diff --git a/Cheats.h b/Cheats.h index aaa041a2..738ff7b9 100644 --- a/Cheats.h +++ b/Cheats.h @@ -32,30 +32,30 @@ extern UINT8 gubCheatLevel; #ifdef GERMAN - // ATE: remove cheats unless we're doing a debug build + // ATE: remove cheats unless we're doing a debug build //#ifdef JA2TESTVERSION #define INFORMATION_CHEAT_LEVEL( ) ( gubCheatLevel >= 5 ) #define CHEATER_CHEAT_LEVEL( ) ( gubCheatLevel >= 6 ) - #define DEBUG_CHEAT_LEVEL( ) ( gubCheatLevel >= 7 ) + #define DEBUG_CHEAT_LEVEL( ) ( gubCheatLevel >= 7 ) //#else // #define INFORMATION_CHEAT_LEVEL( ) ( FALSE ) // #define CHEATER_CHEAT_LEVEL( ) ( FALSE ) -// #define DEBUG_CHEAT_LEVEL( ) ( FALSE ) +// #define DEBUG_CHEAT_LEVEL( ) ( FALSE ) //#endif #define RESET_CHEAT_LEVEL( ) ( gubCheatLevel = 0 ) #else - // ATE: remove cheats unless we're doing a debug build + // ATE: remove cheats unless we're doing a debug build //#ifdef JA2TESTVERSION #define INFORMATION_CHEAT_LEVEL( ) ( gubCheatLevel >= 3 ) #define CHEATER_CHEAT_LEVEL( ) ( gubCheatLevel >= 5 ) - #define DEBUG_CHEAT_LEVEL( ) ( gubCheatLevel >= 6 ) + #define DEBUG_CHEAT_LEVEL( ) ( gubCheatLevel >= 6 ) //#else // #define INFORMATION_CHEAT_LEVEL( ) ( FALSE ) // #define CHEATER_CHEAT_LEVEL( ) ( FALSE ) -// #define DEBUG_CHEAT_LEVEL( ) ( FALSE ) +// #define DEBUG_CHEAT_LEVEL( ) ( FALSE ) //#endif #define RESET_CHEAT_LEVEL( ) ( gubCheatLevel = 0 ) diff --git a/Console/ComBSTROut.h b/Console/ComBSTROut.h index 07ffa38f..62bac6b8 100644 --- a/Console/ComBSTROut.h +++ b/Console/ComBSTROut.h @@ -9,26 +9,26 @@ // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Send bug reports, bug fixes, enhancements, requests, flames, etc., and -// I'll try to keep a version up to date. I can be reached as follows: -// marko.bozikovic@alterbox.net -// bozho@kset.org +// I'll try to keep a version up to date. I can be reached as follows: +// marko.bozikovic@alterbox.net +// bozho@kset.org ///////////////////////////////////////////////////////////////////////////// #ifndef _COMBSTROUT_H_ #define _COMBSTROUT_H_ ///////////////////////////////////////////////////////////////////////////// -// CComBSTROut - a class that inherits from CComBSTR and adds Out() method -// that should be used instead of & operator for 'out' -// function parameters +// CComBSTROut - a class that inherits from CComBSTR and adds Out() method +// that should be used instead of & operator for 'out' +// function parameters class CComBSTROut : public CComBSTR { diff --git a/Console/ComVariantOut.h b/Console/ComVariantOut.h index 085dee0b..0efb673f 100644 --- a/Console/ComVariantOut.h +++ b/Console/ComVariantOut.h @@ -9,17 +9,17 @@ // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Send bug reports, bug fixes, enhancements, requests, flames, etc., and -// I'll try to keep a version up to date. I can be reached as follows: -// marko.bozikovic@alterbox.net -// bozho@kset.org +// I'll try to keep a version up to date. I can be reached as follows: +// marko.bozikovic@alterbox.net +// bozho@kset.org ///////////////////////////////////////////////////////////////////////////// #ifndef _COMVARIANTOUT_H_ @@ -27,8 +27,8 @@ ///////////////////////////////////////////////////////////////////////////// // CComVariantOut - a class that inherits from CComVariant and adds Out() -// method that should be used instead of & operator for -// 'out' function parameters +// method that should be used instead of & operator for +// 'out' function parameters class CComVariantOut : public CComVariant { diff --git a/Console/Console.cpp b/Console/Console.cpp index d07c4bc4..d66996a7 100644 --- a/Console/Console.cpp +++ b/Console/Console.cpp @@ -9,17 +9,17 @@ // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Send bug reports, bug fixes, enhancements, requests, flames, etc., and -// I'll try to keep a version up to date. I can be reached as follows: -// marko.bozikovic@alterbox.net -// bozho@kset.org +// I'll try to keep a version up to date. I can be reached as follows: +// marko.bozikovic@alterbox.net +// bozho@kset.org ///////////////////////////////////////////////////////////////////////////// #ifdef UNICODE @@ -249,7 +249,7 @@ Console::Console(LPCTSTR pszConfigFile, LPCTSTR pszShellCmdLine, LPCTSTR pszCons *stdout = *fp; *stderr = *fp; setvbuf( stdout, NULL, _IONBF, 0 ); - + // create text monitor thread DWORD dwThreadID; m_hMonitorThread = ::CreateThread(NULL, 0, Console::MonitorThreadStatic, this, CREATE_SUSPENDED, &dwThreadID); @@ -263,14 +263,14 @@ Console::~Console() { if (m_hSmallIcon) ::DestroyIcon(m_hSmallIcon); if (m_hBigIcon) ::DestroyIcon(m_hBigIcon); - + // ::CloseHandle(m_hConsoleProcess); // ::CloseHandle(m_hQuitEvent); // shutdown console process // ::CloseHandle(m_hStdOut); // ::CloseHandle(m_hStdOutFresh); -// if (m_hWndConsole) ::SendMessage(m_hWndConsole, WM_CLOSE, 0, 0); +// if (m_hWndConsole) ::SendMessage(m_hWndConsole, WM_CLOSE, 0, 0); // ::FreeConsole(); } @@ -284,7 +284,7 @@ Console::~Console() { // creates and shows Console window BOOL Console::Create(HWND notify) { - + m_notifyhWnd = notify; if (m_hWnd) @@ -294,9 +294,9 @@ BOOL Console::Create(HWND notify) { } if (!GetOptions()) return FALSE; - + if (!RegisterWindowClasses()) return FALSE; - + if (!CreateConsoleWindow()) return FALSE; // create window DC @@ -304,30 +304,30 @@ BOOL Console::Create(HWND notify) { m_hdcConsole = ::CreateCompatibleDC(hdcDesktop); m_hdcWindow = ::CreateCompatibleDC(hdcDesktop); ::ReleaseDC(m_hWnd, hdcDesktop); - + // create selection DC m_hdcSelection = ::CreateCompatibleDC(m_hdcWindow); - + if (!SetupMenus()) return FALSE; CreateNewFont(); CreateNewBrush(); - + // SetWindowTransparency(); SetWindowIcons(); GetTextSize(); GetBordersDimensions(); CreateCursor(); - + // now we can start the monitor thread StartShellProcess(); - + // set the long repaint timer if (m_dwMasterRepaintInt) ::SetTimer(m_hWnd, TIMER_REPAINT_MASTER, m_dwMasterRepaintInt, NULL); - + m_bInitializing = FALSE; - + // register for files/folders drag-n-drop ::DragAcceptFiles(m_hWnd, TRUE); @@ -345,9 +345,9 @@ BOOL Console::Create(HWND notify) { } else { ::ShowWindow(m_hWnd, SW_SHOW); } - + ::SetForegroundWindow(m_hWnd); - + return TRUE; } @@ -360,45 +360,45 @@ BOOL Console::Create(HWND notify) { ///////////////////////////////////////////////////////////////////////////// void Console::OnDestroy() { - + if (!m_bInitializing) { ::SetEvent(m_hQuitEvent); ::WaitForSingleObject(m_hMonitorThread, 2000); ::CloseHandle(m_hMonitorThread); - + // kill timers ::KillTimer(m_hWnd, TIMER_REPAINT_CHANGE); if (m_dwMasterRepaintInt) ::KillTimer(m_hWnd, TIMER_REPAINT_MASTER); - + DestroyCursor(); - + // cleanup graphics objects if (m_hFontOld) ::SelectObject(m_hdcConsole, m_hFontOld); if (m_hFont) ::DeleteObject(m_hFont); - + if (m_hBkBrush) ::DeleteObject(m_hBkBrush); - + if (m_hbmpConsoleOld) ::SelectObject(m_hdcConsole, m_hbmpConsoleOld); if (m_hbmpConsole) ::DeleteObject(m_hbmpConsole); - + if (m_hbmpWindowOld) ::SelectObject(m_hdcWindow, m_hbmpWindowOld); if (m_hbmpWindow) ::DeleteObject(m_hbmpWindow); - + if (m_hbmpBackgroundOld) ::SelectObject(m_hdcBackground, m_hbmpBackgroundOld); if (m_hbmpBackground) ::DeleteObject(m_hbmpBackground); if (m_hdcBackground) ::DeleteDC(m_hdcBackground); - + if (m_hbmpSelectionOld) ::SelectObject(m_hdcSelection, m_hbmpSelectionOld); if (m_hbmpSelection)::DeleteObject(m_hbmpSelection); if (m_hdcSelection) ::DeleteDC(m_hdcSelection); - + if (m_hbrushSelection) ::DeleteObject(m_hbrushSelection); - + ::DestroyMenu(m_hConfigFilesMenu); ::DestroyMenu(m_hPopupMenu); - + SetTrayIcon(NIM_DELETE); - + ::DeleteDC(m_hdcConsole); ::DeleteDC(m_hdcWindow); ::PostQuitMessage(0); @@ -420,58 +420,58 @@ void Console::OnNcDestroy() { ///////////////////////////////////////////////////////////////////////////// void Console::OnPaint() { - + PAINTSTRUCT paintStruct; HDC hdc = ::BeginPaint(m_hWnd, &paintStruct); - + if (!m_nTextSelection) { // if there's no selection, just blit console image ::BitBlt( - hdc, - paintStruct.rcPaint.left, - paintStruct.rcPaint.top, - paintStruct.rcPaint.right - paintStruct.rcPaint.left + 1, - paintStruct.rcPaint.bottom - paintStruct.rcPaint.top + 1, - m_hdcConsole, - paintStruct.rcPaint.left, - paintStruct.rcPaint.top, + hdc, + paintStruct.rcPaint.left, + paintStruct.rcPaint.top, + paintStruct.rcPaint.right - paintStruct.rcPaint.left + 1, + paintStruct.rcPaint.bottom - paintStruct.rcPaint.top + 1, + m_hdcConsole, + paintStruct.rcPaint.left, + paintStruct.rcPaint.top, SRCCOPY); } else { // there's a text selection, first compose the image in an off-screen // buffer, and then blit it ::BitBlt( - m_hdcWindow, - paintStruct.rcPaint.left, - paintStruct.rcPaint.top, - paintStruct.rcPaint.right - paintStruct.rcPaint.left + 1, - paintStruct.rcPaint.bottom - paintStruct.rcPaint.top + 1, - m_hdcConsole, - paintStruct.rcPaint.left, - paintStruct.rcPaint.top, + m_hdcWindow, + paintStruct.rcPaint.left, + paintStruct.rcPaint.top, + paintStruct.rcPaint.right - paintStruct.rcPaint.left + 1, + paintStruct.rcPaint.bottom - paintStruct.rcPaint.top + 1, + m_hdcConsole, + paintStruct.rcPaint.left, + paintStruct.rcPaint.top, SRCCOPY); - + ::BitBlt( - m_hdcWindow, - m_rectSelection.left, - m_rectSelection.top, - m_rectSelection.right - m_rectSelection.left, - m_rectSelection.bottom - m_rectSelection.top, - m_hdcSelection, - 0, - 0, + m_hdcWindow, + m_rectSelection.left, + m_rectSelection.top, + m_rectSelection.right - m_rectSelection.left, + m_rectSelection.bottom - m_rectSelection.top, + m_hdcSelection, + 0, + 0, SRCINVERT); ::BitBlt( - hdc, - paintStruct.rcPaint.left, - paintStruct.rcPaint.top, - paintStruct.rcPaint.right - paintStruct.rcPaint.left + 1, - paintStruct.rcPaint.bottom - paintStruct.rcPaint.top + 1, - m_hdcWindow, - paintStruct.rcPaint.left, - paintStruct.rcPaint.top, + hdc, + paintStruct.rcPaint.left, + paintStruct.rcPaint.top, + paintStruct.rcPaint.right - paintStruct.rcPaint.left + 1, + paintStruct.rcPaint.bottom - paintStruct.rcPaint.top + 1, + m_hdcWindow, + paintStruct.rcPaint.left, + paintStruct.rcPaint.top, SRCCOPY); } - + ::EndPaint(m_hWnd, &paintStruct); } @@ -481,7 +481,7 @@ void Console::OnPaint() { ///////////////////////////////////////////////////////////////////////////// void Console::OnPaintTimer() { - + ::KillTimer(m_hWnd, TIMER_REPAINT_CHANGE); RefreshStdOut(); RefreshScreenBuffer(); @@ -523,28 +523,28 @@ void Console::OnWindowPosChanging(WINDOWPOS* lpWndPos) { m_dwDocked = DOCK_NONE; DWORD dwLeftRight = 0; DWORD dwTopBottom = 0; - + // now, see if we're close to the edges if (lpWndPos->x <= rectDesktop.left + m_nSnapDst) { lpWndPos->x = rectDesktop.left; dwLeftRight = 1; } - + if (lpWndPos->x >= rectDesktop.right - m_nWindowWidth - m_nSnapDst) { lpWndPos->x = rectDesktop.right - m_nWindowWidth; dwLeftRight = 2; } - + if (lpWndPos->y <= rectDesktop.top + m_nSnapDst) { lpWndPos->y = rectDesktop.top; dwTopBottom = 1; } - + if (lpWndPos->y >= rectDesktop.bottom - m_nWindowHeight - m_nSnapDst) { lpWndPos->y = rectDesktop.bottom - m_nWindowHeight; dwTopBottom = 2; } - + // now, see if the window is docked if (dwLeftRight == 1) { // left edge @@ -566,7 +566,7 @@ void Console::OnWindowPosChanging(WINDOWPOS* lpWndPos) { } } } - + m_nX = lpWndPos->x; m_nY = lpWndPos->y; @@ -575,7 +575,7 @@ void Console::OnWindowPosChanging(WINDOWPOS* lpWndPos) { // we need to repaint for relative backgrounds // if (m_bRelativeBackground && !m_bInitializing) RepaintWindow(); } - + if (m_dwCurrentZOrder == Z_ORDER_ONBOTTOM) lpWndPos->hwndInsertAfter = HWND_BOTTOM; } @@ -585,7 +585,7 @@ void Console::OnWindowPosChanging(WINDOWPOS* lpWndPos) { ///////////////////////////////////////////////////////////////////////////// void Console::OnActivateApp(BOOL bActivate, DWORD dwFlags) { - + if (m_pCursor) { m_pCursor->SetState(bActivate); DrawCursor(); @@ -598,7 +598,7 @@ void Console::OnActivateApp(BOOL bActivate, DWORD dwFlags) { } else { g_pfnSetLayeredWndAttr(m_hWnd, m_crBackground, m_byInactiveAlpha, LWA_ALPHA); } - + } #endif } @@ -609,63 +609,63 @@ void Console::OnActivateApp(BOOL bActivate, DWORD dwFlags) { ///////////////////////////////////////////////////////////////////////////// void Console::OnVScroll(WPARAM wParam) { - + // TRACE(_T("VScroll\n")); int nCurrentPos = ::GetScrollPos(m_hWnd, SB_VERT); int nDelta = 0; - - switch(LOWORD (wParam)) { - - case SB_PAGEUP: - nDelta = -5; - break; - - case SB_PAGEDOWN: - nDelta = 5; - break; - - case SB_LINEUP: - nDelta = -1; - break; - - case SB_LINEDOWN: - nDelta = 1; - break; - - case SB_THUMBTRACK: - nDelta = HIWORD(wParam) - nCurrentPos; + + switch(LOWORD (wParam)) { + + case SB_PAGEUP: + nDelta = -5; break; - + + case SB_PAGEDOWN: + nDelta = 5; + break; + + case SB_LINEUP: + nDelta = -1; + break; + + case SB_LINEDOWN: + nDelta = 1; + break; + + case SB_THUMBTRACK: + nDelta = HIWORD(wParam) - nCurrentPos; + break; + case SB_ENDSCROLL: - + return; - - default: + + default: return; } - + if ((nDelta = max(-nCurrentPos, min(nDelta, (int)(m_dwBufferRows-m_dwRows) - nCurrentPos))) != 0) { - - nCurrentPos += nDelta; - + + nCurrentPos += nDelta; + SMALL_RECT sr; sr.Top = (short) nCurrentPos; // sr.Bottom = nDelta; sr.Left = sr.Right = 0; m_csbiConsole.srWindow = sr; // ::SetConsoleWindowInfo(m_hStdOutFresh, FALSE, &sr); - + SCROLLINFO si; - si.cbSize = sizeof(si); - si.fMask = SIF_POS; - si.nPos = nCurrentPos; + si.cbSize = sizeof(si); + si.fMask = SIF_POS; + si.nPos = nCurrentPos; ::FlatSB_SetScrollInfo(m_hWnd, SB_VERT, &si, TRUE); - + // this seems to work/look much better than direct repainting... ::SetTimer(m_hWnd, TIMER_REPAINT_CHANGE, m_dwChangeRepaintInt, NULL); } - + } ///////////////////////////////////////////////////////////////////////////// @@ -683,24 +683,24 @@ void Console::OnInputLangChangeRequest(WPARAM wParam, LPARAM lParam) { ///////////////////////////////////////////////////////////////////////////// void Console::OnLButtonDown(UINT uiFlags, POINTS points) { -#if 0 +#if 0 RECT windowRect; ::GetCursorPos(&m_mouseCursorOffset); ::GetWindowRect(m_hWnd, &windowRect); m_mouseCursorOffset.x -= windowRect.left; m_mouseCursorOffset.y -= windowRect.top; - + if (!m_bMouseDragable || (m_bInverseShift == !(uiFlags & MK_SHIFT))) { - + if (m_nCharWidth) { - + if (m_nTextSelection == TEXT_SELECTION_SELECTED) return; - + // fixed-width characters // start copy text selection ::SetCapture(m_hWnd); - + if (!m_nTextSelection) { RECT rect; rect.left = 0; @@ -709,18 +709,18 @@ void Console::OnLButtonDown(UINT uiFlags, POINTS points) { rect.bottom = m_nClientHeight; ::FillRect(m_hdcSelection, &rect, m_hbrushSelection); } - + m_nTextSelection = TEXT_SELECTION_SELECTING; - + m_coordSelOrigin.X = min(max(points.x - m_nInsideBorder, 0) / m_nCharWidth, m_dwColumns-1); m_coordSelOrigin.Y = min(max(points.y - m_nInsideBorder, 0) / m_nCharHeight, m_dwRows-1); - + m_rectSelection.left = m_rectSelection.right = m_coordSelOrigin.X * m_nCharWidth + m_nInsideBorder; m_rectSelection.top = m_rectSelection.bottom = m_coordSelOrigin.Y * m_nCharHeight + m_nInsideBorder; - + TRACE(_T("Starting point: %ix%i\n"), m_coordSelOrigin.X, m_coordSelOrigin.Y); } - + } else { if (m_nTextSelection) { return; @@ -742,31 +742,31 @@ void Console::OnLButtonUp(UINT uiFlags, POINTS points) { if ((m_nTextSelection == TEXT_SELECTION_SELECTED) || // X Windows select/copy style ((m_nTextSelection == TEXT_SELECTION_SELECTING) && (m_bCopyOnSelect))) { - + // if the user clicked inside the selection rectangle, copy data - if ((points.x >= m_rectSelection.left) && - (points.x <= m_rectSelection.right) && - (points.y >= m_rectSelection.top) && + if ((points.x >= m_rectSelection.left) && + (points.x <= m_rectSelection.right) && + (points.y >= m_rectSelection.top) && (points.y <= m_rectSelection.bottom)) { - + CopyTextToClipboard(); } - + if (m_bCopyOnSelect) ::ReleaseCapture(); ClearSelection(); - + } else if (m_nTextSelection == TEXT_SELECTION_SELECTING) { if ((m_rectSelection.left == m_rectSelection.right) && (m_rectSelection.top == m_rectSelection.bottom)) { m_nTextSelection = TEXT_SELECTION_NONE; - + } else { m_nTextSelection = TEXT_SELECTION_SELECTED; } ::ReleaseCapture(); - + } else if (m_bMouseDragable) { // end window drag ::ReleaseCapture(); @@ -779,7 +779,7 @@ void Console::OnLButtonUp(UINT uiFlags, POINTS points) { ///////////////////////////////////////////////////////////////////////////// void Console::OnLButtonDblClick(UINT uiFlags, POINTS points) { - + // ToggleWindowOnTop(); } @@ -789,7 +789,7 @@ void Console::OnLButtonDblClick(UINT uiFlags, POINTS points) { ///////////////////////////////////////////////////////////////////////////// void Console::OnRButtonUp(UINT uiFlags, POINTS points) { - + if (uiFlags & MK_SHIFT) { PasteClipoardText(); } else { @@ -800,9 +800,9 @@ void Console::OnRButtonUp(UINT uiFlags, POINTS points) { point.x = points.x; point.y = points.y; ::ClientToScreen(m_hWnd, &point); - + HMENU hPopup = ::GetSubMenu(m_hPopupMenu, 0); - + // show popup menu ::TrackPopupMenu(hPopup, 0, point.x, point.y, 0, m_hWnd, NULL); } @@ -833,20 +833,20 @@ void Console::OnMouseMove(UINT uiFlags, POINTS points) { if (uiFlags & MK_LBUTTON) { ::GetWindowRect(m_hWnd, &windowRect); - + point.x = points.x; point.y = points.y; - + ::ClientToScreen(m_hWnd, &point); - + deltaX = point.x - windowRect.left - m_mouseCursorOffset.x; deltaY = point.y - windowRect.top - m_mouseCursorOffset.y; - + if (deltaX | deltaY) { // TRACE(_T("m_nTextSelection: %i, Delta X: %i Delta Y: %i\n"), m_nTextSelection, deltaX, deltaY); - if (m_nTextSelection) { + if (m_nTextSelection) { if ((!m_bMouseDragable) || (m_bInverseShift == !(uiFlags & MK_SHIFT))) { // some text has been selected, just return @@ -856,12 +856,12 @@ void Console::OnMouseMove(UINT uiFlags, POINTS points) { COORD coordSel; ::InvalidateRect(m_hWnd, &m_rectSelection, FALSE); - + coordSel.X = min(max(points.x - m_nInsideBorder, 0) / m_nCharWidth, m_dwColumns-1); coordSel.Y = min(max(points.y - m_nInsideBorder, 0) / m_nCharHeight, m_dwRows-1); // TRACE(_T("End point: %ix%i\n"), coordSel.X, coordSel.Y); - + if (coordSel.X >= m_coordSelOrigin.X) { m_rectSelection.left = m_coordSelOrigin.X * m_nCharWidth + m_nInsideBorder; m_rectSelection.right = (coordSel.X + 1) * m_nCharWidth + m_nInsideBorder; @@ -869,7 +869,7 @@ void Console::OnMouseMove(UINT uiFlags, POINTS points) { m_rectSelection.left = coordSel.X * m_nCharWidth + m_nInsideBorder; m_rectSelection.right = (m_coordSelOrigin.X + 1) * m_nCharWidth + m_nInsideBorder; } - + if (coordSel.Y >= m_coordSelOrigin.Y) { m_rectSelection.top = m_coordSelOrigin.Y * m_nCharHeight + m_nInsideBorder; m_rectSelection.bottom = (coordSel.Y + 1) * m_nCharHeight + m_nInsideBorder; @@ -882,7 +882,7 @@ void Console::OnMouseMove(UINT uiFlags, POINTS points) { ::InvalidateRect(m_hWnd, &m_rectSelection, FALSE); } - + } else if (m_bMouseDragable) { // moving the window @@ -892,13 +892,13 @@ void Console::OnMouseMove(UINT uiFlags, POINTS points) { case Z_ORDER_ONTOP : hwndZ = HWND_TOPMOST; break; case Z_ORDER_ONBOTTOM : hwndZ = HWND_BOTTOM; break; } - + ::SetWindowPos( - m_hWnd, - hwndZ, - windowRect.left + deltaX, - windowRect.top + deltaY, - 0, + m_hWnd, + hwndZ, + windowRect.left + deltaX, + windowRect.top + deltaY, + 0, 0, SWP_NOSIZE); @@ -966,7 +966,7 @@ void Console::OnChar(WORD myChar) { ///////////////////////////////////////////////////////////////////////////// void Console::OnSetCursor(WORD wHitTest, WORD wMouseMessage) { - + if (wHitTest == HTBORDER) { if (wMouseMessage == WM_LBUTTONDOWN) { if (m_bMouseDragable) { @@ -993,7 +993,7 @@ void Console::OnSetCursor(WORD wHitTest, WORD wMouseMessage) { ///////////////////////////////////////////////////////////////////////////// void Console::OnInitMenuPopup(HMENU hMenu, UINT uiPos, BOOL bSysMenu) { - + if ((hMenu != ::GetSubMenu(m_hPopupMenu, 0)) && (hMenu != m_hSysMenu)) return; // update configuration files submenu @@ -1006,7 +1006,7 @@ void Console::OnInitMenuPopup(HMENU hMenu, UINT uiPos, BOOL bSysMenu) { ///////////////////////////////////////////////////////////////////////////// void Console::OnDropFiles(HDROP hDrop) { - + UINT uiFilesCount = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0); tstring strFilenames(_T("")); @@ -1014,14 +1014,14 @@ void Console::OnDropFiles(HDROP hDrop) { for (UINT i = 0; i < uiFilesCount; ++i) { TCHAR szFilename[MAX_PATH]; ::ZeroMemory(szFilename, sizeof(szFilename)); - + ::DragQueryFile(hDrop, i, szFilename, MAX_PATH); tstring strFilename(szFilename); // if there are spaces in the filename, put quotes around it if (strFilename.find(_T(" ")) != tstring::npos) strFilename = tstring(_T("\"")) + strFilename + tstring(_T("\"")); - + if (i > 0) strFilenames += _T(" "); strFilenames += strFilename; @@ -1043,7 +1043,7 @@ BOOL Console::OnCommand(WPARAM wParam, LPARAM lParam) // popup menu return HandleMenuCommand(LOWORD(wParam)); } - + return TRUE; } @@ -1053,7 +1053,7 @@ BOOL Console::OnCommand(WPARAM wParam, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////// BOOL Console::OnSysCommand(WPARAM wParam, LPARAM lParam) { - + return HandleMenuCommand(wParam); } @@ -1063,35 +1063,35 @@ BOOL Console::OnSysCommand(WPARAM wParam, LPARAM lParam) { ///////////////////////////////////////////////////////////////////////////// void Console::OnTrayNotify(WPARAM wParam, LPARAM lParam) { - + switch (lParam) { case WM_RBUTTONUP: { if (m_bPopupMenuDisabled) return; POINT posCursor; - + ::GetCursorPos(&posCursor); // show popup menu ::SetForegroundWindow(m_hWnd); ::TrackPopupMenu(::GetSubMenu(m_hPopupMenu, 0), 0, posCursor.x, posCursor.y, 0, m_hWnd, NULL); ::PostMessage(m_hWnd, WM_NULL, 0, 0); - + return; - } - - case WM_LBUTTONDOWN: + } + + case WM_LBUTTONDOWN: m_bHideWindow = false; ShowHideWindow(); ::SetForegroundWindow(m_hWnd); return; - + case WM_LBUTTONDBLCLK: m_bHideWindow = !m_bHideWindow; ShowHideWindow(); ::SetForegroundWindow(m_hWnd); return; - + default : return; } } @@ -1103,13 +1103,13 @@ void Console::OnTrayNotify(WPARAM wParam, LPARAM lParam) { #if 0 void Console::OnWallpaperChanged(const TCHAR* pszFilename) { - + if (m_dwTransparency == TRANSPARENCY_FAKE) { SetWindowTransparency(); CreateBackgroundBitmap(); RepaintWindow(); } - + } #endif @@ -1119,15 +1119,15 @@ void Console::OnWallpaperChanged(const TCHAR* pszFilename) { ///////////////////////////////////////////////////////////////////////////// BOOL Console::GetOptions() { - + #if 0 class XmlException { public: XmlException(BOOL bRet) : m_bRet(bRet){}; BOOL m_bRet; }; - + BOOL bRet = FALSE; - + IStream* pFileStream = NULL; IXMLDocument* pConfigDoc = NULL; IPersistStreamInit* pPersistStream = NULL; @@ -1140,54 +1140,54 @@ BOOL Console::GetOptions() { IXMLElement* pBackgroundElement = NULL; IXMLElement* pCursorElement = NULL; IXMLElement* pBehaviorElement = NULL; - + try { ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); - + USES_CONVERSION; - + // open file stream if (!SUCCEEDED(CreateFileStream( - m_strConfigFile.c_str(), + m_strConfigFile.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, - 0, + 0, NULL, &pFileStream))) { - + throw XmlException(FALSE); } - + // create XML document instance if (!SUCCEEDED(::CoCreateInstance( - CLSID_XMLDocument, - NULL, - CLSCTX_INPROC_SERVER, - IID_IXMLDocument, + CLSID_XMLDocument, + NULL, + CLSCTX_INPROC_SERVER, + IID_IXMLDocument, (void**)&pConfigDoc))) { - + throw XmlException(FALSE); } - + // load the configuration file pConfigDoc->QueryInterface(IID_IPersistStreamInit, (void **)&pPersistStream); - + if (!SUCCEEDED(pPersistStream->Load(pFileStream))) throw XmlException(FALSE); - + // see if we're dealing with the skin if (!SUCCEEDED(pConfigDoc->get_root(&pRootElement))) throw XmlException(FALSE); - + CComVariantOut varAttValue; CComBSTROut bstr; CComBSTROut strText; tstring strTempText(_T("")); - + // root element must be CONSOLE pRootElement->get_tagName(bstr.Out()); bstr.ToUpper(); - + if (!(bstr == CComBSTR(_T("CONSOLE")))) throw XmlException(FALSE); pRootElement->getAttribute(CComBSTR(_T("title")), varAttValue.Out()); @@ -1195,23 +1195,23 @@ BOOL Console::GetOptions() { m_strWindowTitle = OLE2T(varAttValue.bstrVal); m_strWindowTitleCurrent = m_strWindowTitle; } - + pRootElement->getAttribute(CComBSTR(_T("refresh")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) m_dwMasterRepaintInt = _ttol(OLE2T(varAttValue.bstrVal)); - + pRootElement->getAttribute(CComBSTR(_T("change_refresh")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) m_dwChangeRepaintInt = _ttol(OLE2T(varAttValue.bstrVal)); if ((int)m_dwChangeRepaintInt < 5) m_dwChangeRepaintInt = 5; - + pRootElement->getAttribute(CComBSTR(_T("shell")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) m_strShell = OLE2T(varAttValue.bstrVal); - + pRootElement->getAttribute(CComBSTR(_T("editor")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) m_strConfigEditor = OLE2T(varAttValue.bstrVal); pRootElement->getAttribute(CComBSTR(_T("editor_params")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) m_strConfigEditorParams = OLE2T(varAttValue.bstrVal); - + pRootElement->get_children(&pColl); if (!pColl) throw XmlException(TRUE); @@ -1223,7 +1223,7 @@ BOOL Console::GetOptions() { if (pFontColl) { IXMLElement* pFontSubelement = NULL; - + if (!SUCCEEDED(pFontColl->item(CComVariant(_T("size")), CComVariant(0), (IDispatch**)&pFontSubelement))) throw XmlException(FALSE); if (pFontSubelement) { pFontSubelement->get_text(strText.Out()); @@ -1237,27 +1237,27 @@ BOOL Console::GetOptions() { m_bItalic = !_tcsicmp(OLE2T(strText), _T("true")); } SAFERELEASE(pFontSubelement); - + if (!SUCCEEDED(pFontColl->item(CComVariant(_T("bold")), CComVariant(0), (IDispatch**)&pFontSubelement))) throw XmlException(FALSE); if (pFontSubelement) { pFontSubelement->get_text(strText.Out()); m_bBold = !_tcsicmp(OLE2T(strText), _T("true")); } SAFERELEASE(pFontSubelement); - + if (!SUCCEEDED(pFontColl->item(CComVariant(_T("name")), CComVariant(0), (IDispatch**)&pFontSubelement))) throw XmlException(FALSE); if (pFontSubelement) { pFontSubelement->get_text(strText.Out()); if (strText.Length() > 0) m_strFontName = OLE2T(strText); } SAFERELEASE(pFontSubelement); - + if (!SUCCEEDED(pFontColl->item(CComVariant(_T("color")), CComVariant(0), (IDispatch**)&pFontSubelement))) throw XmlException(FALSE); if (pFontSubelement) { BYTE r = 0; BYTE g = 0; BYTE b = 0; - + varAttValue.Clear(); pFontSubelement->getAttribute(CComBSTR(_T("r")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) r = _ttoi(OLE2T(varAttValue.bstrVal)); @@ -1267,7 +1267,7 @@ BOOL Console::GetOptions() { varAttValue.Clear(); pFontSubelement->getAttribute(CComBSTR(_T("b")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) b = _ttoi(OLE2T(varAttValue.bstrVal)); - + m_bUseFontColor = TRUE; m_crFontColor = RGB(r, g, b); } @@ -1278,9 +1278,9 @@ BOOL Console::GetOptions() { if (pFontSubelement) { IXMLElementCollection* pColorsColl = NULL; - + if (!SUCCEEDED(pFontSubelement->get_children(&pColorsColl))) throw XmlException(FALSE); - + if (pColorsColl) { for (int i = 0; i < 16; ++i) { @@ -1288,14 +1288,14 @@ BOOL Console::GetOptions() { TCHAR szColorName[32]; _sntprintf(szColorName, sizeof(szColorName)/sizeof(TCHAR), _T("color_%02i"), i); - + if (!SUCCEEDED(pColorsColl->item(CComVariant(szColorName), CComVariant(0), (IDispatch**)&pColorSubelement))) throw XmlException(FALSE); if (pColorSubelement) { BYTE r = 0; BYTE g = 0; BYTE b = 0; - + varAttValue.Clear(); pColorSubelement->getAttribute(CComBSTR(_T("r")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) r = _ttoi(OLE2T(varAttValue.bstrVal)); @@ -1305,7 +1305,7 @@ BOOL Console::GetOptions() { varAttValue.Clear(); pColorSubelement->getAttribute(CComBSTR(_T("b")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) b = _ttoi(OLE2T(varAttValue.bstrVal)); - + Console::m_arrConsoleColors[i] = RGB(r, g, b); } @@ -1315,19 +1315,19 @@ BOOL Console::GetOptions() { SAFERELEASE(pColorsColl); } SAFERELEASE(pFontSubelement); - } + } SAFERELEASE(pFontColl); } - + // get position settings IXMLElementCollection* pPositionColl = NULL; if (!SUCCEEDED(pColl->item(CComVariant(_T("position")), CComVariant(0), (IDispatch**)&pPositionElement))) throw XmlException(FALSE); if (pPositionElement) { if (!SUCCEEDED(pPositionElement->get_children(&pPositionColl))) throw XmlException(FALSE); - + if (pPositionColl) { IXMLElement* pPositionSubelement = NULL; - + if (!m_bReloading) { if (!SUCCEEDED(pPositionColl->item(CComVariant(_T("x")), CComVariant(0), (IDispatch**)&pPositionSubelement))) throw XmlException(FALSE); if (pPositionSubelement) { @@ -1335,7 +1335,7 @@ BOOL Console::GetOptions() { if (strText.Length() > 0) m_nX = _ttoi(OLE2T(strText)); } SAFERELEASE(pPositionSubelement); - + if (!SUCCEEDED(pPositionColl->item(CComVariant(_T("y")), CComVariant(0), (IDispatch**)&pPositionSubelement))) throw XmlException(FALSE); if (pPositionSubelement) { pPositionSubelement->get_text(strText.Out()); @@ -1343,12 +1343,12 @@ BOOL Console::GetOptions() { } SAFERELEASE(pPositionSubelement); } - + if (!SUCCEEDED(pPositionColl->item(CComVariant(_T("docked")), CComVariant(0), (IDispatch**)&pPositionSubelement))) throw XmlException(FALSE); if (pPositionSubelement) { pPositionSubelement->get_text(strText.Out()); strTempText = OLE2T(strText); - + if (!_tcsicmp(strTempText.c_str(), _T("top left"))) { m_dwDocked = DOCK_TOP_LEFT; } else if (!_tcsicmp(strTempText.c_str(), _T("top right"))) { @@ -1362,19 +1362,19 @@ BOOL Console::GetOptions() { } } SAFERELEASE(pPositionSubelement); - + if (!SUCCEEDED(pPositionColl->item(CComVariant(_T("snap_distance")), CComVariant(0), (IDispatch**)&pPositionSubelement))) throw XmlException(FALSE); if (pPositionSubelement) { pPositionSubelement->get_text(strText.Out()); if (strText.Length() > 0) m_nSnapDst = _ttoi(OLE2T(strText)); } SAFERELEASE(pPositionSubelement); - + if (!SUCCEEDED(pPositionColl->item(CComVariant(_T("z_order")), CComVariant(0), (IDispatch**)&pPositionSubelement))) throw XmlException(FALSE); if (pPositionSubelement) { pPositionSubelement->get_text(strText.Out()); strTempText = OLE2T(strText); - + if (!_tcsicmp(strTempText.c_str(), _T("regular"))) { m_dwCurrentZOrder = Z_ORDER_REGULAR; m_dwOriginalZOrder = Z_ORDER_REGULAR; @@ -1391,7 +1391,7 @@ BOOL Console::GetOptions() { } SAFERELEASE(pPositionSubelement); } - + SAFERELEASE(pPositionColl); } @@ -1400,7 +1400,7 @@ BOOL Console::GetOptions() { if (!SUCCEEDED(pColl->item(CComVariant(_T("appearance")), CComVariant(0), (IDispatch**)&pAppearanceElement))) throw XmlException(FALSE); if (pAppearanceElement) { if (!SUCCEEDED(pAppearanceElement->get_children(&pAppearanceColl))) throw XmlException(FALSE); - + if (pAppearanceColl) { IXMLElement* pAppearanaceSubelement = NULL; @@ -1437,32 +1437,32 @@ BOOL Console::GetOptions() { if (!SUCCEEDED(pAppearanceColl->item(CComVariant(_T("scrollbar")), CComVariant(0), (IDispatch**)&pScrollbarElement))) throw XmlException(FALSE); if (pScrollbarElement) { if (!SUCCEEDED(pScrollbarElement->get_children(&pScrollbarColl))) throw XmlException(FALSE); - + if (pScrollbarColl) { IXMLElement* pScrollbarSubelement = NULL; - + if (!SUCCEEDED(pScrollbarColl->item(CComVariant(_T("color")), CComVariant(0), (IDispatch**)&pScrollbarSubelement))) throw XmlException(FALSE); if (pScrollbarSubelement) { BYTE r = 0; BYTE g = 0; BYTE b = 0; - + pScrollbarSubelement->getAttribute(CComBSTR(_T("r")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) r = _ttoi(OLE2T(varAttValue.bstrVal)); pScrollbarSubelement->getAttribute(CComBSTR(_T("g")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) g = _ttoi(OLE2T(varAttValue.bstrVal)); pScrollbarSubelement->getAttribute(CComBSTR(_T("b")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) b = _ttoi(OLE2T(varAttValue.bstrVal)); - + m_crScrollbarColor = RGB(r, g, b); } SAFERELEASE(pScrollbarSubelement); - + if (!SUCCEEDED(pScrollbarColl->item(CComVariant(_T("style")), CComVariant(0), (IDispatch**)&pScrollbarSubelement))) throw XmlException(FALSE); if (pScrollbarSubelement) { pScrollbarSubelement->get_text(strText.Out()); strTempText = OLE2T(strText); - + if (!_tcsicmp(strTempText.c_str(), _T("regular"))) { m_nScrollbarStyle = FSB_REGULAR_MODE; } else if (!_tcsicmp(strTempText.c_str(), _T("flat"))) { @@ -1480,7 +1480,7 @@ BOOL Console::GetOptions() { if (strText.Length() > 0) m_nScrollbarWidth = _ttoi(OLE2T(strText)); } SAFERELEASE(pScrollbarSubelement); - + if (!SUCCEEDED(pScrollbarColl->item(CComVariant(_T("button_height")), CComVariant(0), (IDispatch**)&pScrollbarSubelement))) throw XmlException(FALSE); if (pScrollbarSubelement) { pScrollbarSubelement->get_text(strText.Out()); @@ -1517,13 +1517,13 @@ BOOL Console::GetOptions() { if (strText.Length() > 0) m_nInsideBorder = _ttoi(OLE2T(strText)); } SAFERELEASE(pAppearanaceSubelement); - + if (!SUCCEEDED(pAppearanceColl->item(CComVariant(_T("taskbar_button")), CComVariant(0), (IDispatch**)&pAppearanaceSubelement))) throw XmlException(FALSE); if (pAppearanaceSubelement) { pAppearanaceSubelement->get_text(strText.Out()); if (!_tcsicmp(OLE2T(strText), _T("hide"))) { m_dwTaskbarButton = TASKBAR_BUTTON_HIDE; - } else if (!_tcsicmp(OLE2T(strText), _T("tray"))) { + } else if (!_tcsicmp(OLE2T(strText), _T("tray"))) { m_dwTaskbarButton = TASKBAR_BUTTON_TRAY; } else { m_dwTaskbarButton = TASKBAR_BUTTON_NORMAL; @@ -1533,7 +1533,7 @@ BOOL Console::GetOptions() { if (!SUCCEEDED(pAppearanceColl->item(CComVariant(_T("size")), CComVariant(0), (IDispatch**)&pAppearanaceSubelement))) throw XmlException(FALSE); if (pAppearanaceSubelement) { - + pAppearanaceSubelement->getAttribute(CComBSTR(_T("rows")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) { if (_tcsicmp(OLE2T(varAttValue.bstrVal), _T("max")) == 0) { @@ -1561,7 +1561,7 @@ BOOL Console::GetOptions() { } } SAFERELEASE(pAppearanaceSubelement); - + if (!SUCCEEDED(pAppearanceColl->item(CComVariant(_T("transparency")), CComVariant(0), (IDispatch**)&pAppearanaceSubelement))) throw XmlException(FALSE); if (pAppearanaceSubelement) { pAppearanaceSubelement->getAttribute(CComBSTR(_T("alpha")), varAttValue.Out()); @@ -1571,7 +1571,7 @@ BOOL Console::GetOptions() { pAppearanaceSubelement->get_text(strText.Out()); strTempText = OLE2T(strText); - + if (!_tcsicmp(strTempText.c_str(), _T("none"))) { m_dwTransparency = TRANSPARENCY_NONE; } else if (!_tcsicmp(strTempText.c_str(), _T("alpha"))) { @@ -1581,32 +1581,32 @@ BOOL Console::GetOptions() { } else if (!_tcsicmp(strTempText.c_str(), _T("fake"))) { m_dwTransparency = TRANSPARENCY_FAKE; } - + } SAFERELEASE(pAppearanaceSubelement); - + // get background settings IXMLElementCollection* pBackgroundColl = NULL; if (!SUCCEEDED(pAppearanceColl->item(CComVariant(_T("background")), CComVariant(0), (IDispatch**)&pBackgroundElement))) throw XmlException(FALSE); if (pBackgroundElement) { if (!SUCCEEDED(pBackgroundElement->get_children(&pBackgroundColl))) throw XmlException(FALSE); - + if (pBackgroundColl) { IXMLElement* pBackgroundSubelement = NULL; - + if (!SUCCEEDED(pBackgroundColl->item(CComVariant(_T("color")), CComVariant(0), (IDispatch**)&pBackgroundSubelement))) throw XmlException(FALSE); if (pBackgroundSubelement) { BYTE r = 0; BYTE g = 0; BYTE b = 0; - + pBackgroundSubelement->getAttribute(CComBSTR(_T("r")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) r = _ttoi(OLE2T(varAttValue.bstrVal)); pBackgroundSubelement->getAttribute(CComBSTR(_T("g")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) g = _ttoi(OLE2T(varAttValue.bstrVal)); pBackgroundSubelement->getAttribute(CComBSTR(_T("b")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) b = _ttoi(OLE2T(varAttValue.bstrVal)); - + m_crBackground = RGB(r, g, b); } SAFERELEASE(pBackgroundSubelement); @@ -1616,14 +1616,14 @@ BOOL Console::GetOptions() { BYTE r = 0; BYTE g = 0; BYTE b = 0; - + pBackgroundSubelement->getAttribute(CComBSTR(_T("r")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) r = _ttoi(OLE2T(varAttValue.bstrVal)); pBackgroundSubelement->getAttribute(CComBSTR(_T("g")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) g = _ttoi(OLE2T(varAttValue.bstrVal)); pBackgroundSubelement->getAttribute(CComBSTR(_T("b")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) b = _ttoi(OLE2T(varAttValue.bstrVal)); - + m_crConsoleBackground = RGB(r, g, b); } SAFERELEASE(pBackgroundSubelement); @@ -1633,7 +1633,7 @@ BOOL Console::GetOptions() { BYTE r = 0; BYTE g = 0; BYTE b = 0; - + pBackgroundSubelement->getAttribute(CComBSTR(_T("r")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) m_byTintR = _ttoi(OLE2T(varAttValue.bstrVal)); pBackgroundSubelement->getAttribute(CComBSTR(_T("g")), varAttValue.Out()); @@ -1642,12 +1642,12 @@ BOOL Console::GetOptions() { if (varAttValue.vt == VT_BSTR) m_byTintB = _ttoi(OLE2T(varAttValue.bstrVal)); pBackgroundSubelement->getAttribute(CComBSTR(_T("opacity")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) m_byTintOpacity = _ttoi(OLE2T(varAttValue.bstrVal)); - + if (m_byTintOpacity > 100) m_byTintOpacity = 50; - m_bTintSet = TRUE; + m_bTintSet = TRUE; } SAFERELEASE(pBackgroundSubelement); - + if (!SUCCEEDED(pBackgroundColl->item(CComVariant(_T("image")), CComVariant(0), (IDispatch**)&pBackgroundSubelement))) throw XmlException(FALSE); if (pBackgroundSubelement) { @@ -1679,7 +1679,7 @@ BOOL Console::GetOptions() { m_bExtendBackground = FALSE; } } - + pBackgroundSubelement->get_text(strText.Out()); m_strBackgroundFile = OLE2T(strText); m_bBitmapBackground = TRUE; @@ -1688,12 +1688,12 @@ BOOL Console::GetOptions() { } SAFERELEASE(pBackgroundColl); } - + IXMLElementCollection* pCursorColl = NULL; if (!SUCCEEDED(pAppearanceColl->item(CComVariant(_T("cursor")), CComVariant(0), (IDispatch**)&pCursorElement))) throw XmlException(FALSE); if (pCursorElement) { if (!SUCCEEDED(pCursorElement->get_children(&pCursorColl))) throw XmlException(FALSE); - + if (pCursorColl) { IXMLElement* pCursorSubelement = NULL; @@ -1702,23 +1702,23 @@ BOOL Console::GetOptions() { BYTE r = 0; BYTE g = 0; BYTE b = 0; - + pCursorSubelement->getAttribute(CComBSTR(_T("r")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) r = _ttoi(OLE2T(varAttValue.bstrVal)); pCursorSubelement->getAttribute(CComBSTR(_T("g")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) g = _ttoi(OLE2T(varAttValue.bstrVal)); pCursorSubelement->getAttribute(CComBSTR(_T("b")), varAttValue.Out()); if (varAttValue.vt == VT_BSTR) b = _ttoi(OLE2T(varAttValue.bstrVal)); - + m_crCursorColor = RGB(r, g, b); } SAFERELEASE(pCursorSubelement); - + if (!SUCCEEDED(pCursorColl->item(CComVariant(_T("style")), CComVariant(0), (IDispatch**)&pCursorSubelement))) throw XmlException(FALSE); if (pCursorSubelement) { pCursorSubelement->get_text(strText.Out()); strTempText = OLE2T(strText); - + if (!_tcsicmp(strTempText.c_str(), _T("none"))) { m_dwCursorStyle = CURSOR_STYLE_NONE; } else if (!_tcsicmp(strTempText.c_str(), _T("XTerm"))) { @@ -1753,14 +1753,14 @@ BOOL Console::GetOptions() { } SAFERELEASE(pCursorColl); } - + if (!SUCCEEDED(pAppearanceColl->item(CComVariant(_T("icon")), CComVariant(0), (IDispatch**)&pAppearanaceSubelement))) throw XmlException(FALSE); if (pAppearanaceSubelement) { pAppearanaceSubelement->get_text(strText.Out()); if (strText.Length() > 0) m_strIconFilename = OLE2T(strText); } SAFERELEASE(pAppearanaceSubelement); - + } SAFERELEASE(pAppearanceColl); } @@ -1773,10 +1773,10 @@ BOOL Console::GetOptions() { if (pBehaviorElement) { if (!SUCCEEDED(pBehaviorElement->get_children(&pBehaviorColl))) throw XmlException(FALSE); - + if (pBehaviorColl) { IXMLElement* pBehaviourSubelement = NULL; - + if (!SUCCEEDED(pBehaviorColl->item(CComVariant(_T("mouse_drag")), CComVariant(0), (IDispatch**)&pBehaviourSubelement))) throw XmlException(FALSE); if (pBehaviourSubelement) { pBehaviourSubelement->get_text(strText.Out()); @@ -1787,7 +1787,7 @@ BOOL Console::GetOptions() { } } SAFERELEASE(pBehaviourSubelement); - + if (!SUCCEEDED(pBehaviorColl->item(CComVariant(_T("copy_on_select")), CComVariant(0), (IDispatch**)&pBehaviourSubelement))) throw XmlException(FALSE); if (pBehaviourSubelement) { pBehaviourSubelement->get_text(strText.Out()); @@ -1798,7 +1798,7 @@ BOOL Console::GetOptions() { } } SAFERELEASE(pBehaviourSubelement); - + if (!SUCCEEDED(pBehaviorColl->item(CComVariant(_T("inverse_shift")), CComVariant(0), (IDispatch**)&pBehaviourSubelement))) throw XmlException(FALSE); if (pBehaviourSubelement) { pBehaviourSubelement->get_text(strText.Out()); @@ -1809,7 +1809,7 @@ BOOL Console::GetOptions() { } } SAFERELEASE(pBehaviourSubelement); - + if (!SUCCEEDED(pBehaviorColl->item(CComVariant(_T("reload_new_config")), CComVariant(0), (IDispatch**)&pBehaviourSubelement))) throw XmlException(FALSE); if (pBehaviourSubelement) { pBehaviourSubelement->get_text(strText.Out()); @@ -1833,11 +1833,11 @@ BOOL Console::GetOptions() { } } SAFERELEASE(pBehaviourSubelement); - + } SAFERELEASE(pBehaviorColl); } - + bRet = TRUE; } catch (const XmlException& e) { @@ -1869,7 +1869,7 @@ BOOL Console::GetOptions() { ///////////////////////////////////////////////////////////////////////////// BOOL Console::RegisterWindowClasses() { - WNDCLASSEX wcx; + WNDCLASSEX wcx; // register the Console window class ::ZeroMemory(&wcx, sizeof(WNDCLASSEX)); @@ -1882,10 +1882,10 @@ BOOL Console::RegisterWindowClasses() { wcx.hIcon = ::LoadIcon(ghInstance, MAKEINTRESOURCE(IDI_ICON2)); wcx.hCursor = ::LoadCursor(NULL, IDC_ARROW); wcx.hbrBackground = ::CreateSolidBrush(RGB(0, 0, 0)); - wcx.lpszMenuName = NULL; + wcx.lpszMenuName = NULL; wcx.lpszClassName = Console::m_szConsoleClass; wcx.hIconSm = NULL; - + if ((::RegisterClassEx(&wcx) == 0) && (::GetLastError() != ERROR_CLASS_ALREADY_EXISTS)) return FALSE; // register the hidden parent window class @@ -1902,9 +1902,9 @@ BOOL Console::RegisterWindowClasses() { wcx.lpszMenuName = NULL; wcx.lpszClassName = Console::m_szHiddenParentClass; wcx.hIconSm = NULL; - + if ((::RegisterClassEx(&wcx) == 0) && (::GetLastError() != ERROR_CLASS_ALREADY_EXISTS)) return FALSE; - + return TRUE; } @@ -1914,20 +1914,20 @@ BOOL Console::RegisterWindowClasses() { ///////////////////////////////////////////////////////////////////////////// BOOL Console::SetupMenus() { - + MENUITEMINFO mii; - + // setup popup menu if ((m_hPopupMenu = ::LoadMenu(ghInstance, MAKEINTRESOURCE(IDR_POPUP_MENU))) == NULL) return FALSE; if ((m_hConfigFilesMenu = ::CreateMenu()) == NULL) return FALSE; - + // add stuff to the system menu TCHAR* arrMenuItems[] = {_T("&Copy"), _T("&Paste")}; DWORD arrMenuTypes[] = {MFT_STRING, MFT_STRING}; DWORD arrMenuIDs[] = { ID_COPY, ID_PASTE}; - + m_hSysMenu = ::GetSystemMenu(m_hWnd, FALSE); - + for (int i = 0; i < sizeof(arrMenuIDs)/sizeof(arrMenuIDs[0]); ++i) { ::ZeroMemory(&mii, sizeof(MENUITEMINFO)); mii.cbSize = sizeof(MENUITEMINFO); @@ -1942,20 +1942,20 @@ BOOL Console::SetupMenus() { } ::InsertMenuItem(m_hSysMenu, SC_CLOSE, FALSE, &mii); } - + // set config files menu as a submenu of "Select configuration file" item // in the popup and system menus ::ZeroMemory(&mii, sizeof(MENUITEMINFO)); mii.cbSize = sizeof(MENUITEMINFO); mii.fMask = MIIM_SUBMENU; mii.hSubMenu = m_hConfigFilesMenu; - + // ::SetMenuItemInfo(m_hPopupMenu, ID_SEL_CONFIG_FILE, FALSE, &mii); // ::SetMenuItemInfo(m_hSysMenu, ID_SEL_CONFIG_FILE, FALSE, &mii); - + // load the initial list (so the list can be used by external programs) UpdateConfigFilesSubmenu(); - + return TRUE; } @@ -1971,20 +1971,20 @@ BOOL Console::CreateConsoleWindow() { if (m_dwTaskbarButton == TASKBAR_BUTTON_NORMAL) dwWindowStyle |= WS_MINIMIZEBOX; switch (m_dwWindowBorder) { - case BORDER_NONE : + case BORDER_NONE : dwWindowStyle |= WS_POPUPWINDOW & ~WS_BORDER; break; case BORDER_REGULAR : dwWindowStyle |= WS_CAPTION|WS_SYSMENU; break; - + case BORDER_THIN : dwWindowStyle |= WS_POPUPWINDOW; break; - + default: dwWindowStyle |= WS_POPUPWINDOW & ~WS_BORDER; } - + // If the taskbar style is set to hide or tray, we create an invisible window // to parent the main window to. This hides the taskbar button while allowing // us to use the normal title bar. @@ -2002,18 +2002,18 @@ BOOL Console::CreateConsoleWindow() { NULL, ghInstance, NULL)) == NULL) { - + return FALSE; } - + // don't let the user minimize it if there's no way to restore it if (m_dwTaskbarButton == TASKBAR_BUTTON_HIDE) dwWindowStyle &= ~WS_MINIMIZEBOX; } - - + + if ((m_hWnd = ::CreateWindowEx( 0, //m_dwTaskbarButton > TASKBAR_BUTTON_NORMAL ? WS_EX_TOOLWINDOW : 0, - Console::m_szConsoleClass, + Console::m_szConsoleClass, m_strWindowTitle.c_str(), dwWindowStyle, ((m_nX == -1) || (m_nY == -1)) ? CW_USEDEFAULT : 0, @@ -2024,7 +2024,7 @@ BOOL Console::CreateConsoleWindow() { NULL, ghInstance, NULL)) == NULL) { - + return FALSE; } @@ -2047,11 +2047,11 @@ BOOL Console::CreateConsoleWindow() { ///////////////////////////////////////////////////////////////////////////// void Console::CreateNewFont() { - + // create a new font if (m_hFontOld) ::SelectObject(m_hdcConsole, m_hFontOld); if (m_hFont) ::DeleteObject(m_hFont); - + m_hFont = ::CreateFont( -MulDiv(m_dwFontSize, ::GetDeviceCaps(m_hdcConsole, LOGPIXELSY), 72), 0, @@ -2061,13 +2061,13 @@ void Console::CreateNewFont() { m_bItalic, FALSE, FALSE, - DEFAULT_CHARSET, + DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, m_strFontName.c_str()); - + m_hFontOld = (HFONT)::SelectObject(m_hdcConsole, m_hFont); } @@ -2077,7 +2077,7 @@ void Console::CreateNewFont() { ///////////////////////////////////////////////////////////////////////////// void Console::CreateNewBrush() { - + // create a new background brush if (m_hBkBrush) ::DeleteObject(m_hBkBrush); m_hBkBrush = ::CreateSolidBrush(m_crBackground); @@ -2089,7 +2089,6 @@ void Console::CreateNewBrush() { ///////////////////////////////////////////////////////////////////////////// void Console::CreateCursor() { - switch (m_dwCursorStyle) { case CURSOR_STYLE_XTERM : m_pCursor = (Cursor*)new XTermCursor(m_hWnd, m_hdcConsole, m_crCursorColor); @@ -2139,36 +2138,36 @@ void Console::CreateCursor() { ///////////////////////////////////////////////////////////////////////////// void Console::CreateOffscreenBuffers() { - + HDC hdcDesktop = ::GetDCEx(m_hWnd, NULL, 0); - + // create new window bitmap if (m_hbmpConsoleOld) ::SelectObject(m_hdcConsole, m_hbmpConsoleOld); if (m_hbmpConsole) ::DeleteObject(m_hbmpConsole); - + m_hbmpConsole = ::CreateCompatibleBitmap(hdcDesktop, m_nClientWidth, m_nClientHeight); m_hbmpConsoleOld = (HBITMAP)::SelectObject(m_hdcConsole, m_hbmpConsole); - + if (m_hbmpWindowOld) ::SelectObject(m_hdcWindow, m_hbmpWindowOld); if (m_hbmpWindow) ::DeleteObject(m_hbmpWindow); - + m_hbmpWindow = ::CreateCompatibleBitmap(hdcDesktop, m_nClientWidth, m_nClientHeight); m_hbmpWindowOld = (HBITMAP)::SelectObject(m_hdcWindow, m_hbmpWindow); - + // create selection bitmap if (m_hbmpSelectionOld) ::SelectObject(m_hdcSelection, m_hbmpSelectionOld); if (m_hbmpSelection) ::DeleteObject(m_hbmpSelection); - + m_hbmpSelection = ::CreateCompatibleBitmap(m_hdcWindow, m_nClientWidth, m_nClientHeight); m_hbmpSelectionOld = (HBITMAP)::SelectObject(m_hdcSelection, m_hbmpSelection); - + RECT rect; rect.left = 0; rect.top = 0; rect.right = m_nClientWidth; rect.bottom = m_nClientHeight; ::FillRect(m_hdcSelection, &rect, m_hbrushSelection); - + ::ReleaseDC(m_hWnd, hdcDesktop); } @@ -2178,19 +2177,19 @@ void Console::CreateOffscreenBuffers() { ///////////////////////////////////////////////////////////////////////////// #if 0 void Console::CreateBackgroundBitmap() { - + USES_CONVERSION; - + if (m_hbmpBackgroundOld) ::SelectObject(m_hdcBackground, m_hbmpBackgroundOld); if (m_hbmpBackground) ::DeleteObject(m_hbmpBackground); if (m_hdcBackground) ::DeleteDC(m_hdcBackground); - + if (!m_bBitmapBackground) return; - + // determine the total size of the background bitmap DWORD dwPrimaryDisplayWidth = ::GetSystemMetrics(SM_CXSCREEN); DWORD dwPrimaryDisplayHeight = ::GetSystemMetrics(SM_CYSCREEN); - + DWORD dwBackgroundWidth = 0; DWORD dwBackgroundHeight = 0; @@ -2200,7 +2199,7 @@ void Console::CreateBackgroundBitmap() { // Win2K and later can handle multiple monitors dwBackgroundWidth = ::GetSystemMetrics(SM_CXVIRTUALSCREEN); dwBackgroundHeight = ::GetSystemMetrics(SM_CYVIRTUALSCREEN); - + // get offsets for virtual display m_nBackgroundOffsetX = ::GetSystemMetrics(SM_XVIRTUALSCREEN); m_nBackgroundOffsetY = ::GetSystemMetrics(SM_YVIRTUALSCREEN); @@ -2209,7 +2208,7 @@ void Console::CreateBackgroundBitmap() { dwBackgroundWidth = dwPrimaryDisplayWidth; dwBackgroundHeight = dwBackgroundHeight; } - + } else { dwBackgroundWidth = m_nClientWidth; dwBackgroundHeight = m_nClientHeight; @@ -2223,31 +2222,31 @@ void Console::CreateBackgroundBitmap() { m_bBitmapBackground = FALSE; return; } - + imageData.hdcImage = NULL; imageData.dwImageWidth = image.getWidth(); imageData.dwImageHeight = image.getHeight(); image.convertTo24Bits(); - + // ... if needed, tint the background image if (m_bTintSet) { - + BYTE* pPixels = image.accessPixels(); - BYTE* pPixelsEnd = pPixels + 3*image.getWidth()*image.getHeight(); + BYTE* pPixelsEnd = pPixels + 3*image.getWidth()*image.getHeight(); BYTE* pPixelSubel = pPixels; while (pPixelSubel < pPixelsEnd) { - *pPixelSubel = (BYTE) ((unsigned long)(*pPixelSubel * (100 - m_byTintOpacity) + m_byTintB*m_byTintOpacity)/100); + *pPixelSubel = (BYTE) ((unsigned long)(*pPixelSubel * (100 - m_byTintOpacity) + m_byTintB*m_byTintOpacity)/100); ++pPixelSubel; *pPixelSubel = (BYTE) ((unsigned long)(*pPixelSubel * (100 - m_byTintOpacity) + m_byTintG*m_byTintOpacity)/100); ++pPixelSubel; *pPixelSubel = (BYTE) ((unsigned long)(*pPixelSubel * (100 - m_byTintOpacity) + m_byTintR*m_byTintOpacity)/100); ++pPixelSubel; } - } - + } + // create the basic image HBITMAP hbmpImage = NULL; HBITMAP hbmpImageOld = NULL; @@ -2271,54 +2270,54 @@ void Console::CreateBackgroundBitmap() { image.rescale(imageData.dwImageWidth, imageData.dwImageHeight, FILTER_LANCZOS3); } } - - + + // now, create a DC compatible with the screen and create the basic bitmap HDC hdcDesktop = ::GetDCEx(m_hWnd, NULL, 0); imageData.hdcImage = ::CreateCompatibleDC(hdcDesktop); hbmpImage = ::CreateDIBitmap( - hdcDesktop, - image.getInfoHeader(), - CBM_INIT, - image.accessPixels(), - image.getInfo(), + hdcDesktop, + image.getInfoHeader(), + CBM_INIT, + image.accessPixels(), + image.getInfo(), DIB_RGB_COLORS); hbmpImageOld= (HBITMAP)::SelectObject(imageData.hdcImage, hbmpImage); ::ReleaseDC(m_hWnd, hdcDesktop); - + // create the background image m_hdcBackground = ::CreateCompatibleDC(imageData.hdcImage); m_hbmpBackground = ::CreateCompatibleBitmap(imageData.hdcImage, dwBackgroundWidth, dwBackgroundHeight); m_hbmpBackgroundOld = (HBITMAP)::SelectObject(m_hdcBackground, m_hbmpBackground); - + RECT rectBackground; rectBackground.left = 0; rectBackground.top = 0; rectBackground.right = dwBackgroundWidth; rectBackground.bottom = dwBackgroundHeight; - - // fill the background with the proper background color in case the - // bitmap doesn't cover the entire background, + + // fill the background with the proper background color in case the + // bitmap doesn't cover the entire background, COLORREF crBackground; if (m_dwTransparency == TRANSPARENCY_FAKE) { // get desktop background color HKEY hkeyColors; if (::RegOpenKeyEx(HKEY_CURRENT_USER, _T("Control Panel\\Colors"), 0, KEY_READ, &hkeyColors) == ERROR_SUCCESS) { - + TCHAR szData[MAX_PATH]; DWORD dwDataSize = MAX_PATH; - + BYTE r = 0; BYTE g = 0; BYTE b = 0; - + ::ZeroMemory(szData, sizeof(szData)); ::RegQueryValueEx(hkeyColors, _T("Background"), NULL, NULL, (BYTE*)szData, &dwDataSize); - + _stscanf(szData, _T("%i %i %i"), &r, &g, &b); crBackground = RGB(r, g, b); - + ::RegCloseKey(hkeyColors); } } else { @@ -2328,64 +2327,64 @@ void Console::CreateBackgroundBitmap() { HBRUSH hBkBrush = ::CreateSolidBrush(crBackground); ::FillRect(m_hdcBackground, &rectBackground, hBkBrush); ::DeleteObject(hBkBrush); - + if (m_dwBackgroundStyle == BACKGROUND_STYLE_TILE) { // we're tiling the image, starting at coordinates (0, 0) of the virtual screen DWORD dwX = 0; DWORD dwY = 0; - + DWORD dwImageOffsetX = 0; DWORD dwImageOffsetY = imageData.dwImageHeight + (m_nBackgroundOffsetY - (int)imageData.dwImageHeight*(m_nBackgroundOffsetY/(int)imageData.dwImageHeight)); - + while (dwY < dwBackgroundHeight) { - + dwX = 0; dwImageOffsetX = imageData.dwImageWidth + (m_nBackgroundOffsetX - (int)imageData.dwImageWidth*(m_nBackgroundOffsetX/(int)imageData.dwImageWidth)); - + while (dwX < dwBackgroundWidth) { ::BitBlt( - m_hdcBackground, - dwX, - dwY, - imageData.dwImageWidth, + m_hdcBackground, + dwX, + dwY, + imageData.dwImageWidth, imageData.dwImageHeight, imageData.hdcImage, dwImageOffsetX, dwImageOffsetY, SRCCOPY); - + dwX += imageData.dwImageWidth - dwImageOffsetX; dwImageOffsetX = 0; } - + dwY += imageData.dwImageHeight - dwImageOffsetY; dwImageOffsetY = 0; } } else if (m_bExtendBackground || !m_bRelativeBackground) { - + switch (m_dwBackgroundStyle) { case BACKGROUND_STYLE_RESIZE : ::BitBlt( - m_hdcBackground, + m_hdcBackground, 0, 0, - dwBackgroundWidth, + dwBackgroundWidth, dwBackgroundHeight, imageData.hdcImage, 0, 0, SRCCOPY); break; - + case BACKGROUND_STYLE_CENTER : ::BitBlt( - m_hdcBackground, + m_hdcBackground, (dwBackgroundWidth <= imageData.dwImageWidth) ? 0 : (dwBackgroundWidth - imageData.dwImageWidth)/2, (dwBackgroundHeight <= imageData.dwImageHeight) ? 0 : (dwBackgroundHeight - imageData.dwImageHeight)/2, - imageData.dwImageWidth, + imageData.dwImageWidth, imageData.dwImageHeight, imageData.hdcImage, (dwBackgroundWidth < imageData.dwImageWidth) ? (imageData.dwImageWidth - dwBackgroundWidth)/2 : 0, @@ -2415,39 +2414,39 @@ BOOL CALLBACK Console::BackgroundEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPR DWORD dwDisplayWidth = lprcMonitor->right - lprcMonitor->left; DWORD dwDisplayHeight = lprcMonitor->bottom - lprcMonitor->top; - + DWORD dwPrimaryDisplayWidth = ::GetSystemMetrics(SM_CXSCREEN); DWORD dwPrimaryDisplayHeight = ::GetSystemMetrics(SM_CYSCREEN); - + // center the image according to current display's size and position switch (g_pConsole->m_dwBackgroundStyle) { - + case BACKGROUND_STYLE_RESIZE : ::BitBlt( - g_pConsole->m_hdcBackground, + g_pConsole->m_hdcBackground, (dwDisplayWidth <= dwPrimaryDisplayWidth) ? lprcMonitor->left-g_pConsole->m_nBackgroundOffsetX : lprcMonitor->left-g_pConsole->m_nBackgroundOffsetX + (dwDisplayWidth - dwPrimaryDisplayWidth)/2, (dwDisplayHeight <= dwPrimaryDisplayHeight) ? lprcMonitor->top-g_pConsole->m_nBackgroundOffsetY : lprcMonitor->top-g_pConsole->m_nBackgroundOffsetY + (dwDisplayHeight - dwPrimaryDisplayHeight)/2, - dwDisplayWidth, + dwDisplayWidth, dwDisplayHeight, pImageData->hdcImage, (dwDisplayWidth < dwPrimaryDisplayWidth) ? (dwPrimaryDisplayWidth - dwDisplayWidth)/2 : 0, (dwDisplayHeight < dwPrimaryDisplayHeight) ? (dwPrimaryDisplayHeight - dwDisplayHeight)/2 : 0, SRCCOPY); - + break; - + case BACKGROUND_STYLE_CENTER : ::BitBlt( - g_pConsole->m_hdcBackground, + g_pConsole->m_hdcBackground, (dwDisplayWidth <= pImageData->dwImageWidth) ? lprcMonitor->left-g_pConsole->m_nBackgroundOffsetX : lprcMonitor->left-g_pConsole->m_nBackgroundOffsetX + (dwDisplayWidth - pImageData->dwImageWidth)/2, (dwDisplayHeight <= pImageData->dwImageHeight) ? lprcMonitor->top-g_pConsole->m_nBackgroundOffsetY : lprcMonitor->top-g_pConsole->m_nBackgroundOffsetY + (dwDisplayHeight - pImageData->dwImageHeight)/2, - dwDisplayWidth, + dwDisplayWidth, dwDisplayHeight, pImageData->hdcImage, (dwDisplayWidth < pImageData->dwImageWidth) ? (pImageData->dwImageWidth - dwDisplayWidth)/2 : 0, (dwDisplayHeight < pImageData->dwImageHeight) ? (pImageData->dwImageHeight - dwDisplayHeight)/2 : 0, SRCCOPY); - + break; } @@ -2464,7 +2463,7 @@ void Console::GetTextSize() { TEXTMETRIC textMetric; ::GetTextMetrics(m_hdcConsole, &textMetric); - + m_nCharHeight = textMetric.tmHeight; if (!(textMetric.tmPitchAndFamily & TMPF_FIXED_PITCH)) { @@ -2482,16 +2481,16 @@ void Console::GetBordersDimensions() { WINDOWINFO wndInfo; TITLEBARINFO titlebarInfo; - + ::ZeroMemory(&wndInfo, sizeof(WINDOWINFO)); ::ZeroMemory(&titlebarInfo, sizeof(TITLEBARINFO)); - + wndInfo.cbSize = sizeof(WINDOWINFO); titlebarInfo.cbSize = sizeof(TITLEBARINFO); - + ::GetWindowInfo(m_hWnd, &wndInfo); ::GetTitleBarInfo(m_hWnd, &titlebarInfo); - + m_nXBorderSize = wndInfo.cxWindowBorders; m_nYBorderSize = wndInfo.cyWindowBorders; m_nCaptionSize = (titlebarInfo.rgstate[0] & STATE_SYSTEM_INVISIBLE) ? 0 : titlebarInfo.rcTitleBar.bottom - titlebarInfo.rcTitleBar.top; @@ -2521,21 +2520,21 @@ void Console::CalcWindowSize() { m_nWindowHeight = m_nClientHeight; m_nWindowWidth = m_nClientWidth; break; - + case BORDER_REGULAR : { - + m_nWindowHeight = m_nClientHeight + m_nCaptionSize + 2*m_nYBorderSize; m_nWindowWidth = m_nClientWidth + 2 * m_nXBorderSize; - + break; - } - + } + case BORDER_THIN : - + m_nWindowHeight = m_nClientHeight + 2*m_nYBorderSize; m_nWindowWidth = m_nClientWidth + 2*m_nXBorderSize; } - + if (m_bShowScrollbar) m_nWindowWidth += m_nScrollbarWidth; } @@ -2548,10 +2547,10 @@ void Console::CalcWindowSize() { void Console::SetWindowTransparency() { // set alpha transparency (Win2000 and later only!) if (g_bWin2000 && ((m_dwTransparency == TRANSPARENCY_ALPHA) || (m_dwTransparency == TRANSPARENCY_COLORKEY))) { - + ::SetWindowLong(m_hWnd, GWL_EXSTYLE, ::GetWindowLong(m_hWnd, GWL_EXSTYLE) | WS_EX_LAYERED); g_pfnSetLayeredWndAttr(m_hWnd, m_crBackground, m_byAlpha, m_dwTransparency == TRANSPARENCY_ALPHA ? LWA_ALPHA : LWA_COLORKEY); - + } else if (m_dwTransparency == TRANSPARENCY_FAKE) { // get wallpaper settings HKEY hkeyDesktop; @@ -2564,13 +2563,13 @@ void Console::SetWindowTransparency() { ::ZeroMemory(szData, sizeof(szData)); ::RegQueryValueEx(hkeyDesktop, _T("Wallpaper"), NULL, NULL, (BYTE*)szData, &dwDataSize); - + if (_tcslen(szData) > 0) { m_bBitmapBackground = TRUE; m_strBackgroundFile = szData; m_bRelativeBackground = TRUE; m_bExtendBackground = FALSE; - + // get wallpaper style and tile flag dwDataSize = MAX_PATH; ::ZeroMemory(szData, sizeof(szData)); @@ -2581,7 +2580,7 @@ void Console::SetWindowTransparency() { dwDataSize = MAX_PATH; ::ZeroMemory(szData, sizeof(szData)); ::RegQueryValueEx(hkeyDesktop, _T("TileWallpaper"), NULL, NULL, (BYTE*)szData, &dwDataSize); - + dwTileWallpaper = _ttoi(szData); if (dwTileWallpaper == 1) { @@ -2595,7 +2594,7 @@ void Console::SetWindowTransparency() { } } } - + ::RegCloseKey(hkeyDesktop); } } @@ -2614,12 +2613,12 @@ void Console::SetScrollbarStuff() { } else { m_bShowScrollbar = FALSE; } - + // we don't call InitializeFlatSB due to some problems on Win2k, Windowblinds and new-style scrollbars if (m_nScrollbarStyle != FSB_REGULAR_MODE) ::InitializeFlatSB(m_hWnd); ::FlatSB_ShowScrollBar(m_hWnd, SB_VERT, m_bShowScrollbar); ::FlatSB_SetScrollRange(m_hWnd, SB_VERT, 0, m_dwBufferRows-m_dwRows, FALSE); - + // set scrollbar properties ::FlatSB_SetScrollProp(m_hWnd, WSB_PROP_VSTYLE, m_nScrollbarStyle, FALSE); ::FlatSB_SetScrollProp(m_hWnd, WSB_PROP_VBKGCOLOR, m_crScrollbarColor, FALSE); @@ -2634,7 +2633,7 @@ void Console::SetScrollbarStuff() { ///////////////////////////////////////////////////////////////////////////// void Console::SetDefaultConsoleColors() { - + m_arrConsoleColors[0] = 0x000000; m_arrConsoleColors[1] = 0x800000; m_arrConsoleColors[2] = 0x008000; @@ -2659,18 +2658,18 @@ void Console::SetDefaultConsoleColors() { ///////////////////////////////////////////////////////////////////////////// void Console::SetWindowSizeAndPosition() { - + // set window position #if 0 - DWORD dwScreenWidth = ::GetSystemMetrics(g_bWin2000 ? SM_CXVIRTUALSCREEN : SM_CXSCREEN); - DWORD dwScreenHeight = ::GetSystemMetrics(g_bWin2000 ? SM_CYVIRTUALSCREEN : SM_CYSCREEN); - DWORD dwTop = ::GetSystemMetrics(g_bWin2000 ? SM_YVIRTUALSCREEN : 0); - DWORD dwLeft = ::GetSystemMetrics(g_bWin2000 ? SM_XVIRTUALSCREEN : 0); + DWORD dwScreenWidth = ::GetSystemMetrics(g_bWin2000 ? SM_CXVIRTUALSCREEN : SM_CXSCREEN); + DWORD dwScreenHeight = ::GetSystemMetrics(g_bWin2000 ? SM_CYVIRTUALSCREEN : SM_CYSCREEN); + DWORD dwTop = ::GetSystemMetrics(g_bWin2000 ? SM_YVIRTUALSCREEN : 0); + DWORD dwLeft = ::GetSystemMetrics(g_bWin2000 ? SM_XVIRTUALSCREEN : 0); #else - DWORD dwScreenWidth = ::GetSystemMetrics(SM_CXSCREEN); - DWORD dwScreenHeight = ::GetSystemMetrics(SM_CYSCREEN); - DWORD dwTop = ::GetSystemMetrics(0); - DWORD dwLeft = ::GetSystemMetrics(0); + DWORD dwScreenWidth = ::GetSystemMetrics(SM_CXSCREEN); + DWORD dwScreenHeight = ::GetSystemMetrics(SM_CYSCREEN); + DWORD dwTop = ::GetSystemMetrics(0); + DWORD dwLeft = ::GetSystemMetrics(0); #endif switch (m_dwDocked) { @@ -2679,26 +2678,26 @@ void Console::SetWindowSizeAndPosition() { m_nX = dwLeft; m_nY = dwTop; break; - + case DOCK_TOP_RIGHT: // top right m_nX = dwScreenWidth - m_nWindowWidth; m_nY = dwTop; break; - + case DOCK_BOTTOM_RIGHT: // bottom right m_nX = dwScreenWidth - m_nWindowWidth; m_nY = dwScreenHeight - m_nWindowHeight; break; - + case DOCK_BOTTOM_LEFT: // bottom left m_nX = dwLeft; m_nY = dwScreenHeight - m_nWindowHeight; break; } - + HWND hwndZ = 0; switch (m_dwCurrentZOrder) { case Z_ORDER_REGULAR : hwndZ = HWND_NOTOPMOST; break; @@ -2706,16 +2705,16 @@ void Console::SetWindowSizeAndPosition() { case Z_ORDER_ONBOTTOM : hwndZ = HWND_BOTTOM; break; default : return; } - + ::SetWindowPos( - m_hWnd, - hwndZ, - m_nX, - m_nY, - m_nWindowWidth, - m_nWindowHeight, + m_hWnd, + hwndZ, + m_nX, + m_nY, + m_nWindowWidth, + m_nWindowHeight, 0); - + UpdateOnTopMenuItem(); } @@ -2725,9 +2724,9 @@ void Console::SetWindowSizeAndPosition() { ///////////////////////////////////////////////////////////////////////////// void Console::SetWindowIcons() { - + HICON hOldIcon = NULL; - + if (m_strIconFilename.length() > 0) { // custom icon, try loading it... @@ -2737,7 +2736,7 @@ void Console::SetWindowIcons() { m_hBigIcon = (HICON)::LoadImage(NULL, m_strIconFilename.c_str(), IMAGE_ICON, 0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE); hOldIcon = (HICON)::SendMessage(m_hWnd, WM_SETICON, ICON_BIG, (LPARAM)m_hBigIcon); if (hOldIcon) ::DestroyIcon(hOldIcon); - + } else { m_hSmallIcon = (HICON)::LoadImage(ghInstance, MAKEINTRESOURCE(IDI_ICON2), IMAGE_ICON, 16, 16, 0); } @@ -2748,7 +2747,7 @@ void Console::SetWindowIcons() { hOldIcon = (HICON)::SendMessage(m_hWnd, WM_SETICON, ICON_SMALL, (LPARAM)m_hSmallIcon); if (hOldIcon) ::DestroyIcon(hOldIcon); - + SetTrayIcon(m_dwTaskbarButton == TASKBAR_BUTTON_TRAY ? NIM_ADD : NIM_DELETE); } @@ -2758,23 +2757,23 @@ void Console::SetWindowIcons() { ///////////////////////////////////////////////////////////////////////////// BOOL Console::SetTrayIcon(DWORD dwMessage) { - + NOTIFYICONDATA tnd; tstring strToolTip(m_strWindowTitle); - + tnd.cbSize = sizeof(NOTIFYICONDATA); tnd.hWnd = m_hWnd; tnd.uID = TRAY_ICON_ID; tnd.uFlags = NIF_MESSAGE|NIF_ICON|NIF_TIP; tnd.uCallbackMessage = WM_TRAY_NOTIFY; tnd.hIcon = m_hSmallIcon; - + if (strToolTip.length() > 63) { strToolTip.resize(59); strToolTip += _T(" ..."); // DWORD dw = strToolTip.length(); } - + _tcscpy(tnd.szTip, strToolTip.c_str()); return ::Shell_NotifyIcon(dwMessage, &tnd); } @@ -2785,8 +2784,8 @@ BOOL Console::SetTrayIcon(DWORD dwMessage) { ///////////////////////////////////////////////////////////////////////////// void Console::DestroyCursor() { - - if (m_pCursor) + + if (m_pCursor) { delete m_pCursor; m_pCursor = NULL; @@ -2852,14 +2851,14 @@ void Console::ReloadSettings() { // destory menus ::DestroyMenu(m_hConfigFilesMenu); ::DestroyMenu(m_hPopupMenu); - + // uninitialize flat scrollbars if (m_nScrollbarStyle != FSB_REGULAR_MODE) ::UninitializeFlatSB(m_hWnd); // destory window ::DestroyWindow(m_hWnd); if (m_hwndInvisParent) ::DestroyWindow(m_hwndInvisParent); - + // set default values m_strShell = _T(""); m_strConfigEditor = _T("notepad.exe"); @@ -2944,10 +2943,10 @@ void Console::ReloadSettings() { CreateNewFont(); CreateNewBrush(); - + // SetWindowTransparency(); SetWindowIcons(); - + CreateCursor(); RefreshStdOut(); @@ -2956,7 +2955,7 @@ void Console::ReloadSettings() { InitConsoleWndSize(m_dwColumns); ResizeConsoleWindow(); // ShowHideConsole(); - + m_bInitializing = FALSE; m_bReloading = FALSE; @@ -2965,7 +2964,7 @@ void Console::ReloadSettings() { RepaintWindow(); if (m_dwMasterRepaintInt) ::SetTimer(m_hWnd, TIMER_REPAINT_MASTER, m_dwMasterRepaintInt, NULL); - + if (m_bStartMinimized) { if (m_dwTaskbarButton > TASKBAR_BUTTON_NORMAL) { m_bHideWindow = TRUE; @@ -2975,7 +2974,7 @@ void Console::ReloadSettings() { } else { ::ShowWindow(m_hWnd, SW_SHOW); } - + ::SetForegroundWindow(m_hWnd); } @@ -2989,9 +2988,9 @@ BOOL Console::StartShellProcess() { #if 0 if (m_strShell.length() == 0) { TCHAR szComspec[MAX_PATH]; - + if (::GetEnvironmentVariable(_T("COMSPEC"), szComspec, MAX_PATH) > 0) { - m_strShell = szComspec; + m_strShell = szComspec; } else { m_strShell = _T("cmd.exe"); } @@ -3004,7 +3003,7 @@ BOOL Console::StartShellProcess() { } // strShellCmdLine = "cmd.exe"; - + // create the console window TCHAR szConsoleTitle[MAX_PATH]; ::AllocConsole(); @@ -3020,28 +3019,28 @@ BOOL Console::StartShellProcess() { RefreshStdOut(); InitConsoleWndSize(80); ResizeConsoleWindow(); - + #if 0 ::SetConsoleCtrlHandler(Console::CtrlHandler, TRUE); - + // setup the start up info struct PROCESS_INFORMATION pi; STARTUPINFO si; ::ZeroMemory(&si, sizeof(STARTUPINFO)); si.cb = sizeof(STARTUPINFO); - + if (!::CreateProcess( - NULL, - (TCHAR*)strShellCmdLine.c_str(), - NULL, - NULL, - TRUE, - 0, + NULL, + (TCHAR*)strShellCmdLine.c_str(), + NULL, + NULL, + TRUE, + 0, NULL, NULL, &si, &pi)) { - + return FALSE; } @@ -3051,15 +3050,15 @@ BOOL Console::StartShellProcess() { } else { ShowHideConsole(); } - + // close main thread handle ::CloseHandle(pi.hThread); - + // set handles m_hQuitEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL); m_hConsoleProcess = pi.hProcess; #endif - + return TRUE; } @@ -3069,7 +3068,7 @@ BOOL Console::StartShellProcess() { ///////////////////////////////////////////////////////////////////////////// void Console::RefreshStdOut() { -#if 0 +#if 0 if (m_hStdOutFresh) ::CloseHandle(m_hStdOutFresh); m_hStdOutFresh = ::CreateFile(_T("CONOUT$"), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0); #endif @@ -3083,13 +3082,13 @@ void Console::RefreshStdOut() { void Console::RefreshScreenBuffer() { // if we're initializing, do nothing if (m_bInitializing) return; - + // ::GetConsoleScreenBufferInfo(m_hStdOutFresh, &m_csbiConsole); SCROLLINFO si; - si.cbSize = sizeof(si); - si.fMask = SIF_POS; - si.nPos = (int)m_csbiConsole.srWindow.Top; + si.cbSize = sizeof(si); + si.fMask = SIF_POS; + si.nPos = (int)m_csbiConsole.srWindow.Top; ::FlatSB_SetScrollInfo(m_hWnd, SB_VERT, &si, TRUE); #if 0 @@ -3102,13 +3101,13 @@ void Console::RefreshScreenBuffer() { COORD coordBufferSize; COORD coordStart; SMALL_RECT srRegion; - + coordStart.X = 0; coordStart.Y = 0; - + coordBufferSize.X = m_dwColumns; coordBufferSize.Y = m_dwRows; - + srRegion.Top = m_csbiConsole.srWindow.Top; srRegion.Left = 0; srRegion.Bottom = m_csbiConsole.srWindow.Top + m_dwRows - 1; @@ -3120,7 +3119,7 @@ void Console::RefreshScreenBuffer() { for (int i=0; i (DWORD) dwColumns * m_dwBufferRows) { ::SetConsoleWindowInfo(m_hStdOutFresh, TRUE, &srConsoleRect); ::SetConsoleScreenBufferSize(m_hStdOutFresh, coordConsoleSize); @@ -3216,21 +3215,21 @@ void Console::InitConsoleWndSize(DWORD dwColumns) { ///////////////////////////////////////////////////////////////////////////// void Console::ResizeConsoleWindow() { - + m_bInitializing = TRUE; - + if (m_nTextSelection) ClearSelection(); - + // CONSOLE_SCREEN_BUFFER_INFO csbi; // ::GetConsoleScreenBufferInfo(m_hStdOutFresh, &csbi); // in case buffer rows increased since last resize, and we're not using text buffer if (!m_bUseTextBuffer) m_dwBufferRows = m_dwRows; - + COORD coordBuffersSize; coordBuffersSize.X = (SHORT)m_dwColumns; coordBuffersSize.Y = (SHORT)m_dwBufferRows; - + SMALL_RECT srConsoleRect; srConsoleRect.Top = srConsoleRect.Left =0; // srConsoleRect.Right = m_dwColumns - 1; @@ -3239,21 +3238,21 @@ void Console::ResizeConsoleWindow() { #if 0 // order of setting window size and screen buffer size depends on current and desired dimensions if ((DWORD) csbi.dwSize.X * csbi.dwSize.Y > (DWORD) m_dwColumns * m_dwBufferRows) { - + if (m_bUseTextBuffer && (csbi.dwSize.Y > m_dwBufferRows)) { coordBuffersSize.Y = m_dwBufferRows = csbi.dwSize.Y; } - + ::SetConsoleWindowInfo(m_hStdOutFresh, TRUE, &srConsoleRect); ::SetConsoleScreenBufferSize(m_hStdOutFresh, coordBuffersSize); - + // } else if (((DWORD)csbi.dwSize.X < m_dwColumns) || ((DWORD)csbi.dwSize.Y < m_dwBufferRows) || ((DWORD)(csbi.srWindow.Bottom - csbi.srWindow.Top + 1) != m_dwRows)) { } else if ((DWORD) csbi.dwSize.X * csbi.dwSize.Y < (DWORD) m_dwColumns * m_dwBufferRows) { - + if (csbi.dwSize.Y < m_dwBufferRows) { m_dwBufferRows = coordBuffersSize.Y = csbi.dwSize.Y; } - + ::SetConsoleScreenBufferSize(m_hStdOutFresh, coordBuffersSize); ::SetConsoleWindowInfo(m_hStdOutFresh, TRUE, &srConsoleRect); } @@ -3263,7 +3262,7 @@ void Console::ResizeConsoleWindow() { CalcWindowSize(); SetWindowSizeAndPosition(); CreateOffscreenBuffers(); - + // if (m_bBitmapBackground) CreateBackgroundBitmap(); } @@ -3284,7 +3283,7 @@ void Console::AllocateBuffer() ///////////////////////////////////////////////////////////////////////////// void Console::RepaintWindow() { - + RECT rect; rect.top = 0; rect.left = 0; @@ -3302,44 +3301,44 @@ void Console::RepaintWindow() { #endif ::FillRect(m_hdcConsole, &rect, m_hBkBrush); // } - + DWORD dwX = m_nInsideBorder; DWORD dwY = m_nInsideBorder; DWORD dwOffset = m_csbiConsole.srWindow.Top * m_dwColumns; - + WORD attrBG; // stuff used for caching int nBkMode = TRANSPARENT; 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); - + bool bTextOut = false; - + wstring strText(L""); - + memcpy(m_pScreenBuffer, m_pScreenBufferNew + dwOffset, sizeof(CHAR_INFO)*m_dwRows * m_dwColumns); dwOffset = 0; if (m_nCharWidth > 0) { // fixed pitch font for (DWORD i = 0; i < m_dwRows; ++i) { - + dwX = m_nInsideBorder; dwY = i*m_nCharHeight + m_nInsideBorder; nBkMode = TRANSPARENT; crBkColor = RGB(0, 0, 0); crTxtColor = RGB(0, 0, 0); - + bTextOut = false; - + attrBG = m_pScreenBuffer[dwOffset].Attributes >> 4; - + // here we decide how to paint text over the backgound if (m_arrConsoleColors[attrBG] == m_crConsoleBackground) { ::SetBkMode(m_hdcConsole, TRANSPARENT); @@ -3350,15 +3349,15 @@ void Console::RepaintWindow() { ::SetBkColor(m_hdcConsole, m_arrConsoleColors[attrBG]); crBkColor = m_arrConsoleColors[attrBG]; } - + ::SetTextColor(m_hdcConsole, m_bUseFontColor ? m_crFontColor : m_arrConsoleColors[m_pScreenBuffer[dwOffset].Attributes & 0xF]); crTxtColor = m_bUseFontColor ? m_crFontColor : m_arrConsoleColors[m_pScreenBuffer[dwOffset].Attributes & 0xF]; - + strText = m_pScreenBuffer[dwOffset].Char.UnicodeChar; ++dwOffset; for (DWORD j = 1; j < m_dwColumns; ++j) { - + attrBG = m_pScreenBuffer[dwOffset].Attributes >> 4; if (m_arrConsoleColors[attrBG] == m_crConsoleBackground) { @@ -3392,11 +3391,11 @@ void Console::RepaintWindow() { ::SetTextColor(m_hdcConsole, crTxtColor); strText = m_pScreenBuffer[dwOffset].Char.UnicodeChar; - + } else { strText += m_pScreenBuffer[dwOffset].Char.UnicodeChar; } - + ++dwOffset; } @@ -3406,15 +3405,15 @@ void Console::RepaintWindow() { } } else { - + // variable pitch font for (DWORD i = 0; i < m_dwRows; ++i) { - + dwX = m_nInsideBorder; dwY = i*m_nCharHeight + m_nInsideBorder; - + for (DWORD j = 0; j < m_dwColumns; ++j) { - + attrBG = m_pScreenBuffer[dwOffset].Attributes >> 4; // here we decide how to paint text over the backgound @@ -3424,7 +3423,7 @@ void Console::RepaintWindow() { ::SetBkMode(m_hdcConsole, OPAQUE); ::SetBkColor(m_hdcConsole, m_arrConsoleColors[attrBG]); } - + ::SetTextColor(m_hdcConsole, m_bUseFontColor ? m_crFontColor : m_arrConsoleColors[m_pScreenBuffer[dwOffset].Attributes & 0xF]); ::TextOutW(m_hdcConsole, dwX, dwY, &(m_pScreenBuffer[dwOffset].Char.UnicodeChar), 1); int nWidth; @@ -3434,9 +3433,9 @@ void Console::RepaintWindow() { } } } - + if (m_pCursor) DrawCursor(TRUE); - + ::InvalidateRect(m_hWnd, NULL, FALSE); } @@ -3446,19 +3445,19 @@ void Console::RepaintWindow() { ///////////////////////////////////////////////////////////////////////////// void Console::RepaintWindowChanges() { - + DWORD dwX = m_nInsideBorder; DWORD dwY = m_nInsideBorder; DWORD dwDestOffset = 0; DWORD dwSrcOffset = m_csbiConsole.srWindow.Top * m_dwColumns; - + WORD attrBG; if (m_nCharWidth > 0) { // fixed pitch font for (DWORD i = 0; i < m_dwRows; ++i) { - + dwX = m_nInsideBorder; dwY = i*m_nCharHeight + m_nInsideBorder; @@ -3473,7 +3472,7 @@ void Console::RepaintWindowChanges() { rect.left = dwX; rect.bottom = dwY + m_nCharHeight; rect.right = dwX + m_nCharWidth; - + #if 0 if (m_bBitmapBackground) { if (m_bRelativeBackground) { @@ -3485,7 +3484,7 @@ void Console::RepaintWindowChanges() { #endif ::FillRect(m_hdcConsole, &rect, m_hBkBrush); // } - + attrBG = m_pScreenBuffer[dwDestOffset].Attributes >> 4; @@ -3496,7 +3495,7 @@ void Console::RepaintWindowChanges() { ::SetBkMode(m_hdcConsole, OPAQUE); ::SetBkColor(m_hdcConsole, m_arrConsoleColors[attrBG]); } - + ::SetTextColor(m_hdcConsole, m_bUseFontColor ? m_crFontColor : m_arrConsoleColors[m_pScreenBuffer[dwDestOffset].Attributes & 0xF]); ::TextOutW(m_hdcConsole, dwX, dwY, &(m_pScreenBuffer[dwDestOffset].Char.UnicodeChar), 1); @@ -3508,9 +3507,9 @@ void Console::RepaintWindowChanges() { ++dwSrcOffset; } } - + } else { - + // variable pitch font if (memcmp(m_pScreenBuffer, m_pScreenBufferNew + dwDestOffset, sizeof(CHAR_INFO)*m_dwRows * m_dwColumns)) { memcpy(m_pScreenBuffer, m_pScreenBufferNew + dwDestOffset, sizeof(CHAR_INFO)*m_dwRows * m_dwColumns); @@ -3532,16 +3531,16 @@ void Console::RepaintWindowChanges() { #endif ::FillRect(m_hdcConsole, &rect, m_hBkBrush); // } - + for (DWORD i = 0; i < m_dwRows; ++i) { - + dwX = m_nInsideBorder; dwY = i*m_nCharHeight + m_nInsideBorder; - + for (DWORD j = 0; j < m_dwColumns; ++j) { - + attrBG = m_pScreenBuffer[dwDestOffset].Attributes >> 4; - + // here we decide how to paint text over the backgound if (m_arrConsoleColors[attrBG] == m_crConsoleBackground) { ::SetBkMode(m_hdcConsole, TRANSPARENT); @@ -3549,7 +3548,7 @@ void Console::RepaintWindowChanges() { ::SetBkMode(m_hdcConsole, OPAQUE); ::SetBkColor(m_hdcConsole, m_arrConsoleColors[attrBG]); } - + ::SetTextColor(m_hdcConsole, m_bUseFontColor ? m_crFontColor : m_arrConsoleColors[m_pScreenBuffer[dwDestOffset].Attributes & 0xF]); ::TextOutW(m_hdcConsole, dwX, dwY, &(m_pScreenBuffer[dwDestOffset].Char.UnicodeChar), 1); int nWidth; @@ -3558,11 +3557,11 @@ void Console::RepaintWindowChanges() { ++dwDestOffset; } } - + ::InvalidateRect(m_hWnd, NULL, FALSE); } } - + if (m_pCursor) DrawCursor(); } @@ -3572,32 +3571,32 @@ void Console::RepaintWindowChanges() { ///////////////////////////////////////////////////////////////////////////// void Console::DrawCursor(BOOL bOnlyCursor) { - + // first, erase old cursor image if needed if (!bOnlyCursor && m_bCursorVisible) { RECT rectCursorOld; DrawCursorBackground(rectCursorOld); ::InvalidateRect(m_hWnd, &rectCursorOld, FALSE); } - + #if 0 // now, see if the cursor is visible... CONSOLE_CURSOR_INFO cinf; ::GetConsoleCursorInfo(m_hStdOutFresh, &cinf); - + m_bCursorVisible = cinf.bVisible; #endif // ... and draw it if (m_bCursorVisible) { -#if 0 +#if 0 ::GetConsoleScreenBufferInfo(m_hStdOutFresh, &m_csbiCursor); - + if (m_csbiCursor.dwCursorPosition.Y < m_csbiCursor.srWindow.Top || m_csbiCursor.dwCursorPosition.Y > m_csbiCursor.srWindow.Bottom) { m_bCursorVisible = FALSE; return; } - + // set proper cursor offset m_csbiCursor.dwCursorPosition.Y -= m_csbiCursor.srWindow.Top; #endif @@ -3621,41 +3620,41 @@ void Console::DrawCursor(BOOL bOnlyCursor) { inline void Console::GetCursorRect(RECT& rectCursor) { ::ZeroMemory(&rectCursor, sizeof(RECT)); - + if (m_nCharWidth > 0) { // fixed pitch - + rectCursor.left = m_csbiCursor.dwCursorPosition.X * m_nCharWidth + m_nInsideBorder; rectCursor.top = m_csbiCursor.dwCursorPosition.Y * m_nCharHeight + m_nInsideBorder; rectCursor.right = m_csbiCursor.dwCursorPosition.X * m_nCharWidth + m_nCharWidth + m_nInsideBorder; rectCursor.bottom = m_csbiCursor.dwCursorPosition.Y * m_nCharHeight + m_nCharHeight + m_nInsideBorder; - + } else { - + // variable pitch, we do a little joggling here :-) RECT rectLine; int nLastCharWidth; auto_ptr pszLine(new wchar_t[m_csbiCursor.dwCursorPosition.X + 2]); ::ZeroMemory(pszLine.get(), (m_csbiCursor.dwCursorPosition.X + 2)*sizeof(wchar_t)); - + 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; - + ::DrawTextW( - m_hdcConsole, + m_hdcConsole, pszLine.get(), -1, &rectLine, DT_CALCRECT); - + if (!::GetCharWidth32( - m_hdcConsole, - pszLine.get()[m_csbiCursor.dwCursorPosition.X], - pszLine.get()[m_csbiCursor.dwCursorPosition.X], + m_hdcConsole, + pszLine.get()[m_csbiCursor.dwCursorPosition.X], + pszLine.get()[m_csbiCursor.dwCursorPosition.X], &nLastCharWidth)) { - + return; } @@ -3677,7 +3676,7 @@ inline void Console::GetCursorRect(RECT& rectCursor) { 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 + (SHORT) m_dwRows) { return; @@ -3685,41 +3684,41 @@ inline void Console::DrawCursorBackground(RECT& rectCursor) { DWORD dwOffset = (m_csbiCursor.dwCursorPosition.Y-m_csbiConsole.srWindow.Top)*m_dwColumns + m_csbiCursor.dwCursorPosition.X; WORD attrBG = m_pScreenBuffer[dwOffset].Attributes >> 4; - + // here we decide how to paint text over the backgound - + if (m_arrConsoleColors[attrBG] == m_crConsoleBackground) { ::SetBkMode(m_hdcConsole, TRANSPARENT); } else { ::SetBkMode(m_hdcConsole, OPAQUE); ::SetBkColor(m_hdcConsole, m_arrConsoleColors[attrBG]); } - + ::SetTextColor(m_hdcConsole, m_bUseFontColor ? m_crFontColor : m_arrConsoleColors[m_pScreenBuffer[dwOffset].Attributes & 0xF]); - + #if 0 if (m_bBitmapBackground) { if (m_bRelativeBackground) { ::BitBlt( - m_hdcConsole, - rectCursor.left, - rectCursor.top, - rectCursor.right - rectCursor.left, - rectCursor.bottom - rectCursor.top, - m_hdcBackground, - m_nX+m_nXBorderSize-m_nBackgroundOffsetX + rectCursor.left, - m_nY+m_nCaptionSize+m_nYBorderSize-m_nBackgroundOffsetY + rectCursor.top, + m_hdcConsole, + rectCursor.left, + rectCursor.top, + rectCursor.right - rectCursor.left, + rectCursor.bottom - rectCursor.top, + m_hdcBackground, + m_nX+m_nXBorderSize-m_nBackgroundOffsetX + rectCursor.left, + m_nY+m_nCaptionSize+m_nYBorderSize-m_nBackgroundOffsetY + rectCursor.top, SRCCOPY); } else { ::BitBlt( - m_hdcConsole, - rectCursor.left, - rectCursor.top, - rectCursor.right - rectCursor.left, - rectCursor.bottom - rectCursor.top, - m_hdcBackground, - rectCursor.left, + m_hdcConsole, + rectCursor.left, + rectCursor.top, + rectCursor.right - rectCursor.left, + rectCursor.bottom - rectCursor.top, + m_hdcBackground, + rectCursor.left, rectCursor.top, SRCCOPY); } } else { @@ -3728,10 +3727,10 @@ inline void Console::DrawCursorBackground(RECT& rectCursor) { // } ::TextOutW( - m_hdcConsole, - rectCursor.left, - rectCursor.top, - &(m_pScreenBuffer[dwOffset].Char.UnicodeChar), + m_hdcConsole, + rectCursor.left, + rectCursor.top, + &(m_pScreenBuffer[dwOffset].Char.UnicodeChar), 1); } @@ -3741,12 +3740,12 @@ inline void Console::DrawCursorBackground(RECT& rectCursor) { ///////////////////////////////////////////////////////////////////////////// void Console::ClearSelection() { - + m_nTextSelection = TEXT_SELECTION_NONE; m_coordSelOrigin.X = 0; m_coordSelOrigin.Y = 0; ::ZeroMemory(&m_rectSelection, sizeof(RECT)); - + RepaintWindow(); } @@ -3756,14 +3755,14 @@ void Console::ClearSelection() { ///////////////////////////////////////////////////////////////////////////// DWORD Console::GetChangeRate() { - + DWORD dwCount = m_dwRows * m_dwColumns; DWORD dwChangedPositions = 0; - + for (DWORD i = 0; i < dwCount; ++i) { if (m_pScreenBuffer[i].Char.UnicodeChar != m_pScreenBufferNew[i].Char.UnicodeChar) ++dwChangedPositions; } - + return dwChangedPositions*100/dwCount; } @@ -3802,17 +3801,17 @@ void Console::ShowHideConsoleTimeout() { ///////////////////////////////////////////////////////////////////////////// - + ///////////////////////////////////////////////////////////////////////////// void Console::ToggleWindowOnTop() { - + if (m_dwCurrentZOrder == m_dwOriginalZOrder) { m_dwCurrentZOrder = Z_ORDER_ONTOP; } else { m_dwCurrentZOrder = m_dwOriginalZOrder; } - + HWND hwndZ = 0; switch (m_dwCurrentZOrder) { case Z_ORDER_REGULAR : hwndZ = HWND_NOTOPMOST; break; @@ -3820,16 +3819,16 @@ void Console::ToggleWindowOnTop() { case Z_ORDER_ONBOTTOM : hwndZ = HWND_BOTTOM; break; default : return; } - + ::SetWindowPos( - m_hWnd, - hwndZ, - 0, - 0, - 0, - 0, + m_hWnd, + hwndZ, + 0, + 0, + 0, + 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE); - + UpdateOnTopMenuItem(); } @@ -3839,7 +3838,7 @@ void Console::ToggleWindowOnTop() { ///////////////////////////////////////////////////////////////////////////// BOOL Console::HandleMenuCommand(DWORD dwID) { - + // check if it's one of the main menu commands switch (dwID) { @@ -3847,7 +3846,7 @@ BOOL Console::HandleMenuCommand(DWORD dwID) { case ID_SHOW_README_FILE: ShowReadmeFile(); return FALSE; - + case ID_ABOUT: About(); return FALSE; @@ -3856,11 +3855,11 @@ BOOL Console::HandleMenuCommand(DWORD dwID) { case ID_COPY: CopyTextToClipboard(); return FALSE; - + case ID_PASTE: PasteClipoardText(); return FALSE; - + #if 0 case ID_HIDE_CONSOLE: m_bHideConsole = !m_bHideConsole; @@ -3870,20 +3869,20 @@ BOOL Console::HandleMenuCommand(DWORD dwID) { case ID_EDIT_CONFIG_FILE: EditConfigFile(); return FALSE; - + case ID_RELOAD_SETTINGS: ReloadSettings(); return FALSE; - + case ID_TOGGLE_ONTOP: ToggleWindowOnTop(); return FALSE; #endif - + case ID_EXIT_CONSOLE: ::SendMessage(m_hWnd, WM_CLOSE, 0, 0); return FALSE; - + case SC_MINIMIZE: if (m_dwTaskbarButton > TASKBAR_BUTTON_NORMAL) { m_bHideWindow = !m_bHideWindow; @@ -3898,7 +3897,7 @@ BOOL Console::HandleMenuCommand(DWORD dwID) { // check if it's one of config file submenu items if ((dwID >= ID_FIRST_XML_FILE) && (dwID <= ID_LAST_XML_FILE)) { - + TCHAR szFilename[MAX_PATH]; ::ZeroMemory(szFilename, sizeof(szFilename)); ::GetMenuString(m_hConfigFilesMenu, dwID, szFilename, MAX_PATH, MF_BYCOMMAND); @@ -3906,9 +3905,9 @@ BOOL Console::HandleMenuCommand(DWORD dwID) { if (m_dwReloadNewConfig == RELOAD_NEW_CONFIG_PROMPT) { if (::MessageBox( - m_hWndConsole, - _T("Load new settings?"), - _T("New configuration selected"), + m_hWndConsole, + _T("Load new settings?"), + _T("New configuration selected"), MB_YESNO|MB_ICONQUESTION) == IDYES) { ReloadSettings(); @@ -3930,7 +3929,7 @@ BOOL Console::HandleMenuCommand(DWORD dwID) { ///////////////////////////////////////////////////////////////////////////// void Console::UpdateOnTopMenuItem() { - + #if 0 ::CheckMenuItem(::GetSubMenu(m_hPopupMenu, 0), ID_TOGGLE_ONTOP, MF_BYCOMMAND | ((m_dwCurrentZOrder == Z_ORDER_ONTOP) ? MF_CHECKED : MF_UNCHECKED)); ::CheckMenuItem(m_hSysMenu, ID_TOGGLE_ONTOP, MF_BYCOMMAND | ((m_dwCurrentZOrder == Z_ORDER_ONTOP) ? MF_CHECKED : MF_UNCHECKED)); @@ -3943,7 +3942,7 @@ void Console::UpdateOnTopMenuItem() { ///////////////////////////////////////////////////////////////////////////// void Console::UpdateHideConsoleMenuItem() { - + #if 0 ::CheckMenuItem(::GetSubMenu(m_hPopupMenu, 0), ID_HIDE_CONSOLE, MF_BYCOMMAND | (m_bHideConsole ? MF_CHECKED : MF_UNCHECKED)); ::CheckMenuItem(m_hSysMenu, ID_HIDE_CONSOLE, MF_BYCOMMAND | (m_bHideConsole ? MF_CHECKED : MF_UNCHECKED)); @@ -3959,32 +3958,32 @@ void Console::UpdateConfigFilesSubmenu() { #if 0 // populate m_hConfigFilesMenu - + // first, delete old items while (::GetMenuItemCount(m_hConfigFilesMenu) != 0) ::DeleteMenu(m_hConfigFilesMenu, 0, MF_BYPOSITION); - + // then, enumerate the files WIN32_FIND_DATA wfd; HANDLE hWfd = NULL; BOOL bMoreFiles = TRUE; DWORD dwID = ID_FIRST_XML_FILE; - + ::ZeroMemory(&wfd, sizeof(WIN32_FIND_DATA)); - + // create the search mask... int nBackslashPos = m_strConfigFile.rfind(_TCHAR('\\')); tstring strConfigFileDir(m_strConfigFile.substr(0, nBackslashPos+1)); tstring strSearchFileMask(strConfigFileDir + tstring(_T("*.xml"))); - + // ... and enumearate files hWfd = ::FindFirstFile(strSearchFileMask.c_str(), &wfd); while ((hWfd != INVALID_HANDLE_VALUE) && bMoreFiles) { - + MENUITEMINFO mii; TCHAR szFilename[MAX_PATH]; - + _sntprintf(szFilename, MAX_PATH, _T("%s"), (strConfigFileDir + tstring(wfd.cFileName)).c_str()); - + ::ZeroMemory(&mii, sizeof(MENUITEMINFO)); mii.cbSize = sizeof(MENUITEMINFO); mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE; @@ -3992,18 +3991,18 @@ void Console::UpdateConfigFilesSubmenu() { mii.wID = dwID++; mii.dwTypeData = szFilename; mii.cch = _tcslen(wfd.cFileName); - + if (_tcsicmp(szFilename, m_strConfigFile.c_str()) == 0) { mii.fState = MFS_CHECKED; } else { mii.fState = MFS_UNCHECKED; } - + ::InsertMenuItem(m_hConfigFilesMenu, dwID-ID_FIRST_XML_FILE, TRUE, &mii); - + bMoreFiles = ::FindNextFile(hWfd, &wfd); } - + ::FindClose(hWfd); #endif } @@ -4014,35 +4013,35 @@ void Console::UpdateConfigFilesSubmenu() { ///////////////////////////////////////////////////////////////////////////// void Console::CopyTextToClipboard() { - + int nSelX = (m_rectSelection.left - m_nInsideBorder)/m_nCharWidth; int nSelY = (m_rectSelection.top - m_nInsideBorder)/m_nCharHeight; int nSelColumns = (m_rectSelection.right-m_rectSelection.left)/m_nCharWidth; int nSelRows = (m_rectSelection.bottom-m_rectSelection.top)/m_nCharHeight; - + // nothing selected, just return if ((nSelColumns == 0) || (nSelRows == 0)) { ClearSelection(); return; } - + if (!::OpenClipboard(m_hWnd)) { ClearSelection(); return; } - + ::EmptyClipboard(); - - HGLOBAL hglbData = ::GlobalAlloc(GMEM_MOVEABLE, (nSelColumns+2)*nSelRows*sizeof(TCHAR)); - if (hglbData == NULL) { + + HGLOBAL hglbData = ::GlobalAlloc(GMEM_MOVEABLE, (nSelColumns+2)*nSelRows*sizeof(TCHAR)); + if (hglbData == NULL) { ::CloseClipboard(); ClearSelection(); return; - } - - // lock the handle and copy the text to the buffer. - wchar_t* pszData = (wchar_t*)::GlobalLock(hglbData); - + } + + // lock the handle and copy the text to the buffer. + wchar_t* pszData = (wchar_t*)::GlobalLock(hglbData); + { int i; for (i = 0; i < nSelRows; ++i) { @@ -4055,15 +4054,15 @@ void Console::CopyTextToClipboard() { } pszData[(i-1)*(nSelColumns+2) + nSelColumns] = _TCHAR('\x0'); } - + ::GlobalUnlock(hglbData); - + if (::SetClipboardData(CF_UNICODETEXT, hglbData) == NULL) { // we need to global-free data only if copying failed } ::CloseClipboard(); // !!! No call to GlobalFree here. Next app that uses clipboard will call EmptyClipboard to free the data - + ClearSelection(); } @@ -4073,19 +4072,19 @@ void Console::CopyTextToClipboard() { ///////////////////////////////////////////////////////////////////////////// void Console::PasteClipoardText() { - + if (!IsClipboardFormatAvailable(CF_UNICODETEXT)) return; - - + + if (::OpenClipboard(m_hWnd)) { HANDLE hData = ::GetClipboardData(CF_UNICODETEXT); - + SendTextToConsole((wchar_t*)::GlobalLock(hData)); - + ::GlobalUnlock(hData); ::CloseClipboard(); } - + } ///////////////////////////////////////////////////////////////////////////// @@ -4094,16 +4093,16 @@ void Console::PasteClipoardText() { ///////////////////////////////////////////////////////////////////////////// void Console::ShowReadmeFile() { - + // prepare editor parameters tstring strParams(m_strConfigEditorParams); - + if (strParams.length() == 0) { // no params, just use the readme file strParams = m_strReadmeFile; } else { tstring::size_type nPos = strParams.find(_T("%f")); - + if (nPos == tstring::npos) { // no '%f' in editor params, concatenate readme file name strParams += _T(" "); @@ -4113,7 +4112,7 @@ void Console::ShowReadmeFile() { strParams = strParams.replace(nPos, 2, m_strReadmeFile); } } - + ::ShellExecute(NULL, NULL, m_strConfigEditor.c_str(), strParams.c_str(), NULL, SW_SHOWNORMAL); } @@ -4126,7 +4125,7 @@ void Console::ShowReadmeFile() { void Console::About() { CAboutDlg dlg(m_hWnd); - + dlg.DoModal(); } @@ -4135,8 +4134,9 @@ void Console::About() ///////////////////////////////////////////////////////////////////////////// -void Console::SendTextToConsole(const wchar_t *pszText) { - +void Console::SendTextToConsole(const wchar_t *pszText) +{ + if (!pszText || (wcslen(pszText) == 0)) return; BOOL c_state = FALSE; @@ -4199,7 +4199,7 @@ void Console::SendTextToConsole(const wchar_t *pszText) { cursorX += m_nCharWidth; m_csbiCursor.dwCursorPosition.X++; } - + if (m_csbiCursor.dwCursorPosition.X >= (SHORT) m_dwColumns || *pszText == '\r' || *pszText == '\n' ) { m_csbiCursor.dwCursorPosition.X = 0; cursorX = m_nInsideBorder; @@ -4230,13 +4230,13 @@ void Console::SendTextToConsole(const wchar_t *pszText) { #if 0 HANDLE hStdIn = ::CreateFile(_T("CONIN$"), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0); - + DWORD dwTextLen = _tcslen(pszText); DWORD dwTextWritten = 0; - + INPUT_RECORD* pKeyEvents = new INPUT_RECORD[dwTextLen]; ::ZeroMemory(pKeyEvents, sizeof(INPUT_RECORD)*dwTextLen); - + for (DWORD i = 0; i < dwTextLen; ++i) { pKeyEvents[i].EventType = KEY_EVENT; pKeyEvents[i].Event.KeyEvent.bKeyDown = TRUE; @@ -4247,10 +4247,10 @@ void Console::SendTextToConsole(const wchar_t *pszText) { pKeyEvents[i].Event.KeyEvent.dwControlKeyState = 0; } ::WriteConsoleInput(hStdIn, pKeyEvents, dwTextLen, &dwTextWritten); - + DEL_ARR(pKeyEvents); ::CloseHandle(hStdIn); -#endif +#endif } ///////////////////////////////////////////////////////////////////////////// @@ -4259,13 +4259,13 @@ void Console::SendTextToConsole(const wchar_t *pszText) { ///////////////////////////////////////////////////////////////////////////// tstring Console::GetFullFilename(const tstring& strFilename) { - + TCHAR szFilePath[MAX_PATH]; TCHAR* pszFilename; - + ::ZeroMemory(szFilePath, sizeof(szFilePath)); ::GetFullPathName(strFilename.c_str(), MAX_PATH, szFilePath, &pszFilename); - + return tstring(szFilePath); } @@ -4300,27 +4300,27 @@ void Console::GetDesktopRect(RECT& rectDesktop) { rectDesktop.top = 0; rectDesktop.right = ::GetSystemMetrics(SM_CXSCREEN); rectDesktop.bottom = ::GetSystemMetrics(SM_CYSCREEN); - + RECT rectTaskbar = {0, 0, 0, 0}; HWND hWndTaskbar = ::FindWindow(_T("Shell_TrayWnd"), _T("")); - - + + if (hWndTaskbar) { - + ::GetWindowRect(hWndTaskbar, &rectTaskbar); - + if ((rectTaskbar.top <= rectDesktop.top) && (rectTaskbar.left <= rectDesktop.left) && (rectTaskbar.right >= rectDesktop.right)) { // top taskbar rectDesktop.top += rectTaskbar.bottom; - + } else if ((rectTaskbar.top > rectDesktop.top) && (rectTaskbar.left <= rectDesktop.left)) { // bottom taskbar rectDesktop.bottom = rectTaskbar.top; - + } else if ((rectTaskbar.top <= rectDesktop.top) && (rectTaskbar.left > rectDesktop.left)) { // right taskbar rectDesktop.right = rectTaskbar.left; - + } else { // left taskbar rectDesktop.left += rectTaskbar.right; @@ -4336,64 +4336,64 @@ void Console::GetDesktopRect(RECT& rectDesktop) { ///////////////////////////////////////////////////////////////////////////// LRESULT CALLBACK Console::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - + Console *myself = (Console*) ::GetWindowLongPtr( hwnd, GWLP_USERDATA ); - switch (uMsg) { - case WM_CREATE: - return 0; - - case WM_PAINT: + switch (uMsg) { + case WM_CREATE: + return 0; + + case WM_PAINT: // paint the window myself->OnPaint(); return 0; case WM_ERASEBKGND: return -1; - - case WM_SIZE: + + case WM_SIZE: // set the size and position of the window return 0; - + case WM_CLOSE: // ::DestroyWindow(myself->m_hWnd); - // Probably want to just hide the window if the X is hit. That way it can continue + // Probably want to just hide the window if the X is hit. That way it can continue // to update on script output ShowWindow( hwnd, FALSE); - return 0; - - case WM_DESTROY: + return 0; + + case WM_DESTROY: myself->OnDestroy(); return 0; - + case WM_NCDESTROY: myself->OnNcDestroy(); return 0; - + case WM_LBUTTONDOWN: myself->OnLButtonDown((UINT)wParam, MAKEPOINTS(lParam)); return 0; - + case WM_LBUTTONUP: myself->OnLButtonUp((UINT)wParam, MAKEPOINTS(lParam)); return 0; - + case WM_LBUTTONDBLCLK: myself->OnLButtonDblClick((UINT)wParam, MAKEPOINTS(lParam)); return 0; - + case WM_RBUTTONUP: myself->OnRButtonUp((UINT)wParam, MAKEPOINTS(lParam)); return 0; - + case WM_MBUTTONDOWN: myself->OnMButtonDown((UINT)wParam, MAKEPOINTS(lParam)); return 0; - + case WM_MOUSEMOVE: myself->OnMouseMove((UINT)wParam, MAKEPOINTS(lParam)); return 0; - + case WM_SETCURSOR: myself->OnSetCursor(LOWORD(lParam), HIWORD(lParam)); ::DefWindowProc(myself->m_hWnd, uMsg, wParam, lParam); @@ -4406,7 +4406,7 @@ LRESULT CALLBACK Console::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM case WM_DROPFILES: myself->OnDropFiles((HDROP)wParam); return 0; - + case WM_WINDOWPOSCHANGING: myself->OnWindowPosChanging((LPWINDOWPOS)lParam); return 0; @@ -4446,14 +4446,14 @@ LRESULT CALLBACK Console::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM case WM_VSCROLL: myself->OnVScroll(wParam); return 0; - + case WM_TIMER: switch (wParam) { case TIMER_REPAINT_CHANGE: case TIMER_REPAINT_MASTER: myself->OnPaintTimer(); return 0; - + case CURSOR_TIMER: myself->OnCursorTimer(); return 0; @@ -4467,17 +4467,17 @@ LRESULT CALLBACK Console::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM default: return 1; } - + case WM_COMMAND: if (myself->OnCommand(wParam, lParam)) { - return ::DefWindowProc(hwnd, uMsg, wParam, lParam); + return ::DefWindowProc(hwnd, uMsg, wParam, lParam); } else { return 0; } - + case WM_SYSCOMMAND: if (myself->OnSysCommand(wParam, lParam)) { - return ::DefWindowProc(hwnd, uMsg, wParam, lParam); + return ::DefWindowProc(hwnd, uMsg, wParam, lParam); } else { return 0; } @@ -4494,10 +4494,10 @@ LRESULT CALLBACK Console::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM case WM_INPUTLANGCHANGEREQUEST: myself->OnInputLangChangeRequest(wParam, lParam); return ::DefWindowProc(hwnd, uMsg, wParam, lParam); - + // process other messages - default: - return ::DefWindowProc(hwnd, uMsg, wParam, lParam); + default: + return ::DefWindowProc(hwnd, uMsg, wParam, lParam); } return 0; } @@ -4513,10 +4513,10 @@ DWORD WINAPI Console::MonitorThreadStatic(LPVOID lpParam) { } DWORD Console::MonitorThread() { - + // HANDLE arrHandles[] = {m_hConsoleProcess, m_hQuitEvent, m_hStdOut}; // HANDLE arrHandles[] = { m_hStdOut}; - + for (;;) { // Infinite loop #if 0 DWORD dwWait = ::WaitForMultipleObjects(1, arrHandles, FALSE, INFINITE); @@ -4572,3 +4572,4 @@ BOOL WINAPI Console::CtrlHandler(DWORD dwCtrlType) { ///////////////////////////////////////////////////////////////////////////// + diff --git a/Console/Console.h b/Console/Console.h index 0a3076d2..cd79e628 100644 --- a/Console/Console.h +++ b/Console/Console.h @@ -9,17 +9,17 @@ // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Send bug reports, bug fixes, enhancements, requests, flames, etc., and -// I'll try to keep a version up to date. I can be reached as follows: -// marko.bozikovic@alterbox.net -// bozho@kset.org +// I'll try to keep a version up to date. I can be reached as follows: +// marko.bozikovic@alterbox.net +// bozho@kset.org ///////////////////////////////////////////////////////////////////////////// @@ -441,7 +441,7 @@ class Console { // Console window handle HWND m_hWnd; - HWND m_notifyhWnd; + HWND m_notifyhWnd; // console colors COLORREF m_arrConsoleColors[16]; diff --git a/Console/Console.rc b/Console/Console.rc index 09f939d7..50c3ec3f 100644 --- a/Console/Console.rc +++ b/Console/Console.rc @@ -26,17 +26,17 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL // Dialog // -IDD_ABOUT DIALOG DISCARDABLE 0, 0, 146, 87 +IDD_ABOUT DIALOG DISCARDABLE 0, 0, 146, 87 STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | - WS_CAPTION | WS_SYSMENU + WS_CAPTION | WS_SYSMENU CAPTION "About Console" FONT 8, "MS Sans Serif" BEGIN - DEFPUSHBUTTON "OK",IDOK,48,66,50,14 - LTEXT "Console v1.5",IDC_STATIC,51,11,42,8 - LTEXT "Copyright© 2001-2005 Marko Bozikovic",IDC_STATIC,9,30, - 127,8 - LTEXT "bozho@kset.org",IDC_STATIC,46,45,53,8 + DEFPUSHBUTTON "OK",IDOK,48,66,50,14 + LTEXT "Console v1.5",IDC_STATIC,51,11,42,8 + LTEXT "Copyright© 2001-2005 Marko Bozikovic",IDC_STATIC,9,30, + 127,8 + LTEXT "bozho@kset.org",IDC_STATIC,46,45,53,8 END @@ -48,17 +48,17 @@ END #ifdef APSTUDIO_INVOKED GUIDELINES DESIGNINFO DISCARDABLE BEGIN - IDD_ABOUT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 139 - TOPMARGIN, 7 - BOTTOMMARGIN, 80 - END + IDD_ABOUT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 139 + TOPMARGIN, 7 + BOTTOMMARGIN, 80 + END END -#endif // APSTUDIO_INVOKED +#endif // APSTUDIO_INVOKED -#endif // Neutral resources +#endif // Neutral resources ///////////////////////////////////////////////////////////////////////////// @@ -78,7 +78,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -//IDI_ICON2 ICON DISCARDABLE "Console.ico" +//IDI_ICON2 ICON DISCARDABLE "Console.ico" ///////////////////////////////////////////////////////////////////////////// // @@ -87,26 +87,26 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT IDR_POPUP_MENU MENU DISCARDABLE BEGIN - POPUP " " - BEGIN -// MENUITEM "Read&me", ID_SHOW_README_FILE - MENUITEM "&About Console", ID_ABOUT - MENUITEM SEPARATOR - MENUITEM "&Copy", ID_COPY - MENUITEM "&Paste", ID_PASTE - MENUITEM SEPARATOR -// MENUITEM "Always on &top", ID_TOGGLE_ONTOP -// MENUITEM "&Hide console", ID_HIDE_CONSOLE -// MENUITEM SEPARATOR -// MENUITEM "&Select configuration file", ID_SEL_CONFIG_FILE -// MENUITEM "&Edit configuration file", ID_EDIT_CONFIG_FILE -// MENUITEM "&Reload settings", ID_RELOAD_SETTINGS -// MENUITEM SEPARATOR - MENUITEM "E&xit", ID_EXIT_CONSOLE - END + POPUP " " + BEGIN +// MENUITEM "Read&me", ID_SHOW_README_FILE + MENUITEM "&About Console", ID_ABOUT + MENUITEM SEPARATOR + MENUITEM "&Copy", ID_COPY + MENUITEM "&Paste", ID_PASTE + MENUITEM SEPARATOR +// MENUITEM "Always on &top", ID_TOGGLE_ONTOP +// MENUITEM "&Hide console", ID_HIDE_CONSOLE +// MENUITEM SEPARATOR +// MENUITEM "&Select configuration file", ID_SEL_CONFIG_FILE +// MENUITEM "&Edit configuration file", ID_EDIT_CONFIG_FILE +// MENUITEM "&Reload settings", ID_RELOAD_SETTINGS +// MENUITEM SEPARATOR + MENUITEM "E&xit", ID_EXIT_CONSOLE + END END -#endif // Neutral (Default) resources +#endif // Neutral (Default) resources ///////////////////////////////////////////////////////////////////////////// @@ -127,22 +127,22 @@ LANGUAGE LANG_CROATIAN, SUBLANG_DEFAULT 1 TEXTINCLUDE DISCARDABLE BEGIN - "resource.h\0" + "resource.h\0" END 2 TEXTINCLUDE DISCARDABLE BEGIN - "#include ""afxres.h""\r\n" - "\0" + "#include ""afxres.h""\r\n" + "\0" END 3 TEXTINCLUDE DISCARDABLE BEGIN - "\r\n" - "\0" + "\r\n" + "\0" END -#endif // APSTUDIO_INVOKED +#endif // APSTUDIO_INVOKED #ifndef _MAC @@ -164,33 +164,33 @@ VS_VERSION_INFO VERSIONINFO FILETYPE 0x1L FILESUBTYPE 0x0L BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "000004b0" - BEGIN - VALUE "Comments", "A cool console window :-)\0" - VALUE "CompanyName", "Ingenuity Unlimited Ltd.\0" - VALUE "FileDescription", "Console\0" - VALUE "FileVersion", "1.5, Build 351 2005.09.22\0" - VALUE "InternalName", "Console\0" - VALUE "LegalCopyright", "Copyright © 2001-2004 Marko Bozikovic\0" - VALUE "LegalTrademarks", "Copyright © 2001-2004 Marko Bozikovic\0" - VALUE "OriginalFilename", "Console.exe\0" - VALUE "PrivateBuild", "\0" - VALUE "ProductName", "Console\0" - VALUE "ProductVersion", "1.5.00.351\0" - VALUE "SpecialBuild", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0, 1200 - END + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "Comments", "A cool console window :-)\0" + VALUE "CompanyName", "Ingenuity Unlimited Ltd.\0" + VALUE "FileDescription", "Console\0" + VALUE "FileVersion", "1.5, Build 351 2005.09.22\0" + VALUE "InternalName", "Console\0" + VALUE "LegalCopyright", "Copyright © 2001-2004 Marko Bozikovic\0" + VALUE "LegalTrademarks", "Copyright © 2001-2004 Marko Bozikovic\0" + VALUE "OriginalFilename", "Console.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Console\0" + VALUE "ProductVersion", "1.5.00.351\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END END -#endif // !_MAC +#endif // !_MAC -#endif // Croatian resources +#endif // Croatian resources ///////////////////////////////////////////////////////////////////////////// @@ -203,5 +203,5 @@ END ///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED +#endif // not APSTUDIO_INVOKED diff --git a/Console/Console_2005Express.vcproj b/Console/Console_2005Express.vcproj index f4404457..2b85b760 100644 --- a/Console/Console_2005Express.vcproj +++ b/Console/Console_2005Express.vcproj @@ -1,7 +1,7 @@ + + + + + + + + + + + + + + + + + diff --git a/Console/Cursors.cpp b/Console/Cursors.cpp index ad84e462..a74bd1b5 100644 --- a/Console/Cursors.cpp +++ b/Console/Cursors.cpp @@ -9,17 +9,17 @@ // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Send bug reports, bug fixes, enhancements, requests, flames, etc., and -// I'll try to keep a version up to date. I can be reached as follows: -// marko.bozikovic@alterbox.net -// bozho@kset.org +// I'll try to keep a version up to date. I can be reached as follows: +// marko.bozikovic@alterbox.net +// bozho@kset.org ///////////////////////////////////////////////////////////////////////////// @@ -49,7 +49,7 @@ XTermCursor::XTermCursor(HWND hwndConsole, HDC hdcWindow, COLORREF crCursorColor } XTermCursor::~XTermCursor() { - + ::DeleteObject(m_hActiveBrush); ::DeleteObject(m_hInactiveBrush); } @@ -74,7 +74,7 @@ void XTermCursor::Draw(LPRECT pRect) { ///////////////////////////////////////////////////////////////////////////// void XTermCursor::PrepareNext() { - + } ///////////////////////////////////////////////////////////////////////////// @@ -108,7 +108,7 @@ BlockCursor::~BlockCursor() { ///////////////////////////////////////////////////////////////////////////// void BlockCursor::Draw(LPRECT pRect) { - + if (m_bActive && m_bVisible) { ::FillRect(m_hdcWindow, pRect, m_hActiveBrush); @@ -143,7 +143,7 @@ NBBlockCursor::NBBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorCo } NBBlockCursor::~NBBlockCursor() { - + ::DeleteObject(m_hActiveBrush); } @@ -153,7 +153,7 @@ NBBlockCursor::~NBBlockCursor() { ///////////////////////////////////////////////////////////////////////////// void NBBlockCursor::Draw(LPRECT pRect) { - + ::FillRect(m_hdcWindow, pRect, m_hActiveBrush); } @@ -188,7 +188,7 @@ PulseBlockCursor::PulseBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCu } PulseBlockCursor::~PulseBlockCursor() { - + if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer); ::DeleteObject(m_hActiveBrush); } @@ -199,7 +199,7 @@ PulseBlockCursor::~PulseBlockCursor() { ///////////////////////////////////////////////////////////////////////////// void PulseBlockCursor::Draw(LPRECT pRect) { - + // this is called only once, to set the size of the cursor if (m_nMaxSize == 0) { if ((pRect->right - pRect->left) < (pRect->bottom - pRect->top)) { @@ -208,7 +208,7 @@ void PulseBlockCursor::Draw(LPRECT pRect) { m_nMaxSize = (pRect->bottom - pRect->top) >> 1; } } - + if (m_bActive) { RECT rect; ::CopyMemory(&rect, pRect, sizeof(RECT)); @@ -226,13 +226,13 @@ void PulseBlockCursor::Draw(LPRECT pRect) { ///////////////////////////////////////////////////////////////////////////// void PulseBlockCursor::PrepareNext() { - + if (m_nSize == 0) { m_nStep = 1; } else if (m_nSize == m_nMaxSize) { m_nStep = -1; } - + m_nSize += m_nStep; } @@ -256,9 +256,9 @@ BarCursor::BarCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor) } BarCursor::~BarCursor() { - + if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer); - + ::DeleteObject(m_hPen); } @@ -268,7 +268,7 @@ BarCursor::~BarCursor() { ///////////////////////////////////////////////////////////////////////////// void BarCursor::Draw(LPRECT pRect) { - + if (m_bActive && m_bVisible) { HPEN hOldPen = (HPEN)::SelectObject(m_hdcWindow, m_hPen); ::MoveToEx(m_hdcWindow, pRect->left, pRect->top, NULL); @@ -283,7 +283,7 @@ void BarCursor::Draw(LPRECT pRect) { ///////////////////////////////////////////////////////////////////////////// void BarCursor::PrepareNext() { - + m_bVisible = !m_bVisible; } @@ -308,7 +308,7 @@ ConsoleCursor::ConsoleCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorCo } ConsoleCursor::~ConsoleCursor() { - + if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer); ::DeleteObject(m_hActiveBrush); ::CloseHandle(m_hStdOut); @@ -320,7 +320,7 @@ ConsoleCursor::~ConsoleCursor() { ///////////////////////////////////////////////////////////////////////////// void ConsoleCursor::Draw(LPRECT pRect) { - + RECT rect; ::CopyMemory(&rect, pRect, sizeof(RECT)); @@ -345,7 +345,7 @@ void ConsoleCursor::Draw(LPRECT pRect) { ///////////////////////////////////////////////////////////////////////////// void ConsoleCursor::PrepareNext() { - + m_bVisible = !m_bVisible; } @@ -367,7 +367,7 @@ NBHLineCursor::NBHLineCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorCo } NBHLineCursor::~NBHLineCursor() { - + ::DeleteObject(m_hPen); } @@ -377,7 +377,7 @@ NBHLineCursor::~NBHLineCursor() { ///////////////////////////////////////////////////////////////////////////// void NBHLineCursor::Draw(LPRECT pRect) { - + HPEN hOldPen = (HPEN)::SelectObject(m_hdcWindow, m_hPen); ::MoveToEx(m_hdcWindow, pRect->left, pRect->bottom-1, NULL); ::LineTo(m_hdcWindow, pRect->right, pRect->bottom-1); @@ -390,7 +390,7 @@ void NBHLineCursor::Draw(LPRECT pRect) { ///////////////////////////////////////////////////////////////////////////// void NBHLineCursor::PrepareNext() { - + } ///////////////////////////////////////////////////////////////////////////// @@ -415,9 +415,9 @@ HLineCursor::HLineCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor) } HLineCursor::~HLineCursor() { - + if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer); - + ::DeleteObject(m_hPen); } @@ -481,9 +481,9 @@ VLineCursor::VLineCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor) } VLineCursor::~VLineCursor() { - + if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer); - + ::DeleteObject(m_hPen); } @@ -493,14 +493,14 @@ VLineCursor::~VLineCursor() { ///////////////////////////////////////////////////////////////////////////// void VLineCursor::Draw(LPRECT pRect) { - + // this is called only once, to set the size of the cursor if (m_nSize != (pRect->right - pRect->left - 1)) { m_nSize = pRect->right - pRect->left - 1; m_nPosition = 0; m_nStep = 1; } - + if (m_bActive) { HPEN hOldPen = (HPEN)::SelectObject(m_hdcWindow, m_hPen); ::MoveToEx(m_hdcWindow, pRect->left + m_nPosition, pRect->top, NULL); @@ -515,13 +515,13 @@ void VLineCursor::Draw(LPRECT pRect) { ///////////////////////////////////////////////////////////////////////////// void VLineCursor::PrepareNext() { - + if (m_nPosition == 0) { m_nStep = 1; } else if (m_nPosition == m_nSize) { m_nStep = -1; } - + m_nPosition += m_nStep; } @@ -545,7 +545,7 @@ RectCursor::RectCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor) } RectCursor::~RectCursor() { - + if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer); ::DeleteObject(m_hActiveBrush); } @@ -556,9 +556,9 @@ RectCursor::~RectCursor() { ///////////////////////////////////////////////////////////////////////////// void RectCursor::Draw(LPRECT pRect) { - + if (m_bActive && m_bVisible) { - + ::FrameRect(m_hdcWindow, pRect, m_hActiveBrush); } } @@ -569,7 +569,7 @@ void RectCursor::Draw(LPRECT pRect) { ///////////////////////////////////////////////////////////////////////////// void RectCursor::PrepareNext() { - + m_bVisible = !m_bVisible; } @@ -591,7 +591,7 @@ NBRectCursor::NBRectCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColo } NBRectCursor::~NBRectCursor() { - + ::DeleteObject(m_hActiveBrush); } @@ -601,7 +601,7 @@ NBRectCursor::~NBRectCursor() { ///////////////////////////////////////////////////////////////////////////// void NBRectCursor::Draw(LPRECT pRect) { - + ::FrameRect(m_hdcWindow, pRect, m_hActiveBrush); } @@ -636,7 +636,7 @@ PulseRectCursor::PulseRectCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCurs } PulseRectCursor::~PulseRectCursor() { - + if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer); ::DeleteObject(m_hActiveBrush); } @@ -647,7 +647,7 @@ PulseRectCursor::~PulseRectCursor() { ///////////////////////////////////////////////////////////////////////////// void PulseRectCursor::Draw(LPRECT pRect) { - + // this is called only once, to set the size of the cursor if (m_nMaxSize == 0) { if ((pRect->right - pRect->left) < (pRect->bottom - pRect->top)) { @@ -674,13 +674,13 @@ void PulseRectCursor::Draw(LPRECT pRect) { ///////////////////////////////////////////////////////////////////////////// void PulseRectCursor::PrepareNext() { - + if (m_nSize == 0) { m_nStep = 1; } else if (m_nSize == m_nMaxSize) { m_nStep = -1; } - + m_nSize += m_nStep; } @@ -705,13 +705,13 @@ FadeBlockCursor::FadeBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCurs , m_hMemDC(NULL) { m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 35, NULL); - + #if 0 if (g_bWin2000) { // on Win2000 we use real alpha blending - // create a reasonable-sized bitmap, since AlphaBlt resizes - // destination rect if needed, and we don't need to redraw the mem DC + // create a reasonable-sized bitmap, since AlphaBlt resizes + // destination rect if needed, and we don't need to redraw the mem DC // each time m_nBmpWidth = BLEND_BMP_WIDTH; m_nBmpHeight= BLEND_BMP_HEIGHT; @@ -743,7 +743,7 @@ FadeBlockCursor::FadeBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCurs } FadeBlockCursor::~FadeBlockCursor() { - + if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer); #if 0 @@ -761,10 +761,10 @@ FadeBlockCursor::~FadeBlockCursor() { ///////////////////////////////////////////////////////////////////////////// void FadeBlockCursor::Draw(LPRECT pRect) { - + #if 0 if (g_bWin2000) { - + g_pfnAlphaBlend( m_hdcWindow, pRect->left, @@ -777,7 +777,7 @@ void FadeBlockCursor::Draw(LPRECT pRect) { BLEND_BMP_WIDTH, BLEND_BMP_HEIGHT, m_bfn); - + } else { #endif @@ -800,7 +800,7 @@ void FadeBlockCursor::PrepareNext() { } else if ((DWORD)m_bfn.SourceConstantAlpha + ALPHA_STEP > 255) { m_nStep = -ALPHA_STEP; } - + m_bfn.SourceConstantAlpha += m_nStep; } else { #endif @@ -817,19 +817,19 @@ void FadeBlockCursor::PrepareNext() { ///////////////////////////////////////////////////////////////////////////// -// This function is used to create a fake blending for WinNT (uuseful only +// This function is used to create a fake blending for WinNT (uuseful only // for solid background, though) void FadeBlockCursor::FakeBlend() { - + int nDeltaR = ((GetRValue(m_crCursorColor) - GetRValue(m_crBkColor)) << 8) / FADE_STEPS; int nDeltaG = ((GetGValue(m_crCursorColor) - GetGValue(m_crBkColor)) << 8) / FADE_STEPS; int nDeltaB = ((GetBValue(m_crCursorColor) - GetBValue(m_crBkColor)) << 8) / FADE_STEPS; - + for (int i = 0; i < FADE_STEPS; ++i) { m_arrColors[i] = RGB(GetRValue(m_crCursorColor) - (nDeltaR*i >> 8), GetGValue(m_crCursorColor) - (nDeltaG*i >> 8), GetBValue(m_crCursorColor) - (nDeltaB*i >> 8)); } - + m_arrColors[FADE_STEPS] = m_crBkColor; } @@ -840,3 +840,4 @@ void FadeBlockCursor::FakeBlend() { ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// + diff --git a/Console/Cursors.h b/Console/Cursors.h index 93e05453..a8f1d212 100644 --- a/Console/Cursors.h +++ b/Console/Cursors.h @@ -9,17 +9,17 @@ // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Send bug reports, bug fixes, enhancements, requests, flames, etc., and -// I'll try to keep a version up to date. I can be reached as follows: -// marko.bozikovic@alterbox.net -// bozho@kset.org +// I'll try to keep a version up to date. I can be reached as follows: +// marko.bozikovic@alterbox.net +// bozho@kset.org ///////////////////////////////////////////////////////////////////////////// diff --git a/Console/Dialogs.cpp b/Console/Dialogs.cpp index 86180fa4..0ffc2f20 100644 --- a/Console/Dialogs.cpp +++ b/Console/Dialogs.cpp @@ -9,17 +9,17 @@ // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Send bug reports, bug fixes, enhancements, requests, flames, etc., and -// I'll try to keep a version up to date. I can be reached as follows: -// marko.bozikovic@alterbox.net -// bozho@kset.org +// I'll try to keep a version up to date. I can be reached as follows: +// marko.bozikovic@alterbox.net +// bozho@kset.org ///////////////////////////////////////////////////////////////////////////// @@ -72,8 +72,8 @@ BOOL CAboutDlg::DoModal() { ::DialogBox( ghInstance, - MAKEINTRESOURCE(IDD_ABOUT), - m_hWndParent, + MAKEINTRESOURCE(IDD_ABOUT), + m_hWndParent, CAboutDlg::DialogProc); return TRUE; @@ -106,7 +106,7 @@ int CALLBACK CAboutDlg::DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA break; } } - + return 0; } @@ -131,3 +131,4 @@ int CALLBACK CAboutDlg::DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA + diff --git a/Console/Dialogs.h b/Console/Dialogs.h index eaff697c..54cafb05 100644 --- a/Console/Dialogs.h +++ b/Console/Dialogs.h @@ -9,17 +9,17 @@ // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Send bug reports, bug fixes, enhancements, requests, flames, etc., and -// I'll try to keep a version up to date. I can be reached as follows: -// marko.bozikovic@alterbox.net -// bozho@kset.org +// I'll try to keep a version up to date. I can be reached as follows: +// marko.bozikovic@alterbox.net +// bozho@kset.org ///////////////////////////////////////////////////////////////////////////// diff --git a/Console/FileStream.cpp b/Console/FileStream.cpp index f5bd8af3..c78c0028 100644 --- a/Console/FileStream.cpp +++ b/Console/FileStream.cpp @@ -9,23 +9,23 @@ // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Send bug reports, bug fixes, enhancements, requests, flames, etc., and -// I'll try to keep a version up to date. I can be reached as follows: -// marko.bozikovic@alterbox.net -// bozho@kset.org +// I'll try to keep a version up to date. I can be reached as follows: +// marko.bozikovic@alterbox.net +// bozho@kset.org ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// -// FileStream.cpp - implementation of IStream interface on any file -// (not strictly COM, I'm faking it here a bit :-) +// FileStream.cpp - implementation of IStream interface on any file +// (not strictly COM, I'm faking it here a bit :-) // #undef CINTERFACE @@ -47,20 +47,20 @@ static char THIS_FILE[] = __FILE__; // CreateFileStream - opens/creates a file and returns an IStream interface HRESULT CreateFileStream( - LPCTSTR lpFileName, // file name - DWORD dwDesiredAccess, // access mode - DWORD dwShareMode, // share mode - LPSECURITY_ATTRIBUTES lpSecurityAttributes, // SD - DWORD dwCreationDisposition, // how to create - DWORD dwFlagsAndAttributes, // file attributes - HANDLE hTemplateFile, // handle to template file - IStream** ppStream // pointer to IStream interface + LPCTSTR lpFileName, // file name + DWORD dwDesiredAccess, // access mode + DWORD dwShareMode, // share mode + LPSECURITY_ATTRIBUTES lpSecurityAttributes, // SD + DWORD dwCreationDisposition, // how to create + DWORD dwFlagsAndAttributes, // file attributes + HANDLE hTemplateFile, // handle to template file + IStream** ppStream // pointer to IStream interface ) { HANDLE hFile = ::CreateFile( lpFileName, - dwDesiredAccess, + dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, @@ -111,8 +111,8 @@ FileStream::~FileStream() // IStream methods ///////////////////////////////////////////////////////////////////////////// -// Read - reads a specified number of bytes from the stream object into memory -// starting at the current seek pointer +// Read - reads a specified number of bytes from the stream object into memory +// starting at the current seek pointer STDMETHODIMP FileStream::Read(void *pv, ULONG cb, ULONG *pcbRead) { @@ -125,8 +125,8 @@ STDMETHODIMP FileStream::Read(void *pv, ULONG cb, ULONG *pcbRead) ///////////////////////////////////////////////////////////////////////////// -// Write - writes a specified number of bytes into the stream object starting -// at the current seek pointer +// Write - writes a specified number of bytes into the stream object starting +// at the current seek pointer STDMETHODIMP FileStream::Write(void const *pv, ULONG cb, ULONG *pcbWritten) { @@ -139,8 +139,8 @@ STDMETHODIMP FileStream::Write(void const *pv, ULONG cb, ULONG *pcbWritten) ///////////////////////////////////////////////////////////////////////////// -// Seek - changes the seek pointer to a new location relative to the beginning -// of the stream, to the end of the stream, or to the current seek pointer +// Seek - changes the seek pointer to a new location relative to the beginning +// of the stream, to the end of the stream, or to the current seek pointer STDMETHODIMP FileStream::Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) { @@ -148,7 +148,7 @@ STDMETHODIMP FileStream::Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INT DWORD dwMoveLow = dlibMove.LowPart; LONG lMoveHigh = dlibMove.HighPart; - + switch (dwOrigin) { case STREAM_SEEK_SET : dwFileOrigin = FILE_BEGIN; break; case STREAM_SEEK_CUR : dwFileOrigin = FILE_CURRENT; break; @@ -181,8 +181,8 @@ STDMETHODIMP FileStream::SetSize(ULARGE_INTEGER libNewSize) ///////////////////////////////////////////////////////////////////////////// -// CopyTo - copies a specified number of bytes from the current seek pointer -// in the stream to the current seek pointer in another stream +// CopyTo - copies a specified number of bytes from the current seek pointer +// in the stream to the current seek pointer in another stream STDMETHODIMP FileStream::CopyTo(IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten) { diff --git a/Console/FileStream.h b/Console/FileStream.h index 2dcf08dd..4ac8966b 100644 --- a/Console/FileStream.h +++ b/Console/FileStream.h @@ -9,23 +9,23 @@ // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Send bug reports, bug fixes, enhancements, requests, flames, etc., and -// I'll try to keep a version up to date. I can be reached as follows: -// marko.bozikovic@alterbox.net -// bozho@kset.org +// I'll try to keep a version up to date. I can be reached as follows: +// marko.bozikovic@alterbox.net +// bozho@kset.org ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // FileStream.h - implementation of IStream interface on any file -// (not really COM, I'm faking it here a bit :-) +// (not really COM, I'm faking it here a bit :-) // #pragma once @@ -35,14 +35,14 @@ // CreateFileStream - opens/creates a file and returns an IStream interface HRESULT CreateFileStream( - LPCTSTR lpFileName, // file name - DWORD dwDesiredAccess, // access mode - DWORD dwShareMode, // share mode - LPSECURITY_ATTRIBUTES lpSecurityAttributes, // SD - DWORD dwCreationDisposition, // how to create - DWORD dwFlagsAndAttributes, // file attributes - HANDLE hTemplateFile, // handle to template file - IStream** ppStream // pointer to IStream interface + LPCTSTR lpFileName, // file name + DWORD dwDesiredAccess, // access mode + DWORD dwShareMode, // share mode + LPSECURITY_ATTRIBUTES lpSecurityAttributes, // SD + DWORD dwCreationDisposition, // how to create + DWORD dwFlagsAndAttributes, // file attributes + HANDLE hTemplateFile, // handle to template file + IStream** ppStream // pointer to IStream interface ); diff --git a/Credits.cpp b/Credits.cpp index fa5ef6d2..42f86a28 100644 --- a/Credits.cpp +++ b/Credits.cpp @@ -2,13 +2,11 @@ #include "JA2 All.h" #include "Credits.h" #include "Encrypted File.h" - //#include "Utils All.h" - #include "Language Defines.h" + #include "Language Defines.h" #else #include "Types.h" #include "Credits.h" - //#include "Utils All.h" - #include "Language Defines.h" + #include "Language Defines.h" #include "vsurface.h" #include "mousesystem.h" #include "Text.h" @@ -186,9 +184,9 @@ typedef struct } CDRT_FACE; -CDRT_FACE gCreditFaces[] = +CDRT_FACE gCreditFaces[] = { -// x y w h +// x y w h 298, 137, 37, 49, 310, 157, 304, 170, 2500, 0, 0, //Camfield 348, 137, 43, 47, 354, 153, 354, 153, 3700, 0, 0, //Shawn 407, 132, 30, 50, 408, 151, 410, 164, 3000, 0, 0, //Kris @@ -321,7 +319,7 @@ UINT32 guiCreditScreenActiveFont; // the font that is used UINT32 guiCreditScreenTitleFont; // the font that is used UINT8 gubCreditScreenActiveColor; // color of the font UINT8 gubCreditScreenTitleColor; // color of a Title node -//UINT32 guiCreditScreenActiveDisplayFlags; // +//UINT32 guiCreditScreenActiveDisplayFlags; // UINT32 guiCrdtNodeScrollSpeed = CRDT_NODE_DELAY_AMOUNT; //speed credits go up at //UINT32 guiCrdtTimeTillReadNextCredit = CRDT_DELAY_BN_SECTIONS; //the delay before reading the next credit ( normall = guiCrdtDelayBetweenCreditSection or guiCrdtDelayBetweenNodes ) @@ -418,13 +416,13 @@ UINT32 CreditScreenHandle( void ) } GetCreditScreenUserInput(); - + HandleCreditScreen(); - // render buttons marked dirty + // render buttons marked dirty // MarkButtonsDirty( ); -// RenderButtons( ); +// RenderButtons( ); // render help // RenderFastHelp( ); @@ -465,7 +463,7 @@ UINT32 CreditScreenShutdown( void ) BOOLEAN EnterCreditsScreen() { UINT32 uiCnt; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; /* VSURFACE_DESC vs_desc; @@ -475,12 +473,12 @@ BOOLEAN EnterCreditsScreen() strcpy(vs_desc.ImageFile, "INTERFACE\\Credits.sti"); if( !AddVideoSurface( &vs_desc, &guiCreditBackGroundImage ) ) - { + { return( FALSE ); } */ - gfModCredits = TRUE; + gfModCredits = TRUE; ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0 ); VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; @@ -540,7 +538,7 @@ BOOLEAN EnterCreditsScreen() { // Make a mouse region MSYS_DefineRegion( &gCrdtMouseRegions[uiCnt], gCreditFaces[uiCnt].sX, gCreditFaces[uiCnt].sY, (INT16)(gCreditFaces[uiCnt].sX + gCreditFaces[uiCnt].sWidth), (INT16)(gCreditFaces[uiCnt].sY + gCreditFaces[uiCnt].sHeight), MSYS_PRIORITY_NORMAL, - CURSOR_WWW, SelectCreditFaceMovementRegionCallBack, SelectCreditFaceRegionCallBack ); + CURSOR_WWW, SelectCreditFaceMovementRegionCallBack, SelectCreditFaceRegionCallBack ); // Add region MSYS_AddRegion( &gCrdtMouseRegions[uiCnt] ); @@ -552,7 +550,7 @@ BOOLEAN EnterCreditsScreen() //open the credit text file ghFile = FileOpen( CRDT_NAME_OF_CREDIT_FILE, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); if( !ghFile ) - { + { return( FALSE ); } */ @@ -576,7 +574,7 @@ BOOLEAN ExitCreditScreen() //Blit the background image // DeleteVideoSurfaceFromIndex( guiCreditBackGroundImage ); DeleteVideoObjectFromIndex( guiCreditBackGroundImage ); - + DeleteVideoObjectFromIndex( guiCreditFaces ); @@ -644,10 +642,10 @@ void HandleCreditScreen() BOOLEAN RenderCreditScreen() { - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; GetVideoObject(&hPixHandle, guiCreditBackGroundImage ); - BltVideoObject( FRAME_BUFFER, hPixHandle, 0, 0, 0, VO_BLT_SRCTRANSPARENCY, NULL); + BltVideoObject( FRAME_BUFFER, hPixHandle, 0, 0, 0, VO_BLT_SRCTRANSPARENCY, NULL); /* HVSURFACE hVSurface; @@ -861,7 +859,7 @@ BOOLEAN AddCreditNode( UINT32 uiType, UINT32 uiFlags, STR16 pString ) // // Set some default data - // + // //the type of the node pNodeToAdd->uiType = uiType; @@ -960,7 +958,6 @@ BOOLEAN AddCreditNode( UINT32 uiType, UINT32 uiFlags, STR16 pString ) void HandleCreditNodes() { - UINT32 uiCurrentTime =GetJA2Clock(); CRDT_NODE *pCurrent=NULL; CRDT_NODE *pTemp=NULL; @@ -1018,8 +1015,6 @@ void HandleCurrentCreditNode( CRDT_NODE *pCurrent ) void HandleNode_Default( CRDT_NODE *pCurrent ) { - UINT32 uiCurrentTime =GetJA2Clock(); - //if it is time to update the current node // if( ( uiCurrentTime - pCurrent->uiLastTime ) > guiCrdtNodeScrollSpeed ) { @@ -1080,7 +1075,7 @@ BOOLEAN DisplayCreditNode( CRDT_NODE *pCurrent ) //INT16 sHeight = 480 - pCurrent->sOldPosY; RestoreExternBackgroundRect( pCurrent->sOldPosX, pCurrent->sOldPosY, CRDT_WIDTH_OF_TEXT_AREA, sHeight ); } - else if( pCurrent->sOldPosY > CRDT_LINE_NODE_DISAPPEARS_AT ) + else if( pCurrent->sOldPosY > CRDT_LINE_NODE_DISAPPEARS_AT ) { RestoreExternBackgroundRect( pCurrent->sOldPosX, pCurrent->sOldPosY, CRDT_WIDTH_OF_TEXT_AREA, pCurrent->sHeightOfString ); } @@ -1098,20 +1093,17 @@ BOOLEAN DisplayCreditNode( CRDT_NODE *pCurrent ) BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, pCurrent->sPosX, pCurrent->sPosY, VS_BLT_CLIPPED | VS_BLT_USECOLORKEY, NULL ); - + return( TRUE ); } //return false from this function when there are no more items in the text file BOOLEAN GetNextCreditFromTextFile() { - BOOLEAN fDone = FALSE; - UINT32 uiStringWidth = 20; CHAR16 zOriginalString[512]; CHAR16 zString[512]; CHAR16 zCodes[512]; STR16 pzNewCode=NULL; - UINT32 uiCodeType = 0; UINT32 uiNodeType = 0; UINT32 uiStartLoc = 0; UINT32 uiFlags=0; @@ -1261,7 +1253,7 @@ BOOLEAN GetNextCreditFromTextFile() break; case 28: - wcscpy(zOriginalString, L"Starwalker"); + wcscpy(zOriginalString, L"Starwalker"); break; case 29: @@ -1344,7 +1336,7 @@ BOOLEAN GetNextCreditFromTextFile() case 48: wcscpy(zOriginalString, L"@}; "); break; - + // 3.) Sir-Tech Credits default: //Get the current Credit record @@ -1465,7 +1457,7 @@ UINT32 GetAndHandleCreditCodeFromCodeString( STR16 pzCode ) swscanf( &pzCode[1], L"%d%*s", &uiNewDelay ); // guiCrdtDelayBetweenNodes = uiNewDelay; - guiGapBetweenCreditNodes = uiNewDelay; + guiGapBetweenCreditNodes = uiNewDelay; return( CRDT_NODE_NONE ); } @@ -1648,11 +1640,11 @@ void SelectCreditFaceRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } void SelectCreditFaceMovementRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if( iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { giCurrentlySelectedFace = -1; @@ -1678,7 +1670,7 @@ void InitCreditEyeBlinking() void HandleCreditEyeBlinking() { - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; UINT8 ubCnt; GetVideoObject(&hPixHandle, guiCreditFaces ); @@ -1689,7 +1681,7 @@ void HandleCreditEyeBlinking() { // EXCEPTION IS THROWN HERE! BltVideoObject( FRAME_BUFFER, hPixHandle, (UINT8)(ubCnt*3), gCreditFaces[ubCnt].sEyeX, gCreditFaces[ubCnt].sEyeY, VO_BLT_SRCTRANSPARENCY, NULL); - + InvalidateRegion( gCreditFaces[ubCnt].sEyeX, gCreditFaces[ubCnt].sEyeY, gCreditFaces[ubCnt].sEyeX + CRDT_EYE_WIDTH, gCreditFaces[ubCnt].sEyeY + CRDT_EYE_HEIGHT ); gCreditFaces[ubCnt].uiLastBlinkTime = GetJA2Clock(); diff --git a/Editor/Button Defines.h b/Editor/Button Defines.h index e4ec9dac..f4b0a036 100644 --- a/Editor/Button Defines.h +++ b/Editor/Button Defines.h @@ -63,6 +63,7 @@ enum ITEMS_WEAPONS, FIRST_ITEMS_BUTTON = ITEMS_WEAPONS, ITEMS_AMMO, ITEMS_ARMOUR, + ITEMS_LBEGEAR, ITEMS_EXPLOSIVES, ITEMS_EQUIPMENT1, ITEMS_EQUIPMENT2, @@ -249,9 +250,9 @@ enum #define FIRST_MERCS_COLORMODE_BUTTON MERCS_TOGGLECOLOR_BUTTON #define LAST_MERCS_COLORMODE_BUTTON MERCS_BODYTYPE_UP -#define FIRST_MERCS_COLOR_BUTTON MERCS_HAIRCOLOR_DOWN +#define FIRST_MERCS_COLOR_BUTTON MERCS_HAIRCOLOR_DOWN #define LAST_MERCS_COLOR_BUTTON MERCS_PANTCOLOR_UP -#define FIRST_MERCS_BODYTYPE_BUTTON MERCS_BODYTYPE_DOWN +#define FIRST_MERCS_BODYTYPE_BUTTON MERCS_BODYTYPE_DOWN #define LAST_MERCS_BODYTYPE_BUTTON MERCS_BODYTYPE_UP #define FIRST_MERCS_INVENTORY_BUTTON MERCS_HEAD_SLOT @@ -264,4 +265,4 @@ enum #define LAST_MERCS_SCHEDULE_BUTTON MERCS_SCHEDULE_CLEAR #endif -#endif \ No newline at end of file +#endif diff --git a/Editor/Cursor Modes.cpp b/Editor/Cursor Modes.cpp index 79024c99..29116f09 100644 --- a/Editor/Cursor Modes.cpp +++ b/Editor/Cursor Modes.cpp @@ -51,7 +51,7 @@ void EnsureSelectionType(); //Used for offseting cursor to show that it is on the roof rather than on the ground. //This can be conveniently executed by moving the cursor up and right 3 gridnos for a -//total of -483 -(160*3)-(1*3) +//total of -483 -(160*3)-(1*3) #define ROOF_OFFSET (-483) BOOLEAN gfUsingOffset; @@ -98,7 +98,7 @@ void RemoveCursors() Assert( gSelectRegion.iTop >= 0 && gSelectRegion.iTop <= gSelectRegion.iBottom ); Assert( gSelectRegion.iLeft >= 0 && gSelectRegion.iLeft <= gSelectRegion.iRight ); for( y = gSelectRegion.iTop; y <= gSelectRegion.iBottom; y++ ) - { + { for( x = gSelectRegion.iLeft; x <= gSelectRegion.iRight; x++ ) { LEVELNODE* pNode; @@ -160,14 +160,14 @@ void UpdateCursorAreas() } else switch( gusSelectionType ) { - case SMALLSELECTION: + case SMALLSELECTION: gSelectRegion.iLeft = gSelectRegion.iRight = sGridX; gSelectRegion.iTop = gSelectRegion.iBottom = sGridY; fValidCursor = TRUE; break; - case MEDIUMSELECTION: - case LARGESELECTION: - case XLARGESELECTION: + case MEDIUMSELECTION: + case LARGESELECTION: + case XLARGESELECTION: //The mouse mode value reflects the size of the cursor. gSelectRegion.iTop = sGridY - gusSelectionType; gSelectRegion.iBottom = sGridY + gusSelectionType; @@ -189,13 +189,13 @@ void UpdateCursorAreas() //Draw all of the area cursors here. if( fValidCursor ) { - if( iDrawMode == DRAW_MODE_ENEMY || iDrawMode == DRAW_MODE_CREATURE || + if( iDrawMode == DRAW_MODE_ENEMY || iDrawMode == DRAW_MODE_CREATURE || iDrawMode == DRAW_MODE_REBEL || iDrawMode == DRAW_MODE_CIVILIAN || iDrawMode == DRAW_MODE_SCHEDULEACTION ) { iMapIndex = gSelectRegion.iTop * WORLD_COLS + gSelectRegion.iLeft; - if( !IsLocationSittable( iMapIndex, gfRoofPlacement ) && iDrawMode != DRAW_MODE_SCHEDULEACTION || - !IsLocationSittableExcludingPeople( iMapIndex, gfRoofPlacement ) && iDrawMode == DRAW_MODE_SCHEDULEACTION ) + if( !IsLocationSittable( iMapIndex, gfRoofPlacement ) && iDrawMode != DRAW_MODE_SCHEDULEACTION || + !IsLocationSittableExcludingPeople( iMapIndex, gfRoofPlacement ) && iDrawMode == DRAW_MODE_SCHEDULEACTION ) { if( sBadMarker != iMapIndex ) { @@ -225,7 +225,7 @@ void UpdateCursorAreas() } } else for( y = gSelectRegion.iTop; y <= gSelectRegion.iBottom; y++ ) - { + { for( x = gSelectRegion.iLeft; x <= gSelectRegion.iRight; x++ ) { iMapIndex = y * WORLD_COLS + x; @@ -238,11 +238,11 @@ void UpdateCursorAreas() void ForceAreaSelectionWidth() { UINT16 gusDecSelWidth; - + //If the anchor isn't set, we don't want to force the size yet. if( !fAnchored ) return; - + gusDecSelWidth = gusSelectionWidth - 1; //compare the region with the anchor and determine if we are going to force size via @@ -280,8 +280,8 @@ BOOLEAN HandleAreaSelection() //When the user releases the left button, then clear and process the area. if( fAnchored ) { - if( !gfLeftButtonState && !gfCurrentSelectionWithRightButton || - !gfRightButtonState && gfCurrentSelectionWithRightButton ) + if( !gfLeftButtonState && !gfCurrentSelectionWithRightButton || + !gfRightButtonState && gfCurrentSelectionWithRightButton ) { fAnchored = FALSE; ProcessAreaSelection( (BOOLEAN)!gfCurrentSelectionWithRightButton ); @@ -341,8 +341,8 @@ BOOLEAN HandleAreaSelection() void ValidateSelectionRegionBoundaries() { gSelectRegion.iLeft = max( min( 159, gSelectRegion.iLeft ) , 0 ); - gSelectRegion.iRight = max( min( 159, gSelectRegion.iRight ), 0 ); - gSelectRegion.iTop = max( min( 159, gSelectRegion.iTop ) , 0 ); + gSelectRegion.iRight = max( min( 159, gSelectRegion.iRight ), 0 ); + gSelectRegion.iTop = max( min( 159, gSelectRegion.iTop ) , 0 ); gSelectRegion.iBottom = max( min( 159, gSelectRegion.iBottom ), 0 ); } @@ -350,10 +350,10 @@ void EnsureSelectionType() { BOOLEAN fPrevBrushEnabledState = gfBrushEnabled; - //At time of writing, the only drawing mode supporting right mouse button + //At time of writing, the only drawing mode supporting right mouse button //area selections is the cave drawing mode. gfAllowRightButtonSelections = ( iDrawMode == DRAW_MODE_CAVES ); - + //if we are erasing, we have more flexibility with the drawing modes. if( iDrawMode >= DRAW_MODE_ERASE ) { @@ -440,7 +440,7 @@ void DrawBuildingLayout( INT32 iMapIndex ) if( fAdd ) AddTopmostToTail( iMapIndex, FIRSTPOINTERS1 ); } - curr = curr->next; + curr = curr->next; } } @@ -457,8 +457,8 @@ void RemoveBuildingLayout() iMapIndex = curr->sGridNo + iOffset; if( iMapIndex > 0 && iMapIndex < WORLD_MAX ) RemoveTopmost( iMapIndex, FIRSTPOINTERS1 ); - curr = curr->next; + curr = curr->next; } } -#endif \ No newline at end of file +#endif diff --git a/Editor/Editor Callback Prototypes.h b/Editor/Editor Callback Prototypes.h index 28bbcb3d..d33038f4 100644 --- a/Editor/Editor Callback Prototypes.h +++ b/Editor/Editor Callback Prototypes.h @@ -93,6 +93,7 @@ void TerrainTileButtonRegionCallback(MOUSE_REGION *reg,INT32 reason); void ItemsWeaponsCallback(GUI_BUTTON *btn,INT32 reason); void ItemsAmmoCallback(GUI_BUTTON *btn,INT32 reason); void ItemsArmourCallback(GUI_BUTTON *btn,INT32 reason); +void ItemsLBECallback(GUI_BUTTON *btn,INT32 reason); void ItemsExplosivesCallback(GUI_BUTTON *btn,INT32 reason); void ItemsEquipment1Callback(GUI_BUTTON *btn,INT32 reason); void ItemsEquipment2Callback(GUI_BUTTON *btn,INT32 reason); @@ -154,4 +155,4 @@ void BtnEraseCallback(GUI_BUTTON *btn,INT32 reason); #endif -#endif \ No newline at end of file +#endif diff --git a/Editor/Editor Callbacks.cpp b/Editor/Editor Callbacks.cpp index c69a690b..f981215b 100644 --- a/Editor/Editor Callbacks.cpp +++ b/Editor/Editor Callbacks.cpp @@ -401,10 +401,10 @@ void BuildingSawRoomCallback( GUI_BUTTON *btn, INT32 reason ) void BuildingKillBuildingCallback(GUI_BUTTON *btn, INT32 reason) { - if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) { SetEditorBuildingTaskbarMode( BUILDING_KILL_BUILDING ); - iDrawMode = DRAW_MODE_KILL_BUILDING; + iDrawMode = DRAW_MODE_KILL_BUILDING; } } @@ -428,10 +428,10 @@ void BuildingMoveBuildingCallback( GUI_BUTTON *btn, INT32 reason ) void BuildingDrawRoomNumCallback(GUI_BUTTON *btn, INT32 reason) { - if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) { SetEditorBuildingTaskbarMode( BUILDING_DRAW_ROOMNUM ); - iDrawMode = DRAW_MODE_ROOMNUM; + iDrawMode = DRAW_MODE_ROOMNUM; gubCurrRoomNumber = gubMaxRoomNumber; } } @@ -457,7 +457,7 @@ void BuildingToggleRoofViewCallback(GUI_BUTTON *btn,INT32 reason) { UnclickEditorButton( BUILDING_TOGGLE_ROOF_VIEW ); } - //Name could be a bit misleading. It'll hide or show the roofs based on the + //Name could be a bit misleading. It'll hide or show the roofs based on the //fBuildingShowRoofs value. UpdateRoofsView(); } @@ -475,7 +475,7 @@ void BuildingToggleWallViewCallback(GUI_BUTTON *btn,INT32 reason) { UnclickEditorButton( BUILDING_TOGGLE_WALL_VIEW ); } - //Name could be a bit misleading. It'll hide or show the walls based on the + //Name could be a bit misleading. It'll hide or show the walls based on the //fBuildingShowWalls value. UpdateWallsView(); } @@ -506,7 +506,7 @@ void BtnFakeLightCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON); else btn->uiFlags |= BUTTON_CLICKED_ON; - + iEditorToolbarState = TBAR_MODE_FAKE_LIGHTING; } } @@ -701,6 +701,12 @@ void ItemsArmourCallback(GUI_BUTTON *btn,INT32 reason) SetEditorItemsTaskbarMode( ITEMS_ARMOUR ); } +void ItemsLBECallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + SetEditorItemsTaskbarMode( ITEMS_LBEGEAR ); +} + void ItemsExplosivesCallback(GUI_BUTTON *btn,INT32 reason) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) @@ -1295,7 +1301,7 @@ void MouseMovedInMercRegion( MOUSE_REGION *reg, INT32 reason ) void MouseClickedInMercRegion( MOUSE_REGION *reg, INT32 reason ) { if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - HandleMercInventoryPanel( reg->RelativeXPos, reg->RelativeYPos, GUI_LCLICK_EVENT ); + HandleMercInventoryPanel( reg->RelativeXPos, reg->RelativeYPos, GUI_LCLICK_EVENT ); else if( reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) HandleMercInventoryPanel( reg->RelativeXPos, reg->RelativeYPos, GUI_RCLICK_EVENT ); } @@ -1340,4 +1346,4 @@ void ItemStatsDeleteCallback( GUI_BUTTON *btn, INT32 reason ) } -#endif \ No newline at end of file +#endif diff --git a/Editor/Editor Modes.cpp b/Editor/Editor Modes.cpp index 95bfa4e1..0951a6e3 100644 --- a/Editor/Editor Modes.cpp +++ b/Editor/Editor Modes.cpp @@ -44,6 +44,10 @@ void SetEditorItemsTaskbarMode( UINT16 usNewMode ) ClickEditorButton( ITEMS_ARMOUR ); iEditorToolbarState = TBAR_MODE_ITEM_ARMOUR; break; + case ITEMS_LBEGEAR: + ClickEditorButton( ITEMS_LBEGEAR ); + iEditorToolbarState = TBAR_MODE_ITEM_LBEGEAR; + break; case ITEMS_EXPLOSIVES: ClickEditorButton( ITEMS_EXPLOSIVES ); iEditorToolbarState = TBAR_MODE_ITEM_EXPLOSIVES; @@ -75,7 +79,6 @@ void SetEditorItemsTaskbarMode( UINT16 usNewMode ) void SetEditorBuildingTaskbarMode( UINT16 usNewMode ) { - BOOLEAN fNewGroup = FALSE; BOOLEAN fNewRoofs, fNewWalls, fNewRoomInfo; if( usNewMode == usCurrentMode ) { @@ -137,7 +140,7 @@ void SetEditorBuildingTaskbarMode( UINT16 usNewMode ) case BUILDING_PLACE_FLOORS: case BUILDING_PLACE_TOILETS: case BUILDING_PLACE_FURNITURE: - case BUILDING_PLACE_DECALS: + case BUILDING_PLACE_DECALS: case BUILDING_SMART_WALLS: case BUILDING_SMART_DOORS: case BUILDING_SMART_WINDOWS: @@ -185,7 +188,7 @@ void SetEditorBuildingTaskbarMode( UINT16 usNewMode ) fBuildingShowRoomInfo = fNewRoomInfo; gfRenderWorld = TRUE; } -} +} void SetEditorTerrainTaskbarMode( UINT16 usNewMode ) { @@ -345,11 +348,11 @@ void SetEditorMapInfoTaskbarMode( UINT16 usNewMode ) break; } if( fShowExitGrids ) - { + { ShowExitGrids(); } else - { + { HideExitGrids(); } } @@ -392,4 +395,4 @@ void SetEditorSmoothingMode( UINT8 ubNewMode ) gMapInformation.ubEditorSmoothingType = ubNewMode; } -#endif \ No newline at end of file +#endif diff --git a/Editor/Editor Taskbar Creation.cpp b/Editor/Editor Taskbar Creation.cpp index d2ca75e3..9e034e68 100644 --- a/Editor/Editor Taskbar Creation.cpp +++ b/Editor/Editor Taskbar Creation.cpp @@ -7,11 +7,11 @@ #ifdef JA2EDITOR #ifndef PRECOMPILEDHEADERS - //sgp + //sgp #include "Button System.h" #include "Font Control.h" #include "debug.h" - //editor + //editor #include "EditorDefines.h" #include "Editor Callback Prototypes.h" #include "Editor Taskbar Utils.h" @@ -34,8 +34,8 @@ void InitEditorItemStatsButtons(); void InitEditorItemStatsButtons() { - iEditorButton[ ITEMSTATS_PANEL ] = - CreateTextButton( 0, 0, 0, 0, BUTTON_USE_DEFAULT, iScreenWidthOffset + 480, 2 * iScreenHeightOffset + 361, 160, 99, BUTTON_TOGGLE, + iEditorButton[ ITEMSTATS_PANEL ] = + CreateTextButton( 0, 0, 0, 0, BUTTON_USE_DEFAULT, iScreenWidthOffset + 480, 2 * iScreenHeightOffset + 361, 160, 99, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, BUTTON_NO_CALLBACK, BUTTON_NO_CALLBACK ); SpecifyDisabledButtonStyle( iEditorButton[ ITEMSTATS_PANEL ], DISABLED_STYLE_NONE ); DisableButton( iEditorButton[ ITEMSTATS_PANEL ] ); @@ -52,217 +52,217 @@ void InitEditorMercsToolbar() STR16 FaceDirs[8] = {L"north",L"northeast",L"east",L"southeast",L"south",L"southwest",L"west",L"northwest"}; INT32 x; - iEditorButton[ MERCS_PLAYERTOGGLE ] = + iEditorButton[ MERCS_PLAYERTOGGLE ] = CreateCheckBoxButton( iScreenWidthOffset + 4, 2 * iScreenHeightOffset + 362, "EDITOR//SmCheckbox.sti", MSYS_PRIORITY_NORMAL, MercsTogglePlayers ); if( gfShowPlayers ) ClickEditorButton( MERCS_PLAYERTOGGLE ); SetButtonFastHelpText( iEditorButton[ MERCS_PLAYERTOGGLE ], L"Toggle viewing of players"); DisableButton( iEditorButton[ MERCS_PLAYERTOGGLE ] ); - iEditorButton[ MERCS_ENEMYTOGGLE ] = + iEditorButton[ MERCS_ENEMYTOGGLE ] = CreateCheckBoxButton( iScreenWidthOffset + 4, 2 * iScreenHeightOffset + 382, "EDITOR//SmCheckbox.sti", MSYS_PRIORITY_NORMAL, MercsToggleEnemies ); if( gfShowEnemies ) ClickEditorButton( MERCS_ENEMYTOGGLE ); SetButtonFastHelpText( iEditorButton[ MERCS_ENEMYTOGGLE ], L"Toggle viewing of enemies"); - iEditorButton[ MERCS_CREATURETOGGLE ] = + iEditorButton[ MERCS_CREATURETOGGLE ] = CreateCheckBoxButton( iScreenWidthOffset + 4, 2 * iScreenHeightOffset + 402, "EDITOR//SmCheckbox.sti", MSYS_PRIORITY_NORMAL, MercsToggleCreatures ); if( gfShowCreatures ) ClickEditorButton( MERCS_CREATURETOGGLE ); SetButtonFastHelpText( iEditorButton[ MERCS_CREATURETOGGLE ], L"Toggle viewing of creatures"); - iEditorButton[ MERCS_REBELTOGGLE ] = + iEditorButton[ MERCS_REBELTOGGLE ] = CreateCheckBoxButton( iScreenWidthOffset + 4, 2 * iScreenHeightOffset + 422, "EDITOR//SmCheckbox.sti", MSYS_PRIORITY_NORMAL, MercsToggleRebels ); if( gfShowRebels ) ClickEditorButton( MERCS_REBELTOGGLE ); SetButtonFastHelpText( iEditorButton[ MERCS_REBELTOGGLE ], L"Toggle viewing of rebels"); - iEditorButton[ MERCS_CIVILIANTOGGLE ] = + iEditorButton[ MERCS_CIVILIANTOGGLE ] = CreateCheckBoxButton( iScreenWidthOffset + 4, 2 * iScreenHeightOffset + 442, "EDITOR//SmCheckbox.sti", MSYS_PRIORITY_NORMAL, MercsToggleCivilians ); if( gfShowCivilians ) ClickEditorButton( MERCS_CIVILIANTOGGLE ); SetButtonFastHelpText( iEditorButton[ MERCS_CIVILIANTOGGLE ], L"Toggle viewing of civilians"); - iEditorButton[MERCS_PLAYER] = + iEditorButton[MERCS_PLAYER] = CreateTextButton( L"Player",(UINT16)BLOCKFONT, 165, FONT_BLACK, BUTTON_USE_DEFAULT, iScreenWidthOffset + 20, 2 * iScreenHeightOffset + 362, 78, 19, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsPlayerTeamCallback ); SpecifyButtonDownTextColors( iEditorButton[MERCS_PLAYER], FONT_YELLOW, FONT_BLACK ); DisableButton( iEditorButton[MERCS_PLAYER] ); - iEditorButton[MERCS_ENEMY] = + iEditorButton[MERCS_ENEMY] = CreateTextButton( L"Enemy",(UINT16)BLOCKFONT, 165, FONT_BLACK, BUTTON_USE_DEFAULT, iScreenWidthOffset + 20, 2 * iScreenHeightOffset + 382, 78, 19, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsEnemyTeamCallback ); SpecifyButtonDownTextColors( iEditorButton[MERCS_ENEMY], FONT_YELLOW, FONT_BLACK ); - iEditorButton[MERCS_CREATURE] = + iEditorButton[MERCS_CREATURE] = CreateTextButton( L"Creature",(UINT16)BLOCKFONT, 165, FONT_BLACK, BUTTON_USE_DEFAULT, iScreenWidthOffset + 20, 2 * iScreenHeightOffset + 402, 78, 19, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsCreatureTeamCallback ); SpecifyButtonDownTextColors( iEditorButton[MERCS_CREATURE], FONT_YELLOW, FONT_BLACK ); - iEditorButton[MERCS_REBEL] = + iEditorButton[MERCS_REBEL] = CreateTextButton( L"Rebels",(UINT16)BLOCKFONT, 165, FONT_BLACK, BUTTON_USE_DEFAULT, iScreenWidthOffset + 20, 2 * iScreenHeightOffset + 422, 78, 19, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsRebelTeamCallback ); SpecifyButtonDownTextColors( iEditorButton[MERCS_REBEL], FONT_YELLOW, FONT_BLACK ); - iEditorButton[MERCS_CIVILIAN] = + iEditorButton[MERCS_CIVILIAN] = CreateTextButton( L"Civilian",(UINT16)BLOCKFONT, 165, FONT_BLACK, BUTTON_USE_DEFAULT, iScreenWidthOffset + 20, 2 * iScreenHeightOffset + 442, 78, 19, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsCivilianTeamCallback ); SpecifyButtonDownTextColors( iEditorButton[MERCS_CIVILIAN], FONT_YELLOW, FONT_BLACK ); iEditorButton[ MERCS_1 ] = - CreateTextButton( L"DETAILED PLACEMENT", SMALLCOMPFONT, FONT_ORANGE, 60, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 362, 68, 20, BUTTON_TOGGLE, + CreateTextButton( L"DETAILED PLACEMENT", SMALLCOMPFONT, FONT_ORANGE, 60, BUTTON_USE_DEFAULT, + iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 362, 68, 20, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, BUTTON_NO_CALLBACK, BUTTON_NO_CALLBACK ); DisableButton( iEditorButton[ MERCS_1 ] ); SpecifyDisabledButtonStyle( iEditorButton[ MERCS_1 ], DISABLED_STYLE_NONE ); SpecifyButtonTextOffsets( iEditorButton[ MERCS_1 ], 20, 4, FALSE ); SpecifyButtonTextWrappedWidth( iEditorButton[ MERCS_1 ], 46 ); - iEditorButton[ MERCS_DETAILEDCHECKBOX ] = + iEditorButton[ MERCS_DETAILEDCHECKBOX ] = CreateCheckBoxButton( iScreenWidthOffset + 103, 2 * iScreenHeightOffset + 365, "EDITOR//checkbox.sti", MSYS_PRIORITY_NORMAL, MercsDetailedPlacementCallback ); - iEditorButton[ MERCS_GENERAL ] = + iEditorButton[ MERCS_GENERAL ] = CreateEasyToggleButton( iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 382, "EDITOR//MercGeneral.sti", MercsGeneralModeCallback ); SetButtonFastHelpText( iEditorButton[ MERCS_GENERAL ], L"General information mode"); - iEditorButton[ MERCS_APPEARANCE ] = + iEditorButton[ MERCS_APPEARANCE ] = CreateEasyToggleButton( iScreenWidthOffset + 134, 2 * iScreenHeightOffset + 382, "EDITOR//MercAppearance.sti", MercsAppearanceModeCallback ); SetButtonFastHelpText( iEditorButton[ MERCS_APPEARANCE ], L"Physical appearance mode"); - iEditorButton[ MERCS_ATTRIBUTES ] = + iEditorButton[ MERCS_ATTRIBUTES ] = CreateEasyToggleButton( iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 408, "EDITOR//MercAttributes.sti", MercsAttributesModeCallback ); SetButtonFastHelpText( iEditorButton[ MERCS_ATTRIBUTES ], L"Attributes mode"); - iEditorButton[ MERCS_INVENTORY ] = + iEditorButton[ MERCS_INVENTORY ] = CreateEasyToggleButton( iScreenWidthOffset + 134, 2 * iScreenHeightOffset + 408, "EDITOR//MercInventory.sti", MercsInventoryModeCallback ); SetButtonFastHelpText( iEditorButton[ MERCS_INVENTORY ], L"Inventory mode"); - iEditorButton[ MERCS_PROFILE ] = + iEditorButton[ MERCS_PROFILE ] = CreateEasyToggleButton( iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 434, "EDITOR//MercProfile.sti", MercsProfileModeCallback ); SetButtonFastHelpText( iEditorButton[ MERCS_PROFILE ], L"Profile ID mode"); - iEditorButton[ MERCS_SCHEDULE ] = + iEditorButton[ MERCS_SCHEDULE ] = CreateEasyToggleButton( iScreenWidthOffset + 134, 2 * iScreenHeightOffset + 434, "EDITOR//MercSchedule.sti", MercsScheduleModeCallback ); SetButtonFastHelpText( iEditorButton[ MERCS_SCHEDULE ], L"Schedule mode"); //Workaround for identical buttons. MSYS_SetBtnUserData( iEditorButton[ MERCS_SCHEDULE ], 3, 0xffffffff ); - iEditorButton[ MERCS_GLOWSCHEDULE ] = + iEditorButton[ MERCS_GLOWSCHEDULE ] = CreateEasyToggleButton( iScreenWidthOffset + 134, 2 * iScreenHeightOffset + 434, "EDITOR//MercGlowSchedule.sti", MercsScheduleModeCallback ); SetButtonFastHelpText( iEditorButton[ MERCS_GLOWSCHEDULE ], L"Schedule mode"); HideEditorButton( MERCS_GLOWSCHEDULE ); iEditorButton[ MERCS_DELETE ] = - CreateTextButton( L"DELETE", (UINT16)SMALLCOMPFONT, FONT_DKBLUE, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 600, 2 * iScreenHeightOffset + 362, 40, 20, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + CreateTextButton( L"DELETE", (UINT16)SMALLCOMPFONT, FONT_DKBLUE, FONT_BLACK, BUTTON_USE_DEFAULT, + iScreenWidthOffset + 600, 2 * iScreenHeightOffset + 362, 40, 20, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsDeleteCallback ); SetButtonFastHelpText( iEditorButton[ MERCS_DELETE ], L"Delete currently selected merc (DEL)."); iEditorButton[ MERCS_NEXT ] = - CreateTextButton( L"NEXT", (UINT16)SMALLCOMPFONT, FONT_DKBLUE, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 600, 2 * iScreenHeightOffset + 382, 40, 20, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + CreateTextButton( L"NEXT", (UINT16)SMALLCOMPFONT, FONT_DKBLUE, FONT_BLACK, BUTTON_USE_DEFAULT, + iScreenWidthOffset + 600, 2 * iScreenHeightOffset + 382, 40, 20, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsNextCallback ); SetButtonFastHelpText( iEditorButton[ MERCS_NEXT ], L"Find next merc (SPACE)."); //Priority Existance - iEditorButton[ MERCS_PRIORITYEXISTANCE_CHECKBOX ] = + iEditorButton[ MERCS_PRIORITYEXISTANCE_CHECKBOX ] = CreateCheckBoxButton( iScreenWidthOffset + 170, 2 * iScreenHeightOffset + 365, "EDITOR//checkbox.sti", MSYS_PRIORITY_NORMAL, MercsPriorityExistanceCallback ); SetButtonFastHelpText( iEditorButton[ MERCS_PRIORITYEXISTANCE_CHECKBOX ], L"Toggle priority existance" ); - + //If merc has keys - iEditorButton[ MERCS_HASKEYS_CHECKBOX ] = + iEditorButton[ MERCS_HASKEYS_CHECKBOX ] = CreateCheckBoxButton( iScreenWidthOffset + 170, 2 * iScreenHeightOffset + 390, "EDITOR//checkbox.sti", MSYS_PRIORITY_NORMAL, MercsHasKeysCallback ); SetButtonFastHelpText( iEditorButton[ MERCS_HASKEYS_CHECKBOX ], L"Toggle whether or not placement has/naccess to all doors." ); //Orders iEditorButton[ MERCS_ORDERS_STATIONARY ] = - CreateTextButton( L"STATIONARY", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 368, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + CreateTextButton( L"STATIONARY", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, + iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 368, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetOrdersCallback ); - iEditorButton[ MERCS_ORDERS_ONGUARD] = - CreateTextButton( L"ON GUARD", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 380, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + iEditorButton[ MERCS_ORDERS_ONGUARD] = + CreateTextButton( L"ON GUARD", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, + iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 380, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetOrdersCallback ); - iEditorButton[ MERCS_ORDERS_ONCALL ] = - CreateTextButton( L"ON CALL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 392, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + iEditorButton[ MERCS_ORDERS_ONCALL ] = + CreateTextButton( L"ON CALL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, + iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 392, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetOrdersCallback ); - iEditorButton[ MERCS_ORDERS_SEEKENEMY ] = - CreateTextButton( L"SEEK ENEMY", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 404, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + iEditorButton[ MERCS_ORDERS_SEEKENEMY ] = + CreateTextButton( L"SEEK ENEMY", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, + iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 404, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetOrdersCallback ); - iEditorButton[ MERCS_ORDERS_CLOSEPATROL ] = - CreateTextButton( L"CLOSE PATROL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 368, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + iEditorButton[ MERCS_ORDERS_CLOSEPATROL ] = + CreateTextButton( L"CLOSE PATROL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, + iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 368, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetOrdersCallback ); - iEditorButton[ MERCS_ORDERS_FARPATROL ] = - CreateTextButton( L"FAR PATROL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 380, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + iEditorButton[ MERCS_ORDERS_FARPATROL ] = + CreateTextButton( L"FAR PATROL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, + iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 380, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetOrdersCallback ); - iEditorButton[ MERCS_ORDERS_POINTPATROL ] = - CreateTextButton( L"POINT PATROL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 392, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + iEditorButton[ MERCS_ORDERS_POINTPATROL ] = + CreateTextButton( L"POINT PATROL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, + iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 392, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetOrdersCallback ); - iEditorButton[ MERCS_ORDERS_RNDPTPATROL ] = - CreateTextButton( L"RND PT PATROL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 404, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + iEditorButton[ MERCS_ORDERS_RNDPTPATROL ] = + CreateTextButton( L"RND PT PATROL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, + iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 404, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetOrdersCallback ); for ( x = 0; x < 8; x++ ) - { + { MSYS_SetBtnUserData( iEditorButton[ FIRST_MERCS_ORDERS_BUTTON + x ], 0, x); } //Attitudes - iEditorButton[ MERCS_ATTITUDE_DEFENSIVE ] = - CreateTextButton( L"DEFENSIVE", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 424, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + iEditorButton[ MERCS_ATTITUDE_DEFENSIVE ] = + CreateTextButton( L"DEFENSIVE", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT, + iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 424, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetAttitudeCallback ); - iEditorButton[ MERCS_ATTITUDE_BRAVESOLO ] = - CreateTextButton( L"BRAVE SOLO", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 436, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + iEditorButton[ MERCS_ATTITUDE_BRAVESOLO ] = + CreateTextButton( L"BRAVE SOLO", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT, + iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 436, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetAttitudeCallback ); - iEditorButton[ MERCS_ATTITUDE_BRAVEAID ] = - CreateTextButton( L"BRAVE AID", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 448, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + iEditorButton[ MERCS_ATTITUDE_BRAVEAID ] = + CreateTextButton( L"BRAVE AID", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT, + iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 448, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetAttitudeCallback ); - iEditorButton[ MERCS_ATTITUDE_AGGRESSIVE ] = - CreateTextButton( L"AGGRESSIVE", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 424, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + iEditorButton[ MERCS_ATTITUDE_AGGRESSIVE ] = + CreateTextButton( L"AGGRESSIVE", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT, + iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 424, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetAttitudeCallback ); - iEditorButton[ MERCS_ATTITUDE_CUNNINGSOLO ] = - CreateTextButton( L"CUNNING SOLO", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 436, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + iEditorButton[ MERCS_ATTITUDE_CUNNINGSOLO ] = + CreateTextButton( L"CUNNING SOLO", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT, + iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 436, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetAttitudeCallback ); - iEditorButton[ MERCS_ATTITUDE_CUNNINGAID ] = - CreateTextButton( L"CUNNING AID", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 448, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + iEditorButton[ MERCS_ATTITUDE_CUNNINGAID ] = + CreateTextButton( L"CUNNING AID", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT, + iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 448, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetAttitudeCallback ); for ( x = 0; x < 6; x++ ) - { + { MSYS_SetBtnUserData( iEditorButton[ FIRST_MERCS_ATTITUDE_BUTTON + x ], 0, x); } - iEditorButton[ MERCS_DIRECTION_W ] = - CreateIconButton((INT16)giEditMercDirectionIcons[0], 7, BUTTON_USE_DEFAULT, + iEditorButton[ MERCS_DIRECTION_W ] = + CreateIconButton((INT16)giEditMercDirectionIcons[0], 7, BUTTON_USE_DEFAULT, iScreenWidthOffset + 360, 2 * iScreenHeightOffset + 365, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback ); - iEditorButton[ MERCS_DIRECTION_NW ] = - CreateIconButton((INT16)giEditMercDirectionIcons[0], 0, BUTTON_USE_DEFAULT, + iEditorButton[ MERCS_DIRECTION_NW ] = + CreateIconButton((INT16)giEditMercDirectionIcons[0], 0, BUTTON_USE_DEFAULT, iScreenWidthOffset + 390, 2 * iScreenHeightOffset + 365, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback ); - iEditorButton[ MERCS_DIRECTION_N ] = - CreateIconButton((INT16)giEditMercDirectionIcons[0], 1, BUTTON_USE_DEFAULT, + iEditorButton[ MERCS_DIRECTION_N ] = + CreateIconButton((INT16)giEditMercDirectionIcons[0], 1, BUTTON_USE_DEFAULT, iScreenWidthOffset + 420, 2 * iScreenHeightOffset + 365, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback ); - iEditorButton[ MERCS_DIRECTION_NE] = - CreateIconButton((INT16)giEditMercDirectionIcons[0], 2, BUTTON_USE_DEFAULT, + iEditorButton[ MERCS_DIRECTION_NE] = + CreateIconButton((INT16)giEditMercDirectionIcons[0], 2, BUTTON_USE_DEFAULT, iScreenWidthOffset + 420, 2 * iScreenHeightOffset + 395, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback ); - iEditorButton[ MERCS_DIRECTION_E ] = - CreateIconButton((INT16)giEditMercDirectionIcons[0], 3, BUTTON_USE_DEFAULT, + iEditorButton[ MERCS_DIRECTION_E ] = + CreateIconButton((INT16)giEditMercDirectionIcons[0], 3, BUTTON_USE_DEFAULT, iScreenWidthOffset + 420, 2 * iScreenHeightOffset + 425, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback ); - iEditorButton[ MERCS_DIRECTION_SE ] = - CreateIconButton((INT16)giEditMercDirectionIcons[0], 4, BUTTON_USE_DEFAULT, + iEditorButton[ MERCS_DIRECTION_SE ] = + CreateIconButton((INT16)giEditMercDirectionIcons[0], 4, BUTTON_USE_DEFAULT, iScreenWidthOffset + 390, 2 * iScreenHeightOffset + 425, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback ); - iEditorButton[ MERCS_DIRECTION_S ] = - CreateIconButton((INT16)giEditMercDirectionIcons[0], 5, BUTTON_USE_DEFAULT, + iEditorButton[ MERCS_DIRECTION_S ] = + CreateIconButton((INT16)giEditMercDirectionIcons[0], 5, BUTTON_USE_DEFAULT, iScreenWidthOffset + 360, 2 * iScreenHeightOffset + 425, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback ); - iEditorButton[ MERCS_DIRECTION_SW ] = - CreateIconButton((INT16)giEditMercDirectionIcons[0], 6, BUTTON_USE_DEFAULT, + iEditorButton[ MERCS_DIRECTION_SW ] = + CreateIconButton((INT16)giEditMercDirectionIcons[0], 6, BUTTON_USE_DEFAULT, iScreenWidthOffset + 360, 2 * iScreenHeightOffset + 395, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback ); for ( x = 0; x < 8; x++ ) - { + { swprintf( TempString, L"Set merc to face %s", FaceDirs[x] ); SetButtonFastHelpText( iEditorButton[ FIRST_MERCS_DIRECTION_BUTTON + x ], TempString ); MSYS_SetBtnUserData( iEditorButton[ FIRST_MERCS_DIRECTION_BUTTON + x ], 0, x); } - iEditorButton[ MERCS_DIRECTION_FIND ] = - CreateTextButton( L"Find", (INT16)FONT12POINT1, FONT_MCOLOR_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, + iEditorButton[ MERCS_DIRECTION_FIND ] = + CreateTextButton( L"Find", (INT16)FONT12POINT1, FONT_MCOLOR_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, iScreenWidthOffset + 390, 2 * iScreenHeightOffset + 395, 30, 30, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsFindSelectedMercCallback ); SetButtonFastHelpText( iEditorButton[ MERCS_DIRECTION_FIND] , L"Find selected merc" ); @@ -287,7 +287,7 @@ void InitEditorMercsToolbar() iScreenWidthOffset + 480, 2 * iScreenHeightOffset + 445, 40, 15, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetRelativeEquipmentCallback ); SpecifyButtonDownTextColors( iEditorButton[ MERCS_EQUIPMENT_GREAT ], FONT_LTBLUE, FONT_BLACK ); for ( x = 0; x < 5; x++ ) - { + { MSYS_SetBtnUserData( iEditorButton[ FIRST_MERCS_REL_EQUIPMENT_BUTTON + x ], 0, x); } @@ -314,37 +314,37 @@ void InitEditorMercsToolbar() for( x = 0; x < 5; x++ ) MSYS_SetBtnUserData( iEditorButton[ FIRST_MERCS_REL_ATTRIBUTE_BUTTON + x ], 0, x); - iEditorButton[ MERCS_ARMY_CODE ] = + iEditorButton[ MERCS_ARMY_CODE ] = CreateCheckBoxButton( iScreenWidthOffset + 575, 2 * iScreenHeightOffset + 410, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MercsSetEnemyColorCodeCallback ); MSYS_SetBtnUserData( iEditorButton[ MERCS_ARMY_CODE ], 0, SOLDIER_CLASS_ARMY ); - iEditorButton[ MERCS_ADMIN_CODE ] = + iEditorButton[ MERCS_ADMIN_CODE ] = CreateCheckBoxButton( iScreenWidthOffset + 575, 2 * iScreenHeightOffset + 424, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MercsSetEnemyColorCodeCallback ); MSYS_SetBtnUserData( iEditorButton[ MERCS_ADMIN_CODE ], 0, SOLDIER_CLASS_ADMINISTRATOR ); - iEditorButton[ MERCS_ELITE_CODE ] = + iEditorButton[ MERCS_ELITE_CODE ] = CreateCheckBoxButton( iScreenWidthOffset + 575, 2 * iScreenHeightOffset + 438, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MercsSetEnemyColorCodeCallback ); MSYS_SetBtnUserData( iEditorButton[ MERCS_ELITE_CODE ], 0, SOLDIER_CLASS_ELITE ); - iEditorButton[ MERCS_CIVILIAN_GROUP ] = + iEditorButton[ MERCS_CIVILIAN_GROUP ] = CreateTextButton( gszCivGroupNames[0], (INT16)SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, iScreenWidthOffset + 574, 2 * iScreenHeightOffset + 410, 60, 25, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsCivilianGroupCallback ); - iEditorButton[ MERCS_TOGGLECOLOR_BUTTON ] = + iEditorButton[ MERCS_TOGGLECOLOR_BUTTON ] = CreateCheckBoxButton( iScreenWidthOffset + 180, 2 * iScreenHeightOffset +364, "EDITOR//checkbox.sti", MSYS_PRIORITY_NORMAL, MercsToggleColorModeCallback ); - iEditorButton[MERCS_HAIRCOLOR_DOWN] = + iEditorButton[MERCS_HAIRCOLOR_DOWN] = CreateEasyNoToggleButton( iScreenWidthOffset + 200,2 * iScreenHeightOffset +364,"EDITOR//leftarrow.sti", MercsSetColorsCallback ); - iEditorButton[MERCS_HAIRCOLOR_UP] = + iEditorButton[MERCS_HAIRCOLOR_UP] = CreateEasyNoToggleButton( iScreenWidthOffset + 360,2 * iScreenHeightOffset +364,"EDITOR//rightarrow.sti", MercsSetColorsCallback ); - iEditorButton[MERCS_SKINCOLOR_DOWN] = + iEditorButton[MERCS_SKINCOLOR_DOWN] = CreateEasyNoToggleButton( iScreenWidthOffset + 200,2 * iScreenHeightOffset +388,"EDITOR//leftarrow.sti", MercsSetColorsCallback ); - iEditorButton[MERCS_SKINCOLOR_UP] = + iEditorButton[MERCS_SKINCOLOR_UP] = CreateEasyNoToggleButton( iScreenWidthOffset + 360,2 * iScreenHeightOffset +388,"EDITOR//rightarrow.sti", MercsSetColorsCallback ); - iEditorButton[MERCS_VESTCOLOR_DOWN] = + iEditorButton[MERCS_VESTCOLOR_DOWN] = CreateEasyNoToggleButton( iScreenWidthOffset + 200,2 * iScreenHeightOffset +412,"EDITOR//leftarrow.sti", MercsSetColorsCallback ); - iEditorButton[MERCS_VESTCOLOR_UP] = + iEditorButton[MERCS_VESTCOLOR_UP] = CreateEasyNoToggleButton( iScreenWidthOffset + 360,2 * iScreenHeightOffset +412,"EDITOR//rightarrow.sti", MercsSetColorsCallback ); - iEditorButton[MERCS_PANTCOLOR_DOWN] = + iEditorButton[MERCS_PANTCOLOR_DOWN] = CreateEasyNoToggleButton( iScreenWidthOffset + 200,2 * iScreenHeightOffset +436,"EDITOR//leftarrow.sti", MercsSetColorsCallback ); - iEditorButton[MERCS_PANTCOLOR_UP] = + iEditorButton[MERCS_PANTCOLOR_UP] = CreateEasyNoToggleButton( iScreenWidthOffset + 360,2 * iScreenHeightOffset +436,"EDITOR//rightarrow.sti", MercsSetColorsCallback ); for ( x = FIRST_MERCS_COLOR_BUTTON; x < LAST_MERCS_COLOR_BUTTON; x+=2 ) { @@ -354,26 +354,26 @@ void InitEditorMercsToolbar() DisableButton( iEditorButton[ x + 1 ] ); } - iEditorButton[MERCS_BODYTYPE_DOWN] = + iEditorButton[MERCS_BODYTYPE_DOWN] = CreateEasyNoToggleButton( iScreenWidthOffset + 460, 2 * iScreenHeightOffset +364,"EDITOR//leftarrow.sti", MercsSetBodyTypeCallback ); SetButtonFastHelpText( iEditorButton[ MERCS_BODYTYPE_DOWN ], L"Previous body type"); - iEditorButton[MERCS_BODYTYPE_UP] = + iEditorButton[MERCS_BODYTYPE_UP] = CreateEasyNoToggleButton( iScreenWidthOffset + 560, 2 * iScreenHeightOffset +364,"EDITOR//rightarrow.sti", MercsSetBodyTypeCallback ); SetButtonFastHelpText( iEditorButton[ MERCS_BODYTYPE_UP ], L"Next body type"); - iEditorButton[ MERCS_SCHEDULE_VARIANCE1 ] = + iEditorButton[ MERCS_SCHEDULE_VARIANCE1 ] = CreateCheckBoxButton( iScreenWidthOffset + 309, 2 * iScreenHeightOffset +375, "EDITOR//SmCheckBox.sti", MSYS_PRIORITY_NORMAL, MercsScheduleToggleVariance1Callback ); SetButtonFastHelpText( iEditorButton[ MERCS_SCHEDULE_VARIANCE1 ], L"Toggle time variance (+ or - 15 minutes)"); - iEditorButton[ MERCS_SCHEDULE_VARIANCE2 ] = + iEditorButton[ MERCS_SCHEDULE_VARIANCE2 ] = CreateCheckBoxButton( iScreenWidthOffset + 309, 2 * iScreenHeightOffset +396, "EDITOR//SmCheckBox.sti", MSYS_PRIORITY_NORMAL, MercsScheduleToggleVariance2Callback ); SetButtonFastHelpText( iEditorButton[ MERCS_SCHEDULE_VARIANCE2 ], L"Toggle time variance (+ or - 15 minutes)"); - iEditorButton[ MERCS_SCHEDULE_VARIANCE3 ] = + iEditorButton[ MERCS_SCHEDULE_VARIANCE3 ] = CreateCheckBoxButton( iScreenWidthOffset + 309, 2 * iScreenHeightOffset +417, "EDITOR//SmCheckBox.sti", MSYS_PRIORITY_NORMAL, MercsScheduleToggleVariance3Callback ); SetButtonFastHelpText( iEditorButton[ MERCS_SCHEDULE_VARIANCE3 ], L"Toggle time variance (+ or - 15 minutes)"); - iEditorButton[ MERCS_SCHEDULE_VARIANCE4 ] = + iEditorButton[ MERCS_SCHEDULE_VARIANCE4 ] = CreateCheckBoxButton( iScreenWidthOffset + 309, 2 * iScreenHeightOffset +438, "EDITOR//SmCheckBox.sti", MSYS_PRIORITY_NORMAL, MercsScheduleToggleVariance4Callback ); SetButtonFastHelpText( iEditorButton[ MERCS_SCHEDULE_VARIANCE4 ], L"Toggle time variance (+ or - 15 minutes)"); - + iEditorButton[ MERCS_SCHEDULE_ACTION1 ] = CreateTextButton( L"No action", FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, iScreenWidthOffset + 186, 2 * iScreenHeightOffset + 373, 77, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsScheduleAction1Callback ); @@ -386,7 +386,7 @@ void InitEditorMercsToolbar() iEditorButton[ MERCS_SCHEDULE_ACTION4 ] = CreateTextButton( L"No action", FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, iScreenWidthOffset + 186, 2 * iScreenHeightOffset + 436, 77, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsScheduleAction4Callback ); - + iEditorButton[ MERCS_SCHEDULE_DATA1A ] = CreateTextButton( L"", FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, iScreenWidthOffset + 331, 2 * iScreenHeightOffset + 373, 40, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsScheduleData1ACallback ); @@ -416,31 +416,31 @@ void InitEditorMercsToolbar() iScreenWidthOffset + 516, 2 * iScreenHeightOffset + 362, 77, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsScheduleClearCallback ); HideEditorButtons( MERCS_SCHEDULE_DATA1A, MERCS_SCHEDULE_DATA4B ); - iEditorButton[ MERCS_HEAD_SLOT ] = + iEditorButton[ MERCS_HEAD_SLOT ] = CreateCheckBoxButton( MERCPANEL_X+61, MERCPANEL_Y+0, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback ); MSYS_SetBtnUserData( iEditorButton[ MERCS_HEAD_SLOT ], 0, HELMETPOS ); - iEditorButton[ MERCS_BODY_SLOT ] = + iEditorButton[ MERCS_BODY_SLOT ] = CreateCheckBoxButton( MERCPANEL_X+61, MERCPANEL_Y+22, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback ); MSYS_SetBtnUserData( iEditorButton[ MERCS_BODY_SLOT ], 0, VESTPOS ); - iEditorButton[ MERCS_LEGS_SLOT ] = + iEditorButton[ MERCS_LEGS_SLOT ] = CreateCheckBoxButton( MERCPANEL_X+62, MERCPANEL_Y+73, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback ); MSYS_SetBtnUserData( iEditorButton[ MERCS_LEGS_SLOT ], 0, LEGPOS ); - iEditorButton[ MERCS_LEFTHAND_SLOT ] = + iEditorButton[ MERCS_LEFTHAND_SLOT ] = CreateCheckBoxButton( MERCPANEL_X+12, MERCPANEL_Y+43, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback ); MSYS_SetBtnUserData( iEditorButton[ MERCS_LEFTHAND_SLOT ], 0, HANDPOS ); - iEditorButton[ MERCS_RIGHTHAND_SLOT ] = + iEditorButton[ MERCS_RIGHTHAND_SLOT ] = CreateCheckBoxButton( MERCPANEL_X+90, MERCPANEL_Y+42, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback ); MSYS_SetBtnUserData( iEditorButton[ MERCS_RIGHTHAND_SLOT ], 0, SECONDHANDPOS ); - iEditorButton[ MERCS_PACK1_SLOT ] = + iEditorButton[ MERCS_PACK1_SLOT ] = CreateCheckBoxButton( MERCPANEL_X+166, MERCPANEL_Y+6, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback ); MSYS_SetBtnUserData( iEditorButton[ MERCS_PACK1_SLOT ], 0, BIGPOCK1POS ); - iEditorButton[ MERCS_PACK2_SLOT ] = + iEditorButton[ MERCS_PACK2_SLOT ] = CreateCheckBoxButton( MERCPANEL_X+166, MERCPANEL_Y+29, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback ); MSYS_SetBtnUserData( iEditorButton[ MERCS_PACK2_SLOT ], 0, BIGPOCK2POS ); - iEditorButton[ MERCS_PACK3_SLOT ] = + iEditorButton[ MERCS_PACK3_SLOT ] = CreateCheckBoxButton( MERCPANEL_X+166, MERCPANEL_Y+52, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback ); MSYS_SetBtnUserData( iEditorButton[ MERCS_PACK3_SLOT ], 0, BIGPOCK3POS ); - iEditorButton[ MERCS_PACK4_SLOT ] = + iEditorButton[ MERCS_PACK4_SLOT ] = CreateCheckBoxButton( MERCPANEL_X+166, MERCPANEL_Y+75, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback ); MSYS_SetBtnUserData( iEditorButton[ MERCS_PACK4_SLOT ], 0, BIGPOCK4POS ); } @@ -449,103 +449,103 @@ void InitEditorBuildingsToolbar() { iEditorButton[BUILDING_TOGGLE_ROOF_VIEW] = CreateTextButton(L"ROOFS",(UINT16)SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 110, 2 * iScreenHeightOffset + 400, 50, 15, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,BUTTON_NO_CALLBACK, + iScreenWidthOffset + 110, 2 * iScreenHeightOffset + 400, 50, 15, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,BUTTON_NO_CALLBACK, BuildingToggleRoofViewCallback); - iEditorButton[BUILDING_TOGGLE_WALL_VIEW] = + iEditorButton[BUILDING_TOGGLE_WALL_VIEW] = CreateTextButton(L"WALLS",(UINT16)SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 110, 2 * iScreenHeightOffset + 415, 50, 15, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,BUTTON_NO_CALLBACK, + iScreenWidthOffset + 110, 2 * iScreenHeightOffset + 415, 50, 15, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,BUTTON_NO_CALLBACK, BuildingToggleWallViewCallback); iEditorButton[BUILDING_TOGGLE_INFO_VIEW] = CreateTextButton(L"ROOM INFO",(UINT16)SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 110, 2 * iScreenHeightOffset + 430, 50, 15, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,BUTTON_NO_CALLBACK, + iScreenWidthOffset + 110, 2 * iScreenHeightOffset + 430, 50, 15, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,BUTTON_NO_CALLBACK, BuildingToggleInfoViewCallback); //Selection method buttons - iEditorButton[BUILDING_PLACE_WALLS] = + iEditorButton[BUILDING_PLACE_WALLS] = CreateEasyToggleButton( iScreenWidthOffset + 180,2 * iScreenHeightOffset + 370,"EDITOR//wall.sti", BuildingWallCallback); //SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_WALLS],L"Place walls using selection method"); SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_WALLS], L"Place walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\n"); - - - iEditorButton[BUILDING_PLACE_DOORS] = + + + iEditorButton[BUILDING_PLACE_DOORS] = CreateEasyToggleButton( iScreenWidthOffset + 210,2 * iScreenHeightOffset + 370,"EDITOR//door.sti", BuildingDoorCallback); SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_DOORS],L"Place doors using selection method"); - iEditorButton[BUILDING_PLACE_ROOFS] = + iEditorButton[BUILDING_PLACE_ROOFS] = CreateEasyToggleButton( iScreenWidthOffset + 240,2 * iScreenHeightOffset + 370,"EDITOR//roof.sti", BuildingRoofCallback); SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_ROOFS],L"Place roofs using selection method"); - iEditorButton[BUILDING_PLACE_WINDOWS] = + iEditorButton[BUILDING_PLACE_WINDOWS] = CreateEasyToggleButton( iScreenWidthOffset + 180,2 * iScreenHeightOffset + 400,"EDITOR//window.sti", BuildingWindowCallback); SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_WINDOWS],L"Place windows using selection method"); - iEditorButton[BUILDING_PLACE_BROKEN_WALLS] = + iEditorButton[BUILDING_PLACE_BROKEN_WALLS] = CreateEasyToggleButton( iScreenWidthOffset + 210, 2 * iScreenHeightOffset + 400,"EDITOR//crackwall.sti", BuildingCrackWallCallback); SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_BROKEN_WALLS],L"Place damaged walls using selection method."); - iEditorButton[BUILDING_PLACE_FURNITURE] = + iEditorButton[BUILDING_PLACE_FURNITURE] = CreateEasyToggleButton( iScreenWidthOffset + 240, 2 * iScreenHeightOffset + 400,"EDITOR//decor.sti", BuildingFurnitureCallback); SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_FURNITURE],L"Place furniture using selection method"); - iEditorButton[BUILDING_PLACE_DECALS] = + iEditorButton[BUILDING_PLACE_DECALS] = CreateEasyToggleButton( iScreenWidthOffset + 180, 2 * iScreenHeightOffset + 430,"EDITOR//decal.sti", BuildingDecalCallback); SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_DECALS],L"Place wall decals using selection method"); - iEditorButton[BUILDING_PLACE_FLOORS] = + iEditorButton[BUILDING_PLACE_FLOORS] = CreateEasyToggleButton( iScreenWidthOffset + 210, 2 * iScreenHeightOffset + 430,"EDITOR//floor.sti", BuildingFloorCallback); SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_FLOORS],L"Place floors using selection method"); - iEditorButton[BUILDING_PLACE_TOILETS] = + iEditorButton[BUILDING_PLACE_TOILETS] = CreateEasyToggleButton( iScreenWidthOffset + 240, 2 * iScreenHeightOffset + 430,"EDITOR//toilet.sti", BuildingToiletCallback); SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_TOILETS],L"Place generic furniture using selection method"); //Smart method buttons - iEditorButton[BUILDING_SMART_WALLS] = + iEditorButton[BUILDING_SMART_WALLS] = CreateEasyToggleButton( iScreenWidthOffset + 290, 2 * iScreenHeightOffset + 370,"EDITOR//wall.sti", BuildingSmartWallCallback); SetButtonFastHelpText(iEditorButton[BUILDING_SMART_WALLS],L"Place walls using smart method"); - iEditorButton[BUILDING_SMART_DOORS] = + iEditorButton[BUILDING_SMART_DOORS] = CreateEasyToggleButton( iScreenWidthOffset + 320, 2 * iScreenHeightOffset + 370,"EDITOR//door.sti", BuildingSmartDoorCallback); SetButtonFastHelpText(iEditorButton[BUILDING_SMART_DOORS],L"Place doors using smart method"); - iEditorButton[BUILDING_SMART_WINDOWS] = + iEditorButton[BUILDING_SMART_WINDOWS] = CreateEasyToggleButton( iScreenWidthOffset + 290, 2 * iScreenHeightOffset + 400,"EDITOR//window.sti", BuildingSmartWindowCallback); SetButtonFastHelpText(iEditorButton[BUILDING_SMART_WINDOWS],L"Place windows using smart method"); - iEditorButton[BUILDING_SMART_BROKEN_WALLS] = + iEditorButton[BUILDING_SMART_BROKEN_WALLS] = CreateEasyToggleButton( iScreenWidthOffset + 320, 2 * iScreenHeightOffset + 400,"EDITOR//crackwall.sti", BuildingSmartCrackWallCallback); SetButtonFastHelpText(iEditorButton[BUILDING_SMART_BROKEN_WALLS],L"Place damaged walls using smart method"); - iEditorButton[BUILDING_DOORKEY] = + iEditorButton[BUILDING_DOORKEY] = CreateEasyToggleButton( iScreenWidthOffset + 290, 2 * iScreenHeightOffset + 430,"EDITOR//key.sti", BuildingDoorKeyCallback); SetButtonFastHelpText(iEditorButton[BUILDING_DOORKEY], L"Lock or trap existing doors" ); - iEditorButton[BUILDING_NEW_ROOM] = + iEditorButton[BUILDING_NEW_ROOM] = CreateEasyToggleButton( iScreenWidthOffset + 370, 2 * iScreenHeightOffset + 370,"EDITOR//newroom.sti", BuildingNewRoomCallback); SetButtonFastHelpText(iEditorButton[BUILDING_NEW_ROOM],L"Add a new room"); - iEditorButton[BUILDING_CAVE_DRAWING] = + iEditorButton[BUILDING_CAVE_DRAWING] = CreateEasyToggleButton( iScreenWidthOffset + 370, 2 * iScreenHeightOffset + 370,"EDITOR//caves.sti", BuildingCaveDrawingCallback); SetButtonFastHelpText(iEditorButton[BUILDING_CAVE_DRAWING],L"Edit cave walls."); - iEditorButton[BUILDING_SAW_ROOM] = + iEditorButton[BUILDING_SAW_ROOM] = CreateEasyToggleButton( iScreenWidthOffset + 370, 2 * iScreenHeightOffset + 400,"EDITOR//sawroom.sti", BuildingSawRoomCallback); SetButtonFastHelpText(iEditorButton[BUILDING_SAW_ROOM],L"Remove an area from existing building."); - iEditorButton[BUILDING_KILL_BUILDING] = + iEditorButton[BUILDING_KILL_BUILDING] = CreateEasyToggleButton( iScreenWidthOffset + 370, 2 * iScreenHeightOffset + 430,"EDITOR//delroom.sti", BuildingKillBuildingCallback); SetButtonFastHelpText(iEditorButton[BUILDING_KILL_BUILDING],L"Remove a building"); - iEditorButton[BUILDING_NEW_ROOF] = + iEditorButton[BUILDING_NEW_ROOF] = CreateEasyToggleButton( iScreenWidthOffset + 400, 2 * iScreenHeightOffset + 430,"EDITOR//newroof.sti", BuildingNewRoofCallback); SetButtonFastHelpText(iEditorButton[BUILDING_NEW_ROOF],L"Add/replace building's roof with new flat roof."); - iEditorButton[BUILDING_COPY_BUILDING] = + iEditorButton[BUILDING_COPY_BUILDING] = CreateEasyToggleButton( iScreenWidthOffset + 430, 2 * iScreenHeightOffset + 430,"EDITOR//copyroom.sti", BuildingCopyBuildingCallback); SetButtonFastHelpText(iEditorButton[BUILDING_COPY_BUILDING],L"Copy a building"); - iEditorButton[BUILDING_MOVE_BUILDING] = + iEditorButton[BUILDING_MOVE_BUILDING] = CreateEasyToggleButton( iScreenWidthOffset + 460, 2 * iScreenHeightOffset + 430,"EDITOR//moveroom.sti", BuildingMoveBuildingCallback); SetButtonFastHelpText(iEditorButton[BUILDING_MOVE_BUILDING],L"Move a building"); - iEditorButton[BUILDING_DRAW_ROOMNUM] = + iEditorButton[BUILDING_DRAW_ROOMNUM] = CreateEasyToggleButton( iScreenWidthOffset + 410, 2 * iScreenHeightOffset + 370,"EDITOR//addTileRoom.sti", BuildingDrawRoomNumCallback); SetButtonFastHelpText(iEditorButton[BUILDING_DRAW_ROOMNUM],L"Draw room number"); iEditorButton[BUILDING_ERASE_ROOMNUM] = CreateEasyToggleButton( iScreenWidthOffset + 440, 2 * iScreenHeightOffset + 370,"EDITOR//killTileRoom.sti", BuildingEraseRoomNumCallback); SetButtonFastHelpText(iEditorButton[BUILDING_ERASE_ROOMNUM],L"Erase room numbers"); - iEditorButton[BUILDING_TOGGLE_ERASEMODE] = + iEditorButton[BUILDING_TOGGLE_ERASEMODE] = CreateEasyToggleButton( iScreenWidthOffset + 500, 2 * iScreenHeightOffset + 400,"EDITOR//eraser.sti", BtnEraseCallback); SetButtonFastHelpText(iEditorButton[BUILDING_TOGGLE_ERASEMODE],L"Toggle erase mode"); - iEditorButton[BUILDING_UNDO] = + iEditorButton[BUILDING_UNDO] = CreateEasyNoToggleButton( iScreenWidthOffset + 530, 2 * iScreenHeightOffset + 400,"EDITOR//undo.sti", BtnUndoCallback); SetButtonFastHelpText(iEditorButton[BUILDING_UNDO],L"Undo last change"); - iEditorButton[BUILDING_CYCLE_BRUSHSIZE] = + iEditorButton[BUILDING_CYCLE_BRUSHSIZE] = CreateEasyNoToggleButton( iScreenWidthOffset + 500, 2 * iScreenHeightOffset + 430,"EDITOR//paint.sti",BtnBrushCallback); SetButtonFastHelpText( iEditorButton[ BUILDING_CYCLE_BRUSHSIZE ], L"Cycle brush size"); } @@ -553,211 +553,215 @@ void InitEditorBuildingsToolbar() void InitEditorItemsToolbar() { SetFontForeground( FONT_MCOLOR_LTRED ); - iEditorButton[ITEMS_WEAPONS] = + iEditorButton[ITEMS_WEAPONS] = CreateTextButton(L"Weapons",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 440, 59, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, + iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 440, 59, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, ItemsWeaponsCallback); - iEditorButton[ITEMS_AMMO] = + iEditorButton[ITEMS_AMMO] = CreateTextButton(L"Ammo",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 159, 2 * iScreenHeightOffset + 440, 40, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, + iScreenWidthOffset + 159, 2 * iScreenHeightOffset + 440, 40, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, ItemsAmmoCallback); - iEditorButton[ITEMS_ARMOUR] = + iEditorButton[ITEMS_ARMOUR] = CreateTextButton(L"Armour",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 199, 2 * iScreenHeightOffset + 440, 52, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, + iScreenWidthOffset + 199, 2 * iScreenHeightOffset + 440, 52, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, ItemsArmourCallback); - iEditorButton[ITEMS_EXPLOSIVES] = - CreateTextButton(L"Explosives",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 251, 2 * iScreenHeightOffset + 440, 69, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, + iEditorButton[ITEMS_LBEGEAR] = + CreateTextButton(L"LBE",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT, + iScreenWidthOffset + 251, 2 * iScreenHeightOffset + 440, 30, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, + ItemsLBECallback); + iEditorButton[ITEMS_EXPLOSIVES] = + CreateTextButton(L"Exp",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT, + iScreenWidthOffset + 281, 2 * iScreenHeightOffset + 440, 39, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, ItemsExplosivesCallback); - iEditorButton[ITEMS_EQUIPMENT1] = + iEditorButton[ITEMS_EQUIPMENT1] = CreateTextButton(L"E1",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 320, 2 * iScreenHeightOffset + 440, 21, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, + iScreenWidthOffset + 320, 2 * iScreenHeightOffset + 440, 21, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, ItemsEquipment1Callback); - iEditorButton[ITEMS_EQUIPMENT2] = + iEditorButton[ITEMS_EQUIPMENT2] = CreateTextButton(L"E2",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 341, 2 * iScreenHeightOffset + 440, 21, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, + iScreenWidthOffset + 341, 2 * iScreenHeightOffset + 440, 21, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, ItemsEquipment2Callback); - iEditorButton[ITEMS_EQUIPMENT3] = + iEditorButton[ITEMS_EQUIPMENT3] = CreateTextButton(L"E3",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 362, 2 * iScreenHeightOffset + 440, 21, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, + iScreenWidthOffset + 362, 2 * iScreenHeightOffset + 440, 21, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, ItemsEquipment3Callback); - iEditorButton[ITEMS_TRIGGERS] = + iEditorButton[ITEMS_TRIGGERS] = CreateTextButton( L"Triggers",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT, iScreenWidthOffset + 383, 2 * iScreenHeightOffset + 440, 59, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, ItemsTriggersCallback ); - iEditorButton[ITEMS_KEYS] = + iEditorButton[ITEMS_KEYS] = CreateTextButton( L"Keys",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT, iScreenWidthOffset + 442, 2 * iScreenHeightOffset + 440, 38, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, ItemsKeysCallback ); - iEditorButton[ITEMS_LEFTSCROLL] = + iEditorButton[ITEMS_LEFTSCROLL] = CreateEasyNoToggleButton( iScreenWidthOffset + 1, 2 * iScreenHeightOffset + 361,"EDITOR//leftscroll.sti", ItemsLeftScrollCallback); - iEditorButton[ITEMS_RIGHTSCROLL] = + iEditorButton[ITEMS_RIGHTSCROLL] = CreateEasyNoToggleButton( iScreenWidthOffset + 50, 2 * iScreenHeightOffset + 361,"EDITOR//rightscroll.sti", ItemsRightScrollCallback); } - + void InitEditorMapInfoToolbar() { - iEditorButton[MAPINFO_ADD_LIGHT1_SOURCE] = + iEditorButton[MAPINFO_ADD_LIGHT1_SOURCE] = CreateEasyToggleButton( iScreenWidthOffset + 10, SCREEN_HEIGHT - 118, "EDITOR//light.sti", BtnDrawLightsCallback ); SetButtonFastHelpText(iEditorButton[MAPINFO_ADD_LIGHT1_SOURCE],L"Add ambient light source"); - iEditorButton[ MAPINFO_LIGHT_PANEL ] = + iEditorButton[ MAPINFO_LIGHT_PANEL ] = CreateTextButton( 0, 0, 0, 0, BUTTON_USE_DEFAULT, iScreenWidthOffset + 45, SCREEN_HEIGHT - 118, 60, 50, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, BUTTON_NO_CALLBACK, BUTTON_NO_CALLBACK ); SpecifyDisabledButtonStyle( iEditorButton[ MAPINFO_LIGHT_PANEL ], DISABLED_STYLE_NONE ); DisableButton( iEditorButton[ MAPINFO_LIGHT_PANEL ] ); - iEditorButton[ MAPINFO_PRIMETIME_LIGHT ] = + iEditorButton[ MAPINFO_PRIMETIME_LIGHT ] = CreateCheckBoxButton( iScreenWidthOffset + 48, SCREEN_HEIGHT - 115, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MapInfoPrimeTimeRadioCallback ); - iEditorButton[ MAPINFO_NIGHTTIME_LIGHT ] = + iEditorButton[ MAPINFO_NIGHTTIME_LIGHT ] = CreateCheckBoxButton( iScreenWidthOffset + 48, SCREEN_HEIGHT - 100, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MapInfoNightTimeRadioCallback ); - iEditorButton[ MAPINFO_24HOUR_LIGHT ] = + iEditorButton[ MAPINFO_24HOUR_LIGHT ] = CreateCheckBoxButton( iScreenWidthOffset + 48, SCREEN_HEIGHT - 85, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MapInfo24HourTimeRadioCallback ); ClickEditorButton( gbDefaultLightType + MAPINFO_PRIMETIME_LIGHT ); - - iEditorButton[MAPINFO_TOGGLE_FAKE_LIGHTS] = + + iEditorButton[MAPINFO_TOGGLE_FAKE_LIGHTS] = CreateEasyToggleButton( iScreenWidthOffset + 120, SCREEN_HEIGHT - 118, "EDITOR//fakelight.sti", BtnFakeLightCallback ); SetButtonFastHelpText(iEditorButton[MAPINFO_TOGGLE_FAKE_LIGHTS], L"Toggle fake ambient lights."); - iEditorButton[ MAPINFO_RADIO_PANEL ] = + iEditorButton[ MAPINFO_RADIO_PANEL ] = CreateTextButton( 0, 0, 0, 0, BUTTON_USE_DEFAULT, iScreenWidthOffset + 207, SCREEN_HEIGHT - 118, 70, 50, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, BUTTON_NO_CALLBACK, BUTTON_NO_CALLBACK ); SpecifyDisabledButtonStyle( iEditorButton[ MAPINFO_RADIO_PANEL ], DISABLED_STYLE_NONE ); DisableButton( iEditorButton[ MAPINFO_RADIO_PANEL ] ); - iEditorButton[ MAPINFO_RADIO_NORMAL ] = + iEditorButton[ MAPINFO_RADIO_NORMAL ] = CreateCheckBoxButton( iScreenWidthOffset + 210, SCREEN_HEIGHT - 115, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MapInfoNormalRadioCallback ); - iEditorButton[ MAPINFO_RADIO_BASEMENT ] = + iEditorButton[ MAPINFO_RADIO_BASEMENT ] = CreateCheckBoxButton( iScreenWidthOffset + 210, SCREEN_HEIGHT - 100, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MapInfoBasementRadioCallback ); - iEditorButton[ MAPINFO_RADIO_CAVES ] = + iEditorButton[ MAPINFO_RADIO_CAVES ] = CreateCheckBoxButton( iScreenWidthOffset + 210, SCREEN_HEIGHT - 85, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MapInfoCavesRadioCallback ); - iEditorButton[MAPINFO_DRAW_EXITGRIDS] = + iEditorButton[MAPINFO_DRAW_EXITGRIDS] = CreateEasyToggleButton( iScreenWidthOffset + 305, SCREEN_HEIGHT - 108, "EDITOR//exitgridbut.sti", MapInfoDrawExitGridCallback ); SetButtonFastHelpText(iEditorButton[MAPINFO_DRAW_EXITGRIDS],L"Add exit grids (r-clk to query existing)."); - iEditorButton[MAPINFO_CYCLE_BRUSHSIZE] = + iEditorButton[MAPINFO_CYCLE_BRUSHSIZE] = CreateEasyNoToggleButton( iScreenWidthOffset + 420, SCREEN_HEIGHT - 50, "EDITOR//paint.sti", BtnBrushCallback ); SetButtonFastHelpText(iEditorButton[MAPINFO_CYCLE_BRUSHSIZE],L"Cycle brush size"); - iEditorButton[MAPINFO_UNDO] = + iEditorButton[MAPINFO_UNDO] = CreateEasyNoToggleButton( iScreenWidthOffset + 510, SCREEN_HEIGHT - 50, "EDITOR//undo.sti", BtnUndoCallback ); SetButtonFastHelpText(iEditorButton[MAPINFO_UNDO],L"Undo last change"); - iEditorButton[MAPINFO_TOGGLE_ERASEMODE] = + iEditorButton[MAPINFO_TOGGLE_ERASEMODE] = CreateEasyToggleButton( iScreenWidthOffset + 540, SCREEN_HEIGHT - 50, "EDITOR//eraser.sti", BtnEraseCallback); SetButtonFastHelpText(iEditorButton[MAPINFO_TOGGLE_ERASEMODE],L"Toggle erase mode"); - iEditorButton[ MAPINFO_NORTH_POINT ] = + iEditorButton[ MAPINFO_NORTH_POINT ] = CreateEasyToggleButton( iScreenWidthOffset + 540, SCREEN_HEIGHT - 115, "EDITOR//north.sti", MapInfoEntryPointsCallback); SetButtonFastHelpText( iEditorButton[ MAPINFO_NORTH_POINT ], L"Specify north point for validation purposes."); - iEditorButton[ MAPINFO_WEST_POINT ] = + iEditorButton[ MAPINFO_WEST_POINT ] = CreateEasyToggleButton( iScreenWidthOffset + 525, SCREEN_HEIGHT - 94, "EDITOR//west.sti", MapInfoEntryPointsCallback); SetButtonFastHelpText( iEditorButton[ MAPINFO_WEST_POINT ], L"Specify west point for validation purposes."); - iEditorButton[ MAPINFO_EAST_POINT ] = + iEditorButton[ MAPINFO_EAST_POINT ] = CreateEasyToggleButton( iScreenWidthOffset + 555, SCREEN_HEIGHT - 94, "EDITOR//east.sti", MapInfoEntryPointsCallback); SetButtonFastHelpText( iEditorButton[ MAPINFO_EAST_POINT ], L"Specify east point for validation purposes."); - iEditorButton[ MAPINFO_SOUTH_POINT ] = + iEditorButton[ MAPINFO_SOUTH_POINT ] = CreateEasyToggleButton( iScreenWidthOffset + 540, SCREEN_HEIGHT - 73, "EDITOR//south.sti", MapInfoEntryPointsCallback); SetButtonFastHelpText( iEditorButton[ MAPINFO_SOUTH_POINT ], L"Specify south point for validation purposes."); - iEditorButton[ MAPINFO_CENTER_POINT ] = + iEditorButton[ MAPINFO_CENTER_POINT ] = CreateEasyToggleButton( iScreenWidthOffset + 590, SCREEN_HEIGHT - 105, "EDITOR//center.sti", MapInfoEntryPointsCallback); SetButtonFastHelpText( iEditorButton[ MAPINFO_CENTER_POINT ], L"Specify center point for validation purposes."); - iEditorButton[ MAPINFO_ISOLATED_POINT ] = + iEditorButton[ MAPINFO_ISOLATED_POINT ] = CreateEasyToggleButton( iScreenWidthOffset + 590, SCREEN_HEIGHT - 84, "EDITOR//isolated.sti", MapInfoEntryPointsCallback); SetButtonFastHelpText( iEditorButton[ MAPINFO_ISOLATED_POINT ], L"Specify isolated point for validation purposes."); } void InitEditorOptionsToolbar() { - iEditorButton[OPTIONS_NEW_MAP] = - CreateEasyNoToggleButton( iScreenWidthOffset + 71,SCREEN_HEIGHT - 79,"EDITOR//new.sti", BtnNewMapCallback); + iEditorButton[OPTIONS_NEW_MAP] = + CreateEasyNoToggleButton( iScreenWidthOffset + 71,SCREEN_HEIGHT - 79,"EDITOR//new.sti", BtnNewMapCallback); SetButtonFastHelpText(iEditorButton[OPTIONS_NEW_MAP],L"New map"); - iEditorButton[OPTIONS_NEW_BASEMENT] = - CreateEasyNoToggleButton( iScreenWidthOffset + 101,SCREEN_HEIGHT - 79,"EDITOR//new.sti", BtnNewBasementCallback); + iEditorButton[OPTIONS_NEW_BASEMENT] = + CreateEasyNoToggleButton( iScreenWidthOffset + 101,SCREEN_HEIGHT - 79,"EDITOR//new.sti", BtnNewBasementCallback); SetButtonFastHelpText(iEditorButton[OPTIONS_NEW_BASEMENT],L"New basement"); - iEditorButton[OPTIONS_NEW_CAVES] = + iEditorButton[OPTIONS_NEW_CAVES] = CreateEasyNoToggleButton( iScreenWidthOffset + 131,SCREEN_HEIGHT - 79,"EDITOR//new.sti", BtnNewCavesCallback); SetButtonFastHelpText(iEditorButton[OPTIONS_NEW_CAVES],L"New cave level"); - iEditorButton[OPTIONS_SAVE_MAP] = - CreateEasyNoToggleButton( iScreenWidthOffset + 161,SCREEN_HEIGHT - 79,"EDITOR//save.sti", BtnSaveCallback); + iEditorButton[OPTIONS_SAVE_MAP] = + CreateEasyNoToggleButton( iScreenWidthOffset + 161,SCREEN_HEIGHT - 79,"EDITOR//save.sti", BtnSaveCallback); SetButtonFastHelpText(iEditorButton[OPTIONS_SAVE_MAP],L"Save map"); - iEditorButton[OPTIONS_LOAD_MAP] = - CreateEasyNoToggleButton( iScreenWidthOffset + 191,SCREEN_HEIGHT - 79,"EDITOR//load.sti", BtnLoadCallback); + iEditorButton[OPTIONS_LOAD_MAP] = + CreateEasyNoToggleButton( iScreenWidthOffset + 191,SCREEN_HEIGHT - 79,"EDITOR//load.sti", BtnLoadCallback); SetButtonFastHelpText(iEditorButton[OPTIONS_LOAD_MAP],L"Load map"); - iEditorButton[OPTIONS_CHANGE_TILESET] = + iEditorButton[OPTIONS_CHANGE_TILESET] = CreateEasyNoToggleButton( iScreenWidthOffset + 221,SCREEN_HEIGHT - 79,"EDITOR//tileset.sti", BtnChangeTilesetCallback); SetButtonFastHelpText(iEditorButton[OPTIONS_CHANGE_TILESET],L"Select tileset"); - iEditorButton[OPTIONS_LEAVE_EDITOR] = + iEditorButton[OPTIONS_LEAVE_EDITOR] = CreateEasyNoToggleButton( iScreenWidthOffset + 251,SCREEN_HEIGHT - 79,"EDITOR//cancel.sti", BtnCancelCallback); SetButtonFastHelpText(iEditorButton[OPTIONS_LEAVE_EDITOR],L"Leave Editor mode"); - iEditorButton[OPTIONS_QUIT_GAME] = + iEditorButton[OPTIONS_QUIT_GAME] = CreateEasyNoToggleButton( iScreenWidthOffset + 281,SCREEN_HEIGHT - 79,"EDITOR//cancel.sti", BtnQuitCallback); SetButtonFastHelpText(iEditorButton[OPTIONS_QUIT_GAME],L"Exit game."); } void InitEditorTerrainToolbar() { - iEditorButton[TERRAIN_FGROUND_TEXTURES] = + iEditorButton[TERRAIN_FGROUND_TEXTURES] = CreateEasyToggleButton( iScreenWidthOffset + 100,SCREEN_HEIGHT - 80,"EDITOR//downgrid.sti", BtnFgGrndCallback); SetButtonFastHelpText(iEditorButton[TERRAIN_FGROUND_TEXTURES],L"Draw ground textures"); - iEditorButton[TERRAIN_BGROUND_TEXTURES] = + iEditorButton[TERRAIN_BGROUND_TEXTURES] = CreateEasyToggleButton( iScreenWidthOffset + 130,SCREEN_HEIGHT - 80,"EDITOR//upgrid.sti", BtnBkGrndCallback); SetButtonFastHelpText(iEditorButton[TERRAIN_BGROUND_TEXTURES],L"Set map ground textures"); - iEditorButton[TERRAIN_PLACE_CLIFFS] = + iEditorButton[TERRAIN_PLACE_CLIFFS] = CreateEasyToggleButton( iScreenWidthOffset + 160,SCREEN_HEIGHT - 80,"EDITOR//banks.sti", BtnBanksCallback); SetButtonFastHelpText(iEditorButton[TERRAIN_PLACE_CLIFFS],L"Place banks and cliffs"); - iEditorButton[TERRAIN_PLACE_ROADS] = + iEditorButton[TERRAIN_PLACE_ROADS] = CreateEasyToggleButton( iScreenWidthOffset + 190,SCREEN_HEIGHT - 80,"EDITOR//road.sti", BtnRoadsCallback); SetButtonFastHelpText(iEditorButton[TERRAIN_PLACE_ROADS],L"Draw roads"); - iEditorButton[TERRAIN_PLACE_DEBRIS] = + iEditorButton[TERRAIN_PLACE_DEBRIS] = CreateEasyToggleButton( iScreenWidthOffset + 220,SCREEN_HEIGHT - 80,"EDITOR//debris.sti", BtnDebrisCallback); SetButtonFastHelpText(iEditorButton[TERRAIN_PLACE_DEBRIS],L"Draw debris"); - iEditorButton[TERRAIN_PLACE_TREES] = + iEditorButton[TERRAIN_PLACE_TREES] = CreateEasyToggleButton( iScreenWidthOffset + 250,SCREEN_HEIGHT - 80,"EDITOR//tree.sti", BtnObjectCallback); SetButtonFastHelpText(iEditorButton[TERRAIN_PLACE_TREES],L"Place trees & bushes"); - - iEditorButton[TERRAIN_PLACE_ROCKS] = + + iEditorButton[TERRAIN_PLACE_ROCKS] = CreateEasyToggleButton( iScreenWidthOffset + 280,SCREEN_HEIGHT - 80,"EDITOR//num1.sti", BtnObject1Callback); SetButtonFastHelpText(iEditorButton[TERRAIN_PLACE_ROCKS],L"Place rocks"); - - iEditorButton[TERRAIN_PLACE_MISC] = + + iEditorButton[TERRAIN_PLACE_MISC] = CreateEasyToggleButton( iScreenWidthOffset + 310,SCREEN_HEIGHT - 80,"EDITOR//num2.sti", BtnObject2Callback); SetButtonFastHelpText(iEditorButton[TERRAIN_PLACE_MISC],L"Place barrels & other junk"); - - iEditorButton[TERRAIN_FILL_AREA] = + + iEditorButton[TERRAIN_FILL_AREA] = CreateEasyToggleButton( iScreenWidthOffset + 100,SCREEN_HEIGHT - 50,"EDITOR//fill.sti", BtnFillCallback); SetButtonFastHelpText(iEditorButton[TERRAIN_FILL_AREA],L"Fill area"); - iEditorButton[TERRAIN_UNDO] = + iEditorButton[TERRAIN_UNDO] = CreateEasyNoToggleButton( iScreenWidthOffset + 130,SCREEN_HEIGHT - 50,"EDITOR//undo.sti", BtnUndoCallback); SetButtonFastHelpText(iEditorButton[TERRAIN_UNDO],L"Undo last change"); - iEditorButton[TERRAIN_TOGGLE_ERASEMODE] = + iEditorButton[TERRAIN_TOGGLE_ERASEMODE] = CreateEasyToggleButton( iScreenWidthOffset + 160,SCREEN_HEIGHT - 50,"EDITOR//eraser.sti", BtnEraseCallback); SetButtonFastHelpText(iEditorButton[TERRAIN_TOGGLE_ERASEMODE],L"Toggle erase mode"); - iEditorButton[TERRAIN_CYCLE_BRUSHSIZE] = + iEditorButton[TERRAIN_CYCLE_BRUSHSIZE] = CreateEasyNoToggleButton( iScreenWidthOffset + 190,SCREEN_HEIGHT - 50,"EDITOR//paint.sti", BtnBrushCallback); SetButtonFastHelpText(iEditorButton[TERRAIN_CYCLE_BRUSHSIZE],L"Cycle brush size"); - iEditorButton[TERRAIN_RAISE_DENSITY] = + iEditorButton[TERRAIN_RAISE_DENSITY] = CreateEasyNoToggleButton( iScreenWidthOffset + 280,SCREEN_HEIGHT - 50,"EDITOR//uparrow.sti", BtnIncBrushDensityCallback); SetButtonFastHelpText(iEditorButton[TERRAIN_RAISE_DENSITY],L"Raise brush density"); - - iEditorButton[TERRAIN_LOWER_DENSITY] = + + iEditorButton[TERRAIN_LOWER_DENSITY] = CreateEasyNoToggleButton( iScreenWidthOffset + 350,SCREEN_HEIGHT - 50,"EDITOR//downarrow.sti", BtnDecBrushDensityCallback); SetButtonFastHelpText(iEditorButton[TERRAIN_LOWER_DENSITY],L"Lower brush density"); } @@ -765,34 +769,34 @@ void InitEditorTerrainToolbar() void CreateEditorTaskbarInternal() { //Create the tabs for the editor taskbar - iEditorButton[ TAB_TERRAIN ] = + iEditorButton[ TAB_TERRAIN ] = CreateTextButton(L"Terrain", (UINT16)SMALLFONT1, FONT_LTKHAKI, FONT_DKKHAKI, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 100, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK, + iScreenWidthOffset + 100, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK, TaskTerrainCallback); SpecifyButtonDownTextColors( iEditorButton[TAB_TERRAIN], FONT_YELLOW, FONT_ORANGE ); - iEditorButton[ TAB_BUILDINGS ] = + iEditorButton[ TAB_BUILDINGS ] = CreateTextButton(L"Buildings", (UINT16)SMALLFONT1, FONT_LTKHAKI, FONT_DKKHAKI, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 190, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK, + iScreenWidthOffset + 190, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK, TaskBuildingCallback); SpecifyButtonDownTextColors( iEditorButton[TAB_BUILDINGS], FONT_YELLOW, FONT_ORANGE ); - iEditorButton[ TAB_ITEMS ] = + iEditorButton[ TAB_ITEMS ] = CreateTextButton(L"Items", (UINT16)SMALLFONT1, FONT_LTKHAKI, FONT_DKKHAKI, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 280, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK, + iScreenWidthOffset + 280, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK, TaskItemsCallback); SpecifyButtonDownTextColors( iEditorButton[TAB_ITEMS], FONT_YELLOW, FONT_ORANGE ); - iEditorButton[ TAB_MERCS ] = + iEditorButton[ TAB_MERCS ] = CreateTextButton(L"Mercs", (UINT16)SMALLFONT1, FONT_LTKHAKI, FONT_DKKHAKI, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 370, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK, + iScreenWidthOffset + 370, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK, TaskMercsCallback); SpecifyButtonDownTextColors( iEditorButton[TAB_MERCS], FONT_YELLOW, FONT_ORANGE ); - iEditorButton[ TAB_MAPINFO ] = + iEditorButton[ TAB_MAPINFO ] = CreateTextButton(L"Map Info", (UINT16)SMALLFONT1, FONT_LTKHAKI, FONT_DKKHAKI, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 460, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK, + iScreenWidthOffset + 460, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK, TaskMapInfoCallback); SpecifyButtonDownTextColors( iEditorButton[TAB_MAPINFO], FONT_YELLOW, FONT_ORANGE ); - iEditorButton[ TAB_OPTIONS ] = + iEditorButton[ TAB_OPTIONS ] = CreateTextButton(L"Options", (UINT16)SMALLFONT1, FONT_LTKHAKI, FONT_DKKHAKI, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 550, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK, + iScreenWidthOffset + 550, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK, TaskOptionsCallback); SpecifyButtonDownTextColors( iEditorButton[TAB_OPTIONS], FONT_YELLOW, FONT_ORANGE ); @@ -807,4 +811,4 @@ void CreateEditorTaskbarInternal() } -#endif \ No newline at end of file +#endif diff --git a/Editor/Editor Taskbar Utils.cpp b/Editor/Editor Taskbar Utils.cpp index 0a22df46..e4791ade 100644 --- a/Editor/Editor Taskbar Utils.cpp +++ b/Editor/Editor Taskbar Utils.cpp @@ -51,7 +51,7 @@ void RenderEditorInfo(); extern ITEM_POOL *gpItemPool; -//editor icon storage vars +//editor icon storage vars INT32 giEditMercDirectionIcons[2]; UINT32 guiMercInventoryPanel; UINT32 guiOmertaMap; @@ -118,7 +118,7 @@ void InitEditorRegions() INT32 x; //By doing this, all of the buttons underneath are blanketed and can't be used anymore. - //Any new buttons will cover this up as well. Think of it as a barrier between the editor buttons, + //Any new buttons will cover this up as well. Think of it as a barrier between the editor buttons, //and the game's interface panel buttons and regions. MSYS_DefineRegion( &EditorRegion, 0, SCREEN_HEIGHT - 120, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_NORMAL, 0, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); @@ -133,19 +133,19 @@ void InitEditorRegions() gfShowTerrainTileButtons=FALSE; //Create the region for the items selection window. - MSYS_DefineRegion( &ItemsRegion, iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 360, iScreenWidthOffset + 540, 2 * iScreenHeightOffset + 440, MSYS_PRIORITY_NORMAL, 0, + MSYS_DefineRegion( &ItemsRegion, iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 360, iScreenWidthOffset + 540, 2 * iScreenHeightOffset + 440, MSYS_PRIORITY_NORMAL, 0, (MOUSE_CALLBACK)MouseMovedInItemsRegion, (MOUSE_CALLBACK)MouseClickedInItemsRegion ); MSYS_DisableRegion( &ItemsRegion ); //Create the region for the merc inventory panel. - MSYS_DefineRegion( &MercRegion, iScreenWidthOffset + 175, 2 * iScreenHeightOffset + 361, iScreenWidthOffset + 450, 2 * iScreenHeightOffset + 460, MSYS_PRIORITY_NORMAL, 0, + MSYS_DefineRegion( &MercRegion, iScreenWidthOffset + 175, 2 * iScreenHeightOffset + 361, iScreenWidthOffset + 450, 2 * iScreenHeightOffset + 460, MSYS_PRIORITY_NORMAL, 0, MouseMovedInMercRegion, MouseClickedInMercRegion ); MSYS_DisableRegion( &MercRegion ); } void LoadEditorImages() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; //Set up the merc inventory panel VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; @@ -192,8 +192,8 @@ void CreateEditorBuffers() UINT16 usUselessWidth, usUselessHeight; UINT8 ubBitDepth; - //create buffer for the transition slot for merc items. This slot contains the newly - //selected item graphic in it's inventory size version. This buffer is then scaled down + //create buffer for the transition slot for merc items. This slot contains the newly + //selected item graphic in it's inventory size version. This buffer is then scaled down //into the associated merc inventory panel slot buffer which is approximately 20% smaller. GetCurrentVideoSettings( &usUselessWidth, &usUselessHeight, &ubBitDepth ); vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE; @@ -289,7 +289,7 @@ void DoTaskbar(void) } gfRenderTaskbar = TRUE; - + HideEditorToolbar( iCurrentTaskbar ); //Special code when exiting previous editor tab @@ -350,7 +350,7 @@ void DoTaskbar(void) break; case TASK_BUILDINGS: ClickEditorButton( TAB_BUILDINGS ); - if(fBuildingShowRoofs) + if(fBuildingShowRoofs) ClickEditorButton( BUILDING_TOGGLE_ROOF_VIEW ); if(fBuildingShowWalls) ClickEditorButton( BUILDING_TOGGLE_WALL_VIEW ); @@ -410,7 +410,7 @@ void DisableEditorTaskbar(void) void EnableEditorTaskbar(void) { INT32 x; - + for(x = 0; x < NUMBER_EDITOR_BUTTONS; x++ ) EnableButton( iEditorButton[ x ] ); //Keep permanent buttons disabled. @@ -425,7 +425,7 @@ void EnableEditorTaskbar(void) } //A specialized mprint function that'll restore the editor panel underneath the -//string before rendering the string. This is obviously only useful for drawing text +//string before rendering the string. This is obviously only useful for drawing text //in the editor taskbar. void mprintfEditor(INT16 x, INT16 y, STR16 pFontString, ...) { @@ -435,7 +435,7 @@ void mprintfEditor(INT16 x, INT16 y, STR16 pFontString, ...) Assert( pFontString != NULL ); - va_start( argptr, pFontString ); // Set up variable argument pointer + va_start( argptr, pFontString ); // Set up variable argument pointer vswprintf( string, pFontString, argptr); // process gprintf string (get output str) va_end( argptr ); @@ -471,7 +471,7 @@ void ClearTaskbarRegion( INT16 sLeft, INT16 sTop, INT16 sRight, INT16 sBottom ) //Kris: //This is a new function which duplicates the older "yellow info boxes" that -//are common throughout the editor. This draws the yellow box with the indentation +//are common throughout the editor. This draws the yellow box with the indentation //look. void DrawEditorInfoBox( STR16 str, UINT32 uiFont, UINT16 x, UINT16 y, UINT16 w, UINT16 h ) { @@ -621,7 +621,7 @@ void RenderMapEntryPointsAndLights() if( sGridNo != -1 ) { GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); - if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH ) + if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH ) { DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"North Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); } @@ -630,7 +630,7 @@ void RenderMapEntryPointsAndLights() if( sGridNo != -1 ) { GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); - if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH ) + if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH ) { DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"West Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); } @@ -639,7 +639,7 @@ void RenderMapEntryPointsAndLights() if( sGridNo != -1 ) { GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); - if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH ) + if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH ) { DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"East Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); } @@ -648,7 +648,7 @@ void RenderMapEntryPointsAndLights() if( sGridNo != -1 ) { GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); - if( sScreenY >= ( - 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH ) + if( sScreenY >= ( - 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH ) { DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"South Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); } @@ -657,7 +657,7 @@ void RenderMapEntryPointsAndLights() if( sGridNo != -1 ) { GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); - if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH ) + if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH ) { DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"Center Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); } @@ -666,7 +666,7 @@ void RenderMapEntryPointsAndLights() if( sGridNo != -1 ) { GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); - if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH ) + if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH ) { DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"Isolated Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); } @@ -677,7 +677,7 @@ void RenderMapEntryPointsAndLights() { if( LightSprites[ i ].uiFlags & LIGHT_SPR_ACTIVE ) { - // Check for light out of bounds. This actually happens in Drassen. + // Check for light out of bounds. This actually happens in Drassen. if (LightSprites[ i ].iY < 0 || LightSprites[ i ].iY > WORLD_ROWS || LightSprites[ i ].iX < 0 || LightSprites[ i ].iX > WORLD_COLS) { @@ -687,7 +687,7 @@ void RenderMapEntryPointsAndLights() sGridNo = LightSprites[ i ].iY * WORLD_COLS + LightSprites[ i ].iX; GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); - if( sScreenY >= (- 50) && sScreenY < (2 * iScreenHeightOffset + 300) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH ) + if( sScreenY >= (- 50) && sScreenY < (2 * iScreenHeightOffset + 300) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH ) { if( LightSprites[ i ].uiFlags & LIGHT_PRIMETIME ) DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 50, 2, FONT10ARIAL, FONT_ORANGE, L"Prime", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); @@ -704,27 +704,27 @@ void BuildTriggerName( OBJECTTYPE *pItem, STR16 szItemName ) { if( pItem->usItem == SWITCH ) { - if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY ) + if( (*pItem)[0]->data.misc.bFrequency == PANIC_FREQUENCY ) swprintf( szItemName, L"Panic Trigger1" ); - else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_2 ) + else if( (*pItem)[0]->data.misc.bFrequency == PANIC_FREQUENCY_2 ) swprintf( szItemName, L"Panic Trigger2" ); - else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_3 ) + else if( (*pItem)[0]->data.misc.bFrequency == PANIC_FREQUENCY_3 ) swprintf( szItemName, L"Panic Trigger3" ); else - swprintf( szItemName, L"Trigger%d", pItem->ItemData.Trigger.BombTrigger.bFrequency - 50 ); + swprintf( szItemName, L"Trigger%d", (*pItem)[0]->data.misc.bFrequency - 50 ); } else { //action item - if( pItem->ItemData.Trigger.bDetonatorType == BOMB_PRESSURE ) + if( (*pItem)[0]->data.misc.bDetonatorType == BOMB_PRESSURE ) swprintf( szItemName, L"Pressure Action" ); - else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY ) + else if( (*pItem)[0]->data.misc.bFrequency == PANIC_FREQUENCY ) swprintf( szItemName, L"Panic Action1" ); - else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_2 ) + else if( (*pItem)[0]->data.misc.bFrequency == PANIC_FREQUENCY_2 ) swprintf( szItemName, L"Panic Action2" ); - else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_3 ) + else if( (*pItem)[0]->data.misc.bFrequency == PANIC_FREQUENCY_3 ) swprintf( szItemName, L"Panic Action3" ); else - swprintf( szItemName, L"Action%d", pItem->ItemData.Trigger.BombTrigger.bFrequency - 50 ); + swprintf( szItemName, L"Action%d", (*pItem)[0]->data.misc.bFrequency - 50 ); } } @@ -797,11 +797,11 @@ void RenderSelectedItemBlownUp() //Display the enlarged item graphic uiVideoObjectIndex = GetInterfaceGraphicForItem( &Item[ gpItem->usItem ] ); GetVideoObject( &hVObject, uiVideoObjectIndex ); - + sWidth = hVObject->pETRLEObject[ Item[ gpItem->usItem ].ubGraphicNum ].usWidth; sOffsetX = hVObject->pETRLEObject[ Item[ gpItem->usItem ].ubGraphicNum ].sOffsetX; xp = sScreenX + (40 - sWidth - sOffsetX*2) / 2; - + sHeight = hVObject->pETRLEObject[ Item[ gpItem->usItem ].ubGraphicNum ].usHeight; sOffsetY = hVObject->pETRLEObject[ Item[ gpItem->usItem ].ubGraphicNum ].sOffsetY; yp = sScreenY + (20 - sHeight - sOffsetY*2) / 2; @@ -818,7 +818,7 @@ void RenderSelectedItemBlownUp() } else if( Item[ gpItem->usItem ].usItemClass == IC_KEY ) { - swprintf( szItemName, L"%S", LockTable[ gpItem->ItemData.Key.ubKeyID ].ubEditorName ); + swprintf( szItemName, L"%S", LockTable[ (*gpItem)[0]->data.key.ubKeyID ].ubEditorName ); } else { @@ -842,7 +842,7 @@ void RenderSelectedItemBlownUp() //Count the number of items in the current pool, and display that. i = 0; - GetItemPool( gsItemGridNo, &pItemPool, 0 ); + GetItemPoolFromGround( gsItemGridNo, &pItemPool ); Assert( pItemPool ); while( pItemPool ) { @@ -852,9 +852,9 @@ void RenderSelectedItemBlownUp() xp = sScreenX; yp = sScreenY + 10; mprintf( xp, yp, L"%d", i ); - + //If the item is hidden, render a blinking H (just like DG) - if( gWorldItems[ gpItemPool->iItemIndex ].bVisible == HIDDEN_ITEM || + if( gWorldItems[ gpItemPool->iItemIndex ].bVisible == HIDDEN_ITEM || gWorldItems[ gpItemPool->iItemIndex ].bVisible == BURIED ) { SetFont( FONT10ARIALBOLD ); @@ -871,17 +871,17 @@ void RenderEditorInfo( ) { CHAR16 FPSText[ 50 ]; static INT32 iSpewWarning = 0; - UINT16 uiMapIndex; + INT16 iMapIndex; SetFont( FONT12POINT1 ); SetFontForeground( FONT_BLACK ); SetFontBackground( FONT_BLACK ); //Display the mapindex position - if( GetMouseMapPos( &uiMapIndex ) ) - swprintf( FPSText, L" (%d) ", uiMapIndex ); + if( GetMouseMapPos( &iMapIndex ) ) + swprintf( FPSText, L" (%d) ", iMapIndex ); else - swprintf( FPSText, L" " ); + swprintf( FPSText, L" " ); mprintfEditor( (UINT16)(iScreenWidthOffset + 50-StringPixLength( FPSText, FONT12POINT1 )/2), 2 * iScreenHeightOffset + 463, FPSText ); switch( iCurrentTaskbar ) @@ -890,7 +890,7 @@ void RenderEditorInfo( ) if( !gfWorldLoaded || giCurrentTilesetID < 0 ) mprintf( iScreenWidthOffset + 260, 2 * iScreenHeightOffset + 445, L"No map currently loaded." ); else - mprintf( iScreenWidthOffset + 260, 2 * iScreenHeightOffset + 445, L"File: %S, Current Tileset: %s", + mprintf( iScreenWidthOffset + 260, 2 * iScreenHeightOffset + 445, L"File: %S, Current Tileset: %s", gubFilename, gTilesets[ giCurrentTilesetID ].zName ); break; case TASK_TERRAIN: @@ -898,7 +898,7 @@ void RenderEditorInfo( ) // WANNE: Comment this two lines, because we always get an exception here. //if( gusSelectionType == LINESELECTION ) // swprintf( wszSelType[LINESELECTION], L"Width: %d", gusSelectionWidth ); - + DrawEditorInfoBox( wszSelType[gusSelectionType], FONT12POINT1, iScreenWidthOffset + 220, 2 * iScreenHeightOffset + 430, 60, 30 ); swprintf( FPSText, L"%d%%", gusSelectionDensity ); DrawEditorInfoBox( FPSText, FONT12POINT1, iScreenWidthOffset + 310, 2 * iScreenHeightOffset + 430, 40, 30 ); @@ -914,7 +914,7 @@ void RenderEditorInfo( ) // WANNE: Comment this two lines, because we always get an exception here. //if( gusSelectionType == LINESELECTION ) // swprintf( wszSelType[LINESELECTION], L"%d", gusSelectionWidth ); - + DrawEditorInfoBox( wszSelType[gusSelectionType], FONT12POINT1, iScreenWidthOffset + 530, 2 * iScreenHeightOffset + 430, 60, 30 ); break; case TASK_MERCS: @@ -925,14 +925,14 @@ void RenderEditorInfo( ) // WANNE: EDITOR: Comment this two lines, because we always get an exception here! //if( gusSelectionType == LINESELECTION ) // swprintf( wszSelType[LINESELECTION], L"Width: %d", gusSelectionWidth ); - + DrawEditorInfoBox( wszSelType[gusSelectionType], FONT12POINT1, iScreenWidthOffset + 440, 2 * iScreenHeightOffset + 430, 60, 30 ); break; } } -//This is in ButtonSystem.c as a hack. Because we need to save the buffer whenever we do a full -//taskbar render, we need to draw the buttons without hilites, hence this flag. This flag is +//This is in ButtonSystem.c as a hack. Because we need to save the buffer whenever we do a full +//taskbar render, we need to draw the buttons without hilites, hence this flag. This flag is //always true in ButtonSystem.c, so it won't effect anything else. extern BOOLEAN gfGotoGridNoUI; @@ -952,13 +952,13 @@ void ProcessEditorRendering() } if( gfRenderDrawingMode ) { - if( iCurrentTaskbar == TASK_BUILDINGS || iCurrentTaskbar == TASK_TERRAIN || iCurrentTaskbar == TASK_ITEMS ) + if( iCurrentTaskbar == TASK_BUILDINGS || iCurrentTaskbar == TASK_TERRAIN || iCurrentTaskbar == TASK_ITEMS ) { ShowCurrentDrawingMode(); gfRenderDrawingMode = FALSE; } } - //render dynamically changed buttons only + //render dynamically changed buttons only RenderButtons( ); if( gfSummaryWindowActive ) @@ -979,8 +979,8 @@ void ProcessEditorRendering() RenderSelectedItemBlownUp(); if( iCurrentTaskbar == TASK_MAPINFO ) RenderMapEntryPointsAndLights(); - if( iDrawMode == DRAW_MODE_PLACE_ITEM && eInfo.uiItemType == TBAR_MODE_ITEM_KEYS || - iDrawMode == DRAW_MODE_DOORKEYS ) + if( iDrawMode == DRAW_MODE_PLACE_ITEM && eInfo.uiItemType == TBAR_MODE_ITEM_KEYS || + iDrawMode == DRAW_MODE_DOORKEYS ) RenderDoorLockInfo(); } @@ -990,8 +990,8 @@ void ProcessEditorRendering() BlitBufferToBuffer( FRAME_BUFFER, guiSAVEBUFFER, 0, 2 * iScreenHeightOffset + 360, SCREEN_WIDTH, 120 ); //Make sure this is TRUE at all times. - //It is set to false when before we save the buffer, so the buttons don't get - //rendered with hilites, in case the mouse is over one. + //It is set to false when before we save the buffer, so the buttons don't get + //rendered with hilites, in case the mouse is over one. gfRenderHilights = TRUE; RenderButtonsFastHelp(); @@ -999,4 +999,4 @@ void ProcessEditorRendering() } -#endif \ No newline at end of file +#endif diff --git a/Editor/Editor Taskbar Utils.h b/Editor/Editor Taskbar Utils.h index 8a7ee6c9..9750ed03 100644 --- a/Editor/Editor Taskbar Utils.h +++ b/Editor/Editor Taskbar Utils.h @@ -4,7 +4,7 @@ #ifndef __EDITOR_TASKBAR_UTILS_H #define __EDITOR_TASKBAR_UTILS_H -//These are utilities that are used within the editor. This function absorbs the expensive +//These are utilities that are used within the editor. This function absorbs the expensive //compile time of the SGP dependencies, while allowing the other editor files to hook into it //without paying, so to speak. @@ -64,7 +64,7 @@ extern UINT32 guiExclamation; extern UINT32 guiKeyImage; extern UINT32 guiMercInvPanelBuffers[9]; extern UINT32 guiMercTempBuffer; -extern INT32 giEditMercImage[2]; +extern INT32 giEditMercImage[2]; #endif #endif \ No newline at end of file diff --git a/Editor/Editor Undo.cpp b/Editor/Editor Undo.cpp index 9ae48864..95f23168 100644 --- a/Editor/Editor Undo.cpp +++ b/Editor/Editor Undo.cpp @@ -16,7 +16,7 @@ #include "editscreen.h" #include "Editor Undo.h" - #include "Render Fun.h" //for access to gubWorldRoomInfo; + #include "Render Fun.h" //for access to gubWorldRoomInfo; #include "Cursor Modes.h" #include "Exit Grids.h" #endif @@ -24,35 +24,35 @@ /* Kris -- Notes on how the undo code works: -At the bottom of the hierarchy, we need to determine the state of the undo command. The idea -is that we want to separate undo commands by separating them by new mouse clicks. By holding a mouse -down and painting various objects in the world would all constitute a single undo command. As soon as -the mouse is release, then a new undo command is setup. So, to automate this, there is a call every +At the bottom of the hierarchy, we need to determine the state of the undo command. The idea +is that we want to separate undo commands by separating them by new mouse clicks. By holding a mouse +down and painting various objects in the world would all constitute a single undo command. As soon as +the mouse is release, then a new undo command is setup. So, to automate this, there is a call every frame to DetermineUndoState(). -At the next level, there is a binary tree that keeps track of what map indices have been backup up in -the current undo command. The whole reason to maintain this list, is to avoid multiple map elements of -the same map index from being saved. In the outer code, everytime something is changed, a call to +At the next level, there is a binary tree that keeps track of what map indices have been backup up in +the current undo command. The whole reason to maintain this list, is to avoid multiple map elements of +the same map index from being saved. In the outer code, everytime something is changed, a call to AddToUndoList() is called, so there are many cases (especially with building/terrain smoothing) that the -same mapindex is added to the undo list. This is also completely transparent, and doesn't need to be +same mapindex is added to the undo list. This is also completely transparent, and doesn't need to be maintained. -In the outer code, there are several calls to AddToUndoList( iMapIndex ). This function basically looks +In the outer code, there are several calls to AddToUndoList( iMapIndex ). This function basically looks in the binary tree for an existing entry, and if there isn't, then the entire mapelement is saved (with -the exception of the merc level ). Lights are also supported, but there is a totally different methodology -for accomplishing this. The equivalent function is AddLightToUndoList( iMapIndex ). In this case, only the +the exception of the merc level ). Lights are also supported, but there is a totally different methodology +for accomplishing this. The equivalent function is AddLightToUndoList( iMapIndex ). In this case, only the light is saved, along with internal maintanance of several flags. -The actual mapelement copy code, is very complex. The mapelement is copied in parallel with a new one which +The actual mapelement copy code, is very complex. The mapelement is copied in parallel with a new one which has to allocate several nodes of several types because a mapelement contains over a dozen separate lists, and -all of them need to be saved. The structure information of certain mapelements may be multitiled and must -also save the affected gridno's as well. This is also done internally. Basically, your call to +all of them need to be saved. The structure information of certain mapelements may be multitiled and must +also save the affected gridno's as well. This is also done internally. Basically, your call to AddToUndoList() for any particular gridno, may actually save several entries (like for a car which could be 6+ tiles) MERCS -Mercs are not supported in the undo code. Because they are so dynamic, and stats could change, they could -move, etc., it doesn't need to be in the undo code. The editor has its own way of dealing with mercs which +Mercs are not supported in the undo code. Because they are so dynamic, and stats could change, they could +move, etc., it doesn't need to be in the undo code. The editor has its own way of dealing with mercs which doesn't use the undo methodology. */ @@ -71,13 +71,13 @@ void DisableUndo() } // undo node data element -typedef struct +typedef struct { INT32 iMapIndex; MAP_ELEMENT *pMapTile; - BOOLEAN fLightSaved; //determines that a light has been saved + BOOLEAN fLightSaved; //determines that a light has been saved UINT8 ubLightRadius; //the radius of the light to build if undo is called - UINT8 ubLightID; //only applies if a light was saved. + UINT8 ubLightID; //only applies if a light was saved. UINT8 ubRoomNum; } undo_struct; @@ -108,27 +108,27 @@ BOOLEAN fNewUndoCmd = TRUE; BOOLEAN gfIgnoreUndoCmdsForLights = FALSE; //New pre-undo binary tree stuff -//With this, new undo commands will not duplicate saves in the same command. This will +//With this, new undo commands will not duplicate saves in the same command. This will //increase speed, and save memory. typedef struct MapIndexBinaryTree { struct MapIndexBinaryTree *left, *right; - UINT16 usMapIndex; + INT16 sMapIndex; }MapIndexBinaryTree; MapIndexBinaryTree *top = NULL; void ClearUndoMapIndexTree(); -BOOLEAN AddMapIndexToTree( UINT16 usMapIndex ); -void CheckMapIndexForMultiTileStructures( UINT16 usMapIndex ); +BOOLEAN AddMapIndexToTree( INT16 sMapIndex ); +void CheckMapIndexForMultiTileStructures( INT16 sMapIndex ); void CheckForMultiTilesInTreeAndAddToUndoList( MapIndexBinaryTree *node ); //Recursively deletes all nodes below the node passed including itself. void DeleteTreeNode( MapIndexBinaryTree **node ) { - if( (*node)->left ) + if( (*node)->left ) DeleteTreeNode( &((*node)->left) ); - if( (*node)->right ) + if( (*node)->right ) DeleteTreeNode( &((*node)->right) ); MemFree( *node ); *node = NULL; @@ -141,14 +141,14 @@ void ClearUndoMapIndexTree() DeleteTreeNode( &top ); } -BOOLEAN AddMapIndexToTree( UINT16 usMapIndex ) +BOOLEAN AddMapIndexToTree( INT16 sMapIndex ) { MapIndexBinaryTree *curr, *parent; if( !top ) { top = (MapIndexBinaryTree*)MemAlloc( sizeof( MapIndexBinaryTree ) ); Assert( top ); - top->usMapIndex = usMapIndex; + top->sMapIndex = sMapIndex; top->left = NULL; top->right = NULL; return TRUE; @@ -161,26 +161,26 @@ BOOLEAN AddMapIndexToTree( UINT16 usMapIndex ) while( curr ) { parent = curr; - if( curr->usMapIndex == usMapIndex ) //found a match, so stop + if( curr->sMapIndex == sMapIndex ) //found a match, so stop return FALSE; //if the mapIndex is < node's mapIndex, then go left, else right - curr = ( usMapIndex < curr->usMapIndex ) ? curr->left : curr->right; + curr = ( sMapIndex < curr->sMapIndex ) ? curr->left : curr->right; } //if we made it this far, then curr is null and parent is pointing //directly above. //Create the new node and fill in the information. curr = (MapIndexBinaryTree*)MemAlloc( sizeof( MapIndexBinaryTree ) ); Assert( curr ); - curr->usMapIndex = usMapIndex; + curr->sMapIndex = sMapIndex; curr->left = NULL; curr->right = NULL; //Now link the new node to the parent. - if( curr->usMapIndex < parent->usMapIndex ) + if( curr->sMapIndex < parent->sMapIndex ) parent->left = curr; else parent->right = curr; return TRUE; -} +} //************************************************************************* // // Start of Undo code @@ -236,7 +236,7 @@ BOOLEAN DeleteStackNodeContents( undo_stack *pCurrent ) pData = pCurrent->pData; pMapTile = pData->pMapTile; - if( !pMapTile ) + if( !pMapTile ) return TRUE; //light was saved -- mapelement wasn't saved. // Free the memory associated with the map tile liked lists @@ -309,14 +309,14 @@ BOOLEAN DeleteStackNodeContents( undo_stack *pCurrent ) { pMapTile->pStructureHead = pStructureNode->pNext; if( pStructureNode->usStructureID > INVALID_STRUCTURE_ID ) - { //Okay to delete the structure data -- otherwise, this would be + { //Okay to delete the structure data -- otherwise, this would be //merc structure data that we DON'T want to delete, because the merc node //that hasn't been modified will still use this structure data! MemFree( pStructureNode ); } pStructureNode = pMapTile->pStructureHead; } - + // Free the map tile structure itself MemFree( pMapTile ); @@ -356,23 +356,23 @@ void CropStackToMaxLength( INT32 iMaxCmds ) } -//We are adding a light to the undo list. We won't save the mapelement, nor will -//we validate the gridno in the binary tree. This works differently than a mapelement, -//because lights work on a different system. By setting the fLightSaved flag to TRUE, -//this will handle the way the undo command is handled. If there is no lightradius in +//We are adding a light to the undo list. We won't save the mapelement, nor will +//we validate the gridno in the binary tree. This works differently than a mapelement, +//because lights work on a different system. By setting the fLightSaved flag to TRUE, +//this will handle the way the undo command is handled. If there is no lightradius in //our saved light, then we intend on erasing the light upon undo execution, otherwise, we //save the light radius and light ID, so that we place it during undo execution. void AddLightToUndoList( INT32 iMapIndex, INT32 iLightRadius, UINT8 ubLightID ) { undo_stack *pNode; undo_struct *pUndoInfo; - + if( !gfUndoEnabled ) return; //When executing an undo command (by adding a light or removing one), that command - //actually tries to add it to the undo list. So we wrap the execution of the undo + //actually tries to add it to the undo list. So we wrap the execution of the undo //command by temporarily setting this flag, so it'll ignore, and not place a new undo - //command. When finished, the flag is cleared, and lights are again allowed to be saved + //command. When finished, the flag is cleared, and lights are again allowed to be saved //in the undo list. if( gfIgnoreUndoCmdsForLights ) return; @@ -389,7 +389,7 @@ void AddLightToUndoList( INT32 iMapIndex, INT32 iLightRadius, UINT8 ubLightID ) } pUndoInfo->fLightSaved = TRUE; - //if ubLightRadius is 0, then we don't need to save the light information because we + //if ubLightRadius is 0, then we don't need to save the light information because we //will erase it when it comes time to execute the undo command. pUndoInfo->ubLightRadius = (UINT8)iLightRadius; pUndoInfo->ubLightID = ubLightID; @@ -420,7 +420,7 @@ BOOLEAN AddToUndoList( INT32 iMapIndex ) //Check to see if the tile in question is even on the visible map, then //if that is true, then check to make sure we don't already have the mapindex //saved in the new binary tree (which only holds unique mapindex values). - if( GridNoOnVisibleWorldTile( (INT16)iMapIndex ) && AddMapIndexToTree( (UINT16)iMapIndex ) ) + if( GridNoOnVisibleWorldTile( (INT16)iMapIndex ) && AddMapIndexToTree( (INT16)iMapIndex ) ) { if( AddToUndoListCmd( iMapIndex, ++iCount ) ) @@ -439,7 +439,7 @@ BOOLEAN AddToUndoListCmd( INT32 iMapIndex, INT32 iCmdCount ) STRUCTURE *pStructure; INT32 iCoveredMapIndex; UINT8 ubLoop; - + if ( (pNode = (undo_stack *)MemAlloc(sizeof( undo_stack )) ) == NULL ) { return( FALSE ); @@ -482,7 +482,7 @@ BOOLEAN AddToUndoListCmd( INT32 iMapIndex, INT32 iCmdCount ) // copy the room number information (it's not in the mapelement structure) pUndoInfo->ubRoomNum = gubWorldRoomInfo[ iMapIndex ]; - + pUndoInfo->fLightSaved = FALSE; pUndoInfo->ubLightRadius = 0; pUndoInfo->ubLightID = 0; @@ -496,10 +496,10 @@ BOOLEAN AddToUndoListCmd( INT32 iMapIndex, INT32 iCmdCount ) // loop through pData->pStructureHead list // for each structure - // find the base tile - // reference the db structure - // if number of tiles > 1 - // add all covered tiles to undo list + // find the base tile + // reference the db structure + // if number of tiles > 1 + // add all covered tiles to undo list pStructure = pData->pStructureHead; while (pStructure) { @@ -519,13 +519,13 @@ BOOLEAN AddToUndoListCmd( INT32 iMapIndex, INT32 iCmdCount ) } -void CheckMapIndexForMultiTileStructures( UINT16 usMapIndex ) +void CheckMapIndexForMultiTileStructures( INT16 sMapIndex ) { STRUCTURE * pStructure; UINT8 ubLoop; INT32 iCoveredMapIndex; - pStructure = gpWorldLevelData[usMapIndex].pStructureHead; + pStructure = gpWorldLevelData[sMapIndex].pStructureHead; while (pStructure) { if (pStructure->pDBStructureRef->pDBStructure->ubNumberOfTiles > 1) @@ -535,7 +535,7 @@ void CheckMapIndexForMultiTileStructures( UINT16 usMapIndex ) // for multi-tile structures we have to add, to the undo list, all the other tiles covered by the structure if (pStructure->fFlags & STRUCTURE_BASE_TILE) { - iCoveredMapIndex = usMapIndex + pStructure->pDBStructureRef->ppTile[ubLoop]->sPosRelToBase; + iCoveredMapIndex = sMapIndex + pStructure->pDBStructureRef->ppTile[ubLoop]->sPosRelToBase; } else { @@ -550,10 +550,10 @@ void CheckMapIndexForMultiTileStructures( UINT16 usMapIndex ) void CheckForMultiTilesInTreeAndAddToUndoList( MapIndexBinaryTree *node ) { - CheckMapIndexForMultiTileStructures( node->usMapIndex ); - if( node->left ) + CheckMapIndexForMultiTileStructures( node->sMapIndex ); + if( node->left ) CheckForMultiTilesInTreeAndAddToUndoList( node->left ); - if( node->right ) + if( node->right ) CheckForMultiTilesInTreeAndAddToUndoList( node->right ); } @@ -590,14 +590,14 @@ BOOLEAN ExecuteUndoList( void ) { iUndoMapIndex = gpTileUndoStack->pData->iMapIndex; - fExitGrid = ExitGridAtGridNo( (UINT16)iUndoMapIndex ); + fExitGrid = ExitGridAtGridNo( (INT16)iUndoMapIndex ); // Find which map tile we are to "undo" if( gpTileUndoStack->pData->fLightSaved ) { //We saved a light, so delete that light INT16 sX, sY; //Turn on this flag so that the following code, when executed, doesn't attempt to - //add lights to the undo list. That would cause problems... + //add lights to the undo list. That would cause problems... gfIgnoreUndoCmdsForLights = TRUE; ConvertGridNoToXY( (INT16)iUndoMapIndex, &sX, &sY ); if( !gpTileUndoStack->pData->ubLightRadius ) @@ -612,7 +612,7 @@ BOOLEAN ExecuteUndoList( void ) // of the undo's MAP_ELEMENT with the world's element. SwapMapElementWithWorld( iUndoMapIndex, gpTileUndoStack->pData->pMapTile ); - // copy the room number information back + // copy the room number information back gubWorldRoomInfo[ iUndoMapIndex ] = gpTileUndoStack->pData->ubRoomNum; // Now we smooth out the changes... @@ -627,16 +627,16 @@ BOOLEAN ExecuteUndoList( void ) iCurCount++; //Kris: - //The new cursor system is somehow interfering with the undo stuff. When - //an undo is called, the item is erased, but a cursor is added! I'm quickly + //The new cursor system is somehow interfering with the undo stuff. When + //an undo is called, the item is erased, but a cursor is added! I'm quickly //hacking around this by erasing all cursors here. RemoveAllTopmostsOfTypeRange( iUndoMapIndex, FIRSTPOINTERS, FIRSTPOINTERS ); - if( fExitGrid && !ExitGridAtGridNo( (UINT16)iUndoMapIndex ) ) + if( fExitGrid && !ExitGridAtGridNo( (INT16)iUndoMapIndex ) ) { //An exitgrid has been removed, so get rid of the associated indicator. RemoveTopmost( (UINT16)iUndoMapIndex, FIRSTPOINTERS8 ); } - else if( !fExitGrid && ExitGridAtGridNo( (UINT16)iUndoMapIndex ) ) + else if( !fExitGrid && ExitGridAtGridNo( (INT16)iUndoMapIndex ) ) { //An exitgrid has been added, so add the associated indicator AddTopmostToTail( (UINT16)iUndoMapIndex, FIRSTPOINTERS8 ); } @@ -669,7 +669,7 @@ void SmoothUndoMapTileTerrain( INT32 iWorldTile, MAP_ELEMENT *pUndoTile ) pLand = pLand->pNext; } } - else if ( gpWorldLevelData[ iWorldTile ].pLandHead == NULL ) + else if ( gpWorldLevelData[ iWorldTile ].pLandHead == NULL ) { // Nothing in world's tile, so smooth out the land in the old tile. pLand = pUndoLand; @@ -692,7 +692,7 @@ void SmoothUndoMapTileTerrain( INT32 iWorldTile, MAP_ELEMENT *pUndoTile ) while( pWLand != NULL && !fFound ) { GetTileType( pWLand->usIndex, &uiWCheckType); - + if ( uiCheckType == uiWCheckType ) fFound = TRUE; @@ -715,7 +715,7 @@ void SmoothUndoMapTileTerrain( INT32 iWorldTile, MAP_ELEMENT *pUndoTile ) while( pLand != NULL && !fFound ) { GetTileType( pLand->usIndex, &uiCheckType); - + if ( uiCheckType == uiWCheckType ) fFound = TRUE; @@ -731,7 +731,7 @@ void SmoothUndoMapTileTerrain( INT32 iWorldTile, MAP_ELEMENT *pUndoTile ) } //Because of the potentially huge amounts of memory that can be allocated due to the inefficient -//undo methods coded by Bret, it is feasible that it could fail. Instead of using assertions to +//undo methods coded by Bret, it is feasible that it could fail. Instead of using assertions to //terminate the program, destroy the memory allocated thusfar. void DeleteMapElementContentsAfterCreationFail( MAP_ELEMENT *pNewMapElement ) { @@ -762,7 +762,7 @@ void DeleteMapElementContentsAfterCreationFail( MAP_ELEMENT *pNewMapElement ) } /* - union + union { struct TAG_level_node *pPrevNode; // FOR LAND, GOING BACKWARDS POINTER ITEM_POOL *pItemPool; // ITEM POOLS @@ -770,7 +770,7 @@ void DeleteMapElementContentsAfterCreationFail( MAP_ELEMENT *pNewMapElement ) INT32 iPhysicsObjectID; // ID FOR PHYSICS ITEM INT32 uiAPCost; // FOR AP DISPLAY }; // ( 4 byte union ) - union + union { struct { @@ -787,7 +787,7 @@ BOOLEAN CopyMapElementFromWorld( MAP_ELEMENT *pNewMapElement, INT32 iMapIndex ) { MAP_ELEMENT *pOldMapElement; LEVELNODE *pOldLevelNode; - LEVELNODE *pLevelNode; + LEVELNODE *pLevelNode; LEVELNODE *pNewLevelNode; LEVELNODE *tail; INT32 x; @@ -832,7 +832,7 @@ BOOLEAN CopyMapElementFromWorld( MAP_ELEMENT *pNewMapElement, INT32 iMapIndex ) //place the new node inside of the new map element if( !pNewStructure ) { - pNewMapElement->pStructureHead = pStructure; + pNewMapElement->pStructureHead = pStructure; pNewStructure = pStructure; } else @@ -886,7 +886,7 @@ BOOLEAN CopyMapElementFromWorld( MAP_ELEMENT *pNewMapElement, INT32 iMapIndex ) //place the new node inside of the new map element if( !pNewLevelNode ) { - pNewMapElement->pLevelNodes[ x ] = pLevelNode; + pNewMapElement->pLevelNodes[ x ] = pLevelNode; pNewLevelNode = pLevelNode; } else @@ -916,7 +916,7 @@ BOOLEAN CopyMapElementFromWorld( MAP_ELEMENT *pNewMapElement, INT32 iMapIndex ) { //make sure the structuredata pointer points to the parallel structure STRUCTURE *pOld, *pNew; //both lists are exactly the same size and contain the same information, - //but the addresses are different. We will traverse the old list until + //but the addresses are different. We will traverse the old list until //we find the match, then pOld = pOldMapElement->pStructureHead; pNew = pNewMapElement->pStructureHead; @@ -933,10 +933,10 @@ BOOLEAN CopyMapElementFromWorld( MAP_ELEMENT *pNewMapElement, INT32 iMapIndex ) } //Kris: //If this assert should fail, that means there is something wrong with - //the preservation of the structure data within the mapelement. + //the preservation of the structure data within the mapelement. if( pOld != pOldLevelNode->pStructureData ) { - //OUCH!!! THIS IS HAPPENING. DISABLED IT FOR LINDA'S SAKE + //OUCH!!! THIS IS HAPPENING. DISABLED IT FOR LINDA'S SAKE Assert( 1 ); } } @@ -968,11 +968,11 @@ BOOLEAN SwapMapElementWithWorld( INT32 iMapIndex, MAP_ELEMENT *pUndoMapElement ) pCurrentMapElement = &gpWorldLevelData[ iMapIndex ]; //Transfer the merc level node from the current world to the undo mapelement - //that will replace it. We do this, because mercs aren't associated with + //that will replace it. We do this, because mercs aren't associated with //undo commands. pUndoMapElement->pMercHead = gpWorldLevelData[ iMapIndex ].pMercHead; gpWorldLevelData[ iMapIndex ].pMercHead = NULL; - + //Swap the mapelements TempMapElement = *pCurrentMapElement; *pCurrentMapElement = *pUndoMapElement; @@ -986,8 +986,8 @@ void DetermineUndoState() // Reset the undo command mode if we released the left button. if( !fNewUndoCmd ) { - if( !gfLeftButtonState && !gfCurrentSelectionWithRightButton || - !gfRightButtonState && gfCurrentSelectionWithRightButton ) + if( !gfLeftButtonState && !gfCurrentSelectionWithRightButton || + !gfRightButtonState && gfCurrentSelectionWithRightButton ) { //Clear the mapindex binary tree list, and set up flag for new undo command. fNewUndoCmd = TRUE; @@ -997,4 +997,4 @@ void DetermineUndoState() } -#endif \ No newline at end of file +#endif diff --git a/Editor/EditorBuildings.cpp b/Editor/EditorBuildings.cpp index b5971a44..00994e2c 100644 --- a/Editor/EditorBuildings.cpp +++ b/Editor/EditorBuildings.cpp @@ -99,15 +99,15 @@ void UpdateBuildingsInfo() //1) if there isn't structure info here, return. //2) if there is structure info here, delete it now. //3) KillBuilding at x-1, y. -//4) KillBuilding at x , y-1. +//4) KillBuilding at x , y-1. //5) KillBuilding at x+1, y. -//6) KillBuilding at x , y+1. +//6) KillBuilding at x , y+1. void KillBuilding( UINT32 iMapIndex ) { BOOLEAN fFound = FALSE; if( !gfBasement ) - fFound |= RemoveAllRoofsOfTypeRange( iMapIndex, FIRSTTEXTURE, LASTITEM ); + fFound |= RemoveAllRoofsOfTypeRange( iMapIndex, FIRSTTEXTURE, LASTITEM ); fFound |= RemoveAllLandsOfTypeRange( iMapIndex, FIRSTFLOOR, LASTFLOOR ); EraseBuilding( iMapIndex ); @@ -120,13 +120,13 @@ void KillBuilding( UINT32 iMapIndex ) return; } - if( GridNoOnVisibleWorldTile( (UINT16)( iMapIndex - WORLD_COLS ) ) ) + if( GridNoOnVisibleWorldTile( (INT16)( iMapIndex - WORLD_COLS ) ) ) KillBuilding( iMapIndex - WORLD_COLS ); - if( GridNoOnVisibleWorldTile( (UINT16)( iMapIndex + WORLD_COLS ) ) ) + if( GridNoOnVisibleWorldTile( (INT16)( iMapIndex + WORLD_COLS ) ) ) KillBuilding( iMapIndex + WORLD_COLS ); - if( GridNoOnVisibleWorldTile( (UINT16)( iMapIndex + 1 ) ) ) + if( GridNoOnVisibleWorldTile( (INT16)( iMapIndex + 1 ) ) ) KillBuilding( iMapIndex + 1 ); - if( GridNoOnVisibleWorldTile( (UINT16)( iMapIndex - 1 ) ) ) + if( GridNoOnVisibleWorldTile( (INT16)( iMapIndex - 1 ) ) ) KillBuilding( iMapIndex - 1 ); if( gfBasement ) @@ -149,7 +149,7 @@ void DeleteBuildingLayout() MemFree( curr ); } gpBuildingLayoutList = NULL; - gsBuildingLayoutAnchorGridNo = -1; + gsBuildingLayoutAnchorGridNo = -1; } void BuildLayout( INT32 iMapIndex, INT32 iOffset ) @@ -193,16 +193,16 @@ void BuildLayout( INT32 iMapIndex, INT32 iOffset ) BuildLayout( iMapIndex, WORLD_COLS ); } -//The first step is copying a building. After that, it either must be pasted or moved. +//The first step is copying a building. After that, it either must be pasted or moved. void CopyBuilding( INT32 iMapIndex ) { - AssertMsg( !gpBuildingLayoutList, "Error: Attempting to copy building multiple times." ); + AssertMsg( !gpBuildingLayoutList, "Error: Attempting to copy building multiple times." ); - //First step is to determine if we have a building in the area that we click. If not, do nothing. + //First step is to determine if we have a building in the area that we click. If not, do nothing. if( !BuildingAtGridNo( iMapIndex ) ) return; - //Okay, a building does exist here to some undetermined capacity. - //Allocate the basic structure, then calculate the layout. The head node is + //Okay, a building does exist here to some undetermined capacity. + //Allocate the basic structure, then calculate the layout. The head node is gpBuildingLayoutList = (BUILDINGLAYOUTNODE*)MemAlloc( sizeof( BUILDINGLAYOUTNODE ) ); Assert( gpBuildingLayoutList ); gpBuildingLayoutList->sGridNo = (INT16)iMapIndex; @@ -210,16 +210,16 @@ void CopyBuilding( INT32 iMapIndex ) //Set the anchor point for this building -- this is where the user clicked. gsBuildingLayoutAnchorGridNo = (INT16)iMapIndex; - - //Now, recursively expand out while adding unique gridnos to our list. The recursion will + + //Now, recursively expand out while adding unique gridnos to our list. The recursion will //terminate when complete. BuildLayout( iMapIndex, -WORLD_COLS ); BuildLayout( iMapIndex, -1 ); BuildLayout( iMapIndex, 1 ); BuildLayout( iMapIndex, WORLD_COLS ); - //We have our layout. Now depending on the mode, we will either move the building or - //copy it. The layout automatically gets deleted as soon as the user releases the mouse + //We have our layout. Now depending on the mode, we will either move the building or + //copy it. The layout automatically gets deleted as soon as the user releases the mouse //button. } @@ -295,7 +295,7 @@ void PasteMapElementToNewMapElement( INT32 iSrcGridNo, INT32 iDstGridNo ) MAP_ELEMENT *pSrcMapElement; LEVELNODE *pNode; UINT16 usType; - + DeleteStuffFromMapTile( iDstGridNo ); DeleteAllLandLayers( iDstGridNo ); @@ -512,23 +512,23 @@ void InitDoorEditing( INT32 iMapIndex ) DisableEditorTaskbar(); MSYS_DefineRegion( &DoorRegion, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGH-2, 0, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); iDoorButton[ DOOR_BACKGROUND ] = - CreateTextButton( 0, 0, 0, 0, BUTTON_USE_DEFAULT, iScreenWidthOffset + 200, iScreenHeightOffset + 130, 240, 100, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH - 1, + CreateTextButton( 0, 0, 0, 0, BUTTON_USE_DEFAULT, iScreenWidthOffset + 200, iScreenHeightOffset + 130, 240, 100, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH - 1, BUTTON_NO_CALLBACK, BUTTON_NO_CALLBACK ); DisableButton( iDoorButton[ DOOR_BACKGROUND ] ); SpecifyDisabledButtonStyle( iDoorButton[ DOOR_BACKGROUND ], DISABLED_STYLE_NONE ); iDoorButton[ DOOR_OKAY ] = CreateTextButton(L"Okay", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 330, iScreenHeightOffset + 195, 50, 30, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, + iScreenWidthOffset + 330, iScreenHeightOffset + 195, 50, 30, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, DoorOkayCallback ); iDoorButton[ DOOR_CANCEL ] = CreateTextButton(L"Cancel", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, - iScreenWidthOffset + 385, iScreenHeightOffset + 195, 50, 30, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, + iScreenWidthOffset + 385, iScreenHeightOffset + 195, 50, 30, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, DoorCancelCallback ); InitTextInputModeWithScheme( DEFAULT_SCHEME ); AddTextInputField( iScreenWidthOffset + 210, iScreenHeightOffset + 155, 25, 16, MSYS_PRIORITY_HIGH, L"0", 3, INPUTTYPE_NUMERICSTRICT ); AddTextInputField( iScreenWidthOffset + 210, iScreenHeightOffset + 175, 25, 16, MSYS_PRIORITY_HIGH, L"0", 2, INPUTTYPE_NUMERICSTRICT ); AddTextInputField( iScreenWidthOffset + 210, iScreenHeightOffset + 195, 25, 16, MSYS_PRIORITY_HIGH, L"0", 2, INPUTTYPE_NUMERICSTRICT ); - iDoorButton[ DOOR_LOCKED ] = + iDoorButton[ DOOR_LOCKED ] = CreateCheckBoxButton( iScreenWidthOffset + 210, iScreenHeightOffset + 215, "EDITOR//SmCheckbox.sti", MSYS_PRIORITY_HIGH, DoorToggleLockedCallback ); pDoor = FindDoorInfoAtGridNo( iDoorMapIndex ); @@ -569,20 +569,20 @@ void ExtractAndUpdateDoorInfo() num = min( max( GetNumericStrictValueFromField( 1 ), 0 ), 10 ); door.ubTrapID = (UINT8)num; SetInputFieldStringWithNumericStrictValue( 1, num ); - if( num ) + if( num ) fCursor = TRUE; num = min( max( GetNumericStrictValueFromField( 2 ), 0 ), 20 ); if( door.ubTrapID && !num ) - num = 1; //Can't have a trap without a traplevel! + num = 1; //Can't have a trap without a traplevel! door.ubTrapLevel = (UINT8)num; SetInputFieldStringWithNumericStrictValue( 2, num ); - if( num ) + if( num ) fCursor = TRUE; if( ButtonList[ iDoorButton[ DOOR_LOCKED ] ]->uiFlags & BUTTON_CLICKED_ON ) { - door.fLocked = TRUE; + door.fLocked = TRUE; } else { @@ -730,7 +730,7 @@ void SetupTextInputForBuildings() { CHAR16 str[4]; InitTextInputModeWithScheme( DEFAULT_SCHEME ); - AddUserInputField( NULL ); //just so we can use short cut keys while not typing. + AddUserInputField( NULL ); //just so we can use short cut keys while not typing. swprintf( str, L"%d", gubMaxRoomNumber ); AddTextInputField( iScreenWidthOffset + 410, 2 * iScreenHeightOffset + 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); } @@ -760,6 +760,7 @@ void ExtractAndUpdateBuildingInfo() - + + diff --git a/Editor/EditorBuildings.h b/Editor/EditorBuildings.h index abb0431c..e0a3c89b 100644 --- a/Editor/EditorBuildings.h +++ b/Editor/EditorBuildings.h @@ -33,7 +33,7 @@ typedef struct BUILDINGLAYOUTNODE extern BUILDINGLAYOUTNODE *gpBuildingLayoutList; extern INT16 gsBuildingLayoutAnchorGridNo; -//The first step is copying a building. After that, it either must be pasted or moved. +//The first step is copying a building. After that, it either must be pasted or moved. void CopyBuilding( INT32 iMapIndex ); void MoveBuilding( INT32 iMapIndex ); void PasteBuilding( INT32 iMapIndex ); diff --git a/Editor/EditorDefines.h b/Editor/EditorDefines.h index 4ff42e5e..25310926 100644 --- a/Editor/EditorDefines.h +++ b/Editor/EditorDefines.h @@ -74,6 +74,7 @@ enum TBAR_MODE_ITEM_WEAPONS, TBAR_MODE_ITEM_AMMO, TBAR_MODE_ITEM_ARMOUR, + TBAR_MODE_ITEM_LBEGEAR, TBAR_MODE_ITEM_EXPLOSIVES, TBAR_MODE_ITEM_EQUIPMENT1, TBAR_MODE_ITEM_EQUIPMENT2, @@ -221,7 +222,7 @@ enum DRAW_MODE_SELECT_BRUSH = 200, DRAW_MODE_FILL_AREA, DRAW_MODE_UNDO, - DRAW_MODE_ERASE = 1000 + DRAW_MODE_ERASE = 1000 }; extern INT32 iEditorButton[NUMBER_EDITOR_BUTTONS]; @@ -244,7 +245,7 @@ extern BOOLEAN gfPendingBasement; extern BOOLEAN gfPendingCaves; //When in merc-inventory mode, this flag is set when the user wishes to get an item, which requires hooking -//into the item editing features. It is defined here, so editoritems can get access to this mode which makes +//into the item editing features. It is defined here, so editoritems can get access to this mode which makes //certain special cases. extern BOOLEAN gfMercGetItem; @@ -262,3 +263,5 @@ extern BOOLEAN gfShowItemStatsPanel; + + diff --git a/Editor/EditorItems.cpp b/Editor/EditorItems.cpp index b36e2b0e..a3d2d93d 100644 --- a/Editor/EditorItems.cpp +++ b/Editor/EditorItems.cpp @@ -49,21 +49,21 @@ extern ITEM_POOL *gpEditingItemPool; -//Simply counts the number of items in the world. This is used for display purposes. +//Simply counts the number of items in the world. This is used for display purposes. UINT16 CountNumberOfEditorPlacementsInWorld( UINT16 usEInfoIndex, UINT16 *pusQuantity ); //wrapper for the next three UINT16 CountNumberOfItemPlacementsInWorld( UINT16 usItem, UINT16 *pusQuantity ); UINT16 CountNumberOfItemsWithFrequency( UINT16 usItem, INT8 bFrequency ); UINT16 CountNumberOfPressureActionsInWorld(); UINT16 CountNumberOfKeysOfTypeInWorld( UINT8 ubKeyID ); -//Finds and selects the next item when right clicking on an item type. Only works if the +//Finds and selects the next item when right clicking on an item type. Only works if the //item actually exists in the world. void FindNextItemOfSelectedType(); //wrapper for the next four void SelectNextTriggerWithFrequency( UINT16 usItem, INT8 bFrequency ); void SelectNextItemOfType( UINT16 usItem ); void SelectNextPressureAction(); void SelectNextKeyOfType( UINT8 ubKeyID ); - + INT32 giDefaultExistChance = 100; typedef struct IPListNode @@ -85,7 +85,7 @@ void BuildItemPoolList() KillItemPoolList(); for( i = 0; i < WORLD_MAX; i++ ) { - if( GetItemPool( i, &temp , 0) ) + if( GetItemPoolFromGround( i, &temp ) ) { if( !pIPHead ) { @@ -151,7 +151,7 @@ void EntryInitEditorItemsInfo() eInfo.sNumTriggers = NUMBER_TRIGGERS; for( i=0; i < MAXITEMS; i++ ) { - if ( Item[i].usItemClass == 0 ) + if ( Item[i].usItemClass == 0 ) break; item = &Item[i]; //if( Item[i].fFlags & ITEM_NOT_EDITOR ) @@ -181,6 +181,9 @@ void EntryInitEditorItemsInfo() case IC_ARMOUR: eInfo.sNumArmour++; break; + case IC_LBEGEAR: + eInfo.sLBEGear++; + break; case IC_GRENADE: case IC_BOMB: eInfo.sNumExplosives++; @@ -188,11 +191,11 @@ void EntryInitEditorItemsInfo() case IC_MEDKIT: case IC_KIT: case IC_FACE: - case IC_MISC: case IC_MONEY: - if( eInfo.sNumEquipment1 < 30 ) - eInfo.sNumEquipment1++; - else if( eInfo.sNumEquipment2 < 30 ) + eInfo.sNumEquipment1++; + break; + case IC_MISC: + if( eInfo.sNumEquipment2 < eInfo.sNumEquipment3 ) eInfo.sNumEquipment2++; else eInfo.sNumEquipment3++; @@ -209,7 +212,7 @@ void EntryInitEditorItemsInfo() void InitEditorItemsInfo(UINT32 uiItemType) { VSURFACE_DESC vs_desc; - UINT8 *pDestBuf, *pSrcBuf; + UINT8 *pDestBuf, *pSrcBuf; UINT32 uiSrcPitchBYTES, uiDestPitchBYTES; INVTYPE *item; SGPRect SaveRect, NewRect; @@ -235,16 +238,16 @@ void InitEditorItemsInfo(UINT32 uiItemType) else { //User selected a different item classification -- delete it first. ClearEditorItemsInfo(); - ClearTaskbarRegion( iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 360, iScreenWidthOffset + 480, 2 * iScreenHeightOffset + 440 ); + ClearTaskbarRegion( iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 360, iScreenWidthOffset + 480, 2 * iScreenHeightOffset + 440 ); } } else { //Clear the menu area, so that the buffer doesn't get corrupted. - ClearTaskbarRegion( iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 360, iScreenWidthOffset + 480, 2 * iScreenHeightOffset + 440 ); + ClearTaskbarRegion( iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 360, iScreenWidthOffset + 480, 2 * iScreenHeightOffset + 440 ); } EnableEditorRegion( ITEM_REGION_ID ); - + eInfo.uiItemType = uiItemType; eInfo.fActive = TRUE; //Begin initialization of data. @@ -265,6 +268,11 @@ void InitEditorItemsInfo(UINT32 uiItemType) eInfo.sScrollIndex = eInfo.sSaveArmourScrollIndex; eInfo.sSelItemIndex = eInfo.sSaveSelArmourIndex; break; + case TBAR_MODE_ITEM_LBEGEAR: + eInfo.sNumItems = eInfo.sLBEGear; + eInfo.sScrollIndex = eInfo.sSaveLBEScrollIndex; + eInfo.sSelItemIndex = eInfo.sSaveSelLBEIndex; + break; case TBAR_MODE_ITEM_EXPLOSIVES: eInfo.sNumItems = eInfo.sNumExplosives; eInfo.sScrollIndex = eInfo.sSaveExplosivesScrollIndex; @@ -307,7 +315,7 @@ void InitEditorItemsInfo(UINT32 uiItemType) DetermineItemsScrolling(); //calculate the width of the buffer based on the number of items. //every pair of items (odd rounded up) requires 60 pixels for width. - //the minimum buffer size is 420. Height is always 80 pixels. + //the minimum buffer size is 420. Height is always 80 pixels. eInfo.sWidth = (eInfo.sNumItems > 12) ? ((eInfo.sNumItems+1)/2)*60 : SCREEN_HEIGHT - 120; eInfo.sHeight = 80; @@ -318,7 +326,7 @@ void InitEditorItemsInfo(UINT32 uiItemType) vs_desc.usHeight = eInfo.sHeight; vs_desc.ubBitDepth = ubBitDepth; - //!!!Memory check. Create the item buffer + //!!!Memory check. Create the item buffer if(!AddVideoSurface( &vs_desc, &eInfo.uiBuffer )) { eInfo.fKill = TRUE; @@ -332,10 +340,10 @@ void InitEditorItemsInfo(UINT32 uiItemType) //copy a blank chunk of the editor interface to the new buffer. for( i=0; ipETRLEObject[item->ubGraphicNum].usWidth; @@ -373,7 +381,7 @@ void InitEditorItemsInfo(UINT32 uiItemType) BltVideoObjectOutlineFromIndex( eInfo.uiBuffer, uiVideoObjectIndex, item->ubGraphicNum, sStart, y+2, 0, FALSE ); //cycle through the various slot positions (0,0), (0,40), (60,0), (60,40), (120,0)... - + if( y == 0 ) { y = 40; @@ -391,7 +399,7 @@ void InitEditorItemsInfo(UINT32 uiItemType) fTypeMatch = FALSE; while( usCounterpETRLEObject[item->ubGraphicNum].usWidth; @@ -618,7 +629,7 @@ void RenderEditorItemsInfo() item = &Item[eInfo.pusItemIndex[eInfo.sSelItemIndex]]; uiVideoObjectIndex = GetInterfaceGraphicForItem( item ); GetVideoObject( &hVObject, uiVideoObjectIndex ); - + x = iScreenWidthOffset + (eInfo.sSelItemIndex/2 - eInfo.sScrollIndex)*60 + 110; y = 2 * iScreenHeightOffset + 360 + (eInfo.sSelItemIndex % 2) * 40; sWidth = hVObject->pETRLEObject[item->ubGraphicNum].usWidth; @@ -683,6 +694,10 @@ void ClearEditorItemsInfo() eInfo.sSaveSelArmourIndex = eInfo.sSelItemIndex; eInfo.sSaveArmourScrollIndex = eInfo.sScrollIndex; break; + case TBAR_MODE_ITEM_LBEGEAR: + eInfo.sSaveSelLBEIndex = eInfo.sSelItemIndex; + eInfo.sSaveLBEScrollIndex = eInfo.sScrollIndex; + break; case TBAR_MODE_ITEM_EXPLOSIVES: eInfo.sSaveSelExplosivesIndex = eInfo.sSelItemIndex; eInfo.sSaveExplosivesScrollIndex = eInfo.sScrollIndex; @@ -708,7 +723,7 @@ void ClearEditorItemsInfo() eInfo.sSaveKeysScrollIndex = eInfo.sScrollIndex; break; } -} +} void HandleItemsPanel( UINT16 usScreenX, UINT16 usScreenY, INT8 bEvent ) { @@ -720,13 +735,13 @@ void HandleItemsPanel( UINT16 usScreenX, UINT16 usScreenY, INT8 bEvent ) if( usScreenY >= (2 * iScreenHeightOffset + 400) ) sIndex++; //Add the converted mouse's XPos into a relative index; - //Calc: starting from 110, for every 60 pixels, add 2 to the index - + //Calc: starting from 110, for every 60 pixels, add 2 to the index + sIndex += ((usScreenX-110-iScreenWidthOffset)/60) * 2; switch( bEvent ) { case GUI_MOVE_EVENT: - if( sIndex < eInfo.sNumItems ) + if( sIndex < eInfo.sNumItems ) { if( eInfo.sHilitedItemIndex != sIndex ) gfRenderTaskbar = TRUE; @@ -792,13 +807,13 @@ void HideItemCursor( INT32 iMapIndex ) BOOLEAN TriggerAtGridNo( INT16 sGridNo ) { ITEM_POOL *pItemPool; - if( !GetItemPool( sGridNo, &pItemPool, 0 ) ) + if( !GetItemPoolFromGround( sGridNo, &pItemPool ) ) { return FALSE; } while( pItemPool ) { - if( gWorldItems[ pItemPool->iItemIndex ].o.usItem == SWITCH ) + if( gWorldItems[ pItemPool->iItemIndex ].object.usItem == SWITCH ) { return TRUE; } @@ -810,7 +825,6 @@ BOOLEAN TriggerAtGridNo( INT16 sGridNo ) void AddSelectedItemToWorld( INT16 sGridNo ) { - OBJECTTYPE tempObject; OBJECTTYPE *pObject; INVTYPE *pItem; ITEM_POOL *pItemPool; @@ -823,17 +837,16 @@ void AddSelectedItemToWorld( INT16 sGridNo ) //Extract the currently selected item. SpecifyItemToEdit( NULL, -1 ); - //memset( &tempObject, 0, sizeof( OBJECTTYPE ) ); if( eInfo.uiItemType == TBAR_MODE_ITEM_KEYS ) { - CreateKeyObject( &tempObject, 1, (UINT8)eInfo.sSelItemIndex ); + CreateKeyObject( &gTempObject, 1, (UINT8)eInfo.sSelItemIndex ); } else { - CreateItem( eInfo.pusItemIndex[eInfo.sSelItemIndex], 100, &tempObject ); + CreateItem( eInfo.pusItemIndex[eInfo.sSelItemIndex], 100, &gTempObject ); } usFlags = 0; - switch( tempObject.usItem ) + switch( gTempObject.usItem ) { case MINE: if ( bVisibility == BURIED ) @@ -844,11 +857,11 @@ void AddSelectedItemToWorld( INT16 sGridNo ) case MONEY: case SILVER: case GOLD: - tempObject.ItemData.Money.bMoneyStatus = 100; - tempObject.ItemData.Money.uiMoneyAmount = 100 + Random( 19901 ); + gTempObject[0]->data.objectStatus = 100; + gTempObject[0]->data.money.uiMoneyAmount = 100 + Random( 19901 ); break; case OWNERSHIP: - tempObject.ItemData.Owner.ubOwnerProfile = NO_PROFILE; + gTempObject[0]->data.owner.ubOwnerProfile = NO_PROFILE; bVisibility = BURIED; break; case SWITCH: @@ -857,42 +870,42 @@ void AddSelectedItemToWorld( INT16 sGridNo ) return; } bVisibility = BURIED; - tempObject.ItemData.Trigger.bBombStatus = 100; - tempObject.ItemData.Trigger.ubBombOwner = 1; + gTempObject[0]->data.objectStatus = 100; + gTempObject[0]->data.misc.ubBombOwner = 1; if( eInfo.sSelItemIndex < 2 ) - tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY; + gTempObject[0]->data.misc.bFrequency = PANIC_FREQUENCY; else if( eInfo.sSelItemIndex < 4 ) - tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY_2; + gTempObject[0]->data.misc.bFrequency = PANIC_FREQUENCY_2; else if( eInfo.sSelItemIndex < 6 ) - tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY_3; + gTempObject[0]->data.misc.bFrequency = PANIC_FREQUENCY_3; else - tempObject.ItemData.Trigger.BombTrigger.bFrequency = (INT8)(FIRST_MAP_PLACED_FREQUENCY + (eInfo.sSelItemIndex-4) / 2); + gTempObject[0]->data.misc.bFrequency = (INT8)(FIRST_MAP_PLACED_FREQUENCY + (eInfo.sSelItemIndex-4) / 2); usFlags |= WORLD_ITEM_ARMED_BOMB; break; case ACTION_ITEM: bVisibility = BURIED; - tempObject.ItemData.Trigger.bBombStatus = 100; - tempObject.ItemData.Trigger.ubBombOwner = 1; - tempObject.bTrap = gbDefaultBombTrapLevel; + gTempObject[0]->data.objectStatus = 100; + gTempObject[0]->data.misc.ubBombOwner = 1; + gTempObject[0]->data.bTrap = gbDefaultBombTrapLevel; if( eInfo.sSelItemIndex < PRESSURE_ACTION_ID ) { - tempObject.ItemData.Trigger.bDetonatorType = BOMB_REMOTE; + gTempObject[0]->data.misc.bDetonatorType = BOMB_REMOTE; if( eInfo.sSelItemIndex < 2 ) - tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY; + gTempObject[0]->data.misc.bFrequency = PANIC_FREQUENCY; else if( eInfo.sSelItemIndex < 4 ) - tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY_2; + gTempObject[0]->data.misc.bFrequency = PANIC_FREQUENCY_2; else if( eInfo.sSelItemIndex < 6 ) - tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY_3; + gTempObject[0]->data.misc.bFrequency = PANIC_FREQUENCY_3; else - tempObject.ItemData.Trigger.BombTrigger.bFrequency = (INT8)(FIRST_MAP_PLACED_FREQUENCY + (eInfo.sSelItemIndex-4) / 2); + gTempObject[0]->data.misc.bFrequency = (INT8)(FIRST_MAP_PLACED_FREQUENCY + (eInfo.sSelItemIndex-4) / 2); } else { - tempObject.ItemData.Trigger.bDetonatorType = BOMB_PRESSURE; - tempObject.ItemData.Trigger.BombTrigger.bDelay = 0; + gTempObject[0]->data.misc.bDetonatorType = BOMB_PRESSURE; + gTempObject[0]->data.misc.bDelay = 0; } - ChangeActionItem( &tempObject, gbActionItemIndex ); - tempObject.fFlags |= OBJECT_ARMED_BOMB; + ChangeActionItem( &gTempObject, gbActionItemIndex ); + gTempObject.fFlags |= OBJECT_ARMED_BOMB; if( gbActionItemIndex == ACTIONITEM_SMPIT ) Add3X3Pit( sGridNo ); else if( gbActionItemIndex == ACTIONITEM_LGPIT ) @@ -901,8 +914,8 @@ void AddSelectedItemToWorld( INT16 sGridNo ) break; } - pObject = InternalAddItemToPool( &sGridNo, &tempObject, bVisibility, 0, usFlags, 0, &iItemIndex ); - if( tempObject.usItem != OWNERSHIP ) + pObject = InternalAddItemToPool( &sGridNo, &gTempObject, bVisibility, 0, usFlags, 0, -1, &iItemIndex ); + if( gTempObject.usItem != OWNERSHIP ) { gWorldItems[ iItemIndex ].ubNonExistChance = (UINT8)(100 - giDefaultExistChance); } @@ -910,40 +923,40 @@ void AddSelectedItemToWorld( INT16 sGridNo ) { gWorldItems[ iItemIndex ].ubNonExistChance = 0; } - + pItem = &( Item[ pObject->usItem ] ); if( pItem->usItemClass == IC_AMMO ) { if (Random( 2 )) { - pObject->ItemData.Ammo.ubShotsLeft[0] = Magazine[ pItem->ubClassIndex ].ubMagSize; + (*pObject)[0]->data.ubShotsLeft = Magazine[ pItem->ubClassIndex ].ubMagSize; } else { - pObject->ItemData.Ammo.ubShotsLeft[0] = (UINT8) Random( Magazine[ pItem->ubClassIndex ].ubMagSize ); + (*pObject)[0]->data.ubShotsLeft = (UINT8) Random( Magazine[ pItem->ubClassIndex ].ubMagSize ); } } else { - pObject->ItemData.Generic.bStatus[0] = (INT8)(70 + Random( 26 )); + (*pObject)[0]->data.objectStatus = (INT8)(70 + Random( 26 )); } if( pItem->usItemClass & IC_GUN ) { if ( pObject->usItem == ROCKET_LAUNCHER ) { - pObject->ItemData.Gun.ubGunShotsLeft = 1; + (*pObject)[0]->data.gun.ubGunShotsLeft = 1; } else { - pObject->ItemData.Gun.ubGunShotsLeft = (UINT8)(Random( Weapon[ pObject->usItem ].ubMagSize )); + (*pObject)[0]->data.gun.ubGunShotsLeft = (UINT8)(Random( Weapon[ pObject->usItem ].ubMagSize )); } } - if( !GetItemPool( sGridNo, &pItemPool, 0 ) ) + if( !GetItemPoolFromGround( sGridNo, &pItemPool ) ) Assert( 0 ); while( pItemPool ) { - if( &(gWorldItems[ pItemPool->iItemIndex ].o) == pObject ) + if( &(gWorldItems[ pItemPool->iItemIndex ].object) == pObject ) { fFound = TRUE; //ShowSelectedItem(); @@ -952,14 +965,14 @@ void AddSelectedItemToWorld( INT16 sGridNo ) pItemPool = pItemPool->pNext; } Assert( fFound ); - + gpItemPool = pItemPool; SpecifyItemToEdit( pObject, sGridNo ); //Get access to the itempool. //search for a current node in list containing same mapindex - pIPCurr = pIPHead; + pIPCurr = pIPHead; pIPPrev = NULL; while( pIPCurr ) { @@ -999,18 +1012,18 @@ void HandleRightClickOnItem( INT16 sGridNo ) IPListNode *pIPCurr; if( gsItemGridNo == sGridNo ) - { //Clicked on the same gridno as the selected item. Automatically select the next + { //Clicked on the same gridno as the selected item. Automatically select the next //item in the same pool. pItemPool = gpItemPool->pNext; if( !pItemPool ) { //currently selected item was last node, so select the head node even if it is the same. - GetItemPool( sGridNo, &pItemPool, 0 ); + GetItemPoolFromGround( sGridNo, &pItemPool ); } } - else if( !GetItemPool( sGridNo, &pItemPool, 0 ) ) + else if( !GetItemPoolFromGround( sGridNo, &pItemPool ) ) { //possibly relocate selected item to this gridno? - return; + return; } gpItemPool = pItemPool; @@ -1028,7 +1041,7 @@ void HandleRightClickOnItem( INT16 sGridNo ) pIPCurr = pIPCurr->next; } Assert( gpCurrItemPoolNode ); - SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].o, gpItemPool->sGridNo ); + SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].object, gpItemPool->sGridNo ); } extern void DeleteSelectedMercsItem(); @@ -1048,15 +1061,15 @@ void DeleteSelectedItem() //save the mapindex if( gpItemPool->pNext ) { - SpecifyItemToEdit( &gWorldItems[ gpItemPool->pNext->iItemIndex ].o, gpItemPool->sGridNo ); + SpecifyItemToEdit( &gWorldItems[ gpItemPool->pNext->iItemIndex ].object, gpItemPool->sGridNo ); } sGridNo = gpItemPool->sGridNo; //remove the item - if( gWorldItems[ gpItemPool->iItemIndex ].o.usItem == ACTION_ITEM ) + if( gWorldItems[ gpItemPool->iItemIndex ].object.usItem == ACTION_ITEM ) { - if( gWorldItems[ gpItemPool->iItemIndex ].o.ItemData.Trigger.bActionValue == ACTION_ITEM_SMALL_PIT ) + if( gWorldItems[ gpItemPool->iItemIndex ].object[0]->data.misc.bActionValue == ACTION_ITEM_SMALL_PIT ) Remove3X3Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); - else if( gWorldItems[ gpItemPool->iItemIndex ].o.ItemData.Trigger.bActionValue == ACTION_ITEM_LARGE_PIT ) + else if( gWorldItems[ gpItemPool->iItemIndex ].object[0]->data.misc.bActionValue == ACTION_ITEM_LARGE_PIT ) Remove5X5Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); } if( gpEditingItemPool == gpItemPool ) @@ -1064,7 +1077,7 @@ void DeleteSelectedItem() RemoveItemFromPool( sGridNo, gpItemPool->iItemIndex, 0 ); gpItemPool = NULL; //determine if there are still any items at this location - if( !GetItemPool( sGridNo, &gpItemPool , 0 ) ) + if( !GetItemPoolFromGround( sGridNo, &gpItemPool ) ) { //no items left, so remove the node from the list. IPListNode *pIPPrev, *pIPCurr; pIPCurr = pIPHead; @@ -1072,7 +1085,7 @@ void DeleteSelectedItem() while( pIPCurr ) { if( pIPCurr->sGridNo == sGridNo ) - { + { if( pIPPrev ) //middle of list pIPPrev->next = pIPCurr->next; else //head of list @@ -1084,7 +1097,7 @@ void DeleteSelectedItem() gpCurrItemPoolNode = pIPHead; if( gpCurrItemPoolNode ) { - GetItemPool( gpCurrItemPoolNode->sGridNo, &gpItemPool, 0 ); + GetItemPoolFromGround( gpCurrItemPoolNode->sGridNo, &gpItemPool ); Assert( gpItemPool ); } //remove node @@ -1103,7 +1116,7 @@ void DeleteSelectedItem() void ShowSelectedItem() { if( gpItemPool ) - { + { gpItemPool->bVisible = INVISIBLE; gWorldItems[ gpItemPool->iItemIndex ].bVisible = INVISIBLE; } @@ -1127,16 +1140,16 @@ void SelectNextItemPool() { MarkMapIndexDirty( gpItemPool->sGridNo ); } - - //go to the next node. If at end of list, choose pIPHead + + //go to the next node. If at end of list, choose pIPHead if( gpCurrItemPoolNode->next ) gpCurrItemPoolNode = gpCurrItemPoolNode->next; - else + else gpCurrItemPoolNode = pIPHead; //get the item pool at this node's gridno. - GetItemPool( gpCurrItemPoolNode->sGridNo, &gpItemPool, 0 ); + GetItemPoolFromGround( gpCurrItemPoolNode->sGridNo, &gpItemPool ); MarkMapIndexDirty( gpItemPool->sGridNo ); - SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].o, gpItemPool->sGridNo ); + SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].object, gpItemPool->sGridNo ); if( gsItemGridNo != -1 ) { CenterScreenAtMapIndex( gsItemGridNo ); @@ -1153,9 +1166,9 @@ void SelectNextItemInPool() } else { - GetItemPool( gpItemPool->sGridNo, &gpItemPool, 0 ); + GetItemPoolFromGround( gpItemPool->sGridNo, &gpItemPool ); } - SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].o, gpItemPool->sGridNo ); + SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].object, gpItemPool->sGridNo ); MarkWorldDirty(); } } @@ -1170,13 +1183,13 @@ void SelectPrevItemInPool() } else { - GetItemPool( gpItemPool->sGridNo, &gpItemPool, 0 ); + GetItemPoolFromGround( gpItemPool->sGridNo, &gpItemPool ); while( gpItemPool->pNext ) { gpItemPool = gpItemPool->pNext; } } - SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].o, gpItemPool->sGridNo ); + SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].object, gpItemPool->sGridNo ); MarkWorldDirty(); } } @@ -1189,7 +1202,7 @@ void FindNextItemOfSelectedType() if( usItem == ACTION_ITEM || usItem == SWITCH ) { if( eInfo.sSelItemIndex < PRESSURE_ACTION_ID ) - { + { INT8 bFrequency; if( eInfo.sSelItemIndex < 2 ) bFrequency = PANIC_FREQUENCY; @@ -1202,7 +1215,7 @@ void FindNextItemOfSelectedType() SelectNextTriggerWithFrequency( usItem, bFrequency ); } else - { + { SelectNextPressureAction(); } } @@ -1230,7 +1243,7 @@ void SelectNextItemOfType( UINT16 usItem ) gpItemPool = gpItemPool->pNext; while( gpItemPool ) { - pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; + pObject = &gWorldItems[ gpItemPool->iItemIndex ].object; if( pObject->usItem == usItem ) { SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); @@ -1246,10 +1259,10 @@ void SelectNextItemOfType( UINT16 usItem ) } while( curr ) { //search to the end of the list - GetItemPool( curr->sGridNo, &gpItemPool, 0 ); + GetItemPoolFromGround( curr->sGridNo, &gpItemPool ); while( gpItemPool ) { - pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; + pObject = &gWorldItems[ gpItemPool->iItemIndex ].object; if( pObject->usItem == usItem ) { SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); @@ -1264,10 +1277,10 @@ void SelectNextItemOfType( UINT16 usItem ) curr = pIPHead; while( curr ) { //search to the end of the list - GetItemPool( curr->sGridNo, &gpItemPool, 0 ); + GetItemPoolFromGround( curr->sGridNo, &gpItemPool ); while( gpItemPool ) { - pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; + pObject = &gWorldItems[ gpItemPool->iItemIndex ].object; if( pObject->usItem == usItem ) { SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); @@ -1294,8 +1307,8 @@ void SelectNextKeyOfType( UINT8 ubKeyID ) gpItemPool = gpItemPool->pNext; while( gpItemPool ) { - pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; - if( Item[ pObject->usItem ].usItemClass == IC_KEY && pObject->ItemData.Key.ubKeyID == ubKeyID ) + pObject = &gWorldItems[ gpItemPool->iItemIndex ].object; + if( Item[ pObject->usItem ].usItemClass == IC_KEY && (*pObject)[0]->data.key.ubKeyID == ubKeyID ) { SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); CenterScreenAtMapIndex( gsItemGridNo ); @@ -1310,11 +1323,11 @@ void SelectNextKeyOfType( UINT8 ubKeyID ) } while( curr ) { //search to the end of the list - GetItemPool( curr->sGridNo, &gpItemPool, 0 ); + GetItemPoolFromGround( curr->sGridNo, &gpItemPool ); while( gpItemPool ) { - pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; - if( Item[ pObject->usItem ].usItemClass == IC_KEY && pObject->ItemData.Key.ubKeyID == ubKeyID ) + pObject = &gWorldItems[ gpItemPool->iItemIndex ].object; + if( Item[ pObject->usItem ].usItemClass == IC_KEY && (*pObject)[0]->data.key.ubKeyID == ubKeyID ) { SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); CenterScreenAtMapIndex( gsItemGridNo ); @@ -1328,11 +1341,11 @@ void SelectNextKeyOfType( UINT8 ubKeyID ) curr = pIPHead; while( curr ) { //search to the end of the list - GetItemPool( curr->sGridNo, &gpItemPool, 0 ); + GetItemPoolFromGround( curr->sGridNo, &gpItemPool ); while( gpItemPool ) { - pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; - if( Item[ pObject->usItem ].usItemClass == IC_KEY && pObject->ItemData.Key.ubKeyID == ubKeyID ) + pObject = &gWorldItems[ gpItemPool->iItemIndex ].object; + if( Item[ pObject->usItem ].usItemClass == IC_KEY && (*pObject)[0]->data.key.ubKeyID == ubKeyID ) { SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); CenterScreenAtMapIndex( gsItemGridNo ); @@ -1358,8 +1371,8 @@ void SelectNextTriggerWithFrequency( UINT16 usItem, INT8 bFrequency ) gpItemPool = gpItemPool->pNext; while( gpItemPool ) { - pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; - if( pObject->usItem == usItem && pObject->ItemData.Trigger.BombTrigger.bFrequency == bFrequency ) + pObject = &gWorldItems[ gpItemPool->iItemIndex ].object; + if( pObject->usItem == usItem && (*pObject)[0]->data.misc.bFrequency == bFrequency ) { SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); CenterScreenAtMapIndex( gsItemGridNo ); @@ -1374,11 +1387,11 @@ void SelectNextTriggerWithFrequency( UINT16 usItem, INT8 bFrequency ) } while( curr ) { //search to the end of the list - GetItemPool( curr->sGridNo, &gpItemPool, 0 ); + GetItemPoolFromGround( curr->sGridNo, &gpItemPool ); while( gpItemPool ) { - pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; - if( pObject->usItem == usItem && pObject->ItemData.Trigger.BombTrigger.bFrequency == bFrequency ) + pObject = &gWorldItems[ gpItemPool->iItemIndex ].object; + if( pObject->usItem == usItem && (*pObject)[0]->data.misc.bFrequency == bFrequency ) { SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); CenterScreenAtMapIndex( gsItemGridNo ); @@ -1392,11 +1405,11 @@ void SelectNextTriggerWithFrequency( UINT16 usItem, INT8 bFrequency ) curr = pIPHead; while( curr ) { //search to the end of the list - GetItemPool( curr->sGridNo, &gpItemPool, 0 ); + GetItemPoolFromGround( curr->sGridNo, &gpItemPool ); while( gpItemPool ) { - pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; - if( pObject->usItem == usItem && pObject->ItemData.Trigger.BombTrigger.bFrequency == bFrequency ) + pObject = &gWorldItems[ gpItemPool->iItemIndex ].object; + if( pObject->usItem == usItem && (*pObject)[0]->data.misc.bFrequency == bFrequency ) { SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); CenterScreenAtMapIndex( gsItemGridNo ); @@ -1422,8 +1435,8 @@ void SelectNextPressureAction() gpItemPool = gpItemPool->pNext; while( gpItemPool ) { - pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; - if( pObject->usItem == ACTION_ITEM && pObject->ItemData.Trigger.bDetonatorType == BOMB_PRESSURE ) + pObject = &gWorldItems[ gpItemPool->iItemIndex ].object; + if( pObject->usItem == ACTION_ITEM && (*pObject)[0]->data.misc.bDetonatorType == BOMB_PRESSURE ) { SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); CenterScreenAtMapIndex( gsItemGridNo ); @@ -1438,11 +1451,11 @@ void SelectNextPressureAction() } while( curr ) { //search to the end of the list - GetItemPool( curr->sGridNo, &gpItemPool, 0 ); + GetItemPoolFromGround( curr->sGridNo, &gpItemPool ); while( gpItemPool ) { - pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; - if( pObject->usItem == ACTION_ITEM && pObject->ItemData.Trigger.bDetonatorType == BOMB_PRESSURE ) + pObject = &gWorldItems[ gpItemPool->iItemIndex ].object; + if( pObject->usItem == ACTION_ITEM && (*pObject)[0]->data.misc.bDetonatorType == BOMB_PRESSURE ) { SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); CenterScreenAtMapIndex( gsItemGridNo ); @@ -1456,11 +1469,11 @@ void SelectNextPressureAction() curr = pIPHead; while( curr ) { //search to the end of the list - GetItemPool( curr->sGridNo, &gpItemPool, 0 ); + GetItemPoolFromGround( curr->sGridNo, &gpItemPool ); while( gpItemPool ) { - pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; - if( pObject->usItem == ACTION_ITEM && pObject->ItemData.Trigger.bDetonatorType == BOMB_PRESSURE ) + pObject = &gWorldItems[ gpItemPool->iItemIndex ].object; + if( pObject->usItem == ACTION_ITEM && (*pObject)[0]->data.misc.bDetonatorType == BOMB_PRESSURE ) { SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); CenterScreenAtMapIndex( gsItemGridNo ); @@ -1481,13 +1494,13 @@ UINT16 CountNumberOfItemPlacementsInWorld( UINT16 usItem, UINT16 *pusQuantity ) pIPCurr = pIPHead; while( pIPCurr ) { - GetItemPool( pIPCurr->sGridNo, &pItemPool, 0 ); + GetItemPoolFromGround( pIPCurr->sGridNo, &pItemPool ); while( pItemPool ) { - if( gWorldItems[ pItemPool->iItemIndex ].o.usItem == usItem ) + if( gWorldItems[ pItemPool->iItemIndex ].object.usItem == usItem ) { num++; - *pusQuantity += gWorldItems[ pItemPool->iItemIndex ].o.ubNumberOfObjects; + *pusQuantity += gWorldItems[ pItemPool->iItemIndex ].object.ubNumberOfObjects; } pItemPool = pItemPool->pNext; } @@ -1504,11 +1517,11 @@ UINT16 CountNumberOfItemsWithFrequency( UINT16 usItem, INT8 bFrequency ) pIPCurr = pIPHead; while( pIPCurr ) { - GetItemPool( pIPCurr->sGridNo, &pItemPool, 0 ); + GetItemPoolFromGround( pIPCurr->sGridNo, &pItemPool ); while( pItemPool ) { - if( gWorldItems[ pItemPool->iItemIndex ].o.usItem == usItem && - gWorldItems[ pItemPool->iItemIndex ].o.ItemData.Trigger.BombTrigger.bFrequency == bFrequency ) + if( gWorldItems[ pItemPool->iItemIndex ].object.usItem == usItem && + gWorldItems[ pItemPool->iItemIndex ].object[0]->data.misc.bFrequency == bFrequency ) { num++; } @@ -1527,11 +1540,11 @@ UINT16 CountNumberOfPressureActionsInWorld() pIPCurr = pIPHead; while( pIPCurr ) { - GetItemPool( pIPCurr->sGridNo, &pItemPool, 0 ); + GetItemPoolFromGround( pIPCurr->sGridNo, &pItemPool ); while( pItemPool ) { - if( gWorldItems[ pItemPool->iItemIndex ].o.usItem == ACTION_ITEM && - gWorldItems[ pItemPool->iItemIndex ].o.ItemData.Trigger.bDetonatorType == BOMB_PRESSURE ) + if( gWorldItems[ pItemPool->iItemIndex ].object.usItem == ACTION_ITEM && + gWorldItems[ pItemPool->iItemIndex ].object[0]->data.misc.bDetonatorType == BOMB_PRESSURE ) { num++; } @@ -1546,7 +1559,7 @@ UINT16 CountNumberOfEditorPlacementsInWorld( UINT16 usEInfoIndex, UINT16 *pusQua { UINT16 usNumPlacements; if( eInfo.uiItemType == TBAR_MODE_ITEM_TRIGGERS ) - { //find identical items with same frequency + { //find identical items with same frequency INT8 bFrequency; if( usEInfoIndex < PRESSURE_ACTION_ID ) { @@ -1573,7 +1586,7 @@ UINT16 CountNumberOfEditorPlacementsInWorld( UINT16 usEInfoIndex, UINT16 *pusQua *pusQuantity = usNumPlacements; } else - { + { usNumPlacements = CountNumberOfItemPlacementsInWorld( eInfo.pusItemIndex[ usEInfoIndex], pusQuantity ); } return usNumPlacements; @@ -1587,12 +1600,12 @@ UINT16 CountNumberOfKeysOfTypeInWorld( UINT8 ubKeyID ) pIPCurr = pIPHead; while( pIPCurr ) { - GetItemPool( pIPCurr->sGridNo, &pItemPool, 0 ); + GetItemPoolFromGround( pIPCurr->sGridNo, &pItemPool ); while( pItemPool ) { - if( Item[ gWorldItems[ pItemPool->iItemIndex ].o.usItem ].usItemClass == IC_KEY ) + if( Item[ gWorldItems[ pItemPool->iItemIndex ].object.usItem ].usItemClass == IC_KEY ) { - if( gWorldItems[ pItemPool->iItemIndex ].o.ItemData.Key.ubKeyID == ubKeyID ) + if( gWorldItems[ pItemPool->iItemIndex ].object[0]->data.key.ubKeyID == ubKeyID ) { num++; } @@ -1610,15 +1623,15 @@ void DisplayItemStatistics() INT16 usItemIndex; CHAR16 pItemName[SIZE_ITEM_NAME]; INVTYPE *pItem; - + if( !eInfo.fActive ) { return; } - + //If there is nothing else currently highlited by the mouse, use the selected item. fUseSelectedItem = eInfo.sHilitedItemIndex == -1 || eInfo.sHilitedItemIndex == eInfo.sSelItemIndex; - + SetFont( SMALLCOMPFONT ); SetFontForeground( (UINT8)(fUseSelectedItem ? FONT_LTRED : FONT_YELLOW) ); @@ -1643,6 +1656,8 @@ void DisplayItemStatistics() - + + + diff --git a/Editor/EditorItems.h b/Editor/EditorItems.h index 84aa30e8..2c78efd9 100644 --- a/Editor/EditorItems.h +++ b/Editor/EditorItems.h @@ -12,18 +12,19 @@ typedef struct{ UINT16 *pusItemIndex; //a dynamic array of Item indices UINT32 uiBuffer; //index of buffer UINT32 uiItemType; //Weapons, ammo, armour, explosives, equipment - INT16 sWidth, sHeight; //width and height of buffer - INT16 sNumItems; //total number of items in the current class of item. + INT32 sWidth, sHeight; //width and height of buffer + //Kaiden: was previously INT16 - Fix for number of items capped by class + INT16 sNumItems; //total number of items in the current class of item. INT16 sSelItemIndex; //currently selected item index. - INT16 sHilitedItemIndex; - INT16 sScrollIndex; //current scroll index (0 is far left, 1 is next tile to the right, ...) - INT16 sSaveSelWeaponsIndex, sSaveSelAmmoIndex, sSaveSelArmourIndex, sSaveSelExplosivesIndex, + INT16 sHilitedItemIndex; + INT16 sScrollIndex; //current scroll index (0 is far left, 1 is next tile to the right, ...) + INT16 sSaveSelWeaponsIndex, sSaveSelAmmoIndex, sSaveSelArmourIndex, sSaveSelLBEIndex, sSaveSelExplosivesIndex, sSaveSelEquipment1Index, sSaveSelEquipment2Index, sSaveSelEquipment3Index, sSaveSelTriggersIndex, sSaveSelKeysIndex; - INT16 sSaveWeaponsScrollIndex, sSaveAmmoScrollIndex, sSaveArmourScrollIndex, sSaveExplosivesScrollIndex, - sSaveEquipment1ScrollIndex, sSaveEquipment2ScrollIndex, sSaveEquipment3ScrollIndex, - sSaveTriggersScrollIndex, sSaveKeysScrollIndex; - INT16 sNumWeapons, sNumAmmo, sNumArmour, sNumExplosives, sNumEquipment1, sNumEquipment2, sNumEquipment3, + INT16 sSaveWeaponsScrollIndex, sSaveAmmoScrollIndex, sSaveArmourScrollIndex, sSaveLBEScrollIndex, + sSaveExplosivesScrollIndex, sSaveEquipment1ScrollIndex, sSaveEquipment2ScrollIndex, + sSaveEquipment3ScrollIndex, sSaveTriggersScrollIndex, sSaveKeysScrollIndex; + INT16 sNumWeapons, sNumAmmo, sNumArmour, sLBEGear, sNumExplosives, sNumEquipment1, sNumEquipment2, sNumEquipment3, sNumTriggers, sNumKeys; }EditorItemsInfo; @@ -67,3 +68,5 @@ extern INT32 giDefaultExistChance; + + diff --git a/Editor/EditorMapInfo.cpp b/Editor/EditorMapInfo.cpp index bbacbe2d..b0a3db91 100644 --- a/Editor/EditorMapInfo.cpp +++ b/Editor/EditorMapInfo.cpp @@ -42,7 +42,6 @@ #include "Soldier Init List.h" #include "strategicmap.h" #include "Soldier Add.h" - #include "Soldier Control.h" #include "Soldier Profile Type.h" #include "Soldier Profile.h" #include "Text Input.h" @@ -59,6 +58,10 @@ #include "Simple Render Utils.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + INT8 gbDefaultLightType = PRIMETIME_LIGHT; SGPPaletteEntry gEditorLightColor; @@ -68,10 +71,10 @@ BOOLEAN gfEditorForceShadeTableRebuild = FALSE; void SetupTextInputForMapInfo() { CHAR16 str[10]; - + InitTextInputModeWithScheme( DEFAULT_SCHEME ); - AddUserInputField( NULL ); //just so we can use short cut keys while not typing. + AddUserInputField( NULL ); //just so we can use short cut keys while not typing. //light rgb fields swprintf( str, L"%d", gEditorLightColor.peRed ); @@ -98,7 +101,7 @@ void SetupTextInputForMapInfo() AddTextInputField( iScreenWidthOffset + 338, 2 * iScreenHeightOffset + 363, 30, 18, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_EXCLUSIVE_COORDINATE ); swprintf( str, L"%d", gExitGrid.ubGotoSectorZ ); AddTextInputField( iScreenWidthOffset + 338, 2 * iScreenHeightOffset + 383, 30, 18, MSYS_PRIORITY_NORMAL, str, 1, INPUTTYPE_NUMERICSTRICT ); - swprintf( str, L"%d", gExitGrid.usGridNo ); + swprintf( str, L"%d", gExitGrid.sGridNo ); AddTextInputField( iScreenWidthOffset + 338, 2 * iScreenHeightOffset + 403, 40, 18, MSYS_PRIORITY_NORMAL, str, 5, INPUTTYPE_NUMERICSTRICT ); } @@ -222,13 +225,13 @@ void ExtractAndUpdateMapInfo() gMapInformation.ubRestrictedScrollID = 0; else gMapInformation.ubRestrictedScrollID = (UINT8)temp; - - //set up fields for exitgrid information + + //set up fields for exitgrid information Get16BitStringFromField( 7, str ); if( str[0] >= 'a' && str[0] <= 'z' ) str[0] -= 32; //uppercase it! - if( str[0] >= 'A' && str[0] <= 'Z' && - str[1] >= '0' && str[1] <= '9' ) + if( str[0] >= 'A' && str[0] <= 'Z' && + str[1] >= '0' && str[1] <= '9' ) { //only update, if coordinate is valid. gExitGrid.ubGotoSectorY = (UINT8)(str[0] - 'A' + 1); gExitGrid.ubGotoSectorX = (UINT8)(str[1] - '0'); @@ -237,8 +240,8 @@ void ExtractAndUpdateMapInfo() gExitGrid.ubGotoSectorX = (UINT8)max( min( gExitGrid.ubGotoSectorX, 16 ), 1 ); gExitGrid.ubGotoSectorY = (UINT8)max( min( gExitGrid.ubGotoSectorY, 16 ), 1 ); } - gExitGrid.ubGotoSectorZ = (UINT8)max( min( GetNumericStrictValueFromField( 8 ), 3 ), 0 ); - gExitGrid.usGridNo = (UINT16)max( min( GetNumericStrictValueFromField( 9 ), 25600 ), 0 ); + gExitGrid.ubGotoSectorZ = (UINT8)max( min( GetNumericStrictValueFromField( 8 ), 3 ), 0 ); + gExitGrid.sGridNo = (INT16)max( min( GetNumericStrictValueFromField( 9 ), 25600 ), 0 ); UpdateMapInfoFields(); } @@ -253,13 +256,13 @@ BOOLEAN ApplyNewExitGridValuesToTextFields() SetInputFieldStringWith16BitString( 7, str ); swprintf( str, L"%d", gExitGrid.ubGotoSectorZ ); SetInputFieldStringWith16BitString( 8, str ); - swprintf( str, L"%d", gExitGrid.usGridNo ); + swprintf( str, L"%d", gExitGrid.sGridNo ); SetInputFieldStringWith16BitString( 9, str ); SetActiveField( 0 ); return TRUE; } -UINT16 usCurrentExitGridNo = 0; +INT16 usCurrentExitGridNo = 0; void LocateNextExitGrid() { EXITGRID ExitGrid; @@ -295,6 +298,7 @@ void ChangeLightDefault( INT8 bLightType ) - + + diff --git a/Editor/EditorMercs.cpp b/Editor/EditorMercs.cpp index 11ae2a34..8e44c6b0 100644 --- a/Editor/EditorMercs.cpp +++ b/Editor/EditorMercs.cpp @@ -44,7 +44,6 @@ #include "Soldier Init List.h" #include "strategicmap.h" #include "Soldier Add.h" - #include "Soldier Control.h" #include "Soldier Profile Type.h" #include "Soldier Profile.h" #include "Text Input.h" @@ -64,6 +63,9 @@ #include "Timer Control.h" #include "message.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; extern void GetSoldierAboveGuyPositions( SOLDIERTYPE *pSoldier, INT16 *psX, INT16 *psY, BOOLEAN fRadio ); @@ -74,7 +76,7 @@ extern void GetSoldierAboveGuyPositions( SOLDIERTYPE *pSoldier, INT16 *psX, INT1 // SANMONA_ARMS_GROUP, // ANGELS_GROUP, // NUM_CIV_GROUPS -CHAR16 gszCivGroupNames[ NUM_CIV_GROUPS ][ 20 ] = +CHAR16 gszCivGroupNames[ NUM_CIV_GROUPS ][ 20 ] = { L"NONE", L"REBEL", @@ -111,8 +113,8 @@ CHAR16 gszCivGroupNames[ NUM_CIV_GROUPS ][ 20 ] = // SCHEDULE_ACTION_LEAVESECTOR, // SCHEDULE_ACTION_ENTERSECTOR, // SCHEDULE_ACTION_STAYINSECTOR, -// SCHEDULE_ACTION_SLEEP, -CHAR16 gszScheduleActions[ NUM_SCHEDULE_ACTIONS ][20] = +// SCHEDULE_ACTION_SLEEP, +CHAR16 gszScheduleActions[ NUM_SCHEDULE_ACTIONS ][20] = { L"No action", L"Lock door", @@ -160,21 +162,21 @@ void SetDroppableCheckboxesBasedOnMercsInventory(); extern BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOOLEAN fUseAnimation, UINT16 usAnimState, UINT16 usAnimCode ); -//array which keeps track of which item is in which slot. This is dependant on the selected merc, so -//these temp values must be updated when different mercs are selected, and reset when a merc detailed -//placement is created. +//array which keeps track of which item is in which slot. This is dependant on the selected merc, so +//these temp values must be updated when different mercs are selected, and reset when a merc detailed +//placement is created. OBJECTTYPE *gpMercSlotItem[9] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; //Because we only support these nine slots, they aren't continuous values, so this array helps //processing functions by referring to this array to get the appropriate slot. -INT8 gbMercSlotTypes[9] = { HELMETPOS, VESTPOS, LEGPOS, HANDPOS, SECONDHANDPOS, +INT8 gbMercSlotTypes[9] = { HELMETPOS, VESTPOS, LEGPOS, HANDPOS, SECONDHANDPOS, BIGPOCK1POS, BIGPOCK2POS, BIGPOCK3POS, BIGPOCK4POS }; //returns the usItem index of specified slot in the currently selected merc. -#define GetSelectedMercSlotItemIndex( x ) (gpSelected->pDetailedPlacement->Inv[gbMercSlotTypes[x]].usItem) -#define GetSelectedMercSlot( x ) (&gpSelected->pDetailedPlacement->Inv[gbMercSlotTypes[x]]) +#define GetSelectedMercSlotItemIndex( x ) (gpSelected->pDetailedPlacement->Inv[gbMercSlotTypes[x]].usItem) +#define GetSelectedMercSlot( x ) (&gpSelected->pDetailedPlacement->Inv[gbMercSlotTypes[x]]) //values indicating which merc inventory slot is hilited and which slot is selected. INT8 gbCurrHilite = -1; INT8 gbCurrSelect = -1; -//when a new merc is selected, this function sets up all of the information for the slots, +//when a new merc is selected, this function sets up all of the information for the slots, //selections, and hilites. void UpdateMercItemSlots(); @@ -186,7 +188,7 @@ void ExtractAndUpdateMercAttributes(); void ExtractAndUpdateMercProfile(); void ExtractAndUpdateMercSchedule(); void CalcStringForValue( STR16 str, INT32 iValue, UINT32 uiMax ); -void ChangeBodyType( INT8 bOffset ); //+1 or -1 only +void ChangeBodyType( INT8 bOffset ); //+1 or -1 only //internal merc variables BASIC_SOLDIERCREATE_STRUCT gTempBasicPlacement; @@ -212,24 +214,24 @@ BOOLEAN gfRoofPlacement; //Below are all flags that have to do with editing detailed placement mercs: -//Determines if the user is allowed to edit merc colors. User must specifically -//click on the checkbox by the colors to confirm that colors will be specified. If +//Determines if the user is allowed to edit merc colors. User must specifically +//click on the checkbox by the colors to confirm that colors will be specified. If //not, the colors will be randomly generated upon creation in the game. BOOLEAN gfCanEditMercColors = FALSE; //A rendering flag that is set whenever a full update of the merc editing information //needs to be done. BOOLEAN gfRenderMercInfo = FALSE; -//When the user specifies a profile index for the merc, all editing is disabled. This is -//because the profile contains all of the information. When this happens, all of the editing +//When the user specifies a profile index for the merc, all editing is disabled. This is +//because the profile contains all of the information. When this happens, all of the editing //buttons are disabled, but you are allowed to view stats, inventory, etc., as well as specify //orders, attitude, and direction. BOOLEAN gfCanEditMercs = TRUE; //When in inventory mode, this flag is set when the user wishes to get an item, which requires hooking -//into the item editing features. This is processed during the editor update, which in turn, sets the +//into the item editing features. This is processed during the editor update, which in turn, sets the //new mode. BOOLEAN gfMercGetItem = FALSE; //As soon as an item is selected, the items index is stored here, so the item can be copied into the -//slot for editing and rendering purposes. This is a temp store value only when leaving the editor items +//slot for editing and rendering purposes. This is a temp store value only when leaving the editor items //mode. UINT16 gusMercsNewItemIndex = 0xffff; @@ -269,9 +271,9 @@ INT16 sBaseStat[NUM_DIFF_LVLS] = { 50, 60, 70, 80, 90 }; INT16 sBaseExpLvl[NUM_DIFF_LVLS] = { 1, 3, 5, 7, 9 }; STR16 EditMercStat[12] = { L"Max Health",L"Cur Health",L"Strength", - L"Agility",L"Dexterity",L"Charisma", - L"Wisdom",L"Marksmanship",L"Explosives", - L"Medical",L"Scientific",L"Exp Level" }; + L"Agility",L"Dexterity",L"Charisma", + L"Wisdom",L"Marksmanship",L"Explosives", + L"Medical",L"Scientific",L"Exp Level" }; #define NUM_MERC_ORDERS 8 STR16 EditMercOrders[8] = { L"Stationary",L"On Guard",L"Close Patrol", @@ -284,7 +286,7 @@ STR16 EditMercAttitudes[6] = { L"Defensive",L"Brave Loner",L"Brave Buddy", //information for bodytypes. #ifdef RANDOM - #undef RANDOM + #undef RANDOM #endif #define RANDOM -1 #define MAX_ENEMYTYPES 7 @@ -296,8 +298,8 @@ STR16 EditMercAttitudes[6] = { L"Defensive",L"Brave Loner",L"Brave Buddy", INT8 bEnemyArray[MAX_ENEMYTYPES]={ RANDOM, REGMALE, BIGMALE, STOCKYMALE, REGFEMALE, TANK_NW, TANK_NE }; INT8 bCreatureArray[MAX_CREATURETYPES]={ BLOODCAT, LARVAE_MONSTER, INFANT_MONSTER, YAF_MONSTER, YAM_MONSTER, ADULTFEMALEMONSTER, AM_MONSTER, QUEENMONSTER }; INT8 bRebelArray[MAX_REBELTYPES]={ RANDOM, FATCIV, MANCIV, REGMALE, BIGMALE, STOCKYMALE, REGFEMALE }; -INT8 bCivArray[MAX_CIVTYPES]={ RANDOM, FATCIV, MANCIV, MINICIV, DRESSCIV, HATKIDCIV, KIDCIV, REGMALE, BIGMALE, STOCKYMALE, REGFEMALE, - HUMVEE, ELDORADO, ICECREAMTRUCK, JEEP, CRIPPLECIV, ROBOTNOWEAPON, COW }; +INT8 bCivArray[MAX_CIVTYPES]={ RANDOM, FATCIV, MANCIV, MINICIV, DRESSCIV, HATKIDCIV, KIDCIV, REGMALE, BIGMALE, STOCKYMALE, REGFEMALE, + HUMVEE, ELDORADO, ICECREAMTRUCK, JEEP, CRIPPLECIV, ROBOTNOWEAPON, COW }; INT8 gbCurrCreature = BLOODCAT; @@ -340,9 +342,9 @@ void EntryInitEditorMercsInfo() iCurStart += gubpNumReplacementsPerRange[ x - 1 ]; iEditColorStart[x] = iCurStart; } - gsSelectedMercID = -1; + gsSelectedMercID = -1; gsSelectedMercGridNo = 0; - + gfCanEditMercs = TRUE; } @@ -381,7 +383,7 @@ void ProcessMercEditing() SET_PALETTEREP_ID( pSoldier->HeadPal, gpPalRep[ ubPaletteRep ].ID ); sprintf( gpSelected->pDetailedPlacement->HeadPal, pSoldier->HeadPal ); - CreateSoldierPalettes( pSoldier ); + pSoldier->CreateSoldierPalettes( ); break; case 1: ubType = EDIT_COLOR_HEAD; @@ -393,7 +395,7 @@ void ProcessMercEditing() SET_PALETTEREP_ID( pSoldier->HeadPal, gpPalRep[ ubPaletteRep ].ID ); sprintf( gpSelected->pDetailedPlacement->HeadPal, pSoldier->HeadPal ); - CreateSoldierPalettes( pSoldier ); + pSoldier->CreateSoldierPalettes( ); break; case 2: @@ -406,7 +408,7 @@ void ProcessMercEditing() SET_PALETTEREP_ID( pSoldier->SkinPal, gpPalRep[ ubPaletteRep ].ID ); sprintf( gpSelected->pDetailedPlacement->SkinPal, pSoldier->SkinPal ); - CreateSoldierPalettes( pSoldier ); + pSoldier->CreateSoldierPalettes( ); break; case 3: ubType = EDIT_COLOR_SKIN; @@ -418,7 +420,7 @@ void ProcessMercEditing() SET_PALETTEREP_ID( pSoldier->SkinPal, gpPalRep[ ubPaletteRep ].ID ); sprintf( gpSelected->pDetailedPlacement->SkinPal, pSoldier->SkinPal ); - CreateSoldierPalettes( pSoldier ); + pSoldier->CreateSoldierPalettes( ); break; case 4: @@ -431,7 +433,7 @@ void ProcessMercEditing() SET_PALETTEREP_ID( pSoldier->VestPal, gpPalRep[ ubPaletteRep ].ID ); sprintf( gpSelected->pDetailedPlacement->VestPal, pSoldier->VestPal ); - CreateSoldierPalettes( pSoldier ); + pSoldier->CreateSoldierPalettes( ); break; case 5: ubType = EDIT_COLOR_VEST; @@ -443,7 +445,7 @@ void ProcessMercEditing() SET_PALETTEREP_ID( pSoldier->VestPal, gpPalRep[ ubPaletteRep ].ID ); sprintf( gpSelected->pDetailedPlacement->VestPal, pSoldier->VestPal ); - CreateSoldierPalettes( pSoldier ); + pSoldier->CreateSoldierPalettes( ); break; case 6: @@ -456,7 +458,7 @@ void ProcessMercEditing() SET_PALETTEREP_ID( pSoldier->PantsPal, gpPalRep[ ubPaletteRep ].ID ); sprintf( gpSelected->pDetailedPlacement->PantsPal, pSoldier->PantsPal ); - CreateSoldierPalettes( pSoldier ); + pSoldier->CreateSoldierPalettes( ); break; case 7: ubType = EDIT_COLOR_PANTS; @@ -468,7 +470,7 @@ void ProcessMercEditing() SET_PALETTEREP_ID( pSoldier->PantsPal, gpPalRep[ ubPaletteRep ].ID ); sprintf( gpSelected->pDetailedPlacement->PantsPal, pSoldier->PantsPal ); - CreateSoldierPalettes( pSoldier ); + pSoldier->CreateSoldierPalettes( ); break; } iEditMercMode = EDIT_MERC_NONE; @@ -498,9 +500,9 @@ void AddMercToWorld( INT32 iMapIndex ) gTempBasicPlacement.bBodyType = gbCurrCreature; break; case DRAW_MODE_REBEL: - gTempBasicPlacement.bTeam = MILITIA_TEAM; + gTempBasicPlacement.bTeam = MILITIA_TEAM; gTempBasicPlacement.bBodyType = RANDOM; - break; + break; case DRAW_MODE_CIVILIAN: gTempBasicPlacement.bTeam = CIV_TEAM; gTempBasicPlacement.bBodyType = RANDOM; @@ -517,17 +519,17 @@ void AddMercToWorld( INT32 iMapIndex ) UINT8 ubID; INT16 sSectorX, sSectorY; SOLDIERINITNODE *pNode; - + GetCurrentWorldSector( &sSectorX, &sSectorY ); //Set up some general information. gTempBasicPlacement.fDetailedPlacement = FALSE; gTempBasicPlacement.fPriorityExistance = FALSE; - gTempBasicPlacement.usStartingGridNo = (UINT16)iMapIndex; - gTempBasicPlacement.bOrders = gbDefaultOrders; + gTempBasicPlacement.sStartingGridNo = (INT16)iMapIndex; + gTempBasicPlacement.bOrders = gbDefaultOrders; gTempBasicPlacement.bAttitude = gbDefaultAttitude; - gTempBasicPlacement.bRelativeAttributeLevel = gbDefaultRelativeAttributeLevel; - gTempBasicPlacement.bRelativeEquipmentLevel = gbDefaultRelativeEquipmentLevel; + gTempBasicPlacement.bRelativeAttributeLevel = gbDefaultRelativeAttributeLevel; + gTempBasicPlacement.bRelativeEquipmentLevel = gbDefaultRelativeEquipmentLevel; gTempBasicPlacement.ubDirection = gbDefaultDirection; //Generate detailed placement information given the temp placement information. @@ -542,12 +544,12 @@ void AddMercToWorld( INT32 iMapIndex ) { pSoldier->bVisible = 1; pSoldier->bLastRenderVisibleValue = 1; - //Set up the soldier in the list, so we can track the soldier in the + //Set up the soldier in the list, so we can track the soldier in the //future (saving, loading, strategic AI) pNode = AddBasicPlacementToSoldierInitList( &gTempBasicPlacement ); Assert( pNode ); pNode->pSoldier = pSoldier; - + //Add the soldier to physically appear on the map now. InternalAddSoldierToSector( ubID, FALSE, FALSE, 0, 0 ); IndicateSelectedMerc( ubID ); @@ -558,7 +560,7 @@ void AddMercToWorld( INT32 iMapIndex ) gpSelected->pBasicPlacement->fOnRoof = TRUE; if( gpSelected->pDetailedPlacement ) gpSelected->pDetailedPlacement->fOnRoof = TRUE; - SetSoldierHeight( gpSelected->pSoldier, 58.0 ); + gpSelected->pSoldier->SetSoldierHeight( 58.0 ); } UnclickEditorButtons( FIRST_MERCS_INVENTORY_BUTTON, LAST_MERCS_INVENTORY_BUTTON ); for( i = FIRST_MERCS_INVENTORY_BUTTON; i <= LAST_MERCS_INVENTORY_BUTTON; i++ ) @@ -579,8 +581,8 @@ void HandleRightClickOnMerc( INT32 iMapIndex ) sThisMercID = (INT16)IsMercHere( iMapIndex ); - if ( sThisMercID != -1) - { + if ( sThisMercID != -1) + { if ( gsSelectedMercID != sThisMercID ) { // We want to edit a new merc (or different merc) //We need to avoid the editing of player mercs. @@ -591,25 +593,25 @@ void HandleRightClickOnMerc( INT32 iMapIndex ) } } else if( gsSelectedMercID != -1 && IsLocationSittable( iMapIndex, gfRoofPlacement ) )// We want to move the selected merc to this new location. - { + { RemoveAllObjectsOfTypeRange( gsSelectedMercGridNo, CONFIRMMOVE, CONFIRMMOVE ); - EVENT_SetSoldierPosition( gpSelected->pSoldier, (FLOAT)(sCellX + 5), (FLOAT)(sCellY + 5) ); + gpSelected->pSoldier->EVENT_SetSoldierPosition( (FLOAT)(sCellX + 5), (FLOAT)(sCellY + 5) ); if( gfRoofPlacement && FlatRoofAboveGridNo( iMapIndex ) ) { gpSelected->pBasicPlacement->fOnRoof = TRUE; if( gpSelected->pDetailedPlacement ) gpSelected->pDetailedPlacement->fOnRoof = TRUE; - SetSoldierHeight( gpSelected->pSoldier, 58.0 ); + gpSelected->pSoldier->SetSoldierHeight( 58.0 ); } else { gpSelected->pBasicPlacement->fOnRoof = FALSE; if( gpSelected->pDetailedPlacement ) gpSelected->pDetailedPlacement->fOnRoof = FALSE; - SetSoldierHeight( gpSelected->pSoldier, 0.0 ); + gpSelected->pSoldier->SetSoldierHeight( 0.0 ); } gsSelectedMercGridNo = (INT16)iMapIndex; - gpSelected->pBasicPlacement->usStartingGridNo = gsSelectedMercGridNo; + gpSelected->pBasicPlacement->sStartingGridNo = gsSelectedMercGridNo; if( gpSelected->pDetailedPlacement ) gpSelected->pDetailedPlacement->sInsertionGridNo = gsSelectedMercGridNo; AddObjectToHead( gsSelectedMercGridNo, CONFIRMMOVE1 ); @@ -638,13 +640,13 @@ void ResetAllMercPositions() TacticalRemoveSoldier( curr->pSoldier->ubID ); curr->pSoldier = NULL; } - //usMapIndex = gpSelected->pBasicPlacement->usStartingGridNo; - //ConvertGridNoToCellXY( usMapIndex, &sCellX, &sCellY ); + //sMapIndex = gpSelected->pBasicPlacement->sStartingGridNo; + //ConvertGridNoToCellXY( sMapIndex, &sCellX, &sCellY ); //if( gpSelected->pSoldier ) //{ // EVENT_SetSoldierPosition( gpSelected->pSoldier, (FLOAT)(sCellX + 5), (FLOAT)(sCellY + 5) ); // if( gpSelected->pBasicPlacement->fOnRoof ) - // SetSoldierHeight( gpSelected->pSoldier, 58.0 ); + // gpSelected->pSoldier->SetSoldierHeight( 58.0 ); // SetMercDirection( gpSelected->pBasicPlacement->ubDirection ); //} curr = curr->next; @@ -666,23 +668,23 @@ void AddMercWaypoint( UINT32 iMapIndex ) if ( gsSelectedMercID == -1 || (gsSelectedMercID <= (INT32)gTacticalStatus.Team[ OUR_TEAM ].bLastID) || gsSelectedMercID >= MAXMERCS ) return; - - if ( iActionParam > gpSelected->pSoldier->bPatrolCnt ) + + if ( iActionParam > gpSelected->pSoldier->aiData.bPatrolCnt ) { // Fill up missing waypoints with same value as new one - for(iNum = gpSelected->pSoldier->bPatrolCnt + 1; iNum <= iActionParam; iNum++) + for(iNum = gpSelected->pSoldier->aiData.bPatrolCnt + 1; iNum <= iActionParam; iNum++) { gpSelected->pBasicPlacement->sPatrolGrid[iNum] = (INT16)iMapIndex; if( gpSelected->pDetailedPlacement ) gpSelected->pDetailedPlacement->sPatrolGrid[iNum] = (INT16)iMapIndex; - gpSelected->pSoldier->usPatrolGrid[iNum] = (UINT16)iMapIndex; + gpSelected->pSoldier->aiData.sPatrolGrid[iNum] = (INT16)iMapIndex; } - + gpSelected->pBasicPlacement->bPatrolCnt = (INT8)iActionParam; if( gpSelected->pDetailedPlacement ) gpSelected->pDetailedPlacement->bPatrolCnt = (INT8)iActionParam; - gpSelected->pSoldier->bPatrolCnt = (INT8) iActionParam; - gpSelected->pSoldier->bNextPatrolPnt = 1; + gpSelected->pSoldier->aiData.bPatrolCnt = (INT8) iActionParam; + gpSelected->pSoldier->aiData.bNextPatrolPnt = 1; } else { @@ -690,7 +692,7 @@ void AddMercWaypoint( UINT32 iMapIndex ) gpSelected->pBasicPlacement->sPatrolGrid[iActionParam] = (INT16)iMapIndex; if( gpSelected->pDetailedPlacement ) gpSelected->pDetailedPlacement->sPatrolGrid[iActionParam] = (INT16)iMapIndex; - gpSelected->pSoldier->usPatrolGrid[iActionParam] = (UINT16)iMapIndex; + gpSelected->pSoldier->aiData.sPatrolGrid[iActionParam] = (INT16)iMapIndex; } gfRenderWorld = TRUE; } @@ -706,21 +708,21 @@ void EraseMercWaypoint() return; // Fill up missing areas - if ( iActionParam > gpSelected->pSoldier->bPatrolCnt ) + if ( iActionParam > gpSelected->pSoldier->aiData.bPatrolCnt ) return; - for(iNum = iActionParam; iNum < gpSelected->pSoldier->bPatrolCnt; iNum++) + for(iNum = iActionParam; iNum < gpSelected->pSoldier->aiData.bPatrolCnt; iNum++) { gpSelected->pBasicPlacement->sPatrolGrid[iNum] = gpSelected->pBasicPlacement->sPatrolGrid[iNum+1]; if( gpSelected->pDetailedPlacement ) gpSelected->pDetailedPlacement->sPatrolGrid[iNum] = gpSelected->pDetailedPlacement->sPatrolGrid[iNum+1]; - gpSelected->pSoldier->usPatrolGrid[iNum] = gpSelected->pSoldier->usPatrolGrid[iNum+1]; + gpSelected->pSoldier->aiData.sPatrolGrid[iNum] = gpSelected->pSoldier->aiData.sPatrolGrid[iNum+1]; } gpSelected->pBasicPlacement->bPatrolCnt--; if( gpSelected->pDetailedPlacement ) gpSelected->pDetailedPlacement->bPatrolCnt--; - gpSelected->pSoldier->bPatrolCnt--; + gpSelected->pSoldier->aiData.bPatrolCnt--; gfRenderWorld = TRUE; } @@ -728,7 +730,7 @@ void EraseMercWaypoint() //---------------------------------------------------------------------------------------------- // ChangeBaseSoldierStats // -// This functions changes the stats of a given merc (PC or NPC, though should only be used +// This functions changes the stats of a given merc (PC or NPC, though should only be used // for NPC mercs) to reflect the base difficulty level selected. // void ChangeBaseSoldierStats( SOLDIERTYPE *pSoldier ) @@ -736,35 +738,35 @@ void ChangeBaseSoldierStats( SOLDIERTYPE *pSoldier ) if ( pSoldier == NULL ) return; - pSoldier->bLifeMax = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); - pSoldier->bLife = pSoldier->bLifeMax; + pSoldier->stats.bLifeMax = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); + pSoldier->stats.bLife = pSoldier->stats.bLifeMax; pSoldier->bBleeding = 0; pSoldier->bBreath = 100; - pSoldier->bMarksmanship = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); - pSoldier->bMedical = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); - pSoldier->bMechanical = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); - pSoldier->bExplosive = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); - pSoldier->bAgility = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); - pSoldier->bDexterity = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); + pSoldier->stats.bMarksmanship = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); + pSoldier->stats.bMedical = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); + pSoldier->stats.bMechanical = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); + pSoldier->stats.bExplosive = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); + pSoldier->stats.bAgility = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); + pSoldier->stats.bDexterity = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); - pSoldier->bStrength = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); - pSoldier->bLeadership = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); - pSoldier->bWisdom = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); - pSoldier->bScientific = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); + pSoldier->stats.bStrength = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); + pSoldier->stats.bLeadership = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); + pSoldier->stats.bWisdom = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); + pSoldier->stats.bScientific = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); - pSoldier->bExpLevel = (UINT8)sBaseExpLvl[sCurBaseDiff]; + pSoldier->stats.bExpLevel = (UINT8)sBaseExpLvl[sCurBaseDiff]; pSoldier->bGunType = (INT8)Random(BASE_GUNTYPE_DEVIATION); - pSoldier->bActionPoints = CalcActionPoints( pSoldier ); + pSoldier->bActionPoints = pSoldier->CalcActionPoints( ); } //---------------------------------------------------------------------------------------------- // DisplayEditMercWindow // -// Displays the edit merc stat page while editing mercs. If the merc color editing page is +// Displays the edit merc stat page while editing mercs. If the merc color editing page is // to be displayed, this function will dispatch it instead. // void DisplayEditMercWindow( void ) @@ -802,7 +804,7 @@ void DisplayEditMercWindow( void ) ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos, iYPos, iXPos + iWidth, iYPos + iHeight, usFillColorLight ); ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 1, iYPos + 1, iXPos + iWidth, iYPos + iHeight, usFillColorDark ); ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 1, iYPos + 1, iXPos + iWidth - 1, iYPos + iHeight - 1, usFillColorBack ); - + SetFont( FONT12POINT1 ); // Name window @@ -812,36 +814,36 @@ void DisplayEditMercWindow( void ) ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 129, iYPos + 17, iXPos + 128 + 103, iYPos + 17 + 18, usFillColorTextBk ); iXOff = (105 - StringPixLength( pSoldier->name, FONT12POINT1 )) / 2; gprintf( iXPos + 130 + iXOff, iYPos + 20, L"%s", pSoldier->name ); - + // Orders window gprintf( iXPos + 128, iYPos + 38, L"Orders:" ); ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 128, iYPos + 51, iXPos + 128 + 104, iYPos + 51 + 19, usFillColorDark ); ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 129, iYPos + 52, iXPos + 128 + 104, iYPos + 52 + 19, usFillColorLight ); ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 129, iYPos + 52, iXPos + 128 + 103, iYPos + 52 + 18, usFillColorTextBk ); - iXOff = (105 - StringPixLength( EditMercOrders[pSoldier->bOrders], FONT12POINT1 )) / 2; - gprintf( iXPos + 130 + iXOff, iYPos + 55, L"%s", EditMercOrders[pSoldier->bOrders] ); + iXOff = (105 - StringPixLength( EditMercOrders[pSoldier->aiData.bOrders], FONT12POINT1 )) / 2; + gprintf( iXPos + 130 + iXOff, iYPos + 55, L"%s", EditMercOrders[pSoldier->aiData.bOrders] ); // Combat window gprintf( iXPos + 128, iYPos + 73, L"Combat Attitude:" ); ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 128, iYPos + 86, iXPos + 128 + 104, iYPos + 86 + 19, usFillColorDark ); ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 129, iYPos + 87, iXPos + 128 + 104, iYPos + 87 + 19, usFillColorLight ); ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 129, iYPos + 87, iXPos + 128 + 103, iYPos + 87 + 18, usFillColorTextBk ); - iXOff = (105 - StringPixLength( EditMercAttitudes[pSoldier->bAttitude], FONT12POINT1 )) / 2; - gprintf( iXPos + 130 + iXOff, iYPos + 90, L"%s", EditMercAttitudes[pSoldier->bAttitude] ); + iXOff = (105 - StringPixLength( EditMercAttitudes[pSoldier->aiData.bAttitude], FONT12POINT1 )) / 2; + gprintf( iXPos + 130 + iXOff, iYPos + 90, L"%s", EditMercAttitudes[pSoldier->aiData.bAttitude] ); // Get stats - iEditStat[0] = pSoldier->bLifeMax; // 12 13 - iEditStat[1] = pSoldier->bLife; // 14 15 - iEditStat[2] = pSoldier->bStrength; // 16 17 - iEditStat[3] = pSoldier->bAgility; // 18 19 - iEditStat[4] = pSoldier->bDexterity; // 20 21 - iEditStat[5] = pSoldier->bLeadership; // 22 23 - iEditStat[6] = pSoldier->bWisdom; // 24 25 - iEditStat[7] = pSoldier->bMarksmanship; // 26 27 - iEditStat[8] = pSoldier->bExplosive; // 28 29 - iEditStat[9] = pSoldier->bMedical; // 30 31 - iEditStat[10] = pSoldier->bScientific; // 32 33 - iEditStat[11] = pSoldier->bExpLevel; // 34 35 + iEditStat[0] = pSoldier->stats.bLifeMax; // 12 13 + iEditStat[1] = pSoldier->stats.bLife; // 14 15 + iEditStat[2] = pSoldier->stats.bStrength; // 16 17 + iEditStat[3] = pSoldier->stats.bAgility; // 18 19 + iEditStat[4] = pSoldier->stats.bDexterity; // 20 21 + iEditStat[5] = pSoldier->stats.bLeadership; // 22 23 + iEditStat[6] = pSoldier->stats.bWisdom; // 24 25 + iEditStat[7] = pSoldier->stats.bMarksmanship; // 26 27 + iEditStat[8] = pSoldier->stats.bExplosive; // 28 29 + iEditStat[9] = pSoldier->stats.bMedical; // 30 31 + iEditStat[10] = pSoldier->stats.bScientific; // 32 33 + iEditStat[11] = pSoldier->stats.bExpLevel; // 34 35 // Stat value windows for ( x = 0; x < 12; x++ ) @@ -850,7 +852,7 @@ void DisplayEditMercWindow( void ) ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 116, iYPos + 110 + (20 * x), iXPos + 116 + 30, iYPos + 110 + (20 * x) + 19, usFillColorDark ); ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 117, iYPos + 111 + (20 * x), iXPos + 116 + 30, iYPos + 111 + (20 * x) + 19, usFillColorLight ); ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 117, iYPos + 111 + (20 * x), iXPos + 116 + 29, iYPos + 111 + (20 * x) + 18, usFillColorTextBk ); - + swprintf( TempString, L"%d", iEditStat[x] ); iXOff = (30 - StringPixLength( TempString, FONT12POINT1 )) / 2; gprintf( iXPos + 118 + iXOff, iYPos + 114 + (20 * x), L"%s", TempString ); @@ -982,7 +984,7 @@ void EditMercStatUpCallback(GUI_BUTTON *btn,INT32 reason) INT32 iBtn; if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) - { + { iEditWhichStat = -1; for ( iBtn = 0; iBtn < 36 && iEditWhichStat == -1; iBtn++ ) { @@ -1011,7 +1013,7 @@ void EditMercStatDwnCallback(GUI_BUTTON *btn,INT32 reason) INT32 iBtn; if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) - { + { iEditWhichStat = -1; for ( iBtn = 0; iBtn < 36 && iEditWhichStat == -1; iBtn++ ) { @@ -1041,7 +1043,7 @@ void EditMercSetDirCallback(GUI_BUTTON *btn,INT32 reason) INT32 iBtn; if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) - { + { iEditWhichStat = -1; for ( iBtn = 0; iBtn < 36 && iEditWhichStat == -1; iBtn++ ) { @@ -1063,7 +1065,7 @@ void EditMercSetDirCallback(GUI_BUTTON *btn,INT32 reason) void EditMercCenterCallback(GUI_BUTTON *btn,INT32 reason) { if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) - { + { iEditStatTimer = 0; iEditMercMode = EDIT_MERC_FIND; @@ -1077,7 +1079,7 @@ void EditMercColorDwnCallback(GUI_BUTTON *btn,INT32 reason) INT32 iBtn; if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) - { + { iEditWhichStat = -1; for ( iBtn = 0; iBtn < 8 && iEditWhichStat == -1; iBtn++ ) { @@ -1122,7 +1124,7 @@ void MercsSetColorsCallback( GUI_BUTTON *btn, INT32 reason ) { INT32 iBtn; if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) - { + { iEditWhichStat = -1; for ( iBtn = FIRST_MERCS_COLOR_BUTTON; iBtn <= LAST_MERCS_COLOR_BUTTON; iBtn++ ) { @@ -1146,7 +1148,7 @@ void MercsSetBodyTypeCallback( GUI_BUTTON *btn, INT32 reason ) if( btn->IDNum == iEditorButton[ MERCS_BODYTYPE_DOWN ] ) ChangeBodyType( 1 ); //next else - ChangeBodyType( -1 ); //previous + ChangeBodyType( -1 ); //previous } } @@ -1155,7 +1157,7 @@ void EditMercDecDifficultyCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) { btn->uiFlags |= BUTTON_CLICKED_ON; - + iEditorToolbarState = TBAR_MODE_DEC_DIFF; } } @@ -1166,7 +1168,7 @@ void EditMercIncDifficultyCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) { btn->uiFlags |= BUTTON_CLICKED_ON; - + iEditorToolbarState = TBAR_MODE_INC_DIFF; } } @@ -1182,17 +1184,19 @@ void EditMercIncDifficultyCallback(GUI_BUTTON *btn,INT32 reason) // void ShowEditMercPalettes( SOLDIERTYPE *pSoldier ) { - UINT8 ubPaletteRep = 0xff; + UINT8 ubPaletteRep; + if( !pSoldier ) + ubPaletteRep = 0xff; if( pSoldier ) { if( !strlen( pSoldier->HeadPal ) ) ubPaletteRep = 0xff; - else + else GetPaletteRepIndexFromID( pSoldier->HeadPal, &ubPaletteRep ); } ShowEditMercColorSet( ubPaletteRep, 0 ); - + if( pSoldier ) { if( !strlen( pSoldier->SkinPal ) ) @@ -1201,7 +1205,7 @@ void ShowEditMercPalettes( SOLDIERTYPE *pSoldier ) GetPaletteRepIndexFromID( pSoldier->SkinPal, &ubPaletteRep ); } ShowEditMercColorSet( ubPaletteRep, 1 ); - + if( pSoldier ) { if( !strlen( pSoldier->VestPal ) ) @@ -1231,9 +1235,9 @@ void ShowEditMercColorSet( UINT8 ubPaletteRep, INT16 sSet ) { UINT16 us16BPPColor, usFillColorDark, usFillColorLight; UINT8 cnt1; - UINT8 ubSize; + UINT8 ubSize; INT16 sUnitSize; - INT16 sLeft, sTop, sRight, sBottom; + INT16 sLeft, sTop, sRight, sBottom; if( ubPaletteRep == 0xff ) ubSize = 16; @@ -1245,13 +1249,13 @@ void ShowEditMercColorSet( UINT8 ubPaletteRep, INT16 sSet ) sTop = 2 * iScreenHeightOffset + 364 + (sSet * 24); sBottom = sTop + 20; sLeft = iScreenWidthOffset + 230; - sRight = iScreenWidthOffset + 359; + sRight = iScreenWidthOffset + 359; usFillColorDark = Get16BPPColor(FROMRGB(24, 61, 81)); usFillColorLight = Get16BPPColor(FROMRGB(136, 138, 135)); // Draw color bar window area - ColorFillVideoSurfaceArea(FRAME_BUFFER, sLeft, sTop, sRight, sBottom, usFillColorDark ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, sLeft, sTop, sRight, sBottom, usFillColorDark ); ColorFillVideoSurfaceArea(FRAME_BUFFER, sLeft + 1, sTop + 1, sRight, sBottom, usFillColorLight ); InvalidateRegion( sLeft, sTop, sRight, sBottom ); @@ -1291,7 +1295,7 @@ void DisplayWayPoints(void) INT8 bPoint; SOLDIERTYPE *pSoldier; INT16 sGridNo; - + if ( gsSelectedMercID == -1 || (gsSelectedMercID <= (INT32)gTacticalStatus.Team[ OUR_TEAM ].bLastID) || gsSelectedMercID >= MAXMERCS ) return; @@ -1301,10 +1305,10 @@ void DisplayWayPoints(void) return; // point 0 is not used! - for ( bPoint = 1; bPoint <= pSoldier->bPatrolCnt; bPoint++ ) + for ( bPoint = 1; bPoint <= pSoldier->aiData.bPatrolCnt; bPoint++ ) { // Get the next point - sGridNo = (INT16)pSoldier->usPatrolGrid[bPoint]; + sGridNo = (INT16)pSoldier->aiData.sPatrolGrid[bPoint]; // Can we see it? if ( !GridNoOnVisibleWorldTile( sGridNo ) ) @@ -1320,7 +1324,7 @@ void DisplayWayPoints(void) dOffsetY = (FLOAT)(sYMapPos * CELL_Y_SIZE) - gsRenderCenterY; FloatFromCellToScreenCoordinates( dOffsetX, dOffsetY, &ScrnX, &ScrnY); - + sScreenX = ( ( gsVIEWPORT_END_X - gsVIEWPORT_START_X ) /2 ) + (INT16)ScrnX; sScreenY = ( ( gsVIEWPORT_END_Y - gsVIEWPORT_START_Y ) /2 ) + (INT16)ScrnY; @@ -1333,7 +1337,7 @@ void DisplayWayPoints(void) { // Shown it on screen! SetFont(TINYFONT1); - if( pSoldier->bLevel == 1 ) + if( pSoldier->pathing.bLevel == 1 ) { SetFontBackground( FONT_LTBLUE ); sScreenY -= 68; @@ -1372,7 +1376,7 @@ void CreateEditMercWindow( void ) BUTTON_USE_DEFAULT, (INT16)(iXPos + 183), (INT16)(iYPos + 337), 80, 20, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercDoneEditCallback ); // Disable color editing for PC Mercs - if ( (UINT16)gsSelectedMercID >= gTacticalStatus.Team[ OUR_TEAM ].bFirstID && (UINT16)gsSelectedMercID <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ) + if ( (UINT16)gsSelectedMercID >= gTacticalStatus.Team[ OUR_TEAM ].bFirstID && (UINT16)gsSelectedMercID <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ) DisableButton( iEditMercColorPage ); iEditorButton[8] = QuickCreateButton( giEditMercImage[0], (INT16)(iXPos + 98), (INT16)(iYPos + 51), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercPrevOrderCallback ); @@ -1390,16 +1394,16 @@ void CreateEditMercWindow( void ) iEditorButton[14] = QuickCreateButton( giEditMercImage[0], (INT16)(iXPos + 86), (INT16)(iYPos + 130), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatDwnCallback ); iEditorButton[15] = QuickCreateButton( giEditMercImage[1], (INT16)(iXPos + 146), (INT16)(iYPos + 130), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatUpCallback ); - + iEditorButton[16] = QuickCreateButton( giEditMercImage[0], (INT16)(iXPos + 86), (INT16)(iYPos + 150), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatDwnCallback ); iEditorButton[17] = QuickCreateButton( giEditMercImage[1], (INT16)(iXPos + 146), (INT16)(iYPos + 150), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatUpCallback ); - + iEditorButton[18] = QuickCreateButton( giEditMercImage[0], (INT16)(iXPos + 86), (INT16)(iYPos + 170), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatDwnCallback ); iEditorButton[19] = QuickCreateButton( giEditMercImage[1], (INT16)(iXPos + 146), (INT16)(iYPos + 170), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatUpCallback ); - + iEditorButton[20] = QuickCreateButton( giEditMercImage[0], (INT16)(iXPos + 86), (INT16)(iYPos + 190), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatDwnCallback ); iEditorButton[21] = QuickCreateButton( giEditMercImage[1], (INT16)(iXPos + 146), (INT16)(iYPos + 190), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatUpCallback ); - + iEditorButton[22] = QuickCreateButton( giEditMercImage[0], (INT16)(iXPos + 86), (INT16)(iYPos + 210), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatDwnCallback ); iEditorButton[23] = QuickCreateButton( giEditMercImage[1], (INT16)(iXPos + 146), (INT16)(iYPos + 210), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatUpCallback ); @@ -1429,7 +1433,7 @@ void CreateEditMercWindow( void ) } void SetMercOrders( INT8 bOrders ) { - gpSelected->pSoldier->bOrders = bOrders; + gpSelected->pSoldier->aiData.bOrders = bOrders; gpSelected->pBasicPlacement->bOrders = bOrders; UnclickEditorButtons( FIRST_MERCS_ORDERS_BUTTON, LAST_MERCS_ORDERS_BUTTON ); ClickEditorButton( FIRST_MERCS_ORDERS_BUTTON + bOrders ); @@ -1438,7 +1442,7 @@ void SetMercOrders( INT8 bOrders ) void SetMercAttitude( INT8 bAttitude ) { - gpSelected->pSoldier->bAttitude = bAttitude; + gpSelected->pSoldier->aiData.bAttitude = bAttitude; gpSelected->pBasicPlacement->bAttitude = bAttitude; UnclickEditorButtons( FIRST_MERCS_ATTITUDE_BUTTON, LAST_MERCS_ATTITUDE_BUTTON ); ClickEditorButton( FIRST_MERCS_ATTITUDE_BUTTON + bAttitude ); @@ -1454,10 +1458,10 @@ void SetMercDirection( INT8 bDirection ) gpSelected->pBasicPlacement->ubDirection = bDirection; // ATE: Changed these to call functions.... - EVENT_SetSoldierDirection( gpSelected->pSoldier, bDirection ); - EVENT_SetSoldierDesiredDirection( gpSelected->pSoldier, bDirection ); + gpSelected->pSoldier->EVENT_SetSoldierDirection( bDirection ); + gpSelected->pSoldier->EVENT_SetSoldierDesiredDirection( bDirection ); - ConvertAniCodeToAniFrame( gpSelected->pSoldier, 0 ); + gpSelected->pSoldier->ConvertAniCodeToAniFrame( 0 ); } void SetMercRelativeEquipment( INT8 bLevel ) @@ -1483,22 +1487,22 @@ void SetMercRelativeAttributes( INT8 bLevel ) void IndicateSelectedMerc( INT16 sID ) { SOLDIERINITNODE *prev; - INT8 bTeam; + INT8 bTeam; //If we are trying to select a merc that is already selected, ignore. if( sID >= 0 && sID == gsSelectedMercGridNo ) return; //first remove the cursor of the previous merc. - //NOTE: It doesn't matter what the value is, even if a merc isn't selected. + //NOTE: It doesn't matter what the value is, even if a merc isn't selected. //There is no need to validate the gridNo value, because it is always valid. RemoveAllObjectsOfTypeRange( gsSelectedMercGridNo, CONFIRMMOVE, CONFIRMMOVE ); //This is very important, because clearing the merc editing mode actually, - //updates the edited merc. If this call isn't here, it is possible to update the + //updates the edited merc. If this call isn't here, it is possible to update the //newly selected merc with the wrong information. SetMercEditingMode( MERC_NOMODE ); - + bTeam = -1; //determine selection method @@ -1518,7 +1522,7 @@ void IndicateSelectedMerc( INT16 sID ) } else { //we are at the end of the list, so select the first merc in the list. - gpSelected = gSoldierInitHead; + gpSelected = gSoldierInitHead; } } if( !gpSelected ) //list is empty @@ -1589,7 +1593,7 @@ void IndicateSelectedMerc( INT16 sID ) } else { //we are at the end of the list, so select the first merc in the list. - gpSelected = gSoldierInitHead; + gpSelected = gSoldierInitHead; } } if( !gpSelected ) //list is empty @@ -1613,7 +1617,7 @@ void IndicateSelectedMerc( INT16 sID ) } if( !gpSelected ) return; - if( gpSelected == prev ) + if( gpSelected == prev ) { //we have cycled through the list already, so choose the same guy (if he is on the desired team)... if( !gpSelected->pSoldier || gpSelected->pSoldier->bVisible != 1 || gpSelected->pSoldier->bTeam != bTeam ) { @@ -1650,8 +1654,8 @@ void IndicateSelectedMerc( INT16 sID ) //update the merc item slots to reflect what the merc currently has. UpdateMercItemSlots(); - - //Whatever the case, we want to update the gui to press the appropriate buttons + + //Whatever the case, we want to update the gui to press the appropriate buttons //depending on the merc's attributes. //Click the appropriate team button UnclickEditorButton( MERCS_ENEMY ); @@ -1674,8 +1678,8 @@ void IndicateSelectedMerc( INT16 sID ) gfRenderMercInfo = TRUE; //These calls will set the proper button states, even though it redundantly //assigns the soldier with the same orders/attitude. - SetMercOrders( gpSelected->pSoldier->bOrders ); - SetMercAttitude( gpSelected->pSoldier->bAttitude ); + SetMercOrders( gpSelected->pSoldier->aiData.bOrders ); + SetMercAttitude( gpSelected->pSoldier->aiData.bAttitude ); SetMercDirection( gpSelected->pSoldier->ubDirection ); if( gpSelected->pBasicPlacement->fPriorityExistance ) ClickEditorButton( MERCS_PRIORITYEXISTANCE_CHECKBOX ); @@ -1764,7 +1768,7 @@ void SetupTextInputForMercAttributes() DisableAllTextFields(); } -//In the merc editing, all detailed placement values for generated attributes are set to -1. +//In the merc editing, all detailed placement values for generated attributes are set to -1. //When making a generated attribute static, we then set the value to its applicable value. //This function is similar to the itoa function except that -1 is converted to a null string. void CalcStringForValue( STR16 str, INT32 iValue, UINT32 uiMax ) @@ -1786,7 +1790,7 @@ void ExtractAndUpdateMercAttributes() //It just so happens that GetNumericStrict...() will return -1 for any blank fields. //-1 values in the detailed placement work nicely, because that signifies that specific - //field isn't static. Any other value becomes static, and static values override any + //field isn't static. Any other value becomes static, and static values override any //generated values. gpSelected->pDetailedPlacement->bExpLevel = (INT8)min( GetNumericStrictValueFromField( 0 ), 100 ); gpSelected->pDetailedPlacement->bLife = (INT8)min( GetNumericStrictValueFromField( 1 ), 100 ); @@ -1813,7 +1817,7 @@ void ExtractAndUpdateMercAttributes() //make sure the life doesn't exceed the maxlife... if( gpSelected->pDetailedPlacement->bLifeMax != -1 && gpSelected->pDetailedPlacement->bLife != -1 && gpSelected->pDetailedPlacement->bLife > gpSelected->pDetailedPlacement->bLifeMax ) - gpSelected->pDetailedPlacement->bLife = gpSelected->pDetailedPlacement->bLifeMax; + gpSelected->pDetailedPlacement->bLife = gpSelected->pDetailedPlacement->bLifeMax; //update the soldier UpdateSoldierWithStaticDetailedInformation( gpSelected->pSoldier, gpSelected->pDetailedPlacement ); @@ -1876,7 +1880,7 @@ void ExtractAndUpdateMercSchedule() BOOLEAN fValidSchedule = FALSE; BOOLEAN fScheduleNeedsUpdate = FALSE; SCHEDULENODE *pNext = NULL; - if( !gpSelected ) + if( !gpSelected ) return; //extract all of the fields into a temp schedulenode. //memset( &gScheduleNode, 0, sizeof( SCHEDULENODE ) ); @@ -1953,7 +1957,7 @@ void ExtractCurrentMercModeInfo( BOOLEAN fKillTextInputMode ) case MERC_SCHEDULEMODE: ExtractAndUpdateMercSchedule(); break; - default: + default: fKillTextInputMode = FALSE; break; } @@ -1965,14 +1969,13 @@ void InitDetailedPlacementForMerc() { Assert( !gpSelected->pDetailedPlacement ); - // WDS - Clean up inventory handling gpSelected->pDetailedPlacement = new SOLDIERCREATE_STRUCT; Assert( gpSelected->pDetailedPlacement ); - + gpSelected->pBasicPlacement->fDetailedPlacement = TRUE; gpSelected->pBasicPlacement->fPriorityExistance = FALSE; CreateStaticDetailedPlacementGivenBasicPlacementInfo( gpSelected->pDetailedPlacement, gpSelected->pBasicPlacement ); - + ClearCurrentSchedule(); //update the soldier @@ -1989,7 +1992,7 @@ void KillDetailedPlacementForMerc() } -void ChangeBodyType( INT8 bOffset ) //+1 or -1 only +void ChangeBodyType( INT8 bOffset ) //+1 or -1 only { INT8 *pbArray; INT32 iMax, x; @@ -2018,13 +2021,7 @@ 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++ ) { @@ -2045,7 +2042,7 @@ void ChangeBodyType( INT8 bOffset ) //+1 or -1 only { gpSelected->pSoldier->ubBodyType = (UINT8)iIndex; //Set the flags based on the bodytype - gpSelected->pSoldier->uiStatusFlags &= ~(SOLDIER_VEHICLE | SOLDIER_ROBOT | SOLDIER_ANIMAL | SOLDIER_MONSTER); + gpSelected->pSoldier->flags.uiStatusFlags &= ~(SOLDIER_VEHICLE | SOLDIER_ROBOT | SOLDIER_ANIMAL | SOLDIER_MONSTER); switch( gpSelected->pSoldier->ubBodyType ) { case ADULTFEMALEMONSTER: @@ -2055,15 +2052,15 @@ void ChangeBodyType( INT8 bOffset ) //+1 or -1 only case LARVAE_MONSTER: case INFANT_MONSTER: case QUEENMONSTER: - gpSelected->pSoldier->uiStatusFlags |= SOLDIER_MONSTER; + gpSelected->pSoldier->flags.uiStatusFlags |= SOLDIER_MONSTER; break; case BLOODCAT: case COW: case CROW: - gpSelected->pSoldier->uiStatusFlags |= SOLDIER_ANIMAL; + gpSelected->pSoldier->flags.uiStatusFlags |= SOLDIER_ANIMAL; break; case ROBOTNOWEAPON: - gpSelected->pSoldier->uiStatusFlags |= SOLDIER_ROBOT; + gpSelected->pSoldier->flags.uiStatusFlags |= SOLDIER_ROBOT; break; case HUMVEE: case ELDORADO: @@ -2071,11 +2068,11 @@ void ChangeBodyType( INT8 bOffset ) //+1 or -1 only case JEEP: case TANK_NW: case TANK_NE: - gpSelected->pSoldier->uiStatusFlags |= SOLDIER_VEHICLE; + gpSelected->pSoldier->flags.uiStatusFlags |= SOLDIER_VEHICLE; break; } SetSoldierAnimationSurface( gpSelected->pSoldier, gpSelected->pSoldier->usAnimState ); - ConvertAniCodeToAniFrame( gpSelected->pSoldier, 0 ); + gpSelected->pSoldier->ConvertAniCodeToAniFrame( 0 ); } //Update the placement's info as well. gpSelected->pBasicPlacement->bBodyType = (INT8)iIndex; @@ -2088,7 +2085,7 @@ void ChangeBodyType( INT8 bOffset ) //+1 or -1 only gbCurrCreature = (INT8)iIndex; AssignCreatureInventory( gpSelected->pSoldier ); } - CreateSoldierPalettes( gpSelected->pSoldier ); + gpSelected->pSoldier->CreateSoldierPalettes( ); } void SetMercEditability( BOOLEAN fEditable ) @@ -2113,14 +2110,14 @@ void SetMercEditability( BOOLEAN fEditable ) ClickEditorButton( MERCS_TOGGLECOLOR_BUTTON ); DisableEditorButton( MERCS_PRIORITYEXISTANCE_CHECKBOX ); DisableEditorButton( MERCS_CIVILIAN_GROUP ); - } + } } -//There are 4 exclusive entry points in a map. Only one of each type can exist on a +//There are 4 exclusive entry points in a map. Only one of each type can exist on a //map, and these points are used to validate the map by attempting to connect the four -//points together. If one of the points is isolated, then the map will be rejected. It -//isn't necessary to specify all four points. You wouldn't want to specify a north point if +//points together. If one of the points is isolated, then the map will be rejected. It +//isn't necessary to specify all four points. You wouldn't want to specify a north point if //there isn't going to be any traversing to adjacent maps from that side. void SpecifyEntryPoint( UINT32 iMapIndex ) { @@ -2148,7 +2145,7 @@ void SpecifyEntryPoint( UINT32 iMapIndex ) AddToUndoList( *psEntryGridNo ); RemoveAllTopmostsOfTypeRange( *psEntryGridNo, FIRSTPOINTERS, FIRSTPOINTERS ); } - *psEntryGridNo = (UINT16)iMapIndex; + *psEntryGridNo = (INT16)iMapIndex; ValidateEntryPointGridNo( psEntryGridNo ); AddToUndoList( *psEntryGridNo ); AddTopmostToTail( *psEntryGridNo, FIRSTPOINTERS2 ); @@ -2177,9 +2174,9 @@ void SetMercEditingMode( UINT8 ubNewMode ) gubLastDetailedMercMode = gubCurrMercMode; //Depending on the mode we were just in, we may want to extract and update the - //merc first. Then we change modes... + //merc first. Then we change modes... ExtractCurrentMercModeInfo( TRUE ); - + //Change modes now. gubPrevMercMode = gubCurrMercMode; gubCurrMercMode = ubNewMode; @@ -2205,7 +2202,7 @@ void SetMercEditingMode( UINT8 ubNewMode ) //ClearCurrentSchedule(); break; } - + //If we leave the merc tab, then we want to update editable fields such as //attributes, which was just handled above, then turn everything off, and exit. if( ubNewMode == MERC_NOMODE ) @@ -2218,17 +2215,17 @@ void SetMercEditingMode( UINT8 ubNewMode ) { ShowEditorButtons( FIRST_MERCS_BUTTON, LAST_MERCS_TEAMMODE_BUTTON ); } - + //Release the currently selected merc if you just selected a new team. if( gsSelectedMercID != -1 && ubNewMode == MERC_TEAMMODE ) { //attempt to weed out conditions where we select a team that matches the currently - //selected merc. We don't want to deselect him in this case. + //selected merc. We don't want to deselect him in this case. if( gpSelected->pSoldier->bTeam == ENEMY_TEAM && iDrawMode == DRAW_MODE_ENEMY || gpSelected->pSoldier->bTeam == CREATURE_TEAM && iDrawMode == DRAW_MODE_CREATURE || gpSelected->pSoldier->bTeam == MILITIA_TEAM && iDrawMode == DRAW_MODE_REBEL || gpSelected->pSoldier->bTeam == CIV_TEAM && iDrawMode == DRAW_MODE_CIVILIAN ) - { //Same team, so don't deselect merc. Instead, keep the previous editing mode + { //Same team, so don't deselect merc. Instead, keep the previous editing mode //because we are still editing this merc. gubCurrMercMode = gubPrevMercMode; //if we don't have a detailed placement, auto set to basic mode. @@ -2259,9 +2256,9 @@ void SetMercEditingMode( UINT8 ubNewMode ) } else UnclickEditorButton( MERCS_DETAILEDCHECKBOX ); - //Now we are setting up the button states for the new mode, as well as show the + //Now we are setting up the button states for the new mode, as well as show the //applicable buttons for the detailed placement modes. - if( gubCurrMercMode == MERC_APPEARANCEMODE && iDrawMode == DRAW_MODE_CREATURE || + if( gubCurrMercMode == MERC_APPEARANCEMODE && iDrawMode == DRAW_MODE_CREATURE || gubCurrMercMode == MERC_SCHEDULEMODE && iDrawMode != DRAW_MODE_CIVILIAN ) { gubCurrMercMode = MERC_GENERALMODE; @@ -2293,7 +2290,7 @@ void SetMercEditingMode( UINT8 ubNewMode ) case MERC_BASICMODE: ShowEditorButtons( FIRST_MERCS_GENERAL_BUTTON, LAST_MERCS_GENERAL_BUTTON ); if( iDrawMode == DRAW_MODE_CREATURE ) - { //Set up alternate general mode. This one doesn't allow you to specify relative attributes + { //Set up alternate general mode. This one doesn't allow you to specify relative attributes //but requires you to specify a body type. HideEditorButtons( FIRST_MERCS_REL_EQUIPMENT_BUTTON, LAST_MERCS_REL_EQUIPMENT_BUTTON ); ShowEditorButtons( FIRST_MERCS_BODYTYPE_BUTTON, LAST_MERCS_BODYTYPE_BUTTON ); @@ -2308,7 +2305,7 @@ void SetMercEditingMode( UINT8 ubNewMode ) UnclickEditorButtons( FIRST_MERCS_PRIORITYMODE_BUTTON, LAST_MERCS_PRIORITYMODE_BUTTON ); ClickEditorButton( MERCS_GENERAL ); if( iDrawMode == DRAW_MODE_CREATURE ) - { //Set up alternate general mode. This one doesn't allow you to specify relative equipment + { //Set up alternate general mode. This one doesn't allow you to specify relative equipment //but requires you to specify a body type. HideEditorButtons( FIRST_MERCS_REL_EQUIPMENT_BUTTON, LAST_MERCS_REL_EQUIPMENT_BUTTON ); ShowEditorButtons( FIRST_MERCS_BODYTYPE_BUTTON, LAST_MERCS_BODYTYPE_BUTTON ); @@ -2353,7 +2350,7 @@ void SetMercEditingMode( UINT8 ubNewMode ) UnclickEditorButtons( FIRST_MERCS_PRIORITYMODE_BUTTON, LAST_MERCS_PRIORITYMODE_BUTTON ); ClickEditorButton( MERCS_SCHEDULE ); SetupTextInputForMercSchedule(); - UpdateScheduleInfo(); + UpdateScheduleInfo(); DetermineScheduleEditability(); } //Show or hide the schedule buttons @@ -2458,17 +2455,17 @@ void UpdateMercsInfo() DisplayBodyTypeInfo(); SetFont( SMALLCOMPFONT ); SetFontForeground( FONT_LTBLUE ); - mprintf( iScreenWidthOffset + 493, 2 * iScreenHeightOffset + 416, L"RELATIVE"); - mprintf( iScreenWidthOffset + 480, 2 * iScreenHeightOffset + 422, L"ATTRIBUTES"); + mprintf( iScreenWidthOffset + 493, 2 * iScreenHeightOffset + 416, L"RELATIVE"); + mprintf( iScreenWidthOffset + 480, 2 * iScreenHeightOffset + 422, L"ATTRIBUTES"); } else { SetFontForeground( FONT_LTGREEN ); - mprintf( iScreenWidthOffset + 480, 2 * iScreenHeightOffset + 363, L"RELATIVE"); - mprintf( iScreenWidthOffset + 480, 2 * iScreenHeightOffset + 371, L"EQUIPMENT"); + mprintf( iScreenWidthOffset + 480, 2 * iScreenHeightOffset + 363, L"RELATIVE"); + mprintf( iScreenWidthOffset + 480, 2 * iScreenHeightOffset + 371, L"EQUIPMENT"); SetFontForeground( FONT_LTBLUE ); - mprintf( iScreenWidthOffset + 530, 2 * iScreenHeightOffset + 363, L"RELATIVE"); - mprintf( iScreenWidthOffset + 530, 2 * iScreenHeightOffset + 371, L"ATTRIBUTES"); + mprintf( iScreenWidthOffset + 530, 2 * iScreenHeightOffset + 363, L"RELATIVE"); + mprintf( iScreenWidthOffset + 530, 2 * iScreenHeightOffset + 371, L"ATTRIBUTES"); } if( iDrawMode == DRAW_MODE_ENEMY ) { @@ -2507,17 +2504,17 @@ void UpdateMercsInfo() mprintf( iScreenWidthOffset + 396, 2 * iScreenHeightOffset + 364, L"Hair color:"); mprintf( iScreenWidthOffset + 396, 2 * iScreenHeightOffset + 388, L"Skin color:"); - mprintf( iScreenWidthOffset + 396, 2 * iScreenHeightOffset + 412, L"Vest color:"); + mprintf( iScreenWidthOffset + 396, 2 * iScreenHeightOffset + 412, L"Vest color:"); mprintf( iScreenWidthOffset + 396, 2 * iScreenHeightOffset + 436, L"Pant color:"); SetFont( SMALLCOMPFONT ); SetFontForeground( FONT_BLACK ); if( gpSelected->pDetailedPlacement->fVisible || gpSelected->pDetailedPlacement->ubProfile != NO_PROFILE ) { - mprintfEditor( iScreenWidthOffset + 396, 2 * iScreenHeightOffset + 374, L"%S ", gpSelected->pSoldier->HeadPal ); - mprintfEditor( iScreenWidthOffset + 396, 2 * iScreenHeightOffset + 398, L"%S ", gpSelected->pSoldier->SkinPal ); - mprintfEditor( iScreenWidthOffset + 396, 2 * iScreenHeightOffset + 422, L"%S ", gpSelected->pSoldier->VestPal ); - mprintfEditor( iScreenWidthOffset + 396, 2 * iScreenHeightOffset + 446, L"%S ", gpSelected->pSoldier->PantsPal ); + mprintfEditor( iScreenWidthOffset + 396, 2 * iScreenHeightOffset + 374, L"%S ", gpSelected->pSoldier->HeadPal ); + mprintfEditor( iScreenWidthOffset + 396, 2 * iScreenHeightOffset + 398, L"%S ", gpSelected->pSoldier->SkinPal ); + mprintfEditor( iScreenWidthOffset + 396, 2 * iScreenHeightOffset + 422, L"%S ", gpSelected->pSoldier->VestPal ); + mprintfEditor( iScreenWidthOffset + 396, 2 * iScreenHeightOffset + 446, L"%S ", gpSelected->pSoldier->PantsPal ); ShowEditMercPalettes( gpSelected->pSoldier ); } else @@ -2538,7 +2535,7 @@ void UpdateMercsInfo() CHAR16 tempStr[500]; swprintf( tempStr, L"%s%s%s%s%s%d.", L"By specifying a profile index, all of the information will be extracted from the profile ", - L"and override any values that you have edited. It will also disable the editing features ", + L"and override any values that you have edited. It will also disable the editing features ", L"though, you will still be able to view stats, etc. Pressing ENTER will automatically ", L"extract the number you have typed. A blank field will clear the profile. The current ", L"number of profiles range from 0 to ", NUM_PROFILES ); @@ -2547,13 +2544,13 @@ void UpdateMercsInfo() if( gpSelected->pDetailedPlacement->ubProfile == NO_PROFILE ) { SetFontForeground( FONT_GRAY3 ); - mprintfEditor( iScreenWidthOffset + 240, 2 * iScreenHeightOffset + 435, L"Current Profile: n/a "); + mprintfEditor( iScreenWidthOffset + 240, 2 * iScreenHeightOffset + 435, L"Current Profile: n/a "); } else { SetFontForeground( FONT_WHITE ); ClearTaskbarRegion( iScreenWidthOffset + 240, 2 * iScreenHeightOffset + 435, iScreenWidthOffset + 580, 2 * iScreenHeightOffset + 445 ); - mprintf( iScreenWidthOffset + 240, 2 * iScreenHeightOffset + 435, L"Current Profile: %s", gMercProfiles[ gpSelected->pDetailedPlacement->ubProfile ].zName ); + mprintf( iScreenWidthOffset + 240, 2 * iScreenHeightOffset + 435, L"Current Profile: %s", gMercProfiles[ gpSelected->pDetailedPlacement->ubProfile ].zName ); } } break; @@ -2561,7 +2558,7 @@ void UpdateMercsInfo() SetFont( FONT10ARIAL ); SetFontForeground( FONT_WHITE ); SetFontShadow( FONT_NEARBLACK ); - switch( gpSelected->pSoldier->bOrders ) + switch( gpSelected->pSoldier->aiData.bOrders ) { case STATIONARY: mprintf( iScreenWidthOffset + 430, 2 * iScreenHeightOffset + 363, L"STATIONARY" ); break; case ONCALL: mprintf( iScreenWidthOffset + 430, 2 * iScreenHeightOffset + 363, L"ON CALL" ); break; @@ -2606,11 +2603,11 @@ void UpdateMercsInfo() swprintf( str, L"Click on the gridno where you wish to move to." ); break; case SCHEDULE_INSTRUCTIONS_SLEEP: - swprintf( str, L"Click on the gridno where you wish to sleep at. Person will automatically return to original position after waking up." ); + swprintf( str, L"Click on the gridno where you wish to sleep at. Person will automatically return to original position after waking up." ); default: return; } - wcscat( str, L" Hit ESC to abort entering this line in the schedule." ); + wcscat( str, L" Hit ESC to abort entering this line in the schedule." ); DisplayWrappedString( iScreenWidthOffset + 436, 2 * iScreenHeightOffset + 392, 149, 2, FONT10ARIAL, FONT_YELLOW, str, FONT_BLACK, FALSE, LEFT_JUSTIFIED ); } break; @@ -2618,21 +2615,21 @@ void UpdateMercsInfo() } //When a detailed placement merc is in the inventory panel, there is a overall region -//blanketing this panel. As the user moves the mouse around and clicks, etc., this function -//is called by the region callback functions to handle these cases. The event types are defined -//in Editor Taskbar Utils.h. Here are the internal functions... +//blanketing this panel. As the user moves the mouse around and clicks, etc., this function +//is called by the region callback functions to handle these cases. The event types are defined +//in Editor Taskbar Utils.h. Here are the internal functions... -SGPRect mercRects[9] = +SGPRect mercRects[9] = { - { 75, 0, 104, 19 }, //head - { 75, 22, 104, 41 }, //body - { 76, 73, 105, 92 }, //legs - { 26, 43, 78, 62 }, //left hand + { 75, 0, 104, 19 }, //head + { 75, 22, 104, 41 }, //body + { 76, 73, 105, 92 }, //legs + { 26, 43, 78, 62 }, //left hand { 104, 42, 156, 61 }, //right hand - { 180, 6, 232, 25 }, //pack 1 + { 180, 6, 232, 25 }, //pack 1 { 180, 29, 232, 48 }, //pack 2 { 180, 52, 232, 71 }, //pack 3 - { 180, 75, 232, 94 } //pack 4 + { 180, 75, 232, 94 } //pack 4 }; @@ -2670,7 +2667,7 @@ void RenderSelectedMercsInventory() yp = mercRects[ i ].iTop + MERCPANEL_Y; pDst = LockVideoSurface( FRAME_BUFFER, &uiDstPitchBYTES ); pSrc = LockVideoSurface( guiMercInvPanelBuffers[i], &uiSrcPitchBYTES ); - Blt16BPPTo16BPPTrans( (UINT16*)pDst, uiDstPitchBYTES, + Blt16BPPTo16BPPTrans( (UINT16*)pDst, uiDstPitchBYTES, (UINT16 *)pSrc, uiSrcPitchBYTES, xp, yp, 0, 0, i<3 ? 22 : 44, 15, 0 ); UnLockVideoSurface( FRAME_BUFFER ); UnLockVideoSurface( guiMercInvPanelBuffers[i] ); @@ -2719,11 +2716,11 @@ void DeleteSelectedMercsItem() } //This function does two main things: -// 1) Allows a new item to be created via usItem and assigned to the currently selected merc. -// 2) Converts the image from interface size to the smaller panel used by the editor. The slots -// in the editor are approximately 80% of that size. This involves scaling calculations. These -// images are saved in individual slots are are blitted to the screen during rendering, not here. -// NOTE: Step one can be skipped (when selecting an existing merc). By setting the +// 1) Allows a new item to be created via usItem and assigned to the currently selected merc. +// 2) Converts the image from interface size to the smaller panel used by the editor. The slots +// in the editor are approximately 80% of that size. This involves scaling calculations. These +// images are saved in individual slots are are blitted to the screen during rendering, not here. +// NOTE: Step one can be skipped (when selecting an existing merc). By setting the void AddNewItemToSelectedMercsInventory( BOOLEAN fCreate ) { UINT32 uiVideoObjectIndex; @@ -2768,7 +2765,7 @@ void AddNewItemToSelectedMercsInventory( BOOLEAN fCreate ) //randomize the status on non-ammo items. if( !(Item[ gpSelected->pDetailedPlacement->Inv[ gbMercSlotTypes[ gbCurrSelect ] ].usItem ].usItemClass & IC_AMMO) ) - gpSelected->pDetailedPlacement->Inv[ gbMercSlotTypes[ gbCurrSelect ] ].ItemData.Generic.bStatus[0] = (INT8)(80 + Random( 21 )); + gpSelected->pDetailedPlacement->Inv[ gbMercSlotTypes[ gbCurrSelect ] ][0]->data.objectStatus = (INT8)(80 + Random( 21 )); if( gusMercsNewItemIndex ) { @@ -2779,7 +2776,7 @@ void AddNewItemToSelectedMercsInventory( BOOLEAN fCreate ) gpMercSlotItem[ gbCurrSelect ] = &gpSelected->pDetailedPlacement->Inv[ gbMercSlotTypes[ gbCurrSelect ] ]; if( !fCreate ) - { //it is possible to have a null item which we don't want to blit! Also, we need to set the + { //it is possible to have a null item which we don't want to blit! Also, we need to set the //new item index, so that it can extract the item's image using that. gusMercsNewItemIndex = gpMercSlotItem[ gbCurrSelect ]->usItem; if( !gpMercSlotItem[ gbCurrSelect ] ) @@ -2788,9 +2785,9 @@ void AddNewItemToSelectedMercsInventory( BOOLEAN fCreate ) //GOAL: //From here on, we are going to first render the new item into a temp buffer, then crop the image in //the buffer and scale it down to fit into it's associated slot in the panel (which on average will - //require scaling the item by 80%). We have to do a bunch of calculations to override the offsets, etc. + //require scaling the item by 80%). We have to do a bunch of calculations to override the offsets, etc. //Each slot has it's own smaller version buffer, and this is what gets drawn when the rendering happens. - + //assign the buffers uiSrcID = guiMercTempBuffer; uiDstID = guiMercInvPanelBuffers[ gbCurrSelect ]; @@ -2825,9 +2822,9 @@ void AddNewItemToSelectedMercsInventory( BOOLEAN fCreate ) pObject = &hVObject->pETRLEObject[ item->ubGraphicNum ]; iSrcWidth = pObject->usWidth; iSrcHeight = pObject->usHeight; - SrcRect.iLeft += pObject->sOffsetX; - SrcRect.iRight = SrcRect.iLeft + iSrcWidth; - SrcRect.iTop += pObject->sOffsetY; + SrcRect.iLeft += pObject->sOffsetX; + SrcRect.iRight = SrcRect.iLeft + iSrcWidth; + SrcRect.iTop += pObject->sOffsetY; SrcRect.iBottom = SrcRect.iTop + iSrcHeight; //if the source image width is less than 30 (small slot), then modify the DstRect. @@ -2837,9 +2834,9 @@ void AddNewItemToSelectedMercsInventory( BOOLEAN fCreate ) iDstWidth = MERCINV_LGSLOT_WIDTH; //compare the sizes of the cropped image to the destination buffer size, and calculate the - //scalar value. It is possible to have scalars > 1.0, in which case, we change it to 1.0 and - //use the other value. - rWidthScalar = (float)iDstWidth/(float)iSrcWidth; + //scalar value. It is possible to have scalars > 1.0, in which case, we change it to 1.0 and + //use the other value. + rWidthScalar = (float)iDstWidth/(float)iSrcWidth; if( rWidthScalar > 1.0 ) rWidthScalar = 1.0; rHeightScalar = (float)iDstHeight/(float)iSrcHeight; @@ -2853,7 +2850,7 @@ void AddNewItemToSelectedMercsInventory( BOOLEAN fCreate ) rScalar = rWidthScalar ; else rScalar = max( rWidthScalar, rHeightScalar ); - + //apply the scalar to the destination width and height iDstWidth = (INT32)( iSrcWidth * rScalar ); iDstHeight = (INT32)( iSrcHeight * rScalar ); @@ -2865,7 +2862,7 @@ void AddNewItemToSelectedMercsInventory( BOOLEAN fCreate ) iDstWidth = MERCINV_SMSLOT_WIDTH; if( iDstHeight > MERCINV_SLOT_HEIGHT ) iDstHeight = MERCINV_SLOT_HEIGHT; - + //use the new width and height values to calculate the new dest rect (center the item) DstRect.iLeft = (DstRect.iRight - DstRect.iLeft - iDstWidth) / 2; DstRect.iRight = DstRect.iLeft + iDstWidth; @@ -2893,7 +2890,7 @@ void RenderMercInventoryPanel() if( gbCurrHilite != -1 ) DrawRect( &mercRects[ gbCurrHilite ], Get16BPPColor( FROMRGB( 200, 200, 0 ) ) ); if( gbCurrSelect != -1 ) - DrawRect( &mercRects[ gbCurrSelect ], Get16BPPColor( FROMRGB( 200, 0, 0 ) ) ); + DrawRect( &mercRects[ gbCurrSelect ], Get16BPPColor( FROMRGB( 200, 0, 0 ) ) ); RenderSelectedMercsInventory(); InvalidateRegion( MERCPANEL_X, MERCPANEL_Y, iScreenWidthOffset + 475, 2 * iScreenHeightOffset + 460 ); UpdateItemStatsPanel(); @@ -2901,15 +2898,15 @@ void RenderMercInventoryPanel() //This function is called by the move and click callback functions for the region blanketing the -//9 slots in the inventory panel. It passes the event type as well as the relative x and y positions -//which are processed here. This basically checks for new changes in hilighting and selections, which +//9 slots in the inventory panel. It passes the event type as well as the relative x and y positions +//which are processed here. This basically checks for new changes in hilighting and selections, which //will set the rendering flag, and getitem flag if the user wishes to choose an item. void HandleMercInventoryPanel( INT16 sX, INT16 sY, INT8 bEvent ) { INT8 x; if( !gfCanEditMercs && bEvent == GUI_RCLICK_EVENT ) { //if we are dealing with a profile merc, we can't allow editing - //of items, but we can look at them. So, treat all right clicks + //of items, but we can look at them. So, treat all right clicks //as if they were left clicks. bEvent = GUI_LCLICK_EVENT; } @@ -2929,16 +2926,16 @@ void HandleMercInventoryPanel( INT16 sX, INT16 sY, INT8 bEvent ) } } //if we don't find a valid slot, then we need to turn it off. - if( gbCurrHilite != -1 ) - { //only turn off if it isn't already off. This avoids unecessary rendering. + if( gbCurrHilite != -1 ) + { //only turn off if it isn't already off. This avoids unecessary rendering. gbCurrHilite = -1; gfRenderMercInfo = TRUE; } break; case GUI_LCLICK_EVENT: case GUI_RCLICK_EVENT: - //The user has clicked in the inventory panel. Determine if he clicked in - //a slot. Left click selects the slot for editing, right clicking enables + //The user has clicked in the inventory panel. Determine if he clicked in + //a slot. Left click selects the slot for editing, right clicking enables //the user to choose an item for that slot. for( x = 0; x < 9; x++ ) { @@ -2970,19 +2967,17 @@ void UpdateMercItemSlots() gpMercSlotItem[ x ] = NULL; } } - else + else { if( gpSelected->pDetailedPlacement->ubProfile != NO_PROFILE ) { - // 0verhaul: Inventory is now a C++ class. Bad memcpy! No biscuit! - //memcpy( &gpSelected->pDetailedPlacement->Inv, &gpSelected->pSoldier->inv, sizeof( OBJECTTYPE ) * NUM_INV_SLOTS ); gpSelected->pDetailedPlacement->Inv = gpSelected->pSoldier->inv; } for( x = 0; x < 9; x++ ) { //Set the curr select and the addnewitem function will handle the rest, including rebuilding //the nine slot buffers, etc. - gbCurrSelect = x; + gbCurrSelect = x; AddNewItemToSelectedMercsInventory( FALSE ); } } @@ -3001,7 +2996,7 @@ void SetDroppableCheckboxesBasedOnMercsInventory() for( i = 0; i < 9; i++ ) { pItem = &gpSelected->pDetailedPlacement->Inv[ gbMercSlotTypes[ i ] ]; - if( pItem->fFlags & OBJECT_UNDROPPABLE ) + if( (*pItem).fFlags & OBJECT_UNDROPPABLE ) { //check box is clear UnclickEditorButton( MERCS_HEAD_SLOT + i ); } @@ -3026,8 +3021,8 @@ void SetEnemyColorCode( UINT8 ubColorCode ) gubSoldierClass = SOLDIER_CLASS_ARMY; if( gpSelected->pDetailedPlacement ) gpSelected->pDetailedPlacement->ubSoldierClass = SOLDIER_CLASS_ARMY; - SET_PALETTEREP_ID( gpSelected->pSoldier->VestPal, "REDVEST" ); - SET_PALETTEREP_ID( gpSelected->pSoldier->PantsPal, "GREENPANTS" ); + SET_PALETTEREP_ID( gpSelected->pSoldier->VestPal, "REDVEST" ); + SET_PALETTEREP_ID( gpSelected->pSoldier->PantsPal, "GREENPANTS" ); ClickEditorButton( MERCS_ARMY_CODE ); break; case SOLDIER_CLASS_ADMINISTRATOR: @@ -3036,16 +3031,16 @@ void SetEnemyColorCode( UINT8 ubColorCode ) if( gpSelected->pDetailedPlacement ) gpSelected->pDetailedPlacement->ubSoldierClass = SOLDIER_CLASS_ADMINISTRATOR; ClickEditorButton( MERCS_ADMIN_CODE ); - SET_PALETTEREP_ID( gpSelected->pSoldier->VestPal, "BLUEVEST" ); - SET_PALETTEREP_ID( gpSelected->pSoldier->PantsPal, "BLUEPANTS" ); + SET_PALETTEREP_ID( gpSelected->pSoldier->VestPal, "BLUEVEST" ); + SET_PALETTEREP_ID( gpSelected->pSoldier->PantsPal, "BLUEPANTS" ); break; case SOLDIER_CLASS_ELITE: gpSelected->pBasicPlacement->ubSoldierClass = SOLDIER_CLASS_ELITE; gubSoldierClass = SOLDIER_CLASS_ELITE; if( gpSelected->pDetailedPlacement ) gpSelected->pDetailedPlacement->ubSoldierClass = SOLDIER_CLASS_ELITE; - SET_PALETTEREP_ID( gpSelected->pSoldier->VestPal, "BLACKSHIRT" ); - SET_PALETTEREP_ID( gpSelected->pSoldier->PantsPal, "BLACKPANTS" ); + SET_PALETTEREP_ID( gpSelected->pSoldier->VestPal, "BLACKSHIRT" ); + SET_PALETTEREP_ID( gpSelected->pSoldier->PantsPal, "BLACKPANTS" ); ClickEditorButton( MERCS_ELITE_CODE ); break; case SOLDIER_CLASS_MINER: @@ -3054,19 +3049,19 @@ void SetEnemyColorCode( UINT8 ubColorCode ) gubSoldierClass = SOLDIER_CLASS_MINER; if( gpSelected->pDetailedPlacement ) gpSelected->pDetailedPlacement->ubSoldierClass = SOLDIER_CLASS_ELITE; - SET_PALETTEREP_ID( gpSelected->pSoldier->VestPal, "greyVEST" ); - SET_PALETTEREP_ID( gpSelected->pSoldier->PantsPal, "BEIGEPANTS" ); + SET_PALETTEREP_ID( gpSelected->pSoldier->VestPal, "greyVEST" ); + SET_PALETTEREP_ID( gpSelected->pSoldier->PantsPal, "BEIGEPANTS" ); break; default: return; } - CreateSoldierPalettes( gpSelected->pSoldier ); + gpSelected->pSoldier->CreateSoldierPalettes( ); } void SetEnemyDroppableStatus( UINT32 uiSlot, BOOLEAN fDroppable ) { - if( gpSelected ) + if( gpSelected ) { if( fDroppable ) { @@ -3085,7 +3080,7 @@ void SetEnemyDroppableStatus( UINT32 uiSlot, BOOLEAN fDroppable ) } if( gbCurrSelect != -1 && uiSlot == (UINT32)gbMercSlotTypes[ gbCurrSelect ] ) { - if( gpMercSlotItem[ gbCurrSelect ]->usItem == NOTHING ) + if( gpMercSlotItem[ gbCurrSelect ]->exists() == false ) SpecifyItemToEdit( gpMercSlotItem[ gbCurrSelect ], -1 ); } } @@ -3109,7 +3104,7 @@ void ChangeCivGroup( UINT8 ubNewCivGroup ) void RenderMercStrings() { - SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pSoldier; INT16 sXPos, sYPos; INT16 sX, sY; STR16 pStr; @@ -3140,7 +3135,7 @@ void RenderMercStrings() pStr = GetSoldierHealthString( pSoldier ); SetFont( TINYFONT1 ); - SetFontBackground( FONT_BLACK ); + SetFontBackground( FONT_BLACK ); SetFontForeground( FONT_RED ); FindFontCenterCoordinates( sXPos, sYPos, 80, 1, pStr, TINYFONT1, &sX, &sY ); @@ -3193,7 +3188,7 @@ void RenderMercStrings() { if( GetJA2Clock() % 1000 < 500 ) SetFontForeground( FONT_DKRED ); - else + else SetFontForeground( FONT_RED ); swprintf( str, L"Patrol orders with no waypoints" ); FindFontCenterCoordinates( sXPos, sYPos, 80, 1, str, TINYFONT1, &sX, &sY ); @@ -3209,7 +3204,7 @@ void RenderMercStrings() { if( GetJA2Clock() % 1000 < 500 ) SetFontForeground( FONT_DKRED ); - else + else SetFontForeground( FONT_RED ); swprintf( str, L"Waypoints with no patrol orders" ); FindFontCenterCoordinates( sXPos, sYPos, 80, 1, str, TINYFONT1, &sX, &sY ); @@ -3235,7 +3230,7 @@ void SetMercTeamVisibility( INT8 bTeam, BOOLEAN fVisible ) INT8 bVisible; curr = gSoldierInitHead; bVisible = fVisible ? 1 : -1; - while( curr ) + while( curr ) { if( curr->pBasicPlacement->bTeam == bTeam ) { @@ -3316,7 +3311,7 @@ void RegisterCurrentScheduleAction( INT32 iMapIndex ) if( gfSingleAction ) return; iDrawMode = DRAW_MODE_PLAYER + gpSelected->pBasicPlacement->bTeam; - gCurrSchedule.usData2[ gubCurrentScheduleActionIndex ] = (UINT16)iMapIndex; + gCurrSchedule.usData2[ gubCurrentScheduleActionIndex ] = (INT16)iMapIndex; SpecifyButtonText( iEditorButton[ MERCS_SCHEDULE_DATA1B + gubCurrentScheduleActionIndex ], str ); DetermineScheduleEditability(); gubScheduleInstructions = SCHEDULE_INSTRUCTIONS_NONE; @@ -3359,7 +3354,7 @@ void RegisterCurrentScheduleAction( INT32 iMapIndex ) case SCHEDULE_ACTION_NONE: break; } - gCurrSchedule.usData1[ gubCurrentScheduleActionIndex ] = (UINT16)iMapIndex; + gCurrSchedule.usData1[ gubCurrentScheduleActionIndex ] = (INT16)iMapIndex; SpecifyButtonText( iEditorButton[ MERCS_SCHEDULE_DATA1A + gubCurrentScheduleActionIndex ], str ); } } @@ -3419,7 +3414,7 @@ void StartScheduleAction() void UpdateScheduleAction( UINT8 ubNewAction ) { gCurrSchedule.ubAction[ gubCurrentScheduleActionIndex ] = ubNewAction; - SpecifyButtonText( iEditorButton[ MERCS_SCHEDULE_ACTION1 + gubCurrentScheduleActionIndex ], + SpecifyButtonText( iEditorButton[ MERCS_SCHEDULE_ACTION1 + gubCurrentScheduleActionIndex ], gszScheduleActions[ ubNewAction ] ); MSYS_SetBtnUserData( iEditorButton[ MERCS_SCHEDULE_ACTION1 + gubCurrentScheduleActionIndex ], 0, ubNewAction ); //Now, based on this action, disable the other buttons @@ -3430,7 +3425,7 @@ void UpdateScheduleAction( UINT8 ubNewAction ) // 0:1A, 1:1B, 2:2A, 3:2B, ... void FindScheduleGridNo( UINT8 ubScheduleData ) { - INT32 iMapIndex = 0xffff; + INT32 iMapIndex; switch( ubScheduleData ) { case 0: //1a @@ -3459,7 +3454,6 @@ void FindScheduleGridNo( UINT8 ubScheduleData ) break; default: AssertMsg( 0, "FindScheduleGridNo passed incorrect dataID." ); - return; } if( iMapIndex != 0xffff ) { @@ -3519,7 +3513,7 @@ void RenderCurrentSchedule() dOffsetY = (FLOAT)(sYMapPos * CELL_Y_SIZE) - gsRenderCenterY; FloatFromCellToScreenCoordinates( dOffsetX, dOffsetY, &ScrnX, &ScrnY); - + sScreenX = ( ( gsVIEWPORT_END_X - gsVIEWPORT_START_X ) /2 ) + (INT16)ScrnX; sScreenY = ( ( gsVIEWPORT_END_Y - gsVIEWPORT_START_Y ) /2 ) + (INT16)ScrnY; @@ -3570,7 +3564,7 @@ void UpdateScheduleInfo() SetExclusive24HourTimeValue( (UINT8)(i+1), pSchedule->usTime[i] ); } } - + //Check or uncheck the checkbox buttons based on the schedule's status. UnclickEditorButtons( MERCS_SCHEDULE_VARIANCE1, MERCS_SCHEDULE_VARIANCE4 ); if( pSchedule->usFlags & SCHEDULE_FLAGS_VARIANCE1 ) @@ -3606,7 +3600,6 @@ void CopyMercPlacement( INT32 iMapIndex ) memcpy( &gSaveBufferBasicPlacement, gpSelected->pBasicPlacement, sizeof( BASIC_SOLDIERCREATE_STRUCT ) ); if( gSaveBufferBasicPlacement.fDetailedPlacement ) { - // WDS - Clean up inventory handling gSaveBufferDetailedPlacement = *gpSelected->pDetailedPlacement; } ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Placement copied." ); @@ -3641,9 +3634,9 @@ void PasteMercPlacement( INT32 iMapIndex ) gTempBasicPlacement.bBodyType = gbCurrCreature; break; case DRAW_MODE_REBEL: - gTempBasicPlacement.bTeam = MILITIA_TEAM; + gTempBasicPlacement.bTeam = MILITIA_TEAM; gTempBasicPlacement.bBodyType = RANDOM; - break; + break; case DRAW_MODE_CIVILIAN: gTempBasicPlacement.bTeam = CIV_TEAM; gTempBasicPlacement.bBodyType = RANDOM; @@ -3660,19 +3653,17 @@ void PasteMercPlacement( INT32 iMapIndex ) UINT8 ubID; INT16 sSectorX, sSectorY; SOLDIERINITNODE *pNode; - + GetCurrentWorldSector( &sSectorX, &sSectorY ); //Set up some general information. //gTempBasicPlacement.fDetailedPlacement = TRUE; - gTempBasicPlacement.usStartingGridNo = (UINT16)iMapIndex; + gTempBasicPlacement.sStartingGridNo = (INT16)iMapIndex; //Generate detailed placement information given the temp placement information. if( gTempBasicPlacement.fDetailedPlacement ) { - // WDS - Clean up inventory handling - // WANNE: Removed the following line, didn't compile - //gTempDetailedPlacement = *gSaveBufferDetailedPlacement; + gTempDetailedPlacement = gSaveBufferDetailedPlacement; } else { @@ -3689,7 +3680,6 @@ void PasteMercPlacement( INT32 iMapIndex ) } else { - // WDS - Clean up inventory handling tempDetailedPlacement = gTempDetailedPlacement; } @@ -3698,7 +3688,7 @@ void PasteMercPlacement( INT32 iMapIndex ) { pSoldier->bVisible = 1; pSoldier->bLastRenderVisibleValue = 1; - //Set up the soldier in the list, so we can track the soldier in the + //Set up the soldier in the list, so we can track the soldier in the //future (saving, loading, strategic AI) pNode = AddBasicPlacementToSoldierInitList( &gTempBasicPlacement ); Assert( pNode ); @@ -3709,18 +3699,15 @@ void PasteMercPlacement( INT32 iMapIndex ) //allocate memory for new static detailed placement gTempBasicPlacement.fDetailedPlacement = TRUE; gTempBasicPlacement.fPriorityExistance = gSaveBufferBasicPlacement.fPriorityExistance; - // WDS - Clean up inventory handling - pNode->pDetailedPlacement = new SOLDIERCREATE_STRUCT; + pNode->pDetailedPlacement = new SOLDIERCREATE_STRUCT(gSaveBufferDetailedPlacement); + //copy the file information from temp var to node in list. if( !pNode->pDetailedPlacement ) { AssertMsg( 0, "Failed to allocate memory for new detailed placement in PasteMercPlacement." ); return; } - //copy the file information from temp var to node in list. - // WDS - Clean up inventory handling - *pNode->pDetailedPlacement = gSaveBufferDetailedPlacement; } - + //Add the soldier to physically appear on the map now. InternalAddSoldierToSector( ubID, FALSE, FALSE, 0, 0 ); IndicateSelectedMerc( ubID ); @@ -3731,7 +3718,7 @@ void PasteMercPlacement( INT32 iMapIndex ) gpSelected->pBasicPlacement->fOnRoof = TRUE; if( gpSelected->pDetailedPlacement ) gpSelected->pDetailedPlacement->fOnRoof = TRUE; - SetSoldierHeight( gpSelected->pSoldier, 58.0 ); + gpSelected->pSoldier->SetSoldierHeight( 58.0 ); } UnclickEditorButtons( FIRST_MERCS_INVENTORY_BUTTON, LAST_MERCS_INVENTORY_BUTTON ); for( i = FIRST_MERCS_INVENTORY_BUTTON; i <= LAST_MERCS_INVENTORY_BUTTON; i++ ) @@ -3752,6 +3739,7 @@ void PasteMercPlacement( INT32 iMapIndex ) - + + diff --git a/Editor/EditorMercs.h b/Editor/EditorMercs.h index df806252..cf188ce3 100644 --- a/Editor/EditorMercs.h +++ b/Editor/EditorMercs.h @@ -5,7 +5,7 @@ #ifndef __EDITORMERCS_H #define __EDITORMERCS_H -//Merc editing modes. These are used to determine which buttons to show and hide. +//Merc editing modes. These are used to determine which buttons to show and hide. enum { MERC_NOMODE, //used for shutting down mercs tab, to extract any changed information diff --git a/Editor/EditorTerrain.cpp b/Editor/EditorTerrain.cpp index 2a679498..7bafed27 100644 --- a/Editor/EditorTerrain.cpp +++ b/Editor/EditorTerrain.cpp @@ -72,7 +72,7 @@ void HideTerrainTileButtons() { DisableEditorRegion( x ); } - gfShowTerrainTileButtons=FALSE; + gfShowTerrainTileButtons=FALSE; } } @@ -85,7 +85,7 @@ void ShowTerrainTileButtons() { EnableEditorRegion( x ); } - gfShowTerrainTileButtons=TRUE; + gfShowTerrainTileButtons=TRUE; } } @@ -122,10 +122,10 @@ void RenderTerrainTileButtons() ColorFillVideoSurfaceArea(ButtonDestBuffer, usX + 1, usY + 1, usX2, usY2, usFillColorLight); } ColorFillVideoSurfaceArea(ButtonDestBuffer, usX + 1, usY + 1, usX2 - 1, usY2 - 1, 0); - + SetObjectShade( gTileDatabase[gTileTypeStartIndex[x]].hTileSurface, DEFAULT_SHADE_LEVEL ); - BltVideoObject(ButtonDestBuffer, gTileDatabase[gTileTypeStartIndex[x]].hTileSurface, 0, (usX + 1), (usY + 1), - VO_BLT_SRCTRANSPARENCY, NULL); + BltVideoObject(ButtonDestBuffer, gTileDatabase[gTileTypeStartIndex[x]].hTileSurface, 0, (usX + 1), (usY + 1), + VO_BLT_SRCTRANSPARENCY, NULL); if( fUseTerrainWeights ) { @@ -135,7 +135,7 @@ void RenderTerrainTileButtons() } } -//This callback is used for each of the terrain tile buttons. The userData[0] field +//This callback is used for each of the terrain tile buttons. The userData[0] field //contains the terrain button's index value. void TerrainTileButtonRegionCallback(MOUSE_REGION *reg,INT32 reason) { @@ -147,9 +147,9 @@ void TerrainTileButtonRegionCallback(MOUSE_REGION *reg,INT32 reason) { TerrainForegroundTile = TerrainTileSelected; CurrentPaste = (UINT16)TerrainForegroundTile; - //iEditorToolbarState = TBAR_MODE_DRAW; + //iEditorToolbarState = TBAR_MODE_DRAW; if( _KeyDown( SHIFT ) ) - { + { fUseTerrainWeights = TRUE; } if( fUseTerrainWeights ) @@ -161,7 +161,7 @@ void TerrainTileButtonRegionCallback(MOUSE_REGION *reg,INT32 reason) usTotalWeight++; } } - else + else { //Regular LEFTCLICK selects only that terrain tile. //When total weight is 0, then the only selected tile is drawn. ResetTerrainTileWeights(); @@ -195,7 +195,7 @@ void ChooseWeightedTerrainTile() UINT16 x, usWeight; INT16 sRandomNum; if(!usTotalWeight) - { //Not in the weighted mode. CurrentPaste will already contain the selected tile. + { //Not in the weighted mode. CurrentPaste will already contain the selected tile. return; } sRandomNum = rand() % usTotalWeight; @@ -228,7 +228,7 @@ void Fill( INT32 x, INT32 y ) if( count > maxCount ) maxCount = count; - + iMapIndex = y * WORLD_COLS + x; if( !GridNoOnVisibleWorldTile( (INT16)iMapIndex ) ) { @@ -261,15 +261,15 @@ void TerrainFill( UINT32 iMapIndex ) INT16 sX, sY; //determine what we should be looking for to replace... GetTileType( gpWorldLevelData[ iMapIndex ].pLandHead->usIndex, &guiSearchType ); - + //check terminating conditions if( guiSearchType == CurrentPaste ) return; - + ConvertGridNoToXY( (INT16)iMapIndex, &sX, &sY ); count = 0; - + Fill( sX, sY ); } @@ -279,6 +279,7 @@ void TerrainFill( UINT32 iMapIndex ) - + + diff --git a/Editor/EditorTerrain.h b/Editor/EditorTerrain.h index f4def4fd..360dabc7 100644 --- a/Editor/EditorTerrain.h +++ b/Editor/EditorTerrain.h @@ -14,7 +14,7 @@ //Soon to be added to an editor struct extern UINT16 usTotalWeight; extern BOOLEAN fPrevShowTerrainTileButtons; -extern BOOLEAN fUseTerrainWeights; +extern BOOLEAN fUseTerrainWeights; extern INT32 TerrainTileSelected, TerrainForegroundTile,TerrainBackgroundTile; extern INT32 TerrainTileDrawMode; diff --git a/Editor/Editor_2005Express.vcproj b/Editor/Editor_2005Express.vcproj index 71353b8a..fbc74b04 100644 --- a/Editor/Editor_2005Express.vcproj +++ b/Editor/Editor_2005Express.vcproj @@ -1,7 +1,7 @@ - + + + + + + + + + + + + + + + + + + diff --git a/Editor/Item Statistics.cpp b/Editor/Item Statistics.cpp index 961f9ce4..3643872c 100644 --- a/Editor/Item Statistics.cpp +++ b/Editor/Item Statistics.cpp @@ -20,7 +20,6 @@ #include "Item Statistics.h" #include "Text Input.h" #include "Action Items.h" - #include "Item types.h" #include "video.h" #include "Simple Render Utils.h" #include "Weapons.h" @@ -39,7 +38,7 @@ INT32 giSciFiCheckboxButton = -1; INT32 giAlarmTriggerButton = -1; INT32 giOwnershipGroupButton = -1; -CHAR16 gszActionItemDesc[ NUM_ACTIONITEMS ][ 30 ] = +CHAR16 gszActionItemDesc[ NUM_ACTIONITEMS ][ 30 ] = { L"Klaxon Mine", L"Flare Mine", @@ -81,9 +80,9 @@ const STR16 GetActionItemName( OBJECTTYPE *pItem ) { if( !pItem || pItem->usItem != ACTION_ITEM ) return NULL; - if( pItem->ItemData.Trigger.bActionValue != ACTION_ITEM_BLOW_UP ) + if( (*pItem)[0]->data.misc.bActionValue != ACTION_ITEM_BLOW_UP ) { - switch( pItem->ItemData.Trigger.bActionValue ) + switch( (*pItem)[0]->data.misc.bActionValue ) { case ACTION_ITEM_OPEN_DOOR: return gszActionItemDesc[ ACTIONITEM_OPEN ]; case ACTION_ITEM_CLOSE_DOOR: return gszActionItemDesc[ ACTIONITEM_CLOSE ]; @@ -111,7 +110,7 @@ const STR16 GetActionItemName( OBJECTTYPE *pItem ) default: return NULL; } } - else switch( pItem->ItemData.Trigger.usBombItem ) + else switch( (*pItem)[0]->data.misc.usBombItem ) { case STUN_GRENADE: return gszActionItemDesc[ ACTIONITEM_STUN ]; case SMOKE_GRENADE: return gszActionItemDesc[ ACTIONITEM_SMOKE ]; @@ -165,6 +164,7 @@ enum EDITING_GUNS, EDITING_AMMO, EDITING_ARMOUR, + EDITING_LBEGEAR, EDITING_EQUIPMENT, EDITING_EXPLOSIVES, EDITING_MONEY, @@ -198,6 +198,10 @@ void SetupArmourGUI(); void ExtractAndUpdateArmourGUI(); void RemoveArmourGUI(); +void SetupLBEGUI(); +void ExtractAndUpdateLBEGUI(); +void RemoveLBEGUI(); + void SetupEquipGUI(); void ExtractAndUpdateEquipGUI(); void RemoveEquipGUI(); @@ -277,6 +281,7 @@ void ExecuteItemStatsCmd( UINT8 ubAction ) case EDITING_GUNS: ExtractAndUpdateGunGUI(); break; case EDITING_AMMO: ExtractAndUpdateAmmoGUI(); break; case EDITING_ARMOUR: ExtractAndUpdateArmourGUI(); break; + case EDITING_LBEGEAR: ExtractAndUpdateLBEGUI(); break; case EDITING_EQUIPMENT: ExtractAndUpdateEquipGUI(); break; case EDITING_EXPLOSIVES: ExtractAndUpdateExplosivesGUI(); break; case EDITING_MONEY: ExtractAndUpdateMoneyGUI(); break; @@ -328,6 +333,7 @@ void RemoveItemGUI() case EDITING_GUNS: RemoveGunGUI(); break; case EDITING_AMMO: RemoveAmmoGUI(); break; case EDITING_ARMOUR: RemoveArmourGUI(); break; + case EDITING_LBEGEAR: RemoveLBEGUI(); break; case EDITING_EQUIPMENT: RemoveEquipGUI(); break; case EDITING_EXPLOSIVES: RemoveExplosivesGUI(); break; case EDITING_MONEY: RemoveMoneyGUI(); break; @@ -412,6 +418,10 @@ void SpecifyItemToEdit( OBJECTTYPE *pItem, INT32 iMapIndex ) gbEditingMode = EDITING_ARMOUR; SetupArmourGUI(); break; + case IC_LBEGEAR: + gbEditingMode = EDITING_LBEGEAR; + SetupLBEGUI(); + break; case IC_MEDKIT: case IC_KIT: case IC_MISC: @@ -435,7 +445,7 @@ void SpecifyItemToEdit( OBJECTTYPE *pItem, INT32 iMapIndex ) SetupKeysGUI(); break; case IC_PUNCH: - if ( gpItem->usItem != NOTHING) + if ( gpItem->exists() == true) { gbEditingMode = EDITING_EQUIPMENT; SetupEquipGUI(); @@ -444,7 +454,7 @@ void SpecifyItemToEdit( OBJECTTYPE *pItem, INT32 iMapIndex ) // else fall through and act as nothing case IC_NONE: gbEditingMode = EDITING_NOTHING; - if( !(gpItem->fFlags & OBJECT_UNDROPPABLE) ) + if( !((*gpItem).fFlags & OBJECT_UNDROPPABLE) ) gbEditingMode = EDITING_DROPPABLE; break; default: @@ -473,7 +483,7 @@ void UpdateItemStatsPanel() SetFontForeground( FONT_GRAY2 ); SetFontShadow( FONT_NEARBLACK ); SetFontBackground( FONT_BLACK ); - if( gpItem && iCurrentTaskbar == TASK_ITEMS && + if( gpItem && iCurrentTaskbar == TASK_ITEMS && gbEditingMode != EDITING_TRIGGERS && gbEditingMode != EDITING_ACTIONITEMS ) { mprintf( iScreenWidthOffset + 500, 2 * iScreenHeightOffset + 366, L"Toggle hide flag" ); @@ -516,6 +526,7 @@ void UpdateItemStatsPanel() mprintf( iScreenWidthOffset + 512, 2 * iScreenHeightOffset + 404, L"Trap Level" ); break; case EDITING_ARMOUR: + case EDITING_LBEGEAR: case EDITING_EQUIPMENT: mprintf( iScreenWidthOffset + 512, 2 * iScreenHeightOffset + 384, L"Status" ); mprintf( iScreenWidthOffset + 512, 2 * iScreenHeightOffset + 404, L"Trap Level" ); @@ -535,7 +546,7 @@ void UpdateItemStatsPanel() case EDITING_TRIGGERS: mprintf( iScreenWidthOffset + 512, 2 * iScreenHeightOffset + 369, L"Trap Level"); mprintf( iScreenWidthOffset + 512, 2 * iScreenHeightOffset + 389, L"Tolerance" ); - if( gpEditingItemPool && gpItem->ItemData.Trigger.BombTrigger.bFrequency >= PANIC_FREQUENCY_3 && gpItem->ItemData.Trigger.BombTrigger.bFrequency <= PANIC_FREQUENCY ) + if( gpEditingItemPool && (*gpItem)[0]->data.misc.bFrequency >= PANIC_FREQUENCY_3 && (*gpItem)[0]->data.misc.bFrequency <= PANIC_FREQUENCY ) mprintf( iScreenWidthOffset + 500, 2 * iScreenHeightOffset + 407, L"Alarm Trigger" ); break; } @@ -546,7 +557,7 @@ void UpdateItemStatsPanel() SetFontForeground( FONT_YELLOW ); else if( iPercent >= 50 ) SetFontForeground( FONT_ORANGE ); - else + else SetFontForeground( FONT_RED ); mprintf( iScreenWidthOffset + 512, 2 * iScreenHeightOffset + 444, L"Exist Chance" ); mprintf( iScreenWidthOffset + 587, 2 * iScreenHeightOffset + 366, L"B" ); @@ -601,16 +612,16 @@ void SetupGameTypeFlags() { if( gpEditingItemPool ) { - giBothCheckboxButton = + giBothCheckboxButton = CreateCheckBoxButton( iScreenWidthOffset + 573, 2 * iScreenHeightOffset + 365, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, BothModesCheckboxCallback ); SetButtonFastHelpText( giBothCheckboxButton, L"Item appears in both Sci-Fi and Realistic modes. (|B)" ); - giRealisticCheckboxButton = + giRealisticCheckboxButton = CreateCheckBoxButton( iScreenWidthOffset + 595, 2 * iScreenHeightOffset + 365, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, RealisticOnlyCheckboxCallback ); SetButtonFastHelpText( giRealisticCheckboxButton, L"Item appears in |Realistic mode only." ); - giSciFiCheckboxButton = + giSciFiCheckboxButton = CreateCheckBoxButton( iScreenWidthOffset + 616, 2 * iScreenHeightOffset + 365, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, SciFiOnlyCheckboxCallback ); SetButtonFastHelpText( giSciFiCheckboxButton, L"Item appears in |Sci-Fi mode only." ); - + if( gWorldItems[ gpEditingItemPool->iItemIndex ].usFlags & WORLD_ITEM_REALISTIC_ONLY ) ButtonList[ giRealisticCheckboxButton ]->uiFlags |= (BUTTON_CLICKED_ON | BUTTON_DIRTY); else if( gWorldItems[ gpEditingItemPool->iItemIndex ].usFlags & WORLD_ITEM_SCIFI_ONLY ) @@ -644,28 +655,28 @@ void SetupGunGUI() CHAR16 str[20]; INT16 yp; memset( gfAttachment, 0, NUM_ATTACHMENT_BUTTONS ); - swprintf( str, L"%d", gpItem->ItemData.Gun.bGunStatus ); + swprintf( str, L"%d", (*gpItem)[0]->data.gun.bGunStatus ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); - swprintf( str, L"%d", gpItem->ItemData.Gun.ubGunShotsLeft ); + swprintf( str, L"%d", (*gpItem)[0]->data.gun.ubGunShotsLeft ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); - swprintf( str, L"%d", gpItem->bTrap ); + swprintf( str, L"%d", (*gpItem)[0]->data.bTrap ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 420, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT ); if( gpEditingItemPool ) { swprintf( str, L"%d", 100 - gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 440, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); } - //Attachments are a dynamic part of guns. None, some, or all attachments could be available - //for a particular weapon. Show only the ones that we can apply to this gun. + //Attachments are a dynamic part of guns. None, some, or all attachments could be available + //for a particular weapon. Show only the ones that we can apply to this gun. yp = 2 * iScreenHeightOffset + 383; guiAttachmentButton[ SILENCER_ATTACHMENT_BUTTON ] = -1; if( ValidAttachment( SILENCER, gpItem->usItem ) ) { - guiAttachmentButton[ SILENCER_ATTACHMENT_BUTTON ] = + guiAttachmentButton[ SILENCER_ATTACHMENT_BUTTON ] = CreateTextButton( L"SILENCER", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, iScreenWidthOffset + 570, yp, 60, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleAttachment ); yp += 14; - if( FindAttachment( gpItem, SILENCER ) != -1 ) + if( FindAttachment( gpItem, SILENCER ) ) { ButtonList[ guiAttachmentButton[ SILENCER_ATTACHMENT_BUTTON ] ]->uiFlags |= BUTTON_CLICKED_ON; gfAttachment[0] = TRUE; @@ -674,11 +685,11 @@ void SetupGunGUI() guiAttachmentButton[ SNIPERSCOPE_ATTACHMENT_BUTTON ] = -1; if( ValidAttachment( SNIPERSCOPE, gpItem->usItem ) ) { - guiAttachmentButton[ SNIPERSCOPE_ATTACHMENT_BUTTON ] = + guiAttachmentButton[ SNIPERSCOPE_ATTACHMENT_BUTTON ] = CreateTextButton( L"SNIPERSCOPE", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, iScreenWidthOffset + 570, yp, 60, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleAttachment ); yp += 14; - if( FindAttachment( gpItem, SNIPERSCOPE ) != -1 ) + if( FindAttachment( gpItem, SNIPERSCOPE ) ) { ButtonList[ guiAttachmentButton[ SNIPERSCOPE_ATTACHMENT_BUTTON ] ]->uiFlags |= BUTTON_CLICKED_ON; gfAttachment[1] = TRUE; @@ -687,11 +698,11 @@ void SetupGunGUI() guiAttachmentButton[ LASERSCOPE_ATTACHMENT_BUTTON ] = -1; if( ValidAttachment( LASERSCOPE, gpItem->usItem ) ) { - guiAttachmentButton[ LASERSCOPE_ATTACHMENT_BUTTON ] = + guiAttachmentButton[ LASERSCOPE_ATTACHMENT_BUTTON ] = CreateTextButton( L"LASERSCOPE", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, iScreenWidthOffset + 570, yp, 60, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleAttachment ); yp += 14; - if( FindAttachment( gpItem, LASERSCOPE ) != -1 ) + if( FindAttachment( gpItem, LASERSCOPE ) ) { ButtonList[ guiAttachmentButton[ LASERSCOPE_ATTACHMENT_BUTTON ] ]->uiFlags |= BUTTON_CLICKED_ON; gfAttachment[2] = TRUE; @@ -700,11 +711,11 @@ void SetupGunGUI() guiAttachmentButton[ BIPOD_ATTACHMENT_BUTTON ] = -1; if( ValidAttachment( BIPOD, gpItem->usItem ) ) { - guiAttachmentButton[ BIPOD_ATTACHMENT_BUTTON ] = + guiAttachmentButton[ BIPOD_ATTACHMENT_BUTTON ] = CreateTextButton( L"BIPOD", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, iScreenWidthOffset + 570, yp, 60, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleAttachment ); yp += 14; - if( FindAttachment( gpItem, BIPOD ) != -1 ) + if( FindAttachment( gpItem, BIPOD ) ) { ButtonList[ guiAttachmentButton[ BIPOD_ATTACHMENT_BUTTON ] ]->uiFlags |= BUTTON_CLICKED_ON; gfAttachment[3] = TRUE; @@ -713,11 +724,11 @@ void SetupGunGUI() guiAttachmentButton[ DUCKBILL_ATTACHMENT_BUTTON ] = -1; if( ValidAttachment( DUCKBILL, gpItem->usItem ) ) { - guiAttachmentButton[ DUCKBILL_ATTACHMENT_BUTTON ] = + guiAttachmentButton[ DUCKBILL_ATTACHMENT_BUTTON ] = CreateTextButton( L"DUCKBILL", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, iScreenWidthOffset + 570, yp, 60, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleAttachment ); yp += 14; - if( FindAttachment( gpItem, DUCKBILL ) != -1 ) + if( FindAttachment( gpItem, DUCKBILL ) ) { ButtonList[ guiAttachmentButton[ DUCKBILL_ATTACHMENT_BUTTON ] ]->uiFlags |= BUTTON_CLICKED_ON; gfAttachment[4] = TRUE; @@ -726,11 +737,11 @@ void SetupGunGUI() guiAttachmentButton[ GLAUNCHER_ATTACHMENT_BUTTON ] = -1; if( ValidAttachment( UNDER_GLAUNCHER, gpItem->usItem ) ) { - guiAttachmentButton[ GLAUNCHER_ATTACHMENT_BUTTON ] = + guiAttachmentButton[ GLAUNCHER_ATTACHMENT_BUTTON ] = CreateTextButton( L"G-LAUNCHER", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, iScreenWidthOffset + 570, yp, 60, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleAttachment ); yp += 14; - if( FindAttachment( gpItem, UNDER_GLAUNCHER ) != -1 ) + if( FindAttachment( gpItem, UNDER_GLAUNCHER ) ) { ButtonList[ guiAttachmentButton[ GLAUNCHER_ATTACHMENT_BUTTON ] ]->uiFlags |= BUTTON_CLICKED_ON; gfAttachment[5] = TRUE; @@ -761,7 +772,7 @@ void ExtractAndUpdateGunGUI() i = 20 + Random( 81 ); else i = min( i, 100 ); - gpItem->ItemData.Gun.bGunStatus = (INT8)i; + (*gpItem)[0]->data.gun.bGunStatus = (INT8)i; SetInputFieldStringWithNumericStrictValue( 1, i ); //Update the ammo i = GetNumericStrictValueFromField( 2 ); @@ -769,12 +780,12 @@ void ExtractAndUpdateGunGUI() i = Random( 1 + Weapon[ gpItem->usItem ].ubMagSize ); else i = min( i, Weapon[ gpItem->usItem ].ubMagSize ); - gpItem->ItemData.Gun.ubGunShotsLeft = (UINT8)i; + (*gpItem)[0]->data.gun.ubGunShotsLeft = (UINT8)i; SetInputFieldStringWithNumericStrictValue( 2, i ); //Update the trap level i = GetNumericStrictValueFromField( 3 ); i = ( i == -1 ) ? 0 : min( i, 20 ); - gpItem->bTrap = (INT8)i; + (*gpItem)[0]->data.bTrap = (INT8)i; SetInputFieldStringWithNumericStrictValue( 3, i ); if( gpEditingItemPool ) { @@ -790,7 +801,7 @@ void SetupAmmoGUI() CHAR16 str[20]; swprintf( str, L"%d", gpItem->ubNumberOfObjects ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 1, INPUTTYPE_NUMERICSTRICT ); - swprintf( str, L"%d", gpItem->bTrap ); + swprintf( str, L"%d", (*gpItem)[0]->data.bTrap ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT ); if( gpEditingItemPool ) { @@ -810,16 +821,15 @@ void ExtractAndUpdateAmmoGUI() //Update the number of clips i = GetNumericStrictValueFromField( 1 ); if( i == -1 ) - i = 1 + Random( Item[ gpItem->usItem ].ubPerPocket ); + i = 1 + Random( ItemSlotLimit(gpItem, STACK_SIZE_LIMIT) ); else - i = max( 1, min( i, Item[ gpItem->usItem ].ubPerPocket ) ); - gpItem->ubNumberOfObjects = (UINT8)i; + i = max( 1, min( i, ItemSlotLimit(gpItem, STACK_SIZE_LIMIT) ) ); SetInputFieldStringWithNumericStrictValue( 1, i ); - CreateItems( gpItem->usItem, 100, gpItem->ubNumberOfObjects, gpItem ); + CreateItems( gpItem->usItem, 100, i, gpItem ); //Update the trap level i = GetNumericStrictValueFromField( 2 ); i = ( i == -1 ) ? 0 : min( i, 20 ); - gpItem->bTrap = (INT8)i; + (*gpItem)[0]->data.bTrap = (INT8)i; SetInputFieldStringWithNumericStrictValue( 2, i ); if( gpEditingItemPool ) { @@ -833,9 +843,9 @@ void ExtractAndUpdateAmmoGUI() void SetupArmourGUI() { CHAR16 str[20]; - swprintf( str, L"%d", gpItem->ItemData.Generic.bStatus[0] ); + swprintf( str, L"%d", (*gpItem)[0]->data.objectStatus ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); - swprintf( str, L"%d", gpItem->bTrap ); + swprintf( str, L"%d", (*gpItem)[0]->data.bTrap ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT ); if( gpEditingItemPool ) { @@ -846,10 +856,10 @@ void SetupArmourGUI() guiCeramicPlatesButton = -1; if( ValidAttachment( CERAMIC_PLATES, gpItem->usItem ) ) { - guiCeramicPlatesButton = + guiCeramicPlatesButton = CreateTextButton( L"CERAMIC PLATES", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, iScreenWidthOffset + 558, 2 * iScreenHeightOffset + 375, 72, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleCeramicPlates ); - if( FindAttachment( gpItem, CERAMIC_PLATES ) != -1 ) + if( FindAttachment( gpItem, CERAMIC_PLATES ) ) { ButtonList[ guiCeramicPlatesButton ]->uiFlags |= BUTTON_CLICKED_ON; gfCeramicPlates = TRUE; @@ -875,12 +885,56 @@ void ExtractAndUpdateArmourGUI() i = 20 + Random( 81 ); else i = min( i, 100 ); - gpItem->ItemData.Generic.bStatus[0] = (INT8)i; + (*gpItem)[0]->data.objectStatus = (INT8)i; SetInputFieldStringWithNumericStrictValue( 1, i ); //Update the trap level i = GetNumericStrictValueFromField( 2 ); i = ( i == -1 ) ? 0 : min( i, 20 ); - gpItem->bTrap = (INT8)i; + (*gpItem)[0]->data.bTrap = (INT8)i; + SetInputFieldStringWithNumericStrictValue( 2, i ); + if( gpEditingItemPool ) + { + giDefaultExistChance = GetNumericStrictValueFromField( 3 ); + giDefaultExistChance = ( giDefaultExistChance == -1 ) ? 100 : max( 1, min( giDefaultExistChance, 100 ) ); + gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance = (UINT8)(100 - giDefaultExistChance ); + SetInputFieldStringWithNumericStrictValue( 3, giDefaultExistChance ); + } +} + +void SetupLBEGUI() +{ + CHAR16 str[20]; + swprintf( str, L"%d", (*gpItem)[0]->data.objectStatus ); + AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + swprintf( str, L"%d", (*gpItem)[0]->data.bTrap ); + AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT ); + if( gpEditingItemPool ) + { + swprintf( str, L"%d", 100 - gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance ); + AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 440, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + } +} + +void RemoveLBEGUI() +{ + //nothing to remove +} + +void ExtractAndUpdateLBEGUI() +{ + INT32 i; + //Update the equipment status + i = GetNumericStrictValueFromField( 1 ); + if( i == -1 ) + i = 20 + Random( 81 ); + else + i = min( i, 100 ); + (*gpItem)[0]->data.objectStatus = (INT8)i; + SetInputFieldStringWithNumericStrictValue( 1, i ); + //Update the trap level + i = GetNumericStrictValueFromField( 2 ); + i = ( i == -1 ) ? 0 : min( i, 20 ); + (*gpItem)[0]->data.bTrap = (INT8)i; SetInputFieldStringWithNumericStrictValue( 2, i ); if( gpEditingItemPool ) { @@ -894,9 +948,9 @@ void ExtractAndUpdateArmourGUI() void SetupEquipGUI() { CHAR16 str[20]; - swprintf( str, L"%d", gpItem->ItemData.Generic.bStatus[0] ); + swprintf( str, L"%d", (*gpItem)[0]->data.objectStatus ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); - swprintf( str, L"%d", gpItem->bTrap ); + swprintf( str, L"%d", (*gpItem)[0]->data.bTrap ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT ); if( gpEditingItemPool ) { @@ -919,12 +973,12 @@ void ExtractAndUpdateEquipGUI() i = 20 + Random( 81 ); else i = min( i, 100 ); - gpItem->ItemData.Generic.bStatus[0] = (INT8)i; + (*gpItem)[0]->data.objectStatus = (INT8)i; SetInputFieldStringWithNumericStrictValue( 1, i ); //Update the trap level i = GetNumericStrictValueFromField( 2 ); i = ( i == -1 ) ? 0 : min( i, 20 ); - gpItem->bTrap = (INT8)i; + (*gpItem)[0]->data.bTrap = (INT8)i; SetInputFieldStringWithNumericStrictValue( 2, i ); if( gpEditingItemPool ) { @@ -939,15 +993,15 @@ void SetupExplosivesGUI() { CHAR16 str[20]; INT16 yp; - swprintf( str, L"%d", gpItem->ItemData.Generic.bStatus[0] ); + swprintf( str, L"%d", (*gpItem)[0]->data.objectStatus ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); swprintf( str, L"%d", gpItem->ubNumberOfObjects ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 1, INPUTTYPE_NUMERICSTRICT ); - if( Item[ gpItem->usItem ].ubPerPocket == 1 ) + if( ItemSlotLimit(gpItem, STACK_SIZE_LIMIT)== 1 ) { DisableTextField( 2 ); } - swprintf( str, L"%d", gpItem->bTrap ); + swprintf( str, L"%d", (*gpItem)[0]->data.bTrap ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 420, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT ); if( gpEditingItemPool ) { @@ -959,11 +1013,11 @@ void SetupExplosivesGUI() guiDetonatorButton = -1; if( ValidAttachment( DETONATOR, gpItem->usItem ) ) { - guiDetonatorButton = + guiDetonatorButton = CreateTextButton( L"DETONATOR", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, iScreenWidthOffset + 570, yp, 60, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleDetonator ); yp += 14; - if( FindAttachment( gpItem, DETONATOR ) != -1 ) + if( FindAttachment( gpItem, DETONATOR ) ) { ButtonList[ guiDetonatorButton ]->uiFlags |= BUTTON_CLICKED_ON; gfDetonator = TRUE; @@ -989,24 +1043,23 @@ void ExtractAndUpdateExplosivesGUI() i = 20 + Random( 81 ); else i = min( i, 100 ); - gpItem->ItemData.Generic.bStatus[0] = (INT8)i; + (*gpItem)[0]->data.objectStatus = (INT8)i; SetInputFieldStringWithNumericStrictValue( 1, i ); //Update the quantity - if( Item[ gpItem->usItem ].ubPerPocket > 1 ) + if( ItemSlotLimit(gpItem, STACK_SIZE_LIMIT) > 1 ) { i = GetNumericStrictValueFromField( 2 ); if( i == -1 ) - i = 1 + Random( Item[ gpItem->usItem ].ubPerPocket ); + i = 1 + Random( ItemSlotLimit(gpItem, STACK_SIZE_LIMIT) ); else - i = max( 1, min( i, Item[ gpItem->usItem ].ubPerPocket ) ); - gpItem->ubNumberOfObjects = (UINT8)i; + i = max( 1, min( i, ItemSlotLimit(gpItem, STACK_SIZE_LIMIT) ) ); SetInputFieldStringWithNumericStrictValue( 2, i ); - CreateItems( gpItem->usItem, gpItem->ItemData.Generic.bStatus[0], gpItem->ubNumberOfObjects, gpItem ); + CreateItems( gpItem->usItem, (INT8)(*gpItem)[0]->data.objectStatus, i, gpItem ); } //Update the trap level i = GetNumericStrictValueFromField( 3 ); - i = ( i == -1 ) ? 0 : min( i, 20 ); - gpItem->bTrap = (INT8)i; + i = ( i == -1 ) ? 0 : min( i, 20 ); + (*gpItem)[0]->data.bTrap = (INT8)i; SetInputFieldStringWithNumericStrictValue( 3, i ); if( gpEditingItemPool ) { @@ -1020,7 +1073,7 @@ void ExtractAndUpdateExplosivesGUI() void SetupMoneyGUI() { CHAR16 str[20]; - swprintf( str, L"%d", gpItem->ItemData.Money.uiMoneyAmount ); + swprintf( str, L"%d", (*gpItem)[0]->data.money.uiMoneyAmount ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 45, 15, MSYS_PRIORITY_NORMAL, str, 5, INPUTTYPE_NUMERICSTRICT ); if( gpEditingItemPool ) { @@ -1038,8 +1091,8 @@ void ExtractAndUpdateMoneyGUI() i = Random( 20000 ); else i = max( 1, min( i, 20000 ) ); - gpItem->ItemData.Money.uiMoneyAmount = i; - gpItem->ItemData.Money.bMoneyStatus = 100; + (*gpItem)[0]->data.money.uiMoneyAmount = i; + (*gpItem)[0]->data.objectStatus = 100; SetInputFieldStringWithNumericStrictValue( 1, i ); if( gpEditingItemPool ) { @@ -1058,10 +1111,10 @@ void RemoveMoneyGUI() void SetupOwnershipGUI() { CHAR16 str[20]; - swprintf( str, L"%d", gpItem->ItemData.Owner.ubOwnerProfile ); + swprintf( str, L"%d", (*gpItem)[0]->data.owner.ubOwnerProfile ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); - giOwnershipGroupButton = - CreateTextButton( gszCivGroupNames[ gpItem->ItemData.Owner.ubOwnerCivGroup ], SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + giOwnershipGroupButton = + CreateTextButton( gszCivGroupNames[ (*gpItem)[0]->data.owner.ubOwnerCivGroup ], SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 415, 80, 25, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, OwnershipGroupButtonCallback ); } @@ -1075,7 +1128,7 @@ void OwnershipGroupButtonCallback( GUI_BUTTON *btn, INT32 reason ) void SetOwnershipGroup( UINT8 ubNewGroup ) { - gpItem->ItemData.Owner.ubOwnerCivGroup = ubNewGroup; + (*gpItem)[0]->data.owner.ubOwnerCivGroup = ubNewGroup; SpecifyButtonText( giOwnershipGroupButton, gszCivGroupNames[ ubNewGroup ] ); } @@ -1088,7 +1141,7 @@ void ExtractAndUpdateOwnershipGUI() i = Random( 0 ); else i = max( 0, min( i, 255 ) ); - gpItem->ItemData.Owner.ubOwnerProfile = (UINT8)i; + (*gpItem)[0]->data.owner.ubOwnerProfile = (UINT8)i; SetInputFieldStringWithNumericStrictValue( 1, i ); } @@ -1131,9 +1184,9 @@ void SetupActionItemsGUI() { CHAR16 str[4]; STR16 pStr; - swprintf( str, L"%d", gpItem->ItemData.Generic.bStatus[0] ); + swprintf( str, L"%d", (*gpItem)[0]->data.objectStatus ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 365, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); - swprintf( str, L"%d", gpItem->bTrap ); + swprintf( str, L"%d", (*gpItem)[0]->data.bTrap ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 385, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT ); if( gpEditingItemPool ) { @@ -1141,7 +1194,7 @@ void SetupActionItemsGUI() AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 440, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); } pStr = GetActionItemName( gpItem ); - guiActionItemButton = + guiActionItemButton = CreateTextButton( pStr, FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, iScreenWidthOffset + 510, 2 * iScreenHeightOffset + 410, 100, 20, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ActionItemCallback ); } @@ -1155,14 +1208,14 @@ void ExtractAndUpdateActionItemsGUI() i = 20 + Random( 81 ); else i = min( i, 100 ); - gpItem->ItemData.Generic.bStatus[0] = (INT8)i; + (*gpItem)[0]->data.objectStatus = (INT8)i; SetInputFieldStringWithNumericStrictValue( 1, i ); //Update the trap level i = GetNumericStrictValueFromField( 2 ); i = ( i == -1 ) ? 0 : min( i, 20 ); - if( i != gpItem->bTrap ) + if( i != (*gpItem)[0]->data.bTrap ) gbDefaultBombTrapLevel = (INT8)i; - gpItem->bTrap = (INT8)i; + (*gpItem)[0]->data.bTrap = (INT8)i; SetInputFieldStringWithNumericStrictValue( 2, i ); if( gpEditingItemPool ) @@ -1188,29 +1241,29 @@ void AlarmTriggerCheckboxCallback( GUI_BUTTON *btn, INT32 reason ) if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if( btn->uiFlags & BUTTON_CLICKED_ON ) - gpItem->fFlags |= OBJECT_ALARM_TRIGGER; + (*gpItem).fFlags |= OBJECT_ALARM_TRIGGER; else - gpItem->fFlags &= ~OBJECT_ALARM_TRIGGER; + (*gpItem).fFlags &= ~OBJECT_ALARM_TRIGGER; } } void SetupTriggersGUI() { CHAR16 str[4]; - swprintf( str, L"%d", gpItem->bTrap ); + swprintf( str, L"%d", (*gpItem)[0]->data.bTrap ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 365, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); - swprintf( str, L"%d", gpItem->ItemData.Trigger.Area.ubTolerance ); + swprintf( str, L"%d", (*gpItem)[0]->data.misc.ubTolerance ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 385, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); if( gpEditingItemPool ) { swprintf( str, L"%d", 100 - gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 440, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); - if( gpItem->ItemData.Trigger.BombTrigger.bFrequency <= PANIC_FREQUENCY && gpItem->ItemData.Trigger.BombTrigger.bFrequency >= PANIC_FREQUENCY_3 ) + if( (*gpItem)[0]->data.misc.bFrequency <= PANIC_FREQUENCY && (*gpItem)[0]->data.misc.bFrequency >= PANIC_FREQUENCY_3 ) { - giAlarmTriggerButton = + giAlarmTriggerButton = CreateCheckBoxButton( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 405, "EDITOR//smCheckBox.sti", MSYS_PRIORITY_NORMAL, AlarmTriggerCheckboxCallback ); SetButtonFastHelpText( giAlarmTriggerButton, L"If the panic trigger is an alarm trigger,\nenemies won't attempt to use it if they\nare already aware of your presence."); - if( gpItem->fFlags & OBJECT_ALARM_TRIGGER ) + if( (*gpItem).fFlags & OBJECT_ALARM_TRIGGER ) ButtonList[ giAlarmTriggerButton ]->uiFlags |= BUTTON_CLICKED_ON; } } @@ -1222,12 +1275,12 @@ void ExtractAndUpdateTriggersGUI() //Update the trap level i = GetNumericStrictValueFromField( 1 ); i = ( i == -1 ) ? 0 : min( i, 20 ); - gpItem->bTrap = (INT8)i; + (*gpItem)[0]->data.bTrap = (INT8)i; SetInputFieldStringWithNumericStrictValue( 1, i ); i = GetNumericStrictValueFromField( 2 ); i = ( i == -1 ) ? 0 : max( 0, min( i, 99 ) ); - gpItem->ItemData.Trigger.Area.ubTolerance = (UINT8)i; + (*gpItem)[0]->data.misc.ubTolerance = (UINT8)i; SetInputFieldStringWithNumericStrictValue( 2, i ); if( gpEditingItemPool ) @@ -1241,7 +1294,7 @@ void ExtractAndUpdateTriggersGUI() void RemoveTriggersGUI() { - if( gpEditingItemPool && gpItem->ItemData.Trigger.BombTrigger.bFrequency <= PANIC_FREQUENCY && gpItem->ItemData.Trigger.BombTrigger.bFrequency >= PANIC_FREQUENCY_3 ) + if( gpEditingItemPool && (*gpItem)[0]->data.misc.bFrequency <= PANIC_FREQUENCY && (*gpItem)[0]->data.misc.bFrequency >= PANIC_FREQUENCY_3 ) { if( giAlarmTriggerButton != -1 ) { @@ -1257,7 +1310,6 @@ void ToggleAttachment( GUI_BUTTON *btn, INT32 reason ) { INT32 i; UINT16 usAttachment = 0; - OBJECTTYPE temp; for( i = 0; i < NUM_ATTACHMENT_BUTTONS; i++ ) { //Loop through and find the button that was just modified switch( i ) @@ -1276,17 +1328,16 @@ void ToggleAttachment( GUI_BUTTON *btn, INT32 reason ) { gfAttachment[ i ] = TRUE; btn->uiFlags |= BUTTON_CLICKED_ON; - CreateItem( usAttachment, gpItem->ItemData.Gun.bGunStatus, &temp ); - AttachObject( NULL, gpItem, &temp ); + CreateItem( usAttachment, (*gpItem)[0]->data.gun.bGunStatus, &gTempObject ); + gpItem->AttachObject( NULL, &gTempObject ); } else { //Button is out, so remove the attachment - INT8 slot; gfAttachment[ i ] = FALSE; btn->uiFlags &= ~BUTTON_CLICKED_ON; - slot = FindAttachment( gpItem, usAttachment ); - if( slot != -1 ) - RemoveAttachment( gpItem, slot, &temp ); + OBJECTTYPE* pAttachment = FindAttachment( gpItem, usAttachment ); + if( pAttachment ) + gpItem->RemoveAttachment( pAttachment ); } } } @@ -1298,21 +1349,19 @@ void ToggleCeramicPlates( GUI_BUTTON *btn, INT32 reason ) { if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { - OBJECTTYPE temp; gfCeramicPlates ^= TRUE; if( gfCeramicPlates ) { btn->uiFlags |= BUTTON_CLICKED_ON; - CreateItem( CERAMIC_PLATES, gpItem->ItemData.Generic.bStatus[0], &temp ); - AttachObject( NULL, gpItem, &temp ); + CreateItem( CERAMIC_PLATES, (*gpItem)[0]->data.objectStatus, &gTempObject ); + gpItem->AttachObject( NULL, &gTempObject ); } else { - INT8 slot; btn->uiFlags &= ~BUTTON_CLICKED_ON; - slot = FindAttachment( gpItem, CERAMIC_PLATES ); - if( slot != -1 ) - RemoveAttachment( gpItem, slot, &temp ); + OBJECTTYPE* pAttachment = FindAttachment( gpItem, CERAMIC_PLATES ); + if( pAttachment ) + gpItem->RemoveAttachment( pAttachment ); } } } @@ -1321,22 +1370,20 @@ void ToggleDetonator( GUI_BUTTON *btn, INT32 reason ) { if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { - OBJECTTYPE temp; if( !gfDetonator ) { gfDetonator = TRUE; btn->uiFlags |= BUTTON_CLICKED_ON; - CreateItem( DETONATOR, gpItem->ItemData.Generic.bStatus[0], &temp ); - AttachObject( NULL, gpItem, &temp ); + CreateItem( DETONATOR, (*gpItem)[0]->data.objectStatus, &gTempObject ); + gpItem->AttachObject( NULL, &gTempObject ); } else { //Button is out, so remove the attachment - INT8 slot; gfDetonator = FALSE; btn->uiFlags &= ~BUTTON_CLICKED_ON; - slot = FindAttachment( gpItem, DETONATOR ); - if( slot != -1 ) - RemoveAttachment( gpItem, slot, &temp ); + OBJECTTYPE* pAttachment = FindAttachment( gpItem, DETONATOR ); + if( pAttachment ) + gpItem->RemoveAttachment( pAttachment ); } } } @@ -1352,133 +1399,133 @@ void ActionItemCallback( GUI_BUTTON *btn, INT32 reason ) void ChangeActionItem( OBJECTTYPE *pItem, INT8 bActionItemIndex ) { pItem->usItem = ACTION_ITEM; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_BLOW_UP; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_BLOW_UP; switch( bActionItemIndex ) { case ACTIONITEM_TRIP_KLAXON: - pItem->ItemData.Trigger.usBombItem = TRIP_KLAXON; + (*pItem)[0]->data.misc.usBombItem = TRIP_KLAXON; break; case ACTIONITEM_FLARE: - pItem->ItemData.Trigger.usBombItem = TRIP_FLARE; + (*pItem)[0]->data.misc.usBombItem = TRIP_FLARE; break; case ACTIONITEM_TEARGAS: - pItem->ItemData.Trigger.usBombItem = TEARGAS_GRENADE; + (*pItem)[0]->data.misc.usBombItem = TEARGAS_GRENADE; break; case ACTIONITEM_STUN: - pItem->ItemData.Trigger.usBombItem = STUN_GRENADE; + (*pItem)[0]->data.misc.usBombItem = STUN_GRENADE; break; - case ACTIONITEM_SMOKE: - pItem->ItemData.Trigger.usBombItem = SMOKE_GRENADE; + case ACTIONITEM_SMOKE: + (*pItem)[0]->data.misc.usBombItem = SMOKE_GRENADE; break; case ACTIONITEM_MUSTARD: - pItem->ItemData.Trigger.usBombItem = MUSTARD_GRENADE; + (*pItem)[0]->data.misc.usBombItem = MUSTARD_GRENADE; break; case ACTIONITEM_MINE: - pItem->ItemData.Trigger.usBombItem = MINE; + (*pItem)[0]->data.misc.usBombItem = MINE; break; case ACTIONITEM_OPEN: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_OPEN_DOOR; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_OPEN_DOOR; break; case ACTIONITEM_CLOSE: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_CLOSE_DOOR; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_CLOSE_DOOR; break; case ACTIONITEM_UNLOCK_DOOR: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_UNLOCK_DOOR; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_UNLOCK_DOOR; break; case ACTIONITEM_TOGGLE_LOCK: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_LOCK; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_TOGGLE_LOCK; break; case ACTIONITEM_UNTRAP_DOOR: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_UNTRAP_DOOR; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_UNTRAP_DOOR; break; case ACTIONITEM_TOGGLE_PRESSURE_ITEMS: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_PRESSURE_ITEMS; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_TOGGLE_PRESSURE_ITEMS; break; case ACTIONITEM_SMPIT: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_SMALL_PIT; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_SMALL_PIT; break; case ACTIONITEM_LGPIT: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_LARGE_PIT; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_LARGE_PIT; break; case ACTIONITEM_TOGGLE_DOOR: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_DOOR; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_TOGGLE_DOOR; break; case ACTIONITEM_TOGGLE_ACTION1: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_ACTION1; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_TOGGLE_ACTION1; break; case ACTIONITEM_TOGGLE_ACTION2: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_ACTION2; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_TOGGLE_ACTION2; break; case ACTIONITEM_TOGGLE_ACTION3: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_ACTION3; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_TOGGLE_ACTION3; break; case ACTIONITEM_TOGGLE_ACTION4: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_ACTION4; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_TOGGLE_ACTION4; break; case ACTIONITEM_ENTER_BROTHEL: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_ENTER_BROTHEL; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_ENTER_BROTHEL; break; case ACTIONITEM_EXIT_BROTHEL: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_EXIT_BROTHEL; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_EXIT_BROTHEL; break; case ACTIONITEM_KINGPIN_ALARM: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_KINGPIN_ALARM; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_KINGPIN_ALARM; break; case ACTIONITEM_SEX: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_SEX; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_SEX; break; case ACTIONITEM_REVEAL_ROOM: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_REVEAL_ROOM; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_REVEAL_ROOM; break; case ACTIONITEM_LOCAL_ALARM: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_LOCAL_ALARM; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_LOCAL_ALARM; break; case ACTIONITEM_GLOBAL_ALARM: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_GLOBAL_ALARM; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_GLOBAL_ALARM; break; case ACTIONITEM_KLAXON: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_KLAXON; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_KLAXON; break; case ACTIONITEM_SMALL: - pItem->ItemData.Trigger.usBombItem = HAND_GRENADE; + (*pItem)[0]->data.misc.usBombItem = HAND_GRENADE; break; case ACTIONITEM_MEDIUM: - pItem->ItemData.Trigger.usBombItem = TNT; + (*pItem)[0]->data.misc.usBombItem = TNT; break; case ACTIONITEM_LARGE: - pItem->ItemData.Trigger.usBombItem = C4; + (*pItem)[0]->data.misc.usBombItem = C4; break; case ACTIONITEM_MUSEUM_ALARM: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_MUSEUM_ALARM; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_MUSEUM_ALARM; break; case ACTIONITEM_BLOODCAT_ALARM: - pItem->ItemData.Trigger.usBombItem = NOTHING; - pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_BLOODCAT_ALARM; + (*pItem)[0]->data.misc.usBombItem = NOTHING; + (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_BLOODCAT_ALARM; break; case ACTIONITEM_BIG_TEAR_GAS: - pItem->ItemData.Trigger.usBombItem = BIG_TEAR_GAS; + (*pItem)[0]->data.misc.usBombItem = BIG_TEAR_GAS; break; } @@ -1494,9 +1541,9 @@ void UpdateActionItem( INT8 bActionItemIndex ) //If the previous item was a pit, remove it before changing it if( gpItem->usItem == ACTION_ITEM ) { - if( gpItem->ItemData.Trigger.bActionValue == ACTION_ITEM_SMALL_PIT ) + if( (*gpItem)[0]->data.misc.bActionValue == ACTION_ITEM_SMALL_PIT ) Remove3X3Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); - else if( gpItem->ItemData.Trigger.bActionValue == ACTION_ITEM_LARGE_PIT ) + else if( (*gpItem)[0]->data.misc.bActionValue == ACTION_ITEM_LARGE_PIT ) Remove5X5Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); } @@ -1506,9 +1553,9 @@ void UpdateActionItem( INT8 bActionItemIndex ) //If the new item is a pit, add it so we can see how it looks. if( gpItem->usItem == ACTION_ITEM ) { - if( gpItem->ItemData.Trigger.bActionValue == ACTION_ITEM_SMALL_PIT ) + if( (*gpItem)[0]->data.misc.bActionValue == ACTION_ITEM_SMALL_PIT ) Add3X3Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); - else if( gpItem->ItemData.Trigger.bActionValue == ACTION_ITEM_LARGE_PIT ) + else if( (*gpItem)[0]->data.misc.bActionValue == ACTION_ITEM_LARGE_PIT ) Add5X5Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); } } diff --git a/Editor/Item Statistics.h b/Editor/Item Statistics.h index 609cd08a..af14a137 100644 --- a/Editor/Item Statistics.h +++ b/Editor/Item Statistics.h @@ -4,12 +4,17 @@ #ifndef __ITEM_STATISTICS_H #define __ITEM_STATISTICS_H -#include "Item Types.h" +//#include "Item Types.h" + +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + //Handles the dynamic changing of text input fields and button modes depending on the currently edited -//item. Both the merc's inventory panel, and the items tab use the same code to accomplish this. +//item. Both the merc's inventory panel, and the items tab use the same code to accomplish this. -//Set if we are editing items from the items tab. Otherwise, it is assumed that we are +//Set if we are editing items from the items tab. Otherwise, it is assumed that we are //editing items from the merc's inventory panel. extern BOOLEAN gfItemEditingMode; @@ -40,8 +45,8 @@ void ExecuteItemStatsCmd( UINT8 ubAction ); extern OBJECTTYPE *gpItem; extern INT16 gsItemGridNo; -//enumerations for all of the different action items. Used by the popup menu for -//changing the type of action item. When modified, an equivalent text array must be +//enumerations for all of the different action items. Used by the popup menu for +//changing the type of action item. When modified, an equivalent text array must be //changed as well. enum { diff --git a/Editor/LoadScreen.cpp b/Editor/LoadScreen.cpp index 9c143810..8483b3af 100644 --- a/Editor/LoadScreen.cpp +++ b/Editor/LoadScreen.cpp @@ -948,6 +948,8 @@ UINT32 ProcessFileIO() CreateMessageBox( L" Error loading file. Try another filename?" ); return LOADSAVE_SCREEN; } + //ADB these are NOT set yet! but they need to be, duh + CompileWorldMovementCosts(); SetGlobalSectorValues( gzFilename ); RestoreFontSettings(); @@ -958,9 +960,9 @@ UINT32 ProcessFileIO() //UpdateMercsInSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); AddSoldierInitListTeamToWorld( ENEMY_TEAM, 255 ); - AddSoldierInitListTeamToWorld( CREATURE_TEAM, 255 ); + AddSoldierInitListTeamToWorld( CREATURE_TEAM, 255 ); AddSoldierInitListTeamToWorld( MILITIA_TEAM, 255 ); - AddSoldierInitListTeamToWorld( CIV_TEAM, 255 ); + AddSoldierInitListTeamToWorld( CIV_TEAM, 255 ); iCurrentAction = ACTION_NULL; gbCurrentFileIOStatus = IOSTATUS_NONE; if( !gfCaves && !gfBasement ) diff --git a/Editor/Road Smoothing.cpp b/Editor/Road Smoothing.cpp index 87c3d925..0498b917 100644 --- a/Editor/Road Smoothing.cpp +++ b/Editor/Road Smoothing.cpp @@ -23,10 +23,10 @@ typedef struct MACROSTRUCT }MACROSTRUCT; //road macros -//These define the macros for the 32 road pieces. The column contains the macro ID and +//These define the macros for the 32 road pieces. The column contains the macro ID and //the second contains the gridno offset from the anchor position (where the user clicks in the world to -//place the road). The actual index of the array refers to the offset from ROADPIECE001. -MACROSTRUCT gRoadMacros[] = +//place the road). The actual index of the array refers to the offset from ROADPIECE001. +MACROSTRUCT gRoadMacros[] = { //left 1 {L1, -2 }, @@ -148,19 +148,19 @@ MACROSTRUCT gRoadMacros[] = {RTL, -322 }, {RTL, -482 }, {RTL, -642 }, - {RTL, -802 }, + {RTL, -802 }, {RTL, -1 }, {RTL, -161 }, {RTL, -321 }, {RTL, -481 }, {RTL, -641 }, - {RTL, -801 }, + {RTL, -801 }, {RTL, 0 }, {RTL, -160 }, {RTL, -320 }, {RTL, -480 }, {RTL, -640 }, - {RTL, -800 }, + {RTL, -800 }, //right half of top-left corner {RBR, 159 }, {RBR, -1 }, @@ -376,7 +376,7 @@ MACROSTRUCT gRoadMacros[] = INT16 gsRoadMacroStartIndex[ NUM_ROAD_MACROS ]; -//A simple optimization function that calculates the first index in the large database for +//A simple optimization function that calculates the first index in the large database for //the particular macro ID. void InitializeRoadMacros() { @@ -398,7 +398,7 @@ void InitializeRoadMacros() // i = ROADPIECES001; } -//Road macros vary in size from 3 gridnos to 18 gridnos. Using the anchor gridno based off of the original +//Road macros vary in size from 3 gridnos to 18 gridnos. Using the anchor gridno based off of the original //road system, this function will place the new macro (consisting of multiple road pieces in multiple //gridnos). void PlaceRoadMacroAtGridNo( INT32 iMapIndex, INT32 iMacroID ) @@ -416,10 +416,10 @@ void PlaceRoadMacroAtGridNo( INT32 iMapIndex, INT32 iMacroID ) } } -//The old road system used multi-tiled roads as a single image. The new road system has taken these large -//pieces and chopped them up into single tiled images (to mitigate lighting problems). Some of the larger -//road pieces turned into 18 smaller pieces. So this function will go analyse the world, and replaces any -//locations containing the original road tile information, delete it, and replace it by inserting it's +//The old road system used multi-tiled roads as a single image. The new road system has taken these large +//pieces and chopped them up into single tiled images (to mitigate lighting problems). Some of the larger +//road pieces turned into 18 smaller pieces. So this function will go analyse the world, and replaces any +//locations containing the original road tile information, delete it, and replace it by inserting it's //equivalent macro. void ReplaceObsoleteRoads() { diff --git a/Editor/Road Smoothing.h b/Editor/Road Smoothing.h index b7a39efa..872c2d6b 100644 --- a/Editor/Road Smoothing.h +++ b/Editor/Road Smoothing.h @@ -5,7 +5,7 @@ #ifndef __ROAD_SMOOTHING_H #define __ROAD_SMOOTHING_H -//There are the 32 macro definitions that make up all of the road pieces. These enumerations +//There are the 32 macro definitions that make up all of the road pieces. These enumerations //match up exactly to the previous road system order of graphics (FIRSTROAD1 - FIRSTROAD32) enum { @@ -21,7 +21,7 @@ enum RTL, //right top-left corner piece RBR, //right bottom-right corner piece LBR, //left bottom-right corner piece - L2, //left 2 (variation of the left 1) + L2, //left 2 (variation of the left 1) R2, //right 2 L3, //left 3 R3, //right 3 @@ -32,7 +32,7 @@ enum BI, //bottom intersection (piece connecting bottom to right) LI, //left intersection (piece connecting left to bottom ) TI, //top intersection (piece connecting top to left) - RI, //right intersection (piece connection right to top) + RI, //right intersection (piece connection right to top) L4, //left 4 R4, //right 4 B4, //bottom 4 @@ -44,14 +44,14 @@ enum NUM_ROAD_MACROS }; -//The old road system used multi-tiled roads as a single image. The new road system has taken these large -//pieces and chopped them up into single tiled images (to mitigate lighting problems). Some of the larger -//road pieces turned into 18 smaller pieces. So this function will go analyse the world, and replaces any +//The old road system used multi-tiled roads as a single image. The new road system has taken these large +//pieces and chopped them up into single tiled images (to mitigate lighting problems). Some of the larger +//road pieces turned into 18 smaller pieces. So this function will go analyse the world, and replaces any //locations containing the original road tile information, delete it, and replace it by inserting it's //equivalent macro. void ReplaceObsoleteRoads(); -//Road macros vary in size from 3 gridnos to 18 gridnos. Using the anchor gridno based off of the original +//Road macros vary in size from 3 gridnos to 18 gridnos. Using the anchor gridno based off of the original //road system, this function will place the new macro (consisting of multiple road pieces in multiple //gridnos). void PlaceRoadMacroAtGridNo( INT32 iMapIndex, INT32 iMacroID ); diff --git a/Editor/Sector Summary.cpp b/Editor/Sector Summary.cpp index d90f8b35..5e0e9987 100644 --- a/Editor/Sector Summary.cpp +++ b/Editor/Sector Summary.cpp @@ -37,6 +37,8 @@ #include "World Items.h" #include "text.h" #include "Soldier Create.h" + #include "GameVersion.h" + #include "Campaign Types.h" #endif extern BOOLEAN gfOverheadMapDirty; @@ -475,19 +477,19 @@ void DestroySummaryWindow() if( gpWorldItemsSummaryArray ) { - MemFree( gpWorldItemsSummaryArray ); + delete[]( gpWorldItemsSummaryArray ); gpWorldItemsSummaryArray = NULL; gusWorldItemsSummaryArraySize = 0; } if( gpPEnemyItemsSummaryArray ) { - MemFree( gpPEnemyItemsSummaryArray ); + delete[]( gpPEnemyItemsSummaryArray ); gpPEnemyItemsSummaryArray = NULL; gusPEnemyItemsSummaryArraySize = 0; } if( gpNEnemyItemsSummaryArray ) { - MemFree( gpNEnemyItemsSummaryArray ); + delete[]( gpNEnemyItemsSummaryArray ); gpNEnemyItemsSummaryArray = NULL; gusNEnemyItemsSummaryArraySize = 0; } @@ -709,27 +711,27 @@ void RenderItemDetails() { if( index == SWITCH || index == ACTION_ITEM ) { - if( gpWorldItemsSummaryArray[ i ].o.usItem == index ) + if( gpWorldItemsSummaryArray[ i ].object.usItem == index ) { if( gubSummaryItemMode == ITEMMODE_SCIFI && !(gpWorldItemsSummaryArray[ i ].usFlags & WORLD_ITEM_REALISTIC_ONLY) || - gubSummaryItemMode == ITEMMODE_REAL && !(gpWorldItemsSummaryArray[ i ].usFlags & WORLD_ITEM_SCIFI_ONLY) ) + gubSummaryItemMode == ITEMMODE_REAL && !(gpWorldItemsSummaryArray[ i ].usFlags & WORLD_ITEM_SCIFI_ONLY) ) { - pItem = &gpWorldItemsSummaryArray[ i ].o; - if( !pItem->ItemData.Trigger.BombTrigger.bFrequency ) + pItem = &gpWorldItemsSummaryArray[ i ].object; + if( !(*pItem)[0]->data.misc.bFrequency ) bFreqIndex = 7; - else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY ) + else if( (*pItem)[0]->data.misc.bFrequency == PANIC_FREQUENCY ) bFreqIndex = 0; - else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_2 ) + else if( (*pItem)[0]->data.misc.bFrequency == PANIC_FREQUENCY_2 ) bFreqIndex = 1; - else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_3 ) + else if( (*pItem)[0]->data.misc.bFrequency == PANIC_FREQUENCY_3 ) bFreqIndex = 2; - else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == FIRST_MAP_PLACED_FREQUENCY + 1 ) + else if( (*pItem)[0]->data.misc.bFrequency == FIRST_MAP_PLACED_FREQUENCY + 1 ) bFreqIndex = 3; - else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == FIRST_MAP_PLACED_FREQUENCY + 2 ) + else if( (*pItem)[0]->data.misc.bFrequency == FIRST_MAP_PLACED_FREQUENCY + 2 ) bFreqIndex = 4; - else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == FIRST_MAP_PLACED_FREQUENCY + 3 ) + else if( (*pItem)[0]->data.misc.bFrequency == FIRST_MAP_PLACED_FREQUENCY + 3 ) bFreqIndex = 5; - else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == FIRST_MAP_PLACED_FREQUENCY + 4 ) + else if( (*pItem)[0]->data.misc.bFrequency == FIRST_MAP_PLACED_FREQUENCY + 4 ) bFreqIndex = 6; else continue; @@ -747,15 +749,14 @@ void RenderItemDetails() } continue; } - if( gpWorldItemsSummaryArray[ i ].o.usItem == index ) + if( gpWorldItemsSummaryArray[ i ].object.usItem == index ) { if( gubSummaryItemMode == ITEMMODE_SCIFI && !(gpWorldItemsSummaryArray[ i ].usFlags & WORLD_ITEM_REALISTIC_ONLY) || - gubSummaryItemMode == ITEMMODE_REAL && !(gpWorldItemsSummaryArray[ i ].usFlags & WORLD_ITEM_SCIFI_ONLY) ) + gubSummaryItemMode == ITEMMODE_REAL && !(gpWorldItemsSummaryArray[ i ].usFlags & WORLD_ITEM_SCIFI_ONLY) ) { - pItem = &gpWorldItemsSummaryArray[ i ].o; + pItem = &gpWorldItemsSummaryArray[ i ].object; uiExistChance += (100 - gpWorldItemsSummaryArray[ i ].ubNonExistChance) * pItem->ubNumberOfObjects; - uiStatus += pItem->ItemData.Generic.bStatus[0]; - uiQuantity += pItem->ubNumberOfObjects; + uiStatus += (*pItem)[0]->data.objectStatus; } } } @@ -862,7 +863,7 @@ void RenderItemDetails() { pItem = &gpPEnemyItemsSummaryArray[ i ]; uiExistChance += 100 * pItem->ubNumberOfObjects; - uiStatus += pItem->ItemData.Generic.bStatus[0]; + uiStatus += (*pItem)[0]->data.objectStatus; uiQuantity += pItem->ubNumberOfObjects; } } @@ -934,7 +935,7 @@ void RenderItemDetails() { pItem = &gpNEnemyItemsSummaryArray[ i ]; uiExistChance += 100 * pItem->ubNumberOfObjects; - uiStatus += pItem->ItemData.Generic.bStatus[0]; + uiStatus += (*pItem)[0]->data.objectStatus; uiQuantity += pItem->ubNumberOfObjects; } } @@ -2014,7 +2015,7 @@ void MapClickCallback( MOUSE_REGION *reg, INT32 reason ) } if( gpWorldItemsSummaryArray ) { - MemFree( gpWorldItemsSummaryArray ); + delete[]( gpWorldItemsSummaryArray ); gpWorldItemsSummaryArray = NULL; gusWorldItemsSummaryArraySize = 0; } @@ -2230,7 +2231,7 @@ void LoadGlobalSummary() STRING512 MapsDir; UINT32 uiNumBytesRead; FLOAT dMajorVersion; - INT32 x,y; + INT32 x,y; CHAR8 szFilename[40]; CHAR8 szSector[6]; @@ -2758,7 +2759,7 @@ void SummaryUpdateCallback( GUI_BUTTON *btn, INT32 reason ) // ADB: The current sector summary should be set to the array value, not the other way around. // Also the sector X and Y values are 1-based and the array is 0-based. So subtract 1 from X and Y gpCurrentSectorSummary = gpSectorSummary[ gsSelSectorX - 1][ gsSelSectorY - 1][ giCurrLevel ]; - + gfRenderSummary = TRUE; RemoveProgressBar( 0 ); @@ -2913,6 +2914,9 @@ void ApologizeOverrideAndForceUpdateEverything() gusNumberOfMapsToBeForceUpdated = 0; } +//CHRISL: ADB changed the way this load file is handled +extern int gEnemyPreservedTempFileVersion[256]; +extern int gCivPreservedTempFileVersion[256]; void SetupItemDetailsMode( BOOLEAN fAllowRecursion ) { HWFILE hfile; @@ -2929,19 +2933,19 @@ void SetupItemDetailsMode( BOOLEAN fAllowRecursion ) //Clear memory for all the item summaries loaded if( gpWorldItemsSummaryArray ) { - MemFree( gpWorldItemsSummaryArray ); + delete[]( gpWorldItemsSummaryArray ); gpWorldItemsSummaryArray = NULL; gusWorldItemsSummaryArraySize = 0; } if( gpPEnemyItemsSummaryArray ) { - MemFree( gpPEnemyItemsSummaryArray ); + delete[]( gpPEnemyItemsSummaryArray ); gpPEnemyItemsSummaryArray = NULL; gusPEnemyItemsSummaryArraySize = 0; } if( gpNEnemyItemsSummaryArray ) { - MemFree( gpNEnemyItemsSummaryArray ); + delete[]( gpNEnemyItemsSummaryArray ); gpNEnemyItemsSummaryArray = NULL; gusNEnemyItemsSummaryArraySize = 0; } @@ -2993,9 +2997,12 @@ void SetupItemDetailsMode( BOOLEAN fAllowRecursion ) ShowButton( iSummaryButton[ SUMMARY_SCIFI ] ); ShowButton( iSummaryButton[ SUMMARY_REAL ] ); ShowButton( iSummaryButton[ SUMMARY_ENEMY ] ); - gpWorldItemsSummaryArray = (WORLDITEM*)MemAlloc( sizeof( WORLDITEM ) * uiNumItems ); + gpWorldItemsSummaryArray = new WORLDITEM[ uiNumItems ]; gusWorldItemsSummaryArraySize = gpCurrentSectorSummary->usNumItems; - FileRead( hfile, gpWorldItemsSummaryArray, sizeof( WORLDITEM ) * uiNumItems, &uiNumBytesRead ); + for (unsigned int x = 0; x < uiNumItems; ++x) + { + gpWorldItemsSummaryArray[x].Load(hfile); + } //NOW, do the enemy's items! //We need to do two passes. The first pass simply processes all the enemies and counts all the droppable items @@ -3020,9 +3027,7 @@ void SetupItemDetailsMode( BOOLEAN fAllowRecursion ) } if( basic.fDetailedPlacement ) { //skip static priority placement - // WDS - Clean up inventory handling - FileRead( hfile, &priority, SIZEOF_SOLDIERCREATE_STRUCT, &uiNumBytesRead ); - if( uiNumBytesRead != SIZEOF_SOLDIERCREATE_STRUCT ) + if ( !priority.Load(hfile, SAVE_GAME_VERSION, false) ) { //Invalid situation. FileClose( hfile ); return; @@ -3039,7 +3044,7 @@ void SetupItemDetailsMode( BOOLEAN fAllowRecursion ) for( j = 0; j < 9; j++ ) { pItem = &priority.Inv[ gbMercSlotTypes[ j ] ]; - if( pItem->usItem != NOTHING && !( pItem->fFlags & OBJECT_UNDROPPABLE ) ) + if( pItem->exists() == true && !( (*pItem).fFlags & OBJECT_UNDROPPABLE ) ) { usNumItems++; } @@ -3058,13 +3063,11 @@ void SetupItemDetailsMode( BOOLEAN fAllowRecursion ) //Pass 1 completed, so now allocate enough space to hold all the items if( gusPEnemyItemsSummaryArraySize ) { - gpPEnemyItemsSummaryArray = (OBJECTTYPE*)MemAlloc( sizeof( OBJECTTYPE ) * gusPEnemyItemsSummaryArraySize ); - memset( gpPEnemyItemsSummaryArray, 0, sizeof( OBJECTTYPE ) * gusPEnemyItemsSummaryArraySize ); + gpPEnemyItemsSummaryArray = new OBJECTTYPE[ gusPEnemyItemsSummaryArraySize ]; } if( gusNEnemyItemsSummaryArraySize ) { - gpNEnemyItemsSummaryArray = (OBJECTTYPE*)MemAlloc( sizeof( OBJECTTYPE ) * gusNEnemyItemsSummaryArraySize ); - memset( gpNEnemyItemsSummaryArray, 0, sizeof( OBJECTTYPE ) * gusNEnemyItemsSummaryArraySize ); + gpNEnemyItemsSummaryArray = new OBJECTTYPE[ gusNEnemyItemsSummaryArraySize ]; } //PASS #2 @@ -3085,9 +3088,7 @@ void SetupItemDetailsMode( BOOLEAN fAllowRecursion ) } if( basic.fDetailedPlacement ) { //skip static priority placement - // WDS - Clean up inventory handling - FileRead( hfile, &priority, SIZEOF_SOLDIERCREATE_STRUCT, &uiNumBytesRead ); - if( uiNumBytesRead != SIZEOF_SOLDIERCREATE_STRUCT ) + if ( !priority.Load(hfile, SAVE_GAME_VERSION, false) ) { //Invalid situation. FileClose( hfile ); return; @@ -3104,16 +3105,16 @@ void SetupItemDetailsMode( BOOLEAN fAllowRecursion ) for( j = 0; j < 9; j++ ) { pItem = &priority.Inv[ gbMercSlotTypes[ j ] ]; - if( pItem->usItem != NOTHING && !( pItem->fFlags & OBJECT_UNDROPPABLE ) ) + if( pItem->exists() == true && !( (*pItem).fFlags & OBJECT_UNDROPPABLE ) ) { if( basic.fPriorityExistance ) { - memcpy( &(gpPEnemyItemsSummaryArray[ usPEnemyIndex ]), pItem, sizeof( OBJECTTYPE ) ); + gpPEnemyItemsSummaryArray[ usPEnemyIndex ] = *pItem; usPEnemyIndex++; } else { - memcpy( &(gpNEnemyItemsSummaryArray[ usNEnemyIndex ]), pItem, sizeof( OBJECTTYPE ) ); + gpNEnemyItemsSummaryArray[ usNEnemyIndex ] = *pItem; usNEnemyIndex++; } } @@ -3150,4 +3151,5 @@ void ClearSummaryInfo() } } -#endif \ No newline at end of file +#endif + diff --git a/Editor/SmartMethod.cpp b/Editor/SmartMethod.cpp index b02d47d0..6e956097 100644 --- a/Editor/SmartMethod.cpp +++ b/Editor/SmartMethod.cpp @@ -28,7 +28,7 @@ void CalcSmartWallDefault( UINT16 *pusObjIndex, UINT16 *pusUseIndex ) void CalcSmartDoorDefault( UINT16 *pusObjIndex, UINT16 *pusUseIndex ) { *pusUseIndex = 4 * ( gubDoorUIValue % 2 ); //open or closed -- odd or even - *pusObjIndex = FIRSTDOOR + gubDoorUIValue / 2; + *pusObjIndex = FIRSTDOOR + gubDoorUIValue / 2; } void CalcSmartWindowDefault( UINT16 *pusObjIndex, UINT16 *pusUseIndex ) @@ -42,8 +42,8 @@ void CalcSmartBrokenWallDefault( UINT16 *pusObjIndex, UINT16 *pusUseIndex ) switch( gubBrokenWallUIValue ) { case 0:case 1: *pusUseIndex = 49 + gubBrokenWallUIValue; break; - case 3: *pusUseIndex = 62; break; - case 4: *pusUseIndex = 64; break; + case 3: *pusUseIndex = 62; break; + case 4: *pusUseIndex = 64; break; } *pusObjIndex = FIRSTWALL; } @@ -56,7 +56,7 @@ UINT16 CalcSmartWindowIndex( UINT16 usWallOrientation ) UINT16 CalcSmartDoorIndex( UINT16 usWallOrientation ) { //convert the orientation values as the graphics are in reverse order - //orientation values: INSIDE_TOP_LEFT=1, INSIDE_TOP_RIGHT=2, OUTSIDE_TOP_LEFT=3, OUTSIDE_TOP_RIGHT=4 + //orientation values: INSIDE_TOP_LEFT=1, INSIDE_TOP_RIGHT=2, OUTSIDE_TOP_LEFT=3, OUTSIDE_TOP_RIGHT=4 //door graphics order: INSIDE_TOP_LEFT=15, INSIDE_TOP_RIGHT=10, OUTSIDE_TOP_LEFT=5, OUTSIDE_TOP_RIGHT=0 usWallOrientation = (4 - usWallOrientation) * 5; //4 * (gubDoorUIValue%2) evaluates to +4 if the door is open, 0 if closed @@ -75,19 +75,19 @@ UINT16 CalcSmartBrokenWallIndex( UINT16 usWallOrientation ) if( gubBrokenWallUIValue < 2 ) //broken walls { //convert the orientation value as the graphics are in a different order. - //orientation values: INSIDE_TOP_LEFT=1, INSIDE_TOP_RIGHT=2, OUTSIDE_TOP_LEFT=3, OUTSIDE_TOP_RIGHT=4 - // 4 6 8 10 - //door graphics order: INSIDE_TOP_LEFT=4, INSIDE_TOP_RIGHT=6, OUTSIDE_TOP_LEFT=0, OUTSIDE_TOP_RIGHT=2 + //orientation values: INSIDE_TOP_LEFT=1, INSIDE_TOP_RIGHT=2, OUTSIDE_TOP_LEFT=3, OUTSIDE_TOP_RIGHT=4 + // 4 6 8 10 + //door graphics order: INSIDE_TOP_LEFT=4, INSIDE_TOP_RIGHT=6, OUTSIDE_TOP_LEFT=0, OUTSIDE_TOP_RIGHT=2 usWallOrientation = usWallOrientation * 2 + 2; usWallOrientation -= usWallOrientation > 6 ? 8 : 0; return (UINT16)( usWallOrientation + 48 + gubBrokenWallUIValue ); } - + //cracked and smudged walls //convert the orientation value as the graphics are in a different order. - //orientation values: INSIDE_TOP_LEFT=1, INSIDE_TOP_RIGHT=2, OUTSIDE_TOP_LEFT=3, OUTSIDE_TOP_RIGHT=4 - //door graphics order: INSIDE_TOP_LEFT=1, INSIDE_TOP_RIGHT=2, OUTSIDE_TOP_LEFT=5, OUTSIDE_TOP_RIGHT=6 + //orientation values: INSIDE_TOP_LEFT=1, INSIDE_TOP_RIGHT=2, OUTSIDE_TOP_LEFT=3, OUTSIDE_TOP_RIGHT=4 + //door graphics order: INSIDE_TOP_LEFT=1, INSIDE_TOP_RIGHT=2, OUTSIDE_TOP_LEFT=5, OUTSIDE_TOP_RIGHT=6 usWallOrientation += usWallOrientation > 1 ? 2 : 0; usWallOrientation += gubBrokenWallUIValue == 4 ? 2 : 0; //smudged type which is 2 index values higher. return (UINT16)( usWallOrientation + 57 ); @@ -135,7 +135,7 @@ void DecSmartBrokenWallUIValue() BOOLEAN CalcWallInfoUsingSmartMethod( UINT32 iMapIndex, UINT16 *pusWallType, UINT16 *pusIndex ) { - return FALSE; + return FALSE; } BOOLEAN CalcDoorInfoUsingSmartMethod( UINT32 iMapIndex, UINT16 *pusDoorType, UINT16 *pusIndex ) @@ -205,7 +205,7 @@ BOOLEAN CalcBrokenWallInfoUsingSmartMethod( UINT32 iMapIndex, UINT16 *pusWallTyp LEVELNODE *pWall = NULL; UINT32 uiTileType; UINT16 usWallOrientation; - + if( gubBrokenWallUIValue == 2 ) //the hole in the wall { *pusWallType = 0xffff; @@ -247,25 +247,25 @@ BOOLEAN CalcBrokenWallInfoUsingSmartMethod( UINT32 iMapIndex, UINT16 *pusWallTyp } -//This is a very difficult function to document properly. The reason being is that it is sooo -//subliminal by nature. I have thought up of priorities and choose the best piece to draw based -//on the surrounding conditions. Here are the priorities which are referenced below via comments: -//A) If there is currently a bottom piece and a right piece, immediately exit. -//B) We are currently over a bottom piece. Now, we don't automatically want to draw a right piece here -// for multiple reasons. First, the UI will be too quick and place bottom and right pieces for every -// place the user clicks, which isn't what we want. Therefore, we look to see if there is a right -// piece in the y-1 gridno. It would then make sense to place a right piece down here. Regardless, +//This is a very difficult function to document properly. The reason being is that it is sooo +//subliminal by nature. I have thought up of priorities and choose the best piece to draw based +//on the surrounding conditions. Here are the priorities which are referenced below via comments: +//A) If there is currently a bottom piece and a right piece, immediately exit. +//B) We are currently over a bottom piece. Now, we don't automatically want to draw a right piece here +// for multiple reasons. First, the UI will be too quick and place bottom and right pieces for every +// place the user clicks, which isn't what we want. Therefore, we look to see if there is a right +// piece in the y-1 gridno. It would then make sense to place a right piece down here. Regardless, // if we encounter a bottom piece here, we will exit. -//C) This is the counterpart to B, but we are looking at a current right piece, and are determining if +//C) This is the counterpart to B, but we are looking at a current right piece, and are determining if // we should place a bottom piece based on another bottom piece existing in the x-1 gridno. -//D) Now, we analyse the neighboring tiles and determine the orientations that would add weight to the -// current tile either towards drawing a horizontal piece or a vertical piece. -//E) Now that we have the information, we give the highest priority to any weights that match the current -// wall piece type selected by the user. Based on that, we will only consider the best match of the -// type and use it. If there are no matches on type, we continue. -//F) We failed to find weights matching the current wall type, but before we give up using the user's wall -// type, there are two more cases. When there is a bottom wall in the y+1 position or a right wall in -// the x+1 position. If there are matching walls, there, then we draw two pieces to connect the current +//D) Now, we analyse the neighboring tiles and determine the orientations that would add weight to the +// current tile either towards drawing a horizontal piece or a vertical piece. +//E) Now that we have the information, we give the highest priority to any weights that match the current +// wall piece type selected by the user. Based on that, we will only consider the best match of the +// type and use it. If there are no matches on type, we continue. +//F) We failed to find weights matching the current wall type, but before we give up using the user's wall +// type, there are two more cases. When there is a bottom wall in the y+1 position or a right wall in +// the x+1 position. If there are matching walls, there, then we draw two pieces to connect the current // gridno with the respective position. void PasteSmartWall( UINT32 iMapIndex ) { @@ -273,7 +273,7 @@ void PasteSmartWall( UINT32 iMapIndex ) static UINT32 iAloneMapIndex = 0x8000; UINT16 usWallType; - //These are the counters for the walls of each type + //These are the counters for the walls of each type UINT16 usNumV[4]={0,0,0,0}; //vertical wall weights UINT16 usNumH[4]={0,0,0,0}; //horizontal wall weights @@ -282,8 +282,8 @@ void PasteSmartWall( UINT32 iMapIndex ) return; //*B* See above documentation usWallType = GetHorizontalWallType( iMapIndex ); - if( usWallType ) - { + if( usWallType ) + { if( usWallType == gubWallUIValue ) { usWallType = GetVerticalWallType( iMapIndex - WORLD_COLS ); @@ -312,12 +312,12 @@ void PasteSmartWall( UINT32 iMapIndex ) } } } - return; + return; } //*C* See above documentation usWallType = GetVerticalWallType( iMapIndex ); - if( usWallType ) - { + if( usWallType ) + { if( usWallType == gubWallUIValue ) { usWallType = GetHorizontalWallType( iMapIndex - 1 ); @@ -329,25 +329,25 @@ void PasteSmartWall( UINT32 iMapIndex ) BuildWallPiece( iMapIndex, INTERIOR_BOTTOM, gubWallUIValue ); } } - return; + return; } //*D* See above documentation - //Evaluate left adjacent tile + //Evaluate left adjacent tile if( usWallType = GetVerticalWallType( iMapIndex - 1 ) ) - usNumH[ usWallType - FIRSTWALL ]++; + usNumH[ usWallType - FIRSTWALL ]++; if( usWallType = GetHorizontalWallType( iMapIndex - 1 ) ) usNumH[ usWallType - FIRSTWALL ]++; - //Evaluate right adjacent tile + //Evaluate right adjacent tile if( usWallType = GetHorizontalWallType( iMapIndex + 1 ) ) - usNumH[ usWallType - FIRSTWALL ]++; - //Evaluate upper adjacent tile + usNumH[ usWallType - FIRSTWALL ]++; + //Evaluate upper adjacent tile if( usWallType = GetVerticalWallType( iMapIndex - WORLD_COLS ) ) - usNumV[ usWallType - FIRSTWALL ]++; + usNumV[ usWallType - FIRSTWALL ]++; if( usWallType = GetHorizontalWallType( iMapIndex - WORLD_COLS ) ) usNumV[ usWallType - FIRSTWALL ]++; - //Evaluate lower adjacent tile + //Evaluate lower adjacent tile if( usWallType = GetVerticalWallType( iMapIndex + WORLD_COLS ) ) - usNumV[ usWallType - FIRSTWALL ]++; + usNumV[ usWallType - FIRSTWALL ]++; //*E* See above documentation if( usNumV[gubWallUIValue - FIRSTWALL] | usNumH[gubWallUIValue - FIRSTWALL] ) { @@ -357,11 +357,11 @@ void PasteSmartWall( UINT32 iMapIndex ) { //inside BuildWallPiece( iMapIndex, EXTERIOR_RIGHT, gubWallUIValue ); //Change to extended piece if it is a new top right corner to cover the end part. - if( GetHorizontalWall( iMapIndex - WORLD_COLS ) && !GetHorizontalWall( iMapIndex - WORLD_COLS + 1 ) + if( GetHorizontalWall( iMapIndex - WORLD_COLS ) && !GetHorizontalWall( iMapIndex - WORLD_COLS + 1 ) && !GetVerticalWall( iMapIndex - WORLD_COLS ) ) ChangeVerticalWall( iMapIndex, INTERIOR_EXTENDED ); - else if( GetHorizontalWall( iMapIndex - WORLD_COLS ) && !GetHorizontalWall( iMapIndex - WORLD_COLS - 1 ) - && !GetVerticalWall( iMapIndex - WORLD_COLS - 1 ) ) + else if( GetHorizontalWall( iMapIndex - WORLD_COLS ) && !GetHorizontalWall( iMapIndex - WORLD_COLS - 1 ) + && !GetVerticalWall( iMapIndex - WORLD_COLS - 1 ) ) { ChangeVerticalWall( iMapIndex, INTERIOR_EXTENDED ); EraseHorizontalWall( iMapIndex - WORLD_COLS ); @@ -370,11 +370,11 @@ void PasteSmartWall( UINT32 iMapIndex ) else { //outside BuildWallPiece( iMapIndex, INTERIOR_RIGHT, gubWallUIValue ); - if( GetHorizontalWall( iMapIndex - WORLD_COLS ) && !GetHorizontalWall( iMapIndex - WORLD_COLS + 1 ) + if( GetHorizontalWall( iMapIndex - WORLD_COLS ) && !GetHorizontalWall( iMapIndex - WORLD_COLS + 1 ) && !GetVerticalWall( iMapIndex - WORLD_COLS ) ) ChangeVerticalWall( iMapIndex, EXTERIOR_EXTENDED ); - else if( GetHorizontalWall( iMapIndex - WORLD_COLS ) && !GetHorizontalWall( iMapIndex - WORLD_COLS - 1 ) - && !GetVerticalWall( iMapIndex - WORLD_COLS - 1 ) ) + else if( GetHorizontalWall( iMapIndex - WORLD_COLS ) && !GetHorizontalWall( iMapIndex - WORLD_COLS - 1 ) + && !GetVerticalWall( iMapIndex - WORLD_COLS - 1 ) ) { ChangeVerticalWall( iMapIndex, EXTERIOR_EXTENDED ); EraseHorizontalWall( iMapIndex - WORLD_COLS ); @@ -383,29 +383,29 @@ void PasteSmartWall( UINT32 iMapIndex ) } else { - if( GetVerticalWall( iMapIndex - 1 ) && !GetVerticalWall( iMapIndex - WORLD_COLS - 1 ) - && !GetHorizontalWall( iMapIndex - WORLD_COLS - 1 ) ) + if( GetVerticalWall( iMapIndex - 1 ) && !GetVerticalWall( iMapIndex - WORLD_COLS - 1 ) + && !GetHorizontalWall( iMapIndex - WORLD_COLS - 1 ) ) EraseVerticalWall( iMapIndex - 1); if( FloorAtGridNo( iMapIndex + WORLD_COLS ) ) { //inside BuildWallPiece( iMapIndex, EXTERIOR_BOTTOM, gubWallUIValue ); - if( GetVerticalWall( iMapIndex + WORLD_COLS ) ) + if( GetVerticalWall( iMapIndex + WORLD_COLS ) ) ChangeVerticalWall( iMapIndex + WORLD_COLS, INTERIOR_EXTENDED ); if( GetVerticalWall( iMapIndex + WORLD_COLS - 1 ) && !GetVerticalWall( iMapIndex - 1 ) ) - ChangeVerticalWall( iMapIndex + WORLD_COLS - 1, INTERIOR_EXTENDED ); - else if( GetVerticalWall( iMapIndex - 1 ) && !GetVerticalWall( iMapIndex + WORLD_COLS - 1 ) - && FloorAtGridNo( iMapIndex ) ) + ChangeVerticalWall( iMapIndex + WORLD_COLS - 1, INTERIOR_EXTENDED ); + else if( GetVerticalWall( iMapIndex - 1 ) && !GetVerticalWall( iMapIndex + WORLD_COLS - 1 ) + && FloorAtGridNo( iMapIndex ) ) ChangeVerticalWall( iMapIndex - 1, INTERIOR_BOTTOMEND ); } else { //outside BuildWallPiece( iMapIndex, INTERIOR_BOTTOM, gubWallUIValue ); - if( GetVerticalWall( iMapIndex + WORLD_COLS ) ) + if( GetVerticalWall( iMapIndex + WORLD_COLS ) ) ChangeVerticalWall( iMapIndex + WORLD_COLS, EXTERIOR_EXTENDED ); if( GetVerticalWall( iMapIndex + WORLD_COLS - 1 ) && !GetVerticalWall( iMapIndex - 1 ) ) - ChangeVerticalWall( iMapIndex + WORLD_COLS - 1, EXTERIOR_EXTENDED ); - else if( GetVerticalWall( iMapIndex - 1 ) && !GetVerticalWall( iMapIndex + WORLD_COLS - 1 ) - && FloorAtGridNo( iMapIndex ) ) + ChangeVerticalWall( iMapIndex + WORLD_COLS - 1, EXTERIOR_EXTENDED ); + else if( GetVerticalWall( iMapIndex - 1 ) && !GetVerticalWall( iMapIndex + WORLD_COLS - 1 ) + && FloorAtGridNo( iMapIndex ) ) ChangeVerticalWall( iMapIndex - 1, EXTERIOR_BOTTOMEND ); } } @@ -441,7 +441,7 @@ void PasteSmartWall( UINT32 iMapIndex ) if( usWallType == gubWallUIValue ) { if(FloorAtGridNo( iMapIndex + WORLD_COLS ) ) - { //inside + { //inside BuildWallPiece( iMapIndex + 1, EXTERIOR_BOTTOM, gubWallUIValue ); BuildWallPiece( iMapIndex, EXTERIOR_BOTTOM, gubWallUIValue ); if( !GetVerticalWall( iMapIndex - WORLD_COLS + 1 ) ) @@ -457,7 +457,7 @@ void PasteSmartWall( UINT32 iMapIndex ) else ChangeVerticalWall( iMapIndex + 1, INTERIOR_BOTTOMEND ); } - } + } else { //outside BuildWallPiece( iMapIndex + 1, INTERIOR_BOTTOM, gubWallUIValue ); @@ -533,7 +533,7 @@ void PasteSmartWindow( UINT32 iMapIndex ) GetWallOrientation( pWall->usIndex, &usWallOrientation ); usIndex = CalcSmartWindowIndex( usWallOrientation ); //Calculate the new graphic for the window type selected. - + AddToUndoList( iMapIndex ); GetTileIndexFromTypeSubIndex( usWallType, usIndex, &usNewWallIndex ); ReplaceStructIndex( iMapIndex, pWall->usIndex, usNewWallIndex ); @@ -623,6 +623,7 @@ void PasteSmartBrokenWall( UINT32 iMapIndex ) - + + diff --git a/Editor/Smoothing Utils.cpp b/Editor/Smoothing Utils.cpp index 6e3278df..77c290db 100644 --- a/Editor/Smoothing Utils.cpp +++ b/Editor/Smoothing Utils.cpp @@ -6,7 +6,7 @@ #ifdef JA2EDITOR -#ifndef PRECOMPILEDHEADERS +#ifndef PRECOMPILEDHEADERS #include #include "worlddef.h" //for LEVELNODE def #include "worldman.h" //for RemoveXXXX() @@ -22,7 +22,7 @@ extern UINT16 PickAWallPiece( UINT16 usWallPieceType ); //This method isn't foolproof, but because erasing large areas of buildings could result in -//multiple wall types for each building. When processing the region, it is necessary to +//multiple wall types for each building. When processing the region, it is necessary to //calculate the roof type by searching for the nearest roof tile. UINT16 SearchForWallType( UINT32 iMapIndex ) { @@ -40,7 +40,7 @@ UINT16 SearchForWallType( UINT32 iMapIndex ) } while( sRadius < 32 ) { - //NOTE: start at the higher y value and go negative because it is possible to have another + //NOTE: start at the higher y value and go negative because it is possible to have another // structure type one tile north, but not one tile south -- so it'll find the correct wall first. for( y = sRadius; y >= -sRadius; y-- ) for( x = -sRadius; x <= sRadius; x++ ) { @@ -73,7 +73,7 @@ UINT16 SearchForWallType( UINT32 iMapIndex ) } //This method isn't foolproof, but because erasing large areas of buildings could result in -//multiple roof types for each building. When processing the region, it is necessary to +//multiple roof types for each building. When processing the region, it is necessary to //calculate the roof type by searching for the nearest roof tile. UINT16 SearchForRoofType( UINT32 iMapIndex ) { @@ -108,7 +108,7 @@ UINT16 SearchForRoofType( UINT32 iMapIndex ) } return 0xffff; } - + BOOLEAN RoofAtGridNo( UINT32 iMapIndex ) { LEVELNODE *pRoof; @@ -139,7 +139,7 @@ BOOLEAN BuildingAtGridNo( UINT32 iMapIndex ) BOOLEAN ValidDecalPlacement( UINT32 iMapIndex ) { - if( GetVerticalWall( iMapIndex ) || GetHorizontalWall( iMapIndex ) + if( GetVerticalWall( iMapIndex ) || GetHorizontalWall( iMapIndex ) || GetVerticalFence( iMapIndex ) || GetHorizontalFence( iMapIndex ) ) return TRUE; return FALSE; @@ -157,7 +157,7 @@ LEVELNODE* GetVerticalWall( UINT32 iMapIndex ) { GetTileType( pStruct->usIndex, &uiTileType ); if ( uiTileType >= FIRSTWALL && uiTileType <= LASTWALL || - uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) + uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) { GetWallOrientation( pStruct->usIndex, &usWallOrientation ); if( usWallOrientation == INSIDE_TOP_RIGHT || usWallOrientation == OUTSIDE_TOP_RIGHT ) @@ -183,7 +183,7 @@ LEVELNODE* GetHorizontalWall( UINT32 iMapIndex ) { GetTileType( pStruct->usIndex, &uiTileType ); if ( uiTileType >= FIRSTWALL && uiTileType <= LASTWALL || - uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) + uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) { GetWallOrientation( pStruct->usIndex, &usWallOrientation ); if( usWallOrientation == INSIDE_TOP_LEFT || usWallOrientation == OUTSIDE_TOP_LEFT ) @@ -398,12 +398,12 @@ void RestoreWalls( UINT32 iMapIndex ) { return; } - //we are in a special case here. The user is attempting to restore a wall, though nothing - //is here. We will hook into the smart wall method by tricking it into using the local wall + //we are in a special case here. The user is attempting to restore a wall, though nothing + //is here. We will hook into the smart wall method by tricking it into using the local wall //type, but only if we have adjacent walls. fDone = FALSE; if( pWall = GetHorizontalWall( iMapIndex - 1 ) ) - fDone = TRUE; + fDone = TRUE; if( !fDone && (pWall = GetHorizontalWall( iMapIndex + 1 )) ) fDone = TRUE; if( !fDone && (pWall = GetVerticalWall( iMapIndex - WORLD_COLS )) ) @@ -412,7 +412,7 @@ void RestoreWalls( UINT32 iMapIndex ) fDone = TRUE; if( !fDone ) return; - //found a wall. Let's back up the current wall value, and restore it after pasting a smart wall. + //found a wall. Let's back up the current wall value, and restore it after pasting a smart wall. if( pWall ) { GetTileType( pWall->usIndex, &uiTileType ); @@ -422,7 +422,7 @@ void RestoreWalls( UINT32 iMapIndex ) if( usWallType != 0xffff ) { ubSaveWallUIValue = gubWallUIValue; //save the wall UI value. - gubWallUIValue = (UINT8)usWallType; //trick the UI value + gubWallUIValue = (UINT8)usWallType; //trick the UI value PasteSmartWall( iMapIndex ); //paste smart wall with fake UI value gubWallUIValue = ubSaveWallUIValue; //restore the real UI value. } @@ -443,7 +443,7 @@ UINT16 GetWallClass( LEVELNODE *pWall ) { if( usWallIndex == gbWallTileLUT[row][col] ) { - return row; //row is the wall class + return row; //row is the wall class } } } @@ -466,4 +466,4 @@ UINT16 GetHorizontalWallClass( UINT16 iMapIndex ) return 0xffff; } -#endif \ No newline at end of file +#endif diff --git a/Editor/Summary Info.h b/Editor/Summary Info.h index cc2885ab..2895b26c 100644 --- a/Editor/Summary Info.h +++ b/Editor/Summary Info.h @@ -65,10 +65,10 @@ typedef struct SUMMARYFILE // //----- // 190 //start version 10 - EXITGRID ExitGrid[4]; //5*4 // 20 - UINT16 usExitGridSize[4]; //2*4 // 8 - BOOLEAN fInvalidDest[4]; // 4 - UINT8 ubNumExitGridDests; // 1 + EXITGRID ExitGrid[4]; //5*4 // 20 + UINT16 usExitGridSize[4]; //2*4 // 8 + BOOLEAN fInvalidDest[4]; // 4 + UINT8 ubNumExitGridDests; // 1 BOOLEAN fTooManyExitGridDests; // 1 // //----- // // 224 @@ -77,7 +77,7 @@ typedef struct SUMMARYFILE // //----- // 225 //start version 12 - UINT16 usWarningRoomNums; // 2 + UINT16 usWarningRoomNums; // 2 // 227 //start version 13 UINT8 ubEnemiesHaveWaypoints; // 1 diff --git a/Editor/edit_sys.cpp b/Editor/edit_sys.cpp index 049b6573..ce301a5b 100644 --- a/Editor/edit_sys.cpp +++ b/Editor/edit_sys.cpp @@ -39,9 +39,9 @@ void PasteTextureEx( INT16 sGridNo, UINT16 usType ); void PasteTextureFromRadiusEx( INT16 sGridNo, UINT16 usType, UINT8 ubRadius ); -BOOLEAN gfWarning = FALSE; +BOOLEAN gfWarning = FALSE; -BOOLEAN gfDoFill = FALSE; +BOOLEAN gfDoFill = FALSE; UINT16 CurrentPaste = NO_TILE; UINT16 gDebrisPaste = NO_TILE; UINT16 gChangeElevation = FALSE; @@ -78,9 +78,9 @@ void DeleteStuffFromMapTile( UINT32 iMapIndex ) //UINT32 uiCheckType; //UINT16 usDummy; - //GetTileType( gpWorldLevelData[ iMapIndex ].pLandHead->usIndex, &uiCheckType ); - //RemoveLand( iMapIndex, gpWorldLevelData[ iMapIndex ].pLandHead->usIndex ); - //SmoothTerrainRadius( iMapIndex, uiCheckType, 1, TRUE ); + //GetTileType( gpWorldLevelData[ iMapIndex ].pLandHead->usIndex, &uiCheckType ); + //RemoveLand( iMapIndex, gpWorldLevelData[ iMapIndex ].pLandHead->usIndex ); + //SmoothTerrainRadius( iMapIndex, uiCheckType, 1, TRUE ); RemoveExitGridFromWorld( iMapIndex ); RemoveAllStructsOfTypeRange( iMapIndex, FIRSTTEXTURE, WIREFRAMES ); @@ -122,20 +122,20 @@ void EraseMapTile( UINT32 iMapIndex ) case DRAW_MODE_EXITGRID: AddToUndoList( iMapIndex ); RemoveExitGridFromWorld( iMapIndex ); - RemoveTopmost( (UINT16)iMapIndex, FIRSTPOINTERS8 ); + RemoveTopmost( (INT16)iMapIndex, FIRSTPOINTERS8 ); break; - case DRAW_MODE_GROUND: + case DRAW_MODE_GROUND: // Is there ground on this tile? if not, get out o here if ( gpWorldLevelData[ iMapIndex ].pLandHead == NULL ) break; - + // is there only 1 ground tile here? if so, get out o here if ( gpWorldLevelData[ iMapIndex ].pLandHead->pNext == NULL ) break; AddToUndoList( iMapIndex ); - GetTileType( gpWorldLevelData[ iMapIndex ].pLandHead->usIndex, &uiCheckType ); - RemoveLand( iMapIndex, gpWorldLevelData[ iMapIndex ].pLandHead->usIndex ); - SmoothTerrainRadius( iMapIndex, uiCheckType, 1, TRUE ); + GetTileType( gpWorldLevelData[ iMapIndex ].pLandHead->usIndex, &uiCheckType ); + RemoveLand( iMapIndex, gpWorldLevelData[ iMapIndex ].pLandHead->usIndex ); + SmoothTerrainRadius( iMapIndex, uiCheckType, 1, TRUE ); break; case DRAW_MODE_OSTRUCTS: case DRAW_MODE_OSTRUCTS1: @@ -217,7 +217,7 @@ void EraseMapTile( UINT32 iMapIndex ) //--------------------------------------------------------------------------------------------------------------- // PasteDebris -// +// // Place some "debris" on the map at the current mouse coordinates. This function is called repeatedly if // the current brush size is larger than 1 tile. // @@ -232,7 +232,7 @@ void PasteDebris( UINT32 iMapIndex ) pNumSelList = &iNumDebrisSelected; if ( iMapIndex < 0x8000 ) - { + { AddToUndoList( iMapIndex ); // Remove any debris that is currently at this map location @@ -343,7 +343,7 @@ void PasteSingleToilet( UINT32 iMapIndex ) // PasteSingleWallCommon // // Common paste routine for PasteSingleWall, PasteSingleDoor, PasteSingleDecoration, and -// PasteSingleDecor (above). +// PasteSingleDecor (above). // void PasteSingleWallCommon( UINT32 iMapIndex ) { @@ -352,7 +352,7 @@ void PasteSingleWallCommon( UINT32 iMapIndex ) UINT16 usTempIndex; if ( iMapIndex < 0x8000 ) - { + { AddToUndoList( iMapIndex ); usUseIndex = pSelList[ iCurBank ].usIndex; @@ -360,7 +360,7 @@ void PasteSingleWallCommon( UINT32 iMapIndex ) // TEMP STUFF FOR ONROOF THINGS! if ( (usUseObjIndex >= FIRSTONROOF) && (usUseObjIndex <= SECONDONROOF ) ) - { + { // Add to onroof section! AddOnRoofToTail( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ); @@ -382,7 +382,7 @@ void PasteSingleWallCommon( UINT32 iMapIndex ) { // PLace shadow for doors if( !gfBasement ) - AddExclusiveShadow( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex - FIRSTDOOR + FIRSTDOORSHADOW ] + usUseIndex ) ); + AddExclusiveShadow( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex - FIRSTDOOR + FIRSTDOORSHADOW ] + usUseIndex ) ); } // Is it a wall? @@ -399,15 +399,15 @@ void PasteSingleWallCommon( UINT32 iMapIndex ) // Slap down wall/window/door/decoration (no smoothing) AddWallToStructLayer( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex), TRUE ); } - } + } // Is it a door/window/decoration? else if ( ( (usUseObjIndex >= FIRSTDOOR) && (usUseObjIndex <= LASTDOOR)) || - ((usUseObjIndex >= FIRSTDECORATIONS) && (usUseObjIndex <= LASTDECORATIONS)) ) + ((usUseObjIndex >= FIRSTDECORATIONS) && (usUseObjIndex <= LASTDECORATIONS)) ) { // Slap down wall/window/door/decoration (no smoothing) AddWallToStructLayer( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex), TRUE ); } - else if ( ((usUseObjIndex >= FIRSTROOF) && (usUseObjIndex <= LASTROOF)) || + else if ( ((usUseObjIndex >= FIRSTROOF) && (usUseObjIndex <= LASTROOF)) || ((usUseObjIndex >= FIRSTSLANTROOF) && (usUseObjIndex <= LASTSLANTROOF)) ) { // Put a roof on this tile (even if nothing else is here) @@ -423,7 +423,7 @@ void PasteSingleWallCommon( UINT32 iMapIndex ) AddLandToHead( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ); } else if( usUseObjIndex >= FIRSTWALLDECAL && usUseObjIndex <= LASTWALLDECAL || - usUseObjIndex >= FIFTHWALLDECAL && usUseObjIndex <= EIGTHWALLDECAL ) + usUseObjIndex >= FIFTHWALLDECAL && usUseObjIndex <= EIGTHWALLDECAL ) { // Plop a decal here RemoveAllStructsOfTypeRange( iMapIndex, FIRSTWALLDECAL, LASTWALLDECAL ); @@ -431,7 +431,7 @@ void PasteSingleWallCommon( UINT32 iMapIndex ) AddStructToTail( iMapIndex, (UINT16)( gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex ) ); } - else if ( usUseObjIndex >= FIRSTISTRUCT && usUseObjIndex <= LASTISTRUCT || + else if ( usUseObjIndex >= FIRSTISTRUCT && usUseObjIndex <= LASTISTRUCT || usUseObjIndex >= FIFTHISTRUCT && usUseObjIndex <= EIGHTISTRUCT ) { AddStructToHead( iMapIndex, (UINT16)( gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex ) ); @@ -460,7 +460,7 @@ UINT16 GetRandomIndexByRange( UINT16 usRangeStart, UINT16 usRangeEnd ) usNumInPickList = 0; for ( usWhich = 0; usWhich < *pNumSelList; usWhich++ ) { - usObject = (UINT16)pSelList[ usWhich ].uiObject; + usObject = (UINT16)pSelList[ usWhich ].uiObject; if ( (usObject >= usRangeStart) && (usObject <= usRangeEnd) ) { usPickList[ usNumInPickList ] = usObject; @@ -476,15 +476,15 @@ UINT16 GetRandomTypeByRange( UINT16 usRangeStart, UINT16 usRangeEnd ) UINT16 usNumInPickList; UINT16 i; UINT16 usObject; - UINT32 uiType; + UINT32 uiType; // Get a list of valid object to select from usNumInPickList = 0; for ( i = 0; i < *pNumSelList; i++ ) { - usObject = (UINT16)pSelList[ i ].uiObject; + usObject = (UINT16)pSelList[ i ].uiObject; if ( (usObject >= usRangeStart) && (usObject <= usRangeEnd) ) { - GetTileType( usObject, &uiType ); + GetTileType( usObject, &uiType ); usPickList[ usNumInPickList ] = (UINT16)uiType; usNumInPickList++; } @@ -495,7 +495,7 @@ UINT16 GetRandomTypeByRange( UINT16 usRangeStart, UINT16 usRangeEnd ) //--------------------------------------------------------------------------------------------------------------- // PasteStructure (See also PasteStructure1, PasteStructure2, and PasteStructureCommon) -// +// // Puts a structure (trees, trucks, etc.) into the world // void PasteStructure( UINT32 iMapIndex ) @@ -508,7 +508,7 @@ void PasteStructure( UINT32 iMapIndex ) //--------------------------------------------------------------------------------------------------------------- // PasteStructure1 (See also PasteStructure, PasteStructure2, and PasteStructureCommon) -// +// // Puts a structure (trees, trucks, etc.) into the world // void PasteStructure1( UINT32 iMapIndex ) @@ -521,7 +521,7 @@ void PasteStructure1( UINT32 iMapIndex ) //--------------------------------------------------------------------------------------------------------------- // PasteStructure2 (See also PasteStructure, PasteStructure1, and PasteStructureCommon) -// +// // Puts a structure (trees, trucks, etc.) into the world // void PasteStructure2( UINT32 iMapIndex ) @@ -541,7 +541,6 @@ void PasteStructure2( UINT32 iMapIndex ) // void PasteStructureCommon( UINT32 iMapIndex ) { -// BOOLEAN fDoPaste = FALSE; UINT32 fHeadType; UINT16 usUseIndex; UINT16 usUseObjIndex; @@ -549,7 +548,7 @@ void PasteStructureCommon( UINT32 iMapIndex ) BOOLEAN fOkayToAdd; if ( iMapIndex < 0x8000 ) - { + { /* if ( gpWorldLevelData[ iMapIndex ].pStructHead != NULL ) { @@ -566,7 +565,7 @@ void PasteStructureCommon( UINT32 iMapIndex ) iRandSelIndex = GetRandomSelection( ); if ( iRandSelIndex == -1 ) { - return; + return; } AddToUndoList( iMapIndex ); @@ -581,9 +580,9 @@ void PasteStructureCommon( UINT32 iMapIndex ) // Actual structure info is added by the functions below AddStructToHead( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ); // For now, adjust to shadows by a hard-coded amount, - + // Add mask if in long grass - GetLandHeadType( iMapIndex, &fHeadType ); + GetLandHeadType( iMapIndex, &fHeadType ); } } } @@ -606,7 +605,7 @@ void PasteBanks( UINT32 iMapIndex, UINT16 usStructIndex , BOOLEAN fReplace) UINT16 usUseIndex; UINT16 usUseObjIndex; UINT16 usIndex; - + pSelList = SelBanks; pNumSelList = &iNumBanksSelected; @@ -614,10 +613,10 @@ void PasteBanks( UINT32 iMapIndex, UINT16 usStructIndex , BOOLEAN fReplace) usUseObjIndex = (UINT16)pSelList[ iCurBank ].uiObject; if ( iMapIndex < 0x8000 ) - { + { fDoPaste = TRUE; - if ( gpWorldLevelData[ iMapIndex ].pStructHead != NULL ) + if ( gpWorldLevelData[ iMapIndex ].pStructHead != NULL ) { // CHECK IF THE SAME TILE IS HERE if ( gpWorldLevelData[ iMapIndex ].pStructHead->usIndex == (UINT16)( gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex ) ) @@ -647,7 +646,7 @@ void PasteBanks( UINT32 iMapIndex, UINT16 usStructIndex , BOOLEAN fReplace) { AddStructToHead( iMapIndex, (UINT16)( gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex ) ); // Add shadows - if ( !gfBasement && usUseObjIndex == FIRSTCLIFF ) + if ( !gfBasement && usUseObjIndex == FIRSTCLIFF ) { //AddShadowToHead( iMapIndex, (UINT16)( gTileTypeStartIndex[ usUseObjIndex - FIRSTCLIFF + FIRSTCLIFFSHADOW ] + usUseIndex ) ); AddObjectToHead( iMapIndex, (UINT16)( gTileTypeStartIndex[ usUseObjIndex - FIRSTCLIFF + FIRSTCLIFFHANG ] + usUseIndex ) ); @@ -661,7 +660,7 @@ void PasteBanks( UINT32 iMapIndex, UINT16 usStructIndex , BOOLEAN fReplace) void PasteRoads( UINT32 iMapIndex ) { UINT16 usUseIndex; - + pSelList = SelRoads; pNumSelList = &iNumRoadsSelected; @@ -691,56 +690,56 @@ void PasteTexture( UINT32 iMapIndex ) // void PasteTextureCommon( UINT32 iMapIndex ) { - UINT8 ubLastHighLevel; - UINT16 usTileIndex; - //UINT16 Dummy; - - if ( CurrentPaste != NO_TILE && iMapIndex < 0x8000 ) - { + UINT8 ubLastHighLevel; + UINT16 usTileIndex; + //UINT16 Dummy; - // Set undo, then set new - AddToUndoList( iMapIndex ); + if ( CurrentPaste != NO_TILE && iMapIndex < 0x8000 ) + { - if ( CurrentPaste == DEEPWATERTEXTURE ) - { - // IF WE ARE PASTING DEEP WATER AND WE ARE NOT OVER WATER, IGNORE! - if ( TypeExistsInLandLayer( iMapIndex, REGWATERTEXTURE, &usTileIndex ) ) - { + // Set undo, then set new + AddToUndoList( iMapIndex ); + + if ( CurrentPaste == DEEPWATERTEXTURE ) + { + // IF WE ARE PASTING DEEP WATER AND WE ARE NOT OVER WATER, IGNORE! + if ( TypeExistsInLandLayer( iMapIndex, REGWATERTEXTURE, &usTileIndex ) ) + { if ( !gTileDatabase[ usTileIndex ].ubFullTile ) { - return; + return; } - } - else - { + } + else + { return; - } - } + } + } - // Don't draw over floors - if ( TypeRangeExistsInLandLayer( iMapIndex, FIRSTFLOOR, FOURTHFLOOR, &usTileIndex ) ) - { - return; - } + // Don't draw over floors + if ( TypeRangeExistsInLandLayer( iMapIndex, FIRSTFLOOR, FOURTHFLOOR, &usTileIndex ) ) + { + return; + } - // Compare heights and do appropriate action - if ( AnyHeigherLand( iMapIndex, CurrentPaste, &ubLastHighLevel ) ) - { - // Here we do the following: - // - Remove old type from layer - // - Smooth World with old type - // - Add a 3 by 3 square of new type at head - // - Smooth World with new type - PasteHigherTexture( iMapIndex, CurrentPaste ); + // Compare heights and do appropriate action + if ( AnyHeigherLand( iMapIndex, CurrentPaste, &ubLastHighLevel ) ) + { + // Here we do the following: + // - Remove old type from layer + // - Smooth World with old type + // - Add a 3 by 3 square of new type at head + // - Smooth World with new type + PasteHigherTexture( iMapIndex, CurrentPaste ); - } - else - { + } + else + { PasteTextureEx( (INT16)iMapIndex, CurrentPaste ); SmoothTerrainRadius( iMapIndex, CurrentPaste, 1, TRUE ); - } + } } } @@ -753,17 +752,17 @@ void PasteTextureCommon( UINT32 iMapIndex ) // void PasteHigherTexture( UINT32 iMapIndex, UINT32 fNewType ) { - UINT16 NewTile; - UINT8 ubLastHighLevel; - UINT32 *puiDeletedTypes = NULL; - UINT8 ubNumTypes; - UINT8 cnt; + UINT16 NewTile; + UINT8 ubLastHighLevel; + UINT32 *puiDeletedTypes = NULL; + UINT8 ubNumTypes; + UINT8 cnt; - // Here we do the following: - // - Remove old type from layer - // - Smooth World with old type - // - Add a 3 by 3 square of new type at head - // - Smooth World with new type + // Here we do the following: + // - Remove old type from layer + // - Smooth World with old type + // - Add a 3 by 3 square of new type at head + // - Smooth World with new type //if ( iMapIndex < 0x8000 && TypeRangeExistsInLandLayer( iMapIndex, FIRSTFLOOR, LASTFLOOR, &NewTile ) ) //ATE: DONOT DO THIS!!!!!!! - I know what was intended - not to draw over floors - this @@ -771,41 +770,41 @@ void PasteHigherTexture( UINT32 iMapIndex, UINT32 fNewType ) //return; - if ( iMapIndex < 0x8000 && AnyHeigherLand( iMapIndex, fNewType, &ubLastHighLevel )) - { - AddToUndoList( iMapIndex ); + if ( iMapIndex < 0x8000 && AnyHeigherLand( iMapIndex, fNewType, &ubLastHighLevel )) + { + AddToUndoList( iMapIndex ); - // - For all heigher level, remove - RemoveHigherLandLevels( iMapIndex, fNewType, &puiDeletedTypes, &ubNumTypes ); + // - For all heigher level, remove + RemoveHigherLandLevels( iMapIndex, fNewType, &puiDeletedTypes, &ubNumTypes ); - // Set with a radius of 1 and smooth according to height difference - SetLowerLandIndexWithRadius( iMapIndex, fNewType, 1 , TRUE ); + // Set with a radius of 1 and smooth according to height difference + SetLowerLandIndexWithRadius( iMapIndex, fNewType, 1 , TRUE ); - // Smooth all deleted levels - for ( cnt = 0; cnt < ubNumTypes; cnt++ ) - { + // Smooth all deleted levels + for ( cnt = 0; cnt < ubNumTypes; cnt++ ) + { SmoothTerrainRadius( iMapIndex, puiDeletedTypes[ cnt ], 1, TRUE ); - } + } - MemFree( puiDeletedTypes ); + MemFree( puiDeletedTypes ); - } - else if ( iMapIndex < 0x8000 ) - { + } + else if ( iMapIndex < 0x8000 ) + { AddToUndoList( iMapIndex ); - GetTileIndexFromTypeSubIndex( fNewType, REQUIRES_SMOOTHING_TILE, &NewTile ); + GetTileIndexFromTypeSubIndex( fNewType, REQUIRES_SMOOTHING_TILE, &NewTile ); SetLandIndex( iMapIndex, NewTile, fNewType, FALSE ); // Smooth item then adding here SmoothTerrain( iMapIndex, fNewType, &NewTile, FALSE ); - if ( NewTile != NO_TILE ) - { + if ( NewTile != NO_TILE ) + { // Change tile SetLandIndex( iMapIndex, NewTile, fNewType, FALSE ); - } - } + } + } } @@ -816,17 +815,17 @@ void PasteHigherTexture( UINT32 iMapIndex, UINT32 fNewType ) // BOOLEAN PasteHigherTextureFromRadius( INT32 iMapIndex, UINT32 uiNewType, UINT8 ubRadius ) { - INT16 sTop, sBottom; - INT16 sLeft, sRight; - INT16 cnt1, cnt2; + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2; INT32 iNewIndex; INT32 iXPos,iYPos; - + // Determine start and end indicies and num rows sTop = ubRadius; sBottom = -ubRadius; - sLeft = -ubRadius; - sRight = ubRadius; + sLeft = -ubRadius; + sRight = ubRadius; iXPos = (iMapIndex % WORLD_COLS); iYPos = (iMapIndex - iXPos) / WORLD_COLS; @@ -870,7 +869,7 @@ BOOLEAN PasteExistingTexture( UINT32 iMapIndex, UINT16 usIndex ) //UINT16 Dummy; // If here, we want to make, esentially, what is a type in - // a level other than TOP-MOST the TOP-MOST level. + // a level other than TOP-MOST the TOP-MOST level. // We should: // - remove what was top-most // - re-adjust the world to reflect missing top-most peice @@ -881,7 +880,7 @@ BOOLEAN PasteExistingTexture( UINT32 iMapIndex, UINT16 usIndex ) //if ( TypeRangeExistsInLandLayer( iMapIndex, FIRSTFLOOR, LASTFLOOR, &Dummy ) ) // return( FALSE ); - // Get top tile index + // Get top tile index // Remove all land peices except GetTileType( usIndex, &uiNewType ); @@ -899,7 +898,7 @@ BOOLEAN PasteExistingTexture( UINT32 iMapIndex, UINT16 usIndex ) SetLandIndex( iMapIndex, usIndex, uiNewType, FALSE ); // ATE: Set this land peice to require smoothing again! - SmoothAllTerrainTypeRadius( iMapIndex, 2, TRUE ); + SmoothAllTerrainTypeRadius( iMapIndex, 2, TRUE ); return( TRUE ); } @@ -912,21 +911,21 @@ BOOLEAN PasteExistingTexture( UINT32 iMapIndex, UINT16 usIndex ) // BOOLEAN PasteExistingTextureFromRadius( INT32 iMapIndex, UINT16 usIndex, UINT8 ubRadius ) { - INT16 sTop, sBottom; - INT16 sLeft, sRight; - INT16 cnt1, cnt2; + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2; INT32 iNewIndex; INT32 leftmost; - + // Determine start end end indicies and num rows sTop = ubRadius; sBottom = -ubRadius; - sLeft = - ubRadius; - sRight = ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; if ( iMapIndex >= 0x8000 ) return ( FALSE ); - + for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) { @@ -936,8 +935,8 @@ BOOLEAN PasteExistingTextureFromRadius( INT32 iMapIndex, UINT16 usIndex, UINT8 u { iNewIndex = iMapIndex + ( WORLD_COLS * cnt1 ) + cnt2; - if ( iNewIndex >=0 && iNewIndex < WORLD_MAX && - iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) ) + if ( iNewIndex >=0 && iNewIndex < WORLD_MAX && + iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) ) { AddToUndoList( iMapIndex ); PasteExistingTexture( iNewIndex, usIndex ); @@ -961,20 +960,20 @@ BOOLEAN SetLowerLandIndexWithRadius( INT32 iMapIndex, UINT32 uiNewType, UINT8 ub INT16 sTop, sBottom; INT16 sLeft, sRight; INT16 cnt1, cnt2; - INT32 iNewIndex; + INT32 iNewIndex; BOOLEAN fDoPaste = FALSE; INT32 leftmost; UINT8 ubLastHighLevel; - UINT32 *puiSmoothTiles = NULL; - INT16 sNumSmoothTiles = 0; + UINT32 *puiSmoothTiles = NULL; + INT16 sNumSmoothTiles = 0; UINT16 usTemp; UINT16 NewTile; //,Dummy; // Determine start end end indicies and num rows sTop = ubRadius; sBottom = -ubRadius; - sLeft = - ubRadius; - sRight = ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; if ( iMapIndex >= 0x8000 ) return ( FALSE ); @@ -988,8 +987,8 @@ BOOLEAN SetLowerLandIndexWithRadius( INT32 iMapIndex, UINT32 uiNewType, UINT8 ub { iNewIndex = iMapIndex + ( WORLD_COLS * cnt1 ) + cnt2; - if ( iNewIndex >=0 && iNewIndex < WORLD_MAX && - iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) ) + if ( iNewIndex >=0 && iNewIndex < WORLD_MAX && + iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) ) { if ( fReplace ) @@ -1003,9 +1002,9 @@ BOOLEAN SetLowerLandIndexWithRadius( INT32 iMapIndex, UINT32 uiNewType, UINT8 ub fDoPaste = TRUE; } } - + //if ( fDoPaste && !TypeRangeExistsInLandLayer( iMapIndex, FIRSTFLOOR, LASTFLOOR, &Dummy ) ) - if ( fDoPaste ) + if ( fDoPaste ) { if ( iMapIndex == iNewIndex ) { @@ -1046,7 +1045,7 @@ BOOLEAN SetLowerLandIndexWithRadius( INT32 iMapIndex, UINT32 uiNewType, UINT8 ub // Once here, smooth any tiles that need it if ( sNumSmoothTiles > 0 ) { - for ( cnt1 = 0; cnt1 < sNumSmoothTiles; cnt1++ ) + for ( cnt1 = 0; cnt1 < sNumSmoothTiles; cnt1++ ) { SmoothTerrainRadius( puiSmoothTiles[ cnt1 ], uiNewType, 10, FALSE ); @@ -1062,17 +1061,17 @@ BOOLEAN SetLowerLandIndexWithRadius( INT32 iMapIndex, UINT32 uiNewType, UINT8 ub void PasteTextureEx( INT16 sGridNo, UINT16 usType ) { UINT16 usIndex; - UINT8 ubTypeLevel; + UINT8 ubTypeLevel; UINT16 NewTile; // CHECK IF THIS TEXTURE EXISTS! - if ( TypeExistsInLandLayer( sGridNo, usType, &usIndex ) ) - { + if ( TypeExistsInLandLayer( sGridNo, usType, &usIndex ) ) + { if ( GetTypeLandLevel( sGridNo, usType, &ubTypeLevel ) ) { // If top-land , do not change if ( ubTypeLevel != LANDHEAD ) - { + { PasteExistingTexture( sGridNo, usIndex ); } } @@ -1080,10 +1079,10 @@ void PasteTextureEx( INT16 sGridNo, UINT16 usType ) else { - // Fill with just first tile, smoothworld() will pick proper piece later - GetTileIndexFromTypeSubIndex( usType, REQUIRES_SMOOTHING_TILE, &NewTile ); + // Fill with just first tile, smoothworld() will pick proper piece later + GetTileIndexFromTypeSubIndex( usType, REQUIRES_SMOOTHING_TILE, &NewTile ); - SetLandIndex( sGridNo, NewTile, usType, FALSE ); + SetLandIndex( sGridNo, NewTile, usType, FALSE ); } } @@ -1091,21 +1090,21 @@ void PasteTextureEx( INT16 sGridNo, UINT16 usType ) void PasteTextureFromRadiusEx( INT16 sGridNo, UINT16 usType, UINT8 ubRadius ) { - INT16 sTop, sBottom; - INT16 sLeft, sRight; - INT16 cnt1, cnt2; + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2; INT32 iNewIndex; INT32 leftmost; - + // Determine start end end indicies and num rows sTop = ubRadius; sBottom = -ubRadius; - sLeft = - ubRadius; - sRight = ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; if ( sGridNo >= 0x8000 ) return; - + for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) { @@ -1115,8 +1114,8 @@ void PasteTextureFromRadiusEx( INT16 sGridNo, UINT16 usType, UINT8 ubRadius ) { iNewIndex = sGridNo + ( WORLD_COLS * cnt1 ) + cnt2; - if ( iNewIndex >=0 && iNewIndex < WORLD_MAX && - iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) ) + if ( iNewIndex >=0 && iNewIndex < WORLD_MAX && + iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) ) { PasteTextureEx( sGridNo, usType ); } @@ -1145,12 +1144,10 @@ void RaiseWorldLand( ) BOOLEAN fSomethingRaised = FALSE; UINT8 ubLoop; UINT16 usIndex; - BOOLEAN fStopRaise = FALSE; - INT32 iCounterA = 0, iCounterB = 0; INT32 iStartNumberOfRaises = 0; INT32 iNumberOfRaises = 0; BOOLEAN fAboutToRaise = FALSE; - + fRaise=FALSE; fRaiseSet=FALSE; @@ -1160,7 +1157,7 @@ void RaiseWorldLand( ) gpWorldLevelData[cnt].uiFlags &= (~MAPELEMENT_RAISE_LAND_END ); } - + for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) { @@ -1176,13 +1173,12 @@ void RaiseWorldLand( ) pStruct = pStruct->pNext; continue; } - pTileElement = &(gTileDatabase[ pStruct->usIndex ]); if (pTileElement->fType==FIRSTCLIFF) - { + { 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 ) { // DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("Cliff has %d children", pTileElement->ubNumberOfTiles)); @@ -1194,7 +1190,7 @@ void RaiseWorldLand( ) // presently by CLIFF object/tileset 1 // so simply detect this tile set and turn off instead of on // element 1 is 12 tiles and is unique - + sTempGridNo = cnt + pTileElement->pTileLocData[ubLoop].bTileOffsetX + pTileElement->pTileLocData[ubLoop].bTileOffsetY * WORLD_COLS; // Check for valid gridno if ( OutOfBounds( (INT16)cnt, (INT16)sTempGridNo ) ) @@ -1202,7 +1198,7 @@ void RaiseWorldLand( ) continue; } //if (pTileElement->ubNumberOfTiles==10) - if((usIndex==LAND_DROP_1)||(usIndex==LAND_DROP_2) ||(usIndex==LAND_DROP_4)) + if((usIndex==LAND_DROP_1)||(usIndex==LAND_DROP_2) ||(usIndex==LAND_DROP_4)) { gpWorldLevelData[sTempGridNo].uiFlags &= (~MAPELEMENT_RAISE_LAND_START ); gpWorldLevelData[sTempGridNo].uiFlags |= MAPELEMENT_RAISE_LAND_END; @@ -1267,10 +1263,10 @@ void RaiseWorldLand( ) } if (gpWorldLevelData[cnt].uiFlags&MAPELEMENT_RAISE_LAND_START) { - fRaiseSet=TRUE; + fRaiseSet=TRUE; } else if((gpWorldLevelData[cnt].uiFlags&MAPELEMENT_RAISE_LAND_END)&&(!fRaiseSet)) - { + { // there is a dropoff without a rise. // back up and set beginning to raiseland start gpWorldLevelData[cnt+((WORLD_ROWS-1)-(cnt%WORLD_ROWS))].uiFlags &= (~MAPELEMENT_RAISE_LAND_END ); @@ -1302,7 +1298,7 @@ void RaiseWorldLand( ) fRaiseSet = FALSE; } else if((gpWorldLevelData[cnt].uiFlags&MAPELEMENT_RAISE_LAND_END)||(gpWorldLevelData[cnt-1].uiFlags&MAPELEMENT_RAISE_LAND_END) || ( gpWorldLevelData[cnt+1].uiFlags&MAPELEMENT_RAISE_LAND_END) ) - { + { fRaiseSet=FALSE; } if (fRaiseSet) @@ -1319,20 +1315,20 @@ void RaiseWorldLand( ) // Now go through the world, starting at x=max(x) and y=max(y) and work backwards // if a cliff is found turn raise flag on, if the end of a screen is found, turn off - // the system uses world_cord=x+y*(row_size) + // the system uses world_cord=x+y*(row_size) - for (cnt=WORLD_MAX-1; cnt >= 0; cnt--) + for (cnt=WORLD_MAX-1; cnt >= 0; cnt--) { - // reset the RAISE to FALSE - // End of the row + // reset the RAISE to FALSE + // End of the row if ( !(cnt % WORLD_ROWS) ) { iNumberOfRaises = 0; iStartNumberOfRaises = 0; } - if( ( gpWorldLevelData[cnt].uiFlags & MAPELEMENT_RAISE_LAND_END ) ) + if( ( gpWorldLevelData[cnt].uiFlags & MAPELEMENT_RAISE_LAND_END ) ) { if( cnt > 1 ) { @@ -1344,11 +1340,11 @@ void RaiseWorldLand( ) } else if( gpWorldLevelData[cnt].uiFlags & MAPELEMENT_RAISE_LAND_START ) { - // check tile before and after, if either are raise land flagged, then don't increment number of + // check tile before and after, if either are raise land flagged, then don't increment number of // raises if( cnt < WORLD_MAX - 2 ) { - if( ( !( gpWorldLevelData[ cnt + 1 ].uiFlags & MAPELEMENT_RAISE_LAND_START) && !( gpWorldLevelData[ cnt + 2 ].uiFlags & MAPELEMENT_RAISE_LAND_START ) ) ) + if( ( !( gpWorldLevelData[ cnt + 1 ].uiFlags & MAPELEMENT_RAISE_LAND_START) && !( gpWorldLevelData[ cnt + 2 ].uiFlags & MAPELEMENT_RAISE_LAND_START ) ) ) { iNumberOfRaises++; } @@ -1365,7 +1361,7 @@ void RaiseWorldLand( ) iNumberOfRaises = iStartNumberOfRaises; continue; } - + if( iNumberOfRaises >= 0 ) { //DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("Land Raise start at count: %d is raised",cnt )); @@ -1373,19 +1369,19 @@ void RaiseWorldLand( ) } } - for (cnt=WORLD_MAX-1; cnt >= 0; cnt--) + for (cnt=WORLD_MAX-1; cnt >= 0; cnt--) { if( ( cnt < WORLD_MAX - WORLD_ROWS ) && ( cnt > WORLD_ROWS ) ) { - if( ( gpWorldLevelData[cnt + WORLD_ROWS ].sHeight == gpWorldLevelData[cnt - WORLD_ROWS ].sHeight ) && ( gpWorldLevelData[ cnt ].sHeight!= gpWorldLevelData[cnt - WORLD_ROWS ].sHeight ) ) + if( ( gpWorldLevelData[cnt + WORLD_ROWS ].sHeight == gpWorldLevelData[cnt - WORLD_ROWS ].sHeight ) && ( gpWorldLevelData[ cnt ].sHeight!= gpWorldLevelData[cnt - WORLD_ROWS ].sHeight ) ) { gpWorldLevelData[cnt].sHeight = gpWorldLevelData[cnt + WORLD_ROWS ].sHeight; } - else if( ( gpWorldLevelData[ cnt ].sHeight > gpWorldLevelData[cnt - WORLD_ROWS ].sHeight )&& ( gpWorldLevelData[cnt + WORLD_ROWS ].sHeight != gpWorldLevelData[cnt - WORLD_ROWS ].sHeight ) && ( gpWorldLevelData[cnt ].sHeight > gpWorldLevelData[cnt + WORLD_ROWS ].sHeight ) ) + else if( ( gpWorldLevelData[ cnt ].sHeight > gpWorldLevelData[cnt - WORLD_ROWS ].sHeight )&& ( gpWorldLevelData[cnt + WORLD_ROWS ].sHeight != gpWorldLevelData[cnt - WORLD_ROWS ].sHeight ) && ( gpWorldLevelData[cnt ].sHeight > gpWorldLevelData[cnt + WORLD_ROWS ].sHeight ) ) { if( gpWorldLevelData[cnt - WORLD_ROWS ].sHeight > gpWorldLevelData[cnt + WORLD_ROWS ].sHeight ) { - gpWorldLevelData[ cnt ].sHeight = gpWorldLevelData[cnt - WORLD_ROWS ].sHeight; + gpWorldLevelData[ cnt ].sHeight = gpWorldLevelData[cnt - WORLD_ROWS ].sHeight; } else { @@ -1448,6 +1444,7 @@ void EliminateObjectLayerRedundancy() - + + diff --git a/Editor/edit_sys.h b/Editor/edit_sys.h index bea3566e..ff76c8bf 100644 --- a/Editor/edit_sys.h +++ b/Editor/edit_sys.h @@ -17,9 +17,9 @@ #define DRAW_CLIFFS 1 #define DRAW_CLIFF_LAND 2 -extern BOOLEAN gfWarning; +extern BOOLEAN gfWarning; -extern BOOLEAN gfDoFill; +extern BOOLEAN gfDoFill; extern UINT16 CurrentPaste; extern UINT16 gDebrisPaste; extern UINT16 gChangeElevation; diff --git a/Editor/editscreen.cpp b/Editor/editscreen.cpp index 795304de..2561717f 100644 --- a/Editor/editscreen.cpp +++ b/Editor/editscreen.cpp @@ -25,10 +25,9 @@ #include "Interactive Tiles.h" #include "overhead types.h" #include "Overhead.h" - #include "Soldier Control.h" #include "Handle UI.h" #include "Event Pump.h" - #include "world items.h" + #include "world items.h" #include "loadscreen.h" #include "render dirty.h" #include "isometric utils.h" @@ -76,6 +75,9 @@ #include "Summary Info.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; extern CHAR8 *szMusicList[NUM_MUSIC]; @@ -101,7 +103,7 @@ GUI_BUTTON *gpPersistantButton; // These are global variables used by the main game loop -UINT32 guiSaveTacticalStatusFlags; //saves the tactical status flags when entering the editor. +UINT32 guiSaveTacticalStatusFlags; //saves the tactical status flags when entering the editor. BOOLEAN gfAutoLoadA9 = FALSE; //new vars added by Kris @@ -162,7 +164,7 @@ INT16 gsCursorGridNo; INT32 giMusicID = 0; -void EraseWorldData( ); +void EraseWorldData( ); BOOLEAN EditModeInit( void ); BOOLEAN EditModeShutdown( void ); @@ -182,7 +184,7 @@ BOOLEAN gfEditorDirty = TRUE; BOOLEAN fRaiseHeight = FALSE; INT32 iDrawMode = DRAW_MODE_NOTHING; -INT32 iCurrentAction,iActionParam; +INT32 iCurrentAction,iActionParam; INT32 iEditAction = ACTION_NULL; INT32 iEditorButton[NUMBER_EDITOR_BUTTONS]; @@ -216,7 +218,7 @@ UINT16 gusEditorTaskbarLoColor; void CreateGotoGridNoUI(); void RemoveGotoGridNoUI(); -BOOLEAN gfGotoGridNoUI = FALSE; +BOOLEAN gfGotoGridNoUI = FALSE; INT32 guiGotoGridNoUIButtonID; MOUSE_REGION GotoGridNoUIRegion; @@ -226,7 +228,7 @@ MOUSE_REGION GotoGridNoUIRegion; // This function is called once at SGP (and game) startup // UINT32 EditScreenInit(void) -{ +{ gfFakeLights = FALSE; eInfo.fGameInit = TRUE; @@ -235,13 +237,13 @@ UINT32 EditScreenInit(void) //Set the editor colors. //gusEditorTaskbarColor = 9581; - //gusEditorTaskbarColor = Get16BPPColor( FROMRGB( 72, 88, 104 ) ); + //gusEditorTaskbarColor = Get16BPPColor( FROMRGB( 72, 88, 104 ) ); //gusEditorTaskbarHiColor = Get16BPPColor( FROMRGB( 136, 138, 135 ) ); - //gusEditorTaskbarLoColor = Get16BPPColor( FROMRGB( 24, 61, 81 ) ); - - gusEditorTaskbarColor = Get16BPPColor( FROMRGB( 65, 79, 94 ) ); + //gusEditorTaskbarLoColor = Get16BPPColor( FROMRGB( 24, 61, 81 ) ); + + gusEditorTaskbarColor = Get16BPPColor( FROMRGB( 65, 79, 94 ) ); gusEditorTaskbarHiColor = Get16BPPColor( FROMRGB( 122, 124, 121 ) ); - gusEditorTaskbarLoColor = Get16BPPColor( FROMRGB( 22, 55, 73 ) ); + gusEditorTaskbarLoColor = Get16BPPColor( FROMRGB( 22, 55, 73 ) ); InitClipboard(); @@ -259,7 +261,7 @@ UINT32 EditScreenInit(void) // This function is called once at shutdown of the game // UINT32 EditScreenShutdown(void) -{ +{ GameShutdownEditorMercsInfo(); RemoveAllFromUndoList(); KillClipboard(); @@ -298,7 +300,7 @@ BOOLEAN EditModeInit( void ) fEditModeFirstTime = FALSE; DisableButtonHelpTextRestore(); - + if( fFirstTimeInEditModeInit ) { if( gfWorldLoaded ) @@ -331,8 +333,8 @@ BOOLEAN EditModeInit( void ) MSYS_DisableRegion(&gRadarRegion); CreateEditorTaskbar(); - - //Hide all of the buttons here. DoTaskbar() will handle the + + //Hide all of the buttons here. DoTaskbar() will handle the //showing and hiding of the buttons. for( x = LAST_EDITORTAB_BUTTON+1; x < NUMBER_EDITOR_BUTTONS; x++ ) HideButton( iEditorButton[x] ); @@ -362,20 +364,20 @@ BOOLEAN EditModeInit( void ) gusGameLightLevel = LightGetAmbient(); if( !gfBasement && !gfCaves ) - gusLightLevel = 12;//EDITOR_LIGHT_MAX - (UINT16)LightGetAmbient(); + gusLightLevel = 12;//EDITOR_LIGHT_MAX - (UINT16)LightGetAmbient(); else gusLightLevel = EDITOR_LIGHT_MAX - (UINT16)LightGetAmbient(); - + if( gfFakeLights ) { gusSavedLightLevel = gusLightLevel; gusLightLevel = EDITOR_LIGHT_FAKE; - ClickEditorButton( MAPINFO_TOGGLE_FAKE_LIGHTS ); + ClickEditorButton( MAPINFO_TOGGLE_FAKE_LIGHTS ); } gfRenderWorld = TRUE; gfRenderTaskbar = TRUE; - + //Reset the corruption detection flags. gfCorruptMap = FALSE; gfCorruptSchedules = FALSE; @@ -388,7 +390,7 @@ BOOLEAN EditModeInit( void ) gfRoofPlacement = FALSE; EnableUndo(); - + RemoveMercsInSector( ); if( gfWorldLoaded ) { @@ -463,7 +465,7 @@ BOOLEAN EditModeShutdown( void ) fEditModeFirstTime = TRUE; UpdateLastActionBeforeLeaving(); - + DeleteEditorTaskbar(); // create clock mouse region for clock pause @@ -471,13 +473,13 @@ BOOLEAN EditModeShutdown( void ) iOldTaskMode = iCurrentTaskbar; gTacticalStatus.uiFlags = guiSaveTacticalStatusFlags; - + RemoveLightPositionHandles( ); - + MapOptimize(); - + RemoveCursors(); - + fHelpScreen = FALSE; // Set render back to normal mode gTacticalStatus.uiFlags &= ~(NOHIDE_REDUNDENCY | SHOW_ALL_ITEMS); @@ -541,7 +543,7 @@ BOOLEAN EditModeShutdown( void ) } EnableButtonHelpTextRestore(); - + if( gfNeedToInitGame ) { InitStrategicLayer(); @@ -583,7 +585,7 @@ void SetBackgroundTexture( ) { // Erase old layers RemoveAllLandsOfTypeRange( cnt, FIRSTTEXTURE, DEEPWATERTEXTURE ); - + // Add level usIndex = (UINT16)(rand( ) % 10 ); @@ -595,7 +597,7 @@ void SetBackgroundTexture( ) AddLandToTail( cnt, usIndex ); //show the land below the floor. else AddLandToHead( cnt, usIndex ); //no floor so no worries. - } + } } @@ -666,7 +668,7 @@ BOOLEAN DrawTempMouseCursorObject(void) case DRAW_MODE_ROOM: pSelList = SelRoom; pNumSelList = &iNumRoomsSelected; - return FALSE; //a special case where we just want to get the info and not display a cursor. + return FALSE; //a special case where we just want to get the info and not display a cursor. case DRAW_MODE_NEWROOF: pSelList = SelSingleNewRoof; pNumSelList = &iNumNewRoofsSelected; @@ -766,7 +768,7 @@ BOOLEAN DrawTempMouseCursorObject(void) { return FALSE; } - if( usUseObjIndex == 0xffff || usUseIndex == 0xffff ) + if( usUseObjIndex == 0xffff || usUseIndex == 0xffff ) { return FALSE; } @@ -787,7 +789,7 @@ BOOLEAN DrawTempMouseCursorObject(void) return( FALSE ); } - + //Displays the current drawing object in the small, lower left window of the editor's toolbar. void ShowCurrentDrawingMode( void ) @@ -797,7 +799,7 @@ void ShowCurrentDrawingMode( void ) UINT16 usUseIndex; UINT16 usObjIndex; INT32 iStartX = iScreenWidthOffset + 50; - INT32 iStartY = 2 * iScreenHeightOffset + 440; + INT32 iStartY = 2 * iScreenHeightOffset + 440; INT32 iPicHeight, iPicWidth; INT16 sTempOffsetX; INT16 sTempOffsetY; @@ -806,7 +808,7 @@ void ShowCurrentDrawingMode( void ) UINT8 *pDestBuf; UINT16 usFillColor; INT32 iIndexToUse; - + // Set up a clipping rectangle for the display window. NewRect.iLeft = iScreenWidthOffset + 0; NewRect.iTop = 2 * iScreenHeightOffset + 400; @@ -854,7 +856,7 @@ void ShowCurrentDrawingMode( void ) usObjIndex = (UINT16)SelOStructs[ iIndexToUse ].uiObject; } break; - + case DRAW_MODE_OSTRUCTS1: if ( iNumOStructs1Selected > 0 ) { @@ -914,7 +916,7 @@ void ShowCurrentDrawingMode( void ) { usUseIndex = SelSingleWindow[ iCurBank ].usIndex; usObjIndex = (UINT16)SelSingleWindow[ iCurBank ].uiObject; - } + } break; case DRAW_MODE_ROOFS: if ( iNumRoofsSelected > 0 ) @@ -1006,7 +1008,7 @@ void ShowCurrentDrawingMode( void ) DisplayItemStatistics(); break; } - + // If we actually have something to draw, draw it if ( (usUseIndex != 0xffff) && (usObjIndex != 0xffff) ) { @@ -1028,9 +1030,9 @@ void ShowCurrentDrawingMode( void ) pETRLEObject->sOffsetY = 0; SetObjectShade( gTileDatabase[gTileTypeStartIndex[usObjIndex]].hTileSurface, DEFAULT_SHADE_LEVEL ); - BltVideoObject( FRAME_BUFFER, gTileDatabase[gTileTypeStartIndex[usObjIndex]].hTileSurface, - usUseIndex, (iScreenWidthOffset + 0 + iStartX), (2 * iScreenHeightOffset + 400 + iStartY), - VO_BLT_SRCTRANSPARENCY, NULL); + BltVideoObject( FRAME_BUFFER, gTileDatabase[gTileTypeStartIndex[usObjIndex]].hTileSurface, + usUseIndex, (iScreenWidthOffset + 0 + iStartX), (2 * iScreenHeightOffset + 400 + iStartY), + VO_BLT_SRCTRANSPARENCY, NULL); pETRLEObject->sOffsetX = sTempOffsetX; pETRLEObject->sOffsetY = sTempOffsetY; @@ -1070,7 +1072,7 @@ void HandleJA2ToolbarSelection( void ) case TBAR_MODE_SET_BGRND: iCurrentAction = ACTION_SET_NEW_BACKGROUND; break; - + case TBAR_MODE_DENS_DWN: iCurrentAction = ACTION_DENSITY_DOWN; break; @@ -1188,7 +1190,7 @@ void HandleJA2ToolbarSelection( void ) iCurrentAction = ACTION_NULL; iDrawMode = DRAW_MODE_BANKS; break; - + case TBAR_MODE_GET_DEBRIS: iCurrentAction = ACTION_NEXT_DEBRIS; iDrawMode = DRAW_MODE_DEBRIS; @@ -1198,7 +1200,7 @@ void HandleJA2ToolbarSelection( void ) iCurrentAction = ACTION_NULL; iDrawMode = DRAW_MODE_DEBRIS; break; - + case TBAR_MODE_GET_OSTRUCTS: iCurrentAction = ACTION_NEXT_STRUCT; iDrawMode = DRAW_MODE_OSTRUCTS; @@ -1218,7 +1220,7 @@ void HandleJA2ToolbarSelection( void ) iCurrentAction = ACTION_NULL; iDrawMode = DRAW_MODE_OSTRUCTS1; break; - + case TBAR_MODE_GET_OSTRUCTS2: iCurrentAction = ACTION_NEXT_STRUCT2; iDrawMode = DRAW_MODE_OSTRUCTS2; @@ -1252,7 +1254,7 @@ void HandleJA2ToolbarSelection( void ) case TBAR_MODE_CHANGE_BRUSH: iCurrentAction = ACTION_NEXT_SELECTIONTYPE; break; - + case TBAR_MODE_ERASE: switch ( iDrawMode ) { @@ -1296,6 +1298,7 @@ void HandleJA2ToolbarSelection( void ) case TBAR_MODE_ITEM_WEAPONS: case TBAR_MODE_ITEM_AMMO: case TBAR_MODE_ITEM_ARMOUR: + case TBAR_MODE_ITEM_LBEGEAR: case TBAR_MODE_ITEM_EXPLOSIVES: case TBAR_MODE_ITEM_EQUIPMENT1: case TBAR_MODE_ITEM_EQUIPMENT2: @@ -1331,7 +1334,7 @@ extern void DeleteSelectedMercsItem(); void HandleKeyboardShortcuts( ) { static INT32 iSavedMode; - static BOOLEAN fShowTrees = TRUE; + static BOOLEAN fShowTrees = TRUE; while( DequeueEvent( &EditorInputEvent ) ) { if( !HandleSummaryInput( &EditorInputEvent ) && !HandleTextInput( &EditorInputEvent ) && EditorInputEvent.usEvent == KEY_DOWN ) @@ -1514,7 +1517,7 @@ void HandleKeyboardShortcuts( ) gfRenderWorld = TRUE; gfRenderTaskbar = TRUE; break; - + case F2: if (EditorInputEvent.usKeyState & ALT_DOWN ) { @@ -1540,7 +1543,7 @@ void HandleKeyboardShortcuts( ) case F5: UpdateLastActionBeforeLeaving(); - CreateSummaryWindow(); + CreateSummaryWindow(); break; case F6: @@ -1561,7 +1564,7 @@ void HandleKeyboardShortcuts( ) if( gubWorldRoomInfo[ i ] ) { AddToUndoList( i ); - RemoveAllRoofsOfTypeRange( i, FIRSTTEXTURE, LASTITEM ); + RemoveAllRoofsOfTypeRange( i, FIRSTTEXTURE, LASTITEM ); RemoveAllOnRoofsOfTypeRange( i, FIRSTTEXTURE, LASTITEM ); RemoveAllShadowsOfTypeRange( i, FIRSTROOF, LASTSLANTROOF ); usRoofIndex = (UINT16) (9 + ( rand() % 3 )); @@ -1599,7 +1602,7 @@ void HandleKeyboardShortcuts( ) case ']': iCurrentAction = ACTION_DENSITY_UP; break; - + case '+': //if ( iDrawMode == DRAW_MODE_SHOW_TILESET ) // iCurrentAction = ACTION_MLIST_DWN; @@ -1677,7 +1680,7 @@ void HandleKeyboardShortcuts( ) iCurrentAction = ACTION_NULL; iDrawMode = DRAW_MODE_DEBRIS; - ClickEditorButton( TERRAIN_PLACE_DEBRIS ); + ClickEditorButton( TERRAIN_PLACE_DEBRIS ); iEditorToolbarState = TBAR_MODE_DRAW_DEBRIS; TerrainTileDrawMode = TERRAIN_TILES_NODRAW; break; @@ -1731,7 +1734,7 @@ void HandleKeyboardShortcuts( ) { CreateGotoGridNoUI(); } - else + else { if ( iCurrentTaskbar != TASK_TERRAIN ) { @@ -1764,7 +1767,7 @@ void HandleKeyboardShortcuts( ) UpdateLastActionBeforeLeaving(); iCurrentAction = ACTION_LOAD_MAP; break; - } + } if ( iCurrentTaskbar != TASK_TERRAIN ) { iTaskMode = TASK_TERRAIN; @@ -1779,11 +1782,11 @@ void HandleKeyboardShortcuts( ) } else { - ClearRenderFlags( RENDER_FLAG_ROOMIDS ); + ClearRenderFlags( RENDER_FLAG_ROOMIDS ); UnclickEditorButton( BUILDING_TOGGLE_INFO_VIEW ); } break; - case 'o': + case 'o': if ( iCurrentTaskbar != TASK_TERRAIN ) { iTaskMode = TASK_TERRAIN; @@ -1791,7 +1794,7 @@ void HandleKeyboardShortcuts( ) } iCurrentAction = ACTION_NULL; iDrawMode = DRAW_MODE_OSTRUCTS2; - ClickEditorButton( TERRAIN_PLACE_MISC ); + ClickEditorButton( TERRAIN_PLACE_MISC ); iEditorToolbarState = TBAR_MODE_DRAW_OSTRUCTS2; break; case 'r': // rocks @@ -1802,7 +1805,7 @@ void HandleKeyboardShortcuts( ) } iCurrentAction = ACTION_NULL; iDrawMode = DRAW_MODE_OSTRUCTS1; - ClickEditorButton( TERRAIN_PLACE_ROCKS ); + ClickEditorButton( TERRAIN_PLACE_ROCKS ); iEditorToolbarState = TBAR_MODE_DRAW_OSTRUCTS1; break; case 's': @@ -1819,7 +1822,7 @@ void HandleKeyboardShortcuts( ) } iCurrentAction = ACTION_NULL; iDrawMode = DRAW_MODE_OSTRUCTS; - ClickEditorButton( TERRAIN_PLACE_TREES ); + ClickEditorButton( TERRAIN_PLACE_TREES ); iEditorToolbarState = TBAR_MODE_DRAW_OSTRUCTS; break; case 'T': @@ -1853,9 +1856,9 @@ void HandleKeyboardShortcuts( ) } break; - case 'x': + case 'x': if (EditorInputEvent.usKeyState & ALT_DOWN ) - { + { if( InOverheadMap() ) KillOverheadMap(); if( gfEditingDoor ) @@ -1913,9 +1916,9 @@ UINT32 PerformSelectedAction( void ) case ACTION_ERASE_WAYPOINT: EraseMercWaypoint(); break; - + case ACTION_SET_WAYPOINT: - iMapIndex = MAPROWCOLTOPOS( sGridY, sGridX ); + iMapIndex = MAPROWCOLTOPOS( sGridY, sGridX ); AddMercWaypoint( iMapIndex ); break; @@ -1928,10 +1931,10 @@ UINT32 PerformSelectedAction( void ) fHelpScreen = TRUE; fAllDone = FALSE; break; - + case ACTION_QUICK_ERASE: if ( (gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA) && GetMouseXY( &sGridX, &sGridY ) ) - { + { iMapIndex = MAPROWCOLTOPOS( sGridY, sGridX ); if ( iMapIndex < 0x8000 ) @@ -1940,7 +1943,7 @@ UINT32 PerformSelectedAction( void ) } } break; - + case ACTION_QUIT_GAME: gfProgramIsRunning = FALSE; case ACTION_EXIT_EDITOR: @@ -1999,7 +2002,7 @@ UINT32 PerformSelectedAction( void ) else { gCurrentBackground = TerrainBackgroundTile; - SetBackgroundTexture( ); + SetBackgroundTexture( ); fBeenWarned = FALSE; } break; @@ -2009,23 +2012,23 @@ UINT32 PerformSelectedAction( void ) switch ( iDrawMode ) { case DRAW_MODE_BANKS: - if ( iNumBanksSelected > 0 ) + if ( iNumBanksSelected > 0 ) iCurBank = (iCurBank + 1) % iNumBanksSelected; break; case DRAW_MODE_ROADS: - if ( iNumRoadsSelected > 0 ) + if ( iNumRoadsSelected > 0 ) iCurBank = (iCurBank + 1) % iNumRoadsSelected; break; case DRAW_MODE_WALLS: - if ( iNumWallsSelected > 0 ) + if ( iNumWallsSelected > 0 ) iCurBank = (iCurBank + 1) % iNumWallsSelected; break; case DRAW_MODE_DOORS: - if ( iNumDoorsSelected > 0 ) + if ( iNumDoorsSelected > 0 ) iCurBank = (iCurBank + 1) % iNumDoorsSelected; break; case DRAW_MODE_WINDOWS: - if ( iNumWindowsSelected > 0 ) + if ( iNumWindowsSelected > 0 ) iCurBank = (iCurBank + 1) % iNumWindowsSelected; break; case DRAW_MODE_ROOFS: @@ -2037,11 +2040,11 @@ UINT32 PerformSelectedAction( void ) iCurBank = (iCurBank + 1) % iNumBrokenWallsSelected; break; case DRAW_MODE_DECOR: - if ( iNumDecorSelected > 0 ) + if ( iNumDecorSelected > 0 ) iCurBank = (iCurBank + 1) % iNumDecorSelected; break; case DRAW_MODE_DECALS: - if ( iNumDecalsSelected > 0 ) + if ( iNumDecalsSelected > 0 ) iCurBank = (iCurBank + 1) % iNumDecalsSelected; break; case DRAW_MODE_FLOORS: @@ -2087,23 +2090,23 @@ UINT32 PerformSelectedAction( void ) switch ( iDrawMode ) { case DRAW_MODE_BANKS: - if ( iNumBanksSelected > 0 ) + if ( iNumBanksSelected > 0 ) iCurBank = (iCurBank + (iNumBanksSelected - 1)) % iNumBanksSelected; break; case DRAW_MODE_ROADS: - if ( iNumRoadsSelected > 0 ) + if ( iNumRoadsSelected > 0 ) iCurBank = (iCurBank + (iNumRoadsSelected - 1)) % iNumRoadsSelected; break; case DRAW_MODE_WALLS: - if ( iNumWallsSelected > 0 ) + if ( iNumWallsSelected > 0 ) iCurBank = (iCurBank + (iNumWallsSelected - 1)) % iNumWallsSelected; break; case DRAW_MODE_DOORS: - if ( iNumDoorsSelected > 0 ) + if ( iNumDoorsSelected > 0 ) iCurBank = (iCurBank + (iNumDoorsSelected - 1)) % iNumDoorsSelected; break; case DRAW_MODE_WINDOWS: - if ( iNumWindowsSelected > 0 ) + if ( iNumWindowsSelected > 0 ) iCurBank = (iCurBank + (iNumWindowsSelected - 1)) % iNumWindowsSelected; break; case DRAW_MODE_ROOFS: @@ -2111,15 +2114,15 @@ UINT32 PerformSelectedAction( void ) iCurBank = (iCurBank + (iNumRoofsSelected - 1)) % iNumRoofsSelected; break; case DRAW_MODE_BROKEN_WALLS: - if ( iNumBrokenWallsSelected > 0 ) + if ( iNumBrokenWallsSelected > 0 ) iCurBank = (iCurBank + (iNumBrokenWallsSelected - 1)) % iNumBrokenWallsSelected; break; case DRAW_MODE_DECOR: - if ( iNumDecorSelected > 0 ) + if ( iNumDecorSelected > 0 ) iCurBank = (iCurBank + (iNumDecorSelected - 1)) % iNumDecorSelected; break; case DRAW_MODE_DECALS: - if ( iNumDecalsSelected > 0 ) + if ( iNumDecalsSelected > 0 ) iCurBank = (iCurBank + (iNumDecalsSelected - 1)) % iNumDecalsSelected; break; case DRAW_MODE_FLOORS: @@ -2196,7 +2199,7 @@ UINT32 PerformSelectedAction( void ) UpdateLastActionBeforeLeaving(); return LOADSAVE_SCREEN; - case ACTION_LOAD_MAP: + case ACTION_LOAD_MAP: UpdateLastActionBeforeLeaving(); return LOADSAVE_SCREEN; @@ -2217,7 +2220,7 @@ UINT32 PerformSelectedAction( void ) fAllDone = FALSE; break; - case ACTION_SHADE_UP: + case ACTION_SHADE_UP: if ( EditorInputEvent.usKeyState & SHIFT_DOWN ) { gShadePercent+= (FLOAT).05; @@ -2234,7 +2237,7 @@ UINT32 PerformSelectedAction( void ) SetShadeTablePercent( gShadePercent ); break; - case ACTION_SHADE_DWN: + case ACTION_SHADE_DWN: if ( EditorInputEvent.usKeyState & SHIFT_DOWN ) { gShadePercent-= (FLOAT).05; @@ -2265,19 +2268,19 @@ UINT32 PerformSelectedAction( void ) AddWallToStructLayer( iMapIndex, FIRSTWALL19, TRUE ); break; - case ACTION_NEXT_STRUCT: + case ACTION_NEXT_STRUCT: CreateJA2SelectionWindow( SELWIN_OSTRUCTS ); fSelectionWindow = TRUE; fAllDone = FALSE; break; - - case ACTION_NEXT_STRUCT1: + + case ACTION_NEXT_STRUCT1: CreateJA2SelectionWindow( SELWIN_OSTRUCTS1 ); fSelectionWindow = TRUE; fAllDone = FALSE; break; - case ACTION_NEXT_STRUCT2: + case ACTION_NEXT_STRUCT2: CreateJA2SelectionWindow( SELWIN_OSTRUCTS2 ); fSelectionWindow = TRUE; fAllDone = FALSE; @@ -2388,7 +2391,7 @@ UINT32 ProcessEditscreenMessageBoxResponse() else if( iDrawMode == DRAW_MODE_NEW_GROUND ) { gCurrentBackground = TerrainBackgroundTile; - SetBackgroundTexture( ); + SetBackgroundTexture( ); SetEditorTerrainTaskbarMode( TERRAIN_FGROUND_TEXTURES ); return EDIT_SCREEN; } @@ -2403,7 +2406,7 @@ UINT32 ProcessEditscreenMessageBoxResponse() // UINT32 WaitForHelpScreenResponse( void ) { - InputAtom DummyEvent; + InputAtom DummyEvent; BOOLEAN fLeaveScreen; ColorFillVideoSurfaceArea(FRAME_BUFFER, iScreenWidthOffset + 50, iScreenHeightOffset + 50, iScreenWidthOffset + 590, iScreenHeightOffset + 310, @@ -2415,67 +2418,67 @@ UINT32 WaitForHelpScreenResponse( void ) SetFont( gp12PointFont1 ); - gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 55, L"HOME" ); + gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 55, L"HOME" ); gprintf( iScreenWidthOffset + 205, iScreenHeightOffset + 55, L"Toggle fake editor lighting ON/OFF" ); gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 67, L"INSERT" ); gprintf( iScreenWidthOffset + 205, iScreenHeightOffset + 67, L"Toggle fill mode ON/OFF" ); - gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 79, L"BKSPC" ); + gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 79, L"BKSPC" ); gprintf( iScreenWidthOffset + 205, iScreenHeightOffset + 79, L"Undo last change" ); - gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 91, L"DEL" ); + gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 91, L"DEL" ); gprintf( iScreenWidthOffset + 205, iScreenHeightOffset + 91, L"Quick erase object under mouse cursor" ); - gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 103, L"ESC" ); + gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 103, L"ESC" ); gprintf( iScreenWidthOffset + 205, iScreenHeightOffset + 103, L"Exit editor" ); - gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 115, L"PGUP/PGDN" ); + gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 115, L"PGUP/PGDN" ); gprintf( iScreenWidthOffset + 205, iScreenHeightOffset + 115, L"Change object to be pasted" ); - gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 127, L"F1" ); + gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 127, L"F1" ); gprintf( iScreenWidthOffset + 205, iScreenHeightOffset + 127, L"This help screen" ); - gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 139, L"F10" ); + gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 139, L"F10" ); gprintf( iScreenWidthOffset + 205, iScreenHeightOffset + 139, L"Save current map" ); - gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 151, L"F11" ); + gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 151, L"F11" ); gprintf( iScreenWidthOffset + 205, iScreenHeightOffset + 151, L"Load map as current" ); - gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 163, L"+/-" ); + gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 163, L"+/-" ); gprintf( iScreenWidthOffset + 205, iScreenHeightOffset + 163, L"Change shadow darkness by .01" ); - gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 175, L"SHFT +/-" ); + gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 175, L"SHFT +/-" ); gprintf( iScreenWidthOffset + 205, iScreenHeightOffset + 175, L"Change shadow darkness by .05" ); - gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 187, L"0 - 9" ); + gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 187, L"0 - 9" ); gprintf( iScreenWidthOffset + 205, iScreenHeightOffset + 187, L"Change map/tileset filename" ); - - gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 199, L"b" ); + + gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 199, L"b" ); gprintf( iScreenWidthOffset + 205, iScreenHeightOffset + 199, L"Change brush size" ); - - gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 211, L"d" ); + + gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 211, L"d" ); gprintf( iScreenWidthOffset + 205, iScreenHeightOffset + 211, L"Draw debris" ); - gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 223, L"o" ); + gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 223, L"o" ); gprintf( iScreenWidthOffset + 205, iScreenHeightOffset + 223, L"Draw obstacle" ); - gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 235, L"r" ); + gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 235, L"r" ); gprintf( iScreenWidthOffset + 205, iScreenHeightOffset + 235, L"Draw rocks" ); - gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 247, L"t" ); + gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 247, L"t" ); gprintf( iScreenWidthOffset + 205, iScreenHeightOffset + 247, L"Toggle trees display ON/OFF" ); - gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 259, L"g" ); + gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 259, L"g" ); gprintf( iScreenWidthOffset + 205, iScreenHeightOffset + 259, L"Draw ground textures" ); - gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 271, L"w" ); + gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 271, L"w" ); gprintf( iScreenWidthOffset + 205, iScreenHeightOffset + 271, L"Draw building walls" ); - gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 283, L"e" ); + gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 283, L"e" ); gprintf( iScreenWidthOffset + 205, iScreenHeightOffset + 283, L"Toggle erase mode ON/OFF" ); - gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 295, L"h" ); + gprintf( iScreenWidthOffset + 55, iScreenHeightOffset + 295, L"h" ); gprintf( iScreenWidthOffset + 205, iScreenHeightOffset + 295, L"Toggle roofs ON/OFF" ); @@ -2501,7 +2504,7 @@ UINT32 WaitForHelpScreenResponse( void ) if ( (_LeftButtonDown) || (_RightButtonDown) || fLeaveScreen ) { fHelpScreen = FALSE; - + while( DequeueEvent( &DummyEvent ) ) continue; @@ -2524,7 +2527,7 @@ UINT32 WaitForHelpScreenResponse( void ) // UINT32 WaitForSelectionWindowResponse( void ) { - InputAtom DummyEvent; + InputAtom DummyEvent; while (DequeueEvent(&DummyEvent) == TRUE) { @@ -2552,7 +2555,7 @@ UINT32 WaitForSelectionWindowResponse( void ) } } } - + if ( DoWindowSelection( ) ) { fSelectionWindow = FALSE; @@ -2626,8 +2629,8 @@ void ShowCurrentSlotSurface( UINT32 vSurface, INT32 iWindow ) WinRect.iRight = (iWindow == 0) ? (iScreenWidthOffset + 485) : (iScreenWidthOffset + 637); WinRect.iBottom = 2 * iScreenHeightOffset + 399; - ColorFillVideoSurfaceArea(FRAME_BUFFER, WinRect.iLeft - 1, WinRect.iTop - 1, - WinRect.iRight + 1, WinRect.iBottom + 1, + ColorFillVideoSurfaceArea(FRAME_BUFFER, WinRect.iLeft - 1, WinRect.iTop - 1, + WinRect.iRight + 1, WinRect.iBottom + 1, Get16BPPColor(FROMRGB(128, 0, 0)) ); iWinWidth = WinRect.iRight - WinRect.iLeft; @@ -2665,16 +2668,16 @@ void ShowCurrentSlotSurface( UINT32 vSurface, INT32 iWindow ) } vSfx.SrcRect = ClipRect; - BltVideoSurface( FRAME_BUFFER, vSurface, 0, - iStartX, iStartY, - VS_BLT_SRCSUBRECT, &vSfx ); + BltVideoSurface( FRAME_BUFFER, vSurface, 0, + iStartX, iStartY, + VS_BLT_SRCSUBRECT, &vSfx ); } //---------------------------------------------------------------------------------------------- // ShowCurrentSlotImage // -// Displays the image of the currently highlighted tileset slot image. Usually this is for +// Displays the image of the currently highlighted tileset slot image. Usually this is for // 8 bit image (.STI) files // void ShowCurrentSlotImage( HVOBJECT hVObj, INT32 iWindow ) @@ -2716,8 +2719,8 @@ void ShowCurrentSlotImage( HVOBJECT hVObj, INT32 iWindow ) pETRLEObject->sOffsetY = 0; SetObjectShade( hVObj, DEFAULT_SHADE_LEVEL ); - BltVideoObject( FRAME_BUFFER, hVObj, 0, (iStartX), (iStartY), - VO_BLT_SRCTRANSPARENCY, NULL); + BltVideoObject( FRAME_BUFFER, hVObj, 0, (iStartX), (iStartY), + VO_BLT_SRCTRANSPARENCY, NULL); pETRLEObject->sOffsetX = sTempOffsetX; pETRLEObject->sOffsetY = sTempOffsetY; @@ -2747,21 +2750,21 @@ BOOLEAN PlaceLight( INT16 sRadius, INT16 iMapX, INT16 iMapY, INT16 sType ) ubIntensity = (UINT8)((float)sRadius / LIGHT_DECAY); if ( (iLightHandle = LightCreateOmni( ubIntensity, sRadius )) == (-1) ) { - // Can't create light template + // Can't create light template DebugMsg(TOPIC_GAME, DBG_LEVEL_1, String("PlaceLight: Can't create light template for radius %d",sRadius) ); return( FALSE ); } if ( !LightSave( iLightHandle, Filename ) ) { - // Can't save light template + // Can't save light template DebugMsg(TOPIC_GAME, DBG_LEVEL_1, String("PlaceLight: Can't save light template for radius %d",sRadius) ); return( FALSE ); - } + } if ( (iLightHandle = LightSpriteCreate( Filename, sType )) == (-1) ) { - // Can't create sprite + // Can't create sprite DebugMsg(TOPIC_GAME, DBG_LEVEL_1, String("PlaceLight: Can't create light sprite of radius %d",sRadius) ); return( FALSE ); } @@ -2769,7 +2772,7 @@ BOOLEAN PlaceLight( INT16 sRadius, INT16 iMapX, INT16 iMapY, INT16 sType ) if ( !LightSpritePower( iLightHandle, TRUE ) ) { - // Can't turn this light on + // Can't turn this light on DebugMsg(TOPIC_GAME, DBG_LEVEL_1, String("PlaceLight: Can't turn on light %d",iLightHandle) ); return( FALSE ); } @@ -2807,10 +2810,10 @@ BOOLEAN PlaceLight( INT16 sRadius, INT16 iMapX, INT16 iMapY, INT16 sType ) //---------------------------------------------------------------------------------------------- // RemoveLight // -// Removes (erases) all lights at a given map tile location. Lights that are attached to a merc +// Removes (erases) all lights at a given map tile location. Lights that are attached to a merc // are not deleted. // -// Returns TRUE if deleted the light, otherwise, returns FALSE. +// Returns TRUE if deleted the light, otherwise, returns FALSE. // i.e. FALSE is not an error condition! // BOOLEAN RemoveLight( INT16 iMapX, INT16 iMapY ) @@ -2830,7 +2833,7 @@ BOOLEAN RemoveLight( INT16 iMapX, INT16 iMapY ) for(iCount=0; iCount < MAX_LIGHT_SPRITES; iCount++) { if(LightSprites[iCount].uiFlags & LIGHT_SPR_ACTIVE) - { + { if ( LightSprites[iCount].iX == iMapX && LightSprites[iCount].iY == iMapY ) { // Found a light, so let's see if it belong to a merc! @@ -2852,18 +2855,18 @@ BOOLEAN RemoveLight( INT16 iMapX, INT16 iMapY ) LightSpritePower( iCount, FALSE ); LightSpriteDestroy( iCount ); fRemovedLight = TRUE; - iMapIndex = ((INT32)iMapY * WORLD_COLS) + (INT32)iMapX; + iMapIndex = ((INT32)iMapY * WORLD_COLS) + (INT32)iMapX; RemoveAllObjectsOfTypeRange( iMapIndex, GOODRING, GOODRING ); } } } } if( fRemovedLight ) - { + { UINT16 usRadius; - //Assuming that the light naming convention doesn't change, then this following conversion - //should work. Basically, the radius values aren't stored in the lights, so I have pull - //the radius out of the filename. Ex: L-RO5.LHT + //Assuming that the light naming convention doesn't change, then this following conversion + //should work. Basically, the radius values aren't stored in the lights, so I have pull + //the radius out of the filename. Ex: L-RO5.LHT usRadius = pLastLightName[4] - 0x30; AddLightToUndoList( iMapIndex, usRadius, (UINT8)uiLastLightType ); } @@ -2876,7 +2879,7 @@ BOOLEAN RemoveLight( INT16 iMapX, INT16 iMapY ) // ShowLightPositionHandles // // For all lights that are in the world (except lights attached to mercs), this function places -// a marker at it's location for editing purposes. +// a marker at it's location for editing purposes. // void ShowLightPositionHandles( void ) { @@ -2891,7 +2894,7 @@ void ShowLightPositionHandles( void ) for(iCount=0; iCount < MAX_LIGHT_SPRITES; iCount++) { if(LightSprites[iCount].uiFlags & LIGHT_SPR_ACTIVE) - { + { // Found a light, so let's see if it belong to a merc! fSoldierLight = FALSE; for ( cnt = 0; cnt < MAX_NUM_SOLDIERS && !fSoldierLight; cnt++ ) @@ -2934,7 +2937,7 @@ void RemoveLightPositionHandles( void ) for(iCount=0; iCount < MAX_LIGHT_SPRITES; iCount++) { if(LightSprites[iCount].uiFlags & LIGHT_SPR_ACTIVE) - { + { // Found a light, so let's see if it belong to a merc! fSoldierLight = FALSE; for ( cnt = 0; cnt < MAX_NUM_SOLDIERS && !fSoldierLight; cnt++ ) @@ -2975,7 +2978,7 @@ void RemoveLightPositionHandles( void ) BOOLEAN CheckForSlantRoofs( void ) { UINT16 usCheck; - + pSelList = SelRoom; pNumSelList = &iNumRoomsSelected; @@ -2993,14 +2996,14 @@ BOOLEAN CheckForSlantRoofs( void ) // MapOptimize // // Runs through all map locations, and if it's outside the visible world, then we remove -// EVERYTHING from it since it will never be seen! +// EVERYTHING from it since it will never be seen! // // If it can be seen, then we remove all extraneous land tiles. We find the tile that has the first // FULL TILE indicator, and delete anything that may come after it (it'll never be seen anyway) // // Doing the above has shown to free up about 1.1 Megs on the default map. Deletion of non-viewable // land pieces alone gained us about 600 K of memory. -// +// void MapOptimize(void) { #if 0 @@ -3020,7 +3023,7 @@ void MapOptimize(void) { // Tile is in viewable area so try to optimize any extra land pieces pMapTile = &gpWorldLevelData[ gridno ]; - + node = start = pMapTile->pLandStart; head = pMapTile->pLandHead; @@ -3028,7 +3031,7 @@ void MapOptimize(void) node = start = head; end = pMapTile->pLandTail; - + fChangedHead = fChangedTail = fFound = FALSE; while ( !fFound && node != NULL ) { @@ -3056,7 +3059,7 @@ void MapOptimize(void) */ // Now delete from the end to "node" - while( end != node && end != NULL ) + while( end != node && end != NULL ) { fChangedTail = TRUE; temp = end->pPrev; @@ -3112,7 +3115,7 @@ BOOLEAN CheckForFences( void ) return( fFence ); } -void EnsureStatusOfEditorButtons() +void EnsureStatusOfEditorButtons() { if ( iDrawMode >= DRAW_MODE_ERASE ) { @@ -3148,7 +3151,6 @@ void EnsureStatusOfEditorButtons() void HandleMouseClicksInGameScreen() { - //EXITGRID dummy={0,0,0,0}; INT16 sX, sY; BOOLEAN fPrevState; if( !GetMouseXY( &sGridX, &sGridY ) ) @@ -3161,7 +3163,7 @@ void HandleMouseClicksInGameScreen() { //if mouse cursor not in the game screen. return; } - + iMapIndex = MAPROWCOLTOPOS( sGridY, sGridX ); fPrevState = gfRenderWorld; @@ -3190,7 +3192,7 @@ void HandleMouseClicksInGameScreen() LightSpriteRenderAll(); // To adjust building's lighting return; } - + switch ( iDrawMode ) { case DRAW_MODE_SCHEDULEACTION: @@ -3220,7 +3222,7 @@ void HandleMouseClicksInGameScreen() gfFirstPlacement = FALSE; } break; - + case DRAW_MODE_LIGHT: // Add a normal light to the world if( gfFirstPlacement ) @@ -3256,7 +3258,7 @@ void HandleMouseClicksInGameScreen() case DRAW_MODE_SMART_WINDOWS: PasteSmartWindow( iMapIndex ); break; case DRAW_MODE_SMART_BROKEN_WALLS: PasteSmartBrokenWall( iMapIndex ); break; case DRAW_MODE_EXITGRID: - case DRAW_MODE_FLOORS: + case DRAW_MODE_FLOORS: case DRAW_MODE_GROUND: case DRAW_MODE_OSTRUCTS: case DRAW_MODE_OSTRUCTS1: @@ -3297,7 +3299,7 @@ void HandleMouseClicksInGameScreen() case DRAW_MODE_PLACE_ITEM: if( gfFirstPlacement ) { - AddSelectedItemToWorld( (UINT16)iMapIndex ); + AddSelectedItemToWorld( (INT16)iMapIndex ); gfFirstPlacement = FALSE; } break; @@ -3319,7 +3321,7 @@ void HandleMouseClicksInGameScreen() HandleRightClickOnMerc( iMapIndex ); break; case DRAW_MODE_PLACE_ITEM: - HandleRightClickOnItem( (UINT16)iMapIndex ); + HandleRightClickOnItem( (INT16)iMapIndex ); break; // Handle the right clicks in the main window to bring up the appropriate selection window @@ -3348,7 +3350,7 @@ void HandleMouseClicksInGameScreen() ProcessAreaSelection( FALSE ); break; - case DRAW_MODE_SMART_WALLS: + case DRAW_MODE_SMART_WALLS: EraseWalls( iMapIndex ); break; case DRAW_MODE_SMART_BROKEN_WALLS: @@ -3357,7 +3359,7 @@ void HandleMouseClicksInGameScreen() RestoreWalls( iMapIndex ); break; case DRAW_MODE_EXITGRID: - if( GetExitGrid( (UINT16)iMapIndex, &gExitGrid ) ) + if( GetExitGrid( (INT16)iMapIndex, &gExitGrid ) ) ApplyNewExitGridValuesToTextFields(); break; default: @@ -3410,7 +3412,7 @@ BOOLEAN DoIRenderASpecialMouseCursor() case DRAW_MODE_OSTRUCTS: case DRAW_MODE_OSTRUCTS1: if(!fDontUseRandom) - break; + break; case DRAW_MODE_BANKS: case DRAW_MODE_ROADS: case DRAW_MODE_WALLS: @@ -3429,7 +3431,7 @@ BOOLEAN DoIRenderASpecialMouseCursor() case DRAW_MODE_SMART_BROKEN_WALLS: case DRAW_MODE_ROOM: case DRAW_MODE_NEWROOF: - return DrawTempMouseCursorObject( ); + return DrawTempMouseCursorObject( ); default: break; @@ -3446,13 +3448,13 @@ void ShowEntryPoints() { //make entry points visible if( gMapInformation.sNorthGridNo != -1 ) - AddTopmostToTail( gMapInformation.sNorthGridNo, FIRSTPOINTERS2 ); + AddTopmostToTail( gMapInformation.sNorthGridNo, FIRSTPOINTERS2 ); if( gMapInformation.sEastGridNo != -1 ) - AddTopmostToTail( gMapInformation.sEastGridNo, FIRSTPOINTERS2 ); + AddTopmostToTail( gMapInformation.sEastGridNo, FIRSTPOINTERS2 ); if( gMapInformation.sSouthGridNo != -1 ) - AddTopmostToTail( gMapInformation.sSouthGridNo, FIRSTPOINTERS2 ); + AddTopmostToTail( gMapInformation.sSouthGridNo, FIRSTPOINTERS2 ); if( gMapInformation.sWestGridNo != -1 ) - AddTopmostToTail( gMapInformation.sWestGridNo, FIRSTPOINTERS2 ); + AddTopmostToTail( gMapInformation.sWestGridNo, FIRSTPOINTERS2 ); } void HideEntryPoints() @@ -3526,8 +3528,8 @@ void ProcessAreaSelection( BOOLEAN fWithLeftButton ) case DRAW_MODE_SLANTED_ROOF: AddBuildingSectionToWorld( &gSelectRegion ); break; - case DRAW_MODE_SAW_ROOM: - RemoveBuildingSectionFromWorld( &gSelectRegion ); + case DRAW_MODE_SAW_ROOM: + RemoveBuildingSectionFromWorld( &gSelectRegion ); break; case DRAW_MODE_CAVES: if( fWithLeftButton ) @@ -3567,32 +3569,32 @@ void ProcessAreaSelection( BOOLEAN fWithLeftButton ) } } -//For any drawing modes that support large cursors, or even area selection, this function calls the -//appropriate paste function for every gridno within the cursor. This is not used for functions that +//For any drawing modes that support large cursors, or even area selection, this function calls the +//appropriate paste function for every gridno within the cursor. This is not used for functions that //rely completely on selection areas, such as buildings. void DrawObjectsBasedOnSelectionRegion() { INT32 x, y, iMapIndex; BOOLEAN fSkipTest; - //Certain drawing modes are placed with 100% density. Those cases are checked here, + //Certain drawing modes are placed with 100% density. Those cases are checked here, //so the density test can be skipped. fSkipTest = FALSE; if( gusSelectionType == SMALLSELECTION || - iDrawMode == DRAW_MODE_GROUND || - iDrawMode == DRAW_MODE_FLOORS || - iDrawMode == DRAW_MODE_ROOMNUM || + iDrawMode == DRAW_MODE_GROUND || + iDrawMode == DRAW_MODE_FLOORS || + iDrawMode == DRAW_MODE_ROOMNUM || iDrawMode == DRAW_MODE_EXITGRID ) fSkipTest = TRUE; //The reason why I process the region from top to bottom then to the right is - //to even out the binary tree undo placements. Otherwise, the placements within + //to even out the binary tree undo placements. Otherwise, the placements within //the undo binary tree would alway choose the right branch because the imapindex is //always greater than the previously positioned one. //Process the cursor area for ( x = gSelectRegion.iLeft; x <= gSelectRegion.iRight; x++ ) { - //process the region from + //process the region from for ( y = gSelectRegion.iTop; y <= (INT16)gSelectRegion.iBottom; y++ ) { if( fSkipTest || PerformDensityTest() ) @@ -3600,10 +3602,10 @@ void DrawObjectsBasedOnSelectionRegion() iMapIndex = MAPROWCOLTOPOS( y, x ); switch( iDrawMode ) { - case DRAW_MODE_EXITGRID: + case DRAW_MODE_EXITGRID: AddToUndoList( iMapIndex ); - AddExitGridToWorld( iMapIndex, &gExitGrid ); - AddTopmostToTail( (UINT16)iMapIndex, FIRSTPOINTERS8 ); + AddExitGridToWorld( iMapIndex, &gExitGrid ); + AddTopmostToTail( (INT16)iMapIndex, FIRSTPOINTERS8 ); break; case DRAW_MODE_DEBRIS: PasteDebris( iMapIndex ); break; case DRAW_MODE_FLOORS: PasteSingleFloor( iMapIndex ); break; @@ -3611,7 +3613,7 @@ void DrawObjectsBasedOnSelectionRegion() case DRAW_MODE_OSTRUCTS: PasteStructure( iMapIndex ); break; case DRAW_MODE_OSTRUCTS1: PasteStructure1( iMapIndex ); break; case DRAW_MODE_OSTRUCTS2: PasteStructure2( iMapIndex ); break; - case DRAW_MODE_ROOMNUM: PasteRoomNumber( iMapIndex, gubCurrRoomNumber ); break; + case DRAW_MODE_ROOMNUM: PasteRoomNumber( iMapIndex, gubCurrRoomNumber ); break; default: return; //no point in continuing... } } @@ -3622,7 +3624,7 @@ void DrawObjectsBasedOnSelectionRegion() extern void AutoLoadMap(); //The main loop of the editor. -UINT32 EditScreenHandle( void ) +UINT32 EditScreenHandle( void ) { UINT32 uiRetVal; BOOLEAN fShowingCursor; @@ -3645,7 +3647,7 @@ UINT32 EditScreenHandle( void ) if( gfAutoLoadA9 == 2 ) AutoLoadMap(); - + if ( fEditModeFirstTime ) { EditModeInit( ); @@ -3669,8 +3671,8 @@ UINT32 EditScreenHandle( void ) // Handle the bottom task bar menu. DoTaskbar(); - //Process the variety of popup menus, dialogs, etc. - + //Process the variety of popup menus, dialogs, etc. + if( gubMessageBoxStatus ) { if( MessageBoxHandled( ) ) @@ -3691,12 +3693,12 @@ UINT32 EditScreenHandle( void ) EnsureStatusOfEditorButtons(); // Handle scrolling of the map if needed - if( !gfGotoGridNoUI && iDrawMode != DRAW_MODE_SHOW_TILESET && !gfSummaryWindowActive && + if( !gfGotoGridNoUI && iDrawMode != DRAW_MODE_SHOW_TILESET && !gfSummaryWindowActive && !gfEditingDoor && !gfNoScroll && !InOverheadMap() ) ScrollWorld(); iCurrentAction = ACTION_NULL; - + UpdateCursorAreas(); HandleMouseClicksInGameScreen(); @@ -3705,7 +3707,7 @@ UINT32 EditScreenHandle( void ) gfFirstPlacement = TRUE; //If we are copying or moving a building, we process, then delete the building layout immediately - //after releasing the mouse button. If released in the world, then the building would have been + //after releasing the mouse button. If released in the world, then the building would have been //processed in above function, HandleMouseClicksInGameScreen(). if( !_LeftButtonDown && gpBuildingLayoutList ) DeleteBuildingLayout(); @@ -3716,14 +3718,14 @@ UINT32 EditScreenHandle( void ) if ( fBuildingShowRoomInfo ) { - SetRenderFlags( RENDER_FLAG_ROOMIDS ); - } + SetRenderFlags( RENDER_FLAG_ROOMIDS ); + } if ( gfRenderWorld ) { if( gCursorNode ) gCursorNode->uiFlags &= (~LEVELNODE_REVEAL); - + // This flag is the beast that makes the renderer do everything MarkWorldDirty(); @@ -3762,7 +3764,7 @@ UINT32 EditScreenHandle( void ) } ExecuteVideoOverlays( ); - ScrollString( ); + ScrollString( ); ExecuteBaseDirtyRectQueue(); EndFrameBufferRender( ); @@ -3849,6 +3851,8 @@ UINT32 EditScreenShutdown( ) - + + + diff --git a/Editor/editscreen.h b/Editor/editscreen.h index 9616d621..249abd8c 100644 --- a/Editor/editscreen.h +++ b/Editor/editscreen.h @@ -36,7 +36,7 @@ void FindTilesetComments(void); void GetMasterList(void); void HandleJA2ToolbarSelection( void ); -void HandleKeyboardShortcuts( ); +void HandleKeyboardShortcuts( ); UINT32 PerformSelectedAction( void ); UINT32 WaitForSelectionWindowResponse( void ); UINT32 WaitForMessageBoxResponse( UINT32 uiCurrentScreen ); @@ -55,7 +55,7 @@ void MapOptimize(void); extern UINT16 GenericButtonFillColors[40]; -//These go together. The taskbar has a specific color scheme. +//These go together. The taskbar has a specific color scheme. extern UINT16 gusEditorTaskbarColor; extern UINT16 gusEditorTaskbarHiColor; extern UINT16 gusEditorTaskbarLoColor; diff --git a/Editor/messagebox.cpp b/Editor/messagebox.cpp index 24d4bd80..4f4b58ca 100644 --- a/Editor/messagebox.cpp +++ b/Editor/messagebox.cpp @@ -49,7 +49,7 @@ void CreateMessageBox( STR16 wzString ) BUTTON_NO_CALLBACK, BUTTON_NO_CALLBACK); DisableButton( iMsgBoxBgrnd ); SpecifyDisabledButtonStyle( iMsgBoxBgrnd, DISABLED_STYLE_NONE ); - + iMsgBoxOkImg = LoadButtonImage("EDITOR//ok.sti",0,1,2,3,4); iMsgBoxCancelImg = LoadButtonImage("EDITOR//cancel.sti",0,1,2,3,4); @@ -74,7 +74,7 @@ void CreateMessageBox( STR16 wzString ) BOOLEAN MessageBoxHandled() { - InputAtom DummyEvent; + InputAtom DummyEvent; while( DequeueEvent( &DummyEvent ) ) { @@ -134,7 +134,7 @@ void MsgBoxOkClkCallback( GUI_BUTTON *butn, INT32 reason ) butn->uiFlags |= BUTTON_CLICKED_ON; } else if ( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { + { gubMessageBoxStatus = MESSAGEBOX_DONE; gfMessageBoxResult = TRUE; } @@ -147,7 +147,7 @@ void MsgBoxCnclClkCallback( GUI_BUTTON *butn, INT32 reason ) butn->uiFlags |= BUTTON_CLICKED_ON; } else if ( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { + { gubMessageBoxStatus = MESSAGEBOX_DONE; gfMessageBoxResult = FALSE; } @@ -162,6 +162,7 @@ void MsgBoxCnclClkCallback( GUI_BUTTON *butn, INT32 reason ) - + + diff --git a/Editor/messagebox.h b/Editor/messagebox.h index 02715683..9f0a57fa 100644 --- a/Editor/messagebox.h +++ b/Editor/messagebox.h @@ -19,7 +19,7 @@ BOOLEAN MessageBoxHandled(); void RemoveMessageBox(); //NOTES: -//Rewrote the damn thing. It is better now because you have less management issues. +//Rewrote the damn thing. It is better now because you have less management issues. //In your screen's main loop, instead of using the previous method, you would use the following syntax: // // if( gubMessageBoxState ) @@ -29,9 +29,9 @@ void RemoveMessageBox(); // return MYCURRENT_SCREEN; // } // -// UINT32 ProcessMyOwnMessageBoxResultHandlerFunction() +// UINT32 ProcessMyOwnMessageBoxResultHandlerFunction() // { -// RemoveMessageBox(); //MUST BE HERE +// RemoveMessageBox(); //MUST BE HERE // if( gfMessageBoxResult ) //user selected yes // { // ... diff --git a/Editor/newsmooth.cpp b/Editor/newsmooth.cpp index d0a1bf65..174f8c4a 100644 --- a/Editor/newsmooth.cpp +++ b/Editor/newsmooth.cpp @@ -61,73 +61,73 @@ UINT16 GetCaveTileIndexFromPerimeterValue( UINT8 ubTotal ) UINT16 usType = FIRSTWALL; UINT16 usIndex; UINT16 usTileIndex; - + switch( ubTotal ) { - case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: + case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: case 0xf0: - //usIndex = 0; + //usIndex = 0; //break; return 0xffff; - case 0x01: case 0x11: case 0x21: case 0x31: case 0x41: case 0x51: case 0x61: case 0x71: + case 0x01: case 0x11: case 0x21: case 0x31: case 0x41: case 0x51: case 0x61: case 0x71: case 0x81: case 0x91: case 0xa1: case 0xb1: case 0xc1: case 0xd1: case 0xe1: case 0xf1: usType = SECONDWALL; - usIndex = 1 + (UINT16)Random( 4 ); + usIndex = 1 + (UINT16)Random( 4 ); break; - case 0x02: case 0x12: case 0x22: case 0x32: case 0x42: case 0x52: case 0x62: case 0x72: + case 0x02: case 0x12: case 0x22: case 0x32: case 0x42: case 0x52: case 0x62: case 0x72: case 0x82: case 0x92: case 0xa2: case 0xb2: case 0xc2: case 0xd2: case 0xe2: case 0xf2: usType = SECONDWALL; - usIndex = 5 + (UINT16)Random( 4 ); + usIndex = 5 + (UINT16)Random( 4 ); break; - case 0x03: case 0x13: case 0x43: case 0x53: case 0x83: case 0x93: case 0xc3: case 0xd3: - usIndex = 1; + case 0x03: case 0x13: case 0x43: case 0x53: case 0x83: case 0x93: case 0xc3: case 0xd3: + usIndex = 1; break; - case 0x04: case 0x14: case 0x24: case 0x34: case 0x44: case 0x54: case 0x64: case 0x74: + case 0x04: case 0x14: case 0x24: case 0x34: case 0x44: case 0x54: case 0x64: case 0x74: case 0x84: case 0x94: case 0xa4: case 0xb4: case 0xc4: case 0xd4: case 0xe4: case 0xf4: usType = SECONDWALL; - usIndex = 9 + (UINT16)Random( 4 ); + usIndex = 9 + (UINT16)Random( 4 ); break; - case 0x05: case 0x15: case 0x25: case 0x35: case 0x45: case 0x55: case 0x65: case 0x75: + case 0x05: case 0x15: case 0x25: case 0x35: case 0x45: case 0x55: case 0x65: case 0x75: case 0x85: case 0x95: case 0xa5: case 0xb5: case 0xc5: case 0xd5: case 0xe5: case 0xf5: usIndex = 2 + (UINT16)Random( 2 ); break; - case 0x06: case 0x16: case 0x26: case 0x36: case 0x86: case 0x96: case 0xa6: case 0xb6: + case 0x06: case 0x16: case 0x26: case 0x36: case 0x86: case 0x96: case 0xa6: case 0xb6: usIndex = 4; break; case 0x07: case 0x17: case 0x87: case 0x97: usIndex = 5; break; - case 0x08: case 0x18: case 0x28: case 0x38: case 0x48: case 0x58: case 0x68: case 0x78: + case 0x08: case 0x18: case 0x28: case 0x38: case 0x48: case 0x58: case 0x68: case 0x78: case 0x88: case 0x98: case 0xa8: case 0xb8: case 0xc8: case 0xd8: case 0xe8: case 0xf8: usType = SECONDWALL; - usIndex = 13 + (UINT16)Random( 4 ); + usIndex = 13 + (UINT16)Random( 4 ); break; - case 0x09: case 0x29: case 0x49: case 0x69: case 0x89: case 0xa9: case 0xc9: case 0xe9: + case 0x09: case 0x29: case 0x49: case 0x69: case 0x89: case 0xa9: case 0xc9: case 0xe9: usIndex = 6; break; - case 0x0a: case 0x1a: case 0x2a: case 0x3a: case 0x4a: case 0x5a: case 0x6a: case 0x7a: + case 0x0a: case 0x1a: case 0x2a: case 0x3a: case 0x4a: case 0x5a: case 0x6a: case 0x7a: case 0x8a: case 0x9a: case 0xaa: case 0xba: case 0xca: case 0xda: case 0xea: case 0xfa: usIndex = 7 + (UINT16)Random( 2 ); break; - case 0x0b: case 0x4b: case 0x8b: case 0xcb: + case 0x0b: case 0x4b: case 0x8b: case 0xcb: usIndex = 9; break; - case 0x0c: case 0x1c: case 0x2c: case 0x3c: case 0x4c: case 0x5c: case 0x6c: case 0x7c: + case 0x0c: case 0x1c: case 0x2c: case 0x3c: case 0x4c: case 0x5c: case 0x6c: case 0x7c: usIndex = 10; break; case 0x0d: case 0x2d: case 0x4d: case 0x6d: usIndex = 11; break; - case 0x0e: case 0x1e: case 0x2e: case 0x3e: + case 0x0e: case 0x1e: case 0x2e: case 0x3e: usIndex = 12; break; - case 0x0f: + case 0x0f: usIndex = 13; break; - case 0x19: case 0x39: case 0x59: case 0x79: case 0x99: case 0xb9: case 0xd9: case 0xf9: + case 0x19: case 0x39: case 0x59: case 0x79: case 0x99: case 0xb9: case 0xd9: case 0xf9: usIndex = 14 + (UINT16)Random( 2 ); break; - case 0x1b: case 0x5b: case 0x9b: case 0xdb: + case 0x1b: case 0x5b: case 0x9b: case 0xdb: usIndex = 16; break; case 0x1d: case 0x3d: case 0x5d: case 0x7d: @@ -136,31 +136,31 @@ UINT16 GetCaveTileIndexFromPerimeterValue( UINT8 ubTotal ) case 0x1f: usIndex = 18; break; - case 0x23: case 0x33: case 0x63: case 0x73: case 0xa3: case 0xb3: case 0xe3: case 0xf3: + case 0x23: case 0x33: case 0x63: case 0x73: case 0xa3: case 0xb3: case 0xe3: case 0xf3: usIndex = 19 + (UINT16)Random( 2 ); break; case 0x27: case 0x37: case 0xa7: case 0xb7: usIndex = 21; break; - case 0x2b: case 0x6b: case 0xab: case 0xeb: + case 0x2b: case 0x6b: case 0xab: case 0xeb: usIndex = 22; break; case 0x2f: usIndex = 23; break; - case 0x3b: case 0x7b: case 0xbb: case 0xfb: + case 0x3b: case 0x7b: case 0xbb: case 0xfb: usIndex = 24 + (UINT16)Random( 3 ); break; case 0x3f: usIndex = 27; break; - case 0x46: case 0x56: case 0x66: case 0x76: case 0xc6: case 0xd6: case 0xe6: case 0xf6: + case 0x46: case 0x56: case 0x66: case 0x76: case 0xc6: case 0xd6: case 0xe6: case 0xf6: usIndex = 28 + (UINT16)Random( 2 ); break; case 0x47: case 0x57: case 0xc7: case 0xd7: usIndex = 30; break; - case 0x4e: case 0x5e: case 0x6e: case 0x7e: + case 0x4e: case 0x5e: case 0x6e: case 0x7e: usIndex = 31; break; case 0x4f: @@ -184,7 +184,7 @@ UINT16 GetCaveTileIndexFromPerimeterValue( UINT8 ubTotal ) case 0x8d: case 0xad: case 0xcd: case 0xed: usIndex = 42; break; - case 0x8e: case 0x9e: case 0xae: case 0xbe: + case 0x8e: case 0x9e: case 0xae: case 0xbe: usIndex = 43; break; case 0x8f: @@ -202,7 +202,7 @@ UINT16 GetCaveTileIndexFromPerimeterValue( UINT8 ubTotal ) case 0xbf: usIndex = 50 + (UINT16)Random( 2 ); break; - case 0xce: case 0xde: case 0xee: case 0xfe: + case 0xce: case 0xde: case 0xee: case 0xfe: usIndex = 52 + (UINT16)Random( 3 ); break; case 0xcf: @@ -227,14 +227,14 @@ UINT16 GetCaveTileIndexFromPerimeterValue( UINT8 ubTotal ) // 16 | 1 | 32 // ---+---+--- -// 8 | | 2 +// 8 | | 2 // ---+---+--- // 128| 4 | 64 -//These values are combined in any possible order ranging in -//values from 0 - 255. If there is a cave existing in any of +//These values are combined in any possible order ranging in +//values from 0 - 255. If there is a cave existing in any of //these bordering gridnos, then the corresponding number is added -//to this total. The lookup table has been precalculated to know -//which piece to use for all of these combinations. In many cases, +//to this total. The lookup table has been precalculated to know +//which piece to use for all of these combinations. In many cases, //up to 16 combinations can share the same graphic image, as corners //may not effect the look of the piece. UINT8 CalcNewCavePerimeterValue( INT32 iMapIndex ) @@ -245,7 +245,7 @@ UINT8 CalcNewCavePerimeterValue( INT32 iMapIndex ) if( CaveAtGridNo( iMapIndex + 1 ) ) ubTotal += 0x02; //east if( CaveAtGridNo( iMapIndex + WORLD_COLS ) ) - ubTotal += 0x04; //south + ubTotal += 0x04; //south if( CaveAtGridNo( iMapIndex - 1 ) ) ubTotal += 0x08; //west if( CaveAtGridNo( iMapIndex - WORLD_COLS - 1 ) ) @@ -281,24 +281,24 @@ void AddCave( INT32 iMapIndex, UINT16 usIndex ) #define INTERIOR_BOTTOMEND_SHADOW_INDEX 31 //Wall Look Up Table containing variants and indices with each row being a different walltype. -INT8 gbWallTileLUT[NUM_WALL_TYPES][7] = -{ +INT8 gbWallTileLUT[NUM_WALL_TYPES][7] = +{ // The number of variants of this tile type. -// | The first relative index of the wall type (FIRSTWALL, SECONDWALL, etc. ) walltype + 10 -// | | The 2nd relative index ( walltype + 11 ) +// | The first relative index of the wall type (FIRSTWALL, SECONDWALL, etc. ) walltype + 10 +// | | The 2nd relative index ( walltype + 11 ) // | | | 3rd 4th 5th 6th -// | | | | | | | +// | | | | | | | 6, 10, 11, 12, 27, 28, 29, //INTERIOR_L - 6, 7, 8, 9, 24, 25, 26, //INTERIOR_R - 6, 4, 5, 6, 21, 22, 23, //EXTERIOR_L - 6, 1, 2, 3, 18, 19, 20, //EXTERIOR_R - 1, 14, 0, 0, 0, 0, 0, //INTERIOR_CORNER - 1, 15, 0, 0, 0, 0, 0, //INTERIOR_BOTTOMEND - 1, 13, 0, 0, 0, 0, 0, //EXTERIOR_BOTTOMEND - 1, 16, 0, 0, 0, 0, 0, //INTERIOR_EXTENDED - 1, 57, 0, 0, 0, 0, 0, //EXTERIOR_EXTENDED - 1, 56, 0, 0, 0, 0, 0, //INTERIOR_EXTENDED_BOTTOMEND - 1, 17, 0, 0, 0, 0, 0, //EXTERIOR_EXTENDED_BOTTOMEND + 6, 7, 8, 9, 24, 25, 26, //INTERIOR_R + 6, 4, 5, 6, 21, 22, 23, //EXTERIOR_L + 6, 1, 2, 3, 18, 19, 20, //EXTERIOR_R + 1, 14, 0, 0, 0, 0, 0, //INTERIOR_CORNER + 1, 15, 0, 0, 0, 0, 0, //INTERIOR_BOTTOMEND + 1, 13, 0, 0, 0, 0, 0, //EXTERIOR_BOTTOMEND + 1, 16, 0, 0, 0, 0, 0, //INTERIOR_EXTENDED + 1, 57, 0, 0, 0, 0, 0, //EXTERIOR_EXTENDED + 1, 56, 0, 0, 0, 0, 0, //INTERIOR_EXTENDED_BOTTOMEND + 1, 17, 0, 0, 0, 0, 0, //EXTERIOR_EXTENDED_BOTTOMEND }; //Roof table -- such a small table, using definitions instead. @@ -333,9 +333,9 @@ INT8 gbWallTileLUT[NUM_WALL_TYPES][7] = //PRIVATELY "ENCAPSULATED" FUNCTIONS //These construction functions do all the smoothing. -//NOTE: passing null for wall/roof type will force the function to search for the nearest -// existing respective type. -void BuildSlantRoof( INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom, UINT16 usWallType, UINT16 usRoofType, BOOLEAN fVertical ); +//NOTE: passing null for wall/roof type will force the function to search for the nearest +// existing respective type. +void BuildSlantRoof( INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom, UINT16 usWallType, UINT16 usRoofType, BOOLEAN fVertical ); void BulldozeNature( UINT32 iMapIndex ); void EraseRoof( UINT32 iMapIndex ); @@ -356,10 +356,10 @@ void BuildSlantRoof( INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom, UINT1 if( fVertical ) { iMapIndex = iBottom * WORLD_COLS + iLeft; - //This happens to be the only mapindex that needs to be backed up. The rest have already been + //This happens to be the only mapindex that needs to be backed up. The rest have already been //done because of the building code before this. AddToUndoList( iMapIndex + 8 ); - //Add the closest viewable pieces. There are two aframe walls pieces, and extended aframe roof pieces. + //Add the closest viewable pieces. There are two aframe walls pieces, and extended aframe roof pieces. GetTileIndexFromTypeSubIndex( usWallType, VWALL_LEFT, &usTileIndex ); AddRoofToHead( iMapIndex + 4, usTileIndex ); GetTileIndexFromTypeSubIndex( usWallType, VWALL_RIGHT, &usTileIndex ); @@ -385,10 +385,10 @@ void BuildSlantRoof( INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom, UINT1 else { iMapIndex = iTop * WORLD_COLS + iRight; - //This happens to be the only mapindex that needs to be backed up. The rest have already been + //This happens to be the only mapindex that needs to be backed up. The rest have already been //done because of the building code before this. AddToUndoList( iMapIndex + 8*WORLD_COLS ); - //Add the closest viewable pieces. There are two aframe walls pieces, and extended aframe roof pieces. + //Add the closest viewable pieces. There are two aframe walls pieces, and extended aframe roof pieces. GetTileIndexFromTypeSubIndex( usWallType, HWALL_LEFT, &usTileIndex ); AddRoofToHead( iMapIndex + 4*WORLD_COLS, usTileIndex ); GetTileIndexFromTypeSubIndex( usWallType, HWALL_RIGHT, &usTileIndex ); @@ -427,16 +427,16 @@ UINT16 PickAWallPiece( UINT16 usWallPieceType ) return usWallPieceChosen; } -//From a given gridNo and perspective (wallpiece), it will calculate the new piece, and +//From a given gridNo and perspective (wallpiece), it will calculate the new piece, and //where to place it as well as handle the special cases. -//NOTE: Placing top and left pieces are placed relative to the gridno, and the gridNo will -// shift accordingly to place the piece. Pretend you are the floor, and you want to place a piece to -// the left. You pass your position, and INTERIOR_LEFT, with interior meaning from the inside of a -// building. If you were outside the building, you would call EXTERIOR_LEFT. The left tile will be -// placed on gridNo - 1! Up tiles will be placed on gridNo - 160. -//NOTE: Passing NULL for usWallType will force it to calculate the closest existing wall type, and -// use that for building this new wall. It is necessary for restructuring a building, but not for -// adding on to an existing building, where the type is already known. +//NOTE: Placing top and left pieces are placed relative to the gridno, and the gridNo will +// shift accordingly to place the piece. Pretend you are the floor, and you want to place a piece to +// the left. You pass your position, and INTERIOR_LEFT, with interior meaning from the inside of a +// building. If you were outside the building, you would call EXTERIOR_LEFT. The left tile will be +// placed on gridNo - 1! Up tiles will be placed on gridNo - 160. +//NOTE: Passing NULL for usWallType will force it to calculate the closest existing wall type, and +// use that for building this new wall. It is necessary for restructuring a building, but not for +// adding on to an existing building, where the type is already known. void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType ) { INT16 sIndex; @@ -461,7 +461,7 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType ) AddExclusiveShadow( iMapIndex - 1, usTileIndex ); } if ( pStruct = GetVerticalWall( iMapIndex ) ) //right corner - { //Special case where placing the new wall will generate a corner to the right, so replace + { //Special case where placing the new wall will generate a corner to the right, so replace //the vertical piece with a bottomend. sIndex = PickAWallPiece( EXTERIOR_BOTTOMEND ); AddToUndoList( iMapIndex ); @@ -489,7 +489,7 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType ) ubWallClass = EXTERIOR_R; 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. ubWallClass = EXTERIOR_BOTTOMEND; } @@ -522,7 +522,7 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType ) AddToUndoList( iMapIndex + WORLD_COLS - 1 ); GetTileIndexFromTypeSubIndex( usWallType, sIndex, &usTileIndex ); ReplaceStructIndex( iMapIndex + WORLD_COLS - 1, pStruct->usIndex, usTileIndex ); - //NOTE: Not yet checking for interior extended bottomend! + //NOTE: Not yet checking for interior extended bottomend! } if( pStruct = GetVerticalWall( iMapIndex ) ) { @@ -535,7 +535,7 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType ) case INTERIOR_BOTTOM: ubWallClass = EXTERIOR_L; if( pStruct = GetVerticalWall( iMapIndex ) ) //right corner - { //Special case where placing the new wall will generate a corner to the right, so replace + { //Special case where placing the new wall will generate a corner to the right, so replace //the vertical piece with a bottomend. sIndex = PickAWallPiece( EXTERIOR_BOTTOMEND ); AddToUndoList( iMapIndex ); @@ -580,7 +580,7 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType ) case INTERIOR_RIGHT: ubWallClass = EXTERIOR_R; 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. ubWallClass = EXTERIOR_BOTTOMEND; } @@ -591,8 +591,8 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType ) else ubWallClass = EXTERIOR_EXTENDED; } - if( !gfBasement && GetHorizontalWall( iMapIndex + 1 ) && !GetHorizontalWall( iMapIndex ) - && !FloorAtGridNo( iMapIndex + WORLD_COLS ) ) + if( !gfBasement && GetHorizontalWall( iMapIndex + 1 ) && !GetHorizontalWall( iMapIndex ) + && !FloorAtGridNo( iMapIndex + WORLD_COLS ) ) { GetTileIndexFromTypeSubIndex( usWallType, INTERIOR_BOTTOMEND_SHADOW_INDEX, &usTileIndex ); AddExclusiveShadow( iMapIndex, usTileIndex ); @@ -618,9 +618,9 @@ void RebuildRoofUsingFloorInfo( INT32 iMapIndex, UINT16 usRoofType ) usRoofType = SearchForRoofType( iMapIndex ); } if( usRoofType == 0xffff ) - return; //no roof type around, so don't draw one. + return; //no roof type around, so don't draw one. //Analyse the mapindex for walls and set the flags. - //NOTE: There is no support for more than 2 side on a roof, so if there is, draw TOPLEFT + //NOTE: There is no support for more than 2 side on a roof, so if there is, draw TOPLEFT AddToUndoList( iMapIndex ); EraseRoof( iMapIndex ); @@ -648,8 +648,8 @@ void RebuildRoofUsingFloorInfo( INT32 iMapIndex, UINT16 usRoofType ) //Given a gridno, it will erase the current roof, and calculate the new roof piece based on the //wall orientions giving priority to the top and left walls before anything else. -//NOTE: passing NULL for usRoofType will force the function to calculate the nearest roof type, -// and use that for the new roof. This is needed when erasing parts of multiple buildings simultaneously. +//NOTE: passing NULL for usRoofType will force the function to calculate the nearest roof type, +// and use that for the new roof. This is needed when erasing parts of multiple buildings simultaneously. void RebuildRoof( UINT32 iMapIndex, UINT16 usRoofType ) { UINT16 usRoofIndex, usTileIndex; @@ -659,9 +659,9 @@ void RebuildRoof( UINT32 iMapIndex, UINT16 usRoofType ) usRoofType = SearchForRoofType( iMapIndex ); } if( usRoofType == 0xffff ) - return; //no roof type around, so don't draw one. + return; //no roof type around, so don't draw one. //Analyse the mapindex for walls and set the flags. - //NOTE: There is no support for more than 2 side on a roof, so if there is, draw TOPLEFT + //NOTE: There is no support for more than 2 side on a roof, so if there is, draw TOPLEFT AddToUndoList( iMapIndex ); EraseRoof( iMapIndex ); @@ -685,7 +685,7 @@ void RebuildRoof( UINT32 iMapIndex, UINT16 usRoofType ) { HideStructOfGivenType( iMapIndex, usRoofType, TRUE ); } -} +} void BulldozeNature( UINT32 iMapIndex ) { @@ -702,7 +702,7 @@ void BulldozeNature( UINT32 iMapIndex ) void EraseRoof( UINT32 iMapIndex ) { AddToUndoList( iMapIndex ); - RemoveAllRoofsOfTypeRange( iMapIndex, FIRSTTEXTURE, LASTITEM ); + RemoveAllRoofsOfTypeRange( iMapIndex, FIRSTTEXTURE, LASTITEM ); RemoveAllOnRoofsOfTypeRange( iMapIndex, FIRSTTEXTURE, LASTITEM ); RemoveAllShadowsOfTypeRange( iMapIndex, FIRSTROOF, LASTSLANTROOF ); } @@ -737,7 +737,7 @@ void EraseBuilding( UINT32 iMapIndex ) //and the TOP_LEFT oriented wall in the gridno up one as well as the other building information at this //gridno. void EraseFloorOwnedBuildingPieces( UINT32 iMapIndex ) -{ +{ LEVELNODE *pStruct = NULL; UINT32 uiTileType; UINT16 usWallOrientation; @@ -755,7 +755,7 @@ void EraseFloorOwnedBuildingPieces( UINT32 iMapIndex ) { GetTileType( pStruct->usIndex, &uiTileType ); if ( uiTileType >= FIRSTWALL && uiTileType <= LASTWALL || - uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) + uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) { GetWallOrientation( pStruct->usIndex, &usWallOrientation ); if( usWallOrientation == INSIDE_TOP_RIGHT || usWallOrientation == OUTSIDE_TOP_RIGHT ) @@ -777,7 +777,7 @@ void EraseFloorOwnedBuildingPieces( UINT32 iMapIndex ) { GetTileType( pStruct->usIndex, &uiTileType ); if ( uiTileType >= FIRSTWALL && uiTileType <= LASTWALL || - uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) + uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) { GetWallOrientation( pStruct->usIndex, &usWallOrientation ); if( usWallOrientation == INSIDE_TOP_LEFT || usWallOrientation == OUTSIDE_TOP_LEFT ) @@ -810,20 +810,20 @@ void RemoveCaveSectionFromWorld( SGPRect *pSelectRegion ) left = pSelectRegion->iLeft; right = pSelectRegion->iRight; bottom = pSelectRegion->iBottom; - //Pass 1: Remove all pieces in area + //Pass 1: Remove all pieces in area for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ ) { iMapIndex = y * WORLD_COLS + x; AddToUndoList( iMapIndex ); - RemoveAllStructsOfTypeRange( iMapIndex, FIRSTWALL, LASTWALL ); + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTWALL, LASTWALL ); } - //Past 2: Go around outside perimeter and smooth each piece + //Past 2: Go around outside perimeter and smooth each piece for( y = top - 1; y <= bottom + 1; y++ ) for( x = left - 1; x <= right + 1; x++ ) { iMapIndex = y * WORLD_COLS + x; if( CaveAtGridNo( iMapIndex ) ) { - ubPerimeterValue = CalcNewCavePerimeterValue( iMapIndex ); + ubPerimeterValue = CalcNewCavePerimeterValue( iMapIndex ); usIndex = GetCaveTileIndexFromPerimeterValue( ubPerimeterValue ); AddToUndoList( iMapIndex ); if( usIndex != 0xffff ) @@ -846,7 +846,7 @@ void AddCaveSectionToWorld( SGPRect *pSelectRegion ) left = pSelectRegion->iLeft; right = pSelectRegion->iRight; bottom = pSelectRegion->iBottom; - //Pass 1: Add bogus piece to each gridno in region + //Pass 1: Add bogus piece to each gridno in region for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ ) { uiMapIndex = y * WORLD_COLS + x; @@ -857,7 +857,7 @@ void AddCaveSectionToWorld( SGPRect *pSelectRegion ) AddCave( uiMapIndex, usIndex ); } } - //Past 2: Go around outside perimeter and smooth each piece + //Past 2: Go around outside perimeter and smooth each piece for( y = top - 1; y <= bottom + 1; y++ ) for( x = left - 1; x <= right + 1; x++ ) { uiMapIndex = y * WORLD_COLS + x; @@ -889,9 +889,9 @@ void AddCaveSectionToWorld( SGPRect *pSelectRegion ) // BEGIN PUBLIC FUNCTION IMPLEMENTATION //-------------------------------------------------------------------------------------------------- -//When the user removes a section from a building, it will not only erase the +//When the user removes a section from a building, it will not only erase the //entire highlighted area, it'll repair the building itself so there are no -//outside walls missing from the new building. +//outside walls missing from the new building. void RemoveBuildingSectionFromWorld( SGPRect *pSelectRegion ) { UINT32 top, left, right, bottom, x, y; @@ -905,17 +905,17 @@ void RemoveBuildingSectionFromWorld( SGPRect *pSelectRegion ) right = pSelectRegion->iRight; bottom = pSelectRegion->iBottom; - //1ST PASS: Erase all building owned by the floor tile if there is one. + //1ST PASS: Erase all building owned by the floor tile if there is one. for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ ) { iMapIndex = y * WORLD_COLS + x; EraseFloorOwnedBuildingPieces( iMapIndex ); //Erase possible top and left walls in bordering tiles. } - //2ND PASS: Build new walls whereever there are neighboring floor tiles. + //2ND PASS: Build new walls whereever there are neighboring floor tiles. for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ ) { iMapIndex = y * WORLD_COLS + x; - //NOTE: Top and bottom walls MUST be placed first -- it minimizes the number of special cases. + //NOTE: Top and bottom walls MUST be placed first -- it minimizes the number of special cases. if( y == top ) { fFloor = FloorAtGridNo( iMapIndex - WORLD_COLS ); @@ -937,15 +937,15 @@ void RemoveBuildingSectionFromWorld( SGPRect *pSelectRegion ) if( x == right ) { fFloor = FloorAtGridNo( iMapIndex + 1); - if( gfBasement && !fFloor || !gfBasement && fFloor && !GetVerticalWall( iMapIndex ) ) + if( gfBasement && !fFloor || !gfBasement && fFloor && !GetVerticalWall( iMapIndex ) ) BuildWallPiece( iMapIndex, EXTERIOR_RIGHT, 0 ); } } - //3RD PASS: Go around the outside of the region, and rebuild the roof. + //3RD PASS: Go around the outside of the region, and rebuild the roof. if( gfBasement ) { usFloorType = GetRandomIndexByRange( FIRSTFLOOR, LASTFLOOR ); - if( usFloorType == 0xffff ) + if( usFloorType == 0xffff ) usFloorType = FIRSTFLOOR; for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ ) { @@ -983,7 +983,7 @@ void AddBuildingSectionToWorld( SGPRect *pSelectRegion ) bottom = pSelectRegion->iBottom; //Special case scenario: - //If the user selects a floor without walls, then it is implied that the user wishes to + //If the user selects a floor without walls, then it is implied that the user wishes to //change the floor for say a kitchen which might have a different floor type. usWallType = GetRandomIndexByRange( FIRSTWALL, LASTWALL ); usFloorType = GetRandomIndexByRange( FIRSTFLOOR, LASTFLOOR ); @@ -1002,10 +1002,10 @@ void AddBuildingSectionToWorld( SGPRect *pSelectRegion ) return; } - //1ST PASS: Determine if there are any floor tiles in this region. If there are, then - // that signifies that we are concantenating this building to an existing one. Otherwise, - // we are just drawing an individual building. If we find a floor, extract the type so - // we know how to draw it later. + //1ST PASS: Determine if there are any floor tiles in this region. If there are, then + // that signifies that we are concantenating this building to an existing one. Otherwise, + // we are just drawing an individual building. If we find a floor, extract the type so + // we know how to draw it later. fNewBuilding = TRUE; for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ ) { @@ -1016,13 +1016,13 @@ void AddBuildingSectionToWorld( SGPRect *pSelectRegion ) UINT32 uiTileType; //If a floor is found, then we are adding to an existing structure. fNewBuilding = FALSE; - //Extract the floor type. We already checked if there was a floor here, so it is assumed. + //Extract the floor type. We already checked if there was a floor here, so it is assumed. pFloor = gpWorldLevelData[ iMapIndex ].pLandHead; while( pFloor ) { GetTileType( pFloor->usIndex, &uiTileType ); if( uiTileType >= FIRSTFLOOR && uiTileType <= LASTFLOOR ) - { + { usFloorType = (UINT16)uiTileType; break; } @@ -1036,7 +1036,7 @@ void AddBuildingSectionToWorld( SGPRect *pSelectRegion ) } } } - + if( fNewBuilding ) { //if( gfBasement ) @@ -1060,19 +1060,19 @@ void AddBuildingSectionToWorld( SGPRect *pSelectRegion ) return; } - //2ND PASS: Remove all walls in the region that border no floor tile, or simply walls - // that are considered exterior walls. That way, it won't wreck the inside of a building - // if you select too much interior. Also, gridnos that delete walls will also delete the - // floor and roof tiles there. That signifies that the floorless parts will be resmoothed, - // and rebuilt in the third pass. + //2ND PASS: Remove all walls in the region that border no floor tile, or simply walls + // that are considered exterior walls. That way, it won't wreck the inside of a building + // if you select too much interior. Also, gridnos that delete walls will also delete the + // floor and roof tiles there. That signifies that the floorless parts will be resmoothed, + // and rebuilt in the third pass. for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ ) { iMapIndex = y * WORLD_COLS + x; if( gfBasement ) { - EraseBuilding( iMapIndex ); + EraseBuilding( iMapIndex ); } - else if( FloorAtGridNo( iMapIndex ) && !fNewBuilding) + else if( FloorAtGridNo( iMapIndex ) && !fNewBuilding) { if( y >= top && !FloorAtGridNo( iMapIndex - WORLD_COLS ) ) { @@ -1104,11 +1104,11 @@ void AddBuildingSectionToWorld( SGPRect *pSelectRegion ) BulldozeNature( iMapIndex ); } } - //3RD PASS: Process the region, and all walls of floorless tiles are rebuilt from interior perspective. + //3RD PASS: Process the region, and all walls of floorless tiles are rebuilt from interior perspective. for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ ) { iMapIndex = y * WORLD_COLS + x; - if( !FloorAtGridNo( iMapIndex ) ) + if( !FloorAtGridNo( iMapIndex ) ) { if( y == top && !GetHorizontalWall( iMapIndex - WORLD_COLS ) ) { @@ -1142,14 +1142,14 @@ void AddBuildingSectionToWorld( SGPRect *pSelectRegion ) if( fSlantRoof ) { fVertical = (bottom - top == 7) ? FALSE : TRUE; - BuildSlantRoof( left, top, right, bottom, usWallType, usRoofType, fVertical ); + BuildSlantRoof( left, top, right, bottom, usWallType, usRoofType, fVertical ); } - //4TH PASS: Process the region, and all floorless tiles get new roofs and floors. + //4TH PASS: Process the region, and all floorless tiles get new roofs and floors. for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ ) { iMapIndex = y * WORLD_COLS + x; - if( !FloorAtGridNo( iMapIndex ) ) + if( !FloorAtGridNo( iMapIndex ) ) { if( !fSlantRoof ) RebuildRoof( iMapIndex, usRoofType ); @@ -1194,6 +1194,7 @@ void AnalyseCaveMapForStructureInfo() - + + diff --git a/Editor/popupmenu.cpp b/Editor/popupmenu.cpp index daa13718..50b39173 100644 --- a/Editor/popupmenu.cpp +++ b/Editor/popupmenu.cpp @@ -1,7 +1,7 @@ // WANNE: EDITOR: todo //FUNCTIONALITY: -//This popup menu functions IDENTICALLY to Windows95's methodology. You can use the arrow keys, or the +//This popup menu functions IDENTICALLY to Windows95's methodology. You can use the arrow keys, or the //mouse in two methods. The first method is where you release the mouse button before //moving the cursor inside the popup menu, which makes it persistant (it won't go away until you click again), //or non-persistant, where you release the button inside the menu after your initial click (non-persistant). @@ -76,14 +76,14 @@ user to make a selection or cancel before doing anything else. There are two modes of operation as soon as the user presses the mouse on a popup menu activation button. 1) The user releases the mouse before moving the cursor onto - the popup region. The popup menu will end as soon as the + the popup region. The popup menu will end as soon as the user presses the mouse button. If the cursor is out of the popup region, then it returns 0. 2) The user holds the mouse while moving the cursor onto the popup region. The popup menu will end as soon as the user releases the mouse button. If the cursor is out of the popup region, then it returns 0. - + Returns 0 if nothing in menu was selected, else returns the menu entry number starting from 1. @@ -182,7 +182,7 @@ void InitPopupMenu( INT32 iButtonID, UINT8 ubPopupMenuID, UINT8 ubDirection ) gPopup.ubColumns++; } //now we have the number of columns as well as the max number of entries per column, and - //the total menu height. + //the total menu height. //We now calculate the total width of the menu as well as the max width of each column. ubCounter = 0; @@ -202,7 +202,7 @@ void InitPopupMenu( INT32 iButtonID, UINT8 ubPopupMenuID, UINT8 ubDirection ) } usMenuWidth += gPopup.ubColumnWidth[ ubColumn ]; } - + //Calculate popup menu boundaries based on direction from argument point. switch( ubDirection ) { @@ -214,8 +214,8 @@ void InitPopupMenu( INT32 iButtonID, UINT8 ubPopupMenuID, UINT8 ubDirection ) break; case DIR_UPLEFT: gPopup.usLeft = usX - usMenuWidth; - gPopup.usTop = usY - usMenuHeight - 1; - gPopup.usRight = usX; + gPopup.usTop = usY - usMenuHeight - 1; + gPopup.usRight = usX; gPopup.usBottom = usY - 1; break; case DIR_DOWNRIGHT: @@ -226,13 +226,13 @@ void InitPopupMenu( INT32 iButtonID, UINT8 ubPopupMenuID, UINT8 ubDirection ) break; case DIR_DOWNLEFT: gPopup.usLeft = usX - usMenuWidth; - gPopup.usTop = usY + 1; - gPopup.usRight = usX; + gPopup.usTop = usY + 1; + gPopup.usRight = usX; gPopup.usBottom = usY + usMenuHeight + 1; break; } MSYS_DefineRegion( &popupRegion, 0, 0, 640, 480, MSYS_PRIORITY_HIGHEST, - CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); RenderPopupMenu(); } @@ -248,13 +248,13 @@ void RenderPopupMenu() UINT16 usStart; //Draw the menu - ColorFillVideoSurfaceArea(FRAME_BUFFER, - gPopup.usLeft, gPopup.usTop, gPopup.usRight, gPopup.usBottom, + ColorFillVideoSurfaceArea(FRAME_BUFFER, + gPopup.usLeft, gPopup.usTop, gPopup.usRight, gPopup.usBottom, Get16BPPColor(FROMRGB(128, 128, 128) ) ); - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, 640, 480 ); usLineColor = Get16BPPColor( FROMRGB( 64, 64, 64 ) ); - RectangleDraw( TRUE, gPopup.usLeft, gPopup.usTop, gPopup.usRight, gPopup.usBottom, + RectangleDraw( TRUE, gPopup.usLeft, gPopup.usTop, gPopup.usRight, gPopup.usBottom, usLineColor, pDestBuf ); if( gPopup.ubColumns > 1 ) { //draw a vertical line between each column @@ -271,7 +271,7 @@ void RenderPopupMenu() SetFont( gPopup.usFont); SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( FONT_MCOLOR_WHITE ); - + usX = gPopup.usLeft + 1; ubCounter = 0; usStart = gPopup.usLeft; @@ -312,7 +312,7 @@ UINT8 GetPopupIndexFromMousePosition() UINT8 ubNumEntriesDown; UINT16 usRelX; UINT8 ubCount; - if( gusMouseXPos >= gPopup.usLeft + if( gusMouseXPos >= gPopup.usLeft && gusMouseXPos <= gPopup.usRight && gusMouseYPos > gPopup.usTop //one pixel gap on top ignored && gusMouseYPos < gPopup.usBottom - 2 ) //two pixel gap on bottom ignored @@ -346,7 +346,7 @@ void PopupMenuHandle() //Attempt to determine if the menu will be persistant or not. //Determination is made when the mouse's left button is released or if //the mouse cursor enters the menu region. - if( gusMouseXPos >= gPopup.usLeft + if( gusMouseXPos >= gPopup.usLeft && gusMouseXPos <= gPopup.usRight && gusMouseYPos > gPopup.usTop //one pixel gap on top ignored && gusMouseYPos < gPopup.usBottom - 1 ) //two pixel gap on bottom ignored @@ -382,15 +382,15 @@ void PopupMenuHandle() //Check terminating conditions for persistant states. if( gfLeftButtonState && gPopup.ubActiveType == POPUP_ACTIVETYPE_PERSISTANT ) fWaitingForLButtonRelease = TRUE; - if( gfLeftButtonState && gPopup.ubActiveType == POPUP_ACTIVETYPE_PERSISTANT + if( gfLeftButtonState && gPopup.ubActiveType == POPUP_ACTIVETYPE_PERSISTANT || !gfLeftButtonState && gPopup.ubActiveType == POPUP_ACTIVETYPE_NONPERSISTANT ) { - //Selection conditions via mouse have been met whether the mouse is in the + //Selection conditions via mouse have been met whether the mouse is in the //menu region or not. gPopup.ubSelectedIndex = GetPopupIndexFromMousePosition(); if( gPopup.ubSelectedIndex ) { - ProcessPopupMenuSelection(); + ProcessPopupMenuSelection(); } gPopup.fActive = FALSE; MSYS_RemoveRegion( &popupRegion ); @@ -497,6 +497,7 @@ BOOLEAN ProcessPopupMenuIfActive( ) - + + diff --git a/Editor/popupmenu.h b/Editor/popupmenu.h index 57baca0d..516b715b 100644 --- a/Editor/popupmenu.h +++ b/Editor/popupmenu.h @@ -2,8 +2,8 @@ #ifdef JA2EDITOR //popupmenu.h -//Author: Kris Morness -//Created: Sept 4, 1997 +//Author: Kris Morness +//Created: Sept 4, 1997 #ifndef __POPUPMENU_H #define __POPUPMENU_H @@ -12,30 +12,30 @@ POPUP MENU DESIGN CONSIDERATIONS -There is currently no support for nested popup menus. Let Kris know if +There is currently no support for nested popup menus. Let Kris know if you need this. USER INSTRUCTIONS The goal of this popup menu system is to create a quick and intuitive -interface system which is functionally similar to Win95 and MacOS. +interface system which is functionally similar to Win95 and MacOS. As soon as you click on a button which activates the popup menu, the user will choose a selection in one of three ways: 1) KEYBOARD - at anytime, the user can use the keyboard regardless of mouse - mode. The up/down arrow keys will cycle through the choices and enter will - accept the choice. ESC will cancel the menu without making a choice. + mode. The up/down arrow keys will cycle through the choices and enter will + accept the choice. ESC will cancel the menu without making a choice. 2) When the mousedown event activates the menu, the user releases the mouse before - entering the popup menu region. The menu mode will change and become persistant. - Clicking on the hilighted item will close the popup and activate the choice. - Clicking elsewhere, the popup will be closed without making a selection. This - is functionally equivalent to Win95. + entering the popup menu region. The menu mode will change and become persistant. + Clicking on the hilighted item will close the popup and activate the choice. + Clicking elsewhere, the popup will be closed without making a selection. This + is functionally equivalent to Win95. 3) When the mousedown event activates the menu, the user holds the mouse down and - moves the cursor over the popup region. At this moment the menu becomes - non-persistant and a choice is made by releasing the mouse. If the mouse is - released on a highlighted choice, that choice is selected, otherwise the popup - is cancelled. This is functionally equivalent to MacOS. The small diffence is - that under Win95's standard convention, the release of the mouse outside of the - region doesn't kill the menu, but in MacOS, it does. + moves the cursor over the popup region. At this moment the menu becomes + non-persistant and a choice is made by releasing the mouse. If the mouse is + released on a highlighted choice, that choice is selected, otherwise the popup + is cancelled. This is functionally equivalent to MacOS. The small diffence is + that under Win95's standard convention, the release of the mouse outside of the + region doesn't kill the menu, but in MacOS, it does. */ @@ -49,7 +49,7 @@ enum popupMenuIDs }; //The direction of the popup menu relative to the button -//pressed to activate it or mouse position. In editor mode, +//pressed to activate it or mouse position. In editor mode, //this will attempt to go up and to the right of the button. #define UPMASK 0x00 #define DNMASK 0x10 @@ -79,11 +79,11 @@ typedef struct currentPopupMenuInformation{ UINT16 usFont; BOOLEAN fActive; BOOLEAN fUseKeyboardInfoUntilMouseMoves; - UINT16 usLeft, usTop, usRight, usBottom; //popup region coords. + UINT16 usLeft, usTop, usRight, usBottom; //popup region coords. UINT16 usLastMouseX, usLastMouseY; }CurrentPopupMenuInformation; -//A global var that keeps the popup menu information. +//A global var that keeps the popup menu information. extern CurrentPopupMenuInformation gPopup; extern STR16 popupMenuStrings[5]; diff --git a/Editor/selectwin.cpp b/Editor/selectwin.cpp index 2e86598b..56b4d836 100644 --- a/Editor/selectwin.cpp +++ b/Editor/selectwin.cpp @@ -49,33 +49,33 @@ SGPPoint SelWinSpacing, SelWinStartPoint, SelWinEndPoint; //These definitions help define the start and end of the various wall indices. //This needs to be maintained if the walls change. -#define WALL_LAST_WALL_OFFSET 30 -#define WALL_FIRST_AFRAME_OFFSET 31 -#define WALL_LAST_AFRAME_OFFSET 34 -#define WALL_FIRST_WINDOW_OFFSET 35 -#define WALL_LAST_WINDOW_OFFSET 46 -#define WALL_FIRST_BROKEN_WALL_OFFSET 47 -#define WALL_LAST_BROKEN_WALL_OFFSET 54 -#define WALL_FIRST_APPENDED_WALL_OFFSET 55 -#define WALL_LAST_APPENDED_WALL_OFFSET 56 +#define WALL_LAST_WALL_OFFSET 30 +#define WALL_FIRST_AFRAME_OFFSET 31 +#define WALL_LAST_AFRAME_OFFSET 34 +#define WALL_FIRST_WINDOW_OFFSET 35 +#define WALL_LAST_WINDOW_OFFSET 46 +#define WALL_FIRST_BROKEN_WALL_OFFSET 47 +#define WALL_LAST_BROKEN_WALL_OFFSET 54 +#define WALL_FIRST_APPENDED_WALL_OFFSET 55 +#define WALL_LAST_APPENDED_WALL_OFFSET 56 #define WALL_FIRST_WEATHERED_WALL_OFFSET 57 -#define WALL_LAST_WEATHERED_WALL_OFFSET 64 +#define WALL_LAST_WEATHERED_WALL_OFFSET 64 //I've added these definitions to add readability, and minimize conversion time for changes -//incase there are new values, etc. +//incase there are new values, etc. #define OSTRUCTS_NUMELEMENTS ( LASTOSTRUCT - FIRSTFULLSTRUCT + 22 ) #define OSTRUCTS1_NUMELEMENTS 5 #define OSTRUCTS2_NUMELEMENTS 12 #define BANKSLIST_NUMELEMENTS 5 #define ROADSLIST_NUMELEMENTS 1 -#define DEBRISLIST_NUMELEMENTS ( LASTDEBRIS - DEBRISROCKS + 2 + 1 ) //+1 for ANOTHERDEBRIS +#define DEBRISLIST_NUMELEMENTS ( LASTDEBRIS - DEBRISROCKS + 2 + 1 ) //+1 for ANOTHERDEBRIS #define SINGLEWALL_NUMELEMENTS ( (LASTWALL-FIRSTWALL+1) * 2 ) #define SINGLEDOOR_NUMELEMENTS (( LASTDOOR - FIRSTDOOR + 1 ) * 5) #define SINGLEWINDOW_NUMELEMENTS ( LASTWALL - FIRSTWALL + 1 ) #define SINGLEROOF_NUMELEMENTS ( (LASTROOF-FIRSTROOF+1) + (LASTSLANTROOF-FIRSTSLANTROOF+1) + \ (LASTWALL-FIRSTWALL+1) + (SECONDONROOF-FIRSTONROOF+1) ) -#define SINGLENEWROOF_NUMELEMENTS (LASTROOF-FIRSTROOF+1) +#define SINGLENEWROOF_NUMELEMENTS (LASTROOF-FIRSTROOF+1) #define SINGLEBROKENWALL_NUMELEMENTS ( (LASTDECORATIONS-FIRSTDECORATIONS+1) + (LASTWALL-FIRSTWALL+1)*2 ) #define SINGLEDECOR_NUMELEMENTS ( LASTISTRUCT - FIRSTISTRUCT + 1 ) #define SINGLEDECAL_NUMELEMENTS ( LASTWALLDECAL - FIRSTWALLDECAL + EIGTHWALLDECAL - FIFTHWALLDECAL + 3 ) @@ -87,8 +87,8 @@ SGPPoint SelWinSpacing, SelWinStartPoint, SelWinEndPoint; (LASTROOF-FIRSTROOF+1) + (2 )) -//This is a special case for trees which may have varying numbers. There was a problem -//in which we loaded a new tileset which had one less tree in it. When we called BuildSelectionWindow(), +//This is a special case for trees which may have varying numbers. There was a problem +//in which we loaded a new tileset which had one less tree in it. When we called BuildSelectionWindow(), //it would crash because it thought there was an extra tree which was now invalid. UINT16 gusNumOStructs = 0; @@ -104,15 +104,15 @@ DisplaySpec SingleDoor[ SINGLEDOOR_NUMELEMENTS ]; DisplaySpec SingleWindow[ SINGLEWINDOW_NUMELEMENTS ]; DisplaySpec SingleRoof[ SINGLEROOF_NUMELEMENTS ]; DisplaySpec SingleNewRoof[ SINGLENEWROOF_NUMELEMENTS ]; -DisplaySpec SingleBrokenWall[ SINGLEBROKENWALL_NUMELEMENTS ]; +DisplaySpec SingleBrokenWall[ SINGLEBROKENWALL_NUMELEMENTS ]; DisplaySpec SingleDecor[ SINGLEDECOR_NUMELEMENTS ]; DisplaySpec SingleDecal[ SINGLEDECAL_NUMELEMENTS ]; DisplaySpec SingleFloor[ SINGLEFLOOR_NUMELEMENTS ]; DisplaySpec SingleToilet[ SINGLETOILET_NUMELEMENTS ]; DisplaySpec Room[ ROOM_NUMELEMENTS ]; -//These are all of the different selection lists. Changing the max_selections will -//change the number of selections values you can have at a time. This is Bret's gay code, +//These are all of the different selection lists. Changing the max_selections will +//change the number of selections values you can have at a time. This is Bret's gay code, //though I've cleaned it up a lot. Selections SelOStructs[MAX_SELECTIONS] = { {FIRSTFULLSTRUCT, 0, 1} }; // Default selections Selections SelOStructs1[MAX_SELECTIONS] = { {FOURTHOSTRUCT, 0, 1} }; // Default selections @@ -123,13 +123,13 @@ Selections SelDebris[MAX_SELECTIONS] = { {DEBRISROCKS, 0, 1} }; Selections SelSingleWall[MAX_SELECTIONS] = { {FIRSTWALL, 0, 1} }; Selections SelSingleDoor[MAX_SELECTIONS] = { {FIRSTDOOR, 0, 1} }; Selections SelSingleWindow[MAX_SELECTIONS] = { {FIRSTWALL, 44, 1} }; -Selections SelSingleRoof[MAX_SELECTIONS] = { {FIRSTROOF, 0, 1} }; -Selections SelSingleNewRoof[MAX_SELECTIONS] = { {FIRSTROOF, 0, 1} }; -Selections SelSingleBrokenWall[MAX_SELECTIONS] = { {FIRSTDECORATIONS, 0, 1} }; +Selections SelSingleRoof[MAX_SELECTIONS] = { {FIRSTROOF, 0, 1} }; +Selections SelSingleNewRoof[MAX_SELECTIONS] = { {FIRSTROOF, 0, 1} }; +Selections SelSingleBrokenWall[MAX_SELECTIONS] = { {FIRSTDECORATIONS, 0, 1} }; Selections SelSingleDecor[MAX_SELECTIONS]= { {FIRSTISTRUCT, 0, 1} }; Selections SelSingleDecal[MAX_SELECTIONS] = { {FIRSTWALLDECAL, 0, 1} }; -Selections SelSingleFloor[MAX_SELECTIONS] = { {FIRSTFLOOR, 0, 1} }; -Selections SelSingleToilet[MAX_SELECTIONS] = { {FIFTHISTRUCT, 0, 1} }; +Selections SelSingleFloor[MAX_SELECTIONS] = { {FIRSTFLOOR, 0, 1} }; +Selections SelSingleToilet[MAX_SELECTIONS] = { {FIFTHISTRUCT, 0, 1} }; Selections SelRoom[MAX_SELECTIONS] = { {FIRSTWALL, 0, 1} }; // Number of objects currently in the selection list @@ -147,7 +147,7 @@ INT32 iNumDecorSelected = 1; INT32 iNumDecalsSelected = 1; INT32 iNumBrokenWallsSelected = 1; INT32 iNumFloorsSelected = 1; -INT32 iNumToiletsSelected = 1; +INT32 iNumToiletsSelected = 1; INT32 iNumRoofsSelected = 1; INT32 iNumNewRoofsSelected = 1; INT32 iNumRoomsSelected = 1; @@ -157,7 +157,7 @@ Selections OldSelList[MAX_SELECTIONS]; INT32 iOldNumSelList; // Global pointers for selection list -Selections *pSelList; +Selections *pSelList; INT32 *pNumSelList; // Global used to indicate which selection to use (changes with the PGUP/PGDWN keys in editor) @@ -183,15 +183,15 @@ void CreateJA2SelectionWindow( INT16 sWhat ) fAllDone = FALSE; DisableEditorTaskbar( ); - + // Load up the button images iButtonIcons[ CANCEL_ICON ] = LoadGenericButtonIcon( "EDITOR//bigX.sti" ); iButtonIcons[ UP_ICON ] = LoadGenericButtonIcon( "EDITOR//lgUpArrow.sti" ); iButtonIcons[ DOWN_ICON ] = LoadGenericButtonIcon( "EDITOR//lgDownArrow.sti" ); iButtonIcons[ OK_ICON ] = LoadGenericButtonIcon( "EDITOR//checkmark.sti" ); - + iSelectWin = CreateHotSpot(0, 0, 600, 360, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, SelWinClkCallback); + DEFAULT_MOVE_CALLBACK, SelWinClkCallback); iCancelWin = CreateIconButton((INT16)iButtonIcons[CANCEL_ICON], 0, BUTTON_USE_DEFAULT, 600, 40, @@ -221,7 +221,7 @@ void CreateJA2SelectionWindow( INT16 sWhat ) DEFAULT_MOVE_CALLBACK, DwnClkCallback); SetButtonFastHelpText(iScrollDown,L"Scroll window down"); - fButtonsPresent = TRUE; + fButtonsPresent = TRUE; SelWinSpacing.iX = 2; SelWinSpacing.iY = 2; @@ -230,12 +230,12 @@ void CreateJA2SelectionWindow( INT16 sWhat ) SelWinStartPoint.iY = 15; iTopWinCutOff = 15; - + SelWinEndPoint.iX = 599; SelWinEndPoint.iY = 359; iBotWinCutOff = 359; - + switch( sWhat ) { case SELWIN_OSTRUCTS: @@ -352,14 +352,14 @@ void CreateJA2SelectionWindow( INT16 sWhat ) return; } - BuildDisplayWindow( pDSpec, usNSpecs, &pDispList, &SelWinStartPoint, &SelWinEndPoint, + BuildDisplayWindow( pDSpec, usNSpecs, &pDispList, &SelWinStartPoint, &SelWinEndPoint, &SelWinSpacing, CLEAR_BACKGROUND); } -//The selection window method is initialized here. This is where all the graphics for all -//the categories are organized and loaded. If you wish to move things around, then this is -//where the initialization part is done. I have also changed this from previously being loaded +//The selection window method is initialized here. This is where all the graphics for all +//the categories are organized and loaded. If you wish to move things around, then this is +//where the initialization part is done. I have also changed this from previously being loaded //every single time you go into a selection window which was redundant and CPU consuming. void InitJA2SelectionWindow( void ) { @@ -416,7 +416,7 @@ void InitJA2SelectionWindow( void ) OStructs1[ iCount + 1 ].uiObjIndx = FIRSTOSTRUCT + iCount; } - + // Other junk! (the "2" button in the "terrain" toolbar) OStructs2[ 0 ].ubType = DISPLAY_GRAPHIC; OStructs2[ 0 ].hVObject = gTileDatabase[gTileTypeStartIndex[THIRDOSTRUCT]].hTileSurface; @@ -536,13 +536,13 @@ void InitJA2SelectionWindow( void ) DebrisList[ iCount ].usEnd = 0; DebrisList[ iCount ].uiObjIndx = DEBRISROCKS + iCount; } - // Add one more for new misc debris + // Add one more for new misc debris DebrisList[ iCount ].ubType = DISPLAY_GRAPHIC; DebrisList[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[DEBRIS2MISC ] ].hTileSurface; DebrisList[ iCount ].usStart = DISPLAY_ALL_OBJECTS; DebrisList[ iCount ].usEnd = 0; DebrisList[ iCount ].uiObjIndx = DEBRIS2MISC; - //Add yet another one... + //Add yet another one... iCount++; DebrisList[ iCount ].ubType = DISPLAY_GRAPHIC; DebrisList[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[ANOTHERDEBRIS ] ].hTileSurface; @@ -584,7 +584,7 @@ void InitJA2SelectionWindow( void ) Room[ iCount ].uiObjIndx = FIRSTSLANTROOF + iCount2; } - //Walls + //Walls for ( iCount = 0, iCount2 = 0; iCount < (LASTWALL - FIRSTWALL + 1); iCount++, iCount2+=2 ) { SingleWall[ iCount2 ].ubType = DISPLAY_GRAPHIC; @@ -634,13 +634,13 @@ void InitJA2SelectionWindow( void ) SingleDoor[ iCount2+4 ].usEnd = 19; SingleDoor[ iCount2+4 ].uiObjIndx = FIRSTDOOR + iCount; } - //Windows + //Windows for ( iCount = 0; iCount < (LASTWALL - FIRSTWALL + 1); iCount++ ) - { + { SingleWindow[ iCount ].ubType = DISPLAY_GRAPHIC; SingleWindow[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTWALL + iCount]].hTileSurface; - SingleWindow[ iCount ].usStart = WALL_FIRST_WINDOW_OFFSET; - SingleWindow[ iCount ].usEnd = WALL_LAST_WINDOW_OFFSET; + SingleWindow[ iCount ].usStart = WALL_FIRST_WINDOW_OFFSET; + SingleWindow[ iCount ].usEnd = WALL_LAST_WINDOW_OFFSET; SingleWindow[ iCount ].uiObjIndx = FIRSTWALL + iCount; } //Roofs and slant roofs @@ -810,11 +810,11 @@ void RemoveJA2SelectionWindow( void ) pDispList = TrashList(pDispList); } gfRenderTaskbar = TRUE; - + gfOverheadMapDirty = TRUE; EnableEditorTaskbar( ); } - + //---------------------------------------------------------------------------------------------- // TrashList @@ -828,10 +828,10 @@ DisplayList *TrashList( DisplayList *pNode ) if (pNode->pNext != NULL) pNode->pNext = TrashList(pNode->pNext); - + if (pNode->pNext == NULL) MemFree(pNode); - + return(NULL); } @@ -865,9 +865,9 @@ void RenderSelectionWindow( void ) button = ButtonList[iSelectWin]; if ( button == NULL ) return; - - if ( (abs( iStartClickX - button->Area.MouseXPos ) > 9) || - (abs( iStartClickY - (button->Area.MouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY)) > 9) ) + + if ( (abs( iStartClickX - button->Area.MouseXPos ) > 9) || + (abs( iStartClickY - (button->Area.MouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY)) > 9) ) { // iSX = (INT32)iStartClickX; // iEX = (INT32)button->Area.MouseXPos; @@ -931,7 +931,7 @@ void SelWinClkCallback( GUI_BUTTON *button, INT32 reason ) if (!(button->uiFlags & BUTTON_ENABLED)) return; - + iClickX = button->Area.MouseXPos; iClickY = button->Area.MouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY; @@ -976,7 +976,7 @@ void SelWinClkCallback( GUI_BUTTON *button, INT32 reason ) else if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { button->uiFlags &= (~BUTTON_CLICKED_ON); - + if( !gfRenderSquareArea ) return; @@ -1061,7 +1061,7 @@ void DisplaySelectionWindowGraphicalInformation() } SetFont( FONT12POINT1 ); SetFontForeground( FONT_WHITE ); - if( pNode ) + if( pNode ) { //usObjIndex = (UINT16)pNode->uiObjIndx; //usIndex = pNode->uiIndex; @@ -1074,13 +1074,13 @@ void DisplaySelectionWindowGraphicalInformation() } else { - mprintf( 2, 2, L"File: %S, subindex: %d (%S)", + mprintf( 2, 2, L"File: %S, subindex: %d (%S)", gTilesets[ giCurrentTilesetID ].TileSurfaceFilenames[ pNode->uiObjIndx ], pNode->uiIndex, gTileSurfaceName[ pNode->uiObjIndx ] ); } } - mprintf( 350, 2, L"Current Tileset: %s", gTilesets[ giCurrentTilesetID ].zName ); -} + mprintf( 350, 2, L"Current Tileset: %s", gTilesets[ giCurrentTilesetID ].zName ); +} //---------------------------------------------------------------------------------------------- // AddToSelectionList @@ -1095,12 +1095,12 @@ void AddToSelectionList( DisplayList *pNode ) for (iIndex = 0; iIndex < (*pNumSelList); iIndex++ ) { if ( pNode->uiObjIndx == pSelList[ iIndex ].uiObject && - pNode->uiIndex == pSelList[ iIndex ].usIndex ) + pNode->uiIndex == pSelList[ iIndex ].usIndex ) { iUseIndex = iIndex; break; } - } + } if ( iUseIndex >= 0 ) { @@ -1171,13 +1171,13 @@ BOOLEAN RemoveFromSelectionList( DisplayList *pNode ) for (iIndex = 0; iIndex < (*pNumSelList); iIndex++ ) { if ( pNode->uiObjIndx == pSelList[ iIndex ].uiObject && - pNode->uiIndex == pSelList[ iIndex ].usIndex ) + pNode->uiIndex == pSelList[ iIndex ].usIndex ) { iUseIndex = iIndex; break; } - } - + } + if ( iUseIndex >= 0 ) { // Was already in the list, so bump up the count @@ -1188,7 +1188,7 @@ BOOLEAN RemoveFromSelectionList( DisplayList *pNode ) // Squash the list to remove old entry for ( iIndex = iUseIndex; iIndex < ((*pNumSelList) - 1); iIndex++ ) pSelList[ iIndex ] = pSelList[ iIndex + 1 ]; - + (*pNumSelList)--; fRemoved = TRUE; } @@ -1214,7 +1214,7 @@ INT32 GetRandomSelection( void ) fDontUseRandom = FALSE; return( iCurBank ); } - + iTotalCounts = 0; for (iIndex = 0; iIndex < (*pNumSelList); iIndex++ ) iTotalCounts += (INT32)pSelList[ iIndex ].sCount; @@ -1248,12 +1248,12 @@ BOOLEAN IsInSelectionList( DisplayList *pNode ) for (iIndex = 0; iIndex < (*pNumSelList) && !fFound; iIndex++ ) { if ( pNode->uiObjIndx == pSelList[ iIndex ].uiObject && - pNode->uiIndex == pSelList[ iIndex ].usIndex ) + pNode->uiIndex == pSelList[ iIndex ].usIndex ) { fFound = TRUE; } - } - + } + return ( fFound ); } @@ -1275,13 +1275,13 @@ INT32 FindInSelectionList( DisplayList *pNode ) for (iIndex = 0; iIndex < (*pNumSelList) && !fFound; iIndex++ ) { if ( pNode->uiObjIndx == pSelList[ iIndex ].uiObject && - pNode->uiIndex == pSelList[ iIndex ].usIndex ) + pNode->uiIndex == pSelList[ iIndex ].usIndex ) { fFound = TRUE; iUseIndex = iIndex; } - } - + } + return ( iUseIndex ); } @@ -1289,7 +1289,7 @@ INT32 FindInSelectionList( DisplayList *pNode ) //---------------------------------------------------------------------------------------------- // SaveSelectionList // -// Copies the current selection list to a save buffer. Used in case we want to cancel a +// Copies the current selection list to a save buffer. Used in case we want to cancel a // selection window. // void SaveSelectionList( void ) @@ -1326,7 +1326,7 @@ void RestoreSelectionList( void ) void OkClkCallback( GUI_BUTTON *button, INT32 reason ) { - + if (reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { button->uiFlags |= BUTTON_CLICKED_ON; @@ -1345,7 +1345,7 @@ void OkClkCallback( GUI_BUTTON *button, INT32 reason ) // Button callback function for the selection window's CANCEL button // void CnclClkCallback( GUI_BUTTON *button, INT32 reason ) -{ +{ if (reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { button->uiFlags |= BUTTON_CLICKED_ON; @@ -1480,14 +1480,14 @@ void DrawSelections( void ) GetClippingRect(&ClipRect); SetClippingRect(&NewRect); - + // SetFont( gpSmallFont ); SetFont( gpLargeFontType1 ); SetObjectShade( gvoLargeFontType1, 0 ); // SetObjectShade( gvoLargeFont, 0 ); DisplayWindowFunc( pDispList, iTopWinCutOff, iBotWinCutOff, &SelWinStartPoint, CLEAR_BACKGROUND ); - + SetObjectShade( gvoLargeFontType1, 4 ); SetClippingRect(&ClipRect); @@ -1501,7 +1501,7 @@ void DrawSelections( void ) // properly scrolling the window etc. // BOOLEAN BuildDisplayWindow( DisplaySpec *pDisplaySpecs, UINT16 usNumSpecs, DisplayList **pDisplayList, - SGPPoint * pUpperLeft, SGPPoint * pBottomRight, + SGPPoint * pUpperLeft, SGPPoint * pBottomRight, SGPPoint * pSpacing, UINT16 fFlags ) { INT32 iCurrX = pUpperLeft->iX; @@ -1552,7 +1552,7 @@ BOOLEAN BuildDisplayWindow( DisplaySpec *pDisplaySpecs, UINT16 usNumSpecs, Displ iCurrY += usGreatestHeightInRow + pSpacing->iY; usGreatestHeightInRow = 0; } - + if ((pCurNode = (DisplayList *)MemAlloc(sizeof(DisplayList))) != FALSE) { pCurNode->hObj = pDisplaySpec->hVObject; @@ -1580,7 +1580,7 @@ BOOLEAN BuildDisplayWindow( DisplaySpec *pDisplaySpecs, UINT16 usNumSpecs, Displ } iCurrX += pETRLEObject->usWidth + pSpacing->iX; - } + } } } @@ -1604,7 +1604,7 @@ BOOLEAN DisplayWindowFunc( DisplayList *pNode, INT16 iTopCutOff, INT16 iBottomCu ETRLEObject * pETRLEObject; UINT16 usFillColor; INT16 sCount; - + if ( pNode == NULL ) return(TRUE); @@ -1637,7 +1637,7 @@ BOOLEAN DisplayWindowFunc( DisplayList *pNode, INT16 iTopCutOff, INT16 iBottomCu usFillColor = SelWinHilightFillColor; ColorFillVideoSurfaceArea( FRAME_BUFFER, pNode->iX, iCurrY, - pNode->iX + pNode->iWidth, + pNode->iX + pNode->iWidth, iCurrY + pNode->iHeight, usFillColor); } @@ -1646,7 +1646,7 @@ BOOLEAN DisplayWindowFunc( DisplayList *pNode, INT16 iTopCutOff, INT16 iBottomCu sCount = pSelList[ FindInSelectionList( pNode ) ].sCount; SetObjectShade( pNode->hObj, DEFAULT_SHADE_LEVEL ); - fReturnVal = BltVideoObject( FRAME_BUFFER, pNode->hObj, pNode->uiIndex, + fReturnVal = BltVideoObject( FRAME_BUFFER, pNode->hObj, pNode->uiIndex, (UINT16)pNode->iX, (UINT16)iCurrY, VO_BLT_SRCTRANSPARENCY, NULL); @@ -1670,6 +1670,6 @@ BOOLEAN DisplayWindowFunc( DisplayList *pNode, INT16 iTopCutOff, INT16 iBottomCu - + diff --git a/Editor/selectwin.h b/Editor/selectwin.h index ac010940..fe02e8aa 100644 --- a/Editor/selectwin.h +++ b/Editor/selectwin.h @@ -82,7 +82,7 @@ typedef struct HVOBJECT hVObject; UINT16 usStart; UINT16 usEnd; - UINT32 uiObjIndx; + UINT32 uiObjIndx; }; struct { @@ -141,11 +141,11 @@ extern Selections SelSingleDoor[ MAX_SELECTIONS ]; extern Selections SelSingleWindow[ MAX_SELECTIONS ]; extern Selections SelSingleRoof[ MAX_SELECTIONS ]; extern Selections SelSingleNewRoof[ MAX_SELECTIONS ]; -extern Selections SelSingleBrokenWall[ MAX_SELECTIONS ]; +extern Selections SelSingleBrokenWall[ MAX_SELECTIONS ]; extern Selections SelSingleDecor[ MAX_SELECTIONS ]; extern Selections SelSingleDecal[ MAX_SELECTIONS ]; extern Selections SelSingleFloor[ MAX_SELECTIONS ]; -extern Selections SelSingleToilet[ MAX_SELECTIONS ]; +extern Selections SelSingleToilet[ MAX_SELECTIONS ]; extern Selections SelRoom[ MAX_SELECTIONS ]; diff --git a/Editor/smooth.cpp b/Editor/smooth.cpp index bd6b87db..537ed5dc 100644 --- a/Editor/smooth.cpp +++ b/Editor/smooth.cpp @@ -23,27 +23,27 @@ #include "Editor Undo.h" #endif -INT16 gbSmoothStruct[] = +INT16 gbSmoothStruct[] = { 3, 2, 12, 27, 12, 0, - 5, 2, 15, 30, 39, 0, + 5, 2, 15, 30, 39, 0, 7, 2, 17, 32, 41, 0, - 11, 2, 14, 29, 14, 0, + 11, 2, 14, 29, 14, 0, 8, 2, 13, 28, 38, 0, - 15, 1, 19, 0, 43, 0, - 26, 1, 20, 0, 44, 0, - 12, 2, 18, 33, 42, 0, - 23, 1, 21, 0, 45, 0, - 18, 2, 16, 31, 40, 0, - 21, 1, 22, 0, 46, 0, - 14, 2, 11, 26, 11, 0, - 19, 1, 23, 0, 47, 0, - 16, 2, 24, 34, 48, 0, - 10, 2, 25, 35, 49, 0, - -1 + 15, 1, 19, 0, 43, 0, + 26, 1, 20, 0, 44, 0, + 12, 2, 18, 33, 42, 0, + 23, 1, 21, 0, 45, 0, + 18, 2, 16, 31, 40, 0, + 21, 1, 22, 0, 46, 0, + 14, 2, 11, 26, 11, 0, + 19, 1, 23, 0, 47, 0, + 16, 2, 24, 34, 48, 0, + 10, 2, 25, 35, 49, 0, + -1 }; - + // This is a list of smoothed out water/shoreline textures // Coding is as such: // 1st - the corresponding bitvalue for the surrounding water tiles @@ -51,21 +51,21 @@ INT16 gbSmoothStruct[] = // 3rd - the first variation // 4th - the second variation -INT16 gbSmoothWaterStruct[] = +INT16 gbSmoothWaterStruct[] = // FIRST ENTRY MAJIC NUMBER CALCULATED // 2nd ENTRY # OF VARIATIONS -// 3rd, 4rth ENTRY TILE NUMBERS ( entry 1, entry 2 ) +// 3rd, 4rth ENTRY TILE NUMBERS ( entry 1, entry 2 ) { - 1020, 1, 11, 0, - 1000, 1, 12, 0, + 1020, 1, 11, 0, + 1000, 1, 12, 0, 510, 2, 13, 43, 190, 1, 14, 0, 894, 1, 15, 0, - 622, 1, 16, 0, - 1014, 2, 17, 41, - 944, 1, 18, 24, - 872, 1, 19, 0, - 992, 1, 20, 0, + 622, 1, 16, 0, + 1014, 2, 17, 41, + 944, 1, 18, 24, + 872, 1, 19, 0, + 992, 1, 20, 0, 62, 1, 21, 0, 190, 2, 22, 14, 620, 1, 23, 0, @@ -74,51 +74,51 @@ INT16 gbSmoothWaterStruct[] = 434, 1, 28, 0, 110, 1, 29,0, 1010, 1, 30,0, - 876, 2, 31, 32, + 876, 2, 31, 32, 878, 2, 32, 31, - 1004, 2, 32, 31, + 1004, 2, 32, 31, 1006, 2, 33, 34, 1008, 2, 34, 33, 1016, 2, 33, 34, 126, 2, 35, 36, - 254, 2, 35, 26, - 638, 2, 36, 26, + 254, 2, 35, 26, + 638, 2, 36, 26, 438, 2, 38, 27, 446, 2, 37, 38, 950, 2, 37, 27, 864, 1, 39, 0, - 1040, 1, 40, 0, + 1040, 1, 40, 0, 1014, 2, 41, 17, 432, 1, 42, 0, 510, 1, 43, 13, 54, 1, 44, 0, - 108, 1, 45, 0, + 108, 1, 45, 0, -1 }; - -BOOLEAN HigherLevel( UINT32 gridno, UINT8 NewLevel ); -BOOLEAN ContainsWater( UINT32 gridno ); + +BOOLEAN HigherLevel( INT32 gridno, UINT8 NewLevel ); +BOOLEAN ContainsWater( INT32 gridno ); void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSmooth ) { - int temp=0,type=0; + int temp=0; int FullTile = FALSE; UINT16 usOldIndex; UINT16 usTempIndex; UINT32 cnt; BOOLEAN fFound; UINT32 uiTempIndex; - UINT16 usTileIndex; + UINT16 usTileIndex; UINT16 land=0; - UINT32 uiTopType; + UINT32 uiTopType; BOOLEAN fSameTile; INT16 *pSmoothStruct; - // Check to see if the orginal texture was water, is so, smooth square/hex with + // Check to see if the orginal texture was water, is so, smooth square/hex with // SmoothWaterTerrain rather than the proceeding method if( origType==REGWATERTEXTURE) { - SmoothWaterTerrain( gridno, origType, piNewTile, TRUE); + SmoothWaterTerrain( gridno, origType, piNewTile, TRUE); return; } pSmoothStruct = gbSmoothStruct; @@ -142,7 +142,7 @@ void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSm if ( usOldIndex >= 1 && usOldIndex <= 10 ) { *piNewTile = NO_TILE; - return; + return; } } @@ -188,7 +188,7 @@ void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSm // Now, at this point the height (of "temp") will tell us // which texture piece to use - + // Loop through smooth struct cnt = 0; fFound = FALSE; @@ -210,10 +210,10 @@ void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSm } if ( pSmoothStruct[ cnt + 3 ] ) { - if ( pSmoothStruct[ cnt + 3 ] == usOldIndex ) - { + if ( pSmoothStruct[ cnt + 3 ] == usOldIndex ) + { fSameTile = TRUE; - } + } } if ( fSameTile ) { @@ -221,7 +221,7 @@ void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSm return; } uiTempIndex = rand() % pSmoothStruct[ cnt + 1 ]; - land = pSmoothStruct[ cnt + 2 + uiTempIndex ]; + land = pSmoothStruct[ cnt + 2 + uiTempIndex ]; fFound = TRUE; } while( FALSE ); break; @@ -236,14 +236,14 @@ void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSm *piNewTile = NO_TILE; return; } - // this is a "full" tile, so randomize between the + // this is a "full" tile, so randomize between the // five available tiles land = (rand( ) % 10 ) + 1; FullTile = TRUE; } GetTileIndexFromTypeSubIndex( origType, land, &usTileIndex ); *piNewTile = usTileIndex; -} +} void SmoothExitGridRadius( INT16 sMapIndex, UINT8 ubRadius ) { @@ -277,14 +277,14 @@ void SmoothExitGridRadius( INT16 sMapIndex, UINT8 ubRadius ) void SmoothExitGrid(int gridno, UINT16 *piNewTile, BOOLEAN fForceSmooth ) { - int temp=0,type=0; + int temp=0; int FullTile = FALSE; UINT16 usOldIndex; UINT16 usTempIndex; UINT32 cnt; BOOLEAN fFound; UINT32 uiTempIndex; - UINT16 usTileIndex; + UINT16 usTileIndex; UINT16 usExitGridIndex=0; BOOLEAN fSameTile; @@ -311,7 +311,7 @@ void SmoothExitGrid(int gridno, UINT16 *piNewTile, BOOLEAN fForceSmooth ) if ( usOldIndex >= 1 && usOldIndex <= 10 ) { *piNewTile = NO_TILE; - return; + return; } } @@ -357,7 +357,7 @@ void SmoothExitGrid(int gridno, UINT16 *piNewTile, BOOLEAN fForceSmooth ) // Now, at this point the height (of "temp") will tell us // which texture piece to use - + // Loop through smooth struct cnt = 0; fFound = FALSE; @@ -377,10 +377,10 @@ void SmoothExitGrid(int gridno, UINT16 *piNewTile, BOOLEAN fForceSmooth ) } if ( pSmoothStruct[ cnt + 3 ] ) { - if ( pSmoothStruct[ cnt + 3 ] == usOldIndex ) - { + if ( pSmoothStruct[ cnt + 3 ] == usOldIndex ) + { fSameTile = TRUE; - } + } } if ( fSameTile ) { @@ -388,7 +388,7 @@ void SmoothExitGrid(int gridno, UINT16 *piNewTile, BOOLEAN fForceSmooth ) return; } uiTempIndex = rand() % pSmoothStruct[ cnt + 1 ]; - usExitGridIndex = pSmoothStruct[ cnt + 2 + uiTempIndex ]; + usExitGridIndex = pSmoothStruct[ cnt + 2 + uiTempIndex ]; fFound = TRUE; } while( FALSE ); break; @@ -403,34 +403,34 @@ void SmoothExitGrid(int gridno, UINT16 *piNewTile, BOOLEAN fForceSmooth ) *piNewTile = NO_TILE; return; } - // this is a "full" tile, so randomize between the + // this is a "full" tile, so randomize between the // five available tiles usExitGridIndex = (rand( ) % 10 ) + 1; FullTile = TRUE; } GetTileIndexFromTypeSubIndex( EXITTEXTURE, usExitGridIndex, &usTileIndex ); *piNewTile = usTileIndex; -} +} void SmoothTerrainWorld( UINT32 uiCheckType ) { - int cnt; - UINT16 usIndex; - UINT16 NewTile; - // Smooth out entire world surrounding tiles - for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) - { + int cnt; + UINT16 usIndex; + UINT16 NewTile; + // Smooth out entire world surrounding tiles + for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) + { if ( TypeExistsInLandLayer( cnt, uiCheckType, &usIndex ) ) { SmoothTerrain( cnt, uiCheckType, &NewTile, TRUE ); - if ( NewTile != NO_TILE ) - { - // Change tile - SetLandIndex( cnt, NewTile, uiCheckType, FALSE ); - } + if ( NewTile != NO_TILE ) + { + // Change tile + SetLandIndex( cnt, NewTile, uiCheckType, FALSE ); } - } + } + } } @@ -440,7 +440,7 @@ void SmoothAllTerrainWorld( void ) UINT16 usIndex; UINT16 NewTile; UINT32 uiCheckType; - // Smooth out entire world surrounding tiles + // Smooth out entire world surrounding tiles for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) { for ( uiCheckType = FIRSTTEXTURE; uiCheckType <= SEVENTHTEXTURE; uiCheckType++ ) @@ -451,8 +451,8 @@ void SmoothAllTerrainWorld( void ) if ( NewTile != NO_TILE ) { - // Change tile - SetLandIndex( cnt, NewTile, uiCheckType, FALSE ); + // Change tile + SetLandIndex( cnt, NewTile, uiCheckType, FALSE ); } } } @@ -461,39 +461,39 @@ void SmoothAllTerrainWorld( void ) void SmoothTerrainRadius( UINT32 iMapIndex, UINT32 uiCheckType, UINT8 ubRadius, BOOLEAN fForceSmooth ) { - INT16 sTop, sBottom; - INT16 sLeft, sRight; - INT16 cnt1, cnt2; - INT32 iNewIndex; + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2; + INT32 iNewIndex; UINT16 NewTile; UINT16 usIndex; INT32 leftmost; // Don't bother to smooth floors, they don't need them - if ( uiCheckType >= FIRSTFLOOR && uiCheckType <= LASTFLOOR ) + if ( uiCheckType >= FIRSTFLOOR && uiCheckType <= LASTFLOOR ) return; // Determine start end end indicies and num rows sTop = ubRadius; sBottom = -ubRadius; - sLeft = - ubRadius; - sRight = ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) { leftmost = ( ( iMapIndex + ( WORLD_COLS * cnt1 ) )/ WORLD_COLS ) * WORLD_COLS; for( cnt2 = sLeft; cnt2 <= sRight; cnt2++ ) { iNewIndex = iMapIndex + ( WORLD_COLS * cnt1 ) + cnt2; - if ( iNewIndex >=0 && iNewIndex < WORLD_MAX && - iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) ) + if ( iNewIndex >=0 && iNewIndex < WORLD_MAX && + iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) ) { if ( TypeExistsInLandLayer( iNewIndex, uiCheckType, &usIndex ) ) { - SmoothTerrain( iNewIndex, uiCheckType, &NewTile, fForceSmooth ); + SmoothTerrain( iNewIndex, uiCheckType, &NewTile, fForceSmooth ); if ( NewTile != NO_TILE ) - { - // Change tile - AddToUndoList( iNewIndex ); - SetLandIndex( iNewIndex, NewTile, uiCheckType, FALSE ); + { + // Change tile + AddToUndoList( iNewIndex ); + SetLandIndex( iNewIndex, NewTile, uiCheckType, FALSE ); } } } @@ -503,18 +503,18 @@ void SmoothTerrainRadius( UINT32 iMapIndex, UINT32 uiCheckType, UINT8 ubRadius, void SmoothAllTerrainTypeRadius( UINT32 iMapIndex, UINT8 ubRadius, BOOLEAN fForceSmooth ) { - INT16 sTop, sBottom; - INT16 sLeft, sRight; - INT16 cnt1, cnt2, cnt3; - INT32 iNewIndex; + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2, cnt3; + INT32 iNewIndex; UINT16 NewTile; UINT16 usIndex; INT32 leftmost; // Determine start end end indicies and num rows sTop = ubRadius; sBottom = -ubRadius; - sLeft = - ubRadius; - sRight = ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; for( cnt3 = FIRSTTEXTURE; cnt3 <= SEVENTHTEXTURE; cnt3++ ) { for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) @@ -523,16 +523,16 @@ void SmoothAllTerrainTypeRadius( UINT32 iMapIndex, UINT8 ubRadius, BOOLEAN fForc for( cnt2 = sLeft; cnt2 <= sRight; cnt2++ ) { iNewIndex = iMapIndex + ( WORLD_COLS * cnt1 ) + cnt2; - if ( iNewIndex >=0 && iNewIndex < WORLD_MAX && - iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) ) + if ( iNewIndex >=0 && iNewIndex < WORLD_MAX && + iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) ) { if ( TypeExistsInLandLayer( iNewIndex, cnt3, &usIndex ) ) { - SmoothTerrain( iNewIndex, cnt3, &NewTile, fForceSmooth ); + SmoothTerrain( iNewIndex, cnt3, &NewTile, fForceSmooth ); if ( NewTile != NO_TILE ) { - // Change tile - SetLandIndex( iNewIndex, NewTile, cnt3, FALSE ); + // Change tile + SetLandIndex( iNewIndex, NewTile, cnt3, FALSE ); } } } @@ -544,18 +544,18 @@ void SmoothAllTerrainTypeRadius( UINT32 iMapIndex, UINT8 ubRadius, BOOLEAN fForc void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSmooth ) { // This procedure will calculate the approriate smooth texture for a water texture - // based on the surrounding water textures. This is done via masking bits within + // based on the surrounding water textures. This is done via masking bits within // a temp variable, then searching for the right texture and inserting it - int temp=0,type=0; + int temp=0; int FullTile = FALSE; UINT16 usOldIndex; UINT16 usTempIndex; UINT32 cnt; BOOLEAN fFound; UINT32 uiTempIndex; - UINT16 usTileIndex; + UINT16 usTileIndex; UINT16 land=0; - UINT32 uiTopType; + UINT32 uiTopType; BOOLEAN fSameTile; INT16 *pSmoothStruct; @@ -578,7 +578,7 @@ void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fF if ( usOldIndex >= 1 && usOldIndex <= 10 ) { *piNewTile = NO_TILE; - return; + return; } } // Mask approriate bits in temp for the lookup in the SmoothWaterStruct list @@ -673,8 +673,8 @@ void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fF cnt = 0; fFound = FALSE; GetLandHeadType( gridno, &uiTopType ); - // Speed up of this while loop using double/quick search will result - // in an incorrect solution due to multiple instances of bitvalues in the list of + // Speed up of this while loop using double/quick search will result + // in an incorrect solution due to multiple instances of bitvalues in the list of // smoothed water textures while( pSmoothStruct[ cnt ] != -1 ) { @@ -690,10 +690,10 @@ void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fF } if ( pSmoothStruct[ cnt + 3 ] ) { - if ( pSmoothStruct[ cnt + 3 ] == usOldIndex ) - { + if ( pSmoothStruct[ cnt + 3 ] == usOldIndex ) + { fSameTile = TRUE; - } + } } if ( fSameTile ) { @@ -701,7 +701,7 @@ void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fF return; } uiTempIndex = rand() % pSmoothStruct[ cnt + 1 ]; - land = pSmoothStruct[ cnt + 2 + uiTempIndex ]; + land = pSmoothStruct[ cnt + 2 + uiTempIndex ]; fFound = TRUE; } while( FALSE ); break; @@ -711,7 +711,7 @@ void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fF if ( !fFound ) { // Check for existance of same tile - if ( usOldIndex >= 1 && usOldIndex <= 10 ) + if ( usOldIndex >= 1 && usOldIndex <= 10 ) { *piNewTile = NO_TILE; return; @@ -721,13 +721,14 @@ void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fF } GetTileIndexFromTypeSubIndex( origType, land, &usTileIndex ); *piNewTile = usTileIndex; -} +} #endif - + + diff --git a/Editor/smooth.h b/Editor/smooth.h index 7d9b3d0b..151255d8 100644 --- a/Editor/smooth.h +++ b/Editor/smooth.h @@ -8,13 +8,13 @@ #define ONELEVELTYPETWOROOF 2 -// Area (pointer to SGP rect) + -// Location to check-+--| | |---- Check left and right edges -----| |---- Check top and bottom edges -----| +// Area (pointer to SGP rect) + +// Location to check-+--| | |---- Check left and right edges -----| |---- Check top and bottom edges -----| #define IsLocationInArea( x, y, r ) ( ((x) >= r->iLeft) && ((x) <= r->iRight) && ((y) >= r->iTop) && ((y) <= r->iBottom) ) void SmoothAllTerrainWorld( void ); -void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSmooth ); +void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSmooth ); void SmoothTerrainRadius( UINT32 iMapIndex, UINT32 uiCheckType, UINT8 ubRadius, BOOLEAN fForceSmooth ); void SmoothTerrainWorld( UINT32 uiCheckType ); diff --git a/Fade Screen.cpp b/Fade Screen.cpp index 380c576e..ee6e21b9 100644 --- a/Fade Screen.cpp +++ b/Fade Screen.cpp @@ -14,7 +14,7 @@ #include "gameloop.h" #endif -#define SQUARE_STEP 8 +#define SQUARE_STEP 8 extern UINT32 guiExitScreen; // symbol already declared globally in laptop.cpp (jonathanl) BOOLEAN gfFadeInitialized = FALSE; @@ -34,12 +34,12 @@ UINT32 uiOldMusicMode; FADE_FUNCTION gFadeFunction = NULL; -FADE_HOOK gFadeInDoneCallback = NULL; +FADE_HOOK gFadeInDoneCallback = NULL; FADE_HOOK gFadeOutDoneCallback = NULL; -void FadeFrameBufferSquare( ); -void FadeFrameBufferVersionOne( ); +void FadeFrameBufferSquare( ); +void FadeFrameBufferVersionOne( ); void FadeFrameBufferVersionFaster( INT8 bFadeValue ); void FadeFrameBufferSide( ); void FadeFrameBufferRealFade( ); @@ -49,14 +49,14 @@ void FadeInBackBufferSquare( ); void FadeInFrameBufferRealFade( ); -extern BOOLEAN ShadowVideoSurfaceRectUsingLowPercentTable( UINT32 uiDestVSurface, INT32 X1, INT32 Y1, INT32 X2, INT32 Y2); +extern BOOLEAN ShadowVideoSurfaceRectUsingLowPercentTable( UINT32 uiDestVSurface, INT32 X1, INT32 Y1, INT32 X2, INT32 Y2); BOOLEAN UpdateSaveBufferWithBackbuffer( void ); -BOOLEAN gfFadeIn = FALSE; -BOOLEAN gfFadeOut = FALSE; -BOOLEAN gfFadeOutDone = FALSE; -BOOLEAN gfFadeInDone = FALSE; +BOOLEAN gfFadeIn = FALSE; +BOOLEAN gfFadeOut = FALSE; +BOOLEAN gfFadeOutDone = FALSE; +BOOLEAN gfFadeInDone = FALSE; void FadeInNextFrame( ) @@ -164,8 +164,8 @@ void BeginFade( UINT32 uiExitScreen, INT8 bFadeValue, INT8 bType, UINT32 uiDelay gsFadeRealCount = -1; gsFadeLimit = 8; - gFadeFunction = (FADE_FUNCTION)FadeInFrameBufferRealFade; - gfFadeInVideo = FALSE; + gFadeFunction = (FADE_FUNCTION)FadeInFrameBufferRealFade; + gfFadeInVideo = FALSE; // Copy backbuffer to savebuffer UpdateSaveBufferWithBackbuffer( ); @@ -175,11 +175,11 @@ void BeginFade( UINT32 uiExitScreen, INT8 bFadeValue, INT8 bType, UINT32 uiDelay break; case FADE_OUT_REALFADE: - + gsFadeRealCount = -1; gsFadeLimit = 10; - gFadeFunction = (FADE_FUNCTION)FadeFrameBufferRealFade; - gfFadeInVideo = FALSE; + gFadeFunction = (FADE_FUNCTION)FadeFrameBufferRealFade; + gfFadeInVideo = FALSE; // Clear framebuffer //ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); @@ -324,7 +324,7 @@ UINT32 FadeScreenHandle( ) return( FADE_SCREEN ); } -UINT32 FadeScreenShutdown( ) +UINT32 FadeScreenShutdown( ) { return( FALSE ); @@ -491,7 +491,7 @@ void FadeFrameBufferVersionFaster( INT8 bFadeValue ) } -void FadeFrameBufferSide( ) +void FadeFrameBufferSide( ) { INT32 iX1, iX2; INT16 sFadeMove; @@ -510,7 +510,7 @@ void FadeFrameBufferSide( ) } -void FadeFrameBufferSquare( ) +void FadeFrameBufferSquare( ) { INT32 iX1, iX2, iY1, iY2; INT16 sFadeXMove, sFadeYMove; @@ -518,7 +518,7 @@ void FadeFrameBufferSquare( ) sFadeXMove = SQUARE_STEP; sFadeYMove = (INT16)(sFadeXMove * .75); - + iX1 = giX1; iX2 = giX1 + sFadeXMove; iY1 = giY1; @@ -543,7 +543,7 @@ void FadeFrameBufferSquare( ) } -void FadeInBackBufferSquare( ) +void FadeInBackBufferSquare( ) { INT32 iX1, iX2, iY1, iY2; INT16 sFadeXMove, sFadeYMove; @@ -563,15 +563,15 @@ void FadeInBackBufferSquare( ) iY2 = giY2 + sFadeYMove; BltFx.SrcRect.iLeft = iX1; - BltFx.SrcRect.iTop = iY1; + BltFx.SrcRect.iTop = iY1; BltFx.SrcRect.iRight = iX2; BltFx.SrcRect.iBottom = iY2; - if ( BltFx.SrcRect.iRight != BltFx.SrcRect.iLeft ) + if ( BltFx.SrcRect.iRight != BltFx.SrcRect.iLeft ) { - BltVideoSurface( BACKBUFFER, FRAME_BUFFER, 0, - iX1, iY1, - VS_BLT_SRCSUBRECT, &BltFx ); + BltVideoSurface( BACKBUFFER, FRAME_BUFFER, 0, + iX1, iY1, + VS_BLT_SRCSUBRECT, &BltFx ); } iX1 = giX2; @@ -580,15 +580,15 @@ void FadeInBackBufferSquare( ) iY2 = giY2 + sFadeYMove; BltFx.SrcRect.iLeft = iX1; - BltFx.SrcRect.iTop = iY1; + BltFx.SrcRect.iTop = iY1; BltFx.SrcRect.iRight = iX2; BltFx.SrcRect.iBottom = iY2; if ( BltFx.SrcRect.iRight != BltFx.SrcRect.iLeft ) { - BltVideoSurface( BACKBUFFER, FRAME_BUFFER, 0, - iX1, iY1, - VS_BLT_SRCSUBRECT, &BltFx ); + BltVideoSurface( BACKBUFFER, FRAME_BUFFER, 0, + iX1, iY1, + VS_BLT_SRCSUBRECT, &BltFx ); } iX1 = giX1; @@ -597,15 +597,15 @@ void FadeInBackBufferSquare( ) iY2 = giY1; BltFx.SrcRect.iLeft = iX1; - BltFx.SrcRect.iTop = iY1; + BltFx.SrcRect.iTop = iY1; BltFx.SrcRect.iRight = iX2; BltFx.SrcRect.iBottom = iY2; - if ( BltFx.SrcRect.iBottom != BltFx.SrcRect.iTop ) + if ( BltFx.SrcRect.iBottom != BltFx.SrcRect.iTop ) { - BltVideoSurface( BACKBUFFER, FRAME_BUFFER, 0, - iX1, iY1, - VS_BLT_SRCSUBRECT, &BltFx ); + BltVideoSurface( BACKBUFFER, FRAME_BUFFER, 0, + iX1, iY1, + VS_BLT_SRCSUBRECT, &BltFx ); } iX1 = giX1; @@ -614,15 +614,15 @@ void FadeInBackBufferSquare( ) iY2 = giY2 + sFadeYMove; BltFx.SrcRect.iLeft = iX1; - BltFx.SrcRect.iTop = iY1; + BltFx.SrcRect.iTop = iY1; BltFx.SrcRect.iRight = iX2; BltFx.SrcRect.iBottom = iY2; if ( BltFx.SrcRect.iBottom != BltFx.SrcRect.iTop ) { - BltVideoSurface( BACKBUFFER, FRAME_BUFFER, 0, - iX1, iY1, - VS_BLT_SRCSUBRECT, &BltFx ); + BltVideoSurface( BACKBUFFER, FRAME_BUFFER, 0, + iX1, iY1, + VS_BLT_SRCSUBRECT, &BltFx ); } giX1 -= sFadeXMove; @@ -637,7 +637,7 @@ void FadeFrameBufferRealFade( ) { if ( gsFadeRealCount != gsFadeCount ) { - ShadowVideoSurfaceRectUsingLowPercentTable( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + ShadowVideoSurfaceRectUsingLowPercentTable( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); gsFadeRealCount = gsFadeCount; } @@ -654,7 +654,7 @@ void FadeInFrameBufferRealFade( ) for ( cnt = 0; cnt < ( gsFadeLimit - gsFadeCount ); cnt++ ) { - ShadowVideoSurfaceRectUsingLowPercentTable( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + ShadowVideoSurfaceRectUsingLowPercentTable( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); } // Refresh Screen @@ -672,11 +672,11 @@ void FadeInFrameBufferRealFade( ) BOOLEAN UpdateSaveBufferWithBackbuffer(void) { UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; - UINT8 *pDestBuf, *pSrcBuf; + UINT8 *pDestBuf, *pSrcBuf; UINT16 usWidth, usHeight; - UINT8 ubBitDepth; + UINT8 ubBitDepth; + - // Update saved buffer - do for the viewport size ony! GetCurrentVideoSettings( &usWidth, &usHeight, &ubBitDepth ); @@ -686,8 +686,8 @@ BOOLEAN UpdateSaveBufferWithBackbuffer(void) if(gbPixelDepth==16) { // BLIT HERE - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, 0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); } diff --git a/GameInitOptionsScreen.cpp b/GameInitOptionsScreen.cpp index d014c0ed..55781d50 100644 --- a/GameInitOptionsScreen.cpp +++ b/GameInitOptionsScreen.cpp @@ -79,6 +79,11 @@ #define GIO_IRON_MAN_SETTING_Y iScreenHeightOffset + 355 #define GIO_IRON_MAN_SETTING_WIDTH GIO_DIF_SETTINGS_WIDTH +// CHRISL: +#define GIO_INV_SETTING_X iScreenWidthOffset + 340 +#define GIO_INV_SETTING_Y GIO_IRON_MAN_SETTING_Y +#define GIO_INV_SETTING_WIDTH GIO_DIF_SETTINGS_WIDTH + //Difficulty settings enum { @@ -120,6 +125,15 @@ enum NUM_BR_OPTIONS, }; +// CHRISL: New inventory options +enum +{ + GIO_INV_OLD, + GIO_INV_NEW, + + NUM_INV_OPTIONS, +}; + // JA2Gold: no more timed turns setting /* @@ -181,6 +195,10 @@ INT32 giGioMessageBox = -1; //extern INT32 gp16PointArial; +// CHRISL: checkbox to toggle INV selection +UINT32 guiINVOptionToggles[ NUM_INV_OPTIONS ]; +void BtnINVOptionTogglesCallback(GUI_BUTTON *btn,INT32 reason); + // Done Button void BtnGIODoneCallback(GUI_BUTTON *btn,INT32 reason); UINT32 guiGIODoneButton; @@ -271,13 +289,13 @@ UINT32 GameInitOptionsScreenHandle( void ) } GetGIOScreenUserInput(); - + HandleGIOScreen(); - // render buttons marked dirty + // render buttons marked dirty MarkButtonsDirty( ); - RenderButtons( ); + RenderButtons( ); // render help // RenderFastHelp( ); @@ -325,7 +343,7 @@ UINT32 GameInitOptionsScreenShutdown( void ) BOOLEAN EnterGIOScreen() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; UINT16 cnt; UINT16 usPosY; @@ -354,24 +372,24 @@ BOOLEAN EnterGIOScreen() //Ok button giGIODoneBtnImage = LoadButtonImage("INTERFACE\\PreferencesButtons.sti", -1,0,-1,2,-1 ); - guiGIODoneButton = CreateIconAndTextButton( giGIODoneBtnImage, gzGIOScreenText[GIO_OK_TEXT], OPT_BUTTON_FONT, - OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, - OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - GIO_BTN_OK_X, GIO_BTN_OK_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnGIODoneCallback); + guiGIODoneButton = CreateIconAndTextButton( giGIODoneBtnImage, gzGIOScreenText[GIO_OK_TEXT], OPT_BUTTON_FONT, + OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, + OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + GIO_BTN_OK_X, GIO_BTN_OK_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnGIODoneCallback); SpecifyButtonSoundScheme( guiGIODoneButton, BUTTON_SOUND_SCHEME_BIGSWITCH3 ); SpecifyDisabledButtonStyle( guiGIODoneButton, DISABLED_STYLE_NONE ); //Cancel button giGIOCancelBtnImage = UseLoadedButtonImage( giGIODoneBtnImage, -1,1,-1,3,-1 ); - guiGIOCancelButton = CreateIconAndTextButton( giGIOCancelBtnImage, gzGIOScreenText[GIO_CANCEL_TEXT], OPT_BUTTON_FONT, - OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, - OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - GIO_CANCEL_X, GIO_BTN_OK_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnGIOCancelCallback ); + guiGIOCancelButton = CreateIconAndTextButton( giGIOCancelBtnImage, gzGIOScreenText[GIO_CANCEL_TEXT], OPT_BUTTON_FONT, + OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, + OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + GIO_CANCEL_X, GIO_BTN_OK_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnGIOCancelCallback ); SpecifyButtonSoundScheme( guiGIOCancelButton, BUTTON_SOUND_SCHEME_BIGSWITCH3 ); @@ -382,8 +400,8 @@ BOOLEAN EnterGIOScreen() for( cnt=0; cntuiFlags |= BUTTON_CLICKED_ON; + break; + case INVENTORY_NEW: + ButtonList[ guiINVOptionToggles[ GIO_INV_NEW ] ]->uiFlags |= BUTTON_CLICKED_ON; + break; + } + } + // JA2Gold: iron man buttons usPosY = GIO_IRON_MAN_SETTING_Y - GIO_OFFSET_TO_TOGGLE_BOX_Y; for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) { @@ -827,7 +885,7 @@ void BtnBROptionTogglesCallback( GUI_BUTTON *btn, INT32 reason ) { if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { - UINT8 ubButton = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + /*UINT8 ubButton = (UINT8)*/MSYS_GetBtnUserData( btn, 0 ); if( btn->uiFlags & BUTTON_CLICKED_ON ) { @@ -861,11 +919,50 @@ void BtnBROptionTogglesCallback( GUI_BUTTON *btn, INT32 reason ) } } +// CHRISL: +void BtnINVOptionTogglesCallback(GUI_BUTTON *btn,INT32 reason) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + /*UINT8 ubButton = (UINT8)*/MSYS_GetBtnUserData( btn, 0 ); + + if( btn->uiFlags & BUTTON_CLICKED_ON ) + { + UINT8 cnt; + + for( cnt=0; cntuiFlags &= ~BUTTON_CLICKED_ON; + } + + //enable the current button + btn->uiFlags |= BUTTON_CLICKED_ON; + } + else + { + UINT8 cnt; + BOOLEAN fAnyChecked=FALSE; + + //if none of the other boxes are checked, do not uncheck this box + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + { + fAnyChecked = TRUE; + } + } + //if none are checked, re check this one + if( !fAnyChecked ) + btn->uiFlags |= BUTTON_CLICKED_ON; + } + } +} + void BtnGameStyleTogglesCallback( GUI_BUTTON *btn, INT32 reason ) { if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { - UINT8 ubButton = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + /*UINT8 ubButton = (UINT8)*/MSYS_GetBtnUserData( btn, 0 ); if( btn->uiFlags & BUTTON_CLICKED_ON ) { @@ -941,7 +1038,7 @@ void BtnGunOptionsTogglesCallback( GUI_BUTTON *btn, INT32 reason ) { if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { - UINT8 ubButton = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + /*UINT8 ubButton = (UINT8)*/MSYS_GetBtnUserData( btn, 0 ); if( btn->uiFlags & BUTTON_CLICKED_ON ) { @@ -1040,7 +1137,7 @@ void BtnGIODoneCallback(GUI_BUTTON *btn,INT32 reason) InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnGIOCancelCallback(GUI_BUTTON *btn,INT32 reason) @@ -1058,7 +1155,7 @@ void BtnGIOCancelCallback(GUI_BUTTON *btn,INT32 reason) InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} UINT8 GetCurrentDifficultyButtonSetting() @@ -1093,6 +1190,21 @@ UINT8 GetCurrentBROptionButtonSetting() return( 0 ); } +// CHRISL: +UINT8 GetCurrentINVOptionButtonSetting() +{ + UINT8 cnt; + + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + { + return( cnt ); + } + } + return( 0 ); +} + UINT8 GetCurrentGameStyleButtonSetting() { UINT8 cnt; @@ -1166,7 +1278,7 @@ void RestoreGIOButtonBackGrounds() //Check box to toggle Difficulty settings for( cnt=0; cnt= NUM_SAVE_GAMES ) + if( gGameSettings.bLastSavedGameSlot < 0 || gGameSettings.bLastSavedGameSlot >= NUM_SAVE_GAMES ) gGameSettings.bLastSavedGameSlot = -1; if( gGameSettings.ubMusicVolumeSetting > HIGHVOLUME ) gGameSettings.ubMusicVolumeSetting = MIDVOLUME; - + if( gGameSettings.ubSoundEffectsVolume > HIGHVOLUME ) gGameSettings.ubSoundEffectsVolume = MIDVOLUME; @@ -143,7 +146,7 @@ BOOLEAN LoadGameSettings() gGameSettings.fOptions[ TOPTION_SUBTITLES ] = TRUE; gGameSettings.fOptions[ TOPTION_SPEECH ] = TRUE; } - + // // Set the settings @@ -151,7 +154,7 @@ BOOLEAN LoadGameSettings() SetSoundEffectsVolume( gGameSettings.ubSoundEffectsVolume ); SetSpeechVolume( gGameSettings.ubSpeechVolume ); - MusicSetVolume( gGameSettings.ubMusicVolumeSetting ); + MusicSetVolume( gGameSettings.ubMusicVolumeSetting ); #ifndef BLOOD_N_GORE_ENABLED gGameSettings.fOptions[ TOPTION_BLOOD_N_GORE ] = FALSE; @@ -195,7 +198,7 @@ BOOLEAN SaveGameSettings() gGameSettings.ubSoundEffectsVolume = (UINT8)GetSoundEffectsVolume( ); gGameSettings.ubSpeechVolume = (UINT8)GetSpeechVolume( ); - gGameSettings.ubMusicVolumeSetting = (UINT8)MusicGetVolume( ); + gGameSettings.ubMusicVolumeSetting = (UINT8)MusicGetVolume( ); strcpy( gGameSettings.zVersionNumber, czVersionNumber ); @@ -227,7 +230,7 @@ void InitGameSettings() //Set the settings SetSoundEffectsVolume( gGameSettings.ubSoundEffectsVolume ); SetSpeechVolume( gGameSettings.ubSpeechVolume ); - MusicSetVolume( gGameSettings.ubMusicVolumeSetting ); + MusicSetVolume( gGameSettings.ubMusicVolumeSetting ); gGameSettings.fOptions[ TOPTION_SUBTITLES ] = TRUE; gGameSettings.fOptions[ TOPTION_SPEECH ] = TRUE; @@ -296,6 +299,7 @@ void InitGameOptions() gGameOptions.fAirStrikes = FALSE; gGameOptions.ubGameStyle = STYLE_SCIFI; gGameOptions.ubDifficultyLevel = DIF_LEVEL_MEDIUM; + gGameOptions.ubInventorySystem = INVENTORY_NEW; //gGameOptions.fTurnTimeLimit = FALSE; gGameOptions.fIronManMode = FALSE; @@ -332,16 +336,16 @@ void LoadGameExternalOptions() gGameExternalOptions.iIMPMaleCharacterCount = iniReader.ReadInteger("JA2 Laptop Settings","IMP_MALE_CHARACTER_COUNT", COUNT_STANDARD_MALE_SLOTS, 1, NUM_PROFILES); gGameExternalOptions.iIMPFemaleCharacterCount = iniReader.ReadInteger("JA2 Laptop Settings","IMP_FEMALE_CHARACTER_COUNT", COUNT_STANDARD_FEMALE_SLOTS, 1, NUM_PROFILES); - if (gGameExternalOptions.iIMPMaleCharacterCount + gGameExternalOptions.iIMPFemaleCharacterCount > NUM_PROFILES) + if (gGameExternalOptions.iIMPMaleCharacterCount + gGameExternalOptions.iIMPFemaleCharacterCount > NUM_PROFILES) { gGameExternalOptions.iIMPMaleCharacterCount = COUNT_STANDARD_MALE_SLOTS; gGameExternalOptions.iIMPFemaleCharacterCount = COUNT_STANDARD_FEMALE_SLOTS; } // - // Note: put -1 between male/female slots and -1 at end. This allows everything to be - // counted dynamically quite easily. Note that all the code assumes there is AT - // LEAST ONE slot for each sex. If that changes the code will have to be updated. + // Note: put -1 between male/female slots and -1 at end. This allows everything to be + // counted dynamically quite easily. Note that all the code assumes there is AT + // LEAST ONE slot for each sex. If that changes the code will have to be updated. // // Because errors in these values can really goof things up we will try to fix up bad // values and use the defaults instead. @@ -397,20 +401,20 @@ void LoadGameExternalOptions() gGameExternalOptions.fAllMercsAvailable = iniReader.ReadBoolean("JA2 Laptop Settings","ALL_MERCS_AT_MERC",FALSE); //Merc Death Settings: - gGameExternalOptions.gfMercsDieOnAssignment = iniReader.ReadBoolean("JA2 Laptop Settings","MERCS_DIE_ON_ASSIGNMENT",TRUE); - gGameExternalOptions.giEasyMercDeaths = iniReader.ReadInteger("JA2 Laptop Settings","EASY_MERC_DEATHS",1); - gGameExternalOptions.giExperiencedMercDeaths = iniReader.ReadInteger("JA2 Laptop Settings","EXPERIENCED_MERC_DEATHS",2); - gGameExternalOptions.giExpertMercDeaths = iniReader.ReadInteger("JA2 Laptop Settings","EXPERT_MERC_DEATHS",3); - gGameExternalOptions.giInsaneMercDeaths = iniReader.ReadInteger("JA2 Laptop Settings","INSANE_MERC_DEATHS",4); + gGameExternalOptions.gfMercsDieOnAssignment = iniReader.ReadBoolean("JA2 Laptop Settings","MERCS_DIE_ON_ASSIGNMENT",TRUE); + gGameExternalOptions.giEasyMercDeaths = iniReader.ReadInteger("JA2 Laptop Settings","EASY_MERC_DEATHS",1); + gGameExternalOptions.giExperiencedMercDeaths = iniReader.ReadInteger("JA2 Laptop Settings","EXPERIENCED_MERC_DEATHS",2); + gGameExternalOptions.giExpertMercDeaths = iniReader.ReadInteger("JA2 Laptop Settings","EXPERT_MERC_DEATHS",3); + gGameExternalOptions.giInsaneMercDeaths = iniReader.ReadInteger("JA2 Laptop Settings","INSANE_MERC_DEATHS",4); //################# System Settings ################# gGameExternalOptions.gubDeadLockDelay = (UINT8) iniReader.ReadInteger("JA2 System Settings","DEAD_LOCK_DELAY",15); gGameExternalOptions.gfEnableEmergencyButton_SkipStrategicEvents = iniReader.ReadBoolean("JA2 System Settings","ENABLE_EMERGENCY_BUTTON_NUMLOCK_TO_SKIP_STRATEGIC_EVENTS",0); - + //################# Video Settings ################# gGameExternalOptions.gfVSync = iniReader.ReadBoolean("JA2 Video Settings","VERTICAL_SYNC",0); - + //################# Animation Settings ################# gGameExternalOptions.gubPlayerTurnSpeedUpFactor = iniReader.ReadInteger("JA2 Turnbased Animation Speed Settings","PLAYER_TURN_SPEED_UP_FACTOR",1); @@ -419,7 +423,7 @@ void LoadGameExternalOptions() gGameExternalOptions.gubMilitiaTurnSpeedUpFactor = iniReader.ReadInteger("JA2 Turnbased Animation Speed Settings","MILITIA_TURN_SPEED_UP_FACTOR",1); gGameExternalOptions.gubCivilianTurnSpeedUpFactor = iniReader.ReadInteger("JA2 Turnbased Animation Speed Settings","CIVILIAN_TURN_SPEED_UP_FACTOR",1); - + //################# Sound Settings ################# gGameExternalOptions.guiWeaponSoundEffectsVolume = iniReader.ReadInteger("JA2 Sound Settings","WEAPON_SOUND_EFFECTS_VOLUME",0); @@ -427,7 +431,7 @@ void LoadGameExternalOptions() //################# Tactical Settings ################# - gGameExternalOptions.gfRevealItems = iniReader.ReadBoolean("JA2 Tactical Settings","REVEAL_ITEMS_AFTER_COMBAT",TRUE); + gGameExternalOptions.gfRevealItems = iniReader.ReadBoolean("JA2 Tactical Settings","REVEAL_ITEMS_AFTER_COMBAT",TRUE); // Militia Settings gGameExternalOptions.fAllowTacticalMilitiaCommand = iniReader.ReadBoolean("JA2 Tactical Settings","ALLOW_TACTICAL_MILITIA_COMMAND",0); @@ -473,6 +477,9 @@ void LoadGameExternalOptions() gGameExternalOptions.fEnableSoldierTooltipBigSlot2 = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_BIG_SLOT_2", TRUE); gGameExternalOptions.fEnableSoldierTooltipBigSlot3 = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_BIG_SLOT_3", TRUE); gGameExternalOptions.fEnableSoldierTooltipBigSlot4 = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_BIG_SLOT_4", TRUE); + gGameExternalOptions.fEnableSoldierTooltipBigSlot5 = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_BIG_SLOT_5", TRUE); + gGameExternalOptions.fEnableSoldierTooltipBigSlot6 = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_BIG_SLOT_6", TRUE); + gGameExternalOptions.fEnableSoldierTooltipBigSlot7 = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_BIG_SLOT_7", TRUE); // ShadoWarrior: Tooltip changes (end) // Unload weapons & remove attachments @@ -482,7 +489,7 @@ void LoadGameExternalOptions() gGameExternalOptions.fEnableArmorCoverage = iniReader.ReadBoolean("JA2 Tactical Settings", "ENABLE_ARMOR_COVERAGE", FALSE); // ShadoWarrior for Captain J's armor coverage //################# Rain Settings ################## - + // Rain settings gGameExternalOptions.gfAllowRain = iniReader.ReadBoolean("JA2 Rain Settings","ALLOW_RAIN",0); gGameExternalOptions.gusRainChancePerDay = iniReader.ReadInteger("JA2 Rain Settings","RAIN_CHANCE_PER_DAY",100); @@ -514,7 +521,8 @@ void LoadGameExternalOptions() //Lalien: Game starting time gGameExternalOptions.iGameStartingTime = iniReader.ReadInteger("JA2 Gameplay Settings", "GAME_STARTING_TIME", NUM_SEC_IN_HOUR); - + + // WANNE: Check for invalid starting time if (gGameExternalOptions.iGameStartingTime < 0 || gGameExternalOptions.iGameStartingTime >= NUM_SEC_IN_DAY) { @@ -526,7 +534,7 @@ void LoadGameExternalOptions() } gGameExternalOptions.iFirstArrivalDelay = iniReader.ReadInteger("JA2 Gameplay Settings", "FIRST_ARRIVAL_DELAY", 6 * NUM_SEC_IN_HOUR); - + //################# Settings valid on game start only end ################## @@ -538,15 +546,15 @@ void LoadGameExternalOptions() gGameExternalOptions.fStealingDisabled = iniReader.ReadBoolean("JA2 Gameplay Settings","STEALING_FROM_SHIPMENTS_DISABLED",FALSE); // WDS: Game progress - gGameExternalOptions.ubGameProgressPortionKills = iniReader.ReadInteger("JA2 Gameplay Settings","GAME_PROGRESS_KILLS",25); + gGameExternalOptions.ubGameProgressPortionKills = iniReader.ReadInteger("JA2 Gameplay Settings","GAME_PROGRESS_KILLS",25); gGameExternalOptions.ubGameProgressPortionControl = iniReader.ReadInteger("JA2 Gameplay Settings","GAME_PROGRESS_CONTROL",25); gGameExternalOptions.ubGameProgressPortionIncome = iniReader.ReadInteger("JA2 Gameplay Settings","GAME_PROGRESS_INCOME",50); gGameExternalOptions.ubGameProgressPortionVisited = iniReader.ReadInteger("JA2 Gameplay Settings","GAME_PROGRESS_VISITED",0); - + // Any way to warn on this? if (gGameExternalOptions.ubGameProgressPortionKills + gGameExternalOptions.ubGameProgressPortionControl + gGameExternalOptions.ubGameProgressPortionIncome + gGameExternalOptions.ubGameProgressPortionVisited != 100) { - gGameExternalOptions.ubGameProgressPortionKills = 25; + gGameExternalOptions.ubGameProgressPortionKills = 25; gGameExternalOptions.ubGameProgressPortionControl = 25; gGameExternalOptions.ubGameProgressPortionIncome = 50; gGameExternalOptions.ubGameProgressPortionVisited = 0; @@ -557,7 +565,7 @@ void LoadGameExternalOptions() gGameExternalOptions.ubGameProgressMikeAvailable = iniReader.ReadInteger("JA2 Gameplay Settings","GAME_PROGRESS_MIKE_AVAILABLE",50); gGameExternalOptions.ubGameProgressIggyAvaliable = iniReader.ReadInteger("JA2 Gameplay Settings","GAME_PROGRESS_IGGY_AVAILABLE",70); gGameExternalOptions.ubSendTroopsToDrassen = iniReader.ReadBoolean("JA2 Gameplay Settings","STRATEGIC_EVENT_SEND_TROOPS_TO_DRASSEN",TRUE); - + //Weapons modification gGameExternalOptions.ubExplosivesDamageMultiplier = iniReader.ReadInteger("JA2 Gameplay Settings","EXPLOSIVES_DAMAGE_MULTIPLIER",0); @@ -649,7 +657,7 @@ void LoadGameExternalOptions() gGameExternalOptions.gfAllowReinforcements = iniReader.ReadBoolean("JA2 Gameplay Settings","ALLOW_REINFORCEMENTS",FALSE); gGameExternalOptions.gfAllowReinforcementsOnlyInCity = iniReader.ReadBoolean("JA2 Gameplay Settings","ALLOW_REINFORCEMENTS_ONLY_IN_CITIES",FALSE); gGameExternalOptions.guiBaseQueenPoolIncrement = iniReader.ReadInteger("JA2 Gameplay Settings","QUEEN_POOL_INCREMENT_PER_DIFFICULTY_LEVEL",60); - + gGameExternalOptions.guiCreateEachNHours = iniReader.ReadInteger("JA2 Gameplay Settings","CREATE_EACH_N_HOURS",24); gGameExternalOptions.guiDivOfOriginalMilitia = iniReader.ReadInteger("JA2 Gameplay Settings","DIV_OF_ORIGINAL_MILITIA",4); gGameExternalOptions.guiMinMilitiaSquadSize = iniReader.ReadInteger("JA2 Gameplay Settings","MINIMUM_MILITIA_SQUAD_SIZE",5); @@ -691,14 +699,14 @@ void LoadGameExternalOptions() gGameExternalOptions.ubRepairCostPerJam = iniReader.ReadInteger("JA2 Gameplay Settings","REPAIR_COST_PER_JAM",2); gGameExternalOptions.ubRepairRateDivisor = iniReader.ReadInteger("JA2 Gameplay Settings","REPAIR_RATE_DIVISOR",2500); - + //Misc gGameExternalOptions.fAmmoDynamicWeight = iniReader.ReadBoolean("JA2 Gameplay Settings", "DYNAMIC_AMMO_WEIGHT", TRUE); //Pulmu - gGameExternalOptions.fEnableCrepitus = iniReader.ReadBoolean("JA2 Gameplay Settings", "ENABLE_CREPITUS", TRUE); + gGameExternalOptions.fEnableCrepitus = iniReader.ReadBoolean("JA2 Gameplay Settings", "ENABLE_CREPITUS", TRUE); - gGameExternalOptions.fEnableAllTerrorists = iniReader.ReadBoolean("JA2 Gameplay Settings", "ENABLE_ALL_TERRORISTS", FALSE); - gGameExternalOptions.fEnableAllWeaponCaches = iniReader.ReadBoolean("JA2 Gameplay Settings", "ENABLE_ALL_WEAPON_CACHES", FALSE); + gGameExternalOptions.fEnableAllTerrorists = iniReader.ReadBoolean("JA2 Gameplay Settings", "ENABLE_ALL_TERRORISTS", FALSE); + gGameExternalOptions.fEnableAllWeaponCaches = iniReader.ReadBoolean("JA2 Gameplay Settings", "ENABLE_ALL_WEAPON_CACHES", FALSE); gGameExternalOptions.fSlowProgressForEnemyItemsChoice = iniReader.ReadBoolean("JA2 Gameplay Settings", "SLOW_PROGRESS_FOR_ENEMY_ITEMS_CHOICE", TRUE); @@ -708,6 +716,14 @@ void LoadGameExternalOptions() // WANNE: Added INI file Option for enemy ambushes, so we also have the option to play vanilla ja2 ambush settings gGameExternalOptions.fEnableChanceOfEnemyAmbushesOnInsaneDifficult = iniReader.ReadBoolean("JA2 Gameplay Settings", "ENABLE_CHANCE_OF_ENEMY_AMBUSHES_ON_INSANE_DIFFICULT", TRUE); + // CHRISL: New setting to allow Slay to remain as a hired PC + gGameExternalOptions.fEnableSlayForever = iniReader.ReadBoolean("JA2 Gameplay Settings", "SLAY_FOREVER", FALSE); + + // CHRISL: New setting to determine the AP cost to reload 1 loose round of ammo + gGameExternalOptions.ubAPCostPerRound = iniReader.ReadInteger("JA2 Gameplay Settings","AP_COST_PER_ROUND",2); + + // CHRISL: New setting to determine AP multiplier when reloading with wrong sized clip + gGameExternalOptions.ubWrongMagMult = iniReader.ReadFloat("JA2 Gameplay Settings","WRONG_MAG_MULT",2); } @@ -720,7 +736,6 @@ BOOLEAN GetCDLocation( ) { UINT32 uiStrngLength = 0; CHAR8 zCdLocation[ SGPFILENAME_LEN ]; - //UINT32 uiDriveType=0; UINT32 uiRetVal=0; //Do a crude check to make sure the Ja2.ini file is the right on @@ -730,7 +745,7 @@ BOOLEAN GetCDLocation( ) { // the user most likely doesnt have the file, or the user has messed with the file // build a new one - + //First delete the old file // Snap: don't clobber the INI file! //FileDelete( GAME_INI_FILE ); @@ -751,9 +766,9 @@ BOOLEAN GetCDLocation( ) } //Now create a new file - WritePrivateProfileString( "Ja2 Settings", "CD", zCdLocation, GAME_INI_FILE ); + WritePrivateProfileString( "Ja2 Settings", "CD", zCdLocation, GAME_INI_FILE ); - GetPrivateProfileString( "Ja2 Settings","CD", "", zCdLocation, SGPFILENAME_LEN, GAME_INI_FILE ); + GetPrivateProfileString( "Ja2 Settings","CD", "", zCdLocation, SGPFILENAME_LEN, GAME_INI_FILE ); } uiStrngLength = strlen( zCdLocation ); @@ -892,7 +907,6 @@ BOOLEAN CheckIfGameCdromIsInCDromDrive() CHAR8 zCdFile[ SGPFILENAME_LEN ]; CHAR8 zCdromRootDrive[512]; - //BOOLEAN fFailed = FALSE; UINT32 uiVolumeReturnValue; UINT32 uiLastError = ERROR_SUCCESS; @@ -903,7 +917,7 @@ BOOLEAN CheckIfGameCdromIsInCDromDrive() if( !uiVolumeReturnValue ) { - uiLastError = GetLastError(); + uiLastError = GetLastError(); } // OK, build filename @@ -917,7 +931,7 @@ BOOLEAN CheckIfGameCdromIsInCDromDrive() //if a game has been started, add the msg about saving the game to a different entry if( gTacticalStatus.fHasAGameBeenStarted ) { - sprintf( sString, "%S %S", pMessageStrings[ MSG_INTEGRITY_WARNING ], pMessageStrings[ MSG_CDROM_SAVE_GAME ] ); + sprintf( sString, "%S %S", pMessageStrings[ MSG_INTEGRITY_WARNING ], pMessageStrings[ MSG_CDROM_SAVE_GAME ] ); SaveGame( SAVE__ERROR_NUM, pMessageStrings[ MSG_CDROM_SAVE ] ); } @@ -926,20 +940,20 @@ BOOLEAN CheckIfGameCdromIsInCDromDrive() sprintf( sString, "%S", pMessageStrings[ MSG_INTEGRITY_WARNING ] ); } - // ATE: These are ness. due to reference counting - // in showcursor(). I'm not about to go digging in low level stuff at this - // point in the game development, so keep these here, as this works... -// ShowCursor(TRUE); -// ShowCursor(TRUE); - ShutdownWithErrorBox( sString ); + // ATE: These are ness. due to reference counting + // in showcursor(). I'm not about to go digging in low level stuff at this + // point in the game development, so keep these here, as this works... +// ShowCursor(TRUE); +// ShowCursor(TRUE); + ShutdownWithErrorBox( sString ); - //DoTester( ); - //MessageBox(NULL, sString, "Error", MB_OK | MB_ICONERROR ); + //DoTester( ); + //MessageBox(NULL, sString, "Error", MB_OK | MB_ICONERROR ); return( FALSE ); } - return( TRUE ); + return( TRUE ); } @@ -1102,8 +1116,8 @@ BOOLEAN CanGameBeSaved() } //if there are enemies in the current sector - if( gWorldSectorX != -1 && gWorldSectorY != -1 && - gWorldSectorX != 0 && gWorldSectorY != 0 && + if( gWorldSectorX != -1 && gWorldSectorY != -1 && + gWorldSectorX != 0 && gWorldSectorY != 0 && NumEnemiesInAnySector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ) > 0 ) { //no save for you diff --git a/GameSettings.h b/GameSettings.h index 0aca4c4c..e720cc74 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -93,6 +93,12 @@ typedef struct } GAME_SETTINGS; +// CHRISL: New Enums to track inventory system +enum +{ + INVENTORY_OLD = 0, + INVENTORY_NEW = 1 +}; //Enums for the difficulty levels @@ -131,10 +137,13 @@ typedef struct BOOLEAN fTurnTimeLimit; BOOLEAN fIronManMode; UINT8 ubBobbyRay; - UINT8 ubFiller[7]; + UINT8 ubInventorySystem; + UINT8 ubFiller[6]; } GAME_OPTIONS; +bool UsingNewInventorySystem(); + // Snap: Options read from an INI file in the default of custom Data directory typedef struct { @@ -254,7 +263,7 @@ typedef struct //Sight range - UINT32 ubStraightSightRange; + UINT32 ubStraightSightRange; UINT32 ubVisDistDecreasePerRainIntensity; BOOLEAN gfAllowLimitedVision; @@ -413,6 +422,9 @@ typedef struct BOOLEAN fEnableSoldierTooltipBigSlot2; BOOLEAN fEnableSoldierTooltipBigSlot3; BOOLEAN fEnableSoldierTooltipBigSlot4; + BOOLEAN fEnableSoldierTooltipBigSlot5; + BOOLEAN fEnableSoldierTooltipBigSlot6; + BOOLEAN fEnableSoldierTooltipBigSlot7; // ShadoWarrior: Tooltip changes (end) //Kaiden MERC Deaths Externalized: @@ -425,9 +437,17 @@ typedef struct // Lesh: slow enemy items choice progress BOOLEAN fSlowProgressForEnemyItemsChoice; + // CHRISL: option to allow Slay to remain as a hired PC + BOOLEAN fEnableSlayForever; + + // CHRISL: New setting to determine the AP cost to reload 1 loose round of ammo + INT32 ubAPCostPerRound; + + // CHRISL: New setting to determine AP multiplier when reloading with wrong sized clip + FLOAT ubWrongMagMult; } GAME_EXTERNAL_OPTIONS; -//This structure will contain general Ja2 settings NOT individual game settings. +//This structure will contain general Ja2 settings NOT individual game settings. extern GAME_SETTINGS gGameSettings; //This structure will contain the Game options set at the beginning of the game. diff --git a/GameVersion.cpp b/GameVersion.cpp index e4dcf7f3..a6cf1028 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -5,15 +5,20 @@ #include "GameVersion.h" #endif - + // // Keeps track of the game version // -#ifdef JA2BETAVERSION +#ifdef JA2EDITOR + +//MAP EDITOR BUILD VERSION +CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.1855.NI.B11.1" }; + +#elif defined JA2BETAVERSION //BETA/TEST BUILD VERSION -CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.1202" }; +CHAR16 zVersionLabel[256] = { L"Debug v1.13.1855.NI.B11.1" }; #elif defined CRIPPLED_VERSION @@ -22,20 +27,14 @@ CHAR16 zVersionLabel[256] = { L"Beta v. 0.98" }; #else - //RELEASE BUILD VERSION - CHAR16 zVersionLabel[256] = { L"Release v1.13.1797" }; - + //RELEASE BUILD VERSION + CHAR16 zVersionLabel[256] = { L"Release v1.13.1855.NI.B11.1" }; #endif -CHAR8 czVersionNumber[16] = { "Build 08.02.24" }; //YY.MM.DD +//CHAR8 czVersionNumber[16] = { "Build 08.02.24" }; //YY.MM.DD +CHAR8 czVersionNumber[16] = { "Beta 08.03.03" }; //YY.MM.DD CHAR16 zTrackingNumber[16] = { L"Z" }; -// -// Keeps track of the saved game version. Increment the saved game version whenever -// you will invalidate the saved game file - -#define SAVE_GAME_VERSION 101 //100 // 99 - -const UINT32 guiSavedGameVersion = SAVE_GAME_VERSION; +// SAVE_GAME_VERSION is defined in header, change it there diff --git a/GameVersion.h b/GameVersion.h index 8b2b9508..02e50db1 100644 --- a/GameVersion.h +++ b/GameVersion.h @@ -16,16 +16,20 @@ extern CHAR8 czVersionNumber[16]; extern CHAR16 zTrackingNumber[16]; +//ADB: I needed these here so I moved them, and why put them in *.cpp anyways? +// +// Keeps track of the saved game version. Increment the saved game version whenever +// you will invalidate the saved game file +#define SAVE_GAME_VERSION 103 //102 //101 //100 // 99 + + +//these I don't so much need here +#define CURRENT_SAVEGAME_DATATYPE_VERSION 103 +#define FIRST_SAVEGAME_DATATYPE_CHANGE 102 +//#define SECOND_SAVEGAME_DATATYPE_CHANGE 999, #define CURRENT_SAVEGAME_DATATYPE_VERSION 999 + //#define RUSSIANGOLD - -// -// Keeps track of the saved game version. Increment the saved game version whenever -// you will invalidate the saved game file -// - -const extern UINT32 guiSavedGameVersion; - #ifdef __cplusplus } #endif diff --git a/German.vsprops b/German.vsprops index dd3a2b9f..4d4c9b9d 100644 --- a/German.vsprops +++ b/German.vsprops @@ -1,7 +1,7 @@ - - + gHelpScreen.bNumberOfButtons ) ? gHelpScreen.bNumberOfButtons-1 : bRetValue; + gHelpScreen.bCurrentHelpScreenActiveSubPage = ( bRetValue > gHelpScreen.bNumberOfButtons ) ? gHelpScreen.bNumberOfButtons-1 : bRetValue; gHelpScreen.ubHelpScreenDirty = HLP_SCRN_DRTY_LVL_REFRESH_TEXT; @@ -1410,7 +1410,7 @@ void BtnHelpScreenBtnsCallback(GUI_BUTTON *btn,INT32 reason) // btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void ChangeToHelpScreenSubPage( INT8 bNewPage ) { @@ -1480,9 +1480,9 @@ UINT16 GetAndDisplayHelpScreenText( UINT32 uiRecord, UINT16 usPosX, UINT16 usPos LoadEncryptedDataFromFile(HELPSCREEN_FILE, zText, uiStartLoc, HELPSCREEN_RECORD_SIZE ); //Display the text - usNumVertPixels = IanDisplayWrappedString( usPosX, usPosY, usWidth, HELP_SCREEN_GAP_BTN_LINES, - HELP_SCREEN_TEXT_BODY_FONT, HELP_SCREEN_TEXT_BODY_COLOR, zText, - HELP_SCREEN_TEXT_BACKGROUND, FALSE, 0 ); + usNumVertPixels = IanDisplayWrappedString( usPosX, usPosY, usWidth, HELP_SCREEN_GAP_BTN_LINES, + HELP_SCREEN_TEXT_BODY_FONT, HELP_SCREEN_TEXT_BODY_COLOR, zText, + HELP_SCREEN_TEXT_BACKGROUND, FALSE, 0 ); SetFontShadow( DEFAULT_SHADOW ); @@ -1569,7 +1569,7 @@ void BtnHelpScreenExitCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} UINT16 RenderLaptopHelpScreen() @@ -2083,7 +2083,7 @@ void RefreshAllHelpScreenButtons() } ButtonList[ guiHelpScreenExitBtn ]->uiFlags |= BUTTON_DIRTY; - + if( !gHelpScreen.fForceHelpScreenToComeUp ) { ButtonList[ gHelpScreenDontShowHelpAgainToggle ]->uiFlags |= BUTTON_DIRTY; @@ -2176,12 +2176,12 @@ void ChangeHelpScreenSubPage() //enable or disable the help screen arrow buttons if( gHelpScreen.usTotalNumberOfLinesInBuffer <= HLP_SCRN__MAX_NUMBER_DISPLAYED_LINES_IN_BUFFER ) - { + { DisableButton( giHelpScreenScrollArrows[0] ); DisableButton( giHelpScreenScrollArrows[1] ); } else - { + { EnableButton( giHelpScreenScrollArrows[0] ); EnableButton( giHelpScreenScrollArrows[1] ); } @@ -2189,8 +2189,8 @@ void ChangeHelpScreenSubPage() void ClearHelpScreenTextBuffer() { - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; // CLEAR THE FRAME BUFFER pDestBuf = LockVideoSurface( guiHelpScreenTextBufferSurface, &uiDestPitchBYTES ); @@ -2259,8 +2259,8 @@ void DisplayHelpScreenTextBufferScrollBox() { INT32 iSizeOfBox; INT32 iTopPosScrollBox=0; - UINT8 *pDestBuf; - UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; + UINT32 uiDestPitchBYTES; UINT16 usPosX; if( gHelpScreen.bNumberOfButtons != 0 ) @@ -2282,13 +2282,13 @@ void DisplayHelpScreenTextBufferScrollBox() // next draw the box // - //if there ARE scroll bars, draw the + //if there ARE scroll bars, draw the if( !( gHelpScreen.usTotalNumberOfLinesInBuffer <= HLP_SCRN__MAX_NUMBER_DISPLAYED_LINES_IN_BUFFER ) ) { ColorFillVideoSurfaceArea( FRAME_BUFFER, usPosX, iTopPosScrollBox, usPosX+HLP_SCRN__WIDTH_OF_SCROLL_AREA, iTopPosScrollBox+iSizeOfBox-1, Get16BPPColor( FROMRGB( 227, 198, 88 ) ) ); //display the line - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); // draw the gold highlite line on the top and left @@ -2298,7 +2298,7 @@ void DisplayHelpScreenTextBufferScrollBox() // draw the shadow line on the bottom and right LineDraw(FALSE, usPosX, iTopPosScrollBox+iSizeOfBox-1, usPosX+HLP_SCRN__WIDTH_OF_SCROLL_AREA, iTopPosScrollBox+iSizeOfBox-1, Get16BPPColor( FROMRGB( 65, 49, 6 ) ), pDestBuf); LineDraw(FALSE, usPosX+HLP_SCRN__WIDTH_OF_SCROLL_AREA, iTopPosScrollBox, usPosX+HLP_SCRN__WIDTH_OF_SCROLL_AREA, iTopPosScrollBox+iSizeOfBox-1, Get16BPPColor( FROMRGB( 65, 49, 6 ) ), pDestBuf); - + // unlock frame buffer UnLockVideoSurface( FRAME_BUFFER ); } @@ -2326,8 +2326,8 @@ void CreateScrollAreaButtons() //Create a mouse region 'mask' the entrire screen MSYS_DefineRegion( &gHelpScreenScrollArea, usPosX, (UINT16)iPosY, (UINT16)(usPosX+usWidth), (UINT16)(iPosY+HLP_SCRN__HEIGHT_OF_SCROLL_AREA), MSYS_PRIORITY_HIGHEST, - gHelpScreen.usCursor, SelectHelpScrollAreaMovementCallBack, SelectHelpScrollAreaCallBack ); - MSYS_AddRegion( &gHelpScreenScrollArea ); + gHelpScreen.usCursor, SelectHelpScrollAreaMovementCallBack, SelectHelpScrollAreaCallBack ); + MSYS_AddRegion( &gHelpScreenScrollArea ); guiHelpScreenScrollArrowImage[ 0 ] = LoadButtonImage( "INTERFACE\\HelpScreen.sti", 14,10, 11, 12 ,13 ); guiHelpScreenScrollArrowImage[ 1 ] = UseLoadedButtonImage( guiHelpScreenScrollArrowImage[ 0 ] ,19,15,16,17,18 ); @@ -2344,7 +2344,7 @@ void CreateScrollAreaButtons() BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, DEFAULT_MOVE_CALLBACK, BtnHelpScreenScrollArrowsCallback ); MSYS_SetBtnUserData( giHelpScreenScrollArrows[0],0,0); - SetButtonCursor( giHelpScreenScrollArrows[0], gHelpScreen.usCursor ); + SetButtonCursor( giHelpScreenScrollArrows[0], gHelpScreen.usCursor ); usPosY = gHelpScreen.usScreenLocY + HLP_SCRN__SCROLL_DWN_ARROW_Y; @@ -2353,7 +2353,7 @@ void CreateScrollAreaButtons() BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, DEFAULT_MOVE_CALLBACK, BtnHelpScreenScrollArrowsCallback ); MSYS_SetBtnUserData( giHelpScreenScrollArrows[1],0,1); - SetButtonCursor( giHelpScreenScrollArrows[1], gHelpScreen.usCursor ); + SetButtonCursor( giHelpScreenScrollArrows[1], gHelpScreen.usCursor ); } @@ -2408,7 +2408,7 @@ void CalculateHeightAndPositionForHelpScreenScrollBox( INT32 *piHeightOfScrollBo void SelectHelpScrollAreaCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -2416,15 +2416,15 @@ void SelectHelpScrollAreaCallBack(MOUSE_REGION * pRegion, INT32 iReason ) { gfScrollBoxIsScrolling = FALSE; gHelpScreen.iLastMouseClickY = -1; - } + } else if( iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { gfScrollBoxIsScrolling = TRUE; HelpScreenMouseMoveScrollBox( pRegion->MouseYPos ); - } + } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } @@ -2444,7 +2444,7 @@ void SelectHelpScrollAreaMovementCallBack(MOUSE_REGION * pRegion, INT32 iReason HelpScreenMouseMoveScrollBox( pRegion->MouseYPos ); } } -} +} void HelpScreenMouseMoveScrollBox( INT32 usMousePosY ) { diff --git a/HelpScreen.h b/HelpScreen.h index a575fd6d..3d22c3e9 100644 --- a/HelpScreen.h +++ b/HelpScreen.h @@ -36,7 +36,7 @@ typedef struct INT32 iLastMouseClickY; //last position the mouse was clicked ( if != -1 ) - INT8 bCurrentHelpScreenActiveSubPage; //used to keep track of the current page being displayed + INT8 bCurrentHelpScreenActiveSubPage; //used to keep track of the current page being displayed INT8 bNumberOfButtons; diff --git a/Init.cpp b/Init.cpp index a31f3935..ed80e52a 100644 --- a/Init.cpp +++ b/Init.cpp @@ -3,7 +3,7 @@ #include "HelpScreen.h" #include "Multilingual Text Code Generator.h" #include "INIReader.h" - + #else #include "builddefines.h" #include @@ -48,7 +48,7 @@ #include "laptop.h" #include "Shade Table Util.h" #include "Exit Grids.h" - #include "Summary Info.h" + #include "Summary Info.h" #include "GameSettings.h" #include "Game Init.h" #include "Init.h" @@ -62,11 +62,18 @@ #include "editscreen.h" #endif +#include "Sector Summary.h" extern BOOLEAN GetCDromDriveLetter( STR8 pString ); // The InitializeGame function is responsible for setting up all data and Gaming Engine // tasks which will run the game +#ifdef JA2EDITOR +#define BUILD_AS_EDITOR_ONLY +#else +#undef BUILD_AS_EDITOR_ONLY +#endif + #ifdef JA2BETAVERSION extern BOOLEAN gfUseConsecutiveQuickSaveSlots; #endif @@ -88,6 +95,7 @@ extern BOOLEAN gfUseConsecutiveQuickSaveSlots; extern HINSTANCE ghInstance; +extern OBJECTTYPE GLOCK_17_ForUseWithLOS; // Prepends the language prefix to the file name in a proposed path. static void AddLanguagePrefix(STR fileName, const STR language) @@ -145,7 +153,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) if(!ReadInEnemyArmourDropsStats(gEnemyArmourDrops, fileName)) return FALSE; // WANNE: Enemy drops - end - + // WANNE: Sector Loadscreens [2007-05-18] strcpy(fileName, directoryName); strcat(fileName, SECTORLOADSCREENSFILENAME); @@ -184,13 +192,13 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) return FALSE; - // Lesh: added this, begin + // Lesh: added this, begin strcpy(fileName, directoryName); strcat(fileName, BURSTSOUNDSFILENAME); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); if(!ReadInBurstSoundArray(fileName)) return FALSE; - // Lesh: end + // Lesh: end strcpy(fileName, directoryName); strcat(fileName, ITEMSFILENAME); @@ -202,12 +210,12 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) // The idea here is that we can have a separate xml file that's named differently // but only contains the relevant tags that need to be localized // then when the file is read in using the same xml reader code, it will only overwrite -// the tags that are contained in the localized file. This only works for items.xml +// the tags that are contained in the localized file. This only works for items.xml // since I tweaked the xml_items.cpp to make it work :p // So for instance, the german file would be called German.Items.xml and would only contain // the uiIndex (for reference), szItemName, szLongItemName, szItemDesc, szBRName, and szBRDesc tags - -#ifdef GERMAN + +#ifdef GERMAN strcpy(fileName, directoryName); strcat(fileName, GERMAN_PREFIX); strcat(fileName, ITEMSFILENAME); @@ -218,7 +226,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) return FALSE; } #endif -#ifdef RUSSIAN +#ifdef RUSSIAN strcpy(fileName, directoryName); strcat(fileName, RUSSIAN_PREFIX); strcat(fileName, ITEMSFILENAME); @@ -257,7 +265,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) strcat(fileName, LAUNCHABLESFILENAME); if(!ReadInLaunchableStats(fileName)) return FALSE; - + strcpy(fileName, directoryName); strcat(fileName, COMPATIBLEFACEITEMSFILENAME); if(!ReadInCompatibleFaceItemStats(fileName)) @@ -280,12 +288,56 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) strcat(fileName, EXPLOSIVESFILENAME); if(!ReadInExplosiveStats(fileName)) return FALSE; - + strcpy(fileName, directoryName); strcat(fileName, ARMOURSFILENAME); if(!ReadInArmourStats(fileName)) return FALSE; + // CHRISL: + strcpy(fileName, directoryName); + strcat(fileName, LOADBEARINGEQUIPMENTFILENAME); + if(!ReadInlbeStats(fileName)) + return FALSE; + + // CHRISL: + strcpy(fileName, directoryName); + strcat(fileName, LBEPOCKETFILENAME); + if(!ReadInLBEPocketStats(fileName,FALSE)) + return FALSE; + +//CHRISL: Simple localization +// Same setup as what Madd used for items.xml + +#ifdef GERMAN + strcpy(fileName, directoryName); + strcat(fileName, GERMAN_PREFIX); + strcat(fileName, LBEPOCKETFILENAME); + if ( FileExists(fileName) ) + { + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + if(!ReadInLBEPocketStats(fileName,TRUE)) + return FALSE; + } +#endif +#ifdef RUSSIAN + strcpy(fileName, directoryName); + strcat(fileName, RUSSIAN_PREFIX); + strcat(fileName, LBEPOCKETFILENAME); + if ( FileExists(fileName) ) + { + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + if(!ReadInLBEPocketStats(fileName,TRUE)) + return FALSE; + } +#endif + + // CHRISL: + strcpy(fileName, directoryName); + strcat(fileName, MERCSTARTINGGEARFILENAME); + if(!ReadInMercStartingGearStats(fileName)) + return FALSE; + strcpy(fileName, directoryName); strcat(fileName, WEAPONSFILENAME); if(!ReadInWeaponStats(fileName)) @@ -393,7 +445,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) strcat(fileName, CITYTABLEFILENAME); if(!ReadInMapStructure(fileName)) return FALSE; - + #ifdef RUSSIAN AddLanguagePrefix( fileName, RUSSIAN_PREFIX); if ( FileExists(fileName) ) @@ -405,8 +457,8 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) #endif // Lesh: Strategic movement costs will be read in Strategic\Strategic Movement Costs.cpp, - // function BOOLEAN InitStrategicMovementCosts(); - // It is called several times from various places and acts after clearing SectorInfo array + // function BOOLEAN InitStrategicMovementCosts(); + // It is called several times from various places and acts after clearing SectorInfo array // Lesh: load altsectors list strcpy(fileName, directoryName); @@ -419,7 +471,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) strcat(fileName, SAMSITESFILENAME); if ( !ReadInSAMInfo(fileName) ) return FALSE; - + // Lesh: army externalization strcpy(fileName, directoryName); strcat(fileName, GARRISONFILENAME); @@ -438,14 +490,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) strcpy(fileName, directoryName); strcat(fileName, EXPLOSIONDATAFILENAME); - if(!ReadInExplosionDataStats(fileName)) + if(!ReadInExplosionDataStats(fileName)) return FALSE; // Kaiden: Read in Restricted Sectors for Mobile Militia strcpy(fileName, directoryName); strcat(fileName, ROAMINGMILITIAFILENAME); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); - if(!ReadInRoamingInfo(fileName)) + if(!ReadInRoamingInfo(fileName)) return FALSE; return TRUE; @@ -453,13 +505,13 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) UINT32 InitializeJA2(void) -{ +{ #ifdef LASERLOCK_ENABLED HandleLaserLockResult( PrepareLaserLockSystem() ); #endif - HandleJA2CDCheck( ); + HandleJA2CDCheck( ); gfWorldLoaded = FALSE; @@ -468,7 +520,7 @@ UINT32 InitializeJA2(void) { return( ERROR_SCREEN ); } - + // Load external text LoadAllExternalText(); @@ -477,7 +529,7 @@ UINT32 InitializeJA2(void) gsRenderCenterX = 805; gsRenderCenterY = 805; - + // Init data InitializeSystemVideoObjects( ); @@ -498,7 +550,7 @@ UINT32 InitializeJA2(void) { return( ERROR_SCREEN ); } - + //needs to be called here to init the SectorInfo struct if ( !InitStrategicMovementCosts( ) ) { @@ -520,7 +572,7 @@ UINT32 InitializeJA2(void) // INit intensity tables BuildIntensityTable( ); - + // Init Event Manager if ( !InitializeEventManager( ) ) { @@ -548,6 +600,11 @@ UINT32 InitializeJA2(void) return( ERROR_SCREEN ); } + //ADB When a merc calcs CTGT for a thrown item he uses a GLOCK temp item + //but we don't want to recreate it every single time CTGT is called, so init the GLOCK here + CreateItem(GLOCK_17, 100, &GLOCK_17_ForUseWithLOS); + + #ifdef JA2BETAVERSION #ifdef JA2EDITOR @@ -559,7 +616,7 @@ UINT32 InitializeJA2(void) } #endif #endif - + #ifdef JA2BETAVERSION if( ProcessIfMultilingualCmdLineArgDetected( gzCommandLine ) ) { //If the multilingual text code generator has activated, quit now. @@ -595,7 +652,7 @@ UINT32 InitializeJA2(void) //also set the sector gWorldSectorX = 0; gWorldSectorY = 0; - gfAutoLoadA9 = TRUE; + gfAutoLoadA9 = FALSE; gfIntendOnEnteringEditor = TRUE; gGameOptions.fGunNut = TRUE; gGameOptions.fAirStrikes = FALSE; @@ -615,6 +672,23 @@ UINT32 InitializeJA2(void) gGameOptions.fAirStrikes = FALSE; return( GAME_SCREEN ); } + + #ifdef BUILD_AS_EDITOR_ONLY + //ADB We are building with JA2EDITOR, why force a commandline arguement??? + //build once, rename, change the define and build again + //no pesky shortcuts + OutputDebugString( "Beginning JA2EDITOR without using a commandline argument...\n" ); + //For editor purposes, need to know the default map file. + sprintf( gubFilename, "none"); + //also set the sector + gWorldSectorX = 0; + gWorldSectorY = 0; + gfAutoLoadA9 = TRUE; + gfIntendOnEnteringEditor = TRUE; + gGameOptions.fGunNut = TRUE; + gGameOptions.fAirStrikes = FALSE; + return( GAME_SCREEN ); + #endif #endif #endif @@ -623,8 +697,8 @@ UINT32 InitializeJA2(void) void ShutdownJA2(void) -{ - UINT32 uiIndex; +{ + UINT32 uiIndex; // Clear screen.... ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); @@ -633,7 +707,7 @@ void ShutdownJA2(void) SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); RefreshScreen( NULL ); - + ShutdownStrategicLayer(); // remove temp files built by laptop @@ -642,11 +716,11 @@ void ShutdownJA2(void) // Shutdown queue system ShutdownDialogueControl(); - // Shutdown Screens - for (uiIndex = 0; uiIndex < MAX_SCREENS; uiIndex++) - { - (*(GameScreens[uiIndex].ShutdownScreen))(); - } + // Shutdown Screens + for (uiIndex = 0; uiIndex < MAX_SCREENS; uiIndex++) + { + (*(GameScreens[uiIndex].ShutdownScreen))(); + } // Shutdown animation system @@ -723,7 +797,7 @@ BOOLEAN PrepareLaserLockSystem() iCheckRetVal = LASERLOK_Check(); if( iCheckRetVal != 0 ) goto FAILED_LASERLOK; - + //Restore back to the proper directory SetFileManCurrentDirectory( zDirectory ); return( TRUE ); @@ -742,8 +816,8 @@ void HandleLaserLockResult( BOOLEAN fSuccess ) sprintf( zString, "%S", gzLateLocalizedString[56] ); -// ShowCursor(TRUE); -// ShowCursor(TRUE); +// ShowCursor(TRUE); +// ShowCursor(TRUE); ShutdownWithErrorBox( zString ); } } diff --git a/Intro.cpp b/Intro.cpp index a71f6e16..f837c2af 100644 --- a/Intro.cpp +++ b/Intro.cpp @@ -83,7 +83,7 @@ enum INT32 giCurrentIntroBeingPlayed = SMKINTRO_NO_VIDEO; -CHAR *gpzSmackerFileNames[] = +CHAR *gpzSmackerFileNames[] = { //begining of the game "INTRO\\Rebel_cr.smk", @@ -225,7 +225,7 @@ BOOLEAN EnterIntroScreen() { PrepareToExitIntroScreen(); } - + return( TRUE ); } @@ -279,34 +279,34 @@ void HandleIntroScreen() void GetIntroScreenUserInput() { InputAtom Event; - POINT MousePos; + POINT MousePos; GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! + ScreenToClient(ghWindow, &MousePos); // In window coords! while( DequeueEvent( &Event ) ) { // HOOK INTO MOUSE HOOKS switch( Event.usEvent) - { + { case LEFT_BUTTON_DOWN: MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; case LEFT_BUTTON_UP: - MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); + MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); break; case RIGHT_BUTTON_DOWN: MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - case RIGHT_BUTTON_UP: - MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + case RIGHT_BUTTON_UP: + MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - case RIGHT_BUTTON_REPEAT: - MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + case RIGHT_BUTTON_REPEAT: + MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - case LEFT_BUTTON_REPEAT: - MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + case LEFT_BUTTON_REPEAT: + MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; } @@ -499,12 +499,12 @@ void SetIntroType( INT8 bIntroType ) void DisplaySirtechSplashScreen() { - HVOBJECT hPixHandle; - VOBJECT_DESC VObjectDesc; + HVOBJECT hPixHandle; + VOBJECT_DESC VObjectDesc; UINT32 uiLogoID; - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; // CLEAR THE FRAME BUFFER @@ -519,23 +519,23 @@ void DisplaySirtechSplashScreen() // FilenameForBPP("INTERFACE\\TShold.sti", VObjectDesc.ImageFile); if( !AddVideoObject(&VObjectDesc, &uiLogoID) ) - { - FilenameForBPP("GERMAN\\SPLASH_GERMAN.sti", VObjectDesc.ImageFile); - if( !AddVideoObject(&VObjectDesc, &uiLogoID) ) - { - /* - * This is the place, where most non english coders stranding. - * Don't hesitate, don't give up! - * I'll now tell You what You made wrong - * (2006-10-10, Sergeant_Kolja) - */ - #ifdef _DEBUG - # if defined(ENGLISH) - AssertMsg( 0, String( "Wheter English nor German works. May be You built English - but have only German or other foreign Disk?" ) ); - # elif defined(GERMAN) - AssertMsg( 0, String( "Weder Englisch noch Deutsch geht. Deutsche Version kompiliert und mit englischer CDs gestartet? Das geht nicht!" ) ); - # endif - #endif + { + FilenameForBPP("GERMAN\\SPLASH_GERMAN.sti", VObjectDesc.ImageFile); + if( !AddVideoObject(&VObjectDesc, &uiLogoID) ) + { + /* + * This is the place, where most non english coders stranding. + * Don't hesitate, don't give up! + * I'll now tell You what You made wrong + * (2006-10-10, Sergeant_Kolja) + */ + #ifdef _DEBUG + # if defined(ENGLISH) + AssertMsg( 0, String( "Wheter English nor German works. May be You built English - but have only German or other foreign Disk?" ) ); + # elif defined(GERMAN) + AssertMsg( 0, String( "Weder Englisch noch Deutsch geht. Deutsche Version kompiliert und mit englischer CDs gestartet? Das geht nicht!" ) ); + # endif + #endif AssertMsg( 0, String( "Failed to load %s", VObjectDesc.ImageFile ) ); return; } @@ -548,4 +548,4 @@ void DisplaySirtechSplashScreen() InvalidateScreen(); RefreshScreen( NULL ); -} \ No newline at end of file +} diff --git a/JA2 Splash.cpp b/JA2 Splash.cpp index 7cea4388..36ffc672 100644 --- a/JA2 Splash.cpp +++ b/JA2 Splash.cpp @@ -22,7 +22,7 @@ void InitJA2SplashScreen() #else UINT32 uiLogoID = 0; - HVSURFACE hVSurface; // unused jonathanl // lalien reenabled for international versions + HVSURFACE hVSurface; // unused jonathanl // lalien reenabled for international versions VSURFACE_DESC VSurfaceDesc; //unused jonathanl // lalien reenabled for international versions #ifdef JA2TESTVERSION INT32 i = 0; @@ -31,7 +31,7 @@ void InitJA2SplashScreen() VSurfaceDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; sprintf( VSurfaceDesc.ImageFile, "LOADSCREENS\\Notification.sti" ); if( !AddVideoSurface( &VSurfaceDesc, &uiLogoID ) ) - { + { //AssertMsg( 0, String( "Failed to load %s", VSurfaceDesc.ImageFile ) ); return; } @@ -52,12 +52,12 @@ void InitJA2SplashScreen() i++; } #endif - + memset( &VSurfaceDesc, 0, sizeof( VSURFACE_DESC ) ); VSurfaceDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; GetMLGFilename( VSurfaceDesc.ImageFile, MLG_SPLASH ); if( !AddVideoSurface( &VSurfaceDesc, &uiLogoID ) ) - { + { AssertMsg( 0, String( "Failed to load %s", VSurfaceDesc.ImageFile ) ); return; } diff --git a/JA2.mak b/JA2.mak deleted file mode 100644 index 32a51693..00000000 --- a/JA2.mak +++ /dev/null @@ -1,2273 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on JA2.dsp -!IF "$(CFG)" == "" -CFG=ja2 - Win32 Demo Bounds Checker -!MESSAGE No configuration specified. Defaulting to ja2 - Win32 Demo Bounds Checker. -!ENDIF - -!IF "$(CFG)" != "ja2 - Win32 Release" && "$(CFG)" != "ja2 - Win32 Debug" && "$(CFG)" != "ja2 - Win32 Release with Debug Info" && "$(CFG)" != "ja2 - Win32 Bounds Checker" && "$(CFG)" != "ja2 - Win32 Debug Demo" && "$(CFG)" != "ja2 - Win32 Release Demo" && "$(CFG)" != "ja2 - Win32 Demo Release with Debug Info" && "$(CFG)" != "ja2 - Win32 Demo Bounds Checker" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "JA2.mak" CFG="ja2 - Win32 Demo Bounds Checker" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ja2 - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "ja2 - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE "ja2 - Win32 Release with Debug Info" (based on "Win32 (x86) Application") -!MESSAGE "ja2 - Win32 Bounds Checker" (based on "Win32 (x86) Application") -!MESSAGE "ja2 - Win32 Debug Demo" (based on "Win32 (x86) Application") -!MESSAGE "ja2 - Win32 Release Demo" (based on "Win32 (x86) Application") -!MESSAGE "ja2 - Win32 Demo Release with Debug Info" (based on "Win32 (x86) Application") -!MESSAGE "ja2 - Win32 Demo Bounds Checker" (based on "Win32 (x86) Application") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ja2 - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "..\ja2_cvs.exe" "$(OUTDIR)\JA2.bsc" - -!ELSE - -ALL : "Strategic - Win32 Release" "Laptop - Win32 Release" "Editor - Win32 Release" "TacticalAI - Win32 Release" "Utils - Win32 Release" "Tactical - Win32 Release" "Standard Gaming Platform - Win32 Release" "TileEngine - Win32 Release" "..\ja2_cvs.exe" "$(OUTDIR)\JA2.bsc" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"TileEngine - Win32 ReleaseCLEAN" "Standard Gaming Platform - Win32 ReleaseCLEAN" "Tactical - Win32 ReleaseCLEAN" "Utils - Win32 ReleaseCLEAN" "TacticalAI - Win32 ReleaseCLEAN" "Editor - Win32 ReleaseCLEAN" "Laptop - Win32 ReleaseCLEAN" "Strategic - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\_Ja25GermanText.obj" - -@erase "$(INTDIR)\_Ja25GermanText.sbr" - -@erase "$(INTDIR)\aniviewscreen.obj" - -@erase "$(INTDIR)\aniviewscreen.sbr" - -@erase "$(INTDIR)\Credits.obj" - -@erase "$(INTDIR)\Credits.sbr" - -@erase "$(INTDIR)\Cursors.obj" - -@erase "$(INTDIR)\Cursors.sbr" - -@erase "$(INTDIR)\Fade Screen.obj" - -@erase "$(INTDIR)\Fade Screen.sbr" - -@erase "$(INTDIR)\GameInitOptionsScreen.obj" - -@erase "$(INTDIR)\GameInitOptionsScreen.sbr" - -@erase "$(INTDIR)\gameloop.obj" - -@erase "$(INTDIR)\gameloop.sbr" - -@erase "$(INTDIR)\gamescreen.obj" - -@erase "$(INTDIR)\gamescreen.sbr" - -@erase "$(INTDIR)\GameSettings.obj" - -@erase "$(INTDIR)\GameSettings.sbr" - -@erase "$(INTDIR)\GameVersion.obj" - -@erase "$(INTDIR)\GameVersion.sbr" - -@erase "$(INTDIR)\HelpScreen.obj" - -@erase "$(INTDIR)\HelpScreen.sbr" - -@erase "$(INTDIR)\Init.obj" - -@erase "$(INTDIR)\Init.sbr" - -@erase "$(INTDIR)\Intro.obj" - -@erase "$(INTDIR)\Intro.sbr" - -@erase "$(INTDIR)\JA2 Splash.obj" - -@erase "$(INTDIR)\JA2 Splash.sbr" - -@erase "$(INTDIR)\ja2.res" - -@erase "$(INTDIR)\jascreens.obj" - -@erase "$(INTDIR)\jascreens.sbr" - -@erase "$(INTDIR)\Loading Screen.obj" - -@erase "$(INTDIR)\Loading Screen.sbr" - -@erase "$(INTDIR)\MainMenuScreen.obj" - -@erase "$(INTDIR)\MainMenuScreen.sbr" - -@erase "$(INTDIR)\MessageBoxScreen.obj" - -@erase "$(INTDIR)\MessageBoxScreen.sbr" - -@erase "$(INTDIR)\Options Screen.obj" - -@erase "$(INTDIR)\Options Screen.sbr" - -@erase "$(INTDIR)\SaveLoadGame.obj" - -@erase "$(INTDIR)\SaveLoadGame.sbr" - -@erase "$(INTDIR)\SaveLoadScreen.obj" - -@erase "$(INTDIR)\SaveLoadScreen.sbr" - -@erase "$(INTDIR)\SCREENS.obj" - -@erase "$(INTDIR)\SCREENS.sbr" - -@erase "$(INTDIR)\Sys Globals.obj" - -@erase "$(INTDIR)\Sys Globals.sbr" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\JA2.bsc" - -@erase "$(OUTDIR)\ja2_cvs.map" - -@erase "..\ja2_cvs.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP_PROJ=/nologo /G5 /MT /W3 /GX /Zi /O2 /Ob2 /I ".\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Editor" /I ".\Strategic" /I ".\laptop" /I ".\\" /D "CALLBACKTIMER" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\JA2.pch" /YX"JA2 All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /O2b2 /c -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ja2.res" /d "NDEBUG" -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\JA2.bsc" -BSC32_SBRS= \ - "$(INTDIR)\_Ja25GermanText.sbr" \ - "$(INTDIR)\aniviewscreen.sbr" \ - "$(INTDIR)\Credits.sbr" \ - "$(INTDIR)\Cursors.sbr" \ - "$(INTDIR)\Fade Screen.sbr" \ - "$(INTDIR)\GameInitOptionsScreen.sbr" \ - "$(INTDIR)\gameloop.sbr" \ - "$(INTDIR)\gamescreen.sbr" \ - "$(INTDIR)\GameSettings.sbr" \ - "$(INTDIR)\GameVersion.sbr" \ - "$(INTDIR)\HelpScreen.sbr" \ - "$(INTDIR)\Init.sbr" \ - "$(INTDIR)\Intro.sbr" \ - "$(INTDIR)\JA2 Splash.sbr" \ - "$(INTDIR)\jascreens.sbr" \ - "$(INTDIR)\Loading Screen.sbr" \ - "$(INTDIR)\MainMenuScreen.sbr" \ - "$(INTDIR)\MessageBoxScreen.sbr" \ - "$(INTDIR)\Options Screen.sbr" \ - "$(INTDIR)\SaveLoadGame.sbr" \ - "$(INTDIR)\SaveLoadScreen.sbr" \ - "$(INTDIR)\SCREENS.sbr" \ - "$(INTDIR)\Sys Globals.sbr" - -"$(OUTDIR)\JA2.bsc" : "$(OUTDIR)" $(BSC32_SBRS) - $(BSC32) @<< - $(BSC32_FLAGS) $(BSC32_SBRS) -<< - -LINK32=link.exe -LINK32_FLAGS=libexpatMT.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map:"$(INTDIR)\ja2_cvs.map" /machine:I386 /out:"..\ja2_cvs.exe" -LINK32_OBJS= \ - "$(INTDIR)\_Ja25GermanText.obj" \ - "$(INTDIR)\aniviewscreen.obj" \ - "$(INTDIR)\Credits.obj" \ - "$(INTDIR)\Cursors.obj" \ - "$(INTDIR)\Fade Screen.obj" \ - "$(INTDIR)\GameInitOptionsScreen.obj" \ - "$(INTDIR)\gameloop.obj" \ - "$(INTDIR)\gamescreen.obj" \ - "$(INTDIR)\GameSettings.obj" \ - "$(INTDIR)\GameVersion.obj" \ - "$(INTDIR)\HelpScreen.obj" \ - "$(INTDIR)\Init.obj" \ - "$(INTDIR)\Intro.obj" \ - "$(INTDIR)\JA2 Splash.obj" \ - "$(INTDIR)\jascreens.obj" \ - "$(INTDIR)\Loading Screen.obj" \ - "$(INTDIR)\MainMenuScreen.obj" \ - "$(INTDIR)\MessageBoxScreen.obj" \ - "$(INTDIR)\Options Screen.obj" \ - "$(INTDIR)\SaveLoadGame.obj" \ - "$(INTDIR)\SaveLoadScreen.obj" \ - "$(INTDIR)\SCREENS.obj" \ - "$(INTDIR)\Sys Globals.obj" \ - "$(INTDIR)\ja2.res" \ - ".\TileEngine\Release\TileEngine.lib" \ - ".\Standard Gaming Platform\Release\Standard Gaming Platform.lib" \ - ".\Tactical\Release\Tactical.lib" \ - ".\Utils\Release\Utils.lib" \ - ".\TacticalAI\Release\TacticalAI.lib" \ - ".\Editor\Release\Editor.lib" \ - ".\Laptop\Release\Laptop.lib" \ - ".\Strategic\Release\Strategic.lib" - -"..\ja2_cvs.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "ja2 - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "..\ja2_cvs.exe" "$(OUTDIR)\JA2.bsc" - -!ELSE - -ALL : "Strategic - Win32 Debug" "Laptop - Win32 Debug" "Editor - Win32 Debug" "TacticalAI - Win32 Debug" "Utils - Win32 Debug" "Tactical - Win32 Debug" "Standard Gaming Platform - Win32 Debug" "TileEngine - Win32 Debug" "..\ja2_cvs.exe" "$(OUTDIR)\JA2.bsc" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"TileEngine - Win32 DebugCLEAN" "Standard Gaming Platform - Win32 DebugCLEAN" "Tactical - Win32 DebugCLEAN" "Utils - Win32 DebugCLEAN" "TacticalAI - Win32 DebugCLEAN" "Editor - Win32 DebugCLEAN" "Laptop - Win32 DebugCLEAN" "Strategic - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\_Ja25GermanText.obj" - -@erase "$(INTDIR)\_Ja25GermanText.sbr" - -@erase "$(INTDIR)\aniviewscreen.obj" - -@erase "$(INTDIR)\aniviewscreen.sbr" - -@erase "$(INTDIR)\Credits.obj" - -@erase "$(INTDIR)\Credits.sbr" - -@erase "$(INTDIR)\Cursors.obj" - -@erase "$(INTDIR)\Cursors.sbr" - -@erase "$(INTDIR)\Fade Screen.obj" - -@erase "$(INTDIR)\Fade Screen.sbr" - -@erase "$(INTDIR)\GameInitOptionsScreen.obj" - -@erase "$(INTDIR)\GameInitOptionsScreen.sbr" - -@erase "$(INTDIR)\gameloop.obj" - -@erase "$(INTDIR)\gameloop.sbr" - -@erase "$(INTDIR)\gamescreen.obj" - -@erase "$(INTDIR)\gamescreen.sbr" - -@erase "$(INTDIR)\GameSettings.obj" - -@erase "$(INTDIR)\GameSettings.sbr" - -@erase "$(INTDIR)\GameVersion.obj" - -@erase "$(INTDIR)\GameVersion.sbr" - -@erase "$(INTDIR)\HelpScreen.obj" - -@erase "$(INTDIR)\HelpScreen.sbr" - -@erase "$(INTDIR)\Init.obj" - -@erase "$(INTDIR)\Init.sbr" - -@erase "$(INTDIR)\Intro.obj" - -@erase "$(INTDIR)\Intro.sbr" - -@erase "$(INTDIR)\JA2 Splash.obj" - -@erase "$(INTDIR)\JA2 Splash.sbr" - -@erase "$(INTDIR)\ja2.res" - -@erase "$(INTDIR)\jascreens.obj" - -@erase "$(INTDIR)\jascreens.sbr" - -@erase "$(INTDIR)\Loading Screen.obj" - -@erase "$(INTDIR)\Loading Screen.sbr" - -@erase "$(INTDIR)\MainMenuScreen.obj" - -@erase "$(INTDIR)\MainMenuScreen.sbr" - -@erase "$(INTDIR)\MessageBoxScreen.obj" - -@erase "$(INTDIR)\MessageBoxScreen.sbr" - -@erase "$(INTDIR)\Options Screen.obj" - -@erase "$(INTDIR)\Options Screen.sbr" - -@erase "$(INTDIR)\SaveLoadGame.obj" - -@erase "$(INTDIR)\SaveLoadGame.sbr" - -@erase "$(INTDIR)\SaveLoadScreen.obj" - -@erase "$(INTDIR)\SaveLoadScreen.sbr" - -@erase "$(INTDIR)\SCREENS.obj" - -@erase "$(INTDIR)\SCREENS.sbr" - -@erase "$(INTDIR)\Sys Globals.obj" - -@erase "$(INTDIR)\Sys Globals.sbr" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\JA2.bsc" - -@erase "$(OUTDIR)\ja2_cvs.map" - -@erase "..\ja2_cvs.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I ".\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Editor" /I ".\Strategic" /I ".\laptop" /I ".\\" /I "..\\" /D "CALLBACKTIMER" /D "PRECOMPILEDHEADERS" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "_VTUNE_PROFILING" /D "XML_STATIC" /D "CINTERFACE" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\JA2.pch" /YX"JA2 All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ja2.res" /d "_DEBUG" -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\JA2.bsc" -BSC32_SBRS= \ - "$(INTDIR)\_Ja25GermanText.sbr" \ - "$(INTDIR)\aniviewscreen.sbr" \ - "$(INTDIR)\Credits.sbr" \ - "$(INTDIR)\Cursors.sbr" \ - "$(INTDIR)\Fade Screen.sbr" \ - "$(INTDIR)\GameInitOptionsScreen.sbr" \ - "$(INTDIR)\gameloop.sbr" \ - "$(INTDIR)\gamescreen.sbr" \ - "$(INTDIR)\GameSettings.sbr" \ - "$(INTDIR)\GameVersion.sbr" \ - "$(INTDIR)\HelpScreen.sbr" \ - "$(INTDIR)\Init.sbr" \ - "$(INTDIR)\Intro.sbr" \ - "$(INTDIR)\JA2 Splash.sbr" \ - "$(INTDIR)\jascreens.sbr" \ - "$(INTDIR)\Loading Screen.sbr" \ - "$(INTDIR)\MainMenuScreen.sbr" \ - "$(INTDIR)\MessageBoxScreen.sbr" \ - "$(INTDIR)\Options Screen.sbr" \ - "$(INTDIR)\SaveLoadGame.sbr" \ - "$(INTDIR)\SaveLoadScreen.sbr" \ - "$(INTDIR)\SCREENS.sbr" \ - "$(INTDIR)\Sys Globals.sbr" - -"$(OUTDIR)\JA2.bsc" : "$(OUTDIR)" $(BSC32_SBRS) - $(BSC32) @<< - $(BSC32_FLAGS) $(BSC32_SBRS) -<< - -LINK32=link.exe -LINK32_FLAGS=libexpatMT.lib mss32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib /nologo /subsystem:windows /profile /map:"$(INTDIR)\ja2_cvs.map" /debug /machine:I386 /nodefaultlib:"libcmt" /out:"..\ja2_cvs.exe" /libpath:".\..\..\Standard Gaming Platform\\" -LINK32_OBJS= \ - "$(INTDIR)\_Ja25GermanText.obj" \ - "$(INTDIR)\aniviewscreen.obj" \ - "$(INTDIR)\Credits.obj" \ - "$(INTDIR)\Cursors.obj" \ - "$(INTDIR)\Fade Screen.obj" \ - "$(INTDIR)\GameInitOptionsScreen.obj" \ - "$(INTDIR)\gameloop.obj" \ - "$(INTDIR)\gamescreen.obj" \ - "$(INTDIR)\GameSettings.obj" \ - "$(INTDIR)\GameVersion.obj" \ - "$(INTDIR)\HelpScreen.obj" \ - "$(INTDIR)\Init.obj" \ - "$(INTDIR)\Intro.obj" \ - "$(INTDIR)\JA2 Splash.obj" \ - "$(INTDIR)\jascreens.obj" \ - "$(INTDIR)\Loading Screen.obj" \ - "$(INTDIR)\MainMenuScreen.obj" \ - "$(INTDIR)\MessageBoxScreen.obj" \ - "$(INTDIR)\Options Screen.obj" \ - "$(INTDIR)\SaveLoadGame.obj" \ - "$(INTDIR)\SaveLoadScreen.obj" \ - "$(INTDIR)\SCREENS.obj" \ - "$(INTDIR)\Sys Globals.obj" \ - "$(INTDIR)\ja2.res" \ - ".\TileEngine\Debug\TileEngine.lib" \ - ".\Standard Gaming Platform\Debug\Standard Gaming Platform.lib" \ - ".\Tactical\Debug\Tactical.lib" \ - ".\Utils\Debug\Utils.lib" \ - ".\TacticalAI\Debug\TacticalAI.lib" \ - ".\Editor\Debug\Editor.lib" \ - ".\Laptop\Debug\Laptop.lib" \ - ".\Strategic\Debug\Strategic.lib" - -"..\ja2_cvs.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "ja2 - Win32 Release with Debug Info" - -OUTDIR=.\Release with Debug -INTDIR=.\Release with Debug -# Begin Custom Macros -OutDir=.\Release with Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "..\ja2_cvs.exe" "$(OUTDIR)\JA2.bsc" - -!ELSE - -ALL : "Strategic - Win32 Release with Debug Info" "Laptop - Win32 Release with Debug Info" "Editor - Win32 Release with Debug Info" "TacticalAI - Win32 Release with Debug Info" "Utils - Win32 Release with Debug Info" "Tactical - Win32 Release with Debug Info" "Standard Gaming Platform - Win32 Release with Debug Info" "TileEngine - Win32 Release with Debug Info" "..\ja2_cvs.exe" "$(OUTDIR)\JA2.bsc" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"TileEngine - Win32 Release with Debug InfoCLEAN" "Standard Gaming Platform - Win32 Release with Debug InfoCLEAN" "Tactical - Win32 Release with Debug InfoCLEAN" "Utils - Win32 Release with Debug InfoCLEAN" "TacticalAI - Win32 Release with Debug InfoCLEAN" "Editor - Win32 Release with Debug InfoCLEAN" "Laptop - Win32 Release with Debug InfoCLEAN" "Strategic - Win32 Release with Debug InfoCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\_Ja25GermanText.obj" - -@erase "$(INTDIR)\_Ja25GermanText.sbr" - -@erase "$(INTDIR)\aniviewscreen.obj" - -@erase "$(INTDIR)\aniviewscreen.sbr" - -@erase "$(INTDIR)\Credits.obj" - -@erase "$(INTDIR)\Credits.sbr" - -@erase "$(INTDIR)\Cursors.obj" - -@erase "$(INTDIR)\Cursors.sbr" - -@erase "$(INTDIR)\Fade Screen.obj" - -@erase "$(INTDIR)\Fade Screen.sbr" - -@erase "$(INTDIR)\GameInitOptionsScreen.obj" - -@erase "$(INTDIR)\GameInitOptionsScreen.sbr" - -@erase "$(INTDIR)\gameloop.obj" - -@erase "$(INTDIR)\gameloop.sbr" - -@erase "$(INTDIR)\gamescreen.obj" - -@erase "$(INTDIR)\gamescreen.sbr" - -@erase "$(INTDIR)\GameSettings.obj" - -@erase "$(INTDIR)\GameSettings.sbr" - -@erase "$(INTDIR)\GameVersion.obj" - -@erase "$(INTDIR)\GameVersion.sbr" - -@erase "$(INTDIR)\HelpScreen.obj" - -@erase "$(INTDIR)\HelpScreen.sbr" - -@erase "$(INTDIR)\Init.obj" - -@erase "$(INTDIR)\Init.sbr" - -@erase "$(INTDIR)\Intro.obj" - -@erase "$(INTDIR)\Intro.sbr" - -@erase "$(INTDIR)\JA2 Splash.obj" - -@erase "$(INTDIR)\JA2 Splash.sbr" - -@erase "$(INTDIR)\ja2.res" - -@erase "$(INTDIR)\jascreens.obj" - -@erase "$(INTDIR)\jascreens.sbr" - -@erase "$(INTDIR)\Loading Screen.obj" - -@erase "$(INTDIR)\Loading Screen.sbr" - -@erase "$(INTDIR)\MainMenuScreen.obj" - -@erase "$(INTDIR)\MainMenuScreen.sbr" - -@erase "$(INTDIR)\MessageBoxScreen.obj" - -@erase "$(INTDIR)\MessageBoxScreen.sbr" - -@erase "$(INTDIR)\Options Screen.obj" - -@erase "$(INTDIR)\Options Screen.sbr" - -@erase "$(INTDIR)\SaveLoadGame.obj" - -@erase "$(INTDIR)\SaveLoadGame.sbr" - -@erase "$(INTDIR)\SaveLoadScreen.obj" - -@erase "$(INTDIR)\SaveLoadScreen.sbr" - -@erase "$(INTDIR)\SCREENS.obj" - -@erase "$(INTDIR)\SCREENS.sbr" - -@erase "$(INTDIR)\Sys Globals.obj" - -@erase "$(INTDIR)\Sys Globals.sbr" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\JA2.bsc" - -@erase "$(OUTDIR)\ja2_cvs.map" - -@erase "..\ja2_cvs.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP_PROJ=/nologo /G5 /MT /W4 /GX /Zi /O2 /I ".\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\laptop" /I ".\\" /D "NDEBUG" /D "RELEASE_WITH_DEBUG_INFO" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "_VTUNE_PROFILING" /D "XML_STATIC" /D "CINTERFACE" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\JA2.pch" /YX"JA2 All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /O2b2 /c -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ja2.res" /d "NDEBUG" -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\JA2.bsc" -BSC32_SBRS= \ - "$(INTDIR)\_Ja25GermanText.sbr" \ - "$(INTDIR)\aniviewscreen.sbr" \ - "$(INTDIR)\Credits.sbr" \ - "$(INTDIR)\Cursors.sbr" \ - "$(INTDIR)\Fade Screen.sbr" \ - "$(INTDIR)\GameInitOptionsScreen.sbr" \ - "$(INTDIR)\gameloop.sbr" \ - "$(INTDIR)\gamescreen.sbr" \ - "$(INTDIR)\GameSettings.sbr" \ - "$(INTDIR)\GameVersion.sbr" \ - "$(INTDIR)\HelpScreen.sbr" \ - "$(INTDIR)\Init.sbr" \ - "$(INTDIR)\Intro.sbr" \ - "$(INTDIR)\JA2 Splash.sbr" \ - "$(INTDIR)\jascreens.sbr" \ - "$(INTDIR)\Loading Screen.sbr" \ - "$(INTDIR)\MainMenuScreen.sbr" \ - "$(INTDIR)\MessageBoxScreen.sbr" \ - "$(INTDIR)\Options Screen.sbr" \ - "$(INTDIR)\SaveLoadGame.sbr" \ - "$(INTDIR)\SaveLoadScreen.sbr" \ - "$(INTDIR)\SCREENS.sbr" \ - "$(INTDIR)\Sys Globals.sbr" - -"$(OUTDIR)\JA2.bsc" : "$(OUTDIR)" $(BSC32_SBRS) - $(BSC32) @<< - $(BSC32_FLAGS) $(BSC32_SBRS) -<< - -LINK32=link.exe -LINK32_FLAGS=libexpatMT.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map:"$(INTDIR)\ja2_cvs.map" /debug /machine:I386 /out:"..\ja2_cvs.exe" -LINK32_OBJS= \ - "$(INTDIR)\_Ja25GermanText.obj" \ - "$(INTDIR)\aniviewscreen.obj" \ - "$(INTDIR)\Credits.obj" \ - "$(INTDIR)\Cursors.obj" \ - "$(INTDIR)\Fade Screen.obj" \ - "$(INTDIR)\GameInitOptionsScreen.obj" \ - "$(INTDIR)\gameloop.obj" \ - "$(INTDIR)\gamescreen.obj" \ - "$(INTDIR)\GameSettings.obj" \ - "$(INTDIR)\GameVersion.obj" \ - "$(INTDIR)\HelpScreen.obj" \ - "$(INTDIR)\Init.obj" \ - "$(INTDIR)\Intro.obj" \ - "$(INTDIR)\JA2 Splash.obj" \ - "$(INTDIR)\jascreens.obj" \ - "$(INTDIR)\Loading Screen.obj" \ - "$(INTDIR)\MainMenuScreen.obj" \ - "$(INTDIR)\MessageBoxScreen.obj" \ - "$(INTDIR)\Options Screen.obj" \ - "$(INTDIR)\SaveLoadGame.obj" \ - "$(INTDIR)\SaveLoadScreen.obj" \ - "$(INTDIR)\SCREENS.obj" \ - "$(INTDIR)\Sys Globals.obj" \ - "$(INTDIR)\ja2.res" \ - ".\TileEngine\Release with Debug\TileEngine.lib" \ - ".\Standard Gaming Platform\Release with Debug Info\Standard Gaming Platform.lib" \ - ".\Tactical\Release with Debug\Tactical.lib" \ - ".\Utils\Release with Debug\Utils.lib" \ - ".\TacticalAI\Release with Debug\TacticalAI.lib" \ - ".\Editor\Release with Debug\Editor.lib" \ - ".\Laptop\Release with Debug\Laptop.lib" \ - ".\Strategic\Release with Debug\Strategic.lib" - -"..\ja2_cvs.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "ja2 - Win32 Bounds Checker" - -OUTDIR=.\Bounds Checker -INTDIR=.\Bounds Checker -# Begin Custom Macros -OutDir=.\Bounds Checker -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "..\ja2.exe" "$(OUTDIR)\JA2.bsc" - -!ELSE - -ALL : "Strategic - Win32 Bounds Checker" "Laptop - Win32 Bounds Checker" "Editor - Win32 Bounds Checker" "TacticalAI - Win32 Bounds Checker" "Utils - Win32 Bounds Checker" "Tactical - Win32 Bounds Checker" "Standard Gaming Platform - Win32 Bounds Checker" "TileEngine - Win32 Bounds Checker" "..\ja2.exe" "$(OUTDIR)\JA2.bsc" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"TileEngine - Win32 Bounds CheckerCLEAN" "Standard Gaming Platform - Win32 Bounds CheckerCLEAN" "Tactical - Win32 Bounds CheckerCLEAN" "Utils - Win32 Bounds CheckerCLEAN" "TacticalAI - Win32 Bounds CheckerCLEAN" "Editor - Win32 Bounds CheckerCLEAN" "Laptop - Win32 Bounds CheckerCLEAN" "Strategic - Win32 Bounds CheckerCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\_Ja25GermanText.obj" - -@erase "$(INTDIR)\_Ja25GermanText.sbr" - -@erase "$(INTDIR)\aniviewscreen.obj" - -@erase "$(INTDIR)\aniviewscreen.sbr" - -@erase "$(INTDIR)\Credits.obj" - -@erase "$(INTDIR)\Credits.sbr" - -@erase "$(INTDIR)\Cursors.obj" - -@erase "$(INTDIR)\Cursors.sbr" - -@erase "$(INTDIR)\Fade Screen.obj" - -@erase "$(INTDIR)\Fade Screen.sbr" - -@erase "$(INTDIR)\GameInitOptionsScreen.obj" - -@erase "$(INTDIR)\GameInitOptionsScreen.sbr" - -@erase "$(INTDIR)\gameloop.obj" - -@erase "$(INTDIR)\gameloop.sbr" - -@erase "$(INTDIR)\gamescreen.obj" - -@erase "$(INTDIR)\gamescreen.sbr" - -@erase "$(INTDIR)\GameSettings.obj" - -@erase "$(INTDIR)\GameSettings.sbr" - -@erase "$(INTDIR)\GameVersion.obj" - -@erase "$(INTDIR)\GameVersion.sbr" - -@erase "$(INTDIR)\HelpScreen.obj" - -@erase "$(INTDIR)\HelpScreen.sbr" - -@erase "$(INTDIR)\Init.obj" - -@erase "$(INTDIR)\Init.sbr" - -@erase "$(INTDIR)\Intro.obj" - -@erase "$(INTDIR)\Intro.sbr" - -@erase "$(INTDIR)\JA2 Splash.obj" - -@erase "$(INTDIR)\JA2 Splash.sbr" - -@erase "$(INTDIR)\ja2.res" - -@erase "$(INTDIR)\jascreens.obj" - -@erase "$(INTDIR)\jascreens.sbr" - -@erase "$(INTDIR)\Loading Screen.obj" - -@erase "$(INTDIR)\Loading Screen.sbr" - -@erase "$(INTDIR)\MainMenuScreen.obj" - -@erase "$(INTDIR)\MainMenuScreen.sbr" - -@erase "$(INTDIR)\MessageBoxScreen.obj" - -@erase "$(INTDIR)\MessageBoxScreen.sbr" - -@erase "$(INTDIR)\Options Screen.obj" - -@erase "$(INTDIR)\Options Screen.sbr" - -@erase "$(INTDIR)\SaveLoadGame.obj" - -@erase "$(INTDIR)\SaveLoadGame.sbr" - -@erase "$(INTDIR)\SaveLoadScreen.obj" - -@erase "$(INTDIR)\SaveLoadScreen.sbr" - -@erase "$(INTDIR)\SCREENS.obj" - -@erase "$(INTDIR)\SCREENS.sbr" - -@erase "$(INTDIR)\Sys Globals.obj" - -@erase "$(INTDIR)\Sys Globals.sbr" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\JA2.bsc" - -@erase "$(OUTDIR)\ja2.map" - -@erase "..\ja2.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\Laptop" /D "_DEBUG" /D "BOUNDS_CHECKER" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "_VTUNE_PROFILING" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\JA2.pch" /YX"JA2 All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ja2.res" /d "_DEBUG" -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\JA2.bsc" -BSC32_SBRS= \ - "$(INTDIR)\_Ja25GermanText.sbr" \ - "$(INTDIR)\aniviewscreen.sbr" \ - "$(INTDIR)\Credits.sbr" \ - "$(INTDIR)\Cursors.sbr" \ - "$(INTDIR)\Fade Screen.sbr" \ - "$(INTDIR)\GameInitOptionsScreen.sbr" \ - "$(INTDIR)\gameloop.sbr" \ - "$(INTDIR)\gamescreen.sbr" \ - "$(INTDIR)\GameSettings.sbr" \ - "$(INTDIR)\GameVersion.sbr" \ - "$(INTDIR)\HelpScreen.sbr" \ - "$(INTDIR)\Init.sbr" \ - "$(INTDIR)\Intro.sbr" \ - "$(INTDIR)\JA2 Splash.sbr" \ - "$(INTDIR)\jascreens.sbr" \ - "$(INTDIR)\Loading Screen.sbr" \ - "$(INTDIR)\MainMenuScreen.sbr" \ - "$(INTDIR)\MessageBoxScreen.sbr" \ - "$(INTDIR)\Options Screen.sbr" \ - "$(INTDIR)\SaveLoadGame.sbr" \ - "$(INTDIR)\SaveLoadScreen.sbr" \ - "$(INTDIR)\SCREENS.sbr" \ - "$(INTDIR)\Sys Globals.sbr" - -"$(OUTDIR)\JA2.bsc" : "$(OUTDIR)" $(BSC32_SBRS) - $(BSC32) @<< - $(BSC32_FLAGS) $(BSC32_SBRS) -<< - -LINK32=link.exe -LINK32_FLAGS=vtuneapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map:"$(INTDIR)\ja2.map" /debug /machine:I386 /out:"\ja2\ja2.exe" -LINK32_OBJS= \ - "$(INTDIR)\_Ja25GermanText.obj" \ - "$(INTDIR)\aniviewscreen.obj" \ - "$(INTDIR)\Credits.obj" \ - "$(INTDIR)\Cursors.obj" \ - "$(INTDIR)\Fade Screen.obj" \ - "$(INTDIR)\GameInitOptionsScreen.obj" \ - "$(INTDIR)\gameloop.obj" \ - "$(INTDIR)\gamescreen.obj" \ - "$(INTDIR)\GameSettings.obj" \ - "$(INTDIR)\GameVersion.obj" \ - "$(INTDIR)\HelpScreen.obj" \ - "$(INTDIR)\Init.obj" \ - "$(INTDIR)\Intro.obj" \ - "$(INTDIR)\JA2 Splash.obj" \ - "$(INTDIR)\jascreens.obj" \ - "$(INTDIR)\Loading Screen.obj" \ - "$(INTDIR)\MainMenuScreen.obj" \ - "$(INTDIR)\MessageBoxScreen.obj" \ - "$(INTDIR)\Options Screen.obj" \ - "$(INTDIR)\SaveLoadGame.obj" \ - "$(INTDIR)\SaveLoadScreen.obj" \ - "$(INTDIR)\SCREENS.obj" \ - "$(INTDIR)\Sys Globals.obj" \ - "$(INTDIR)\ja2.res" \ - ".\TileEngine\Bounds Checker\TileEngine.lib" \ - ".\Standard Gaming Platform\Standar0\Standard Gaming Platform.lib" \ - ".\Tactical\Bounds Checker\Tactical.lib" \ - ".\Utils\Bounds Checker\Utils.lib" \ - ".\TacticalAI\Bounds Checker\TacticalAI.lib" \ - ".\Editor\Bounds Checker\Editor.lib" \ - ".\Laptop\Bounds Checker\Laptop.lib" \ - ".\Strategic\Bounds Checker\Strategic.lib" - -"..\ja2.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "ja2 - Win32 Debug Demo" - -OUTDIR=.\Debug Demo -INTDIR=.\Debug Demo -# Begin Custom Macros -OutDir=.\Debug Demo -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "..\..\ja2demo\ja2.exe" "$(OUTDIR)\JA2.bsc" - -!ELSE - -ALL : "Strategic - Win32 Debug Demo" "Laptop - Win32 Debug Demo" "Editor - Win32 Debug Demo" "TacticalAI - Win32 Debug Demo" "Utils - Win32 Debug Demo" "Tactical - Win32 Debug Demo" "Standard Gaming Platform - Win32 Debug Demo" "TileEngine - Win32 Debug Demo" "..\..\ja2demo\ja2.exe" "$(OUTDIR)\JA2.bsc" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"TileEngine - Win32 Debug DemoCLEAN" "Standard Gaming Platform - Win32 Debug DemoCLEAN" "Tactical - Win32 Debug DemoCLEAN" "Utils - Win32 Debug DemoCLEAN" "TacticalAI - Win32 Debug DemoCLEAN" "Editor - Win32 Debug DemoCLEAN" "Laptop - Win32 Debug DemoCLEAN" "Strategic - Win32 Debug DemoCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\_Ja25GermanText.obj" - -@erase "$(INTDIR)\_Ja25GermanText.sbr" - -@erase "$(INTDIR)\aniviewscreen.obj" - -@erase "$(INTDIR)\aniviewscreen.sbr" - -@erase "$(INTDIR)\Credits.obj" - -@erase "$(INTDIR)\Credits.sbr" - -@erase "$(INTDIR)\Cursors.obj" - -@erase "$(INTDIR)\Cursors.sbr" - -@erase "$(INTDIR)\Fade Screen.obj" - -@erase "$(INTDIR)\Fade Screen.sbr" - -@erase "$(INTDIR)\GameInitOptionsScreen.obj" - -@erase "$(INTDIR)\GameInitOptionsScreen.sbr" - -@erase "$(INTDIR)\gameloop.obj" - -@erase "$(INTDIR)\gameloop.sbr" - -@erase "$(INTDIR)\gamescreen.obj" - -@erase "$(INTDIR)\gamescreen.sbr" - -@erase "$(INTDIR)\GameSettings.obj" - -@erase "$(INTDIR)\GameSettings.sbr" - -@erase "$(INTDIR)\GameVersion.obj" - -@erase "$(INTDIR)\GameVersion.sbr" - -@erase "$(INTDIR)\HelpScreen.obj" - -@erase "$(INTDIR)\HelpScreen.sbr" - -@erase "$(INTDIR)\Init.obj" - -@erase "$(INTDIR)\Init.sbr" - -@erase "$(INTDIR)\Intro.obj" - -@erase "$(INTDIR)\Intro.sbr" - -@erase "$(INTDIR)\JA2 Splash.obj" - -@erase "$(INTDIR)\JA2 Splash.sbr" - -@erase "$(INTDIR)\ja2.res" - -@erase "$(INTDIR)\jascreens.obj" - -@erase "$(INTDIR)\jascreens.sbr" - -@erase "$(INTDIR)\Loading Screen.obj" - -@erase "$(INTDIR)\Loading Screen.sbr" - -@erase "$(INTDIR)\MainMenuScreen.obj" - -@erase "$(INTDIR)\MainMenuScreen.sbr" - -@erase "$(INTDIR)\MessageBoxScreen.obj" - -@erase "$(INTDIR)\MessageBoxScreen.sbr" - -@erase "$(INTDIR)\Options Screen.obj" - -@erase "$(INTDIR)\Options Screen.sbr" - -@erase "$(INTDIR)\SaveLoadGame.obj" - -@erase "$(INTDIR)\SaveLoadGame.sbr" - -@erase "$(INTDIR)\SaveLoadScreen.obj" - -@erase "$(INTDIR)\SaveLoadScreen.sbr" - -@erase "$(INTDIR)\SCREENS.obj" - -@erase "$(INTDIR)\SCREENS.sbr" - -@erase "$(INTDIR)\Sys Globals.obj" - -@erase "$(INTDIR)\Sys Globals.sbr" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\JA2.bsc" - -@erase "$(OUTDIR)\ja2.map" - -@erase "..\..\ja2demo\ja2.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\Laptop" /D "_DEBUG" /D "JA2DEMO" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\JA2.pch" /YX"JA2 All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ja2.res" /d "_DEBUG" -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\JA2.bsc" -BSC32_SBRS= \ - "$(INTDIR)\_Ja25GermanText.sbr" \ - "$(INTDIR)\aniviewscreen.sbr" \ - "$(INTDIR)\Credits.sbr" \ - "$(INTDIR)\Cursors.sbr" \ - "$(INTDIR)\Fade Screen.sbr" \ - "$(INTDIR)\GameInitOptionsScreen.sbr" \ - "$(INTDIR)\gameloop.sbr" \ - "$(INTDIR)\gamescreen.sbr" \ - "$(INTDIR)\GameSettings.sbr" \ - "$(INTDIR)\GameVersion.sbr" \ - "$(INTDIR)\HelpScreen.sbr" \ - "$(INTDIR)\Init.sbr" \ - "$(INTDIR)\Intro.sbr" \ - "$(INTDIR)\JA2 Splash.sbr" \ - "$(INTDIR)\jascreens.sbr" \ - "$(INTDIR)\Loading Screen.sbr" \ - "$(INTDIR)\MainMenuScreen.sbr" \ - "$(INTDIR)\MessageBoxScreen.sbr" \ - "$(INTDIR)\Options Screen.sbr" \ - "$(INTDIR)\SaveLoadGame.sbr" \ - "$(INTDIR)\SaveLoadScreen.sbr" \ - "$(INTDIR)\SCREENS.sbr" \ - "$(INTDIR)\Sys Globals.sbr" - -"$(OUTDIR)\JA2.bsc" : "$(OUTDIR)" $(BSC32_SBRS) - $(BSC32) @<< - $(BSC32_FLAGS) $(BSC32_SBRS) -<< - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map:"$(INTDIR)\ja2.map" /debug /machine:I386 /out:"d:\ja2demo\ja2.exe" -LINK32_OBJS= \ - "$(INTDIR)\_Ja25GermanText.obj" \ - "$(INTDIR)\aniviewscreen.obj" \ - "$(INTDIR)\Credits.obj" \ - "$(INTDIR)\Cursors.obj" \ - "$(INTDIR)\Fade Screen.obj" \ - "$(INTDIR)\GameInitOptionsScreen.obj" \ - "$(INTDIR)\gameloop.obj" \ - "$(INTDIR)\gamescreen.obj" \ - "$(INTDIR)\GameSettings.obj" \ - "$(INTDIR)\GameVersion.obj" \ - "$(INTDIR)\HelpScreen.obj" \ - "$(INTDIR)\Init.obj" \ - "$(INTDIR)\Intro.obj" \ - "$(INTDIR)\JA2 Splash.obj" \ - "$(INTDIR)\jascreens.obj" \ - "$(INTDIR)\Loading Screen.obj" \ - "$(INTDIR)\MainMenuScreen.obj" \ - "$(INTDIR)\MessageBoxScreen.obj" \ - "$(INTDIR)\Options Screen.obj" \ - "$(INTDIR)\SaveLoadGame.obj" \ - "$(INTDIR)\SaveLoadScreen.obj" \ - "$(INTDIR)\SCREENS.obj" \ - "$(INTDIR)\Sys Globals.obj" \ - "$(INTDIR)\ja2.res" \ - ".\TileEngine\Debug Demo\TileEngine.lib" \ - ".\Standard Gaming Platform\Standard\Standard Gaming Platform.lib" \ - ".\Tactical\Debug Demo\Tactical.lib" \ - ".\Utils\Debug Demo\Utils.lib" \ - ".\TacticalAI\Debug Demo\TacticalAI.lib" \ - ".\Editor\Debug Demo\Editor.lib" \ - ".\Laptop\Debug Demo\Laptop.lib" \ - ".\Strategic\Debug Demo\Strategic.lib" - -"..\..\ja2demo\ja2.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "ja2 - Win32 Release Demo" - -OUTDIR=.\Release Demo -INTDIR=.\Release Demo -# Begin Custom Macros -OutDir=.\Release Demo -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "..\..\ja2demo\ja2.exe" "$(OUTDIR)\JA2.bsc" - -!ELSE - -ALL : "Strategic - Win32 Release Demo" "Laptop - Win32 Release Demo" "Editor - Win32 Release Demo" "TacticalAI - Win32 Release Demo" "Utils - Win32 Release Demo" "Tactical - Win32 Release Demo" "Standard Gaming Platform - Win32 Release Demo" "TileEngine - Win32 Release Demo" "..\..\ja2demo\ja2.exe" "$(OUTDIR)\JA2.bsc" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"TileEngine - Win32 Release DemoCLEAN" "Standard Gaming Platform - Win32 Release DemoCLEAN" "Tactical - Win32 Release DemoCLEAN" "Utils - Win32 Release DemoCLEAN" "TacticalAI - Win32 Release DemoCLEAN" "Editor - Win32 Release DemoCLEAN" "Laptop - Win32 Release DemoCLEAN" "Strategic - Win32 Release DemoCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\_Ja25GermanText.obj" - -@erase "$(INTDIR)\_Ja25GermanText.sbr" - -@erase "$(INTDIR)\aniviewscreen.obj" - -@erase "$(INTDIR)\aniviewscreen.sbr" - -@erase "$(INTDIR)\Credits.obj" - -@erase "$(INTDIR)\Credits.sbr" - -@erase "$(INTDIR)\Cursors.obj" - -@erase "$(INTDIR)\Cursors.sbr" - -@erase "$(INTDIR)\Fade Screen.obj" - -@erase "$(INTDIR)\Fade Screen.sbr" - -@erase "$(INTDIR)\GameInitOptionsScreen.obj" - -@erase "$(INTDIR)\GameInitOptionsScreen.sbr" - -@erase "$(INTDIR)\gameloop.obj" - -@erase "$(INTDIR)\gameloop.sbr" - -@erase "$(INTDIR)\gamescreen.obj" - -@erase "$(INTDIR)\gamescreen.sbr" - -@erase "$(INTDIR)\GameSettings.obj" - -@erase "$(INTDIR)\GameSettings.sbr" - -@erase "$(INTDIR)\GameVersion.obj" - -@erase "$(INTDIR)\GameVersion.sbr" - -@erase "$(INTDIR)\HelpScreen.obj" - -@erase "$(INTDIR)\HelpScreen.sbr" - -@erase "$(INTDIR)\Init.obj" - -@erase "$(INTDIR)\Init.sbr" - -@erase "$(INTDIR)\Intro.obj" - -@erase "$(INTDIR)\Intro.sbr" - -@erase "$(INTDIR)\JA2 Splash.obj" - -@erase "$(INTDIR)\JA2 Splash.sbr" - -@erase "$(INTDIR)\ja2.res" - -@erase "$(INTDIR)\jascreens.obj" - -@erase "$(INTDIR)\jascreens.sbr" - -@erase "$(INTDIR)\Loading Screen.obj" - -@erase "$(INTDIR)\Loading Screen.sbr" - -@erase "$(INTDIR)\MainMenuScreen.obj" - -@erase "$(INTDIR)\MainMenuScreen.sbr" - -@erase "$(INTDIR)\MessageBoxScreen.obj" - -@erase "$(INTDIR)\MessageBoxScreen.sbr" - -@erase "$(INTDIR)\Options Screen.obj" - -@erase "$(INTDIR)\Options Screen.sbr" - -@erase "$(INTDIR)\SaveLoadGame.obj" - -@erase "$(INTDIR)\SaveLoadGame.sbr" - -@erase "$(INTDIR)\SaveLoadScreen.obj" - -@erase "$(INTDIR)\SaveLoadScreen.sbr" - -@erase "$(INTDIR)\SCREENS.obj" - -@erase "$(INTDIR)\SCREENS.sbr" - -@erase "$(INTDIR)\Sys Globals.obj" - -@erase "$(INTDIR)\Sys Globals.sbr" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\JA2.bsc" - -@erase "$(OUTDIR)\ja2.map" - -@erase "..\..\ja2demo\ja2.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP_PROJ=/nologo /G5 /MT /W4 /GX /Zi /O2 /I "\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\laptop" /D "RELEASE_WITH_DEBUG_INFO" /D "NDEBUG" /D "JA2DEMO" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\JA2.pch" /YX"JA2 All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /O2b2 /c -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ja2.res" /d "NDEBUG" -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\JA2.bsc" -BSC32_SBRS= \ - "$(INTDIR)\_Ja25GermanText.sbr" \ - "$(INTDIR)\aniviewscreen.sbr" \ - "$(INTDIR)\Credits.sbr" \ - "$(INTDIR)\Cursors.sbr" \ - "$(INTDIR)\Fade Screen.sbr" \ - "$(INTDIR)\GameInitOptionsScreen.sbr" \ - "$(INTDIR)\gameloop.sbr" \ - "$(INTDIR)\gamescreen.sbr" \ - "$(INTDIR)\GameSettings.sbr" \ - "$(INTDIR)\GameVersion.sbr" \ - "$(INTDIR)\HelpScreen.sbr" \ - "$(INTDIR)\Init.sbr" \ - "$(INTDIR)\Intro.sbr" \ - "$(INTDIR)\JA2 Splash.sbr" \ - "$(INTDIR)\jascreens.sbr" \ - "$(INTDIR)\Loading Screen.sbr" \ - "$(INTDIR)\MainMenuScreen.sbr" \ - "$(INTDIR)\MessageBoxScreen.sbr" \ - "$(INTDIR)\Options Screen.sbr" \ - "$(INTDIR)\SaveLoadGame.sbr" \ - "$(INTDIR)\SaveLoadScreen.sbr" \ - "$(INTDIR)\SCREENS.sbr" \ - "$(INTDIR)\Sys Globals.sbr" - -"$(OUTDIR)\JA2.bsc" : "$(OUTDIR)" $(BSC32_SBRS) - $(BSC32) @<< - $(BSC32_FLAGS) $(BSC32_SBRS) -<< - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map:"$(INTDIR)\ja2.map" /debug /machine:I386 /out:"d:\ja2demo\ja2.exe" -LINK32_OBJS= \ - "$(INTDIR)\_Ja25GermanText.obj" \ - "$(INTDIR)\aniviewscreen.obj" \ - "$(INTDIR)\Credits.obj" \ - "$(INTDIR)\Cursors.obj" \ - "$(INTDIR)\Fade Screen.obj" \ - "$(INTDIR)\GameInitOptionsScreen.obj" \ - "$(INTDIR)\gameloop.obj" \ - "$(INTDIR)\gamescreen.obj" \ - "$(INTDIR)\GameSettings.obj" \ - "$(INTDIR)\GameVersion.obj" \ - "$(INTDIR)\HelpScreen.obj" \ - "$(INTDIR)\Init.obj" \ - "$(INTDIR)\Intro.obj" \ - "$(INTDIR)\JA2 Splash.obj" \ - "$(INTDIR)\jascreens.obj" \ - "$(INTDIR)\Loading Screen.obj" \ - "$(INTDIR)\MainMenuScreen.obj" \ - "$(INTDIR)\MessageBoxScreen.obj" \ - "$(INTDIR)\Options Screen.obj" \ - "$(INTDIR)\SaveLoadGame.obj" \ - "$(INTDIR)\SaveLoadScreen.obj" \ - "$(INTDIR)\SCREENS.obj" \ - "$(INTDIR)\Sys Globals.obj" \ - "$(INTDIR)\ja2.res" \ - ".\TileEngine\Release Demo\TileEngine.lib" \ - ".\Standard Gaming Platform\Standar1\Standard Gaming Platform.lib" \ - ".\Tactical\Release Demo\Tactical.lib" \ - ".\Utils\Release Demo\Utils.lib" \ - ".\TacticalAI\Release Demo\TacticalAI.lib" \ - ".\Editor\Release Demo\Editor.lib" \ - ".\Laptop\Release Demo\Laptop.lib" \ - ".\Strategic\Release Demo\Strategic.lib" - -"..\..\ja2demo\ja2.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" - -OUTDIR=.\Demo Release with Debug -INTDIR=.\Demo Release with Debug -# Begin Custom Macros -OutDir=.\Demo Release with Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "..\..\ja2demo\ja2.exe" "$(OUTDIR)\JA2.bsc" - -!ELSE - -ALL : "Strategic - Win32 Demo Release with Debug Info" "Laptop - Win32 Demo Release with Debug Info" "Editor - Win32 Demo Release with Debug Info" "TacticalAI - Win32 Demo Release with Debug Info" "Utils - Win32 Demo Release with Debug Info" "Tactical - Win32 Demo Release with Debug Info" "Standard Gaming Platform - Win32 Demo Release with Debug Info" "TileEngine - Win32 Demo Release with Debug Info" "..\..\ja2demo\ja2.exe" "$(OUTDIR)\JA2.bsc" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"TileEngine - Win32 Demo Release with Debug InfoCLEAN" "Standard Gaming Platform - Win32 Demo Release with Debug InfoCLEAN" "Tactical - Win32 Demo Release with Debug InfoCLEAN" "Utils - Win32 Demo Release with Debug InfoCLEAN" "TacticalAI - Win32 Demo Release with Debug InfoCLEAN" "Editor - Win32 Demo Release with Debug InfoCLEAN" "Laptop - Win32 Demo Release with Debug InfoCLEAN" "Strategic - Win32 Demo Release with Debug InfoCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\_Ja25GermanText.obj" - -@erase "$(INTDIR)\_Ja25GermanText.sbr" - -@erase "$(INTDIR)\aniviewscreen.obj" - -@erase "$(INTDIR)\aniviewscreen.sbr" - -@erase "$(INTDIR)\Credits.obj" - -@erase "$(INTDIR)\Credits.sbr" - -@erase "$(INTDIR)\Cursors.obj" - -@erase "$(INTDIR)\Cursors.sbr" - -@erase "$(INTDIR)\Fade Screen.obj" - -@erase "$(INTDIR)\Fade Screen.sbr" - -@erase "$(INTDIR)\GameInitOptionsScreen.obj" - -@erase "$(INTDIR)\GameInitOptionsScreen.sbr" - -@erase "$(INTDIR)\gameloop.obj" - -@erase "$(INTDIR)\gameloop.sbr" - -@erase "$(INTDIR)\gamescreen.obj" - -@erase "$(INTDIR)\gamescreen.sbr" - -@erase "$(INTDIR)\GameSettings.obj" - -@erase "$(INTDIR)\GameSettings.sbr" - -@erase "$(INTDIR)\GameVersion.obj" - -@erase "$(INTDIR)\GameVersion.sbr" - -@erase "$(INTDIR)\HelpScreen.obj" - -@erase "$(INTDIR)\HelpScreen.sbr" - -@erase "$(INTDIR)\Init.obj" - -@erase "$(INTDIR)\Init.sbr" - -@erase "$(INTDIR)\Intro.obj" - -@erase "$(INTDIR)\Intro.sbr" - -@erase "$(INTDIR)\JA2 Splash.obj" - -@erase "$(INTDIR)\JA2 Splash.sbr" - -@erase "$(INTDIR)\ja2.res" - -@erase "$(INTDIR)\jascreens.obj" - -@erase "$(INTDIR)\jascreens.sbr" - -@erase "$(INTDIR)\Loading Screen.obj" - -@erase "$(INTDIR)\Loading Screen.sbr" - -@erase "$(INTDIR)\MainMenuScreen.obj" - -@erase "$(INTDIR)\MainMenuScreen.sbr" - -@erase "$(INTDIR)\MessageBoxScreen.obj" - -@erase "$(INTDIR)\MessageBoxScreen.sbr" - -@erase "$(INTDIR)\Options Screen.obj" - -@erase "$(INTDIR)\Options Screen.sbr" - -@erase "$(INTDIR)\SaveLoadGame.obj" - -@erase "$(INTDIR)\SaveLoadGame.sbr" - -@erase "$(INTDIR)\SaveLoadScreen.obj" - -@erase "$(INTDIR)\SaveLoadScreen.sbr" - -@erase "$(INTDIR)\SCREENS.obj" - -@erase "$(INTDIR)\SCREENS.sbr" - -@erase "$(INTDIR)\Sys Globals.obj" - -@erase "$(INTDIR)\Sys Globals.sbr" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\JA2.bsc" - -@erase "$(OUTDIR)\ja2.map" - -@erase "..\..\ja2demo\ja2.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP_PROJ=/nologo /G5 /MT /W4 /GX /Zi /O2 /I ".\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\laptop" /I ".\\" /D "RELEASE_WITH_DEBUG_INFO" /D "NDEBUG" /D "JA2DEMO" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "XML_STATIC" /D "CINTERFACE" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\JA2.pch" /YX"JA2 All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /O2b2 /c -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ja2.res" /d "NDEBUG" -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\JA2.bsc" -BSC32_SBRS= \ - "$(INTDIR)\_Ja25GermanText.sbr" \ - "$(INTDIR)\aniviewscreen.sbr" \ - "$(INTDIR)\Credits.sbr" \ - "$(INTDIR)\Cursors.sbr" \ - "$(INTDIR)\Fade Screen.sbr" \ - "$(INTDIR)\GameInitOptionsScreen.sbr" \ - "$(INTDIR)\gameloop.sbr" \ - "$(INTDIR)\gamescreen.sbr" \ - "$(INTDIR)\GameSettings.sbr" \ - "$(INTDIR)\GameVersion.sbr" \ - "$(INTDIR)\HelpScreen.sbr" \ - "$(INTDIR)\Init.sbr" \ - "$(INTDIR)\Intro.sbr" \ - "$(INTDIR)\JA2 Splash.sbr" \ - "$(INTDIR)\jascreens.sbr" \ - "$(INTDIR)\Loading Screen.sbr" \ - "$(INTDIR)\MainMenuScreen.sbr" \ - "$(INTDIR)\MessageBoxScreen.sbr" \ - "$(INTDIR)\Options Screen.sbr" \ - "$(INTDIR)\SaveLoadGame.sbr" \ - "$(INTDIR)\SaveLoadScreen.sbr" \ - "$(INTDIR)\SCREENS.sbr" \ - "$(INTDIR)\Sys Globals.sbr" - -"$(OUTDIR)\JA2.bsc" : "$(OUTDIR)" $(BSC32_SBRS) - $(BSC32) @<< - $(BSC32_FLAGS) $(BSC32_SBRS) -<< - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map:"$(INTDIR)\ja2.map" /debug /machine:I386 /out:"d:\ja2demo\ja2.exe" -LINK32_OBJS= \ - "$(INTDIR)\_Ja25GermanText.obj" \ - "$(INTDIR)\aniviewscreen.obj" \ - "$(INTDIR)\Credits.obj" \ - "$(INTDIR)\Cursors.obj" \ - "$(INTDIR)\Fade Screen.obj" \ - "$(INTDIR)\GameInitOptionsScreen.obj" \ - "$(INTDIR)\gameloop.obj" \ - "$(INTDIR)\gamescreen.obj" \ - "$(INTDIR)\GameSettings.obj" \ - "$(INTDIR)\GameVersion.obj" \ - "$(INTDIR)\HelpScreen.obj" \ - "$(INTDIR)\Init.obj" \ - "$(INTDIR)\Intro.obj" \ - "$(INTDIR)\JA2 Splash.obj" \ - "$(INTDIR)\jascreens.obj" \ - "$(INTDIR)\Loading Screen.obj" \ - "$(INTDIR)\MainMenuScreen.obj" \ - "$(INTDIR)\MessageBoxScreen.obj" \ - "$(INTDIR)\Options Screen.obj" \ - "$(INTDIR)\SaveLoadGame.obj" \ - "$(INTDIR)\SaveLoadScreen.obj" \ - "$(INTDIR)\SCREENS.obj" \ - "$(INTDIR)\Sys Globals.obj" \ - "$(INTDIR)\ja2.res" \ - ".\TileEngine\Demo Release with Debug\TileEngine.lib" \ - ".\Standard Gaming Platform\Standar2\Standard Gaming Platform.lib" \ - ".\Tactical\Demo Release with Debug\Tactical.lib" \ - ".\Utils\Demo Release with Debug\Utils.lib" \ - ".\TacticalAI\Demo Release with Debug\TacticalAI.lib" \ - ".\Editor\Demo Release with Debug\Editor.lib" \ - ".\Laptop\Demo Release with Debug\Laptop.lib" \ - ".\Strategic\Demo Release with Debug\Strategic.lib" - -"..\..\ja2demo\ja2.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" - -OUTDIR=.\Demo Bounds Checker -INTDIR=.\Demo Bounds Checker -# Begin Custom Macros -OutDir=.\Demo Bounds Checker -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "..\..\ja2.exe" "$(OUTDIR)\JA2.bsc" - -!ELSE - -ALL : "Strategic - Win32 Demo Bounds Checker" "Laptop - Win32 Demo Bounds Checker" "Editor - Win32 Demo Bounds Checker" "TacticalAI - Win32 Demo Bounds Checker" "Utils - Win32 Demo Bounds Checker" "Tactical - Win32 Demo Bounds Checker" "TileEngine - Win32 Demo Bounds Checker" "..\..\ja2.exe" "$(OUTDIR)\JA2.bsc" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"TileEngine - Win32 Demo Bounds CheckerCLEAN" "Tactical - Win32 Demo Bounds CheckerCLEAN" "Utils - Win32 Demo Bounds CheckerCLEAN" "TacticalAI - Win32 Demo Bounds CheckerCLEAN" "Editor - Win32 Demo Bounds CheckerCLEAN" "Laptop - Win32 Demo Bounds CheckerCLEAN" "Strategic - Win32 Demo Bounds CheckerCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\_Ja25GermanText.obj" - -@erase "$(INTDIR)\_Ja25GermanText.sbr" - -@erase "$(INTDIR)\aniviewscreen.obj" - -@erase "$(INTDIR)\aniviewscreen.sbr" - -@erase "$(INTDIR)\Credits.obj" - -@erase "$(INTDIR)\Credits.sbr" - -@erase "$(INTDIR)\Cursors.obj" - -@erase "$(INTDIR)\Cursors.sbr" - -@erase "$(INTDIR)\Fade Screen.obj" - -@erase "$(INTDIR)\Fade Screen.sbr" - -@erase "$(INTDIR)\GameInitOptionsScreen.obj" - -@erase "$(INTDIR)\GameInitOptionsScreen.sbr" - -@erase "$(INTDIR)\gameloop.obj" - -@erase "$(INTDIR)\gameloop.sbr" - -@erase "$(INTDIR)\gamescreen.obj" - -@erase "$(INTDIR)\gamescreen.sbr" - -@erase "$(INTDIR)\GameSettings.obj" - -@erase "$(INTDIR)\GameSettings.sbr" - -@erase "$(INTDIR)\GameVersion.obj" - -@erase "$(INTDIR)\GameVersion.sbr" - -@erase "$(INTDIR)\HelpScreen.obj" - -@erase "$(INTDIR)\HelpScreen.sbr" - -@erase "$(INTDIR)\Init.obj" - -@erase "$(INTDIR)\Init.sbr" - -@erase "$(INTDIR)\Intro.obj" - -@erase "$(INTDIR)\Intro.sbr" - -@erase "$(INTDIR)\JA2 Splash.obj" - -@erase "$(INTDIR)\JA2 Splash.sbr" - -@erase "$(INTDIR)\ja2.res" - -@erase "$(INTDIR)\jascreens.obj" - -@erase "$(INTDIR)\jascreens.sbr" - -@erase "$(INTDIR)\Loading Screen.obj" - -@erase "$(INTDIR)\Loading Screen.sbr" - -@erase "$(INTDIR)\MainMenuScreen.obj" - -@erase "$(INTDIR)\MainMenuScreen.sbr" - -@erase "$(INTDIR)\MessageBoxScreen.obj" - -@erase "$(INTDIR)\MessageBoxScreen.sbr" - -@erase "$(INTDIR)\Options Screen.obj" - -@erase "$(INTDIR)\Options Screen.sbr" - -@erase "$(INTDIR)\SaveLoadGame.obj" - -@erase "$(INTDIR)\SaveLoadGame.sbr" - -@erase "$(INTDIR)\SaveLoadScreen.obj" - -@erase "$(INTDIR)\SaveLoadScreen.sbr" - -@erase "$(INTDIR)\SCREENS.obj" - -@erase "$(INTDIR)\SCREENS.sbr" - -@erase "$(INTDIR)\Sys Globals.obj" - -@erase "$(INTDIR)\Sys Globals.sbr" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\JA2.bsc" - -@erase "$(OUTDIR)\ja2.map" - -@erase "..\..\ja2.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\Laptop" /D "_DEBUG" /D "BOUNDS_CHECKER" /D "JA2DEMO" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\JA2.pch" /YX"JA2 All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ja2.res" /d "_DEBUG" -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\JA2.bsc" -BSC32_SBRS= \ - "$(INTDIR)\_Ja25GermanText.sbr" \ - "$(INTDIR)\aniviewscreen.sbr" \ - "$(INTDIR)\Credits.sbr" \ - "$(INTDIR)\Cursors.sbr" \ - "$(INTDIR)\Fade Screen.sbr" \ - "$(INTDIR)\GameInitOptionsScreen.sbr" \ - "$(INTDIR)\gameloop.sbr" \ - "$(INTDIR)\gamescreen.sbr" \ - "$(INTDIR)\GameSettings.sbr" \ - "$(INTDIR)\GameVersion.sbr" \ - "$(INTDIR)\HelpScreen.sbr" \ - "$(INTDIR)\Init.sbr" \ - "$(INTDIR)\Intro.sbr" \ - "$(INTDIR)\JA2 Splash.sbr" \ - "$(INTDIR)\jascreens.sbr" \ - "$(INTDIR)\Loading Screen.sbr" \ - "$(INTDIR)\MainMenuScreen.sbr" \ - "$(INTDIR)\MessageBoxScreen.sbr" \ - "$(INTDIR)\Options Screen.sbr" \ - "$(INTDIR)\SaveLoadGame.sbr" \ - "$(INTDIR)\SaveLoadScreen.sbr" \ - "$(INTDIR)\SCREENS.sbr" \ - "$(INTDIR)\Sys Globals.sbr" - -"$(OUTDIR)\JA2.bsc" : "$(OUTDIR)" $(BSC32_SBRS) - $(BSC32) @<< - $(BSC32_FLAGS) $(BSC32_SBRS) -<< - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map:"$(INTDIR)\ja2.map" /debug /machine:I386 /out:"..\..\ja2.exe" -LINK32_OBJS= \ - "$(INTDIR)\_Ja25GermanText.obj" \ - "$(INTDIR)\aniviewscreen.obj" \ - "$(INTDIR)\Credits.obj" \ - "$(INTDIR)\Cursors.obj" \ - "$(INTDIR)\Fade Screen.obj" \ - "$(INTDIR)\GameInitOptionsScreen.obj" \ - "$(INTDIR)\gameloop.obj" \ - "$(INTDIR)\gamescreen.obj" \ - "$(INTDIR)\GameSettings.obj" \ - "$(INTDIR)\GameVersion.obj" \ - "$(INTDIR)\HelpScreen.obj" \ - "$(INTDIR)\Init.obj" \ - "$(INTDIR)\Intro.obj" \ - "$(INTDIR)\JA2 Splash.obj" \ - "$(INTDIR)\jascreens.obj" \ - "$(INTDIR)\Loading Screen.obj" \ - "$(INTDIR)\MainMenuScreen.obj" \ - "$(INTDIR)\MessageBoxScreen.obj" \ - "$(INTDIR)\Options Screen.obj" \ - "$(INTDIR)\SaveLoadGame.obj" \ - "$(INTDIR)\SaveLoadScreen.obj" \ - "$(INTDIR)\SCREENS.obj" \ - "$(INTDIR)\Sys Globals.obj" \ - "$(INTDIR)\ja2.res" \ - ".\TileEngine\Demo Bounds Checker\TileEngine.lib" \ - ".\Tactical\Demo Bounds Checker\Tactical.lib" \ - ".\Utils\Demo Bounds Checker\Utils.lib" \ - ".\TacticalAI\Demo Bounds Checker\TacticalAI.lib" \ - ".\Editor\Demo Bounds Checker\Editor.lib" \ - ".\Laptop\Demo Bounds Checker\Laptop.lib" \ - ".\Strategic\Demo Bounds Checker\Strategic.lib" - -"..\..\ja2.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - - -!IF "$(NO_EXTERNAL_DEPS)" != "1" -!IF EXISTS("JA2.dep") -!INCLUDE "JA2.dep" -!ELSE -!MESSAGE Warning: cannot find "JA2.dep" -!ENDIF -!ENDIF - - -!IF "$(CFG)" == "ja2 - Win32 Release" || "$(CFG)" == "ja2 - Win32 Debug" || "$(CFG)" == "ja2 - Win32 Release with Debug Info" || "$(CFG)" == "ja2 - Win32 Bounds Checker" || "$(CFG)" == "ja2 - Win32 Debug Demo" || "$(CFG)" == "ja2 - Win32 Release Demo" || "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" || "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" -SOURCE=.\Utils\_Ja25GermanText.cpp - -"$(INTDIR)\_Ja25GermanText.obj" "$(INTDIR)\_Ja25GermanText.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\aniviewscreen.cpp - -"$(INTDIR)\aniviewscreen.obj" "$(INTDIR)\aniviewscreen.sbr" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\Credits.cpp - -"$(INTDIR)\Credits.obj" "$(INTDIR)\Credits.sbr" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\Utils\Cursors.cpp - -"$(INTDIR)\Cursors.obj" "$(INTDIR)\Cursors.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=".\Fade Screen.cpp" - -"$(INTDIR)\Fade Screen.obj" "$(INTDIR)\Fade Screen.sbr" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\GameInitOptionsScreen.cpp - -"$(INTDIR)\GameInitOptionsScreen.obj" "$(INTDIR)\GameInitOptionsScreen.sbr" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\gameloop.cpp - -"$(INTDIR)\gameloop.obj" "$(INTDIR)\gameloop.sbr" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\gamescreen.cpp - -"$(INTDIR)\gamescreen.obj" "$(INTDIR)\gamescreen.sbr" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\GameSettings.cpp - -"$(INTDIR)\GameSettings.obj" "$(INTDIR)\GameSettings.sbr" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\GameVersion.cpp - -"$(INTDIR)\GameVersion.obj" "$(INTDIR)\GameVersion.sbr" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\HelpScreen.cpp - -"$(INTDIR)\HelpScreen.obj" "$(INTDIR)\HelpScreen.sbr" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\Init.cpp - -"$(INTDIR)\Init.obj" "$(INTDIR)\Init.sbr" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\Intro.cpp - -"$(INTDIR)\Intro.obj" "$(INTDIR)\Intro.sbr" : $(SOURCE) "$(INTDIR)" - - -SOURCE=".\JA2 Splash.cpp" - -"$(INTDIR)\JA2 Splash.obj" "$(INTDIR)\JA2 Splash.sbr" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\Res\ja2.rc - -!IF "$(CFG)" == "ja2 - Win32 Release" - - -"$(INTDIR)\ja2.res" : $(SOURCE) "$(INTDIR)" - $(RSC) /l 0x409 /fo"$(INTDIR)\ja2.res" /i "Res" /i ".\Res" /d "NDEBUG" $(SOURCE) - - -!ELSEIF "$(CFG)" == "ja2 - Win32 Debug" - - -"$(INTDIR)\ja2.res" : $(SOURCE) "$(INTDIR)" - $(RSC) /l 0x409 /fo"$(INTDIR)\ja2.res" /i "Res" /i ".\Res" /d "_DEBUG" $(SOURCE) - - -!ELSEIF "$(CFG)" == "ja2 - Win32 Release with Debug Info" - - -"$(INTDIR)\ja2.res" : $(SOURCE) "$(INTDIR)" - $(RSC) /l 0x409 /fo"$(INTDIR)\ja2.res" /i "Res" /i ".\Res" /d "NDEBUG" $(SOURCE) - - -!ELSEIF "$(CFG)" == "ja2 - Win32 Bounds Checker" - - -"$(INTDIR)\ja2.res" : $(SOURCE) "$(INTDIR)" - $(RSC) /l 0x409 /fo"$(INTDIR)\ja2.res" /i "Res" /i ".\Res" /d "_DEBUG" $(SOURCE) - - -!ELSEIF "$(CFG)" == "ja2 - Win32 Debug Demo" - - -"$(INTDIR)\ja2.res" : $(SOURCE) "$(INTDIR)" - $(RSC) /l 0x409 /fo"$(INTDIR)\ja2.res" /i "Res" /i ".\Res" /d "_DEBUG" $(SOURCE) - - -!ELSEIF "$(CFG)" == "ja2 - Win32 Release Demo" - - -"$(INTDIR)\ja2.res" : $(SOURCE) "$(INTDIR)" - $(RSC) /l 0x409 /fo"$(INTDIR)\ja2.res" /i "Res" /i ".\Res" /d "NDEBUG" $(SOURCE) - - -!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" - - -"$(INTDIR)\ja2.res" : $(SOURCE) "$(INTDIR)" - $(RSC) /l 0x409 /fo"$(INTDIR)\ja2.res" /i "Res" /i ".\Res" /d "NDEBUG" $(SOURCE) - - -!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" - - -"$(INTDIR)\ja2.res" : $(SOURCE) "$(INTDIR)" - $(RSC) /l 0x409 /fo"$(INTDIR)\ja2.res" /i "Res" /i ".\Res" /d "_DEBUG" $(SOURCE) - - -!ENDIF - -SOURCE=.\jascreens.cpp - -"$(INTDIR)\jascreens.obj" "$(INTDIR)\jascreens.sbr" : $(SOURCE) "$(INTDIR)" - - -SOURCE=".\Loading Screen.cpp" - -"$(INTDIR)\Loading Screen.obj" "$(INTDIR)\Loading Screen.sbr" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\MainMenuScreen.cpp - -"$(INTDIR)\MainMenuScreen.obj" "$(INTDIR)\MainMenuScreen.sbr" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\MessageBoxScreen.cpp - -"$(INTDIR)\MessageBoxScreen.obj" "$(INTDIR)\MessageBoxScreen.sbr" : $(SOURCE) "$(INTDIR)" - - -SOURCE=".\Options Screen.cpp" - -"$(INTDIR)\Options Screen.obj" "$(INTDIR)\Options Screen.sbr" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\SaveLoadGame.cpp - -"$(INTDIR)\SaveLoadGame.obj" "$(INTDIR)\SaveLoadGame.sbr" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\SaveLoadScreen.cpp - -"$(INTDIR)\SaveLoadScreen.obj" "$(INTDIR)\SaveLoadScreen.sbr" : $(SOURCE) "$(INTDIR)" - - -SOURCE=.\SCREENS.cpp - -"$(INTDIR)\SCREENS.obj" "$(INTDIR)\SCREENS.sbr" : $(SOURCE) "$(INTDIR)" - - -SOURCE=".\Sys Globals.cpp" - -"$(INTDIR)\Sys Globals.obj" "$(INTDIR)\Sys Globals.sbr" : $(SOURCE) "$(INTDIR)" - - -!IF "$(CFG)" == "ja2 - Win32 Release" - -"TileEngine - Win32 Release" : - cd ".\TileEngine" - $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Release" - cd ".." - -"TileEngine - Win32 ReleaseCLEAN" : - cd ".\TileEngine" - $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Release" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Debug" - -"TileEngine - Win32 Debug" : - cd ".\TileEngine" - $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Debug" - cd ".." - -"TileEngine - Win32 DebugCLEAN" : - cd ".\TileEngine" - $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Debug" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Release with Debug Info" - -"TileEngine - Win32 Release with Debug Info" : - cd ".\TileEngine" - $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Release with Debug Info" - cd ".." - -"TileEngine - Win32 Release with Debug InfoCLEAN" : - cd ".\TileEngine" - $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Release with Debug Info" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Bounds Checker" - -"TileEngine - Win32 Bounds Checker" : - cd ".\TileEngine" - $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Bounds Checker" - cd ".." - -"TileEngine - Win32 Bounds CheckerCLEAN" : - cd ".\TileEngine" - $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Bounds Checker" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Debug Demo" - -"TileEngine - Win32 Debug Demo" : - cd ".\TileEngine" - $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Debug Demo" - cd ".." - -"TileEngine - Win32 Debug DemoCLEAN" : - cd ".\TileEngine" - $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Debug Demo" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Release Demo" - -"TileEngine - Win32 Release Demo" : - cd ".\TileEngine" - $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Release Demo" - cd ".." - -"TileEngine - Win32 Release DemoCLEAN" : - cd ".\TileEngine" - $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Release Demo" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" - -"TileEngine - Win32 Demo Release with Debug Info" : - cd ".\TileEngine" - $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Demo Release with Debug Info" - cd ".." - -"TileEngine - Win32 Demo Release with Debug InfoCLEAN" : - cd ".\TileEngine" - $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Demo Release with Debug Info" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" - -"TileEngine - Win32 Demo Bounds Checker" : - cd ".\TileEngine" - $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Demo Bounds Checker" - cd ".." - -"TileEngine - Win32 Demo Bounds CheckerCLEAN" : - cd ".\TileEngine" - $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Demo Bounds Checker" RECURSE=1 CLEAN - cd ".." - -!ENDIF - -!IF "$(CFG)" == "ja2 - Win32 Release" - -"Standard Gaming Platform - Win32 Release" : - cd ".\Standard Gaming Platform" - $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Release" - cd ".." - -"Standard Gaming Platform - Win32 ReleaseCLEAN" : - cd ".\Standard Gaming Platform" - $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Release" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Debug" - -"Standard Gaming Platform - Win32 Debug" : - cd ".\Standard Gaming Platform" - $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Debug" - cd ".." - -"Standard Gaming Platform - Win32 DebugCLEAN" : - cd ".\Standard Gaming Platform" - $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Debug" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Release with Debug Info" - -"Standard Gaming Platform - Win32 Release with Debug Info" : - cd ".\Standard Gaming Platform" - $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Release with Debug Info" - cd ".." - -"Standard Gaming Platform - Win32 Release with Debug InfoCLEAN" : - cd ".\Standard Gaming Platform" - $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Release with Debug Info" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Bounds Checker" - -"Standard Gaming Platform - Win32 Bounds Checker" : - cd ".\Standard Gaming Platform" - $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Bounds Checker" - cd ".." - -"Standard Gaming Platform - Win32 Bounds CheckerCLEAN" : - cd ".\Standard Gaming Platform" - $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Bounds Checker" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Debug Demo" - -"Standard Gaming Platform - Win32 Debug Demo" : - cd ".\Standard Gaming Platform" - $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Debug Demo" - cd ".." - -"Standard Gaming Platform - Win32 Debug DemoCLEAN" : - cd ".\Standard Gaming Platform" - $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Debug Demo" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Release Demo" - -"Standard Gaming Platform - Win32 Release Demo" : - cd ".\Standard Gaming Platform" - $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Release Demo" - cd ".." - -"Standard Gaming Platform - Win32 Release DemoCLEAN" : - cd ".\Standard Gaming Platform" - $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Release Demo" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" - -"Standard Gaming Platform - Win32 Demo Release with Debug Info" : - cd ".\Standard Gaming Platform" - $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Demo Release with Debug Info" - cd ".." - -"Standard Gaming Platform - Win32 Demo Release with Debug InfoCLEAN" : - cd ".\Standard Gaming Platform" - $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Demo Release with Debug Info" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" - -!ENDIF - -!IF "$(CFG)" == "ja2 - Win32 Release" - -"Tactical - Win32 Release" : - cd ".\Tactical" - $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Release" - cd ".." - -"Tactical - Win32 ReleaseCLEAN" : - cd ".\Tactical" - $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Release" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Debug" - -"Tactical - Win32 Debug" : - cd ".\Tactical" - $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Debug" - cd ".." - -"Tactical - Win32 DebugCLEAN" : - cd ".\Tactical" - $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Debug" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Release with Debug Info" - -"Tactical - Win32 Release with Debug Info" : - cd ".\Tactical" - $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Release with Debug Info" - cd ".." - -"Tactical - Win32 Release with Debug InfoCLEAN" : - cd ".\Tactical" - $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Release with Debug Info" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Bounds Checker" - -"Tactical - Win32 Bounds Checker" : - cd ".\Tactical" - $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Bounds Checker" - cd ".." - -"Tactical - Win32 Bounds CheckerCLEAN" : - cd ".\Tactical" - $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Bounds Checker" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Debug Demo" - -"Tactical - Win32 Debug Demo" : - cd ".\Tactical" - $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Debug Demo" - cd ".." - -"Tactical - Win32 Debug DemoCLEAN" : - cd ".\Tactical" - $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Debug Demo" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Release Demo" - -"Tactical - Win32 Release Demo" : - cd ".\Tactical" - $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Release Demo" - cd ".." - -"Tactical - Win32 Release DemoCLEAN" : - cd ".\Tactical" - $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Release Demo" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" - -"Tactical - Win32 Demo Release with Debug Info" : - cd ".\Tactical" - $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Demo Release with Debug Info" - cd ".." - -"Tactical - Win32 Demo Release with Debug InfoCLEAN" : - cd ".\Tactical" - $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Demo Release with Debug Info" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" - -"Tactical - Win32 Demo Bounds Checker" : - cd ".\Tactical" - $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Demo Bounds Checker" - cd ".." - -"Tactical - Win32 Demo Bounds CheckerCLEAN" : - cd ".\Tactical" - $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Demo Bounds Checker" RECURSE=1 CLEAN - cd ".." - -!ENDIF - -!IF "$(CFG)" == "ja2 - Win32 Release" - -"Utils - Win32 Release" : - cd ".\Utils" - $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Release" - cd ".." - -"Utils - Win32 ReleaseCLEAN" : - cd ".\Utils" - $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Release" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Debug" - -"Utils - Win32 Debug" : - cd ".\Utils" - $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Debug" - cd ".." - -"Utils - Win32 DebugCLEAN" : - cd ".\Utils" - $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Debug" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Release with Debug Info" - -"Utils - Win32 Release with Debug Info" : - cd ".\Utils" - $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Release with Debug Info" - cd ".." - -"Utils - Win32 Release with Debug InfoCLEAN" : - cd ".\Utils" - $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Release with Debug Info" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Bounds Checker" - -"Utils - Win32 Bounds Checker" : - cd ".\Utils" - $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Bounds Checker" - cd ".." - -"Utils - Win32 Bounds CheckerCLEAN" : - cd ".\Utils" - $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Bounds Checker" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Debug Demo" - -"Utils - Win32 Debug Demo" : - cd ".\Utils" - $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Debug Demo" - cd ".." - -"Utils - Win32 Debug DemoCLEAN" : - cd ".\Utils" - $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Debug Demo" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Release Demo" - -"Utils - Win32 Release Demo" : - cd ".\Utils" - $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Release Demo" - cd ".." - -"Utils - Win32 Release DemoCLEAN" : - cd ".\Utils" - $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Release Demo" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" - -"Utils - Win32 Demo Release with Debug Info" : - cd ".\Utils" - $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Demo Release with Debug Info" - cd ".." - -"Utils - Win32 Demo Release with Debug InfoCLEAN" : - cd ".\Utils" - $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Demo Release with Debug Info" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" - -"Utils - Win32 Demo Bounds Checker" : - cd ".\Utils" - $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Demo Bounds Checker" - cd ".." - -"Utils - Win32 Demo Bounds CheckerCLEAN" : - cd ".\Utils" - $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Demo Bounds Checker" RECURSE=1 CLEAN - cd ".." - -!ENDIF - -!IF "$(CFG)" == "ja2 - Win32 Release" - -"TacticalAI - Win32 Release" : - cd ".\TacticalAI" - $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Release" - cd ".." - -"TacticalAI - Win32 ReleaseCLEAN" : - cd ".\TacticalAI" - $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Release" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Debug" - -"TacticalAI - Win32 Debug" : - cd ".\TacticalAI" - $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Debug" - cd ".." - -"TacticalAI - Win32 DebugCLEAN" : - cd ".\TacticalAI" - $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Debug" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Release with Debug Info" - -"TacticalAI - Win32 Release with Debug Info" : - cd ".\TacticalAI" - $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Release with Debug Info" - cd ".." - -"TacticalAI - Win32 Release with Debug InfoCLEAN" : - cd ".\TacticalAI" - $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Release with Debug Info" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Bounds Checker" - -"TacticalAI - Win32 Bounds Checker" : - cd ".\TacticalAI" - $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Bounds Checker" - cd ".." - -"TacticalAI - Win32 Bounds CheckerCLEAN" : - cd ".\TacticalAI" - $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Bounds Checker" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Debug Demo" - -"TacticalAI - Win32 Debug Demo" : - cd ".\TacticalAI" - $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Debug Demo" - cd ".." - -"TacticalAI - Win32 Debug DemoCLEAN" : - cd ".\TacticalAI" - $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Debug Demo" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Release Demo" - -"TacticalAI - Win32 Release Demo" : - cd ".\TacticalAI" - $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Release Demo" - cd ".." - -"TacticalAI - Win32 Release DemoCLEAN" : - cd ".\TacticalAI" - $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Release Demo" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" - -"TacticalAI - Win32 Demo Release with Debug Info" : - cd ".\TacticalAI" - $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Demo Release with Debug Info" - cd ".." - -"TacticalAI - Win32 Demo Release with Debug InfoCLEAN" : - cd ".\TacticalAI" - $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Demo Release with Debug Info" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" - -"TacticalAI - Win32 Demo Bounds Checker" : - cd ".\TacticalAI" - $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Demo Bounds Checker" - cd ".." - -"TacticalAI - Win32 Demo Bounds CheckerCLEAN" : - cd ".\TacticalAI" - $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Demo Bounds Checker" RECURSE=1 CLEAN - cd ".." - -!ENDIF - -!IF "$(CFG)" == "ja2 - Win32 Release" - -"Editor - Win32 Release" : - cd ".\Editor" - $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Release" - cd ".." - -"Editor - Win32 ReleaseCLEAN" : - cd ".\Editor" - $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Release" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Debug" - -"Editor - Win32 Debug" : - cd ".\Editor" - $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Debug" - cd ".." - -"Editor - Win32 DebugCLEAN" : - cd ".\Editor" - $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Debug" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Release with Debug Info" - -"Editor - Win32 Release with Debug Info" : - cd ".\Editor" - $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Release with Debug Info" - cd ".." - -"Editor - Win32 Release with Debug InfoCLEAN" : - cd ".\Editor" - $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Release with Debug Info" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Bounds Checker" - -"Editor - Win32 Bounds Checker" : - cd ".\Editor" - $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Bounds Checker" - cd ".." - -"Editor - Win32 Bounds CheckerCLEAN" : - cd ".\Editor" - $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Bounds Checker" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Debug Demo" - -"Editor - Win32 Debug Demo" : - cd ".\Editor" - $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Debug Demo" - cd ".." - -"Editor - Win32 Debug DemoCLEAN" : - cd ".\Editor" - $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Debug Demo" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Release Demo" - -"Editor - Win32 Release Demo" : - cd ".\Editor" - $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Release Demo" - cd ".." - -"Editor - Win32 Release DemoCLEAN" : - cd ".\Editor" - $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Release Demo" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" - -"Editor - Win32 Demo Release with Debug Info" : - cd ".\Editor" - $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Demo Release with Debug Info" - cd ".." - -"Editor - Win32 Demo Release with Debug InfoCLEAN" : - cd ".\Editor" - $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Demo Release with Debug Info" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" - -"Editor - Win32 Demo Bounds Checker" : - cd ".\Editor" - $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Demo Bounds Checker" - cd ".." - -"Editor - Win32 Demo Bounds CheckerCLEAN" : - cd ".\Editor" - $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Demo Bounds Checker" RECURSE=1 CLEAN - cd ".." - -!ENDIF - -!IF "$(CFG)" == "ja2 - Win32 Release" - -"Laptop - Win32 Release" : - cd ".\Laptop" - $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Release" - cd ".." - -"Laptop - Win32 ReleaseCLEAN" : - cd ".\Laptop" - $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Release" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Debug" - -"Laptop - Win32 Debug" : - cd ".\Laptop" - $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Debug" - cd ".." - -"Laptop - Win32 DebugCLEAN" : - cd ".\Laptop" - $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Debug" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Release with Debug Info" - -"Laptop - Win32 Release with Debug Info" : - cd ".\Laptop" - $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Release with Debug Info" - cd ".." - -"Laptop - Win32 Release with Debug InfoCLEAN" : - cd ".\Laptop" - $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Release with Debug Info" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Bounds Checker" - -"Laptop - Win32 Bounds Checker" : - cd ".\Laptop" - $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Bounds Checker" - cd ".." - -"Laptop - Win32 Bounds CheckerCLEAN" : - cd ".\Laptop" - $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Bounds Checker" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Debug Demo" - -"Laptop - Win32 Debug Demo" : - cd ".\Laptop" - $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Debug Demo" - cd ".." - -"Laptop - Win32 Debug DemoCLEAN" : - cd ".\Laptop" - $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Debug Demo" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Release Demo" - -"Laptop - Win32 Release Demo" : - cd ".\Laptop" - $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Release Demo" - cd ".." - -"Laptop - Win32 Release DemoCLEAN" : - cd ".\Laptop" - $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Release Demo" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" - -"Laptop - Win32 Demo Release with Debug Info" : - cd ".\Laptop" - $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Demo Release with Debug Info" - cd ".." - -"Laptop - Win32 Demo Release with Debug InfoCLEAN" : - cd ".\Laptop" - $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Demo Release with Debug Info" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" - -"Laptop - Win32 Demo Bounds Checker" : - cd ".\Laptop" - $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Demo Bounds Checker" - cd ".." - -"Laptop - Win32 Demo Bounds CheckerCLEAN" : - cd ".\Laptop" - $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Demo Bounds Checker" RECURSE=1 CLEAN - cd ".." - -!ENDIF - -!IF "$(CFG)" == "ja2 - Win32 Release" - -"Strategic - Win32 Release" : - cd ".\Strategic" - $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Release" - cd ".." - -"Strategic - Win32 ReleaseCLEAN" : - cd ".\Strategic" - $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Release" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Debug" - -"Strategic - Win32 Debug" : - cd ".\Strategic" - $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Debug" - cd ".." - -"Strategic - Win32 DebugCLEAN" : - cd ".\Strategic" - $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Debug" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Release with Debug Info" - -"Strategic - Win32 Release with Debug Info" : - cd ".\Strategic" - $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Release with Debug Info" - cd ".." - -"Strategic - Win32 Release with Debug InfoCLEAN" : - cd ".\Strategic" - $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Release with Debug Info" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Bounds Checker" - -"Strategic - Win32 Bounds Checker" : - cd ".\Strategic" - $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Bounds Checker" - cd ".." - -"Strategic - Win32 Bounds CheckerCLEAN" : - cd ".\Strategic" - $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Bounds Checker" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Debug Demo" - -"Strategic - Win32 Debug Demo" : - cd ".\Strategic" - $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Debug Demo" - cd ".." - -"Strategic - Win32 Debug DemoCLEAN" : - cd ".\Strategic" - $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Debug Demo" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Release Demo" - -"Strategic - Win32 Release Demo" : - cd ".\Strategic" - $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Release Demo" - cd ".." - -"Strategic - Win32 Release DemoCLEAN" : - cd ".\Strategic" - $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Release Demo" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" - -"Strategic - Win32 Demo Release with Debug Info" : - cd ".\Strategic" - $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Demo Release with Debug Info" - cd ".." - -"Strategic - Win32 Demo Release with Debug InfoCLEAN" : - cd ".\Strategic" - $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Demo Release with Debug Info" RECURSE=1 CLEAN - cd ".." - -!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" - -"Strategic - Win32 Demo Bounds Checker" : - cd ".\Strategic" - $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Demo Bounds Checker" - cd ".." - -"Strategic - Win32 Demo Bounds CheckerCLEAN" : - cd ".\Strategic" - $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Demo Bounds Checker" RECURSE=1 CLEAN - cd ".." - -!ENDIF - - -!ENDIF - diff --git a/JA2.suo b/JA2.suo deleted file mode 100644 index fc00f21c..00000000 Binary files a/JA2.suo and /dev/null differ diff --git a/JA2.vcproj b/JA2.vcproj index 49e8205c..252a0ea0 100644 --- a/JA2.vcproj +++ b/JA2.vcproj @@ -43,7 +43,7 @@ - - diff --git a/Language Defines.cpp b/Language Defines.cpp new file mode 100644 index 00000000..111ec419 --- /dev/null +++ b/Language Defines.cpp @@ -0,0 +1,21 @@ +#include "Language Defines.h" + +#if defined(ENGLISH) +# pragma message(" (Language set to ENGLISH, You'll need english CDs)") +#elif defined(GERMAN) +# pragma message(" (Language set to GERMAN, You'll need Topware/german CDs)") +#elif defined(RUSSIAN) +# pragma message(" (Language set to RUSSIAN, You'll need russian CDs)") +#elif defined(DUTCH) +# pragma message(" (Language set to DUTCH, You'll need dutch CDs)") +#elif defined(POLISH) +# pragma message(" (Language set to POLISH, You'll need polish CDs)") +#elif defined(FRENCH) +# pragma message(" (Language set to FRENCH, You'll need french CDs)") +#elif defined(ITALIAN) +# pragma message(" (Language set to ITALIAN, You'll need italian CDs)") +#elif defined(TAIWANESE) +# pragma message(" (Language set to TAIWANESE, You'll need taiwanese CDs)") +#else +# error "At least You have to specify a Language somewhere. See comments above." +#endif diff --git a/Language Defines.h b/Language Defines.h index 8f2ce366..422807fa 100644 --- a/Language Defines.h +++ b/Language Defines.h @@ -15,16 +15,20 @@ * using one of the two later methods will keep this SVN file unchanged for the * future, only Your private project files (workspace/solution) will differ * from the SVN stuff. - * (2006-10-10, Sergeant_Kolja) + * (2006-10-10, Sergeant_Kolja) */ -#if !defined(ENGLISH) && !defined(GERMAN) && !defined(RUSSIAN) && !defined(DUTCH) && !defined(POLISH) +#if !defined(ENGLISH) && !defined(GERMAN) && !defined(RUSSIAN) && !defined(DUTCH) && !defined(POLISH) && !defined(FRENCH) && !defined(ITALIAN) && !defined(TAIWANESE) /* please set one manually here (by uncommenting) if not willingly to set Workspace wide */ #define ENGLISH //#define GERMAN //#define RUSSIAN //#define DUTCH //#define POLISH +//#define FRENCH +//#define ITALIAN +//#define TAIWANESE + #endif @@ -33,29 +37,16 @@ * Regardless of if we did it Workspace wide or by uncommenting above, * HERE we must see, what language was selected. If one, we */ -#if defined(ENGLISH) -# pragma message(" (Language set to ENGLISH, You'll need english CDs)") -#elif defined(GERMAN) -# pragma message(" (Language set to GERMAN, You'll need Topware/german CDs)") -#elif defined(RUSSIAN) -# pragma message(" (Language set to RUSSIAN, You'll need russian CDs)") -#elif defined(DUTCH) -# pragma message(" (Language set to DUTCH, You'll need dutch CDs)") -#elif defined(POLISH) -# pragma message(" (Language set to POLISH, You'll need polish CDs)") -#else +#if !defined(ENGLISH) && !defined(GERMAN) && !defined(RUSSIAN) && !defined(DUTCH) && !defined(POLISH) && !defined(FRENCH) && !defined(ITALIAN) && !defined(TAIWANESE) # error "At least You have to specify a Language somewhere. See comments above." #endif - -#define BLOOD_N_GORE_ENABLED - //if the language represents words as single chars #ifdef TAIWAN #define SINGLE_CHAR_WORDS #endif -#endif \ No newline at end of file +#endif diff --git a/Laptop/AimArchives.cpp b/Laptop/AimArchives.cpp index 41a5dfa5..5fe95614 100644 --- a/Laptop/AimArchives.cpp +++ b/Laptop/AimArchives.cpp @@ -60,7 +60,7 @@ #define AIM_ALUMNI_PAGE1_Y LAPTOP_SCREEN_WEB_UL_Y + 357 #define AIM_ALUMNI_PAGE_GAP BOTTOM_BUTTON_START_WIDTH + 25 -#define AIM_ALUMNI_PAGE_END_X AIM_ALUMNI_PAGE1_X + (BOTTOM_BUTTON_START_WIDTH + BOTTOM_BUTTON_START_WIDTH) * 3 +#define AIM_ALUMNI_PAGE_END_X AIM_ALUMNI_PAGE1_X + (BOTTOM_BUTTON_START_WIDTH + BOTTOM_BUTTON_START_WIDTH) * 3 #define AIM_ALUMNI_PAGE_END_Y AIM_ALUMNI_PAGE1_Y + BOTTOM_BUTTON_START_HEIGHT #define AIM_ALUMNI_TITLE_X IMAGE_OFFSET_X + 149 @@ -71,12 +71,12 @@ #define AIM_POPUP_TEXT_WIDTH 296 #define AIM_POPUP_SECTION_HEIGHT 9 -#define AIM_POPUP_X LAPTOP_SCREEN_UL_X + (500-AIM_POPUP_WIDTH)/2 +#define AIM_POPUP_X LAPTOP_SCREEN_UL_X + (500-AIM_POPUP_WIDTH)/2 #define AIM_POPUP_Y iScreenHeightOffset + 120 + LAPTOP_SCREEN_WEB_DELTA_Y #define AIM_POPUP_SHADOW_GAP 4 -#define AIM_POPUP_TEXT_X AIM_POPUP_X +#define AIM_POPUP_TEXT_X AIM_POPUP_X #define AIM_ALUMNI_FACE_PANEL_X AIM_POPUP_X + 6 #define AIM_ALUMNI_FACE_PANEL_Y AIM_POPUP_Y + 6 @@ -91,7 +91,7 @@ #define AIM_ALUMNI_DONE_X AIM_POPUP_X + AIM_POPUP_WIDTH - AIM_ALUMNI_DONE_WIDTH - 7 #define AIM_ALUMNI_DONE_WIDTH 36 -#define AIM_ALUMNI_DONE_HEIGHT 16 +#define AIM_ALUMNI_DONE_HEIGHT 16 #define AIM_ALUMNI_NAME_SIZE 80 * 2 #define AIM_ALUMNI_DECRIPTION_SIZE 80 * 7 * 2 @@ -160,7 +160,7 @@ void EnterInitAimArchives() BOOLEAN EnterAimArchives() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; UINT16 usPosX, i; @@ -207,17 +207,17 @@ BOOLEAN EnterAimArchives() InitAlumniFaceRegions(); //Load graphic for buttons - guiAlumniPageButtonImage = LoadButtonImage("LAPTOP\\BottomButtons2.sti", -1,0,-1,1,-1 ); + guiAlumniPageButtonImage = LoadButtonImage("LAPTOP\\BottomButtons2.sti", -1,0,-1,1,-1 ); usPosX = AIM_ALUMNI_PAGE1_X; for(i=0; i<3; i++) { - guiAlumniPageButton[i] = CreateIconAndTextButton( guiAlumniPageButtonImage, AimAlumniText[i], AIM_ALUMNI_PAGE_FONT, - AIM_ALUMNI_PAGE_COLOR_UP, DEFAULT_SHADOW, - AIM_ALUMNI_PAGE_COLOR_DOWN, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - usPosX, AIM_ALUMNI_PAGE1_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnAlumniPageButtonCallback); + guiAlumniPageButton[i] = CreateIconAndTextButton( guiAlumniPageButtonImage, AimAlumniText[i], AIM_ALUMNI_PAGE_FONT, + AIM_ALUMNI_PAGE_COLOR_UP, DEFAULT_SHADOW, + AIM_ALUMNI_PAGE_COLOR_DOWN, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + usPosX, AIM_ALUMNI_PAGE1_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnAlumniPageButtonCallback); SetButtonCursor(guiAlumniPageButton[i], CURSOR_WWW); MSYS_SetBtnUserData( guiAlumniPageButton[i], 0, i); @@ -280,13 +280,13 @@ void RenderAimArchives() { HVOBJECT hFrameHandle; HVOBJECT hFaceHandle; -// HVOBJECT hBottomButtonHandle; +// HVOBJECT hBottomButtonHandle; UINT16 usPosX, usPosY,x,y,i=0; UINT8 ubNumRows=0; UINT32 uiStartLoc=0; CHAR16 sText[400]; - + DrawAimDefaults(); DisableAimButton(); @@ -324,7 +324,7 @@ void RenderAimArchives() { //Blt face to screen BltVideoObject(FRAME_BUFFER, hFaceHandle, i,usPosX+4, usPosY+4, VO_BLT_SRCTRANSPARENCY,NULL); - + //Blt the alumni frame background BltVideoObject(FRAME_BUFFER, hFrameHandle, 0,usPosX, usPosY, VO_BLT_SRCTRANSPARENCY,NULL); @@ -332,7 +332,7 @@ void RenderAimArchives() uiStartLoc = AIM_ALUMNI_NAME_LINESIZE * i; LoadEncryptedDataFromFile(AIM_ALUMNI_NAME_FILE, sText, uiStartLoc, AIM_ALUMNI_NAME_SIZE ); DrawTextToScreen(sText, (UINT16)(usPosX + AIM_ALUMNI_NAME_OFFSET_X), (UINT16)(usPosY + AIM_ALUMNI_NAME_OFFSET_Y), AIM_ALUMNI_NAME_WIDTH, AIM_ALUMNI_NAME_FONT, AIM_ALUMNI_NAME_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); - + usPosX += AIM_ALUMNI_GRID_OFFSET_X; i++; } @@ -352,8 +352,8 @@ void RenderAimArchives() //Display the merc's name uiStartLoc = AIM_ALUMNI_NAME_LINESIZE * i; LoadEncryptedDataFromFile(AIM_ALUMNI_NAME_FILE, sText, uiStartLoc, AIM_ALUMNI_NAME_SIZE ); - DrawTextToScreen(sText, (UINT16)(usPosX + AIM_ALUMNI_NAME_OFFSET_X), (UINT16)(usPosY + AIM_ALUMNI_NAME_OFFSET_Y), AIM_ALUMNI_NAME_WIDTH, AIM_ALUMNI_NAME_FONT, AIM_ALUMNI_NAME_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); - + DrawTextToScreen(sText, (UINT16)(usPosX + AIM_ALUMNI_NAME_OFFSET_X), (UINT16)(usPosY + AIM_ALUMNI_NAME_OFFSET_Y), AIM_ALUMNI_NAME_WIDTH, AIM_ALUMNI_NAME_FONT, AIM_ALUMNI_NAME_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + usPosX += AIM_ALUMNI_GRID_OFFSET_X; } @@ -370,10 +370,10 @@ void RenderAimArchives() } - MarkButtonsDirty( ); + MarkButtonsDirty( ); RenderWWWProgramTitleBar( ); - + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } @@ -395,7 +395,7 @@ void SelectAlumniFaceRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } @@ -407,7 +407,7 @@ void BtnAlumniPageButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags |= BUTTON_CLICKED_ON; gunAlumniButtonDown=ubRetValue; - + InvalidateRegion(AIM_ALUMNI_PAGE1_X,AIM_ALUMNI_PAGE1_Y, AIM_ALUMNI_PAGE_END_X,AIM_ALUMNI_PAGE_END_Y); } if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) @@ -421,7 +421,7 @@ void BtnAlumniPageButtonCallback(GUI_BUTTON *btn,INT32 reason) ChangingAimArchiveSubPage( ubRetValue ); gubPageNum = ubRetValue; - + gfReDrawScreen = TRUE; gfDestroyPopUpBox = TRUE; @@ -441,7 +441,7 @@ void BtnAlumniPageButtonCallback(GUI_BUTTON *btn,INT32 reason) DisableAimArchiveButton(); InvalidateRegion(AIM_ALUMNI_PAGE1_X,AIM_ALUMNI_PAGE1_Y, AIM_ALUMNI_PAGE_END_X,AIM_ALUMNI_PAGE_END_Y); } -} +} void ResetAimArchiveButtons() @@ -450,7 +450,7 @@ void ResetAimArchiveButtons() for(i=0; i<3; i++) { - ButtonList[ guiAlumniPageButton[i] ]->uiFlags &= ~BUTTON_CLICKED_ON; + ButtonList[ guiAlumniPageButton[i] ]->uiFlags &= ~BUTTON_CLICKED_ON; } } @@ -484,8 +484,6 @@ void DisplayAlumniOldMercPopUp() HVOBJECT hDoneHandle; HVOBJECT hFacePaneHandle; HVOBJECT hFaceHandle; -// WRAPPED_STRING *pFirstWrappedString, *pTempWrappedString; - UINT16 usHeight = GetFontHeight(AIM_ALUMNI_POPUP_FONT); CHAR16 sName[AIM_ALUMNI_NAME_SIZE]; CHAR16 sDesc[AIM_ALUMNI_DECRIPTION_SIZE]; UINT32 uiStartLoc; @@ -503,7 +501,7 @@ void DisplayAlumniOldMercPopUp() LoadEncryptedDataFromFile(AIM_ALUMNI_FILE, sDesc, uiStartLoc, AIM_ALUMNI_DECRIPTION_SIZE); usStringPixLength = StringPixLength( sDesc, AIM_ALUMNI_POPUP_FONT); - ubNumDescLines = (UINT8) (usStringPixLength / AIM_POPUP_TEXT_WIDTH); + ubNumDescLines = (UINT8) (usStringPixLength / AIM_POPUP_TEXT_WIDTH); ubNumLines += ubNumDescLines; @@ -543,7 +541,7 @@ void DisplayAlumniOldMercPopUp() //Display the description DisplayWrappedString(AIM_ALUMNI_POPUP_DESC_X, AIM_ALUMNI_POPUP_DESC_Y, AIM_POPUP_TEXT_WIDTH, 2, AIM_ALUMNI_POPUP_FONT, AIM_ALUMNI_POPUP_COLOR, sDesc, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); - + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } @@ -577,7 +575,7 @@ void InitAlumniFaceRegions() { MSYS_DefineRegion( &gMercAlumniFaceMouseRegions[ i ], usPosX, usPosY, (INT16)(usPosX + AIM_ALUMNI_ALUMNI_FACE_WIDTH), (INT16)(usPosY + AIM_ALUMNI_ALUMNI_FACE_HEIGHT), MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectAlumniFaceRegionCallBack); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectAlumniFaceRegionCallBack); // Add region MSYS_AddRegion( &gMercAlumniFaceMouseRegions[ i ] ); MSYS_SetRegionUserData( &gMercAlumniFaceMouseRegions[ i ], 0, i+(20*gubPageNum)); @@ -593,7 +591,7 @@ void InitAlumniFaceRegions() if( gubPageNum == 2 ) { MSYS_DefineRegion( &gMercAlumniFaceMouseRegions[ i ], usPosX, usPosY, (INT16)(usPosX + AIM_ALUMNI_ALUMNI_FACE_WIDTH), (INT16)(usPosY + AIM_ALUMNI_ALUMNI_FACE_HEIGHT), MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectAlumniFaceRegionCallBack); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectAlumniFaceRegionCallBack); // Add region MSYS_AddRegion( &gMercAlumniFaceMouseRegions[ i ] ); MSYS_SetRegionUserData( &gMercAlumniFaceMouseRegions[ i ], 0, i+(20*gubPageNum)); @@ -629,7 +627,7 @@ void RemoveAimAlumniFaceRegion() for(i=0; iRegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); } -} +} BOOLEAN DrawMercsFaceToScreen(UINT8 ubMercID, UINT16 usPosX, UINT16 usPosY, UINT8 ubImage) { - HVOBJECT hMugShotBorderHandle; + HVOBJECT hMugShotBorderHandle; HVOBJECT hFaceHandle; SOLDIERTYPE *pSoldier=NULL; @@ -299,14 +299,14 @@ BOOLEAN DrawMercsFaceToScreen(UINT8 ubMercID, UINT16 usPosX, UINT16 usPosY, UINT //set the red pallete to the face SetObjectHandleShade( guiAimFiFace[ubMercID], 0 ); - //Blt face to screen + //Blt face to screen BltVideoObject(FRAME_BUFFER, hFaceHandle, 0,usPosX+AIM_FI_FACE_OFFSET, usPosY+AIM_FI_FACE_OFFSET, VO_BLT_SRCTRANSPARENCY,NULL); - + DrawTextToScreen(AimFiText[AIM_FI_DEAD], (UINT16)(usPosX+AIM_FI_AWAY_TEXT_OFFSET_X), (UINT16)(usPosY+AIM_FI_AWAY_TEXT_OFFSET_Y), AIM_FI_AWAY_TEXT_OFFSET_WIDTH, FONT10ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); } //else if the merc is currently a POW or, the merc was fired as a pow - else if( gMercProfiles[ AimMercArray[ubMercID] ].bMercStatus == MERC_FIRED_AS_A_POW || ( pSoldier && pSoldier->bAssignment == ASSIGNMENT_POW ) ) + else if( gMercProfiles[ AimMercArray[ubMercID] ].bMercStatus == MERC_FIRED_AS_A_POW || ( pSoldier && pSoldier->bAssignment == ASSIGNMENT_POW ) ) { ShadowVideoSurfaceRect( FRAME_BUFFER, usPosX+AIM_FI_FACE_OFFSET, usPosY+AIM_FI_FACE_OFFSET, usPosX + 48+AIM_FI_FACE_OFFSET, usPosY + 43+AIM_FI_FACE_OFFSET); DrawTextToScreen( pPOWStrings[0], (UINT16)(usPosX+AIM_FI_AWAY_TEXT_OFFSET_X), (UINT16)(usPosY+AIM_FI_AWAY_TEXT_OFFSET_Y), AIM_FI_AWAY_TEXT_OFFSET_WIDTH, FONT10ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); @@ -335,6 +335,7 @@ BOOLEAN DrawMercsFaceToScreen(UINT8 ubMercID, UINT16 usPosX, UINT16 usPosY, UINT - + + diff --git a/Laptop/AimHistory.cpp b/Laptop/AimHistory.cpp index ec761d3c..267bf82d 100644 --- a/Laptop/AimHistory.cpp +++ b/Laptop/AimHistory.cpp @@ -57,7 +57,7 @@ extern UINT32 guiBottomButton2; // symbol already declared globally in AimPolici extern UINT32 guiContentButton; // symbol already declared globally in AimPolicies.cpp (jonathanl) extern UINT8 gubCurPageNum; // symbol already declared globally in AimPolicies.cpp (jonathanl) -extern BOOLEAN gfInToc = FALSE; // symbol already declared globally in AimPolicies.cpp (jonathanl) +extern BOOLEAN gfInToc = FALSE; // symbol already declared globally in AimPolicies.cpp (jonathanl) extern UINT8 gubAimHistoryMenuButtonDown=255; // symbol already declared globally in AimPolicies.cpp (jonathanl) BOOLEAN gfExitingAimHistory; @@ -69,7 +69,7 @@ void ResetAimHistoryButtons(); void DisableAimHistoryButton(); -MOUSE_REGION gSelectedHistoryTocMenuRegion[ NUM_AIM_HISTORY_PAGES ]; +MOUSE_REGION gSelectedHistoryTocMenuRegion[ NUM_AIM_HISTORY_PAGES ]; void SelectHistoryTocMenuRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //Bottom Menu Buttons @@ -128,7 +128,7 @@ void EnterInitAimHistory() BOOLEAN EnterAimHistory() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; gfExitingAimHistory = FALSE; InitAimDefaults(); @@ -154,10 +154,10 @@ void ExitAimHistory() gfExitingAimHistory = TRUE; RemoveAimDefaults(); ExitAimHistoryMenuBar(); - + DeleteVideoObjectFromIndex(guiContentButton); giCurrentSubPage = gubCurPageNum; - + if(gfInToc) ExitTocMenu(); @@ -189,22 +189,22 @@ void RenderAimHistory() InitTocMenu(); break; - //Load and Display the begining + //Load and Display the begining case 1: DisplayAimHistoryParagraph(IN_THE_BEGINNING, 2); break; - //Load and Display the island of metavira + //Load and Display the island of metavira case 2: DisplayAimHistoryParagraph(THE_ISLAND_METAVIRA, 2); break; - //Load and Display the gus tarballs + //Load and Display the gus tarballs case 3: DisplayAimHistoryParagraph(GUS_TARBALLS, 2); break; - //Load and Display the founder + //Load and Display the founder case 4: DisplayAimHistoryParagraph(WORD_FROM_FOUNDER, 1); @@ -218,7 +218,7 @@ void RenderAimHistory() //Load and Display the incorporation case 5: DisplayAimHistoryParagraph(INCORPORATION, 2); - + // display dunn and bradbord... uiStartLoc = AIM_HISTORY_LINE_SIZE * DUNN_AND_BRADROAD; LoadEncryptedDataFromFile(AIMHISTORYFILE, sText, uiStartLoc, AIM_HISTORY_LINE_SIZE); @@ -231,11 +231,11 @@ void RenderAimHistory() break; } - MarkButtonsDirty( ); + MarkButtonsDirty( ); RenderWWWProgramTitleBar( ); - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } @@ -243,7 +243,7 @@ void RenderAimHistory() BOOLEAN InitAimHistoryMenuBar(void) { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; UINT16 i, usPosX; // load the Bottom Buttons graphic and add it @@ -255,7 +255,7 @@ BOOLEAN InitAimHistoryMenuBar(void) FilenameForBPP("LAPTOP\\BottomButton2.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiBottomButton2)); - guiHistoryMenuButtonImage = LoadButtonImage("LAPTOP\\BottomButtons2.sti", -1,0,-1,1,-1 ); + guiHistoryMenuButtonImage = LoadButtonImage("LAPTOP\\BottomButtons2.sti", -1,0,-1,1,-1 ); usPosX = AIM_HISTORY_MENU_X; for(i=0; i= 2) { //2nd paragraph - usPosY += usNumPixels + AIM_HISTORY_SPACE_BETWEEN_PARAGRAPHS; + usPosY += usNumPixels + AIM_HISTORY_SPACE_BETWEEN_PARAGRAPHS; uiStartLoc = AIM_HISTORY_LINE_SIZE * (ubPageNum + 2 ); LoadEncryptedDataFromFile(AIMHISTORYFILE, sText, uiStartLoc, AIM_HISTORY_LINE_SIZE); DisplayWrappedString(AIM_HISTORY_PARAGRAPH_X, usPosY, AIM_HISTORY_PARAGRAPH_WIDTH, 2, AIM_HISTORY_TEXT_FONT, AIM_HISTORY_TEXT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); @@ -390,13 +390,13 @@ BOOLEAN DisplayAimHistoryParagraph(UINT8 ubPageNum, UINT8 ubNumParagraphs) if(ubNumParagraphs >= 3) { //3rd paragraph - usPosY += usNumPixels + AIM_HISTORY_SPACE_BETWEEN_PARAGRAPHS; + usPosY += usNumPixels + AIM_HISTORY_SPACE_BETWEEN_PARAGRAPHS; uiStartLoc = AIM_HISTORY_LINE_SIZE * (ubPageNum + 3 ); LoadEncryptedDataFromFile(AIMHISTORYFILE, sText, uiStartLoc, AIM_HISTORY_LINE_SIZE); DisplayWrappedString(AIM_HISTORY_PARAGRAPH_X, usPosY, AIM_HISTORY_PARAGRAPH_WIDTH, 2, AIM_HISTORY_TEXT_FONT, AIM_HISTORY_TEXT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); } - + return(TRUE); } @@ -411,12 +411,12 @@ BOOLEAN InitTocMenu() CHAR16 sText[400]; UINT8 ubLocInFile[]= {IN_THE_BEGINNING, - THE_ISLAND_METAVIRA, - GUS_TARBALLS, - WORD_FROM_FOUNDER, - INCORPORATION}; + THE_ISLAND_METAVIRA, + GUS_TARBALLS, + WORD_FROM_FOUNDER, + INCORPORATION}; - HVOBJECT hContentButtonHandle; + HVOBJECT hContentButtonHandle; GetVideoObject(&hContentButtonHandle, guiContentButton); @@ -426,7 +426,7 @@ BOOLEAN InitTocMenu() { uiStartLoc = AIM_HISTORY_LINE_SIZE * ubLocInFile[i]; LoadEncryptedDataFromFile(AIMHISTORYFILE, sText, uiStartLoc, AIM_HISTORY_LINE_SIZE); - + usWidth = StringPixLength(sText, AIM_HISTORY_TOC_TEXT_FONT); //if the mouse regions havent been inited, init them @@ -434,12 +434,12 @@ BOOLEAN InitTocMenu() { //Mouse region for the history toc buttons MSYS_DefineRegion( &gSelectedHistoryTocMenuRegion[i], AIM_HISTORY_TOC_X, usPosY, (UINT16)(AIM_HISTORY_TOC_X + AIM_CONTENTBUTTON_WIDTH), (UINT16)(usPosY + AIM_CONTENTBUTTON_HEIGHT), MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectHistoryTocMenuRegionCallBack); - MSYS_AddRegion(&gSelectedHistoryTocMenuRegion[i]); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectHistoryTocMenuRegionCallBack); + MSYS_AddRegion(&gSelectedHistoryTocMenuRegion[i]); MSYS_SetRegionUserData( &gSelectedHistoryTocMenuRegion[i], 0, i+1); } - BltVideoObject(FRAME_BUFFER, hContentButtonHandle, 0,AIM_HISTORY_TOC_X, usPosY, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hContentButtonHandle, 0,AIM_HISTORY_TOC_X, usPosY, VO_BLT_SRCTRANSPARENCY,NULL); DrawTextToScreen(sText, AIM_HISTORY_TOC_X, (UINT16)(usPosY + AIM_HISTORY_TOC_Y), AIM_CONTENTBUTTON_WIDTH, AIM_HISTORY_TOC_TEXT_FONT, AIM_HISTORY_TOC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); @@ -468,9 +468,9 @@ BOOLEAN ExitTocMenu() } - + void SelectHistoryTocMenuRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if(gfInToc) { if (iReason & MSYS_CALLBACK_REASON_INIT) @@ -503,7 +503,7 @@ void BtnHistoryMenuButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags |= BUTTON_CLICKED_ON; gubAimHistoryMenuButtonDown = ubRetValue; - + InvalidateRegion(AIM_HISTORY_MENU_X,AIM_HISTORY_MENU_Y, AIM_HISTORY_MENU_END_X,AIM_HISTORY_MENU_END_Y); } if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) @@ -569,7 +569,7 @@ void BtnHistoryMenuButtonCallback(GUI_BUTTON *btn,INT32 reason) InvalidateRegion(AIM_HISTORY_MENU_X,AIM_HISTORY_MENU_Y, AIM_HISTORY_MENU_END_X,AIM_HISTORY_MENU_END_Y); } -} +} void ResetAimHistoryButtons() @@ -578,7 +578,7 @@ void ResetAimHistoryButtons() for(i=0; iuiFlags &= ~BUTTON_CLICKED_ON; + ButtonList[ guiHistoryMenuButton[i] ]->uiFlags &= ~BUTTON_CLICKED_ON; } } @@ -591,7 +591,7 @@ void DisableAimHistoryButton() { ButtonList[ guiHistoryMenuButton[ 0 ] ]->uiFlags |= (BUTTON_CLICKED_ON ); } - else if( ( gubCurPageNum == 5) ) + else if( ( gubCurPageNum == 5) ) { ButtonList[ guiHistoryMenuButton[ AIM_HISTORY_MENU_BUTTON_AMOUNT-1 ] ]->uiFlags |= (BUTTON_CLICKED_ON ); } @@ -621,6 +621,7 @@ void ChangingAimHistorySubPage( UINT8 ubSubPageNumber ) - + + diff --git a/Laptop/AimLinks.cpp b/Laptop/AimLinks.cpp index 4461cc1e..52f5f2d3 100644 --- a/Laptop/AimLinks.cpp +++ b/Laptop/AimLinks.cpp @@ -14,8 +14,8 @@ #define AIM_LINK_TITLE_FONT FONT14ARIAL #define AIM_LINK_TITLE_COLOR AIM_GREEN -#define AIM_LINK_FONT FONT12ARIAL -#define AIM_LINK_COLOR AIM_FONT_GOLD +#define AIM_LINK_FONT FONT12ARIAL +#define AIM_LINK_COLOR AIM_FONT_GOLD #define AIM_LINK_NUM_LINKS 3 @@ -55,7 +55,7 @@ UINT8 gubLinkPages[]={ INSURANCE_BOOKMARK}; //Clicking on guys Face -MOUSE_REGION gSelectedLinkRegion[ AIM_LINK_NUM_LINKS ] ; +MOUSE_REGION gSelectedLinkRegion[ AIM_LINK_NUM_LINKS ] ; void SelectLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); @@ -66,7 +66,7 @@ void GameInitAimLinks() BOOLEAN EnterAimLinks() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; UINT16 usPosY; INT16 i; @@ -92,12 +92,12 @@ BOOLEAN EnterAimLinks() for(i=0; i 2 ) + if( ( DisplayWrappedString( 0, 0, AIM_MEDICAL_DEPOSIT_WIDTH, 2, AIM_FONT12ARIAL, AIM_M_COLOR_DYNAMIC_TEXT, sMedicalString, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED | DONT_DISPLAY_TEXT ) / GetFontHeight( AIM_FONT12ARIAL ) ) > 2 ) { - DisplayWrappedString( AIM_MEDICAL_DEPOSIT_X, (UINT16)(AIM_MEDICAL_DEPOSIT_Y - GetFontHeight( AIM_FONT12ARIAL ) ), AIM_MEDICAL_DEPOSIT_WIDTH, 2, AIM_FONT12ARIAL, AIM_M_COLOR_DYNAMIC_TEXT, sMedicalString, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + DisplayWrappedString( AIM_MEDICAL_DEPOSIT_X, (UINT16)(AIM_MEDICAL_DEPOSIT_Y - GetFontHeight( AIM_FONT12ARIAL ) ), AIM_MEDICAL_DEPOSIT_WIDTH, 2, AIM_FONT12ARIAL, AIM_M_COLOR_DYNAMIC_TEXT, sMedicalString, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); } else - DisplayWrappedString(AIM_MEDICAL_DEPOSIT_X, AIM_MEDICAL_DEPOSIT_Y, AIM_MEDICAL_DEPOSIT_WIDTH, 2, AIM_FONT12ARIAL, AIM_M_COLOR_DYNAMIC_TEXT, sMedicalString, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + DisplayWrappedString(AIM_MEDICAL_DEPOSIT_X, AIM_MEDICAL_DEPOSIT_Y, AIM_MEDICAL_DEPOSIT_WIDTH, 2, AIM_FONT12ARIAL, AIM_M_COLOR_DYNAMIC_TEXT, sMedicalString, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); } LoadMercBioInfo( gbCurrentSoldier, MercInfoString, AdditionalInfoString); @@ -1213,7 +1213,7 @@ BOOLEAN DisplayMercsInventory(UINT8 ubMercID) INVTYPE *pItem; HVOBJECT hVObject; UINT32 usHeight, usWidth; - ETRLEObject *pTrav; + ETRLEObject *pTrav; CHAR16 gzItemName[ SIZE_ITEM_NAME ]; UINT8 ubItemCount=0; // UINT16 gzTempItemName[ SIZE_ITEM_INFO ]; @@ -1225,7 +1225,7 @@ BOOLEAN DisplayMercsInventory(UINT8 ubMercID) PosY = WEAPONBOX_Y; PosX = WEAPONBOX_X+3; // + 3 ( 1 to take care of the shadow, +2 to get past the weapon box border ) - for(i=0; ipETRLEObject[ pItem->ubGraphicNum ] ); - + usHeight = (UINT32)pTrav->usHeight; usWidth = (UINT32)pTrav->usWidth; - sCenX = PosX + ( abs( WEAPONBOX_SIZE_X - 3 - usWidth ) / 2 ) - pTrav->sOffsetX; + sCenX = PosX + ( abs( WEAPONBOX_SIZE_X - 3 - usWidth ) / 2 ) - pTrav->sOffsetX; sCenY = PosY + ( abs( WEAPONBOX_SIZE_Y - usHeight ) / 2 ) - pTrav->sOffsetY; //blt the shadow of the item @@ -1264,14 +1264,14 @@ BOOLEAN DisplayMercsInventory(UINT8 ubMercID) else { } - + wcscpy( gzItemName, ShortItemNames[ usItem ] ); //if this will only be a single line, center it in the box - if( ( DisplayWrappedString( (UINT16)(PosX-1), AIM_MEMBER_WEAPON_NAME_Y, AIM_MEMBER_WEAPON_NAME_WIDTH, 2, AIM_M_WEAPON_TEXT_FONT, AIM_M_WEAPON_TEXT_COLOR, gzItemName, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED | DONT_DISPLAY_TEXT ) / GetFontHeight( AIM_M_WEAPON_TEXT_FONT ) ) == 1 ) - DisplayWrappedString( (UINT16)(PosX-1), (UINT16)(AIM_MEMBER_WEAPON_NAME_Y+GetFontHeight( AIM_M_WEAPON_TEXT_FONT )/2), AIM_MEMBER_WEAPON_NAME_WIDTH, 2, AIM_M_WEAPON_TEXT_FONT, AIM_M_WEAPON_TEXT_COLOR, gzItemName, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + if( ( DisplayWrappedString( (UINT16)(PosX-1), AIM_MEMBER_WEAPON_NAME_Y, AIM_MEMBER_WEAPON_NAME_WIDTH, 2, AIM_M_WEAPON_TEXT_FONT, AIM_M_WEAPON_TEXT_COLOR, gzItemName, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED | DONT_DISPLAY_TEXT ) / GetFontHeight( AIM_M_WEAPON_TEXT_FONT ) ) == 1 ) + DisplayWrappedString( (UINT16)(PosX-1), (UINT16)(AIM_MEMBER_WEAPON_NAME_Y+GetFontHeight( AIM_M_WEAPON_TEXT_FONT )/2), AIM_MEMBER_WEAPON_NAME_WIDTH, 2, AIM_M_WEAPON_TEXT_FONT, AIM_M_WEAPON_TEXT_COLOR, gzItemName, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); else - DisplayWrappedString( (UINT16)(PosX-1), AIM_MEMBER_WEAPON_NAME_Y, AIM_MEMBER_WEAPON_NAME_WIDTH, 2, AIM_M_WEAPON_TEXT_FONT, AIM_M_WEAPON_TEXT_COLOR, gzItemName, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DisplayWrappedString( (UINT16)(PosX-1), AIM_MEMBER_WEAPON_NAME_Y, AIM_MEMBER_WEAPON_NAME_WIDTH, 2, AIM_M_WEAPON_TEXT_FONT, AIM_M_WEAPON_TEXT_COLOR, gzItemName, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); PosX += WEAPONBOX_SIZE_X; } @@ -1316,7 +1316,7 @@ void BtnPreviousButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnContactButtonCallback(GUI_BUTTON *btn,INT32 reason) { @@ -1330,9 +1330,9 @@ void BtnContactButtonCallback(GUI_BUTTON *btn,INT32 reason) if (btn->uiFlags & BUTTON_CLICKED_ON) { //if we are not already in the video conferemce mode, go in to it - if( !gubVideoConferencingMode) + if( !gubVideoConferencingMode) { - + gubVideoConferencingMode = AIM_VIDEO_POPUP_MODE; // gubVideoConferencingMode = AIM_VIDEO_INIT_MODE; gfFirstTimeInContactScreen = TRUE; @@ -1350,7 +1350,7 @@ void BtnContactButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnNextButtonCallback(GUI_BUTTON *btn,INT32 reason) { @@ -1373,7 +1373,7 @@ void BtnNextButtonCallback(GUI_BUTTON *btn,INT32 reason) gbCurrentSoldier = AimMercArray[gbCurrentIndex]; - gfRedrawScreen = TRUE; + gfRedrawScreen = TRUE; gubVideoConferencingMode = AIM_VIDEO_NOT_DISPLAYED_MODE; @@ -1385,16 +1385,16 @@ void BtnNextButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} BOOLEAN DisplayMercsFace() { - HVOBJECT hFaceHandle; - HVOBJECT hPortraitHandle; + HVOBJECT hFaceHandle; + HVOBJECT hPortraitHandle; STR sFaceLoc = "FACES\\BIGFACES\\"; char sTemp[100]; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; SOLDIERTYPE *pSoldier=NULL; //See if the merc is currently hired @@ -1402,17 +1402,17 @@ BOOLEAN DisplayMercsFace() // Portrait Frame GetVideoObject(&hPortraitHandle, guiPortrait); - BltVideoObject(FRAME_BUFFER, hPortraitHandle, 0,PORTRAIT_X, PORTRAIT_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPortraitHandle, 0,PORTRAIT_X, PORTRAIT_Y, VO_BLT_SRCTRANSPARENCY,NULL); // load the Face graphic and add it - sprintf(sTemp, "%s%02d.sti", sFaceLoc, gbCurrentSoldier); + sprintf(sTemp, "%s%02d.sti", sFaceLoc, gbCurrentSoldier); VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP(sTemp, VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiFace)); - //Blt face to screen + //Blt face to screen GetVideoObject(&hFaceHandle, guiFace); - BltVideoObject(FRAME_BUFFER, hFaceHandle, 0,FACE_X, FACE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hFaceHandle, 0,FACE_X, FACE_Y, VO_BLT_SRCTRANSPARENCY,NULL); //if the merc is dead if( IsMercDead( gbCurrentSoldier ) ) @@ -1426,7 +1426,7 @@ BOOLEAN DisplayMercsFace() //set the red pallete to the face SetObjectHandleShade( guiFace, 0 ); - //Blt face to screen + //Blt face to screen BltVideoObject(FRAME_BUFFER, hFaceHandle, 0,FACE_X, FACE_Y, VO_BLT_SRCTRANSPARENCY,NULL); //if the merc is dead, display it @@ -1434,12 +1434,12 @@ BOOLEAN DisplayMercsFace() } //else if the merc is currently a POW or, the merc was fired as a pow - else if( gMercProfiles[ gbCurrentSoldier ].bMercStatus == MERC_FIRED_AS_A_POW || ( pSoldier && pSoldier->bAssignment == ASSIGNMENT_POW ) ) + else if( gMercProfiles[ gbCurrentSoldier ].bMercStatus == MERC_FIRED_AS_A_POW || ( pSoldier && pSoldier->bAssignment == ASSIGNMENT_POW ) ) { ShadowVideoSurfaceRect( FRAME_BUFFER, FACE_X, FACE_Y, FACE_X + FACE_WIDTH, FACE_Y + FACE_HEIGHT); DrawTextToScreen( pPOWStrings[0], FACE_X+1, FACE_Y+107, FACE_WIDTH, FONT14ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); } - + //else if the merc has already been hired else if( FindSoldierByProfileID( gbCurrentSoldier, TRUE ) ) @@ -1469,7 +1469,7 @@ void DisplayMercStats() // Display all the static text // - //First column in stats box. Health, Agility, dexterity, strength, leadership, wisdom + //First column in stats box. Health, Agility, dexterity, strength, leadership, wisdom DrawTextToScreen(CharacterInfo[AIM_MEMBER_HEALTH], STATS_FIRST_COL, HEALTH_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); DisplayDots(STATS_FIRST_COL, HEALTH_Y, FIRST_COLUMN_DOT, CharacterInfo[AIM_MEMBER_HEALTH]); @@ -1489,7 +1489,7 @@ void DisplayMercStats() DisplayDots(STATS_FIRST_COL, WISDOM_Y, FIRST_COLUMN_DOT, CharacterInfo[AIM_MEMBER_WISDOM]); - //Second column in stats box. Exp.Level, Markmanship, mechanical, explosive, medical + //Second column in stats box. Exp.Level, Markmanship, mechanical, explosive, medical DrawTextToScreen(CharacterInfo[AIM_MEMBER_EXP_LEVEL], STATS_SECOND_COL, EXPLEVEL_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); DisplayDots(STATS_SECOND_COL, EXPLEVEL_Y, SECOND_COLUMN_DOT, CharacterInfo[AIM_MEMBER_EXP_LEVEL]); @@ -1513,7 +1513,7 @@ void DisplayMercStats() //Name DrawTextToScreen(gMercProfiles[gbCurrentSoldier].zName, NAME_X, NAME_Y, 0, FONT14ARIAL, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); - // Numbers for above. Health, Agility, dexterity, strength, leadership, wisdom + // Numbers for above. Health, Agility, dexterity, strength, leadership, wisdom ubColor = GetStatColor( gMercProfiles[gbCurrentSoldier].bLife ); DrawNumeralsToScreen( gMercProfiles[gbCurrentSoldier].bLife, 3, STATS_FIRST_NUM, HEALTH_Y, AIM_M_NUMBER_FONT, ubColor ); @@ -1533,7 +1533,7 @@ void DisplayMercStats() ubColor = GetStatColor( gMercProfiles[gbCurrentSoldier].bWisdom ); DrawNumeralsToScreen(gMercProfiles[gbCurrentSoldier].bWisdom, 3, STATS_FIRST_NUM, WISDOM_Y, AIM_M_NUMBER_FONT, ubColor ); - //Second column in stats box. Exp.Level, Markmanship, mechanical, explosive, medical + //Second column in stats box. Exp.Level, Markmanship, mechanical, explosive, medical // ubColor = GetStatColor( gMercProfiles[gbCurrentSoldier].bExpLevel ); DrawNumeralsToScreen(gMercProfiles[gbCurrentSoldier].bExpLevel, 3, STATS_SECOND_NUM, EXPLEVEL_Y, AIM_M_NUMBER_FONT, FONT_MCOLOR_WHITE ); @@ -1566,7 +1566,7 @@ void DisplayDots(UINT16 usNameX, UINT16 usNameY, UINT16 usStatX, STR16 pString) { INT16 sNumberOfDots; UINT16 usStringLength = StringPixLength(pString, AIM_M_FONT_STATIC_TEXT); - INT16 i; + INT16 i; UINT16 usPosX; sNumberOfDots = (usStatX - usNameX - usStringLength) / 7; @@ -1614,7 +1614,7 @@ void BtnContractLengthButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnBuyEquipmentButtonCallback(GUI_BUTTON *btn,INT32 reason) @@ -1648,7 +1648,7 @@ void BtnBuyEquipmentButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} //Transfer funds button callback void BtnAuthorizeButtonCallback(GUI_BUTTON *btn,INT32 reason) @@ -1674,7 +1674,7 @@ void BtnAuthorizeButtonCallback(GUI_BUTTON *btn,INT32 reason) { StopMercTalking(); - //can the merc be hired? (does he like/not like people on the team + //can the merc be hired? (does he like/not like people on the team // if( CanMercBeHired() ) { //Was the merc hired @@ -1717,7 +1717,7 @@ void BtnAuthorizeButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} @@ -1806,10 +1806,10 @@ INT8 AimMemberHireMerc() return( FALSE ); Menptr[ sSoldierID ].bTypeOfLastContract = bTypeOfContract; - + //add an entry in the finacial page for the hiring of the merc AddTransactionToPlayersBook(HIRED_MERC, ubCurrentSoldier, GetWorldTotalMin(), -( giContractAmount - gMercProfiles[gbCurrentSoldier].sMedicalDepositAmount ) ); - + if( gMercProfiles[ gbCurrentSoldier ].bMedicalDeposit ) { //add an entry in the finacial page for the medical deposit @@ -1835,12 +1835,12 @@ BOOLEAN DisplayVideoConferencingDisplay() //Title & Name if( gubVideoConferencingMode == AIM_VIDEO_INIT_MODE) { - swprintf( sMercName, L"%s", VideoConfercingText[AIM_MEMBER_CONNECTING]); + swprintf( sMercName, L"%s", VideoConfercingText[AIM_MEMBER_CONNECTING]); DrawTextToScreen(sMercName, AIM_MEMBER_VIDEO_NAME_X, AIM_MEMBER_VIDEO_NAME_Y, 0, FONT12ARIAL, AIM_M_VIDEO_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); } else { - swprintf( sMercName, L"%s %s", VideoConfercingText[AIM_MEMBER_VIDEO_CONF_WITH], gMercProfiles[gbCurrentSoldier].zName); + swprintf( sMercName, L"%s %s", VideoConfercingText[AIM_MEMBER_VIDEO_CONF_WITH], gMercProfiles[gbCurrentSoldier].zName); DrawTextToScreen(sMercName, AIM_MEMBER_VIDEO_NAME_X, AIM_MEMBER_VIDEO_NAME_Y, 0, FONT12ARIAL, AIM_M_VIDEO_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); } @@ -1848,7 +1848,7 @@ BOOLEAN DisplayVideoConferencingDisplay() if( gubVideoConferencingMode == AIM_VIDEO_HIRE_MERC_MODE ) { // Display the contract charge - SetFontShadow(AIM_M_VIDEO_NAME_SHADOWCOLOR); + SetFontShadow(AIM_M_VIDEO_NAME_SHADOWCOLOR); DrawTextToScreen(VideoConfercingText[AIM_MEMBER_CONTRACT_CHARGE], AIM_CONTRACT_CHARGE_X, AIM_CONTRACT_CHARGE_Y, 0, FONT12ARIAL, AIM_M_VIDEO_NAME_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); SetFontShadow(DEFAULT_SHADOW); } @@ -1862,37 +1862,37 @@ BOOLEAN DisplayVideoConferencingDisplay() UINT16 usActualHeight; UINT16 usPosX; - SET_USE_WINFONTS( TRUE ); - SET_WINFONT( giSubTitleWinFont ); + SET_USE_WINFONTS( TRUE ); + SET_WINFONT( giSubTitleWinFont ); iAimMembersBoxId = PrepareMercPopupBox( iAimMembersBoxId ,BASIC_MERC_POPUP_BACKGROUND, BASIC_MERC_POPUP_BORDER, gsTalkingMercText, 300, 0, 0, 0, &usActualWidth, &usActualHeight); - SET_USE_WINFONTS( FALSE ); + SET_USE_WINFONTS( FALSE ); usPosX = iScreenWidthOffset + ( 613 - usActualWidth ) / 2 ; RenderMercPopUpBoxFromIndex( iAimMembersBoxId, usPosX, TEXT_POPUP_WINDOW_Y, FRAME_BUFFER); - + if( RemoveMercPopupBoxFromIndex( iAimMembersBoxId ) ) { iAimMembersBoxId = -1; } } - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); return(TRUE); } BOOLEAN DisplayMercsVideoFace() { - HVOBJECT hTerminalHandle; - STR sFaceLoc = "FACES\\"; + HVOBJECT hTerminalHandle; + //STR sFaceLoc = "FACES\\"; // Get and Blt Terminal Frame GetVideoObject(&hTerminalHandle, guiVideoConfTerminal); ShadowVideoSurfaceImage( FRAME_BUFFER, hTerminalHandle, AIM_MEMBER_VIDEO_CONF_TERMINAL_X, AIM_MEMBER_VIDEO_CONF_TERMINAL_Y); - BltVideoObject(FRAME_BUFFER, hTerminalHandle, 0,AIM_MEMBER_VIDEO_CONF_TERMINAL_X, AIM_MEMBER_VIDEO_CONF_TERMINAL_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hTerminalHandle, 0,AIM_MEMBER_VIDEO_CONF_TERMINAL_X, AIM_MEMBER_VIDEO_CONF_TERMINAL_Y, VO_BLT_SRCTRANSPARENCY,NULL); //Display the Select light on the merc @@ -1956,7 +1956,7 @@ void DisplaySelectLights(BOOLEAN fContractDown, BOOLEAN fBuyEquipDown) } usPosY += AIM_MEMBER_BUY_EQUIPMENT_GAP; } - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } @@ -1970,11 +1970,11 @@ UINT32 DisplayMercChargeAmount() if( gubVideoConferencingMode != AIM_VIDEO_HIRE_MERC_MODE ) return(0); - // Display the 'black hole'for the contract charge in the video conference terminal + // Display the 'black hole'for the contract charge in the video conference terminal GetVideoObject(&hImageHandle, guiVideoContractCharge); BltVideoObject(FRAME_BUFFER, hImageHandle, 0,AIM_MEMBER_VIDEO_CONF_CONTRACT_IMAGE_X, AIM_MEMBER_VIDEO_CONF_CONTRACT_IMAGE_Y, VO_BLT_SRCTRANSPARENCY,NULL); - + if( FindSoldierByProfileID( gbCurrentSoldier, TRUE ) == NULL ) { giContractAmount = 0; @@ -2004,12 +2004,12 @@ UINT32 DisplayMercChargeAmount() } } - - swprintf( wDollarTemp, L"%d", giContractAmount); + + swprintf( wDollarTemp, L"%d", giContractAmount); InsertCommasForDollarFigure( wDollarTemp ); InsertDollarSignInToString( wDollarTemp ); - //if the merc hasnt just been hired + //if the merc hasnt just been hired // if( FindSoldierByProfileID( gbCurrentSoldier, TRUE ) == NULL ) { if( gMercProfiles[ gbCurrentSoldier ].bMedicalDeposit ) @@ -2025,8 +2025,8 @@ UINT32 DisplayMercChargeAmount() BOOLEAN InitCreateDeleteAimPopUpBox(UINT8 ubFlag, STR16 sString1, STR16 sString2, UINT16 usPosX, UINT16 usPosY, UINT8 ubData) { - VOBJECT_DESC VObjectDesc; - HVOBJECT hPopupBoxHandle; + VOBJECT_DESC VObjectDesc; + HVOBJECT hPopupBoxHandle; static UINT16 usPopUpBoxPosX, usPopUpBoxPosY; static CHAR16 sPopUpString1[400], sPopUpString2[400]; static BOOLEAN fPopUpBoxActive = FALSE;; @@ -2065,12 +2065,12 @@ BOOLEAN InitCreateDeleteAimPopUpBox(UINT8 ubFlag, STR16 sString1, STR16 sString2 //Create the popup boxes button guiPopUpImage = LoadButtonImage("LAPTOP\\VideoConfButtons.sti", -1,2,-1,3,-1 ); guiPopUpOkButton = CreateIconAndTextButton( guiPopUpImage, VideoConfercingText[AIM_MEMBER_OK], - FONT14ARIAL, - AIM_POPUP_BOX_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, - AIM_POPUP_BOX_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, - TEXT_CJUSTIFIED, - (UINT16)(usPosX+AIM_POPUP_BOX_BUTTON_OFFSET_X), (UINT16)(usPosY+AIM_POPUP_BOX_BUTTON_OFFSET_Y), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+5, - DEFAULT_MOVE_CALLBACK, BtnPopUpOkButtonCallback); + FONT14ARIAL, + AIM_POPUP_BOX_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + AIM_POPUP_BOX_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + TEXT_CJUSTIFIED, + (UINT16)(usPosX+AIM_POPUP_BOX_BUTTON_OFFSET_X), (UINT16)(usPosY+AIM_POPUP_BOX_BUTTON_OFFSET_Y), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+5, + DEFAULT_MOVE_CALLBACK, BtnPopUpOkButtonCallback); SetButtonCursor(guiPopUpOkButton, CURSOR_LAPTOP_SCREEN); MSYS_SetBtnUserData( guiPopUpOkButton, 0, ubData); @@ -2107,13 +2107,13 @@ BOOLEAN InitCreateDeleteAimPopUpBox(UINT8 ubFlag, STR16 sString1, STR16 sString2 GetVideoObject(&hPopupBoxHandle, guiPopUpBox); BltVideoObject(FRAME_BUFFER, hPopupBoxHandle, 0,usPopUpBoxPosX, usPopUpBoxPosY, VO_BLT_SRCTRANSPARENCY,NULL); - SetFontShadow(AIM_M_VIDEO_NAME_SHADOWCOLOR); + SetFontShadow(AIM_M_VIDEO_NAME_SHADOWCOLOR); usTempPosY += AIM_POPUP_BOX_STRING1_Y; - if( sPopUpString1[0] != L'\0') - usTempPosY += DisplayWrappedString(usPopUpBoxPosX, usTempPosY, AIM_POPUP_BOX_WIDTH, 2, AIM_POPUP_BOX_FONT, AIM_POPUP_BOX_COLOR, sPopUpString1, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + if( sPopUpString1[0] != L'\0') + usTempPosY += DisplayWrappedString(usPopUpBoxPosX, usTempPosY, AIM_POPUP_BOX_WIDTH, 2, AIM_POPUP_BOX_FONT, AIM_POPUP_BOX_COLOR, sPopUpString1, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); if( sPopUpString2[0] != L'\0') - DisplayWrappedString(usPopUpBoxPosX, (UINT16)(usTempPosY+4), AIM_POPUP_BOX_WIDTH, 2, AIM_POPUP_BOX_FONT, AIM_POPUP_BOX_COLOR, sPopUpString2, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + DisplayWrappedString(usPopUpBoxPosX, (UINT16)(usTempPosY+4), AIM_POPUP_BOX_WIDTH, 2, AIM_POPUP_BOX_FONT, AIM_POPUP_BOX_COLOR, sPopUpString2, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); SetFontShadow(DEFAULT_SHADOW); @@ -2176,12 +2176,12 @@ void BtnPopUpOkButtonCallback(GUI_BUTTON *btn,INT32 reason) fInCallback = FALSE; // gfStopMercFromTalking = TRUE; - - gubPopUpBoxAction = AIM_POPUP_DELETE; + + gubPopUpBoxAction = AIM_POPUP_DELETE; if( gubVideoConferencingMode != AIM_VIDEO_NOT_DISPLAYED_MODE ) { - if( ubCurPageNum == AIM_POPUP_BOX_SUCCESS) + if( ubCurPageNum == AIM_POPUP_BOX_SUCCESS) { gubVideoConferencingMode = AIM_VIDEO_HIRE_MERC_MODE; WaitForMercToFinishTalkingOrUserToClick(); @@ -2196,9 +2196,9 @@ void BtnPopUpOkButtonCallback(GUI_BUTTON *btn,INT32 reason) InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } } -} +} -// we first contact merc. We either go to hire him or cancel the call +// we first contact merc. We either go to hire him or cancel the call void BtnFirstContactButtonCallback(GUI_BUTTON *btn,INT32 reason) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) @@ -2211,7 +2211,7 @@ void BtnFirstContactButtonCallback(GUI_BUTTON *btn,INT32 reason) if (btn->uiFlags & BUTTON_CLICKED_ON) { UINT8 ubRetValue = (UINT8)MSYS_GetBtnUserData( btn, 0 ); - + // gfStopMercFromTalking = TRUE; StopMercTalking(); @@ -2239,7 +2239,7 @@ void BtnFirstContactButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnAnsweringMachineButtonCallback(GUI_BUTTON *btn,INT32 reason) @@ -2254,7 +2254,7 @@ void BtnAnsweringMachineButtonCallback(GUI_BUTTON *btn,INT32 reason) if (btn->uiFlags & BUTTON_CLICKED_ON) { UINT8 ubRetValue = (UINT8)MSYS_GetBtnUserData( btn, 0 ); - + if( ubRetValue == 0) { //Set a flag indicating that the merc has a message @@ -2285,7 +2285,7 @@ void BtnAnsweringMachineButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnHangUpButtonCallback(GUI_BUTTON *btn,INT32 reason) @@ -2312,10 +2312,10 @@ void BtnHangUpButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(CONTACT_X,CONTACT_BOX_Y,CONTACT_BR_X,CONTACT_BR_Y); } -} +} // InitVideoFace() is called once to initialize things -BOOLEAN InitVideoFace(UINT8 ubMercID) +BOOLEAN InitVideoFace(UINT8 ubMercID) { //Create the facial index giMercFaceIndex = InitFace( ubMercID, NOBODY, 0 ); @@ -2335,7 +2335,7 @@ BOOLEAN InitVideoFace(UINT8 ubMercID) // InitVideoFaceTalking() is called to start a merc speaking a particular message -BOOLEAN InitVideoFaceTalking(UINT8 ubMercID, UINT16 usQuoteNum) +BOOLEAN InitVideoFaceTalking(UINT8 ubMercID, UINT16 usQuoteNum) { //Starts the merc talking @@ -2345,7 +2345,7 @@ BOOLEAN InitVideoFaceTalking(UINT8 ubMercID, UINT16 usQuoteNum) } //Enables it so if a player clicks, he will shutup the merc - MSYS_EnableRegion(&gSelectedShutUpMercRegion); + MSYS_EnableRegion(&gSelectedShutUpMercRegion); gfIsShutUpMouseRegionActive = TRUE; gfMercIsTalking = TRUE; @@ -2401,7 +2401,7 @@ BOOLEAN DisplayTalkingMercFaceForVideoPopUp(INT32 iFaceIndex) if( gfIsAnsweringMachineActive ) { //display a message over the mercs face - DisplayWrappedString( AIM_MEMBER_VIDEO_FACE_X, AIM_MEMBER_VIDEO_FACE_Y+20, AIM_MEMBER_VIDEO_FACE_WIDTH, 2, FONT14ARIAL, 145, AimPopUpText[ AIM_MEMBER_PRERECORDED_MESSAGE ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DisplayWrappedString( AIM_MEMBER_VIDEO_FACE_X, AIM_MEMBER_VIDEO_FACE_Y+20, AIM_MEMBER_VIDEO_FACE_WIDTH, 2, FONT14ARIAL, 145, AimPopUpText[ AIM_MEMBER_PRERECORDED_MESSAGE ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); } @@ -2447,9 +2447,9 @@ void DisplayTextForMercFaceVideoPopUp(STR16 pString) #else swprintf( gsTalkingMercText, L"\"%s\"", pString ); #endif - + //Set the minimum time for the dialogue text to be present - usAimMercSpeechDuration = wcslen( gsTalkingMercText ) * AIM_TEXT_SPEECH_MODIFIER; + usAimMercSpeechDuration = wcslen( gsTalkingMercText ) * AIM_TEXT_SPEECH_MODIFIER; if( usAimMercSpeechDuration < MINIMUM_TALKING_TIME_FOR_MERC ) usAimMercSpeechDuration = MINIMUM_TALKING_TIME_FOR_MERC; @@ -2461,7 +2461,7 @@ void DisplayTextForMercFaceVideoPopUp(STR16 pString) void SelectShutUpMercRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ BOOLEAN fInCallBack=TRUE; if(fInCallBack) @@ -2472,14 +2472,14 @@ void SelectShutUpMercRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { gfStopMercFromTalking = TRUE; - } + } else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) { fInCallBack = FALSE; gfStopMercFromTalking = TRUE; fInCallBack = TRUE; - } + } } } @@ -2493,12 +2493,12 @@ UINT8 WillMercAcceptCall() } //if the merc is currently on contract, the answering machine will pick up. - if( (gMercProfiles[ gbCurrentSoldier ].bMercStatus > 0 ) || (gMercProfiles[ gbCurrentSoldier ].bMercStatus == MERC_HAS_NO_TEXT_FILE ) || (gMercProfiles[ gbCurrentSoldier ].bMercStatus == MERC_HIRED_BUT_NOT_ARRIVED_YET ) ) + if( (gMercProfiles[ gbCurrentSoldier ].bMercStatus > 0 ) || (gMercProfiles[ gbCurrentSoldier ].bMercStatus == MERC_HAS_NO_TEXT_FILE ) || (gMercProfiles[ gbCurrentSoldier ].bMercStatus == MERC_HIRED_BUT_NOT_ARRIVED_YET ) ) { return(AIM_VIDEO_MERC_ANSWERING_MACHINE_MODE); } - // if the merc is at home, or if the merc is only slightly annoyed at the player, he will greet the player + // if the merc is at home, or if the merc is only slightly annoyed at the player, he will greet the player if( IsMercHireable( gbCurrentSoldier ) ) { return(AIM_VIDEO_FIRST_CONTACT_MERC_MODE); @@ -2523,7 +2523,7 @@ BOOLEAN CanMercBeHired() // if the merc recently came back with poor morale, and hasn't gotten over it yet if (gMercProfiles[ gbCurrentSoldier ].ubDaysOfMoraleHangover > 0) { - // then he refuses with a lame excuse. Buddy or no buddy. + // then he refuses with a lame excuse. Buddy or no buddy. WaitForMercToFinishTalkingOrUserToClick(); InitVideoFaceTalking( gbCurrentSoldier, QUOTE_LAME_REFUSAL ); return( FALSE ); @@ -2555,7 +2555,7 @@ BOOLEAN CanMercBeHired() bMercID = gMercProfiles[ gbCurrentSoldier ].bBuddy[j]; if( bMercID < 0 ) - continue; + continue; if( IsMercOnTeam( bMercID ) && !IsMercDead( bMercID ) ) { @@ -2650,7 +2650,7 @@ BOOLEAN CanMercBeHired() BOOLEAN DisplaySnowBackground() { UINT32 uiCurrentTime = 0; - HVOBJECT hSnowHandle; + HVOBJECT hSnowHandle; UINT8 ubCount; uiCurrentTime = GetJA2Clock(); @@ -2685,7 +2685,7 @@ BOOLEAN DisplaySnowBackground() GetVideoObject(&hSnowHandle, guiBWSnow); BltVideoObject(FRAME_BUFFER, hSnowHandle, ubCount,AIM_MEMBER_VIDEO_FACE_X, AIM_MEMBER_VIDEO_FACE_Y, VO_BLT_SRCTRANSPARENCY,NULL); - InvalidateRegion(AIM_MEMBER_VIDEO_FACE_X,AIM_MEMBER_VIDEO_FACE_Y, AIM_MEMBER_VIDEO_FACE_X+AIM_MEMBER_VIDEO_FACE_WIDTH,AIM_MEMBER_VIDEO_FACE_Y+AIM_MEMBER_VIDEO_FACE_HEIGHT); + InvalidateRegion(AIM_MEMBER_VIDEO_FACE_X,AIM_MEMBER_VIDEO_FACE_Y, AIM_MEMBER_VIDEO_FACE_X+AIM_MEMBER_VIDEO_FACE_WIDTH,AIM_MEMBER_VIDEO_FACE_Y+AIM_MEMBER_VIDEO_FACE_HEIGHT); return(FALSE); } @@ -2716,7 +2716,7 @@ BOOLEAN DisplayBlackBackground(UINT8 ubMaxNumOfLoops) } // Blit color to screen ColorFillVideoSurfaceArea( FRAME_BUFFER, AIM_MEMBER_VIDEO_FACE_X, AIM_MEMBER_VIDEO_FACE_Y, AIM_MEMBER_VIDEO_FACE_X+AIM_MEMBER_VIDEO_FACE_WIDTH, AIM_MEMBER_VIDEO_FACE_Y+AIM_MEMBER_VIDEO_FACE_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); - InvalidateRegion(AIM_MEMBER_VIDEO_FACE_X,AIM_MEMBER_VIDEO_FACE_Y, AIM_MEMBER_VIDEO_FACE_X+AIM_MEMBER_VIDEO_FACE_WIDTH,AIM_MEMBER_VIDEO_FACE_Y+AIM_MEMBER_VIDEO_FACE_HEIGHT); + InvalidateRegion(AIM_MEMBER_VIDEO_FACE_X,AIM_MEMBER_VIDEO_FACE_Y, AIM_MEMBER_VIDEO_FACE_X+AIM_MEMBER_VIDEO_FACE_WIDTH,AIM_MEMBER_VIDEO_FACE_Y+AIM_MEMBER_VIDEO_FACE_HEIGHT); return(FALSE); } @@ -2728,7 +2728,7 @@ void HandleVideoDistortion() { static UINT32 uiStaticNoiseSound = NO_SAMPLE; UINT8 ubOldMode = gubCurrentStaticMode; - + // if we are just entering the contact page, display a snowy background if( gfFirstTimeInContactScreen && !gfIsAnsweringMachineActive) { @@ -2737,7 +2737,7 @@ void HandleVideoDistortion() //if it is time to start playing another sound if( uiStaticNoiseSound == NO_SAMPLE ) { - uiStaticNoiseSound = PlayJA2SampleFromFile( "LAPTOP\\static4.wav", RATE_11025, LOWVOLUME, 1, MIDDLEPAN ); + uiStaticNoiseSound = PlayJA2SampleFromFile( "LAPTOP\\static4.wav", RATE_11025, LOWVOLUME, 1, MIDDLEPAN ); } } else @@ -2760,7 +2760,7 @@ void HandleVideoDistortion() if( (GetJA2Clock() - uiCurTime) > 2500) { ubNum = (UINT8)Random( 200 );//125; - + if( ubNum < 15) gubCurrentStaticMode = VC_FUZZY_LINE; @@ -2790,7 +2790,7 @@ void HandleVideoDistortion() //if it is time to start playing another sound if( uiStaticNoiseSound == NO_SAMPLE ) { - uiStaticNoiseSound = PlayJA2SampleFromFile( "LAPTOP\\static1.wav", RATE_11025, LOWVOLUME, 1, MIDDLEPAN ); + uiStaticNoiseSound = PlayJA2SampleFromFile( "LAPTOP\\static1.wav", RATE_11025, LOWVOLUME, 1, MIDDLEPAN ); } break; @@ -2800,7 +2800,7 @@ void HandleVideoDistortion() //if it is time to start playing another sound if( uiStaticNoiseSound == NO_SAMPLE ) { - uiStaticNoiseSound = PlayJA2SampleFromFile( "LAPTOP\\static5.wav", RATE_11025, LOWVOLUME, 1, MIDDLEPAN ); + uiStaticNoiseSound = PlayJA2SampleFromFile( "LAPTOP\\static5.wav", RATE_11025, LOWVOLUME, 1, MIDDLEPAN ); } break; @@ -2810,7 +2810,7 @@ void HandleVideoDistortion() //if it is time to start playing another sound if( uiStaticNoiseSound == NO_SAMPLE ) { - uiStaticNoiseSound = PlayJA2SampleFromFile( "LAPTOP\\static6.wav", RATE_11025, LOWVOLUME, 1, MIDDLEPAN ); + uiStaticNoiseSound = PlayJA2SampleFromFile( "LAPTOP\\static6.wav", RATE_11025, LOWVOLUME, 1, MIDDLEPAN ); } break; @@ -2820,17 +2820,17 @@ void HandleVideoDistortion() //if it is time to start playing another sound if( uiStaticNoiseSound == NO_SAMPLE ) { - uiStaticNoiseSound = PlayJA2SampleFromFile( "LAPTOP\\static3.wav", RATE_11025, LOWVOLUME, 1, MIDDLEPAN ); + uiStaticNoiseSound = PlayJA2SampleFromFile( "LAPTOP\\static3.wav", RATE_11025, LOWVOLUME, 1, MIDDLEPAN ); } break; - + case VC_TRANS_SNOW_OUT: gubCurrentStaticMode = DisplayTransparentSnow(VC_TRANS_SNOW_OUT, guiTransSnow, 7, FALSE); //if it is time to start playing another sound if( uiStaticNoiseSound == NO_SAMPLE ) { - uiStaticNoiseSound = PlayJA2SampleFromFile( "LAPTOP\\static5.wav", RATE_11025, LOWVOLUME, 1, MIDDLEPAN ); + uiStaticNoiseSound = PlayJA2SampleFromFile( "LAPTOP\\static5.wav", RATE_11025, LOWVOLUME, 1, MIDDLEPAN ); } break; @@ -2840,7 +2840,7 @@ void HandleVideoDistortion() //if it is time to start playing another sound if( uiStaticNoiseSound == NO_SAMPLE ) { - uiStaticNoiseSound = PlayJA2SampleFromFile( "LAPTOP\\static4.wav", RATE_11025, LOWVOLUME, 1, MIDDLEPAN ); + uiStaticNoiseSound = PlayJA2SampleFromFile( "LAPTOP\\static4.wav", RATE_11025, LOWVOLUME, 1, MIDDLEPAN ); } break; } @@ -2855,7 +2855,7 @@ void HandleVideoDistortion() //returns true when done. else false UINT8 DisplayTransparentSnow(UINT8 ubMode, UINT32 uiImageIdentifier, UINT8 ubMaxImages, BOOLEAN bForward) { - HVOBJECT hFuzzLineHandle; + HVOBJECT hFuzzLineHandle; static INT8 bCount= 0; UINT32 uiCurrentTime = 0; static UINT32 uiLastTime=0; @@ -2915,7 +2915,7 @@ UINT8 DisplayTransparentSnow(UINT8 ubMode, UINT32 uiImageIdentifier, UINT8 ubMax //returns true when done. else false UINT8 DisplayDistortionLine(UINT8 ubMode, UINT32 uiImageIdentifier, UINT8 ubMaxImages) { - HVOBJECT hFuzzLineHandle; + HVOBJECT hFuzzLineHandle; static UINT8 ubCount=255; UINT32 uiCurrentTime = 0; static UINT32 uiLastTime=0; @@ -2967,7 +2967,7 @@ UINT8 DisplayPixelatedImage(UINT8 ubMaxImages) uiLastTime = uiCurrentTime; } -// PixelateVideoObjectRect( FRAME_BUFFER, AIM_MEMBER_VIDEO_FACE_X, AIM_MEMBER_VIDEO_FACE_Y, AIM_MEMBER_VIDEO_FACE_X+AIM_MEMBER_VIDEO_FACE_WIDTH-1, AIM_MEMBER_VIDEO_FACE_Y+AIM_MEMBER_VIDEO_FACE_HEIGHT-1); +// PixelateVideoObjectRect( FRAME_BUFFER, AIM_MEMBER_VIDEO_FACE_X, AIM_MEMBER_VIDEO_FACE_Y, AIM_MEMBER_VIDEO_FACE_X+AIM_MEMBER_VIDEO_FACE_WIDTH-1, AIM_MEMBER_VIDEO_FACE_Y+AIM_MEMBER_VIDEO_FACE_HEIGHT-1); ShadowVideoSurfaceRect( FRAME_BUFFER, AIM_MEMBER_VIDEO_FACE_X, AIM_MEMBER_VIDEO_FACE_Y, AIM_MEMBER_VIDEO_FACE_X+AIM_MEMBER_VIDEO_FACE_WIDTH-1, AIM_MEMBER_VIDEO_FACE_Y+AIM_MEMBER_VIDEO_FACE_HEIGHT-1); if( ubCount == ubMaxImages-1) @@ -2985,8 +2985,8 @@ void HandleMercAttitude() uiCurrentTime = GetJA2Clock(); - if( ( gubMercAttitudeLevel <= 1 && ( ( uiCurrentTime - guiMercAttitudeTime ) > QUOTE_FIRST_ATTITUDE_TIME ) ) || - ( ( uiCurrentTime - guiMercAttitudeTime ) > QUOTE_ATTITUDE_TIME ) ) + if( ( gubMercAttitudeLevel <= 1 && ( ( uiCurrentTime - guiMercAttitudeTime ) > QUOTE_FIRST_ATTITUDE_TIME ) ) || + ( ( uiCurrentTime - guiMercAttitudeTime ) > QUOTE_ATTITUDE_TIME ) ) { if( gubMercAttitudeLevel == QUOTE_DELAY_SMALL_TALK) @@ -3017,13 +3017,13 @@ void HandleMercAttitude() //increments the merc 'annoyance' at the player - if( gMercProfiles[ gbCurrentSoldier ].bMercStatus == 0 ) + if( gMercProfiles[ gbCurrentSoldier ].bMercStatus == 0 ) gMercProfiles[ gbCurrentSoldier ].bMercStatus = MERC_ANNOYED_BUT_CAN_STILL_CONTACT; - else if( gMercProfiles[ gbCurrentSoldier ].bMercStatus == MERC_ANNOYED_BUT_CAN_STILL_CONTACT ) + else if( gMercProfiles[ gbCurrentSoldier ].bMercStatus == MERC_ANNOYED_BUT_CAN_STILL_CONTACT ) gMercProfiles[ gbCurrentSoldier ].bMercStatus = MERC_ANNOYED_WONT_CONTACT; // add an event so we can reset the 'annoyance factor' - uiResetTime = ( Random( 600 ) ); + uiResetTime = ( Random( 600 ) ); uiResetTime += GetWorldTotalMin() + MERC_ANNOYED_WONT_CONTACT_TIME_MINUTES; AddStrategicEvent( EVENT_AIM_RESET_MERC_ANNOYANCE, uiResetTime, gbCurrentSoldier ); @@ -3046,7 +3046,7 @@ void StopMercTalking() { if( gfIsShutUpMouseRegionActive ) { - MSYS_DisableRegion(&gSelectedShutUpMercRegion); + MSYS_DisableRegion(&gSelectedShutUpMercRegion); ShutupaYoFace( giMercFaceIndex ); gfMercIsTalking = FALSE; @@ -3075,7 +3075,7 @@ void BtnXToCloseVideoConfButtonCallback(GUI_BUTTON *btn,INT32 reason) InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } } -} +} BOOLEAN InitDeleteVideoConferencePopUp( ) @@ -3084,7 +3084,7 @@ BOOLEAN InitDeleteVideoConferencePopUp( ) static BOOLEAN fVideoConferenceCreated = FALSE; UINT8 i; UINT16 usPosX, usPosY; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; VSURFACE_DESC vs_desc; //remove the face help text @@ -3113,14 +3113,14 @@ BOOLEAN InitDeleteVideoConferencePopUp( ) SpecifyDisabledButtonStyle( giXToCloseVideoConfButton, DISABLED_STYLE_NONE ); fXRegionActive = TRUE; - MSYS_DisableRegion(&gSelectedFaceRegion); + MSYS_DisableRegion(&gSelectedFaceRegion); } } // The video conference is not displayed - if( gubVideoConferencingMode == AIM_VIDEO_NOT_DISPLAYED_MODE ) + if( gubVideoConferencingMode == AIM_VIDEO_NOT_DISPLAYED_MODE ) { gubVideoConferencingPreviousMode = gubVideoConferencingMode; gfRedrawScreen = TRUE; @@ -3146,10 +3146,10 @@ BOOLEAN InitDeleteVideoConferencePopUp( ) fXRegionActive = FALSE; } - MSYS_DisableRegion(&gSelectedShutUpMercRegion); + MSYS_DisableRegion(&gSelectedShutUpMercRegion); //Enable the ability to click on the BIG face to go to different screen - MSYS_EnableRegion(&gSelectedFaceRegion); + MSYS_EnableRegion(&gSelectedFaceRegion); // EnableDisableCurrentVideoConferenceButtons(FALSE); if( gubVideoConferencingPreviousMode == AIM_VIDEO_HIRE_MERC_MODE ) @@ -3222,7 +3222,7 @@ BOOLEAN InitDeleteVideoConferencePopUp( ) } // The screen in which you first contact the merc, you have the option to hang up or goto hire merc screen - if( gubVideoConferencingMode == AIM_VIDEO_FIRST_CONTACT_MERC_MODE ) + if( gubVideoConferencingMode == AIM_VIDEO_FIRST_CONTACT_MERC_MODE ) { //if the last screen was the init screen, then we need to initialize the video face if( ( gubVideoConferencingPreviousMode == AIM_VIDEO_INIT_MODE) || ( gubVideoConferencingPreviousMode == AIM_VIDEO_NOT_DISPLAYED_MODE) ) @@ -3242,12 +3242,12 @@ BOOLEAN InitDeleteVideoConferencePopUp( ) for(i=0; i<2; i++) { giAuthorizeButton[i] = CreateIconAndTextButton( guiVideoConferenceButtonImage[2], VideoConfercingText[i+AIM_MEMBER_HIRE], - FONT12ARIAL, - AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, - AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, - TEXT_CJUSTIFIED, - usPosX, AIM_MEMBER_HANG_UP_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnFirstContactButtonCallback); + FONT12ARIAL, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + TEXT_CJUSTIFIED, + usPosX, AIM_MEMBER_HANG_UP_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnFirstContactButtonCallback); MSYS_SetBtnUserData( giAuthorizeButton[i], 0, i); SetButtonCursor(giAuthorizeButton[i], CURSOR_LAPTOP_SCREEN); @@ -3266,7 +3266,7 @@ BOOLEAN InitDeleteVideoConferencePopUp( ) } - + // The screen in which you set the contract length, and the ability to buy equipment.. if( gubVideoConferencingMode == AIM_VIDEO_HIRE_MERC_MODE) { @@ -3277,12 +3277,12 @@ BOOLEAN InitDeleteVideoConferencePopUp( ) usPosY = AIM_MEMBER_BUY_CONTRACT_LENGTH_Y; for(i=0; i<3; i++) { - giContractLengthButton[i] = CreateIconAndTextButton( guiVideoConferenceButtonImage[0], VideoConfercingText[i+AIM_MEMBER_ONE_DAY], FONT12ARIAL, - AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, - AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, - TEXT_LJUSTIFIED, - AIM_MEMBER_BUY_CONTRACT_LENGTH_X, usPosY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnContractLengthButtonCallback); + giContractLengthButton[i] = CreateIconAndTextButton( guiVideoConferenceButtonImage[0], VideoConfercingText[i+AIM_MEMBER_ONE_DAY], FONT12ARIAL, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + TEXT_LJUSTIFIED, + AIM_MEMBER_BUY_CONTRACT_LENGTH_X, usPosY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnContractLengthButtonCallback); SetButtonCursor(giContractLengthButton[i], CURSOR_LAPTOP_SCREEN); MSYS_SetBtnUserData( giContractLengthButton[i], 0, i); @@ -3295,12 +3295,12 @@ BOOLEAN InitDeleteVideoConferencePopUp( ) for(i=0; i<2; i++) { giBuyEquipmentButton[i] = CreateIconAndTextButton( guiVideoConferenceButtonImage[0], VideoConfercingText[i+AIM_MEMBER_NO_EQUIPMENT], - FONT12ARIAL, - AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, - AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, - TEXT_LJUSTIFIED, - AIM_MEMBER_BUY_EQUIPMENT_X, usPosY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnBuyEquipmentButtonCallback); + FONT12ARIAL, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + TEXT_LJUSTIFIED, + AIM_MEMBER_BUY_EQUIPMENT_X, usPosY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnBuyEquipmentButtonCallback); SetButtonCursor(giBuyEquipmentButton[i], CURSOR_LAPTOP_SCREEN); MSYS_SetBtnUserData( giBuyEquipmentButton[i], 0, i); @@ -3317,12 +3317,12 @@ BOOLEAN InitDeleteVideoConferencePopUp( ) for(i=0; i<2; i++) { giAuthorizeButton[i] = CreateIconAndTextButton( guiVideoConferenceButtonImage[1], VideoConfercingText[i+AIM_MEMBER_TRANSFER_FUNDS], - FONT12ARIAL, - AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, - AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, - TEXT_CJUSTIFIED, - usPosX, AIM_MEMBER_AUTHORIZE_PAY_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnAuthorizeButtonCallback); + FONT12ARIAL, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + TEXT_CJUSTIFIED, + usPosX, AIM_MEMBER_AUTHORIZE_PAY_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnAuthorizeButtonCallback); SetButtonCursor(giAuthorizeButton[i], CURSOR_LAPTOP_SCREEN); MSYS_SetBtnUserData( giAuthorizeButton[i], 0, i); @@ -3338,7 +3338,7 @@ BOOLEAN InitDeleteVideoConferencePopUp( ) // The merc is not home and the player gets the answering machine - if( gubVideoConferencingMode == AIM_VIDEO_MERC_ANSWERING_MACHINE_MODE ) + if( gubVideoConferencingMode == AIM_VIDEO_MERC_ANSWERING_MACHINE_MODE ) { gubVideoConferencingPreviousMode = gubVideoConferencingMode; @@ -3349,12 +3349,12 @@ BOOLEAN InitDeleteVideoConferencePopUp( ) guiVideoConferenceButtonImage[2] = LoadButtonImage("LAPTOP\\VideoConfButtons.sti", -1,2,-1,3,-1 ); giAnsweringMachineButton[0] = CreateIconAndTextButton( guiVideoConferenceButtonImage[2], VideoConfercingText[AIM_MEMBER_LEAVE_MESSAGE], - FONT12ARIAL, - AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, - AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, - TEXT_CJUSTIFIED, - usPosX, AIM_MEMBER_HANG_UP_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnAnsweringMachineButtonCallback); + FONT12ARIAL, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + TEXT_CJUSTIFIED, + usPosX, AIM_MEMBER_HANG_UP_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnAnsweringMachineButtonCallback); MSYS_SetBtnUserData( giAnsweringMachineButton[0], 0, 0); SetButtonCursor(giAnsweringMachineButton[0], CURSOR_LAPTOP_SCREEN); @@ -3365,23 +3365,23 @@ BOOLEAN InitDeleteVideoConferencePopUp( ) usPosX += AIM_MEMBER_AUTHORIZE_PAY_GAP; giAnsweringMachineButton[1] = CreateIconAndTextButton( guiVideoConferenceButtonImage[2], VideoConfercingText[AIM_MEMBER_HANG_UP], - FONT12ARIAL, - AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, - AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, - TEXT_CJUSTIFIED, - usPosX, AIM_MEMBER_HANG_UP_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnAnsweringMachineButtonCallback); + FONT12ARIAL, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + TEXT_CJUSTIFIED, + usPosX, AIM_MEMBER_HANG_UP_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnAnsweringMachineButtonCallback); MSYS_SetBtnUserData( giAnsweringMachineButton[1], 0, 1); SetButtonCursor(giAnsweringMachineButton[1], CURSOR_LAPTOP_SCREEN); - //The face must be inited even though the face wont appear. It is so the voice is played + //The face must be inited even though the face wont appear. It is so the voice is played InitVideoFace(gbCurrentSoldier); //Make sure the merc doesnt ramble away to the player gubMercAttitudeLevel = QUOTE_DELAY_NO_ACTION; - + // //DEF: TEST // @@ -3395,22 +3395,22 @@ BOOLEAN InitDeleteVideoConferencePopUp( ) - + // The merc is home but for some reason doesnt want to work for player if( gubVideoConferencingMode == AIM_VIDEO_MERC_UNAVAILABLE_MODE) { gubVideoConferencingPreviousMode = gubVideoConferencingMode; - // The hangup button + // The hangup button guiVideoConferenceButtonImage[2] = LoadButtonImage("LAPTOP\\VideoConfButtons.sti", -1,2,-1,3,-1 ); giHangUpButton = CreateIconAndTextButton( guiVideoConferenceButtonImage[2], VideoConfercingText[AIM_MEMBER_HANG_UP], - FONT12ARIAL, - AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, - AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, - TEXT_CJUSTIFIED, - AIM_MEMBER_HANG_UP_X, AIM_MEMBER_HANG_UP_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnHangUpButtonCallback); + FONT12ARIAL, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + TEXT_CJUSTIFIED, + AIM_MEMBER_HANG_UP_X, AIM_MEMBER_HANG_UP_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnHangUpButtonCallback); MSYS_SetBtnUserData( giHangUpButton, 0, 1); SetButtonCursor(giHangUpButton, CURSOR_LAPTOP_SCREEN); @@ -3489,7 +3489,7 @@ BOOLEAN DeleteVideoConfPopUp() // The opening animation of the vc (fuzzy screen, then goes to black) case AIM_VIDEO_INIT_MODE: { - + break; } @@ -3501,10 +3501,10 @@ BOOLEAN DeleteVideoConfPopUp() //Remove the video conf buttons images UnloadButtonImage(guiVideoConferenceButtonImage[2]); - //Remove the Hangup buttons + //Remove the Hangup buttons for(i=0; i<2; i++) RemoveButton(giAuthorizeButton[i] ); - + break; } @@ -3517,7 +3517,7 @@ BOOLEAN DeleteVideoConfPopUp() for(i=0; i<2; i++) UnloadButtonImage(guiVideoConferenceButtonImage[i]); - //Remove the Contracy Length button + //Remove the Contracy Length button for(i=0; i<3; i++) RemoveButton(giContractLengthButton[i] ); @@ -3598,18 +3598,18 @@ BOOLEAN HandleCurrentVideoConfMode() case AIM_VIDEO_NOT_DISPLAYED_MODE: { gfWaitingForMercToStopTalkingOrUserToClick = FALSE; - + break; } - + case AIM_VIDEO_POPUP_MODE: { BOOLEAN ubDone; if( gfJustSwitchedVideoConferenceMode ) ubDone = DisplayMovingTitleBar( TRUE, TRUE ); - else + else ubDone = DisplayMovingTitleBar( TRUE, FALSE ); @@ -3647,10 +3647,10 @@ BOOLEAN HandleCurrentVideoConfMode() // The screen in which you first contact the merc, you have the option to hang up or goto hire merc screen case AIM_VIDEO_FIRST_CONTACT_MERC_MODE: { - //if the merc is at home, play his greeting + //if the merc is at home, play his greeting // if( gfJustSwitchedVideoConferenceMode ) // InitVideoFaceTalking(gbCurrentSoldier, QUOTE_GREETING); - + break; } @@ -3669,14 +3669,14 @@ BOOLEAN HandleCurrentVideoConfMode() { InitVideoFaceTalking(gbCurrentSoldier, QUOTE_ANSWERING_MACHINE_MSG); } - + break; } // The merc is home but doesnt want to work for player case AIM_VIDEO_MERC_UNAVAILABLE_MODE: { - + break; } @@ -3686,7 +3686,7 @@ BOOLEAN HandleCurrentVideoConfMode() if( gfJustSwitchedVideoConferenceMode ) ubDone = DisplayMovingTitleBar( FALSE, TRUE ); - else + else ubDone = DisplayMovingTitleBar( FALSE, FALSE ); if(ubDone) @@ -3724,7 +3724,7 @@ BOOLEAN EnableDisableCurrentVideoConferenceButtons( BOOLEAN fEnable) if( fCreated ) { //enable buttons behind the acknowlegde button - + for( i=0; i<3; i++) EnableButton( giContractLengthButton[i] ); @@ -3764,10 +3764,10 @@ BOOLEAN HandleAnsweringMachineMessage() static BOOLEAN fDone; if( gfJustSwitchedVideoConferenceMode ) - fDone = DisplayAnimatedAnsweringMachineMsg( TRUE, 12); + fDone = DisplayAnimatedAnsweringMachineMsg( TRUE, 12); else if( !fDone ) { - fDone = DisplayAnimatedAnsweringMachineMsg( FALSE, 12); + fDone = DisplayAnimatedAnsweringMachineMsg( FALSE, 12); if( fDone ) { fDone = FALSE; @@ -3780,7 +3780,7 @@ BOOLEAN HandleAnsweringMachineMessage() /* BOOLEAN DisplayAnimatedAnsweringMachineMsg( BOOLEAN fInit, UINT8 ubNumSubImages) { -// HVOBJECT hImageHandle; +// HVOBJECT hImageHandle; static UINT8 ubSubImage=0; static UINT32 uiLastTime=0; UINT32 uiCurTime = GetJA2Clock(); @@ -3821,7 +3821,7 @@ BOOLEAN DisplayAnimatedAnsweringMachineMsg( BOOLEAN fInit, UINT8 ubNumSubImages) //display the black background with text over it. ColorFillVideoSurfaceArea( FRAME_BUFFER, AIM_MEMBER_VIDEO_FACE_X, AIM_MEMBER_VIDEO_FACE_Y, AIM_MEMBER_VIDEO_FACE_X+AIM_MEMBER_VIDEO_FACE_WIDTH, AIM_MEMBER_VIDEO_FACE_Y+AIM_MEMBER_VIDEO_FACE_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); - DisplayWrappedString(AIM_MEMBER_VIDEO_FACE_X, AIM_MEMBER_VIDEO_FACE_Y+20, AIM_MEMBER_VIDEO_FACE_WIDTH, 2, FONT14ARIAL, 145, AimPopUpText[AIM_MEMBER_LEAVE_MSG], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + DisplayWrappedString(AIM_MEMBER_VIDEO_FACE_X, AIM_MEMBER_VIDEO_FACE_Y+20, AIM_MEMBER_VIDEO_FACE_WIDTH, 2, FONT14ARIAL, 145, AimPopUpText[AIM_MEMBER_LEAVE_MSG], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); InvalidateRegion(AIM_MEMBER_VIDEO_FACE_X,AIM_MEMBER_VIDEO_FACE_Y, AIM_MEMBER_VIDEO_FACE_X+AIM_MEMBER_VIDEO_FACE_WIDTH,AIM_MEMBER_VIDEO_FACE_Y+AIM_MEMBER_VIDEO_FACE_HEIGHT); ubSubImage ++; @@ -3846,7 +3846,7 @@ void ResetMercAnnoyanceAtPlayer( UINT8 ubMercID ) { //if merc is still annoyed, reset back to 0 - if ( ubMercID == LARRY_NORMAL ) + if ( ubMercID == LARRY_NORMAL ) { if ( CheckFact( FACT_LARRY_CHANGED, 0 ) ) { @@ -3970,7 +3970,7 @@ BOOLEAN DisplayMovingTitleBar(BOOLEAN fForward, BOOLEAN fInit ) BltStretchVideoSurface(FRAME_BUFFER, guiVideoTitleBar, 0, 0, VO_BLT_SRCTRANSPARENCY, &SrcRect, &DestRect ); - + InvalidateRegion(DestRect.iLeft,DestRect.iTop, DestRect.iRight, DestRect.iBottom); InvalidateRegion(LastRect.iLeft,LastRect.iTop, LastRect.iRight, LastRect.iBottom); @@ -3996,7 +3996,7 @@ BOOLEAN DisplayMovingTitleBar(BOOLEAN fForward, BOOLEAN fInit ) #ifdef JA2TESTVERSION -//TEMP: +//TEMP: void TempHiringOfMercs( UINT8 ubNumberOfMercs, BOOLEAN fReset ) { INT16 i; @@ -4060,7 +4060,7 @@ void TempHiringOfMercs( UINT8 ubNumberOfMercs, BOOLEAN fReset ) //add an entry in the finacial page for the hiring of the merc AddTransactionToPlayersBook(HIRED_MERC, MercID[i], GetWorldTotalMin(), -(INT32)( gMercProfiles[MercID[i]].sSalary ) ); - + if( gMercProfiles[ MercID[i] ].bMedicalDeposit ) { //add an entry in the finacial page for the medical deposit @@ -4108,8 +4108,8 @@ void DelayMercSpeech( UINT8 ubMercID, UINT16 usQuoteNum, UINT16 usDelay, BOOLEAN fQuoteWaiting = TRUE; } - - + + if( fQuoteWaiting ) { if( ( uiCurTime - uiLastTime ) > usCurDelay ) @@ -4132,7 +4132,7 @@ void DelayMercSpeech( UINT8 ubMercID, UINT16 usQuoteNum, UINT16 usDelay, BOOLEAN #ifdef JA2TESTVERSION -//TEMP!!! +//TEMP!!! BOOLEAN QuickHireMerc() { INT8 bReturnCode; @@ -4189,7 +4189,7 @@ BOOLEAN QuickHireMerc() giContractAmount = gMercProfiles[gbCurrentSoldier].sSalary; AddTransactionToPlayersBook(HIRED_MERC, ubCurrentSoldier, GetWorldTotalMin(), -( giContractAmount ) );//- gMercProfiles[gbCurrentSoldier].sMedicalDepositAmount - + if( gMercProfiles[ gbCurrentSoldier ].bMedicalDeposit ) { //add an entry in the finacial page for the medical deposit @@ -4210,7 +4210,7 @@ void TempHandleAimMemberKeyBoardInput() InputAtom InputEvent; while (DequeueEvent(&InputEvent) == TRUE) - {//!HandleTextInput( &InputEvent ) && + {//!HandleTextInput( &InputEvent ) && if( InputEvent.usEvent == KEY_DOWN ) { switch (InputEvent.usParam) @@ -4245,7 +4245,7 @@ void WaitForMercToFinishTalkingOrUserToClick() if( !gfIsShutUpMouseRegionActive ) { //Enables it so if a player clicks, he will shutup the merc - MSYS_EnableRegion(&gSelectedShutUpMercRegion); + MSYS_EnableRegion(&gSelectedShutUpMercRegion); gfIsShutUpMouseRegionActive = TRUE; } @@ -4340,7 +4340,7 @@ void DemoHiringOfMercs( ) //add an entry in the finacial page for the hiring of the merc AddTransactionToPlayersBook(HIRED_MERC, MercID[i], GetWorldTotalMin(), -(INT32)( gMercProfiles[MercID[i]].sSalary ) ); - + if( gMercProfiles[ MercID[i] ].bMedicalDeposit ) { //add an entry in the finacial page for the medical deposit @@ -4379,7 +4379,7 @@ void DisplayPopUpBoxExplainingMercArrivalLocationAndTime( ) //calc the approximate hour the mercs will arrive at uiHour = ( ( LaptopSaveInfo.sLastHiredMerc.uiArrivalTime ) - ( ( ( LaptopSaveInfo.sLastHiredMerc.uiArrivalTime ) / 1440 ) * 1440 ) ) / 60; - + //create the time string swprintf( zTimeString, L"%02d:%02d", uiHour, 0 ); @@ -4391,16 +4391,16 @@ void DisplayPopUpBoxExplainingMercArrivalLocationAndTime( ) #ifdef GERMAN //Germans version has a different argument order - swprintf( szLocAndTime, pMessageStrings[ MSG_JUST_HIRED_MERC_ARRIVAL_LOCATION_POPUP ], - gMercProfiles[ pSoldier->ubProfile ].zNickname, - LaptopSaveInfo.sLastHiredMerc.uiArrivalTime / 1440, + swprintf( szLocAndTime, pMessageStrings[ MSG_JUST_HIRED_MERC_ARRIVAL_LOCATION_POPUP ], + gMercProfiles[ pSoldier->ubProfile ].zNickname, + LaptopSaveInfo.sLastHiredMerc.uiArrivalTime / 1440, zTimeString, zSectorIDString ); #else - swprintf( szLocAndTime, pMessageStrings[ MSG_JUST_HIRED_MERC_ARRIVAL_LOCATION_POPUP ], - gMercProfiles[ pSoldier->ubProfile ].zNickname, + swprintf( szLocAndTime, pMessageStrings[ MSG_JUST_HIRED_MERC_ARRIVAL_LOCATION_POPUP ], + gMercProfiles[ pSoldier->ubProfile ].zNickname, zSectorIDString, - LaptopSaveInfo.sLastHiredMerc.uiArrivalTime / 1440, + LaptopSaveInfo.sLastHiredMerc.uiArrivalTime / 1440, zTimeString ); #endif @@ -4433,15 +4433,16 @@ void DisplayPopUpBoxExplainingMercArrivalLocationAndTimeCallBack( UINT8 bExitVal void DisplayAimMemberClickOnFaceHelpText() { //display the 'left and right click' onscreen help msg - DrawTextToScreen( AimMemberText[0], AIM_FI_LEFT_CLICK_TEXT_X, AIM_FI_LEFT_CLICK_TEXT_Y, AIM_FI_CLICK_TEXT_WIDTH, AIM_FI_HELP_TITLE_FONT, AIM_FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); - DrawTextToScreen( AimMemberText[1], AIM_FI_LEFT_CLICK_TEXT_X, AIM_FI_LEFT_CLICK_TEXT_Y+AIM_FI_CLICK_DESC_TEXT_Y_OFFSET, AIM_FI_CLICK_TEXT_WIDTH, AIM_FI_HELP_FONT, AIM_FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DrawTextToScreen( AimMemberText[0], AIM_FI_LEFT_CLICK_TEXT_X, AIM_FI_LEFT_CLICK_TEXT_Y, AIM_FI_CLICK_TEXT_WIDTH, AIM_FI_HELP_TITLE_FONT, AIM_FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DrawTextToScreen( AimMemberText[1], AIM_FI_LEFT_CLICK_TEXT_X, AIM_FI_LEFT_CLICK_TEXT_Y+AIM_FI_CLICK_DESC_TEXT_Y_OFFSET, AIM_FI_CLICK_TEXT_WIDTH, AIM_FI_HELP_FONT, AIM_FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); - DrawTextToScreen( AimMemberText[2], AIM_FI_RIGHT_CLICK_TEXT_X, AIM_FI_LEFT_CLICK_TEXT_Y, AIM_FI_CLICK_TEXT_WIDTH, AIM_FI_HELP_TITLE_FONT, AIM_FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); - DrawTextToScreen( AimMemberText[3], AIM_FI_RIGHT_CLICK_TEXT_X, AIM_FI_LEFT_CLICK_TEXT_Y+AIM_FI_CLICK_DESC_TEXT_Y_OFFSET, AIM_FI_CLICK_TEXT_WIDTH, AIM_FI_HELP_FONT, AIM_FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DrawTextToScreen( AimMemberText[2], AIM_FI_RIGHT_CLICK_TEXT_X, AIM_FI_LEFT_CLICK_TEXT_Y, AIM_FI_CLICK_TEXT_WIDTH, AIM_FI_HELP_TITLE_FONT, AIM_FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DrawTextToScreen( AimMemberText[3], AIM_FI_RIGHT_CLICK_TEXT_X, AIM_FI_LEFT_CLICK_TEXT_Y+AIM_FI_CLICK_DESC_TEXT_Y_OFFSET, AIM_FI_CLICK_TEXT_WIDTH, AIM_FI_HELP_FONT, AIM_FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); } - + + diff --git a/Laptop/AimPolicies.cpp b/Laptop/AimPolicies.cpp index 64b03e4f..5f7c912f 100644 --- a/Laptop/AimPolicies.cpp +++ b/Laptop/AimPolicies.cpp @@ -137,7 +137,7 @@ enum //Toc menu mouse regions -MOUSE_REGION gSelectedPolicyTocMenuRegion[ NUM_AIM_POLICY_TOC_BUTTONS ]; +MOUSE_REGION gSelectedPolicyTocMenuRegion[ NUM_AIM_POLICY_TOC_BUTTONS ]; void SelectPolicyTocMenuRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //Agree/Disagree menu Buttons regions @@ -156,7 +156,7 @@ INT32 guiPoliciesMenuButtonImage; UINT32 guiBottomButton; UINT32 guiBottomButton2; UINT8 gubCurPageNum; -BOOLEAN gfInPolicyToc = FALSE; +BOOLEAN gfInPolicyToc = FALSE; BOOLEAN gfInAgreementPage = FALSE; BOOLEAN gfAimPolicyMenuBarLoaded = FALSE; UINT32 guiContentButton; @@ -174,8 +174,8 @@ BOOLEAN ExitAimPolicyMenuBar(void); BOOLEAN InitAimPolicyTocMenu(void); BOOLEAN ExitAimPolicyTocMenu(void); BOOLEAN DrawAimPolicyMenu(); -BOOLEAN DisplayAimPolicyStatement(void); -BOOLEAN DisplayAimPolicyTitleText(void); +BOOLEAN DisplayAimPolicyStatement(void); +BOOLEAN DisplayAimPolicyTitleText(void); BOOLEAN InitAgreementRegion(void); BOOLEAN ExitAgreementButton(void); void DisableAimPolicyButton(); @@ -184,7 +184,7 @@ void ChangingAimPoliciesSubPage( UINT8 ubSubPageNumber ); -BOOLEAN DisplayAimPolicyTitle(UINT16 usPosY, UINT8 ubPageNum, FLOAT fNumber); +BOOLEAN DisplayAimPolicyTitle(UINT16 usPosY, UINT8 ubPageNum, FLOAT fNumber); UINT16 DisplayAimPolicyParagraph(UINT16 usPosY, UINT8 ubPageNum, FLOAT fNumber); UINT16 DisplayAimPolicySubParagraph(UINT16 usPosY, UINT8 ubPageNum, FLOAT fNumber); @@ -203,7 +203,7 @@ void EnterInitAimPolicies() BOOLEAN EnterAimPolicies() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; InitAimDefaults(); @@ -251,9 +251,9 @@ void ExitAimPolicies() if(gfInPolicyToc) ExitAimPolicyTocMenu(); - + if( gfInAgreementPage ) - ExitAgreementButton(); + ExitAgreementButton(); RemoveAimDefaults(); giCurrentSubPage = gubCurPageNum; @@ -280,7 +280,7 @@ void RenderAimPolicies() DisplayAimPolicyTitleText(); if( gfInAgreementPage ) - ExitAgreementButton(); + ExitAgreementButton(); switch( gubCurPageNum ) { @@ -384,11 +384,11 @@ void RenderAimPolicies() break; } - MarkButtonsDirty( ); + MarkButtonsDirty( ); RenderWWWProgramTitleBar( ); - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } @@ -401,7 +401,7 @@ BOOLEAN InitAimPolicyMenuBar(void) return(TRUE); //Load graphic for buttons - guiPoliciesMenuButtonImage = LoadButtonImage("LAPTOP\\BottomButtons2.sti", -1,0,-1,1,-1 ); + guiPoliciesMenuButtonImage = LoadButtonImage("LAPTOP\\BottomButtons2.sti", -1,0,-1,1,-1 ); usPosX = AIM_POLICY_MENU_X; for(i=0; iuiFlags &= ~BUTTON_CLICKED_ON; + ButtonList[ guiPoliciesMenuButton[i] ]->uiFlags &= ~BUTTON_CLICKED_ON; } } @@ -857,7 +855,7 @@ void DisableAimPolicyButton() ButtonList[ guiPoliciesMenuButton[ 0 ] ]->uiFlags |= (BUTTON_CLICKED_ON ); ButtonList[ guiPoliciesMenuButton[ 2 ] ]->uiFlags |= (BUTTON_CLICKED_ON ); } - else if( ( gubCurPageNum == AIM_POLICY_LAST_PAGE ) ) + else if( ( gubCurPageNum == AIM_POLICY_LAST_PAGE ) ) { ButtonList[ guiPoliciesMenuButton[ 3 ] ]->uiFlags |= (BUTTON_CLICKED_ON ); } @@ -886,6 +884,7 @@ void ChangingAimPoliciesSubPage( UINT8 ubSubPageNumber ) - + + diff --git a/Laptop/AimSort.cpp b/Laptop/AimSort.cpp index b08afe05..c031aa7c 100644 --- a/Laptop/AimSort.cpp +++ b/Laptop/AimSort.cpp @@ -14,7 +14,7 @@ #include "Multi Language Graphic Utils.h" #endif -//#define +//#define #define AIM_SORT_FONT_TITLE FONT14ARIAL #define AIM_SORT_FONT_SORT_TEXT FONT10ARIAL @@ -34,7 +34,7 @@ #define AIM_SORT_TO_STATS_X AIM_SORT_TO_MUGSHOTS_X #define AIM_SORT_TO_STATS_Y AIM_SORT_TO_MUGSHOTS_Y + AIM_SORT_GAP_BN_ICONS -#define AIM_SORT_TO_STATS_SIZE AIM_SORT_TO_MUGSHOTS_SIZE +#define AIM_SORT_TO_STATS_SIZE AIM_SORT_TO_MUGSHOTS_SIZE #define AIM_SORT_TO_ALUMNI_X AIM_SORT_TO_MUGSHOTS_X #define AIM_SORT_TO_ALUMNI_Y AIM_SORT_TO_STATS_Y + AIM_SORT_GAP_BN_ICONS @@ -52,13 +52,13 @@ #define AIM_SORT_EXP_TEXT_X AIM_SORT_PRICE_TEXT_X #define AIM_SORT_EXP_TEXT_Y AIM_SORT_PRICE_TEXT_Y + 13 - + #define AIM_SORT_MARKMNSHP_TEXT_X AIM_SORT_PRICE_TEXT_X #define AIM_SORT_MARKMNSHP_TEXT_Y AIM_SORT_EXP_TEXT_Y + 13 #define AIM_SORT_MEDICAL_X AIM_SORT_SORT_BY_X + 125 #define AIM_SORT_MEDICAL_Y AIM_SORT_PRICE_TEXT_Y - + #define AIM_SORT_EXPLOSIVES_X AIM_SORT_MEDICAL_X #define AIM_SORT_EXPLOSIVES_Y AIM_SORT_EXP_TEXT_Y @@ -107,40 +107,40 @@ UINT8 gubOldListMode; // Mouse stuff //Clicking on To Mugshot -MOUSE_REGION gSelectedToMugShotRegion; +MOUSE_REGION gSelectedToMugShotRegion; void SelectToMugShotRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //Clicking on ToStats -MOUSE_REGION gSelectedToStatsRegion; +MOUSE_REGION gSelectedToStatsRegion; void SelectToStatsRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //Clicking on ToStats -MOUSE_REGION gSelectedToArchiveRegion; +MOUSE_REGION gSelectedToArchiveRegion; void SelectToArchiveRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //Clicking on Price Check Box -MOUSE_REGION gSelectedPriceBoxRegion; +MOUSE_REGION gSelectedPriceBoxRegion; void SelectPriceBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //Clicking on Explosive Check Box -MOUSE_REGION gSelectedExpBoxRegion; +MOUSE_REGION gSelectedExpBoxRegion; void SelectExpBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //Clicking on Markmanship Check Box -MOUSE_REGION gSelectedMarkBoxRegion; +MOUSE_REGION gSelectedMarkBoxRegion; void SelectMarkBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //Clicking on Medical Check box -MOUSE_REGION gSelectedMedicalBoxRegion; +MOUSE_REGION gSelectedMedicalBoxRegion; void SelectMedicalBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //Clicking on Explosive Check Box -MOUSE_REGION gSelectedExplosiveBoxRegion; +MOUSE_REGION gSelectedExplosiveBoxRegion; void SelectExplosiveBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //Clicking on Mechanical Check Box -MOUSE_REGION gSelectedMechanicalBoxRegion; +MOUSE_REGION gSelectedMechanicalBoxRegion; void SelectMechanicalBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //Clicking on Ascending Check Box -MOUSE_REGION gSelectedAscendBoxRegion; +MOUSE_REGION gSelectedAscendBoxRegion; void SelectAscendBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //Clicking on Descending Check Box -MOUSE_REGION gSelectedDescendBoxRegion; +MOUSE_REGION gSelectedDescendBoxRegion; void SelectDescendBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); @@ -171,7 +171,7 @@ void GameInitAimSort() BOOLEAN EnterAimSort() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; UINT8 ubCurNumber=0; UINT16 ubWidth; UINT8 i; @@ -231,63 +231,63 @@ BOOLEAN EnterAimSort() //Mouse region for the ToMugShotRegion MSYS_DefineRegion( &gSelectedToMugShotRegion, AIM_SORT_TO_MUGSHOTS_X, AIM_SORT_TO_MUGSHOTS_Y, (AIM_SORT_TO_MUGSHOTS_X + AIM_SORT_TO_MUGSHOTS_SIZE), (AIM_SORT_TO_MUGSHOTS_Y + AIM_SORT_TO_MUGSHOTS_SIZE), MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectToMugShotRegionCallBack ); - MSYS_AddRegion(&gSelectedToMugShotRegion); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectToMugShotRegionCallBack ); + MSYS_AddRegion(&gSelectedToMugShotRegion); //Mouse region for the ToStatsRegion MSYS_DefineRegion( &gSelectedToStatsRegion, AIM_SORT_TO_STATS_X, AIM_SORT_TO_STATS_Y, (AIM_SORT_TO_STATS_X + AIM_SORT_TO_STATS_SIZE), (AIM_SORT_TO_STATS_Y + AIM_SORT_TO_STATS_SIZE), MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectToStatsRegionCallBack ); - MSYS_AddRegion(&gSelectedToStatsRegion); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectToStatsRegionCallBack ); + MSYS_AddRegion(&gSelectedToStatsRegion); //Mouse region for the ToArhciveRegion MSYS_DefineRegion( &gSelectedToArchiveRegion, AIM_SORT_TO_ALUMNI_X, AIM_SORT_TO_ALUMNI_Y, (AIM_SORT_TO_ALUMNI_X + AIM_SORT_TO_ALUMNI_SIZE), (AIM_SORT_TO_ALUMNI_Y + AIM_SORT_TO_ALUMNI_SIZE), MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectToArchiveRegionCallBack ); - MSYS_AddRegion(&gSelectedToArchiveRegion); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectToArchiveRegionCallBack ); + MSYS_AddRegion(&gSelectedToArchiveRegion); + - //CURSOR_WWW MSYS_NO_CURSOR ubCurNumber = 0; //Mouse region for the Price Check Box ubWidth = StringPixLength( AimSortText[PRICE], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_PRICE_TEXT_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; MSYS_DefineRegion( &gSelectedPriceBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectPriceBoxRegionCallBack ); - MSYS_AddRegion(&gSelectedPriceBoxRegion); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectPriceBoxRegionCallBack ); + MSYS_AddRegion(&gSelectedPriceBoxRegion); ubCurNumber+=2; ubWidth = StringPixLength( AimSortText[EXPERIENCE], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_PRICE_TEXT_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; //Mouse region for the Experience Check Box MSYS_DefineRegion( &gSelectedExpBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectExpBoxRegionCallBack ); - MSYS_AddRegion(&gSelectedExpBoxRegion); - + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectExpBoxRegionCallBack ); + MSYS_AddRegion(&gSelectedExpBoxRegion); + ubCurNumber+=2; ubWidth = StringPixLength( AimSortText[AIMMARKSMANSHIP], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_PRICE_TEXT_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; //Mouse region for the Markmanship Check Box MSYS_DefineRegion( &gSelectedMarkBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectMarkBoxRegionCallBack ); - MSYS_AddRegion(&gSelectedMarkBoxRegion); - + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectMarkBoxRegionCallBack ); + MSYS_AddRegion(&gSelectedMarkBoxRegion); + ubCurNumber+=2; ubWidth = StringPixLength( AimSortText[AIMMEDICAL], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_MEDICAL_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; - //Mouse region for the Medical Check Box + //Mouse region for the Medical Check Box MSYS_DefineRegion( &gSelectedMedicalBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectMedicalBoxRegionCallBack ); - MSYS_AddRegion(&gSelectedMedicalBoxRegion); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectMedicalBoxRegionCallBack ); + MSYS_AddRegion(&gSelectedMedicalBoxRegion); ubCurNumber+=2; ubWidth = StringPixLength( AimSortText[EXPLOSIVES], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_MEDICAL_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; - //Mouse region for the Explosive Check Box + //Mouse region for the Explosive Check Box MSYS_DefineRegion( &gSelectedExplosiveBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectExplosiveBoxRegionCallBack ); - MSYS_AddRegion(&gSelectedExplosiveBoxRegion); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectExplosiveBoxRegionCallBack ); + MSYS_AddRegion(&gSelectedExplosiveBoxRegion); ubCurNumber+=2; ubWidth = StringPixLength( AimSortText[AIMMECHANICAL], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_MEDICAL_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; //Mouse region for the Mechanical Check Box MSYS_DefineRegion( &gSelectedMechanicalBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectMechanicalBoxRegionCallBack ); - MSYS_AddRegion(&gSelectedMechanicalBoxRegion); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectMechanicalBoxRegionCallBack ); + MSYS_AddRegion(&gSelectedMechanicalBoxRegion); ubCurNumber+=2; @@ -295,21 +295,21 @@ BOOLEAN EnterAimSort() ubWidth = AimSortCheckBoxLoc[ ubCurNumber ] - StringPixLength( AimSortText[ASCENDING], AIM_SORT_FONT_SORT_TEXT) - 6; //Mouse region for the Ascend Check Box MSYS_DefineRegion( &gSelectedAscendBoxRegion, ubWidth , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)(AimSortCheckBoxLoc[ ubCurNumber ] + AIM_SORT_CHECKBOX_SIZE), (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectAscendBoxRegionCallBack ); - MSYS_AddRegion(&gSelectedAscendBoxRegion); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectAscendBoxRegionCallBack ); + MSYS_AddRegion(&gSelectedAscendBoxRegion); ubCurNumber+=2; ubWidth = AimSortCheckBoxLoc[ ubCurNumber ] - StringPixLength( AimSortText[DESCENDING], AIM_SORT_FONT_SORT_TEXT) - 6; //Mouse region for the Descend Check Box MSYS_DefineRegion( &gSelectedDescendBoxRegion, ubWidth, AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)(AimSortCheckBoxLoc[ ubCurNumber ] + AIM_SORT_CHECKBOX_SIZE), (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectDescendBoxRegionCallBack ); - MSYS_AddRegion(&gSelectedDescendBoxRegion); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectDescendBoxRegionCallBack ); + MSYS_AddRegion(&gSelectedDescendBoxRegion); InitAimMenuBar(); - + RenderAimSort(); return( TRUE ); @@ -327,18 +327,18 @@ void ExitAimSort() DeleteVideoObjectFromIndex(guiToStats); DeleteVideoObjectFromIndex(guiSelectLight); - MSYS_RemoveRegion( &gSelectedToMugShotRegion); - MSYS_RemoveRegion( &gSelectedToStatsRegion); - MSYS_RemoveRegion( &gSelectedToArchiveRegion); + MSYS_RemoveRegion( &gSelectedToMugShotRegion); + MSYS_RemoveRegion( &gSelectedToStatsRegion); + MSYS_RemoveRegion( &gSelectedToArchiveRegion); - MSYS_RemoveRegion( &gSelectedPriceBoxRegion); - MSYS_RemoveRegion( &gSelectedExpBoxRegion); - MSYS_RemoveRegion( &gSelectedMarkBoxRegion); - MSYS_RemoveRegion( &gSelectedMedicalBoxRegion); - MSYS_RemoveRegion( &gSelectedExplosiveBoxRegion); - MSYS_RemoveRegion( &gSelectedMechanicalBoxRegion); - MSYS_RemoveRegion( &gSelectedAscendBoxRegion); - MSYS_RemoveRegion( &gSelectedDescendBoxRegion); + MSYS_RemoveRegion( &gSelectedPriceBoxRegion); + MSYS_RemoveRegion( &gSelectedExpBoxRegion); + MSYS_RemoveRegion( &gSelectedMarkBoxRegion); + MSYS_RemoveRegion( &gSelectedMedicalBoxRegion); + MSYS_RemoveRegion( &gSelectedExplosiveBoxRegion); + MSYS_RemoveRegion( &gSelectedMechanicalBoxRegion); + MSYS_RemoveRegion( &gSelectedAscendBoxRegion); + MSYS_RemoveRegion( &gSelectedDescendBoxRegion); ExitAimMenuBar(); } @@ -350,27 +350,27 @@ void HandleAimSort() void RenderAimSort() { - HVOBJECT hSortByHandle; - HVOBJECT hToAlumniHandle; - HVOBJECT hToMugShotHandle; - HVOBJECT hToStatsHandle; + HVOBJECT hSortByHandle; + HVOBJECT hToAlumniHandle; + HVOBJECT hToMugShotHandle; + HVOBJECT hToStatsHandle; DrawAimDefaults(); // SortBy GetVideoObject(&hSortByHandle, guiSortByBox); - BltVideoObject(FRAME_BUFFER, hSortByHandle, 0,AIM_SORT_SORT_BY_X, AIM_SORT_SORT_BY_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hSortByHandle, 0,AIM_SORT_SORT_BY_X, AIM_SORT_SORT_BY_Y, VO_BLT_SRCTRANSPARENCY,NULL); // To MugShots GetVideoObject(&hToMugShotHandle, guiToMugShots); - BltVideoObject(FRAME_BUFFER, hToMugShotHandle, 0,AIM_SORT_TO_MUGSHOTS_X, AIM_SORT_TO_MUGSHOTS_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hToMugShotHandle, 0,AIM_SORT_TO_MUGSHOTS_X, AIM_SORT_TO_MUGSHOTS_Y, VO_BLT_SRCTRANSPARENCY,NULL); // To stats GetVideoObject(&hToStatsHandle, guiToStats); - BltVideoObject(FRAME_BUFFER, hToStatsHandle, 0,AIM_SORT_TO_STATS_X, AIM_SORT_TO_STATS_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hToStatsHandle, 0,AIM_SORT_TO_STATS_X, AIM_SORT_TO_STATS_Y, VO_BLT_SRCTRANSPARENCY,NULL); // To Alumni GetVideoObject(&hToAlumniHandle, guiToAlumni); - BltVideoObject(FRAME_BUFFER, hToAlumniHandle, 0,AIM_SORT_TO_ALUMNI_X, AIM_SORT_TO_ALUMNI_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hToAlumniHandle, 0,AIM_SORT_TO_ALUMNI_X, AIM_SORT_TO_ALUMNI_Y, VO_BLT_SRCTRANSPARENCY,NULL); // Draw the aim slogan under the symbol @@ -404,18 +404,18 @@ void RenderAimSort() DisableAimButton(); - MarkButtonsDirty( ); + MarkButtonsDirty( ); RenderWWWProgramTitleBar( ); - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } void SelectToMugShotRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { @@ -426,12 +426,12 @@ void SelectToMugShotRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } void SelectToStatsRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { @@ -442,13 +442,13 @@ void SelectToStatsRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } void SelectToArchiveRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { @@ -459,13 +459,13 @@ void SelectToArchiveRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } void SelectPriceBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { @@ -482,13 +482,13 @@ void SelectPriceBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } void SelectExpBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { @@ -505,12 +505,12 @@ void SelectExpBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } void SelectMarkBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { @@ -527,13 +527,13 @@ void SelectMarkBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } void SelectMedicalBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { @@ -550,13 +550,13 @@ void SelectMedicalBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } void SelectExplosiveBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { @@ -573,13 +573,13 @@ void SelectExplosiveBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } void SelectMechanicalBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { @@ -596,13 +596,13 @@ void SelectMechanicalBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } void SelectAscendBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { @@ -619,13 +619,13 @@ void SelectAscendBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } void SelectDescendBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { @@ -642,7 +642,7 @@ void SelectDescendBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } @@ -654,11 +654,11 @@ void DrawSelectLight(UINT8 ubMode, UINT8 ubImage) ubMode *= 2; GetVideoObject(&hSelectLightHandle, guiSelectLight); - BltVideoObject(FRAME_BUFFER, hSelectLightHandle, ubImage, (AimSortCheckBoxLoc[ubMode] ), ( AimSortCheckBoxLoc[ubMode + 1] ), VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hSelectLightHandle, ubImage, (AimSortCheckBoxLoc[ubMode] ), ( AimSortCheckBoxLoc[ubMode + 1] ), VO_BLT_SRCTRANSPARENCY,NULL); -// InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); +// InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); - InvalidateRegion(AimSortCheckBoxLoc[ubMode],AimSortCheckBoxLoc[ubMode+1], (AimSortCheckBoxLoc[ubMode] + AIM_SORT_CHECKBOX_SIZE), (AimSortCheckBoxLoc[ubMode+1] + AIM_SORT_CHECKBOX_SIZE) ); + InvalidateRegion(AimSortCheckBoxLoc[ubMode],AimSortCheckBoxLoc[ubMode+1], (AimSortCheckBoxLoc[ubMode] + AIM_SORT_CHECKBOX_SIZE), (AimSortCheckBoxLoc[ubMode+1] + AIM_SORT_CHECKBOX_SIZE) ); } @@ -684,27 +684,27 @@ INT32 QsortCompare( const void *pNum1, const void *pNum2) { //Price INT16 uiWeeklySalary case 0: - return( CompareValue((INT32)gMercProfiles[ Num1 ].uiWeeklySalary, (INT32)gMercProfiles[Num2].uiWeeklySalary ) ); + return( CompareValue((INT32)gMercProfiles[ Num1 ].uiWeeklySalary, (INT32)gMercProfiles[Num2].uiWeeklySalary ) ); break; //Experience INT16 bExpLevel case 1: - return( CompareValue((INT32)gMercProfiles[ Num1 ].bExpLevel, (INT32)gMercProfiles[Num2].bExpLevel) ); + return( CompareValue((INT32)gMercProfiles[ Num1 ].bExpLevel, (INT32)gMercProfiles[Num2].bExpLevel) ); break; //Marksmanship INT16 bMarksmanship case 2: - return( CompareValue((INT32)gMercProfiles[ Num1 ].bMarksmanship, (INT32)gMercProfiles[Num2].bMarksmanship ) ); + return( CompareValue((INT32)gMercProfiles[ Num1 ].bMarksmanship, (INT32)gMercProfiles[Num2].bMarksmanship ) ); break; //Medical INT16 bMedical case 3: - return( CompareValue((INT32)gMercProfiles[ Num1 ].bMedical, (INT32)gMercProfiles[Num2].bMedical ) ); + return( CompareValue((INT32)gMercProfiles[ Num1 ].bMedical, (INT32)gMercProfiles[Num2].bMedical ) ); break; //Explosives INT16 bExplosive case 4: - return( CompareValue((INT32)gMercProfiles[ Num1 ].bExplosive, (INT32)gMercProfiles[Num2].bExplosive ) ); + return( CompareValue((INT32)gMercProfiles[ Num1 ].bExplosive, (INT32)gMercProfiles[Num2].bExplosive ) ); break; //Mechanical INT16 bMechanical case 5: - return( CompareValue((INT32)gMercProfiles[ Num1 ].bMechanical, (INT32)gMercProfiles[Num2].bMechanical ) ); + return( CompareValue((INT32)gMercProfiles[ Num1 ].bMechanical, (INT32)gMercProfiles[Num2].bMechanical ) ); break; default: @@ -746,6 +746,7 @@ INT32 CompareValue(const INT32 Num1, const INT32 Num2) - + + diff --git a/Laptop/BobbyR.cpp b/Laptop/BobbyR.cpp index 2d54453e..c5bbc605 100644 --- a/Laptop/BobbyR.cpp +++ b/Laptop/BobbyR.cpp @@ -86,26 +86,26 @@ #define BOBBIES_MISC_SIGN_X BOBBYS_PLAQUES_X + 238 #define BOBBIES_MISC_SIGN_Y BOBBYS_PLAQUES_Y + 27 -#define BOBBIES_MISC_SIGN_WIDTH 103 -#define BOBBIES_MISC_SIGN_HEIGHT 57 +#define BOBBIES_MISC_SIGN_WIDTH 103 +#define BOBBIES_MISC_SIGN_HEIGHT 57 #define BOBBIES_MISC_SIGN_TEXT_OFFSET BOBBIES_MISC_SIGN_Y + BOBBIES_CENTER_SIGN_OFFSET_Y #define BOBBIES_GUNS_SIGN_X BOBBYS_PLAQUES_X + 3 #define BOBBIES_GUNS_SIGN_Y BOBBYS_PLAQUES_Y + 102 -#define BOBBIES_GUNS_SIGN_WIDTH 116 -#define BOBBIES_GUNS_SIGN_HEIGHT 75 +#define BOBBIES_GUNS_SIGN_WIDTH 116 +#define BOBBIES_GUNS_SIGN_HEIGHT 75 #define BOBBIES_GUNS_SIGN_TEXT_OFFSET BOBBIES_GUNS_SIGN_Y + BOBBIES_CENTER_SIGN_OFFSET_Y #define BOBBIES_AMMO_SIGN_X BOBBYS_PLAQUES_X + 150 #define BOBBIES_AMMO_SIGN_Y BOBBYS_PLAQUES_Y + 105 -#define BOBBIES_AMMO_SIGN_WIDTH 112 +#define BOBBIES_AMMO_SIGN_WIDTH 112 #define BOBBIES_AMMO_SIGN_HEIGHT 71 #define BOBBIES_AMMO_SIGN_TEXT_OFFSET BOBBIES_AMMO_SIGN_Y + BOBBIES_CENTER_SIGN_OFFSET_Y - + #define BOBBIES_ARMOUR_SIGN_X BOBBYS_PLAQUES_X + 290 #define BOBBIES_ARMOUR_SIGN_Y BOBBYS_PLAQUES_Y + 108 -#define BOBBIES_ARMOUR_SIGN_WIDTH 114 -#define BOBBIES_ARMOUR_SIGN_HEIGHT 70 +#define BOBBIES_ARMOUR_SIGN_WIDTH 114 +#define BOBBIES_ARMOUR_SIGN_HEIGHT 70 #define BOBBIES_ARMOUR_SIGN_TEXT_OFFSET BOBBIES_ARMOUR_SIGN_Y + BOBBIES_CENTER_SIGN_OFFSET_Y #define BOBBIES_3RD_SENTENCE_X LAPTOP_SCREEN_UL_X @@ -114,7 +114,7 @@ #define BOBBY_R_NEW_PURCHASE_ARRIVAL_TIME (1 * 60 * 24) // minutes in 1 day -#define BOBBY_R_USED_PURCHASE_OFFSET MAXITEMS +#define BOBBY_R_USED_PURCHASE_OFFSET MAXITEMS #define BOBBYR_UNDERCONSTRUCTION_ANI_DELAY 150 #define BOBBYR_UNDERCONSTRUCTION_NUM_FRAMES 5 @@ -154,12 +154,12 @@ UINT16 gusFirstMiscIndex; UINT16 gusLastMiscIndex; UINT8 gubNumMiscPages; -UINT16 gusFirstArmourIndex; -UINT16 gusLastArmourIndex; +UINT16 gusFirstArmourIndex; +UINT16 gusLastArmourIndex; UINT8 gubNumArmourPages; -UINT16 gusFirstUsedIndex; -UINT16 gusLastUsedIndex; +UINT16 gusFirstUsedIndex; +UINT16 gusLastUsedIndex; UINT8 gubNumUsedPages; */ @@ -176,7 +176,7 @@ UINT8 gubBobbyRPages[]={ //Bobby's Sign menu mouse regions -MOUSE_REGION gSelectedBobbiesSignMenuRegion[ BOBBIES_NUMBER_SIGNS ]; +MOUSE_REGION gSelectedBobbiesSignMenuRegion[ BOBBIES_NUMBER_SIGNS ]; void SelectBobbiesSignMenuRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); BOOLEAN InitBobbiesMouseRegion(UINT8 ubNumerRegions, UINT16 *usMouseRegionPosArray, MOUSE_REGION *MouseRegion); @@ -194,15 +194,15 @@ void GameInitBobbyR() BOOLEAN EnterBobbyR() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; UINT8 i; - // an array of mouse regions for the bobbies signs. Top Left corner, bottom right corner - UINT16 usMouseRegionPosArray[] = {BOBBIES_USED_SIGN_X, BOBBIES_USED_SIGN_Y, BOBBIES_USED_SIGN_X+BOBBIES_USED_SIGN_WIDTH, BOBBIES_USED_SIGN_Y+BOBBIES_USED_SIGN_HEIGHT, - BOBBIES_MISC_SIGN_X, BOBBIES_MISC_SIGN_Y, BOBBIES_MISC_SIGN_X+BOBBIES_MISC_SIGN_WIDTH, BOBBIES_MISC_SIGN_Y+BOBBIES_MISC_SIGN_HEIGHT, - BOBBIES_GUNS_SIGN_X, BOBBIES_GUNS_SIGN_Y, BOBBIES_GUNS_SIGN_X+BOBBIES_GUNS_SIGN_WIDTH, BOBBIES_GUNS_SIGN_Y+BOBBIES_GUNS_SIGN_HEIGHT, - BOBBIES_AMMO_SIGN_X, BOBBIES_AMMO_SIGN_Y, BOBBIES_AMMO_SIGN_X+BOBBIES_AMMO_SIGN_WIDTH, BOBBIES_AMMO_SIGN_Y+BOBBIES_AMMO_SIGN_HEIGHT, - BOBBIES_ARMOUR_SIGN_X, BOBBIES_ARMOUR_SIGN_Y, BOBBIES_ARMOUR_SIGN_X+BOBBIES_ARMOUR_SIGN_WIDTH, BOBBIES_ARMOUR_SIGN_Y+BOBBIES_ARMOUR_SIGN_HEIGHT}; + // an array of mouse regions for the bobbies signs. Top Left corner, bottom right corner + UINT16 usMouseRegionPosArray[] = {BOBBIES_USED_SIGN_X, BOBBIES_USED_SIGN_Y, BOBBIES_USED_SIGN_X+BOBBIES_USED_SIGN_WIDTH, BOBBIES_USED_SIGN_Y+BOBBIES_USED_SIGN_HEIGHT, + BOBBIES_MISC_SIGN_X, BOBBIES_MISC_SIGN_Y, BOBBIES_MISC_SIGN_X+BOBBIES_MISC_SIGN_WIDTH, BOBBIES_MISC_SIGN_Y+BOBBIES_MISC_SIGN_HEIGHT, + BOBBIES_GUNS_SIGN_X, BOBBIES_GUNS_SIGN_Y, BOBBIES_GUNS_SIGN_X+BOBBIES_GUNS_SIGN_WIDTH, BOBBIES_GUNS_SIGN_Y+BOBBIES_GUNS_SIGN_HEIGHT, + BOBBIES_AMMO_SIGN_X, BOBBIES_AMMO_SIGN_Y, BOBBIES_AMMO_SIGN_X+BOBBIES_AMMO_SIGN_WIDTH, BOBBIES_AMMO_SIGN_Y+BOBBIES_AMMO_SIGN_HEIGHT, + BOBBIES_ARMOUR_SIGN_X, BOBBIES_ARMOUR_SIGN_Y, BOBBIES_ARMOUR_SIGN_X+BOBBIES_ARMOUR_SIGN_WIDTH, BOBBIES_ARMOUR_SIGN_Y+BOBBIES_ARMOUR_SIGN_HEIGHT}; InitBobbyRWoodBackground(); @@ -278,7 +278,7 @@ void ExitBobbyR() { DeleteVideoObjectFromIndex(guiUnderConstructionImage); } - + DeleteBobbyRWoodBackground(); @@ -294,39 +294,39 @@ void HandleBobbyR() void RenderBobbyR() { - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; HVOBJECT hStorePlaqueHandle; - + DrawBobbyRWoodBackground(); // Bobby's Name GetVideoObject(&hPixHandle, guiBobbyName); - BltVideoObject(FRAME_BUFFER, hPixHandle, 0,BOBBY_RAYS_NAME_X, BOBBY_RAYS_NAME_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0,BOBBY_RAYS_NAME_X, BOBBY_RAYS_NAME_Y, VO_BLT_SRCTRANSPARENCY,NULL); // Plaque GetVideoObject(&hPixHandle, guiPlaque); - BltVideoObject(FRAME_BUFFER, hPixHandle, 0,BOBBYS_PLAQUES_X, BOBBYS_PLAQUES_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0,BOBBYS_PLAQUES_X, BOBBYS_PLAQUES_Y, VO_BLT_SRCTRANSPARENCY,NULL); // Top Hinge GetVideoObject(&hPixHandle, guiTopHinge); - BltVideoObject(FRAME_BUFFER, hPixHandle, 0,BOBBIES_TOPHINGE_X, BOBBIES_TOPHINGE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0,BOBBIES_TOPHINGE_X, BOBBIES_TOPHINGE_Y, VO_BLT_SRCTRANSPARENCY,NULL); // Bottom Hinge GetVideoObject(&hPixHandle, guiBottomHinge); - BltVideoObject(FRAME_BUFFER, hPixHandle, 0,BOBBIES_BOTTOMHINGE_X, BOBBIES_BOTTOMHINGE_Y, VO_BLT_SRCTRANSPARENCY,NULL); - + BltVideoObject(FRAME_BUFFER, hPixHandle, 0,BOBBIES_BOTTOMHINGE_X, BOBBIES_BOTTOMHINGE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + // StorePlaque GetVideoObject(&hStorePlaqueHandle, guiStorePlaque); - BltVideoObject(FRAME_BUFFER, hStorePlaqueHandle, 0,BOBBIES_STORE_PLAQUE_X, BOBBIES_STORE_PLAQUE_Y, VO_BLT_SRCTRANSPARENCY,NULL); - + BltVideoObject(FRAME_BUFFER, hStorePlaqueHandle, 0,BOBBIES_STORE_PLAQUE_X, BOBBIES_STORE_PLAQUE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + // Handle GetVideoObject(&hPixHandle, guiHandle); - BltVideoObject(FRAME_BUFFER, hPixHandle, 0,BOBBIES_HANDLE_X, BOBBIES_HANDLE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0,BOBBIES_HANDLE_X, BOBBIES_HANDLE_Y, VO_BLT_SRCTRANSPARENCY,NULL); /* if( !LaptopSaveInfo.fBobbyRSiteCanBeAccessed ) { - // The undercontsruction graphic + // The undercontsruction graphic GetVideoObject(&hPixHandle, guiUnderConstructionImage ); BltVideoObject(FRAME_BUFFER, hPixHandle, 0,BOBBIES_FIRST_SENTENCE_X, BOBBIES_FIRST_SENTENCE_Y, VO_BLT_SRCTRANSPARENCY,NULL); BltVideoObject(FRAME_BUFFER, hPixHandle, 0,BOBBIES_3RD_SENTENCE_X, BOBBIES_3RD_SENTENCE_Y, VO_BLT_SRCTRANSPARENCY,NULL); @@ -377,7 +377,7 @@ void RenderBobbyR() } RenderWWWProgramTitleBar( ); - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } @@ -385,7 +385,7 @@ void RenderBobbyR() BOOLEAN InitBobbyRWoodBackground() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; // load the Wood bacground graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; @@ -404,7 +404,7 @@ BOOLEAN DeleteBobbyRWoodBackground() BOOLEAN DrawBobbyRWoodBackground() { - HVOBJECT hWoodBackGroundHandle; + HVOBJECT hWoodBackGroundHandle; UINT16 x,y, uiPosX, uiPosY; // Blt the Wood background @@ -416,7 +416,7 @@ BOOLEAN DrawBobbyRWoodBackground() uiPosX = BOBBY_WOOD_BACKGROUND_X; for(x=0; x<4; x++) { - BltVideoObject(FRAME_BUFFER, hWoodBackGroundHandle, 0,uiPosX, uiPosY, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hWoodBackGroundHandle, 0,uiPosX, uiPosY, VO_BLT_SRCTRANSPARENCY,NULL); uiPosX += BOBBY_WOOD_BACKGROUND_WIDTH; } uiPosY += BOBBY_WOOD_BACKGROUND_HEIGHT; @@ -434,9 +434,9 @@ BOOLEAN InitBobbiesMouseRegion(UINT8 ubNumerRegions, UINT16 *usMouseRegionPosArr { //Mouse region for the toc buttons MSYS_DefineRegion( &MouseRegion[i], usMouseRegionPosArray[ubCount], usMouseRegionPosArray[ubCount+1], usMouseRegionPosArray[ubCount+2], usMouseRegionPosArray[ubCount+3], MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectBobbiesSignMenuRegionCallBack); - MSYS_AddRegion(&MouseRegion[i]); - MSYS_SetRegionUserData( &MouseRegion[i], 0, gubBobbyRPages[i]); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectBobbiesSignMenuRegionCallBack); + MSYS_AddRegion(&MouseRegion[i]); + MSYS_SetRegionUserData( &MouseRegion[i], 0, gubBobbyRPages[i]); ubCount +=4; } @@ -460,7 +460,7 @@ BOOLEAN RemoveBobbiesMouseRegion(UINT8 ubNumberRegions, MOUSE_REGION *Mouse_Regi void SelectBobbiesSignMenuRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { @@ -474,14 +474,14 @@ void SelectBobbiesSignMenuRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } /* BOOLEAN WebPageTileBackground(UINT8 ubNumX, UINT8 ubNumY, UINT16 usWidth, UINT16 usHeight, UINT32 uiBackground) { - HVOBJECT hBackGroundHandle; + HVOBJECT hBackGroundHandle; UINT16 x,y, uiPosX, uiPosY; // Blt the Wood background @@ -493,7 +493,7 @@ BOOLEAN WebPageTileBackground(UINT8 ubNumX, UINT8 ubNumY, UINT16 usWidth, UINT16 uiPosX = LAPTOP_SCREEN_UL_X; for(x=0; x BOBBYR_UNDERCONSTRUCTION_ANI_DELAY )||( fReDrawScreenFlag ) ) { - // The undercontsruction graphic + // The undercontsruction graphic GetVideoObject(&hPixHandle, guiUnderConstructionImage ); BltVideoObject(FRAME_BUFFER, hPixHandle, usCount, BOBBYR_UNDERCONSTRUCTION_X, BOBBYR_UNDERCONSTRUCTION_Y, VO_BLT_SRCTRANSPARENCY,NULL); @@ -532,8 +532,8 @@ void HandleBobbyRUnderConstructionAni( BOOLEAN fReset ) DrawTextToScreen( BobbyRaysFrontText[ BOBBYR_UNDER_CONSTRUCTION ], BOBBYR_UNDER_CONSTRUCTION_TEXT_X, BOBBYR_UNDER_CONSTRUCTION_TEXT_Y, BOBBYR_UNDER_CONSTRUCTION_TEXT_WIDTH, FONT16ARIAL, BOBBIES_SENTENCE_COLOR, BOBBIES_SIGN_BACKCOLOR, FALSE, CENTER_JUSTIFIED | INVALIDATE_TEXT ); - InvalidateRegion( BOBBYR_UNDERCONSTRUCTION_X, BOBBYR_UNDERCONSTRUCTION_Y, BOBBYR_UNDERCONSTRUCTION_X+BOBBYR_UNDERCONSTRUCTION_WIDTH, BOBBYR_UNDERCONSTRUCTION_Y+BOBBYR_UNDERCONSTRUCTION_HEIGHT ); - InvalidateRegion( BOBBYR_UNDERCONSTRUCTION_X, BOBBYR_UNDERCONSTRUCTION1_Y, BOBBYR_UNDERCONSTRUCTION_X+BOBBYR_UNDERCONSTRUCTION_WIDTH, BOBBYR_UNDERCONSTRUCTION1_Y+BOBBYR_UNDERCONSTRUCTION_HEIGHT ); + InvalidateRegion( BOBBYR_UNDERCONSTRUCTION_X, BOBBYR_UNDERCONSTRUCTION_Y, BOBBYR_UNDERCONSTRUCTION_X+BOBBYR_UNDERCONSTRUCTION_WIDTH, BOBBYR_UNDERCONSTRUCTION_Y+BOBBYR_UNDERCONSTRUCTION_HEIGHT ); + InvalidateRegion( BOBBYR_UNDERCONSTRUCTION_X, BOBBYR_UNDERCONSTRUCTION1_Y, BOBBYR_UNDERCONSTRUCTION_X+BOBBYR_UNDERCONSTRUCTION_WIDTH, BOBBYR_UNDERCONSTRUCTION1_Y+BOBBYR_UNDERCONSTRUCTION_HEIGHT ); uiLastTime = GetJA2Clock(); @@ -794,7 +794,7 @@ void OrderBobbyRItem(UINT16 usItemIndex) { UINT32 uiArrivalTime; - //add the new item to the queue. The new item will arrive in 'uiArrivalTime' minutes. + //add the new item to the queue. The new item will arrive in 'uiArrivalTime' minutes. uiArrivalTime = BOBBY_R_NEW_PURCHASE_ARRIVAL_TIME + Random( BOBBY_R_NEW_PURCHASE_ARRIVAL_TIME / 2 ); uiArrivalTime += GetWorldTotalMin(); AddStrategicEvent( EVENT_UPDATE_BOBBY_RAY_INVENTORY, uiArrivalTime, usItemIndex); @@ -830,7 +830,7 @@ void AddFreshBobbyRayInventory( UINT16 usItemIndex ) if (sInventorySlot == -1) { DebugMsg(TOPIC_JA2, DBG_LEVEL_3,String("AddFreshBobbyRayInventory: item not found! = %d", usItemIndex )); - AssertMsg( FALSE, String( "AddFreshBobbyRayInventory(), Item %d not found. AM-0.", usItemIndex ) ); + AssertMsg( FALSE, String( "AddFreshBobbyRayInventory(), Item %d not found. AM-0.", usItemIndex ) ); return; } @@ -915,6 +915,7 @@ void CancelAllPendingBRPurchaseOrders(void) - + + diff --git a/Laptop/BobbyR.h b/Laptop/BobbyR.h index a3cd9fce..486a9a80 100644 --- a/Laptop/BobbyR.h +++ b/Laptop/BobbyR.h @@ -1,9 +1,14 @@ #ifndef __BOBBYR_H #define __BOBBYR_H -#include "Item Types.h" +//#include "Item Types.h" #include "Store Inventory.h" +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + void GameInitBobbyR(); BOOLEAN EnterBobbyR(); @@ -34,12 +39,12 @@ extern UINT16 gusFirstMiscIndex; extern UINT16 gusLastMiscIndex; extern UINT8 gubNumMiscPages; -extern UINT16 gusFirstArmourIndex; -extern UINT16 gusLastArmourIndex; +extern UINT16 gusFirstArmourIndex; +extern UINT16 gusLastArmourIndex; extern UINT8 gubNumArmourPages; -extern UINT16 gusFirstUsedIndex; -extern UINT16 gusLastUsedIndex; +extern UINT16 gusFirstUsedIndex; +extern UINT16 gusLastUsedIndex; extern UINT8 gubNumUsedPages; */ diff --git a/Laptop/BobbyRAmmo.cpp b/Laptop/BobbyRAmmo.cpp index 5d266af2..924f7185 100644 --- a/Laptop/BobbyRAmmo.cpp +++ b/Laptop/BobbyRAmmo.cpp @@ -26,7 +26,7 @@ void GameInitBobbyRAmmo() BOOLEAN EnterBobbyRAmmo() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; //gfBigImageMouseRegionCreated = FALSE; @@ -90,20 +90,21 @@ void RenderBobbyRAmmo() DisplayItemInfo(IC_AMMO, guiCurrentAmmoFilterMode); UpdateButtonText(guiCurrentLaptopMode); - + UpdateAmmoFilterButtons(guiCurrentAmmoFilterMode, guiPrevAmmoFilterMode); MarkButtonsDirty( ); RenderWWWProgramTitleBar( ); InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); - fReDrawScreenFlag = TRUE; - fPausedReDrawScreenFlag = TRUE; + fReDrawScreenFlag = TRUE; + fPausedReDrawScreenFlag = TRUE; } - + + diff --git a/Laptop/BobbyRArmour.cpp b/Laptop/BobbyRArmour.cpp index b0fe26a9..424830b1 100644 --- a/Laptop/BobbyRArmour.cpp +++ b/Laptop/BobbyRArmour.cpp @@ -25,7 +25,7 @@ void GameInitBobbyRArmour() BOOLEAN EnterBobbyRArmour() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; // load the background graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; @@ -76,7 +76,7 @@ void HandleBobbyRArmour() void RenderBobbyRArmour() { - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; WebPageTileBackground(BOBBYR_NUM_HORIZONTAL_TILES, BOBBYR_NUM_VERTICAL_TILES, BOBBYR_BACKGROUND_WIDTH, BOBBYR_BACKGROUND_HEIGHT, guiArmourBackground); @@ -85,7 +85,7 @@ void RenderBobbyRArmour() // GunForm GetVideoObject(&hPixHandle, guiArmourGrid); - BltVideoObject(FRAME_BUFFER, hPixHandle, 0, BOBBYR_GRIDLOC_X, BOBBYR_GRIDLOC_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, BOBBYR_GRIDLOC_X, BOBBYR_GRIDLOC_Y, VO_BLT_SRCTRANSPARENCY,NULL); DisplayItemInfo(IC_ARMOUR, guiCurrentArmourFilterMode); @@ -94,11 +94,11 @@ void RenderBobbyRArmour() UpdateArmourFilterButtons(guiCurrentArmourFilterMode, guiPrevArmourFilterMode); - MarkButtonsDirty( ); + MarkButtonsDirty( ); RenderWWWProgramTitleBar( ); - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); - fReDrawScreenFlag = TRUE; - fPausedReDrawScreenFlag = TRUE; + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + fReDrawScreenFlag = TRUE; + fPausedReDrawScreenFlag = TRUE; } @@ -107,6 +107,7 @@ void RenderBobbyRArmour() - + + diff --git a/Laptop/BobbyRGuns.cpp b/Laptop/BobbyRGuns.cpp index ea29acc3..a4fab9ca 100644 --- a/Laptop/BobbyRGuns.cpp +++ b/Laptop/BobbyRGuns.cpp @@ -38,10 +38,10 @@ #define BOBBYR_ORDER_TEXT_COLOR 75 #define BOBBYR_STATIC_TEXT_COLOR 75 -#define BOBBYR_ITEM_DESC_TEXT_FONT FONT10ARIAL -#define BOBBYR_ITEM_DESC_TEXT_COLOR FONT_MCOLOR_WHITE -#define BOBBYR_ITEM_NAME_TEXT_FONT FONT10ARIAL -#define BOBBYR_ITEM_NAME_TEXT_COLOR FONT_MCOLOR_WHITE +#define BOBBYR_ITEM_DESC_TEXT_FONT FONT10ARIAL +#define BOBBYR_ITEM_DESC_TEXT_COLOR FONT_MCOLOR_WHITE +#define BOBBYR_ITEM_NAME_TEXT_FONT FONT10ARIAL +#define BOBBYR_ITEM_NAME_TEXT_COLOR FONT_MCOLOR_WHITE #define NUM_BOBBYRPAGE_MENU 6 #define NUM_CATALOGUE_BUTTONS 5 @@ -70,8 +70,8 @@ #define BOBBYR_CATALOGUE_BUTTON_Y LAPTOP_SCREEN_WEB_UL_Y + 300 #define BOBBYR_CATALOGUE_BUTTON_WIDTH 56//75 -#define BOBBYR_HOME_BUTTON_X iScreenWidthOffset + 120 -#define BOBBYR_HOME_BUTTON_Y iScreenHeightOffset + 400 + LAPTOP_SCREEN_WEB_DELTA_Y +#define BOBBYR_HOME_BUTTON_X iScreenWidthOffset + 120 +#define BOBBYR_HOME_BUTTON_Y iScreenHeightOffset + 400 + LAPTOP_SCREEN_WEB_DELTA_Y #define BOBBYR_CATALOGUE_BUTTON_TEXT_Y BOBBYR_CATALOGUE_BUTTON_Y + 5 @@ -102,7 +102,7 @@ #define BOBBYR_ITEM_COST_TEXT_Y BOBBYR_GRIDLOC_Y + 6 #define BOBBYR_ITEM_COST_TEXT_WIDTH 42 -#define BOBBYR_ITEM_COST_NUM_X BOBBYR_ITEM_COST_TEXT_X +#define BOBBYR_ITEM_COST_NUM_X BOBBYR_ITEM_COST_TEXT_X #define BOBBYR_ITEM_COST_NUM_Y BOBBYR_ITEM_COST_TEXT_Y + 10 #define BOBBYR_ITEM_STOCK_TEXT_X BOBBYR_ITEM_COST_TEXT_X @@ -147,8 +147,8 @@ BobbyRayPurchaseStruct BobbyRayPurchases[ MAX_PURCHASE_AMOUNT ]; #define NUMBER_GUNS_FILTER_BUTTONS 9 #define NUMBER_AMMO_FILTER_BUTTONS 8 #define NUMBER_ARMOUR_FILTER_BUTTONS 4 -#define NUMBER_MISC_FILTER_BUTTONS 9 -#define NUMBER_USED_FILTER_BUTTONS 3 +#define NUMBER_MISC_FILTER_BUTTONS 10 +#define NUMBER_USED_FILTER_BUTTONS 4 #define BOBBYR_GUNS_FILTER_BUTTON_GAP BOBBYR_CATALOGUE_BUTTON_GAP - 1 #define BOBBYR_AMMO_FILTER_BUTTON_GAP BOBBYR_CATALOGUE_BUTTON_GAP - 1 @@ -196,6 +196,7 @@ INT8 ubFilterAmmoButtonValues[] = { INT8 ubFilterUsedButtonValues[] = { BOBBYR_FILTER_USED_GUNS, BOBBYR_FILTER_USED_ARMOR, + BOBBYR_FILTER_USED_LBEGEAR, BOBBYR_FILTER_USED_MISC}; INT8 ubFilterArmourButtonValues[] = { @@ -213,10 +214,11 @@ INT8 ubFilterMiscButtonValues[] = { BOBBYR_FILTER_MISC_MEDKIT, BOBBYR_FILTER_MISC_KIT, BOBBYR_FILTER_MISC_FACE, + BOBBYR_FILTER_MISC_LBEGEAR, BOBBYR_FILTER_MISC_MISC}; - + extern BOOLEAN fExitingLaptopFlag; UINT32 guiGunBackground; @@ -259,7 +261,7 @@ INT32 guiBobbyRNextPageImage; // Big Image Mouse region -MOUSE_REGION gSelectedBigImageRegion[ BOBBYR_NUM_WEAPONS_ON_PAGE ]; +MOUSE_REGION gSelectedBigImageRegion[ BOBBYR_NUM_WEAPONS_ON_PAGE ]; void SelectBigImageRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); // The order form button @@ -274,7 +276,7 @@ extern INT32 guiBobbyRHomeImage; // symbol already defined in BobbyRMailOrder.cp // Link from the title -MOUSE_REGION gSelectedTitleImageLinkRegion; +MOUSE_REGION gSelectedTitleImageLinkRegion; void SelectTitleImageLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); @@ -295,6 +297,8 @@ UINT16 DisplayDamage(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight); UINT16 DisplayRange(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight); UINT16 DisplayMagazine(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight); void DisplayItemNameAndInfo(UINT16 usPosY, UINT16 usIndex, UINT16 usBobbyIndex, BOOLEAN fUsed); +// CHRISL: New display function for LBE Gear +UINT16 DisplayLBEInfo(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight); UINT16 DisplayWeight(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight); UINT16 DisplayCaliber(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight); void CreateMouseRegionForBigImage(UINT16 usPosY, UINT8 ubCount, INT16 *pItemNumbers ); @@ -343,7 +347,7 @@ void EnterInitBobbyRGuns() BOOLEAN EnterBobbyRGuns() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; gfBigImageMouseRegionCreated = FALSE; @@ -366,9 +370,9 @@ BOOLEAN EnterBobbyRGuns() SetFirstLastPagesForNew( IC_BOBBY_GUN, guiCurrentGunFilterMode ); //Draw menu bar - InitBobbyMenuBar(); + InitBobbyMenuBar(); InitBobbyRGunsFilterBar(); - + // render once RenderBobbyRGuns( ); @@ -396,7 +400,7 @@ void HandleBobbyRGuns() void RenderBobbyRGuns() { - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; WebPageTileBackground(BOBBYR_NUM_HORIZONTAL_TILES, BOBBYR_NUM_VERTICAL_TILES, BOBBYR_BACKGROUND_WIDTH, BOBBYR_BACKGROUND_HEIGHT, guiGunBackground); @@ -416,19 +420,19 @@ void RenderBobbyRGuns() RenderWWWProgramTitleBar( ); //InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); - fReDrawScreenFlag = TRUE; - fPausedReDrawScreenFlag = TRUE; + fReDrawScreenFlag = TRUE; + fPausedReDrawScreenFlag = TRUE; } BOOLEAN DisplayBobbyRBrTitle() { - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; // BR title GetVideoObject(&hPixHandle, guiBrTitle); - BltVideoObject(FRAME_BUFFER, hPixHandle, 0, BOBBYR_BRTITLE_X, BOBBYR_BRTITLE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, BOBBYR_BRTITLE_X, BOBBYR_BRTITLE_Y, VO_BLT_SRCTRANSPARENCY,NULL); // To Order Text DrawTextToScreen(BobbyRText[BOBBYR_GUNS_TO_ORDER], BOBBYR_TO_ORDER_TITLE_X, BOBBYR_TO_ORDER_TITLE_Y, 0, BOBBYR_ORDER_TITLE_FONT, BOBBYR_ORDER_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); @@ -445,7 +449,7 @@ BOOLEAN DisplayBobbyRBrTitle() BOOLEAN InitBobbyBrTitle() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; // load the br title graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; @@ -454,9 +458,9 @@ BOOLEAN InitBobbyBrTitle() //initialize the link to the homepage by clicking on the title MSYS_DefineRegion( &gSelectedTitleImageLinkRegion, BOBBYR_BRTITLE_X, BOBBYR_BRTITLE_Y, (BOBBYR_BRTITLE_X + BOBBYR_BRTITLE_WIDTH), (UINT16)(BOBBYR_BRTITLE_Y + BOBBYR_BRTITLE_HEIGHT), MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectTitleImageLinkRegionCallBack); - MSYS_AddRegion( &gSelectedTitleImageLinkRegion ); - + CURSOR_WWW, MSYS_NO_CALLBACK, SelectTitleImageLinkRegionCallBack); + MSYS_AddRegion( &gSelectedTitleImageLinkRegion ); + gusOldItemNumOnTopOfPage=65535; @@ -476,7 +480,7 @@ BOOLEAN DeleteBobbyBrTitle() void SelectTitleImageLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -496,7 +500,7 @@ BOOLEAN InitBobbyRGunsFilterBar() bCurMode = 0; usPosX = FILTER_BUTTONS_GUN_START_X; - guiBobbyRFilterImage = LoadButtonImage("LAPTOP\\CatalogueButton1.sti", -1,0,-1,1,-1 ); + guiBobbyRFilterImage = LoadButtonImage("LAPTOP\\CatalogueButton1.sti", -1,0,-1,1,-1 ); // Loop through the filter buttons for(i=0; i 7) + //CHRISL: Don't display the LBEGEAR button if we're using the old inventory system + if((UsingNewInventorySystem() == false) && ubFilterMiscButtonValues[i] == BOBBYR_FILTER_MISC_LBEGEAR) { - usPosX = FILTER_BUTTONS_MISC_START_X; - usYOffset = 25; + continue; } + usPosX = FILTER_BUTTONS_MISC_START_X + ( (bCurMode % sItemWidth) * usXOffset); + usPosY = FILTER_BUTTONS_Y + ( (bCurMode / sItemWidth) * usYOffset); + // Filter buttons guiBobbyRFilterMisc[i] = CreateIconAndTextButton( guiBobbyRFilterImage, BobbyRFilter[BOBBYR_FILTER_MISC_BLADE+i], BOBBYR_GUNS_BUTTON_FONT, BOBBYR_GUNS_TEXT_COLOR_ON, BOBBYR_GUNS_SHADOW_COLOR, BOBBYR_GUNS_TEXT_COLOR_OFF, BOBBYR_GUNS_SHADOW_COLOR, TEXT_CJUSTIFIED, - usPosX, FILTER_BUTTONS_Y + usYOffset, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + usPosX, usPosY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnBobbyRFilterMiscCallback); SetButtonCursor(guiBobbyRFilterMisc[i], CURSOR_LAPTOP_SCREEN); - MSYS_SetBtnUserData( guiBobbyRFilterMisc[i], 0, ubFilterMiscButtonValues[bCurMode]); - - usPosX += BOBBYR_MISC_FILTER_BUTTON_GAP; + MSYS_SetBtnUserData( guiBobbyRFilterMisc[i], 0, ubFilterMiscButtonValues[i]); bCurMode++; } - + return(TRUE); } - -BOOLEAN InitBobbyMenuBar( ) +BOOLEAN InitBobbyMenuBar( ) { UINT8 i; UINT16 usPosX; @@ -700,27 +706,27 @@ BOOLEAN InitBobbyMenuBar( ) // Previous button guiBobbyRPreviousPageImage = LoadButtonImage("LAPTOP\\PreviousButton.sti", -1,0,-1,1,-1 ); - guiBobbyRPreviousPage = CreateIconAndTextButton( guiBobbyRPreviousPageImage, BobbyRText[BOBBYR_GUNS_PREVIOUS_ITEMS], BOBBYR_GUNS_BUTTON_FONT, - BOBBYR_GUNS_TEXT_COLOR_ON, BOBBYR_GUNS_SHADOW_COLOR, - BOBBYR_GUNS_TEXT_COLOR_OFF, BOBBYR_GUNS_SHADOW_COLOR, - TEXT_CJUSTIFIED, - BOBBYR_PREVIOUS_BUTTON_X, BOBBYR_PREVIOUS_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnBobbyRNextPreviousPageCallback); + guiBobbyRPreviousPage = CreateIconAndTextButton( guiBobbyRPreviousPageImage, BobbyRText[BOBBYR_GUNS_PREVIOUS_ITEMS], BOBBYR_GUNS_BUTTON_FONT, + BOBBYR_GUNS_TEXT_COLOR_ON, BOBBYR_GUNS_SHADOW_COLOR, + BOBBYR_GUNS_TEXT_COLOR_OFF, BOBBYR_GUNS_SHADOW_COLOR, + TEXT_CJUSTIFIED, + BOBBYR_PREVIOUS_BUTTON_X, BOBBYR_PREVIOUS_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnBobbyRNextPreviousPageCallback); SetButtonCursor(guiBobbyRPreviousPage, CURSOR_LAPTOP_SCREEN); MSYS_SetBtnUserData( guiBobbyRPreviousPage, 0, BOBBYR_PREVIOUS_PAGE); SpecifyDisabledButtonStyle( guiBobbyRPreviousPage, DISABLED_STYLE_SHADED ); - - guiBobbyRPageMenuImage = LoadButtonImage("LAPTOP\\CatalogueButton1.sti", -1,0,-1,1,-1 ); + + guiBobbyRPageMenuImage = LoadButtonImage("LAPTOP\\CatalogueButton1.sti", -1,0,-1,1,-1 ); // Next button - guiBobbyRNextPageImage = LoadButtonImage("LAPTOP\\NextButton.sti", -1,0,-1,1,-1 ); - guiBobbyRNextPage = CreateIconAndTextButton( guiBobbyRNextPageImage, BobbyRText[BOBBYR_GUNS_MORE_ITEMS], BOBBYR_GUNS_BUTTON_FONT, - BOBBYR_GUNS_TEXT_COLOR_ON, BOBBYR_GUNS_SHADOW_COLOR, - BOBBYR_GUNS_TEXT_COLOR_OFF, BOBBYR_GUNS_SHADOW_COLOR, - TEXT_CJUSTIFIED, - BOBBYR_NEXT_BUTTON_X, BOBBYR_NEXT_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnBobbyRNextPreviousPageCallback); + guiBobbyRNextPageImage = LoadButtonImage("LAPTOP\\NextButton.sti", -1,0,-1,1,-1 ); + guiBobbyRNextPage = CreateIconAndTextButton( guiBobbyRNextPageImage, BobbyRText[BOBBYR_GUNS_MORE_ITEMS], BOBBYR_GUNS_BUTTON_FONT, + BOBBYR_GUNS_TEXT_COLOR_ON, BOBBYR_GUNS_SHADOW_COLOR, + BOBBYR_GUNS_TEXT_COLOR_OFF, BOBBYR_GUNS_SHADOW_COLOR, + TEXT_CJUSTIFIED, + BOBBYR_NEXT_BUTTON_X, BOBBYR_NEXT_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnBobbyRNextPreviousPageCallback); SetButtonCursor(guiBobbyRNextPage, CURSOR_LAPTOP_SCREEN); MSYS_SetBtnUserData( guiBobbyRNextPage, 0, BOBBYR_NEXT_PAGE); SpecifyDisabledButtonStyle( guiBobbyRNextPage, DISABLED_STYLE_SHADED ); @@ -731,12 +737,12 @@ BOOLEAN InitBobbyMenuBar( ) for(i=0; iArea.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnBobbyRFilterGunsCallback(GUI_BUTTON *btn,INT32 reason) @@ -994,15 +1006,15 @@ void BtnBobbyRFilterGunsCallback(GUI_BUTTON *btn,INT32 reason) case BOBBYR_FILTER_GUNS_SHOTGUN: guiCurrentGunFilterMode = GUN_SHOTGUN; break; - } + } //if (guiCurrentAmmoFilterMode > -1) { SetFirstLastPagesForNew(IC_BOBBY_GUN, guiCurrentGunFilterMode); } - + UpdateGunFilterButtons(guiCurrentGunFilterMode, guiPrevGunFilterMode); - + DeleteMouseRegionForBigImage(); fReDrawScreenFlag = TRUE; fPausedReDrawScreenFlag = TRUE; @@ -1012,7 +1024,7 @@ void BtnBobbyRFilterGunsCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnBobbyRFilterAmmoCallback(GUI_BUTTON *btn,INT32 reason) { @@ -1034,7 +1046,7 @@ void BtnBobbyRFilterAmmoCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); guiPrevAmmoFilterMode = guiCurrentAmmoFilterMode; - + switch (bNewValue) { case BOBBYR_FILTER_AMMO_PISTOL: @@ -1075,7 +1087,7 @@ void BtnBobbyRFilterAmmoCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnBobbyRFilterUsedCallback(GUI_BUTTON *btn,INT32 reason) { @@ -1097,7 +1109,7 @@ void BtnBobbyRFilterUsedCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); guiPrevUsedFilterMode = guiCurrentUsedFilterMode; - + switch (bNewValue) { case BOBBYR_FILTER_USED_GUNS: @@ -1106,6 +1118,9 @@ void BtnBobbyRFilterUsedCallback(GUI_BUTTON *btn,INT32 reason) case BOBBYR_FILTER_USED_ARMOR: guiCurrentUsedFilterMode = IC_ARMOUR; break; + case BOBBYR_FILTER_USED_LBEGEAR: + guiCurrentUsedFilterMode = IC_LBEGEAR; + break; case BOBBYR_FILTER_USED_MISC: guiCurrentUsedFilterMode = IC_BOBBY_MISC; break; @@ -1113,7 +1128,7 @@ void BtnBobbyRFilterUsedCallback(GUI_BUTTON *btn,INT32 reason) UpdateUsedFilterButtons(); SetFirstLastPagesForUsed(guiCurrentUsedFilterMode); - + DeleteMouseRegionForBigImage(); fReDrawScreenFlag = TRUE; fPausedReDrawScreenFlag = TRUE; @@ -1123,7 +1138,7 @@ void BtnBobbyRFilterUsedCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnBobbyRFilterArmourCallback(GUI_BUTTON *btn,INT32 reason) @@ -1160,12 +1175,12 @@ void BtnBobbyRFilterArmourCallback(GUI_BUTTON *btn,INT32 reason) case BOBBYR_FILTER_ARMOUR_PLATE: guiCurrentArmourFilterMode = ARMOURCLASS_PLATE; break; - } + } SetFirstLastPagesForNew(IC_ARMOUR, guiCurrentArmourFilterMode); - + UpdateArmourFilterButtons(guiCurrentArmourFilterMode, guiPrevArmourFilterMode); - + DeleteMouseRegionForBigImage(); fReDrawScreenFlag = TRUE; fPausedReDrawScreenFlag = TRUE; @@ -1175,7 +1190,7 @@ void BtnBobbyRFilterArmourCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnBobbyRFilterMiscCallback(GUI_BUTTON *btn,INT32 reason) { @@ -1223,15 +1238,18 @@ void BtnBobbyRFilterMiscCallback(GUI_BUTTON *btn,INT32 reason) case BOBBYR_FILTER_MISC_FACE: guiCurrentMiscFilterMode = IC_FACE; break; + case BOBBYR_FILTER_MISC_LBEGEAR: + guiCurrentMiscFilterMode = IC_LBEGEAR; + break; case BOBBYR_FILTER_MISC_MISC: guiCurrentMiscFilterMode = IC_MISC; break; - } + } SetFirstLastPagesForNew(IC_BOBBY_MISC, guiCurrentMiscFilterMode); - + UpdateMiscFilterButtons(); - + DeleteMouseRegionForBigImage(); fReDrawScreenFlag = TRUE; fPausedReDrawScreenFlag = TRUE; @@ -1241,7 +1259,7 @@ void BtnBobbyRFilterMiscCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnBobbyRNextPreviousPageCallback(GUI_BUTTON *btn,INT32 reason) { @@ -1278,21 +1296,20 @@ void BtnBobbyRNextPreviousPageCallback(GUI_BUTTON *btn,INT32 reason) DeleteMouseRegionForBigImage(); fReDrawScreenFlag = TRUE; - fPausedReDrawScreenFlag = TRUE; + fPausedReDrawScreenFlag = TRUE; } if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} BOOLEAN DisplayItemInfo(UINT32 uiItemClass, INT32 iFilter) { UINT16 i; UINT8 ubCount=0; UINT16 PosY, usTextPosY; - UINT16 ubFirstIndex=0; UINT16 usItemIndex; CHAR16 sDollarTemp[60]; CHAR16 sTemp[60]; @@ -1365,7 +1382,7 @@ BOOLEAN DisplayItemInfo(UINT32 uiItemClass, INT32 iFilter) continue; } - // No Filter -> Take all + // No Filter->Take all if (iFilter == -1) { bAddItem = TRUE; @@ -1406,7 +1423,7 @@ BOOLEAN DisplayItemInfo(UINT32 uiItemClass, INT32 iFilter) gusItemNumberForItemsOnScreen[ ubCount ] = i; DisplayBigItemImage( usItemIndex, PosY); - + //Display Items Name DisplayItemNameAndInfo(usTextPosY, usItemIndex, i, gfOnUsedPage); @@ -1447,7 +1464,7 @@ BOOLEAN DisplayItemInfo(UINT32 uiItemClass, INT32 iFilter) gusItemNumberForItemsOnScreen[ ubCount ] = i; DisplayBigItemImage( usItemIndex, PosY); - + //Display Items Name DisplayItemNameAndInfo(usTextPosY, usItemIndex, i, gfOnUsedPage); @@ -1488,7 +1505,7 @@ BOOLEAN DisplayItemInfo(UINT32 uiItemClass, INT32 iFilter) gusItemNumberForItemsOnScreen[ ubCount ] = i; DisplayBigItemImage( usItemIndex, PosY); - + //Display Items Name DisplayItemNameAndInfo(usTextPosY, usItemIndex, i, gfOnUsedPage); @@ -1533,7 +1550,7 @@ BOOLEAN DisplayItemInfo(UINT32 uiItemClass, INT32 iFilter) gusItemNumberForItemsOnScreen[ ubCount ] = i; DisplayBigItemImage( usItemIndex, PosY); - + //Display Items Name DisplayItemNameAndInfo(usTextPosY, usItemIndex, i, gfOnUsedPage); @@ -1551,6 +1568,7 @@ BOOLEAN DisplayItemInfo(UINT32 uiItemClass, INT32 iFilter) case IC_MEDKIT: case IC_KIT: case IC_FACE: + case IC_LBEGEAR: // USED if (uiItemClass == BOBBYR_USED_ITEMS) { @@ -1561,6 +1579,7 @@ BOOLEAN DisplayItemInfo(UINT32 uiItemClass, INT32 iFilter) Item[usItemIndex].usItemClass == IC_MISC || Item[usItemIndex].usItemClass == IC_MEDKIT || Item[usItemIndex].usItemClass == IC_KIT || + Item[usItemIndex].usItemClass == IC_LBEGEAR || Item[usItemIndex].usItemClass == IC_FACE) { bAddItem = TRUE; @@ -1584,7 +1603,7 @@ BOOLEAN DisplayItemInfo(UINT32 uiItemClass, INT32 iFilter) gusItemNumberForItemsOnScreen[ ubCount ] = i; DisplayBigItemImage( usItemIndex, PosY); - + //Display Items Name DisplayItemNameAndInfo(usTextPosY, usItemIndex, i, gfOnUsedPage); @@ -1601,7 +1620,7 @@ BOOLEAN DisplayItemInfo(UINT32 uiItemClass, INT32 iFilter) if( gusOldItemNumOnTopOfPage != gusCurWeaponIndex ) { CreateMouseRegionForBigImage(BOBBYR_GRID_PIC_Y, ubCount, pItemNumbers ); - + gusOldItemNumOnTopOfPage = gusCurWeaponIndex; } @@ -1625,7 +1644,6 @@ BOOLEAN DisplayItemInfo(UINT32 uiItemClass, INT32 iFilter) BOOLEAN DisplayGunInfo(UINT16 usIndex, UINT16 usTextPosY, BOOLEAN fUsed, UINT16 usBobbyIndex) { UINT16 usHeight; - UINT32 uiStartLoc=0; UINT16 usFontHeight; usFontHeight = GetFontHeight(BOBBYR_ITEM_DESC_TEXT_FONT); @@ -1646,7 +1664,7 @@ BOOLEAN DisplayGunInfo(UINT16 usIndex, UINT16 usTextPosY, BOOLEAN fUsed, UINT16 //Range usHeight = DisplayRange(usHeight, usIndex, usFontHeight); - + //Damage usHeight = DisplayDamage(usHeight, usIndex, usFontHeight); @@ -1662,7 +1680,6 @@ BOOLEAN DisplayGunInfo(UINT16 usIndex, UINT16 usTextPosY, BOOLEAN fUsed, UINT16 BOOLEAN DisplayNonGunWeaponInfo(UINT16 usIndex, UINT16 usTextPosY, BOOLEAN fUsed, UINT16 usBobbyIndex) { UINT16 usHeight; - UINT32 uiStartLoc=0; UINT16 usFontHeight; usFontHeight = GetFontHeight(BOBBYR_ITEM_DESC_TEXT_FONT); @@ -1689,7 +1706,6 @@ BOOLEAN DisplayNonGunWeaponInfo(UINT16 usIndex, UINT16 usTextPosY, BOOLEAN fUsed BOOLEAN DisplayAmmoInfo(UINT16 usIndex, UINT16 usTextPosY, BOOLEAN fUsed, UINT16 usBobbyIndex) { UINT16 usHeight; - UINT32 uiStartLoc=0; UINT16 usFontHeight; usFontHeight = GetFontHeight(BOBBYR_ITEM_DESC_TEXT_FONT); @@ -1716,10 +1732,10 @@ BOOLEAN DisplayBigItemImage(UINT16 usIndex, UINT16 PosY) { INT16 PosX, sCenX, sCenY; UINT32 usHeight, usWidth; - ETRLEObject *pTrav; + ETRLEObject *pTrav; INVTYPE *pItem; UINT32 uiImage; - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; PosX = BOBBYR_GRID_PIC_X; @@ -1751,7 +1767,6 @@ BOOLEAN DisplayBigItemImage(UINT16 usIndex, UINT16 PosY) BOOLEAN DisplayArmourInfo(UINT16 usIndex, UINT16 usTextPosY, BOOLEAN fUsed, UINT16 usBobbyIndex) { UINT16 usHeight; - UINT32 uiStartLoc=0; UINT16 usFontHeight; usFontHeight = GetFontHeight(BOBBYR_ITEM_DESC_TEXT_FONT); @@ -1774,10 +1789,15 @@ BOOLEAN DisplayArmourInfo(UINT16 usIndex, UINT16 usTextPosY, BOOLEAN fUsed, UINT BOOLEAN DisplayMiscInfo(UINT16 usIndex, UINT16 usTextPosY, BOOLEAN fUsed, UINT16 usBobbyIndex) { UINT16 usHeight; - UINT32 uiStartLoc=0; UINT16 usFontHeight; usFontHeight = GetFontHeight(BOBBYR_ITEM_DESC_TEXT_FONT); + //CHRISL: Display extra information for LBE Items when using new inventory system + if((UsingNewInventorySystem() == true) && Item[usIndex].usItemClass == IC_LBEGEAR) + { + usHeight = DisplayLBEInfo(usTextPosY, usIndex, usFontHeight); + } + //Display Items Name // DisplayItemNameAndInfo(usTextPosY, usIndex, fUsed); @@ -1861,7 +1881,7 @@ UINT16 DisplayRof(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight) swprintf(sTemp, L"? %s", pMessageStrings[ MSG_RPM ] ); else swprintf(sTemp, L"%3d/%s", WeaponROF[ usIndex ], pMessageStrings[ MSG_MINUTE_ABBREVIATION ]); - + DrawTextToScreen(sTemp, BOBBYR_ITEM_WEIGHT_NUM_X, (UINT16)usPosY, BOBBYR_ITEM_WEIGHT_NUM_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); usPosY += usFontHeight + 2; @@ -1872,7 +1892,7 @@ UINT16 DisplayDamage(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight) { CHAR16 sTemp[20]; UINT16 gunDamage = 0; - + if ( Item[ usIndex ].usItemClass == IC_GUN || Item[ usIndex ].usItemClass == IC_LAUNCHER ) { gunDamage = (UINT16)( Weapon[ usIndex ].ubImpact + ( (double) Weapon[ usIndex ].ubImpact / 100) * gGameExternalOptions.ubGunDamageMultiplier ); @@ -1942,6 +1962,56 @@ UINT16 DisplayCaliber(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight) return(usPosY); } +// CHRISL: New display function for LBE Gear +UINT16 DisplayLBEInfo(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight) +{ + CHAR16 sTemp[20]; + CHAR16 pName[80]; + int lnCnt=0, count, size; + UINT16 lbeIndex; + UINT8 pIndex=0; + std::vector pocketNum; + + size = LBEPocketType.size(); + pocketNum.reserve(size); + lbeIndex = Item[usIndex].ubClassIndex; + // Determine number of each pocket definition + for(count = 0; count0) + { + if(lnCnt>4) + { + swprintf(sTemp, L"More..." ); + DrawTextToScreen(sTemp, BOBBYR_ITEM_WEIGHT_TEXT_X, (UINT16)usPosY, BOBBYR_ITEM_WEIGHT_NUM_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usPosY += usFontHeight + 2; + break; + } + else + { + mbstowcs(pName,LBEPocketType[count].pName,80); + pName[14] = '\0'; + swprintf(sTemp, L"%s(x%d)", pName, pocketNum[count] ); + DrawTextToScreen(sTemp, BOBBYR_ITEM_WEIGHT_TEXT_X, (UINT16)usPosY, BOBBYR_ITEM_WEIGHT_NUM_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usPosY += usFontHeight + 2; + lnCnt++; + } + } + } + return(usPosY); +} + UINT16 DisplayWeight(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight) { @@ -1961,10 +2031,8 @@ void DisplayItemNameAndInfo(UINT16 usPosY, UINT16 usIndex, UINT16 usBobbyIndex, { CHAR16 sText[400]; CHAR16 sTemp[20]; - UINT32 uiStartLoc=0; UINT8 ubPurchaseNumber; - UINT16 usFontHeight = GetFontHeight(BOBBYR_ITEM_DESC_TEXT_FONT); //Display Items Name //uiStartLoc = BOBBYR_ITEM_DESC_FILE_SIZE * usIndex; @@ -1974,7 +2042,7 @@ void DisplayItemNameAndInfo(UINT16 usPosY, UINT16 usIndex, UINT16 usBobbyIndex, if( StringPixLength( sText, BOBBYR_ITEM_NAME_TEXT_FONT ) > ( BOBBYR_GRID_PIC_WIDTH - 6 ) ) ReduceStringLength( sText, BOBBYR_GRID_PIC_WIDTH - 6, BOBBYR_ITEM_NAME_TEXT_FONT ); - + DrawTextToScreen(sText, BOBBYR_ITEM_NAME_X, (UINT16)(usPosY+BOBBYR_ITEM_NAME_Y_OFFSET), 0, BOBBYR_ITEM_NAME_TEXT_FONT, BOBBYR_ITEM_NAME_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); //number bought @@ -2069,7 +2137,6 @@ void SetFirstLastPagesForNew( UINT32 uiClassMask, INT32 iFilter ) UINT16 i; INT16 sFirst = -1; INT16 sLast = -1; - UINT16 ubPages=0; UINT16 ubNumItems=0; UINT16 usItemIndex = 0; @@ -2085,7 +2152,7 @@ void SetFirstLastPagesForNew( UINT32 uiClassMask, INT32 iFilter ) { if( Item[ LaptopSaveInfo.BobbyRayInventory[ i ].usItemIndex ].usItemClass & uiClassMask ) { - // No Filter -> Take all + // No Filter->Take all if (iFilter == -1) { bCntNumItems = TRUE; @@ -2151,7 +2218,7 @@ void SetFirstLastPagesForNew( UINT32 uiClassMask, INT32 iFilter ) gubNumPages = 0; return; } - + gusFirstItemIndex = (UINT16)sFirst; gusLastItemIndex = (UINT16)sLast; gubNumPages = (UINT8)( ubNumItems / (FLOAT)BOBBYR_NUM_WEAPONS_ON_PAGE ); @@ -2165,10 +2232,8 @@ void SetFirstLastPagesForUsed(INT32 iFilter) UINT16 i; INT16 sFirst = -1; INT16 sLast = -1; - UINT16 ubPages=0; UINT16 ubNumItems=0; UINT16 usItemIndex; - INT32 iFilterLauncher = IC_LAUNCHER; gubCurPage = 0; BOOLEAN bCntNumItems = FALSE; @@ -2180,7 +2245,7 @@ void SetFirstLastPagesForUsed(INT32 iFilter) //If we have some of the inventory on hand if( LaptopSaveInfo.BobbyRayUsedInventory[ i ].ubQtyOnHand != 0 ) { - // No Filter -> Take all + // No Filter->Take all if (iFilter == -1) { bCntNumItems = TRUE; @@ -2188,7 +2253,6 @@ void SetFirstLastPagesForUsed(INT32 iFilter) else { bCntNumItems = FALSE; - // Get the weapon from the item usItemIndex = LaptopSaveInfo.BobbyRayUsedInventory[ i ].usItemIndex; @@ -2213,6 +2277,12 @@ void SetFirstLastPagesForUsed(INT32 iFilter) bCntNumItems = TRUE; } break; + case IC_LBEGEAR: + if (Item[usItemIndex].usItemClass == IC_LBEGEAR) + { + bCntNumItems = TRUE; + } + break; case IC_BOBBY_MISC: if (Item[usItemIndex].usItemClass == IC_BLADE || Item[usItemIndex].usItemClass == IC_THROWING_KNIFE || @@ -2262,7 +2332,7 @@ void CreateMouseRegionForBigImage( UINT16 usPosY, UINT8 ubCount, INT16 *pItemNum UINT8 i; CHAR16 zItemName[ SIZE_ITEM_NAME ]; UINT8 ubItemCount=0; - CHAR16 pStr[ 250 ]; + CHAR16 pStr[ 250 ]; if( gfBigImageMouseRegionCreated ) return; @@ -2270,8 +2340,8 @@ void CreateMouseRegionForBigImage( UINT16 usPosY, UINT8 ubCount, INT16 *pItemNum for(i=0; iubShotsLeft[0], //Shots left + // (*pObject)[0]->data.ubShotsLeft, //Shots left // gWeaponStatsDesc[ 12 ], //Weight String // fWeight, //Weight // GetWeightUnitString() //Weight units @@ -2447,9 +2517,9 @@ void CreateMouseRegionForBigImage( UINT16 usPosY, UINT8 ubCount, INT16 *pItemNum //and only if the user has an item that can use the particular type of ammo ubItemCount = CheckPlayersInventoryForGunMatchingGivenAmmoID( pItemNumbers[ i ] ); if( ubItemCount != 0 ) - { + { swprintf( zItemName, L"\n%s %d %s",BobbyRText[BOBBYR_GUNS_NUM_GUNS_THAT_USE_AMMO_1], ubItemCount, BobbyRText[BOBBYR_GUNS_NUM_GUNS_THAT_USE_AMMO_2] ); - wcscat( pStr, zItemName ); + wcscat( pStr, zItemName ); } } break; @@ -2462,8 +2532,8 @@ void CreateMouseRegionForBigImage( UINT16 usPosY, UINT8 ubCount, INT16 *pItemNum UINT16 explDamage = (UINT16)( Explosive[Item[ pItemNumbers[ i ] ].ubClassIndex].ubDamage + ( (double) Explosive[Item[ pItemNumbers[ i ] ].ubClassIndex].ubDamage / 100) * gGameExternalOptions.ubExplosivesDamageMultiplier ); UINT16 explStunDamage = (UINT16)( Explosive[Item[ pItemNumbers[ i ] ].ubClassIndex].ubStunDamage + ( (double) Explosive[Item[ pItemNumbers[ i ] ].ubClassIndex].ubStunDamage / 100) * gGameExternalOptions.ubExplosivesDamageMultiplier ); - swprintf( pStr, L"%s\n%s %d\n%s %d\n%s %1.1f %s", - ItemNames[ pItemNumbers[ i ] ], + swprintf( pStr, L"%s\n%s %d\n%s %d\n%s %1.1f %s", + ItemNames[ pItemNumbers[ i ] ], gWeaponStatsDesc[ 11 ], //Damage String explDamage, //Expl damage gWeaponStatsDesc[ 13 ], //Stun Damage String @@ -2500,7 +2570,7 @@ void CreateMouseRegionForBigImage( UINT16 usPosY, UINT8 ubCount, INT16 *pItemNum break; } - swprintf( pStr, L"%s\n%s %d%% (%d)\n%s %d%%\n%s %1.1f %s", + swprintf( pStr, L"%s\n%s %d%% (%d)\n%s %d%%\n%s %1.1f %s", ItemNames[ pItemNumbers[ i ] ], //Item long name pInvPanelTitleStrings[ 4 ], //Protection string iProtection, //Protection rating in % based on best armor @@ -2521,7 +2591,7 @@ void CreateMouseRegionForBigImage( UINT16 usPosY, UINT8 ubCount, INT16 *pItemNum default: // The final, and typical case, is that of an item with a percent status { - swprintf( pStr, L"%s\n%s %1.1f %s", + swprintf( pStr, L"%s\n%s %1.1f %s", ItemNames[ pItemNumbers[ i ] ], //Item long name gWeaponStatsDesc[ 12 ], //Weight String fWeight, //Weight @@ -2560,7 +2630,7 @@ void DeleteMouseRegionForBigImage() void SelectBigImageRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { @@ -2572,7 +2642,7 @@ void SelectBigImageRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) PurchaseBobbyRayItem( gusItemNumberForItemsOnScreen[ usItemNum] ); fReDrawScreenFlag = TRUE; - fPausedReDrawScreenFlag = TRUE; + fPausedReDrawScreenFlag = TRUE; } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { @@ -2580,7 +2650,7 @@ void SelectBigImageRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) UnPurchaseBobbyRayItem( gusItemNumberForItemsOnScreen[ usItemNum] ); fReDrawScreenFlag = TRUE; - fPausedReDrawScreenFlag = TRUE; + fPausedReDrawScreenFlag = TRUE; } else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT) { @@ -2588,7 +2658,7 @@ void SelectBigImageRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) PurchaseBobbyRayItem( gusItemNumberForItemsOnScreen[ usItemNum] ); fReDrawScreenFlag = TRUE; - fPausedReDrawScreenFlag = TRUE; + fPausedReDrawScreenFlag = TRUE; } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_REPEAT) { @@ -2596,7 +2666,7 @@ void SelectBigImageRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) UnPurchaseBobbyRayItem( gusItemNumberForItemsOnScreen[ usItemNum] ); fReDrawScreenFlag = TRUE; - fPausedReDrawScreenFlag = TRUE; + fPausedReDrawScreenFlag = TRUE; } } @@ -2634,7 +2704,7 @@ void PurchaseBobbyRayItem(UINT16 usItemNumber) } } - // Else If the item is already purchased increment purchase amount. Only if ordering less then the max amount! + // Else If the item is already purchased increment purchase amount. Only if ordering less then the max amount! else { if( BobbyRayPurchases[ ubPurchaseNumber ].ubNumberPurchased <= BOBBY_RAY_MAX_AMOUNT_OF_ITEMS_TO_PURCHASE) @@ -2675,7 +2745,7 @@ void PurchaseBobbyRayItem(UINT16 usItemNumber) DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, BobbyRText[ BOBBYR_MORE_THEN_10_PURCHASES ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); } } - // Else If the item is already purchased increment purchase amount. Only if ordering less then the max amount! + // Else If the item is already purchased increment purchase amount. Only if ordering less then the max amount! else { if( BobbyRayPurchases[ ubPurchaseNumber ].ubNumberPurchased <= BOBBY_RAY_MAX_AMOUNT_OF_ITEMS_TO_PURCHASE) @@ -2760,7 +2830,7 @@ void BtnBobbyROrderFormCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnBobbyRHomeButtonCallback(GUI_BUTTON *btn,INT32 reason) { @@ -2780,7 +2850,7 @@ void BtnBobbyRHomeButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void UpdateButtonText(UINT32 uiCurPage) @@ -2884,7 +2954,9 @@ void UpdateUsedFilterButtons() { EnableButton(guiBobbyRFilterUsed[0]); EnableButton(guiBobbyRFilterUsed[1]); - EnableButton(guiBobbyRFilterUsed[2]); + if(guiBobbyRFilterUsed[2]) + EnableButton(guiBobbyRFilterUsed[2]); + EnableButton(guiBobbyRFilterUsed[3]); switch (guiCurrentUsedFilterMode) { @@ -2894,9 +2966,12 @@ void UpdateUsedFilterButtons() case IC_ARMOUR: DisableButton(guiBobbyRFilterUsed[1]); break; - case IC_BOBBY_MISC: + case IC_LBEGEAR: DisableButton(guiBobbyRFilterUsed[2]); break; + case IC_BOBBY_MISC: + DisableButton(guiBobbyRFilterUsed[3]); + break; } } @@ -2928,7 +3003,9 @@ void UpdateMiscFilterButtons() EnableButton(guiBobbyRFilterMisc[5]); EnableButton(guiBobbyRFilterMisc[6]); EnableButton(guiBobbyRFilterMisc[7]); - EnableButton(guiBobbyRFilterMisc[8]); + if(guiBobbyRFilterMisc[8]) + EnableButton(guiBobbyRFilterMisc[8]); + EnableButton(guiBobbyRFilterMisc[9]); switch (guiCurrentMiscFilterMode) { @@ -2956,9 +3033,12 @@ void UpdateMiscFilterButtons() case IC_FACE: DisableButton(guiBobbyRFilterMisc[7]); break; - case IC_MISC: + case IC_LBEGEAR: DisableButton(guiBobbyRFilterMisc[8]); break; + case IC_MISC: + DisableButton(guiBobbyRFilterMisc[9]); + break; } //if (iNewButton != iOldButton) @@ -2981,7 +3061,7 @@ UINT16 CalcBobbyRayCost( UINT16 usIndex, UINT16 usBobbyIndex, BOOLEAN fUsed) { DOUBLE value; if( fUsed ) - value = Item[ LaptopSaveInfo.BobbyRayUsedInventory[ usBobbyIndex ].usItemIndex ].usPrice * + value = Item[ LaptopSaveInfo.BobbyRayUsedInventory[ usBobbyIndex ].usItemIndex ].usPrice * ( .5 + .5 * ( LaptopSaveInfo.BobbyRayUsedInventory[ usBobbyIndex ].ubItemQuality ) / 100 ) + .5; else value = Item[ LaptopSaveInfo.BobbyRayInventory[ usBobbyIndex ].usItemIndex ].usPrice; @@ -3019,7 +3099,7 @@ void DisableBobbyRButtons() else EnableButton( guiBobbyRNextPage ); } - + // if it is the first page, disable the prev page buitton if( gubCurPage == 0 ) @@ -3089,6 +3169,12 @@ void CalcFirstIndexForPage( STORE_INVENTORY *pInv, UINT32 uiItemClass ) bCntItem = TRUE; } break; + case IC_LBEGEAR: + if (Item[usItemIndex].usItemClass == IC_LBEGEAR) + { + bCntItem = TRUE; + } + break; case IC_BOBBY_MISC: if (Item[usItemIndex].usItemClass == IC_BLADE || Item[usItemIndex].usItemClass == IC_THROWING_KNIFE || @@ -3164,7 +3250,7 @@ void CalcFirstIndexForPage( STORE_INVENTORY *pInv, UINT32 uiItemClass ) { bCntItem = TRUE; } - + } } else if (uiItemClass == IC_ARMOUR) @@ -3222,14 +3308,14 @@ void CalcFirstIndexForPage( STORE_INVENTORY *pInv, UINT32 uiItemClass ) } } -BOOLEAN IsAmmoMatchinWeaponType(UINT16 usItemIndex, UINT8 ubWeaponType) +BOOLEAN IsAmmoMatchinWeaponType(UINT16 usItemIndex, UINT8 ubWeaponType) { // usItemIndex == Ammo BOOLEAN bRetValue = FALSE; UINT32 i; - + for (i = 0; i < MAXITEMS; i++) { // We found the Weapon that uses this Ammo @@ -3255,9 +3341,9 @@ BOOLEAN IsAmmoMatchinWeaponType(UINT16 usItemIndex, UINT8 ubWeaponType) void OutOfStockMessageBoxCallBack( UINT8 bExitValue ) { // yes, load the game - if( bExitValue == MSG_BOX_RETURN_OK ) + if( bExitValue == MSG_BOX_RETURN_OK ) { -// guiCurrentLaptopMode = LAPTOP_MODE_BOBBY_R; +// guiCurrentLaptopMode = LAPTOP_MODE_BOBBY_R; } } @@ -3279,7 +3365,7 @@ UINT8 CheckPlayersInventoryForGunMatchingGivenAmmoID( INT16 sItemID ) if( Menptr[ ubMercCount ].bActive ) { //loop through all the pockets on the merc - for( ubPocketCount=0; ubPocketCountuiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnBobbyRAcceptOrderCallback(GUI_BUTTON *btn,INT32 reason) @@ -786,7 +786,7 @@ void BtnBobbyRAcceptOrderCallback(GUI_BUTTON *btn,INT32 reason) else { //else pop up a confirmation box - swprintf( zTemp, BobbyROrderFormText[BOBBYR_CONFIRM_DEST], *BobbyROrderLocations[gbSelectedCity].psCityLoc ); + swprintf( zTemp, BobbyROrderFormText[BOBBYR_CONFIRM_DEST], *BobbyROrderLocations[gbSelectedCity].psCityLoc ); DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, zTemp, LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmBobbyRPurchaseMessageBoxCallBack ); } @@ -831,7 +831,7 @@ void BtnBobbyRAcceptOrderCallback(GUI_BUTTON *btn,INT32 reason) if( BobbyRayPurchases[ i ].ubNumberPurchased ) { //copy the purchases into the struct that will be added to the queue - memcpy(&LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray[ cnt ].BobbyRayPurchase[ ubCount ] , &BobbyRayPurchases[i], sizeof(BobbyRayPurchaseStruct)); + memcpy(&LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray[ cnt ].BobbyRayPurchase[ ubCount ] , &BobbyRayPurchases[i], sizeof(BobbyRayPurchaseStruct)); ubCount ++; } } @@ -840,7 +840,7 @@ void BtnBobbyRAcceptOrderCallback(GUI_BUTTON *btn,INT32 reason) LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray[ cnt ].fActive = TRUE; LaptopSaveInfo.usNumberOfBobbyRayOrderUsed++; - //get the length of time to receive the shipment + //get the length of time to receive the shipment if( gubSelectedLight == 0 ) { bDaysAhead = OVERNIGHT_EXPRESS; @@ -861,7 +861,7 @@ void BtnBobbyRAcceptOrderCallback(GUI_BUTTON *btn,INT32 reason) bDaysAhead = 0; //uiResetTimeSec = 0; } - + if (gMercProfiles[99].bLife == 0) { // Sal is dead, so Pablo is dead, so the airport is badly run @@ -878,14 +878,14 @@ void BtnBobbyRAcceptOrderCallback(GUI_BUTTON *btn,INT32 reason) //Add the transaction to the finance page AddTransactionToPlayersBook(BOBBYR_PURCHASE, 0, GetWorldTotalMin(), -giGrandTotal); - + //display the confirm order graphic gfDrawConfirmOrderGrpahic = TRUE; //Get rid of the city drop dowm, if it is being displayed gubDropDownAction = BR_DROP_DOWN_DESTROY; - MSYS_EnableRegion(&gSelectedConfirmOrderRegion); + MSYS_EnableRegion(&gSelectedConfirmOrderRegion); */ } } @@ -897,7 +897,7 @@ void BtnBobbyRAcceptOrderCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void DisplayPurchasedItems( BOOLEAN fCalledFromOrderPage, UINT16 usGridX, UINT16 usGridY, BobbyRayPurchaseStruct *pBobbyRayPurchase, BOOLEAN fJustDisplayTitles, INT32 iOrderNum ) @@ -969,7 +969,7 @@ void DisplayPurchasedItems( BOOLEAN fCalledFromOrderPage, UINT16 usGridX, UINT16 { //if the item was purchased // if( BobbyRayPurchases[ i ].ubNumberPurchased ) - if( pBobbyRayPurchase[i].ubNumberPurchased ) + if( pBobbyRayPurchase[i].ubNumberPurchased ) { uiTotal = 0; @@ -1063,7 +1063,7 @@ void DisplayShippingCosts( BOOLEAN fCalledFromOrderPage, INT32 iSubTotal, UINT16 // INT32 iTotal; if( fCalledFromOrderPage ) - { + { iSubTotal = guiSubTotal; // iTotal = giGrandTotal; @@ -1103,12 +1103,12 @@ void DisplayShippingCosts( BOOLEAN fCalledFromOrderPage, INT32 iSubTotal, UINT16 //erase the old area // bli the total Saved area onto the grid if( fCalledFromOrderPage ) - { + { GetVideoObject(&hPixHandle, guiTotalSaveArea); - BltVideoObject(FRAME_BUFFER, hPixHandle, 0, BOBBYR_TOTAL_SAVED_AREA_X, BOBBYR_TOTAL_SAVED_AREA_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, BOBBYR_TOTAL_SAVED_AREA_X, BOBBYR_TOTAL_SAVED_AREA_Y, VO_BLT_SRCTRANSPARENCY,NULL); } - + //if there is a shipment, display the s&h charge if( iSubTotal ) { @@ -1125,7 +1125,7 @@ void DisplayShippingCosts( BOOLEAN fCalledFromOrderPage, INT32 iSubTotal, UINT16 InsertDollarSignInToString( sTemp ); DrawTextToScreen(sTemp, (UINT16)(usGridX + BOBBYR_GRID_FIFTH_COLUMN_X-2), (UINT16)(usGridY + BOBBYR_SHIPPING_N_HANDLE_Y), BOBBYR_GRID_FIFTH_COLUMN_WIDTH, BOBBYR_ORDER_DYNAMIC_TEXT_FONT, BOBBYR_ORDER_DYNAMIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); - + //Display the grand total giGrandTotal = iSubTotal + iShippingCost; @@ -1136,7 +1136,7 @@ void DisplayShippingCosts( BOOLEAN fCalledFromOrderPage, INT32 iSubTotal, UINT16 DrawTextToScreen(sTemp, (UINT16)(usGridX + BOBBYR_GRID_FIFTH_COLUMN_X-2), (UINT16)(usGridY + BOBBYR_GRAND_TOTAL_Y), BOBBYR_GRID_FIFTH_COLUMN_WIDTH, BOBBYR_ORDER_DYNAMIC_TEXT_FONT, BOBBYR_ORDER_DYNAMIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); } - InvalidateRegion(iScreenWidthOffset + 333,iScreenHeightOffset + 326,iScreenWidthOffset + 374,iScreenHeightOffset + 400); + InvalidateRegion(iScreenWidthOffset + 333,iScreenHeightOffset + 326,iScreenWidthOffset + 374,iScreenHeightOffset + 400); } @@ -1160,7 +1160,7 @@ void BtnBobbyRBackCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnBobbyRHomeCallback(GUI_BUTTON *btn,INT32 reason) @@ -1173,7 +1173,7 @@ void BtnBobbyRHomeCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); - guiCurrentLaptopMode = LAPTOP_MODE_BOBBY_R; + guiCurrentLaptopMode = LAPTOP_MODE_BOBBY_R; InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) @@ -1181,10 +1181,10 @@ void BtnBobbyRHomeCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void SelectShippingSpeedRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -1193,7 +1193,7 @@ void SelectShippingSpeedRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) gubSelectedLight = (UINT8)MSYS_GetRegionUserData( pRegion, 0 ); DrawShippingSpeedLights( gubSelectedLight ); DisplayShippingCosts( TRUE, 0, BOBBYR_ORDERGRID_X, BOBBYR_ORDERGRID_Y, -1 ); - } + } } BOOLEAN DrawShippingSpeedLights(UINT8 ubSelected) @@ -1220,7 +1220,7 @@ BOOLEAN DrawShippingSpeedLights(UINT8 ubSelected) void SelectConfirmOrderRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -1237,8 +1237,8 @@ void SelectConfirmOrderRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) //Goto The homepage guiCurrentLaptopMode = LAPTOP_MODE_BOBBY_R; - - } + + } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { //Remove the items for Boby Rqys Inventory @@ -1249,8 +1249,8 @@ void SelectConfirmOrderRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) gubSelectedLight = 0; gfDestroyConfirmGrphiArea = TRUE; gubSelectedLight = 0; - - } + + } } @@ -1287,8 +1287,8 @@ BOOLEAN CreateDestroyBobbyRDropDown( UINT8 ubDropDownAction ) for( i=0; i< BOBBYR_NUM_DISPLAYED_CITIES; i++) { MSYS_DefineRegion( &gSelectedDropDownRegion[i], usPosX, (UINT16)(usPosY+4), (UINT16)(usPosX+BOBBYR_DROP_DOWN_WIDTH-6), (UINT16)(usPosY+usFontHeight+7), MSYS_PRIORITY_HIGH, - CURSOR_WWW, SelectDropDownMovementCallBack, SelectDropDownRegionCallBack); - MSYS_AddRegion(&gSelectedDropDownRegion[i]); + CURSOR_WWW, SelectDropDownMovementCallBack, SelectDropDownRegionCallBack); + MSYS_AddRegion(&gSelectedDropDownRegion[i]); MSYS_SetRegionUserData( &gSelectedDropDownRegion[ i ], 0, i); usPosY += usFontHeight + 2; @@ -1304,8 +1304,8 @@ BOOLEAN CreateDestroyBobbyRDropDown( UINT8 ubDropDownAction ) for(i=0; i<2; i++) { MSYS_DefineRegion( &gSelectedUpDownArrowOnScrollAreaRegion[i], usPosX, usPosY, (UINT16)(usPosX+BOBBYR_SCROLL_ARROW_WIDTH), (UINT16)(usPosY+BOBBYR_SCROLL_ARROW_HEIGHT), MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectUpDownArrowOnScrollAreaRegionCallBack); - MSYS_AddRegion(&gSelectedUpDownArrowOnScrollAreaRegion[i]); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectUpDownArrowOnScrollAreaRegionCallBack); + MSYS_AddRegion(&gSelectedUpDownArrowOnScrollAreaRegion[i]); MSYS_SetRegionUserData( &gSelectedUpDownArrowOnScrollAreaRegion[ i ], 0, i); usPosX = BOBBYR_SCROLL_DOWN_ARROW_X; usPosY = BOBBYR_SCROLL_DOWN_ARROW_Y; @@ -1318,32 +1318,32 @@ BOOLEAN CreateDestroyBobbyRDropDown( UINT8 ubDropDownAction ) for(i=0; iRegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); } -} +} @@ -1565,7 +1564,7 @@ void DrawSelectedCity( UINT8 ubCityNumber ) //display the name in the list ColorFillVideoSurfaceArea( FRAME_BUFFER, BOBBYR_CITY_START_LOCATION_X+4, usPosY+4, BOBBYR_CITY_START_LOCATION_X+BOBBYR_DROP_DOWN_WIDTH-4, usPosY+usFontHeight+6, Get16BPPColor( FROMRGB( 200, 169, 87 ) ) ); - SetFontShadow(NO_SHADOW); + SetFontShadow(NO_SHADOW); if( ubCityNumber == 255 ) DrawTextToScreen( *(BobbyROrderLocations[ 0 ].psCityLoc), BOBBYR_CITY_START_LOCATION_X+BOBBYR_CITY_NAME_OFFSET, (UINT16)(usPosY+5), 0, BOBBYR_DROPDOWN_FONT, BOBBYR_FONT_BLACK, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); else @@ -1611,7 +1610,7 @@ void DisplayShippingLocationCity() if( gbSelectedCity != -1 ) { - swprintf( sTemp, L"%d", ( INT32 )(BobbyROrderLocations[gbSelectedCity].usOverNightExpress/GetWeightBasedOnMetricOption( 1 ) ) ); + swprintf( sTemp, L"%d", ( INT32 )(BobbyROrderLocations[gbSelectedCity].usOverNightExpress/GetWeightBasedOnMetricOption( 1 ) ) ); InsertCommasForDollarFigure( sTemp ); InsertDollarSignInToString( sTemp ); } @@ -1640,14 +1639,14 @@ void DisplayShippingLocationCity() } void SelectCloseDroDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) { gubDropDownAction = BR_DROP_DOWN_DESTROY; - } + } } @@ -1702,7 +1701,7 @@ BOOLEAN IsAnythingPurchasedFromBobbyRayPage() } void SelectTitleLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -1714,7 +1713,7 @@ void SelectTitleLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) void SelectScrollAreaDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -1737,7 +1736,7 @@ void SelectScrollAreaDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReaso } gubDropDownAction = BR_DROP_DOWN_DISPLAY; - } + } else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT) { UINT8 ubCityNum = (UINT8)MSYS_GetRegionUserData( pRegion, 0 ); @@ -1799,11 +1798,11 @@ void SelectScrollAreaDropDownMovementCallBack(MOUSE_REGION * pRegion, INT32 reas InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); } } -} +} void SelectUpDownArrowOnScrollAreaRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -1836,14 +1835,14 @@ void SelectUpDownArrowOnScrollAreaRegionCallBack(MOUSE_REGION * pRegion, INT32 i } gubDropDownAction = BR_DROP_DOWN_DISPLAY; - } + } } void DrawGoldRectangle( INT8 bCityNum ) { - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; UINT16 usWidth, usTempHeight, usTempPosY, usHeight; UINT16 usPosX, usPosY; @@ -1857,10 +1856,10 @@ void DrawGoldRectangle( INT8 bCityNum ) usPosX = BOBBYR_SCROLL_AREA_X; usWidth = BOBBYR_SCROLL_AREA_WIDTH - 5; usTempHeight = ( BOBBYR_SCROLL_AREA_HEIGHT - 2 * BOBBYR_SCROLL_ARROW_HEIGHT ) - 8; - + usHeight = usTempHeight / (BOBBYR_ORDER_NUM_SHIPPING_CITIES+1); - usPosY = usTempPosY + (UINT16)( ( ( BOBBYR_SCROLL_AREA_HEIGHT - 2 * BOBBYR_SCROLL_ARROW_HEIGHT ) / (FLOAT)(BOBBYR_ORDER_NUM_SHIPPING_CITIES +1) ) * bCityNum ); + usPosY = usTempPosY + (UINT16)( ( ( BOBBYR_SCROLL_AREA_HEIGHT - 2 * BOBBYR_SCROLL_ARROW_HEIGHT ) / (FLOAT)(BOBBYR_ORDER_NUM_SHIPPING_CITIES +1) ) * bCityNum ); temp = BOBBYR_SCROLL_AREA_Y + BOBBYR_SCROLL_AREA_HEIGHT - BOBBYR_SCROLL_ARROW_HEIGHT - usHeight - 1; @@ -1870,17 +1869,17 @@ void DrawGoldRectangle( INT8 bCityNum ) ColorFillVideoSurfaceArea( FRAME_BUFFER, BOBBYR_SCROLL_AREA_X, usPosY, BOBBYR_SCROLL_AREA_X+usWidth, usPosY+usHeight, Get16BPPColor( FROMRGB( 186, 165, 68 ) ) ); //display the line - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - // draw the gold highlite line on the top and left + // draw the gold highlite line on the top and left LineDraw(FALSE, usPosX, usPosY, usPosX+usWidth, usPosY, Get16BPPColor( FROMRGB( 235, 222, 171 ) ), pDestBuf); LineDraw(FALSE, usPosX, usPosY, usPosX, usPosY+usHeight, Get16BPPColor( FROMRGB( 235, 222, 171 ) ), pDestBuf); - // draw the shadow line on the bottom and right + // draw the shadow line on the bottom and right LineDraw(FALSE, usPosX, usPosY+usHeight, usPosX+usWidth, usPosY+usHeight, Get16BPPColor( FROMRGB( 65, 49, 6 ) ), pDestBuf); LineDraw(FALSE, usPosX+usWidth, usPosY, usPosX+usWidth, usPosY+usHeight, Get16BPPColor( FROMRGB( 65, 49, 6 ) ), pDestBuf); - + // unlock frame buffer UnLockVideoSurface( FRAME_BUFFER ); } @@ -1900,7 +1899,7 @@ UINT32 CalcCostFromWeightOfPackage( UINT8 ubTypeOfService ) //Get the package's weight uiTotalWeight = CalcPackageTotalWeight(); - + /* for(i=0; iuiFlags &= (~BUTTON_CLICKED_ON ); - guiCurrentLaptopMode = LAPTOP_MODE_BOBBYR_SHIPMENTS; + guiCurrentLaptopMode = LAPTOP_MODE_BOBBYR_SHIPMENTS; InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) @@ -2227,12 +2226,12 @@ void BtnBobbyRGotoShipmentPageCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} BOOLEAN CreateBobbyRayOrderTitle() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; // load BobbyRayTitle graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; @@ -2241,8 +2240,8 @@ BOOLEAN CreateBobbyRayOrderTitle() //the link to home page from the title MSYS_DefineRegion( &gSelectedTitleLinkRegion, BOBBYR_BOBBY_RAY_TITLE_X, BOBBYR_BOBBY_RAY_TITLE_Y, (BOBBYR_BOBBY_RAY_TITLE_X + BOBBYR_BOBBY_RAY_TITLE_WIDTH), (UINT16)(BOBBYR_BOBBY_RAY_TITLE_Y + BOBBYR_BOBBY_RAY_TITLE_HEIGHT), MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectTitleLinkRegionCallBack); - MSYS_AddRegion( &gSelectedTitleLinkRegion ); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectTitleLinkRegionCallBack); + MSYS_AddRegion( &gSelectedTitleLinkRegion ); return( TRUE ); } @@ -2255,11 +2254,11 @@ void DestroyBobbyROrderTitle() void DrawBobbyROrderTitle() { - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; // Bobbyray title GetVideoObject(&hPixHandle, guiBobbyRayTitle); - BltVideoObject(FRAME_BUFFER, hPixHandle, 0, BOBBYR_BOBBY_RAY_TITLE_X, BOBBYR_BOBBY_RAY_TITLE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, BOBBYR_BOBBY_RAY_TITLE_X, BOBBYR_BOBBY_RAY_TITLE_Y, VO_BLT_SRCTRANSPARENCY,NULL); } @@ -2308,7 +2307,7 @@ BOOLEAN AddNewBobbyRShipment( BobbyRayPurchaseStruct *pPurchaseStruct, UINT8 ubD gpNewBobbyrShipments[ iFoundSpot ].fDisplayedInShipmentPage = FALSE; //get the package weight, if the weight is "below" the minimum, use the minimum - if( uiPackageWeight < MIN_SHIPPING_WEIGHT ) + if( uiPackageWeight < MIN_SHIPPING_WEIGHT ) { gpNewBobbyrShipments[ iFoundSpot ].uiPackageWeight = MIN_SHIPPING_WEIGHT; } @@ -2330,7 +2329,7 @@ BOOLEAN AddNewBobbyRShipment( BobbyRayPurchaseStruct *pPurchaseStruct, UINT8 ubD memcpy( &gpNewBobbyrShipments[ iFoundSpot ].BobbyRayPurchase[ ubItemCount ], &pPurchaseStruct[i], sizeof( BobbyRayPurchaseStruct ) ); //copy the purchases into the struct that will be added to the queue -// memcpy(&LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray[ cnt ].BobbyRayPurchase[ ubCount ] , &BobbyRayPurchases[i], sizeof(BobbyRayPurchaseStruct)); +// memcpy(&LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray[ cnt ].BobbyRayPurchase[ ubCount ] , &BobbyRayPurchases[i], sizeof(BobbyRayPurchaseStruct)); ubItemCount++; } } @@ -2338,12 +2337,12 @@ BOOLEAN AddNewBobbyRShipment( BobbyRayPurchaseStruct *pPurchaseStruct, UINT8 ubD gpNewBobbyrShipments[ iFoundSpot ].ubNumberPurchases = ubItemCount; - //get the length of time to receive the shipment + //get the length of time to receive the shipment if( fPruchasedFromBobbyR ) bDaysAhead = CalculateOrderDelay( ubDeliveryMethod ); else bDaysAhead = ubDeliveryMethod; - + //AddStrategicEvent( EVENT_BOBBYRAY_PURCHASE, uiResetTimeSec, cnt); AddFutureDayStrategicEvent( EVENT_BOBBYRAY_PURCHASE, (8 + Random(4) ) * 60, iFoundSpot, bDaysAhead ); @@ -2451,6 +2450,6 @@ BOOLEAN NewWayOfLoadingBobbyRMailOrdersToSaveGameFile( HWFILE hFile ) - + diff --git a/Laptop/BobbyRMisc.cpp b/Laptop/BobbyRMisc.cpp index 28e13e91..b79e4db4 100644 --- a/Laptop/BobbyRMisc.cpp +++ b/Laptop/BobbyRMisc.cpp @@ -25,7 +25,7 @@ void GameInitBobbyRMisc() BOOLEAN EnterBobbyRMisc() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; // load the background graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; @@ -46,7 +46,7 @@ BOOLEAN EnterBobbyRMisc() //Draw menu bar InitBobbyMenuBar( ); - + InitBobbyRMiscFilterBar(); // CalculateFirstAndLastIndexs(); @@ -77,7 +77,7 @@ void HandleBobbyRMisc() void RenderBobbyRMisc() { - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; WebPageTileBackground(BOBBYR_NUM_HORIZONTAL_TILES, BOBBYR_NUM_VERTICAL_TILES, BOBBYR_BACKGROUND_WIDTH, BOBBYR_BACKGROUND_HEIGHT, guiMiscBackground); @@ -95,8 +95,8 @@ void RenderBobbyRMisc() MarkButtonsDirty( ); RenderWWWProgramTitleBar( ); InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); - fReDrawScreenFlag = TRUE; - fPausedReDrawScreenFlag = TRUE; + fReDrawScreenFlag = TRUE; + fPausedReDrawScreenFlag = TRUE; } @@ -105,6 +105,7 @@ void RenderBobbyRMisc() - + + diff --git a/Laptop/BobbyRShipments.cpp b/Laptop/BobbyRShipments.cpp index b9a3d9dd..ddc51a49 100644 --- a/Laptop/BobbyRShipments.cpp +++ b/Laptop/BobbyRShipments.cpp @@ -88,7 +88,7 @@ INT32 giBobbyRShipmentHomeImage; -MOUSE_REGION gSelectedPreviousShipmentsRegion[BOBBYR_SHIPMENT_NUM_PREVIOUS_SHIPMENTS]; +MOUSE_REGION gSelectedPreviousShipmentsRegion[BOBBYR_SHIPMENT_NUM_PREVIOUS_SHIPMENTS]; void SelectPreviousShipmentsRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); @@ -117,7 +117,7 @@ void GameInitBobbyRShipments() BOOLEAN EnterBobbyRShipments() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; InitBobbyRWoodBackground(); @@ -127,23 +127,23 @@ BOOLEAN EnterBobbyRShipments() CHECKF(AddVideoObject(&VObjectDesc, &guiBobbyRShipmentGrid)); - guiBobbyRShipmentBackImage = LoadButtonImage("LAPTOP\\CatalogueButton.sti", -1,0,-1,1,-1 ); - guiBobbyRShipmetBack = CreateIconAndTextButton( guiBobbyRShipmentBackImage, BobbyROrderFormText[BOBBYR_BACK], BOBBYR_GUNS_BUTTON_FONT, - BOBBYR_GUNS_TEXT_COLOR_ON, BOBBYR_GUNS_SHADOW_COLOR, - BOBBYR_GUNS_TEXT_COLOR_OFF, BOBBYR_GUNS_SHADOW_COLOR, - TEXT_CJUSTIFIED, - BOBBYR_SHIPMENT_BACK_BUTTON_X, BOBBYR_SHIPMENT_BACK_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnBobbyRShipmentBackCallback); + guiBobbyRShipmentBackImage = LoadButtonImage("LAPTOP\\CatalogueButton.sti", -1,0,-1,1,-1 ); + guiBobbyRShipmetBack = CreateIconAndTextButton( guiBobbyRShipmentBackImage, BobbyROrderFormText[BOBBYR_BACK], BOBBYR_GUNS_BUTTON_FONT, + BOBBYR_GUNS_TEXT_COLOR_ON, BOBBYR_GUNS_SHADOW_COLOR, + BOBBYR_GUNS_TEXT_COLOR_OFF, BOBBYR_GUNS_SHADOW_COLOR, + TEXT_CJUSTIFIED, + BOBBYR_SHIPMENT_BACK_BUTTON_X, BOBBYR_SHIPMENT_BACK_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnBobbyRShipmentBackCallback); SetButtonCursor( guiBobbyRShipmetBack, CURSOR_LAPTOP_SCREEN); - giBobbyRShipmentHomeImage = UseLoadedButtonImage( guiBobbyRShipmentBackImage, -1,0,-1,1,-1 ); - guiBobbyRShipmentHome = CreateIconAndTextButton( giBobbyRShipmentHomeImage, BobbyROrderFormText[BOBBYR_HOME], BOBBYR_GUNS_BUTTON_FONT, - BOBBYR_GUNS_TEXT_COLOR_ON, BOBBYR_GUNS_SHADOW_COLOR, - BOBBYR_GUNS_TEXT_COLOR_OFF, BOBBYR_GUNS_SHADOW_COLOR, - TEXT_CJUSTIFIED, - BOBBYR_SHIPMENT_HOME_BUTTON_X, BOBBYR_SHIPMENT_HOME_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnBobbyRShipmentHomeCallback); + giBobbyRShipmentHomeImage = UseLoadedButtonImage( guiBobbyRShipmentBackImage, -1,0,-1,1,-1 ); + guiBobbyRShipmentHome = CreateIconAndTextButton( giBobbyRShipmentHomeImage, BobbyROrderFormText[BOBBYR_HOME], BOBBYR_GUNS_BUTTON_FONT, + BOBBYR_GUNS_TEXT_COLOR_ON, BOBBYR_GUNS_SHADOW_COLOR, + BOBBYR_GUNS_TEXT_COLOR_OFF, BOBBYR_GUNS_SHADOW_COLOR, + TEXT_CJUSTIFIED, + BOBBYR_SHIPMENT_HOME_BUTTON_X, BOBBYR_SHIPMENT_HOME_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnBobbyRShipmentHomeCallback); SetButtonCursor( guiBobbyRShipmentHome, CURSOR_LAPTOP_SCREEN); CreateBobbyRayOrderTitle(); @@ -195,7 +195,7 @@ void HandleBobbyRShipments() void RenderBobbyRShipments() { -// HVOBJECT hPixHandle; +// HVOBJECT hPixHandle; DrawBobbyRWoodBackground(); @@ -206,7 +206,7 @@ void RenderBobbyRShipments() DisplayShipmentGrid(); - if( giBobbyRShipmentSelectedShipment != -1 && + if( giBobbyRShipmentSelectedShipment != -1 && gpNewBobbyrShipments[ giBobbyRShipmentSelectedShipment ].fActive && gpNewBobbyrShipments[ giBobbyRShipmentSelectedShipment ].fDisplayedInShipmentPage ) { @@ -222,9 +222,9 @@ void RenderBobbyRShipments() DisplayShipmentTitles(); DisplayPreviousShipments(); - MarkButtonsDirty( ); + MarkButtonsDirty( ); RenderWWWProgramTitleBar( ); - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } void BtnBobbyRShipmentBackCallback(GUI_BUTTON *btn,INT32 reason) @@ -247,7 +247,7 @@ void BtnBobbyRShipmentBackCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnBobbyRShipmentHomeCallback(GUI_BUTTON *btn,INT32 reason) @@ -261,7 +261,7 @@ void BtnBobbyRShipmentHomeCallback(GUI_BUTTON *btn,INT32 reason) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); - guiCurrentLaptopMode = LAPTOP_MODE_BOBBY_R; + guiCurrentLaptopMode = LAPTOP_MODE_BOBBY_R; InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } @@ -270,20 +270,20 @@ void BtnBobbyRShipmentHomeCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void DisplayShipmentGrid() { - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; GetVideoObject(&hPixHandle, guiBobbyRShipmentGrid); // Shipment Order Grid - BltVideoObject(FRAME_BUFFER, hPixHandle, 0, BOBBYR_SHIPMENT_DELIVERY_GRID_X, BOBBYR_SHIPMENT_DELIVERY_GRID_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, BOBBYR_SHIPMENT_DELIVERY_GRID_X, BOBBYR_SHIPMENT_DELIVERY_GRID_Y, VO_BLT_SRCTRANSPARENCY,NULL); // Order Grid - BltVideoObject(FRAME_BUFFER, hPixHandle, 1, BOBBYR_SHIPMENT_ORDER_GRID_X, BOBBYR_SHIPMENT_ORDER_GRID_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 1, BOBBYR_SHIPMENT_ORDER_GRID_X, BOBBYR_SHIPMENT_ORDER_GRID_Y, VO_BLT_SRCTRANSPARENCY,NULL); } @@ -355,8 +355,8 @@ void CreatePreviousShipmentsMouseRegions() for( uiCnt=0; uiCntuiFlags & BUTTON_ENABLED)) return; if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } - + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - + btn->uiFlags&=~(BUTTON_CLICKED_ON); // back to the main page, otherwise, back to home page if( iCurrentImpPage == IMP_MAIN_PAGE ) { - iCurrentImpPage = IMP_HOME_PAGE; - fButtonPendingFlag = TRUE; - iCurrentProfileMode = 0; - fFinishedCharGeneration = FALSE; - ResetCharacterStats( ); + iCurrentImpPage = IMP_HOME_PAGE; + fButtonPendingFlag = TRUE; + iCurrentProfileMode = 0; + fFinishedCharGeneration = FALSE; + ResetCharacterStats( ); } else if( iCurrentImpPage == IMP_FINISH ) - { + { iCurrentImpPage = IMP_MAIN_PAGE; iCurrentProfileMode = 4; fFinishedCharGeneration = FALSE; - fButtonPendingFlag = TRUE; - //iCurrentProfileMode = 0; - //fFinishedCharGeneration = FALSE; - //ResetCharacterStats( ); + fButtonPendingFlag = TRUE; + //iCurrentProfileMode = 0; + //fFinishedCharGeneration = FALSE; + //ResetCharacterStats( ); } else if( iCurrentImpPage == IMP_PERSONALITY_QUIZ || iCurrentImpPage == IMP_PERSONALITY_FINISH) { giMaxPersonalityQuizQuestion = 0; - fStartOverFlag = TRUE; + fStartOverFlag = TRUE; iCurrentAnswer = -1; iCurrentImpPage = IMP_PERSONALITY; fButtonPendingFlag = TRUE; } - else + else { if( iCurrentImpPage == IMP_ATTRIBUTE_PAGE ) { SetAttributes( ); fFirstIMPAttribTime = TRUE; } - iCurrentImpPage = IMP_MAIN_PAGE; + iCurrentImpPage = IMP_MAIN_PAGE; iCurrentAnswer = -1; } - } + } } @@ -725,6 +725,7 @@ BOOLEAN HasTheCurrentIMPPageBeenVisited( void ) - + + diff --git a/Laptop/CharProfile.h b/Laptop/CharProfile.h index c1776167..0a0eb29a 100644 --- a/Laptop/CharProfile.h +++ b/Laptop/CharProfile.h @@ -66,7 +66,7 @@ extern STR16 pImpPopUpStrings[]; enum{ IMP_HOME_PAGE, IMP_BEGIN, - IMP_FINISH, + IMP_FINISH, IMP_MAIN_PAGE, IMP_PERSONALITY, IMP_PERSONALITY_QUIZ, diff --git a/Laptop/IMP AboutUs.cpp b/Laptop/IMP AboutUs.cpp index fcbd76e1..1048b5d1 100644 --- a/Laptop/IMP AboutUs.cpp +++ b/Laptop/IMP AboutUs.cpp @@ -31,19 +31,19 @@ void EnterIMPAboutUs( void ) // create buttons CreateIMPAboutUsButtons( ); - // entry into IMP about us page + // entry into IMP about us page RenderIMPAboutUs( ); - + return; } void ExitIMPAboutUs( void ) { - // exit from IMP About us page - + // exit from IMP About us page + // delete Buttons - DeleteIMPAboutUsButtons( ); + DeleteIMPAboutUsButtons( ); return; } @@ -51,17 +51,17 @@ void ExitIMPAboutUs( void ) void RenderIMPAboutUs( void ) { - // rneders the IMP about us page - + // rneders the IMP about us page + // the background RenderProfileBackGround( ); - + // the IMP symbol RenderIMPSymbol( 106, 1 ); // about us indent RenderAboutUsIndentFrame( 8, 130 ); - // about us indent + // about us indent RenderAboutUsIndentFrame( 258, 130 ); return; @@ -70,7 +70,7 @@ void RenderIMPAboutUs( void ) void HandleIMPAboutUs( void ) { - // handles the IMP about us page + // handles the IMP about us page return; } @@ -79,33 +79,33 @@ void HandleIMPAboutUs( void ) void CreateIMPAboutUsButtons( void ) { - // this function will create the buttons needed for th IMP about us page - // the back button button - giIMPAboutUsButtonImage[0]= LoadButtonImage( "LAPTOP\\button_3.sti" ,-1,0,-1,1,-1 ); - /*giIMPAboutUsButton[0] = QuickCreateButton( giIMPAboutUsButtonImage[0], LAPTOP_SCREEN_UL_X + 426 , LAPTOP_SCREEN_WEB_UL_Y + ( 360 ), + // this function will create the buttons needed for th IMP about us page + // the back button button + giIMPAboutUsButtonImage[0]= LoadButtonImage( "LAPTOP\\button_3.sti" ,-1,0,-1,1,-1 ); + /*giIMPAboutUsButton[0] = QuickCreateButton( giIMPAboutUsButtonImage[0], LAPTOP_SCREEN_UL_X + 426 , LAPTOP_SCREEN_WEB_UL_Y + ( 360 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPBackCallback); */ - giIMPAboutUsButton[0] = CreateIconAndTextButton( giIMPAboutUsButtonImage[0], pImpButtonText[6], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + 216, LAPTOP_SCREEN_WEB_UL_Y + ( 360 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPBackCallback); - - SetButtonCursor(giIMPAboutUsButton[0], CURSOR_WWW); - - return; + giIMPAboutUsButton[0] = CreateIconAndTextButton( giIMPAboutUsButtonImage[0], pImpButtonText[6], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + 216, LAPTOP_SCREEN_WEB_UL_Y + ( 360 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPBackCallback); + + SetButtonCursor(giIMPAboutUsButton[0], CURSOR_WWW); + + return; } void DeleteIMPAboutUsButtons( void ) { - // this function destroys the buttons needed for the IMP about Us Page + // this function destroys the buttons needed for the IMP about Us Page - // the about back button - RemoveButton(giIMPAboutUsButton[0] ); - UnloadButtonImage(giIMPAboutUsButtonImage[0] ); + // the about back button + RemoveButton(giIMPAboutUsButton[0] ); + UnloadButtonImage(giIMPAboutUsButtonImage[0] ); return; @@ -120,14 +120,14 @@ void BtnIMPBackCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - iCurrentImpPage = IMP_HOME_PAGE; + btn->uiFlags&=~(BUTTON_CLICKED_ON); + iCurrentImpPage = IMP_HOME_PAGE; } - } -} \ No newline at end of file + } +} diff --git a/Laptop/IMP Attribute Entrance.cpp b/Laptop/IMP Attribute Entrance.cpp index 244940bd..2a0ec1a2 100644 --- a/Laptop/IMP Attribute Entrance.cpp +++ b/Laptop/IMP Attribute Entrance.cpp @@ -17,7 +17,7 @@ #include "IMP Text System.h" #endif -// the buttons +// the buttons UINT32 giIMPAttributeEntranceButtonImage[ 1 ]; UINT32 giIMPAttributeEntranceButton[ 1 ]; @@ -41,18 +41,18 @@ void EnterIMPAttributeEntrance( void ) void RenderIMPAttributeEntrance( void ) { - // the background + // the background RenderProfileBackGround( ); // avg merc indent - RenderAvgMercIndentFrame(90, 40 ); - + RenderAvgMercIndentFrame(90, 40 ); + return; } void ExitIMPAttributeEntrance( void ) { - // destroy the finish buttons + // destroy the finish buttons DestroyIMPAttributeEntranceButtons( ); return; @@ -61,10 +61,10 @@ void ExitIMPAttributeEntrance( void ) void HandleIMPAttributeEntrance( void ) { - - - return; + + + return; } @@ -72,18 +72,18 @@ void CreateIMPAttributeEntranceButtons( void ) { // the begin button - giIMPAttributeEntranceButtonImage[0]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); + giIMPAttributeEntranceButtonImage[0]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); /* - giIMPAttributeEntranceButton[0] = QuickCreateButton( giIMPAttributeEntranceButtonImage[0], LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), + giIMPAttributeEntranceButton[0] = QuickCreateButton( giIMPAttributeEntranceButtonImage[0], LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeBeginCallback ); */ - giIMPAttributeEntranceButton[0] = CreateIconAndTextButton( giIMPAttributeEntranceButtonImage[ 0 ], pImpButtonText[ 13 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeBeginCallback); + giIMPAttributeEntranceButton[0] = CreateIconAndTextButton( giIMPAttributeEntranceButtonImage[ 0 ], pImpButtonText[ 13 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeBeginCallback); SetButtonCursor(giIMPAttributeEntranceButton[0], CURSOR_WWW); return; @@ -93,12 +93,12 @@ void CreateIMPAttributeEntranceButtons( void ) void DestroyIMPAttributeEntranceButtons( void ) { // this function will destroy the buttons needed for the IMP attrib enter page - - // the begin button - RemoveButton(giIMPAttributeEntranceButton[ 0 ] ); - UnloadButtonImage(giIMPAttributeEntranceButtonImage[ 0 ] ); - + // the begin button + RemoveButton(giIMPAttributeEntranceButton[ 0 ] ); + UnloadButtonImage(giIMPAttributeEntranceButtonImage[ 0 ] ); + + return; } @@ -113,15 +113,15 @@ void BtnIMPAttributeBeginCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - iCurrentImpPage = IMP_ATTRIBUTE_PAGE; + btn->uiFlags&=~(BUTTON_CLICKED_ON); + iCurrentImpPage = IMP_ATTRIBUTE_PAGE; fButtonPendingFlag = TRUE; } - } -} \ No newline at end of file + } +} diff --git a/Laptop/IMP Attribute Finish.cpp b/Laptop/IMP Attribute Finish.cpp index ca64467e..ad208a0f 100644 --- a/Laptop/IMP Attribute Finish.cpp +++ b/Laptop/IMP Attribute Finish.cpp @@ -35,14 +35,14 @@ BOOLEAN CameBackToAttributesPageButNotFinished(); void BtnIMPAttributeFinishYesCallback(GUI_BUTTON *btn,INT32 reason); void BtnIMPAttributeFinishNoCallback(GUI_BUTTON *btn,INT32 reason); - + void EnterIMPAttributeFinish( void ) { - // create the needed buttons + // create the needed buttons CreateAttributeFinishButtons( ); // render screen - RenderIMPAttributeFinish( ); + RenderIMPAttributeFinish( ); return; @@ -51,11 +51,11 @@ void EnterIMPAttributeFinish( void ) void RenderIMPAttributeFinish( void ) { - // render background + // render background RenderProfileBackGround( ); - + // indent for text - RenderBeginIndent( 110, 93 ); + RenderBeginIndent( 110, 93 ); return; } @@ -63,7 +63,7 @@ void RenderIMPAttributeFinish( void ) void ExitIMPAttributeFinish( void ) { - // destroy the buttons for this screen + // destroy the buttons for this screen DestroyAttributeFinishButtons( ); return; @@ -81,40 +81,40 @@ void CreateAttributeFinishButtons( void ) { // this procedure will create the buttons needed for the attribute finish screen - + // the yes button - giIMPAttributeFinishButtonImage[0]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); -/* giIMPAttributeFinishButton[0] = QuickCreateButton( giIMPAttributeFinishButtonImage[0], LAPTOP_SCREEN_UL_X + ( 90 ), LAPTOP_SCREEN_WEB_UL_Y + ( 224 ), + giIMPAttributeFinishButtonImage[0]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); +/* giIMPAttributeFinishButton[0] = QuickCreateButton( giIMPAttributeFinishButtonImage[0], LAPTOP_SCREEN_UL_X + ( 90 ), LAPTOP_SCREEN_WEB_UL_Y + ( 224 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeFinishYesCallback ); */ - giIMPAttributeFinishButton[0] = CreateIconAndTextButton( giIMPAttributeFinishButtonImage[0], pImpButtonText[ 20 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( 130 ), LAPTOP_SCREEN_WEB_UL_Y + ( 180 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeFinishYesCallback ); + giIMPAttributeFinishButton[0] = CreateIconAndTextButton( giIMPAttributeFinishButtonImage[0], pImpButtonText[ 20 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 130 ), LAPTOP_SCREEN_WEB_UL_Y + ( 180 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeFinishYesCallback ); // the no button - giIMPAttributeFinishButtonImage[1]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); -/* giIMPAttributeFinishButton[1] = QuickCreateButton( giIMPAttributeFinishButtonImage[1], LAPTOP_SCREEN_UL_X + ( 276 ), LAPTOP_SCREEN_WEB_UL_Y + ( 224 ), + giIMPAttributeFinishButtonImage[1]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); +/* giIMPAttributeFinishButton[1] = QuickCreateButton( giIMPAttributeFinishButtonImage[1], LAPTOP_SCREEN_UL_X + ( 276 ), LAPTOP_SCREEN_WEB_UL_Y + ( 224 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeFinishNoCallback ); */ - giIMPAttributeFinishButton[1] = CreateIconAndTextButton( giIMPAttributeFinishButtonImage[1], pImpButtonText[ 21 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( 130 ), LAPTOP_SCREEN_WEB_UL_Y + ( 264 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeFinishNoCallback); + giIMPAttributeFinishButton[1] = CreateIconAndTextButton( giIMPAttributeFinishButtonImage[1], pImpButtonText[ 21 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 130 ), LAPTOP_SCREEN_WEB_UL_Y + ( 264 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeFinishNoCallback); - SetButtonCursor(giIMPAttributeFinishButton[0], CURSOR_WWW); + SetButtonCursor(giIMPAttributeFinishButton[0], CURSOR_WWW); SetButtonCursor(giIMPAttributeFinishButton[1], CURSOR_WWW); - - return; + + return; } @@ -124,13 +124,13 @@ void DestroyAttributeFinishButtons( void ) // this procedure will destroy the buttons for the attribute finish screen - // the yes button - RemoveButton(giIMPAttributeFinishButton[ 0 ] ); - UnloadButtonImage(giIMPAttributeFinishButtonImage[ 0 ] ); + // the yes button + RemoveButton(giIMPAttributeFinishButton[ 0 ] ); + UnloadButtonImage(giIMPAttributeFinishButtonImage[ 0 ] ); - // the no button - RemoveButton(giIMPAttributeFinishButton[ 1 ] ); - UnloadButtonImage(giIMPAttributeFinishButtonImage[ 1 ] ); + // the no button + RemoveButton(giIMPAttributeFinishButton[ 1 ] ); + UnloadButtonImage(giIMPAttributeFinishButtonImage[ 1 ] ); return; } @@ -143,28 +143,28 @@ void BtnIMPAttributeFinishYesCallback(GUI_BUTTON *btn,INT32 reason) if (!(btn->uiFlags & BUTTON_ENABLED)) return; - if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - // gone far enough - iCurrentImpPage = IMP_MAIN_PAGE; -// if( iCurrentProfileMode < IMP__PORTRAIT ) + btn->uiFlags&=~(BUTTON_CLICKED_ON); + // gone far enough + iCurrentImpPage = IMP_MAIN_PAGE; +// if( iCurrentProfileMode < IMP__PORTRAIT ) if( !CameBackToAttributesPageButNotFinished() ) { - iCurrentProfileMode = IMP__FINISH;//IMP__PORTRAIT; + iCurrentProfileMode = IMP__FINISH;//IMP__PORTRAIT; } - // if we are already done, leave - if( iCurrentProfileMode == IMP__FINISH) + // if we are already done, leave + if( iCurrentProfileMode == IMP__FINISH) { - iCurrentImpPage = IMP_FINISH; + iCurrentImpPage = IMP_FINISH; } - + // SET ATTRIBUTES NOW SetGeneratedCharacterAttributes( ); fButtonPendingFlag = TRUE; @@ -195,13 +195,13 @@ void BtnIMPAttributeFinishNoCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); // if no, return to attribute iCurrentImpPage = IMP_ATTRIBUTE_PAGE; fReturnStatus = TRUE; diff --git a/Laptop/IMP Attribute Selection.cpp b/Laptop/IMP Attribute Selection.cpp index dcd2a978..e4d7c8fb 100644 --- a/Laptop/IMP Attribute Selection.cpp +++ b/Laptop/IMP Attribute Selection.cpp @@ -36,7 +36,7 @@ //#define MAX_ATTIBUTEPOINT 90 //#define START_ATTRIBEPOINT 55 -//#define MIN_ATTIBUTEPOINT 35 +//#define MIN_ATTIBUTEPOINT 35 //#define MAX_ZERO_BONUS 15 @@ -64,17 +64,17 @@ enum // Snap: these globals will be properly initialized in SetAttributes // the skills as they stand -INT32 iCurrentStrength = 0; -INT32 iCurrentAgility = 0; -INT32 iCurrentDexterity = 0; -INT32 iCurrentHealth = 0; -INT32 iCurrentLeaderShip = 0; -INT32 iCurrentWisdom = 0; +INT32 iCurrentStrength = 0; +INT32 iCurrentAgility = 0; +INT32 iCurrentDexterity = 0; +INT32 iCurrentHealth = 0; +INT32 iCurrentLeaderShip = 0; +INT32 iCurrentWisdom = 0; INT32 iCurrentMarkmanship = 0; -INT32 iCurrentMechanical = 0; -INT32 iCurrentMedical = 0; -INT32 iCurrentExplosives = 0; - +INT32 iCurrentMechanical = 0; +INT32 iCurrentMedical = 0; +INT32 iCurrentExplosives = 0; + // which stat is message about stat at zero about INT32 iCurrentStatAtZero = 0; @@ -125,7 +125,7 @@ void ProcessAttributes( void ); void DestroyIMPAttributeSelectionButtons( void ); void CreateIMPAttributeSelectionButtons( void ); UINT8 IncrementStat( INT32 iStatToIncrement ); -UINT8 DecrementStat( INT32 iStatToDecrement ); +UINT8 DecrementStat( INT32 iStatToDecrement ); BOOLEAN DoWeHaveThisManyBonusPoints( INT32 iBonusPoints ); void CreateAttributeSliderButtons( void ); void DestroyAttributeSliderButtons( void ); @@ -151,45 +151,45 @@ void StatAtZeroBoxCallBack( UINT8 bExitValue ); void EnterIMPAttributeSelection( void ) { - + // set attributes and skills if( ( fReturnStatus == FALSE ) && ( fFirstIMPAttribTime == TRUE ) ) { // re starting - SetAttributes( ); - + SetAttributes( ); + gpCurrentScrollBox = NULL; giCurrentlySelectedStat = -1; - // does character have PROBLEMS!!?!?! + // does character have PROBLEMS!!?!?! /* - if( DoesCharacterHaveAnAttitude() ) + if( DoesCharacterHaveAnAttitude() ) { - iCurrentBonusPoints+= 10; + iCurrentBonusPoints+= 10; } - if( DoesCharacterHaveAPersoanlity( ) ) - { - iCurrentBonusPoints += 10; + if( DoesCharacterHaveAPersoanlity( ) ) + { + iCurrentBonusPoints += 10; } */ } - fReturnStatus = TRUE; + fReturnStatus = TRUE; fFirstIMPAttribTime = FALSE; // create done button - CreateIMPAttributeSelectionButtons( ); + CreateIMPAttributeSelectionButtons( ); // create clider buttons CreateAttributeSliderButtons( ); // the mouse regions CreateSlideRegionMouseRegions( ); - //CreateSliderBarMouseRegions( ); + //CreateSliderBarMouseRegions( ); // render background - RenderIMPAttributeSelection( ); - - + RenderIMPAttributeSelection( ); + + return; } @@ -200,7 +200,7 @@ void RenderIMPAlteredAttribute( void ) } void RenderIMPAttributeSelection( void ) { - // the background + // the background RenderProfileBackGround( ); @@ -209,12 +209,12 @@ void RenderIMPAttributeSelection( void ) // render attribute boxes RenderAttributeBoxes( ); - + RenderAttrib1IndentFrame(51, 30 ); - + if( fReviewStats != TRUE ) { - RenderAttrib2IndentFrame(350, 42 ); + RenderAttrib2IndentFrame(350, 42 ); } // reset rerender flag @@ -222,7 +222,7 @@ void RenderIMPAttributeSelection( void ) // print text for screen PrintImpText( ); - + // amt of bonus pts DrawBonusPointsRemaining( ); @@ -231,15 +231,15 @@ void RenderIMPAttributeSelection( void ) void ExitIMPAttributeSelection( void ) { - // get rid of slider buttons + // get rid of slider buttons DestroyAttributeSliderButtons( ); // the mouse regions DestroySlideRegionMouseRegions( ); - //DestroySlideBarMouseRegions( ); + //DestroySlideBarMouseRegions( ); // get rid of done buttons - DestroyIMPAttributeSelectionButtons( ); + DestroyIMPAttributeSelectionButtons( ); fReturnStatus = FALSE; @@ -251,7 +251,7 @@ void HandleIMPAttributeSelection( void ) { // review mode, do not allow changes - if( fReviewStats ) + if( fReviewStats ) { return; } @@ -266,7 +266,7 @@ void HandleIMPAttributeSelection( void ) } //else if the user is holding down the mouse button to the right of the scroll bars - else if( gusMouseXPos > ( LAPTOP_SCREEN_UL_X + SKILL_SLIDE_START_X + BAR_WIDTH ) ) + else if( gusMouseXPos > ( LAPTOP_SCREEN_UL_X + SKILL_SLIDE_START_X + BAR_WIDTH ) ) { IncrementStat( giCurrentlySelectedStat ); } @@ -279,21 +279,21 @@ void HandleIMPAttributeSelection( void ) // get old stat value - iCurrentAttributeValue = GetCurrentAttributeValue( giCurrentlySelectedStat ); + iCurrentAttributeValue = GetCurrentAttributeValue( giCurrentlySelectedStat ); iNewValue = DetermineNewValue( sNewX ); // chenged, move mouse region if change large enough - if( iCurrentAttributeValue != iNewValue ) + if( iCurrentAttributeValue != iNewValue ) { - // update screen - fHasAnySlidingBarMoved = TRUE; + // update screen + fHasAnySlidingBarMoved = TRUE; } - // change is enough - if ( iNewValue - iCurrentAttributeValue > 0) + // change is enough + if ( iNewValue - iCurrentAttributeValue > 0) { // positive, increment stat - iCounter = iNewValue - iCurrentAttributeValue; + iCounter = iNewValue - iCurrentAttributeValue; for( iCounter; iCounter > 0; iCounter--) { IncrementStat( giCurrentlySelectedStat ); @@ -302,7 +302,7 @@ void HandleIMPAttributeSelection( void ) else { // negative, decrement stat - iCounter = iCurrentAttributeValue - iNewValue; + iCounter = iCurrentAttributeValue - iNewValue; for( iCounter; iCounter > 0; iCounter--) { DecrementStat( giCurrentlySelectedStat ); @@ -321,7 +321,7 @@ void HandleIMPAttributeSelection( void ) // prcoess current state of attributes ProcessAttributes( ); - + // has any bar moved? if( fHasAnySlidingBarMoved ) { @@ -332,20 +332,20 @@ void HandleIMPAttributeSelection( void ) } else { - + RenderAttributeFrameForIndex( 51, 87, uiBarToReRender ); /* // print text for screen PrintImpText( ); - + // amt of bonus pts DrawBonusPointsRemaining( ); RenderAttributeFrame( 51, 87 ); - + // render attribute boxes RenderAttributeBoxes( ); - + PrintImpText( ); InvalidateRegion( LAPTOP_SCREEN_UL_X + 51, LAPTOP_SCREEN_WEB_UL_Y + 87, LAPTOP_SCREEN_UL_X + 51 + 400, LAPTOP_SCREEN_WEB_UL_Y + 87 + 220 ); @@ -391,7 +391,7 @@ void ProcessAttributes( void ) } - // dex + // dex if( iCurrentDexterity <= iMinAttribute ) { iCurrentDexterity = iMinAttribute; @@ -400,7 +400,7 @@ void ProcessAttributes( void ) } - // agility + // agility if( iCurrentAgility <= iMinAttribute ) { iCurrentAgility = iMinAttribute; @@ -409,7 +409,7 @@ void ProcessAttributes( void ) } - // wisdom + // wisdom if( iCurrentWisdom <= iMinAttribute ) { iCurrentWisdom = iMinAttribute; @@ -418,15 +418,15 @@ void ProcessAttributes( void ) } - // Kaiden: Leadership should be zero-able - // LeaderShip - //if( iCurrentLeaderShip <= MIN_ATTIBUTEPOINT ) - //{ - //iCurrentLeaderShip = MIN_ATTIBUTEPOINT; - // disable button too - //} + // Kaiden: Leadership should be zero-able + // LeaderShip + //if( iCurrentLeaderShip <= MIN_ATTIBUTEPOINT ) + //{ + //iCurrentLeaderShip = MIN_ATTIBUTEPOINT; + // disable button too + //} - // health + // health if( iCurrentHealth <= iMinAttribute ) { iCurrentHealth = iMinAttribute; @@ -438,7 +438,7 @@ void ProcessAttributes( void ) // now check for above MAX_ATTIBUTEPOINT - // strength + // strength if( iCurrentStrength >= iMaxAttribute ) { iCurrentStrength = iMaxAttribute; @@ -447,7 +447,7 @@ void ProcessAttributes( void ) } - // dex + // dex if( iCurrentDexterity >= iMaxAttribute ) { iCurrentDexterity = iMaxAttribute; @@ -456,7 +456,7 @@ void ProcessAttributes( void ) } - // agility + // agility if( iCurrentAgility >= iMaxAttribute ) { iCurrentAgility = iMaxAttribute; @@ -465,7 +465,7 @@ void ProcessAttributes( void ) } - // wisdom + // wisdom if( iCurrentWisdom >= iMaxAttribute ) { iCurrentWisdom = iMaxAttribute; @@ -474,7 +474,7 @@ void ProcessAttributes( void ) } - // LeaderShip + // LeaderShip if( iCurrentLeaderShip >= iMaxAttribute ) { iCurrentLeaderShip = iMaxAttribute; @@ -483,7 +483,7 @@ void ProcessAttributes( void ) } - // health + // health if( iCurrentHealth >= iMaxAttribute ) { iCurrentHealth = iMaxAttribute; @@ -491,20 +491,20 @@ void ProcessAttributes( void ) } - return; + return; } UINT8 IncrementStat( INT32 iStatToIncrement ) { - // this function is responsable for incrementing a stat + // this function is responsable for incrementing a stat + - INT32 iMinAttribute = gGameExternalOptions.iMinAttribute; INT32 iMaxAttribute = gGameExternalOptions.iMaxAttribute; INT32 iMaxZeroBonus = gGameExternalOptions.iMaxZeroBonus; // review mode, do not allow changes - if( fReviewStats ) + if( fReviewStats ) { return( SLIDER_ERROR ); } @@ -520,79 +520,79 @@ UINT8 IncrementStat( INT32 iStatToIncrement ) switch( iStatToIncrement ) { case( STRENGTH_ATTRIBUTE ): - if( iCurrentStrength > iMaxAttribute -1 ) + if( iCurrentStrength > iMaxAttribute -1 ) { // too high, leave return( SLIDER_OUT_OF_RANGE ); - } - else + } + else { iCurrentStrength++; - iCurrentBonusPoints--; + iCurrentBonusPoints--; } break; - case( DEXTERITY_ATTRIBUTE ): - if( iCurrentDexterity > iMaxAttribute -1 ) + case( DEXTERITY_ATTRIBUTE ): + if( iCurrentDexterity > iMaxAttribute -1 ) { // too high, leave return( SLIDER_OUT_OF_RANGE ); - } - else + } + else { iCurrentDexterity++; - iCurrentBonusPoints--; + iCurrentBonusPoints--; } break; case( AGILITY_ATTRIBUTE ): - if( iCurrentAgility > iMaxAttribute -1 ) + if( iCurrentAgility > iMaxAttribute -1 ) { // too high, leave return( SLIDER_OUT_OF_RANGE ); - } - else + } + else { iCurrentAgility++; - iCurrentBonusPoints--; + iCurrentBonusPoints--; } break; case( WISDOM_ATTRIBUTE ): - if( iCurrentWisdom > iMaxAttribute -1 ) + if( iCurrentWisdom > iMaxAttribute -1 ) { // too high, leave return( SLIDER_OUT_OF_RANGE ); - } - else + } + else { iCurrentWisdom++; - iCurrentBonusPoints--; + iCurrentBonusPoints--; } break; case( HEALTH_ATTRIBUTE ): - if( iCurrentHealth > iMaxAttribute -1 ) + if( iCurrentHealth > iMaxAttribute -1 ) { // too high, leave return( SLIDER_OUT_OF_RANGE ); - } - else + } + else { iCurrentHealth++; - iCurrentBonusPoints--; + iCurrentBonusPoints--; } break; case( LEADERSHIP_ATTRIBUTE ): - if( iCurrentLeaderShip > iMaxAttribute -1 ) + if( iCurrentLeaderShip > iMaxAttribute -1 ) { // too high, leave return( SLIDER_OUT_OF_RANGE ); } - else + else { if( iCurrentLeaderShip == 0) { if( DoWeHaveThisManyBonusPoints( iMaxZeroBonus ) == TRUE ) { - iCurrentLeaderShip+=iMinAttribute; - iCurrentBonusPoints-=iMaxZeroBonus; + iCurrentLeaderShip+=iMinAttribute; + iCurrentBonusPoints-=iMaxZeroBonus; fSkillAtZeroWarning = FALSE; } else @@ -602,25 +602,25 @@ UINT8 IncrementStat( INT32 iStatToIncrement ) } else { - iCurrentLeaderShip++; - iCurrentBonusPoints--; + iCurrentLeaderShip++; + iCurrentBonusPoints--; } } break; case( MARKSMANSHIP_SKILL ): - if( iCurrentMarkmanship > iMaxAttribute -1 ) + if( iCurrentMarkmanship > iMaxAttribute -1 ) { // too high, leave return( SLIDER_OUT_OF_RANGE ); - } - else + } + else { if( iCurrentMarkmanship == 0) { if( DoWeHaveThisManyBonusPoints( iMaxZeroBonus ) == TRUE ) { - iCurrentMarkmanship+=iMinAttribute; - iCurrentBonusPoints-=iMaxZeroBonus; + iCurrentMarkmanship+=iMinAttribute; + iCurrentBonusPoints-=iMaxZeroBonus; fSkillAtZeroWarning = FALSE; } else @@ -630,25 +630,25 @@ UINT8 IncrementStat( INT32 iStatToIncrement ) } else { - iCurrentMarkmanship++; - iCurrentBonusPoints--; + iCurrentMarkmanship++; + iCurrentBonusPoints--; } } break; case( MECHANICAL_SKILL ): - if( iCurrentMechanical > iMaxAttribute -1 ) + if( iCurrentMechanical > iMaxAttribute -1 ) { // too high, leave return( SLIDER_OUT_OF_RANGE ); - } - else + } + else { if( iCurrentMechanical == 0) { if( DoWeHaveThisManyBonusPoints( iMaxZeroBonus ) == TRUE ) { - iCurrentMechanical+=iMinAttribute; - iCurrentBonusPoints-=iMaxZeroBonus; + iCurrentMechanical+=iMinAttribute; + iCurrentBonusPoints-=iMaxZeroBonus; fSkillAtZeroWarning = FALSE; } else @@ -658,25 +658,25 @@ UINT8 IncrementStat( INT32 iStatToIncrement ) } else { - iCurrentMechanical++; - iCurrentBonusPoints--; + iCurrentMechanical++; + iCurrentBonusPoints--; } } break; case( MEDICAL_SKILL ): - if( iCurrentMedical > iMaxAttribute -1 ) + if( iCurrentMedical > iMaxAttribute -1 ) { // too high, leave return( SLIDER_OUT_OF_RANGE ); - } - else + } + else { if( iCurrentMedical == 0) { if( DoWeHaveThisManyBonusPoints( iMaxZeroBonus ) == TRUE ) { - iCurrentMedical+=iMinAttribute; - iCurrentBonusPoints-=iMaxZeroBonus; + iCurrentMedical+=iMinAttribute; + iCurrentBonusPoints-=iMaxZeroBonus; fSkillAtZeroWarning = FALSE; } else @@ -686,25 +686,25 @@ UINT8 IncrementStat( INT32 iStatToIncrement ) } else { - iCurrentMedical++; - iCurrentBonusPoints--; + iCurrentMedical++; + iCurrentBonusPoints--; } } break; case( EXPLOSIVE_SKILL ): - if( iCurrentExplosives > iMaxAttribute -1 ) + if( iCurrentExplosives > iMaxAttribute -1 ) { // too high, leave return( SLIDER_OUT_OF_RANGE ); - } - else + } + else { if( iCurrentExplosives == 0) { if( DoWeHaveThisManyBonusPoints( iMaxZeroBonus ) == TRUE ) { - iCurrentExplosives+=iMinAttribute; - iCurrentBonusPoints-=iMaxZeroBonus; + iCurrentExplosives+=iMinAttribute; + iCurrentBonusPoints-=iMaxZeroBonus; fSkillAtZeroWarning = FALSE; } else @@ -714,8 +714,8 @@ UINT8 IncrementStat( INT32 iStatToIncrement ) } else { - iCurrentExplosives++; - iCurrentBonusPoints--; + iCurrentExplosives++; + iCurrentBonusPoints--; } } break; @@ -726,7 +726,7 @@ UINT8 IncrementStat( INT32 iStatToIncrement ) } -UINT8 DecrementStat( INT32 iStatToDecrement ) +UINT8 DecrementStat( INT32 iStatToDecrement ) { INT32 iMinAttribute = gGameExternalOptions.iMinAttribute; @@ -734,12 +734,12 @@ UINT8 DecrementStat( INT32 iStatToDecrement ) // review mode, do not allow changes - if( fReviewStats ) + if( fReviewStats ) { return( SLIDER_ERROR ); } - // decrement a stat + // decrement a stat // check to make sure stat isn't maxed out already switch( iStatToDecrement ) { @@ -748,19 +748,19 @@ UINT8 DecrementStat( INT32 iStatToDecrement ) { // ok to decrement iCurrentStrength--; - iCurrentBonusPoints++; + iCurrentBonusPoints++; } else { return( SLIDER_OUT_OF_RANGE ); } break; - case( DEXTERITY_ATTRIBUTE ): + case( DEXTERITY_ATTRIBUTE ): if( iCurrentDexterity > iMinAttribute ) { // ok to decrement iCurrentDexterity--; - iCurrentBonusPoints++; + iCurrentBonusPoints++; } else { @@ -772,19 +772,19 @@ UINT8 DecrementStat( INT32 iStatToDecrement ) { // ok to decrement iCurrentAgility--; - iCurrentBonusPoints++; + iCurrentBonusPoints++; } else { return( SLIDER_OUT_OF_RANGE ); } break; - case( WISDOM_ATTRIBUTE ): + case( WISDOM_ATTRIBUTE ): if( iCurrentWisdom > iMinAttribute ) { // ok to decrement iCurrentWisdom--; - iCurrentBonusPoints++; + iCurrentBonusPoints++; } else { @@ -796,14 +796,14 @@ UINT8 DecrementStat( INT32 iStatToDecrement ) { // ok to decrement iCurrentLeaderShip--; - iCurrentBonusPoints++; + iCurrentBonusPoints++; } //Kaiden: Leadership couldn't be set to zero fixed below: else if( iCurrentLeaderShip == iMinAttribute) { - // ok to decrement + // ok to decrement iCurrentLeaderShip-=iMinAttribute; - iCurrentBonusPoints+=iMaxZeroBonus; + iCurrentBonusPoints+=iMaxZeroBonus; fSkillAtZeroWarning = TRUE; } break; @@ -812,25 +812,25 @@ UINT8 DecrementStat( INT32 iStatToDecrement ) { // ok to decrement iCurrentHealth--; - iCurrentBonusPoints++; + iCurrentBonusPoints++; } else { return( SLIDER_OUT_OF_RANGE ); } break; - case( MARKSMANSHIP_SKILL ): + case( MARKSMANSHIP_SKILL ): if( iCurrentMarkmanship > iMinAttribute ) { // ok to decrement iCurrentMarkmanship--; - iCurrentBonusPoints++; + iCurrentBonusPoints++; } else if( iCurrentMarkmanship == iMinAttribute) { - // ok to decrement + // ok to decrement iCurrentMarkmanship-=iMinAttribute; - iCurrentBonusPoints+=iMaxZeroBonus; + iCurrentBonusPoints+=iMaxZeroBonus; fSkillAtZeroWarning = TRUE; } break; @@ -839,13 +839,13 @@ UINT8 DecrementStat( INT32 iStatToDecrement ) { // ok to decrement iCurrentMedical--; - iCurrentBonusPoints++; + iCurrentBonusPoints++; } else if( iCurrentMedical == iMinAttribute) { - // ok to decrement + // ok to decrement iCurrentMedical-=iMinAttribute; - iCurrentBonusPoints+=iMaxZeroBonus; + iCurrentBonusPoints+=iMaxZeroBonus; fSkillAtZeroWarning = TRUE; } break; @@ -854,13 +854,13 @@ UINT8 DecrementStat( INT32 iStatToDecrement ) { // ok to decrement iCurrentMechanical--; - iCurrentBonusPoints++; + iCurrentBonusPoints++; } else if( iCurrentMechanical == iMinAttribute) { - // ok to decrement + // ok to decrement iCurrentMechanical-=iMinAttribute; - iCurrentBonusPoints+=iMaxZeroBonus; + iCurrentBonusPoints+=iMaxZeroBonus; fSkillAtZeroWarning = TRUE; } break; @@ -869,20 +869,20 @@ UINT8 DecrementStat( INT32 iStatToDecrement ) { // ok to decrement iCurrentExplosives--; - iCurrentBonusPoints++; + iCurrentBonusPoints++; } else if( iCurrentExplosives == iMinAttribute) { - // ok to decrement + // ok to decrement iCurrentExplosives-=iMinAttribute; - iCurrentBonusPoints+=iMaxZeroBonus; + iCurrentBonusPoints+=iMaxZeroBonus; fSkillAtZeroWarning = TRUE; } break; - + } - + if( fSkillAtZeroWarning == TRUE ) { // current stat at zero @@ -914,20 +914,20 @@ void CreateIMPAttributeSelectionButtons( void ) { // the finished button - giIMPAttributeSelectionButtonImage[0]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); -/* giIMPAttributeSelectionButton[0] = QuickCreateButton( giIMPAttributeSelectionButtonImage[0], LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), + giIMPAttributeSelectionButtonImage[0]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); +/* giIMPAttributeSelectionButton[0] = QuickCreateButton( giIMPAttributeSelectionButtonImage[0], LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeFinishCallback ); - */ - giIMPAttributeSelectionButton[0] = CreateIconAndTextButton( giIMPAttributeSelectionButtonImage[0], pImpButtonText[ 11 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeFinishCallback); + */ + giIMPAttributeSelectionButton[0] = CreateIconAndTextButton( giIMPAttributeSelectionButtonImage[0], pImpButtonText[ 11 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeFinishCallback); + + - - SetButtonCursor(giIMPAttributeSelectionButton[0], CURSOR_WWW); return; } @@ -935,10 +935,10 @@ void CreateIMPAttributeSelectionButtons( void ) void DestroyIMPAttributeSelectionButtons( void ) { // this function will destroy the buttons needed for the IMP attrib enter page - - // the begin button - RemoveButton(giIMPAttributeSelectionButton[ 0 ] ); - UnloadButtonImage(giIMPAttributeSelectionButtonImage[ 0 ] ); + + // the begin button + RemoveButton(giIMPAttributeSelectionButton[ 0 ] ); + UnloadButtonImage(giIMPAttributeSelectionButtonImage[ 0 ] ); return; } @@ -954,14 +954,14 @@ void BtnIMPAttributeFinishCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - + btn->uiFlags&=~(BUTTON_CLICKED_ON); + //are we done diting, or just reviewing the stats? if( fReviewStats == TRUE ) { @@ -969,12 +969,12 @@ void BtnIMPAttributeFinishCallback(GUI_BUTTON *btn,INT32 reason) } else { - iCurrentImpPage = IMP_ATTRIBUTE_FINISH; + iCurrentImpPage = IMP_ATTRIBUTE_FINISH; } fButtonPendingFlag = TRUE; } - } -} + } +} @@ -984,13 +984,11 @@ void RenderAttributeBoxes( void ) INT32 iMinAttribute = gGameExternalOptions.iMinAttribute; - // this function will render the boxes in the sliding attribute bar, based on position - INT32 iCnt=STRENGTH_ATTRIBUTE; - INT16 sX = 0; - INT16 sY = 0; - INT16 sTempY = 0; - INT16 sTempX = 0; - CHAR16 sString[3]; + // this function will render the boxes in the sliding attribute bar, based on position + INT32 iCnt=STRENGTH_ATTRIBUTE; + INT16 sX = 0; + INT16 sY = 0; + CHAR16 sString[3]; // set last char to null sString[2] = 0; @@ -1004,19 +1002,19 @@ void RenderAttributeBoxes( void ) // run through and render each slider bar for( iCnt = HEALTH_ATTRIBUTE; iCnt <= MECHANICAL_SKILL; iCnt++) { - // position is ( width * ( stat - 35 ) ) /50] + // position is ( width * ( stat - 35 ) ) /50] // unless 0, then it is 0 - for skills - + // get y position sY = SKILL_SLIDE_START_Y + SKILL_SLIDE_HEIGHT * ( ( INT16 )iCnt ) ; switch( iCnt ) { - case (STRENGTH_ATTRIBUTE): - // blt in strength slider - sX = DetermineNewPosition( iCurrentStrength - iMinAttribute ); + case (STRENGTH_ATTRIBUTE): + // blt in strength slider + sX = DetermineNewPosition( iCurrentStrength - iMinAttribute ); RenderSliderBar( sX, sY ); - + // set sliderbar mouse region MSYS_MoveMouseRegionTo( &pSliderBarRegions[ iCnt ], ( INT16 )(sX + LAPTOP_SCREEN_UL_X ), ( INT16 )( sY + LAPTOP_SCREEN_WEB_UL_Y ) ); @@ -1025,10 +1023,10 @@ void RenderAttributeBoxes( void ) sX += LAPTOP_SCREEN_UL_X; sY += LAPTOP_SCREEN_WEB_UL_Y; mprintf(sX + 13, sY + 3, sString); - break; + break; case (DEXTERITY_ATTRIBUTE): - // blt in strength slider - sX = DetermineNewPosition( iCurrentDexterity - iMinAttribute ); + // blt in strength slider + sX = DetermineNewPosition( iCurrentDexterity - iMinAttribute ); RenderSliderBar( sX, sY ); // set sliderbar mouse region @@ -1036,14 +1034,14 @@ void RenderAttributeBoxes( void ) // the text swprintf( sString, L"%d", iCurrentDexterity ); - sX += LAPTOP_SCREEN_UL_X; + sX += LAPTOP_SCREEN_UL_X; sY += LAPTOP_SCREEN_WEB_UL_Y; mprintf(sX + 13, sY + 3, sString); - break; + break; case (AGILITY_ATTRIBUTE): - // blt in strength slider - sX = DetermineNewPosition( iCurrentAgility - iMinAttribute ); + // blt in strength slider + sX = DetermineNewPosition( iCurrentAgility - iMinAttribute ); RenderSliderBar( sX, sY ); // set sliderbar mouse region @@ -1055,10 +1053,10 @@ void RenderAttributeBoxes( void ) sY += LAPTOP_SCREEN_WEB_UL_Y; mprintf(sX + 13, sY + 3, sString); - break; + break; case (WISDOM_ATTRIBUTE): - // blt in strength slider - sX = DetermineNewPosition( iCurrentWisdom - iMinAttribute ); + // blt in strength slider + sX = DetermineNewPosition( iCurrentWisdom - iMinAttribute ); RenderSliderBar( sX, sY ); // set sliderbar mouse region @@ -1069,53 +1067,53 @@ void RenderAttributeBoxes( void ) sX += LAPTOP_SCREEN_UL_X; sY += LAPTOP_SCREEN_WEB_UL_Y; mprintf(sX + 13, sY + 3, sString); - break; - case (LEADERSHIP_ATTRIBUTE): - // blt in strength slider - sX = DetermineNewPosition( iCurrentLeaderShip - iMinAttribute ); + break; + case (LEADERSHIP_ATTRIBUTE): + // blt in strength slider + sX = DetermineNewPosition( iCurrentLeaderShip - iMinAttribute ); RenderSliderBar( sX, sY ); - // set sliderbar mouse region + // set sliderbar mouse region MSYS_MoveMouseRegionTo( &pSliderBarRegions[ iCnt ], ( INT16 )(sX + LAPTOP_SCREEN_UL_X ), ( INT16 )( sY + LAPTOP_SCREEN_WEB_UL_Y ) ); // the text - swprintf( sString, L"%d", iCurrentLeaderShip ); + swprintf( sString, L"%d", iCurrentLeaderShip ); sX += LAPTOP_SCREEN_UL_X; sY += LAPTOP_SCREEN_WEB_UL_Y; mprintf(sX + 13 , sY + 3, sString); - break; + break; case (HEALTH_ATTRIBUTE): - // blt in health slider - sX = DetermineNewPosition( iCurrentHealth - iMinAttribute ); + // blt in health slider + sX = DetermineNewPosition( iCurrentHealth - iMinAttribute ); RenderSliderBar( sX, sY ); - // set sliderbar mouse region + // set sliderbar mouse region MSYS_MoveMouseRegionTo( &pSliderBarRegions[ iCnt ], ( INT16 )(sX + LAPTOP_SCREEN_UL_X ), ( INT16 )( sY + LAPTOP_SCREEN_WEB_UL_Y ) ); // the text swprintf( sString, L"%d", iCurrentHealth ); - sY += LAPTOP_SCREEN_WEB_UL_Y; + sY += LAPTOP_SCREEN_WEB_UL_Y; sX += LAPTOP_SCREEN_UL_X; mprintf(sX + 13, sY + 3, sString); - break; - case (MARKSMANSHIP_SKILL): - // blt in marksmanship slider - - sX = DetermineNewPosition( iCurrentMarkmanship - iMinAttribute ); + break; + case (MARKSMANSHIP_SKILL): + // blt in marksmanship slider + + sX = DetermineNewPosition( iCurrentMarkmanship - iMinAttribute ); RenderSliderBar( sX, sY ); - // set sliderbar mouse region + // set sliderbar mouse region MSYS_MoveMouseRegionTo( &pSliderBarRegions[ iCnt ], ( INT16 )(sX + LAPTOP_SCREEN_UL_X ), ( INT16 )( sY + LAPTOP_SCREEN_WEB_UL_Y ) ); // the text swprintf( sString, L"%d", iCurrentMarkmanship ); - sY += LAPTOP_SCREEN_WEB_UL_Y; + sY += LAPTOP_SCREEN_WEB_UL_Y; sX += LAPTOP_SCREEN_UL_X; mprintf(sX + 13, sY + 3, sString); - break; - case (MEDICAL_SKILL): - // blt in medical slider - - sX = DetermineNewPosition( iCurrentMedical - iMinAttribute ); + break; + case (MEDICAL_SKILL): + // blt in medical slider + + sX = DetermineNewPosition( iCurrentMedical - iMinAttribute ); RenderSliderBar( sX, sY ); // set sliderbar mouse region @@ -1123,14 +1121,14 @@ void RenderAttributeBoxes( void ) // the text swprintf( sString, L"%d", iCurrentMedical ); - sY += LAPTOP_SCREEN_WEB_UL_Y; + sY += LAPTOP_SCREEN_WEB_UL_Y; sX += LAPTOP_SCREEN_UL_X; mprintf(sX + 13, sY + 3, sString); - break; - case (MECHANICAL_SKILL): - // blt in mech slider - - sX = DetermineNewPosition( iCurrentMechanical - iMinAttribute ); + break; + case (MECHANICAL_SKILL): + // blt in mech slider + + sX = DetermineNewPosition( iCurrentMechanical - iMinAttribute ); RenderSliderBar( sX, sY ); // set sliderbar mouse region @@ -1139,14 +1137,14 @@ void RenderAttributeBoxes( void ) // the text swprintf( sString, L"%d", iCurrentMechanical ); - sY += LAPTOP_SCREEN_WEB_UL_Y; + sY += LAPTOP_SCREEN_WEB_UL_Y; sX += LAPTOP_SCREEN_UL_X; mprintf(sX + 13, sY + 3, sString); - break; + break; case (EXPLOSIVE_SKILL): - // blt in explosive slider - - sX = DetermineNewPosition( iCurrentExplosives - iMinAttribute ); + // blt in explosive slider + + sX = DetermineNewPosition( iCurrentExplosives - iMinAttribute ); RenderSliderBar( sX, sY ); // set sliderbar mouse region @@ -1154,10 +1152,10 @@ void RenderAttributeBoxes( void ) // the text swprintf( sString, L"%d", iCurrentExplosives ); - sY += LAPTOP_SCREEN_WEB_UL_Y; + sY += LAPTOP_SCREEN_WEB_UL_Y; sX += LAPTOP_SCREEN_UL_X; mprintf(sX + 13, sY + 3, sString); - break; + break; } } @@ -1173,24 +1171,24 @@ void RenderAttributeBoxes( void ) void CreateAttributeSliderButtons( void ) { // this function will create the buttons for the attribute slider - // the finished button - INT32 iCounter =0; - - giIMPAttributeSelectionSliderButtonImage[ 0 ]= LoadButtonImage( "LAPTOP\\AttributeArrows.sti" ,-1,0,-1,1,-1 ); - giIMPAttributeSelectionSliderButtonImage[ 1 ]= LoadButtonImage( "LAPTOP\\AttributeArrows.sti" ,-1,3,-1,4,-1 ); + // the finished button + INT32 iCounter =0; + + giIMPAttributeSelectionSliderButtonImage[ 0 ]= LoadButtonImage( "LAPTOP\\AttributeArrows.sti" ,-1,0,-1,1,-1 ); + giIMPAttributeSelectionSliderButtonImage[ 1 ]= LoadButtonImage( "LAPTOP\\AttributeArrows.sti" ,-1,3,-1,4,-1 ); for(iCounter = 0; iCounter < 20; iCounter+=2 ) { - // left button - decrement stat - giIMPAttributeSelectionSliderButton[ iCounter ] = QuickCreateButton( giIMPAttributeSelectionSliderButtonImage[ 0 ], LAPTOP_SCREEN_UL_X + ( 163 ), ( INT16 ) ( LAPTOP_SCREEN_WEB_UL_Y + ( 99 + iCounter / 2 * 20 ) ), + // left button - decrement stat + giIMPAttributeSelectionSliderButton[ iCounter ] = QuickCreateButton( giIMPAttributeSelectionSliderButtonImage[ 0 ], LAPTOP_SCREEN_UL_X + ( 163 ), ( INT16 ) ( LAPTOP_SCREEN_WEB_UL_Y + ( 99 + iCounter / 2 * 20 ) ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeSliderLeftCallback ); - - // right button - increment stat - giIMPAttributeSelectionSliderButton[ iCounter + 1 ] = QuickCreateButton( giIMPAttributeSelectionSliderButtonImage[ 1 ], LAPTOP_SCREEN_UL_X + ( 419 ), ( INT16 ) ( LAPTOP_SCREEN_WEB_UL_Y + ( 99 + iCounter / 2 * 20 ) ), + + // right button - increment stat + giIMPAttributeSelectionSliderButton[ iCounter + 1 ] = QuickCreateButton( giIMPAttributeSelectionSliderButtonImage[ 1 ], LAPTOP_SCREEN_UL_X + ( 419 ), ( INT16 ) ( LAPTOP_SCREEN_WEB_UL_Y + ( 99 + iCounter / 2 * 20 ) ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeSliderRightCallback ); - + SetButtonCursor(giIMPAttributeSelectionSliderButton[iCounter], CURSOR_WWW); SetButtonCursor(giIMPAttributeSelectionSliderButton[iCounter + 1 ], CURSOR_WWW); // set user data @@ -1205,18 +1203,18 @@ void CreateAttributeSliderButtons( void ) void DestroyAttributeSliderButtons( void ) { - // this function will destroy the buttons used for attribute manipulation - INT32 iCounter =0; + // this function will destroy the buttons used for attribute manipulation + INT32 iCounter =0; - // get rid of image + // get rid of image UnloadButtonImage(giIMPAttributeSelectionSliderButtonImage[ 0 ] ); UnloadButtonImage(giIMPAttributeSelectionSliderButtonImage[ 1 ] ); for(iCounter = 0; iCounter < 20; iCounter++ ) { // get rid of button - RemoveButton(giIMPAttributeSelectionSliderButton[ iCounter ] ); - + RemoveButton(giIMPAttributeSelectionSliderButton[ iCounter ] ); + } return; @@ -1230,32 +1228,32 @@ void BtnIMPAttributeSliderLeftCallback(GUI_BUTTON *btn,INT32 reason) // btn callback for IMP personality quiz answer button if (!(btn->uiFlags & BUTTON_ENABLED)) return; - - + + iValue = (INT32)MSYS_GetBtnUserData( btn, 0 ); if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) - { - DecrementStat( iValue ); + { + DecrementStat( iValue ); // stat has changed, rerender - fHasAnySlidingBarMoved = TRUE; - uiBarToReRender = iValue; + fHasAnySlidingBarMoved = TRUE; + uiBarToReRender = iValue; } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - - DecrementStat( iValue ); - fHasAnySlidingBarMoved = TRUE; + + DecrementStat( iValue ); + fHasAnySlidingBarMoved = TRUE; btn->uiFlags|=(BUTTON_CLICKED_ON); - uiBarToReRender = iValue; + uiBarToReRender = iValue; } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - + btn->uiFlags&=~(BUTTON_CLICKED_ON); + } } } @@ -1263,7 +1261,7 @@ void BtnIMPAttributeSliderLeftCallback(GUI_BUTTON *btn,INT32 reason) void BtnIMPAttributeSliderRightCallback(GUI_BUTTON *btn,INT32 reason) { - INT32 iValue = -1; + INT32 iValue = -1; // btn callback for IMP personality quiz answer button if (!(btn->uiFlags & BUTTON_ENABLED)) @@ -1272,28 +1270,28 @@ void BtnIMPAttributeSliderRightCallback(GUI_BUTTON *btn,INT32 reason) iValue = (INT32)MSYS_GetBtnUserData( btn, 0 ); if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) - { - IncrementStat( iValue ); + { + IncrementStat( iValue ); // stat has changed, rerender - fHasAnySlidingBarMoved = TRUE; - uiBarToReRender = iValue; + fHasAnySlidingBarMoved = TRUE; + uiBarToReRender = iValue; } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - - IncrementStat( iValue ); + + IncrementStat( iValue ); fHasAnySlidingBarMoved = TRUE; - uiBarToReRender = iValue; + uiBarToReRender = iValue; btn->uiFlags|=(BUTTON_CLICKED_ON); - + } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - + btn->uiFlags&=~(BUTTON_CLICKED_ON); + } } } @@ -1303,21 +1301,21 @@ void BtnIMPAttributeSliderRightCallback(GUI_BUTTON *btn,INT32 reason) void CreateSlideRegionMouseRegions( void ) { // this function will create that mouse regions on the sliding area, that, if the player clicks on, the bar will automatically jump to - INT32 iCounter = 0; - + INT32 iCounter = 0; + for( iCounter = 0; iCounter < 10; iCounter++ ) { - // define the region - MSYS_DefineRegion( &pSliderRegions[ iCounter ], ( INT16 ) ( SKILL_SLIDE_START_X + LAPTOP_SCREEN_UL_X), ( INT16 ) ( LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + iCounter * SKILL_SLIDE_HEIGHT ) , ( INT16 ) ( LAPTOP_SCREEN_UL_X + SKILL_SLIDE_START_X + BAR_WIDTH ), ( INT16 ) ( LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + iCounter * SKILL_SLIDE_HEIGHT + 15 ), + // define the region + MSYS_DefineRegion( &pSliderRegions[ iCounter ], ( INT16 ) ( SKILL_SLIDE_START_X + LAPTOP_SCREEN_UL_X), ( INT16 ) ( LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + iCounter * SKILL_SLIDE_HEIGHT ) , ( INT16 ) ( LAPTOP_SCREEN_UL_X + SKILL_SLIDE_START_X + BAR_WIDTH ), ( INT16 ) ( LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + iCounter * SKILL_SLIDE_HEIGHT + 15 ), MSYS_PRIORITY_HIGH + 2, CURSOR_WWW, MSYS_NO_CALLBACK, SliderRegionButtonCallback); - - // define user data - MSYS_SetRegionUserData(&pSliderRegions[iCounter],0,iCounter); - // now add it - MSYS_AddRegion(&pSliderRegions[ iCounter ]); + + // define user data + MSYS_SetRegionUserData(&pSliderRegions[iCounter],0,iCounter); + // now add it + MSYS_AddRegion(&pSliderRegions[ iCounter ]); } - return; + return; } void CreateSliderBarMouseRegions( void ) @@ -1326,7 +1324,7 @@ void CreateSliderBarMouseRegions( void ) INT32 iMinAttribute = gGameExternalOptions.iMinAttribute; // this function will create that mouse regions on the sliding bars, that, if the player clicks on, the bar will automatically jump to - INT32 iCounter = 0; + INT32 iCounter = 0; INT16 sX = 0; // set the starting X @@ -1334,29 +1332,29 @@ void CreateSliderBarMouseRegions( void ) for( iCounter = 0; iCounter < 10; iCounter++ ) { - // define the region - MSYS_DefineRegion( &pSliderBarRegions[ iCounter ], ( INT16 ) ( sX ), ( INT16 ) ( LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + iCounter * SKILL_SLIDE_HEIGHT ) , ( INT16 ) (sX + SLIDER_BAR_WIDTH ), ( INT16 ) ( LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + iCounter * SKILL_SLIDE_HEIGHT + 15 ), + // define the region + MSYS_DefineRegion( &pSliderBarRegions[ iCounter ], ( INT16 ) ( sX ), ( INT16 ) ( LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + iCounter * SKILL_SLIDE_HEIGHT ) , ( INT16 ) (sX + SLIDER_BAR_WIDTH ), ( INT16 ) ( LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + iCounter * SKILL_SLIDE_HEIGHT + 15 ), MSYS_PRIORITY_HIGH + 2, CURSOR_WWW, MSYS_NO_CALLBACK, SliderBarRegionButtonCallback); - - // define user data - MSYS_SetRegionUserData(&pSliderBarRegions[iCounter],0,iCounter); - // now add it - MSYS_AddRegion(&pSliderBarRegions[ iCounter ]); + + // define user data + MSYS_SetRegionUserData(&pSliderBarRegions[iCounter],0,iCounter); + // now add it + MSYS_AddRegion(&pSliderBarRegions[ iCounter ]); } - return; + return; } void DestroySlideRegionMouseRegions( void ) { - // this function will destroy the regions user for the slider ' jumping' + // this function will destroy the regions user for the slider ' jumping' INT32 iCounter=0; - + // delete the regions for( iCounter=0; iCounter < 10; iCounter++ ) { - MSYS_RemoveRegion( &pSliderRegions[ iCounter ] ); + MSYS_RemoveRegion( &pSliderRegions[ iCounter ] ); } return; @@ -1365,13 +1363,13 @@ void DestroySlideRegionMouseRegions( void ) void DestroySlideBarMouseRegions( void ) { - // this function will destroy the regions user for the slider ' jumping' + // this function will destroy the regions user for the slider ' jumping' INT32 iCounter=0; - + // delete the regions for( iCounter=0; iCounter < 10; iCounter++ ) { - MSYS_RemoveRegion( &pSliderBarRegions[ iCounter ] ); + MSYS_RemoveRegion( &pSliderBarRegions[ iCounter ] ); } return; @@ -1380,50 +1378,49 @@ void DestroySlideBarMouseRegions( void ) void SliderRegionButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ) { - + INT32 iMinAttribute = gGameExternalOptions.iMinAttribute; INT32 iMaxAttribute = gGameExternalOptions.iMaxAttribute; - INT32 iCurrentAttributeValue = 0; - INT32 iNewAttributeValue = 0; - INT32 iAttributeDelta = 0; - INT32 iCounter =0; - INT16 sX =0; + INT32 iCurrentAttributeValue = 0; + INT32 iNewAttributeValue = 0; + INT32 iAttributeDelta = 0; + INT32 iCounter =0; + INT16 sX =0; INT16 sY = 0; static INT16 sOldX = -1; static INT16 sOldY = -1; static INT32 iAttribute = -1; INT32 iNewValue = 0; - INT32 iCurrentValue = 0; - INT16 sNewX = -1; - + INT16 sNewX = -1; + //if we already have an anchored slider bar if( gpCurrentScrollBox != pRegion && gpCurrentScrollBox != NULL ) return; - if (iReason & MSYS_CALLBACK_REASON_INIT) - { - return; - } + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + return; + } if (iReason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT) - { + { if( fSlideIsActive == FALSE) - { + { // not active leave - return; + return; } - // check to see if we have moved - if( MSYS_GetRegionUserData(pRegion, 0) != iAttribute ) + // check to see if we have moved + if( MSYS_GetRegionUserData(pRegion, 0) != iAttribute ) { // different regions iAttribute = MSYS_GetRegionUserData(pRegion, 0); - sOldX = -1; + sOldX = -1; sOldY = -1; - return; + return; } uiBarToReRender = iAttribute; @@ -1431,34 +1428,34 @@ void SliderRegionButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ) giCurrentlySelectedStat = iAttribute; gpCurrentScrollBox = pRegion; - // get new attribute value x + // get new attribute value x sNewX = pRegion->MouseXPos; - + // sOldX has been reset, set to sNewX if( sOldX == -1) { sOldX = sNewX; - return; + return; } // check against old x if( sNewX != sOldX ) { // get old stat value - iCurrentAttributeValue = GetCurrentAttributeValue( iAttribute ); + iCurrentAttributeValue = GetCurrentAttributeValue( iAttribute ); iNewValue = DetermineNewValue( sNewX ); // chenged, move mouse region if change large enough - if( iCurrentAttributeValue != iNewValue ) + if( iCurrentAttributeValue != iNewValue ) { - // update screen - fHasAnySlidingBarMoved = TRUE; + // update screen + fHasAnySlidingBarMoved = TRUE; } - // change is enough - if ( iNewValue - iCurrentAttributeValue > 0) + // change is enough + if ( iNewValue - iCurrentAttributeValue > 0) { // positive, increment stat - iCounter = iNewValue - iCurrentAttributeValue; + iCounter = iNewValue - iCurrentAttributeValue; for( iCounter; iCounter > 0; iCounter--) { IncrementStat( iAttribute ); @@ -1467,53 +1464,53 @@ void SliderRegionButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ) else { // negative, decrement stat - iCounter = iCurrentAttributeValue - iNewValue; + iCounter = iCurrentAttributeValue - iNewValue; for( iCounter; iCounter > 0; iCounter--) { DecrementStat( iAttribute ); } } - - sOldX = sNewX; + + sOldX = sNewX; } } - else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) - { - + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + if( fSlideIsActive ) { - // reset slide is active flag - fSlideIsActive = FALSE; + // reset slide is active flag + fSlideIsActive = FALSE; return; } - + // get mouse XY - - sX = pRegion -> MouseXPos; - sY = pRegion -> MouseYPos; - // which region are we in? - + sX = pRegion->MouseXPos; + sY = pRegion->MouseYPos; + + // which region are we in? + // get attribute iAttribute = MSYS_GetRegionUserData(pRegion, 0); - uiBarToReRender = iAttribute; + uiBarToReRender = iAttribute; // get value of attribute iCurrentAttributeValue = GetCurrentAttributeValue( iAttribute ); - + // set the new attribute value based on position of mouse click iNewAttributeValue = DetermineNewValue( sX ); // too high, reset to MAX_ATTIBUTEPOINT if( iNewAttributeValue > iMaxAttribute ) - { + { iNewAttributeValue = iMaxAttribute; } - + // get the delta iAttributeDelta = iCurrentAttributeValue - iNewAttributeValue; - + // set Counter iCounter = iAttributeDelta; @@ -1523,49 +1520,49 @@ void SliderRegionButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ) // decrement for( iCounter = 0; iCounter < iAttributeDelta; iCounter++ ) { - DecrementStat( iAttribute ); + DecrementStat( iAttribute ); } } else { // increment attribute - for( iCounter = iAttributeDelta; iCounter < 0; iCounter++ ) + for( iCounter = iAttributeDelta; iCounter < 0; iCounter++ ) { if( iCurrentAttributeValue == 0) { iCounter = 0; } - IncrementStat( iAttribute ); + IncrementStat( iAttribute ); } } // update screen - fHasAnySlidingBarMoved = TRUE; + fHasAnySlidingBarMoved = TRUE; - } - else if ( iReason & MSYS_CALLBACK_REASON_RBUTTON_UP ) - { - + } + else if ( iReason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + { - } + + } else if( iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { // get mouse positions - sX = pRegion -> MouseXPos; - sY = pRegion -> MouseYPos; + sX = pRegion->MouseXPos; + sY = pRegion->MouseYPos; // get attribute iAttribute = MSYS_GetRegionUserData(pRegion, 0); - uiBarToReRender = iAttribute; + uiBarToReRender = iAttribute; // get value of attribute iCurrentAttributeValue = GetCurrentAttributeValue( iAttribute ); - + // get the boxes bounding x sNewX = DetermineNewPosition( iCurrentAttributeValue - iMinAttribute ); - sNewX += LAPTOP_SCREEN_UL_X; + sNewX += LAPTOP_SCREEN_UL_X; // the sNewX is below 0, reset to zero if( sNewX < 0 ) @@ -1576,7 +1573,7 @@ void SliderRegionButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ) if( ( sX > sNewX )&&( sX < sNewX + SLIDER_BAR_WIDTH) ) { // we are within the slide bar, set fact we want to drag and draw - fSlideIsActive = TRUE; + fSlideIsActive = TRUE; } else { @@ -1584,31 +1581,31 @@ void SliderRegionButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ) fSlideIsActive =FALSE; } } - + } void SliderBarRegionButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ) -{ - +{ + if( iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - fSlideIsActive = TRUE; + fSlideIsActive = TRUE; SliderRegionButtonCallback( &pSliderRegions[ MSYS_GetRegionUserData(pRegion, 0) ], MSYS_CALLBACK_REASON_LBUTTON_REPEAT); } if( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { fSlideIsActive = FALSE; } - + } INT32 GetCurrentAttributeValue( INT32 iAttribute ) { // this function will get the value of the attribute that was passed to this fucntion via iAttribute - INT32 iValue =0; + INT32 iValue =0; - switch( iAttribute ) + switch( iAttribute ) { case ( STRENGTH_ATTRIBUTE ): iValue = iCurrentStrength; @@ -1616,10 +1613,10 @@ INT32 GetCurrentAttributeValue( INT32 iAttribute ) case ( DEXTERITY_ATTRIBUTE ): iValue = iCurrentDexterity; break; - case ( AGILITY_ATTRIBUTE ): + case ( AGILITY_ATTRIBUTE ): iValue = iCurrentAgility; break; - case ( HEALTH_ATTRIBUTE ): + case ( HEALTH_ATTRIBUTE ): iValue = iCurrentHealth; break; case ( WISDOM_ATTRIBUTE ): @@ -1641,7 +1638,7 @@ INT32 GetCurrentAttributeValue( INT32 iAttribute ) iValue = iCurrentExplosives; break; - + } return iValue; @@ -1652,10 +1649,10 @@ void SetAttributes( void ) { INT8 bExtraPoints; /* - // set attributes and skills based on what is in charprofile.c - + // set attributes and skills based on what is in charprofile.c + // attributes - iCurrentStrength = iStrength + iAddStrength; + iCurrentStrength = iStrength + iAddStrength; iCurrentDexterity = iDexterity + iAddDexterity; iCurrentHealth = iHealth + iAddHealth; iCurrentLeaderShip = iLeadership + iAddLeadership; @@ -1663,13 +1660,13 @@ void SetAttributes( void ) iCurrentAgility = iAgility + iAddAgility; // skills - iCurrentMarkmanship = iMarksmanship + iAddMarksmanship; + iCurrentMarkmanship = iMarksmanship + iAddMarksmanship; iCurrentMechanical = iMechanical + iAddMechanical; iCurrentMedical = iMedical + iAddMedical; iCurrentExplosives = iExplosives + iAddExplosives; - + // reset bonus pts - iCurrentBonusPoints = 40; + iCurrentBonusPoints = 40; */ iCurrentStrength = gGameExternalOptions.iStartAttribute; @@ -1691,14 +1688,14 @@ void SetAttributes( void ) iCurrentBonusPoints = gGameExternalOptions.iImpAttributePoints; - //Determine if the player has any extra points + //Determine if the player has any extra points bExtraPoints = DoesPlayerHaveExtraAttibutePointsToDistributeBasedOnSkillSelection(); if( bExtraPoints > 0 ) { iCurrentBonusPoints += bExtraPoints; } - + ResetIncrementCharacterAttributes( ); @@ -1708,21 +1705,21 @@ void SetAttributes( void ) void DrawBonusPointsRemaining( void ) { - // draws the amount of points remaining player has + // draws the amount of points remaining player has CHAR16 sString[64]; // just reviewing, don't blit stats if( fReviewStats == TRUE ) { - return; + return; } // parse amountof bns pts remaining swprintf(sString, L"%d", iCurrentBonusPoints); // set font color SetFontForeground( FONT_WHITE ); - SetFontBackground( FONT_BLACK ); - SetFont( FONT12ARIAL ); + SetFontBackground( FONT_BLACK ); + SetFont( FONT12ARIAL ); // print string mprintf( LAPTOP_SCREEN_UL_X + 425 ,LAPTOP_SCREEN_WEB_UL_Y + 51, sString ); @@ -1733,8 +1730,8 @@ void DrawBonusPointsRemaining( void ) void SetGeneratedCharacterAttributes( void ) { - // copies over the attributes of the player generated character - iStrength = iCurrentStrength ; + // copies over the attributes of the player generated character + iStrength = iCurrentStrength ; iDexterity = iCurrentDexterity; iHealth = iCurrentHealth; iLeadership = iCurrentLeaderShip; @@ -1742,11 +1739,11 @@ void SetGeneratedCharacterAttributes( void ) iAgility = iCurrentAgility; // skills - iMarksmanship = iCurrentMarkmanship; + iMarksmanship = iCurrentMarkmanship; iMechanical = iCurrentMechanical; iMedical = iCurrentMedical; iExplosives = iCurrentExplosives; - + return; } @@ -1755,7 +1752,7 @@ void SetGeneratedCharacterAttributes( void ) void StatAtZeroBoxCallBack( UINT8 bExitValue ) { // yes, so start over, else stay here and do nothing for now - if( bExitValue == MSG_BOX_RETURN_YES ) + if( bExitValue == MSG_BOX_RETURN_YES ) { MarkButtonsDirty(); } @@ -1779,7 +1776,7 @@ INT32 DetermineNewValue( INT32 iNewX ) INT32 iStartLoc = SKILL_SLIDE_START_X + LAPTOP_SCREEN_UL_X; INT32 iPositionX = iNewX - iStartLoc; FLOAT fPercentOfBar=0.0f; - + fPercentOfBar = iPositionX / ( FLOAT)( BAR_WIDTH - SLIDER_BAR_WIDTH ); @@ -1789,7 +1786,7 @@ INT32 DetermineNewValue( INT32 iNewX ) // too high, reset to MAX_ATTIBUTEPOINT if( iNewValue > iMaxAttribute ) - { + { iNewValue = iMaxAttribute; } @@ -1805,9 +1802,8 @@ INT32 DetermineNewPosition( INT32 iAttribute ) INT32 iNewLoc=0; INT32 iStartLoc = SKILL_SLIDE_START_X; - FLOAT fPercentOfBar=0.0f; FLOAT fBasePixelScaleWidth = ( ( BAR_WIDTH - SLIDER_BAR_WIDTH ) / (FLOAT)( iMaxAttribute - iMinAttribute ) ); - + iNewLoc = (INT32)(iAttribute * fBasePixelScaleWidth); if( iNewLoc < 0 ) diff --git a/Laptop/IMP Begin Screen.cpp b/Laptop/IMP Begin Screen.cpp index da63265d..556c584f 100644 --- a/Laptop/IMP Begin Screen.cpp +++ b/Laptop/IMP Begin Screen.cpp @@ -38,7 +38,7 @@ #define MALE_BOX_Y 254 + LAPTOP_SCREEN_WEB_UL_Y #define MALE_BOX_WIDTH 24 - 2 #define MALE_BOX_HEIGHT 24 - 2 -#define FEMALE_BOX_X 2 + 302 + LAPTOP_SCREEN_UL_X +#define FEMALE_BOX_X 2 + 302 + LAPTOP_SCREEN_UL_X #define MAX_FULL_NAME 29 #define MAX_NICK_NAME 8 #define FULL_NAME_REGION_WIDTH 230 @@ -52,8 +52,8 @@ enum{ // TextEnterMode .. whether user is entering full name or nick name, or gender selection enum{ - FULL_NAME_MODE, - NICK_NAME_MODE, + FULL_NAME_MODE, + NICK_NAME_MODE, MALE_GENDER_SELECT, FEMALE_GENDER_SELECT, }; @@ -115,7 +115,7 @@ BOOLEAN CheckCharacterInputForEgg( void ); // mouse region callbacks void SelectFullNameRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); -void SelectNickNameRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +void SelectNickNameRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); void SelectMaleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); void SelectFemaleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); void MvtOnMaleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); @@ -128,48 +128,48 @@ void EnterIMPBeginScreen( void ) { // reset all variables - + memset( pFullNameString, 0, sizeof( pFullNameString ) ); - memset( pNickNameString, 0, sizeof( pNickNameString ) ); - + memset( pNickNameString, 0, sizeof( pNickNameString ) ); + // if we are not restarting...then copy over name, set cursor and array positions if( iCurrentProfileMode != IMP__REGISTRY ) { - wcscpy( pFullNameString, pFullName ); - wcscpy( pNickNameString, pNickName ); + wcscpy( pFullNameString, pFullName ); + wcscpy( pNickNameString, pNickName ); uiFullNameCharacterPosition = wcslen( pFullNameString ); - uiNickNameCharacterPosition = wcslen( pNickNameString ); - uiFullNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pFullNameString, FONT14ARIAL ); - uiNickNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pNickNameString, FONT14ARIAL ); - + uiNickNameCharacterPosition = wcslen( pNickNameString ); + uiFullNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pFullNameString, FONT14ARIAL ); + uiNickNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pNickNameString, FONT14ARIAL ); + // set gender too bGenderFlag = fCharacterIsMale; - + } - else + else { uiNickNameCursorPosition =196 + LAPTOP_SCREEN_UL_X; - uiFullNameCursorPosition =196 + LAPTOP_SCREEN_UL_X; + uiFullNameCursorPosition =196 + LAPTOP_SCREEN_UL_X; uiFullNameCharacterPosition = 0; uiNickNameCharacterPosition = 0; bGenderFlag = -1; } - - + + ubTextEnterMode =0; // draw name if any fNewCharInString = TRUE; - - - // render the screen on entry - RenderIMPBeginScreen( ); - if( fFinishedCharGeneration ) + + // render the screen on entry + RenderIMPBeginScreen( ); + + if( fFinishedCharGeneration ) { - ubTextEnterMode = 5; + ubTextEnterMode = 5; } else { @@ -182,36 +182,36 @@ void EnterIMPBeginScreen( void ) // create buttons needed for begin screen CreateIMPBeginScreenButtons( ); - return; + return; } void RenderIMPBeginScreen( void ) { - // the background + // the background RenderProfileBackGround( ); - // fourth button image 3X - RenderButton4Image( 64, 118 ); + // fourth button image 3X + RenderButton4Image( 64, 118 ); RenderButton4Image( 64, 178 ); RenderButton4Image( 64, 238 ); // the begin screen indents - RenderBeginIndent( 105, 58); + RenderBeginIndent( 105, 58); // full name indent RenderNameIndent( 194, 132); // nick name - RenderNickNameIndent( 194, 192); + RenderNickNameIndent( 194, 192); // gender indents RenderGenderIndent( 192, 252 ); RenderGenderIndent( 302, 252 ); - + // render warning string Print8CharacterOnlyString( ); - + // display player name @@ -219,24 +219,24 @@ void RenderIMPBeginScreen( void ) DisplayPlayerNickNameString( ); RenderMaleGenderIcon( ); RenderFemaleGenderIcon( ); - + // the gender itself RenderGender( ); - + return; } void ExitIMPBeginScreen( void ) { - - // remove buttons - RemoveIMPBeginScreenButtons( ); - // remove mouse regions + // remove buttons + RemoveIMPBeginScreenButtons( ); + + // remove mouse regions DestroyIMPBeginScreenMouseRegions( ); wcscpy( pFullName, pFullNameString ); - + // is nick name too long?..shorten if( wcslen( pNickNameString ) > 8 ) { @@ -246,7 +246,7 @@ void ExitIMPBeginScreen( void ) wcscpy( pNickName, pNickNameString ); - + // set gender fCharacterIsMale = bGenderFlag; @@ -260,59 +260,59 @@ void HandleIMPBeginScreen( void ) GetPlayerKeyBoardInputForIMPBeginScreen( ); // has a new char been added to activation string - + // render the cursor switch( ubTextEnterMode ) { case( FULL_NAME_MODE ): - DisplayFullNameStringCursor( ); + DisplayFullNameStringCursor( ); break; case( NICK_NAME_MODE ): - DisplayNickNameStringCursor( ); + DisplayNickNameStringCursor( ); break; case( MALE_GENDER_SELECT ): - DisplayMaleGlowCursor( ); + DisplayMaleGlowCursor( ); break; case( FEMALE_GENDER_SELECT ): - DisplayFemaleGlowCursor( ); + DisplayFemaleGlowCursor( ); break; } - + if( fNewCharInString ) - { - // display strings - DisplayPlayerFullNameString( ); - DisplayPlayerNickNameString( ); + { + // display strings + DisplayPlayerFullNameString( ); + DisplayPlayerNickNameString( ); RenderMaleGenderIcon( ); RenderFemaleGenderIcon( ); - + // the gender itself - RenderGender( ); + RenderGender( ); } - return; + return; } void CreateIMPBeginScreenButtons( void ) { - // this procedure will create the buttons needed for the IMP BeginScreen + // this procedure will create the buttons needed for the IMP BeginScreen // ths done button - giIMPBeginScreenButtonImage[0]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); -/* giIMPBeginScreenButton[0] = QuickCreateButton( giIMPBeginScreenButtonImage[0], LAPTOP_SCREEN_UL_X + ( 134 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), + giIMPBeginScreenButtonImage[0]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); +/* giIMPBeginScreenButton[0] = QuickCreateButton( giIMPBeginScreenButtonImage[0], LAPTOP_SCREEN_UL_X + ( 134 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPBeginScreenDoneCallback); - */ + */ - giIMPBeginScreenButton[0] = CreateIconAndTextButton( giIMPBeginScreenButtonImage[ 0 ], pImpButtonText[ 6 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( 134 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPBeginScreenDoneCallback); + giIMPBeginScreenButton[0] = CreateIconAndTextButton( giIMPBeginScreenButtonImage[ 0 ], pImpButtonText[ 6 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 134 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPBeginScreenDoneCallback); SetButtonCursor(giIMPBeginScreenButton[0], CURSOR_WWW); return; @@ -323,12 +323,12 @@ void CreateIMPBeginScreenButtons( void ) void RemoveIMPBeginScreenButtons( void ) { - // this procedure will destroy the already created buttosn for the IMP BeginScreen + // this procedure will destroy the already created buttosn for the IMP BeginScreen + + // the done button + RemoveButton(giIMPBeginScreenButton[0] ); + UnloadButtonImage(giIMPBeginScreenButtonImage[0] ); - // the done button - RemoveButton(giIMPBeginScreenButton[0] ); - UnloadButtonImage(giIMPBeginScreenButtonImage[0] ); - return; } @@ -348,13 +348,13 @@ void BtnIMPBeginScreenDoneCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); if( fFinishedCharGeneration ) { @@ -366,7 +366,7 @@ void BtnIMPBeginScreenDoneCallback(GUI_BUTTON *btn,INT32 reason) /* else { - if( CheckCharacterInputForEgg( ) ) + if( CheckCharacterInputForEgg( ) ) { fEggOnYouFace = TRUE; } @@ -420,7 +420,7 @@ void BtnIMPBeginScreenDoneCallback(GUI_BUTTON *btn,INT32 reason) // ok, now set back to main page, and set the fact we have completed part 1 if ( ( iCurrentProfileMode < IMP__PERSONALITY ) &&( bGenderFlag != -1 ) ) { - iCurrentProfileMode = IMP__PORTRAIT;//IMP__PERSONALITY; + iCurrentProfileMode = IMP__PORTRAIT;//IMP__PERSONALITY; } else if( bGenderFlag == -1 ) { @@ -434,8 +434,8 @@ void BtnIMPBeginScreenDoneCallback(GUI_BUTTON *btn,INT32 reason) } } } - } -} + } +} @@ -446,63 +446,63 @@ void BtnIMPBeginScreenDoneCallback(GUI_BUTTON *btn,INT32 reason) void GetPlayerKeyBoardInputForIMPBeginScreen( void ) { InputAtom InputEvent; - POINT MousePos; + POINT MousePos; // get the current curosr position, might just need it. - GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! + GetCursorPos(&MousePos); + ScreenToClient(ghWindow, &MousePos); // In window coords! // handle input events - while( DequeueEvent(&InputEvent) ) - { - /* + while( DequeueEvent(&InputEvent) ) + { + /* // HOOK INTO MOUSE HOOKS - switch(InputEvent.usEvent) + switch(InputEvent.usEvent) { - - case LEFT_BUTTON_DOWN: - MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); - break; - case LEFT_BUTTON_UP: - MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); - break; - case RIGHT_BUTTON_DOWN: - MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); - break; - case RIGHT_BUTTON_UP: - MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); - break; + + case LEFT_BUTTON_DOWN: + MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case LEFT_BUTTON_UP: + MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); + break; + case RIGHT_BUTTON_DOWN: + MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case RIGHT_BUTTON_UP: + MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; } */ - if( !HandleTextInput( &InputEvent ) && (InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT) ) + if( !HandleTextInput( &InputEvent ) && (InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT) ) { - switch( InputEvent.usParam ) + switch( InputEvent.usParam ) { case (( ENTER )): - // check to see if gender was highlighted..if so, select it - if( FEMALE_GENDER_SELECT == ubTextEnterMode ) + // check to see if gender was highlighted..if so, select it + if( FEMALE_GENDER_SELECT == ubTextEnterMode ) { - bGenderFlag = IMP_FEMALE; + bGenderFlag = IMP_FEMALE; + } + else if( MALE_GENDER_SELECT == ubTextEnterMode ) + { + bGenderFlag = IMP_MALE; } - else if( MALE_GENDER_SELECT == ubTextEnterMode ) - { - bGenderFlag = IMP_MALE; - } - // increment to next selection box - IncrementTextEnterMode( ); - fNewCharInString = TRUE; + // increment to next selection box + IncrementTextEnterMode( ); + fNewCharInString = TRUE; break; case( SPACE ): // handle space bar - if( FEMALE_GENDER_SELECT == ubTextEnterMode ) + if( FEMALE_GENDER_SELECT == ubTextEnterMode ) { - bGenderFlag = IMP_FEMALE; + bGenderFlag = IMP_FEMALE; DecrementTextEnterMode( ); } - else if( MALE_GENDER_SELECT == ubTextEnterMode ) + else if( MALE_GENDER_SELECT == ubTextEnterMode ) { - bGenderFlag = IMP_MALE; + bGenderFlag = IMP_MALE; IncrementTextEnterMode( ); } else @@ -511,16 +511,16 @@ void GetPlayerKeyBoardInputForIMPBeginScreen( void ) } fNewCharInString = TRUE; break; - case (( ESC )): - LeaveLapTopScreen( ); + case (( ESC )): + LeaveLapTopScreen( ); break; case (( TAB )): - // tab hit, increment to next selection box - IncrementTextEnterMode( ); - fNewCharInString = TRUE; - break; + // tab hit, increment to next selection box + IncrementTextEnterMode( ); + fNewCharInString = TRUE; + break; case ( 265 ): - // tab and shift + // tab and shift DecrementTextEnterMode( ); fNewCharInString = TRUE; break; @@ -529,155 +529,155 @@ void GetPlayerKeyBoardInputForIMPBeginScreen( void ) break; } } - } + } return; } void HandleBeginScreenTextEvent( UINT32 uiKey ) { - // this function checks to see if a letter or a backspace was pressed, if so, either put char to screen - // or delete it + // this function checks to see if a letter or a backspace was pressed, if so, either put char to screen + // or delete it - switch( uiKey ) + switch( uiKey ) { - case ( BACKSPACE ): - + case ( BACKSPACE ): + switch( ubTextEnterMode ) { case( FULL_NAME_MODE ): - if( uiFullNameCharacterPosition >= 0 ) + if( uiFullNameCharacterPosition >= 0 ) { - - + + // decrement StringPosition - if( uiFullNameCharacterPosition > 0) + if( uiFullNameCharacterPosition > 0) { - uiFullNameCharacterPosition-=1; - } - + uiFullNameCharacterPosition-=1; + } - - // null out char - pFullNameString[uiFullNameCharacterPosition] = 0; - - // move cursor back by sizeof char + + + // null out char + pFullNameString[uiFullNameCharacterPosition] = 0; + + // move cursor back by sizeof char uiFullNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pFullNameString, FONT14ARIAL ); - // string has been altered, redisplay - fNewCharInString = TRUE; + // string has been altered, redisplay + fNewCharInString = TRUE; } break; - case ( NICK_NAME_MODE ): - if( uiNickNameCharacterPosition >= 0 ) + case ( NICK_NAME_MODE ): + if( uiNickNameCharacterPosition >= 0 ) { - - // decrement StringPosition + + // decrement StringPosition if( uiNickNameCharacterPosition > 0 ) - uiNickNameCharacterPosition-=1; - - // null out char - pNickNameString[uiNickNameCharacterPosition] = 0; - - // move cursor back by sizeof char + uiNickNameCharacterPosition-=1; + + // null out char + pNickNameString[uiNickNameCharacterPosition] = 0; + + // move cursor back by sizeof char uiNickNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pNickNameString, FONT14ARIAL ); - - // string has been altered, redisplay - fNewCharInString = TRUE; + + // string has been altered, redisplay + fNewCharInString = TRUE; } - - break; + + break; } break; - default: - if( uiKey >= 'A' && uiKey <= 'Z' || + default: + if( uiKey >= 'A' && uiKey <= 'Z' || uiKey >= 'a' && uiKey <= 'z' || uiKey >= '0' && uiKey <= '9' || uiKey == '_' || uiKey == '.' || uiKey == ' ' ) - { - // if the current string position is at max or great, do nothing - switch( ubTextEnterMode ) + { + // if the current string position is at max or great, do nothing + switch( ubTextEnterMode ) { case( FULL_NAME_MODE ): - if( uiFullNameCharacterPosition >= MAX_FULL_NAME ) - { - break; - } - else - { + if( uiFullNameCharacterPosition >= MAX_FULL_NAME ) + { + break; + } + else + { - if(uiFullNameCharacterPosition < 1 ) - { - uiFullNameCharacterPosition = 0; - } - // make sure we haven't moved too far - if( ( uiFullNameCursorPosition + StringPixLength( ( CHAR16 *)&(uiKey ), FONT14ARIAL ) ) > (UINT32)FULL_NAME_REGION_WIDTH + 196 + LAPTOP_SCREEN_UL_X) - { - // do nothing for now, when pop up is in place, display - break; - } - // valid char, capture and convert to CHAR16 - pFullNameString[uiFullNameCharacterPosition] = ( CHAR16 )uiKey; - + if(uiFullNameCharacterPosition < 1 ) + { + uiFullNameCharacterPosition = 0; + } + // make sure we haven't moved too far + if( ( uiFullNameCursorPosition + StringPixLength( ( CHAR16 *)&(uiKey ), FONT14ARIAL ) ) > (UINT32)FULL_NAME_REGION_WIDTH + 196 + LAPTOP_SCREEN_UL_X) + { + // do nothing for now, when pop up is in place, display + break; + } + // valid char, capture and convert to CHAR16 + pFullNameString[uiFullNameCharacterPosition] = ( CHAR16 )uiKey; - // null out next char position - pFullNameString[uiFullNameCharacterPosition + 1] = 0; - - // move cursor position ahead - uiFullNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pFullNameString, FONT14ARIAL ); - - // increment string position - uiFullNameCharacterPosition +=1; - - // string has been altered, redisplay - fNewCharInString = TRUE; - } - break; - case ( NICK_NAME_MODE ): - if( uiNickNameCharacterPosition >= MAX_NICK_NAME ) - { - break; - } - else - { - if(uiNickNameCharacterPosition == -1) - { - uiNickNameCharacterPosition = 0; - } + // null out next char position + pFullNameString[uiFullNameCharacterPosition + 1] = 0; - // make sure we haven't moved too far - if( ( uiNickNameCursorPosition + StringPixLength( (CHAR16 *)&(uiKey ), FONT14ARIAL ) ) > (UINT32)NICK_NAME_REGION_WIDTH + 196 + LAPTOP_SCREEN_UL_X ) - { - // do nothing for now, when pop up is in place, display - break; - } + // move cursor position ahead + uiFullNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pFullNameString, FONT14ARIAL ); - // valid char, capture and convert to CHAR16 - pNickNameString[uiNickNameCharacterPosition] = ( CHAR16 )uiKey; - - // null out next char position - pNickNameString[uiNickNameCharacterPosition + 1] = 0; - - // move cursor position ahead - uiNickNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pNickNameString, FONT14ARIAL ); - - // increment string position - uiNickNameCharacterPosition +=1; - - // string has been altered, redisplay - fNewCharInString = TRUE; - } - - break; + // increment string position + uiFullNameCharacterPosition +=1; + + // string has been altered, redisplay + fNewCharInString = TRUE; + } + break; + case ( NICK_NAME_MODE ): + if( uiNickNameCharacterPosition >= MAX_NICK_NAME ) + { + break; + } + else + { + + if(uiNickNameCharacterPosition == -1) + { + uiNickNameCharacterPosition = 0; + } + + // make sure we haven't moved too far + if( ( uiNickNameCursorPosition + StringPixLength( (CHAR16 *)&(uiKey ), FONT14ARIAL ) ) > (UINT32)NICK_NAME_REGION_WIDTH + 196 + LAPTOP_SCREEN_UL_X ) + { + // do nothing for now, when pop up is in place, display + break; + } + + // valid char, capture and convert to CHAR16 + pNickNameString[uiNickNameCharacterPosition] = ( CHAR16 )uiKey; + + // null out next char position + pNickNameString[uiNickNameCharacterPosition + 1] = 0; + + // move cursor position ahead + uiNickNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pNickNameString, FONT14ARIAL ); + + // increment string position + uiNickNameCharacterPosition +=1; + + // string has been altered, redisplay + fNewCharInString = TRUE; + } + + break; } } - break; - } + break; + } return; } @@ -686,27 +686,27 @@ void HandleBeginScreenTextEvent( UINT32 uiKey ) void DisplayFullNameStringCursor( void ) { // this procdure will draw the activation string cursor on the screen at position cursorx cursory - UINT32 uiDestPitchBYTES; + UINT32 uiDestPitchBYTES; static UINT32 uiBaseTime = 0; UINT32 uiDeltaTime = 0; - static UINT32 iCurrentState = 0; - UINT8 *pDestBuf; - static BOOLEAN fIncrement = TRUE; + static UINT32 iCurrentState = 0; + UINT8 *pDestBuf; + static BOOLEAN fIncrement = TRUE; if(uiBaseTime == 0) { uiBaseTime = GetJA2Clock(); } - + // get difference uiDeltaTime = GetJA2Clock() - uiBaseTime; // if difference is long enough, rotate colors if(uiDeltaTime > MIN_GLOW_DELTA) - { + { if( iCurrentState == 10) { - // start rotating downward + // start rotating downward fIncrement = FALSE; } if( iCurrentState == 0) @@ -715,7 +715,7 @@ void DisplayFullNameStringCursor( void ) fIncrement = TRUE; } // if increment upward, increment iCurrentState - if(fIncrement) + if(fIncrement) { iCurrentState++; } @@ -724,20 +724,20 @@ void DisplayFullNameStringCursor( void ) // else downwards iCurrentState--; } - // reset basetime to current clock + // reset basetime to current clock uiBaseTime = GetJA2Clock( ); } - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); - // draw line in current state - LineDraw(TRUE, (UINT16) uiFullNameCursorPosition, FULL_NAME_CURSOR_Y - 3, (UINT16)uiFullNameCursorPosition, FULL_NAME_CURSOR_Y + CURSOR_HEIGHT - 2, Get16BPPColor( FROMRGB( GlowColorsList[ iCurrentState ][ 0 ], GlowColorsList[ iCurrentState ][ 1 ], GlowColorsList[ iCurrentState ][ 2 ] ) ), - pDestBuf); - - InvalidateRegion((UINT16) uiFullNameCursorPosition, FULL_NAME_CURSOR_Y - 3 , (UINT16)uiFullNameCursorPosition + 1, FULL_NAME_CURSOR_Y + CURSOR_HEIGHT + 1 - 2); - + // draw line in current state + LineDraw(TRUE, (UINT16) uiFullNameCursorPosition, FULL_NAME_CURSOR_Y - 3, (UINT16)uiFullNameCursorPosition, FULL_NAME_CURSOR_Y + CURSOR_HEIGHT - 2, Get16BPPColor( FROMRGB( GlowColorsList[ iCurrentState ][ 0 ], GlowColorsList[ iCurrentState ][ 1 ], GlowColorsList[ iCurrentState ][ 2 ] ) ), + pDestBuf); + + InvalidateRegion((UINT16) uiFullNameCursorPosition, FULL_NAME_CURSOR_Y - 3 , (UINT16)uiFullNameCursorPosition + 1, FULL_NAME_CURSOR_Y + CURSOR_HEIGHT + 1 - 2); + // unlock frame buffer UnLockVideoSurface( FRAME_BUFFER ); return; @@ -747,27 +747,27 @@ void DisplayFullNameStringCursor( void ) void DisplayNickNameStringCursor( void ) { // this procdure will draw the activation string cursor on the screen at position cursorx cursory - UINT32 uiDestPitchBYTES; + UINT32 uiDestPitchBYTES; static UINT32 uiBaseTime = 0; UINT32 uiDeltaTime = 0; UINT8 *pDestBuf; - static UINT32 iCurrentState = 0; - static BOOLEAN fIncrement = TRUE; + static UINT32 iCurrentState = 0; + static BOOLEAN fIncrement = TRUE; if(uiBaseTime == 0) { uiBaseTime = GetJA2Clock(); } - + // get difference uiDeltaTime = GetJA2Clock() - uiBaseTime; // if difference is long enough, rotate colors if(uiDeltaTime > MIN_GLOW_DELTA) - { + { if( iCurrentState == 10) { - // start rotating downward + // start rotating downward fIncrement = FALSE; } if( iCurrentState == 0) @@ -776,7 +776,7 @@ void DisplayNickNameStringCursor( void ) fIncrement = TRUE; } // if increment upward, increment iCurrentState - if(fIncrement) + if(fIncrement) { iCurrentState++; } @@ -785,20 +785,20 @@ void DisplayNickNameStringCursor( void ) // else downwards iCurrentState--; } - // reset basetime to current clock + // reset basetime to current clock uiBaseTime = GetJA2Clock( ); } - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); - // draw line in current state - LineDraw(TRUE, (UINT16) uiNickNameCursorPosition, NICK_NAME_CURSOR_Y, (UINT16)uiNickNameCursorPosition, NICK_NAME_CURSOR_Y + CURSOR_HEIGHT, Get16BPPColor( FROMRGB( GlowColorsList[ iCurrentState ][ 0 ], GlowColorsList[ iCurrentState ][ 1 ], GlowColorsList[ iCurrentState ][ 2 ] ) ), - pDestBuf ); - - InvalidateRegion((UINT16) uiNickNameCursorPosition, NICK_NAME_CURSOR_Y, (UINT16)uiNickNameCursorPosition + 1, NICK_NAME_CURSOR_Y + CURSOR_HEIGHT + 1); - + // draw line in current state + LineDraw(TRUE, (UINT16) uiNickNameCursorPosition, NICK_NAME_CURSOR_Y, (UINT16)uiNickNameCursorPosition, NICK_NAME_CURSOR_Y + CURSOR_HEIGHT, Get16BPPColor( FROMRGB( GlowColorsList[ iCurrentState ][ 0 ], GlowColorsList[ iCurrentState ][ 1 ], GlowColorsList[ iCurrentState ][ 2 ] ) ), + pDestBuf ); + + InvalidateRegion((UINT16) uiNickNameCursorPosition, NICK_NAME_CURSOR_Y, (UINT16)uiNickNameCursorPosition + 1, NICK_NAME_CURSOR_Y + CURSOR_HEIGHT + 1); + // unlock frame buffer UnLockVideoSurface( FRAME_BUFFER ); return; @@ -809,7 +809,6 @@ void DisplayPlayerFullNameString( void ) { // this function will grab the string that the player will enter for activation - INT32 iCounter=0; // player gone too far, move back if(uiFullNameCharacterPosition > MAX_FULL_NAME) @@ -820,19 +819,19 @@ void DisplayPlayerFullNameString( void ) // restore background RenderNameIndent( 194, 132); - // setup the font stuff + // setup the font stuff SetFont( FONT14ARIAL ); - SetFontForeground( 184 ); + SetFontForeground( 184 ); SetFontBackground(FONT_BLACK); - // reset shadow - SetFontShadow(DEFAULT_SHADOW); - mprintf(LAPTOP_SCREEN_UL_X + 196, FULL_NAME_CURSOR_Y + 1, pFullNameString); - - + // reset shadow + SetFontShadow(DEFAULT_SHADOW); + mprintf(LAPTOP_SCREEN_UL_X + 196, FULL_NAME_CURSOR_Y + 1, pFullNameString); + + fNewCharInString = FALSE; - fReDrawScreenFlag = TRUE; + fReDrawScreenFlag = TRUE; return; } @@ -841,7 +840,6 @@ void DisplayPlayerNickNameString( void ) { // this function will grab the string that the player will enter for activation - INT32 iCounter=0; // player gone too far, move back if(uiNickNameCharacterPosition > MAX_NICK_NAME) @@ -852,19 +850,19 @@ void DisplayPlayerNickNameString( void ) // restore background RenderNickNameIndent( 194, 192); - // setup the font stuff + // setup the font stuff SetFont( FONT14ARIAL ); - SetFontForeground( 184 ); + SetFontForeground( 184 ); SetFontBackground(FONT_BLACK); - // reset shadow - SetFontShadow(DEFAULT_SHADOW); - mprintf( LAPTOP_SCREEN_UL_X + 196, NICK_NAME_CURSOR_Y + 4, pNickNameString); - - + // reset shadow + SetFontShadow(DEFAULT_SHADOW); + mprintf( LAPTOP_SCREEN_UL_X + 196, NICK_NAME_CURSOR_Y + 4, pNickNameString); + + fNewCharInString = FALSE; - fReDrawScreenFlag = TRUE; + fReDrawScreenFlag = TRUE; return; } @@ -872,27 +870,27 @@ void DisplayPlayerNickNameString( void ) void DisplayMaleGlowCursor( void ) { // this procdure will draw the activation string cursor on the screen at position cursorx cursory - UINT32 uiDestPitchBYTES; + UINT32 uiDestPitchBYTES; static UINT32 uiBaseTime = 0; UINT32 uiDeltaTime = 0; - static UINT32 iCurrentState = 0; - static BOOLEAN fIncrement = TRUE; - UINT8 *pDestBuf; + static UINT32 iCurrentState = 0; + static BOOLEAN fIncrement = TRUE; + UINT8 *pDestBuf; if(uiBaseTime == 0) { uiBaseTime = GetJA2Clock(); } - + // get difference uiDeltaTime = GetJA2Clock() - uiBaseTime; // if difference is long enough, rotate colors if(uiDeltaTime > MIN_GLOW_DELTA) - { + { if( iCurrentState == 10) { - // start rotating downward + // start rotating downward fIncrement = FALSE; } if( iCurrentState == 0) @@ -901,7 +899,7 @@ void DisplayMaleGlowCursor( void ) fIncrement = TRUE; } // if increment upward, increment iCurrentState - if(fIncrement) + if(fIncrement) { iCurrentState++; } @@ -910,19 +908,19 @@ void DisplayMaleGlowCursor( void ) // else downwards iCurrentState--; } - // reset basetime to current clock + // reset basetime to current clock uiBaseTime = GetJA2Clock( ); } - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); // draw rectangle - RectangleDraw( TRUE, MALE_BOX_X, MALE_BOX_Y, MALE_BOX_X + MALE_BOX_WIDTH, MALE_BOX_Y + MALE_BOX_HEIGHT, Get16BPPColor( FROMRGB( GlowColorsList[ iCurrentState ][ 0 ], GlowColorsList[ iCurrentState ][ 1 ], GlowColorsList[ iCurrentState ][ 2 ] ) ), pDestBuf ); - - - InvalidateRegion((UINT16) MALE_BOX_X, MALE_BOX_Y, MALE_BOX_X + MALE_BOX_WIDTH + 1, MALE_BOX_Y + MALE_BOX_HEIGHT + 1); - + RectangleDraw( TRUE, MALE_BOX_X, MALE_BOX_Y, MALE_BOX_X + MALE_BOX_WIDTH, MALE_BOX_Y + MALE_BOX_HEIGHT, Get16BPPColor( FROMRGB( GlowColorsList[ iCurrentState ][ 0 ], GlowColorsList[ iCurrentState ][ 1 ], GlowColorsList[ iCurrentState ][ 2 ] ) ), pDestBuf ); + + + InvalidateRegion((UINT16) MALE_BOX_X, MALE_BOX_Y, MALE_BOX_X + MALE_BOX_WIDTH + 1, MALE_BOX_Y + MALE_BOX_HEIGHT + 1); + // unlock frame buffer UnLockVideoSurface( FRAME_BUFFER ); return; @@ -933,27 +931,27 @@ void DisplayMaleGlowCursor( void ) void DisplayFemaleGlowCursor( void ) { // this procdure will draw the activation string cursor on the screen at position cursorx cursory - UINT32 uiDestPitchBYTES; + UINT32 uiDestPitchBYTES; static UINT32 uiBaseTime = 0; UINT32 uiDeltaTime = 0; - static UINT32 iCurrentState = 0; - static BOOLEAN fIncrement = TRUE; + static UINT32 iCurrentState = 0; + static BOOLEAN fIncrement = TRUE; UINT8 *pDestBuf; if(uiBaseTime == 0) { uiBaseTime = GetJA2Clock(); } - + // get difference uiDeltaTime = GetJA2Clock() - uiBaseTime; // if difference is long enough, rotate colors if(uiDeltaTime > MIN_GLOW_DELTA) - { + { if( iCurrentState == 10) { - // start rotating downward + // start rotating downward fIncrement = FALSE; } if( iCurrentState == 0) @@ -962,7 +960,7 @@ void DisplayFemaleGlowCursor( void ) fIncrement = TRUE; } // if increment upward, increment iCurrentState - if(fIncrement) + if(fIncrement) { iCurrentState++; } @@ -971,19 +969,19 @@ void DisplayFemaleGlowCursor( void ) // else downwards iCurrentState--; } - // reset basetime to current clock + // reset basetime to current clock uiBaseTime = GetJA2Clock( ); } - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); // draw rectangle - RectangleDraw( TRUE, FEMALE_BOX_X, MALE_BOX_Y, FEMALE_BOX_X + MALE_BOX_WIDTH, MALE_BOX_Y + MALE_BOX_HEIGHT, Get16BPPColor( FROMRGB( GlowColorsList[ iCurrentState ][ 0 ], GlowColorsList[ iCurrentState ][ 1 ], GlowColorsList[ iCurrentState ][ 2 ] ) ), pDestBuf ); - - - InvalidateRegion((UINT16) FEMALE_BOX_X, MALE_BOX_Y, FEMALE_BOX_X + MALE_BOX_WIDTH + 1, MALE_BOX_Y + MALE_BOX_HEIGHT + 1); - + RectangleDraw( TRUE, FEMALE_BOX_X, MALE_BOX_Y, FEMALE_BOX_X + MALE_BOX_WIDTH, MALE_BOX_Y + MALE_BOX_HEIGHT, Get16BPPColor( FROMRGB( GlowColorsList[ iCurrentState ][ 0 ], GlowColorsList[ iCurrentState ][ 1 ], GlowColorsList[ iCurrentState ][ 2 ] ) ), pDestBuf ); + + + InvalidateRegion((UINT16) FEMALE_BOX_X, MALE_BOX_Y, FEMALE_BOX_X + MALE_BOX_WIDTH + 1, MALE_BOX_Y + MALE_BOX_HEIGHT + 1); + // unlock frame buffer UnLockVideoSurface( FRAME_BUFFER ); return; @@ -994,7 +992,7 @@ void CopyFirstNameIntoNickName( void ) { // this procedure will copy the characters first name in to the nickname for the character UINT32 iCounter=0; - while( ( pFullNameString[ iCounter ] != L' ' ) && ( iCounter < 20) && ( pFullNameString[ iCounter ] != 0 ) ) + while( ( pFullNameString[ iCounter ] != L' ' ) && ( iCounter < 20) && ( pFullNameString[ iCounter ] != 0 ) ) { // copy charcters into nick name pNickNameString[ iCounter ] = pFullNameString[ iCounter ]; @@ -1007,14 +1005,14 @@ void CopyFirstNameIntoNickName( void ) void IncrementTextEnterMode( void ) { - // this function will incrment which text enter mode we are in, FULLname, NICKname, IMP_MALE or IMP_FEMALE - + // this function will incrment which text enter mode we are in, FULLname, NICKname, IMP_MALE or IMP_FEMALE + // if at IMP_FEMALE gender selection, reset to full name - if( FEMALE_GENDER_SELECT == ubTextEnterMode) + if( FEMALE_GENDER_SELECT == ubTextEnterMode) { - ubTextEnterMode = FULL_NAME_MODE; + ubTextEnterMode = FULL_NAME_MODE; } - else + else { // otherwise, next selection ubTextEnterMode++; @@ -1024,14 +1022,14 @@ void IncrementTextEnterMode( void ) void DecrementTextEnterMode( void ) { - // this function will incrment which text enter mode we are in, FULLname, NICKname, IMP_MALE or IMP_FEMALE - + // this function will incrment which text enter mode we are in, FULLname, NICKname, IMP_MALE or IMP_FEMALE + // if at IMP_FEMALE gender selection, reset to full name - if( FULL_NAME_MODE == ubTextEnterMode) + if( FULL_NAME_MODE == ubTextEnterMode) { - ubTextEnterMode = FEMALE_GENDER_SELECT; + ubTextEnterMode = FEMALE_GENDER_SELECT; } - else + else { // otherwise, next selection ubTextEnterMode--; @@ -1041,13 +1039,13 @@ void DecrementTextEnterMode( void ) void RenderMaleGenderIcon( void ) { - // this function displays a filled box in the IMP_MALE gender box if IMP_MALE has been selected - + // this function displays a filled box in the IMP_MALE gender box if IMP_MALE has been selected + // re render indent RenderGenderIndent( 192, 252 ); // IMP_MALE selected draw box - if( bGenderFlag == IMP_MALE ) + if( bGenderFlag == IMP_MALE ) { } @@ -1057,13 +1055,13 @@ void RenderMaleGenderIcon( void ) void RenderFemaleGenderIcon( void ) { - // this function displays a filled box in the IMP_MALE gender box if IMP_MALE has been selected - + // this function displays a filled box in the IMP_MALE gender box if IMP_MALE has been selected + // re render indent RenderGenderIndent( 302, 252 ); - - // IMP_FEMALE selected draw box - if( bGenderFlag == IMP_FEMALE ) + + // IMP_FEMALE selected draw box + if( bGenderFlag == IMP_FEMALE ) { } @@ -1077,26 +1075,26 @@ void RenderFemaleGenderIcon( void ) void CreateIMPBeginScreenMouseRegions( void ) { // this function creates the IMP mouse regions - + // are we only reviewing text?.. if so, do not create regions if( ubTextEnterMode == 5 ) return; // full name region - MSYS_DefineRegion(&gIMPBeginScreenMouseRegions[ 0 ] , LAPTOP_SCREEN_UL_X + 196, LAPTOP_SCREEN_WEB_UL_Y + 135, LAPTOP_SCREEN_UL_X + 196 + FULL_NAME_REGION_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + 135 + 24, MSYS_PRIORITY_HIGH, CURSOR_WWW, + MSYS_DefineRegion(&gIMPBeginScreenMouseRegions[ 0 ] , LAPTOP_SCREEN_UL_X + 196, LAPTOP_SCREEN_WEB_UL_Y + 135, LAPTOP_SCREEN_UL_X + 196 + FULL_NAME_REGION_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + 135 + 24, MSYS_PRIORITY_HIGH, CURSOR_WWW, MSYS_NO_CALLBACK, (MOUSE_CALLBACK)SelectFullNameRegionCallBack ); - + // nick name region - MSYS_DefineRegion(&gIMPBeginScreenMouseRegions[ 1 ] , LAPTOP_SCREEN_UL_X + 196, LAPTOP_SCREEN_WEB_UL_Y + 195, LAPTOP_SCREEN_UL_X + 196 + NICK_NAME_REGION_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + 195 + 24, MSYS_PRIORITY_HIGH, CURSOR_WWW, + MSYS_DefineRegion(&gIMPBeginScreenMouseRegions[ 1 ] , LAPTOP_SCREEN_UL_X + 196, LAPTOP_SCREEN_WEB_UL_Y + 195, LAPTOP_SCREEN_UL_X + 196 + NICK_NAME_REGION_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + 195 + 24, MSYS_PRIORITY_HIGH, CURSOR_WWW, MSYS_NO_CALLBACK, (MOUSE_CALLBACK)SelectNickNameRegionCallBack ); // IMP_MALE gender area - MSYS_DefineRegion(&gIMPBeginScreenMouseRegions[ 2 ] , MALE_BOX_X, MALE_BOX_Y, MALE_BOX_X + MALE_BOX_WIDTH, MALE_BOX_Y + MALE_BOX_HEIGHT, MSYS_PRIORITY_HIGH, CURSOR_WWW, + MSYS_DefineRegion(&gIMPBeginScreenMouseRegions[ 2 ] , MALE_BOX_X, MALE_BOX_Y, MALE_BOX_X + MALE_BOX_WIDTH, MALE_BOX_Y + MALE_BOX_HEIGHT, MSYS_PRIORITY_HIGH, CURSOR_WWW, (MOUSE_CALLBACK)MvtOnMaleRegionCallBack, (MOUSE_CALLBACK)SelectMaleRegionCallBack ); // IMP_FEMALE gender region - MSYS_DefineRegion(&gIMPBeginScreenMouseRegions[ 3 ] , FEMALE_BOX_X, MALE_BOX_Y, FEMALE_BOX_X + MALE_BOX_WIDTH, MALE_BOX_Y + MALE_BOX_HEIGHT, MSYS_PRIORITY_HIGH, CURSOR_WWW, + MSYS_DefineRegion(&gIMPBeginScreenMouseRegions[ 3 ] , FEMALE_BOX_X, MALE_BOX_Y, FEMALE_BOX_X + MALE_BOX_WIDTH, MALE_BOX_Y + MALE_BOX_HEIGHT, MSYS_PRIORITY_HIGH, CURSOR_WWW, (MOUSE_CALLBACK)MvtOnFemaleRegionCallBack, (MOUSE_CALLBACK)SelectFemaleRegionCallBack ); @@ -1118,18 +1116,18 @@ void DestroyIMPBeginScreenMouseRegions( void ) return; // remove regions - MSYS_RemoveRegion(&gIMPBeginScreenMouseRegions[ 0 ]); + MSYS_RemoveRegion(&gIMPBeginScreenMouseRegions[ 0 ]); MSYS_RemoveRegion(&gIMPBeginScreenMouseRegions[ 1 ]); MSYS_RemoveRegion(&gIMPBeginScreenMouseRegions[ 2 ]); MSYS_RemoveRegion(&gIMPBeginScreenMouseRegions[ 3 ]); - + return; } void SelectFullNameRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { @@ -1143,12 +1141,12 @@ void SelectFullNameRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } void SelectNickNameRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { @@ -1162,11 +1160,11 @@ void SelectNickNameRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } void SelectMaleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { @@ -1180,12 +1178,12 @@ void SelectMaleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } void SelectFemaleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { @@ -1199,12 +1197,12 @@ void SelectFemaleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } void MvtOnFemaleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if ( iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { //fNewCharInString = TRUE; @@ -1218,9 +1216,9 @@ void MvtOnFemaleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) void MvtOnMaleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if ( iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) - { + { //fNewCharInString = TRUE; } else if( iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE) @@ -1232,11 +1230,11 @@ void MvtOnMaleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) void RenderGender( void ) { - // this procedure will render the gender of the character int he appropriate box + // this procedure will render the gender of the character int he appropriate box // check to see if gender has been in fact set - if( bGenderFlag == -1 ) - { + if( bGenderFlag == -1 ) + { // nope, leave return; } @@ -1261,12 +1259,12 @@ void Print8CharacterOnlyString( void ) SetFontBackground( FONT_BLACK ); SetFontForeground( FONT_BLACK ); SetFont( FONT12ARIAL ); - SetFontShadow(NO_SHADOW); + SetFontShadow(NO_SHADOW); mprintf(iScreenWidthOffset + 430, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y + 228,pIMPBeginScreenStrings[ 0 ]); // reset shadow - SetFontShadow(DEFAULT_SHADOW); + SetFontShadow(DEFAULT_SHADOW); } @@ -1283,207 +1281,207 @@ BOOLEAN CheckCharacterInputForEgg( void ) { wcscpy( pFullNameString, L"Mark Carter"); wcscpy( pNickNameString, L"BodyCount"); - bGenderFlag = IMP_MALE; + bGenderFlag = IMP_MALE; iHealth = 99; iAgility = 99; iStrength = 99; iDexterity = 99; iWisdom = 35; iLeadership = 35; - iMarksmanship = 99; - iMechanical = 0; + iMarksmanship = 99; + iMechanical = 0; iExplosives = 99; iMedical = 0; iSkillA = AMBIDEXT; iSkillB = AUTO_WEAPS; - iPersonality = NO_PERSONALITYTRAIT; + iPersonality = NO_PERSONALITYTRAIT; iAttitude = ATT_ASSHOLE; iCurrentImpPage = IMP_FINISH; // LaptopSaveInfo.iCurrentVoice = 1; // LaptopSaveInfo.iCharIndex = 1; iPortraitNumber = 2; - return TRUE; + return TRUE; } else if ( ( wcscmp( pFullNameString, L"hcnerF evaD") == 0)&&( wcscmp( pNickNameString, L"Feral") == 0)) { - wcscpy( pFullNameString, L"Dave French"); + wcscpy( pFullNameString, L"Dave French"); wcscpy( pNickNameString, L"Feral"); - bGenderFlag = IMP_MALE; + bGenderFlag = IMP_MALE; iHealth = 90; iAgility = 95; iStrength = 90; iDexterity = 95; iWisdom = 60; iLeadership = 60; - iMarksmanship = 89; - iMechanical = 40; + iMarksmanship = 89; + iMechanical = 40; iExplosives = 25; iMedical = 60; iSkillA = MARTIALARTS; iSkillB = AUTO_WEAPS; - iPersonality = NO_PERSONALITYTRAIT; + iPersonality = NO_PERSONALITYTRAIT; iAttitude = ATT_FRIENDLY; iCurrentImpPage = IMP_FINISH; // LaptopSaveInfo.iCurrentVoice = 1; // LaptopSaveInfo.iCharIndex = 1; iPortraitNumber = 1; - return TRUE; + return TRUE; } else if ( ( wcscmp( pFullNameString, L"Marnes") == 0)&&( wcscmp( pNickNameString, L"Marnes") == 0)) { - wcscpy( pFullNameString, L"Kris Marnes"); + wcscpy( pFullNameString, L"Kris Marnes"); wcscpy( pNickNameString, L"Marnes"); - bGenderFlag = IMP_MALE; + bGenderFlag = IMP_MALE; iHealth = 100; iAgility = 100; iStrength = 100; iDexterity = 100; iWisdom = 100; iLeadership = 100; - iMarksmanship = 100; - iMechanical = 100; + iMarksmanship = 100; + iMechanical = 100; iExplosives = 100; iMedical = 100; iSkillA = MARTIALARTS; iSkillB = AUTO_WEAPS; - iPersonality = NO_PERSONALITYTRAIT; + iPersonality = NO_PERSONALITYTRAIT; iAttitude = ATT_FRIENDLY; iCurrentImpPage = IMP_FINISH; // LaptopSaveInfo.iCurrentVoice = 2; // LaptopSaveInfo.iCharIndex = 2; iPortraitNumber = 1; - return TRUE; + return TRUE; } else if( ( wcscmp( pFullNameString, L"neslO namroN") == 0 ) && ( wcscmp( pNickNameString, L"N.R.G") == 0) ) { wcscpy( pFullNameString, L"Norman Olsen"); wcscpy( pNickNameString, L"N.R.G"); - bGenderFlag = IMP_MALE; + bGenderFlag = IMP_MALE; iHealth = 99; iAgility = 99; iStrength = 99; iDexterity = 90; iWisdom = 70; iLeadership = 35; - + iMarksmanship = 70; - iMechanical = 65; + iMechanical = 65; iExplosives = 99; iMedical = 75; - + iSkillA = STEALTHY; iSkillB = MARTIALARTS; - + iPersonality = NO_PERSONALITYTRAIT; iAttitude = ATT_AGGRESSIVE; iCurrentImpPage = IMP_FINISH; // LaptopSaveInfo.iCurrentVoice = 1; // LaptopSaveInfo.iCharIndex = 1; iPortraitNumber = 4; - return TRUE; + return TRUE; } else if( ( wcscmp( pFullNameString, L"snommE werdnA") == 0 ) && ( wcscmp( pNickNameString, L"Bubba") == 0) ) { wcscpy( pFullNameString, L"Andrew Emmons"); wcscpy( pNickNameString, L"Bubba"); - bGenderFlag =IMP_MALE; + bGenderFlag =IMP_MALE; iHealth = 97; iAgility = 98; iStrength = 80; iDexterity = 80; iWisdom = 99; iLeadership = 99; - + iMarksmanship = 99; - iMechanical = 0; + iMechanical = 0; iExplosives = 0; iMedical = 99; - + iSkillA = AUTO_WEAPS; iSkillB = AMBIDEXT; - + iPersonality = NO_PERSONALITYTRAIT; iAttitude = ATT_ARROGANT; iCurrentImpPage = IMP_FINISH; // LaptopSaveInfo.iCurrentVoice = 1; // LaptopSaveInfo.iCharIndex = 1; iPortraitNumber = 2; - return TRUE; + return TRUE; } else if( ( wcscmp( pFullNameString, L"nalehW yeoJ") == 0 ) && ( wcscmp( pNickNameString, L"Joeker") == 0) ) { wcscpy( pFullNameString, L"Joey Whelan"); wcscpy( pNickNameString, L"Joeker"); - bGenderFlag = 0; + bGenderFlag = 0; iHealth = 99; iAgility = 99; iStrength = 99; iDexterity = 99; iWisdom = 70; iLeadership = 80; - + iMarksmanship = 99; - iMechanical = 35; + iMechanical = 35; iExplosives = 99; iMedical = 35; - + iSkillA = AUTO_WEAPS; iSkillB = MARTIALARTS; - + iPersonality = NO_PERSONALITYTRAIT; iAttitude = ATT_AGGRESSIVE; iCurrentImpPage = IMP_FINISH; // LaptopSaveInfo.iCurrentVoice = 1; // LaptopSaveInfo.iCharIndex = 1; iPortraitNumber = 4; - return TRUE; + return TRUE; } else if( ( wcscmp( pFullNameString, L"gnehC cirE") == 0 ) && ( wcscmp( pNickNameString, L"BlakAddr") == 0) ) { wcscpy( pFullNameString, L"Eric Cheng"); wcscpy( pNickNameString, L"BlakAddr"); - bGenderFlag = IMP_MALE; + bGenderFlag = IMP_MALE; iHealth = 99; iAgility = 99; iStrength = 99; iDexterity = 99; iWisdom = 99; iLeadership = 70; - + iMarksmanship = 99; - iMechanical = 50; + iMechanical = 50; iExplosives = 99; iMedical = 0; - + iSkillA = AUTO_WEAPS; iSkillB = MARTIALARTS; - + iPersonality = NO_PERSONALITYTRAIT; iAttitude = ATT_LONER; iCurrentImpPage = IMP_FINISH; // LaptopSaveInfo.iCurrentVoice = 1; // LaptopSaveInfo.iCharIndex = 1; iPortraitNumber = 3; - return TRUE; + return TRUE; } else if( ( wcscmp( pFullNameString, L"Karters Killer Kru") == 0 ) && ( wcscmp( pNickNameString, L"Bitchin") == 0) ) { wcscpy( pFullNameString, L"Mark Carter"); wcscpy( pNickNameString, L"BodyCount"); - bGenderFlag = IMP_MALE; + bGenderFlag = IMP_MALE; iHealth = 99; iAgility = 99; iStrength = 99; iDexterity = 99; iWisdom = 35; iLeadership = 35; - iMarksmanship = 99; - iMechanical = 0; + iMarksmanship = 99; + iMechanical = 0; iExplosives = 99; iMedical = 0; iSkillA = AMBIDEXT; iSkillB = AUTO_WEAPS; - iPersonality = PSYCHO; + iPersonality = PSYCHO; iAttitude = ATT_ASSHOLE; iCurrentImpPage = IMP_FINISH; // LaptopSaveInfo.iCurrentVoice = 1; @@ -1518,35 +1516,35 @@ BOOLEAN CheckCharacterInputForEgg( void ) HireMercStruct.ubProfileID = 20; HireMerc( &HireMercStruct ); - return TRUE; + return TRUE; } else if( ( wcscmp( pFullNameString, L"dleifmaC sirhC") == 0 ) && ( wcscmp( pNickNameString, L"SSR") == 0) ) { wcscpy( pFullNameString, L"James Bolivar DiGriz"); wcscpy( pNickNameString, L"DiGriz"); - bGenderFlag = IMP_MALE; + bGenderFlag = IMP_MALE; iHealth = 99; iAgility = 80; iStrength = 80; iDexterity = 99; iWisdom = 70; iLeadership = 70; - + iMarksmanship = 99; - iMechanical = 99; + iMechanical = 99; iExplosives = 99; iMedical = 60; - + iSkillA = ELECTRONICS; iSkillB = LOCKPICKING; - + iPersonality = NO_PERSONALITYTRAIT; iAttitude = ATT_LONER; iCurrentImpPage = IMP_FINISH; // LaptopSaveInfo.iCurrentVoice = 1; // LaptopSaveInfo.iCharIndex = 1; iPortraitNumber = 3; - return TRUE; + return TRUE; } #endif #endif @@ -1554,22 +1552,22 @@ BOOLEAN CheckCharacterInputForEgg( void ) { wcscpy( pFullNameString, L"Test Female"); wcscpy( pNickNameString, L"Test"); - bGenderFlag = IMP_FEMALE; + bGenderFlag = IMP_FEMALE; iHealth = 55; iAgility = 55; iStrength = 55; iDexterity = 55; iWisdom = 55; iLeadership = 55; - + iMarksmanship = 55; - iMechanical = 55; + iMechanical = 55; iExplosives = 55; iMedical = 55; - + iSkillA = 0; iSkillB = 0; - + iPersonality = NO_PERSONALITYTRAIT; iAttitude = ATT_LONER; iCurrentImpPage = IMP_FINISH; @@ -1579,4 +1577,4 @@ BOOLEAN CheckCharacterInputForEgg( void ) } return FALSE; -} \ No newline at end of file +} diff --git a/Laptop/IMP Compile Character.cpp b/Laptop/IMP Compile Character.cpp index f0de4a5a..51521197 100644 --- a/Laptop/IMP Compile Character.cpp +++ b/Laptop/IMP Compile Character.cpp @@ -55,15 +55,15 @@ extern BOOLEAN fLoadingCharacterForPreviousImpProfile; // positions of the face x and y for eyes and mouth for the 10 portraits INT16 sFacePositions[ NUMBER_OF_PLAYER_PORTRAITS ][ 4 ]= { - {0,0,0,0}, - {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, - {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, @@ -134,58 +134,58 @@ void CreateACharacterFromPlayerEnteredStats( void ) // copy over full name - wcscpy( gMercProfiles[ LaptopSaveInfo.iIMPIndex ].zName, pFullName ); + wcscpy( gMercProfiles[ LaptopSaveInfo.iIMPIndex ].zName, pFullName ); // the nickname - wcscpy( gMercProfiles[ LaptopSaveInfo.iIMPIndex ].zNickname, pNickName ); - - // gender + wcscpy( gMercProfiles[ LaptopSaveInfo.iIMPIndex ].zNickname, pNickName ); + + // gender if ( fCharacterIsMale == TRUE ) { - // male - gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bSex = MALE; + // male + gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bSex = MALE; } else { // female - gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bSex = FEMALE; + gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bSex = FEMALE; } // attributes gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bLifeMax = ( INT8 )iHealth; - gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bLife = ( INT8 )iHealth; - gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bAgility = ( INT8 )iAgility; - gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bStrength = ( INT8 )iStrength; - gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bDexterity = ( INT8 )iDexterity; - gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bWisdom = ( INT8 )iWisdom; + gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bLife = ( INT8 )iHealth; + gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bAgility = ( INT8 )iAgility; + gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bStrength = ( INT8 )iStrength; + gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bDexterity = ( INT8 )iDexterity; + gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bWisdom = ( INT8 )iWisdom; gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bLeadership = ( INT8 )iLeadership; // skills gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bMarksmanship = ( INT8 )iMarksmanship; - gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bMedical = ( INT8 )iMedical; - gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bMechanical = ( INT8 )iMechanical; - gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bExplosive = ( INT8 )iExplosives; + gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bMedical = ( INT8 )iMedical; + gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bMechanical = ( INT8 )iMechanical; + gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bExplosive = ( INT8 )iExplosives; - // personality + // personality gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bPersonalityTrait = ( INT8 )iPersonality; - + // attitude - gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bAttitude = ( INT8 )iAttitude; - + gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bAttitude = ( INT8 )iAttitude; + gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bExpLevel = 1; - + // set time away gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bMercStatus = 0; - - - // face - SelectMercFace( ); - return; + + // face + SelectMercFace( ); + + return; } @@ -213,10 +213,10 @@ BOOLEAN DoesCharacterHaveAPersoanlity( void ) { - if( iPersonality != NO_PERSONALITYTRAIT ) + if( iPersonality != NO_PERSONALITYTRAIT ) { // yep - return ( TRUE ); + return ( TRUE ); } else { @@ -233,10 +233,10 @@ BOOLEAN DoesCharacterHaveAPersoanlity( void ) return( FALSE ); // simply checks if caracter has a personality other than normal - if( iPersonality != NO_PERSONALITYTRAIT ) + if( iPersonality != NO_PERSONALITYTRAIT ) { // yep - return ( TRUE ); + return ( TRUE ); } else { @@ -254,15 +254,15 @@ void CreatePlayerAttitude( void ) if(gGameSettings.fOptions[TOPTION_USE_RANDOM_PERSONALITY] == TRUE) { AddAnAttitudeToAttitudeList( ATT_OPTIMIST ); - AddAnAttitudeToAttitudeList( ATT_LONER ); - AddAnAttitudeToAttitudeList( ATT_FRIENDLY ); + AddAnAttitudeToAttitudeList( ATT_LONER ); + AddAnAttitudeToAttitudeList( ATT_FRIENDLY ); AddAnAttitudeToAttitudeList( ATT_ARROGANT ); AddAnAttitudeToAttitudeList( ATT_NORMAL ); AddAnAttitudeToAttitudeList( ATT_ASSHOLE ); AddAnAttitudeToAttitudeList( ATT_COWARD ); AddAnAttitudeToAttitudeList( ATT_AGGRESSIVE ); AddAnAttitudeToAttitudeList( ATT_PESSIMIST ); - AddAnAttitudeToAttitudeList( ATT_BIG_SHOT ); + AddAnAttitudeToAttitudeList( ATT_BIG_SHOT ); // this function will 'roll a die' and decide if any attitude does exists INT32 iDiceValue = 0; @@ -339,8 +339,8 @@ void AddAnAttitudeToAttitudeList( INT8 bAttitude ) { // add element AttitudeList[ iLastElementInAttitudeList ] = ( INT32 )bAttitude; - - // increment attitude list counter + + // increment attitude list counter iLastElementInAttitudeList++; } @@ -350,14 +350,14 @@ void AddAnAttitudeToAttitudeList( INT8 bAttitude ) void AddSkillToSkillList( INT8 bSkill ) { - // adds a skill to skills list + // adds a skill to skills list - if( iLastElementInSkillsList < ATTITUDE_LIST_SIZE) + if( iLastElementInSkillsList < ATTITUDE_LIST_SIZE) { // add element SkillsList[ iLastElementInSkillsList ] = ( INT32 )bSkill; - - // increment attitude list counter + + // increment attitude list counter iLastElementInSkillsList++; } @@ -381,7 +381,7 @@ void ClearAllSkillsList( void ) void RemoveSkillFromSkillsList( INT32 iIndex ) -{ +{ INT32 iLoop; // remove a skill from the index given and shorten the list @@ -440,7 +440,7 @@ void ValidateSkillsList( void ) } } - // Kaiden using UB's code, lockpicking can't be removed from the list "yet". + // Kaiden using UB's code, lockpicking can't be removed from the list "yet". // special check for lockpicking //iValue = pProfile->bMechanical; //iValue = ( iValue * pProfile->bWisdom ) / 100; @@ -483,9 +483,8 @@ void ValidateSkillsList( void ) void CreatePlayerSkills( void ) { - // this function will 'roll a die' and decide if any attitude does exists - INT32 iDiceValue = 0; - INT32 iCounter = 0; + // this function will 'roll a die' and decide if any attitude does exists + INT32 iDiceValue = 0; ValidateSkillsList(); /* Kaiden - Commented out in UB to skip the whole random skill thing @@ -500,8 +499,8 @@ void CreatePlayerSkills( void ) iSkillB = SkillsList[ iDiceValue ]; */ - - // Kaiden: This section was added in it's place: + + // Kaiden: This section was added in it's place: if( iLastElementInSkillsList > 0 ) { // set attitude @@ -539,8 +538,8 @@ void CreatePlayerSkills( void ) } /* - // are the same, - // reroll until different, or until ATTITUDE_LIST_SIZE times + // are the same, + // reroll until different, or until ATTITUDE_LIST_SIZE times iSkillB = Random( iLastElementInSkillsList + 1 ); while( (iSkillA == iSkillB ) && ( iCounter < HOW_MANY_ROLLS_FOR_SAME_SKILL_CHECK ) ) @@ -548,13 +547,13 @@ void CreatePlayerSkills( void ) // increment counter iCounter++; - // next random - iSkillB = Random( iLastElementInSkillsList + 1 ); + // next random + iSkillB = Random( iLastElementInSkillsList + 1 ); } - if( iCounter == ATTITUDE_LIST_SIZE ) + if( iCounter == ATTITUDE_LIST_SIZE ) { - iSkillB = NO_SKILLTRAIT; + iSkillB = NO_SKILLTRAIT; } return; @@ -567,7 +566,7 @@ void AddAPersonalityToPersonalityList( INT8 bPersonlity ) { // CJC, Oct 26 98: prevent personality list from being generated // because no dialogue was written to support PC personality quotes - + // BUT we can manage this for PSYCHO okay //Kaiden: But we're going to try it anyway screw dialoge. @@ -578,13 +577,13 @@ void AddAPersonalityToPersonalityList( INT8 bPersonlity ) // return; //} - // will add a persoanlity to persoanlity list - if( iLastElementInPersonalityList < ATTITUDE_LIST_SIZE) + // will add a persoanlity to persoanlity list + if( iLastElementInPersonalityList < ATTITUDE_LIST_SIZE) { // add element PersonalityList[ iLastElementInPersonalityList ] = ( INT32 )bPersonlity; - - // increment attitude list counter + + // increment attitude list counter iLastElementInPersonalityList++; } @@ -610,7 +609,7 @@ void CreatePlayerPersonality( void ) AddAPersonalityToPersonalityList( NONSWIMMER ); AddAPersonalityToPersonalityList( FEAR_OF_INSECTS ); AddAPersonalityToPersonalityList( NO_PERSONALITYTRAIT ); - AddAPersonalityToPersonalityList( PSYCHO ); + AddAPersonalityToPersonalityList( PSYCHO ); AddAPersonalityToPersonalityList( FORGETFUL ); AddAPersonalityToPersonalityList( NERVOUS ); AddAPersonalityToPersonalityList( HEAT_INTOLERANT ); @@ -625,7 +624,7 @@ void CreatePlayerPersonality( void ) INT32 iCounter = 0; INT32 iCounter2 = 0; - // Kaiden: Roll dice 20 times just to be on the safe side + // Kaiden: Roll dice 20 times just to be on the safe side // was getting too many repeats. Will end up scrapping // rand() later anyway so will worry about fixing it then. for (iCounter2 = 0; iCounter2 < 20; iCounter2++) @@ -635,12 +634,12 @@ void CreatePlayerPersonality( void ) // Kaiden two chances to avoid a normal personality. As IMP // says, They check it twice just to make sure :p - for( iCounter = 0; iCounter < iLastElementInPersonalityList; iCounter++ ) + for( iCounter = 0; iCounter < iLastElementInPersonalityList; iCounter++ ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("iDiceValue = %d",iDiceValue)); - if( PersonalityList[ iDiceValue ] == NO_PERSONALITYTRAIT ) + if( PersonalityList[ iDiceValue ] == NO_PERSONALITYTRAIT ) { //Kaiden: Roll one more time for good measure: iDiceValue = Random( iLastElementInPersonalityList + 1 ); @@ -663,14 +662,14 @@ void CreatePlayersPersonalitySkillsAndAttitude( void ) - + // creates personality, skills and attitudes from curretly built list // personality CreatePlayerPersonality( ); // skills are now created later after stats have been chosen - //CreatePlayerSkills( ); + //CreatePlayerSkills( ); // attitude CreatePlayerAttitude( ); @@ -683,7 +682,7 @@ void ResetSkillsAttributesAndPersonality( void ) { // reset count of skills attributes and personality - + iLastElementInPersonalityList = 0; iLastElementInSkillsList = 0; @@ -696,7 +695,7 @@ void ResetSkillsAttributesAndPersonality( void ) void ResetIncrementCharacterAttributes( void ) { // this resets any increments due to character generation - + // attributes iAddStrength = 0; iAddDexterity = 0; @@ -705,7 +704,7 @@ void ResetIncrementCharacterAttributes( void ) iAddHealth = 0; iAddLeadership = 0; - // skills + // skills iAddMarksmanship = 0; iAddExplosives = 0; iAddMedical = 0; @@ -718,15 +717,15 @@ void SelectMercFace( void ) // this procedure will select the approriate face for the merc and save offsets // grab face filename -// strcpy( gMercProfiles[ LaptopSaveInfo.iIMPIndex ].ubUnusedFaceFileName , pPlayerSelectedFaceFileNames[ iPortraitNumber ]); +// strcpy( gMercProfiles[ LaptopSaveInfo.iIMPIndex ].ubUnusedFaceFileName , pPlayerSelectedFaceFileNames[ iPortraitNumber ]); // now the offsets - gMercProfiles[ LaptopSaveInfo.iIMPIndex ].ubFaceIndex = 200 + ( UINT8 )iPortraitNumber; + gMercProfiles[ LaptopSaveInfo.iIMPIndex ].ubFaceIndex = 200 + ( UINT8 )iPortraitNumber; // eyes gMercProfiles[ LaptopSaveInfo.iIMPIndex ].usEyesX = sFacePositions[ iPortraitNumber ][ 0 ]; gMercProfiles[ LaptopSaveInfo.iIMPIndex ].usEyesY = sFacePositions[ iPortraitNumber ][ 1 ]; - + // mouth gMercProfiles[ LaptopSaveInfo.iIMPIndex ].usMouthX = sFacePositions[ iPortraitNumber ][ 2 ]; gMercProfiles[ LaptopSaveInfo.iIMPIndex ].usMouthY = sFacePositions[ iPortraitNumber ][ 3 ]; @@ -740,9 +739,9 @@ void SetMercSkinAndHairColors( void ) { enum{ PINKSKIN, TANSKIN, DARKSKIN, BLACKSKIN, NUMSKINS }; enum{ BROWNHEAD, BLACKHEAD, //black skin (only this line ) - WHITEHEAD, //dark skin (this line plus all above) - BLONDHEAD, REDHEAD, //pink/tan skin (this line plus all above ) - NUMHEADS + WHITEHEAD, //dark skin (this line plus all above) + BLONDHEAD, REDHEAD, //pink/tan skin (this line plus all above ) + NUMHEADS }; enum @@ -941,15 +940,15 @@ void HandleMercStatsForChangesInFace( ) CreatePlayerSkills(); // body type - if ( fCharacterIsMale ) + if ( fCharacterIsMale ) { - // male + // male // big or regular // Madd - don't override the skills - override the body type instead if( ShouldThisMercHaveABigBody() && iSkillA != MARTIALARTS && iSkillB != MARTIALARTS ) { - gMercProfiles[ LaptopSaveInfo.iIMPIndex ].ubBodyType = BIGMALE; - + gMercProfiles[ LaptopSaveInfo.iIMPIndex ].ubBodyType = BIGMALE; + //if( iSkillA == MARTIALARTS ) //{ // iSkillA = HANDTOHAND; @@ -961,14 +960,14 @@ void HandleMercStatsForChangesInFace( ) } else { - gMercProfiles[ LaptopSaveInfo.iIMPIndex ].ubBodyType = REGMALE; - } + gMercProfiles[ LaptopSaveInfo.iIMPIndex ].ubBodyType = REGMALE; + } } else { - // female - gMercProfiles[ LaptopSaveInfo.iIMPIndex ].ubBodyType = REGFEMALE; - + // female + gMercProfiles[ LaptopSaveInfo.iIMPIndex ].ubBodyType = REGFEMALE; + if( iSkillA == MARTIALARTS ) { iSkillA = HANDTOHAND; @@ -981,8 +980,8 @@ void HandleMercStatsForChangesInFace( ) // skill trait - gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bSkillTrait = ( INT8 )iSkillA; - gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bSkillTrait2 = ( INT8 )iSkillB; + gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bSkillTrait = ( INT8 )iSkillA; + gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bSkillTrait2 = ( INT8 )iSkillB; } @@ -999,4 +998,4 @@ BOOLEAN ShouldThisMercHaveABigBody( void ) //} return( FALSE ); -} \ No newline at end of file +} diff --git a/Laptop/IMP Confirm.cpp b/Laptop/IMP Confirm.cpp index 004fed46..3aa22076 100644 --- a/Laptop/IMP Confirm.cpp +++ b/Laptop/IMP Confirm.cpp @@ -33,9 +33,24 @@ #include "strategic.h" #include "weapons.h" #include "Random.h" + #include "GameVersion.h" + #include "GameSettings.h" #endif -#define IMP_FILENAME_SUFFIX ".dat" +// Changed by ADB (rev 1513) to resolve IMPs created prior to structural changes +//#define IMP_FILENAME_SUFFIX ".dat" +#define OLD_IMP_FILENAME_SUFFIX ".dat" +#define NEW_IMP_FILENAME_SUFFIX ".dat2" + +//CHRISL: structure needed to store temporary inventory information during IMP creation +typedef struct +{ + UINT16 inv; + UINT8 iSize; + UINT32 iClass; + UINT8 iStatus; + UINT8 iNumber; +} INVNODE; IMP_ITEM_CHOICE_TYPE gIMPItemChoices[MAX_IMP_ITEM_TYPES]; @@ -45,7 +60,7 @@ void GiveIMPItems( MERCPROFILESTRUCT *pProfile, INT8 abilityValue, UINT8 typeInd UINT32 giIMPConfirmButton[ 2 ]; UINT32 giIMPConfirmButtonImage[ 2 ]; BOOLEAN fNoAlreadySelected = FALSE; -UINT16 uiEyeXPositions[ ]={ +UINT16 uiEyeXPositions[ ]={ 8, 9, 8, @@ -65,7 +80,7 @@ UINT16 uiEyeXPositions[ ]={ }; UINT16 uiEyeYPositions[ ]= -{ +{ 5, 4, 5, @@ -132,6 +147,14 @@ void MakeProfileInvItemAnySlot(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 void MakeProfileInvItemThisSlot(MERCPROFILESTRUCT *pProfile, UINT32 uiPos, UINT16 usItem, UINT8 ubStatus, UINT8 ubHowMany); INT32 FirstFreeBigEnoughPocket(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 ubHowMany); +// CHRISL: +void RedistributeStartingItems(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 sPocket); +void DistributeInitialGear(MERCPROFILESTRUCT *pProfile); +INT32 FirstFreeBigEnoughPocket(MERCPROFILESTRUCT *pProfile, INVNODE *tInv); +INT32 AnyFreeBigEnoughPocket(MERCPROFILESTRUCT *pProfile, INVNODE *tInv); +INT32 SpecificFreePocket(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 ubHowMany, UINT32 usClass); +INT32 PickPocket(MERCPROFILESTRUCT *pProfile, UINT8 ppStart, UINT8 ppStop, UINT16 usItem, UINT8 iNumber, UINT8 * cap); + // callbacks void BtnIMPConfirmNo( GUI_BUTTON *btn,INT32 reason ); void BtnIMPConfirmYes( GUI_BUTTON *btn,INT32 reason ); @@ -147,14 +170,14 @@ void EnterIMPConfirm( void ) void RenderIMPConfirm( void ) { - // the background + // the background RenderProfileBackGround( ); - + // indent - RenderAvgMercIndentFrame(90, 40 ); + RenderAvgMercIndentFrame(90, 40 ); // highlight answer - PrintImpText( ); + PrintImpText( ); return; } @@ -163,7 +186,7 @@ void ExitIMPConfirm( void ) { // destroy buttons - DestroyConfirmButtons( ); + DestroyConfirmButtons( ); return; } @@ -175,40 +198,40 @@ void HandleIMPConfirm( void ) void CreateConfirmButtons( void ) { // create buttons for confirm screen - - giIMPConfirmButtonImage[0]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); - giIMPConfirmButton[0] = CreateIconAndTextButton( giIMPConfirmButtonImage[0], pImpButtonText[ 16 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 254 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPConfirmYes); - - giIMPConfirmButtonImage[1]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); - giIMPConfirmButton[1] = CreateIconAndTextButton( giIMPConfirmButtonImage[ 1 ], pImpButtonText[ 17 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPConfirmNo); - + + giIMPConfirmButtonImage[0]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); + giIMPConfirmButton[0] = CreateIconAndTextButton( giIMPConfirmButtonImage[0], pImpButtonText[ 16 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 254 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPConfirmYes); + + giIMPConfirmButtonImage[1]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); + giIMPConfirmButton[1] = CreateIconAndTextButton( giIMPConfirmButtonImage[ 1 ], pImpButtonText[ 17 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPConfirmNo); + SetButtonCursor(giIMPConfirmButton[ 0 ], CURSOR_WWW); SetButtonCursor(giIMPConfirmButton[ 1 ], CURSOR_WWW); - + return; } void DestroyConfirmButtons( void ) { - // destroy buttons for confirm screen - - RemoveButton(giIMPConfirmButton[ 0 ] ); - UnloadButtonImage(giIMPConfirmButtonImage[ 0 ] ); + // destroy buttons for confirm screen + + RemoveButton(giIMPConfirmButton[ 0 ] ); + UnloadButtonImage(giIMPConfirmButtonImage[ 0 ] ); + - RemoveButton(giIMPConfirmButton[ 1 ] ); - UnloadButtonImage(giIMPConfirmButtonImage[ 1 ] ); + UnloadButtonImage(giIMPConfirmButtonImage[ 1 ] ); return; } @@ -236,8 +259,8 @@ BOOLEAN AddCharacterToPlayersTeam( void ) } - HireMercStruct.sSectorX = gsMercArriveSectorX; - HireMercStruct.sSectorY = gsMercArriveSectorY; + HireMercStruct.sSectorX = gsMercArriveSectorX; + HireMercStruct.sSectorY = gsMercArriveSectorY; HireMercStruct.fUseLandingZoneForArrival = TRUE; HireMercStruct.fCopyProfileItemsOver = TRUE; @@ -262,7 +285,7 @@ BOOLEAN AddCharacterToPlayersTeam( void ) } -void BtnIMPConfirmYes(GUI_BUTTON *btn,INT32 reason) +void BtnIMPConfirmYes(GUI_BUTTON *btn,INT32 reason) { // btn callback for IMP Homepage About US button @@ -271,7 +294,7 @@ void BtnIMPConfirmYes(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { @@ -290,7 +313,7 @@ void BtnIMPConfirmYes(GUI_BUTTON *btn,INT32 reason) if( LaptopSaveInfo.iCurrentBalance < COST_OF_PROFILE ) { // not enough - return; + return; } // line moved by CJC Nov 28 2002 to AFTER the check for money @@ -298,12 +321,12 @@ void BtnIMPConfirmYes(GUI_BUTTON *btn,INT32 reason) // charge the player AddTransactionToPlayersBook(IMP_PROFILE, (UINT8)(LaptopSaveInfo.iIMPIndex), GetWorldTotalMin( ), - ( COST_OF_PROFILE ) ); - AddHistoryToPlayersLog( HISTORY_CHARACTER_GENERATED, 0,GetWorldTotalMin( ), -1, -1 ); + AddHistoryToPlayersLog( HISTORY_CHARACTER_GENERATED, 0,GetWorldTotalMin( ), -1, -1 ); AddCharacterToPlayersTeam( ); - + // write the created imp merc WriteOutCurrentImpCharacter( ( UINT8 )( LaptopSaveInfo.iIMPIndex ) ); - + fButtonPendingFlag = TRUE; iCurrentImpPage = IMP_HOME_PAGE; @@ -324,24 +347,24 @@ void BtnIMPConfirmYes(GUI_BUTTON *btn,INT32 reason) //Display a popup msg box telling the user when and where the merc will arrive //DisplayPopUpBoxExplainingMercArrivalLocationAndTime( LaptopSaveInfo.iIMPIndex ); - + //reset the id of the last merc so we dont get the DisplayPopUpBoxExplainingMercArrivalLocationAndTime() pop up box in another screen by accident LaptopSaveInfo.sLastHiredMerc.iIdOfMerc = -1; } } - + } // fixed? by CJC Nov 28 2002 void BtnIMPConfirmNo( GUI_BUTTON *btn,INT32 reason ) { - // btn callback for IMP Homepage About US button + // btn callback for IMP Homepage About US button if (!(btn->uiFlags & BUTTON_ENABLED)) return; if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { @@ -365,9 +388,9 @@ void BtnIMPConfirmNo( GUI_BUTTON *btn,INT32 reason ) fButtonPendingFlag = TRUE; iCurrentImpPage = IMP_HOME_PAGE; } - fNoAlreadySelected = TRUE; + fNoAlreadySelected = TRUE; */ - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); } } } @@ -377,13 +400,13 @@ void BtnIMPConfirmNo( GUI_BUTTON *btn,INT32 reason ) { - // btn callback for IMP Homepage About US button + // btn callback for IMP Homepage About US button if (!(btn->uiFlags & BUTTON_ENABLED)) return; if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { @@ -396,8 +419,8 @@ void BtnIMPConfirmNo( GUI_BUTTON *btn,INT32 reason ) fButtonPendingFlag = TRUE; iCurrentImpPage = IMP_HOME_PAGE; } - fNoAlreadySelected = TRUE; - btn->uiFlags&=~(BUTTON_CLICKED_ON); + fNoAlreadySelected = TRUE; + btn->uiFlags&=~(BUTTON_CLICKED_ON); } } } @@ -406,13 +429,144 @@ void BtnIMPConfirmNo( GUI_BUTTON *btn,INT32 reason ) #define PROFILE_HAS_SKILL_TRAIT( p, t ) ((p->bSkillTrait == t) || (p->bSkillTrait2 == t)) +//CHRISL: New function to handle proper distribution of starting gear +void DistributeInitialGear(MERCPROFILESTRUCT *pProfile) +{ + INVNODE tInv[NUM_INV_SLOTS]; + int i, j, number; + UINT8 count = 0, length; + int iOrder[NUM_INV_SLOTS]; + INT32 iSlot; + BOOLEAN iSet = FALSE; + + // First move profile information to temporary storage + for(i=INV_START_POS; iinv[i] != NOTHING) + { + if((UsingNewInventorySystem() == true)) + { + if(Item[pProfile->inv[i]].ItemSize != 99) + { + tInv[count].inv = pProfile->inv[i]; + tInv[count].iSize = Item[pProfile->inv[i]].ItemSize; + tInv[count].iClass = Item[pProfile->inv[i]].usItemClass; + tInv[count].iStatus = (pProfile->bInvStatus[i] > 0) ? pProfile->bInvStatus[i] : 100; + tInv[count].iNumber = (pProfile->bInvNumber[i] == 0) ? 1 :pProfile->bInvNumber[i]; + count++; + } + pProfile->inv[i] = 0; + pProfile->bInvStatus[i] = 0; + pProfile->bInvNumber[i] = 0; + } + else + { + if(Item[pProfile->inv[i]].usItemClass == IC_LBEGEAR) + { + pProfile->inv[i] = 0; + pProfile->bInvStatus[i] = 0; + pProfile->bInvNumber[i] = 0; + } + } + } + } + + //Now that we've weeded out illegal items, skip the rest if we're in OldInv + if((UsingNewInventorySystem() == false)) + return; + + length = count; + count = 0; + // Next sort list by size + for(j=34; j>=0; j--) + { + for(i=0; i 0) + { + iSlot = FirstFreeBigEnoughPocket (pProfile, &tInv[iOrder[i]]); + if(iSlot != -1) + { + MakeProfileInvItemThisSlot(pProfile, iSlot, tInv[iOrder[i]].inv, tInv[iOrder[i]].iStatus, tInv[iOrder[i]].iNumber); + iSet = TRUE; + number -= tInv[iOrder[i]].iNumber; + tInv[iOrder[i]].iNumber = number; + } + else if(tInv[iOrder[i]].iNumber>1){ + tInv[iOrder[i]].iNumber --; + } + else { + iSet = FALSE; + tInv[iOrder[i]].iNumber = number; + number = 0; + } + } + if(iSet) + iOrder[i]=-1; + } + } + // finish by putting anything that's left into any pocket, including inactive pockets + for(i=0; ibMarksmanship,IMP_MARKSMANSHIP); - + //Give ANY imp the calico // MakeProfileInvItemThisSlot( pProfile, HANDPOS, M950, 100, 1); @@ -543,7 +697,7 @@ void GiveItemsToPC( UINT8 ubProfileId ) // MakeProfileInvItemAnySlot(pProfile, SILENCER, 100, 1); GiveIMPRandomItems(pProfile,IMP_STEALTHY); } - + if (PROFILE_HAS_SKILL_TRAIT(pProfile, KNIFING)) { // MakeProfileInvItemAnySlot(pProfile, COMBAT_KNIFE, 100, 1); @@ -567,9 +721,9 @@ void GiveItemsToPC( UINT8 ubProfileId ) GiveIMPRandomItems(pProfile,IMP_MARTIALARTS); } - if (PROFILE_HAS_SKILL_TRAIT(pProfile, ONROOF)) + if (PROFILE_HAS_SKILL_TRAIT(pProfile, PROF_SNIPER)) { - GiveIMPRandomItems(pProfile,IMP_ROOFTOPS); + GiveIMPRandomItems(pProfile,IMP_PROF_SNIPER); } if (PROFILE_HAS_SKILL_TRAIT(pProfile, TEACHING)) @@ -591,14 +745,30 @@ void GiveItemsToPC( UINT8 ubProfileId ) { GiveIMPRandomItems(pProfile,IMP_THIEF); } + + // CHRISL: Now that all items have been issued, distribute them into appropriate pockets, starting with the largest items + DistributeInitialGear(pProfile); } void MakeProfileInvItemAnySlot(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 ubStatus, UINT8 ubHowMany) { - INT32 iSlot; + INT32 iSlot = -1; - iSlot = FirstFreeBigEnoughPocket(pProfile, usItem, ubHowMany); + if((UsingNewInventorySystem() == false)) + iSlot = FirstFreeBigEnoughPocket(pProfile, usItem, ubHowMany); + else + { + // CHRISL: Alter the placement of initial equipment to come last. At this stage, just add items, one pocket at a time + for(int i=INV_START_POS; iinv[i] == NOTHING) + { + iSlot = i; + break; + } + } + } if (iSlot == -1) { @@ -610,14 +780,255 @@ void MakeProfileInvItemAnySlot(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 MakeProfileInvItemThisSlot(pProfile, iSlot, usItem, ubStatus, ubHowMany); } +// CHRISL: New function to move initial gear into LBE pockets when LBE items are given during creation +void RedistributeStartingItems(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 sPocket) +{ + UINT16 lbeIndex; + UINT8 lbeClass, iSize; + UINT16 inv[NUM_INV_SLOTS], istatus[NUM_INV_SLOTS], inumber[NUM_INV_SLOTS]; + + lbeIndex = Item[usItem].ubClassIndex; + lbeClass = LoadBearingEquipment[lbeIndex].lbeClass; + + // Move non-worn items into temporary storage + for(int i=INV_START_POS; i=BODYPOSFINAL) + { + inv[i] = pProfile->inv[i]; + istatus[i] = pProfile->bInvStatus[i]; + inumber[i] = pProfile->bInvNumber[i]; + pProfile->inv[i] = 0; + pProfile->bInvStatus[i] = 0; + pProfile->bInvNumber[i] = 0; + } + else + { + switch (i) + { + case HANDPOS: + case SECONDHANDPOS: + inv[i] = pProfile->inv[i]; + istatus[i] = pProfile->bInvStatus[i]; + inumber[i] = pProfile->bInvNumber[i]; + pProfile->inv[i] = 0; + pProfile->bInvStatus[i] = 0; + pProfile->bInvNumber[i] = 0; + break; + default: + inv[i] = 0; + istatus[i] = 0; + inumber[i] = 0; + break; + } + } + } + + // Redistribute stored items with the assumption of the new LBE item + for(int i=INV_START_POS; iinv[j] == NONE && LBEPocketType[LoadBearingEquipment[lbeIndex].lbePocketIndex[icPocket[j]]].ItemCapacityPerSize[iSize] != NONE) + { + pProfile->inv[j] = inv[i]; + pProfile->bInvStatus[j] = istatus[i]; + pProfile->bInvNumber[j] = inumber[i]; + inv[i] = istatus[i] = inumber[i] = 0; + break; + } + } + pProfile->inv[i] = inv[i]; + pProfile->bInvStatus[i] = istatus[i]; + pProfile->bInvNumber[i] = inumber[i]; + inv[i] = istatus[i] = inumber[i] = 0; + } + } +} + +// CHRISL: New function to work with LBE pockets +INT32 SpecificFreePocket(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 ubHowMany, UINT32 usClass) +{ + UINT8 lbePocket; + + if (ubHowMany == 1) + { + switch (usClass) + { + case IC_LBEGEAR: + if(pProfile->inv[VESTPOCKPOS]==NONE && LoadBearingEquipment[Item[usItem].ubClassIndex].lbeClass==VEST_PACK) + return VESTPOCKPOS; + if(pProfile->inv[LTHIGHPOCKPOS]==NONE && LoadBearingEquipment[Item[usItem].ubClassIndex].lbeClass==THIGH_PACK) + return LTHIGHPOCKPOS; + if(pProfile->inv[RTHIGHPOCKPOS]==NONE && LoadBearingEquipment[Item[usItem].ubClassIndex].lbeClass==THIGH_PACK) + return RTHIGHPOCKPOS; + if(LoadBearingEquipment[Item[usItem].ubClassIndex].lbeClass==COMBAT_PACK) + { + if(pProfile->inv[CPACKPOCKPOS]==NONE) + { + if(LoadBearingEquipment[Item[usItem].ubClassIndex].lbeCombo!=0) + { + if((pProfile->inv[BPACKPOCKPOS]!=NONE && LoadBearingEquipment[Item[pProfile->inv[BPACKPOCKPOS]].ubClassIndex].lbeCombo==LoadBearingEquipment[Item[usItem].ubClassIndex].lbeCombo) || pProfile->inv[BPACKPOCKPOS]==NONE) + return CPACKPOCKPOS; + } + else if(pProfile->inv[BPACKPOCKPOS]==NONE) + return CPACKPOCKPOS; + } + } + if(LoadBearingEquipment[Item[usItem].ubClassIndex].lbeClass==BACKPACK) + { + if(pProfile->inv[BPACKPOCKPOS]==NONE) + { + if(LoadBearingEquipment[Item[usItem].ubClassIndex].lbeCombo!=0) + { + if((pProfile->inv[CPACKPOCKPOS]!=NONE && LoadBearingEquipment[Item[pProfile->inv[CPACKPOCKPOS]].ubClassIndex].lbeCombo==LoadBearingEquipment[Item[usItem].ubClassIndex].lbeCombo) || pProfile->inv[CPACKPOCKPOS]==NONE) + return BPACKPOCKPOS; + } + else if(pProfile->inv[CPACKPOCKPOS]==NONE) + return BPACKPOCKPOS; + } + } + break; + case IC_ARMOUR: + if ( pProfile->inv[HELMETPOS] == NONE && Armour[Item[usItem].ubClassIndex].ubArmourClass == ARMOURCLASS_HELMET ) + return HELMETPOS; + if ( pProfile->inv[VESTPOS] == NONE && Armour[Item[usItem].ubClassIndex].ubArmourClass == ARMOURCLASS_VEST ) + return VESTPOS; + if ( pProfile->inv[LEGPOS] == NONE && Armour[Item[usItem].ubClassIndex].ubArmourClass == ARMOURCLASS_LEGGINGS && !(Item[usItem].attachment)) + return LEGPOS; + break; + case IC_BLADE: + if ( pProfile->inv[KNIFEPOCKPOS] == NONE) + return KNIFEPOCKPOS; + break; + /* CHRISL: This won't work without hard coding pocket definitions since there is no way to + guarantee that the pocket definitions won't change. */ +// case IC_BOMB: +// for(int i=BIGPOCKSTART; iinv[icLBE[i]]].ubClassIndex].lbePocketIndex[icPocket[i]]==7) // TNT Pocket +// if(pProfile->inv[i] == NONE) +// return i; +// } +// break; +// case IC_GRENADE: +// for(int i=BIGPOCKSTART; iinv[i]==NONE && Item[usItem].ItemSize==16 && LoadBearingEquipment[Item[pProfile->inv[icLBE[i]]].ubClassIndex].lbePocketIndex[icPocket[i]]==12) // Rifle Grenade +// return i; +// else if(pProfile->inv[i]==NONE && LoadBearingEquipment[Item[pProfile->inv[icLBE[i]]].ubClassIndex].lbePocketIndex[icPocket[i]]==13) // Grenade +// return i; +// } +// break; + case IC_GUN: + if ( pProfile->inv[HANDPOS] == NONE ) + return HANDPOS; + if ( pProfile->inv[SECONDHANDPOS] == NONE && !(Item[pProfile->inv[HANDPOS]].twohanded)) + return SECONDHANDPOS; + if((UsingNewInventorySystem() == true)) + if ( pProfile->inv[GUNSLINGPOCKPOS] == NONE && pProfile->inv[BPACKPOCKPOS] == NONE && LBEPocketType[1].ItemCapacityPerSize[Item[usItem].ItemSize]!=0) + return GUNSLINGPOCKPOS; + for(int i=BIGPOCKSTART; iinv[icLBE[i]]].ubClassIndex].lbePocketIndex[icPocket[i]]; + if(pProfile->inv[i]==NONE && (lbePocket==6 || lbePocket==10) && LBEPocketType[lbePocket].ItemCapacityPerSize[Item[usItem].ItemSize]!=0) + return i; + } + break; + case IC_FACE: + if ( pProfile->inv[HEAD1POS] == NONE && CompatibleFaceItem(usItem,pProfile->inv[HEAD2POS]) ) + return HEAD1POS; + if ( pProfile->inv[HEAD2POS] == NONE && CompatibleFaceItem(usItem,pProfile->inv[HEAD1POS]) ) + return HEAD2POS; + break; + default: + break; + } + } + return(-1); +} + void MakeProfileInvItemThisSlot(MERCPROFILESTRUCT *pProfile, UINT32 uiPos, UINT16 usItem, UINT8 ubStatus, UINT8 ubHowMany) { - pProfile->inv[uiPos] = usItem; - pProfile->bInvStatus[uiPos] = ubStatus; - pProfile->bInvNumber[uiPos] = ubHowMany; + pProfile->inv[uiPos] = usItem; + pProfile->bInvStatus[uiPos] = ubStatus; + pProfile->bInvNumber[uiPos] = ubHowMany; } +//INT32 FirstFreeBigEnoughPocket(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 ubHowMany, UINT32 usClass) +INT32 FirstFreeBigEnoughPocket(MERCPROFILESTRUCT *pProfile, INVNODE *tInv) +{ + INT32 sPocket=-1, mPocket=-1, lPocket=-1; + UINT8 sCapacity=0; + UINT8 mCapacity=0; + UINT8 lCapacity=0; + UINT8 capacity=0; + + /*CHRISL: Make the assumption that by the time we get to this function, we've already activated + all the pockets we're going to activate. LBE Items were all placed in SpecificFreePocket function + which should activate everything. */ + //Start with active big pockets + sPocket=PickPocket(pProfile, SMALLPOCKSTART, SMALLPOCKFINAL, tInv->inv, tInv->iNumber, &sCapacity); + //Next search active medium pockets + mPocket=PickPocket(pProfile, MEDPOCKSTART, MEDPOCKFINAL, tInv->inv, tInv->iNumber, &mCapacity); + //Lastly search active small pockets + lPocket=PickPocket(pProfile, BIGPOCKSTART, BIGPOCKFINAL, tInv->inv, tInv->iNumber, &lCapacity); + //Finally, compare the three pockets we've found and return the pocket that is most logical to use + capacity = min(sCapacity, mCapacity); + capacity = min(lCapacity, capacity); + if(capacity == 254) { //no pocket found + return -1; + } + else if(capacity == sCapacity) { + return sPocket; + } + else if(capacity == mCapacity) { + return mPocket; + } + else if(capacity == lCapacity) { + return lPocket; + } + return(-1); +} + +// CHRISL: Use to find best pocket to store item in. Could probably be merged with FitsInSmallPocket +INT32 PickPocket(MERCPROFILESTRUCT *pProfile, UINT8 ppStart, UINT8 ppStop, UINT16 usItem, UINT8 iNumber, UINT8 * cap) +{ + UINT16 pIndex=0; + INT32 pocket=0; + UINT8 capacity=254; + + for(UINT32 uiPos=ppStart; uiPosinv[icLBE[uiPos]]==0){ + pIndex=LoadBearingEquipment[Item[icDefault[uiPos]].ubClassIndex].lbePocketIndex[icPocket[uiPos]]; + } + else { + pIndex=LoadBearingEquipment[Item[pProfile->inv[icLBE[uiPos]]].ubClassIndex].lbePocketIndex[icPocket[uiPos]]; + } + // Here's were we get complicated. We should look for the smallest pocket all items can fit in + if(LBEPocketType[pIndex].ItemCapacityPerSize[Item[usItem].ItemSize] >= iNumber && + LBEPocketType[pIndex].ItemCapacityPerSize[Item[usItem].ItemSize] < capacity && + pProfile->inv[uiPos] == 0) { + if((LBEPocketType[pIndex].pRestriction != 0 && LBEPocketType[pIndex].pRestriction == Item[usItem].usItemClass) || + LBEPocketType[pIndex].pRestriction == 0) { + capacity = LBEPocketType[pIndex].ItemCapacityPerSize[Item[usItem].ItemSize]; + pocket = uiPos; + } + } + } + if(pocket!=0){ + *cap=capacity; + return pocket; + } + else{ + *cap=254; + return -1; + } +} INT32 FirstFreeBigEnoughPocket(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 ubHowMany) { @@ -667,18 +1078,59 @@ INT32 FirstFreeBigEnoughPocket(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 return(-1); } +// CHRISL: This function will place objects anywhere it can. It tries to use active pockets but will use any pocket as a last resort +INT32 AnyFreeBigEnoughPocket(MERCPROFILESTRUCT *pProfile, INVNODE *tInv) +{ + INT32 iSlot; + INT32 iPos; + UINT16 iSize, lbeCap, usItem; + + iSlot = FirstFreeBigEnoughPocket (pProfile, tInv); + if(iSlot != -1) + return(iSlot); + else + { + /* CHRISL: FAILSAFE: We can't find any active pockets to put this item. Rather then losing the item, + put it in any pocket using old inventory method. Player can then manually resort items later. */ + usItem = tInv->inv; + iSize = Item[usItem].ubPerPocket; + lbeCap = max(1, (iSize/2)); + for(iPos = BIGPOCKSTART; iPos < NUM_INV_SLOTS; iPos ++) + { + if(iPos >= MEDPOCKFINAL && iSize > 0) + return(-1); + else + { + if(pProfile->inv[iPos] == NONE) + return(iPos); + else if(pProfile->inv[iPos] == usItem) + { + if((iPos < BIGPOCKFINAL && iSize >= (tInv->iNumber+1)) || (iPos >= BIGPOCKFINAL && lbeCap >= (tInv->iNumber+1))) + { + tInv->iNumber++; + return(iPos); + } + } + } + } + } + return(-1); +} + void WriteOutCurrentImpCharacter( INT32 iProfileId ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("WriteOutCurrentImpCharacter: IMP.dat")); char zImpFileName[13]; strcpy(zImpFileName,IMP_MERC_FILENAME); - strcat(zImpFileName,IMP_FILENAME_SUFFIX); + // Changed by ADB, rev 1513, to resolve IMPs created prior to structural changes + //strcat(zImpFileName,IMP_FILENAME_SUFFIX); + strcat(zImpFileName,NEW_IMP_FILENAME_SUFFIX); WriteOutCurrentImpCharacter ( iProfileId, zImpFileName); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("WriteOutCurrentImpCharacter: Nickname.dat")); - + char zFileName[13]; char temp; @@ -688,7 +1140,9 @@ void WriteOutCurrentImpCharacter( INT32 iProfileId ) zFileName[i] = temp; } - strcat(zFileName,IMP_FILENAME_SUFFIX); + // Changed by ADB, rev 1513 + //strcat(zFileName,IMP_FILENAME_SUFFIX); + strcat(zFileName,NEW_IMP_FILENAME_SUFFIX); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("WriteOutCurrentImpCharacter: %s", zFileName)); WriteOutCurrentImpCharacter ( iProfileId, zFileName); @@ -704,6 +1158,23 @@ void WriteOutCurrentImpCharacter( INT32 iProfileId, STR fileName ) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("WriteOutCurrentImpCharacter: %s", fileName)); hFile = FileOpen(fileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE); + // ADB we need to indicate that we have saved under the new format + int nine = 9999; + if (!FileWrite(hFile, &nine, sizeof( INT32 ), &uiBytesWritten)) + { + if (hFile) + FileClose(hFile); + return; + } + + int version = SAVE_GAME_VERSION; + if (!FileWrite(hFile, &version, sizeof( INT32 ), &uiBytesWritten)) + { + if (hFile) + FileClose(hFile); + return; + } + // write out the profile id if (!FileWrite(hFile, &iProfileId, sizeof( INT32 ), &uiBytesWritten)) { @@ -721,9 +1192,7 @@ void WriteOutCurrentImpCharacter( INT32 iProfileId, STR fileName ) } // write out the profile itself - // WDS - Clean up inventory handling - gMercProfiles[ iProfileId ].CopyNewInventoryToOld(); - if (!FileWrite(hFile, &gMercProfiles[ iProfileId ], SIZEOF_MERCPROFILESTRUCT_POD, &uiBytesWritten)) + if ( !gMercProfiles[ iProfileId ].Save(hFile) ) { if (hFile) FileClose(hFile); @@ -739,15 +1208,28 @@ void WriteOutCurrentImpCharacter( INT32 iProfileId, STR fileName ) BOOLEAN ImpExists ( STR nickName ) { + // Changed by ADB, rev 1513, to resolve IMPs created prior to structural changes char zFileName[13]; strcpy(zFileName,nickName); - strcat(zFileName,IMP_FILENAME_SUFFIX); + //strcat(zFileName,IMP_FILENAME_SUFFIX); + strcat(zFileName,OLD_IMP_FILENAME_SUFFIX); - DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ImpExists: %s", zFileName)); - DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ImpExists: %d", FileExistsNoDB(zFileName) )); + //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ImpExists: %s", zFileName)); + //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ImpExists: %d", FileExistsNoDB(zFileName) )); + BOOLEAN oldExists = FileExistsNoDB(zFileName); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("OLD ImpExists: %s", zFileName)); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("OLD ImpExists: %d", oldExists )); - return FileExistsNoDB(zFileName); + //return FileExistsNoDB(zFileName); + strcpy(zFileName,nickName); + strcat(zFileName,NEW_IMP_FILENAME_SUFFIX); + + BOOLEAN newExists = FileExistsNoDB(zFileName); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("NEW ImpExists: %s", zFileName)); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("NEW ImpExists: %d", newExists )); + + return (oldExists || newExists); } BOOLEAN LoadImpCharacter( STR nickName ) @@ -758,25 +1240,61 @@ BOOLEAN LoadImpCharacter( STR nickName ) char zFileName[13]; + //ADB first try to load the new kind strcpy(zFileName,nickName); - strcat(zFileName,IMP_FILENAME_SUFFIX); + //strcat(zFileName,IMP_FILENAME_SUFFIX); + strcat(zFileName,NEW_IMP_FILENAME_SUFFIX); - // open the file for writing + // open the file for reading hFile = FileOpen(zFileName, FILE_ACCESS_READ, FALSE); // valid file? - if( hFile == -1 ) + if( !hFile ) + { + //DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 7 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + //return FALSE; + //if the new kind doesn't exist, load the old kind + strcpy(zFileName,nickName); + strcat(zFileName,OLD_IMP_FILENAME_SUFFIX); + + // open the file for reading + hFile = FileOpen(zFileName, FILE_ACCESS_READ, FALSE); + + // valid file? + if( !hFile ) + { + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 7 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + return FALSE; + } + } + + // read in the profile + if (!FileRead(hFile, &iProfileId, sizeof( INT32 ), &uiBytesRead)) { DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 7 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); return FALSE; } - // read in the profile + int version = SAVE_GAME_VERSION; + bool isOldVersion = true; + if (iProfileId == 9999) { + //ADB if we saved under the original version, then iProfileId is some low number + //if we saved under the new version, then it's 9999, and we need to know what version it was saved under + isOldVersion = false; - if (!FileRead(hFile, &iProfileId, sizeof( INT32 ), &uiBytesRead)) - { - DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 7 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); - return FALSE; + //load the version, atm not used + if (!FileRead(hFile, &version, sizeof( INT32 ), &uiBytesRead)) + { + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 7 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + return FALSE; + } + + //load the REAL iProfileId + if (!FileRead(hFile, &iProfileId, sizeof( INT32 ), &uiBytesRead)) + { + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 7 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + return FALSE; + } } // read in the portrait @@ -795,17 +1313,19 @@ BOOLEAN LoadImpCharacter( STR nickName ) LaptopSaveInfo.iIMPIndex = iProfileId; // read in the profile - // WDS - Clean up inventory handling - if (!FileRead(hFile, &gMercProfiles[ iProfileId ] , SIZEOF_MERCPROFILESTRUCT_POD, &uiBytesRead)) + //if ( !gMercProfiles[ iProfileId ].Load(hFile, false) ) + if ( !gMercProfiles[ iProfileId ].Load(hFile, isOldVersion, false, false) ) { DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 7 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); return FALSE; } - gMercProfiles[ iProfileId ].CopyOldInventoryToNew(); // close file FileClose(hFile); - + + //CHRISL: At this point, we need to resort profile inventory so that NewInv items don't accidentally appear in OldInv + DistributeInitialGear(&gMercProfiles[iProfileId]); + if( LaptopSaveInfo.iCurrentBalance < COST_OF_PROFILE ) { DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 3 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); @@ -813,7 +1333,7 @@ BOOLEAN LoadImpCharacter( STR nickName ) // not enough return FALSE; } - + // charge the player // is the character male? @@ -837,7 +1357,7 @@ BOOLEAN LoadImpCharacter( STR nickName ) FileClose(hFile); // WDS: Allow flexible numbers of IMPs of each sex - // note: check this + // note: check this // You cannot have more than 3 I.M.P characters with the same gender on your team. DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 9 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); @@ -849,18 +1369,18 @@ BOOLEAN LoadImpCharacter( STR nickName ) void ResetIMPCharactersEyesAndMouthOffsets( UINT8 ubMercProfileID ) { - // ATE: Check boundary conditions! - if( ( ( gMercProfiles[ ubMercProfileID ].ubFaceIndex - 200 ) > 16 ) || ( ubMercProfileID >= PROF_HUMMER ) ) - { - return; - } + // ATE: Check boundary conditions! + if( ( ( gMercProfiles[ ubMercProfileID ].ubFaceIndex - 200 ) > 16 ) || ( ubMercProfileID >= PROF_HUMMER ) ) + { + return; + } gMercProfiles[ ubMercProfileID ].usEyesX = uiEyeXPositions[ gMercProfiles[ ubMercProfileID ].ubFaceIndex - 200 ]; - gMercProfiles[ ubMercProfileID ].usEyesY = uiEyeYPositions[ gMercProfiles[ ubMercProfileID ].ubFaceIndex - 200 ]; + gMercProfiles[ ubMercProfileID ].usEyesY = uiEyeYPositions[ gMercProfiles[ ubMercProfileID ].ubFaceIndex - 200 ]; - gMercProfiles[ ubMercProfileID ].usMouthX = uiMouthXPositions[ gMercProfiles[ ubMercProfileID ].ubFaceIndex - 200 ]; - gMercProfiles[ ubMercProfileID ].usMouthY = uiMouthYPositions[ gMercProfiles[ ubMercProfileID ].ubFaceIndex - 200 ]; + gMercProfiles[ ubMercProfileID ].usMouthX = uiMouthXPositions[ gMercProfiles[ ubMercProfileID ].ubFaceIndex - 200 ]; + gMercProfiles[ ubMercProfileID ].usMouthY = uiMouthYPositions[ gMercProfiles[ ubMercProfileID ].ubFaceIndex - 200 ]; } @@ -927,7 +1447,9 @@ void GiveIMPItems( MERCPROFILESTRUCT *pProfile, INT8 abilityValue, UINT8 typeInd DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPItems: 2 iChoice = %d",iChoice)); usItem = gIMPItemChoices[ typeIndex ].bItemNo[ iChoice ]; DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPItems: typeIndex = %d, usItem = %d, iChoice = %d, abilityValue = %d",typeIndex, usItem,iChoice, abilityValue )); - if ( usItem > 0 && ItemIsLegal(usItem)) + //CHRISL: Let "illegal" guns be allowed so we don't have to worry about an IMP failing to start with a weapon simply + // because Tons of Guns was not selected. + if ( usItem > 0 && (ItemIsLegal(usItem) || Item[usItem].usItemClass == IC_GUN)) { MakeProfileInvItemAnySlot(pProfile,usItem,100,1); @@ -956,3 +1478,4 @@ void GiveIMPItems( MERCPROFILESTRUCT *pProfile, INT8 abilityValue, UINT8 typeInd } + diff --git a/Laptop/IMP Finish.cpp b/Laptop/IMP Finish.cpp index cec9c852..8da9cd1b 100644 --- a/Laptop/IMP Finish.cpp +++ b/Laptop/IMP Finish.cpp @@ -33,7 +33,7 @@ #define MAIN_PAGE__FIRST_BUTTON_POS_X ( LAPTOP_SCREEN_UL_X + 15 ) #define MAIN_PAGE__SECOND_BUTTON_POS_X ( MAIN_PAGE__FIRST_BUTTON_POS_X + MAIN_PAGE_SPACE_BTN_BUTTONS ) #define MAIN_PAGE__THIRD_BUTTON_POS_X ( MAIN_PAGE__SECOND_BUTTON_POS_X + MAIN_PAGE_SPACE_BTN_BUTTONS ) -#define MAIN_PAGE__FOURTH_BUTTON_POS_X (MAIN_PAGE__THIRD_BUTTON_POS_X + MAIN_PAGE_SPACE_BTN_BUTTONS ) +#define MAIN_PAGE__FOURTH_BUTTON_POS_X (MAIN_PAGE__THIRD_BUTTON_POS_X + MAIN_PAGE_SPACE_BTN_BUTTONS ) // buttons INT32 giIMPFinishButton[ 6 ]; @@ -85,8 +85,8 @@ void EnterIMPFinish( void ) LoadCharacterPortrait( ); // CREATE buttons for IMP finish screen - CreateIMPFinishButtons( ); - + CreateIMPFinishButtons( ); + // set review mode fReviewStats = TRUE; iCurrentProfileMode = IMP__FINISH; @@ -100,14 +100,14 @@ void EnterIMPFinish( void ) void RenderIMPFinish( void ) { - // the background + // the background RenderProfileBackGround( ); - + // render merc fullname RenderCharFullName( ); // indent for text - RenderBeginIndent( 110, 50 ); + RenderBeginIndent( 110, 50 ); return; } @@ -116,7 +116,7 @@ void ExitIMPFinish( void ) { // remove buttons for IMP finish screen - DeleteIMPFinishButtons( ); + DeleteIMPFinishButtons( ); // get rid of graphic for portrait DestroyCharacterPortrait( ); @@ -127,9 +127,9 @@ void ExitIMPFinish( void ) void HandleIMPFinish( void ) { - - - return; + + + return; } @@ -138,103 +138,103 @@ void CreateIMPFinishButtons( void ) { CHAR16 sString[ 128 ]; - // this function will create the buttons needed for th IMP about us page - // the start over button button - giIMPFinishButtonImage[0]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); + // this function will create the buttons needed for th IMP about us page + // the start over button button + giIMPFinishButtonImage[0]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); /*giIMPFinishButton[0] = QuickCreateButton( giIMPFinishButtonImage[0], LAPTOP_SCREEN_UL_X + 136 , LAPTOP_SCREEN_WEB_UL_Y + ( 114 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishStartOverCallback); - */ - giIMPFinishButton[ 0 ] = CreateIconAndTextButton( giIMPFinishButtonImage[ 0 ], pImpButtonText[ 7 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + 136 , LAPTOP_SCREEN_WEB_UL_Y + ( 174 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishStartOverCallback); + */ + giIMPFinishButton[ 0 ] = CreateIconAndTextButton( giIMPFinishButtonImage[ 0 ], pImpButtonText[ 7 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + 136 , LAPTOP_SCREEN_WEB_UL_Y + ( 174 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishStartOverCallback); // the done button - giIMPFinishButtonImage[1]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); + giIMPFinishButtonImage[1]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); /* giIMPFinishButton[1] = QuickCreateButton( giIMPFinishButtonImage[1], LAPTOP_SCREEN_UL_X + 136 , LAPTOP_SCREEN_WEB_UL_Y + ( 174 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishDoneCallback); */ - giIMPFinishButton[ 1 ] = CreateIconAndTextButton( giIMPFinishButtonImage[ 1 ], pImpButtonText[ 6 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + 136 , LAPTOP_SCREEN_WEB_UL_Y + ( 114 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishDoneCallback); + giIMPFinishButton[ 1 ] = CreateIconAndTextButton( giIMPFinishButtonImage[ 1 ], pImpButtonText[ 6 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + 136 , LAPTOP_SCREEN_WEB_UL_Y + ( 114 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishDoneCallback); // the personality button - giIMPFinishButtonImage[2]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); + giIMPFinishButtonImage[2]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); /* giIMPFinishButton[2] = QuickCreateButton( giIMPFinishButtonImage[2], LAPTOP_SCREEN_UL_X + 13 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishPersonalityCallback); - -*/ giIMPFinishButton[ 2 ] = CreateIconAndTextButton( giIMPFinishButtonImage[ 2 ], pImpButtonText[ 2 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - MAIN_PAGE__THIRD_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishPersonalityCallback); - - SpecifyButtonIcon( giIMPFinishButton[2] , guiANALYSE, 0, 33, 23, FALSE ); + +*/ giIMPFinishButton[ 2 ] = CreateIconAndTextButton( giIMPFinishButtonImage[ 2 ], pImpButtonText[ 2 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MAIN_PAGE__THIRD_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishPersonalityCallback); + + SpecifyButtonIcon( giIMPFinishButton[2] , guiANALYSE, 0, 33, 23, FALSE ); // the attribs button - giIMPFinishButtonImage[3]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); + giIMPFinishButtonImage[3]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); /* giIMPFinishButton[3] = QuickCreateButton( giIMPFinishButtonImage[3], LAPTOP_SCREEN_UL_X + 133 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishAttributesCallback); */ - giIMPFinishButton[ 3 ] = CreateIconAndTextButton( giIMPFinishButtonImage[ 3 ], pImpButtonText[ 3 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - MAIN_PAGE__FOURTH_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishAttributesCallback); + giIMPFinishButton[ 3 ] = CreateIconAndTextButton( giIMPFinishButtonImage[ 3 ], pImpButtonText[ 3 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MAIN_PAGE__FOURTH_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishAttributesCallback); - SpecifyButtonIcon( giIMPFinishButton[ 3 ], guiATTRIBUTEGRAPH, 0, - 25, 25, FALSE ); + SpecifyButtonIcon( giIMPFinishButton[ 3 ], guiATTRIBUTEGRAPH, 0, + 25, 25, FALSE ); - // the portrait button - giIMPFinishButtonImage[4]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); + // the portrait button + giIMPFinishButtonImage[4]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); /* giIMPFinishButton[4] = QuickCreateButton( giIMPFinishButtonImage[4], LAPTOP_SCREEN_UL_X + 253 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishPortraitCallback); */ - giIMPFinishButton[ 4 ] = CreateIconAndTextButton( giIMPFinishButtonImage[ 4 ], pImpButtonText[ 4 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - MAIN_PAGE__FIRST_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPagePortraitCallback); + giIMPFinishButton[ 4 ] = CreateIconAndTextButton( giIMPFinishButtonImage[ 4 ], pImpButtonText[ 4 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MAIN_PAGE__FIRST_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPagePortraitCallback); - SpecifyButtonIcon( giIMPFinishButton[ 4 ], guiCHARACTERPORTRAIT, 0, - 33, 23, FALSE ); + SpecifyButtonIcon( giIMPFinishButton[ 4 ], guiCHARACTERPORTRAIT, 0, + 33, 23, FALSE ); swprintf( sString, pImpButtonText[ 5 ], GetVoiceCountFromVoiceSlot(iCurrentVoice)); // the voice button - giIMPFinishButtonImage[5]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); + giIMPFinishButtonImage[5]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); /* giIMPFinishButton[5] = QuickCreateButton( giIMPFinishButtonImage[5], LAPTOP_SCREEN_UL_X + 373 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishVoiceCallback); - */ - giIMPFinishButton[ 5 ] = CreateIconAndTextButton( giIMPFinishButtonImage[ 5 ], sString, FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - MAIN_PAGE__SECOND_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageVoiceCallback); - - SpecifyButtonIcon( giIMPFinishButton[ 5 ], guiSMALLSILHOUETTE, 0, - 33, 23, FALSE ); + */ + giIMPFinishButton[ 5 ] = CreateIconAndTextButton( giIMPFinishButtonImage[ 5 ], sString, FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MAIN_PAGE__SECOND_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageVoiceCallback); + + SpecifyButtonIcon( giIMPFinishButton[ 5 ], guiSMALLSILHOUETTE, 0, + 33, 23, FALSE ); - SetButtonCursor(giIMPFinishButton[0], CURSOR_WWW); + SetButtonCursor(giIMPFinishButton[0], CURSOR_WWW); SetButtonCursor(giIMPFinishButton[1], CURSOR_WWW); SetButtonCursor(giIMPFinishButton[2], CURSOR_WWW); SetButtonCursor(giIMPFinishButton[3], CURSOR_WWW); @@ -251,31 +251,31 @@ void CreateIMPFinishButtons( void ) void DeleteIMPFinishButtons( void ) { - // this function destroys the buttons needed for the IMP about Us Page + // this function destroys the buttons needed for the IMP about Us Page + + // the back button + RemoveButton(giIMPFinishButton[0] ); + UnloadButtonImage(giIMPFinishButtonImage[0] ); - // the back button - RemoveButton(giIMPFinishButton[0] ); - UnloadButtonImage(giIMPFinishButtonImage[0] ); - // begin profiling button RemoveButton(giIMPFinishButton[1] ); - UnloadButtonImage(giIMPFinishButtonImage[1] ); + UnloadButtonImage(giIMPFinishButtonImage[1] ); // begin personna button RemoveButton(giIMPFinishButton[2] ); - UnloadButtonImage(giIMPFinishButtonImage[2] ); - + UnloadButtonImage(giIMPFinishButtonImage[2] ); + // begin attribs button RemoveButton(giIMPFinishButton[3] ); - UnloadButtonImage(giIMPFinishButtonImage[3] ); - + UnloadButtonImage(giIMPFinishButtonImage[3] ); + // begin portrait button RemoveButton(giIMPFinishButton[4] ); - UnloadButtonImage(giIMPFinishButtonImage[4] ); + UnloadButtonImage(giIMPFinishButtonImage[4] ); // begin voice button RemoveButton(giIMPFinishButton[5] ); - UnloadButtonImage(giIMPFinishButtonImage[5] ); + UnloadButtonImage(giIMPFinishButtonImage[5] ); return; @@ -291,18 +291,18 @@ void BtnIMPFinishStartOverCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 1 ], LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, FinishMessageBoxCallBack); - + } - } -} + } +} void BtnIMPFinishDoneCallback(GUI_BUTTON *btn,INT32 reason) { @@ -311,77 +311,77 @@ void BtnIMPFinishDoneCallback(GUI_BUTTON *btn,INT32 reason) if (!(btn->uiFlags & BUTTON_ENABLED)) return; - + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - iCurrentImpPage = IMP_CONFIRM; + btn->uiFlags&=~(BUTTON_CLICKED_ON); + iCurrentImpPage = IMP_CONFIRM; CreateACharacterFromPlayerEnteredStats( ); fButtonPendingFlag = TRUE; - iCurrentProfileMode = IMP__REGISTRY; + iCurrentProfileMode = IMP__REGISTRY; fFinishedCharGeneration = FALSE; //ResetCharacterStats( ); } - } -} + } +} void BtnIMPFinishPersonalityCallback(GUI_BUTTON *btn,INT32 reason) { // btn callback for Main Page Begin Profiling - static BOOLEAN fAnimateFlag = FALSE; + static BOOLEAN fAnimateFlag = FALSE; static UINT32 uiBaseTime = 0; static BOOLEAN fState = 0; - INT32 iDifference = 0; - + INT32 iDifference = 0; + if (!(btn->uiFlags & BUTTON_ENABLED)) return; if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); - uiBaseTime = GetJA2Clock(); - SpecifyButtonText( giIMPFinishButton[2], pImpButtonText[ 23 ] ); - fAnimateFlag = TRUE; + btn->uiFlags|=(BUTTON_CLICKED_ON); + uiBaseTime = GetJA2Clock(); + SpecifyButtonText( giIMPFinishButton[2], pImpButtonText[ 23 ] ); + fAnimateFlag = TRUE; } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); fButtonPendingFlag = TRUE; uiBaseTime = 0; - fAnimateFlag = FALSE; - iCurrentImpPage = IMP_PERSONALITY_QUIZ; + fAnimateFlag = FALSE; + iCurrentImpPage = IMP_PERSONALITY_QUIZ; SpecifyButtonText( giIMPFinishButton[2], pImpButtonText[ 2 ] ); } } - + // get amount of time between callbacks - iDifference = GetJA2Clock() - uiBaseTime; - + iDifference = GetJA2Clock() - uiBaseTime; + if( fAnimateFlag ) { - if( iDifference > ANIMATE_MIN_TIME ) + if( iDifference > ANIMATE_MIN_TIME ) { - + uiBaseTime = GetJA2Clock(); if( fState ) { - SpecifyButtonIcon( giIMPFinishButton[2] , guiANALYSE, 1, 33, 23, FALSE ); + SpecifyButtonIcon( giIMPFinishButton[2] , guiANALYSE, 1, 33, 23, FALSE ); fState = FALSE; } else { - SpecifyButtonIcon( giIMPFinishButton[2] , guiANALYSE, 0, 33, 23, FALSE ); + SpecifyButtonIcon( giIMPFinishButton[2] , guiANALYSE, 0, 33, 23, FALSE ); fState = TRUE; } @@ -390,7 +390,7 @@ void BtnIMPFinishPersonalityCallback(GUI_BUTTON *btn,INT32 reason) } -} +} void BtnIMPFinishAttributesCallback(GUI_BUTTON *btn,INT32 reason) { @@ -399,7 +399,7 @@ void BtnIMPFinishAttributesCallback(GUI_BUTTON *btn,INT32 reason) if (!(btn->uiFlags & BUTTON_ENABLED)) return; - // if not this far in char generation, don't alot ANY action + // if not this far in char generation, don't alot ANY action if( iCurrentProfileMode < IMP__ATTRIBUTES ) { btn->uiFlags&=~(BUTTON_CLICKED_ON); @@ -409,19 +409,19 @@ void BtnIMPFinishAttributesCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - iCurrentImpPage = IMP_ATTRIBUTE_PAGE; + btn->uiFlags&=~(BUTTON_CLICKED_ON); + iCurrentImpPage = IMP_ATTRIBUTE_PAGE; fButtonPendingFlag = TRUE; SpecifyButtonText( giIMPFinishButton[2], pImpButtonText[ 2 ] ); } - } -} + } +} void BtnIMPFinishPortraitCallback(GUI_BUTTON *btn,INT32 reason) { @@ -430,31 +430,31 @@ void BtnIMPFinishPortraitCallback(GUI_BUTTON *btn,INT32 reason) if (!(btn->uiFlags & BUTTON_ENABLED)) return; - // if not this far in char generation, don't alot ANY action + // if not this far in char generation, don't alot ANY action if( iCurrentProfileMode < IMP__PORTRAIT ) { btn->uiFlags&=~(BUTTON_CLICKED_ON); - + return; } if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); - sFaceX = 253; - sFaceY = 247; + btn->uiFlags|=(BUTTON_CLICKED_ON); + sFaceX = 253; + sFaceY = 247; } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - sFaceX = 253; + btn->uiFlags&=~(BUTTON_CLICKED_ON); + sFaceX = 253; sFaceY = 245; } - } -} + } +} void BtnIMPFinishVoiceCallback(GUI_BUTTON *btn,INT32 reason) @@ -464,7 +464,7 @@ void BtnIMPFinishVoiceCallback(GUI_BUTTON *btn,INT32 reason) if (!(btn->uiFlags & BUTTON_ENABLED)) return; - // if not this far in char generation, don't alot ANY action + // if not this far in char generation, don't alot ANY action if( iCurrentProfileMode < IMP__PORTRAIT ) { btn->uiFlags&=~(BUTTON_CLICKED_ON); @@ -475,154 +475,154 @@ void BtnIMPFinishVoiceCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); - + btn->uiFlags|=(BUTTON_CLICKED_ON); + } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - // play voice + // play voice if( ! SoundIsPlaying( uiVoiceSound ) ) { - uiVoiceSound = PlayVoice( ); - } + uiVoiceSound = PlayVoice( ); + } btn->uiFlags&=~(BUTTON_CLICKED_ON); fButtonPendingFlag = TRUE; } - } -} + } +} /* WDS - Unused? BOOLEAN RenderCharProfileFinishFace( void ) { // render the portrait of the current picture - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; HVOBJECT hHandle; UINT32 uiGraphicHandle; - if( fCharacterIsMale == TRUE ) + if( fCharacterIsMale == TRUE ) { - switch( LaptopSaveInfo.iCurrentVoice ) + switch( LaptopSaveInfo.iCurrentVoice ) { - case( 0 ): - // first portrait + case( 0 ): + // first portrait - // load it - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("Faces\\SmallFaces\\00.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); - - // show it - GetVideoObject(&hHandle, uiGraphicHandle); - BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sFaceX, LAPTOP_SCREEN_WEB_UL_Y + sFaceY , VO_BLT_SRCTRANSPARENCY,NULL); + // load it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("Faces\\SmallFaces\\00.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); + + // show it + GetVideoObject(&hHandle, uiGraphicHandle); + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sFaceX, LAPTOP_SCREEN_WEB_UL_Y + sFaceY , VO_BLT_SRCTRANSPARENCY,NULL); - // and kick it's sorry ..umm never mind, outta here - DeleteVideoObjectFromIndex( uiGraphicHandle ); + // and kick it's sorry ..umm never mind, outta here + DeleteVideoObjectFromIndex( uiGraphicHandle ); - break; - case( 1 ): - // first portrait + break; + case( 1 ): + // first portrait - // load it - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("Faces\\SmallFaces\\01.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); - - // show it - GetVideoObject(&hHandle, uiGraphicHandle); - BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sFaceX, LAPTOP_SCREEN_WEB_UL_Y + sFaceY , VO_BLT_SRCTRANSPARENCY,NULL); + // load it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("Faces\\SmallFaces\\01.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); + + // show it + GetVideoObject(&hHandle, uiGraphicHandle); + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sFaceX, LAPTOP_SCREEN_WEB_UL_Y + sFaceY , VO_BLT_SRCTRANSPARENCY,NULL); - // and kick it's sorry ..umm never mind, outta here - DeleteVideoObjectFromIndex( uiGraphicHandle ); + // and kick it's sorry ..umm never mind, outta here + DeleteVideoObjectFromIndex( uiGraphicHandle ); - break; - case( 2 ): - // first portrait + break; + case( 2 ): + // first portrait - // load it - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("Faces\\SmallFaces\\02.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); - - // show it - GetVideoObject(&hHandle, uiGraphicHandle); - BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sFaceX, LAPTOP_SCREEN_WEB_UL_Y + sFaceY , VO_BLT_SRCTRANSPARENCY,NULL); + // load it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("Faces\\SmallFaces\\02.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); + + // show it + GetVideoObject(&hHandle, uiGraphicHandle); + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sFaceX, LAPTOP_SCREEN_WEB_UL_Y + sFaceY , VO_BLT_SRCTRANSPARENCY,NULL); - // and kick it's sorry ..umm never mind, outta here - DeleteVideoObjectFromIndex( uiGraphicHandle ); - + // and kick it's sorry ..umm never mind, outta here + DeleteVideoObjectFromIndex( uiGraphicHandle ); - break; + + break; } - + } else { - switch( LaptopSaveInfo.iCurrentVoice ) + switch( LaptopSaveInfo.iCurrentVoice ) { - case( 0 ): - // first portrait + case( 0 ): + // first portrait - // load it - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("Faces\\SmallFaces\\03.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); - - // show it - GetVideoObject(&hHandle, uiGraphicHandle); - BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sFaceX, LAPTOP_SCREEN_WEB_UL_Y + sFaceY , VO_BLT_SRCTRANSPARENCY,NULL); + // load it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("Faces\\SmallFaces\\03.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); + + // show it + GetVideoObject(&hHandle, uiGraphicHandle); + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sFaceX, LAPTOP_SCREEN_WEB_UL_Y + sFaceY , VO_BLT_SRCTRANSPARENCY,NULL); - // and kick it's sorry ..umm never mind, outta here - DeleteVideoObjectFromIndex( uiGraphicHandle ); + // and kick it's sorry ..umm never mind, outta here + DeleteVideoObjectFromIndex( uiGraphicHandle ); - break; - case( 1 ): - // first portrait + break; + case( 1 ): + // first portrait - // load it - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("Faces\\SmallFaces\\04.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); - - // show it - GetVideoObject(&hHandle, uiGraphicHandle); - BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sFaceX, LAPTOP_SCREEN_WEB_UL_Y + sFaceY , VO_BLT_SRCTRANSPARENCY,NULL); + // load it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("Faces\\SmallFaces\\04.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); + + // show it + GetVideoObject(&hHandle, uiGraphicHandle); + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sFaceX, LAPTOP_SCREEN_WEB_UL_Y + sFaceY , VO_BLT_SRCTRANSPARENCY,NULL); - // and kick it's sorry ..umm never mind, outta here - DeleteVideoObjectFromIndex( uiGraphicHandle ); + // and kick it's sorry ..umm never mind, outta here + DeleteVideoObjectFromIndex( uiGraphicHandle ); - break; - case( 2 ): - // first portrait + break; + case( 2 ): + // first portrait - // load it - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("Faces\\SmallFaces\\05.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); - - // show it - GetVideoObject(&hHandle, uiGraphicHandle); - BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sFaceX, LAPTOP_SCREEN_WEB_UL_Y + sFaceY , VO_BLT_SRCTRANSPARENCY,NULL); + // load it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("Faces\\SmallFaces\\05.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); + + // show it + GetVideoObject(&hHandle, uiGraphicHandle); + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sFaceX, LAPTOP_SCREEN_WEB_UL_Y + sFaceY , VO_BLT_SRCTRANSPARENCY,NULL); - // and kick it's sorry ..umm never mind, outta here - DeleteVideoObjectFromIndex( uiGraphicHandle ); + // and kick it's sorry ..umm never mind, outta here + DeleteVideoObjectFromIndex( uiGraphicHandle ); - break; + break; } } - // render the nickname - SetFontForeground( FONT_WHITE ); + // render the nickname + SetFontForeground( FONT_WHITE ); SetFontBackground( FONT_BLACK ); - SetFont( FONT12ARIAL ); + SetFont( FONT12ARIAL ); mprintf( 253, 350, pNickName ); @@ -637,29 +637,29 @@ void RenderCharFullName( void ) INT16 sX, sY; // render the characters full name - SetFont( FONT14ARIAL ); + SetFont( FONT14ARIAL ); SetFontForeground( FONT_WHITE ); SetFontBackground( FONT_BLACK ); swprintf( sString, pIMPFinishStrings[ 0 ], pFullName ); - FindFontCenterCoordinates(LAPTOP_SCREEN_UL_X - 111, 0, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 0 , sString , FONT14ARIAL, &sX, &sY); - mprintf( sX, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y + 33, sString ); + FindFontCenterCoordinates(LAPTOP_SCREEN_UL_X - 111, 0, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 0 , sString , FONT14ARIAL, &sX, &sY); + mprintf( sX, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y + 33, sString ); return; } BOOLEAN LoadCharacterPortrait( void ) { - // this function will load the character's portrait, to be used on portrait button - VOBJECT_DESC VObjectDesc; + // this function will load the character's portrait, to be used on portrait button + VOBJECT_DESC VObjectDesc; // load it - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP( pPlayerSelectedFaceFileNames[ iPortraitNumber ] , VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiCHARACTERPORTRAIT)); - + return( TRUE ); } @@ -677,7 +677,7 @@ void DestroyCharacterPortrait( void ) void FinishMessageBoxCallBack( UINT8 bExitValue ) { // yes, so start over, else stay here and do nothing for now - if( bExitValue == MSG_BOX_RETURN_YES ) + if( bExitValue == MSG_BOX_RETURN_YES ) { iCurrentImpPage = IMP_HOME_PAGE; fButtonPendingFlag = TRUE; diff --git a/Laptop/IMP HomePage.cpp b/Laptop/IMP HomePage.cpp index 8222eb85..80c8391b 100644 --- a/Laptop/IMP HomePage.cpp +++ b/Laptop/IMP HomePage.cpp @@ -80,59 +80,59 @@ BOOLEAN fNewCharInActivationString = FALSE; void EnterImpHomePage( void ) { - // upon entry to Imp home page - memset(pPlayerActivationString, 0, sizeof(pPlayerActivationString)); - - // reset string position - iStringPos =0; + // upon entry to Imp home page + memset(pPlayerActivationString, 0, sizeof(pPlayerActivationString)); - // reset activation cursor position - uiCursorPosition = IMP_PLAYER_ACTIVATION_STRING_X; + // reset string position + iStringPos =0; - // load buttons - CreateIMPHomePageButtons( ); + // reset activation cursor position + uiCursorPosition = IMP_PLAYER_ACTIVATION_STRING_X; - // we have now vsisited IMP, reset fact we haven't - fNotVistedImpYet = FALSE; - - // render screen once - RenderImpHomePage( ); - return; + // load buttons + CreateIMPHomePageButtons( ); + + // we have now vsisited IMP, reset fact we haven't + fNotVistedImpYet = FALSE; + + // render screen once + RenderImpHomePage( ); + return; } void RenderImpHomePage( void ) { - // the background + // the background RenderProfileBackGround( ); - + // the IMP symbol RenderIMPSymbol( 107, 45 ); - - // the second button image + + // the second button image RenderButton2Image( 134, 314); // render the indents - + //activation indents RenderActivationIndent( 257, 328 ); // the two font page indents RenderFrontPageIndent( 3, 64 ); - RenderFrontPageIndent( 396,64 ); + RenderFrontPageIndent( 396,64 ); - - // render the activation string + + // render the activation string DisplayPlayerActivationString( ); - + return; } void ExitImpHomePage( void ) { - + // remove buttons - RemoveIMPHomePageButtons( ); + RemoveIMPHomePageButtons( ); return; } @@ -142,26 +142,25 @@ void HandleImpHomePage( void ) { // handle keyboard input for this screen - GetPlayerKeyBoardInputForIMPHomePage( ); + GetPlayerKeyBoardInputForIMPHomePage( ); // has a new char been added to activation string - if( fNewCharInActivationString ) + if( fNewCharInActivationString ) { - // display string - DisplayPlayerActivationString( ); + // display string + DisplayPlayerActivationString( ); } // render the cursor DisplayActivationStringCursor( ); - return; + return; } void DisplayPlayerActivationString( void ) { // this function will grab the string that the player will enter for activation - INT32 iCounter=0; // player gone too far, move back if(iStringPos > 64) @@ -172,19 +171,19 @@ void DisplayPlayerActivationString( void ) // restore background RenderActivationIndent( 257, 328 ); - // setup the font stuff + // setup the font stuff SetFont( FONT14ARIAL ); - SetFontForeground( 184 ); + SetFontForeground( 184 ); SetFontBackground(FONT_BLACK); - // reset shadow - SetFontShadow(DEFAULT_SHADOW); - mprintf(IMP_PLAYER_ACTIVATION_STRING_X, IMP_PLAYER_ACTIVATION_STRING_Y, pPlayerActivationString); - - + // reset shadow + SetFontShadow(DEFAULT_SHADOW); + mprintf(IMP_PLAYER_ACTIVATION_STRING_X, IMP_PLAYER_ACTIVATION_STRING_Y, pPlayerActivationString); + + fNewCharInActivationString = FALSE; - fReDrawScreenFlag = TRUE; + fReDrawScreenFlag = TRUE; return; } @@ -192,27 +191,27 @@ void DisplayPlayerActivationString( void ) void DisplayActivationStringCursor( void ) { // this procdure will draw the activation string cursor on the screen at position cursorx cursory - UINT32 uiDestPitchBYTES; + UINT32 uiDestPitchBYTES; static UINT32 uiBaseTime = 0; UINT32 uiDeltaTime = 0; UINT8 *pDestBuf; - static UINT32 iCurrentState = 0; - static BOOLEAN fIncrement = TRUE; + static UINT32 iCurrentState = 0; + static BOOLEAN fIncrement = TRUE; if(uiBaseTime == 0) { uiBaseTime = GetJA2Clock(); } - + // get difference uiDeltaTime = GetJA2Clock() - uiBaseTime; // if difference is long enough, rotate colors if(uiDeltaTime > MIN_GLOW_DELTA) - { + { if( iCurrentState == 10) { - // start rotating downward + // start rotating downward fIncrement = FALSE; } if( iCurrentState == 0) @@ -221,7 +220,7 @@ void DisplayActivationStringCursor( void ) fIncrement = TRUE; } // if increment upward, increment iCurrentState - if(fIncrement) + if(fIncrement) { iCurrentState++; } @@ -230,24 +229,24 @@ void DisplayActivationStringCursor( void ) // else downwards iCurrentState--; } - // reset basetime to current clock + // reset basetime to current clock uiBaseTime = GetJA2Clock( ); } - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); - // draw line in current state - LineDraw(TRUE, (UINT16) uiCursorPosition, CURSOR_Y, (UINT16)uiCursorPosition, CURSOR_Y + CURSOR_HEIGHT, Get16BPPColor( FROMRGB( GlowColorsList[ iCurrentState ][ 0 ], GlowColorsList[ iCurrentState ][ 1 ], GlowColorsList[ iCurrentState ][ 2 ] ) ), - pDestBuf ); - + // draw line in current state + LineDraw(TRUE, (UINT16) uiCursorPosition, CURSOR_Y, (UINT16)uiCursorPosition, CURSOR_Y + CURSOR_HEIGHT, Get16BPPColor( FROMRGB( GlowColorsList[ iCurrentState ][ 0 ], GlowColorsList[ iCurrentState ][ 1 ], GlowColorsList[ iCurrentState ][ 2 ] ) ), + pDestBuf ); + // unlock frame buffer UnLockVideoSurface( FRAME_BUFFER ); - InvalidateRegion((UINT16) uiCursorPosition , CURSOR_Y , (UINT16)uiCursorPosition + 1, CURSOR_Y + CURSOR_HEIGHT + 1); - - + InvalidateRegion((UINT16) uiCursorPosition , CURSOR_Y , (UINT16)uiCursorPosition + 1, CURSOR_Y + CURSOR_HEIGHT + 1); + + return; } @@ -256,17 +255,17 @@ void DisplayActivationStringCursor( void ) void GetPlayerKeyBoardInputForIMPHomePage( void ) { InputAtom InputEvent; - POINT MousePos; + POINT MousePos; GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! + ScreenToClient(ghWindow, &MousePos); // In window coords! - while (DequeueEvent(&InputEvent) == TRUE) - { + while (DequeueEvent(&InputEvent) == TRUE) + { // HOOK INTO MOUSE HOOKS /* switch(InputEvent.usEvent) - { + { case LEFT_BUTTON_DOWN: MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; @@ -276,26 +275,26 @@ void GetPlayerKeyBoardInputForIMPHomePage( void ) case RIGHT_BUTTON_DOWN: MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - case RIGHT_BUTTON_UP: + case RIGHT_BUTTON_UP: MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - } + } */ if( !HandleTextInput( &InputEvent ) && (InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT || InputEvent.usEvent == KEY_UP ) ) { - switch( InputEvent.usParam ) + switch( InputEvent.usParam ) { - case (( ENTER ) ): + case (( ENTER ) ): if(( InputEvent.usEvent == KEY_UP ) ) { - // return hit, check to see if current player activation string is a valid one + // return hit, check to see if current player activation string is a valid one ProcessPlayerInputActivationString( ); - - fNewCharInActivationString = TRUE; + + fNewCharInActivationString = TRUE; } break; case (( ESC )): - LeaveLapTopScreen( ); + LeaveLapTopScreen( ); break; default: if(InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT ) @@ -313,12 +312,12 @@ void GetPlayerKeyBoardInputForIMPHomePage( void ) void HandleTextEvent( UINT32 uiKey ) { - // this function checks to see if a letter or a backspace was pressed, if so, either put char to screen - // or delete it - switch( uiKey ) + // this function checks to see if a letter or a backspace was pressed, if so, either put char to screen + // or delete it + switch( uiKey ) { - case ( BACKSPACE ): - + case ( BACKSPACE ): + if( iStringPos >= 0 ) { @@ -327,31 +326,31 @@ void HandleTextEvent( UINT32 uiKey ) // decrement iStringPosition iStringPos-=1; } - + // null out char - pPlayerActivationString[iStringPos ] = 0; - + pPlayerActivationString[iStringPos ] = 0; + // move back cursor - uiCursorPosition = StringPixLength( pPlayerActivationString, FONT14ARIAL ) + IMP_PLAYER_ACTIVATION_STRING_X; - - + uiCursorPosition = StringPixLength( pPlayerActivationString, FONT14ARIAL ) + IMP_PLAYER_ACTIVATION_STRING_X; + + // string has been altered, redisplay - fNewCharInActivationString = TRUE; - - } + fNewCharInActivationString = TRUE; + + } break; - default: - if( uiKey >= 'A' && uiKey <= 'Z' || + default: + if( uiKey >= 'A' && uiKey <= 'Z' || uiKey >= 'a' && uiKey <= 'z' || uiKey >= '0' && uiKey <= '9' || uiKey == '_' || uiKey == '.' || uiKey ==' ') - { + { // if the current string position is at max or great, do nothing - if( iStringPos >= 8 ) - { + if( iStringPos >= 8 ) + { break; } else @@ -360,27 +359,27 @@ void HandleTextEvent( UINT32 uiKey ) { iStringPos = 0; } - // valid char, capture and convert to CHAR16 - pPlayerActivationString[iStringPos] = ( CHAR16 )uiKey; - + // valid char, capture and convert to CHAR16 + pPlayerActivationString[iStringPos] = ( CHAR16 )uiKey; + // null out next char position pPlayerActivationString[iStringPos + 1] = 0; - + // move cursor position ahead - uiCursorPosition = StringPixLength( pPlayerActivationString, FONT14ARIAL ) + IMP_PLAYER_ACTIVATION_STRING_X; - + uiCursorPosition = StringPixLength( pPlayerActivationString, FONT14ARIAL ) + IMP_PLAYER_ACTIVATION_STRING_X; + // increment string position iStringPos +=1; - - // string has been altered, redisplay - fNewCharInActivationString = TRUE; + + // string has been altered, redisplay + fNewCharInActivationString = TRUE; } } break; - + } @@ -390,14 +389,14 @@ void HandleTextEvent( UINT32 uiKey ) void ProcessPlayerInputActivationString( void ) { - // prcess string to see if it matches activation string + // prcess string to see if it matches activation string char charPlayerActivationString[32]; wcstombs(charPlayerActivationString,pPlayerActivationString,32); BOOLEAN freeMercSlot = TRUE; // WANNE: Check total number of hired mercs - if( NumberOfMercsOnPlayerTeam() >= 18 ) + if( NumberOfMercsOnPlayerTeam() >= 18 ) { freeMercSlot = FALSE; } @@ -406,7 +405,7 @@ void ProcessPlayerInputActivationString( void ) if( ( ( wcscmp(pPlayerActivationString, L"XEP624") == 0 ) || ( wcscmp(pPlayerActivationString, L"xep624") == 0 ) ) &&( LaptopSaveInfo.gfNewGameLaptop < 2 ) ) { // WANNE: Check total number of hired mercs - if( freeMercSlot == FALSE ) + if( freeMercSlot == FALSE ) { DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, AimPopUpText[ AIM_MEMBER_ALREADY_HAVE_18_MERCS ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); return; @@ -428,7 +427,7 @@ void ProcessPlayerInputActivationString( void ) else if( wcscmp(pPlayerActivationString, L"90210") == 0 ) { // WANNE: Check total number of hired mercs - if( freeMercSlot == FALSE ) + if( freeMercSlot == FALSE ) { DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, AimPopUpText[ AIM_MEMBER_ALREADY_HAVE_18_MERCS ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); return; @@ -454,7 +453,7 @@ void ProcessPlayerInputActivationString( void ) else if ( ImpExists( charPlayerActivationString ) ) { // WANNE: Check total number of hired mercs - if( freeMercSlot == FALSE ) + if( freeMercSlot == FALSE ) { DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, AimPopUpText[ AIM_MEMBER_ALREADY_HAVE_18_MERCS ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); return; @@ -466,7 +465,7 @@ void ProcessPlayerInputActivationString( void ) { // Reset activation text box ResetActivationStringTextBox(); - + //DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 11 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); AddEmail(IMP_EMAIL_PROFILE_RESULTS, IMP_EMAIL_PROFILE_RESULTS_LENGTH, IMP_PROFILE_RESULTS, GetWorldTotalMin( ), LaptopSaveInfo.iIMPIndex ); } @@ -500,7 +499,7 @@ void ResetActivationStringTextBox(void) } iStringPos = 0; - + uiCursorPosition = StringPixLength( pPlayerActivationString, FONT14ARIAL ) + IMP_PLAYER_ACTIVATION_STRING_X; DisplayPlayerActivationString(); DisplayActivationStringCursor(); @@ -508,25 +507,25 @@ void ResetActivationStringTextBox(void) void CreateIMPHomePageButtons( void ) { - // this procedure will create the buttons needed for the IMP homepage + // this procedure will create the buttons needed for the IMP homepage // ths about us button - giIMPHomePageButtonImage[0]= LoadButtonImage( "LAPTOP\\button_1.sti" ,-1,0,-1,1,-1 ); - /* giIMPHomePageButton[0] = QuickCreateButton( giIMPHomePageButtonImage[0], LAPTOP_SCREEN_UL_X + ( 286 - 106 ), LAPTOP_SCREEN_WEB_UL_Y + ( 248 - 48 ), + giIMPHomePageButtonImage[0]= LoadButtonImage( "LAPTOP\\button_1.sti" ,-1,0,-1,1,-1 ); + /* giIMPHomePageButton[0] = QuickCreateButton( giIMPHomePageButtonImage[0], LAPTOP_SCREEN_UL_X + ( 286 - 106 ), LAPTOP_SCREEN_WEB_UL_Y + ( 248 - 48 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAboutUsCallback); - */ - - giIMPHomePageButton[0] = CreateIconAndTextButton( giIMPHomePageButtonImage[0], pImpButtonText[ 0 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( 286 - 106 ), LAPTOP_SCREEN_WEB_UL_Y + ( 248 - 48), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAboutUsCallback); + */ + + giIMPHomePageButton[0] = CreateIconAndTextButton( giIMPHomePageButtonImage[0], pImpButtonText[ 0 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 286 - 106 ), LAPTOP_SCREEN_WEB_UL_Y + ( 248 - 48), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAboutUsCallback); SetButtonCursor(giIMPHomePageButton[ 0 ], CURSOR_WWW); - + return; } @@ -535,12 +534,12 @@ void CreateIMPHomePageButtons( void ) void RemoveIMPHomePageButtons( void ) { - // this procedure will destroy the already created buttosn for the IMP homepage + // this procedure will destroy the already created buttosn for the IMP homepage + + // the about us button + RemoveButton(giIMPHomePageButton[0] ); + UnloadButtonImage(giIMPHomePageButtonImage[0] ); - // the about us button - RemoveButton(giIMPHomePageButton[0] ); - UnloadButtonImage(giIMPHomePageButtonImage[0] ); - return; } @@ -555,15 +554,15 @@ void BtnIMPAboutUsCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - iCurrentImpPage = IMP_ABOUT_US; + btn->uiFlags&=~(BUTTON_CLICKED_ON); + iCurrentImpPage = IMP_ABOUT_US; fButtonPendingFlag = TRUE; } - } -} + } +} diff --git a/Laptop/IMP MainPage.cpp b/Laptop/IMP MainPage.cpp index 1be324ac..50967210 100644 --- a/Laptop/IMP MainPage.cpp +++ b/Laptop/IMP MainPage.cpp @@ -75,7 +75,7 @@ BOOLEAN CheckIfFinishedCharacterGeneration( void ); // this is the current state of profiling the player is in. /* - 0 - Beginning + 0 - Beginning 1 - Personnality 2 - Attributes and Skills 3 - Portrait @@ -88,7 +88,7 @@ INT32 iCurrentProfileMode = IMP__REGISTRY; extern INT32 iCurrentVoice; // Return a count of how many IMP slots there are in total -INT32 CountIMPSlots() +INT32 CountIMPSlots() { INT32 idx; // Keep a static count so we only count once @@ -176,7 +176,7 @@ INT32 GetLastMaleSlot() { idx = 0; // Skip the males - while (gGameExternalOptions.iaIMPSlots[idx] != -1) + while (gGameExternalOptions.iaIMPSlots[idx] != -1) { ++idx; } @@ -211,7 +211,7 @@ INT32 GetFirstFemaleSlot() { idx = 0; // Skip the males - while (gGameExternalOptions.iaIMPSlots[idx] != -1) + while (gGameExternalOptions.iaIMPSlots[idx] != -1) { ++idx; } @@ -228,13 +228,13 @@ INT32 GetLastFemaleSlot() { idx = 0; // Skip the males - while (gGameExternalOptions.iaIMPSlots[idx] != -1) + while (gGameExternalOptions.iaIMPSlots[idx] != -1) { ++idx; } ++idx; // Skip the females - while (gGameExternalOptions.iaIMPSlots[idx] != -1) + while (gGameExternalOptions.iaIMPSlots[idx] != -1) { ++idx; } @@ -256,7 +256,7 @@ BOOLEAN IsIMPSlotFree(INT32 iIMPId) { if ((iIMPId >= 0) && (iIMPId < NUM_PROFILES) && ((wcscmp(gMercProfiles[iIMPId].zName, L"") == 0) || - (gMercProfiles[iIMPId].bMercStatus == MERC_IS_DEAD))) + (gMercProfiles[iIMPId].bMercStatus == MERC_IS_DEAD))) { return TRUE; } @@ -269,12 +269,12 @@ BOOLEAN IsIMPSlotFree(INT32 iIMPId) void EnterIMPMainPage( void ) { - + // turn off review mode fReviewStats = FALSE; - - // create buttons + + // create buttons CreateIMPMainPageButtons( ); // load portrait for face button, if applicable @@ -286,19 +286,19 @@ void EnterIMPMainPage( void ) // alter states UpDateIMPMainPageButtons( ); - // entry into IMP about us page + // entry into IMP about us page RenderIMPMainPage( ); - + return; } void ExitIMPMainPage( void ) { - // exit from IMP About us page - + // exit from IMP About us page + // delete Buttons - DeleteIMPMainPageButtons( ); + DeleteIMPMainPageButtons( ); DestoryMouseRegionsForIMPMainPageBasedOnCharGenStatus( ); return; @@ -307,27 +307,27 @@ void ExitIMPMainPage( void ) void RenderIMPMainPage( void ) { - // rneders the IMP about us page - + // rneders the IMP about us page + // the background RenderProfileBackGround( ); - + // the IMP symbol //RenderIMPSymbol( 106, 1 ); - // indent + // indent RenderMainIndentFrame( 164, 74 ); - + return; } void HandleIMPMainPage( void ) { - // handles the IMP about main page + // handles the IMP about main page if ( CheckIfFinishedCharacterGeneration( ) ) { - iCurrentImpPage = IMP_FINISH; + iCurrentImpPage = IMP_FINISH; } // shade out buttons that should be shaded/unselectable //ShadeUnSelectableButtons( ); @@ -339,34 +339,32 @@ void HandleIMPMainPage( void ) // void CreateIMPMainPageButtons( void ) { - UINT16 usPosX=0; + CHAR16 sString[ 128 ]; - CHAR16 sString[ 128 ]; - // the back button button - giIMPMainPageButtonImage[0]= LoadButtonImage( "LAPTOP\\button_3.sti" ,-1,0,-1,1,-1 ); - - + giIMPMainPageButtonImage[0]= LoadButtonImage( "LAPTOP\\button_3.sti" ,-1,0,-1,1,-1 ); + + /* giIMPMainPageButton[0] = QuickCreateButton( giIMPMainPageButtonImage[0], LAPTOP_SCREEN_UL_X + 10 , LAPTOP_SCREEN_WEB_UL_Y + ( 360 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageBackCallback); - + */ //Cancel/back button - giIMPMainPageButton[0] = CreateIconAndTextButton( giIMPMainPageButtonImage[0], pImpButtonText[ 19 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + 15, LAPTOP_SCREEN_WEB_UL_Y + ( 360 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageBackCallback); + giIMPMainPageButton[0] = CreateIconAndTextButton( giIMPMainPageButtonImage[0], pImpButtonText[ 19 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + 15, LAPTOP_SCREEN_WEB_UL_Y + ( 360 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageBackCallback); - SpecifyButtonTextSubOffsets( giIMPMainPageButton[0], 0, -1, FALSE ); + SpecifyButtonTextSubOffsets( giIMPMainPageButton[0], 0, -1, FALSE ); // the begin profiling button - giIMPMainPageButtonImage[1]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); + giIMPMainPageButtonImage[1]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); /*giIMPMainPageButton[1] = QuickCreateButton( giIMPMainPageButtonImage[1], LAPTOP_SCREEN_UL_X + 136 , LAPTOP_SCREEN_WEB_UL_Y + ( 174 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageBeginCallback); @@ -375,40 +373,40 @@ void CreateIMPMainPageButtons( void ) //Registry/Begin button if(( iCurrentProfileMode == IMP__REGISTRY )||( iCurrentProfileMode > IMP__ATTRIBUTES) ) { - giIMPMainPageButton[1] = CreateIconAndTextButton( giIMPMainPageButtonImage[ 1 ], pImpButtonText[ 1 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + 136 , LAPTOP_SCREEN_WEB_UL_Y + ( 174 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageBeginCallback); - } + giIMPMainPageButton[1] = CreateIconAndTextButton( giIMPMainPageButtonImage[ 1 ], pImpButtonText[ 1 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + 136 , LAPTOP_SCREEN_WEB_UL_Y + ( 174 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageBeginCallback); + } else { - giIMPMainPageButton[1] = CreateIconAndTextButton( giIMPMainPageButtonImage[ 1 ], pImpButtonText[ 22 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, + giIMPMainPageButton[1] = CreateIconAndTextButton( giIMPMainPageButtonImage[ 1 ], pImpButtonText[ 22 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, LAPTOP_SCREEN_UL_X + 136 , LAPTOP_SCREEN_WEB_UL_Y + ( 174 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageBeginCallback); + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageBeginCallback); } // the personality button - giIMPMainPageButtonImage[2]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); - + giIMPMainPageButtonImage[2]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); + /* giIMPMainPageButton[2] = QuickCreateButton( giIMPMainPageButtonImage[2], LAPTOP_SCREEN_UL_X + 13 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPagePersonalityCallback); */ //Personality - giIMPMainPageButton[2] = CreateIconAndTextButton( giIMPMainPageButtonImage[ 2 ], pImpButtonText[ 2 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - MAIN_PAGE__THIRD_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPagePersonalityCallback); + giIMPMainPageButton[2] = CreateIconAndTextButton( giIMPMainPageButtonImage[ 2 ], pImpButtonText[ 2 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MAIN_PAGE__THIRD_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPagePersonalityCallback); if( IMP_CanWeDisplaySpecialtiesGraph( ) ) @@ -419,51 +417,51 @@ void CreateIMPMainPageButtons( void ) // the attribs button - giIMPMainPageButtonImage[3]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); - + giIMPMainPageButtonImage[3]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); + /* giIMPMainPageButton[3] = QuickCreateButton( giIMPMainPageButtonImage[3], LAPTOP_SCREEN_UL_X + 133 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageAttributesCallback); */ //Attributes - giIMPMainPageButton[3] = CreateIconAndTextButton( giIMPMainPageButtonImage[ 3 ], pImpButtonText[ 3 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - MAIN_PAGE__FOURTH_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageAttributesCallback); + giIMPMainPageButton[3] = CreateIconAndTextButton( giIMPMainPageButtonImage[ 3 ], pImpButtonText[ 3 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MAIN_PAGE__FOURTH_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageAttributesCallback); if( IMP_CanWeDisplayAttributeGraph( ) ) { - SpecifyButtonIcon( giIMPMainPageButton[3], guiATTRIBUTEGRAPH, 0, 25, 25, FALSE ); + SpecifyButtonIcon( giIMPMainPageButton[3], guiATTRIBUTEGRAPH, 0, 25, 25, FALSE ); } - // the portrait button - giIMPMainPageButtonImage[4]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); - + // the portrait button + giIMPMainPageButtonImage[4]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); + /*giIMPMainPageButton[4] = QuickCreateButton( giIMPMainPageButtonImage[4], LAPTOP_SCREEN_UL_X + 253 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPagePortraitCallback); - */ + */ //Portrait - giIMPMainPageButton[4] = CreateIconAndTextButton( giIMPMainPageButtonImage[ 4 ], pImpButtonText[ 4 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - MAIN_PAGE__FIRST_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPagePortraitCallback); + giIMPMainPageButton[4] = CreateIconAndTextButton( giIMPMainPageButtonImage[ 4 ], pImpButtonText[ 4 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MAIN_PAGE__FIRST_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPagePortraitCallback); // the voice button - giIMPMainPageButtonImage[5]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); + giIMPMainPageButtonImage[5]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); /*giIMPMainPageButton[5] = QuickCreateButton( giIMPMainPageButtonImage[5], LAPTOP_SCREEN_UL_X + 373 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageVoiceCallback); - */ + */ if( iCurrentProfileMode != IMP__VOICE && iCurrentProfileMode != IMP__PORTRAIT ) { @@ -475,29 +473,29 @@ void CreateIMPMainPageButtons( void ) } //Voice - giIMPMainPageButton[5] = CreateIconAndTextButton( giIMPMainPageButtonImage[ 5 ], sString, FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - MAIN_PAGE__SECOND_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageVoiceCallback); + giIMPMainPageButton[5] = CreateIconAndTextButton( giIMPMainPageButtonImage[ 5 ], sString, FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MAIN_PAGE__SECOND_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageVoiceCallback); if( IMP_CanWeDisplayVoiceGraph( ) ) { - SpecifyButtonIcon( giIMPMainPageButton[5], guiSMALLSILHOUETTE, 0, 33, 23, FALSE ); + SpecifyButtonIcon( giIMPMainPageButton[5], guiSMALLSILHOUETTE, 0, 33, 23, FALSE ); } - - SetButtonCursor(giIMPMainPageButton[ 0 ], CURSOR_WWW); + + SetButtonCursor(giIMPMainPageButton[ 0 ], CURSOR_WWW); SetButtonCursor(giIMPMainPageButton[ 1 ], CURSOR_WWW); SetButtonCursor(giIMPMainPageButton[ 2 ], CURSOR_WWW); SetButtonCursor(giIMPMainPageButton[ 3 ], CURSOR_WWW); SetButtonCursor(giIMPMainPageButton[ 4 ], CURSOR_WWW); SetButtonCursor(giIMPMainPageButton[ 5 ], CURSOR_WWW); - + SpecifyButtonTextOffsets( giIMPMainPageButton[ 2 ], 10, 40, TRUE ); SpecifyButtonTextOffsets( giIMPMainPageButton[ 3 ], 10, 40, TRUE ); SpecifyButtonTextOffsets( giIMPMainPageButton[ 4 ], 10, 40, TRUE ); @@ -514,31 +512,31 @@ void CreateIMPMainPageButtons( void ) void DeleteIMPMainPageButtons( void ) { - // this function destroys the buttons needed for the IMP about Us Page + // this function destroys the buttons needed for the IMP about Us Page + + // the back button + RemoveButton(giIMPMainPageButton[0] ); + UnloadButtonImage(giIMPMainPageButtonImage[0] ); - // the back button - RemoveButton(giIMPMainPageButton[0] ); - UnloadButtonImage(giIMPMainPageButtonImage[0] ); - // begin profiling button RemoveButton(giIMPMainPageButton[1] ); - UnloadButtonImage(giIMPMainPageButtonImage[1] ); + UnloadButtonImage(giIMPMainPageButtonImage[1] ); // begin personna button RemoveButton(giIMPMainPageButton[2] ); - UnloadButtonImage(giIMPMainPageButtonImage[2] ); - + UnloadButtonImage(giIMPMainPageButtonImage[2] ); + // begin attribs button RemoveButton(giIMPMainPageButton[3] ); - UnloadButtonImage(giIMPMainPageButtonImage[3] ); - + UnloadButtonImage(giIMPMainPageButtonImage[3] ); + // begin portrait button RemoveButton(giIMPMainPageButton[4] ); - UnloadButtonImage(giIMPMainPageButtonImage[4] ); + UnloadButtonImage(giIMPMainPageButtonImage[4] ); // begin voice button RemoveButton(giIMPMainPageButton[5] ); - UnloadButtonImage(giIMPMainPageButtonImage[5] ); + UnloadButtonImage(giIMPMainPageButtonImage[5] ); return; @@ -553,56 +551,56 @@ void BtnIMPMainPageBackCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - iCurrentImpPage = IMP_HOME_PAGE; + btn->uiFlags&=~(BUTTON_CLICKED_ON); + iCurrentImpPage = IMP_HOME_PAGE; fButtonPendingFlag = TRUE; iCurrentProfileMode = IMP__REGISTRY; fFinishedCharGeneration = FALSE; - ResetCharacterStats( ); + ResetCharacterStats( ); } - } -} + } +} void BtnIMPMainPageBeginCallback(GUI_BUTTON *btn,INT32 reason) { // btn callback for Main Page Begin Profiling - + if (!(btn->uiFlags & BUTTON_ENABLED)) return; // too far along to change gender - + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - + btn->uiFlags&=~(BUTTON_CLICKED_ON); + // are we going to change name, or do we have to start over from scratch if( iCurrentProfileMode > IMP__ATTRIBUTES ) { // too far along, restart - DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 1 ], LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, BeginMessageBoxCallBack); - + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 1 ], LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, BeginMessageBoxCallBack); + } else { if( LaptopSaveInfo.iCurrentBalance < COST_OF_PROFILE ) { DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 3 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, BeginMessageBoxCallBack); - + } else if( NumberOfMercsOnPlayerTeam() >= 18 ) { @@ -610,15 +608,15 @@ void BtnIMPMainPageBeginCallback(GUI_BUTTON *btn,INT32 reason) } else { - // change name - iCurrentImpPage = IMP_BEGIN; - fButtonPendingFlag = TRUE; - } - } - + // change name + iCurrentImpPage = IMP_BEGIN; + fButtonPendingFlag = TRUE; } - } -} + } + + } + } +} void BtnIMPMainPagePersonalityCallback(GUI_BUTTON *btn,INT32 reason) @@ -629,8 +627,8 @@ void BtnIMPMainPagePersonalityCallback(GUI_BUTTON *btn,INT32 reason) if (!(btn->uiFlags & BUTTON_ENABLED)) return; -/* - // if not this far in char generation, don't alot ANY action +/* + // if not this far in char generation, don't alot ANY action if( iCurrentProfileMode != IMP__PERSONALITY ) { btn->uiFlags&=~(BUTTON_CLICKED_ON); @@ -640,18 +638,18 @@ void BtnIMPMainPagePersonalityCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - iCurrentImpPage = IMP_PERSONALITY; + btn->uiFlags&=~(BUTTON_CLICKED_ON); + iCurrentImpPage = IMP_PERSONALITY; fButtonPendingFlag = TRUE; } - } -} + } +} void BtnIMPMainPageAttributesCallback(GUI_BUTTON *btn,INT32 reason) { @@ -660,7 +658,7 @@ void BtnIMPMainPageAttributesCallback(GUI_BUTTON *btn,INT32 reason) if (!(btn->uiFlags & BUTTON_ENABLED)) return; - // if not this far in char generation, don't alot ANY action + // if not this far in char generation, don't alot ANY action if( iCurrentProfileMode < IMP__ATTRIBUTES ) { btn->uiFlags&=~(BUTTON_CLICKED_ON); @@ -671,18 +669,18 @@ void BtnIMPMainPageAttributesCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - iCurrentImpPage = IMP_ATTRIBUTE_ENTRANCE; + btn->uiFlags&=~(BUTTON_CLICKED_ON); + iCurrentImpPage = IMP_ATTRIBUTE_ENTRANCE; fButtonPendingFlag = TRUE; } - } -} + } +} void BtnIMPMainPagePortraitCallback(GUI_BUTTON *btn,INT32 reason) { @@ -691,7 +689,7 @@ void BtnIMPMainPagePortraitCallback(GUI_BUTTON *btn,INT32 reason) if (!(btn->uiFlags & BUTTON_ENABLED)) return; - // if not this far in char generation, don't alot ANY action + // if not this far in char generation, don't alot ANY action if( ( iCurrentProfileMode != IMP__PORTRAIT )&&( iCurrentProfileMode != IMP__VOICE ) && ( iCurrentProfileMode > IMP__FINISH ) ) { btn->uiFlags&=~(BUTTON_CLICKED_ON); @@ -702,18 +700,18 @@ void BtnIMPMainPagePortraitCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - iCurrentImpPage = IMP_PORTRAIT; + btn->uiFlags&=~(BUTTON_CLICKED_ON); + iCurrentImpPage = IMP_PORTRAIT; fButtonPendingFlag = TRUE; } - } -} + } +} void BtnIMPMainPageVoiceCallback(GUI_BUTTON *btn,INT32 reason) @@ -723,7 +721,7 @@ void BtnIMPMainPageVoiceCallback(GUI_BUTTON *btn,INT32 reason) if (!(btn->uiFlags & BUTTON_ENABLED)) return; - // if not this far in char generation, don't alot ANY action + // if not this far in char generation, don't alot ANY action if( ( iCurrentProfileMode != IMP__PORTRAIT ) && ( iCurrentProfileMode > IMP__FINISH ) ) { btn->uiFlags&=~(BUTTON_CLICKED_ON); @@ -734,40 +732,40 @@ void BtnIMPMainPageVoiceCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - iCurrentImpPage = IMP_VOICE; + btn->uiFlags&=~(BUTTON_CLICKED_ON); + iCurrentImpPage = IMP_VOICE; fButtonPendingFlag = TRUE; } - } -} + } +} void NextProfilingMode( void ) { - // this function will change to mode the player is in for profiling - + // this function will change to mode the player is in for profiling + // if less than done - if(iCurrentProfileMode < IMP__VOICE) - iCurrentProfileMode++; - + if(iCurrentProfileMode < IMP__VOICE) + iCurrentProfileMode++; + return; } BOOLEAN CheckIfFinishedCharacterGeneration( void ) { - // this function checks to see if character is done character generation - + // this function checks to see if character is done character generation + // are we done character generation if( iCurrentProfileMode == IMP__FINISH ) { // yes - return ( TRUE ); + return ( TRUE ); } else { @@ -775,32 +773,32 @@ BOOLEAN CheckIfFinishedCharacterGeneration( void ) return ( FALSE ); } } - + void ShadeUnSelectableButtons( void ) { INT32 iCounter =0; - // this function looks at the status ofiCurrentProfileMode and decides which buttons + // this function looks at the status ofiCurrentProfileMode and decides which buttons // should be shaded ( unselectable ) - + for( iCounter = iCurrentProfileMode; iCounter < 5; iCounter++ ) { - ShadowVideoSurfaceRect( FRAME_BUFFER, 13 + (iCounter ) * 120 + 114, 245, 13 + ( iCounter + 1 ) * 120 + 90, 245 + 92 ); - InvalidateRegion(13 + (iCounter ) * 120 + 114, 245, 13 + (iCounter ) * 120 + 114, 245 + 92 ); + ShadowVideoSurfaceRect( FRAME_BUFFER, 13 + (iCounter ) * 120 + 114, 245, 13 + ( iCounter + 1 ) * 120 + 90, 245 + 92 ); + InvalidateRegion(13 + (iCounter ) * 120 + 114, 245, 13 + (iCounter ) * 120 + 114, 245 + 92 ); } - + fMarkButtonsDirtyFlag = FALSE; - return; + return; } void UpDateIMPMainPageButtons( void ) { // update mainpage button states - INT32 iCount = 0; + INT32 iCount = 0; // disable all - for( iCount = 2; iCount < 6; iCount++) + for( iCount = 2; iCount < 6; iCount++) { DisableButton( giIMPMainPageButton[ iCount ] ); } @@ -809,15 +807,15 @@ void UpDateIMPMainPageButtons( void ) { MSYS_DisableRegion( &pIMPMainPageMouseRegions[ iCount ]); } - // enable - switch( iCurrentProfileMode ) + // enable + switch( iCurrentProfileMode ) { //begin case IMP__REGISTRY: - MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 0 ]); - MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 1 ]); - MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 2 ]); - MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 3 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 0 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 1 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 2 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 3 ]); break; //Personality ( 3RD BUTTON ) @@ -830,10 +828,10 @@ void UpDateIMPMainPageButtons( void ) // MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 1 ]); MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 3 ]); /* - EnableButton( giIMPMainPageButton[2] ); - MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 1 ]); - MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 2 ]); - MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 3 ]); + EnableButton( giIMPMainPageButton[2] ); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 1 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 2 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 3 ]); */ break; @@ -842,32 +840,32 @@ void UpDateIMPMainPageButtons( void ) EnableButton( giIMPMainPageButton[2] ); EnableButton( giIMPMainPageButton[4] ); EnableButton( giIMPMainPageButton[5] ); - EnableButton( giIMPMainPageButton[3] ); + EnableButton( giIMPMainPageButton[3] ); // MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 0 ]); -// MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 1 ]); -// MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 2 ]); +// MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 1 ]); +// MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 2 ]); /* - EnableButton( giIMPMainPageButton[3] ); + EnableButton( giIMPMainPageButton[3] ); MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 0 ]); - MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 2 ]); - MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 3 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 2 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 3 ]); */ break; //Portrait ( ist button case IMP__PORTRAIT: // EnableButton( giIMPMainPageButton[3] ); - EnableButton( giIMPMainPageButton[4] ); + EnableButton( giIMPMainPageButton[4] ); MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 1 ]); - MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 2 ]); - MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 3 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 2 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 3 ]); /* EnableButton( giIMPMainPageButton[3] ); - EnableButton( giIMPMainPageButton[4] ); + EnableButton( giIMPMainPageButton[4] ); MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 0 ]); - //MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 1 ]); - MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 3 ]); + //MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 1 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 3 ]); */ break; @@ -880,11 +878,11 @@ void UpDateIMPMainPageButtons( void ) MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 2 ]); MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 3 ]); /* - //MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 1 ]); - MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 0 ]); - EnableButton( giIMPMainPageButton[3] ); - EnableButton( giIMPMainPageButton[4] ); - EnableButton( giIMPMainPageButton[5] ); + //MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 1 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 0 ]); + EnableButton( giIMPMainPageButton[3] ); + EnableButton( giIMPMainPageButton[4] ); + EnableButton( giIMPMainPageButton[5] ); */ break; } @@ -895,12 +893,12 @@ void UpDateIMPMainPageButtons( void ) void BeginMessageBoxCallBack( UINT8 bExitValue ) { // yes, so start over, else stay here and do nothing for now - if( bExitValue == MSG_BOX_RETURN_YES ) + if( bExitValue == MSG_BOX_RETURN_YES ) { iCurrentImpPage = IMP_BEGIN; - iCurrentProfileMode = IMP__REGISTRY; + iCurrentProfileMode = IMP__REGISTRY; } - + else if( bExitValue == MSG_BOX_RETURN_OK ) { // if ok, then we are coming from financial warning, allow continue @@ -911,29 +909,29 @@ void BeginMessageBoxCallBack( UINT8 bExitValue ) void CreateMouseRegionsForIMPMainPageBasedOnCharGenStatus( void ) { - // this procedure will create masks for the char generation main page + // this procedure will create masks for the char generation main page + - // mask for personality page button - MSYS_DefineRegion( &pIMPMainPageMouseRegions[ 0 ],LAPTOP_SCREEN_UL_X + 13 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), LAPTOP_SCREEN_UL_X + 13 + 115 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ) + 93 , MSYS_PRIORITY_HIGH+5, - CURSOR_WWW, MSYS_NO_CALLBACK, IMPMainPageNotSelectableBtnCallback ); + MSYS_DefineRegion( &pIMPMainPageMouseRegions[ 0 ],LAPTOP_SCREEN_UL_X + 13 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), LAPTOP_SCREEN_UL_X + 13 + 115 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ) + 93 , MSYS_PRIORITY_HIGH+5, + CURSOR_WWW, MSYS_NO_CALLBACK, IMPMainPageNotSelectableBtnCallback ); // mask for attrib page button - MSYS_DefineRegion( &pIMPMainPageMouseRegions[ 1 ],LAPTOP_SCREEN_UL_X + 133 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), LAPTOP_SCREEN_UL_X + 133 + 115 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ) + 93 , MSYS_PRIORITY_HIGH+5, - CURSOR_WWW, MSYS_NO_CALLBACK, IMPMainPageNotSelectableBtnCallback ); + MSYS_DefineRegion( &pIMPMainPageMouseRegions[ 1 ],LAPTOP_SCREEN_UL_X + 133 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), LAPTOP_SCREEN_UL_X + 133 + 115 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ) + 93 , MSYS_PRIORITY_HIGH+5, + CURSOR_WWW, MSYS_NO_CALLBACK, IMPMainPageNotSelectableBtnCallback ); // mask for portrait page button - MSYS_DefineRegion( &pIMPMainPageMouseRegions[ 2 ],LAPTOP_SCREEN_UL_X + 253 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), LAPTOP_SCREEN_UL_X + 253 + 115 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ) + 93 , MSYS_PRIORITY_HIGH+5, - CURSOR_WWW, MSYS_NO_CALLBACK, IMPMainPageNotSelectableBtnCallback ); + MSYS_DefineRegion( &pIMPMainPageMouseRegions[ 2 ],LAPTOP_SCREEN_UL_X + 253 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), LAPTOP_SCREEN_UL_X + 253 + 115 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ) + 93 , MSYS_PRIORITY_HIGH+5, + CURSOR_WWW, MSYS_NO_CALLBACK, IMPMainPageNotSelectableBtnCallback ); // mask for voice page button - MSYS_DefineRegion( &pIMPMainPageMouseRegions[ 3 ],LAPTOP_SCREEN_UL_X + 373 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), LAPTOP_SCREEN_UL_X + 373 + 115 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ) + 93 , MSYS_PRIORITY_HIGH+5, - CURSOR_WWW, MSYS_NO_CALLBACK, IMPMainPageNotSelectableBtnCallback ); + MSYS_DefineRegion( &pIMPMainPageMouseRegions[ 3 ],LAPTOP_SCREEN_UL_X + 373 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), LAPTOP_SCREEN_UL_X + 373 + 115 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ) + 93 , MSYS_PRIORITY_HIGH+5, + CURSOR_WWW, MSYS_NO_CALLBACK, IMPMainPageNotSelectableBtnCallback ); @@ -950,32 +948,32 @@ void DestoryMouseRegionsForIMPMainPageBasedOnCharGenStatus( void ) // will destroy button masks for the char gen pages - MSYS_RemoveRegion( &pIMPMainPageMouseRegions[ 0 ]); + MSYS_RemoveRegion( &pIMPMainPageMouseRegions[ 0 ]); - MSYS_RemoveRegion( &pIMPMainPageMouseRegions[ 1 ]); + MSYS_RemoveRegion( &pIMPMainPageMouseRegions[ 1 ]); - MSYS_RemoveRegion( &pIMPMainPageMouseRegions[ 2 ]); + MSYS_RemoveRegion( &pIMPMainPageMouseRegions[ 2 ]); + + MSYS_RemoveRegion( &pIMPMainPageMouseRegions[ 3 ]); - MSYS_RemoveRegion( &pIMPMainPageMouseRegions[ 3 ]); - return; } void IMPMainPageNotSelectableBtnCallback(MOUSE_REGION * pRegion, INT32 iReason ) -{ - - if (iReason & MSYS_CALLBACK_REASON_INIT) - { +{ - return; - } - - if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) - { - DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 4 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, BeginMessageBoxCallBack); - } + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + + return; + } + + if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 4 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, BeginMessageBoxCallBack); + } return; } @@ -995,7 +993,7 @@ INT32 CountFilledIMPSlots( INT8 iSex ) for (i = iStart; i <= iEnd; ++i) { if ((gGameExternalOptions.iaIMPSlots[i] != -1) && - (!IsIMPSlotFree(gGameExternalOptions.iaIMPSlots[i]))) + (!IsIMPSlotFree(gGameExternalOptions.iaIMPSlots[i]))) { ++iCount; } @@ -1019,7 +1017,7 @@ INT32 CountEmptyIMPSlots( INT8 iSex ) // Count the free slots for (i = iStart; i <= iEnd; ++i) { - if (IsIMPSlotFree(gGameExternalOptions.iaIMPSlots[i])) + if (IsIMPSlotFree(gGameExternalOptions.iaIMPSlots[i])) { ++iCount; } @@ -1061,7 +1059,7 @@ INT32 GetFreeIMPSlot(INT32 iIMPId, INT32 iDefaultIMPId) // We have a default imp id (90210 or nickname) if (iDefaultIMPId != -1) { - if (IsIMPSlotFree(iDefaultIMPId)) + if (IsIMPSlotFree(iDefaultIMPId)) { return iDefaultIMPId; } @@ -1089,7 +1087,7 @@ INT32 GetFreeIMPSlot(INT32 iIMPId, INT32 iDefaultIMPId) for (i = iStart; i <= iEnd; ++i) { // Found a free imp slot - if (IsIMPSlotFree(gGameExternalOptions.iaIMPSlots[i])) + if (IsIMPSlotFree(gGameExternalOptions.iaIMPSlots[i])) { return gGameExternalOptions.iaIMPSlots[i]; } @@ -1103,8 +1101,8 @@ INT32 GetFreeIMPSlot(INT32 iIMPId, INT32 iDefaultIMPId) BOOLEAN LoadCharacterPortraitForMainPage( void ) { - // this function will load the character's portrait, to be used on portrait button - VOBJECT_DESC VObjectDesc; + // this function will load the character's portrait, to be used on portrait button + VOBJECT_DESC VObjectDesc; if( IMP_CanWeDisplayPortrait( ) ) { @@ -1113,10 +1111,10 @@ BOOLEAN LoadCharacterPortraitForMainPage( void ) FilenameForBPP( pPlayerSelectedFaceFileNames[ iPortraitNumber ] , VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiCHARACTERPORTRAITFORMAINPAGE)); - + // now specify - SpecifyButtonIcon( giIMPMainPageButton[4], guiCHARACTERPORTRAITFORMAINPAGE, 0, - 33, 23, FALSE ); + SpecifyButtonIcon( giIMPMainPageButton[4], guiCHARACTERPORTRAITFORMAINPAGE, 0, + 33, 23, FALSE ); } return( TRUE ); @@ -1126,9 +1124,9 @@ BOOLEAN LoadCharacterPortraitForMainPage( void ) BOOLEAN IMP_CanWeDisplayPortrait( ) { - if( iCurrentProfileMode == IMP__VOICE || - iCurrentProfileMode == IMP__ATTRIBUTES || - iCurrentProfileMode == IMP__PERSONALITY || + if( iCurrentProfileMode == IMP__VOICE || + iCurrentProfileMode == IMP__ATTRIBUTES || + iCurrentProfileMode == IMP__PERSONALITY || iCurrentProfileMode == IMP__FINISH ) { return( TRUE ); @@ -1155,7 +1153,7 @@ BOOLEAN IMP_CanWeDisplayAttributeGraph( ) BOOLEAN IMP_CanWeDisplaySpecialtiesGraph( ) { - if( iCurrentProfileMode == IMP__ATTRIBUTES || + if( iCurrentProfileMode == IMP__ATTRIBUTES || iCurrentProfileMode == IMP__FINISH ) { return( TRUE ); @@ -1169,9 +1167,9 @@ BOOLEAN IMP_CanWeDisplaySpecialtiesGraph( ) BOOLEAN IMP_CanWeDisplayVoiceGraph( ) { - if( iCurrentProfileMode == IMP__ATTRIBUTES || -// iCurrentProfileMode == IMP__VOICE || - iCurrentProfileMode == IMP__PERSONALITY || + if( iCurrentProfileMode == IMP__ATTRIBUTES || +// iCurrentProfileMode == IMP__VOICE || + iCurrentProfileMode == IMP__PERSONALITY || iCurrentProfileMode == IMP__FINISH ) { return( TRUE ); diff --git a/Laptop/IMP MainPage.h b/Laptop/IMP MainPage.h index 71dd0621..6e9f7f0d 100644 --- a/Laptop/IMP MainPage.h +++ b/Laptop/IMP MainPage.h @@ -31,7 +31,7 @@ INT32 GetFirstFemaleSlot(); INT32 GetLastFemaleSlot(); // This returns a count of how any slots along we are in the potential -// slot list. Usable for displaying on the "Voice" button in the interface +// slot list. Usable for displaying on the "Voice" button in the interface // and probably not much else. INT32 GetVoiceCountFromVoiceSlot(INT32 iSlot); diff --git a/Laptop/IMP Personality Entrance.cpp b/Laptop/IMP Personality Entrance.cpp index cd80dc13..fa1be06f 100644 --- a/Laptop/IMP Personality Entrance.cpp +++ b/Laptop/IMP Personality Entrance.cpp @@ -30,29 +30,29 @@ void BtnIMPPersonalityEntranceDoneCallback(GUI_BUTTON *btn,INT32 reason); void EnterIMPPersonalityEntrance( void ) { - // create buttons needed + // create buttons needed CreateIMPPersonalityEntranceButtons( ); - return; + return; } void RenderIMPPersonalityEntrance( void ) { - // the background + // the background RenderProfileBackGround( ); // the IMP symbol //RenderIMPSymbol( 112, 30 ); // indent - RenderAvgMercIndentFrame(90, 40 ); + RenderAvgMercIndentFrame(90, 40 ); return; } void ExitIMPPersonalityEntrance( void ) { - // destroy buttons needed + // destroy buttons needed DestroyIMPPersonalityEntranceButtons( ); @@ -64,30 +64,30 @@ void ExitIMPPersonalityEntrance( void ) void HandleIMPPersonalityEntrance( void ) { - - return; + + return; } void CreateIMPPersonalityEntranceButtons( void ) { - // this function will create the buttons needed for the IMP personality Page + // this function will create the buttons needed for the IMP personality Page // ths begin button - giIMPPersonalityEntranceButtonImage[0]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); - /*giIMPPersonalityEntranceButton[0] = QuickCreateButton( giIMPPersonalityEntranceButtonImage[0], LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), + giIMPPersonalityEntranceButtonImage[0]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); + /*giIMPPersonalityEntranceButton[0] = QuickCreateButton( giIMPPersonalityEntranceButtonImage[0], LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityEntranceDoneCallback); */ - giIMPPersonalityEntranceButton[0] = CreateIconAndTextButton( giIMPPersonalityEntranceButtonImage[0], pImpButtonText[ 1 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityEntranceDoneCallback); + giIMPPersonalityEntranceButton[0] = CreateIconAndTextButton( giIMPPersonalityEntranceButtonImage[0], pImpButtonText[ 1 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityEntranceDoneCallback); + - SetButtonCursor(giIMPPersonalityEntranceButton[0], CURSOR_WWW); return; @@ -96,10 +96,10 @@ void CreateIMPPersonalityEntranceButtons( void ) void DestroyIMPPersonalityEntranceButtons( void ) { // this function will destroy the buttons needed for the IMP personality page - + // the begin button - RemoveButton(giIMPPersonalityEntranceButton[0] ); - UnloadButtonImage(giIMPPersonalityEntranceButtonImage[0] ); + RemoveButton(giIMPPersonalityEntranceButton[0] ); + UnloadButtonImage(giIMPPersonalityEntranceButtonImage[0] ); return; } @@ -114,17 +114,17 @@ void BtnIMPPersonalityEntranceDoneCallback(GUI_BUTTON *btn,INT32 reason) if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); - + btn->uiFlags|=(BUTTON_CLICKED_ON); + } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - // done with begin screen, next screen + btn->uiFlags&=~(BUTTON_CLICKED_ON); + // done with begin screen, next screen iCurrentImpPage = IMP_PERSONALITY_QUIZ; - fButtonPendingFlag = TRUE; + fButtonPendingFlag = TRUE; } } -} \ No newline at end of file +} diff --git a/Laptop/IMP Personality Finish.cpp b/Laptop/IMP Personality Finish.cpp index 64271308..e9c936b9 100644 --- a/Laptop/IMP Personality Finish.cpp +++ b/Laptop/IMP Personality Finish.cpp @@ -26,7 +26,7 @@ UINT8 bPersonalityEndState = 0; #define PERSONALITY_CONFIRM_FINISH_DELAY 2500 -// flag set when player hits YES/NO button +// flag set when player hits YES/NO button BOOLEAN fConfirmHasBeenSelectedFlag = FALSE; BOOLEAN fConfirmIsYesFlag = FALSE; BOOLEAN fOkToReturnIMPMainPageFromPersonalityFlag = FALSE; @@ -74,11 +74,11 @@ void EnterIMPPersonalityFinish( void ) void RenderIMPPersonalityFinish( void ) { - // the background + // the background RenderProfileBackGround( ); // indent for text - RenderBeginIndent( 110, 93 ); + RenderBeginIndent( 110, 93 ); // check confirm flag to decide if we have to display appropriate response to button action if( fConfirmHasBeenSelectedFlag ) @@ -86,13 +86,13 @@ void RenderIMPPersonalityFinish( void ) // confirm was yes, display yes string if(fConfirmIsYesFlag == TRUE) { - // display yes string + // display yes string PrintImpText( ); } else { // display no string - PrintImpText( ); + PrintImpText( ); } } return; @@ -100,12 +100,12 @@ void RenderIMPPersonalityFinish( void ) void ExitIMPPersonalityFinish( void ) { - + // exit at IMP Ok button if( fExitIMPPerFinAtOk ) { // destroy the finish ok buttons - DestroyPersonalityFinishOkButton( ); + DestroyPersonalityFinishOkButton( ); } @@ -126,12 +126,12 @@ void ExitIMPPersonalityFinish( void ) void HandleIMPPersonalityFinish( void ) { - + // check if confirm and delay CheckIfConfirmHasBeenSelectedAndTimeDelayHasPassed( ); - return; + return; } @@ -139,7 +139,7 @@ void CheckIfConfirmHasBeenSelectedAndTimeDelayHasPassed( void ) { // this function will check to see if player has in fact confirmed selection and delay to // read text has occurred - + // if not confirm selected, return @@ -172,43 +172,43 @@ void CheckIfConfirmHasBeenSelectedAndTimeDelayHasPassed( void ) fConfirmHasBeenSelectedFlag = FALSE; fExitDueFrIMPPerFinToOkButton = TRUE; } - + return; } void CreateIMPPersonalityFinishButtons( void ) { - // this function will create the buttons needed for the IMP personality Finish Page + // this function will create the buttons needed for the IMP personality Finish Page // ths Yes button - giIMPPersonalityFinishButtonImage[0]= LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 ); -/* giIMPPersonalityFinishButton[0] = QuickCreateButton( giIMPPersonalityFinishButtonImage[0], LAPTOP_SCREEN_UL_X + ( 90 ), LAPTOP_SCREEN_WEB_UL_Y + ( 224 ), + giIMPPersonalityFinishButtonImage[0]= LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 ); +/* giIMPPersonalityFinishButton[0] = QuickCreateButton( giIMPPersonalityFinishButtonImage[0], LAPTOP_SCREEN_UL_X + ( 90 ), LAPTOP_SCREEN_WEB_UL_Y + ( 224 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityFinishYesCallback); */ - giIMPPersonalityFinishButton[0] = CreateIconAndTextButton( giIMPPersonalityFinishButtonImage[0], pImpButtonText[ 9 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( 90 ), LAPTOP_SCREEN_WEB_UL_Y + ( 224 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityFinishYesCallback); + giIMPPersonalityFinishButton[0] = CreateIconAndTextButton( giIMPPersonalityFinishButtonImage[0], pImpButtonText[ 9 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 90 ), LAPTOP_SCREEN_WEB_UL_Y + ( 224 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityFinishYesCallback); - // the no Button - giIMPPersonalityFinishButtonImage[ 1 ]= LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 ); -/* giIMPPersonalityFinishButton[ 1 ] = QuickCreateButton( giIMPPersonalityFinishButtonImage[1], LAPTOP_SCREEN_UL_X + ( 276 ), LAPTOP_SCREEN_WEB_UL_Y + ( 224 ), + // the no Button + giIMPPersonalityFinishButtonImage[ 1 ]= LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 ); +/* giIMPPersonalityFinishButton[ 1 ] = QuickCreateButton( giIMPPersonalityFinishButtonImage[1], LAPTOP_SCREEN_UL_X + ( 276 ), LAPTOP_SCREEN_WEB_UL_Y + ( 224 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityFinishNoCallback); - */ - giIMPPersonalityFinishButton[ 1 ] = CreateIconAndTextButton( giIMPPersonalityFinishButtonImage[ 1 ], pImpButtonText[ 10 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( 276 ), LAPTOP_SCREEN_WEB_UL_Y + ( 224 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityFinishNoCallback); + */ + giIMPPersonalityFinishButton[ 1 ] = CreateIconAndTextButton( giIMPPersonalityFinishButtonImage[ 1 ], pImpButtonText[ 10 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 276 ), LAPTOP_SCREEN_WEB_UL_Y + ( 224 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityFinishNoCallback); - SetButtonCursor(giIMPPersonalityFinishButton[0], CURSOR_WWW); - SetButtonCursor(giIMPPersonalityFinishButton[1], CURSOR_WWW); + SetButtonCursor(giIMPPersonalityFinishButton[0], CURSOR_WWW); + SetButtonCursor(giIMPPersonalityFinishButton[1], CURSOR_WWW); return; @@ -218,14 +218,14 @@ void CreateIMPPersonalityFinishButtons( void ) void DestroyIMPersonalityFinishButtons( void ) { // this function will destroy the buttons needed for the IMP personality Finish page - - // the yes button - RemoveButton(giIMPPersonalityFinishButton[ 0 ] ); - UnloadButtonImage(giIMPPersonalityFinishButtonImage[ 0 ] ); - // the no button + // the yes button + RemoveButton(giIMPPersonalityFinishButton[ 0 ] ); + UnloadButtonImage(giIMPPersonalityFinishButtonImage[ 0 ] ); + + // the no button RemoveButton(giIMPPersonalityFinishButton[ 1 ] ); - UnloadButtonImage(giIMPPersonalityFinishButtonImage[ 1 ] ); + UnloadButtonImage(giIMPPersonalityFinishButtonImage[ 1 ] ); return; } @@ -241,35 +241,35 @@ void BtnIMPPersonalityFinishYesCallback(GUI_BUTTON *btn,INT32 reason) if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { // confirm flag set, get out of HERE! - if( fConfirmHasBeenSelectedFlag ) - { - // now set this button off - btn->uiFlags&=~(BUTTON_CLICKED_ON); + if( fConfirmHasBeenSelectedFlag ) + { + // now set this button off + btn->uiFlags&=~(BUTTON_CLICKED_ON); - return; - } + return; + } + + btn->uiFlags|=(BUTTON_CLICKED_ON); - btn->uiFlags|=(BUTTON_CLICKED_ON); - } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - - // now set this button off - btn->uiFlags&=~(BUTTON_CLICKED_ON); + + // now set this button off + btn->uiFlags&=~(BUTTON_CLICKED_ON); // set fact yes was selected - fConfirmIsYesFlag = TRUE; + fConfirmIsYesFlag = TRUE; // set fact that confirmation has been done fConfirmHasBeenSelectedFlag = TRUE; - + // now make skill, personality and attitude CreatePlayersPersonalitySkillsAndAttitude( ); fButtonPendingFlag = TRUE; - bPersonalityEndState = 1; + bPersonalityEndState = 1; } } } @@ -285,34 +285,34 @@ void BtnIMPPersonalityFinishNoCallback(GUI_BUTTON *btn,INT32 reason) if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - // confirm flag set, get out of HERE! - if( fConfirmHasBeenSelectedFlag ) - { - // now set this button off - btn->uiFlags&=~(BUTTON_CLICKED_ON); + // confirm flag set, get out of HERE! + if( fConfirmHasBeenSelectedFlag ) + { + // now set this button off + btn->uiFlags&=~(BUTTON_CLICKED_ON); - return; - } + return; + } + + btn->uiFlags|=(BUTTON_CLICKED_ON); - btn->uiFlags|=(BUTTON_CLICKED_ON); - } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - + // now set this button on - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); // set fact yes was selected - fConfirmIsYesFlag = FALSE; + fConfirmIsYesFlag = FALSE; // set fact that confirmation has been done fConfirmHasBeenSelectedFlag = TRUE; CreatePlayersPersonalitySkillsAndAttitude( ); - - bPersonalityEndState = 2; + + bPersonalityEndState = 2; fButtonPendingFlag = TRUE; } } @@ -324,17 +324,17 @@ void CreatePersonalityFinishOkButton( void ) { // create personality button finish button - giIMPPersonalityFinishButtonImage[0]= LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 ); - giIMPPersonalityFinishButton[0] = CreateIconAndTextButton( giIMPPersonalityFinishButtonImage[0], pImpButtonText[ 24 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( 186 ), LAPTOP_SCREEN_WEB_UL_Y + ( 224 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityFinishOkCallback); + giIMPPersonalityFinishButtonImage[0]= LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityFinishButton[0] = CreateIconAndTextButton( giIMPPersonalityFinishButtonImage[0], pImpButtonText[ 24 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 186 ), LAPTOP_SCREEN_WEB_UL_Y + ( 224 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityFinishOkCallback); SetButtonCursor(giIMPPersonalityFinishButton[0], CURSOR_WWW); - + return; } @@ -342,8 +342,8 @@ void CreatePersonalityFinishOkButton( void ) void DestroyPersonalityFinishOkButton( void ) { // the ok button - RemoveButton(giIMPPersonalityFinishButton[ 0 ] ); - UnloadButtonImage(giIMPPersonalityFinishButtonImage[ 0 ] ); + RemoveButton(giIMPPersonalityFinishButton[ 0 ] ); + UnloadButtonImage(giIMPPersonalityFinishButtonImage[ 0 ] ); } @@ -357,16 +357,16 @@ void BtnIMPPersonalityFinishOkCallback(GUI_BUTTON *btn,INT32 reason) if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - - btn->uiFlags|=(BUTTON_CLICKED_ON); - + + btn->uiFlags|=(BUTTON_CLICKED_ON); + } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { // now set this button on - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); // Testing UB stuff // if( iCurrentProfileMode < 2 ) @@ -389,4 +389,4 @@ void BtnIMPPersonalityFinishOkCallback(GUI_BUTTON *btn,INT32 reason) } } } -} \ No newline at end of file +} diff --git a/Laptop/IMP Personality Quiz.cpp b/Laptop/IMP Personality Quiz.cpp index 7f2f80cb..8d381ffe 100644 --- a/Laptop/IMP Personality Quiz.cpp +++ b/Laptop/IMP Personality Quiz.cpp @@ -31,7 +31,7 @@ UINT32 giIMPPersonalityQuizButtonImage[ 2 ]; // these are the buttons for the current question INT32 giIMPPersonalityQuizAnswerButton[ 10 ]; INT32 giIMPPersonalityQuizAnswerButtonImage[ 10 ]; - + INT32 giPreviousQuestionButton; INT32 giNextQuestionButton; @@ -63,7 +63,7 @@ INT32 iQuizAnswerList[MAX_NUMBER_OF_IMP_QUESTIONS]; // current number of buttons being shown INT32 iNumberOfPersonaButtons = 0; -// function definitions +// function definitions void DestroyIMPPersonalityQuizAnswerButtons(INT32 iNumberOfButtons ); void CreateIMPPersonalityQuizAnswerButtons( void ); void CreateIMPPersonalityQuizButtons( void ); @@ -111,12 +111,12 @@ void EnterIMPPersonalityQuiz( void ) { // void answers out the quiz - memset( &iQuizAnswerList, -1, sizeof( INT32 ) * MAX_NUMBER_OF_IMP_QUESTIONS ); - + memset( &iQuizAnswerList, -1, sizeof( INT32 ) * MAX_NUMBER_OF_IMP_QUESTIONS ); + // if we are entering for first time, reset if( giCurrentPersonalityQuizQuestion == MAX_NUMBER_OF_IMP_QUESTIONS ) { - giCurrentPersonalityQuizQuestion = 0; + giCurrentPersonalityQuizQuestion = 0; } // reset previous giPreviousPersonalityQuizQuestion = -1; @@ -124,7 +124,7 @@ void EnterIMPPersonalityQuiz( void ) // reset skills, attributes and personality ResetSkillsAttributesAndPersonality( ); - // create/destroy buttons for questions, if needed + // create/destroy buttons for questions, if needed CreateIMPPersonalityQuizAnswerButtons( ); // now reset them @@ -138,11 +138,11 @@ void EnterIMPPersonalityQuiz( void ) void RenderIMPPersonalityQuiz( void ) { - // the background + // the background RenderProfileBackGround( ); - + // highlight answer - PrintImpText( ); + PrintImpText( ); // indent for current and last page numbers //RenderAttrib2IndentFrame(BTN_FIRST_COLUMN_X + 2, 365 ); @@ -160,14 +160,14 @@ void ExitIMPPersonalityQuiz( void ) // set previous to current, we want it's buttons gone! - giPreviousPersonalityQuizQuestion = giCurrentPersonalityQuizQuestion; + giPreviousPersonalityQuizQuestion = giCurrentPersonalityQuizQuestion; // destroy regular quiz buttons: the done and start over buttons - DestroyIMPersonalityQuizButtons( ); + DestroyIMPersonalityQuizButtons( ); // destroy the buttons used for answers - DestroyPersonalityQuizButtons( ); + DestroyPersonalityQuizButtons( ); if( fStartOverFlag ) { @@ -180,74 +180,74 @@ void ExitIMPPersonalityQuiz( void ) void HandleIMPPersonalityQuiz( void ) { - - // create/destroy buttons for questions, if needed + + // create/destroy buttons for questions, if needed CreateIMPPersonalityQuizAnswerButtons( ); - + // handle keyboard input HandleIMPQuizKeyBoard( ); - if( iCurrentAnswer == -1) + if( iCurrentAnswer == -1) { DisableButton( giIMPPersonalityQuizButton[0] ); } - return; + return; } void CreateIMPPersonalityQuizButtons( void ) { - // this function will create the buttons needed for the IMP personality quiz Page - - - + // this function will create the buttons needed for the IMP personality quiz Page + + + // ths Done button - giIMPPersonalityQuizButtonImage[0]= LoadButtonImage( "LAPTOP\\button_7.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityQuizButtonImage[0]= LoadButtonImage( "LAPTOP\\button_7.sti" ,-1,0,-1,1,-1 ); -/* giIMPPersonalityQuizButton[0] = QuickCreateButton( giIMPPersonalityQuizButtonImage[0], LAPTOP_SCREEN_UL_X + ( 197 ), LAPTOP_SCREEN_WEB_UL_Y + ( 310 ), +/* giIMPPersonalityQuizButton[0] = QuickCreateButton( giIMPPersonalityQuizButtonImage[0], LAPTOP_SCREEN_UL_X + ( 197 ), LAPTOP_SCREEN_WEB_UL_Y + ( 310 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswerConfirmCallback); */ - giIMPPersonalityQuizButton[0] = CreateIconAndTextButton( giIMPPersonalityQuizButtonImage[0], pImpButtonText[ 8 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( 197 ), LAPTOP_SCREEN_WEB_UL_Y + ( 302 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswerConfirmCallback); + giIMPPersonalityQuizButton[0] = CreateIconAndTextButton( giIMPPersonalityQuizButtonImage[0], pImpButtonText[ 8 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 197 ), LAPTOP_SCREEN_WEB_UL_Y + ( 302 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswerConfirmCallback); - // start over - giIMPPersonalityQuizButtonImage[ 1 ]= LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 ); - - /* giIMPPersonalityQuizButton[ 1 ] = QuickCreateButton( giIMPPersonalityQuizButtonImage[1], LAPTOP_SCREEN_UL_X + ( BTN_FIRST_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 310 ), + // start over + giIMPPersonalityQuizButtonImage[ 1 ]= LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 ); + + /* giIMPPersonalityQuizButton[ 1 ] = QuickCreateButton( giIMPPersonalityQuizButtonImage[1], LAPTOP_SCREEN_UL_X + ( BTN_FIRST_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 310 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityQuizStartOverCallback); */ - - giIMPPersonalityQuizButton[ 1 ] = CreateIconAndTextButton( giIMPPersonalityQuizButtonImage[ 1 ], pImpButtonText[ 7 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( BTN_FIRST_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 302 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityQuizStartOverCallback); + + giIMPPersonalityQuizButton[ 1 ] = CreateIconAndTextButton( giIMPPersonalityQuizButtonImage[ 1 ], pImpButtonText[ 7 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( BTN_FIRST_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 302 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityQuizStartOverCallback); giPreviousQuestionButtonImage = LoadButtonImage( "LAPTOP\\button_3.sti" ,-1,0,-1,1,-1 ); - giPreviousQuestionButton = CreateIconAndTextButton( giPreviousQuestionButtonImage, pImpButtonText[ 12 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( 197 ), LAPTOP_SCREEN_WEB_UL_Y + ( 361 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)PreviousQuestionButtonCallback); + giPreviousQuestionButton = CreateIconAndTextButton( giPreviousQuestionButtonImage, pImpButtonText[ 12 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 197 ), LAPTOP_SCREEN_WEB_UL_Y + ( 361 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)PreviousQuestionButtonCallback); giNextQuestionButtonImage = LoadButtonImage( "LAPTOP\\button_3.sti" ,-1,0,-1,1,-1 ); - giNextQuestionButton = CreateIconAndTextButton( giNextQuestionButtonImage, pImpButtonText[ 13 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( 417 ), LAPTOP_SCREEN_WEB_UL_Y + ( 361 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)NextQuestionButtonCallback); + giNextQuestionButton = CreateIconAndTextButton( giNextQuestionButtonImage, pImpButtonText[ 13 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 417 ), LAPTOP_SCREEN_WEB_UL_Y + ( 361 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)NextQuestionButtonCallback); SpecifyButtonTextSubOffsets( giNextQuestionButton, 0, -1, FALSE ); @@ -256,7 +256,7 @@ void CreateIMPPersonalityQuizButtons( void ) DisableButton( giPreviousQuestionButton ); DisableButton( giNextQuestionButton ); - SetButtonCursor( giIMPPersonalityQuizButton[0], CURSOR_WWW ); + SetButtonCursor( giIMPPersonalityQuizButton[0], CURSOR_WWW ); SetButtonCursor( giIMPPersonalityQuizButton[1], CURSOR_WWW ); SetButtonCursor( giPreviousQuestionButton, CURSOR_WWW ); SetButtonCursor( giNextQuestionButton, CURSOR_WWW ); @@ -267,14 +267,14 @@ void CreateIMPPersonalityQuizButtons( void ) void DestroyIMPersonalityQuizButtons( void ) { // this function will destroy the buttons needed for the IMP personality quiz page - - // the done button - RemoveButton(giIMPPersonalityQuizButton[ 0 ] ); - UnloadButtonImage(giIMPPersonalityQuizButtonImage[ 0 ] ); - // the start over button + // the done button + RemoveButton(giIMPPersonalityQuizButton[ 0 ] ); + UnloadButtonImage(giIMPPersonalityQuizButtonImage[ 0 ] ); + + // the start over button RemoveButton(giIMPPersonalityQuizButton[ 1 ] ); - UnloadButtonImage(giIMPPersonalityQuizButtonImage[ 1 ] ); + UnloadButtonImage(giIMPPersonalityQuizButtonImage[ 1 ] ); // previosu button RemoveButton( giPreviousQuestionButton ); @@ -290,9 +290,9 @@ void DestroyIMPersonalityQuizButtons( void ) void CreateIMPPersonalityQuizAnswerButtons( void ) { - // this function will create the buttons for the personality quiz answer selections - - if( IMP_PERSONALITY_QUIZ != iCurrentImpPage ) + // this function will create the buttons for the personality quiz answer selections + + if( IMP_PERSONALITY_QUIZ != iCurrentImpPage ) { // not valid pagre, get out return; @@ -305,46 +305,46 @@ void CreateIMPPersonalityQuizAnswerButtons( void ) return; } - // destroy old screens buttons - DestroyPersonalityQuizButtons( ); - + // destroy old screens buttons + DestroyPersonalityQuizButtons( ); + // re-render screen RenderProfileBackGround( ); - switch( giCurrentPersonalityQuizQuestion ) - { + switch( giCurrentPersonalityQuizQuestion ) + { case ( -1 ): - // do nothing + // do nothing break; case ( 0 ): - // 6 buttons - iNumberOfPersonaButtons = 6; + // 6 buttons + iNumberOfPersonaButtons = 6; break; case ( 3 ): // 5 buttons iNumberOfPersonaButtons = 5; - break; + break; case ( 5 ): // 5 buttons iNumberOfPersonaButtons = 5; - break; + break; case ( 10 ): // 5 buttons iNumberOfPersonaButtons = 5; - break; + break; case ( 11 ): // 5 buttons iNumberOfPersonaButtons = 8; - break; + break; default: - // 4 buttons + // 4 buttons iNumberOfPersonaButtons = 4; break; } - - AddIMPPersonalityQuizAnswerButtons( iNumberOfPersonaButtons ); + + AddIMPPersonalityQuizAnswerButtons( iNumberOfPersonaButtons ); ToggleQuestionNumberButtonOn( iQuizAnswerList[ giCurrentPersonalityQuizQuestion ] ); @@ -363,37 +363,37 @@ void CreateIMPPersonalityQuizAnswerButtons( void ) void DestroyPersonalityQuizButtons( void ) { - - // this function will destroy the buttons used in the previous personality question - // destroy old buttons - switch( giPreviousPersonalityQuizQuestion ) + + // this function will destroy the buttons used in the previous personality question + // destroy old buttons + switch( giPreviousPersonalityQuizQuestion ) { case ( -1 ): // do nothing break; case ( 0 ): - // 6 buttons - DestroyIMPPersonalityQuizAnswerButtons( 6 ); + // 6 buttons + DestroyIMPPersonalityQuizAnswerButtons( 6 ); break; case ( 3 ): // 5 buttons - DestroyIMPPersonalityQuizAnswerButtons( 5 ); - break; + DestroyIMPPersonalityQuizAnswerButtons( 5 ); + break; case ( 5 ): // 5 buttons - DestroyIMPPersonalityQuizAnswerButtons( 5 ); - break; + DestroyIMPPersonalityQuizAnswerButtons( 5 ); + break; case ( 10 ): // 5 buttons - DestroyIMPPersonalityQuizAnswerButtons( 5 ); - break; + DestroyIMPPersonalityQuizAnswerButtons( 5 ); + break; case ( 11 ): // 5 buttons - DestroyIMPPersonalityQuizAnswerButtons( 8 ); - break; + DestroyIMPPersonalityQuizAnswerButtons( 8 ); + break; default: - // 4 buttons - DestroyIMPPersonalityQuizAnswerButtons( 4 ); + // 4 buttons + DestroyIMPPersonalityQuizAnswerButtons( 4 ); break; } @@ -402,80 +402,80 @@ void DestroyPersonalityQuizButtons( void ) void AddIMPPersonalityQuizAnswerButtons( INT32 iNumberOfButtons ) { - // will add iNumberofbuttons to the answer button list - INT32 iCounter = 0; - CHAR16 sString[ 32 ]; + // will add iNumberofbuttons to the answer button list + INT32 iCounter = 0; + CHAR16 sString[ 32 ]; for(iCounter = 0; iCounter < iNumberOfButtons; iCounter++) { - switch( iCounter ) + switch( iCounter ) { case ( 0 ): - giIMPPersonalityQuizAnswerButtonImage[0]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); - giIMPPersonalityQuizAnswerButton[0] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[0], LAPTOP_SCREEN_UL_X + ( BTN_FIRST_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 97 ), + giIMPPersonalityQuizAnswerButtonImage[0]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityQuizAnswerButton[0] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[0], LAPTOP_SCREEN_UL_X + ( BTN_FIRST_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 97 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 3, MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswer0Callback); break; case ( 1 ): - giIMPPersonalityQuizAnswerButtonImage[1]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); - giIMPPersonalityQuizAnswerButton[1] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[1], LAPTOP_SCREEN_UL_X + ( BTN_FIRST_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 147 ), + giIMPPersonalityQuizAnswerButtonImage[1]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityQuizAnswerButton[1] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[1], LAPTOP_SCREEN_UL_X + ( BTN_FIRST_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 147 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 3, MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswer1Callback); break; case ( 2 ): - giIMPPersonalityQuizAnswerButtonImage[2]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); - giIMPPersonalityQuizAnswerButton[2] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[2], LAPTOP_SCREEN_UL_X + ( BTN_FIRST_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 197 ), + giIMPPersonalityQuizAnswerButtonImage[2]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityQuizAnswerButton[2] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[2], LAPTOP_SCREEN_UL_X + ( BTN_FIRST_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 197 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 3, MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswer2Callback); break; case ( 3 ): - giIMPPersonalityQuizAnswerButtonImage[3]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); - giIMPPersonalityQuizAnswerButton[3] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[3], LAPTOP_SCREEN_UL_X + ( BTN_FIRST_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 247 ), + giIMPPersonalityQuizAnswerButtonImage[3]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityQuizAnswerButton[3] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[3], LAPTOP_SCREEN_UL_X + ( BTN_FIRST_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 247 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 3, MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswer3Callback); break; case ( 4 ): - giIMPPersonalityQuizAnswerButtonImage[4]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); - giIMPPersonalityQuizAnswerButton[4] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[4], LAPTOP_SCREEN_UL_X + ( BTN_SECOND_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 97 ), + giIMPPersonalityQuizAnswerButtonImage[4]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityQuizAnswerButton[4] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[4], LAPTOP_SCREEN_UL_X + ( BTN_SECOND_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 97 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswer4Callback); break; case ( 5 ): - giIMPPersonalityQuizAnswerButtonImage[5]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); - giIMPPersonalityQuizAnswerButton[5] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[5], LAPTOP_SCREEN_UL_X + ( BTN_SECOND_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 147 ), + giIMPPersonalityQuizAnswerButtonImage[5]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityQuizAnswerButton[5] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[5], LAPTOP_SCREEN_UL_X + ( BTN_SECOND_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 147 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 3, MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswer5Callback); break; case ( 6 ): - giIMPPersonalityQuizAnswerButtonImage[6]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); - giIMPPersonalityQuizAnswerButton[6] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[6], LAPTOP_SCREEN_UL_X + ( BTN_SECOND_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 197 ), + giIMPPersonalityQuizAnswerButtonImage[6]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityQuizAnswerButton[6] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[6], LAPTOP_SCREEN_UL_X + ( BTN_SECOND_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 197 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 3, MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswer6Callback); break; case ( 7 ): - giIMPPersonalityQuizAnswerButtonImage[7]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); - giIMPPersonalityQuizAnswerButton[7] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[7], LAPTOP_SCREEN_UL_X + ( BTN_SECOND_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 247 ), + giIMPPersonalityQuizAnswerButtonImage[7]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityQuizAnswerButton[7] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[7], LAPTOP_SCREEN_UL_X + ( BTN_SECOND_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 247 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 3, MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswer7Callback); break; case ( 8 ): - giIMPPersonalityQuizAnswerButtonImage[8]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); - giIMPPersonalityQuizAnswerButton[8] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[8], LAPTOP_SCREEN_UL_X + ( ( BTN_SECOND_COLUMN_X ) ), LAPTOP_SCREEN_WEB_UL_Y + ( 268 ), + giIMPPersonalityQuizAnswerButtonImage[8]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityQuizAnswerButton[8] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[8], LAPTOP_SCREEN_UL_X + ( ( BTN_SECOND_COLUMN_X ) ), LAPTOP_SCREEN_WEB_UL_Y + ( 268 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 3, MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswer8Callback); break; case ( 9 ): - giIMPPersonalityQuizAnswerButtonImage[9]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); - giIMPPersonalityQuizAnswerButton[9] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[9], LAPTOP_SCREEN_UL_X + ( ( 276 - 46 ) / 2 ), LAPTOP_SCREEN_WEB_UL_Y + ( 147 ), + giIMPPersonalityQuizAnswerButtonImage[9]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityQuizAnswerButton[9] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[9], LAPTOP_SCREEN_UL_X + ( ( 276 - 46 ) / 2 ), LAPTOP_SCREEN_WEB_UL_Y + ( 147 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 3, MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswer9Callback); @@ -483,30 +483,30 @@ void AddIMPPersonalityQuizAnswerButtons( INT32 iNumberOfButtons ) } swprintf( sString, L"%d", iCounter + 1 ); SpecifyButtonUpTextColors( giIMPPersonalityQuizAnswerButton[ iCounter ], FONT_WHITE, FONT_BLACK ); - SpecifyButtonDownTextColors( giIMPPersonalityQuizAnswerButton[ iCounter ], FONT_WHITE, FONT_BLACK ); + SpecifyButtonDownTextColors( giIMPPersonalityQuizAnswerButton[ iCounter ], FONT_WHITE, FONT_BLACK ); SpecifyButtonTextOffsets( giIMPPersonalityQuizAnswerButton[ iCounter ], +23, +12, TRUE ); SpecifyButtonFont( giIMPPersonalityQuizAnswerButton[ iCounter ], FONT12ARIAL ); SpecifyButtonText( giIMPPersonalityQuizAnswerButton[ iCounter ], sString ); - SetButtonCursor( giIMPPersonalityQuizAnswerButton[ iCounter ], CURSOR_WWW); + SetButtonCursor( giIMPPersonalityQuizAnswerButton[ iCounter ], CURSOR_WWW); } // previous is current - giPreviousPersonalityQuizQuestion = giCurrentPersonalityQuizQuestion; + giPreviousPersonalityQuizQuestion = giCurrentPersonalityQuizQuestion; return; } void DestroyIMPPersonalityQuizAnswerButtons(INT32 iNumberOfButtons ) { - INT32 iCounter = 0; + INT32 iCounter = 0; for(iCounter = 0; iCounter < iNumberOfButtons; iCounter++) { - RemoveButton(giIMPPersonalityQuizAnswerButton[ iCounter ] ); - UnloadButtonImage(giIMPPersonalityQuizAnswerButtonImage[ iCounter ] ); - giIMPPersonalityQuizAnswerButton[ iCounter ] = -1; + RemoveButton(giIMPPersonalityQuizAnswerButton[ iCounter ] ); + UnloadButtonImage(giIMPPersonalityQuizAnswerButtonImage[ iCounter ] ); + giIMPPersonalityQuizAnswerButton[ iCounter ] = -1; } - + return; } @@ -524,23 +524,23 @@ void BtnIMPPersonalityQuizAnswer0Callback(GUI_BUTTON *btn,INT32 reason) if (btn->uiFlags & BUTTON_CLICKED_ON) { - // reset buttons + // reset buttons ResetQuizAnswerButtons( ); // ok, check to see if button was disabled, if so, re enable - CheckStateOfTheConfirmButton( ); + CheckStateOfTheConfirmButton( ); iCurrentAnswer = 0; // now set this button on - btn->uiFlags|=(BUTTON_CLICKED_ON); - - + btn->uiFlags|=(BUTTON_CLICKED_ON); + + // highlight answer - PrintImpText( ); - + PrintImpText( ); + // the current and last question numbers - PrintQuizQuestionNumber( ); + PrintQuizQuestionNumber( ); fReDrawCharProfile = TRUE; } @@ -561,23 +561,23 @@ void BtnIMPPersonalityQuizAnswer1Callback(GUI_BUTTON *btn,INT32 reason) if (btn->uiFlags & BUTTON_CLICKED_ON) { - // reset buttons + // reset buttons ResetQuizAnswerButtons( ); // now set this button on - btn->uiFlags|=(BUTTON_CLICKED_ON); - + btn->uiFlags|=(BUTTON_CLICKED_ON); + // ok, check to see if button was disabled, if so, re enable - CheckStateOfTheConfirmButton( ); + CheckStateOfTheConfirmButton( ); iCurrentAnswer = 1; // highlight answer - PrintImpText( ); + PrintImpText( ); // the current and last question numbers - PrintQuizQuestionNumber( ); - + PrintQuizQuestionNumber( ); + fReDrawCharProfile = TRUE; } } @@ -596,25 +596,25 @@ void BtnIMPPersonalityQuizAnswer2Callback(GUI_BUTTON *btn,INT32 reason) if (btn->uiFlags & BUTTON_CLICKED_ON) { - // reset buttons + // reset buttons ResetQuizAnswerButtons( ); // now set this button on - btn->uiFlags|=(BUTTON_CLICKED_ON); - + btn->uiFlags|=(BUTTON_CLICKED_ON); + // ok, check to see if button was disabled, if so, re enable - CheckStateOfTheConfirmButton( ); + CheckStateOfTheConfirmButton( ); iCurrentAnswer = 2; // highlight answer - PrintImpText( ); + PrintImpText( ); // the current and last question numbers - PrintQuizQuestionNumber( ); + PrintQuizQuestionNumber( ); fReDrawCharProfile = TRUE; - + } } } @@ -632,26 +632,26 @@ void BtnIMPPersonalityQuizAnswer3Callback(GUI_BUTTON *btn,INT32 reason) if (btn->uiFlags & BUTTON_CLICKED_ON) { - // reset buttons + // reset buttons ResetQuizAnswerButtons( ); // now set this button on - btn->uiFlags|=(BUTTON_CLICKED_ON); - + btn->uiFlags|=(BUTTON_CLICKED_ON); + // ok, check to see if button was disabled, if so, re enable - CheckStateOfTheConfirmButton( ); + CheckStateOfTheConfirmButton( ); iCurrentAnswer = 3; - - + + // highlight answer - PrintImpText( ); + PrintImpText( ); // the current and last question numbers - PrintQuizQuestionNumber( ); + PrintQuizQuestionNumber( ); fReDrawCharProfile = TRUE; - + } } } @@ -669,25 +669,25 @@ void BtnIMPPersonalityQuizAnswer4Callback(GUI_BUTTON *btn,INT32 reason) if (btn->uiFlags & BUTTON_CLICKED_ON) { - // reset buttons + // reset buttons ResetQuizAnswerButtons( ); // now set this button on - btn->uiFlags|=(BUTTON_CLICKED_ON); - + btn->uiFlags|=(BUTTON_CLICKED_ON); + // ok, check to see if button was disabled, if so, re enable - CheckStateOfTheConfirmButton( ); + CheckStateOfTheConfirmButton( ); iCurrentAnswer = 4; // highlight answer - PrintImpText( ); + PrintImpText( ); // the current and last question numbers - PrintQuizQuestionNumber( ); + PrintQuizQuestionNumber( ); fReDrawCharProfile = TRUE; - + } } } @@ -705,26 +705,26 @@ void BtnIMPPersonalityQuizAnswer5Callback(GUI_BUTTON *btn,INT32 reason) if (btn->uiFlags & BUTTON_CLICKED_ON) { - // reset buttons + // reset buttons ResetQuizAnswerButtons( ); // now set this button on - btn->uiFlags|=(BUTTON_CLICKED_ON); - + btn->uiFlags|=(BUTTON_CLICKED_ON); + // ok, check to see if button was disabled, if so, re enable - CheckStateOfTheConfirmButton( ); + CheckStateOfTheConfirmButton( ); iCurrentAnswer = 5; // highlight answer - PrintImpText( ); - + PrintImpText( ); + // the current and last question numbers - PrintQuizQuestionNumber( ); + PrintQuizQuestionNumber( ); fReDrawCharProfile = TRUE; - + } } } @@ -742,25 +742,25 @@ void BtnIMPPersonalityQuizAnswer6Callback(GUI_BUTTON *btn,INT32 reason) if (btn->uiFlags & BUTTON_CLICKED_ON) { - // reset buttons + // reset buttons ResetQuizAnswerButtons( ); // now set this button on - btn->uiFlags|=(BUTTON_CLICKED_ON); - + btn->uiFlags|=(BUTTON_CLICKED_ON); + // ok, check to see if button was disabled, if so, re enable - CheckStateOfTheConfirmButton( ); + CheckStateOfTheConfirmButton( ); iCurrentAnswer = 6; // highlight answer - PrintIMPPersonalityQuizQuestionAndAnsers( ); + PrintIMPPersonalityQuizQuestionAndAnsers( ); // the current and last question numbers - PrintQuizQuestionNumber( ); + PrintQuizQuestionNumber( ); fReDrawCharProfile = TRUE; - + } } } @@ -778,23 +778,23 @@ void BtnIMPPersonalityQuizAnswer7Callback(GUI_BUTTON *btn,INT32 reason) if (btn->uiFlags & BUTTON_CLICKED_ON) { - // reset buttons + // reset buttons ResetQuizAnswerButtons( ); // now set this button on - btn->uiFlags|=(BUTTON_CLICKED_ON); - + btn->uiFlags|=(BUTTON_CLICKED_ON); + // ok, check to see if button was disabled, if so, re enable - CheckStateOfTheConfirmButton( ); + CheckStateOfTheConfirmButton( ); iCurrentAnswer = 7; - + // redraw text PrintImpText( ); // the current and last question numbers - PrintQuizQuestionNumber( ); - + PrintQuizQuestionNumber( ); + fReDrawCharProfile = TRUE; } } @@ -813,24 +813,24 @@ void BtnIMPPersonalityQuizAnswer8Callback(GUI_BUTTON *btn,INT32 reason) if (btn->uiFlags & BUTTON_CLICKED_ON) { - // reset buttons + // reset buttons ResetQuizAnswerButtons( ); // now set this button on - btn->uiFlags|=(BUTTON_CLICKED_ON); - + btn->uiFlags|=(BUTTON_CLICKED_ON); + // ok, check to see if button was disabled, if so, re enable - CheckStateOfTheConfirmButton( ); + CheckStateOfTheConfirmButton( ); iCurrentAnswer = 8; - + PrintImpText( ); // the current and last question numbers - PrintQuizQuestionNumber( ); + PrintQuizQuestionNumber( ); fReDrawCharProfile = TRUE; - + } } } @@ -848,23 +848,23 @@ void BtnIMPPersonalityQuizAnswer9Callback(GUI_BUTTON *btn,INT32 reason) if (btn->uiFlags & BUTTON_CLICKED_ON) { - // reset buttons + // reset buttons ResetQuizAnswerButtons( ); // now set this button on - btn->uiFlags|=(BUTTON_CLICKED_ON); - + btn->uiFlags|=(BUTTON_CLICKED_ON); + // ok, check to see if button was disabled, if so, re enable - CheckStateOfTheConfirmButton( ); + CheckStateOfTheConfirmButton( ); iCurrentAnswer = 9; // highlight answer - PrintIMPPersonalityQuizQuestionAndAnsers( ); + PrintIMPPersonalityQuizQuestionAndAnsers( ); // the current and last question numbers - PrintQuizQuestionNumber( ); - + PrintQuizQuestionNumber( ); + } } } @@ -883,16 +883,16 @@ void BtnIMPPersonalityQuizAnswerConfirmCallback(GUI_BUTTON *btn,INT32 reason) if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); - + btn->uiFlags|=(BUTTON_CLICKED_ON); + } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - - btn->uiFlags&=~(BUTTON_CLICKED_ON); - + + btn->uiFlags&=~(BUTTON_CLICKED_ON); + if( iCurrentAnswer != -1) { @@ -900,18 +900,18 @@ void BtnIMPPersonalityQuizAnswerConfirmCallback(GUI_BUTTON *btn,INT32 reason) ResetQuizAnswerButtons( ); // copy the answer into the list - iQuizAnswerList[ giCurrentPersonalityQuizQuestion ] = iCurrentAnswer; + iQuizAnswerList[ giCurrentPersonalityQuizQuestion ] = iCurrentAnswer; // reset answer for next question iCurrentAnswer = -1; - + // next question, JOHNNY! if( giCurrentPersonalityQuizQuestion == giMaxPersonalityQuizQuestion ) { giMaxPersonalityQuizQuestion++; } - giCurrentPersonalityQuizQuestion++; + giCurrentPersonalityQuizQuestion++; CheckAndUpdateNextPreviousIMPQuestionButtonStates(); // OPPS!, done..time to finish up @@ -937,18 +937,18 @@ void BtnIMPPersonalityQuizStartOverCallback(GUI_BUTTON *btn,INT32 reason) if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); - + btn->uiFlags|=(BUTTON_CLICKED_ON); + } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - - btn->uiFlags&=~(BUTTON_CLICKED_ON); + + btn->uiFlags&=~(BUTTON_CLICKED_ON); giPreviousPersonalityQuizQuestion = giCurrentPersonalityQuizQuestion; giMaxPersonalityQuizQuestion = 0; - fStartOverFlag = TRUE; + fStartOverFlag = TRUE; iCurrentImpPage = IMP_PERSONALITY; fButtonPendingFlag = TRUE; @@ -961,45 +961,45 @@ void ResetQuizAnswerButtons( void ) { INT32 iCounter = 0; - INT32 iCnt = 0; - + INT32 iCnt = 0; + // how many buttons to reset? - switch( giCurrentPersonalityQuizQuestion ) + switch( giCurrentPersonalityQuizQuestion ) { case ( -1 ): // do nothing return; break; case ( 0 ): - // 6 buttons - iCounter =6; + // 6 buttons + iCounter =6; break; case ( 3 ): // 5 buttons - iCounter = 5; - break; + iCounter = 5; + break; case ( 5 ): - // 6 buttons + // 6 buttons iCounter = 5; break; case ( 10 ): - // 6 buttons + // 6 buttons iCounter = 5; break; case ( 11 ): // 9 buttons - iCounter = 8; + iCounter = 8; break; default: - // 4 buttons - iCounter = 4; + // 4 buttons + iCounter = 4; break; } // now run through and reset the buttons for(iCnt = 0; iCnt < iCounter; iCnt++) - { - ButtonList[ giIMPPersonalityQuizAnswerButton[ iCnt ] ]->uiFlags &= ~(BUTTON_CLICKED_ON); + { + ButtonList[ giIMPPersonalityQuizAnswerButton[ iCnt ] ]->uiFlags &= ~(BUTTON_CLICKED_ON); } return; @@ -1008,19 +1008,19 @@ void ResetQuizAnswerButtons( void ) void CompileQuestionsInStatsAndWhatNot( void ) { - // one BIG case/switch statement to determine what values are added where - INT32 iCurrentQuestion = 0; - + // one BIG case/switch statement to determine what values are added where + INT32 iCurrentQuestion = 0; + for( iCurrentQuestion= 0; iCurrentQuestion < MAX_NUMBER_OF_IMP_QUESTIONS; iCurrentQuestion++ ) { switch( iCurrentQuestion ) { - - // ok, run throught he list of questions - case ( 0 ): - switch( iQuizAnswerList[ iCurrentQuestion ] ) + + // ok, run throught he list of questions + case ( 0 ): + switch( iQuizAnswerList[ iCurrentQuestion ] ) { - case( 0 ): + case( 0 ): if( fCharacterIsMale ) { // Martial arts @@ -1031,241 +1031,241 @@ void CompileQuestionsInStatsAndWhatNot( void ) // for women, ambidexterious AddSkillToSkillList( AMBIDEXT ); } - break; - case( 1 ): - AddAnAttitudeToAttitudeList( ATT_LONER ); + break; + case( 1 ): + AddAnAttitudeToAttitudeList( ATT_LONER ); break; case( 2 ): // hand to hand AddSkillToSkillList( HANDTOHAND ); break; - case( 3 ): - // lock picking - AddSkillToSkillList( LOCKPICKING ); + case( 3 ): + // lock picking + AddSkillToSkillList( LOCKPICKING ); break; case( 4 ): - // throwing + // throwing AddSkillToSkillList( THROWING ); break; case( 5 ): - // optimist - AddAnAttitudeToAttitudeList( ATT_OPTIMIST ); + // optimist + AddAnAttitudeToAttitudeList( ATT_OPTIMIST ); break; } - break; - case ( 1 ): + break; + case ( 1 ): switch( iQuizAnswerList[ iCurrentQuestion ] ) { - case( 0 ): + case( 0 ): // teaching - AddSkillToSkillList( TEACHING ); - break; - case( 1 ): - AddSkillToSkillList( STEALTHY ); + AddSkillToSkillList( TEACHING ); + break; + case( 1 ): + AddSkillToSkillList( STEALTHY ); break; case( 2 ): - // psycho + // psycho AddAPersonalityToPersonalityList( PSYCHO ); break; - case( 3 ): - AddAnAttitudeToAttitudeList( ATT_FRIENDLY ); - break; + case( 3 ): + AddAnAttitudeToAttitudeList( ATT_FRIENDLY ); + break; } - break; - case ( 2 ): + break; + case ( 2 ): switch( iQuizAnswerList[ iCurrentQuestion ] ) { - case( 0 ): + case( 0 ): // lock picking - AddSkillToSkillList( LOCKPICKING ); - break; - case( 1 ): - // arrogant + AddSkillToSkillList( LOCKPICKING ); + break; + case( 1 ): + // arrogant AddAnAttitudeToAttitudeList( ATT_ARROGANT ); break; - case( 2 ): + case( 2 ): AddSkillToSkillList( STEALTHY ); break; - case( 3 ): + case( 3 ): // normal AddAnAttitudeToAttitudeList( ATT_NORMAL ); break; - - } - break; - case ( 3 ): + + } + break; + case ( 3 ): switch( iQuizAnswerList[ iCurrentQuestion ] ) { - case( 0 ): + case( 0 ): // automatic weapons - AddSkillToSkillList( AUTO_WEAPS ); - break; - case( 1 ): + AddSkillToSkillList( AUTO_WEAPS ); + break; + case( 1 ): // friendly - AddAnAttitudeToAttitudeList( ATT_FRIENDLY ); + AddAnAttitudeToAttitudeList( ATT_FRIENDLY ); break; case( 2 ): // normal AddAnAttitudeToAttitudeList( ATT_NORMAL ); break; - case( 3 ): + case( 3 ): // asshole - AddAnAttitudeToAttitudeList( ATT_ASSHOLE ); + AddAnAttitudeToAttitudeList( ATT_ASSHOLE ); break; case( 4 ): - AddAnAttitudeToAttitudeList( ATT_LONER ); + AddAnAttitudeToAttitudeList( ATT_LONER ); break; - + } - break; - case ( 4 ): + break; + case ( 4 ): switch( iQuizAnswerList[ iCurrentQuestion ] ) { - case( 0 ): - // coward + case( 0 ): + // coward AddAnAttitudeToAttitudeList( ATT_COWARD ); - break; - case( 1 ): + break; + case( 1 ): // none break; case( 2 ): // aggressive AddAnAttitudeToAttitudeList( ATT_AGGRESSIVE ); break; - case( 3 ): + case( 3 ): // none break; } - break; - case ( 5 ): + break; + case ( 5 ): switch( iQuizAnswerList[ iCurrentQuestion ] ) { - case( 0 ): - // coward + case( 0 ): + // coward AddAnAttitudeToAttitudeList( ATT_COWARD ); - break; - case( 1 ): + break; + case( 1 ): AddSkillToSkillList( NIGHTOPS ); break; case( 2 ): // dont like boxes much - AddAPersonalityToPersonalityList( CLAUSTROPHOBIC ); + AddAPersonalityToPersonalityList( CLAUSTROPHOBIC ); break; - case( 3 ): - // none + case( 3 ): + // none break; case( 4 ): - // none + // none break; } - break; - case ( 6 ): + break; + case ( 6 ): switch( iQuizAnswerList[ iCurrentQuestion ] ) { - case( 0 ): + case( 0 ): // electronics - AddSkillToSkillList( ELECTRONICS ); - break; - case( 1 ): + AddSkillToSkillList( ELECTRONICS ); + break; + case( 1 ): //knifing - AddSkillToSkillList( KNIFING ); + AddSkillToSkillList( KNIFING ); break; case( 2 ): - AddSkillToSkillList( NIGHTOPS ); + AddSkillToSkillList( NIGHTOPS ); break; - case( 3 ): - // none + case( 3 ): + // none break; } - break; - case ( 7 ): + break; + case ( 7 ): switch( iQuizAnswerList[ iCurrentQuestion ] ) { - case( 0 ): + case( 0 ): // ambidexterous AddSkillToSkillList( AMBIDEXT ); - break; - case( 1 ): - // none + break; + case( 1 ): + // none break; case( 2 ): - // optimist - AddAnAttitudeToAttitudeList( ATT_OPTIMIST ); + // optimist + AddAnAttitudeToAttitudeList( ATT_OPTIMIST ); break; - case( 3 ): - // psycho + case( 3 ): + // psycho AddAPersonalityToPersonalityList( PSYCHO ); break; } - break; - case ( 8 ): + break; + case ( 8 ): switch( iQuizAnswerList[ iCurrentQuestion ] ) { - case( 0 ): + case( 0 ): // forgetful AddAPersonalityToPersonalityList( FORGETFUL ); - break; - case( 1 ): + break; + case( 1 ): // none case( 2 ): // pessimist AddAnAttitudeToAttitudeList( ATT_PESSIMIST ); break; - case( 3 ): - // nervous + case( 3 ): + // nervous AddAPersonalityToPersonalityList( NERVOUS ); break; } - break; - case ( 9 ): - + break; + case ( 9 ): + switch( iQuizAnswerList[ iCurrentQuestion ] ) { - case( 0 ): + case( 0 ): // none - break; - case( 1 ): - // pessimist + break; + case( 1 ): + // pessimist AddAnAttitudeToAttitudeList( ATT_PESSIMIST ); break; case( 2 ): // asshole - AddAnAttitudeToAttitudeList( ATT_ASSHOLE ); + AddAnAttitudeToAttitudeList( ATT_ASSHOLE ); break; - case( 3 ): - // nervous + case( 3 ): + // nervous AddAPersonalityToPersonalityList( NERVOUS ); break; } - break; - case ( 10 ): + break; + case ( 10 ): switch( iQuizAnswerList[ iCurrentQuestion ] ) { case( 0 ): - // none - break; - case( 1 ): - // teaching - AddSkillToSkillList( TEACHING ); + // none + break; + case( 1 ): + // teaching + AddSkillToSkillList( TEACHING ); break; case( 2 ): - // aggressive + // aggressive AddAnAttitudeToAttitudeList( ATT_AGGRESSIVE ); break; - case( 3 ): - // normal + case( 3 ): + // normal AddAnAttitudeToAttitudeList( ATT_NORMAL ); break; case( 4 ): // none break; } - break; - case ( 11 ): + break; + case ( 11 ): switch( iQuizAnswerList[ iCurrentQuestion ] ) { - case( 0 ): + case( 0 ): if( fCharacterIsMale ) { // Martial arts @@ -1276,302 +1276,302 @@ void CompileQuestionsInStatsAndWhatNot( void ) // for women, ambidexterious AddSkillToSkillList( AMBIDEXT ); } - break; - case( 1 ): + break; + case( 1 ): //knifing - AddSkillToSkillList( KNIFING ); + AddSkillToSkillList( KNIFING ); break; case( 2 ): - // none + // none break; - case( 3 ): + case( 3 ): // automatic weapons - AddSkillToSkillList( AUTO_WEAPS ); + AddSkillToSkillList( AUTO_WEAPS ); break; case( 4 ): // hand to hand AddSkillToSkillList( HANDTOHAND ); break; case( 5 ): - // electronics - AddSkillToSkillList( ELECTRONICS ); + // electronics + AddSkillToSkillList( ELECTRONICS ); break; case( 6 ): - // ashole + // ashole break; case( 7 ): - // none + // none break; } - break; - case ( 12 ): + break; + case ( 12 ): switch( iQuizAnswerList[ iCurrentQuestion ] ) { - case( 0 ): - // forgetful + case( 0 ): + // forgetful AddAPersonalityToPersonalityList( FORGETFUL ); break; - case( 1 ): - // normal + case( 1 ): + // normal AddAnAttitudeToAttitudeList( ATT_NORMAL ); break; case( 2 ): // normal AddAnAttitudeToAttitudeList( ATT_NORMAL ); break; - case( 3 ): - // heat problems - AddAPersonalityToPersonalityList( HEAT_INTOLERANT ); + case( 3 ): + // heat problems + AddAPersonalityToPersonalityList( HEAT_INTOLERANT ); break; } - break; - case ( 13 ): + break; + case ( 13 ): switch( iQuizAnswerList[ iCurrentQuestion ] ) { - case( 0 ): + case( 0 ): // dont like boxes much - AddAPersonalityToPersonalityList( CLAUSTROPHOBIC ); - break; - case( 1 ): + AddAPersonalityToPersonalityList( CLAUSTROPHOBIC ); + break; + case( 1 ): // normal AddAnAttitudeToAttitudeList( ATT_NORMAL ); break; case( 2 ): - // heat problems - AddAPersonalityToPersonalityList( HEAT_INTOLERANT ); + // heat problems + AddAPersonalityToPersonalityList( HEAT_INTOLERANT ); break; - case( 3 ): - // none + case( 3 ): + // none break; } - break; - case ( 14 ): + break; + case ( 14 ): switch( iQuizAnswerList[ iCurrentQuestion ] ) { - case( 0 ): + case( 0 ): // throwing - AddSkillToSkillList( THROWING ); - break; - case( 1 ): + AddSkillToSkillList( THROWING ); + break; + case( 1 ): // ambidexterous AddSkillToSkillList( AMBIDEXT ); break; case( 3 ): - // none + // none break; - case( 2 ): - AddAnAttitudeToAttitudeList( ATT_ARROGANT ); + case( 2 ): + AddAnAttitudeToAttitudeList( ATT_ARROGANT ); break; - + } - break; - case ( 15 ): + break; + case ( 15 ): switch( iQuizAnswerList[ iCurrentQuestion ] ) { - case( 0 ): + case( 0 ): // none ! - break; - case( 1 ): + break; + case( 1 ): // none ! break; case( 2 ): // none ! break; - case( 3 ): + case( 3 ): // none ! break; } - break; + break; } - } + } } void BltAnswerIndents( INT32 iNumberOfIndents ) { - INT32 iCounter = 0; - - + INT32 iCounter = 0; + + // the question indent - RenderQtnIndentFrame( 15, 20 ); + RenderQtnIndentFrame( 15, 20 ); - // the answers + // the answers for( iCounter = 0; iCounter < iNumberOfIndents; iCounter++) { switch( iCounter ) { - case( 0 ): - if( iNumberOfIndents < 5 ) + case( 0 ): + if( iNumberOfIndents < 5 ) { - RenderQtnLongIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 93); - + RenderQtnLongIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 93); + if( iCurrentAnswer == iCounter ) { RenderQtnLongIndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 93 ); } } - else + else { - RenderQtnShortIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 93); - + RenderQtnShortIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 93); + if( iCurrentAnswer == iCounter ) { RenderQtnShortIndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 93 ); } } - break; - case( 1 ): - if( iNumberOfIndents < 5 ) + break; + case( 1 ): + if( iNumberOfIndents < 5 ) { - RenderQtnLongIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 143); - + RenderQtnLongIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 143); + if( iCurrentAnswer == iCounter ) { RenderQtnLongIndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 143 ); } } - else + else { - RenderQtnShortIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 143); - + RenderQtnShortIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 143); + if( iCurrentAnswer == iCounter ) { RenderQtnShortIndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 143 ); } } - break; - case( 2 ): - if( iNumberOfIndents < 5 ) + break; + case( 2 ): + if( iNumberOfIndents < 5 ) { - RenderQtnLongIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 193); - + RenderQtnLongIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 193); + if( iCurrentAnswer == iCounter ) { - RenderQtnLongIndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 193 ); + RenderQtnLongIndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 193 ); } } - else + else { - RenderQtnShortIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 193); - + RenderQtnShortIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 193); + if( iCurrentAnswer == iCounter ) { - RenderQtnShortIndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 193 ); + RenderQtnShortIndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 193 ); } } - break; - case( 3 ): + break; + case( 3 ): // is this question # 6 ..if so, need longer answer box if( ( giCurrentPersonalityQuizQuestion == 5) ) { // render longer frame RenderQtnShort2IndentFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 243 ); - + // is this answer currently selected? if( iCurrentAnswer == iCounter ) { // need to highlight - RenderQtnShort2IndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 243 ); + RenderQtnShort2IndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 243 ); } // done break; } - if( iNumberOfIndents < 5 ) + if( iNumberOfIndents < 5 ) { - RenderQtnLongIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 243); - - if( iCurrentAnswer == iCounter ) - { - RenderQtnLongIndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 243 ); - } - } - else - { - RenderQtnShortIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 243); - - if( iCurrentAnswer == iCounter ) - { - RenderQtnShortIndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 243 ); - } - } - break; - case( 4 ): + RenderQtnLongIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 243); - //is this question # 14 or 21?..if so, need longer answer box - if( ( giCurrentPersonalityQuizQuestion == 10)||( giCurrentPersonalityQuizQuestion == 5 ) ) + if( iCurrentAnswer == iCounter ) { - // render longer frame - RenderQtnShort2IndentFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 93 ); - + RenderQtnLongIndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 243 ); + } + } + else + { + RenderQtnShortIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 243); + + if( iCurrentAnswer == iCounter ) + { + RenderQtnShortIndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 243 ); + } + } + break; + case( 4 ): + + //is this question # 14 or 21?..if so, need longer answer box + if( ( giCurrentPersonalityQuizQuestion == 10)||( giCurrentPersonalityQuizQuestion == 5 ) ) + { + // render longer frame + RenderQtnShort2IndentFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 93 ); + // is this answer currently selected? - if( iCurrentAnswer == iCounter ) + if( iCurrentAnswer == iCounter ) { - // need to highlight - RenderQtnShort2IndentHighFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 93 ); + // need to highlight + RenderQtnShort2IndentHighFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 93 ); } - // done - break; + // done + break; } - - RenderQtnShortIndentFrame(BTN_SECOND_COLUMN_X + INDENT_OFFSET, 93); - - if( iCurrentAnswer == iCounter ) - { - RenderQtnShortIndentHighFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 93 ); - } - break; - case( 5 ): + + RenderQtnShortIndentFrame(BTN_SECOND_COLUMN_X + INDENT_OFFSET, 93); + + if( iCurrentAnswer == iCounter ) + { + RenderQtnShortIndentHighFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 93 ); + } + break; + case( 5 ): // special case?..longer frame needed if so - if( ( giCurrentPersonalityQuizQuestion == 19) ) - { - // render longer frame - RenderQtnShort2IndentFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 143 ); - + if( ( giCurrentPersonalityQuizQuestion == 19) ) + { + // render longer frame + RenderQtnShort2IndentFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 143 ); + // is this answer currently selected? - if( iCurrentAnswer == iCounter ) + if( iCurrentAnswer == iCounter ) { - // need to highlight - RenderQtnShort2IndentHighFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 143 ); + // need to highlight + RenderQtnShort2IndentHighFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 143 ); } - // done - break; + // done + break; } - RenderQtnShortIndentFrame(BTN_SECOND_COLUMN_X + INDENT_OFFSET, 143); - if( iCurrentAnswer == iCounter ) - { - RenderQtnShortIndentHighFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 143 ); - } - break; - case( 6 ): - RenderQtnShortIndentFrame(BTN_SECOND_COLUMN_X + INDENT_OFFSET, 193); - if( iCurrentAnswer == iCounter ) - { - RenderQtnShortIndentHighFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 193 ); - } - break; - case( 7 ): - RenderQtnShortIndentFrame(BTN_SECOND_COLUMN_X + INDENT_OFFSET, 243); - if( iCurrentAnswer == iCounter ) - { - RenderQtnShortIndentHighFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 243 ); - } - break; - case( 8 ): - break; + RenderQtnShortIndentFrame(BTN_SECOND_COLUMN_X + INDENT_OFFSET, 143); + if( iCurrentAnswer == iCounter ) + { + RenderQtnShortIndentHighFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 143 ); + } + break; + case( 6 ): + RenderQtnShortIndentFrame(BTN_SECOND_COLUMN_X + INDENT_OFFSET, 193); + if( iCurrentAnswer == iCounter ) + { + RenderQtnShortIndentHighFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 193 ); + } + break; + case( 7 ): + RenderQtnShortIndentFrame(BTN_SECOND_COLUMN_X + INDENT_OFFSET, 243); + if( iCurrentAnswer == iCounter ) + { + RenderQtnShortIndentHighFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 243 ); + } + break; + case( 8 ): + break; } } } void PrintQuizQuestionNumber( void ) { - // this function will print the number of the current question and the numebr of questions + // this function will print the number of the current question and the numebr of questions CHAR16 sString[ 10 ]; @@ -1583,20 +1583,20 @@ void PrintQuizQuestionNumber( void ) // get current question number into a string swprintf(sString, L"%d", giCurrentPersonalityQuizQuestion + 1); - - // print current question number - mprintf( LAPTOP_SCREEN_UL_X + 345 , LAPTOP_SCREEN_WEB_UL_Y + 370 ,sString); - // total number of questions - mprintf( LAPTOP_SCREEN_UL_X + 383 , LAPTOP_SCREEN_WEB_UL_Y + 370 , L"16"); - return; + // print current question number + mprintf( LAPTOP_SCREEN_UL_X + 345 , LAPTOP_SCREEN_WEB_UL_Y + 370 ,sString); + + // total number of questions + mprintf( LAPTOP_SCREEN_UL_X + 383 , LAPTOP_SCREEN_WEB_UL_Y + 370 , L"16"); + return; } void CheckStateOfTheConfirmButton( void ) { - // will check the state of the confirm button, should it be enabled or disabled? + // will check the state of the confirm button, should it be enabled or disabled? if( iCurrentAnswer == -1 ) { // was disabled, enable @@ -1609,18 +1609,18 @@ void CheckStateOfTheConfirmButton( void ) void HandleIMPQuizKeyBoard( void ) { InputAtom InputEvent; - POINT MousePos; + POINT MousePos; BOOLEAN fSkipFrame = FALSE; GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! + ScreenToClient(ghWindow, &MousePos); // In window coords! - while( ( DequeueEvent(&InputEvent) == TRUE ) ) - { + while( ( DequeueEvent(&InputEvent) == TRUE ) ) + { if( fSkipFrame == FALSE ) { // HOOK INTO MOUSE HOOKS - + /* if( (InputEvent.usEvent == KEY_DOWN ) && ( InputEvent.usParam >= '1' ) && ( InputEvent.usParam <= '9') ) @@ -1632,12 +1632,12 @@ void HandleIMPQuizKeyBoard( void ) // ok, check to see if button was disabled, if so, re enable CheckStateOfTheConfirmButton( ); - + // toggle this button on ButtonList[ giIMPPersonalityQuizAnswerButton[ InputEvent.usParam - '1' ] ]->uiFlags |= (BUTTON_CLICKED_ON); iCurrentAnswer = InputEvent.usParam - '1'; - + PrintImpText( ); // the current and last question numbers @@ -1657,7 +1657,7 @@ void HandleIMPQuizKeyBoard( void ) // reset answer for next question iCurrentAnswer = -1; - + // next question, JOHNNY! giCurrentPersonalityQuizQuestion++; giMaxPersonalityQuizQuestion++; @@ -1668,7 +1668,7 @@ void HandleIMPQuizKeyBoard( void ) { iCurrentImpPage = IMP_PERSONALITY_FINISH; // process - CompileQuestionsInStatsAndWhatNot( ); + CompileQuestionsInStatsAndWhatNot( ); } fSkipFrame = TRUE; @@ -1685,32 +1685,32 @@ void HandleIMPQuizKeyBoard( void ) } else { - + */ switch(InputEvent.usEvent) { case LEFT_BUTTON_DOWN: MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); - + break; case LEFT_BUTTON_UP: - MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); - + MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); + break; case RIGHT_BUTTON_DOWN: MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); - + break; - case RIGHT_BUTTON_UP: - MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); - + case RIGHT_BUTTON_UP: + MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; - case RIGHT_BUTTON_REPEAT: - MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); - + case RIGHT_BUTTON_REPEAT: + MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; - case LEFT_BUTTON_REPEAT: - MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); - + case LEFT_BUTTON_REPEAT: + MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; default: HandleKeyBoardShortCutsForLapTop( InputEvent.usEvent, InputEvent.usParam, InputEvent.usKeyState ); @@ -1811,7 +1811,7 @@ void ToggleQuestionNumberButtonOn( INT32 iAnswerNumber ) { // reset buttons ResetQuizAnswerButtons( ); - + // toggle this button on ButtonList[ giIMPPersonalityQuizAnswerButton[ iAnswerNumber ] ]->uiFlags |= (BUTTON_CLICKED_ON); iCurrentAnswer = iAnswerNumber; @@ -1824,18 +1824,18 @@ void ToggleQuestionNumberButtonOn( INT32 iAnswerNumber ) void PreviousQuestionButtonCallback( GUI_BUTTON *btn, INT32 iReason ) { if (!(btn->uiFlags & BUTTON_ENABLED)) - return; + return; if( iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { MoveBackAQuestion( ); - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); } } return; @@ -1845,19 +1845,19 @@ void PreviousQuestionButtonCallback( GUI_BUTTON *btn, INT32 iReason ) void NextQuestionButtonCallback( GUI_BUTTON *btn, INT32 iReason ) { if (!(btn->uiFlags & BUTTON_ENABLED)) - return; + return; if( iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { MoveAheadAQuestion( ); - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); } } return; -} \ No newline at end of file +} diff --git a/Laptop/IMP Portraits.cpp b/Laptop/IMP Portraits.cpp index 28b85b14..a143f725 100644 --- a/Laptop/IMP Portraits.cpp +++ b/Laptop/IMP Portraits.cpp @@ -51,10 +51,10 @@ void BtnIMPPortraitDoneCallback(GUI_BUTTON *btn,INT32 reason); void EnterIMPPortraits( void ) { - + // create buttons CreateIMPPortraitButtons( ); - + // render background RenderIMPPortraits( ); @@ -65,9 +65,9 @@ void EnterIMPPortraits( void ) void RenderIMPPortraits( void ) { - - // render background + + // render background RenderProfileBackGround( ); // the Voices frame @@ -77,8 +77,8 @@ void RenderIMPPortraits( void ) RenderPortrait( 200, 176 ); // indent for the text - RenderAttrib1IndentFrame( 128, 65); - + RenderAttrib1IndentFrame( 128, 65); + // text PrintImpText( ); @@ -89,7 +89,7 @@ void RenderIMPPortraits( void ) void ExitIMPPortraits( void ) { // destroy buttons for IMP portrait page - DestroyIMPPortraitButtons( ); + DestroyIMPPortraitButtons( ); return; } @@ -98,10 +98,10 @@ void HandleIMPPortraits( void ) { // do we need to re write screen - if ( fReDrawPortraitScreenFlag == TRUE ) + if ( fReDrawPortraitScreenFlag == TRUE ) { - RenderIMPPortraits( ); - + RenderIMPPortraits( ); + // reset redraw flag fReDrawPortraitScreenFlag = FALSE; } @@ -111,43 +111,43 @@ void HandleIMPPortraits( void ) BOOLEAN RenderPortrait( INT16 sX, INT16 sY ) { - // render the portrait of the current picture - VOBJECT_DESC VObjectDesc; + // render the portrait of the current picture + VOBJECT_DESC VObjectDesc; HVOBJECT hHandle; UINT32 uiGraphicHandle; - if( fCharacterIsMale ) + if( fCharacterIsMale ) { // load it - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP( pPlayerSelectedBigFaceFileNames[ iCurrentPortrait ] , VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); - - // show it - GetVideoObject(&hHandle, uiGraphicHandle); - BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP( pPlayerSelectedBigFaceFileNames[ iCurrentPortrait ] , VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); + + // show it + GetVideoObject(&hHandle, uiGraphicHandle); + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - // and kick it's sorry ..umm never mind, outta here - DeleteVideoObjectFromIndex( uiGraphicHandle ); + // and kick it's sorry ..umm never mind, outta here + DeleteVideoObjectFromIndex( uiGraphicHandle ); + - } else { - // load it - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP( pPlayerSelectedBigFaceFileNames[ iCurrentPortrait + 8 ] , VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); - - // show it - GetVideoObject(&hHandle, uiGraphicHandle); - BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + // load it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP( pPlayerSelectedBigFaceFileNames[ iCurrentPortrait + 8 ] , VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); + + // show it + GetVideoObject(&hHandle, uiGraphicHandle); + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - // and kick it's sorry ..umm never mind, outta here - DeleteVideoObjectFromIndex( uiGraphicHandle ); + // and kick it's sorry ..umm never mind, outta here + DeleteVideoObjectFromIndex( uiGraphicHandle ); } @@ -159,7 +159,7 @@ BOOLEAN RenderPortrait( INT16 sX, INT16 sY ) void IncrementPictureIndex( void ) { // cycle to next picture - + iCurrentPortrait++; // gone too far? @@ -169,20 +169,20 @@ void IncrementPictureIndex( void ) } - return; + return; } void DecrementPicture( void ) { - // cycle to previous picture - + // cycle to previous picture + iCurrentPortrait--; // gone too far? - if( iCurrentPortrait < 0 ) + if( iCurrentPortrait < 0 ) { - iCurrentPortrait = iLastPicture; + iCurrentPortrait = iLastPicture; } return; @@ -191,54 +191,54 @@ void DecrementPicture( void ) void CreateIMPPortraitButtons( void ) { - // will create buttons need for the IMP portrait screen + // will create buttons need for the IMP portrait screen // next button - giIMPPortraitButtonImage[0]= LoadButtonImage( "LAPTOP\\voicearrows.sti" ,-1,1,-1,3,-1 ); - /*giIMPPortraitButton[0] = QuickCreateButton( giIMPPortraitButtonImage[0], LAPTOP_SCREEN_UL_X + ( 18 ), LAPTOP_SCREEN_WEB_UL_Y + ( 184 ), + giIMPPortraitButtonImage[0]= LoadButtonImage( "LAPTOP\\voicearrows.sti" ,-1,1,-1,3,-1 ); + /*giIMPPortraitButton[0] = QuickCreateButton( giIMPPortraitButtonImage[0], LAPTOP_SCREEN_UL_X + ( 18 ), LAPTOP_SCREEN_WEB_UL_Y + ( 184 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPortraitNextCallback ); - */ - giIMPPortraitButton[0] = CreateIconAndTextButton( giIMPPortraitButtonImage[0], pImpButtonText[ 13 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( 343 ), LAPTOP_SCREEN_WEB_UL_Y + ( 205 ),BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPortraitNextCallback); + */ + giIMPPortraitButton[0] = CreateIconAndTextButton( giIMPPortraitButtonImage[0], pImpButtonText[ 13 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 343 ), LAPTOP_SCREEN_WEB_UL_Y + ( 205 ),BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPortraitNextCallback); // previous button - giIMPPortraitButtonImage[ 1 ]= LoadButtonImage( "LAPTOP\\voicearrows.sti" ,-1,0,-1,2,-1 ); -/* giIMPPortraitButton[ 1 ] = QuickCreateButton( giIMPPortraitButtonImage[ 1 ], LAPTOP_SCREEN_UL_X + ( 18 ), LAPTOP_SCREEN_WEB_UL_Y + ( 254 ), + giIMPPortraitButtonImage[ 1 ]= LoadButtonImage( "LAPTOP\\voicearrows.sti" ,-1,0,-1,2,-1 ); +/* giIMPPortraitButton[ 1 ] = QuickCreateButton( giIMPPortraitButtonImage[ 1 ], LAPTOP_SCREEN_UL_X + ( 18 ), LAPTOP_SCREEN_WEB_UL_Y + ( 254 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPortraitPreviousCallback ); - */ - giIMPPortraitButton[ 1 ] = CreateIconAndTextButton( giIMPPortraitButtonImage[ 1 ], pImpButtonText[ 12 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( 93), LAPTOP_SCREEN_WEB_UL_Y + ( 205 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPortraitPreviousCallback); + */ + giIMPPortraitButton[ 1 ] = CreateIconAndTextButton( giIMPPortraitButtonImage[ 1 ], pImpButtonText[ 12 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 93), LAPTOP_SCREEN_WEB_UL_Y + ( 205 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPortraitPreviousCallback); // done button - giIMPPortraitButtonImage[ 2 ]= LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 ); - /* giIMPPortraitButton[ 2 ] = QuickCreateButton( giIMPPortraitButtonImage[ 1 ], LAPTOP_SCREEN_UL_X + ( 349 ), LAPTOP_SCREEN_WEB_UL_Y + ( 220 ), + giIMPPortraitButtonImage[ 2 ]= LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 ); + /* giIMPPortraitButton[ 2 ] = QuickCreateButton( giIMPPortraitButtonImage[ 1 ], LAPTOP_SCREEN_UL_X + ( 349 ), LAPTOP_SCREEN_WEB_UL_Y + ( 220 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPortraitDoneCallback ); - */ - giIMPPortraitButton[ 2 ] = CreateIconAndTextButton( giIMPPortraitButtonImage[ 2 ], pImpButtonText[ 11 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( 187 ), LAPTOP_SCREEN_WEB_UL_Y + ( 330 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPortraitDoneCallback); + */ + giIMPPortraitButton[ 2 ] = CreateIconAndTextButton( giIMPPortraitButtonImage[ 2 ], pImpButtonText[ 11 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 187 ), LAPTOP_SCREEN_WEB_UL_Y + ( 330 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPortraitDoneCallback); - SetButtonCursor(giIMPPortraitButton[0], CURSOR_WWW); - SetButtonCursor(giIMPPortraitButton[1], CURSOR_WWW); - SetButtonCursor(giIMPPortraitButton[2], CURSOR_WWW); + SetButtonCursor(giIMPPortraitButton[0], CURSOR_WWW); + SetButtonCursor(giIMPPortraitButton[1], CURSOR_WWW); + SetButtonCursor(giIMPPortraitButton[2], CURSOR_WWW); } @@ -247,18 +247,18 @@ void DestroyIMPPortraitButtons( void ) { // will destroy buttons created for IMP Portrait screen - + // the next button - RemoveButton(giIMPPortraitButton[ 0 ] ); - UnloadButtonImage(giIMPPortraitButtonImage[ 0 ] ); - + RemoveButton(giIMPPortraitButton[ 0 ] ); + UnloadButtonImage(giIMPPortraitButtonImage[ 0 ] ); + // the previous button - RemoveButton(giIMPPortraitButton[ 1 ] ); - UnloadButtonImage(giIMPPortraitButtonImage[ 1 ] ); - + RemoveButton(giIMPPortraitButton[ 1 ] ); + UnloadButtonImage(giIMPPortraitButtonImage[ 1 ] ); + // the done button - RemoveButton(giIMPPortraitButton[ 2 ] ); - UnloadButtonImage(giIMPPortraitButtonImage[ 2 ] ); + RemoveButton(giIMPPortraitButton[ 2 ] ); + UnloadButtonImage(giIMPPortraitButtonImage[ 2 ] ); return; } @@ -273,21 +273,21 @@ void BtnIMPPortraitNextCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - + btn->uiFlags&=~(BUTTON_CLICKED_ON); + // next picture!! IncrementPictureIndex( ); fReDrawPortraitScreenFlag = TRUE; } - } -} + } +} void BtnIMPPortraitPreviousCallback(GUI_BUTTON *btn,INT32 reason) { @@ -298,21 +298,21 @@ void BtnIMPPortraitPreviousCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - + btn->uiFlags&=~(BUTTON_CLICKED_ON); + // previous picture, please!!! DecrementPicture( ); fReDrawPortraitScreenFlag = TRUE; } - } -} + } +} void BtnIMPPortraitDoneCallback(GUI_BUTTON *btn,INT32 reason) { @@ -323,58 +323,58 @@ void BtnIMPPortraitDoneCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - + btn->uiFlags&=~(BUTTON_CLICKED_ON); + // go to main page iCurrentImpPage = IMP_MAIN_PAGE; /* // current mode now is voice - if( iCurrentProfileMode < IMP__VOICE ) + if( iCurrentProfileMode < IMP__VOICE ) { - iCurrentProfileMode = IMP__VOICE; + iCurrentProfileMode = IMP__VOICE; } -*/ +*/ // if we are already done, leave - if( iCurrentProfileMode == IMP__FINISH ) + if( iCurrentProfileMode == IMP__FINISH ) { - iCurrentImpPage = IMP_FINISH; - } + iCurrentImpPage = IMP_FINISH; + } else { if( CameBackToPortraitsPageButNotFinished() ) { // iCurrentProfileMode = IMP__VOICE; - iCurrentImpPage = IMP_MAIN_PAGE; + iCurrentImpPage = IMP_MAIN_PAGE; } else { iCurrentProfileMode = IMP__VOICE; - } + } } // grab picture number - if( fCharacterIsMale ) + if( fCharacterIsMale ) { - // male + // male iPortraitNumber = iCurrentPortrait; } else { - // female + // female iPortraitNumber = iCurrentPortrait + ( 8 ); } - + fButtonPendingFlag = TRUE; } - } -} + } +} BOOLEAN CameBackToPortraitsPageButNotFinished() diff --git a/Laptop/IMP Skill Trait.cpp b/Laptop/IMP Skill Trait.cpp index fbe6ec43..4107aa5b 100644 --- a/Laptop/IMP Skill Trait.cpp +++ b/Laptop/IMP Skill Trait.cpp @@ -80,7 +80,7 @@ BOOLEAN gfSkillTraitQuestions[ IMP_SKILL_TRAITS__NUMBER_SKILLS ]; INT32 giIMPSkillTraitAnswerButton[ IMP_SKILL_TRAITS__NUMBER_SKILLS ]; INT32 giIMPSkillTraitAnswerButtonImage[ IMP_SKILL_TRAITS__NUMBER_SKILLS ]; -// this is the Done buttons +// this is the Done buttons INT32 giIMPSkillTraitFinsihButton; INT32 giIMPSkillTraitFinsihButtonImage; @@ -124,7 +124,7 @@ BOOLEAN CameBackToSpecialtiesPageButNotFinished(); void EnterIMPSkillTrait( void ) { // UINT32 uiCnt; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; //add the skill trait buttons AddImpSkillTraitButtons(); @@ -141,13 +141,13 @@ void EnterIMPSkillTrait( void ) - giIMPSkillTraitFinsihButtonImage = LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 ); - giIMPSkillTraitFinsihButton = CreateIconAndTextButton( giIMPSkillTraitFinsihButtonImage, pImpButtonText[ 24 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( 350 ), LAPTOP_SCREEN_WEB_UL_Y + ( 340 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPSkillTraitFinishCallback ); + giIMPSkillTraitFinsihButtonImage = LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 ); + giIMPSkillTraitFinsihButton = CreateIconAndTextButton( giIMPSkillTraitFinsihButtonImage, pImpButtonText[ 24 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 350 ), LAPTOP_SCREEN_WEB_UL_Y + ( 340 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPSkillTraitFinishCallback ); @@ -206,7 +206,7 @@ void HandleIMPSkillTrait( void ) gfIST_Redraw = FALSE; } - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } void AddImpSkillTraitButtons() @@ -243,9 +243,9 @@ void AddImpSkillTraitButtons() } if( iCnt == 0 ) - giIMPSkillTraitAnswerButtonImage[ iCnt ] = LoadButtonImage( "LAPTOP\\button_6.sti", -1,0,-1,1,-1 ); + giIMPSkillTraitAnswerButtonImage[ iCnt ] = LoadButtonImage( "LAPTOP\\button_6.sti", -1,0,-1,1,-1 ); else - giIMPSkillTraitAnswerButtonImage[ iCnt ] = UseLoadedButtonImage( giIMPSkillTraitAnswerButtonImage[ 0 ], -1,0,-1,1,-1 ); + giIMPSkillTraitAnswerButtonImage[ iCnt ] = UseLoadedButtonImage( giIMPSkillTraitAnswerButtonImage[ 0 ], -1,0,-1,1,-1 ); giIMPSkillTraitAnswerButton[iCnt] = QuickCreateButton( giIMPSkillTraitAnswerButtonImage[ iCnt ], usPosX, usPosY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 3, @@ -289,7 +289,7 @@ void BtnIMPSkillTraitAnswerCallback(GUI_BUTTON *btn,INT32 reason) { // btn->uiFlags|=(BUTTON_CLICKED_ON); - INT32 iSkillTrait = MSYS_GetBtnUserData( btn, 0 ); + INT32 iSkillTrait = MSYS_GetBtnUserData( btn, 0 ); HandleIMPSkillTraitAnswers( iSkillTrait, FALSE ); } @@ -333,9 +333,9 @@ void HandleIMPSkillTraitAnswers( UINT32 uiSkillPressed, BOOLEAN fResetAllButtons HandleLastSelectedTraits( (INT8)uiSkillPressed ); -/* +/* //if there are already 2 skills selected, and we are trying to PRESS a new button ( skill isnt currently set ) - if( CountNumSkillStraitsSelected() == 2 && + if( CountNumSkillStraitsSelected() == 2 && !gfSkillTraitQuestions[ uiSkillPressed ] && uiSkillPressed != IMP_SKILL_TRAITS__NONE ) { @@ -443,7 +443,7 @@ void IMPSkillTraitDisplaySkills() UINT32 uiCnt; UINT16 usPosX, usPosY; UINT16 usBoxPosX, usBoxPosY; - HVOBJECT hImageHandle; + HVOBJECT hImageHandle; //Display the title @@ -577,7 +577,7 @@ INT8 DoesPlayerHaveExtraAttibutePointsToDistributeBasedOnSkillSelection() { //if the trait is not the ones you cant be expert in ) if( gfSkillTraitQuestions[ IMP_SKILL_TRAITS__ELECTRONICS ] || - gfSkillTraitQuestions[ IMP_SKILL_TRAITS__AMBIDEXTROUS ] || + gfSkillTraitQuestions[ IMP_SKILL_TRAITS__AMBIDEXTROUS ] || gfSkillTraitQuestions[ IMP_SKILL_TRAITS__CAMO ] ) { bExtraPoints = 5; @@ -632,47 +632,47 @@ void AddSelectedSkillsToSkillsList() case IMP_SKILL_TRAITS__ELECTRONICS: AddSkillToSkillList( ELECTRONICS ); break; - + case IMP_SKILL_TRAITS__NIGHT_OPS: AddSkillToSkillList( NIGHTOPS ); break; - + case IMP_SKILL_TRAITS__THROWING: AddSkillToSkillList( THROWING ); break; - + case IMP_SKILL_TRAITS__TEACHING: AddSkillToSkillList( TEACHING ); break; - + case IMP_SKILL_TRAITS__HEAVY_WEAPONS: AddSkillToSkillList( HEAVY_WEAPS ); break; - + case IMP_SKILL_TRAITS__AUTO_WEAPONS: AddSkillToSkillList( AUTO_WEAPS ); break; - + case IMP_SKILL_TRAITS__STEALTHY: AddSkillToSkillList( STEALTHY ); break; - + case IMP_SKILL_TRAITS__AMBIDEXTROUS: AddSkillToSkillList( AMBIDEXT ); break; - + case IMP_SKILL_TRAITS__KNIFING: AddSkillToSkillList( KNIFING ); break; - - case IMP_SKILL_TRAITS__ROOFTOP_SNIPING: - AddSkillToSkillList( ONROOF ); + + case IMP_SKILL_TRAITS__PROF_SNIPER: + AddSkillToSkillList( PROF_SNIPER ); break; - + case IMP_SKILL_TRAITS__CAMO: AddSkillToSkillList( CAMOUFLAGED ); break; - + case IMP_SKILL_TRAITS__MARTIAL_ARTS: AddSkillToSkillList( MARTIALARTS ); break; @@ -684,7 +684,6 @@ void AddSelectedSkillsToSkillsList() void HandleLastSelectedTraits( INT8 bNewTrait ) { - INT8 bTemp=-1; //if there are none selected if( gbLastSelectedTraits[ 0 ] == -1 ) { @@ -706,4 +705,4 @@ void HandleLastSelectedTraits( INT8 bNewTrait ) gbLastSelectedTraits[ 1 ] = gbLastSelectedTraits[ 0 ]; gbLastSelectedTraits[ 0 ] = bNewTrait; } -} \ No newline at end of file +} diff --git a/Laptop/IMP Skill Trait.h b/Laptop/IMP Skill Trait.h index 7321ed03..a141a704 100644 --- a/Laptop/IMP Skill Trait.h +++ b/Laptop/IMP Skill Trait.h @@ -21,14 +21,14 @@ enum IMP_SKILL_TRAITS__STEALTHY, IMP_SKILL_TRAITS__AMBIDEXTROUS, IMP_SKILL_TRAITS__KNIFING, - IMP_SKILL_TRAITS__ROOFTOP_SNIPING, + IMP_SKILL_TRAITS__PROF_SNIPER, IMP_SKILL_TRAITS__CAMO, IMP_SKILL_TRAITS__MARTIAL_ARTS, IMP_SKILL_TRAITS__NONE, IMP_SKILL_TRAITS__NUMBER_SKILLS, }; -// STR16 gzIMPSkillTraitsText[]; +// STR16 gzIMPSkillTraitsText[]; INT8 DoesPlayerHaveExtraAttibutePointsToDistributeBasedOnSkillSelection(); diff --git a/Laptop/IMP Text System.cpp b/Laptop/IMP Text System.cpp index 326ec59f..5e07612d 100644 --- a/Laptop/IMP Text System.cpp +++ b/Laptop/IMP Text System.cpp @@ -48,10 +48,7 @@ void LoadAndDisplayIMPText( INT16 sStartX, INT16 sStartY, INT16 sLineLength, INT { // this procedure will load and display to the screen starting at postion X, Y relative to the start of the laptop screen // it will access record sIMPTextRecordNumber and go until all records following it but before the next IMP record are displayed in font uiFont - CHAR16 sString[ 1024 ]; - INT32 iCounter =0; - BOOLEAN fNotDonePrintingFlag = TRUE; - INT32 iRecordPosition = 0; + CHAR16 sString[ 1024 ]; if( fShadow == FALSE ) { @@ -59,19 +56,19 @@ void LoadAndDisplayIMPText( INT16 sStartX, INT16 sStartY, INT16 sLineLength, INT SetFontShadow( NO_SHADOW ); } - // load the string + // load the string LoadEncryptedDataFromFile("BINARYDATA\\IMPText.EDT", sString, ( UINT32 ) ( ( sIMPTextRecordNumber ) * IMP_SEEK_AMOUNT ), IMP_SEEK_AMOUNT); - + // null put last char sString[ wcslen( sString) ] = 0; - + if( uiFlags == 0 ) { uiFlags = LEFT_JUSTIFIED; } - DisplayWrappedString( sStartX, ( INT16 )( sStartY ), sLineLength, 2, uiFont, ubColor, sString, FONT_BLACK,FALSE, uiFlags); + DisplayWrappedString( sStartX, ( INT16 )( sStartY ), sLineLength, 2, uiFont, ubColor, sString, FONT_BLACK,FALSE, uiFlags); // reset shadow @@ -100,181 +97,181 @@ void PrintImpText( void ) switch( iCurrentImpPage ) { case ( IMP_HOME_PAGE ): - // the imp homepage - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y + 43, sWidth, IMP_HOME_1, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED ); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y +60, sWidth, IMP_HOME_2, FONT10ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED ); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y +208, sWidth,IMP_HOME_3, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED ); - LoadAndDisplayIMPText( IMP_LEFT_IDENT_TEXT_X, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y +99, IMP_IDENT_WIDTH,IMP_HOME_7, FONT10ARIAL, 142, TRUE, CENTER_JUSTIFIED); - LoadAndDisplayIMPText( IMP_RIGHT_IDENT_TEXT_X, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y +99, IMP_IDENT_WIDTH,IMP_HOME_8, FONT10ARIAL, 142, TRUE, CENTER_JUSTIFIED); - LoadAndDisplayIMPText( iScreenWidthOffset + 258, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y +362, ( 640 ),IMP_HOME_5, FONT14ARIAL, FONT_BLACK, FALSE, 0); - LoadAndDisplayIMPText( IMP_LEFT_IDENT_TEXT_X, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y +188, IMP_IDENT_WIDTH,IMP_HOME_9, FONT10ARIAL, 142, TRUE, RIGHT_JUSTIFIED); - LoadAndDisplayIMPText( IMP_RIGHT_IDENT_TEXT_X, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y +188, IMP_IDENT_WIDTH,IMP_HOME_10, FONT10ARIAL, 142, TRUE, RIGHT_JUSTIFIED); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y +402, sWidth, IMP_HOME_6, FONT12ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); + // the imp homepage + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y + 43, sWidth, IMP_HOME_1, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED ); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y +60, sWidth, IMP_HOME_2, FONT10ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED ); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y +208, sWidth,IMP_HOME_3, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED ); + LoadAndDisplayIMPText( IMP_LEFT_IDENT_TEXT_X, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y +99, IMP_IDENT_WIDTH,IMP_HOME_7, FONT10ARIAL, 142, TRUE, CENTER_JUSTIFIED); + LoadAndDisplayIMPText( IMP_RIGHT_IDENT_TEXT_X, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y +99, IMP_IDENT_WIDTH,IMP_HOME_8, FONT10ARIAL, 142, TRUE, CENTER_JUSTIFIED); + LoadAndDisplayIMPText( iScreenWidthOffset + 258, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y +362, ( 640 ),IMP_HOME_5, FONT14ARIAL, FONT_BLACK, FALSE, 0); + LoadAndDisplayIMPText( IMP_LEFT_IDENT_TEXT_X, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y +188, IMP_IDENT_WIDTH,IMP_HOME_9, FONT10ARIAL, 142, TRUE, RIGHT_JUSTIFIED); + LoadAndDisplayIMPText( IMP_RIGHT_IDENT_TEXT_X, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y +188, IMP_IDENT_WIDTH,IMP_HOME_10, FONT10ARIAL, 142, TRUE, RIGHT_JUSTIFIED); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y +402, sWidth, IMP_HOME_6, FONT12ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); - break; + break; case ( IMP_ABOUT_US ): - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 17, LAPTOP_SCREEN_WEB_UL_Y + 137, ( 640 ),IMP_ABOUT_US_1, FONT12ARIAL, FONT_WHITE, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 25, LAPTOP_SCREEN_WEB_UL_Y + 154, ( 337 - 124 ), IMP_ABOUT_US_2, FONT10ARIAL, 142, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 25, LAPTOP_SCREEN_WEB_UL_Y + 235, ( 337 - 124 ), IMP_ABOUT_US_3, FONT10ARIAL, 142, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 17, LAPTOP_SCREEN_WEB_UL_Y + 137, ( 640 ),IMP_ABOUT_US_1, FONT12ARIAL, FONT_WHITE, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 25, LAPTOP_SCREEN_WEB_UL_Y + 154, ( 337 - 124 ), IMP_ABOUT_US_2, FONT10ARIAL, 142, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 25, LAPTOP_SCREEN_WEB_UL_Y + 235, ( 337 - 124 ), IMP_ABOUT_US_3, FONT10ARIAL, 142, TRUE, 0); LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 17, LAPTOP_SCREEN_WEB_UL_Y + 260, ( 640 ), IMP_ABOUT_US_10, FONT12ARIAL, FONT_WHITE, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 25, LAPTOP_SCREEN_WEB_UL_Y + 280, ( 337 - 124 ), IMP_ABOUT_US_4, FONT10ARIAL, 142, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 267, LAPTOP_SCREEN_WEB_UL_Y + 137, ( 640 ), IMP_ABOUT_US_11, FONT12ARIAL, FONT_WHITE, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 275, LAPTOP_SCREEN_WEB_UL_Y + 154, ( 337 - 129 ), IMP_ABOUT_US_5, FONT10ARIAL, 142, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 267, LAPTOP_SCREEN_WEB_UL_Y + 227, ( 640 ), IMP_ABOUT_US_8, FONT12ARIAL, FONT_WHITE, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 275, LAPTOP_SCREEN_WEB_UL_Y + 247, ( 337 - 129 ), IMP_ABOUT_US_6, FONT10ARIAL, 142, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 267, LAPTOP_SCREEN_WEB_UL_Y + 277, ( 640 ), IMP_ABOUT_US_9, FONT12ARIAL, FONT_WHITE, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 275, LAPTOP_SCREEN_WEB_UL_Y + 297, ( 337 - 129 ), IMP_ABOUT_US_7, FONT10ARIAL, 142, TRUE, 0); - + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 25, LAPTOP_SCREEN_WEB_UL_Y + 280, ( 337 - 124 ), IMP_ABOUT_US_4, FONT10ARIAL, 142, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 267, LAPTOP_SCREEN_WEB_UL_Y + 137, ( 640 ), IMP_ABOUT_US_11, FONT12ARIAL, FONT_WHITE, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 275, LAPTOP_SCREEN_WEB_UL_Y + 154, ( 337 - 129 ), IMP_ABOUT_US_5, FONT10ARIAL, 142, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 267, LAPTOP_SCREEN_WEB_UL_Y + 227, ( 640 ), IMP_ABOUT_US_8, FONT12ARIAL, FONT_WHITE, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 275, LAPTOP_SCREEN_WEB_UL_Y + 247, ( 337 - 129 ), IMP_ABOUT_US_6, FONT10ARIAL, 142, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 267, LAPTOP_SCREEN_WEB_UL_Y + 277, ( 640 ), IMP_ABOUT_US_9, FONT12ARIAL, FONT_WHITE, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 275, LAPTOP_SCREEN_WEB_UL_Y + 297, ( 337 - 129 ), IMP_ABOUT_US_7, FONT10ARIAL, 142, TRUE, 0); + break; case ( IMP_MAIN_PAGE ): - // title + // title LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, LAPTOP_SCREEN_WEB_UL_Y + 19, sWidth, IMP_MAIN_1, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); - + // set up for IMP text for title box area switch( iCurrentProfileMode ) { - case( IMP__REGISTRY ): - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 173, LAPTOP_SCREEN_WEB_UL_Y + 91, ( 329 - 173 ), IMP_MAIN_2, FONT10ARIAL, 142, TRUE, 0); + case( IMP__REGISTRY ): + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 173, LAPTOP_SCREEN_WEB_UL_Y + 91, ( 329 - 173 ), IMP_MAIN_2, FONT10ARIAL, 142, TRUE, 0); break; case( IMP__PORTRAIT ): - IanDisplayWrappedString( LAPTOP_SCREEN_UL_X + 173, LAPTOP_SCREEN_WEB_UL_Y + 91, ( 329 - 173 ), 2, FONT10ARIAL, 142, pExtraIMPStrings[ 0 ],0,FALSE,0); + IanDisplayWrappedString( LAPTOP_SCREEN_UL_X + 173, LAPTOP_SCREEN_WEB_UL_Y + 91, ( 329 - 173 ), 2, FONT10ARIAL, 142, pExtraIMPStrings[ 0 ],0,FALSE,0); break; case( IMP__VOICE ): - IanDisplayWrappedString( LAPTOP_SCREEN_UL_X + 173, LAPTOP_SCREEN_WEB_UL_Y + 91, ( 329 - 173 ), 2, FONT10ARIAL, 142, pExtraIMPStrings[ 1 ],0,FALSE,0); + IanDisplayWrappedString( LAPTOP_SCREEN_UL_X + 173, LAPTOP_SCREEN_WEB_UL_Y + 91, ( 329 - 173 ), 2, FONT10ARIAL, 142, pExtraIMPStrings[ 1 ],0,FALSE,0); break; case( IMP__PERSONALITY ): - IanDisplayWrappedString( LAPTOP_SCREEN_UL_X + 173, LAPTOP_SCREEN_WEB_UL_Y + 91, ( 329 - 173 ), 2, FONT10ARIAL, 142, pExtraIMPStrings[ 2 ],0,FALSE,0); + IanDisplayWrappedString( LAPTOP_SCREEN_UL_X + 173, LAPTOP_SCREEN_WEB_UL_Y + 91, ( 329 - 173 ), 2, FONT10ARIAL, 142, pExtraIMPStrings[ 2 ],0,FALSE,0); break; case( IMP__ATTRIBUTES ): - IanDisplayWrappedString( LAPTOP_SCREEN_UL_X + 173, LAPTOP_SCREEN_WEB_UL_Y + 91, ( 329 - 173 ), 2, FONT10ARIAL, 142, pExtraIMPStrings[ 3 ],0,FALSE,0); + IanDisplayWrappedString( LAPTOP_SCREEN_UL_X + 173, LAPTOP_SCREEN_WEB_UL_Y + 91, ( 329 - 173 ), 2, FONT10ARIAL, 142, pExtraIMPStrings[ 3 ],0,FALSE,0); break; } break; case ( IMP_BEGIN ): - + // title LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, LAPTOP_SCREEN_WEB_UL_Y + 7, sWidth, IMP_BEGIN_1, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED ); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 105, LAPTOP_SCREEN_WEB_UL_Y + 67, ( 390 - 105 ), IMP_BEGIN_2, FONT10ARIAL, 142, TRUE, CENTER_JUSTIFIED); - + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 105, LAPTOP_SCREEN_WEB_UL_Y + 67, ( 390 - 105 ), IMP_BEGIN_2, FONT10ARIAL, 142, TRUE, CENTER_JUSTIFIED); + // fullname - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 81, LAPTOP_SCREEN_WEB_UL_Y + 139, ( 640 ), IMP_BEGIN_3, FONT14ARIAL, FONT_BLACK, FALSE, 0); - + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 81, LAPTOP_SCREEN_WEB_UL_Y + 139, ( 640 ), IMP_BEGIN_3, FONT14ARIAL, FONT_BLACK, FALSE, 0); + // nick name - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 81, LAPTOP_SCREEN_WEB_UL_Y + 199, ( 640 ), IMP_BEGIN_4, FONT14ARIAL, FONT_BLACK, FALSE, 0); - + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 81, LAPTOP_SCREEN_WEB_UL_Y + 199, ( 640 ), IMP_BEGIN_4, FONT14ARIAL, FONT_BLACK, FALSE, 0); + // gender - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 81, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_6, FONT14ARIAL, FONT_BLACK, FALSE, 0); - + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 81, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_6, FONT14ARIAL, FONT_BLACK, FALSE, 0); + // male - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 240, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_10, FONT14ARIAL, FONT_BLACK, FALSE, 0); - + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 240, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_10, FONT14ARIAL, FONT_BLACK, FALSE, 0); + // female - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 360, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_11, FONT14ARIAL, FONT_BLACK, FALSE, 0); - + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 360, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_11, FONT14ARIAL, FONT_BLACK, FALSE, 0); + break; case ( IMP_PERSONALITY ): - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 130, LAPTOP_SCREEN_WEB_UL_Y + 60, ( 456 - 200 ), IMP_PERS_1, FONT12ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 130, LAPTOP_SCREEN_WEB_UL_Y + 130, ( 456 - 200 ), IMP_PERS_2, FONT12ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, LAPTOP_SCREEN_WEB_UL_Y + 7, sWidth, IMP_PERS_6, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED ); - - + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 130, LAPTOP_SCREEN_WEB_UL_Y + 60, ( 456 - 200 ), IMP_PERS_1, FONT12ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 130, LAPTOP_SCREEN_WEB_UL_Y + 130, ( 456 - 200 ), IMP_PERS_2, FONT12ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, LAPTOP_SCREEN_WEB_UL_Y + 7, sWidth, IMP_PERS_6, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED ); + + break; case ( IMP_PERSONALITY_QUIZ ): -// LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_WEB_UL_Y + 5, sWidth, IMP_PERS_6, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED ); -// LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 293, LAPTOP_SCREEN_WEB_UL_Y + 370, ( 456 - 200 ), IMP_PERS_11, FONT12ARIAL, FONT_WHITE, TRUE, 0); -// LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 363, LAPTOP_SCREEN_WEB_UL_Y + 370, ( 456 - 200 ), IMP_PERS_12, FONT12ARIAL, FONT_WHITE, TRUE, 0); - +// LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_WEB_UL_Y + 5, sWidth, IMP_PERS_6, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED ); +// LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 293, LAPTOP_SCREEN_WEB_UL_Y + 370, ( 456 - 200 ), IMP_PERS_11, FONT12ARIAL, FONT_WHITE, TRUE, 0); +// LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 363, LAPTOP_SCREEN_WEB_UL_Y + 370, ( 456 - 200 ), IMP_PERS_12, FONT12ARIAL, FONT_WHITE, TRUE, 0); + // print the question and suitable answers // PrintIMPPersonalityQuizQuestionAndAnsers( ); - + break; case ( IMP_PERSONALITY_FINISH ): - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_WEB_UL_Y + 7, sWidth, IMP_PERS_6, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_WEB_UL_Y + 7, sWidth, IMP_PERS_6, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); switch( bPersonalityEndState ) { - case( 0 ): - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 125, LAPTOP_SCREEN_WEB_UL_Y + 100, ( 356 - 100 ), IMP_PERS_F1, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); - break; - case( 1 ): - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 125, LAPTOP_SCREEN_WEB_UL_Y + 100, ( 356 - 100 ), IMP_PERS_F4, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); - break; - case( 2 ): - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 125, LAPTOP_SCREEN_WEB_UL_Y + 100, ( 356 - 100 ), IMP_PERS_F5, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); - break; + case( 0 ): + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 125, LAPTOP_SCREEN_WEB_UL_Y + 100, ( 356 - 100 ), IMP_PERS_F1, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); + break; + case( 1 ): + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 125, LAPTOP_SCREEN_WEB_UL_Y + 100, ( 356 - 100 ), IMP_PERS_F4, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); + break; + case( 2 ): + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 125, LAPTOP_SCREEN_WEB_UL_Y + 100, ( 356 - 100 ), IMP_PERS_F5, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); + break; } break; case( IMP_ATTRIBUTE_ENTRANCE ): - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, LAPTOP_SCREEN_WEB_UL_Y + 7, sWidth, IMP_ATTRIB_1 - 1, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 110, LAPTOP_SCREEN_WEB_UL_Y + 50, ( 300 ), IMP_ATTRIB_5, FONT12ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 110, LAPTOP_SCREEN_WEB_UL_Y + 130, ( 300 ), IMP_ATTRIB_6, FONT12ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 110, LAPTOP_SCREEN_WEB_UL_Y + 200, ( 300 ), IMP_ATTRIB_7, FONT12ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, LAPTOP_SCREEN_WEB_UL_Y + 7, sWidth, IMP_ATTRIB_1 - 1, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 110, LAPTOP_SCREEN_WEB_UL_Y + 50, ( 300 ), IMP_ATTRIB_5, FONT12ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 110, LAPTOP_SCREEN_WEB_UL_Y + 130, ( 300 ), IMP_ATTRIB_6, FONT12ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 110, LAPTOP_SCREEN_WEB_UL_Y + 200, ( 300 ), IMP_ATTRIB_7, FONT12ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); break; - case( IMP_ATTRIBUTE_PAGE ): - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, LAPTOP_SCREEN_WEB_UL_Y + 7, sWidth, IMP_ATTRIB_1 - 1, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); - + case( IMP_ATTRIBUTE_PAGE ): + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, LAPTOP_SCREEN_WEB_UL_Y + 7, sWidth, IMP_ATTRIB_1 - 1, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); + // don't blit bonus if reviewing if( fReviewStats != TRUE ) { - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 355, LAPTOP_SCREEN_WEB_UL_Y + 51, ( 640 ), IMP_ATTRIB_SA_2 - 1, FONT12ARIAL, FONT_WHITE, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 56, LAPTOP_SCREEN_WEB_UL_Y + 33, ( 240 ), IMP_ATTRIB_SA_15, FONT10ARIAL, FONT_WHITE, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 355, LAPTOP_SCREEN_WEB_UL_Y + 51, ( 640 ), IMP_ATTRIB_SA_2 - 1, FONT12ARIAL, FONT_WHITE, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 56, LAPTOP_SCREEN_WEB_UL_Y + 33, ( 240 ), IMP_ATTRIB_SA_15, FONT10ARIAL, FONT_WHITE, TRUE, 0); } else { LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 56, LAPTOP_SCREEN_WEB_UL_Y + 33, ( 240 ), IMP_ATTRIB_SA_18, FONT10ARIAL, FONT_WHITE, TRUE, 0); } // stats - // health - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 60, LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + 0 * SKILL_SLIDE_HEIGHT, ( 100 ), IMP_ATTRIB_SA_6 - 1, FONT12ARIAL, FONT_WHITE, TRUE, RIGHT_JUSTIFIED); - // dex - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 60, LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + 1 * SKILL_SLIDE_HEIGHT, ( 100 ), IMP_ATTRIB_SA_8 - 1, FONT12ARIAL, FONT_WHITE, TRUE, RIGHT_JUSTIFIED); - // agili - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 60, LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + 2 * SKILL_SLIDE_HEIGHT, ( 100 ), IMP_ATTRIB_SA_7 - 1, FONT12ARIAL, FONT_WHITE, TRUE, RIGHT_JUSTIFIED); - // str - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 60, LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + 3 * SKILL_SLIDE_HEIGHT, ( 100 ), IMP_ATTRIB_SA_9 - 1, FONT12ARIAL, FONT_WHITE, TRUE, RIGHT_JUSTIFIED); - // wisdom - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 60, LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + 4 * SKILL_SLIDE_HEIGHT, ( 100 ), IMP_ATTRIB_SA_11 - 1, FONT12ARIAL, FONT_WHITE, TRUE, RIGHT_JUSTIFIED); - // lead - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 60, LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + 5 * SKILL_SLIDE_HEIGHT, ( 100 ), IMP_ATTRIB_SA_10 - 1, FONT12ARIAL, FONT_WHITE, TRUE, RIGHT_JUSTIFIED); - // marks - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 60, LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + 6 * SKILL_SLIDE_HEIGHT, ( 100 ), IMP_ATTRIB_SA_12 - 1, FONT12ARIAL, FONT_WHITE, TRUE, RIGHT_JUSTIFIED); - // med - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 60, LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + 7 * SKILL_SLIDE_HEIGHT, ( 100 ), IMP_ATTRIB_SA_14 - 1, FONT12ARIAL, FONT_WHITE, TRUE, RIGHT_JUSTIFIED); - // expl - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 60, LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + 8 * SKILL_SLIDE_HEIGHT, ( 100 ), IMP_ATTRIB_SA_15 - 1, FONT12ARIAL, FONT_WHITE, TRUE, RIGHT_JUSTIFIED); - // mech - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 60, LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + 9 * SKILL_SLIDE_HEIGHT, ( 100 ), IMP_ATTRIB_SA_13 - 1, FONT12ARIAL, FONT_WHITE, TRUE, RIGHT_JUSTIFIED); - - // should we display zero warning or nowmal ' come on herc..' text - - - + // health + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 60, LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + 0 * SKILL_SLIDE_HEIGHT, ( 100 ), IMP_ATTRIB_SA_6 - 1, FONT12ARIAL, FONT_WHITE, TRUE, RIGHT_JUSTIFIED); + // dex + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 60, LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + 1 * SKILL_SLIDE_HEIGHT, ( 100 ), IMP_ATTRIB_SA_8 - 1, FONT12ARIAL, FONT_WHITE, TRUE, RIGHT_JUSTIFIED); + // agili + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 60, LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + 2 * SKILL_SLIDE_HEIGHT, ( 100 ), IMP_ATTRIB_SA_7 - 1, FONT12ARIAL, FONT_WHITE, TRUE, RIGHT_JUSTIFIED); + // str + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 60, LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + 3 * SKILL_SLIDE_HEIGHT, ( 100 ), IMP_ATTRIB_SA_9 - 1, FONT12ARIAL, FONT_WHITE, TRUE, RIGHT_JUSTIFIED); + // wisdom + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 60, LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + 4 * SKILL_SLIDE_HEIGHT, ( 100 ), IMP_ATTRIB_SA_11 - 1, FONT12ARIAL, FONT_WHITE, TRUE, RIGHT_JUSTIFIED); + // lead + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 60, LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + 5 * SKILL_SLIDE_HEIGHT, ( 100 ), IMP_ATTRIB_SA_10 - 1, FONT12ARIAL, FONT_WHITE, TRUE, RIGHT_JUSTIFIED); + // marks + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 60, LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + 6 * SKILL_SLIDE_HEIGHT, ( 100 ), IMP_ATTRIB_SA_12 - 1, FONT12ARIAL, FONT_WHITE, TRUE, RIGHT_JUSTIFIED); + // med + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 60, LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + 7 * SKILL_SLIDE_HEIGHT, ( 100 ), IMP_ATTRIB_SA_14 - 1, FONT12ARIAL, FONT_WHITE, TRUE, RIGHT_JUSTIFIED); + // expl + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 60, LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + 8 * SKILL_SLIDE_HEIGHT, ( 100 ), IMP_ATTRIB_SA_15 - 1, FONT12ARIAL, FONT_WHITE, TRUE, RIGHT_JUSTIFIED); + // mech + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 60, LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + 9 * SKILL_SLIDE_HEIGHT, ( 100 ), IMP_ATTRIB_SA_13 - 1, FONT12ARIAL, FONT_WHITE, TRUE, RIGHT_JUSTIFIED); + + // should we display zero warning or nowmal ' come on herc..' text + + + break; - case( IMP_ATTRIBUTE_FINISH ): + case( IMP_ATTRIBUTE_FINISH ): LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, LAPTOP_SCREEN_WEB_UL_Y + 7, sWidth, IMP_ATTRIB_1 - 1, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); - + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 125, LAPTOP_SCREEN_WEB_UL_Y + 100, ( 356 - 100 ), IMP_AF_2 - 1, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); - + break; case ( IMP_PORTRAIT ): - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, LAPTOP_SCREEN_WEB_UL_Y + 7, sWidth, IMP_POR_1 - 1, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 135, LAPTOP_SCREEN_WEB_UL_Y + 68, ( 240 ), IMP_POR_2 - 1, FONT10ARIAL, 142, TRUE, 0); - + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, LAPTOP_SCREEN_WEB_UL_Y + 7, sWidth, IMP_POR_1 - 1, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 135, LAPTOP_SCREEN_WEB_UL_Y + 68, ( 240 ), IMP_POR_2 - 1, FONT10ARIAL, 142, TRUE, 0); + break; case ( IMP_VOICE ): - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, LAPTOP_SCREEN_WEB_UL_Y + 7, sWidth, IMP_VOC_1 - 1, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 135, LAPTOP_SCREEN_WEB_UL_Y + 70, ( 240 ), IMP_VOC_2 - 1, FONT10ARIAL, 142, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, LAPTOP_SCREEN_WEB_UL_Y + 7, sWidth, IMP_VOC_1 - 1, FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 135, LAPTOP_SCREEN_WEB_UL_Y + 70, ( 240 ), IMP_VOC_2 - 1, FONT10ARIAL, 142, TRUE, 0); break; case ( IMP_FINISH ): - //LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 160, LAPTOP_SCREEN_WEB_UL_Y + 7, ( 640 ), IMP_FIN_1 - 1, FONT14ARIAL, FONT_WHITE, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 150, LAPTOP_SCREEN_WEB_UL_Y + 55, ( 200 ), IMP_FIN_2 - 1, FONT12ARIAL, FONT_WHITE, TRUE, 0); + //LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 160, LAPTOP_SCREEN_WEB_UL_Y + 7, ( 640 ), IMP_FIN_1 - 1, FONT14ARIAL, FONT_WHITE, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 150, LAPTOP_SCREEN_WEB_UL_Y + 55, ( 200 ), IMP_FIN_2 - 1, FONT12ARIAL, FONT_WHITE, TRUE, 0); break; case( IMP_CONFIRM ): - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, LAPTOP_SCREEN_WEB_UL_Y + 7, sWidth, IMP_CON_1 , FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 160, LAPTOP_SCREEN_WEB_UL_Y + 60, ( 200 ), IMP_CON_2 , FONT12ARIAL, FONT_WHITE, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 160, LAPTOP_SCREEN_WEB_UL_Y + 145, ( 200 ), IMP_CON_3 , FONT12ARIAL, FONT_WHITE, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X - 111, LAPTOP_SCREEN_WEB_UL_Y + 7, sWidth, IMP_CON_1 , FONT14ARIAL, FONT_WHITE, TRUE, CENTER_JUSTIFIED); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 160, LAPTOP_SCREEN_WEB_UL_Y + 60, ( 200 ), IMP_CON_2 , FONT12ARIAL, FONT_WHITE, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 160, LAPTOP_SCREEN_WEB_UL_Y + 145, ( 200 ), IMP_CON_3 , FONT12ARIAL, FONT_WHITE, TRUE, 0); break; } @@ -283,20 +280,20 @@ void PrintImpText( void ) void PrintImpTextPostButtonRender( void ) { // prints any text after IMP buttons have been rendered - switch( iCurrentImpPage ) + switch( iCurrentImpPage ) { case ( IMP_HOME_PAGE ): // about us button - break; + break; } } void PrintIMPPersonalityQuizQuestionAndAnsers( void ) { - + INT32 iCounter = 0; - INT32 iOffset = 0; + INT32 iOffset = 0; if( giCurrentPersonalityQuizQuestion < 0 ) { @@ -309,86 +306,86 @@ void PrintIMPPersonalityQuizQuestionAndAnsers( void ) // incrment until question is found iOffset +=iIMPQuestionLengths[ iCounter ]; } - - // handle any female specifc questions + + // handle any female specifc questions if( fCharacterIsMale == FALSE ) { OffSetQuestionForFemaleSpecificQuestions( &iOffset ); } // how many answers are there? - switch( iIMPQuestionLengths[ giCurrentPersonalityQuizQuestion ]) + switch( iIMPQuestionLengths[ giCurrentPersonalityQuizQuestion ]) { - case ( 5 ): + case ( 5 ): // 4 answers, write down the side, extra wide columns - + // question is at IMP_QUESTION_1 + iOffset // and there are 4 answers afterwards - BltAnswerIndents( 4 ); + BltAnswerIndents( 4 ); LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 20, LAPTOP_SCREEN_WEB_UL_Y + 30, ( 460 ), ( INT16 )( IMP_QUESTION_1 + iOffset ), FONT10ARIAL, FONT_WHITE, TRUE, LEFT_JUSTIFIED); - + // answers LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 100, ( 390 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 1), FONT10ARIAL, 142, TRUE, LEFT_JUSTIFIED); LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 150, ( 390 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 2), FONT10ARIAL, 142, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 200, ( 390 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 3), FONT10ARIAL, 142, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 250, ( 390 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 4), FONT10ARIAL, 142, TRUE, 0); - - + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 200, ( 390 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 3), FONT10ARIAL, 142, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 250, ( 390 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 4), FONT10ARIAL, 142, TRUE, 0); + + iOffset = 0; - break; + break; case ( 6 ): - // question is at IMP_QUESTION_1 + iOffset + // question is at IMP_QUESTION_1 + iOffset // and there are 5 answers afterwards - BltAnswerIndents( 5 ); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 20, LAPTOP_SCREEN_WEB_UL_Y + 30, ( 460 ), ( INT16 )( IMP_QUESTION_1 + iOffset ), FONT10ARIAL, FONT_WHITE, TRUE, LEFT_JUSTIFIED); - + BltAnswerIndents( 5 ); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 20, LAPTOP_SCREEN_WEB_UL_Y + 30, ( 460 ), ( INT16 )( IMP_QUESTION_1 + iOffset ), FONT10ARIAL, FONT_WHITE, TRUE, LEFT_JUSTIFIED); + // answers LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 100, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 1), FONT10ARIAL, 142, TRUE, 0); LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 150, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 2), FONT10ARIAL, 142, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 200, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 3), FONT10ARIAL, 142, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 250, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 4), FONT10ARIAL, 142, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X +QTN_SECOND_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 100, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 5), FONT10ARIAL, 142, TRUE, 0); - - + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 200, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 3), FONT10ARIAL, 142, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 250, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 4), FONT10ARIAL, 142, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X +QTN_SECOND_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 100, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 5), FONT10ARIAL, 142, TRUE, 0); + + break; case( 7 ): - // question is at IMP_QUESTION_1 + iOffset + // question is at IMP_QUESTION_1 + iOffset // and there are 5 answers afterwards - BltAnswerIndents( 6 ); + BltAnswerIndents( 6 ); LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 20, LAPTOP_SCREEN_WEB_UL_Y + 30, ( 460 ), ( INT16 )( IMP_QUESTION_1 + iOffset ), FONT10ARIAL, FONT_WHITE, TRUE, LEFT_JUSTIFIED); - + // answers LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 100, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 1), FONT10ARIAL, 142, TRUE, 0); LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 150, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 2), FONT10ARIAL, 142, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 200, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 3), FONT10ARIAL, 142, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 250, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 4), FONT10ARIAL, 142, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_SECOND_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 100, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 5), FONT10ARIAL, 142, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_SECOND_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 150, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 6), FONT10ARIAL, 142, TRUE, 0); - - + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 200, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 3), FONT10ARIAL, 142, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 250, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 4), FONT10ARIAL, 142, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_SECOND_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 100, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 5), FONT10ARIAL, 142, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_SECOND_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 150, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 6), FONT10ARIAL, 142, TRUE, 0); + + break; - case( 9 ): - // question is at IMP_QUESTION_1 + iOffset + case( 9 ): + // question is at IMP_QUESTION_1 + iOffset // and there are 8 answers afterwards - BltAnswerIndents( 8 ); - + BltAnswerIndents( 8 ); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 20, LAPTOP_SCREEN_WEB_UL_Y + 30, ( 460 ), ( INT16 )( IMP_QUESTION_1 + iOffset ), FONT10ARIAL, FONT_WHITE, TRUE, LEFT_JUSTIFIED); - + // answers LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 100, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 1), FONT10ARIAL, 142, TRUE, 0); LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 150, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 2), FONT10ARIAL, 142, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 200, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 3), FONT10ARIAL, 142, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 250, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 4), FONT10ARIAL, 142, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_SECOND_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 100, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 5), FONT10ARIAL, 142, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_SECOND_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 150, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 6), FONT10ARIAL, 142, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_SECOND_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 200, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 7), FONT10ARIAL, 142, TRUE, 0); - LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_SECOND_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 250, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 8), FONT10ARIAL, 142, TRUE, 0); - - + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 200, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 3), FONT10ARIAL, 142, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_FIRST_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 250, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 4), FONT10ARIAL, 142, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_SECOND_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 100, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 5), FONT10ARIAL, 142, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_SECOND_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 150, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 6), FONT10ARIAL, 142, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_SECOND_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 200, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 7), FONT10ARIAL, 142, TRUE, 0); + LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + QTN_SECOND_COLUMN_X, LAPTOP_SCREEN_WEB_UL_Y + 250, ( 160 ), ( INT16 )( IMP_QUESTION_1 + iOffset + 8), FONT10ARIAL, 142, TRUE, 0); + + break; } @@ -400,7 +397,6 @@ void OffSetQuestionForFemaleSpecificQuestions( INT32 *iCurrentOffset ) { INT32 iExtraOffSet = 0; BOOLEAN fOffSet = TRUE; - INT32 iCounter = 0; // find the extra switch( giCurrentPersonalityQuizQuestion ) @@ -412,13 +408,13 @@ void OffSetQuestionForFemaleSpecificQuestions( INT32 *iCurrentOffset ) iExtraOffSet = iIMPQuestionLengths[ 0 ]; break; case( 8 ): - iExtraOffSet = iIMPQuestionLengths[ 0 ] + iIMPQuestionLengths[ 3 ]; + iExtraOffSet = iIMPQuestionLengths[ 0 ] + iIMPQuestionLengths[ 3 ]; break; case( 9 ): - iExtraOffSet = iIMPQuestionLengths[ 0 ] + iIMPQuestionLengths[ 3 ] + iIMPQuestionLengths[ 8 ]; + iExtraOffSet = iIMPQuestionLengths[ 0 ] + iIMPQuestionLengths[ 3 ] + iIMPQuestionLengths[ 8 ]; break; case( 13 ): - iExtraOffSet = iIMPQuestionLengths[ 0 ] + iIMPQuestionLengths[ 3 ] + iIMPQuestionLengths[ 8 ] + iIMPQuestionLengths[ 9 ]; + iExtraOffSet = iIMPQuestionLengths[ 0 ] + iIMPQuestionLengths[ 3 ] + iIMPQuestionLengths[ 8 ] + iIMPQuestionLengths[ 9 ]; break; default: fOffSet = FALSE; @@ -428,8 +424,8 @@ void OffSetQuestionForFemaleSpecificQuestions( INT32 *iCurrentOffset ) if( fOffSet ) { *iCurrentOffset = IMP_CON_3 - ( IMP_QUESTION_1 - 3 ); - + *iCurrentOffset += iExtraOffSet; } -} \ No newline at end of file +} diff --git a/Laptop/IMP Text System.h b/Laptop/IMP Text System.h index 9d1e5021..ba84db3d 100644 --- a/Laptop/IMP Text System.h +++ b/Laptop/IMP Text System.h @@ -25,18 +25,18 @@ enum{ IMP_HOME_6, IMP_HOME_7, IMP_HOME_8, - IMP_HOME_9, + IMP_HOME_9, IMP_HOME_10, IMP_ABOUT_US_1, IMP_ABOUT_US_2, IMP_ABOUT_US_3, - IMP_ABOUT_US_4, - IMP_ABOUT_US_5, - IMP_ABOUT_US_6, - IMP_ABOUT_US_7, - IMP_ABOUT_US_8, - IMP_ABOUT_US_9, - IMP_ABOUT_US_10, + IMP_ABOUT_US_4, + IMP_ABOUT_US_5, + IMP_ABOUT_US_6, + IMP_ABOUT_US_7, + IMP_ABOUT_US_8, + IMP_ABOUT_US_9, + IMP_ABOUT_US_10, IMP_ABOUT_US_11, IMP_ABOUT_US_12, IMP_MAIN_1, @@ -48,8 +48,8 @@ enum{ IMP_MAIN_7, IMP_MAIN_8, IMP_MAIN_9, - IMP_BEGIN_1, - IMP_BEGIN_2, + IMP_BEGIN_1, + IMP_BEGIN_2, IMP_BEGIN_3, IMP_BEGIN_4, IMP_BEGIN_5, @@ -74,24 +74,24 @@ enum{ IMP_QUESTION_1, IMP_PERS_F1 = IMP_QUESTION_1 + 90, IMP_PERS_F2, - IMP_PERS_F3, + IMP_PERS_F3, IMP_PERS_F4, IMP_PERS_F5, IMP_PERS_F6, - IMP_PERS_F7, - IMP_PERS_F8, - IMP_ATTRIB_1, + IMP_PERS_F7, + IMP_PERS_F8, + IMP_ATTRIB_1, IMP_ATTRIB_2, IMP_ATTRIB_3, IMP_ATTRIB_4, IMP_ATTRIB_5, IMP_ATTRIB_6, IMP_ATTRIB_7, - IMP_ATTRIB_8, - IMP_ATTRIB_SA_1, + IMP_ATTRIB_8, + IMP_ATTRIB_SA_1, IMP_ATTRIB_SA_2, IMP_ATTRIB_SA_3, - IMP_ATTRIB_SA_4, + IMP_ATTRIB_SA_4, IMP_ATTRIB_SA_5, IMP_ATTRIB_SA_6, IMP_ATTRIB_SA_7, @@ -112,7 +112,7 @@ enum{ IMP_AF_4, IMP_AF_5, IMP_AF_6, - IMP_POR_1, + IMP_POR_1, IMP_POR_2, IMP_POR_3, IMP_POR_4, @@ -127,12 +127,12 @@ enum{ IMP_VOC_6, IMP_VOC_7, IMP_FIN_1, - IMP_FIN_2, + IMP_FIN_2, IMP_FIN_3, IMP_FIN_4, IMP_FIN_5, IMP_FIN_6, - IMP_FIN_7, + IMP_FIN_7, IMP_FIN_8, IMP_FIN_9, IMP_FIN_10, diff --git a/Laptop/IMP Voices.cpp b/Laptop/IMP Voices.cpp index 71a4e681..f57ed6f1 100644 --- a/Laptop/IMP Voices.cpp +++ b/Laptop/IMP Voices.cpp @@ -40,7 +40,7 @@ BOOLEAN fVoiceAVisited = FALSE, fVoiceBVisited = FALSE, fVoiceCVisited = FALSE; BOOLEAN fReDrawVoicesScreenFlag = FALSE; // the portrait region, for player to click on and re-hear voice -MOUSE_REGION gVoicePortraitRegion; +MOUSE_REGION gVoicePortraitRegion; // function definitions void IncrementVoice( void ); @@ -60,12 +60,12 @@ void IMPPortraitRegionButtonCallback(MOUSE_REGION * pRegion, INT32 iReason ); void EnterIMPVoices( void ) { - fVoiceAVisited = FALSE; + fVoiceAVisited = FALSE; fVoiceBVisited = FALSE; fVoiceCVisited = FALSE; // Set the initial voice - if (fCharacterIsMale == TRUE) + if (fCharacterIsMale == TRUE) { iCurrentVoice = GetFirstFreeSlot(MALE); } @@ -76,7 +76,7 @@ void EnterIMPVoices( void ) // create buttons CreateIMPVoicesButtons( ); - + // create mouse regions CreateIMPVoiceMouseRegions( ); @@ -92,19 +92,19 @@ void EnterIMPVoices( void ) void RenderIMPVoices( void ) { - - // render background + + // render background RenderProfileBackGround( ); // the Voices frame RenderPortraitFrame( 191, 167 ); - + // the sillouette RenderLargeSilhouette( 200, 176 ); // indent for the text - RenderAttrib1IndentFrame( 128, 65); + RenderAttrib1IndentFrame( 128, 65); // render voice index value RenderVoiceIndex( ); @@ -119,9 +119,9 @@ void RenderIMPVoices( void ) void ExitIMPVoices( void ) { // destroy buttons for IMP Voices page - DestroyIMPVoicesButtons( ); + DestroyIMPVoicesButtons( ); - // destroy mouse regions for this screen + // destroy mouse regions for this screen DestroyIMPVoiceMouseRegions( ); @@ -132,10 +132,10 @@ void HandleIMPVoices( void ) { // do we need to re write screen - if ( fReDrawVoicesScreenFlag == TRUE ) + if ( fReDrawVoicesScreenFlag == TRUE ) { - RenderIMPVoices( ); - + RenderIMPVoices( ); + // reset redraw flag fReDrawVoicesScreenFlag = FALSE; } @@ -146,7 +146,7 @@ void HandleIMPVoices( void ) // WDS: Allow flexible numbers of IMPs of each sex // Ensure the voice is within the valid range -void FixVoiceRange() +void FixVoiceRange() { if (fCharacterIsMale == TRUE) { @@ -191,7 +191,7 @@ void IncrementVoice( void ) void DecrementVoice( void ) { - INT32 iIMPIndex = -1; + INT32 iIMPIndex = -1; INT32 i; iCurrentVoice--; @@ -215,54 +215,54 @@ void DecrementVoice( void ) void CreateIMPVoicesButtons( void ) { - // will create buttons need for the IMP Voices screen + // will create buttons need for the IMP Voices screen // next button - giIMPVoicesButtonImage[0]= LoadButtonImage( "LAPTOP\\voicearrows.sti" ,-1,1,-1,3,-1 ); - /*giIMPVoicesButton[0] = QuickCreateButton( giIMPVoicesButtonImage[0], LAPTOP_SCREEN_UL_X + ( 18 ), LAPTOP_SCREEN_WEB_UL_Y + ( 184 ), + giIMPVoicesButtonImage[0]= LoadButtonImage( "LAPTOP\\voicearrows.sti" ,-1,1,-1,3,-1 ); + /*giIMPVoicesButton[0] = QuickCreateButton( giIMPVoicesButtonImage[0], LAPTOP_SCREEN_UL_X + ( 18 ), LAPTOP_SCREEN_WEB_UL_Y + ( 184 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPVoicesNextCallback ); - */ - giIMPVoicesButton[0] = CreateIconAndTextButton( giIMPVoicesButtonImage[0], pImpButtonText[ 13 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( 343 ), LAPTOP_SCREEN_WEB_UL_Y + ( 205 ),BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPVoicesNextCallback); + */ + giIMPVoicesButton[0] = CreateIconAndTextButton( giIMPVoicesButtonImage[0], pImpButtonText[ 13 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 343 ), LAPTOP_SCREEN_WEB_UL_Y + ( 205 ),BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPVoicesNextCallback); // previous button - giIMPVoicesButtonImage[ 1 ]= LoadButtonImage( "LAPTOP\\voicearrows.sti" ,-1,0,-1,2,-1 ); -/* giIMPVoicesButton[ 1 ] = QuickCreateButton( giIMPVoicesButtonImage[ 1 ], LAPTOP_SCREEN_UL_X + ( 18 ), LAPTOP_SCREEN_WEB_UL_Y + ( 254 ), + giIMPVoicesButtonImage[ 1 ]= LoadButtonImage( "LAPTOP\\voicearrows.sti" ,-1,0,-1,2,-1 ); +/* giIMPVoicesButton[ 1 ] = QuickCreateButton( giIMPVoicesButtonImage[ 1 ], LAPTOP_SCREEN_UL_X + ( 18 ), LAPTOP_SCREEN_WEB_UL_Y + ( 254 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPVoicesPreviousCallback ); - */ - giIMPVoicesButton[ 1 ] = CreateIconAndTextButton( giIMPVoicesButtonImage[ 1 ], pImpButtonText[ 12 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( 93), LAPTOP_SCREEN_WEB_UL_Y + ( 205 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPVoicesPreviousCallback); + */ + giIMPVoicesButton[ 1 ] = CreateIconAndTextButton( giIMPVoicesButtonImage[ 1 ], pImpButtonText[ 12 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 93), LAPTOP_SCREEN_WEB_UL_Y + ( 205 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPVoicesPreviousCallback); // done button - giIMPVoicesButtonImage[ 2 ]= LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 ); - /* giIMPVoicesButton[ 2 ] = QuickCreateButton( giIMPVoicesButtonImage[ 1 ], LAPTOP_SCREEN_UL_X + ( 349 ), LAPTOP_SCREEN_WEB_UL_Y + ( 220 ), + giIMPVoicesButtonImage[ 2 ]= LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 ); + /* giIMPVoicesButton[ 2 ] = QuickCreateButton( giIMPVoicesButtonImage[ 1 ], LAPTOP_SCREEN_UL_X + ( 349 ), LAPTOP_SCREEN_WEB_UL_Y + ( 220 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPVoicesDoneCallback ); - */ - giIMPVoicesButton[ 2 ] = CreateIconAndTextButton( giIMPVoicesButtonImage[ 2 ], pImpButtonText[ 11 ], FONT12ARIAL, - FONT_WHITE, DEFAULT_SHADOW, - FONT_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - LAPTOP_SCREEN_UL_X + ( 187 ), LAPTOP_SCREEN_WEB_UL_Y + ( 330 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPVoicesDoneCallback); + */ + giIMPVoicesButton[ 2 ] = CreateIconAndTextButton( giIMPVoicesButtonImage[ 2 ], pImpButtonText[ 11 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 187 ), LAPTOP_SCREEN_WEB_UL_Y + ( 330 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPVoicesDoneCallback); - SetButtonCursor(giIMPVoicesButton[0], CURSOR_WWW); - SetButtonCursor(giIMPVoicesButton[1], CURSOR_WWW); - SetButtonCursor(giIMPVoicesButton[2], CURSOR_WWW); + SetButtonCursor(giIMPVoicesButton[0], CURSOR_WWW); + SetButtonCursor(giIMPVoicesButton[1], CURSOR_WWW); + SetButtonCursor(giIMPVoicesButton[2], CURSOR_WWW); } @@ -272,18 +272,18 @@ void DestroyIMPVoicesButtons( void ) { // will destroy buttons created for IMP Voices screen - + // the next button - RemoveButton(giIMPVoicesButton[ 0 ] ); - UnloadButtonImage(giIMPVoicesButtonImage[ 0 ] ); - + RemoveButton(giIMPVoicesButton[ 0 ] ); + UnloadButtonImage(giIMPVoicesButtonImage[ 0 ] ); + // the previous button - RemoveButton(giIMPVoicesButton[ 1 ] ); - UnloadButtonImage(giIMPVoicesButtonImage[ 1 ] ); - + RemoveButton(giIMPVoicesButton[ 1 ] ); + UnloadButtonImage(giIMPVoicesButtonImage[ 1 ] ); + // the done button - RemoveButton(giIMPVoicesButton[ 2 ] ); - UnloadButtonImage(giIMPVoicesButtonImage[ 2 ] ); + RemoveButton(giIMPVoicesButton[ 2 ] ); + UnloadButtonImage(giIMPVoicesButtonImage[ 2 ] ); return; } @@ -298,32 +298,32 @@ void BtnIMPVoicesNextCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - + btn->uiFlags&=~(BUTTON_CLICKED_ON); + // next voice!! IncrementVoice( ); // play voice if( ! SoundIsPlaying( uiVocVoiceSound ) ) { - uiVocVoiceSound = PlayVoice( ); - } + uiVocVoiceSound = PlayVoice( ); + } else { SoundStop( uiVocVoiceSound ); uiVocVoiceSound = PlayVoice( ); } - + fReDrawVoicesScreenFlag = TRUE; } - } -} + } +} void BtnIMPVoicesPreviousCallback(GUI_BUTTON *btn,INT32 reason) { @@ -334,21 +334,21 @@ void BtnIMPVoicesPreviousCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - + btn->uiFlags&=~(BUTTON_CLICKED_ON); + // previous voice, please!!! DecrementVoice( ); // play voice if( ! SoundIsPlaying( uiVocVoiceSound ) ) { - uiVocVoiceSound = PlayVoice( ); - } + uiVocVoiceSound = PlayVoice( ); + } else { SoundStop( uiVocVoiceSound ); @@ -357,8 +357,8 @@ void BtnIMPVoicesPreviousCallback(GUI_BUTTON *btn,INT32 reason) fReDrawVoicesScreenFlag = TRUE; } - } -} + } +} void BtnIMPVoicesDoneCallback(GUI_BUTTON *btn,INT32 reason) { @@ -369,22 +369,22 @@ void BtnIMPVoicesDoneCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - + btn->uiFlags&=~(BUTTON_CLICKED_ON); + // go to main page iCurrentImpPage = IMP_MAIN_PAGE; // if we are already done, leave - if( iCurrentProfileMode == IMP__FINISH ) + if( iCurrentProfileMode == IMP__FINISH ) { - iCurrentImpPage = IMP_FINISH; - } + iCurrentImpPage = IMP_FINISH; + } else { if( CameBackToVoicePageButNotFinished() ) @@ -398,7 +398,7 @@ void BtnIMPVoicesDoneCallback(GUI_BUTTON *btn,INT32 reason) } /* // current mode now is voice - else if( iCurrentProfileMode < IMP__PORTRAIT ) + else if( iCurrentProfileMode < IMP__PORTRAIT ) { iCurrentProfileMode = IMP__PORTRAIT; } @@ -411,15 +411,15 @@ void BtnIMPVoicesDoneCallback(GUI_BUTTON *btn,INT32 reason) } */ // set voice id, to grab character slot - + // WDS: Allow flexible numbers of IMPs of each sex LaptopSaveInfo.iIMPIndex = gGameExternalOptions.iaIMPSlots[iCurrentVoice]; - // set button up image pending + // set button up image pending fButtonPendingFlag = TRUE; } - } -} + } +} BOOLEAN CameBackToVoicePageButNotFinished() { @@ -444,17 +444,17 @@ UINT32 PlayVoice( void ) Assert((iSlot >= 0) && (iSlot <= 999)); sprintf(caVoiceSample, caVoiceSample, iSlot); - return( PlayJA2SampleFromFile( caVoiceSample, RATE_11025, MIDVOLUME, 1 , MIDDLEPAN ) ); + return( PlayJA2SampleFromFile( caVoiceSample, RATE_11025, MIDVOLUME, 1 , MIDDLEPAN ) ); } void CreateIMPVoiceMouseRegions( void ) { - // will create mouse regions needed for the IMP voices page + // will create mouse regions needed for the IMP voices page MSYS_DefineRegion( &gVoicePortraitRegion, LAPTOP_SCREEN_UL_X + 200, LAPTOP_SCREEN_WEB_UL_Y + 176 ,LAPTOP_SCREEN_UL_X + 200 + 100, LAPTOP_SCREEN_WEB_UL_Y + 176 + 100,MSYS_PRIORITY_HIGH, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, IMPPortraitRegionButtonCallback ); - - + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, IMPPortraitRegionButtonCallback ); + + MSYS_AddRegion( &gVoicePortraitRegion ); return; @@ -462,29 +462,29 @@ void CreateIMPVoiceMouseRegions( void ) void DestroyIMPVoiceMouseRegions( void ) { - // will destroy already created mouse reiogns for IMP voices page - MSYS_RemoveRegion( &gVoicePortraitRegion ); + // will destroy already created mouse reiogns for IMP voices page + MSYS_RemoveRegion( &gVoicePortraitRegion ); return; } void IMPPortraitRegionButtonCallback(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ // callback handler for imp portrait region button events - if (iReason & MSYS_CALLBACK_REASON_INIT) - { - return; - } - if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) - { - if( ! SoundIsPlaying( uiVocVoiceSound ) ) + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + return; + } + if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + if( ! SoundIsPlaying( uiVocVoiceSound ) ) { - uiVocVoiceSound = PlayVoice( ); + uiVocVoiceSound = PlayVoice( ); } - - } + + } return; } @@ -508,4 +508,4 @@ void RenderVoiceIndex( void ) mprintf( sX, iScreenHeightOffset + 320, sString ); return; -} \ No newline at end of file +} diff --git a/Laptop/IMPVideoObjects.cpp b/Laptop/IMPVideoObjects.cpp index 96186bc8..6f3d6b79 100644 --- a/Laptop/IMPVideoObjects.cpp +++ b/Laptop/IMPVideoObjects.cpp @@ -15,7 +15,7 @@ #include "IMP Attribute Selection.h" #endif -// globals +// globals // video object handles @@ -67,8 +67,8 @@ extern void DrawBonusPointsRemaining( void ); BOOLEAN LoadProfileBackGround( void ) { - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + // this procedure will load in the graphics for the generic background VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; @@ -80,9 +80,9 @@ BOOLEAN LoadProfileBackGround( void ) } void RemoveProfileBackGround( void ) -{ +{ - // remove background + // remove background DeleteVideoObjectFromIndex( guiBACKGROUND ); return; @@ -93,40 +93,39 @@ void RenderProfileBackGround( void ) { HVOBJECT hHandle; - INT32 iCurrentHeight = 0; - INT32 iCounter = 0; + INT32 iCounter = 0; + + // this procedure will render the generic backgound to the screen - // this procedure will render the generic backgound to the screen - // get the video object - GetVideoObject(&hHandle, guiBACKGROUND); - + GetVideoObject(&hHandle, guiBACKGROUND); + // render each row 5 times wide, 5 tiles high - for(iCounter = 0; iCounter < 4; iCounter++) + for(iCounter = 0; iCounter < 4; iCounter++) { - // blt background to screen from left to right - BltVideoObject(FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X + 0 * CHAR_PROFILE_BACKGROUND_TILE_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + iCounter * CHAR_PROFILE_BACKGROUND_TILE_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); - BltVideoObject(FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X + 1 * CHAR_PROFILE_BACKGROUND_TILE_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + iCounter * CHAR_PROFILE_BACKGROUND_TILE_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); - BltVideoObject(FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X + 2 * CHAR_PROFILE_BACKGROUND_TILE_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + iCounter * CHAR_PROFILE_BACKGROUND_TILE_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); - BltVideoObject(FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X + 3 * CHAR_PROFILE_BACKGROUND_TILE_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + iCounter * CHAR_PROFILE_BACKGROUND_TILE_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); - } + // blt background to screen from left to right + BltVideoObject(FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X + 0 * CHAR_PROFILE_BACKGROUND_TILE_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + iCounter * CHAR_PROFILE_BACKGROUND_TILE_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X + 1 * CHAR_PROFILE_BACKGROUND_TILE_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + iCounter * CHAR_PROFILE_BACKGROUND_TILE_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X + 2 * CHAR_PROFILE_BACKGROUND_TILE_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + iCounter * CHAR_PROFILE_BACKGROUND_TILE_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X + 3 * CHAR_PROFILE_BACKGROUND_TILE_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + iCounter * CHAR_PROFILE_BACKGROUND_TILE_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + } // dirty buttons MarkButtonsDirty( ); // force refresh of screen - InvalidateRegion( LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_WEB_UL_Y, SCREEN_WIDTH, SCREEN_HEIGHT ); + InvalidateRegion( LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_WEB_UL_Y, SCREEN_WIDTH, SCREEN_HEIGHT ); return; } BOOLEAN LoadIMPSymbol( void ) { - + // this procedure will load the IMP main symbol into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; GetMLGFilename( VObjectDesc.ImageFile, MLG_IMPSYMBOL ); CHECKF(AddVideoObject(&VObjectDesc, &guiIMPSYMBOL)); @@ -138,7 +137,7 @@ BOOLEAN LoadIMPSymbol( void ) void DeleteIMPSymbol( void ) { - // remove IMP symbol + // remove IMP symbol DeleteVideoObjectFromIndex( guiIMPSYMBOL ); return; @@ -146,12 +145,12 @@ void DeleteIMPSymbol( void ) void RenderIMPSymbol(INT16 sX, INT16 sY) { - HVOBJECT hHandle; + HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiIMPSYMBOL); + // get the video object + GetVideoObject(&hHandle, guiIMPSYMBOL); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); return; @@ -163,10 +162,10 @@ void RenderIMPSymbol(INT16 sX, INT16 sY) BOOLEAN LoadBeginIndent( void ) { - + // this procedure will load the indent main symbol into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\BeginScreenIndent.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiBEGININDENT)); @@ -178,7 +177,7 @@ BOOLEAN LoadBeginIndent( void ) void DeleteBeginIndent( void ) { - // remove indent symbol + // remove indent symbol DeleteVideoObjectFromIndex( guiBEGININDENT ); @@ -187,14 +186,14 @@ void DeleteBeginIndent( void ) void RenderBeginIndent(INT16 sX, INT16 sY) { - HVOBJECT hHandle; + HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiBEGININDENT); + // get the video object + GetVideoObject(&hHandle, guiBEGININDENT); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } @@ -207,10 +206,10 @@ void RenderBeginIndent(INT16 sX, INT16 sY) BOOLEAN LoadActivationIndent( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\ActivationIndent.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiACTIVATIONINDENT)); @@ -222,7 +221,7 @@ BOOLEAN LoadActivationIndent( void ) void DeleteActivationIndent( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiACTIVATIONINDENT ); return; @@ -230,14 +229,14 @@ void DeleteActivationIndent( void ) void RenderActivationIndent(INT16 sX, INT16 sY) { - HVOBJECT hHandle; + HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiACTIVATIONINDENT); + // get the video object + GetVideoObject(&hHandle, guiACTIVATIONINDENT); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } @@ -246,10 +245,10 @@ void RenderActivationIndent(INT16 sX, INT16 sY) BOOLEAN LoadFrontPageIndent( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\FrontPageIndent.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiFRONTPAGEINDENT)); @@ -261,7 +260,7 @@ BOOLEAN LoadFrontPageIndent( void ) void DeleteFrontPageIndent( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiFRONTPAGEINDENT ); return; @@ -269,14 +268,14 @@ void DeleteFrontPageIndent( void ) void RenderFrontPageIndent(INT16 sX, INT16 sY) { - HVOBJECT hHandle; + HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiFRONTPAGEINDENT); + // get the video object + GetVideoObject(&hHandle, guiFRONTPAGEINDENT); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } @@ -287,10 +286,10 @@ void RenderFrontPageIndent(INT16 sX, INT16 sY) BOOLEAN LoadAnalyse( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\Analyze.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiANALYSE)); @@ -302,7 +301,7 @@ BOOLEAN LoadAnalyse( void ) void DeleteAnalyse( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiANALYSE ); return; @@ -313,12 +312,12 @@ void RenderAnalyse(INT16 sX, INT16 sY, INT8 bImageNumber) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiANALYSE); + // get the video object + GetVideoObject(&hHandle, guiANALYSE); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, bImageNumber, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } @@ -329,22 +328,22 @@ void RenderAnalyse(INT16 sX, INT16 sY, INT8 bImageNumber) BOOLEAN LoadAttributeGraph( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\Attributegraph.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiATTRIBUTEGRAPH)); return (TRUE) ; } - + void DeleteAttributeGraph( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiATTRIBUTEGRAPH ); return; @@ -356,12 +355,12 @@ void RenderAttributeGraph(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiATTRIBUTEGRAPH); + // get the video object + GetVideoObject(&hHandle, guiATTRIBUTEGRAPH); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } @@ -371,10 +370,10 @@ void RenderAttributeGraph(INT16 sX, INT16 sY) BOOLEAN LoadAttributeGraphBar( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\AttributegraphBar.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiATTRIBUTEGRAPHBAR)); @@ -386,7 +385,7 @@ BOOLEAN LoadAttributeGraphBar( void ) void DeleteAttributeBarGraph( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiATTRIBUTEGRAPHBAR ); return; @@ -394,14 +393,14 @@ void DeleteAttributeBarGraph( void ) void RenderAttributeBarGraph(INT16 sX, INT16 sY) { - HVOBJECT hHandle; + HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiATTRIBUTEGRAPHBAR); + // get the video object + GetVideoObject(&hHandle, guiATTRIBUTEGRAPHBAR); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } @@ -413,10 +412,10 @@ void RenderAttributeBarGraph(INT16 sX, INT16 sY) BOOLEAN LoadFullNameIndent( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\FullNameIndent.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiFULLNAMEINDENT)); @@ -428,7 +427,7 @@ BOOLEAN LoadFullNameIndent( void ) void DeleteFullNameIndent( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiFULLNAMEINDENT ); return; @@ -440,12 +439,12 @@ void RenderFullNameIndent(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiFULLNAMEINDENT); + // get the video object + GetVideoObject(&hHandle, guiFULLNAMEINDENT); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } @@ -453,10 +452,10 @@ void RenderFullNameIndent(INT16 sX, INT16 sY) BOOLEAN LoadNickNameIndent( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\NickName.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiNICKNAMEINDENT)); @@ -468,7 +467,7 @@ BOOLEAN LoadNickNameIndent( void ) void DeleteNickNameIndent( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiNICKNAMEINDENT ); return; @@ -480,22 +479,22 @@ void RenderNickNameIndent(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiNICKNAMEINDENT); + // get the video object + GetVideoObject(&hHandle, guiNICKNAMEINDENT); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } BOOLEAN LoadNameIndent( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\NameIndent.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiNAMEINDENT)); @@ -507,7 +506,7 @@ BOOLEAN LoadNameIndent( void ) void DeleteNameIndent( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiNAMEINDENT ); return; @@ -519,25 +518,25 @@ void RenderNameIndent(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiNAMEINDENT); + // get the video object + GetVideoObject(&hHandle, guiNAMEINDENT); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } - + BOOLEAN LoadGenderIndent( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\GenderIndent.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiGENDERINDENT)); @@ -549,7 +548,7 @@ BOOLEAN LoadGenderIndent( void ) void DeleteGenderIndent( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiGENDERINDENT ); return; @@ -560,12 +559,12 @@ void RenderGenderIndent(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiGENDERINDENT); + // get the video object + GetVideoObject(&hHandle, guiGENDERINDENT); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } @@ -574,10 +573,10 @@ void RenderGenderIndent(INT16 sX, INT16 sY) BOOLEAN LoadSmallFrame( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\SmallFrame.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiSMALLFRAME)); @@ -589,7 +588,7 @@ BOOLEAN LoadSmallFrame( void ) void DeleteSmallFrame( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiSMALLFRAME ); return; @@ -600,12 +599,12 @@ void RenderSmallFrame(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiSMALLFRAME); + // get the video object + GetVideoObject(&hHandle, guiSMALLFRAME); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } @@ -614,10 +613,10 @@ void RenderSmallFrame(INT16 sX, INT16 sY) BOOLEAN LoadSmallSilhouette( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\SmallSilhouette.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiSMALLSILHOUETTE)); @@ -629,7 +628,7 @@ BOOLEAN LoadSmallSilhouette( void ) void DeleteSmallSilhouette( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiSMALLSILHOUETTE ); return; @@ -640,12 +639,12 @@ void RenderSmallSilhouette(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiSMALLSILHOUETTE); + // get the video object + GetVideoObject(&hHandle, guiSMALLSILHOUETTE); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } @@ -653,10 +652,10 @@ void RenderSmallSilhouette(INT16 sX, INT16 sY) BOOLEAN LoadLargeSilhouette( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\largesilhouette.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiLARGESILHOUETTE)); @@ -668,7 +667,7 @@ BOOLEAN LoadLargeSilhouette( void ) void DeleteLargeSilhouette( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiLARGESILHOUETTE ); return; @@ -679,22 +678,22 @@ void RenderLargeSilhouette(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiLARGESILHOUETTE); + // get the video object + GetVideoObject(&hHandle, guiLARGESILHOUETTE); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } BOOLEAN LoadAttributeFrame( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\attributeframe.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiATTRIBUTEFRAME)); @@ -706,7 +705,7 @@ BOOLEAN LoadAttributeFrame( void ) void DeleteAttributeFrame( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiATTRIBUTEFRAME ); return; @@ -719,12 +718,12 @@ void RenderAttributeFrame(INT16 sX, INT16 sY) INT32 iCounter = 0; INT16 sCurrentY = 0; - // get the video object - GetVideoObject(&hHandle, guiATTRIBUTEFRAME); + // get the video object + GetVideoObject(&hHandle, guiATTRIBUTEFRAME); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + sCurrentY += 10; for( iCounter = 0; iCounter < 10; iCounter++ ) { @@ -755,12 +754,12 @@ void RenderAttributeFrameForIndex( INT16 sX, INT16 sY, INT32 iIndex ) sCurrentY = ( INT16 )( 10 + ( iIndex * 20 ) ); - // get the video object - GetVideoObject(&hHandle, guiATTRIBUTEFRAME); + // get the video object + GetVideoObject(&hHandle, guiATTRIBUTEFRAME); // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 2, LAPTOP_SCREEN_UL_X + sX + 134, LAPTOP_SCREEN_WEB_UL_Y + sY + sCurrentY, VO_BLT_SRCTRANSPARENCY,NULL); - + RenderAttrib2IndentFrame(350, 42 ); // amt of bonus pts @@ -770,18 +769,18 @@ void RenderAttributeFrameForIndex( INT16 sX, INT16 sY, INT32 iIndex ) RenderAttributeBoxes( ); InvalidateRegion( LAPTOP_SCREEN_UL_X + sX + 134, LAPTOP_SCREEN_WEB_UL_Y + sY + sCurrentY, LAPTOP_SCREEN_UL_X + sX + 400, LAPTOP_SCREEN_WEB_UL_Y + sY + sCurrentY + 21 ); - - + + return; } BOOLEAN LoadSliderBar( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\attributeslider.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiSLIDERBAR)); @@ -793,7 +792,7 @@ BOOLEAN LoadSliderBar( void ) void DeleteSliderBar( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiSLIDERBAR ); return; @@ -804,12 +803,12 @@ void RenderSliderBar(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiSLIDERBAR); + // get the video object + GetVideoObject(&hHandle, guiSLIDERBAR); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } @@ -818,10 +817,10 @@ void RenderSliderBar(INT16 sX, INT16 sY) BOOLEAN LoadButton2Image( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\button_2.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiBUTTON2IMAGE)); @@ -833,7 +832,7 @@ BOOLEAN LoadButton2Image( void ) void DeleteButton2Image( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiBUTTON2IMAGE ); return; @@ -844,21 +843,21 @@ void RenderButton2Image(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiBUTTON2IMAGE); + // get the video object + GetVideoObject(&hHandle, guiBUTTON2IMAGE); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } BOOLEAN LoadButton4Image( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\button_4.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiBUTTON4IMAGE)); @@ -870,7 +869,7 @@ BOOLEAN LoadButton4Image( void ) void DeleteButton4Image( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiBUTTON4IMAGE ); return; @@ -881,22 +880,22 @@ void RenderButton4Image(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiBUTTON4IMAGE); + // get the video object + GetVideoObject(&hHandle, guiBUTTON4IMAGE); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } BOOLEAN LoadButton1Image( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\button_1.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiBUTTON1IMAGE)); @@ -908,7 +907,7 @@ BOOLEAN LoadButton1Image( void ) void DeleteButton1Image( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiBUTTON1IMAGE ); return; @@ -919,22 +918,22 @@ void RenderButton1Image(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiBUTTON1IMAGE); + // get the video object + GetVideoObject(&hHandle, guiBUTTON1IMAGE); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } BOOLEAN LoadPortraitFrame( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\Voice_PortraitFrame.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiPORTRAITFRAME)); @@ -946,7 +945,7 @@ BOOLEAN LoadPortraitFrame( void ) void DeletePortraitFrame( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiPORTRAITFRAME ); return; @@ -957,12 +956,12 @@ void RenderPortraitFrame(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiPORTRAITFRAME); + // get the video object + GetVideoObject(&hHandle, guiPORTRAITFRAME); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } @@ -970,10 +969,10 @@ void RenderPortraitFrame(INT16 sX, INT16 sY) BOOLEAN LoadMainIndentFrame( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\mainprofilepageindent.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiMAININDENT)); @@ -985,7 +984,7 @@ BOOLEAN LoadMainIndentFrame( void ) void DeleteMainIndentFrame( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiMAININDENT ); return; @@ -996,22 +995,22 @@ void RenderMainIndentFrame(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiMAININDENT); + // get the video object + GetVideoObject(&hHandle, guiMAININDENT); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } BOOLEAN LoadQtnLongIndentFrame( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\longindent.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiLONGINDENT)); @@ -1023,7 +1022,7 @@ BOOLEAN LoadQtnLongIndentFrame( void ) void DeleteQtnLongIndentFrame( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiLONGINDENT ); return; @@ -1034,21 +1033,21 @@ void RenderQtnLongIndentFrame(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiLONGINDENT); + // get the video object + GetVideoObject(&hHandle, guiLONGINDENT); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } BOOLEAN LoadQtnShortIndentFrame( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\shortindent.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiSHORTINDENT)); @@ -1060,7 +1059,7 @@ BOOLEAN LoadQtnShortIndentFrame( void ) void DeleteQtnShortIndentFrame( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiSHORTINDENT ); return; @@ -1071,21 +1070,21 @@ void RenderQtnShortIndentFrame(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiSHORTINDENT); + // get the video object + GetVideoObject(&hHandle, guiSHORTINDENT); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } BOOLEAN LoadQtnLongIndentHighFrame( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\longindenthigh.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiLONGHINDENT)); @@ -1097,7 +1096,7 @@ BOOLEAN LoadQtnLongIndentHighFrame( void ) void DeleteQtnLongIndentHighFrame( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiLONGHINDENT ); return; @@ -1108,21 +1107,21 @@ void RenderQtnLongIndentHighFrame(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiLONGHINDENT); + // get the video object + GetVideoObject(&hHandle, guiLONGHINDENT); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } BOOLEAN LoadQtnShortIndentHighFrame( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\shortindenthigh.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiSHORTHINDENT)); @@ -1134,7 +1133,7 @@ BOOLEAN LoadQtnShortIndentHighFrame( void ) void DeleteQtnShortIndentHighFrame( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiSHORTHINDENT ); return; @@ -1145,22 +1144,22 @@ void RenderQtnShortIndentHighFrame(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiSHORTHINDENT); + // get the video object + GetVideoObject(&hHandle, guiSHORTHINDENT); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } BOOLEAN LoadQtnIndentFrame( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\questionindent.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiQINDENT)); @@ -1172,7 +1171,7 @@ BOOLEAN LoadQtnIndentFrame( void ) void DeleteQtnIndentFrame( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiQINDENT ); return; @@ -1183,22 +1182,22 @@ void RenderQtnIndentFrame(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiQINDENT); + // get the video object + GetVideoObject(&hHandle, guiQINDENT); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } BOOLEAN LoadAttrib1IndentFrame( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\attributescreenindent_1.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiA1INDENT)); @@ -1210,7 +1209,7 @@ BOOLEAN LoadAttrib1IndentFrame( void ) void DeleteAttrib1IndentFrame( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiA1INDENT ); return; @@ -1221,21 +1220,21 @@ void RenderAttrib1IndentFrame(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiA1INDENT); + // get the video object + GetVideoObject(&hHandle, guiA1INDENT); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } BOOLEAN LoadAttrib2IndentFrame( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\attributescreenindent_2.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiA2INDENT)); @@ -1247,7 +1246,7 @@ BOOLEAN LoadAttrib2IndentFrame( void ) void DeleteAttrib2IndentFrame( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiA2INDENT ); return; @@ -1258,21 +1257,21 @@ void RenderAttrib2IndentFrame(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiA2INDENT); + // get the video object + GetVideoObject(&hHandle, guiA2INDENT); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } BOOLEAN LoadAvgMercIndentFrame( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\anaveragemercindent.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiAVGMERCINDENT)); @@ -1284,7 +1283,7 @@ BOOLEAN LoadAvgMercIndentFrame( void ) void DeleteAvgMercIndentFrame( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiAVGMERCINDENT ); return; @@ -1295,12 +1294,12 @@ void RenderAvgMercIndentFrame(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiAVGMERCINDENT); + // get the video object + GetVideoObject(&hHandle, guiAVGMERCINDENT); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } @@ -1308,10 +1307,10 @@ void RenderAvgMercIndentFrame(INT16 sX, INT16 sY) BOOLEAN LoadAboutUsIndentFrame( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\aboutusindent.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiABOUTUSINDENT)); @@ -1323,7 +1322,7 @@ BOOLEAN LoadAboutUsIndentFrame( void ) void DeleteAboutUsIndentFrame( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiABOUTUSINDENT ); return; @@ -1334,22 +1333,22 @@ void RenderAboutUsIndentFrame(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiABOUTUSINDENT); + // get the video object + GetVideoObject(&hHandle, guiABOUTUSINDENT); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } BOOLEAN LoadQtnShort2IndentFrame( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\shortindent2.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiSHORT2INDENT)); @@ -1361,7 +1360,7 @@ BOOLEAN LoadQtnShort2IndentFrame( void ) void DeleteQtnShort2IndentFrame( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiSHORT2INDENT ); return; @@ -1372,21 +1371,21 @@ void RenderQtnShort2IndentFrame(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiSHORT2INDENT); + // get the video object + GetVideoObject(&hHandle, guiSHORT2INDENT); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } BOOLEAN LoadQtnShort2IndentHighFrame( void ) { - + // this procedure will load the activation indent into memory - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\shortindent2High.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiSHORT2HINDENT)); @@ -1398,7 +1397,7 @@ BOOLEAN LoadQtnShort2IndentHighFrame( void ) void DeleteQtnShort2IndentHighFrame( void ) { - // remove activation indent symbol + // remove activation indent symbol DeleteVideoObjectFromIndex( guiSHORT2HINDENT ); return; @@ -1409,17 +1408,18 @@ void RenderQtnShort2IndentHighFrame(INT16 sX, INT16 sY) HVOBJECT hHandle; - // get the video object - GetVideoObject(&hHandle, guiSHORT2HINDENT); + // get the video object + GetVideoObject(&hHandle, guiSHORT2HINDENT); - // blt to sX, sY relative to upper left corner + // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); - + return; } - + + diff --git a/Laptop/LaptopSave.h b/Laptop/LaptopSave.h index e17efa7c..d46eb145 100644 --- a/Laptop/LaptopSave.h +++ b/Laptop/LaptopSave.h @@ -1,10 +1,15 @@ #ifndef _LAPTOP_SAVE_H_ #define _LAPTOP_SAVE_H_ -#include "Item Types.h" +//#include "Item Types.h" #include "FileMan.h" #include "Store Inventory.h" +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + #define MAX_BOOKMARKS 20 diff --git a/Laptop/Laptop_2005Express.vcproj b/Laptop/Laptop_2005Express.vcproj index 6f296618..4d7f3dc9 100644 --- a/Laptop/Laptop_2005Express.vcproj +++ b/Laptop/Laptop_2005Express.vcproj @@ -1,7 +1,7 @@ - + + + + + + + + + + + + + + + + + + diff --git a/Laptop/Store Inventory.cpp b/Laptop/Store Inventory.cpp index 058196d4..b9f6fa51 100644 --- a/Laptop/Store Inventory.cpp +++ b/Laptop/Store Inventory.cpp @@ -19,61 +19,61 @@ UINT8 StoreInventory[MAXITEMS][BOBBY_RAY_LISTS]; //= //// The first column is for Bobby Rays new inventory, BOBBY_RAY_NEW, //// The second column is for Bobby Rays used inventory, BOBBY_RAY_USED, //// -// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ //// MADD MARKER ////---WEAPONS--- -// {8, 1 }, /* Glock 17 */ -// {6, 1 }, /* Glock 18 */ -// {8, 1 }, /* Beretta 92F */ -// {6, 1 }, /* Beretta 93R */ -// {8, 1 }, /* .38 S&W Special */ -// {8, 1 }, /* .357 Barracuda */ -// {6, 1 }, /* .357 DesertEagle*/ -// {7, 1 }, /* .45 M1911 */ -// {4, 1 }, /* H&K MP5K */ -// {4, 1 }, /* .45 MAC-10 */ // 10 +// {8, 1 }, /* Glock 17 */ +// {6, 1 }, /* Glock 18 */ +// {8, 1 }, /* Beretta 92F */ +// {6, 1 }, /* Beretta 93R */ +// {8, 1 }, /* .38 S&W Special */ +// {8, 1 }, /* .357 Barracuda */ +// {6, 1 }, /* .357 DesertEagle*/ +// {7, 1 }, /* .45 M1911 */ +// {4, 1 }, /* H&K MP5K */ +// {4, 1 }, /* .45 MAC-10 */ // 10 // -// {4, 1 }, /* Thompson M1A1 */ -// {4, 1 }, /* Colt Commando */ -// {4, 1 }, /* H&K MP53 */ -// {4, 1 }, /* AKSU-74 */ -// {2, 1 }, /* 5.7mm FN P90 */ -// {4, 1 }, /* Type-85 */ -// {3, 1 }, /* SKS */ -// {2, 1 }, /* Dragunov */ -// {2, 1 }, /* M24 */ -// {3, 1 }, /* Steyr AUG */ //20 +// {4, 1 }, /* Thompson M1A1 */ +// {4, 1 }, /* Colt Commando */ +// {4, 1 }, /* H&K MP53 */ +// {4, 1 }, /* AKSU-74 */ +// {2, 1 }, /* 5.7mm FN P90 */ +// {4, 1 }, /* Type-85 */ +// {3, 1 }, /* SKS */ +// {2, 1 }, /* Dragunov */ +// {2, 1 }, /* M24 */ +// {3, 1 }, /* Steyr AUG */ //20 // -// {3, 1 }, /* H&K G41 */ -// {3, 1 }, /* Ruger Mini-14 */ -// {3, 1 }, /* C-7 */ -// {3, 1 }, /* FA-MAS */ -// {3, 1 }, /* AK-74 */ -// {3, 1 }, /* AKM */ -// {3, 1 }, /* M-14 */ -// {3, 1 }, /* FN-FAL */ -// {3, 1 }, /* H&K G3A3 */ -// {3, 1 }, /* H&K G11 */ // 30 +// {3, 1 }, /* H&K G41 */ +// {3, 1 }, /* Ruger Mini-14 */ +// {3, 1 }, /* C-7 */ +// {3, 1 }, /* FA-MAS */ +// {3, 1 }, /* AK-74 */ +// {3, 1 }, /* AKM */ +// {3, 1 }, /* M-14 */ +// {3, 1 }, /* FN-FAL */ +// {3, 1 }, /* H&K G3A3 */ +// {3, 1 }, /* H&K G11 */ // 30 // -// {5, 1 }, /* Remington M870 */ -// {3, 1 }, /* SPAS-15 */ -// {2, 1 }, /* CAWS */ -// {2, 1 }, /* FN Minimi */ -// {2, 1 }, /* RPK-74 */ -// {2, 1 }, /* H&K 21E */ -// {5, 0 }, /* combat knife */ -// {7, 0 }, /* throwing knife */ -// {0, 0 }, /* rock */ +// {5, 1 }, /* Remington M870 */ +// {3, 1 }, /* SPAS-15 */ +// {2, 1 }, /* CAWS */ +// {2, 1 }, /* FN Minimi */ +// {2, 1 }, /* RPK-74 */ +// {2, 1 }, /* H&K 21E */ +// {5, 0 }, /* combat knife */ +// {7, 0 }, /* throwing knife */ +// {0, 0 }, /* rock */ // {2, 0 }, /* grenade launcher*/ // 40 // // {2, 0 }, /* mortar */ -// {0, 0 }, /* another rock */ -// {0, 0 }, /* claws */ +// {0, 0 }, /* another rock */ +// {0, 0 }, /* claws */ // {0, 0 }, /* claws */ // {0, 0 }, /* claws */ // {0, 0 }, /* claws */ // {0, 0 }, /* tentacles */ -// {0, 0 }, /* spit */ +// {0, 0 }, /* spit */ // {2, 0 }, /* brass knuckles */ // {6, 0 }, /* underslung g.l. */ // 50 // @@ -91,7 +91,7 @@ UINT8 StoreInventory[MAXITEMS][BOBBY_RAY_LISTS]; //= // {2, 1 }, /* dart gun */ // {0, 0 }, /* bloody throwing knife */ // {0, 0 }, /* flamethrower */ -// {3, 0 }, /* Crowbar */ +// {3, 0 }, /* Crowbar */ // {1, 0 }, /* Auto Rocket Rifle */ // {2, 1 }, /* barrett - nothing */ // {2, 1 }, /* val silent - nothing */ @@ -102,31 +102,31 @@ UINT8 StoreInventory[MAXITEMS][BOBBY_RAY_LISTS]; //= ////---AMMO--- // {50, 0 }, /* CLIP9_15 */ // {40, 0 }, /* CLIP9_30 */ -// {8, 0 }, /* CLIP9_15_AP */ -// {4, 0 }, /* CLIP9_30_AP */ -// {7, 0 }, /* CLIP9_15_HP */ -// {4, 0 }, /* CLIP9_30_HP */ +// {8, 0 }, /* CLIP9_15_AP */ +// {4, 0 }, /* CLIP9_30_AP */ +// {7, 0 }, /* CLIP9_15_HP */ +// {4, 0 }, /* CLIP9_30_HP */ // {50, 0 }, /* CLIP38_6 */ // {8, 0 }, /* CLIP38_6_AP */ // {6, 0 }, /* CLIP38_6_HP */ // {40, 0 }, /* CLIP45_7 */ // 80 // // {25, 0 }, /* CLIP45_30 */ -// {6, 0 }, /* CLIP45_7_AP */ -// {8, 0 }, /* CLIP45_30_AP */ -// {6, 0 }, /* CLIP45_7_HP */ -// {5, 0 }, /* CLIP45_30_HP */ -// {40, 0 }, /* CLIP357_6 */ -// {20, 0 }, /* CLIP357_9 */ -// {6, 0 }, /* CLIP357_6_AP */ -// {5, 0 }, /* CLIP357_9_AP */ +// {6, 0 }, /* CLIP45_7_AP */ +// {8, 0 }, /* CLIP45_30_AP */ +// {6, 0 }, /* CLIP45_7_HP */ +// {5, 0 }, /* CLIP45_30_HP */ +// {40, 0 }, /* CLIP357_6 */ +// {20, 0 }, /* CLIP357_9 */ +// {6, 0 }, /* CLIP357_6_AP */ +// {5, 0 }, /* CLIP357_9_AP */ // {4, 0 }, /* CLIP357_6_HP */ //90 // -// {4, 0 }, /* CLIP357_9_HP */ -// {25, 0 }, /* CLIP545_30_AP */ -// {5, 0 }, /* CLIP545_30_HP */ -// {15, 0 }, /* CLIP556_30_AP */ -// {5, 0 }, /* CLIP556_30_HP */ +// {4, 0 }, /* CLIP357_9_HP */ +// {25, 0 }, /* CLIP545_30_AP */ +// {5, 0 }, /* CLIP545_30_HP */ +// {15, 0 }, /* CLIP556_30_AP */ +// {5, 0 }, /* CLIP556_30_HP */ // {15, 0 }, /* CLIP762W_10_AP */ // {12, 0 }, /* CLIP762W_30_AP */ // {4, 0 }, /* CLIP762W_10_HP */ @@ -134,54 +134,54 @@ UINT8 StoreInventory[MAXITEMS][BOBBY_RAY_LISTS]; //= // {10, 0 }, /* CLIP762N_5_AP */ //100 // // {10, 0 }, /* CLIP762N_20_AP */ -// {5, 0 }, /* CLIP762N_5_HP */ -// {5, 0 }, /* CLIP762N_20_HP */ -// {10, 0 }, /* CLIP47_50_SAP */ -// {10, 0 }, /* CLIP57_50_AP */ -// {5, 0 }, /* CLIP57_50_HP */ -// {20, 0 }, /* CLIP12G_7 */ +// {5, 0 }, /* CLIP762N_5_HP */ +// {5, 0 }, /* CLIP762N_20_HP */ +// {10, 0 }, /* CLIP47_50_SAP */ +// {10, 0 }, /* CLIP57_50_AP */ +// {5, 0 }, /* CLIP57_50_HP */ +// {20, 0 }, /* CLIP12G_7 */ // {40, 0 }, /* CLIP12G_7_BUCKSHOT */ -// {10, 0 }, /* CLIPCAWS_10_SAP */ +// {10, 0 }, /* CLIPCAWS_10_SAP */ // {10, 0 }, /* CLIPCAWS_10_FLECH */ //110 // // {5, 0 }, /* CLIPROCKET_AP */ -// {5, 0 }, /* CLIPROCKET_HE */ -// {5, 0 }, /* CLIPROCKET_HEAT */ +// {5, 0 }, /* CLIPROCKET_HE */ +// {5, 0 }, /* CLIPROCKET_HEAT */ // {20, 0 }, /* sleep dart */ // {0, 0 }, /* Clip Flame */ -// {6, 0 }, /* CLIP50_11 */ +// {6, 0 }, /* CLIP50_11 */ // {5, 0 }, /* CLIP9H_20 */ //120 -// {8, 0 }, /* CLIP9_50 */ -// {4, 0 }, /* CLIP9_50_AP */ -// {4, 0 }, /* CLIP9_50_HP */ +// {8, 0 }, /* CLIP9_50 */ +// {4, 0 }, /* CLIP9_50_AP */ +// {4, 0 }, /* CLIP9_50_HP */ // -// {2, 0 }, /* DRUM545_75_AP */ -// {1, 0 }, /* DRUM545_75_HP */ -// {2, 0 }, /* BELT556_200_AP */ -// {1, 0 }, /* BELT556_200_HP */ -// {2, 0 }, /* BELT762N_100_AP */ -// {1, 0 }, /* BELT762N_100_HP */ -// {10, 0 }, /* CLIP57_20_AP */ -// {5, 0 }, /* CLIP57_20_HP */ -// {0, 0 }, /* nothing */ +// {2, 0 }, /* DRUM545_75_AP */ +// {1, 0 }, /* DRUM545_75_HP */ +// {2, 0 }, /* BELT556_200_AP */ +// {1, 0 }, /* BELT556_200_HP */ +// {2, 0 }, /* BELT762N_100_AP */ +// {1, 0 }, /* BELT762N_100_HP */ +// {10, 0 }, /* CLIP57_20_AP */ +// {5, 0 }, /* CLIP57_20_HP */ +// {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ //130 // ////---EXPLOSIVES--- // {7, 0 }, /* stun grenade */ -// {7, 0 }, /* tear gas grenade */ +// {7, 0 }, /* tear gas grenade */ // {5, 0 }, /* mustard gas grenade*/ -// {7, 0 }, /* mini hand grenade */ -// {6, 0 }, /* reg hand grenade */ -// {0, 0 }, /* RDX */ +// {7, 0 }, /* mini hand grenade */ +// {6, 0 }, /* reg hand grenade */ +// {0, 0 }, /* RDX */ // {6, 0 }, /* TNT (="explosives")*/ -// {0, 0 }, /* HMX (=RDX+TNT) */ -// {0, 0 }, /* C1 (=RDX+min oil) */ -// {6, 0 }, /* mortar shell */ //140 +// {0, 0 }, /* HMX (=RDX+TNT) */ +// {0, 0 }, /* C1 (=RDX+min oil) */ +// {6, 0 }, /* mortar shell */ //140 // -// {0, 0 }, /* mine */ -// {2, 0 }, /* C4 ("plastique") */ -// {0, 0 }, /* trip flare */ -// {0, 0 }, /* trip klaxon */ +// {0, 0 }, /* mine */ +// {2, 0 }, /* C4 ("plastique") */ +// {0, 0 }, /* trip flare */ +// {0, 0 }, /* trip klaxon */ // {4, 0 }, /* shaped charge */ // {4, 0 }, /* break light */ // {5, 0 }, /* 40mm HE grenade */ @@ -201,13 +201,13 @@ UINT8 StoreInventory[MAXITEMS][BOBBY_RAY_LISTS]; //= // {0, 0 }, /* nothing */ //160 // ////---ARMOUR--- -// {2, 1 }, /* Flak jacket */ +// {2, 1 }, /* Flak jacket */ // {0, 0 }, /* Flak jacket w X */ // {0, 0 }, /* Flak jacket w Y */ -// {1, 1 }, /* Kevlar vest */ +// {1, 1 }, /* Kevlar vest */ // {0, 0 }, /* Kevlar vest w X */ // {0, 0 }, /* Kevlar vest w Y */ -// {1, 1 }, /* Spectra vest */ +// {1, 1 }, /* Spectra vest */ // {0, 0 }, /* Spectra vest w X*/ // {0, 0 }, /* Spectra vest w Y*/ // {1, 1 }, /* Kevlar leggings */ //170 @@ -217,15 +217,15 @@ UINT8 StoreInventory[MAXITEMS][BOBBY_RAY_LISTS]; //= // {1, 1 }, /* Spectra leggings*/ // {0, 0 }, /* Spectra legs w X*/ // {0, 0 }, /* Spectra legs w Y*/ -// {3, 1 }, /* Steel helmet */ -// {1, 1 }, /* Kevlar helmet */ +// {3, 1 }, /* Steel helmet */ +// {1, 1 }, /* Kevlar helmet */ // {0, 0 }, /* Kevlar helm w X */ // {0, 0 }, /* Kevlar helm w Y */ -// {1, 1 }, /* Spectra helmet */ //180 +// {1, 1 }, /* Spectra helmet */ //180 // // {0, 0 }, /* Spectra helm w X*/ // {0, 0 }, /* Spectra helm w Y*/ -// {0, 0 }, /* Ceramic plates */ +// {0, 0 }, /* Ceramic plates */ // {0, 0 }, /* hide */ // {0, 0 }, /* hide */ // {0, 0 }, /* hide */ @@ -247,119 +247,119 @@ UINT8 StoreInventory[MAXITEMS][BOBBY_RAY_LISTS]; //= // ////---MISC--- // {8, 0 }, /* First aid kit */ -// {6, 0 }, /* Medical Kit */ -// {4, 1 }, /* Tool Kit */ -// {3, 1 }, /* Locksmith kit */ -// {4, 0 }, /* Camouflage kit*/ -// {0, 0 }, /* nothing */ // Boobytrap kit - unused -// {6, 1 }, /* Silencer */ -// {6, 1 }, /* Sniper scope */ -// {6, 1 }, /* Bipod */ -// {6, 1 }, /* Extended ear */ // 210 +// {6, 0 }, /* Medical Kit */ +// {4, 1 }, /* Tool Kit */ +// {3, 1 }, /* Locksmith kit */ +// {4, 0 }, /* Camouflage kit*/ +// {0, 0 }, /* nothing */ // Boobytrap kit - unused +// {6, 1 }, /* Silencer */ +// {6, 1 }, /* Sniper scope */ +// {6, 1 }, /* Bipod */ +// {6, 1 }, /* Extended ear */ // 210 // // {6, 1 }, /* Night goggles */ -// {8, 0 }, /* Sun goggles */ -// {6, 1 }, /* Gas mask */ -// {10, 0 }, /* Canteen */ -// {2, 0 }, /* Metal detector*/ -// {6, 0 }, /* Compound 18 */ -// {0, 0 }, /* Jar w/Queen Blood */ +// {8, 0 }, /* Sun goggles */ +// {6, 1 }, /* Gas mask */ +// {10, 0 }, /* Canteen */ +// {2, 0 }, /* Metal detector*/ +// {6, 0 }, /* Compound 18 */ +// {0, 0 }, /* Jar w/Queen Blood */ // {0, 0 }, /* Jar w/Elixir */ -// {0, 0 }, /* Money */ -// {0, 0 }, /* Glass jar */ //220 +// {0, 0 }, /* Money */ +// {0, 0 }, /* Glass jar */ //220 // // {0, 0 }, /* Jar w/Creature Blood */ // {0, 0 }, /* Adrenaline Booster */ -// {6, 0 }, /* Detonator */ -// {6, 0 }, /* Rem Detonator */ -// {0, 0 }, /* VideoTape */ -// {0, 0 }, /* Deed */ -// {0, 0 }, /* Letter */ -// {0, 0 }, /* Terrorist Info */ -// {0, 0 }, /* Chalice */ -// {0, 0 }, /* Mission4 */ //230 +// {6, 0 }, /* Detonator */ +// {6, 0 }, /* Rem Detonator */ +// {0, 0 }, /* VideoTape */ +// {0, 0 }, /* Deed */ +// {0, 0 }, /* Letter */ +// {0, 0 }, /* Terrorist Info */ +// {0, 0 }, /* Chalice */ +// {0, 0 }, /* Mission4 */ //230 // -// {0, 0 }, /* Mission5 */ -// {0, 0 }, /* Mission6 */ -// {0, 0 }, /* Switch */ -// {0, 0 }, /* Action Item */ -// {0, 0 }, /* Syringe2 */ -// {0, 0 }, /* Syringe3 */ -// {0, 0 }, /* Syringe4 */ -// {0, 0 }, /* Syringe5 */ -// {0, 0 }, /* Jar w/Human blood */ +// {0, 0 }, /* Mission5 */ +// {0, 0 }, /* Mission6 */ +// {0, 0 }, /* Switch */ +// {0, 0 }, /* Action Item */ +// {0, 0 }, /* Syringe2 */ +// {0, 0 }, /* Syringe3 */ +// {0, 0 }, /* Syringe4 */ +// {0, 0 }, /* Syringe5 */ +// {0, 0 }, /* Jar w/Human blood */ // {0, 0 }, /* Ownership item */ //240 // -// {6, 1 }, /* Laser scope */ +// {6, 1 }, /* Laser scope */ // {6, 0 }, /* Remote trigger*/ -// {3, 0 }, /* Wirecutters */ //243 -// {3, 0 }, /* Duckbill */ -// {0, 0 }, /* Alcohol */ +// {3, 0 }, /* Wirecutters */ //243 +// {3, 0 }, /* Duckbill */ +// {0, 0 }, /* Alcohol */ // {1, 1 }, /* UV Goggles */ // {0, 0 }, /* Discarded LAW */ -// {0, 0 }, /* head - generic */ -// {0, 0 }, /* head - Imposter*/ +// {0, 0 }, /* head - generic */ +// {0, 0 }, /* head - Imposter*/ // {0, 0 }, /* head - T-Rex */ // 250 // -// {0, 0 }, /* head - Slay */ -// {0, 0 }, /* head - Druggist */ -// {0, 0 }, /* head - Matron */ -// {0, 0 }, /* head - Tiffany */ -// {0, 0 }, /* wine */ -// {0, 0 }, /* beer */ -// {0, 0 }, /* pornos */ -// {0, 0 }, /* video camera */ -// {0, 0 }, /* robot remote control */ +// {0, 0 }, /* head - Slay */ +// {0, 0 }, /* head - Druggist */ +// {0, 0 }, /* head - Matron */ +// {0, 0 }, /* head - Tiffany */ +// {0, 0 }, /* wine */ +// {0, 0 }, /* beer */ +// {0, 0 }, /* pornos */ +// {0, 0 }, /* video camera */ +// {0, 0 }, /* robot remote control */ // {0, 0 }, /* creature claws */ // 260 // -// {0, 0 }, /* creature flesh */ -// {0, 0 }, /* creature organ */ -// {0, 0 }, /* remote trigger */ -// {0, 0 }, /* gold watch */ -// {0, 0 }, /* golf clubs */ -// {0, 0 }, /* walkman */ -// {0, 0 }, /* portable TV */ -// {0, 0 }, /* Money for player's account */ -// {0, 0 }, /* cigars */ +// {0, 0 }, /* creature flesh */ +// {0, 0 }, /* creature organ */ +// {0, 0 }, /* remote trigger */ +// {0, 0 }, /* gold watch */ +// {0, 0 }, /* golf clubs */ +// {0, 0 }, /* walkman */ +// {0, 0 }, /* portable TV */ +// {0, 0 }, /* Money for player's account */ +// {0, 0 }, /* cigars */ // {0, 0 }, /* nothing */ // 270 // // {0, 0 }, /* key */ // 271 -// {0, 0 }, /* key */ -// {0, 0 }, /* key */ -// {0, 0 }, /* key */ -// {0, 0 }, /* key */ -// {0, 0 }, /* key */ -// {0, 0 }, /* key */ -// {0, 0 }, /* key */ -// {0, 0 }, /* key */ -// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ // // {6, 1 }, /* flash suppressor */ // 281 -// {2, 1 }, /* rpg 7 */ -// {4, 0 }, /* RPG_HE_ROCKET */ -// {4, 0 }, /* RPG_AP_ROCKET */ -// {4, 0 }, /* RPG_FRAG_ROCKET */ -// {6, 1 }, /* reflex_scoped */ -// {6, 1 }, /* reflex_unscoped */ -// {0, 0 }, /* key */ -// {0, 0 }, /* key */ -// {0, 0 }, /* key */ +// {2, 1 }, /* rpg 7 */ +// {4, 0 }, /* RPG_HE_ROCKET */ +// {4, 0 }, /* RPG_AP_ROCKET */ +// {4, 0 }, /* RPG_FRAG_ROCKET */ +// {6, 1 }, /* reflex_scoped */ +// {6, 1 }, /* reflex_unscoped */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ // // {0, 0 }, /* key */ // 291 -// {0, 0 }, /* key */ -// {0, 0 }, /* key */ -// {0, 0 }, /* key */ -// {0, 0 }, /* key */ -// {0, 0 }, /* key */ -// {0, 0 }, /* key */ -// {0, 0 }, /* key */ -// {0, 0 }, /* key */ -// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ // // {0, 0 }, /* key */ // 301 -// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ -// {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ @@ -368,7 +368,7 @@ UINT8 StoreInventory[MAXITEMS][BOBBY_RAY_LISTS]; //= // {0, 0 }, /* nothing */ // // {0, 0 }, /* nothing */ // 311 -// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ @@ -379,13 +379,13 @@ UINT8 StoreInventory[MAXITEMS][BOBBY_RAY_LISTS]; //= // {0, 0 }, /* nothing */ // // {0, 0 }, /* nothing */ // 321 -// {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ -// {3, 1 }, /* m900 */ +// {0, 0 }, /* nothing */ +// {3, 1 }, /* m900 */ // {6, 1 }, /* m950 */ // {3, 1 }, /* m960a - 330 */ // @@ -401,7 +401,7 @@ UINT8 StoreInventory[MAXITEMS][BOBBY_RAY_LISTS]; //= // {4, 1 }, /* g36c */ // // {2, 1 }, /* MSG */ // 341 -// {3, 1 }, /* Bennelli */ +// {3, 1 }, /* Bennelli */ // {3, 1 }, /* AK103 */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ @@ -417,60 +417,60 @@ UINT8 StoreInventory[MAXITEMS][BOBBY_RAY_LISTS]; //= //MADD MARKER INT16 WeaponROF[ MAXITEMS ];//= //{ -// 0, /* Nothing */ +// 0, /* Nothing */ // -// 40, /* Glock 17 */ -// 1300, /* Glock 18 */ -// 45, /* Beretta 92F */ -// 1100, /* Beretta 93R */ -// 25, /* .38 S&W Special */ -// 23, /* .357 Barracuda */ -// 27, /* .357 DesertEagle*/ -// 35, /* .45 M1911 */ -// 900, /* H&K MP5K */ -// 1090, /* .45 MAC-10 */ // 10 +// 40, /* Glock 17 */ +// 1300, /* Glock 18 */ +// 45, /* Beretta 92F */ +// 1100, /* Beretta 93R */ +// 25, /* .38 S&W Special */ +// 23, /* .357 Barracuda */ +// 27, /* .357 DesertEagle*/ +// 35, /* .45 M1911 */ +// 900, /* H&K MP5K */ +// 1090, /* .45 MAC-10 */ // 10 // -// 700, /* Thompson M1A1 */ -// 900, /* Colt Commando */ -// 800, /* H&K MP53 */ -// 900, /* AKSU-74 */ -// 900, /* 5.7mm FN P90 */ -// 780, /* Type-85 */ -// 40, /* SKS */ -// 20, /* Dragunov */ -// 20, /* M24 */ -// 650, /* Steyr AUG */ //20 +// 700, /* Thompson M1A1 */ +// 900, /* Colt Commando */ +// 800, /* H&K MP53 */ +// 900, /* AKSU-74 */ +// 900, /* 5.7mm FN P90 */ +// 780, /* Type-85 */ +// 40, /* SKS */ +// 20, /* Dragunov */ +// 20, /* M24 */ +// 650, /* Steyr AUG */ //20 // -// 850, /* H&K G41 */ -// 750, /* Ruger Mini-14 */ -// 600, /* C-7 */ -// 900, /* FA-MAS */ -// 650, /* AK-74 */ -// 600, /* AKM */ -// 750, /* M-14 */ -// 650, /* FN-FAL */ -// 500, /* H&K G3A3 */ -// 600, /* H&K G11 */ // 30 +// 850, /* H&K G41 */ +// 750, /* Ruger Mini-14 */ +// 600, /* C-7 */ +// 900, /* FA-MAS */ +// 650, /* AK-74 */ +// 600, /* AKM */ +// 750, /* M-14 */ +// 650, /* FN-FAL */ +// 500, /* H&K G3A3 */ +// 600, /* H&K G11 */ // 30 // -// 21, /* Remington M870 */ -// 30, /* SPAS-15 */ -// -1, /* CAWS */ -// 750, /* FN Minimi */ -// 800, /* RPK-74 */ -// 800, /* H&K 21E */ +// 21, /* Remington M870 */ +// 30, /* SPAS-15 */ +// -1, /* CAWS */ +// 750, /* FN Minimi */ +// 800, /* RPK-74 */ +// 800, /* H&K 21E */ // 0, /* combat knife */ // 0, /* throwing knife */ // 0, /* rock */ // 1, /* grenade launcher */ // 40 // // 1, /* mortar */ -// 0, /* another rock */ -// 0, /* claws */ +// 0, /* another rock */ +// 0, /* claws */ // 0, /* claws */ // 0, /* claws */ // 0, /* claws */ // 0, /* tentacles */ -// 0, /* spit */ +// 0, /* spit */ // 0, /* brass knuckles */ // 1, /* underslung g.l. */ // 50 // @@ -754,8 +754,8 @@ INT16 WeaponROF[ MAXITEMS ];//= // 0, // nothing // 0, // nothing // 0, // nothing -// 1300, /* m900 */ -// 600, /* m950 */ +// 1300, /* m900 */ +// 600, /* m950 */ // 600, /* m960a - 330 */ // 800, /* micro uzi */ // 600, /* enfield */ @@ -795,7 +795,7 @@ void SetupStoreInventory( STORE_INVENTORY *pInventoryArray, BOOLEAN fUsed ) UINT16 usItemIndex; UINT8 ubNumBought; - //loop through all items BR can stock to init a starting quantity on hand + //loop through all items BR can stock to init a starting quantity on hand for(i = 0; i < LaptopSaveInfo.usInventoryListLength[fUsed]; i++) { usItemIndex = pInventoryArray[ i ].usItemIndex; @@ -840,9 +840,9 @@ BOOLEAN DoesGunOfSameClassExistInInventory( UINT8 ubItemIndex, UINT8 ubDealerID //go through all of the guns - for(i=0; iuiFlags &= ~(BUTTON_CLICKED_ON); + ButtonList[ Buttons[ cnt ] ]->uiFlags &= ~(BUTTON_CLICKED_ON); } } @@ -665,7 +665,7 @@ void DisableAimButton() for(i=0; iuiFlags |= BUTTON_CLICKED_ON; + ButtonList[ guiBottomButtons[i] ]->uiFlags |= BUTTON_CLICKED_ON; } } @@ -741,7 +741,7 @@ void HandleAdAndWarningArea( BOOLEAN fInit, BOOLEAN fRedraw ) switch( gubCurrentAdvertisment ) { case AIM_AD_WARNING_BOX: - MSYS_DisableRegion(&gSelectedBannerRegion); + MSYS_DisableRegion(&gSelectedBannerRegion); ubPreviousAdvertisment = DrawWarningBox( fInit, fRedraw ); break; @@ -751,22 +751,22 @@ void HandleAdAndWarningArea( BOOLEAN fInit, BOOLEAN fRedraw ) case AIM_AD_FOR_ADS: // disable the region because only certain banners will be 'clickable' - MSYS_DisableRegion(&gSelectedBannerRegion); + MSYS_DisableRegion(&gSelectedBannerRegion); ubPreviousAdvertisment = DisplayAd( fInit, fRedraw, AIM_AD_FOR_ADS_DELAY, AIM_AD_FOR_ADS__NUM_SUBIMAGES, guiAdForAdsImages ); break; case AIM_AD_INSURANCE_AD: - MSYS_EnableRegion(&gSelectedBannerRegion); + MSYS_EnableRegion(&gSelectedBannerRegion); ubPreviousAdvertisment = DisplayAd( fInit, fRedraw, AIM_AD_INSURANCE_AD_DELAY, AIM_AD_INSURANCE_AD__NUM_SUBIMAGES, guiInsuranceAdImages ); break; case AIM_AD_FUNERAL_ADS: - MSYS_EnableRegion(&gSelectedBannerRegion); + MSYS_EnableRegion(&gSelectedBannerRegion); ubPreviousAdvertisment = DisplayAd( fInit, fRedraw, AIM_AD_FUNERAL_AD_DELAY, AIM_AD_FUNERAL_AD__NUM_SUBIMAGES, guiFuneralAdImages ); break; case AIM_AD_BOBBY_RAY_AD: - MSYS_EnableRegion(&gSelectedBannerRegion); + MSYS_EnableRegion(&gSelectedBannerRegion); // ubPreviousAdvertisment = DisplayAd( fInit, fRedraw, AIM_AD_BOBBYR_AD_DELAY, AIM_AD_BOBBYR_AD__NUM_SUBIMAGES, guiBobbyRAdImages ); ubPreviousAdvertisment = DisplayBobbyRAd( fInit, fRedraw ); break; @@ -787,7 +787,7 @@ BOOLEAN DisplayFlowerAd( BOOLEAN fInit, BOOLEAN fRedraw ) uiLastTime = 0; ubSubImage = 0; ubCount = 0; - MSYS_EnableRegion(&gSelectedBannerRegion); + MSYS_EnableRegion(&gSelectedBannerRegion); } if( ((uiCurTime - uiLastTime) > AIM_FLOWER_AD_DELAY) || fRedraw) @@ -801,14 +801,14 @@ BOOLEAN DisplayFlowerAd( BOOLEAN fInit, BOOLEAN fRedraw ) //Blit the blue sky frame with text on top GetVideoObject(&hAdHandle, guiFlowerAdvertisement); BltVideoObject(FRAME_BUFFER, hAdHandle, 0,WARNING_X, WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); - + // redraw new mail warning, and create new mail button, if nessacary fReDrawNewMailFlag = TRUE; - - //Display Aim Warning Text + + //Display Aim Warning Text DisplayWrappedString(AIM_WARNING_TEXT_X, AIM_WARNING_TEXT_Y, AIM_WARNING_TEXT_WIDTH, 2, FONT14ARIAL, FONT_GREEN, AimScreenText[AIM_INFO_6], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); - //Display Aim Warning Text + //Display Aim Warning Text SetFontShadow( FONT_MCOLOR_WHITE ); DisplayWrappedString(AIM_WARNING_TEXT_X, AIM_FLOWER_LINK_TEXT_Y, AIM_WARNING_TEXT_WIDTH, 2, FONT12ARIAL, 2, AimScreenText[AIM_INFO_7], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); SetFontShadow( DEFAULT_SHADOW ); @@ -831,15 +831,15 @@ BOOLEAN DisplayFlowerAd( BOOLEAN fInit, BOOLEAN fRedraw ) { GetVideoObject(&hAdHandle, guiFlowerAdvertisement); BltVideoObject(FRAME_BUFFER, hAdHandle, ubSubImage,WARNING_X, WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); - + // redraw new mail warning, and create new mail button, if nessacary fReDrawNewMailFlag = TRUE; - + ubSubImage++; } uiLastTime = GetJA2Clock(); - InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); + InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); } return( AIM_AD_NOT_DONE ); } @@ -856,7 +856,7 @@ BOOLEAN DrawWarningBox( BOOLEAN fInit, BOOLEAN fRedraw ) { CHAR16 sText[400]; UINT32 uiStartLoc=0; - UINT16 usLocY = AIM_WARNING_TEXT_Y + (GetFontHeight(AIM_WARNING_FONT) + 2) * 2; + //UINT16 usLocY = AIM_WARNING_TEXT_Y + (GetFontHeight(AIM_WARNING_FONT) + 2) * 2; HVOBJECT hWarningHandle; //Warning @@ -867,7 +867,7 @@ BOOLEAN DrawWarningBox( BOOLEAN fInit, BOOLEAN fRedraw ) uiStartLoc = AIM_HISTORY_LINE_SIZE * AIM_WARNING_1; LoadEncryptedDataFromFile(AIMHISTORYFILE, sText, uiStartLoc, AIM_HISTORY_LINE_SIZE); - //Display Aim Warning Text + //Display Aim Warning Text DisplayWrappedString(AIM_WARNING_TEXT_X, AIM_WARNING_TEXT_Y, AIM_WARNING_TEXT_WIDTH, 2, AIM_WARNING_FONT, FONT_RED, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); @@ -888,7 +888,7 @@ BOOLEAN DrawWarningBox( BOOLEAN fInit, BOOLEAN fRedraw ) } void SelectBannerRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -907,7 +907,7 @@ void SelectBannerRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } @@ -939,10 +939,10 @@ BOOLEAN DisplayAd( BOOLEAN fInit, BOOLEAN fRedraw, UINT16 usDelay, UINT16 usNumb //Blit the ad GetVideoObject(&hAdHandle, uiAdImageIdentifier); BltVideoObject(FRAME_BUFFER, hAdHandle, 0,WARNING_X, WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); - + // redraw new mail warning, and create new mail button, if nessacary fReDrawNewMailFlag = TRUE; - + InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); } @@ -966,10 +966,10 @@ BOOLEAN DisplayAd( BOOLEAN fInit, BOOLEAN fRedraw, UINT16 usDelay, UINT16 usNumb //Blit the ad GetVideoObject(&hAdHandle, uiAdImageIdentifier); BltVideoObject(FRAME_BUFFER, hAdHandle, ubSubImage,WARNING_X, WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); - + // redraw new mail warning, and create new mail button, if nessacary fReDrawNewMailFlag = TRUE; - + InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); } @@ -986,10 +986,10 @@ BOOLEAN DisplayAd( BOOLEAN fInit, BOOLEAN fRedraw, UINT16 usDelay, UINT16 usNumb { GetVideoObject(&hAdHandle, uiAdImageIdentifier); BltVideoObject(FRAME_BUFFER, hAdHandle, ubSubImage,WARNING_X, WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); - + // redraw new mail warning, and create new mail button, if nessacary fReDrawNewMailFlag = TRUE; - + ubSubImage++; } @@ -997,7 +997,7 @@ BOOLEAN DisplayAd( BOOLEAN fInit, BOOLEAN fRedraw, UINT16 usDelay, UINT16 usNumb HandleTextOnAimAdd( ubSubImage ); uiLastTime = GetJA2Clock(); - InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); + InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); } return( ubRetVal ); } @@ -1026,7 +1026,7 @@ void HandleTextOnAimAdd( UINT8 ubCurSubImage ) //if the subimage is the first couple if( ubCurSubImage <= AIM_AD_BOBBYR_AD_NUM_DUCK_SUBIMAGES ) { - //Display Aim Warning Text + //Display Aim Warning Text SetFontShadow( 2 ); DisplayWrappedString(AIM_BOBBYR1_LINK_TEXT_X, AIM_BOBBYR1_LINK_TEXT_Y, AIM_WARNING_TEXT_WIDTH, 2, BOBBYR_UNDER_CONSTRUCTION_AD_FONT, BOBBYR_UNDER_CONSTRUCTION_AD_COLOR, AimScreenText[AIM_BOBBYR_ADD1], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED | INVALIDATE_TEXT ); SetFontShadow( DEFAULT_SHADOW ); @@ -1035,7 +1035,7 @@ void HandleTextOnAimAdd( UINT8 ubCurSubImage ) else if( ubCurSubImage >= AIM_AD_BOBBYR_AD__NUM_SUBIMAGES-5 ) { - //Display Aim Warning Text + //Display Aim Warning Text SetFontShadow( 2 ); DisplayWrappedString(AIM_BOBBYR2_LINK_TEXT_X, AIM_BOBBYR2_LINK_TEXT_Y, AIM_WARNING_TEXT_WIDTH, 2, BOBBYR_UNDER_CONSTRUCTION_AD_FONT, BOBBYR_UNDER_CONSTRUCTION_AD_COLOR, AimScreenText[AIM_BOBBYR_ADD2], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED | INVALIDATE_TEXT ) ; SetFontShadow( DEFAULT_SHADOW ); @@ -1043,7 +1043,7 @@ void HandleTextOnAimAdd( UINT8 ubCurSubImage ) /* else { - //Display Aim Warning Text + //Display Aim Warning Text SetFontShadow( 2 ); // DisplayWrappedString( AIM_BOBBYR3_LINK_TEXT_X, AIM_BOBBYR3_LINK_TEXT_Y, AIM_WARNING_TEXT_WIDTH, 2, BOBBYR_UNDER_CONSTRUCTION_AD_FONT, FONT_MCOLOR_WHITE, AimScreenText[AIM_BOBBYR_ADD3], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED | INVALIDATE_TEXT ); SetFontShadow( DEFAULT_SHADOW ); @@ -1121,10 +1121,10 @@ BOOLEAN DisplayBobbyRAd( BOOLEAN fInit, BOOLEAN fRedraw ) ubSubImage = AIM_AD_BOBBYR_AD__NUM_SUBIMAGES - 1; } - + // redraw new mail warning, and create new mail button, if nessacary fReDrawNewMailFlag = TRUE; - + InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); } @@ -1133,7 +1133,7 @@ BOOLEAN DisplayBobbyRAd( BOOLEAN fInit, BOOLEAN fRedraw ) uiLastTime = GetJA2Clock(); - InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); + InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); } /* @@ -1164,10 +1164,10 @@ BOOLEAN DisplayBobbyRAd( BOOLEAN fInit, BOOLEAN fRedraw ) { //Blit the ad BltVideoObject(FRAME_BUFFER, hAdHandle, ubSubImage,WARNING_X, WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); - + // redraw new mail warning, and create new mail button, if nessacary fReDrawNewMailFlag = TRUE; - + InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); } @@ -1184,10 +1184,10 @@ BOOLEAN DisplayBobbyRAd( BOOLEAN fInit, BOOLEAN fRedraw ) //Blit the ad GetVideoObject(&hAdHandle, guiBobbyRAdImages); BltVideoObject(FRAME_BUFFER, hAdHandle, ubSubImage,WARNING_X, WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); - + // redraw new mail warning, and create new mail button, if nessacary fReDrawNewMailFlag = TRUE; - + InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); } @@ -1204,10 +1204,10 @@ BOOLEAN DisplayBobbyRAd( BOOLEAN fInit, BOOLEAN fRedraw ) { GetVideoObject(&hAdHandle, guiBobbyRAdImages); BltVideoObject(FRAME_BUFFER, hAdHandle, ubSubImage,WARNING_X, WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); - + // redraw new mail warning, and create new mail button, if nessacary fReDrawNewMailFlag = TRUE; - + ubSubImage++; } */ @@ -1220,8 +1220,6 @@ UINT8 GetNextAimAd( UINT8 ubCurrentAd ) { UINT8 ubNextAd; UINT32 uiDay = GetWorldDay(); - BOOLEAN fSkip=FALSE; - if( ubCurrentAd == AIM_AD_WARNING_BOX ) { if( uiDay < AIM_AD_BOBBYR_AD_STARTS ) @@ -1257,6 +1255,7 @@ UINT8 GetNextAimAd( UINT8 ubCurrentAd ) - + + diff --git a/Laptop/email.cpp b/Laptop/email.cpp index 20e473c7..42fc1db2 100644 --- a/Laptop/email.cpp +++ b/Laptop/email.cpp @@ -23,9 +23,9 @@ #include "finances.h" #endif -//static EmailPtr pEmailList; -EmailPtr pEmailList; -static PagePtr pPageList; +//static EmailPtr pEmailList; +EmailPtr pEmailList; +static PagePtr pPageList; static INT32 iLastPage=-1; static INT32 iCurrentPage=0; INT32 iDeleteId=0; @@ -83,7 +83,7 @@ UINT32 guiEmailWarning; #define DATE_WIDTH 592-527 #define SUBJECT_X LAPTOP_SCREEN_UL_X+175 -#define SUBJECT_WIDTH 254 +#define SUBJECT_WIDTH 254 #define INDIC_X iScreenWidthOffset + 128 #define INDIC_WIDTH 155-123 #define INDIC_HEIGHT 145-128 @@ -107,7 +107,7 @@ UINT32 guiEmailWarning; #define MESSAGEX_X iScreenWidthOffset + 425 #define MESSAGEX_Y iScreenHeightOffset + 6 -#define EMAIL_WARNING_X iScreenWidthOffset + 210 +#define EMAIL_WARNING_X iScreenWidthOffset + 210 #define EMAIL_WARNING_Y iScreenHeightOffset + 140 #define EMAIL_WARNING_WIDTH 254 #define EMAIL_WARNING_HEIGHT 138 @@ -115,7 +115,7 @@ UINT32 guiEmailWarning; #define NEW_BTN_X EMAIL_WARNING_X +(338-245) #define NEW_BTN_Y EMAIL_WARNING_Y +(278-195) -#define EMAIL_TEXT_FONT FONT10ARIAL +#define EMAIL_TEXT_FONT FONT10ARIAL #define TRAVERSE_EMAIL_FONT FONT14ARIAL #define EMAIL_BOX_FONT FONT14ARIAL #define MESSAGE_FONT EMAIL_TEXT_FONT @@ -127,7 +127,7 @@ UINT32 guiEmailWarning; #define MAX_NUMBER_EMAIL_PAGES 100 #define PREVIOUS_PAGE 0 -#define NEXT_PAGE 1 +#define NEXT_PAGE 1 #define NEXT_PAGE_X LAPTOP_UL_X + 562 #define NEXT_PAGE_Y iScreenHeightOffset + 51 @@ -161,7 +161,7 @@ UINT32 guiEmailWarning; #define INDENT_X_WIDTH 544 - 481 // the position of the page number being displayed in the email program -#define PAGE_NUMBER_X iScreenWidthOffset + 516 +#define PAGE_NUMBER_X iScreenWidthOffset + 516 #define PAGE_NUMBER_Y iScreenHeightOffset + 58 // defines for location of message 'title'/'headers' @@ -203,7 +203,7 @@ BOOLEAN gfPageButtonsWereCreated = FALSE; // mouse regions MOUSE_REGION pEmailRegions[MAX_MESSAGES_PAGE]; -extern MOUSE_REGION pScreenMask; // symbol already defined in laptop.cpp (jonathanl) +extern MOUSE_REGION pScreenMask; // symbol already defined in laptop.cpp (jonathanl) MOUSE_REGION pDeleteScreenMask; // the email info struct to speed up email @@ -298,9 +298,9 @@ void CreateMailScreenButtons( void ); void DestroyMailScreenButtons( void ); void DrawLineDividers( void ); void FromCallback(GUI_BUTTON *btn, INT32 iReason ); -void SubjectCallback(GUI_BUTTON *btn, INT32 iReason ); -void DateCallback(GUI_BUTTON *btn, INT32 iReason ); -void ReadCallback(GUI_BUTTON *btn, INT32 iReason ); +void SubjectCallback(GUI_BUTTON *btn, INT32 iReason ); +void DateCallback(GUI_BUTTON *btn, INT32 iReason ); +void ReadCallback(GUI_BUTTON *btn, INT32 iReason ); void BtnPreviousEmailPageCallback(GUI_BUTTON *btn,INT32 reason); void BtnNextEmailPageCallback(GUI_BUTTON *btn,INT32 reason); void DisplayEmailList(); @@ -308,8 +308,8 @@ void ClearOutEmailMessageRecordsList( void ); void AddEmailRecordToList( STR16 pString ); void UpDateMessageRecordList( void ); void HandleAnySpecialEmailMessageEvents(INT32 iMessageId ); -BOOLEAN HandleMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr pMail ); -void HandleIMPCharProfileResultsMessage( void ); +BOOLEAN HandleMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr pMail ); +void HandleIMPCharProfileResultsMessage( void ); void HandleEmailViewerButtonStates( void ); void SetUpIconForButton( void ); void DeleteCurrentMessage( void ); @@ -329,18 +329,18 @@ BOOLEAN ReplaceBiffNameWithProperMercName( CHAR16 *pFinishedString, EmailPtr pMa void InitializeMouseRegions() { INT32 iCounter=0; - + // init mouseregions for(iCounter=0; iCounter iId >iId) - iId=pEmail->iId; - pEmail=pEmail->Next; + if(pEmail->iId >iId) + iId=pEmail->iId; + pEmail=pEmail->Next; } } // reset pEmail pEmail=pEmailList; - + // move to end of list if( pEmail ) { - while( pEmail -> Next) - pEmail = pEmail -> Next; - } + while( pEmail->Next) + pEmail = pEmail->Next; + } // add new element onto list - pTempEmail = (EmailPtr) MemAlloc(sizeof(Email)); - memset( pTempEmail, 0, sizeof(Email) ); + pTempEmail = (EmailPtr) MemAlloc(sizeof(Email)); + memset( pTempEmail, 0, sizeof(Email) ); // add in strings //while(pMessage !=NULL) //{ - //pTempEmail->pText[iCounter]=MemAlloc((wcslen(pMessage->pString)+2)*2); - //wcscpy(pTempEmail->pText[iCounter],pMessage->pString); - //pMessage=pMessage->Next; - //iCounter++; - //} - //pTempEmail->pText[iCounter]=NULL; + //pTempEmail->pText[iCounter]=MemAlloc((wcslen(pMessage->pString)+2)*2); + //wcscpy(pTempEmail->pText[iCounter],pMessage->pString); + //pMessage=pMessage->Next; + //iCounter++; + //} + //pTempEmail->pText[iCounter]=NULL; // copy subject pTempEmail->pSubject = (STR16) MemAlloc( 128 * sizeof(CHAR16) ); memset( pTempEmail->pSubject, 0, sizeof( CHAR16 ) * 128 ); wcscpy(pTempEmail->pSubject,pSubject); - + // copy offset and length of the actual message in email.edt pTempEmail->usOffset =(UINT16)iMessageOffset; pTempEmail->usLength =(UINT16)iMessageLength; // null out last byte of subject - pTempEmail->pSubject[wcslen(pSubject)+1]=0; - - pTempEmail->iCurrentIMPPosition = iCurrentIMPPosition; - + pTempEmail->pSubject[wcslen(pSubject)+1]=0; + + pTempEmail->iCurrentIMPPosition = iCurrentIMPPosition; + // set date and sender, Id if(pEmail) - pTempEmail->iId=iId+1; + pTempEmail->iId=iId+1; else pTempEmail->iId=0; - + // copy date and sender id's pTempEmail->iDate=iDate; - pTempEmail->ubSender=ubSender; - + pTempEmail->ubSender=ubSender; + // the special data pTempEmail->iFirstData = iFirstData; - pTempEmail->uiSecondData = uiSecondData; + pTempEmail->uiSecondData = uiSecondData; // place into list if(pEmail) { // list exists, place at end - pEmail->Next=pTempEmail; - pTempEmail->Prev=pEmail; + pEmail->Next=pTempEmail; + pTempEmail->Prev=pEmail; } else { @@ -833,15 +826,15 @@ void AddEmailMessage(INT32 iMessageOffset, INT32 iMessageLength,STR16 pSubject, pTempEmail->Next=NULL; // set flag that new mail has arrived - fNewMailFlag=TRUE; + fNewMailFlag=TRUE; // add this message to the pages of email - AddMessageToPages(pTempEmail->iId); + AddMessageToPages(pTempEmail->iId); - // reset read flag of this particular message - pTempEmail->fRead=fAlreadyRead; + // reset read flag of this particular message + pTempEmail->fRead=fAlreadyRead; - // set fact this message is new + // set fact this message is new pTempEmail->fNew=TRUE; return; } @@ -852,7 +845,6 @@ void RemoveEmailMessage(INT32 iId) // run through list and remove message, update everyone afterwards EmailPtr pEmail=pEmailList; EmailPtr pTempEmail=NULL; - INT32 iCounter=0; // error check @@ -861,44 +853,44 @@ void RemoveEmailMessage(INT32 iId) // look for message pEmail = GetEmailMessage( iId ); - //while((pEmail->iId !=iId)&&(pEmail -> Next)) + //while((pEmail->iId !=iId)&&(pEmail->Next)) // pEmail=pEmail->Next; // end of list, no mail found, leave if(!pEmail) return; - // found + // found - // set tempt o current + // set tempt object current pTempEmail=pEmail; - // check position of message in list - if((pEmail->Prev)&&(pTempEmail->Next)) + // check position of message in list + if((pEmail->Prev)&&(pTempEmail->Next)) { // in the middle of the list - pEmail=pEmail->Prev; - pTempEmail=pTempEmail->Next; - MemFree(pEmail->Next->pSubject); - //while(pEmail->Next->pText[iCounter]) - //{ - //MemFree(pEmail->Next->pText[iCounter]); - //iCounter++; - //} - MemFree(pEmail->Next); - pEmail->Next=pTempEmail; - pTempEmail->Prev=pEmail; + pEmail=pEmail->Prev; + pTempEmail=pTempEmail->Next; + MemFree(pEmail->Next->pSubject); + //while(pEmail->Next->pText[iCounter]) + //{ + //MemFree(pEmail->Next->pText[iCounter]); + //iCounter++; + //} + MemFree(pEmail->Next); + pEmail->Next=pTempEmail; + pTempEmail->Prev=pEmail; } else if(pEmail->Prev) { // end of the list pEmail=pEmail->Prev; - MemFree(pEmail->Next->pSubject); + MemFree(pEmail->Next->pSubject); //while(pEmail->Next->pText[iCounter]) //{ - //MemFree(pEmail->Next->pText[iCounter]); - //iCounter++; + //MemFree(pEmail->Next->pText[iCounter]); + //iCounter++; //} - MemFree(pEmail->Next); + MemFree(pEmail->Next); pEmail->Next=NULL; } else if(pTempEmail->Next) @@ -906,27 +898,27 @@ void RemoveEmailMessage(INT32 iId) // beginning of the list pEmail=pTempEmail; pTempEmail=pTempEmail->Next; - MemFree(pEmail->pSubject); - //while(pEmail->pText[iCounter]) + MemFree(pEmail->pSubject); + //while(pEmail->pText[iCounter]) //{ - //MemFree(pEmail->pText[iCounter]); + //MemFree(pEmail->pText[iCounter]); //iCounter++; //} - MemFree(pEmail); + MemFree(pEmail); pTempEmail->Prev=NULL; pEmailList=pTempEmail; } else { // all alone - MemFree(pEmail->pSubject); + MemFree(pEmail->pSubject); // while(pEmail->pText[iCounter]) //{ - //MemFree(pEmail->pText[iCounter]); - //iCounter++; + //MemFree(pEmail->pText[iCounter]); + //iCounter++; //} - MemFree(pEmail); - pEmailList=NULL; + MemFree(pEmail); + pEmailList=NULL; } } @@ -934,22 +926,22 @@ EmailPtr GetEmailMessage(INT32 iId) { EmailPtr pEmail=pEmailList; // return pointer to message with iId - + // invalid id if(iId==-1) return NULL; - + // invalid list if( pEmail == NULL ) { return NULL; } - // look for message + // look for message while( (pEmail->iId !=iId)&&(pEmail->Next) ) pEmail=pEmail->Next; - - if( ( pEmail ->iId != iId ) && ( pEmail->Next == NULL ) ) + + if( ( pEmail->iId != iId ) && ( pEmail->Next == NULL ) ) { pEmail = NULL; } @@ -968,21 +960,21 @@ void AddEmailPage() PagePtr pPage=pPageList; if(pPage) { - while(pPage->Next) - pPage=pPage->Next; + while(pPage->Next) + pPage=pPage->Next; } if(pPage) - { - + { + // there is a page, add current page after it pPage->Next = (pagemessages *) MemAlloc(sizeof(Page)); pPage->Next->Prev=pPage; - pPage=pPage->Next; + pPage=pPage->Next; pPage->Next=NULL; pPage->iPageId=pPage->Prev->iPageId+1; - memset(pPage->iIds, -1, sizeof(INT32) * MAX_MESSAGES_PAGE ); + memset(pPage->iIds, -1, sizeof(INT32) * MAX_MESSAGES_PAGE ); } else { @@ -993,8 +985,8 @@ void AddEmailPage() pPage->Prev=NULL; pPage->Next=NULL; pPage->iPageId=0; - memset(pPage->iIds, -1, sizeof(INT32) * MAX_MESSAGES_PAGE ); - pPageList=pPage; + memset(pPage->iIds, -1, sizeof(INT32) * MAX_MESSAGES_PAGE ); + pPageList=pPage; } iLastPage++; return; @@ -1004,34 +996,34 @@ void AddEmailPage() void RemoveEmailPage(INT32 iPageId) { - PagePtr pPage=pPageList; + PagePtr pPage=pPageList; PagePtr pTempPage=NULL; - + // run through list until page is matched, or out of pages while((pPage->iPageId !=iPageId)&&(pPage)) pPage=pPage->Next; - + // error check if(!pPage) return; - // found + // found pTempPage=pPage; - if((pPage->Prev)&&(pTempPage->Next)) + if((pPage->Prev)&&(pTempPage->Next)) { // in the middle of the list - pPage=pPage->Prev; - pTempPage=pTempPage->Next; - MemFree(pPage->Next); - pPage->Next=pTempPage; - pTempPage->Prev=pPage; + pPage=pPage->Prev; + pTempPage=pTempPage->Next; + MemFree(pPage->Next); + pPage->Next=pTempPage; + pTempPage->Prev=pPage; } else if(pPage->Prev) { // end of the list pPage=pPage->Prev; - MemFree(pPage->Next); + MemFree(pPage->Next); pPage->Next=NULL; } else if(pTempPage->Next) @@ -1039,18 +1031,18 @@ void RemoveEmailPage(INT32 iPageId) // beginning of the list pPage=pTempPage; pTempPage=pTempPage->Next; - MemFree(pPage); + MemFree(pPage); pTempPage->Prev=NULL; } else { // all alone - - MemFree(pPage); - pPageList=NULL; + + MemFree(pPage); + pPageList=NULL; } - if(iLastPage !=0) - iLastPage--; + if(iLastPage !=0) + iLastPage--; } void AddMessageToPages(INT32 iMessageId) @@ -1059,24 +1051,24 @@ void AddMessageToPages(INT32 iMessageId) PagePtr pPage=pPageList; INT32 iCounter=0; if(!pPage) - AddEmailPage(); + AddEmailPage(); pPage=pPageList; while((pPage->Next)&&(pPage->iIds[MAX_MESSAGES_PAGE-1]!=-1)) pPage=pPage->Next; // if list is full, add new page - while(iCounter iIds[iCounter]==-1) break; iCounter++; } if(iCounter==MAX_MESSAGES_PAGE) - { + { AddEmailPage(); AddMessageToPages(iMessageId); - return; + return; } - else + else { pPage->iIds[iCounter]=iMessageId; } @@ -1085,19 +1077,18 @@ void AddMessageToPages(INT32 iMessageId) void SortMessages(INT32 iCriteria) { - EmailPtr pA=pEmailList; + EmailPtr pA=pEmailList; EmailPtr pB=pEmailList; CHAR16 pSubjectA[256]; CHAR16 pSubjectB[256]; - INT32 iId=0; - + // no messages to sort? if( ( pA == NULL) ||( pB == NULL ) ) { return; } - // nothing here either? + // nothing here either? if(!pA->Next) return; @@ -1105,115 +1096,115 @@ void SortMessages(INT32 iCriteria) switch(iCriteria) { case RECEIVED: - while(pA) - { + while(pA) + { // set B to next in A - pB=pA -> Next; + pB=pA->Next; while(pB) { if( fSortDateUpwards ) { // if date is lesser, swap - if(pA->iDate > pB->iDate) - SwapMessages(pA->iId, pB->iId); + if(pA->iDate > pB->iDate) + SwapMessages(pA->iId, pB->iId); } else { // if date is lesser, swap - if(pA->iDate < pB->iDate) - SwapMessages(pA->iId, pB->iId); + if(pA->iDate < pB->iDate) + SwapMessages(pA->iId, pB->iId); } - + // next in B's list pB=pB->Next; } - + // next in A's List - pA=pA->Next; + pA=pA->Next; } break; case SENDER: - while(pA) + while(pA) { - - pB = pA ->Next; + + pB = pA->Next; while(pB) { - // lesser string?...need sorting + // lesser string?...need sorting if( fSortSenderUpwards ) { - if(( wcscmp( pSenderNameList[pA->ubSender] , pSenderNameList[pB->ubSender] ) ) < 0 ) - SwapMessages(pA->iId, pB->iId); + if(( wcscmp( pSenderNameList[pA->ubSender] , pSenderNameList[pB->ubSender] ) ) < 0 ) + SwapMessages(pA->iId, pB->iId); } else { if(( wcscmp( pSenderNameList[pA->ubSender] , pSenderNameList[pB->ubSender] ) ) > 0 ) - SwapMessages(pA->iId, pB->iId); + SwapMessages(pA->iId, pB->iId); } // next in B's list pB=pB->Next; } - // next in A's List + // next in A's List pA=pA->Next; } break; - case SUBJECT: - while(pA) - { + case SUBJECT: + while(pA) + { - pB = pA ->Next; + pB = pA->Next; while(pB) { // clear out control codes - CleanOutControlCodesFromString( pA->pSubject, pSubjectA ); - CleanOutControlCodesFromString( pB->pSubject, pSubjectB ); - - // lesser string?...need sorting + CleanOutControlCodesFromString( pA->pSubject, pSubjectA ); + CleanOutControlCodesFromString( pB->pSubject, pSubjectB ); + + // lesser string?...need sorting if( fSortSubjectUpwards ) { - if( ( wcscmp( pA->pSubject ,pB->pSubject ) ) < 0) - SwapMessages(pA->iId, pB->iId); - } + if( ( wcscmp( pA->pSubject ,pB->pSubject ) ) < 0) + SwapMessages(pA->iId, pB->iId); + } else { - if( ( wcscmp( pA->pSubject ,pB->pSubject ) ) > 0) - SwapMessages(pA->iId, pB->iId); + if( ( wcscmp( pA->pSubject ,pB->pSubject ) ) > 0) + SwapMessages(pA->iId, pB->iId); } // next in B's list pB=pB->Next; } // next in A's List - pA=pA->Next; + pA=pA->Next; } break; - case READ: - while(pA) - { + case READ: + while(pA) + { - pB = pA ->Next; + pB = pA->Next; while(pB) { - // one read and another not?...need sorting - if( ( pA->fRead ) && ( ! ( pB -> fRead ) ) ) + // one read and another not?...need sorting + if( ( pA->fRead ) && ( ! ( pB->fRead ) ) ) SwapMessages(pA->iId, pB->iId); - + // next in B's list pB=pB->Next; } // next in A's List - pA=pA->Next; + pA=pA->Next; } break; } // place new list into pages of email - //PlaceMessagesinPages(); - + //PlaceMessagesinPages(); + // redraw the screen fReDrawScreenFlag=TRUE; } @@ -1229,13 +1220,13 @@ void SwapMessages(INT32 iIdA, INT32 iIdB) memset( pTemp->pSubject, 0, sizeof( CHAR16 ) * 128 ); if(!pA->Next) - return; + return; //find pA while(pA->iId!=iIdA) - pA=pA->Next; + pA=pA->Next; // find pB while(pB->iId!=iIdB) - pB=pB->Next; + pB=pB->Next; // swap @@ -1266,11 +1257,11 @@ void SwapMessages(INT32 iIdA, INT32 iIdB) pB->usOffset=pTemp->usOffset; pB->usLength=pTemp->usLength; pB->iDate=pTemp->iDate; - pB->ubSender=pTemp->ubSender; + pB->ubSender=pTemp->ubSender; wcscpy(pB->pSubject, pTemp->pSubject); // free up memory - MemFree(pTemp -> pSubject); + MemFree(pTemp->pSubject); MemFree( pTemp ); return; } @@ -1279,7 +1270,7 @@ void ClearPages() { // run through list of message pages and set to -1 PagePtr pPage=pPageList; - + // error check if( pPageList == NULL ) { @@ -1289,10 +1280,10 @@ void ClearPages() while(pPage->Next) { pPage=pPage->Next; - MemFree(pPage->Prev); + MemFree(pPage->Prev); } if(pPage) - MemFree(pPage); + MemFree(pPage); pPageList=NULL; iLastPage=-1; @@ -1308,7 +1299,7 @@ void PlaceMessagesinPages() { AddMessageToPages(pEmail->iId); pEmail=pEmail->Next; - + } if(iCurrentPage >iLastPage) iCurrentPage=iLastPage; @@ -1331,17 +1322,17 @@ void DisplayMessageList(INT32 iPageNum) void DrawLetterIcon(INT32 iCounter, BOOLEAN fRead) { - HVOBJECT hHandle; - // will draw the icon for letter in mail list depending if the mail has been read or not - + HVOBJECT hHandle; + // will draw the icon for letter in mail list depending if the mail has been read or not + // grab video object GetVideoObject(&hHandle, guiEmailIndicator); - + // is it read or not? if(fRead) - BltVideoObject(FRAME_BUFFER, hHandle, 0,INDIC_X, (MIDDLE_Y+iCounter*MIDDLE_WIDTH+2), VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 0,INDIC_X, (MIDDLE_Y+iCounter*MIDDLE_WIDTH+2), VO_BLT_SRCTRANSPARENCY,NULL); else - BltVideoObject(FRAME_BUFFER, hHandle, 1,INDIC_X, (MIDDLE_Y+iCounter*MIDDLE_WIDTH+2), VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 1,INDIC_X, (MIDDLE_Y+iCounter*MIDDLE_WIDTH+2), VO_BLT_SRCTRANSPARENCY,NULL); return; } @@ -1353,7 +1344,7 @@ void DrawSubject(INT32 iCounter, STR16 pSubject, BOOLEAN fRead) // draw subject line of mail being viewed in viewer // lock buffer to prevent overwrite - SetFontDestBuffer(FRAME_BUFFER, SUBJECT_X , ((UINT16)(MIDDLE_Y+iCounter*MIDDLE_WIDTH)) , SUBJECT_X + SUBJECT_WIDTH , ( ( UINT16 ) ( MIDDLE_Y + iCounter * MIDDLE_WIDTH ) ) + MIDDLE_WIDTH, FALSE ); + SetFontDestBuffer(FRAME_BUFFER, SUBJECT_X , ((UINT16)(MIDDLE_Y+iCounter*MIDDLE_WIDTH)) , SUBJECT_X + SUBJECT_WIDTH , ( ( UINT16 ) ( MIDDLE_Y + iCounter * MIDDLE_WIDTH ) ) + MIDDLE_WIDTH, FALSE ); SetFontShadow(NO_SHADOW); SetFontForeground( FONT_BLACK ); SetFontBackground( FONT_BLACK ); @@ -1369,9 +1360,9 @@ void DrawSubject(INT32 iCounter, STR16 pSubject, BOOLEAN fRead) ReduceStringLength( pTempSubject, SUBJECT_WIDTH - 10, MESSAGE_FONT ); } - // display string subject - IanDisplayWrappedString(SUBJECT_X, (( UINT16 )( 4 + MIDDLE_Y + iCounter * MIDDLE_WIDTH ) ) , SUBJECT_WIDTH, MESSAGE_GAP, MESSAGE_FONT, MESSAGE_COLOR ,pTempSubject,0 ,FALSE ,LEFT_JUSTIFIED ); - } + // display string subject + IanDisplayWrappedString(SUBJECT_X, (( UINT16 )( 4 + MIDDLE_Y + iCounter * MIDDLE_WIDTH ) ) , SUBJECT_WIDTH, MESSAGE_GAP, MESSAGE_FONT, MESSAGE_COLOR ,pTempSubject,0 ,FALSE ,LEFT_JUSTIFIED ); + } else { //if the subject will be too long, cap it, and add the '...' @@ -1381,13 +1372,13 @@ void DrawSubject(INT32 iCounter, STR16 pSubject, BOOLEAN fRead) } // display string subject - IanDisplayWrappedString(SUBJECT_X, (( UINT16 )( 4 + MIDDLE_Y + iCounter * MIDDLE_WIDTH ) ) , SUBJECT_WIDTH, MESSAGE_GAP, FONT10ARIALBOLD, MESSAGE_COLOR ,pTempSubject,0 ,FALSE ,LEFT_JUSTIFIED ); + IanDisplayWrappedString(SUBJECT_X, (( UINT16 )( 4 + MIDDLE_Y + iCounter * MIDDLE_WIDTH ) ) , SUBJECT_WIDTH, MESSAGE_GAP, FONT10ARIALBOLD, MESSAGE_COLOR ,pTempSubject,0 ,FALSE ,LEFT_JUSTIFIED ); } SetFontShadow(DEFAULT_SHADOW); // reset font dest buffer - SetFontDestBuffer(FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); - + SetFontDestBuffer(FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); + return; } @@ -1398,7 +1389,7 @@ void DrawSender(INT32 iCounter, UINT8 ubSender, BOOLEAN fRead) SetFontShadow(NO_SHADOW); SetFontShadow(NO_SHADOW); - SetFontForeground( FONT_BLACK ); + SetFontForeground( FONT_BLACK ); SetFontBackground( FONT_BLACK ); if( fRead ) @@ -1410,19 +1401,19 @@ void DrawSender(INT32 iCounter, UINT8 ubSender, BOOLEAN fRead) SetFont( FONT10ARIALBOLD ); } - mprintf(SENDER_X,(( UINT16 )( 4 + MIDDLE_Y + iCounter * MIDDLE_WIDTH ) ) ,pSenderNameList[ubSender]); - + mprintf(SENDER_X,(( UINT16 )( 4 + MIDDLE_Y + iCounter * MIDDLE_WIDTH ) ) ,pSenderNameList[ubSender]); + SetFont( MESSAGE_FONT ); SetFontShadow(DEFAULT_SHADOW); return; } void DrawDate(INT32 iCounter, INT32 iDate, BOOLEAN fRead) -{ +{ CHAR16 sString[20]; SetFontShadow(NO_SHADOW); - SetFontForeground( FONT_BLACK ); + SetFontForeground( FONT_BLACK ); SetFontBackground( FONT_BLACK ); if( fRead ) @@ -1434,8 +1425,8 @@ void DrawDate(INT32 iCounter, INT32 iDate, BOOLEAN fRead) SetFont( FONT10ARIALBOLD ); } // draw date of message being displayed in mail viewer - swprintf(sString, L"%s %d", pDayStrings[ 0 ], iDate/ ( 24 * 60 ) ); - mprintf(DATE_X,(( UINT16 )( 4 + MIDDLE_Y + iCounter * MIDDLE_WIDTH ) ),sString); + swprintf(sString, L"%s %d", pDayStrings[ 0 ], iDate/ ( 24 * 60 ) ); + mprintf(DATE_X,(( UINT16 )( 4 + MIDDLE_Y + iCounter * MIDDLE_WIDTH ) ),sString); SetFont( MESSAGE_FONT ); SetFontShadow(DEFAULT_SHADOW); @@ -1446,32 +1437,32 @@ void DisplayEmailList() { INT32 iCounter=0; // look at current page, and display - PagePtr pPage=pPageList; - EmailPtr pEmail=NULL; + PagePtr pPage=pPageList; + EmailPtr pEmail=NULL; // error check, if no page, return if(!pPage) return; - + // if current page ever ends up negative, reset to 0 if(iCurrentPage==-1) iCurrentPage=0; - + // loop until we get to the current page while((pPage->iPageId!=iCurrentPage)&&(iCurrentPage <=iLastPage)) pPage=pPage->Next; - + // now we have current page, display it pEmail=GetEmailMessage(pPage->iIds[iCounter]); SetFontShadow(NO_SHADOW); SetFont(EMAIL_TEXT_FONT); - - + + // draw each line of the list for this page while(pEmail) { - + // highlighted message, set text of message in list to blue if(iCounter==iHighLightLine) { @@ -1480,39 +1471,39 @@ void DisplayEmailList() else if(pEmail->fRead) { // message has been read, reset color to black - SetFontForeground(FONT_BLACK); - //SetFontBackground(FONT_BLACK); - + SetFontForeground(FONT_BLACK); + //SetFontBackground(FONT_BLACK); + } else { - // defualt, message is not read, set font red - SetFontForeground(FONT_RED); - //SetFontBackground(FONT_BLACK); + // defualt, message is not read, set font red + SetFontForeground(FONT_RED); + //SetFontBackground(FONT_BLACK); } - SetFontBackground(FONT_BLACK); - + SetFontBackground(FONT_BLACK); + //draw the icon, sender, date, subject DrawLetterIcon(iCounter,pEmail->fRead ); DrawSubject(iCounter, pEmail->pSubject, pEmail->fRead ); DrawSender(iCounter, pEmail->ubSender, pEmail->fRead ); DrawDate(iCounter, pEmail->iDate, pEmail->fRead ); - + iCounter++; // too many messages onthis page, reset pEmail, so no more are drawn - if(iCounter >=MAX_MESSAGES_PAGE) - pEmail=NULL; + if(iCounter >=MAX_MESSAGES_PAGE) + pEmail=NULL; else - pEmail=GetEmailMessage(pPage->iIds[iCounter]); - + pEmail=GetEmailMessage(pPage->iIds[iCounter]); + } - - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_LR_Y); - + + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_LR_Y); + SetFontShadow(DEFAULT_SHADOW); return; } @@ -1523,9 +1514,9 @@ void LookForUnread() BOOLEAN fStatusOfNewEmailFlag = fUnReadMailFlag; // simply runrs through list of messages, if any unread, set unread flag - - EmailPtr pA=pEmailList; - + + EmailPtr pA=pEmailList; + // reset unread flag fUnReadMailFlag=FALSE; @@ -1534,7 +1525,7 @@ void LookForUnread() { // unread mail found, set flag if(!(pA->fRead)) - fUnReadMailFlag=TRUE; + fUnReadMailFlag=TRUE; pA=pA->Next; } @@ -1548,85 +1539,84 @@ void LookForUnread() } void EmailBtnCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ INT32 iCount; PagePtr pPage=pPageList; INT32 iId=0; - EmailPtr pEmail=NULL; if (iReason & MSYS_CALLBACK_REASON_INIT) { return; } if(fDisplayMessageFlag) - return; + return; if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) { - // error check - iCount=MSYS_GetRegionUserData(pRegion, 0); - // check for valid email - // find surrent page - if(!pPage) - return; - while((pPage->Next)&&(pPage->iPageId!=iCurrentPage)) - pPage=pPage->Next; - if(!pPage) - return; - // found page - - // get id for element iCount - iId=pPage->iIds[iCount]; - - // invalid message - if(iId==-1) - { - fDisplayMessageFlag=FALSE; - return; - } - // Get email and display - fDisplayMessageFlag=TRUE; - giMessagePage = 0; - giPrevMessageId = giMessageId; - giMessageId=iId; + // error check + iCount=MSYS_GetRegionUserData(pRegion, 0); + // check for valid email + // find surrent page + if(!pPage) + return; + while((pPage->Next)&&(pPage->iPageId!=iCurrentPage)) + pPage=pPage->Next; + if(!pPage) + return; + // found page + + // get id for element iCount + iId=pPage->iIds[iCount]; + + // invalid message + if(iId==-1) + { + fDisplayMessageFlag=FALSE; + return; + } + // Get email and display + fDisplayMessageFlag=TRUE; + giMessagePage = 0; + giPrevMessageId = giMessageId; + giMessageId=iId; + - } else if(iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - iCount=MSYS_GetRegionUserData(pRegion, 0); - - // error check - if(!pPage) - { - HandleRightButtonUpEvent( ); - return; - } + iCount=MSYS_GetRegionUserData(pRegion, 0); - giMessagePage = 0; + // error check + if(!pPage) + { + HandleRightButtonUpEvent( ); + return; + } - while((pPage->Next)&&(pPage->iPageId!=iCurrentPage)) - pPage=pPage->Next; - if(!pPage) - { - HandleRightButtonUpEvent( ); - return; - } - // found page - // get id for element iCount - iId=pPage->iIds[iCount]; - if(!GetEmailMessage(iId)) - { - // no mail here, handle right button up event - HandleRightButtonUpEvent( ); - return; - } - else - { - fDeleteMailFlag=TRUE; - iDeleteId=iId; - //DisplayDeleteNotice(GetEmailMessage(iDeleteId)); - //DeleteEmail(); - } + giMessagePage = 0; + + while((pPage->Next)&&(pPage->iPageId!=iCurrentPage)) + pPage=pPage->Next; + if(!pPage) + { + HandleRightButtonUpEvent( ); + return; + } + // found page + // get id for element iCount + iId=pPage->iIds[iCount]; + if(!GetEmailMessage(iId)) + { + // no mail here, handle right button up event + HandleRightButtonUpEvent( ); + return; + } + else + { + fDeleteMailFlag=TRUE; + iDeleteId=iId; + //DisplayDeleteNotice(GetEmailMessage(iDeleteId)); + //DeleteEmail(); + } } } void EmailMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason ) @@ -1635,19 +1625,19 @@ void EmailMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason ) { return; } - if(fDisplayMessageFlag) + if(fDisplayMessageFlag) return; if (iReason == MSYS_CALLBACK_REASON_MOVE) { // set highlight to current regions data, this is the message to display - iHighLightLine=MSYS_GetRegionUserData(pRegion, 0); + iHighLightLine=MSYS_GetRegionUserData(pRegion, 0); } - if (iReason == MSYS_CALLBACK_REASON_LOST_MOUSE ) + if (iReason == MSYS_CALLBACK_REASON_LOST_MOUSE ) { // reset highlight line to invalid message - iHighLightLine=-1; + iHighLightLine=-1; } } @@ -1658,45 +1648,45 @@ void BtnMessageXCallback(GUI_BUTTON *btn,INT32 reason) if((reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )||(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN)) { - + btn->uiFlags |= BUTTON_CLICKED_ON; - + } - else if((reason & MSYS_CALLBACK_REASON_LBUTTON_UP )||(reason & MSYS_CALLBACK_REASON_RBUTTON_UP)) + else if((reason & MSYS_CALLBACK_REASON_LBUTTON_UP )||(reason & MSYS_CALLBACK_REASON_RBUTTON_UP)) { - + if(btn->uiFlags& BUTTON_CLICKED_ON) { - // X button has been pressed and let up, this means to stop displaying the currently displayed message + // X button has been pressed and let up, this means to stop displaying the currently displayed message - // reset display message flag - fDisplayMessageFlag=FALSE; + // reset display message flag + fDisplayMessageFlag=FALSE; - // reset button flag - btn->uiFlags &= ~BUTTON_CLICKED_ON; + // reset button flag + btn->uiFlags &= ~BUTTON_CLICKED_ON; - // reset page being displayed - giMessagePage = 0; + // reset page being displayed + giMessagePage = 0; - // redraw icons - DrawLapTopIcons(); + // redraw icons + DrawLapTopIcons(); - // force update of entire screen - fPausedReDrawScreenFlag=TRUE; + // force update of entire screen + fPausedReDrawScreenFlag=TRUE; - // rerender email - //RenderEmail(); + // rerender email + //RenderEmail(); } } - -} + +} void SetUnNewMessages() { // on exit from the mailer, set all new messages as 'un'new - EmailPtr pEmail=pEmailList; + EmailPtr pEmail=pEmailList; // run through the list of messages and add to pages - + while(pEmail) { pEmail->fNew=FALSE; @@ -1707,21 +1697,13 @@ SetUnNewMessages() INT32 DisplayEmailMessage(EmailPtr pMail) { - HVOBJECT hHandle; - INT32 iCnt=0; + HVOBJECT hHandle; INT32 iHeight=0; INT32 iCounter=1; // CHAR16 pString[MAIL_STRING_SIZE/2 + 1]; CHAR16 pString[MAIL_STRING_SIZE]; INT32 iOffSet=0; - INT32 iHeightTemp=0; - INT32 iHeightSoFar = 0; RecordPtr pTempRecord; - INT32 iPageSize = 0; - INT32 iPastHeight=0; - INT32 iYPositionOnPage = 0; - INT32 iTotalYPosition = 0; - BOOLEAN fGoingOffCurrentPage = FALSE; BOOLEAN fDonePrintingMessage = FALSE; @@ -1729,80 +1711,80 @@ INT32 DisplayEmailMessage(EmailPtr pMail) if(!pMail) return 0; - iOffSet=(INT32)pMail->usOffset; - - // reset redraw email message flag + iOffSet=(INT32)pMail->usOffset; + + // reset redraw email message flag fReDrawMessageFlag = FALSE; - + // we KNOW the player is going to "read" this, so mark it as so pMail->fRead=TRUE; giCurrentIMPSlot = pMail->iCurrentIMPPosition; - + // draw text for title bar - //swprintf(pString, L"%s / %s", pSenderNameList[pMail->ubSender],pMail->pSubject); + //swprintf(pString, L"%s / %s", pSenderNameList[pMail->ubSender],pMail->pSubject); //DisplayWrappedString(VIEWER_X+VIEWER_HEAD_X+4, VIEWER_Y+VIEWER_HEAD_Y+4, VIEWER_HEAD_WIDTH, MESSAGE_GAP, MESSAGE_FONT, MESSAGE_COLOR, pString, 0,FALSE,0); - + // increment height for size of one line iHeight+=GetFontHeight( MESSAGE_FONT ); // is there any special event meant for this mail?..if so, handle it HandleAnySpecialEmailMessageEvents( iOffSet ); - + HandleMailSpecialMessages( ( UINT16 ) ( iOffSet ), &iViewerPositionY, pMail); - + PreProcessEmail( pMail ); - - pTempRecord = pMessageRecordList; - + pTempRecord = pMessageRecordList; - // blt in top line of message as a blank graphic + + + // blt in top line of message as a blank graphic // get a handle to the bitmap of EMAIL VIEWER Background GetVideoObject( &hHandle, guiEmailMessage ); - + // place the graphic on the frame buffer BltVideoObject( FRAME_BUFFER, hHandle, 1,VIEWER_X, VIEWER_MESSAGE_BODY_START_Y + iViewerPositionY, VO_BLT_SRCTRANSPARENCY,NULL ); - BltVideoObject( FRAME_BUFFER, hHandle, 1,VIEWER_X, VIEWER_MESSAGE_BODY_START_Y + GetFontHeight( MESSAGE_FONT ) + iViewerPositionY, VO_BLT_SRCTRANSPARENCY,NULL ); - + BltVideoObject( FRAME_BUFFER, hHandle, 1,VIEWER_X, VIEWER_MESSAGE_BODY_START_Y + GetFontHeight( MESSAGE_FONT ) + iViewerPositionY, VO_BLT_SRCTRANSPARENCY,NULL ); + // set shadow SetFontShadow(NO_SHADOW); // get a handle to the bitmap of EMAIL VIEWER GetVideoObject(&hHandle, guiEmailMessage); - + // place the graphic on the frame buffer BltVideoObject(FRAME_BUFFER, hHandle, 0,VIEWER_X, VIEWER_Y + iViewerPositionY, VO_BLT_SRCTRANSPARENCY,NULL); - - + + // the icon for the title of this box GetVideoObject( &hHandle, guiTITLEBARICONS ); - BltVideoObject( FRAME_BUFFER, hHandle, 0,VIEWER_X + 5, VIEWER_Y + iViewerPositionY + 2, VO_BLT_SRCTRANSPARENCY,NULL ); - + BltVideoObject( FRAME_BUFFER, hHandle, 0,VIEWER_X + 5, VIEWER_Y + iViewerPositionY + 2, VO_BLT_SRCTRANSPARENCY,NULL ); + // display header text - DisplayEmailMessageSubjectDateFromLines( pMail, iViewerPositionY ); - + DisplayEmailMessageSubjectDateFromLines( pMail, iViewerPositionY ); + // display title text DrawEmailMessageDisplayTitleText( iViewerPositionY ); - - - iCounter=0; - // now blit the text background based on height + + + iCounter=0; + // now blit the text background based on height for (iCounter=2; iCounter < ( ( iTotalHeight ) / ( GetFontHeight( MESSAGE_FONT ) ) ); iCounter++ ) { - // get a handle to the bitmap of EMAIL VIEWER Background - GetVideoObject( &hHandle, guiEmailMessage ); - - // place the graphic on the frame buffer - BltVideoObject( FRAME_BUFFER, hHandle, 1,VIEWER_X, iViewerPositionY + VIEWER_MESSAGE_BODY_START_Y+( (GetFontHeight( MESSAGE_FONT ) ) * ( iCounter )), VO_BLT_SRCTRANSPARENCY,NULL ); - + // get a handle to the bitmap of EMAIL VIEWER Background + GetVideoObject( &hHandle, guiEmailMessage ); + + // place the graphic on the frame buffer + BltVideoObject( FRAME_BUFFER, hHandle, 1,VIEWER_X, iViewerPositionY + VIEWER_MESSAGE_BODY_START_Y+( (GetFontHeight( MESSAGE_FONT ) ) * ( iCounter )), VO_BLT_SRCTRANSPARENCY,NULL ); + } - + // now the bottom piece to the message viewer - GetVideoObject( &hHandle, guiEmailMessage ); - + GetVideoObject( &hHandle, guiEmailMessage ); + if( giNumberOfPagesToCurrentEmail <= 2 ) { // place the graphic on the frame buffer @@ -1816,43 +1798,43 @@ INT32 DisplayEmailMessage(EmailPtr pMail) // reset iCounter and iHeight iCounter = 1; - iHeight = GetFontHeight(MESSAGE_FONT); + iHeight = GetFontHeight(MESSAGE_FONT); - // draw body of text. Any particular email can encompass more than one "record" in the + // draw body of text. Any particular email can encompass more than one "record" in the // email file. Draw each record (length is number of records) - + // now place the text - + // reset ptemprecord to head of list pTempRecord = pMessageRecordList; - // reset shadow + // reset shadow SetFontShadow( NO_SHADOW ); pTempRecord = pEmailPageInfo[ giMessagePage ].pFirstRecord; - + if( pTempRecord ) { while( fDonePrintingMessage == FALSE ) { - - // copy over string - wcscpy( pString, pTempRecord -> pRecord ); + + // copy over string + wcscpy( pString, pTempRecord->pRecord ); // get the height of the string, ONLY!...must redisplay ON TOP OF background graphic - iHeight += IanDisplayWrappedString(VIEWER_X + 9, ( UINT16 )( VIEWER_MESSAGE_BODY_START_Y + iHeight + iViewerPositionY), MESSAGE_WIDTH, MESSAGE_GAP, MESSAGE_FONT, MESSAGE_COLOR,pString,0,FALSE, IAN_WRAP_NO_SHADOW); + iHeight += IanDisplayWrappedString(VIEWER_X + 9, ( UINT16 )( VIEWER_MESSAGE_BODY_START_Y + iHeight + iViewerPositionY), MESSAGE_WIDTH, MESSAGE_GAP, MESSAGE_FONT, MESSAGE_COLOR,pString,0,FALSE, IAN_WRAP_NO_SHADOW); + - // increment email record ptr - pTempRecord = pTempRecord -> Next; + pTempRecord = pTempRecord->Next; + - if( pTempRecord == NULL ) { fDonePrintingMessage = TRUE; } - else if( ( pTempRecord == pEmailPageInfo[ giMessagePage ].pLastRecord ) && ( pEmailPageInfo[ giMessagePage + 1 ].pFirstRecord != NULL ) ) + else if( ( pTempRecord == pEmailPageInfo[ giMessagePage ].pLastRecord ) && ( pEmailPageInfo[ giMessagePage + 1 ].pFirstRecord != NULL ) ) { fDonePrintingMessage = TRUE; } @@ -1863,44 +1845,44 @@ INT32 DisplayEmailMessage(EmailPtr pMail) if(iTotalHeight < MAX_EMAIL_MESSAGE_PAGE_SIZE) { fOnLastPageFlag = TRUE; - while( pTempRecord ) + while( pTempRecord ) { - // copy over string - wcscpy( pString, pTempRecord -> pRecord ); + // copy over string + wcscpy( pString, pTempRecord->pRecord ); + + // get the height of the string, ONLY!...must redisplay ON TOP OF background graphic + iHeight += IanDisplayWrappedString(VIEWER_X + MESSAGE_X + 4, ( UINT16 )( VIEWER_MESSAGE_BODY_START_Y + iHeight + iViewerPositionY), MESSAGE_WIDTH, MESSAGE_GAP, MESSAGE_FONT, MESSAGE_COLOR,pString,0,FALSE, IAN_WRAP_NO_SHADOW); - // get the height of the string, ONLY!...must redisplay ON TOP OF background graphic - iHeight += IanDisplayWrappedString(VIEWER_X + MESSAGE_X + 4, ( UINT16 )( VIEWER_MESSAGE_BODY_START_Y + iHeight + iViewerPositionY), MESSAGE_WIDTH, MESSAGE_GAP, MESSAGE_FONT, MESSAGE_COLOR,pString,0,FALSE, IAN_WRAP_NO_SHADOW); - // increment email record ptr - pTempRecord = pTempRecord -> Next; + pTempRecord = pTempRecord->Next; } - + } - else + else { - + iYPositionOnPage = 0; // go to the right record pTempRecord = GetFirstRecordOnThisPage( pMessageRecordList, MESSAGE_FONT, MESSAGE_WIDTH, MESSAGE_GAP, giMessagePage, MAX_EMAIL_MESSAGE_PAGE_SIZE ); - while( pTempRecord ) + while( pTempRecord ) { - // copy over string - wcscpy( pString, pTempRecord -> pRecord ); - + // copy over string + wcscpy( pString, pTempRecord->pRecord ); + if( pString[ 0 ] == 0 ) { // on last page fOnLastPageFlag = TRUE; } - - if( ( iYPositionOnPage + IanWrappedStringHeight(0, 0, MESSAGE_WIDTH, MESSAGE_GAP, - MESSAGE_FONT, 0, pTempRecord->pRecord, - 0, 0, 0 ) ) <= MAX_EMAIL_MESSAGE_PAGE_SIZE ) + + if( ( iYPositionOnPage + IanWrappedStringHeight(0, 0, MESSAGE_WIDTH, MESSAGE_GAP, + MESSAGE_FONT, 0, pTempRecord->pRecord, + 0, 0, 0 ) ) <= MAX_EMAIL_MESSAGE_PAGE_SIZE ) { - // now print it - iYPositionOnPage += IanDisplayWrappedString(VIEWER_X + MESSAGE_X + 4, ( UINT16 )( VIEWER_MESSAGE_BODY_START_Y + 10 +iYPositionOnPage + iViewerPositionY), MESSAGE_WIDTH, MESSAGE_GAP, MESSAGE_FONT, MESSAGE_COLOR,pString,0,FALSE, IAN_WRAP_NO_SHADOW); + // now print it + iYPositionOnPage += IanDisplayWrappedString(VIEWER_X + MESSAGE_X + 4, ( UINT16 )( VIEWER_MESSAGE_BODY_START_Y + 10 +iYPositionOnPage + iViewerPositionY), MESSAGE_WIDTH, MESSAGE_GAP, MESSAGE_FONT, MESSAGE_COLOR,pString,0,FALSE, IAN_WRAP_NO_SHADOW); fGoingOffCurrentPage = FALSE; } else @@ -1910,9 +1892,9 @@ INT32 DisplayEmailMessage(EmailPtr pMail) } - pTempRecord = pTempRecord ->Next; + pTempRecord = pTempRecord->Next; + - if( ( pTempRecord == NULL ) && ( fGoingOffCurrentPage == FALSE ) ) { // on last page @@ -1930,7 +1912,7 @@ INT32 DisplayEmailMessage(EmailPtr pMail) pTempRecord = NULL; } } - + } */ @@ -1939,8 +1921,8 @@ INT32 DisplayEmailMessage(EmailPtr pMail) // mark this area dirty InvalidateRegion( LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_LR_Y ); - - + + // reset shadow SetFontShadow( DEFAULT_SHADOW ); @@ -1958,16 +1940,16 @@ void BtnNewOkback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - { + { } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if(btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - fNewMailFlag=FALSE; + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fNewMailFlag=FALSE; } } @@ -1976,65 +1958,65 @@ void BtnNewOkback(GUI_BUTTON *btn,INT32 reason) void AddDeleteRegionsToMessageRegion(INT32 iViewerY) { // will create/destroy mouse region for message display - + if((fDisplayMessageFlag)&&(!fOldDisplayMessageFlag)) { // set old flag fOldDisplayMessageFlag=TRUE; - - + + // add X button - giMessageButtonImage[0]= LoadButtonImage( "LAPTOP\\X.sti" ,-1,0,-1,1,-1 ); - giMessageButton[0] = QuickCreateButton( giMessageButtonImage[0], BUTTON_X + 2,(INT16) ( BUTTON_Y + ( INT16 )iViewerY + 1), + giMessageButtonImage[0]= LoadButtonImage( "LAPTOP\\X.sti" ,-1,0,-1,1,-1 ); + giMessageButton[0] = QuickCreateButton( giMessageButtonImage[0], BUTTON_X + 2,(INT16) ( BUTTON_Y + ( INT16 )iViewerY + 1), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnMessageXCallback ); - SetButtonCursor(giMessageButton[0], CURSOR_LAPTOP_SCREEN); - + SetButtonCursor(giMessageButton[0], CURSOR_LAPTOP_SCREEN); + if( giNumberOfPagesToCurrentEmail > 2 ) { // add next and previous mail page buttons - giMailMessageButtonsImage[0]= LoadButtonImage( "LAPTOP\\NewMailButtons.sti" ,-1,0,-1,3,-1 ); + giMailMessageButtonsImage[0]= LoadButtonImage( "LAPTOP\\NewMailButtons.sti" ,-1,0,-1,3,-1 ); giMailMessageButtons[0] = QuickCreateButton( giMailMessageButtonsImage[0], PREVIOUS_PAGE_BUTTON_X,(INT16) ( LOWER_BUTTON_Y + ( INT16 )iViewerY + 2), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnPreviousEmailPageCallback ); - giMailMessageButtonsImage[1]= LoadButtonImage( "LAPTOP\\NewMailButtons.sti" ,-1,1,-1,4,-1 ); + giMailMessageButtonsImage[1]= LoadButtonImage( "LAPTOP\\NewMailButtons.sti" ,-1,1,-1,4,-1 ); giMailMessageButtons[1] = QuickCreateButton( giMailMessageButtonsImage[1], NEXT_PAGE_BUTTON_X ,(INT16) ( LOWER_BUTTON_Y + ( INT16 )iViewerY + 2), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnNextEmailPageCallback ); - + gfPageButtonsWereCreated = TRUE; - + } - giMailMessageButtonsImage[2]= LoadButtonImage( "LAPTOP\\NewMailButtons.sti" ,-1,2,-1,5,-1 ); + giMailMessageButtonsImage[2]= LoadButtonImage( "LAPTOP\\NewMailButtons.sti" ,-1,2,-1,5,-1 ); giMailMessageButtons[2] = QuickCreateButton( giMailMessageButtonsImage[2], DELETE_BUTTON_X,(INT16) ( BUTTON_LOWER_Y + ( INT16 )iViewerY + 2), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnDeleteCallback ); /* // set up disable methods SpecifyDisabledButtonStyle( giMailMessageButtons[1], DISABLED_STYLE_SHADED ); - SpecifyDisabledButtonStyle( giMailMessageButtons[0], DISABLED_STYLE_SHADED ); + SpecifyDisabledButtonStyle( giMailMessageButtons[0], DISABLED_STYLE_SHADED ); */ // set cursors SetButtonCursor(giMailMessageButtons[0], CURSOR_LAPTOP_SCREEN); SetButtonCursor(giMailMessageButtons[1], CURSOR_LAPTOP_SCREEN); - SetButtonCursor(giMailMessageButtons[2], CURSOR_LAPTOP_SCREEN); + SetButtonCursor(giMailMessageButtons[2], CURSOR_LAPTOP_SCREEN); SetButtonCursor(giMessageButton[0], CURSOR_LAPTOP_SCREEN); - + // force update of screen - fReDrawScreenFlag=TRUE; + fReDrawScreenFlag=TRUE; } - else if((!fDisplayMessageFlag)&&(fOldDisplayMessageFlag)) - { + else if((!fDisplayMessageFlag)&&(fOldDisplayMessageFlag)) + { // delete region - fOldDisplayMessageFlag=FALSE; - RemoveButton(giMessageButton[0] ); - UnloadButtonImage( giMessageButtonImage[0] ); + fOldDisplayMessageFlag=FALSE; + RemoveButton(giMessageButton[0] ); + UnloadButtonImage( giMessageButtonImage[0] ); // net/previous email page buttons - if( gfPageButtonsWereCreated ) + if( gfPageButtonsWereCreated ) { RemoveButton(giMailMessageButtons[0] ); UnloadButtonImage( giMailMessageButtonsImage[0] ); @@ -2043,8 +2025,8 @@ void AddDeleteRegionsToMessageRegion(INT32 iViewerY) gfPageButtonsWereCreated = FALSE; } RemoveButton(giMailMessageButtons[2] ); - UnloadButtonImage( giMailMessageButtonsImage[2] ); - // force update of screen + UnloadButtonImage( giMailMessageButtonsImage[2] ); + // force update of screen fReDrawScreenFlag=TRUE; } @@ -2052,58 +2034,58 @@ void AddDeleteRegionsToMessageRegion(INT32 iViewerY) void CreateDestroyNewMailButton() { - static BOOLEAN fOldNewMailFlag=FALSE; + static BOOLEAN fOldNewMailFlag=FALSE; // check if we are video conferencing, if so, do nothing if( gubVideoConferencingMode != 0 ) { - return ; + return ; } if((fNewMailFlag)&&(!fOldNewMailFlag)) { - // create new mail dialog box button + // create new mail dialog box button + + // set old flag (stating button has been created) + fOldNewMailFlag=TRUE; - // set old flag (stating button has been created) - fOldNewMailFlag=TRUE; - // load image and setup button giNewMailButtonImage[0]=LoadButtonImage( "LAPTOP\\YesNoButtons.sti" ,-1,0,-1,1,-1 ); - giNewMailButton[0]= QuickCreateButton( giNewMailButtonImage[0], NEW_BTN_X+10, NEW_BTN_Y, + giNewMailButton[0]= QuickCreateButton( giNewMailButtonImage[0], NEW_BTN_X+10, NEW_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST-2, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnNewOkback); - + // set cursor SetButtonCursor(giNewMailButton[0], CURSOR_LAPTOP_SCREEN); - + // set up screen mask region MSYS_DefineRegion(&pScreenMask,0, 0,SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST-3,CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, LapTopScreenCallBack); MSYS_AddRegion(&pScreenMask); - MarkAButtonDirty( giNewMailButton[0] ); + MarkAButtonDirty( giNewMailButton[0] ); fReDrawScreenFlag = TRUE; } else if((!fNewMailFlag)&&(fOldNewMailFlag)) { - // reset old flag - fOldNewMailFlag=FALSE; + // reset old flag + fOldNewMailFlag=FALSE; - // remove the button - RemoveButton( giNewMailButton[0] ); - UnloadButtonImage( giNewMailButtonImage[0] ); - - // remove screen mask - MSYS_RemoveRegion( &pScreenMask ); + // remove the button + RemoveButton( giNewMailButton[0] ); + UnloadButtonImage( giNewMailButtonImage[0] ); + + // remove screen mask + MSYS_RemoveRegion( &pScreenMask ); - //re draw screen - fReDraw=TRUE; + //re draw screen + fReDraw=TRUE; - // redraw screen - fPausedReDrawScreenFlag=TRUE; + // redraw screen + fPausedReDrawScreenFlag=TRUE; } } @@ -2111,17 +2093,17 @@ void CreateDestroyNewMailButton() BOOLEAN DisplayNewMailBox( void ) { - - + + HVOBJECT hHandle; static BOOLEAN fOldNewMailFlag=FALSE; // will display a new mail box whenever new mail has arrived - + // check if we are video conferencing, if so, do nothing - if( gubVideoConferencingMode != 0 ) - { - return( FALSE ); - } + if( gubVideoConferencingMode != 0 ) + { + return( FALSE ); + } // just stopped displaying box, reset old flag if( ( !fNewMailFlag ) && ( fOldNewMailFlag ) ) @@ -2129,61 +2111,61 @@ BOOLEAN DisplayNewMailBox( void ) fOldNewMailFlag=FALSE; return ( FALSE ); } - + // not even set, leave NOW! if( !fNewMailFlag ) return ( FALSE ); - + // is set but already drawn, LEAVE NOW! - //if( ( fNewMailFlag ) && ( fOldNewMailFlag ) ) + //if( ( fNewMailFlag ) && ( fOldNewMailFlag ) ) // return ( FALSE ); - - GetVideoObject( &hHandle, guiEmailWarning ); - BltVideoObject( FRAME_BUFFER, hHandle, 0,EMAIL_WARNING_X, EMAIL_WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL ); - - + + GetVideoObject( &hHandle, guiEmailWarning ); + BltVideoObject( FRAME_BUFFER, hHandle, 0,EMAIL_WARNING_X, EMAIL_WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL ); + + // the icon for the title of this box GetVideoObject( &hHandle, guiTITLEBARICONS ); - BltVideoObject( FRAME_BUFFER, hHandle, 0,EMAIL_WARNING_X + 5, EMAIL_WARNING_Y + 2, VO_BLT_SRCTRANSPARENCY,NULL ); - - // font stuff + BltVideoObject( FRAME_BUFFER, hHandle, 0,EMAIL_WARNING_X + 5, EMAIL_WARNING_Y + 2, VO_BLT_SRCTRANSPARENCY,NULL ); + + // font stuff SetFont( EMAIL_HEADER_FONT ); SetFontForeground( FONT_WHITE ); SetFontBackground( FONT_BLACK ); SetFontShadow( DEFAULT_SHADOW ); - + // print warning mprintf(EMAIL_WARNING_X + 30, EMAIL_WARNING_Y + 8, pEmailTitleText[0] ); - // font stuff + // font stuff SetFontShadow( NO_SHADOW ); SetFont( EMAIL_WARNING_FONT ); - SetFontForeground( FONT_BLACK ); + SetFontForeground( FONT_BLACK ); // printf warning string mprintf(EMAIL_WARNING_X + 60, EMAIL_WARNING_Y + 63, pNewMailStrings[0] ); DrawLapTopIcons( ); - + // invalidate region InvalidateRegion( EMAIL_WARNING_X, EMAIL_WARNING_Y, EMAIL_WARNING_X + 270, EMAIL_WARNING_Y + 200 ); - + // mark button - MarkAButtonDirty( giNewMailButton[0] ); - + MarkAButtonDirty( giNewMailButton[0] ); + // reset shadow SetFontShadow( DEFAULT_SHADOW ); - + // redraw icons - + // set box as displayed fOldNewMailFlag=TRUE; - + // return return ( TRUE ); } @@ -2200,24 +2182,24 @@ void ReDrawNewMailBox( void ) fNewMailFlag = FALSE; // display new mail box - DisplayNewMailBox( ); + DisplayNewMailBox( ); + + // dirty buttons + MarkAButtonDirty( giNewMailButton[0] ); + - // dirty buttons - MarkAButtonDirty( giNewMailButton[0] ); - - // set display flag back to orginal fNewMailFlag = TRUE; - // time to redraw - DisplayNewMailBox( ); + // time to redraw + DisplayNewMailBox( ); } // return; - // reset flag for redraw - fReDrawNewMailFlag = FALSE; + // reset flag for redraw + fReDrawNewMailFlag = FALSE; return; } @@ -2226,11 +2208,11 @@ void ReDrawNewMailBox( void ) void SwitchEmailPages( void ) { // this function will switch current page - + // gone too far, reset page to start if( iCurrentPage >iLastPage ) iCurrentPage=0; - + // set to last page if( iCurrentPage < 0 ) iCurrentPage=iLastPage; @@ -2243,56 +2225,56 @@ void DetermineNextPrevPageDisplay( void ) { // will determine which of previous and next page graphics to display - + if( iCurrentPage > 0 ) { // display Previous graphic - + // font stuff - SetFont( TRAVERSE_EMAIL_FONT ); + SetFont( TRAVERSE_EMAIL_FONT ); SetFontForeground( FONT_RED ); SetFontBackground( FONT_BLACK ); - + // print previous string - mprintf( PREVIOUS_PAGE_X, PREVIOUS_PAGE_Y, pTraverseStrings[PREVIOUS_PAGE] ); + mprintf( PREVIOUS_PAGE_X, PREVIOUS_PAGE_Y, pTraverseStrings[PREVIOUS_PAGE] ); } // less than last page, so there is a next page - if(iCurrentPage uiFlags & BUTTON_ENABLED)) +{ + + if (!(btn->uiFlags & BUTTON_ENABLED)) return; if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - { + { } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if(btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - - // not on last page, move ahead one + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + // not on last page, move ahead one if(iCurrentPage uiFlags & BUTTON_ENABLED)) + if (!(btn->uiFlags & BUTTON_ENABLED)) return; if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - { + { } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { @@ -2329,36 +2311,36 @@ void BtnPreviousEmailPageCallback(GUI_BUTTON *btn,INT32 reason) { giMessagePage--; } - + btn->uiFlags&=~(BUTTON_CLICKED_ON); - + fReDraw=TRUE; RenderEmail(); MarkButtonsDirty( ); } - } - else if (reason & MSYS_CALLBACK_REASON_RBUTTON_UP) - { - // nothing yet - } + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + // nothing yet + } } void BtnNextEmailPageCallback(GUI_BUTTON *btn,INT32 reason) { - if (!(btn->uiFlags & BUTTON_ENABLED)) + if (!(btn->uiFlags & BUTTON_ENABLED)) return; if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - { + { } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { - // not on last page, move ahead one + // not on last page, move ahead one btn->uiFlags&=~(BUTTON_CLICKED_ON); if( ( giNumberOfPagesToCurrentEmail - 1 ) <= giMessagePage ) @@ -2366,7 +2348,7 @@ void BtnNextEmailPageCallback(GUI_BUTTON *btn,INT32 reason) return; } - if( ! ( fOnLastPageFlag ) ) + if( ! ( fOnLastPageFlag ) ) { if( ( giNumberOfPagesToCurrentEmail - 1 ) > ( giMessagePage + 1 ) ) giMessagePage++; @@ -2374,31 +2356,31 @@ void BtnNextEmailPageCallback(GUI_BUTTON *btn,INT32 reason) MarkButtonsDirty( ); fReDrawScreenFlag = TRUE; - } - else if (reason & MSYS_CALLBACK_REASON_RBUTTON_UP) - { - // nothing yet - } + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + // nothing yet + } } void PreviousRegionButtonCallback(GUI_BUTTON *btn,INT32 reason) -{ +{ if (!(btn->uiFlags & BUTTON_ENABLED)) return; if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - { + { } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if(btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); // if we are not on forst page, more back one if(iCurrentPage>0) { @@ -2411,9 +2393,9 @@ void PreviousRegionButtonCallback(GUI_BUTTON *btn,INT32 reason) } else if (reason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - // nothing yet + // nothing yet } - + } @@ -2425,17 +2407,17 @@ void BtnDeleteNoback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - { + { } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if(btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - fDeleteMailFlag=FALSE; - fReDrawScreenFlag=TRUE; + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fDeleteMailFlag=FALSE; + fReDrawScreenFlag=TRUE; } } } @@ -2449,18 +2431,18 @@ void BtnDeleteYesback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - { + { } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if(btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - fReDrawScreenFlag=TRUE; - DeleteEmail(); - + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fReDrawScreenFlag=TRUE; + DeleteEmail(); + } } } @@ -2472,14 +2454,14 @@ void CreateDestroyNextPreviousRegions() if(fCreated) { // destroy already create next, previous mouse regions - fCreated=FALSE; - + fCreated=FALSE; + RemoveButton( giMailPageButtons[ 1 ] ); UnloadButtonImage( giMailPageButtonsImage[ 1 ] ); RemoveButton( giMailPageButtons[ 0 ] ); UnloadButtonImage( giMailPageButtonsImage[ 0 ] ); - + } else { @@ -2490,16 +2472,16 @@ void CreateDestroyNextPreviousRegions() /* // ' next' region - MSYS_DefineRegion(&pEmailMoveRegions[NEXT_BUTTON],NEXT_PAGE_X, NEXT_PAGE_Y,(INT16) (NEXT_PAGE_X+NEXT_WIDTH), (INT16)(NEXT_PAGE_Y+NEXT_HEIGHT), + MSYS_DefineRegion(&pEmailMoveRegions[NEXT_BUTTON],NEXT_PAGE_X, NEXT_PAGE_Y,(INT16) (NEXT_PAGE_X+NEXT_WIDTH), (INT16)(NEXT_PAGE_Y+NEXT_HEIGHT), MSYS_PRIORITY_NORMAL+2,MSYS_NO_CURSOR, MSYS_NO_CALLBACK, NextRegionButtonCallback); - + // ' previous ' region - MSYS_DefineRegion(&pEmailMoveRegions[PREVIOUS_BUTTON],PREVIOUS_PAGE_X,PREVIOUS_PAGE_Y, (INT16)(PREVIOUS_PAGE_X+PREVIOUS_WIDTH),(INT16)(PREVIOUS_PAGE_Y+PREVIOUS_HEIGHT), + MSYS_DefineRegion(&pEmailMoveRegions[PREVIOUS_BUTTON],PREVIOUS_PAGE_X,PREVIOUS_PAGE_Y, (INT16)(PREVIOUS_PAGE_X+PREVIOUS_WIDTH),(INT16)(PREVIOUS_PAGE_Y+PREVIOUS_HEIGHT), MSYS_PRIORITY_NORMAL+2,MSYS_NO_CURSOR, MSYS_NO_CALLBACK, PreviousRegionButtonCallback ); - + // add regions MSYS_AddRegion(&pEmailMoveRegions[PREVIOUS_BUTTON]); - MSYS_AddRegion(&pEmailMoveRegions[NEXT_BUTTON]); + MSYS_AddRegion(&pEmailMoveRegions[NEXT_BUTTON]); */ } } @@ -2509,44 +2491,44 @@ void ReDraw() // forces update of entire laptop screen if(fReDraw) { - RenderLaptop( ); - //EnterNewLaptopMode(); - DrawLapTopText(); - ReDrawHighLight(); - MarkButtonsDirty( ); - fReDraw=FALSE; + RenderLaptop( ); + //EnterNewLaptopMode(); + DrawLapTopText(); + ReDrawHighLight(); + MarkButtonsDirty( ); + fReDraw=FALSE; } - + } void CreateDestroyDeleteNoticeMailButton() { - static BOOLEAN fOldDeleteMailFlag=FALSE; + static BOOLEAN fOldDeleteMailFlag=FALSE; if((fDeleteMailFlag)&&(!fOldDeleteMailFlag)) { - // confirm delete email buttons + // confirm delete email buttons - // YES button - fOldDeleteMailFlag=TRUE; + // YES button + fOldDeleteMailFlag=TRUE; giDeleteMailButtonImage[0]=LoadButtonImage( "LAPTOP\\YesNoButtons.sti" ,-1,0,-1,1,-1 ); - giDeleteMailButton[0]= QuickCreateButton( giDeleteMailButtonImage[0], NEW_BTN_X+1, NEW_BTN_Y, + giDeleteMailButton[0]= QuickCreateButton( giDeleteMailButtonImage[0], NEW_BTN_X+1, NEW_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 2, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnDeleteYesback); - + // NO button giDeleteMailButtonImage[1]=LoadButtonImage( "LAPTOP\\YesNoButtons.sti" ,-1,2,-1,3,-1 ); - giDeleteMailButton[1]= QuickCreateButton( giDeleteMailButtonImage[1], NEW_BTN_X+40, NEW_BTN_Y, + giDeleteMailButton[1]= QuickCreateButton( giDeleteMailButtonImage[1], NEW_BTN_X+40, NEW_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 2, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnDeleteNoback); - + // set up cursors SetButtonCursor(giDeleteMailButton[0], CURSOR_LAPTOP_SCREEN); - SetButtonCursor(giDeleteMailButton[1], CURSOR_LAPTOP_SCREEN); - + SetButtonCursor(giDeleteMailButton[1], CURSOR_LAPTOP_SCREEN); + // set up screen mask to prevent other actions while delete mail box is destroyed MSYS_DefineRegion(&pDeleteScreenMask,0, 0,SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST-3,CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, LapTopScreenCallBack); - MSYS_AddRegion(&pDeleteScreenMask); + MSYS_AddRegion(&pDeleteScreenMask); // force update fReDrawScreenFlag = TRUE; @@ -2555,31 +2537,31 @@ void CreateDestroyDeleteNoticeMailButton() else if((!fDeleteMailFlag)&&(fOldDeleteMailFlag)) { - // clear out the buttons and screen mask - fOldDeleteMailFlag=FALSE; - RemoveButton( giDeleteMailButton[0] ); - UnloadButtonImage( giDeleteMailButtonImage[0] ); - RemoveButton( giDeleteMailButton[1] ); - UnloadButtonImage( giDeleteMailButtonImage[1] ); - - // the region - MSYS_RemoveRegion(&pDeleteScreenMask); - - // force refresh - fReDrawScreenFlag=TRUE; - + // clear out the buttons and screen mask + fOldDeleteMailFlag=FALSE; + RemoveButton( giDeleteMailButton[0] ); + UnloadButtonImage( giDeleteMailButtonImage[0] ); + RemoveButton( giDeleteMailButton[1] ); + UnloadButtonImage( giDeleteMailButtonImage[1] ); + + // the region + MSYS_RemoveRegion(&pDeleteScreenMask); + + // force refresh + fReDrawScreenFlag=TRUE; + } return; } BOOLEAN DisplayDeleteNotice(EmailPtr pMail) { - + HVOBJECT hHandle; // will display a delete mail box whenever delete mail has arrived if(!fDeleteMailFlag) return(FALSE); - + if( !fReDrawScreenFlag ) { // no redraw flag, leave @@ -2593,13 +2575,13 @@ BOOLEAN DisplayDeleteNotice(EmailPtr pMail) } - // load graphics - - GetVideoObject(&hHandle, guiEmailWarning); - BltVideoObject(FRAME_BUFFER, hHandle, 0,EMAIL_WARNING_X, EMAIL_WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); - - - // font stuff + // load graphics + + GetVideoObject(&hHandle, guiEmailWarning); + BltVideoObject(FRAME_BUFFER, hHandle, 0,EMAIL_WARNING_X, EMAIL_WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + + // font stuff SetFont( EMAIL_HEADER_FONT ); SetFontForeground( FONT_WHITE ); SetFontBackground( FONT_BLACK ); @@ -2607,31 +2589,31 @@ BOOLEAN DisplayDeleteNotice(EmailPtr pMail) // the icon for the title of this box GetVideoObject( &hHandle, guiTITLEBARICONS ); - BltVideoObject( FRAME_BUFFER, hHandle, 0,EMAIL_WARNING_X + 5, EMAIL_WARNING_Y + 2, VO_BLT_SRCTRANSPARENCY,NULL ); - - // title + BltVideoObject( FRAME_BUFFER, hHandle, 0,EMAIL_WARNING_X + 5, EMAIL_WARNING_Y + 2, VO_BLT_SRCTRANSPARENCY,NULL ); + + // title mprintf(EMAIL_WARNING_X + 30, EMAIL_WARNING_Y + 8, pEmailTitleText[0] ); - + // shadow, font, and foreground SetFontShadow( NO_SHADOW ); SetFont( EMAIL_WARNING_FONT ); - SetFontForeground( FONT_BLACK ); + SetFontForeground( FONT_BLACK ); // draw text based on mail being read or not if((pMail->fRead)) - mprintf(EMAIL_WARNING_X + 95 , EMAIL_WARNING_Y + 65,pDeleteMailStrings[0]); - else - mprintf(EMAIL_WARNING_X + 70, EMAIL_WARNING_Y + 65,pDeleteMailStrings[1]); - - + mprintf(EMAIL_WARNING_X + 95 , EMAIL_WARNING_Y + 65,pDeleteMailStrings[0]); + else + mprintf(EMAIL_WARNING_X + 70, EMAIL_WARNING_Y + 65,pDeleteMailStrings[1]); + + // invalidate screen area, for refresh - + if( ! fNewMailFlag ) { // draw buttons - MarkButtonsDirty( ); - InvalidateRegion(EMAIL_WARNING_X, EMAIL_WARNING_Y ,EMAIL_WARNING_X+EMAIL_WARNING_WIDTH,EMAIL_WARNING_Y+EMAIL_WARNING_HEIGHT); - } + MarkButtonsDirty( ); + InvalidateRegion(EMAIL_WARNING_X, EMAIL_WARNING_Y ,EMAIL_WARNING_X+EMAIL_WARNING_WIDTH,EMAIL_WARNING_Y+EMAIL_WARNING_HEIGHT); + } // reset font shadow SetFontShadow(DEFAULT_SHADOW); @@ -2640,168 +2622,168 @@ BOOLEAN DisplayDeleteNotice(EmailPtr pMail) } void DeleteEmail() -{ - +{ + // error check, invalid mail, or not time to delete mail if( fDeleteInternal != TRUE ) { - if((iDeleteId==-1)||(!fDeleteMailFlag)) - return; + if((iDeleteId==-1)||(!fDeleteMailFlag)) + return; } - // remove the message - RemoveEmailMessage(iDeleteId); + // remove the message + RemoveEmailMessage(iDeleteId); - // stop displaying message, if so - fDisplayMessageFlag = FALSE; + // stop displaying message, if so + fDisplayMessageFlag = FALSE; - // upadte list - PlaceMessagesinPages(); - - // redraw icons (if deleted message was last unread, remove checkmark) - DrawLapTopIcons(); - - // if all of a sudden we are beyond last page, move back one - if(iCurrentPage > iLastPage) - iCurrentPage=iLastPage; + // upadte list + PlaceMessagesinPages(); - // rerender mail list - RenderEmail(); + // redraw icons (if deleted message was last unread, remove checkmark) + DrawLapTopIcons(); - // nolong time to delete mail - fDeleteMailFlag=FALSE; - fReDrawScreenFlag=TRUE; - // refresh screen (get rid of dialog box image) - //ReDraw(); + // if all of a sudden we are beyond last page, move back one + if(iCurrentPage > iLastPage) + iCurrentPage=iLastPage; - // invalidate - InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); + // rerender mail list + RenderEmail(); + + // nolong time to delete mail + fDeleteMailFlag=FALSE; + fReDrawScreenFlag=TRUE; + // refresh screen (get rid of dialog box image) + //ReDraw(); + + // invalidate + InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); } void FromCallback(GUI_BUTTON *btn, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { return; } if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) { - - // sort messages based on sender name, then replace into pages of email + + // sort messages based on sender name, then replace into pages of email fSortSenderUpwards = !fSortSenderUpwards; - SortMessages(SENDER); + SortMessages(SENDER); - //SpecifyButtonIcon( giSortButton[1] , giArrowsForEmail, UINT16 usVideoObjectIndex, INT8 bXOffset, INT8 bYOffset, TRUE ); + //SpecifyButtonIcon( giSortButton[1] , giArrowsForEmail, UINT16 usVideoObjectIndex, INT8 bXOffset, INT8 bYOffset, TRUE ); fJustStartedEmail = FALSE; PlaceMessagesinPages(); - btn->uiFlags&= ~(BUTTON_CLICKED_ON); + btn->uiFlags&= ~(BUTTON_CLICKED_ON); } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - // nothing yet + // nothing yet } - + } void SubjectCallback(GUI_BUTTON *btn, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { return; } if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) { - // sort message on subject and reorder list + // sort message on subject and reorder list fSortSubjectUpwards = !fSortSubjectUpwards; - SortMessages(SUBJECT); + SortMessages(SUBJECT); fJustStartedEmail = FALSE; PlaceMessagesinPages(); - - btn->uiFlags&= ~(BUTTON_CLICKED_ON); + + btn->uiFlags&= ~(BUTTON_CLICKED_ON); } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - // nothing yet + // nothing yet } - + } void BtnDeleteCallback(GUI_BUTTON *btn, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { return; } if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) { - - btn->uiFlags&= ~(BUTTON_CLICKED_ON); - iDeleteId = giMessageId; - fDeleteMailFlag = TRUE; - + + btn->uiFlags&= ~(BUTTON_CLICKED_ON); + iDeleteId = giMessageId; + fDeleteMailFlag = TRUE; + } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - // nothing yet + // nothing yet } - + } void DateCallback(GUI_BUTTON *btn, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { return; } if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) { - // sort messages based on date recieved and reorder lsit + // sort messages based on date recieved and reorder lsit fSortDateUpwards = !fSortDateUpwards; - SortMessages(RECEIVED); + SortMessages(RECEIVED); PlaceMessagesinPages(); fJustStartedEmail = FALSE; - btn->uiFlags&= ~(BUTTON_CLICKED_ON); + btn->uiFlags&= ~(BUTTON_CLICKED_ON); } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - // nothing yet + // nothing yet } - + } void ReadCallback(GUI_BUTTON *btn, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { return; } if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) { - // sort messages based on date recieved and reorder lsit - SortMessages(READ); + // sort messages based on date recieved and reorder lsit + SortMessages(READ); PlaceMessagesinPages(); fJustStartedEmail = FALSE; - btn->uiFlags&= ~(BUTTON_CLICKED_ON); + btn->uiFlags&= ~(BUTTON_CLICKED_ON); } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - // nothing yet + // nothing yet } - + } @@ -2812,25 +2794,25 @@ void SetUpSortRegions() return; // will set up sort mail regions - + // from region - /* + /* MSYS_DefineRegion(&pSortMailRegions[0],FROM_BOX_X ,FROM_BOX_Y, FROM_BOX_X+FROM_BOX_WIDTH ,FROM_BOX_Y+TOP_HEIGHT, MSYS_PRIORITY_NORMAL+2,MSYS_NO_CURSOR,MSYS_NO_CALLBACK, FromCallback ); - + // subject region MSYS_DefineRegion(&pSortMailRegions[1],SUBJECT_X ,FROM_BOX_Y, SUBJECT_BOX_X+SUBJECT_WIDTH ,FROM_BOX_Y+TOP_HEIGHT, MSYS_PRIORITY_NORMAL+2,MSYS_NO_CURSOR,MSYS_NO_CALLBACK, SubjectCallback ); - + // date region MSYS_DefineRegion(&pSortMailRegions[2],DATE_X ,FROM_BOX_Y, DATE_BOX_X+DATE_WIDTH ,FROM_BOX_Y+TOP_HEIGHT, MSYS_PRIORITY_NORMAL+2,MSYS_NO_CURSOR,MSYS_NO_CALLBACK, DateCallback ); - + //add regions MSYS_AddRegion(&pSortMailRegions[0]); - MSYS_AddRegion(&pSortMailRegions[1]); - MSYS_AddRegion(&pSortMailRegions[2]); - + MSYS_AddRegion(&pSortMailRegions[1]); + MSYS_AddRegion(&pSortMailRegions[2]); + return; */ } @@ -2854,78 +2836,78 @@ void DisplayTextOnTitleBar( void ) // draw email screen title text // font stuff - SetFont( EMAIL_TITLE_FONT ); - SetFontForeground( FONT_WHITE ); + SetFont( EMAIL_TITLE_FONT ); + SetFontForeground( FONT_WHITE ); SetFontBackground( FONT_BLACK ); - + // printf the title mprintf( EMAIL_TITLE_X, EMAIL_TITLE_Y, pEmailTitleText[0] ); - + // reset the shadow - + } void DestroyMailScreenButtons( void ) { - // this function will destory the buttons used in the email screen + // this function will destory the buttons used in the email screen // the sort email buttons - RemoveButton( giSortButton[0] ); - UnloadButtonImage( giSortButtonImage[0] ); - RemoveButton( giSortButton[1] ); - UnloadButtonImage( giSortButtonImage[1] ); - RemoveButton( giSortButton[2] ); - UnloadButtonImage( giSortButtonImage[2] ); - RemoveButton( giSortButton[3] ); - UnloadButtonImage( giSortButtonImage[3] ); + RemoveButton( giSortButton[0] ); + UnloadButtonImage( giSortButtonImage[0] ); + RemoveButton( giSortButton[1] ); + UnloadButtonImage( giSortButtonImage[1] ); + RemoveButton( giSortButton[2] ); + UnloadButtonImage( giSortButtonImage[2] ); + RemoveButton( giSortButton[3] ); + UnloadButtonImage( giSortButtonImage[3] ); return; } void CreateMailScreenButtons( void ) { - + // create sort buttons, right now - not finished // read sort - giSortButtonImage[0]= LoadButtonImage( "LAPTOP\\mailbuttons.sti" ,-1,0,-1,4,-1 ); + giSortButtonImage[0]= LoadButtonImage( "LAPTOP\\mailbuttons.sti" ,-1,0,-1,4,-1 ); giSortButton[0] = QuickCreateButton( giSortButtonImage[0], ENVELOPE_BOX_X, FROM_BOX_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)ReadCallback); SetButtonCursor(giSortButton[0], CURSOR_LAPTOP_SCREEN); - + // subject sort - giSortButtonImage[1]= LoadButtonImage( "LAPTOP\\mailbuttons.sti" ,-1,1,-1,5,-1 ); + giSortButtonImage[1]= LoadButtonImage( "LAPTOP\\mailbuttons.sti" ,-1,1,-1,5,-1 ); giSortButton[1] = QuickCreateButton( giSortButtonImage[1], FROM_BOX_X, FROM_BOX_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)FromCallback); SetButtonCursor(giSortButton[1], CURSOR_LAPTOP_SCREEN); - SpecifyFullButtonTextAttributes( giSortButton[1], pEmailHeaders[FROM_HEADER], EMAIL_WARNING_FONT, - FONT_BLACK, FONT_BLACK, + SpecifyFullButtonTextAttributes( giSortButton[1], pEmailHeaders[FROM_HEADER], EMAIL_WARNING_FONT, + FONT_BLACK, FONT_BLACK, FONT_BLACK, FONT_BLACK, TEXT_CJUSTIFIED ); // sender sort - giSortButtonImage[2]= LoadButtonImage( "LAPTOP\\mailbuttons.sti" ,-1,2,-1,6,-1 ); + giSortButtonImage[2]= LoadButtonImage( "LAPTOP\\mailbuttons.sti" ,-1,2,-1,6,-1 ); giSortButton[2] = QuickCreateButton( giSortButtonImage[2], SUBJECT_BOX_X, FROM_BOX_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)SubjectCallback ); SetButtonCursor(giSortButton[2], CURSOR_LAPTOP_SCREEN); SpecifyFullButtonTextAttributes( giSortButton[2], pEmailHeaders[SUBJECT_HEADER], EMAIL_WARNING_FONT, - FONT_BLACK, FONT_BLACK, + FONT_BLACK, FONT_BLACK, FONT_BLACK, FONT_BLACK, TEXT_CJUSTIFIED ); // date sort - giSortButtonImage[3]= LoadButtonImage( "LAPTOP\\mailbuttons.sti" ,-1,3,-1,7,-1 ); + giSortButtonImage[3]= LoadButtonImage( "LAPTOP\\mailbuttons.sti" ,-1,3,-1,7,-1 ); giSortButton[3] = QuickCreateButton( giSortButtonImage[3], DATE_BOX_X, FROM_BOX_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)DateCallback); SetButtonCursor(giSortButton[3], CURSOR_LAPTOP_SCREEN); SpecifyFullButtonTextAttributes( giSortButton[3], pEmailHeaders[RECD_HEADER], EMAIL_WARNING_FONT, - FONT_BLACK, FONT_BLACK, + FONT_BLACK, FONT_BLACK, FONT_BLACK, FONT_BLACK, TEXT_CJUSTIFIED ); @@ -2937,45 +2919,45 @@ void DisplayEmailMessageSubjectDateFromLines( EmailPtr pMail , INT32 iViewerY) { // this procedure will draw the title/headers to From, Subject, Date fields in the display // message box - INT16 usX, usY; - CHAR16 sString[100]; + INT16 usX, usY; + CHAR16 sString[100]; - // font stuff + // font stuff SetFont(MESSAGE_FONT); SetFontForeground(FONT_BLACK); SetFontBackground(FONT_BLACK); SetFontShadow(NO_SHADOW); - - // all headers, but not info are right justified - - // print from - FindFontRightCoordinates( MESSAGE_HEADER_X-20, ( INT16 ) ( MESSAGE_FROM_Y + (INT16)iViewerY ) , MESSAGE_HEADER_WIDTH, ( INT16 ) ( MESSAGE_FROM_Y + GetFontHeight ( MESSAGE_FONT ) ) ,pEmailHeaders[0] ,MESSAGE_FONT, &usX, &usY); + + // all headers, but not info are right justified + + // print from + FindFontRightCoordinates( MESSAGE_HEADER_X-20, ( INT16 ) ( MESSAGE_FROM_Y + (INT16)iViewerY ) , MESSAGE_HEADER_WIDTH, ( INT16 ) ( MESSAGE_FROM_Y + GetFontHeight ( MESSAGE_FONT ) ) ,pEmailHeaders[0] ,MESSAGE_FONT, &usX, &usY); mprintf( usX, MESSAGE_FROM_Y + (UINT16)iViewerY, pEmailHeaders[0]); - + // the actual from info mprintf( MESSAGE_HEADER_X+MESSAGE_HEADER_WIDTH-13, MESSAGE_FROM_Y + iViewerY, pSenderNameList[pMail->ubSender]); - // print date - FindFontRightCoordinates( MESSAGE_HEADER_X+168, ( INT16 ) ( MESSAGE_DATE_Y + (UINT16)iViewerY ), MESSAGE_HEADER_WIDTH, ( INT16 ) ( MESSAGE_DATE_Y + GetFontHeight ( MESSAGE_FONT ) ) ,pEmailHeaders[2] ,MESSAGE_FONT, &usX, &usY); + // print date + FindFontRightCoordinates( MESSAGE_HEADER_X+168, ( INT16 ) ( MESSAGE_DATE_Y + (UINT16)iViewerY ), MESSAGE_HEADER_WIDTH, ( INT16 ) ( MESSAGE_DATE_Y + GetFontHeight ( MESSAGE_FONT ) ) ,pEmailHeaders[2] ,MESSAGE_FONT, &usX, &usY); mprintf( usX, MESSAGE_DATE_Y+ (UINT16)iViewerY , pEmailHeaders[2]); - + // the actual date info swprintf(sString, L"%d", ( ( pMail->iDate ) / ( 24 * 60) ) ); mprintf( MESSAGE_HEADER_X+235, MESSAGE_DATE_Y + (UINT16)iViewerY, sString); - - + + // print subject - FindFontRightCoordinates( MESSAGE_HEADER_X-20, MESSAGE_SUBJECT_Y , MESSAGE_HEADER_WIDTH, ( INT16 ) (MESSAGE_SUBJECT_Y + GetFontHeight ( MESSAGE_FONT )),pEmailHeaders[1] ,MESSAGE_FONT, &usX, &usY); + FindFontRightCoordinates( MESSAGE_HEADER_X-20, MESSAGE_SUBJECT_Y , MESSAGE_HEADER_WIDTH, ( INT16 ) (MESSAGE_SUBJECT_Y + GetFontHeight ( MESSAGE_FONT )),pEmailHeaders[1] ,MESSAGE_FONT, &usX, &usY); mprintf( usX, MESSAGE_SUBJECT_Y + (UINT16)iViewerY, pEmailHeaders[1]); - + // the actual subject info //mprintf( , MESSAGE_SUBJECT_Y, pMail->pSubject); IanDisplayWrappedString(SUBJECT_LINE_X+2, (INT16) ( SUBJECT_LINE_Y+2 + (UINT16)iViewerY ), SUBJECT_LINE_WIDTH, MESSAGE_GAP, MESSAGE_FONT, MESSAGE_COLOR,pMail->pSubject,0,FALSE,0); - + // reset shadow SetFontShadow(DEFAULT_SHADOW); @@ -2985,30 +2967,30 @@ void DisplayEmailMessageSubjectDateFromLines( EmailPtr pMail , INT32 iViewerY) void DrawEmailMessageDisplayTitleText( INT32 iViewerY ) { - // this procedure will display the title of the email message display box + // this procedure will display the title of the email message display box // font stuff - SetFont( EMAIL_HEADER_FONT ); + SetFont( EMAIL_HEADER_FONT ); SetFontForeground( FONT_WHITE ); SetFontBackground( FONT_BLACK ); // dsiplay mail viewer title on message viewer - mprintf( VIEWER_X + 30, VIEWER_Y + 8 + (UINT16) iViewerY, pEmailTitleText[0] ); + mprintf( VIEWER_X + 30, VIEWER_Y + 8 + (UINT16) iViewerY, pEmailTitleText[0] ); - return; + return; } - + void DrawLineDividers( void ) { - // this function draws divider lines between lines of text + // this function draws divider lines between lines of text INT32 iCounter=0; - HVOBJECT hHandle; - + HVOBJECT hHandle; + for(iCounter=1; iCounter < 19; iCounter++) { - GetVideoObject( &hHandle, guiMAILDIVIDER ); - BltVideoObject(FRAME_BUFFER, hHandle, 0,INDIC_X-10, (MIDDLE_Y+iCounter*MIDDLE_WIDTH - 1), VO_BLT_SRCTRANSPARENCY,NULL); - } + GetVideoObject( &hHandle, guiMAILDIVIDER ); + BltVideoObject(FRAME_BUFFER, hHandle, 0,INDIC_X-10, (MIDDLE_Y+iCounter*MIDDLE_WIDTH - 1), VO_BLT_SRCTRANSPARENCY,NULL); + } return; @@ -3017,21 +2999,21 @@ void DrawLineDividers( void ) void ClearOutEmailMessageRecordsList( void ) { - RecordPtr pTempRecord; + RecordPtr pTempRecord; INT32 iCounter = 0; // runt hrough list freeing records up - while(pMessageRecordList) + while(pMessageRecordList) { - // set temp to current - pTempRecord = pMessageRecordList; - + // set temp to current + pTempRecord = pMessageRecordList; + // next element - pMessageRecordList = pMessageRecordList -> Next; + pMessageRecordList = pMessageRecordList->Next; MemFree( pTempRecord ); } - + for( iCounter = 0; iCounter < MAX_NUMBER_EMAIL_PAGES; iCounter++ ) { pEmailPageInfo[ iCounter ].pFirstRecord = NULL; @@ -3047,38 +3029,38 @@ void ClearOutEmailMessageRecordsList( void ) void AddEmailRecordToList( STR16 pString ) { - RecordPtr pTempRecord; - + RecordPtr pTempRecord; + // set to head of list pTempRecord=pMessageRecordList; - + if(!pTempRecord) { - + // list empty, set this node to head pTempRecord = (RecordPtr) MemAlloc( sizeof(Record)); pMessageRecordList = pTempRecord; } - else + else { - // run to end of list - while(pTempRecord -> Next) + // run to end of list + while(pTempRecord->Next) { - pTempRecord = pTempRecord -> Next; + pTempRecord = pTempRecord->Next; } // found, alloc - pTempRecord -> Next = (messagerecord *) MemAlloc( sizeof(Record) ); - + pTempRecord->Next = (messagerecord *) MemAlloc( sizeof(Record) ); + // move to node - pTempRecord = pTempRecord -> Next; - } + pTempRecord = pTempRecord->Next; + } // set next to null - pTempRecord -> Next = NULL; + pTempRecord->Next = NULL; // copy in string - wcscpy( pTempRecord -> pRecord, pString ); + wcscpy( pTempRecord->pRecord, pString ); // done return @@ -3092,12 +3074,12 @@ void UpDateMessageRecordList( void ) // simply checks to see if old and new message ids are the same, if so, do nothing // otherwise clear list - - if( giMessageId != giPrevMessageId ) + + if( giMessageId != giPrevMessageId ) { // if chenged, clear list - ClearOutEmailMessageRecordsList( ); - + ClearOutEmailMessageRecordsList( ); + // set prev to current giPrevMessageId = giMessageId; } @@ -3113,18 +3095,18 @@ void HandleAnySpecialEmailMessageEvents(INT32 iMessageId ) { case( IMP_EMAIL_AGAIN ): - SetBookMark(IMP_BOOKMARK); + SetBookMark(IMP_BOOKMARK); break; - case( IMP_EMAIL_INTRO ): - SetBookMark(IMP_BOOKMARK); + case( IMP_EMAIL_INTRO ): + SetBookMark(IMP_BOOKMARK); break; } } void ReDisplayBoxes( void ) { - - + + // the email message itself @@ -3137,20 +3119,20 @@ void ReDisplayBoxes( void ) if(fDeleteMailFlag) { // delete message, redisplay - DisplayDeleteNotice(GetEmailMessage(iDeleteId)); + DisplayDeleteNotice(GetEmailMessage(iDeleteId)); } if(fNewMailFlag) { // if new mail, redisplay box - DisplayNewMailBox( ); + DisplayNewMailBox( ); } } BOOLEAN HandleMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr pMail ) { - BOOLEAN fSpecialCase = FALSE; + BOOLEAN fSpecialCase = FALSE; // this procedure will handle special cases of email messages that are not stored in email.edt, or need special processing switch( usMessageId ) @@ -3158,7 +3140,7 @@ BOOLEAN HandleMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr case( IMP_EMAIL_PROFILE_RESULTS ): HandleIMPCharProfileResultsMessage( ); - fSpecialCase = TRUE; + fSpecialCase = TRUE; break; case( MERC_INTRO ): @@ -3199,20 +3181,20 @@ BOOLEAN HandleMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr -#define IMP_RESULTS_INTRO_LENGTH 9 +#define IMP_RESULTS_INTRO_LENGTH 9 #define IMP_RESULTS_PERSONALITY_INTRO IMP_RESULTS_INTRO_LENGTH // 0 - 9 #define IMP_RESULTS_PERSONALITY_INTRO_LENGTH 5 #define IMP_PERSONALITY_NORMAL IMP_RESULTS_PERSONALITY_INTRO + IMP_RESULTS_PERSONALITY_INTRO_LENGTH // 14 - 18 #define IMP_PERSONALITY_LENGTH 4 #define IMP_PERSONALITY_HEAT IMP_PERSONALITY_NORMAL + IMP_PERSONALITY_LENGTH // 19 - 22 -#define IMP_PERSONALITY_NERVOUS IMP_PERSONALITY_HEAT + IMP_PERSONALITY_LENGTH // 23 - 26 +#define IMP_PERSONALITY_NERVOUS IMP_PERSONALITY_HEAT + IMP_PERSONALITY_LENGTH // 23 - 26 #define IMP_PERSONALITY_CLAUSTROPHOBIC IMP_PERSONALITY_NERVOUS + IMP_PERSONALITY_LENGTH // 27 - 30 #define IMP_PERSONALITY_NONSWIMMER IMP_PERSONALITY_CLAUSTROPHOBIC + IMP_PERSONALITY_LENGTH // 31 - 34 #define IMP_PERSONALITY_FEAR_OF_INSECTS IMP_PERSONALITY_NONSWIMMER + IMP_PERSONALITY_LENGTH #define IMP_PERSONALITY_FORGETFUL IMP_PERSONALITY_FEAR_OF_INSECTS + IMP_PERSONALITY_LENGTH + 1 #define IMP_PERSONALITY_PSYCHO IMP_PERSONALITY_FORGETFUL + IMP_PERSONALITY_LENGTH -#define IMP_RESULTS_ATTITUDE_INTRO IMP_PERSONALITY_PSYCHO + IMP_PERSONALITY_LENGTH + 1 +#define IMP_RESULTS_ATTITUDE_INTRO IMP_PERSONALITY_PSYCHO + IMP_PERSONALITY_LENGTH + 1 #define IMP_RESULTS_ATTITUDE_LENGTH 5 #define IMP_ATTITUDE_LENGTH 5 #define IMP_ATTITUDE_NORMAL IMP_RESULTS_ATTITUDE_INTRO + IMP_RESULTS_ATTITUDE_LENGTH @@ -3225,12 +3207,12 @@ BOOLEAN HandleMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr #define IMP_ATTITUDE_ASSHOLE IMP_ATTITUDE_ARROGANT + IMP_ATTITUDE_LENGTH + 1 #define IMP_ATTITUDE_COWARD IMP_ATTITUDE_ASSHOLE + IMP_ATTITUDE_LENGTH #define IMP_RESULTS_SKILLS IMP_ATTITUDE_COWARD + IMP_ATTITUDE_LENGTH + 1 -#define IMP_RESULTS_SKILLS_LENGTH 7 -#define IMP_SKILLS_IMPERIAL_SKILLS IMP_RESULTS_SKILLS + IMP_RESULTS_SKILLS_LENGTH + 1 +#define IMP_RESULTS_SKILLS_LENGTH 7 +#define IMP_SKILLS_IMPERIAL_SKILLS IMP_RESULTS_SKILLS + IMP_RESULTS_SKILLS_LENGTH + 1 #define IMP_SKILLS_IMPERIAL_MARK IMP_SKILLS_IMPERIAL_SKILLS + 1 #define IMP_SKILLS_IMPERIAL_MECH IMP_SKILLS_IMPERIAL_SKILLS + 2 #define IMP_SKILLS_IMPERIAL_EXPL IMP_SKILLS_IMPERIAL_SKILLS + 3 -#define IMP_SKILLS_IMPERIAL_MED IMP_SKILLS_IMPERIAL_SKILLS + 4 +#define IMP_SKILLS_IMPERIAL_MED IMP_SKILLS_IMPERIAL_SKILLS + 4 #define IMP_SKILLS_NEED_TRAIN_SKILLS IMP_SKILLS_IMPERIAL_MED + 1 #define IMP_SKILLS_NEED_TRAIN_MARK IMP_SKILLS_NEED_TRAIN_SKILLS + 1 // 119 @@ -3239,10 +3221,10 @@ BOOLEAN HandleMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr #define IMP_SKILLS_NEED_TRAIN_MED IMP_SKILLS_NEED_TRAIN_SKILLS + 4 #define IMP_SKILLS_NO_SKILL IMP_SKILLS_NEED_TRAIN_MED + 1 -#define IMP_SKILLS_NO_SKILL_MARK IMP_SKILLS_NO_SKILL + 1 // 124 -#define IMP_SKILLS_NO_SKILL_MECH IMP_SKILLS_NO_SKILL + 2 -#define IMP_SKILLS_NO_SKILL_EXPL IMP_SKILLS_NO_SKILL + 3 -#define IMP_SKILLS_NO_SKILL_MED IMP_SKILLS_NO_SKILL + 4 // 127 +#define IMP_SKILLS_NO_SKILL_MARK IMP_SKILLS_NO_SKILL + 1 // 124 +#define IMP_SKILLS_NO_SKILL_MECH IMP_SKILLS_NO_SKILL + 2 +#define IMP_SKILLS_NO_SKILL_EXPL IMP_SKILLS_NO_SKILL + 3 +#define IMP_SKILLS_NO_SKILL_MED IMP_SKILLS_NO_SKILL + 4 // 127 #define IMP_SKILLS_SPECIAL_INTRO IMP_SKILLS_NO_SKILL_MED + 1 // 128, 129 #define IMP_SKILLS_SPECIAL_INTRO_LENGTH 2 @@ -3262,8 +3244,8 @@ BOOLEAN HandleMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr // WANNE: These 2 skills are missing in the email! // The problem is, that there is no description in binarydata\impass.edt -#define IMP_SKILLS_SPECIAL_ONROOF IMP_SKILLS_SPECIAL_KNIFE + 1 -#define IMP_SKILLS_SPECIAL_CAMOUFLAGED IMP_SKILLS_SPECIAL_ONROOF + 1 +#define IMP_SKILLS_SPECIAL_SNIPER IMP_SKILLS_SPECIAL_KNIFE + 1 +#define IMP_SKILLS_SPECIAL_CAMOUFLAGED IMP_SKILLS_SPECIAL_SNIPER + 1 #define IMP_RESULTS_PHYSICAL IMP_SKILLS_SPECIAL_KNIFE + 1 #define IMP_RESULTS_PHYSICAL_LENGTH 7 @@ -3277,7 +3259,7 @@ BOOLEAN HandleMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr #define IMP_PHYSICAL_SUPER_STRENGTH IMP_PHYSICAL_SUPER_DEXTERITY + 1 #define IMP_PHYSICAL_SUPER_LEADERSHIP IMP_PHYSICAL_SUPER_STRENGTH + 1 #define IMP_PHYSICAL_SUPER_WISDOM IMP_PHYSICAL_SUPER_LEADERSHIP + 1 - + #define IMP_PHYSICAL_LOW IMP_PHYSICAL_SUPER_WISDOM + 1 #define IMP_PHYSICAL_LOW_LENGTH 1 @@ -3303,7 +3285,7 @@ BOOLEAN HandleMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr #define IMP_PHYSICAL_END IMP_PHYSICAL_VERY_LOW_WISDOM + 1 #define IMP_PHYSICAL_END_LENGTH 3 -#define IMP_RESULTS_PORTRAIT IMP_PHYSICAL_END + IMP_PHYSICAL_END_LENGTH +#define IMP_RESULTS_PORTRAIT IMP_PHYSICAL_END + IMP_PHYSICAL_END_LENGTH #define IMP_RESULTS_PORTRAIT_LENGTH 6 @@ -3320,32 +3302,27 @@ BOOLEAN HandleMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr #define IMP_PORTRAIT_FEMALE_4 IMP_PORTRAIT_FEMALE_3 + 4 #define IMP_PORTRAIT_FEMALE_5 IMP_PORTRAIT_FEMALE_4 + 4 #define IMP_PORTRAIT_FEMALE_6 IMP_PORTRAIT_FEMALE_5 + 4 - + #define IMP_RESULTS_END IMP_PORTRAIT_FEMALE_6 + 1 #define IMP_RESULTS_END_LENGTH 3 void HandleIMPCharProfileResultsMessage( void) { - // special case, IMP profile return - INT32 iTotalHeight=0; - INT32 iCnt=0; + // special case, IMP profile return INT32 iHeight=0; INT32 iCounter=0; // CHAR16 pString[MAIL_STRING_SIZE/2 + 1]; CHAR16 pString[MAIL_STRING_SIZE]; INT32 iOffSet=0; - INT32 iViewerY=0; - INT32 iHeightTemp=0; - INT32 iHeightSoFar = 0; RecordPtr pTempRecord; - INT32 iEndOfSection =0; - INT32 iRand = 0; + INT32 iEndOfSection =0; + INT32 iRand = 0; BOOLEAN fSufficientMechSkill = FALSE, fSufficientMarkSkill = FALSE, fSufficientMedSkill = FALSE, fSufficientExplSkill = FALSE; - BOOLEAN fSufficientHlth = FALSE, fSufficientStr = FALSE, fSufficientWis = FALSE, fSufficientAgi = FALSE, fSufficientDex = FALSE, fSufficientLdr = FALSE; - + BOOLEAN fSufficientHlth = FALSE, fSufficientStr = FALSE, fSufficientWis = FALSE, fSufficientAgi = FALSE, fSufficientDex = FALSE, fSufficientLdr = FALSE; + INT16 iCurrentIMPSlot = -1; - + iRand = Random( 32767 ); // set record ptr to head of list @@ -3355,17 +3332,17 @@ void HandleIMPCharProfileResultsMessage( void) iHeight+=GetFontHeight( MESSAGE_FONT ); // load intro - iEndOfSection = IMP_RESULTS_INTRO_LENGTH; - + iEndOfSection = IMP_RESULTS_INTRO_LENGTH; + // list doesn't exist, reload if( !pTempRecord ) - { + { - while(iEndOfSection > iCounter) + while(iEndOfSection > iCounter) { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); - + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + // have to place players name into string for first record if( iCounter == 0) { @@ -3376,42 +3353,42 @@ void HandleIMPCharProfileResultsMessage( void) swprintf( zTemp, L" %s", gMercProfiles[ iCurrentIMPSlot ].zName ); wcscat( pString, zTemp ); } - - // add to list - AddEmailRecordToList( pString ); - - // increment email record counter - iCounter++; + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; } // now the personality intro iOffSet = IMP_RESULTS_PERSONALITY_INTRO; iEndOfSection = IMP_RESULTS_PERSONALITY_INTRO_LENGTH + 1; - iCounter = 0; + iCounter = 0; while(iEndOfSection > iCounter) { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); - - // increment email record counter - iCounter++; + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; } // personality itself switch( gMercProfiles[ iCurrentIMPSlot ].bPersonalityTrait) { // normal as can be - case( NO_PERSONALITYTRAIT ): - iOffSet = IMP_PERSONALITY_NORMAL; + case( NO_PERSONALITYTRAIT ): + iOffSet = IMP_PERSONALITY_NORMAL; break; case( HEAT_INTOLERANT ): iOffSet = IMP_PERSONALITY_HEAT; break; - case( NERVOUS ): + case( NERVOUS ): iOffSet = IMP_PERSONALITY_NERVOUS; break; case( CLAUSTROPHOBIC ): @@ -3432,55 +3409,55 @@ void HandleIMPCharProfileResultsMessage( void) } // personality tick -// DEF: removed 1/12/99, cause it was changing the length of email that were already calculated +// DEF: removed 1/12/99, cause it was changing the length of email that were already calculated // LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + Random( IMP_PERSONALITY_LENGTH - 1 ) + 1 ), MAIL_STRING_SIZE ); LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + 1 ), MAIL_STRING_SIZE ); // add to list AddEmailRecordToList( pString ); - + // persoanlity paragraph LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + IMP_PERSONALITY_LENGTH ), MAIL_STRING_SIZE ); - // add to list + // add to list AddEmailRecordToList( pString ); // extra paragraph for bugs if( gMercProfiles[ iCurrentIMPSlot ].bPersonalityTrait == FEAR_OF_INSECTS ) { - // persoanlity paragraph + // persoanlity paragraph LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + IMP_PERSONALITY_LENGTH + 1 ), MAIL_STRING_SIZE ); // add to list AddEmailRecordToList( pString ); } - // attitude intro - // now the personality intro + // attitude intro + // now the personality intro iOffSet = IMP_RESULTS_ATTITUDE_INTRO; iEndOfSection = IMP_RESULTS_ATTITUDE_LENGTH; - iCounter = 0; + iCounter = 0; while(iEndOfSection > iCounter) { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); - - // increment email record counter - iCounter++; + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; } // personality itself switch( gMercProfiles[ iCurrentIMPSlot ].bAttitude ) { // normal as can be - case( ATT_NORMAL ): - iOffSet = IMP_ATTITUDE_NORMAL; + case( ATT_NORMAL ): + iOffSet = IMP_ATTITUDE_NORMAL; break; case( ATT_FRIENDLY ): iOffSet = IMP_ATTITUDE_FRIENDLY; break; - case( ATT_LONER ): + case( ATT_LONER ): iOffSet = IMP_ATTITUDE_LONER; break; case( ATT_OPTIMIST ): @@ -3495,7 +3472,7 @@ void HandleIMPCharProfileResultsMessage( void) case( ATT_ARROGANT ): iOffSet = IMP_ATTITUDE_ARROGANT; break; - case( ATT_ASSHOLE ): + case( ATT_ASSHOLE ): iOffSet = IMP_ATTITUDE_ASSHOLE; break; case( ATT_COWARD ): @@ -3508,10 +3485,10 @@ void HandleIMPCharProfileResultsMessage( void) LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet ), MAIL_STRING_SIZE ); // add to list AddEmailRecordToList( pString ); - + // attitude tick -// DEF: removed 1/12/99, cause it was changing the length of email that were already calculated +// DEF: removed 1/12/99, cause it was changing the length of email that were already calculated // LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + Random( IMP_ATTITUDE_LENGTH - 2 ) + 1 ), MAIL_STRING_SIZE ); LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + 1 ), MAIL_STRING_SIZE ); // add to list @@ -3519,45 +3496,45 @@ void HandleIMPCharProfileResultsMessage( void) // attitude paragraph LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + IMP_ATTITUDE_LENGTH - 1 ), MAIL_STRING_SIZE ); - // add to list + // add to list AddEmailRecordToList( pString ); - + //check for second paragraph if( iOffSet != IMP_ATTITUDE_NORMAL ) { - // attitude paragraph - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + IMP_ATTITUDE_LENGTH ), MAIL_STRING_SIZE ); - // add to list - AddEmailRecordToList( pString ); + // attitude paragraph + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + IMP_ATTITUDE_LENGTH ), MAIL_STRING_SIZE ); + // add to list + AddEmailRecordToList( pString ); } - + // skills - // now the skills intro + // now the skills intro iOffSet = IMP_RESULTS_SKILLS; iEndOfSection = IMP_RESULTS_SKILLS_LENGTH; - iCounter = 0; + iCounter = 0; - while(iEndOfSection > iCounter) + while(iEndOfSection > iCounter) { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); - - // increment email record counter - iCounter++; + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; } - + // imperial skills - iOffSet = IMP_SKILLS_IMPERIAL_SKILLS; + iOffSet = IMP_SKILLS_IMPERIAL_SKILLS; iEndOfSection = 0; - iCounter = 0; + iCounter = 0; // marksmanship if ( gMercProfiles[ iCurrentIMPSlot ].bMarksmanship >= SUPER_SKILL_VALUE ) - { + { fSufficientMarkSkill = TRUE; iEndOfSection = 1; } @@ -3565,7 +3542,7 @@ void HandleIMPCharProfileResultsMessage( void) // medical if ( gMercProfiles[ iCurrentIMPSlot ].bMedical >= SUPER_SKILL_VALUE ) { - fSufficientMedSkill = TRUE; + fSufficientMedSkill = TRUE; iEndOfSection = 1; } @@ -3584,32 +3561,32 @@ void HandleIMPCharProfileResultsMessage( void) while (iEndOfSection > iCounter) { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); - - // increment email record counter - iCounter++; + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; } - + // now handle skills - if ( fSufficientMarkSkill ) + if ( fSufficientMarkSkill ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_IMPERIAL_MARK ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_IMPERIAL_MARK ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } - + if ( fSufficientMedSkill ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_IMPERIAL_MED ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_IMPERIAL_MED ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } @@ -3617,18 +3594,18 @@ void HandleIMPCharProfileResultsMessage( void) if ( fSufficientMechSkill ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_IMPERIAL_MECH ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_IMPERIAL_MECH ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } - // explosives + // explosives if ( fSufficientExplSkill ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_IMPERIAL_EXPL ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_IMPERIAL_EXPL ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } @@ -3637,55 +3614,55 @@ void HandleIMPCharProfileResultsMessage( void) fSufficientMarkSkill = FALSE; fSufficientExplSkill = FALSE; fSufficientMedSkill = FALSE; - - // imperial skills - iOffSet = IMP_SKILLS_NEED_TRAIN_SKILLS; - iEndOfSection = 0; - iCounter = 0; - + // imperial skills + iOffSet = IMP_SKILLS_NEED_TRAIN_SKILLS; + iEndOfSection = 0; + iCounter = 0; + + // now the needs training values if( ( gMercProfiles[ iCurrentIMPSlot ].bMarksmanship > NO_CHANCE_IN_HELL_SKILL_VALUE ) &&( gMercProfiles[ iCurrentIMPSlot ].bMarksmanship <= NEEDS_TRAINING_SKILL_VALUE ) ) - { + { fSufficientMarkSkill = TRUE; iEndOfSection = 1; } if( ( gMercProfiles[ iCurrentIMPSlot ].bMedical > NO_CHANCE_IN_HELL_SKILL_VALUE ) &&( gMercProfiles[ iCurrentIMPSlot ].bMedical <= NEEDS_TRAINING_SKILL_VALUE ) ) - { + { fSufficientMedSkill = TRUE; iEndOfSection = 1; } if( ( gMercProfiles[ iCurrentIMPSlot ].bMechanical > NO_CHANCE_IN_HELL_SKILL_VALUE ) &&( gMercProfiles[ iCurrentIMPSlot ].bMechanical <= NEEDS_TRAINING_SKILL_VALUE ) ) - { + { fSufficientMechSkill = TRUE; iEndOfSection = 1; } if( ( gMercProfiles[ iCurrentIMPSlot ].bExplosive > NO_CHANCE_IN_HELL_SKILL_VALUE ) &&( gMercProfiles[ iCurrentIMPSlot ].bExplosive <= NEEDS_TRAINING_SKILL_VALUE ) ) - { + { fSufficientExplSkill = TRUE; iEndOfSection = 1; } while(iEndOfSection > iCounter) { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); - - // increment email record counter - iCounter++; + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; } if( fSufficientMarkSkill ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_NEED_TRAIN_MARK ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_NEED_TRAIN_MARK ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } @@ -3693,8 +3670,8 @@ void HandleIMPCharProfileResultsMessage( void) if( fSufficientMedSkill ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_NEED_TRAIN_MED ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_NEED_TRAIN_MED ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } @@ -3703,7 +3680,7 @@ void HandleIMPCharProfileResultsMessage( void) { // read one record from email file LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_NEED_TRAIN_MECH ), MAIL_STRING_SIZE ); - + // add to list AddEmailRecordToList( pString ); } @@ -3712,7 +3689,7 @@ void HandleIMPCharProfileResultsMessage( void) { // read one record from email file LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_NEED_TRAIN_EXPL ), MAIL_STRING_SIZE ); - + // add to list AddEmailRecordToList( pString ); } @@ -3725,9 +3702,9 @@ void HandleIMPCharProfileResultsMessage( void) // and the no chance in hell of doing anything useful values // no skill - iOffSet = IMP_SKILLS_NO_SKILL; + iOffSet = IMP_SKILLS_NO_SKILL; iEndOfSection = 0; - iCounter = 0; + iCounter = 0; if( gMercProfiles[ iCurrentIMPSlot ].bMarksmanship <= NO_CHANCE_IN_HELL_SKILL_VALUE ) { @@ -3755,21 +3732,21 @@ void HandleIMPCharProfileResultsMessage( void) while(iEndOfSection > iCounter) { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); - - // increment email record counter - iCounter++; + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; } if( fSufficientMechSkill ) { // read one record from email file LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_NO_SKILL_MECH ), MAIL_STRING_SIZE ); - + // add to list AddEmailRecordToList( pString ); } @@ -3778,7 +3755,7 @@ void HandleIMPCharProfileResultsMessage( void) { // read one record from email file LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_NO_SKILL_MARK ), MAIL_STRING_SIZE ); - + // add to list AddEmailRecordToList( pString ); } @@ -3787,7 +3764,7 @@ void HandleIMPCharProfileResultsMessage( void) { // read one record from email file LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_NO_SKILL_MED ), MAIL_STRING_SIZE ); - + // add to list AddEmailRecordToList( pString ); } @@ -3795,175 +3772,175 @@ void HandleIMPCharProfileResultsMessage( void) { // read one record from email file LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_NO_SKILL_EXPL ), MAIL_STRING_SIZE ); - + // add to list AddEmailRecordToList( pString ); } - + // now the specialized skills // imperial skills - iOffSet = IMP_SKILLS_SPECIAL_INTRO; + iOffSet = IMP_SKILLS_SPECIAL_INTRO; iEndOfSection = IMP_SKILLS_SPECIAL_INTRO_LENGTH; - iCounter = 0; + iCounter = 0; while(iEndOfSection > iCounter) { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); - - // increment email record counter - iCounter++; - } - - if( ( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait == KNIFING )||( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait2 == KNIFING ) ) - { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_KNIFE ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; } - // lockpick + if( ( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait == KNIFING )||( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait2 == KNIFING ) ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_KNIFE ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + // lockpick if( ( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait == LOCKPICKING)||( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait2 == LOCKPICKING) ) - { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_LOCK ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_LOCK ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); } // hand to hand if( ( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait == HANDTOHAND )||( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait2 == HANDTOHAND ) ) - { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_HAND ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_HAND ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); } - + // electronics if( ( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait == ELECTRONICS )||( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait2 == ELECTRONICS ) ) - { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_ELEC ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_ELEC ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); } if( ( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait == NIGHTOPS )||( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait2 == NIGHTOPS ) ) - { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_NIGHT ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_NIGHT ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); } if( ( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait == THROWING)||( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait2 == THROWING) ) - { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_THROW ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_THROW ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); } if( ( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait == TEACHING )||( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait2 == TEACHING ) ) - { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_TEACH ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_TEACH ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); } if( ( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait == HEAVY_WEAPS )||( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait2 == HEAVY_WEAPS ) ) - { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_HEAVY ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_HEAVY ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); } if( ( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait == AUTO_WEAPS )||( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait2 == AUTO_WEAPS ) ) - { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_AUTO ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_AUTO ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); } if( ( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait == STEALTHY )||( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait2 == STEALTHY ) ) - { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_STEALTH ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_STEALTH ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); } if( ( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait == AMBIDEXT)||( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait2 == AMBIDEXT) ) - { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_AMBI ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_AMBI ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); } if( ( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait == THIEF )||( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait2 == THIEF ) ) - { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_THIEF ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_THIEF ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); } if( ( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait == MARTIALARTS )||( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait2 == MARTIALARTS ) ) { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_MARTIAL ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_MARTIAL ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); } // rooftop - if( ( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait == ONROOF )||( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait2 == ONROOF ) ) + if( ( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait == PROF_SNIPER )||( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait2 == PROF_SNIPER ) ) { // WANNE: No entry in the Impass.edt for rooftop, so add any static text here - // read one record from email file - //LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_ONROOF ), MAIL_STRING_SIZE ); - + // read one record from email file + //LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_ONROOF ), MAIL_STRING_SIZE ); + wcscpy(pString, MissingIMPSkillsDescriptions[0]); //#ifdef GERMAN // wcscpy(pString, L"Dach-Treffer Bonus: "); //#else - //wcscpy(pString, L"Rooftop Sniping: "); + //wcscpy(pString, L"Sniper: "); //#endif - // add to list - AddEmailRecordToList( pString ); + // add to list + AddEmailRecordToList( pString ); } // camouflage if( ( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait == CAMOUFLAGED )||( gMercProfiles[ iCurrentIMPSlot ].bSkillTrait2 == CAMOUFLAGED ) ) { // WANNE: No entry in the Impass.edt for camouflage, so add any static text here - // read one record from email file - //LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_CAMOUFLAGED ), MAIL_STRING_SIZE ); - + // read one record from email file + //LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_CAMOUFLAGED ), MAIL_STRING_SIZE ); + wcscpy(pString, MissingIMPSkillsDescriptions[1]); /*#ifdef GERMAN @@ -3972,41 +3949,41 @@ void HandleIMPCharProfileResultsMessage( void) wcscpy(pString, L"Camouflage: "); #endif*/ - // add to list - AddEmailRecordToList( pString ); + // add to list + AddEmailRecordToList( pString ); } // now the physical // imperial physical - iOffSet = IMP_RESULTS_PHYSICAL; + iOffSet = IMP_RESULTS_PHYSICAL; iEndOfSection = IMP_RESULTS_PHYSICAL_LENGTH; - iCounter = 0; + iCounter = 0; while(iEndOfSection > iCounter) { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); - - // increment email record counter - iCounter++; + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; } // super physical iOffSet = IMP_PHYSICAL_SUPER; iEndOfSection = 0; - iCounter = 0; + iCounter = 0; + - // health - if( gMercProfiles[ iCurrentIMPSlot ].bLife >= SUPER_STAT_VALUE ) - { + if( gMercProfiles[ iCurrentIMPSlot ].bLife >= SUPER_STAT_VALUE ) + { fSufficientHlth = TRUE; iEndOfSection = 1; } - + // dex if( gMercProfiles[ iCurrentIMPSlot ].bDexterity >= SUPER_STAT_VALUE ) { @@ -4017,14 +3994,14 @@ void HandleIMPCharProfileResultsMessage( void) // agility if( gMercProfiles[ iCurrentIMPSlot ].bAgility >= SUPER_STAT_VALUE ) { - fSufficientAgi = TRUE; + fSufficientAgi = TRUE; iEndOfSection = 1; } // strength if( gMercProfiles[ iCurrentIMPSlot ].bStrength >= SUPER_STAT_VALUE ) { - fSufficientStr = TRUE; + fSufficientStr = TRUE; iEndOfSection = 1; } @@ -4044,21 +4021,21 @@ void HandleIMPCharProfileResultsMessage( void) while(iEndOfSection > iCounter) { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); - - // increment email record counter - iCounter++; + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; } - + if( fSufficientHlth ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_SUPER_HEALTH ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_SUPER_HEALTH ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } @@ -4067,8 +4044,8 @@ void HandleIMPCharProfileResultsMessage( void) if( fSufficientDex ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_SUPER_DEXTERITY ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_SUPER_DEXTERITY ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } @@ -4076,8 +4053,8 @@ void HandleIMPCharProfileResultsMessage( void) if( fSufficientStr ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_SUPER_STRENGTH ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_SUPER_STRENGTH ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } @@ -4085,17 +4062,17 @@ void HandleIMPCharProfileResultsMessage( void) if( fSufficientAgi ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_SUPER_AGILITY ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_SUPER_AGILITY ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } - + if( fSufficientWis ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_SUPER_WISDOM ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_SUPER_WISDOM ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } @@ -4103,8 +4080,8 @@ void HandleIMPCharProfileResultsMessage( void) if( fSufficientLdr ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_SUPER_LEADERSHIP ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_SUPER_LEADERSHIP ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } @@ -4112,19 +4089,19 @@ void HandleIMPCharProfileResultsMessage( void) fSufficientHlth = FALSE; fSufficientStr = FALSE; fSufficientWis = FALSE; - fSufficientAgi = FALSE; + fSufficientAgi = FALSE; fSufficientDex = FALSE; - fSufficientLdr = FALSE; + fSufficientLdr = FALSE; - // now the low attributes - // super physical + // now the low attributes + // super physical iOffSet = IMP_PHYSICAL_LOW; iEndOfSection = 0; - iCounter = 0; - + iCounter = 0; + // health - if( ( gMercProfiles[ iCurrentIMPSlot ].bLife < NEEDS_TRAINING_STAT_VALUE ) &&( gMercProfiles[ iCurrentIMPSlot ].bLife > NO_CHANCE_IN_HELL_STAT_VALUE ) ) - { + if( ( gMercProfiles[ iCurrentIMPSlot ].bLife < NEEDS_TRAINING_STAT_VALUE ) &&( gMercProfiles[ iCurrentIMPSlot ].bLife > NO_CHANCE_IN_HELL_STAT_VALUE ) ) + { fSufficientHlth = TRUE; iEndOfSection = 1; } @@ -4142,7 +4119,7 @@ void HandleIMPCharProfileResultsMessage( void) fSufficientAgi = TRUE; iEndOfSection = 1; } - + // wisdom if( (gMercProfiles[ iCurrentIMPSlot ].bWisdom < NEEDS_TRAINING_STAT_VALUE)&&( gMercProfiles[ iCurrentIMPSlot ].bWisdom > NO_CHANCE_IN_HELL_STAT_VALUE ) ) { @@ -4166,31 +4143,31 @@ void HandleIMPCharProfileResultsMessage( void) while(iEndOfSection > iCounter) { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); - - // increment email record counter - iCounter++; + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; } if( fSufficientHlth ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_LOW_HEALTH ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_LOW_HEALTH ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } - + if( fSufficientDex ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_LOW_DEXTERITY ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_LOW_DEXTERITY ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } @@ -4198,19 +4175,19 @@ void HandleIMPCharProfileResultsMessage( void) if( fSufficientStr ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_LOW_STRENGTH ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_LOW_STRENGTH ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } - + if( fSufficientAgi ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_LOW_AGILITY ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_LOW_AGILITY ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } @@ -4218,48 +4195,48 @@ void HandleIMPCharProfileResultsMessage( void) if( fSufficientWis ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_LOW_WISDOM ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_LOW_WISDOM ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } - + if( fSufficientLdr ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_LOW_LEADERSHIP ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_LOW_LEADERSHIP ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } - - - - + + + + // very low physical iOffSet = IMP_PHYSICAL_VERY_LOW; iEndOfSection = 0; - iCounter = 0; + iCounter = 0; fSufficientHlth = FALSE; fSufficientStr = FALSE; fSufficientWis = FALSE; - fSufficientAgi = FALSE; + fSufficientAgi = FALSE; fSufficientDex = FALSE; - fSufficientLdr = FALSE; - + fSufficientLdr = FALSE; + // health - if( gMercProfiles[ iCurrentIMPSlot ].bLife <= NO_CHANCE_IN_HELL_STAT_VALUE ) - { + if( gMercProfiles[ iCurrentIMPSlot ].bLife <= NO_CHANCE_IN_HELL_STAT_VALUE ) + { fSufficientHlth = TRUE; iEndOfSection =1; } - + // dex if( gMercProfiles[ iCurrentIMPSlot ].bDexterity <= NO_CHANCE_IN_HELL_STAT_VALUE ) { @@ -4290,32 +4267,32 @@ void HandleIMPCharProfileResultsMessage( void) while(iEndOfSection > iCounter) { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); - - // increment email record counter - iCounter++; + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; } if( fSufficientHlth ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_VERY_LOW_HEALTH ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_VERY_LOW_HEALTH ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } - + if( fSufficientDex ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_VERY_LOW_DEXTERITY ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_VERY_LOW_DEXTERITY ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } @@ -4323,30 +4300,30 @@ void HandleIMPCharProfileResultsMessage( void) if( fSufficientStr ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_VERY_LOW_STRENGTH ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_VERY_LOW_STRENGTH ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } - - + + if( fSufficientAgi ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_VERY_LOW_AGILITY ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_VERY_LOW_AGILITY ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } - + if( fSufficientWis ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_VERY_LOW_WISDOM ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_VERY_LOW_WISDOM ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } @@ -4355,76 +4332,76 @@ void HandleIMPCharProfileResultsMessage( void) // leadership if( gMercProfiles[ iCurrentIMPSlot ].bLeadership <= NO_CHANCE_IN_HELL_STAT_VALUE ) { - fSufficientLdr = TRUE; + fSufficientLdr = TRUE; } - if( fSufficientLdr ) + if( fSufficientLdr ) { // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_VERY_LOW_LEADERSHIP ), MAIL_STRING_SIZE ); - + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_VERY_LOW_LEADERSHIP ), MAIL_STRING_SIZE ); + // add to list AddEmailRecordToList( pString ); } - // very low physical + // very low physical iOffSet = IMP_RESULTS_PORTRAIT; iEndOfSection = IMP_RESULTS_PORTRAIT_LENGTH; - iCounter = 0; + iCounter = 0; while(iEndOfSection > iCounter) { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); - - // increment email record counter - iCounter++; + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; } // portraits - + switch( iPortraitNumber ) { - case( 0 ): - iOffSet = IMP_PORTRAIT_MALE_1; + case( 0 ): + iOffSet = IMP_PORTRAIT_MALE_1; break; case( 1 ): - iOffSet = IMP_PORTRAIT_MALE_2; + iOffSet = IMP_PORTRAIT_MALE_2; break; case( 2 ): - iOffSet = IMP_PORTRAIT_MALE_3; + iOffSet = IMP_PORTRAIT_MALE_3; break; case( 3 ): - iOffSet = IMP_PORTRAIT_MALE_4; + iOffSet = IMP_PORTRAIT_MALE_4; break; case( 4 ): case( 5 ): - iOffSet = IMP_PORTRAIT_MALE_5; - break; + iOffSet = IMP_PORTRAIT_MALE_5; + break; case( 6 ): case( 7 ): - iOffSet = IMP_PORTRAIT_MALE_6; + iOffSet = IMP_PORTRAIT_MALE_6; break; case( 8 ): - iOffSet = IMP_PORTRAIT_FEMALE_1; + iOffSet = IMP_PORTRAIT_FEMALE_1; break; case( 9 ): - iOffSet = IMP_PORTRAIT_FEMALE_2; + iOffSet = IMP_PORTRAIT_FEMALE_2; break; - case( 10 ): - iOffSet = IMP_PORTRAIT_FEMALE_3; + case( 10 ): + iOffSet = IMP_PORTRAIT_FEMALE_3; break; case( 11 ): case( 12 ): - iOffSet = IMP_PORTRAIT_FEMALE_4; + iOffSet = IMP_PORTRAIT_FEMALE_4; break; case( 13 ): case( 14 ): - iOffSet = IMP_PORTRAIT_FEMALE_5; + iOffSet = IMP_PORTRAIT_FEMALE_5; break; } @@ -4433,42 +4410,42 @@ void HandleIMPCharProfileResultsMessage( void) iOffSet += 2; } - iEndOfSection = 2; - iCounter = 0; - - while(iEndOfSection > iCounter) + iEndOfSection = 2; + iCounter = 0; + + while(iEndOfSection > iCounter) { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); - - // increment email record counter - iCounter++; + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; } - iOffSet = IMP_RESULTS_END; + iOffSet = IMP_RESULTS_END; iEndOfSection = IMP_RESULTS_END_LENGTH; - iCounter = 0; + iCounter = 0; while(iEndOfSection > iCounter) { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); - - // add to list - AddEmailRecordToList( pString ); - - // increment email record counter - iCounter++; + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; } giPrevMessageId = giMessageId; } - pTempRecord = pMessageRecordList; + pTempRecord = pMessageRecordList; } @@ -4483,9 +4460,9 @@ void HandleEmailViewerButtonStates( void ) return; } - - if( giNumberOfPagesToCurrentEmail <= 2 ) + + if( giNumberOfPagesToCurrentEmail <= 2 ) { return; } @@ -4525,7 +4502,7 @@ void SetUpIconForButton( ) return; } - + return; @@ -4538,29 +4515,29 @@ void DeleteCurrentMessage( void ) // set current message to be deleted iDeleteId = giMessageId; - + // set the currently displayed message to none giMessageId = -1; // reset display message flag - fDisplayMessageFlag=FALSE; + fDisplayMessageFlag=FALSE; // reset page being displayed - giMessagePage = 0; + giMessagePage = 0; fDeleteInternal = TRUE; // delete message DeleteEmail( ); - + fDeleteInternal = FALSE; // force update of entire screen fReDrawScreenFlag=TRUE; - // rerender email + // rerender email RenderEmail(); - + return; } @@ -4571,14 +4548,14 @@ void CreateNextPreviousEmailPageButtons( void ) // this function will create the buttons to advance and go back email pages // next button - giMailPageButtonsImage[0]= LoadButtonImage( "LAPTOP\\NewMailButtons.sti" ,-1,1,-1,4,-1 ); + giMailPageButtonsImage[0]= LoadButtonImage( "LAPTOP\\NewMailButtons.sti" ,-1,1,-1,4,-1 ); giMailPageButtons[0] = QuickCreateButton( giMailPageButtonsImage[0],NEXT_PAGE_X, NEXT_PAGE_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)NextRegionButtonCallback ); SetButtonCursor(giMailPageButtons[0], CURSOR_LAPTOP_SCREEN); // previous button - giMailPageButtonsImage[1]= LoadButtonImage( "LAPTOP\\NewMailButtons.sti" ,-1,0,-1,3,-1 ); + giMailPageButtonsImage[1]= LoadButtonImage( "LAPTOP\\NewMailButtons.sti" ,-1,0,-1,3,-1 ); giMailPageButtons[1] = QuickCreateButton( giMailPageButtonsImage[1],PREVIOUS_PAGE_X, NEXT_PAGE_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)PreviousRegionButtonCallback ); @@ -4586,8 +4563,8 @@ void CreateNextPreviousEmailPageButtons( void ) /* // set up disable methods - SpecifyDisabledButtonStyle( giMailPageButtons[1], DISABLED_STYLE_SHADED ); - SpecifyDisabledButtonStyle( giMailPageButtons[0], DISABLED_STYLE_SHADED ); + SpecifyDisabledButtonStyle( giMailPageButtons[1], DISABLED_STYLE_SHADED ); + SpecifyDisabledButtonStyle( giMailPageButtons[0], DISABLED_STYLE_SHADED ); */ return; @@ -4619,12 +4596,12 @@ void DisplayWhichPageOfEmailProgramIsDisplayed( void ) // will draw the number of the email program we are viewing right now CHAR16 sString[ 10 ]; - // font stuff + // font stuff SetFont(MESSAGE_FONT); SetFontForeground(FONT_BLACK); SetFontBackground(FONT_BLACK); SetFontShadow(NO_SHADOW); - + // page number if( iLastPage < 0 ) swprintf( sString, L"%d / %d", 1, 1); @@ -4646,23 +4623,23 @@ void OpenMostRecentUnreadEmail( void ) INT32 iMostRecentMailId = -1; EmailPtr pB=pEmailList; UINT32 iLowestDate = 9999999; - + while( pB ) - { + { // if date is lesser and unread , swap if( ( pB->iDate < iLowestDate )&&( pB->fRead == FALSE ) ) { - iMostRecentMailId = pB -> iId; - iLowestDate = pB -> iDate; + iMostRecentMailId = pB->iId; + iLowestDate = pB->iDate; } // next in B's list - pB=pB->Next; + pB=pB->Next; } // set up id giMessageId = iMostRecentMailId; - + // valid message, show it if( giMessageId != -1 ) { @@ -4676,22 +4653,19 @@ void OpenMostRecentUnreadEmail( void ) BOOLEAN DisplayNumberOfPagesToThisEmail( INT32 iViewerY ) { // display the indent for the display of pages to this email..along with the current page/number of pages - - - INT32 iCounter=0; INT16 sX = 0, sY = 0; CHAR16 sString[ 32 ]; // get and blt the email list background - // load, blt and delete graphics + // load, blt and delete graphics //VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; // FilenameForBPP( "LAPTOP\\mailindent.sti", VObjectDesc.ImageFile ); //CHECKF( AddVideoObject( &VObjectDesc, &uiMailIndent ) ); // GetVideoObject( &hHandle, uiMailIndent ); // BltVideoObject( FRAME_BUFFER, hHandle, 0,VIEWER_X + INDENT_X_OFFSET, VIEWER_Y + iViewerY + INDENT_Y_OFFSET - 10, VO_BLT_SRCTRANSPARENCY,NULL ); // DeleteVideoObjectFromIndex( uiMailIndent ); - + giNumberOfPagesToCurrentEmail = ( giNumberOfPagesToCurrentEmail ); // parse current page and max number of pages to email @@ -4700,11 +4674,11 @@ BOOLEAN DisplayNumberOfPagesToThisEmail( INT32 iViewerY ) SetFont( FONT12ARIAL ); SetFontForeground( FONT_BLACK ); SetFontBackground( FONT_BLACK ); - + // turn off the shadows SetFontShadow(NO_SHADOW); - SetFontDestBuffer(FRAME_BUFFER, 0 , 0 , SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); + SetFontDestBuffer(FRAME_BUFFER, 0 , 0 , SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); FindFontCenterCoordinates(VIEWER_X + INDENT_X_OFFSET, 0,INDENT_X_WIDTH, 0, sString, FONT12ARIAL, &sX, &sY); mprintf( sX, VIEWER_Y + iViewerY + INDENT_Y_OFFSET - 2, sString ); @@ -4726,7 +4700,7 @@ INT32 GetNumberOfPagesToEmail( ) // set temp record to head of list pTempRecord=pMessageRecordList; - // run through messages, and find out how many + // run through messages, and find out how many while( pTempRecord ) { pTempRecord = GetFirstRecordOnThisPage( pMessageRecordList, MESSAGE_FONT, MESSAGE_WIDTH, MESSAGE_GAP, iNumberOfPagesToEmail, MAX_EMAIL_MESSAGE_PAGE_SIZE ); @@ -4791,12 +4765,12 @@ void PreProcessEmail( EmailPtr pMail ) // list doesn't exist, reload if( !pTempRecord ) - { - while(pMail->usLength > iCounter) + { + while(pMail->usLength > iCounter) { - // read one record from email file - LoadEncryptedDataFromFile( "BINARYDATA\\Email.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); - + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Email.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + // WANNE: We have a new 1.13 MERC merc (Text, Gaston, Stogie or Biggens) if (iNew113MERCMerc != 0) { @@ -4826,10 +4800,10 @@ void PreProcessEmail( EmailPtr pMail ) // add to list AddEmailRecordToList( pString ); - - // increment email record counter - iCounter++; - } + + // increment email record counter + iCounter++; + } // WANNE: Set the value back if (iNew113MERCMerc != 0) @@ -4837,56 +4811,56 @@ void PreProcessEmail( EmailPtr pMail ) pMail->usLength = iNew113MERCMerc; } - giPrevMessageId = giMessageId; + giPrevMessageId = giMessageId; } - + // set record ptr to head of list pTempRecord=pMessageRecordList; //def removed // pass the subject line if( pTempRecord && pMail->usOffset != IMP_EMAIL_PROFILE_RESULTS) { - pTempRecord = pTempRecord->Next; + pTempRecord = pTempRecord->Next; } // get number of pages to this email - giNumberOfPagesToCurrentEmail = GetNumberOfPagesToEmail( ); + giNumberOfPagesToCurrentEmail = GetNumberOfPagesToEmail( ); while( pTempRecord ) - { - - // copy over string - wcscpy(pString, pTempRecord -> pRecord); + { - // get the height of the string, ONLY!...must redisplay ON TOP OF background graphic + // copy over string + wcscpy(pString, pTempRecord->pRecord); + + // get the height of the string, ONLY!...must redisplay ON TOP OF background graphic iHeight += IanWrappedStringHeight(VIEWER_X + 9, ( UINT16 )( VIEWER_MESSAGE_BODY_START_Y + iHeight + GetFontHeight(MESSAGE_FONT)), MESSAGE_WIDTH, MESSAGE_GAP, MESSAGE_FONT, MESSAGE_COLOR,pString,0,FALSE,0); - + // next message record string - pTempRecord = pTempRecord -> Next; - + pTempRecord = pTempRecord->Next; + } - - iViewerPositionY = ( 261 - iHeight ) / 2; - + + iViewerPositionY = ( 261 - iHeight ) / 2; + if ( iViewerPositionY < 0 ) { iViewerPositionY = 0; } // set total height to height of records displayed - iTotalHeight=iHeight; + iTotalHeight=iHeight; // if the message background is less than MIN_MESSAGE_HEIGHT_IN_LINES, set to that number - if( ( iTotalHeight / GetFontHeight( MESSAGE_FONT ) ) < MIN_MESSAGE_HEIGHT_IN_LINES) + if( ( iTotalHeight / GetFontHeight( MESSAGE_FONT ) ) < MIN_MESSAGE_HEIGHT_IN_LINES) { iTotalHeight=GetFontHeight( MESSAGE_FONT ) * MIN_MESSAGE_HEIGHT_IN_LINES; } - if(iTotalHeight > MAX_EMAIL_MESSAGE_PAGE_SIZE) + if(iTotalHeight > MAX_EMAIL_MESSAGE_PAGE_SIZE) { - // if message to big to fit on page + // if message to big to fit on page iTotalHeight = MAX_EMAIL_MESSAGE_PAGE_SIZE + 10; } else @@ -4902,7 +4876,7 @@ void PreProcessEmail( EmailPtr pMail ) if( pTempRecord && pMail->usOffset != IMP_EMAIL_PROFILE_RESULTS) { - pTempRecord = pTempRecord->Next; + pTempRecord = pTempRecord->Next; } /* @@ -4916,17 +4890,17 @@ void PreProcessEmail( EmailPtr pMail ) pEmailPageInfo[ 0 ].pFirstRecord = pTempRecord ; pEmailPageInfo[ 0 ].iPageNumber = 0; - + Assert(pTempRecord); // required, otherwise we're testing pCurrentRecord when undefined later - while( pTempRecord ) + while( pTempRecord ) { pCurrentRecord = pTempRecord; // increment email record ptr - pTempRecord = pTempRecord -> Next; + pTempRecord = pTempRecord->Next; - } + } // only one record to this email?..then set next to null if( pCurrentRecord == pEmailPageInfo[ 0 ].pFirstRecord ) @@ -4942,14 +4916,14 @@ void PreProcessEmail( EmailPtr pMail ) pEmailPageInfo[ 1 ].pLastRecord = NULL; pEmailPageInfo[ 1 ].iPageNumber = 1; } - else + else { fOnLastPageFlag = FALSE; pTempList = pMessageRecordList; if( pTempList && pMail->usOffset != IMP_EMAIL_PROFILE_RESULTS) { - pTempList = pTempList->Next; + pTempList = pTempList->Next; } /* @@ -4976,22 +4950,22 @@ void PreProcessEmail( EmailPtr pMail ) // go to the right record while( pTempRecord ) { - // copy over string - wcscpy( pString, pTempRecord -> pRecord ); - + // copy over string + wcscpy( pString, pTempRecord->pRecord ); + if( pString[ 0 ] == 0 ) { // on last page fOnLastPageFlag = TRUE; } - - if( ( iYPositionOnPage + IanWrappedStringHeight(0, 0, MESSAGE_WIDTH, MESSAGE_GAP, - MESSAGE_FONT, 0, pTempRecord->pRecord, - 0, 0, 0 ) ) <= MAX_EMAIL_MESSAGE_PAGE_SIZE ) - { - // now print it - iYPositionOnPage += IanWrappedStringHeight(VIEWER_X + 9, ( UINT16 )( VIEWER_MESSAGE_BODY_START_Y + 10 +iYPositionOnPage + iViewerPositionY), MESSAGE_WIDTH, MESSAGE_GAP, MESSAGE_FONT, MESSAGE_COLOR,pString,0,FALSE, IAN_WRAP_NO_SHADOW); + if( ( iYPositionOnPage + IanWrappedStringHeight(0, 0, MESSAGE_WIDTH, MESSAGE_GAP, + MESSAGE_FONT, 0, pTempRecord->pRecord, + 0, 0, 0 ) ) <= MAX_EMAIL_MESSAGE_PAGE_SIZE ) + { + // now print it + + iYPositionOnPage += IanWrappedStringHeight(VIEWER_X + 9, ( UINT16 )( VIEWER_MESSAGE_BODY_START_Y + 10 +iYPositionOnPage + iViewerPositionY), MESSAGE_WIDTH, MESSAGE_GAP, MESSAGE_FONT, MESSAGE_COLOR,pString,0,FALSE, IAN_WRAP_NO_SHADOW); fGoingOffCurrentPage = FALSE; } else @@ -5000,10 +4974,10 @@ void PreProcessEmail( EmailPtr pMail ) fGoingOffCurrentPage = TRUE; } - + pCurrentRecord = pTempRecord; - pTempRecord = pTempRecord ->Next; + pTempRecord = pTempRecord->Next; if( fGoingOffCurrentPage == FALSE ) { @@ -5032,7 +5006,7 @@ void PreProcessEmail( EmailPtr pMail ) } - + } @@ -5263,7 +5237,7 @@ void AddAllEmails() UINT32 uiCnt; UINT32 uiOffset; - AddEmail(IMP_EMAIL_INTRO,IMP_EMAIL_INTRO_LENGTH,CHAR_PROFILE_SITE, GetWorldTotalMin(), -1 ); + AddEmail(IMP_EMAIL_INTRO,IMP_EMAIL_INTRO_LENGTH,CHAR_PROFILE_SITE, GetWorldTotalMin(), -1 ); AddEmail(ENRICO_CONGRATS,ENRICO_CONGRATS_LENGTH,MAIL_ENRICO, GetWorldTotalMin(), -1 ); AddEmail(IMP_EMAIL_AGAIN,IMP_EMAIL_AGAIN_LENGTH,1, GetWorldTotalMin( ), -1 ); AddEmail(MERC_INTRO, MERC_INTRO_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin( ), -1 ); @@ -5291,10 +5265,10 @@ void AddAllEmails() AddEmail( ( UINT8 )( uiOffset + ( uiCnt * AIM_REPLY_LENGTH_BARRY ) ), AIM_REPLY_LENGTH_BARRY, ( UINT8 )( 6 + uiCnt ), GetWorldTotalMin(), -1 ); } - AddEmail(OLD_ENRICO_1,OLD_ENRICO_1_LENGTH,MAIL_ENRICO, GetWorldTotalMin(), -1 ); - AddEmail(OLD_ENRICO_2,OLD_ENRICO_2_LENGTH,MAIL_ENRICO, GetWorldTotalMin(), -1 ); - AddEmail(OLD_ENRICO_3,OLD_ENRICO_3_LENGTH,MAIL_ENRICO, GetWorldTotalMin(), -1 ); - AddEmail(RIS_REPORT,RIS_REPORT_LENGTH,RIS_EMAIL, GetWorldTotalMin(), -1 ); + AddEmail(OLD_ENRICO_1,OLD_ENRICO_1_LENGTH,MAIL_ENRICO, GetWorldTotalMin(), -1 ); + AddEmail(OLD_ENRICO_2,OLD_ENRICO_2_LENGTH,MAIL_ENRICO, GetWorldTotalMin(), -1 ); + AddEmail(OLD_ENRICO_3,OLD_ENRICO_3_LENGTH,MAIL_ENRICO, GetWorldTotalMin(), -1 ); + AddEmail(RIS_REPORT,RIS_REPORT_LENGTH,RIS_EMAIL, GetWorldTotalMin(), -1 ); AddEmail( ENRICO_MIGUEL, ENRICO_MIGUEL_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1 ); AddEmail(ENRICO_PROG_20, ENRICO_PROG_20_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1); @@ -5333,6 +5307,7 @@ void AddAllEmails() - + + diff --git a/Laptop/email.h b/Laptop/email.h index 9369448f..d9b072ac 100644 --- a/Laptop/email.h +++ b/Laptop/email.h @@ -14,9 +14,9 @@ #define ENRICO_CONGRATS_LENGTH 3 #define IMP_EMAIL_AGAIN (ENRICO_CONGRATS + ENRICO_CONGRATS_LENGTH) #define IMP_EMAIL_AGAIN_LENGTH 6 -#define MERC_INTRO (IMP_EMAIL_AGAIN + IMP_EMAIL_AGAIN_LENGTH) -#define MERC_INTRO_LENGTH 5 -#define MERC_NEW_SITE_ADDRESS ( MERC_INTRO + MERC_INTRO_LENGTH ) +#define MERC_INTRO (IMP_EMAIL_AGAIN + IMP_EMAIL_AGAIN_LENGTH) +#define MERC_INTRO_LENGTH 5 +#define MERC_NEW_SITE_ADDRESS ( MERC_INTRO + MERC_INTRO_LENGTH ) #define MERC_NEW_SITE_ADDRESS_LENGTH 2 #define AIM_MEDICAL_DEPOSIT_REFUND ( MERC_NEW_SITE_ADDRESS + MERC_NEW_SITE_ADDRESS_LENGTH ) #define AIM_MEDICAL_DEPOSIT_REFUND_LENGTH 3 @@ -227,8 +227,8 @@ typedef struct pagemessages Page; typedef Page *PagePtr; struct messagerecord{ -// CHAR16 pRecord[ 320 ]; - CHAR16 pRecord[ 640 ]; +// CHAR16 pRecord[ 320 ]; + CHAR16 pRecord[ 640 ]; struct messagerecord *Next; }; @@ -245,7 +245,7 @@ typedef struct enum { SENDER=0, RECEIVED, - SUBJECT, + SUBJECT, READ, }; @@ -270,8 +270,8 @@ enum { extern BOOLEAN fUnReadMailFlag; extern BOOLEAN fNewMailFlag; -extern BOOLEAN fOldUnreadFlag; -extern BOOLEAN fOldNewMailFlag; +extern BOOLEAN fOldUnreadFlag; +extern BOOLEAN fOldNewMailFlag; extern BOOLEAN fDeleteMailFlag; extern BOOLEAN fDisplayMessageFlag; extern BOOLEAN fReDrawNewMailFlag; diff --git a/Laptop/files.cpp b/Laptop/files.cpp index 8c113073..e7cd645d 100644 --- a/Laptop/files.cpp +++ b/Laptop/files.cpp @@ -22,7 +22,7 @@ #define BLOCK_FILE_HEIGHT 10 #define BOX_HEIGHT 14 #define TITLE_X iScreenWidthOffset + 140 -#define TITLE_Y iScreenHeightOffset + 33 +#define TITLE_Y iScreenHeightOffset + 33 #define TEXT_X iScreenWidthOffset + 140 #define PAGE_SIZE 22 #define FILES_TITLE_FONT FONT14ARIAL @@ -37,9 +37,9 @@ #define FILE_GAP 2 #define FILE_TEXT_COLOR FONT_BLACK #define FILE_STRING_SIZE 400 -#define MAX_FILES_PAGE MAX_FILES_LIST_LENGTH +#define MAX_FILES_PAGE MAX_FILES_LIST_LENGTH #define FILES_LIST_X FILES_SENDER_TEXT_X -#define FILES_LIST_Y ( 9 * BLOCK_HEIGHT ) +#define FILES_LIST_Y ( 9 * BLOCK_HEIGHT ) #define FILES_LIST_WIDTH 100 #define LENGTH_OF_ENRICO_FILE 68 #define MAX_FILE_MESSAGE_PAGE_SIZE 325 @@ -82,7 +82,7 @@ extern UINT32 guiTOP; // symbol already defined in finances.cpp (jonathanl) UINT32 guiHIGHLIGHT; -// currewnt page of multipage files we are on +// currewnt page of multipage files we are on INT32 giFilesPage = 0; // strings @@ -190,21 +190,21 @@ UINT32 AddFilesToPlayersLog(UINT8 ubCode, UINT32 uiDate, UINT8 ubFormat, STR8 pF { // adds Files item to player's log(Files List), returns unique id number of it // outside of the Files system(the code in this .c file), this is the only function you'll ever need - UINT32 uiId=0; + UINT32 uiId=0; // if not in Files mode, read in from file if(!fInFilesMode) - OpenAndReadFilesFile( ); - + OpenAndReadFilesFile( ); + // process the actual data - uiId = ProcessAndEnterAFilesRecord(ubCode, uiDate, ubFormat ,pFirstPicFile, pSecondPicFile, FALSE ); - + uiId = ProcessAndEnterAFilesRecord(ubCode, uiDate, ubFormat ,pFirstPicFile, pSecondPicFile, FALSE ); + // set unread flag, if nessacary CheckForUnreadFiles( ); // write out to file if not in Files mode if(!fInFilesMode) - OpenAndWriteFilesFile( ); + OpenAndWriteFilesFile( ); // return unique id of this transaction return uiId; @@ -212,10 +212,10 @@ UINT32 AddFilesToPlayersLog(UINT8 ubCode, UINT32 uiDate, UINT8 ubFormat, STR8 pF void GameInitFiles( ) { - if ( (FileExists( FILES_DAT_FILE ) == TRUE ) ) + if ( (FileExists( FILES_DAT_FILE ) == TRUE ) ) { - FileClearAttributes( FILES_DAT_FILE ); - FileDelete( FILES_DAT_FILE ); + FileClearAttributes( FILES_DAT_FILE ); + FileDelete( FILES_DAT_FILE ); } ClearFilesList( ); @@ -227,35 +227,35 @@ void GameInitFiles( ) void EnterFiles() { - + // load grpahics for files system LoadFiles( ); - + //AddFilesToPlayersLog(1, 0, 0,"LAPTOP\\portrait.sti", "LAPTOP\\portrait.sti"); //AddFilesToPlayersLog(0, 0, 3,"LAPTOP\\portrait.sti", "LAPTOP\\portrait.sti"); - //AddFilesToPlayersLog(2, 0, 1,"LAPTOP\\portrait.sti", "LAPTOP\\portrait.sti"); - // in files mode now, set the fact + //AddFilesToPlayersLog(2, 0, 1,"LAPTOP\\portrait.sti", "LAPTOP\\portrait.sti"); + // in files mode now, set the fact fInFilesMode=TRUE; - - // initialize mouse regions - InitializeFilesMouseRegions( ); - // create buttons + // initialize mouse regions + InitializeFilesMouseRegions( ); + + // create buttons CreateButtonsForFilesPage( ); // now set start states HandleFileViewerButtonStates( ); - + // build files list - OpenAndReadFilesFile( ); + OpenAndReadFilesFile( ); // render files system - RenderFiles( ); + RenderFiles( ); // entered due to icon if( fEnteredFileViewerFromNewFileIcon == TRUE ) { - OpenFirstUnreadFile( ); + OpenFirstUnreadFile( ); fEnteredFileViewerFromNewFileIcon = FALSE; } @@ -266,8 +266,8 @@ void ExitFiles() { // write files list out to disk - OpenAndWriteFilesFile( ); - + OpenAndWriteFilesFile( ); + // remove mouse regions RemoveFilesMouseRegions( ); @@ -276,7 +276,7 @@ void ExitFiles() fInFilesMode = FALSE; - // remove files + // remove files RemoveFiles( ); } @@ -287,28 +287,28 @@ void HandleFiles() void RenderFiles() { - HVOBJECT hHandle; + HVOBJECT hHandle; // render the background - RenderFilesBackGround( ); + RenderFilesBackGround( ); // draw the title bars text - DrawFilesTitleText( ); + DrawFilesTitleText( ); // the columns - DrawFilesListBackGround( ); - + DrawFilesListBackGround( ); + // display the list of senders - DisplayFilesList( ); + DisplayFilesList( ); // draw the highlighted file DisplayFileMessage( ); // title bar icon - BlitTitleBarIcons( ); + BlitTitleBarIcons( ); + - // display border GetVideoObject(&hHandle, guiLaptopBACKGROUND); BltVideoObject(FRAME_BUFFER, hHandle, 0,iScreenWidthOffset + 108, iScreenHeightOffset + 23, VO_BLT_SRCTRANSPARENCY,NULL); @@ -319,20 +319,19 @@ void RenderFiles() void RenderFilesBackGround( void ) { // render generic background for file system - HVOBJECT hHandle; - INT32 iCounter=0; - + HVOBJECT hHandle; + // get title bar object GetVideoObject(&hHandle, guiTITLE); - + // blt title bar to screen BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X, TOP_Y - 2, VO_BLT_SRCTRANSPARENCY,NULL); - - // get and blt the top part of the screen, video object and blt to screen - GetVideoObject( &hHandle, guiTOP ); - BltVideoObject( FRAME_BUFFER, hHandle, 0,TOP_X, TOP_Y + 22, VO_BLT_SRCTRANSPARENCY, NULL ); - - + + // get and blt the top part of the screen, video object and blt to screen + GetVideoObject( &hHandle, guiTOP ); + BltVideoObject( FRAME_BUFFER, hHandle, 0,TOP_X, TOP_Y + 22, VO_BLT_SRCTRANSPARENCY, NULL ); + + return; } @@ -341,41 +340,41 @@ void DrawFilesTitleText( void ) { // setup the font stuff SetFont(FILES_TITLE_FONT); - SetFontForeground(FONT_WHITE); + SetFontForeground(FONT_WHITE); SetFontBackground(FONT_BLACK); - // reset shadow - SetFontShadow(DEFAULT_SHADOW); - + // reset shadow + SetFontShadow(DEFAULT_SHADOW); + // draw the pages title mprintf(TITLE_X,TITLE_Y,pFilesTitle[0]); - - + + return; } BOOLEAN LoadFiles( void ) { - VOBJECT_DESC VObjectDesc; - // load files video objects into memory + VOBJECT_DESC VObjectDesc; + // load files video objects into memory // title bar - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\programtitlebar.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiTITLE)); - + // top portion of the screen background VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\fileviewer.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiTOP)); - + // the highlight - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\highlight.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiHIGHLIGHT)); - // top portion of the screen background + // top portion of the screen background VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\fileviewerwhite.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiFileBack)); @@ -387,12 +386,12 @@ void RemoveFiles( void ) { // delete files video objects from memory - - + + DeleteVideoObjectFromIndex(guiTOP); DeleteVideoObjectFromIndex(guiTITLE); - DeleteVideoObjectFromIndex(guiHIGHLIGHT); - DeleteVideoObjectFromIndex(guiFileBack); + DeleteVideoObjectFromIndex(guiHIGHLIGHT); + DeleteVideoObjectFromIndex(guiFileBack); return; @@ -400,15 +399,15 @@ void RemoveFiles( void ) UINT32 ProcessAndEnterAFilesRecord( UINT8 ubCode, UINT32 uiDate, UINT8 ubFormat ,STR8 pFirstPicFile, STR8 pSecondPicFile, BOOLEAN fRead ) { - UINT32 uiId=0; - FilesUnitPtr pFiles=pFilesListHead; - + UINT32 uiId=0; + FilesUnitPtr pFiles=pFilesListHead; + // add to Files list if(pFiles) { while(pFiles) { - // check to see if the file is already there + // check to see if the file is already there if(pFiles->ubCode==ubCode) { // if so, return it's id number @@ -418,27 +417,27 @@ UINT32 ProcessAndEnterAFilesRecord( UINT8 ubCode, UINT32 uiDate, UINT8 ubFormat // next in the list pFiles = pFiles->Next; } - + // reset pointer pFiles=pFilesListHead; // go to end of list while(pFiles->Next) - { + { pFiles = pFiles->Next; } // alloc space pFiles->Next = (files *) MemAlloc(sizeof(FilesUnit)); - + // increment id number uiId = pFiles->uiIdNumber + 1; - + // set up information passed pFiles = pFiles->Next; pFiles->Next = NULL; pFiles->ubCode = ubCode; pFiles->uiDate = uiDate; - pFiles->uiIdNumber = uiId; + pFiles->uiIdNumber = uiId; pFiles->ubFormat = ubFormat; pFiles->fRead = fRead; } @@ -446,42 +445,42 @@ UINT32 ProcessAndEnterAFilesRecord( UINT8 ubCode, UINT32 uiDate, UINT8 ubFormat { // alloc space pFiles = (FilesUnitPtr) MemAlloc(sizeof(FilesUnit)); - + // setup info passed pFiles->Next = NULL; pFiles->ubCode = ubCode; pFiles->uiDate = uiDate; - pFiles->uiIdNumber = uiId; - pFilesListHead = pFiles; + pFiles->uiIdNumber = uiId; + pFilesListHead = pFiles; pFiles->ubFormat=ubFormat; - pFiles -> fRead = fRead; + pFiles->fRead = fRead; } // null out ptr's to picture file names - pFiles -> pPicFileNameList[0] = NULL; - pFiles -> pPicFileNameList[1] = NULL; + pFiles->pPicFileNameList[0] = NULL; + pFiles->pPicFileNameList[1] = NULL; // copy file name strings // first file if(pFirstPicFile) { - if((pFirstPicFile[0]) != 0) + if((pFirstPicFile[0]) != 0) { - pFiles -> pPicFileNameList[0] = (STR8) MemAlloc(strlen(pFirstPicFile) + 1 ); - strcpy( pFiles -> pPicFileNameList[0], pFirstPicFile); - pFiles -> pPicFileNameList[0][strlen(pFirstPicFile)] = 0; + pFiles->pPicFileNameList[0] = (STR8) MemAlloc(strlen(pFirstPicFile) + 1 ); + strcpy( pFiles->pPicFileNameList[0], pFirstPicFile); + pFiles->pPicFileNameList[0][strlen(pFirstPicFile)] = 0; } } - // second file - + // second file + if(pSecondPicFile) { - if((pSecondPicFile[0]) != 0) + if((pSecondPicFile[0]) != 0) { - pFiles->pPicFileNameList[1] = (STR8) MemAlloc(strlen(pSecondPicFile) + 1 ); - strcpy( pFiles->pPicFileNameList[1], pSecondPicFile); + pFiles->pPicFileNameList[1] = (STR8) MemAlloc(strlen(pSecondPicFile) + 1 ); + strcpy( pFiles->pPicFileNameList[1], pSecondPicFile); pFiles->pPicFileNameList[1][ strlen( pSecondPicFile ) ] = 0; } } @@ -492,15 +491,15 @@ UINT32 ProcessAndEnterAFilesRecord( UINT8 ubCode, UINT32 uiDate, UINT8 ubFormat void OpenAndReadFilesFile( void ) { - // this procedure will open and read in data to the finance list - HWFILE hFileHandle; - UINT8 ubCode; + // this procedure will open and read in data to the finance list + HWFILE hFileHandle; + UINT8 ubCode; UINT32 uiDate; - INT32 iBytesRead=0; - UINT32 uiByteCount=0; - CHAR8 pFirstFilePath[128]; - CHAR8 pSecondFilePath[128]; - UINT8 ubFormat; + INT32 iBytesRead=0; + UINT32 uiByteCount=0; + CHAR8 pFirstFilePath[128]; + CHAR8 pSecondFilePath[128]; + UINT8 ubFormat; BOOLEAN fRead; // clear out the old list @@ -511,60 +510,59 @@ void OpenAndReadFilesFile( void ) return; // open file - hFileHandle=FileOpen( FILES_DAT_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + hFileHandle=FileOpen( FILES_DAT_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); // failed to get file, return if(!hFileHandle) { return; - } + } // make sure file is more than 0 length - if ( FileGetSize( hFileHandle ) == 0 ) + if ( FileGetSize( hFileHandle ) == 0 ) { - FileClose( hFileHandle ); + FileClose( hFileHandle ); return; } - + // file exists, read in data, continue until file end - while( FileGetSize( hFileHandle ) > uiByteCount) + while( FileGetSize( hFileHandle ) > uiByteCount) { - + // read in data - FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); - + FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &uiDate, sizeof(UINT32), (UINT32 *)&iBytesRead ); - - FileRead( hFileHandle, &pFirstFilePath, 128, (UINT32 *)&iBytesRead ); - - FileRead( hFileHandle, &pSecondFilePath, 128, (UINT32 *)&iBytesRead ); - FileRead( hFileHandle, &ubFormat, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &pFirstFilePath, 128, (UINT32 *)&iBytesRead ); - FileRead( hFileHandle, &fRead, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &pSecondFilePath, 128, (UINT32 *)&iBytesRead ); + + FileRead( hFileHandle, &ubFormat, sizeof(UINT8), (UINT32 *)&iBytesRead ); + + FileRead( hFileHandle, &fRead, sizeof(UINT8), (UINT32 *)&iBytesRead ); // add transaction - ProcessAndEnterAFilesRecord(ubCode, uiDate, ubFormat,pFirstFilePath, pSecondFilePath, fRead); + ProcessAndEnterAFilesRecord(ubCode, uiDate, ubFormat,pFirstFilePath, pSecondFilePath, fRead); // increment byte counter - uiByteCount += sizeof( UINT32 ) + sizeof( UINT8 )+ 128 + 128 + sizeof(UINT8) + sizeof( BOOLEAN ); - } - - // close file + uiByteCount += sizeof( UINT32 ) + sizeof( UINT8 )+ 128 + 128 + sizeof(UINT8) + sizeof( BOOLEAN ); + } + + // close file FileClose( hFileHandle ); - + return; } BOOLEAN OpenAndWriteFilesFile( void ) { - // this procedure will open and write out data from the finance list - HWFILE hFileHandle; - INT32 iBytesWritten=0; - FilesUnitPtr pFilesList=pFilesListHead; + // this procedure will open and write out data from the finance list + HWFILE hFileHandle; + FilesUnitPtr pFilesList=pFilesListHead; CHAR8 pFirstFilePath[128]; - CHAR8 pSecondFilePath[128]; - + CHAR8 pSecondFilePath[128]; + memset(&pFirstFilePath, 0, sizeof( pFirstFilePath ) ); memset(&pSecondFilePath, 0, sizeof( pSecondFilePath ) ); @@ -579,7 +577,7 @@ BOOLEAN OpenAndWriteFilesFile( void ) strcpy(pSecondFilePath, pFilesList->pPicFileNameList[1]); } } - + // open file hFileHandle=FileOpen( FILES_DAT_FILE, FILE_ACCESS_WRITE|FILE_CREATE_ALWAYS, FALSE); @@ -587,26 +585,26 @@ BOOLEAN OpenAndWriteFilesFile( void ) if(!hFileHandle) { return ( FALSE ); - } - // write info, while there are elements left in the list - while(pFilesList) + } + // write info, while there are elements left in the list + while(pFilesList) { - // now write date and amount, and code - FileWrite( hFileHandle, &(pFilesList->ubCode), sizeof ( UINT8 ), NULL ); - FileWrite( hFileHandle, &(pFilesList->uiDate), sizeof ( UINT32 ), NULL ); - FileWrite( hFileHandle, &(pFirstFilePath), 128, NULL ); - FileWrite( hFileHandle, &(pSecondFilePath), 128, NULL ); - FileWrite( hFileHandle, &(pFilesList->ubFormat), sizeof(UINT8), NULL ); + // now write date and amount, and code + FileWrite( hFileHandle, &(pFilesList->ubCode), sizeof ( UINT8 ), NULL ); + FileWrite( hFileHandle, &(pFilesList->uiDate), sizeof ( UINT32 ), NULL ); + FileWrite( hFileHandle, &(pFirstFilePath), 128, NULL ); + FileWrite( hFileHandle, &(pSecondFilePath), 128, NULL ); + FileWrite( hFileHandle, &(pFilesList->ubFormat), sizeof(UINT8), NULL ); FileWrite( hFileHandle, &(pFilesList->fRead), sizeof(UINT8), NULL ); // next element in list pFilesList = pFilesList->Next; - + } // close file - FileClose( hFileHandle ); - // clear out the old list + FileClose( hFileHandle ); + // clear out the old list ClearFilesList( ); return ( TRUE ); @@ -615,40 +613,39 @@ BOOLEAN OpenAndWriteFilesFile( void ) void ClearFilesList( void ) { // remove each element from list of transactions - FilesUnitPtr pFilesList=pFilesListHead; - FilesUnitPtr pFilesNode=pFilesList; + FilesUnitPtr pFilesList=pFilesListHead; + FilesUnitPtr pFilesNode=pFilesList; // while there are elements in the list left, delete them while( pFilesList ) { - // set node to list head + // set node to list head pFilesNode=pFilesList; - + // set list head to next node pFilesList=pFilesList->Next; - + // if present, dealloc string - if(pFilesNode->pPicFileNameList[0]) + if(pFilesNode->pPicFileNameList[0]) { - MemFree(pFilesNode->pPicFileNameList[0]); + MemFree(pFilesNode->pPicFileNameList[0]); } - if(pFilesNode->pPicFileNameList[1]) + if(pFilesNode->pPicFileNameList[1]) { - MemFree(pFilesNode->pPicFileNameList[1]); + MemFree(pFilesNode->pPicFileNameList[1]); } // delete current node MemFree(pFilesNode); } - pFilesListHead=NULL; + pFilesListHead=NULL; return; } void DrawFilesListBackGround( void ) { // proceudre will draw the background for the list of files - INT32 iCounter=7; - // HVOBJECT hHandle; + // HVOBJECT hHandle; // now the columns @@ -661,15 +658,15 @@ void DrawFilesListBackGround( void ) void DisplayFilesList( void ) { - // this function will run through the list of files of files and display the 'sender' - FilesUnitPtr pFilesList=pFilesListHead; - INT32 iCounter=0; - HVOBJECT hHandle; - - + // this function will run through the list of files of files and display the 'sender' + FilesUnitPtr pFilesList=pFilesListHead; + INT32 iCounter=0; + HVOBJECT hHandle; + + // font stuff - SetFont(FILES_TEXT_FONT); - SetFontForeground(FONT_BLACK); + SetFont(FILES_TEXT_FONT); + SetFontForeground(FONT_BLACK); SetFontBackground(FONT_BLACK); SetFontShadow(NO_SHADOW); @@ -678,17 +675,17 @@ void DisplayFilesList( void ) { if (iCounter==iHighLightFileLine) { - // render highlight - GetVideoObject(&hHandle, guiHIGHLIGHT); - BltVideoObject(FRAME_BUFFER, hHandle, 0, FILES_SENDER_TEXT_X - 5, iScreenHeightOffset + ( ( iCounter + 9 ) * BLOCK_HEIGHT) + ( iCounter * 2 ) - 4 , VO_BLT_SRCTRANSPARENCY,NULL); - + // render highlight + GetVideoObject(&hHandle, guiHIGHLIGHT); + BltVideoObject(FRAME_BUFFER, hHandle, 0, FILES_SENDER_TEXT_X - 5, iScreenHeightOffset + ( ( iCounter + 9 ) * BLOCK_HEIGHT) + ( iCounter * 2 ) - 4 , VO_BLT_SRCTRANSPARENCY,NULL); + } - + mprintf(FILES_SENDER_TEXT_X, iScreenHeightOffset + (( iCounter + 9 ) * BLOCK_HEIGHT) + ( iCounter * 2 ) - 2 ,pFilesSenderList[pFilesList->ubCode]); iCounter++; pFilesList=pFilesList->Next; } - + // reset shadow SetFontShadow(DEFAULT_SHADOW); @@ -700,22 +697,22 @@ void DisplayFilesList( void ) void DisplayFileMessage( void ) { - - - - - // get the currently selected message - if(iHighLightFileLine!=-1) - { + + + + + // get the currently selected message + if(iHighLightFileLine!=-1) + { // display text - DisplayFormattedText( ); + DisplayFormattedText( ); } else { HandleFileViewerButtonStates( ); } - + // reset shadow SetFontShadow(DEFAULT_SHADOW); @@ -729,132 +726,131 @@ void InitializeFilesMouseRegions( void ) // init mouseregions for(iCounter=0; iCounter Next; + // next element in list + pFilesList = pFilesList->Next; - // increment counter - iCounter++; - } - - fReDrawScreenFlag=TRUE; + // increment counter + iCounter++; + } - - return; - } + fReDrawScreenFlag=TRUE; + + + return; + } } BOOLEAN DisplayFormattedText( void ) { - FilesUnitPtr pFilesList=pFilesListHead; - + FilesUnitPtr pFilesList=pFilesListHead; + UINT16 usFirstWidth = 0; UINT16 usFirstHeight = 0; - UINT16 usSecondWidth; + UINT16 usSecondWidth; UINT16 usSecondHeight; - INT16 sTextWidth = 0; INT32 iCounter=0; - INT32 iLength=0; + INT32 iLength=0; INT32 iHeight=0; INT32 iOffSet=0; INT32 iMessageCode; CHAR16 sString[2048]; - HVOBJECT hHandle; - UINT32 uiFirstTempPicture; + HVOBJECT hHandle; + UINT32 uiFirstTempPicture; UINT32 uiSecondTempPicture; - VOBJECT_DESC VObjectDesc; - INT16 usFreeSpace = 0; + VOBJECT_DESC VObjectDesc; + INT16 usFreeSpace = 0; static INT32 iOldMessageCode = 0; fWaitAFrame = FALSE; // get the file that was highlighted - while(iCounter < iHighLightFileLine) + while(iCounter < iHighLightFileLine) { - iCounter++; + iCounter++; pFilesList=pFilesList->Next; } - // message code found, reset counter - iMessageCode = pFilesList->ubCode; + // message code found, reset counter + iMessageCode = pFilesList->ubCode; iCounter=0; - - // set file as read + + // set file as read pFilesList->fRead = TRUE; // clear the file string structure list - // get file background object + // get file background object GetVideoObject(&hHandle, guiFileBack); - + // blt background to screen BltVideoObject(FRAME_BUFFER, hHandle, 0, FILE_VIEWER_X, FILE_VIEWER_Y - 4, VO_BLT_SRCTRANSPARENCY,NULL); - // get the offset in the file - while( iCounter < iMessageCode) + // get the offset in the file + while( iCounter < iMessageCode) { - // increment increment offset - iOffSet+=ubFileRecordsLength[iCounter]; + // increment increment offset + iOffSet+=ubFileRecordsLength[iCounter]; - // increment counter + // increment counter iCounter++; } @@ -862,151 +858,151 @@ BOOLEAN DisplayFormattedText( void ) if( pFilesList->ubFormat < ENRICO_BACKGROUND ) { - - LoadEncryptedDataFromFile("BINARYDATA\\Files.edt", sString, FILE_STRING_SIZE * (iOffSet) * 2, FILE_STRING_SIZE * iLength * 2); + + LoadEncryptedDataFromFile("BINARYDATA\\Files.edt", sString, FILE_STRING_SIZE * (iOffSet) * 2, FILE_STRING_SIZE * iLength * 2); } // reset counter iCounter=0; - + // no shadow SetFontShadow(NO_SHADOW); - switch( pFilesList->ubFormat ) + switch( pFilesList->ubFormat ) { - case 0: - - // no format, all text + case 0: - while(iLength > iCounter) - { - // read one record from file manager file - LoadEncryptedDataFromFile( "BINARYDATA\\Files.edt", sString, FILE_STRING_SIZE * ( iOffSet + iCounter ) * 2, FILE_STRING_SIZE * 2 ); - - // display string and get height - iHeight += IanDisplayWrappedString(FILE_VIEWER_X + 4, ( UINT16 )( FILE_VIEWER_Y + iHeight ), FILE_VIEWER_WIDTH, FILE_GAP, FILES_TEXT_FONT, FILE_TEXT_COLOR, sString,0,FALSE,0); - - // increment file record counter - iCounter++; - } - break; - - case 1: + // no format, all text - // second format, one picture, all text below + while(iLength > iCounter) + { + // read one record from file manager file + LoadEncryptedDataFromFile( "BINARYDATA\\Files.edt", sString, FILE_STRING_SIZE * ( iOffSet + iCounter ) * 2, FILE_STRING_SIZE * 2 ); - // load graphic - VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; - FilenameForBPP( pFilesList->pPicFileNameList[ 0 ], VObjectDesc.ImageFile ); - CHECKF(AddVideoObject( &VObjectDesc, &uiFirstTempPicture ) ); - - GetVideoObjectETRLESubregionProperties( uiFirstTempPicture, 0, &usFirstWidth, &usFirstHeight ); - + // display string and get height + iHeight += IanDisplayWrappedString(FILE_VIEWER_X + 4, ( UINT16 )( FILE_VIEWER_Y + iHeight ), FILE_VIEWER_WIDTH, FILE_GAP, FILES_TEXT_FONT, FILE_TEXT_COLOR, sString,0,FALSE,0); - // get file background object - GetVideoObject(&hHandle, uiFirstTempPicture); - - // blt background to screen - BltVideoObject(FRAME_BUFFER, hHandle, 0, FILE_VIEWER_X + 4 + ( FILE_VIEWER_WIDTH - usFirstWidth ) / 2, FILE_VIEWER_Y + 10, VO_BLT_SRCTRANSPARENCY,NULL); - - iHeight = usFirstHeight + 20; + // increment file record counter + iCounter++; + } + break; + + case 1: + + // second format, one picture, all text below + + // load graphic + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + FilenameForBPP( pFilesList->pPicFileNameList[ 0 ], VObjectDesc.ImageFile ); + CHECKF(AddVideoObject( &VObjectDesc, &uiFirstTempPicture ) ); + + GetVideoObjectETRLESubregionProperties( uiFirstTempPicture, 0, &usFirstWidth, &usFirstHeight ); - while(iLength > iCounter) - { + // get file background object + GetVideoObject(&hHandle, uiFirstTempPicture); - // read one record from file manager file - LoadEncryptedDataFromFile( "BINARYDATA\\Files.edt", sString, FILE_STRING_SIZE * ( iOffSet + iCounter ) * 2, FILE_STRING_SIZE * 2 ); - - // display string and get height - iHeight += IanDisplayWrappedString(FILE_VIEWER_X + 4, ( UINT16 )( FILE_VIEWER_Y + iHeight ), FILE_VIEWER_WIDTH, FILE_GAP, FILES_TEXT_FONT, FILE_TEXT_COLOR, sString,0,FALSE,0); - - // increment file record counter - iCounter++; - } + // blt background to screen + BltVideoObject(FRAME_BUFFER, hHandle, 0, FILE_VIEWER_X + 4 + ( FILE_VIEWER_WIDTH - usFirstWidth ) / 2, FILE_VIEWER_Y + 10, VO_BLT_SRCTRANSPARENCY,NULL); - // delete video object - DeleteVideoObjectFromIndex( uiFirstTempPicture ); - - break; - case 2: - - // third format, two pictures, side by side with all text below - - // load first graphic - VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; - FilenameForBPP( pFilesList->pPicFileNameList[ 0 ], VObjectDesc.ImageFile ); - CHECKF(AddVideoObject( &VObjectDesc, &uiFirstTempPicture)); - - // load second graphic - VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; - FilenameForBPP( pFilesList->pPicFileNameList[ 1 ] , VObjectDesc.ImageFile ); - CHECKF(AddVideoObject( &VObjectDesc, &uiSecondTempPicture ) ); - - GetVideoObjectETRLESubregionProperties( uiFirstTempPicture, 0, &usFirstWidth, &usFirstHeight ); - GetVideoObjectETRLESubregionProperties( uiSecondTempPicture, 0, &usSecondWidth, &usSecondHeight ); - - // get free space; - usFreeSpace = FILE_VIEWER_WIDTH - usFirstWidth - usSecondWidth; - - usFreeSpace /= 3; - // get file background object - GetVideoObject(&hHandle, uiFirstTempPicture); - - - // blt background to screen - BltVideoObject(FRAME_BUFFER, hHandle, 0, FILE_VIEWER_X + usFreeSpace, FILE_VIEWER_Y + 10, VO_BLT_SRCTRANSPARENCY,NULL); - - // get file background object - GetVideoObject(&hHandle, uiSecondTempPicture); - - // get position for second picture - usFreeSpace *= 2; - usFreeSpace += usFirstWidth; - - // blt background to screen - BltVideoObject(FRAME_BUFFER, hHandle, 0, FILE_VIEWER_X + usFreeSpace, FILE_VIEWER_Y + 10, VO_BLT_SRCTRANSPARENCY,NULL); - + iHeight = usFirstHeight + 20; - // delete video object - DeleteVideoObjectFromIndex(uiFirstTempPicture); - DeleteVideoObjectFromIndex(uiSecondTempPicture); + while(iLength > iCounter) + { - // put in text - iHeight = usFirstHeight + 20; + // read one record from file manager file + LoadEncryptedDataFromFile( "BINARYDATA\\Files.edt", sString, FILE_STRING_SIZE * ( iOffSet + iCounter ) * 2, FILE_STRING_SIZE * 2 ); + + // display string and get height + iHeight += IanDisplayWrappedString(FILE_VIEWER_X + 4, ( UINT16 )( FILE_VIEWER_Y + iHeight ), FILE_VIEWER_WIDTH, FILE_GAP, FILES_TEXT_FONT, FILE_TEXT_COLOR, sString,0,FALSE,0); + + // increment file record counter + iCounter++; + } + + // delete video object + DeleteVideoObjectFromIndex( uiFirstTempPicture ); + + break; + case 2: + + // third format, two pictures, side by side with all text below + + // load first graphic + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + FilenameForBPP( pFilesList->pPicFileNameList[ 0 ], VObjectDesc.ImageFile ); + CHECKF(AddVideoObject( &VObjectDesc, &uiFirstTempPicture)); + + // load second graphic + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + FilenameForBPP( pFilesList->pPicFileNameList[ 1 ] , VObjectDesc.ImageFile ); + CHECKF(AddVideoObject( &VObjectDesc, &uiSecondTempPicture ) ); + + GetVideoObjectETRLESubregionProperties( uiFirstTempPicture, 0, &usFirstWidth, &usFirstHeight ); + GetVideoObjectETRLESubregionProperties( uiSecondTempPicture, 0, &usSecondWidth, &usSecondHeight ); + + // get free space; + usFreeSpace = FILE_VIEWER_WIDTH - usFirstWidth - usSecondWidth; + + usFreeSpace /= 3; + // get file background object + GetVideoObject(&hHandle, uiFirstTempPicture); - while(iLength > iCounter) - { + // blt background to screen + BltVideoObject(FRAME_BUFFER, hHandle, 0, FILE_VIEWER_X + usFreeSpace, FILE_VIEWER_Y + 10, VO_BLT_SRCTRANSPARENCY,NULL); - // read one record from file manager file - LoadEncryptedDataFromFile( "BINARYDATA\\Files.edt", sString, FILE_STRING_SIZE * ( iOffSet + iCounter ) * 2, FILE_STRING_SIZE * 2 ); - - // display string and get height - iHeight += IanDisplayWrappedString(FILE_VIEWER_X + 4, ( UINT16 )( FILE_VIEWER_Y + iHeight ), FILE_VIEWER_WIDTH, FILE_GAP, FILES_TEXT_FONT, FILE_TEXT_COLOR, sString,0,FALSE,0); - - // increment file record counter - iCounter++; - } + // get file background object + GetVideoObject(&hHandle, uiSecondTempPicture); + + // get position for second picture + usFreeSpace *= 2; + usFreeSpace += usFirstWidth; + + // blt background to screen + BltVideoObject(FRAME_BUFFER, hHandle, 0, FILE_VIEWER_X + usFreeSpace, FILE_VIEWER_Y + 10, VO_BLT_SRCTRANSPARENCY,NULL); - break; - - case 3: - // picture on the left, with text on right and below - // load first graphic - HandleSpecialTerroristFile( pFilesList->ubCode, pFilesList->pPicFileNameList[ 0 ] ); - break; - default: - HandleSpecialFiles( pFilesList -> ubFormat ); - break; + + // delete video object + DeleteVideoObjectFromIndex(uiFirstTempPicture); + DeleteVideoObjectFromIndex(uiSecondTempPicture); + + // put in text + iHeight = usFirstHeight + 20; + + + while(iLength > iCounter) + { + + // read one record from file manager file + LoadEncryptedDataFromFile( "BINARYDATA\\Files.edt", sString, FILE_STRING_SIZE * ( iOffSet + iCounter ) * 2, FILE_STRING_SIZE * 2 ); + + // display string and get height + iHeight += IanDisplayWrappedString(FILE_VIEWER_X + 4, ( UINT16 )( FILE_VIEWER_Y + iHeight ), FILE_VIEWER_WIDTH, FILE_GAP, FILES_TEXT_FONT, FILE_TEXT_COLOR, sString,0,FALSE,0); + + // increment file record counter + iCounter++; + } + + + break; + + case 3: + // picture on the left, with text on right and below + // load first graphic + HandleSpecialTerroristFile( pFilesList->ubCode, pFilesList->pPicFileNameList[ 0 ] ); + break; + default: + HandleSpecialFiles( pFilesList->ubFormat ); + break; } HandleFileViewerButtonStates( ); SetFontShadow(DEFAULT_SHADOW); - + return ( TRUE ); } @@ -1014,10 +1010,9 @@ BOOLEAN DisplayFormattedText( void ) BOOLEAN HandleSpecialFiles( UINT8 ubFormat ) { INT32 iCounter = 0; - CHAR16 sString[2048]; + CHAR16 sString[2048]; FileStringPtr pTempString = NULL ; FileStringPtr pLocatorString = NULL; - INT32 iTotalYPosition = 0; INT32 iYPositionOnPage = 0; INT32 iFileLineWidth = 0; INT32 iFileStartX = 0; @@ -1030,7 +1025,7 @@ BOOLEAN HandleSpecialFiles( UINT8 ubFormat ) UINT32 uiPicture; HVOBJECT hHandle; VOBJECT_DESC VObjectDesc; - + ClearFileStringList( ); @@ -1041,21 +1036,21 @@ BOOLEAN HandleSpecialFiles( UINT8 ubFormat ) // read one record from file manager file WidthList = CreateWidthRecordsForAruloIntelFile( ); - while( iCounter < LENGTH_OF_ENRICO_FILE ) + while( iCounter < LENGTH_OF_ENRICO_FILE ) { - LoadEncryptedDataFromFile( "BINARYDATA\\RIS.EDT", sString, FILE_STRING_SIZE * ( iCounter ) * 2, FILE_STRING_SIZE * 2 ); + LoadEncryptedDataFromFile( "BINARYDATA\\RIS.EDT", sString, FILE_STRING_SIZE * ( iCounter ) * 2, FILE_STRING_SIZE * 2 ); AddStringToFilesList( sString ); iCounter++; } pTempString = pFileStringList; - - iYPositionOnPage = 0; + + iYPositionOnPage = 0; iCounter = 0; pLocatorString = pTempString; - pTempString = GetFirstStringOnThisPage( pFileStringList,FILES_TEXT_FONT, 350, FILE_GAP, giFilesPage, MAX_FILE_MESSAGE_PAGE_SIZE, WidthList); + pTempString = GetFirstStringOnThisPage( pFileStringList,FILES_TEXT_FONT, 350, FILE_GAP, giFilesPage, MAX_FILE_MESSAGE_PAGE_SIZE, WidthList); // find out where this string is while( pLocatorString != pTempString ) @@ -1069,32 +1064,32 @@ BOOLEAN HandleSpecialFiles( UINT8 ubFormat ) while( pTempString ) { uiFlags = IAN_WRAP_NO_SHADOW; - // copy over string + // copy over string wcscpy( sString, pTempString->pString ); - + if( sString[ 0 ] == 0 ) { // on last page fOnLastFilesPageFlag = TRUE; } - - + + // set up font uiFont = FILES_TEXT_FONT; if( giFilesPage == 0 ) { - switch( iCounter ) + switch( iCounter ) { - case( 0 ): - uiFont = FILES_TITLE_FONT; - break; - + case( 0 ): + uiFont = FILES_TITLE_FONT; + break; + } } // reset width iFileLineWidth = 350; - iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); + iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); // based on the record we are at, selected X start position and the width to wrap the line, to fit around pictures @@ -1102,21 +1097,21 @@ BOOLEAN HandleSpecialFiles( UINT8 ubFormat ) { // title iFileLineWidth = 350; - iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); - + iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); + } else if( iCounter == 1 ) { // opening on first page iFileLineWidth = 350; - iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); - + iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); + } else if( ( iCounter > 1) &&( iCounter < FILES_COUNTER_1_WIDTH ) ) { iFileLineWidth = 350; - iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); - + iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); + } else if( iCounter == FILES_COUNTER_1_WIDTH ) { @@ -1125,44 +1120,44 @@ BOOLEAN HandleSpecialFiles( UINT8 ubFormat ) iYPositionOnPage += ( MAX_FILE_MESSAGE_PAGE_SIZE - iYPositionOnPage ); } iFileLineWidth = 350; - iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); + iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); } - + else if( iCounter == FILES_COUNTER_2_WIDTH ) { iFileLineWidth = 200; - iFileStartX = (UINT16) ( FILE_VIEWER_X + 150 ); + iFileStartX = (UINT16) ( FILE_VIEWER_X + 150 ); } else if( iCounter == FILES_COUNTER_3_WIDTH ) { iFileLineWidth = 200; - iFileStartX = (UINT16) ( FILE_VIEWER_X + 150 ); + iFileStartX = (UINT16) ( FILE_VIEWER_X + 150 ); } - + else { iFileLineWidth = 350; - iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); + iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); } // not far enough, advance - - if( ( iYPositionOnPage + IanWrappedStringHeight(0, 0, ( UINT16 )iFileLineWidth, FILE_GAP, - uiFont, 0, sString, - 0, 0, 0 ) ) < MAX_FILE_MESSAGE_PAGE_SIZE ) - { - // now print it - iYPositionOnPage += ( INT32 )IanDisplayWrappedString((UINT16) ( iFileStartX ), ( UINT16 )( FILE_VIEWER_Y + iYPositionOnPage), ( INT16 )iFileLineWidth, FILE_GAP, uiFont, FILE_TEXT_COLOR, sString,0,FALSE, uiFlags ); - fGoingOffCurrentPage = FALSE; - } - else + if( ( iYPositionOnPage + IanWrappedStringHeight(0, 0, ( UINT16 )iFileLineWidth, FILE_GAP, + uiFont, 0, sString, + 0, 0, 0 ) ) < MAX_FILE_MESSAGE_PAGE_SIZE ) { - // gonna get cut off...end now - fGoingOffCurrentPage = TRUE; + // now print it + iYPositionOnPage += ( INT32 )IanDisplayWrappedString((UINT16) ( iFileStartX ), ( UINT16 )( FILE_VIEWER_Y + iYPositionOnPage), ( INT16 )iFileLineWidth, FILE_GAP, uiFont, FILE_TEXT_COLOR, sString,0,FALSE, uiFlags ); + + fGoingOffCurrentPage = FALSE; + } + else + { + // gonna get cut off...end now + fGoingOffCurrentPage = TRUE; } - pTempString = pTempString ->Next; - + pTempString = pTempString->Next; + if( pTempString == NULL ) { // on last page @@ -1179,7 +1174,7 @@ BOOLEAN HandleSpecialFiles( UINT8 ubFormat ) pTempString = NULL; } iCounter++; - } + } ClearOutWidthRecordsList( WidthList ); ClearFileStringList( ); break; @@ -1195,11 +1190,11 @@ BOOLEAN HandleSpecialFiles( UINT8 ubFormat ) CHECKF(AddVideoObject(&VObjectDesc, &uiPicture)); // get title bar object - GetVideoObject(&hHandle, uiPicture); - - // blt title bar to screen - BltVideoObject(FRAME_BUFFER, hHandle, 0,iScreenWidthOffset + 300, iScreenHeightOffset + 270, VO_BLT_SRCTRANSPARENCY,NULL); - + GetVideoObject(&hHandle, uiPicture); + + // blt title bar to screen + BltVideoObject(FRAME_BUFFER, hHandle, 0,iScreenWidthOffset + 300, iScreenHeightOffset + 270, VO_BLT_SRCTRANSPARENCY,NULL); + DeleteVideoObjectFromIndex( uiPicture ); } @@ -1211,32 +1206,32 @@ BOOLEAN HandleSpecialFiles( UINT8 ubFormat ) CHECKF(AddVideoObject(&VObjectDesc, &uiPicture)); // get title bar object - GetVideoObject(&hHandle, uiPicture); - - // blt title bar to screen - BltVideoObject(FRAME_BUFFER, hHandle, 0,iScreenWidthOffset + 260, iScreenHeightOffset + 225, VO_BLT_SRCTRANSPARENCY,NULL); - + GetVideoObject(&hHandle, uiPicture); + + // blt title bar to screen + BltVideoObject(FRAME_BUFFER, hHandle, 0,iScreenWidthOffset + 260, iScreenHeightOffset + 225, VO_BLT_SRCTRANSPARENCY,NULL); + DeleteVideoObjectFromIndex( uiPicture ); } else if( giFilesPage == 5 ) { - + // wedding pic VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\Enrico_W.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &uiPicture)); // get title bar object - GetVideoObject(&hHandle, uiPicture); - - // blt title bar to screen - BltVideoObject(FRAME_BUFFER, hHandle, 0,iScreenWidthOffset + 260, iScreenHeightOffset + 85, VO_BLT_SRCTRANSPARENCY,NULL); - + GetVideoObject(&hHandle, uiPicture); + + // blt title bar to screen + BltVideoObject(FRAME_BUFFER, hHandle, 0,iScreenWidthOffset + 260, iScreenHeightOffset + 85, VO_BLT_SRCTRANSPARENCY,NULL); + DeleteVideoObjectFromIndex( uiPicture ); } - + return ( TRUE ); } @@ -1245,29 +1240,29 @@ void AddStringToFilesList( STR16 pString ) { FileStringPtr pFileString; - FileStringPtr pTempString = pFileStringList; + FileStringPtr pTempString = pFileStringList; // create string structure pFileString = (FileStringPtr) MemAlloc( sizeof( FileString ) ); - - - // alloc string and copy - pFileString-> pString = (STR16) MemAlloc( ( wcslen( pString ) * sizeof(CHAR16) ) + 2 ); + + + // alloc string and copy + pFileString->pString = (STR16) MemAlloc( ( wcslen( pString ) * sizeof(CHAR16) ) + 2 ); wcscpy( pFileString->pString, pString ); pFileString->pString[ wcslen( pString ) ] = 0; // set Next to NULL - pFileString -> Next = NULL; + pFileString->Next = NULL; if( pFileStringList == NULL ) { pFileStringList = pFileString; } else { - while( pTempString -> Next ) + while( pTempString->Next ) { - pTempString = pTempString -> Next; + pTempString = pTempString->Next; } pTempString->Next = pFileString; } @@ -1288,10 +1283,10 @@ void ClearFileStringList( void ) { return; } - while( pFileString -> Next) + while( pFileString->Next) { pDeleteFileString = pFileString; - pFileString = pFileString -> Next; + pFileString = pFileString->Next; MemFree( pDeleteFileString->pString); MemFree( pDeleteFileString ); } @@ -1308,13 +1303,13 @@ void ClearFileStringList( void ) void CreateButtonsForFilesPage( void ) { // will create buttons for the files page - giFilesPageButtonsImage[0]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,0,-1,1,-1 ); - giFilesPageButtons[0] = QuickCreateButton( giFilesPageButtonsImage[0], PREVIOUS_FILE_PAGE_BUTTON_X, PREVIOUS_FILE_PAGE_BUTTON_Y, + giFilesPageButtonsImage[0]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,0,-1,1,-1 ); + giFilesPageButtons[0] = QuickCreateButton( giFilesPageButtonsImage[0], PREVIOUS_FILE_PAGE_BUTTON_X, PREVIOUS_FILE_PAGE_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnPreviousFilePageCallback ); - giFilesPageButtonsImage[ 1 ]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,6,-1,7,-1 ); - giFilesPageButtons[ 1 ] = QuickCreateButton( giFilesPageButtonsImage[ 1 ], NEXT_FILE_PAGE_BUTTON_X, NEXT_FILE_PAGE_BUTTON_Y , + giFilesPageButtonsImage[ 1 ]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,6,-1,7,-1 ); + giFilesPageButtons[ 1 ] = QuickCreateButton( giFilesPageButtonsImage[ 1 ], NEXT_FILE_PAGE_BUTTON_X, NEXT_FILE_PAGE_BUTTON_Y , BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnNextFilePageCallback ); @@ -1333,7 +1328,7 @@ void DeleteButtonsForFilesPage( void ) RemoveButton(giFilesPageButtons[ 0 ] ); UnloadButtonImage( giFilesPageButtonsImage[ 0 ] ); - + RemoveButton(giFilesPageButtons[ 1 ] ); UnloadButtonImage( giFilesPageButtonsImage[ 1 ] ); @@ -1344,7 +1339,7 @@ void DeleteButtonsForFilesPage( void ) // callbacks void BtnPreviousFilePageCallback(GUI_BUTTON *btn,INT32 reason) { - if (!(btn->uiFlags & BUTTON_ENABLED)) + if (!(btn->uiFlags & BUTTON_ENABLED)) return; if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) @@ -1356,10 +1351,10 @@ void BtnPreviousFilePageCallback(GUI_BUTTON *btn,INT32 reason) } if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - { - btn->uiFlags|=(BUTTON_CLICKED_ON); + { + btn->uiFlags|=(BUTTON_CLICKED_ON); } - + } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { @@ -1370,11 +1365,11 @@ void BtnPreviousFilePageCallback(GUI_BUTTON *btn,INT32 reason) } if((btn->uiFlags & BUTTON_CLICKED_ON)) - { + { if( giFilesPage > 0 ) { - giFilesPage--; + giFilesPage--; fWaitAFrame = TRUE; } @@ -1382,7 +1377,7 @@ void BtnPreviousFilePageCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags&=~(BUTTON_CLICKED_ON); MarkButtonsDirty( ); } - } + } return; } @@ -1390,7 +1385,7 @@ void BtnPreviousFilePageCallback(GUI_BUTTON *btn,INT32 reason) void BtnNextFilePageCallback(GUI_BUTTON *btn,INT32 reason) { - if (!(btn->uiFlags & BUTTON_ENABLED)) + if (!(btn->uiFlags & BUTTON_ENABLED)) return; if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) @@ -1401,10 +1396,10 @@ void BtnNextFilePageCallback(GUI_BUTTON *btn,INT32 reason) } if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - { - btn->uiFlags|=(BUTTON_CLICKED_ON); + { + btn->uiFlags|=(BUTTON_CLICKED_ON); } - + } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { @@ -1414,9 +1409,9 @@ void BtnNextFilePageCallback(GUI_BUTTON *btn,INT32 reason) } if((btn->uiFlags & BUTTON_CLICKED_ON)) - { + { - if( ( fOnLastFilesPageFlag ) == FALSE ) + if( ( fOnLastFilesPageFlag ) == FALSE ) { fWaitAFrame = TRUE; giFilesPage++; @@ -1484,11 +1479,11 @@ FileRecordWidthPtr CreateRecordWidth( INT32 iRecordNumber, INT32 iRecordWidth, // how wide special records are ( ones that share space with pictures ) pTempRecord = (FileRecordWidthPtr) MemAlloc( sizeof( FileRecordWidth ) ); - pTempRecord -> Next = NULL; - pTempRecord -> iRecordNumber = iRecordNumber; - pTempRecord -> iRecordWidth = iRecordWidth; - pTempRecord -> iRecordHeightAdjustment = iRecordHeightAdjustment; - pTempRecord -> ubFlags = ubFlags; + pTempRecord->Next = NULL; + pTempRecord->iRecordNumber = iRecordNumber; + pTempRecord->iRecordWidth = iRecordWidth; + pTempRecord->iRecordHeightAdjustment = iRecordHeightAdjustment; + pTempRecord->ubFlags = ubFlags; return ( pTempRecord ); } @@ -1499,22 +1494,22 @@ FileRecordWidthPtr CreateWidthRecordsForAruloIntelFile( void ) FileRecordWidthPtr pTempRecord = NULL; FileRecordWidthPtr pRecordListHead = NULL; - + // first record width // pTempRecord = CreateRecordWidth( 7, 350, 200,0 ); pTempRecord = CreateRecordWidth( FILES_COUNTER_1_WIDTH, 350, MAX_FILE_MESSAGE_PAGE_SIZE,0 ); // set up head of list now pRecordListHead = pTempRecord; - + // next record -// pTempRecord -> Next = CreateRecordWidth( 43, 200,0, 0 ); - pTempRecord -> Next = CreateRecordWidth( FILES_COUNTER_2_WIDTH, 200,0, 0 ); +// pTempRecord->Next = CreateRecordWidth( 43, 200,0, 0 ); + pTempRecord->Next = CreateRecordWidth( FILES_COUNTER_2_WIDTH, 200,0, 0 ); pTempRecord = pTempRecord->Next; // and the next.. -// pTempRecord -> Next = CreateRecordWidth( 45, 200,0, 0 ); - pTempRecord -> Next = CreateRecordWidth( FILES_COUNTER_3_WIDTH, 200,0, 0 ); +// pTempRecord->Next = CreateRecordWidth( 45, 200,0, 0 ); + pTempRecord->Next = CreateRecordWidth( FILES_COUNTER_3_WIDTH, 200,0, 0 ); pTempRecord = pTempRecord->Next; return( pRecordListHead ); @@ -1527,21 +1522,21 @@ FileRecordWidthPtr CreateWidthRecordsForTerroristFile( void ) FileRecordWidthPtr pTempRecord = NULL; FileRecordWidthPtr pRecordListHead = NULL; - + // first record width pTempRecord = CreateRecordWidth( 4, 170, 0,0 ); // set up head of list now pRecordListHead = pTempRecord; - + // next record - pTempRecord -> Next = CreateRecordWidth( 5, 170,0, 0 ); + pTempRecord->Next = CreateRecordWidth( 5, 170,0, 0 ); pTempRecord = pTempRecord->Next; - pTempRecord -> Next = CreateRecordWidth( 6, 170,0, 0 ); + pTempRecord->Next = CreateRecordWidth( 6, 170,0, 0 ); pTempRecord = pTempRecord->Next; - - + + return( pRecordListHead ); } @@ -1561,13 +1556,13 @@ void ClearOutWidthRecordsList( FileRecordWidthPtr pFileRecordWidthList ) return; } - while( pTempRecord -> Next ) + while( pTempRecord->Next ) { // set up delete record pDeleteRecord = pTempRecord; // move to next record - pTempRecord = pTempRecord -> Next; + pTempRecord = pTempRecord->Next; MemFree( pDeleteRecord ); } @@ -1587,25 +1582,25 @@ void OpenFirstUnreadFile( void ) { // open the first unread file in the list INT32 iCounter = 0; - FilesUnitPtr pFilesList=pFilesListHead; + FilesUnitPtr pFilesList=pFilesListHead; - // make sure is a valid - while( pFilesList ) - { + // make sure is a valid + while( pFilesList ) + { - // if iCounter = iFileId, is a valid file - if( pFilesList -> fRead == FALSE ) - { - iHighLightFileLine = iCounter; - } + // if iCounter = iFileId, is a valid file + if( pFilesList->fRead == FALSE ) + { + iHighLightFileLine = iCounter; + } - // next element in list - pFilesList = pFilesList->Next; + // next element in list + pFilesList = pFilesList->Next; + + // increment counter + iCounter++; + } - // increment counter - iCounter++; - } - return; } @@ -1616,14 +1611,14 @@ void CheckForUnreadFiles( void ) // willc heck for any unread files and set flag if any FilesUnitPtr pFilesList=pFilesListHead; - + fNewFilesInFileViewer = FALSE; while( pFilesList ) - { + { // unread?...if so, set flag - if( pFilesList -> fRead == FALSE ) + if( pFilesList->fRead == FALSE ) { fNewFilesInFileViewer = TRUE; } @@ -1642,10 +1637,9 @@ BOOLEAN HandleSpecialTerroristFile( INT32 iFileNumber, STR sPictureName ) { INT32 iCounter = 0; - CHAR16 sString[2048]; + CHAR16 sString[2048]; FileStringPtr pTempString = NULL ; FileStringPtr pLocatorString = NULL; - INT32 iTotalYPosition = 0; INT32 iYPositionOnPage = 0; INT32 iFileLineWidth = 0; INT32 iFileStartX = 0; @@ -1663,8 +1657,8 @@ BOOLEAN HandleSpecialTerroristFile( INT32 iFileNumber, STR sPictureName ) // grab width list WidthList = CreateWidthRecordsForTerroristFile( ); - - + + while( iCounter < ubFileRecordsLength[ iFileNumber ] ) { LoadEncryptedDataFromFile( "BINARYDATA\\files.EDT", sString, FILE_STRING_SIZE * ( iOffset + iCounter ) * 2, FILE_STRING_SIZE * 2 ); @@ -1674,18 +1668,18 @@ BOOLEAN HandleSpecialTerroristFile( INT32 iFileNumber, STR sPictureName ) pTempString = pFileStringList; - + iYPositionOnPage = 0; iCounter = 0; pLocatorString = pTempString; - pTempString = GetFirstStringOnThisPage( pFileStringList,FILES_TEXT_FONT, 350, FILE_GAP, giFilesPage, MAX_FILE_MESSAGE_PAGE_SIZE, WidthList); + pTempString = GetFirstStringOnThisPage( pFileStringList,FILES_TEXT_FONT, 350, FILE_GAP, giFilesPage, MAX_FILE_MESSAGE_PAGE_SIZE, WidthList); // find out where this string is while( pLocatorString != pTempString ) { iCounter++; - pLocatorString = pLocatorString -> Next; + pLocatorString = pLocatorString->Next; } @@ -1693,59 +1687,59 @@ BOOLEAN HandleSpecialTerroristFile( INT32 iFileNumber, STR sPictureName ) while( pTempString ) { uiFlags = IAN_WRAP_NO_SHADOW; - // copy over string - wcscpy( sString, pTempString -> pString ); - + // copy over string + wcscpy( sString, pTempString->pString ); + if( sString[ 0 ] == 0 ) { // on last page fOnLastFilesPageFlag = TRUE; } - - + + // set up font uiFont = FILES_TEXT_FONT; if( giFilesPage == 0 ) { switch( iCounter ) { - case( 0 ): + case( 0 ): uiFont = FILES_TITLE_FONT; - break; - + break; + } } if( ( iCounter > 3 ) && ( iCounter < 7 ) ) { iFileLineWidth = 170; - iFileStartX = (UINT16) ( FILE_VIEWER_X + 180 ); + iFileStartX = (UINT16) ( FILE_VIEWER_X + 180 ); } else { // reset width iFileLineWidth = 350; - iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); + iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); } // based on the record we are at, selected X start position and the width to wrap the line, to fit around pictures - if( ( iYPositionOnPage + IanWrappedStringHeight(0, 0, ( UINT16 )iFileLineWidth, FILE_GAP, - uiFont, 0, sString, - 0, 0, 0 ) ) < MAX_FILE_MESSAGE_PAGE_SIZE ) + if( ( iYPositionOnPage + IanWrappedStringHeight(0, 0, ( UINT16 )iFileLineWidth, FILE_GAP, + uiFont, 0, sString, + 0, 0, 0 ) ) < MAX_FILE_MESSAGE_PAGE_SIZE ) { - // now print it - iYPositionOnPage += ( INT32 )IanDisplayWrappedString((UINT16) ( iFileStartX ), ( UINT16 )( FILE_VIEWER_Y + iYPositionOnPage), ( INT16 )iFileLineWidth, FILE_GAP, uiFont, FILE_TEXT_COLOR, sString,0,FALSE, uiFlags ); + // now print it + iYPositionOnPage += ( INT32 )IanDisplayWrappedString((UINT16) ( iFileStartX ), ( UINT16 )( FILE_VIEWER_Y + iYPositionOnPage), ( INT16 )iFileLineWidth, FILE_GAP, uiFont, FILE_TEXT_COLOR, sString,0,FALSE, uiFlags ); - fGoingOffCurrentPage = FALSE; + fGoingOffCurrentPage = FALSE; } else { - // gonna get cut off...end now - fGoingOffCurrentPage = TRUE; + // gonna get cut off...end now + fGoingOffCurrentPage = TRUE; } - pTempString = pTempString ->Next; - + pTempString = pTempString->Next; + if( ( pTempString == NULL ) && ( fGoingOffCurrentPage == FALSE ) ) { // on last page @@ -1773,38 +1767,38 @@ BOOLEAN HandleSpecialTerroristFile( INT32 iFileNumber, STR sPictureName ) { sprintf(sTemp, "%s%03d.sti", "FACES\\BIGFACES\\", usProfileIdsForTerroristFiles[ iFileNumber + 1 ]); } - - + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP(sTemp, VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &uiPicture)); - //Blt face to screen to + //Blt face to screen to GetVideoObject(&hHandle, uiPicture); //def: 3/24/99 -// BltVideoObject(FRAME_BUFFER, hHandle, 0,( INT16 ) ( FILE_VIEWER_X + 30 ), ( INT16 ) ( iYPositionOnPage + 5), VO_BLT_SRCTRANSPARENCY,NULL); - BltVideoObject(FRAME_BUFFER, hHandle, 0,( INT16 ) ( FILE_VIEWER_X + 30 ), ( INT16 ) ( iScreenHeightOffset + iYPositionOnPage + 21), VO_BLT_SRCTRANSPARENCY,NULL); +// BltVideoObject(FRAME_BUFFER, hHandle, 0,( INT16 ) ( FILE_VIEWER_X + 30 ), ( INT16 ) ( iYPositionOnPage + 5), VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 0,( INT16 ) ( FILE_VIEWER_X + 30 ), ( INT16 ) ( iScreenHeightOffset + iYPositionOnPage + 21), VO_BLT_SRCTRANSPARENCY,NULL); - DeleteVideoObjectFromIndex( uiPicture ); + DeleteVideoObjectFromIndex( uiPicture ); VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\InterceptBorder.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &uiPicture)); - //Blt face to screen to + //Blt face to screen to GetVideoObject(&hHandle, uiPicture); - BltVideoObject(FRAME_BUFFER, hHandle, 0,( INT16 ) ( FILE_VIEWER_X + 25 ), ( INT16 ) ( iScreenHeightOffset + iYPositionOnPage + 16 ), VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 0,( INT16 ) ( FILE_VIEWER_X + 25 ), ( INT16 ) ( iScreenHeightOffset + iYPositionOnPage + 16 ), VO_BLT_SRCTRANSPARENCY,NULL); - DeleteVideoObjectFromIndex( uiPicture ); + DeleteVideoObjectFromIndex( uiPicture ); } iCounter++; - } - - - + } + + + ClearOutWidthRecordsList( WidthList ); ClearFileStringList( ); @@ -1831,6 +1825,7 @@ BOOLEAN AddFileAboutTerrorist( INT32 iProfileId ) - + + diff --git a/Laptop/finances.cpp b/Laptop/finances.cpp index 6d042dff..c026c86e 100644 --- a/Laptop/finances.cpp +++ b/Laptop/finances.cpp @@ -32,7 +32,7 @@ #define MID_DIVLINE_Y2 iScreenHeightOffset + 263 + 20 #define BOT_DIVLINE_Y2 MID_DIVLINE_Y2 + MID_DIVLINE_Y - BOT_DIVLINE_Y #define TITLE_X iScreenWidthOffset + 140 -#define TITLE_Y iScreenHeightOffset + 33 +#define TITLE_Y iScreenHeightOffset + 33 #define TEXT_X iScreenWidthOffset + 140 #define PAGE_SIZE 17 @@ -56,13 +56,13 @@ #define RECORD_CREDIT_WIDTH 106-47 #define RECORD_DEBIT_WIDTH RECORD_CREDIT_WIDTH #define RECORD_DATE_X TOP_X+10 -#define RECORD_TRANSACTION_X RECORD_DATE_X+RECORD_DATE_WIDTH +#define RECORD_TRANSACTION_X RECORD_DATE_X+RECORD_DATE_WIDTH #define RECORD_TRANSACTION_WIDTH 500-280 #define RECORD_DEBIT_X RECORD_TRANSACTION_X+RECORD_TRANSACTION_WIDTH -#define RECORD_CREDIT_X RECORD_DEBIT_X+RECORD_DEBIT_WIDTH +#define RECORD_CREDIT_X RECORD_DEBIT_X+RECORD_DEBIT_WIDTH #define RECORD_Y iScreenHeightOffset + 107-10 #define RECORD_DATE_WIDTH 47 -#define RECORD_BALANCE_X RECORD_DATE_X+385 +#define RECORD_BALANCE_X RECORD_DATE_X+385 #define RECORD_BALANCE_WIDTH 479-385 #define RECORD_HEADER_Y iScreenHeightOffset + 90 @@ -74,7 +74,7 @@ // BUTTON defines enum{ PREV_PAGE_BUTTON=0, - NEXT_PAGE_BUTTON, + NEXT_PAGE_BUTTON, FIRST_PAGE_BUTTON, LAST_PAGE_BUTTON, }; @@ -86,7 +86,7 @@ enum{ #define NEXT_BTN_X iScreenWidthOffset + 553//577 #define PREV_BTN_X iScreenWidthOffset + 529//553 #define LAST_PAGE_X iScreenWidthOffset + 577 -#define BTN_Y iScreenHeightOffset + 53 +#define BTN_Y iScreenHeightOffset + 53 @@ -183,14 +183,13 @@ UINT32 AddTransactionToPlayersBook (UINT8 ubCode, UINT8 ubSecondCode, UINT32 uiD { // adds transaction to player's book(Financial List), returns unique id number of it // outside of the financial system(the code in this .c file), this is the only function you'll ever need - - INT32 iCurPage = iCurrentPage; + UINT32 uiId=0; - FinanceUnitPtr pFinance=pFinanceListHead; + FinanceUnitPtr pFinance=pFinanceListHead; // read in balance from file - GetBalanceFromDisk( ); + GetBalanceFromDisk( ); // process the actual data @@ -207,36 +206,36 @@ UINT32 AddTransactionToPlayersBook (UINT8 ubCode, UINT8 ubSecondCode, UINT32 uiD { gMercProfiles[ ubSecondCode ].uiTotalCostToDate += -iAmount; } - + // clear list ClearFinanceList( ); - + pFinance=pFinanceListHead; - + // update balance LaptopSaveInfo.iCurrentBalance += iAmount; uiId = ProcessAndEnterAFinacialRecord(ubCode, uiDate, iAmount, ubSecondCode, LaptopSaveInfo.iCurrentBalance); // write balance to disk - WriteBalanceToDisk( ); + WriteBalanceToDisk( ); - // append to end of file - AppendFinanceToEndOfFile( pFinance ); + // append to end of file + AppendFinanceToEndOfFile( pFinance ); // set number of pages SetLastPageInRecords( ); if( !fInFinancialMode ) { - ClearFinanceList( ); + ClearFinanceList( ); } - else + else { SetFinanceButtonStates( ); - + // force update - fPausedReDrawScreenFlag = TRUE; + fPausedReDrawScreenFlag = TRUE; } fMapScreenBottomDirty = TRUE; @@ -248,25 +247,25 @@ UINT32 AddTransactionToPlayersBook (UINT8 ubCode, UINT8 ubSecondCode, UINT32 uiD FinanceUnitPtr GetFinance(UINT32 uiId) { FinanceUnitPtr pFinance=pFinanceListHead; - - // get a finance object and return a pointer to it, the obtaining of the + + // get a finance object and return a pointer to it, the obtaining of the // finance object is via a unique ID the programmer must store // , it is returned on addition of a financial transaction // error check if(!pFinance) - return ( NULL ); - + return ( NULL ); + // look for finance object with Id while(pFinance) { - if(pFinance->uiIdNumber == uiId) - break; + if(pFinance->uiIdNumber == uiId) + break; - // next finance record - pFinance = pFinance->Next; + // next finance record + pFinance = pFinance->Next; } - + return (pFinance); } @@ -274,19 +273,19 @@ UINT32 GetTotalDebits() { // returns the total of the debits UINT32 uiDebits=0; - FinanceUnitPtr pFinance=pFinanceListHead; - + FinanceUnitPtr pFinance=pFinanceListHead; + // run to end of list while(pFinance) { // if a debit, add to debit total if(pFinance->iAmount > 0) uiDebits+=( (UINT32) (pFinance->iAmount)); - + // next finance record pFinance=pFinance->Next; } - + return uiDebits; } @@ -294,38 +293,38 @@ UINT32 GetTotalCredits() { // returns the total of the credits UINT32 uiCredits = 0; - FinanceUnitPtr pFinance=pFinanceListHead; - + FinanceUnitPtr pFinance=pFinanceListHead; + // run to end of list while( pFinance ) { // if a credit, add to credit total if( pFinance->iAmount < 0 ) uiCredits += ( (UINT32) ( pFinance->iAmount )); - + // next finance record pFinance = pFinance->Next; } - + return uiCredits; } UINT32 GetDayCredits(UINT32 usDayNumber) { - // returns the total of the credits for day( note resolution of usDayNumber is days) + // returns the total of the credits for day( note resolution of usDayNumber is days) UINT32 uiCredits = 0; - FinanceUnitPtr pFinance = pFinanceListHead; - + FinanceUnitPtr pFinance = pFinanceListHead; + while( pFinance ) { // if a credit and it occurs on day passed if(( pFinance->iAmount < 0)&&( (pFinance->uiDate / (60*24)) ==usDayNumber )) uiCredits+=((UINT32)(pFinance->iAmount)); - + // next finance record pFinance=pFinance->Next; } - + return uiCredits; } @@ -333,35 +332,35 @@ UINT32 GetDayDebits(UINT32 usDayNumber) { // returns the total of the debits UINT32 uiDebits=0; - FinanceUnitPtr pFinance=pFinanceListHead; - + FinanceUnitPtr pFinance=pFinanceListHead; + while(pFinance) { if(( pFinance->iAmount > 0 )&&( (pFinance->uiDate / (60*24) ) ==usDayNumber ) ) uiDebits += ( (UINT32) (pFinance->iAmount)); - - // next finance record + + // next finance record pFinance=pFinance->Next; } - + return uiDebits; } INT32 GetTotalToDay( INT32 sTimeInMins ) { // gets the total amount to this day - UINT32 uiTotal = 0; - FinanceUnitPtr pFinance = pFinanceListHead; - + UINT32 uiTotal = 0; + FinanceUnitPtr pFinance = pFinanceListHead; + while(pFinance) { if(((INT32)( pFinance->uiDate / (60*24)) <= sTimeInMins/(24*60) )) uiTotal += ((UINT32)(pFinance->iAmount)); - - // next finance record + + // next finance record pFinance=pFinance->Next; } - + return uiTotal; } INT32 GetYesterdaysIncome( void ) @@ -380,21 +379,21 @@ INT32 GetCurrentBalance( void ) INT32 GetTodaysIncome( void ) { - // get income + // get income return ( GetCurrentBalance() - GetTotalToDay( GetWorldTotalMin() - ( 24*60 ) )); } INT32 GetProjectedTotalDailyIncome( void ) { - // return total projected income, including what is earned today already + // return total projected income, including what is earned today already // CJC: I DON'T THINK SO! - // The point is: PredictIncomeFromPlayerMines isn't dependant on the time of day + // The point is: PredictIncomeFromPlayerMines isn't dependant on the time of day // (anymore) and this would report income of 0 at midnight! /* - if (GetWorldMinutesInDay() <= 0) - { + if (GetWorldMinutesInDay() <= 0) + { return ( 0 ); } */ @@ -414,18 +413,18 @@ INT32 GetProjectedBalance( void ) INT32 GetConfidenceValue() { - // return confidence that the projected income is infact correct - return(( ( GetWorldMinutesInDay()*100 ) / (60*24) )); + // return confidence that the projected income is infact correct + return(( ( GetWorldMinutesInDay()*100 ) / (60*24) )); } void GameInitFinances() { - // initialize finances on game start up + // initialize finances on game start up // unlink Finances data file if( (FileExists( FINANCES_DATA_FILE ) ) ) { FileClearAttributes( FINANCES_DATA_FILE ); - FileDelete( FINANCES_DATA_FILE ); + FileDelete( FINANCES_DATA_FILE ); } GetBalanceFromDisk( ); } @@ -434,65 +433,65 @@ void EnterFinances() { //entry into finanacial system, load graphics, set variables..draw screen once // set the fact we are in the financial display system - - fInFinancialMode=TRUE; - // build finances list - //OpenAndReadFinancesFile( ); + + fInFinancialMode=TRUE; + // build finances list + //OpenAndReadFinancesFile( ); // reset page we are on iCurrentPage = LaptopSaveInfo.iCurrentFinancesPage; - // get the balance - GetBalanceFromDisk( ); + // get the balance + GetBalanceFromDisk( ); - // clear the list - ClearFinanceList( ); + // clear the list + ClearFinanceList( ); - // force redraw of the entire screen - fReDrawScreenFlag=TRUE; + // force redraw of the entire screen + fReDrawScreenFlag=TRUE; - // set number of pages + // set number of pages SetLastPageInRecords( ); - // load graphics into memory - LoadFinances( ); - - // create buttons - CreateFinanceButtons( ); - + // load graphics into memory + LoadFinances( ); + + // create buttons + CreateFinanceButtons( ); + // set button state SetFinanceButtonStates( ); - // draw finance - RenderFinances( ); - -// DrawSummary( ); + // draw finance + RenderFinances( ); - // draw page number - DisplayFinancePageNumberAndDateRange( ); +// DrawSummary( ); + + // draw page number + DisplayFinancePageNumberAndDateRange( ); - //InvalidateRegion(0,0,640,480); - return; + //InvalidateRegion(0,0,640,480); + return; } void ExitFinances( void ) { LaptopSaveInfo.iCurrentFinancesPage = iCurrentPage; - + // not in finance system anymore - fInFinancialMode=FALSE; - + fInFinancialMode=FALSE; + // destroy buttons DestroyFinanceButtons( ); - // clear out list + // clear out list ClearFinanceList( ); - + // remove graphics RemoveFinances( ); return; @@ -501,29 +500,29 @@ void ExitFinances( void ) void HandleFinances( void ) { - + } void RenderFinances( void ) { - HVOBJECT hHandle; + HVOBJECT hHandle; // draw background - RenderBackGround(); - + RenderBackGround(); + // if we are on the first page, draw the summary if(iCurrentPage==0) - DrawSummary( ); + DrawSummary( ); else - DrawAPageOfRecords( ); + DrawAPageOfRecords( ); + - //title DrawFinanceTitleText( ); // draw pages and dates - DisplayFinancePageNumberAndDateRange( ); + DisplayFinancePageNumberAndDateRange( ); // display border @@ -532,7 +531,7 @@ void RenderFinances( void ) // title bar icon - BlitTitleBarIcons( ); + BlitTitleBarIcons( ); @@ -541,34 +540,34 @@ void RenderFinances( void ) BOOLEAN LoadFinances( void ) { - VOBJECT_DESC VObjectDesc; - // load Finance video objects into memory + VOBJECT_DESC VObjectDesc; + // load Finance video objects into memory // title bar - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\programtitlebar.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiTITLE)); - + // top portion of the screen background VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\Financeswindow.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiTOP)); - - // black divider line - long ( 480 length) - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + + // black divider line - long ( 480 length) + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\divisionline480.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiLONGLINE)); // the records columns - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\recordcolumns.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiLISTCOLUMNS)); - // black divider line - long ( 480 length) - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + // black divider line - long ( 480 length) + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\divisionline.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiLINE)); - + return (TRUE); } @@ -576,9 +575,9 @@ void RemoveFinances( void ) { // delete Finance video objects from memory - DeleteVideoObjectFromIndex(guiLONGLINE); + DeleteVideoObjectFromIndex(guiLONGLINE); DeleteVideoObjectFromIndex(guiLINE); - DeleteVideoObjectFromIndex(guiLISTCOLUMNS); + DeleteVideoObjectFromIndex(guiLISTCOLUMNS); DeleteVideoObjectFromIndex(guiTOP); DeleteVideoObjectFromIndex(guiTITLE); @@ -589,16 +588,15 @@ void RemoveFinances( void ) void RenderBackGround( void ) { // render generic background for Finance system - HVOBJECT hHandle; - INT32 iCounter=0; - + HVOBJECT hHandle; + // get title bar object - GetVideoObject(&hHandle, guiTITLE); + GetVideoObject(&hHandle, guiTITLE); BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X, TOP_Y - 2, VO_BLT_SRCTRANSPARENCY,NULL); - + // get and blt the top part of the screen, video object and blt to screen - GetVideoObject(&hHandle, guiTOP); - BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X, TOP_Y + 22, VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hHandle, guiTOP); + BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X, TOP_Y + 22, VO_BLT_SRCTRANSPARENCY,NULL); DrawFinanceTitleText( ); return; } @@ -609,7 +607,7 @@ void RenderBackGround( void ) void DrawSummary( void ) { // draw day's summary to screen - DrawSummaryLines( ); + DrawSummaryLines( ); DrawSummaryText( ); DrawFinanceTitleText( ); return; @@ -618,94 +616,92 @@ void DrawSummary( void ) void DrawSummaryLines( void ) { // draw divider lines on screen - HVOBJECT hHandle; - + HVOBJECT hHandle; + // the summary LINE object handle - GetVideoObject(&hHandle, guiLINE); - + GetVideoObject(&hHandle, guiLINE); + // blit summary LINE object to screen BltVideoObject(FRAME_BUFFER, hHandle, 0,DIVLINE_X, TOP_DIVLINE_Y, VO_BLT_SRCTRANSPARENCY,NULL); - BltVideoObject(FRAME_BUFFER, hHandle, 0,DIVLINE_X, TOP_DIVLINE_Y+2, VO_BLT_SRCTRANSPARENCY,NULL); - //BltVideoObject(FRAME_BUFFER, hHandle, 0,DIVLINE_X, MID_DIVLINE_Y, VO_BLT_SRCTRANSPARENCY,NULL); - BltVideoObject(FRAME_BUFFER, hHandle, 0,DIVLINE_X, BOT_DIVLINE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 0,DIVLINE_X, TOP_DIVLINE_Y+2, VO_BLT_SRCTRANSPARENCY,NULL); + //BltVideoObject(FRAME_BUFFER, hHandle, 0,DIVLINE_X, MID_DIVLINE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 0,DIVLINE_X, BOT_DIVLINE_Y, VO_BLT_SRCTRANSPARENCY,NULL); BltVideoObject(FRAME_BUFFER, hHandle, 0,DIVLINE_X, MID_DIVLINE_Y2, VO_BLT_SRCTRANSPARENCY,NULL); - //BltVideoObject(FRAME_BUFFER, hHandle, 0,DIVLINE_X, BOT_DIVLINE_Y2, VO_BLT_SRCTRANSPARENCY,NULL); + //BltVideoObject(FRAME_BUFFER, hHandle, 0,DIVLINE_X, BOT_DIVLINE_Y2, VO_BLT_SRCTRANSPARENCY,NULL); + - return; } void DrawAPageOfRecords( void ) { // this procedure will draw a series of financial records to the screen - INT32 iCurPage=1; - INT32 iCount=0; - pCurrentFinance=pFinanceListHead; + pCurrentFinance=pFinanceListHead; // (re-)render background DrawRecordsBackGround( ); - + // error check if(iCurrentPage==-1) return; - - // current page is found, render from here + + // current page is found, render from here DrawRecordsText( ); - DisplayFinancePageNumberAndDateRange( ); + DisplayFinancePageNumberAndDateRange( ); return; } void DrawRecordsBackGround( void ) { // proceudre will draw the background for the list of financial records - INT32 iCounter=6; - HVOBJECT hHandle; + INT32 iCounter=6; + HVOBJECT hHandle; // render the generic background RenderBackGround( ); - + // now the columns for(iCounter; iCounter <35; iCounter++) { // get and blt middle background to screen - GetVideoObject(&hHandle, guiLISTCOLUMNS); - BltVideoObject(FRAME_BUFFER, hHandle, 0, TOP_X + 10, TOP_Y + 18 + ( iCounter * BLOCK_HEIGHT ) + 1, VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hHandle, guiLISTCOLUMNS); + BltVideoObject(FRAME_BUFFER, hHandle, 0, TOP_X + 10, TOP_Y + 18 + ( iCounter * BLOCK_HEIGHT ) + 1, VO_BLT_SRCTRANSPARENCY,NULL); } // the divisorLines - GetVideoObject(&hHandle, guiLONGLINE); - BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X + 10, TOP_Y + 17 + ( 6 * ( BLOCK_HEIGHT ) ), VO_BLT_SRCTRANSPARENCY,NULL); - GetVideoObject(&hHandle, guiLONGLINE); - BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X + 10, TOP_Y + 19 + ( 6 * ( BLOCK_HEIGHT ) ) , VO_BLT_SRCTRANSPARENCY,NULL); - GetVideoObject(&hHandle, guiLONGLINE); - BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X + 10, TOP_Y + 19 + ( ( iCounter ) * ( BLOCK_HEIGHT ) ) , VO_BLT_SRCTRANSPARENCY,NULL); - + GetVideoObject(&hHandle, guiLONGLINE); + BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X + 10, TOP_Y + 17 + ( 6 * ( BLOCK_HEIGHT ) ), VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hHandle, guiLONGLINE); + BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X + 10, TOP_Y + 19 + ( 6 * ( BLOCK_HEIGHT ) ) , VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hHandle, guiLONGLINE); + BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X + 10, TOP_Y + 19 + ( ( iCounter ) * ( BLOCK_HEIGHT ) ) , VO_BLT_SRCTRANSPARENCY,NULL); + // the header text - DrawRecordsColumnHeadersText( ); - + DrawRecordsColumnHeadersText( ); + return; } void DrawRecordsColumnHeadersText( void ) { - // write the headers text for each column - INT16 usX, usY; - + // write the headers text for each column + INT16 usX, usY; + // font stuff SetFont(FINANCE_TEXT_FONT); - SetFontForeground(FONT_BLACK); + SetFontForeground(FONT_BLACK); SetFontBackground(FONT_BLACK); SetFontShadow(NO_SHADOW); // the date header - FindFontCenterCoordinates(RECORD_DATE_X,0,RECORD_DATE_WIDTH,0, pFinanceHeaders[0], FINANCE_TEXT_FONT,&usX, &usY); + FindFontCenterCoordinates(RECORD_DATE_X,0,RECORD_DATE_WIDTH,0, pFinanceHeaders[0], FINANCE_TEXT_FONT,&usX, &usY); mprintf(usX, RECORD_HEADER_Y, pFinanceHeaders[0]); - - // debit header + + // debit header FindFontCenterCoordinates(RECORD_DEBIT_X,0,RECORD_DEBIT_WIDTH,0, pFinanceHeaders[1], FINANCE_TEXT_FONT,&usX, &usY); mprintf(usX, RECORD_HEADER_Y, pFinanceHeaders[1]); @@ -714,11 +710,11 @@ void DrawRecordsColumnHeadersText( void ) mprintf(usX, RECORD_HEADER_Y, pFinanceHeaders[2]); // balance header - FindFontCenterCoordinates(RECORD_BALANCE_X,0,RECORD_BALANCE_WIDTH,0, pFinanceHeaders[4], FINANCE_TEXT_FONT,&usX, &usY); + FindFontCenterCoordinates(RECORD_BALANCE_X,0,RECORD_BALANCE_WIDTH,0, pFinanceHeaders[4], FINANCE_TEXT_FONT,&usX, &usY); mprintf(usX, RECORD_HEADER_Y, pFinanceHeaders[4]); - + // transaction header - FindFontCenterCoordinates(RECORD_TRANSACTION_X,0,RECORD_TRANSACTION_WIDTH,0, pFinanceHeaders[3], FINANCE_TEXT_FONT,&usX, &usY); + FindFontCenterCoordinates(RECORD_TRANSACTION_X,0,RECORD_TRANSACTION_WIDTH,0, pFinanceHeaders[3], FINANCE_TEXT_FONT,&usX, &usY); mprintf(usX, RECORD_HEADER_Y, pFinanceHeaders[3]); SetFontShadow(DEFAULT_SHADOW); @@ -727,34 +723,34 @@ void DrawRecordsColumnHeadersText( void ) void DrawRecordsText( void ) { - // draws the text of the records - FinanceUnitPtr pCurFinance=pCurrentFinance; - FinanceUnitPtr pTempFinance=pFinanceListHead; + // draws the text of the records + FinanceUnitPtr pCurFinance=pCurrentFinance; + FinanceUnitPtr pTempFinance=pFinanceListHead; CHAR16 sString[512]; - INT32 iCounter=0; + INT32 iCounter=0; INT16 usX, usY; - INT32 iBalance=0; + INT32 iBalance=0; - // setup the font stuff + // setup the font stuff SetFont(FINANCE_TEXT_FONT); - SetFontForeground(FONT_BLACK); + SetFontForeground(FONT_BLACK); SetFontBackground(FONT_BLACK); - SetFontShadow(NO_SHADOW); + SetFontShadow(NO_SHADOW); + - // anything to print if( pCurrentFinance == NULL ) { - // nothing to print + // nothing to print return; } // get balance to this point - while( pTempFinance !=pCurFinance) + while( pTempFinance !=pCurFinance) { // increment balance by amount of transaction - iBalance += pTempFinance->iAmount; - + iBalance += pTempFinance->iAmount; + // next element pTempFinance = pTempFinance->Next; } @@ -764,69 +760,69 @@ void DrawRecordsText( void ) { // get and write the date swprintf(sString, L"%d", pCurFinance->uiDate / ( 24*60 ) ); - - + + FindFontCenterCoordinates(RECORD_DATE_X,0,RECORD_DATE_WIDTH,0, sString, FINANCE_TEXT_FONT,&usX, &usY); mprintf(usX, 12+RECORD_Y + ( iCounter * ( GetFontHeight( FINANCE_TEXT_FONT ) + 6 ) ), sString); - + // get and write debit/ credit if(pCurFinance->iAmount >=0) { // increase in asset - debit - swprintf(sString, L"%d", pCurFinance->iAmount); - // insert commas - InsertCommasForDollarFigure( sString ); - // insert dollar sight for first record in the list + swprintf(sString, L"%d", pCurFinance->iAmount); + // insert commas + InsertCommasForDollarFigure( sString ); + // insert dollar sight for first record in the list //DEF: 3/19/99: removed cause we want to see the dollar sign on ALL entries -// if( iCounter == 0 ) - { - InsertDollarSignInToString( sString ); - } +// if( iCounter == 0 ) + { + InsertDollarSignInToString( sString ); + } - FindFontCenterCoordinates(RECORD_DEBIT_X,0,RECORD_DEBIT_WIDTH,0, sString, FINANCE_TEXT_FONT,&usX, &usY); - mprintf(usX, 12+RECORD_Y + (iCounter * ( GetFontHeight( FINANCE_TEXT_FONT ) + 6 ) ), sString); + FindFontCenterCoordinates(RECORD_DEBIT_X,0,RECORD_DEBIT_WIDTH,0, sString, FINANCE_TEXT_FONT,&usX, &usY); + mprintf(usX, 12+RECORD_Y + (iCounter * ( GetFontHeight( FINANCE_TEXT_FONT ) + 6 ) ), sString); } else { // decrease in asset - credit - swprintf(sString, L"%d", pCurFinance->iAmount * (-1)); - SetFontForeground(FONT_RED); - InsertCommasForDollarFigure( sString ); - // insert dollar sight for first record in the list + swprintf(sString, L"%d", pCurFinance->iAmount * (-1)); + SetFontForeground(FONT_RED); + InsertCommasForDollarFigure( sString ); + // insert dollar sight for first record in the list //DEF: 3/19/99: removed cause we want to see the dollar sign on ALL entries -// if( iCounter == 0 ) - { - InsertDollarSignInToString( sString ); - } +// if( iCounter == 0 ) + { + InsertDollarSignInToString( sString ); + } - FindFontCenterCoordinates(RECORD_CREDIT_X ,0 , RECORD_CREDIT_WIDTH,0, sString, FINANCE_TEXT_FONT,&usX, &usY); - mprintf(usX, 12+RECORD_Y + (iCounter * ( GetFontHeight( FINANCE_TEXT_FONT ) + 6 ) ), sString); - SetFontForeground(FONT_BLACK); + FindFontCenterCoordinates(RECORD_CREDIT_X ,0 , RECORD_CREDIT_WIDTH,0, sString, FINANCE_TEXT_FONT,&usX, &usY); + mprintf(usX, 12+RECORD_Y + (iCounter * ( GetFontHeight( FINANCE_TEXT_FONT ) + 6 ) ), sString); + SetFontForeground(FONT_BLACK); } // the balance to this point - iBalance = pCurFinance->iBalanceToDate; - + iBalance = pCurFinance->iBalanceToDate; + // set font based on balance if(iBalance >=0) { - SetFontForeground(FONT_BLACK); + SetFontForeground(FONT_BLACK); } else { - SetFontForeground(FONT_RED); + SetFontForeground(FONT_RED); iBalance = ( iBalance ) * ( -1 ); } // transaction string ProcessTransactionString(sString, pCurFinance); - FindFontCenterCoordinates(RECORD_TRANSACTION_X,0,RECORD_TRANSACTION_WIDTH,0, sString, FINANCE_TEXT_FONT,&usX, &usY); + FindFontCenterCoordinates(RECORD_TRANSACTION_X,0,RECORD_TRANSACTION_WIDTH,0, sString, FINANCE_TEXT_FONT,&usX, &usY); mprintf(usX, 12+RECORD_Y + (iCounter * ( GetFontHeight( FINANCE_TEXT_FONT ) + 6 ) ), sString); // print the balance string - swprintf(sString, L"%d", iBalance); + swprintf(sString, L"%d", iBalance); InsertCommasForDollarFigure( sString ); // insert dollar sight for first record in the list //DEF: 3/19/99: removed cause we want to see the dollar sign on ALL entries @@ -843,107 +839,107 @@ void DrawRecordsText( void ) // next finance pCurFinance = pCurFinance->Next; - + // last page, no finances left, return if( ! pCurFinance ) { // restore shadow - SetFontShadow(DEFAULT_SHADOW); + SetFontShadow(DEFAULT_SHADOW); return; } } // restore shadow - SetFontShadow(DEFAULT_SHADOW); + SetFontShadow(DEFAULT_SHADOW); return; } void DrawFinanceTitleText( void ) { // setup the font stuff SetFont(FINANCE_HEADER_FONT); - SetFontForeground(FONT_WHITE); + SetFontForeground(FONT_WHITE); SetFontBackground(FONT_BLACK); - // reset shadow - SetFontShadow(DEFAULT_SHADOW); - + // reset shadow + SetFontShadow(DEFAULT_SHADOW); + // draw the pages title mprintf(TITLE_X,TITLE_Y,pFinanceTitle[0]); - - + + return; } void InvalidateLapTopScreen( void ) { // invalidates blit region to force refresh of screen - + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_LR_Y); - + return; } void DrawSummaryText( void ) { INT16 usX, usY; - CHAR16 pString[100]; + CHAR16 pString[100]; INT32 iBalance = 0; // setup the font stuff - SetFont(FINANCE_TEXT_FONT); - SetFontForeground(FONT_BLACK); + SetFont(FINANCE_TEXT_FONT); + SetFontForeground(FONT_BLACK); SetFontBackground(FONT_BLACK); SetFontShadow(NO_SHADOW); // draw summary text to the screen mprintf(TEXT_X,YESTERDAYS_INCOME,pFinanceSummary[2]); - mprintf(TEXT_X,YESTERDAYS_OTHER,pFinanceSummary[3]); - mprintf(TEXT_X,YESTERDAYS_DEBITS,pFinanceSummary[4]); - mprintf(TEXT_X,YESTERDAYS_BALANCE,pFinanceSummary[5]); - mprintf(TEXT_X,TODAYS_INCOME,pFinanceSummary[6]); - mprintf(TEXT_X,TODAYS_OTHER,pFinanceSummary[7]); - mprintf(TEXT_X,TODAYS_DEBITS,pFinanceSummary[8]); + mprintf(TEXT_X,YESTERDAYS_OTHER,pFinanceSummary[3]); + mprintf(TEXT_X,YESTERDAYS_DEBITS,pFinanceSummary[4]); + mprintf(TEXT_X,YESTERDAYS_BALANCE,pFinanceSummary[5]); + mprintf(TEXT_X,TODAYS_INCOME,pFinanceSummary[6]); + mprintf(TEXT_X,TODAYS_OTHER,pFinanceSummary[7]); + mprintf(TEXT_X,TODAYS_DEBITS,pFinanceSummary[8]); mprintf(TEXT_X,TODAYS_CURRENT_BALANCE, pFinanceSummary[9]); mprintf(TEXT_X,TODAYS_CURRENT_FORCAST_INCOME, pFinanceSummary[10]); mprintf(TEXT_X,TODAYS_CURRENT_FORCAST_BALANCE, pFinanceSummary[11]); // draw the actual numbers - + // yesterdays income - iBalance = GetPreviousDaysIncome( ); + iBalance = GetPreviousDaysIncome( ); swprintf(pString, L"%d", iBalance ); - + InsertCommasForDollarFigure( pString ); if( iBalance != 0 ) InsertDollarSignInToString( pString ); - FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); - + FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); + mprintf(usX,YESTERDAYS_INCOME,pString); - + SetFontForeground( FONT_BLACK ); // yesterdays other - iBalance = GetYesterdaysOtherDeposits( ); + iBalance = GetYesterdaysOtherDeposits( ); swprintf(pString, L"%d", iBalance ); - + InsertCommasForDollarFigure( pString ); if( iBalance != 0 ) InsertDollarSignInToString( pString ); - - FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); - + + FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); + mprintf(usX,YESTERDAYS_OTHER,pString); - + SetFontForeground( FONT_RED ); // yesterdays debits - iBalance = GetYesterdaysDebits( ); + iBalance = GetYesterdaysDebits( ); if( iBalance < 0 ) { SetFontForeground( FONT_RED ); @@ -951,20 +947,20 @@ void DrawSummaryText( void ) } swprintf(pString, L"%d", iBalance ); - + InsertCommasForDollarFigure( pString ); if( iBalance != 0 ) InsertDollarSignInToString( pString ); - - FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); - + + FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); + mprintf(usX,YESTERDAYS_DEBITS,pString); - + SetFontForeground( FONT_BLACK ); // yesterdays balance..ending balance..so todays balance then - iBalance = GetTodaysBalance( ); - + iBalance = GetTodaysBalance( ); + if( iBalance < 0 ) { SetFontForeground( FONT_RED ); @@ -975,44 +971,44 @@ void DrawSummaryText( void ) InsertCommasForDollarFigure( pString ); if( iBalance != 0 ) InsertDollarSignInToString( pString ); - - FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); - + + FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); + mprintf(usX,YESTERDAYS_BALANCE,pString); - + SetFontForeground( FONT_BLACK ); // todays income - iBalance = GetTodaysDaysIncome( ); + iBalance = GetTodaysDaysIncome( ); swprintf(pString, L"%d", iBalance ); - + InsertCommasForDollarFigure( pString ); if( iBalance != 0 ) InsertDollarSignInToString( pString ); - - FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); - + + FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); + mprintf(usX,TODAYS_INCOME,pString); - + SetFontForeground( FONT_BLACK ); // todays other - iBalance = GetTodaysOtherDeposits( ); + iBalance = GetTodaysOtherDeposits( ); swprintf(pString, L"%d", iBalance ); - + InsertCommasForDollarFigure( pString ); if( iBalance != 0 ) InsertDollarSignInToString( pString ); - - FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); - + + FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); + mprintf(usX,TODAYS_OTHER,pString); - + SetFontForeground( FONT_RED ); // todays debits - iBalance = GetTodaysDebits( ); - + iBalance = GetTodaysDebits( ); + // absolute value if( iBalance < 0 ) { @@ -1020,15 +1016,15 @@ void DrawSummaryText( void ) } swprintf(pString, L"%d", iBalance ); - + InsertCommasForDollarFigure( pString ); if( iBalance != 0 ) InsertDollarSignInToString( pString ); - - FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); - + + FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); + mprintf(usX,TODAYS_DEBITS,pString); - + SetFontForeground( FONT_BLACK ); // todays current balance @@ -1045,27 +1041,27 @@ void DrawSummaryText( void ) swprintf(pString, L"%d", iBalance ); } - InsertCommasForDollarFigure( pString ); - if( iBalance != 0 ) - InsertDollarSignInToString( pString ); - - FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); - mprintf(usX,TODAYS_CURRENT_BALANCE,pString); - SetFontForeground( FONT_BLACK ); - - - // todays forcast income - iBalance = GetProjectedTotalDailyIncome( ); - swprintf(pString, L"%d", iBalance ); - InsertCommasForDollarFigure( pString ); if( iBalance != 0 ) InsertDollarSignInToString( pString ); - - FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); - + + FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); + mprintf(usX,TODAYS_CURRENT_BALANCE,pString); + SetFontForeground( FONT_BLACK ); + + + // todays forcast income + iBalance = GetProjectedTotalDailyIncome( ); + swprintf(pString, L"%d", iBalance ); + + InsertCommasForDollarFigure( pString ); + if( iBalance != 0 ) + InsertDollarSignInToString( pString ); + + FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); + mprintf(usX,TODAYS_CURRENT_FORCAST_INCOME,pString); - + SetFontForeground( FONT_BLACK ); @@ -1083,15 +1079,15 @@ void DrawSummaryText( void ) swprintf(pString, L"%d", iBalance ); } - InsertCommasForDollarFigure( pString ); + InsertCommasForDollarFigure( pString ); if( iBalance != 0 ) InsertDollarSignInToString( pString ); - - FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); - mprintf(usX,TODAYS_CURRENT_FORCAST_BALANCE,pString); - SetFontForeground( FONT_BLACK ); - + FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); + mprintf(usX,TODAYS_CURRENT_FORCAST_BALANCE,pString); + SetFontForeground( FONT_BLACK ); + + // reset the shadow SetFontShadow(DEFAULT_SHADOW); @@ -1102,14 +1098,14 @@ void DrawSummaryText( void ) void OpenAndReadFinancesFile( void ) { - // this procedure will open and read in data to the finance list - HWFILE hFileHandle; - UINT8 ubCode, ubSecondCode; + // this procedure will open and read in data to the finance list + HWFILE hFileHandle; + UINT8 ubCode, ubSecondCode; UINT32 uiDate; INT32 iAmount; INT32 iBalanceToDate; - INT32 iBytesRead=0; - UINT32 uiByteCount=0; + INT32 iBytesRead=0; + UINT32 uiByteCount=0; // clear out the old list ClearFinanceList( ); @@ -1119,54 +1115,54 @@ void OpenAndReadFinancesFile( void ) return; // open file - hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); // failed to get file, return if(!hFileHandle) { - // close file + // close file FileClose( hFileHandle ); return; - } + } // make sure file is more than 0 length - if ( FileGetSize( hFileHandle ) == 0 ) + if ( FileGetSize( hFileHandle ) == 0 ) { - FileClose( hFileHandle ); + FileClose( hFileHandle ); return; } - + // read in balance // write balance to disk first - FileRead( hFileHandle, &(LaptopSaveInfo.iCurrentBalance), sizeof ( INT32 ), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &(LaptopSaveInfo.iCurrentBalance), sizeof ( INT32 ), (UINT32 *)&iBytesRead ); uiByteCount += sizeof( INT32 ); AssertMsg( iBytesRead, "Failed To Read Data Entry"); // file exists, read in data, continue until file end - while( FileGetSize( hFileHandle ) > uiByteCount) + while( FileGetSize( hFileHandle ) > uiByteCount) { - + // read in other data - FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &ubSecondCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &uiDate, sizeof(UINT32), (UINT32 *)&iBytesRead ); - FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); - FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); AssertMsg( iBytesRead, "Failed To Read Data Entry"); // add transaction - ProcessAndEnterAFinacialRecord(ubCode, uiDate, iAmount, ubSecondCode, iBalanceToDate); + ProcessAndEnterAFinacialRecord(ubCode, uiDate, iAmount, ubSecondCode, iBalanceToDate); // increment byte counter - uiByteCount += sizeof( INT32 ) + sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32 ); - } - - // close file + uiByteCount += sizeof( INT32 ) + sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32 ); + } + + // close file FileClose( hFileHandle ); - + return; } @@ -1174,31 +1170,31 @@ void OpenAndReadFinancesFile( void ) void ClearFinanceList( void ) { // remove each element from list of transactions - FinanceUnitPtr pFinanceList=pFinanceListHead; - FinanceUnitPtr pFinanceNode=pFinanceList; + FinanceUnitPtr pFinanceList=pFinanceListHead; + FinanceUnitPtr pFinanceNode=pFinanceList; // while there are elements in the list left, delete them while( pFinanceList ) { - // set node to list head + // set node to list head pFinanceNode=pFinanceList; - + // set list head to next node pFinanceList=pFinanceList->Next; - + // delete current node MemFree(pFinanceNode); } - pCurrentFinance = NULL; - pFinanceListHead = NULL; + pCurrentFinance = NULL; + pFinanceListHead = NULL; return; } UINT32 ProcessAndEnterAFinacialRecord( UINT8 ubCode, UINT32 uiDate, INT32 iAmount, UINT8 ubSecondCode, INT32 iBalanceToDate ) { - UINT32 uiId = 0; - FinanceUnitPtr pFinance=pFinanceListHead; + UINT32 uiId = 0; + FinanceUnitPtr pFinance=pFinanceListHead; // add to finance list if(pFinance) @@ -1206,62 +1202,62 @@ UINT32 ProcessAndEnterAFinacialRecord( UINT8 ubCode, UINT32 uiDate, INT32 iAmoun // go to end of list while(pFinance->Next) pFinance=pFinance->Next; - + // alloc space pFinance->Next = (finance *) MemAlloc(sizeof(FinanceUnit)); - + // increment id number uiId = pFinance->uiIdNumber + 1; - + // set up information passed pFinance = pFinance->Next; pFinance->Next = NULL; pFinance->ubCode = ubCode; - pFinance->ubSecondCode = ubSecondCode; + pFinance->ubSecondCode = ubSecondCode; pFinance->uiDate = uiDate; pFinance->iAmount = iAmount; - pFinance->uiIdNumber = uiId; - pFinance->iBalanceToDate = iBalanceToDate; - - + pFinance->uiIdNumber = uiId; + pFinance->iBalanceToDate = iBalanceToDate; + + } else { // alloc space uiId = ReadInLastElementOfFinanceListAndReturnIdNumber( ); pFinance = (FinanceUnitPtr) MemAlloc(sizeof(FinanceUnit)); - + // setup info passed pFinance->Next = NULL; pFinance->ubCode = ubCode; - pFinance->ubSecondCode = ubSecondCode; + pFinance->ubSecondCode = ubSecondCode; pFinance->uiDate = uiDate; pFinance->iAmount= iAmount; - pFinance->uiIdNumber = uiId; - pFinance->iBalanceToDate = iBalanceToDate; - pFinanceListHead = pFinance; + pFinance->uiIdNumber = uiId; + pFinance->iBalanceToDate = iBalanceToDate; + pFinanceListHead = pFinance; } - pCurrentFinance = pFinanceListHead; - + pCurrentFinance = pFinanceListHead; + return uiId; } void CreateFinanceButtons( void ) { - giFinanceButtonImage[PREV_PAGE_BUTTON] = LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,0,-1,1,-1 ); + giFinanceButtonImage[PREV_PAGE_BUTTON] = LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,0,-1,1,-1 ); giFinanceButton[PREV_PAGE_BUTTON] = QuickCreateButton( giFinanceButtonImage[PREV_PAGE_BUTTON], PREV_BTN_X, BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnFinanceDisplayPrevPageCallBack); - giFinanceButtonImage[NEXT_PAGE_BUTTON]= UseLoadedButtonImage( giFinanceButtonImage[PREV_PAGE_BUTTON] ,-1,6,-1,7,-1 ); + giFinanceButtonImage[NEXT_PAGE_BUTTON]= UseLoadedButtonImage( giFinanceButtonImage[PREV_PAGE_BUTTON] ,-1,6,-1,7,-1 ); giFinanceButton[NEXT_PAGE_BUTTON] = QuickCreateButton( giFinanceButtonImage[NEXT_PAGE_BUTTON], NEXT_BTN_X, BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnFinanceDisplayNextPageCallBack); //button to go to the first page - giFinanceButtonImage[FIRST_PAGE_BUTTON]= UseLoadedButtonImage( giFinanceButtonImage[PREV_PAGE_BUTTON], -1,3,-1,4,-1 ); + giFinanceButtonImage[FIRST_PAGE_BUTTON]= UseLoadedButtonImage( giFinanceButtonImage[PREV_PAGE_BUTTON], -1,3,-1,4,-1 ); giFinanceButton[FIRST_PAGE_BUTTON] = QuickCreateButton( giFinanceButtonImage[FIRST_PAGE_BUTTON], FIRST_PAGE_X, BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnFinanceFirstLastPageCallBack); @@ -1269,19 +1265,19 @@ void CreateFinanceButtons( void ) MSYS_SetBtnUserData( giFinanceButton[FIRST_PAGE_BUTTON], 0, 0 ); //button to go to the last page - giFinanceButtonImage[LAST_PAGE_BUTTON]= UseLoadedButtonImage( giFinanceButtonImage[PREV_PAGE_BUTTON], -1,9,-1,10,-1 ); + giFinanceButtonImage[LAST_PAGE_BUTTON]= UseLoadedButtonImage( giFinanceButtonImage[PREV_PAGE_BUTTON], -1,9,-1,10,-1 ); giFinanceButton[LAST_PAGE_BUTTON] = QuickCreateButton( giFinanceButtonImage[LAST_PAGE_BUTTON], LAST_PAGE_X, BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnFinanceFirstLastPageCallBack); MSYS_SetBtnUserData( giFinanceButton[LAST_PAGE_BUTTON], 0, 1 ); - - + + SetButtonCursor(giFinanceButton[0], CURSOR_LAPTOP_SCREEN); - SetButtonCursor(giFinanceButton[1], CURSOR_LAPTOP_SCREEN); - SetButtonCursor(giFinanceButton[2], CURSOR_LAPTOP_SCREEN); - SetButtonCursor(giFinanceButton[3], CURSOR_LAPTOP_SCREEN); + SetButtonCursor(giFinanceButton[1], CURSOR_LAPTOP_SCREEN); + SetButtonCursor(giFinanceButton[2], CURSOR_LAPTOP_SCREEN); + SetButtonCursor(giFinanceButton[3], CURSOR_LAPTOP_SCREEN); return; } @@ -1294,42 +1290,42 @@ void DestroyFinanceButtons( void ) { RemoveButton( giFinanceButton[ uiCnt ] ); UnloadButtonImage( giFinanceButtonImage[ uiCnt ] ); - } + } } void BtnFinanceDisplayPrevPageCallBack(GUI_BUTTON *btn,INT32 reason) { - - if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - - btn->uiFlags&=~(BUTTON_CLICKED_ON); - - // if greater than page zero, we can move back, decrement iCurrentPage counter - LoadPreviousPage( ); - pCurrentFinance=pFinanceListHead; - - // set button state - SetFinanceButtonStates( ); - fReDrawScreenFlag=TRUE; - } - + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + // if greater than page zero, we can move back, decrement iCurrentPage counter + LoadPreviousPage( ); + pCurrentFinance=pFinanceListHead; + + // set button state + SetFinanceButtonStates( ); + fReDrawScreenFlag=TRUE; + } + } void BtnFinanceDisplayNextPageCallBack(GUI_BUTTON *btn,INT32 reason) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - // increment currentPage - //IncrementCurrentPageFinancialDisplay( ); - LoadNextPage( ); + btn->uiFlags&=~(BUTTON_CLICKED_ON); + // increment currentPage + //IncrementCurrentPageFinancialDisplay( ); + LoadNextPage( ); - // set button state - SetFinanceButtonStates( ); + // set button state + SetFinanceButtonStates( ); - pCurrentFinance=pFinanceListHead; - // redraw screen - fReDrawScreenFlag=TRUE; + pCurrentFinance=pFinanceListHead; + // redraw screen + fReDrawScreenFlag=TRUE; } } @@ -1354,35 +1350,35 @@ void BtnFinanceFirstLastPageCallBack(GUI_BUTTON *btn,INT32 reason) LoadInRecords( guiLastPageInRecordsList + 1 ); iCurrentPage = guiLastPageInRecordsList + 1; - } + } // set button state SetFinanceButtonStates( ); pCurrentFinance=pFinanceListHead; // redraw screen - fReDrawScreenFlag=TRUE; + fReDrawScreenFlag=TRUE; } } void IncrementCurrentPageFinancialDisplay( void ) { - // run through list, from pCurrentFinance, to NUM_RECORDS_PER_PAGE +1 FinancialUnits - FinanceUnitPtr pTempFinance=pCurrentFinance; + // run through list, from pCurrentFinance, to NUM_RECORDS_PER_PAGE +1 FinancialUnits + FinanceUnitPtr pTempFinance=pCurrentFinance; BOOLEAN fOkToIncrementPage=FALSE; INT32 iCounter=0; // on the overview page, simply set iCurrent to head of list, and page to 1 - if(iCurrentPage==0) + if(iCurrentPage==0) { - + pCurrentFinance=pFinanceListHead; iCurrentPage=1; - + return; } - + // no list, we are on page 2 if( pTempFinance == NULL ) { @@ -1393,23 +1389,23 @@ void IncrementCurrentPageFinancialDisplay( void ) // haven't reached end of list and not yet at beginning of next page while( ( pTempFinance )&&( ! fOkToIncrementPage ) ) { - // found the next page, first record thereof + // found the next page, first record thereof if(iCounter==NUM_RECORDS_PER_PAGE+1) { fOkToIncrementPage=TRUE; - pCurrentFinance=pTempFinance->Next; + pCurrentFinance=pTempFinance->Next; } //next record pTempFinance=pTempFinance->Next; - iCounter++; + iCounter++; } // if ok to increment, increment - if(fOkToIncrementPage) + if(fOkToIncrementPage) { iCurrentPage++; - + } return; @@ -1443,11 +1439,11 @@ void ProcessTransactionString(STR16 pString, FinanceUnitPtr pFinance) case PAY_SPECK_FOR_MERC: swprintf(pString, L"%s", pTransactionText[ PAY_SPECK_FOR_MERC ], gMercProfiles[pFinance->ubSecondCode].zName); break; - + case MEDICAL_DEPOSIT: swprintf(pString, pTransactionText[ MEDICAL_DEPOSIT ] , gMercProfiles[pFinance->ubSecondCode].zNickname); break; - + case IMP_PROFILE: swprintf(pString, L"%s", pTransactionText[ IMP_PROFILE ] ); break; @@ -1457,7 +1453,7 @@ void ProcessTransactionString(STR16 pString, FinanceUnitPtr pFinance) break; case REDUCED_INSURANCE: - swprintf(pString, pTransactionText[ REDUCED_INSURANCE ], gMercProfiles[pFinance->ubSecondCode].zNickname ); + swprintf(pString, pTransactionText[ REDUCED_INSURANCE ], gMercProfiles[pFinance->ubSecondCode].zNickname ); break; case EXTENDED_INSURANCE: @@ -1481,7 +1477,7 @@ void ProcessTransactionString(STR16 pString, FinanceUnitPtr pFinance) break; case EXTENDED_CONTRACT_BY_2_WEEKS: - swprintf(pString, pTransactionAlternateText[ 3 ], gMercProfiles[pFinance->ubSecondCode].zNickname ); + swprintf(pString, pTransactionAlternateText[ 3 ], gMercProfiles[pFinance->ubSecondCode].zNickname ); break; case DEPOSIT_FROM_GOLD_MINE: @@ -1498,7 +1494,7 @@ void ProcessTransactionString(STR16 pString, FinanceUnitPtr pFinance) break; case PARTIAL_MEDICAL_REFUND: - swprintf(pString, pTransactionText[ PARTIAL_MEDICAL_REFUND ], gMercProfiles[pFinance->ubSecondCode].zNickname); + swprintf(pString, pTransactionText[ PARTIAL_MEDICAL_REFUND ], gMercProfiles[pFinance->ubSecondCode].zNickname); break; case NO_MEDICAL_REFUND: @@ -1506,7 +1502,7 @@ void ProcessTransactionString(STR16 pString, FinanceUnitPtr pFinance) break; case TRANSFER_FUNDS_TO_MERC: - swprintf(pString,pTransactionText[ TRANSFER_FUNDS_TO_MERC ], gMercProfiles[pFinance->ubSecondCode].zNickname); + swprintf(pString,pTransactionText[ TRANSFER_FUNDS_TO_MERC ], gMercProfiles[pFinance->ubSecondCode].zNickname); break; case TRANSFER_FUNDS_FROM_MERC: swprintf(pString, pTransactionText[ TRANSFER_FUNDS_FROM_MERC ], gMercProfiles[pFinance->ubSecondCode].zNickname); @@ -1531,11 +1527,11 @@ void ProcessTransactionString(STR16 pString, FinanceUnitPtr pFinance) break; case( PURCHASED_ITEM_FROM_DEALER ): - swprintf(pString, pTransactionText[ PURCHASED_ITEM_FROM_DEALER ], gMercProfiles[ pFinance->ubSecondCode ].zNickname ); + swprintf(pString, pTransactionText[ PURCHASED_ITEM_FROM_DEALER ], gMercProfiles[ pFinance->ubSecondCode ].zNickname ); break; case( MERC_DEPOSITED_MONEY_TO_PLAYER_ACCOUNT ): - swprintf(pString, pTransactionText[ MERC_DEPOSITED_MONEY_TO_PLAYER_ACCOUNT ], gMercProfiles[ pFinance->ubSecondCode ].zNickname ); + swprintf(pString, pTransactionText[ MERC_DEPOSITED_MONEY_TO_PLAYER_ACCOUNT ], gMercProfiles[ pFinance->ubSecondCode ].zNickname ); break; } @@ -1546,32 +1542,31 @@ void ProcessTransactionString(STR16 pString, FinanceUnitPtr pFinance) void DisplayFinancePageNumberAndDateRange( void ) { - // this function will go through the list of 'histories' starting at current until end or + // this function will go through the list of 'histories' starting at current until end or // MAX_PER_PAGE...it will get the date range and the page number - INT32 iLastPage=0; INT32 iCounter=0; - UINT32 uiLastDate; + UINT32 uiLastDate; FinanceUnitPtr pTempFinance=pFinanceListHead; - CHAR16 sString[50]; + CHAR16 sString[50]; - // setup the font stuff + // setup the font stuff SetFont(FINANCE_TEXT_FONT); - SetFontForeground(FONT_BLACK); + SetFontForeground(FONT_BLACK); SetFontBackground(FONT_BLACK); - SetFontShadow(NO_SHADOW); + SetFontShadow(NO_SHADOW); if( !pCurrentFinance ) { pCurrentFinance = pFinanceListHead; - if( !pCurrentFinance ) + if( !pCurrentFinance ) { - swprintf( sString, L"%s %d / %d",pFinanceHeaders[5], iCurrentPage + 1 , guiLastPageInRecordsList + 2 ); - mprintf( PAGE_NUMBER_X, PAGE_NUMBER_Y, sString ); - return; + swprintf( sString, L"%s %d / %d",pFinanceHeaders[5], iCurrentPage + 1 , guiLastPageInRecordsList + 2 ); + mprintf( PAGE_NUMBER_X, PAGE_NUMBER_Y, sString ); + return; } } - + uiLastDate=pCurrentFinance->uiDate; // find last page while(pTempFinance) @@ -1579,68 +1574,66 @@ void DisplayFinancePageNumberAndDateRange( void ) iCounter++; pTempFinance=pTempFinance->Next; } - + // get the last page - - swprintf( sString, L"%s %d / %d",pFinanceHeaders[5], iCurrentPage + 1 , guiLastPageInRecordsList + 2 ); + + swprintf( sString, L"%s %d / %d",pFinanceHeaders[5], iCurrentPage + 1 , guiLastPageInRecordsList + 2 ); mprintf( PAGE_NUMBER_X, PAGE_NUMBER_Y, sString ); - + // reset shadow - SetFontShadow(DEFAULT_SHADOW); + SetFontShadow(DEFAULT_SHADOW); } BOOLEAN WriteBalanceToDisk( void ) { // will write the current balance to disk - HWFILE hFileHandle; - INT32 iBytesWritten=0; - FinanceUnitPtr pFinanceList=pFinanceListHead; - - + HWFILE hFileHandle; + + // open file hFileHandle=FileOpen( FINANCES_DATA_FILE, FILE_ACCESS_WRITE|FILE_CREATE_ALWAYS, FALSE); // write balance to disk - FileWrite( hFileHandle, &(LaptopSaveInfo.iCurrentBalance), sizeof ( INT32 ), NULL ); - + FileWrite( hFileHandle, &(LaptopSaveInfo.iCurrentBalance), sizeof ( INT32 ), NULL ); + // close file - FileClose( hFileHandle ); + FileClose( hFileHandle ); - return( TRUE ); + return( TRUE ); } void GetBalanceFromDisk( void ) { // will grab the current blanace from disk // assuming file already openned - // this procedure will open and read in data to the finance list - HWFILE hFileHandle; - INT32 iBytesRead=0; + // this procedure will open and read in data to the finance list + HWFILE hFileHandle; + INT32 iBytesRead=0; // open file - hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); // failed to get file, return if(!hFileHandle) { LaptopSaveInfo.iCurrentBalance = 0; // close file - FileClose( hFileHandle ); + FileClose( hFileHandle ); return; - } + } - // start at beginning + // start at beginning FileSeek( hFileHandle, 0, FILE_SEEK_FROM_START); // get balance from disk first - FileRead( hFileHandle, &(LaptopSaveInfo.iCurrentBalance), sizeof ( INT32 ), (UINT32 *)&iBytesRead ); - + FileRead( hFileHandle, &(LaptopSaveInfo.iCurrentBalance), sizeof ( INT32 ), (UINT32 *)&iBytesRead ); + AssertMsg( iBytesRead, "Failed To Read Data Entry"); // close file - FileClose( hFileHandle ); + FileClose( hFileHandle ); return; } @@ -1648,102 +1641,99 @@ void GetBalanceFromDisk( void ) BOOLEAN AppendFinanceToEndOfFile( FinanceUnitPtr pFinance ) { - // will write the current finance to disk - HWFILE hFileHandle; - INT32 iBytesWritten=0; - FinanceUnitPtr pFinanceList=pFinanceListHead; - - + // will write the current finance to disk + HWFILE hFileHandle; + FinanceUnitPtr pFinanceList=pFinanceListHead; + + // open file hFileHandle=FileOpen( FINANCES_DATA_FILE, FILE_ACCESS_WRITE|FILE_OPEN_ALWAYS, FALSE); // if no file exits, do nothing if(!hFileHandle) { - // close file + // close file FileClose( hFileHandle ); - return ( FALSE ); + return ( FALSE ); } - + // go to the end if( FileSeek( hFileHandle,0,FILE_SEEK_FROM_END ) == FALSE ) { // error - FileClose( hFileHandle ); + FileClose( hFileHandle ); return( FALSE ); } - + // write finance to disk - // now write date and amount, and code - FileWrite( hFileHandle, &(pFinanceList->ubCode), sizeof ( UINT8 ), NULL ); - FileWrite( hFileHandle, &(pFinanceList->ubSecondCode), sizeof ( UINT8 ), NULL ); - FileWrite( hFileHandle, &(pFinanceList->uiDate), sizeof ( UINT32 ), NULL ); - FileWrite( hFileHandle, &(pFinanceList->iAmount), sizeof ( INT32 ), NULL ); - FileWrite( hFileHandle, &(pFinanceList->iBalanceToDate), sizeof ( INT32 ), NULL ); + // now write date and amount, and code + FileWrite( hFileHandle, &(pFinanceList->ubCode), sizeof ( UINT8 ), NULL ); + FileWrite( hFileHandle, &(pFinanceList->ubSecondCode), sizeof ( UINT8 ), NULL ); + FileWrite( hFileHandle, &(pFinanceList->uiDate), sizeof ( UINT32 ), NULL ); + FileWrite( hFileHandle, &(pFinanceList->iAmount), sizeof ( INT32 ), NULL ); + FileWrite( hFileHandle, &(pFinanceList->iBalanceToDate), sizeof ( INT32 ), NULL ); // close file - FileClose( hFileHandle ); + FileClose( hFileHandle ); - return( TRUE ); + return( TRUE ); } UINT32 ReadInLastElementOfFinanceListAndReturnIdNumber( void ) { // this function will read in the last unit in the finance list, to grab it's id number - - HWFILE hFileHandle; - INT32 iBytesRead=0; - INT32 iFileSize = 0; + + HWFILE hFileHandle; + INT32 iFileSize = 0; // no file, return if ( ! (FileExists( FINANCES_DATA_FILE ) ) ) return 0; // open file - hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); // failed to get file, return if(!hFileHandle) { - // close file + // close file FileClose( hFileHandle ); return 0; - } + } // make sure file is more than balance size + length of 1 record - 1 byte - if ( FileGetSize( hFileHandle ) < sizeof( INT32 ) + sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32 ) ) + if ( FileGetSize( hFileHandle ) < sizeof( INT32 ) + sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32 ) ) { - FileClose( hFileHandle ); - return 0; + FileClose( hFileHandle ); + return 0; } - + // size is? - iFileSize = FileGetSize( hFileHandle ); + iFileSize = FileGetSize( hFileHandle ); // done with file, close it FileClose( hFileHandle ); - // file size -1 / sizeof record in bytes is id - return ( ( iFileSize - 1 ) / ( sizeof( INT32 ) + sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32 )) ); - + // file size -1 / sizeof record in bytes is id + return ( ( iFileSize - 1 ) / ( sizeof( INT32 ) + sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32 )) ); + } void SetLastPageInRecords( void ) { // grabs the size of the file and interprets number of pages it will take up - HWFILE hFileHandle; - INT32 iBytesRead=0; + HWFILE hFileHandle; // no file, return if ( ! (FileExists( FINANCES_DATA_FILE ) ) ) return; // open file - hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); // failed to get file, return if(!hFileHandle) @@ -1751,31 +1741,31 @@ void SetLastPageInRecords( void ) LaptopSaveInfo.iCurrentBalance = 0; return; - } + } // make sure file is more than 0 length - if ( FileGetSize( hFileHandle ) == 0 ) + if ( FileGetSize( hFileHandle ) == 0 ) { - FileClose( hFileHandle ); - guiLastPageInRecordsList = 1; + FileClose( hFileHandle ); + guiLastPageInRecordsList = 1; return; } - - + + // done with file, close it FileClose( hFileHandle ); guiLastPageInRecordsList = ( ReadInLastElementOfFinanceListAndReturnIdNumber( ) - 1 )/ NUM_RECORDS_PER_PAGE; - + return; } BOOLEAN LoadPreviousPage( void ) { - + // clear out old list of records, and load in previous page worth of records - ClearFinanceList( ); + ClearFinanceList( ); // load previous page if( ( iCurrentPage == 1 )||( iCurrentPage == 0 ) ) @@ -1783,38 +1773,38 @@ BOOLEAN LoadPreviousPage( void ) iCurrentPage = 0; return ( FALSE ); } - + // now load in previous page's records, if we can - if ( LoadInRecords( iCurrentPage - 1 ) ) + if ( LoadInRecords( iCurrentPage - 1 ) ) { iCurrentPage--; return ( TRUE ); } else { - LoadInRecords( iCurrentPage ); + LoadInRecords( iCurrentPage ); return ( FALSE ); } } BOOLEAN LoadNextPage( void ) { - - // clear out old list of records, and load in previous page worth of records - ClearFinanceList( ); - - + // clear out old list of records, and load in previous page worth of records + ClearFinanceList( ); + + + // now load in previous page's records, if we can - if ( LoadInRecords( iCurrentPage + 1 ) ) + if ( LoadInRecords( iCurrentPage + 1 ) ) { iCurrentPage++; - return ( TRUE ); + return ( TRUE ); } else { LoadInRecords( iCurrentPage ); - return ( FALSE ); + return ( FALSE ); } } @@ -1822,17 +1812,17 @@ BOOLEAN LoadNextPage( void ) BOOLEAN LoadInRecords( UINT32 uiPage ) { // loads in records belogning, to page uiPage - // no file, return + // no file, return BOOLEAN fOkToContinue=TRUE; - INT32 iCount =0; - HWFILE hFileHandle; - UINT8 ubCode, ubSecondCode; + INT32 iCount =0; + HWFILE hFileHandle; + UINT8 ubCode, ubSecondCode; INT32 iBalanceToDate; UINT32 uiDate; INT32 iAmount; - INT32 iBytesRead=0; - UINT32 uiByteCount=0; - + INT32 iBytesRead=0; + UINT32 uiByteCount=0; + // check if bad page if( uiPage == 0 ) { @@ -1844,69 +1834,69 @@ BOOLEAN LoadInRecords( UINT32 uiPage ) return( FALSE ); // open file - hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); // failed to get file, return if(!hFileHandle) { - // close file + // close file FileClose( hFileHandle ); return( FALSE ); - } + } // make sure file is more than 0 length - if ( FileGetSize( hFileHandle ) == 0 ) + if ( FileGetSize( hFileHandle ) == 0 ) { - FileClose( hFileHandle ); + FileClose( hFileHandle ); return( FALSE ); } - // is the file long enough? - if( ( FileGetSize( hFileHandle ) - sizeof( INT32 ) - 1) / ( NUM_RECORDS_PER_PAGE * ( sizeof( INT32 ) + sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32 )) ) + 1 < uiPage ) + // is the file long enough? + if( ( FileGetSize( hFileHandle ) - sizeof( INT32 ) - 1) / ( NUM_RECORDS_PER_PAGE * ( sizeof( INT32 ) + sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32 )) ) + 1 < uiPage ) { // nope FileClose( hFileHandle ); - return( FALSE ); + return( FALSE ); } FileSeek( hFileHandle, sizeof( INT32 ) + ( uiPage - 1 ) * NUM_RECORDS_PER_PAGE * ( sizeof( INT32 )+ sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32)), FILE_SEEK_FROM_START ); - - uiByteCount = sizeof( INT32 )+( uiPage - 1 ) * NUM_RECORDS_PER_PAGE * ( sizeof( INT32 ) + sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32 ) ); + + uiByteCount = sizeof( INT32 )+( uiPage - 1 ) * NUM_RECORDS_PER_PAGE * ( sizeof( INT32 ) + sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32 ) ); // file exists, read in data, continue until end of page - while( ( iCount < NUM_RECORDS_PER_PAGE )&&( fOkToContinue ) &&( uiByteCount < FileGetSize( hFileHandle ) ) ) + while( ( iCount < NUM_RECORDS_PER_PAGE )&&( fOkToContinue ) &&( uiByteCount < FileGetSize( hFileHandle ) ) ) { - - // read in data - FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + + // read in data + FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &ubSecondCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &uiDate, sizeof(UINT32), (UINT32 *)&iBytesRead ); - FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); - FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); AssertMsg( iBytesRead, "Failed To Read Data Entry"); // add transaction - ProcessAndEnterAFinacialRecord(ubCode, uiDate, iAmount, ubSecondCode, iBalanceToDate); + ProcessAndEnterAFinacialRecord(ubCode, uiDate, iAmount, ubSecondCode, iBalanceToDate); // increment byte counter - uiByteCount += sizeof( INT32 ) + sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32 ); - + uiByteCount += sizeof( INT32 ) + sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32 ); + // we've overextended our welcome, and bypassed end of file, get out - if( uiByteCount >= FileGetSize( hFileHandle ) ) + if( uiByteCount >= FileGetSize( hFileHandle ) ) { // not ok to continue fOkToContinue = FALSE; } iCount++; - } - - // close file + } + + // close file FileClose( hFileHandle ); // check to see if we in fact have a list to display - if( pFinanceListHead == NULL ) + if( pFinanceListHead == NULL ) { // got no records, return false return( FALSE ); @@ -1920,8 +1910,8 @@ BOOLEAN LoadInRecords( UINT32 uiPage ) void InsertCommasForDollarFigure( STR16 pString ) { - INT16 sCounter =0; - INT16 sZeroCount =0; + INT16 sCounter =0; + INT16 sZeroCount =0; INT16 sTempCounter = 0; INT16 sEndPosition = 0; @@ -1930,7 +1920,7 @@ void InsertCommasForDollarFigure( STR16 pString ) { sCounter++; } - + // negative? if( pString[0] == '-' ) { @@ -1946,19 +1936,19 @@ void InsertCommasForDollarFigure( STR16 pString ) } // at end, start backing up until beginning - while( sCounter > sEndPosition ) + while( sCounter > sEndPosition ) { - - + + // enough for a comma? if( sZeroCount==3 ) { // reset count sZeroCount =0; - // set tempcounter to current counter + // set tempcounter to current counter sTempCounter = sCounter; - // run until end + // run until end while( pString[ sTempCounter ] != 0 ) { sTempCounter++; @@ -1987,7 +1977,7 @@ void InsertCommasForDollarFigure( STR16 pString ) void InsertDollarSignInToString( STR16 pString ) { // run to end of string, copy everything in string 2 places right, insert a space at pString[ 1 ] and a L'$' at pString[ 0 ] - + INT32 iCounter =0; // run to end of string @@ -1995,55 +1985,55 @@ void InsertDollarSignInToString( STR16 pString ) { iCounter++; } - + // now copy over while( iCounter >= 0 ) { - pString[ iCounter + 1] = pString[ iCounter ]; + pString[ iCounter + 1] = pString[ iCounter ]; iCounter--; } pString[ 0 ] = L'$'; return; -} +} INT32 GetPreviousBalanceToDate( void ) { // will grab balance to date of previous record // grabs the size of the file and interprets number of pages it will take up - HWFILE hFileHandle; - INT32 iBytesRead=0; - INT32 iBalanceToDate=0; + HWFILE hFileHandle; + INT32 iBytesRead=0; + INT32 iBalanceToDate=0; // no file, return if ( ! (FileExists( FINANCES_DATA_FILE ) ) ) return 0; // open file - hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); // failed to get file, return if(!hFileHandle) { - // close file + // close file FileClose( hFileHandle ); return 0; - } - - if ( FileGetSize( hFileHandle ) < sizeof( INT32 ) + sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32 ) ) - { - FileClose( hFileHandle ); - return 0; } - FileSeek( hFileHandle, ( sizeof( INT32 ) ) , FILE_SEEK_FROM_END ); - + if ( FileGetSize( hFileHandle ) < sizeof( INT32 ) + sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32 ) ) + { + FileClose( hFileHandle ); + return 0; + } + + FileSeek( hFileHandle, ( sizeof( INT32 ) ) , FILE_SEEK_FROM_END ); + // get balnce to date - FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); - + FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); + FileClose( hFileHandle ); return iBalanceToDate; @@ -2053,67 +2043,65 @@ INT32 GetPreviousBalanceToDate( void ) INT32 GetPreviousDaysBalance( void ) { // find out what today is, then go back 2 days, get balance for that day - INT32 iPreviousDaysBalance = 0; - HWFILE hFileHandle; - INT32 iBytesRead=0; - UINT32 iDateInMinutes = 0; + HWFILE hFileHandle; + INT32 iBytesRead=0; + UINT32 iDateInMinutes = 0; BOOLEAN fOkToContinue = FALSE; UINT32 iByteCount = 0; - INT32 iCounter =1; + INT32 iCounter =1; UINT8 ubCode; UINT8 ubSecondCode; UINT32 uiDate; INT32 iAmount; INT32 iBalanceToDate = 0; - BOOLEAN fGoneTooFar= FALSE; - INT32 iFileSize = 0; + BOOLEAN fGoneTooFar= FALSE; // what day is it? - iDateInMinutes = GetWorldTotalMin( ) - ( 60 * 24 ); - + iDateInMinutes = GetWorldTotalMin( ) - ( 60 * 24 ); + // error checking // no file, return if ( ! (FileExists( FINANCES_DATA_FILE ) ) ) return 0; // open file - hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); // failed to get file, return if(!hFileHandle) { - // close file + // close file FileClose( hFileHandle ); return 0; - } - - // start at the end, move back until Date / 24 * 60 on the record is = ( iDateInMinutes / ( 24 * 60 ) ) - 2 - iByteCount+= sizeof( INT32 ); - // loop, make sure we don't pass beginning of file, if so, we have an error, and check for condifition above + } + + // start at the end, move back until Date / 24 * 60 on the record is = ( iDateInMinutes / ( 24 * 60 ) ) - 2 + iByteCount+= sizeof( INT32 ); + // loop, make sure we don't pass beginning of file, if so, we have an error, and check for condifition above while( ( iByteCount < FileGetSize( hFileHandle ) ) && ( ! fOkToContinue ) && ( ! fGoneTooFar ) ) { - FileSeek( hFileHandle, RECORD_SIZE * iCounter , FILE_SEEK_FROM_END ); - - // incrment byte count - iByteCount += RECORD_SIZE; - + FileSeek( hFileHandle, RECORD_SIZE * iCounter , FILE_SEEK_FROM_END ); + + // incrment byte count + iByteCount += RECORD_SIZE; + FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &ubSecondCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &uiDate, sizeof(UINT32), (UINT32 *)&iBytesRead ); - FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); - FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); - + FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); + // check to see if we are far enough if( ( uiDate / ( 24 * 60 ) ) == ( iDateInMinutes / ( 24 * 60 ) ) - 2 ) { fOkToContinue = TRUE; - } + } if( iDateInMinutes / ( 24 * 60 ) >= 2 ) { // there are no entries for the previous day - if( ( uiDate / ( 24 * 60 ) ) < ( iDateInMinutes / ( 24 * 60 ) ) - 2 ) + if( ( uiDate / ( 24 * 60 ) ) < ( iDateInMinutes / ( 24 * 60 ) ) - 2 ) { fGoneTooFar = TRUE; @@ -2125,16 +2113,16 @@ INT32 GetPreviousDaysBalance( void ) } iCounter++; } - + if( fOkToContinue == FALSE ) { // reached beginning of file, nothing found, return 0 - // close file - FileClose( hFileHandle ); + // close file + FileClose( hFileHandle ); return 0; } - FileClose( hFileHandle ); + FileClose( hFileHandle ); // reached 3 days ago, or beginning of file return iBalanceToDate; @@ -2146,71 +2134,70 @@ INT32 GetPreviousDaysBalance( void ) INT32 GetTodaysBalance( void ) { // find out what today is, then go back 2 days, get balance for that day - INT32 iPreviousDaysBalance = 0; - HWFILE hFileHandle; - INT32 iBytesRead=0; - UINT32 iDateInMinutes = 0; + HWFILE hFileHandle; + INT32 iBytesRead=0; + UINT32 iDateInMinutes = 0; BOOLEAN fOkToContinue = FALSE; UINT32 iByteCount = 0; - INT32 iCounter = 1; + INT32 iCounter = 1; UINT8 ubCode; UINT8 ubSecondCode; UINT32 uiDate; INT32 iAmount; INT32 iBalanceToDate = 0; - BOOLEAN fGoneTooFar= FALSE; + BOOLEAN fGoneTooFar= FALSE; + - // what day is it? - iDateInMinutes = GetWorldTotalMin( ); - + iDateInMinutes = GetWorldTotalMin( ); + // error checking // no file, return if ( ! (FileExists( FINANCES_DATA_FILE ) ) ) return 0; // open file - hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); // failed to get file, return if(!hFileHandle) { - // close file + // close file FileClose( hFileHandle ); return 0; - } - - // start at the end, move back until Date / 24 * 60 on the record is = ( iDateInMinutes / ( 24 * 60 ) ) - 2 - iByteCount+= sizeof( INT32 ); + } - // loop, make sure we don't pass beginning of file, if so, we have an error, and check for condifition above + // start at the end, move back until Date / 24 * 60 on the record is = ( iDateInMinutes / ( 24 * 60 ) ) - 2 + iByteCount+= sizeof( INT32 ); + + // loop, make sure we don't pass beginning of file, if so, we have an error, and check for condifition above while( ( iByteCount < FileGetSize( hFileHandle ) ) && ( ! fOkToContinue ) && ( ! fGoneTooFar ) ) { - FileSeek( hFileHandle, RECORD_SIZE * iCounter , FILE_SEEK_FROM_END ); - - // incrment byte count - iByteCount += RECORD_SIZE; - + FileSeek( hFileHandle, RECORD_SIZE * iCounter , FILE_SEEK_FROM_END ); + + // incrment byte count + iByteCount += RECORD_SIZE; + FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &ubSecondCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &uiDate, sizeof(UINT32), (UINT32 *)&iBytesRead ); - FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); - FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); - + FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); + AssertMsg( iBytesRead, "Failed To Read Data Entry"); // check to see if we are far enough if( ( uiDate / ( 24 * 60 ) ) == ( iDateInMinutes / ( 24 * 60 ) ) - 1 ) { fOkToContinue = TRUE; - } + } iCounter++; } - - - FileClose( hFileHandle ); + + + FileClose( hFileHandle ); // not found ? if( fOkToContinue == FALSE ) @@ -2226,75 +2213,74 @@ INT32 GetTodaysBalance( void ) INT32 GetPreviousDaysIncome( void ) { - // will return the income from the previous day - // which is todays starting balance - yesterdays starting balance - INT32 iPreviousDaysBalance = 0; - HWFILE hFileHandle; - INT32 iBytesRead=0; - UINT32 iDateInMinutes = 0; + // will return the income from the previous day + // which is todays starting balance - yesterdays starting balance + HWFILE hFileHandle; + INT32 iBytesRead=0; + UINT32 iDateInMinutes = 0; BOOLEAN fOkToContinue = FALSE; BOOLEAN fOkToIncrement = FALSE; UINT32 iByteCount = 0; - INT32 iCounter = 1; + INT32 iCounter = 1; UINT8 ubCode; UINT8 ubSecondCode; UINT32 uiDate; INT32 iAmount; INT32 iBalanceToDate; - BOOLEAN fGoneTooFar = FALSE; + BOOLEAN fGoneTooFar = FALSE; INT32 iTotalPreviousIncome = 0; // what day is it? - iDateInMinutes = GetWorldTotalMin( ); - + iDateInMinutes = GetWorldTotalMin( ); + // error checking // no file, return if ( ! (FileExists( FINANCES_DATA_FILE ) ) ) return 0; // open file - hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); // failed to get file, return if(!hFileHandle) { - // close file + // close file FileClose( hFileHandle ); return 0; - } - - // start at the end, move back until Date / 24 * 60 on the record is = ( iDateInMinutes / ( 24 * 60 ) ) - 2 - iByteCount+= sizeof( INT32 ); + } - // loop, make sure we don't pass beginning of file, if so, we have an error, and check for condifition above + // start at the end, move back until Date / 24 * 60 on the record is = ( iDateInMinutes / ( 24 * 60 ) ) - 2 + iByteCount+= sizeof( INT32 ); + + // loop, make sure we don't pass beginning of file, if so, we have an error, and check for condifition above while( ( iByteCount < FileGetSize( hFileHandle ) ) && ( ! fOkToContinue ) &&( !fGoneTooFar ) ) { - FileGetPos( hFileHandle ); + FileGetPos( hFileHandle ); - FileSeek( hFileHandle, RECORD_SIZE * iCounter , FILE_SEEK_FROM_END ); - - // incrment byte count - iByteCount += RECORD_SIZE; + FileSeek( hFileHandle, RECORD_SIZE * iCounter , FILE_SEEK_FROM_END ); - FileGetPos( hFileHandle ); + // incrment byte count + iByteCount += RECORD_SIZE; + + FileGetPos( hFileHandle ); FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &ubSecondCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &uiDate, sizeof(UINT32), (UINT32 *)&iBytesRead ); - FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); - FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); - + FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); + AssertMsg( iBytesRead, "Failed To Read Data Entry"); // check to see if we are far enough if( ( uiDate / ( 24 * 60 ) )== ( iDateInMinutes / ( 24 * 60 ) ) - 2 ) { fOkToContinue = TRUE; - } + } // there are no entries for the previous day - if( ( uiDate / ( 24 * 60 ) ) < ( iDateInMinutes / ( 24 * 60 ) ) - 2 ) - { + if( ( uiDate / ( 24 * 60 ) ) < ( iDateInMinutes / ( 24 * 60 ) ) - 2 ) + { fGoneTooFar = TRUE; } @@ -2310,14 +2296,14 @@ INT32 GetPreviousDaysIncome( void ) // increment total iTotalPreviousIncome += iAmount; } - + iCounter++; } - - // now run back one more day and add up the total of deposits - // close file + // now run back one more day and add up the total of deposits + + // close file FileClose( hFileHandle ); return( iTotalPreviousIncome ); @@ -2327,67 +2313,66 @@ INT32 GetPreviousDaysIncome( void ) INT32 GetTodaysDaysIncome( void ) { - // will return the income from the previous day - // which is todays starting balance - yesterdays starting balance - INT32 iPreviousDaysBalance = 0; - HWFILE hFileHandle; - INT32 iBytesRead=0; - UINT32 iDateInMinutes = 0; + // will return the income from the previous day + // which is todays starting balance - yesterdays starting balance + HWFILE hFileHandle; + INT32 iBytesRead=0; + UINT32 iDateInMinutes = 0; BOOLEAN fOkToContinue = FALSE; BOOLEAN fOkToIncrement = FALSE; UINT32 iByteCount = 0; - INT32 iCounter = 1; + INT32 iCounter = 1; UINT8 ubCode; UINT8 ubSecondCode; UINT32 uiDate; INT32 iAmount; INT32 iBalanceToDate; - BOOLEAN fGoneTooFar = FALSE; + BOOLEAN fGoneTooFar = FALSE; INT32 iTotalIncome = 0; // what day is it? - iDateInMinutes = GetWorldTotalMin( ); - + iDateInMinutes = GetWorldTotalMin( ); + // error checking // no file, return if ( ! (FileExists( FINANCES_DATA_FILE ) ) ) return 0; // open file - hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); // failed to get file, return if(!hFileHandle) { - // close file - FileClose( hFileHandle ); + // close file + FileClose( hFileHandle ); return 0; - } - - // start at the end, move back until Date / 24 * 60 on the record is = ( iDateInMinutes / ( 24 * 60 ) ) - 2 - iByteCount+=sizeof( INT32 ); + } - // loop, make sure we don't pass beginning of file, if so, we have an error, and check for condifition above + // start at the end, move back until Date / 24 * 60 on the record is = ( iDateInMinutes / ( 24 * 60 ) ) - 2 + iByteCount+=sizeof( INT32 ); + + // loop, make sure we don't pass beginning of file, if so, we have an error, and check for condifition above while( ( iByteCount < FileGetSize( hFileHandle ) ) && ( ! fOkToContinue ) &&( !fGoneTooFar ) ) { - FileSeek( hFileHandle, RECORD_SIZE * iCounter , FILE_SEEK_FROM_END ); - - // incrment byte count - iByteCount += RECORD_SIZE; - + FileSeek( hFileHandle, RECORD_SIZE * iCounter , FILE_SEEK_FROM_END ); + + // incrment byte count + iByteCount += RECORD_SIZE; + FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &ubSecondCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &uiDate, sizeof(UINT32), (UINT32 *)&iBytesRead ); - FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); - FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); - + FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); + AssertMsg( iBytesRead, "Failed To Read Data Entry"); // check to see if we are far enough if( ( uiDate / ( 24 * 60 ) ) == ( iDateInMinutes / ( 24 * 60 ) ) - 1 ) { fOkToContinue = TRUE; - } + } if( ( uiDate / ( 24 * 60 ) ) > ( iDateInMinutes / ( 24 * 60 ) ) - 1 ) { @@ -2401,20 +2386,20 @@ INT32 GetTodaysDaysIncome( void ) iTotalIncome += iAmount; fOkToIncrement = FALSE; } - + iCounter++; } - + // no entries, return nothing - no income for the day if( fGoneTooFar == TRUE ) { - FileClose( hFileHandle ); + FileClose( hFileHandle ); return 0; } - // now run back one more day and add up the total of deposits + // now run back one more day and add up the total of deposits - // close file + // close file FileClose( hFileHandle ); return( iTotalIncome ); @@ -2424,7 +2409,7 @@ INT32 GetTodaysDaysIncome( void ) void SetFinanceButtonStates( void ) { // this function will look at what page we are viewing, enable and disable buttons as needed - + if( iCurrentPage == 0 ) { // first page, disable left buttons @@ -2441,9 +2426,9 @@ void SetFinanceButtonStates( void ) if( LoadNextPage( ) ) { // decrement page - LoadPreviousPage( ); - - + LoadPreviousPage( ); + + // enable buttons EnableButton( giFinanceButton[ NEXT_PAGE_BUTTON ] ); EnableButton( giFinanceButton[ LAST_PAGE_BUTTON ] ); @@ -2451,8 +2436,8 @@ void SetFinanceButtonStates( void ) } else { - DisableButton( giFinanceButton[ NEXT_PAGE_BUTTON ] ); - DisableButton( giFinanceButton[ LAST_PAGE_BUTTON ] ); + DisableButton( giFinanceButton[ NEXT_PAGE_BUTTON ] ); + DisableButton( giFinanceButton[ LAST_PAGE_BUTTON ] ); } } @@ -2461,65 +2446,64 @@ INT32 GetTodaysOtherDeposits( void ) { // grab todays other deposits - INT32 iPreviousDaysBalance = 0; - HWFILE hFileHandle; - INT32 iBytesRead=0; - UINT32 iDateInMinutes = 0; + HWFILE hFileHandle; + INT32 iBytesRead=0; + UINT32 iDateInMinutes = 0; BOOLEAN fOkToContinue = FALSE; BOOLEAN fOkToIncrement = FALSE; UINT32 iByteCount = 0; - INT32 iCounter = 1; + INT32 iCounter = 1; UINT8 ubCode; UINT8 ubSecondCode; UINT32 uiDate; INT32 iAmount; INT32 iBalanceToDate; - BOOLEAN fGoneTooFar = FALSE; + BOOLEAN fGoneTooFar = FALSE; INT32 iTotalIncome = 0; // what day is it? - iDateInMinutes = GetWorldTotalMin( ); - + iDateInMinutes = GetWorldTotalMin( ); + // error checking // no file, return if ( ! (FileExists( FINANCES_DATA_FILE ) ) ) return 0; // open file - hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); // failed to get file, return if(!hFileHandle) { - // close file + // close file FileClose( hFileHandle ); return 0; - } - - // start at the end, move back until Date / 24 * 60 on the record is = ( iDateInMinutes / ( 24 * 60 ) ) - 2 - iByteCount+= sizeof( INT32 ); + } - // loop, make sure we don't pass beginning of file, if so, we have an error, and check for condifition above + // start at the end, move back until Date / 24 * 60 on the record is = ( iDateInMinutes / ( 24 * 60 ) ) - 2 + iByteCount+= sizeof( INT32 ); + + // loop, make sure we don't pass beginning of file, if so, we have an error, and check for condifition above while( ( iByteCount < FileGetSize( hFileHandle ) ) && ( ! fOkToContinue ) &&( !fGoneTooFar ) ) { - FileSeek( hFileHandle, RECORD_SIZE * iCounter , FILE_SEEK_FROM_END ); - - // incrment byte count - iByteCount += RECORD_SIZE; - + FileSeek( hFileHandle, RECORD_SIZE * iCounter , FILE_SEEK_FROM_END ); + + // incrment byte count + iByteCount += RECORD_SIZE; + FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &ubSecondCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &uiDate, sizeof(UINT32), (UINT32 *)&iBytesRead ); - FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); - FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); - + FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); + AssertMsg( iBytesRead, "Failed To Read Data Entry"); // check to see if we are far enough if( ( uiDate / ( 24 * 60 ) ) == ( iDateInMinutes / ( 24 * 60 ) ) - 1 ) { fOkToContinue = TRUE; - } + } if( ( uiDate / ( 24 * 60 ) ) > ( iDateInMinutes / ( 24 * 60 ) ) - 1 ) { @@ -2536,20 +2520,20 @@ INT32 GetTodaysOtherDeposits( void ) fOkToIncrement = FALSE; } } - + iCounter++; } - + // no entries, return nothing - no income for the day if( fGoneTooFar == TRUE ) { - FileClose( hFileHandle ); + FileClose( hFileHandle ); return 0; } - // now run back one more day and add up the total of deposits + // now run back one more day and add up the total of deposits - // close file + // close file FileClose( hFileHandle ); return( iTotalIncome ); @@ -2558,70 +2542,68 @@ INT32 GetTodaysOtherDeposits( void ) INT32 GetYesterdaysOtherDeposits( void ) { - - INT32 iPreviousDaysBalance = 0; - HWFILE hFileHandle; - INT32 iBytesRead=0; - UINT32 iDateInMinutes = 0; + HWFILE hFileHandle; + INT32 iBytesRead=0; + UINT32 iDateInMinutes = 0; BOOLEAN fOkToContinue = FALSE; BOOLEAN fOkToIncrement = FALSE; UINT32 iByteCount = 0; - INT32 iCounter = 1; + INT32 iCounter = 1; UINT8 ubCode; UINT8 ubSecondCode; UINT32 uiDate; INT32 iAmount; INT32 iBalanceToDate; - BOOLEAN fGoneTooFar = FALSE; + BOOLEAN fGoneTooFar = FALSE; INT32 iTotalPreviousIncome = 0; // what day is it? - iDateInMinutes = GetWorldTotalMin( ); - + iDateInMinutes = GetWorldTotalMin( ); + // error checking // no file, return if ( ! (FileExists( FINANCES_DATA_FILE ) ) ) return 0; // open file - hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); // failed to get file, return if(!hFileHandle) { - // close file + // close file FileClose( hFileHandle ); return 0; - } - - // start at the end, move back until Date / 24 * 60 on the record is = ( iDateInMinutes / ( 24 * 60 ) ) - 2 - iByteCount+= sizeof( INT32 ); + } - // loop, make sure we don't pass beginning of file, if so, we have an error, and check for condifition above + // start at the end, move back until Date / 24 * 60 on the record is = ( iDateInMinutes / ( 24 * 60 ) ) - 2 + iByteCount+= sizeof( INT32 ); + + // loop, make sure we don't pass beginning of file, if so, we have an error, and check for condifition above while( ( iByteCount < FileGetSize( hFileHandle ) ) && ( ! fOkToContinue ) &&( !fGoneTooFar ) ) { - FileSeek( hFileHandle, RECORD_SIZE * iCounter , FILE_SEEK_FROM_END ); - - // incrment byte count - iByteCount += RECORD_SIZE; - + FileSeek( hFileHandle, RECORD_SIZE * iCounter , FILE_SEEK_FROM_END ); + + // incrment byte count + iByteCount += RECORD_SIZE; + FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &ubSecondCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &uiDate, sizeof(UINT32), (UINT32 *)&iBytesRead ); - FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); - FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); - + FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); + AssertMsg( iBytesRead, "Failed To Read Data Entry"); // check to see if we are far enough if( ( uiDate / ( 24 * 60 ) )== ( iDateInMinutes / ( 24 * 60 ) ) - 2 ) { fOkToContinue = TRUE; - } + } // there are no entries for the previous day - if( ( uiDate / ( 24 * 60 ) ) < ( iDateInMinutes / ( 24 * 60 ) ) - 2 ) - { + if( ( uiDate / ( 24 * 60 ) ) < ( iDateInMinutes / ( 24 * 60 ) ) - 2 ) + { fGoneTooFar = TRUE; } @@ -2640,11 +2622,11 @@ INT32 GetYesterdaysOtherDeposits( void ) iTotalPreviousIncome += iAmount; } } - + iCounter++; } - // close file + // close file FileClose( hFileHandle ); return( iTotalPreviousIncome ); @@ -2663,7 +2645,7 @@ INT32 GetTodaysDebits( void ) INT32 GetYesterdaysDebits( void ) { // return the expenses for yesterday - + return( GetTodaysBalance( ) - GetPreviousDaysBalance( ) - GetPreviousDaysIncome( ) - GetYesterdaysOtherDeposits( ) ); } @@ -2672,7 +2654,7 @@ void LoadCurrentBalance( void ) { // will load the current balance from finances.dat file HWFILE hFileHandle; - INT32 iBytesRead=0; + INT32 iBytesRead=0; // is the first record in the file // error checking @@ -2684,24 +2666,24 @@ void LoadCurrentBalance( void ) } // open file - hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); // failed to get file, return if(!hFileHandle) { LaptopSaveInfo.iCurrentBalance= 0; - // close file + // close file FileClose( hFileHandle ); return; } - FileSeek( hFileHandle, 0 , FILE_SEEK_FROM_START ); + FileSeek( hFileHandle, 0 , FILE_SEEK_FROM_START ); FileRead( hFileHandle, &LaptopSaveInfo.iCurrentBalance, sizeof( INT32 ), (UINT32 *)&iBytesRead ); - + AssertMsg( iBytesRead, "Failed To Read Data Entry"); - // close file + // close file FileClose( hFileHandle ); @@ -2710,6 +2692,7 @@ void LoadCurrentBalance( void ) - + + diff --git a/Laptop/florist Cards.cpp b/Laptop/florist Cards.cpp index c7fe46fa..18a03edb 100644 --- a/Laptop/florist Cards.cpp +++ b/Laptop/florist Cards.cpp @@ -18,10 +18,10 @@ #define FLORIST_CARDS_SENTENCE_FONT FONT12ARIAL #define FLORIST_CARDS_SENTENCE_COLOR FONT_MCOLOR_WHITE -#define FLORIST_CARD_FIRST_POS_X LAPTOP_SCREEN_UL_X + 7 -#define FLORIST_CARD_FIRST_POS_Y LAPTOP_SCREEN_WEB_UL_Y + 72 -#define FLORIST_CARD_FIRST_OFFSET_X 174 -#define FLORIST_CARD_FIRST_OFFSET_Y 109 +#define FLORIST_CARD_FIRST_POS_X LAPTOP_SCREEN_UL_X + 7 +#define FLORIST_CARD_FIRST_POS_Y LAPTOP_SCREEN_WEB_UL_Y + 72 +#define FLORIST_CARD_FIRST_OFFSET_X 174 +#define FLORIST_CARD_FIRST_OFFSET_Y 109 #define FLORIST_CARD_CARD_WIDTH 135 #define FLORIST_CARD_CARD_HEIGHT 100 @@ -45,7 +45,7 @@ UINT32 guiCardBackground; INT8 gbCurrentlySelectedCard; //link to the card gallery -MOUSE_REGION gSelectedFloristCardsRegion[9]; +MOUSE_REGION gSelectedFloristCardsRegion[9]; void SelectFloristCardsRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); @@ -63,7 +63,7 @@ void GameInitFloristCards() BOOLEAN EnterFloristCards() { UINT16 i, j, usPosX, usPosY; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; UINT8 ubCount; InitFloristDefaults(); @@ -81,9 +81,9 @@ BOOLEAN EnterFloristCards() for(i=0; i<3; i++) { MSYS_DefineRegion( &gSelectedFloristCardsRegion[ubCount], usPosX, usPosY, (UINT16)(usPosX + FLORIST_CARD_CARD_WIDTH), (UINT16)(usPosY + FLORIST_CARD_CARD_HEIGHT), MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectFloristCardsRegionCallBack ); - MSYS_AddRegion(&gSelectedFloristCardsRegion[ubCount]); - MSYS_SetRegionUserData( &gSelectedFloristCardsRegion[ubCount], 0, ubCount ); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectFloristCardsRegionCallBack ); + MSYS_AddRegion(&gSelectedFloristCardsRegion[ubCount]); + MSYS_SetRegionUserData( &gSelectedFloristCardsRegion[ubCount], 0, ubCount ); ubCount++; usPosX += FLORIST_CARD_FIRST_OFFSET_X; } @@ -93,12 +93,12 @@ BOOLEAN EnterFloristCards() guiFlowerCardsButtonImage = LoadButtonImage("LAPTOP\\FloristButtons.sti", -1,0,-1,1,-1 ); - guiFlowerCardsBackButton = CreateIconAndTextButton( guiFlowerCardsButtonImage, sFloristCards[FLORIST_CARDS_BACK], FLORIST_BUTTON_TEXT_FONT, - FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, - FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, - TEXT_CJUSTIFIED, - FLORIST_CARD_BACK_BUTTON_X, FLORIST_CARD_BACK_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnFlowerCardsBackButtonCallback); + guiFlowerCardsBackButton = CreateIconAndTextButton( guiFlowerCardsButtonImage, sFloristCards[FLORIST_CARDS_BACK], FLORIST_BUTTON_TEXT_FONT, + FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + TEXT_CJUSTIFIED, + FLORIST_CARD_BACK_BUTTON_X, FLORIST_CARD_BACK_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnFlowerCardsBackButtonCallback); SetButtonCursor(guiFlowerCardsBackButton, CURSOR_WWW ); @@ -116,7 +116,7 @@ void ExitFloristCards() RemoveFloristDefaults(); DeleteVideoObjectFromIndex( guiCardBackground ); - //card gallery + //card gallery for(i=0; i<9; i++) MSYS_RemoveRegion( &gSelectedFloristCardsRegion[i]); @@ -135,7 +135,7 @@ void RenderFloristCards() UINT16 usPosX, usPosY; CHAR16 sTemp[ 640 ]; UINT32 uiStartLoc=0; - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; UINT16 usHeightOffset; DisplayFloristDefaults(); @@ -157,17 +157,17 @@ void RenderFloristCards() uiStartLoc = FLOR_CARD_TEXT_TITLE_SIZE * ubCount; LoadEncryptedDataFromFile(FLOR_CARD_TEXT_FILE, sTemp, uiStartLoc, FLOR_CARD_TEXT_TITLE_SIZE); -// DisplayWrappedString((UINT16)(usPosX+7), (UINT16)(usPosY+15), FLORIST_CARD_TEXT_WIDTH, 2, FLORIST_CARDS_SENTENCE_FONT, FLORIST_CARDS_SENTENCE_COLOR, sTemp, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); - usHeightOffset = IanWrappedStringHeight( (UINT16)(usPosX+7), (UINT16)(usPosY), FLORIST_CARD_TEXT_WIDTH, 2, - FLORIST_CARDS_SENTENCE_FONT, FLORIST_CARDS_SENTENCE_COLOR, sTemp, - 0, FALSE, 0); +// DisplayWrappedString((UINT16)(usPosX+7), (UINT16)(usPosY+15), FLORIST_CARD_TEXT_WIDTH, 2, FLORIST_CARDS_SENTENCE_FONT, FLORIST_CARDS_SENTENCE_COLOR, sTemp, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + usHeightOffset = IanWrappedStringHeight( (UINT16)(usPosX+7), (UINT16)(usPosY), FLORIST_CARD_TEXT_WIDTH, 2, + FLORIST_CARDS_SENTENCE_FONT, FLORIST_CARDS_SENTENCE_COLOR, sTemp, + 0, FALSE, 0); usHeightOffset = ( FLORIST_CARD_TEXT_HEIGHT - usHeightOffset ) / 2; - IanDisplayWrappedString( (UINT16)(usPosX+7), (UINT16)(usPosY+10+usHeightOffset), FLORIST_CARD_TEXT_WIDTH, 2, - FLORIST_CARDS_SENTENCE_FONT, FLORIST_CARDS_SENTENCE_COLOR, sTemp, - 0, FALSE, 0); + IanDisplayWrappedString( (UINT16)(usPosX+7), (UINT16)(usPosY+10+usHeightOffset), FLORIST_CARD_TEXT_WIDTH, 2, + FLORIST_CARDS_SENTENCE_FONT, FLORIST_CARDS_SENTENCE_COLOR, sTemp, + 0, FALSE, 0); ubCount++; usPosX += FLORIST_CARD_FIRST_OFFSET_X; @@ -175,15 +175,15 @@ void RenderFloristCards() usPosY += FLORIST_CARD_FIRST_OFFSET_Y; } - MarkButtonsDirty( ); + MarkButtonsDirty( ); RenderWWWProgramTitleBar( ); - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } void SelectFloristCardsRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -195,7 +195,7 @@ void SelectFloristCardsRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } @@ -223,4 +223,4 @@ void BtnFlowerCardsBackButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} diff --git a/Laptop/florist Gallery.cpp b/Laptop/florist Gallery.cpp index 6a22fd2e..d9ae9aee 100644 --- a/Laptop/florist Gallery.cpp +++ b/Laptop/florist Gallery.cpp @@ -39,7 +39,7 @@ #define FLOR_GALLERY_NEXT_BUTTON_X LAPTOP_SCREEN_UL_X + 420 #define FLOR_GALLERY_NEXT_BUTTON_Y FLOR_GALLERY_BACK_BUTTON_Y - + #define FLOR_GALLERY_FLOWER_BUTTON_X (LAPTOP_SCREEN_UL_X + 7) #define FLOR_GALLERY_FLOWER_BUTTON_Y LAPTOP_SCREEN_WEB_UL_Y + 74 @@ -47,12 +47,12 @@ #define FLOR_GALLERY_TITLE_TEXT_X (LAPTOP_SCREEN_UL_X + 0) #define FLOR_GALLERY_TITLE_TEXT_Y LAPTOP_SCREEN_WEB_UL_Y + 48 -#define FLOR_GALLERY_TITLE_TEXT_WIDTH (613 - 111) +#define FLOR_GALLERY_TITLE_TEXT_WIDTH (613 - 111) #define FLOR_GALLERY_FLOWER_TITLE_X FLOR_GALLERY_FLOWER_BUTTON_X + 88 #define FLOR_GALLERY_DESC_WIDTH 390 - + #define FLOR_GALLERY_FLOWER_TITLE_OFFSET_Y 9 #define FLOR_GALLERY_FLOWER_PRICE_OFFSET_Y FLOR_GALLERY_FLOWER_TITLE_OFFSET_Y + 17 #define FLOR_GALLERY_FLOWER_DESC_OFFSET_Y FLOR_GALLERY_FLOWER_PRICE_OFFSET_Y + 15 @@ -105,20 +105,20 @@ BOOLEAN EnterFloristGallery() //the next previous buttons guiFloralGalleryButtonImage = LoadButtonImage("LAPTOP\\FloristButtons.sti", -1,0,-1,1,-1 ); - guiFloralGalleryButton[0] = CreateIconAndTextButton( guiFloralGalleryButtonImage, sFloristGalleryText[FLORIST_GALLERY_PREV], FLORIST_BUTTON_TEXT_FONT, - FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, - FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, - TEXT_CJUSTIFIED, - FLOR_GALLERY_BACK_BUTTON_X, FLOR_GALLERY_BACK_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnFloralGalleryBackButtonCallback); + guiFloralGalleryButton[0] = CreateIconAndTextButton( guiFloralGalleryButtonImage, sFloristGalleryText[FLORIST_GALLERY_PREV], FLORIST_BUTTON_TEXT_FONT, + FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + TEXT_CJUSTIFIED, + FLOR_GALLERY_BACK_BUTTON_X, FLOR_GALLERY_BACK_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnFloralGalleryBackButtonCallback); SetButtonCursor(guiFloralGalleryButton[0], CURSOR_WWW ); - guiFloralGalleryButton[1] = CreateIconAndTextButton( guiFloralGalleryButtonImage, sFloristGalleryText[FLORIST_GALLERY_NEXT], FLORIST_BUTTON_TEXT_FONT, - FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, - FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, - TEXT_CJUSTIFIED, - FLOR_GALLERY_NEXT_BUTTON_X, FLOR_GALLERY_NEXT_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnFloralGalleryNextButtonCallback); + guiFloralGalleryButton[1] = CreateIconAndTextButton( guiFloralGalleryButtonImage, sFloristGalleryText[FLORIST_GALLERY_NEXT], FLORIST_BUTTON_TEXT_FONT, + FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + TEXT_CJUSTIFIED, + FLOR_GALLERY_NEXT_BUTTON_X, FLOR_GALLERY_NEXT_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnFloralGalleryNextButtonCallback); SetButtonCursor(guiFloralGalleryButton[1], CURSOR_WWW ); RenderFloristGallery(); @@ -137,7 +137,7 @@ void ExitFloristGallery() for(i=0; i<2; i++) RemoveButton( guiFloralGalleryButton[i] ); - UnloadButtonImage( guiFloralGalleryButtonImage ); + UnloadButtonImage( guiFloralGalleryButtonImage ); DeleteFlowerButtons(); @@ -167,9 +167,9 @@ void RenderFloristGallery() DisplayFloralDescriptions(); - MarkButtonsDirty( ); + MarkButtonsDirty( ); RenderWWWProgramTitleBar( ); - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } @@ -202,7 +202,7 @@ void BtnFloralGalleryNextButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnFloralGalleryBackButtonCallback(GUI_BUTTON *btn,INT32 reason) @@ -243,7 +243,7 @@ void BtnFloralGalleryBackButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} @@ -273,7 +273,7 @@ void BtnGalleryFlowerButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} BOOLEAN InitFlowerButtons() @@ -281,9 +281,9 @@ BOOLEAN InitFlowerButtons() UINT16 i,j, count; UINT16 usPosY; char sTemp[40]; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; + - if( (FLOR_GALLERY_NUMBER_FLORAL_IMAGES - gubCurFlowerIndex) >= 3 ) gubCurNumberOfFlowers = 3; else @@ -321,7 +321,7 @@ BOOLEAN InitFlowerButtons() count ++; } - //if its the first page, display the 'back' text in place of the 'prev' text on the top left button + //if its the first page, display the 'back' text in place of the 'prev' text on the top left button if( gubCurFlowerIndex == 0 ) SpecifyButtonText( guiFloralGalleryButton[0], sFloristGalleryText[FLORIST_GALLERY_HOME] ); else @@ -386,7 +386,7 @@ BOOLEAN DisplayFloralDescriptions() //Display Flower Desc uiStartLoc = FLOR_GALLERY_TEXT_TOTAL_SIZE * (i + gubCurFlowerIndex) + FLOR_GALLERY_TEXT_TITLE_SIZE + FLOR_GALLERY_TEXT_PRICE_SIZE; LoadEncryptedDataFromFile(FLOR_GALLERY_TEXT_FILE, sTemp, uiStartLoc, FLOR_GALLERY_TEXT_DESC_SIZE); - DisplayWrappedString(FLOR_GALLERY_FLOWER_TITLE_X, (UINT16)(usPosY+FLOR_GALLERY_FLOWER_DESC_OFFSET_Y), FLOR_GALLERY_DESC_WIDTH, 2, FLOR_GALLERY_FLOWER_DESC_FONT, FLOR_GALLERY_FLOWER_DESC_COLOR, sTemp, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DisplayWrappedString(FLOR_GALLERY_FLOWER_TITLE_X, (UINT16)(usPosY+FLOR_GALLERY_FLOWER_DESC_OFFSET_Y), FLOR_GALLERY_DESC_WIDTH, 2, FLOR_GALLERY_FLOWER_DESC_FONT, FLOR_GALLERY_FLOWER_DESC_COLOR, sTemp, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usPosY += FLOR_GALLERY_FLOWER_BUTTON_OFFSET_Y; } @@ -419,3 +419,4 @@ void ChangingFloristGallerySubPage( UINT8 ubSubPageNumber ) } } + diff --git a/Laptop/florist Order Form.cpp b/Laptop/florist Order Form.cpp index 00322e9b..dcc3172b 100644 --- a/Laptop/florist Order Form.cpp +++ b/Laptop/florist Order Form.cpp @@ -42,8 +42,8 @@ #define FLOWER_ORDER_SENTIMENT_BOX_X LAPTOP_SCREEN_UL_X + 14 #define FLOWER_ORDER_SENTIMENT_BOX_Y LAPTOP_SCREEN_WEB_UL_Y + 226 -#define FLOWER_ORDER_SENTIMENT_BOX_WIDTH 468 -#define FLOWER_ORDER_SENTIMENT_BOX_HEIGHT 27 +#define FLOWER_ORDER_SENTIMENT_BOX_WIDTH 468 +#define FLOWER_ORDER_SENTIMENT_BOX_HEIGHT 27 #define FLOWER_ORDER_NAME_BOX_X LAPTOP_SCREEN_UL_X + 60 #define FLOWER_ORDER_NAME_BOX_Y LAPTOP_SCREEN_WEB_UL_Y + 314 - FLOWER_ORDER_SMALLER_PS_OFFSET_Y @@ -51,8 +51,8 @@ #define FLOWER_ORDER_SMALLER_PS_OFFSET_Y 27 -#define FLOWER_ORDER_DELIVERY_LOCATION_X LAPTOP_SCREEN_UL_X + 205 -#define FLOWER_ORDER_DELIVERY_LOCATION_Y LAPTOP_SCREEN_WEB_UL_Y + 143 +#define FLOWER_ORDER_DELIVERY_LOCATION_X LAPTOP_SCREEN_UL_X + 205 +#define FLOWER_ORDER_DELIVERY_LOCATION_Y LAPTOP_SCREEN_WEB_UL_Y + 143 #define FLOWER_ORDER_DELIVERY_LOCATION_WIDTH 252 #define FLOWER_ORDER_DELIVERY_LOCATION_HEIGHT 20 @@ -113,7 +113,7 @@ #define FLOWER_ORDER_CHECK_BOX_0_Y FLOWER_ORDER_DATE_Y - 3 #define FLOWER_ORDER_CHECK_BOX_1_X LAPTOP_SCREEN_UL_X + 270 -#define FLOWER_ORDER_CHECK_BOX_1_Y FLOWER_ORDER_CHECK_BOX_0_Y +#define FLOWER_ORDER_CHECK_BOX_1_Y FLOWER_ORDER_CHECK_BOX_0_Y #define FLOWER_ORDER_CHECK_BOX_2_X LAPTOP_SCREEN_UL_X + 123 #define FLOWER_ORDER_CHECK_BOX_2_Y FLOWER_ORDER_ADDITIONAL_SERVICES_Y @@ -201,7 +201,7 @@ UINT8 gubFlowerDestDropDownMode; UINT8 gubCurrentlySelectedFlowerLocation; -CHAR16 gsSentimentTextField[ FLOWER_ORDER_PERSONEL_SENTIMENT_NUM_CHARS ] = {0} ; +CHAR16 gsSentimentTextField[ FLOWER_ORDER_PERSONEL_SENTIMENT_NUM_CHARS ] = {0} ; CHAR16 gsNameTextField[ FLOWER_ORDER_NAME_FIELD_NUM_CHARS ] = {0}; @@ -224,35 +224,35 @@ UINT32 guiFlowerOrderGalleryButton; //Clicking on OrderCheckBox -MOUSE_REGION gSelectedFloristCheckBoxRegion[ 6 ]; +MOUSE_REGION gSelectedFloristCheckBoxRegion[ 6 ]; void SelectFlorsitCheckBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //link to the card gallery -MOUSE_REGION gSelectedFloristCardGalleryLinkRegion; +MOUSE_REGION gSelectedFloristCardGalleryLinkRegion; void SelectFloristCardGalleryLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //link to the flower gallery by clicking on the flower -MOUSE_REGION gSelectedFloristGalleryLinkRegion; +MOUSE_REGION gSelectedFloristGalleryLinkRegion; void SelectFloristGalleryLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //the drop down for the city -MOUSE_REGION gSelectedFloristDropDownRegion; +MOUSE_REGION gSelectedFloristDropDownRegion; void SelectFloristDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //to disable the drop down window -MOUSE_REGION gSelectedFloristDisableDropDownRegion; +MOUSE_REGION gSelectedFloristDisableDropDownRegion; void SelectFloristDisableDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //mouse region for the drop down city location area -MOUSE_REGION gSelectedFlowerDropDownRegion[ FLOWER_ORDER_NUMBER_OF_DROP_DOWN_LOCATIONS ]; +MOUSE_REGION gSelectedFlowerDropDownRegion[ FLOWER_ORDER_NUMBER_OF_DROP_DOWN_LOCATIONS ]; void SelectFlowerDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); void SelectFlowerDropDownMovementCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //to select typing in the personal sentiment box -//MOUSE_REGION gSelectedFloristPersonalSentimentBoxRegion; +//MOUSE_REGION gSelectedFloristPersonalSentimentBoxRegion; //void SelectFloristPersonalSentimentBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); @@ -276,7 +276,7 @@ void GameInitFloristOrderForm() BOOLEAN EnterFloristOrderForm() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; UINT8 i; char sTemp[40]; UINT16 usPosX, usWidth, usHeight; @@ -316,44 +316,44 @@ BOOLEAN EnterFloristOrderForm() CHECKF(AddVideoObject(&VObjectDesc, &guiCurrentlySelectedFlowerImage)); - // border - VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + // border + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; FilenameForBPP( "INTERFACE\\TactPopUp.sti", VObjectDesc.ImageFile ); CHECKF( AddVideoObject( &VObjectDesc, &guiDropDownBorder ) ); guiFlowerOrderButtonImage = LoadButtonImage("LAPTOP\\FloristButtons.sti", -1,0,-1,1,-1 ); - guiFlowerOrderBackButton = CreateIconAndTextButton( guiFlowerOrderButtonImage, sOrderFormText[FLORIST_ORDER_BACK], FLORIST_BUTTON_TEXT_FONT, - FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, - FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, - TEXT_CJUSTIFIED, - FLOWER_ORDER_BACK_BUTTON_X, FLOWER_ORDER_BACK_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnFlowerOrderBackButtonCallback); + guiFlowerOrderBackButton = CreateIconAndTextButton( guiFlowerOrderButtonImage, sOrderFormText[FLORIST_ORDER_BACK], FLORIST_BUTTON_TEXT_FONT, + FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + TEXT_CJUSTIFIED, + FLOWER_ORDER_BACK_BUTTON_X, FLOWER_ORDER_BACK_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnFlowerOrderBackButtonCallback); SetButtonCursor(guiFlowerOrderBackButton, CURSOR_WWW ); - guiFlowerOrderSendButton = CreateIconAndTextButton( guiFlowerOrderButtonImage, sOrderFormText[FLORIST_ORDER_SEND], FLORIST_BUTTON_TEXT_FONT, - FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, - FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, - TEXT_CJUSTIFIED, - FLOWER_ORDER_SEND_BUTTON_X, FLOWER_ORDER_SEND_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnFlowerOrderSendButtonCallback); + guiFlowerOrderSendButton = CreateIconAndTextButton( guiFlowerOrderButtonImage, sOrderFormText[FLORIST_ORDER_SEND], FLORIST_BUTTON_TEXT_FONT, + FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + TEXT_CJUSTIFIED, + FLOWER_ORDER_SEND_BUTTON_X, FLOWER_ORDER_SEND_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnFlowerOrderSendButtonCallback); SetButtonCursor(guiFlowerOrderSendButton, CURSOR_WWW ); - guiFlowerOrderClearButton = CreateIconAndTextButton( guiFlowerOrderButtonImage, sOrderFormText[FLORIST_ORDER_CLEAR], FLORIST_BUTTON_TEXT_FONT, - FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, - FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, - TEXT_CJUSTIFIED, - FLOWER_ORDER_CLEAR_BUTTON_X, FLOWER_ORDER_CLEAR_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnFlowerOrderClearButtonCallback); + guiFlowerOrderClearButton = CreateIconAndTextButton( guiFlowerOrderButtonImage, sOrderFormText[FLORIST_ORDER_CLEAR], FLORIST_BUTTON_TEXT_FONT, + FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + TEXT_CJUSTIFIED, + FLOWER_ORDER_CLEAR_BUTTON_X, FLOWER_ORDER_CLEAR_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnFlowerOrderClearButtonCallback); SetButtonCursor(guiFlowerOrderClearButton, CURSOR_WWW ); - guiFlowerOrderGalleryButton = CreateIconAndTextButton( guiFlowerOrderButtonImage, sOrderFormText[FLORIST_ORDER_GALLERY], FLORIST_BUTTON_TEXT_FONT, - FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, - FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, - TEXT_CJUSTIFIED, - FLOWER_ORDER_GALLERY_BUTTON_X, FLOWER_ORDER_GALLERY_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnFlowerOrderGalleryButtonCallback); + guiFlowerOrderGalleryButton = CreateIconAndTextButton( guiFlowerOrderButtonImage, sOrderFormText[FLORIST_ORDER_GALLERY], FLORIST_BUTTON_TEXT_FONT, + FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + TEXT_CJUSTIFIED, + FLOWER_ORDER_GALLERY_BUTTON_X, FLOWER_ORDER_GALLERY_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnFlowerOrderGalleryButtonCallback); SetButtonCursor(guiFlowerOrderGalleryButton, CURSOR_WWW ); @@ -362,75 +362,75 @@ BOOLEAN EnterFloristOrderForm() // i=0; MSYS_DefineRegion( &gSelectedFloristCheckBoxRegion[i], FLOWER_ORDER_CHECK_BOX_0_X, FLOWER_ORDER_CHECK_BOX_0_Y, (UINT16)(FLOWER_ORDER_CHECK_BOX_0_X + FLOWER_ORDER_CHECK_WIDTH), (UINT16)(FLOWER_ORDER_CHECK_BOX_0_Y + FLOWER_ORDER_CHECK_HEIGHT), MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectFlorsitCheckBoxRegionCallBack ); - MSYS_AddRegion(&gSelectedFloristCheckBoxRegion[i]); - MSYS_SetRegionUserData( &gSelectedFloristCheckBoxRegion[i], 0, i ); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectFlorsitCheckBoxRegionCallBack ); + MSYS_AddRegion(&gSelectedFloristCheckBoxRegion[i]); + MSYS_SetRegionUserData( &gSelectedFloristCheckBoxRegion[i], 0, i ); i++; MSYS_DefineRegion( &gSelectedFloristCheckBoxRegion[i], FLOWER_ORDER_CHECK_BOX_1_X, FLOWER_ORDER_CHECK_BOX_1_Y, (UINT16)(FLOWER_ORDER_CHECK_BOX_1_X + FLOWER_ORDER_CHECK_WIDTH), (UINT16)(FLOWER_ORDER_CHECK_BOX_1_Y + FLOWER_ORDER_CHECK_HEIGHT), MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectFlorsitCheckBoxRegionCallBack ); - MSYS_AddRegion(&gSelectedFloristCheckBoxRegion[i]); - MSYS_SetRegionUserData( &gSelectedFloristCheckBoxRegion[i], 0, i ); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectFlorsitCheckBoxRegionCallBack ); + MSYS_AddRegion(&gSelectedFloristCheckBoxRegion[i]); + MSYS_SetRegionUserData( &gSelectedFloristCheckBoxRegion[i], 0, i ); i++; MSYS_DefineRegion( &gSelectedFloristCheckBoxRegion[i], FLOWER_ORDER_CHECK_BOX_2_X, FLOWER_ORDER_CHECK_BOX_2_Y, (UINT16)(FLOWER_ORDER_CHECK_BOX_2_X + FLOWER_ORDER_CHECK_WIDTH), (UINT16)(FLOWER_ORDER_CHECK_BOX_2_Y + FLOWER_ORDER_CHECK_HEIGHT), MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectFlorsitCheckBoxRegionCallBack ); - MSYS_AddRegion(&gSelectedFloristCheckBoxRegion[i]); - MSYS_SetRegionUserData( &gSelectedFloristCheckBoxRegion[i], 0, i ); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectFlorsitCheckBoxRegionCallBack ); + MSYS_AddRegion(&gSelectedFloristCheckBoxRegion[i]); + MSYS_SetRegionUserData( &gSelectedFloristCheckBoxRegion[i], 0, i ); i++; MSYS_DefineRegion( &gSelectedFloristCheckBoxRegion[i], FLOWER_ORDER_CHECK_BOX_3_X, FLOWER_ORDER_CHECK_BOX_3_Y, (UINT16)(FLOWER_ORDER_CHECK_BOX_3_X + FLOWER_ORDER_CHECK_WIDTH), (UINT16)(FLOWER_ORDER_CHECK_BOX_3_Y + FLOWER_ORDER_CHECK_HEIGHT), MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectFlorsitCheckBoxRegionCallBack ); - MSYS_AddRegion(&gSelectedFloristCheckBoxRegion[i]); - MSYS_SetRegionUserData( &gSelectedFloristCheckBoxRegion[i], 0, i ); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectFlorsitCheckBoxRegionCallBack ); + MSYS_AddRegion(&gSelectedFloristCheckBoxRegion[i]); + MSYS_SetRegionUserData( &gSelectedFloristCheckBoxRegion[i], 0, i ); i++; MSYS_DefineRegion( &gSelectedFloristCheckBoxRegion[i], FLOWER_ORDER_CHECK_BOX_4_X, FLOWER_ORDER_CHECK_BOX_4_Y, (UINT16)(FLOWER_ORDER_CHECK_BOX_4_X + FLOWER_ORDER_CHECK_WIDTH), (UINT16)(FLOWER_ORDER_CHECK_BOX_4_Y + FLOWER_ORDER_CHECK_HEIGHT), MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectFlorsitCheckBoxRegionCallBack ); - MSYS_AddRegion(&gSelectedFloristCheckBoxRegion[i]); - MSYS_SetRegionUserData( &gSelectedFloristCheckBoxRegion[i], 0, i ); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectFlorsitCheckBoxRegionCallBack ); + MSYS_AddRegion(&gSelectedFloristCheckBoxRegion[i]); + MSYS_SetRegionUserData( &gSelectedFloristCheckBoxRegion[i], 0, i ); i++; MSYS_DefineRegion( &gSelectedFloristCheckBoxRegion[i], FLOWER_ORDER_CHECK_BOX_5_X, FLOWER_ORDER_CHECK_BOX_5_Y, (UINT16)(FLOWER_ORDER_CHECK_BOX_5_X + FLOWER_ORDER_CHECK_WIDTH), (UINT16)(FLOWER_ORDER_CHECK_BOX_5_Y + FLOWER_ORDER_CHECK_HEIGHT), MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectFlorsitCheckBoxRegionCallBack ); - MSYS_AddRegion(&gSelectedFloristCheckBoxRegion[i]); - MSYS_SetRegionUserData( &gSelectedFloristCheckBoxRegion[i], 0, i ); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectFlorsitCheckBoxRegionCallBack ); + MSYS_AddRegion(&gSelectedFloristCheckBoxRegion[i]); + MSYS_SetRegionUserData( &gSelectedFloristCheckBoxRegion[i], 0, i ); i++; usPosX = StringPixLength( sOrderFormText[FLORIST_ORDER_SELECT_FROM_OURS], FLOWER_ORDEER_SMALL_FONT) + 2 + FLOWER_ORDER_LINK_TO_CARD_GALLERY_X; usWidth = StringPixLength( sOrderFormText[FLORIST_ORDER_STANDARDIZED_CARDS], FLOWER_ORDEER_SMALL_FONT); usHeight = GetFontHeight(FLOWER_ORDEER_SMALL_FONT); MSYS_DefineRegion( &gSelectedFloristCardGalleryLinkRegion, usPosX, FLOWER_ORDER_LINK_TO_CARD_GALLERY_Y, (UINT16)(usPosX + usWidth), (UINT16)(FLOWER_ORDER_LINK_TO_CARD_GALLERY_Y + usHeight), MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectFloristCardGalleryLinkRegionCallBack ); - MSYS_AddRegion(&gSelectedFloristCardGalleryLinkRegion); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectFloristCardGalleryLinkRegionCallBack ); + MSYS_AddRegion(&gSelectedFloristCardGalleryLinkRegion); //flower link MSYS_DefineRegion( &gSelectedFloristGalleryLinkRegion, FLOWER_ORDER_FLOWER_BOX_X, FLOWER_ORDER_FLOWER_BOX_Y, (UINT16)(FLOWER_ORDER_FLOWER_BOX_X + FLOWER_ORDER_FLOWER_BOX_WIDTH), (UINT16)(FLOWER_ORDER_FLOWER_BOX_Y + FLOWER_ORDER_FLOWER_BOX_HEIGHT), MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectFloristGalleryLinkRegionCallBack ); - MSYS_AddRegion(&gSelectedFloristGalleryLinkRegion); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectFloristGalleryLinkRegionCallBack ); + MSYS_AddRegion(&gSelectedFloristGalleryLinkRegion); //drop down city location MSYS_DefineRegion( &gSelectedFloristDropDownRegion, FLOWER_ORDER_DELIVERY_LOCATION_X, FLOWER_ORDER_DELIVERY_LOCATION_Y, (UINT16)(FLOWER_ORDER_DELIVERY_LOCATION_X + FLOWER_ORDER_DELIVERY_LOCATION_WIDTH), (UINT16)(FLOWER_ORDER_DELIVERY_LOCATION_Y + FLOWER_ORDER_DELIVERY_LOCATION_HEIGHT), MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectFloristDropDownRegionCallBack); - MSYS_AddRegion(&gSelectedFloristDropDownRegion); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectFloristDropDownRegionCallBack); + MSYS_AddRegion(&gSelectedFloristDropDownRegion); //to disable the drop down city location MSYS_DefineRegion( &gSelectedFloristDisableDropDownRegion, LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_WEB_UL_Y, LAPTOP_SCREEN_LR_X, LAPTOP_SCREEN_WEB_LR_Y, MSYS_PRIORITY_HIGH+2, - CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, SelectFloristDisableDropDownRegionCallBack); - MSYS_AddRegion(&gSelectedFloristDisableDropDownRegion); - MSYS_DisableRegion(&gSelectedFloristDisableDropDownRegion); + CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, SelectFloristDisableDropDownRegionCallBack); + MSYS_AddRegion(&gSelectedFloristDisableDropDownRegion); + MSYS_DisableRegion(&gSelectedFloristDisableDropDownRegion); //to select typing in the personal sentiment box // MSYS_DefineRegion( &gSelectedFloristPersonalSentimentBoxRegion, FLOWER_ORDER_SENTIMENT_BOX_X, FLOWER_ORDER_SENTIMENT_BOX_Y, (UINT16)(FLOWER_ORDER_SENTIMENT_BOX_X + FLOWER_ORDER_SENTIMENT_BOX_WIDTH), (UINT16)(FLOWER_ORDER_SENTIMENT_BOX_Y + FLOWER_ORDER_SENTIMENT_BOX_HEIGHT), MSYS_PRIORITY_HIGH, -// CURSOR_WWW, MSYS_NO_CALLBACK, SelectFloristPersonalSentimentBoxRegionCallBack); -// MSYS_AddRegion( &gSelectedFloristPersonalSentimentBoxRegion ); +// CURSOR_WWW, MSYS_NO_CALLBACK, SelectFloristPersonalSentimentBoxRegionCallBack); +// MSYS_AddRegion( &gSelectedFloristPersonalSentimentBoxRegion ); InitFlowerOrderTextInputBoxes(); LaptopSaveInfo.uiFlowerOrderNumber += Random( 5 ) + 1; - + RenderFloristOrderForm(); // guiFlowerPrice = 0; @@ -508,7 +508,7 @@ void HandleFloristOrderForm() void RenderFloristOrderForm() { - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; UINT16 usPosX; CHAR16 sTemp[ 640 ]; UINT32 uiStartLoc=0; @@ -549,7 +549,7 @@ void RenderFloristOrderForm() - + //Deliverry Date DrawTextToScreen(sOrderFormText[FLORIST_ORDER_DELIVERY_DATE], FLOWER_ORDER_ORDER_NUM_NAME_X, FLOWER_ORDER_DATE_Y, 0, FLOWER_ORDEER_BIG_FONT, FLOWER_ORDER_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); @@ -602,9 +602,9 @@ void RenderFloristOrderForm() //Display the currently selected city FlowerOrderDisplayShippingLocationCity(); - MarkButtonsDirty( ); + MarkButtonsDirty( ); RenderWWWProgramTitleBar( ); - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } @@ -632,7 +632,7 @@ void BtnFlowerOrderBackButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnFlowerOrderSendButtonCallback(GUI_BUTTON *btn,INT32 reason) { @@ -677,7 +677,7 @@ void BtnFlowerOrderSendButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnFlowerOrderClearButtonCallback(GUI_BUTTON *btn,INT32 reason) { @@ -703,7 +703,7 @@ void BtnFlowerOrderClearButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnFlowerOrderGalleryButtonCallback(GUI_BUTTON *btn,INT32 reason) { @@ -731,11 +731,11 @@ void BtnFlowerOrderGalleryButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void SelectFlorsitCheckBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -801,63 +801,63 @@ void SelectFlorsitCheckBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } void DisplayFloristCheckBox() { - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; //check box GetVideoObject(&hPixHandle, guiFlowerOrderCheckBoxButtonImage); if( gfFLoristCheckBox0Down ) - BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_0_X, FLOWER_ORDER_CHECK_BOX_0_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_0_X, FLOWER_ORDER_CHECK_BOX_0_Y, VO_BLT_SRCTRANSPARENCY,NULL); else - BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_0_X, FLOWER_ORDER_CHECK_BOX_0_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_0_X, FLOWER_ORDER_CHECK_BOX_0_Y, VO_BLT_SRCTRANSPARENCY,NULL); //first check box GetVideoObject(&hPixHandle, guiFlowerOrderCheckBoxButtonImage); if( gfFLoristCheckBox1Down ) - BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_1_X, FLOWER_ORDER_CHECK_BOX_1_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_1_X, FLOWER_ORDER_CHECK_BOX_1_Y, VO_BLT_SRCTRANSPARENCY,NULL); else - BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_1_X, FLOWER_ORDER_CHECK_BOX_1_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_1_X, FLOWER_ORDER_CHECK_BOX_1_Y, VO_BLT_SRCTRANSPARENCY,NULL); //second check box GetVideoObject(&hPixHandle, guiFlowerOrderCheckBoxButtonImage); if( gfFLoristCheckBox2Down ) - BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_2_X, FLOWER_ORDER_CHECK_BOX_2_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_2_X, FLOWER_ORDER_CHECK_BOX_2_Y, VO_BLT_SRCTRANSPARENCY,NULL); else - BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_2_X, FLOWER_ORDER_CHECK_BOX_2_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_2_X, FLOWER_ORDER_CHECK_BOX_2_Y, VO_BLT_SRCTRANSPARENCY,NULL); //third check box GetVideoObject(&hPixHandle, guiFlowerOrderCheckBoxButtonImage); if( gfFLoristCheckBox3Down ) - BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_3_X, FLOWER_ORDER_CHECK_BOX_3_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_3_X, FLOWER_ORDER_CHECK_BOX_3_Y, VO_BLT_SRCTRANSPARENCY,NULL); else - BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_3_X, FLOWER_ORDER_CHECK_BOX_3_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_3_X, FLOWER_ORDER_CHECK_BOX_3_Y, VO_BLT_SRCTRANSPARENCY,NULL); //Foiurth check box GetVideoObject(&hPixHandle, guiFlowerOrderCheckBoxButtonImage); if( gfFLoristCheckBox4Down ) - BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_4_X, FLOWER_ORDER_CHECK_BOX_4_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_4_X, FLOWER_ORDER_CHECK_BOX_4_Y, VO_BLT_SRCTRANSPARENCY,NULL); else - BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_4_X, FLOWER_ORDER_CHECK_BOX_4_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_4_X, FLOWER_ORDER_CHECK_BOX_4_Y, VO_BLT_SRCTRANSPARENCY,NULL); //fifth check box GetVideoObject(&hPixHandle, guiFlowerOrderCheckBoxButtonImage); if( gfFLoristCheckBox5Down ) - BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_5_X, FLOWER_ORDER_CHECK_BOX_5_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_5_X, FLOWER_ORDER_CHECK_BOX_5_Y, VO_BLT_SRCTRANSPARENCY,NULL); else - BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_5_X, FLOWER_ORDER_CHECK_BOX_5_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_5_X, FLOWER_ORDER_CHECK_BOX_5_Y, VO_BLT_SRCTRANSPARENCY,NULL); - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } void SelectFloristCardGalleryLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -867,7 +867,7 @@ void SelectFloristCardGalleryLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iR } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } @@ -891,7 +891,7 @@ void DisplayFlowerDynamicItems() CleanOutControlCodesFromString(sTemp, sText); - DisplayWrappedString( (UINT16)(FLOWER_ORDER_SENTIMENT_BOX_X+10), (UINT16)(FLOWER_ORDER_SENTIMENT_BOX_Y+7), FLOWER_ORDER_PERSONAL_SENT_TEXT_WIDTH, 2, FLOWER_ORDEER_SMALL_FONT, FLOWER_ORDEER_SMALL_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DisplayWrappedString( (UINT16)(FLOWER_ORDER_SENTIMENT_BOX_X+10), (UINT16)(FLOWER_ORDER_SENTIMENT_BOX_Y+7), FLOWER_ORDER_PERSONAL_SENT_TEXT_WIDTH, 2, FLOWER_ORDEER_SMALL_FONT, FLOWER_ORDEER_SMALL_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); } */ //order number @@ -935,7 +935,7 @@ void DisplayFlowerDynamicItems() void SelectFloristGalleryLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -945,35 +945,35 @@ void SelectFloristGalleryLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReaso } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } void SelectFloristDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) { gubFlowerDestDropDownMode = FLOWER_ORDER_DROP_DOWN_CREATE; - } + } } void SelectFloristDisableDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) { gubFlowerDestDropDownMode = FLOWER_ORDER_DROP_DOWN_DESTROY; - } + } } void SelectFlowerDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -982,7 +982,7 @@ void SelectFlowerDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) gubCurrentlySelectedFlowerLocation = (UINT8)MSYS_GetRegionUserData( pRegion, 0 ); FlowerOrderDrawSelectedCity( gubCurrentlySelectedFlowerLocation ); gubFlowerDestDropDownMode = FLOWER_ORDER_DROP_DOWN_DESTROY; - } + } } void SelectFlowerDropDownMovementCallBack(MOUSE_REGION * pRegion, INT32 reason ) @@ -1001,7 +1001,7 @@ void SelectFlowerDropDownMovementCallBack(MOUSE_REGION * pRegion, INT32 reason ) InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); } -} +} @@ -1058,8 +1058,8 @@ BOOLEAN CreateDestroyFlowerOrderDestDropDown( UINT8 ubDropDownMode ) for( i=0; i< FLOWER_ORDER_NUMBER_OF_DROP_DOWN_LOCATIONS; i++) { MSYS_DefineRegion( &gSelectedFlowerDropDownRegion[i], usPosX, (UINT16)(usPosY+4), (UINT16)(usPosX+FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH), (UINT16)(usPosY+usFontHeight), MSYS_PRIORITY_HIGH+3, - CURSOR_WWW, SelectFlowerDropDownMovementCallBack, SelectFlowerDropDownRegionCallBack); - MSYS_AddRegion(&gSelectedFlowerDropDownRegion[i]); + CURSOR_WWW, SelectFlowerDropDownMovementCallBack, SelectFlowerDropDownRegionCallBack); + MSYS_AddRegion(&gSelectedFlowerDropDownRegion[i]); MSYS_SetRegionUserData( &gSelectedFlowerDropDownRegion[ i ], 0, i); usPosY += usFontHeight + 2; @@ -1069,7 +1069,7 @@ BOOLEAN CreateDestroyFlowerOrderDestDropDown( UINT8 ubDropDownMode ) gubFlowerDestDropDownMode = FLOWER_ORDER_DROP_DOWN_DISPLAY; - MSYS_EnableRegion(&gSelectedFloristDisableDropDownRegion); + MSYS_EnableRegion(&gSelectedFloristDisableDropDownRegion); //disable the text entry fields @@ -1080,7 +1080,7 @@ BOOLEAN CreateDestroyFlowerOrderDestDropDown( UINT8 ubDropDownMode ) //disable the clear order and accept order buttons, (their rendering interferes with the drop down graphics) } break; - + case FLOWER_ORDER_DROP_DOWN_DESTROY: { UINT8 i; @@ -1089,17 +1089,17 @@ BOOLEAN CreateDestroyFlowerOrderDestDropDown( UINT8 ubDropDownMode ) break; for( i=0; i< FLOWER_ORDER_NUMBER_OF_DROP_DOWN_LOCATIONS; i++) - MSYS_RemoveRegion( &gSelectedFlowerDropDownRegion[i]); + MSYS_RemoveRegion( &gSelectedFlowerDropDownRegion[i]); //display the name on the title bar ColorFillVideoSurfaceArea( FRAME_BUFFER, FLOWER_ORDER_DROP_DOWN_LOCATION_X+3, FLOWER_ORDER_DELIVERY_LOCATION_Y+3, FLOWER_ORDER_DROP_DOWN_LOCATION_X+FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH, FLOWER_ORDER_DELIVERY_LOCATION_Y+FLOWER_ORDER_DELIVERY_LOCATION_HEIGHT-2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); DrawTextToScreen( *(FlowerOrderLocations[ gubCurrentlySelectedFlowerLocation ].psCityLoc), FLOWER_ORDER_DROP_DOWN_CITY_START_X+6, FLOWER_ORDER_DROP_DOWN_CITY_START_Y+3, 0, FLOWER_ORDEER_DROP_DOWN_FONT, FLOWER_ORDEER_DROP_DOWN_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); //enable the drop down region - MSYS_DisableRegion(&gSelectedFloristDisableDropDownRegion); + MSYS_DisableRegion(&gSelectedFloristDisableDropDownRegion); fPausedReDrawScreenFlag = TRUE; - fMouseRegionsCreated = FALSE; + fMouseRegionsCreated = FALSE; gubFlowerDestDropDownMode = FLOWER_ORDER_DROP_DOWN_NO_ACTION; //enable the text entry fields @@ -1112,7 +1112,7 @@ BOOLEAN CreateDestroyFlowerOrderDestDropDown( UINT8 ubDropDownMode ) UINT8 i; UINT16 usPosY, usPosX; UINT16 usFontHeight = GetFontHeight( FLOWER_ORDEER_DROP_DOWN_FONT ); - HVOBJECT hImageHandle; + HVOBJECT hImageHandle; //Display the background for the drop down window ColorFillVideoSurfaceArea( FRAME_BUFFER, FLOWER_ORDER_DROP_DOWN_LOCATION_X, FLOWER_ORDER_DROP_DOWN_LOCATION_Y, FLOWER_ORDER_DROP_DOWN_LOCATION_X+FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH, FLOWER_ORDER_DROP_DOWN_LOCATION_Y+usHeight, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); @@ -1129,7 +1129,7 @@ BOOLEAN CreateDestroyFlowerOrderDestDropDown( UINT8 ubDropDownMode ) { //TOP ROW BltVideoObject(FRAME_BUFFER, hImageHandle, 1,i+FLOWER_ORDER_DROP_DOWN_LOCATION_X, usPosY+FLOWER_ORDER_DROP_DOWN_LOCATION_Y, VO_BLT_SRCTRANSPARENCY,NULL); - + //BOTTOM ROW BltVideoObject(FRAME_BUFFER, hImageHandle, 6,i+FLOWER_ORDER_DROP_DOWN_LOCATION_X, usHeight-10+6+FLOWER_ORDER_DROP_DOWN_LOCATION_Y, VO_BLT_SRCTRANSPARENCY,NULL); } @@ -1163,7 +1163,7 @@ BOOLEAN CreateDestroyFlowerOrderDestDropDown( UINT8 ubDropDownMode ) FlowerOrderDrawSelectedCity( gubCurrentlySelectedFlowerLocation ); - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } break; } @@ -1181,12 +1181,12 @@ void FlowerOrderDrawSelectedCity( UINT8 ubNumber ) //display the name in the list ColorFillVideoSurfaceArea( FRAME_BUFFER, FLOWER_ORDER_DROP_DOWN_CITY_START_X, usPosY+2, FLOWER_ORDER_DROP_DOWN_CITY_START_X+FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH-9, usPosY+usFontHeight+4, Get16BPPColor( FROMRGB( 255, 255, 255 ) ) ); - SetFontShadow(NO_SHADOW); + SetFontShadow(NO_SHADOW); DrawTextToScreen( *(FlowerOrderLocations[ubNumber].psCityLoc), FLOWER_ORDER_DROP_DOWN_CITY_START_X+6, (UINT16)(usPosY+3), 0, FLOWER_ORDEER_DROP_DOWN_FONT, 2, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); SetFontShadow(DEFAULT_SHADOW); FlowerOrderDisplayShippingLocationCity(); - SetFontShadow(DEFAULT_SHADOW); + SetFontShadow(DEFAULT_SHADOW); } @@ -1205,13 +1205,13 @@ void InitFlowerOrderTextInputBoxes() CHAR16 sTemp[ 640 ]; CHAR16 sText[ 640 ]; - + InitTextInputMode(); SetTextInputFont( (UINT16)FONT12ARIAL ); Set16BPPTextFieldColor( Get16BPPColor(FROMRGB( 255, 255, 255) ) ); SetBevelColors( Get16BPPColor(FROMRGB(136, 138, 135)), Get16BPPColor(FROMRGB(24, 61, 81)) ); - SetTextInputRegularColors( 2, FONT_WHITE ); - SetTextInputHilitedColors( FONT_WHITE, 2, 141 ); + SetTextInputRegularColors( 2, FONT_WHITE ); + SetTextInputHilitedColors( FONT_WHITE, 2, 141 ); SetCursorColor( Get16BPPColor(FROMRGB(0, 0, 0) ) ); AddUserInputField( FlowerOrderUserTextFieldCallBack ); diff --git a/Laptop/florist.cpp b/Laptop/florist.cpp index 5355568d..0401461a 100644 --- a/Laptop/florist.cpp +++ b/Laptop/florist.cpp @@ -74,7 +74,7 @@ UINT32 guiGalleryButton; //link to the flower home page by clicking on the flower title -MOUSE_REGION gSelectedFloristTitleHomeLinkRegion; +MOUSE_REGION gSelectedFloristTitleHomeLinkRegion; void SelectFloristTitleHomeLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); @@ -85,10 +85,10 @@ void GameInitFlorist() BOOLEAN EnterFlorist() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; SetBookMark( FLORIST_BOOKMARK ); - + InitFloristDefaults(); // load the handbullet graphic and add it @@ -98,12 +98,12 @@ BOOLEAN EnterFlorist() guiGalleryButtonImage = LoadButtonImage("LAPTOP\\FloristButtons.sti", -1,0,-1,1,-1 ); - guiGalleryButton = CreateIconAndTextButton( guiGalleryButtonImage, sFloristText[FLORIST_GALLERY], FLORIST_BUTTON_TEXT_FONT, - FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, - FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, - TEXT_CJUSTIFIED, - FLORIST_GALLERY_BUTTON_X, FLORIST_GALLERY_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnGalleryButtonCallback); + guiGalleryButton = CreateIconAndTextButton( guiGalleryButtonImage, sFloristText[FLORIST_GALLERY], FLORIST_BUTTON_TEXT_FONT, + FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + TEXT_CJUSTIFIED, + FLORIST_GALLERY_BUTTON_X, FLORIST_GALLERY_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnGalleryButtonCallback); SetButtonCursor(guiGalleryButton, CURSOR_WWW ); //reset the currently selected card @@ -127,7 +127,7 @@ BOOLEAN EnterFlorist() void ExitFlorist() { - + DeleteVideoObjectFromIndex(guiHandBullet); RemoveFloristDefaults(); @@ -143,7 +143,7 @@ void HandleFlorist() void RenderFlorist() { - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; UINT16 i, usPosY; UINT8 ubTextCounter; @@ -152,10 +152,10 @@ void RenderFlorist() DisplayFloristDefaults(); //compnay info - DisplayWrappedString(FLORIST_COMPANY_INFO_TEXT_X, FLORIST_COMPANY_INFO_LINE_1_Y, FLORIST_COMPANY_INFO_TEXT_WIDTH, 2, FLORIST_SENTENCE_FONT, FLORIST_SENTENCE_COLOR, sFloristText[ FLORIST_DROP_ANYWHERE ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); - DisplayWrappedString(FLORIST_COMPANY_INFO_TEXT_X, FLORIST_COMPANY_INFO_LINE_2_Y, FLORIST_COMPANY_INFO_TEXT_WIDTH, 2, FLORIST_SENTENCE_FONT, FLORIST_SENTENCE_COLOR, sFloristText[ FLORIST_PHONE_NUMBER ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); - DisplayWrappedString(FLORIST_COMPANY_INFO_TEXT_X, FLORIST_COMPANY_INFO_LINE_3_Y, FLORIST_COMPANY_INFO_TEXT_WIDTH, 2, FLORIST_SENTENCE_FONT, FLORIST_SENTENCE_COLOR, sFloristText[ FLORIST_STREET_ADDRESS ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); - DisplayWrappedString(FLORIST_COMPANY_INFO_TEXT_X, FLORIST_COMPANY_INFO_LINE_4_Y, FLORIST_COMPANY_INFO_TEXT_WIDTH, 2, FLORIST_SENTENCE_FONT, FLORIST_SENTENCE_COLOR, sFloristText[ FLORIST_WWW_ADDRESS ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + DisplayWrappedString(FLORIST_COMPANY_INFO_TEXT_X, FLORIST_COMPANY_INFO_LINE_1_Y, FLORIST_COMPANY_INFO_TEXT_WIDTH, 2, FLORIST_SENTENCE_FONT, FLORIST_SENTENCE_COLOR, sFloristText[ FLORIST_DROP_ANYWHERE ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + DisplayWrappedString(FLORIST_COMPANY_INFO_TEXT_X, FLORIST_COMPANY_INFO_LINE_2_Y, FLORIST_COMPANY_INFO_TEXT_WIDTH, 2, FLORIST_SENTENCE_FONT, FLORIST_SENTENCE_COLOR, sFloristText[ FLORIST_PHONE_NUMBER ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + DisplayWrappedString(FLORIST_COMPANY_INFO_TEXT_X, FLORIST_COMPANY_INFO_LINE_3_Y, FLORIST_COMPANY_INFO_TEXT_WIDTH, 2, FLORIST_SENTENCE_FONT, FLORIST_SENTENCE_COLOR, sFloristText[ FLORIST_STREET_ADDRESS ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + DisplayWrappedString(FLORIST_COMPANY_INFO_TEXT_X, FLORIST_COMPANY_INFO_LINE_4_Y, FLORIST_COMPANY_INFO_TEXT_WIDTH, 2, FLORIST_SENTENCE_FONT, FLORIST_SENTENCE_COLOR, sFloristText[ FLORIST_WWW_ADDRESS ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); usPosY = FLORIST_FIRST_BULLET_Y; @@ -164,24 +164,24 @@ void RenderFlorist() { BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLORIST_FIRST_BULLET_X, usPosY, VO_BLT_SRCTRANSPARENCY,NULL); - DisplayWrappedString(FLORIST_FIRST_SENTENCE_COLUMN_TEXT_X, (UINT16)(usPosY+20), FLORIST_FIRST_SENTENCE_COLUMN_TEXT_WIDTH, 2, FLORIST_SENTENCE_FONT, FLORIST_SENTENCE_COLOR, sFloristText[ubTextCounter], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DisplayWrappedString(FLORIST_FIRST_SENTENCE_COLUMN_TEXT_X, (UINT16)(usPosY+20), FLORIST_FIRST_SENTENCE_COLUMN_TEXT_WIDTH, 2, FLORIST_SENTENCE_FONT, FLORIST_SENTENCE_COLOR, sFloristText[ubTextCounter], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); ubTextCounter++; - DisplayWrappedString(FLORIST_SECOND_SENTENCE_COLUMN_TEXT_X, (UINT16)(usPosY+15), FLORIST_SECOND_SENTENCE_COLUMN_TEXT_WIDTH, 2, FLORIST_SENTENCE_FONT, FLORIST_SENTENCE_COLOR, sFloristText[ubTextCounter], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DisplayWrappedString(FLORIST_SECOND_SENTENCE_COLUMN_TEXT_X, (UINT16)(usPosY+15), FLORIST_SECOND_SENTENCE_COLUMN_TEXT_WIDTH, 2, FLORIST_SENTENCE_FONT, FLORIST_SENTENCE_COLOR, sFloristText[ubTextCounter], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); ubTextCounter++; usPosY += FLORIST_BULLET_OFFSET_Y; } - MarkButtonsDirty( ); + MarkButtonsDirty( ); RenderWWWProgramTitleBar( ); - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_UL_Y); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_UL_Y); } BOOLEAN InitFloristDefaults() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; // load the Florist background graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; @@ -206,8 +206,8 @@ BOOLEAN InitFloristDefaults() //flower title homepage link MSYS_DefineRegion( &gSelectedFloristTitleHomeLinkRegion, FLORIST_SMALL_TITLE_X, FLORIST_SMALL_TITLE_Y, (UINT16)(FLORIST_SMALL_TITLE_X + FLORIST_SMALL_TITLE_WIDTH), (UINT16)(FLORIST_SMALL_TITLE_Y + FLORIST_SMALL_TITLE_HEIGHT), MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectFloristTitleHomeLinkRegionCallBack ); - MSYS_AddRegion(&gSelectedFloristTitleHomeLinkRegion); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectFloristTitleHomeLinkRegionCallBack ); + MSYS_AddRegion(&gSelectedFloristTitleHomeLinkRegion); } return(TRUE); @@ -215,20 +215,20 @@ BOOLEAN InitFloristDefaults() void DisplayFloristDefaults() { - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; WebPageTileBackground(4, 4, FLORIST_BACKGROUND_WIDTH, FLORIST_BACKGROUND_HEIGHT, guiFloristBackground); //if its the first page if( guiCurrentLaptopMode == LAPTOP_MODE_FLORIST ) { - gfHomePageActive = TRUE; + gfHomePageActive = TRUE; GetVideoObject(&hPixHandle, guiLargeTitleSymbol); BltVideoObject(FRAME_BUFFER, hPixHandle, 0,FLORIST_BIG_TITLE_X, FLORIST_BIG_TITLE_Y, VO_BLT_SRCTRANSPARENCY,NULL); } else { - gfHomePageActive = FALSE; + gfHomePageActive = FALSE; GetVideoObject(&hPixHandle, guiSmallTitleSymbol); BltVideoObject(FRAME_BUFFER, hPixHandle, 0,FLORIST_SMALL_TITLE_X, FLORIST_SMALL_TITLE_Y, VO_BLT_SRCTRANSPARENCY,NULL); } @@ -278,10 +278,10 @@ void BtnGalleryButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void SelectFloristTitleHomeLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -291,12 +291,13 @@ void SelectFloristTitleHomeLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iRea } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } - + + diff --git a/Laptop/funeral.cpp b/Laptop/funeral.cpp index 18307db2..1669bb1c 100644 --- a/Laptop/funeral.cpp +++ b/Laptop/funeral.cpp @@ -100,11 +100,11 @@ UINT32 guiRightColumn; //Clicking on Funeral link -MOUSE_REGION gSelectedFuneralLinkRegion[ FUNERAL_NUMBER_OF_LINKS ]; +MOUSE_REGION gSelectedFuneralLinkRegion[ FUNERAL_NUMBER_OF_LINKS ]; void SelectFuneralLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //Clicking on rip sign to make it disappear -MOUSE_REGION gSelectedRipSignRegion; +MOUSE_REGION gSelectedRipSignRegion; void SelectRipSignRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); @@ -120,7 +120,7 @@ void GameInitFuneral() BOOLEAN EnterFuneral() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; UINT16 usPosX, i; // load the Closed graphic and add it @@ -148,7 +148,7 @@ BOOLEAN EnterFuneral() GetMLGFilename( VObjectDesc.ImageFile, MLG_MCGILLICUTTYS ); CHECKF(AddVideoObject(&VObjectDesc, &guiMcGillicuttys)); - // load the Mortuary graphic and add it + // load the Mortuary graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; GetMLGFilename( VObjectDesc.ImageFile, MLG_MORTUARY ); CHECKF(AddVideoObject(&VObjectDesc, &guiMortuary)); @@ -165,17 +165,17 @@ BOOLEAN EnterFuneral() //Mouse region for the bottom links MSYS_DefineRegion( &gSelectedFuneralLinkRegion[i], usPosX, FUNERAL_LINK_1_Y, (UINT16)(usPosX + FUNERAL_LINK_1_WIDTH), (UINT16)(FUNERAL_LINK_1_Y + FUNERAL_LINK_1_HEIGHT), MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectFuneralLinkRegionCallBack ); - MSYS_AddRegion(&gSelectedFuneralLinkRegion[i]); - MSYS_SetRegionUserData( &gSelectedFuneralLinkRegion[i], 0, i ); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectFuneralLinkRegionCallBack ); + MSYS_AddRegion(&gSelectedFuneralLinkRegion[i]); + MSYS_SetRegionUserData( &gSelectedFuneralLinkRegion[i], 0, i ); usPosX += FUNERAL_LINK_OFFSET_X; } MSYS_DefineRegion( &gSelectedRipSignRegion, FUNERAL_CLOSED_RIP_SIGN_X, FUNERAL_CLOSED_RIP_SIGN_Y, (UINT16)(FUNERAL_CLOSED_RIP_SIGN_X + FUNERAL_CLOSED_WIDTH), (UINT16)(FUNERAL_CLOSED_RIP_SIGN_Y + FUNERAL_CLOSED_HEIGHT), MSYS_PRIORITY_HIGH+1, - CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, SelectRipSignRegionCallBack ); - MSYS_AddRegion(&gSelectedRipSignRegion); - MSYS_DisableRegion(&gSelectedRipSignRegion); + CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, SelectRipSignRegionCallBack ); + MSYS_AddRegion(&gSelectedRipSignRegion); + MSYS_DisableRegion(&gSelectedRipSignRegion); SetBookMark( FUNERAL_BOOKMARK ); @@ -198,7 +198,7 @@ void ExitFuneral() for(i=0; i 0 ) @@ -250,37 +250,37 @@ void EnterHistory() // render hbackground - RenderHistory( ); + RenderHistory( ); - // set the fact we are in the history viewer - fInHistoryMode=TRUE; - + // set the fact we are in the history viewer + fInHistoryMode=TRUE; + // build Historys list - //OpenAndReadHistoryFile( ); - - // force redraw of the entire screen - //fReDrawScreenFlag=TRUE; - + //OpenAndReadHistoryFile( ); + + // force redraw of the entire screen + //fReDrawScreenFlag=TRUE; + // set inital states SetHistoryButtonStates( ); - return; + return; } void ExitHistory() { - LaptopSaveInfo.iCurrentHistoryPage = iCurrentHistoryPage; + LaptopSaveInfo.iCurrentHistoryPage = iCurrentHistoryPage; + + // not in History system anymore + fInHistoryMode=FALSE; + - // not in History system anymore - fInHistoryMode=FALSE; - - // write out history list to file //OpenAndWriteHistoryFile( ); // delete graphics - RemoveHistory( ); + RemoveHistory( ); // delete buttons DestroyHistoryButtons( ); @@ -288,76 +288,76 @@ void ExitHistory() ClearHistoryList( ); - return; + return; } void HandleHistory() -{ +{ // DEF 2/5/99 Dont need to update EVERY FRAME!!!! - // check and update status of buttons -// SetHistoryButtonStates( ); + // check and update status of buttons +// SetHistoryButtonStates( ); } void RenderHistory( void ) { - //render the background to the display - RenderHistoryBackGround( ); - - // the title bar text - DrawHistoryTitleText( ); - - // the actual lists background - DisplayHistoryListBackground( ); + //render the background to the display + RenderHistoryBackGround( ); - // the headers to each column - DisplayHistoryListHeaders( ); + // the title bar text + DrawHistoryTitleText( ); - // render the currentpage of records - DrawAPageofHistoryRecords( ); - - // stuff at top of page, the date range and page numbers - DisplayPageNumberAndDateRange( ); + // the actual lists background + DisplayHistoryListBackground( ); - // title bar icon - BlitTitleBarIcons( ); + // the headers to each column + DisplayHistoryListHeaders( ); - return; + // render the currentpage of records + DrawAPageofHistoryRecords( ); + + // stuff at top of page, the date range and page numbers + DisplayPageNumberAndDateRange( ); + + // title bar icon + BlitTitleBarIcons( ); + + return; } BOOLEAN LoadHistory( void ) { - VOBJECT_DESC VObjectDesc; - // load History video objects into memory + VOBJECT_DESC VObjectDesc; + // load History video objects into memory // title bar - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\programtitlebar.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiTITLE)); - + // top portion of the screen background VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\historywindow.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiTOP)); - - - // shaded line - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + + + // shaded line + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\historylines.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiSHADELINE)); /* -Not being used??? DF commented out - // vert line - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; +Not being used??? DF commented out + // vert line + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\historyvertline.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiVERTLINE)); */ - // black divider line - long ( 480 length) - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + // black divider line - long ( 480 length) + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\divisionline480.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiLONGLINE)); - + return (TRUE); } @@ -365,7 +365,7 @@ void RemoveHistory( void ) { // delete history video objects from memory - DeleteVideoObjectFromIndex(guiLONGLINE); + DeleteVideoObjectFromIndex(guiLONGLINE); DeleteVideoObjectFromIndex(guiTOP); DeleteVideoObjectFromIndex(guiTITLE); DeleteVideoObjectFromIndex(guiSHADELINE); @@ -377,22 +377,21 @@ void RemoveHistory( void ) void RenderHistoryBackGround( void ) { // render generic background for history system - HVOBJECT hHandle; - INT32 iCounter=0; - + HVOBJECT hHandle; + // get title bar object - GetVideoObject(&hHandle, guiTITLE); - + GetVideoObject(&hHandle, guiTITLE); + // blt title bar to screen BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X, TOP_Y -2 , VO_BLT_SRCTRANSPARENCY,NULL); - + // get and blt the top part of the screen, video object and blt to screen - GetVideoObject(&hHandle, guiTOP); - BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X, TOP_Y + 22, VO_BLT_SRCTRANSPARENCY,NULL); - - // display background for history list - DisplayHistoryListBackground( ); + GetVideoObject(&hHandle, guiTOP); + BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X, TOP_Y + 22, VO_BLT_SRCTRANSPARENCY,NULL); + + // display background for history list + DisplayHistoryListBackground( ); return; } @@ -400,13 +399,13 @@ void DrawHistoryTitleText( void ) { // setup the font stuff SetFont(HISTORY_HEADER_FONT); - SetFontForeground(FONT_WHITE); + SetFontForeground(FONT_WHITE); SetFontBackground(FONT_BLACK); - SetFontShadow(DEFAULT_SHADOW); - + SetFontShadow(DEFAULT_SHADOW); + // draw the pages title mprintf(TITLE_X,TITLE_Y,pHistoryTitle[0]); - + return; } @@ -414,22 +413,22 @@ void CreateHistoryButtons( void ) { // the prev page button - giHistoryButtonImage[PREV_PAGE_BUTTON]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,0,-1,1,-1 ); + giHistoryButtonImage[PREV_PAGE_BUTTON]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,0,-1,1,-1 ); giHistoryButton[PREV_PAGE_BUTTON] = QuickCreateButton( giHistoryButtonImage[PREV_PAGE_BUTTON], PREV_BTN_X, BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnHistoryDisplayPrevPageCallBack); - + // the next page button - giHistoryButtonImage[NEXT_PAGE_BUTTON]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,6,-1,7,-1 ); + giHistoryButtonImage[NEXT_PAGE_BUTTON]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,6,-1,7,-1 ); giHistoryButton[NEXT_PAGE_BUTTON] = QuickCreateButton( giHistoryButtonImage[NEXT_PAGE_BUTTON], NEXT_BTN_X, BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnHistoryDisplayNextPageCallBack); - + // set buttons SetButtonCursor(giHistoryButton[0], CURSOR_LAPTOP_SCREEN); SetButtonCursor(giHistoryButton[1], CURSOR_LAPTOP_SCREEN); - + return; } @@ -438,15 +437,15 @@ void DestroyHistoryButtons( void ) { // remove History buttons and images from memory - + // next page button RemoveButton(giHistoryButton[1] ); UnloadButtonImage(giHistoryButtonImage[1] ); - + // prev page button RemoveButton(giHistoryButton[0] ); UnloadButtonImage(giHistoryButtonImage[0] ); - + return; } @@ -455,7 +454,7 @@ void BtnHistoryDisplayPrevPageCallBack(GUI_BUTTON *btn,INT32 reason) // force redraw if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - fReDrawScreenFlag=TRUE; + fReDrawScreenFlag=TRUE; } @@ -470,14 +469,14 @@ void BtnHistoryDisplayPrevPageCallBack(GUI_BUTTON *btn,INT32 reason) { LoadPreviousHistoryPage( ); //iCurrentHistoryPage--; - DrawAPageofHistoryRecords( ); + DrawAPageofHistoryRecords( ); } // set new state SetHistoryButtonStates( ); } - + } void BtnHistoryDisplayNextPageCallBack(GUI_BUTTON *btn,INT32 reason) @@ -485,64 +484,61 @@ void BtnHistoryDisplayNextPageCallBack(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - fReDrawScreenFlag=TRUE; + fReDrawScreenFlag=TRUE; } // force redraw if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { - // increment currentPage - btn->uiFlags&=~(BUTTON_CLICKED_ON); + // increment currentPage + btn->uiFlags&=~(BUTTON_CLICKED_ON); LoadNextHistoryPage( ); // set new state SetHistoryButtonStates( ); - fReDrawScreenFlag=TRUE; + fReDrawScreenFlag=TRUE; } - + } BOOLEAN IncrementCurrentPageHistoryDisplay( void ) { - // run through list, from pCurrentHistory, to NUM_RECORDS_PER_PAGE +1 HistoryUnits - HistoryUnitPtr pTempHistory=pCurrentHistory; - BOOLEAN fOkToIncrementPage=FALSE; - INT32 iCounter=0; + // run through list, from pCurrentHistory, to NUM_RECORDS_PER_PAGE +1 HistoryUnits HWFILE hFileHandle; UINT32 uiFileSize=0; - UINT32 uiSizeOfRecordsOnEachPage = 0; - + UINT32 uiSizeOfRecordsOnEachPage = 0; + if ( ! (FileExists( HISTORY_DATA_FILE ) ) ) return( FALSE ); // open file - hFileHandle=FileOpen( HISTORY_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + hFileHandle=FileOpen( HISTORY_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); // failed to get file, return if(!hFileHandle) { return( FALSE ); - } + } // make sure file is more than 0 length - if ( FileGetSize( hFileHandle ) == 0 ) + if ( FileGetSize( hFileHandle ) == 0 ) { - FileClose( hFileHandle ); + FileClose( hFileHandle ); return( FALSE ); } uiFileSize = FileGetSize( hFileHandle ) - 1; uiSizeOfRecordsOnEachPage = ( NUM_RECORDS_PER_PAGE * ( sizeof( UINT8 ) + sizeof( UINT32 ) + 3*sizeof( UINT8 )+ sizeof(INT16) + sizeof( INT16 ) ) ); - // is the file long enough? -// if( ( FileGetSize( hFileHandle ) - 1 ) / ( NUM_RECORDS_PER_PAGE * ( sizeof( UINT8 ) + sizeof( UINT32 ) + 3*sizeof( UINT8 )+ sizeof(INT16) + sizeof( INT16 ) ) ) + 1 < ( UINT32 )( iCurrentHistoryPage + 1 ) ) + // is the file long enough? +// if( ( FileGetSize( hFileHandle ) - 1 ) / ( NUM_RECORDS_PER_PAGE * ( sizeof( UINT8 ) + sizeof( UINT32 ) + 3*sizeof( UINT8 )+ sizeof(INT16) + sizeof( INT16 ) ) ) + 1 < ( UINT32 )( iCurrentHistoryPage + 1 ) ) if( uiFileSize / uiSizeOfRecordsOnEachPage + 1 < ( UINT32 )( iCurrentHistoryPage + 1 ) ) { // nope FileClose( hFileHandle ); - return( FALSE ); + return( FALSE ); } else { @@ -555,20 +551,20 @@ BOOLEAN IncrementCurrentPageHistoryDisplay( void ) // haven't reached end of list and not yet at beginning of next page while( ( pTempHistory )&&( ! fOkToIncrementPage ) ) { - // found the next page, first record thereof + // found the next page, first record thereof if(iCounter==NUM_RECORDS_PER_PAGE+1) { fOkToIncrementPage=TRUE; - pCurrentHistory=pTempHistory->Next; + pCurrentHistory=pTempHistory->Next; } //next record pTempHistory=pTempHistory->Next; - iCounter++; + iCounter++; } */ // if ok to increment, increment - + return( TRUE ); } @@ -576,8 +572,8 @@ BOOLEAN IncrementCurrentPageHistoryDisplay( void ) UINT32 ProcessAndEnterAHistoryRecord( UINT8 ubCode, UINT32 uiDate, UINT8 ubSecondCode, INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ , UINT8 ubColor ) { - UINT32 uiId=0; - HistoryUnitPtr pHistory=pHistoryListHead; + UINT32 uiId=0; + HistoryUnitPtr pHistory=pHistoryListHead; // add to History list if(pHistory) @@ -585,38 +581,38 @@ UINT32 ProcessAndEnterAHistoryRecord( UINT8 ubCode, UINT32 uiDate, UINT8 ubSecon // go to end of list while(pHistory->Next) pHistory=pHistory->Next; - + // alloc space pHistory->Next = (history *) MemAlloc(sizeof(HistoryUnit)); - + // increment id number uiId = pHistory->uiIdNumber + 1; - + // set up information passed pHistory = pHistory->Next; pHistory->Next = NULL; pHistory->ubCode = ubCode; - pHistory->ubSecondCode = ubSecondCode; + pHistory->ubSecondCode = ubSecondCode; pHistory->uiDate = uiDate; - pHistory->uiIdNumber = uiId; + pHistory->uiIdNumber = uiId; pHistory->sSectorX = sSectorX; pHistory->sSectorY = sSectorY; pHistory->bSectorZ = bSectorZ; pHistory->ubColor = ubColor; - + } else { // alloc space pHistory = (HistoryUnitPtr) MemAlloc(sizeof(HistoryUnit)); - + // setup info passed pHistory->Next = NULL; pHistory->ubCode = ubCode; - pHistory->ubSecondCode = ubSecondCode; + pHistory->ubSecondCode = ubSecondCode; pHistory->uiDate = uiDate; - pHistory->uiIdNumber = uiId; - pHistoryListHead = pHistory; + pHistory->uiIdNumber = uiId; + pHistoryListHead = pHistory; pHistory->sSectorX = sSectorX; pHistory->sSectorY = sSectorY; pHistory->bSectorZ = bSectorZ; @@ -630,16 +626,16 @@ UINT32 ProcessAndEnterAHistoryRecord( UINT8 ubCode, UINT32 uiDate, UINT8 ubSecon void OpenAndReadHistoryFile( void ) { - // this procedure will open and read in data to the History list - + // this procedure will open and read in data to the History list + HWFILE hFileHandle; - UINT8 ubCode, ubSecondCode; + UINT8 ubCode, ubSecondCode; UINT32 uiDate; - INT16 sSectorX, sSectorY; + INT16 sSectorX, sSectorY; INT8 bSectorZ = 0; UINT8 ubColor; - INT32 iBytesRead=0; - UINT32 uiByteCount=0; + INT32 iBytesRead=0; + UINT32 uiByteCount=0; // clear out the old list ClearHistoryList( ); @@ -649,30 +645,30 @@ void OpenAndReadHistoryFile( void ) return; // open file - hFileHandle=FileOpen( HISTORY_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + hFileHandle=FileOpen( HISTORY_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); // failed to get file, return if(!hFileHandle) { return; - } + } // make sure file is more than 0 length - if ( FileGetSize( hFileHandle ) == 0 ) + if ( FileGetSize( hFileHandle ) == 0 ) { - FileClose( hFileHandle ); + FileClose( hFileHandle ); return; } - + // file exists, read in data, continue until file end - while( FileGetSize( hFileHandle ) > uiByteCount) + while( FileGetSize( hFileHandle ) > uiByteCount) { // read in other data - FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &ubSecondCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &uiDate, sizeof(UINT32), (UINT32 *)&iBytesRead ); - FileRead( hFileHandle, &sSectorX, sizeof(INT16), (UINT32 *)&iBytesRead ); - FileRead( hFileHandle, &sSectorY, sizeof(INT16), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &sSectorX, sizeof(INT16), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &sSectorY, sizeof(INT16), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &bSectorZ, sizeof(INT8), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &ubColor, sizeof( UINT8 ), (UINT32 *)&iBytesRead ); @@ -682,27 +678,26 @@ void OpenAndReadHistoryFile( void ) #endif // add transaction - ProcessAndEnterAHistoryRecord( ubCode, uiDate, ubSecondCode, sSectorX, sSectorY, bSectorZ, ubColor ); + ProcessAndEnterAHistoryRecord( ubCode, uiDate, ubSecondCode, sSectorX, sSectorY, bSectorZ, ubColor ); // increment byte counter - uiByteCount += SIZE_OF_HISTORY_FILE_RECORD; - } - - // close file + uiByteCount += SIZE_OF_HISTORY_FILE_RECORD; + } + + // close file FileClose( hFileHandle ); - + return; } BOOLEAN OpenAndWriteHistoryFile( void ) { - // this procedure will open and write out data from the History list - + // this procedure will open and write out data from the History list + HWFILE hFileHandle; - INT32 iBytesWritten=0; - HistoryUnitPtr pHistoryList=pHistoryListHead; - - + HistoryUnitPtr pHistoryList=pHistoryListHead; + + // open file hFileHandle=FileOpen( HISTORY_DATA_FILE, FILE_ACCESS_WRITE|FILE_CREATE_ALWAYS, FALSE); @@ -710,9 +705,9 @@ BOOLEAN OpenAndWriteHistoryFile( void ) if(!hFileHandle) { return ( FALSE ); - } - // write info, while there are elements left in the list - while(pHistoryList) + } + // write info, while there are elements left in the list + while(pHistoryList) { #ifdef JA2TESTVERSION @@ -720,23 +715,23 @@ BOOLEAN OpenAndWriteHistoryFile( void ) PerformCheckOnHistoryRecord( 2, pHistoryList->sSectorX, pHistoryList->sSectorY, pHistoryList->bSectorZ ); #endif - // now write date and amount, and code - FileWrite( hFileHandle, &(pHistoryList->ubCode ), sizeof ( UINT8 ), NULL ); - FileWrite( hFileHandle, &(pHistoryList->ubSecondCode ), sizeof ( UINT8 ), NULL ); - FileWrite( hFileHandle, &(pHistoryList->uiDate ), sizeof ( UINT32 ), NULL ); - FileWrite( hFileHandle, &(pHistoryList->sSectorX ), sizeof ( INT16 ), NULL ); - FileWrite( hFileHandle, &(pHistoryList->sSectorY ), sizeof ( INT16 ), NULL ); - FileWrite( hFileHandle, &(pHistoryList->bSectorZ ), sizeof ( INT8 ), NULL ); - FileWrite( hFileHandle, &(pHistoryList->ubColor ), sizeof ( UINT8 ), NULL ); + // now write date and amount, and code + FileWrite( hFileHandle, &(pHistoryList->ubCode ), sizeof ( UINT8 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->ubSecondCode ), sizeof ( UINT8 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->uiDate ), sizeof ( UINT32 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->sSectorX ), sizeof ( INT16 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->sSectorY ), sizeof ( INT16 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->bSectorZ ), sizeof ( INT8 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->ubColor ), sizeof ( UINT8 ), NULL ); // next element in list pHistoryList = pHistoryList->Next; - + } // close file - FileClose( hFileHandle ); - // clear out the old list + FileClose( hFileHandle ); + // clear out the old list ClearHistoryList( ); return ( TRUE ); @@ -746,75 +741,75 @@ BOOLEAN OpenAndWriteHistoryFile( void ) void ClearHistoryList( void ) { // remove each element from list of transactions - + HistoryUnitPtr pHistoryList=pHistoryListHead; - HistoryUnitPtr pHistoryNode=pHistoryList; + HistoryUnitPtr pHistoryNode=pHistoryList; // while there are elements in the list left, delete them while( pHistoryList ) { - // set node to list head + // set node to list head pHistoryNode=pHistoryList; - + // set list head to next node pHistoryList=pHistoryList->Next; - + // delete current node MemFree(pHistoryNode); } - pHistoryListHead=NULL; - + pHistoryListHead=NULL; + return; } void DisplayHistoryListHeaders( void ) { - // this procedure will display the headers to each column in History - INT16 usX, usY; + // this procedure will display the headers to each column in History + INT16 usX, usY; // font stuff SetFont(HISTORY_TEXT_FONT); - SetFontForeground(FONT_BLACK); + SetFontForeground(FONT_BLACK); SetFontBackground(FONT_BLACK); - SetFontShadow(NO_SHADOW); - - // the date header - FindFontCenterCoordinates(RECORD_DATE_X + 5,0,RECORD_DATE_WIDTH,0, pHistoryHeaders[0], HISTORY_TEXT_FONT,&usX, &usY); - mprintf(usX, RECORD_HEADER_Y, pHistoryHeaders[0]); - + SetFontShadow(NO_SHADOW); + // the date header - FindFontCenterCoordinates(RECORD_DATE_X + RECORD_DATE_WIDTH + 5,0,RECORD_LOCATION_WIDTH,0, pHistoryHeaders[ 3 ], HISTORY_TEXT_FONT,&usX, &usY); + FindFontCenterCoordinates(RECORD_DATE_X + 5,0,RECORD_DATE_WIDTH,0, pHistoryHeaders[0], HISTORY_TEXT_FONT,&usX, &usY); + mprintf(usX, RECORD_HEADER_Y, pHistoryHeaders[0]); + + // the date header + FindFontCenterCoordinates(RECORD_DATE_X + RECORD_DATE_WIDTH + 5,0,RECORD_LOCATION_WIDTH,0, pHistoryHeaders[ 3 ], HISTORY_TEXT_FONT,&usX, &usY); mprintf(usX, RECORD_HEADER_Y, pHistoryHeaders[3]); // event header - FindFontCenterCoordinates(RECORD_DATE_X + RECORD_DATE_WIDTH + RECORD_LOCATION_WIDTH + 5,0,RECORD_LOCATION_WIDTH,0, pHistoryHeaders[ 3 ], HISTORY_TEXT_FONT,&usX, &usY); + FindFontCenterCoordinates(RECORD_DATE_X + RECORD_DATE_WIDTH + RECORD_LOCATION_WIDTH + 5,0,RECORD_LOCATION_WIDTH,0, pHistoryHeaders[ 3 ], HISTORY_TEXT_FONT,&usX, &usY); mprintf(usX, RECORD_HEADER_Y, pHistoryHeaders[4]); // reset shadow SetFontShadow(DEFAULT_SHADOW); return; } - + void DisplayHistoryListBackground( void ) { - // this function will display the History list display background - HVOBJECT hHandle; - INT32 iCounter=0; - + // this function will display the History list display background + HVOBJECT hHandle; + INT32 iCounter=0; + + - // get shaded line object GetVideoObject(&hHandle, guiSHADELINE); for(iCounter=0; iCounter <11; iCounter++) { - // blt title bar to screen - BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X + 15, (TOP_DIVLINE_Y + BOX_HEIGHT * 2 * iCounter), VO_BLT_SRCTRANSPARENCY,NULL); + // blt title bar to screen + BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X + 15, (TOP_DIVLINE_Y + BOX_HEIGHT * 2 * iCounter), VO_BLT_SRCTRANSPARENCY,NULL); } - + // the long hortizontal line int he records list display region - GetVideoObject(&hHandle, guiLONGLINE); - BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X + 9, (TOP_DIVLINE_Y ), VO_BLT_SRCTRANSPARENCY,NULL); - BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X + 9, (TOP_DIVLINE_Y + BOX_HEIGHT * 2 * 11 ), VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hHandle, guiLONGLINE); + BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X + 9, (TOP_DIVLINE_Y ), VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X + 9, (TOP_DIVLINE_Y + BOX_HEIGHT * 2 * 11 ), VO_BLT_SRCTRANSPARENCY,NULL); return; @@ -822,20 +817,18 @@ void DisplayHistoryListBackground( void ) void DrawHistoryRecordsText( void ) { - // draws the text of the records - HistoryUnitPtr pCurHistory=pHistoryListHead; - HistoryUnitPtr pTempHistory=pHistoryListHead; + // draws the text of the records + HistoryUnitPtr pCurHistory=pHistoryListHead; CHAR16 sString[512]; - INT32 iCounter=0; + INT32 iCounter=0; INT16 usX, usY; - INT32 iBalance=0; INT16 sX =0, sY =0; - // setup the font stuff + // setup the font stuff SetFont(HISTORY_TEXT_FONT); - SetFontForeground(FONT_BLACK); + SetFontForeground(FONT_BLACK); SetFontBackground(FONT_BLACK); - SetFontShadow(NO_SHADOW); + SetFontShadow(NO_SHADOW); // error check if( !pCurHistory) @@ -857,27 +850,27 @@ void DrawHistoryRecordsText( void ) swprintf(sString, L"%d", ( pCurHistory->uiDate / ( 24 * 60 ) ) ); FindFontCenterCoordinates(RECORD_DATE_X + 5, 0, RECORD_DATE_WIDTH,0, sString, HISTORY_TEXT_FONT,&usX, &usY); mprintf(usX, RECORD_Y + ( iCounter * ( BOX_HEIGHT ) ) + 3, sString); - + // now the actual history text - //FindFontCenterCoordinates(RECORD_DATE_X + RECORD_DATE_WIDTH,0,RECORD_HISTORY_WIDTH,0, pHistoryStrings[pCurHistory->ubCode], HISTORY_TEXT_FONT,&usX, &usY); + //FindFontCenterCoordinates(RECORD_DATE_X + RECORD_DATE_WIDTH,0,RECORD_HISTORY_WIDTH,0, pHistoryStrings[pCurHistory->ubCode], HISTORY_TEXT_FONT,&usX, &usY); ProcessHistoryTransactionString(sString, pCurHistory); // mprintf(RECORD_DATE_X + RECORD_DATE_WIDTH + 25, RECORD_Y + ( iCounter * ( BOX_HEIGHT ) ) + 3, pHistoryStrings[pCurHistory->ubCode] ); mprintf(RECORD_DATE_X + RECORD_LOCATION_WIDTH +RECORD_DATE_WIDTH + 15, RECORD_Y + ( iCounter * ( BOX_HEIGHT ) ) + 3, sString ); - - + + // no location if( ( pCurHistory->sSectorX == -1 )||( pCurHistory->sSectorY == -1 ) ) { - FindFontCenterCoordinates( RECORD_DATE_X + RECORD_DATE_WIDTH, 0,RECORD_LOCATION_WIDTH + 10, 0, pHistoryLocations[0] ,HISTORY_TEXT_FONT, &sX, &sY ); - mprintf(sX, RECORD_Y + ( iCounter * ( BOX_HEIGHT ) ) + 3, pHistoryLocations[0] ); - } + FindFontCenterCoordinates( RECORD_DATE_X + RECORD_DATE_WIDTH, 0,RECORD_LOCATION_WIDTH + 10, 0, pHistoryLocations[0] ,HISTORY_TEXT_FONT, &sX, &sY ); + mprintf(sX, RECORD_Y + ( iCounter * ( BOX_HEIGHT ) ) + 3, pHistoryLocations[0] ); + } else { GetSectorIDString( pCurHistory->sSectorX, pCurHistory->sSectorY, pCurHistory->bSectorZ, sString, TRUE ); - FindFontCenterCoordinates( RECORD_DATE_X + RECORD_DATE_WIDTH, 0, RECORD_LOCATION_WIDTH + 10, 0, sString ,HISTORY_TEXT_FONT, &sX, &sY ); - + FindFontCenterCoordinates( RECORD_DATE_X + RECORD_DATE_WIDTH, 0, RECORD_LOCATION_WIDTH + 10, 0, sString ,HISTORY_TEXT_FONT, &sX, &sY ); + ReduceStringLength( sString, RECORD_LOCATION_WIDTH + 10, HISTORY_TEXT_FONT ); - + mprintf(sX, RECORD_Y + ( iCounter * ( BOX_HEIGHT ) ) + 3, sString ); } @@ -886,20 +879,20 @@ void DrawHistoryRecordsText( void ) // next History pCurHistory = pCurHistory->Next; - + // last page, no Historys left, return if( ! pCurHistory ) { // restore shadow - SetFontShadow(DEFAULT_SHADOW); + SetFontShadow(DEFAULT_SHADOW); return; } } // restore shadow - SetFontShadow(DEFAULT_SHADOW); + SetFontShadow(DEFAULT_SHADOW); return; } @@ -907,30 +900,28 @@ void DrawHistoryRecordsText( void ) void DrawAPageofHistoryRecords( void ) { // this procedure will draw a series of history records to the screen - INT32 iCurPage=1; - INT32 iCount=0; - pCurrentHistory=pHistoryListHead; + pCurrentHistory=pHistoryListHead; // (re-)render background - + // the title bar text - DrawHistoryTitleText( ); - - // the actual lists background - DisplayHistoryListBackground( ); + DrawHistoryTitleText( ); + + // the actual lists background + DisplayHistoryListBackground( ); + + // the headers to each column + DisplayHistoryListHeaders( ); - // the headers to each column - DisplayHistoryListHeaders( ); - // error check if(iCurrentHistoryPage==-1) { iCurrentHistoryPage=0; - } - - - // current page is found, render from here + } + + + // current page is found, render from here DrawHistoryRecordsText( ); // update page numbers, and date ranges @@ -941,36 +932,36 @@ void DrawAPageofHistoryRecords( void ) void DisplayPageNumberAndDateRange( void ) { - // this function will go through the list of 'histories' starting at current until end or + // this function will go through the list of 'histories' starting at current until end or // MAX_PER_PAGE...it will get the date range and the page number INT32 iLastPage=0; INT32 iCounter=0; - UINT32 uiLastDate; + UINT32 uiLastDate; HistoryUnitPtr pTempHistory=pHistoryListHead; - CHAR16 sString[50]; + CHAR16 sString[50]; - // setup the font stuff + // setup the font stuff SetFont(HISTORY_TEXT_FONT); - SetFontForeground(FONT_BLACK); + SetFontForeground(FONT_BLACK); SetFontBackground(FONT_BLACK); - SetFontShadow(NO_SHADOW); + SetFontShadow(NO_SHADOW); if( !pCurrentHistory ) { - swprintf( sString, L"%s %d / %d",pHistoryHeaders[1], 1, 1 ); - mprintf( PAGE_NUMBER_X, PAGE_NUMBER_Y, sString ); + swprintf( sString, L"%s %d / %d",pHistoryHeaders[1], 1, 1 ); + mprintf( PAGE_NUMBER_X, PAGE_NUMBER_Y, sString ); + + swprintf( sString, L"%s %d - %d",pHistoryHeaders[2], 1 , 1 ); + mprintf( HISTORY_DATE_X, HISTORY_DATE_Y, sString ); + + // reset shadow + SetFontShadow(DEFAULT_SHADOW); - swprintf( sString, L"%s %d - %d",pHistoryHeaders[2], 1 , 1 ); - mprintf( HISTORY_DATE_X, HISTORY_DATE_Y, sString ); - - // reset shadow - SetFontShadow(DEFAULT_SHADOW); - return; - } - + } + uiLastDate=pCurrentHistory->uiDate; /* @@ -981,20 +972,20 @@ void DisplayPageNumberAndDateRange( void ) pTempHistory=pTempHistory->Next; } - // set last page + // set last page iLastPage=iCounter/NUM_RECORDS_PER_PAGE; */ iLastPage = GetNumberOfHistoryPages(); // set temp to current, to get last date - pTempHistory=pCurrentHistory; - + pTempHistory=pCurrentHistory; + // reset counter iCounter=0; // run through list until end or num_records, which ever first - while((pTempHistory)&&(iCounter < NUM_RECORDS_PER_PAGE)) + while((pTempHistory)&&(iCounter < NUM_RECORDS_PER_PAGE)) { uiLastDate=pTempHistory->uiDate; iCounter++; @@ -1002,20 +993,20 @@ void DisplayPageNumberAndDateRange( void ) pTempHistory = pTempHistory->Next; } - + // get the last page - - swprintf( sString, L"%s %d / %d",pHistoryHeaders[1], iCurrentHistoryPage , iLastPage +1 ); + + swprintf( sString, L"%s %d / %d",pHistoryHeaders[1], iCurrentHistoryPage , iLastPage +1 ); mprintf( PAGE_NUMBER_X, PAGE_NUMBER_Y, sString ); - swprintf( sString, L"%s %d - %d",pHistoryHeaders[2], pCurrentHistory->uiDate / ( 24 * 60 ) , uiLastDate/( 24 * 60 ) ); - mprintf( HISTORY_DATE_X, HISTORY_DATE_Y, sString ); + swprintf( sString, L"%s %d - %d",pHistoryHeaders[2], pCurrentHistory->uiDate / ( 24 * 60 ) , uiLastDate/( 24 * 60 ) ); + mprintf( HISTORY_DATE_X, HISTORY_DATE_Y, sString ); + - // reset shadow SetFontShadow(DEFAULT_SHADOW); - + return; } @@ -1031,7 +1022,7 @@ void ProcessHistoryTransactionString(STR16 pString, HistoryUnitPtr pHistory) break; case HISTORY_HIRED_MERC_FROM_AIM: - swprintf(pString, pHistoryStrings[ HISTORY_HIRED_MERC_FROM_AIM ], gMercProfiles[pHistory->ubSecondCode].zName ); + swprintf(pString, pHistoryStrings[ HISTORY_HIRED_MERC_FROM_AIM ], gMercProfiles[pHistory->ubSecondCode].zName ); break; case HISTORY_MERC_KILLED: @@ -1040,13 +1031,13 @@ void ProcessHistoryTransactionString(STR16 pString, HistoryUnitPtr pHistory) #ifdef JA2BETAVERSION else { - swprintf(pString, pHistoryStrings[ HISTORY_MERC_KILLED ], L"ERROR!!! NO_PROFILE" ); + swprintf(pString, pHistoryStrings[ HISTORY_MERC_KILLED ], L"ERROR!!! NO_PROFILE" ); } #endif break; case HISTORY_HIRED_MERC_FROM_MERC: - swprintf(pString, pHistoryStrings[ HISTORY_HIRED_MERC_FROM_MERC ], gMercProfiles[pHistory->ubSecondCode].zName ); + swprintf(pString, pHistoryStrings[ HISTORY_HIRED_MERC_FROM_MERC ], gMercProfiles[pHistory->ubSecondCode].zName ); break; case HISTORY_SETTLED_ACCOUNTS_AT_MERC: @@ -1057,16 +1048,16 @@ void ProcessHistoryTransactionString(STR16 pString, HistoryUnitPtr pHistory) break; case( HISTORY_CHARACTER_GENERATED ): swprintf(pString, pHistoryStrings[ HISTORY_CHARACTER_GENERATED ] ); - break; + break; case( HISTORY_PURCHASED_INSURANCE ): swprintf(pString, pHistoryStrings[ HISTORY_PURCHASED_INSURANCE ], gMercProfiles[pHistory->ubSecondCode].zNickname ); - break; + break; case( HISTORY_CANCELLED_INSURANCE ): swprintf(pString, pHistoryStrings[ HISTORY_CANCELLED_INSURANCE ], gMercProfiles[pHistory->ubSecondCode].zNickname ); - break; + break; case( HISTORY_INSURANCE_CLAIM_PAYOUT ): swprintf(pString, pHistoryStrings[ HISTORY_INSURANCE_CLAIM_PAYOUT ], gMercProfiles[pHistory->ubSecondCode].zNickname ); - break; + break; case HISTORY_EXTENDED_CONTRACT_1_DAY: swprintf(pString, pHistoryStrings[ HISTORY_EXTENDED_CONTRACT_1_DAY ], gMercProfiles[pHistory->ubSecondCode].zNickname ); @@ -1079,28 +1070,28 @@ void ProcessHistoryTransactionString(STR16 pString, HistoryUnitPtr pHistory) case HISTORY_EXTENDED_CONTRACT_2_WEEK: swprintf(pString, pHistoryStrings[ HISTORY_EXTENDED_CONTRACT_2_WEEK ], gMercProfiles[pHistory->ubSecondCode].zNickname ); break; - + case( HISTORY_MERC_FIRED ): swprintf(pString, pHistoryStrings[ HISTORY_MERC_FIRED ], gMercProfiles[pHistory->ubSecondCode].zNickname ); - break; + break; case( HISTORY_MERC_QUIT ): swprintf(pString, pHistoryStrings[ HISTORY_MERC_QUIT ], gMercProfiles[pHistory->ubSecondCode].zNickname ); - break; + break; case( HISTORY_QUEST_STARTED ): GetQuestStartedString( pHistory->ubSecondCode, sString ); swprintf(pString, sString ); - break; + break; case( HISTORY_QUEST_FINISHED ): GetQuestEndedString( pHistory->ubSecondCode, sString ); swprintf(pString, sString ); - break; + break; case( HISTORY_TALKED_TO_MINER ): swprintf(pString, pHistoryStrings[ HISTORY_TALKED_TO_MINER ], pTownNames[ pHistory->ubSecondCode ] ); - break; + break; case( HISTORY_LIBERATED_TOWN ): swprintf(pString, pHistoryStrings[ HISTORY_LIBERATED_TOWN ], pTownNames[ pHistory->ubSecondCode ] ); break; @@ -1191,9 +1182,9 @@ void ProcessHistoryTransactionString(STR16 pString, HistoryUnitPtr pHistory) void DrawHistoryLocation( INT16 sSectorX, INT16 sSectorY ) { - // will draw the location of the history event + // will draw the location of the history event + - return; } @@ -1201,33 +1192,33 @@ void DrawHistoryLocation( INT16 sSectorX, INT16 sSectorY ) void SetHistoryButtonStates( void ) { // this function will look at what page we are viewing, enable and disable buttons as needed - + if( iCurrentHistoryPage == 1 ) { // first page, disable left buttons DisableButton( giHistoryButton[PREV_PAGE_BUTTON] ); - + } else { // enable buttons EnableButton( giHistoryButton[PREV_PAGE_BUTTON] ); - + } if( IncrementCurrentPageHistoryDisplay( ) ) { // decrement page - iCurrentHistoryPage--; + iCurrentHistoryPage--; DrawAPageofHistoryRecords( ); - + // enable buttons EnableButton( giHistoryButton[ NEXT_PAGE_BUTTON ] ); } else { - DisableButton( giHistoryButton[ NEXT_PAGE_BUTTON ] ); + DisableButton( giHistoryButton[ NEXT_PAGE_BUTTON ] ); } } @@ -1235,18 +1226,18 @@ void SetHistoryButtonStates( void ) BOOLEAN LoadInHistoryRecords( UINT32 uiPage ) { // loads in records belogning, to page uiPage - // no file, return + // no file, return BOOLEAN fOkToContinue=TRUE; - INT32 iCount =0; - HWFILE hFileHandle; - UINT8 ubCode, ubSecondCode; + INT32 iCount =0; + HWFILE hFileHandle; + UINT8 ubCode, ubSecondCode; INT16 sSectorX, sSectorY; - INT8 bSectorZ; + INT8 bSectorZ; UINT32 uiDate; UINT8 ubColor; - INT32 iBytesRead=0; - UINT32 uiByteCount=0; - + INT32 iBytesRead=0; + UINT32 uiByteCount=0; + // check if bad page if( uiPage == 0 ) { @@ -1258,42 +1249,42 @@ BOOLEAN LoadInHistoryRecords( UINT32 uiPage ) return( FALSE ); // open file - hFileHandle=FileOpen( HISTORY_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + hFileHandle=FileOpen( HISTORY_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); // failed to get file, return if(!hFileHandle) { return( FALSE ); - } + } // make sure file is more than 0 length - if ( FileGetSize( hFileHandle ) == 0 ) + if ( FileGetSize( hFileHandle ) == 0 ) { - FileClose( hFileHandle ); + FileClose( hFileHandle ); return( FALSE ); } - // is the file long enough? - if( ( FileGetSize( hFileHandle ) - 1 ) / ( NUM_RECORDS_PER_PAGE * SIZE_OF_HISTORY_FILE_RECORD ) + 1 < uiPage ) + // is the file long enough? + if( ( FileGetSize( hFileHandle ) - 1 ) / ( NUM_RECORDS_PER_PAGE * SIZE_OF_HISTORY_FILE_RECORD ) + 1 < uiPage ) { // nope FileClose( hFileHandle ); - return( FALSE ); + return( FALSE ); } FileSeek( hFileHandle, ( uiPage - 1 ) * NUM_RECORDS_PER_PAGE * ( SIZE_OF_HISTORY_FILE_RECORD), FILE_SEEK_FROM_START ); - - uiByteCount = ( uiPage - 1 ) * NUM_RECORDS_PER_PAGE * (SIZE_OF_HISTORY_FILE_RECORD ); + + uiByteCount = ( uiPage - 1 ) * NUM_RECORDS_PER_PAGE * (SIZE_OF_HISTORY_FILE_RECORD ); // file exists, read in data, continue until end of page - while( ( iCount < NUM_RECORDS_PER_PAGE )&&( fOkToContinue ) ) + while( ( iCount < NUM_RECORDS_PER_PAGE )&&( fOkToContinue ) ) { - + // read in other data - FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &ubSecondCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &uiDate, sizeof(UINT32), (UINT32 *)&iBytesRead ); - FileRead( hFileHandle, &sSectorX, sizeof(INT16), (UINT32 *)&iBytesRead ); - FileRead( hFileHandle, &sSectorY, sizeof(INT16), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &sSectorX, sizeof(INT16), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &sSectorY, sizeof(INT16), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &bSectorZ, sizeof(INT8), (UINT32 *)&iBytesRead ); FileRead( hFileHandle, &ubColor, sizeof(UINT8), (UINT32 *)&iBytesRead ); @@ -1303,26 +1294,26 @@ BOOLEAN LoadInHistoryRecords( UINT32 uiPage ) #endif // add transaction - ProcessAndEnterAHistoryRecord(ubCode, uiDate, ubSecondCode, sSectorX, sSectorY, bSectorZ, ubColor); + ProcessAndEnterAHistoryRecord(ubCode, uiDate, ubSecondCode, sSectorX, sSectorY, bSectorZ, ubColor); // increment byte counter - uiByteCount += SIZE_OF_HISTORY_FILE_RECORD; - + uiByteCount += SIZE_OF_HISTORY_FILE_RECORD; + // we've overextended our welcome, and bypassed end of file, get out - if( uiByteCount >= FileGetSize( hFileHandle ) ) + if( uiByteCount >= FileGetSize( hFileHandle ) ) { // not ok to continue fOkToContinue = FALSE; } iCount++; - } - - // close file + } + + // close file FileClose( hFileHandle ); // check to see if we in fact have a list to display - if( pHistoryListHead == NULL ) + if( pHistoryListHead == NULL ) { // got no records, return false return( FALSE ); @@ -1338,14 +1329,13 @@ BOOLEAN LoadInHistoryRecords( UINT32 uiPage ) BOOLEAN WriteOutHistoryRecords( UINT32 uiPage ) { // loads in records belogning, to page uiPage - // no file, return + // no file, return BOOLEAN fOkToContinue=TRUE; - INT32 iCount =0; - HWFILE hFileHandle; + INT32 iCount =0; + HWFILE hFileHandle; HistoryUnitPtr pList; - INT32 iBytesRead=0; - UINT32 uiByteCount=0; - + UINT32 uiByteCount=0; + // check if bad page if( uiPage == 0 ) { @@ -1357,55 +1347,55 @@ BOOLEAN WriteOutHistoryRecords( UINT32 uiPage ) return( FALSE ); // open file - hFileHandle=FileOpen( HISTORY_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_WRITE ), FALSE ); + hFileHandle=FileOpen( HISTORY_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_WRITE ), FALSE ); // failed to get file, return if(!hFileHandle) { return( FALSE ); - } + } // make sure file is more than 0 length - if ( FileGetSize( hFileHandle ) == 0 ) + if ( FileGetSize( hFileHandle ) == 0 ) { - FileClose( hFileHandle ); + FileClose( hFileHandle ); return( FALSE ); } - // is the file long enough? - if( ( FileGetSize( hFileHandle ) - 1 ) / ( NUM_RECORDS_PER_PAGE * SIZE_OF_HISTORY_FILE_RECORD ) + 1 < uiPage ) + // is the file long enough? + if( ( FileGetSize( hFileHandle ) - 1 ) / ( NUM_RECORDS_PER_PAGE * SIZE_OF_HISTORY_FILE_RECORD ) + 1 < uiPage ) { // nope FileClose( hFileHandle ); - return( FALSE ); + return( FALSE ); } pList = pHistoryListHead; - + if( pList == NULL ) { return( FALSE ); } - + FileSeek( hFileHandle, sizeof( INT32 ) + ( uiPage - 1 ) * NUM_RECORDS_PER_PAGE * SIZE_OF_HISTORY_FILE_RECORD, FILE_SEEK_FROM_START ); - + uiByteCount = /*sizeof( INT32 )+ */( uiPage - 1 ) * NUM_RECORDS_PER_PAGE * SIZE_OF_HISTORY_FILE_RECORD; // file exists, read in data, continue until end of page - while( ( iCount < NUM_RECORDS_PER_PAGE )&&( fOkToContinue ) ) + while( ( iCount < NUM_RECORDS_PER_PAGE )&&( fOkToContinue ) ) { #ifdef JA2TESTVERSION //perform a check on the data to see if it is pooched PerformCheckOnHistoryRecord( 4, pList->sSectorX, pList->sSectorY, pList->bSectorZ ); #endif - - FileWrite( hFileHandle, &(pList->ubCode ), sizeof ( UINT8 ), NULL ); - FileWrite( hFileHandle, &(pList->ubSecondCode ), sizeof ( UINT8 ), NULL ); - FileWrite( hFileHandle, &(pList->uiDate ), sizeof ( UINT32 ), NULL ); - FileWrite( hFileHandle, &(pList->sSectorX ), sizeof ( INT16 ), NULL ); - FileWrite( hFileHandle, &(pList->sSectorY ), sizeof ( INT16 ), NULL ); - FileWrite( hFileHandle, &(pList->bSectorZ ), sizeof ( INT8 ), NULL ); - FileWrite( hFileHandle, &(pList->ubColor ), sizeof ( UINT8 ), NULL ); + + FileWrite( hFileHandle, &(pList->ubCode ), sizeof ( UINT8 ), NULL ); + FileWrite( hFileHandle, &(pList->ubSecondCode ), sizeof ( UINT8 ), NULL ); + FileWrite( hFileHandle, &(pList->uiDate ), sizeof ( UINT32 ), NULL ); + FileWrite( hFileHandle, &(pList->sSectorX ), sizeof ( INT16 ), NULL ); + FileWrite( hFileHandle, &(pList->sSectorY ), sizeof ( INT16 ), NULL ); + FileWrite( hFileHandle, &(pList->bSectorZ ), sizeof ( INT8 ), NULL ); + FileWrite( hFileHandle, &(pList->ubColor ), sizeof ( UINT8 ), NULL ); pList = pList->Next; @@ -1417,9 +1407,9 @@ BOOLEAN WriteOutHistoryRecords( UINT32 uiPage ) } iCount++; - } - - // close file + } + + // close file FileClose( hFileHandle ); ClearHistoryList( ); @@ -1429,22 +1419,22 @@ BOOLEAN WriteOutHistoryRecords( UINT32 uiPage ) BOOLEAN LoadNextHistoryPage( void ) { - - // clear out old list of records, and load in previous page worth of records - ClearHistoryList( ); - - + // clear out old list of records, and load in previous page worth of records + ClearHistoryList( ); + + + // now load in previous page's records, if we can - if ( LoadInHistoryRecords( iCurrentHistoryPage + 1 ) ) + if ( LoadInHistoryRecords( iCurrentHistoryPage + 1 ) ) { iCurrentHistoryPage++; - return ( TRUE ); + return ( TRUE ); } else { LoadInHistoryRecords( iCurrentHistoryPage ); - return ( FALSE ); + return ( FALSE ); } } @@ -1452,25 +1442,25 @@ BOOLEAN LoadNextHistoryPage( void ) BOOLEAN LoadPreviousHistoryPage( void ) { - + // clear out old list of records, and load in previous page worth of records - ClearHistoryList( ); + ClearHistoryList( ); // load previous page if( ( iCurrentHistoryPage == 1 ) ) { return ( FALSE ); } - + // now load in previous page's records, if we can - if ( LoadInHistoryRecords( iCurrentHistoryPage - 1 ) ) + if ( LoadInHistoryRecords( iCurrentHistoryPage - 1 ) ) { iCurrentHistoryPage--; return ( TRUE ); } else { - LoadInHistoryRecords( iCurrentHistoryPage ); + LoadInHistoryRecords( iCurrentHistoryPage ); return ( FALSE ); } } @@ -1479,37 +1469,36 @@ BOOLEAN LoadPreviousHistoryPage( void ) void SetLastPageInHistoryRecords( void ) { // grabs the size of the file and interprets number of pages it will take up - HWFILE hFileHandle; - INT32 iBytesRead=0; + HWFILE hFileHandle; // no file, return if ( ! (FileExists( HISTORY_DATA_FILE ) ) ) return; // open file - hFileHandle=FileOpen( HISTORY_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + hFileHandle=FileOpen( HISTORY_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); // failed to get file, return if(!hFileHandle) { guiLastPageInHistoryRecordsList = 1; return; - } + } // make sure file is more than 0 length - if ( FileGetSize( hFileHandle ) == 0 ) + if ( FileGetSize( hFileHandle ) == 0 ) { - FileClose( hFileHandle ); - guiLastPageInHistoryRecordsList = 1; + FileClose( hFileHandle ); + guiLastPageInHistoryRecordsList = 1; return; } - - + + // done with file, close it FileClose( hFileHandle ); guiLastPageInHistoryRecordsList = ReadInLastElementOfHistoryListAndReturnIdNumber( ) / NUM_RECORDS_PER_PAGE; - + return; } @@ -1517,65 +1506,63 @@ UINT32 ReadInLastElementOfHistoryListAndReturnIdNumber( void ) { // this function will read in the last unit in the history list, to grab it's id number - - HWFILE hFileHandle; - INT32 iBytesRead=0; - INT32 iFileSize = 0; + + HWFILE hFileHandle; + INT32 iFileSize = 0; // no file, return if ( ! (FileExists( HISTORY_DATA_FILE ) ) ) return 0; // open file - hFileHandle=FileOpen( HISTORY_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + hFileHandle=FileOpen( HISTORY_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); // failed to get file, return if(!hFileHandle) { return 0; - } + } // make sure file is more than balance size + length of 1 record - 1 byte - if ( FileGetSize( hFileHandle ) < SIZE_OF_HISTORY_FILE_RECORD ) + if ( FileGetSize( hFileHandle ) < SIZE_OF_HISTORY_FILE_RECORD ) { - FileClose( hFileHandle ); - return 0; + FileClose( hFileHandle ); + return 0; } - + // size is? - iFileSize = FileGetSize( hFileHandle ); + iFileSize = FileGetSize( hFileHandle ); // done with file, close it FileClose( hFileHandle ); - // file size / sizeof record in bytes is id - return ( ( iFileSize ) / ( SIZE_OF_HISTORY_FILE_RECORD ) ); - + // file size / sizeof record in bytes is id + return ( ( iFileSize ) / ( SIZE_OF_HISTORY_FILE_RECORD ) ); + } BOOLEAN AppendHistoryToEndOfFile( HistoryUnitPtr pHistory ) { - // will write the current finance to disk - HWFILE hFileHandle; - INT32 iBytesWritten=0; - HistoryUnitPtr pHistoryList=pHistoryListHead; - - + // will write the current finance to disk + HWFILE hFileHandle; + HistoryUnitPtr pHistoryList=pHistoryListHead; + + // open file hFileHandle=FileOpen( HISTORY_DATA_FILE, FILE_ACCESS_WRITE|FILE_OPEN_ALWAYS, FALSE); // if no file exits, do nothing if(!hFileHandle) { - return ( FALSE ); + return ( FALSE ); } - + // go to the end if( FileSeek( hFileHandle,0,FILE_SEEK_FROM_END ) == FALSE ) { // error - FileClose( hFileHandle ); + FileClose( hFileHandle ); return( FALSE ); } @@ -1584,31 +1571,30 @@ BOOLEAN AppendHistoryToEndOfFile( HistoryUnitPtr pHistory ) PerformCheckOnHistoryRecord( 5, pHistoryList->sSectorX, pHistoryList->sSectorY, pHistoryList->bSectorZ ); #endif - - // now write date and amount, and code - FileWrite( hFileHandle, &(pHistoryList->ubCode ), sizeof ( UINT8 ), NULL ); - FileWrite( hFileHandle, &(pHistoryList->ubSecondCode ), sizeof ( UINT8 ), NULL ); - FileWrite( hFileHandle, &(pHistoryList->uiDate ), sizeof ( UINT32 ), NULL ); - FileWrite( hFileHandle, &(pHistoryList->sSectorX ), sizeof ( INT16 ), NULL ); - FileWrite( hFileHandle, &(pHistoryList->sSectorY ), sizeof ( INT16 ), NULL ); - FileWrite( hFileHandle, &(pHistoryList->bSectorZ ), sizeof ( INT8 ), NULL ); - FileWrite( hFileHandle, &(pHistoryList->ubColor ), sizeof ( UINT8 ), NULL ); + + // now write date and amount, and code + FileWrite( hFileHandle, &(pHistoryList->ubCode ), sizeof ( UINT8 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->ubSecondCode ), sizeof ( UINT8 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->uiDate ), sizeof ( UINT32 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->sSectorX ), sizeof ( INT16 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->sSectorY ), sizeof ( INT16 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->bSectorZ ), sizeof ( INT8 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->ubColor ), sizeof ( UINT8 ), NULL ); // close file - FileClose( hFileHandle ); + FileClose( hFileHandle ); - return( TRUE ); + return( TRUE ); } void ResetHistoryFact( UINT8 ubCode, INT16 sSectorX, INT16 sSectorY ) { // run through history list - INT32 iOldHistoryPage = iCurrentHistoryPage; HistoryUnitPtr pList = pHistoryListHead; BOOLEAN fFound = FALSE; - // set current page to before list + // set current page to before list iCurrentHistoryPage = 0; SetLastPageInHistoryRecords( ); @@ -1619,29 +1605,29 @@ void ResetHistoryFact( UINT8 ubCode, INT16 sSectorX, INT16 sSectorY ) while( pList ) { - if( ( pList -> ubSecondCode == ubCode ) && ( pList->ubCode == HISTORY_QUEST_STARTED ) ) + if( ( pList->ubSecondCode == ubCode ) && ( pList->ubCode == HISTORY_QUEST_STARTED ) ) { // reset color - pList -> ubColor = 0; + pList->ubColor = 0; fFound = TRUE; - + // save OpenAndWriteHistoryFile( ); pList = NULL; } - + if( fFound != TRUE ) { pList = pList->Next; } } - + if( fInHistoryMode ) { - iCurrentHistoryPage--; - + iCurrentHistoryPage--; + // load in first page - LoadNextHistoryPage( ); + LoadNextHistoryPage( ); } SetHistoryFact( HISTORY_QUEST_FINISHED, ubCode, GetWorldTotalMin(), sSectorX, sSectorY ); @@ -1652,12 +1638,11 @@ void ResetHistoryFact( UINT8 ubCode, INT16 sSectorX, INT16 sSectorY ) UINT32 GetTimeQuestWasStarted( UINT8 ubCode ) { // run through history list - INT32 iOldHistoryPage = iCurrentHistoryPage; HistoryUnitPtr pList = pHistoryListHead; BOOLEAN fFound = FALSE; UINT32 uiTime = 0; - // set current page to before list + // set current page to before list iCurrentHistoryPage = 0; SetLastPageInHistoryRecords( ); @@ -1668,26 +1653,26 @@ UINT32 GetTimeQuestWasStarted( UINT8 ubCode ) while( pList ) { - if( ( pList -> ubSecondCode == ubCode ) && ( pList->ubCode == HISTORY_QUEST_STARTED ) ) + if( ( pList->ubSecondCode == ubCode ) && ( pList->ubCode == HISTORY_QUEST_STARTED ) ) { uiTime = pList->uiDate; fFound = TRUE; - + pList = NULL; } - + if( fFound != TRUE ) { pList = pList->Next; } } - + if( fInHistoryMode ) { - iCurrentHistoryPage--; - + iCurrentHistoryPage--; + // load in first page - LoadNextHistoryPage( ); + LoadNextHistoryPage( ); } return( uiTime ); @@ -1696,14 +1681,14 @@ UINT32 GetTimeQuestWasStarted( UINT8 ubCode ) void GetQuestStartedString( UINT8 ubQuestValue, STR16 sQuestString ) { // open the file and copy the string - LoadEncryptedDataFromFile( "BINARYDATA\\quests.edt", sQuestString, 160 * ( ubQuestValue * 2 ), 160 ); + LoadEncryptedDataFromFile( "BINARYDATA\\quests.edt", sQuestString, 160 * ( ubQuestValue * 2 ), 160 ); } void GetQuestEndedString( UINT8 ubQuestValue, STR16 sQuestString ) { // open the file and copy the string - LoadEncryptedDataFromFile( "BINARYDATA\\quests.edt", sQuestString, 160 * ( ( ubQuestValue * 2 ) + 1), 160 ); + LoadEncryptedDataFromFile( "BINARYDATA\\quests.edt", sQuestString, 160 * ( ( ubQuestValue * 2 ) + 1), 160 ); } @@ -1724,25 +1709,25 @@ INT32 GetNumberOfHistoryPages() { HWFILE hFileHandle; UINT32 uiFileSize=0; - UINT32 uiSizeOfRecordsOnEachPage = 0; + UINT32 uiSizeOfRecordsOnEachPage = 0; INT32 iNumberOfHistoryPages = 0; - + if ( ! (FileExists( HISTORY_DATA_FILE ) ) ) return( 0 ); // open file - hFileHandle=FileOpen( HISTORY_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + hFileHandle=FileOpen( HISTORY_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); // failed to get file, return if(!hFileHandle) { return( 0 ); - } + } // make sure file is more than 0 length - if ( FileGetSize( hFileHandle ) == 0 ) + if ( FileGetSize( hFileHandle ) == 0 ) { - FileClose( hFileHandle ); + FileClose( hFileHandle ); return( 0 ); } @@ -1758,6 +1743,7 @@ INT32 GetNumberOfHistoryPages() - + + diff --git a/Laptop/history.h b/Laptop/history.h index 09b64cd5..826bc04c 100644 --- a/Laptop/history.h +++ b/Laptop/history.h @@ -26,9 +26,9 @@ struct history{ enum{ HISTORY_ENTERED_HISTORY_MODE=0, - HISTORY_HIRED_MERC_FROM_AIM, + HISTORY_HIRED_MERC_FROM_AIM, HISTORY_HIRED_MERC_FROM_MERC, - HISTORY_MERC_KILLED, + HISTORY_MERC_KILLED, HISTORY_SETTLED_ACCOUNTS_AT_MERC, HISTORY_ACCEPTED_ASSIGNMENT_FROM_ENRICO, HISTORY_CHARACTER_GENERATED, diff --git a/Laptop/insurance Comments.cpp b/Laptop/insurance Comments.cpp index 9dd6431c..96d7120b 100644 --- a/Laptop/insurance Comments.cpp +++ b/Laptop/insurance Comments.cpp @@ -37,7 +37,7 @@ UINT32 guiInsCmntBulletImage; //link to the varios pages -MOUSE_REGION gSelectedInsuranceCommentLinkRegion[3]; +MOUSE_REGION gSelectedInsuranceCommentLinkRegion[3]; void SelectInsuranceCommentLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); @@ -53,7 +53,7 @@ void GameInitInsuranceComments() BOOLEAN EnterInsuranceComments() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; UINT8 i; UINT16 usPosX; @@ -68,9 +68,9 @@ BOOLEAN EnterInsuranceComments() for( i=0; i<3; i++) { MSYS_DefineRegion( &gSelectedInsuranceCommentLinkRegion[i], usPosX, INS_CMNT_LINK_Y-1, (UINT16)(usPosX + INS_CMNT_LINK_WIDTH), INS_CMNT_LINK_Y+INS_CMNT_LINK_HEIGHT+1, MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectInsuranceCommentLinkRegionCallBack); - MSYS_AddRegion(&gSelectedInsuranceCommentLinkRegion[i]); - MSYS_SetRegionUserData( &gSelectedInsuranceCommentLinkRegion[i], 0, i ); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectInsuranceCommentLinkRegionCallBack); + MSYS_AddRegion(&gSelectedInsuranceCommentLinkRegion[i]); + MSYS_SetRegionUserData( &gSelectedInsuranceCommentLinkRegion[i], 0, i ); usPosX += INS_CMNT_LINK_OFFSET_X; } @@ -100,7 +100,7 @@ void HandleInsuranceComments() void RenderInsuranceComments() { -// HVOBJECT hPixHandle; +// HVOBJECT hPixHandle; CHAR16 sText[800]; UINT16 usPosX, usPosY; @@ -140,7 +140,7 @@ void RenderInsuranceComments() //Display the first link text swprintf( sText, L"%s", pMessageStrings[ MSG_HOMEPAGE ] ); - DisplayWrappedString( usPosX, INS_CMNT_LINK_Y+13, INS_CMNT_LINK_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + DisplayWrappedString( usPosX, INS_CMNT_LINK_Y+13, INS_CMNT_LINK_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); //Display the red bar under the link at the bottom DisplaySmallRedLineWithShadow( usPosX, INS_CMNT_LINK_Y+INS_CMNT_LINK_HEIGHT, (UINT16)(usPosX+INS_CMNT_LINK_WIDTH), INS_CMNT_LINK_Y+INS_CMNT_LINK_HEIGHT); usPosX += INS_CMNT_LINK_OFFSET_X; @@ -160,14 +160,14 @@ void RenderInsuranceComments() DisplaySmallRedLineWithShadow( usPosX, INS_CMNT_LINK_Y+INS_CMNT_LINK_HEIGHT, (UINT16)(usPosX+INS_CMNT_LINK_WIDTH), INS_CMNT_LINK_Y+INS_CMNT_LINK_HEIGHT); SetFontShadow(DEFAULT_SHADOW); - MarkButtonsDirty( ); + MarkButtonsDirty( ); RenderWWWProgramTitleBar( ); - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } void SelectInsuranceCommentLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -184,14 +184,14 @@ void SelectInsuranceCommentLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iRea } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } BOOLEAN DisplayComment( UINT8 ubCommentorsName, UINT8 ubComment, UINT16 usPosY ) { CHAR16 sText[800]; - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; UINT16 sNumPixels=0; @@ -201,7 +201,7 @@ BOOLEAN DisplayComment( UINT8 ubCommentorsName, UINT8 ubComment, UINT16 usPosY ) //Display the commenters comment GetInsuranceText( ubComment, sText ); //+INS_CMNT_COMMENT_OFFSET_Y - sNumPixels = DisplayWrappedString( INS_CMNT_FIRST_BULLET_X+INSURANCE_BULLET_TEXT_OFFSET_X, (UINT16)(usPosY), INS_CMNT_COMMENT_TEXT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + sNumPixels = DisplayWrappedString( INS_CMNT_FIRST_BULLET_X+INSURANCE_BULLET_TEXT_OFFSET_X, (UINT16)(usPosY), INS_CMNT_COMMENT_TEXT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); //Display the red bar under the link at the bottom DisplaySmallRedLineWithShadow( INS_CMNT_FIRST_BULLET_X+INSURANCE_BULLET_TEXT_OFFSET_X, (UINT16)(usPosY+sNumPixels), INS_CMNT_FIRST_BULLET_X+INS_CMNT_REDLINE_WIDTH, (UINT16)(usPosY+sNumPixels)); @@ -216,3 +216,4 @@ BOOLEAN DisplayComment( UINT8 ubCommentorsName, UINT8 ubComment, UINT16 usPosY ) } + diff --git a/Laptop/insurance Contract.cpp b/Laptop/insurance Contract.cpp index c1a76097..8d6876a6 100644 --- a/Laptop/insurance Contract.cpp +++ b/Laptop/insurance Contract.cpp @@ -124,7 +124,7 @@ INT16 gsMaxPlayersOnTeam; //link to the varios pages -MOUSE_REGION gSelectedInsuranceContractLinkRegion[2]; +MOUSE_REGION gSelectedInsuranceContractLinkRegion[2]; void SelectInsuranceContractRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); INT32 guiInsContractPrevButtonImage; @@ -203,7 +203,7 @@ void EnterLaptopInitInsuranceContract() BOOLEAN EnterInsuranceContract() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; UINT16 usPosX,i; //build the list of mercs that are can be displayed @@ -212,7 +212,7 @@ BOOLEAN EnterInsuranceContract() gubNumberofDisplayedInsuranceGrids = GetNumberOfHireMercsStartingFromID( (UINT8) gsCurrentInsuranceMercIndex ); if( gubNumberofDisplayedInsuranceGrids > 3 ) gubNumberofDisplayedInsuranceGrids = 3; - + InitInsuranceDefaults(); @@ -232,9 +232,9 @@ BOOLEAN EnterInsuranceContract() for(i=0; i<2; i++) { MSYS_DefineRegion( &gSelectedInsuranceContractLinkRegion[i], usPosX, INS_CTRCT_BOTTON_LINK_RED_BAR_Y-37, (UINT16)(usPosX + INS_CTRCT_BOTTOM_LINK_RED_WIDTH), INS_CTRCT_BOTTON_LINK_RED_BAR_Y+2, MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectInsuranceContractRegionCallBack); - MSYS_AddRegion(&gSelectedInsuranceContractLinkRegion[i]); - MSYS_SetRegionUserData( &gSelectedInsuranceContractLinkRegion[i], 0, i ); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectInsuranceContractRegionCallBack); + MSYS_AddRegion(&gSelectedInsuranceContractLinkRegion[i]); + MSYS_SetRegionUserData( &gSelectedInsuranceContractLinkRegion[i], 0, i ); usPosX += INS_CTRCT_BOTTOM_LINK_RED_BAR_OFFSET; } @@ -242,24 +242,24 @@ BOOLEAN EnterInsuranceContract() //left arrow guiInsContractPrevButtonImage = LoadButtonImage("LAPTOP\\InsLeftButton.sti", 2,0,-1,1,-1 ); - guiInsContractPrevBackButton = CreateIconAndTextButton( guiInsContractPrevButtonImage, InsContractText[INS_CONTRACT_PREVIOUS], INS_FONT_BIG, - INS_FONT_COLOR, INS_FONT_SHADOW, - INS_FONT_COLOR, INS_FONT_SHADOW, - TEXT_CJUSTIFIED, - INS_INFO_LEFT_ARROW_BUTTON_X, INS_INFO_LEFT_ARROW_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnInsContractPrevButtonCallback); + guiInsContractPrevBackButton = CreateIconAndTextButton( guiInsContractPrevButtonImage, InsContractText[INS_CONTRACT_PREVIOUS], INS_FONT_BIG, + INS_FONT_COLOR, INS_FONT_SHADOW, + INS_FONT_COLOR, INS_FONT_SHADOW, + TEXT_CJUSTIFIED, + INS_INFO_LEFT_ARROW_BUTTON_X, INS_INFO_LEFT_ARROW_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnInsContractPrevButtonCallback); SetButtonCursor( guiInsContractPrevBackButton, CURSOR_WWW ); SpecifyButtonTextOffsets( guiInsContractPrevBackButton, 17, 16, FALSE ); //Right arrow guiInsContractNextButtonImage = LoadButtonImage("LAPTOP\\InsRightButton.sti", 2,0,-1,1,-1 ); - guiInsContractNextBackButton = CreateIconAndTextButton( guiInsContractNextButtonImage, InsContractText[INS_CONTRACT_NEXT], INS_FONT_BIG, - INS_FONT_COLOR, INS_FONT_SHADOW, - INS_FONT_COLOR, INS_FONT_SHADOW, - TEXT_CJUSTIFIED, - INS_INFO_RIGHT_ARROW_BUTTON_X, INS_INFO_RIGHT_ARROW_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnInsContractNextButtonCallBack); + guiInsContractNextBackButton = CreateIconAndTextButton( guiInsContractNextButtonImage, InsContractText[INS_CONTRACT_NEXT], INS_FONT_BIG, + INS_FONT_COLOR, INS_FONT_SHADOW, + INS_FONT_COLOR, INS_FONT_SHADOW, + TEXT_CJUSTIFIED, + INS_INFO_RIGHT_ARROW_BUTTON_X, INS_INFO_RIGHT_ARROW_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnInsContractNextButtonCallBack); SetButtonCursor( guiInsContractNextBackButton, CURSOR_WWW ); SpecifyButtonTextOffsets( guiInsContractNextBackButton, 18, 16, FALSE ); @@ -315,7 +315,7 @@ void HandleInsuranceContract() gfChangeInsuranceFormButtons = FALSE; //force a redraw of the screen to erase the old buttons - fPausedReDrawScreenFlag = TRUE; + fPausedReDrawScreenFlag = TRUE; RenderInsuranceContract(); MarkButtonsDirty(); @@ -328,13 +328,12 @@ void HandleInsuranceContract() void RenderInsuranceContract() { - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; CHAR16 sText[800]; UINT8 ubCount=0; INT16 sMercID; INT16 sNextMercID; UINT16 usPosX; - BOOLEAN fIsThereAnyAimMercs = FALSE; SOLDIERTYPE *pSoldier = NULL; @@ -347,17 +346,17 @@ void RenderInsuranceContract() usPosX = INS_CTRCT_BOTTOM_LINK_RED_BAR_X; - //Display the red bar under the link at the bottom. and the text + //Display the red bar under the link at the bottom. and the text DisplaySmallRedLineWithShadow( usPosX, INS_CTRCT_BOTTON_LINK_RED_BAR_Y, (UINT16)(usPosX+INS_CTRCT_BOTTOM_LINK_RED_WIDTH), INS_CTRCT_BOTTON_LINK_RED_BAR_Y); swprintf( sText, L"%s", pMessageStrings[ MSG_HOMEPAGE ] ); - DisplayWrappedString( usPosX, INS_CTRCT_BOTTON_LINK_Y+18, INS_CTRCT_BOTTOM_LINK_RED_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + DisplayWrappedString( usPosX, INS_CTRCT_BOTTON_LINK_Y+18, INS_CTRCT_BOTTOM_LINK_RED_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); usPosX += INS_CTRCT_BOTTOM_LINK_RED_BAR_OFFSET; - //Display the red bar under the link at the bottom. and the text + //Display the red bar under the link at the bottom. and the text DisplaySmallRedLineWithShadow( usPosX, INS_CTRCT_BOTTON_LINK_RED_BAR_Y, (UINT16)(usPosX+INS_CTRCT_BOTTOM_LINK_RED_WIDTH), INS_CTRCT_BOTTON_LINK_RED_BAR_Y); GetInsuranceText( INS_SNGL_HOW_DOES_INS_WORK, sText ); - DisplayWrappedString( usPosX, INS_CTRCT_BOTTON_LINK_Y+12, INS_CTRCT_BOTTOM_LINK_RED_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + DisplayWrappedString( usPosX, INS_CTRCT_BOTTON_LINK_Y+12, INS_CTRCT_BOTTOM_LINK_RED_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); //Display the title slogan @@ -371,7 +370,7 @@ void RenderInsuranceContract() //Display the first instruction sentence GetInsuranceText( INS_MLTI_TO_PURCHASE_INSURANCE, sText ); - DisplayWrappedString( INS_CTRCT_FIRST_BULLET_TEXT_X+INSURANCE_BULLET_TEXT_OFFSET_X, INS_CTRCT_FIRST_BULLET_TEXT_Y, INS_CTRCT_INTSRUCTION_TEXT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DisplayWrappedString( INS_CTRCT_FIRST_BULLET_TEXT_X+INSURANCE_BULLET_TEXT_OFFSET_X, INS_CTRCT_FIRST_BULLET_TEXT_Y, INS_CTRCT_INTSRUCTION_TEXT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); //Get and display the insurance bullet @@ -380,7 +379,7 @@ void RenderInsuranceContract() //Display the second instruction sentence GetInsuranceText( INS_MLTI_ONCE_SATISFIED_CLICK_ACCEPT, sText ); - DisplayWrappedString( INS_CTRCT_FIRST_BULLET_TEXT_X+INSURANCE_BULLET_TEXT_OFFSET_X, INS_CTRCT_SECOND_BULLET_TEXT_Y, INS_CTRCT_INTSRUCTION_TEXT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DisplayWrappedString( INS_CTRCT_FIRST_BULLET_TEXT_X+INSURANCE_BULLET_TEXT_OFFSET_X, INS_CTRCT_SECOND_BULLET_TEXT_Y, INS_CTRCT_INTSRUCTION_TEXT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); //Display the red bar under the instruction text DisplaySmallRedLineWithShadow( INS_CTRCT_FIRST_BULLET_TEXT_X, INS_CTRCT_RED_BAR_UNDER_INSTRUCTION_TEXT_Y, INS_CTRCT_FIRST_BULLET_TEXT_X+INS_CTRCT_INTSRUCTION_TEXT_WIDTH, INS_CTRCT_RED_BAR_UNDER_INSTRUCTION_TEXT_Y); @@ -423,11 +422,11 @@ void RenderInsuranceContract() SetFontShadow(DEFAULT_SHADOW); - MarkButtonsDirty( ); + MarkButtonsDirty( ); RenderWWWProgramTitleBar( ); - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } - + @@ -459,7 +458,7 @@ void BtnInsContractPrevButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} @@ -480,7 +479,7 @@ void BtnInsContractNextButtonCallBack(GUI_BUTTON *btn,INT32 reason) //signal that we want to change the number of forms on the page gfChangeInsuranceFormButtons = TRUE; - + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } } @@ -489,15 +488,15 @@ void BtnInsContractNextButtonCallBack(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} BOOLEAN DisplayOrderGrid( UINT8 ubGridNumber, UINT8 ubMercID ) { - VOBJECT_DESC VObjectDesc; - HVOBJECT hPixHandle; + VOBJECT_DESC VObjectDesc; + HVOBJECT hPixHandle; UINT16 usPosX, usPosY; UINT32 uiInsMercFaceImage; INT32 iCostOfContract=0; @@ -507,7 +506,7 @@ BOOLEAN DisplayOrderGrid( UINT8 ubGridNumber, UINT8 ubMercID ) SOLDIERTYPE *pSoldier; - + pSoldier = &Menptr[ GetSoldierIDFromMercID( ubMercID ) ]; @@ -550,7 +549,7 @@ BOOLEAN DisplayOrderGrid( UINT8 ubGridNumber, UINT8 ubMercID ) FilenameForBPP( sTemp, VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &uiInsMercFaceImage)); - //Get the merc's face + //Get the merc's face GetVideoObject(&hPixHandle, uiInsMercFaceImage ); //if the merc is dead, shade the face red @@ -564,14 +563,14 @@ BOOLEAN DisplayOrderGrid( UINT8 ubGridNumber, UINT8 ubMercID ) SetObjectHandleShade( uiInsMercFaceImage, 0 ); } - //Get and display the mercs face + //Get and display the mercs face BltVideoObject(FRAME_BUFFER, hPixHandle, 0, usPosX+INS_CTRCT_OG_FACE_OFFSET_X, INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_OG_FACE_OFFSET_Y, VO_BLT_SRCTRANSPARENCY,NULL); // the face images isn't needed anymore so delete it DeleteVideoObjectFromIndex( uiInsMercFaceImage ); //display the mercs nickname - DrawTextToScreen(gMercProfiles[ ubMercID ].zNickname, (UINT16)(usPosX + INS_CTRCT_OG_NICK_NAME_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y + INS_CTRCT_OG_NICK_NAME_OFFSET_Y, 0, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen(gMercProfiles[ ubMercID ].zNickname, (UINT16)(usPosX + INS_CTRCT_OG_NICK_NAME_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y + INS_CTRCT_OG_NICK_NAME_OFFSET_Y, 0, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); //Get the text to display the mercs current insurance contract status if( IsMercDead( pSoldier->ubProfile ) ) @@ -587,7 +586,7 @@ BOOLEAN DisplayOrderGrid( UINT8 ubGridNumber, UINT8 ubMercID ) //Display the contract text GetInsuranceText( INS_SNGL_DEAD_NO_CONTRACT, sText ); } - DisplayWrappedString( (UINT16)(usPosX+INS_CTRCT_OG_HAS_CONTRACT_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_OG_HAS_CONTRACT_OFFSET_Y, INS_CTRCT_CONTRACT_STATUS_TEXT_WIDTH, 2, INS_FONT_SMALL, INS_FONT_COLOR_RED, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DisplayWrappedString( (UINT16)(usPosX+INS_CTRCT_OG_HAS_CONTRACT_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_OG_HAS_CONTRACT_OFFSET_Y, INS_CTRCT_CONTRACT_STATUS_TEXT_WIDTH, 2, INS_FONT_SMALL, INS_FONT_COLOR_RED, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); } else { @@ -615,9 +614,9 @@ BOOLEAN DisplayOrderGrid( UINT8 ubGridNumber, UINT8 ubMercID ) fDisplayMercContractStateTextColorInRed = TRUE; } if( fDisplayMercContractStateTextColorInRed ) - DisplayWrappedString( (UINT16)(usPosX+INS_CTRCT_OG_HAS_CONTRACT_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_OG_HAS_CONTRACT_OFFSET_Y, INS_CTRCT_CONTRACT_STATUS_TEXT_WIDTH, 2, INS_FONT_SMALL, INS_FONT_COLOR_RED, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DisplayWrappedString( (UINT16)(usPosX+INS_CTRCT_OG_HAS_CONTRACT_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_OG_HAS_CONTRACT_OFFSET_Y, INS_CTRCT_CONTRACT_STATUS_TEXT_WIDTH, 2, INS_FONT_SMALL, INS_FONT_COLOR_RED, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); else - DisplayWrappedString( (UINT16)(usPosX+INS_CTRCT_OG_HAS_CONTRACT_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_OG_HAS_CONTRACT_OFFSET_Y, INS_CTRCT_CONTRACT_STATUS_TEXT_WIDTH, 2, INS_FONT_SMALL, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DisplayWrappedString( (UINT16)(usPosX+INS_CTRCT_OG_HAS_CONTRACT_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_OG_HAS_CONTRACT_OFFSET_Y, INS_CTRCT_CONTRACT_STATUS_TEXT_WIDTH, 2, INS_FONT_SMALL, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); } @@ -631,7 +630,7 @@ BOOLEAN DisplayOrderGrid( UINT8 ubGridNumber, UINT8 ubMercID ) DrawTextToScreen( sText, (UINT16)(usPosX+INS_CTRCT_LENGTH_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_LENGTH_OFFSET_Y, 0, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); //Display the mercs contract length - swprintf( sText, L"%d", pSoldier->iTotalContractLength ); + swprintf( sText, L"%d", pSoldier->iTotalContractLength ); DrawTextToScreen( sText, (UINT16)(usPosX+INS_CTRCT_OG_BOX_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_LENGTH_OFFSET_Y, INS_CTRCT_OG_BOX_WIDTH, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); @@ -642,9 +641,9 @@ BOOLEAN DisplayOrderGrid( UINT8 ubGridNumber, UINT8 ubMercID ) //display the amount of time the merc has left on their Regular contract if( IsMercDead( ubMercID ) ) - swprintf( sText, L"%s", pMessageStrings[ MSG_LOWERCASE_NA ] ); + swprintf( sText, L"%s", pMessageStrings[ MSG_LOWERCASE_NA ] ); else - swprintf( sText, L"%d", GetTimeRemainingOnSoldiersContract( pSoldier ) ); + swprintf( sText, L"%d", GetTimeRemainingOnSoldiersContract( pSoldier ) ); DrawTextToScreen( sText, (UINT16)(usPosX+INS_CTRCT_OG_BOX_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_DAYS_REMAINING_OFFSET_Y, INS_CTRCT_OG_BOX_WIDTH, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); @@ -668,13 +667,13 @@ BOOLEAN DisplayOrderGrid( UINT8 ubGridNumber, UINT8 ubMercID ) //if the soldier has insurance, disply the length of time the merc has left if( IsMercDead( ubMercID ) ) - swprintf( sText, L"%s", pMessageStrings[ MSG_LOWERCASE_NA ] ); + swprintf( sText, L"%s", pMessageStrings[ MSG_LOWERCASE_NA ] ); else if( pSoldier->usLifeInsurance != 0 ) - swprintf( sText, L"%d", GetTimeRemainingOnSoldiersInsuranceContract( pSoldier ) ); + swprintf( sText, L"%d", GetTimeRemainingOnSoldiersInsuranceContract( pSoldier ) ); else - swprintf( sText, L"%d", 0 ); + swprintf( sText, L"%d", 0 ); DrawTextToScreen( sText, (UINT16)(usPosX+INS_CTRCT_OG_BOX_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_DAYS_REMAINING_OFFSET_Y+54, INS_CTRCT_OG_BOX_WIDTH, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); @@ -706,7 +705,7 @@ BOOLEAN DisplayOrderGrid( UINT8 ubGridNumber, UINT8 ubMercID ) DrawTextToScreen( sText, (UINT16)(usPosX+INS_CTRCT_EMPLYMNT_CNTRCT_TEXT_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_PREMIUM_OWING_OFFSET_Y, INS_CTRCT_ORDER_GRID_WIDTH, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); //display the amount of refund - swprintf( sText, L"%d", iCostOfContract ); + swprintf( sText, L"%d", iCostOfContract ); InsertCommasForDollarFigure( sText ); InsertDollarSignInToString( sText ); } @@ -714,7 +713,7 @@ BOOLEAN DisplayOrderGrid( UINT8 ubGridNumber, UINT8 ubMercID ) if( IsMercDead( ubMercID ) ) { - swprintf( sText, L"0"); + swprintf( sText, L"0"); InsertDollarSignInToString( sText ); } //display the amount owing @@ -776,7 +775,7 @@ void BtnInsuranceAcceptClearForm1ButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} @@ -820,7 +819,7 @@ void BtnInsuranceAcceptClearForm2ButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} @@ -865,7 +864,7 @@ void BtnInsuranceAcceptClearForm3ButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} @@ -919,7 +918,7 @@ INT32 CalculateInsuranceCost( SOLDIERTYPE *pSoldier, BOOLEAN fHaveInsurance ) */ void SelectInsuranceContractRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -934,7 +933,7 @@ void SelectInsuranceContractRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } INT8 CountInsurableMercs() @@ -948,8 +947,8 @@ INT8 CountInsurableMercs() cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) - { + for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) + { if (MercIsInsurable(pSoldier)) { bCount++; @@ -990,47 +989,47 @@ void CreateDestroyInsuranceContractFormButtons( BOOLEAN fCreate) //The accept button image guiInsuranceAcceptClearForm1ButtonImage = LoadButtonImage("LAPTOP\\AcceptClearBox.sti", -1,0,-1,1,-1 ); - if( gubNumberofDisplayedInsuranceGrids >= 1 ) + if( gubNumberofDisplayedInsuranceGrids >= 1 ) { //the accept button for form 1 - guiInsuranceAcceptClearForm1Button = CreateIconAndTextButton( guiInsuranceAcceptClearForm1ButtonImage, InsContractText[INS_CONTRACT_ACCEPT], INS_FONT_MED, - INS_FONT_BTN_COLOR, INS_FONT_BTN_SHADOW_COLOR, - INS_FONT_BTN_COLOR, INS_FONT_BTN_SHADOW_COLOR, - TEXT_CJUSTIFIED, - INS_CTRCT_ORDER_GRID1_X+INS_CTRCT_ACCEPT_BTN_X, INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_ACCEPT_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnInsuranceAcceptClearForm1ButtonCallback); + guiInsuranceAcceptClearForm1Button = CreateIconAndTextButton( guiInsuranceAcceptClearForm1ButtonImage, InsContractText[INS_CONTRACT_ACCEPT], INS_FONT_MED, + INS_FONT_BTN_COLOR, INS_FONT_BTN_SHADOW_COLOR, + INS_FONT_BTN_COLOR, INS_FONT_BTN_SHADOW_COLOR, + TEXT_CJUSTIFIED, + INS_CTRCT_ORDER_GRID1_X+INS_CTRCT_ACCEPT_BTN_X, INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_ACCEPT_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnInsuranceAcceptClearForm1ButtonCallback); SetButtonCursor( guiInsuranceAcceptClearForm1Button, CURSOR_LAPTOP_SCREEN ); MSYS_SetBtnUserData( guiInsuranceAcceptClearForm1Button, 0, 0); } - if( gubNumberofDisplayedInsuranceGrids >= 2 ) + if( gubNumberofDisplayedInsuranceGrids >= 2 ) { //the accept button for form 2 - guiInsuranceAcceptClearForm2Button = CreateIconAndTextButton( guiInsuranceAcceptClearForm1ButtonImage, InsContractText[INS_CONTRACT_ACCEPT], INS_FONT_MED, - INS_FONT_BTN_COLOR, INS_FONT_BTN_SHADOW_COLOR, - INS_FONT_BTN_COLOR, INS_FONT_BTN_SHADOW_COLOR, - TEXT_CJUSTIFIED, - INS_CTRCT_ORDER_GRID2_X+INS_CTRCT_ACCEPT_BTN_X, INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_ACCEPT_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnInsuranceAcceptClearForm2ButtonCallback); + guiInsuranceAcceptClearForm2Button = CreateIconAndTextButton( guiInsuranceAcceptClearForm1ButtonImage, InsContractText[INS_CONTRACT_ACCEPT], INS_FONT_MED, + INS_FONT_BTN_COLOR, INS_FONT_BTN_SHADOW_COLOR, + INS_FONT_BTN_COLOR, INS_FONT_BTN_SHADOW_COLOR, + TEXT_CJUSTIFIED, + INS_CTRCT_ORDER_GRID2_X+INS_CTRCT_ACCEPT_BTN_X, INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_ACCEPT_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnInsuranceAcceptClearForm2ButtonCallback); SetButtonCursor(guiInsuranceAcceptClearForm2Button, CURSOR_LAPTOP_SCREEN ); MSYS_SetBtnUserData( guiInsuranceAcceptClearForm2Button, 0, 0); - + } - - if( gubNumberofDisplayedInsuranceGrids >= 3 ) + + if( gubNumberofDisplayedInsuranceGrids >= 3 ) { //the accept button for form 3 - guiInsuranceAcceptClearForm3Button = CreateIconAndTextButton( guiInsuranceAcceptClearForm1ButtonImage, InsContractText[INS_CONTRACT_ACCEPT], INS_FONT_MED, - INS_FONT_BTN_COLOR, INS_FONT_BTN_SHADOW_COLOR, - INS_FONT_BTN_COLOR, INS_FONT_BTN_SHADOW_COLOR, - TEXT_CJUSTIFIED, - INS_CTRCT_ORDER_GRID3_X+INS_CTRCT_ACCEPT_BTN_X, INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_ACCEPT_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnInsuranceAcceptClearForm3ButtonCallback); + guiInsuranceAcceptClearForm3Button = CreateIconAndTextButton( guiInsuranceAcceptClearForm1ButtonImage, InsContractText[INS_CONTRACT_ACCEPT], INS_FONT_MED, + INS_FONT_BTN_COLOR, INS_FONT_BTN_SHADOW_COLOR, + INS_FONT_BTN_COLOR, INS_FONT_BTN_SHADOW_COLOR, + TEXT_CJUSTIFIED, + INS_CTRCT_ORDER_GRID3_X+INS_CTRCT_ACCEPT_BTN_X, INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_ACCEPT_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnInsuranceAcceptClearForm3ButtonCallback); SetButtonCursor( guiInsuranceAcceptClearForm3Button, CURSOR_LAPTOP_SCREEN ); MSYS_SetBtnUserData( guiInsuranceAcceptClearForm3Button, 0, 0); } @@ -1040,24 +1039,24 @@ void CreateDestroyInsuranceContractFormButtons( BOOLEAN fCreate) if( fButtonsCreated && ! fCreate ) { - //the accept image + //the accept image UnloadButtonImage( guiInsuranceAcceptClearForm1ButtonImage ); if( gubNumberofDisplayedInsuranceGrids >= 1 ) { - //the accept for the first form + //the accept for the first form RemoveButton( guiInsuranceAcceptClearForm1Button ); } if( gubNumberofDisplayedInsuranceGrids >= 2 ) { - //the accept clear for the second form + //the accept clear for the second form RemoveButton( guiInsuranceAcceptClearForm2Button ); } if( gubNumberofDisplayedInsuranceGrids >= 3 ) { - //the accept clear for the third form + //the accept clear for the third form RemoveButton( guiInsuranceAcceptClearForm3Button ); } @@ -1069,8 +1068,6 @@ void CreateDestroyInsuranceContractFormButtons( BOOLEAN fCreate) void HandleAcceptButton( UINT8 ubSoldierID, UINT8 ubFormID ) { - INT32 iAmountOfMoneyTransfer = -1; - //passed in either 1,2,3 should be 0,1,2 ubFormID--; @@ -1097,8 +1094,8 @@ void DailyUpdateOfInsuredMercs() cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) - { + for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) + { //if the soldier is in the team array if( pSoldier->bActive ) { @@ -1126,7 +1123,7 @@ void DailyUpdateOfInsuredMercs() } -#define MIN_INSURANCE_RATIO 0.1f +#define MIN_INSURANCE_RATIO 0.1f #define MAX_INSURANCE_RATIO 10.0f @@ -1140,12 +1137,12 @@ INT32 CalculateInsuranceContractCost( INT32 iLength, UINT8 ubMercID ) UINT32 uiTotalInsurancePremium; SOLDIERTYPE *pSoldier; - + pSoldier = &Menptr[ GetSoldierIDFromMercID( ubMercID ) ]; // only mercs with at least 2 days to go on their employment contract are insurable - // def: 2/5/99. However if they already have insurance is SHOULD be ok + // def: 2/5/99. However if they already have insurance is SHOULD be ok if( GetTimeRemainingOnSoldiersContract( pSoldier ) < 2 && !( pSoldier->usLifeInsurance != 0 && GetTimeRemainingOnSoldiersContract( pSoldier ) >= 1 ) ) { return( 0 ); @@ -1158,7 +1155,7 @@ INT32 CalculateInsuranceContractCost( INT32 iLength, UINT8 ubMercID ) } /* - replaced with the above check + replaced with the above check if (iLength < 2) { @@ -1237,7 +1234,7 @@ FLOAT DiffFromNormRatio( INT16 sThisValue, INT16 sNormalValue ) void InsContractNoMercsPopupCallBack( UINT8 bExitValue ) { // yes, so start over, else stay here and do nothing for now - if( bExitValue == MSG_BOX_RETURN_OK ) + if( bExitValue == MSG_BOX_RETURN_OK ) { guiCurrentLaptopMode = LAPTOP_MODE_INSURANCE; } @@ -1256,8 +1253,8 @@ void BuildInsuranceArray() gsMaxPlayersOnTeam = 0; // store profile #s of all insurable mercs in an array - for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) - { + for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) + { if( MercIsInsurable(pSoldier) ) { gubInsuranceMercArray[ gsMaxPlayersOnTeam ] = pSoldier->ubProfile; @@ -1285,7 +1282,7 @@ BOOLEAN AddLifeInsurancePayout( SOLDIERTYPE *pSoldier ) if( LaptopSaveInfo.ubNumberLifeInsurancePayouts <= LaptopSaveInfo.ubNumberLifeInsurancePayoutUsed ) { LaptopSaveInfo.ubNumberLifeInsurancePayouts++; - LaptopSaveInfo.pLifeInsurancePayouts = (LIFE_INSURANCE_PAYOUT *) MemRealloc( LaptopSaveInfo.pLifeInsurancePayouts, sizeof( LIFE_INSURANCE_PAYOUT ) * LaptopSaveInfo.ubNumberLifeInsurancePayouts ); + LaptopSaveInfo.pLifeInsurancePayouts = (LIFE_INSURANCE_PAYOUT *) MemRealloc( LaptopSaveInfo.pLifeInsurancePayouts, sizeof( LIFE_INSURANCE_PAYOUT ) * LaptopSaveInfo.ubNumberLifeInsurancePayouts ); if( LaptopSaveInfo.pLifeInsurancePayouts == NULL ) return( FALSE ); @@ -1304,10 +1301,10 @@ BOOLEAN AddLifeInsurancePayout( SOLDIERTYPE *pSoldier ) LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].fActive = TRUE; // This uses the merc's latest salaries, ignoring that they may be higher than the salaries paid under the current - // contract if the guy has recently gained a level. We could store his daily salary when he was last contracted, + // contract if the guy has recently gained a level. We could store his daily salary when he was last contracted, // and use that, but it still doesn't easily account for the fact that renewing a leveled merc early means that the - // first part of his contract is under his old salary and the second part is under his new one. Therefore, I chose - // to ignore this wrinkle, and let the player awlays get paid out using the higher amount. ARM + // first part of his contract is under his old salary and the second part is under his new one. Therefore, I chose + // to ignore this wrinkle, and let the player awlays get paid out using the higher amount. ARM // figure out which of the 3 salary rates the merc has is the cheapest, and use it to calculate the paid amount, to // avoid getting back more than the merc cost if he was on a 2-week contract! @@ -1485,7 +1482,7 @@ void EnableDisableInsuranceContractAcceptButtons() { EnableDisableIndividualInsuranceContractButton( gubMercIDForMercInForm2, &guiInsuranceAcceptClearForm2Button ); } - + //If it is the 3rd grid if( gubNumberofDisplayedInsuranceGrids >= 3 ) { @@ -1505,7 +1502,7 @@ void EnableDisableIndividualInsuranceContractButton( UINT8 ubMercIDForMercInForm // if the soldiers contract can be extended, enable the button if( CanSoldierExtendInsuranceContract( &Menptr[ sSoldierID ] ) ) EnableButton( *puiAcceptButton ); - + // else the soldier cant extend their insurance contract, disable the button else DisableButton( *puiAcceptButton ); @@ -1587,7 +1584,7 @@ void PurchaseOrExtendInsuranceForSoldier( SOLDIERTYPE *pSoldier, UINT32 uiInsura if( pSoldier == NULL ) AssertMsg( 0, "Soldier pointer is NULL!" ); - //if the user doesnt have insruance already, + //if the user doesnt have insruance already, if( !(pSoldier->usLifeInsurance ) ) { //specify the start date of the contract @@ -1598,7 +1595,7 @@ void PurchaseOrExtendInsuranceForSoldier( SOLDIERTYPE *pSoldier, UINT32 uiInsura //transfer money iAmountOfMoneyTransfer = CalculateInsuranceContractCost( uiInsuranceLength, pSoldier->ubProfile ); - //if the user did have insruance already, + //if the user did have insruance already, if( pSoldier->usLifeInsurance ) { //specify the start date of the contract @@ -1630,7 +1627,7 @@ void PurchaseOrExtendInsuranceForSoldier( SOLDIERTYPE *pSoldier, UINT32 uiInsura } else { - //else if the player has enought to cover the bill, let him + //else if the player has enought to cover the bill, let him //the player just purchased life insurance AddTransactionToPlayersBook( PURCHASED_INSURANCE, pSoldier->ubProfile, GetWorldTotalMin(), -( iAmountOfMoneyTransfer ) ); @@ -1673,7 +1670,7 @@ INT32 CalculateSoldiersInsuranceContractLength( SOLDIERTYPE *pSoldier ) // only mercs with at least 2 days to go on their employment contract are insurable - // def: 2/5/99. However if they already have insurance is SHOULD be ok + // def: 2/5/99. However if they already have insurance is SHOULD be ok if( uiTimeRemainingOnSoldiersContract < 2 && !( pSoldier->usLifeInsurance != 0 && uiTimeRemainingOnSoldiersContract >= 1 ) ) { return( 0 ); @@ -1743,4 +1740,4 @@ BOOLEAN AreAnyAimMercsOnTeam( ) } return( fIsThereAnyAimMercs ); -} \ No newline at end of file +} diff --git a/Laptop/insurance Info.cpp b/Laptop/insurance Info.cpp index 5a3d00a0..68691031 100644 --- a/Laptop/insurance Info.cpp +++ b/Laptop/insurance Info.cpp @@ -73,10 +73,10 @@ UINT32 guiInsNextBackButton; //link to the varios pages -MOUSE_REGION gSelectedInsuranceInfoLinkRegion; +MOUSE_REGION gSelectedInsuranceInfoLinkRegion; void SelectInsuranceLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); -MOUSE_REGION gSelectedInsuranceInfoHomeLinkRegion; +MOUSE_REGION gSelectedInsuranceInfoHomeLinkRegion; void SelectInsuranceInfoHomeLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); @@ -103,7 +103,7 @@ void EnterInitInsuranceInfo() BOOLEAN EnterInsuranceInfo() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; UINT16 usPosX; InitInsuranceDefaults(); @@ -116,24 +116,24 @@ BOOLEAN EnterInsuranceInfo() //left arrow guiInsPrevButtonImage = LoadButtonImage("LAPTOP\\InsLeftButton.sti", 2,0,-1,1,-1 ); - guiInsPrevBackButton = CreateIconAndTextButton( guiInsPrevButtonImage, InsInfoText[INS_INFO_PREVIOUS], INS_FONT_BIG, - INS_FONT_COLOR, INS_FONT_SHADOW, - INS_FONT_COLOR, INS_FONT_SHADOW, - TEXT_CJUSTIFIED, - INS_INFO_LEFT_ARROW_BUTTON_X, INS_INFO_LEFT_ARROW_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnInsPrevButtonCallback); + guiInsPrevBackButton = CreateIconAndTextButton( guiInsPrevButtonImage, InsInfoText[INS_INFO_PREVIOUS], INS_FONT_BIG, + INS_FONT_COLOR, INS_FONT_SHADOW, + INS_FONT_COLOR, INS_FONT_SHADOW, + TEXT_CJUSTIFIED, + INS_INFO_LEFT_ARROW_BUTTON_X, INS_INFO_LEFT_ARROW_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnInsPrevButtonCallback); SetButtonCursor( guiInsPrevBackButton, CURSOR_WWW ); SpecifyButtonTextOffsets( guiInsPrevBackButton, 17, 16, FALSE ); //Right arrow guiInsNextButtonImage = LoadButtonImage("LAPTOP\\InsRightButton.sti", 2,0,-1,1,-1 ); - guiInsNextBackButton = CreateIconAndTextButton( guiInsNextButtonImage, InsInfoText[INS_INFO_NEXT], INS_FONT_BIG, - INS_FONT_COLOR, INS_FONT_SHADOW, - INS_FONT_COLOR, INS_FONT_SHADOW, - TEXT_CJUSTIFIED, - INS_INFO_RIGHT_ARROW_BUTTON_X, INS_INFO_RIGHT_ARROW_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnInsNextButtonCallback); + guiInsNextBackButton = CreateIconAndTextButton( guiInsNextButtonImage, InsInfoText[INS_INFO_NEXT], INS_FONT_BIG, + INS_FONT_COLOR, INS_FONT_SHADOW, + INS_FONT_COLOR, INS_FONT_SHADOW, + TEXT_CJUSTIFIED, + INS_INFO_RIGHT_ARROW_BUTTON_X, INS_INFO_RIGHT_ARROW_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnInsNextButtonCallback); SetButtonCursor( guiInsNextBackButton, CURSOR_WWW ); SpecifyButtonTextOffsets( guiInsNextBackButton, 18, 16, FALSE ); @@ -142,13 +142,13 @@ BOOLEAN EnterInsuranceInfo() //link to go to the contract page //link to go to the home page MSYS_DefineRegion( &gSelectedInsuranceInfoHomeLinkRegion, usPosX, INS_INFO_LINK_TO_CONTRACT_Y-37, (UINT16)(usPosX + INS_INFO_LINK_TO_CONTRACT_WIDTH), INS_INFO_LINK_TO_CONTRACT_Y+2, MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectInsuranceInfoHomeLinkRegionCallBack); - MSYS_AddRegion(&gSelectedInsuranceInfoHomeLinkRegion); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectInsuranceInfoHomeLinkRegionCallBack); + MSYS_AddRegion(&gSelectedInsuranceInfoHomeLinkRegion); usPosX += INS_INFO_LINK_START_OFFSET + INS_INFO_LINK_TO_CONTRACT_WIDTH; MSYS_DefineRegion( &gSelectedInsuranceInfoLinkRegion, usPosX, INS_INFO_LINK_TO_CONTRACT_Y-37, (UINT16)(usPosX + INS_INFO_LINK_TO_CONTRACT_WIDTH), INS_INFO_LINK_TO_CONTRACT_Y+2, MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectInsuranceLinkRegionCallBack); - MSYS_AddRegion(&gSelectedInsuranceInfoLinkRegion); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectInsuranceLinkRegionCallBack); + MSYS_AddRegion(&gSelectedInsuranceInfoLinkRegion); gubCurrentInsInfoSubPage = INS_INFO_INFO_TOC; @@ -183,7 +183,6 @@ void HandleInsuranceInfo() void RenderInsuranceInfo() { CHAR16 sText[800]; - UINT16 usNewLineOffset = 0; UINT16 usPosX; DisableArrowButtonsIfOnLastOrFirstPage(); @@ -221,23 +220,23 @@ void RenderInsuranceInfo() usPosX = INS_INFO_LINK_START_X; - //Display the red bar under the link at the bottom. and the text + //Display the red bar under the link at the bottom. and the text DisplaySmallRedLineWithShadow( usPosX, INS_INFO_LINK_TO_CONTRACT_Y, (UINT16)(usPosX+INS_INFO_LINK_TO_CONTRACT_WIDTH), INS_INFO_LINK_TO_CONTRACT_Y); - swprintf( sText, L"%s", pMessageStrings[ MSG_HOMEPAGE ] ); - DisplayWrappedString( usPosX, INS_INFO_LINK_TO_CONTRACT_TEXT_Y+14, INS_INFO_LINK_TO_CONTRACT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + swprintf( sText, L"%s", pMessageStrings[ MSG_HOMEPAGE ] ); + DisplayWrappedString( usPosX, INS_INFO_LINK_TO_CONTRACT_TEXT_Y+14, INS_INFO_LINK_TO_CONTRACT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); usPosX += INS_INFO_LINK_START_OFFSET + INS_INFO_LINK_TO_CONTRACT_WIDTH; - //Display the red bar under the link at the bottom. and the text + //Display the red bar under the link at the bottom. and the text DisplaySmallRedLineWithShadow( usPosX, INS_INFO_LINK_TO_CONTRACT_Y, (UINT16)(usPosX+INS_INFO_LINK_TO_CONTRACT_WIDTH), INS_INFO_LINK_TO_CONTRACT_Y); GetInsuranceText( INS_SNGL_TO_ENTER_REVIEW, sText ); - DisplayWrappedString( usPosX, INS_INFO_LINK_TO_CONTRACT_TEXT_Y, INS_INFO_LINK_TO_CONTRACT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + DisplayWrappedString( usPosX, INS_INFO_LINK_TO_CONTRACT_TEXT_Y, INS_INFO_LINK_TO_CONTRACT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); SetFontShadow(DEFAULT_SHADOW); - MarkButtonsDirty( ); + MarkButtonsDirty( ); RenderWWWProgramTitleBar( ); - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } @@ -259,7 +258,7 @@ void BtnInsPrevButtonCallback(GUI_BUTTON *btn,INT32 reason) gubCurrentInsInfoSubPage --; ChangingInsuranceInfoSubPage( gubCurrentInsInfoSubPage ); -// fPausedReDrawScreenFlag = TRUE; +// fPausedReDrawScreenFlag = TRUE; InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } @@ -269,7 +268,7 @@ void BtnInsPrevButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnInsNextButtonCallback(GUI_BUTTON *btn,INT32 reason) { @@ -289,7 +288,7 @@ void BtnInsNextButtonCallback(GUI_BUTTON *btn,INT32 reason) ChangingInsuranceInfoSubPage( gubCurrentInsInfoSubPage ); -// fPausedReDrawScreenFlag = TRUE; +// fPausedReDrawScreenFlag = TRUE; InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } @@ -299,10 +298,10 @@ void BtnInsNextButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void SelectInsuranceLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -312,11 +311,11 @@ void SelectInsuranceLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } void SelectInsuranceInfoHomeLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -326,7 +325,7 @@ void SelectInsuranceInfoHomeLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iRe } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } @@ -344,27 +343,27 @@ void DisplaySubmitClaimPage() //Display the title slogan GetInsuranceText( INS_MLTI_U_CAN_REST_ASSURED, sText ); - usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; GetInsuranceText( INS_MLTI_HAD_U_HIRED_AN_INDIVIDUAL, sText ); - usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; - //display the BIG FRAUD + //display the BIG FRAUD GetInsuranceText( INS_SNGL_FRAUD, sText ); - DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, (UINT16)(usNewLineOffset-1), INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_BIG, INS_INFO_FRAUD_TEXT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, (UINT16)(usNewLineOffset-1), INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_BIG, INS_INFO_FRAUD_TEXT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usPosX = INS_INFO_FIRST_PARAGRAPH_X + StringPixLength( sText, INS_FONT_BIG ) + 2; GetInsuranceText( INS_MLTI_WE_RESERVE_THE_RIGHT, sText ); - usNewLineOffset += DisplayWrappedString( usPosX, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += DisplayWrappedString( usPosX, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); GetInsuranceText( INS_MLTI_SHOULD_THERE_BE_GROUNDS, sText ); - usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; GetInsuranceText( INS_MLTI_SHOULD_SUCH_A_SITUATION, sText ); - usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; } @@ -373,7 +372,7 @@ void DisplayPremiumPage() { CHAR16 sText[800]; UINT16 usNewLineOffset = 0; - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; usNewLineOffset = INS_INFO_FIRST_PARAGRAPH_Y; @@ -383,7 +382,7 @@ void DisplayPremiumPage() DrawTextToScreen( sText, INS_INFO_SUBTITLE_X, INS_INFO_SUBTITLE_Y, 0, INS_FONT_BIG, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); GetInsuranceText( INS_MLTI_EACH_TIME_U_COME_TO_US, sText ); - usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; //Get and display the insurance bullet @@ -391,7 +390,7 @@ void DisplayPremiumPage() BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, VO_BLT_SRCTRANSPARENCY,NULL); GetInsuranceText( INS_MLTI_LENGTH_OF_EMPLOYMENT_CONTRACT, sText ); - usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X+INSURANCE_BULLET_TEXT_OFFSET_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X+INSURANCE_BULLET_TEXT_OFFSET_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; @@ -400,7 +399,7 @@ void DisplayPremiumPage() BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, VO_BLT_SRCTRANSPARENCY,NULL); GetInsuranceText( INS_MLTI_EMPLOYEES_AGE_AND_HEALTH, sText ); - usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X+INSURANCE_BULLET_TEXT_OFFSET_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X+INSURANCE_BULLET_TEXT_OFFSET_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; @@ -409,7 +408,7 @@ void DisplayPremiumPage() BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, VO_BLT_SRCTRANSPARENCY,NULL); GetInsuranceText( INS_MLTI_EMPLOOYEES_TRAINING_AND_EXP, sText ); - usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X+INSURANCE_BULLET_TEXT_OFFSET_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X+INSURANCE_BULLET_TEXT_OFFSET_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; } @@ -419,7 +418,7 @@ void DisplayRenewingPremiumPage() { CHAR16 sText[800]; UINT16 usNewLineOffset = 0; -// HVOBJECT hPixHandle; +// HVOBJECT hPixHandle; usNewLineOffset = INS_INFO_FIRST_PARAGRAPH_Y; @@ -428,16 +427,16 @@ void DisplayRenewingPremiumPage() DrawTextToScreen( sText, INS_INFO_SUBTITLE_X, INS_INFO_SUBTITLE_Y, 0, INS_FONT_BIG, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); GetInsuranceText( INS_MLTI_WHEN_IT_COMES_TIME_TO_RENEW, sText ); - usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; GetInsuranceText( INS_MLTI_SHOULD_THE_PROJECT_BE_GOING_WELL, sText ); - usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; //display the LOWER PREMIUM FOR RENWING EARLY GetInsuranceText( INS_SNGL_LOWER_PREMIUMS_4_RENEWING, sText ); - DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, (UINT16)(usNewLineOffset-1), INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_BIG, INS_INFO_FRAUD_TEXT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, (UINT16)(usNewLineOffset-1), INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_BIG, INS_INFO_FRAUD_TEXT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS + 2; /* @@ -446,7 +445,7 @@ void DisplayRenewingPremiumPage() BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, VO_BLT_SRCTRANSPARENCY,NULL); GetInsuranceText( INS_MLTI_IF_U_EXTEND_THE_CONTRACT, sText ); - usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X+INSURANCE_BULLET_TEXT_OFFSET_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X+INSURANCE_BULLET_TEXT_OFFSET_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; */ } @@ -466,26 +465,26 @@ void DisplayCancelationPagePage() DrawTextToScreen( sText, INS_INFO_SUBTITLE_X, INS_INFO_SUBTITLE_Y, 0, INS_FONT_BIG, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); GetInsuranceText( INS_MLTI_WE_WILL_ACCEPT_INS_CANCELATION, sText ); - usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; GetInsuranceText( INS_MLTI_1_HOUR_EXCLUSION_A, sText ); - usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; GetInsuranceText( INS_MLTI_1_HOUR_EXCLUSION_B, sText ); - usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; } void DisableArrowButtonsIfOnLastOrFirstPage() { - if( gubCurrentInsInfoSubPage == INS_INFO_INFO_TOC) + if( gubCurrentInsInfoSubPage == INS_INFO_INFO_TOC) DisableButton( guiInsPrevBackButton); else EnableButton( guiInsPrevBackButton ); - if( gubCurrentInsInfoSubPage == INS_INFO_LAST_PAGE - 1 ) + if( gubCurrentInsInfoSubPage == INS_INFO_LAST_PAGE - 1 ) DisableButton( guiInsNextBackButton); else EnableButton( guiInsNextBackButton ); @@ -515,7 +514,7 @@ void DisplayInfoTocPage() { CHAR16 sText[800]; UINT16 usNewLineOffset = 0; - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; UINT16 usPosY; usNewLineOffset = INS_INFO_FIRST_PARAGRAPH_Y; @@ -526,16 +525,16 @@ void DisplayInfoTocPage() //Display the First paragraph GetInsuranceText( INS_MLTI_HIRING_4_SHORT_TERM_HIGH_RISK_1, sText ); - usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; //Display the 2nd paragraph GetInsuranceText( INS_MLTI_HIRING_4_SHORT_TERM_HIGH_RISK_2, sText ); - usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; - - //Display the sub title + + //Display the sub title GetInsuranceText( INS_SNGL_WE_CAN_OFFER_U, sText ); DrawTextToScreen( sText, INS_INFO_TOC_SUBTITLE_X, usNewLineOffset, 640-INS_INFO_INFO_TOC_TITLE_X, INS_FONT_BIG, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); usPosY = usNewLineOffset + 12; @@ -554,7 +553,7 @@ void DisplayInfoTocPage() BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, VO_BLT_SRCTRANSPARENCY,NULL); GetInsuranceText( INS_MLTI_REASONABLE_AND_FLEXIBLE, sText ); - usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X+INSURANCE_BULLET_TEXT_OFFSET_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X+INSURANCE_BULLET_TEXT_OFFSET_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; @@ -568,7 +567,8 @@ void DisplayInfoTocPage() BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, VO_BLT_SRCTRANSPARENCY,NULL); GetInsuranceText( INS_MLTI_QUICKLY_AND_EFFICIENT, sText ); - usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X+INSURANCE_BULLET_TEXT_OFFSET_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X+INSURANCE_BULLET_TEXT_OFFSET_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; } + diff --git a/Laptop/insurance.cpp b/Laptop/insurance.cpp index cc22f122..9d0f9e94 100644 --- a/Laptop/insurance.cpp +++ b/Laptop/insurance.cpp @@ -76,11 +76,11 @@ UINT32 guiInsuranceBulletImage; //link to the varios pages -MOUSE_REGION gSelectedInsuranceLinkRegion[3]; +MOUSE_REGION gSelectedInsuranceLinkRegion[3]; void SelectInsuranceRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //link to the home page by clicking on the small title -MOUSE_REGION gSelectedInsuranceTitleLinkRegion; +MOUSE_REGION gSelectedInsuranceTitleLinkRegion; void SelectInsuranceTitleLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); @@ -91,7 +91,7 @@ void GameInitInsurance() BOOLEAN EnterInsurance() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; UINT16 usPosX, i; SetBookMark( INSURANCE_BOOKMARK ); @@ -112,9 +112,9 @@ BOOLEAN EnterInsurance() for(i=0; i<3; i++) { MSYS_DefineRegion( &gSelectedInsuranceLinkRegion[i], usPosX, INSURANCE_BOTTOM_LINK_RED_BAR_Y-37, (UINT16)(usPosX + INSURANCE_BOTTOM_LINK_RED_BAR_WIDTH), INSURANCE_BOTTOM_LINK_RED_BAR_Y+2, MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectInsuranceRegionCallBack); - MSYS_AddRegion(&gSelectedInsuranceLinkRegion[i]); - MSYS_SetRegionUserData( &gSelectedInsuranceLinkRegion[i], 0, i ); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectInsuranceRegionCallBack); + MSYS_AddRegion(&gSelectedInsuranceLinkRegion[i]); + MSYS_SetRegionUserData( &gSelectedInsuranceLinkRegion[i], 0, i ); usPosX += INSURANCE_BOTTOM_LINK_RED_BAR_OFFSET; } @@ -149,7 +149,7 @@ void HandleInsurance() void RenderInsurance() { CHAR16 sText[800]; - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; DisplayInsuranceDefaults(); @@ -189,39 +189,39 @@ void RenderInsurance() DrawTextToScreen( sText, INSURANCE_BOTTOM_SLOGAN_X, INSURANCE_BOTTOM_SLOGAN_Y, INSURANCE_BOTTOM_SLOGAN_WIDTH, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); - //Display the red bar under the link at the bottom. and the text + //Display the red bar under the link at the bottom. and the text DisplaySmallRedLineWithShadow( INSURANCE_BOTTOM_LINK_RED_BAR_X, INSURANCE_BOTTOM_LINK_RED_BAR_Y, INSURANCE_BOTTOM_LINK_RED_BAR_X+INSURANCE_BOTTOM_LINK_RED_BAR_WIDTH, INSURANCE_BOTTOM_LINK_RED_BAR_Y); GetInsuranceText( INS_SNGL_COMMENTSFROM_CLIENTS, sText ); - DisplayWrappedString( INSURANCE_LINK_TEXT_1_X, INSURANCE_LINK_TEXT_1_Y, INSURANCE_LINK_TEXT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); - + DisplayWrappedString( INSURANCE_LINK_TEXT_1_X, INSURANCE_LINK_TEXT_1_Y, INSURANCE_LINK_TEXT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + //Display the red bar under the link at the bottom DisplaySmallRedLineWithShadow( INSURANCE_BOTTOM_LINK_RED_BAR_X_2, INSURANCE_BOTTOM_LINK_RED_BAR_Y, INSURANCE_BOTTOM_LINK_RED_BAR_X_2+INSURANCE_BOTTOM_LINK_RED_BAR_WIDTH, INSURANCE_BOTTOM_LINK_RED_BAR_Y); GetInsuranceText( INS_SNGL_HOW_DOES_INS_WORK, sText ); - DisplayWrappedString( INSURANCE_LINK_TEXT_2_X, INSURANCE_LINK_TEXT_2_Y+7, INSURANCE_LINK_TEXT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + DisplayWrappedString( INSURANCE_LINK_TEXT_2_X, INSURANCE_LINK_TEXT_2_Y+7, INSURANCE_LINK_TEXT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); //Display the red bar under the link at the bottom DisplaySmallRedLineWithShadow( INSURANCE_BOTTOM_LINK_RED_BAR_X_3, INSURANCE_BOTTOM_LINK_RED_BAR_Y, INSURANCE_BOTTOM_LINK_RED_BAR_X_3+INSURANCE_BOTTOM_LINK_RED_BAR_WIDTH, INSURANCE_BOTTOM_LINK_RED_BAR_Y); GetInsuranceText( INS_SNGL_TO_ENTER_REVIEW, sText ); - DisplayWrappedString( INSURANCE_LINK_TEXT_3_X, INSURANCE_LINK_TEXT_3_Y+7, INSURANCE_LINK_TEXT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + DisplayWrappedString( INSURANCE_LINK_TEXT_3_X, INSURANCE_LINK_TEXT_3_Y+7, INSURANCE_LINK_TEXT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); SetFontShadow(DEFAULT_SHADOW); - MarkButtonsDirty( ); + MarkButtonsDirty( ); RenderWWWProgramTitleBar( ); - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } BOOLEAN InitInsuranceDefaults() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; // load the Flower Account Box graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; @@ -248,8 +248,8 @@ BOOLEAN InitInsuranceDefaults() //create the link to the home page on the small titles MSYS_DefineRegion( &gSelectedInsuranceTitleLinkRegion, INSURANCE_SMALL_TITLE_X+85, INSURANCE_SMALL_TITLE_Y, (UINT16)(INSURANCE_SMALL_TITLE_X + INSURANCE_SMALL_TITLE_WIDTH), (UINT16)(INSURANCE_SMALL_TITLE_Y+INSURANCE_SMALL_TITLE_HEIGHT), MSYS_PRIORITY_HIGH, - CURSOR_WWW, MSYS_NO_CALLBACK, SelectInsuranceTitleLinkRegionCallBack); - MSYS_AddRegion(&gSelectedInsuranceTitleLinkRegion); + CURSOR_WWW, MSYS_NO_CALLBACK, SelectInsuranceTitleLinkRegionCallBack); + MSYS_AddRegion(&gSelectedInsuranceTitleLinkRegion); } return( TRUE ); @@ -257,7 +257,7 @@ BOOLEAN InitInsuranceDefaults() void DisplayInsuranceDefaults() { - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; UINT8 i; UINT16 usPosY; @@ -320,19 +320,19 @@ void RemoveInsuranceDefaults() void DisplaySmallRedLineWithShadow( UINT16 usStartX, UINT16 usStartY, UINT16 EndX, UINT16 EndY) { - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - // draw the red line + // draw the red line LineDraw(FALSE, usStartX, usStartY, EndX, EndY, Get16BPPColor( FROMRGB( 255, 0, 0 ) ), pDestBuf); - // draw the black shadow line + // draw the black shadow line LineDraw(FALSE, usStartX+1, usStartY+1, EndX+1, EndY+1, Get16BPPColor( FROMRGB( 0, 0, 0 ) ), pDestBuf); - + // unlock frame buffer UnLockVideoSurface( FRAME_BUFFER ); } @@ -357,7 +357,7 @@ void GetInsuranceText( UINT8 ubNumber, STR16 pString ) void SelectInsuranceRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -374,11 +374,11 @@ void SelectInsuranceRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } void SelectInsuranceTitleLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -388,12 +388,13 @@ void SelectInsuranceTitleLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReaso } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { - } + } } - + + diff --git a/Laptop/laptop.cpp b/Laptop/laptop.cpp index 2cd25c96..41d37792 100644 --- a/Laptop/laptop.cpp +++ b/Laptop/laptop.cpp @@ -17,11 +17,11 @@ #include "AimMembers.h" #include "AimFacialIndex.h" #include "AimSort.h" - #include "AimArchives.h" + #include "AimArchives.h" #include "AimHistory.h" #include "AimLinks.h" #include "AimPolicies.h" - #include "mercs.h" + #include "mercs.h" #include "mercs Files.h" #include "mercs Account.h" #include "mercs No Account.h" @@ -54,7 +54,6 @@ #include "Game init.h" #include "Game Clock.h" #include "vobject_blitters.h" - #include "Soldier Control.h" #include "Soldier Profile.h" #include "Overhead.h" #include "environment.h" @@ -86,12 +85,15 @@ #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; // icons text id's enum{ MAIL=0, - WWW, + WWW, FINANCIAL, PERSONNEL, HISTORY, @@ -109,7 +111,7 @@ enum{ FINANCIAL_REGION, PERSONNEL_REGION, HISTORY_REGION, - FILES_REGION, + FILES_REGION, }; @@ -127,7 +129,7 @@ typedef struct rgbcolor RGBCOLOR; RGBCOLOR GlowColors[]={ {0,0,0}, - {25,0,0}, + {25,0,0}, {50,0,0}, {75,0,0}, {100,0,0}, @@ -166,20 +168,20 @@ enum{ #define LAPTOP_ICON_TEXT_X iScreenWidthOffset + 24 #define LAPTOP_ICON_TEXT_WIDTH 79 -#define LAPTOP_ICON_TEXT_HEIGHT 6 +#define LAPTOP_ICON_TEXT_HEIGHT 6 #define LAPTOP_ICON_TEXT_MAIL_Y iScreenHeightOffset + 77 #define LAPTOP_ICON_TEXT_WWW_Y iScreenHeightOffset + 142 #define LAPTOP_ICON_TEXT_FINANCIAL_Y iScreenHeightOffset + 214 -#define LAPTOP_ICON_TEXT_PERSONNEL_Y iScreenHeightOffset + 296 +#define LAPTOP_ICON_TEXT_PERSONNEL_Y iScreenHeightOffset + 296 #define LAPTOP_ICON_TEXT_HISTORY_Y iScreenHeightOffset + 356 #define LAPTOP_ICON_TEXT_FILES_Y iScreenHeightOffset + 415 -#define LAPTOPICONFONT FONT10ARIAL +#define LAPTOPICONFONT FONT10ARIAL #define BOOK_FONT FONT10ARIAL #define DOWNLOAD_FONT FONT12ARIAL -#define ERROR_TITLE_FONT FONT14ARIAL -#define ERROR_FONT FONT12ARIAL +#define ERROR_TITLE_FONT FONT14ARIAL +#define ERROR_FONT FONT12ARIAL #define HISTORY_ICON_OFFSET_X 0 @@ -222,7 +224,7 @@ enum{ #define DOWN_STRING_Y DOWNLOAD_Y + 5 #define ERROR_X iScreenWidthOffset + 300 #define ERROR_Y iScreenHeightOffset + 200 -#define ERROR_BTN_X iScreenWidthOffset + 43 +#define ERROR_BTN_X iScreenWidthOffset + 43 #define ERROR_BTN_Y ERROR_Y + 70 #define ERROR_TITLE_X ERROR_X + 3 #define ERROR_TITLE_Y ERROR_Y + 3 @@ -248,8 +250,8 @@ enum{ #define LAPTOP_TITLE_BAR_TOP_RIGHT_Y LAPTOP_TITLE_BAR_TOP_LEFT_Y #define LAPTOP_TITLE_BAR_ICON_OFFSET_X 5 -#define LAPTOP_TITLE_BAR_ICON_OFFSET_Y 2 -#define LAPTOP_TITLE_BAR_TEXT_OFFSET_X 29 +#define LAPTOP_TITLE_BAR_ICON_OFFSET_Y 2 +#define LAPTOP_TITLE_BAR_TEXT_OFFSET_X 29 #define LAPTOP_TITLE_BAR_TEXT_OFFSET_Y 8 #define LAPTOP_PROGRAM_ICON_X LAPTOP_TITLE_BAR_TOP_LEFT_X @@ -293,7 +295,7 @@ BOOLEAN gbMessageDisplayed; UINT32 guiCurrentLaptopMode; UINT32 guiPreviousLaptopMode; UINT32 guiCurrentWWWMode = LAPTOP_MODE_NONE; -INT32 giCurrentSubPage; +INT32 giCurrentSubPage; UINT32 guiCurrentLapTopCursor; UINT32 guiPreviousLapTopCursor; UINT32 guiCurrentSidePanel; // the current navagation panel on the leftside of the laptop screen @@ -363,9 +365,9 @@ BOOLEAN gfTemporaryDisablingOfLoadPendingFlag=FALSE; //GLOBAL FOR WHICH SCREEN TO EXIT TO FOR LAPTOP UINT32 guiExitScreen = MAP_SCREEN; -MOUSE_REGION gLaptopRegion; +MOUSE_REGION gLaptopRegion; // Laptop screen graphic handle -UINT32 guiLAPTOP; +UINT32 guiLAPTOP; BOOLEAN fNewWWWDisplay=TRUE; static BOOLEAN fNewWWW=TRUE; @@ -411,7 +413,7 @@ UINT32 guiNEWMAIL; //laptop button UINT32 guiLAPTOPBUTTON; // the sidepanel handle -UINT32 guiLAPTOPSIDEPANEL; +UINT32 guiLAPTOPSIDEPANEL; //BOOLEAN gfNewGameLaptop = TRUE; @@ -454,12 +456,12 @@ BOOLEAN fMaximizingProgram = FALSE; // program we are maximizing INT8 bProgramBeingMaximized = -1; -// are we minimizing +// are we minimizing BOOLEAN fMinizingProgram = FALSE; // process openned queue -INT32 gLaptopProgramQueueList[ 6 ]; +INT32 gLaptopProgramQueueList[ 6 ]; @@ -518,7 +520,7 @@ void GetLaptopKeyboardInput(); UINT32 ExitLaptopMode(UINT32 uiMode); UINT32 DrawLapTopText(); -void BtnOnCallback(GUI_BUTTON *btn,INT32 reason); +void BtnOnCallback(GUI_BUTTON *btn,INT32 reason); UINT32 CreateLaptopButtons(); void DeleteLapTopButtons(); BOOLEAN DeleteLapTopMouseRegions(); @@ -531,7 +533,7 @@ void HandleLapTopCursorUpDate(); void PrintBalance( void ); -// callbacks +// callbacks void FinancialRegionButtonCallback(GUI_BUTTON *btn,INT32 reason); void PersonnelRegionButtonCallback(GUI_BUTTON *btn,INT32 reason ); void WWWRegionButtonCallback(GUI_BUTTON *btn,INT32 reason); @@ -663,7 +665,7 @@ void SetLaptopNewGameFlag( ) void HandleLapTopCursorUpDate() { if(guiPreviousLapTopCursor==guiCurrentLapTopCursor) - return; + return; switch(guiCurrentLapTopCursor) { case LAPTOP_PANEL_CURSOR: @@ -672,51 +674,51 @@ void HandleLapTopCursorUpDate() case LAPTOP_SCREEN_CURSOR: MSYS_SetCurrentCursor(CURSOR_LAPTOP_SCREEN); break; - case LAPTOP_WWW_CURSOR: + case LAPTOP_WWW_CURSOR: MSYS_SetCurrentCursor(CURSOR_WWW); break; } - guiPreviousLapTopCursor=guiCurrentLapTopCursor; - + guiPreviousLapTopCursor=guiCurrentLapTopCursor; + } -void +void GetLaptopKeyboardInput() { - InputAtom InputEvent; - POINT MousePos; + InputAtom InputEvent; + POINT MousePos; GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! + ScreenToClient(ghWindow, &MousePos); // In window coords! fTabHandled = FALSE; - while (DequeueEvent(&InputEvent) == TRUE) - { + while (DequeueEvent(&InputEvent) == TRUE) + { // HOOK INTO MOUSE HOOKS switch(InputEvent.usEvent) - { + { case LEFT_BUTTON_DOWN: MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; case LEFT_BUTTON_UP: - MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); + MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); break; case RIGHT_BUTTON_DOWN: MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - case RIGHT_BUTTON_UP: - MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + case RIGHT_BUTTON_UP: + MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - case RIGHT_BUTTON_REPEAT: - MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + case RIGHT_BUTTON_REPEAT: + MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - case LEFT_BUTTON_REPEAT: - MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + case LEFT_BUTTON_REPEAT: + MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - } - + } + HandleKeyBoardShortCutsForLapTop( InputEvent.usEvent, InputEvent.usParam, InputEvent.usKeyState ); - + } } @@ -742,8 +744,8 @@ UINT32 LaptopScreenInit() guiCurrentWWWMode = LAPTOP_MODE_NONE; guiCurrentSidePanel = FIRST_SIDE_PANEL; guiPreviousSidePanel = FIRST_SIDE_PANEL; - - + + gfSideBarFlag=FALSE; gfShowBookmarks=FALSE; InitBookMarkList(); @@ -770,7 +772,7 @@ UINT32 LaptopScreenInit() GameInitInsuranceContract(); GameInitFuneral(); GameInitSirTech(); - GameInitFiles(); + GameInitFiles(); GameInitPersonnel(); // init program states @@ -789,7 +791,7 @@ BOOLEAN InitLaptopAndLaptopScreens() GameInitFinances(); GameInitHistory(); - + //Reset the flag so we can create a new IMP character LaptopSaveInfo.fIMPCompletedFlag = FALSE; @@ -803,18 +805,18 @@ BOOLEAN InitLaptopAndLaptopScreens() UINT32 DrawLapTopIcons() { - - return (TRUE); + + return (TRUE); } UINT32 DrawLapTopText() { - + // show balance DisplayPlayersBalanceToDate( ); - - + + return (TRUE); } @@ -827,21 +829,20 @@ UINT32 LaptopScreenShutdown() ClearHistoryList( ); - return TRUE; + return TRUE; } INT32 EnterLaptop() { //Create, load, initialize data -- just entered the laptop. - - VOBJECT_DESC VObjectDesc; - INT32 iCounter=0; + + VOBJECT_DESC VObjectDesc; static BOOLEAN fEnteredFromGameStartup = TRUE; // we are re entering due to message box, leave NOW! - if( fExitDueToMessageBox == TRUE ) + if( fExitDueToMessageBox == TRUE ) { - + return ( TRUE ); } @@ -866,7 +867,7 @@ INT32 EnterLaptop() // Stop any person from saying anything StopAnyCurrentlyTalkingSpeech( ); - + // Don't play music.... SetMusicMode( MUSIC_LAPTOP ); @@ -880,11 +881,11 @@ INT32 EnterLaptop() // //Enable the rain delay warning // giRainDelayInternetSite = -1; - // //lower the volume + // //lower the volume // guiRainLoop = PlayJA2Ambient( RAIN_1, LOWVOLUME, 0 ); //} - + //open the laptop library // OpenLibrary( LIBRARY_LAPTOP ); @@ -894,40 +895,40 @@ INT32 EnterLaptop() // set the fact we are currently in laptop, for rendering purposes fCurrentlyInLaptop = TRUE; - + // clear guiSAVEBUFFER //ColorFillVideoSurfaceArea(guiSAVEBUFFER, 0, 0, 640, 480, Get16BPPColor(FROMRGB(0, 0, 0)) ); - // disable characters panel buttons + // disable characters panel buttons - // reset redraw flag and redraw new mail + // reset redraw flag and redraw new mail fReDrawScreenFlag = FALSE; - fReDrawNewMailFlag = TRUE; + fReDrawNewMailFlag = TRUE; // setup basic cursors - guiCurrentLapTopCursor=LAPTOP_PANEL_CURSOR; + guiCurrentLapTopCursor=LAPTOP_PANEL_CURSOR; guiPreviousLapTopCursor=LAPTOP_NO_CURSOR; - + // sub page giCurrentSubPage = 0; giCurrentRegion=EMAIL_REGION; - + // load the laptop graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\laptop3.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiLAPTOP)); - + // background for panel VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\taskbar.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiLaptopBACKGROUND)); - + // background for panel VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\programtitlebar.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiTITLEBARLAPTOP)); - + // lights for power and HD VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\lights.sti", VObjectDesc.ImageFile); @@ -937,7 +938,7 @@ INT32 EnterLaptop() VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\ICONS.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiTITLEBARICONS)); - + // load, blt and delete graphics VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP( "LAPTOP\\NewMailWarning.sti", VObjectDesc.ImageFile ); @@ -948,20 +949,20 @@ INT32 EnterLaptop() guiCurrentLaptopMode = LAPTOP_MODE_NONE; //MSYS_SetCurrentCursor(CURSOR_NORMAL); - + guiCurrentLaptopMode = LAPTOP_MODE_NONE; guiPreviousLaptopMode = LAPTOP_MODE_NONE; guiCurrentWWWMode = LAPTOP_MODE_NONE; guiCurrentSidePanel = FIRST_SIDE_PANEL; guiPreviousSidePanel = FIRST_SIDE_PANEL; - gfSideBarFlag=FALSE; - CreateLapTopMouseRegions(); - RenderLapTopImage(); - HighLightRegion(giCurrentRegion); + gfSideBarFlag=FALSE; + CreateLapTopMouseRegions(); + RenderLapTopImage(); + HighLightRegion(giCurrentRegion); //AddEmailMessage(L"Entered LapTop",L"Entered", 0, 0); - //for(iCounter=0; iCounter <10; iCounter++) + //for(iCounter=0; iCounter <10; iCounter++) //{ - //AddEmail(3,5,0,0); + //AddEmail(3,5,0,0); //} // the laptop mouse region @@ -993,9 +994,9 @@ INT32 EnterLaptop() InitLaptopOpenQueue( ); - gfShowBookmarks=FALSE; - LoadBookmark( ); - SetBookMark(AIM_BOOKMARK); + gfShowBookmarks=FALSE; + LoadBookmark( ); + SetBookMark(AIM_BOOKMARK); LoadLoadPending( ); DrawDeskTopBackground( ); @@ -1017,22 +1018,22 @@ INT32 EnterLaptop() void ExitLaptop() { - // exit is called due to message box, leave + // exit is called due to message box, leave if( fExitDueToMessageBox ) { fExitDueToMessageBox = FALSE; return; } - if ( DidGameJustStart() ) - { - SetMusicMode( MUSIC_LAPTOP ); - } - else - { - // Restore to old stuff... - SetMusicMode( MUSIC_RESTORE); - } + if ( DidGameJustStart() ) + { + SetMusicMode( MUSIC_LAPTOP ); + } + else + { + // Restore to old stuff... + SetMusicMode( MUSIC_RESTORE); + } // Start ambients... BuildDayAmbientSounds( ); @@ -1053,66 +1054,66 @@ void ExitLaptop() //Deallocate, save data -- leaving laptop. - SetRenderFlags( RENDER_FLAG_FULL ); + SetRenderFlags( RENDER_FLAG_FULL ); if( fExitDuringLoad == FALSE ) { ExitLaptopMode(guiCurrentLaptopMode); } - + fExitDuringLoad = FALSE; fLoadPendingFlag = FALSE; DeleteVideoObjectFromIndex(guiLAPTOP); - DeleteVideoObjectFromIndex(guiLaptopBACKGROUND); + DeleteVideoObjectFromIndex(guiLaptopBACKGROUND); DeleteVideoObjectFromIndex( guiTITLEBARLAPTOP ); DeleteVideoObjectFromIndex( guiLIGHTS ); - DeleteVideoObjectFromIndex( guiTITLEBARICONS ); + DeleteVideoObjectFromIndex( guiTITLEBARICONS ); DeleteVideoObjectFromIndex( guiEmailWarning ); // destroy region for new mail icon CreateDestroyMouseRegionForNewMailIcon( ); // get rid of desktop - DeleteDesktopBackground( ); + DeleteDesktopBackground( ); - if(fErrorFlag) + if(fErrorFlag) { - fErrorFlag=FALSE; - CreateDestroyErrorButton(); - } + fErrorFlag=FALSE; + CreateDestroyErrorButton(); + } if(fDeleteMailFlag) { - fDeleteMailFlag=FALSE; - CreateDestroyDeleteNoticeMailButton(); - } + fDeleteMailFlag=FALSE; + CreateDestroyDeleteNoticeMailButton(); + } if(fNewMailFlag) { - fNewMailFlag=FALSE; - CreateDestroyNewMailButton(); + fNewMailFlag=FALSE; + CreateDestroyNewMailButton(); } // get rid of minize button CreateDestroyMinimizeButtonForCurrentMode( ); - + //MSYS_SetCurrentCursor(CURSOR_NORMAL); gfEnterLapTop=TRUE; DeleteLapTopButtons(); - DeleteLapTopMouseRegions(); + DeleteLapTopMouseRegions(); // restore tactical buttons - //CreateCurrentTacticalPanelButtons(); + //CreateCurrentTacticalPanelButtons(); gfShowBookmarks=FALSE; CreateDestoryBookMarkRegions( ); - fNewWWW=TRUE; - RemoveBookmark(-2); + fNewWWW=TRUE; + RemoveBookmark(-2); DeleteBookmark( ); //DeleteBookmarkRegions(); - DeleteLoadPending( ); + DeleteLoadPending( ); fReDrawNewMailFlag = FALSE; //Since we are going to MapScreen, check the flag @@ -1128,24 +1129,24 @@ void ExitLaptop() void RenderLapTopImage() { - HVOBJECT hLapTopHandle; - - + HVOBJECT hLapTopHandle; + + if( ( fMaximizingProgram == TRUE ) ||( fMinizingProgram == TRUE) ) { return; } GetVideoObject(&hLapTopHandle, guiLAPTOP); - BltVideoObject(FRAME_BUFFER, hLapTopHandle, 0,LAPTOP_X, LAPTOP_Y, VO_BLT_SRCTRANSPARENCY,NULL); - - + BltVideoObject(FRAME_BUFFER, hLapTopHandle, 0,LAPTOP_X, LAPTOP_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + GetVideoObject(&hLapTopHandle, guiLaptopBACKGROUND); - BltVideoObject(FRAME_BUFFER, hLapTopHandle, 1,iScreenWidthOffset + 25, iScreenHeightOffset + 23, VO_BLT_SRCTRANSPARENCY,NULL); - + BltVideoObject(FRAME_BUFFER, hLapTopHandle, 1,iScreenWidthOffset + 25, iScreenHeightOffset + 23, VO_BLT_SRCTRANSPARENCY,NULL); + MarkButtonsDirty( ); - + } void RenderLaptop() { @@ -1162,14 +1163,14 @@ void RenderLaptop() uiTempMode = guiCurrentLaptopMode; guiCurrentLaptopMode = guiPreviousLaptopMode; } - + switch( guiCurrentLaptopMode ) { case( LAPTOP_MODE_NONE ): - DrawDeskTopBackground( ); + DrawDeskTopBackground( ); break; case LAPTOP_MODE_AIM: - RenderAIM(); + RenderAIM(); break; case LAPTOP_MODE_AIM_MEMBERS: RenderAIMMembers(); @@ -1291,7 +1292,7 @@ void RenderLaptop() case LAPTOP_MODE_BOBBYR_SHIPMENTS: RenderBobbyRShipments(); break; - + } @@ -1303,25 +1304,25 @@ void RenderLaptop() RenderWWWProgramTitleBar( ); } - + if(fLoadPendingFlag) { - guiCurrentLaptopMode = uiTempMode; + guiCurrentLaptopMode = uiTempMode; return; } - + DisplayProgramBoundingBox( FALSE ); - + // mark the buttons dirty at this point - MarkButtonsDirty( ); + MarkButtonsDirty( ); } void EnterNewLaptopMode() { static BOOLEAN fOldLoadFlag=FALSE; - + if( fExitingLaptopFlag ) { return; @@ -1330,124 +1331,124 @@ void EnterNewLaptopMode() fFlickerHD = TRUE; // handle maximizing of programs - switch( guiCurrentLaptopMode ) + switch( guiCurrentLaptopMode ) { case ( LAPTOP_MODE_EMAIL ): - if( gLaptopProgramStates[ LAPTOP_PROGRAM_MAILER ] == LAPTOP_PROGRAM_MINIMIZED ) - { - // minized, maximized - if( fMaximizingProgram == FALSE ) - { - fInitTitle = TRUE; - InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopTitles[ 0 ], guiTITLEBARICONS, 0 ); - ExitLaptopMode(guiPreviousLaptopMode); - - } - fMaximizingProgram = TRUE; - bProgramBeingMaximized = LAPTOP_PROGRAM_MAILER; - gLaptopProgramStates[ LAPTOP_PROGRAM_MAILER ] = LAPTOP_PROGRAM_OPEN; - - return; - } + if( gLaptopProgramStates[ LAPTOP_PROGRAM_MAILER ] == LAPTOP_PROGRAM_MINIMIZED ) + { + // minized, maximized + if( fMaximizingProgram == FALSE ) + { + fInitTitle = TRUE; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopTitles[ 0 ], guiTITLEBARICONS, 0 ); + ExitLaptopMode(guiPreviousLaptopMode); + + } + fMaximizingProgram = TRUE; + bProgramBeingMaximized = LAPTOP_PROGRAM_MAILER; + gLaptopProgramStates[ LAPTOP_PROGRAM_MAILER ] = LAPTOP_PROGRAM_OPEN; + + return; + } break; case ( LAPTOP_MODE_FILES ): - if( gLaptopProgramStates[ LAPTOP_PROGRAM_FILES ] == LAPTOP_PROGRAM_MINIMIZED ) - { - // minized, maximized - if( fMaximizingProgram == FALSE ) - { - fInitTitle = TRUE; - InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopTitles[ 1 ], guiTITLEBARICONS, 2 ); - ExitLaptopMode(guiPreviousLaptopMode); - - } + if( gLaptopProgramStates[ LAPTOP_PROGRAM_FILES ] == LAPTOP_PROGRAM_MINIMIZED ) + { + // minized, maximized + if( fMaximizingProgram == FALSE ) + { + fInitTitle = TRUE; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopTitles[ 1 ], guiTITLEBARICONS, 2 ); + ExitLaptopMode(guiPreviousLaptopMode); - // minized, maximized - fMaximizingProgram = TRUE; - bProgramBeingMaximized = LAPTOP_PROGRAM_FILES; - gLaptopProgramStates[ LAPTOP_PROGRAM_FILES ] = LAPTOP_PROGRAM_OPEN; - return; - } + } + + // minized, maximized + fMaximizingProgram = TRUE; + bProgramBeingMaximized = LAPTOP_PROGRAM_FILES; + gLaptopProgramStates[ LAPTOP_PROGRAM_FILES ] = LAPTOP_PROGRAM_OPEN; + return; + } break; case ( LAPTOP_MODE_PERSONNEL ): - if( gLaptopProgramStates[ LAPTOP_PROGRAM_PERSONNEL ] == LAPTOP_PROGRAM_MINIMIZED ) - { + if( gLaptopProgramStates[ LAPTOP_PROGRAM_PERSONNEL ] == LAPTOP_PROGRAM_MINIMIZED ) + { - // minized, maximized - if( fMaximizingProgram == FALSE ) - { - fInitTitle = TRUE; - InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopTitles[ 2 ], guiTITLEBARICONS, 3 ); - ExitLaptopMode(guiPreviousLaptopMode); - - } + // minized, maximized + if( fMaximizingProgram == FALSE ) + { + fInitTitle = TRUE; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopTitles[ 2 ], guiTITLEBARICONS, 3 ); + ExitLaptopMode(guiPreviousLaptopMode); - // minized, maximized - fMaximizingProgram = TRUE; - bProgramBeingMaximized = LAPTOP_PROGRAM_PERSONNEL; - gLaptopProgramStates[ LAPTOP_PROGRAM_PERSONNEL ] = LAPTOP_PROGRAM_OPEN; - return; - } + } + + // minized, maximized + fMaximizingProgram = TRUE; + bProgramBeingMaximized = LAPTOP_PROGRAM_PERSONNEL; + gLaptopProgramStates[ LAPTOP_PROGRAM_PERSONNEL ] = LAPTOP_PROGRAM_OPEN; + return; + } break; case ( LAPTOP_MODE_FINANCES ): - if( gLaptopProgramStates[ LAPTOP_PROGRAM_FINANCES ] == LAPTOP_PROGRAM_MINIMIZED ) - { + if( gLaptopProgramStates[ LAPTOP_PROGRAM_FINANCES ] == LAPTOP_PROGRAM_MINIMIZED ) + { - // minized, maximized - if( fMaximizingProgram == FALSE ) - { - fInitTitle = TRUE; - InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopTitles[ 3 ], guiTITLEBARICONS, 5 ); - ExitLaptopMode(guiPreviousLaptopMode); - + // minized, maximized + if( fMaximizingProgram == FALSE ) + { + fInitTitle = TRUE; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopTitles[ 3 ], guiTITLEBARICONS, 5 ); + ExitLaptopMode(guiPreviousLaptopMode); - } - // minized, maximized - fMaximizingProgram = TRUE; - bProgramBeingMaximized = LAPTOP_PROGRAM_FINANCES; - gLaptopProgramStates[ LAPTOP_PROGRAM_FINANCES ] = LAPTOP_PROGRAM_OPEN; - return; - } + } + + // minized, maximized + fMaximizingProgram = TRUE; + bProgramBeingMaximized = LAPTOP_PROGRAM_FINANCES; + gLaptopProgramStates[ LAPTOP_PROGRAM_FINANCES ] = LAPTOP_PROGRAM_OPEN; + return; + } break; case ( LAPTOP_MODE_HISTORY ): - if( gLaptopProgramStates[ LAPTOP_PROGRAM_HISTORY ] == LAPTOP_PROGRAM_MINIMIZED ) - { - // minized, maximized - if( fMaximizingProgram == FALSE ) - { - fInitTitle = TRUE; - InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopTitles[ 4 ], guiTITLEBARICONS, 4 ); - ExitLaptopMode(guiPreviousLaptopMode); - + if( gLaptopProgramStates[ LAPTOP_PROGRAM_HISTORY ] == LAPTOP_PROGRAM_MINIMIZED ) + { + // minized, maximized + if( fMaximizingProgram == FALSE ) + { + fInitTitle = TRUE; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopTitles[ 4 ], guiTITLEBARICONS, 4 ); + ExitLaptopMode(guiPreviousLaptopMode); - } - // minized, maximized - fMaximizingProgram = TRUE; - bProgramBeingMaximized = LAPTOP_PROGRAM_HISTORY; - gLaptopProgramStates[ LAPTOP_PROGRAM_HISTORY ] = LAPTOP_PROGRAM_OPEN; - return; - } + + } + // minized, maximized + fMaximizingProgram = TRUE; + bProgramBeingMaximized = LAPTOP_PROGRAM_HISTORY; + gLaptopProgramStates[ LAPTOP_PROGRAM_HISTORY ] = LAPTOP_PROGRAM_OPEN; + return; + } break; case( LAPTOP_MODE_NONE ): - // do nothing + // do nothing break; default: - if( gLaptopProgramStates[ LAPTOP_PROGRAM_WEB_BROWSER ] == LAPTOP_PROGRAM_MINIMIZED ) - { - // minized, maximized - if( fMaximizingProgram == FALSE ) - { - fInitTitle = TRUE; - InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pWebTitle[ 0 ], guiTITLEBARICONS, 1 ); - ExitLaptopMode(guiPreviousLaptopMode); - } - // minized, maximized - fMaximizingProgram = TRUE; - bProgramBeingMaximized = LAPTOP_PROGRAM_WEB_BROWSER; - gLaptopProgramStates[ LAPTOP_PROGRAM_WEB_BROWSER ] = LAPTOP_PROGRAM_OPEN; - return; - } + if( gLaptopProgramStates[ LAPTOP_PROGRAM_WEB_BROWSER ] == LAPTOP_PROGRAM_MINIMIZED ) + { + // minized, maximized + if( fMaximizingProgram == FALSE ) + { + fInitTitle = TRUE; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pWebTitle[ 0 ], guiTITLEBARICONS, 1 ); + ExitLaptopMode(guiPreviousLaptopMode); + } + // minized, maximized + fMaximizingProgram = TRUE; + bProgramBeingMaximized = LAPTOP_PROGRAM_WEB_BROWSER; + gLaptopProgramStates[ LAPTOP_PROGRAM_WEB_BROWSER ] = LAPTOP_PROGRAM_OPEN; + return; + } break; } @@ -1459,11 +1460,11 @@ void EnterNewLaptopMode() if((fOldLoadFlag)&&(!fLoadPendingFlag)) { - fOldLoadFlag=FALSE; + fOldLoadFlag=FALSE; } - else if((fLoadPendingFlag)&&(!fOldLoadFlag)) - { - ExitLaptopMode(guiPreviousLaptopMode); + else if((fLoadPendingFlag)&&(!fOldLoadFlag)) + { + ExitLaptopMode(guiPreviousLaptopMode); fOldLoadFlag=TRUE; return; } @@ -1476,7 +1477,7 @@ void EnterNewLaptopMode() // do not exit previous mode if coming from sliding bar handler if( ( fEnteredNewLapTopDueToHandleSlidingBars == FALSE ) ) { - ExitLaptopMode(guiPreviousLaptopMode); + ExitLaptopMode(guiPreviousLaptopMode); } } @@ -1484,24 +1485,24 @@ void EnterNewLaptopMode() if((guiCurrentWWWMode==LAPTOP_MODE_NONE)&&(guiCurrentLaptopMode >=LAPTOP_MODE_WWW)) { - RenderLapTopImage(); - giCurrentRegion=WWW_REGION; - RestoreOldRegion(giOldRegion); - guiCurrentLaptopMode =LAPTOP_MODE_WWW; - HighLightRegion(giCurrentRegion); + RenderLapTopImage(); + giCurrentRegion=WWW_REGION; + RestoreOldRegion(giOldRegion); + guiCurrentLaptopMode =LAPTOP_MODE_WWW; + HighLightRegion(giCurrentRegion); } else { - if( guiCurrentLaptopMode > LAPTOP_MODE_WWW) - { - if(guiPreviousLaptopMode < LAPTOP_MODE_WWW ) - guiCurrentLaptopMode = guiCurrentWWWMode; - else - { - guiCurrentWWWMode = guiCurrentLaptopMode; - giCurrentSubPage =0; - } - } + if( guiCurrentLaptopMode > LAPTOP_MODE_WWW) + { + if(guiPreviousLaptopMode < LAPTOP_MODE_WWW ) + guiCurrentLaptopMode = guiCurrentWWWMode; + else + { + guiCurrentWWWMode = guiCurrentLaptopMode; + giCurrentSubPage =0; + } + } } if( guiCurrentLaptopMode >= LAPTOP_MODE_WWW ) @@ -1513,10 +1514,10 @@ void EnterNewLaptopMode() if( ( guiCurrentLaptopMode >= LAPTOP_MODE_WWW ) &&( guiPreviousLaptopMode >= LAPTOP_MODE_WWW ) ) { - gfShowBookmarks = FALSE; + gfShowBookmarks = FALSE; } - + //Initialize the new mode. switch( guiCurrentLaptopMode ) @@ -1641,36 +1642,36 @@ void EnterNewLaptopMode() break; } - + // first time using webbrowser in this laptop session if( ( fFirstTimeInLaptop == TRUE ) && ( guiCurrentLaptopMode >=LAPTOP_MODE_WWW ) ) { // show bookmarks gfShowBookmarks = TRUE; - // reset flag + // reset flag fFirstTimeInLaptop = FALSE; } - if( ( !fLoadPendingFlag) ) + if( ( !fLoadPendingFlag) ) { - CreateDestroyMinimizeButtonForCurrentMode( ); + CreateDestroyMinimizeButtonForCurrentMode( ); guiPreviousLaptopMode = guiCurrentLaptopMode; SetSubSiteAsVisted( ); } DisplayProgramBoundingBox( TRUE ); - + // check to see if we need to go to there default web page of not - //HandleDefaultWebpageForLaptop( ); + //HandleDefaultWebpageForLaptop( ); } void HandleLapTopHandles() { if(fLoadPendingFlag) return; - + if( ( fMaximizingProgram == TRUE ) || ( fMinizingProgram == TRUE ) ) { return; @@ -1679,9 +1680,9 @@ void HandleLapTopHandles() switch( guiCurrentLaptopMode ) { - + case LAPTOP_MODE_AIM: - + HandleAIM(); break; case LAPTOP_MODE_AIM_MEMBERS: @@ -1719,7 +1720,7 @@ void HandleLapTopHandles() HandleMercsNoAccount(); break; - + case LAPTOP_MODE_BOBBY_R: HandleBobbyR(); break; @@ -1742,7 +1743,7 @@ void HandleLapTopHandles() HandleBobbyRMailOrder(); break; - + case LAPTOP_MODE_CHAR_PROFILE: HandleCharProfile(); break; @@ -1773,7 +1774,7 @@ void HandleLapTopHandles() case LAPTOP_MODE_INSURANCE_COMMENTS: HandleInsuranceComments(); break; - + case LAPTOP_MODE_FUNERAL: HandleFuneral(); break; @@ -1795,16 +1796,16 @@ void HandleLapTopHandles() case LAPTOP_MODE_EMAIL: HandleEmail(); break; - + case LAPTOP_MODE_BROKEN_LINK: HandleBrokenLink(); break; - + case LAPTOP_MODE_BOBBYR_SHIPMENTS: HandleBobbyRShipments(); break; } - + } extern BOOLEAN gfPrintFrameBuffer; @@ -1814,7 +1815,7 @@ UINT32 LaptopScreenHandle() INT16 sYOffset = 0; INT16 sXOffset = 0; - //User just changed modes. This is determined by the button callbacks + //User just changed modes. This is determined by the button callbacks //created in LaptopScreenInit() // Correct the minor cosmetic bug (laptop zooming start not correct) @@ -1842,15 +1843,15 @@ UINT32 LaptopScreenHandle() // just entered if(gfEnterLapTop) { - EnterLaptop(); - CreateLaptopButtons(); - gfEnterLapTop=FALSE; + EnterLaptop(); + CreateLaptopButtons(); + gfEnterLapTop=FALSE; } if( gfStartMapScreenToLaptopTransition ) - { + { //Everything is set up to start the transition animation. - //SGPRect SrcRect1; + //SGPRect SrcRect1; SGPRect SrcRect2, DstRect; INT32 iPercentage, iScalePercentage, iFactor; UINT32 uiStartTime, uiTimeRange, uiCurrTime; @@ -1860,7 +1861,7 @@ UINT32 LaptopScreenHandle() INT32 iRealPercentage; SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); - //Step 1: Build the laptop image into the save buffer. + //Step 1: Build the laptop image into the save buffer. gfStartMapScreenToLaptopTransition = FALSE; RestoreBackgroundRects(); RenderLapTopImage(); @@ -1872,8 +1873,8 @@ UINT32 LaptopScreenHandle() PrintNumberOnTeam( ); ShowLights(); - //Step 2: The mapscreen image is in the EXTRABUFFER, and laptop is in the SAVEBUFFER - // Start transitioning the screen. + //Step 2: The mapscreen image is in the EXTRABUFFER, and laptop is in the SAVEBUFFER + // Start transitioning the screen. DstRect.iLeft = iScreenWidthOffset; //0 DstRect.iTop = iScreenHeightOffset; //0 DstRect.iRight = iScreenWidthOffset + 640; //640 @@ -1891,8 +1892,8 @@ UINT32 LaptopScreenHandle() // SCREEN_WIDTH - iScreenWidthOffset, SCREEN_HEIGHT - iScreenHeightOffset ); PlayJA2SampleFromFile( "SOUNDS\\Laptop power up (8-11).wav", RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); - - while( iRealPercentage < 100 ) + + while( iRealPercentage < 100 ) { // Lesh: restore mapscreen so laptop zooming won't leave "graphical trail BlitBufferToBuffer( guiEXTRABUFFER, FRAME_BUFFER, iScreenWidthOffset, iScreenHeightOffset, @@ -1926,34 +1927,34 @@ UINT32 LaptopScreenHandle() SrcRect2.iRight = SrcRect2.iLeft + iWidth; SrcRect2.iTop = iY - iHeight / 2; SrcRect2.iBottom = SrcRect2.iTop + iHeight; - + BltStretchVideoSurface( FRAME_BUFFER, guiSAVEBUFFER, iScreenWidthOffset, iScreenHeightOffset, 0, &DstRect, &SrcRect2 ); InvalidateScreen(); - + RefreshScreen( NULL ); } fReDrawScreenFlag = TRUE; } - + //DO NOT MOVE THIS FUNCTION CALL!!! - + //This determines if the help screen should be active if( ShouldTheHelpScreenComeUp( HELP_SCREEN_LAPTOP, FALSE ) ) { // handle the help screen HelpScreenHandler(); - return( LAPTOP_SCREEN ); + return( LAPTOP_SCREEN ); } RestoreBackgroundRects(); // lock cursor to screen RestrictMouseCursor( &LaptopScreenRect ); - - + + // handle animated cursors HandleAnimatedCursors( ); @@ -1974,7 +1975,7 @@ UINT32 LaptopScreenHandle() { fLoadPendingFlag=FALSE; } - + if( ( fMaximizingProgram == FALSE ) && ( fMinizingProgram == FALSE ) ) { if( guiCurrentLaptopMode <= LAPTOP_MODE_WWW ) @@ -1985,102 +1986,102 @@ UINT32 LaptopScreenHandle() guiPreviousLaptopMode = guiCurrentLaptopMode; } } - else - { - if(!fLoadPendingFlag) - { + else + { + if(!fLoadPendingFlag) + { EnterNewLaptopMode(); guiPreviousLaptopMode = guiCurrentLaptopMode; - } + } } } - } + } if( fPausedReDrawScreenFlag ) { fReDrawScreenFlag = TRUE; fPausedReDrawScreenFlag = FALSE; } - - if( fReDrawScreenFlag ) + + if( fReDrawScreenFlag ) { - RenderLapTopImage(); - HighLightRegion(giCurrentRegion); - RenderLaptop(); - + RenderLapTopImage(); + HighLightRegion(giCurrentRegion); + RenderLaptop(); + } - + // are we about to leave laptop if( fExitingLaptopFlag ) { if( fLoadPendingFlag == TRUE ) { - fLoadPendingFlag = FALSE; - fExitDuringLoad = TRUE; + fLoadPendingFlag = FALSE; + fExitDuringLoad = TRUE; } LeaveLapTopScreen( ); } - + if( fExitingLaptopFlag == FALSE ) { - // handle handles for laptop input stream - HandleLapTopHandles(); + // handle handles for laptop input stream + HandleLapTopHandles(); } // get keyboard input, handle it GetLaptopKeyboardInput(); - - + + // check to see if new mail box needs to be displayed DisplayNewMailBox( ); - CreateDestroyNewMailButton( ); + CreateDestroyNewMailButton( ); // create various mouse regions that are global to laptop system - CreateDestoryBookMarkRegions( ); + CreateDestoryBookMarkRegions( ); CreateDestroyErrorButton( ); - + // check to see if error box needs to be displayed DisplayErrorBox(); // check to see if buttons marked dirty - CheckMarkButtonsDirtyFlag( ); - - // check to see if new mail box needs to be displayed + CheckMarkButtonsDirtyFlag( ); + + // check to see if new mail box needs to be displayed ShouldNewMailBeDisplayed(); - + // check to see if new mail box needs to be displayed ReDrawNewMailBox( ); - + // look for unread email LookForUnread(); //Handle keyboard shortcuts... - + // mouse regions - //HandleLapTopScreenMouseUi(); - //RenderButtons(); + //HandleLapTopScreenMouseUi(); + //RenderButtons(); //RenderButtonsFastHelp( ); - - - if( ( fLoadPendingFlag == FALSE )||( fNewMailFlag ) ) + + + if( ( fLoadPendingFlag == FALSE )||( fNewMailFlag ) ) { - // render buttons marked dirty - RenderButtons( ); - - // render fast help 'quick created' buttons + // render buttons marked dirty + RenderButtons( ); + + // render fast help 'quick created' buttons // RenderFastHelp( ); -// RenderButtonsFastHelp( ); - } +// RenderButtonsFastHelp( ); + } // show text on top of buttons if( ( fMaximizingProgram == FALSE ) && ( fMinizingProgram == FALSE ) ) { - DrawButtonText(); + DrawButtonText(); } @@ -2101,12 +2102,12 @@ UINT32 LaptopScreenHandle() if( ( fIntermediateReDrawFlag )||( fReDrawPostButtonRender ) ) { - // rendering AFTER buttons and button text - if( ( fMaximizingProgram == FALSE ) && ( fMinizingProgram == FALSE ) ) + // rendering AFTER buttons and button text + if( ( fMaximizingProgram == FALSE ) && ( fMinizingProgram == FALSE ) ) { - PostButtonRendering( ); + PostButtonRendering( ); } - } + } //PrintBalance( ); PrintDate( ); @@ -2125,16 +2126,16 @@ UINT32 LaptopScreenHandle() // display power and HD lights ShowLights( ); - + // render frame rate DisplayFrameRate( ); - + // invalidate screen if redrawn if( fReDrawScreenFlag == TRUE ) { InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); - fReDrawScreenFlag = FALSE; + fReDrawScreenFlag = FALSE; } ExecuteVideoOverlays(); @@ -2143,11 +2144,11 @@ UINT32 LaptopScreenHandle() // RenderButtonsFastHelp(); RenderFastHelp( ); - // ex SAVEBUFFER queue + // ex SAVEBUFFER queue ExecuteBaseDirtyRectQueue(); ResetInterface(); EndFrameBufferRender( ); - return (LAPTOP_SCREEN); + return (LAPTOP_SCREEN); } @@ -2157,15 +2158,15 @@ UINT32 LaptopScreenHandle() UINT32 RenderLaptopPanel() { - - return 0; + + return 0; } UINT32 ExitLaptopMode(UINT32 uiMode) { //Deallocate the previous mode that you were in. - + switch( uiMode ) { case LAPTOP_MODE_AIM: @@ -2206,7 +2207,7 @@ UINT32 ExitLaptopMode(UINT32 uiMode) ExitMercsNoAccount(); break; - + case LAPTOP_MODE_BOBBY_R: ExitBobbyR(); break; @@ -2260,7 +2261,7 @@ UINT32 ExitLaptopMode(UINT32 uiMode) case LAPTOP_MODE_INSURANCE_COMMENTS: ExitInsuranceComments(); break; - + case LAPTOP_MODE_FUNERAL: ExitFuneral(); break; @@ -2279,13 +2280,13 @@ UINT32 ExitLaptopMode(UINT32 uiMode) case LAPTOP_MODE_FILES: ExitFiles(); break; - case LAPTOP_MODE_EMAIL: + case LAPTOP_MODE_EMAIL: ExitEmail(); break; case LAPTOP_MODE_BROKEN_LINK: ExitBrokenLink(); break; - + case LAPTOP_MODE_BOBBYR_SHIPMENTS: ExitBobbyRShipments(); break; @@ -2293,7 +2294,7 @@ UINT32 ExitLaptopMode(UINT32 uiMode) if( ( uiMode != LAPTOP_MODE_NONE )&&( uiMode < LAPTOP_MODE_WWW ) ) { - CreateDestroyMinimizeButtonForCurrentMode( ); + CreateDestroyMinimizeButtonForCurrentMode( ); } return(TRUE); } @@ -2303,105 +2304,105 @@ UINT32 CreateLaptopButtons() { memset( giLapTopButton, -1, sizeof( giLapTopButton ) ); - + // the program buttons - gLaptopButtonImage[0]= LoadButtonImage( "LAPTOP\\buttonsforlaptop.sti" ,-1,0,-1,8,-1 ); + gLaptopButtonImage[0]= LoadButtonImage( "LAPTOP\\buttonsforlaptop.sti" ,-1,0,-1,8,-1 ); gLaptopButton[0] = QuickCreateButton( gLaptopButtonImage[0], iScreenWidthOffset + 29, iScreenHeightOffset + 66, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)EmailRegionButtonCallback); CreateLaptopButtonHelpText( gLaptopButton[0], LAPTOP_BN_HLP_TXT_VIEW_EMAIL ); - - SpecifyButtonText( gLaptopButton[0], pLaptopIcons[ 0 ] ); + + SpecifyButtonText( gLaptopButton[0], pLaptopIcons[ 0 ] ); SpecifyButtonFont( gLaptopButton[0], FONT10ARIAL ); SpecifyButtonTextOffsets( gLaptopButton[0], 30, 11, TRUE ); SpecifyButtonDownTextColors( gLaptopButton[0], 2, 0 ); SpecifyButtonUpTextColors( gLaptopButton[0], 2, 0 ); - gLaptopButtonImage[1]= LoadButtonImage( "LAPTOP\\buttonsforlaptop.sti" ,-1,1,-1,9,-1 ); - gLaptopButton[1] = QuickCreateButton( gLaptopButtonImage[1], iScreenWidthOffset + 29, + gLaptopButtonImage[1]= LoadButtonImage( "LAPTOP\\buttonsforlaptop.sti" ,-1,1,-1,9,-1 ); + gLaptopButton[1] = QuickCreateButton( gLaptopButtonImage[1], iScreenWidthOffset + 29, iScreenHeightOffset + 98, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)WWWRegionButtonCallback); CreateLaptopButtonHelpText( gLaptopButton[1], LAPTOP_BN_HLP_TXT_BROWSE_VARIOUS_WEB_SITES ); - SpecifyButtonText( gLaptopButton[1], pLaptopIcons[1 ] ); + SpecifyButtonText( gLaptopButton[1], pLaptopIcons[1 ] ); SpecifyButtonFont( gLaptopButton[1], FONT10ARIAL ); SpecifyButtonTextOffsets( gLaptopButton[1], 30, 11, TRUE ); SpecifyButtonUpTextColors( gLaptopButton[1], 2, 0 ); SpecifyButtonDownTextColors( gLaptopButton[1], 2, 0 ); - - gLaptopButtonImage[2]= LoadButtonImage( "LAPTOP\\buttonsforlaptop.sti" ,-1,2,-1,10,-1 ); + + gLaptopButtonImage[2]= LoadButtonImage( "LAPTOP\\buttonsforlaptop.sti" ,-1,2,-1,10,-1 ); gLaptopButton[2] = QuickCreateButton( gLaptopButtonImage[2], iScreenWidthOffset + 29, iScreenHeightOffset + 130, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)FilesRegionButtonCallback); CreateLaptopButtonHelpText( gLaptopButton[2], LAPTOP_BN_HLP_TXT_VIEW_FILES_AND_EMAIL_ATTACHMENTS ); - SpecifyButtonText( gLaptopButton[2], pLaptopIcons[ 5 ] ); + SpecifyButtonText( gLaptopButton[2], pLaptopIcons[ 5 ] ); SpecifyButtonFont( gLaptopButton[2], FONT10ARIAL ); SpecifyButtonTextOffsets( gLaptopButton[2], 30, 11, TRUE ); SpecifyButtonUpTextColors( gLaptopButton[2], 2, 0 ); SpecifyButtonDownTextColors( gLaptopButton[2], 2, 0 ); - - gLaptopButtonImage[3]= LoadButtonImage( "LAPTOP\\buttonsforlaptop.sti" ,-1,3,-1,11,-1 ); + + gLaptopButtonImage[3]= LoadButtonImage( "LAPTOP\\buttonsforlaptop.sti" ,-1,3,-1,11,-1 ); gLaptopButton[3] = QuickCreateButton( gLaptopButtonImage[3], iScreenWidthOffset + 29, iScreenHeightOffset + 194, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)PersonnelRegionButtonCallback); CreateLaptopButtonHelpText( gLaptopButton[3], LAPTOP_BN_HLP_TXT_VIEW_TEAM_INFO ); - SpecifyButtonText( gLaptopButton[3], pLaptopIcons[ 3] ); + SpecifyButtonText( gLaptopButton[3], pLaptopIcons[ 3] ); SpecifyButtonFont( gLaptopButton[3], FONT10ARIAL ); SpecifyButtonTextOffsets( gLaptopButton[3], 30, 11, TRUE ); SpecifyButtonUpTextColors( gLaptopButton[3], 2, 0 ); SpecifyButtonDownTextColors( gLaptopButton[3], 2, 0 ); - - gLaptopButtonImage[4]= LoadButtonImage( "LAPTOP\\buttonsforlaptop.sti" ,-1,4,-1,12,-1 ); + + gLaptopButtonImage[4]= LoadButtonImage( "LAPTOP\\buttonsforlaptop.sti" ,-1,4,-1,12,-1 ); gLaptopButton[4] = QuickCreateButton( gLaptopButtonImage[4], iScreenWidthOffset + 29, iScreenHeightOffset + 162, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)HistoryRegionButtonCallback); CreateLaptopButtonHelpText( gLaptopButton[4], LAPTOP_BN_HLP_TXT_READ_LOG_OF_EVENTS ); - SpecifyButtonText( gLaptopButton[4], pLaptopIcons[ 4 ] ); + SpecifyButtonText( gLaptopButton[4], pLaptopIcons[ 4 ] ); SpecifyButtonFont( gLaptopButton[4], FONT10ARIAL ); SpecifyButtonTextOffsets( gLaptopButton[4], 30, 11, TRUE ); SpecifyButtonUpTextColors( gLaptopButton[4], 2, 0 ); SpecifyButtonDownTextColors( gLaptopButton[4], 2, 0 ); - - - gLaptopButtonImage[5]= LoadButtonImage( "LAPTOP\\buttonsforlaptop.sti" ,-1,5,-1,13,-1 ); + + + gLaptopButtonImage[5]= LoadButtonImage( "LAPTOP\\buttonsforlaptop.sti" ,-1,5,-1,13,-1 ); gLaptopButton[5] = QuickCreateButton( gLaptopButtonImage[5], iScreenWidthOffset + 29, iScreenHeightOffset + 241, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)FinancialRegionButtonCallback); CreateLaptopButtonHelpText( gLaptopButton[5], LAPTOP_BN_HLP_TXT_VIEW_FINANCIAL_SUMMARY_AND_HISTORY ); - SpecifyButtonText( gLaptopButton[5], pLaptopIcons[ 2 ] ); + SpecifyButtonText( gLaptopButton[5], pLaptopIcons[ 2 ] ); SpecifyButtonFont( gLaptopButton[5], FONT10ARIAL ); SpecifyButtonTextOffsets( gLaptopButton[5], 30, 11, TRUE ); SpecifyButtonUpTextColors( gLaptopButton[5], 2, 0 ); SpecifyButtonDownTextColors( gLaptopButton[5], 2, 0 ); - - gLaptopButtonImage[6]= LoadButtonImage( "LAPTOP\\buttonsforlaptop.sti" ,-1,6,-1,14,-1 ); + + gLaptopButtonImage[6]= LoadButtonImage( "LAPTOP\\buttonsforlaptop.sti" ,-1,6,-1,14,-1 ); gLaptopButton[6] = QuickCreateButton( gLaptopButtonImage[6], iScreenWidthOffset + 29, iScreenHeightOffset + 378, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnOnCallback); CreateLaptopButtonHelpText( gLaptopButton[6], LAPTOP_BN_HLP_TXT_CLOSE_LAPTOP ); - - SpecifyButtonText( gLaptopButton[6], pLaptopIcons[ 6 ] ); + + SpecifyButtonText( gLaptopButton[6], pLaptopIcons[ 6 ] ); SpecifyButtonFont( gLaptopButton[6], FONT10ARIAL ); SpecifyButtonTextOffsets( gLaptopButton[6], 25, 11, TRUE ); SpecifyButtonUpTextColors( gLaptopButton[6], 2, 0 ); SpecifyButtonDownTextColors( gLaptopButton[6], 2, 0 ); - + // define the cursor SetButtonCursor(gLaptopButton[0], CURSOR_LAPTOP_SCREEN); @@ -2423,40 +2424,40 @@ DeleteLapTopButtons() UINT32 cnt; for( cnt = 0; cnt < 7; cnt++ ) - { + { RemoveButton( gLaptopButton[ cnt ] ); UnloadButtonImage( gLaptopButtonImage[ cnt ] ); } } -void +void BtnOnCallback(GUI_BUTTON *btn,INT32 reason) { if (!(btn->uiFlags & BUTTON_ENABLED)) - return; + return; if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - btn->uiFlags|=(BUTTON_CLICKED_ON); - InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); - + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + btn->uiFlags|=(BUTTON_CLICKED_ON); + InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); + } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { - if ( HandleExit( ) ) - { -// btn->uiFlags&=~(BUTTON_CLICKED_ON); - fExitingLaptopFlag = TRUE; - InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); - } - } - btn->uiFlags&=~(BUTTON_CLICKED_ON); + if ( HandleExit( ) ) + { +// btn->uiFlags&=~(BUTTON_CLICKED_ON); + fExitingLaptopFlag = TRUE; + InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); + } + } + btn->uiFlags&=~(BUTTON_CLICKED_ON); } -} +} BOOLEAN LeaveLapTopScreen( void ) { @@ -2478,7 +2479,7 @@ BOOLEAN LeaveLapTopScreen( void ) sXOffset = 2; sYOffset = 1; } - + if( ExitLaptopDone( ) ) { SetLaptopExitScreen( MAP_SCREEN ); @@ -2499,7 +2500,7 @@ BOOLEAN LeaveLapTopScreen( void ) gfDontStartTransitionFromLaptop = TRUE; } - SetPendingNewScreen(guiExitScreen); + SetPendingNewScreen(guiExitScreen); if( !gfDontStartTransitionFromLaptop ) { @@ -2512,7 +2513,7 @@ BOOLEAN LeaveLapTopScreen( void ) gfDontStartTransitionFromLaptop = TRUE; SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); - //Step 1: Build the laptop image into the save buffer. + //Step 1: Build the laptop image into the save buffer. RestoreBackgroundRects(); RenderLapTopImage(); HighLightRegion(giCurrentRegion); @@ -2523,8 +2524,8 @@ BOOLEAN LeaveLapTopScreen( void ) PrintNumberOnTeam( ); ShowLights(); - //Step 2: The mapscreen image is in the EXTRABUFFER, and laptop is in the SAVEBUFFER - // Start transitioning the screen. + //Step 2: The mapscreen image is in the EXTRABUFFER, and laptop is in the SAVEBUFFER + // Start transitioning the screen. DstRect.iLeft = iScreenWidthOffset + 0; // 0 DstRect.iTop = iScreenHeightOffset + 0; // 0 DstRect.iRight = iScreenWidthOffset + 640; // 640 @@ -2540,7 +2541,7 @@ BOOLEAN LeaveLapTopScreen( void ) PlayJA2SampleFromFile( "SOUNDS\\Laptop power down (8-11).wav", RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); - while( iRealPercentage > 0 ) + while( iRealPercentage > 0 ) { BlitBufferToBuffer( guiEXTRABUFFER, FRAME_BUFFER, iScreenWidthOffset, iScreenHeightOffset, SCREEN_WIDTH - iScreenWidthOffset, SCREEN_HEIGHT - iScreenHeightOffset ); @@ -2586,7 +2587,7 @@ BOOLEAN LeaveLapTopScreen( void ) //gfPrintFrameBuffer = TRUE; RefreshScreen( NULL ); } - } + } } return( TRUE ); @@ -2597,7 +2598,7 @@ BOOLEAN HandleExit( void ) { // static BOOLEAN fSentImpWarningAlready = FALSE; - + // remind player about IMP if ( LaptopSaveInfo.gfNewGameLaptop != 0 ) { @@ -2609,7 +2610,7 @@ BOOLEAN HandleExit( void ) } } - // new game, send email + // new game, send email if ( LaptopSaveInfo.gfNewGameLaptop != 0 ) { // Set an event to send this email ( day 2 8:00-12:00 ) @@ -2619,16 +2620,16 @@ BOOLEAN HandleExit( void ) /* Moved to an event that gets triggered the next day: HaventMadeImpMercEmailCallBack() - + LaptopSaveInfo.fSentImpWarningAlready = TRUE; AddEmail(IMP_EMAIL_AGAIN,IMP_EMAIL_AGAIN_LENGTH,1, GetWorldTotalMin( ) ); */ fExitingLaptopFlag = TRUE; - return( FALSE ); - } + return( FALSE ); + } } - + return ( TRUE ); @@ -2645,17 +2646,17 @@ void HaventMadeImpMercEmailCallBack() } -BOOLEAN +BOOLEAN CreateLapTopMouseRegions() { // define regions - + // the entire laptop display region MSYS_DefineRegion( &gLapTopScreenRegion, ( UINT16 )( LaptopScreenRect.iLeft ),( UINT16 )( LaptopScreenRect.iTop ),( UINT16 ) ( LaptopScreenRect.iRight ),( UINT16 )( LaptopScreenRect.iBottom ), MSYS_PRIORITY_NORMAL+1, - CURSOR_LAPTOP_SCREEN, ScreenRegionMvtCallback, LapTopScreenCallBack ); + CURSOR_LAPTOP_SCREEN, ScreenRegionMvtCallback, LapTopScreenCallBack ); + - //MSYS_AddRegion(&gLapTopScreenRegion); return (TRUE); } @@ -2663,9 +2664,9 @@ CreateLapTopMouseRegions() BOOLEAN DeleteLapTopMouseRegions() { - + MSYS_RemoveRegion( &gLapTopScreenRegion); - + return (TRUE); } @@ -2674,52 +2675,52 @@ void FinancialRegionButtonCallback(GUI_BUTTON *btn,INT32 reason) if (!(btn->uiFlags & BUTTON_ENABLED)) return; - + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - btn->uiFlags|=(BUTTON_CLICKED_ON); + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); if(giCurrentRegion!=FINANCIAL_REGION) - giOldRegion=giCurrentRegion; + giOldRegion=giCurrentRegion; giCurrentRegion=FINANCIAL_REGION; if(gfShowBookmarks) { - gfShowBookmarks=FALSE; - fReDrawScreenFlag=TRUE; + gfShowBookmarks=FALSE; + fReDrawScreenFlag=TRUE; } guiCurrentLaptopMode=LAPTOP_MODE_FINANCES; UpdateListToReflectNewProgramOpened( LAPTOP_PROGRAM_FINANCES ); - } } -} - - + } +} + + void PersonnelRegionButtonCallback( GUI_BUTTON *btn,INT32 reason) -{ - +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) return; - + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - btn->uiFlags|=(BUTTON_CLICKED_ON); + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); if(giCurrentRegion!=PERSONNEL_REGION) @@ -2728,8 +2729,8 @@ void PersonnelRegionButtonCallback( GUI_BUTTON *btn,INT32 reason) guiCurrentLaptopMode=LAPTOP_MODE_PERSONNEL; if(gfShowBookmarks) { - gfShowBookmarks=FALSE; - fReDrawScreenFlag=TRUE; + gfShowBookmarks=FALSE; + fReDrawScreenFlag=TRUE; } RestoreOldRegion(giOldRegion); HighLightRegion(giCurrentRegion); @@ -2737,80 +2738,80 @@ void PersonnelRegionButtonCallback( GUI_BUTTON *btn,INT32 reason) UpdateListToReflectNewProgramOpened( LAPTOP_PROGRAM_PERSONNEL ); - } - } + } + } } -void EmailRegionButtonCallback( GUI_BUTTON *btn,INT32 reason ) -{ - +void EmailRegionButtonCallback( GUI_BUTTON *btn,INT32 reason ) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) return; - + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - btn->uiFlags|=(BUTTON_CLICKED_ON); + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); // set old region if(giCurrentRegion!=EMAIL_REGION) - giOldRegion=giCurrentRegion; - + giOldRegion=giCurrentRegion; + // stop showing WWW bookmarks if(gfShowBookmarks) { - gfShowBookmarks=FALSE; + gfShowBookmarks=FALSE; } // set current highlight region giCurrentRegion=EMAIL_REGION; - + // restore old region RestoreOldRegion(giOldRegion); // set up current mode guiCurrentLaptopMode =LAPTOP_MODE_EMAIL; - + UpdateListToReflectNewProgramOpened( LAPTOP_PROGRAM_MAILER ); // highlight current region HighLightRegion(giCurrentRegion); - + //redraw screen fReDrawScreenFlag=TRUE; } - } + } } void WWWRegionButtonCallback(GUI_BUTTON *btn,INT32 reason ) -{ +{ if (!(btn->uiFlags & BUTTON_ENABLED)) return; - + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - btn->uiFlags|=(BUTTON_CLICKED_ON); + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + btn->uiFlags|=(BUTTON_CLICKED_ON); } - else if(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN ) + else if(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN ) { - if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - btn->uiFlags|=(BUTTON_CLICKED_ON); + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); if(giCurrentRegion!=WWW_REGION) giOldRegion=giCurrentRegion; if(!fNewWWW) @@ -2819,7 +2820,7 @@ void WWWRegionButtonCallback(GUI_BUTTON *btn,INT32 reason ) // reset show bookmarks if( guiCurrentLaptopMode < LAPTOP_MODE_WWW ) { - gfShowBookmarks = FALSE; + gfShowBookmarks = FALSE; fShowBookmarkInfo = TRUE; } else @@ -2830,13 +2831,13 @@ void WWWRegionButtonCallback(GUI_BUTTON *btn,INT32 reason ) if((gfShowBookmarks)&&(!fNewWWW)) { - - fReDrawScreenFlag=TRUE; - fNewWWWDisplay=FALSE; + + fReDrawScreenFlag=TRUE; + fNewWWWDisplay=FALSE; } else if( fNewWWW ) { - + // no longer a new WWW mode fNewWWW=FALSE; @@ -2846,81 +2847,81 @@ void WWWRegionButtonCallback(GUI_BUTTON *btn,INT32 reason ) // make sure program is maximized if( gLaptopProgramStates[ LAPTOP_PROGRAM_WEB_BROWSER ] == LAPTOP_PROGRAM_OPEN ) { - // re render laptop region - RenderLapTopImage(); + // re render laptop region + RenderLapTopImage(); - // re render background - DrawDeskTopBackground( ); + // re render background + DrawDeskTopBackground( ); } } giCurrentRegion=WWW_REGION; RestoreOldRegion(giOldRegion); if(guiCurrentWWWMode!=LAPTOP_MODE_NONE) - guiCurrentLaptopMode = guiCurrentWWWMode; + guiCurrentLaptopMode = guiCurrentWWWMode; else guiCurrentLaptopMode=LAPTOP_MODE_WWW; UpdateListToReflectNewProgramOpened( LAPTOP_PROGRAM_WEB_BROWSER ); HighLightRegion(giCurrentRegion); fReDrawScreenFlag=TRUE; - } + } } - else if (reason & MSYS_CALLBACK_REASON_RBUTTON_UP) - { + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { if (btn->uiFlags & BUTTON_CLICKED_ON) { btn->uiFlags&=~(BUTTON_CLICKED_ON); // nothing yet - - + + if(giCurrentRegion!=WWW_REGION) - giOldRegion=giCurrentRegion; - + giOldRegion=giCurrentRegion; + giCurrentRegion=WWW_REGION; - + RestoreOldRegion(giOldRegion); - + if(guiCurrentWWWMode!=LAPTOP_MODE_NONE) - guiCurrentLaptopMode = guiCurrentWWWMode; + guiCurrentLaptopMode = guiCurrentWWWMode; else guiCurrentLaptopMode=LAPTOP_MODE_WWW; - + HighLightRegion(giCurrentRegion); - + fReDrawScreenFlag=TRUE; } } - + } void HistoryRegionButtonCallback(GUI_BUTTON *btn,INT32 reason ) -{ +{ if (!(btn->uiFlags & BUTTON_ENABLED)) return; - + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - btn->uiFlags|=(BUTTON_CLICKED_ON); + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); // if not in history, update to the fact if(giCurrentRegion!=HISTORY_REGION) - giOldRegion=giCurrentRegion; + giOldRegion=giCurrentRegion; if(gfShowBookmarks) { // stop showing WWW bookmarks - gfShowBookmarks=FALSE; + gfShowBookmarks=FALSE; } // current region is history giCurrentRegion=HISTORY_REGION; - + // restore old region area RestoreOldRegion(giOldRegion); @@ -2933,38 +2934,38 @@ void HistoryRegionButtonCallback(GUI_BUTTON *btn,INT32 reason ) UpdateListToReflectNewProgramOpened( LAPTOP_PROGRAM_HISTORY ); gfShowBookmarks=FALSE; - + //redraw screen fReDrawScreenFlag=TRUE; - } } - + } + } -void FilesRegionButtonCallback( GUI_BUTTON *btn,INT32 reason ) -{ +void FilesRegionButtonCallback( GUI_BUTTON *btn,INT32 reason ) +{ if (!(btn->uiFlags & BUTTON_ENABLED)) return; - + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - btn->uiFlags|=(BUTTON_CLICKED_ON); + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); // reset old region if(giCurrentRegion!=FILES_REGION) - giOldRegion=giCurrentRegion; - + giOldRegion=giCurrentRegion; + // stop showing WWW bookmarks if(gfShowBookmarks) { - gfShowBookmarks=FALSE; - fReDrawScreenFlag=TRUE; + gfShowBookmarks=FALSE; + fReDrawScreenFlag=TRUE; } // set new region @@ -2975,16 +2976,16 @@ void FilesRegionButtonCallback( GUI_BUTTON *btn,INT32 reason ) // highlight new region HighLightRegion(giCurrentRegion); - + guiCurrentLaptopMode=LAPTOP_MODE_FILES; UpdateListToReflectNewProgramOpened( LAPTOP_PROGRAM_FILES ); - + //redraw screen fReDrawScreenFlag=TRUE; - } } - + } + } @@ -2992,50 +2993,50 @@ void HandleLapTopScreenMouseUi() { if ( gEmailRegion.uiFlags & MSYS_MOUSE_IN_AREA ) { - giHighLightRegion=EMAIL_REGION; + giHighLightRegion=EMAIL_REGION; } else if ( gPersonnelRegion.uiFlags & MSYS_MOUSE_IN_AREA ) { - giHighLightRegion=PERSONNEL_REGION; + giHighLightRegion=PERSONNEL_REGION; } else if ( gFinancialRegion.uiFlags & MSYS_MOUSE_IN_AREA ) { - giHighLightRegion=FINANCIAL_REGION; + giHighLightRegion=FINANCIAL_REGION; } else if ( gWWWRegion.uiFlags & MSYS_MOUSE_IN_AREA ) { - giHighLightRegion=WWW_REGION; + giHighLightRegion=WWW_REGION; } else if ( gFilesRegion.uiFlags & MSYS_MOUSE_IN_AREA ) { - giHighLightRegion=FILES_REGION; + giHighLightRegion=FILES_REGION; } else if ( gHistoryRegion.uiFlags & MSYS_MOUSE_IN_AREA ) { - giHighLightRegion=HISTORY_REGION; + giHighLightRegion=HISTORY_REGION; } else - giHighLightRegion=NO_REGION; + giHighLightRegion=NO_REGION; DrawHighLightRegionBox(); } void DrawHighLightRegionBox() { - + return; } void RestoreOldRegion(INT32 iOldRegion) { - + return; } void HighLightRegion(INT32 iCurrentRegion) { - + return; } @@ -3048,88 +3049,84 @@ void HandleAnimatedButtons() } void AnimateButton( UINT32 uiIconID, UINT16 usX, UINT16 usY ) { - return; + return; } void WWWRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) { static INT32 iBaseTime=0; - static INT32 iFrame=0; - INT32 iDifference=0; - HVOBJECT hLapTopIconHandle; + static INT32 iFrame=0; + HVOBJECT hLapTopIconHandle; if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { iBaseTime=0; iFrame=0; - GetVideoObject(&hLapTopIconHandle, guiWWWICON); - BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, (UINT16)iFrame,LAPTOP_ICONS_X, LAPTOP_ICONS_WWW_Y, VO_BLT_SRCTRANSPARENCY,NULL); - DrawLapTopText(); + GetVideoObject(&hLapTopIconHandle, guiWWWICON); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, (UINT16)iFrame,LAPTOP_ICONS_X, LAPTOP_ICONS_WWW_Y, VO_BLT_SRCTRANSPARENCY,NULL); + DrawLapTopText(); HighLightRegion(giCurrentRegion); InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); - } + } } void EmailRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) { static INT32 iBaseTime=0; - static INT32 iFrame=0; - INT32 iDifference=0; - HVOBJECT hLapTopIconHandle; + static INT32 iFrame=0; + HVOBJECT hLapTopIconHandle; if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { iBaseTime=0; iFrame=0; - DrawLapTopText(); - GetVideoObject(&hLapTopIconHandle, guiMAILICON); - BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, (UINT16)iFrame,LAPTOP_ICONS_X, LAPTOP_ICONS_MAIL_Y, VO_BLT_SRCTRANSPARENCY,NULL); + DrawLapTopText(); + GetVideoObject(&hLapTopIconHandle, guiMAILICON); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, (UINT16)iFrame,LAPTOP_ICONS_X, LAPTOP_ICONS_MAIL_Y, VO_BLT_SRCTRANSPARENCY,NULL); if(fUnReadMailFlag) - { - GetVideoObject(&hLapTopIconHandle, guiUNREAD); - BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,LAPTOP_ICONS_X+CHECK_X, LAPTOP_ICONS_MAIL_Y+CHECK_Y, VO_BLT_SRCTRANSPARENCY,NULL); + { + GetVideoObject(&hLapTopIconHandle, guiUNREAD); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,LAPTOP_ICONS_X+CHECK_X, LAPTOP_ICONS_MAIL_Y+CHECK_Y, VO_BLT_SRCTRANSPARENCY,NULL); } DrawLapTopText(); HighLightRegion(giCurrentRegion); InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); - } + } } void FinancialRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) { static INT32 iBaseTime=0; - static INT32 iFrame=0; - INT32 iDifference=0; - HVOBJECT hLapTopIconHandle; + static INT32 iFrame=0; + HVOBJECT hLapTopIconHandle; if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { iBaseTime=0; iFrame=0; - GetVideoObject(&hLapTopIconHandle, guiFINANCIALICON); - BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, (UINT16)iFrame,LAPTOP_ICONS_X-4, LAPTOP_ICONS_FINANCIAL_Y, VO_BLT_SRCTRANSPARENCY,NULL); - DrawLapTopText(); + GetVideoObject(&hLapTopIconHandle, guiFINANCIALICON); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, (UINT16)iFrame,LAPTOP_ICONS_X-4, LAPTOP_ICONS_FINANCIAL_Y, VO_BLT_SRCTRANSPARENCY,NULL); + DrawLapTopText(); HighLightRegion(giCurrentRegion); InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); - } + } } void HistoryRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) { static INT32 iBaseTime=0; - static INT32 iFrame=0; - INT32 iDifference=0; - HVOBJECT hLapTopIconHandle; + static INT32 iFrame=0; + HVOBJECT hLapTopIconHandle; if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { iBaseTime=0; iFrame=0; - + GetVideoObject(&hLapTopIconHandle, guiHISTORYICON); - BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, (UINT16)iFrame,LAPTOP_ICONS_X, LAPTOP_ICONS_HISTORY_Y, VO_BLT_SRCTRANSPARENCY,NULL); - DrawLapTopText(); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, (UINT16)iFrame,LAPTOP_ICONS_X, LAPTOP_ICONS_HISTORY_Y, VO_BLT_SRCTRANSPARENCY,NULL); + DrawLapTopText(); HighLightRegion(giCurrentRegion); InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); - } + } } @@ -3137,38 +3134,36 @@ void HistoryRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) void FilesRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) { static INT32 iBaseTime=0; - static INT32 iFrame=0; - INT32 iDifference=0; - HVOBJECT hLapTopIconHandle; + static INT32 iFrame=0; + HVOBJECT hLapTopIconHandle; if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { iBaseTime=0; iFrame=0; - GetVideoObject(&hLapTopIconHandle, guiFILESICON); - BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, (UINT16)iFrame,LAPTOP_ICONS_X, LAPTOP_ICONS_FILES_Y+7, VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hLapTopIconHandle, guiFILESICON); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, (UINT16)iFrame,LAPTOP_ICONS_X, LAPTOP_ICONS_FILES_Y+7, VO_BLT_SRCTRANSPARENCY,NULL); DrawLapTopText(); HighLightRegion(giCurrentRegion); InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); - } + } } void PersonnelRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) { static INT32 iBaseTime=0; - static INT32 iFrame=0; - INT32 iDifference=0; - HVOBJECT hLapTopIconHandle; + static INT32 iFrame=0; + HVOBJECT hLapTopIconHandle; if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { iBaseTime=0; iFrame=0; - + GetVideoObject(&hLapTopIconHandle, guiPERSICON); - BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, (UINT16)iFrame,LAPTOP_ICONS_X, LAPTOP_ICONS_PERSONNEL_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, (UINT16)iFrame,LAPTOP_ICONS_X, LAPTOP_ICONS_PERSONNEL_Y, VO_BLT_SRCTRANSPARENCY,NULL); DrawLapTopText(); HighLightRegion(giCurrentRegion); InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); - } + } } @@ -3176,13 +3171,13 @@ void PersonnelRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) void CheckIfMouseLeaveScreen() { - POINT MousePos; - GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! - if((MousePos.x >LAPTOP_SCREEN_LR_X )||(MousePos.xLAPTOP_SCREEN_LR_Y)) - { - guiCurrentLapTopCursor=LAPTOP_PANEL_CURSOR; - } + POINT MousePos; + GetCursorPos(&MousePos); + ScreenToClient(ghWindow, &MousePos); // In window coords! + if((MousePos.x >LAPTOP_SCREEN_LR_X )||(MousePos.xLAPTOP_SCREEN_LR_Y)) + { + guiCurrentLapTopCursor=LAPTOP_PANEL_CURSOR; + } } void ScreenRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) @@ -3195,16 +3190,16 @@ void ScreenRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) { guiCurrentLapTopCursor=LAPTOP_SCREEN_CURSOR; } - if (iReason == MSYS_CALLBACK_REASON_LOST_MOUSE ) + if (iReason == MSYS_CALLBACK_REASON_LOST_MOUSE ) { - CheckIfMouseLeaveScreen(); + CheckIfMouseLeaveScreen(); } */ } void ReDrawHighLight() { - HighLightRegion(giCurrentRegion); + HighLightRegion(giCurrentRegion); return; } @@ -3233,20 +3228,20 @@ void InitBookMarkList() void SetBookMark(INT32 iBookId) { // find first empty spot, set to iBookId - INT32 iCounter=0; - if(iBookId!=-2) + INT32 iCounter=0; + if(iBookId!=-2) { - while(LaptopSaveInfo.iBookMarkList[iCounter]!=-1) - { - // move trhough list until empty - if( LaptopSaveInfo.iBookMarkList[iCounter]==iBookId) - { - // found it, return - return; - } - iCounter++; - } - LaptopSaveInfo.iBookMarkList[iCounter]=iBookId; + while(LaptopSaveInfo.iBookMarkList[iCounter]!=-1) + { + // move trhough list until empty + if( LaptopSaveInfo.iBookMarkList[iCounter]==iBookId) + { + // found it, return + return; + } + iCounter++; + } + LaptopSaveInfo.iBookMarkList[iCounter]=iBookId; } return; } @@ -3254,7 +3249,7 @@ void SetBookMark(INT32 iBookId) BOOLEAN RemoveBookMark( INT32 iBookId ) { - INT32 iCounter=0; + INT32 iCounter=0; //Loop through the bookmarks to get to the desired bookmark while( LaptopSaveInfo.iBookMarkList[iCounter] != iBookId ) @@ -3280,45 +3275,45 @@ BOOLEAN RemoveBookMark( INT32 iBookId ) BOOLEAN LoadBookmark() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; // grab download bars too - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\downloadtop.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiDOWNLOADTOP)); - - + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\downloadmid.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiDOWNLOADMID)); - - + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\downloadbot.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiDOWNLOADBOT)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\bookmarktop.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiBOOKTOP)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\bookmarkmiddle.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiBOOKMID)); - - + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\webpages.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiBOOKMARK)); - - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\hilite.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiBOOKHIGH)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\Bookmarkbottom.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiBOOKBOT)); @@ -3333,10 +3328,10 @@ void DisplayBookMarks( void ) // will look at bookmarklist and set accordingly INT32 iCounter=1; // load images - HVOBJECT hLapTopIconHandle; - // laptop icons + HVOBJECT hLapTopIconHandle; + // laptop icons INT16 sX, sY; - + // check if we are maximizing or minimizing.. if so, do not display if( ( fMaximizingProgram == TRUE ) || ( fMinizingProgram == TRUE ) ) @@ -3353,98 +3348,98 @@ void DisplayBookMarks( void ) // set buffer SetFontDestBuffer(FRAME_BUFFER ,BOOK_X, BOOK_TOP_Y,BOOK_X+BOOK_WIDTH-10,SCREEN_HEIGHT, FALSE); - - + + // blt in book mark background while( LaptopSaveInfo.iBookMarkList[iCounter-1]!=-1) { - - if(iHighLightBookLine==iCounter-1) - { - GetVideoObject(&hLapTopIconHandle, guiBOOKHIGH); - BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,BOOK_X, BOOK_TOP_Y+ ( iCounter*( BOOK_HEIGHT + 6 ) )+ 6, VO_BLT_SRCTRANSPARENCY,NULL); - } - else - { - GetVideoObject(&hLapTopIconHandle, guiBOOKMARK); - BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,BOOK_X, BOOK_TOP_Y+ ( iCounter*( BOOK_HEIGHT + 6 ) )+ 6, VO_BLT_SRCTRANSPARENCY,NULL); - } - if( iHighLightBookLine==iCounter-1 ) - { - // blit in text - SetFontForeground(FONT_WHITE); - SetFontBackground(FONT_BLACK); - } - else - { - // blit in text - SetFontForeground(FONT_BLACK); - SetFontBackground(FONT_BLACK); - } - - FindFontCenterCoordinates(BOOK_X + 3, (UINT16)(BOOK_TOP_Y+2+(iCounter*( BOOK_HEIGHT + 6 ) ) + 6),BOOK_WIDTH - 3,BOOK_HEIGHT+6, pBookMarkStrings[ LaptopSaveInfo.iBookMarkList[iCounter-1] ] , BOOK_FONT, &sX, &sY ); - - mprintf(sX, sY,pBookMarkStrings[ LaptopSaveInfo.iBookMarkList[iCounter-1] ] ); - iCounter++; + if(iHighLightBookLine==iCounter-1) + { + GetVideoObject(&hLapTopIconHandle, guiBOOKHIGH); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,BOOK_X, BOOK_TOP_Y+ ( iCounter*( BOOK_HEIGHT + 6 ) )+ 6, VO_BLT_SRCTRANSPARENCY,NULL); + } + else + { + GetVideoObject(&hLapTopIconHandle, guiBOOKMARK); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,BOOK_X, BOOK_TOP_Y+ ( iCounter*( BOOK_HEIGHT + 6 ) )+ 6, VO_BLT_SRCTRANSPARENCY,NULL); + } + + if( iHighLightBookLine==iCounter-1 ) + { + // blit in text + SetFontForeground(FONT_WHITE); + SetFontBackground(FONT_BLACK); + } + else + { + // blit in text + SetFontForeground(FONT_BLACK); + SetFontBackground(FONT_BLACK); + } + + FindFontCenterCoordinates(BOOK_X + 3, (UINT16)(BOOK_TOP_Y+2+(iCounter*( BOOK_HEIGHT + 6 ) ) + 6),BOOK_WIDTH - 3,BOOK_HEIGHT+6, pBookMarkStrings[ LaptopSaveInfo.iBookMarkList[iCounter-1] ] , BOOK_FONT, &sX, &sY ); + + mprintf(sX, sY,pBookMarkStrings[ LaptopSaveInfo.iBookMarkList[iCounter-1] ] ); + iCounter++; } // blit one more - if(iHighLightBookLine==iCounter-1) - { + if(iHighLightBookLine==iCounter-1) + { GetVideoObject(&hLapTopIconHandle, guiBOOKHIGH); BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,BOOK_X, BOOK_TOP_Y+ ( iCounter*( BOOK_HEIGHT + 6 ) )+ 6, VO_BLT_SRCTRANSPARENCY,NULL); - } - else - { - GetVideoObject(&hLapTopIconHandle, guiBOOKMARK); - BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,BOOK_X, BOOK_TOP_Y+ ( iCounter*( BOOK_HEIGHT + 6 ) )+ 6, VO_BLT_SRCTRANSPARENCY,NULL); - } + } + else + { + GetVideoObject(&hLapTopIconHandle, guiBOOKMARK); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,BOOK_X, BOOK_TOP_Y+ ( iCounter*( BOOK_HEIGHT + 6 ) )+ 6, VO_BLT_SRCTRANSPARENCY,NULL); + } - if( iHighLightBookLine==iCounter-1 ) - { - // blit in text - SetFontForeground(FONT_WHITE); - SetFontBackground(FONT_BLACK); - } - else - { - // blit in text - SetFontForeground(FONT_BLACK); - SetFontBackground(FONT_BLACK); - } - FindFontCenterCoordinates(BOOK_X + 3, (UINT16)(BOOK_TOP_Y+2+(iCounter*( BOOK_HEIGHT + 6 ) ) + 6),BOOK_WIDTH - 3,BOOK_HEIGHT+6,pBookMarkStrings[ CANCEL_STRING ] , BOOK_FONT, &sX, &sY ); - mprintf(sX, sY,pBookMarkStrings[CANCEL_STRING] ); - iCounter++; + if( iHighLightBookLine==iCounter-1 ) + { + // blit in text + SetFontForeground(FONT_WHITE); + SetFontBackground(FONT_BLACK); + } + else + { + // blit in text + SetFontForeground(FONT_BLACK); + SetFontBackground(FONT_BLACK); + } + FindFontCenterCoordinates(BOOK_X + 3, (UINT16)(BOOK_TOP_Y+2+(iCounter*( BOOK_HEIGHT + 6 ) ) + 6),BOOK_WIDTH - 3,BOOK_HEIGHT+6,pBookMarkStrings[ CANCEL_STRING ] , BOOK_FONT, &sX, &sY ); + mprintf(sX, sY,pBookMarkStrings[CANCEL_STRING] ); + iCounter++; + + SetFontDestBuffer(FRAME_BUFFER,0,0,SCREEN_WIDTH, SCREEN_HEIGHT, FALSE); - SetFontDestBuffer(FRAME_BUFFER,0,0,SCREEN_WIDTH, SCREEN_HEIGHT, FALSE); - //GetVideoObject(&hLapTopIconHandle, guiBOOKBOT); //BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,BOOK_X, 6+BOOK_TOP_Y+(iCounter)*BOOK_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); - + /*if(fNewWWWDisplay) - ScrollDisplayText(BOOK_TOP_Y+2+((iCounter)*BOOK_HEIGHT)+6); + ScrollDisplayText(BOOK_TOP_Y+2+((iCounter)*BOOK_HEIGHT)+6); else - */ InvalidateRegion(BOOK_X,BOOK_TOP_Y+((iCounter)*BOOK_HEIGHT)+12, BOOK_X+BOOK_WIDTH, BOOK_TOP_Y+((iCounter+1)*BOOK_HEIGHT)+16); + */ InvalidateRegion(BOOK_X,BOOK_TOP_Y+((iCounter)*BOOK_HEIGHT)+12, BOOK_X+BOOK_WIDTH, BOOK_TOP_Y+((iCounter+1)*BOOK_HEIGHT)+16); SetFontShadow(DEFAULT_SHADOW); - + InvalidateRegion(BOOK_X, BOOK_TOP_Y, BOOK_X+BOOK_WIDTH, BOOK_TOP_Y+(iCounter + 6 )*BOOK_HEIGHT+16); return; } void RemoveBookmark(INT32 iBookId) { - INT32 iCounter=0; + INT32 iCounter=0; if(iBookId==-2) return; while( LaptopSaveInfo.iBookMarkList[iCounter]!=-1) { if( LaptopSaveInfo.iBookMarkList[iCounter]==iBookId) { - // found, move everyone back + // found, move everyone back for(iCounter=iCounter+1; iCounter SCROLL_DIFFERENCE) { - - // reset postion, if scrolled too far - if(sCurX = iLoadTime) { // done loading, redraw screen - fLoadPendingFlag = FALSE; + fLoadPendingFlag = FALSE; fFastLoadFlag = FALSE; iTotalTime=0; iBaseTime=0; @@ -3903,20 +3895,20 @@ BOOLEAN DisplayLoadPending( void ) iDifference=GetJA2Clock()-iBaseTime; - - + + // difference has been long enough or we are redrawing the screen - if( (iDifference) > iUnitTime) - { + if( (iDifference) > iUnitTime) + { // LONG ENOUGH TIME PASSED iCounter=0; iBaseTime=GetJA2Clock(); iTotalTime+=iDifference; - iTempTime=iTotalTime; - + iTempTime=iTotalTime; + } - + // new mail, don't redraw if( fNewMailFlag == TRUE ) { @@ -3930,81 +3922,81 @@ BOOLEAN DisplayLoadPending( void ) // display top middle and bottom of box - GetVideoObject(&hLapTopIconHandle, guiDOWNLOADTOP); + GetVideoObject(&hLapTopIconHandle, guiDOWNLOADTOP); BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,DOWNLOAD_X, DOWNLOAD_Y, VO_BLT_SRCTRANSPARENCY,NULL); - GetVideoObject(&hLapTopIconHandle, guiDOWNLOADMID); - BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,DOWNLOAD_X, DOWNLOAD_Y+DOWN_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); - GetVideoObject(&hLapTopIconHandle, guiDOWNLOADBOT); - BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,DOWNLOAD_X, DOWNLOAD_Y+2*DOWN_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); - GetVideoObject(&hLapTopIconHandle, guiTITLEBARICONS); + GetVideoObject(&hLapTopIconHandle, guiDOWNLOADMID); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,DOWNLOAD_X, DOWNLOAD_Y+DOWN_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hLapTopIconHandle, guiDOWNLOADBOT); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,DOWNLOAD_X, DOWNLOAD_Y+2*DOWN_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hLapTopIconHandle, guiTITLEBARICONS); BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 1,DOWNLOAD_X + 4, DOWNLOAD_Y + 1, VO_BLT_SRCTRANSPARENCY,NULL); - - // font stuff + + // font stuff SetFont(DOWNLOAD_FONT); SetFontForeground(FONT_WHITE); SetFontBackground(FONT_BLACK); - SetFontShadow(NO_SHADOW); + SetFontShadow(NO_SHADOW); // reload or download? if( fFastLoadFlag == TRUE ) - { + { FindFontCenterCoordinates( iScreenWidthOffset + 328, iScreenHeightOffset, 118, 0, pDownloadString[1], DOWNLOAD_FONT, &sXPosition, &sYPosition ); - // display download string + // display download string mprintf( sXPosition, DOWN_STRING_Y,pDownloadString[1]); } - else + else { FindFontCenterCoordinates( iScreenWidthOffset + 328, iScreenHeightOffset, /*iScreenWidthOffset + */118, 0, pDownloadString[ 0 ], DOWNLOAD_FONT, &sXPosition, &sYPosition ); // display download string mprintf( sXPosition, DOWN_STRING_Y,pDownloadString[0]); - } + } // get and blt the window video object GetVideoObject(&hLapTopIconHandle, guiGRAPHWINDOW); BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,LAPTOP_WINDOW_X, LAPTOP_WINDOW_Y, VO_BLT_SRCTRANSPARENCY,NULL); - + // check to see if we are only updating screen, but not passed a new element in the load pending display - - - iTempTime = iTotalTime; + + + iTempTime = iTotalTime; // decide how many time units are to be displayed, based on amount of time passed while(iTempTime >0) { - GetVideoObject(&hLapTopIconHandle, guiGRAPHBAR); - BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,LAPTOP_BAR_X+(UNIT_WIDTH*iCounter), LAPTOP_BAR_Y, VO_BLT_SRCTRANSPARENCY,NULL); - iTempTime-=iUnitTime; - iCounter++; - + GetVideoObject(&hLapTopIconHandle, guiGRAPHBAR); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,LAPTOP_BAR_X+(UNIT_WIDTH*iCounter), LAPTOP_BAR_Y, VO_BLT_SRCTRANSPARENCY,NULL); + iTempTime-=iUnitTime; + iCounter++; + // have we gone too far? if( iCounter > 30 ) { iTempTime = 0; } } - + InvalidateRegion(DOWNLOAD_X, DOWNLOAD_Y, DOWNLOAD_X + 150, DOWNLOAD_Y + 100); // re draw screen and new mail warning box - SetFontShadow(DEFAULT_SHADOW); + SetFontShadow(DEFAULT_SHADOW); - MarkButtonsDirty( ); + MarkButtonsDirty( ); DisableMercSiteButton(); - return (FALSE); + return (FALSE); } void DeleteLoadPending( void ) { // this funtion will delete the load pending graphics // reuse bookmark - DeleteVideoObjectFromIndex(guiGRAPHBAR); - DeleteVideoObjectFromIndex(guiGRAPHWINDOW); + DeleteVideoObjectFromIndex(guiGRAPHBAR); + DeleteVideoObjectFromIndex(guiGRAPHWINDOW); return; } @@ -4016,57 +4008,57 @@ void BtnErrorCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - { + { } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if(btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - fErrorFlag=FALSE; - + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fErrorFlag=FALSE; + } } } void CreateDestroyErrorButton( void ) { - static BOOLEAN fOldErrorFlag=FALSE; + static BOOLEAN fOldErrorFlag=FALSE; if((fErrorFlag)&&(!fOldErrorFlag)) { - // create inventory button - fOldErrorFlag=TRUE; - + // create inventory button + fOldErrorFlag=TRUE; + // load image and create error confirm button giErrorButtonImage[0]=LoadButtonImage( "LAPTOP\\errorbutton.sti" ,-1,0,-1,1,-1 ); - giErrorButton[0]= QuickCreateButton( giErrorButtonImage[0], ERROR_X+ERROR_BTN_X, ERROR_BTN_Y, + giErrorButton[0]= QuickCreateButton( giErrorButtonImage[0], ERROR_X+ERROR_BTN_X, ERROR_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnErrorCallback); - + // define the cursor SetButtonCursor(giErrorButton[0], CURSOR_LAPTOP_SCREEN); - + // define the screen mask MSYS_DefineRegion(&pScreenMask,0, 0,SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST-3,CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, LapTopScreenCallBack); - - // add region - MSYS_AddRegion(&pScreenMask); + + // add region + MSYS_AddRegion(&pScreenMask); } else if((!fErrorFlag)&&(fOldErrorFlag)) { - // done dsiplaying, get rid of button and screen mask - fOldErrorFlag=FALSE; - - RemoveButton( giErrorButton[0] ); - UnloadButtonImage( giErrorButtonImage[0] ); - - MSYS_RemoveRegion(&pScreenMask); + // done dsiplaying, get rid of button and screen mask + fOldErrorFlag=FALSE; + + RemoveButton( giErrorButton[0] ); + UnloadButtonImage( giErrorButtonImage[0] ); + + MSYS_RemoveRegion(&pScreenMask); + + // re draw screen + fReDrawScreenFlag=TRUE; - // re draw screen - fReDrawScreenFlag=TRUE; - } return; } @@ -4075,50 +4067,50 @@ void CreateDestroyErrorButton( void ) void DisplayErrorBox( void ) { // this function will display the error graphic - HVOBJECT hLapTopIconHandle; - if(!fErrorFlag) + HVOBJECT hLapTopIconHandle; + if(!fErrorFlag) return; // get and blt top portion GetVideoObject(&hLapTopIconHandle, guiBOOKTOP); BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,ERROR_X, ERROR_Y, VO_BLT_SRCTRANSPARENCY,NULL); - + // middle * 5 GetVideoObject(&hLapTopIconHandle, guiBOOKMID); - BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,ERROR_X, ERROR_Y+BOOK_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); - + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,ERROR_X, ERROR_Y+BOOK_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hLapTopIconHandle, guiBOOKMID); - BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,ERROR_X, ERROR_Y+2*BOOK_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); - + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,ERROR_X, ERROR_Y+2*BOOK_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hLapTopIconHandle, guiBOOKMID); - BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,ERROR_X, ERROR_Y+3*BOOK_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); - + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,ERROR_X, ERROR_Y+3*BOOK_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hLapTopIconHandle, guiBOOKMID); - BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,ERROR_X, ERROR_Y+4*BOOK_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); - + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,ERROR_X, ERROR_Y+4*BOOK_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hLapTopIconHandle, guiBOOKMID); - BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,ERROR_X, ERROR_Y+5*BOOK_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); - + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,ERROR_X, ERROR_Y+5*BOOK_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + // the bottom GetVideoObject(&hLapTopIconHandle, guiBOOKBOT); BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,ERROR_X, ERROR_Y+6*BOOK_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); - + // font stuff SetFont(ERROR_TITLE_FONT); - SetFontForeground(FONT_WHITE); + SetFontForeground(FONT_WHITE); SetFontBackground(FONT_BLACK); - SetFontShadow(NO_SHADOW); - + SetFontShadow(NO_SHADOW); + // print title mprintf(ERROR_TITLE_X, ERROR_TITLE_Y, pErrorStrings[0]); - SetFontForeground(FONT_BLACK); - SetFont(ERROR_FONT); - + SetFontForeground(FONT_BLACK); + SetFont(ERROR_FONT); + // display error string DisplayWrappedString(ERROR_X+ERROR_TEXT_X,(UINT16)(ERROR_Y+ERROR_TEXT_Y+DisplayWrappedString(ERROR_X+ERROR_TEXT_X, ERROR_Y+ERROR_TEXT_Y, BOOK_WIDTH, 2,ERROR_FONT,FONT_BLACK, pErrorStrings[1],FONT_BLACK,FALSE,CENTER_JUSTIFIED)), BOOK_WIDTH, 2,ERROR_FONT,FONT_BLACK, pErrorStrings[2],FONT_BLACK,FALSE,CENTER_JUSTIFIED); SetFontShadow(DEFAULT_SHADOW); - + return; } @@ -4126,18 +4118,18 @@ void DisplayErrorBox( void ) void DrawTextOnErrorButton() { // draws text on error button - SetFont(ERROR_TITLE_FONT); - SetFontForeground(FONT_BLACK); + SetFont(ERROR_TITLE_FONT); + SetFontForeground(FONT_BLACK); SetFontBackground(FONT_BLACK); - SetFontShadow(NO_SHADOW); + SetFontShadow(NO_SHADOW); mprintf(ERROR_X+ERROR_BTN_X+ERROR_BTN_TEXT_X, ERROR_BTN_Y+ERROR_BTN_TEXT_Y, pErrorStrings[3]); SetFontShadow(DEFAULT_SHADOW); - + InvalidateRegion(ERROR_X, ERROR_Y, ERROR_X+BOOK_WIDTH, ERROR_Y+6*BOOK_HEIGHT); return; } -// This function is called every time the laptop is FIRST initialized, ie whenever the laptop is loaded. It calls +// This function is called every time the laptop is FIRST initialized, ie whenever the laptop is loaded. It calls // various init function in the laptop pages that need to be inited when the laptop is just loaded. void EnterLaptopInitLaptopPages() { @@ -4158,29 +4150,29 @@ void EnterLaptopInitLaptopPages() void CheckMarkButtonsDirtyFlag( void ) { - // this function checks the fMarkButtonsDirtyFlag, if true, mark buttons dirty + // this function checks the fMarkButtonsDirtyFlag, if true, mark buttons dirty if( fMarkButtonsDirtyFlag ) { - // flag set, mark buttons and reset + // flag set, mark buttons and reset MarkButtonsDirty( ); fMarkButtonsDirtyFlag = FALSE; } - return; + return; } void PostButtonRendering( void ) { - // this function is in place to allow for post button rendering + // this function is in place to allow for post button rendering switch( guiCurrentLaptopMode ) - { - case LAPTOP_MODE_AIM: -// RenderCharProfilePostButton( ); + { + case LAPTOP_MODE_AIM: +// RenderCharProfilePostButton( ); break; - case LAPTOP_MODE_AIM_MEMBERS: + case LAPTOP_MODE_AIM_MEMBERS: RenderAIMMembersTopLevel(); break; @@ -4190,7 +4182,7 @@ void PostButtonRendering( void ) void ShouldNewMailBeDisplayed() { - + BOOLEAN fReDraw=FALSE; switch( guiCurrentLaptopMode ) { @@ -4203,7 +4195,7 @@ void ShouldNewMailBeDisplayed() { RenderLapTopImage(); HighLightRegion(giCurrentRegion); - RenderLaptop(); + RenderLaptop(); } */ } @@ -4211,9 +4203,9 @@ void ShouldNewMailBeDisplayed() void DisplayPlayersBalanceToDate( void ) { - // print players balance to date - CHAR16 sString[ 100 ]; - INT16 sX, sY; + // print players balance to date + CHAR16 sString[ 100 ]; + INT16 sX, sY; // initialize string memset( sString, 0, sizeof( sString ) ); @@ -4221,7 +4213,7 @@ void DisplayPlayersBalanceToDate( void ) // font stuff SetFont( FONT10ARIAL); SetFontForeground( 142 ); - SetFontShadow(NO_SHADOW); + SetFontShadow(NO_SHADOW); // parse straigth number swprintf( sString, L"%d", LaptopSaveInfo.iCurrentBalance ); @@ -4229,7 +4221,7 @@ void DisplayPlayersBalanceToDate( void ) // put in commas, then dollar sign InsertCommasForDollarFigure( sString ); InsertDollarSignInToString( sString ); - + // get center FindFontCenterCoordinates( (INT16)LAPTOP_ICON_TEXT_X, iScreenHeightOffset, (INT16)(LAPTOP_ICON_TEXT_WIDTH) ,(INT16)(LAPTOP_ICON_TEXT_HEIGHT), sString, LAPTOPICONFONT, &sX, &sY ); @@ -4245,7 +4237,7 @@ void DisplayPlayersBalanceToDate( void ) } // reset shadow - SetFontShadow(DEFAULT_SHADOW); + SetFontShadow(DEFAULT_SHADOW); return; } @@ -4253,15 +4245,15 @@ void DisplayPlayersBalanceToDate( void ) void CheckIfNewWWWW( void ) { - // if no www mode, set new www flag..until new www mode that is not 0 + // if no www mode, set new www flag..until new www mode that is not 0 if( guiCurrentWWWMode == LAPTOP_MODE_NONE ) { - fNewWWW = TRUE; + fNewWWW = TRUE; } else { - fNewWWW = FALSE; + fNewWWW = FALSE; } return; @@ -4272,38 +4264,38 @@ void HandleLapTopESCKey( void ) { // will handle esc key events, since handling depends on state of laptop - + if( fNewMailFlag ) { // get rid of new mail warning box - fNewMailFlag=FALSE; - CreateDestroyNewMailButton(); - + fNewMailFlag=FALSE; + CreateDestroyNewMailButton(); + // force redraw - fReDrawScreenFlag = TRUE; - RenderLaptop( ); + fReDrawScreenFlag = TRUE; + RenderLaptop( ); } else if(fDeleteMailFlag) { - // get rid of delete mail box - fDeleteMailFlag=FALSE; - CreateDestroyDeleteNoticeMailButton(); + // get rid of delete mail box + fDeleteMailFlag=FALSE; + CreateDestroyDeleteNoticeMailButton(); // force redraw - fReDrawScreenFlag = TRUE; - RenderLaptop( ); + fReDrawScreenFlag = TRUE; + RenderLaptop( ); } else if( fErrorFlag ) { // get rid of error warning box - fErrorFlag=FALSE; - CreateDestroyErrorButton(); + fErrorFlag=FALSE; + CreateDestroyErrorButton(); // force redraw - fReDrawScreenFlag = TRUE; - RenderLaptop( ); - } + fReDrawScreenFlag = TRUE; + RenderLaptop( ); + } else if( gfShowBookmarks ) { @@ -4311,18 +4303,18 @@ void HandleLapTopESCKey( void ) gfShowBookmarks = FALSE; // force redraw - fReDrawScreenFlag = TRUE; + fReDrawScreenFlag = TRUE; RenderLapTopImage( ); - RenderLaptop( ); + RenderLaptop( ); } else { - // leave + // leave fExitingLaptopFlag = TRUE; HandleExit( ); } - + return; } @@ -4335,33 +4327,33 @@ void HandleRightButtonUpEvent( void ) if( fNewMailFlag ) { // get rid of new mail warning box - fNewMailFlag=FALSE; - CreateDestroyNewMailButton(); - + fNewMailFlag=FALSE; + CreateDestroyNewMailButton(); + // force redraw - fReDrawScreenFlag = TRUE; - RenderLaptop( ); + fReDrawScreenFlag = TRUE; + RenderLaptop( ); } else if(fDeleteMailFlag) { - // get rid of delete mail box - fDeleteMailFlag=FALSE; - CreateDestroyDeleteNoticeMailButton(); + // get rid of delete mail box + fDeleteMailFlag=FALSE; + CreateDestroyDeleteNoticeMailButton(); // force redraw - fReDrawScreenFlag = TRUE; - RenderLaptop( ); + fReDrawScreenFlag = TRUE; + RenderLaptop( ); } else if( fErrorFlag ) { // get rid of error warning box - fErrorFlag=FALSE; - CreateDestroyErrorButton(); + fErrorFlag=FALSE; + CreateDestroyErrorButton(); // force redraw - fReDrawScreenFlag = TRUE; - RenderLaptop( ); - } + fReDrawScreenFlag = TRUE; + RenderLaptop( ); + } else if( gfShowBookmarks ) { @@ -4369,18 +4361,18 @@ void HandleRightButtonUpEvent( void ) gfShowBookmarks = FALSE; // force redraw - fReDrawScreenFlag = TRUE; + fReDrawScreenFlag = TRUE; RenderLapTopImage( ); - RenderLaptop( ); + RenderLaptop( ); } else if( fDisplayMessageFlag ) { fDisplayMessageFlag = FALSE; // force redraw - fReDrawScreenFlag = TRUE; + fReDrawScreenFlag = TRUE; RenderLapTopImage( ); - RenderLaptop( ); + RenderLaptop( ); } else if( fShowBookmarkInfo ) @@ -4402,9 +4394,9 @@ void HandleLeftButtonUpEvent( void ) gfShowBookmarks = FALSE; // force redraw - fReDrawScreenFlag = TRUE; + fReDrawScreenFlag = TRUE; RenderLapTopImage( ); - RenderLaptop( ); + RenderLaptop( ); } else if( fShowBookmarkInfo ) { @@ -4413,42 +4405,42 @@ void HandleLeftButtonUpEvent( void ) } void LapTopScreenCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ - - if (iReason & MSYS_CALLBACK_REASON_INIT) - { +{ + + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + + return; + } - return; - } - if( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { HandleLeftButtonUpEvent( ); return; } - if(iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) - { - HandleRightButtonUpEvent( ); + if(iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + HandleRightButtonUpEvent( ); return; - } + } return; } BOOLEAN DoLapTopMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT8 ubFlags, MSGBOX_CALLBACK ReturnCallback ) { - SGPRect pCenteringRect= {LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_UL_Y, LAPTOP_SCREEN_LR_X, LAPTOP_SCREEN_LR_Y }; + SGPRect pCenteringRect= {LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_UL_Y, LAPTOP_SCREEN_LR_X, LAPTOP_SCREEN_LR_Y }; + - // reset exit mode fExitDueToMessageBox = TRUE; - + // do message box and return - iLaptopMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT8 ) ( ubFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, &pCenteringRect ); + iLaptopMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT8 ) ( ubFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, &pCenteringRect ); + - // send back return state return( ( iLaptopMessageBox != -1 ) ); @@ -4461,7 +4453,7 @@ BOOLEAN DoLapTopSystemMessageBoxWithRect( UINT8 ubStyle, STR16 zString, UINT32 u fExitDueToMessageBox = TRUE; // do message box and return - iLaptopMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT16 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, pCenteringRect ); + iLaptopMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT16 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, pCenteringRect ); // send back return state return( ( iLaptopMessageBox != -1 ) ); @@ -4477,7 +4469,7 @@ BOOLEAN DoLapTopSystemMessageBox( UINT8 ubStyle, STR16 zString, UINT32 uiExitScr fExitDueToMessageBox = TRUE; // do message box and return - iLaptopMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT16 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, &CenteringRect ); + iLaptopMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT16 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, &CenteringRect ); // send back return state return( ( iLaptopMessageBox != -1 ) ); @@ -4488,7 +4480,7 @@ BOOLEAN DoLapTopSystemMessageBox( UINT8 ubStyle, STR16 zString, UINT32 uiExitScr //places a tileable pattern down BOOLEAN WebPageTileBackground(UINT8 ubNumX, UINT8 ubNumY, UINT16 usWidth, UINT16 usHeight, UINT32 uiBackgroundIdentifier) { - HVOBJECT hBackGroundHandle; + HVOBJECT hBackGroundHandle; UINT16 x,y, uiPosX, uiPosY; // Blt the Wood background @@ -4500,7 +4492,7 @@ BOOLEAN WebPageTileBackground(UINT8 ubNumX, UINT8 ubNumY, UINT16 usWidth, UINT16 uiPosX = LAPTOP_SCREEN_UL_X; for(x=0; x HD_FLICKER_TIME ) && ( fLoadPendingFlag == FALSE ) ) { iBaseTime = GetJA2Clock( ); @@ -4919,7 +4911,7 @@ void FlickerHDLight( void ) iBaseTime = 0; iTotalDifference = 0; fFlickerHD = FALSE; - InvalidateRegion(iScreenWidthOffset + 88, iScreenHeightOffset + 466, + InvalidateRegion(iScreenWidthOffset + 88, iScreenHeightOffset + 466, iScreenWidthOffset + 102, iScreenHeightOffset + 477 ); return; } @@ -4927,24 +4919,24 @@ void FlickerHDLight( void ) if( iDifference > FLICKER_TIME ) { iTotalDifference += iDifference; - + if( fLoadPendingFlag == TRUE ) { iTotalDifference = 0; } - + if( ( Random( 2 ) ) == 0 ) { - fHardDriveLightOn = TRUE; + fHardDriveLightOn = TRUE; } - else + else { - fHardDriveLightOn = FALSE; + fHardDriveLightOn = FALSE; } InvalidateRegion(iScreenWidthOffset + 88, iScreenHeightOffset + 466, iScreenWidthOffset + 102, iScreenHeightOffset + 477 ); } - + return; } @@ -4965,9 +4957,9 @@ BOOLEAN ExitLaptopDone( void ) fPowerLightOn = FALSE; - - InvalidateRegion(iScreenWidthOffset + 44, iScreenHeightOffset + 466, - iScreenWidthOffset + 58, iScreenHeightOffset + 477 ); + + InvalidateRegion(iScreenWidthOffset + 44, iScreenHeightOffset + 466, + iScreenWidthOffset + 58, iScreenHeightOffset + 477 ); // get the current difference iDifference = GetJA2Clock( ) - iBaseTime; @@ -4990,7 +4982,7 @@ BOOLEAN ExitLaptopDone( void ) void CreateDestroyMinimizeButtonForCurrentMode( void ) { // will create the minimize button - + static BOOLEAN fAlreadyCreated = FALSE; // check to see if created, if so, do nothing @@ -5023,7 +5015,7 @@ void CreateDestroyMinimizeButtonForCurrentMode( void ) CreateMinimizeButtonForCurrentMode( ); CreateMinimizeRegionsForLaptopProgramIcons( ); } - else if( ( fAlreadyCreated == TRUE ) && ( fCreateMinimizeButton == FALSE ) ) + else if( ( fAlreadyCreated == TRUE ) && ( fCreateMinimizeButton == FALSE ) ) { // created and must be destroyed fAlreadyCreated = FALSE; @@ -5043,11 +5035,11 @@ void CreateDestroyMinimizeButtonForCurrentMode( void ) void CreateMinimizeButtonForCurrentMode( void ) { // create minimize button - gLaptopMinButtonImage[0]= LoadButtonImage( "LAPTOP\\x.sti" ,-1,0,-1,1,-1 ); - gLaptopMinButton[0] = QuickCreateButton( gLaptopMinButtonImage[0], iScreenWidthOffset + 590, iScreenHeightOffset + 30, + gLaptopMinButtonImage[0]= LoadButtonImage( "LAPTOP\\x.sti" ,-1,0,-1,1,-1 ); + gLaptopMinButton[0] = QuickCreateButton( gLaptopMinButtonImage[0], iScreenWidthOffset + 590, iScreenHeightOffset + 30, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)LaptopMinimizeProgramButtonCallback); - + SetButtonCursor(gLaptopMinButton[0], CURSOR_LAPTOP_SCREEN); return; } @@ -5055,7 +5047,7 @@ void CreateMinimizeButtonForCurrentMode( void ) void DestroyMinimizeButtonForCurrentMode( void ) { // destroy minimize button - RemoveButton( gLaptopMinButton[ 0 ] ); + RemoveButton( gLaptopMinButton[ 0 ] ); UnloadButtonImage( gLaptopMinButtonImage[ 0 ] ); } @@ -5064,63 +5056,63 @@ void DestroyMinimizeButtonForCurrentMode( void ) void LaptopMinimizeProgramButtonCallback(GUI_BUTTON *btn,INT32 reason) { if (!(btn->uiFlags & BUTTON_ENABLED)) - return; + return; if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) { - btn->uiFlags|=(BUTTON_CLICKED_ON); - } + btn->uiFlags|=(BUTTON_CLICKED_ON); + } } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); switch( guiCurrentLaptopMode ) { - case( LAPTOP_MODE_EMAIL ): + case( LAPTOP_MODE_EMAIL ): gLaptopProgramStates[ LAPTOP_PROGRAM_MAILER ] = LAPTOP_PROGRAM_MINIMIZED; - InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[ 0 ], guiTITLEBARICONS, 0 ); - SetCurrentToLastProgramOpened( ); + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[ 0 ], guiTITLEBARICONS, 0 ); + SetCurrentToLastProgramOpened( ); fMinizingProgram = TRUE; fInitTitle = TRUE; break; case( LAPTOP_MODE_FILES ): gLaptopProgramStates[ LAPTOP_PROGRAM_FILES ] = LAPTOP_PROGRAM_MINIMIZED; - InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[5], guiTITLEBARICONS, 2 ); - SetCurrentToLastProgramOpened( ); + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[5], guiTITLEBARICONS, 2 ); + SetCurrentToLastProgramOpened( ); fMinizingProgram = TRUE; fInitTitle = TRUE; break; case( LAPTOP_MODE_FINANCES ): gLaptopProgramStates[ LAPTOP_PROGRAM_FINANCES ] = LAPTOP_PROGRAM_MINIMIZED; - InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[ 2 ], guiTITLEBARICONS, 5 ); + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[ 2 ], guiTITLEBARICONS, 5 ); SetCurrentToLastProgramOpened( ); fMinizingProgram = TRUE; fInitTitle = TRUE; break; case( LAPTOP_MODE_HISTORY ): gLaptopProgramStates[ LAPTOP_PROGRAM_HISTORY ] = LAPTOP_PROGRAM_MINIMIZED; - InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[4], guiTITLEBARICONS, 4 ); + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[4], guiTITLEBARICONS, 4 ); SetCurrentToLastProgramOpened( ); fMinizingProgram = TRUE; fInitTitle = TRUE; break; case( LAPTOP_MODE_PERSONNEL ): gLaptopProgramStates[ LAPTOP_PROGRAM_PERSONNEL ] = LAPTOP_PROGRAM_MINIMIZED; - InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[3], guiTITLEBARICONS, 3 ); + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[3], guiTITLEBARICONS, 3 ); SetCurrentToLastProgramOpened( ); fMinizingProgram = TRUE; fInitTitle = TRUE; break; case( LAPTOP_MODE_NONE ): - // nothing + // nothing break; default: gLaptopProgramStates[ LAPTOP_PROGRAM_WEB_BROWSER ] = LAPTOP_PROGRAM_MINIMIZED; - InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[ 7 ], guiTITLEBARICONS, 1 ); + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[ 7 ], guiTITLEBARICONS, 1 ); SetCurrentToLastProgramOpened( ); gfShowBookmarks = FALSE; fMinizingProgram = TRUE; @@ -5129,7 +5121,7 @@ void LaptopMinimizeProgramButtonCallback(GUI_BUTTON *btn,INT32 reason) } } } -} +} INT32 FindLastProgramStillOpen( void ) { @@ -5156,7 +5148,7 @@ INT32 FindLastProgramStillOpen( void ) void UpdateListToReflectNewProgramOpened( INT32 iOpenedProgram ) { INT32 iCounter = 0; - + // will update queue of opened programs to show thier states // set iOpenedProgram to 1, and update others @@ -5196,7 +5188,7 @@ void SetCurrentToLastProgramOpened( void ) guiCurrentLaptopMode = LAPTOP_MODE_HISTORY; break; case( LAPTOP_PROGRAM_MAILER ): - guiCurrentLaptopMode = LAPTOP_MODE_EMAIL; + guiCurrentLaptopMode = LAPTOP_MODE_EMAIL; break; case( LAPTOP_PROGRAM_PERSONNEL ): guiCurrentLaptopMode = LAPTOP_MODE_PERSONNEL; @@ -5211,7 +5203,7 @@ void SetCurrentToLastProgramOpened( void ) // last www mode if( guiCurrentWWWMode != 0 ) { - guiCurrentLaptopMode = guiCurrentWWWMode; + guiCurrentLaptopMode = guiCurrentWWWMode; } else { @@ -5236,31 +5228,31 @@ void BlitTitleBarIcons( void ) { case( LAPTOP_MODE_HISTORY ): GetVideoObject(&hHandle, guiTITLEBARICONS); - BltVideoObject(FRAME_BUFFER, hHandle, 4,LAPTOP_TITLE_ICONS_X, LAPTOP_TITLE_ICONS_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 4,LAPTOP_TITLE_ICONS_X, LAPTOP_TITLE_ICONS_Y, VO_BLT_SRCTRANSPARENCY,NULL); break; case( LAPTOP_MODE_EMAIL ): - GetVideoObject(&hHandle, guiTITLEBARICONS); - BltVideoObject(FRAME_BUFFER, hHandle, 0,LAPTOP_TITLE_ICONS_X, LAPTOP_TITLE_ICONS_Y, VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hHandle, guiTITLEBARICONS); + BltVideoObject(FRAME_BUFFER, hHandle, 0,LAPTOP_TITLE_ICONS_X, LAPTOP_TITLE_ICONS_Y, VO_BLT_SRCTRANSPARENCY,NULL); break; case( LAPTOP_MODE_PERSONNEL ): - GetVideoObject(&hHandle, guiTITLEBARICONS); - BltVideoObject(FRAME_BUFFER, hHandle, 3,LAPTOP_TITLE_ICONS_X, LAPTOP_TITLE_ICONS_Y, VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hHandle, guiTITLEBARICONS); + BltVideoObject(FRAME_BUFFER, hHandle, 3,LAPTOP_TITLE_ICONS_X, LAPTOP_TITLE_ICONS_Y, VO_BLT_SRCTRANSPARENCY,NULL); break; case( LAPTOP_MODE_FINANCES ): - GetVideoObject(&hHandle, guiTITLEBARICONS); - BltVideoObject(FRAME_BUFFER, hHandle, 5,LAPTOP_TITLE_ICONS_X, LAPTOP_TITLE_ICONS_Y, VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hHandle, guiTITLEBARICONS); + BltVideoObject(FRAME_BUFFER, hHandle, 5,LAPTOP_TITLE_ICONS_X, LAPTOP_TITLE_ICONS_Y, VO_BLT_SRCTRANSPARENCY,NULL); break; case( LAPTOP_MODE_FILES ): - GetVideoObject(&hHandle, guiTITLEBARICONS); - BltVideoObject(FRAME_BUFFER, hHandle, 2,LAPTOP_TITLE_ICONS_X, LAPTOP_TITLE_ICONS_Y, VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hHandle, guiTITLEBARICONS); + BltVideoObject(FRAME_BUFFER, hHandle, 2,LAPTOP_TITLE_ICONS_X, LAPTOP_TITLE_ICONS_Y, VO_BLT_SRCTRANSPARENCY,NULL); break; case( LAPTOP_MODE_NONE ): - // do nothing + // do nothing break; default: // www pages GetVideoObject(&hHandle, guiTITLEBARICONS); - BltVideoObject(FRAME_BUFFER, hHandle, 1,LAPTOP_TITLE_ICONS_X, LAPTOP_TITLE_ICONS_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 1,LAPTOP_TITLE_ICONS_X, LAPTOP_TITLE_ICONS_Y, VO_BLT_SRCTRANSPARENCY,NULL); break; } @@ -5270,34 +5262,34 @@ void BlitTitleBarIcons( void ) BOOLEAN DrawDeskTopBackground( void ) { HVSURFACE hSrcVSurface; - UINT32 uiDestPitchBYTES; + UINT32 uiDestPitchBYTES; UINT32 uiSrcPitchBYTES; - UINT16 *pDestBuf; - UINT8 *pSrcBuf; + UINT16 *pDestBuf; + UINT8 *pSrcBuf; SGPRect clip; - // set clipping region - // WANNE: If i change this values to SCREEN_WIDTH, ... than an exception is thrown in the vobject_blitters.cpp) - // -> no changes to clip structure - clip.iLeft = 0; - clip.iRight = 506; - clip.iTop = 0; - clip.iBottom = 427; + // set clipping region + // WANNE: If i change this values to SCREEN_WIDTH, ... than an exception is thrown in the vobject_blitters.cpp) + //->no changes to clip structure + clip.iLeft = 0; + clip.iRight = 506; + clip.iTop = 0; + clip.iBottom = 427; // get surfaces pDestBuf = (UINT16*)LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES); CHECKF( GetVideoSurface( &hSrcVSurface, guiDESKTOP) ); pSrcBuf = LockVideoSurface( guiDESKTOP, &uiSrcPitchBYTES); - - + + // blit .pcx for the background onto desktop - Blt8BPPDataSubTo16BPPBuffer( pDestBuf, uiDestPitchBYTES, hSrcVSurface, pSrcBuf,uiSrcPitchBYTES, LAPTOP_SCREEN_UL_X - 2, LAPTOP_SCREEN_UL_Y - 3, &clip); + Blt8BPPDataSubTo16BPPBuffer( pDestBuf, uiDestPitchBYTES, hSrcVSurface, pSrcBuf,uiSrcPitchBYTES, LAPTOP_SCREEN_UL_X - 2, LAPTOP_SCREEN_UL_Y - 3, &clip); // release surfaces UnLockVideoSurface( guiDESKTOP ); - UnLockVideoSurface( FRAME_BUFFER ); + UnLockVideoSurface( FRAME_BUFFER ); return ( TRUE ); } @@ -5308,9 +5300,9 @@ BOOLEAN LoadDesktopBackground( void ) // load desktop background VSURFACE_DESC vs_desc; - vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; + vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; GetMLGFilename( vs_desc.ImageFile, MLG_DESKTOP ); - CHECKF(AddVideoSurface(&vs_desc, &guiDESKTOP)); + CHECKF(AddVideoSurface(&vs_desc, &guiDESKTOP)); return( TRUE ); @@ -5327,7 +5319,7 @@ void DeleteDesktopBackground( void ) void PrintBalance( void ) { - CHAR16 pString[ 32 ]; + CHAR16 pString[ 32 ]; // UINT16 usX, usY; SetFont( FONT10ARIAL ); @@ -5338,7 +5330,7 @@ void PrintBalance( void ) swprintf(pString, L"%d", LaptopSaveInfo.iCurrentBalance); InsertCommasForDollarFigure( pString ); InsertDollarSignInToString( pString ); - + if( ButtonList[ gLaptopButton[ 5 ] ]->uiFlags & BUTTON_CLICKED_ON ) { mprintf(iScreenWidthOffset + 48, iScreenHeightOffset + 273,pString); @@ -5355,9 +5347,9 @@ void PrintBalance( void ) void PrintNumberOnTeam( void ) { - CHAR16 pString[ 32 ]; + CHAR16 pString[ 32 ]; SOLDIERTYPE *pSoldier, *pTeamSoldier; - INT32 cnt=0; + INT32 cnt=0; INT32 iCounter=0; UINT16 usPosX, usPosY, usFontHeight, usStrLength; @@ -5368,15 +5360,15 @@ void PrintNumberOnTeam( void ) SetFontShadow( NO_SHADOW ); // grab number on team - pSoldier = MercPtrs[0]; - + pSoldier = MercPtrs[0]; + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++, pTeamSoldier++) { pTeamSoldier = MercPtrs[ cnt ]; - if( ( pTeamSoldier->bActive)&&( !( pTeamSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) ) + if( ( pTeamSoldier->bActive)&&( !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) ) { - iCounter++; + iCounter++; } } @@ -5398,7 +5390,7 @@ void PrintNumberOnTeam( void ) } mprintf( usPosX, usPosY, pString); - + SetFontShadow( DEFAULT_SHADOW ); } @@ -5427,7 +5419,7 @@ void DisplayTaskBarIcons() if( fNewFilesInFileViewer ) { //display the files icon, if there is any - BltVideoObject(FRAME_BUFFER, hPixHandle, 7,LAPTOP__NEW_FILE_ICON_X, LAPTOP__NEW_FILE_ICON_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 7,LAPTOP__NEW_FILE_ICON_X, LAPTOP__NEW_FILE_ICON_Y, VO_BLT_SRCTRANSPARENCY,NULL); } //display the email icon, if there is email @@ -5451,7 +5443,7 @@ void HandleKeyBoardShortCutsForLapTop( UINT16 usEvent, UINT32 usParam, UINT16 us if ( (usEvent == KEY_DOWN ) && (usParam == ESC ) ) { // esc hit, check to see if boomark list is shown, if so, get rid of it, otherwise, leave - HandleLapTopESCKey( ); + HandleLapTopESCKey( ); } else if( (usEvent == KEY_DOWN ) && ( usParam == TAB ) ) { @@ -5470,7 +5462,7 @@ void HandleKeyBoardShortCutsForLapTop( UINT16 usEvent, UINT32 usParam, UINT16 us #ifdef JA2TESTVERSION else if ((usEvent == KEY_DOWN )&& ( usParam == 'm' ) ) - { + { if( ( usKeyState & ALT_DOWN ) ) { CheatToGetAll5Merc(); @@ -5492,12 +5484,12 @@ void HandleKeyBoardShortCutsForLapTop( UINT16 usEvent, UINT32 usParam, UINT16 us } else if ((usEvent == KEY_DOWN )&& ( usParam == 'x' ) ) - { + { if( ( usKeyState & ALT_DOWN ) ) { - HandleShortCutExitState( ); + HandleShortCutExitState( ); } - //LeaveLapTopScreen( ); + //LeaveLapTopScreen( ); } #ifdef JA2TESTVERSION else if ((usEvent == KEY_DOWN )&& ( usParam == 'q' )) @@ -5513,7 +5505,7 @@ void HandleKeyBoardShortCutsForLapTop( UINT16 usEvent, UINT32 usParam, UINT16 us fExitingLaptopFlag = TRUE; } else if ((usEvent == KEY_DOWN )&& ( usParam == 's' )) - { + { if( ( usKeyState & ALT_DOWN ) ) { SetBookMark( AIM_BOOKMARK ); @@ -5527,7 +5519,7 @@ void HandleKeyBoardShortCutsForLapTop( UINT16 usEvent, UINT32 usParam, UINT16 us } //help screen stuff - else + else #endif if( (usEvent == KEY_DOWN ) && ( ( usParam == 'h' ) || ( usParam == 'H' ) ) ) { @@ -5579,7 +5571,7 @@ void HandleKeyBoardShortCutsForLapTop( UINT16 usEvent, UINT32 usParam, UINT16 us #ifdef JA2TESTVERSION else if ((usEvent == KEY_DOWN )&& ( usParam == 'd' )) - { + { if( gfTemporaryDisablingOfLoadPendingFlag ) gfTemporaryDisablingOfLoadPendingFlag = FALSE; else @@ -5621,8 +5613,8 @@ void HandleKeyBoardShortCutsForLapTop( UINT16 usEvent, UINT32 usParam, UINT16 us else if( usEvent == KEY_DOWN && usParam == 'v' && usKeyState & CTRL_DOWN ) { #ifdef SGP_VIDEO_DEBUGGING - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"VObjects: %d", guiVObjectSize ); - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"VSurfaces: %d", guiVSurfaceSize ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"VObjects: %d", guiVObjectSize ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"VSurfaces: %d", guiVSurfaceSize ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"SGPVideoDump.txt updated..." ); PerformVideoInfoDumpIntoFile( "SGPVideoDump.txt", TRUE ); #endif @@ -5688,21 +5680,21 @@ void HandleKeyBoardShortCutsForLapTop( UINT16 usEvent, UINT32 usParam, UINT16 us BOOLEAN RenderWWWProgramTitleBar( void ) { // will render the title bar for the www program - UINT32 uiTITLEFORWWW; + UINT32 uiTITLEFORWWW; HVOBJECT hHandle; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; INT32 iIndex = 0; CHAR16 sString[256]; - // title bar - load - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + // title bar - load + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\programtitlebar.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &uiTITLEFORWWW)); // blit title - GetVideoObject(&hHandle, uiTITLEFORWWW); - BltVideoObject( FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_UL_Y - 2, VO_BLT_SRCTRANSPARENCY,NULL ); - + GetVideoObject(&hHandle, uiTITLEFORWWW); + BltVideoObject( FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_UL_Y - 2, VO_BLT_SRCTRANSPARENCY,NULL ); + // now delete DeleteVideoObjectFromIndex( uiTITLEFORWWW ); @@ -5712,31 +5704,31 @@ BOOLEAN RenderWWWProgramTitleBar( void ) SetFontForeground( FONT_WHITE ); SetFontBackground( FONT_BLACK ); - // display title + // display title // no page loaded yet, do not handle yet if( guiCurrentLaptopMode == LAPTOP_MODE_WWW ) { - mprintf(iScreenWidthOffset + 140 , iScreenHeightOffset + 33 ,pWebTitle[0]); + mprintf(iScreenWidthOffset + 140 , iScreenHeightOffset + 33 ,pWebTitle[0]); } - + else { iIndex = guiCurrentLaptopMode - LAPTOP_MODE_WWW-1; - swprintf( sString, L"%s - %s", pWebTitle[0], pWebPagesTitles[ iIndex ] ); + swprintf( sString, L"%s - %s", pWebTitle[0], pWebPagesTitles[ iIndex ] ); mprintf(iScreenWidthOffset + 140 ,iScreenHeightOffset + 33 ,sString); } - - + + BlitTitleBarIcons( ); DisplayProgramBoundingBox( FALSE ); - + //InvalidateRegion( 0, 0, 640, 480 ); return( TRUE ); } @@ -5748,10 +5740,10 @@ void HandleDefaultWebpageForLaptop( void ) // go to first page in bookmark list if( guiCurrentLaptopMode == LAPTOP_MODE_WWW ) { - // if valid entry go there + // if valid entry go there if( LaptopSaveInfo.iBookMarkList[ 0 ] != -1 ) { - GoToWebPage( LaptopSaveInfo.iBookMarkList[ 0 ] ); + GoToWebPage( LaptopSaveInfo.iBookMarkList[ 0 ] ); } } @@ -5763,8 +5755,8 @@ void CreateMinimizeRegionsForLaptopProgramIcons( void ) { // will create the minizing region to lie over the icon for this particular laptop program - MSYS_DefineRegion( &gLapTopProgramMinIcon,LAPTOP_PROGRAM_ICON_X, LAPTOP_PROGRAM_ICON_Y ,LAPTOP_PROGRAM_ICON_X + LAPTOP_PROGRAM_ICON_WIDTH ,LAPTOP_PROGRAM_ICON_Y + LAPTOP_PROGRAM_ICON_HEIGHT, MSYS_PRIORITY_NORMAL+1, - CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, LaptopProgramIconMinimizeCallback ); + MSYS_DefineRegion( &gLapTopProgramMinIcon,LAPTOP_PROGRAM_ICON_X, LAPTOP_PROGRAM_ICON_Y ,LAPTOP_PROGRAM_ICON_X + LAPTOP_PROGRAM_ICON_WIDTH ,LAPTOP_PROGRAM_ICON_Y + LAPTOP_PROGRAM_ICON_HEIGHT, MSYS_PRIORITY_NORMAL+1, + CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, LaptopProgramIconMinimizeCallback ); return; } @@ -5772,9 +5764,9 @@ void CreateMinimizeRegionsForLaptopProgramIcons( void ) void DestroyMinimizeRegionsForLaptopProgramIcons( void ) { - // will destroy the minizmize regions to be placed over the laptop icons that will be + // will destroy the minizmize regions to be placed over the laptop icons that will be // displayed on the top of the laptop program bar - + MSYS_RemoveRegion( &gLapTopProgramMinIcon); return; @@ -5785,50 +5777,50 @@ void LaptopProgramIconMinimizeCallback( MOUSE_REGION * pRegion, INT32 iReason ) { // callback handler for the minize region that is attatched to the laptop program icon if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) - { + { switch( guiCurrentLaptopMode ) { - case( LAPTOP_MODE_EMAIL ): + case( LAPTOP_MODE_EMAIL ): gLaptopProgramStates[ LAPTOP_PROGRAM_MAILER ] = LAPTOP_PROGRAM_MINIMIZED; - InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[0], guiTITLEBARICONS, 0 ); - SetCurrentToLastProgramOpened( ); + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[0], guiTITLEBARICONS, 0 ); + SetCurrentToLastProgramOpened( ); fMinizingProgram = TRUE; fInitTitle = TRUE; break; case( LAPTOP_MODE_FILES ): gLaptopProgramStates[ LAPTOP_PROGRAM_FILES ] = LAPTOP_PROGRAM_MINIMIZED; - InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[5], guiTITLEBARICONS, 2 ); - SetCurrentToLastProgramOpened( ); + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[5], guiTITLEBARICONS, 2 ); + SetCurrentToLastProgramOpened( ); fMinizingProgram = TRUE; fInitTitle = TRUE; break; case( LAPTOP_MODE_FINANCES ): gLaptopProgramStates[ LAPTOP_PROGRAM_FINANCES ] = LAPTOP_PROGRAM_MINIMIZED; - InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[2], guiTITLEBARICONS, 5 ); + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[2], guiTITLEBARICONS, 5 ); SetCurrentToLastProgramOpened( ); fMinizingProgram = TRUE; fInitTitle = TRUE; break; case( LAPTOP_MODE_HISTORY ): gLaptopProgramStates[ LAPTOP_PROGRAM_HISTORY ] = LAPTOP_PROGRAM_MINIMIZED; - InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[4], guiTITLEBARICONS, 4 ); + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[4], guiTITLEBARICONS, 4 ); SetCurrentToLastProgramOpened( ); fMinizingProgram = TRUE; fInitTitle = TRUE; break; case( LAPTOP_MODE_PERSONNEL ): gLaptopProgramStates[ LAPTOP_PROGRAM_PERSONNEL ] = LAPTOP_PROGRAM_MINIMIZED; - InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[3], guiTITLEBARICONS, 3 ); + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[3], guiTITLEBARICONS, 3 ); SetCurrentToLastProgramOpened( ); fMinizingProgram = TRUE; fInitTitle = TRUE; break; case( LAPTOP_MODE_NONE ): - // nothing + // nothing break; default: gLaptopProgramStates[ LAPTOP_PROGRAM_WEB_BROWSER ] = LAPTOP_PROGRAM_MINIMIZED; - InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pWebTitle[ 0 ], guiTITLEBARICONS, 1 ); + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pWebTitle[ 0 ], guiTITLEBARICONS, 1 ); SetCurrentToLastProgramOpened( ); gfShowBookmarks = FALSE; fShowBookmarkInfo = FALSE; @@ -5847,19 +5839,19 @@ void DisplayProgramBoundingBox( BOOLEAN fMarkButtons ) HVOBJECT hHandle; GetVideoObject(&hHandle, guiLaptopBACKGROUND); - BltVideoObject(FRAME_BUFFER, hHandle, 1, iScreenWidthOffset + 25, iScreenHeightOffset + 23, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 1, iScreenWidthOffset + 25, iScreenHeightOffset + 23, VO_BLT_SRCTRANSPARENCY,NULL); // no laptop mode, no border around the program if( guiCurrentLaptopMode != LAPTOP_MODE_NONE ) { - GetVideoObject(&hHandle, guiLaptopBACKGROUND); - BltVideoObject(FRAME_BUFFER, hHandle, 0, iScreenWidthOffset + 108, iScreenHeightOffset + 23, VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hHandle, guiLaptopBACKGROUND); + BltVideoObject(FRAME_BUFFER, hHandle, 0, iScreenWidthOffset + 108, iScreenHeightOffset + 23, VO_BLT_SRCTRANSPARENCY,NULL); } if( fMarkButtons || fLoadPendingFlag ) { - MarkButtonsDirty( ); - RenderButtons( ); + MarkButtonsDirty( ); + RenderButtons( ); } @@ -5871,7 +5863,7 @@ void DisplayProgramBoundingBox( BOOLEAN fMarkButtons ) // new files or email? DisplayTaskBarIcons( ); - + return; } @@ -5881,16 +5873,16 @@ void CreateDestroyMouseRegionForNewMailIcon( void ) static BOOLEAN fCreated = FALSE; //. will toggle creation/destruction of the mouse regions used by the new mail icon - + if( fCreated == FALSE ) { fCreated = TRUE; - MSYS_DefineRegion(&gNewMailIconRegion, LAPTOP__NEW_EMAIL_ICON_X, LAPTOP__NEW_EMAIL_ICON_Y + 5, LAPTOP__NEW_EMAIL_ICON_X+16, LAPTOP__NEW_EMAIL_ICON_Y + 16, - MSYS_PRIORITY_HIGHEST - 3 , CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, NewEmailIconCallback); + MSYS_DefineRegion(&gNewMailIconRegion, LAPTOP__NEW_EMAIL_ICON_X, LAPTOP__NEW_EMAIL_ICON_Y + 5, LAPTOP__NEW_EMAIL_ICON_X+16, LAPTOP__NEW_EMAIL_ICON_Y + 16, + MSYS_PRIORITY_HIGHEST - 3 , CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, NewEmailIconCallback); CreateFileAndNewEmailIconFastHelpText( LAPTOP_BN_HLP_TXT_YOU_HAVE_NEW_MAIL, (BOOLEAN)(fUnReadMailFlag == 0 ) ); - MSYS_DefineRegion(&gNewFileIconRegion, LAPTOP__NEW_FILE_ICON_X, LAPTOP__NEW_FILE_ICON_Y + 5, LAPTOP__NEW_FILE_ICON_X + 16, LAPTOP__NEW_FILE_ICON_Y + 16, - MSYS_PRIORITY_HIGHEST - 3 , CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, NewFileIconCallback); + MSYS_DefineRegion(&gNewFileIconRegion, LAPTOP__NEW_FILE_ICON_X, LAPTOP__NEW_FILE_ICON_Y + 5, LAPTOP__NEW_FILE_ICON_X + 16, LAPTOP__NEW_FILE_ICON_Y + 16, + MSYS_PRIORITY_HIGHEST - 3 , CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, NewFileIconCallback); CreateFileAndNewEmailIconFastHelpText( LAPTOP_BN_HLP_TXT_YOU_HAVE_NEW_FILE, (BOOLEAN)( fNewFilesInFileViewer == 0 ) ); } else @@ -5905,7 +5897,7 @@ void CreateDestroyMouseRegionForNewMailIcon( void ) void NewEmailIconCallback( MOUSE_REGION * pRegion, INT32 iReason ) { if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) - { + { if( fUnReadMailFlag ) { fOpenMostRecentUnReadFlag = TRUE; @@ -5919,7 +5911,7 @@ void NewEmailIconCallback( MOUSE_REGION * pRegion, INT32 iReason ) void NewFileIconCallback( MOUSE_REGION * pRegion, INT32 iReason ) { if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) - { + { if( fNewFilesInFileViewer ) { fEnteredFileViewerFromNewFileIcon = TRUE; @@ -5941,15 +5933,15 @@ void HandleWWWSubSites( void ) fLoadPendingFlag = TRUE; fConnectingToSubPage = TRUE; - + // fast or slow load? if( gfWWWaitSubSitesVisitedFlags[ guiCurrentLaptopMode - ( LAPTOP_MODE_WWW + 1 ) ] == TRUE ) { fFastLoadFlag = TRUE; } - + // set fact we were here - gfWWWaitSubSitesVisitedFlags[ guiCurrentLaptopMode - ( LAPTOP_MODE_WWW + 1 ) ] = TRUE; + gfWWWaitSubSitesVisitedFlags[ guiCurrentLaptopMode - ( LAPTOP_MODE_WWW + 1 ) ] = TRUE; //Dont show the dlownload screen when switching between these pages if( ( guiCurrentLaptopMode == LAPTOP_MODE_AIM_MEMBERS ) && ( guiPreviousLaptopMode == LAPTOP_MODE_AIM_MEMBERS_FACIAL_INDEX ) || @@ -5959,8 +5951,8 @@ void HandleWWWSubSites( void ) fLoadPendingFlag = FALSE; // set fact we were here - gfWWWaitSubSitesVisitedFlags[ LAPTOP_MODE_AIM_MEMBERS_FACIAL_INDEX - ( LAPTOP_MODE_WWW + 1 ) ] = TRUE; - gfWWWaitSubSitesVisitedFlags[ LAPTOP_MODE_AIM_MEMBERS - ( LAPTOP_MODE_WWW + 1 ) ] = TRUE; + gfWWWaitSubSitesVisitedFlags[ LAPTOP_MODE_AIM_MEMBERS_FACIAL_INDEX - ( LAPTOP_MODE_WWW + 1 ) ] = TRUE; + gfWWWaitSubSitesVisitedFlags[ LAPTOP_MODE_AIM_MEMBERS - ( LAPTOP_MODE_WWW + 1 ) ] = TRUE; } return; @@ -5970,7 +5962,7 @@ void HandleWWWSubSites( void ) void UpdateStatusOfDisplayingBookMarks( void ) { // this function will disable showing of bookmarks if in process of download or if we miniming web browser - if( ( fLoadPendingFlag == TRUE ) || ( guiCurrentLaptopMode < LAPTOP_MODE_WWW ) ) + if( ( fLoadPendingFlag == TRUE ) || ( guiCurrentLaptopMode < LAPTOP_MODE_WWW ) ) { gfShowBookmarks = FALSE; } @@ -6068,7 +6060,7 @@ void HandleAltTabKeyInLaptop( void ) case( LAPTOP_MODE_PERSONNEL ): guiCurrentLaptopMode = LAPTOP_MODE_FINANCES; break; - + case( LAPTOP_MODE_HISTORY ): guiCurrentLaptopMode = LAPTOP_MODE_PERSONNEL; break; @@ -6109,8 +6101,8 @@ void DisplayWebBookMarkNotify( void ) // show background objects GetVideoObject(&hLapTopIconHandle, guiDOWNLOADTOP); - BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,DOWNLOAD_X, DOWNLOAD_Y, VO_BLT_SRCTRANSPARENCY,NULL); - GetVideoObject(&hLapTopIconHandle, guiDOWNLOADMID); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,DOWNLOAD_X, DOWNLOAD_Y, VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hLapTopIconHandle, guiDOWNLOADMID); BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,DOWNLOAD_X, DOWNLOAD_Y+DOWN_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); GetVideoObject(&hLapTopIconHandle, guiDOWNLOADBOT); BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,DOWNLOAD_X, DOWNLOAD_Y+2*DOWN_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); @@ -6139,7 +6131,7 @@ void DisplayWebBookMarkNotify( void ) } else if( ( fOldShow == TRUE ) && ( fShowBookmarkInfo == FALSE ) ) - { + { //MSYS_RemoveRegion( &gLapTopScreenRegion ); fOldShow = FALSE; fPausedReDrawScreenFlag = TRUE; @@ -6156,7 +6148,7 @@ void HandleWebBookMarkNotifyTimer( void ) INT32 iDifference = 0; static BOOLEAN fOldShowBookMarkInfo = FALSE; - + // check if maxing or mining? if( ( fMaximizingProgram == TRUE ) || ( fMinizingProgram == TRUE ) ) { @@ -6216,33 +6208,33 @@ void HandleWebBookMarkNotifyTimer( void ) void ClearOutTempLaptopFiles( void ) { // clear out all temp files from laptop - + // file file - if ( (FileExists( "files.dat" ) == TRUE ) ) + if ( (FileExists( "files.dat" ) == TRUE ) ) { - FileClearAttributes( "files.dat" ); - FileDelete( "files.dat" ); + FileClearAttributes( "files.dat" ); + FileDelete( "files.dat" ); } // finances - if ( (FileExists( "finances.dat" ) == TRUE ) ) + if ( (FileExists( "finances.dat" ) == TRUE ) ) { - FileClearAttributes( "finances.dat" ); - FileDelete( "finances.dat" ); + FileClearAttributes( "finances.dat" ); + FileDelete( "finances.dat" ); } // email - if ( (FileExists( "email.dat" ) == TRUE ) ) + if ( (FileExists( "email.dat" ) == TRUE ) ) { - FileClearAttributes( "email.dat" ); - FileDelete( "email.dat" ); + FileClearAttributes( "email.dat" ); + FileDelete( "email.dat" ); } // history - if ( (FileExists( "history.dat" ) == TRUE ) ) + if ( (FileExists( "history.dat" ) == TRUE ) ) { - FileClearAttributes( "history.dat" ); - FileDelete( "history.dat" ); + FileClearAttributes( "history.dat" ); + FileDelete( "history.dat" ); } } @@ -6250,7 +6242,7 @@ void ClearOutTempLaptopFiles( void ) BOOLEAN SaveLaptopInfoToSavedGame( HWFILE hFile ) { - UINT32 uiNumBytesWritten=0; + UINT32 uiNumBytesWritten=0; UINT32 uiSize; @@ -6261,7 +6253,7 @@ BOOLEAN SaveLaptopInfoToSavedGame( HWFILE hFile ) return(FALSE); } - //If there is anything in the Bobby Ray Orders on Delivery + //If there is anything in the Bobby Ray Orders on Delivery if( LaptopSaveInfo.usNumberOfBobbyRayOrderUsed ) { //Allocate memory for the information @@ -6298,14 +6290,14 @@ BOOLEAN SaveLaptopInfoToSavedGame( HWFILE hFile ) BOOLEAN LoadLaptopInfoFromSavedGame( HWFILE hFile ) { - UINT32 uiNumBytesRead=0; + UINT32 uiNumBytesRead=0; UINT32 uiSize; - + //if there is memory allocated for the BobbyR orders if( LaptopSaveInfo.usNumberOfBobbyRayOrderItems ) { - //Free the memory + //Free the memory if( LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray ) MemFree( LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray ); LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray = NULL; @@ -6317,7 +6309,7 @@ BOOLEAN LoadLaptopInfoFromSavedGame( HWFILE hFile ) if( !LaptopSaveInfo.pLifeInsurancePayouts ) Assert( 0 ); //Should never happen - //Free the memory + //Free the memory MemFree( LaptopSaveInfo.pLifeInsurancePayouts ); LaptopSaveInfo.pLifeInsurancePayouts = NULL; } @@ -6329,7 +6321,7 @@ BOOLEAN LoadLaptopInfoFromSavedGame( HWFILE hFile ) return(FALSE); } - //If there is anything in the Bobby Ray Orders on Delivery + //If there is anything in the Bobby Ray Orders on Delivery if( LaptopSaveInfo.usNumberOfBobbyRayOrderUsed ) { //Allocate memory for the information @@ -6461,6 +6453,7 @@ void CreateLaptopButtonHelpText( INT32 iButtonIndex, UINT32 uiButtonHelpTextID ) - + + diff --git a/Laptop/laptop.h b/Laptop/laptop.h index 95abffcd..159c42d9 100644 --- a/Laptop/laptop.h +++ b/Laptop/laptop.h @@ -65,7 +65,7 @@ extern BOOLEAN gbMessageDisplayed; extern UINT32 guiCurrentLaptopMode; extern UINT32 guiPreviousLaptopMode; -extern INT32 giCurrentSubPage; +extern INT32 giCurrentSubPage; extern UINT32 guiCurrentLapTopCursor; extern UINT32 guiPreviousLapTopCursor; extern BOOLEAN fMarkButtonsDirtyFlag; @@ -143,12 +143,12 @@ enum enum{ FIRST_SIDE_PANEL=1, - SECOND_SIDE_PANEL, + SECOND_SIDE_PANEL, }; enum{ LAPTOP_NO_CURSOR=0, - LAPTOP_PANEL_CURSOR, - LAPTOP_SCREEN_CURSOR, + LAPTOP_PANEL_CURSOR, + LAPTOP_SCREEN_CURSOR, LAPTOP_WWW_CURSOR, }; diff --git a/Laptop/mercs Account.cpp b/Laptop/mercs Account.cpp index 3bf6ed8e..a59338fe 100644 --- a/Laptop/mercs Account.cpp +++ b/Laptop/mercs Account.cpp @@ -75,8 +75,8 @@ UINT32 guiAccountNumberGrid; INT32 giMercTotalContractCharge; UINT32 guiMercOrderGrid0; -UINT8 iNumberOfHiredMercs; -UINT8 iTotalAccountPages; +UINT8 iNumberOfHiredMercs; +UINT8 iTotalAccountPages; UINT8 iCurrentAccountPage; INT32 guiAccountButtonImage; @@ -139,7 +139,7 @@ void BtnAccountPrevPageButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnAccountNextPageButtonCallback(GUI_BUTTON *btn,INT32 reason) { @@ -176,7 +176,7 @@ void BtnAccountNextPageButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} INT32 GetNumberOfHiredMercs() { @@ -195,7 +195,7 @@ INT32 GetNumberOfHiredMercs() usMercID = GetMercIDFromMERCArray( i ); // Is the merc hired? - if( IsMercOnTeam( (UINT8)usMercID ) || gMercProfiles[ usMercID ].iMercMercContractLength != 0 ) + if( IsMercOnTeam( (UINT8)usMercID ) || gMercProfiles[ usMercID ].iMercMercContractLength != 0 ) { uiContractCharge = gMercProfiles[ usMercID ].sSalary * gMercProfiles[ usMercID ].iMercMercContractLength; giMercTotalContractCharge += uiContractCharge; @@ -220,7 +220,7 @@ BOOLEAN EnterMercsAccount() iCurrentAccountPage = 0; iNumberOfHiredMercs = GetNumberOfHiredMercs(); - + // Can only display MAX_NUMBER_MERCS mercs per page iTotalAccountPages = iNumberOfHiredMercs / MAX_NUMBER_MERCS_ON_PAGE; mercOverPage = iNumberOfHiredMercs % MAX_NUMBER_MERCS_ON_PAGE; @@ -232,7 +232,7 @@ BOOLEAN EnterMercsAccount() iTotalAccountPages++; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; InitMercBackGround(); @@ -258,46 +258,46 @@ BOOLEAN EnterMercsAccount() // Prev Button guiAccountPrevButton = CreateIconAndTextButton( guiAccountButtonImage, MercAccountPageText[0], - FONT12ARIAL, - MERC_BUTTON_UP_COLOR, DEFAULT_SHADOW, - MERC_BUTTON_DOWN_COLOR, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - MERC_AC_PREV_BUTTON_X, MERC_AC_PREV_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnAccountPrevPageButtonCallback); + FONT12ARIAL, + MERC_BUTTON_UP_COLOR, DEFAULT_SHADOW, + MERC_BUTTON_DOWN_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MERC_AC_PREV_BUTTON_X, MERC_AC_PREV_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnAccountPrevPageButtonCallback); SetButtonCursor(guiAccountPrevButton, CURSOR_LAPTOP_SCREEN); SpecifyDisabledButtonStyle( guiAccountPrevButton, DISABLED_STYLE_SHADED); // Next Button guiAccountNextButton = CreateIconAndTextButton( guiAccountButtonImage, MercAccountPageText[1], - FONT12ARIAL, - MERC_BUTTON_UP_COLOR, DEFAULT_SHADOW, - MERC_BUTTON_DOWN_COLOR, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - MERC_AC_NEXT_BUTTON_X, MERC_AC_NEXT_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnAccountNextPageButtonCallback); + FONT12ARIAL, + MERC_BUTTON_UP_COLOR, DEFAULT_SHADOW, + MERC_BUTTON_DOWN_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MERC_AC_NEXT_BUTTON_X, MERC_AC_NEXT_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnAccountNextPageButtonCallback); SetButtonCursor(guiAccountNextButton, CURSOR_LAPTOP_SCREEN); SpecifyDisabledButtonStyle( guiAccountNextButton, DISABLED_STYLE_SHADED); - + guiMercAuthorizeButtonImage = LoadButtonImage("LAPTOP\\BigButtons.sti", -1,0,-1,1,-1 ); guiMercAuthorizeBoxButton = CreateIconAndTextButton( guiMercAuthorizeButtonImage, MercAccountText[MERC_ACCOUNT_AUTHORIZE], - FONT12ARIAL, - MERC_BUTTON_UP_COLOR, DEFAULT_SHADOW, - MERC_BUTTON_DOWN_COLOR, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - MERC_AC_AUTHORIZE_BUTTON_X, MERC_AC_AUTHORIZE_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnMercAuthorizeButtonCallback); + FONT12ARIAL, + MERC_BUTTON_UP_COLOR, DEFAULT_SHADOW, + MERC_BUTTON_DOWN_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MERC_AC_AUTHORIZE_BUTTON_X, MERC_AC_AUTHORIZE_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnMercAuthorizeButtonCallback); SetButtonCursor(guiMercAuthorizeBoxButton, CURSOR_LAPTOP_SCREEN); SpecifyDisabledButtonStyle( guiMercAuthorizeBoxButton, DISABLED_STYLE_SHADED); guiMercBackBoxButton = CreateIconAndTextButton( guiMercAuthorizeButtonImage, MercAccountText[MERC_ACCOUNT_HOME], - FONT12ARIAL, - MERC_BUTTON_UP_COLOR, DEFAULT_SHADOW, - MERC_BUTTON_DOWN_COLOR, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - MERC_AC_CANCEL_BUTTON_X, MERC_AC_CANCEL_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnMercBackButtonCallback); + FONT12ARIAL, + MERC_BUTTON_UP_COLOR, DEFAULT_SHADOW, + MERC_BUTTON_DOWN_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MERC_AC_CANCEL_BUTTON_X, MERC_AC_CANCEL_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnMercBackButtonCallback); SetButtonCursor(guiMercBackBoxButton, CURSOR_LAPTOP_SCREEN); SpecifyDisabledButtonStyle( guiMercBackBoxButton, DISABLED_STYLE_SHADED); @@ -342,14 +342,14 @@ void HandleMercsAccount() { gfMercPlayerDoesntHaveEnoughMoney_DisplayWarning = FALSE; - DoLapTopMessageBox( MSG_BOX_BLUE_ON_GREY, L"Transfer failed. No funds available.", LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL ); + DoLapTopMessageBox( MSG_BOX_BLUE_ON_GREY, L"Transfer failed. No funds available.", LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL ); } } void RenderMercsAccount() { CHAR16 sText[100]; - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; DrawMecBackGround(); @@ -378,7 +378,7 @@ void RenderMercsAccount() DrawTextToScreen( MercAccountText[MERC_ACCOUNT_DAYS], MERC_AC_SECOND_COLUMN_X, MERC_AC_MERC_TITLE_Y, MERC_AC_SECOND_COLUMN_WIDTH, MERC_ACCOUNT_TEXT_FONT, MERC_ACCOUNT_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); DrawTextToScreen( MercAccountText[MERC_ACCOUNT_RATE], MERC_AC_THIRD_COLUMN_X, MERC_AC_MERC_TITLE_Y, MERC_AC_THIRD_COLUMN_WIDTH, MERC_ACCOUNT_TEXT_FONT, MERC_ACCOUNT_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); DrawTextToScreen( MercAccountText[MERC_ACCOUNT_CHARGE], MERC_AC_FOURTH_COLUMN_X, MERC_AC_MERC_TITLE_Y, MERC_AC_FOURTH_COLUMN_WIDTH, MERC_ACCOUNT_TEXT_FONT, MERC_ACCOUNT_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); - + if (iCurrentAccountPage == iTotalAccountPages - 1) { DrawTextToScreen( MercAccountText[MERC_ACCOUNT_TOTAL], MERC_AC_THIRD_COLUMN_X, MERC_AC_TOTAL_COST_Y, MERC_AC_THIRD_COLUMN_WIDTH, MERC_ACCOUNT_TEXT_FONT, MERC_ACCOUNT_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); @@ -386,7 +386,7 @@ void RenderMercsAccount() DisplayHiredMercs(); - // giMercTotalContractCharge gets set with the price in DisplayHiredMercs(), so if there is currently no charge, disable the button + // giMercTotalContractCharge gets set with the price in DisplayHiredMercs(), so if there is currently no charge, disable the button if( giMercTotalContractCharge == 0 ) { DisableButton( guiMercAuthorizeBoxButton ); @@ -394,9 +394,9 @@ void RenderMercsAccount() - MarkButtonsDirty( ); + MarkButtonsDirty( ); RenderWWWProgramTitleBar( ); - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } @@ -434,7 +434,7 @@ void BtnMercAuthorizeButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnMercBackButtonCallback(GUI_BUTTON *btn,INT32 reason) @@ -461,12 +461,12 @@ void BtnMercBackButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void DisplayHiredMercs() { UINT16 usPosY; - UINT32 uiContractCharge; + UINT32 uiContractCharge; CHAR16 sTemp[20]; UINT8 i, usMercID; UINT8 ubFontColor; @@ -497,20 +497,20 @@ void DisplayHiredMercs() } // Loop through all the mercs - for(i=usMercIDStart; i <= TOTAL_NUMBER_OF_MERCS ; i++) + for(i=usMercIDStart; i <= TOTAL_NUMBER_OF_MERCS ; i++) { // We have no more free rows on the current page if (usCurrentRow == usMercIDEnd - 1) break; - //if it larry Roach burn advance. ( cause larry is in twice, a sober larry and a stoned larry ) + //if it larry Roach burn advance. ( cause larry is in twice, a sober larry and a stoned larry ) if( i == MERC_LARRY_ROACHBURN ) continue; usMercID = GetMercIDFromMERCArray( i ); //is the merc on the team, or is owed money - if( IsMercOnTeam( (UINT8)usMercID ) || gMercProfiles[ usMercID ].iMercMercContractLength != 0 ) + if( IsMercOnTeam( (UINT8)usMercID ) || gMercProfiles[ usMercID ].iMercMercContractLength != 0 ) { usCurrentRow++; @@ -618,7 +618,7 @@ void SettleMercAccounts() //if( LaptopSaveInfo.gubPlayersMercAccountStatus != MERC_ACCOUNT_INVALID ) LaptopSaveInfo.gubPlayersMercAccountStatus = MERC_ACCOUNT_VALID; - + // Since the player has paid, make sure speck wont complain about the lack of payment LaptopSaveInfo.uiSpeckQuoteFlags &= ~SPECK_QUOTE__SENT_EMAIL_ABOUT_LACK_OF_PAYMENT; } @@ -687,7 +687,7 @@ void SettleMercAccounts() return; } - + // add the transaction to the finance page AddTransactionToPlayersBook( PAY_SPECK_FOR_MERC, GetMercIDFromMERCArray( gubCurMercIndex ), GetWorldTotalMin(), -giMercTotalContractCharge); AddHistoryToPlayersLog( HISTORY_SETTLED_ACCOUNTS_AT_MERC, GetMercIDFromMERCArray( gubCurMercIndex ), GetWorldTotalMin(), -1, -1 ); @@ -724,7 +724,7 @@ void SettleMercAccounts() void MercAuthorizePaymentMessageBoxCallBack( UINT8 bExitValue ) { // yes, clear the form - if( bExitValue == MSG_BOX_RETURN_YES ) + if( bExitValue == MSG_BOX_RETURN_YES ) { //if the player owes Speck money, then settle the accounts if( giMercTotalContractCharge ) @@ -741,7 +741,7 @@ UINT32 CalculateHowMuchPlayerOwesSpeck() for(i=0; iuiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnMercNextButtonCallback(GUI_BUTTON *btn,INT32 reason) @@ -377,7 +377,7 @@ void BtnMercNextButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnMercHireButtonCallback(GUI_BUTTON *btn,INT32 reason) @@ -426,22 +426,22 @@ void BtnMercHireButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} BOOLEAN DisplayMercFace( UINT8 ubMercID) { - HVOBJECT hFaceHandle; - HVOBJECT hPortraitHandle; + HVOBJECT hFaceHandle; + HVOBJECT hPortraitHandle; STR sFaceLoc = "FACES\\BIGFACES\\"; char sTemp[100]; MERCPROFILESTRUCT *pMerc; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; SOLDIERTYPE *pSoldier=NULL; // Portrait Frame GetVideoObject(&hPortraitHandle, guiPortraitBox); - BltVideoObject(FRAME_BUFFER, hPortraitHandle, 0,MERC_FILES_PORTRAIT_BOX_X, MERC_FILES_PORTRAIT_BOX_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPortraitHandle, 0,MERC_FILES_PORTRAIT_BOX_X, MERC_FILES_PORTRAIT_BOX_Y, VO_BLT_SRCTRANSPARENCY,NULL); pMerc = &gMercProfiles[ ubMercID ]; @@ -449,14 +449,14 @@ BOOLEAN DisplayMercFace( UINT8 ubMercID) pSoldier = FindSoldierByProfileID( ubMercID, TRUE ); // load the Face graphic and add it - sprintf(sTemp, "%s%02d.sti", sFaceLoc, ubMercID); + sprintf(sTemp, "%s%02d.sti", sFaceLoc, ubMercID); VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP(sTemp, VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiMercFace)); - //Blt face to screen + //Blt face to screen GetVideoObject(&hFaceHandle, guiMercFace); - BltVideoObject(FRAME_BUFFER, hFaceHandle, 0,MERC_FACE_X, MERC_FACE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hFaceHandle, 0,MERC_FACE_X, MERC_FACE_Y, VO_BLT_SRCTRANSPARENCY,NULL); //if the merc is dead, shadow the face red and put text over top saying the merc is dead if( IsMercDead( ubMercID ) ) @@ -470,8 +470,8 @@ BOOLEAN DisplayMercFace( UINT8 ubMercID) //set the red pallete to the face SetObjectHandleShade( guiMercFace, 0 ); - //Blt face to screen - BltVideoObject(FRAME_BUFFER, hFaceHandle, 0,MERC_FACE_X, MERC_FACE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + //Blt face to screen + BltVideoObject(FRAME_BUFFER, hFaceHandle, 0,MERC_FACE_X, MERC_FACE_Y, VO_BLT_SRCTRANSPARENCY,NULL); DisplayWrappedString(MERC_FACE_X, MERC_FACE_Y+MERC_PORTRAIT_TEXT_OFFSET_Y, MERC_FACE_WIDTH, 2, FONT14ARIAL, 145, MercInfo[MERC_FILES_MERC_IS_DEAD], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); } @@ -483,7 +483,7 @@ BOOLEAN DisplayMercFace( UINT8 ubMercID) } //else if the merc is currently a POW or, the merc was fired as a pow - else if( pMerc->bMercStatus == MERC_FIRED_AS_A_POW || ( pSoldier && pSoldier->bAssignment == ASSIGNMENT_POW ) ) + else if( pMerc->bMercStatus == MERC_FIRED_AS_A_POW || ( pSoldier && pSoldier->bAssignment == ASSIGNMENT_POW ) ) { ShadowVideoSurfaceRect( FRAME_BUFFER, MERC_FACE_X, MERC_FACE_Y, MERC_FACE_X + MERC_FACE_WIDTH, MERC_FACE_Y + MERC_FACE_HEIGHT); DisplayWrappedString(MERC_FACE_X, MERC_FACE_Y+MERC_PORTRAIT_TEXT_OFFSET_Y, MERC_FACE_WIDTH, 2, FONT14ARIAL, 145, pPOWStrings[0], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); @@ -518,7 +518,7 @@ void LoadAndDisplayMercBio( UINT8 ubMercID ) uiStartLoc = MERC_BIO_SIZE * ubMercID; LoadEncryptedDataFromFile(MERCBIOFILE, sText, uiStartLoc, MERC_BIO_INFO_TEXT_SIZE); DisplayWrappedString(MERC_BIO_TEXT_X, MERC_BIO_TEXT_Y, MERC_BIO_WIDTH, 2, MERC_BIO_FONT, MERC_BIO_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); - + //load and display the merc's additioanl info (if any) uiStartLoc = MERC_BIO_SIZE * ubMercID + MERC_BIO_INFO_TEXT_SIZE; LoadEncryptedDataFromFile(MERCBIOFILE, sText, uiStartLoc, MERC_BIO_ADD_INFO_TEXT_SIZE); @@ -526,7 +526,7 @@ void LoadAndDisplayMercBio( UINT8 ubMercID ) { DrawTextToScreen( MercInfo[ MERC_FILES_ADDITIONAL_INFO ], MERC_ADD_BIO_TITLE_X, MERC_ADD_BIO_TITLE_Y, 0, MERC_TITLE_FONT, MERC_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); DisplayWrappedString( MERC_ADD_BIO_TEXT_X, MERC_ADD_BIO_TEXT_Y, MERC_BIO_WIDTH, 2, MERC_BIO_FONT, MERC_BIO_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - } + } } @@ -627,7 +627,7 @@ BOOLEAN MercFilesHireMerc(UINT8 ubMercID) gusMercVideoSpeckSpeech = SPECK_QUOTE_PLAYER_TRIES_TO_HIRE_ALREADY_HIRED_MERC; gubArrivedFromMercSubSite = MERC_CAME_FROM_HIRE_PAGE; } - + return(FALSE); } @@ -698,17 +698,17 @@ void BtnMercFilesBackButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void EnableDisableMercFilesNextPreviousButton( ) { if( gubCurMercIndex <= LaptopSaveInfo.gubLastMercIndex-1 ) - EnableButton( guiNextButton ); + EnableButton( guiNextButton ); else - DisableButton( guiNextButton ); + DisableButton( guiNextButton ); if( gubCurMercIndex > 0 ) EnableButton( guiPrevButton ); else DisableButton( guiPrevButton ); -} \ No newline at end of file +} diff --git a/Laptop/mercs No Account.cpp b/Laptop/mercs No Account.cpp index 3befeb70..770432c6 100644 --- a/Laptop/mercs No Account.cpp +++ b/Laptop/mercs No Account.cpp @@ -56,7 +56,7 @@ void GameInitMercsNoAccount() BOOLEAN EnterMercsNoAccount() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; InitMercBackGround(); @@ -70,23 +70,23 @@ BOOLEAN EnterMercsNoAccount() guiOpenAccountBoxButtonImage = LoadButtonImage("LAPTOP\\BigButtons.sti", -1,0,-1,1,-1 ); guiOpenAccountBoxButton = CreateIconAndTextButton( guiOpenAccountBoxButtonImage, MercNoAccountText[MERC_NO_ACC_OPEN_ACCOUNT], - FONT12ARIAL, - MERC_BUTTON_UP_COLOR, DEFAULT_SHADOW, - MERC_BUTTON_DOWN_COLOR, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - MERC_OPEN_BUTTON_X, MERC_OPEN_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnOpenAccountBoxButtonCallback); + FONT12ARIAL, + MERC_BUTTON_UP_COLOR, DEFAULT_SHADOW, + MERC_BUTTON_DOWN_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MERC_OPEN_BUTTON_X, MERC_OPEN_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnOpenAccountBoxButtonCallback); SetButtonCursor(guiOpenAccountBoxButton, CURSOR_LAPTOP_SCREEN); SpecifyDisabledButtonStyle( guiOpenAccountBoxButton, DISABLED_STYLE_SHADED); guiCancelBoxButton = CreateIconAndTextButton( guiOpenAccountBoxButtonImage, MercNoAccountText[MERC_NO_ACC_CANCEL], - FONT12ARIAL, - MERC_BUTTON_UP_COLOR, DEFAULT_SHADOW, - MERC_BUTTON_DOWN_COLOR, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - MERC_CANCEL_BUTTON_X, MERC_CANCEL_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnCancelBoxButtonCallback); + FONT12ARIAL, + MERC_BUTTON_UP_COLOR, DEFAULT_SHADOW, + MERC_BUTTON_DOWN_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MERC_CANCEL_BUTTON_X, MERC_CANCEL_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnCancelBoxButtonCallback); SetButtonCursor(guiCancelBoxButton, CURSOR_LAPTOP_SCREEN); SpecifyDisabledButtonStyle( guiCancelBoxButton, DISABLED_STYLE_SHADED); @@ -113,7 +113,7 @@ void HandleMercsNoAccount() void RenderMercsNoAccount() { - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; DrawMecBackGround(); @@ -124,9 +124,9 @@ void RenderMercsNoAccount() //Display the sentence DisplayWrappedString(MERC_NA_SENTENCE_X, MERC_NA_SENTENCE_Y, MERC_NA_SENTENCE_WIDTH, 2, MERC_NA_TEXT_FONT, MERC_NA_TEXT_COLOR, MercNoAccountText[MERC_NO_ACC_NO_ACCOUNT_OPEN_ONE], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); - MarkButtonsDirty( ); + MarkButtonsDirty( ); RenderWWWProgramTitleBar( ); - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } @@ -163,7 +163,7 @@ void BtnOpenAccountBoxButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnCancelBoxButtonCallback(GUI_BUTTON *btn,INT32 reason) @@ -190,5 +190,6 @@ void BtnCancelBoxButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} + diff --git a/Laptop/mercs.cpp b/Laptop/mercs.cpp index d7923630..067ac71d 100644 --- a/Laptop/mercs.cpp +++ b/Laptop/mercs.cpp @@ -74,8 +74,8 @@ // Video Conference Defines -#define MERC_VIDEO_BACKGROUND_X MERC_PORTRAIT_X -#define MERC_VIDEO_BACKGROUND_Y MERC_PORTRAIT_Y +#define MERC_VIDEO_BACKGROUND_X MERC_PORTRAIT_X +#define MERC_VIDEO_BACKGROUND_Y MERC_PORTRAIT_Y #define MERC_VIDEO_BACKGROUND_WIDTH 116 #define MERC_VIDEO_BACKGROUND_HEIGHT 108 @@ -100,7 +100,7 @@ #define MERC_FIRST_MERC BIFF -#define MERC_LAST_MERC BUBBA +#define MERC_LAST_MERC BUBBA //number of payment days ( # of merc days paid ) to get next set of mercs @@ -135,9 +135,9 @@ typedef struct } CONTITION_FOR_MERC_AVAILABLE; -CONTITION_FOR_MERC_AVAILABLE gConditionsForMercAvailability[ NUM_MERC_ARRIVALS ] = +CONTITION_FOR_MERC_AVAILABLE gConditionsForMercAvailability[ NUM_MERC_ARRIVALS ] = { - 5000, 8, 6, //BUBBA + 5000, 8, 6, //BUBBA 10000, 15, 7, //Larry 15000, 20, 9, //Numb 16000, 21, 10, //Tex @@ -225,8 +225,8 @@ typedef struct UINT32 uiNumberOfTimesQuoteSaid; } NUMBER_TIMES_QUOTE_SAID; -NUMBER_TIMES_QUOTE_SAID gNumberOfTimesQuoteSaid[ MERC_NUMBER_OF_RANDOM_QUOTES ] = -{ +NUMBER_TIMES_QUOTE_SAID gNumberOfTimesQuoteSaid[ MERC_NUMBER_OF_RANDOM_QUOTES ] = +{ { SPECK_QUOTE_RANDOM_CHIT_CHAT_1, 0 }, { SPECK_QUOTE_RANDOM_CHIT_CHAT_2, 0 }, @@ -279,8 +279,8 @@ void MercSiteSubTitleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //******************************* -// -// Function Prototypes +// +// Function Prototypes // //******************************* @@ -352,7 +352,7 @@ void GameInitMercs() } else { - LaptopSaveInfo.gubLastMercIndex = LAST_MERC_ID; //NUMBER_OF_BAD_MERCS; + LaptopSaveInfo.gubLastMercIndex = LAST_MERC_ID; //NUMBER_OF_BAD_MERCS; } gubCurrentMercVideoMode = MERC_VIDEO_NO_VIDEO_MODE; @@ -373,7 +373,7 @@ void GameInitMercs() BOOLEAN EnterMercs() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; VSURFACE_DESC vs_desc; SetBookMark( MERC_BOOKMARK ); @@ -415,7 +415,7 @@ BOOLEAN EnterMercs() // Account Box button - guiAccountBoxButtonImage = LoadButtonImage("LAPTOP\\SmallButtons.sti", -1,0,-1,1,-1 ); + guiAccountBoxButtonImage = LoadButtonImage("LAPTOP\\SmallButtons.sti", -1,0,-1,1,-1 ); guiAccountBoxButton = QuickCreateButton(guiAccountBoxButtonImage, MERC_ACCOUNT_BUTTON_X, MERC_ACCOUNT_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, @@ -496,7 +496,7 @@ void ExitMercs() if( gfMercVideoIsBeingDisplayed ) { gfMercVideoIsBeingDisplayed = FALSE; - DeleteFace( giVideoSpeckFaceIndex ); + DeleteFace( giVideoSpeckFaceIndex ); InitDestroyXToCloseVideoWindow( FALSE ); gubCurrentMercVideoMode = MERC_VIDEO_NO_VIDEO_MODE; } @@ -544,7 +544,7 @@ void ExitMercs() void HandleMercs() { - if( gfRedrawMercSite ) + if( gfRedrawMercSite ) { RenderMercs(); gfRedrawMercSite = FALSE; @@ -597,7 +597,7 @@ void HandleMercs() void RenderMercs() { - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; DrawMecBackGround(); @@ -638,7 +638,7 @@ void RenderMercs() RenderMercPopUpBoxFromIndex( iMercPopUpBox, gusSpeckDialogueX, MERC_TEXT_BOX_POS_Y, FRAME_BUFFER); } - MarkButtonsDirty( ); + MarkButtonsDirty( ); RenderWWWProgramTitleBar( ); //if the page is redrawn, and we are in video conferencing, redraw the VC backgrund graphic @@ -646,13 +646,13 @@ void RenderMercs() ButtonList[ guiAccountBoxButton ]->uiFlags &= ~BUTTON_FORCE_UNDIRTY; - InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); } BOOLEAN InitMercBackGround() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; // load the Merc background graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; @@ -713,7 +713,7 @@ void BtnAccountBoxButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnFileBoxButtonCallback(GUI_BUTTON *btn,INT32 reason) { @@ -738,7 +738,7 @@ void BtnFileBoxButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void DailyUpdateOfMercSite( UINT16 usDate) @@ -747,7 +747,6 @@ void DailyUpdateOfMercSite( UINT16 usDate) INT16 sSoldierID, i; UINT8 ubMercID; INT32 iNumDays; - BOOLEAN fAlreadySentEmailToPlayerThisTurn = FALSE; //if its the first day, leave if( usDate == 1 ) @@ -761,7 +760,7 @@ void DailyUpdateOfMercSite( UINT16 usDate) ubMercID = GetMercIDFromMERCArray( (UINT8) i ); if( IsMercOnTeam( ubMercID ) ) { - //if it larry Roach burn advance. ( cause larry is in twice, a sober larry and a stoned larry ) + //if it larry Roach burn advance. ( cause larry is in twice, a sober larry and a stoned larry ) if( i == MERC_LARRY_ROACHBURN ) continue; @@ -823,7 +822,7 @@ void DailyUpdateOfMercSite( UINT16 usDate) // if( LaptopSaveInfo.guiNumberOfMercPaymentsInDays > 4 ) { UINT8 ubNumDays; - + // ubNumDays = (UINT8) LaptopSaveInfo.guiNumberOfMercPaymentsInDays / 4; ubNumDays = (UINT8) LaptopSaveInfo.guiNumberOfMercPaymentsInDays; @@ -857,7 +856,7 @@ void DailyUpdateOfMercSite( UINT16 usDate) } } - + //for the Second merc //if the merc is not already here if( LaptopSaveInfo.gbNumDaysTillSecondMercArrives != -1 ) @@ -884,7 +883,7 @@ void DailyUpdateOfMercSite( UINT16 usDate) LaptopSaveInfo.gbNumDaysTillSecondMercArrives = -1; } } - + //for the Third merc //if the merc is not already here if( LaptopSaveInfo.gbNumDaysTillThirdMercArrives != -1 ) @@ -911,7 +910,7 @@ void DailyUpdateOfMercSite( UINT16 usDate) LaptopSaveInfo.gbNumDaysTillThirdMercArrives = -1; } } - + //for the Fourth merc //if the merc is not already here if( LaptopSaveInfo.gbNumDaysTillFourthMercArrives != -1 ) @@ -941,7 +940,7 @@ void DailyUpdateOfMercSite( UINT16 usDate) } */ - // If the merc site has never gone down, the number of MERC payment days is above 'X', + // If the merc site has never gone down, the number of MERC payment days is above 'X', // and the players account status is ok ( cant have the merc site going down when the player owes him money, player may lose account that way ) if( ShouldTheMercSiteServerGoDown() ) { @@ -955,7 +954,7 @@ void DailyUpdateOfMercSite( UINT16 usDate) //Remove the book mark // RemoveBookMark( MERC_BOOKMARK ); - //Get the site up the next day at 6:00 pm + //Get the site up the next day at 6:00 pm uiTimeInMinutes = GetMidnightOfFutureDayInMinutes( 1 ) + 18 * 60; //Add an event that will get the site back up and running @@ -1017,7 +1016,7 @@ BOOLEAN InitDeleteMercVideoConferenceMode() ShutupaYoFace( giVideoSpeckFaceIndex ); //Delete the face - DeleteFace( giVideoSpeckFaceIndex ); + DeleteFace( giVideoSpeckFaceIndex ); gfMercVideoIsBeingDisplayed = FALSE; } @@ -1037,7 +1036,7 @@ void InitMercVideoFace() // InternalSetAutoFaceActive( guiMercVideoFaceBackground, FACE_AUTO_RESTORE_BUFFER , giVideoSpeckFaceIndex, 0, 0, 8, 9, 7, 25 ); SetAutoFaceActive( guiMercVideoFaceBackground, FACE_AUTO_RESTORE_BUFFER , giVideoSpeckFaceIndex, 0, 0); - + //Renders the face to the background RenderAutoFace( giVideoSpeckFaceIndex ); @@ -1047,7 +1046,7 @@ void InitMercVideoFace() } -BOOLEAN StartSpeckTalking(UINT16 usQuoteNum) +BOOLEAN StartSpeckTalking(UINT16 usQuoteNum) { if( usQuoteNum == MERC_VIDEO_SPECK_SPEECH_NOT_TALKING || usQuoteNum == MERC_VIDEO_SPECK_HAS_TO_TALK_BUT_QUOTE_NOT_CHOSEN_YET ) return( FALSE ); @@ -1067,7 +1066,7 @@ BOOLEAN StartSpeckTalking(UINT16 usQuoteNum) return(TRUE); } -// Performs the frame by frame update +// Performs the frame by frame update BOOLEAN HandleSpeckTalking( BOOLEAN fReset ) { static BOOLEAN fWasTheMercTalking=FALSE; @@ -1166,7 +1165,7 @@ void HandleCurrentMercDistortion() if( fReturnStatus ) ubCurrentMercDistortionMode = MERC_DISTORTION_PIXELATE_DOWN; break; - + case MERC_DISTORTION_PIXELATE_DOWN: // fReturnStatus = PixelateVideoMercImage( FALSE ); fReturnStatus = PixelateVideoMercImage( FALSE, MERC_VIDEO_FACE_X, MERC_VIDEO_FACE_Y, MERC_VIDEO_FACE_WIDTH, MERC_VIDEO_FACE_HEIGHT ); @@ -1402,7 +1401,7 @@ void BtnXToCloseMercVideoButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} BOOLEAN DisplayMercVideoIntro( UINT16 usTimeTillFinish ) @@ -1436,7 +1435,7 @@ void HandleTalkingSpeck() { //Init the video conferencing case MERC_VIDEO_INIT_VIDEO_MODE: - //perform some opening animation. When its done start Speck talking + //perform some opening animation. When its done start Speck talking //if the intro is finished if( DisplayMercVideoIntro( MERC_INTRO_TIME ) ) @@ -1491,7 +1490,7 @@ void HandleTalkingSpeck() return; } - + if( gsSpeckDialogueTextPopUp[0] != L'\0' ) { // DrawButton( guiAccountBoxButton ); @@ -1511,14 +1510,14 @@ void HandleTalkingSpeck() // shut down the video conferencing case MERC_VIDEO_EXIT_VIDEO_MODE: - + //if the exit animation is finished, exit the video conf window if( DisplayMercVideoIntro( MERC_EXIT_TIME ) ) { StopSpeckFromTalking( ); //Delete the face - DeleteFace( giVideoSpeckFaceIndex ); + DeleteFace( giVideoSpeckFaceIndex ); InitDestroyXToCloseVideoWindow( FALSE ); gfRedrawMercSite = TRUE; @@ -1532,7 +1531,7 @@ void HandleTalkingSpeck() } else { - //else we are done the exit animation. The area is not being invalidated anymore + //else we are done the exit animation. The area is not being invalidated anymore InvalidateRegion( MERC_VIDEO_FACE_X, MERC_VIDEO_FACE_Y, MERC_VIDEO_FACE_X+MERC_VIDEO_FACE_WIDTH, MERC_VIDEO_FACE_Y+MERC_VIDEO_FACE_HEIGHT ); } break; @@ -1560,7 +1559,7 @@ void DisplayTextForSpeckVideoPopUp(STR16 pString) //Set this so the popup box doesnt render in RenderMercs() iMercPopUpBox = -1; - + //Render the screen to get rid of any old text popup boxes RenderMercs(); @@ -1572,10 +1571,10 @@ void DisplayTextForSpeckVideoPopUp(STR16 pString) } //Create the popup box - SET_USE_WINFONTS( TRUE ); - SET_WINFONT( giSubTitleWinFont ); - iMercPopUpBox = PrepareMercPopupBox( iMercPopUpBox, BASIC_MERC_POPUP_BACKGROUND, BASIC_MERC_POPUP_BORDER, gsSpeckDialogueTextPopUp, 300, 0, 0, 0, &gusSpeckDialogueActualWidth, &usActualHeight); - SET_USE_WINFONTS( FALSE ); + SET_USE_WINFONTS( TRUE ); + SET_WINFONT( giSubTitleWinFont ); + iMercPopUpBox = PrepareMercPopupBox( iMercPopUpBox, BASIC_MERC_POPUP_BACKGROUND, BASIC_MERC_POPUP_BORDER, gsSpeckDialogueTextPopUp, 300, 0, 0, 0, &gusSpeckDialogueActualWidth, &usActualHeight); + SET_USE_WINFONTS( FALSE ); gusSpeckDialogueX = iScreenWidthOffset + 111 + ((640 - 111) / 2 - (gusSpeckDialogueActualWidth / 2)); @@ -1586,7 +1585,7 @@ void DisplayTextForSpeckVideoPopUp(STR16 pString) if( !( gMercSiteSubTitleMouseRegion.uiFlags & MSYS_REGION_EXISTS ) ) { MSYS_DefineRegion( &gMercSiteSubTitleMouseRegion, gusSpeckDialogueX, MERC_TEXT_BOX_POS_Y, (INT16)(gusSpeckDialogueX + gusSpeckDialogueActualWidth), (INT16)(MERC_TEXT_BOX_POS_Y + usActualHeight), MSYS_PRIORITY_HIGH, - CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, MercSiteSubTitleRegionCallBack ); + CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, MercSiteSubTitleRegionCallBack ); MSYS_AddRegion( &gMercSiteSubTitleMouseRegion ); } } @@ -1610,7 +1609,6 @@ void CheatToGetAll5Merc() BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen ) { static UINT16 usQuoteToSay=MERC_VIDEO_SPECK_SPEECH_NOT_TALKING; - UINT8 ubRandom=0; UINT8 ubCnt; BOOLEAN fCanSayLackOfPaymentQuote = TRUE; BOOLEAN fCanUseIdleTag = FALSE; @@ -1701,7 +1699,6 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen ) else { - UINT8 ubNumMercsDead = NumberOfMercMercsDead(); UINT8 ubRandom = ( UINT8 ) Random( 100 ); //if business is good @@ -1726,7 +1723,7 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen ) StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_10_GENERIC_OPENING ); fCanUseIdleTag = TRUE; - //if the merc hasnt said the line before + //if the merc hasnt said the line before if( !LaptopSaveInfo.fSaidGenericOpeningInMercSite ) { LaptopSaveInfo.fSaidGenericOpeningInMercSite = TRUE; @@ -2104,7 +2101,7 @@ BOOLEAN IsMercMercAvailable( UINT8 ubMercID ) { //if this is the merc if( GetMercIDFromMERCArray( cnt ) == ubMercID ) - { + { //if the merc is available, and Not dead // if( gMercProfiles[ ubMercID ].bMercStatus == 0 && !IsMercDead( ubMercID ) ) if( IsMercHireable( ubMercID ) ) @@ -2123,7 +2120,7 @@ BOOLEAN ShouldSpeckStartTalkingDueToActionOnSubPage() HandlePlayerHiringMerc( GetMercIDFromMERCArray( gubCurMercIndex ) ); - //get speck to say the thank you + //get speck to say the thank you if( Random( 100 ) > 50 ) StartSpeckTalking( SPECK_QUOTE_GENERIC_THANKS_FOR_HIRING_MERCS_1 ); else @@ -2305,10 +2302,10 @@ BOOLEAN ShouldTheMercSiteServerGoDown() { UINT32 uiDay = GetWorldDay(); - // If the merc site has never gone down, the first new merc has shown ( which shows the player is using the site ), + // If the merc site has never gone down, the first new merc has shown ( which shows the player is using the site ), // and the players account status is ok ( cant have the merc site going down when the player owes him money, player may lose account that way ) -// if( !LaptopSaveInfo.fMercSiteHasGoneDownYet && LaptopSaveInfo.gbNumDaysTillThirdMercArrives <= 6 && LaptopSaveInfo.gubPlayersMercAccountStatus == MERC_ACCOUNT_VALID ) - if( !LaptopSaveInfo.fMercSiteHasGoneDownYet && LaptopSaveInfo.ubLastMercAvailableId >= 1 && LaptopSaveInfo.gubPlayersMercAccountStatus == MERC_ACCOUNT_VALID ) +// if( !LaptopSaveInfo.fMercSiteHasGoneDownYet && LaptopSaveInfo.gbNumDaysTillThirdMercArrives <= 6 && LaptopSaveInfo.gubPlayersMercAccountStatus == MERC_ACCOUNT_VALID ) + if( !LaptopSaveInfo.fMercSiteHasGoneDownYet && LaptopSaveInfo.ubLastMercAvailableId >= 1 && LaptopSaveInfo.gubPlayersMercAccountStatus == MERC_ACCOUNT_VALID ) { if( Random( 100 ) < ( uiDay * 2 + 10 ) ) { @@ -2384,7 +2381,7 @@ BOOLEAN CanMercQuoteBeSaid( UINT32 uiQuoteID ) if( !IsMercMercAvailable( FLO ) ) fRetVal = FALSE; break; - + case SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_GUMPY: if( !IsMercMercAvailable( GUMPY ) ) fRetVal = FALSE; @@ -2394,17 +2391,17 @@ BOOLEAN CanMercQuoteBeSaid( UINT32 uiQuoteID ) if( !IsMercMercAvailable( LARRY_NORMAL ) || IsMercMercAvailable( LARRY_DRUNK ) ) fRetVal = FALSE; break; - + case SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_COUGER: if( !IsMercMercAvailable( COUGAR ) ) fRetVal = FALSE; break; - + case SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_NUMB: if( !IsMercMercAvailable( NUMB ) ) fRetVal = FALSE; break; - + case SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_BUBBA: if( !IsMercMercAvailable( BUBBA ) ) fRetVal = FALSE; @@ -2481,7 +2478,7 @@ void ShouldAnyNewMercMercBecomeAvailable() } //for Larry - // if( GetMercIDFromMERCArray( LaptopSaveInfo.gubLastMercIndex ) == LARRY_NORMAL || + // if( GetMercIDFromMERCArray( LaptopSaveInfo.gubLastMercIndex ) == LARRY_NORMAL || // GetMercIDFromMERCArray( LaptopSaveInfo.gubLastMercIndex ) == LARRY_DRUNK ) { if( CanMercBeAvailableYet( MERC_ARRIVES_LARRY ) ) @@ -2571,7 +2568,7 @@ void NewMercsAvailableAtMercSiteCallBack( ) } //for Larry -// if( GetMercIDFromMERCArray( LaptopSaveInfo.gubLastMercIndex ) == LARRY_NORMAL || +// if( GetMercIDFromMERCArray( LaptopSaveInfo.gubLastMercIndex ) == LARRY_NORMAL || // GetMercIDFromMERCArray( LaptopSaveInfo.gubLastMercIndex ) == LARRY_DRUNK ) { if( CanMercBeAvailableYet( MERC_ARRIVES_LARRY ) ) @@ -2675,6 +2672,7 @@ UINT32 CalcMercDaysServed() - + + diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index e67e630f..0e2a2654 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -54,7 +54,7 @@ #define TEXT_BOX_Y LAPTOP_SCREEN_UL_Y+188 #define PAGE_BOX_X LAPTOP_SCREEN_UL_X+250 - 10 #define PAGE_BOX_Y LAPTOP_SCREEN_UL_Y+3 -#define PAGE_BOX_WIDTH 58 +#define PAGE_BOX_WIDTH 58 #define PAGE_BOX_HEIGHT 24 #define MAX_SLOTS 4 #define PERS_CURR_TEAM_X LAPTOP_SCREEN_UL_X + 39 - 15 @@ -62,7 +62,7 @@ #define PERS_DEPART_TEAM_Y LAPTOP_SCREEN_UL_Y + 247 #define BUTTON_Y LAPTOP_SCREEN_UL_Y+34 -#define LEFT_BUTTON_X LAPTOP_SCREEN_UL_X+3 - 10 +#define LEFT_BUTTON_X LAPTOP_SCREEN_UL_X+3 - 10 #define RIGHT_BUTTON_X LAPTOP_SCREEN_UL_X+476 - 10 #define PERS_COUNT 15 #define MAX_STATS 20 @@ -80,10 +80,10 @@ #define FACES_DIR "FACES\\BIGFACES\\" #define SMALL_FACES_DIR "FACES\\" -#define NEXT_MERC_FACE_X LAPTOP_SCREEN_UL_X + 448 -#define MERC_FACE_SCROLL_Y LAPTOP_SCREEN_UL_Y + 150 -#define PREV_MERC_FACE_X LAPTOP_SCREEN_UL_X + 285 - +#define NEXT_MERC_FACE_X LAPTOP_SCREEN_UL_X + 448 +#define MERC_FACE_SCROLL_Y LAPTOP_SCREEN_UL_Y + 150 +#define PREV_MERC_FACE_X LAPTOP_SCREEN_UL_X + 285 + #define DEPARTED_X LAPTOP_SCREEN_UL_X + 29 - 10 #define DEPARTED_Y LAPTOP_SCREEN_UL_Y + 207 @@ -113,7 +113,7 @@ #define PERS_STAT_AVG_X LAPTOP_SCREEN_UL_X + 157 - 10 #define PERS_STAT_AVG_Y LAPTOP_SCREEN_UL_Y + 274 -#define PERS_STAT_AVG_WIDTH 202 - 159 +#define PERS_STAT_AVG_WIDTH 202 - 159 #define PERS_STAT_LOWEST_X LAPTOP_SCREEN_UL_X + 72 - 10 #define PERS_STAT_LOWEST_WIDTH 155 - 75 #define PERS_STAT_HIGHEST_X LAPTOP_SCREEN_UL_X + 205 - 10 @@ -126,8 +126,8 @@ #define PERS_TOGGLE_CUR_Y LAPTOP_SCREEN_UL_Y + 208 #define PERS_TOGGLE_DEPART_Y LAPTOP_SCREEN_UL_Y + 238 -#define PERS_DEPARTED_UP_X LAPTOP_SCREEN_UL_X + 265 - 10 -#define PERS_DEPARTED_UP_Y LAPTOP_SCREEN_UL_Y + 210 +#define PERS_DEPARTED_UP_X LAPTOP_SCREEN_UL_X + 265 - 10 +#define PERS_DEPARTED_UP_Y LAPTOP_SCREEN_UL_Y + 210 #define PERS_DEPARTED_DOWN_Y LAPTOP_SCREEN_UL_Y + 237 #define PERS_TITLE_X iScreenWidthOffset + 140 @@ -158,7 +158,7 @@ enum{ #define ATM_DISPLAY_X iScreenWidthOffset + 509 #define ATM_DISPLAY_Y iScreenHeightOffset + 58 #define ATM_DISPLAY_HEIGHT 10 -#define ATM_DISPLAY_WIDTH 81 +#define ATM_DISPLAY_WIDTH 81 // the number of inventory items per personnel page @@ -205,13 +205,13 @@ UINT8 gubPersonnelInfoState = PRSNL_STATS; enum { PRSNL_TXT_HEALTH, // HEALTH OF MERC - PRSNL_TXT_AGILITY, + PRSNL_TXT_AGILITY, PRSNL_TXT_DEXTERITY, PRSNL_TXT_STRENGTH, PRSNL_TXT_LEADERSHIP, PRSNL_TXT_WISDOM, //5 PRSNL_TXT_EXP_LVL, // EXPERIENCE LEVEL - PRSNL_TXT_MARKSMANSHIP, + PRSNL_TXT_MARKSMANSHIP, PRSNL_TXT_MECHANICAL, PRSNL_TXT_EXPLOSIVES, PRSNL_TXT_MEDICAL, //10 @@ -283,7 +283,7 @@ POINT pPersonnelScreenPoints[]= {422+PrsnlOffSetX, 445+PrsnlOffSetY}, {422+PrsnlOffSetX, 380+PrsnlOffSetY}, // for contract price {422+PrsnlOffSetX, 435+PrsnlOffSetY}, - {140,33}, // Personnel Header + {140,33}, // Personnel Header {422+PrsnlOffSetX, 330+PrsnlOffSetY}, {422+PrsnlOffSetX, 340+PrsnlOffSetY}, //20 {422+PrsnlOffSetX, 355+PrsnlOffSetY}, @@ -325,7 +325,7 @@ BOOLEAN fOldATMFlags = 0; //INT16 ubLeftCharactersList[ 256 ]; //INT16 ubOtherCharactersList[ 256 ]; -// the id of currently displayed merc in right half of screen +// the id of currently displayed merc in right half of screen INT32 iCurrentPersonSelectedId = -1; INT32 giCurrentUpperLeftPortraitNumber = 0; @@ -445,7 +445,7 @@ void DisplayEmploymentinformation( INT32 iId, INT32 iSlot ); -// AIM merc: Returns the amount of time left on mercs contract +// AIM merc: Returns the amount of time left on mercs contract // MERC merc: Returns the amount of time the merc has worked // IMP merc: Returns the amount of time the merc has worked // else: returns -1 @@ -496,7 +496,6 @@ void HandleTimedAtmModes( void ); void GameInitPersonnel( void ) { // init past characters lists - INT32 iCounter =0; InitPastCharactersList( ); } @@ -505,7 +504,7 @@ void InitVariables(void) { pPersonnelScreenPoints[0].x = iScreenWidthOffset + 422+PrsnlOffSetX; //0 pPersonnelScreenPoints[0].y = iScreenHeightOffset + 205+PrsnlOffSetY; - + pPersonnelScreenPoints[1].x = iScreenWidthOffset + 422+PrsnlOffSetX; pPersonnelScreenPoints[1].y = iScreenHeightOffset + 215+PrsnlOffSetY; @@ -588,12 +587,12 @@ void InitVariables(void) void EnterPersonnel( void ) { InitVariables(); - + fReDrawScreenFlag=TRUE; - iStartPersonId=-1; + iStartPersonId=-1; iCurrentPersonSelectedId = -1; - + uiCurrentInventoryIndex = 0; guiSliderPosition = 0; @@ -601,7 +600,7 @@ void EnterPersonnel( void ) // load graphics for screen LoadPersonnelGraphics( ); - + // show atm panel fShowAtmPanelStartButton = TRUE; @@ -611,14 +610,14 @@ void EnterPersonnel( void ) // load personnel LoadPersonnelScreenBackgroundGraphics( ); - + // render screen RenderPersonnel( ); // how many people do we have?..if you have someone set default to 0 if( GetNumberOfMercsDeadOrAliveOnPlayersTeam() > 0 ) { - iCurrentPersonSelectedId = GetIdOfFirstDisplayedMerc( ); + iCurrentPersonSelectedId = GetIdOfFirstDisplayedMerc( ); } fCreatePersonnelPortraitMouseRegions = TRUE; @@ -630,14 +629,14 @@ void EnterPersonnel( void ) fCreateRegionsForPastCurrentToggle = TRUE; CreateDestroyCurrentDepartedMouseRegions( ); - + // create buttons for screen CreatePersonnelButtons( ); // set states of en- dis able buttons SetPersonnelButtonStates( ); - - return; + + return; } void ExitPersonnel( void ) @@ -664,14 +663,14 @@ void ExitPersonnel( void ) CreateDestroyPersonnelInventoryScrollButtons( ); // get rid of graphics - RemovePersonnelGraphics( ); + RemovePersonnelGraphics( ); - DeletePersonnelScreenBackgroundGraphics( ); + DeletePersonnelScreenBackgroundGraphics( ); CreateDestroyButtonsForPersonnelDepartures( ); // delete buttons - DeletePersonnelButtons( ); + DeletePersonnelButtons( ); fCreatePersonnelPortraitMouseRegions = FALSE; @@ -683,13 +682,13 @@ void ExitPersonnel( void ) CreateDestroyCurrentDepartedMouseRegions( ); - + return; } void HandlePersonnel( void ) { - //RenderButtonsFastHelp( ); + //RenderButtonsFastHelp( ); CreateDestroyButtonsForPersonnelDepartures( ); // create / destroy buttons for scrolling departed list @@ -709,23 +708,23 @@ void HandlePersonnel( void ) // handle timed modes for ATM HandleTimedAtmModes( ); - return; + return; } BOOLEAN LoadPersonnelGraphics( void ) { // load graphics needed for personnel screen - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + // load graphics - // title bar - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + // title bar + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\programtitlebar.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiTITLE)); // the background grpahics - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\personnelwindow.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiSCREEN)); @@ -739,7 +738,7 @@ BOOLEAN LoadPersonnelGraphics( void ) void RemovePersonnelGraphics( void ) { // delete graphics needed for personnel screen - + DeleteVideoObjectFromIndex(guiSCREEN); DeleteVideoObjectFromIndex(guiTITLE); DeleteVideoObjectFromIndex(guiPersonnelInventory); @@ -750,20 +749,19 @@ void RemovePersonnelGraphics( void ) void RenderPersonnel( void ) { - HVOBJECT hHandle; - INT32 iCounter=0; - // re-renders personnel screen - // render main background - - // blit title - GetVideoObject(&hHandle, guiTITLE); - BltVideoObject( FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_UL_Y - 2, VO_BLT_SRCTRANSPARENCY,NULL ); - + HVOBJECT hHandle; + // re-renders personnel screen + // render main background + + // blit title + GetVideoObject(&hHandle, guiTITLE); + BltVideoObject( FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_UL_Y - 2, VO_BLT_SRCTRANSPARENCY,NULL ); + // blit screen GetVideoObject(&hHandle, guiSCREEN); - BltVideoObject( FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_UL_Y + 22, VO_BLT_SRCTRANSPARENCY,NULL ); + BltVideoObject( FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_UL_Y + 22, VO_BLT_SRCTRANSPARENCY,NULL ); - // render pictures of mercs on scnree + // render pictures of mercs on scnree //RenderPersonnelPictures( ); // display header for screen @@ -776,7 +774,7 @@ void RenderPersonnel( void ) //GetVideoObject(&hHandle, guiLaptopBACKGROUND); //BltVideoObject(FRAME_BUFFER, hHandle, 0,108, 23, VO_BLT_SRCTRANSPARENCY,NULL); - + // invalidte the region we blitted to //InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_LR_Y); @@ -812,7 +810,7 @@ void RenderPersonnel( void ) // lowest stat values DisplayLowestStatValuesForCurrentTeam( ); - + // past team DisplayStateOfPastTeamMembers( ); @@ -820,14 +818,14 @@ void RenderPersonnel( void ) // title bar - BlitTitleBarIcons( ); + BlitTitleBarIcons( ); // show text on titlebar DisplayPersonnelTextOnTitleBar( ); // the highest stats DisplayHighestStatValuesForCurrentTeam( ); - + // render the atm panel RenderAtmPanel( ); @@ -836,7 +834,7 @@ void RenderPersonnel( void ) // en-dis-able start button UpDateStateOfStartButton( ); - return; + return; } @@ -846,7 +844,6 @@ BOOLEAN RenderPersonnelPictures( void ) // find person with iStartPersonId, unless it is -1, then find first bActive Merc on Staff SOLDIERTYPE *pTeamSoldier, *pSoldier; BOOLEAN fFound=FALSE; - INT32 iCounter=0; INT32 iSlot=0; INT32 cnt=0; INT32 iCurrentId = 0; @@ -858,66 +855,64 @@ BOOLEAN RenderPersonnelPictures( void ) if(iStartPersonId==-1) { - cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++, pSoldier++ ) - { - if ( pSoldier->bLife >= OKLIFE && pSoldier->bActive ) - { - fFound = TRUE; - iStartPersonId=cnt; - break; - } - } - if(!fFound) + cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++, pSoldier++ ) + { + if ( pSoldier->stats.bLife >= OKLIFE && pSoldier->bActive ) + { + fFound = TRUE; + iStartPersonId=cnt; + break; + } + } + if(!fFound) return (FALSE); } else { - iCurrentId=iStartPersonId; - fFound=TRUE; - cnt=iCurrentId; + iCurrentId=iStartPersonId; + fFound=TRUE; + cnt=iCurrentId; } while(fFound) { - // the soldier's ID is found - // render Face - fFound=FALSE; + // the soldier's ID is found + // render Face + fFound=FALSE; RenderPersonnelFace(iCurrentId, iSlot, FALSE, FALSE, FALSE ); // draw stats - RenderPersonnelStats(iCurrentId, iSlot); + RenderPersonnelStats(iCurrentId, iSlot); DisplayCharName( iCurrentId, iSlot); //find next guy pSoldier=MercPtrs[iCurrentId]; - cnt++; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) - { - if ( pTeamSoldier->bLife >= OKLIFE && pTeamSoldier->bActive ) + cnt++; + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) + { + if ( pTeamSoldier->stats.bLife >= OKLIFE && pTeamSoldier->bActive ) { - if( pTeamSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if( pTeamSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { return( FALSE ); } - fFound = TRUE; + fFound = TRUE; iSlot++; - break; + break; } } if(iSlot>=MAX_SLOTS) fFound=FALSE; - iCurrentId=cnt; + iCurrentId=cnt; } - + return(TRUE); } void RenderPersonnelStats( INT32 iId, INT32 iSlot ) { - - INT32 iCounter=0; // will render the stats of person iId in slot iSlot SetFont(PERS_FONT); SetFontForeground(PERS_TEXT_FONT_COLOR); @@ -933,26 +928,24 @@ void RenderPersonnelStats( INT32 iId, INT32 iSlot ) } else if( gubPersonnelInfoState == PERSONNEL_EMPLOYMENT_BTN ) { - DisplayEmploymentinformation( iId, iSlot ); + DisplayEmploymentinformation( iId, iSlot ); } -} +} BOOLEAN RenderPersonnelFace(INT32 iId, INT32 iSlot, BOOLEAN fDead, BOOLEAN fFired, BOOLEAN fOther ) { char sTemp[100]; HVOBJECT hFaceHandle; - VOBJECT_DESC VObjectDesc; - INT32 iCounter = 7; - + VOBJECT_DESC VObjectDesc; // draw face to soldier iId in slot iSlot - + // special case?..player generated merc if( fCurrentTeamMode == TRUE ) { - - if( ( 50 < MercPtrs[iId] -> ubProfile )&&( 57 > MercPtrs[iId] -> ubProfile ) ) + + if( ( 50 < MercPtrs[iId]->ubProfile )&&( 57 > MercPtrs[iId]->ubProfile ) ) { - sprintf( sTemp, "%s%03d.sti", FACES_DIR, gMercProfiles[ MercPtrs[iId] -> ubProfile ].ubFaceIndex ); + sprintf( sTemp, "%s%03d.sti", FACES_DIR, gMercProfiles[ MercPtrs[iId]->ubProfile ].ubFaceIndex ); } else { @@ -969,17 +962,17 @@ BOOLEAN RenderPersonnelFace(INT32 iId, INT32 iSlot, BOOLEAN fDead, BOOLEAN fFire if( ( 50 < iId )&&( 57 > iId ) ) { - sprintf( sTemp, "%s%03d.sti", FACES_DIR, gMercProfiles[ iId ].ubFaceIndex ); + sprintf( sTemp, "%s%03d.sti", FACES_DIR, gMercProfiles[ iId ].ubFaceIndex ); } else { - sprintf(sTemp, "%s%02d.sti", FACES_DIR, iId ); + sprintf(sTemp, "%s%02d.sti", FACES_DIR, iId ); } } if( fCurrentTeamMode == TRUE ) { - if( MercPtrs[iId]->uiStatusFlags & SOLDIER_VEHICLE ) + if( MercPtrs[iId]->flags.uiStatusFlags & SOLDIER_VEHICLE ) { return( TRUE ); } @@ -989,15 +982,15 @@ BOOLEAN RenderPersonnelFace(INT32 iId, INT32 iSlot, BOOLEAN fDead, BOOLEAN fFire FilenameForBPP(sTemp, VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiFACE)); - //Blt face to screen to + //Blt face to screen to GetVideoObject(&hFaceHandle, guiFACE); if( fCurrentTeamMode == TRUE ) { - if( MercPtrs[iId]->bLife <= 0 ) + if( MercPtrs[iId]->stats.bLife <= 0 ) { hFaceHandle->pShades[ 0 ] = Create16BPPPaletteShaded( hFaceHandle->pPaletteEntry, DEAD_MERC_COLOR_RED, DEAD_MERC_COLOR_GREEN, DEAD_MERC_COLOR_BLUE, TRUE ); - + //set the red pallete to the face SetObjectHandleShade( guiFACE, 0 ); } @@ -1007,34 +1000,34 @@ BOOLEAN RenderPersonnelFace(INT32 iId, INT32 iSlot, BOOLEAN fDead, BOOLEAN fFire if( fDead == TRUE ) { hFaceHandle->pShades[ 0 ] = Create16BPPPaletteShaded( hFaceHandle->pPaletteEntry, DEAD_MERC_COLOR_RED, DEAD_MERC_COLOR_GREEN, DEAD_MERC_COLOR_BLUE, TRUE ); - + //set the red pallete to the face SetObjectHandleShade( guiFACE, 0 ); } } - - BltVideoObject(FRAME_BUFFER, hFaceHandle, 0,IMAGE_BOX_X+(iSlot*IMAGE_BOX_WIDTH), IMAGE_BOX_Y, VO_BLT_SRCTRANSPARENCY,NULL); - + + BltVideoObject(FRAME_BUFFER, hFaceHandle, 0,IMAGE_BOX_X+(iSlot*IMAGE_BOX_WIDTH), IMAGE_BOX_Y, VO_BLT_SRCTRANSPARENCY,NULL); + //if the merc is dead, display it if( !fCurrentTeamMode ) { INT32 iHeightOfText; - iHeightOfText = DisplayWrappedString(IMAGE_BOX_X, (UINT16)(IMAGE_BOX_Y+IMAGE_FULL_NAME_OFFSET_Y), IMAGE_NAME_WIDTH, 1, PERS_FONT, PERS_FONT_COLOR, gMercProfiles[ iId ].zName, 0, FALSE, CENTER_JUSTIFIED | DONT_DISPLAY_TEXT ); + iHeightOfText = DisplayWrappedString(IMAGE_BOX_X, (UINT16)(IMAGE_BOX_Y+IMAGE_FULL_NAME_OFFSET_Y), IMAGE_NAME_WIDTH, 1, PERS_FONT, PERS_FONT_COLOR, gMercProfiles[ iId ].zName, 0, FALSE, CENTER_JUSTIFIED | DONT_DISPLAY_TEXT ); //if the string will rap if( ( iHeightOfText - 2 ) > GetFontHeight( PERS_FONT ) ) { //raise where we display it, and rap it - DisplayWrappedString(IMAGE_BOX_X, (UINT16)(IMAGE_BOX_Y+IMAGE_FULL_NAME_OFFSET_Y - GetFontHeight( PERS_FONT )), IMAGE_NAME_WIDTH, 1, PERS_FONT, PERS_FONT_COLOR, gMercProfiles[ iId ].zName, 0, FALSE, CENTER_JUSTIFIED); + DisplayWrappedString(IMAGE_BOX_X, (UINT16)(IMAGE_BOX_Y+IMAGE_FULL_NAME_OFFSET_Y - GetFontHeight( PERS_FONT )), IMAGE_NAME_WIDTH, 1, PERS_FONT, PERS_FONT_COLOR, gMercProfiles[ iId ].zName, 0, FALSE, CENTER_JUSTIFIED); } else { - DrawTextToScreen( gMercProfiles[ iId ].zName, IMAGE_BOX_X, (UINT16)(IMAGE_BOX_Y+IMAGE_FULL_NAME_OFFSET_Y), IMAGE_NAME_WIDTH, PERS_FONT, PERS_FONT_COLOR, 0, FALSE, CENTER_JUSTIFIED ); + DrawTextToScreen( gMercProfiles[ iId ].zName, IMAGE_BOX_X, (UINT16)(IMAGE_BOX_Y+IMAGE_FULL_NAME_OFFSET_Y), IMAGE_NAME_WIDTH, PERS_FONT, PERS_FONT_COLOR, 0, FALSE, CENTER_JUSTIFIED ); } -// DrawTextToScreen(gMercProfiles[ iId ].zName, ( INT16 ) ( IMAGE_BOX_X+(iSlot*IMAGE_BOX_WIDTH) ), ( INT16 ) ( IMAGE_BOX_Y + 107 ), IMAGE_BOX_WITH_NO_BORDERS, PERS_FONT, PERS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); +// DrawTextToScreen(gMercProfiles[ iId ].zName, ( INT16 ) ( IMAGE_BOX_X+(iSlot*IMAGE_BOX_WIDTH) ), ( INT16 ) ( IMAGE_BOX_Y + 107 ), IMAGE_BOX_WITH_NO_BORDERS, PERS_FONT, PERS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); } /* @@ -1067,11 +1060,11 @@ removed cause we already show this under the picture, instead display the mercs } } -*/ +*/ DeleteVideoObjectFromIndex(guiFACE); - - + + return (TRUE); } @@ -1106,7 +1099,7 @@ BOOLEAN NextPersonnelFace( void ) iCurPortraitId = 0; } - else if( iCurPortraitId == 19 ) + else if( iCurPortraitId == 19 ) { giCurrentUpperLeftPortraitNumber += 20; iCurPortraitId = 0; @@ -1117,7 +1110,7 @@ BOOLEAN NextPersonnelFace( void ) } // get of this merc in this slot - iCurrentPersonSelectedId = iCurPortraitId; + iCurrentPersonSelectedId = iCurPortraitId; fReDrawScreenFlag = TRUE; } @@ -1126,16 +1119,16 @@ BOOLEAN NextPersonnelFace( void ) BOOLEAN PrevPersonnelFace( void ) { - + if( iCurrentPersonSelectedId == -1 ) { return ( TRUE ); } - if( fCurrentTeamMode == TRUE ) + if( fCurrentTeamMode == TRUE ) { // wrap around? - if( iCurrentPersonSelectedId == 0 ) + if( iCurrentPersonSelectedId == 0 ) { iCurrentPersonSelectedId = GetNumberOfMercsDeadOrAliveOnPlayersTeam( ) - 1; @@ -1151,7 +1144,7 @@ BOOLEAN PrevPersonnelFace( void ) } else { - if ( ( iCurPortraitId == 0 ) && ( giCurrentUpperLeftPortraitNumber == 0 ) ) + if ( ( iCurPortraitId == 0 ) && ( giCurrentUpperLeftPortraitNumber == 0 ) ) { // about to go off the end giCurrentUpperLeftPortraitNumber = ( GetNumberOfDeadOnPastTeam( ) + GetNumberOfLeftOnPastTeam( ) + GetNumberOfOtherOnPastTeam( ) ) - ( GetNumberOfDeadOnPastTeam( ) + GetNumberOfLeftOnPastTeam( ) + GetNumberOfOtherOnPastTeam( ) ) % 20; @@ -1159,7 +1152,7 @@ BOOLEAN PrevPersonnelFace( void ) iCurPortraitId--; } - else if( iCurPortraitId == 0 ) + else if( iCurPortraitId == 0 ) { giCurrentUpperLeftPortraitNumber -= 20; iCurPortraitId = 19; @@ -1170,7 +1163,7 @@ BOOLEAN PrevPersonnelFace( void ) } // get of this merc in this slot - iCurrentPersonSelectedId = iCurPortraitId; + iCurrentPersonSelectedId = iCurPortraitId; fReDrawScreenFlag = TRUE; } @@ -1182,44 +1175,44 @@ void CreatePersonnelButtons( void ) { // left button - giPersonnelButtonImage[0]= LoadButtonImage( "LAPTOP\\personnelbuttons.sti" ,-1,0,-1,1,-1 ); + giPersonnelButtonImage[0]= LoadButtonImage( "LAPTOP\\personnelbuttons.sti" ,-1,0,-1,1,-1 ); giPersonnelButton[0] = QuickCreateButton( giPersonnelButtonImage[0], PREV_MERC_FACE_X, MERC_FACE_SCROLL_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)LeftButtonCallBack); - + // right button - giPersonnelButtonImage[1]= LoadButtonImage( "LAPTOP\\personnelbuttons.sti" ,-1,2,-1,3,-1 ); + giPersonnelButtonImage[1]= LoadButtonImage( "LAPTOP\\personnelbuttons.sti" ,-1,2,-1,3,-1 ); giPersonnelButton[1] = QuickCreateButton( giPersonnelButtonImage[1], NEXT_MERC_FACE_X, MERC_FACE_SCROLL_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)RightButtonCallBack); - - + + /* // left button - giPersonnelButtonImage[0]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,0,-1,1,-1 ); + giPersonnelButtonImage[0]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,0,-1,1,-1 ); giPersonnelButton[0] = QuickCreateButton( giPersonnelButtonImage[0], LEFT_BUTTON_X, BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)LeftButtonCallBack); - + // right button - giPersonnelButtonImage[1]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,6,-1,7,-1 ); + giPersonnelButtonImage[1]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,6,-1,7,-1 ); giPersonnelButton[1] = QuickCreateButton( giPersonnelButtonImage[1], RIGHT_BUTTON_X, BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)RightButtonCallBack); - + // left FF button - giPersonnelButtonImage[2]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,3,-1,4,-1 ); + giPersonnelButtonImage[2]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,3,-1,4,-1 ); giPersonnelButton[2] = QuickCreateButton( giPersonnelButtonImage[2], LEFT_BUTTON_X, BUTTON_Y + 22, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)LeftFFButtonCallBack); - + // right ff button - giPersonnelButtonImage[3]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,9,-1,10,-1 ); + giPersonnelButtonImage[3]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,9,-1,10,-1 ); giPersonnelButton[3] = QuickCreateButton( giPersonnelButtonImage[3], RIGHT_BUTTON_X, BUTTON_Y + 22, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)RightFFButtonCallBack); - */ + */ // set up cursors SetButtonCursor(giPersonnelButton[0], CURSOR_LAPTOP_SCREEN); SetButtonCursor(giPersonnelButton[1], CURSOR_LAPTOP_SCREEN); @@ -1233,7 +1226,7 @@ void CreatePersonnelButtons( void ) void DeletePersonnelButtons( void ) { - RemoveButton(giPersonnelButton[0] ); + RemoveButton(giPersonnelButton[0] ); UnloadButtonImage(giPersonnelButtonImage[0] ); RemoveButton(giPersonnelButton[1] ); UnloadButtonImage( giPersonnelButtonImage[1] ); @@ -1257,18 +1250,18 @@ void LeftButtonCallBack(GUI_BUTTON *btn,INT32 reason) { fReDrawScreenFlag=TRUE; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if(btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - fReDrawScreenFlag=TRUE; - PrevPersonnelFace( ); - uiCurrentInventoryIndex = 0; - guiSliderPosition = 0; - + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fReDrawScreenFlag=TRUE; + PrevPersonnelFace( ); + uiCurrentInventoryIndex = 0; + guiSliderPosition = 0; + } } } @@ -1284,21 +1277,21 @@ void LeftFFButtonCallBack(GUI_BUTTON *btn,INT32 reason) { fReDrawScreenFlag=TRUE; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if(btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - fReDrawScreenFlag=TRUE; - PrevPersonnelFace( ); - PrevPersonnelFace( ); - PrevPersonnelFace( ); - PrevPersonnelFace( ); - - // set states - SetPersonnelButtonStates( ); + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fReDrawScreenFlag=TRUE; + PrevPersonnelFace( ); + PrevPersonnelFace( ); + PrevPersonnelFace( ); + PrevPersonnelFace( ); + + // set states + SetPersonnelButtonStates( ); } } } @@ -1311,21 +1304,21 @@ void RightButtonCallBack(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - { - fReDrawScreenFlag=TRUE; + { + fReDrawScreenFlag=TRUE; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if(btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - fReDrawScreenFlag=TRUE; - NextPersonnelFace( ); - uiCurrentInventoryIndex = 0; - guiSliderPosition = 0; - + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fReDrawScreenFlag=TRUE; + NextPersonnelFace( ); + uiCurrentInventoryIndex = 0; + guiSliderPosition = 0; + } } @@ -1339,59 +1332,59 @@ void RightFFButtonCallBack(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - { - fReDrawScreenFlag=TRUE; + { + fReDrawScreenFlag=TRUE; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if(btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - fReDrawScreenFlag=TRUE; - NextPersonnelFace( ); - NextPersonnelFace( ); - NextPersonnelFace( ); - NextPersonnelFace( ); + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fReDrawScreenFlag=TRUE; + NextPersonnelFace( ); + NextPersonnelFace( ); + NextPersonnelFace( ); + NextPersonnelFace( ); - // set states - SetPersonnelButtonStates( ); + // set states + SetPersonnelButtonStates( ); } } } void DisplayHeader( void ) { - SetFont(PERS_HEADER_FONT); + SetFont(PERS_HEADER_FONT); SetFontForeground(PERS_FONT_COLOR); SetFontBackground( 0 ); mprintf(pPersonnelScreenPoints[18].x,pPersonnelScreenPoints[18].y,pPersonnelTitle[0]); - + return; } void DisplayCharName( INT32 iId, INT32 iSlot ) { - // get merc's nickName, assignment, and sector location info + // get merc's nickName, assignment, and sector location info INT16 sX, sY; - SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pSoldier; CHAR16 sString[ 64 ]; CHAR16 sTownName[ 256 ]; - INT8 bTownId = -1; + INT8 bTownId = -1; INT32 iHeightOfText; sTownName[0] = L'\0'; pSoldier=MercPtrs[iId]; - SetFont(CHAR_NAME_FONT); + SetFont(CHAR_NAME_FONT); SetFontForeground(PERS_TEXT_FONT_COLOR); SetFontBackground(FONT_BLACK); - - if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + + if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { return; } @@ -1403,7 +1396,7 @@ void DisplayCharName( INT32 iId, INT32 iSlot ) { } else - { + { // name of town, if any bTownId = GetTownIdForSector( Menptr[iId].sSectorX, Menptr[iId].sSectorY ); @@ -1435,7 +1428,7 @@ void DisplayCharName( INT32 iId, INT32 iSlot ) { sX = ( INT16 )pPersonnelScreenPoints[ 0 ].x; } - + //Display the mercs name mprintf(sX+iSlot*IMAGE_BOX_WIDTH, CHAR_NAME_Y, sString ); @@ -1449,7 +1442,7 @@ void DisplayCharName( INT32 iId, INT32 iSlot ) { sX = ( INT16 )pPersonnelScreenPoints[ 0 ].x; } - + mprintf(sX+iSlot*IMAGE_BOX_WIDTH, CHAR_LOC_Y, sString ); @@ -1478,14 +1471,14 @@ Moved so the name of the town will be in the same line as the name if( Menptr[iId].bAssignment == ASSIGNMENT_POW ) { // FindFontCenterCoordinates(IMAGE_BOX_X-5,0,IMAGE_BOX_WIDTH, 0,pPOWStrings[ 1 ],CHAR_NAME_FONT, &sX, &sY ); -// mprintf(sX+iSlot*IMAGE_BOX_WIDTH, CHAR_NAME_Y+20,pPOWStrings[ 1 ] ); +// mprintf(sX+iSlot*IMAGE_BOX_WIDTH, CHAR_NAME_Y+20,pPOWStrings[ 1 ] ); } else if( Menptr[iId].bAssignment == IN_TRANSIT ) { return; } else - { + { // name of town, if any bTownId = GetTownIdForSector( Menptr[iId].sSectorX, Menptr[iId].sSectorY ); @@ -1496,7 +1489,7 @@ Moved so the name of the town will be in the same line as the name } } */ - + return; } @@ -1510,9 +1503,9 @@ void DisplayCharStats(INT32 iId, INT32 iSlot) UINT32 uiHits = 0; SOLDIERTYPE *pSoldier = &Menptr[iId]; BOOLEAN fAmIaRobot = AM_A_ROBOT( pSoldier ); - - - if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + + + if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { return; } @@ -1522,294 +1515,294 @@ void DisplayCharStats(INT32 iId, INT32 iSlot) { switch(iCounter) { - case 0: - // health - if( Menptr[iId].bAssignment != ASSIGNMENT_POW ) - { + case 0: + // health + if( Menptr[iId].bAssignment != ASSIGNMENT_POW ) + { if( gMercProfiles[Menptr[iId].ubProfile].bLifeDelta > 0 ) { swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bLifeDelta); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } - //else - //{ - swprintf(sString, L"%d/%d",Menptr[iId].bLife,Menptr[iId].bLifeMax); - //} - } - else - { - swprintf( sString, pPOWStrings[ 1 ] ); - } + //else + //{ + swprintf(sString, L"%d/%d",Menptr[iId].stats.bLife,Menptr[iId].stats.bLifeMax); + //} + } + else + { + swprintf( sString, pPOWStrings[ 1 ] ); + } - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[PRSNL_TXT_HEALTH]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; - case 1: - // agility - if( !fAmIaRobot ) - { - if( gMercProfiles[Menptr[iId].ubProfile].bAgilityDelta > 0 ) - { - swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bAgilityDelta); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } - //else - //{ - swprintf(sString, L"%d",Menptr[iId].bAgility); - //} - } - else - { - swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); - } - - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; - case 2: - // dexterity - if( !fAmIaRobot ) - { - if( gMercProfiles[Menptr[iId].ubProfile].bDexterityDelta > 0 ) - { - swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bDexterityDelta); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } - //else - //{ - swprintf(sString, L"%d",Menptr[iId].bDexterity); - //} - } - else - { - swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); - } - - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[PRSNL_TXT_HEALTH]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); break; - case 3: - // strength - if( !fAmIaRobot ) - { - if( gMercProfiles[Menptr[iId].ubProfile].bStrengthDelta > 0 ) - { + case 1: + // agility + if( !fAmIaRobot ) + { + if( gMercProfiles[Menptr[iId].ubProfile].bAgilityDelta > 0 ) + { + swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bAgilityDelta); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } + //else + //{ + swprintf(sString, L"%d",Menptr[iId].stats.bAgility); + //} + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } + + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 2: + // dexterity + if( !fAmIaRobot ) + { + if( gMercProfiles[Menptr[iId].ubProfile].bDexterityDelta > 0 ) + { + swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bDexterityDelta); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } + //else + //{ + swprintf(sString, L"%d",Menptr[iId].stats.bDexterity); + //} + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } + + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 3: + // strength + if( !fAmIaRobot ) + { + if( gMercProfiles[Menptr[iId].ubProfile].bStrengthDelta > 0 ) + { swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bStrengthDelta); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } - //else - //{ - swprintf(sString, L"%d",Menptr[iId].bStrength ); - //} - } - else - { - swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); - } + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } + //else + //{ + swprintf(sString, L"%d",Menptr[iId].stats.bStrength ); + //} + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; - case 4: - // leadership - if( !fAmIaRobot ) - { - if( gMercProfiles[Menptr[iId].ubProfile].bLeadershipDelta > 0 ) - { + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 4: + // leadership + if( !fAmIaRobot ) + { + if( gMercProfiles[Menptr[iId].ubProfile].bLeadershipDelta > 0 ) + { swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bLeadershipDelta); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20 +TEXT_DELTA_OFFSET),0,30,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } - //else - //{ - swprintf(sString, L"%d",Menptr[iId].bLeadership ); - //} - } - else - { - swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); - } + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20 +TEXT_DELTA_OFFSET),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } + //else + //{ + swprintf(sString, L"%d",Menptr[iId].stats.bLeadership ); + //} + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; - case 5: - // wisdom - if( !fAmIaRobot ) - { - if( gMercProfiles[Menptr[iId].ubProfile].bWisdomDelta > 0 ) - { + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 5: + // wisdom + if( !fAmIaRobot ) + { + if( gMercProfiles[Menptr[iId].ubProfile].bWisdomDelta > 0 ) + { swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bWisdomDelta); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - } - //else - //{ - swprintf(sString, L"%d",Menptr[iId].bWisdom ); - //} - } - else - { - swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); - } + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + } + //else + //{ + swprintf(sString, L"%d",Menptr[iId].stats.bWisdom ); + //} + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; - case 6: - // exper - if( !fAmIaRobot ) - { + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 6: + // exper + if( !fAmIaRobot ) + { - if( gMercProfiles[Menptr[iId].ubProfile].bExpLevelDelta > 0 ) - { + if( gMercProfiles[Menptr[iId].ubProfile].bExpLevelDelta > 0 ) + { swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bExpLevelDelta); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20 +TEXT_DELTA_OFFSET),0,30,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - } - //else - //{ - swprintf(sString, L"%d",Menptr[iId].bExpLevel ); - //} - } - else - { - swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); - } + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20 +TEXT_DELTA_OFFSET),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + } + //else + //{ + swprintf(sString, L"%d",Menptr[iId].stats.bExpLevel ); + //} + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; - case 7: - //mrkmanship - if( !fAmIaRobot ) - { - if( gMercProfiles[Menptr[iId].ubProfile].bMarksmanshipDelta > 0 ) - { + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 7: + //mrkmanship + if( !fAmIaRobot ) + { + if( gMercProfiles[Menptr[iId].ubProfile].bMarksmanshipDelta > 0 ) + { swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bMarksmanshipDelta); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } - //else - //{ - swprintf(sString, L"%d",Menptr[iId].bMarksmanship); - //} - } - else - { - swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); - } + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } + //else + //{ + swprintf(sString, L"%d",Menptr[iId].stats.bMarksmanship); + //} + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; - case 8: - // mech - if( !fAmIaRobot ) - { + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 8: + // mech + if( !fAmIaRobot ) + { - if( gMercProfiles[Menptr[iId].ubProfile].bMechanicDelta > 0 ) - { + if( gMercProfiles[Menptr[iId].ubProfile].bMechanicDelta > 0 ) + { swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bMechanicDelta); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } - //else - //{ - swprintf(sString, L"%d",Menptr[iId].bMechanical); - //} - } - else - { - swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); - } + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } + //else + //{ + swprintf(sString, L"%d",Menptr[iId].stats.bMechanical); + //} + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; - case 9: - // exp - if( !fAmIaRobot ) - { - if( gMercProfiles[Menptr[iId].ubProfile].bExplosivesDelta > 0 ) - { + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 9: + // exp + if( !fAmIaRobot ) + { + if( gMercProfiles[Menptr[iId].ubProfile].bExplosivesDelta > 0 ) + { swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bExplosivesDelta); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } - //else - //{ - swprintf(sString, L"%d",Menptr[iId].bExplosive); - //} + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } + //else + //{ + swprintf(sString, L"%d",Menptr[iId].stats.bExplosive); + //} - } - else - { - swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); - } + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; - case 10: - // med - if( !fAmIaRobot ) - { - if( gMercProfiles[Menptr[iId].ubProfile].bMedicalDelta > 0 ) - { - swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bMedicalDelta); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20 +TEXT_DELTA_OFFSET),0,30,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } - //else - //{ - swprintf(sString, L"%d",Menptr[iId].bMedical); - //} - } - else - { - swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); - } + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 10: + // med + if( !fAmIaRobot ) + { + if( gMercProfiles[Menptr[iId].ubProfile].bMedicalDelta > 0 ) + { + swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bMedicalDelta); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20 +TEXT_DELTA_OFFSET),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } + //else + //{ + swprintf(sString, L"%d",Menptr[iId].stats.bMedical); + //} + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; - case 14: - // kills - mprintf((INT16)(pPersonnelScreenPoints[21].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[21].y,pPersonnelScreenStrings[PRSNL_TXT_KILLS]); + case 14: + // kills + mprintf((INT16)(pPersonnelScreenPoints[21].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[21].y,pPersonnelScreenStrings[PRSNL_TXT_KILLS]); swprintf(sString, L"%d",gMercProfiles[Menptr[iId].ubProfile].usKills); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[21].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[21].y,sString); - break; - case 15: + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[21].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[21].y,sString); + break; + case 15: // assists - mprintf((INT16)(pPersonnelScreenPoints[22].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[22].y,pPersonnelScreenStrings[PRSNL_TXT_ASSISTS]); + mprintf((INT16)(pPersonnelScreenPoints[22].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[22].y,pPersonnelScreenStrings[PRSNL_TXT_ASSISTS]); swprintf(sString, L"%d",gMercProfiles[Menptr[iId].ubProfile].usAssists); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[22].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[22].y,sString); - break; - case 16: + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[22].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[22].y,sString); + break; + case 16: // shots/hits - mprintf((INT16)(pPersonnelScreenPoints[23].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[23].y,pPersonnelScreenStrings[PRSNL_TXT_HIT_PERCENTAGE]); + mprintf((INT16)(pPersonnelScreenPoints[23].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[23].y,pPersonnelScreenStrings[PRSNL_TXT_HIT_PERCENTAGE]); uiHits = ( UINT32 )gMercProfiles[Menptr[iId].ubProfile].usShotsHit; uiHits *= 100; - + // check we have shot at least once if( gMercProfiles[Menptr[iId].ubProfile].usShotsFired > 0 ) { - uiHits /= ( UINT32 )gMercProfiles[Menptr[iId].ubProfile].usShotsFired; + uiHits /= ( UINT32 )gMercProfiles[Menptr[iId].ubProfile].usShotsFired; } else { @@ -1819,24 +1812,24 @@ void DisplayCharStats(INT32 iId, INT32 iSlot) swprintf(sString, L"%d %%%%",uiHits); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[23].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - sX += StringPixLength( L"%", PERS_FONT ); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[23].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + sX += StringPixLength( L"%", PERS_FONT ); mprintf(sX,pPersonnelScreenPoints[23].y,sString); - break; - case 17: + break; + case 17: // battles - mprintf((INT16)(pPersonnelScreenPoints[24].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[24].y,pPersonnelScreenStrings[PRSNL_TXT_BATTLES]); + mprintf((INT16)(pPersonnelScreenPoints[24].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[24].y,pPersonnelScreenStrings[PRSNL_TXT_BATTLES]); swprintf(sString, L"%d",gMercProfiles[Menptr[iId].ubProfile].usBattlesFought); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[24].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[24].y,sString); - break; - case 18: + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[24].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[24].y,sString); + break; + case 18: // wounds - mprintf((INT16)(pPersonnelScreenPoints[25].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[25].y,pPersonnelScreenStrings[PRSNL_TXT_TIMES_WOUNDED]); + mprintf((INT16)(pPersonnelScreenPoints[25].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[25].y,pPersonnelScreenStrings[PRSNL_TXT_TIMES_WOUNDED]); swprintf(sString, L"%d",gMercProfiles[Menptr[iId].ubProfile].usTimesWounded); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[25].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[25].y,sString); - break; + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[25].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[25].y,sString); + break; // The Mercs Skills case 19: @@ -1849,9 +1842,9 @@ void DisplayCharStats(INT32 iId, INT32 iSlot) mprintf( (INT16)( pPersonnelScreenPoints[bScreenLocIndex].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[bScreenLocIndex].y,pPersonnelScreenStrings[ PRSNL_TXT_SKILLS ] ); //KM: April 16, 1999 - //Added support for the German version, which has potential string overrun problems. For example, the text "Skills:" can - //overlap "NightOps (Expert)" because the German strings are much longer. In these cases, I ensure that the right - //justification of the traits don't overlap. If it would, I move it over to the right. + //Added support for the German version, which has potential string overrun problems. For example, the text "Skills:" can + //overlap "NightOps (Expert)" because the German strings are much longer. In these cases, I ensure that the right + //justification of the traits don't overlap. If it would, I move it over to the right. iWidth = StringPixLength( pPersonnelScreenStrings[ PRSNL_TXT_SKILLS ], PERS_FONT ); iMinimumX = iWidth + pPersonnelScreenPoints[bScreenLocIndex].x + iSlot * TEXT_BOX_WIDTH + 2; @@ -1865,16 +1858,16 @@ void DisplayCharStats(INT32 iId, INT32 iSlot) { swprintf( sString, L"%s %s", gzMercSkillText[bSkill1], gzMercSkillText[NUM_SKILLTRAITS] ); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[bScreenLocIndex].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[bScreenLocIndex].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); //KM: April 16, 1999 //Perform the potential overrun check if( sX <= iMinimumX ) { - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20 +TEXT_DELTA_OFFSET),0,30,0,sString, PERS_FONT, &sX, &sY); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20 +TEXT_DELTA_OFFSET),0,30,0,sString, PERS_FONT, &sX, &sY); sX = (INT16)max( sX, iMinimumX ); } - + mprintf(sX,pPersonnelScreenPoints[bScreenLocIndex].y,sString); } else @@ -1884,12 +1877,12 @@ void DisplayCharStats(INT32 iId, INT32 iSlot) { swprintf( sString, L"%s", gzMercSkillText[bSkill1] ); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[bScreenLocIndex].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[bScreenLocIndex].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); //KM: April 16, 1999 //Perform the potential overrun check sX = (INT16)max( sX, iMinimumX ); - + mprintf(sX,pPersonnelScreenPoints[bScreenLocIndex].y,sString); bScreenLocIndex++; @@ -1900,7 +1893,7 @@ void DisplayCharStats(INT32 iId, INT32 iSlot) { swprintf( sString, L"%s", gzMercSkillText[bSkill2] ); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[bScreenLocIndex].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[bScreenLocIndex].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); //KM: April 16, 1999 //Perform the potential overrun check @@ -1916,21 +1909,21 @@ void DisplayCharStats(INT32 iId, INT32 iSlot) { swprintf( sString, L"%s", pPersonnelScreenStrings[ PRSNL_TXT_NOSKILLS ] ); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[bScreenLocIndex].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[bScreenLocIndex].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); mprintf(sX,pPersonnelScreenPoints[bScreenLocIndex].y,sString); } } } - else - { - swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); - } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } } break; /* - case 19: - // total contract time served - mprintf((INT16)(pPersonnelScreenPoints[24].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[24].y,pPersonnelScreenStrings[18]); + case 19: + // total contract time served + mprintf((INT16)(pPersonnelScreenPoints[24].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[24].y,pPersonnelScreenStrings[18]); if( gMercProfiles[Menptr[iId].ubProfile].usTotalDaysServed > 0 ) { swprintf(sString, L"%d %s",gMercProfiles[Menptr[iId].ubProfile].usTotalDaysServed - 1, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ] ); @@ -1939,9 +1932,9 @@ void DisplayCharStats(INT32 iId, INT32 iSlot) { swprintf(sString, L"%d %s",gMercProfiles[Menptr[iId].ubProfile].usTotalDaysServed, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ] ); } - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[24].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[24].y,sString); - break; + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[24].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[24].y,sString); + break; */ } } @@ -1952,15 +1945,15 @@ void DisplayCharStats(INT32 iId, INT32 iSlot) INT32 GetLastMercId( void ) { // rolls through list of mercs and returns how many on team - SOLDIERTYPE *pSoldier, *pTeamSoldier; - INT32 cnt=0; + SOLDIERTYPE *pSoldier, *pTeamSoldier; + INT32 cnt=0; INT32 iCounter=0; - pSoldier = MercPtrs[0]; - + pSoldier = MercPtrs[0]; + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) { - if( ( pTeamSoldier->bActive ) && ( pTeamSoldier->bLife > 0 ) ) - iCounter++; + if( ( pTeamSoldier->bActive ) && ( pTeamSoldier->stats.bLife > 0 ) ) + iCounter++; } return iCounter; } @@ -1969,35 +1962,35 @@ INT32 GetLastMercId( void ) void DrawPageNumber( void ) { // draws the page number - + CHAR16 sString[10]; INT16 sX, sY; - INT32 iPageNumber, iLastPage; - + INT32 iPageNumber, iLastPage; + return; // get last page number, and current page too iLastPage=GetLastMercId()/MAX_SLOTS; iPageNumber=iStartPersonId/MAX_SLOTS; - iPageNumber++; + iPageNumber++; if(iLastPage==0) - iLastPage++; + iLastPage++; // get current and last pages swprintf(sString, L"%d/%d", iPageNumber, iLastPage); - + // set up font SetFont(PERS_FONT); SetFontForeground(FONT_BLACK); SetFontBackground(FONT_BLACK); SetFontShadow(NO_SHADOW); - + // center FindFontCenterCoordinates(PAGE_X, PAGE_Y,PAGE_BOX_WIDTH, PAGE_BOX_HEIGHT, sString, PERS_FONT, &sX, &sY); - + // print page number mprintf(sX, sY, sString); - + // reset shadow SetFontShadow(DEFAULT_SHADOW); @@ -2008,18 +2001,18 @@ void DrawPageNumber( void ) void SetPersonnelButtonStates( void ) { // this function will look at what page we are viewing, enable and disable buttons as needed - + if( ! PrevPersonnelFace( ) ) { // first page, disable left buttons - + // DisableButton( giPersonnelButton[ 2 ] ); DisableButton( giPersonnelButton[ 0 ] ); } else { // enable buttons - NextPersonnelFace( ); + NextPersonnelFace( ); // enable buttons // EnableButton( giPersonnelButton[ 2 ] ); @@ -2028,14 +2021,14 @@ void SetPersonnelButtonStates( void ) if( ! NextPersonnelFace( ) ) { - + // DisableButton( giPersonnelButton[ 3 ] ); DisableButton( giPersonnelButton[ 1 ] ); } else { - // decrement page - PrevPersonnelFace( ); + // decrement page + PrevPersonnelFace( ); // enable buttons // EnableButton( giPersonnelButton[ 3 ] ); EnableButton( giPersonnelButton[ 1 ] ); @@ -2054,13 +2047,13 @@ void RenderPersonnelScreenBackground( void ) if( fCurrentTeamMode == TRUE ) { // blit title - GetVideoObject(&hHandle, guiCURRENTTEAM); - + GetVideoObject(&hHandle, guiCURRENTTEAM); + } else { // blit title - GetVideoObject(&hHandle, guiDEPARTEDTEAM); + GetVideoObject(&hHandle, guiDEPARTEDTEAM); } BltVideoObject( FRAME_BUFFER, hHandle, 0,DEPARTED_X, DEPARTED_Y, VO_BLT_SRCTRANSPARENCY,NULL ); @@ -2072,18 +2065,18 @@ void RenderPersonnelScreenBackground( void ) BOOLEAN LoadPersonnelScreenBackgroundGraphics( void ) { // will load the graphics for the personeel screen background - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + // departed bar - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\departed.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiDEPARTEDTEAM)); // current bar - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\CurrentTeam.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiCURRENTTEAM)); - + return ( TRUE ); } @@ -2121,21 +2114,21 @@ void CreateDestroyButtonsForPersonnelDepartures( void ) INT32 GetNumberOfMercsOnPlayersTeam( void ) { - SOLDIERTYPE *pTeamSoldier, *pSoldier; + SOLDIERTYPE *pTeamSoldier, *pSoldier; INT32 cnt=0; INT32 iCounter = 0; - - - - // grab number on team - pSoldier = MercPtrs[0]; - + + + + // grab number on team + pSoldier = MercPtrs[0]; + // no soldiers - + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++, pTeamSoldier++) { - if( ( pTeamSoldier->bActive) && !( pTeamSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && ( pTeamSoldier->bLife > 0 ) ) + if( ( pTeamSoldier->bActive) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && ( pTeamSoldier->stats.bLife > 0 ) ) iCounter++; } @@ -2146,28 +2139,28 @@ INT32 GetNumberOfMercsOnPlayersTeam( void ) INT32 GetNumberOfMercsDeadOrAliveOnPlayersTeam( void ) { - SOLDIERTYPE *pTeamSoldier, *pSoldier; + SOLDIERTYPE *pTeamSoldier, *pSoldier; INT32 cnt=0; INT32 iCounter = 0; - - - - // grab number on team - pSoldier = MercPtrs[0]; - + + + + // grab number on team + pSoldier = MercPtrs[0]; + // no soldiers - + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++, pTeamSoldier++) { - if( ( pTeamSoldier->bActive) && !( pTeamSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if( ( pTeamSoldier->bActive) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) iCounter++; } return ( iCounter ); } -void CreateDestroyMouseRegionsForPersonnelPortraits( void ) +void CreateDestroyMouseRegionsForPersonnelPortraits( void ) { // creates/ destroys mouse regions for portraits @@ -2179,8 +2172,8 @@ void CreateDestroyMouseRegionsForPersonnelPortraits( void ) // create regions for( sCounter = 0; sCounter < PERSONNEL_PORTRAIT_NUMBER; sCounter++ ) { - MSYS_DefineRegion(&gPortraitMouseRegions[ sCounter ], ( INT16 ) ( SMALL_PORTRAIT_START_X + ( sCounter % PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_WIDTH ), ( INT16 ) ( SMALL_PORTRAIT_START_Y + ( sCounter / PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_HEIGHT ) , ( INT16 ) ( ( SMALL_PORTRAIT_START_X ) + ( ( sCounter % PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_WIDTH ) + SMALL_PORTRAIT_WIDTH ) , ( INT16 )( SMALL_PORTRAIT_START_Y + ( sCounter / PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_HEIGHT + SMALL_PORTRAIT_HEIGHT ), - MSYS_PRIORITY_HIGHEST,CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, PersonnelPortraitCallback); + MSYS_DefineRegion(&gPortraitMouseRegions[ sCounter ], ( INT16 ) ( SMALL_PORTRAIT_START_X + ( sCounter % PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_WIDTH ), ( INT16 ) ( SMALL_PORTRAIT_START_Y + ( sCounter / PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_HEIGHT ) , ( INT16 ) ( ( SMALL_PORTRAIT_START_X ) + ( ( sCounter % PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_WIDTH ) + SMALL_PORTRAIT_WIDTH ) , ( INT16 )( SMALL_PORTRAIT_START_Y + ( sCounter / PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_HEIGHT + SMALL_PORTRAIT_HEIGHT ), + MSYS_PRIORITY_HIGHEST,CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, PersonnelPortraitCallback); MSYS_SetRegionUserData( &gPortraitMouseRegions[ sCounter ] ,0 , sCounter ); MSYS_AddRegion( &gPortraitMouseRegions[ sCounter ] ); } @@ -2193,7 +2186,7 @@ void CreateDestroyMouseRegionsForPersonnelPortraits( void ) // destroy regions for( sCounter = 0; sCounter < PERSONNEL_PORTRAIT_NUMBER; sCounter++ ) { - MSYS_RemoveRegion( &gPortraitMouseRegions[ sCounter ] ); + MSYS_RemoveRegion( &gPortraitMouseRegions[ sCounter ] ); } fCreated = FALSE; @@ -2208,11 +2201,11 @@ BOOLEAN DisplayPicturesOfCurrentTeam( void ) INT32 iTotalOnTeam = 0; char sTemp[100]; HVOBJECT hFaceHandle; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; SOLDIERTYPE *pSoldier; INT32 iId = 0; INT32 iCnt = 0; - + // will display the 20 small portraits of the current team // get number of mercs on team @@ -2229,16 +2222,16 @@ BOOLEAN DisplayPicturesOfCurrentTeam( void ) // start id iId= gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; - + for( iCounter = 0; iCounter < iTotalOnTeam; iCnt++ ) { - if( ( MercPtrs[iId + iCnt ] -> bActive == TRUE ) ) + if( ( MercPtrs[iId + iCnt ]->bActive == TRUE ) ) { // found the next actual guy - if( ( 50 < MercPtrs[iId + iCnt ] -> ubProfile )&&( 57 > MercPtrs[iId + iCnt ] -> ubProfile ) ) + if( ( 50 < MercPtrs[iId + iCnt ] ->ubProfile )&&( 57 > MercPtrs[iId + iCnt ]->ubProfile ) ) { - sprintf( sTemp, "%s%03d.sti", SMALL_FACES_DIR, gMercProfiles[ MercPtrs[ iId + iCnt ] -> ubProfile ].ubFaceIndex ); + sprintf( sTemp, "%s%03d.sti", SMALL_FACES_DIR, gMercProfiles[ MercPtrs[ iId + iCnt ]->ubProfile ].ubFaceIndex ); } else { @@ -2251,27 +2244,27 @@ BOOLEAN DisplayPicturesOfCurrentTeam( void ) sprintf(sTemp, "%s%03d.sti", SMALL_FACES_DIR, Menptr[ iId + iCnt ].ubProfile); } } - + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP(sTemp, VObjectDesc.ImageFile); + FilenameForBPP(sTemp, VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiFACE)); - //Blt face to screen to + //Blt face to screen to GetVideoObject(&hFaceHandle, guiFACE); - if( Menptr[ iId + iCnt ].bLife <= 0 ) + if( Menptr[ iId + iCnt ].stats.bLife <= 0 ) { hFaceHandle->pShades[ 0 ] = Create16BPPPaletteShaded( hFaceHandle->pPaletteEntry, DEAD_MERC_COLOR_RED, DEAD_MERC_COLOR_GREEN, DEAD_MERC_COLOR_BLUE, TRUE ); - + //set the red pallete to the face SetObjectHandleShade( guiFACE, 0 ); } - - + + BltVideoObject(FRAME_BUFFER, hFaceHandle, 0,( INT16 ) ( SMALL_PORTRAIT_START_X+ ( iCounter % PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_WIDTH ), ( INT16 ) ( SMALL_PORTRAIT_START_Y + ( iCounter / PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_HEIGHT ), VO_BLT_SRCTRANSPARENCY,NULL); - - if( Menptr[ iId + iCnt ].bLife <= 0 ) + + if( Menptr[ iId + iCnt ].stats.bLife <= 0 ) { //if the merc is dead, display it DrawTextToScreen(AimPopUpText[AIM_MEMBER_DEAD], ( INT16 ) ( SMALL_PORTRAIT_START_X+ ( iCounter % PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_WIDTH ), ( INT16 ) ( SMALL_PORTRAIT_START_Y + ( iCounter / PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_HEIGHT + SMALL_PORT_HEIGHT / 2 ), SMALL_PORTRAIT_WIDTH_NO_BORDERS, FONT10ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); @@ -2297,19 +2290,19 @@ void PersonnelPortraitCallback( MOUSE_REGION * pRegion, INT32 iReason ) // callback handler for the minize region that is attatched to the laptop program icon if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) - { + { // get id of portrait if( fCurrentTeamMode == TRUE ) { - // valid portrait, set up id + // valid portrait, set up id if( iPortraitId >= GetNumberOfMercsDeadOrAliveOnPlayersTeam( ) ) { - // not a valid id, leave - return; + // not a valid id, leave + return; } - iCurrentPersonSelectedId = iPortraitId; + iCurrentPersonSelectedId = iPortraitId; fReDrawScreenFlag = TRUE; } else @@ -2340,11 +2333,11 @@ void PersonnelPortraitCallback( MOUSE_REGION * pRegion, INT32 iReason ) { if( fCurrentTeamMode == TRUE ) { - // valid portrait, set up id + // valid portrait, set up id if( iPortraitId >= GetNumberOfMercsDeadOrAliveOnPlayersTeam( ) ) { - // not a valid id, leave - return; + // not a valid id, leave + return; } //if the user is rigt clicking on the same face @@ -2356,7 +2349,7 @@ void PersonnelPortraitCallback( MOUSE_REGION * pRegion, INT32 iReason ) else gubPersonnelInfoState = PERSONNEL_STAT_BTN; } - + iCurrentPersonSelectedId = iPortraitId; fReDrawScreenFlag = TRUE; @@ -2376,18 +2369,18 @@ void PersonnelPortraitCallback( MOUSE_REGION * pRegion, INT32 iReason ) void DisplayFaceOfDisplayedMerc( ) { // valid person?, display - + if( iCurrentPersonSelectedId != -1 ) { // highlight it DisplayHighLightBox( ); // if showing inventory, leave - + if( fCurrentTeamMode == TRUE ) { - RenderPersonnelFace( GetIdOfThisSlot( iCurrentPersonSelectedId ), 0, FALSE, FALSE, FALSE ); - DisplayCharName( GetIdOfThisSlot( iCurrentPersonSelectedId ), 0 ); + RenderPersonnelFace( GetIdOfThisSlot( iCurrentPersonSelectedId ), 0, FALSE, FALSE, FALSE ); + DisplayCharName( GetIdOfThisSlot( iCurrentPersonSelectedId ), 0 ); // if( fShowInventory == TRUE ) if( gubPersonnelInfoState == PRSNL_INV ) @@ -2395,13 +2388,13 @@ void DisplayFaceOfDisplayedMerc( ) return; } - RenderPersonnelStats( GetIdOfThisSlot( iCurrentPersonSelectedId ), 0 ); - + RenderPersonnelStats( GetIdOfThisSlot( iCurrentPersonSelectedId ), 0 ); + } else { - RenderPersonnelFace( GetIdOfPastMercInSlot( iCurrentPersonSelectedId ), 0, IsPastMercDead( iCurrentPersonSelectedId ), IsPastMercFired( iCurrentPersonSelectedId ), IsPastMercOther( iCurrentPersonSelectedId ) ); - DisplayDepartedCharName( GetIdOfPastMercInSlot( iCurrentPersonSelectedId ), 0, GetTheStateOfDepartedMerc( GetIdOfPastMercInSlot( iCurrentPersonSelectedId ) ) ); + RenderPersonnelFace( GetIdOfPastMercInSlot( iCurrentPersonSelectedId ), 0, IsPastMercDead( iCurrentPersonSelectedId ), IsPastMercFired( iCurrentPersonSelectedId ), IsPastMercOther( iCurrentPersonSelectedId ) ); + DisplayDepartedCharName( GetIdOfPastMercInSlot( iCurrentPersonSelectedId ), 0, GetTheStateOfDepartedMerc( GetIdOfPastMercInSlot( iCurrentPersonSelectedId ) ) ); // if( fShowInventory == TRUE ) if( gubPersonnelInfoState == PRSNL_INV ) @@ -2409,10 +2402,10 @@ void DisplayFaceOfDisplayedMerc( ) return; } - DisplayDepartedCharStats( GetIdOfPastMercInSlot( iCurrentPersonSelectedId ), 0, GetTheStateOfDepartedMerc( GetIdOfPastMercInSlot( iCurrentPersonSelectedId ) ) ); + DisplayDepartedCharStats( GetIdOfPastMercInSlot( iCurrentPersonSelectedId ), 0, GetTheStateOfDepartedMerc( GetIdOfPastMercInSlot( iCurrentPersonSelectedId ) ) ); } - + } @@ -2461,7 +2454,7 @@ void RenderInventoryForCharacter( INT32 iId, INT32 iSlot ) INT32 iTotalAmmo = 0; GetVideoObject(&hHandle, guiPersonnelInventory); - BltVideoObject(FRAME_BUFFER, hHandle, 0,( INT16 ) ( iScreenWidthOffset + 397 ), ( INT16 ) ( iScreenHeightOffset + 200 ), VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 0,( INT16 ) ( iScreenWidthOffset + 397 ), ( INT16 ) ( iScreenHeightOffset + 200 ), VO_BLT_SRCTRANSPARENCY,NULL); if( fCurrentTeamMode == FALSE ) { @@ -2478,8 +2471,8 @@ void RenderInventoryForCharacter( INT32 iId, INT32 iSlot ) { return; } - - for( ubCounter = 0; ubCounter < NUM_INV_SLOTS; ubCounter++ ) + + for( ubCounter = 0; ubCounter < pSoldier->inv.size(); ubCounter++ ) { PosX = iScreenWidthOffset + 397 + 3; PosY = iScreenHeightOffset + 200 + 8 +( ubItemCount * ( 29 ) ); @@ -2490,7 +2483,7 @@ void RenderInventoryForCharacter( INT32 iId, INT32 iSlot ) continue; } - if( pSoldier->inv[ ubCounter ].ubNumberOfObjects ) + if( pSoldier->inv[ ubCounter ].exists() == true ) { if( uiCurrentInventoryIndex > ubUpToCount ) { @@ -2500,30 +2493,30 @@ void RenderInventoryForCharacter( INT32 iId, INT32 iSlot ) { sIndex = ( pSoldier->inv[ ubCounter ].usItem ); pItem = &Item[ sIndex ]; - + GetVideoObject( &hHandle, GetInterfaceGraphicForItem( pItem ) ); pTrav = &(hHandle->pETRLEObject[ pItem->ubGraphicNum ] ); - + usHeight = (UINT32)pTrav->usHeight; usWidth = (UINT32)pTrav->usWidth; - sCenX = PosX + ( abs( 57 - usWidth ) / 2 ) - pTrav->sOffsetX; + sCenX = PosX + ( abs( 57 - usWidth ) / 2 ) - pTrav->sOffsetX; sCenY = PosY + ( abs( 22 - usHeight ) / 2 ) - pTrav->sOffsetY; // shadow if(gGameSettings.fOptions[ TOPTION_SHOW_ITEM_SHADOW ]) BltVideoObjectOutlineShadowFromIndex( FRAME_BUFFER, GetInterfaceGraphicForItem( pItem ), pItem->ubGraphicNum, sCenX-2, sCenY+2); - + //blt the item BltVideoObjectOutlineFromIndex( FRAME_BUFFER, GetInterfaceGraphicForItem( pItem ), pItem->ubGraphicNum, sCenX, sCenY, 0, FALSE ); - + SetFont( FONT10ARIAL ); SetFontForeground( FONT_WHITE ); SetFontBackground( FONT_BLACK ); SetFontDestBuffer( FRAME_BUFFER, 0,0,SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); - + // grab item name LoadItemInfo(sIndex, sString, NULL ); - + // shorten if needed if( StringPixLength( sString, FONT10ARIAL) > ( 171 - 75 ) ) { @@ -2538,57 +2531,49 @@ void RenderInventoryForCharacter( INT32 iId, INT32 iSlot ) { // Ammo iTotalAmmo = 0; - if( pSoldier->inv[ ubCounter ].ubNumberOfObjects > 1 ) + for( cnt = 0; cnt < pSoldier->inv[ ubCounter ].ubNumberOfObjects; cnt++ ) { - for( cnt = 0; cnt < pSoldier->inv[ ubCounter ].ubNumberOfObjects; cnt++ ) - { - // get total ammo - iTotalAmmo+= pSoldier->inv[ ubCounter ].ItemData.Ammo.ubShotsLeft[cnt]; - } + // get total ammo + iTotalAmmo += pSoldier->inv[ ubCounter ][cnt]->data.ubShotsLeft; } - else - { - iTotalAmmo= pSoldier->inv[ ubCounter ].ItemData.Ammo.ubShotsLeft[ 0 ]; - } - swprintf( sString, L"%d/%d", iTotalAmmo, ( pSoldier->inv[ ubCounter ].ubNumberOfObjects * Magazine[ Item[pSoldier->inv[ ubCounter ].usItem ].ubClassIndex ].ubMagSize ) ); - FindFontRightCoordinates( ( INT16 )( PosX + 65 ), ( INT16 ) ( PosY + 15 ), ( INT16 ) ( 171 - 75 ), + FindFontRightCoordinates( ( INT16 )( PosX + 65 ), ( INT16 ) ( PosY + 15 ), ( INT16 ) ( 171 - 75 ), ( INT16 )( GetFontHeight( FONT10ARIAL ) ), sString, FONT10ARIAL, &sX, &sY ); } else { - swprintf( sString, L"%2d%%%%", pSoldier->inv[ ubCounter ].ItemData.Generic.bStatus[0] ); - FindFontRightCoordinates( ( INT16 )( PosX + 65 ), ( INT16 ) ( PosY + 15 ), ( INT16 ) ( 171 - 75 ), + swprintf( sString, L"%2d%%%%", pSoldier->inv[ ubCounter ][0]->data.objectStatus ); + FindFontRightCoordinates( ( INT16 )( PosX + 65 ), ( INT16 ) ( PosY + 15 ), ( INT16 ) ( 171 - 75 ), ( INT16 )( GetFontHeight( FONT10ARIAL ) ), sString, FONT10ARIAL, &sX, &sY ); - + sX += StringPixLength( L"%", FONT10ARIAL ); } - - + + mprintf( sX, sY, sString ); - + if ( Item[pSoldier->inv[ ubCounter ].usItem ].usItemClass & IC_GUN ) { - swprintf( sString, L"%s", AmmoCaliber[ Weapon[ Item[ pSoldier->inv[ ubCounter ].usItem ].ubClassIndex ].ubCalibre ]); - + swprintf( sString, L"%s", AmmoCaliber[ Weapon[ Item[ pSoldier->inv[ ubCounter ].usItem ].ubClassIndex ].ubCalibre ]); + // shorten if needed if( StringPixLength( sString, FONT10ARIAL) > ( 171 - 75 ) ) { ReduceStringLength( sString, ( 171 - 75 ), FONT10ARIAL ); } - + // print name mprintf( PosX + 65, PosY + 15 , sString ); } - + // if more than 1? if( pSoldier->inv[ ubCounter ].ubNumberOfObjects > 1 ) { - swprintf( sString, L"x%d", pSoldier->inv[ ubCounter ].ubNumberOfObjects ); - FindFontRightCoordinates( ( INT16 )( PosX ), ( INT16 ) ( PosY + 15 ), ( INT16 ) ( 58 ), + swprintf( sString, L"x%d", pSoldier->inv[ ubCounter ].ubNumberOfObjects ); + FindFontRightCoordinates( ( INT16 )( PosX ), ( INT16 ) ( PosY + 15 ), ( INT16 ) ( 58 ), ( INT16 )( GetFontHeight( FONT10ARIAL ) ), sString, FONT10ARIAL, &sX, &sY ); mprintf( sX, sY, sString ); } @@ -2601,10 +2586,10 @@ void RenderInventoryForCharacter( INT32 iId, INT32 iSlot ) if( ubItemCount == NUMBER_OF_INVENTORY_PERSONNEL ) { - ubCounter = NUM_INV_SLOTS; + break; } } - + return; @@ -2613,18 +2598,13 @@ void RenderInventoryForCharacter( INT32 iId, INT32 iSlot ) void InventoryUpButtonCallback(GUI_BUTTON *btn,INT32 reason) { - INT32 iValue = 0; - SOLDIERTYPE *pSoldier = MercPtrs[ 0 ]; - INT32 cnt = 0; - INT32 iId = 0; - if (!(btn->uiFlags & BUTTON_ENABLED)) return; if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { @@ -2636,7 +2616,7 @@ void InventoryUpButtonCallback(GUI_BUTTON *btn,INT32 reason) { return; } - + // up one element uiCurrentInventoryIndex--; fReDrawScreenFlag = TRUE; @@ -2661,15 +2641,9 @@ void InventoryUpButtonCallback(GUI_BUTTON *btn,INT32 reason) void InventoryDownButtonCallback(GUI_BUTTON *btn,INT32 reason) { - INT32 iValue = 0; - SOLDIERTYPE *pSoldier = MercPtrs[ 0 ]; - INT32 cnt = 0; - INT32 iId = 0; - if (!(btn->uiFlags & BUTTON_ENABLED)) return; - if(reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) { if( ( INT32 )uiCurrentInventoryIndex >= ( INT32 )( GetNumberOfInventoryItemsOnCurrentMerc( ) - NUMBER_OF_INVENTORY_PERSONNEL ) ) @@ -2685,7 +2659,7 @@ void InventoryDownButtonCallback(GUI_BUTTON *btn,INT32 reason) } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { @@ -2697,7 +2671,7 @@ void InventoryDownButtonCallback(GUI_BUTTON *btn,INT32 reason) { return; } - + // up one element uiCurrentInventoryIndex++; fReDrawScreenFlag = TRUE; @@ -2706,7 +2680,7 @@ void InventoryDownButtonCallback(GUI_BUTTON *btn,INT32 reason) } } - + } @@ -2722,14 +2696,14 @@ void EnableDisableInventoryScrollButtons( void ) if( uiCurrentInventoryIndex == 0 ) { ButtonList[ giPersonnelInventoryButtons[ 0 ] ]->uiFlags &= ~( BUTTON_CLICKED_ON ); - DisableButton( giPersonnelInventoryButtons[ 0 ] ); + DisableButton( giPersonnelInventoryButtons[ 0 ] ); } else { EnableButton( giPersonnelInventoryButtons[ 0 ] ); } - - + + if( ( INT32 )uiCurrentInventoryIndex >= ( INT32 )( GetNumberOfInventoryItemsOnCurrentMerc( ) - NUMBER_OF_INVENTORY_PERSONNEL ) ) { ButtonList[ giPersonnelInventoryButtons[ 1 ] ]->uiFlags &= ~( BUTTON_CLICKED_ON ); @@ -2761,9 +2735,9 @@ INT32 GetNumberOfInventoryItemsOnCurrentMerc( void ) pSoldier = &Menptr[ iId ]; - for( ubCounter = 0; ubCounter < NUM_INV_SLOTS; ubCounter++ ) + for( ubCounter = 0; ubCounter < pSoldier->inv.size(); ubCounter++ ) { - if( ( pSoldier->inv[ ubCounter ].ubNumberOfObjects ) && ( pSoldier->inv[ ubCounter ].usItem) ) + if( ( pSoldier->inv[ ubCounter ].exists() == true) ) { ubCount++; } @@ -2780,19 +2754,19 @@ void CreateDestroyPersonnelInventoryScrollButtons( void ) if( ( gubPersonnelInfoState == PRSNL_INV ) && ( fCreated == FALSE ) ) { // create buttons - giPersonnelInventoryButtonsImages[ 0 ]= LoadButtonImage( "LAPTOP\\personnel_inventory.sti" ,-1,1,-1,2,-1 ); - giPersonnelInventoryButtons[ 0 ] = QuickCreateButton( giPersonnelInventoryButtonsImages[0], iScreenWidthOffset + 176 + 397, iScreenHeightOffset + 2 + 200, - BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + giPersonnelInventoryButtonsImages[ 0 ]= LoadButtonImage( "LAPTOP\\personnel_inventory.sti" ,-1,1,-1,2,-1 ); + giPersonnelInventoryButtons[ 0 ] = QuickCreateButton( giPersonnelInventoryButtonsImages[0], iScreenWidthOffset + 176 + 397, iScreenHeightOffset + 2 + 200, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)InventoryUpButtonCallback); - giPersonnelInventoryButtonsImages[ 1 ]= LoadButtonImage( "LAPTOP\\personnel_inventory.sti" ,-1,3,-1,4,-1 ); - giPersonnelInventoryButtons[ 1 ] = QuickCreateButton( giPersonnelInventoryButtonsImages[1], iScreenWidthOffset + 397 + 176, iScreenHeightOffset + 200 + 223, - BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + giPersonnelInventoryButtonsImages[ 1 ]= LoadButtonImage( "LAPTOP\\personnel_inventory.sti" ,-1,3,-1,4,-1 ); + giPersonnelInventoryButtons[ 1 ] = QuickCreateButton( giPersonnelInventoryButtonsImages[1], iScreenWidthOffset + 397 + 176, iScreenHeightOffset + 200 + 223, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)InventoryDownButtonCallback); // set up cursors for these buttons SetButtonCursor( giPersonnelInventoryButtons[ 0 ], CURSOR_LAPTOP_SCREEN); - SetButtonCursor( giPersonnelInventoryButtons[ 1 ], CURSOR_LAPTOP_SCREEN); + SetButtonCursor( giPersonnelInventoryButtons[ 1 ], CURSOR_LAPTOP_SCREEN); MSYS_DefineRegion( &gMouseScrollPersonnelINV, X_OF_PERSONNEL_SCROLL_REGION, Y_OF_PERSONNEL_SCROLL_REGION, X_OF_PERSONNEL_SCROLL_REGION + X_SIZE_OF_PERSONNEL_SCROLL_REGION, Y_OF_PERSONNEL_SCROLL_REGION + Y_SIZE_OF_PERSONNEL_SCROLL_REGION, MSYS_PRIORITY_HIGHEST - 3, CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, HandleSliderBarClickCallback ); @@ -2804,9 +2778,9 @@ void CreateDestroyPersonnelInventoryScrollButtons( void ) { // destroy buttons RemoveButton(giPersonnelInventoryButtons[0] ); - UnloadButtonImage(giPersonnelInventoryButtonsImages[0] ); - RemoveButton(giPersonnelInventoryButtons[1] ); - UnloadButtonImage(giPersonnelInventoryButtonsImages[1] ); + UnloadButtonImage(giPersonnelInventoryButtonsImages[0] ); + RemoveButton(giPersonnelInventoryButtons[1] ); + UnloadButtonImage(giPersonnelInventoryButtonsImages[1] ); MSYS_RemoveRegion( &gMouseScrollPersonnelINV ); @@ -2840,7 +2814,7 @@ void DisplayNumberOnCurrentTeam( void ) } mprintf( sX, PERS_CURR_TEAM_Y, sString ); - + // now the cost of the current team, if applicable DisplayCostOfCurrentTeam( ); @@ -2873,7 +2847,7 @@ void DisplayNumberDeparted( void ) mprintf( sX, PERS_DEPART_TEAM_Y, sString ); - + return; } @@ -2882,55 +2856,54 @@ INT32 GetTotalDailyCostOfCurrentTeam( void ) { // will return the total daily cost of the current team - SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pSoldier; INT32 cnt=0; - INT32 iCounter = 0; INT32 iCostOfTeam = 0; - // first grunt - pSoldier = MercPtrs[0]; + // first grunt + pSoldier = MercPtrs[0]; // not active?..return cost of zero // run through active soldiers for ( pSoldier = MercPtrs[ 0 ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++ ) { - pSoldier = MercPtrs[cnt]; + pSoldier = MercPtrs[cnt]; - if( ( pSoldier->bActive) && ( pSoldier->bLife > 0 ) ) - { - - // valid soldier, get cost - if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) - { - // daily rate - if( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK ) - { - // 2 week contract - iCostOfTeam += gMercProfiles[pSoldier->ubProfile].uiBiWeeklySalary / 14; - } - else if( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_1_WEEK ) - { - // 1 week contract - iCostOfTeam += gMercProfiles[ pSoldier->ubProfile ].uiWeeklySalary / 7 ; - } - else - { + if( ( pSoldier->bActive) && ( pSoldier->stats.bLife > 0 ) ) + { - iCostOfTeam += gMercProfiles[ pSoldier->ubProfile ].sSalary; - } - } - else if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__MERC) - { - // MERC Merc - iCostOfTeam += gMercProfiles[ pSoldier->ubProfile ].sSalary; - } - else - { + // valid soldier, get cost + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) + { + // daily rate + if( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK ) + { + // 2 week contract + iCostOfTeam += gMercProfiles[pSoldier->ubProfile].uiBiWeeklySalary / 14; + } + else if( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_1_WEEK ) + { + // 1 week contract + iCostOfTeam += gMercProfiles[ pSoldier->ubProfile ].uiWeeklySalary / 7 ; + } + else + { + + iCostOfTeam += gMercProfiles[ pSoldier->ubProfile ].sSalary; + } + } + else if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__MERC) + { + // MERC Merc + iCostOfTeam += gMercProfiles[ pSoldier->ubProfile ].sSalary; + } + else + { // no cost - iCostOfTeam += 0; - } + iCostOfTeam += 0; + } } } return iCostOfTeam; @@ -2940,15 +2913,14 @@ INT32 GetLowestDailyCostOfCurrentTeam( void ) { // will return the lowest daily cost of the current team - SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pSoldier; INT32 cnt=0; - INT32 iCounter = 0; INT32 iLowest = 999999; // INT32 iId =0; INT32 iCost = 0; - // first grunt - pSoldier = MercPtrs[0]; + // first grunt + pSoldier = MercPtrs[0]; // not active?..return cost of zero @@ -2957,45 +2929,45 @@ INT32 GetLowestDailyCostOfCurrentTeam( void ) { pSoldier = MercPtrs[cnt]; - if( ( pSoldier->bActive ) && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && ( pSoldier->bLife > 0 ) ) + if( ( pSoldier->bActive ) && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && ( pSoldier->stats.bLife > 0 ) ) { - // valid soldier, get cost - if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) - { - // daily rate - if( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK ) - { - // 2 week contract - iCost = gMercProfiles[ pSoldier->ubProfile ].uiBiWeeklySalary / 14; - } - else if( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_1_WEEK ) - { - // 1 week contract - iCost = gMercProfiles[ pSoldier->ubProfile ].uiWeeklySalary / 7 ; - } - else - { + // valid soldier, get cost + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) + { + // daily rate + if( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK ) + { + // 2 week contract + iCost = gMercProfiles[ pSoldier->ubProfile ].uiBiWeeklySalary / 14; + } + else if( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_1_WEEK ) + { + // 1 week contract + iCost = gMercProfiles[ pSoldier->ubProfile ].uiWeeklySalary / 7 ; + } + else + { - iCost = gMercProfiles[ pSoldier->ubProfile ].sSalary; - } - } - else if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__MERC) - { - // MERC Merc - iCost = gMercProfiles[ pSoldier->ubProfile ].sSalary; - } - else - { + iCost = gMercProfiles[ pSoldier->ubProfile ].sSalary; + } + } + else if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__MERC) + { + // MERC Merc + iCost = gMercProfiles[ pSoldier->ubProfile ].sSalary; + } + else + { // no cost - iCost = 0; - } + iCost = 0; + } + + if( iCost <= iLowest ) + { + iLowest = iCost; + } + } - if( iCost <= iLowest ) - { - iLowest = iCost; - } - } - } // if no mercs, send 0 @@ -3013,15 +2985,14 @@ INT32 GetHighestDailyCostOfCurrentTeam( void ) { // will return the lowest daily cost of the current team - SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pSoldier; INT32 cnt=0; - INT32 iCounter = 0; INT32 iHighest = 0; // INT32 iId =0; INT32 iCost = 0; - // first grunt - pSoldier = MercPtrs[0]; + // first grunt + pSoldier = MercPtrs[0]; // not active?..return cost of zero @@ -3030,47 +3001,47 @@ INT32 GetHighestDailyCostOfCurrentTeam( void ) { pSoldier = MercPtrs[cnt]; - if( ( pSoldier->bActive) && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && ( pSoldier->bLife > 0 ) ) - { - - // valid soldier, get cost - if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) - { - // daily rate - if( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK ) - { - // 2 week contract - iCost = gMercProfiles[ pSoldier->ubProfile ].uiBiWeeklySalary / 14; - } - else if( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_1_WEEK ) - { - // 1 week contract - iCost = gMercProfiles[ pSoldier->ubProfile ].uiWeeklySalary / 7 ; - } - else - { + if( ( pSoldier->bActive) && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && ( pSoldier->stats.bLife > 0 ) ) + { - iCost = gMercProfiles[ pSoldier->ubProfile ].sSalary; - } - } - else if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__MERC) - { - // MERC Merc - iCost = gMercProfiles[ pSoldier->ubProfile ].sSalary; - } - else - { + // valid soldier, get cost + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) + { + // daily rate + if( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK ) + { + // 2 week contract + iCost = gMercProfiles[ pSoldier->ubProfile ].uiBiWeeklySalary / 14; + } + else if( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_1_WEEK ) + { + // 1 week contract + iCost = gMercProfiles[ pSoldier->ubProfile ].uiWeeklySalary / 7 ; + } + else + { + + iCost = gMercProfiles[ pSoldier->ubProfile ].sSalary; + } + } + else if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__MERC) + { + // MERC Merc + iCost = gMercProfiles[ pSoldier->ubProfile ].sSalary; + } + else + { // no cost - iCost = 0; - } + iCost = 0; + } + + + if( iCost >= iHighest ) + { + iHighest = iCost; + } + } - - if( iCost >= iHighest ) - { - iHighest = iCost; - } - } - } return iHighest; } @@ -3082,8 +3053,8 @@ void DisplayCostOfCurrentTeam( void ) // display number on team CHAR16 sString[ 32 ]; INT16 sX, sY; - - + + // font stuff SetFont( FONT10ARIAL ); SetFontBackground( FONT_BLACK ); @@ -3093,35 +3064,35 @@ void DisplayCostOfCurrentTeam( void ) { // daily cost - mprintf( PERS_CURR_TEAM_COST_X, PERS_CURR_TEAM_COST_Y, pPersonelTeamStrings[ 2 ] ); + mprintf( PERS_CURR_TEAM_COST_X, PERS_CURR_TEAM_COST_Y, pPersonelTeamStrings[ 2 ] ); - swprintf( sString, L"%d", GetTotalDailyCostOfCurrentTeam( ) ); + swprintf( sString, L"%d", GetTotalDailyCostOfCurrentTeam( ) ); InsertCommasForDollarFigure( sString ); InsertDollarSignInToString( sString ); - FindFontRightCoordinates((INT16)(PERS_CURR_TEAM_COST_X),0,PERS_CURR_TEAM_WIDTH,0,sString, PERS_FONT, &sX, &sY); + FindFontRightCoordinates((INT16)(PERS_CURR_TEAM_COST_X),0,PERS_CURR_TEAM_WIDTH,0,sString, PERS_FONT, &sX, &sY); mprintf( sX ,PERS_CURR_TEAM_COST_Y, sString ); // highest cost - mprintf( PERS_CURR_TEAM_COST_X, PERS_CURR_TEAM_HIGHEST_Y, pPersonelTeamStrings[ 3 ] ); + mprintf( PERS_CURR_TEAM_COST_X, PERS_CURR_TEAM_HIGHEST_Y, pPersonelTeamStrings[ 3 ] ); - swprintf( sString, L"%d", GetHighestDailyCostOfCurrentTeam( ) ); + swprintf( sString, L"%d", GetHighestDailyCostOfCurrentTeam( ) ); InsertCommasForDollarFigure( sString ); InsertDollarSignInToString( sString ); - FindFontRightCoordinates((INT16)(PERS_CURR_TEAM_COST_X),0,PERS_CURR_TEAM_WIDTH,0,sString, PERS_FONT, &sX, &sY); + FindFontRightCoordinates((INT16)(PERS_CURR_TEAM_COST_X),0,PERS_CURR_TEAM_WIDTH,0,sString, PERS_FONT, &sX, &sY); mprintf( sX ,PERS_CURR_TEAM_HIGHEST_Y, sString ); // the lowest cost - mprintf( PERS_CURR_TEAM_COST_X, PERS_CURR_TEAM_LOWEST_Y, pPersonelTeamStrings[ 4 ] ); + mprintf( PERS_CURR_TEAM_COST_X, PERS_CURR_TEAM_LOWEST_Y, pPersonelTeamStrings[ 4 ] ); - swprintf( sString, L"%d", GetLowestDailyCostOfCurrentTeam( ) ); + swprintf( sString, L"%d", GetLowestDailyCostOfCurrentTeam( ) ); InsertCommasForDollarFigure( sString ); InsertDollarSignInToString( sString ); - FindFontRightCoordinates((INT16)(PERS_CURR_TEAM_COST_X),0,PERS_CURR_TEAM_WIDTH,0,sString, PERS_FONT, &sX, &sY); + FindFontRightCoordinates((INT16)(PERS_CURR_TEAM_COST_X),0,PERS_CURR_TEAM_WIDTH,0,sString, PERS_FONT, &sX, &sY); mprintf( sX ,PERS_CURR_TEAM_LOWEST_Y, sString ); @@ -3137,12 +3108,11 @@ void DisplayCostOfCurrentTeam( void ) INT32 GetIdOfDepartedMercWithHighestStat( INT32 iStat ) { // will return the id value of the merc on the players team with highest in this stat - // -1 means error + // -1 means error INT32 iId = -1; INT32 iValue =0; MERCPROFILESTRUCT *pTeamSoldier; INT32 cnt=0; - INT32 iCounter =0; INT8 bCurrentList = 0; INT16 *bCurrentListValue = LaptopSaveInfo.ubDeadCharactersList; BOOLEAN fNotDone = TRUE; @@ -3176,14 +3146,14 @@ INT32 GetIdOfDepartedMercWithHighestStat( INT32 iStat ) if( bCurrentList == 0 ) { bCurrentList = 1; - bCurrentListValue = LaptopSaveInfo.ubLeftCharactersList; + bCurrentListValue = LaptopSaveInfo.ubLeftCharactersList; } else if( bCurrentList == 1 ) { bCurrentList = 2; bCurrentListValue = LaptopSaveInfo.ubOtherCharactersList; } - + //reset the loop counter uiLoopCounter = 0; } @@ -3205,105 +3175,105 @@ INT32 GetIdOfDepartedMercWithHighestStat( INT32 iStat ) case 0: // health - //if the soldier is a pow, dont use the health cause it aint known + //if the soldier is a pow, dont use the health cause it aint known pSoldier = FindSoldierByProfileID( (UINT8)cnt, FALSE ); if( pSoldier && pSoldier->bAssignment == ASSIGNMENT_POW ) { continue; } - if( pTeamSoldier -> bLife >= iValue ) + if( pTeamSoldier->bLife >= iValue ) { iId = cnt; - iValue = pTeamSoldier -> bLife; + iValue = pTeamSoldier->bLife; } break; - case 1: - // agility - if( pTeamSoldier -> bAgility >= iValue ) + case 1: + // agility + if( pTeamSoldier->bAgility >= iValue ) { iId = cnt; - iValue = pTeamSoldier -> bAgility; + iValue = pTeamSoldier->bAgility; } break; case 2: // dexterity - if( pTeamSoldier -> bDexterity >= iValue ) + if( pTeamSoldier->bDexterity >= iValue ) { iId = cnt; - iValue = pTeamSoldier -> bDexterity; + iValue = pTeamSoldier->bDexterity; } break; case 3: // strength - if( pTeamSoldier -> bStrength >= iValue ) + if( pTeamSoldier->bStrength >= iValue ) { iId = cnt; - iValue = pTeamSoldier -> bStrength; - } + iValue = pTeamSoldier->bStrength; + } break; case 4: // leadership - if( pTeamSoldier -> bLeadership >= iValue ) + if( pTeamSoldier->bLeadership >= iValue ) { iId = cnt; - iValue = pTeamSoldier -> bLeadership; - } + iValue = pTeamSoldier->bLeadership; + } break; case 5: - // wisdom - if( pTeamSoldier -> bWisdom >= iValue ) + // wisdom + if( pTeamSoldier->bWisdom >= iValue ) { iId = cnt; - iValue = pTeamSoldier -> bWisdom; + iValue = pTeamSoldier->bWisdom; } break; case 6: // exper - if( pTeamSoldier -> bExpLevel >= iValue ) + if( pTeamSoldier->bExpLevel >= iValue ) { iId = cnt; - iValue = pTeamSoldier -> bExpLevel; - } + iValue = pTeamSoldier->bExpLevel; + } break; case 7: //mrkmanship - if( pTeamSoldier -> bMarksmanship >= iValue ) + if( pTeamSoldier->bMarksmanship >= iValue ) { iId = cnt; - iValue = pTeamSoldier -> bMarksmanship; + iValue = pTeamSoldier->bMarksmanship; } - - break; + + break; case 8: // mech - if( pTeamSoldier -> bMechanical >= iValue ) + if( pTeamSoldier->bMechanical >= iValue ) { iId = cnt; - iValue = pTeamSoldier -> bMechanical; + iValue = pTeamSoldier->bMechanical; } - break; + break; case 9: // exp - if(pTeamSoldier -> bExplosive >= iValue ) + if(pTeamSoldier->bExplosive >= iValue ) { iId = cnt; - iValue = pTeamSoldier -> bExplosive; + iValue = pTeamSoldier->bExplosive; } break; case 10: // med - if( pTeamSoldier -> bMedical >= iValue ) + if( pTeamSoldier->bMedical >= iValue ) { iId = cnt; - iValue = pTeamSoldier -> bMedical; + iValue = pTeamSoldier->bMedical; } break; } bCurrentListValue++; - } + } return( iId ); @@ -3313,12 +3283,11 @@ INT32 GetIdOfDepartedMercWithHighestStat( INT32 iStat ) INT32 GetIdOfDepartedMercWithLowestStat( INT32 iStat ) { // will return the id value of the merc on the players team with highest in this stat - // -1 means error + // -1 means error INT32 iId = -1; INT32 iValue =9999999; MERCPROFILESTRUCT *pTeamSoldier; INT32 cnt=0; - INT32 iCounter =0; INT8 bCurrentList = 0; INT16 *bCurrentListValue = LaptopSaveInfo.ubDeadCharactersList; BOOLEAN fNotDone = TRUE; @@ -3351,7 +3320,7 @@ INT32 GetIdOfDepartedMercWithLowestStat( INT32 iStat ) if( bCurrentList == 0 ) { bCurrentList = 1; - bCurrentListValue = LaptopSaveInfo.ubLeftCharactersList; + bCurrentListValue = LaptopSaveInfo.ubLeftCharactersList; } else if( bCurrentList == 1 ) { @@ -3387,98 +3356,98 @@ INT32 GetIdOfDepartedMercWithLowestStat( INT32 iStat ) continue; } - if( pTeamSoldier -> bLife < iValue ) + if( pTeamSoldier->bLife < iValue ) { iId = cnt; - iValue = pTeamSoldier -> bLife; + iValue = pTeamSoldier->bLife; } break; - case 1: - // agility - if( pTeamSoldier -> bAgility < iValue ) + case 1: + // agility + if( pTeamSoldier->bAgility < iValue ) { iId = cnt; - iValue = pTeamSoldier -> bAgility; + iValue = pTeamSoldier->bAgility; } break; case 2: // dexterity - if( pTeamSoldier -> bDexterity < iValue ) + if( pTeamSoldier->bDexterity < iValue ) { iId = cnt; - iValue = pTeamSoldier -> bDexterity; + iValue = pTeamSoldier->bDexterity; } break; case 3: // strength - if( pTeamSoldier -> bStrength < iValue ) + if( pTeamSoldier->bStrength < iValue ) { iId = cnt; - iValue = pTeamSoldier -> bStrength; - } + iValue = pTeamSoldier->bStrength; + } break; case 4: // leadership - if( pTeamSoldier -> bLeadership < iValue ) + if( pTeamSoldier->bLeadership < iValue ) { iId = cnt; - iValue = pTeamSoldier -> bLeadership; - } + iValue = pTeamSoldier->bLeadership; + } break; case 5: - // wisdom - if( pTeamSoldier -> bWisdom < iValue ) + // wisdom + if( pTeamSoldier->bWisdom < iValue ) { iId = cnt; - iValue = pTeamSoldier -> bWisdom; + iValue = pTeamSoldier->bWisdom; } break; case 6: // exper - if( pTeamSoldier -> bExpLevel < iValue ) + if( pTeamSoldier->bExpLevel < iValue ) { iId = cnt; - iValue = pTeamSoldier -> bExpLevel; - } + iValue = pTeamSoldier->bExpLevel; + } break; case 7: //mrkmanship - if( pTeamSoldier -> bMarksmanship < iValue ) + if( pTeamSoldier->bMarksmanship < iValue ) { iId = cnt; - iValue = pTeamSoldier -> bMarksmanship; + iValue = pTeamSoldier->bMarksmanship; } - - break; + + break; case 8: // mech - if( pTeamSoldier -> bMechanical < iValue ) + if( pTeamSoldier->bMechanical < iValue ) { iId = cnt; - iValue = pTeamSoldier -> bMechanical; + iValue = pTeamSoldier->bMechanical; } - break; + break; case 9: // exp - if(pTeamSoldier -> bExplosive < iValue ) + if(pTeamSoldier->bExplosive < iValue ) { iId = cnt; - iValue = pTeamSoldier -> bExplosive; + iValue = pTeamSoldier->bExplosive; } break; case 10: // med - if( pTeamSoldier -> bMedical < iValue ) + if( pTeamSoldier->bMedical < iValue ) { iId = cnt; - iValue = pTeamSoldier -> bMedical; + iValue = pTeamSoldier->bMedical; } break; } bCurrentListValue++; - } + } return( iId ); @@ -3488,121 +3457,121 @@ INT32 GetIdOfDepartedMercWithLowestStat( INT32 iStat ) INT32 GetIdOfMercWithHighestStat( INT32 iStat ) { // will return the id value of the merc on the players team with highest in this stat - // -1 means error + // -1 means error INT32 iId = -1; INT32 iValue =0; - SOLDIERTYPE *pTeamSoldier, *pSoldier; + SOLDIERTYPE *pTeamSoldier, *pSoldier; INT32 cnt=0; - // first grunt - pSoldier = MercPtrs[0]; + // first grunt + pSoldier = MercPtrs[0]; // run through active soldiers for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) { - if( ( pTeamSoldier->bActive) && !( pTeamSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && ( pTeamSoldier->bLife > 0 ) && !AM_A_ROBOT( pTeamSoldier ) ) - { - switch( iStat ) - { - case 0: - // health + if( ( pTeamSoldier->bActive) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && ( pTeamSoldier->stats.bLife > 0 ) && !AM_A_ROBOT( pTeamSoldier ) ) + { + switch( iStat ) + { + case 0: + // health if( pTeamSoldier->bAssignment == ASSIGNMENT_POW ) { continue; } - if( pTeamSoldier -> bLifeMax >= iValue ) - { - iId = cnt; - iValue = pTeamSoldier -> bLifeMax; - } - break; - case 1: - // agility - if( pTeamSoldier -> bAgility >= iValue ) - { - iId = cnt; - iValue = pTeamSoldier -> bAgility; - } - break; - case 2: - // dexterity - if( pTeamSoldier -> bDexterity >= iValue ) - { - iId = cnt; - iValue = pTeamSoldier -> bDexterity; - } + if( pTeamSoldier->stats.bLifeMax >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier->stats.bLifeMax; + } + break; + case 1: + // agility + if( pTeamSoldier->stats.bAgility >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier->stats.bAgility; + } break; - case 3: - // strength - if( pTeamSoldier -> bStrength >= iValue ) - { - iId = cnt; - iValue = pTeamSoldier -> bStrength; - } - break; - case 4: + case 2: + // dexterity + if( pTeamSoldier->stats.bDexterity >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier->stats.bDexterity; + } + break; + case 3: + // strength + if( pTeamSoldier->stats.bStrength >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier->stats.bStrength; + } + break; + case 4: // leadership - if( pTeamSoldier -> bLeadership >= iValue ) - { - iId = cnt; - iValue = pTeamSoldier -> bLeadership; - } - break; - case 5: + if( pTeamSoldier->stats.bLeadership >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier->stats.bLeadership; + } + break; + case 5: // wisdom - if( pTeamSoldier -> bWisdom >= iValue ) - { - iId = cnt; - iValue = pTeamSoldier -> bWisdom; - } - break; - case 6: + if( pTeamSoldier->stats.bWisdom >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier->stats.bWisdom; + } + break; + case 6: // exper - if( pTeamSoldier -> bExpLevel >= iValue ) - { - iId = cnt; - iValue = pTeamSoldier -> bExpLevel; - } + if( pTeamSoldier->stats.bExpLevel >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier->stats.bExpLevel; + } - break; - case 7: - //mrkmanship - if( pTeamSoldier -> bMarksmanship >= iValue ) - { - iId = cnt; - iValue = pTeamSoldier -> bMarksmanship; - } - - break; - case 8: + break; + case 7: + //mrkmanship + if( pTeamSoldier->stats.bMarksmanship >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier->stats.bMarksmanship; + } + + break; + case 8: // mech - if( pTeamSoldier -> bMechanical >= iValue ) - { - iId = cnt; - iValue = pTeamSoldier -> bMechanical; - } - break; - case 9: + if( pTeamSoldier->stats.bMechanical >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier->stats.bMechanical; + } + break; + case 9: // exp - if(pTeamSoldier -> bExplosive >= iValue ) - { - iId = cnt; - iValue = pTeamSoldier -> bExplosive; - } - break; - case 10: - // med - if( pTeamSoldier -> bMedical >= iValue ) - { - iId = cnt; - iValue = pTeamSoldier -> bMedical; - } - break; - } - } - } + if(pTeamSoldier->stats.bExplosive >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier->stats.bExplosive; + } + break; + case 10: + // med + if( pTeamSoldier->stats.bMedical >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier->stats.bMedical; + } + break; + } + } + } return( iId ); @@ -3611,123 +3580,123 @@ INT32 GetIdOfMercWithHighestStat( INT32 iStat ) INT32 GetIdOfMercWithLowestStat( INT32 iStat ) { // will return the id value of the merc on the players team with highest in this stat - // -1 means error + // -1 means error INT32 iId = -1; INT32 iValue =999999; - SOLDIERTYPE *pTeamSoldier, *pSoldier; + SOLDIERTYPE *pTeamSoldier, *pSoldier; INT32 cnt=0; - // first grunt - pSoldier = MercPtrs[0]; + // first grunt + pSoldier = MercPtrs[0]; // run through active soldiers for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) { - if(( pTeamSoldier->bActive) && !( pTeamSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && ( pTeamSoldier->bLife > 0 ) && !AM_A_ROBOT( pTeamSoldier ) ) - { + if(( pTeamSoldier->bActive) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && ( pTeamSoldier->stats.bLife > 0 ) && !AM_A_ROBOT( pTeamSoldier ) ) + { - switch( iStat ) - { - case 0: - // health + switch( iStat ) + { + case 0: + // health if( pTeamSoldier->bAssignment == ASSIGNMENT_POW ) { continue; } - if( pTeamSoldier -> bLifeMax <= iValue ) - { - iId = cnt; - iValue = pTeamSoldier -> bLifeMax; - } - break; - case 1: - // agility - if( pTeamSoldier -> bAgility <= iValue ) - { - iId = cnt; - iValue = pTeamSoldier -> bAgility; - } - break; - case 2: - // dexterity - if( pTeamSoldier -> bDexterity <= iValue ) - { - iId = cnt; - iValue = pTeamSoldier -> bDexterity; - } + if( pTeamSoldier->stats.bLifeMax <= iValue ) + { + iId = cnt; + iValue = pTeamSoldier->stats.bLifeMax; + } + break; + case 1: + // agility + if( pTeamSoldier->stats.bAgility <= iValue ) + { + iId = cnt; + iValue = pTeamSoldier->stats.bAgility; + } break; - case 3: - // strength - if( pTeamSoldier -> bStrength <= iValue ) - { - iId = cnt; - iValue = pTeamSoldier -> bStrength; - } - break; - case 4: + case 2: + // dexterity + if( pTeamSoldier->stats.bDexterity <= iValue ) + { + iId = cnt; + iValue = pTeamSoldier->stats.bDexterity; + } + break; + case 3: + // strength + if( pTeamSoldier->stats.bStrength <= iValue ) + { + iId = cnt; + iValue = pTeamSoldier->stats.bStrength; + } + break; + case 4: // leadership - if( pTeamSoldier -> bLeadership <= iValue ) - { - iId = cnt; - iValue = pTeamSoldier -> bLeadership; - } - break; - case 5: + if( pTeamSoldier->stats.bLeadership <= iValue ) + { + iId = cnt; + iValue = pTeamSoldier->stats.bLeadership; + } + break; + case 5: // wisdom - if( pTeamSoldier -> bWisdom <= iValue ) - { - iId = cnt; - iValue = pTeamSoldier -> bWisdom; - } - break; - case 6: + if( pTeamSoldier->stats.bWisdom <= iValue ) + { + iId = cnt; + iValue = pTeamSoldier->stats.bWisdom; + } + break; + case 6: // exper - if( pTeamSoldier -> bExpLevel <= iValue ) - { - iId = cnt; - iValue = pTeamSoldier -> bExpLevel; - } + if( pTeamSoldier->stats.bExpLevel <= iValue ) + { + iId = cnt; + iValue = pTeamSoldier->stats.bExpLevel; + } - break; - case 7: - //mrkmanship - if( pTeamSoldier -> bMarksmanship <= iValue ) - { - iId = cnt; - iValue = pTeamSoldier -> bMarksmanship; - } - - break; - case 8: + break; + case 7: + //mrkmanship + if( pTeamSoldier->stats.bMarksmanship <= iValue ) + { + iId = cnt; + iValue = pTeamSoldier->stats.bMarksmanship; + } + + break; + case 8: // mech - if( pTeamSoldier -> bMechanical <= iValue ) - { - iId = cnt; - iValue = pTeamSoldier -> bMechanical; - } - break; - case 9: + if( pTeamSoldier->stats.bMechanical <= iValue ) + { + iId = cnt; + iValue = pTeamSoldier->stats.bMechanical; + } + break; + case 9: // exp - if( pTeamSoldier -> bExplosive <= iValue ) - { - iId = cnt; - iValue = pTeamSoldier -> bExplosive; - } - break; - case 10: - // med - if( pTeamSoldier -> bMedical <= iValue ) - { - iId = cnt; - iValue = pTeamSoldier -> bMedical; - } - break; - } - } - } + if( pTeamSoldier->stats.bExplosive <= iValue ) + { + iId = cnt; + iValue = pTeamSoldier->stats.bExplosive; + } + break; + case 10: + // med + if( pTeamSoldier->stats.bMedical <= iValue ) + { + iId = cnt; + iValue = pTeamSoldier->stats.bMedical; + } + break; + } + } + } return( iId ); @@ -3737,29 +3706,29 @@ INT32 GetIdOfMercWithLowestStat( INT32 iStat ) INT32 GetAvgStatOfCurrentTeamStat( INT32 iStat ) { // will return the id value of the merc on the players team with highest in this stat - // -1 means error - SOLDIERTYPE *pTeamSoldier, *pSoldier; + // -1 means error + SOLDIERTYPE *pTeamSoldier, *pSoldier; INT32 cnt=0; INT32 iTotalStatValue = 0; INT8 bNumberOfPows = 0; UINT8 ubNumberOfMercsInCalculation = 0; - // first grunt - pSoldier = MercPtrs[0]; + // first grunt + pSoldier = MercPtrs[0]; // run through active soldiers for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) { // Only count stats of merc (not vehicles) - if ( !( pTeamSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { - if(( pTeamSoldier->bActive)&&( pTeamSoldier->bLife > 0 ) && !AM_A_ROBOT( pTeamSoldier ) ) - { - switch( iStat ) - { - case 0: - // health + if(( pTeamSoldier->bActive)&&( pTeamSoldier->stats.bLife > 0 ) && !AM_A_ROBOT( pTeamSoldier ) ) + { + switch( iStat ) + { + case 0: + // health //if this is a pow, dont count his stats if( pTeamSoldier->bAssignment == ASSIGNMENT_POW ) @@ -3768,67 +3737,67 @@ INT32 GetAvgStatOfCurrentTeamStat( INT32 iStat ) continue; } - iTotalStatValue += pTeamSoldier -> bLifeMax; - - break; - case 1: - // agility - iTotalStatValue +=pTeamSoldier -> bAgility; + iTotalStatValue += pTeamSoldier->stats.bLifeMax; - break; - case 2: - // dexterity - iTotalStatValue += pTeamSoldier -> bDexterity; + break; + case 1: + // agility + iTotalStatValue +=pTeamSoldier->stats.bAgility; break; - case 3: - // strength - iTotalStatValue += pTeamSoldier -> bStrength; + case 2: + // dexterity + iTotalStatValue += pTeamSoldier->stats.bDexterity; - break; - case 4: + break; + case 3: + // strength + iTotalStatValue += pTeamSoldier->stats.bStrength; + + break; + case 4: // leadership - iTotalStatValue += pTeamSoldier -> bLeadership; + iTotalStatValue += pTeamSoldier->stats.bLeadership; - break; - case 5: + break; + case 5: // wisdom - - iTotalStatValue += pTeamSoldier -> bWisdom; - break; - case 6: + + iTotalStatValue += pTeamSoldier->stats.bWisdom; + break; + case 6: // exper - - iTotalStatValue += pTeamSoldier -> bExpLevel; - break; - case 7: - //mrkmanship - - iTotalStatValue += pTeamSoldier -> bMarksmanship; - - break; - case 8: + iTotalStatValue += pTeamSoldier->stats.bExpLevel; + + break; + case 7: + //mrkmanship + + iTotalStatValue += pTeamSoldier->stats.bMarksmanship; + + break; + case 8: // mech - - iTotalStatValue += pTeamSoldier -> bMechanical; - break; - case 9: - // exp - - iTotalStatValue += pTeamSoldier ->bExplosive; - break; - case 10: - // med - - iTotalStatValue += pTeamSoldier -> bMedical; - break; - } - ubNumberOfMercsInCalculation++; - } - } - } + iTotalStatValue += pTeamSoldier->stats.bMechanical; + break; + case 9: + // exp + + iTotalStatValue += pTeamSoldier->stats.bExplosive; + break; + case 10: + // med + + iTotalStatValue += pTeamSoldier->stats.bMedical; + break; + } + + ubNumberOfMercsInCalculation++; + } + } + } //if the stat is health, and there are only pow's @@ -3850,21 +3819,20 @@ INT32 GetAvgStatOfCurrentTeamStat( INT32 iStat ) INT32 GetAvgStatOfPastTeamStat( INT32 iStat ) { // will return the id value of the merc on the players team with highest in this stat - // -1 means error + // -1 means error INT32 cnt=0; INT32 iTotalStatValue = 0; INT32 iId = -1; MERCPROFILESTRUCT *pTeamSoldier; - INT32 iCounter =0; INT8 bCurrentList = 0; INT16 *bCurrentListValue = LaptopSaveInfo.ubDeadCharactersList; BOOLEAN fNotDone = TRUE; UINT32 uiLoopCounter; // run through active soldiers - + //while( fNotDone ) - for( uiLoopCounter=0; fNotDone ; uiLoopCounter++ ) + for( uiLoopCounter=0; fNotDone ; uiLoopCounter++ ) { /* // check if we are in fact not done @@ -3889,7 +3857,7 @@ INT32 GetAvgStatOfPastTeamStat( INT32 iStat ) if( bCurrentList == 0 ) { bCurrentList = 1; - bCurrentListValue = LaptopSaveInfo.ubLeftCharactersList; + bCurrentListValue = LaptopSaveInfo.ubLeftCharactersList; } else if( bCurrentList == 1 ) { @@ -3919,80 +3887,80 @@ INT32 GetAvgStatOfPastTeamStat( INT32 iStat ) { case 0: // health - - iTotalStatValue += pTeamSoldier -> bLife; - + + iTotalStatValue += pTeamSoldier->bLife; + break; - case 1: - // agility - - iTotalStatValue += pTeamSoldier -> bAgility; - + case 1: + // agility + + iTotalStatValue += pTeamSoldier->bAgility; + break; case 2: // dexterity - - iTotalStatValue += pTeamSoldier -> bDexterity; - + + iTotalStatValue += pTeamSoldier->bDexterity; + break; case 3: // strength - - iTotalStatValue += pTeamSoldier -> bStrength; - + + iTotalStatValue += pTeamSoldier->bStrength; + break; case 4: // leadership - - iTotalStatValue += pTeamSoldier -> bLeadership; - + + iTotalStatValue += pTeamSoldier->bLeadership; + break; case 5: - // wisdom - - iTotalStatValue += pTeamSoldier -> bWisdom; - + // wisdom + + iTotalStatValue += pTeamSoldier->bWisdom; + break; case 6: // exper - - iTotalStatValue += pTeamSoldier -> bExpLevel; - + + iTotalStatValue += pTeamSoldier->bExpLevel; + break; case 7: //mrkmanship - + iId = cnt; - iTotalStatValue += pTeamSoldier -> bMarksmanship; - - - break; + iTotalStatValue += pTeamSoldier->bMarksmanship; + + + break; case 8: // mech - - iTotalStatValue += pTeamSoldier -> bMechanical; - - break; + + iTotalStatValue += pTeamSoldier->bMechanical; + + break; case 9: // exp - - iTotalStatValue += pTeamSoldier -> bExplosive; - + + iTotalStatValue += pTeamSoldier->bExplosive; + break; case 10: // med - - iTotalStatValue += pTeamSoldier -> bMedical; + + iTotalStatValue += pTeamSoldier->bMedical; break; } bCurrentListValue++; - } + } if( GetNumberOfPastMercsOnPlayersTeam( ) > 0 ) { - return( iTotalStatValue / GetNumberOfPastMercsOnPlayersTeam( ) ); + return( iTotalStatValue / GetNumberOfPastMercsOnPlayersTeam( ) ); } else { @@ -4018,15 +3986,15 @@ void DisplayAverageStatValuesForCurrentTeam( void ) FindFontCenterCoordinates( PERS_STAT_AVG_X, 0 ,PERS_STAT_AVG_WIDTH, 0 , pPersonnelCurrentTeamStatsStrings[ 1 ], FONT10ARIAL , &sX, &sY ); mprintf( sX, PERS_STAT_AVG_Y, pPersonnelCurrentTeamStatsStrings[ 1 ] ); - + // nobody on team leave - if( ( GetNumberOfMercsDeadOrAliveOnPlayersTeam( ) == 0 ) && ( fCurrentTeamMode == TRUE ) ) + if( ( GetNumberOfMercsDeadOrAliveOnPlayersTeam( ) == 0 ) && ( fCurrentTeamMode == TRUE ) ) { return; } // check if in past team and nobody on past team - if( ( GetNumberOfPastMercsOnPlayersTeam( ) == 0 ) && ( fCurrentTeamMode == FALSE ) ) + if( ( GetNumberOfPastMercsOnPlayersTeam( ) == 0 ) && ( fCurrentTeamMode == FALSE ) ) { return; } @@ -4045,7 +4013,7 @@ void DisplayAverageStatValuesForCurrentTeam( void ) SetFontForeground( PERS_TEXT_FONT_COLOR ); } - if( fCurrentTeamMode == TRUE ) + if( fCurrentTeamMode == TRUE ) { INT32 iValue = GetAvgStatOfCurrentTeamStat( iCounter ); @@ -4061,9 +4029,9 @@ void DisplayAverageStatValuesForCurrentTeam( void ) swprintf( sString, L"%d", GetAvgStatOfPastTeamStat( iCounter ) ); } // center - FindFontCenterCoordinates( PERS_STAT_AVG_X, 0 ,PERS_STAT_AVG_WIDTH, 0 , sString, FONT10ARIAL , &sX, &sY ); + FindFontCenterCoordinates( PERS_STAT_AVG_X, 0 ,PERS_STAT_AVG_WIDTH, 0 , sString, FONT10ARIAL , &sX, &sY ); - mprintf( sX, PERS_STAT_AVG_Y + ( iCounter + 1 ) * ( GetFontHeight( FONT10ARIAL ) + 3 ), sString ); + mprintf( sX, PERS_STAT_AVG_Y + ( iCounter + 1 ) * ( GetFontHeight( FONT10ARIAL ) + 3 ), sString ); } return; @@ -4092,7 +4060,7 @@ void DisplayLowestStatValuesForCurrentTeam( void ) mprintf( sX, PERS_STAT_AVG_Y, pPersonnelCurrentTeamStatsStrings[ 0 ] ); // nobody on team leave - if( ( GetNumberOfMercsOnPlayersTeam( ) == 0 ) && ( fCurrentTeamMode == TRUE) ) + if( ( GetNumberOfMercsOnPlayersTeam( ) == 0 ) && ( fCurrentTeamMode == TRUE) ) { return; } @@ -4133,7 +4101,7 @@ void DisplayLowestStatValuesForCurrentTeam( void ) if( iId == -1 ) swprintf( sString, L"%s", pPOWStrings[1] ); else - swprintf( sString, L"%s", MercPtrs[ iId ] -> name ); + swprintf( sString, L"%s", MercPtrs[ iId ]->name ); } else { @@ -4142,136 +4110,136 @@ void DisplayLowestStatValuesForCurrentTeam( void ) } // print name mprintf( PERS_STAT_LOWEST_X, PERS_STAT_AVG_Y + ( iCounter + 1 ) * ( GetFontHeight( FONT10ARIAL ) + 3 ), sString ); - + switch( iCounter ) { - case 0: - // health - if( fCurrentTeamMode == TRUE ) - { - if( iId == -1 ) - iStat = -1; - else - iStat = MercPtrs[ iId ] -> bLifeMax; - } - else - { - iStat = gMercProfiles[ iDepartedId ] . bLife; - } - break; - case 1: - // agility - if( fCurrentTeamMode == TRUE ) - { - iStat = MercPtrs[ iId ] -> bAgility; - } - else - { - iStat = gMercProfiles[ iDepartedId ] . bAgility; - } - - break; - case 2: - // dexterity + case 0: + // health + if( fCurrentTeamMode == TRUE ) + { + if( iId == -1 ) + iStat = -1; + else + iStat = MercPtrs[ iId ]->stats.bLifeMax; + } + else + { + iStat = gMercProfiles[ iDepartedId ] . bLife; + } + break; + case 1: + // agility if( fCurrentTeamMode == TRUE ) { - iStat = MercPtrs[ iId ] -> bDexterity; + iStat = MercPtrs[ iId ]->stats.bAgility; } else { - iStat = gMercProfiles[ iDepartedId ] . bDexterity; + iStat = gMercProfiles[ iDepartedId ] . bAgility; } break; - case 3: - // strength - if( fCurrentTeamMode == TRUE ) - { - iStat = MercPtrs[ iId ] -> bStrength; - } - else - { - iStat = gMercProfiles[ iDepartedId ] . bStrength; - } + case 2: + // dexterity + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ]->stats.bDexterity; + } + else + { + iStat = gMercProfiles[ iDepartedId ] . bDexterity; + } - break; - case 4: + break; + case 3: + // strength + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ]->stats.bStrength; + } + else + { + iStat = gMercProfiles[ iDepartedId ] . bStrength; + } + + break; + case 4: // leadership if( fCurrentTeamMode == TRUE ) { - iStat = MercPtrs[ iId ] -> bLeadership; + iStat = MercPtrs[ iId ]->stats.bLeadership; } else { - iStat = gMercProfiles[ iDepartedId ] . bLeadership; + iStat = gMercProfiles[ iDepartedId ] . bLeadership; } - break; - case 5: + break; + case 5: // wisdom if( fCurrentTeamMode == TRUE ) { - iStat = MercPtrs[ iId ] -> bWisdom; + iStat = MercPtrs[ iId ]->stats.bWisdom; } else { - iStat = gMercProfiles[ iDepartedId ] . bWisdom; + iStat = gMercProfiles[ iDepartedId ] . bWisdom; } - break; - case 6: + break; + case 6: // exper if( fCurrentTeamMode == TRUE ) { - iStat = MercPtrs[ iId ] -> bExpLevel; + iStat = MercPtrs[ iId ]->stats.bExpLevel; } else { - iStat = gMercProfiles[ iDepartedId ] . bExpLevel; + iStat = gMercProfiles[ iDepartedId ] . bExpLevel; } - break; - case 7: - //mrkmanship + break; + case 7: + //mrkmanship if( fCurrentTeamMode == TRUE ) { - iStat = MercPtrs[ iId ] -> bMarksmanship; + iStat = MercPtrs[ iId ]->stats.bMarksmanship; } else { - iStat = gMercProfiles[ iDepartedId ] . bMarksmanship; + iStat = gMercProfiles[ iDepartedId ] . bMarksmanship; } - break; - case 8: + break; + case 8: // mech if( fCurrentTeamMode == TRUE ) { - iStat = MercPtrs[ iId ] -> bMechanical; + iStat = MercPtrs[ iId ]->stats.bMechanical; } else { - iStat = gMercProfiles[ iDepartedId ] . bMechanical; + iStat = gMercProfiles[ iDepartedId ] . bMechanical; } - break; - case 9: + break; + case 9: // exp if( fCurrentTeamMode == TRUE ) { - iStat = MercPtrs[ iId ] -> bExplosive; + iStat = MercPtrs[ iId ]->stats.bExplosive; } else { - iStat = gMercProfiles[ iDepartedId ] . bExplosive; + iStat = gMercProfiles[ iDepartedId ] .bExplosive; } - break; - case 10: - // med + break; + case 10: + // med if( fCurrentTeamMode == TRUE ) { - iStat = MercPtrs[ iId ] -> bMedical; + iStat = MercPtrs[ iId ]->stats.bMedical; } else { - iStat = gMercProfiles[ iDepartedId ] . bMedical; + iStat = gMercProfiles[ iDepartedId ] . bMedical; } - break; + break; } if( iStat == -1 ) @@ -4280,9 +4248,9 @@ void DisplayLowestStatValuesForCurrentTeam( void ) swprintf( sString, L"%d", iStat ); // right justify - FindFontRightCoordinates( PERS_STAT_LOWEST_X, 0 ,PERS_STAT_LOWEST_WIDTH, 0 , sString, FONT10ARIAL , &sX, &sY ); + FindFontRightCoordinates( PERS_STAT_LOWEST_X, 0 ,PERS_STAT_LOWEST_WIDTH, 0 , sString, FONT10ARIAL , &sX, &sY ); - mprintf( sX, PERS_STAT_AVG_Y + ( iCounter + 1 ) * ( GetFontHeight( FONT10ARIAL ) + 3 ), sString ); + mprintf( sX, PERS_STAT_AVG_Y + ( iCounter + 1 ) * ( GetFontHeight( FONT10ARIAL ) + 3 ), sString ); } return; @@ -4311,7 +4279,7 @@ void DisplayHighestStatValuesForCurrentTeam( void ) mprintf( sX, PERS_STAT_AVG_Y, pPersonnelCurrentTeamStatsStrings[ 2 ] ); // nobody on team leave - if( ( GetNumberOfMercsOnPlayersTeam( ) == 0 ) && ( fCurrentTeamMode == TRUE) ) + if( ( GetNumberOfMercsOnPlayersTeam( ) == 0 ) && ( fCurrentTeamMode == TRUE) ) { return; } @@ -4348,7 +4316,7 @@ void DisplayHighestStatValuesForCurrentTeam( void ) if( iId == -1 ) swprintf( sString, L"%s", pPOWStrings[1] ); else - swprintf( sString, L"%s", MercPtrs[ iId ] -> name ); + swprintf( sString, L"%s", MercPtrs[ iId ]->name ); } else { @@ -4357,147 +4325,147 @@ void DisplayHighestStatValuesForCurrentTeam( void ) } // print name mprintf( PERS_STAT_HIGHEST_X, PERS_STAT_AVG_Y + ( iCounter + 1 ) * ( GetFontHeight( FONT10ARIAL ) + 3 ), sString ); - + switch( iCounter ) { - case 0: - // health - if( fCurrentTeamMode == TRUE ) - { - if( iId == -1 ) + case 0: + // health + if( fCurrentTeamMode == TRUE ) + { + if( iId == -1 ) iStat = -1; - else - iStat = MercPtrs[ iId ] -> bLifeMax; - } - else - { - iStat = gMercProfiles[ iId ] . bLife; - } - break; - case 1: - // agility - if( fCurrentTeamMode == TRUE ) - { - iStat = MercPtrs[ iId ] -> bAgility; - } - else - { - iStat = gMercProfiles[ iId ] . bAgility; - } - - break; - case 2: - // dexterity + else + iStat = MercPtrs[ iId ]->stats.bLifeMax; + } + else + { + iStat = gMercProfiles[ iId ] . bLife; + } + break; + case 1: + // agility if( fCurrentTeamMode == TRUE ) { - iStat = MercPtrs[ iId ] -> bDexterity; + iStat = MercPtrs[ iId ]->stats.bAgility; } else { - iStat = gMercProfiles[ iId ] . bDexterity; + iStat = gMercProfiles[ iId ] . bAgility; } break; - case 3: - // strength - if( fCurrentTeamMode == TRUE ) - { - iStat = MercPtrs[ iId ] -> bStrength; - } - else - { - iStat = gMercProfiles[ iId ] . bStrength; - } + case 2: + // dexterity + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ]->stats.bDexterity; + } + else + { + iStat = gMercProfiles[ iId ] . bDexterity; + } - break; - case 4: + break; + case 3: + // strength + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ]->stats.bStrength; + } + else + { + iStat = gMercProfiles[ iId ] . bStrength; + } + + break; + case 4: // leadership if( fCurrentTeamMode == TRUE ) { - iStat = MercPtrs[ iId ] -> bLeadership; + iStat = MercPtrs[ iId ]->stats.bLeadership; } else { - iStat = gMercProfiles[ iId ] . bLeadership; + iStat = gMercProfiles[ iId ] . bLeadership; } - break; - case 5: + break; + case 5: // wisdom if( fCurrentTeamMode == TRUE ) { - iStat = MercPtrs[ iId ] -> bWisdom; + iStat = MercPtrs[ iId ]->stats.bWisdom; } else { - iStat = gMercProfiles[ iId ] . bWisdom; + iStat = gMercProfiles[ iId ] . bWisdom; } - break; - case 6: + break; + case 6: // exper if( fCurrentTeamMode == TRUE ) { - iStat = MercPtrs[ iId ] -> bExpLevel; + iStat = MercPtrs[ iId ]->stats.bExpLevel; } else { - iStat = gMercProfiles[ iId ] . bExpLevel; + iStat = gMercProfiles[ iId ] . bExpLevel; } - break; - case 7: - //mrkmanship + break; + case 7: + //mrkmanship if( fCurrentTeamMode == TRUE ) { - iStat = MercPtrs[ iId ] -> bMarksmanship; + iStat = MercPtrs[ iId ]->stats.bMarksmanship; } else { - iStat = gMercProfiles[ iId ] . bMarksmanship; + iStat = gMercProfiles[ iId ] . bMarksmanship; } - break; - case 8: + break; + case 8: // mech if( fCurrentTeamMode == TRUE ) { - iStat = MercPtrs[ iId ] -> bMechanical; + iStat = MercPtrs[ iId ]->stats.bMechanical; } else { - iStat = gMercProfiles[ iId ] . bMechanical; + iStat = gMercProfiles[ iId ] . bMechanical; } - break; - case 9: + break; + case 9: // exp if( fCurrentTeamMode == TRUE ) { - iStat = MercPtrs[ iId ] -> bExplosive; + iStat = MercPtrs[ iId ]->stats.bExplosive; } else { iStat = gMercProfiles[ iId ] . bExplosive; } - break; - case 10: - // med + break; + case 10: + // med if( fCurrentTeamMode == TRUE ) { - iStat = MercPtrs[ iId ] -> bMedical; + iStat = MercPtrs[ iId ]->stats.bMedical; } else { - iStat = gMercProfiles[ iId ] . bMedical; + iStat = gMercProfiles[ iId ] . bMedical; } - break; + break; } - + if( iStat == -1 ) swprintf( sString, L"%s", pPOWStrings[1] ); else swprintf( sString, L"%d", iStat ); // right justify - FindFontRightCoordinates( PERS_STAT_HIGHEST_X, 0 ,PERS_STAT_LOWEST_WIDTH, 0 , sString, FONT10ARIAL , &sX, &sY ); + FindFontRightCoordinates( PERS_STAT_HIGHEST_X, 0 ,PERS_STAT_LOWEST_WIDTH, 0 , sString, FONT10ARIAL , &sX, &sY ); - mprintf( sX, PERS_STAT_AVG_Y + ( iCounter + 1 ) * ( GetFontHeight( FONT10ARIAL ) + 3 ), sString ); + mprintf( sX, PERS_STAT_AVG_Y + ( iCounter + 1 ) * ( GetFontHeight( FONT10ARIAL ) + 3 ), sString ); } return; @@ -4541,12 +4509,11 @@ void DisplayPersonnelTeamStats( void ) INT32 GetNumberOfPastMercsOnPlayersTeam( void ) { INT32 iPastNumberOfMercs = 0; - INT32 iCounter = 0; // will run through the alist of past mercs on the players team and return thier number // dead iPastNumberOfMercs += GetNumberOfDeadOnPastTeam( ); - + // left iPastNumberOfMercs += GetNumberOfLeftOnPastTeam( ); @@ -4641,28 +4608,28 @@ void DisplayStateOfPastTeamMembers( void ) { // dead - mprintf( PERS_CURR_TEAM_COST_X, PERS_CURR_TEAM_COST_Y, pPersonelTeamStrings[ 5 ] ); - swprintf( sString, L"%d", GetNumberOfDeadOnPastTeam( ) ); - - FindFontRightCoordinates((INT16)(PERS_CURR_TEAM_COST_X),0,PERS_DEPART_TEAM_WIDTH,0,sString, PERS_FONT, &sX, &sY); - - mprintf( sX ,PERS_CURR_TEAM_COST_Y, sString ); - - // fired - mprintf( PERS_CURR_TEAM_COST_X, PERS_CURR_TEAM_HIGHEST_Y, pPersonelTeamStrings[ 6 ] ); - swprintf( sString, L"%d", GetNumberOfLeftOnPastTeam( ) ); - - FindFontRightCoordinates((INT16)(PERS_CURR_TEAM_COST_X),0,PERS_DEPART_TEAM_WIDTH,0,sString, PERS_FONT, &sX, &sY); - - mprintf( sX ,PERS_CURR_TEAM_HIGHEST_Y, sString ); + mprintf( PERS_CURR_TEAM_COST_X, PERS_CURR_TEAM_COST_Y, pPersonelTeamStrings[ 5 ] ); + swprintf( sString, L"%d", GetNumberOfDeadOnPastTeam( ) ); - // other - mprintf( PERS_CURR_TEAM_COST_X, PERS_CURR_TEAM_LOWEST_Y, pPersonelTeamStrings[ 7 ] ); - swprintf( sString, L"%d", GetNumberOfOtherOnPastTeam( ) ); - - FindFontRightCoordinates((INT16)(PERS_CURR_TEAM_COST_X),0,PERS_DEPART_TEAM_WIDTH,0,sString, PERS_FONT, &sX, &sY); - - mprintf( sX ,PERS_CURR_TEAM_LOWEST_Y, sString ); + FindFontRightCoordinates((INT16)(PERS_CURR_TEAM_COST_X),0,PERS_DEPART_TEAM_WIDTH,0,sString, PERS_FONT, &sX, &sY); + + mprintf( sX ,PERS_CURR_TEAM_COST_Y, sString ); + + // fired + mprintf( PERS_CURR_TEAM_COST_X, PERS_CURR_TEAM_HIGHEST_Y, pPersonelTeamStrings[ 6 ] ); + swprintf( sString, L"%d", GetNumberOfLeftOnPastTeam( ) ); + + FindFontRightCoordinates((INT16)(PERS_CURR_TEAM_COST_X),0,PERS_DEPART_TEAM_WIDTH,0,sString, PERS_FONT, &sX, &sY); + + mprintf( sX ,PERS_CURR_TEAM_HIGHEST_Y, sString ); + + // other + mprintf( PERS_CURR_TEAM_COST_X, PERS_CURR_TEAM_LOWEST_Y, pPersonelTeamStrings[ 7 ] ); + swprintf( sString, L"%d", GetNumberOfOtherOnPastTeam( ) ); + + FindFontRightCoordinates((INT16)(PERS_CURR_TEAM_COST_X),0,PERS_DEPART_TEAM_WIDTH,0,sString, PERS_FONT, &sX, &sY); + + mprintf( sX ,PERS_CURR_TEAM_LOWEST_Y, sString ); } else { @@ -4685,12 +4652,12 @@ void CreateDestroyCurrentDepartedMouseRegions( void ) { // not created, create MSYS_DefineRegion(&gTogglePastCurrentTeam[ 0 ], PERS_TOGGLE_CUR_DEPART_X, PERS_TOGGLE_CUR_Y, PERS_TOGGLE_CUR_DEPART_X + PERS_TOGGLE_CUR_DEPART_WIDTH, PERS_TOGGLE_CUR_Y + PERS_TOGGLE_CUR_DEPART_HEIGHT, - MSYS_PRIORITY_HIGHEST - 3 ,CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, PersonnelCurrentTeamCallback); - + MSYS_PRIORITY_HIGHEST - 3 ,CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, PersonnelCurrentTeamCallback); + MSYS_AddRegion( &gTogglePastCurrentTeam[ 0 ] ); MSYS_DefineRegion(&gTogglePastCurrentTeam[ 1 ], PERS_TOGGLE_CUR_DEPART_X, PERS_TOGGLE_DEPART_Y , PERS_TOGGLE_CUR_DEPART_X + PERS_TOGGLE_CUR_DEPART_WIDTH, PERS_TOGGLE_DEPART_Y + PERS_TOGGLE_CUR_DEPART_HEIGHT, - MSYS_PRIORITY_HIGHEST - 3,CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, PersonnelDepartedTeamCallback); + MSYS_PRIORITY_HIGHEST - 3,CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, PersonnelDepartedTeamCallback); MSYS_AddRegion( &gTogglePastCurrentTeam[ 1 ] ); @@ -4714,13 +4681,13 @@ void CreateDestroyCurrentDepartedMouseRegions( void ) void PersonnelCurrentTeamCallback( MOUSE_REGION * pRegion, INT32 iReason ) { if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) - { + { fCurrentTeamMode = TRUE; if( fCurrentTeamMode == TRUE ) { - iCurrentPersonSelectedId = -1; - + iCurrentPersonSelectedId = -1; + // how many people do we have?..if you have someone set default to 0 if( GetNumberOfMercsDeadOrAliveOnPlayersTeam() > 0 ) { @@ -4731,7 +4698,7 @@ void PersonnelCurrentTeamCallback( MOUSE_REGION * pRegion, INT32 iReason ) } fCurrentTeamMode = TRUE; - fReDrawScreenFlag = TRUE; + fReDrawScreenFlag = TRUE; } } @@ -4740,13 +4707,13 @@ void PersonnelCurrentTeamCallback( MOUSE_REGION * pRegion, INT32 iReason ) void PersonnelDepartedTeamCallback( MOUSE_REGION * pRegion, INT32 iReason ) { if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) - { + { fCurrentTeamMode = FALSE; if( fCurrentTeamMode == FALSE ) { - iCurrentPersonSelectedId = -1; + iCurrentPersonSelectedId = -1; // how many departed people? if( GetNumberOfPastMercsOnPlayersTeam( ) > 0 ) @@ -4773,20 +4740,20 @@ void CreateDestroyButtonsForDepartedTeamList( void ) if( ( fCurrentTeamMode == FALSE ) && ( fCreated == FALSE ) ) { // not created. create - giPersonnelButtonImage[ 4 ]= LoadButtonImage( "LAPTOP\\departuresbuttons.sti" ,-1,0,-1,2,-1 ); - giPersonnelButton[ 4 ] = QuickCreateButton( giPersonnelButtonImage[4], PERS_DEPARTED_UP_X, PERS_DEPARTED_UP_Y, - BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + giPersonnelButtonImage[ 4 ]= LoadButtonImage( "LAPTOP\\departuresbuttons.sti" ,-1,0,-1,2,-1 ); + giPersonnelButton[ 4 ] = QuickCreateButton( giPersonnelButtonImage[4], PERS_DEPARTED_UP_X, PERS_DEPARTED_UP_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)DepartedUpCallBack); - + // right button - giPersonnelButtonImage[ 5 ]= LoadButtonImage( "LAPTOP\\departuresbuttons.sti" ,-1,1,-1,3,-1 ); + giPersonnelButtonImage[ 5 ]= LoadButtonImage( "LAPTOP\\departuresbuttons.sti" ,-1,1,-1,3,-1 ); giPersonnelButton[ 5 ] = QuickCreateButton( giPersonnelButtonImage[5], PERS_DEPARTED_UP_X, PERS_DEPARTED_DOWN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)DepartedDownCallBack); - + // set up cursors for these buttons SetButtonCursor( giPersonnelButton[ 4 ], CURSOR_LAPTOP_SCREEN); - SetButtonCursor( giPersonnelButton[ 5 ], CURSOR_LAPTOP_SCREEN); + SetButtonCursor( giPersonnelButton[ 5 ], CURSOR_LAPTOP_SCREEN); fCreated = TRUE; @@ -4795,9 +4762,9 @@ void CreateDestroyButtonsForDepartedTeamList( void ) { // created. destroy RemoveButton(giPersonnelButton[4] ); - UnloadButtonImage(giPersonnelButtonImage[4] ); - RemoveButton(giPersonnelButton[5] ); - UnloadButtonImage(giPersonnelButtonImage[5] ); + UnloadButtonImage(giPersonnelButtonImage[4] ); + RemoveButton(giPersonnelButton[5] ); + UnloadButtonImage(giPersonnelButtonImage[5] ); fCreated = FALSE; fReDrawScreenFlag = TRUE; } @@ -4813,20 +4780,20 @@ void DepartedUpCallBack(GUI_BUTTON *btn,INT32 reason) { if(!(btn->uiFlags & BUTTON_CLICKED_ON)) { - + } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if(btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); - if( giCurrentUpperLeftPortraitNumber - 20 >= 0 ) + if( giCurrentUpperLeftPortraitNumber - 20 >= 0 ) { - giCurrentUpperLeftPortraitNumber-=20; - fReDrawScreenFlag = TRUE; + giCurrentUpperLeftPortraitNumber-=20; + fReDrawScreenFlag = TRUE; } } } @@ -4842,9 +4809,9 @@ void DepartedDownCallBack(GUI_BUTTON *btn,INT32 reason) { if(!(btn->uiFlags & BUTTON_CLICKED_ON)) { - + } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { @@ -4868,7 +4835,6 @@ void DisplayPastMercsPortraits( void ) INT32 iCounter = 0; INT32 iCounterA = 0; INT32 iStartArray = 0; // 0 = dead list, 1 = fired list, 2 = other list - BOOLEAN fFound = FALSE; // not time to display if( fCurrentTeamMode == TRUE ) @@ -4895,10 +4861,10 @@ void DisplayPastMercsPortraits( void ) iCounter++; } } - + if( iCounter < 20 ) { - iStartArray = 0; + iStartArray = 0; } else { @@ -4919,10 +4885,10 @@ void DisplayPastMercsPortraits( void ) if( LaptopSaveInfo.ubOtherCharactersList[ iCounterA ] != -1 ) iCounter++; } - + if( iCounter < 20 ) { - iStartArray = 1; + iStartArray = 1; } else { @@ -4941,8 +4907,8 @@ void DisplayPastMercsPortraits( void ) if( iStartArray == 0 ) { // run through list and display -// for( iCounterA ; ( ( iCounter < 20 ) && ( LaptopSaveInfo.ubDeadCharactersList[ iCounterA ] != -1 ) ); iCounter++, iCounterA++ ) - for( iCounterA ; iCounter < 20 && iCounterA < 256; iCounterA++ ) +// for( iCounterA ; ( ( iCounter < 20 ) && ( LaptopSaveInfo.ubDeadCharactersList[ iCounterA ] != -1 ) ); iCounter++, iCounterA++ ) + for( iCounterA ; iCounter < 20 && iCounterA < 256; iCounterA++ ) { // show dead pictures if( LaptopSaveInfo.ubDeadCharactersList[ iCounterA ] != -1 ) @@ -4957,8 +4923,8 @@ void DisplayPastMercsPortraits( void ) } if( iStartArray <= 1 ) { -// for( iCounterA ; ( ( iCounter < 20 ) && ( LaptopSaveInfo.ubLeftCharactersList[ iCounterA ] != -1 ) ); iCounter++, iCounterA++ ) - for( iCounterA ; ( iCounter < 20 && iCounterA < 256 ); iCounterA++ ) +// for( iCounterA ; ( ( iCounter < 20 ) && ( LaptopSaveInfo.ubLeftCharactersList[ iCounterA ] != -1 ) ); iCounter++, iCounterA++ ) + for( iCounterA ; ( iCounter < 20 && iCounterA < 256 ); iCounterA++ ) { // show fired pics if( LaptopSaveInfo.ubLeftCharactersList[ iCounterA ] != -1 ) @@ -4974,7 +4940,7 @@ void DisplayPastMercsPortraits( void ) if( iStartArray <= 2 ) { // for( iCounterA ; ( ( iCounter < 20 ) && ( LaptopSaveInfo.ubOtherCharactersList[ iCounterA ] != -1 ) ) ; iCounter++, iCounterA++ ) - for( iCounterA ; ( iCounter < 20 && iCounterA < 256 ); iCounterA++ ) + for( iCounterA ; ( iCounter < 20 && iCounterA < 256 ); iCounterA++ ) { // show other pics if( LaptopSaveInfo.ubOtherCharactersList[ iCounterA ] != -1 ) @@ -5012,7 +4978,7 @@ INT32 GetIdOfPastMercInSlot( INT32 iSlot ) return iCurrentPersonSelectedId; } // go through dead list - for( iCounterA = 0; ( ( iCounter ) < iSlot + giCurrentUpperLeftPortraitNumber); iCounterA++ ) + for( iCounterA = 0; ( ( iCounter ) < iSlot + giCurrentUpperLeftPortraitNumber); iCounterA++ ) { if( LaptopSaveInfo.ubDeadCharactersList[ iCounterA ] != -1 ) iCounter++; @@ -5020,22 +4986,22 @@ INT32 GetIdOfPastMercInSlot( INT32 iSlot ) if( iSlot + giCurrentUpperLeftPortraitNumber == iCounter) { - return ( LaptopSaveInfo.ubDeadCharactersList[ iCounterA - 1] ); + return ( LaptopSaveInfo.ubDeadCharactersList[ iCounterA - 1] ); } // now the fired list iCounterA =0; - for( iCounterA = 0; ( ( ( iCounter )< iSlot + giCurrentUpperLeftPortraitNumber) ); iCounterA++ ) + for( iCounterA = 0; ( ( ( iCounter )< iSlot + giCurrentUpperLeftPortraitNumber) ); iCounterA++ ) { if( LaptopSaveInfo.ubLeftCharactersList[ iCounterA ] != -1 ) iCounter++; } - + if( iSlot + giCurrentUpperLeftPortraitNumber == iCounter) { - return ( LaptopSaveInfo.ubLeftCharactersList[ iCounterA - 1 ] ); + return ( LaptopSaveInfo.ubLeftCharactersList[ iCounterA - 1 ] ); } - + // now the fired list iCounterA =0; @@ -5045,7 +5011,7 @@ INT32 GetIdOfPastMercInSlot( INT32 iSlot ) iCounter++; } - return( LaptopSaveInfo.ubOtherCharactersList[ iCounterA - 1] ); + return( LaptopSaveInfo.ubOtherCharactersList[ iCounterA - 1] ); } @@ -5056,26 +5022,26 @@ INT32 GetIdOfPastMercInSlot( INT32 iSlot ) BOOLEAN DisplayPortraitOfPastMerc( INT32 iId , INT32 iCounter, BOOLEAN fDead, BOOLEAN fFired, BOOLEAN fOther ) { - + char sTemp[100]; HVOBJECT hFaceHandle; - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; - if( ( 50 < iId )&&( 57 > iId ) ) + + if( ( 50 < iId )&&( 57 > iId ) ) { - sprintf( sTemp, "%s%03d.sti", SMALL_FACES_DIR, gMercProfiles[ iId ].ubFaceIndex ); + sprintf( sTemp, "%s%03d.sti", SMALL_FACES_DIR, gMercProfiles[ iId ].ubFaceIndex ); } else { - if( iId < 100 ) + if( iId < 100 ) { - sprintf(sTemp, "%s%02d.sti", SMALL_FACES_DIR, iId ); + sprintf(sTemp, "%s%02d.sti", SMALL_FACES_DIR, iId ); } else { - sprintf(sTemp, "%s%03d.sti", SMALL_FACES_DIR, iId ); + sprintf(sTemp, "%s%03d.sti", SMALL_FACES_DIR, iId ); } } @@ -5084,20 +5050,20 @@ BOOLEAN DisplayPortraitOfPastMerc( INT32 iId , INT32 iCounter, BOOLEAN fDead, BO CHECKF(AddVideoObject(&VObjectDesc, &guiFACE)); - //Blt face to screen to + //Blt face to screen to GetVideoObject(&hFaceHandle, guiFACE); if( fDead ) { hFaceHandle->pShades[ 0 ] = Create16BPPPaletteShaded( hFaceHandle->pPaletteEntry, DEAD_MERC_COLOR_RED, DEAD_MERC_COLOR_GREEN, DEAD_MERC_COLOR_BLUE, TRUE ); - + //set the red pallete to the face SetObjectHandleShade( guiFACE, 0 ); } BltVideoObject(FRAME_BUFFER, hFaceHandle, 0,( INT16 ) ( SMALL_PORTRAIT_START_X+ ( iCounter % PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_WIDTH ), ( INT16 ) ( SMALL_PORTRAIT_START_Y + ( iCounter / PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_HEIGHT ), VO_BLT_SRCTRANSPARENCY,NULL); - + /* text on the Small portrait if( fDead ) @@ -5115,9 +5081,9 @@ BOOLEAN DisplayPortraitOfPastMerc( INT32 iId , INT32 iCounter, BOOLEAN fDead, BO DrawTextToScreen(pDepartedMercPortraitStrings[2], ( INT16 ) ( SMALL_PORTRAIT_START_X+ ( iCounter % PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_WIDTH ), ( INT16 ) ( SMALL_PORTRAIT_START_Y + ( iCounter / PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_HEIGHT + SMALL_PORT_HEIGHT / 2 ), SMALL_PORTRAIT_WIDTH_NO_BORDERS, FONT10ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); } */ - + DeleteVideoObjectFromIndex(guiFACE); - + return ( TRUE ); } @@ -5141,122 +5107,122 @@ void DisplayDepartedCharStats(INT32 iId, INT32 iSlot, INT32 iState) { switch(iCounter) { - case 0: - // health + case 0: + // health - // dead? - if( iState == 0 ) - { - swprintf(sString, L"%d/%d",0,gMercProfiles[iId].bLife); - } - else - { - swprintf(sString, L"%d/%d",gMercProfiles[iId].bLife,gMercProfiles[iId].bLife); - } - - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; - case 1: - // agility - swprintf(sString, L"%d",gMercProfiles[iId].bAgility); - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; - case 2: - // dexterity - swprintf(sString, L"%d",gMercProfiles[iId].bDexterity); - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + // dead? + if( iState == 0 ) + { + swprintf(sString, L"%d/%d",0,gMercProfiles[iId].bLife); + } + else + { + swprintf(sString, L"%d/%d",gMercProfiles[iId].bLife,gMercProfiles[iId].bLife); + } + + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); break; - case 3: - // strength - swprintf(sString, L"%d",gMercProfiles[iId].bStrength); - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; - case 4: - // leadership - swprintf(sString, L"%d",gMercProfiles[iId].bLeadership); - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; - case 5: - // wisdom - swprintf(sString, L"%d",gMercProfiles[iId].bWisdom); - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; - case 6: - // exper - swprintf(sString, L"%d",gMercProfiles[iId].bExpLevel); - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; - case 7: - //mrkmanship - swprintf(sString, L"%d",gMercProfiles[iId].bMarksmanship); - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; - case 8: - // mech - swprintf(sString, L"%d",gMercProfiles[iId].bMechanical); - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; - case 9: - // exp - swprintf(sString, L"%d",gMercProfiles[iId].bExplosive); - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; - case 10: - // med - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - - swprintf(sString, L"%d",gMercProfiles[iId].bMedical); - - - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; + case 1: + // agility + swprintf(sString, L"%d",gMercProfiles[iId].bAgility); + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 2: + // dexterity + swprintf(sString, L"%d",gMercProfiles[iId].bDexterity); + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 3: + // strength + swprintf(sString, L"%d",gMercProfiles[iId].bStrength); + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 4: + // leadership + swprintf(sString, L"%d",gMercProfiles[iId].bLeadership); + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 5: + // wisdom + swprintf(sString, L"%d",gMercProfiles[iId].bWisdom); + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 6: + // exper + swprintf(sString, L"%d",gMercProfiles[iId].bExpLevel); + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 7: + //mrkmanship + swprintf(sString, L"%d",gMercProfiles[iId].bMarksmanship); + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 8: + // mech + swprintf(sString, L"%d",gMercProfiles[iId].bMechanical); + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 9: + // exp + swprintf(sString, L"%d",gMercProfiles[iId].bExplosive); + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 10: + // med + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + + swprintf(sString, L"%d",gMercProfiles[iId].bMedical); - case 14: - // kills - mprintf((INT16)(pPersonnelScreenPoints[21].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[21].y,pPersonnelScreenStrings[PRSNL_TXT_KILLS]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + + + case 14: + // kills + mprintf((INT16)(pPersonnelScreenPoints[21].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[21].y,pPersonnelScreenStrings[PRSNL_TXT_KILLS]); swprintf(sString, L"%d",gMercProfiles[iId].usKills); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[21].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[21].y,sString); - break; - case 15: + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[21].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[21].y,sString); + break; + case 15: // assists - mprintf((INT16)(pPersonnelScreenPoints[22].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[22].y,pPersonnelScreenStrings[PRSNL_TXT_ASSISTS]); + mprintf((INT16)(pPersonnelScreenPoints[22].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[22].y,pPersonnelScreenStrings[PRSNL_TXT_ASSISTS]); swprintf(sString, L"%d",gMercProfiles[iId].usAssists); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[22].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[22].y,sString); - break; - case 16: + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[22].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[22].y,sString); + break; + case 16: // shots/hits - mprintf((INT16)(pPersonnelScreenPoints[23].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[23].y,pPersonnelScreenStrings[PRSNL_TXT_HIT_PERCENTAGE]); + mprintf((INT16)(pPersonnelScreenPoints[23].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[23].y,pPersonnelScreenStrings[PRSNL_TXT_HIT_PERCENTAGE]); uiHits = ( UINT32 )gMercProfiles[iId].usShotsHit; uiHits *= 100; - + // check we have shot at least once if( gMercProfiles[iId].usShotsFired > 0 ) { - uiHits /= ( UINT32 )gMercProfiles[iId].usShotsFired; + uiHits /= ( UINT32 )gMercProfiles[iId].usShotsFired; } else { @@ -5265,24 +5231,24 @@ void DisplayDepartedCharStats(INT32 iId, INT32 iSlot, INT32 iState) } swprintf(sString, L"%d %%%%",uiHits); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[23].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - sX += StringPixLength( L"%", PERS_FONT ); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[23].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + sX += StringPixLength( L"%", PERS_FONT ); mprintf(sX,pPersonnelScreenPoints[23].y,sString); - break; - case 17: + break; + case 17: // battles mprintf((INT16)(pPersonnelScreenPoints[24].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[24].y,pPersonnelScreenStrings[PRSNL_TXT_BATTLES]); swprintf(sString, L"%d",gMercProfiles[iId].usBattlesFought); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[24].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[24].y,sString); - break; - case 18: + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[24].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[24].y,sString); + break; + case 18: // wounds mprintf((INT16)(pPersonnelScreenPoints[25].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[25].y,pPersonnelScreenStrings[PRSNL_TXT_TIMES_WOUNDED]); swprintf(sString, L"%d",gMercProfiles[iId].usTimesWounded); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[25].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[25].y,sString); - break; + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[25].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[25].y,sString); + break; } } @@ -5309,7 +5275,7 @@ void EnableDisableDeparturesButtons( void ) // enable up button EnableButton( giPersonnelButton[ 4 ] ); } - if( ( GetNumberOfDeadOnPastTeam( ) + GetNumberOfLeftOnPastTeam( ) + GetNumberOfOtherOnPastTeam( ) ) - giCurrentUpperLeftPortraitNumber >= 20 ) + if( ( GetNumberOfDeadOnPastTeam( ) + GetNumberOfLeftOnPastTeam( ) + GetNumberOfOtherOnPastTeam( ) ) - giCurrentUpperLeftPortraitNumber >= 20 ) { // enable down button EnableButton( giPersonnelButton[ 5 ] ); @@ -5322,14 +5288,14 @@ void EnableDisableDeparturesButtons( void ) void DisplayDepartedCharName( INT32 iId, INT32 iSlot, INT32 iState ) { - // get merc's nickName, assignment, and sector location info + // get merc's nickName, assignment, and sector location info INT16 sX, sY; CHAR16 sString[ 32 ]; - SetFont(CHAR_NAME_FONT); + SetFont(CHAR_NAME_FONT); SetFontForeground(PERS_TEXT_FONT_COLOR); SetFontBackground(FONT_BLACK); - + if( ( iState == -1 )||( iId == -1 ) ) { return; @@ -5347,7 +5313,7 @@ void DisplayDepartedCharName( INT32 iId, INT32 iSlot, INT32 iState ) } mprintf( sX + iSlot * IMAGE_BOX_WIDTH, CHAR_NAME_Y, sString ); - + // state if( gMercProfiles[ iId ].ubMiscFlags2 & PROFILE_MISC_FLAG2_MARRIED_TO_HICKS ) @@ -5355,7 +5321,7 @@ void DisplayDepartedCharName( INT32 iId, INT32 iSlot, INT32 iState ) //displaye 'married' swprintf( sString, L"%s", pPersonnelDepartedStateStrings[ DEPARTED_MARRIED ] ); } - else if( iState == DEPARTED_DEAD ) + else if( iState == DEPARTED_DEAD ) { swprintf( sString, L"%s", pPersonnelDepartedStateStrings[ DEPARTED_DEAD ] ); } @@ -5400,8 +5366,8 @@ void DisplayDepartedCharName( INT32 iId, INT32 iSlot, INT32 iState ) mprintf( sX + iSlot * IMAGE_BOX_WIDTH, CHAR_NAME_Y + 10 , sString ); - - + + return; } @@ -5445,24 +5411,24 @@ void DisplayPersonnelTextOnTitleBar( void ) // draw email screen title text // font stuff - SetFont( FONT14ARIAL ); - SetFontForeground( FONT_WHITE ); + SetFont( FONT14ARIAL ); + SetFontForeground( FONT_WHITE ); SetFontBackground( FONT_BLACK ); - + // printf the title mprintf( PERS_TITLE_X, PERS_TITLE_Y, pPersTitleText[0] ); - + // reset the shadow - + } BOOLEAN DisplayHighLightBox( void ) { // will display highlight box around selected merc - VOBJECT_DESC VObjectDesc; - UINT32 uiBox = 0; - HVOBJECT hHandle; - + VOBJECT_DESC VObjectDesc; + UINT32 uiBox = 0; + HVOBJECT hHandle; + // load graphics // is the current selected face valid? @@ -5472,14 +5438,14 @@ BOOLEAN DisplayHighLightBox( void ) return ( FALSE ); } - // bounding - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + // bounding + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\PicBorde.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &uiBox)); // blit it GetVideoObject(&hHandle, uiBox); - BltVideoObject(FRAME_BUFFER, hHandle, 0,( INT16 ) ( SMALL_PORTRAIT_START_X+ ( iCurrentPersonSelectedId % PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_WIDTH - 2 ), ( INT16 ) ( SMALL_PORTRAIT_START_Y + ( iCurrentPersonSelectedId / PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_HEIGHT - 3 ), VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 0,( INT16 ) ( SMALL_PORTRAIT_START_X+ ( iCurrentPersonSelectedId % PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_WIDTH - 2 ), ( INT16 ) ( SMALL_PORTRAIT_START_Y + ( iCurrentPersonSelectedId / PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_HEIGHT - 3 ), VO_BLT_SRCTRANSPARENCY,NULL); // deleteit @@ -5568,8 +5534,8 @@ void AddCharacterToOtherList( SOLDIERTYPE *pSoldier ) } -// If you have hired a merc before, then the they left for whatever reason, and now you are hiring them again, -// we must get rid of them from the departed section in the personnel screen. ( wouldnt make sense for them +// If you have hired a merc before, then the they left for whatever reason, and now you are hiring them again, +// we must get rid of them from the departed section in the personnel screen. ( wouldnt make sense for them //to be on your team list, and departed list ) BOOLEAN RemoveNewlyHiredMercFromPersonnelDepartedList( UINT8 ubProfile ) { @@ -5605,25 +5571,25 @@ BOOLEAN RemoveNewlyHiredMercFromPersonnelDepartedList( UINT8 ubProfile ) return( FALSE ); } -// grab the id of the first merc being displayed +// grab the id of the first merc being displayed INT32 GetIdOfFirstDisplayedMerc( ) { SOLDIERTYPE *pSoldier; - INT32 cnt = 0, iCounter = 0; + INT32 cnt = 0; // set current soldier pSoldier = MercPtrs[ cnt ]; - if( fCurrentTeamMode == TRUE ) + if( fCurrentTeamMode == TRUE ) { // run through list of soldiers on players current team //cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++, pSoldier++ ) - { - if( ( pSoldier->bActive )&&( pSoldier->bLife > 0 ) ) - { - return( 0 ); - } + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++, pSoldier++ ) + { + if( ( pSoldier->bActive )&&( pSoldier->stats.bLife > 0 ) ) + { + return( 0 ); + } } return( -1 ); } @@ -5643,25 +5609,25 @@ INT32 GetIdOfThisSlot( INT32 iSlot ) // set current soldier pSoldier = MercPtrs[ cnt ]; - if( fCurrentTeamMode == TRUE ) + if( fCurrentTeamMode == TRUE ) { // run through list of soldiers on players current team cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++, pSoldier++ ) - { - if( ( pSoldier->bActive ) ) - { - + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++, pSoldier++ ) + { + if( ( pSoldier->bActive ) ) + { - // same character as slot, return this value - if( iCounter == iSlot ) - { + + // same character as slot, return this value + if( iCounter == iSlot ) + { return( cnt ); - } + } - // found another soldier - iCounter++; - } + // found another soldier + iCounter++; + } } } else @@ -5678,9 +5644,9 @@ INT32 GetIdOfThisSlot( INT32 iSlot ) BOOLEAN RenderAtmPanel( void ) { - VOBJECT_DESC VObjectDesc; - UINT32 uiBox = 0; - HVOBJECT hHandle; + VOBJECT_DESC VObjectDesc; + UINT32 uiBox = 0; + HVOBJECT hHandle; // render the ATM panel @@ -5748,7 +5714,7 @@ void CreateDestroyStartATMButton( void ) { static BOOLEAN fCreated = FALSE; // create/destroy atm start button as needed - + if( ( fCreated == FALSE ) && ( fShowAtmPanelStartButton == TRUE ) ) { @@ -5756,7 +5722,7 @@ void CreateDestroyStartATMButton( void ) /* // the ATM start button - giPersonnelATMStartButtonImage[ 0 ]= LoadButtonImage( "LAPTOP\\AtmButtons.sti" ,-1,2,-1,3,-1 ); + giPersonnelATMStartButtonImage[ 0 ]= LoadButtonImage( "LAPTOP\\AtmButtons.sti" ,-1,2,-1,3,-1 ); giPersonnelATMStartButton[ 0 ] = QuickCreateButton( giPersonnelATMStartButtonImage[ 0 ] , 519,87, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)ATMStartButtonCallback ); @@ -5768,7 +5734,7 @@ void CreateDestroyStartATMButton( void ) SetButtonCursor(giPersonnelATMStartButton[ 0 ], CURSOR_LAPTOP_SCREEN); */ // the stats button - giPersonnelATMStartButtonImage[ PERSONNEL_STAT_BTN ]= LoadButtonImage( "LAPTOP\\AtmButtons.sti" ,-1,2,-1,3,-1 ); + giPersonnelATMStartButtonImage[ PERSONNEL_STAT_BTN ]= LoadButtonImage( "LAPTOP\\AtmButtons.sti" ,-1,2,-1,3,-1 ); giPersonnelATMStartButton[ PERSONNEL_STAT_BTN ] = QuickCreateButton( giPersonnelATMStartButtonImage[ PERSONNEL_STAT_BTN ] , iScreenWidthOffset + 519, iScreenHeightOffset + 80, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, MSYS_NO_CALLBACK, (GUI_CALLBACK)PersonnelStatStartButtonCallback ); @@ -5780,7 +5746,7 @@ void CreateDestroyStartATMButton( void ) SetButtonCursor(giPersonnelATMStartButton[ PERSONNEL_STAT_BTN ], CURSOR_LAPTOP_SCREEN); // the Employment selection button - giPersonnelATMStartButtonImage[ PERSONNEL_EMPLOYMENT_BTN ]= LoadButtonImage( "LAPTOP\\AtmButtons.sti" ,-1,2,-1,3,-1 ); + giPersonnelATMStartButtonImage[ PERSONNEL_EMPLOYMENT_BTN ]= LoadButtonImage( "LAPTOP\\AtmButtons.sti" ,-1,2,-1,3,-1 ); giPersonnelATMStartButton[ PERSONNEL_EMPLOYMENT_BTN ] = QuickCreateButton( giPersonnelATMStartButtonImage[ PERSONNEL_EMPLOYMENT_BTN ] , iScreenWidthOffset + 519, iScreenHeightOffset + 110, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, MSYS_NO_CALLBACK, (GUI_CALLBACK)EmployementInfoButtonCallback ); @@ -5792,7 +5758,7 @@ void CreateDestroyStartATMButton( void ) SetButtonCursor(giPersonnelATMStartButton[ PERSONNEL_EMPLOYMENT_BTN ], CURSOR_LAPTOP_SCREEN); // the inventory selection button - giPersonnelATMStartButtonImage[ PERSONNEL_INV_BTN ]= LoadButtonImage( "LAPTOP\\AtmButtons.sti" ,-1,2,-1,3,-1 ); + giPersonnelATMStartButtonImage[ PERSONNEL_INV_BTN ]= LoadButtonImage( "LAPTOP\\AtmButtons.sti" ,-1,2,-1,3,-1 ); giPersonnelATMStartButton[ PERSONNEL_INV_BTN ] = QuickCreateButton( giPersonnelATMStartButtonImage[ PERSONNEL_INV_BTN ] , iScreenWidthOffset + 519, iScreenHeightOffset + 140, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, MSYS_NO_CALLBACK, (GUI_CALLBACK)PersonnelINVStartButtonCallback ); @@ -5803,7 +5769,7 @@ void CreateDestroyStartATMButton( void ) SpecifyButtonFont( giPersonnelATMStartButton[ PERSONNEL_INV_BTN ], PERS_FONT ); SetButtonCursor(giPersonnelATMStartButton[ PERSONNEL_INV_BTN ], CURSOR_LAPTOP_SCREEN); - + fCreated = TRUE; } else if( ( fCreated == TRUE ) && ( fShowAtmPanelStartButton == FALSE ) ) @@ -5829,8 +5795,6 @@ void FindPositionOfPersInvSlider( void ) INT32 iValue = 0; INT32 iNumberOfItems = 0; INT16 sSizeOfEachSubRegion = 0; - INT16 sYPositionOnBar = 0; - INT16 iCurrentItemValue = 0; // find out how many there are iValue = ( INT32 )( GetNumberOfInventoryItemsOnCurrentMerc( ) ); @@ -5844,7 +5808,7 @@ void FindPositionOfPersInvSlider( void ) } // get the subregion sizes - sSizeOfEachSubRegion = ( INT16 )( ( INT32 )( Y_SIZE_OF_PERSONNEL_SCROLL_REGION - SIZE_OF_PERSONNEL_CURSOR ) / ( INT32 )( iNumberOfItems ) ); + sSizeOfEachSubRegion = ( INT16 )( ( INT32 )( Y_SIZE_OF_PERSONNEL_SCROLL_REGION - SIZE_OF_PERSONNEL_CURSOR ) / ( INT32 )( iNumberOfItems ) ); // get slider position guiSliderPosition = uiCurrentInventoryIndex * sSizeOfEachSubRegion; @@ -5861,13 +5825,13 @@ void HandleSliderBarClickCallback( MOUSE_REGION *pRegion, INT32 iReason ) INT16 sYPositionOnBar = 0; INT16 iCurrentItemValue = 0; - if( ( iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) || ( iReason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) ) - { + if( ( iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) || ( iReason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) ) + { // find out how many there are iValue = ( INT32 )( GetNumberOfInventoryItemsOnCurrentMerc( ) ); - // make sure there are more than one page - if( ( INT32 )uiCurrentInventoryIndex >= iValue - NUMBER_OF_INVENTORY_PERSONNEL + 1 ) + // make sure there are more than one page + if( ( INT32 )uiCurrentInventoryIndex >= iValue - NUMBER_OF_INVENTORY_PERSONNEL + 1 ) { return; } @@ -5882,11 +5846,11 @@ void HandleSliderBarClickCallback( MOUSE_REGION *pRegion, INT32 iReason ) } // find the x,y on the slider bar - GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! + GetCursorPos(&MousePos); + ScreenToClient(ghWindow, &MousePos); // In window coords! // get the subregion sizes - sSizeOfEachSubRegion = ( INT16 )( ( INT32 )( Y_SIZE_OF_PERSONNEL_SCROLL_REGION - SIZE_OF_PERSONNEL_CURSOR ) / ( INT32 )( iNumberOfItems ) ); + sSizeOfEachSubRegion = ( INT16 )( ( INT32 )( Y_SIZE_OF_PERSONNEL_SCROLL_REGION - SIZE_OF_PERSONNEL_CURSOR ) / ( INT32 )( iNumberOfItems ) ); // get the cursor placement sYPositionOnBar = (INT16) MousePos.y - Y_OF_PERSONNEL_SCROLL_REGION; @@ -5932,14 +5896,14 @@ void CreateDestroyATMButton( void ) static BOOLEAN fCreated = FALSE; CHAR16 sString[ 32 ]; - + // create/destroy atm start button as needed INT32 iCounter = 0; if( ( fCreated == FALSE ) && ( fShowAtmPanel == TRUE ) ) { - + for( iCounter = 0; iCounter < 10; iCounter++ ) { if( iCounter != 9 ) @@ -5956,7 +5920,7 @@ void CreateDestroyATMButton( void ) iNumberPadButtons[ iCounter ] = QuickCreateButton( iNumberPadButtonsImages[ iCounter ], ( INT16 )( ATM_BUTTONS_START_X + ( ATM_BUTTON_WIDTH * ( INT16 )( iCounter % 3 )) ), ( INT16 )( ATM_BUTTONS_START_Y + ( INT16 )( ATM_BUTTON_HEIGHT * ( iCounter / 3 ))) , BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)ATMNumberButtonCallback ); - + if( iCounter != 9) { MSYS_SetBtnUserData(iNumberPadButtons[iCounter],0,iCounter + 1 ); @@ -5978,13 +5942,13 @@ void CreateDestroyATMButton( void ) { if( iCounter == OK_ATM ) { - giPersonnelATMSideButtonImage[ iCounter ]= LoadButtonImage( "LAPTOP\\AtmButtons.sti" ,-1,7,-1,9,-1 ); + giPersonnelATMSideButtonImage[ iCounter ]= LoadButtonImage( "LAPTOP\\AtmButtons.sti" ,-1,7,-1,9,-1 ); } else { - giPersonnelATMSideButtonImage[ iCounter ]= LoadButtonImage( "LAPTOP\\AtmButtons.sti" ,-1,10,-1,12,-1 ); + giPersonnelATMSideButtonImage[ iCounter ]= LoadButtonImage( "LAPTOP\\AtmButtons.sti" ,-1,10,-1,12,-1 ); } - + if( ( iCounter != DEPOSIT_ATM ) && ( iCounter != WIDTHDRAWL_ATM ) ) { giPersonnelATMSideButton[ iCounter ] = QuickCreateButton( giPersonnelATMSideButtonImage[ iCounter ], ( INT16 )( pAtmSideButtonPts[ iCounter ].x ), ( INT16 )( pAtmSideButtonPts[ iCounter ].y ), @@ -6013,7 +5977,7 @@ void CreateDestroyATMButton( void ) // stop showing //RemoveButton( giPersonnelATMButton ); //UnloadButtonImage( giPersonnelATMButtonImage ); - + for( iCounter = 0; iCounter < 10; iCounter++ ) { UnloadButtonImage( iNumberPadButtonsImages[ iCounter ] ); @@ -6022,7 +5986,7 @@ void CreateDestroyATMButton( void ) for( iCounter = OK_ATM; iCounter < NUMBER_ATM_BUTTONS ;iCounter++ ) { - RemoveButton( giPersonnelATMSideButton[ iCounter ] ); + RemoveButton( giPersonnelATMSideButton[ iCounter ] ); UnloadButtonImage( giPersonnelATMSideButtonImage[ iCounter ] ); } @@ -6044,7 +6008,7 @@ void ATMStartButtonCallback(GUI_BUTTON *btn,INT32 reason) { fReDrawScreenFlag=TRUE; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { @@ -6068,7 +6032,7 @@ void PersonnelINVStartButtonCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { fReDrawScreenFlag=TRUE; - btn->uiFlags |= (BUTTON_CLICKED_ON); + btn->uiFlags |= (BUTTON_CLICKED_ON); ButtonList[giPersonnelATMStartButton[ PERSONNEL_STAT_BTN ] ]->uiFlags &= ~(BUTTON_CLICKED_ON); ButtonList[giPersonnelATMStartButton[ PERSONNEL_EMPLOYMENT_BTN ] ]->uiFlags &= ~(BUTTON_CLICKED_ON); // fShowInventory = TRUE; @@ -6082,11 +6046,11 @@ void PersonnelStatStartButtonCallback(GUI_BUTTON *btn,INT32 reason) return; if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) - { + { fReDrawScreenFlag=TRUE; - btn->uiFlags |= BUTTON_CLICKED_ON; - ButtonList[giPersonnelATMStartButton[ PERSONNEL_EMPLOYMENT_BTN ] ]->uiFlags &= ~(BUTTON_CLICKED_ON); - ButtonList[giPersonnelATMStartButton[ PERSONNEL_INV_BTN ] ]->uiFlags &= ~(BUTTON_CLICKED_ON); + btn->uiFlags |= BUTTON_CLICKED_ON; + ButtonList[giPersonnelATMStartButton[ PERSONNEL_EMPLOYMENT_BTN ] ]->uiFlags &= ~(BUTTON_CLICKED_ON); + ButtonList[giPersonnelATMStartButton[ PERSONNEL_INV_BTN ] ]->uiFlags &= ~(BUTTON_CLICKED_ON); // fShowInventory = FALSE; gubPersonnelInfoState = PRSNL_STATS; } @@ -6099,11 +6063,11 @@ void EmployementInfoButtonCallback(GUI_BUTTON *btn,INT32 reason) return; if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) - { + { fReDrawScreenFlag=TRUE; - btn->uiFlags |= BUTTON_CLICKED_ON; - ButtonList[giPersonnelATMStartButton[ PERSONNEL_INV_BTN ] ]->uiFlags &= ~(BUTTON_CLICKED_ON); - ButtonList[giPersonnelATMStartButton[ PERSONNEL_STAT_BTN ] ]->uiFlags &= ~(BUTTON_CLICKED_ON); + btn->uiFlags |= BUTTON_CLICKED_ON; + ButtonList[giPersonnelATMStartButton[ PERSONNEL_INV_BTN ] ]->uiFlags &= ~(BUTTON_CLICKED_ON); + ButtonList[giPersonnelATMStartButton[ PERSONNEL_STAT_BTN ] ]->uiFlags &= ~(BUTTON_CLICKED_ON); gubPersonnelInfoState = PRSNL_EMPLOYMENT; } } @@ -6112,9 +6076,6 @@ void EmployementInfoButtonCallback(GUI_BUTTON *btn,INT32 reason) void ATMOther2ButtonCallback(GUI_BUTTON *btn,INT32 reason) { INT32 iValue = 0; - SOLDIERTYPE *pSoldier = MercPtrs[ 0 ]; - INT32 cnt = 0; - INT32 iId = 0; if (!(btn->uiFlags & BUTTON_ENABLED)) return; @@ -6128,8 +6089,8 @@ void ATMOther2ButtonCallback(GUI_BUTTON *btn,INT32 reason) { fReDrawScreenFlag=TRUE; } - btn->uiFlags|=(BUTTON_CLICKED_ON); - + btn->uiFlags|=(BUTTON_CLICKED_ON); + switch( iValue ) { case( DEPOSIT_ATM ): @@ -6166,7 +6127,7 @@ void ATMOtherButtonCallback(GUI_BUTTON *btn,INT32 reason) { fReDrawScreenFlag=TRUE; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { @@ -6286,7 +6247,7 @@ void ATMOtherButtonCallback(GUI_BUTTON *btn,INT32 reason) { fShowAtmPanel = FALSE; fShowAtmPanelStartButton = TRUE; - + } fReDrawScreenFlag=TRUE; break; @@ -6319,7 +6280,7 @@ void ATMNumberButtonCallback(GUI_BUTTON *btn,INT32 reason) { fReDrawScreenFlag=TRUE; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { @@ -6331,7 +6292,7 @@ void ATMNumberButtonCallback(GUI_BUTTON *btn,INT32 reason) sTransferString[ iCounter ] = ( sZero[ 0 ] + ( UINT16 )iValue ); sTransferString[ iCounter + 1 ] = 0; fReDrawScreenFlag=TRUE; - + // gone too far if( StringPixLength( sTransferString, ATM_FONT ) >= ATM_DISPLAY_WIDTH - 10 ) { @@ -6346,7 +6307,6 @@ void DisplayATMAmount( void ) INT16 sX = 0, sY = 0; CHAR16 sTempString[ 32 ]; - CHAR16 sZero[ 2 ] = L"0"; INT32 iCounter = 0; if( fShowAtmPanel == FALSE ) @@ -6368,7 +6328,7 @@ void DisplayATMAmount( void ) // insert commas and dollar sign InsertCommasForDollarFigure( sTempString ); InsertDollarSignInToString( sTempString ); - + // set font SetFont( ATM_FONT ); @@ -6401,7 +6361,7 @@ void HandleStateOfATMButtons( void ) for( iCounter = 0; iCounter < NUMBER_ATM_BUTTONS; iCounter++ ) { - if( ( iCounter != DEPOSIT_ATM) && ( iCounter != WIDTHDRAWL_ATM ) && ( iCounter != CANCEL_ATM ) ) + if( ( iCounter != DEPOSIT_ATM) && ( iCounter != WIDTHDRAWL_ATM ) && ( iCounter != CANCEL_ATM ) ) { DisableButton( giPersonnelATMSideButton[ iCounter ] ); } @@ -6425,7 +6385,7 @@ void HandleStateOfATMButtons( void ) INT32 GetFundsOnMerc( SOLDIERTYPE *pSoldier ) { INT32 iCurrentAmount = 0; - INT32 iCurrentPocket = 0; + UINT32 iCurrentPocket = 0; // run through mercs pockets, if any money in them, add to total // error check @@ -6435,11 +6395,11 @@ INT32 GetFundsOnMerc( SOLDIERTYPE *pSoldier ) } // run through grunts pockets and count all the spare change - for( iCurrentPocket = 0; iCurrentPocket < NUM_INV_SLOTS; iCurrentPocket++ ) + for( iCurrentPocket = 0; iCurrentPocket < pSoldier->inv.size(); iCurrentPocket++ ) { if ( Item[ pSoldier->inv[ iCurrentPocket ] .usItem ].usItemClass == IC_MONEY ) { - iCurrentAmount += pSoldier->inv[ iCurrentPocket ].ItemData.Money.uiMoneyAmount; + iCurrentAmount += pSoldier->inv[ iCurrentPocket ][0]->data.money.uiMoneyAmount; } } @@ -6449,11 +6409,6 @@ INT32 GetFundsOnMerc( SOLDIERTYPE *pSoldier ) BOOLEAN TransferFundsFromMercToBank( SOLDIERTYPE *pSoldier, INT32 iCurrentBalance ) { - INT32 iCurrentPocket = 0; - INT32 iAmountLeftToTake = iCurrentBalance; - OBJECTTYPE ObjectToRemove; - - // move this amount of money from the grunt to the bank // error check if( pSoldier == NULL ) @@ -6461,27 +6416,29 @@ BOOLEAN TransferFundsFromMercToBank( SOLDIERTYPE *pSoldier, INT32 iCurrentBalanc return FALSE; } + UINT32 iCurrentPocket = 0; + INT32 iAmountLeftToTake = iCurrentBalance; // run through grunts pockets and count all the spare change - for( iCurrentPocket = 0; iCurrentPocket < NUM_INV_SLOTS; iCurrentPocket++ ) + for( iCurrentPocket = 0; iCurrentPocket < pSoldier->inv.size(); iCurrentPocket++ ) { if ( Item[ pSoldier->inv[ iCurrentPocket ] .usItem ].usItemClass == IC_MONEY ) { // is there more left to go, or does this pocket finish it off? - if( pSoldier->inv[ iCurrentPocket ].ItemData.Money.uiMoneyAmount > ( UINT32 )iAmountLeftToTake ) + if( pSoldier->inv[ iCurrentPocket ][0]->data.money.uiMoneyAmount > ( UINT32 )iAmountLeftToTake ) { - pSoldier->inv[ iCurrentPocket ].ItemData.Money.uiMoneyAmount -= iAmountLeftToTake; + pSoldier->inv[ iCurrentPocket ][0]->data.money.uiMoneyAmount -= iAmountLeftToTake; iAmountLeftToTake = 0; } else { - iAmountLeftToTake -= pSoldier->inv[ iCurrentPocket ].ItemData.Money.uiMoneyAmount; - pSoldier->inv[ iCurrentPocket ].ItemData.Money.uiMoneyAmount = 0; + iAmountLeftToTake -= pSoldier->inv[ iCurrentPocket ][0]->data.money.uiMoneyAmount; + pSoldier->inv[ iCurrentPocket ][0]->data.money.uiMoneyAmount = 0; //Remove the item out off the merc - RemoveObjectFromSlot( pSoldier, (INT8)iCurrentPocket, &ObjectToRemove ); + DeleteObj(&pSoldier->inv[iCurrentPocket]); } - } + } } if( iAmountLeftToTake != 0 ) @@ -6501,8 +6458,6 @@ BOOLEAN TransferFundsFromMercToBank( SOLDIERTYPE *pSoldier, INT32 iCurrentBalanc BOOLEAN TransferFundsFromBankToMerc( SOLDIERTYPE *pSoldier, INT32 iCurrentBalance ) { - OBJECTTYPE pMoneyObject; - // move this amount of money from the grunt to the bank // error check if( pSoldier == NULL ) @@ -6523,19 +6478,11 @@ BOOLEAN TransferFundsFromBankToMerc( SOLDIERTYPE *pSoldier, INT32 iCurrentBalanc } - // set up object - memset( &( pMoneyObject ), 0, sizeof( OBJECTTYPE ) ); - // set up money object - pMoneyObject.usItem = MONEY; - pMoneyObject.ubNumberOfObjects = 1; - pMoneyObject.ItemData.Money.bMoneyStatus = 100; - //pMoneyObject.ItemData.Generic.bStatus[0] = 100; // Isn't this the same as the previous line? - pMoneyObject.ItemData.Money.uiMoneyAmount = iCurrentBalance; - + CreateMoney(iCurrentBalance, &gTempObject); // now auto place money object - if( AutoPlaceObject( pSoldier, &( pMoneyObject ), TRUE ) == TRUE ) + if( AutoPlaceObject( pSoldier, &( gTempObject ), TRUE ) == TRUE ) { // now place transaction AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, pSoldier->ubProfile, GetWorldTotalMin() , -( iCurrentBalance ) ); @@ -6659,7 +6606,7 @@ void UpDateStateOfStartButton( void ) } } - + } else { @@ -6670,7 +6617,7 @@ void UpDateStateOfStartButton( void ) DisableButton( giPersonnelATMStartButton[ PERSONNEL_EMPLOYMENT_BTN ] ); } - + } else { @@ -6703,14 +6650,14 @@ void DisplayAmountOnCurrentMerc( void ) pSoldier = MercPtrs[ iId ]; } - iFunds = GetFundsOnMerc( pSoldier ); + iFunds = GetFundsOnMerc( pSoldier ); swprintf( sString, L"%d", iFunds ); // insert commas and dollar sign InsertCommasForDollarFigure( sString ); InsertDollarSignInToString( sString ); - + // set font SetFont( ATM_FONT ); @@ -6732,15 +6679,15 @@ void HandlePersonnelKeyboard( void ) INT32 iCounter = 0; INT32 iValue = 0; CHAR16 sZero[ 2 ] = L"0"; - + InputAtom InputEvent; - POINT MousePos; + POINT MousePos; GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! + ScreenToClient(ghWindow, &MousePos); // In window coords! - while (DequeueEvent(&InputEvent) == TRUE) - { + while (DequeueEvent(&InputEvent) == TRUE) + { if ( (InputEvent.usEvent == KEY_DOWN ) && (InputEvent.usParam >= '0' ) && ( InputEvent.usParam <= '9') ) { if( ( fShowAtmPanel ) && ( fATMFlags != 0 ) ) @@ -6751,7 +6698,7 @@ void HandlePersonnelKeyboard( void ) sTransferString[ iCounter ] = ( sZero[ 0 ] + ( UINT16 )iValue ); sTransferString[ iCounter + 1 ] = 0; fPausedReDrawScreenFlag=TRUE; - + // gone too far if( StringPixLength( sTransferString, ATM_FONT ) >= ATM_DISPLAY_WIDTH - 10 ) { @@ -6766,14 +6713,13 @@ void HandlePersonnelKeyboard( void ) void RenderRectangleForPersonnelTransactionAmount( void ) { - INT32 iLength = 0; + INT32 iLength = 0; INT32 iHeight = GetFontHeight( ATM_FONT ); - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; CHAR16 sTempString[ 32 ]; - CHAR16 sZero[ 2 ] = L"0"; - INT32 iCounter = 0; - + INT32 iCounter = 0; + wcscpy( sTempString, sTransferString ); @@ -6789,19 +6735,19 @@ void RenderRectangleForPersonnelTransactionAmount( void ) // insert commas and dollar sign InsertCommasForDollarFigure( sTempString ); InsertDollarSignInToString( sTempString ); - + // string not worth worrying about? if( wcslen( sTempString ) < 2 ) { return; } - // grab total length + // grab total length iLength = StringPixLength( sTempString, ATM_FONT ); - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); RestoreClipRegionToFullScreenForRectangle( uiDestPitchBYTES ); - RectangleDraw( TRUE, ( ATM_DISPLAY_X + ATM_DISPLAY_WIDTH ) - iLength - 2, ATM_DISPLAY_Y + 35, ATM_DISPLAY_X + ATM_DISPLAY_WIDTH + 1, ATM_DISPLAY_Y + iHeight + 36, Get16BPPColor( FROMRGB( 255, 255, 255 ) ), pDestBuf ); + RectangleDraw( TRUE, ( ATM_DISPLAY_X + ATM_DISPLAY_WIDTH ) - iLength - 2, ATM_DISPLAY_Y + 35, ATM_DISPLAY_X + ATM_DISPLAY_WIDTH + 1, ATM_DISPLAY_Y + iHeight + 36, Get16BPPColor( FROMRGB( 255, 255, 255 ) ), pDestBuf ); UnLockVideoSurface( FRAME_BUFFER ); } @@ -6855,7 +6801,7 @@ BOOLEAN IsPastMercDead( INT32 iId ) BOOLEAN IsPastMercFired( INT32 iId ) { - if( GetTheStateOfDepartedMerc( GetIdOfPastMercInSlot( iId ) ) == DEPARTED_FIRED ) + if( GetTheStateOfDepartedMerc( GetIdOfPastMercInSlot( iId ) ) == DEPARTED_FIRED ) { return( TRUE ); } @@ -6867,7 +6813,7 @@ BOOLEAN IsPastMercFired( INT32 iId ) BOOLEAN IsPastMercOther( INT32 iId ) { - if( GetTheStateOfDepartedMerc( GetIdOfPastMercInSlot( iId ) ) == DEPARTED_OTHER ) + if( GetTheStateOfDepartedMerc( GetIdOfPastMercInSlot( iId ) ) == DEPARTED_OTHER ) { return( TRUE ); } @@ -6885,10 +6831,9 @@ void DisplayEmploymentinformation( INT32 iId, INT32 iSlot ) CHAR16 sString[50]; CHAR16 sStringA[ 50 ]; INT16 sX, sY; - UINT32 uiHits = 0; - - - if( Menptr[iId].uiStatusFlags & SOLDIER_VEHICLE ) + + + if( Menptr[iId].flags.uiStatusFlags & SOLDIER_VEHICLE ) { return; } @@ -6899,13 +6844,13 @@ void DisplayEmploymentinformation( INT32 iId, INT32 iSlot ) switch(iCounter) { -// case 12: +// case 12: //Remaining Contract: case 0: { - UINT32 uiTimeUnderThisDisplayAsHours = 24*60; - UINT32 uiMinutesInDay = 24 * 60; + //UINT32 uiTimeUnderThisDisplayAsHours = 24*60; + static const UINT32 uiMinutesInDay = 24 * 60; if(Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC || Menptr[iId].ubProfile == SLAY ) { @@ -6924,7 +6869,7 @@ void DisplayEmploymentinformation( INT32 iId, INT32 iSlot ) if( iTimeLeftOnContract / uiMinutesInDay ) { swprintf(sString, L"%d%s %d%s / %d%s",( iTimeLeftOnContract / uiMinutesInDay ), gpStrategicString[ STR_PB_DAYS_ABBREVIATION ], (iTimeLeftOnContract % uiMinutesInDay)/60, gpStrategicString[ STR_PB_HOURS_ABBREVIATION ], Menptr[iId].iTotalContractLength, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ]); - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[PRSNL_TXT_CURRENT_CONTRACT]); + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[PRSNL_TXT_CURRENT_CONTRACT]); } //else there is under a day left @@ -6932,7 +6877,7 @@ void DisplayEmploymentinformation( INT32 iId, INT32 iSlot ) { //DEF: removed 2/7/99 swprintf(sString, L"%d%s / %d%s", (iTimeLeftOnContract % uiMinutesInDay)/60, gpStrategicString[ STR_PB_HOURS_ABBREVIATION ], Menptr[iId].iTotalContractLength, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ]); - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[PRSNL_TXT_CURRENT_CONTRACT]); + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[PRSNL_TXT_CURRENT_CONTRACT]); } } @@ -6949,65 +6894,65 @@ void DisplayEmploymentinformation( INT32 iId, INT32 iSlot ) mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[PRSNL_TXT_CURRENT_CONTRACT]); } - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)+Prsnl_DATA_OffSetX),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)+Prsnl_DATA_OffSetX),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } break; -// case 11: -// case 19: - case 1: +// case 11: +// case 19: + case 1: - // total contract time served - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[PRSNL_TXT_TOTAL_SERVICE]); + // total contract time served + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[PRSNL_TXT_TOTAL_SERVICE]); //./DEF 2/4/99: total service days used to be calced as 'days -1' swprintf(sString, L"%d %s",gMercProfiles[Menptr[iId].ubProfile].usTotalDaysServed, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ] ); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)+Prsnl_DATA_OffSetX),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)+Prsnl_DATA_OffSetX),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; -// case 13: - case 3: - // cost (PRSNL_TXT_TOTAL_COST) +// case 13: + case 3: + // cost (PRSNL_TXT_TOTAL_COST) /* - if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) - { - UINT32 uiDailyCost = 0; + if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) + { + UINT32 uiDailyCost = 0; - if( Menptr[iId].bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK ) - { - // 2 week contract - uiDailyCost = gMercProfiles[ Menptr[ iId ].ubProfile ].uiBiWeeklySalary / 14; - } - else if( Menptr[iId].bTypeOfLastContract == CONTRACT_EXTEND_1_WEEK ) - { - // 1 week contract - uiDailyCost = gMercProfiles[ Menptr[ iId ].ubProfile ].uiWeeklySalary / 7; - } - else - { - uiDailyCost = gMercProfiles[ Menptr[ iId ].ubProfile ].sSalary; - } + if( Menptr[iId].bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK ) + { + // 2 week contract + uiDailyCost = gMercProfiles[ Menptr[ iId ].ubProfile ].uiBiWeeklySalary / 14; + } + else if( Menptr[iId].bTypeOfLastContract == CONTRACT_EXTEND_1_WEEK ) + { + // 1 week contract + uiDailyCost = gMercProfiles[ Menptr[ iId ].ubProfile ].uiWeeklySalary / 7; + } + else + { + uiDailyCost = gMercProfiles[ Menptr[ iId ].ubProfile ].sSalary; + } -// swprintf( sString, L"%d",uiDailyCost * Menptr[ iId ].iTotalContractLength ); - swprintf( sString, L"%d", gMercProfiles[ Menptr[ iId ].ubProfile ].uiTotalCostToDate ); - } - else if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__MERC) - { +// swprintf( sString, L"%d",uiDailyCost * Menptr[ iId ].iTotalContractLength ); + swprintf( sString, L"%d", gMercProfiles[ Menptr[ iId ].ubProfile ].uiTotalCostToDate ); + } + else if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__MERC) + { // swprintf( sString, L"%d",gMercProfiles[ Menptr[ iId ].ubProfile ].sSalary * gMercProfiles[ Menptr[ iId ].ubProfile ].iMercMercContractLength ); swprintf( sString, L"%d", gMercProfiles[ Menptr[ iId ].ubProfile ].uiTotalCostToDate ); - } - else - { - //Display a $0 amount -// swprintf( sString, L"0" ); + } + else + { + //Display a $0 amount +// swprintf( sString, L"0" ); - swprintf( sString, L"%d", gMercProfiles[ Menptr[ iId ].ubProfile ].uiTotalCostToDate ); - } + swprintf( sString, L"%d", gMercProfiles[ Menptr[ iId ].ubProfile ].uiTotalCostToDate ); + } */ swprintf( sString, L"%d", gMercProfiles[ Menptr[ iId ].ubProfile ].uiTotalCostToDate ); @@ -7017,86 +6962,86 @@ void DisplayEmploymentinformation( INT32 iId, INT32 iSlot ) /* DEF:3/19/99: - if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__MERC ) - { - swprintf( sStringA, L"%s", pPersonnelScreenStrings[ PRSNL_TXT_UNPAID_AMOUNT ] ); - } - else + if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__MERC ) + { + swprintf( sStringA, L"%s", pPersonnelScreenStrings[ PRSNL_TXT_UNPAID_AMOUNT ] ); + } + else */ - { - swprintf( sStringA, L"%s", pPersonnelScreenStrings[ PRSNL_TXT_TOTAL_COST ] ); - } + { + swprintf( sStringA, L"%s", pPersonnelScreenStrings[ PRSNL_TXT_TOTAL_COST ] ); + } - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)+Prsnl_DATA_OffSetX),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf( (INT16)(pPersonnelScreenPoints[iCounter].x +(iSlot*TEXT_BOX_WIDTH) ),pPersonnelScreenPoints[ iCounter ].y,sStringA); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)+Prsnl_DATA_OffSetX),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf( (INT16)(pPersonnelScreenPoints[iCounter].x +(iSlot*TEXT_BOX_WIDTH) ),pPersonnelScreenPoints[ iCounter ].y,sStringA); - // print contract cost - mprintf( ( INT16 ) ( sX ) , pPersonnelScreenPoints[iCounter].y,sString); - - if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) - { - // daily rate - if( Menptr[iId].bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK ) - { - // 2 week contract - swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].uiBiWeeklySalary / 14 ); - InsertCommasForDollarFigure( sStringA ); - InsertDollarSignInToString( sStringA ); - swprintf( sString, L"%s", sStringA ); - } - else if( Menptr[iId].bTypeOfLastContract == CONTRACT_EXTEND_1_WEEK ) - { - // 1 week contract - swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].uiWeeklySalary / 7 ); - InsertCommasForDollarFigure( sStringA ); - InsertDollarSignInToString( sStringA ); - swprintf( sString, L"%s", sStringA ); - } - else - { + // print contract cost + mprintf( ( INT16 ) ( sX ) , pPersonnelScreenPoints[iCounter].y,sString); - swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].sSalary ); - InsertCommasForDollarFigure( sStringA ); - InsertDollarSignInToString( sStringA ); - swprintf( sString, L"%s", sStringA ); - } - } - else if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__MERC) - { + if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) + { + // daily rate + if( Menptr[iId].bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK ) + { + // 2 week contract + swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].uiBiWeeklySalary / 14 ); + InsertCommasForDollarFigure( sStringA ); + InsertDollarSignInToString( sStringA ); + swprintf( sString, L"%s", sStringA ); + } + else if( Menptr[iId].bTypeOfLastContract == CONTRACT_EXTEND_1_WEEK ) + { + // 1 week contract + swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].uiWeeklySalary / 7 ); + InsertCommasForDollarFigure( sStringA ); + InsertDollarSignInToString( sStringA ); + swprintf( sString, L"%s", sStringA ); + } + else + { + + swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].sSalary ); + InsertCommasForDollarFigure( sStringA ); + InsertDollarSignInToString( sStringA ); + swprintf( sString, L"%s", sStringA ); + } + } + else if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__MERC) + { //DEF: 99/2/7 -// swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].sSalary * Menptr[ iId ].iTotalContractLength); - swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].sSalary ); - InsertCommasForDollarFigure( sStringA ); - InsertDollarSignInToString( sStringA ); - swprintf( sString, L"%s", sStringA ); - } +// swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].sSalary * Menptr[ iId ].iTotalContractLength); + swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].sSalary ); + InsertCommasForDollarFigure( sStringA ); + InsertDollarSignInToString( sStringA ); + swprintf( sString, L"%s", sStringA ); + } - else - { - //Display a $0 amount -// swprintf( sString, L"0" ); -// InsertDollarSignInToString( sString ); - swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].sSalary ); - InsertCommasForDollarFigure( sStringA ); - InsertDollarSignInToString( sStringA ); - swprintf( sString, L"%s", sStringA ); - } + else + { + //Display a $0 amount +// swprintf( sString, L"0" ); +// InsertDollarSignInToString( sString ); + swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].sSalary ); + InsertCommasForDollarFigure( sStringA ); + InsertDollarSignInToString( sStringA ); + swprintf( sString, L"%s", sStringA ); + } - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)+Prsnl_DATA_OffSetX),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)+Prsnl_DATA_OffSetX),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); -// iCounter++; - iCounter++; +// iCounter++; + iCounter++; - // now print daily rate - mprintf( ( INT16 )( sX ),pPersonnelScreenPoints[ iCounter+1 ].y,sString); - mprintf( (INT16)(pPersonnelScreenPoints[iCounter+1].x +(iSlot*TEXT_BOX_WIDTH) ),pPersonnelScreenPoints[ iCounter +1].y, pPersonnelScreenStrings[PRSNL_TXT_DAILY_COST]); - - break; + // now print daily rate + mprintf( ( INT16 )( sX ),pPersonnelScreenPoints[ iCounter+1 ].y,sString); + mprintf( (INT16)(pPersonnelScreenPoints[iCounter+1].x +(iSlot*TEXT_BOX_WIDTH) ),pPersonnelScreenPoints[ iCounter +1].y, pPersonnelScreenStrings[PRSNL_TXT_DAILY_COST]); - case 5: - // medical deposit + break; - //if its a merc merc, display the salary oweing + case 5: + // medical deposit + + //if its a merc merc, display the salary oweing if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__MERC ) { mprintf((INT16)(pPersonnelScreenPoints[iCounter-1].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter-1].y,pPersonnelScreenStrings[PRSNL_TXT_UNPAID_AMOUNT]); @@ -7105,12 +7050,12 @@ DEF:3/19/99: InsertCommasForDollarFigure( sString ); InsertDollarSignInToString( sString ); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter-1].x+(iSlot*TEXT_BOX_WIDTH)+Prsnl_DATA_OffSetX),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter-1].x+(iSlot*TEXT_BOX_WIDTH)+Prsnl_DATA_OffSetX),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); mprintf(sX,pPersonnelScreenPoints[iCounter-1].y,sString); } else { - mprintf((INT16)(pPersonnelScreenPoints[iCounter-1].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter-1].y,pPersonnelScreenStrings[PRSNL_TXT_MED_DEPOSIT]); + mprintf((INT16)(pPersonnelScreenPoints[iCounter-1].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter-1].y,pPersonnelScreenStrings[PRSNL_TXT_MED_DEPOSIT]); swprintf(sString, L"%d",gMercProfiles[Menptr[iId].ubProfile].sMedicalDepositAmount); @@ -7118,18 +7063,18 @@ DEF:3/19/99: InsertCommasForDollarFigure( sString ); InsertDollarSignInToString( sString ); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter-1].x+(iSlot*TEXT_BOX_WIDTH)+Prsnl_DATA_OffSetX),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter-1].x+(iSlot*TEXT_BOX_WIDTH)+Prsnl_DATA_OffSetX),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); mprintf(sX,pPersonnelScreenPoints[iCounter-1].y,sString); } - - break; + + break; } } } -// AIM merc: Returns the amount of time left on mercs contract +// AIM merc: Returns the amount of time left on mercs contract // MERC merc: Returns the amount of time the merc has worked // IMP merc: Returns the amount of time the merc has worked // else: returns -1 @@ -7165,6 +7110,7 @@ INT32 CalcTimeLeftOnMercContract( SOLDIERTYPE *pSoldier ) - + + diff --git a/Laptop/sirtech.cpp b/Laptop/sirtech.cpp index 38bc8c73..82876a25 100644 --- a/Laptop/sirtech.cpp +++ b/Laptop/sirtech.cpp @@ -32,6 +32,7 @@ void RenderSirTech() - + + diff --git a/Loading Screen.cpp b/Loading Screen.cpp index c12b32d2..1a9dba07 100644 --- a/Loading Screen.cpp +++ b/Loading Screen.cpp @@ -19,29 +19,29 @@ extern HVSURFACE ghFrameBuffer; -STR8 szSectorMap[MAP_WORLD_Y][MAP_WORLD_X] = { - {"N", "N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N"}, - - {"N", "A1","A2","A3","A4","A5","A6","A7","A8","A9","A10","A11","A12","A13","A14","A15","A16" ,"N"}, - {"N", "B1","B2","B3","B4","B5","B6","B7","B8","B9","B10","B11","B12","B13","B14","B15","B16" ,"N"}, - {"N", "C1","C2","C3","C4","C5","C6","C7","C8","C9","C10","C11","C12","C13","C14","C15","C16" ,"N"}, - {"N", "D1","D2","D3","D4","D5","D6","D7","D8","D9","D10","D11","D12","D13","D14","D15","D16" ,"N"}, - {"N", "E1","E2","E3","E4","E5","E6","E7","E8","E9","E10","E11","E12","E13","E14","E15","E16" ,"N"}, - {"N", "F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","F13","F14","F15","F16" ,"N"}, - {"N", "G1","G2","G3","G4","G5","G6","G7","G8","G9","G10","G11","G12","G13","G14","G15","G16" ,"N"}, - {"N", "H1","H2","H3","H4","H5","H6","H7","H8","H9","H10","H11","H12","H13","H14","H15","H16" ,"N"}, - {"N", "I1","I2","I3","I4","I5","I6","I7","I8","I9","I10","I11","I12","I13","I14","I15","I16" ,"N"}, - {"N", "J1","J2","J3","J4","J5","J6","J7","J8","J9","J10","J11","J12","J13","J14","J15","J16" ,"N"}, - {"N", "K1","K2","K3","K4","K5","K6","K7","K8","K9","K10","K11","K12","K13","K14","K15","K16" ,"N"}, - {"N", "L1","L2","L3","L4","L5","L6","L7","L8","L9","L10","L11","L12","L13","L14","L15","L16" ,"N"}, - {"N", "M1","M2","M3","M4","M5","M6","M7","M8","M9","M10","M11","M12","M13","M14","M15","M16" ,"N"}, - {"N", "N1","N2","N3","N4","N5","N6","N7","N8","N9","N10","N11","N12","N13","N14","N15","N16" ,"N"}, - {"N", "O1","O2","O3","O4","O5","O6","O7","O8","O9","O10","O11","O12","O13","O14","O15","O16" ,"N"}, - {"N", "P1","P2","P3","P4","P5","P6","P7","P8","P9","P10","P11","P12","P13","P14","P15","P16" ,"N"}, - - {"N","N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N"} +STR8 szSectorMap[MAP_WORLD_Y][MAP_WORLD_X] = { + {"N", "N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N"}, + + {"N", "A1","A2","A3","A4","A5","A6","A7","A8","A9","A10","A11","A12","A13","A14","A15","A16" ,"N"}, + {"N", "B1","B2","B3","B4","B5","B6","B7","B8","B9","B10","B11","B12","B13","B14","B15","B16" ,"N"}, + {"N", "C1","C2","C3","C4","C5","C6","C7","C8","C9","C10","C11","C12","C13","C14","C15","C16" ,"N"}, + {"N", "D1","D2","D3","D4","D5","D6","D7","D8","D9","D10","D11","D12","D13","D14","D15","D16" ,"N"}, + {"N", "E1","E2","E3","E4","E5","E6","E7","E8","E9","E10","E11","E12","E13","E14","E15","E16" ,"N"}, + {"N", "F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","F13","F14","F15","F16" ,"N"}, + {"N", "G1","G2","G3","G4","G5","G6","G7","G8","G9","G10","G11","G12","G13","G14","G15","G16" ,"N"}, + {"N", "H1","H2","H3","H4","H5","H6","H7","H8","H9","H10","H11","H12","H13","H14","H15","H16" ,"N"}, + {"N", "I1","I2","I3","I4","I5","I6","I7","I8","I9","I10","I11","I12","I13","I14","I15","I16" ,"N"}, + {"N", "J1","J2","J3","J4","J5","J6","J7","J8","J9","J10","J11","J12","J13","J14","J15","J16" ,"N"}, + {"N", "K1","K2","K3","K4","K5","K6","K7","K8","K9","K10","K11","K12","K13","K14","K15","K16" ,"N"}, + {"N", "L1","L2","L3","L4","L5","L6","L7","L8","L9","L10","L11","L12","L13","L14","L15","L16" ,"N"}, + {"N", "M1","M2","M3","M4","M5","M6","M7","M8","M9","M10","M11","M12","M13","M14","M15","M16" ,"N"}, + {"N", "N1","N2","N3","N4","N5","N6","N7","N8","N9","N10","N11","N12","N13","N14","N15","N16" ,"N"}, + {"N", "O1","O2","O3","O4","O5","O6","O7","O8","O9","O10","O11","O12","O13","O14","O15","O16" ,"N"}, + {"N", "P1","P2","P3","P4","P5","P6","P7","P8","P9","P10","P11","P12","P13","P14","P15","P16" ,"N"}, + + {"N","N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N"} }; - + UINT8 gubLastLoadingScreenID = LOADINGSCREEN_NOTHING; STR8 szSector; BOOLEAN bShowSmallImage = FALSE; @@ -329,7 +329,7 @@ UINT8 GetLoadScreenID( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) case SEC_P15: case SEC_P16: szSector = szSectorMap [sSectorY][sSectorX]; - + if( fNight ) { return NIGHT; @@ -338,12 +338,12 @@ UINT8 GetLoadScreenID( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) { return DAY; } - + case SEC_A9: szSector = "A9"; - + if( !DidGameJustStart() ) - { + { if( fNight ) { return NIGHT; @@ -351,15 +351,15 @@ UINT8 GetLoadScreenID( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) else { return DAY; - } + } } else { return HELI; } - } + } } /* WANNE: User made System - END */ - + /* WANNE: Sir-Tech System - BEGIN */ else { @@ -393,7 +393,7 @@ UINT8 GetLoadScreenID( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) if( fNight ) return LOADINGSCREEN_NIGHTMILITARY; return LOADINGSCREEN_DAYMILITARY; - case SEC_K4: + case SEC_K4: if( fNight ) return LOADINGSCREEN_NIGHTLAB; return LOADINGSCREEN_DAYLAB; @@ -456,7 +456,7 @@ UINT8 GetLoadScreenID( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) return LOADINGSCREEN_DAYTOWN1; } } - case SAND: + case SAND: case SAND_ROAD: if( fNight ) { @@ -468,7 +468,7 @@ UINT8 GetLoadScreenID( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) } case FARMLAND: case FARMLAND_ROAD: - case ROAD: + case ROAD: if( fNight ) { return LOADINGSCREEN_NIGHTGENERIC; @@ -541,15 +541,15 @@ UINT8 GetLoadScreenID( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) case SEC_I13: //Alma prison dungeon case SEC_J9: //Tixa prison dungeon case SEC_K4: //Orta weapons plant - case SEC_O3: //Meduna - case SEC_P3: //Meduna + case SEC_O3: //Meduna + case SEC_P3: //Meduna return LOADINGSCREEN_BASEMENT; default: //rest are mines return LOADINGSCREEN_MINE; } break; // Basement Level 2 and 3 - case 2: + case 2: case 3: //all level 2 and 3 maps are caves! return LOADINGSCREEN_CAVE; @@ -570,7 +570,7 @@ UINT8 GetLoadScreenID( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) extern BOOLEAN gfSchedulesHosed; -//sets up the loadscreen with specified ID, and draws it to the FRAME_BUFFER, +//sets up the loadscreen with specified ID, and draws it to the FRAME_BUFFER, //and refreshing the screen with it. void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { @@ -790,7 +790,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayWild_1024x768.sti"); } - + break; case LOADINGSCREEN_DAYTROPICAL: strcpy(smallImage, "LOADSCREENS\\LS_DayTropical.sti"); @@ -806,7 +806,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayTropical_1024x768.sti"); } - + break; case LOADINGSCREEN_DAYFOREST: strcpy(smallImage, "LOADSCREENS\\LS_DayForest.sti"); @@ -822,7 +822,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayForest_1024x768.sti"); } - + break; case LOADINGSCREEN_DAYDESERT: strcpy(smallImage, "LOADSCREENS\\LS_DayDesert.sti"); @@ -838,7 +838,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayDesert_1024x768.sti"); } - + break; case LOADINGSCREEN_DAYPALACE: strcpy(smallImage, "LOADSCREENS\\LS_DayPalace.sti"); @@ -854,7 +854,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayPalace_1024x768.sti"); } - + break; case LOADINGSCREEN_NIGHTGENERIC: strcpy(smallImage, "LOADSCREENS\\LS_NightGeneric.sti"); @@ -870,7 +870,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightGeneric_1024x768.sti"); } - + break; case LOADINGSCREEN_NIGHTWILD: strcpy(smallImage, "LOADSCREENS\\LS_NightWild.sti"); @@ -886,7 +886,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightWild_1024x768.sti"); } - + break; case LOADINGSCREEN_NIGHTTOWN1: strcpy(smallImage, "LOADSCREENS\\LS_NightTown1.sti"); @@ -902,7 +902,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightTown1_1024x768.sti"); } - + break; case LOADINGSCREEN_NIGHTTOWN2: strcpy(smallImage, "LOADSCREENS\\LS_NightTown2.sti"); @@ -918,7 +918,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightTown2_1024x768.sti"); } - + break; case LOADINGSCREEN_NIGHTFOREST: strcpy(smallImage, "LOADSCREENS\\LS_NightForest.sti"); @@ -934,7 +934,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightForest_1024x768.sti"); } - + break; case LOADINGSCREEN_NIGHTTROPICAL: strcpy(smallImage, "LOADSCREENS\\LS_NightTropical.sti"); @@ -950,7 +950,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightTropical_1024x768.sti"); } - + break; case LOADINGSCREEN_NIGHTDESERT: strcpy(smallImage, "LOADSCREENS\\LS_NightDesert.sti"); @@ -966,7 +966,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightDesert_1024x768.sti"); } - + break; case LOADINGSCREEN_NIGHTPALACE: strcpy(smallImage, "LOADSCREENS\\LS_NightPalace.sti"); @@ -982,7 +982,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightPalace_1024x768.sti"); } - + break; case LOADINGSCREEN_HELI: strcpy(smallImage, "LOADSCREENS\\LS_Heli.sti"); @@ -998,7 +998,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Heli_1024x768.sti"); } - + break; case LOADINGSCREEN_BASEMENT: strcpy(smallImage, "LOADSCREENS\\LS_Basement.sti"); @@ -1014,7 +1014,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Basement_1024x768.sti"); } - + break; case LOADINGSCREEN_MINE: strcpy(smallImage, "LOADSCREENS\\LS_Mine.sti"); @@ -1046,7 +1046,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Cave_1024x768.sti"); } - + break; case LOADINGSCREEN_DAYPINE: strcpy(smallImage, "LOADSCREENS\\LS_DayPine.sti"); @@ -1062,7 +1062,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayPine_1024x768.sti"); } - + break; case LOADINGSCREEN_NIGHTPINE: strcpy(smallImage, "LOADSCREENS\\LS_NightPine.sti"); @@ -1078,7 +1078,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightPine_1024x768.sti"); } - + break; case LOADINGSCREEN_DAYMILITARY: strcpy(smallImage, "LOADSCREENS\\LS_DayMilitary.sti"); @@ -1094,7 +1094,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayMilitary_1024x768.sti"); } - + break; case LOADINGSCREEN_NIGHTMILITARY: strcpy(smallImage, "LOADSCREENS\\LS_NightMilitary.sti"); @@ -1110,7 +1110,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightMilitary_1024x768.sti"); } - + break; case LOADINGSCREEN_DAYSAM: strcpy(smallImage, "LOADSCREENS\\LS_DaySAM.sti"); @@ -1126,7 +1126,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DaySAM_1024x768.sti"); } - + break; case LOADINGSCREEN_NIGHTSAM: strcpy(smallImage, "LOADSCREENS\\LS_NightSAM.sti"); @@ -1142,7 +1142,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightSAM_1024x768.sti"); } - + break; case LOADINGSCREEN_DAYPRISON: strcpy(smallImage, "LOADSCREENS\\LS_DayPrison.sti"); @@ -1158,7 +1158,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayPrison_1024x768.sti"); } - + break; case LOADINGSCREEN_NIGHTPRISON: strcpy(smallImage, "LOADSCREENS\\LS_NightPrison.sti"); @@ -1174,7 +1174,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightPrison_1024x768.sti"); } - + break; case LOADINGSCREEN_DAYHOSPITAL: strcpy(smallImage, "LOADSCREENS\\LS_DayHospital.sti"); @@ -1190,7 +1190,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayHospital_1024x768.sti"); } - + break; case LOADINGSCREEN_NIGHTHOSPITAL: strcpy(smallImage, "LOADSCREENS\\LS_NightHospital.sti"); @@ -1206,7 +1206,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightHospital_1024x768.sti"); } - + break; case LOADINGSCREEN_DAYAIRPORT: strcpy(smallImage, "LOADSCREENS\\LS_DayAirport.sti"); @@ -1222,7 +1222,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayAirport_1024x768.sti"); } - + break; case LOADINGSCREEN_NIGHTAIRPORT: strcpy(smallImage, "LOADSCREENS\\LS_NightAirport.sti"); @@ -1238,7 +1238,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightAirport_1024x768.sti"); } - + break; case LOADINGSCREEN_DAYLAB: strcpy(smallImage, "LOADSCREENS\\LS_DayLab.sti"); @@ -1254,7 +1254,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayLab_1024x768.sti"); } - + break; case LOADINGSCREEN_NIGHTLAB: strcpy(smallImage, "LOADSCREENS\\LS_NightLab.sti"); @@ -1270,7 +1270,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightLab_1024x768.sti"); } - + break; case LOADINGSCREEN_DAYOMERTA: strcpy(smallImage, "LOADSCREENS\\LS_DayOmerta.sti"); @@ -1279,11 +1279,11 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayOmerta.sti"); } else if (iResolution == 1) - { + { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayOmerta_800x600.sti"); } else if (iResolution == 2) - { + { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayOmerta_1024x768.sti"); } break; @@ -1301,7 +1301,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightOmerta_1024x768.sti"); } - + break; case LOADINGSCREEN_DAYCHITZENA: strcpy(smallImage, "LOADSCREENS\\LS_DayChitzena.sti"); @@ -1317,7 +1317,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayChitzena_1024x768.sti"); } - + break; case LOADINGSCREEN_NIGHTCHITZENA: strcpy(smallImage, "LOADSCREENS\\LS_NightChitzena.sti"); @@ -1333,7 +1333,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightChitzena_1024x768.sti"); } - + break; case LOADINGSCREEN_DAYMINE: strcpy(smallImage, "LOADSCREENS\\LS_DayMine.sti"); @@ -1349,7 +1349,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayMine_1024x768.sti" ); } - + break; case LOADINGSCREEN_NIGHTMINE: strcpy(smallImage, "LOADSCREENS\\LS_NightMine.sti"); @@ -1365,7 +1365,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightMine_1024x768.sti" ); } - + break; case LOADINGSCREEN_DAYBALIME: strcpy(smallImage, "LOADSCREENS\\LS_DayBalime.sti"); @@ -1381,7 +1381,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayBalime_1024x768.sti" ); } - + break; case LOADINGSCREEN_NIGHTBALIME: strcpy(smallImage, "LOADSCREENS\\LS_NightBalime.sti"); @@ -1397,7 +1397,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightBalime_1024x768.sti" ); } - + break; default: strcpy(smallImage, "LOADSCREENS\\LS_Heli.sti"); @@ -1415,7 +1415,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) } break; } // Switch - END - } + } // Sti loadscreen (big image) is not available if ( AddVideoSurface( &vs_desc, &uiLoadScreen ) == FALSE && iResolution > 0) @@ -1436,7 +1436,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { //Blit the background image GetVideoSurface( &hVSurface, uiLoadScreen ); - // Special case -> show the small image centered + // Special case->show the small image centered if (iResolution > 0 && bShowSmallImage == TRUE) { BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, iScreenWidthOffset, iScreenHeightOffset, 0, NULL ); @@ -1464,3 +1464,4 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) RefreshScreen( NULL ); } + diff --git a/Loading Screen.h b/Loading Screen.h index 6db7d22f..c37121fb 100644 --- a/Loading Screen.h +++ b/Loading Screen.h @@ -3,7 +3,7 @@ -enum +enum { LOADINGSCREEN_NOTHING, LOADINGSCREEN_DAYGENERIC, diff --git a/MainMenuScreen.cpp b/MainMenuScreen.cpp index 29be9704..9876d5a3 100644 --- a/MainMenuScreen.cpp +++ b/MainMenuScreen.cpp @@ -55,9 +55,9 @@ enum #define MAINMENU_Y iScreenHeightOffset + 277 #define MAINMENU_Y_SPACE 37 - + INT32 iMenuImages[ NUM_MENU_ITEMS ]; -INT32 iMenuButtons[ NUM_MENU_ITEMS ]; +INT32 iMenuButtons[ NUM_MENU_ITEMS ]; UINT16 gusMainMenuButtonWidths[ NUM_MENU_ITEMS ]; @@ -98,8 +98,8 @@ void RestoreButtonBackGrounds(); UINT32 MainMenuScreenInit( ) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Version Label: %S", zVersionLabel )); - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Version #: %s", czVersionNumber )); - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Tracking #: %S", zTrackingNumber )); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Version #: %s", czVersionNumber )); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Tracking #: %S", zTrackingNumber )); return( TRUE ); } @@ -115,13 +115,13 @@ UINT32 MainMenuScreenHandle( ) { SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); SetMusicMode( MUSIC_NONE ); - return MAINMENU_SCREEN; //The splash screen hasn't been up long enough yet. + return MAINMENU_SCREEN; //The splash screen hasn't been up long enough yet. } if( guiSplashFrameFade ) { //Fade the splash screen. uiTime = GetJA2Clock(); if( guiSplashFrameFade > 2 ) - ShadowVideoSurfaceRectUsingLowPercentTable( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + ShadowVideoSurfaceRectUsingLowPercentTable( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); else if( guiSplashFrameFade > 1 ) ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0 ); else @@ -139,7 +139,7 @@ UINT32 MainMenuScreenHandle( ) EndFrameBufferRender(); SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); - + return MAINMENU_SCREEN; } @@ -175,7 +175,7 @@ UINT32 MainMenuScreenHandle( ) EndFrameBufferRender( ); - + // if ( gfDoHelpScreen ) // HandleHelpScreenInput(); // else @@ -197,7 +197,7 @@ UINT32 MainMenuScreenHandle( ) } -UINT32 MainMenuScreenShutdown( ) +UINT32 MainMenuScreenShutdown( ) { return( FALSE ); } @@ -255,7 +255,7 @@ void HandleMainMenuScreen() BOOLEAN InitMainMenu( ) { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; // gfDoHelpScreen = 0; @@ -326,8 +326,8 @@ BOOLEAN InitMainMenu( ) void ExitMainMenu( ) { -// UINT32 uiDestPitchBYTES; -// UINT8 *pDestBuf; +// UINT32 uiDestPitchBYTES; +// UINT8 *pDestBuf; // if( !gfDoHelpScreen ) { @@ -336,7 +336,7 @@ void ExitMainMenu( ) CreateDestroyMainMenuButtons( FALSE ); - + DeleteVideoObjectFromIndex( guiMainMenuBackGroundImage ); DeleteVideoObjectFromIndex( guiJa2LogoImage ); @@ -405,12 +405,12 @@ void MenuButtonMoveCallback(GUI_BUTTON *btn,INT32 reason) void HandleMainMenuInput() { - InputAtom InputEvent; + InputAtom InputEvent; - // Check for esc + // Check for esc while (DequeueEvent(&InputEvent) == TRUE) - { - if( InputEvent.usEvent == KEY_UP ) + { + if( InputEvent.usEvent == KEY_UP ) { switch( InputEvent.usParam ) { @@ -445,11 +445,11 @@ void HandleMainMenuInput() case 'o': gbHandledMainMenu = PREFERENCES; - break; + break; case 's': gbHandledMainMenu = CREDITS; - break; + break; } } } @@ -474,8 +474,8 @@ void HandleHelpScreenInput() void ClearMainMenu() { - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; // CLEAR THE FRAME BUFFER pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); @@ -507,7 +507,7 @@ void SelectMainMenuBackGroundRegionCallBack(MOUSE_REGION * pRegion, INT32 iReaso gfDoHelpScreen = FALSE; } */ - } + } } void SetMainMenuExitScreen( UINT32 uiNewScreen ) @@ -532,7 +532,7 @@ void CreateDestroyBackGroundMouseMask( BOOLEAN fCreate ) // Make a mouse region MSYS_DefineRegion( &(gBackRegion), 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST, - CURSOR_NORMAL, MSYS_NO_CALLBACK, SelectMainMenuBackGroundRegionCallBack ); + CURSOR_NORMAL, MSYS_NO_CALLBACK, SelectMainMenuBackGroundRegionCallBack ); // Add region MSYS_AddRegion(&(gBackRegion) ); @@ -555,7 +555,6 @@ BOOLEAN CreateDestroyMainMenuButtons( BOOLEAN fCreate ) INT32 cnt; SGPFILENAME filename; INT16 sSlot; - //INT32 iStartLoc=0; #ifndef _DEBUG CHAR16 zText[512]; #endif @@ -609,7 +608,7 @@ BOOLEAN CreateDestroyMainMenuButtons( BOOLEAN fCreate ) ButtonList[ iMenuButtons[ cnt ] ]->UserData[0] = cnt; #ifndef _DEBUG - //load up some info from the 'mainmenu.edt' file. This makes sure the file is present. The file is + //load up some info from the 'mainmenu.edt' file. This makes sure the file is present. The file is // 'marked' with a code that identifies the testers INT32 iStartLoc = MAINMENU_RECORD_SIZE * cnt; if( !LoadEncryptedDataFromFile(MAINMENU_TEXT_FILE, zText, iStartLoc, MAINMENU_RECORD_SIZE ) ) @@ -620,7 +619,7 @@ BOOLEAN CreateDestroyMainMenuButtons( BOOLEAN fCreate ) if( pSoldier->bActive != TRUE ) { //something is very wrong - pSoldier->bActive = pSoldier->bLife; + pSoldier->bActive = pSoldier->stats.bLife; } } #endif @@ -650,41 +649,41 @@ BOOLEAN CreateDestroyMainMenuButtons( BOOLEAN fCreate ) void RenderMainMenu() { - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; //Get and display the background image GetVideoObject(&hPixHandle, guiMainMenuBackGroundImage ); - BltVideoObject( guiSAVEBUFFER, hPixHandle, 0, 0, 0, VO_BLT_SRCTRANSPARENCY,NULL); - BltVideoObject( FRAME_BUFFER, hPixHandle, 0, 0, 0, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject( guiSAVEBUFFER, hPixHandle, 0, 0, 0, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject( FRAME_BUFFER, hPixHandle, 0, 0, 0, VO_BLT_SRCTRANSPARENCY,NULL); GetVideoObject(&hPixHandle, guiJa2LogoImage ); - BltVideoObject( FRAME_BUFFER, hPixHandle, 0, iScreenWidthOffset + 188, iScreenHeightOffset + 10, VO_BLT_SRCTRANSPARENCY,NULL); - BltVideoObject( guiSAVEBUFFER, hPixHandle, 0, iScreenWidthOffset + 188, iScreenHeightOffset + 10, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject( FRAME_BUFFER, hPixHandle, 0, iScreenWidthOffset + 188, iScreenHeightOffset + 10, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject( guiSAVEBUFFER, hPixHandle, 0, iScreenWidthOffset + 188, iScreenHeightOffset + 10, VO_BLT_SRCTRANSPARENCY,NULL); #ifdef TESTFOREIGNFONTS - DrawTextToScreen( L"LARGEFONT1: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 105, 640, LARGEFONT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - DrawTextToScreen( L"SMALLFONT1: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 125, 640, SMALLFONT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - DrawTextToScreen( L"TINYFONT1: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 145, 640, TINYFONT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - DrawTextToScreen( L"FONT12POINT1: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 165, 640, FONT12POINT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - DrawTextToScreen( L"COMPFONT: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 185, 640, COMPFONT, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - DrawTextToScreen( L"SMALLCOMPFONT: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 205, 640, SMALLCOMPFONT, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - DrawTextToScreen( L"FONT10ROMAN: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 225, 640, FONT10ROMAN, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - DrawTextToScreen( L"FONT12ROMAN: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 245, 640, FONT12ROMAN, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - DrawTextToScreen( L"FONT14SANSERIF: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 255, 640, FONT14SANSERIF, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - DrawTextToScreen( L"MILITARYFONT: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 265, 640, MILITARYFONT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - DrawTextToScreen( L"FONT10ARIAL: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 285, 640, FONT10ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - DrawTextToScreen( L"FONT14ARIAL: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 305, 640, FONT14ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - DrawTextToScreen( L"FONT12ARIAL: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 325, 640, FONT12ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - DrawTextToScreen( L"FONT10ARIALBOLD: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 345, 640, FONT10ARIALBOLD, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - DrawTextToScreen( L"BLOCKFONT: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 365, 640, BLOCKFONT, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - DrawTextToScreen( L"BLOCKFONT2: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 385, 640, BLOCKFONT2, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - DrawTextToScreen( L"FONT12ARIALFIXEDWIDTH: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 405, 640, FONT12ARIALFIXEDWIDTH, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - DrawTextToScreen( L"FONT16ARIAL: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 425, 640, FONT16ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - DrawTextToScreen( L"BLOCKFONTNARROW: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 445, 640, BLOCKFONTNARROW, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - DrawTextToScreen( L"FONT14HUMANIST: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 465, 640, FONT14HUMANIST, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"LARGEFONT1: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 105, 640, LARGEFONT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"SMALLFONT1: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 125, 640, SMALLFONT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"TINYFONT1: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 145, 640, TINYFONT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"FONT12POINT1: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 165, 640, FONT12POINT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"COMPFONT: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 185, 640, COMPFONT, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"SMALLCOMPFONT: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 205, 640, SMALLCOMPFONT, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"FONT10ROMAN: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 225, 640, FONT10ROMAN, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"FONT12ROMAN: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 245, 640, FONT12ROMAN, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"FONT14SANSERIF: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 255, 640, FONT14SANSERIF, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"MILITARYFONT: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 265, 640, MILITARYFONT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"FONT10ARIAL: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 285, 640, FONT10ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"FONT14ARIAL: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 305, 640, FONT14ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"FONT12ARIAL: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 325, 640, FONT12ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"FONT10ARIALBOLD: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 345, 640, FONT10ARIALBOLD, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"BLOCKFONT: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 365, 640, BLOCKFONT, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"BLOCKFONT2: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 385, 640, BLOCKFONT2, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"FONT12ARIALFIXEDWIDTH: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 405, 640, FONT12ARIALFIXEDWIDTH, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"FONT16ARIAL: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 425, 640, FONT16ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"BLOCKFONTNARROW: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 445, 640, BLOCKFONTNARROW, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"FONT14HUMANIST: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 465, 640, FONT14HUMANIST, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); #else - DrawTextToScreen( gzCopyrightText[ 0 ], 0, SCREEN_HEIGHT - 20, SCREEN_WIDTH, FONT10ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DrawTextToScreen( gzCopyrightText[ 0 ], 0, SCREEN_HEIGHT - 20, SCREEN_WIDTH, FONT10ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); #endif InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); @@ -705,3 +704,4 @@ void RestoreButtonBackGrounds() } + diff --git a/MessageBoxScreen.cpp b/MessageBoxScreen.cpp index efb40122..c60a3c26 100644 --- a/MessageBoxScreen.cpp +++ b/MessageBoxScreen.cpp @@ -29,13 +29,13 @@ #define MSGBOX_DEFAULT_WIDTH 300 #define MSGBOX_BUTTON_WIDTH 61 -#define MSGBOX_BUTTON_HEIGHT 20 +#define MSGBOX_BUTTON_HEIGHT 20 #define MSGBOX_BUTTON_X_SEP 15 #define MSGBOX_SMALL_BUTTON_WIDTH 31 #define MSGBOX_SMALL_BUTTON_X_SEP 8 -typedef void (*MSGBOX_CALLBACK)( UINT8 bExitValue ); +typedef void (*MSGBOX_CALLBACK)( UINT8 bExitValue ); // old mouse x and y positions SGPPoint pOldMousePosition; @@ -82,7 +82,7 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN UINT16 usTextBoxHeight; SGPRect aRect; UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; - UINT8 *pDestBuf, *pSrcBuf; + UINT8 *pDestBuf, *pSrcBuf; INT16 sButtonX, sButtonY, sBlankSpace; UINT8 ubMercBoxBackground = BASIC_MERC_POPUP_BACKGROUND, ubMercBoxBorder = BASIC_MERC_POPUP_BORDER; UINT8 ubFontColor, ubFontShadowColor; @@ -116,7 +116,7 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN ubFontShadowColor = DEFAULT_SHADOW; usCursor = CURSOR_NORMAL; - break; + break; case MSG_BOX_RED_ON_WHITE: ubMercBoxBackground = WHITE_MERC_POPUP_BACKGROUND; @@ -141,7 +141,7 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN ubFontShadowColor = FONT_MCOLOR_WHITE; usCursor = CURSOR_LAPTOP_SCREEN; break; - case MSG_BOX_IMP_STYLE: + case MSG_BOX_IMP_STYLE: ubMercBoxBackground = IMP_POPUP_BACKGROUND; ubMercBoxBorder = DIALOG_MERC_POPUP_BORDER; @@ -163,7 +163,7 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN ubFontShadowColor = DEFAULT_SHADOW; usCursor = CURSOR_NORMAL; - break; + break; case MSG_BOX_LAPTOP_DEFAULT: ubMercBoxBackground = LAPTOP_POPUP_BACKGROUND; @@ -208,7 +208,7 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN // Set some values! gMsgBox.usFlags = usFlags; gMsgBox.uiExitScreen = uiExitScreen; - gMsgBox.ExitCallback = ReturnCallback; + gMsgBox.ExitCallback = ReturnCallback; gMsgBox.fRenderBox = TRUE; gMsgBox.bHandled = 0; @@ -218,7 +218,7 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN if( gMsgBox.iBoxId == -1 ) { #ifdef JA2BETAVERSION - AssertMsg( 0, "Failed in DoMessageBox(). Probable reason is because the string was too large to fit in max message box size." ); + AssertMsg( 0, "Failed in DoMessageBox(). Probable reason is because the string was too large to fit in max message box size." ); #endif return 0; } @@ -252,20 +252,20 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN vs_desc.usWidth = usTextBoxWidth; vs_desc.usHeight = usTextBoxHeight; vs_desc.ubBitDepth = 16; - + if( AddVideoSurface( &vs_desc, &gMsgBox.uiSaveBuffer) == FALSE ) { return( - 1 ); } - //Save what we have under here... + //Save what we have under here... pDestBuf = LockVideoSurface( gMsgBox.uiSaveBuffer, &uiDestPitchBYTES); pSrcBuf = LockVideoSurface( FRAME_BUFFER, &uiSrcPitchBYTES); - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - 0 , 0, - gMsgBox.sX , gMsgBox.sY, + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + 0 , 0, + gMsgBox.sX , gMsgBox.sY, usTextBoxWidth, usTextBoxHeight ); UnLockVideoSurface( gMsgBox.uiSaveBuffer ); @@ -273,7 +273,7 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN // Create top-level mouse region MSYS_DefineRegion( &(gMsgBox.BackRegion), 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST, - usCursor, MSYS_NO_CALLBACK, MsgBoxClickCallback ); + usCursor, MSYS_NO_CALLBACK, MsgBoxClickCallback ); if( gGameSettings.fOptions[ TOPTION_DONT_MOVE_MOUSE ] == FALSE ) { @@ -308,41 +308,41 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10; gMsgBox.uiButton[0] = CreateIconAndTextButton( gMsgBox.iButtonImages, L"1", FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NumberedMsgBoxCallback ); + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NumberedMsgBoxCallback ); MSYS_SetBtnUserData( gMsgBox.uiButton[0], 0, 1); SetButtonCursor(gMsgBox.uiButton[0], usCursor); sButtonX += MSGBOX_SMALL_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP; gMsgBox.uiButton[1] = CreateIconAndTextButton( gMsgBox.iButtonImages, L"2", FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NumberedMsgBoxCallback ); + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NumberedMsgBoxCallback ); MSYS_SetBtnUserData( gMsgBox.uiButton[1], 0, 2); SetButtonCursor(gMsgBox.uiButton[1], usCursor); sButtonX += MSGBOX_SMALL_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP; gMsgBox.uiButton[2] = CreateIconAndTextButton( gMsgBox.iButtonImages, L"3", FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NumberedMsgBoxCallback ); + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NumberedMsgBoxCallback ); MSYS_SetBtnUserData( gMsgBox.uiButton[2], 0, 3); SetButtonCursor(gMsgBox.uiButton[2], usCursor); sButtonX += MSGBOX_SMALL_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP; gMsgBox.uiButton[3] = CreateIconAndTextButton( gMsgBox.iButtonImages, L"4", FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NumberedMsgBoxCallback ); + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NumberedMsgBoxCallback ); MSYS_SetBtnUserData( gMsgBox.uiButton[3], 0, 4); SetButtonCursor(gMsgBox.uiButton[3], usCursor); ForceButtonUnDirty( gMsgBox.uiButton[3] ); @@ -357,24 +357,24 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN // Create text button if ( usFlags & MSG_BOX_FLAG_OK ) { - + // sButtonX = ( usTextBoxWidth - MSGBOX_BUTTON_WIDTH ) / 2; sButtonX = ( usTextBoxWidth - GetMSgBoxButtonWidth( gMsgBox.iButtonImages ) ) / 2; sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10; - gMsgBox.uiOKButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_OK ], FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)OKMsgBoxCallback ); + gMsgBox.uiOKButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_OK ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)OKMsgBoxCallback ); SetButtonCursor(gMsgBox.uiOKButton, usCursor); ForceButtonUnDirty( gMsgBox.uiOKButton ); } - + // Create text button if ( usFlags & MSG_BOX_FLAG_CANCEL ) @@ -382,12 +382,12 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN sButtonX = ( usTextBoxWidth - GetMSgBoxButtonWidth( gMsgBox.iButtonImages ) ) / 2; sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10; - gMsgBox.uiOKButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_CANCEL ], FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)OKMsgBoxCallback ); + gMsgBox.uiOKButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_CANCEL ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)OKMsgBoxCallback ); SetButtonCursor(gMsgBox.uiOKButton, usCursor); ForceButtonUnDirty( gMsgBox.uiOKButton ); @@ -398,22 +398,22 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 2; sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10; - gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_YES ], FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback ); + gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_YES ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback ); SetButtonCursor(gMsgBox.uiYESButton, usCursor); ForceButtonUnDirty( gMsgBox.uiYESButton ); - gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_NO ], FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback ); + gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_NO ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback ); SetButtonCursor(gMsgBox.uiNOButton, usCursor); ForceButtonUnDirty( gMsgBox.uiNOButton ); @@ -424,22 +424,22 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 2; sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10; - gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pUpdatePanelButtons[ 0 ], FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback ); + gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pUpdatePanelButtons[ 0 ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback ); SetButtonCursor(gMsgBox.uiYESButton, usCursor); ForceButtonUnDirty( gMsgBox.uiYESButton ); - gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pUpdatePanelButtons[ 1 ], FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback ); + gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pUpdatePanelButtons[ 1 ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback ); SetButtonCursor(gMsgBox.uiNOButton, usCursor); ForceButtonUnDirty( gMsgBox.uiNOButton ); @@ -450,22 +450,22 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 2; sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10; - gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_OK ], FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)OKMsgBoxCallback ); + gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_OK ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)OKMsgBoxCallback ); SetButtonCursor(gMsgBox.uiYESButton, usCursor); ForceButtonUnDirty( gMsgBox.uiYESButton ); - gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_REHIRE ], FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ContractMsgBoxCallback ); + gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_REHIRE ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ContractMsgBoxCallback ); SetButtonCursor(gMsgBox.uiNOButton, usCursor); ForceButtonUnDirty( gMsgBox.uiNOButton ); @@ -476,31 +476,31 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 3; sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10; - gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_YES ], FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback ); + gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_YES ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback ); SetButtonCursor(gMsgBox.uiYESButton, usCursor); ForceButtonUnDirty( gMsgBox.uiYESButton ); - gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_NO ], FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback ); + gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_NO ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback ); SetButtonCursor(gMsgBox.uiNOButton, usCursor); ForceButtonUnDirty( gMsgBox.uiNOButton ); - gMsgBox.uiOKButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_REHIRE ], FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX + 2 * ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ContractMsgBoxCallback ); + gMsgBox.uiOKButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_REHIRE ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX + 2 * ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ContractMsgBoxCallback ); SetButtonCursor(gMsgBox.uiOKButton, usCursor); ForceButtonUnDirty( gMsgBox.uiOKButton ); @@ -512,31 +512,31 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 3; sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10; - gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton1, FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback ); + gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton1, FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback ); SetButtonCursor(gMsgBox.uiYESButton, usCursor); ForceButtonUnDirty( gMsgBox.uiYESButton ); - gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton2, FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback ); + gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton2, FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback ); SetButtonCursor(gMsgBox.uiNOButton, usCursor); ForceButtonUnDirty( gMsgBox.uiNOButton ); - gMsgBox.uiOKButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_REHIRE ], FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX + 2 * ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ContractMsgBoxCallback ); + gMsgBox.uiOKButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_REHIRE ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX + 2 * ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ContractMsgBoxCallback ); SetButtonCursor(gMsgBox.uiOKButton, usCursor); ForceButtonUnDirty( gMsgBox.uiOKButton ); @@ -547,22 +547,22 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 2; sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10; - gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton1, FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback ); + gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton1, FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback ); SetButtonCursor(gMsgBox.uiYESButton, usCursor); ForceButtonUnDirty( gMsgBox.uiYESButton ); - gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton2, FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback ); + gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton2, FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback ); SetButtonCursor(gMsgBox.uiNOButton, usCursor); ForceButtonUnDirty( gMsgBox.uiNOButton ); } @@ -572,31 +572,31 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 3; sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10; - gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_YES ], FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback ); + gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_YES ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback ); SetButtonCursor(gMsgBox.uiYESButton, usCursor); ForceButtonUnDirty( gMsgBox.uiYESButton ); - gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_NO ], FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback ); + gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_NO ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback ); SetButtonCursor(gMsgBox.uiNOButton, usCursor); ForceButtonUnDirty( gMsgBox.uiNOButton ); - gMsgBox.uiOKButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_LIE ], FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX + 2 * ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)LieMsgBoxCallback ); + gMsgBox.uiOKButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_LIE ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX + 2 * ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)LieMsgBoxCallback ); SetButtonCursor(gMsgBox.uiOKButton, usCursor); ForceButtonUnDirty( gMsgBox.uiOKButton ); @@ -607,22 +607,22 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 2; sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10; - gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_OK ], FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback ); + gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_OK ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback ); SetButtonCursor(gMsgBox.uiYESButton, usCursor); ForceButtonUnDirty( gMsgBox.uiYESButton ); - gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_SKIP ], FONT12ARIAL, - ubFontColor, ubFontShadowColor, - ubFontColor, ubFontShadowColor, - TEXT_CJUSTIFIED, - (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback ); + gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_SKIP ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback ); SetButtonCursor(gMsgBox.uiNOButton, usCursor); ForceButtonUnDirty( gMsgBox.uiNOButton ); } @@ -641,9 +641,9 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN } #endif - // Save mouse restriction region... - GetRestrictedClipCursor( &gOldCursorLimitRectangle ); - FreeMouseCursor( ); + // Save mouse restriction region... + GetRestrictedClipCursor( &gOldCursorLimitRectangle ); + FreeMouseCursor( ); gfNewMessageBox = TRUE; @@ -683,7 +683,7 @@ void OKMsgBoxCallback(GUI_BUTTON *btn, INT32 reason ) fLButtonDown = FALSE; } - + } void YESMsgBoxCallback(GUI_BUTTON *btn, INT32 reason ) @@ -705,7 +705,7 @@ void YESMsgBoxCallback(GUI_BUTTON *btn, INT32 reason ) else if ( reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { fLButtonDown = FALSE; - } + } } void NOMsgBoxCallback(GUI_BUTTON *btn, INT32 reason ) @@ -727,7 +727,7 @@ void NOMsgBoxCallback(GUI_BUTTON *btn, INT32 reason ) else if ( reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { fLButtonDown = FALSE; - } + } } @@ -750,7 +750,7 @@ void ContractMsgBoxCallback(GUI_BUTTON *btn, INT32 reason ) else if ( reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { fLButtonDown = FALSE; - } + } } void LieMsgBoxCallback(GUI_BUTTON *btn, INT32 reason ) @@ -772,7 +772,7 @@ void LieMsgBoxCallback(GUI_BUTTON *btn, INT32 reason ) else if ( reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { fLButtonDown = FALSE; - } + } } @@ -782,20 +782,20 @@ void NumberedMsgBoxCallback(GUI_BUTTON *btn, INT32 reason ) { btn->uiFlags |= BUTTON_CLICKED_ON; } - else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); // OK, exit gMsgBox.bHandled = (INT8) MSYS_GetBtnUserData( btn, 0); } - + } UINT32 ExitMsgBox( INT8 ubExitCode ) { UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; - UINT8 *pDestBuf, *pSrcBuf; + UINT8 *pDestBuf, *pSrcBuf; SGPPoint pPosition; // Delete popup! @@ -814,62 +814,62 @@ UINT32 ExitMsgBox( INT8 ubExitCode ) { if ( gMsgBox.usFlags & MSG_BOX_FLAG_OK ) { - RemoveButton( gMsgBox.uiOKButton ); + RemoveButton( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNO ) { - RemoveButton( gMsgBox.uiYESButton ); - RemoveButton( gMsgBox.uiNOButton ); + RemoveButton( gMsgBox.uiYESButton ); + RemoveButton( gMsgBox.uiNOButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_OKCONTRACT ) { - RemoveButton( gMsgBox.uiYESButton ); - RemoveButton( gMsgBox.uiNOButton ); + RemoveButton( gMsgBox.uiYESButton ); + RemoveButton( gMsgBox.uiNOButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNOCONTRACT ) { - RemoveButton( gMsgBox.uiYESButton ); + RemoveButton( gMsgBox.uiYESButton ); RemoveButton( gMsgBox.uiNOButton ); RemoveButton( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_GENERICCONTRACT ) { - RemoveButton( gMsgBox.uiYESButton ); + RemoveButton( gMsgBox.uiYESButton ); RemoveButton( gMsgBox.uiNOButton ); RemoveButton( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_GENERIC ) { - RemoveButton( gMsgBox.uiYESButton ); + RemoveButton( gMsgBox.uiYESButton ); RemoveButton( gMsgBox.uiNOButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNOLIE ) { - RemoveButton( gMsgBox.uiYESButton ); + RemoveButton( gMsgBox.uiYESButton ); RemoveButton( gMsgBox.uiNOButton ); RemoveButton( gMsgBox.uiOKButton ); } if( gMsgBox.usFlags & MSG_BOX_FLAG_CONTINUESTOP ) { - RemoveButton( gMsgBox.uiYESButton ); + RemoveButton( gMsgBox.uiYESButton ); RemoveButton( gMsgBox.uiNOButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_OKSKIP ) { - RemoveButton( gMsgBox.uiYESButton ); - RemoveButton( gMsgBox.uiNOButton ); + RemoveButton( gMsgBox.uiYESButton ); + RemoveButton( gMsgBox.uiNOButton ); } } - + // Delete button images UnloadButtonImage( gMsgBox.iButtonImages ); @@ -884,8 +884,8 @@ UINT32 ExitMsgBox( INT8 ubExitCode ) } #endif - // Restore mouse restriction region... - RestrictMouseCursor( &gOldCursorLimitRectangle ); + // Restore mouse restriction region... + RestrictMouseCursor( &gOldCursorLimitRectangle ); gfInMsgBox = FALSE; @@ -904,9 +904,9 @@ UINT32 ExitMsgBox( INT8 ubExitCode ) pSrcBuf = LockVideoSurface( gMsgBox.uiSaveBuffer, &uiSrcPitchBYTES); pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES); - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - gMsgBox.sX , gMsgBox.sY, + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + gMsgBox.sX , gMsgBox.sY, 0, 0, gMsgBox.usWidth, gMsgBox.usHeight ); @@ -938,30 +938,30 @@ UINT32 ExitMsgBox( INT8 ubExitCode ) // Remove save buffer! DeleteVideoSurfaceFromIndex( gMsgBox.uiSaveBuffer ); - + switch( gMsgBox.uiExitScreen ) { case GAME_SCREEN: - if ( InOverheadMap( ) ) - { - gfOverheadMapDirty = TRUE; - } - else - { - SetRenderFlags( RENDER_FLAG_FULL ); - } + if ( InOverheadMap( ) ) + { + gfOverheadMapDirty = TRUE; + } + else + { + SetRenderFlags( RENDER_FLAG_FULL ); + } break; case MAP_SCREEN: fMapPanelDirty = TRUE; break; } - if ( gfFadeInitialized ) - { - SetPendingNewScreen(FADE_SCREEN); - return( FADE_SCREEN ); - } + if ( gfFadeInitialized ) + { + SetPendingNewScreen(FADE_SCREEN); + return( FADE_SCREEN ); + } return( gMsgBox.uiExitScreen ); } @@ -974,7 +974,7 @@ UINT32 MessageBoxScreenInit( ) UINT32 MessageBoxScreenHandle( ) { - InputAtom InputEvent; + InputAtom InputEvent; if ( gfNewMessageBox ) { @@ -982,7 +982,7 @@ UINT32 MessageBoxScreenHandle( ) if ( ( gfStartedFromGameScreen )||( gfStartedFromMapScreen ) ) { //UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; - //UINT8 *pDestBuf, *pSrcBuf; + //UINT8 *pDestBuf, *pSrcBuf; if( gfStartedFromGameScreen ) { @@ -1000,17 +1000,17 @@ UINT32 MessageBoxScreenHandle( ) pDestBuf = LockVideoSurface( gMsgBox.uiSaveBuffer, &uiDestPitchBYTES); pSrcBuf = LockVideoSurface( FRAME_BUFFER, &uiSrcPitchBYTES); - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - 0 , 0, - gMsgBox.sX , gMsgBox.sY, + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + 0 , 0, + gMsgBox.sX , gMsgBox.sY, gMsgBox.usWidth, gMsgBox.usHeight ); UnLockVideoSurface( gMsgBox.uiSaveBuffer ); UnLockVideoSurface( FRAME_BUFFER ); */ } - + gfNewMessageBox = FALSE; return( MSG_BOX_SCREEN ); @@ -1033,68 +1033,68 @@ UINT32 MessageBoxScreenHandle( ) if ( gMsgBox.usFlags & MSG_BOX_FLAG_OK ) { - MarkAButtonDirty( gMsgBox.uiOKButton ); + MarkAButtonDirty( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_CANCEL ) { - MarkAButtonDirty( gMsgBox.uiOKButton ); + MarkAButtonDirty( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNO ) { - MarkAButtonDirty( gMsgBox.uiYESButton ); - MarkAButtonDirty( gMsgBox.uiNOButton ); + MarkAButtonDirty( gMsgBox.uiYESButton ); + MarkAButtonDirty( gMsgBox.uiNOButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_OKCONTRACT ) { - MarkAButtonDirty( gMsgBox.uiYESButton ); + MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNOCONTRACT ) { - MarkAButtonDirty( gMsgBox.uiYESButton ); + MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); MarkAButtonDirty( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_GENERICCONTRACT ) { - MarkAButtonDirty( gMsgBox.uiYESButton ); + MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); MarkAButtonDirty( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_GENERIC ) { - MarkAButtonDirty( gMsgBox.uiYESButton ); + MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); } if( gMsgBox.usFlags & MSG_BOX_FLAG_CONTINUESTOP ) { // Exit messagebox - MarkAButtonDirty( gMsgBox.uiYESButton ); + MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNOLIE ) { - MarkAButtonDirty( gMsgBox.uiYESButton ); + MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); MarkAButtonDirty( gMsgBox.uiOKButton ); } if ( gMsgBox.usFlags & MSG_BOX_FLAG_OKSKIP ) { - MarkAButtonDirty( gMsgBox.uiYESButton ); + MarkAButtonDirty( gMsgBox.uiYESButton ); MarkAButtonDirty( gMsgBox.uiNOButton ); } - RenderMercPopUpBoxFromIndex( gMsgBox.iBoxId, gMsgBox.sX, gMsgBox.sY, FRAME_BUFFER ); + RenderMercPopUpBoxFromIndex( gMsgBox.iBoxId, gMsgBox.sX, gMsgBox.sY, FRAME_BUFFER ); //gMsgBox.fRenderBox = FALSE; // ATE: Render each frame... } @@ -1105,22 +1105,22 @@ UINT32 MessageBoxScreenHandle( ) EndFrameBufferRender( ); // carter, need key shortcuts for clearing up message boxes - // Check for esc + // Check for esc while (DequeueEvent(&InputEvent) == TRUE) - { - if( InputEvent.usEvent == KEY_UP ) + { + if( InputEvent.usEvent == KEY_UP ) { if( ( InputEvent.usParam == ESC ) || ( InputEvent.usParam == 'n') ) - { - if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNO ) - { - // Exit messagebox - gMsgBox.bHandled = MSG_BOX_RETURN_NO; - } + { + if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNO ) + { + // Exit messagebox + gMsgBox.bHandled = MSG_BOX_RETURN_NO; + } } - if( InputEvent.usParam == ENTER ) - { + if( InputEvent.usParam == ENTER ) + { if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNO ) { // Exit messagebox @@ -1189,7 +1189,7 @@ UINT32 MessageBoxScreenHandle( ) } } - if ( gMsgBox.bHandled ) + if ( gMsgBox.bHandled ) { SetRenderFlags( RENDER_FLAG_FULL ); return( ExitMsgBox( gMsgBox.bHandled ) ); @@ -1198,7 +1198,7 @@ UINT32 MessageBoxScreenHandle( ) return( MSG_BOX_SCREEN ); } -UINT32 MessageBoxScreenShutdown( ) +UINT32 MessageBoxScreenShutdown( ) { return( FALSE ); } @@ -1208,7 +1208,7 @@ UINT32 MessageBoxScreenShutdown( ) void DoScreenIndependantMessageBox( const STR16 zString, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ) { SGPRect CenteringRect= {0, 0, SCREEN_WIDTH, INV_INTERFACE_START_Y }; - DoScreenIndependantMessageBoxWithRect( zString, usFlags, ReturnCallback, &CenteringRect ); + DoScreenIndependantMessageBoxWithRect( zString, usFlags, ReturnCallback, &CenteringRect ); } // a basic box that don't care what screen we came from @@ -1273,7 +1273,7 @@ void DoScreenIndependantMessageBoxWithRect( const STR16 zString, UINT16 usFlags, // Tactical else if( guiCurrentScreen == GAME_SCREEN ) { - DoMessageBox( MSG_BOX_BASIC_STYLE, zString, guiCurrentScreen, usFlags, ReturnCallback, pCenteringRect ); + DoMessageBox( MSG_BOX_BASIC_STYLE, zString, guiCurrentScreen, usFlags, ReturnCallback, pCenteringRect ); } } diff --git a/MessageBoxScreen.h b/MessageBoxScreen.h index c8f68cf7..66730059 100644 --- a/MessageBoxScreen.h +++ b/MessageBoxScreen.h @@ -5,11 +5,11 @@ // Message box flags #define MSG_BOX_FLAG_USE_CENTERING_RECT 0x0001 // Pass in a rect to center in -#define MSG_BOX_FLAG_OK 0x0002 // Displays OK button -#define MSG_BOX_FLAG_YESNO 0x0004 // Displays YES NO buttons -#define MSG_BOX_FLAG_CANCEL 0x0008 // Displays YES NO buttons +#define MSG_BOX_FLAG_OK 0x0002 // Displays OK button +#define MSG_BOX_FLAG_YESNO 0x0004 // Displays YES NO buttons +#define MSG_BOX_FLAG_CANCEL 0x0008 // Displays YES NO buttons #define MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS 0x0010 // Displays four numbered buttons, 1-4 -#define MSG_BOX_FLAG_YESNOCONTRACT 0x0020 // yes no and contract buttons +#define MSG_BOX_FLAG_YESNOCONTRACT 0x0020 // yes no and contract buttons #define MSG_BOX_FLAG_OKCONTRACT 0x0040 // ok and contract buttons #define MSG_BOX_FLAG_YESNOLIE 0x0080 // ok and contract buttons #define MSG_BOX_FLAG_CONTINUESTOP 0x0100 // continue stop box diff --git a/Options Screen.cpp b/Options Screen.cpp index 57b25ea3..efce3947 100644 --- a/Options Screen.cpp +++ b/Options Screen.cpp @@ -7,7 +7,7 @@ #include "Font Control.h" #include "Game Clock.h" #include "Render Dirty.h" - #include "Text Input.h" + #include "Text Input.h" #include "WordWrap.h" #include "SaveLoadScreen.h" #include "Render Dirty.h" @@ -23,7 +23,7 @@ #include "Worlddat.h" #include "Worlddef.h" #include "GameSettings.h" - #include "Game Init.h" + #include "Game Init.h" #include "English.h" #include "Overhead.h" #include "Gap.h" @@ -166,7 +166,7 @@ UINT8 gubFirstColOfOptions=OPT_FIRST_COLUMN_TOGGLE_CUT_OFF; BOOLEAN gfSettingOfTreeTopStatusOnEnterOfOptionScreen; BOOLEAN gfSettingOfItemGlowStatusOnEnterOfOptionScreen; -BOOLEAN gfSettingOfDontAnimateSmoke; +BOOLEAN gfSettingOfDontAnimateSmoke; // Goto save game Button void BtnOptGotoSaveGameCallback(GUI_BUTTON *btn,INT32 reason); @@ -195,13 +195,13 @@ void BtnOptionsTogglesCallback(GUI_BUTTON *btn,INT32 reason); //Mouse regions for the name of the option -MOUSE_REGION gSelectedOptionTextRegion[ NUM_GAME_OPTIONS ]; +MOUSE_REGION gSelectedOptionTextRegion[ NUM_GAME_OPTIONS ]; void SelectedOptionTextRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); void SelectedOptionTextRegionMovementCallBack(MOUSE_REGION * pRegion, INT32 reason ); //Mouse regions for the area around the toggle boxs -MOUSE_REGION gSelectedToggleBoxAreaRegion; +MOUSE_REGION gSelectedToggleBoxAreaRegion; void SelectedToggleBoxAreaRegionMovementCallBack(MOUSE_REGION * pRegion, INT32 reason ); @@ -249,7 +249,7 @@ UINT32 OptionsScreenInit() //Set so next time we come in, we can set up gfOptionsScreenEntry = TRUE; - + return( TRUE ); } @@ -288,9 +288,9 @@ UINT32 OptionsScreenHandle() //Render the active slider bars RenderAllSliderBars(); - // render buttons marked dirty - MarkButtonsDirty( ); - RenderButtons( ); + // render buttons marked dirty + MarkButtonsDirty( ); + RenderButtons( ); // ATE: Put here to save RECTS before any fast help being drawn... SaveBackgroundRects( ); @@ -328,14 +328,14 @@ UINT32 OptionsScreenShutdown() BOOLEAN EnterOptionsScreen() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; UINT16 usPosY; UINT8 cnt; UINT16 usTextWidth, usTextHeight; // WANNE: Do not draw the blackground back //ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0 ); - + //Default this to off gfHideBloodAndGoreOption=FALSE; @@ -391,15 +391,15 @@ Uncomment this to enable the check for files to activate the blood and gore opti VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; GetMLGFilename( VObjectDesc.ImageFile, MLG_OPTIONHEADER ); CHECKF(AddVideoObject(&VObjectDesc, &guiOptionsAddOnImages)); - + //Save game button giOptionsButtonImages = LoadButtonImage("INTERFACE\\OptionScreenAddons.sti", -1,2,-1,3,-1 ); - guiOptGotoSaveGameBtn = CreateIconAndTextButton( giOptionsButtonImages, zOptionsText[OPT_SAVE_GAME], OPT_BUTTON_FONT, - OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, - OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - OPT_SAVE_BTN_X, OPT_SAVE_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnOptGotoSaveGameCallback); + guiOptGotoSaveGameBtn = CreateIconAndTextButton( giOptionsButtonImages, zOptionsText[OPT_SAVE_GAME], OPT_BUTTON_FONT, + OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, + OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + OPT_SAVE_BTN_X, OPT_SAVE_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnOptGotoSaveGameCallback); SpecifyDisabledButtonStyle( guiOptGotoSaveGameBtn, DISABLED_STYLE_HATCHED ); if( guiPreviousOptionScreen == MAINMENU_SCREEN || !CanGameBeSaved() ) { @@ -408,34 +408,34 @@ Uncomment this to enable the check for files to activate the blood and gore opti //Load game button giGotoLoadBtnImage = UseLoadedButtonImage( giOptionsButtonImages, -1,2,-1,3,-1 ); - guiOptGotoLoadGameBtn = CreateIconAndTextButton( giGotoLoadBtnImage, zOptionsText[OPT_LOAD_GAME], OPT_BUTTON_FONT, - OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, - OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - OPT_LOAD_BTN_X, OPT_LOAD_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnOptGotoLoadGameCallback); + guiOptGotoLoadGameBtn = CreateIconAndTextButton( giGotoLoadBtnImage, zOptionsText[OPT_LOAD_GAME], OPT_BUTTON_FONT, + OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, + OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + OPT_LOAD_BTN_X, OPT_LOAD_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnOptGotoLoadGameCallback); // SpecifyDisabledButtonStyle( guiBobbyRAcceptOrder, DISABLED_STYLE_SHADED ); //Quit to main menu button giQuitBtnImage = UseLoadedButtonImage( giOptionsButtonImages, -1,2,-1,3,-1 ); - guiQuitButton = CreateIconAndTextButton( giQuitBtnImage, zOptionsText[OPT_MAIN_MENU], OPT_BUTTON_FONT, - OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, - OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - OPT_QUIT_BTN_X, OPT_QUIT_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnOptQuitCallback); + guiQuitButton = CreateIconAndTextButton( giQuitBtnImage, zOptionsText[OPT_MAIN_MENU], OPT_BUTTON_FONT, + OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, + OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + OPT_QUIT_BTN_X, OPT_QUIT_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnOptQuitCallback); SpecifyDisabledButtonStyle( guiQuitButton, DISABLED_STYLE_HATCHED ); // DisableButton( guiQuitButton ); //Done button giDoneBtnImage = UseLoadedButtonImage( giOptionsButtonImages, -1,2,-1,3,-1 ); - guiDoneButton = CreateIconAndTextButton( giDoneBtnImage, zOptionsText[OPT_DONE], OPT_BUTTON_FONT, - OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, - OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - OPT_DONE_BTN_X, OPT_DONE_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnDoneCallback); + guiDoneButton = CreateIconAndTextButton( giDoneBtnImage, zOptionsText[OPT_DONE], OPT_BUTTON_FONT, + OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, + OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + OPT_DONE_BTN_X, OPT_DONE_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnDoneCallback); // SpecifyDisabledButtonStyle( guiBobbyRAcceptOrder, DISABLED_STYLE_SHADED ); @@ -459,8 +459,8 @@ Uncomment this to enable the check for files to activate the blood and gore opti continue; } //Check box to toggle tracking mode - guiOptionsToggles[ cnt ] = CreateCheckBoxButton( OPT_TOGGLE_BOX_FIRST_COLUMN_X, usPosY, - "INTERFACE\\OptionsCheckBoxes_12x12.sti", MSYS_PRIORITY_HIGH+10, + guiOptionsToggles[ cnt ] = CreateCheckBoxButton( OPT_TOGGLE_BOX_FIRST_COLUMN_X, usPosY, + "INTERFACE\\OptionsCheckBoxes_12x12.sti", MSYS_PRIORITY_HIGH+10, BtnOptionsTogglesCallback ); MSYS_SetBtnUserData( guiOptionsToggles[ cnt ], 0, cnt ); @@ -476,16 +476,16 @@ Uncomment this to enable the check for files to activate the blood and gore opti //Create mouse regions for the option toggle text MSYS_DefineRegion( &gSelectedOptionTextRegion[cnt], OPT_TOGGLE_BOX_FIRST_COLUMN_X+13, usPosY, (UINT16)(OPT_TOGGLE_BOX_FIRST_COL_TEXT_X+usTextWidth), (UINT16)(usPosY+usTextHeight*ubNumLines), MSYS_PRIORITY_HIGH, - CURSOR_NORMAL, SelectedOptionTextRegionMovementCallBack, SelectedOptionTextRegionCallBack ); - MSYS_AddRegion( &gSelectedOptionTextRegion[cnt]); + CURSOR_NORMAL, SelectedOptionTextRegionMovementCallBack, SelectedOptionTextRegionCallBack ); + MSYS_AddRegion( &gSelectedOptionTextRegion[cnt]); MSYS_SetRegionUserData( &gSelectedOptionTextRegion[ cnt ], 0, cnt); } else { //Create mouse regions for the option toggle text MSYS_DefineRegion( &gSelectedOptionTextRegion[cnt], OPT_TOGGLE_BOX_FIRST_COLUMN_X+13, usPosY, (UINT16)(OPT_TOGGLE_BOX_FIRST_COL_TEXT_X+usTextWidth), (UINT16)(usPosY+usTextHeight), MSYS_PRIORITY_HIGH, - CURSOR_NORMAL, SelectedOptionTextRegionMovementCallBack, SelectedOptionTextRegionCallBack ); - MSYS_AddRegion( &gSelectedOptionTextRegion[cnt]); + CURSOR_NORMAL, SelectedOptionTextRegionMovementCallBack, SelectedOptionTextRegionCallBack ); + MSYS_AddRegion( &gSelectedOptionTextRegion[cnt]); MSYS_SetRegionUserData( &gSelectedOptionTextRegion[ cnt ], 0, cnt); } @@ -502,8 +502,8 @@ Uncomment this to enable the check for files to activate the blood and gore opti for( cnt=gubFirstColOfOptions; cnt OPT_TOGGLE_BOX_TEXT_WIDTH ) DisplayWrappedString( OPT_TOGGLE_BOX_FIRST_COL_TEXT_X, usPosY, OPT_TOGGLE_BOX_TEXT_WIDTH, 2, OPT_MAIN_FONT, OPT_MAIN_COLOR, zOptionsToggleText[ cnt ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); else - DrawTextToScreen( zOptionsToggleText[ cnt ], OPT_TOGGLE_BOX_FIRST_COL_TEXT_X, usPosY, 0, OPT_MAIN_FONT, OPT_MAIN_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( zOptionsToggleText[ cnt ], OPT_TOGGLE_BOX_FIRST_COL_TEXT_X, usPosY, 0, OPT_MAIN_FONT, OPT_MAIN_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); usPosY += OPT_GAP_BETWEEN_TOGGLE_BOXES; } @@ -752,27 +752,27 @@ void RenderOptionsScreen() if( usWidth > OPT_TOGGLE_BOX_TEXT_WIDTH ) DisplayWrappedString( OPT_TOGGLE_BOX_SECOND_TEXT_X, usPosY, OPT_TOGGLE_BOX_TEXT_WIDTH, 2, OPT_MAIN_FONT, OPT_MAIN_COLOR, zOptionsToggleText[ cnt ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); else - DrawTextToScreen( zOptionsToggleText[ cnt ], OPT_TOGGLE_BOX_SECOND_TEXT_X, usPosY, 0, OPT_MAIN_FONT, OPT_MAIN_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( zOptionsToggleText[ cnt ], OPT_TOGGLE_BOX_SECOND_TEXT_X, usPosY, 0, OPT_MAIN_FONT, OPT_MAIN_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); usPosY += OPT_GAP_BETWEEN_TOGGLE_BOXES; } - + // // Text for the Slider Bars // //Display the Sound Fx text - DisplayWrappedString( OPT_SOUND_FX_TEXT_X, OPT_SOUND_FX_TEXT_Y, OPT_SLIDER_TEXT_WIDTH, 2, OPT_SLIDER_FONT, OPT_MAIN_COLOR, zOptionsText[ OPT_SOUND_FX ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DisplayWrappedString( OPT_SOUND_FX_TEXT_X, OPT_SOUND_FX_TEXT_Y, OPT_SLIDER_TEXT_WIDTH, 2, OPT_SLIDER_FONT, OPT_MAIN_COLOR, zOptionsText[ OPT_SOUND_FX ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); //Display the Speech text - DisplayWrappedString( OPT_SPEECH_TEXT_X, OPT_SPEECH_TEXT_Y, OPT_SLIDER_TEXT_WIDTH, 2, OPT_SLIDER_FONT, OPT_MAIN_COLOR, zOptionsText[ OPT_SPEECH ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DisplayWrappedString( OPT_SPEECH_TEXT_X, OPT_SPEECH_TEXT_Y, OPT_SLIDER_TEXT_WIDTH, 2, OPT_SLIDER_FONT, OPT_MAIN_COLOR, zOptionsText[ OPT_SPEECH ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); //Display the Music text - DisplayWrappedString( OPT_MUSIC_TEXT_X, OPT_MUSIC_TEXT_Y, OPT_SLIDER_TEXT_WIDTH, 2, OPT_SLIDER_FONT, OPT_MAIN_COLOR, zOptionsText[ OPT_MUSIC ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); - + DisplayWrappedString( OPT_MUSIC_TEXT_X, OPT_MUSIC_TEXT_Y, OPT_SLIDER_TEXT_WIDTH, 2, OPT_SLIDER_FONT, OPT_MAIN_COLOR, zOptionsText[ OPT_MUSIC ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + InvalidateRegion( OPTIONS__TOP_LEFT_X, OPTIONS__TOP_LEFT_Y, OPTIONS__BOTTOM_RIGHT_X, OPTIONS__BOTTOM_RIGHT_Y); } @@ -787,33 +787,33 @@ void RenderOptionsScreen() void GetOptionsScreenUserInput() { InputAtom Event; - POINT MousePos; + POINT MousePos; GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! + ScreenToClient(ghWindow, &MousePos); // In window coords! while( DequeueEvent( &Event ) ) { // HOOK INTO MOUSE HOOKS switch( Event.usEvent) - { + { case LEFT_BUTTON_DOWN: MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; case LEFT_BUTTON_UP: - MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); + MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); break; case RIGHT_BUTTON_DOWN: MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - case RIGHT_BUTTON_UP: - MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + case RIGHT_BUTTON_UP: + MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - case RIGHT_BUTTON_REPEAT: - MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + case RIGHT_BUTTON_REPEAT: + MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - case LEFT_BUTTON_REPEAT: - MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + case LEFT_BUTTON_REPEAT: + MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; } @@ -896,7 +896,7 @@ void GetOptionsScreenUserInput() case 'z': - SetErrorMode( SEM_FAILCRITICALERRORS ); + SetErrorMode( SEM_FAILCRITICALERRORS ); break; case 'q': @@ -936,7 +936,7 @@ void BtnOptGotoSaveGameCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnOptGotoLoadGameCallback(GUI_BUTTON *btn,INT32 reason) { @@ -959,7 +959,7 @@ void BtnOptGotoLoadGameCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnOptQuitCallback(GUI_BUTTON *btn,INT32 reason) @@ -985,7 +985,7 @@ void BtnOptQuitCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnDoneCallback(GUI_BUTTON *btn,INT32 reason) { @@ -1007,7 +1007,7 @@ void BtnDoneCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void BtnOptionsTogglesCallback( GUI_BUTTON *btn, INT32 reason ) @@ -1052,7 +1052,6 @@ void BtnOptionsTogglesCallback( GUI_BUTTON *btn, INT32 reason ) void HandleOptionToggle( UINT8 ubButton, BOOLEAN fState, BOOLEAN fDown, BOOLEAN fPlaySound ) { static UINT32 uiOptionToggleSound = NO_SAMPLE; - //UINT32 uiSideToPlaySoundOn = MIDDLEPAN; // static BOOLEAN fCheckBoxDrawnDownLastTime = FALSE; if( fState ) @@ -1069,12 +1068,12 @@ void HandleOptionToggle( UINT8 ubButton, BOOLEAN fState, BOOLEAN fDown, BOOLEAN gGameSettings.fOptions[ ubButton ] = FALSE; ButtonList[ guiOptionsToggles[ ubButton ] ]->uiFlags &= ~BUTTON_CLICKED_ON; - + if( fDown ) DrawCheckBoxButtonOff( guiOptionsToggles[ ubButton ] ); //check to see if the user is unselecting either the spech or subtitles toggle - if( ubButton == TOPTION_SPEECH || ubButton == TOPTION_SUBTITLES ) + if( ubButton == TOPTION_SPEECH || ubButton == TOPTION_SUBTITLES ) { //make sure that at least of of the toggles is still enabled if( !(ButtonList[ guiOptionsToggles[ TOPTION_SPEECH ] ]->uiFlags & BUTTON_CLICKED_ON) ) @@ -1106,12 +1105,12 @@ void HandleOptionToggle( UINT8 ubButton, BOOLEAN fState, BOOLEAN fDown, BOOLEAN if( fDown ) { // case BTN_SND_CLICK_OFF: - PlayJA2Sample( BIG_SWITCH3_IN, RATE_11025, BTNVOLUME, 1, MIDDLEPAN ); + PlayJA2Sample( BIG_SWITCH3_IN, RATE_11025, BTNVOLUME, 1, MIDDLEPAN ); } else { // case BTN_SND_CLICK_ON: - PlayJA2Sample( BIG_SWITCH3_OUT, RATE_11025, BTNVOLUME, 1, MIDDLEPAN ); + PlayJA2Sample( BIG_SWITCH3_OUT, RATE_11025, BTNVOLUME, 1, MIDDLEPAN ); } } } @@ -1134,16 +1133,16 @@ void SpeechSliderChangeCallBack( INT32 iNewValue ) void MusicSliderChangeCallBack( INT32 iNewValue ) { - MusicSetVolume( iNewValue ); + MusicSetVolume( iNewValue ); } BOOLEAN DoOptionsMessageBoxWithRect( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect ) -{ +{ // reset exit mode gfExitOptionsDueToMessageBox = TRUE; // do message box and return - giOptionsMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT16 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, pCenteringRect ); + giOptionsMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT16 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, pCenteringRect ); // send back return state return( ( giOptionsMessageBox != -1 ) ); @@ -1151,13 +1150,13 @@ BOOLEAN DoOptionsMessageBoxWithRect( UINT8 ubStyle, const STR16 zString, UINT32 BOOLEAN DoOptionsMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ) { - SGPRect CenteringRect= {0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1 }; - + SGPRect CenteringRect= {0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1 }; + // reset exit mode gfExitOptionsDueToMessageBox = TRUE; // do message box and return - giOptionsMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT16 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, &CenteringRect ); + giOptionsMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT16 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, &CenteringRect ); // send back return state return( ( giOptionsMessageBox != -1 ) ); @@ -1168,7 +1167,7 @@ BOOLEAN DoOptionsMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitSc void ConfirmQuitToMainMenuMessageBoxCallBack( UINT8 bExitValue ) { // yes, Quit to main menu - if( bExitValue == MSG_BOX_RETURN_YES ) + if( bExitValue == MSG_BOX_RETURN_YES ) { gfEnteredFromMapScreen = FALSE; gfExitOptionsAfterMessageBox = TRUE; @@ -1218,7 +1217,6 @@ void HandleSliderBarMovementSounds() { static UINT32 uiLastSoundFxTime=0; static UINT32 uiLastSpeechTime=0; - //UINT32 uiCurTime = GetJA2Clock(); static UINT32 uiLastPlayingSoundID = NO_SAMPLE; static UINT32 uiLastPlayingSpeechID = NO_SAMPLE; @@ -1264,7 +1262,7 @@ void SelectedOptionTextRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } - else if( iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN )//iReason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT || + else if( iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN )//iReason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT || { if( gGameSettings.fOptions[ ubButton ] ) { @@ -1380,17 +1378,17 @@ void HandleHighLightedText( BOOLEAN fHighLight ) { if( fHighLight ) DisplayWrappedString( usPosX, usPosY, OPT_TOGGLE_BOX_TEXT_WIDTH, 2, OPT_MAIN_FONT, OPT_HIGHLIGHT_COLOR, zOptionsToggleText[ bHighLight ], FONT_MCOLOR_BLACK, TRUE, LEFT_JUSTIFIED ); -// DrawTextToScreen( zOptionsToggleText[ bHighLight ], usPosX, usPosY, 0, OPT_MAIN_FONT, OPT_HIGHLIGHT_COLOR, FONT_MCOLOR_BLACK, TRUE, LEFT_JUSTIFIED ); +// DrawTextToScreen( zOptionsToggleText[ bHighLight ], usPosX, usPosY, 0, OPT_MAIN_FONT, OPT_HIGHLIGHT_COLOR, FONT_MCOLOR_BLACK, TRUE, LEFT_JUSTIFIED ); else DisplayWrappedString( usPosX, usPosY, OPT_TOGGLE_BOX_TEXT_WIDTH, 2, OPT_MAIN_FONT, OPT_MAIN_COLOR, zOptionsToggleText[ bHighLight ], FONT_MCOLOR_BLACK, TRUE, LEFT_JUSTIFIED ); -// DrawTextToScreen( zOptionsToggleText[ bHighLight ], usPosX, usPosY, 0, OPT_MAIN_FONT, OPT_MAIN_COLOR, FONT_MCOLOR_BLACK, TRUE, LEFT_JUSTIFIED ); +// DrawTextToScreen( zOptionsToggleText[ bHighLight ], usPosX, usPosY, 0, OPT_MAIN_FONT, OPT_MAIN_COLOR, FONT_MCOLOR_BLACK, TRUE, LEFT_JUSTIFIED ); } else { if( fHighLight ) - DrawTextToScreen( zOptionsToggleText[ bHighLight ], usPosX, usPosY, 0, OPT_MAIN_FONT, OPT_HIGHLIGHT_COLOR, FONT_MCOLOR_BLACK, TRUE, LEFT_JUSTIFIED ); + DrawTextToScreen( zOptionsToggleText[ bHighLight ], usPosX, usPosY, 0, OPT_MAIN_FONT, OPT_HIGHLIGHT_COLOR, FONT_MCOLOR_BLACK, TRUE, LEFT_JUSTIFIED ); else - DrawTextToScreen( zOptionsToggleText[ bHighLight ], usPosX, usPosY, 0, OPT_MAIN_FONT, OPT_MAIN_COLOR, FONT_MCOLOR_BLACK, TRUE, LEFT_JUSTIFIED ); + DrawTextToScreen( zOptionsToggleText[ bHighLight ], usPosX, usPosY, 0, OPT_MAIN_FONT, OPT_MAIN_COLOR, FONT_MCOLOR_BLACK, TRUE, LEFT_JUSTIFIED ); } } } @@ -1405,7 +1403,7 @@ void SelectedToggleBoxAreaRegionMovementCallBack(MOUSE_REGION * pRegion, INT32 r else if( reason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) { UINT8 ubCnt; - + //loop through all the toggle box's and remove the in area flag for( ubCnt=0;ubCnt - + SCR_INITIALIZING -> SCR_ACTIVE -> SCR_SHUTTING_DOWN -> SCR_INACTIVE ... Anything else +// SCR_INACTIVE->SCR_INITIALIZING->SCR_ACTIVE->SCR_SHUTTING_DOWN->SCR_INACTIVE ... Anything else // will cause the system to yak. -#define SCR_INACTIVE 0x00 -#define SCR_INITIALIZING 0x01 -#define SCR_ACTIVE 0x02 -#define SCR_SHUTTING_DOWN 0x04 +#define SCR_INACTIVE 0x00 +#define SCR_INITIALIZING 0x01 +#define SCR_ACTIVE 0x02 +#define SCR_SHUTTING_DOWN 0x04 // This extern is made available to make sure that external modules will have access to the screen information diff --git a/SCREENS.cpp b/SCREENS.cpp index bb500a1c..7387c435 100644 --- a/SCREENS.cpp +++ b/SCREENS.cpp @@ -30,12 +30,12 @@ BOOLEAN fDisplayOverheadMap; Screens GameScreens[MAX_SCREENS] = { - { EditScreenInit, EditScreenHandle, EditScreenShutdown }, - { SavingScreenInitialize, SavingScreenHandle, SavingScreenShutdown }, // Title Screen - { LoadingScreenInitialize, LoadingScreenHandle, LoadingScreenShutdown }, // Title Screen - { ErrorScreenInitialize, ErrorScreenHandle, ErrorScreenShutdown }, // Title Screen - { InitScreenInitialize, InitScreenHandle, InitScreenShutdown }, // Title Screen - { MainGameScreenInit, MainGameScreenHandle, MainGameScreenShutdown }, + { EditScreenInit, EditScreenHandle, EditScreenShutdown }, + { SavingScreenInitialize, SavingScreenHandle, SavingScreenShutdown }, // Title Screen + { LoadingScreenInitialize, LoadingScreenHandle, LoadingScreenShutdown }, // Title Screen + { ErrorScreenInitialize, ErrorScreenHandle, ErrorScreenShutdown }, // Title Screen + { InitScreenInitialize, InitScreenHandle, InitScreenShutdown }, // Title Screen + { MainGameScreenInit, MainGameScreenHandle, MainGameScreenShutdown }, { AniEditScreenInit, AniEditScreenHandle, AniEditScreenShutdown }, { PalEditScreenInit, PalEditScreenHandle, PalEditScreenShutdown }, { DebugScreenInit, DebugScreenHandle, DebugScreenShutdown }, diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index 4d03a0af..e788339f 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -64,7 +64,6 @@ #include "Tactical Placement GUI.h" #include "Strategic Mines.h" - #include "GameVersion.h" #include "Strategic Town Loyalty.h" #include "Vehicles.h" #include "Merc Contract.h" @@ -103,6 +102,8 @@ #include "interface panels.h" #include "interface dialogue.h" #include "Assignments.h" + #include "Interface Items.h" + #include "Shopkeeper Interface.h" #endif #include "BobbyR.h" @@ -243,7 +244,7 @@ typedef struct // the flags for skyrider events BOOLEAN fShowEstoniRefuelHighLight; BOOLEAN fShowOtherSAMHighLight; - BOOLEAN fShowDrassenSAMHighLight; + BOOLEAN fShowDrassenSAMHighLight; UINT32 uiEnvWeather; @@ -255,7 +256,7 @@ typedef struct BOOLEAN fSkyriderEmptyHelpGiven; BOOLEAN fEnterMapDueToContract; UINT8 ubHelicopterHitsTaken; - UINT8 ubQuitType; + UINT8 ubQuitType; BOOLEAN fSkyriderSaidCongratsOnTakingSAM; INT16 sContractRehireSoldierID; @@ -301,7 +302,7 @@ typedef struct BOOLEAN gfMeanwhileTryingToStart; BOOLEAN gfInMeanwhile; - // list of dead guys for squads...in id values -> -1 means no one home + // list of dead guys for squads...in id values->-1 means no one home INT16 sDeadMercs[ NUMBER_OF_SQUADS ][ NUMBER_OF_SOLDIERS_PER_SQUAD ]; // levels of publicly known noises @@ -376,7 +377,7 @@ typedef struct INT32 iHospitalTempBalance; INT32 iHospitalRefund; - INT8 fPlayerTeamSawJoey; + INT8 fPlayerTeamSawJoey; INT8 fMikeShouldSayHi; UINT8 ubFiller[550]; //This structure should be 1024 bytes @@ -385,8 +386,7 @@ typedef struct -UINT32 guiSaveGameVersion=0; - +UINT32 guiCurrentSaveGameVersion = SAVE_GAME_VERSION; ///////////////////////////////////////////////////// // @@ -396,13 +396,13 @@ UINT32 guiSaveGameVersion=0; //CHAR8 gsSaveGameNameWithPath[ 512 ]; -CHAR8 gSaveDir[ MAX_PATH ]; // Snap: Initilized by InitSaveDir +CHAR8 gSaveDir[ MAX_PATH ]; // Snap: Initilized by InitSaveDir UINT8 gubSaveGameLoc=0; UINT32 guiScreenToGotoAfterLoadingSavedGame = 0; -extern EmailPtr pEmailList; +extern EmailPtr pEmailList; extern UINT32 guiCurrentUniqueSoldierId; extern BOOLEAN gfHavePurchasedItemsFromTony; @@ -419,6 +419,10 @@ BOOLEAN LoadSavedMercProfiles( HWFILE hwFile ); BOOLEAN SaveSoldierStructure( HWFILE hFile ); BOOLEAN LoadSoldierStructure( HWFILE hFile ); +// CHRISL: New functions to save and load LBENODE data +BOOLEAN SaveLBENODEToSaveGameFile( HWFILE hFile ); +BOOLEAN LoadLBENODEFromSaveGameFile( HWFILE hFile ); + //BOOLEAN SavePtrInfo( PTR *pData, UINT32 uiSizeOfObject, HWFILE hFile ); //BOOLEAN LoadPtrInfo( PTR *pData, UINT32 uiSizeOfObject, HWFILE hFile ); @@ -461,22 +465,1318 @@ void HandleOldBobbyRMailOrders(); void SaveGameFilePosition( INT32 iPos, STR pMsg ); void LoadGameFilePosition( INT32 iPos, STR pMsg ); - + void WriteTempFileNameToFile( STR pFileName, UINT32 uiSizeOfFile, HFILE hSaveFile ); - void InitShutDownMapTempFileTest( BOOLEAN fInit, STR pNameOfFile, UINT8 ubSaveGameID ); + void InitShutDownMapTempFileTest( BOOLEAN fInit, STR pNameOfFile, UINT8 ubSaveGameID ); #endif #ifdef JA2BETAVERSION extern BOOLEAN ValidateSoldierInitLinks( UINT8 ubCode ); #endif - void TruncateStrategicGroupSizes(); +void TruncateStrategicGroupSizes(); - ///////////////////////////////////////////////////// +///////////////////////////////////////////////////// // // Functions // ///////////////////////////////////////////////////// +//ADB +//Some notes on saving and loading functions: +//some of these classes are saved in 2 places, in the savegame and in the sector file +//when this happens, the class data saved to the sector file is not encrypted, +//while the savegame may or may not be, this is why there is a bool for save. + +//to load from a sector, the data is first loaded in one fell swoop and put in a buffer +//then, each class's data is read from the buffer, so it needs a function that takes a buffer not a file +//this function can automatically assume it is reading non encrypted data +//the regular loading function may or may not be reading encrypted data +//but that is determined on a class by class basis + +//when saving encrypted data there is only one new function, +//but there are 2 loading functions to support really old versions + +//the encryption set is determined by the savegame header, so make sure +//that saving and loading are logically mirrors, or when changing +//savegame versions you'll try decrypting it differently + +//some class's structure have changed. for these, there is a conversion that needs to take place +//the savegame version is read and the data loaded accordingly, then converted +//load once, convert as many times as necessary + +//when changing the structure of some class, check if it is someplace in +//LoadWorld, if it is, you've got to rebuild the maps + +//if all that sounds compilcated, it is + +extern int gLastLBEUniqueID; +/* +// CHRISL: New function to save/load LBENODE data +BOOLEAN SaveLBENODEToSaveGameFile( HWFILE hFile ) +{ + UINT32 uiNumBytesWritten; + if ( !FileWrite( hFile, &gLastLBEUniqueID, sizeof(int), &uiNumBytesWritten ) ) + { + return(FALSE); + } + return TRUE; +} + +BOOLEAN LoadLBENODEFromSaveGameFile( HWFILE hFile ) +{ + UINT32 uiNumBytesRead; + if ( !FileRead( hFile, &gLastLBEUniqueID, sizeof(int), &uiNumBytesRead ) ) + { + return(FALSE); + } + return TRUE; +} +*/ +BOOLEAN LBENODE::Load( HWFILE hFile ) +{ + UINT32 uiNumBytesRead; + //if we are at the most current version, then fine + if ( guiCurrentSaveGameVersion >= CURRENT_SAVEGAME_DATATYPE_VERSION ) + { + if ( !FileRead( hFile, this, SIZEOF_LBENODE_POD, &uiNumBytesRead ) ) + { + return(FALSE); + } + if (uniqueID >= gLastLBEUniqueID) { + //can happen because of the order things are saved and loaded, + //when combined with copy assignment which makes a new LBENODE + gLastLBEUniqueID = uniqueID + 1; + } + int size; + if ( !FileRead( hFile, &size, sizeof(int), &uiNumBytesRead ) ) + { + return(FALSE); + } + + inv.resize(size); + for (std::vector::iterator iter = inv.begin(); iter != inv.end(); ++iter) { + if (! iter->Load(hFile)) { + return FALSE; + } + } + } + else + { + //we shouldn't be loading from anything before the first change + Assert(guiCurrentSaveGameVersion >= FIRST_SAVEGAME_DATATYPE_CHANGE); + } + return TRUE; +} + +BOOLEAN LBENODE::Load( INT8** hBuffer, float dMajorMapVersion, UINT8 ubMinorMapVersion ) +{ + if (dMajorMapVersion >= 6.0 && ubMinorMapVersion > 26 ) { + LOADDATA( this, *hBuffer, SIZEOF_LBENODE_POD ); + if (uniqueID >= gLastLBEUniqueID) { + //can happen because of the order things are saved and loaded, + //when combined with copy assignment which makes a new LBENODE + gLastLBEUniqueID = uniqueID + 1; + } + int size; + LOADDATA( &size, *hBuffer, sizeof(int) ); + inv.resize(size); + for (std::vector::iterator iter = inv.begin(); iter != inv.end(); ++iter) { + iter->Load(hBuffer, dMajorMapVersion, ubMinorMapVersion); + } + } + else { + Assert(guiCurrentSaveGameVersion >= FIRST_SAVEGAME_DATATYPE_CHANGE); + } + return TRUE; +} + +BOOLEAN LBENODE::Save( HWFILE hFile, bool fSavingMap ) +{ + UINT32 uiNumBytesWritten; + int size = inv.size(); + + if ( !FileWrite( hFile, this, SIZEOF_LBENODE_POD, &uiNumBytesWritten ) ) + { + return(FALSE); + } + if ( !FileWrite( hFile, &size, sizeof(int), &uiNumBytesWritten ) ) + { + return(FALSE); + } + for (std::vector::iterator iter = inv.begin(); iter != inv.end(); ++iter) { + //we are not saving to a map, at least not yet + if (! iter->Save(hFile, false)) { + return FALSE; + } + } + return TRUE; +} + + +BOOLEAN LoadArmsDealerInventoryFromSavedGameFile( HWFILE hFile ) +{ + UINT32 uiNumBytesRead; + UINT8 ubArmsDealer; + UINT16 usItemIndex; + + //Free all the dealers special inventory arrays + ShutDownArmsDealers(); + + if (guiCurrentSaveGameVersion >= FIRST_SAVEGAME_DATATYPE_CHANGE) { + int dealers; + if (!FileRead( hFile, &dealers, sizeof( int ), &uiNumBytesRead )) + { + return( FALSE ); + } + gArmsDealersInventory.resize(dealers); + + if (!FileRead( hFile, gArmsDealerStatus, sizeof( gArmsDealerStatus ), &uiNumBytesRead )) + { + return( FALSE ); + } + + //loop through all the dealers inventories + for( ubArmsDealer=0; ubArmsDealerLoad(hFile) ) { + return FALSE; + } + //CHRISL: Because of the "100rnd" bug that Tony is experiencing, lets look at each item as we create it. If the + // item is ammo, reset the bItemCondition value to equal the number of rounds. Hopefully this will be unneccessary + // but for the time being, it may help to alleviate the "100rnd" bug. + if(Item[iter->object.usItem].usItemClass == IC_AMMO) + { + //This condition should catch any dealer ammo items that have both invalid bItemCondition and ubShotsLeft values. + // We'll only make bItemCondition valid at this point. Let the next condition correct ubShotsLeft. + if(iter->bItemCondition > Magazine[Item[iter->object.usItem].ubClassIndex].ubMagSize) + { + iter->bItemCondition = Magazine[Item[iter->object.usItem].ubClassIndex].ubMagSize; + } + //This condition should catch any dealer ammo items that have an invalid bItemCondition assuming ubShotsLeft is valid + if(iter->bItemCondition != iter->object[0]->data.ubShotsLeft) + { + iter->bItemCondition = iter->object[0]->data.ubShotsLeft; + } + } + } + } + } + else { + //the format has changed and needs to be updated + OLD_ARMS_DEALER_STATUS_101 gOldArmsDealerStatus[NUM_ARMS_DEALERS]; + //OLD_DEALER_ITEM_HEADER_101 gOldArmsDealersInventory[NUM_ARMS_DEALERS][MAXITEMS]; + + //pointer to an array of OLD_DEALER_ITEM_HEADER_101 that is sized [NUM_ARMS_DEALERS][MAXITEMS] + typedef OLD_DEALER_ITEM_HEADER_101(*pointerToArmsDealersInventoryArray)[NUM_ARMS_DEALERS][MAXITEMS]; + + pointerToArmsDealersInventoryArray pOldArmsDealersInventory + = (pointerToArmsDealersInventoryArray) new OLD_DEALER_ITEM_HEADER_101[NUM_ARMS_DEALERS][MAXITEMS]; + + + // Elgin was added to the dealers list in Game Version #54, enlarging these 2 tables... + // Manny was added to the dealers list in Game Version #55, enlarging these 2 tables... + bool fIncludesElgin = guiCurrentSaveGameVersion >= 54; + bool fIncludesManny = guiCurrentSaveGameVersion >= 55; + UINT32 uiDealersSaved; + if (fIncludesElgin && fIncludesManny ){ + uiDealersSaved = NUM_ORIGINAL_ARMS_DEALERS; + } + else if ( !fIncludesElgin ) { + // read 2 fewer element without Elgin or Manny in there... + uiDealersSaved = NUM_ORIGINAL_ARMS_DEALERS - 2; + } + else { + // read one fewer element without Elgin in there... + uiDealersSaved = NUM_ORIGINAL_ARMS_DEALERS - 1; + } + gArmsDealersInventory.resize(uiDealersSaved); + + if (!FileRead( hFile, gOldArmsDealerStatus, uiDealersSaved * sizeof( OLD_ARMS_DEALER_STATUS_101 ), &uiNumBytesRead )) + { + return( FALSE ); + } + if (!FileRead( hFile, (*pOldArmsDealersInventory), uiDealersSaved * sizeof( OLD_DEALER_ITEM_HEADER_101 ) * MAXITEMS, &uiNumBytesRead )) + { + return( FALSE ); + } + + if ( !fIncludesElgin ) { + // initialize Elgin now... + InitializeOneArmsDealer( ARMS_DEALER_ELGIN ); + } + if ( !fIncludesManny ) { + // initialize Manny now... + InitializeOneArmsDealer( ARMS_DEALER_MANNY ); + } + + OLD_DEALER_SPECIAL_ITEM_101 oldSpecial; + DEALER_SPECIAL_ITEM loadedSpecial; + //loop through all the dealers inventories + for( ubArmsDealer=0; ubArmsDealerobject); + //cannot set to 100, could be ammo + pPerfectItem->bItemCondition = pPerfectItem->object[0]->data.objectStatus; + } + + //if there are any items on order, order them + if ((*pOldArmsDealersInventory)[ubArmsDealer][usItemIndex].ubQtyOnOrder) { + OrderDealerItems(ubArmsDealer, usItemIndex, + (*pOldArmsDealersInventory)[ubArmsDealer][usItemIndex].ubQtyOnOrder, + (*pOldArmsDealersInventory)[ubArmsDealer][usItemIndex].uiOrderArrivalTime); + } + + //if there are any special elements allocated for this item, load them + for ( int x = 0; x < (*pOldArmsDealersInventory)[ubArmsDealer][usItemIndex].ubElementsAlloced; ++x) { + if (!FileRead( hFile, &oldSpecial, sizeof( OLD_DEALER_SPECIAL_ITEM_101 ), &uiNumBytesRead )) + { + return( FALSE ); + } + //not all elements alloced are full, some are empty! + //convert and add to arms dealer list (if applicable) + loadedSpecial.ConvertFrom101((*pOldArmsDealersInventory)[ubArmsDealer][usItemIndex], oldSpecial, ubArmsDealer, usItemIndex); + } + } + } + delete [] pOldArmsDealersInventory; + } + + return( TRUE ); +} + + +BOOLEAN DEALER_SPECIAL_ITEM::Save(HWFILE hFile) +{ + UINT32 uiNumBytesWritten; + if ( !FileWrite( hFile, this, SIZEOF_DEALER_SPECIAL_ITEM_POD, &uiNumBytesWritten ) ) + { + return FALSE; + } + if ( !this->object.Save(hFile, FALSE) ) + { + return FALSE; + } + return TRUE; +} + +BOOLEAN DEALER_SPECIAL_ITEM::Load(HWFILE hFile) +{ + UINT32 uiNumBytesRead; + //if we are at the most current version, then fine + if ( guiCurrentSaveGameVersion >= CURRENT_SAVEGAME_DATATYPE_VERSION ) + { + if ( !FileRead( hFile, this, SIZEOF_DEALER_SPECIAL_ITEM_POD, &uiNumBytesRead ) ) + { + return FALSE; + } + if ( !this->object.Load(hFile) ) + { + return FALSE; + } + } + else + { + //this will never be loaded from sometime before the first change + Assert(guiCurrentSaveGameVersion >= FIRST_SAVEGAME_DATATYPE_CHANGE); + } + return TRUE; +} + +BOOLEAN REAL_OBJECT::Save(HWFILE hFile) +{ + UINT32 uiNumBytesWritten; + if ( !FileWrite( hFile, this, SIZEOF_REAL_OBJECT_POD, &uiNumBytesWritten ) ) + { + return FALSE; + } + if ( !this->Obj.Save(hFile, FALSE) ) + { + return FALSE; + } + return TRUE; +} + +BOOLEAN REAL_OBJECT::Load(HWFILE hFile) +{ + UINT32 uiNumBytesRead; + //if we are at the most current version, then fine + if ( guiCurrentSaveGameVersion >= CURRENT_SAVEGAME_DATATYPE_VERSION ) + { + if ( !FileRead( hFile, this, SIZEOF_REAL_OBJECT_POD, &uiNumBytesRead ) ) + { + return FALSE; + } + if ( !this->Obj.Load(hFile) ) + { + return FALSE; + } + } + else + { + if ( guiCurrentSaveGameVersion < FIRST_SAVEGAME_DATATYPE_CHANGE ) + { + OLD_REAL_OBJECT_101 oldObject; + if ( !FileRead( hFile, &oldObject, sizeof( OLD_REAL_OBJECT_101 ), &uiNumBytesRead ) ) + { + return FALSE; + } + *this = oldObject; + } + } + return TRUE; +} + +BOOLEAN INVENTORY_IN_SLOT::Save(HWFILE hFile) +{ + UINT32 uiNumBytesWritten; + if ( !FileWrite( hFile, this, SIZEOF_INVENTORY_IN_SLOT_POD, &uiNumBytesWritten ) ) + { + return FALSE; + } + if ( !this->ItemObject.Save(hFile, FALSE) ) + { + return FALSE; + } + return TRUE; +} + +BOOLEAN INVENTORY_IN_SLOT::Load(HWFILE hFile) +{ + UINT32 uiNumBytesRead; + //if we are at the most current version, then fine + if ( guiCurrentSaveGameVersion >= CURRENT_SAVEGAME_DATATYPE_VERSION ) + { + if ( !FileRead( hFile, this, SIZEOF_INVENTORY_IN_SLOT_POD, &uiNumBytesRead ) ) + { + return FALSE; + } + if ( !this->ItemObject.Load(hFile) ) + { + return FALSE; + } + } + else + { + if ( guiCurrentSaveGameVersion < FIRST_SAVEGAME_DATATYPE_CHANGE ) + { + OLD_INVENTORY_IN_SLOT_101 oldItem; + if ( !FileRead( hFile, &oldItem, sizeof( OLD_INVENTORY_IN_SLOT_101 ), &uiNumBytesRead ) ) + { + return FALSE; + } + *this = oldItem; + } + } + return TRUE; +} + +BOOLEAN MERC_LEAVE_ITEM::Save(HWFILE hFile) +{ + if ( !this->object.Save(hFile, FALSE) ) + { + return FALSE; + } + return TRUE; +} + +BOOLEAN MERC_LEAVE_ITEM::Load(HWFILE hFile) +{ + UINT32 uiNumBytesRead; + //if we are at the most current version, then fine + if ( guiCurrentSaveGameVersion >= CURRENT_SAVEGAME_DATATYPE_VERSION ) + { + if ( !this->object.Load(hFile) ) + { + return FALSE; + } + } + else + { + if ( guiCurrentSaveGameVersion < FIRST_SAVEGAME_DATATYPE_CHANGE ) + { + OLD_MERC_LEAVE_ITEM_101 oldItem; + if ( !FileRead( hFile, &oldItem, sizeof( OLD_MERC_LEAVE_ITEM_101 ), &uiNumBytesRead ) ) + { + return FALSE; + } + this->object = oldItem.oldObject; + } + } + return TRUE; +} + +BOOLEAN ITEM_CURSOR_SAVE_INFO::Load(HWFILE hFile) +{ + UINT32 uiNumBytesRead; + //if we are at the most current version, then fine + if ( guiCurrentSaveGameVersion >= CURRENT_SAVEGAME_DATATYPE_VERSION ) + { + //3 bytes of info, screw being neat + if ( !FileRead( hFile, this, 3, &uiNumBytesRead ) ) + { + return FALSE; + } + if ( !this->ItemPointerInfo.Load(hFile) ) + { + return FALSE; + } + } + else + { + if ( guiCurrentSaveGameVersion < FIRST_SAVEGAME_DATATYPE_CHANGE ) + { + OLD_ITEM_CURSOR_SAVE_INFO_101 oldInfo101; + if ( !FileRead( hFile, &oldInfo101, sizeof(OLD_ITEM_CURSOR_SAVE_INFO_101), &uiNumBytesRead ) ) + { + return FALSE; + } + *this = oldInfo101; + } + + } + return TRUE; +} + +BOOLEAN ITEM_CURSOR_SAVE_INFO::Save(HWFILE hFile) +{ + UINT32 uiNumBytesWritten; + //3 bytes of info, screw being neat + if ( !FileWrite( hFile, this, 3, &uiNumBytesWritten ) ) + { + return FALSE; + } + if ( !this->ItemPointerInfo.Save(hFile, FALSE) ) + { + return FALSE; + } + return TRUE; +} + + +BOOLEAN SOLDIERCREATE_STRUCT::Save(HWFILE hFile, bool fSavingMap) +{ + UINT32 uiNumBytesWritten; + if ( !FileWrite( hFile, this, SIZEOF_SOLDIERCREATE_STRUCT_POD, &uiNumBytesWritten ) ) + { + return FALSE; + } + if ( !this->Inv.Save(hFile, fSavingMap) ) + { + return FALSE; + } + + //ADB screw checksums, they suck, also, checksums aren't always saved + /* + if (fSavingMap == false) { + UINT16 usCheckSum = GetChecksum(); + if ( !FileWrite( hFile, &usCheckSum, 2, &uiNumBytesWritten ) ) + { + return FALSE; + } + } + */ + return TRUE; +} + +BOOLEAN SOLDIERCREATE_STRUCT::Load(INT8 **hBuffer, float dMajorMapVersion, UINT8 ubMinorMapVersion) +{ + if (dMajorMapVersion >= 6.0 && ubMinorMapVersion > 26 ) { + LOADDATA( this, *hBuffer, SIZEOF_SOLDIERCREATE_STRUCT_POD ); + this->Inv.Load(hBuffer, dMajorMapVersion, ubMinorMapVersion); + } + else { + //ADB checksum was not saved under these circumstances! + OLD_SOLDIERCREATE_STRUCT_101 OldSavedSoldierInfo101; + LOADDATA( &OldSavedSoldierInfo101, *hBuffer, SIZEOF_OLD_SOLDIERCREATE_STRUCT_101_POD ); + OldSavedSoldierInfo101.CopyOldInventoryToNew(); + *this = OldSavedSoldierInfo101; + } + return TRUE; +} + +BOOLEAN SOLDIERCREATE_STRUCT::Load(HWFILE hFile, int versionToLoad, bool loadChecksum) +{ + UINT32 uiNumBytesRead; + + //ADB need to overwrite guiCurrentSaveGameVersion so that the other things loaded (like inv) are loaded ok + int tempVersion = guiCurrentSaveGameVersion; + guiCurrentSaveGameVersion = versionToLoad; + + //if we are at the most current version, then fine + if ( guiCurrentSaveGameVersion >= CURRENT_SAVEGAME_DATATYPE_VERSION) + { + //the info has changed at version 102 + //first, load the POD + if ( !FileRead( hFile, this, SIZEOF_SOLDIERCREATE_STRUCT_POD, &uiNumBytesRead ) ) + { + guiCurrentSaveGameVersion = tempVersion; + return(FALSE); + } + + //load the OO inventory + if ( !this->Inv.Load(hFile) ) + { + guiCurrentSaveGameVersion = tempVersion; + return(FALSE); + } + } + else + { + OLD_SOLDIERCREATE_STRUCT_101 OldSavedSoldierInfo101; + //we are loading an older version (only load once, so use "else if") + //first load the data based on what version was stored + if ( guiCurrentSaveGameVersion < FIRST_SAVEGAME_DATATYPE_CHANGE ) + { + if ( !FileRead( hFile, &OldSavedSoldierInfo101, SIZEOF_OLD_SOLDIERCREATE_STRUCT_101_POD, &uiNumBytesRead ) ) + { + guiCurrentSaveGameVersion = tempVersion; + return FALSE; + } + } + /* + else if ( guiCurrentSaveGameVersion < SECOND_SAVEGAME_DATATYPE_CHANGE ) + OldSavedSoldierInfo999.initialize(); + FileRead( hFile, &OldSavedSoldierInfo999, SIZEOF_OLD_SOLDIERCREATE_STRUCT_999_POD, &uiNumBytesRead ); + */ + + //now we have the data that needs to be converted (keep on converting up, so use "if") + if ( guiCurrentSaveGameVersion < FIRST_SAVEGAME_DATATYPE_CHANGE ) + { + OldSavedSoldierInfo101.CopyOldInventoryToNew(); + *this = OldSavedSoldierInfo101; + //OldSavedSoldierInfo999 = OldSavedSoldierInfo101; + } + //change this when changing the file version again + /* + if ( guiCurrentSaveGameVersion < SECOND_SAVEGAME_DATATYPE_CHANGE ) + { + *this = OldSavedSoldierInfo999; + } + */ + + + //ADB need to make sure we are loading the checksum only if the older version saved it + if (loadChecksum == true) { +#ifdef JA2TESTVERSION + CHAR8 zReason[256]; +#endif + + UINT16 usCheckSum; + FileRead( hFile, &usCheckSum, 2, &uiNumBytesRead ); + if( uiNumBytesRead != 2 ) + { + #ifdef JA2TESTVERSION + sprintf( zReason, "Load SoldierCreateStruct -- EOF while reading usCheckSum. KM" ); + AssertMsg( 0, zReason ); + #endif + guiCurrentSaveGameVersion = tempVersion; + return FALSE; + } + //ADB screw checksums, they suck + /* + //verify the checksum equation (anti-hack) -- see save + UINT16 usFileCheckSum = GetChecksum(); + if( usCheckSum != usFileCheckSum ) + { //Hacker has modified the stats on the enemy placements. + #ifdef JA2TESTVERSION + sprintf( zReason, "EnemySoldier -- checksum for placement %d failed. KM", usFileCheckSum ); + AssertMsg( 0, zReason ); + #endif + guiCurrentSaveGameVersion = tempVersion; + return FALSE; + } + */ + } + } + + guiCurrentSaveGameVersion = tempVersion; + return TRUE; +} + +// Changed by ADB, rev 1513 +//BOOLEAN MERCPROFILESTRUCT::Load(HWFILE hFile, bool forceLoadOldVersion) +BOOLEAN MERCPROFILESTRUCT::Load(HWFILE hFile, bool forceLoadOldVersion, bool forceLoadOldEncryption, bool wasSavedWithEncryption) +{ + UINT32 uiNumBytesRead; + this->initialize(); + + //if we are at the most current version, then fine + if ( guiCurrentSaveGameVersion >= CURRENT_SAVEGAME_DATATYPE_VERSION && forceLoadOldVersion == false) + { + if ( !FileRead( hFile, this, SIZEOF_MERCPROFILESTRUCT_POD, &uiNumBytesRead ) ) + { + return(FALSE); + } + int size; + if ( !FileRead( hFile, &size, sizeof(int), &uiNumBytesRead ) ) + { + return(FALSE); + } + inv.resize(size); + bInvStatus.resize(size); + bInvNumber.resize(size); + int item; + int status; + int number; + for (int x = 0; x < size; ++x) { + if ( !FileRead( hFile, &item, sizeof(int), &uiNumBytesRead ) ) + { + return(FALSE); + } + if ( !FileRead( hFile, &status, sizeof(int), &uiNumBytesRead ) ) + { + return(FALSE); + } + if ( !FileRead( hFile, &number, sizeof(int), &uiNumBytesRead ) ) + { + return(FALSE); + } + inv[x] = item; + bInvStatus[x] = status; + bInvNumber[x] = number; + } + if ( this->uiProfileChecksum != this->GetChecksum() ) + { + return( FALSE ); + } + } + else + { + //we are loading an older version (only load once, so use "else if") + //first load the data based on what version was stored + if ( guiCurrentSaveGameVersion < FIRST_SAVEGAME_DATATYPE_CHANGE || forceLoadOldVersion == true) + { + OLD_MERCPROFILESTRUCT_101 old; + typedef BOOLEAN (*functionPtr) ( HWFILE hFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead ); + functionPtr pLoadingFunction; + // Changed by ADB, rev 1513 + //if ( guiCurrentSaveGameVersion < 87 || forceLoadOldVersion == true) + if (wasSavedWithEncryption == false) { + pLoadingFunction = &FileRead; + } + else if ( guiCurrentSaveGameVersion < 87 || forceLoadOldEncryption == true) + { + pLoadingFunction = &JA2EncryptedFileRead; + } + else + { + pLoadingFunction = &NewJA2EncryptedFileRead; + } + + if ( !(*pLoadingFunction)( hFile, &old, SIZEOF_OLD_MERCPROFILESTRUCT_101_POD, &uiNumBytesRead ) ) + { + return(FALSE); + } + *this = old; + } + //skip checksum + } + return TRUE; +} + +BOOLEAN MERCPROFILESTRUCT::Save(HWFILE hFile) +{ + //for now the MERCPROFILESTRUCT remains unchanged + //it does not have any data types that need their own saving function + //if that ever changes this will make updating saves easier + UINT32 uiNumBytesWritten; + this->uiProfileChecksum = this->GetChecksum(); + if ( !FileWrite( hFile, this, SIZEOF_MERCPROFILESTRUCT_POD, &uiNumBytesWritten ) ) + { + return(FALSE); + } + int size = inv.size(); + if ( !FileWrite( hFile, &size, sizeof(int), &uiNumBytesWritten ) ) + { + return(FALSE); + } + for (int x = 0; x < size; ++x) { + int item = inv[x]; + int status = bInvStatus[x]; + int number = bInvNumber[x]; + if ( !FileWrite( hFile, &item, sizeof(int), &uiNumBytesWritten ) ) + { + return(FALSE); + } + if ( !FileWrite( hFile, &status, sizeof(int), &uiNumBytesWritten ) ) + { + return(FALSE); + } + if ( !FileWrite( hFile, &number, sizeof(int), &uiNumBytesWritten ) ) + { + return(FALSE); + } + } + return TRUE; +} + +BOOLEAN SOLDIERTYPE::Save(HWFILE hFile) +{ + UINT32 uiNumBytesWritten; + // calculate checksum for soldier + this->uiMercChecksum = this->GetChecksum(); + if ( !FileWrite( hFile, this, SIZEOF_SOLDIERTYPE_POD, &uiNumBytesWritten ) ) + { + return(FALSE); + } + + //save OO data like inventory + if ( !this->inv.Save(hFile, FALSE) ) + { + return(FALSE); + } + + if ( !FileWrite( hFile, &this->aiData, sizeof(STRUCT_AIData), &uiNumBytesWritten ) ) + { + return(FALSE); + } + if ( !FileWrite( hFile, &this->flags, sizeof(STRUCT_Flags), &uiNumBytesWritten ) ) + { + return(FALSE); + } + if ( !FileWrite( hFile, &this->timeChanges, sizeof(STRUCT_TimeChanges), &uiNumBytesWritten ) ) + { + return(FALSE); + } + if ( !FileWrite( hFile, &this->timeCounters, sizeof(STRUCT_TimeCounters), &uiNumBytesWritten ) ) + { + return(FALSE); + } + if ( !FileWrite( hFile, &this->drugs, sizeof(STRUCT_Drugs), &uiNumBytesWritten ) ) + { + return(FALSE); + } + if ( !FileWrite( hFile, &this->stats, sizeof(STRUCT_Statistics), &uiNumBytesWritten ) ) + { + return(FALSE); + } + if ( !FileWrite( hFile, &this->pathing, sizeof(STRUCT_Pathing), &uiNumBytesWritten ) ) + { + return(FALSE); + } + return TRUE; +} + +BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) +{ + UINT32 uiNumBytesRead; + + //if we are at the most current version, then fine + if ( guiCurrentSaveGameVersion >= CURRENT_SAVEGAME_DATATYPE_VERSION ) + { + //the soldier type info has changed at version 102 + //first, load the POD + if ( !FileRead( hFile, this, SIZEOF_SOLDIERTYPE_POD, &uiNumBytesRead ) ) + { + return(FALSE); + } + + //load the OO inventory + if ( !this->inv.Load(hFile) ) + { + return(FALSE); + } + + //load some structs, atm just POD but could change + if ( !FileRead( hFile, &this->aiData, sizeof(STRUCT_AIData), &uiNumBytesRead ) ) + { + return(FALSE); + } + if ( !FileRead( hFile, &this->flags, sizeof(STRUCT_Flags), &uiNumBytesRead ) ) + { + return(FALSE); + } + if ( !FileRead( hFile, &this->timeChanges, sizeof(STRUCT_TimeChanges), &uiNumBytesRead ) ) + { + return(FALSE); + } + if ( !FileRead( hFile, &this->timeCounters, sizeof(STRUCT_TimeCounters), &uiNumBytesRead ) ) + { + return(FALSE); + } + if ( !FileRead( hFile, &this->drugs, sizeof(STRUCT_Drugs), &uiNumBytesRead ) ) + { + return(FALSE); + } + if ( !FileRead( hFile, &this->stats, sizeof(STRUCT_Statistics), &uiNumBytesRead ) ) + { + return(FALSE); + } + if ( !FileRead( hFile, &this->pathing, sizeof(STRUCT_Pathing), &uiNumBytesRead ) ) + { + return(FALSE); + } + // check checksum + if ( this->GetChecksum() != this->uiMercChecksum ) + { + return( FALSE ); + } + } + else + { + OLDSOLDIERTYPE_101 OldSavedSoldierInfo101; + //we are loading an older version (only load once, so use "else if") + //first load the data based on what version was stored + typedef BOOLEAN (*functionPtr) ( HWFILE hFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead ); + functionPtr pLoadingFunction; + if ( guiCurrentSaveGameVersion < 87 ) + { + pLoadingFunction = &JA2EncryptedFileRead; + } + else + { + pLoadingFunction = &NewJA2EncryptedFileRead; + } + + if ( guiCurrentSaveGameVersion < FIRST_SAVEGAME_DATATYPE_CHANGE ) + { + OldSavedSoldierInfo101.initialize(); + if ( !(*pLoadingFunction)( hFile, &OldSavedSoldierInfo101, SIZEOF_OLDSOLDIERTYPE_101_POD, &uiNumBytesRead ) ) + { + return(FALSE); + } + } + /* + else if ( guiCurrentSaveGameVersion < SECOND_SAVEGAME_DATATYPE_CHANGE ) + OldSavedSoldierInfo999.initialize(); + (*pLoadingFunction)( hFile, &OldSavedSoldierInfo999, SIZEOF_OLDSOLDIERTYPE_999_POD, &uiNumBytesRead ); + */ + + //now we have the data that needs to be converted (keep on converting up, so use "if") + if ( guiCurrentSaveGameVersion < FIRST_SAVEGAME_DATATYPE_CHANGE ) + { + OldSavedSoldierInfo101.CopyOldInventoryToNew(); + (*this) = OldSavedSoldierInfo101; + //OldSavedSoldierInfo999 = OldSavedSoldierInfo101; + } + //change this when changing the file version again + /* + if ( guiCurrentSaveGameVersion < SECOND_SAVEGAME_DATATYPE_CHANGE ) + { + *this = OldSavedSoldierInfo999; + } + */ + //assume checksum is ok + } + return TRUE; +} + +BOOLEAN WORLDITEM::Save(HWFILE hFile, bool fSavingMap) +{ + //save the POD + UINT32 uiNumBytesWritten; + if ( !FileWrite( hFile, this, SIZEOF_WORLDITEM_POD, &uiNumBytesWritten ) ) + { + return(FALSE); + } + + //save the OO OBJECTTYPE + if ( !this->object.Save(hFile, fSavingMap) ) + { + return FALSE; + } + return TRUE; +} + +BOOLEAN WORLDITEM::Load(INT8** hBuffer, float dMajorMapVersion, UINT8 ubMinorMapVersion) +{ + //if we are at the most current MAP version, 5.0 and 27, then fine + if (dMajorMapVersion >= 6.0 && ubMinorMapVersion > 26 ) + { + //load the POD + LOADDATA( this, *hBuffer, SIZEOF_WORLDITEM_POD ); + + //now load the OO OBJECTTYPE + this->object.Load(hBuffer, dMajorMapVersion, ubMinorMapVersion); + } + //if we need to load an older save + else { + //load the old data into a suitable structure, it's just POD + OLD_WORLDITEM_101 oldWorldItem; + LOADDATA( &oldWorldItem, *hBuffer, sizeof( OLD_WORLDITEM_101 ) ); + *this = oldWorldItem; + } + return TRUE; +} + +BOOLEAN WORLDITEM::Load(HWFILE hFile) +{ + UINT32 uiNumBytesRead; + //if we are at the most current version, then fine + if ( guiCurrentSaveGameVersion >= CURRENT_SAVEGAME_DATATYPE_VERSION ) + { + //load the POD + if ( !FileRead( hFile, this, SIZEOF_WORLDITEM_POD, &uiNumBytesRead ) ) + { + return(FALSE); + } + + //now load the OO OBJECTTYPE + if ( !this->object.Load(hFile) ) + { + return FALSE; + } + } + //if we need to load an older save + else { + //load the old data into a suitable structure, it's just POD + OLD_WORLDITEM_101 oldWorldItem; + if ( guiCurrentSaveGameVersion < FIRST_SAVEGAME_DATATYPE_CHANGE ) + { + if ( !FileRead( hFile, &oldWorldItem, sizeof(OLD_WORLDITEM_101), &uiNumBytesRead ) ) + { + return(FALSE); + } + } + + //now we have the data that needs to be converted (keep on converting up, so use "if") + //the first conversion is simple enough that it can be done here + if ( guiCurrentSaveGameVersion < FIRST_SAVEGAME_DATATYPE_CHANGE ) + { + *this = oldWorldItem; + } + } + return TRUE; +} + +BOOLEAN StackedObjectData::Load( INT8** hBuffer, float dMajorMapVersion, UINT8 ubMinorMapVersion ) +{ + //when this function is called, the file has been loaded into a buffer using FileRead + //if we are at the most current version, then fine + //but we can also be loading this from a map that is up to date when the savegame isn't! + if ( guiCurrentSaveGameVersion >= CURRENT_SAVEGAME_DATATYPE_VERSION + || (dMajorMapVersion == gdMajorMapVersion && gubMinorMapVersion == ubMinorMapVersion)) + { + int size; + LOADDATA(&(this->data), *hBuffer, sizeof(ObjectData) ); + LOADDATA(&size, *hBuffer, sizeof(int) ); + attachments.resize(size); + for (attachmentList::iterator iter = attachments.begin(); iter != attachments.end(); ++iter) { + if (! iter->Load( hBuffer, dMajorMapVersion, ubMinorMapVersion ) ) { + return FALSE; + } + } + } + else { + //we shouldn't be loading this + Assert(false); + } + return TRUE; +} + +BOOLEAN StackedObjectData::Load( HWFILE hFile ) +{ + UINT32 uiNumBytesRead; + //if we are at the most current version, then fine + if ( guiCurrentSaveGameVersion >= CURRENT_SAVEGAME_DATATYPE_VERSION ) + { + if ( !FileRead( hFile, &(this->data), sizeof(ObjectData), &uiNumBytesRead ) ) + { + return(FALSE); + } + int size; + if ( !FileRead( hFile, &size, sizeof(int), &uiNumBytesRead ) ) + { + return(FALSE); + } + attachments.resize(size); + for (attachmentList::iterator iter = attachments.begin(); iter != attachments.end(); ++iter) { + if (! iter->Load(hFile) ) { + return FALSE; + } + } + } + else { + //we shouldn't be loading this + Assert(false); + } + return TRUE; +} +BOOLEAN StackedObjectData::Save( HWFILE hFile, bool fSavingMap ) +{ + //if we are saving this to a map file it will be loaded with FileRead + UINT32 uiNumBytesWritten; + int size = 0; + for (attachmentList::iterator iter = attachments.begin(); iter != attachments.end(); ++iter) { + if (iter->exists() == true) { + ++size; + } + else { + //attachments should always exist, if they didn't they should have been removed from the list + DebugBreakpoint(); + } + } + + if ( !FileWrite( hFile, &(this->data), sizeof(ObjectData), &uiNumBytesWritten ) ) + { + return(FALSE); + } + if ( !FileWrite( hFile, &size, sizeof(int), &uiNumBytesWritten ) ) + { + return(FALSE); + } + for (attachmentList::iterator iter = attachments.begin(); iter != attachments.end(); ++iter) { + if (iter->exists() == true) { + if (! iter->Save(hFile, fSavingMap)) { + return FALSE; + } + } + } + return TRUE; +} + +BOOLEAN OBJECTTYPE::Load( HWFILE hFile ) +{ + + UINT32 uiNumBytesRead; + //if we are at the most current version, then fine + if ( guiCurrentSaveGameVersion >= CURRENT_SAVEGAME_DATATYPE_VERSION ) + { + if ( !FileRead( hFile, this, SIZEOF_OBJECTTYPE_POD, &uiNumBytesRead ) ) + { + return(FALSE); + } + int size; + if ( !FileRead( hFile, &size, sizeof(int), &uiNumBytesRead ) ) + { + return(FALSE); + } + + objectStack.resize(size); + int x = 0; + for (StackedObjects::iterator iter = objectStack.begin(); iter != objectStack.end(); ++iter, ++x) { + if (! iter->Load(hFile)) { + return FALSE; + } + if (this->IsActiveLBE(x) == true) { + LBEArray.push_back(LBENODE()); + if (! LBEArray.back().Load(hFile)) { + return FALSE; + } + } + } + } + else + { + OLD_OBJECTTYPE_101 OldSavedObject101; + //we are loading an older version (only load once, so use "else if") + //first load the data based on what version was stored + if ( guiCurrentSaveGameVersion < FIRST_SAVEGAME_DATATYPE_CHANGE ) + { + if ( !FileRead( hFile, &OldSavedObject101, sizeof(OLD_OBJECTTYPE_101), &uiNumBytesRead ) ) + { + return(FALSE); + } + } + /* + else if ( guiCurrentSaveGameVersion < SECOND_SAVEGAME_DATATYPE_CHANGE ) + (*pLoadingFunction)( hFile, &OldSavedObject999, sizeof(OLD_OBJECTTYPE_999), &uiNumBytesRead ); + */ + + //now we have the data that needs to be converted (keep on converting up, so use "if") + if ( guiCurrentSaveGameVersion < FIRST_SAVEGAME_DATATYPE_CHANGE ) + { + (*this) = OldSavedObject101; + //OldSavedObject999 = OldSavedObject101; + } + //change this when changing the file version again + /* + if ( guiCurrentSaveGameVersion < SECOND_SAVEGAME_DATATYPE_CHANGE ) + { + (*this) = OldSavedObject999; + } + */ + } + return TRUE; +} + +BOOLEAN OBJECTTYPE::Load( INT8** hBuffer, float dMajorMapVersion, UINT8 ubMinorMapVersion ) +{ + //when this function is called, the file has been loaded into a buffer using FileRead + //if we are at the most current MAP version, 6.27, then fine + if (dMajorMapVersion >= 6.0 && ubMinorMapVersion > 26 ) + { + int size; + LOADDATA(this, *hBuffer, SIZEOF_OBJECTTYPE_POD ); + LOADDATA(&size, *hBuffer, sizeof(int) ); + objectStack.resize(size); + int x = 0; + for (StackedObjects::iterator iter = objectStack.begin(); iter != objectStack.end(); ++iter, ++x) { + iter->Load(hBuffer, dMajorMapVersion, ubMinorMapVersion); + if (this->IsActiveLBE(x) == true) { + LBEArray.push_back(LBENODE()); + if (! LBEArray.back().Load(hBuffer, dMajorMapVersion, ubMinorMapVersion)) { + return FALSE; + } + } + } + } + else + { + OLD_OBJECTTYPE_101 OldSavedObject101; + LOADDATA( &OldSavedObject101, *hBuffer, sizeof(OLD_OBJECTTYPE_101) ); + (*this) = OldSavedObject101; + } + return TRUE; +} + +BOOLEAN OBJECTTYPE::Save( HWFILE hFile, bool fSavingMap ) +{ + //if we are saving this to a map file it will be loaded with FileRead + UINT32 uiNumBytesWritten; + int size = objectStack.size(); + if ( !FileWrite( hFile, this, SIZEOF_OBJECTTYPE_POD, &uiNumBytesWritten ) ) + { + return(FALSE); + } + if ( !FileWrite( hFile, &size, sizeof(int), &uiNumBytesWritten ) ) + { + return(FALSE); + } + int x = 0; + for (StackedObjects::iterator iter = objectStack.begin(); iter != objectStack.end(); ++iter, ++x) { + if (! iter->Save(hFile, fSavingMap)) { + return FALSE; + } + if (this->IsActiveLBE(x) == true) { + LBENODE* pLBE = this->GetLBEPointer(x); + if (! pLBE->Save(hFile, fSavingMap)) { + return FALSE; + } + //CHRISL: I've remarked this to resolve a problem when the autosave option is active where LBEArray info is + // lost and not rebuilt until after combat is over. This may not be the best way to resolve this, though, + // as ADB may well have had a valid reason to erase the LBEArray during saves. +/* + int uniqueID = (*this)[x]->data.lbe.uniqueID; + for (std::list::iterator iter = LBEArray.begin(); iter != LBEArray.end(); ++iter) { + if (iter->uniqueID == uniqueID) { + LBEArray.erase(iter); + break; + } + } +*/ + } + } + return TRUE; +} + +BOOLEAN Inventory::Load( HWFILE hFile ) +{ + + UINT32 uiNumBytesRead; + int sizeInventory;//how many items are in the stack? + if ( !FileRead( hFile, &sizeInventory, sizeof(int), &uiNumBytesRead ) ) + { + return FALSE; + } + + if (sizeInventory < 0 || sizeInventory > NUM_INV_SLOTS) + { + return(FALSE); + } + + inv.resize(sizeInventory); + bNewItemCount.resize(sizeInventory); + bNewItemCycleCount.resize(sizeInventory); + for (int x = 0; x < sizeInventory; ++x) { + //load the OO OBJECTTYPE + if ( !inv[x].Load(hFile) ) + { + return FALSE; + } + + UINT32 uiNumBytesRead; + if ( !FileRead( hFile, &bNewItemCount[x], sizeof(int), &uiNumBytesRead ) ) + { + return(FALSE); + } + if ( !FileRead( hFile, &bNewItemCycleCount[x], sizeof(int), &uiNumBytesRead ) ) + { + return(FALSE); + } + } + return (TRUE); +} + +BOOLEAN Inventory::Load(INT8** hBuffer, float dMajorMapVersion, UINT8 ubMinorMapVersion) +{ + int sizeInventory; + LOADDATA(&sizeInventory, *hBuffer, sizeof(int) ); + if (sizeInventory < 0 || sizeInventory > NUM_INV_SLOTS) + { + return(FALSE); + } + + inv.resize(sizeInventory); + bNewItemCount.resize(sizeInventory); + bNewItemCycleCount.resize(sizeInventory); + + for (int x = 0; x < sizeInventory; ++x) { + //load the OO OBJECTTYPE + if ( !inv[x].Load(hBuffer, dMajorMapVersion, ubMinorMapVersion) ) + { + return FALSE; + } + + LOADDATA( &bNewItemCount[x], *hBuffer, sizeof(int) ); + LOADDATA( &bNewItemCycleCount[x], *hBuffer, sizeof(int) ); + } + return TRUE; +} + +BOOLEAN Inventory::Save( HWFILE hFile, bool fSavingMap ) +{ + UINT32 uiNumBytesWritten; + int sizeInventory = size();//how many items are in the stack? + if ( !FileWrite( hFile, &sizeInventory, sizeof(int), &uiNumBytesWritten ) ) + { + return(FALSE); + } + + for (int x = 0; x < sizeInventory; ++x) { + //save the OO OBJECTTYPE + if ( !inv[x].Save(hFile, fSavingMap) ) + { + return (FALSE); + } + + if ( !FileWrite( hFile, &(bNewItemCount[x]), sizeof(int), &uiNumBytesWritten ) ) + { + return(FALSE); + } + if ( !FileWrite( hFile, &(bNewItemCycleCount[x]), sizeof(int), &uiNumBytesWritten ) ) + { + return(FALSE); + } + } + return TRUE; +} // Snap: Initializes gSaveDir global, creating the save directory if necessary // The save directory now resides in the data directory (default or custom) @@ -490,11 +1790,11 @@ BOOLEAN InitSaveDir() // The locale-specific save dir location is of the form L"..\\SavedGames" // This has not changed; instead, we strip the ".." at the beginning - sprintf( gSaveDir, "%s%S", dataDir.c_str(), pMessageStrings[ MSG_SAVEDIRECTORY ] + 2 ); + sprintf( gSaveDir, "%s%S", dataDir.c_str(), pMessageStrings[ MSG_SAVEDIRECTORY ] + 2 ); // This was moved here from SaveGame //Check to see if the save directory exists - if( FileGetAttributes( (STR) gSaveDir ) == 0xFFFFFFFF ) + if( FileGetAttributes( (STR) gSaveDir ) == 0xFFFFFFFF ) { //ok the direcotry doesnt exist, create it if( !MakeFileManDirectory( (CHAR8 *)gSaveDir ) ) @@ -513,7 +1813,6 @@ BOOLEAN SaveGame( UINT8 ubSaveGameID, STR16 pGameDesc ) HWFILE hFile=0; SAVED_GAME_HEADER SaveGameHeader; CHAR8 zSaveGameName[ MAX_PATH ]; - //UINT32 uiSizeOfGeneralInfo = sizeof( GENERAL_SAVE_INFO ); //UINT8 saveDir[100]; BOOLEAN fPausedStateBeforeSaving = gfGamePaused; BOOLEAN fLockPauseStateBeforeSaving = gfLockPauseState; @@ -522,12 +1821,12 @@ BOOLEAN SaveGame( UINT8 ubSaveGameID, STR16 pGameDesc ) BOOLEAN fWePausedIt = FALSE; - //sprintf( saveDir, "%S", pMessageStrings[ MSG_SAVEDIRECTORY ] ); + //sprintf( saveDir, "%S", pMessageStrings[ MSG_SAVEDIRECTORY ] ); #ifdef JA2BETAVERSION #ifndef CRIPPLED_VERSION - //AssertMsg( uiSizeOfGeneralInfo == 1024, String( "Saved General info is NOT 1024, it is %d. DF 1.", uiSizeOfGeneralInfo ) ); - //AssertMsg( sizeof( LaptopSaveInfoStruct ) == 7440, String( "LaptopSaveStruct is NOT 7440, it is %d. DF 1.", sizeof( LaptopSaveInfoStruct ) ) ); + //AssertMsg( uiSizeOfGeneralInfo == 1024, String( "Saved General info is NOT 1024, it is %d. DF 1.", uiSizeOfGeneralInfo ) ); + //AssertMsg( sizeof( LaptopSaveInfoStruct ) == 7440, String( "LaptopSaveStruct is NOT 7440, it is %d. DF 1.", sizeof( LaptopSaveInfoStruct ) ) ); #endif #endif @@ -554,7 +1853,7 @@ BOOLEAN SaveGame( UINT8 ubSaveGameID, STR16 pGameDesc ) usPosX = ( SCREEN_WIDTH - usActualWidth ) / 2 ; RenderMercPopUpBoxFromIndex( iSaveLoadGameMessageBoxID, usPosX, iScreenHeightOffset + 160, FRAME_BUFFER ); - + InvalidateRegion(0,0,SCREEN_WIDTH,SCREEN_HEIGHT); ExecuteBaseDirtyRectQueue( ); @@ -602,6 +1901,59 @@ BOOLEAN SaveGame( UINT8 ubSaveGameID, STR16 pGameDesc ) gTacticalStatus.uiFlags |= LOADING_SAVED_GAME; + //ADB this has been moved ahead of SaveCurrentSectorsInformationToTempItemFile + //there was a problem loading savegames if the savegame version changed, because + //the encryption algorithm uses the version of the header + // + // Setup the save game header + // + + SaveGameHeader.uiSavedGameVersion = SAVE_GAME_VERSION; + wcscpy( SaveGameHeader.sSavedGameDesc, pGameDesc ); + strcpy( SaveGameHeader.zGameVersionNumber, czVersionNumber ); + + SaveGameHeader.uiFlags; + + //The following will be used to quickly access info to display in the save/load screen + SaveGameHeader.uiDay = GetWorldDay(); + SaveGameHeader.ubHour = (UINT8)GetWorldHour(); + SaveGameHeader.ubMin = (UINT8)guiMin; + + //copy over the initial game options + memcpy( &SaveGameHeader.sInitialGameOptions, &gGameOptions, sizeof( GAME_OPTIONS ) ); + + + SaveGameHeader.ubNumOfMercsOnPlayersTeam = NumberOfMercsOnPlayerTeam(); + SaveGameHeader.iCurrentBalance = LaptopSaveInfo.iCurrentBalance; + + + SaveGameHeader.uiCurrentScreen = guiPreviousOptionScreen; + + SaveGameHeader.fAlternateSector = GetSectorFlagStatus( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, SF_USE_ALTERNATE_MAP ); + + if( gfWorldLoaded ) + { + SaveGameHeader.fWorldLoaded = TRUE; + SaveGameHeader.ubLoadScreenID = GetLoadScreenID( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); + } + else + { + SaveGameHeader.fWorldLoaded = FALSE; + SaveGameHeader.ubLoadScreenID = 0; + } + + SaveGameHeader.uiRandom = Random( RAND_MAX ); + + // CHRISL: We need to know what inventory system we're using early on + SaveGameHeader.ubInventorySystem = gGameOptions.ubInventorySystem; + + // + // Save the Save Game header file + // + guiJA2EncryptionSet = CalcJA2EncryptionSet( &SaveGameHeader ); + + + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("starting SaveCurrentSectorsInformationToTempItemFile" ) ); //Save the current sectors open temp files to the disk if( !SaveCurrentSectorsInformationToTempItemFile() ) { @@ -609,6 +1961,8 @@ BOOLEAN SaveGame( UINT8 ubSaveGameID, STR16 pGameDesc ) goto FAILED_TO_SAVE; } + + //if we are saving the quick save, if( ubSaveGameID == 0 ) { @@ -621,6 +1975,7 @@ BOOLEAN SaveGame( UINT8 ubSaveGameID, STR16 pGameDesc ) else #endif swprintf( pGameDesc, pMessageStrings[ MSG_QUICKSAVE_NAME ] ); + wcscpy(SaveGameHeader.sSavedGameDesc, pGameDesc); } //If there was no string, add one @@ -628,7 +1983,7 @@ BOOLEAN SaveGame( UINT8 ubSaveGameID, STR16 pGameDesc ) wcscpy( pGameDesc, pMessageStrings[ MSG_NODESC ] ); //Check to see if the save directory exists - /*if( FileGetAttributes( (STR) saveDir ) == 0xFFFFFFFF ) + /*if( FileGetAttributes( (STR) saveDir ) == 0xFFFFFFFF ) { //ok the direcotry doesnt exist, create it if( !MakeFileManDirectory( (CHAR8 *)saveDir ) ) @@ -679,24 +2034,6 @@ BOOLEAN SaveGame( UINT8 ubSaveGameID, STR16 pGameDesc ) - // - // Setup the save game header - // - - SaveGameHeader.uiSavedGameVersion = guiSavedGameVersion; - wcscpy( SaveGameHeader.sSavedGameDesc, pGameDesc ); - strcpy( SaveGameHeader.zGameVersionNumber, czVersionNumber ); - - SaveGameHeader.uiFlags; - - //The following will be used to quickly access info to display in the save/load screen - SaveGameHeader.uiDay = GetWorldDay(); - SaveGameHeader.ubHour = (UINT8)GetWorldHour(); - SaveGameHeader.ubMin = (UINT8)guiMin; - - //copy over the initial game options - memcpy( &SaveGameHeader.sInitialGameOptions, &gGameOptions, sizeof( GAME_OPTIONS ) ); - //Get the sector value to save. GetBestPossibleSectorXYZValues( &SaveGameHeader.sSectorX, &SaveGameHeader.sSectorY, &SaveGameHeader.bSectorZ ); @@ -734,7 +2071,7 @@ BOOLEAN SaveGame( UINT8 ubSaveGameID, STR16 pGameDesc ) { if( pSoldier->bActive ) { - if ( pSoldier->bAssignment != IN_TRANSIT && !pSoldier->fBetweenSectors) + if ( pSoldier->bAssignment != IN_TRANSIT && !pSoldier->flags.fBetweenSectors) { SaveGameHeader.sSectorX = pSoldier->sSectorX; SaveGameHeader.sSectorY = pSoldier->sSectorY; @@ -754,30 +2091,6 @@ BOOLEAN SaveGame( UINT8 ubSaveGameID, STR16 pGameDesc ) } */ - SaveGameHeader.ubNumOfMercsOnPlayersTeam = NumberOfMercsOnPlayerTeam(); - SaveGameHeader.iCurrentBalance = LaptopSaveInfo.iCurrentBalance; - - - SaveGameHeader.uiCurrentScreen = guiPreviousOptionScreen; - - SaveGameHeader.fAlternateSector = GetSectorFlagStatus( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, SF_USE_ALTERNATE_MAP ); - - if( gfWorldLoaded ) - { - SaveGameHeader.fWorldLoaded = TRUE; - SaveGameHeader.ubLoadScreenID = GetLoadScreenID( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); - } - else - { - SaveGameHeader.fWorldLoaded = FALSE; - SaveGameHeader.ubLoadScreenID = 0; - } - - SaveGameHeader.uiRandom = Random( RAND_MAX ); - - // - // Save the Save Game header file - // FileWrite( hFile, &SaveGameHeader, sizeof( SAVED_GAME_HEADER ), &uiNumBytesWritten ); @@ -791,7 +2104,8 @@ BOOLEAN SaveGame( UINT8 ubSaveGameID, STR16 pGameDesc ) SaveGameFilePosition( FileGetPos( hFile ), "Save Game Header" ); #endif - guiJA2EncryptionSet = CalcJA2EncryptionSet( &SaveGameHeader ); + + // //Save the gTactical Status array, plus the curent secotr location @@ -1343,8 +2657,7 @@ BOOLEAN SaveGame( UINT8 ubSaveGameID, STR16 pGameDesc ) SaveGameFilePosition( FileGetPos( hFile ), "New way of saving Bobby R mailorders" ); #endif - - //sss + //Close the saved game file FileClose( hFile ); @@ -1416,7 +2729,7 @@ FAILED_TO_SAVE: //Delete the failed attempt at saving #if 0 - // 0verhaul: Temporarily disabled to try to troubleshoot save game problems + // 0verhaul: Temporarily disabled to try to troubleshoot save game problems DeleteSaveGameNumber( ubSaveGameID ); #endif @@ -1437,12 +2750,17 @@ FAILED_TO_SAVE: } #endif + Assert(guiCurrentSaveGameVersion == SAVE_GAME_VERSION); + guiCurrentSaveGameVersion = SAVE_GAME_VERSION; + return( FALSE ); } UINT32 guiBrokenSaveGameVersion = 0; +extern int gEnemyPreservedTempFileVersion[256]; +extern int gCivPreservedTempFileVersion[256]; BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) { @@ -1454,8 +2772,6 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) INT16 sLoadSectorY; INT8 bLoadSectorZ; CHAR8 zSaveGameName[ MAX_PATH ]; - //UINT32 uiSizeOfGeneralInfo = sizeof( GENERAL_SAVE_INFO ); - UINT32 uiRelStartPerc; UINT32 uiRelEndPerc; @@ -1465,7 +2781,7 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) uiRelStartPerc = uiRelEndPerc =0; - TrashAllSoldiers( ); + TrashAllSoldiers( ); //Empty the dialogue Queue cause someone could still have a quote in waiting EmptyDialogueQueue( ); @@ -1473,13 +2789,16 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) //If there is someone talking, stop them StopAnyCurrentlyTalkingSpeech( ); - ZeroAnimSurfaceCounts( ); + ZeroAnimSurfaceCounts( ); ShutdownNPCQuotes(); + //very small TODO + //Bugfix = Stop the chopter sound + #ifdef JA2BETAVERSION - //AssertMsg( uiSizeOfGeneralInfo == 1024, String( "Saved General info is NOT 1024, it is %d. DF 1.", uiSizeOfGeneralInfo ) ); + //AssertMsg( uiSizeOfGeneralInfo == 1024, String( "Saved General info is NOT 1024, it is %d. DF 1.", uiSizeOfGeneralInfo ) ); #endif //is it a valid save number @@ -1511,13 +2830,13 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) //Set the fact that we are loading a saved game gTacticalStatus.uiFlags |= LOADING_SAVED_GAME; - //Trash the existing world. This is done to ensure that if we are loading a game that doesn't have + //Trash the existing world. This is done to ensure that if we are loading a game that doesn't have //a world loaded, that we trash it beforehand -- else the player could theoretically enter that sector - //where it would be in a pre-load state. + //where it would be in a pre-load state. TrashWorld(); // Lesh: To kill memory leaks during re-loading a saved game - // release strategic layer resources + // release strategic layer resources ShutdownStrategicLayer(); FreeGlobalMessageList(); @@ -1534,8 +2853,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) hFile = FileOpen( zSaveGameName, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); if( !hFile ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("FileOpen failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } @@ -1548,6 +2867,7 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) FileRead( hFile, &SaveGameHeader, sizeof( SAVED_GAME_HEADER ), &uiNumBytesRead ); if( uiNumBytesRead != sizeof( SAVED_GAME_HEADER ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Loading Save Game Header failed" ) ); FileClose( hFile ); return(FALSE); } @@ -1556,26 +2876,47 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) #endif guiJA2EncryptionSet = CalcJA2EncryptionSet( &SaveGameHeader ); - + guiCurrentSaveGameVersion = SaveGameHeader.uiSavedGameVersion; guiBrokenSaveGameVersion = SaveGameHeader.uiSavedGameVersion; + // CHRISL: We need to know what inventory system we're using early on + if(SaveGameHeader.uiSavedGameVersion < FIRST_SAVEGAME_DATATYPE_CHANGE) + SaveGameHeader.ubInventorySystem = 0; + gGameOptions.ubInventorySystem = SaveGameHeader.ubInventorySystem; + if((UsingNewInventorySystem() == true)) + { + if(iResolution == 0){ + // Only load NewInv in higher screen res + FileClose( hFile ); + return(FALSE); + } + InitInventoryNew(); + InitNewInventorySystem(); + InitializeSMPanelCoordsNew(); + InitializeInvPanelCoordsNew(); + } + else + { + InitInventoryOld(); + InitOldInventorySystem(); + InitializeSMPanelCoordsOld(); + InitializeInvPanelCoordsOld(); + } + //if the player is loading up an older version of the game, and the person DOESNT have the cheats on, - if( SaveGameHeader.uiSavedGameVersion < 65 && !CHEATER_CHEAT_LEVEL( ) ) + if( guiCurrentSaveGameVersion < 65 && !CHEATER_CHEAT_LEVEL( ) ) { #ifdef JA2BETAVERSION gfDisplaySaveGamesNowInvalidatedMsg = TRUE; #endif //Fail loading the save FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } //Store the loading screenID that was saved gubLastLoadingScreenID = SaveGameHeader.ubLoadScreenID; - //HACK - guiSaveGameVersion = SaveGameHeader.uiSavedGameVersion; /* if( !LoadGeneralInfo( hFile ) ) @@ -1593,8 +2934,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) //Load the gtactical status structure plus the current sector x,y,z if( !LoadTacticalStatusFromSavedGame( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadTacticalStatusFromSavedGame failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } #ifdef JA2BETAVERSION @@ -1609,8 +2950,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) //Load the game clock ingo if( !LoadGameClock( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadGameClock failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } #ifdef JA2BETAVERSION @@ -1626,14 +2967,19 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) } + for (int x = 0; x < 256; ++x) { + gEnemyPreservedTempFileVersion[x] = guiCurrentSaveGameVersion; + gCivPreservedTempFileVersion[x] = guiCurrentSaveGameVersion; + } + //if the world was loaded when saved, reload it, otherwise dont - if( SaveGameHeader.fWorldLoaded || SaveGameHeader.uiSavedGameVersion < 50 ) + if( SaveGameHeader.fWorldLoaded || guiCurrentSaveGameVersion < 50 ) { //Get the current world sector coordinates sLoadSectorX = gWorldSectorX; sLoadSectorY = gWorldSectorY; bLoadSectorZ = gbWorldSectorZ; - + // This will guarantee that the sector will be loaded gbWorldSectorZ = -1; @@ -1686,8 +3032,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) //load the game events if( !LoadStrategicEventsFromSavedGame( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadStrategicEventsFromSavedGame failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } #ifdef JA2BETAVERSION @@ -1704,8 +3050,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) if( !LoadLaptopInfoFromSavedGame( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadLaptopInfoFromSavedGame failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } #ifdef JA2BETAVERSION @@ -1724,8 +3070,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) // if( !LoadSavedMercProfiles( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadSavedMercProfiles failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } @@ -1745,8 +3091,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) // if( !LoadSoldierStructure( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadSoldierStructure failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } #ifdef JA2BETAVERSION @@ -1766,8 +3112,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) // if( !LoadFilesFromSavedGame( FINANCES_DATA_FILE, hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadFilesFromSavedGame FINANCES_DATA_FILE failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } #ifdef JA2BETAVERSION @@ -1788,8 +3134,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) // if( !LoadFilesFromSavedGame( HISTORY_DATA_FILE, hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadFilesFromSavedGame HISTORY_DATA_FILE failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } #ifdef JA2BETAVERSION @@ -1810,8 +3156,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) // if( !LoadFilesFromSavedGame( FILES_DAT_FILE, hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadFilesFromSavedGame FILES_DAT_FILE failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } #ifdef JA2BETAVERSION @@ -1829,8 +3175,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) // Load the data for the emails if( !LoadEmailFromSavedGame( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadEmailFromSavedGame failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } #ifdef JA2BETAVERSION @@ -1849,8 +3195,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) //Load the strategic Information if( !LoadStrategicInfoFromSavedFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadStrategicInfoFromSavedFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } #ifdef JA2BETAVERSION @@ -1868,8 +3214,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) //Load the underground information if( !LoadUnderGroundSectorInfoFromSavedGame( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadUnderGroundSectorInfoFromSavedGame failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } #ifdef JA2BETAVERSION @@ -1886,8 +3232,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) // Load all the squad info from the saved game file if( !LoadSquadInfoFromSavedGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadSquadInfoFromSavedGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } #ifdef JA2BETAVERSION @@ -1904,8 +3250,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) //Load the group linked list if( !LoadStrategicMovementGroupsFromSavedGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadStrategicMovementGroupsFromSavedGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } #ifdef JA2BETAVERSION @@ -1921,8 +3267,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) // Load all the map temp files from the saved game file into the maps\temp directory if( !LoadMapTempFilesFromSavedGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadMapTempFilesFromSavedGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } #ifdef JA2BETAVERSION @@ -1940,8 +3286,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) if( !LoadQuestInfoFromSavedGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadQuestInfoFromSavedGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } #ifdef JA2BETAVERSION @@ -1954,11 +3300,11 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) RenderProgressBar( 0, 100 ); uiRelStartPerc = uiRelEndPerc; - + if( !LoadOppListInfoFromSavedGame( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadOppListInfoFromSavedGame failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } #ifdef JA2BETAVERSION @@ -1977,8 +3323,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) if( !LoadMapScreenMessagesFromSaveGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadMapScreenMessagesFromSaveGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } #ifdef JA2BETAVERSION @@ -1994,10 +3340,10 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) - if( !LoadNPCInfoFromSavedGameFile( hFile, SaveGameHeader.uiSavedGameVersion ) ) + if( !LoadNPCInfoFromSavedGameFile( hFile, guiCurrentSaveGameVersion ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadNPCInfoFromSavedGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } #ifdef JA2BETAVERSION @@ -2015,8 +3361,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) if( !LoadKeyTableFromSaveedGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadKeyTableFromSaveedGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } #ifdef JA2BETAVERSION @@ -2033,8 +3379,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) if( !LoadTempNpcQuoteArrayToSaveGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadTempNpcQuoteArrayToSaveGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } #ifdef JA2BETAVERSION @@ -2052,8 +3398,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) if( !LoadPreRandomNumbersFromSaveGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadPreRandomNumbersFromSaveGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } #ifdef JA2BETAVERSION @@ -2072,8 +3418,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) if( !LoadSmokeEffectsFromLoadGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadSmokeEffectsFromLoadGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } #ifdef JA2BETAVERSION @@ -2089,10 +3435,10 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) - if( !LoadArmsDealerInventoryFromSavedGameFile( hFile, ( BOOLEAN )( SaveGameHeader.uiSavedGameVersion >= 54 ), ( BOOLEAN )( SaveGameHeader.uiSavedGameVersion >= 55 ) ) ) + if( !LoadArmsDealerInventoryFromSavedGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadArmsDealerInventoryFromSavedGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } #ifdef JA2BETAVERSION @@ -2108,8 +3454,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) if( !LoadGeneralInfo( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadGeneralInfo failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } #ifdef JA2BETAVERSION @@ -2125,8 +3471,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) if( !LoadMineStatusFromSavedGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadMineStatusFromSavedGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } #ifdef JA2BETAVERSION @@ -2144,12 +3490,12 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) - if( SaveGameHeader.uiSavedGameVersion >= 21 ) + if( guiCurrentSaveGameVersion >= 21 ) { if( !LoadStrategicTownLoyaltyFromSavedGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadStrategicTownLoyaltyFromSavedGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } #ifdef JA2BETAVERSION @@ -2168,12 +3514,12 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) - if( SaveGameHeader.uiSavedGameVersion >= 22 ) + if( guiCurrentSaveGameVersion >= 22 ) { - if( !LoadVehicleInformationFromSavedGameFile( hFile, SaveGameHeader.uiSavedGameVersion ) ) + if( !LoadVehicleInformationFromSavedGameFile( hFile, guiCurrentSaveGameVersion ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadVehicleInformationFromSavedGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } #ifdef JA2BETAVERSION @@ -2190,12 +3536,12 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) - if( SaveGameHeader.uiSavedGameVersion >= 24 ) + if( guiCurrentSaveGameVersion >= 24 ) { if( !LoadBulletStructureFromSavedGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadBulletStructureFromSavedGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } #ifdef JA2BETAVERSION @@ -2214,12 +3560,12 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) - if( SaveGameHeader.uiSavedGameVersion >= 24 ) + if( guiCurrentSaveGameVersion >= 24 ) { if( !LoadPhysicsTableFromSavedGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadPhysicsTableFromSavedGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } #ifdef JA2BETAVERSION @@ -2237,12 +3583,12 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) - if( SaveGameHeader.uiSavedGameVersion >= 24 ) + if( guiCurrentSaveGameVersion >= 24 ) { if( !LoadAirRaidInfoFromSaveGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadAirRaidInfoFromSaveGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } #ifdef JA2BETAVERSION @@ -2259,12 +3605,12 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) - if( SaveGameHeader.uiSavedGameVersion >= 24 ) + if( guiCurrentSaveGameVersion >= 24 ) { if( !LoadTeamTurnsFromTheSavedGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadTeamTurnsFromTheSavedGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } #ifdef JA2BETAVERSION @@ -2282,12 +3628,12 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) - if( SaveGameHeader.uiSavedGameVersion >= 25 ) + if( guiCurrentSaveGameVersion >= 25 ) { if( !LoadExplosionTableFromSavedGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadExplosionTableFromSavedGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } #ifdef JA2BETAVERSION @@ -2306,12 +3652,12 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) - if( SaveGameHeader.uiSavedGameVersion >= 27 ) + if( guiCurrentSaveGameVersion >= 27 ) { - if( !LoadCreatureDirectives( hFile, SaveGameHeader.uiSavedGameVersion ) ) + if( !LoadCreatureDirectives( hFile, guiCurrentSaveGameVersion ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadCreatureDirectives failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } #ifdef JA2BETAVERSION @@ -2330,12 +3676,12 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) - if( SaveGameHeader.uiSavedGameVersion >= 28 ) + if( guiCurrentSaveGameVersion >= 28 ) { if( !LoadStrategicStatusFromSaveGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadStrategicStatusFromSaveGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } #ifdef JA2BETAVERSION @@ -2352,12 +3698,12 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) - if( SaveGameHeader.uiSavedGameVersion >= 31 ) + if( guiCurrentSaveGameVersion >= 31 ) { if( !LoadStrategicAI( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadStrategicAI failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } #ifdef JA2BETAVERSION @@ -2374,12 +3720,12 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) - if( SaveGameHeader.uiSavedGameVersion >= 37 ) + if( guiCurrentSaveGameVersion >= 37 ) { if( !LoadLightEffectsFromLoadGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadLightEffectsFromLoadGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return(FALSE); } #ifdef JA2BETAVERSION @@ -2396,12 +3742,12 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) - if( SaveGameHeader.uiSavedGameVersion >= 38 ) + if( guiCurrentSaveGameVersion >= 38 ) { if ( !LoadWatchedLocsFromSavedGame( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadWatchedLocsFromSavedGame failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } } @@ -2418,13 +3764,12 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) uiRelStartPerc = uiRelEndPerc; - - if( SaveGameHeader.uiSavedGameVersion >= 39 ) + if( guiCurrentSaveGameVersion >= 39 ) { if ( !LoadItemCursorFromSavedGame( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadItemCursorFromSavedGame failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } } @@ -2441,12 +3786,12 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) - if( SaveGameHeader.uiSavedGameVersion >= 51 ) + if( guiCurrentSaveGameVersion >= 51 ) { if( !LoadCivQuotesFromLoadGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadCivQuotesFromLoadGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return FALSE; } } @@ -2464,12 +3809,12 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) - if( SaveGameHeader.uiSavedGameVersion >= 53 ) + if( guiCurrentSaveGameVersion >= 53 ) { - if( !LoadBackupNPCInfoFromSavedGameFile( hFile, SaveGameHeader.uiSavedGameVersion ) ) + if( !LoadBackupNPCInfoFromSavedGameFile( hFile, guiCurrentSaveGameVersion ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadBackupNPCInfoFromSavedGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } } @@ -2486,12 +3831,12 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) - if( SaveGameHeader.uiSavedGameVersion >= 58 ) + if( guiCurrentSaveGameVersion >= 58 ) { if( !LoadMeanwhileDefsFromSaveGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadMeanwhileDefsFromSaveGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } #ifdef JA2BETAVERSION @@ -2513,14 +3858,14 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) - if( SaveGameHeader.uiSavedGameVersion >= 59 ) + if( guiCurrentSaveGameVersion >= 59 ) { // trash schedules loaded from map DestroyAllSchedulesWithoutDestroyingEvents(); if ( !LoadSchedulesFromSave( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadSchedulesFromSave failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } #ifdef JA2BETAVERSION @@ -2537,32 +3882,32 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) - if( SaveGameHeader.uiSavedGameVersion >= 61 ) + if( guiCurrentSaveGameVersion >= 61 ) { - if( SaveGameHeader.uiSavedGameVersion < 84 ) - { - if ( !LoadVehicleMovementInfoFromSavedGameFile( hFile ) ) - { - FileClose( hFile ); - guiSaveGameVersion=0; - return( FALSE ); - } - #ifdef JA2BETAVERSION - LoadGameFilePosition( FileGetPos( hFile ), "Extra Vehicle Info" ); - #endif - } - else - { - if ( !NewLoadVehicleMovementInfoFromSavedGameFile( hFile ) ) - { - FileClose( hFile ); - guiSaveGameVersion=0; - return( FALSE ); - } - #ifdef JA2BETAVERSION - LoadGameFilePosition( FileGetPos( hFile ), "Extra Vehicle Info" ); - #endif - } + if( guiCurrentSaveGameVersion < 84 ) + { + if ( !LoadVehicleMovementInfoFromSavedGameFile( hFile ) ) + { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadVehicleMovementInfoFromSavedGameFile failed" ) ); + FileClose( hFile ); + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Extra Vehicle Info" ); + #endif + } + else + { + if ( !NewLoadVehicleMovementInfoFromSavedGameFile( hFile ) ) + { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("NewLoadVehicleMovementInfoFromSavedGameFile failed" ) ); + FileClose( hFile ); + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Extra Vehicle Info" ); + #endif + } } uiRelEndPerc += 1; @@ -2572,18 +3917,18 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) - if( SaveGameHeader.uiSavedGameVersion < 62 ) + if( guiCurrentSaveGameVersion < 62 ) { // the older games had a bug where this flag was never being set gfResetAllPlayerKnowsEnemiesFlags = TRUE; } - if( SaveGameHeader.uiSavedGameVersion >= 67 ) + if( guiCurrentSaveGameVersion >= 67 ) { if ( !LoadContractRenewalDataFromSaveGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadContractRenewalDataFromSaveGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } #ifdef JA2BETAVERSION @@ -2592,12 +3937,12 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) } - if( SaveGameHeader.uiSavedGameVersion >= 70 ) + if( guiCurrentSaveGameVersion >= 70 ) { if ( !LoadLeaveItemList( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadLeaveItemList failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } #ifdef JA2BETAVERSION @@ -2605,19 +3950,19 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) #endif } - if( SaveGameHeader.uiSavedGameVersion <= 73 ) + if( guiCurrentSaveGameVersion <= 73 ) { - // Patch vehicle fuel - AddVehicleFuelToSave( ); + // Patch vehicle fuel + AddVehicleFuelToSave( ); } - if( SaveGameHeader.uiSavedGameVersion >= 85 ) + if( guiCurrentSaveGameVersion >= 85 ) { if ( !NewWayOfLoadingBobbyRMailOrdersToSaveGameFile( hFile ) ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("NewWayOfLoadingBobbyRMailOrdersToSaveGameFile failed" ) ); FileClose( hFile ); - guiSaveGameVersion=0; return( FALSE ); } #ifdef JA2BETAVERSION @@ -2626,17 +3971,12 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) } //If there are any old Bobby R Mail orders, tranfer them to the new system - if( SaveGameHeader.uiSavedGameVersion < 85 ) + if( guiCurrentSaveGameVersion < 85 ) { HandleOldBobbyRMailOrders(); } - ///lll - - - - uiRelEndPerc += 1; SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Final Checks..." ); RenderProgressBar( 0, 100 ); @@ -2644,35 +3984,39 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) - // //Close the saved game file // FileClose( hFile ); // ATE: Patch? Patch up groups.....( will only do for old saves.. ) - UpdatePersistantGroupsFromOldSave( SaveGameHeader.uiSavedGameVersion ); + UpdatePersistantGroupsFromOldSave( guiCurrentSaveGameVersion ); - if( SaveGameHeader.uiSavedGameVersion <= 40 ) + if( guiCurrentSaveGameVersion <= 40 ) { - // Cancel all pending purchase orders for BobbyRay's. Starting with version 41, the BR orders events are - // posted with the usItemIndex itself as the parameter, rather than the inventory slot index. This was + // Cancel all pending purchase orders for BobbyRay's. Starting with version 41, the BR orders events are + // posted with the usItemIndex itself as the parameter, rather than the inventory slot index. This was // done to make it easier to modify BR's traded inventory lists later on without breaking saves. CancelAllPendingBRPurchaseOrders(); } //if the world is loaded, apply the temp files to the loaded map - if( SaveGameHeader.fWorldLoaded || SaveGameHeader.uiSavedGameVersion < 50 ) + if( SaveGameHeader.fWorldLoaded || guiCurrentSaveGameVersion < 50 ) { + //the current sector has been updated, we need to temporarily change the game version we are loading! + UINT32 tempVersion = guiCurrentSaveGameVersion; + guiCurrentSaveGameVersion = SAVE_GAME_VERSION; + // Load the current sectors Information From the temporary files if( !LoadCurrentSectorsInformationFromTempItemsFile() ) { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("LoadCurrentSectorsInformationFromTempItemsFile failed" ) ); InitExitGameDialogBecauseFileHackDetected(); - guiSaveGameVersion=0; return( TRUE ); } + guiCurrentSaveGameVersion = tempVersion; } uiRelEndPerc += 1; @@ -2725,10 +4069,10 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) } //Reset the shadow - SetFontShadow( DEFAULT_SHADOW ); + SetFontShadow( DEFAULT_SHADOW ); #ifdef JA2BETAVERSION - //AssertMsg( uiSizeOfGeneralInfo == 1024, String( "Saved General info is NOT 1024, it is %d. DF 1.", uiSizeOfGeneralInfo ) ); + //AssertMsg( uiSizeOfGeneralInfo == 1024, String( "Saved General info is NOT 1024, it is %d. DF 1.", uiSizeOfGeneralInfo ) ); #endif //if we succesfully LOADED! the game, mark this entry as the last saved game file @@ -2784,16 +4128,16 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) #endif gTacticalStatus.ubAttackBusyCount = 0; } - - if( SaveGameHeader.uiSavedGameVersion < 64 ) - { //Militia/enemies/creature team sizes have been changed from 32 to 20. This function - //will simply kill off the excess. This will allow the ability to load previous saves, though + + if( guiCurrentSaveGameVersion < 64 ) + { //Militia/enemies/creature team sizes have been changed from 32 to 20. This function + //will simply kill off the excess. This will allow the ability to load previous saves, though //there will still be problems, though a LOT less than there would be without this call. TruncateStrategicGroupSizes(); } // ATE: if we are within this window where skyridder was foobared, fix! - if ( SaveGameHeader.uiSavedGameVersion >= 61 && SaveGameHeader.uiSavedGameVersion <= 65 ) + if ( guiCurrentSaveGameVersion >= 61 && guiCurrentSaveGameVersion <= 65 ) { SOLDIERTYPE *pSoldier; MERCPROFILESTRUCT *pProfile; @@ -2805,7 +4149,7 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) if ( pSoldier != NULL ) { - TacticalRemoveSoldier( pSoldier->ubID ); + TacticalRemoveSoldier( pSoldier->ubID ); } // add the pilot at a random location! @@ -2836,7 +4180,7 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) } } - if ( SaveGameHeader.uiSavedGameVersion < 68 ) + if ( guiCurrentSaveGameVersion < 68 ) { // correct bVehicleUnderRepairID for all mercs UINT8 ubID; @@ -2846,29 +4190,29 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) } } - if ( SaveGameHeader.uiSavedGameVersion < 73 ) + if ( guiCurrentSaveGameVersion < 73 ) { if( LaptopSaveInfo.fMercSiteHasGoneDownYet ) LaptopSaveInfo.fFirstVisitSinceServerWentDown = 2; } - //Update the MERC merc contract lenght. Before save version 77 the data was stored in the SOLDIERTYPE, + //Update the MERC merc contract lenght. Before save version 77 the data was stored in the SOLDIERTYPE, //after 77 the data is stored in the profile - if ( SaveGameHeader.uiSavedGameVersion < 77 ) + if ( guiCurrentSaveGameVersion < 77 ) { UpdateMercMercContractInfo(); } - if ( SaveGameHeader.uiSavedGameVersion <= 89 ) + if ( guiCurrentSaveGameVersion <= 89 ) { // ARM: A change was made in version 89 where refuel site availability now also depends on whether the player has - // airspace control over that sector. To update the settings immediately, must call it here. + // airspace control over that sector. To update the settings immediately, must call it here. UpdateRefuelSiteAvailability(); } - if( SaveGameHeader.uiSavedGameVersion < 91 ) + if( guiCurrentSaveGameVersion < 91 ) { //update the amount of money that has been paid to speck CalcAproximateAmountPaidToSpeck(); @@ -2881,7 +4225,7 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) RenderProgressBar( 0, 100 ); RemoveLoadingScreenProgressBar(); - + SetMusicMode( gMusicModeToPlay ); #ifndef JA2TESTVERSION @@ -2895,9 +4239,6 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) } #endif - // reset to 0 - guiSaveGameVersion=0; - // reset once-per-convo records for everyone in the loaded sector ResetOncePerConvoRecordsForAllNPCsInLoadedSector(); @@ -2907,7 +4248,7 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) // if we're not in combat. gTacticalStatus.ubAttackBusyCount = 0; #ifdef DEBUG_ATTACKBUSY - OutputDebugString( "Resetting attack busy due to game load.\n"); + OutputDebugString( "Resetting attack busy due to load game.\n"); #endif } @@ -2918,7 +4259,8 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) //we must reset the values HandlePlayerTogglingLightEffects( FALSE ); - + //now change the savegame format so that temp files are saved and loaded correctly + guiCurrentSaveGameVersion = SAVE_GAME_VERSION; return( TRUE ); } @@ -2931,25 +4273,12 @@ BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) BOOLEAN SaveMercProfiles( HWFILE hFile ) { UINT16 cnt; - UINT32 uiNumBytesWritten=0; - - // WDS - Clean up inventory handling //Loop through all the profiles to save for( cnt=0; cnt< NUM_PROFILES; cnt++) { - gMercProfiles[ cnt ].uiProfileChecksum = ProfileChecksum( &(gMercProfiles[ cnt ]) ); - gMercProfiles[ cnt ].CopyNewInventoryToOld(); - if ( guiSavedGameVersion < 87 ) + if ( !gMercProfiles[ cnt ].Save(hFile) ) { - JA2EncryptedFileWrite( hFile, &gMercProfiles[cnt], SIZEOF_MERCPROFILESTRUCT_POD, &uiNumBytesWritten ); - } - else - { - NewJA2EncryptedFileWrite( hFile, &gMercProfiles[cnt], SIZEOF_MERCPROFILESTRUCT_POD, &uiNumBytesWritten ); - } - if( uiNumBytesWritten != SIZEOF_MERCPROFILESTRUCT_POD ) - { - return(FALSE); + return FALSE; } } @@ -2961,30 +4290,15 @@ BOOLEAN SaveMercProfiles( HWFILE hFile ) BOOLEAN LoadSavedMercProfiles( HWFILE hFile ) { UINT16 cnt; - UINT32 uiNumBytesRead=0; - - // WDS - Clean up inventory handling //Loop through all the profiles to Load for( cnt=0; cnt< NUM_PROFILES; cnt++) { - gMercProfiles[cnt].initialize(); - if ( guiSaveGameVersion < 87 ) - { - JA2EncryptedFileRead( hFile, &gMercProfiles[cnt], SIZEOF_MERCPROFILESTRUCT_POD, &uiNumBytesRead ); - } - else - { - NewJA2EncryptedFileRead( hFile, &gMercProfiles[cnt], SIZEOF_MERCPROFILESTRUCT_POD, &uiNumBytesRead ); - } - if( uiNumBytesRead != SIZEOF_MERCPROFILESTRUCT_POD ) + // Changed by ADB, rev 1513 + //if ( !gMercProfiles[cnt].Load(hFile, false) ) + if ( !gMercProfiles[cnt].Load(hFile, false, false, true) ) { return(FALSE); } - gMercProfiles[ cnt ].CopyOldInventoryToNew(); - if ( gMercProfiles[ cnt ].uiProfileChecksum != ProfileChecksum( &(gMercProfiles[ cnt ]) ) ) - { - return( FALSE ); - } } return( TRUE ); @@ -2992,26 +4306,25 @@ BOOLEAN LoadSavedMercProfiles( HWFILE hFile ) +//Not saving any of these in the soldier struct +// struct TAG_level_node *pLevelNode; +// struct TAG_level_node *pExternShadowLevelNode; +// struct TAG_level_node *pRoofUILevelNode; +// UINT16 *pBackGround; +// UINT16 *pZBackground; +// UINT16 *pForcedShade; +// +// UINT16 *pEffectShades[ NUM_SOLDIER_EFFECTSHADES ]; // Shading tables for effects +// THROW_PARAMS *pThrowParams; +// UINT16 *pCurrentShade; +// UINT16 *pGlowShades[ 20 ]; // +// UINT16 *pShades[ NUM_SOLDIER_SHADES ]; // Shading tables +// UINT16 *p16BPPPalette; +// SGPPaletteEntry *p8BPPPalette +// OBJECTTYPE *pTempObject; - //Not saving any of these in the soldier struct - - // struct TAG_level_node *pLevelNode; - // struct TAG_level_node *pExternShadowLevelNode; - // struct TAG_level_node *pRoofUILevelNode; - // UINT16 *pBackGround; - // UINT16 *pZBackground; - // UINT16 *pForcedShade; - // - // UINT16 *pEffectShades[ NUM_SOLDIER_EFFECTSHADES ]; // Shading tables for effects - // THROW_PARAMS *pThrowParams; - // UINT16 *pCurrentShade; - // UINT16 *pGlowShades[ 20 ]; // - // UINT16 *pShades[ NUM_SOLDIER_SHADES ]; // Shading tables - // UINT16 *p16BPPPalette; - // SGPPaletteEntry *p8BPPPalette - // OBJECTTYPE *pTempObject; - +//Not saving any of these in the soldier struct BOOLEAN SaveSoldierStructure( HWFILE hFile ) { @@ -3020,14 +4333,9 @@ BOOLEAN SaveSoldierStructure( HWFILE hFile ) UINT8 ubOne = 1; UINT8 ubZero = 0; - // WDS - Clean up inventory handling - UINT32 uiSaveSize = SIZEOF_SOLDIERTYPE_POD; //SIZEOF_SOLDIERTYPE; - - - //Loop through all the soldier structs to save for( cnt=0; cnt< TOTAL_SOLDIERS; cnt++) - { + { //if the soldier isnt active, dont add them to the saved game file. if( !Menptr[ cnt ].bActive ) @@ -3049,37 +4357,19 @@ BOOLEAN SaveSoldierStructure( HWFILE hFile ) return(FALSE); } - // calculate checksum for soldier - Menptr[ cnt ].uiMercChecksum = MercChecksum( &(Menptr[ cnt ]) ); // Save the soldier structure - // WDS - Clean up inventory handling - Menptr[cnt].CopyNewInventoryToOld(); - if ( guiSavedGameVersion < 87 ) + if ( !Menptr[ cnt ].Save(hFile) ) { - JA2EncryptedFileWrite( hFile, &Menptr[ cnt ], uiSaveSize, &uiNumBytesWritten ); + return FALSE; } - else - { - NewJA2EncryptedFileWrite( hFile, &Menptr[ cnt ], uiSaveSize, &uiNumBytesWritten ); - } - if( uiNumBytesWritten != uiSaveSize ) - { - return(FALSE); - } - - // // Save all the pointer info from the structure // - - //Save the pMercPath if( !SaveMercPathFromSoldierStruct( hFile, (UINT8)cnt ) ) return( FALSE ); - - // //do we have a KEY_ON_RING *pKeyRing; // @@ -3111,44 +4401,33 @@ BOOLEAN SaveSoldierStructure( HWFILE hFile ) } } } - return( TRUE ); } - BOOLEAN LoadSoldierStructure( HWFILE hFile ) { UINT16 cnt; UINT32 uiNumBytesRead=0; - SOLDIERTYPE SavedSoldierInfo; - // WDS - Clean up inventory handling - UINT32 uiSaveSize = SIZEOF_SOLDIERTYPE_POD; //SIZEOF_SOLDIERTYPE; UINT8 ubId; UINT8 ubOne = 1; UINT8 ubActive = 1; UINT32 uiPercentage; - - SOLDIERCREATE_STRUCT CreateStruct; + SOLDIERTYPE SavedSoldierInfo; //Loop through all the soldier and delete them all for( cnt=0; cnt< TOTAL_SOLDIERS; cnt++) - { + { TacticalRemoveSoldier( cnt ); } - - //Loop through all the soldier structs to load for( cnt=0; cnt< TOTAL_SOLDIERS; cnt++) - { - + { //update the progress bar uiPercentage = (cnt * 100) / (TOTAL_SOLDIERS-1); - RenderProgressBar( 0, uiPercentage ); - //Read in a byte to tell us whether or not there is a soldier loaded here. FileRead( hFile, &ubActive, 1, &uiNumBytesRead ); if( uiNumBytesRead != 1 ) @@ -3166,55 +4445,37 @@ BOOLEAN LoadSoldierStructure( HWFILE hFile ) else { //Read in the saved soldier info into a Temp structure - // WDS - Clean up inventory handling - SavedSoldierInfo.initialize(); - if ( guiSaveGameVersion < 87 ) + if ( !SavedSoldierInfo.Load(hFile) ) { - JA2EncryptedFileRead( hFile, &SavedSoldierInfo, uiSaveSize, &uiNumBytesRead ); - } - else - { - NewJA2EncryptedFileRead( hFile, &SavedSoldierInfo, uiSaveSize, &uiNumBytesRead ); - } - SavedSoldierInfo.CopyOldInventoryToNew(); - if( uiNumBytesRead != uiSaveSize ) - { - return(FALSE); - } - // check checksum - if ( MercChecksum( &SavedSoldierInfo ) != SavedSoldierInfo.uiMercChecksum ) - { - return( FALSE ); + return FALSE; } - //Make sure all the pointer references are NULL'ed out. - SavedSoldierInfo.pTempObject = NULL; - SavedSoldierInfo.pKeyRing = NULL; - SavedSoldierInfo.p8BPPPalette = NULL; - SavedSoldierInfo.p16BPPPalette = NULL; + //Make sure all the pointer references are NULL'ed out. + SavedSoldierInfo.pTempObject = NULL; + SavedSoldierInfo.pKeyRing = NULL; + SavedSoldierInfo.p8BPPPalette = NULL; + SavedSoldierInfo.p16BPPPalette = NULL; memset( SavedSoldierInfo.pShades, 0, sizeof( UINT16* ) * NUM_SOLDIER_SHADES ); memset( SavedSoldierInfo.pGlowShades, 0, sizeof( UINT16* ) * 20 ); - SavedSoldierInfo.pCurrentShade = NULL; - SavedSoldierInfo.pThrowParams = NULL; - SavedSoldierInfo.pLevelNode = NULL; - SavedSoldierInfo.pExternShadowLevelNode = NULL; - SavedSoldierInfo.pRoofUILevelNode = NULL; - SavedSoldierInfo.pBackGround = NULL; - SavedSoldierInfo.pZBackground = NULL; - SavedSoldierInfo.pForcedShade = NULL; - SavedSoldierInfo.pMercPath = NULL; + SavedSoldierInfo.pCurrentShade = NULL; + SavedSoldierInfo.pThrowParams = NULL; + SavedSoldierInfo.pLevelNode = NULL; + SavedSoldierInfo.pExternShadowLevelNode = NULL; + SavedSoldierInfo.pRoofUILevelNode = NULL; + SavedSoldierInfo.pBackGround = NULL; + SavedSoldierInfo.pZBackground = NULL; + SavedSoldierInfo.pForcedShade = NULL; + SavedSoldierInfo.pMercPath = NULL; memset( SavedSoldierInfo.pEffectShades, 0, sizeof( UINT16* ) * NUM_SOLDIER_EFFECTSHADES ); - //if the soldier wasnt active, dont add them now. Advance to the next merc - //if( !SavedSoldierInfo.bActive ) - // continue; + //if the soldier wasnt active, dont add them now. Advance to the next merc + //if( !SavedSoldierInfo.bActive ) + // continue; - // WDS - Clean up inventory handling //Create the new merc - //memset( &CreateStruct, 0, SIZEOF_SOLDIERCREATE_STRUCT ); - CreateStruct.initialize(); + SOLDIERCREATE_STRUCT CreateStruct; CreateStruct.bTeam = SavedSoldierInfo.bTeam; CreateStruct.ubProfile = SavedSoldierInfo.ubProfile; CreateStruct.fUseExistingSoldier = TRUE; @@ -3248,7 +4509,7 @@ BOOLEAN LoadSoldierStructure( HWFILE hFile ) { return(FALSE); } - + } else { @@ -3262,7 +4523,7 @@ BOOLEAN LoadSoldierStructure( HWFILE hFile ) } //if the saved game version is before x, calculate the amount of money paid to mercs - if( guiSaveGameVersion < 83 ) + if( guiCurrentSaveGameVersion < 83 ) { //if the soldier is someone if( Menptr[ cnt ].ubProfile != NO_PROFILE ) @@ -3280,17 +4541,17 @@ BOOLEAN LoadSoldierStructure( HWFILE hFile ) #ifdef GERMAN // Fix neutral flags - if ( guiSaveGameVersion < 94 ) + if ( guiCurrentSaveGameVersion < 94 ) { - if ( Menptr[ cnt].bTeam == OUR_TEAM && Menptr[ cnt ].bNeutral && Menptr[ cnt ].bAssignment != ASSIGNMENT_POW ) + if ( Menptr[ cnt].bTeam == OUR_TEAM && Menptr[ cnt ].aiData.bNeutral && Menptr[ cnt ].bAssignment != ASSIGNMENT_POW ) { // turn off neutral flag - Menptr[ cnt].bNeutral = FALSE; + Menptr[ cnt].aiData.bNeutral = FALSE; } } #endif // JA2Gold: fix next-to-previous attacker value - if ( guiSaveGameVersion < 99 ) + if ( guiCurrentSaveGameVersion < 99 ) { Menptr[ cnt ].ubNextToPreviousAttackerID = NOBODY; } @@ -3299,7 +4560,7 @@ BOOLEAN LoadSoldierStructure( HWFILE hFile ) } // Fix robot - if ( guiSaveGameVersion <= 87 ) + if ( guiCurrentSaveGameVersion <= 87 ) { SOLDIERTYPE * pSoldier; @@ -3316,7 +4577,7 @@ BOOLEAN LoadSoldierStructure( HWFILE hFile ) pSoldier->inv[ VESTPOS ].usItem = SPECTRA_VEST_18; pSoldier->inv[ HELMETPOS ].usItem = SPECTRA_HELMET_18; pSoldier->inv[ LEGPOS ].usItem = SPECTRA_LEGGINGS_18; - pSoldier->bAgility = 50; + pSoldier->stats.bAgility = 50; } } } @@ -3430,10 +4691,10 @@ BOOLEAN SaveFilesToSavedGame( STR pSrcFileName, HWFILE hFile ) } #ifdef JA2BETAVERSION - guiNumberOfMapTempFiles++; //Increment counter: To determine where the temp files are crashing + guiNumberOfMapTempFiles++; //Increment counter: To determine where the temp files are crashing #endif - + //Get the file size of the source data file uiFileSize = FileGetSize( hSrcFile ); if( uiFileSize == 0 ) @@ -3499,7 +4760,7 @@ BOOLEAN LoadFilesFromSavedGame( STR pSrcFileName, HWFILE hFile ) UINT8 *pData; UINT32 uiNumBytesRead; - + //If the source file exists, delete it if( FileExists( pSrcFileName ) ) @@ -3512,7 +4773,7 @@ BOOLEAN LoadFilesFromSavedGame( STR pSrcFileName, HWFILE hFile ) } #ifdef JA2BETAVERSION - guiNumberOfMapTempFiles++; //Increment counter: To determine where the temp files are crashing + guiNumberOfMapTempFiles++; //Increment counter: To determine where the temp files are crashing #endif //open the destination file to write to @@ -3523,13 +4784,13 @@ BOOLEAN LoadFilesFromSavedGame( STR pSrcFileName, HWFILE hFile ) return( FALSE ); } - + // Read the size of the data FileRead( hFile, &uiFileSize, sizeof( UINT32 ), &uiNumBytesRead ); if( uiNumBytesRead != sizeof( UINT32 ) ) { FileClose( hSrcFile ); - + return(FALSE); } @@ -3548,14 +4809,15 @@ BOOLEAN LoadFilesFromSavedGame( STR pSrcFileName, HWFILE hFile ) FileClose( hSrcFile ); return( FALSE ); } - memset( pData, 0, uiFileSize); + //ADB looks hardly necessary if there is a read right below + //memset( pData, 0, uiFileSize); // Read into the buffer FileRead( hFile, pData, uiFileSize, &uiNumBytesRead ); if( uiNumBytesRead != uiFileSize ) { FileClose( hSrcFile ); - + //Free the buffer MemFree( pData ); @@ -3594,7 +4856,6 @@ BOOLEAN SaveEmailToSavedGame( HWFILE hFile ) UINT32 uiNumOfEmails=0; UINT32 uiSizeOfEmails=0; EmailPtr pEmail = pEmailList; - //EmailPtr pTempEmail = NULL; UINT32 cnt; UINT32 uiStringLength=0; UINT32 uiNumBytesWritten=0; @@ -3771,7 +5032,7 @@ BOOLEAN LoadEmailFromSavedGame( HWFILE hFile ) //if there are emails if( cnt ) { - //the first node of the LL was a dummy, node,get rid of it + //the first node of the LL was a dummy, node,get rid of it pTempEmail = pEmailList; pEmailList = pEmailList->Next; pEmailList->Prev = NULL; @@ -3875,14 +5136,7 @@ BOOLEAN LoadTacticalStatusFromSavedGame( HWFILE hFile ) BOOLEAN CopySavedSoldierInfoToNewSoldier( SOLDIERTYPE *pDestSourceInfo, SOLDIERTYPE *pSourceInfo ) { - - - // WDS - Clean up inventory handling - //Copy the old soldier information over to the new structure -// memcpy( pDestSourceInfo, pSourceInfo, SIZEOF_SOLDIERTYPE ); *pDestSourceInfo = *pSourceInfo; - - return( TRUE ); } @@ -3891,13 +5145,13 @@ BOOLEAN SetMercsInsertionGridNo( ) { UINT16 cnt=0; - // loop through all the mercs - for ( cnt=0; cnt < TOTAL_SOLDIERS; cnt++ ) - { + // loop through all the mercs + for ( cnt=0; cnt < TOTAL_SOLDIERS; cnt++ ) + { //if the soldier is active if( Menptr[ cnt ].bActive ) { - + if( Menptr[ cnt ].sGridNo != NOWHERE ) { //set the insertion type to gridno @@ -3937,9 +5191,9 @@ BOOLEAN SaveOppListInfoToSavedGame( HWFILE hFile ) { return( FALSE ); } - - + + // Save the Last Known Opp Locations uiSaveSize = TOTAL_SOLDIERS * TOTAL_SOLDIERS; FileWrite( hFile, gsLastKnownOppLoc, uiSaveSize, &uiNumBytesWritten ); @@ -3947,7 +5201,7 @@ BOOLEAN SaveOppListInfoToSavedGame( HWFILE hFile ) { return( FALSE ); } - + // Save the Last Known Opp Level uiSaveSize = TOTAL_SOLDIERS * TOTAL_SOLDIERS; FileWrite( hFile, gbLastKnownOppLevel, uiSaveSize, &uiNumBytesWritten ); @@ -3956,7 +5210,7 @@ BOOLEAN SaveOppListInfoToSavedGame( HWFILE hFile ) return( FALSE ); } - + // Save the Public Last Known Opp Locations uiSaveSize = MAXTEAMS * TOTAL_SOLDIERS; FileWrite( hFile, gsPublicLastKnownOppLoc, uiSaveSize, &uiNumBytesWritten ); @@ -4016,9 +5270,9 @@ BOOLEAN LoadOppListInfoFromSavedGame( HWFILE hFile ) { return( FALSE ); } - - + + // Load the Last Known Opp Locations uiLoadSize = TOTAL_SOLDIERS * TOTAL_SOLDIERS; FileRead( hFile, gsLastKnownOppLoc, uiLoadSize, &uiNumBytesRead ); @@ -4026,7 +5280,7 @@ BOOLEAN LoadOppListInfoFromSavedGame( HWFILE hFile ) { return( FALSE ); } - + // Load the Last Known Opp Level uiLoadSize = TOTAL_SOLDIERS * TOTAL_SOLDIERS; FileRead( hFile, gbLastKnownOppLevel, uiLoadSize, &uiNumBytesRead ); @@ -4035,7 +5289,7 @@ BOOLEAN LoadOppListInfoFromSavedGame( HWFILE hFile ) return( FALSE ); } - + // Load the Public Last Known Opp Locations uiLoadSize = MAXTEAMS * TOTAL_SOLDIERS; FileRead( hFile, gsPublicLastKnownOppLoc, uiLoadSize, &uiNumBytesRead ); @@ -4228,11 +5482,11 @@ BOOLEAN SaveMercPathFromSoldierStruct( HWFILE hFile, UINT8 ubID ) { return(FALSE); } - + pTempPath = pTempPath->pNext; } - + return( TRUE ); } @@ -4284,7 +5538,7 @@ BOOLEAN LoadMercPathToSoldierStruct( HWFILE hFile, UINT8 ubID ) { pTempPath = MoveToBeginningOfPathList( pTempPath ); ClearStrategicPathList( pTempPath, -1 ); - return( FALSE ); + return( FALSE ); } memset( pTemp, 0 , sizeof( PathSt ) ); @@ -4357,7 +5611,7 @@ void SaveGameFilePosition( INT32 iPos, STR pMsg ) FileSeek( hFile, 0, FILE_SEEK_FROM_END ); - sprintf( zTempString, "%8d %s\n", iPos, pMsg ); + sprintf( zTempString, "%8d %s\n", iPos, pMsg ); uiStrLen = strlen( zTempString ); FileWrite( hFile, zTempString, uiStrLen, &uiNumBytesWritten ); @@ -4401,7 +5655,7 @@ void LoadGameFilePosition( INT32 iPos, STR pMsg ) FileSeek( hFile, 0, FILE_SEEK_FROM_END ); - sprintf( zTempString, "%8d %s\n", iPos, pMsg ); + sprintf( zTempString, "%8d %s\n", iPos, pMsg ); uiStrLen = strlen( zTempString ); FileWrite( hFile, zTempString, uiStrLen, &uiNumBytesWritten ); @@ -4474,7 +5728,7 @@ BOOLEAN SaveGeneralInfo( HWFILE hFile ) // the flags for skyrider events sGeneralInfo.fShowEstoniRefuelHighLight = fShowEstoniRefuelHighLight; sGeneralInfo.fShowOtherSAMHighLight = fShowOtherSAMHighLight; - sGeneralInfo.fShowDrassenSAMHighLight = fShowDrassenSAMHighLight; + sGeneralInfo.fShowDrassenSAMHighLight = fShowDrassenSAMHighLight; sGeneralInfo.fShowCambriaHospitalHighLight = fShowCambriaHospitalHighLight; //The current state of the weather @@ -4488,7 +5742,7 @@ BOOLEAN SaveGeneralInfo( HWFILE hFile ) sGeneralInfo.ubPlayerProgressSkyriderLastCommentedOn = gubPlayerProgressSkyriderLastCommentedOn; sGeneralInfo.fEnterMapDueToContract = fEnterMapDueToContract; - sGeneralInfo.ubQuitType = ubQuitType; + sGeneralInfo.ubQuitType = ubQuitType; if( pContractReHireSoldier != NULL ) sGeneralInfo.sContractRehireSoldierID = pContractReHireSoldier->ubID; @@ -4548,7 +5802,7 @@ BOOLEAN SaveGeneralInfo( HWFILE hFile ) sGeneralInfo.gfInMeanwhile = gfInMeanwhile; - // list of dead guys for squads...in id values -> -1 means no one home + // list of dead guys for squads...in id values->-1 means no one home memcpy( &sGeneralInfo.sDeadMercs, &sDeadMercs, sizeof( INT16 ) * NUMBER_OF_SQUADS * NUMBER_OF_SOLDIERS_PER_SQUAD ); // level of public noises @@ -4601,8 +5855,8 @@ BOOLEAN SaveGeneralInfo( HWFILE hFile ) sGeneralInfo.ubDesertTemperature = gubDesertTemperature; sGeneralInfo.ubGlobalTemperature = gubGlobalTemperature; - sGeneralInfo.sMercArriveSectorX = gsMercArriveSectorX; - sGeneralInfo.sMercArriveSectorY = gsMercArriveSectorY; + sGeneralInfo.sMercArriveSectorX = gsMercArriveSectorX; + sGeneralInfo.sMercArriveSectorY = gsMercArriveSectorY; sGeneralInfo.fCreatureMeanwhileScenePlayed = gfCreatureMeanwhileScenePlayed; @@ -4625,7 +5879,7 @@ BOOLEAN SaveGeneralInfo( HWFILE hFile ) sGeneralInfo.iHospitalTempBalance = giHospitalTempBalance; sGeneralInfo.iHospitalRefund = giHospitalRefund; sGeneralInfo.bHospitalPriceModifier = gbHospitalPriceModifier; - sGeneralInfo.fPlayerTeamSawJoey = gfPlayerTeamSawJoey; + sGeneralInfo.fPlayerTeamSawJoey = gfPlayerTeamSawJoey; sGeneralInfo.fMikeShouldSayHi = gfMikeShouldSayHi; //Setup the @@ -4716,7 +5970,7 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) // the flags for skyrider events fShowEstoniRefuelHighLight = sGeneralInfo.fShowEstoniRefuelHighLight; fShowOtherSAMHighLight = sGeneralInfo.fShowOtherSAMHighLight; - fShowDrassenSAMHighLight = sGeneralInfo.fShowDrassenSAMHighLight; + fShowDrassenSAMHighLight = sGeneralInfo.fShowDrassenSAMHighLight; fShowCambriaHospitalHighLight = sGeneralInfo.fShowCambriaHospitalHighLight; //The current state of the weather @@ -4728,7 +5982,7 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) SoundStop( guiRainLoop ); guiRainLoop = NO_SAMPLE; } - //end rain + //end rain gubDefaultButton = sGeneralInfo.ubDefaultButton; @@ -4738,10 +5992,10 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) gubPlayerProgressSkyriderLastCommentedOn = sGeneralInfo.ubPlayerProgressSkyriderLastCommentedOn; fEnterMapDueToContract = sGeneralInfo.fEnterMapDueToContract; - ubQuitType = sGeneralInfo.ubQuitType; + ubQuitType = sGeneralInfo.ubQuitType; //if the soldier id is valid - if( sGeneralInfo.sContractRehireSoldierID == -1 ) + if( sGeneralInfo.sContractRehireSoldierID == -1 ) pContractReHireSoldier = NULL; else pContractReHireSoldier = &Menptr[ sGeneralInfo.sContractRehireSoldierID ]; @@ -4815,7 +6069,7 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) gfMeanwhileTryingToStart = sGeneralInfo.gfMeanwhileTryingToStart; gfInMeanwhile = sGeneralInfo.gfInMeanwhile; - // list of dead guys for squads...in id values -> -1 means no one home + // list of dead guys for squads...in id values->-1 means no one home memcpy( &sDeadMercs, &sGeneralInfo.sDeadMercs, sizeof( INT16 ) * NUMBER_OF_SQUADS * NUMBER_OF_SOLDIERS_PER_SQUAD ); // level of public noises @@ -4825,7 +6079,7 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) gubScreenCount = sGeneralInfo.gubScreenCount; //used for the mean while screen - if ( guiSaveGameVersion < 71 ) + if ( guiCurrentSaveGameVersion < 71 ) { uiMeanWhileFlags = sGeneralInfo.usOldMeanWhileFlags; } @@ -4897,7 +6151,7 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) giHospitalTempBalance = sGeneralInfo.iHospitalTempBalance; giHospitalRefund = sGeneralInfo.iHospitalRefund; gbHospitalPriceModifier = sGeneralInfo.bHospitalPriceModifier; - gfPlayerTeamSawJoey = sGeneralInfo.fPlayerTeamSawJoey; + gfPlayerTeamSawJoey = sGeneralInfo.fPlayerTeamSawJoey; gfMikeShouldSayHi = sGeneralInfo.fMikeShouldSayHi; return( TRUE ); @@ -4949,7 +6203,7 @@ BOOLEAN LoadMeanwhileDefsFromSaveGameFile( HWFILE hFile ) { UINT32 uiNumBytesRead; - if ( guiSaveGameVersion < 72 ) + if ( guiCurrentSaveGameVersion < 72 ) { //Load the array of meanwhile defs FileRead( hFile, gMeanwhileDef, sizeof( MEANWHILE_DEFINITION ) * (NUM_MEANWHILES-1), &uiNumBytesRead ); @@ -5020,7 +6274,7 @@ void InitShutDownMapTempFileTest( BOOLEAN fInit, STR pNameOfFile, UINT8 ubSaveGa if( fInit ) { - guiNumberOfMapTempFiles = 0; //Test: To determine where the temp files are crashing + guiNumberOfMapTempFiles = 0; //Test: To determine where the temp files are crashing guiSizeOfTempFiles = 0; if( FileExists( zFileName ) ) @@ -5040,7 +6294,7 @@ void InitShutDownMapTempFileTest( BOOLEAN fInit, STR pNameOfFile, UINT8 ubSaveGa FileSeek( hFile, 0, FILE_SEEK_FROM_END ); - sprintf( zTempString, "Number Of Files: %6d. Size of all files: %6d.\n", guiNumberOfMapTempFiles, guiSizeOfTempFiles ); + sprintf( zTempString, "Number Of Files: %6d. Size of all files: %6d.\n", guiNumberOfMapTempFiles, guiSizeOfTempFiles ); uiStrLen = strlen( zTempString ); FileWrite( hFile, zTempString, uiStrLen, &uiNumBytesWritten ); @@ -5078,7 +6332,7 @@ void WriteTempFileNameToFile( STR pFileName, UINT32 uiSizeOfFile, HFILE hSaveFil FileSeek( hFile, 0, FILE_SEEK_FROM_END ); - sprintf( zTempString, "%8d %6d %s\n", FileGetPos( hSaveFile ), uiSizeOfFile, pFileName ); + sprintf( zTempString, "%8d %6d %s\n", FileGetPos( hSaveFile ), uiSizeOfFile, pFileName ); uiStrLen = strlen( zTempString ); FileWrite( hFile, zTempString, uiStrLen, &uiNumBytesWritten ); @@ -5116,7 +6370,6 @@ void GetBestPossibleSectorXYZValues( INT16 *psSectorX, INT16 *psSectorY, INT8 *p INT16 sSoldierCnt; SOLDIERTYPE *pSoldier; INT16 bLastTeamID; - //INT8 bCount=0; BOOLEAN fFoundAMerc=FALSE; // Set locator to first merc @@ -5128,7 +6381,7 @@ void GetBestPossibleSectorXYZValues( INT16 *psSectorX, INT16 *psSectorY, INT8 *p { if( pSoldier->bActive ) { - if ( pSoldier->bAssignment != IN_TRANSIT && !pSoldier->fBetweenSectors) + if ( pSoldier->bAssignment != IN_TRANSIT && !pSoldier->flags.fBetweenSectors) { //we found an alive, merc that is not moving *psSectorX = pSoldier->sSectorX; @@ -5439,7 +6692,7 @@ INT8 GetNumberForAutoSave( BOOLEAN fLatestAutoSave ) return( -1 ); } else - { + { if( CompareSGPFileTimes( &LastWriteTime1, &LastWriteTime2 ) > 0 ) return( 0 ); else @@ -5461,8 +6714,6 @@ void HandleOldBobbyRMailOrders() Assert(0); return; } - - memset( gpNewBobbyrShipments, 0, (sizeof( NewBobbyRayOrderStruct )* LaptopSaveInfo.usNumberOfBobbyRayOrderUsed) ); giNumberOfNewBobbyRShipment = LaptopSaveInfo.usNumberOfBobbyRayOrderUsed; @@ -5473,10 +6724,10 @@ void HandleOldBobbyRMailOrders() if( LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray[iCnt].fActive ) { //copy over the purchase info - memcpy( gpNewBobbyrShipments[ iNewListCnt ].BobbyRayPurchase, + memcpy( gpNewBobbyrShipments[ iNewListCnt ].BobbyRayPurchase, LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray[iCnt].BobbyRayPurchase, sizeof( BobbyRayPurchaseStruct ) * MAX_PURCHASE_AMOUNT ); - + gpNewBobbyrShipments[ iNewListCnt ].fActive = TRUE; gpNewBobbyrShipments[ iNewListCnt ].ubDeliveryLoc = BR_DRASSEN; gpNewBobbyrShipments[ iNewListCnt ].ubDeliveryMethod = 0; @@ -5496,7 +6747,7 @@ void HandleOldBobbyRMailOrders() } } - + UINT32 CalcJA2EncryptionSet( SAVED_GAME_HEADER * pSaveGameHeader ) { UINT32 uiEncryptionSet = 0; diff --git a/SaveLoadGame.h b/SaveLoadGame.h index ef8991ab..dda6b7e8 100644 --- a/SaveLoadGame.h +++ b/SaveLoadGame.h @@ -1,9 +1,13 @@ #ifndef _SAVE_LOAD_GAME_H_ #define _SAVE_LOAD_GAME_H_ -#include "Soldier Control.h" #include "GameSettings.h" +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + #define BYTESINMEGABYTE 1048576 //1024*1024 #define REQUIRED_FREE_SPACE (20 * BYTESINMEGABYTE) @@ -50,13 +54,15 @@ typedef struct UINT32 uiRandom; - UINT8 ubFiller[110]; + UINT8 ubInventorySystem; + + UINT8 ubFiller[109]; } SAVED_GAME_HEADER; extern UINT32 guiScreenToGotoAfterLoadingSavedGame; -extern UINT32 guiSaveGameVersion; +extern UINT32 guiCurrentSaveGameVersion; void CreateSavedGameFileNameFromNumber( UINT8 ubSaveGameID, STR pzNewFileName ); diff --git a/SaveLoadScreen.cpp b/SaveLoadScreen.cpp index bb6e7e5a..da88c237 100644 --- a/SaveLoadScreen.cpp +++ b/SaveLoadScreen.cpp @@ -7,23 +7,23 @@ #include "Font Control.h" #include "Game Clock.h" #include "Render Dirty.h" - #include "Text Input.h" + #include "Text Input.h" #include "SaveLoadGame.h" - #include "Stdio.h" + #include "Stdio.h" #include "WordWrap.h" #include "StrategicMap.h" #include "Finances.h" #include "WCheck.h" #include "Utilities.h" #include "Cursors.h" - #include "VObject.h" + #include "VObject.h" #include "Merc Hiring.h" #include "LaptopSave.h" #include "Options Screen.h" #include "GameVersion.h" - #include "SysUtil.h" + #include "SysUtil.h" #include "Tactical Save.h" - #include "OverHead.h" + #include "OverHead.h" #include "gamescreen.h" #include "GameSettings.h" #include "fade screen.h" @@ -45,7 +45,7 @@ extern UINT32 guiBrokenSaveGameVersion; ////////////////////////////////////////////////////// // -// Defines +// Defines // ////////////////////////////////////////////////////// @@ -112,7 +112,7 @@ extern UINT32 guiBrokenSaveGameVersion; #define SLG_TITLE_POS_X iScreenWidthOffset #define SLG_TITLE_POS_Y iScreenHeightOffset - + #define SLG_SAVE_CANCEL_POS_X iScreenWidthOffset + 226 #define SLG_LOAD_CANCEL_POS_X iScreenWidthOffset + 329 #define SLG_CANCEL_POS_Y iScreenHeightOffset + 438 @@ -127,7 +127,7 @@ extern UINT32 guiBrokenSaveGameVersion; //defines for saved game version status enum -{ +{ SLS_HEADER_OK, SLS_SAVED_GAME_VERSION_OUT_OF_DATE, SLS_GAME_VERSION_OUT_OF_DATE, @@ -136,7 +136,7 @@ enum ////////////////////////////////////////////////////// // -// Global Variables +// Global Variables // ////////////////////////////////////////////////////// @@ -176,7 +176,7 @@ UINT32 guiBackGroundAddOns; // The string that will contain the game desc text -CHAR16 gzGameDescTextField[ SIZE_OF_SAVE_GAME_DESC ] = {0} ; +CHAR16 gzGameDescTextField[ SIZE_OF_SAVE_GAME_DESC ] = {0} ; BOOLEAN gfUserInTextInputMode = FALSE; @@ -215,7 +215,7 @@ UINT32 guiSlgSaveLoadBtn; INT32 guiSaveLoadImage; //Mouse regions for the currently selected save game -MOUSE_REGION gSelectedSaveRegion[ NUM_SAVE_GAMES ]; +MOUSE_REGION gSelectedSaveRegion[ NUM_SAVE_GAMES ]; void SelectedSaveRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); void SelectedSaveRegionMovementCallBack(MOUSE_REGION * pRegion, INT32 reason ); @@ -225,7 +225,7 @@ void SelectedSLSEntireRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); ////////////////////////////////////////////////////// // -// Function Prototypes +// Function Prototypes // ////////////////////////////////////////////////////// @@ -272,7 +272,7 @@ void StartFadeOutForSaveLoadScreen(); ////////////////////////////////////////////////////// // -// Code +// Code // ////////////////////////////////////////////////////// @@ -353,8 +353,8 @@ UINT32 SaveLoadScreenHandle() //If we are not exiting the screen, render the buttons if( !gfSaveLoadScreenExit && guiSaveLoadExitScreen == SAVE_LOAD_SCREEN ) { - // render buttons marked dirty - RenderButtons( ); + // render buttons marked dirty + RenderButtons( ); } @@ -431,8 +431,8 @@ void SetSaveLoadExitScreen( UINT32 uiScreen ) SetPendingNewScreen( uiScreen ); #if 0 - // 0verhaul: This is a repeat of the previous line, but with a different variable set. - // None of it really makes sense. Why would a quicksave be different from a regular one? + // 0verhaul: This is a repeat of the previous line, but with a different variable set. + // None of it really makes sense. Why would a quicksave be different from a regular one? // Why should ctrl+L act differently than alt+L? if( gfDoingQuickLoad ) { @@ -451,10 +451,10 @@ void SetSaveLoadExitScreen( UINT32 uiScreen ) BOOLEAN EnterSaveLoadScreen() { INT8 i; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; UINT16 usPosX = SLG_FIRST_SAVED_SPOT_X; UINT16 usPosY = SLG_FIRST_SAVED_SPOT_Y; - + // WANNE: Do not draw the background black // Black background //ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0 ); @@ -485,19 +485,19 @@ BOOLEAN EnterSaveLoadScreen() { //make sure the save is valid if( gGameSettings.bLastSavedGameSlot != -1 && gbSaveGameArray[ gGameSettings.bLastSavedGameSlot ] ) - { - gbSelectedSaveLocation = gGameSettings.bLastSavedGameSlot; + { + gbSelectedSaveLocation = gGameSettings.bLastSavedGameSlot; //load the saved game ConfirmLoadSavedGameMessageBoxCallBack( MSG_BOX_RETURN_YES ); } - else + else { //else the save isnt valid, so dont load it gfLoadGameUponEntry = FALSE; } } - // load Main background graphic and add it + // load Main background graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("INTERFACE\\LoadScreen.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiSlgBackGroundImage)); @@ -518,12 +518,12 @@ BOOLEAN EnterSaveLoadScreen() // else usPosX = SLG_LOAD_CANCEL_POS_X; - guiSlgCancelBtn = CreateIconAndTextButton( guiSlgButtonImage, zSaveLoadText[SLG_CANCEL], OPT_BUTTON_FONT, - OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, - OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - usPosX, SLG_CANCEL_POS_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnSlgCancelCallback ); + guiSlgCancelBtn = CreateIconAndTextButton( guiSlgButtonImage, zSaveLoadText[SLG_CANCEL], OPT_BUTTON_FONT, + OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, + OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + usPosX, SLG_CANCEL_POS_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnSlgCancelCallback ); //Either the save or load button @@ -533,24 +533,24 @@ BOOLEAN EnterSaveLoadScreen() //If we are saving, dont have the save game button guiSaveLoadImage = UseLoadedButtonImage( guiSlgButtonImage, -1,5,-1,8,-1 ); - guiSlgSaveLoadBtn = CreateIconAndTextButton( guiSaveLoadImage, zSaveLoadText[SLG_SAVE_GAME], OPT_BUTTON_FONT, - OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, - OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - SLG_SAVE_LOAD_BTN_POS_X, SLG_SAVE_LOAD_BTN_POS_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnSlgSaveLoadCallback ); + guiSlgSaveLoadBtn = CreateIconAndTextButton( guiSaveLoadImage, zSaveLoadText[SLG_SAVE_GAME], OPT_BUTTON_FONT, + OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, + OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + SLG_SAVE_LOAD_BTN_POS_X, SLG_SAVE_LOAD_BTN_POS_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnSlgSaveLoadCallback ); } else { guiSaveLoadImage = UseLoadedButtonImage( guiSlgButtonImage, -1,4,-1,7,-1 ); - guiSlgSaveLoadBtn = CreateIconAndTextButton( guiSaveLoadImage, zSaveLoadText[SLG_LOAD_GAME], OPT_BUTTON_FONT, - OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, - OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - SLG_SAVE_LOAD_BTN_POS_X, SLG_SAVE_LOAD_BTN_POS_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, - DEFAULT_MOVE_CALLBACK, BtnSlgSaveLoadCallback ); + guiSlgSaveLoadBtn = CreateIconAndTextButton( guiSaveLoadImage, zSaveLoadText[SLG_LOAD_GAME], OPT_BUTTON_FONT, + OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, + OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + SLG_SAVE_LOAD_BTN_POS_X, SLG_SAVE_LOAD_BTN_POS_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnSlgSaveLoadCallback ); } //if we are loading, disable the load button @@ -568,8 +568,8 @@ BOOLEAN EnterSaveLoadScreen() for(i=0; iuiFlags |= BUTTON_FORCE_UNDIRTY; @@ -757,7 +757,7 @@ void ExitSaveLoadScreen() //Destroy the text fields ( if created ) DestroySaveLoadTextInputBoxes(); - MSYS_RemoveRegion( &gSLSEntireScreenRegion ); + MSYS_RemoveRegion( &gSLSEntireScreenRegion ); gfSaveLoadScreenEntry = TRUE; gfSaveLoadScreenExit = FALSE; @@ -782,7 +782,7 @@ void ExitSaveLoadScreen() void RenderSaveLoadScreen() { - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; //if we are going to be instantly leaving the screen, dont draw the numbers if( gfLoadGameUponEntry ) @@ -791,7 +791,7 @@ void RenderSaveLoadScreen() } GetVideoObject(&hPixHandle, guiSlgBackGroundImage); - BltVideoObject(FRAME_BUFFER, hPixHandle, 0, iScreenWidthOffset, iScreenHeightOffset, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, iScreenWidthOffset, iScreenHeightOffset, VO_BLT_SRCTRANSPARENCY,NULL); if( gfSaveGame ) { @@ -814,7 +814,7 @@ void RenderSaveLoadScreen() DisplaySaveGameList(); - InvalidateRegion( 0, 0, SCREEN_WIDTH , SCREEN_HEIGHT ); + InvalidateRegion( 0, 0, SCREEN_WIDTH , SCREEN_HEIGHT ); } @@ -844,12 +844,12 @@ void HandleSaveLoadScreen() void GetSaveLoadScreenUserInput() { InputAtom Event; - POINT MousePos; + POINT MousePos; INT8 bActiveTextField; static BOOLEAN fWasCtrlHeldDownLastFrame = FALSE; GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! + ScreenToClient(ghWindow, &MousePos); // In window coords! //if we are going to be instantly leaving the screen, dont draw the numbers if( gfLoadGameUponEntry ) @@ -878,24 +878,24 @@ void GetSaveLoadScreenUserInput() { // HOOK INTO MOUSE HOOKS switch( Event.usEvent) - { + { case LEFT_BUTTON_DOWN: MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; case LEFT_BUTTON_UP: - MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); + MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); break; case RIGHT_BUTTON_DOWN: MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - case RIGHT_BUTTON_UP: - MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + case RIGHT_BUTTON_UP: + MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - case RIGHT_BUTTON_REPEAT: - MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + case RIGHT_BUTTON_REPEAT: + MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - case LEFT_BUTTON_REPEAT: - MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + case LEFT_BUTTON_REPEAT: + MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; } @@ -1084,7 +1084,7 @@ void SaveLoadGameNumber( INT8 bSaveGameID ) SaveGameToSlotNum(); } } - else + else { //Check to see if the save game headers are the same ubRetVal = CompareSaveGameVersion( bSaveGameID ); @@ -1098,12 +1098,12 @@ void SaveLoadGameNumber( INT8 bSaveGameID ) { DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, zSaveLoadText[SLG_SAVED_GAME_VERSION_DIF], SAVE_LOAD_SCREEN, MSG_BOX_FLAG_YESNO, LoadSavedGameWarningMessageBoxCallBack ); } - else + else { DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, zSaveLoadText[SLG_BOTH_GAME_AND_SAVED_GAME_DIF], SAVE_LOAD_SCREEN, MSG_BOX_FLAG_YESNO, LoadSavedGameWarningMessageBoxCallBack ); } } - else + else { /* IF YOU UNCOMMENT THIS -- LOCALIZE IT!!! @@ -1123,7 +1123,7 @@ void SaveLoadGameNumber( INT8 bSaveGameID ) BOOLEAN DoSaveLoadMessageBoxWithRect( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect ) { // do message box and return - giSaveLoadMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT8 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, pCenteringRect ); + giSaveLoadMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT8 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, pCenteringRect ); // send back return state return( ( giSaveLoadMessageBox != -1 ) ); @@ -1131,10 +1131,10 @@ BOOLEAN DoSaveLoadMessageBoxWithRect( UINT8 ubStyle, const STR16 zString, UINT32 BOOLEAN DoSaveLoadMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ) { - SGPRect CenteringRect= {0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1 }; - + SGPRect CenteringRect= {0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1 }; + // do message box and return - giSaveLoadMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT8 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, &CenteringRect ); + giSaveLoadMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT8 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, &CenteringRect ); // send back return state return( ( giSaveLoadMessageBox != -1 ) ); @@ -1147,7 +1147,7 @@ BOOLEAN InitSaveGameArray() INT8 cnt; CHAR8 zSaveGameName[ 512 ]; SAVED_GAME_HEADER SaveGameHeader; - + for( cnt=0; cntuiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} @@ -1581,7 +1581,7 @@ void BtnSlgSaveLoadCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} /* void BtnSlgLoadCallback(GUI_BUTTON *btn,INT32 reason) @@ -1604,13 +1604,13 @@ void BtnSlgLoadCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} */ void SelectedSaveRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ INT8 bActiveTextField; if (iReason & MSYS_CALLBACK_REASON_INIT) @@ -1652,7 +1652,7 @@ void SelectedSaveRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) { //Destroy the previous region DestroySaveLoadTextInputBoxes(); - + gbSelectedSaveLocation = bSelected; //Reset the global string @@ -1684,7 +1684,7 @@ void SelectedSaveRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) uiLastTime = GetJA2Clock(); } - + //the user is selecting the selected save game slot else { @@ -1764,11 +1764,11 @@ void SelectedSaveRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) gbSaveGameSelectedLocation[ bSelected ] = SLG_SELECTED_SLOT_GRAPHICS_NUMBER; - } + } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { DisableSelectedSlot(); - } + } } @@ -1805,7 +1805,7 @@ void SelectedSaveRegionMovementCallBack(MOUSE_REGION * pRegion, INT32 reason ) InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); } -} +} @@ -1813,10 +1813,9 @@ void SelectedSaveRegionMovementCallBack(MOUSE_REGION * pRegion, INT32 reason ) void InitSaveLoadScreenTextInputBoxes() { - //UINT32 uiStartLoc=0; UINT16 usPosY; SAVED_GAME_HEADER SaveGameHeader; - + if( gbSelectedSaveLocation == -1 ) return; @@ -1834,10 +1833,10 @@ void InitSaveLoadScreenTextInputBoxes() SetTextInputFont( (UINT16) FONT12ARIALFIXEDWIDTH ); //FONT12ARIAL //FONT12ARIALFIXEDWIDTH Set16BPPTextFieldColor( Get16BPPColor(FROMRGB( 0, 0, 0) ) ); SetBevelColors( Get16BPPColor(FROMRGB(136, 138, 135)), Get16BPPColor(FROMRGB(24, 61, 81)) ); - SetTextInputRegularColors( FONT_WHITE, 2 ); - SetTextInputHilitedColors( 2, FONT_WHITE, FONT_WHITE ); + SetTextInputRegularColors( FONT_WHITE, 2 ); + SetTextInputHilitedColors( 2, FONT_WHITE, FONT_WHITE ); SetCursorColor( Get16BPPColor(FROMRGB(255, 255, 255) ) ); - + AddUserInputField( NULL ); usPosY = SLG_FIRST_SAVED_SPOT_Y + SLG_GAP_BETWEEN_LOCATIONS * gbSelectedSaveLocation; @@ -1880,7 +1879,7 @@ void SetSelection( UINT8 ubNewSelection ) // CHAR16 zMouseHelpTextString[256]; // SAVED_GAME_HEADER SaveGameHeader; - //if we are loading and there is no entry, return + //if we are loading and there is no entry, return if( !gfSaveGame ) { if( !gbSaveGameArray[ubNewSelection] ) @@ -1899,7 +1898,7 @@ void SetSelection( UINT8 ubNewSelection ) gfRedrawSaveLoadScreen = TRUE; DestroySaveLoadTextInputBoxes(); - //if we are loading, + //if we are loading, if( !gfSaveGame ) { //Enable the save/load button @@ -1913,7 +1912,7 @@ void SetSelection( UINT8 ubNewSelection ) { //Destroy the previous region DestroySaveLoadTextInputBoxes(); - + //reset selected slot gbSelectedSaveLocation = ubNewSelection; @@ -1978,7 +1977,7 @@ UINT8 CompareSaveGameVersion( INT8 bSaveGameID ) LoadSavedGameHeader( bSaveGameID, &SaveGameHeader ); // check to see if the saved game version in the header is the same as the current version - if( SaveGameHeader.uiSavedGameVersion != guiSavedGameVersion ) + if( SaveGameHeader.uiSavedGameVersion != SAVE_GAME_VERSION ) { ubRetVal = SLS_SAVED_GAME_VERSION_OUT_OF_DATE; } @@ -1998,7 +1997,7 @@ UINT8 CompareSaveGameVersion( INT8 bSaveGameID ) void LoadSavedGameWarningMessageBoxCallBack( UINT8 bExitValue ) { // yes, load the game - if( bExitValue == MSG_BOX_RETURN_YES ) + if( bExitValue == MSG_BOX_RETURN_YES ) { //Setup up the fade routines StartFadeOutForSaveLoadScreen(); @@ -2016,7 +2015,7 @@ void LoadSavedGameWarningMessageBoxCallBack( UINT8 bExitValue ) void LoadSavedGameDeleteAllSaveGameMessageBoxCallBack( UINT8 bExitValue ) { // yes, Delete all the save game files - if( bExitValue == MSG_BOX_RETURN_YES ) + if( bExitValue == MSG_BOX_RETURN_YES ) { DeleteAllSaveGameFile( ); gfSaveLoadScreenExit = TRUE; @@ -2089,7 +2088,7 @@ void DisplayOnScreenNumber( BOOLEAN fErase ) if( !fErase ) DrawTextToScreen( zTempString, usPosX, (UINT16)(usPosY+SLG_DATE_OFFSET_Y), 0, SAVE_LOAD_NUMBER_FONT, SAVE_LOAD_NUMBER_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - InvalidateRegion( usPosX, usPosY+SLG_DATE_OFFSET_Y, usPosX+10, usPosY+SLG_DATE_OFFSET_Y+10 ); + InvalidateRegion( usPosX, usPosY+SLG_DATE_OFFSET_Y, usPosX+10, usPosY+SLG_DATE_OFFSET_Y+10 ); usPosY += SLG_GAP_BETWEEN_LOCATIONS; } @@ -2123,8 +2122,17 @@ void DoneFadeOutForSaveLoadScreen( void ) } else { - DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, zSaveLoadText[SLG_LOAD_GAME_ERROR], SAVE_LOAD_SCREEN, MSG_BOX_FLAG_OK, FailedLoadingGameCallBack ); - NextLoopCheckForEnoughFreeHardDriveSpace(); + //CHRISL: New fail message if we failed because of screen res + if(UsingNewInventorySystem() == true && iResolution == 0) + { + DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, zSaveLoadText[SLG_INV_RES_ERROR], SAVE_LOAD_SCREEN, MSG_BOX_FLAG_OK, FailedLoadingGameCallBack ); + NextLoopCheckForEnoughFreeHardDriveSpace(); + } + else + { + DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, zSaveLoadText[SLG_LOAD_GAME_ERROR], SAVE_LOAD_SCREEN, MSG_BOX_FLAG_OK, FailedLoadingGameCallBack ); + NextLoopCheckForEnoughFreeHardDriveSpace(); + } } } else @@ -2151,7 +2159,7 @@ void DoneFadeOutForSaveLoadScreen( void ) { //if we are to go to the Tactical screen after loading gFadeInDoneCallback = DoneFadeInForSaveLoadScreen; - + SetSaveLoadExitScreen( guiScreenToGotoAfterLoadingSavedGame ); PauseTime( FALSE ); @@ -2169,7 +2177,7 @@ void DoneFadeOutForSaveLoadScreen( void ) void DoneFadeInForSaveLoadScreen( void ) { //Leave the screen - //if we are supposed to stay in tactical, due nothing, + //if we are supposed to stay in tactical, due nothing, //if we are supposed to goto mapscreen, leave tactical and go to mapscreen if( guiScreenToGotoAfterLoadingSavedGame == MAP_SCREEN ) @@ -2199,14 +2207,14 @@ void DoneFadeInForSaveLoadScreen( void ) void SelectedSLSEntireRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { DisableSelectedSlot(); - } + } } void DisableSelectedSlot() @@ -2229,7 +2237,7 @@ void ConfirmSavedGameMessageBoxCallBack( UINT8 bExitValue ) Assert( gbSelectedSaveLocation != -1 ); // yes, load the game - if( bExitValue == MSG_BOX_RETURN_YES ) + if( bExitValue == MSG_BOX_RETURN_YES ) { SaveGameToSlotNum(); } @@ -2241,7 +2249,7 @@ void ConfirmLoadSavedGameMessageBoxCallBack( UINT8 bExitValue ) Assert( gbSelectedSaveLocation != -1 ); // yes, load the game - if( bExitValue == MSG_BOX_RETURN_YES ) + if( bExitValue == MSG_BOX_RETURN_YES ) { //Setup up the fade routines StartFadeOutForSaveLoadScreen(); @@ -2276,7 +2284,7 @@ void ErrorDetectedInSaveCallback( UINT8 bValue ) void FailedLoadingGameCallBack( UINT8 bExitValue ) { // yes - if( bExitValue == MSG_BOX_RETURN_OK ) + if( bExitValue == MSG_BOX_RETURN_OK ) { //if the current screen is tactical if( guiPreviousOptionScreen == MAP_SCREEN ) @@ -2375,7 +2383,7 @@ BOOLEAN IsThereAnySavedGameFiles() { INT8 cnt; CHAR8 zSaveGameName[ 512 ]; - + for( cnt=0; cntuiFlags & BUTTON_DELETION_PENDING ) continue; + if( c->uiFlags & BUTTON_DELETION_PENDING ) continue; if( c->UserData[3] == 0xffffffff ) continue; if( b->Area.PriorityLevel != c->Area.PriorityLevel ) continue; if( b->Area.RegionTopLeftX != c->Area.RegionTopLeftX ) continue; @@ -106,7 +106,7 @@ void AssertFailIfIdenticalButtonAttributesFound( GUI_BUTTON *b ) if( b->XLoc != c->XLoc ) continue; if( b->YLoc != c->YLoc ) continue; //if we get this far, it is reasonably safe to assume that the newly created - //button already exists. Placing a break point on the following assert will + //button already exists. Placing a break point on the following assert will //allow the coder to easily isolate the case! sprintf( str, "Attempting to create a button that has already been created (existing buttonID %d).", c->IDNum ); AssertMsg( 0, str ); @@ -118,7 +118,7 @@ void AssertFailIfIdenticalButtonAttributesFound( GUI_BUTTON *b ) //These are the variables used for the anchoring of a particular button. //When you click on a button, it get's anchored, until you release the mouse button. //When you move around, you don't want to select other buttons, even when you release -//it. This follows the Windows 95 convention. +//it. This follows the Windows 95 convention. GUI_BUTTON *gpAnchoredButton; GUI_BUTTON *gpPrevAnchoredButton; BOOLEAN gfAnchoredState; @@ -216,7 +216,7 @@ INT32 LoadButtonImage(const STR8 filename, INT32 Grayed, INT32 OffNormal, INT32 // is there ANY file to open? if((Grayed == BUTTON_NO_IMAGE) && (OffNormal == BUTTON_NO_IMAGE) && (OffHilite == BUTTON_NO_IMAGE) && - (OnNormal == BUTTON_NO_IMAGE) && (OnHilite == BUTTON_NO_IMAGE)) + (OnNormal == BUTTON_NO_IMAGE) && (OnHilite == BUTTON_NO_IMAGE)) { DbgMessage(TOPIC_BUTTON_HANDLER, DBG_LEVEL_0, String("No button pictures selected for %s",filename)); return(-1); @@ -351,7 +351,7 @@ INT32 UseLoadedButtonImage(INT32 LoadedImg, INT32 Grayed, INT32 OffNormal, INT32 // is there ANY file to open? if((Grayed == BUTTON_NO_IMAGE) && (OffNormal == BUTTON_NO_IMAGE) && (OffHilite == BUTTON_NO_IMAGE) && - (OnNormal == BUTTON_NO_IMAGE) && (OnHilite == BUTTON_NO_IMAGE)) + (OnNormal == BUTTON_NO_IMAGE) && (OnHilite == BUTTON_NO_IMAGE)) { DbgMessage(TOPIC_BUTTON_HANDLER, DBG_LEVEL_0, String("No button pictures selected for pre-loaded button image %d",LoadedImg)); return(-1); @@ -473,7 +473,7 @@ INT32 UseVObjAsButtonImage(HVOBJECT hVObject, INT32 Grayed, INT32 OffNormal, INT // is there ANY file to open? if((Grayed == BUTTON_NO_IMAGE) && (OffNormal == BUTTON_NO_IMAGE) && (OffHilite == BUTTON_NO_IMAGE) && - (OnNormal == BUTTON_NO_IMAGE) && (OnHilite == BUTTON_NO_IMAGE)) + (OnNormal == BUTTON_NO_IMAGE) && (OnHilite == BUTTON_NO_IMAGE)) { DbgMessage(TOPIC_BUTTON_HANDLER, DBG_LEVEL_0, String("UseVObjAsButtonImage: No button pictures indexes selected for VObject")); return(-1); @@ -908,7 +908,7 @@ INT16 LoadGenericButtonIcon(const STR8 filename) // BOOLEAN UnloadGenericButtonIcon(INT16 GenImg) { - if( GenImg < 0 || GenImg >= MAX_BUTTON_ICONS ) + if( GenImg < 0 || GenImg >= MAX_BUTTON_ICONS ) { sprintf( str, "Attempting to UnloadGenericButtonIcon with out of range index %d.", GenImg ); AssertMsg( 0, str ); @@ -939,7 +939,7 @@ BOOLEAN UnloadGenericButtonIcon(INT16 GenImg) BOOLEAN UnloadGenericButtonImage(INT16 GenImg) { BOOLEAN fDeletedSomething = FALSE; - if( GenImg < 0 || GenImg >= MAX_GENERIC_PICS ) + if( GenImg < 0 || GenImg >= MAX_GENERIC_PICS ) { sprintf( str, "Attempting to UnloadGenericButtonImage with out of range index %d.", GenImg ); AssertMsg( 0, str ); @@ -1317,7 +1317,7 @@ void RemoveButton(INT32 iButtonID) //Kris: if( b->uiFlags & BUTTON_SELFDELETE_IMAGE ) { //checkboxes and simple create buttons have their own graphics associated with them, - //and it is handled internally. We delete it here. This provides the advantage of less + //and it is handled internally. We delete it here. This provides the advantage of less //micromanagement, but with the disadvantage of wasting more memory if you have lots of //buttons using the same graphics. UnloadButtonImage( b->ImageNum ); @@ -1518,8 +1518,8 @@ INT32 SetButtonIcon( INT32 iButtonID, INT16 Icon, INT16 IconIndex ) // If button isn't an icon button, ignore this call if(((b->uiFlags & BUTTON_TYPES) == BUTTON_QUICK) || - ((b->uiFlags & BUTTON_TYPES) == BUTTON_HOT_SPOT) || - ((b->uiFlags & BUTTON_TYPES) == BUTTON_GENERIC)) + ((b->uiFlags & BUTTON_TYPES) == BUTTON_HOT_SPOT) || + ((b->uiFlags & BUTTON_TYPES) == BUTTON_GENERIC)) { return -1; } @@ -1714,7 +1714,7 @@ INT32 CreateTextButton(STR16 string, UINT32 uiFont, INT16 sForeColor, INT16 sSha if ( string && wcslen( string ) ) { b->string = (STR16) MemAlloc( (wcslen(string)+1)*sizeof(CHAR16) ); - AssertMsg( b->string, "Out of memory error: Couldn't allocate string in CreateTextButton." ); + AssertMsg( b->string, "Out of memory error: Couldn't allocate string in CreateTextButton." ); wcscpy( b->string, string ); } @@ -1905,11 +1905,11 @@ INT32 CreateHotSpot(INT16 xloc, INT16 yloc, INT16 Width, INT16 Height,INT16 Prio // will simply set the cursor for the mouse region the button occupies BOOLEAN SetButtonCursor(INT32 iBtnId, UINT16 crsr) { - GUI_BUTTON *b; - b = ButtonList[iBtnId]; + GUI_BUTTON *b; + b = ButtonList[iBtnId]; if (!b) return FALSE; - b->Area.Cursor = crsr; + b->Area.Cursor = crsr; return TRUE; } @@ -2033,7 +2033,7 @@ INT32 QuickCreateButton(UINT32 Image,INT16 xloc,INT16 yloc,INT32 Type,INT16 Prio memset( &b->Area, 0, sizeof( MOUSE_REGION ) ); // Define a MOUSE_REGION for this QuickButton MSYS_DefineRegion(&b->Area,(UINT16)xloc,(UINT16)yloc, - (UINT16)(xloc+(INT16)ButtonPictures[Image].MaxWidth), + (UINT16)(xloc+(INT16)ButtonPictures[Image].MaxWidth), (UINT16)(yloc+(INT16)ButtonPictures[Image].MaxHeight), (INT8)Priority, MSYS_STARTING_CURSORVAL, (MOUSE_CALLBACK)QuickButtonCallbackMMove, @@ -2060,16 +2060,16 @@ INT32 QuickCreateButton(UINT32 Image,INT16 xloc,INT16 yloc,INT32 Type,INT16 Prio return(ButtonNum); } -//A hybrid of QuickCreateButton. Takes a lot less parameters, but makes more assumptions. It self manages the -//loading, and deleting of the image. The size of the image determines the size of the button. It also uses -//the default move callback which emulates Win95. Finally, it sets the priority to normal. The function you +//A hybrid of QuickCreateButton. Takes a lot less parameters, but makes more assumptions. It self manages the +//loading, and deleting of the image. The size of the image determines the size of the button. It also uses +//the default move callback which emulates Win95. Finally, it sets the priority to normal. The function you //choose also determines the type of button (toggle, notoggle, or newtoggle) INT32 CreateEasyNoToggleButton ( INT32 x, INT32 y, const STR8 filename, GUI_CALLBACK ClickCallback ) { return CreateSimpleButton( x, y, filename, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, ClickCallback ); } -INT32 CreateEasyToggleButton ( INT32 x, INT32 y, const STR8 filename, GUI_CALLBACK ClickCallback ) +INT32 CreateEasyToggleButton ( INT32 x, INT32 y, const STR8 filename, GUI_CALLBACK ClickCallback ) { return CreateSimpleButton( x, y, filename, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, ClickCallback ); } @@ -2111,11 +2111,11 @@ INT32 CreateSimpleButton( INT32 x, INT32 y, const STR8 filename, INT32 Type, INT } INT32 CreateIconAndTextButton( INT32 Image, const STR16 string, UINT32 uiFont, - INT16 sForeColor, INT16 sShadowColor, - INT16 sForeColorDown, INT16 sShadowColorDown, - INT8 bJustification, - INT16 xloc, INT16 yloc, INT32 Type, INT16 Priority, - GUI_CALLBACK MoveCallback,GUI_CALLBACK ClickCallback) + INT16 sForeColor, INT16 sShadowColor, + INT16 sForeColorDown, INT16 sShadowColorDown, + INT8 bJustification, + INT16 xloc, INT16 yloc, INT32 Type, INT16 Priority, + GUI_CALLBACK MoveCallback,GUI_CALLBACK ClickCallback) { GUI_BUTTON *b; INT32 iButtonID; @@ -2173,10 +2173,10 @@ INT32 CreateIconAndTextButton( INT32 Image, const STR16 string, UINT32 uiFont, // Allocate memory for the button's text string... b->string = NULL; - if ( string ) + if ( string ) { b->string = (STR16) MemAlloc( (wcslen(string)+1)*sizeof(CHAR16) ); - AssertMsg( b->string, "Out of memory error: Couldn't allocate string in CreateIconAndTextButton." ); + AssertMsg( b->string, "Out of memory error: Couldn't allocate string in CreateIconAndTextButton." ); wcscpy( b->string, string ); } @@ -2219,7 +2219,7 @@ INT32 CreateIconAndTextButton( INT32 Image, const STR16 string, UINT32 uiFont, // Define a MOUSE_REGION for this QuickButton MSYS_DefineRegion(&b->Area,(UINT16)xloc,(UINT16)yloc, - (UINT16)(xloc+(INT16)ButtonPictures[Image].MaxWidth), + (UINT16)(xloc+(INT16)ButtonPictures[Image].MaxWidth), (UINT16)(yloc+(INT16)ButtonPictures[Image].MaxHeight), (INT8)Priority, MSYS_STARTING_CURSORVAL, (MOUSE_CALLBACK)QuickButtonCallbackMMove, @@ -2338,7 +2338,7 @@ void SpecifyButtonTextJustification( INT32 iButtonID, INT8 bJustification ) Assert( iButtonID < MAX_BUTTONS ); b = ButtonList[ iButtonID ]; Assert( b ); - //Range check: if invalid, then set it to center justified. + //Range check: if invalid, then set it to center justified. if( bJustification < BUTTON_TEXT_LEFT || bJustification > BUTTON_TEXT_RIGHT ) bJustification = BUTTON_TEXT_CENTER; b->bJustification = bJustification; @@ -2361,7 +2361,7 @@ void SpecifyFullButtonTextAttributes( INT32 iButtonID, STR16 string, INT32 uiFon b->sShadowColor = sShadowColor; b->sForeColorDown = sForeColorDown; b->sShadowColorDown = sShadowColorDown; - //Range check: if invalid, then set it to center justified. + //Range check: if invalid, then set it to center justified. if( bJustification < BUTTON_TEXT_LEFT || bJustification > BUTTON_TEXT_RIGHT ) bJustification = BUTTON_TEXT_CENTER; b->bJustification = bJustification; @@ -2436,11 +2436,11 @@ void SpecifyDisabledButtonStyle( INT32 iButtonID, INT8 bStyle ) } -//Note: Text is always on top +//Note: Text is always on top //If fShiftImage is true, then the image will shift down one pixel and right one pixel //just like the text does. BOOLEAN SpecifyButtonIcon( INT32 iButtonID, INT32 iVideoObjectID, UINT16 usVideoObjectIndex, - INT8 bXOffset, INT8 bYOffset, BOOLEAN fShiftImage ) + INT8 bXOffset, INT8 bYOffset, BOOLEAN fShiftImage ) { GUI_BUTTON *b; @@ -2573,11 +2573,11 @@ void QuickButtonCallbackMMove(MOUSE_REGION *reg,INT32 reason) AssertMsg( b != NULL, str ); if( !b ) - return; //This is getting called when Adding new regions... + return; //This is getting called when Adding new regions... if( b->uiFlags & BUTTON_ENABLED && - reason & (MSYS_CALLBACK_REASON_LOST_MOUSE | MSYS_CALLBACK_REASON_GAIN_MOUSE) ) + reason & (MSYS_CALLBACK_REASON_LOST_MOUSE | MSYS_CALLBACK_REASON_GAIN_MOUSE) ) { b->uiFlags |= BUTTON_DIRTY; } @@ -2717,14 +2717,14 @@ void QuickButtonCallbackMButn( MOUSE_REGION *reg, INT32 reason ) //Kris: //Set the anchored button incase the user moves mouse off region while still holding - //down the button, but only if the button is up. In Win95, buttons that are already + //down the button, but only if the button is up. In Win95, buttons that are already //down, and anchored never change state, unless you release the mouse in the button area. if( b->MoveCallback == DEFAULT_MOVE_CALLBACK && b->uiFlags & BUTTON_ENABLED ) { if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - gpAnchoredButton = b; + gpAnchoredButton = b; gfAnchoredState = StateBefore; b->uiFlags |= BUTTON_CLICKED_ON; } @@ -2742,7 +2742,7 @@ void QuickButtonCallbackMButn( MOUSE_REGION *reg, INT32 reason ) gpAnchoredButton = b; gfAnchoredState = StateBefore; - //Trick the before state of the button to be different so the sound will play properly as checkbox buttons + //Trick the before state of the button to be different so the sound will play properly as checkbox buttons //are processed differently. StateBefore = (b->uiFlags & BUTTON_CLICKED_ON) ? FALSE : TRUE; StateAfter = !StateBefore; @@ -2750,7 +2750,7 @@ void QuickButtonCallbackMButn( MOUSE_REGION *reg, INT32 reason ) else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { b->uiFlags ^= BUTTON_CLICKED_ON; //toggle the checkbox state upon release inside button area. - //Trick the before state of the button to be different so the sound will play properly as checkbox buttons + //Trick the before state of the button to be different so the sound will play properly as checkbox buttons //are processed differently. StateBefore = (b->uiFlags & BUTTON_CLICKED_ON) ? FALSE : TRUE; StateAfter = !StateBefore; @@ -2781,7 +2781,7 @@ void QuickButtonCallbackMButn( MOUSE_REGION *reg, INT32 reason ) // If there is a callback function with this button, call it if(b->uiFlags & BUTTON_CLICK_CALLBACK) { - //Kris: January 6, 1998 + //Kris: January 6, 1998 //Added these checks to avoid a case where it was possible to process a leftbuttonup message when //the button wasn't anchored, and should have been. gfDelayButtonDeletion = TRUE; @@ -2847,7 +2847,7 @@ void RenderButtons(void) for(iButtonID=0;iButtonIDArea.uiFlags & MSYS_REGION_ENABLED ) { @@ -2916,10 +2916,10 @@ void RenderButtons(void) // void MarkAButtonDirty( INT32 iButtonNum ) { - // surgical dirtying -> marks a user specified button dirty, without dirty the whole lot of them + // surgical dirtying->marks a user specified button dirty, without dirty the whole lot of them - // If the button exists, and it's not owned by another object, draw it + // If the button exists, and it's not owned by another object, draw it if( ButtonList[ iButtonNum ] ) { // Turn on dirty flag @@ -2948,10 +2948,10 @@ void MarkButtonsDirty( void ) void UnMarkButtonDirty( INT32 iButtonIndex ) { - if ( ButtonList[ iButtonIndex ] ) - { - ButtonList[ iButtonIndex ]->uiFlags &= ~( BUTTON_DIRTY ); - } + if ( ButtonList[ iButtonIndex ] ) + { + ButtonList[ iButtonIndex ]->uiFlags &= ~( BUTTON_DIRTY ); + } } void UnmarkButtonsDirty( void ) @@ -3003,10 +3003,10 @@ BOOLEAN DrawButton(INT32 iButtonID ) if( ButtonList[ iButtonID ]->string ) SaveFontSettings(); // Draw this button - if( ButtonList[ iButtonID ]->Area.uiFlags & MSYS_REGION_ENABLED ) - { - DrawButtonFromPtr( ButtonList[ iButtonID ] ); - } + if( ButtonList[ iButtonID ]->Area.uiFlags & MSYS_REGION_ENABLED ) + { + DrawButtonFromPtr( ButtonList[ iButtonID ] ); + } if( ButtonList[ iButtonID ]->string ) RestoreFontSettings(); @@ -3037,7 +3037,7 @@ void DrawButtonFromPtr(GUI_BUTTON *b) case BUTTON_HOT_SPOT: if(b->uiFlags & BUTTON_NO_TOGGLE) b->uiFlags &= (~BUTTON_CLICKED_ON); - return; //hotspots don't have text, but if you want to, change this to a break! + return; //hotspots don't have text, but if you want to, change this to a break! case BUTTON_CHECKBOX: DrawCheckBoxButton(b); break; @@ -3118,13 +3118,13 @@ void DrawQuickButton(GUI_BUTTON *b) // Display the button image BltVideoObject(ButtonDestBuffer, ButtonPictures[b->ImageNum].vobj, - (UINT16)UseImage, b->XLoc, b->YLoc, - VO_BLT_SRCTRANSPARENCY, NULL); + (UINT16)UseImage, b->XLoc, b->YLoc, + VO_BLT_SRCTRANSPARENCY, NULL); } void DrawHatchOnButton( GUI_BUTTON *b ) { - UINT8 *pDestBuf; + UINT8 *pDestBuf; UINT32 uiDestPitchBYTES; SGPRect ClipRect; ClipRect.iLeft = b->Area.RegionTopLeftX; @@ -3157,7 +3157,7 @@ void DrawDefaultOnButton( GUI_BUTTON *b ) pDestBuf = LockVideoSurface( ButtonDestBuffer, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); if( b->bDefaultStatus == DEFAULT_STATUS_DARKBORDER || b->bDefaultStatus == DEFAULT_STATUS_WINDOWS95 ) - { + { //left (one thick) LineDraw( TRUE, b->Area.RegionTopLeftX-1, b->Area.RegionTopLeftY-1, b->Area.RegionTopLeftX-1, b->Area.RegionBottomRightY+1, 0, pDestBuf ); //top (one thick) @@ -3239,7 +3239,7 @@ void DrawCheckBoxButton( GUI_BUTTON *b ) { // Is the mouse over the button, and do we have hilite image? if( b->Area.uiFlags & MSYS_MOUSE_IN_AREA && gfRenderHilights && - gfLeftButtonState && + gfLeftButtonState && ButtonPictures[b->ImageNum].OffHilite != -1 ) UseImage = ButtonPictures[b->ImageNum].OffHilite; // Use Off-Hilite image else if(ButtonPictures[b->ImageNum].OffNormal != -1) @@ -3270,8 +3270,8 @@ void DrawCheckBoxButton( GUI_BUTTON *b ) // Display the button image BltVideoObject(ButtonDestBuffer, ButtonPictures[b->ImageNum].vobj, - (UINT16)UseImage, b->XLoc, b->YLoc, - VO_BLT_SRCTRANSPARENCY, NULL); + (UINT16)UseImage, b->XLoc, b->YLoc, + VO_BLT_SRCTRANSPARENCY, NULL); } void DrawIconOnButton(GUI_BUTTON *b) @@ -3370,10 +3370,10 @@ void DrawIconOnButton(GUI_BUTTON *b) // Blit the icon if( b->uiFlags & BUTTON_GENERIC ) BltVideoObject( ButtonDestBuffer,GenericButtonIcons[b->iIconID], b->usIconIndex, (INT16)xp, (INT16)yp, - VO_BLT_SRCTRANSPARENCY, NULL); + VO_BLT_SRCTRANSPARENCY, NULL); else BltVideoObject( ButtonDestBuffer, hvObject, b->usIconIndex, (INT16)xp, (INT16)yp, - VO_BLT_SRCTRANSPARENCY, NULL ); + VO_BLT_SRCTRANSPARENCY, NULL ); // Restore previous clip region SetClippingRect(&OldClip); } @@ -3518,23 +3518,23 @@ void DrawTextOnButton(GUI_BUTTON *b) { //Kris: //There needs to be recalculation of the start positions based on the - //justification and the width specified wrapped width. I was drawing a + //justification and the width specified wrapped width. I was drawing a //double lined word on the right side of the button to find it drawing way - //over to the left. I've added the necessary code for the right and center + //over to the left. I've added the necessary code for the right and center //justification. yp = b->Area.RegionTopLeftY + 2; - + switch( b->bJustification ) { case BUTTON_TEXT_RIGHT: xp = b->Area.RegionBottomRightX - 3 - b->sWrappedWidth; - + if( b->fShiftText && b->uiFlags & BUTTON_CLICKED_ON ) xp++, yp++; break; case BUTTON_TEXT_CENTER: xp = b->Area.RegionTopLeftX + 3 + b->sWrappedWidth/2; - + if( b->fShiftText && b->uiFlags & BUTTON_CLICKED_ON ) xp++, yp++; break; @@ -3643,10 +3643,10 @@ void DrawGenericButton(GUI_BUTTON *b) // Fill the button's area with the button's background color ColorFillVideoSurfaceArea(ButtonDestBuffer,b->Area.RegionTopLeftX, - b->Area.RegionTopLeftY, - b->Area.RegionBottomRightX, - b->Area.RegionBottomRightY, - GenericButtonFillColors[b->ImageNum]); + b->Area.RegionTopLeftY, + b->Area.RegionBottomRightX, + b->Area.RegionBottomRightY, + GenericButtonFillColors[b->ImageNum]); // If there is a background image, fill the button's area with it if(GenericButtonBackground[b->ImageNum]!=NULL) @@ -3659,13 +3659,13 @@ void DrawGenericButton(GUI_BUTTON *b) // Fill the area with the image, tilling it if need be. ImageFillVideoSurfaceArea(ButtonDestBuffer,b->Area.RegionTopLeftX+ox, - b->Area.RegionTopLeftY+oy, - b->Area.RegionBottomRightX, - b->Area.RegionBottomRightY, - GenericButtonBackground[b->ImageNum], - GenericButtonBackgroundIndex[b->ImageNum], - GenericButtonOffsetX[b->ImageNum], - GenericButtonOffsetY[b->ImageNum]); + b->Area.RegionTopLeftY+oy, + b->Area.RegionBottomRightX, + b->Area.RegionBottomRightY, + GenericButtonBackground[b->ImageNum], + GenericButtonBackgroundIndex[b->ImageNum], + GenericButtonOffsetX[b->ImageNum], + GenericButtonOffsetY[b->ImageNum]); } // Lock the dest buffer @@ -4114,7 +4114,7 @@ INT32 CreateCheckBoxButton( INT16 x, INT16 y, const STR8 filename, INT16 Priorit // Added Oct17, 97 Carter - kind of mindless, but might as well have it void MSYS_SetBtnUserData(INT32 iButtonNum,INT32 index,INT32 userdata) { - GUI_BUTTON *b; + GUI_BUTTON *b; b=ButtonList[iButtonNum]; if((index < 0) || (index > 3)) return; @@ -4168,11 +4168,11 @@ void BtnGenericMouseMoveButtonCallback(GUI_BUTTON *btn,INT32 reason) void ReleaseAnchorMode() { - if( !gpAnchoredButton ) + if( !gpAnchoredButton ) return; if( gusMouseXPos < gpAnchoredButton->Area.RegionTopLeftX || - gusMouseXPos > gpAnchoredButton->Area.RegionBottomRightX || + gusMouseXPos > gpAnchoredButton->Area.RegionBottomRightX || gusMouseYPos < gpAnchoredButton->Area.RegionTopLeftY || gusMouseYPos > gpAnchoredButton->Area.RegionBottomRightY ) { @@ -4299,7 +4299,7 @@ void GiveButtonDefaultStatus( INT32 iButtonID, INT32 iDefaultStatus ) if( b->bDefaultStatus != (INT8)iDefaultStatus ) { b->bDefaultStatus = (INT8)iDefaultStatus; - b->uiFlags |= BUTTON_DIRTY; + b->uiFlags |= BUTTON_DIRTY; } } @@ -4314,7 +4314,7 @@ void RemoveButtonDefaultStatus( INT32 iButtonID ) if( b->bDefaultStatus ) { b->bDefaultStatus = DEFAULT_STATUS_NONE; - b->uiFlags |= BUTTON_DIRTY; + b->uiFlags |= BUTTON_DIRTY; } } diff --git a/Standard Gaming Platform/Compression.cpp b/Standard Gaming Platform/Compression.cpp index bf371583..d128b286 100644 --- a/Standard Gaming Platform/Compression.cpp +++ b/Standard Gaming Platform/Compression.cpp @@ -13,7 +13,7 @@ voidpf ZAlloc( voidpf opaque, uInt items, uInt size ) { - return( MemAlloc( items * size ) ); + return( MemAlloc( items * size ) ); } void ZFree( voidpf opaque, voidpf address ) @@ -25,9 +25,9 @@ PTR DecompressInit( BYTE * pCompressedData, UINT32 uiDataSize ) { z_stream * pZStream; int iZRetCode; - + // allocate memory for the z_stream struct - pZStream = MemAlloc( sizeof( z_stream ) ); + pZStream = (z_stream *)MemAlloc( sizeof( z_stream ) ); if( pZStream == NULL ) { // out of memory! return( NULL ); @@ -37,7 +37,7 @@ PTR DecompressInit( BYTE * pCompressedData, UINT32 uiDataSize ) pZStream->zalloc = ZAlloc; pZStream->zfree = ZFree; pZStream->opaque = NULL; - + // call the ZLIB init routine iZRetCode = inflateInit( pZStream ); if( iZRetCode != Z_OK ) @@ -45,7 +45,7 @@ PTR DecompressInit( BYTE * pCompressedData, UINT32 uiDataSize ) MemFree( pZStream ); return( NULL ); } - + // set up our parameters pZStream->next_in = pCompressedData; pZStream->avail_in = uiDataSize; @@ -73,7 +73,7 @@ UINT32 Decompress( PTR pDecompPtr, BYTE * pBuffer, UINT32 uiBufferLen ) // decompress! iZRetCode = inflate( pZStream, Z_PARTIAL_FLUSH ); Assert( iZRetCode == Z_OK || iZRetCode == Z_STREAM_END ); - + return( uiBufferLen - pZStream->avail_out ); } @@ -100,9 +100,9 @@ PTR CompressInit( BYTE * pUncompressedData, UINT32 uiDataSize ) { z_stream * pZStream; int iZRetCode; - + // allocate memory for the z_stream struct - pZStream = MemAlloc( sizeof( z_stream ) ); + pZStream = (z_stream *)MemAlloc( sizeof( z_stream ) ); if( pZStream == NULL ) { // out of memory! return( NULL ); @@ -112,7 +112,7 @@ PTR CompressInit( BYTE * pUncompressedData, UINT32 uiDataSize ) pZStream->zalloc = ZAlloc; pZStream->zfree = ZFree; pZStream->opaque = NULL; - + // call the ZLIB init routine iZRetCode = deflateInit( pZStream, Z_BEST_COMPRESSION ); if( iZRetCode != Z_OK ) @@ -120,7 +120,7 @@ PTR CompressInit( BYTE * pUncompressedData, UINT32 uiDataSize ) MemFree( pZStream ); return( NULL ); } - + // set up our parameters pZStream->next_in = pUncompressedData; pZStream->avail_in = uiDataSize; @@ -148,7 +148,7 @@ UINT32 Compress( PTR pCompPtr, BYTE * pBuffer, UINT32 uiBufferLen ) // decompress! iZRetCode = deflate( pZStream, Z_FINISH ); Assert( iZRetCode == Z_STREAM_END ); - + return( uiBufferLen - pZStream->avail_out ); } diff --git a/Standard Gaming Platform/Compression.h b/Standard Gaming Platform/Compression.h index 3f0fb7ad..f1fb6210 100644 --- a/Standard Gaming Platform/Compression.h +++ b/Standard Gaming Platform/Compression.h @@ -9,16 +9,16 @@ // To decompress: // // 1) call DecompressInit() with a pointer to your compressed data, and the -// size of that compressed data. DecompressInit() returns a "decompression +// size of that compressed data. DecompressInit() returns a "decompression // pointer" that you should pass to Decompress() and DecompressFini() // // 2) call Decompress() with the decompression pointer, a pointer to a -// buffer for decompressed data, and the length of that buffer. If the +// buffer for decompressed data, and the length of that buffer. If the // buffer is not large enough to hold all of the decompressed data, // Decompress() will fill it completely, and you can call Decompress() again -// to continue your decompression. You are responsible for knowing the -// size your data will be after decompression. (The STI/STCI file format -// records your original data size for you...) Decompress() returns the +// to continue your decompression. You are responsible for knowing the +// size your data will be after decompression. (The STI/STCI file format +// records your original data size for you...) Decompress() returns the // number of bytes of output. // // 3) call DecompressFini() with the decompression pointer when you're done @@ -30,16 +30,16 @@ void DecompressFini( PTR pDecompPtr ); // To compress: // // 1) call CompressInit() with a pointer to your uncompressed data, and the -// size of that uncompressed data. CompressInit() returns a "compression +// size of that uncompressed data. CompressInit() returns a "compression // pointer" that you should pass to Compress() and CompressFini() // // 2) call Compress() with the compression pointer, a pointer to a -// buffer for compressed data, and the length of that buffer. If the +// buffer for compressed data, and the length of that buffer. If the // buffer is not large enough to hold all of the compressed data, // Compress() will fill it completely, and you can call Compress() again -// with a new or emptied buffer to continue your compression later. You +// with a new or emptied buffer to continue your compression later. You // can call CompressedBufferSize() to determine the largest buffer size you -// should need for a certain number of bytes. Ccompress() returns the number +// should need for a certain number of bytes. Ccompress() returns the number // of bytes of output. // // 3) call CompressFini() with the compression pointer when you're done diff --git a/Standard Gaming Platform/Container.cpp b/Standard Gaming Platform/Container.cpp index f1728b26..56b8845c 100644 --- a/Standard Gaming Platform/Container.cpp +++ b/Standard Gaming Platform/Container.cpp @@ -4,7 +4,7 @@ // // Purpose : Function definition for the Container // -// Modification History : +// Modification History : // 25 nov 96 TS creation // // 19 Dec 97 AM Replace all memcpy() with memmove(), since overlap possibilities @@ -12,13 +12,13 @@ // While the memcpy() was working in _DEBUG mode, it was failing // reproducibly in RELEASE mode whenever regions overlapped! // Having read the code, I strongly suggest that you DO NOT use this -// stuff at all and write your own instead. Tarun was no Carmack... +// stuff at all and write your own instead. Tarun was no Carmack... // - Alex Meduna // 1998 KM Detached all references to this file from JA2 as it caused a lot of hard to debug -// crashes. The VOBJECT/VSURFACE lists are now self-maintained and no longer use the -// this crap. DON'T USE THIS -- NO MATTER WHAT!!! +// crashes. The VOBJECT/VSURFACE lists are now self-maintained and no longer use the +// this crap. DON'T USE THIS -- NO MATTER WHAT!!! //***************************************************************************** - + #ifdef JA2_PRECOMPILED_HEADERS #include "JA2 SGP ALL.H" #elif defined( WIZ8_PRECOMPILED_HEADERS ) @@ -87,13 +87,13 @@ typedef struct OrdHeaderTag // // CreateStack // -// Parameter List : num_items - estimated number +// Parameter List : num_items - estimated number // of items in stack // siz_each - size of each item // Return Value NULL if unsuccesful -// pointer to allocated memory +// pointer to allocated memory // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** @@ -110,7 +110,7 @@ HSTACK CreateStack(UINT32 uiNum_items, UINT32 uiSiz_each) { DbgMessage(TOPIC_STACK_CONTAINERS, DBG_LEVEL_0, "Requested stack items and size have to be >0"); return NULL; - } + } // allocate the container memory if ((hStack = MemAlloc(uiAmount + sizeof(StackHeader))) == 0) { @@ -122,9 +122,9 @@ HSTACK CreateStack(UINT32 uiNum_items, UINT32 uiSiz_each) pStack->uiMax_size = uiAmount + sizeof(StackHeader); pStack->uiTotal_items = 0; pStack->uiSiz_of_elem = uiSiz_each; - + // return the pointer to the memory - + return hStack; } @@ -132,13 +132,13 @@ HSTACK CreateStack(UINT32 uiNum_items, UINT32 uiSiz_each) // // CreateQueue // -// Parameter List : num_items - estimated number +// Parameter List : num_items - estimated number // of items in queue // siz_each - size of each item // Return Value NULL if unsuccesful -// pointer to allocated memory +// pointer to allocated memory // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** HQUEUE CreateQueue(UINT32 uiNum_items, UINT32 uiSiz_each) @@ -156,7 +156,7 @@ HQUEUE CreateQueue(UINT32 uiNum_items, UINT32 uiSiz_each) { DbgMessage(TOPIC_QUEUE_CONTAINERS, DBG_LEVEL_0, "Requested queue items and size have to be >0"); return NULL; - } + } // allocate the queue memory if ((hQueue = MemAlloc(uiAmount + sizeof(QueueHeader))) == 0) @@ -164,7 +164,7 @@ HQUEUE CreateQueue(UINT32 uiNum_items, UINT32 uiSiz_each) DbgMessage(TOPIC_QUEUE_CONTAINERS, DBG_LEVEL_0, "Could not allocate queue container memory"); return NULL; } - + pQueue = (QueueHeader *)hQueue; //initialize the queue structure @@ -173,20 +173,20 @@ HQUEUE CreateQueue(UINT32 uiNum_items, UINT32 uiSiz_each) pQueue->uiSiz_of_elem = uiSiz_each; pQueue->uiTail = pQueue->uiHead = sizeof(QueueHeader); - // return the pointer to memory + // return the pointer to memory return hQueue; } //***************************************************************************** // // CreateList // -// Parameter List : num_items - estimated number +// Parameter List : num_items - estimated number // of items in ordered list // siz_each - size of each item // Return Value NULL if unsuccesful -// pointer to allocated memory +// pointer to allocated memory // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** HLIST CreateList(UINT32 uiNum_items, UINT32 uiSiz_each) @@ -204,7 +204,7 @@ HLIST CreateList(UINT32 uiNum_items, UINT32 uiSiz_each) { DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Requested queue items and size have to be >0"); return 0; - } + } // allocate the list memory if ((hList = MemAlloc(uiAmount + sizeof(ListHeader))) == 0) @@ -212,7 +212,7 @@ HLIST CreateList(UINT32 uiNum_items, UINT32 uiSiz_each) DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not allocate queue container memory"); return 0; } - + pList = (ListHeader *)hList; //initialize the list structure @@ -221,7 +221,7 @@ HLIST CreateList(UINT32 uiNum_items, UINT32 uiSiz_each) pList->uiSiz_of_elem = uiSiz_each; pList->uiTail = pList->uiHead = sizeof(ListHeader); - // return the pointer to memory + // return the pointer to memory return hList; @@ -233,13 +233,13 @@ HLIST CreateList(UINT32 uiNum_items, UINT32 uiSiz_each) // // CreateOrdList // -// Parameter List : num_items - estimated number +// Parameter List : num_items - estimated number // of items in ordered list // siz_each - size of each item // Return Value NULL if unsuccesful -// pointer to allocated memory +// pointer to allocated memory // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** HORDLIST CreateOrdList(UINT32 uiNum_items, UINT32 uiSiz_each, INT8 (*compare)(void *, void *, UINT32)) @@ -257,7 +257,7 @@ HORDLIST CreateOrdList(UINT32 uiNum_items, UINT32 uiSiz_each, INT8 (*compare)(vo { DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Requested ordered list items and size have to be >0"); return 0; - } + } // allocate the list memory if ((hOrdList = MemAlloc(uiAmount + sizeof(OrdListHeader))) == 0) @@ -265,7 +265,7 @@ HORDLIST CreateOrdList(UINT32 uiNum_items, UINT32 uiSiz_each, INT8 (*compare)(vo DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not allocate queue container memory"); return 0; } - + pOrdList = (OrdListHeader *)hOrdList; //initialize the list structure @@ -275,7 +275,7 @@ HORDLIST CreateOrdList(UINT32 uiNum_items, UINT32 uiSiz_each, INT8 (*compare)(vo pOrdList->uiTail = pOrdList->uiHead = sizeof(OrdListHeader); pOrdList->pCompare = compare; - // return the pointer to memory + // return the pointer to memory return hOrdList; } @@ -286,15 +286,15 @@ HORDLIST CreateOrdList(UINT32 uiNum_items, UINT32 uiSiz_each, INT8 (*compare)(vo // // push // -// Parameter List : void * - pointer to stack -// container +// Parameter List : void * - pointer to stack +// container // data - data to add to stack -// +// // Return Value BOOLEAN true if push ok -// else false -// +// else false +// // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** HSTACK Push(HSTACK hStack, void *pdata) @@ -323,7 +323,7 @@ HSTACK Push(HSTACK hStack, void *pdata) //perform operations to calculate offset and decide if the container has to resized pTemp_cont = (StackHeader *)hStack; uiOffset = (pTemp_cont->uiSiz_of_elem * pTemp_cont->uiTotal_items) + sizeof(StackHeader); - + if ((uiOffset + pTemp_cont->uiSiz_of_elem) > pTemp_cont->uiMax_size) { uiNew_size = pTemp_cont->uiMax_size + (pTemp_cont->uiMax_size - sizeof(StackHeader)); @@ -331,12 +331,12 @@ HSTACK Push(HSTACK hStack, void *pdata) if ((hStack = MemRealloc(hStack, uiNew_size)) == NULL) { DbgMessage(TOPIC_STACK_CONTAINERS, DBG_LEVEL_0, "Could not resize stack container memory"); - return NULL; - } + return NULL; + } pTemp_cont = (StackHeader *)hStack; - } + } pbyte = (BYTE *)hStack; - pbyte += uiOffset; + pbyte += uiOffset; pvoid = (void *)pbyte; //copy data from pdata to pvoid - the stack memmove(pvoid, pdata, pTemp_cont->uiSiz_of_elem); @@ -348,15 +348,15 @@ HSTACK Push(HSTACK hStack, void *pdata) // // pop // -// Parameter List : void * - pointer to stack -// container -// -// -// Return Value : void * - pointer to stack -// after pushing element +// Parameter List : void * - pointer to stack +// container +// +// +// Return Value : void * - pointer to stack +// after pushing element // // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** BOOLEAN Pop(HSTACK hStack, void *pdata) @@ -379,7 +379,7 @@ BOOLEAN Pop(HSTACK hStack, void *pdata) { DbgMessage(TOPIC_STACK_CONTAINERS, DBG_LEVEL_0, "Variable where data is to be stored is NULL"); return FALSE; - } + } pTemp_cont = (StackHeader *)hStack; uiTotal = pTemp_cont->uiTotal_items; uiSize_of_each = pTemp_cont->uiSiz_of_elem; @@ -393,7 +393,7 @@ BOOLEAN Pop(HSTACK hStack, void *pdata) uiOffset = (uiSize_of_each * uiTotal) + sizeof(StackHeader); uiOffset -= uiSize_of_each; pbyte = (BYTE *)hStack; - pbyte += uiOffset; + pbyte += uiOffset; pvoid = (void *)pbyte; // get the data from pvoid and store in pdata memmove(pdata, pvoid, uiSize_of_each); @@ -405,12 +405,12 @@ BOOLEAN Pop(HSTACK hStack, void *pdata) // PeekStack // // Parameter List : void * - buffer to hold data -// -// +// +// // Return Value : TRUE if stack not empty // // Modification History : -// Apr 14 2000 SCT -> Created +// Apr 14 2000 SCT->Created // //***************************************************************************** BOOLEAN PeekStack(HSTACK hStack, void *pdata) @@ -433,7 +433,7 @@ BOOLEAN PeekStack(HSTACK hStack, void *pdata) { DbgMessage(TOPIC_STACK_CONTAINERS, DBG_LEVEL_0, "Variable where data is to be stored is NULL"); return FALSE; - } + } pTemp_cont = (StackHeader *)hStack; uiTotal = pTemp_cont->uiTotal_items; uiSize_of_each = pTemp_cont->uiSiz_of_elem; @@ -447,7 +447,7 @@ BOOLEAN PeekStack(HSTACK hStack, void *pdata) uiOffset = (uiSize_of_each * uiTotal) + sizeof(StackHeader); uiOffset -= uiSize_of_each; pbyte = (BYTE *)hStack; - pbyte += uiOffset; + pbyte += uiOffset; pvoid = (void *)pbyte; // get the data from pvoid and store in pdata memmove(pdata, pvoid, uiSize_of_each); @@ -462,7 +462,7 @@ BOOLEAN PeekStack(HSTACK hStack, void *pdata) // Return Value : BOOLEAN // // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** BOOLEAN DeleteStack(HSTACK hStack) @@ -485,7 +485,7 @@ BOOLEAN DeleteStack(HSTACK hStack) // Return Value : BOOLEAN // // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** BOOLEAN DeleteQueue(HQUEUE hQueue) @@ -508,7 +508,7 @@ BOOLEAN DeleteQueue(HQUEUE hQueue) // Return Value : BOOLEAN // // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** BOOLEAN DeleteList(HLIST hList) @@ -518,7 +518,7 @@ BOOLEAN DeleteList(HLIST hList) DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "This is not a valid pointer to the list"); return FALSE; } - // free the memory assigned to the list + // free the memory assigned to the list MemFree(hList); return TRUE; } @@ -531,7 +531,7 @@ BOOLEAN DeleteList(HLIST hList) // Return Value : BOOLEAN // // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** BOOLEAN DeleteOrdList(HORDLIST hOrdList) @@ -541,7 +541,7 @@ BOOLEAN DeleteOrdList(HORDLIST hOrdList) DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "This is not a valid pointer to the ordered list"); return FALSE; } - // free the memory assigned to the list + // free the memory assigned to the list MemFree(hOrdList); return TRUE; } @@ -554,7 +554,7 @@ BOOLEAN DeleteOrdList(HORDLIST hOrdList) // Return Value : void // // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** @@ -576,13 +576,13 @@ void InitializeContainers(void) // Return Value : void // // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** void ShutdownContainers( void ) { - UnRegisterDebugTopic(TOPIC_STACK_CONTAINERS, "Stack Container"); + UnRegisterDebugTopic(TOPIC_STACK_CONTAINERS, "Stack Container"); UnRegisterDebugTopic(TOPIC_LIST_CONTAINERS, "List Container"); UnRegisterDebugTopic(TOPIC_QUEUE_CONTAINERS, "Queue Container"); UnRegisterDebugTopic(TOPIC_ORDLIST_CONTAINERS, "Ordered List Container"); @@ -592,15 +592,15 @@ void ShutdownContainers( void ) // PeekQueue - gets the first item in queue without // actually deleting it. // -// Parameter List : pvoid_queue - pointer to queue -// container +// Parameter List : pvoid_queue - pointer to queue +// container // data - data removed from queue -// -// Return Value pointer to queue with data removed -// or NULL if failed -// +// +// Return Value pointer to queue with data removed +// or NULL if failed +// // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** BOOLEAN PeekQueue(HQUEUE hQueue, void *pdata) @@ -608,7 +608,7 @@ BOOLEAN PeekQueue(HQUEUE hQueue, void *pdata) QueueHeader *pTemp_cont; void *pvoid; BYTE *pbyte; - + // cannot check for invalid handle , only 0 if (hQueue == NULL) { @@ -620,10 +620,10 @@ BOOLEAN PeekQueue(HQUEUE hQueue, void *pdata) DbgMessage(TOPIC_QUEUE_CONTAINERS, DBG_LEVEL_0, "Memory fo Data to be removed from queue is NULL"); return FALSE; } - + //assign to temporary variables pTemp_cont = (QueueHeader *)hQueue; - + // if theres no elements to remove return error if (pTemp_cont->uiTotal_items == 0) { @@ -632,12 +632,12 @@ BOOLEAN PeekQueue(HQUEUE hQueue, void *pdata) } //copy the element pointed to by uiHead - + pbyte = (BYTE *)hQueue; - pbyte += pTemp_cont->uiHead; + pbyte += pTemp_cont->uiHead; pvoid = (void *)pbyte; memmove(pdata, pvoid, pTemp_cont->uiSiz_of_elem); - + return TRUE; } //***************************************************************************** @@ -645,15 +645,15 @@ BOOLEAN PeekQueue(HQUEUE hQueue, void *pdata) // PeekList - gets the specified item in the list without // actually deleting it. // -// Parameter List : hList - pointer to list -// container +// Parameter List : hList - pointer to list +// container // data - data where list element is stored -// +// // Return Value BOOLEAN -// -// +// +// // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** BOOLEAN PeekList(HLIST hList, void *pdata, UINT32 uiPos) @@ -662,7 +662,7 @@ BOOLEAN PeekList(HLIST hList, void *pdata, UINT32 uiPos) void *pvoid; UINT32 uiOffsetSrc; BYTE *pbyte; - + // cannot check for invalid handle , only 0 if (hList == NULL) { @@ -674,10 +674,10 @@ BOOLEAN PeekList(HLIST hList, void *pdata, UINT32 uiPos) DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Memory fo Data to be removed from list is NULL"); return FALSE; } - + //assign to temporary variables pTemp_cont = (ListHeader *)hList; - + // if theres no elements to peek return error if (pTemp_cont->uiTotal_items == 0) { @@ -696,10 +696,10 @@ BOOLEAN PeekList(HLIST hList, void *pdata, UINT32 uiPos) uiOffsetSrc = sizeof(ListHeader) + (uiOffsetSrc - pTemp_cont->uiMax_size); pbyte = (BYTE *)hList; - pbyte += uiOffsetSrc; + pbyte += uiOffsetSrc; pvoid = (void *)pbyte; memmove(pdata, pvoid, pTemp_cont->uiSiz_of_elem); - + return TRUE; } @@ -711,13 +711,13 @@ BOOLEAN PeekList(HLIST hList, void *pdata, UINT32 uiPos) // the current node size or strange things could happen. // Contents of node and pdata parameter are swapped. // -// Parameter List : hList - pointer to list container +// Parameter List : hList - pointer to list container // pdata - pointer to data to be swapped // uiPos - List position with which to swap. -// +// // Return Value BOOLEAN - TRUE if successful, FALSE if function fails. -// -// +// +// // Modification History : // Added to SGP by Bret Rowdon for use with JA2. May 1 '97. // - This function was based on the PeekList function. @@ -731,7 +731,7 @@ BOOLEAN SwapListNode(HLIST hList, void *pdata, UINT32 uiPos) BYTE *pbyte; BYTE *pSrc; - + // cannot check for invalid handle, only 0 if (hList == NULL) { @@ -744,10 +744,10 @@ BOOLEAN SwapListNode(HLIST hList, void *pdata, UINT32 uiPos) DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Data pointer to be swapped from list is NULL"); return FALSE; } - + //assign to temporary variables pTemp_cont = (ListHeader *)hList; - + // if theres no elements to peek return error if (pTemp_cont->uiTotal_items == 0) { @@ -766,7 +766,7 @@ BOOLEAN SwapListNode(HLIST hList, void *pdata, UINT32 uiPos) uiOffsetSrc = sizeof(ListHeader) + (uiOffsetSrc - pTemp_cont->uiMax_size); pbyte = (BYTE *)hList; - pbyte += uiOffsetSrc; + pbyte += uiOffsetSrc; pvoid = pbyte; pSrc = (BYTE *) pdata; @@ -785,13 +785,13 @@ BOOLEAN SwapListNode(HLIST hList, void *pdata, UINT32 uiPos) // Unlike SwapListNode(), this does NOT swap previous contents // back into the pdata buffer! // -// Parameter List : hList - pointer to list container +// Parameter List : hList - pointer to list container // pdata - pointer to data to be stored // uiPos - List position into which to store. -// +// // Return Value BOOLEAN - TRUE if successful, FALSE if function fails. -// -// +// +// // Modification History : // Added to SGP by Alex Meduna for use with Wiz8. Oct 31 '97. // - This function is nearly identical to the SwapListNode() function. @@ -802,7 +802,7 @@ BOOLEAN StoreListNode(HLIST hList, void *pdata, UINT32 uiPos) ListHeader *pTemp_cont; UINT32 uiOffsetSrc; BYTE *pbyte; - + // cannot check for invalid handle , only 0 if (hList == NULL) { @@ -815,10 +815,10 @@ BOOLEAN StoreListNode(HLIST hList, void *pdata, UINT32 uiPos) DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Data pointer to be swapped from list is NULL"); return FALSE; } - + //assign to temporary variables pTemp_cont = (ListHeader *)hList; - + // if theres no elements to peek return error if (pTemp_cont->uiTotal_items == 0) { @@ -851,15 +851,15 @@ BOOLEAN StoreListNode(HLIST hList, void *pdata, UINT32 uiPos) // PeekOrdList - gets the specified item in the list without // actually deleting it. // -// Parameter List : hList - pointer to ordered list -// container +// Parameter List : hList - pointer to ordered list +// container // data - data where list element is stored -// +// // Return Value BOOLEAN -// -// +// +// // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** BOOLEAN PeekOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) @@ -868,7 +868,7 @@ BOOLEAN PeekOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) void *pvoid; UINT32 uiOffsetSrc; BYTE *pbyte; - + // cannot check for invalid handle , only 0 if (hOrdList == NULL) { @@ -880,10 +880,10 @@ BOOLEAN PeekOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Memory fo Data to be removed from ordered list is NULL"); return FALSE; } - + //assign to temporary variables pTemp_cont = (OrdListHeader *)hOrdList; - + // if theres no elements to peek return error if (pTemp_cont->uiTotal_items == 0) { @@ -902,25 +902,25 @@ BOOLEAN PeekOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) uiOffsetSrc = sizeof(OrdListHeader) + (uiOffsetSrc - pTemp_cont->uiMax_size); pbyte = (BYTE *)hOrdList; - pbyte += uiOffsetSrc; + pbyte += uiOffsetSrc; pvoid = (void *)pbyte; memmove(pdata, pvoid, pTemp_cont->uiSiz_of_elem); - + return TRUE; } //***************************************************************************** // // RemfromQueue // -// Parameter List : pvoid_queue - pointer to queue -// container +// Parameter List : pvoid_queue - pointer to queue +// container // data - data removed from queue -// -// Return Value pointer to queue with data removed -// or NULL if failed -// +// +// Return Value pointer to queue with data removed +// or NULL if failed +// // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** BOOLEAN RemfromQueue(HQUEUE hQueue, void *pdata) @@ -928,7 +928,7 @@ BOOLEAN RemfromQueue(HQUEUE hQueue, void *pdata) QueueHeader *pTemp_cont; void *pvoid; BYTE *pbyte; - + // cannot check for invalid handle , only 0 if (hQueue == NULL) { @@ -940,10 +940,10 @@ BOOLEAN RemfromQueue(HQUEUE hQueue, void *pdata) DbgMessage(TOPIC_QUEUE_CONTAINERS, DBG_LEVEL_0, "Memory fo Data to be removed from queue is NULL"); return FALSE; } - + //assign to temporary variables pTemp_cont = (QueueHeader *)hQueue; - + // if theres no elements to remove return error if (pTemp_cont->uiTotal_items == 0) { @@ -952,21 +952,21 @@ BOOLEAN RemfromQueue(HQUEUE hQueue, void *pdata) } //remove the element pointed to by uiHead - + pbyte = (BYTE *)hQueue; - pbyte += pTemp_cont->uiHead; + pbyte += pTemp_cont->uiHead; pvoid = (void *)pbyte; memmove(pdata, pvoid, pTemp_cont->uiSiz_of_elem); pTemp_cont->uiTotal_items--; pTemp_cont->uiHead += pTemp_cont->uiSiz_of_elem; - + // if after removing an element head = tail then set them both // to the beginning of the container as it is empty if (pTemp_cont->uiHead == pTemp_cont->uiTail) pTemp_cont->uiHead = pTemp_cont->uiTail = sizeof(QueueHeader); - - // if only the head is at the end of the container then make it point + + // if only the head is at the end of the container then make it point // to the beginning of the container if (pTemp_cont->uiHead == pTemp_cont->uiMax_size) @@ -979,15 +979,15 @@ BOOLEAN RemfromQueue(HQUEUE hQueue, void *pdata) // // AddtoQueue // -// Parameter List : pvoid_queue - pointer to queue -// container +// Parameter List : pvoid_queue - pointer to queue +// container // pdata - pointer to data to add to queue -// +// // Return Value pointer to queue with data added -// else false -// +// else false +// // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** HQUEUE AddtoQueue(HQUEUE hQueue, void *pdata) @@ -1038,12 +1038,12 @@ HQUEUE AddtoQueue(HQUEUE hQueue, void *pdata) pTemp_cont->uiMax_size = uiNew_size; if ((hQueue = MemRealloc(hQueue, uiNew_size)) == NULL) { - DbgMessage(TOPIC_QUEUE_CONTAINERS, DBG_LEVEL_0, "Could not resize queue container memory"); - return NULL; + DbgMessage(TOPIC_QUEUE_CONTAINERS, DBG_LEVEL_0, "Could not resize queue container memory"); + return NULL; } // copy memory from beginning of container to end of container // so that all the data is in one continuous block - + pTemp_cont = (QueueHeader *)hQueue; presize = (BYTE *)hQueue; pmaxsize = (BYTE *)hQueue; @@ -1052,13 +1052,13 @@ HQUEUE AddtoQueue(HQUEUE hQueue, void *pdata) if (uiHead > sizeof(QueueHeader)) memmove(pmaxsize, presize, uiHead-sizeof(QueueHeader)); pTemp_cont->uiTail = uiMax_size + (uiHead-sizeof(QueueHeader)); - } + } pbyte = (BYTE *)hQueue; - pbyte += pTemp_cont->uiTail; + pbyte += pTemp_cont->uiTail; pvoid = (void *)pbyte; memmove(pvoid, pdata, uiSize_of_each); pTemp_cont->uiTotal_items++; - pTemp_cont->uiTail += uiSize_of_each; + pTemp_cont->uiTail += uiSize_of_each; return hQueue; } @@ -1066,13 +1066,13 @@ HQUEUE AddtoQueue(HQUEUE hQueue, void *pdata) // // do_copy // -// Parameter List : pointer to mem, source offset, dest offset, size -// +// Parameter List : pointer to mem, source offset, dest offset, size +// // Return Value BOOLEAN -// -// +// +// // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** BOOLEAN do_copy(void *pmem_void, UINT32 uiSourceOfst, UINT32 uiDestOfst, UINT32 uiSize) @@ -1106,13 +1106,13 @@ BOOLEAN do_copy(void *pmem_void, UINT32 uiSourceOfst, UINT32 uiDestOfst, UINT32 // // do_copy_data // -// Parameter List : pointer to mem, pointer to data, source offset, size -// +// Parameter List : pointer to mem, pointer to data, source offset, size +// // Return Value BOOLEAN -// -// +// +// // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** BOOLEAN do_copy_data(void *pmem_void, void *data, UINT32 uiSrcOfst, UINT32 uiSize) @@ -1141,13 +1141,13 @@ BOOLEAN do_copy_data(void *pmem_void, void *data, UINT32 uiSrcOfst, UINT32 uiSiz // // StackSize // -// Parameter List : pointer to stack -// +// Parameter List : pointer to stack +// // Return Value UINT32 stack size -// -// +// +// // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** UINT32 StackSize(HSTACK hStack) @@ -1166,12 +1166,12 @@ UINT32 StackSize(HSTACK hStack) // QueueSize // // Parameter List : pointer to queue -// +// // Return Value UINT32 queue size -// -// +// +// // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** UINT32 QueueSize(HQUEUE hQueue) @@ -1190,12 +1190,12 @@ UINT32 QueueSize(HQUEUE hQueue) // ListSize // // Parameter List : pointer to queue -// +// // Return Value UINT32 list size -// -// +// +// // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** UINT32 ListSize(HLIST hList) @@ -1214,12 +1214,12 @@ UINT32 ListSize(HLIST hList) // OrdListSize // // Parameter List : pointer to list -// +// // Return Value UINT32 Ordlist size -// -// +// +// // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** UINT32 OrdListSize(HORDLIST hOrdList) @@ -1238,15 +1238,15 @@ UINT32 OrdListSize(HORDLIST hOrdList) // AddtoList // // Parameter List : HCONTAINER - handle to list -// container +// container // data - data to add to queue // position - position after which data is to added -// +// // Return Value BOOLEAN true if push ok -// else false -// +// else false +// // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** HLIST AddtoList(HLIST hList, void *pdata, UINT32 uiPos) @@ -1284,9 +1284,9 @@ HLIST AddtoList(HLIST hList, void *pdata, UINT32 uiPos) DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Data to be pushed onto list is NULL"); return NULL; } - + // assign some temporary variables - + pTemp_cont = (ListHeader *)hList; if (uiPos > pTemp_cont->uiTotal_items) { @@ -1304,7 +1304,7 @@ HLIST AddtoList(HLIST hList, void *pdata, UINT32 uiPos) if (uiTail == uiOffsetSrc) fTail_check = TRUE; // copy appropriate blocks - if (((uiTail + uiSize_of_each) <= uiMax_size) && + if (((uiTail + uiSize_of_each) <= uiMax_size) && ((uiTail > uiHead) || ((uiTail == uiHead) && (uiHead == sizeof(ListHeader))))) { uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); @@ -1312,30 +1312,30 @@ HLIST AddtoList(HLIST hList, void *pdata, UINT32 uiPos) if (fTail_check == FALSE) { if (do_copy(hList, uiOffsetSrc, uiOffsetDst, uiTail-uiOffsetSrc) == FALSE) - { - DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); - return NULL; + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return NULL; } } if (fTail_check == FALSE) pTemp_cont->uiTail += uiSize_of_each; uiFinalLoc = uiOffsetSrc; - } + } if ((((uiTail + uiSize_of_each) <= uiMax_size) && (uiTail < uiHead)) - || (((uiTail + uiSize_of_each) > uiMax_size) && (uiHead >= (sizeof(ListHeader) + uiSize_of_each)))) - { + || (((uiTail + uiSize_of_each) > uiMax_size) && (uiHead >= (sizeof(ListHeader) + uiSize_of_each)))) + { uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); - + if (uiOffsetSrc >= uiMax_size) { uiOffsetSrc = sizeof(ListHeader) + (uiOffsetSrc - uiMax_size); uiOffsetDst = uiOffsetSrc + uiSize_of_each; if (do_copy(hList, uiOffsetDst, uiOffsetSrc, uiTail-uiOffsetSrc) == FALSE) - { - DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); - return NULL; + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return NULL; } uiFinalLoc = uiOffsetSrc; } else @@ -1343,34 +1343,34 @@ HLIST AddtoList(HLIST hList, void *pdata, UINT32 uiPos) uiOffsetSrc = sizeof(ListHeader); uiOffsetDst = uiOffsetSrc + uiSize_of_each; if (do_copy(hList, uiOffsetSrc, uiOffsetDst, uiTail-uiOffsetSrc) == FALSE) - { - DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); - return NULL; + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return NULL; } - + uiOffsetSrc = uiMax_size - uiSize_of_each; uiOffsetDst = sizeof(ListHeader); if (do_copy(hList, uiOffsetSrc, uiOffsetDst, uiSize_of_each) == FALSE) - { - DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); - return NULL; + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return NULL; } uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); uiOffsetDst = uiOffsetSrc + uiSize_of_each; if (do_copy(hList, uiOffsetSrc, uiOffsetDst, (uiMax_size-uiSize_of_each) - uiOffsetSrc) == FALSE) - { - DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); - return NULL; + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return NULL; } } - pTemp_cont->uiTail += uiSize_of_each; - uiFinalLoc = uiOffsetSrc; + pTemp_cont->uiTail += uiSize_of_each; + uiFinalLoc = uiOffsetSrc; }// end if - + if ((((uiTail + uiSize_of_each) <= uiMax_size) && (uiTail == uiHead) && (uiHead >= (sizeof(ListHeader) + uiSize_of_each))) - || (((uiTail + uiSize_of_each) > uiMax_size) && (uiHead == sizeof(ListHeader)))) + || (((uiTail + uiSize_of_each) > uiMax_size) && (uiHead == sizeof(ListHeader)))) { // need to resize the container uiNew_size = uiMax_size + (uiMax_size - sizeof(ListHeader)); @@ -1379,28 +1379,28 @@ HLIST AddtoList(HLIST hList, void *pdata, UINT32 uiPos) { DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not resize list container memory"); return NULL; - } + } pTemp_cont = (ListHeader *)hList; if (do_copy(hList, sizeof(ListHeader), uiMax_size, uiHead - sizeof(ListHeader)) == FALSE) { DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not copy list container memory"); return NULL; - } + } pTemp_cont->uiTail = uiMax_size + (uiHead-sizeof(ListHeader)); - - // now make place for the actual element + + // now make place for the actual element uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); uiOffsetDst = uiOffsetSrc + pTemp_cont->uiSiz_of_elem; if (do_copy(hList, uiOffsetSrc, uiOffsetDst, uiTail-uiOffsetSrc) == FALSE) - { - DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); - return NULL; + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return NULL; } pTemp_cont->uiTail += uiSize_of_each; uiFinalLoc = uiOffsetSrc; } - + // finally insert data at position uiFinalLoc @@ -1410,7 +1410,7 @@ HLIST AddtoList(HLIST hList, void *pdata, UINT32 uiPos) DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "This should never happen! report this problem!"); return NULL; } - pbyte += uiFinalLoc; + pbyte += uiFinalLoc; pvoid = (void *)pbyte; memmove(pvoid, pdata, pTemp_cont->uiSiz_of_elem); @@ -1424,16 +1424,16 @@ HLIST AddtoList(HLIST hList, void *pdata, UINT32 uiPos) // // RemfromList // -// Parameter List : HLIST - handle to list -// container +// Parameter List : HLIST - handle to list +// container // data - data to remove from list // position - position after which data is to added -// +// // Return Value BOOLEAN true if push ok -// else false -// +// else false +// // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** BOOLEAN RemfromList(HLIST hList, void *pdata, UINT32 uiPos) @@ -1447,7 +1447,6 @@ BOOLEAN RemfromList(HLIST hList, void *pdata, UINT32 uiPos) UINT32 uiOffsetSrc; UINT32 uiOffsetDst; UINT32 uiFinalLoc = 0; - BOOLEAN fTail_check=FALSE; // check for invalid handle = 0 if (hList == NULL) @@ -1468,7 +1467,7 @@ BOOLEAN RemfromList(HLIST hList, void *pdata, UINT32 uiPos) DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Data to be pushed onto list is NULL"); return FALSE; } - + // assign some temporary variables pTemp_cont = (ListHeader *)hList; @@ -1485,9 +1484,9 @@ BOOLEAN RemfromList(HLIST hList, void *pdata, UINT32 uiPos) uiTotal = pTemp_cont->uiTotal_items; uiSize_of_each = pTemp_cont->uiSiz_of_elem; - uiMax_size = pTemp_cont->uiMax_size; - uiHead = pTemp_cont->uiHead; - uiTail = pTemp_cont->uiTail; + uiMax_size = pTemp_cont->uiMax_size; + uiHead = pTemp_cont->uiHead; + uiTail = pTemp_cont->uiTail; // copy appropriate blocks if ((uiTail > uiHead) || ((uiTail == uiHead) && (uiHead == sizeof(ListHeader)))) @@ -1518,12 +1517,12 @@ BOOLEAN RemfromList(HLIST hList, void *pdata, UINT32 uiPos) uiOffsetSrc = sizeof(ListHeader) + (uiOffsetSrc - uiMax_size); uiOffsetDst = uiOffsetSrc + uiSize_of_each; if (do_copy_data(hList, pdata, uiOffsetSrc, uiSize_of_each) == FALSE) - { + { DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not copy the data from list"); return FALSE; - } + } if (do_copy(hList, uiOffsetSrc, uiOffsetDst, uiTail-uiOffsetSrc) == FALSE) - { + { DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); return FALSE; } @@ -1572,16 +1571,16 @@ BOOLEAN RemfromList(HLIST hList, void *pdata, UINT32 uiPos) // // RemfromOrdList // -// Parameter List : HORDLIST - handle to ordered list -// container +// Parameter List : HORDLIST - handle to ordered list +// container // data - data to remove from ordered list // position - position after which data is to added -// +// // Return Value BOOLEAN true if push ok -// else false -// +// else false +// // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** BOOLEAN RemfromOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) @@ -1595,7 +1594,7 @@ BOOLEAN RemfromOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) UINT32 uiOffsetSrc; UINT32 uiOffsetDst; UINT32 uiFinalLoc = 0; - + // check for invalid handle = 0 if (hOrdList == NULL) @@ -1616,9 +1615,9 @@ BOOLEAN RemfromOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Data to be pushed onto ordered list is NULL"); return FALSE; } - + // assign some temporary variables - + pTemp_cont = (OrdListHeader *)hOrdList; if (uiPos >= pTemp_cont->uiTotal_items) { @@ -1637,44 +1636,44 @@ BOOLEAN RemfromOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) uiMax_size = pTemp_cont->uiMax_size; uiHead = pTemp_cont->uiHead; uiTail = pTemp_cont->uiTail; - + // copy appropriate blocks if ((uiTail > uiHead) || ((uiTail == uiHead) && (uiHead == sizeof(OrdListHeader)))) { uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); uiOffsetDst = uiOffsetSrc + pTemp_cont->uiSiz_of_elem; if (do_copy_data(hOrdList, pdata, uiOffsetSrc, uiSize_of_each) == FALSE) - { + { DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not copy the data from ordered list"); return FALSE; - } + } if (do_copy(hOrdList, uiOffsetDst, uiOffsetSrc, uiTail-uiOffsetSrc) == FALSE) - { + { DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not remove the data from the ordered list"); return FALSE; } pTemp_cont->uiTail -= uiSize_of_each; - pTemp_cont->uiTotal_items--; - } + pTemp_cont->uiTotal_items--; + } if ((uiTail < uiHead) || ((uiTail == uiHead) && (uiHead <= (sizeof(OrdListHeader)+uiSize_of_each)))) - { + { uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); - + if (uiOffsetSrc >= uiMax_size) { uiOffsetSrc = sizeof(OrdListHeader) + (uiOffsetSrc - uiMax_size); uiOffsetDst = uiOffsetSrc + uiSize_of_each; if (do_copy_data(hOrdList, pdata, uiOffsetSrc, uiSize_of_each) == FALSE) - { + { DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not copy the data from list"); return FALSE; - } + } if (do_copy(hOrdList, uiOffsetSrc, uiOffsetDst, uiTail-uiOffsetSrc) == FALSE) - { + { DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); return FALSE; } @@ -1687,7 +1686,7 @@ BOOLEAN RemfromOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) uiOffsetDst = uiOffsetSrc + uiSize_of_each; if (do_copy(hOrdList, uiOffsetSrc, uiOffsetDst, uiTail-uiOffsetSrc) == FALSE) - { + { DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); return FALSE; } @@ -1696,7 +1695,7 @@ BOOLEAN RemfromOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) uiOffsetDst = sizeof(OrdListHeader); if (do_copy(hOrdList, uiOffsetSrc, uiOffsetDst, uiSize_of_each) == FALSE) - { + { DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); return FALSE; } @@ -1704,23 +1703,23 @@ BOOLEAN RemfromOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); uiOffsetDst = uiOffsetSrc + uiSize_of_each; if (do_copy_data(hOrdList, pdata, uiOffsetSrc, uiSize_of_each) == FALSE) - { + { DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not copy the data from list"); return FALSE; } if (do_copy(hOrdList, uiOffsetSrc, uiOffsetDst, (uiMax_size-uiSize_of_each) - uiOffsetSrc) == FALSE) - { + { DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); return FALSE; } } pTemp_cont->uiTail -= uiSize_of_each; - pTemp_cont->uiTotal_items--; + pTemp_cont->uiTotal_items--; } // end if - + return TRUE; } @@ -1730,16 +1729,16 @@ BOOLEAN RemfromOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) // // StoreinOrdList // -// Parameter List : HORDLIST - handle to ordered list -// container +// Parameter List : HORDLIST - handle to ordered list +// container // data - data to add to the ordered list // position - position after which data is to added -// +// // Return Value BOOLEAN true if push ok -// else false -// +// else false +// // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** HORDLIST StoreinOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) @@ -1772,7 +1771,7 @@ HORDLIST StoreinOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Data to be pushed onto ordered list is NULL"); return NULL; } - + // assign some temporary variables pTemp_cont = (OrdListHeader *)hOrdList; @@ -1784,15 +1783,15 @@ HORDLIST StoreinOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) } - uiTotal = pTemp_cont->uiTotal_items; + uiTotal = pTemp_cont->uiTotal_items; uiSize_of_each = pTemp_cont->uiSiz_of_elem; - uiMax_size = pTemp_cont->uiMax_size; - uiHead = pTemp_cont->uiHead; - uiTail = pTemp_cont->uiTail; - uiOffsetSrc = pTemp_cont->uiHead + (uiPos * pTemp_cont->uiSiz_of_elem); + uiMax_size = pTemp_cont->uiMax_size; + uiHead = pTemp_cont->uiHead; + uiTail = pTemp_cont->uiTail; + uiOffsetSrc = pTemp_cont->uiHead + (uiPos * pTemp_cont->uiSiz_of_elem); - // this shouldn't be necessary? position should never be outside the range? + // this shouldn't be necessary? position should never be outside the range? if (uiOffsetSrc >= uiMax_size) uiOffsetSrc = sizeof(OrdListHeader) + (uiOffsetSrc - uiMax_size); @@ -1811,9 +1810,9 @@ HORDLIST StoreinOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) if (fTail_check == FALSE) { if (do_copy(hOrdList, uiOffsetSrc, uiOffsetDst, uiTail-uiOffsetSrc) == FALSE) - { - DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in ordered list"); - return NULL; + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in ordered list"); + return NULL; } } @@ -1821,21 +1820,21 @@ HORDLIST StoreinOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) pTemp_cont->uiTail += uiSize_of_each; uiFinalLoc = uiOffsetSrc; - } + } if ((((uiTail + uiSize_of_each) <= uiMax_size) && (uiTail < uiHead)) || - (((uiTail + uiSize_of_each) > uiMax_size) && (uiHead >= (sizeof(OrdListHeader) + uiSize_of_each)))) - { + (((uiTail + uiSize_of_each) > uiMax_size) && (uiHead >= (sizeof(OrdListHeader) + uiSize_of_each)))) + { uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); - + if (uiOffsetSrc >= uiMax_size) { uiOffsetSrc = sizeof(OrdListHeader) + (uiOffsetSrc - uiMax_size); uiOffsetDst = uiOffsetSrc + uiSize_of_each; if (do_copy(hOrdList, uiOffsetDst, uiOffsetSrc, uiTail-uiOffsetSrc) == FALSE) - { + { DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); return NULL; } @@ -1847,7 +1846,7 @@ HORDLIST StoreinOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) uiOffsetDst = uiOffsetSrc + uiSize_of_each; if (do_copy(hOrdList, uiOffsetSrc, uiOffsetDst, uiTail-uiOffsetSrc) == FALSE) - { + { DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); return NULL; } @@ -1856,7 +1855,7 @@ HORDLIST StoreinOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) uiOffsetDst = sizeof(OrdListHeader); if (do_copy(hOrdList, uiOffsetSrc, uiOffsetDst, uiSize_of_each) == FALSE) - { + { DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); return NULL; } @@ -1865,7 +1864,7 @@ HORDLIST StoreinOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) uiOffsetDst = uiOffsetSrc + uiSize_of_each; if (do_copy(hOrdList, uiOffsetSrc, uiOffsetDst, (uiMax_size-uiSize_of_each) - uiOffsetSrc) == FALSE) - { + { DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); return NULL; } @@ -1878,7 +1877,7 @@ HORDLIST StoreinOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) if ((((uiTail + uiSize_of_each) <= uiMax_size) && (uiTail == uiHead) && (uiHead >= (sizeof(OrdListHeader) + uiSize_of_each))) - || (((uiTail + uiSize_of_each) > uiMax_size) && (uiHead == sizeof(OrdListHeader)))) + || (((uiTail + uiSize_of_each) > uiMax_size) && (uiHead == sizeof(OrdListHeader)))) { // need to resize the container uiNew_size = uiMax_size + (uiMax_size - sizeof(OrdListHeader)); @@ -1888,7 +1887,7 @@ HORDLIST StoreinOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) { DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not resize ordered list container memory"); return NULL; - } + } pTemp_cont = (OrdListHeader *)hOrdList; @@ -1896,24 +1895,24 @@ HORDLIST StoreinOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) { DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not copy ordered list container memory"); return NULL; - } + } pTemp_cont->uiTail = uiMax_size + (uiHead-sizeof(OrdListHeader)); - - // now make place for the actual element + + // now make place for the actual element uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); uiOffsetDst = uiOffsetSrc + pTemp_cont->uiSiz_of_elem; if (do_copy(hOrdList, uiOffsetSrc, uiOffsetDst, uiTail-uiOffsetSrc) == FALSE) - { + { DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); return NULL; } pTemp_cont->uiTail += uiSize_of_each; uiFinalLoc = uiOffsetSrc; } - + if (uiFinalLoc == 0) { DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "This should never happen! report this problem!"); @@ -1923,7 +1922,7 @@ HORDLIST StoreinOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) // finally insert data at position uiFinalLoc pbyte = (BYTE *)hOrdList; - pbyte += uiFinalLoc; + pbyte += uiFinalLoc; pvoid = (void *)pbyte; memmove(pvoid, pdata, pTemp_cont->uiSiz_of_elem); pTemp_cont->uiTotal_items++; @@ -1940,15 +1939,15 @@ HORDLIST StoreinOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) // // AddtoOrdList // -// Parameter List : HORDLIST - handle to ordered list -// container +// Parameter List : HORDLIST - handle to ordered list +// container // data - data to add to the ordered list -// +// // Return Value BOOLEAN true if Add ok else false -// +// // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry -// Dec 19th 1997 -> verified, cleaned up, and heavily commented by AM +// Nov 26th 1996->modified for use by Wizardry +// Dec 19th 1997->verified, cleaned up, and heavily commented by AM // //***************************************************************************** HORDLIST AddtoOrdList(HORDLIST hOrdList, void *pdata) @@ -1957,8 +1956,6 @@ HORDLIST AddtoOrdList(HORDLIST hOrdList, void *pdata) void *pTemp_data; UINT32 uiOffset; BOOLEAN fContinue = FALSE; - BOOLEAN fLessThan = FALSE; - BOOLEAN fMoreThan = FALSE; INT8 sbResult; UINT32 uiPosition; @@ -1968,7 +1965,7 @@ HORDLIST AddtoOrdList(HORDLIST hOrdList, void *pdata) // if the list is empty or full) - if (pOrdList->uiHead == pOrdList->uiTail) + if (pOrdList->uiHead == pOrdList->uiTail) { // if the head offset points to position 0, presumably that means it's empty (?) if (pOrdList->uiHead == sizeof(OrdListHeader)) @@ -2011,7 +2008,7 @@ HORDLIST AddtoOrdList(HORDLIST hOrdList, void *pdata) // get entry data at the current offset position and store it in pTemp_data if (do_copy_data(hOrdList, pTemp_data, (uiOffset - pOrdList->uiSiz_of_elem), pOrdList->uiSiz_of_elem ) == FALSE) - { + { DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not copy the data from list"); MemFree(pTemp_data); return NULL; @@ -2023,26 +2020,26 @@ HORDLIST AddtoOrdList(HORDLIST hOrdList, void *pdata) // and do the right thing based on the result... switch (sbResult) { - case ORDLIST_ERROR : - { + case ORDLIST_ERROR : + { DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not perform comparison for ordered lists"); MemFree(pTemp_data); return NULL; } - case ORDLIST_EQUAL : + case ORDLIST_EQUAL : case ORDLIST_LEFT_LESS : { - // found the right spot! Insert it at the current position + // found the right spot! Insert it at the current position if ((hOrdList = StoreinOrdList(hOrdList, pdata, uiPosition)) == NULL) - { + { DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not copy the data into ordered list"); MemFree(pTemp_data); return NULL; } return hOrdList; - } - + } + case ORDLIST_RIGHT_LESS : { // keep looking @@ -2080,7 +2077,7 @@ HORDLIST AddtoOrdList(HORDLIST hOrdList, void *pdata) // and stick it in there... if ((hOrdList = StoreinOrdList(hOrdList, pdata, uiPosition)) == FALSE) - { + { DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not copy the data into ordered list"); return NULL; } diff --git a/Standard Gaming Platform/Container.h b/Standard Gaming Platform/Container.h index 1811c286..69dfe1f5 100644 --- a/Standard Gaming Platform/Container.h +++ b/Standard Gaming Platform/Container.h @@ -13,7 +13,7 @@ //*********************************************** // -// Includes +// Includes // // //*********************************************** @@ -22,13 +22,13 @@ //*********************************************** // -// Defines and typedefs +// Defines and typedefs // //*********************************************** -#define ORDLIST_ERROR -1 -#define ORDLIST_EQUAL 0 -#define ORDLIST_LEFT_LESS 1 -#define ORDLIST_RIGHT_LESS 2 +#define ORDLIST_ERROR -1 +#define ORDLIST_EQUAL 0 +#define ORDLIST_LEFT_LESS 1 +#define ORDLIST_RIGHT_LESS 2 typedef void * HCONTAINER; typedef HCONTAINER HSTACK; @@ -53,9 +53,9 @@ extern void ShutdownContainers(void); // Stack Functions // CreateStack(estimated number of items in stack, size of each item // Push(handle to container returned from CreateStack, data to be passed in (must be void *) -// : returns handle to new stack +// : returns handle to new stack // Pop(handle to container returned from CreateStack, data to be passed in (must be void *) -// : returns BOOLEAN +// : returns BOOLEAN // DeleteStack deletes the stack container // StackSize returns size of stack @@ -78,51 +78,51 @@ extern BOOLEAN PeekStack(HSTACK hStack, void *data); // DeleteQueue(handle to container) Delete the queue container // : returns BOOLEAN -extern HQUEUE CreateQueue(UINT32 num_of_elem, UINT32 siz_of_each); +extern HQUEUE CreateQueue(UINT32 num_of_elem, UINT32 siz_of_each); extern HQUEUE AddtoQueue(HQUEUE hQueue, void *data); extern BOOLEAN RemfromQueue(HQUEUE hQueue,void *data); extern BOOLEAN PeekQueue(HQUEUE hQueue, void *data); -extern UINT32 QueueSize(HQUEUE hQueue); +extern UINT32 QueueSize(HQUEUE hQueue); extern BOOLEAN DeleteQueue(HQUEUE hQueue); // List Functions // CreateList(estimated number of items in queue, size of each item // AddtoList(handle to container returned from CreateQueue, data to be passed in (must be void *) -// position where data is to be added (0...sizeof(list)) +// position where data is to be added (0...sizeof(list)) // : returns handle to new list // RemfromList(handle to container returned from CreateList, variable where data is stored (must be void *) -// position where data is to be deleted (0...sizeof(list)-1) +// position where data is to be deleted (0...sizeof(list)-1) // PeekList(handle to the list, variable where peeked data is stored). Item is not deleted. -// position where data is to be peeked (0...sizeof(list)-1) +// position where data is to be peeked (0...sizeof(list)-1) // ListSize(handle to the list) returns the list size // DeleteList(handle to the list) Delete the list container -extern HLIST CreateList(UINT32 num_of_elem, UINT32 siz_of_each); -extern HLIST AddtoList(HLIST hList, void *data, UINT32 position); +extern HLIST CreateList(UINT32 num_of_elem, UINT32 siz_of_each); +extern HLIST AddtoList(HLIST hList, void *data, UINT32 position); extern BOOLEAN RemfromList(HLIST hList,void *data, UINT32 position); extern BOOLEAN PeekList(HLIST hList, void *data, UINT32 position); -extern UINT32 ListSize(HLIST hList); +extern UINT32 ListSize(HLIST hList); extern BOOLEAN DeleteList(HLIST hList); extern BOOLEAN SwapListNode(HLIST hList, void *pdata, UINT32 uiPos); extern BOOLEAN StoreListNode(HLIST hList, void *pdata, UINT32 uiPos); // Ordered List Functions // CreateOrdList(estimated number of items in ordered list, size of each item, -// pointer to a compare function that returns info on whether the data in the ordered stack -// is < or > the new data to be added into the ordered list. +// pointer to a compare function that returns info on whether the data in the ordered stack +// is < or > the new data to be added into the ordered list. // AddtoOrdList(handle to container returned from CreateOrdList, data to be passed in (must be void *) // RemfromOrdList(handle to container returned from CreateList, variable where data is stored (must be void *) -// position where data is to be deleted (0...sizeof(list)-1) +// position where data is to be deleted (0...sizeof(list)-1) // PeekOrdList(handle to the list, variable where peeked data is stored). Item is not deleted. -// position where data is to be peeked (0...sizeof(list)-1) +// position where data is to be peeked (0...sizeof(list)-1) // OrdListSize(handle to the list) returns the ordered list size // DeleteOrdList(handle to the list) Delete the ordered list container -extern HLIST CreateOrdList(UINT32 num_of_elem, UINT32 siz_of_each, INT8 (*compare)(void *,void *, UINT32)); +extern HLIST CreateOrdList(UINT32 num_of_elem, UINT32 siz_of_each, INT8 (*compare)(void *,void *, UINT32)); extern HLIST AddtoOrdList(HLIST hList, void *data); extern BOOLEAN RemfromOrdList(HLIST hList,void *data, UINT32 position); extern BOOLEAN PeekOrdList(HLIST hList, void *data, UINT32 position); -extern UINT32 OrdListSize(HLIST hList); +extern UINT32 OrdListSize(HLIST hList); extern BOOLEAN DeleteOrdList(HLIST hList); #ifdef __cplusplus diff --git a/Standard Gaming Platform/Cursor Control.cpp b/Standard Gaming Platform/Cursor Control.cpp index ad812f5f..70337985 100644 --- a/Standard Gaming Platform/Cursor Control.cpp +++ b/Standard Gaming Platform/Cursor Control.cpp @@ -23,19 +23,19 @@ BOOLEAN gfCursorDatabaseInit = FALSE; CursorFileData *gpCursorFileDatabase; -CursorData *gpCursorDatabase; -INT16 gsGlobalCursorYOffset = 0; -INT16 gsCurMouseOffsetX = 0; -INT16 gsCurMouseOffsetY = 0; -UINT16 gsCurMouseHeight = 0; -UINT16 gsCurMouseWidth = 0; -UINT16 gusNumDataFiles = 0; -UINT32 guiExternVo; -UINT16 gusExternVoSubIndex; -UINT32 guiExtern2Vo; -UINT16 gusExtern2VoSubIndex; -UINT32 guiOldSetCursor = 0; -UINT32 guiDelayTimer = 0; +CursorData *gpCursorDatabase; +INT16 gsGlobalCursorYOffset = 0; +INT16 gsCurMouseOffsetX = 0; +INT16 gsCurMouseOffsetY = 0; +UINT16 gsCurMouseHeight = 0; +UINT16 gsCurMouseWidth = 0; +UINT16 gusNumDataFiles = 0; +UINT32 guiExternVo; +UINT16 gusExternVoSubIndex; +UINT32 guiExtern2Vo; +UINT16 gusExtern2VoSubIndex; +UINT32 guiOldSetCursor = 0; +UINT32 guiDelayTimer = 0; MOUSEBLT_HOOK gMouseBltOverride = NULL; @@ -44,17 +44,17 @@ MOUSEBLT_HOOK gMouseBltOverride = NULL; BOOLEAN BltToMouseCursorFromVObject( HVOBJECT hVObject, UINT16 usVideoObjectSubIndex, UINT16 usXPos, UINT16 usYPos ) { - BOOLEAN ReturnValue; + BOOLEAN ReturnValue; - ReturnValue = BltVideoObject(MOUSE_BUFFER, hVObject, usVideoObjectSubIndex, usXPos, usYPos, VO_BLT_SRCTRANSPARENCY, NULL); + ReturnValue = BltVideoObject(MOUSE_BUFFER, hVObject, usVideoObjectSubIndex, usXPos, usYPos, VO_BLT_SRCTRANSPARENCY, NULL); - return ReturnValue; + return ReturnValue; } BOOLEAN BltToMouseCursorFromVObjectWithOutline( HVOBJECT hVObject, UINT16 usVideoObjectSubIndex, UINT16 usXPos, UINT16 usYPos ) { - BOOLEAN ReturnValue; - ETRLEObject *pTrav; + BOOLEAN ReturnValue; + ETRLEObject *pTrav; INT16 sXPos, sYPos; // Adjust for offsets @@ -71,9 +71,9 @@ BOOLEAN BltToMouseCursorFromVObjectWithOutline( HVOBJECT hVObject, UINT16 usVide sXPos += ( ( gsCurMouseWidth - pTrav->usWidth ) / 2 ); sYPos += ( ( gsCurMouseHeight - pTrav->usHeight ) / 2 ); - ReturnValue = BltVideoObjectOutline(MOUSE_BUFFER, hVObject, usVideoObjectSubIndex, sXPos, sYPos, Get16BPPColor( FROMRGB( 0, 255, 0 ) ), TRUE ); + ReturnValue = BltVideoObjectOutline(MOUSE_BUFFER, hVObject, usVideoObjectSubIndex, sXPos, sYPos, Get16BPPColor( FROMRGB( 0, 255, 0 ) ), TRUE ); - return ReturnValue; + return ReturnValue; } @@ -82,7 +82,7 @@ void InitCursorDatabase( CursorFileData *pCursorFileData, CursorData *pCursorDat { // Set global values! - gpCursorFileDatabase = pCursorFileData; + gpCursorFileDatabase = pCursorFileData; gpCursorDatabase = pCursorData; gusNumDataFiles = suNumDataFiles; gfCursorDatabaseInit = TRUE; @@ -102,7 +102,7 @@ BOOLEAN LoadCursorData(UINT32 uiCursorIndex) UINT32 cnt; INT16 sMaxHeight = -1; INT16 sMaxWidth = -1; - ETRLEObject *pTrav; + ETRLEObject *pTrav; pCurData = &( gpCursorDatabase[ uiCursorIndex ] ); @@ -118,7 +118,7 @@ BOOLEAN LoadCursorData(UINT32 uiCursorIndex) // VOBJECT_DESC VideoObjectDescription; // FIRST LOAD AS AN HIMAGE SO WE CAN GET AUX DATA! - HIMAGE hImage; + HIMAGE hImage; AuxObjectData *pAuxData; @@ -164,7 +164,7 @@ BOOLEAN LoadCursorData(UINT32 uiCursorIndex) // the hImage is no longer needed DestroyImage( hImage ); - + // Save hVObject.... GetVideoObject( &(gpCursorFileDatabase[ pCurImage->uiFileIndex ].hVObject), gpCursorFileDatabase[ pCurImage->uiFileIndex ].uiIndex ); @@ -182,12 +182,12 @@ BOOLEAN LoadCursorData(UINT32 uiCursorIndex) return FALSE; } - if ( pTrav->usHeight > sMaxHeight ) + if ( pTrav->usHeight > sMaxHeight ) { sMaxHeight = pTrav->usHeight; } - if ( pTrav->usWidth > sMaxWidth ) + if ( pTrav->usWidth > sMaxWidth ) { sMaxWidth = pTrav->usWidth; } @@ -284,7 +284,7 @@ void UnLoadCursorData(UINT32 uiCursorIndex) { if ( !( gpCursorFileDatabase[ pCurImage->uiFileIndex ].ubFlags & USE_EXTERN_VO_CURSOR ) ) { - DeleteVideoObjectFromIndex( gpCursorFileDatabase[ pCurImage->uiFileIndex ].uiIndex); + DeleteVideoObjectFromIndex( gpCursorFileDatabase[ pCurImage->uiFileIndex ].uiIndex); gpCursorFileDatabase[ pCurImage->uiFileIndex ].uiIndex = 0; } gpCursorFileDatabase[ pCurImage->uiFileIndex ].fLoaded = FALSE; @@ -295,45 +295,45 @@ void UnLoadCursorData(UINT32 uiCursorIndex) /////////////////////////////////////////////////////////////////////////////////////////////////// -void CursorDatabaseClear(void) +void CursorDatabaseClear(void) { - UINT32 uiIndex; + UINT32 uiIndex; - for (uiIndex = 0; uiIndex < gusNumDataFiles; uiIndex++) - { - if (gpCursorFileDatabase[uiIndex].fLoaded == TRUE) - { + for (uiIndex = 0; uiIndex < gusNumDataFiles; uiIndex++) + { + if (gpCursorFileDatabase[uiIndex].fLoaded == TRUE) + { if ( !( gpCursorFileDatabase[ uiIndex ].ubFlags & USE_EXTERN_VO_CURSOR ) ) { - DeleteVideoObjectFromIndex( gpCursorFileDatabase[uiIndex].uiIndex); + DeleteVideoObjectFromIndex( gpCursorFileDatabase[uiIndex].uiIndex); gpCursorFileDatabase[uiIndex].uiIndex = 0; } - gpCursorFileDatabase[uiIndex].fLoaded = FALSE; - } - } + gpCursorFileDatabase[uiIndex].fLoaded = FALSE; + } + } } /////////////////////////////////////////////////////////////////////////////////////////////////// -BOOLEAN SetCurrentCursorFromDatabase( UINT32 uiCursorIndex ) +BOOLEAN SetCurrentCursorFromDatabase( UINT32 uiCursorIndex ) { #ifdef JA2 - BOOLEAN ReturnValue = TRUE; + BOOLEAN ReturnValue = TRUE; UINT16 usSubIndex; CursorData *pCurData; CursorImage *pCurImage; UINT32 cnt; INT16 sCenterValX, sCenterValY; HVOBJECT hVObject; - ETRLEObject *pTrav; + ETRLEObject *pTrav; UINT16 usEffHeight, usEffWidth; if ( gfCursorDatabaseInit ) { // Enter mouse buffer mutex - //EnterMutex(MOUSE_BUFFER_MUTEX, __LINE__, __FILE__); + //EnterMutex(MOUSE_BUFFER_MUTEX, __LINE__, __FILE__); // If the current cursor is the first index, disable cursors @@ -350,7 +350,7 @@ BOOLEAN SetCurrentCursorFromDatabase( UINT32 uiCursorIndex ) else { // CHECK FOR EXTERN CURSOR - if ( uiCursorIndex == EXTERN_CURSOR || uiCursorIndex == EXTERN2_CURSOR ) + if ( uiCursorIndex == EXTERN_CURSOR || uiCursorIndex == EXTERN2_CURSOR ) { INT16 sSubX, sSubY; HVOBJECT hVObjectTemp; @@ -400,7 +400,7 @@ BOOLEAN SetCurrentCursorFromDatabase( UINT32 uiCursorIndex ) { BltVideoObjectOutlineFromIndex( MOUSE_BUFFER, guiExternVo, gusExternVoSubIndex, 0, 0, 0, FALSE ); } - + // Hook into hook function if ( gMouseBltOverride != NULL ) { @@ -496,7 +496,7 @@ BOOLEAN SetCurrentCursorFromDatabase( UINT32 uiCursorIndex ) continue; } } - } + } else { if ( cnt <= 1 ) @@ -584,7 +584,7 @@ BOOLEAN SetCurrentCursorFromDatabase( UINT32 uiCursorIndex ) } } - return ( ReturnValue ); + return ( ReturnValue ); #else return(0); #endif @@ -616,7 +616,7 @@ void SetExternVOData( UINT32 uiCursorIndex, HVOBJECT hVObject, UINT16 usSubIndex // If loaded, unload... UnLoadCursorData( uiCursorIndex ); - + // Set extern vo gpCursorFileDatabase[ pCurImage->uiFileIndex ].hVObject = hVObject; pCurImage->uiSubIndex = usSubIndex; @@ -646,7 +646,7 @@ void RemoveExternVOData( UINT32 uiCursorIndex ) gpCursorFileDatabase[ pCurImage->uiFileIndex ].hVObject = NULL; } - } + } } diff --git a/Standard Gaming Platform/Cursor Control.h b/Standard Gaming Platform/Cursor Control.h index e5b67eff..3d5a5a36 100644 --- a/Standard Gaming Platform/Cursor Control.h +++ b/Standard Gaming Platform/Cursor Control.h @@ -10,7 +10,7 @@ #include "Video.h" #else #include "video2.h" -#endif +#endif #ifdef __cplusplus extern "C" { @@ -18,11 +18,11 @@ extern "C" { extern UINT32 GetCursorHandle(UINT32 uiCursorIndex); -extern void UnloadCursorData(UINT32 uiCursorIndex); -extern BOOLEAN LoadCursorData(UINT32 uiCursorIndex); -extern void CursorDatabaseClear(void); +extern void UnloadCursorData(UINT32 uiCursorIndex); +extern BOOLEAN LoadCursorData(UINT32 uiCursorIndex); +extern void CursorDatabaseClear(void); extern UINT16 GetCursorSubIndex(UINT32 uiCursorIndex); -extern BOOLEAN SetCurrentCursorFromDatabase( UINT32 uiCursorIndex ); +extern BOOLEAN SetCurrentCursorFromDatabase( UINT32 uiCursorIndex ); #define ANIMATED_CURSOR 0x02 #define USE_EXTERN_VO_CURSOR 0x04 @@ -44,7 +44,7 @@ extern BOOLEAN SetCurrentCursorFromDatabase( UINT32 uiCursorIndex ); #define CURSOR_TO_FLASH2 0x02 #define CURSOR_TO_SUB_CONDITIONALLY 0x04 #define DELAY_START_CURSOR 0x08 -#define CURSOR_TO_PLAY_SOUND 0x10 +#define CURSOR_TO_PLAY_SOUND 0x10 /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -55,9 +55,9 @@ extern BOOLEAN SetCurrentCursorFromDatabase( UINT32 uiCursorIndex ); typedef struct { - UINT8 ubFilename[MAX_FILENAME_LEN]; - BOOLEAN fLoaded; - UINT32 uiIndex; + UINT8 ubFilename[MAX_FILENAME_LEN]; + BOOLEAN fLoaded; + UINT32 uiIndex; UINT8 ubFlags; UINT8 ubNumberOfFrames; HVOBJECT hVObject; @@ -66,8 +66,8 @@ typedef struct typedef struct { - UINT32 uiFileIndex; - UINT16 uiSubIndex; + UINT32 uiFileIndex; + UINT16 uiSubIndex; UINT32 uiCurrentFrame; INT16 usPosX; INT16 usPosY; @@ -78,8 +78,8 @@ typedef struct { CursorImage Composites[ MAX_COMPOSITES ]; UINT16 usNumComposites; - INT16 sOffsetX; - INT16 sOffsetY; + INT16 sOffsetX; + INT16 sOffsetY; UINT16 usHeight; UINT16 usWidth; UINT8 bFlags; @@ -87,19 +87,19 @@ typedef struct } CursorData; -extern INT16 gsGlobalCursorYOffset; +extern INT16 gsGlobalCursorYOffset; // Globals for cursor database offset values -extern INT16 gsCurMouseOffsetX; -extern INT16 gsCurMouseOffsetY; -extern UINT16 gsCurMouseHeight; -extern UINT16 gsCurMouseWidth; +extern INT16 gsCurMouseOffsetX; +extern INT16 gsCurMouseOffsetY; +extern UINT16 gsCurMouseHeight; +extern UINT16 gsCurMouseWidth; -extern UINT32 guiExternVo; -extern UINT16 gusExternVoSubIndex; -extern UINT32 guiExtern2Vo; -extern UINT16 gusExtern2VoSubIndex; -extern BOOLEAN gfExternUse2nd; +extern UINT32 guiExternVo; +extern UINT16 gusExternVoSubIndex; +extern UINT32 guiExtern2Vo; +extern UINT16 gusExtern2VoSubIndex; +extern BOOLEAN gfExternUse2nd; typedef void (*MOUSEBLT_HOOK)( void ); diff --git a/Standard Gaming Platform/DEBUG.H b/Standard Gaming Platform/DEBUG.H index eb1d7031..dc9bca77 100644 --- a/Standard Gaming Platform/DEBUG.H +++ b/Standard Gaming Platform/DEBUG.H @@ -55,21 +55,21 @@ extern STR8 String(const STR8 String, ...); // Debug Mode //******************************************************************************************* -//Modified the Assertion code. As of the writing of this code, there are no other functions that -//make use of _FailMessage. With that assumption made, we can then make two functions, the first Assert, taking -//one argument, and passing a NULL string. The second one, AssertMsg(), accepts a string as the second parameter. -//This string that has vanished for Assert is now built inside of fail message. This is the case for both Asserts, but the second one -//also is added. Ex: +//Modified the Assertion code. As of the writing of this code, there are no other functions that +//make use of _FailMessage. With that assumption made, we can then make two functions, the first Assert, taking +//one argument, and passing a NULL string. The second one, AssertMsg(), accepts a string as the second parameter. +//This string that has vanished for Assert is now built inside of fail message. This is the case for both Asserts, but the second one +//also is added. Ex: //Assert( pointer ); -//Assert( pointer, "This pointer is null and you tried to access it in function A "); -//It'll make debugging a little simpler. In anal cases, you could build the string first, then assert +//Assert( pointer, "This pointer is null and you tried to access it in function A "); +//It'll make debugging a little simpler. In anal cases, you could build the string first, then assert //with it. extern void _FailMessage(STR8 pString, UINT32 uiLineNum, STR8 pSourceFile ); #define Assert(a) (a) ? _Null() : _FailMessage( NULL, __LINE__, __FILE__ ) -#define AssertMsg(a,b) (a) ? _Null() : _FailMessage( b, __LINE__, __FILE__ ) +#define AssertMsg(a,b) (a) ? _Null() : _FailMessage( b, __LINE__, __FILE__ ) -extern CHAR8 gubAssertString[128]; +extern CHAR8 gubAssertString[512];//for long filenames #else @@ -83,7 +83,7 @@ extern CHAR8 gubAssertString[128]; // Kaiden: Added this for Map Editor #ifdef JA2BETAVERSION - extern CHAR8 gubAssertString[128]; + extern CHAR8 gubAssertString[512];//for long filenames #endif // Moved these out of the defines - debug mgr always initialized @@ -120,7 +120,7 @@ extern BOOLEAN gfDebugTopics[MAX_TOPICS_ALLOTED]; // Enable the debug topic we want #if defined( JA2 ) || defined( UTIL ) #define RegisterJA2DebugTopic(a, b) DbgTopicRegistration( TOPIC_REGISTER, &(a), (b) ) -#define RegisterDebugTopic(a, b) ((void *)0) +#define RegisterDebugTopic(a, b) ((void *)0) #define DebugMsg(a, b, c) DbgMessageReal( (a), TOPIC_MESSAGE, (b), (c) ) #else #define RegisterJA2DebugTopic(a, b) ((void *)0) @@ -182,4 +182,4 @@ extern void _DebugMessage(UINT8 *pSourceFile, UINT32 uiLineNum, UINT8 *pString) #endif */ -#endif \ No newline at end of file +#endif diff --git a/Standard Gaming Platform/DEBUG.cpp b/Standard Gaming Platform/DEBUG.cpp index 5b25beea..bbb80843 100644 --- a/Standard Gaming Platform/DEBUG.cpp +++ b/Standard Gaming Platform/DEBUG.cpp @@ -68,7 +68,7 @@ INT32 giProfileCount; // they are required for the String() function, which is NOT a // debug-mode only function, it's used in release-mode as well! -- DB -CHAR8 gubAssertString[128]; +CHAR8 gubAssertString[512];//for long filenames #define MAX_MSG_LENGTH2 512 CHAR8 gbTmpDebugString[8][MAX_MSG_LENGTH2]; @@ -158,7 +158,7 @@ STRING512 gpcDebugLogFileName; // Return Value : // Modification history : // -// xxjun98:CJC -> creation +// xxjun98:CJC ->creation // //************************************************************************** BOOLEAN DbgGetLogFileName( STRING512 pcName ) @@ -194,7 +194,7 @@ BOOLEAN DbgGetLogFileName( STRING512 pcName ) // Return Value : // Modification history : // -// xxnov96:HJH -> creation +// xxnov96:HJH ->creation // //************************************************************************** @@ -235,7 +235,7 @@ BOOLEAN DbgInitialize(void) // Return Value : // Modification history : // -// xxnov96:HJH -> creation +// xxnov96:HJH ->creation // //************************************************************************** @@ -254,7 +254,7 @@ void DbgShutdown(void) // Return Value : // Modification history : // -// June 97: BR -> creation +// June 97: BR ->creation // //************************************************************************** @@ -324,7 +324,7 @@ void RemoveDebugText( void ) // Return Value : // Modification history : // -// June 97: BR -> creation +// June 97: BR ->creation // //************************************************************************** @@ -343,7 +343,6 @@ void DbgClearAllTopics( void ) } } - //************************************************************************** // // DbgMessageReal @@ -354,7 +353,7 @@ void DbgClearAllTopics( void ) // Return Value : // Modification history : // -// xxnov96:HJH -> creation +// xxnov96:HJH ->creation // //************************************************************************** void DbgMessageReal(UINT16 uiTopicId, UINT8 uiCommand, UINT8 uiDebugLevel, STR8 strMessage) @@ -362,7 +361,6 @@ void DbgMessageReal(UINT16 uiTopicId, UINT8 uiCommand, UINT8 uiDebugLevel, STR8 #ifndef _NO_DEBUG_TXT FILE *OutFile; #endif - // Check for a registered topic ID if ( uiTopicId < MAX_TOPICS_ALLOTED )//&& gfDebugTopics[uiTopicId] ) { @@ -379,7 +377,6 @@ void DbgMessageReal(UINT16 uiTopicId, UINT8 uiCommand, UINT8 uiDebugLevel, STR8 } #endif } - } //************************************************************************** @@ -392,7 +389,7 @@ void DbgMessageReal(UINT16 uiTopicId, UINT8 uiCommand, UINT8 uiDebugLevel, STR8 // Return Value : // Modification history : // -// 11nov96:HJH -> creation +// 11nov96:HJH ->creation // //************************************************************************** @@ -411,7 +408,7 @@ BOOLEAN DbgSetDebugLevel(UINT16 uiTopicId, UINT8 uiDebugLevel) // Return Value : // Modification history : // -// xxnov96:HJH -> creation +// xxnov96:HJH ->creation // //************************************************************************** @@ -493,7 +490,6 @@ void DbgShutdown(void) {}; #endif - #if defined ( _DEBUG ) || defined ( FORCE_ASSERTS_ON ) @@ -507,15 +503,14 @@ extern HVOBJECT FontObjs[25]; #ifdef JA2 //JAGGED ALLIANCE 2 VERSION ONLY void _FailMessage( STR8 pString, UINT32 uiLineNum, STR8 pSourceFile ) -{ +{ CHAR8 ubOutputString[512]; #ifndef _NO_DEBUG_TXT MSG Message; // FILE *DebugFile; #endif - BOOLEAN fDone = FALSE; //Build the output strings - sprintf( ubOutputString, "{ %ld } Assertion Failure [Line %d in %s]\n", GetTickCount(), uiLineNum, pSourceFile ); + sprintf( ubOutputString, "{ %ld } Assertion Failure [Line %d in \n%c %s]\n", GetTickCount(), uiLineNum, '\n', pSourceFile ); if( pString ) sprintf( gubAssertString, pString ); else @@ -540,6 +535,7 @@ void _FailMessage( STR8 pString, UINT32 uiLineNum, STR8 pSourceFile ) // 0verhaul: Replacement for the above. More consistent. DbgMessage( TOPIC_GAME, DBG_LEVEL_1, ubOutputString); + #if 0 if( !FontObjs[0] ) { //Font manager hasn't yet been initialized so use the windows error system @@ -554,7 +550,7 @@ void _FailMessage( STR8 pString, UINT32 uiLineNum, STR8 pSourceFile ) //NASTY HACK, THE GAME IS GOING TO DIE ANYWAY, SO WHO CARES WHAT WE DO. //This will actually bring up a screen that prints out the assert message //until the user hits esc or alt-x. - sprintf( gubErrorText, "Assertion Failure -- Line %d in %s", uiLineNum, pSourceFile ); + sprintf( gubErrorText, "Assertion Failure -- Line %d in %s %s", uiLineNum, std::string("\n").c_str(), pSourceFile ); SetPendingNewScreen( ERROR_SCREEN ); SetCurrentScreen( ERROR_SCREEN ); while (gfProgramIsRunning) diff --git a/Standard Gaming Platform/DbMan.cpp b/Standard Gaming Platform/DbMan.cpp index 5b9ff1be..d4cd1b8a 100644 --- a/Standard Gaming Platform/DbMan.cpp +++ b/Standard Gaming Platform/DbMan.cpp @@ -6,7 +6,7 @@ // // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // //************************************************************************** @@ -44,11 +44,11 @@ #define INITIAL_NUM_HANDLES 20 #define NUM_FILES_TO_ADD_AT_A_TIME 20 -#define CHECKF(exp) if (!(exp)) { return(FALSE); } -#define CHECKV(exp) if (!(exp)) { return; } -#define CHECKN(exp) if (!(exp)) { return(NULL); } +#define CHECKF(exp) if (!(exp)) { return(FALSE); } +#define CHECKV(exp) if (!(exp)) { return; } +#define CHECKN(exp) if (!(exp)) { return(NULL); } #define CHECKBI(exp) if (!(exp)) { return(-1); } -#define CHECK0(exp) if (!(exp)) { return(0); } +#define CHECK0(exp) if (!(exp)) { return(0); } #define PRINT_DEBUG_INFO FileDebugPrint(); @@ -194,7 +194,7 @@ BOOLEAN GetShortFilename( STR strFilename, STR strPathname ); // Return Value : // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // //************************************************************************** @@ -213,7 +213,7 @@ HDBFILE CreateDBFileHandle( HFILEINDEX high, HDBINDEX low ) // Return Value : // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // //************************************************************************** @@ -241,7 +241,7 @@ BOOLEAN InitializeDatabaseManager( STR strIndexFilename ) strcpy( gdb.strIndexFilename, strIndexFilename ); - RegisterDebugTopic( TOPIC_DATABASE_MANAGER, "Database Manager"); + RegisterDebugTopic( TOPIC_DATABASE_MANAGER, "Database Manager"); return(TRUE); } @@ -256,7 +256,7 @@ BOOLEAN InitializeDatabaseManager( STR strIndexFilename ) // Return Value : // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // //************************************************************************** @@ -281,7 +281,7 @@ void ShutdownDatabaseManager( void ) // release memory used MemFree( gdb.pDBFiles ); - UnRegisterDebugTopic( TOPIC_DATABASE_MANAGER, "Database Manager" ); + UnRegisterDebugTopic( TOPIC_DATABASE_MANAGER, "Database Manager" ); } //************************************************************************** @@ -294,7 +294,7 @@ void ShutdownDatabaseManager( void ) // Return Value : // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // //************************************************************************** @@ -311,16 +311,16 @@ void DbDebug( BOOLEAN fFlag ) // // Parameter List : // -// STR -> name of file to check existence of +// STR ->name of file to check existence of // // Return Value : // -// BOOLEAN -> TRUE if it exists -// -> FALSE if not +// BOOLEAN ->TRUE if it exists +// ->FALSE if not // // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // //************************************************************************** @@ -337,16 +337,16 @@ BOOLEAN DbExists( STR strFilename ) // // Parameter List : // -// STR -> filename +// STR ->filename // // Return Value : // -// HDBINDEX -> handle of opened file -// -> 0 if unsuccessful +// HDBINDEX ->handle of opened file +// ->0 if unsuccessful // // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // //************************************************************************** @@ -358,7 +358,7 @@ HDBINDEX DbOpen( STR strFilename ) CHAR cShortDBName[FILENAME_LENGTH]; BOOLEAN fFound; - fFound = FALSE; + fFound = FALSE; hDBIndex = 0; // first, find any already open databases, and make sure that if we're trying to @@ -423,12 +423,12 @@ HDBINDEX DbOpen( STR strFilename ) // // Parameter List : // -// HWFILE hFile -> handle to database file to close +// HWFILE hFile ->handle to database file to close // // Return Value : // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // //************************************************************************** @@ -452,17 +452,17 @@ void DbClose( HDBINDEX hFile ) // // Parameter List : // -// STR -> filename -// UIN32 -> access - read or write, or both -// BOOLEAN -> delete on close +// STR ->filename +// UIN32 ->access - read or write, or both +// BOOLEAN ->delete on close // // Return Value : // -// HWFILE -> handle of opened file +// HWFILE ->handle of opened file // // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // //************************************************************************** @@ -491,7 +491,7 @@ HDBFILE DbFileOpen( STR strFilename ) DbFile *pNew; pNew = (DbFile *) MemRealloc( gdb.pDBFiles[hDBIndex].pOpenFiles, - gdb.pDBFiles[hDBIndex].uiNumFiles + NUM_FILES_TO_ADD_AT_A_TIME ); + gdb.pDBFiles[hDBIndex].uiNumFiles + NUM_FILES_TO_ADD_AT_A_TIME ); if ( !pNew ) { @@ -519,12 +519,12 @@ HDBFILE DbFileOpen( STR strFilename ) // // Parameter List : // -// HWFILE hFile -> handle to database file to close +// HWFILE hFile ->handle to database file to close // // Return Value : // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // //************************************************************************** @@ -534,7 +534,7 @@ void DbFileClose( HDBFILE hDBFile ) HDBINDEX hDBIndex; hFileIndex = ExtractFileIndex( hDBFile ); - hDBIndex = ExtractDbIndex( hDBFile ); + hDBIndex = ExtractDbIndex( hDBFile ); if ( hDBIndex >= gdb.uiNumDBFiles ) return; @@ -559,19 +559,19 @@ void DbFileClose( HDBFILE hDBFile ) // // Parameter List : // -// HWFILE -> handle to file to read from -// void * -> source buffer -// UINT32 -> num bytes to read -// UINT32 -> num bytes read +// HWFILE ->handle to file to read from +// void * ->source buffer +// UINT32 ->num bytes to read +// UINT32 ->num bytes read // // Return Value : // -// BOOLEAN -> TRUE if successful -// -> FALSE if not +// BOOLEAN ->TRUE if successful +// ->FALSE if not // // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // //************************************************************************** @@ -583,7 +583,7 @@ BOOLEAN DbFileRead(HDBFILE hDBFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *pui UINT32 uiStartPos, uiCurPos, uiBytesRead; hFileIndex = ExtractFileIndex( hDBFile ); - hDBIndex = ExtractDbIndex( hDBFile ); + hDBIndex = ExtractDbIndex( hDBFile ); CHECKF( hDBIndex < gdb.uiNumDBFiles ); CHECKF( gdb.pDBFiles[hDBIndex].pOpenFiles ) @@ -618,12 +618,12 @@ BOOLEAN DbFileRead(HDBFILE hDBFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *pui // // Return Value : // -// BOOLEAN -> TRUE if successful -// -> FALSE if not +// BOOLEAN ->TRUE if successful +// ->FALSE if not // // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // //************************************************************************** @@ -652,18 +652,18 @@ BOOLEAN DbFileLoad(STR filename, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiByt // // Parameter List : // -// HWFILE -> handle to file to seek in -// UINT32 -> distance to seek -// UINT8 -> how to seek +// HWFILE ->handle to file to seek in +// UINT32 ->distance to seek +// UINT8 ->how to seek // // Return Value : // -// BOOLEAN -> TRUE if successful -// -> FALSE if not +// BOOLEAN ->TRUE if successful +// ->FALSE if not // // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // //************************************************************************** @@ -674,7 +674,7 @@ BOOLEAN DbFileSeek( HDBFILE hDBFile, UINT32 uiDistance, UINT8 uiHow ) UINT32 uiStartPos, uiCurPos, uiSize; hFileIndex = ExtractFileIndex( hDBFile ); - hDBIndex = ExtractDbIndex( hDBFile ); + hDBIndex = ExtractDbIndex( hDBFile ); CHECKF( hDBIndex < gdb.uiNumDBFiles ); CHECKF( gdb.pDBFiles[hDBIndex].pOpenFiles ) @@ -705,16 +705,16 @@ BOOLEAN DbFileSeek( HDBFILE hDBFile, UINT32 uiDistance, UINT8 uiHow ) // // Parameter List : // -// HWFILE -> handle to file +// HWFILE ->handle to file // // Return Value : // -// INT32 -> current offset in file if successful -// -> -1 if not +// INT32 ->current offset in file if successful +// ->-1 if not // // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // //************************************************************************** @@ -724,7 +724,7 @@ UINT32 DbFileGetPos( HDBFILE hDBFile ) HDBINDEX hDBIndex; hFileIndex = ExtractFileIndex( hDBFile ); - hDBIndex = ExtractDbIndex( hDBFile ); + hDBIndex = ExtractDbIndex( hDBFile ); CHECK0( hDBIndex < gdb.uiNumDBFiles ); CHECK0( gdb.pDBFiles[hDBIndex].pOpenFiles ) @@ -742,16 +742,16 @@ UINT32 DbFileGetPos( HDBFILE hDBFile ) // // Parameter List : // -// HWFILE -> handle to file +// HWFILE ->handle to file // // Return Value : // -// INT32 -> file size in file if successful -// -> 0 if not +// INT32 ->file size in file if successful +// ->0 if not // // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // //************************************************************************** @@ -761,7 +761,7 @@ UINT32 DbFileGetSize( HDBFILE hDBFile ) HDBINDEX hDBIndex; hFileIndex = ExtractFileIndex( hDBFile ); - hDBIndex = ExtractDbIndex( hDBFile ); + hDBIndex = ExtractDbIndex( hDBFile ); CHECK0( hDBIndex < gdb.uiNumDBFiles ); CHECK0( gdb.pDBFiles[hDBIndex].pOpenFiles ) @@ -781,7 +781,7 @@ UINT32 DbFileGetSize( HDBFILE hDBFile ) // Return Value : // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // //************************************************************************** @@ -799,7 +799,7 @@ void DbDebugPrint( void ) // Return Value : // Modification history : // -// 15oct96:HJH -> creation +// 15oct96:HJH ->creation // //************************************************************************** @@ -842,7 +842,7 @@ BOOLEAN InitDB( DbInfo *pDBInfo, STR strFilename ) // Return Value : // Modification history : // -// 15oct96:HJH -> creation +// 15oct96:HJH ->creation // //************************************************************************** @@ -888,7 +888,7 @@ HDBINDEX OpenDatabaseContainingFile( STR strFilename ) // Return Value : // Modification history : // -// 15oct96:HJH -> creation +// 15oct96:HJH ->creation // //************************************************************************** @@ -938,7 +938,7 @@ BOOLEAN InitFile( HWFILE hDBFile, DbFile *pFileInfo, STR strFilename ) // Return Value : // Modification history : // -// 15oct96:HJH -> creation +// 15oct96:HJH ->creation // //************************************************************************** @@ -1015,7 +1015,7 @@ BOOLEAN LoadBucket( CHAR cFirstLetter ) // Return Value : // Modification history : // -// 15oct96:HJH -> creation +// 15oct96:HJH ->creation // //************************************************************************** diff --git a/Standard Gaming Platform/DbMan.h b/Standard Gaming Platform/DbMan.h index 85b20e43..13af5e63 100644 --- a/Standard Gaming Platform/DbMan.h +++ b/Standard Gaming Platform/DbMan.h @@ -28,11 +28,11 @@ //************************************************************************** #ifndef FILE_ACCESS_READ -#define FILE_ACCESS_READ 0x01 +#define FILE_ACCESS_READ 0x01 #endif #ifndef FILE_ACCESS_WRITE -#define FILE_ACCESS_WRITE 0x02 +#define FILE_ACCESS_WRITE 0x02 #endif #define FILE_SEEK_FROM_START 0x01 // keep in sync with fileman.h diff --git a/Standard Gaming Platform/DirectDraw Calls.cpp b/Standard Gaming Platform/DirectDraw Calls.cpp index 97eebc4f..d315a284 100644 --- a/Standard Gaming Platform/DirectDraw Calls.cpp +++ b/Standard Gaming Platform/DirectDraw Calls.cpp @@ -50,12 +50,12 @@ DDCreateSurfaceInMemory ( LPDIRECTDRAW2 pExistingDirectDraw, // copy to a local so we don't change the input parameter memcpy ( &DDSurfaceDesc, pNewSurfaceDesc, sizeof ( DDSURFACEDESC ) ); - + // must have caps set since we are adding to the ddsCaps element DDSurfaceDesc.dwFlags |= DDSD_CAPS; // If this is a hardware D3D driver, the Z-Buffer MUST end up in video - // memory. Otherwise, it MUST end up in system memory. + // memory. Otherwise, it MUST end up in system memory. if ( fVideoMemory ) DDSurfaceDesc.ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY; else @@ -64,7 +64,7 @@ DDCreateSurfaceInMemory ( LPDIRECTDRAW2 pExistingDirectDraw, // create the surface DDCreateSurface ( pExistingDirectDraw, &DDSurfaceDesc, ppNewSurface1, ppNewSurface2 ); - // get surface information + // get surface information DDGetSurfaceDescription ( *ppNewSurface2, &DDSurfaceDesc ); // was the surface created in video memory? @@ -123,7 +123,7 @@ void DDGetSurfaceDescription ( LPDIRECTDRAWSURFACE2 pSurface, DDSURFACEDESC *pSu void DDGetSurfaceCaps ( LPDIRECTDRAWSURFACE2 pSurface, DDSCAPS *pSurfaceCaps ) { - Assert( pSurface != NULL ); + Assert( pSurface != NULL ); Assert( pSurfaceCaps != NULL ); ATTEMPT( IDirectDrawSurface2_GetCaps( pSurface, pSurfaceCaps ) ); @@ -131,9 +131,9 @@ void DDGetSurfaceCaps ( LPDIRECTDRAWSURFACE2 pSurface, DDSCAPS *pSurfaceCaps ) } void DDCreateRasterSurface ( LPDIRECTDRAW2 pDirectDraw, INT32 iWidth, INT32 iHeight, - BOOLEAN fVideoMemory, - LPDIRECTDRAWSURFACE *ppRasterSurface1, - LPDIRECTDRAWSURFACE2 *ppRasterSurface2 ) + BOOLEAN fVideoMemory, + LPDIRECTDRAWSURFACE *ppRasterSurface1, + LPDIRECTDRAWSURFACE2 *ppRasterSurface2 ) { DDSURFACEDESC DDSurfaceDesc; @@ -155,9 +155,9 @@ void DDCreateRasterSurface ( LPDIRECTDRAW2 pDirectDraw, INT32 iWidth, INT32 iHei } void DDCreateZBufferSurface ( LPDIRECTDRAW2 pDirectDraw, INT32 iWidth, INT32 iHeight, - BOOLEAN fVideoMemory, - LPDIRECTDRAWSURFACE *ppZBufferSurface1, - LPDIRECTDRAWSURFACE2 *ppZBufferSurface2 ) + BOOLEAN fVideoMemory, + LPDIRECTDRAWSURFACE *ppZBufferSurface1, + LPDIRECTDRAWSURFACE2 *ppZBufferSurface2 ) { DDSURFACEDESC DDSurfaceDesc; @@ -183,9 +183,9 @@ void DDAddAttachedSurface ( LPDIRECTDRAWSURFACE2 pParentSurface, LPDIRECTDRAWSURFACE2 pAddChildSurface ) { - Assert ( pParentSurface != NULL ); + Assert ( pParentSurface != NULL ); Assert ( pAddChildSurface != NULL ); - + // attach the child to the parent surface ATTEMPT ( IDirectDrawSurface2_AddAttachedSurface ( pParentSurface, pAddChildSurface ) ); @@ -195,7 +195,7 @@ void DDDeleteAttachedSurface ( LPDIRECTDRAWSURFACE2 pParentSurface, LPDIRECTDRAWSURFACE2 pDeleteChildSurface ) { - Assert ( pParentSurface != NULL ); + Assert ( pParentSurface != NULL ); Assert ( pDeleteChildSurface != NULL ); // seperate the z buffer surface from the raster surface @@ -226,13 +226,13 @@ void DDRestoreSurface( LPDIRECTDRAWSURFACE2 pSurface ) } -void DDBltFastSurface( LPDIRECTDRAWSURFACE2 pDestSurface, UINT32 uiX, UINT32 uiY, LPDIRECTDRAWSURFACE2 pSrcSurface, +void DDBltFastSurface( LPDIRECTDRAWSURFACE2 pDestSurface, UINT32 uiX, UINT32 uiY, LPDIRECTDRAWSURFACE2 pSrcSurface, LPRECT pSrcRect, UINT32 uiTrans) { HRESULT ReturnCode; - Assert( pDestSurface != NULL ); - Assert( pSrcSurface != NULL ); + Assert( pDestSurface != NULL ); + Assert( pSrcSurface != NULL ); do { @@ -243,12 +243,12 @@ void DDBltFastSurface( LPDIRECTDRAWSURFACE2 pDestSurface, UINT32 uiX, UINT32 uiY void DDBltSurface( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDestRect, LPDIRECTDRAWSURFACE2 pSrcSurface, - LPRECT pSrcRect, UINT32 uiFlags, LPDDBLTFX pDDBltFx ) + LPRECT pSrcRect, UINT32 uiFlags, LPDDBLTFX pDDBltFx ) { HRESULT ReturnCode; - Assert( pDestSurface != NULL ); + Assert( pDestSurface != NULL ); do { @@ -272,7 +272,7 @@ void DDCreatePalette( LPDIRECTDRAW2 pDirectDraw, UINT32 uiFlags, LPPALETTEENTRY void DDSetSurfacePalette( LPDIRECTDRAWSURFACE2 pSurface, LPDIRECTDRAWPALETTE pDDPalette ) { - Assert( pDDPalette != NULL ); + Assert( pDDPalette != NULL ); Assert( pSurface != NULL ); ATTEMPT( IDirectDrawSurface2_SetPalette( pSurface, pDDPalette ) ); @@ -294,7 +294,7 @@ void DDSetPaletteEntries( LPDIRECTDRAWPALETTE pPalette, UINT32 uiFlags, UINT32 u Assert( pPalette != NULL ); Assert( pEntries != NULL ); - ATTEMPT( IDirectDrawPalette_SetEntries( pPalette, uiFlags, uiStartingEntry, uiCount, pEntries ) ); + ATTEMPT( IDirectDrawPalette_SetEntries( pPalette, uiFlags, uiStartingEntry, uiCount, pEntries ) ); } @@ -304,7 +304,7 @@ void DDGetPaletteEntries( LPDIRECTDRAWPALETTE pPalette, UINT32 uiFlags, UINT32 u Assert( pPalette != NULL ); Assert( pEntries != NULL ); - ATTEMPT( IDirectDrawPalette_GetEntries( pPalette, uiFlags, uiBase, uiNumEntries, pEntries ) ); + ATTEMPT( IDirectDrawPalette_GetEntries( pPalette, uiFlags, uiBase, uiNumEntries, pEntries ) ); } @@ -381,7 +381,7 @@ void DDSetClipperList( LPDIRECTDRAWCLIPPER pDDClipper, LPRGNDATA pClipList, UINT { Assert( pDDClipper != NULL ); Assert( pClipList != NULL ); - + ATTEMPT( IDirectDrawClipper_SetClipList( pDDClipper, pClipList, uiFlags ) ); } @@ -391,30 +391,30 @@ HRESULT BltFastDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, INT32 { DDSURFACEDESC SurfaceDescription; UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; - UINT8 *pDestBuf, *pSrcBuf; - HRESULT ReturnCode; - DDCOLORKEY ColorKey; + UINT8 *pDestBuf, *pSrcBuf; + HRESULT ReturnCode; + DDCOLORKEY ColorKey; UINT16 us16BPPColorKey; // Lock surfaces DDLockSurface( (LPDIRECTDRAWSURFACE2)pDestSurface, NULL, &SurfaceDescription, 0, NULL); uiDestPitchBYTES = SurfaceDescription.lPitch; - pDestBuf = (UINT8 *) SurfaceDescription.lpSurface; + pDestBuf = (UINT8 *) SurfaceDescription.lpSurface; // Lock surfaces DDLockSurface( (LPDIRECTDRAWSURFACE2)pSrcSurface, NULL, &SurfaceDescription, 0, NULL); uiSrcPitchBYTES = SurfaceDescription.lPitch; - pSrcBuf = (UINT8 *) SurfaceDescription.lpSurface; + pSrcBuf = (UINT8 *) SurfaceDescription.lpSurface; if ( uiTrans == DDBLTFAST_NOCOLORKEY ) { - Blt16BPPTo16BPP( (UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - uiX , uiY, - pSrcRect->left , pSrcRect->top, - ( pSrcRect->right - pSrcRect->left ), + Blt16BPPTo16BPP( (UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + uiX , uiY, + pSrcRect->left , pSrcRect->top, + ( pSrcRect->right - pSrcRect->left ), ( pSrcRect->bottom - pSrcRect->top ) ); } else if ( uiTrans == DDBLTFAST_SRCCOLORKEY ) @@ -422,20 +422,20 @@ HRESULT BltFastDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, INT32 // Get 16 bpp color key..... ReturnCode = IDirectDrawSurface2_GetColorKey( pSrcSurface, DDCKEY_SRCBLT, &ColorKey); - if (ReturnCode == DD_OK) + if (ReturnCode == DD_OK) { us16BPPColorKey = (UINT16)ColorKey.dwColorSpaceLowValue; - Blt16BPPTo16BPPTrans( (UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - uiX , uiY, - pSrcRect->left , pSrcRect->top, - ( pSrcRect->right - pSrcRect->left ), + Blt16BPPTo16BPPTrans( (UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + uiX , uiY, + pSrcRect->left , pSrcRect->top, + ( pSrcRect->right - pSrcRect->left ), ( pSrcRect->bottom - pSrcRect->top ), us16BPPColorKey ); } } - else + else { // Not supported..... } @@ -453,15 +453,15 @@ HRESULT BltDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDe DDSURFACEDESC SurfaceDescription; UINT32 uiDestPitchBYTES, uiSrcPitchBYTES = 0; UINT8 *pDestBuf, *pSrcBuf = NULL; - HRESULT ReturnCode; - DDCOLORKEY ColorKey; + HRESULT ReturnCode; + DDCOLORKEY ColorKey; UINT16 us16BPPColorKey; // Lock surfaces DDLockSurface( (LPDIRECTDRAWSURFACE2)pDestSurface, NULL, &SurfaceDescription, 0, NULL); uiDestPitchBYTES = SurfaceDescription.lPitch; - pDestBuf = (UINT8 *) SurfaceDescription.lpSurface; + pDestBuf = (UINT8 *) SurfaceDescription.lpSurface; if ( pSrcSurface != NULL ) @@ -469,12 +469,12 @@ HRESULT BltDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDe // Lock surfaces DDLockSurface( (LPDIRECTDRAWSURFACE2)pSrcSurface, NULL, &SurfaceDescription, 0, NULL); uiSrcPitchBYTES = SurfaceDescription.lPitch; - pSrcBuf = (UINT8 *) SurfaceDescription.lpSurface; + pSrcBuf = (UINT8 *) SurfaceDescription.lpSurface; } - if ( pSrcRect != NULL && - ( ( pSrcRect->right - pSrcRect->left ) != ( pDestRect->right - pDestRect->left ) || - ( pSrcRect->bottom - pSrcRect->top ) != ( pDestRect->bottom - pDestRect->top ) ) ) + if ( pSrcRect != NULL && + ( ( pSrcRect->right - pSrcRect->left ) != ( pDestRect->right - pDestRect->left ) || + ( pSrcRect->bottom - pSrcRect->top ) != ( pDestRect->bottom - pDestRect->top ) ) ) { DDUnlockSurface( (LPDIRECTDRAWSURFACE2)pDestSurface, NULL ); @@ -493,13 +493,13 @@ HRESULT BltDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDe // Lock surfaces DDLockSurface( (LPDIRECTDRAWSURFACE2)pSrcSurface, NULL, &SurfaceDescription, 0, NULL); uiSrcPitchBYTES = SurfaceDescription.lPitch; - pSrcBuf = (UINT8 *) SurfaceDescription.lpSurface; + pSrcBuf = (UINT8 *) SurfaceDescription.lpSurface; - Blt16BPPTo16BPP( (UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - pDestRect->left , pDestRect->top, - pSrcRect->left , pSrcRect->top, - ( pSrcRect->right - pSrcRect->left ), + Blt16BPPTo16BPP( (UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + pDestRect->left , pDestRect->top, + pSrcRect->left , pSrcRect->top, + ( pSrcRect->right - pSrcRect->left ), ( pSrcRect->bottom - pSrcRect->top ) ); } else if ( uiFlags & DDBLT_KEYSRC ) @@ -507,15 +507,15 @@ HRESULT BltDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDe // Get 16 bpp color key..... ReturnCode = IDirectDrawSurface2_GetColorKey( pSrcSurface, DDCKEY_SRCBLT, &ColorKey); - if (ReturnCode == DD_OK) + if (ReturnCode == DD_OK) { us16BPPColorKey = (UINT16)ColorKey.dwColorSpaceLowValue; - Blt16BPPTo16BPPTrans( (UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - pDestRect->left , pDestRect->top, - pSrcRect->left , pSrcRect->top, - ( pSrcRect->right - pSrcRect->left ), + Blt16BPPTo16BPPTrans( (UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + pDestRect->left , pDestRect->top, + pSrcRect->left , pSrcRect->top, + ( pSrcRect->right - pSrcRect->left ), ( pSrcRect->bottom - pSrcRect->top ), us16BPPColorKey ); } diff --git a/Standard Gaming Platform/DirectDraw Calls.h b/Standard Gaming Platform/DirectDraw Calls.h index 2d475708..e94ed8c5 100644 --- a/Standard Gaming Platform/DirectDraw Calls.h +++ b/Standard Gaming Platform/DirectDraw Calls.h @@ -20,11 +20,11 @@ void DDCreateSurfaceInMemory ( LPDIRECTDRAW2 pExistingDirectDraw, BOOLEAN fVideoMemory, LPDIRECTDRAWSURFACE *ppNewSurface1, LPDIRECTDRAWSURFACE2 *ppNewSurface2 ); void DDCreateZBufferSurface ( LPDIRECTDRAW2 pDirectDraw, INT32 iWidth, INT32 iHeight, - BOOLEAN fVideoMemory, LPDIRECTDRAWSURFACE *ppZBufferSurface1, - LPDIRECTDRAWSURFACE2 *ppZBufferSurface2 ); + BOOLEAN fVideoMemory, LPDIRECTDRAWSURFACE *ppZBufferSurface1, + LPDIRECTDRAWSURFACE2 *ppZBufferSurface2 ); void DDCreateRasterSurface ( LPDIRECTDRAW2 pDirectDraw, INT32 iWidth, INT32 iHeight, - BOOLEAN fVideoMemory, LPDIRECTDRAWSURFACE *ppRasterSurface1, - LPDIRECTDRAWSURFACE2 *ppRasterSurface2 ); + BOOLEAN fVideoMemory, LPDIRECTDRAWSURFACE *ppRasterSurface1, + LPDIRECTDRAWSURFACE2 *ppRasterSurface2 ); void DDGetSurfaceDescription ( LPDIRECTDRAWSURFACE2 pSurface, DDSURFACEDESC *pSurfaceDesc ); void DDGetSurfaceCaps ( LPDIRECTDRAWSURFACE2 pSurface, DDSCAPS *pSurfaceCaps ); void DDAddAttachedSurface ( LPDIRECTDRAWSURFACE2 pParentSurface, @@ -37,7 +37,7 @@ void DDGetDDInterface( LPDIRECTDRAWSURFACE2 pSurface, LPDIRECTDRAW *ppDirectDraw void DDLockSurface( LPDIRECTDRAWSURFACE2 pSurface, LPRECT pDestRect, LPDDSURFACEDESC pSurfaceDesc, - UINT32 uiFlags, HANDLE hEvent); + UINT32 uiFlags, HANDLE hEvent); void DDUnlockSurface( LPDIRECTDRAWSURFACE2 pSurface, PTR pSurfaceData ); @@ -47,7 +47,7 @@ void DDBltFastSurface( LPDIRECTDRAWSURFACE2 pDestSurface, UINT32 uiX, UINT32 uiY LPRECT pSrcRect, UINT32 uiTrans); void DDBltSurface( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDestRect, LPDIRECTDRAWSURFACE2 pSrcSurface, - LPRECT pSrcRect, UINT32 uiFlags, LPDDBLTFX pDDBltFx ); + LPRECT pSrcRect, UINT32 uiFlags, LPDDBLTFX pDDBltFx ); void DDSetSurfacePalette( LPDIRECTDRAWSURFACE2 pSurface, LPDIRECTDRAWPALETTE pDDPalette ); @@ -86,8 +86,8 @@ HRESULT BltFastDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, INT32 HRESULT BltDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDestRect, LPDIRECTDRAWSURFACE2 pSrcSurface, LPRECT pSrcRect, UINT32 uiFlags, LPDDBLTFX pDDBltFx ); -#define IDirectDrawSurface2_SGPBltFast(p,a,b,c,d,e) ( ( gfDontUseDDBlits == TRUE ) ? BltFastDDSurfaceUsingSoftware( p, a, b, c, d, e ) : ( IDirectDrawSurface2_BltFast(p,a,b,c,d,e) ) ) -#define IDirectDrawSurface2_SGPBlt(p,a,b,c,d,e) ( ( gfDontUseDDBlits == TRUE ) ? BltDDSurfaceUsingSoftware( p, a, b, c, d, e ) : ( IDirectDrawSurface2_Blt(p,a,b,c,d,e) ) ) +#define IDirectDrawSurface2_SGPBltFast(p,a,b,c,d,e) ( ( gfDontUseDDBlits == TRUE ) ? BltFastDDSurfaceUsingSoftware( p, a, b, c, d, e ) : ( IDirectDrawSurface2_BltFast(p,a,b,c,d,e) ) ) +#define IDirectDrawSurface2_SGPBlt(p,a,b,c,d,e) ( ( gfDontUseDDBlits == TRUE ) ? BltDDSurfaceUsingSoftware( p, a, b, c, d, e ) : ( IDirectDrawSurface2_Blt(p,a,b,c,d,e) ) ) #ifdef __cplusplus diff --git a/Standard Gaming Platform/DirectX Common.cpp b/Standard Gaming Platform/DirectX Common.cpp index c5cc2694..832d3037 100644 --- a/Standard Gaming Platform/DirectX Common.cpp +++ b/Standard Gaming Platform/DirectX Common.cpp @@ -14,7 +14,7 @@ #include "debug.h" #endif -void DirectXZeroMem ( void* pMemory, int nSize ) +void DirectXZeroMem ( void* pMemory, int nSize ) { memset ( pMemory, 0, nSize ); } @@ -26,219 +26,219 @@ void DirectXAttempt ( INT32 iErrorCode, INT32 nLine, STR8 szFilename ) if ( iErrorCode != DD_OK ) { FastDebugMsg("DIRECTX COMMON: DirectX Error\n" ); - FastDebugMsg(DirectXErrorDescription(iErrorCode)); + FastDebugMsg(DirectXErrorDescription(iErrorCode)); } #endif } STR8 DirectXErrorDescription ( INT32 iDXReturn ) { - switch( iDXReturn ) - { - case DD_OK - : return "No error.\0"; - case DDERR_ALREADYINITIALIZED - : return "The object has already been initialized."; - case DDERR_BLTFASTCANTCLIP - : return "A DirectDrawClipper object is attached to a source surface that has passed into a call to the IDirectDrawSurface2::BltFast method."; - case DDERR_CANNOTATTACHSURFACE - : return "A surface cannot be attached to another requested surface."; - case DDERR_CANNOTDETACHSURFACE - : return "A surface cannot be detached from another requested surface."; - case DDERR_CANTCREATEDC - : return "Windows cannot create any more device contexts (DCs)."; - case DDERR_CANTDUPLICATE - : return "Primary and 3D surfaces, or surfaces that are implicitly created, cannot be duplicated."; - case DDERR_CANTLOCKSURFACE - : return "Access to this surface is refused because an attempt was made to lock the primary surface without DCI support."; - case DDERR_CANTPAGELOCK - : return "An attempt to page lock a surface failed. Page lock will not work on a display-memory surface or an emulated primary surface."; - case DDERR_CANTPAGEUNLOCK - : return "An attempt to page unlock a surface failed. Page unlock will not work on a display-memory surface or an emulated primary surface."; - case DDERR_CLIPPERISUSINGHWND - : return "An attempt was made to set a clip list for a DirectDrawClipper object that is already monitoring a window handle."; - case DDERR_COLORKEYNOTSET - : return "No source color key is specified for this operation."; - case DDERR_CURRENTLYNOTAVAIL - : return "No support is currently available."; - case DDERR_DCALREADYCREATED - : return "A device context (DC) has already been returned for this surface. Only one DC can be retrieved for each surface."; - case DDERR_DIRECTDRAWALREADYCREATED - : return "A DirectDraw object representing this driver has already been created for this process."; - case DDERR_EXCEPTION - : return "An exception was encountered while performing the requested operation."; - case DDERR_EXCLUSIVEMODEALREADYSET - : return "An attempt was made to set the cooperative level when it was already set to exclusive."; - case DDERR_GENERIC - : return "There is an undefined error condition."; - case DDERR_HEIGHTALIGN - : return "The height of the provided rectangle is not a multiple of the required alignment."; - case DDERR_HWNDALREADYSET - : return "The DirectDraw cooperative level window handle has already been set. It cannot be reset while the process has surfaces or palettes created."; - case DDERR_HWNDSUBCLASSED - : return "DirectDraw is prevented from restoring state because the DirectDraw cooperative level window handle has been subclassed."; - case DDERR_IMPLICITLYCREATED - : return "The surface cannot be restored because it is an implicitly created surface."; - case DDERR_INCOMPATIBLEPRIMARY - : return "The primary surface creation request does not match with the existing primary surface."; - case DDERR_INVALIDCAPS - : return "One or more of the capability bits passed to the callback function are incorrect."; - case DDERR_INVALIDCLIPLIST - : return "DirectDraw does not support the provided clip list."; - case DDERR_INVALIDDIRECTDRAWGUID - : return "The globally unique identifier (GUID) passed to the DirectDrawCreate function is not a valid DirectDraw driver identifier."; - case DDERR_INVALIDMODE - : return "DirectDraw does not support the requested mode."; - case DDERR_INVALIDOBJECT - : return "DirectDraw received a pointer that was an invalid DirectDraw object."; - case DDERR_INVALIDPARAMS - : return "One or more of the parameters passed to the method are incorrect."; - case DDERR_INVALIDPIXELFORMAT - : return "The pixel format was invalid as specified."; - case DDERR_INVALIDPOSITION - : return "The position of the overlay on the destination is no longer legal."; - case DDERR_INVALIDRECT - : return "The provided rectangle was invalid."; - case DDERR_INVALIDSURFACETYPE - : return "The requested operation could not be performed because the surface was of the wrong type."; - case DDERR_LOCKEDSURFACES - : return "One or more surfaces are locked, causing the failure of the requested operation."; - case DDERR_NO3D - : return "No 3D hardware or emulation is present."; - case DDERR_NOALPHAHW - : return "No alpha acceleration hardware is present or available, causing the failure of the requested operation."; - case DDERR_NOBLTHW - : return "No blitter hardware is present."; - case DDERR_NOCLIPLIST - : return "No clip list is available."; - case DDERR_NOCLIPPERATTACHED - : return "No DirectDrawClipper object is attached to the surface object."; - case DDERR_NOCOLORCONVHW - : return "The operation cannot be carried out because no color-conversion hardware is present or available."; - case DDERR_NOCOLORKEY - : return "The surface does not currently have a color key."; - case DDERR_NOCOLORKEYHW - : return "The operation cannot be carried out because there is no hardware support for the destination color key."; - case DDERR_NOCOOPERATIVELEVELSET - : return "A create function is called without the IDirectDraw2::SetCooperativeLevel method being called."; - case DDERR_NODC - : return "No DC has ever been created for this surface."; - case DDERR_NODDROPSHW - : return "No DirectDraw raster operation (ROP) hardware is available."; - case DDERR_NODIRECTDRAWHW - : return "Hardware-only DirectDraw object creation is not possible; the driver does not support any hardware."; - case DDERR_NODIRECTDRAWSUPPORT - : return "DirectDraw support is not possible with the current display driver."; - case DDERR_NOEMULATION - : return "Software emulation is not available."; - case DDERR_NOEXCLUSIVEMODE - : return "The operation requires the application to have exclusive mode, but the application does not have exclusive mode."; - case DDERR_NOFLIPHW - : return "Flipping visible surfaces is not supported."; - case DDERR_NOGDI - : return "No GDI is present."; - case DDERR_NOHWND - : return "Clipper notification requires a window handle, or no window handle has been previously set as the cooperative level window handle."; - case DDERR_NOMIPMAPHW - : return "The operation cannot be carried out because no mipmap texture mapping hardware is present or available."; - case DDERR_NOMIRRORHW - : return "The operation cannot be carried out because no mirroring hardware is present or available."; - case DDERR_NOOVERLAYDEST - : return "The IDirectDrawSurface2::GetOverlayPosition method is called on an overlay that the IDirectDrawSurface2::UpdateOverlay method has not been called on to establish a destination."; - case DDERR_NOOVERLAYHW - : return "The operation cannot be carried out because no overlay hardware is present or available."; - case DDERR_NOPALETTEATTACHED - : return "No palette object is attached to this surface."; - case DDERR_NOPALETTEHW - : return "There is no hardware support for 16- or 256-color palettes."; - case DDERR_NORASTEROPHW - : return "The operation cannot be carried out because no appropriate raster operation hardware is present or available."; - case DDERR_NOROTATIONHW - : return "The operation cannot be carried out because no rotation hardware is present or available."; - case DDERR_NOSTRETCHHW - : return "The operation cannot be carried out because there is no hardware support for stretching."; - case DDERR_NOT4BITCOLOR - : return "The DirectDrawSurface object is not using a 4-bit color palette and the requested operation requires a 4-bit color palette."; - case DDERR_NOT4BITCOLORINDEX - : return "The DirectDrawSurface object is not using a 4-bit color index palette and the requested operation requires a 4-bit color index palette."; - case DDERR_NOT8BITCOLOR - : return "The DirectDrawSurface object is not using an 8-bit color palette and the requested operation requires an 8-bit color palette."; - case DDERR_NOTAOVERLAYSURFACE - : return "An overlay component is called for a non-overlay surface."; - case DDERR_NOTEXTUREHW - : return "The operation cannot be carried out because no texture-mapping hardware is present or available."; - case DDERR_NOTFLIPPABLE - : return "An attempt has been made to flip a surface that cannot be flipped."; - case DDERR_NOTFOUND - : return "The requested item was not found."; - case DDERR_NOTINITIALIZED - : return "An attempt was made to call an interface method of a DirectDraw object created by CoCreateInstance before the object was initialized."; - case DDERR_NOTLOCKED - : return "An attempt is made to unlock a surface that was not locked."; - case DDERR_NOTPAGELOCKED - : return "An attempt is made to page unlock a surface with no outstanding page locks."; - case DDERR_NOTPALETTIZED - : return "The surface being used is not a palette-based surface."; - case DDERR_NOVSYNCHW - : return "The operation cannot be carried out because there is no hardware support for vertical blank synchronized operations."; - case DDERR_NOZBUFFERHW - : return "The operation to create a z-buffer in display memory or to perform a blit using a z-buffer cannot be carried out because there is no hardware support for z-buffers."; - case DDERR_NOZOVERLAYHW - : return "The overlay surfaces cannot be z-layered based on the z-order because the hardware does not support z-ordering of overlays."; - case DDERR_OUTOFCAPS - : return "The hardware needed for the requested operation has already been allocated."; - case DDERR_OUTOFMEMORY - : return "DirectDraw does not have enough memory to perform the operation."; - case DDERR_OUTOFVIDEOMEMORY - : return "DirectDraw does not have enough display memory to perform the operation."; - case DDERR_OVERLAYCANTCLIP - : return "The hardware does not support clipped overlays."; - case DDERR_OVERLAYCOLORKEYONLYONEACTIVE - : return "An attempt was made to have more than one color key active on an overlay."; - case DDERR_OVERLAYNOTVISIBLE - : return "The IDirectDrawSurface2::GetOverlayPosition method is called on a hidden overlay."; - case DDERR_PALETTEBUSY - : return "Access to this palette is refused because the palette is locked by another thread."; - case DDERR_PRIMARYSURFACEALREADYEXISTS - : return "This process has already created a primary surface."; - case DDERR_REGIONTOOSMALL - : return "The region passed to the IDirectDrawClipper::GetClipList method is too small."; - case DDERR_SURFACEALREADYATTACHED - : return "An attempt was made to attach a surface to another surface to which it is already attached."; - case DDERR_SURFACEALREADYDEPENDENT - : return "An attempt was made to make a surface a dependency of another surface to which it is already dependent."; - case DDERR_SURFACEBUSY - : return "Access to the surface is refused because the surface is locked by another thread."; - case DDERR_SURFACEISOBSCURED - : return "Access to the surface is refused because the surface is obscured."; - case DDERR_SURFACELOST - : return "Access to the surface is refused because the surface memory is gone. The DirectDrawSurface object representing this surface should have the IDirectDrawSurface2::Restore method called on it."; - case DDERR_SURFACENOTATTACHED - : return "The requested surface is not attached."; - case DDERR_TOOBIGHEIGHT - : return "The height requested by DirectDraw is too large."; - case DDERR_TOOBIGSIZE - : return "The size requested by DirectDraw is too large. However, the individual height and width are OK."; - case DDERR_TOOBIGWIDTH - : return "The width requested by DirectDraw is too large."; - case DDERR_UNSUPPORTED - : return "The operation is not supported."; - case DDERR_UNSUPPORTEDFORMAT - : return "The FourCC format requested is not supported by DirectDraw."; - case DDERR_UNSUPPORTEDMASK - : return "The bitmask in the pixel format requested is not supported by DirectDraw."; - case DDERR_UNSUPPORTEDMODE - : return "The display is currently in an unsupported mode."; - case DDERR_VERTICALBLANKINPROGRESS - : return "A vertical blank is in progress."; - case DDERR_WASSTILLDRAWING - : return "The previous blit operation that is transferring information to or from this surface is incomplete."; - case DDERR_WRONGMODE - : return "This surface cannot be restored because it was created in a different mode."; - case DDERR_XALIGN - : return "The provided rectangle was not horizontally aligned on a required boundary."; - default - : return "Unrecognized error value.\0"; - } + switch( iDXReturn ) + { + case DD_OK + : return "No error.\0"; + case DDERR_ALREADYINITIALIZED + : return "The object has already been initialized."; + case DDERR_BLTFASTCANTCLIP + : return "A DirectDrawClipper object is attached to a source surface that has passed into a call to the IDirectDrawSurface2::BltFast method."; + case DDERR_CANNOTATTACHSURFACE + : return "A surface cannot be attached to another requested surface."; + case DDERR_CANNOTDETACHSURFACE + : return "A surface cannot be detached from another requested surface."; + case DDERR_CANTCREATEDC + : return "Windows cannot create any more device contexts (DCs)."; + case DDERR_CANTDUPLICATE + : return "Primary and 3D surfaces, or surfaces that are implicitly created, cannot be duplicated."; + case DDERR_CANTLOCKSURFACE + : return "Access to this surface is refused because an attempt was made to lock the primary surface without DCI support."; + case DDERR_CANTPAGELOCK + : return "An attempt to page lock a surface failed. Page lock will not work on a display-memory surface or an emulated primary surface."; + case DDERR_CANTPAGEUNLOCK + : return "An attempt to page unlock a surface failed. Page unlock will not work on a display-memory surface or an emulated primary surface."; + case DDERR_CLIPPERISUSINGHWND + : return "An attempt was made to set a clip list for a DirectDrawClipper object that is already monitoring a window handle."; + case DDERR_COLORKEYNOTSET + : return "No source color key is specified for this operation."; + case DDERR_CURRENTLYNOTAVAIL + : return "No support is currently available."; + case DDERR_DCALREADYCREATED + : return "A device context (DC) has already been returned for this surface. Only one DC can be retrieved for each surface."; + case DDERR_DIRECTDRAWALREADYCREATED + : return "A DirectDraw object representing this driver has already been created for this process."; + case DDERR_EXCEPTION + : return "An exception was encountered while performing the requested operation."; + case DDERR_EXCLUSIVEMODEALREADYSET + : return "An attempt was made to set the cooperative level when it was already set to exclusive."; + case DDERR_GENERIC + : return "There is an undefined error condition."; + case DDERR_HEIGHTALIGN + : return "The height of the provided rectangle is not a multiple of the required alignment."; + case DDERR_HWNDALREADYSET + : return "The DirectDraw cooperative level window handle has already been set. It cannot be reset while the process has surfaces or palettes created."; + case DDERR_HWNDSUBCLASSED + : return "DirectDraw is prevented from restoring state because the DirectDraw cooperative level window handle has been subclassed."; + case DDERR_IMPLICITLYCREATED + : return "The surface cannot be restored because it is an implicitly created surface."; + case DDERR_INCOMPATIBLEPRIMARY + : return "The primary surface creation request does not match with the existing primary surface."; + case DDERR_INVALIDCAPS + : return "One or more of the capability bits passed to the callback function are incorrect."; + case DDERR_INVALIDCLIPLIST + : return "DirectDraw does not support the provided clip list."; + case DDERR_INVALIDDIRECTDRAWGUID + : return "The globally unique identifier (GUID) passed to the DirectDrawCreate function is not a valid DirectDraw driver identifier."; + case DDERR_INVALIDMODE + : return "DirectDraw does not support the requested mode."; + case DDERR_INVALIDOBJECT + : return "DirectDraw received a pointer that was an invalid DirectDraw object."; + case DDERR_INVALIDPARAMS + : return "One or more of the parameters passed to the method are incorrect."; + case DDERR_INVALIDPIXELFORMAT + : return "The pixel format was invalid as specified."; + case DDERR_INVALIDPOSITION + : return "The position of the overlay on the destination is no longer legal."; + case DDERR_INVALIDRECT + : return "The provided rectangle was invalid."; + case DDERR_INVALIDSURFACETYPE + : return "The requested operation could not be performed because the surface was of the wrong type."; + case DDERR_LOCKEDSURFACES + : return "One or more surfaces are locked, causing the failure of the requested operation."; + case DDERR_NO3D + : return "No 3D hardware or emulation is present."; + case DDERR_NOALPHAHW + : return "No alpha acceleration hardware is present or available, causing the failure of the requested operation."; + case DDERR_NOBLTHW + : return "No blitter hardware is present."; + case DDERR_NOCLIPLIST + : return "No clip list is available."; + case DDERR_NOCLIPPERATTACHED + : return "No DirectDrawClipper object is attached to the surface object."; + case DDERR_NOCOLORCONVHW + : return "The operation cannot be carried out because no color-conversion hardware is present or available."; + case DDERR_NOCOLORKEY + : return "The surface does not currently have a color key."; + case DDERR_NOCOLORKEYHW + : return "The operation cannot be carried out because there is no hardware support for the destination color key."; + case DDERR_NOCOOPERATIVELEVELSET + : return "A create function is called without the IDirectDraw2::SetCooperativeLevel method being called."; + case DDERR_NODC + : return "No DC has ever been created for this surface."; + case DDERR_NODDROPSHW + : return "No DirectDraw raster operation (ROP) hardware is available."; + case DDERR_NODIRECTDRAWHW + : return "Hardware-only DirectDraw object creation is not possible; the driver does not support any hardware."; + case DDERR_NODIRECTDRAWSUPPORT + : return "DirectDraw support is not possible with the current display driver."; + case DDERR_NOEMULATION + : return "Software emulation is not available."; + case DDERR_NOEXCLUSIVEMODE + : return "The operation requires the application to have exclusive mode, but the application does not have exclusive mode."; + case DDERR_NOFLIPHW + : return "Flipping visible surfaces is not supported."; + case DDERR_NOGDI + : return "No GDI is present."; + case DDERR_NOHWND + : return "Clipper notification requires a window handle, or no window handle has been previously set as the cooperative level window handle."; + case DDERR_NOMIPMAPHW + : return "The operation cannot be carried out because no mipmap texture mapping hardware is present or available."; + case DDERR_NOMIRRORHW + : return "The operation cannot be carried out because no mirroring hardware is present or available."; + case DDERR_NOOVERLAYDEST + : return "The IDirectDrawSurface2::GetOverlayPosition method is called on an overlay that the IDirectDrawSurface2::UpdateOverlay method has not been called on to establish a destination."; + case DDERR_NOOVERLAYHW + : return "The operation cannot be carried out because no overlay hardware is present or available."; + case DDERR_NOPALETTEATTACHED + : return "No palette object is attached to this surface."; + case DDERR_NOPALETTEHW + : return "There is no hardware support for 16- or 256-color palettes."; + case DDERR_NORASTEROPHW + : return "The operation cannot be carried out because no appropriate raster operation hardware is present or available."; + case DDERR_NOROTATIONHW + : return "The operation cannot be carried out because no rotation hardware is present or available."; + case DDERR_NOSTRETCHHW + : return "The operation cannot be carried out because there is no hardware support for stretching."; + case DDERR_NOT4BITCOLOR + : return "The DirectDrawSurface object is not using a 4-bit color palette and the requested operation requires a 4-bit color palette."; + case DDERR_NOT4BITCOLORINDEX + : return "The DirectDrawSurface object is not using a 4-bit color index palette and the requested operation requires a 4-bit color index palette."; + case DDERR_NOT8BITCOLOR + : return "The DirectDrawSurface object is not using an 8-bit color palette and the requested operation requires an 8-bit color palette."; + case DDERR_NOTAOVERLAYSURFACE + : return "An overlay component is called for a non-overlay surface."; + case DDERR_NOTEXTUREHW + : return "The operation cannot be carried out because no texture-mapping hardware is present or available."; + case DDERR_NOTFLIPPABLE + : return "An attempt has been made to flip a surface that cannot be flipped."; + case DDERR_NOTFOUND + : return "The requested item was not found."; + case DDERR_NOTINITIALIZED + : return "An attempt was made to call an interface method of a DirectDraw object created by CoCreateInstance before the object was initialized."; + case DDERR_NOTLOCKED + : return "An attempt is made to unlock a surface that was not locked."; + case DDERR_NOTPAGELOCKED + : return "An attempt is made to page unlock a surface with no outstanding page locks."; + case DDERR_NOTPALETTIZED + : return "The surface being used is not a palette-based surface."; + case DDERR_NOVSYNCHW + : return "The operation cannot be carried out because there is no hardware support for vertical blank synchronized operations."; + case DDERR_NOZBUFFERHW + : return "The operation to create a z-buffer in display memory or to perform a blit using a z-buffer cannot be carried out because there is no hardware support for z-buffers."; + case DDERR_NOZOVERLAYHW + : return "The overlay surfaces cannot be z-layered based on the z-order because the hardware does not support z-ordering of overlays."; + case DDERR_OUTOFCAPS + : return "The hardware needed for the requested operation has already been allocated."; + case DDERR_OUTOFMEMORY + : return "DirectDraw does not have enough memory to perform the operation."; + case DDERR_OUTOFVIDEOMEMORY + : return "DirectDraw does not have enough display memory to perform the operation."; + case DDERR_OVERLAYCANTCLIP + : return "The hardware does not support clipped overlays."; + case DDERR_OVERLAYCOLORKEYONLYONEACTIVE + : return "An attempt was made to have more than one color key active on an overlay."; + case DDERR_OVERLAYNOTVISIBLE + : return "The IDirectDrawSurface2::GetOverlayPosition method is called on a hidden overlay."; + case DDERR_PALETTEBUSY + : return "Access to this palette is refused because the palette is locked by another thread."; + case DDERR_PRIMARYSURFACEALREADYEXISTS + : return "This process has already created a primary surface."; + case DDERR_REGIONTOOSMALL + : return "The region passed to the IDirectDrawClipper::GetClipList method is too small."; + case DDERR_SURFACEALREADYATTACHED + : return "An attempt was made to attach a surface to another surface to which it is already attached."; + case DDERR_SURFACEALREADYDEPENDENT + : return "An attempt was made to make a surface a dependency of another surface to which it is already dependent."; + case DDERR_SURFACEBUSY + : return "Access to the surface is refused because the surface is locked by another thread."; + case DDERR_SURFACEISOBSCURED + : return "Access to the surface is refused because the surface is obscured."; + case DDERR_SURFACELOST + : return "Access to the surface is refused because the surface memory is gone. The DirectDrawSurface object representing this surface should have the IDirectDrawSurface2::Restore method called on it."; + case DDERR_SURFACENOTATTACHED + : return "The requested surface is not attached."; + case DDERR_TOOBIGHEIGHT + : return "The height requested by DirectDraw is too large."; + case DDERR_TOOBIGSIZE + : return "The size requested by DirectDraw is too large. However, the individual height and width are OK."; + case DDERR_TOOBIGWIDTH + : return "The width requested by DirectDraw is too large."; + case DDERR_UNSUPPORTED + : return "The operation is not supported."; + case DDERR_UNSUPPORTEDFORMAT + : return "The FourCC format requested is not supported by DirectDraw."; + case DDERR_UNSUPPORTEDMASK + : return "The bitmask in the pixel format requested is not supported by DirectDraw."; + case DDERR_UNSUPPORTEDMODE + : return "The display is currently in an unsupported mode."; + case DDERR_VERTICALBLANKINPROGRESS + : return "A vertical blank is in progress."; + case DDERR_WASSTILLDRAWING + : return "The previous blit operation that is transferring information to or from this surface is incomplete."; + case DDERR_WRONGMODE + : return "This surface cannot be restored because it was created in a different mode."; + case DDERR_XALIGN + : return "The provided rectangle was not horizontally aligned on a required boundary."; + default + : return "Unrecognized error value.\0"; + } } diff --git a/Standard Gaming Platform/DirectX Common.h b/Standard Gaming Platform/DirectX Common.h index e21a5834..af2c448c 100644 --- a/Standard Gaming Platform/DirectX Common.h +++ b/Standard Gaming Platform/DirectX Common.h @@ -9,9 +9,9 @@ extern "C" { // local functions STR8 DirectXErrorDescription ( INT32 iDXReturn ); - void DirectXAttempt ( INT32 iErrorCode, INT32 nLine, STR8 szFilename ); - void DirectXAssert ( BOOLEAN fValue, INT32 nLine, STR8 szFilename ); - void DirectXZeroMem ( void* pMemory, int nSize ); + void DirectXAttempt ( INT32 iErrorCode, INT32 nLine, STR8 szFilename ); + void DirectXAssert ( BOOLEAN fValue, INT32 nLine, STR8 szFilename ); + void DirectXZeroMem ( void* pMemory, int nSize ); #undef ATTEMPT #define ATTEMPT(x) DirectXAttempt ((x),__LINE__,__FILE__) diff --git a/Standard Gaming Platform/English.cpp b/Standard Gaming Platform/English.cpp index 8350be57..48d360fa 100644 --- a/Standard Gaming Platform/English.cpp +++ b/Standard Gaming Platform/English.cpp @@ -13,74 +13,74 @@ UINT16 gsKeyTranslationTable[1024] = { - 0, // - 1, // - 2, // - 3, // - 4, // - 5, // - 6, // - 7, // - 8, // BACK - 9, // TAB - 10, // - 11, // - 12, // - 13, // ENTER - 14, // - 15, // - 16, // SHIFT - 17, // CTRL - 18, // ALT - 19, // PAUSE - 20, // CAPS - 21, // - 22, // - 23, // - 24, // - 25, // - 26, // - 27, // ESC - 28, // - 29, // - 30, // - 31, // - 32, // SPACE - 33, // - 34, // - 35, // - 36, // - 37, // - 38, // - 39, // - 40, // - 41, // - 42, // - 43, // - 44, // - 45, // - 46, // - 47, // - 48, // 0 - 49, // 1 - 50, // 2 - 51, // 3 - 52, // 4 - 53, // 5 - 54, // 6 - 55, // 7 - 56, // 8 - 57, // 9 - 58, // - 59, // - 60, // - 61, // - 62, // - 63, // - 64, // - 97, // a - 98, // b - 99, // c + 0, // + 1, // + 2, // + 3, // + 4, // + 5, // + 6, // + 7, // + 8, // BACK + 9, // TAB + 10, // + 11, // + 12, // + 13, // ENTER + 14, // + 15, // + 16, // SHIFT + 17, // CTRL + 18, // ALT + 19, // PAUSE + 20, // CAPS + 21, // + 22, // + 23, // + 24, // + 25, // + 26, // + 27, // ESC + 28, // + 29, // + 30, // + 31, // + 32, // SPACE + 33, // + 34, // + 35, // + 36, // + 37, // + 38, // + 39, // + 40, // + 41, // + 42, // + 43, // + 44, // + 45, // + 46, // + 47, // + 48, // 0 + 49, // 1 + 50, // 2 + 51, // 3 + 52, // 4 + 53, // 5 + 54, // 6 + 55, // 7 + 56, // 8 + 57, // 9 + 58, // + 59, // + 60, // + 61, // + 62, // + 63, // + 64, // + 97, // a + 98, // b + 99, // c 100, // d 101, // e 102, // f @@ -104,27 +104,27 @@ UINT16 gsKeyTranslationTable[1024] = 120, // x 121, // y 122, // z - 91, // - 92, // - 93, // - 94, // - 95, // - 96, // - 97, // - 98, // - 99, // + 91, // + 92, // + 93, // + 94, // + 95, // + 96, // + 97, // + 98, // + 99, // 100, // 101, // 102, // 103, // 104, // 105, // - 42, // NUM_TIMES - 43, // NUM_PLUS + 42, // NUM_TIMES + 43, // NUM_PLUS 108, // - 45, // NUM_MINUS + 45, // NUM_MINUS 110, // - 47, // NUM_SLASH + 47, // NUM_SLASH 124, // F1 125, // F2 126, // F3 @@ -199,13 +199,13 @@ UINT16 gsKeyTranslationTable[1024] = 183, // 184, // 185, // - 59, // ; - 61, // = - 44, // , - 45, // - - 46, // . - 47, // slash - 96, // ` + 59, // ; + 61, // = + 44, // , + 45, // - + 46, // . + 47, // slash + 96, // ` 193, // 194, // 195, // @@ -232,28 +232,28 @@ UINT16 gsKeyTranslationTable[1024] = 216, // 217, // 218, // - 91, // [ - 92, // back slash - 93, // ] - 39, // ' - 48, // NUM_0 (ON) - 46, // NUM_PERIOD (ON) - 49, // NUM_1 (ON) - 50, // NUM_2 (ON) - 51, // NUM_3 (ON) - 52, // NUM_4 (ON) - 53, // NUM_5 (ON) - 54, // NUM_6 (ON) - 55, // NUM_7 (ON) - 56, // NUM_8 (ON) - 57, // NUM_9 (ON) + 91, // [ + 92, // back slash + 93, // ] + 39, // ' + 48, // NUM_0 (ON) + 46, // NUM_PERIOD (ON) + 49, // NUM_1 (ON) + 50, // NUM_2 (ON) + 51, // NUM_3 (ON) + 52, // NUM_4 (ON) + 53, // NUM_5 (ON) + 54, // NUM_6 (ON) + 55, // NUM_7 (ON) + 56, // NUM_8 (ON) + 57, // NUM_9 (ON) 245, // NUM_0 (OFF) 246, // NUM_PERIOD (OFF) 247, // NUM_1 (OFF) 248, // NUM_2 (OFF) 249, // NUM_3 (OFF) 250, // NUM_4 (OFF) - 0, // NUM_5 (OFF) + 0, // NUM_5 (OFF) 251, // NUM_6 (OFF) 252, // NUM_7 (OFF) 253, // NUM_8 (OFF) @@ -277,31 +277,31 @@ UINT16 gsKeyTranslationTable[1024] = 261, // 262, // 263, // - 8, // BACK + 8, // BACK 265, // TAB 266, // 267, // 268, // - 13, // ENTER + 13, // ENTER 270, // 271, // - 16, // SHIFT - 17, // CTRL - 18, // ALT - 19, // PAUSE - 20, // CAPS + 16, // SHIFT + 17, // CTRL + 18, // ALT + 19, // PAUSE + 20, // CAPS 277, // 278, // 279, // 280, // 281, // 282, // - 27, // ESC + 27, // ESC 284, // 285, // 286, // 287, // - 32, // SPACE + 32, // SPACE 289, // 290, // 291, // @@ -317,16 +317,16 @@ UINT16 gsKeyTranslationTable[1024] = 301, // 302, // 303, // - 41, // ) - 33, // ! - 64, // @ - 35, // # - 36, // $ - 37, // % - 94, // ^ - 38, // & - 42, // * - 40, // ( + 41, // ) + 33, // ! + 64, // @ + 35, // # + 36, // $ + 37, // % + 94, // ^ + 38, // & + 42, // * + 40, // ( 314, // 315, // 316, // @@ -334,32 +334,32 @@ UINT16 gsKeyTranslationTable[1024] = 318, // 319, // 320, // - 65, // A - 66, // B - 67, // C - 68, // D - 69, // E - 70, // F - 71, // G - 72, // H - 73, // I - 74, // J - 75, // K - 76, // L - 77, // M - 78, // N - 79, // O - 80, // P - 81, // Q - 82, // R - 83, // S - 84, // T - 85, // U - 86, // V - 87, // W - 88, // X - 89, // Y - 90, // Z + 65, // A + 66, // B + 67, // C + 68, // D + 69, // E + 70, // F + 71, // G + 72, // H + 73, // I + 74, // J + 75, // K + 76, // L + 77, // M + 78, // N + 79, // O + 80, // P + 81, // Q + 82, // R + 83, // S + 84, // T + 85, // U + 86, // V + 87, // W + 88, // X + 89, // Y + 90, // Z 347, // 348, // 349, // @@ -375,12 +375,12 @@ UINT16 gsKeyTranslationTable[1024] = 359, // 360, // 361, // - 42, // NUM_TIMES - 43, // NUM_PLUS + 42, // NUM_TIMES + 43, // NUM_PLUS 364, // - 45, // NUM_MINUS + 45, // NUM_MINUS 366, // - 47, // NUM_SLASH + 47, // NUM_SLASH 368, // SHIFT-F1 369, // SHIFT-F2 370, // SHIFT-F3 @@ -455,12 +455,12 @@ UINT16 gsKeyTranslationTable[1024] = 439, // 440, // 441, // - 58, // : - 43, // + - 60, // < - 95, // _ - 62, // > - 63, // ? + 58, // : + 43, // + + 60, // < + 95, // _ + 62, // > + 63, // ? 126, // ~ 449, // 450, // @@ -491,25 +491,25 @@ UINT16 gsKeyTranslationTable[1024] = 123, // { 124, // | 125, // } - 34, // " - 48, // NUM_0 (ON) - 46, // NUM_PERIOD (ON) - 49, // NUM_1 (ON) - 50, // NUM_2 (ON) - 51, // NUM_3 (ON) - 52, // NUM_4 (ON) - 53, // NUM_5 (ON) - 54, // NUM_6 (ON) - 55, // NUM_7 (ON) - 56, // NUM_8 (ON) - 57, // NUM_9 (ON) + 34, // " + 48, // NUM_0 (ON) + 46, // NUM_PERIOD (ON) + 49, // NUM_1 (ON) + 50, // NUM_2 (ON) + 51, // NUM_3 (ON) + 52, // NUM_4 (ON) + 53, // NUM_5 (ON) + 54, // NUM_6 (ON) + 55, // NUM_7 (ON) + 56, // NUM_8 (ON) + 57, // NUM_9 (ON) 501, // SHIFT-NUM_0 (OFF) 502, // SHIFT-NUM_PERIOD (OFF) 503, // SHIFT-NUM_1 (OFF) 504, // SHIFT-NUM_2 (OFF) 505, // SHIFT-NUM_3 (OFF) 506, // SHIFT-NUM_4 (OFF) - 0, // SHIFT-NUM_5 (OFF) + 0, // SHIFT-NUM_5 (OFF) 507, // SHIFT-NUM_6 (OFF) 508, // SHIFT-NUM_7 (OFF) 509, // SHIFT-NUM_8 (OFF) @@ -533,31 +533,31 @@ UINT16 gsKeyTranslationTable[1024] = 517, // 518, // 519, // - 8, // BACK + 8, // BACK 521, // TAB 522, // 523, // 524, // - 13, // ENTER + 13, // ENTER 526, // 527, // - 16, // SHIFT - 17, // CTRL - 18, // ALT - 19, // PAUSE - 20, // CAPS + 16, // SHIFT + 17, // CTRL + 18, // ALT + 19, // PAUSE + 20, // CAPS 533, // 534, // 535, // 536, // 537, // 538, // - 27, // ESC + 27, // ESC 540, // 541, // 542, // 543, // - 32, // SPACE + 32, // SPACE 545, // 546, // 547, // @@ -631,12 +631,12 @@ UINT16 gsKeyTranslationTable[1024] = 615, // 616, // 617, // - 42, // NUM_TIMES - 43, // NUM_PLUS + 42, // NUM_TIMES + 43, // NUM_PLUS 620, // - 45, // NUM_MINUS + 45, // NUM_MINUS 622, // - 47, // NUM_SLASH + 47, // NUM_SLASH 624, // ALT-F1 625, // ALT-F2 626, // ALT-F3 @@ -748,24 +748,24 @@ UINT16 gsKeyTranslationTable[1024] = 732, // 733, // 734, // - 48, // NUM_0 (ON) - 46, // NUM_PERIOD (ON) - 49, // NUM_1 (ON) - 50, // NUM_2 (ON) - 51, // NUM_3 (ON) - 52, // NUM_4 (ON) - 53, // NUM_5 (ON) - 54, // NUM_6 (ON) - 55, // NUM_7 (ON) - 56, // NUM_8 (ON) - 57, // NUM_9 (ON) + 48, // NUM_0 (ON) + 46, // NUM_PERIOD (ON) + 49, // NUM_1 (ON) + 50, // NUM_2 (ON) + 51, // NUM_3 (ON) + 52, // NUM_4 (ON) + 53, // NUM_5 (ON) + 54, // NUM_6 (ON) + 55, // NUM_7 (ON) + 56, // NUM_8 (ON) + 57, // NUM_9 (ON) 757, // ALT-NUM_0 (OFF) 758, // ALT-NUM_PERIOD (OFF) 759, // ALT-NUM_1 (OFF) 760, // ALT-NUM_2 (OFF) 761, // ALT-NUM_3 (OFF) 762, // ALT-NUM_4 (OFF) - 0, // ALT-NUM_5 (OFF) + 0, // ALT-NUM_5 (OFF) 763, // ALT-NUM_6 (OFF) 764, // ALT-NUM_7 (OFF) 765, // ALT-NUM_8 (OFF) @@ -789,31 +789,31 @@ UINT16 gsKeyTranslationTable[1024] = 773, // 774, // 775, // - 8, // BACK + 8, // BACK 777, // TAB 778, // 779, // 780, // - 13, // ENTER + 13, // ENTER 782, // 783, // - 16, // SHIFT - 17, // CTRL - 18, // ALT - 19, // PAUSE - 20, // CAPS + 16, // SHIFT + 17, // CTRL + 18, // ALT + 19, // PAUSE + 20, // CAPS 789, // 790, // 791, // 792, // 793, // 794, // - 27, // ESC + 27, // ESC 796, // 797, // 798, // 799, // - 32, // SPACE + 32, // SPACE 801, // 802, // 803, // @@ -887,12 +887,12 @@ UINT16 gsKeyTranslationTable[1024] = 871, // 872, // 873, // - 42, // NUM_TIMES - 43, // NUM_PLUS + 42, // NUM_TIMES + 43, // NUM_PLUS 876, // - 45, // NUM_MINUS + 45, // NUM_MINUS 878, // - 47, // NUM_SLASH + 47, // NUM_SLASH 880, // CTRL-F1 881, // CTRL-F2 882, // CTRL-F3 @@ -1004,24 +1004,24 @@ UINT16 gsKeyTranslationTable[1024] = 988, // 989, // 990, // - 48, // NUM_0 (ON) - 46, // NUM_PERIOD (ON) - 49, // NUM_1 (ON) - 50, // NUM_2 (ON) - 51, // NUM_3 (ON) - 52, // NUM_4 (ON) - 53, // NUM_5 (ON) - 54, // NUM_6 (ON) - 55, // NUM_7 (ON) - 56, // NUM_8 (ON) - 57, // NUM_9 (ON) + 48, // NUM_0 (ON) + 46, // NUM_PERIOD (ON) + 49, // NUM_1 (ON) + 50, // NUM_2 (ON) + 51, // NUM_3 (ON) + 52, // NUM_4 (ON) + 53, // NUM_5 (ON) + 54, // NUM_6 (ON) + 55, // NUM_7 (ON) + 56, // NUM_8 (ON) + 57, // NUM_9 (ON) 1013, // CTRL-NUM_0 (OFF) 1014, // CTRL-NUM_PERIOD (OFF) 1015, // CTRL-NUM_1 (OFF) 1016, // CTRL-NUM_2 (OFF) 1017, // CTRL-NUM_3 (OFF) 1018, // CTRL-NUM_4 (OFF) - 0, // CTRL-NUM_5 (OFF) + 0, // CTRL-NUM_5 (OFF) 1019, // CTRL-NUM_6 (OFF) 1020, // CTRL-NUM_7 (OFF) 1021, // CTRL-NUM_8 (OFF) @@ -1036,5 +1036,5 @@ UINT16 gsKeyTranslationTable[1024] = 1020, // CTRL-HOME 1021, // CTRL-UP 1022, // CTRL-PGUP -1023 // CURSOR +1023 // CURSOR }; diff --git a/Standard Gaming Platform/ExceptionHandling.cpp b/Standard Gaming Platform/ExceptionHandling.cpp index 06314143..84b916dc 100644 --- a/Standard Gaming Platform/ExceptionHandling.cpp +++ b/Standard Gaming Platform/ExceptionHandling.cpp @@ -43,7 +43,7 @@ const int StackColumns = 8; // Number of columns in stack dump. //ppp -void ErrorLog(HWFILE LogFile, STR8 Format, ...); +void ErrorLog(HWFILE LogFile, STR8 Format, ...); STR GetExceptionString( DWORD uiExceptionCode ); void DisplayRegisters( HWFILE hFile, CONTEXT *pContext ); BOOLEAN GetAndDisplayModuleAndSystemInfo( HWFILE hFile, CONTEXT *pContext ); @@ -73,7 +73,7 @@ INT32 RecordExceptionInfo( EXCEPTION_POINTERS *pExceptInfo ) // - // Open a file to output the current state of the game + // Open a file to output the current state of the game // @@ -103,7 +103,7 @@ INT32 RecordExceptionInfo( EXCEPTION_POINTERS *pExceptInfo ) #ifdef JA2 //Dispay Ja's version number - ErrorLog( hFile, "%S: %s. %S",zVersionLabel, czVersionNumber, zTrackingNumber ); + ErrorLog( hFile, "%S: %s. %S",zVersionLabel, czVersionNumber, zTrackingNumber ); //Insert a new line ErrorLog( hFile, zNewLine ); @@ -198,7 +198,7 @@ INT32 RecordExceptionInfo( EXCEPTION_POINTERS *pExceptInfo ) -void ErrorLog( HWFILE hFile, STR8 Format, ...) +void ErrorLog( HWFILE hFile, STR8 Format, ...) { char buffer[2000]; // wvsprintf never prints more than one K. UINT32 uiNumBytesWritten=0; @@ -355,7 +355,7 @@ BOOLEAN GetAndDisplayModuleAndSystemInfo( HWFILE hFile, CONTEXT *pContext ) // // This code for this function is based ( stolen ) from Bruce Dawson's article in Game Developer Magazine Jan 99 // -BOOLEAN DisplayStack( HWFILE hFile, CONTEXT *pContext ) +BOOLEAN DisplayStack( HWFILE hFile, CONTEXT *pContext ) { int Count = 0; char buffer[1000] = ""; @@ -464,7 +464,7 @@ void PrintTime(STR8 output, FILETIME TimeToPrint) void RecordModuleList(HWFILE hFile ) { ErrorLog( hFile, "\r\n" - "Module list: names, addresses, sizes, time stamps " + "Module list: names, addresses, sizes, time stamps " "and file times:\r\n"); SYSTEM_INFO SystemInfo; GetSystemInfo(&SystemInfo); @@ -520,12 +520,12 @@ static void ShowModuleInfo(HWFILE hFile, HINSTANCE ModuleHandle) // be a valid code module address. Therefore we can try to walk // our way through its structures to find the link time stamp. IMAGE_DOS_HEADER *DosHeader = (IMAGE_DOS_HEADER*)ModuleHandle; - if (IMAGE_DOS_SIGNATURE != DosHeader->e_magic) - return; + if (IMAGE_DOS_SIGNATURE != DosHeader->e_magic) + return; IMAGE_NT_HEADERS *NTHeader = (IMAGE_NT_HEADERS*)((STR8 )DosHeader + DosHeader->e_lfanew); - if (IMAGE_NT_SIGNATURE != NTHeader->Signature) - return; + if (IMAGE_NT_SIGNATURE != NTHeader->Signature) + return; // Open the code module file so that we can get its file date // and size. HANDLE ModuleFile = CreateFile(ModName, GENERIC_READ, diff --git a/Standard Gaming Platform/FileCat.h b/Standard Gaming Platform/FileCat.h index 80ca0059..38d1fc27 100644 --- a/Standard Gaming Platform/FileCat.h +++ b/Standard Gaming Platform/FileCat.h @@ -45,4 +45,4 @@ private: void TraverseDir(std::string dir, int depth = -1); }; -#endif // FILECAT_H \ No newline at end of file +#endif // FILECAT_H diff --git a/Standard Gaming Platform/FileMan.cpp b/Standard Gaming Platform/FileMan.cpp index 4c62d889..e1c6a500 100644 --- a/Standard Gaming Platform/FileMan.cpp +++ b/Standard Gaming Platform/FileMan.cpp @@ -6,16 +6,16 @@ // // Modification history : // -// 24sep96:HJH -> creation -// 08Apr97:ARM -> Assign return value from Push() calls back to HStack -// handle, because it may possibly do a MemRealloc() +// 24sep96:HJH ->creation +// 08Apr97:ARM ->Assign return value from Push() calls back to HStack +// handle, because it may possibly do a MemRealloc() // 29Dec97:Kris Morness -// -> Added functionality for setting file attributes which -// allows for read-only attribute overriding -// -> Also added a simple function that clears all file attributes -// to normal. +// ->Added functionality for setting file attributes which +// allows for read-only attribute overriding +// ->Also added a simple function that clears all file attributes +// to normal. // -// 5 Feb 98:Dave French -> extensive modification to support libraries +// 5 Feb 98:Dave French->extensive modification to support libraries // //************************************************************************** @@ -54,9 +54,9 @@ #define FILENAME_LENGTH 600 -#define CHECKF(exp) if (!(exp)) { return(FALSE); } -#define CHECKV(exp) if (!(exp)) { return; } -#define CHECKN(exp) if (!(exp)) { return(NULL); } +#define CHECKF(exp) if (!(exp)) { return(FALSE); } +#define CHECKV(exp) if (!(exp)) { return; } +#define CHECKN(exp) if (!(exp)) { return(NULL); } #define CHECKBI(exp) if (!(exp)) { return(-1); } #define PRINT_DEBUG_INFO FileDebugPrint(); @@ -119,8 +119,8 @@ HANDLE hFindInfoHandle[20] = {INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, // Snap: At program launch we build two directory catalogues: // one for the default Data directory, the other for the custom Data directory. -TFileCat gDefaultDataCat; // Init in InitializeStandardGamingPlatform (sgp.cpp) -TFileCat gCustomDataCat; // Init in InitializeStandardGamingPlatform (sgp.cpp) +TFileCat gDefaultDataCat; // Init in InitializeStandardGamingPlatform (sgp.cpp) +TFileCat gCustomDataCat; // Init in InitializeStandardGamingPlatform (sgp.cpp) //************************************************************************** // @@ -153,10 +153,10 @@ INT32 GetFilesInDirectory( HCONTAINER hStack, CHAR *, HANDLE hFile, WIN32_FIND_ // Return Value : // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // //************************************************************************** -BOOLEAN InitializeFileManager( STR strIndexFilename ) +BOOLEAN InitializeFileManager( STR strIndexFilename ) { RegisterDebugTopic( TOPIC_FILE_MANAGER, "File Manager" ); return( TRUE ); @@ -174,7 +174,7 @@ BOOLEAN InitializeFileManager( STR strIndexFilename ) // Return Value : // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // // 9 Feb 98 DEF - modified to work with the library system // @@ -195,7 +195,7 @@ void ShutdownFileManager( void ) // Return Value : // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // //************************************************************************** @@ -212,27 +212,27 @@ void FileDebug( BOOLEAN f ) // // Parameter List : // -// STR -> name of file to check existence of +// STR ->name of file to check existence of // // Return Value : // -// BOOLEAN -> TRUE if it exists -// -> FALSE if not +// BOOLEAN ->TRUE if it exists +// ->FALSE if not // // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // // 9 Feb 98 DEF - modified to work with the library system // -// Oct 2005: Snap - Rewrote, made to check data catalogues +// Oct 2005: Snap - Rewrote, made to check data catalogues // //************************************************************************** BOOLEAN FileExists( STR strFilename ) { // First check to see if it's in a library (most files should be there) if ( gFileDataBase.fInitialized && - CheckIfFileExistInLibrary( strFilename ) ) return TRUE; + CheckIfFileExistInLibrary( strFilename ) ) return TRUE; // ... then check if it's in the custom Data directory if ( gCustomDataCat.FindFile(strFilename) ) return TRUE; @@ -256,18 +256,18 @@ BOOLEAN FileExists( STR strFilename ) // // Parameter List : // -// STR -> name of file to check existence of +// STR ->name of file to check existence of // // Return Value : // -// BOOLEAN -> TRUE if it exists -// -> FALSE if not +// BOOLEAN ->TRUE if it exists +// ->FALSE if not // // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // -// Oct 2005: Snap - Rewrote, made to check data catalogues +// Oct 2005: Snap - Rewrote, made to check data catalogues // //************************************************************************** extern BOOLEAN FileExistsNoDB( STR strFilename ) @@ -294,16 +294,16 @@ extern BOOLEAN FileExistsNoDB( STR strFilename ) // // Parameter List : // -// STR -> name of file to delete +// STR ->name of file to delete // // Return Value : // -// BOOLEAN -> TRUE if successful -// -> FALSE if not +// BOOLEAN ->TRUE if successful +// ->FALSE if not // // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // //************************************************************************** BOOLEAN FileDelete( STR strFilename ) @@ -324,21 +324,21 @@ BOOLEAN FileDelete( STR strFilename ) // // Parameter List : // -// STR -> filename -// UIN32 -> access - read or write, or both -// BOOLEAN -> delete on close +// STR ->filename +// UIN32 ->access - read or write, or both +// BOOLEAN ->delete on close // // Return Value : // -// HWFILE -> handle of opened file +// HWFILE ->handle of opened file // // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // // 9 Feb 98 DEF - modified to work with the library system // -// Oct 2005: Snap - modified to work with the custom Data directory +// Oct 2005: Snap - modified to work with the custom Data directory // //************************************************************************** HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose ) @@ -379,7 +379,7 @@ HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose ) filePath = gCustomDataCat.GetRootDir() + '\\'; } filePath += strFilename; - // Bad cast! strFilename should have been const. Oh well... + // Bad cast! strFilename should have been const. Oh well... strFilename = const_cast( filePath.c_str() ); // Now strFilename points either to the original file name, // or to the full file path in the custom Data directory. @@ -427,7 +427,7 @@ HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose ) else { //If the file is in the library, get a handle to it. - hLibFile = OpenFileFromLibrary( strFilename ); + hLibFile = OpenFileFromLibrary( strFilename ); //tried to open a file that wasnt in the database if( !hLibFile ) @@ -494,12 +494,12 @@ HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose ) // // Parameter List : // -// HWFILE hFile -> handle to file to close +// HWFILE hFile ->handle to file to close // // Return Value : // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // // 9 Feb 98 DEF - modified to work with the library system // @@ -545,20 +545,20 @@ void FileClose( HWFILE hFile ) // // Parameter List : // -// HWFILE -> handle to file to read from -// void * -> source buffer -// UINT32 -> num bytes to read -// UINT32 -> num bytes read +// HWFILE ->handle to file to read from +// void * ->source buffer +// UINT32 ->num bytes to read +// UINT32 ->num bytes read // // Return Value : // -// BOOLEAN -> TRUE if successful -// -> FALSE if not +// BOOLEAN ->TRUE if successful +// ->FALSE if not // // Modification history : // -// 24sep96:HJH -> creation -// 08Dec97:ARM -> return FALSE if bytes to read != bytes read +// 24sep96:HJH ->creation +// 08Dec97:ARM ->return FALSE if bytes to read != bytes read // // 9 Feb 98 DEF - modified to work with the library system // @@ -650,20 +650,20 @@ BOOLEAN FileRead( HWFILE hFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiByte // // Parameter List : // -// HWFILE -> handle to file to write to -// void * -> destination buffer -// UINT32 -> num bytes to write -// UINT32 -> num bytes written +// HWFILE ->handle to file to write to +// void * ->destination buffer +// UINT32 ->num bytes to write +// UINT32 ->num bytes written // // Return Value : // -// BOOLEAN -> TRUE if successful -// -> FALSE if not +// BOOLEAN ->TRUE if successful +// ->FALSE if not // // Modification history : // -// 24sep96:HJH -> creation -// 08Dec97:ARM -> return FALSE if dwNumBytesToWrite != dwNumBytesWritten +// 24sep96:HJH ->creation +// 08Dec97:ARM ->return FALSE if dwNumBytesToWrite != dwNumBytesWritten // // 9 Feb 98 DEF - modified to work with the library system // @@ -718,13 +718,13 @@ BOOLEAN FileWrite( HWFILE hFile, PTR pDest, UINT32 uiBytesToWrite, UINT32 *puiBy // // Return Value : // -// BOOLEAN -> TRUE if successful -// -> FALSE if not +// BOOLEAN ->TRUE if successful +// ->FALSE if not // // Modification history : // -// 24sep96:HJH -> creation -// 08Dec97:ARM -> return FALSE if bytes to read != bytes read (CHECKF is inappropriate?) +// 24sep96:HJH ->creation +// 08Dec97:ARM ->return FALSE if bytes to read != bytes read (CHECKF is inappropriate?) // //************************************************************************** @@ -762,28 +762,27 @@ BOOLEAN FileLoad( STR strFilename, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiB // // Parameter List : // -// HWFILE -> handle to file to seek in -// ... -> arguments, 1st of which should be a string +// HWFILE ->handle to file to seek in +// ... ->arguments, 1st of which should be a string // // Return Value : // -// BOOLEAN -> TRUE if successful -// -> FALSE if not +// BOOLEAN ->TRUE if successful +// ->FALSE if not // // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // // 9 Feb 98 DEF - modified to work with the library system // //************************************************************************** - #ifndef DIM -# define DIM(x) (sizeof(x)/sizeof(x[0])) /* made StringLen Save, Sergeant_Kolja, 2007-06-10 */ +# define DIM(x) (sizeof(x)/sizeof(x[0])) /* made StringLen Save, Sergeant_Kolja, 2007-06-10 */ #endif -BOOLEAN _cdecl FilePrintf( HWFILE hFile, STR8 strFormatted, ... ) +BOOLEAN _cdecl FilePrintf( HWFILE hFile, STR8 strFormatted, ... ) { CHAR8 strToSend[160]; /* itemdescription of item 0 will NOT fit if only 80 Chars per Line!, Sergeant_Kolja, 2007-06-10 */ va_list argptr; @@ -799,7 +798,7 @@ BOOLEAN _cdecl FilePrintf( HWFILE hFile, STR8 strFormatted, ... ) { va_start(argptr, strFormatted); _vsnprintf( strToSend, DIM(strToSend), strFormatted, argptr ); /* made StringLen Save, Sergeant_Kolja, 2007-06-10 */ - strToSend[ DIM(strToSend)-1 ] = 0; + strToSend[ DIM(strToSend)-1 ] = 0; va_end(argptr); fRetVal = FileWrite( hFile, strToSend, strlen(strToSend), NULL ); @@ -821,18 +820,18 @@ BOOLEAN _cdecl FilePrintf( HWFILE hFile, STR8 strFormatted, ... ) // // Parameter List : // -// HWFILE -> handle to file to seek in -// UINT32 -> distance to seek -// UINT8 -> how to seek +// HWFILE ->handle to file to seek in +// UINT32 ->distance to seek +// UINT8 ->how to seek // // Return Value : // -// BOOLEAN -> TRUE if successful -// -> FALSE if not +// BOOLEAN ->TRUE if successful +// ->FALSE if not // // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // // 9 Feb 98 DEF - modified to work with the library system // @@ -892,16 +891,16 @@ BOOLEAN FileSeek( HWFILE hFile, UINT32 uiDistance, UINT8 uiHow ) // // Parameter List : // -// HWFILE -> handle to file +// HWFILE ->handle to file // // Return Value : // -// INT32 -> current offset in file if successful -// -> -1 if not +// INT32 ->current offset in file if successful +// ->-1 if not // // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // // 9 Feb 98 DEF - modified to work with the library system // @@ -955,16 +954,16 @@ INT32 FileGetPos( HWFILE hFile ) // // Parameter List : // -// HWFILE -> handle to file +// HWFILE ->handle to file // // Return Value : // -// INT32 -> file size in file if successful -// -> 0 if not +// INT32 ->file size in file if successful +// ->0 if not // // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // // 9 Feb 98 DEF - modified to work with the library system // @@ -972,7 +971,7 @@ INT32 FileGetPos( HWFILE hFile ) UINT32 FileGetSize( HWFILE hFile ) { - HANDLE hRealHandle; + HANDLE hRealHandle; UINT32 uiFileSize = 0xFFFFFFFF; INT16 sLibraryID; @@ -1012,7 +1011,7 @@ UINT32 FileGetSize( HWFILE hFile ) // Return Value : // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // //************************************************************************** @@ -1030,7 +1029,7 @@ void FileDebugPrint( void ) // Return Value : // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // // 9 Feb 98 DEF - modified to work with the library system // @@ -1071,7 +1070,7 @@ HANDLE GetHandleToRealFile( HWFILE hFile, BOOLEAN *pfDatabaseFile ) // Return Value : // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // //************************************************************************** /* @@ -1134,7 +1133,7 @@ HWFILE CreateFileHandle( HANDLE hRealFile, BOOLEAN fDatabaseFile ) // Return Value : // Modification history : // -// 24sep96:HJH -> creation +// 24sep96:HJH ->creation // //************************************************************************** /* @@ -1160,7 +1159,7 @@ void DestroyFileHandle( HWFILE hFile ) // Return Value : // Modification history : // -// ??nov96:HJH -> creation +// ??nov96:HJH ->creation // //************************************************************************** @@ -1261,7 +1260,7 @@ void BuildFileDirectory( void ) // Return Value : // Modification history : // -// ??nov96:HJH -> creation +// ??nov96:HJH ->creation // //************************************************************************** @@ -1310,7 +1309,7 @@ INT32 GetFilesInDirectory( HCONTAINER hStack, CHAR *pcDir, HANDLE hFile, WIN32_F BOOLEAN SetFileManCurrentDirectory( STR pcDirectory ) { - return( SetCurrentDirectory( pcDirectory ) ); + return( SetCurrentDirectory( pcDirectory ) ); } @@ -1338,7 +1337,7 @@ BOOLEAN DirectoryExists( STRING512 pcDirectory ) if (uiLastError != ERROR_FILE_NOT_FOUND) { - FastDebugMsg(String("DirectoryExists: ERROR - GetFileAttributes failed, error #%d on file %s", uiLastError, pcDirectory)); + FastDebugMsg(String("DirectoryExists: ERROR - GetFileAttributes failed, error #%d on file %s", uiLastError, pcDirectory)); } } else @@ -1385,7 +1384,7 @@ BOOLEAN RemoveFileManDirectory( STRING512 pcDirectory, BOOLEAN fRecursive ) //If there are files in the directory, DELETE THEM SearchHandle = FindFirstFile( pFileSpec, &sFindData); - if( SearchHandle != INVALID_HANDLE_VALUE ) + if( SearchHandle != INVALID_HANDLE_VALUE ) { fDone = FALSE; @@ -1403,7 +1402,7 @@ BOOLEAN RemoveFileManDirectory( STRING512 pcDirectory, BOOLEAN fRecursive ) { if (!RemoveFileManDirectory(zSubdirectory, TRUE)) { - FastDebugMsg(String("RemoveFileManDirectory: ERROR - Recursive call on %s failed", zSubdirectory)); + FastDebugMsg(String("RemoveFileManDirectory: ERROR - Recursive call on %s failed", zSubdirectory)); break; } } @@ -1447,7 +1446,7 @@ BOOLEAN RemoveFileManDirectory( STRING512 pcDirectory, BOOLEAN fRecursive ) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Removes ALL FILES in the specified directory but leaves the directory alone. Does not affect any subdirectories! +// Removes ALL FILES in the specified directory but leaves the directory alone. Does not affect any subdirectories! // Use RemoveFilemanDirectory() to also delete the directory itself, or to recursively delete subdirectories. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// BOOLEAN EraseDirectory( STRING512 pcDirectory) @@ -1468,7 +1467,7 @@ BOOLEAN EraseDirectory( STRING512 pcDirectory) //If there are files in the directory, DELETE THEM SearchHandle = FindFirstFile( pFileSpec, &sFindData); - if( SearchHandle != INVALID_HANDLE_VALUE ) + if( SearchHandle != INVALID_HANDLE_VALUE ) { fDone = FALSE; @@ -1523,8 +1522,8 @@ BOOLEAN GetExecutableDirectory( STRING512 pcDirectory ) { if ( pcDirectory[ cnt ] == '\\' ) { - pcDirectory[ cnt ] = '\0'; - break; + pcDirectory[ cnt ] = '\0'; + break; } } @@ -1663,20 +1662,20 @@ BOOLEAN FileCopy(STR strSrcFile, STR strDstFile, BOOLEAN fFailIfExists) // open source file - hFile = FileOpen(strSrcFile, FILE_ACCESS_READ, FALSE); - if (hFile == 0) - { - FastDebugMsg(String("FileCopy: FileOpen failed on Src file %s", strSrcFile)); - return(FALSE); - } + hFile = FileOpen(strSrcFile, FILE_ACCESS_READ, FALSE); + if (hFile == 0) + { + FastDebugMsg(String("FileCopy: FileOpen failed on Src file %s", strSrcFile)); + return(FALSE); + } // get its size uiSize = FileGetSize(hFile); if (uiSize == 0) { - FastDebugMsg(String("FileCopy: size is 0, Src file %s", strSrcFile)); - FileClose(hFile); - return(FALSE); + FastDebugMsg(String("FileCopy: size is 0, Src file %s", strSrcFile)); + FileClose(hFile); + return(FALSE); } // allocate a buffer big enough to hold the entire file @@ -1684,44 +1683,44 @@ BOOLEAN FileCopy(STR strSrcFile, STR strDstFile, BOOLEAN fFailIfExists) if (pBuffer == NULL) { FastDebugMsg(String("FileCopy: ERROR - MemAlloc pBuffer failed, size %d", uiSize)); - FileClose(hFile); + FileClose(hFile); return(FALSE); } // read the file into memory - if (!FileRead(hFile, pBuffer, uiSize, &uiBytesRead)) - { - FastDebugMsg(String("FileCopy: FileRead failed, file %s", strSrcFile)); - FileClose(hFile); - return(FALSE); - } + if (!FileRead(hFile, pBuffer, uiSize, &uiBytesRead)) + { + FastDebugMsg(String("FileCopy: FileRead failed, file %s", strSrcFile)); + FileClose(hFile); + return(FALSE); + } // close source file - FileClose(hFile); + FileClose(hFile); // open destination file - hFile = FileOpen(strDstFile, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE); - if (hFile == 0) - { - FastDebugMsg(String("FileCopy: FileOpen failed on Dst file %s", strDstFile)); - return(FALSE); - } + hFile = FileOpen(strDstFile, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE); + if (hFile == 0) + { + FastDebugMsg(String("FileCopy: FileOpen failed on Dst file %s", strDstFile)); + return(FALSE); + } // write buffer to the destination file - if (!FileWrite(hFile, pBuffer, uiSize, &uiBytesWritten)) - { - FastDebugMsg(String("FileCopy: FileWrite failed, file %s", strDstFile)); - FileClose(hFile); - return(FALSE); - } + if (!FileWrite(hFile, pBuffer, uiSize, &uiBytesWritten)) + { + FastDebugMsg(String("FileCopy: FileWrite failed, file %s", strDstFile)); + FileClose(hFile); + return(FALSE); + } // close destination file - FileClose(hFile); + FileClose(hFile); - MemFree(pBuffer); - pBuffer = NULL; + MemFree(pBuffer); + pBuffer = NULL; return(TRUE); */ } @@ -1814,7 +1813,6 @@ BOOLEAN FileCheckEndOfFile( HWFILE hFile ) UINT32 uiFileNum; HANDLE hRealFile; // UINT8 Data; - UINT32 uiNumberOfBytesRead=0; UINT32 uiOldFilePtrLoc=0; UINT32 uiEndOfFilePtrLoc=0; UINT32 temp=0; @@ -1998,7 +1996,7 @@ HANDLE GetRealFileHandleFromFileManFileHandle( HWFILE hFile ) // Return Value : // Modification history : // -// 10June98:DB -> creation +// 10June98:DB ->creation // //************************************************************************** BOOLEAN AddSubdirectoryToPath(CHAR8 *pDirectory) @@ -2060,8 +2058,8 @@ UINT32 uiPathLen; UINT32 GetFreeSpaceOnHardDriveWhereGameIsRunningFrom( ) { - STRING512 zExecDir; - STRING512 zDrive; + STRING512 zExecDir; + STRING512 zDrive; STRING512 zDir; STRING512 zFileName; STRING512 zExt; diff --git a/Standard Gaming Platform/FileMan.h b/Standard Gaming Platform/FileMan.h index f100e2a3..a8f5a0c7 100644 --- a/Standard Gaming Platform/FileMan.h +++ b/Standard Gaming Platform/FileMan.h @@ -31,10 +31,10 @@ // //************************************************************************** -#define MAX_FILENAME_LEN 48 +#define MAX_FILENAME_LEN 48 -#define FILE_ACCESS_READ 0x01 -#define FILE_ACCESS_WRITE 0x02 +#define FILE_ACCESS_READ 0x01 +#define FILE_ACCESS_WRITE 0x02 #define FILE_ACCESS_READWRITE 0x03 #define FILE_CREATE_NEW 0x0010 // create new file. fail if exists @@ -84,8 +84,8 @@ typedef FILETIME SGP_FILETIME; // Snap: At program launch we build two directory catalogues: // one for the default Data directory, the other for the custom Data directory. -extern TFileCat gDefaultDataCat; // Init in InitializeStandardGamingPlatform (sgp.cpp) -extern TFileCat gCustomDataCat; // Init in InitializeStandardGamingPlatform (sgp.cpp) +extern TFileCat gDefaultDataCat; // Init in InitializeStandardGamingPlatform (sgp.cpp) +extern TFileCat gCustomDataCat; // Init in InitializeStandardGamingPlatform (sgp.cpp) //************************************************************************** // @@ -98,7 +98,7 @@ extern "C" { #endif */ -extern BOOLEAN InitializeFileManager( STR strIndexFilename ); +extern BOOLEAN InitializeFileManager( STR strIndexFilename ); extern void ShutdownFileManager( void ); extern void FileDebug( BOOLEAN f ); @@ -115,7 +115,7 @@ extern BOOLEAN FileRead( HWFILE hFile, PTR pDest, UINT32 uiBytesToRead, UINT32 * extern BOOLEAN FileWrite( HWFILE hFile, PTR pDest, UINT32 uiBytesToWrite, UINT32 *puiBytesWritten ); extern BOOLEAN FileLoad( STR filename, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead ); -extern BOOLEAN _cdecl FilePrintf( HWFILE hFile, STR8 strFormatted, ... ); +extern BOOLEAN _cdecl FilePrintf( HWFILE hFile, STR8 strFormatted, ... ); extern BOOLEAN FileSeek( HWFILE, UINT32 uiDistance, UINT8 uiHow ); extern INT32 FileGetPos( HWFILE ); @@ -187,7 +187,7 @@ BOOLEAN AddSubdirectoryToPath(CHAR8 *pDirectory); //Gets the amount of free space on the hard drive that the main executeablt is runnning from UINT32 GetFreeSpaceOnHardDriveWhereGameIsRunningFrom( ); -//Gets the free hard drive space from the drive letter passed in. It has to be the root dir. ( eg. c:\ ) +//Gets the free hard drive space from the drive letter passed in. It has to be the root dir. ( eg. c:\ ) UINT32 GetFreeSpaceOnHardDrive( STR pzDriveLetter ); /* diff --git a/Standard Gaming Platform/Flic.cpp b/Standard Gaming Platform/Flic.cpp index 5a0c5e7c..7d278a25 100644 --- a/Standard Gaming Platform/Flic.cpp +++ b/Standard Gaming Platform/Flic.cpp @@ -20,8 +20,8 @@ // ???:David Smoth - ??? // ???:Bret Rowdon for RIO/GORGE - added 640x480 SVGA support // 05-11jun96:HJH - added routines for bitmap use, and -// other utilities -// 08-May-97 ARM Adapted for Win95 Standard Gaming Platform +// other utilities +// 08-May-97 ARM Adapted for Win95 Standard Gaming Platform // //************************************************************************** @@ -31,7 +31,6 @@ // //************************************************************************** -//#include "stdafx.h" #include #include "flic.h" #include "windows.h" @@ -226,7 +225,7 @@ static void screen_repeat_two(FlicScreen *s, int x, int y, Pixels2 pixels2, int count <<= 1; // Convert from word to pixel count. if (!line_clip(s, &x, &y, &count)) return; - is_odd = (count&1); // Did it turn odd after clipping? Ack! + is_odd = (count&1); // Did it turn odd after clipping? Ack! count >>= 1; // Convert back to word count. // Calculate start screen address. @@ -246,7 +245,7 @@ static void screen_repeat_two(FlicScreen *s, int x, int y, Pixels2 pixels2, int // // screen_put_colors // -// Set count colors in color map starting at start. RGB values +// Set count colors in color map starting at start. RGB values // go from 0 to 255. // // Parameter List : @@ -279,7 +278,7 @@ static void screen_put_colors(FlicScreen *s, int start, Colour *colors, int coun // // screen_put_colors_64 // -// Set count colors in color map starting at start. RGB values +// Set count colors in color map starting at start. RGB values // go from 0 to 64. */ // // Parameter List : @@ -325,13 +324,13 @@ static void screen_put_colors_64(FlicScreen *s, int start, Colour *colors, int c // //************************************************************************** -static void decode_byte_run(Uchar *data, Flic *flic) +static void decode_byte_run(Uchar *data, Flic *flic) { int x,y; int width = flic->head.width; int height = flic->head.height; int psize; // was char -> HJH - Char *cpt = (Char *)data; + Char *cpt = (Char *)data; int end; y = flic->yoff; @@ -375,12 +374,12 @@ static void decode_byte_run(Uchar *data, Flic *flic) // //************************************************************************** -static void decode_delta_fli(Uchar *data, Flic *flic) +static void decode_delta_fli(Uchar *data, Flic *flic) { int xorg = flic->xoff; int yorg = flic->yoff; - Short *wpt = (Short *)data; - Uchar *cpt = (Uchar *)(wpt + 2); + Short *wpt = (Short *)data; + Uchar *cpt = (Uchar *)(wpt + 2); int x,y; Short lines; Uchar opcount; @@ -419,7 +418,7 @@ static void decode_delta_fli(Uchar *data, Flic *flic) // // decode_delta_flc // -// Flc-style delta decompression. The data is word oriented though +// Flc-style delta decompression. The data is word oriented though // a lot of the control info (how to skip, how many words to // copy) are byte oriented still to save space. // @@ -433,7 +432,7 @@ static void decode_delta_fli(Uchar *data, Flic *flic) // //************************************************************************** -static void decode_delta_flc(Uchar *data, Flic *flic) +static void decode_delta_flc(Uchar *data, Flic *flic) { int xorg = flic->xoff; int yorg = flic->yoff; @@ -442,7 +441,7 @@ static void decode_delta_flc(Uchar *data, Flic *flic) Short lp_count; Short opcount; int psize; - union {Short *w; Uchar *ub; Char *b; Pixels2 *p2;} wpt; + union {Short *w; Uchar *ub; Char *b; Pixels2 *p2;} wpt; int lastx; @@ -504,7 +503,7 @@ OUTT: // // decode_black // -// Decode a BLACK chunk. Set frame to solid color 0 one +// Decode a BLACK chunk. Set frame to solid color 0 one // line at a time. // // Parameter List : @@ -517,7 +516,7 @@ OUTT: // //************************************************************************** -static void decode_black(Uchar *data, Flic *flic) +static void decode_black(Uchar *data, Flic *flic) { Pixels2 black; int i; @@ -539,7 +538,7 @@ static void decode_black(Uchar *data, Flic *flic) // // decode_literal // -// Decode a LITERAL chunk. Just copy data to screen one line at +// Decode a LITERAL chunk. Just copy data to screen one line at // a time. // // Parameter List : @@ -552,7 +551,7 @@ static void decode_black(Uchar *data, Flic *flic) // //************************************************************************** -static void decode_literal(Uchar *data, Flic *flic) +static void decode_literal(Uchar *data, Flic *flic) { int i; int height = flic->head.height; @@ -570,16 +569,16 @@ static void decode_literal(Uchar *data, Flic *flic) typedef void ColorOut(FlicScreen *s, int start, Colour *colors, int count); /* This is the type of output parameter to our decode_color below. - * Not coincedently screen_put_color is of this type. */ + * Not coincedently screen_put_color is of this type. */ //************************************************************************** // // decode_color // -// Decode color map. Put results into output. The two color +// Decode color map. Put results into output. The two color // compressions are identical except for whether the RGB values -// are 0-63 or 0-255. Passing in an output that does the appropriate +// are 0-63 or 0-255. Passing in an output that does the appropriate // shifting on the way to the real pallete lets us use the same // code for both COLOR_64 and COLOR_256 compression. // @@ -594,7 +593,7 @@ typedef void ColorOut(FlicScreen *s, int start, Colour *colors, int count); // //************************************************************************** -static void decode_color(Uchar *data, Flic *flic, ColorOut *output) +static void decode_color(Uchar *data, Flic *flic, ColorOut *output) { int start = 0; Uchar *cbuf = (Uchar *)data; @@ -631,7 +630,7 @@ static void decode_color(Uchar *data, Flic *flic, ColorOut *output) // //************************************************************************** -static void decode_color_256(Uchar *data, Flic *flic) +static void decode_color_256(Uchar *data, Flic *flic) { decode_color(data, flic, screen_put_colors); } @@ -652,7 +651,7 @@ static void decode_color_256(Uchar *data, Flic *flic) // //************************************************************************** -static void decode_color_64(Uchar *data, Flic *flic) +static void decode_color_64(Uchar *data, Flic *flic) { decode_color(data, flic, screen_put_colors_64); } @@ -676,40 +675,40 @@ static void decode_color_64(Uchar *data, Flic *flic) // //************************************************************************** -static ErrCode decode_frame(Flic *flic, FrameHead *frame, Uchar *data) +static ErrCode decode_frame(Flic *flic, FrameHead *frame, Uchar *data) { int i; ChunkHead *chunk; for (i=0; ichunks; ++i) { - chunk = (ChunkHead *)data; + chunk = (ChunkHead *)data; data += chunk->size; switch (chunk->type) { case COLOR_256: if (flic->screen.change_palette) - //decode_color_256((Uchar *)(chunk+1), flic); - decode_color_256( (((Uchar *)chunk) + 4 ), flic); + //decode_color_256((Uchar *)(chunk+1), flic); + decode_color_256( (((Uchar *)chunk) + 4 ), flic); break; case DELTA_FLC: - decode_delta_flc((Uchar *)(chunk+1), flic); + decode_delta_flc((Uchar *)(chunk+1), flic); break; case COLOR_64: if (flic->screen.change_palette) - decode_color_64((Uchar *)(chunk+1), flic); + decode_color_64((Uchar *)(chunk+1), flic); break; case DELTA_FLI: - decode_delta_fli((Uchar *)(chunk+1), flic); + decode_delta_fli((Uchar *)(chunk+1), flic); break; case BLACK_FRAME: - decode_black((Uchar *)(chunk+1), flic); + decode_black((Uchar *)(chunk+1), flic); break; case BYTE_RUN: - decode_byte_run((Uchar *)(chunk+1), flic); + decode_byte_run((Uchar *)(chunk+1), flic); break; case LITERAL: - decode_literal((Uchar *)(chunk+1), flic); + decode_literal((Uchar *)(chunk+1), flic); break; default: break; @@ -719,7 +718,7 @@ static ErrCode decode_frame(Flic *flic, FrameHead *frame, Uchar *data) } static ErrCode file_read_big_block(FILE *file, char *block, Ulong size) - /* Read in a big block. Could be bigger than 64K. */ + /* Read in a big block. Could be bigger than 64K. */ { char *pt = block; unsigned size1; @@ -758,10 +757,10 @@ static ErrCode fill_in_frame2(Flic *flic) (*flic->seek)(flic, flic->head.oframe1); if ( fread(&head, sizeof(head), 1, flic->file) != 1 ) - return ErrFlicRead; + return ErrFlicRead; if ( fread(&head, sizeof(head), 1, flic->file) != 1 ) - return ErrFlicRead; + return ErrFlicRead; flic->head.oframe2 = flic->head.oframe1 + head.size; @@ -790,7 +789,7 @@ static ErrCode flic_next_frame(Flic *flic, BOOL fDecode) long size; if ( fread(&head, sizeof(head), 1, flic->file) != 1 ) - err = ErrFlicRead; + err = ErrFlicRead; else { if (head.type == FRAME_TYPE) @@ -802,7 +801,7 @@ static ErrCode flic_next_frame(Flic *flic, BOOL fDecode) { //TRACE("FLC chunk too big: %d\n",size); //Assert(0); - FastDebugMsg(String("flic_next_frame: FLC chunk too big: %d", size)); + FastDebugMsg(String("flic_next_frame: FLC chunk too big: %d", size)); size = 64000; } if (!(err = file_read_big_block(flic->file, pcxbuf, size))) @@ -835,7 +834,7 @@ static ErrCode flic_next_frame(Flic *flic, BOOL fDecode) static Boolean flic_check_frame(Flic *flic) { - return TRUE; + return TRUE; } //************************************************************************** @@ -846,12 +845,12 @@ static Boolean flic_check_frame(Flic *flic) static ErrCode flic_open(Flic *flic, const char *filename) { - return (flic->file = fopen(filename, "rb")) ? 0 : ErrFlicAccess; + return (flic->file = fopen(filename, "rb")) ? 0 : ErrFlicAccess; } static ErrCode flic_seek(Flic *flic, long offset) { - return fseek(flic->file, offset, SEEK_SET) ? ErrFlicSeek : 0; + return fseek(flic->file, offset, SEEK_SET) ? ErrFlicSeek : 0; } //************************************************************************** @@ -871,20 +870,20 @@ static ErrCode flic_seek(Flic *flic, long offset) void FlicInit(Flic *flic, unsigned screen_width, unsigned screen_height, char change_palette, char *Buff) { - flic->file = NULL; - //flic->lib.names = NULL; + flic->file = NULL; + //flic->lib.names = NULL; - flic->open = flic_open; /* Set routines for single flick file access */ - flic->seek = flic_seek; + flic->open = flic_open; /* Set routines for single flick file access */ + flic->seek = flic_seek; - flic->check_frame = flic_check_frame; /* Select a dummy routine */ + flic->check_frame = flic_check_frame; /* Select a dummy routine */ - /** Info used by low level routines */ + /** Info used by low level routines */ - flic->screen.pixels = (unsigned char *)Buff; // (char *) 0xa0000; - flic->screen.width = screen_width; - flic->screen.height = screen_height; - flic->screen.change_palette = change_palette; + flic->screen.pixels = (unsigned char *)Buff; // (char *) 0xa0000; + flic->screen.width = screen_width; + flic->screen.height = screen_height; + flic->screen.change_palette = change_palette; } //************************************************************************** @@ -912,7 +911,7 @@ ErrCode FlicOpen(Flic *flic, const char *filename) if ( !(err = (*flic->open)(flic, filename)) ) { if (fread(&flic->head, sizeof(flic->head), 1, flic->file) != 1) - err = ErrFlicRead; + err = ErrFlicRead; else { flic->name = filename; @@ -966,8 +965,8 @@ ErrCode FlicOpen(Flic *flic, const char *filename) void FlicSetOrigin(Flic *flic, unsigned x, unsigned y) { - flic->xoff = x; - flic->yoff = y; + flic->xoff = x; + flic->yoff = y; } //************************************************************************** @@ -1024,7 +1023,7 @@ static void flic_play_loop_timer() } #ifdef DEBUG -#pragma on (check_stack) +#pragma on (check_stack) #endif //************************************************************************** @@ -1083,16 +1082,16 @@ ErrCode FlicPlay(Flic *flic, Ulong max_loop) } for (flic->status.loop_count = 0; !max_loop || flic->status.loop_count < max_loop; - ++flic->status.loop_count) + ++flic->status.loop_count) { // Seek to second frame (*flic->seek)(flic, flic->head.oframe2); // Loop from 2nd frame thru ring frame for (flic->status.frame_index=0; - (flic->status.frame_index < (flic->head.frames-1)) || - ( (flic->status.frame_index < flic->head.frames) && - ( !max_loop || (flic->status.loop_count < (max_loop - 1)))); - ++flic->status.frame_index) + (flic->status.frame_index < (flic->head.frames-1)) || + ( (flic->status.frame_index < flic->head.frames) && + ( !max_loop || (flic->status.loop_count < (max_loop - 1)))); + ++flic->status.frame_index) { while (!timer_flag); @@ -1133,10 +1132,10 @@ int FlicAdvance(Flic *flic, BOOL fDecode) // Loop from 2nd frame thru ring frame // for (flic->status.frame_index=0; - // (flic->status.frame_index < (flic->head.frames-1)) || - // ( (flic->status.frame_index < flic->head.frames) && - // ( !max_loop || (flic->status.loop_count < (max_loop - 1)))); - // ++flic->status.frame_index) + // (flic->status.frame_index < (flic->head.frames-1)) || + // ( (flic->status.frame_index < flic->head.frames) && + // ( !max_loop || (flic->status.loop_count < (max_loop - 1)))); + // ++flic->status.frame_index) // { if(flic->status.frame_index < flic->head.frames) @@ -1150,7 +1149,7 @@ int FlicAdvance(Flic *flic, BOOL fDecode) return(0); // if (flic->check_frame && !(*flic->check_frame)(flic)) - // return 0; + // return 0; } static void center_flic(Flic *flic) @@ -1163,20 +1162,20 @@ static void center_flic(Flic *flic) void set_flic_origin(Flic *flic, int x, int y) { - flic->xoff = x; - flic->yoff = y; + flic->xoff = x; + flic->yoff = y; } int frame_check(Flic *flic) { -/* - char key; +/* + char key; if (Esc()) - { + { //AbortScript = TRUE; return 0; - } + } if (flic->status.frame_index == FlcSoundFrames[FlcSoundIndex][0]) { @@ -1206,7 +1205,7 @@ int frame_check(Flic *flic) } RefreshSound(); */ - return 1; + return 1; } //************************************************************************** @@ -1295,7 +1294,7 @@ ErrCode FlicGetStats(char *filename, int width, int height, Flic *flic, int *piB if ( !(err = (*flic->open)(flic, filename)) ) { if (fread(&flic->head, sizeof(flic->head), 1, flic->file) != 1) - err = ErrFlicRead; + err = ErrFlicRead; } if ( !err && piBufferSize ) @@ -1352,7 +1351,7 @@ ErrCode FlicGetColourPalette(CHAR *filename, int width, int height, CHAR **ppBuf return(-1); FlicSetOrigin(&flic, 0, 0); - + *ppBuffer = (CHAR *)MemAlloc( iColourPaletteSize ); chunk = (ChunkHead *)FlicSeekChunk( &flic, 0, COLOR_256, NULL ); pcPosition = (CHAR *)(((BYTE *)chunk)+6); @@ -1374,11 +1373,11 @@ ErrCode FlicGetColourPalette(CHAR *filename, int width, int height, CHAR **ppBuf count = 256; { colors = (Colour *)cbuf; - end = start + count; + end = start + count; for (ix = start; ix < end; ++ix) { - (*ppBuffer)[ix*3] =colors->r; + (*ppBuffer)[ix*3] =colors->r; (*ppBuffer)[ix*3+1]=colors->g; (*ppBuffer)[ix*3+2]=colors->b; ++colors; @@ -1424,9 +1423,8 @@ CHAR *FlicSeekChunk(Flic *flic, INT iFrame, ChunkTypes eType, INT *piChunkSize) { FrameHead head; LONG lSize; - BOOL fFound = FALSE; ErrCode err=0; - INT i; + INT i; FlicSeekFirst(flic); @@ -1434,7 +1432,7 @@ CHAR *FlicSeekChunk(Flic *flic, INT iFrame, ChunkTypes eType, INT *piChunkSize) FlicAdvance(flic, FALSE); if ( fread(&head, sizeof(head), 1, flic->file) != 1 ) - err = ErrFlicRead; + err = ErrFlicRead; else { if (head.type == FRAME_TYPE) @@ -1449,20 +1447,19 @@ CHAR *FlicSeekChunk(Flic *flic, INT iFrame, ChunkTypes eType, INT *piChunkSize) } if (!(err = file_read_big_block(flic->file, pcxbuf, lSize))) { - FrameHead *frame = &head; Uchar *data = (unsigned char *)pcxbuf; int i; ChunkHead *chunk; for (i=0; isize; if ( chunk->type == eType ) { if ( piChunkSize ) *piChunkSize = chunk->size; - return( ((char *)chunk) ); + return( ((char *)chunk) ); } } } @@ -1500,7 +1497,7 @@ CHAR *FlicSeekChunk(Flic *flic, INT iFrame, ChunkTypes eType, INT *piChunkSize) INT FlicFindByteRunBeforeFrame(Flic *flic, INT iFrame) { INT iRet = BAD_INDEX; - INT i; + INT i; for ( i=iFrame-1 ; i>=0 ; i-- ) @@ -1620,7 +1617,7 @@ ErrCode FlicFillFrameData( //GetObject( hBitmap, sizeof(DIBSECTION), &dibSection ); flic->screen.pixels = (Pixel *)pcBuffer; - iNumBytesInBuffer = *piNumBytes; + iNumBytesInBuffer = *piNumBytes; if ( iPrevFrame == BAD_INDEX || iPrevFrame != (iFrame-1) ) { diff --git a/Standard Gaming Platform/Font.cpp b/Standard Gaming Platform/Font.cpp index 8b0d15ae..b4594680 100644 --- a/Standard Gaming Platform/Font.cpp +++ b/Standard Gaming Platform/Font.cpp @@ -30,18 +30,18 @@ #endif //******************************************************* // -// Defines +// Defines // //******************************************************* -#define PALETTE_SIZE 768 +#define PALETTE_SIZE 768 #define STRING_DELIMITER 0 -#define ID_BLACK 0 -#define MAX_FONTS 25 +#define ID_BLACK 0 +#define MAX_FONTS 25 //******************************************************* // -// Typedefs +// Typedefs // //******************************************************* @@ -192,8 +192,8 @@ UINT32 uiRed, uiGreen, uiBlue; } -//Kris: These are new counterparts to the above functions. They won't -// effect an 8BPP font, only 16. +//Kris: These are new counterparts to the above functions. They won't +// effect an 8BPP font, only 16. void SetRGBFontForeground( UINT32 uiRed, UINT32 uiGreen, UINT32 uiBlue ) { if((FontDefault < 0) || (FontDefault > MAX_FONTS)) @@ -330,8 +330,8 @@ int count; // LoadFontFile // // Loads a font from an ETRLE file, and inserts it into one of the font slots. -// This function returns (-1) if it fails, and debug msgs for a reason. -// Otherwise the font number is returned. +// This function returns (-1) if it fails, and debug msgs for a reason. +// Otherwise the font number is returned. //***************************************************************************** INT32 LoadFontFile(const STR8 filename) { @@ -343,7 +343,7 @@ UINT32 LoadIndex; if((LoadIndex=FindFreeFont())==(-1)) { - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, String("Out of font slots (%s)", filename)); + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, String("Out of font slots (%s)", filename)); #ifdef JA2 FatalError( "Cannot init FONT file %s", filename ); #endif @@ -355,7 +355,7 @@ UINT32 LoadIndex; if((FontObjs[LoadIndex]=CreateVideoObject(&vo_desc))==NULL) { - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, String("Error creating VOBJECT (%s)", filename)); + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, String("Error creating VOBJECT (%s)", filename)); #ifdef JA2 FatalError( "Cannot init FONT file %s", filename ); #endif @@ -393,14 +393,14 @@ void UnloadFont(UINT32 FontIndex) //***************************************************************************** UINT32 GetWidth(HVOBJECT hSrcVObject, INT16 ssIndex) { - ETRLEObject *pTrav; + ETRLEObject *pTrav; // Assertions Assert( hSrcVObject != NULL ); if ( ssIndex < 0 || ssIndex > 92 ) { - int i=0; + //int breakpoint=0; } // Get Offsets from Index into structure @@ -414,7 +414,7 @@ UINT32 GetWidth(HVOBJECT hSrcVObject, INT16 ssIndex) // Returns the length of a string with a variable number of arguments, in // pixels, using the current font. Maximum length in characters the string can // evaluate to is 512. -// 'uiCharCount' specifies how many characters of the string are counted. +// 'uiCharCount' specifies how many characters of the string are counted. //***************************************************************************** INT16 StringPixLengthArg(INT32 usUseFont, UINT32 uiCharCount, STR16 pFontString, ...) { @@ -423,23 +423,23 @@ CHAR16 string[512]; Assert(pFontString!=NULL); - va_start(argptr, pFontString); // Set up variable argument pointer + va_start(argptr, pFontString); // Set up variable argument pointer vswprintf(string, pFontString, argptr); // process gprintf string (get output str) va_end(argptr); - // make sure the character count is legal - if (uiCharCount > wcslen(string)) - { - uiCharCount = wcslen(string); - } - else - { - if (uiCharCount < wcslen(string)) - { - // less than the full string, so whack off the end of it (it's temporary anyway) - string[uiCharCount] = '\0'; - } - } + // make sure the character count is legal + if (uiCharCount > wcslen(string)) + { + uiCharCount = wcslen(string); + } + else + { + if (uiCharCount < wcslen(string)) + { + // less than the full string, so whack off the end of it (it's temporary anyway) + string[uiCharCount] = '\0'; + } + } return(StringPixLength(string, usUseFont)); } @@ -449,7 +449,7 @@ CHAR16 string[512]; // // Returns the length of a string with a variable number of arguments, in // pixels, using the current font. Maximum length in characters the string can -// evaluate to is 512. Because this is for fast help text, all '|' characters are ignored for the +// evaluate to is 512. Because this is for fast help text, all '|' characters are ignored for the // width calculation. // 'uiCharCount' specifies how many characters of the string are counted. // YOU HAVE TO PREBUILD THE FAST HELP STRING! @@ -465,19 +465,19 @@ INT16 StringPixLengthArgFastHelp(INT32 usUseFont, INT32 usBoldFont, UINT32 uiCha wcscpy( string, pFontString ); - // make sure the character count is legal - if (uiCharCount > wcslen(string)) - { - uiCharCount = wcslen(string); - } - else - { - if (uiCharCount < wcslen(string)) - { - // less than the full string, so whack off the end of it (it's temporary anyway) - string[uiCharCount] = '\0'; - } - } + // make sure the character count is legal + if (uiCharCount > wcslen(string)) + { + uiCharCount = wcslen(string); + } + else + { + if (uiCharCount < wcslen(string)) + { + // less than the full string, so whack off the end of it (it's temporary anyway) + string[uiCharCount] = '\0'; + } + } //now eliminate all '|' characters from the string. i = 0; while( i < uiCharCount ) @@ -504,15 +504,15 @@ INT16 StringPixLengthArgFastHelp(INT32 usUseFont, INT32 usBoldFont, UINT32 uiCha //***************************************************************************************** // -// StringNPixLength +// StringNPixLength // -// Return the length of the of the string or count characters in the -// string, which ever comes first. +// Return the length of the of the string or count characters in the +// string, which ever comes first. // -// Returns INT16 +// Returns INT16 // -// Created by: Gilles Beauparlant -// Created on: 12/1/99 +// Created by: Gilles Beauparlant +// Created on: 12/1/99 // //***************************************************************************************** INT16 StringNPixLength(STR16 string, UINT32 uiMaxCount, INT32 UseFont) @@ -617,7 +617,7 @@ void RestoreFontSettings(void) //***************************************************************************** UINT32 GetHeight(HVOBJECT hSrcVObject, INT16 ssIndex) { - ETRLEObject *pTrav; + ETRLEObject *pTrav; // Assertions Assert( hSrcVObject != NULL ); @@ -663,8 +663,8 @@ INT16 GetIndex(CHAR16 siChar) { if (siChar == *pTrav) { - return ssCount; - } + return ssCount; + } ssCount++; pTrav++; } @@ -736,7 +736,7 @@ UINT8 *pDestBuf; Assert(pFontString!=NULL); - va_start(argptr, pFontString); // Set up variable argument pointer + va_start(argptr, pFontString); // Set up variable argument pointer vswprintf(string, pFontString, argptr); // process gprintf string (get output str) va_end(argptr); @@ -781,7 +781,7 @@ void VarFindFontRightCoordinates( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 s CHAR16 string[512]; va_list argptr; - va_start(argptr, pFontString); // Set up variable argument pointer + va_start(argptr, pFontString); // Set up variable argument pointer vswprintf(string, pFontString, argptr); // process gprintf string (get output str) va_end(argptr); @@ -793,7 +793,7 @@ void VarFindFontCenterCoordinates( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 CHAR16 string[512]; va_list argptr; - va_start(argptr, pFontString); // Set up variable argument pointer + va_start(argptr, pFontString); // Set up variable argument pointer vswprintf(string, pFontString, argptr); // process gprintf string (get output str) va_end(argptr); @@ -843,7 +843,7 @@ UINT8 *pDestBuf; Assert(pFontString!=NULL); - va_start(argptr, pFontString); // Set up variable argument pointer + va_start(argptr, pFontString); // Set up variable argument pointer vswprintf(string, pFontString, argptr); // process gprintf string (get output str) va_end(argptr); @@ -894,7 +894,7 @@ UINT8 *pDestBuf; Assert(pFontString!=NULL); - va_start(argptr, pFontString); // Set up variable argument pointer + va_start(argptr, pFontString); // Set up variable argument pointer vswprintf(string, pFontString, argptr); // process gprintf string (get output str) va_end(argptr); @@ -932,11 +932,11 @@ UINT8 *pDestBuf; UnLockVideoSurface( FontDestBuffer ); #if defined ( JA2 ) || defined( UTIL ) - InvalidateRegion(x, y, + InvalidateRegion(x, y, x + StringPixLength(string, FontDefault), y + GetFontHeight(FontDefault)); #else - InvalidateRegion(x, y, + InvalidateRegion(x, y, x + StringPixLength(string, FontDefault), y + GetFontHeight(FontDefault), INVAL_SRC_TRANS); @@ -961,7 +961,7 @@ CHAR16 string[512]; Assert(pFontString!=NULL); - va_start(argptr, pFontString); // Set up variable argument pointer + va_start(argptr, pFontString); // Set up variable argument pointer vswprintf(string, pFontString, argptr); // process gprintf string (get output str) va_end(argptr); @@ -1005,7 +1005,7 @@ CHAR16 string[512]; Assert(pFontString!=NULL); - va_start(argptr, pFontString); // Set up variable argument pointer + va_start(argptr, pFontString); // Set up variable argument pointer vswprintf(string, pFontString, argptr); // process gprintf string (get output str) va_end(argptr); @@ -1049,7 +1049,7 @@ UINT16 usOldForeColor; Assert(pFontString!=NULL); - va_start(argptr, pFontString); // Set up variable argument pointer + va_start(argptr, pFontString); // Set up variable argument pointer vswprintf(string, pFontString, argptr); // process gprintf string (get output str) va_end(argptr); @@ -1111,7 +1111,7 @@ UINT8 *pDestBuf; Assert(pFontString!=NULL); - va_start(argptr, pFontString); // Set up variable argument pointer + va_start(argptr, pFontString); // Set up variable argument pointer vswprintf(string, pFontString, argptr); // process gprintf string (get output str) va_end(argptr); @@ -1200,24 +1200,24 @@ UINT8 uiPixelDepth; // register the appropriate debug topics if(pTransTable == NULL) { - return FALSE; - } + return FALSE; + } RegisterDebugTopic(TOPIC_FONT_HANDLER, "Font Manager"); if ((pFManager = (FontManager *)MemAlloc(sizeof(FontManager)))==NULL) { - return FALSE; - } + return FALSE; + } if((pTransTab = (FontTranslationTable *)MemAlloc(sizeof(FontTranslationTable)))==NULL) { - return FALSE; - } + return FALSE; + } pFManager->pTranslationTable = pTransTab; pFManager->usDefaultPixelDepth = usDefaultPixelDepth; pTransTab->usNumberOfSymbols = pTransTable->usNumberOfSymbols; - pTransTab->DynamicArrayOf16BitValues = pTransTable->DynamicArrayOf16BitValues; + pTransTab->DynamicArrayOf16BitValues = pTransTable->DynamicArrayOf16BitValues; // Mark all font slots as empty for(count=0; count < MAX_FONTS; count++) @@ -1234,10 +1234,10 @@ UINT8 uiPixelDepth; //***************************************************************************** void ShutdownFontManager(void) { - INT32 count; + INT32 count; UnRegisterDebugTopic(TOPIC_FONT_HANDLER, "Font Manager"); - if(pFManager) + if(pFManager) MemFree(pFManager); for(count=0; count < MAX_FONTS; count++) @@ -1277,15 +1277,15 @@ void DestroyEnglishTransTable( void ) // // Creates the English text->font map table. //***************************************************************************** -FontTranslationTable *CreateEnglishTransTable( ) +FontTranslationTable *CreateEnglishTransTable( ) { FontTranslationTable *pTable = NULL; UINT16 *temp; - pTable = (FontTranslationTable *)MemAlloc(sizeof(FontTranslationTable)); - memset(pTable, 0, sizeof(FontTranslationTable) ); + pTable = (FontTranslationTable *)MemAlloc(sizeof(FontTranslationTable)); + memset(pTable, 0, sizeof(FontTranslationTable) ); - #ifdef JA2 +#ifdef JA2 // ha ha, we have more than Wizardry now (again) pTable->usNumberOfSymbols = 255; #else @@ -1496,7 +1496,7 @@ FontTranslationTable *CreateEnglishTransTable( ) temp++; *temp = 252; // "u" umlaut temp++; - *temp = 223; // double-s that looks like a beta/B // 100 + *temp = 223; // double-s that looks like a beta/B // 100 temp++; #else *temp = 0; // "A" umlaut @@ -1511,13 +1511,13 @@ FontTranslationTable *CreateEnglishTransTable( ) temp++; *temp = 0; // "u" umlaut temp++; - *temp = 0; // double-s that looks like a beta/B // 100 + *temp = 0; // double-s that looks like a beta/B // 100 temp++; #endif - *temp = 192; // À + *temp = 192; // À temp++; - *temp = 193; // Á + *temp = 193; // Á temp++; *temp = 194; // Ã temp++; @@ -1525,7 +1525,7 @@ FontTranslationTable *CreateEnglishTransTable( ) temp++; *temp = 196; // Å temp++; - *temp = 197; // ¨ + *temp = 197; // ¨ temp++; *temp = 198; // Æ temp++; @@ -1710,11 +1710,11 @@ FontTranslationTable *CreateEnglishTransTable( ) temp++; *temp = 1071; temp++; - *temp = 1072; // Ä - temp++; - *temp = 1073; // À + *temp = 1072; // Ä temp++; - *temp = 1074; // Á + *temp = 1073; // À + temp++; + *temp = 1074; // Á temp++; *temp = 1075; // Â temp++; @@ -1888,7 +1888,7 @@ FontTranslationTable *CreateEnglishTransTable( ) temp++; *temp = 255; // "y" umlaut temp++; - *temp = 223; // beta + *temp = 223; // beta // Font glyphs for spell targeting icons //ATE: IMPORTANT! INcreate the array above if you add any new items here... @@ -1906,7 +1906,7 @@ FontTranslationTable *CreateEnglishTransTable( ) // 154 #endif - return pTable; + return pTable; } //***************************************************************************** @@ -1915,139 +1915,139 @@ FontTranslationTable *CreateEnglishTransTable( ) // // Parameter List : filename - File created by the utility tool to open // -// Return Value pointer to the base structure +// Return Value pointer to the base structure // // Modification History : -// Dec 15th 1996 -> modified for use by Wizardry +// Dec 15th 1996->modified for use by Wizardry // //***************************************************************************** /*FontBase *LoadFontFile(UINT8 *pFilename) { - HWFILE hFileHandle; - UINT32 uiFileSize; - UINT32 uiHeightEach; - UINT32 uiTotalSymbol; - UINT32 uiNewoffst, uiOldoffst; - FontBase *pFontBase; - SGPPaletteEntry *pNewPalette; - UINT8 *pPalette; + HWFILE hFileHandle; + UINT32 uiFileSize; + UINT32 uiHeightEach; + UINT32 uiTotalSymbol; + UINT32 uiNewoffst, uiOldoffst; + FontBase *pFontBase; + SGPPaletteEntry *pNewPalette; + UINT8 *pPalette; - if (pFManager == NULL) - { - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Did not Initialize Font Manager"); - return NULL; - } + if (pFManager == NULL) + { + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Did not Initialize Font Manager"); + return NULL; + } - // Open and read in the file - if ((hFileHandle = FileOpen(pFilename, FILE_ACCESS_READ, FALSE)) == 0) - { // damn we failed to open the file - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Cannot open font file"); - return NULL; - } + // Open and read in the file + if ((hFileHandle = FileOpen(pFilename, FILE_ACCESS_READ, FALSE)) == 0) + { // damn we failed to open the file + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Cannot open font file"); + return NULL; + } - uiFileSize = FileGetSize(hFileHandle); - if (uiFileSize == 0) - { // we failed to size up the file - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Font file is empty"); - FileClose(hFileHandle); - return NULL; - } + uiFileSize = FileGetSize(hFileHandle); + if (uiFileSize == 0) + { // we failed to size up the file + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Font file is empty"); + FileClose(hFileHandle); + return NULL; + } - // Allocate memory for the font header file - if ((pFontBase = (FontBase *)MemAlloc(sizeof(FontBase))) == NULL) - { - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Could not malloc memory"); - FileClose(hFileHandle); - } + // Allocate memory for the font header file + if ((pFontBase = (FontBase *)MemAlloc(sizeof(FontBase))) == NULL) + { + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Could not malloc memory"); + FileClose(hFileHandle); + } - // read in these values from the file - if (FileRead(hFileHandle, &uiHeightEach, sizeof(UINT32), NULL) == FALSE) - { - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Could not read Height from File"); - FileClose(hFileHandle); - return NULL; - } + // read in these values from the file + if (FileRead(hFileHandle, &uiHeightEach, sizeof(UINT32), NULL) == FALSE) + { + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Could not read Height from File"); + FileClose(hFileHandle); + return NULL; + } - if (FileRead(hFileHandle, &uiTotalSymbol, sizeof(UINT32), NULL) == FALSE) - { - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Could not read Total Symbol from File"); - FileClose(hFileHandle); - return NULL; - } + if (FileRead(hFileHandle, &uiTotalSymbol, sizeof(UINT32), NULL) == FALSE) + { + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Could not read Total Symbol from File"); + FileClose(hFileHandle); + return NULL; + } - // Assign the proper values to the Base structure - pFontBase->uiHeightEach = uiHeightEach; - pFontBase->uiTotalElements = uiTotalSymbol; - pFontBase->pFontObject = (FontObject *)MemAlloc(uiTotalSymbol * sizeof(FontHeader)); - pPalette = (UINT8 *)MemAlloc(PALETTE_SIZE); - uiOldoffst = (sizeof(FontHeader) + sizeof(FontObject)*pFontBase->uiTotalElements); - uiNewoffst = uiFileSize - uiOldoffst; - pFontBase->pPixData8 = (UINT8 *)MemAlloc(uiNewoffst); + // Assign the proper values to the Base structure + pFontBase->uiHeightEach = uiHeightEach; + pFontBase->uiTotalElements = uiTotalSymbol; + pFontBase->pFontObject = (FontObject *)MemAlloc(uiTotalSymbol * sizeof(FontHeader)); + pPalette = (UINT8 *)MemAlloc(PALETTE_SIZE); + uiOldoffst = (sizeof(FontHeader) + sizeof(FontObject)*pFontBase->uiTotalElements); + uiNewoffst = uiFileSize - uiOldoffst; + pFontBase->pPixData8 = (UINT8 *)MemAlloc(uiNewoffst); - //seek past the FontHeader - if (FileSeek(hFileHandle, sizeof(FontHeader), FILE_SEEK_FROM_START) == FALSE) - { - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Could not seek FileHeader"); - FileClose(hFileHandle); - return NULL; - } + //seek past the FontHeader + if (FileSeek(hFileHandle, sizeof(FontHeader), FILE_SEEK_FROM_START) == FALSE) + { + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Could not seek FileHeader"); + FileClose(hFileHandle); + return NULL; + } - //read in the FontObject - if (FileRead(hFileHandle, pFontBase->pFontObject, (uiTotalSymbol)*sizeof(FontHeader), NULL) == FALSE) - { - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Could not seek Font Objects"); - FileClose(hFileHandle); - return NULL; - } + //read in the FontObject + if (FileRead(hFileHandle, pFontBase->pFontObject, (uiTotalSymbol)*sizeof(FontHeader), NULL) == FALSE) + { + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Could not seek Font Objects"); + FileClose(hFileHandle); + return NULL; + } - if (FileSeek(hFileHandle, uiOldoffst, FILE_SEEK_FROM_START) == FALSE) - { - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Could not seek Old offset"); - FileClose(hFileHandle); - return NULL; - } + if (FileSeek(hFileHandle, uiOldoffst, FILE_SEEK_FROM_START) == FALSE) + { + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Could not seek Old offset"); + FileClose(hFileHandle); + return NULL; + } - // read in the Pixel data - if (FileRead(hFileHandle, pFontBase->pPixData8, uiNewoffst, NULL) == FALSE) - { - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Could not seek Pixel data"); - FileClose(hFileHandle); - return NULL; - } + // read in the Pixel data + if (FileRead(hFileHandle, pFontBase->pPixData8, uiNewoffst, NULL) == FALSE) + { + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Could not seek Pixel data"); + FileClose(hFileHandle); + return NULL; + } - // seek proper position to read in Palette - if (FileSeek(hFileHandle, sizeof(UINT32)*3, FILE_SEEK_FROM_START) == FALSE) - { - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Could not seek Palette Start"); - FileClose(hFileHandle); - return NULL; - } + // seek proper position to read in Palette + if (FileSeek(hFileHandle, sizeof(UINT32)*3, FILE_SEEK_FROM_START) == FALSE) + { + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Could not seek Palette Start"); + FileClose(hFileHandle); + return NULL; + } - // read in Palette - if (FileRead(hFileHandle, pPalette, PALETTE_SIZE, NULL) == FALSE) - { - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Could not read Palette"); - FileClose(hFileHandle); - return NULL; - } + // read in Palette + if (FileRead(hFileHandle, pPalette, PALETTE_SIZE, NULL) == FALSE) + { + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Could not read Palette"); + FileClose(hFileHandle); + return NULL; + } - // set the default pixel depth - pFontBase->siPixelDepth = pFManager->usDefaultPixelDepth; - FileClose(hFileHandle); + // set the default pixel depth + pFontBase->siPixelDepth = pFManager->usDefaultPixelDepth; + FileClose(hFileHandle); - // convert from RGB to SGPPaletteEntry - pNewPalette = ConvertToPaletteEntry(0, 255, pPalette); - pFontBase->pPalette = pNewPalette; + // convert from RGB to SGPPaletteEntry + pNewPalette = ConvertToPaletteEntry(0, 255, pPalette); + pFontBase->pPalette = pNewPalette; - // create the 16BPer Pixel palette - if ((pFontBase->pPalet16 = Create16BPPPalette(pNewPalette)) == NULL) - { - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Could not create 16 bit palette"); - return NULL; - } - // return the FontBase structure - return pFontBase; + // create the 16BPer Pixel palette + if ((pFontBase->pPalet16 = Create16BPPPalette(pNewPalette)) == NULL) + { + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Could not create 16 bit palette"); + return NULL; + } + // return the FontBase structure + return pFontBase; } */ @@ -2079,10 +2079,10 @@ FontTranslationTable *CreateEnglishTransTable( ) // // Parameter List : pointer to the base structure // -// Return Value Maximum font width +// Return Value Maximum font width // // Modification History : -// Dec 15th 1996 -> modified for use by Wizardry +// Dec 15th 1996->modified for use by Wizardry // //***************************************************************************** @@ -2092,15 +2092,15 @@ FontTranslationTable *CreateEnglishTransTable( ) UINT32 siBiggest = 0; UINT16 siCount; - Assert(pFontBase != NULL); + Assert(pFontBase != NULL); pWidth = pFontBase->pFontObject; // traverse the FontObject structure to find the biggest width for(siCount = 0; siCount < pFontBase->uiTotalElements; siCount++) { if( pWidth->uiFontWidth > siBiggest) { - siBiggest = pWidth->uiFontWidth; - } + siBiggest = pWidth->uiFontWidth; + } pWidth++; } // return the max width @@ -2113,10 +2113,10 @@ FontTranslationTable *CreateEnglishTransTable( ) // // Parameter List : Converts from RGB to SGPPaletteEntry // -// Return Value pointer to the SGPPaletteEntry +// Return Value pointer to the SGPPaletteEntry // // Modification History : -// Dec 15th 1996 -> modified for use by Wizardry +// Dec 15th 1996->modified for use by Wizardry // //***************************************************************************** @@ -2124,21 +2124,21 @@ FontTranslationTable *CreateEnglishTransTable( ) SGPPaletteEntry *ConvertToPaletteEntry(UINT8 sbStart, UINT8 sbEnd, UINT8 *pOldPalette) { UINT16 Index; - SGPPaletteEntry *pPalEntry; + SGPPaletteEntry *pPalEntry; SGPPaletteEntry *pInitEntry; pPalEntry = (SGPPaletteEntry *)MemAlloc(sizeof(SGPPaletteEntry) * 256); pInitEntry = pPalEntry; - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Converting RGB palette to SGPPaletteEntry"); - for(Index=0; Index <= (sbEnd-sbStart);Index++) - { - pPalEntry->peRed = *(pOldPalette + (Index*3)); - pPalEntry->peGreen = *(pOldPalette + (Index*3) + 1); - pPalEntry->peBlue = *(pOldPalette + (Index*3) + 2); - pPalEntry->peFlags = 0; - pPalEntry++; - } - return pInitEntry; + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Converting RGB palette to SGPPaletteEntry"); + for(Index=0; Index <= (sbEnd-sbStart);Index++) + { + pPalEntry->peRed = *(pOldPalette + (Index*3)); + pPalEntry->peGreen = *(pOldPalette + (Index*3) + 1); + pPalEntry->peBlue = *(pOldPalette + (Index*3) + 2); + pPalEntry->peFlags = 0; + pPalEntry++; + } + return pInitEntry; } */ //***************************************************************************** @@ -2146,14 +2146,14 @@ SGPPaletteEntry *ConvertToPaletteEntry(UINT8 sbStart, UINT8 sbEnd, UINT8 *pOldPa // SetFontPalette - Sets the Palette // // Parameter List : pointer to the base structure -// new pixel depth -// new Palette size -// pointer to palette data +// new pixel depth +// new Palette size +// pointer to palette data // -// Return Value BOOLEAN +// Return Value BOOLEAN // // Modification History : -// Dec 15th 1996 -> modified for use by Wizardry +// Dec 15th 1996->modified for use by Wizardry // //***************************************************************************** @@ -2174,12 +2174,12 @@ SGPPaletteEntry *ConvertToPaletteEntry(UINT8 sbStart, UINT8 sbEnd, UINT8 *pOldPa // SetFont16BitData - Sets the font structure to hold 16 bit data // // Parameter List : pointer to the base structure -// pointer to new 16 bit data +// pointer to new 16 bit data // -// Return Value BOOLEAN +// Return Value BOOLEAN // // Modification History : -// Dec 15th 1996 -> modified for use by Wizardry +// Dec 15th 1996->modified for use by Wizardry // //***************************************************************************** @@ -2199,31 +2199,31 @@ SGPPaletteEntry *ConvertToPaletteEntry(UINT8 sbStart, UINT8 sbEnd, UINT8 *pOldPa // Blt8Imageto16Dest // // Parameter List : Start offset -// End Offset -// Dest x, y -// Font Width -// Pointer to Base structure -// Pointer to destination buffer -// Destination Pitch -// Height of Each element +// End Offset +// Dest x, y +// Font Width +// Pointer to Base structure +// Pointer to destination buffer +// Destination Pitch +// Height of Each element // -// Return Value : BOOLEAN +// Return Value : BOOLEAN // // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** /*BOOLEAN Blt8Imageto16Dest(UINT32 uiOffStart, UINT32 uiOffEnd, UINT16 siX, UINT16 siY, UINT32 uiWidth, FontBase *pFontBase, UINT8 *pFrameBuffer, UINT16 siDestPitch, UINT16 siHeightEach) { - UINT8 *pTrav; + UINT8 *pTrav; UINT16 *pFrameTrav; UINT16 *p16BPPPalette; - UINT16 usEffectiveWidth; - UINT32 uiFrameCount; - UINT8 amount; - UINT32 row, count; - UINT16 modamount, divamount; + UINT16 usEffectiveWidth; + UINT32 uiFrameCount; + UINT8 amount; + UINT32 row, count; + UINT16 modamount, divamount; UINT32 trace,modtrace; UINT8 sub=0; @@ -2231,7 +2231,7 @@ SGPPaletteEntry *ConvertToPaletteEntry(UINT8 sbStart, UINT8 sbEnd, UINT8 *pOldPa pTrav = pFontBase->pPixData8; pFrameTrav = (UINT16 *)pFrameBuffer; p16BPPPalette = pFontBase->pPalet16; - trace = 0; + trace = 0; modtrace = 0; // effective width is pitch/2 as 16 bits per pixel usEffectiveWidth = (UINT16)(siDestPitch / 2); @@ -2246,83 +2246,83 @@ SGPPaletteEntry *ConvertToPaletteEntry(UINT8 sbStart, UINT8 sbEnd, UINT8 *pOldPa amount = 0; while (count < (uiOffEnd-uiOffStart)) { - amount = 0; - if (*pTrav == ID_BLACK) - { - pTrav++; - count++; - amount = *pTrav; - modamount = (UINT8)(amount) % (UINT8) uiWidth; - divamount = (UINT8)(amount) / (UINT8) uiWidth; - if ((divamount == 0) && ((row+amount) < (UINT16)uiWidth)) - { - pFrameTrav += amount; - trace += amount; - modtrace = trace % 640; - row += amount; - row++; - } - else - { - if (((row+amount) >= (UINT16)uiWidth) && (divamount ==0)) - { - pFrameTrav -= row; + amount = 0; + if (*pTrav == ID_BLACK) + { + pTrav++; + count++; + amount = *pTrav; + modamount = (UINT8)(amount) % (UINT8) uiWidth; + divamount = (UINT8)(amount) / (UINT8) uiWidth; + if ((divamount == 0) && ((row+amount) < (UINT16)uiWidth)) + { + pFrameTrav += amount; + trace += amount; + modtrace = trace % 640; + row += amount; + row++; + } + else + { + if (((row+amount) >= (UINT16)uiWidth) && (divamount ==0)) + { + pFrameTrav -= row; trace -= row; - modtrace = trace % 640; - row = amount-((UINT16)uiWidth-row); - pFrameTrav += usEffectiveWidth+row; + modtrace = trace % 640; + row = amount-((UINT16)uiWidth-row); + pFrameTrav += usEffectiveWidth+row; trace += usEffectiveWidth+row; modtrace = trace % 640; - row++; - } - else - { - pFrameTrav += (divamount*usEffectiveWidth); + row++; + } + else + { + pFrameTrav += (divamount*usEffectiveWidth); trace += (divamount*usEffectiveWidth); modtrace = trace % 640; if(row+modamount > uiWidth) { sub = (UINT8)((row+modamount) % uiWidth); pFrameTrav -= row; - trace -= row; - modtrace = trace % 640; + trace -= row; + modtrace = trace % 640; pFrameTrav += usEffectiveWidth+sub; - trace += usEffectiveWidth + sub; - modtrace = trace % 640; - row = sub; - row++; + trace += usEffectiveWidth + sub; + modtrace = trace % 640; + row = sub; + row++; }else { pFrameTrav += modamount; - trace += modamount; - modtrace = trace % 640; - row = modamount; - row++; + trace += modamount; + modtrace = trace % 640; + row = modamount; + row++; } - } - } - } else - { - if(row >= uiWidth) - { - pFrameTrav += (usEffectiveWidth-uiWidth); + } + } + } else + { + if(row >= uiWidth) + { + pFrameTrav += (usEffectiveWidth-uiWidth); trace += (usEffectiveWidth-uiWidth); modtrace = trace % 640; - *pFrameTrav = p16BPPPalette[*pTrav]; - row = 1; - } - else - { - *pFrameTrav = p16BPPPalette[*pTrav]; - row++; - } - } + *pFrameTrav = p16BPPPalette[*pTrav]; + row = 1; + } + else + { + *pFrameTrav = p16BPPPalette[*pTrav]; + row++; + } + } - pFrameTrav++; + pFrameTrav++; trace++; modtrace = trace % 640; - pTrav++; - count++; + pTrav++; + count++; } return TRUE; @@ -2334,32 +2334,32 @@ SGPPaletteEntry *ConvertToPaletteEntry(UINT8 sbStart, UINT8 sbEnd, UINT8 *pOldPa // Blt8Imageto8Dest // // Parameter List : Start offset -// End Offset -// Dest x, y -// Font Width -// Pointer to Base structure -// Pointer to destination buffer -// Destination Pitch -// Height of Each element +// End Offset +// Dest x, y +// Font Width +// Pointer to Base structure +// Pointer to destination buffer +// Destination Pitch +// Height of Each element // -// Return Value : BOOLEAN +// Return Value : BOOLEAN // // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** /*BOOLEAN Blt8Imageto8Dest(UINT32 uiOffStart, UINT32 uiOffEnd, UINT16 siX, UINT16 siY, UINT32 uiWidth, FontBase *pFontBase, UINT8 *pFrameBuffer, UINT16 siDestPitch, UINT16 siHeightEach) { - UINT8 *pTrav; - UINT32 uiFrameCount; - UINT8 *pFrameTrav; - UINT8 amount; - UINT32 row,count; - UINT16 modamount,divamount; + UINT8 *pTrav; + UINT32 uiFrameCount; + UINT8 *pFrameTrav; + UINT8 amount; + UINT32 row,count; + UINT16 modamount,divamount; DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Blitting 8 to 8"); - Assert(pFontBase != NULL); + Assert(pFontBase != NULL); Assert(pFrameBuffer != NULL); // get the pointers @@ -2369,60 +2369,60 @@ SGPPaletteEntry *ConvertToPaletteEntry(UINT8 sbStart, UINT8 sbEnd, UINT8 *pOldPa uiFrameCount = siY*siDestPitch + siX; pFrameTrav +=uiFrameCount; pTrav += uiOffStart; - // perform blitting + // perform blitting count=0; row = 0; amount = 0; while (count < (uiOffEnd-uiOffStart)) { - amount = 0; - if (*pTrav == ID_BLACK) - { - pTrav++; - count++; - amount = *pTrav; - modamount = amount % (UINT8) uiWidth; - divamount = amount / (UINT8) uiWidth; - if ((divamount == 0) && ((row+amount) < (UINT16)uiWidth)) - { - pFrameTrav += amount; - row += amount; - row++; - } - else - { - if (((row+amount) >= (UINT16)uiWidth) && (divamount ==0)) - { - pFrameTrav -= row; - row = amount-((UINT16)uiWidth-row); - pFrameTrav += siDestPitch+row; - row++; - } - else - { - pFrameTrav += (divamount*siDestPitch)+modamount; - row = modamount; - row++; - } - } - } else - { - if (row >= uiWidth) - { - pFrameTrav += (siDestPitch-uiWidth); - *pFrameTrav = *pTrav; - row = 1; - } - else - { - *pFrameTrav = *pTrav; - row++; - } - } + amount = 0; + if (*pTrav == ID_BLACK) + { + pTrav++; + count++; + amount = *pTrav; + modamount = amount % (UINT8) uiWidth; + divamount = amount / (UINT8) uiWidth; + if ((divamount == 0) && ((row+amount) < (UINT16)uiWidth)) + { + pFrameTrav += amount; + row += amount; + row++; + } + else + { + if (((row+amount) >= (UINT16)uiWidth) && (divamount ==0)) + { + pFrameTrav -= row; + row = amount-((UINT16)uiWidth-row); + pFrameTrav += siDestPitch+row; + row++; + } + else + { + pFrameTrav += (divamount*siDestPitch)+modamount; + row = modamount; + row++; + } + } + } else + { + if (row >= uiWidth) + { + pFrameTrav += (siDestPitch-uiWidth); + *pFrameTrav = *pTrav; + row = 1; + } + else + { + *pFrameTrav = *pTrav; + row++; + } + } - pFrameTrav++; - pTrav++; + pFrameTrav++; + pTrav++; count++; } @@ -2434,32 +2434,32 @@ SGPPaletteEntry *ConvertToPaletteEntry(UINT8 sbStart, UINT8 sbEnd, UINT8 *pOldPa // Blt16Imageto16Dest // // Parameter List : Start offset -// End Offset -// Dest x, y -// Font Width -// Pointer to Base structure -// Pointer to destination buffer -// Destination Pitch -// Height of Each element +// End Offset +// Dest x, y +// Font Width +// Pointer to Base structure +// Pointer to destination buffer +// Destination Pitch +// Height of Each element // -// Return Value : BOOLEAN +// Return Value : BOOLEAN // // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** /*BOOLEAN Blt16Imageto16Dest(UINT32 uiOffStart, UINT32 uiOffEnd, UINT16 siX, UINT16 siY, UINT32 uiWidth, FontBase *pFontBase, UINT8 *pFrameBuffer, UINT16 siDestPitch, UINT16 siHeightEach) { UINT16 *pTrav; - UINT32 uiFrameCount; + UINT32 uiFrameCount; UINT16 *pFrameTrav; - UINT16 amount; - UINT32 row,count; - UINT16 modamount,divamount; - UINT16 usEffectiveWidth; + UINT16 amount; + UINT32 row,count; + UINT16 modamount,divamount; + UINT16 usEffectiveWidth; DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Blitting 16 to 16"); - Assert(pFontBase != NULL); + Assert(pFontBase != NULL); Assert(pFrameBuffer != NULL); //get the pointers @@ -2477,52 +2477,52 @@ SGPPaletteEntry *ConvertToPaletteEntry(UINT8 sbStart, UINT8 sbEnd, UINT8 *pOldPa amount = 0; while (count < (uiOffEnd-uiOffStart)) { - amount = 0; - if (*pTrav == ID_BLACK) - { - pTrav++; - count++; - amount = *pTrav; - modamount = amount % (UINT8) uiWidth; - divamount = amount / (UINT8) uiWidth; - if ((divamount == 0) && ((row+amount) < (UINT16)uiWidth)) - { - pFrameTrav += amount; - row += amount; - row++; - } - else - { - if (((row+amount) >= (UINT16)uiWidth) && (divamount ==0)) - { - pFrameTrav -= row; - row = amount-((UINT16)uiWidth-row); - pFrameTrav += usEffectiveWidth+row; - row++; - } - else - { - pFrameTrav += (divamount*usEffectiveWidth)+modamount; - row = modamount; - row++; - } - } - } else - { - if(row >= uiWidth) - { - pFrameTrav += (usEffectiveWidth-uiWidth); - *pFrameTrav = *pTrav; - row = 1; - } - else - { - *pFrameTrav = *pTrav; - row++; - } - } + amount = 0; + if (*pTrav == ID_BLACK) + { + pTrav++; + count++; + amount = *pTrav; + modamount = amount % (UINT8) uiWidth; + divamount = amount / (UINT8) uiWidth; + if ((divamount == 0) && ((row+amount) < (UINT16)uiWidth)) + { + pFrameTrav += amount; + row += amount; + row++; + } + else + { + if (((row+amount) >= (UINT16)uiWidth) && (divamount ==0)) + { + pFrameTrav -= row; + row = amount-((UINT16)uiWidth-row); + pFrameTrav += usEffectiveWidth+row; + row++; + } + else + { + pFrameTrav += (divamount*usEffectiveWidth)+modamount; + row = modamount; + row++; + } + } + } else + { + if(row >= uiWidth) + { + pFrameTrav += (usEffectiveWidth-uiWidth); + *pFrameTrav = *pTrav; + row = 1; + } + else + { + *pFrameTrav = *pTrav; + row++; + } + } - pFrameTrav++; + pFrameTrav++; pTrav++; count++; } @@ -2536,33 +2536,33 @@ SGPPaletteEntry *ConvertToPaletteEntry(UINT8 sbStart, UINT8 sbEnd, UINT8 *pOldPa // // Parameter List : Given the index, gets the corresponding offset // -// Return Value : offset +// Return Value : offset // // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** /*UINT32 GetOffset(FontBase *pFontBase, INT16 ssIndex) { - FontObject *pTrav; - UINT16 siCount=0; + FontObject *pTrav; + UINT16 siCount=0; - Assert(pFontBase != NULL); - // gets the offset based on the index - if (((UINT32)ssIndex > pFontBase->uiTotalElements) || (ssIndex < 0)) - { - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Incorrect index value passed"); - return 0; - } - pTrav = pFontBase->pFontObject; - while (siCount != ssIndex) - { - siCount++; - pTrav++; - } + Assert(pFontBase != NULL); + // gets the offset based on the index + if (((UINT32)ssIndex > pFontBase->uiTotalElements) || (ssIndex < 0)) + { + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Incorrect index value passed"); + return 0; + } + pTrav = pFontBase->pFontObject; + while (siCount != ssIndex) + { + siCount++; + pTrav++; + } - return pTrav->uiFontOffset; + return pTrav->uiFontOffset; } */ @@ -2573,32 +2573,32 @@ SGPPaletteEntry *ConvertToPaletteEntry(UINT8 sbStart, UINT8 sbEnd, UINT8 *pOldPa // Parameter List : Given the index, gets the corresponding offset // length which is the number of compressed pixels // -// Return Value : offset +// Return Value : offset // // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** /*UINT32 GetOffLen(FontBase *pFontBase, INT16 ssIndex) { - FontObject *pTrav; - UINT16 siCount=0; + FontObject *pTrav; + UINT16 siCount=0; - Assert(pFontBase != NULL); - // gets the offset based on the index - if (((UINT32)ssIndex > pFontBase->uiTotalElements) || (ssIndex < 0)) - { - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Incorrect index value passed"); - return 0; - } - pTrav = pFontBase->pFontObject; - while(siCount != ssIndex) - { - siCount++; - pTrav++; - } + Assert(pFontBase != NULL); + // gets the offset based on the index + if (((UINT32)ssIndex > pFontBase->uiTotalElements) || (ssIndex < 0)) + { + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Incorrect index value passed"); + return 0; + } + pTrav = pFontBase->pFontObject; + while(siCount != ssIndex) + { + siCount++; + pTrav++; + } - return pTrav->uiOffLen; + return pTrav->uiOffLen; } */ @@ -2607,29 +2607,29 @@ SGPPaletteEntry *ConvertToPaletteEntry(UINT8 sbStart, UINT8 sbEnd, UINT8 *pOldPa // PrintFontString // // Parameter List : pointer to \0 (NULL) terminated font string -// x,y,TotalWidth, TotalHeight is the bounding rectangle where -// the font is to be printed -// Multiline if true will print on multiple lines otherwise on 1 line -// Pointer to base structure +// x,y,TotalWidth, TotalHeight is the bounding rectangle where +// the font is to be printed +// Multiline if true will print on multiple lines otherwise on 1 line +// Pointer to base structure // -// Return Value : BOOLEAN +// Return Value : BOOLEAN // // Modification History : -// Nov 26th 1996 -> modified for use by Wizardry +// Nov 26th 1996->modified for use by Wizardry // //***************************************************************************** /*BOOLEAN PrintFontString(UINT16 *pFontString, UINT8 *pDestBuffer, UINT16 siDestWidth, UINT16 siDestPixelDepth, UINT16 siDestPitch, UINT16 siDestHeight, UINT16 siX, UINT16 siY, UINT16 siTotalWidth, UINT16 siTotalHeight, BOOLEAN fMultiLine, FontBase *pFontBase) { - UINT16 siScreenHt; - UINT16 siScreenWt; - UINT16 siChar, siHeightEach; - INT16 ssIndex; - UINT32 uiWidth, uiOffsetSt, uiOffsetEnd, uiOldoffst; + UINT16 siScreenHt; + UINT16 siScreenWt; + UINT16 siChar, siHeightEach; + INT16 ssIndex; + UINT32 uiWidth, uiOffsetSt, uiOffsetEnd, uiOldoffst; UINT16 *pTempFStr; - UINT16 siNewX, siNewY; - UINT16 siInitX, siInitY; - UINT32 uiLen; + UINT16 siNewX, siNewY; + UINT16 siInitX, siInitY; + UINT32 uiLen; // check for NULL pointers passed in Assert(pFontBase != NULL); @@ -2642,15 +2642,15 @@ SGPPaletteEntry *ConvertToPaletteEntry(UINT8 sbStart, UINT8 sbEnd, UINT8 *pOldPa // check for invalid coordinates if((siX<0) || (siX>siScreenWt) || (siY<0) || (siY>siScreenHt) || (siTotalWidth<0) || (siTotalWidth>siScreenWt) || (siTotalHeight<0) || (siTotalHeight>siScreenHt)) { - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Invalid coordinates passed in"); - return FALSE; - } + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Invalid coordinates passed in"); + return FALSE; + } pTempFStr = pFontString; siNewX = siX; siNewY = siY; siInitX = siX; - siInitY = siY; + siInitY = siY; // Get the height of each font and the offset siHeightEach = GetFontHeight(pFontBase); @@ -2659,98 +2659,98 @@ SGPPaletteEntry *ConvertToPaletteEntry(UINT8 sbStart, UINT8 sbEnd, UINT8 *pOldPa // calls the blt routine until the string != to \0 while(*pTempFStr != STRING_DELIMITER) { - siChar = *pTempFStr; - // get the index value for the font - if((ssIndex = GetIndex(siChar)) == -1) + siChar = *pTempFStr; + // get the index value for the font + if((ssIndex = GetIndex(siChar)) == -1) { - return FALSE; - } + return FALSE; + } - // get the width of the font - uiWidth = GetWidth(pFontBase, ssIndex); + // get the width of the font + uiWidth = GetWidth(pFontBase, ssIndex); - // get the font offset - uiOffsetSt = GetOffset(pFontBase, ssIndex); + // get the font offset + uiOffsetSt = GetOffset(pFontBase, ssIndex); - uiLen = GetOffLen(pFontBase,ssIndex); + uiLen = GetOffLen(pFontBase,ssIndex); - // uiOffsetSt -= uiOldoffst; - uiOffsetEnd = uiOffsetSt + uiLen; + // uiOffsetSt -= uiOldoffst; + uiOffsetEnd = uiOffsetSt + uiLen; - // if Multiline = FALSE and reached the end of line - cannot continue - if ((((siNewX+uiWidth) > siScreenWt) || ((siNewX+uiWidth) >= siTotalWidth)) && (fMultiLine == FALSE)) - { - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Cannot continue writing"); - return FALSE; - } + // if Multiline = FALSE and reached the end of line - cannot continue + if ((((siNewX+uiWidth) > siScreenWt) || ((siNewX+uiWidth) >= siTotalWidth)) && (fMultiLine == FALSE)) + { + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Cannot continue writing"); + return FALSE; + } - // check if boundary is reached - if ((((siNewX+uiWidth) >= siScreenWt) || ((siNewX+uiWidth) >= siTotalWidth)) && (fMultiLine == TRUE)) - { - if (((siInitY+siHeightEach) > siScreenHt) || ((siInitY+siHeightEach) >= siTotalHeight)) - { - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Cannot continue writing"); - return FALSE; - } - //call the appropriate blit routines - siNewX = siInitX; - siNewY += siHeightEach; - siInitY = siNewY; - if ((siDestPixelDepth == 16) && (pFontBase->siPixelDepth == 16)) - { - Blt16Imageto16Dest(uiOffsetSt, uiOffsetEnd, siNewX, siNewY, uiWidth, pFontBase, pDestBuffer, siDestPitch, siHeightEach); - } - else - { - if ((siDestPixelDepth == 16) && (pFontBase->siPixelDepth == 8)) - { - Blt8Imageto16Dest(uiOffsetSt, uiOffsetEnd, siNewX, siNewY, uiWidth, pFontBase, pDestBuffer, siDestPitch, siHeightEach); - } - else - { - if ((siDestPixelDepth == 8) && (pFontBase->siPixelDepth == 8)) - { // if(SetPalette(pFontBase->pPalette) == FALSE) - // return FALSE; - Blt8Imageto8Dest(uiOffsetSt, uiOffsetEnd, siNewX, siNewY, uiWidth, pFontBase, pDestBuffer, siDestPitch, siHeightEach); - } - else - { - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Invalid pixel depth / destination surface depth"); - return FALSE; - } - } - siNewX += (UINT16)uiWidth; - } - } else - { // if it isnt end of boundary copy at current location - if((siDestPixelDepth == 16) && (pFontBase->siPixelDepth == 16)) - { - Blt16Imageto16Dest(uiOffsetSt, uiOffsetEnd, siNewX, siNewY, uiWidth, pFontBase, pDestBuffer, siDestPitch, siHeightEach); - } - else - { - if((siDestPixelDepth == 16) && (pFontBase->siPixelDepth == 8)) - { - Blt8Imageto16Dest(uiOffsetSt, uiOffsetEnd, siNewX, siNewY, uiWidth, pFontBase, pDestBuffer, siDestPitch, siHeightEach); - } - else - { - if ((siDestPixelDepth == 8) && (pFontBase->siPixelDepth == 8)) - { - Blt8Imageto8Dest(uiOffsetSt, uiOffsetEnd, siNewX, siNewY, uiWidth, pFontBase, pDestBuffer, siDestPitch, siHeightEach); - } - else - { - DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Invalid pixel depth / destination surface depth"); - return FALSE; - } - } - siNewX += (UINT16)uiWidth; - } - } - // increment string pointer - pTempFStr++; - } + // check if boundary is reached + if ((((siNewX+uiWidth) >= siScreenWt) || ((siNewX+uiWidth) >= siTotalWidth)) && (fMultiLine == TRUE)) + { + if (((siInitY+siHeightEach) > siScreenHt) || ((siInitY+siHeightEach) >= siTotalHeight)) + { + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Cannot continue writing"); + return FALSE; + } + //call the appropriate blit routines + siNewX = siInitX; + siNewY += siHeightEach; + siInitY = siNewY; + if ((siDestPixelDepth == 16) && (pFontBase->siPixelDepth == 16)) + { + Blt16Imageto16Dest(uiOffsetSt, uiOffsetEnd, siNewX, siNewY, uiWidth, pFontBase, pDestBuffer, siDestPitch, siHeightEach); + } + else + { + if ((siDestPixelDepth == 16) && (pFontBase->siPixelDepth == 8)) + { + Blt8Imageto16Dest(uiOffsetSt, uiOffsetEnd, siNewX, siNewY, uiWidth, pFontBase, pDestBuffer, siDestPitch, siHeightEach); + } + else + { + if ((siDestPixelDepth == 8) && (pFontBase->siPixelDepth == 8)) + { // if(SetPalette(pFontBase->pPalette) == FALSE) + // return FALSE; + Blt8Imageto8Dest(uiOffsetSt, uiOffsetEnd, siNewX, siNewY, uiWidth, pFontBase, pDestBuffer, siDestPitch, siHeightEach); + } + else + { + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Invalid pixel depth / destination surface depth"); + return FALSE; + } + } + siNewX += (UINT16)uiWidth; + } + } else + { // if it isnt end of boundary copy at current location + if((siDestPixelDepth == 16) && (pFontBase->siPixelDepth == 16)) + { + Blt16Imageto16Dest(uiOffsetSt, uiOffsetEnd, siNewX, siNewY, uiWidth, pFontBase, pDestBuffer, siDestPitch, siHeightEach); + } + else + { + if((siDestPixelDepth == 16) && (pFontBase->siPixelDepth == 8)) + { + Blt8Imageto16Dest(uiOffsetSt, uiOffsetEnd, siNewX, siNewY, uiWidth, pFontBase, pDestBuffer, siDestPitch, siHeightEach); + } + else + { + if ((siDestPixelDepth == 8) && (pFontBase->siPixelDepth == 8)) + { + Blt8Imageto8Dest(uiOffsetSt, uiOffsetEnd, siNewX, siNewY, uiWidth, pFontBase, pDestBuffer, siDestPitch, siHeightEach); + } + else + { + DbgMessage(TOPIC_FONT_HANDLER, DBG_LEVEL_0, "Invalid pixel depth / destination surface depth"); + return FALSE; + } + } + siNewX += (UINT16)uiWidth; + } + } + // increment string pointer + pTempFStr++; + } return TRUE; } @@ -2763,31 +2763,32 @@ FontTranslationTable *pTransTab; // register the appropriate debug topics if(pTransTable == NULL) { - return FALSE; - } + return FALSE; + } RegisterDebugTopic(TOPIC_FONT_HANDLER, "Font Manager"); if ((pFManager = (FontManager *)MemAlloc(sizeof(FontManager)))==NULL) { - return FALSE; - } + return FALSE; + } if((pTransTab = (FontTranslationTable *)MemAlloc(sizeof(FontTranslationTable)))==NULL) { - return FALSE; - } + return FALSE; + } pFManager->pTranslationTable = pTransTab; pFManager->usDefaultPixelDepth = usDefaultPixelDepth; pTransTab->usNumberOfSymbols = pTransTable->usNumberOfSymbols; - pTransTab->DynamicArrayOf16BitValues = pTransTable->DynamicArrayOf16BitValues; + pTransTab->DynamicArrayOf16BitValues = pTransTable->DynamicArrayOf16BitValues; return TRUE; } */ /*void ShutdownFontManager(void) { - UnRegisterDebugTopic(TOPIC_FONT_HANDLER, "Font Manager"); - MemFree(pFManager); + UnRegisterDebugTopic(TOPIC_FONT_HANDLER, "Font Manager"); + MemFree(pFManager); } */ + diff --git a/Standard Gaming Platform/Font.h b/Standard Gaming Platform/Font.h index 67731ce2..922875c5 100644 --- a/Standard Gaming Platform/Font.h +++ b/Standard Gaming Platform/Font.h @@ -70,7 +70,7 @@ typedef struct { - UINT16 usNumberOfSymbols; + UINT16 usNumberOfSymbols; UINT16 *DynamicArrayOf16BitValues; } FontTranslationTable; @@ -110,7 +110,7 @@ void SetFontForeground(UINT8 ubForeground); void SetFontBackground(UINT8 ubBackground); void SetFontShadow(UINT8 ubBackground); -//Kris: added these +//Kris: added these void SetRGBFontForeground( UINT32 uiRed, UINT32 uiGreen, UINT32 uiBlue ); void SetRGBFontBackground( UINT32 uiRed, UINT32 uiGreen, UINT32 uiBlue ); void SetRGBFontShadow( UINT32 uiRed, UINT32 uiGreen, UINT32 uiBlue ); @@ -122,14 +122,14 @@ UINT16 *GetFontObjectPalette16BPP(INT32 iFont); void DestroyEnglishTransTable( void ); -extern HVOBJECT GetFontObject(INT32 iFont); -extern UINT32 gprintf(INT32 x, INT32 y, const STR16 pFontString, ...); -extern UINT32 gprintfDirty(INT32 x, INT32 y, const STR16 pFontString, ...); -extern UINT32 mprintf(INT32 x, INT32 y, const STR16 pFontString, ...); -extern UINT32 gprintf_buffer( UINT8 *pDestBuf, UINT32 uiDestPitchBYTES, UINT32 FontType, INT32 x, INT32 y, const STR16 pFontString, ...); +extern HVOBJECT GetFontObject(INT32 iFont); +extern UINT32 gprintf(INT32 x, INT32 y, const STR16 pFontString, ...); +extern UINT32 gprintfDirty(INT32 x, INT32 y, const STR16 pFontString, ...); +extern UINT32 mprintf(INT32 x, INT32 y, const STR16 pFontString, ...); +extern UINT32 gprintf_buffer( UINT8 *pDestBuf, UINT32 uiDestPitchBYTES, UINT32 FontType, INT32 x, INT32 y, const STR16 pFontString, ...); extern UINT32 mprintf_buffer( UINT8 *pDestBuf, UINT32 uiDestPitchBYTES, UINT32 FontType, INT32 x, INT32 y, const STR16 pFontString, ...); -// Function for displaying coded test. Since it's slower to do this, it's separate from the normal fuctions +// Function for displaying coded test. Since it's slower to do this, it's separate from the normal fuctions #define FONT_CODE_BEGINCOLOR 180 #define FONT_CODE_RESETCOLOR 181 @@ -137,16 +137,16 @@ UINT32 mprintf_buffer_coded( UINT8 *pDestBuf, UINT32 uiDestPitchBYTES, UINT32 Fo UINT32 mprintf_coded( INT32 x, INT32 y, const STR16 pFontString, ...); -extern BOOLEAN SetFontDestBuffer(UINT32 DestBuffer, INT32 x1, INT32 y1, INT32 x2, INT32 y2, BOOLEAN wrap); -extern BOOLEAN SetFont(INT32 iFontIndex); +extern BOOLEAN SetFontDestBuffer(UINT32 DestBuffer, INT32 x1, INT32 y1, INT32 x2, INT32 y2, BOOLEAN wrap); +extern BOOLEAN SetFont(INT32 iFontIndex); -extern INT32 LoadFontFile(const STR8 pFileName); -extern UINT16 GetFontHeight(INT32 FontNum); -extern BOOLEAN InitializeFontManager(UINT16 usDefaultPixDepth, FontTranslationTable *pTransTable); -extern void ShutdownFontManager(void); -extern void UnloadFont(UINT32 FontIndex); +extern INT32 LoadFontFile(const STR8 pFileName); +extern UINT16 GetFontHeight(INT32 FontNum); +extern BOOLEAN InitializeFontManager(UINT16 usDefaultPixDepth, FontTranslationTable *pTransTable); +extern void ShutdownFontManager(void); +extern void UnloadFont(UINT32 FontIndex); -extern FontTranslationTable *CreateEnglishTransTable( ); +extern FontTranslationTable *CreateEnglishTransTable( ); extern INT16 GetIndex(CHAR16 siChar); extern UINT32 GetWidth(HVOBJECT hSrcVObject, INT16 ssIndex); @@ -168,13 +168,13 @@ void FindFontRightCoordinates( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 sHei void FindFontCenterCoordinates( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 sHeight, const STR16 pStr, INT32 iFontIndex, INT16 *psNewX, INT16 *psNewY ); //extern FontBase *LoadFontFile(CHAR8 *pFileName); -//extern UINT8 *GetFontPalette(CHAR8 *pFileName); -//extern UINT16 GetMaxFontWidth(FontBase *pBase); -//extern void UnloadFont(FontBase *pBase); -//extern BOOLEAN SetFontPalette(FontBase *pFont, UINT16 siDepthPix, SGPPaletteEntry *pNewPalette); +//extern UINT8 *GetFontPalette(CHAR8 *pFileName); +//extern UINT16 GetMaxFontWidth(FontBase *pBase); +//extern void UnloadFont(FontBase *pBase); +//extern BOOLEAN SetFontPalette(FontBase *pFont, UINT16 siDepthPix, SGPPaletteEntry *pNewPalette); // make sure the pFontString is terminated by 0 -//extern BOOLEAN PrintFontString(STR16 pFontString, UINT8 *pDestBuffer, UINT16 siDestWidth, UINT16 siDestPixelDepth, UINT16 siDestPitch, UINT16 siDestHeight, UINT16 siX, UINT16 siY, UINT16 siTotalWidth, UINT16 siTotalHeight, BOOLEAN MultiLine, FontBase *pFontBase); -//extern BOOLEAN SetFont16BitData(FontBase *pFontBase, UINT16 *pData16); +//extern BOOLEAN PrintFontString(STR16 pFontString, UINT8 *pDestBuffer, UINT16 siDestWidth, UINT16 siDestPixelDepth, UINT16 siDestPitch, UINT16 siDestHeight, UINT16 siX, UINT16 siY, UINT16 siTotalWidth, UINT16 siTotalHeight, BOOLEAN MultiLine, FontBase *pFontBase); +//extern BOOLEAN SetFont16BitData(FontBase *pFontBase, UINT16 *pData16); /* #ifdef __cplusplus diff --git a/Standard Gaming Platform/Install.cpp b/Standard Gaming Platform/Install.cpp index e0e10bf4..b48cff3c 100644 --- a/Standard Gaming Platform/Install.cpp +++ b/Standard Gaming Platform/Install.cpp @@ -50,7 +50,7 @@ BOOLEAN InstallApplication( STR strAppname, STR strPath ) { HKEY hKey; - BOOL fRet = TRUE; + BOOL fRet = TRUE; hKey = GetAppRegistryKey(); RegCloseKey( hKey ); diff --git a/Standard Gaming Platform/JA2 SGP ALL.H b/Standard Gaming Platform/JA2 SGP ALL.H index 05b58d61..ad188eb2 100644 --- a/Standard Gaming Platform/JA2 SGP ALL.H +++ b/Standard Gaming Platform/JA2 SGP ALL.H @@ -1,7 +1,7 @@ /* * ChangeLog: - * 10.12.2005 Lesh ripped out everything that refers to MSS - * 10.12.2005 Lesh added fmod.h + * 10.12.2005 Lesh ripped out everything that refers to MSS + * 10.12.2005 Lesh added fmod.h */ #ifndef __JA2_SGP_ALL_H #define __JA2_SGP_ALL_H @@ -88,7 +88,6 @@ #include #include "vobject_private.h" #include "shading.h" -//#include "mss.h" #include "imgfmt.h" #include "timer.h" #include "renderworld.h" diff --git a/Standard Gaming Platform/Ja2 Libs.cpp b/Standard Gaming Platform/Ja2 Libs.cpp index aac50154..94412024 100644 --- a/Standard Gaming Platform/Ja2 Libs.cpp +++ b/Standard Gaming Platform/Ja2 Libs.cpp @@ -1,4 +1,4 @@ - +#include "LibraryDataBase.h" LibraryInitHeader gGameLibaries[ ] = { //Library Name Can be Init at start @@ -15,18 +15,18 @@ LibraryInitHeader gGameLibaries[ ] = { "Fonts.slf", FALSE, TRUE }, { "Interface.slf", FALSE, TRUE }, { "Laptop.slf", FALSE, TRUE }, - { "Maps.slf", TRUE, TRUE }, + { "Maps.slf", TRUE, TRUE }, { "MercEdt.slf", FALSE, TRUE }, - { "Music.slf", TRUE, TRUE }, - { "Npc_Speech.slf", TRUE, TRUE }, + { "Music.slf", TRUE, TRUE }, + { "Npc_Speech.slf", TRUE, TRUE }, { "NpcData.slf", FALSE, TRUE }, { "RadarMaps.slf", FALSE, TRUE }, { "Sounds.slf", FALSE, TRUE }, - { "Speech.slf", TRUE, TRUE }, + { "Speech.slf", TRUE, TRUE }, // { "TileCache.slf", FALSE, TRUE }, - { "TileSets.slf", TRUE, TRUE }, - { "LoadScreens.slf", TRUE, TRUE }, - { "Intro.slf", TRUE, TRUE }, + { "TileSets.slf", TRUE, TRUE }, + { "LoadScreens.slf", TRUE, TRUE }, + { "Intro.slf", TRUE, TRUE }, #ifdef GERMAN { "German.slf", FALSE, TRUE }, diff --git a/Standard Gaming Platform/LibraryDataBase.cpp b/Standard Gaming Platform/LibraryDataBase.cpp index 0f852b35..ce4e3d73 100644 --- a/Standard Gaming Platform/LibraryDataBase.cpp +++ b/Standard Gaming Platform/LibraryDataBase.cpp @@ -21,7 +21,7 @@ //NUMBER_OF_LIBRARIES #ifdef JA2 - #include "Ja2 Libs.cpp" + #include "Ja2 Libs.h" #include "GameSettings.h" #elif defined(UTIL) LibraryInitHeader gGameLibaries[ ] = { 0 }; @@ -52,9 +52,9 @@ INT32 CompareDirEntryFileNames( CHAR8 *arg1[], DIRENTRY **arg2 ); //************************************************************************ // -// InitializeFileDatabase(): Call this function to initialize the file -// database. It will use the gGameLibaries[] array for the list of libraries -// and the define NUMBER_OF_LIBRARIES for the number of libraries. The gGameLibaries +// InitializeFileDatabase(): Call this function to initialize the file +// database. It will use the gGameLibaries[] array for the list of libraries +// and the define NUMBER_OF_LIBRARIES for the number of libraries. The gGameLibaries // array is an array of structure, one of the fields determines if the library // will be initialized and game start. // @@ -130,9 +130,9 @@ BOOLEAN InitializeFileDatabase( ) // Closes all CD libraries, then reopens them. This function needs to be called when CDs // are changed. // -// Returns BOOLEAN - TRUE, always +// Returns BOOLEAN - TRUE, always // -// Created: 3/21/00 Derek Beland +// Created: 3/21/00 Derek Beland //***************************************************************************************** BOOLEAN ReopenCDLibraries(void) { @@ -153,7 +153,7 @@ INT16 i; //************************************************************************ // -// ShutDownFileDatabase(): Call this function to close down the file +// ShutDownFileDatabase(): Call this function to close down the file // database. // //************************************************************************ @@ -177,7 +177,7 @@ BOOLEAN ShutDownFileDatabase( ) //loop through all the 'opened files' ( there should be no files open ) for( sLoop1=0; sLoop1< gFileDataBase.RealFiles.iNumFilesOpen; sLoop1++) { - FastDebugMsg( String("ShutDownFileDatabase( ): ERROR: real file id still exists, wasnt closed") ); + FastDebugMsg( String("ShutDownFileDatabase( ): ERROR: real file id still exists, wasnt closed") ); CloseHandle( gFileDataBase.RealFiles.pRealFilesOpen[ sLoop1 ].hRealFileHandle ); } @@ -276,7 +276,7 @@ BOOLEAN InitializeLibrary( STR pLibraryName, LibraryHeaderStruct *pLibHeader, BO SetFilePointer( hFile, -( LibFileHeader.iEntries * (INT32)sizeof(DIRENTRY) ), NULL, FILE_END ); //loop through the library and determine the number of files that are FILE_OK - //ie. so we dont load the old or deleted files + //ie. so we dont load the old or deleted files usNumEntries = 0; for( uiLoop=0; uiLoop<(UINT32)LibFileHeader.iEntries; uiLoop++ ) { @@ -313,7 +313,7 @@ BOOLEAN InitializeLibrary( STR pLibraryName, LibraryHeaderStruct *pLibHeader, BO { //Check to see if the file is not longer then it should be if( ( strlen( DirEntry.sFileName ) + 1 ) >= FILENAME_SIZE ) - FastDebugMsg(String("\n*******InitializeLibrary(): Warning!: '%s' from the library '%s' has name whose size (%d) is bigger then it should be (%s)", DirEntry.sFileName, pLibHeader->sLibraryPath, ( strlen( DirEntry.sFileName ) + 1 ), FILENAME_SIZE ) ); + FastDebugMsg(String("\n*******InitializeLibrary(): Warning!: '%s' from the library '%s' has name whose size (%d) is bigger then it should be (%s)", DirEntry.sFileName, pLibHeader->sLibraryPath, ( strlen( DirEntry.sFileName ) + 1 ), FILENAME_SIZE ) ); //allocate memory for the files name @@ -347,7 +347,7 @@ BOOLEAN InitializeLibrary( STR pLibraryName, LibraryHeaderStruct *pLibHeader, BO //allocate memory for the library path // if( strlen( LibFileHeader.sPathToLibrary ) == 0 ) { -// FastDebugMsg( String("The %s library file does not contain a path. Use 'n' argument to name the library when you create it\n", LibFileHeader.sLibName ) ); +// FastDebugMsg( String("The %s library file does not contain a path. Use 'n' argument to name the library when you create it\n", LibFileHeader.sLibName ) ); // Assert( 0 ); } @@ -474,9 +474,9 @@ BOOLEAN CheckIfFileExistInLibrary( STR pFileName ) //************************************************************************ // -// This function finds out if the file CAN be in a library. It determines +// This function finds out if the file CAN be in a library. It determines // if the library that the file MAY be in is open. -// ( eg. File is Laptop\Test.sti, if the Laptop\ library is open, it returns true +// ( eg. File is Laptop\Test.sti, if the Laptop\ library is open, it returns true // //************************************************************************ INT16 GetLibraryIDFromFileName( STR pFileName ) @@ -522,7 +522,7 @@ INT16 sLoop1, sBestMatch=-1; //************************************************************************ // // GetFileHeaderFromLibrary() performsperforms a binary search of the -// library. It adds the libraries path to the file in the +// library. It adds the libraries path to the file in the // library and then string compared that to the name that we are // searching for. // @@ -538,20 +538,20 @@ BOOLEAN GetFileHeaderFromLibrary( INT16 sLibraryID, STR pstrFileName, FileHeader gsCurrentLibrary = sLibraryID; - /* try to find the filename using a binary search algorithm: */ - ppFileHeader = (FileHeaderStruct **) bsearch( &sFileNameWithPath, (FileHeaderStruct *) gFileDataBase.pLibraries[ sLibraryID ].pFileHeader, gFileDataBase.pLibraries[ sLibraryID ].usNumberOfEntries, + /* try to find the filename using a binary search algorithm: */ + ppFileHeader = (FileHeaderStruct **) bsearch( &sFileNameWithPath, (FileHeaderStruct *) gFileDataBase.pLibraries[ sLibraryID ].pFileHeader, gFileDataBase.pLibraries[ sLibraryID ].usNumberOfEntries, sizeof( FileHeaderStruct ), (int (*)(const void*, const void*))CompareFileNames ); - if( ppFileHeader ) - { + if( ppFileHeader ) + { *pFileHeader = ( FileHeaderStruct * ) ppFileHeader; return( TRUE ); - } - else - { + } + else + { pFileHeader = NULL; return( FALSE ); - } + } } @@ -573,8 +573,8 @@ INT CompareFileNames( CHAR8 *arg1[], FileHeaderStruct **arg2 ) sprintf( sFileNameWithPath, "%s%s", gFileDataBase.pLibraries[ gsCurrentLibrary ].sLibraryPath, TempFileHeader->pFileName ); - /* Compare all of both strings: */ - return _stricmp( sSearchKey, sFileNameWithPath ); + /* Compare all of both strings: */ + return _stricmp( sSearchKey, sFileNameWithPath ); } @@ -584,7 +584,6 @@ void AddSlashToPath( STR pName ) { UINT32 uiLoop, uiCounter; BOOLEAN fDone = FALSE; - BOOLEAN fFound = FALSE; CHAR8 sNewName[ FILENAME_SIZE ]; //find out if there is a '\' in the file name @@ -612,7 +611,7 @@ void AddSlashToPath( STR pName ) //************************************************************************ // -// This function will see if a file is in a library. If it is, the file will be opened and a file +// This function will see if a file is in a library. If it is, the file will be opened and a file // handle will be created for it. // //************************************************************************ @@ -639,8 +638,8 @@ HWFILE OpenFileFromLibrary( STR pName ) if( gFileDataBase.pLibraries[ sLibraryID ].uiIdOfOtherFileAlreadyOpenedLibrary != 0 ) { // Temp removed -// FastDebugMsg(String("\n*******\nOpenFileFromLibrary(): Warning!: Trying to load file '%s' from the library '%s' which already has a file open\n", pName, gGameLibaries[ sLibraryID ].sLibraryName ) ); -// FastDebugMsg(String("\n*******\nOpenFileFromLibrary(): Warning!: Trying to load file '%s' from the library '%s' which already has a file open ( file open is '%s')\n", pName, gGameLibaries[ sLibraryID ].sLibraryName, gFileDataBase.pLibraries[ sLibraryID ].pOpenFiles[ gFileDataBase.pLibraries[ sLibraryID ].uiIdOfOtherFileAlreadyOpenedLibrary ].pFileHeader->pFileName ) ); +// FastDebugMsg(String("\n*******\nOpenFileFromLibrary(): Warning!: Trying to load file '%s' from the library '%s' which already has a file open\n", pName, gGameLibaries[ sLibraryID ].sLibraryName ) ); +// FastDebugMsg(String("\n*******\nOpenFileFromLibrary(): Warning!: Trying to load file '%s' from the library '%s' which already has a file open ( file open is '%s')\n", pName, gGameLibaries[ sLibraryID ].sLibraryName, gFileDataBase.pLibraries[ sLibraryID ].pOpenFiles[ gFileDataBase.pLibraries[ sLibraryID ].uiIdOfOtherFileAlreadyOpenedLibrary ].pFileHeader->pFileName ) ); } //check if the file is already open @@ -660,7 +659,7 @@ HWFILE OpenFileFromLibrary( STR pName ) //reallocate more space for the array pOpenFiles = (FileOpenStruct *) MemRealloc( gFileDataBase.pLibraries[ sLibraryID ].pOpenFiles, - gFileDataBase.pLibraries[ sLibraryID ].iSizeOfOpenFileArray + NUM_FILES_TO_ADD_AT_A_TIME ); + gFileDataBase.pLibraries[ sLibraryID ].iSizeOfOpenFileArray + NUM_FILES_TO_ADD_AT_A_TIME ); if( !pOpenFiles ) return( 0 ); @@ -875,7 +874,7 @@ BOOLEAN LibraryFileSeek( INT16 sLibraryID, UINT32 uiFileNum, UINT32 uiDistance, //************************************************************************ // // OpenLibrary() Opens a library from the 'array' of library names -// that was passd in at game initialization. Pass in an enum for the +// that was passd in at game initialization. Pass in an enum for the // library. // //************************************************************************ @@ -910,7 +909,7 @@ BOOLEAN CloseLibrary( INT16 sLibraryID ) return( FALSE ); #ifdef JA2TESTVERSION - FastDebugMsg( String("ShutDownFileDatabase( ): %d bytes of ram used for the Library #%3d, path '%s', in the File Database System\n", gFileDataBase.pLibraries[ sLibraryID ].uiTotalMemoryAllocatedForLibrary, sLibraryID, gFileDataBase.pLibraries[ sLibraryID ].sLibraryPath )); + FastDebugMsg( String("ShutDownFileDatabase( ): %d bytes of ram used for the Library #%3d, path '%s', in the File Database System\n", gFileDataBase.pLibraries[ sLibraryID ].uiTotalMemoryAllocatedForLibrary, sLibraryID, gFileDataBase.pLibraries[ sLibraryID ].sLibraryPath )); gFileDataBase.pLibraries[ sLibraryID ].uiTotalMemoryAllocatedForLibrary = 0; #endif @@ -922,10 +921,10 @@ BOOLEAN CloseLibrary( INT16 sLibraryID ) { if( CheckIfFileIsAlreadyOpen( gFileDataBase.pLibraries[ sLibraryID ].pFileHeader[ uiLoop1 ].pFileName, sLibraryID ) ) { - FastDebugMsg( String("CloseLibrary(): ERROR: %s library file id still exists, wasnt closed, closing now.", gFileDataBase.pLibraries[ sLibraryID ].pFileHeader[ uiLoop1 ].pFileName ) ); + FastDebugMsg( String("CloseLibrary(): ERROR: %s library file id still exists, wasnt closed, closing now.", gFileDataBase.pLibraries[ sLibraryID ].pFileHeader[ uiLoop1 ].pFileName ) ); CloseLibraryFile( sLibraryID, uiLoop1 ); - // Removed because the memory gets freed in the next for loop. Would only enter here if files were still open + // Removed because the memory gets freed in the next for loop. Would only enter here if files were still open // gFileDataBase.pLibraries[ sLibraryID ].pFileHeader[ uiLoop1 ].pFileName = NULL; } } @@ -1023,11 +1022,9 @@ BOOLEAN CheckIfFileIsAlreadyOpen( STR pFileName, INT16 sLibraryID ) BOOLEAN GetLibraryFileTime( INT16 sLibraryID, UINT32 uiFileNum, SGP_FILETIME *pLastWriteTime ) { - UINT16 usNumEntries=0; UINT32 uiNumBytesRead; DIRENTRY *pDirEntry; LIBHEADER LibFileHeader; - BOOLEAN fDone = FALSE; // UINT32 cnt; INT32 iFilePos=0; @@ -1077,15 +1074,15 @@ BOOLEAN GetLibraryFileTime( INT16 sLibraryID, UINT32 uiFileNum, SGP_FILETIME *pL - /* try to find the filename using a binary search algorithm: */ - ppDirEntry = (DIRENTRY **) bsearch( gFileDataBase.pLibraries[ sLibraryID ].pOpenFiles[ uiFileNum ].pFileHeader->pFileName, + /* try to find the filename using a binary search algorithm: */ + ppDirEntry = (DIRENTRY **) bsearch( gFileDataBase.pLibraries[ sLibraryID ].pOpenFiles[ uiFileNum ].pFileHeader->pFileName, (DIRENTRY *) pAllEntries, LibFileHeader.iEntries, sizeof( DIRENTRY ), (int (*)(const void*, const void*))CompareDirEntryFileNames ); - if( ppDirEntry ) + if( ppDirEntry ) pDirEntry = ( DIRENTRY * ) ppDirEntry; - else + else return( FALSE ); //Copy the dir entry time over to the passed in time @@ -1118,7 +1115,7 @@ INT32 CompareDirEntryFileNames( CHAR8 *arg1[], DIRENTRY **arg2 ) sprintf( sFileNameWithPath, "%s", TempDirEntry->sFileName ); - /* Compare all of both strings: */ - return _stricmp( sSearchKey, sFileNameWithPath ); + /* Compare all of both strings: */ + return _stricmp( sSearchKey, sFileNameWithPath ); } diff --git a/Standard Gaming Platform/LibraryDataBase.h b/Standard Gaming Platform/LibraryDataBase.h index 1bd83c9f..ed0f9452 100644 --- a/Standard Gaming Platform/LibraryDataBase.h +++ b/Standard Gaming Platform/LibraryDataBase.h @@ -87,8 +87,8 @@ typedef struct HANDLE hLibraryHandle; UINT16 usNumberOfEntries; BOOLEAN fLibraryOpen; -// BOOLEAN fAnotherFileAlreadyOpenedLibrary; //this variable is set when a file is opened from the library and reset when the file is close. No 2 files can have access to the library at 1 time. - UINT32 uiIdOfOtherFileAlreadyOpenedLibrary; //this variable is set when a file is opened from the library and reset when the file is close. No 2 files can have access to the library at 1 time. +// BOOLEAN fAnotherFileAlreadyOpenedLibrary; //this variable is set when a file is opened from the library and reset when the file is close. No 2 files can have access to the library at 1 time. + UINT32 uiIdOfOtherFileAlreadyOpenedLibrary; //this variable is set when a file is opened from the library and reset when the file is close. No 2 files can have access to the library at 1 time. INT32 iNumFilesOpen; INT32 iSizeOfOpenFileArray; FileHeaderStruct *pFileHeader; @@ -132,7 +132,7 @@ typedef struct //************************************************************************* // -// NOTE! The following structs are also used by the datalib98 utility +// NOTE! The following structs are also used by the datalib98 utility // //************************************************************************* diff --git a/Standard Gaming Platform/MemMan.cpp b/Standard Gaming Platform/MemMan.cpp index 9ffd8888..f53be2e6 100644 --- a/Standard Gaming Platform/MemMan.cpp +++ b/Standard Gaming Platform/MemMan.cpp @@ -7,8 +7,8 @@ // Modification history : // // 11sep96:HJH - Creation -// 29may97:ARM - Fix & improve MemDebugCounter handling, logging of -// MemAlloc/MemFree, and reporting of any errors +// 29may97:ARM - Fix & improve MemDebugCounter handling, logging of +// MemAlloc/MemFree, and reporting of any errors // //************************************************************************** @@ -49,7 +49,7 @@ #ifdef JA2 #include "mousesystem.h" #include "MessageBoxScreen.h" -STR16 gzJA2ScreenNames[] = +STR16 gzJA2ScreenNames[] = { L"EDIT_SCREEN", L"SAVING_SCREEN", @@ -92,8 +92,8 @@ STR16 gzJA2ScreenNames[] = UINT32 uiSize; }MEMORY_NODE; - MEMORY_NODE *gpMemoryHead = NULL; - MEMORY_NODE *gpMemoryTail = NULL; + MEMORY_NODE *gpMemoryHead = NULL; + MEMORY_NODE *gpMemoryTail = NULL; UINT32 guiMemoryNodes = 0; UINT32 guiTotalMemoryNodes = 0; #endif @@ -101,8 +101,8 @@ STR16 gzJA2ScreenNames[] = static BOOLEAN gfMemDebug = TRUE; // debug variable for total memory currently allocated UINT32 guiMemTotal = 0; -UINT32 guiMemAlloced = 0; -UINT32 guiMemFreed = 0; +UINT32 guiMemAlloced = 0; +UINT32 guiMemFreed = 0; UINT32 MemDebugCounter = 0; BOOLEAN fMemManagerInit = FALSE; @@ -124,13 +124,13 @@ void DebugPrint( void ); // // MemInit // -// +// // // Parameter List : // Return Value : // Modification history : // -// 12sep96:HJH -> modified for use by Wizardry +// 12sep96:HJH ->modified for use by Wizardry // //************************************************************************** @@ -164,7 +164,7 @@ BOOLEAN InitializeMemoryManager( void ) // Return Value : // Modification history : // -// 12sep96:HJH -> modified for use by Wizardry +// 12sep96:HJH ->modified for use by Wizardry // //************************************************************************** @@ -183,7 +183,7 @@ void MemDebug( BOOLEAN f ) // Return Value : // Modification history : // -// 12sep96:HJH -> modified for use by Wizardry +// 12sep96:HJH ->modified for use by Wizardry // //************************************************************************** @@ -196,7 +196,7 @@ void ShutdownMemoryManager( void ) DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("***** WARNING - WARNING - WARNING *****")); DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("***** WARNING - WARNING - WARNING *****")); DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String(" ")); - DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String(" >>>>> MEMORY LEAK DETECTED!!! <<<<< ")); + DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String(" >>>>> MEMORY LEAK DETECTED!!! <<<<< ")); DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("%d memory blocks still allocated", MemDebugCounter )); DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("%d bytes memory total STILL allocated", guiMemTotal )); DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("%d bytes memory total was allocated", guiMemAlloced)); @@ -217,7 +217,7 @@ void ShutdownMemoryManager( void ) { fprintf( fp, "\n\n" ); fprintf( fp, ">>>>> MEMORY LEAK DETECTED!!! <<<<<\n" ); - fprintf( fp, " %d bytes memory total was allocated\n", guiMemAlloced ); + fprintf( fp, " %d bytes memory total was allocated\n", guiMemAlloced ); fprintf( fp, "- %d bytes memory total was freed\n", guiMemFreed ); fprintf( fp, "_______________________________________________\n" ); fprintf( fp, "%d bytes memory total STILL allocated\n", guiMemTotal ); @@ -237,7 +237,7 @@ void ShutdownMemoryManager( void ) fMemManagerInit = FALSE; } - + #ifdef _DEBUG PTR MemAllocReal( UINT32 uiSize, const STR8 pcFile, INT32 iLine ) @@ -250,23 +250,23 @@ PTR MemAllocReal( UINT32 uiSize, const STR8 pcFile, INT32 iLine ) } if ( !fMemManagerInit ) - DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemAlloc: Warning -- Memory manager not initialized -- Line %d in %s", iLine, pcFile) ); + DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemAlloc: Warning -- Memory manager not initialized -- Line %d in %s", iLine, pcFile) ); ptr = _malloc_dbg( uiSize, _NORMAL_BLOCK, pcFile, iLine ); - if (ptr != NULL) - { - guiMemTotal += uiSize; + if (ptr != NULL) + { + guiMemTotal += uiSize; guiMemAlloced += uiSize; MemDebugCounter++; - } - else + } + else { - DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemAlloc failed: %d bytes (line %d file %s)", uiSize, iLine, pcFile) ); + DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemAlloc failed: %d bytes (line %d file %s)", uiSize, iLine, pcFile) ); } #ifdef DEBUG_MEM_LEAKS - DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_1, String("MemAlloc %p: %d bytes (line %d file %s)", ptr, uiSize, iLine, pcFile) ); + DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_1, String("MemAlloc %p: %d bytes (line %d file %s)", ptr, uiSize, iLine, pcFile) ); #endif return( ptr ); @@ -278,28 +278,28 @@ void MemFreeReal( PTR ptr, const STR8 pcFile, INT32 iLine ) UINT32 uiSize; if ( !fMemManagerInit ) - DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemFree: Warning -- Memory manager not initialized -- Line %d in %s", iLine, pcFile) ); + DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemFree: Warning -- Memory manager not initialized -- Line %d in %s", iLine, pcFile) ); - if (ptr != NULL) - { + if (ptr != NULL) + { uiSize = _msize(ptr); guiMemTotal -= uiSize; guiMemFreed += uiSize; _free_dbg( ptr, _NORMAL_BLOCK ); #ifdef DEBUG_MEM_LEAKS - DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_1, String("MemFree %p: %d bytes (line %d file %s)", ptr, uiSize, iLine, pcFile) ); + DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_1, String("MemFree %p: %d bytes (line %d file %s)", ptr, uiSize, iLine, pcFile) ); #endif - } - else - { - DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemFree ERROR: NULL ptr received (line %d file %s)", iLine, pcFile) ); - } + } + else + { + DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemFree ERROR: NULL ptr received (line %d file %s)", iLine, pcFile) ); + } - // count even a NULL ptr as a MemFree, not because it's really a memory leak, but because it is still an error of some - // sort (nobody should ever be freeing NULL pointers), and this will help in tracking it down if the above DbgMessage - // is not noticed. - MemDebugCounter--; + // count even a NULL ptr as a MemFree, not because it's really a memory leak, but because it is still an error of some + // sort (nobody should ever be freeing NULL pointers), and this will help in tracking it down if the above DbgMessage + // is not noticed. + MemDebugCounter--; } @@ -310,21 +310,21 @@ PTR MemReallocReal( PTR ptr, UINT32 uiSize, const STR8 pcFile, INT32 iLine ) if ( !fMemManagerInit ) - DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemRealloc: Warning -- Memory manager not initialized -- Line %d in %s", iLine, pcFile) ); + DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemRealloc: Warning -- Memory manager not initialized -- Line %d in %s", iLine, pcFile) ); - if(ptr != NULL) + if(ptr != NULL) { uiOldSize = _msize(ptr); guiMemTotal -= uiOldSize; guiMemFreed += uiOldSize; - MemDebugCounter--; + MemDebugCounter--; } // Note that the ptr changes to ptrNew... ptrNew = _realloc_dbg( ptr, uiSize, _NORMAL_BLOCK, pcFile, iLine ); - if (ptrNew == NULL) - { - DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemReAlloc failed: ptr %d, %d -> %d bytes (line %d file %s)", ptr, uiOldSize, uiSize, iLine, pcFile) ); + if (ptrNew == NULL) + { + DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemReAlloc failed: ptr %d, %d->%d bytes (line %d file %s)", ptr, uiOldSize, uiSize, iLine, pcFile) ); if ( uiSize != 0 ) { // ptr is left untouched, so undo the math above @@ -332,17 +332,17 @@ PTR MemReallocReal( PTR ptr, UINT32 uiSize, const STR8 pcFile, INT32 iLine ) guiMemFreed -= uiOldSize; MemDebugCounter++; } - } - else - { + } + else + { #ifdef DEBUG_MEM_LEAKS - DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_1, String("MemRealloc %p: Resizing %d bytes to %d bytes (line %d file %s) - New ptr %p", ptr, uiOldSize, uiSize, iLine, pcFile, ptrNew ) ); + DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_1, String("MemRealloc %p: Resizing %d bytes to %d bytes (line %d file %s) - New ptr %p", ptr, uiOldSize, uiSize, iLine, pcFile, ptrNew ) ); #endif - guiMemTotal += uiSize; + guiMemTotal += uiSize; guiMemAlloced += uiSize; MemDebugCounter++; - } + } return( ptrNew ); } @@ -355,26 +355,26 @@ PTR MemAllocLocked( UINT32 uiSize ) PTR ptr; if ( !fMemManagerInit ) - DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemAllocLocked: Warning -- Memory manager not initialized!!! ") ); + DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemAllocLocked: Warning -- Memory manager not initialized!!! ") ); + - ptr = VirtualAlloc( NULL, uiSize, MEM_COMMIT, PAGE_READWRITE ); if ( ptr ) { - VirtualLock( ptr, uiSize ); + VirtualLock( ptr, uiSize ); - guiMemTotal += uiSize; + guiMemTotal += uiSize; guiMemAlloced += uiSize; MemDebugCounter++; - } - else + } + else { - DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemAllocLocked failed: %d bytes", uiSize) ); + DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemAllocLocked failed: %d bytes", uiSize) ); } #ifdef DEBUG_MEM_LEAKS - DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_1, String("MemAllocLocked %p: %d bytes", ptr, uiSize) ); + DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_1, String("MemAllocLocked %p: %d bytes", ptr, uiSize) ); #endif return( ptr ); @@ -384,29 +384,29 @@ PTR MemAllocLocked( UINT32 uiSize ) void MemFreeLocked( PTR ptr, UINT32 uiSize ) { if ( !fMemManagerInit ) - DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemFreeLocked: Warning -- Memory manager not initialized!!! ") ); + DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemFreeLocked: Warning -- Memory manager not initialized!!! ") ); - if (ptr != NULL) - { - VirtualUnlock( ptr, uiSize ); - VirtualFree( ptr, uiSize, MEM_RELEASE ); + if (ptr != NULL) + { + VirtualUnlock( ptr, uiSize ); + VirtualFree( ptr, uiSize, MEM_RELEASE ); guiMemTotal -= uiSize; guiMemFreed += uiSize; - } - else - { - DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemFreeLocked ERROR: NULL ptr received, size %d", uiSize) ); - } + } + else + { + DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_0, String("MemFreeLocked ERROR: NULL ptr received, size %d", uiSize) ); + } - // count even a NULL ptr as a MemFree, not because it's really a memory leak, but because it is still an error of some - // sort (nobody should ever be freeing NULL pointers), and this will help in tracking it down if the above DbgMessage - // is not noticed. - MemDebugCounter--; + // count even a NULL ptr as a MemFree, not because it's really a memory leak, but because it is still an error of some + // sort (nobody should ever be freeing NULL pointers), and this will help in tracking it down if the above DbgMessage + // is not noticed. + MemDebugCounter--; #ifdef DEBUG_MEM_LEAKS - DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_1, String("MemFreeLocked %p", ptr) ); + DbgMessage( TOPIC_MEMORY_MANAGER, DBG_LEVEL_1, String("MemFreeLocked %p", ptr) ); #endif } @@ -415,13 +415,13 @@ void MemFreeLocked( PTR ptr, UINT32 uiSize ) // // MemGetFree // -// +// // // Parameter List : // Return Value : // Modification history : // -// ??sep96:HJH -> modified for use by Wizardry +// ??sep96:HJH ->modified for use by Wizardry // //************************************************************************** @@ -440,13 +440,13 @@ UINT32 MemGetFree( void ) // // MemGetTotalSystem // -// +// // // Parameter List : // Return Value : // Modification history : // -// May98:HJH -> Carter +// May98:HJH ->Carter // //************************************************************************** @@ -465,13 +465,13 @@ UINT32 MemGetTotalSystem( void ) // // MemCheckPool // -// +// // // Parameter List : // Return Value : // Modification history : // -// 23sep96:HJH -> modified for use by Wizardry +// 23sep96:HJH ->modified for use by Wizardry // //************************************************************************** @@ -503,7 +503,7 @@ PTR MemAllocXDebug( UINT32 size, const STR8 szCodeString, INT32 iLineNum, void * return NULL; } - if( !pSpecial ) + if( !pSpecial ) { ptr = malloc( size ); } @@ -512,8 +512,8 @@ PTR MemAllocXDebug( UINT32 size, const STR8 szCodeString, INT32 iLineNum, void * ptr = pSpecial; } - if( ptr ) - { + if( ptr ) + { // Set into video object list if( gpMemoryHead ) { //Add node after tail @@ -556,8 +556,8 @@ void MemFreeXDebug( PTR ptr, const STR8 szCodeString, INT32 iLineNum, void *pSpe { MEMORY_NODE *curr; - if( ptr ) - { + if( ptr ) + { curr = gpMemoryHead; while( curr ) { @@ -586,7 +586,7 @@ void MemFreeXDebug( PTR ptr, const STR8 szCodeString, INT32 iLineNum, void *pSpe { //Make the next node point to the prev curr->prev->next = curr->next; } - //The node is now detached. Now deallocate it. + //The node is now detached. Now deallocate it. free( curr ); curr = NULL; guiMemoryNodes--; @@ -594,7 +594,7 @@ void MemFreeXDebug( PTR ptr, const STR8 szCodeString, INT32 iLineNum, void *pSpe } curr = curr->next; } - } + } } PTR MemReallocXDebug( PTR ptr, UINT32 size, const STR8 szCodeString, INT32 iLineNum, void *pSpecial ) @@ -679,7 +679,7 @@ void DumpMemoryInfoIntoFile( UINT8 *filename, BOOLEAN fAppend ) if( !guiMemoryNodes ) { - fprintf( fp, "NO MEMORY LEAKS DETECTED! CONGRATULATIONS!\n" ); + fprintf( fp, "NO MEMORY LEAKS DETECTED! CONGRATULATIONS!\n" ); fclose( fp ); return; } @@ -750,4 +750,4 @@ BOOLEAN _AddAndRecordMemAlloc( UINT32 size, UINT32 uiLineNum, UINT8 *pSourceFile return 0; } -#endif \ No newline at end of file +#endif diff --git a/Standard Gaming Platform/MemMan.h b/Standard Gaming Platform/MemMan.h index b9b57282..9460986a 100644 --- a/Standard Gaming Platform/MemMan.h +++ b/Standard Gaming Platform/MemMan.h @@ -55,9 +55,9 @@ extern void ShutdownMemoryManager( void ); // Creates and adds a video object to list #ifdef EXTREME_MEMORY_DEBUGGING - //This is the most effective way to debug memory leaks. Each memory leak will be recorded in a linked + //This is the most effective way to debug memory leaks. Each memory leak will be recorded in a linked //list containing a string referring to the location in code the memory was allocated in addition to - //the number of occurrences. The shutdown code will report all unhandled memory with exact location allocated. + //the number of occurrences. The shutdown code will report all unhandled memory with exact location allocated. void DumpMemoryInfoIntoFile( UINT8 *filename, BOOLEAN fAppend ); BOOLEAN _AddAndRecordMemAlloc( UINT32 size, UINT32 uiLineNum, UINT8 *pSourceFile ); #define MemAlloc( size ) MemAllocXDebug( (size), __FILE__, __LINE__, NULL ) @@ -69,13 +69,13 @@ extern void ShutdownMemoryManager( void ); #else #ifdef _DEBUG #include - //This is another debug feature. Not as sophistocated, but definately not the pig the extreme system is. + //This is another debug feature. Not as sophistocated, but definately not the pig the extreme system is. //This system reports all memory allocations/deallocations in the debug output. #define MemAlloc( size ) MemAllocReal( (size), __FILE__, __LINE__ ) #define MemFree( ptr ) MemFreeReal( (ptr), __FILE__, __LINE__ ) #define MemRealloc( ptr, size ) MemReallocReal( (ptr), (size), __FILE__, __LINE__ ) extern PTR MemAllocReal( UINT32 size, const STR8 , INT32 ); - extern void MemFreeReal( PTR ptr, const STR8 , INT32 ); + extern void MemFreeReal( PTR ptr, const STR8 , INT32 ); extern PTR MemReallocReal( PTR ptr, UINT32 size, const STR8 , INT32 ); //void* ::operator new( size_t sz, const char* file, int line); //void* ::operator new[]( size_t sz, const char *file, int line); @@ -92,7 +92,7 @@ extern void ShutdownMemoryManager( void ); -extern PTR MemAllocLocked( UINT32 size ); +extern PTR MemAllocLocked( UINT32 size ); extern void MemFreeLocked( PTR, UINT32 size ); // get total free on the system at this moment diff --git a/Standard Gaming Platform/Mss-old.h b/Standard Gaming Platform/Mss-old.h index a68eaf22..ff0282fb 100644 --- a/Standard Gaming Platform/Mss-old.h +++ b/Standard Gaming Platform/Mss-old.h @@ -1,32 +1,32 @@ //############################################################################ -//## ## -//## Miles Sound System ## -//## ## -//## MSS.H: Miles Sound System main header file ## -//## ## -//## Version 1.00 of 15-Feb-95: Initial, derived from AIL.H V3.02 ## -//## 1.01 of 19-Jun-95: Added various functions for V3.03 release ## -//## 1.02 of 22-Nov-95: C++ typedef problem fixed, declspecs added ## -//## 1.03 of 15-Feb-96: Changes for 16 bit callbacks and multiple ## -//## 16 bit DLL loads (JKR) ## -//## 1.04 of 2-Nov-97: Changes made to handle DLS in future ## -//## versions ## -//## 1.05 of 1-Jan-98: Massive changes for version 4.0 ## -//## 1.06 of 17-Sep-98: Massive changes for version 5.0 ## -//## 1.07 of 2-Feb-99: Changes for new input API ## -//## 1.08 of 8-Feb-99: Changes for new filter helper functions ## -//## ## -//## Author: John Miles ## -//## ## +//## ## +//## Miles Sound System ## +//## ## +//## MSS.H: Miles Sound System main header file ## +//## ## +//## Version 1.00 of 15-Feb-95: Initial, derived from AIL.H V3.02 ## +//## 1.01 of 19-Jun-95: Added various functions for V3.03 release ## +//## 1.02 of 22-Nov-95: C++ typedef problem fixed, declspecs added ## +//## 1.03 of 15-Feb-96: Changes for 16 bit callbacks and multiple ## +//## 16 bit DLL loads (JKR) ## +//## 1.04 of 2-Nov-97: Changes made to handle DLS in future ## +//## versions ## +//## 1.05 of 1-Jan-98: Massive changes for version 4.0 ## +//## 1.06 of 17-Sep-98: Massive changes for version 5.0 ## +//## 1.07 of 2-Feb-99: Changes for new input API ## +//## 1.08 of 8-Feb-99: Changes for new filter helper functions ## +//## ## +//## Author: John Miles ## +//## ## //############################################################################ -//## ## -//## Contact RAD Game Tools at 425-893-4300 for technical support. ## -//## ## +//## ## +//## Contact RAD Game Tools at 425-893-4300 for technical support. ## +//## ## //############################################################################ #ifndef MSS_VERSION -#define MSS_VERSION "5.0q" +#define MSS_VERSION "5.0q" #define MSS_VERSION_DATE "06-Aug-99" #define MSS_COPYRIGHT "Copyright (C) 1991-99 RAD Game Tools, Inc." @@ -72,57 +72,57 @@ #define IS_32 #else #ifdef _WIN32 - #define IS_WINDOWS - #define IS_WIN32 - #define IS_32 + #define IS_WINDOWS + #define IS_WIN32 + #define IS_32 #else - #ifdef WIN32 - #define IS_WINDOWS - #define IS_WIN32 - #define IS_32 - #else - #ifdef __NT__ - #define IS_WINDOWS - #define IS_WIN32 - #define IS_32 - #else - #ifdef __WIN32__ - #define IS_WINDOWS - #define IS_WIN32 - #define IS_32 - #else - #ifdef _WINDOWS - #define IS_WINDOWS - #define IS_WIN16 - #define IS_16 - #else - #ifdef _WINDLL - #define IS_WINDOWS - #define IS_WIN16 - #define IS_16 - #else - #ifdef WINDOWS - #define IS_WINDOWS - #define IS_WIN16 - #define IS_16 - #else - #ifdef __WINDOWS__ - #define IS_WINDOWS - #define IS_WIN16 - #define IS_16 - #else - #ifdef _Windows - #define IS_WINDOWS - #define IS_WIN16 - #define IS_16 - #endif - #endif - #endif - #endif - #endif - #endif - #endif - #endif + #ifdef WIN32 + #define IS_WINDOWS + #define IS_WIN32 + #define IS_32 + #else + #ifdef __NT__ + #define IS_WINDOWS + #define IS_WIN32 + #define IS_32 + #else + #ifdef __WIN32__ + #define IS_WINDOWS + #define IS_WIN32 + #define IS_32 + #else + #ifdef _WINDOWS + #define IS_WINDOWS + #define IS_WIN16 + #define IS_16 + #else + #ifdef _WINDLL + #define IS_WINDOWS + #define IS_WIN16 + #define IS_16 + #else + #ifdef WINDOWS + #define IS_WINDOWS + #define IS_WIN16 + #define IS_16 + #else + #ifdef __WINDOWS__ + #define IS_WINDOWS + #define IS_WIN16 + #define IS_16 + #else + #ifdef _Windows + #define IS_WINDOWS + #define IS_WIN16 + #define IS_16 + #endif + #endif + #endif + #endif + #endif + #endif + #endif + #endif #endif #endif @@ -154,7 +154,7 @@ extern "C" { #define FOURCC U32 -#define MAKEFOURCC(ch0, ch1, ch2, ch3) \ +#define MAKEFOURCC(ch0, ch1, ch2, ch3) \ ((U32)(U8)(ch0) | ((U32)(U8)(ch1) << 8) | \ ((U32)(U8)(ch2) << 16) | ((U32)(U8)(ch3) << 24 )) @@ -194,15 +194,15 @@ extern "C" { #define AILEXPORT WINAPI #ifdef BUILD_MSS - #define DXDEC __declspec(dllexport) - #define DXDEF __declspec(dllexport) + #define DXDEC __declspec(dllexport) + #define DXDEF __declspec(dllexport) #else - #ifdef __BORLANDC__ - #define DXDEC extern - #else - #define DXDEC __declspec(dllimport) - #endif + #ifdef __BORLANDC__ + #define DXDEC extern + #else + #define DXDEC __declspec(dllimport) + #endif #endif @@ -235,78 +235,78 @@ typedef LPVOID AILLPDIRECTSOUNDBUFFER; // Misc. constant definitions // -#define MAX_DRVRS 16 // Max. # of simultaneous drivers -#define MAX_TIMERS 16 // Max. # of simultaneous timers -#define MAX_NOTES 32 // Max # of notes "on" -#define FOR_NEST 4 // # of nested XMIDI FOR loops -#define NUM_CHANS 16 // # of possible MIDI channels -#define MAX_W_VOICES 16 // Max virtual wave synth voice cnt -#define MAX_W_ENTRIES 512 // 512 wave library entries max. +#define MAX_DRVRS 16 // Max. # of simultaneous drivers +#define MAX_TIMERS 16 // Max. # of simultaneous timers +#define MAX_NOTES 32 // Max # of notes "on" +#define FOR_NEST 4 // # of nested XMIDI FOR loops +#define NUM_CHANS 16 // # of possible MIDI channels +#define MAX_W_VOICES 16 // Max virtual wave synth voice cnt +#define MAX_W_ENTRIES 512 // 512 wave library entries max. -#define MIN_CHAN ( 1-1) // Min channel recognized (0-based) -#define MAX_CHAN (16-1) // Max channel recognized -#define MIN_LOCK_CHAN ( 2-1) // Min channel available for locking -#define MAX_LOCK_CHAN ( 9-1) // Max channel available for locking -#define PERCUSS_CHAN (10-1) // Percussion channel (no locking) +#define MIN_CHAN ( 1-1) // Min channel recognized (0-based) +#define MAX_CHAN (16-1) // Max channel recognized +#define MIN_LOCK_CHAN ( 2-1) // Min channel available for locking +#define MAX_LOCK_CHAN ( 9-1) // Max channel available for locking +#define PERCUSS_CHAN (10-1) // Percussion channel (no locking) -#define AIL_MAX_FILE_HEADER_SIZE 5120 // AIL_set_named_sample_file() requires at least 4K - // of data or the entire file image, whichever is less, - // to determine sample format -#define DIG_F_16BITS_MASK 1 -#define DIG_F_STEREO_MASK 2 -#define DIG_F_ADPCM_MASK 4 +#define AIL_MAX_FILE_HEADER_SIZE 5120 // AIL_set_named_sample_file() requires at least 4K + // of data or the entire file image, whichever is less, + // to determine sample format +#define DIG_F_16BITS_MASK 1 +#define DIG_F_STEREO_MASK 2 +#define DIG_F_ADPCM_MASK 4 -#define DIG_F_MONO_8 0 // PCM data formats -#define DIG_F_MONO_16 (DIG_F_16BITS_MASK) -#define DIG_F_STEREO_8 (DIG_F_STEREO_MASK) -#define DIG_F_STEREO_16 (DIG_F_STEREO_MASK|DIG_F_16BITS_MASK) -#define DIG_F_ADPCM_MONO_16 (DIG_F_ADPCM_MASK |DIG_F_16BITS_MASK) -#define DIG_F_ADPCM_STEREO_16 (DIG_F_ADPCM_MASK |DIG_F_16BITS_MASK|DIG_F_STEREO_MASK) -#define DIG_F_USING_ASI 16 +#define DIG_F_MONO_8 0 // PCM data formats +#define DIG_F_MONO_16 (DIG_F_16BITS_MASK) +#define DIG_F_STEREO_8 (DIG_F_STEREO_MASK) +#define DIG_F_STEREO_16 (DIG_F_STEREO_MASK|DIG_F_16BITS_MASK) +#define DIG_F_ADPCM_MONO_16 (DIG_F_ADPCM_MASK |DIG_F_16BITS_MASK) +#define DIG_F_ADPCM_STEREO_16 (DIG_F_ADPCM_MASK |DIG_F_16BITS_MASK|DIG_F_STEREO_MASK) +#define DIG_F_USING_ASI 16 -#define DIG_PCM_SIGN 0x0001 // (obsolete) -#define DIG_PCM_ORDER 0x0002 +#define DIG_PCM_SIGN 0x0001 // (obsolete) +#define DIG_PCM_ORDER 0x0002 -#define DIG_PCM_POLARITY 0x0004 // PCM flags used by driver hardware -#define DIG_PCM_SPLIT 0x0008 -#define DIG_BUFFER_SERVICE 0x0010 -#define DIG_DUAL_DMA 0x0020 +#define DIG_PCM_POLARITY 0x0004 // PCM flags used by driver hardware +#define DIG_PCM_SPLIT 0x0008 +#define DIG_BUFFER_SERVICE 0x0010 +#define DIG_DUAL_DMA 0x0020 #define DIG_RECORDING_SUPPORTED 0x8000 -#define WAVE_FORMAT_PCM 1 +#define WAVE_FORMAT_PCM 1 #define WAVE_FORMAT_IMA_ADPCM 0x0011 #ifdef IS_DOS -#define AIL3DIG 0 // .DIG driver -#define AIL3MDI 1 // .MDI driver +#define AIL3DIG 0 // .DIG driver +#define AIL3MDI 1 // .MDI driver -#define DIG_DETECT_8_BIT_ONLY 0x0001 // Detect 8-bit DMA only +#define DIG_DETECT_8_BIT_ONLY 0x0001 // Detect 8-bit DMA only #define DIG_DETECT_16_BIT_ONLY 0x0002 // Detect 16-bit DMA only #define DIG_DETECT_8_AND_16_BITS 0x0003 // Detect both 8- and 16-bit DMA -#define DRV_INIT 0x300 // Functions common to .MDI and .DIG -#define DRV_GET_INFO 0x301 // drivers -#define DRV_SERVE 0x302 -#define DRV_PARSE_ENV 0x303 -#define DRV_VERIFY_IO 0x304 -#define DRV_INIT_DEV 0x305 +#define DRV_INIT 0x300 // Functions common to .MDI and .DIG +#define DRV_GET_INFO 0x301 // drivers +#define DRV_SERVE 0x302 +#define DRV_PARSE_ENV 0x303 +#define DRV_VERIFY_IO 0x304 +#define DRV_INIT_DEV 0x305 #define DRV_SHUTDOWN_DEV 0x306 -#define DIG_HW_VOLUME 0x400 // .DIG driver functions +#define DIG_HW_VOLUME 0x400 // .DIG driver functions #define DIG_START_P_CMD 0x401 -#define DIG_STOP_P_REQ 0x402 +#define DIG_STOP_P_REQ 0x402 #define DIG_START_R_CMD 0x403 -#define DIG_STOP_R_REQ 0x404 -#define DIG_VSE 0x405 +#define DIG_STOP_R_REQ 0x404 +#define DIG_VSE 0x405 -#define MDI_HW_VOLUME 0x500 // .MDI driver functions +#define MDI_HW_VOLUME 0x500 // .MDI driver functions #define MDI_INIT_INS_MGR 0x501 -#define MDI_MIDI_XMIT 0x502 +#define MDI_MIDI_XMIT 0x502 #define MDI_INSTALL_T_SET 0x503 #define MDI_GET_T_STATUS 0x504 #define MDI_PROT_UNPROT_T 0x505 -#define MDI_VSE 0x506 +#define MDI_VSE 0x506 #else @@ -323,94 +323,94 @@ typedef LPVOID AILLPDIRECTSOUNDBUFFER; // Non-specific XMIDI/MIDI controllers and event types // -#define SYSEX_BYTE 105 -#define PB_RANGE 106 -#define CHAN_MUTE 107 -#define CALLBACK_PFX 108 -#define SEQ_BRANCH 109 -#define CHAN_LOCK 110 -#define CHAN_PROTECT 111 -#define VOICE_PROTECT 112 -#define TIMBRE_PROTECT 113 -#define PATCH_BANK_SEL 114 -#define INDIRECT_C_PFX 115 -#define FOR_LOOP 116 -#define NEXT_LOOP 117 -#define CLEAR_BEAT_BAR 118 -#define CALLBACK_TRIG 119 -#define SEQ_INDEX 120 +#define SYSEX_BYTE 105 +#define PB_RANGE 106 +#define CHAN_MUTE 107 +#define CALLBACK_PFX 108 +#define SEQ_BRANCH 109 +#define CHAN_LOCK 110 +#define CHAN_PROTECT 111 +#define VOICE_PROTECT 112 +#define TIMBRE_PROTECT 113 +#define PATCH_BANK_SEL 114 +#define INDIRECT_C_PFX 115 +#define FOR_LOOP 116 +#define NEXT_LOOP 117 +#define CLEAR_BEAT_BAR 118 +#define CALLBACK_TRIG 119 +#define SEQ_INDEX 120 -#define GM_BANK_MSB 0 -#define MODULATION 1 -#define DATA_MSB 6 -#define PART_VOLUME 7 -#define PANPOT 10 -#define EXPRESSION 11 -#define GM_BANK_LSB 32 -#define DATA_LSB 38 -#define SUSTAIN 64 -#define REVERB 91 -#define CHORUS 93 -#define RPN_LSB 100 -#define RPN_MSB 101 +#define GM_BANK_MSB 0 +#define MODULATION 1 +#define DATA_MSB 6 +#define PART_VOLUME 7 +#define PANPOT 10 +#define EXPRESSION 11 +#define GM_BANK_LSB 32 +#define DATA_LSB 38 +#define SUSTAIN 64 +#define REVERB 91 +#define CHORUS 93 +#define RPN_LSB 100 +#define RPN_MSB 101 #define RESET_ALL_CTRLS 121 -#define ALL_NOTES_OFF 123 +#define ALL_NOTES_OFF 123 -#define EV_NOTE_OFF 0x80 -#define EV_NOTE_ON 0x90 -#define EV_POLY_PRESS 0xa0 -#define EV_CONTROL 0xb0 -#define EV_PROGRAM 0xc0 -#define EV_CHAN_PRESS 0xd0 -#define EV_PITCH 0xe0 -#define EV_SYSEX 0xf0 -#define EV_ESC 0xf7 -#define EV_META 0xff +#define EV_NOTE_OFF 0x80 +#define EV_NOTE_ON 0x90 +#define EV_POLY_PRESS 0xa0 +#define EV_CONTROL 0xb0 +#define EV_PROGRAM 0xc0 +#define EV_CHAN_PRESS 0xd0 +#define EV_PITCH 0xe0 +#define EV_SYSEX 0xf0 +#define EV_ESC 0xf7 +#define EV_META 0xff -#define META_EOT 0x2f -#define META_TEMPO 0x51 -#define META_TIME_SIG 0x58 +#define META_EOT 0x2f +#define META_TEMPO 0x51 +#define META_TIME_SIG 0x58 // // SAMPLE.system_data[] usage // #define SSD_EOD_CALLBACK 0 // Application end-of-data callback if not NULL -#define VOC_BLK_PTR 1 // Pointer to current block -#define VOC_REP_BLK 2 // Pointer to beginning of repeat loop block -#define VOC_N_REPS 3 // # of iterations left in repeat loop -#define VOC_MARKER 4 // Marker to search for, or -1 if all +#define VOC_BLK_PTR 1 // Pointer to current block +#define VOC_REP_BLK 2 // Pointer to beginning of repeat loop block +#define VOC_N_REPS 3 // # of iterations left in repeat loop +#define VOC_MARKER 4 // Marker to search for, or -1 if all #define VOC_MARKER_FOUND 5 // Desired marker found if 1, else 0 -#define SSD_RELEASE 6 // Release sample handle upon termination if >0 +#define SSD_RELEASE 6 // Release sample handle upon termination if >0 #ifdef IS_WINDOWS #define SSD_EOD_CB_WIN32S 7 // Application end-of-data callback is in Win32s #else -#define SSD_TEMP 7 // Temporary storage location for general use +#define SSD_TEMP 7 // Temporary storage location for general use #endif // // Timer status values // -#define AILT_FREE 0 // Timer handle is free for allocation -#define AILT_STOPPED 1 // Timer is stopped -#define AILT_RUNNING 2 // Timer is running +#define AILT_FREE 0 // Timer handle is free for allocation +#define AILT_STOPPED 1 // Timer is stopped +#define AILT_RUNNING 2 // Timer is running // // SAMPLE.status flag values // -#define SMP_FREE 0x0001 // Sample is available for allocation +#define SMP_FREE 0x0001 // Sample is available for allocation -#define SMP_DONE 0x0002 // Sample has finished playing, or has - // never been started +#define SMP_DONE 0x0002 // Sample has finished playing, or has + // never been started -#define SMP_PLAYING 0x0004 // Sample is playing +#define SMP_PLAYING 0x0004 // Sample is playing -#define SMP_STOPPED 0x0008 // Sample has been stopped +#define SMP_STOPPED 0x0008 // Sample has been stopped #define SMP_PLAYINGBUTRELEASED 0x0010 // Sample is playing, but digital handle - // has been temporarily released + // has been temporarily released @@ -418,17 +418,17 @@ typedef LPVOID AILLPDIRECTSOUNDBUFFER; // SEQUENCE.status flag values // -#define SEQ_FREE 0x0001 // Sequence is available for allocation +#define SEQ_FREE 0x0001 // Sequence is available for allocation -#define SEQ_DONE 0x0002 // Sequence has finished playing, or has - // never been started +#define SEQ_DONE 0x0002 // Sequence has finished playing, or has + // never been started -#define SEQ_PLAYING 0x0004 // Sequence is playing +#define SEQ_PLAYING 0x0004 // Sequence is playing -#define SEQ_STOPPED 0x0008 // Sequence has been stopped +#define SEQ_STOPPED 0x0008 // Sequence has been stopped #define SEQ_PLAYINGBUTRELEASED 0x0010 // Sequence is playing, but MIDI handle - // has been temporarily released + // has been temporarily released #ifdef IS_DOS @@ -436,24 +436,24 @@ typedef LPVOID AILLPDIRECTSOUNDBUFFER; // MIDI driver types // -#define MDIDRVRTYPE_GM 0 // General MIDI driver (Roland-compatible) -#define MDIDRVRTYPE_FM_2 1 // 2-operator FM MIDI driver (OPL2) -#define MDIDRVRTYPE_FM_4 2 // 4-operator FM MIDI driver (OPL3) -#define MDIDRVRTYPE_SPKR 3 // Tandy or PC speaker "beep" driver +#define MDIDRVRTYPE_GM 0 // General MIDI driver (Roland-compatible) +#define MDIDRVRTYPE_FM_2 1 // 2-operator FM MIDI driver (OPL2) +#define MDIDRVRTYPE_FM_4 2 // 4-operator FM MIDI driver (OPL3) +#define MDIDRVRTYPE_SPKR 3 // Tandy or PC speaker "beep" driver // // .INI installation result codes // -#define AIL_INIT_SUCCESS 0 // Driver installed successfully -#define AIL_NO_INI_FILE 1 // No MDI.INI or DIG.INI file exists -#define AIL_INIT_FAILURE 2 // Driver could not be initialized +#define AIL_INIT_SUCCESS 0 // Driver installed successfully +#define AIL_NO_INI_FILE 1 // No MDI.INI or DIG.INI file exists +#define AIL_INIT_FAILURE 2 // Driver could not be initialized #ifdef __BORLANDC__ #ifndef REALPTR #define REALPTR(x) ((void *) (U32) ((((U32) (x))>>16<<4) + ((x) & 0xffff) \ - - AIL_sel_base(_DS))) + - AIL_sel_base(_DS))) #endif #else @@ -470,9 +470,9 @@ typedef LPVOID AILLPDIRECTSOUNDBUFFER; // AIL_set_direct_buffer_control() command values // -#define AILDS_RELINQUISH 0 // App returns control of secondary buffer -#define AILDS_SEIZE 1 // App takes control of secondary buffer -#define AILDS_SEIZE_LOOP 2 // App wishes to loop the secondary buffer +#define AILDS_RELINQUISH 0 // App returns control of secondary buffer +#define AILDS_SEIZE 1 // App takes control of secondary buffer +#define AILDS_SEIZE_LOOP 2 // App wishes to loop the secondary buffer #endif @@ -524,13 +524,13 @@ typedef LPVOID AILLPDIRECTSOUNDBUFFER; #ifndef FILE_ERRS #define FILE_ERRS -#define AIL_NO_ERROR 0 -#define AIL_IO_ERROR 1 +#define AIL_NO_ERROR 0 +#define AIL_IO_ERROR 1 #define AIL_OUT_OF_MEMORY 2 #define AIL_FILE_NOT_FOUND 3 #define AIL_CANT_WRITE_FILE 4 #define AIL_CANT_READ_FILE 5 -#define AIL_DISK_FULL 6 +#define AIL_DISK_FULL 6 #endif @@ -559,125 +559,125 @@ typedef LPVOID AILLPDIRECTSOUNDBUFFER; // #define DIG_RESAMPLING_TOLERANCE 0 -#define DEFAULT_DRT 655 // Resampling triggered at +/- 1% +#define DEFAULT_DRT 655 // Resampling triggered at +/- 1% -#define DIG_MIXER_CHANNELS 1 -#define DEFAULT_DMC 64 // 64 allocatable SAMPLE structures +#define DIG_MIXER_CHANNELS 1 +#define DEFAULT_DMC 64 // 64 allocatable SAMPLE structures -#define DIG_DEFAULT_VOLUME 2 -#define DEFAULT_DDV 127 // Default sample volume = 127 (0-127) +#define DIG_DEFAULT_VOLUME 2 +#define DEFAULT_DDV 127 // Default sample volume = 127 (0-127) -#define MDI_SERVICE_RATE 3 -#define DEFAULT_MSR 120 // XMIDI sequencer timing = 120 Hz +#define MDI_SERVICE_RATE 3 +#define DEFAULT_MSR 120 // XMIDI sequencer timing = 120 Hz -#define MDI_SEQUENCES 4 -#define DEFAULT_MS 8 // 8 sequence handles/driver +#define MDI_SEQUENCES 4 +#define DEFAULT_MS 8 // 8 sequence handles/driver -#define MDI_DEFAULT_VOLUME 5 -#define DEFAULT_MDV 127 // Default sequence volume = 127 (0-127) +#define MDI_DEFAULT_VOLUME 5 +#define DEFAULT_MDV 127 // Default sequence volume = 127 (0-127) -#define MDI_QUANT_ADVANCE 6 -#define DEFAULT_MQA 1 // Beat/bar count +1 interval +#define MDI_QUANT_ADVANCE 6 +#define DEFAULT_MQA 1 // Beat/bar count +1 interval #define MDI_ALLOW_LOOP_BRANCHING 7 -#define DEFAULT_ALB NO // Branches cancel XMIDI FOR loops +#define DEFAULT_ALB NO // Branches cancel XMIDI FOR loops -#define MDI_DEFAULT_BEND_RANGE 8 -#define DEFAULT_MDBR 2 // Default pitch-bend range = 2 +#define MDI_DEFAULT_BEND_RANGE 8 +#define DEFAULT_MDBR 2 // Default pitch-bend range = 2 -#define MDI_DOUBLE_NOTE_OFF 9 -#define DEFAULT_MDNO NO // For stuck notes on SB daughterboards +#define MDI_DOUBLE_NOTE_OFF 9 +#define DEFAULT_MDNO NO // For stuck notes on SB daughterboards -#define DIG_ENABLE_RESAMPLE_FILTER 31 // Enable resampling filter by -#define DEFAULT_DERF YES // default +#define DIG_ENABLE_RESAMPLE_FILTER 31 // Enable resampling filter by +#define DEFAULT_DERF YES // default -#define DIG_DECODE_BUFFER_SIZE 32 // 2K decode buffer size by default -#define DEFAULT_DDBS 2048 +#define DIG_DECODE_BUFFER_SIZE 32 // 2K decode buffer size by default +#define DEFAULT_DDBS 2048 #ifdef IS_WINDOWS -#define DIG_USE_MSS_MIXER 33 -#define DEFAULT_DUMM YES // Use MSS mixer with DirectSound +#define DIG_USE_MSS_MIXER 33 +#define DEFAULT_DUMM YES // Use MSS mixer with DirectSound -#define DIG_DS_FRAGMENT_SIZE 34 -#define DEFAULT_DDFS 8 // Use 8 millisecond buffer fragments with DirectSound if MSS mixer in use +#define DIG_DS_FRAGMENT_SIZE 34 +#define DEFAULT_DDFS 8 // Use 8 millisecond buffer fragments with DirectSound if MSS mixer in use -#define DIG_DS_FRAGMENT_CNT 35 -#define DEFAULT_DDFC 96 // Use 96 buffer fragments with DirectSound if MSS mixer in use +#define DIG_DS_FRAGMENT_CNT 35 +#define DEFAULT_DDFC 96 // Use 96 buffer fragments with DirectSound if MSS mixer in use -#define DIG_DS_MIX_FRAGMENT_CNT 42 -#define DEFAULT_DDMFC 8 // Mix ahead 8 buffer fragments +#define DIG_DS_MIX_FRAGMENT_CNT 42 +#define DEFAULT_DDMFC 8 // Mix ahead 8 buffer fragments -#define DIG_DS_USE_PRIMARY 36 -#define DEFAULT_DDUP NO // Mix into secondary DirectSound buffer by default +#define DIG_DS_USE_PRIMARY 36 +#define DEFAULT_DDUP NO // Mix into secondary DirectSound buffer by default -#define DIG_DS_DSBCAPS_CTRL3D 37 -#define DEFAULT_DDDC NO // Do not use DSBCAPS_CTRL3D by default +#define DIG_DS_DSBCAPS_CTRL3D 37 +#define DEFAULT_DDDC NO // Do not use DSBCAPS_CTRL3D by default -#define DIG_DS_CREATION_HANDLER 38 -#define DEFAULT_DDCH NULL // Use DirectSoundCreate() by default +#define DIG_DS_CREATION_HANDLER 38 +#define DEFAULT_DDCH NULL // Use DirectSoundCreate() by default -#define MDI_SYSEX_BUFFER_SIZE 10 -#define DEFAULT_MSBS 1536 // Default sysex buffer = 1536 bytes +#define MDI_SYSEX_BUFFER_SIZE 10 +#define DEFAULT_MSBS 1536 // Default sysex buffer = 1536 bytes -#define DIG_OUTPUT_BUFFER_SIZE 11 -#define DEFAULT_DOBS 49152 // 48K output buffer size +#define DIG_OUTPUT_BUFFER_SIZE 11 +#define DEFAULT_DOBS 49152 // 48K output buffer size -#define AIL_MM_PERIOD 12 -#define DEFAULT_AMP 5 // Default MM timer period = 5 msec. +#define AIL_MM_PERIOD 12 +#define DEFAULT_AMP 5 // Default MM timer period = 5 msec. -#define AIL_TIMERS 13 -#define DEFAULT_AT 16 // 16 allocatable HTIMER handles +#define AIL_TIMERS 13 +#define DEFAULT_AT 16 // 16 allocatable HTIMER handles #define DIG_MIN_CHAIN_ELEMENT_SIZE 14 -#define DEFAULT_MCES 2048 // 2048 bytes/waveOut buffer +#define DEFAULT_MCES 2048 // 2048 bytes/waveOut buffer -#define DIG_USE_WAVEOUT 15 -#define DEFAULT_DUW NO // Use DirectSound by default +#define DIG_USE_WAVEOUT 15 +#define DEFAULT_DUW NO // Use DirectSound by default -#define DIG_DS_SECONDARY_SIZE 16 -#define DEFAULT_DDSS (32*1024L) // Must be 2^n -- use 32K by default +#define DIG_DS_SECONDARY_SIZE 16 +#define DEFAULT_DDSS (32*1024L) // Must be 2^n -- use 32K by default -#define DIG_DS_SAMPLE_CEILING 17 -#define DEFAULT_DDSC 44100 // Allow up to 44 kHz samples +#define DIG_DS_SAMPLE_CEILING 17 +#define DEFAULT_DDSC 44100 // Allow up to 44 kHz samples -#define AIL_LOCK_PROTECTION 18 -#define DEFAULT_ALP YES // Suspend foreground thread by default +#define AIL_LOCK_PROTECTION 18 +#define DEFAULT_ALP YES // Suspend foreground thread by default #define AIL_WIN32S_CALLBACK_SIZE 19 -#define DEFAULT_WCS 4096 // Size of callback data in bytes +#define DEFAULT_WCS 4096 // Size of callback data in bytes #else -#define DIG_SERVICE_RATE 10 -#define DEFAULT_DSR 200 // DMA buffer-polling rate = 200 Hz +#define DIG_SERVICE_RATE 10 +#define DEFAULT_DSR 200 // DMA buffer-polling rate = 200 Hz #define DIG_HARDWARE_SAMPLE_RATE 11 -#define DEFAULT_DHSR NOM_VAL // Use nominal sample rate by default +#define DEFAULT_DHSR NOM_VAL // Use nominal sample rate by default -#define DIG_DMA_RESERVE 12 -#define DEFAULT_DDR 32768 // Reserve 32K real-mode mem for DMA +#define DIG_DMA_RESERVE 12 +#define DEFAULT_DDR 32768 // Reserve 32K real-mode mem for DMA -#define DIG_LATENCY 13 -#define DEFAULT_DL 100 // Half-buffer size in ms = 100 +#define DIG_LATENCY 13 +#define DEFAULT_DL 100 // Half-buffer size in ms = 100 -#define DIG_USE_STEREO 14 -#define DEFAULT_DUS NO // Use mono output only +#define DIG_USE_STEREO 14 +#define DEFAULT_DUS NO // Use mono output only -#define DIG_USE_16_BITS 15 -#define DEFAULT_DU16 NO // Use 8-bit output by default +#define DIG_USE_16_BITS 15 +#define DEFAULT_DU16 NO // Use 8-bit output by default -#define DIG_ALLOW_16_BIT_DMA 16 -#define DEFAULT_DA16DMA YES // OK to use 16-bit DMA if necessary +#define DIG_ALLOW_16_BIT_DMA 16 +#define DEFAULT_DA16DMA YES // OK to use 16-bit DMA if necessary -#define DIG_SS_LOCK 17 -#define DEFAULT_DSL NO // Don't disable IRQs while mixing +#define DIG_SS_LOCK 17 +#define DEFAULT_DSL NO // Don't disable IRQs while mixing -#define AIL_SCAN_FOR_HARDWARE 18 -#define DEFAULT_ASH YES // Scan for I/O settings if necessary +#define AIL_SCAN_FOR_HARDWARE 18 +#define DEFAULT_ASH YES // Scan for I/O settings if necessary #define AIL_ALLOW_VDM_EXECUTION 19 -#define DEFAULT_AVE YES // Allow Windows "DOS box" execution +#define DEFAULT_AVE YES // Allow Windows "DOS box" execution #endif @@ -687,33 +687,33 @@ typedef LPVOID AILLPDIRECTSOUNDBUFFER; // BEFORE calling DLSMSSOpen()! // ---------------------------------- -#define DLS_TIMEBASE 20 -#define DEFAULT_DTB 120 // 120 intervals/second by default +#define DLS_TIMEBASE 20 +#define DEFAULT_DTB 120 // 120 intervals/second by default -#define DLS_VOICE_LIMIT 21 -#define DEFAULT_DVL 24 // 24 voices supported +#define DLS_VOICE_LIMIT 21 +#define DEFAULT_DVL 24 // 24 voices supported -#define DLS_BANK_SELECT_ALIAS 22 -#define DEFAULT_DBSA NO // Do not treat controller 114 as bank +#define DLS_BANK_SELECT_ALIAS 22 +#define DEFAULT_DBSA NO // Do not treat controller 114 as bank -#define DLS_STREAM_BOOTSTRAP 23 // Don't submit first stream buffer -#define DEFAULT_DSB YES // until at least 2 available +#define DLS_STREAM_BOOTSTRAP 23 // Don't submit first stream buffer +#define DEFAULT_DSB YES // until at least 2 available -#define DLS_VOLUME_BOOST 24 -#define DEFAULT_DVB 0 // Boost final volume by 0 dB +#define DLS_VOLUME_BOOST 24 +#define DEFAULT_DVB 0 // Boost final volume by 0 dB -#define DLS_ENABLE_FILTERING 25 // Filtering = on by default -#define DEFAULT_DEF YES // (may be changed at any time) +#define DLS_ENABLE_FILTERING 25 // Filtering = on by default +#define DEFAULT_DEF YES // (may be changed at any time) -#define AIL_ENABLE_MMX_SUPPORT 27 // Enable MMX support if present -#define DEFAULT_AEMS YES // (may be changed at any time) +#define AIL_ENABLE_MMX_SUPPORT 27 // Enable MMX support if present +#define DEFAULT_AEMS YES // (may be changed at any time) -#define DLS_GM_PASSTHROUGH 28 // Pass unrecognized traffic on to -#define DEFAULT_DGP YES // default GM driver layer - // (may be changed at any time) +#define DLS_GM_PASSTHROUGH 28 // Pass unrecognized traffic on to +#define DEFAULT_DGP YES // default GM driver layer + // (may be changed at any time) #define DLS_ADPCM_TO_ASI_THRESHOLD 39 // Size in samples to switch to ASI -#define DEFAULT_DATAT 32768 +#define DEFAULT_DATAT 32768 #ifdef OLD_DLS_REVERB_PREFERENCES @@ -722,13 +722,13 @@ typedef LPVOID AILLPDIRECTSOUNDBUFFER; // in MSS 6.0 #define DLS_ENABLE_GLOBAL_REVERB 26 // Global reverb disabled by default -#define DEFAULT_DEGR NO +#define DEFAULT_DEGR NO -#define DLS_GLOBAL_REVERB_LEVEL 29 // Reverb level 0-127 -#define DEFAULT_GRL 20 // (may be changed at any time) +#define DLS_GLOBAL_REVERB_LEVEL 29 // Reverb level 0-127 +#define DEFAULT_GRL 20 // (may be changed at any time) -#define DLS_GLOBAL_REVERB_TIME 30 // Reverb time in stream buffers -#define DEFAULT_GRT 1 +#define DLS_GLOBAL_REVERB_TIME 30 // Reverb time in stream buffers +#define DEFAULT_GRT 1 #endif @@ -736,16 +736,16 @@ typedef LPVOID AILLPDIRECTSOUNDBUFFER; // Add'l platform-independent prefs // -#define DIG_REVERB_BUFFER_SIZE 40 -#define DEFAULT_DRBS 0 // No reverb support by default +#define DIG_REVERB_BUFFER_SIZE 40 +#define DEFAULT_DRBS 0 // No reverb support by default -#define DIG_INPUT_LATENCY 41 // Use >= 250-millisecond input buffers if -#define DEFAULT_DIL 250 // explicit size request cannot be satisfied +#define DIG_INPUT_LATENCY 41 // Use >= 250-millisecond input buffers if +#define DEFAULT_DIL 250 // explicit size request cannot be satisfied -#define DIG_USE_WAVEIN 43 -#define DEFAULT_DUWI YES // Use waveIn for input by default +#define DIG_USE_WAVEIN 43 +#define DEFAULT_DUWI YES // Use waveIn for input by default -#define N_PREFS 44 // # of preference types +#define N_PREFS 44 // # of preference types typedef struct _AILSOUNDINFO { S32 format; @@ -770,18 +770,18 @@ typedef struct _AILSOUNDINFO { static void __MSSLockedIncrementAddr(void * addr) { - _asm { - mov eax,[addr] - lock inc dword ptr [eax] - } + _asm { + mov eax,[addr] + lock inc dword ptr [eax] + } } static void __MSSLockedDecrementAddr(void * addr) { - _asm { - mov eax,[addr] - lock dec dword ptr [eax] - } + _asm { + mov eax,[addr] + lock dec dword ptr [eax] + } } #define MSSLockedIncrementPtr(var) __MSSLockedIncrementAddr(&(var)) @@ -805,7 +805,7 @@ typedef struct _AILSOUNDINFO { #define MSSLockedDecrementPtr(var) (--var) #endif -#ifndef RIB_H // RIB.H contents included if RIB.H not already included +#ifndef RIB_H // RIB.H contents included if RIB.H not already included // #include "rib.h" @@ -818,10 +818,10 @@ typedef struct _AILSOUNDINFO { typedef S32 RIBRESULT; -#define RIB_NOERR 0 // Success -- no error -#define RIB_NOT_ALL_AVAILABLE 1 // Some requested functions/attribs not available -#define RIB_NOT_FOUND 2 // Resource not found -#define RIB_OUT_OF_MEM 3 // Out of system RAM +#define RIB_NOERR 0 // Success -- no error +#define RIB_NOT_ALL_AVAILABLE 1 // Some requested functions/attribs not available +#define RIB_NOT_FOUND 2 // Resource not found +#define RIB_OUT_OF_MEM 3 // Out of system RAM // // Handle to interface provider @@ -864,12 +864,12 @@ typedef enum { RIB_NONE = 0, // No type RIB_CUSTOM, // Used for pointers to application-specific structures - RIB_DEC, // Used for 32-bit integer values to be reported in decimal - RIB_HEX, // Used for 32-bit integer values to be reported in hex - RIB_FLOAT, // Used for 32-bit single-precision FP values + RIB_DEC, // Used for 32-bit integer values to be reported in decimal + RIB_HEX, // Used for 32-bit integer values to be reported in hex + RIB_FLOAT, // Used for 32-bit single-precision FP values RIB_PERCENT, // Used for 32-bit single-precision FP values to be reported as percentages - RIB_BOOL, // Used for Boolean-constrained integer values to be reported as TRUE or FALSE - RIB_STRING // Used for pointers to null-terminated ASCII strings + RIB_BOOL, // Used for Boolean-constrained integer values to be reported as TRUE or FALSE + RIB_STRING // Used for pointers to null-terminated ASCII strings } RIB_DATA_SUBTYPE; @@ -880,8 +880,8 @@ RIB_DATA_SUBTYPE; typedef enum { RIB_FUNCTION = 0, - RIB_ATTRIBUTE, // Attribute: read-only data type used for status/info communication - RIB_PREFERENCE // Preference: read/write data type used to control behavior + RIB_ATTRIBUTE, // Attribute: read-only data type used for status/info communication + RIB_PREFERENCE // Preference: read/write data type used to control behavior } RIB_ENTRY_TYPE; @@ -892,10 +892,10 @@ RIB_ENTRY_TYPE; typedef struct { - RIB_ENTRY_TYPE type; // See list above - C8 FAR *entry_name; // Name of desired function or attribute - U32 token; // Function pointer or attribute token - RIB_DATA_SUBTYPE subtype; // Data (attrib or preference) subtype + RIB_ENTRY_TYPE type; // See list above + C8 FAR *entry_name; // Name of desired function or attribute + U32 token; // Function pointer or attribute token + RIB_DATA_SUBTYPE subtype; // Data (attrib or preference) subtype } RIB_INTERFACE_ENTRY; @@ -903,7 +903,7 @@ RIB_INTERFACE_ENTRY; // Standard RAD Interface Broker provider identification attributes // -#define PROVIDER_NAME (-100) // RIB_STRING name of decoder +#define PROVIDER_NAME (-100) // RIB_STRING name of decoder #define PROVIDER_VERSION (-101) // RIB_HEX BCD version number // @@ -920,94 +920,94 @@ typedef U32 (AILCALL FAR *PROVIDER_QUERY_ATTRIBUTE) (HATTRIB index); // attributes, and preferences // -#define FN(entry_name) { RIB_FUNCTION, #entry_name, (U32) &(entry_name), RIB_NONE } -#define REG_FN(entry_name) { RIB_FUNCTION, #entry_name, (U32) &(entry_name), RIB_NONE } +#define FN(entry_name) { RIB_FUNCTION, #entry_name, (U32) &(entry_name), RIB_NONE } +#define REG_FN(entry_name) { RIB_FUNCTION, #entry_name, (U32) &(entry_name), RIB_NONE } -#define AT(entry_name,ID) { RIB_ATTRIBUTE, (entry_name), (U32) &(ID), RIB_NONE } +#define AT(entry_name,ID) { RIB_ATTRIBUTE, (entry_name), (U32) &(ID), RIB_NONE } #define REG_AT(entry_name,ID,subtype) { RIB_ATTRIBUTE, (entry_name), (U32) (ID), subtype } -#define PR(entry_name,ID) { RIB_PREFERENCE, (entry_name), (U32) &(ID), RIB_NONE } +#define PR(entry_name,ID) { RIB_PREFERENCE, (entry_name), (U32) &(ID), RIB_NONE } #define REG_PR(entry_name,ID,subtype) { RIB_PREFERENCE, (entry_name), (U32) (ID), subtype } #define RIB_register(x,y,z) RIB_register_interface (HPROVIDER(x), y, ARY_CNT(z), z) #define RIB_unregister(x,y,z) RIB_unregister_interface(HPROVIDER(x), y, ARY_CNT(z), z) #define RIB_unregister_all(x) RIB_unregister_interface(HPROVIDER(x), NULL, 0, NULL) #define RIB_free_libraries() RIB_free_provider_library(HPROVIDER(NULL)); -#define RIB_request(x,y,z) RIB_request_interface (x, y, ARY_CNT(z), z) +#define RIB_request(x,y,z) RIB_request_interface (x, y, ARY_CNT(z), z) // ---------------------------------- // Standard RIB API prototypes // ---------------------------------- -DXDEC HPROVIDER AILCALL RIB_alloc_provider_handle (U32 module); -DXDEC void AILCALL RIB_free_provider_handle (HPROVIDER provider); +DXDEC HPROVIDER AILCALL RIB_alloc_provider_handle (U32 module); +DXDEC void AILCALL RIB_free_provider_handle (HPROVIDER provider); -DXDEC HPROVIDER AILCALL RIB_load_provider_library (C8 FAR *filename); -DXDEC void AILCALL RIB_free_provider_library (HPROVIDER provider); +DXDEC HPROVIDER AILCALL RIB_load_provider_library (C8 FAR *filename); +DXDEC void AILCALL RIB_free_provider_library (HPROVIDER provider); DXDEC HPROVIDER AILCALL RIB_provider_library_handle (void); -DXDEC RIBRESULT AILCALL RIB_register_interface (HPROVIDER provider, - C8 FAR *interface_name, - S32 entry_count, - const RIB_INTERFACE_ENTRY FAR *rlist); +DXDEC RIBRESULT AILCALL RIB_register_interface (HPROVIDER provider, + C8 FAR *interface_name, + S32 entry_count, + const RIB_INTERFACE_ENTRY FAR *rlist); -DXDEC RIBRESULT AILCALL RIB_unregister_interface (HPROVIDER provider, - C8 FAR *interface_name, - S32 entry_count, - const RIB_INTERFACE_ENTRY FAR *rlist); +DXDEC RIBRESULT AILCALL RIB_unregister_interface (HPROVIDER provider, + C8 FAR *interface_name, + S32 entry_count, + const RIB_INTERFACE_ENTRY FAR *rlist); -DXDEC RIBRESULT AILCALL RIB_request_interface (HPROVIDER provider, - C8 FAR *interface_name, - S32 entry_count, - RIB_INTERFACE_ENTRY FAR *rlist); +DXDEC RIBRESULT AILCALL RIB_request_interface (HPROVIDER provider, + C8 FAR *interface_name, + S32 entry_count, + RIB_INTERFACE_ENTRY FAR *rlist); -DXDEC RIBRESULT AILCALL RIB_request_interface_entry (HPROVIDER provider, - C8 FAR *interface_name, - RIB_ENTRY_TYPE entry_type, - C8 FAR *entry_name, - U32 FAR *token); +DXDEC RIBRESULT AILCALL RIB_request_interface_entry (HPROVIDER provider, + C8 FAR *interface_name, + RIB_ENTRY_TYPE entry_type, + C8 FAR *entry_name, + U32 FAR *token); -DXDEC S32 AILCALL RIB_enumerate_interface (HPROVIDER provider, - C8 FAR *interface_name, - RIB_ENTRY_TYPE type, - HINTENUM FAR *next, - RIB_INTERFACE_ENTRY FAR *dest); +DXDEC S32 AILCALL RIB_enumerate_interface (HPROVIDER provider, + C8 FAR *interface_name, + RIB_ENTRY_TYPE type, + HINTENUM FAR *next, + RIB_INTERFACE_ENTRY FAR *dest); -DXDEC S32 AILCALL RIB_enumerate_providers (C8 FAR *interface_name, - HPROENUM FAR *next, - HPROVIDER FAR *dest); +DXDEC S32 AILCALL RIB_enumerate_providers (C8 FAR *interface_name, + HPROENUM FAR *next, + HPROVIDER FAR *dest); -DXDEC C8 FAR * AILCALL RIB_type_string (U32 data, - RIB_DATA_SUBTYPE subtype); +DXDEC C8 FAR * AILCALL RIB_type_string (U32 data, + RIB_DATA_SUBTYPE subtype); -DXDEC HPROVIDER AILCALL RIB_find_file_provider (C8 FAR *interface_name, - C8 FAR *attribute_name, - C8 FAR *file_suffix); +DXDEC HPROVIDER AILCALL RIB_find_file_provider (C8 FAR *interface_name, + C8 FAR *attribute_name, + C8 FAR *file_suffix); -DXDEC HPROVIDER AILCALL RIB_find_provider (C8 FAR *interface_name, - C8 FAR *attribute_name, - C8 FAR *attribute_value); +DXDEC HPROVIDER AILCALL RIB_find_provider (C8 FAR *interface_name, + C8 FAR *attribute_name, + C8 FAR *attribute_value); -DXDEC S32 AILCALL RIB_load_application_providers - (C8 FAR *filespec); +DXDEC S32 AILCALL RIB_load_application_providers + (C8 FAR *filespec); -DXDEC void AILCALL RIB_set_provider_user_data (HPROVIDER provider, - U32 index, - S32 value); +DXDEC void AILCALL RIB_set_provider_user_data (HPROVIDER provider, + U32 index, + S32 value); -DXDEC S32 AILCALL RIB_provider_user_data (HPROVIDER provider, - U32 index); +DXDEC S32 AILCALL RIB_provider_user_data (HPROVIDER provider, + U32 index); -DXDEC void AILCALL RIB_set_provider_system_data - (HPROVIDER provider, - U32 index, - S32 value); +DXDEC void AILCALL RIB_set_provider_system_data + (HPROVIDER provider, + U32 index, + S32 value); -DXDEC S32 AILCALL RIB_provider_system_data (HPROVIDER provider, - U32 index); +DXDEC S32 AILCALL RIB_provider_system_data (HPROVIDER provider, + U32 index); -DXDEC C8 FAR * AILCALL RIB_error (void); +DXDEC C8 FAR * AILCALL RIB_error (void); #endif @@ -1030,16 +1030,16 @@ typedef S32 HASISTREAM; typedef S32 ASIRESULT; -#define ASI_NOERR 0 // Success -- no error -#define ASI_NOT_ENABLED 1 // ASI not enabled -#define ASI_ALREADY_STARTED 2 // ASI already started -#define ASI_INVALID_PARAM 3 // Invalid parameters used -#define ASI_INTERNAL_ERR 4 // Internal error in ASI driver -#define ASI_OUT_OF_MEM 5 // Out of system RAM -#define ASI_ERR_NOT_IMPLEMENTED 6 // Feature not implemented -#define ASI_NOT_FOUND 7 // ASI supported device not found -#define ASI_NOT_INIT 8 // ASI not initialized -#define ASI_CLOSE_ERR 9 // ASI not closed correctly +#define ASI_NOERR 0 // Success -- no error +#define ASI_NOT_ENABLED 1 // ASI not enabled +#define ASI_ALREADY_STARTED 2 // ASI already started +#define ASI_INVALID_PARAM 3 // Invalid parameters used +#define ASI_INTERNAL_ERR 4 // Internal error in ASI driver +#define ASI_OUT_OF_MEM 5 // Out of system RAM +#define ASI_ERR_NOT_IMPLEMENTED 6 // Feature not implemented +#define ASI_NOT_FOUND 7 // ASI supported device not found +#define ASI_NOT_INIT 8 // ASI not initialized +#define ASI_CLOSE_ERR 9 // ASI not closed correctly // ---------------------------------- // Application-provided ASI callbacks @@ -1060,15 +1060,15 @@ typedef S32 ASIRESULT; // the stream is reached). // -typedef S32 (AILCALLBACK FAR * AILASIFETCHCB) (U32 user, // User value passed to ASI_open_stream() - void FAR *dest, // Location to which stream data should be copied by app - S32 bytes_requested, // # of bytes requested by ASI codec - S32 offset); // If not -1, application should seek to this point in stream +typedef S32 (AILCALLBACK FAR * AILASIFETCHCB) (U32 user, // User value passed to ASI_open_stream() + void FAR *dest, // Location to which stream data should be copied by app + S32 bytes_requested, // # of bytes requested by ASI codec + S32 offset); // If not -1, application should seek to this point in stream //############################################################################ -//## ## -//## Interface "ASI codec" ## -//## ## +//## ## +//## Interface "ASI codec" ## +//## ## //############################################################################ // @@ -1098,18 +1098,18 @@ typedef ASIRESULT (AILCALL FAR *ASI_SHUTDOWN)(void); typedef C8 FAR * (AILCALL FAR *ASI_ERROR)(void); //############################################################################ -//## ## -//## Interface "ASI stream" ## -//## ## +//## ## +//## Interface "ASI stream" ## +//## ## //############################################################################ // // Open a stream, returning handle to stream // -typedef HASISTREAM (AILCALL FAR *ASI_STREAM_OPEN) (U32 user, // User value passed to fetch callback - AILASIFETCHCB fetch_CB, // Source data fetch handler - U32 total_size); // Total size for %-done calculations (0=unknown) +typedef HASISTREAM (AILCALL FAR *ASI_STREAM_OPEN) (U32 user, // User value passed to fetch callback + AILASIFETCHCB fetch_CB, // Source data fetch handler + U32 total_size); // Total size for %-done calculations (0=unknown) // // Translate data in stream, returning # of bytes actually decoded or encoded @@ -1119,9 +1119,9 @@ typedef HASISTREAM (AILCALL FAR *ASI_STREAM_OPEN) (U32 user, // handler to be called to fetch more data from the stream. // -typedef S32 (AILCALL FAR *ASI_STREAM_PROCESS) (HASISTREAM stream, // Handle of stream - void FAR *buffer, // Destination for processed data - S32 buffer_size); // # of bytes to return in buffer +typedef S32 (AILCALL FAR *ASI_STREAM_PROCESS) (HASISTREAM stream, // Handle of stream + void FAR *buffer, // Destination for processed data + S32 buffer_size); // # of bytes to return in buffer // // Restart stream decoding process at new offset @@ -1148,23 +1148,23 @@ typedef S32 (AILCALL FAR *ASI_STREAM_PROCESS) (HASISTREAM stream, // internal buffers and resynchronizing themselves to the data stream. // -typedef ASIRESULT (AILCALL FAR *ASI_STREAM_SEEK) (HASISTREAM stream, - S32 stream_offset); +typedef ASIRESULT (AILCALL FAR *ASI_STREAM_SEEK) (HASISTREAM stream, + S32 stream_offset); // // Retrieve an ASI stream attribute or preference value by index // typedef S32 (AILCALL FAR *ASI_STREAM_ATTRIBUTE) (HASISTREAM stream, - HATTRIB attrib); + HATTRIB attrib); // // Set an ASI stream preference value by index // typedef S32 (AILCALL FAR *ASI_STREAM_SET_PREFERENCE) (HASISTREAM stream, - HATTRIB preference, - void FAR* value); + HATTRIB preference, + void FAR* value); // // Close stream, freeing handle and all internally-allocated resources @@ -1175,9 +1175,9 @@ typedef ASIRESULT (AILCALL FAR *ASI_STREAM_CLOSE) (HASISTREAM stream); #endif //############################################################################ -//## ## -//## Interface "MSS 3D audio services" ## -//## ## +//## ## +//## Interface "MSS 3D audio services" ## +//## ## //############################################################################ // @@ -1199,16 +1199,16 @@ typedef H3DPOBJECT H3DSAMPLE; typedef S32 M3DRESULT; -#define M3D_NOERR 0 // Success -- no error -#define M3D_NOT_ENABLED 1 // M3D not enabled -#define M3D_ALREADY_STARTED 2 // M3D already started -#define M3D_INVALID_PARAM 3 // Invalid parameters used -#define M3D_INTERNAL_ERR 4 // Internal error in M3D driver -#define M3D_OUT_OF_MEM 5 // Out of system RAM -#define M3D_ERR_NOT_IMPLEMENTED 6 // Feature not implemented -#define M3D_NOT_FOUND 7 // M3D supported device not found -#define M3D_NOT_INIT 8 // M3D not initialized -#define M3D_CLOSE_ERR 9 // M3D not closed correctly +#define M3D_NOERR 0 // Success -- no error +#define M3D_NOT_ENABLED 1 // M3D not enabled +#define M3D_ALREADY_STARTED 2 // M3D already started +#define M3D_INVALID_PARAM 3 // Invalid parameters used +#define M3D_INTERNAL_ERR 4 // Internal error in M3D driver +#define M3D_OUT_OF_MEM 5 // Out of system RAM +#define M3D_ERR_NOT_IMPLEMENTED 6 // Feature not implemented +#define M3D_NOT_FOUND 7 // M3D supported device not found +#define M3D_NOT_INIT 8 // M3D not initialized +#define M3D_CLOSE_ERR 9 // M3D not closed correctly typedef M3DRESULT (AILCALL FAR *M3D_STARTUP)(void); @@ -1217,151 +1217,151 @@ typedef M3DRESULT (AILCALL FAR *M3D_SHUTDOWN)(void); typedef C8 FAR * (AILCALL FAR *M3D_ERROR)(void); -typedef S32 (AILCALL FAR *M3D_SET_PROVIDER_PREFERENCE)(HATTRIB preference, - void FAR* value); +typedef S32 (AILCALL FAR *M3D_SET_PROVIDER_PREFERENCE)(HATTRIB preference, + void FAR* value); typedef M3DRESULT (AILCALL FAR * M3D_ACTIVATE)(S32 enable); typedef H3DSAMPLE (AILCALL FAR * M3D_ALLOCATE_3D_SAMPLE_HANDLE)(void); - + -typedef void (AILCALL FAR * M3D_RELEASE_3D_SAMPLE_HANDLE)(H3DSAMPLE samp); - +typedef void (AILCALL FAR * M3D_RELEASE_3D_SAMPLE_HANDLE)(H3DSAMPLE samp); + -typedef void (AILCALL FAR * M3D_START_3D_SAMPLE)(H3DSAMPLE samp); +typedef void (AILCALL FAR * M3D_START_3D_SAMPLE)(H3DSAMPLE samp); -typedef void (AILCALL FAR * M3D_STOP_3D_SAMPLE)(H3DSAMPLE samp); - +typedef void (AILCALL FAR * M3D_STOP_3D_SAMPLE)(H3DSAMPLE samp); + -typedef void (AILCALL FAR * M3D_RESUME_3D_SAMPLE)(H3DSAMPLE samp); - -typedef void (AILCALL FAR * M3D_END_3D_SAMPLE)(H3DSAMPLE samp); +typedef void (AILCALL FAR * M3D_RESUME_3D_SAMPLE)(H3DSAMPLE samp); + +typedef void (AILCALL FAR * M3D_END_3D_SAMPLE)(H3DSAMPLE samp); -typedef S32 (AILCALL FAR * M3D_SET_3D_SAMPLE_DATA)(H3DSAMPLE samp, - AILSOUNDINFO FAR *info); +typedef S32 (AILCALL FAR * M3D_SET_3D_SAMPLE_DATA)(H3DSAMPLE samp, + AILSOUNDINFO FAR *info); -typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_VOLUME)(H3DSAMPLE samp, - S32 volume); - -typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_PLAYBACK_RATE)(H3DSAMPLE samp, - S32 playback_rate); +typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_VOLUME)(H3DSAMPLE samp, + S32 volume); + +typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_PLAYBACK_RATE)(H3DSAMPLE samp, + S32 playback_rate); -typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_OFFSET)(H3DSAMPLE samp, - U32 offset); +typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_OFFSET)(H3DSAMPLE samp, + U32 offset); -typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_LOOP_COUNT)(H3DSAMPLE samp, - U32 loops); +typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_LOOP_COUNT)(H3DSAMPLE samp, + U32 loops); -typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_LOOP_BLOCK)(H3DSAMPLE S, - S32 loop_start_offset, - S32 loop_end_offset); +typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_LOOP_BLOCK)(H3DSAMPLE S, + S32 loop_start_offset, + S32 loop_end_offset); -typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_STATUS)(H3DSAMPLE samp); +typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_STATUS)(H3DSAMPLE samp); -typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_ATTRIBUTE)(H3DSAMPLE samp, HATTRIB index); +typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_ATTRIBUTE)(H3DSAMPLE samp, HATTRIB index); -typedef S32 (AILCALL FAR * M3D_3D_SET_SAMPLE_PREFERENCE)(H3DSAMPLE samp, HATTRIB preference, void FAR* value); +typedef S32 (AILCALL FAR * M3D_3D_SET_SAMPLE_PREFERENCE)(H3DSAMPLE samp, HATTRIB preference, void FAR* value); -typedef S32 (AILCALL FAR * M3D_3D_SAMPLE_VOLUME)(H3DSAMPLE samp); +typedef S32 (AILCALL FAR * M3D_3D_SAMPLE_VOLUME)(H3DSAMPLE samp); -typedef S32 (AILCALL FAR * M3D_3D_SAMPLE_PLAYBACK_RATE)(H3DSAMPLE samp); +typedef S32 (AILCALL FAR * M3D_3D_SAMPLE_PLAYBACK_RATE)(H3DSAMPLE samp); -typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_OFFSET)(H3DSAMPLE samp); +typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_OFFSET)(H3DSAMPLE samp); -typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_LENGTH)(H3DSAMPLE samp); +typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_LENGTH)(H3DSAMPLE samp); -typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_LOOP_COUNT)(H3DSAMPLE samp); +typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_LOOP_COUNT)(H3DSAMPLE samp); -typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_DISTANCES)(H3DSAMPLE samp, - F32 max_front_dist, - F32 min_front_dist, - F32 max_back_dist, - F32 min_back_dist); +typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_DISTANCES)(H3DSAMPLE samp, + F32 max_front_dist, + F32 min_front_dist, + F32 max_back_dist, + F32 min_back_dist); -typedef void (AILCALL FAR * M3D_3D_SAMPLE_DISTANCES)(H3DSAMPLE samp, - F32 FAR * max_front_dist, - F32 FAR * min_front_dist, - F32 FAR * max_back_dist, - F32 FAR * min_back_dist); +typedef void (AILCALL FAR * M3D_3D_SAMPLE_DISTANCES)(H3DSAMPLE samp, + F32 FAR * max_front_dist, + F32 FAR * min_front_dist, + F32 FAR * max_back_dist, + F32 FAR * min_back_dist); -typedef S32 (AILCALL FAR * M3D_ACTIVE_3D_SAMPLE_COUNT)(void); +typedef S32 (AILCALL FAR * M3D_ACTIVE_3D_SAMPLE_COUNT)(void); typedef H3DPOBJECT (AILCALL FAR * M3D_3D_OPEN_LISTENER)(void); -typedef void (AILCALL FAR * M3D_3D_CLOSE_LISTENER)(H3DPOBJECT listener); +typedef void (AILCALL FAR * M3D_3D_CLOSE_LISTENER)(H3DPOBJECT listener); typedef H3DPOBJECT (AILCALL FAR * M3D_3D_OPEN_OBJECT)(void); -typedef void (AILCALL FAR * M3D_3D_CLOSE_OBJECT)(H3DPOBJECT obj); +typedef void (AILCALL FAR * M3D_3D_CLOSE_OBJECT)(H3DPOBJECT obj); -typedef void (AILCALL FAR * M3D_SET_3D_POSITION)(H3DPOBJECT obj, - F32 X, - F32 Y, - F32 Z); +typedef void (AILCALL FAR * M3D_SET_3D_POSITION)(H3DPOBJECT obj, + F32 X, + F32 Y, + F32 Z); -typedef void (AILCALL FAR * M3D_SET_3D_VELOCITY)(H3DPOBJECT obj, - F32 dX_per_ms, - F32 dY_per_ms, - F32 dZ_per_ms, - F32 magnitude); +typedef void (AILCALL FAR * M3D_SET_3D_VELOCITY)(H3DPOBJECT obj, + F32 dX_per_ms, + F32 dY_per_ms, + F32 dZ_per_ms, + F32 magnitude); -typedef void (AILCALL FAR * M3D_SET_3D_VELOCITY_VECTOR)(H3DPOBJECT obj, - F32 dX_per_ms, - F32 dY_per_ms, - F32 dZ_per_ms); +typedef void (AILCALL FAR * M3D_SET_3D_VELOCITY_VECTOR)(H3DPOBJECT obj, + F32 dX_per_ms, + F32 dY_per_ms, + F32 dZ_per_ms); -typedef void (AILCALL FAR * M3D_SET_3D_ORIENTATION)(H3DPOBJECT obj, - F32 X_face, - F32 Y_face, - F32 Z_face, - F32 X_up, - F32 Y_up, - F32 Z_up); +typedef void (AILCALL FAR * M3D_SET_3D_ORIENTATION)(H3DPOBJECT obj, + F32 X_face, + F32 Y_face, + F32 Z_face, + F32 X_up, + F32 Y_up, + F32 Z_up); -typedef void (AILCALL FAR * M3D_3D_POSITION)(H3DPOBJECT obj, - F32 FAR *X, - F32 FAR *Y, - F32 FAR *Z); +typedef void (AILCALL FAR * M3D_3D_POSITION)(H3DPOBJECT obj, + F32 FAR *X, + F32 FAR *Y, + F32 FAR *Z); -typedef void (AILCALL FAR * M3D_3D_VELOCITY)(H3DPOBJECT obj, - F32 FAR *dX_per_ms, - F32 FAR *dY_per_ms, - F32 FAR *dZ_per_ms); +typedef void (AILCALL FAR * M3D_3D_VELOCITY)(H3DPOBJECT obj, + F32 FAR *dX_per_ms, + F32 FAR *dY_per_ms, + F32 FAR *dZ_per_ms); -typedef void (AILCALL FAR * M3D_3D_ORIENTATION)(H3DPOBJECT obj, - F32 FAR *X_face, - F32 FAR *Y_face, - F32 FAR *Z_face, - F32 FAR *X_up, - F32 FAR *Y_up, - F32 FAR *Z_up); +typedef void (AILCALL FAR * M3D_3D_ORIENTATION)(H3DPOBJECT obj, + F32 FAR *X_face, + F32 FAR *Y_face, + F32 FAR *Z_face, + F32 FAR *X_up, + F32 FAR *Y_up, + F32 FAR *Z_up); -typedef void (AILCALL FAR * M3D_3D_UPDATE_POSITION)(H3DPOBJECT obj, - F32 dt_milliseconds); +typedef void (AILCALL FAR * M3D_3D_UPDATE_POSITION)(H3DPOBJECT obj, + F32 dt_milliseconds); -typedef void (AILCALL FAR * M3D_3D_AUTO_UPDATE_POSITION)(H3DPOBJECT obj, - S32 enable); +typedef void (AILCALL FAR * M3D_3D_AUTO_UPDATE_POSITION)(H3DPOBJECT obj, + S32 enable); //############################################################################ -//## ## -//## Interface "MSS mixer services" ## -//## ## +//## ## +//## Interface "MSS mixer services" ## +//## ## //############################################################################ // // Operation flags used by mixer module // -#define M_DEST_STEREO 1 // Set to enable stereo mixer output -#define M_SRC_16 2 // Set to enable mixing of 16-bit samples -#define M_FILTER 4 // Set to enable filtering when resampling -#define M_SRC_STEREO 8 // Set to enable mixing of stereo input samples -#define M_VOL_SCALING 16 // Set to enable volume scalars other than 2047 -#define M_RESAMPLE 32 // Set to enable playback ratios other than 65536 -#define M_ORDER 64 // Set to reverse L/R stereo order for sample +#define M_DEST_STEREO 1 // Set to enable stereo mixer output +#define M_SRC_16 2 // Set to enable mixing of 16-bit samples +#define M_FILTER 4 // Set to enable filtering when resampling +#define M_SRC_STEREO 8 // Set to enable mixing of stereo input samples +#define M_VOL_SCALING 16 // Set to enable volume scalars other than 2047 +#define M_RESAMPLE 32 // Set to enable playback ratios other than 65536 +#define M_ORDER 64 // Set to reverse L/R stereo order for sample #ifdef IS_32 @@ -1387,37 +1387,37 @@ typedef void (AILCALL FAR *MIXER_SHUTDOWN)(void); // typedef void (AILCALL FAR *MIXER_FLUSH) (S32 FAR *dest, - S32 len, - S32 FAR *reverb_buffer, - S32 reverb_level, - U32 MMX_available); + S32 len, + S32 FAR *reverb_buffer, + S32 reverb_level, + U32 MMX_available); // // Perform audio mixing operation // typedef void (AILCALL FAR *MIXER_MERGE) (void FAR * FAR *src, - U32 FAR *src_fract, - void FAR *src_end, - S32 FAR * FAR *dest, - void FAR *dest_end, - S32 FAR *left_val, - S32 FAR *right_val, - S32 playback_ratio, - S32 scale_left, - S32 scale_right, - U32 operation, - U32 MMX_available); + U32 FAR *src_fract, + void FAR *src_end, + S32 FAR * FAR *dest, + void FAR *dest_end, + S32 FAR *left_val, + S32 FAR *right_val, + S32 playback_ratio, + S32 scale_left, + S32 scale_right, + U32 operation, + U32 MMX_available); // // Translate mixer buffer contents to final output format // typedef void (AILCALL FAR *MIXER_COPY) (void FAR *src, - S32 src_len, - void FAR *dest, - U32 operation, - U32 MMX_available); + S32 src_len, + void FAR *dest, + U32 operation, + U32 MMX_available); #else // @@ -1442,37 +1442,37 @@ typedef void (AILCALL FAR *MIXER_SHUTDOWN)(void); // typedef void (AILCALL FAR *MIXER_FLUSH) (S32 FAR *dest, - S32 len, - S32 FAR *reverb_buffer, - S32 reverb_level, - U32 MMX_available); + S32 len, + S32 FAR *reverb_buffer, + S32 reverb_level, + U32 MMX_available); // // Perform audio mixing operation // -typedef void (AILCALL FAR *MIXER_MERGE) (U32 src_sel, - U32 dest_sel, - U32 FAR *src_fract, - U32 FAR *src_offset, - U32 FAR *dest_offset, - U32 src_end_offset, - U32 dest_end_offset, - S32 FAR *left_val, - S32 FAR *right_val, - S32 playback_ratio, - S32 scale_both, - U32 operation); +typedef void (AILCALL FAR *MIXER_MERGE) (U32 src_sel, + U32 dest_sel, + U32 FAR *src_fract, + U32 FAR *src_offset, + U32 FAR *dest_offset, + U32 src_end_offset, + U32 dest_end_offset, + S32 FAR *left_val, + S32 FAR *right_val, + S32 playback_ratio, + S32 scale_both, + U32 operation); // // Translate mixer buffer contents to final output format // typedef void (AILCALL FAR *MIXER_COPY) (void FAR *src, - S32 src_len, - void FAR *dest, - U32 operation, - U32 MMX_available); + S32 src_len, + void FAR *dest, + U32 operation, + U32 MMX_available); #endif // @@ -1483,15 +1483,15 @@ struct _DIG_DRIVER; struct _MDI_DRIVER; -typedef struct _DIG_DRIVER FAR * HDIGDRIVER; // Handle to digital driver +typedef struct _DIG_DRIVER FAR * HDIGDRIVER; // Handle to digital driver -typedef struct _MDI_DRIVER FAR * HMDIDRIVER; // Handle to XMIDI driver +typedef struct _MDI_DRIVER FAR * HMDIDRIVER; // Handle to XMIDI driver -typedef struct _SAMPLE FAR * HSAMPLE; // Handle to sample +typedef struct _SAMPLE FAR * HSAMPLE; // Handle to sample -typedef struct _SEQUENCE FAR * HSEQUENCE; // Handle to sequence +typedef struct _SEQUENCE FAR * HSEQUENCE; // Handle to sequence -typedef S32 HTIMER; // Handle to timer +typedef S32 HTIMER; // Handle to timer #ifdef IS_DOS @@ -1499,7 +1499,7 @@ typedef S32 HTIMER; // Handle to timer // Type definitions // -typedef struct // I/O parameters structure +typedef struct // I/O parameters structure { S16 IO; S16 IRQ; @@ -1509,31 +1509,31 @@ typedef struct // I/O parameters structure } IO_PARMS; -typedef struct // Standard MSS 3.X VDI driver header +typedef struct // Standard MSS 3.X VDI driver header { - S8 ID[8]; // "AIL3xxx" ID string, followed by ^Z + S8 ID[8]; // "AIL3xxx" ID string, followed by ^Z - U32 driver_version; + U32 driver_version; REALFAR common_IO_configurations; - U16 num_IO_configurations; + U16 num_IO_configurations; REALFAR environment_string; IO_PARMS IO; - S16 service_rate; + S16 service_rate; - U16 busy; + U16 busy; - U16 driver_num; // Driver number + U16 driver_num; // Driver number - U16 this_ISR; // Offset of INT 66H dispatcher - REALFAR prev_ISR; // Pointer to previous INT 66H ISR + U16 this_ISR; // Offset of INT 66H dispatcher + REALFAR prev_ISR; // Pointer to previous INT 66H ISR - S8 scratch[128]; // Shared scratch workspace + S8 scratch[128]; // Shared scratch workspace - S8 dev_name[80]; // Device name (VDI version >= 1.12 only) + S8 dev_name[80]; // Device name (VDI version >= 1.12 only) } VDI_HDR; @@ -1552,7 +1552,7 @@ DIG_MODE; typedef struct { - U8 format_supported[16]; + U8 format_supported[16]; DIG_MODE format_data[16]; } DIG_DDT; @@ -1561,7 +1561,7 @@ typedef struct { REALFAR DMA_buffer_A; REALFAR DMA_buffer_B; - S16 active_buffer; + S16 active_buffer; } DIG_DST; @@ -1570,56 +1570,56 @@ typedef struct REALFAR library_environment; REALFAR GTL_suffix; - U16 num_voices; + U16 num_voices; - U16 max_melodic_channel; - U16 min_melodic_channel; - U16 percussion_channel; + U16 max_melodic_channel; + U16 min_melodic_channel; + U16 percussion_channel; } MDI_DDT; typedef struct { - S8 library_directory[128]; - S8 GTL_filename[128]; + S8 library_directory[128]; + S8 GTL_filename[128]; - S8 MIDI_data[512]; + S8 MIDI_data[512]; } MDI_DST; -typedef struct // Initialization file structure +typedef struct // Initialization file structure { - char device_name[128]; // Device name - char driver_name[128]; // Driver filename - IO_PARMS IO; // I/O parameters for driver + char device_name[128]; // Device name + char driver_name[128]; // Driver filename + IO_PARMS IO; // I/O parameters for driver } AIL_INI; -typedef struct // Handle to driver +typedef struct // Handle to driver { - REALFAR seg; // Seg:off pointer to driver (off=0) - U32 sel; // Selector for driver (off=0) - void *buf; // Protected-mode pointer to driver - U32 size; // Size of driver image - VDI_HDR *VHDR; // Pointer to driver header (same as buf) - S32 type; // AIL3DIG or AIL3MDI (see below) + REALFAR seg; // Seg:off pointer to driver (off=0) + U32 sel; // Selector for driver (off=0) + void *buf; // Protected-mode pointer to driver + U32 size; // Size of driver image + VDI_HDR *VHDR; // Pointer to driver header (same as buf) + S32 type; // AIL3DIG or AIL3MDI (see below) - S32 initialized; // 1 if hardware successfully init'd, else 0 + S32 initialized; // 1 if hardware successfully init'd, else 0 - S32 PM_ISR; // -1 if no PM ISR hooked, else IRQ # + S32 PM_ISR; // -1 if no PM ISR hooked, else IRQ # - HTIMER server; // DRV_SERVE periodic timer, if requested + HTIMER server; // DRV_SERVE periodic timer, if requested - // Vector to high-level destructor, if any + // Vector to high-level destructor, if any void (AILCALL *destructor)(HDIGDRIVER); - // High-level descriptor (DIG_ or MDI_DRIVER) - void *descriptor; + // High-level descriptor (DIG_ or MDI_DRIVER) + void *descriptor; } AIL_DRIVER; -typedef struct // VDI interface register structure +typedef struct // VDI interface register structure { S16 AX; S16 BX; @@ -1636,13 +1636,13 @@ VDI_CALL; // Function pointer types // -typedef void (AILCALLBACK FAR* AILINCB) (void FAR *data, S32 len, U32 user); +typedef void (AILCALLBACK FAR* AILINCB) (void FAR *data, S32 len, U32 user); -typedef void (AILCALLBACK FAR* AILTIMERCB) (U32 user); +typedef void (AILCALLBACK FAR* AILTIMERCB) (U32 user); typedef void (AILCALLBACK FAR* AILSAMPLECB) (HSAMPLE sample); -typedef S32 (AILCALLBACK FAR* AILEVENTCB) (HMDIDRIVER hmi,HSEQUENCE seq,S32 status,S32 data_1,S32 data_2); +typedef S32 (AILCALLBACK FAR* AILEVENTCB) (HMDIDRIVER hmi,HSEQUENCE seq,S32 status,S32 data_1,S32 data_2); typedef S32 (AILCALLBACK FAR* AILTIMBRECB) (HMDIDRIVER hmi,S32 bank,S32 patch); @@ -1650,7 +1650,7 @@ typedef S32 (AILCALLBACK FAR* AILPREFIXCB) (HSEQUENCE seq,S32 log,S32 data); typedef void (AILCALLBACK FAR* AILTRIGGERCB) (HSEQUENCE seq,S32 log,S32 data); -typedef void (AILCALLBACK FAR* AILBEATCB) (HMDIDRIVER hmi,HSEQUENCE seq,S32 beat,S32 measure); +typedef void (AILCALLBACK FAR* AILBEATCB) (HMDIDRIVER hmi,HSEQUENCE seq,S32 beat,S32 measure); typedef void (AILCALLBACK FAR* AILSEQUENCECB) (HSEQUENCE seq); @@ -1671,8 +1671,8 @@ typedef S32 HDRIVERSTATE; typedef enum { DP_ASI_DECODER=0, // Must be "ASI codec stream" provider - DP_FILTER, // Must be "MSS pipeline filter" provider - DP_MERGE, // Must be "MSS mixer" provider + DP_FILTER, // Must be "MSS pipeline filter" provider + DP_MERGE, // Must be "MSS mixer" provider N_SAMPLE_STAGES, // Placeholder for end of list (= # of valid stages) SAMPLE_ALL_STAGES // Used to signify all pipeline stages, for shutdown } @@ -1680,10 +1680,10 @@ SAMPLESTAGE; typedef enum { - DP_FLUSH = 0, // Must be "MSS mixer" provider + DP_FLUSH = 0, // Must be "MSS mixer" provider DP_DEFAULT_FILTER, // Must be "MSS pipeline filter" provider (sets the default) DP_DEFAULT_MERGE, // Must be "MSS mixer" provider (sets the default) - DP_COPY, // Must be "MSS mixer" provider + DP_COPY, // Must be "MSS mixer" provider N_DIGDRV_STAGES, // Placeholder for end of list (= # of valid stages) DIGDRV_ALL_STAGES // Used to signify all pipeline stages, for shutdown } @@ -1691,11 +1691,11 @@ DIGDRVSTAGE; typedef struct { - ASI_STREAM_OPEN ASI_stream_open; - ASI_STREAM_PROCESS ASI_stream_process; - ASI_STREAM_SEEK ASI_stream_seek; - ASI_STREAM_CLOSE ASI_stream_close; - ASI_STREAM_ATTRIBUTE ASI_stream_attribute; + ASI_STREAM_OPEN ASI_stream_open; + ASI_STREAM_PROCESS ASI_stream_process; + ASI_STREAM_SEEK ASI_stream_seek; + ASI_STREAM_CLOSE ASI_stream_close; + ASI_STREAM_ATTRIBUTE ASI_stream_attribute; ASI_STREAM_SET_PREFERENCE ASI_stream_set_preference; HATTRIB INPUT_BIT_RATE; @@ -1731,21 +1731,21 @@ MIXSTAGE; typedef struct { struct _FLTPROVIDER FAR *provider; - HSAMPLESTATE sample_state; + HSAMPLESTATE sample_state; } FLTSTAGE; typedef struct { - S32 active; // Pass-through if 0, active if 1 + S32 active; // Pass-through if 0, active if 1 HPROVIDER provider; union - { - ASISTAGE ASI; - MIXSTAGE MIX; - FLTSTAGE FLT; - } + { + ASISTAGE ASI; + MIXSTAGE MIX; + FLTSTAGE FLT; + } TYPE; } DPINFO; @@ -1761,32 +1761,32 @@ typedef enum _AILDUPMODE } AILDUPMODE; -#define AIL_FORCE_DUPLEX 1 // Force specified duplex mode to be used, else fail -#define AIL_FORCE_MODE 2 // Force specified format/rate to be used, else fail -#define AIL_FORCE_BUFSIZE 4 // Force specified input buffer size to be used, else fail +#define AIL_FORCE_DUPLEX 1 // Force specified duplex mode to be used, else fail +#define AIL_FORCE_MODE 2 // Force specified format/rate to be used, else fail +#define AIL_FORCE_BUFSIZE 4 // Force specified input buffer size to be used, else fail -typedef struct _AILINPUTINFO // Input descriptor type +typedef struct _AILINPUTINFO // Input descriptor type { - U32 device_ID; // DS LPGUID or wave device ID - U32 hardware_format; // e.g., DIG_F_STEREO_16 - U32 hardware_rate; // e.g., 22050 - AILDUPMODE duplex_mode; // AIL_HALF_DUPLEX | AIL_FULL_DUPLEX - AILINCB callback; // Callback function to receive incoming data - S32 buffer_size; // Maximum # of bytes to be passed to callback (-1 to use DIG_INPUT_LATENCY) + U32 device_ID; // DS LPGUID or wave device ID + U32 hardware_format; // e.g., DIG_F_STEREO_16 + U32 hardware_rate; // e.g., 22050 + AILDUPMODE duplex_mode; // AIL_HALF_DUPLEX | AIL_FULL_DUPLEX + AILINCB callback; // Callback function to receive incoming data + S32 buffer_size; // Maximum # of bytes to be passed to callback (-1 to use DIG_INPUT_LATENCY) } AILINPUTINFO; -typedef struct _AILTIMER // Timer instance +typedef struct _AILTIMER // Timer instance { - U32 status; + U32 status; AILTIMERCB callback; - U32 user; + U32 user; - S32 elapsed; - S32 value; - S32 callingCT; // Calling EXE's task number (16 bit only) - S32 callingDS; // Calling EXE's DS (used in 16 bit only) - S32 IsWin32s; // Is this a Win32s callback + S32 elapsed; + S32 value; + S32 callingCT; // Calling EXE's task number (16 bit only) + S32 callingDS; // Calling EXE's DS (used in 16 bit only) + S32 IsWin32s; // Is this a Win32s callback } AILTIMERSTR; typedef struct _ADPCMDATATAG @@ -1804,81 +1804,81 @@ typedef struct _ADPCMDATATAG U16 moresamples[16]; } ADPCMDATA; -typedef struct _SAMPLE // Sample instance +typedef struct _SAMPLE // Sample instance { - char tag[4]; // HSAM + char tag[4]; // HSAM - HDIGDRIVER driver; // Driver for playback + HDIGDRIVER driver; // Driver for playback - U32 status; // SMP_ flags: _FREE, _DONE, _PLAYING + U32 status; // SMP_ flags: _FREE, _DONE, _PLAYING - void FAR *start[2]; // Sample buffer address (W) - U32 len [2]; // Sample buffer size in bytes (W) - U32 pos [2]; // Index to next byte (R/W) - U32 done [2]; // Nonzero if buffer with len=0 sent by app + void FAR *start[2]; // Sample buffer address (W) + U32 len [2]; // Sample buffer size in bytes (W) + U32 pos [2]; // Index to next byte (R/W) + U32 done [2]; // Nonzero if buffer with len=0 sent by app - U32 src_fract; // Fractional part of source address - S32 left_val; // Mixer source value from end of last buffer - S32 right_val; // Mixer source value from end of last buffer + U32 src_fract; // Fractional part of source address + S32 left_val; // Mixer source value from end of last buffer + S32 right_val; // Mixer source value from end of last buffer - S32 current_buffer; // Buffer # active (0/1) - S32 last_buffer; // Last active buffer (for double-buffering) - S32 starved; // Buffer stream has run out of data + S32 current_buffer; // Buffer # active (0/1) + S32 last_buffer; // Last active buffer (for double-buffering) + S32 starved; // Buffer stream has run out of data - S32 loop_count; // # of cycles-1 (1=one-shot, 0=indefinite) - S32 loop_start; // Starting offset of loop block (0=SOF) - S32 loop_end; // End offset of loop block (-1=EOF) + S32 loop_count; // # of cycles-1 (1=one-shot, 0=indefinite) + S32 loop_start; // Starting offset of loop block (0=SOF) + S32 loop_end; // End offset of loop block (-1=EOF) - S32 format; // DIG_F format (8/16 bits, mono/stereo) - U32 flags; // DIG_PCM_SIGN / DIG_PCM_ORDER (stereo only) + S32 format; // DIG_F format (8/16 bits, mono/stereo) + U32 flags; // DIG_PCM_SIGN / DIG_PCM_ORDER (stereo only) - S32 playback_rate; // Playback rate in hertz + S32 playback_rate; // Playback rate in hertz - S32 volume; // Sample volume 0-127 - S32 pan; // Mono panpot/stereo balance (0=L ... 127=R) + S32 volume; // Sample volume 0-127 + S32 pan; // Mono panpot/stereo balance (0=L ... 127=R) - S32 left_scale; // Left/mono volume scalar 0-2047 - S32 right_scale; // Right volume scalar 0-2047 + S32 left_scale; // Left/mono volume scalar 0-2047 + S32 right_scale; // Right volume scalar 0-2047 - S32 service_type; // 1 if single-buffered; 2 if streamed + S32 service_type; // 1 if single-buffered; 2 if streamed - AILSAMPLECB SOB; // Start-of-block callback function - AILSAMPLECB EOB; // End-of-buffer callback function - AILSAMPLECB EOS; // End-of-sample callback function + AILSAMPLECB SOB; // Start-of-block callback function + AILSAMPLECB EOB; // End-of-buffer callback function + AILSAMPLECB EOS; // End-of-sample callback function - S32 user_data [8]; // Miscellaneous user data - S32 system_data[8]; // Miscellaneous system data + S32 user_data [8]; // Miscellaneous user data + S32 system_data[8]; // Miscellaneous system data ADPCMDATA adpcm; #ifdef IS_WINDOWS - S32 SOB_IsWin32s; // Is this a Win32s callback - S32 EOB_IsWin32s; // Is this a Win32s callback - S32 EOS_IsWin32s; // Is this a Win32s callback + S32 SOB_IsWin32s; // Is this a Win32s callback + S32 EOB_IsWin32s; // Is this a Win32s callback + S32 EOS_IsWin32s; // Is this a Win32s callback // // DirectSound-specific data // - S32 secondary_buffer; // Secondary buffer index + S32 secondary_buffer; // Secondary buffer index - S32 service_interval; // Service sample every n ms - S32 service_tick; // Current service countdown value - S32 buffer_segment_size; // Buffer segment size to fill + S32 service_interval; // Service sample every n ms + S32 service_tick; // Current service countdown value + S32 buffer_segment_size; // Buffer segment size to fill - S32 prev_segment; // Previous segment # (0...n) - S32 prev_cursor; // Previous play cursor location + S32 prev_segment; // Previous segment # (0...n) + S32 prev_cursor; // Previous play cursor location - S32 bytes_remaining; // # of bytes left to play (if not -1) + S32 bytes_remaining; // # of bytes left to play (if not -1) - S32 direct_control; // 1 if app controls buffer, 0 if MSS + S32 direct_control; // 1 if app controls buffer, 0 if MSS #endif - S32 doeob; // Flags to trigger callbacks - S32 dosob; - S32 doeos; + S32 doeob; // Flags to trigger callbacks + S32 dosob; + S32 doeos; // // Sample pipeline stages @@ -1890,10 +1890,10 @@ typedef struct _SAMPLE // Sample instance // Reverb parms // - F32 reverb_level; // Level [0.0, 1.0] - F32 reverb_reflect_time; // Reflect time in milliseconds - F32 reverb_decay_time; // Decay time [0.1, 20.0] - S32 base_scale; // Original 12-bit volume scalar + F32 reverb_level; // Level [0.0, 1.0] + F32 reverb_reflect_time; // Reflect time in milliseconds + F32 reverb_decay_time; // Decay time [0.1, 20.0] + S32 base_scale; // Original 12-bit volume scalar } SAMPLE; @@ -1901,70 +1901,70 @@ SAMPLE; typedef struct _DIG_INPUT_DRIVER FAR *HDIGINPUT; // Handle to digital input driver -typedef struct _DIG_INPUT_DRIVER // Handle to digital input driver +typedef struct _DIG_INPUT_DRIVER // Handle to digital input driver { - C8 tag[4]; // HDIN + C8 tag[4]; // HDIN - HTIMER background_timer; // Background timer handle + HTIMER background_timer; // Background timer handle - AILINPUTINFO info; // Input device descriptor - U32 callback_user; // Callback user value + AILINPUTINFO info; // Input device descriptor + U32 callback_user; // Callback user value // // Provider-independent data // - U32 DMA_size; // Size of each DMA sub-buffer in bytes - void FAR *DMA[2]; // Simulated DMA buffers + U32 DMA_size; // Size of each DMA sub-buffer in bytes + void FAR *DMA[2]; // Simulated DMA buffers - U8 silence; // Silence value for current format (0 or 128) + U8 silence; // Silence value for current format (0 or 128) - S32 input_enabled; // 1 if enabled, 0 if not - S32 device_active; // 1 if buffers submittable, 0 if not + S32 input_enabled; // 1 if enabled, 0 if not + S32 device_active; // 1 if buffers submittable, 0 if not // // waveOut-specific data // - HWAVEIN hWaveIn; // Handle to wave input device - volatile WAVEHDR wavehdr[2]; // Handles to wave headers + HWAVEIN hWaveIn; // Handle to wave input device + volatile WAVEHDR wavehdr[2]; // Handles to wave headers } DIG_INPUT_DRIVER; #endif -typedef struct _DIG_DRIVER // Handle to digital audio driver +typedef struct _DIG_DRIVER // Handle to digital audio driver { - char tag[4]; // HDIG + char tag[4]; // HDIG - HTIMER backgroundtimer; // Background timer handle + HTIMER backgroundtimer; // Background timer handle - S32 quiet; // # of consecutive quiet sample periods + S32 quiet; // # of consecutive quiet sample periods - S32 n_active_samples; // # of samples being processed + S32 n_active_samples; // # of samples being processed - S32 master_volume; // Master sample volume 0-127 + S32 master_volume; // Master sample volume 0-127 - S32 DMA_rate; // Hardware sample rate - S32 hw_format; // DIG_F code in use - U32 hw_mode_flags; // DIG_PCM_ flags for mode in use + S32 DMA_rate; // Hardware sample rate + S32 hw_format; // DIG_F code in use + U32 hw_mode_flags; // DIG_PCM_ flags for mode in use - S32 channels_per_sample; // # of channels per sample (1 or 2) - S32 bytes_per_channel; // # of bytes per channel (1 or 2) - S32 channels_per_buffer; // # of channels per half-buffer - S32 samples_per_buffer; // # of samples per half-buffer + S32 channels_per_sample; // # of channels per sample (1 or 2) + S32 bytes_per_channel; // # of bytes per channel (1 or 2) + S32 channels_per_buffer; // # of channels per half-buffer + S32 samples_per_buffer; // # of samples per half-buffer - S32 playing; // Playback active if non-zero + S32 playing; // Playback active if non-zero - HSAMPLE samples; // Pointer to list of SAMPLEs - S32 n_samples; // # of SAMPLEs + HSAMPLE samples; // Pointer to list of SAMPLEs + S32 n_samples; // # of SAMPLEs - S32 build_size; // # of bytes in build buffer - S32 FAR *build_buffer; // Build buffer (4 * samples_per_buffer) + S32 build_size; // # of bytes in build buffer + S32 FAR *build_buffer; // Build buffer (4 * samples_per_buffer) - S32 system_data[8]; // Miscellaneous system data + S32 system_data[8]; // Miscellaneous system data - S32 buffer_size; // Size of each output buffer + S32 buffer_size; // Size of each output buffer #ifdef IS_WINDOWS @@ -1972,51 +1972,51 @@ typedef struct _DIG_DRIVER // Handle to digital audio driver // waveOut-specific interface data // - HWAVEOUT hWaveOut; // Wave output driver + HWAVEOUT hWaveOut; // Wave output driver - U32 reset_works; // TRUE if OK to do waveOutReset - U32 request_reset; // If nonzero, do waveOutReset ASAP + U32 reset_works; // TRUE if OK to do waveOutReset + U32 request_reset; // If nonzero, do waveOutReset ASAP - LPWAVEHDR first; // Pointer to first WAVEHDR in chain - S32 n_buffers; // # of output WAVEHDRs in chain + LPWAVEHDR first; // Pointer to first WAVEHDR in chain + S32 n_buffers; // # of output WAVEHDRs in chain LPWAVEHDR volatile FAR *return_list; // Circular list of returned WAVEHDRs - S32 volatile return_head; // Head of WAVEHDR list (insertion point) - S32 volatile return_tail; // Tail of WAVEHDR list (retrieval point) + S32 volatile return_head; // Head of WAVEHDR list (insertion point) + S32 volatile return_tail; // Tail of WAVEHDR list (retrieval point) - U32 deviceid; // id from waveout open - PCMWAVEFORMAT wformat; // format from waveout open + U32 deviceid; // id from waveout open + PCMWAVEFORMAT wformat; // format from waveout open // // DirectSound-specific interface data // - U32 guid; // The guid id of the ds driver - AILLPDIRECTSOUND pDS; // DirectSound output driver (don't - // use with Smacker directly anymore!) + U32 guid; // The guid id of the ds driver + AILLPDIRECTSOUND pDS; // DirectSound output driver (don't + // use with Smacker directly anymore!) - S32 emulated_ds; // is ds emulated or not? - AILLPDIRECTSOUNDBUFFER lppdsb; // primary buffer or null + S32 emulated_ds; // is ds emulated or not? + AILLPDIRECTSOUNDBUFFER lppdsb; // primary buffer or null - U32 dsHwnd; // HWND used with DirectSound + U32 dsHwnd; // HWND used with DirectSound AILLPDIRECTSOUNDBUFFER FAR * lpbufflist; // List of pointers to secondary buffers - HSAMPLE FAR *samp_list; // HSAMPLE associated with each buffer - S32 FAR *sec_format; // DIG_F_ format for secondary buffer - S32 max_buffs; // Max. allowable # of secondary buffers + HSAMPLE FAR *samp_list; // HSAMPLE associated with each buffer + S32 FAR *sec_format; // DIG_F_ format for secondary buffer + S32 max_buffs; // Max. allowable # of secondary buffers // // Misc. data // - S32 released; // has the sound manager been released? + S32 released; // has the sound manager been released? - U32 foreground_timer; // Foreground timer handle + U32 foreground_timer; // Foreground timer handle - HDIGDRIVER next; // Pointer to next HDIGDRIVER in use - S32 callingCT; // Calling EXE's task number (16 bit only) - S32 callingDS; // Calling EXE's DS (used in 16 bit only) + HDIGDRIVER next; // Pointer to next HDIGDRIVER in use + S32 callingCT; // Calling EXE's task number (16 bit only) + S32 callingDS; // Calling EXE's DS (used in 16 bit only) // // Vars for waveOut emulation @@ -2024,44 +2024,44 @@ typedef struct _DIG_DRIVER // Handle to digital audio driver S32 DS_initialized; - AILLPDIRECTSOUNDBUFFER DS_sec_buff; // Secondary buffer (or NULL if none) - AILLPDIRECTSOUNDBUFFER DS_out_buff; // Output buffer (may be sec or prim) - S32 DS_buffer_size; // Size of entire output buffer + AILLPDIRECTSOUNDBUFFER DS_sec_buff; // Secondary buffer (or NULL if none) + AILLPDIRECTSOUNDBUFFER DS_out_buff; // Output buffer (may be sec or prim) + S32 DS_buffer_size; // Size of entire output buffer - S32 DS_frag_cnt; // Total fragment count and size, and - S32 DS_frag_size; // last fragment occupied by play cursor + S32 DS_frag_cnt; // Total fragment count and size, and + S32 DS_frag_size; // last fragment occupied by play cursor S32 DS_last_frag; S32 DS_last_write; S32 DS_last_timer; S32 DS_skip_time; - S32 DS_use_default_format; // 1 to force use of default DS primary buffer format + S32 DS_use_default_format; // 1 to force use of default DS primary buffer format #else // must be first in the DOS section - void *DMA[2]; // Protected-mode pointers to half-buffers - // (note that DMA[0] may != DMA_buf) + void *DMA[2]; // Protected-mode pointers to half-buffers + // (note that DMA[0] may != DMA_buf) - REALFAR DMA_seg; // Seg:off pointer to DMA buffers (off=0) - U32 DMA_sel; // Selector for DMA buffers (off=0) - void *DMA_buf; // Protected-mode pointer to DMA buffers + REALFAR DMA_seg; // Seg:off pointer to DMA buffers (off=0) + U32 DMA_sel; // Selector for DMA buffers (off=0) + void *DMA_buf; // Protected-mode pointer to DMA buffers - S16 *buffer_flag; // Protected-mode pointer to buffer flag - S32 last_buffer; // Last active buffer flag value in driver + S16 *buffer_flag; // Protected-mode pointer to buffer flag + S32 last_buffer; // Last active buffer flag value in driver - AIL_DRIVER *drvr; // Base driver descriptor + AIL_DRIVER *drvr; // Base driver descriptor - DIG_DDT *DDT; // Protected-mode pointer to DDT - DIG_DST *DST; // Protected-mode pointer to DST + DIG_DDT *DDT; // Protected-mode pointer to DDT + DIG_DST *DST; // Protected-mode pointer to DST #endif - S32 use_MMX; // Use MMX with this driver if TRUE + S32 use_MMX; // Use MMX with this driver if TRUE - void FAR *decode_buffer; // Buffer used by optional ASI pipeline decoder - S32 decode_buffer_size; // # of bytes in decode buffer + void FAR *decode_buffer; // Buffer used by optional ASI pipeline decoder + S32 decode_buffer_size; // # of bytes in decode buffer U32 us_count; U32 ms_count; @@ -2079,176 +2079,176 @@ typedef struct _DIG_DRIVER // Handle to digital audio driver // S32 FAR *reverb_buffer; - S32 reverb_buffer_size; - S32 reverb_buffer_position; + S32 reverb_buffer_size; + S32 reverb_buffer_position; } DIG_DRIVER; -typedef struct // MIDI status log structure +typedef struct // MIDI status log structure { - S32 program [NUM_CHANS]; // Program Change - S32 pitch_l [NUM_CHANS]; // Pitch Bend LSB - S32 pitch_h [NUM_CHANS]; // Pitch Bend MSB + S32 program [NUM_CHANS]; // Program Change + S32 pitch_l [NUM_CHANS]; // Pitch Bend LSB + S32 pitch_h [NUM_CHANS]; // Pitch Bend MSB - S32 c_lock [NUM_CHANS]; // Channel Lock - S32 c_prot [NUM_CHANS]; // Channel Lock Protection - S32 c_mute [NUM_CHANS]; // Channel Mute - S32 c_v_prot [NUM_CHANS]; // Voice Protection - S32 bank [NUM_CHANS]; // Patch Bank Select - S32 gm_bank_l [NUM_CHANS]; // GM Bank Select - S32 gm_bank_m [NUM_CHANS]; // GM Bank Select - S32 indirect [NUM_CHANS]; // ICA indirect controller value - S32 callback [NUM_CHANS]; // Callback Trigger + S32 c_lock [NUM_CHANS]; // Channel Lock + S32 c_prot [NUM_CHANS]; // Channel Lock Protection + S32 c_mute [NUM_CHANS]; // Channel Mute + S32 c_v_prot [NUM_CHANS]; // Voice Protection + S32 bank [NUM_CHANS]; // Patch Bank Select + S32 gm_bank_l [NUM_CHANS]; // GM Bank Select + S32 gm_bank_m [NUM_CHANS]; // GM Bank Select + S32 indirect [NUM_CHANS]; // ICA indirect controller value + S32 callback [NUM_CHANS]; // Callback Trigger - S32 mod [NUM_CHANS]; // Modulation - S32 vol [NUM_CHANS]; // Volume - S32 pan [NUM_CHANS]; // Panpot - S32 exp [NUM_CHANS]; // Expression - S32 sus [NUM_CHANS]; // Sustain - S32 reverb [NUM_CHANS]; // Reverb - S32 chorus [NUM_CHANS]; // Chorus + S32 mod [NUM_CHANS]; // Modulation + S32 vol [NUM_CHANS]; // Volume + S32 pan [NUM_CHANS]; // Panpot + S32 exp [NUM_CHANS]; // Expression + S32 sus [NUM_CHANS]; // Sustain + S32 reverb [NUM_CHANS]; // Reverb + S32 chorus [NUM_CHANS]; // Chorus - S32 bend_range[NUM_CHANS]; // Bender Range (data MSB, RPN 0 assumed) + S32 bend_range[NUM_CHANS]; // Bender Range (data MSB, RPN 0 assumed) - S32 RPN_L [NUM_CHANS]; // RPN # LSB - S32 RPN_M [NUM_CHANS]; // RPN # MSB + S32 RPN_L [NUM_CHANS]; // RPN # LSB + S32 RPN_M [NUM_CHANS]; // RPN # MSB } CTRL_LOG; -typedef struct _SEQUENCE // XMIDI sequence state table +typedef struct _SEQUENCE // XMIDI sequence state table { - char tag[4]; // HSEQ + char tag[4]; // HSEQ - HMDIDRIVER driver; // Driver for playback + HMDIDRIVER driver; // Driver for playback - U32 status; // SEQ_ flags + U32 status; // SEQ_ flags - void FAR *TIMB; // XMIDI IFF chunk pointers - void FAR *RBRN; - void FAR *EVNT; + void FAR *TIMB; // XMIDI IFF chunk pointers + void FAR *RBRN; + void FAR *EVNT; - U8 FAR *EVNT_ptr; // Current event pointer + U8 FAR *EVNT_ptr; // Current event pointer - U8 FAR *ICA; // Indirect Controller Array + U8 FAR *ICA; // Indirect Controller Array - AILPREFIXCB prefix_callback; // XMIDI Callback Prefix handler - AILTRIGGERCB trigger_callback; // XMIDI Callback Trigger handler - AILBEATCB beat_callback; // XMIDI beat/bar change handler - AILSEQUENCECB EOS; // End-of-sequence callback function + AILPREFIXCB prefix_callback; // XMIDI Callback Prefix handler + AILTRIGGERCB trigger_callback; // XMIDI Callback Trigger handler + AILBEATCB beat_callback; // XMIDI beat/bar change handler + AILSEQUENCECB EOS; // End-of-sequence callback function - S32 loop_count; // 0=one-shot, -1=indefinite, ... + S32 loop_count; // 0=one-shot, -1=indefinite, ... - S32 interval_count; // # of intervals until next event - S32 interval_num; // # of intervals since start + S32 interval_count; // # of intervals until next event + S32 interval_num; // # of intervals since start - S32 volume; // Sequence volume 0-127 - S32 volume_target; // Target sequence volume 0-127 - S32 volume_accum; // Accumulated volume period - S32 volume_period; // Period for volume stepping + S32 volume; // Sequence volume 0-127 + S32 volume_target; // Target sequence volume 0-127 + S32 volume_accum; // Accumulated volume period + S32 volume_period; // Period for volume stepping - S32 tempo_percent; // Relative tempo percentage 0-100 - S32 tempo_target; // Target tempo 0-100 - S32 tempo_accum; // Accumulated tempo period - S32 tempo_period; // Period for tempo stepping - S32 tempo_error; // Error counter for tempo DDA + S32 tempo_percent; // Relative tempo percentage 0-100 + S32 tempo_target; // Target tempo 0-100 + S32 tempo_accum; // Accumulated tempo period + S32 tempo_period; // Period for tempo stepping + S32 tempo_error; // Error counter for tempo DDA - S32 beat_count; // Sequence playback position - S32 measure_count; + S32 beat_count; // Sequence playback position + S32 measure_count; - S32 time_numerator; // Sequence timing data - S32 time_fraction; - S32 beat_fraction; - S32 time_per_beat; + S32 time_numerator; // Sequence timing data + S32 time_fraction; + S32 beat_fraction; + S32 time_per_beat; - void FAR *FOR_ptrs [FOR_NEST]; // Loop stack - S32 FOR_loop_count [FOR_NEST]; + void FAR *FOR_ptrs [FOR_NEST]; // Loop stack + S32 FOR_loop_count [FOR_NEST]; - S32 chan_map [NUM_CHANS]; // Physical channel map for sequence + S32 chan_map [NUM_CHANS]; // Physical channel map for sequence - CTRL_LOG shadow; // Controller values for sequence + CTRL_LOG shadow; // Controller values for sequence - S32 note_count; // # of notes "on" + S32 note_count; // # of notes "on" - S32 note_chan [MAX_NOTES]; // Channel for queued note (-1=free) - S32 note_num [MAX_NOTES]; // Note # for queued note - S32 note_time [MAX_NOTES]; // Remaining duration in intervals + S32 note_chan [MAX_NOTES]; // Channel for queued note (-1=free) + S32 note_num [MAX_NOTES]; // Note # for queued note + S32 note_time [MAX_NOTES]; // Remaining duration in intervals - S32 user_data [8]; // Miscellaneous user data - S32 system_data[8]; // Miscellaneous system data + S32 user_data [8]; // Miscellaneous user data + S32 system_data[8]; // Miscellaneous system data #ifdef IS_WINDOWS - S32 PREFIX_IsWin32s; // Is this a Win32s callback - S32 TRIGGER_IsWin32s; // Is this a Win32s callback - S32 BEAT_IsWin32s; // Is this a Win32s callback - S32 EOS_IsWin32s; // Is this a Win32s callback + S32 PREFIX_IsWin32s; // Is this a Win32s callback + S32 TRIGGER_IsWin32s; // Is this a Win32s callback + S32 BEAT_IsWin32s; // Is this a Win32s callback + S32 EOS_IsWin32s; // Is this a Win32s callback #endif } SEQUENCE; -typedef struct _MDI_DRIVER // Handle to XMIDI driver +typedef struct _MDI_DRIVER // Handle to XMIDI driver { - char tag[4]; // HMDI + char tag[4]; // HMDI - HTIMER timer; // XMIDI quantization timer - S32 interval_time; // XMIDI quantization timer interval in uS + HTIMER timer; // XMIDI quantization timer + S32 interval_time; // XMIDI quantization timer interval in uS - S32 disable; // > 0 to disable XMIDI service + S32 disable; // > 0 to disable XMIDI service - HSEQUENCE sequences; // Pointer to list of SEQUENCEs - S32 n_sequences; // # of SEQUENCEs + HSEQUENCE sequences; // Pointer to list of SEQUENCEs + S32 n_sequences; // # of SEQUENCEs - S32 lock [NUM_CHANS]; // 1 if locked, 2 if protected, else 0 + S32 lock [NUM_CHANS]; // 1 if locked, 2 if protected, else 0 HSEQUENCE locker[NUM_CHANS]; // HSEQUENCE which locked channel HSEQUENCE owner [NUM_CHANS]; // HSEQUENCE which owned locked channel HSEQUENCE user [NUM_CHANS]; // Last sequence to use channel - S32 state [NUM_CHANS]; // Lock state prior to being locked + S32 state [NUM_CHANS]; // Lock state prior to being locked - S32 notes [NUM_CHANS]; // # of active notes in channel + S32 notes [NUM_CHANS]; // # of active notes in channel - AILEVENTCB event_trap; // MIDI event trap callback function - AILTIMBRECB timbre_trap; // Timbre request callback function + AILEVENTCB event_trap; // MIDI event trap callback function + AILTIMBRECB timbre_trap; // Timbre request callback function - S32 master_volume; // Master XMIDI note volume 0-127 + S32 master_volume; // Master XMIDI note volume 0-127 - S32 system_data[8]; // Miscellaneous system data + S32 system_data[8]; // Miscellaneous system data #ifdef IS_WINDOWS - S32 EVENT_IsWin32s; // Is this a Win32s callback - S32 TIMBRE_IsWin32s; // Is this a Win32s callback + S32 EVENT_IsWin32s; // Is this a Win32s callback + S32 TIMBRE_IsWin32s; // Is this a Win32s callback - MIDIHDR FAR *mhdr; // SysEx header - U8 FAR *sysdata; // SysEx buffer + MIDIHDR FAR *mhdr; // SysEx header + U8 FAR *sysdata; // SysEx buffer - HMDIDRIVER next; // Pointer to next HMDIDRIVER in use - S32 callingCT; // Calling EXE's task number (16 bit only) - S32 callingDS; // Calling EXE's DS (used in 16 bit only) + HMDIDRIVER next; // Pointer to next HMDIDRIVER in use + S32 callingCT; // Calling EXE's task number (16 bit only) + S32 callingDS; // Calling EXE's DS (used in 16 bit only) - HMIDIOUT hMidiOut; // MIDI output driver - U32 deviceid; // ID of the MIDI device - S32 released; // has the hmidiout handle been released + HMIDIOUT hMidiOut; // MIDI output driver + U32 deviceid; // ID of the MIDI device + S32 released; // has the hmidiout handle been released #else - S32 message_count; // MIDI message count - S32 offset; // MIDI buffer offset + S32 message_count; // MIDI message count + S32 offset; // MIDI buffer offset - AIL_DRIVER *drvr; // Base driver descriptor + AIL_DRIVER *drvr; // Base driver descriptor - MDI_DDT *DDT; // Protected-mode pointer to DDT - MDI_DST *DST; // Protected-mode pointer to DST + MDI_DDT *DDT; // Protected-mode pointer to DDT + MDI_DST *DST; // Protected-mode pointer to DST #endif } MDI_DRIVER; -typedef struct // XMIDI TIMB IFF chunk +typedef struct // XMIDI TIMB IFF chunk { - S8 name[4]; + S8 name[4]; - U8 msb; - U8 lsb; - U8 lsb2; - U8 lsb3; + U8 msb; + U8 lsb; + U8 lsb2; + U8 lsb3; U16 n_entries; @@ -2256,54 +2256,54 @@ typedef struct // XMIDI TIMB IFF chunk } TIMB_chunk; -typedef struct // XMIDI RBRN IFF entry +typedef struct // XMIDI RBRN IFF entry { S16 bnum; U32 offset; } RBRN_entry; -typedef struct // Wave library entry +typedef struct // Wave library entry { - S32 bank; // XMIDI bank, MIDI patch for sample + S32 bank; // XMIDI bank, MIDI patch for sample S32 patch; - S32 root_key; // Root MIDI note # for sample (or -1) + S32 root_key; // Root MIDI note # for sample (or -1) - U32 file_offset; // Offset of wave data from start-of-file - U32 size; // Size of wave sample in bytes + U32 file_offset; // Offset of wave data from start-of-file + U32 size; // Size of wave sample in bytes - S32 format; // DIG_F format (8/16 bits, mono/stereo) - U32 flags; // DIG_PCM_SIGN / DIG_PCM_ORDER (stereo) - S32 playback_rate; // Playback rate in hertz + S32 format; // DIG_F format (8/16 bits, mono/stereo) + U32 flags; // DIG_PCM_SIGN / DIG_PCM_ORDER (stereo) + S32 playback_rate; // Playback rate in hertz } WAVE_ENTRY; -typedef struct // Virtual "wave synthesizer" descriptor +typedef struct // Virtual "wave synthesizer" descriptor { - HMDIDRIVER mdi; // MIDI driver for use with synthesizer - HDIGDRIVER dig; // Digital driver for use with synthesizer + HMDIDRIVER mdi; // MIDI driver for use with synthesizer + HDIGDRIVER dig; // Digital driver for use with synthesizer - WAVE_ENTRY FAR *library; // Pointer to wave library + WAVE_ENTRY FAR *library; // Pointer to wave library - AILEVENTCB prev_event_fn; // Previous MIDI event trap function - AILTIMBRECB prev_timb_fn; // Previous timbre request trap function + AILEVENTCB prev_event_fn; // Previous MIDI event trap function + AILTIMBRECB prev_timb_fn; // Previous timbre request trap function - CTRL_LOG controls; // MIDI controller states + CTRL_LOG controls; // MIDI controller states WAVE_ENTRY FAR *wave [NUM_CHANS];// Pointer to WAVE_ENTRY for each channel - HSAMPLE S [MAX_W_VOICES]; // List of HSAMPLE voices - S32 n_voices; // Actual # of voices allocated to synth + HSAMPLE S [MAX_W_VOICES]; // List of HSAMPLE voices + S32 n_voices; // Actual # of voices allocated to synth - S32 chan [MAX_W_VOICES]; // MIDI channel for each voice, or -1 - S32 note [MAX_W_VOICES]; // MIDI note number for voice - S32 root [MAX_W_VOICES]; // MIDI root note for voice - S32 rate [MAX_W_VOICES]; // Playback rate for voice - S32 vel [MAX_W_VOICES]; // MIDI note velocity for voice - U32 time [MAX_W_VOICES]; // Timestamp for voice + S32 chan [MAX_W_VOICES]; // MIDI channel for each voice, or -1 + S32 note [MAX_W_VOICES]; // MIDI note number for voice + S32 root [MAX_W_VOICES]; // MIDI root note for voice + S32 rate [MAX_W_VOICES]; // Playback rate for voice + S32 vel [MAX_W_VOICES]; // MIDI note velocity for voice + U32 time [MAX_W_VOICES]; // Timestamp for voice - U32 event; // Event counter for LRU timestamps + U32 event; // Event counter for LRU timestamps } WAVE_SYNTH; @@ -2332,19 +2332,19 @@ extern volatile S32 AIL_bkgnd_flag; // Global preference array // -extern S32 AIL_preference [N_PREFS]; +extern S32 AIL_preference [N_PREFS]; // // DIG_DRIVER list // -extern HDIGDRIVER DIG_first; +extern HDIGDRIVER DIG_first; // // MDI_DRIVER list // -extern HMDIDRIVER MDI_first; +extern HMDIDRIVER MDI_first; // // Miscellaneous system services @@ -2356,56 +2356,56 @@ extern HMDIDRIVER MDI_first; #define MEM_alloc_lock AIL_mem_alloc_lock #define MEM_free_lock AIL_mem_free_lock -#define FILE_error AIL_file_error -#define FILE_size AIL_file_size -#define FILE_read AIL_file_read -#define FILE_write AIL_file_write +#define FILE_error AIL_file_error +#define FILE_size AIL_file_size +#define FILE_read AIL_file_read +#define FILE_write AIL_file_write #ifdef IS_DOS -#define MEM_alloc AIL_mem_alloc -#define MEM_free AIL_mem_free +#define MEM_alloc AIL_mem_alloc +#define MEM_free AIL_mem_free #define MEM_use_malloc AIL_mem_use_malloc -#define MEM_use_free AIL_mem_use_free -#define MEM_alloc_DOS AIL_mem_alloc_DOS -#define MEM_free_DOS AIL_mem_free_DOS +#define MEM_use_free AIL_mem_use_free +#define MEM_alloc_DOS AIL_mem_alloc_DOS +#define MEM_free_DOS AIL_mem_free_DOS #define VMM_lock_range AIL_vmm_lock_range #define VMM_unlock_range AIL_vmm_unlock_range -#define VMM_lock AIL_vmm_lock -#define VMM_unlock AIL_vmm_unlock +#define VMM_lock AIL_vmm_lock +#define VMM_unlock AIL_vmm_unlock #endif #endif -extern S32 AILCALLBACK DP_ASI_DECODER_callback(U32 user, - void FAR *dest, - S32 bytes_requested, - S32 offset); +extern S32 AILCALLBACK DP_ASI_DECODER_callback(U32 user, + void FAR *dest, + S32 bytes_requested, + S32 offset); -DXDEC void FAR * AILCALL AIL_mem_alloc_lock(U32 size); -DXDEC void AILCALL AIL_mem_free_lock (void FAR *ptr); +DXDEC void FAR * AILCALL AIL_mem_alloc_lock(U32 size); +DXDEC void AILCALL AIL_mem_free_lock (void FAR *ptr); -DXDEC S32 AILCALL AIL_file_error (void); +DXDEC S32 AILCALL AIL_file_error (void); -DXDEC S32 AILCALL AIL_file_size (char FAR *filename); +DXDEC S32 AILCALL AIL_file_size (char FAR *filename); -DXDEC void FAR * AILCALL AIL_file_read (char FAR *filename, - void FAR *dest); +DXDEC void FAR * AILCALL AIL_file_read (char FAR *filename, + void FAR *dest); -DXDEC S32 AILCALL AIL_file_write (char FAR *filename, - void FAR *buf, - U32 len); +DXDEC S32 AILCALL AIL_file_write (char FAR *filename, + void FAR *buf, + U32 len); -DXDEC S32 AILCALL AIL_WAV_file_write - (char FAR *filename, - void FAR *buf, - U32 len, - S32 rate, - S32 format); +DXDEC S32 AILCALL AIL_WAV_file_write + (char FAR *filename, + void FAR *buf, + U32 len, + S32 rate, + S32 format); -DXDEC S32 AILCALL AIL_file_append (char FAR*filename, - void FAR*buf, U32 len); +DXDEC S32 AILCALL AIL_file_append (char FAR*filename, + void FAR*buf, U32 len); #ifdef IS_DOS extern void * AILCALLBACK (*AIL_mem_alloc) (U32); @@ -2419,67 +2419,67 @@ void * cdecl AIL_mem_use_free (void AILCALLBACK (*fn)(void *)); // DXDEC S32 AILCALL AIL_mem_alloc_DOS (U32 n_paras, - void **protected_ptr, - U32 *segment_far_ptr, - U32 *selector); + void **protected_ptr, + U32 *segment_far_ptr, + U32 *selector); DXDEC void AILCALL AIL_mem_free_DOS (void *protected_ptr, - U32 segment_far_ptr, - U32 selector); + U32 segment_far_ptr, + U32 selector); DXDEC S32 AILCALL AIL_vmm_lock_range (void *p1, void *p2); DXDEC S32 AILCALL AIL_vmm_unlock_range (void *p1, void *p2); -DXDEC S32 AILCALL AIL_vmm_lock (void *start, U32 size); -DXDEC S32 AILCALL AIL_vmm_unlock (void *start, U32 size); +DXDEC S32 AILCALL AIL_vmm_lock (void *start, U32 size); +DXDEC S32 AILCALL AIL_vmm_unlock (void *start, U32 size); -DXDEC U32 AILCALL AIL_sel_base (U32 sel); +DXDEC U32 AILCALL AIL_sel_base (U32 sel); DXDEC void AILCALL AIL_sel_set_limit (U32 sel, - U32 limit); + U32 limit); // // Last IO_PARMS structure used to attempt device detection // -extern IO_PARMS AIL_last_IO_attempt; +extern IO_PARMS AIL_last_IO_attempt; // // Low-level support services // -DXDEC REALFAR AILCALL AIL_get_real_vect (U32 vectnum); +DXDEC REALFAR AILCALL AIL_get_real_vect (U32 vectnum); -DXDEC void AILCALL AIL_set_real_vect (U32 vectnum, - REALFAR real_ptr); +DXDEC void AILCALL AIL_set_real_vect (U32 vectnum, + REALFAR real_ptr); -DXDEC void AILCALL AIL_set_USE16_ISR (S32 IRQ, - REALFAR real_base, - U32 ISR_offset); +DXDEC void AILCALL AIL_set_USE16_ISR (S32 IRQ, + REALFAR real_base, + U32 ISR_offset); -DXDEC void AILCALL AIL_restore_USE16_ISR (S32 IRQ); +DXDEC void AILCALL AIL_restore_USE16_ISR (S32 IRQ); -DXDEC U32 AILCALL AIL_disable_interrupts (void); -DXDEC void AILCALL AIL_restore_interrupts (U32 FD_register); +DXDEC U32 AILCALL AIL_disable_interrupts (void); +DXDEC void AILCALL AIL_restore_interrupts (U32 FD_register); -DXDEC void AILCALL AIL_switch_stack (void *stack, - U32 size, - U32 *SS, - void **ESP, - void **EBP); +DXDEC void AILCALL AIL_switch_stack (void *stack, + U32 size, + U32 *SS, + void **ESP, + void **EBP); -DXDEC void AILCALL AIL_restore_stack (U32 SS, - void *ESP, - void *EBP); +DXDEC void AILCALL AIL_restore_stack (U32 SS, + void *ESP, + void *EBP); -DXDEC S32 AILCALL AIL_call_driver (AIL_DRIVER *drvr, - S32 fn, - VDI_CALL *in, - VDI_CALL *out); +DXDEC S32 AILCALL AIL_call_driver (AIL_DRIVER *drvr, + S32 fn, + VDI_CALL *in, + VDI_CALL *out); -DXDEC S32 AILCALL AIL_read_INI (AIL_INI *INI, - char *filename); +DXDEC S32 AILCALL AIL_read_INI (AIL_INI *INI, + char *filename); -DXDEC U32 AILCALL AIL_interrupt_divisor (void); +DXDEC U32 AILCALL AIL_interrupt_divisor (void); #endif @@ -2514,84 +2514,84 @@ void MSSBreakPoint(); #endif #ifdef __SW_3R -extern S32 AILCALL AIL_startup_reg (void); +extern S32 AILCALL AIL_startup_reg (void); #define AIL_startup AIL_startup_reg #else -extern S32 AILCALL AIL_startup_stack (void); +extern S32 AILCALL AIL_startup_stack (void); #define AIL_startup AIL_startup_stack #endif #define AIL_quick_startup(ud,um,opr,opb,ops) AIL_quick_startup_with_start(&AIL_startup,ud,um,opr,opb,ops) -extern S8 AIL_driver_directory [256]; +extern S8 AIL_driver_directory [256]; -DXDEC char FAR* AILCALL AIL_set_driver_directory (char FAR*dir); +DXDEC char FAR* AILCALL AIL_set_driver_directory (char FAR*dir); #define AIL_get_preference(number) (AIL_preference[number]) #else -DXDEC S32 AILCALL AIL_startup (void); +DXDEC S32 AILCALL AIL_startup (void); -DXDEC S32 AILCALL AIL_get_preference (U32 number); +DXDEC S32 AILCALL AIL_get_preference (U32 number); #endif -DXDEC void AILCALL AIL_shutdown (void); +DXDEC void AILCALL AIL_shutdown (void); -DXDEC S32 AILCALL AIL_set_preference (U32 number, - S32 value); +DXDEC S32 AILCALL AIL_set_preference (U32 number, + S32 value); -DXDEC char FAR *AILCALL AIL_last_error (void); +DXDEC char FAR *AILCALL AIL_last_error (void); -DXDEC void AILCALL AIL_set_error (char FAR* error_msg); +DXDEC void AILCALL AIL_set_error (char FAR* error_msg); // // Low-level support services // -DXDEC void __cdecl AIL_debug_printf (C8 FAR *fmt, ...); -DXDEC U32 AILCALL AIL_MMX_available (void); +DXDEC void __cdecl AIL_debug_printf (C8 FAR *fmt, ...); +DXDEC U32 AILCALL AIL_MMX_available (void); -DXDEC void AILCALL AIL_lock (void); -DXDEC void AILCALL AIL_unlock (void); +DXDEC void AILCALL AIL_lock (void); +DXDEC void AILCALL AIL_unlock (void); -DXDEC void AILCALL AIL_delay (S32 intervals); +DXDEC void AILCALL AIL_delay (S32 intervals); -DXDEC S32 AILCALL AIL_background (void); +DXDEC S32 AILCALL AIL_background (void); // // Process services // -DXDEC HTIMER AILCALL AIL_register_timer (AILTIMERCB fn); +DXDEC HTIMER AILCALL AIL_register_timer (AILTIMERCB fn); -DXDEC U32 AILCALL AIL_set_timer_user (HTIMER timer, - U32 user); +DXDEC U32 AILCALL AIL_set_timer_user (HTIMER timer, + U32 user); -DXDEC void AILCALL AIL_set_timer_period (HTIMER timer, - U32 microseconds); +DXDEC void AILCALL AIL_set_timer_period (HTIMER timer, + U32 microseconds); -DXDEC void AILCALL AIL_set_timer_frequency (HTIMER timer, - U32 hertz); +DXDEC void AILCALL AIL_set_timer_frequency (HTIMER timer, + U32 hertz); -DXDEC void AILCALL AIL_set_timer_divisor (HTIMER timer, - U32 PIT_divisor); +DXDEC void AILCALL AIL_set_timer_divisor (HTIMER timer, + U32 PIT_divisor); -DXDEC void AILCALL AIL_start_timer (HTIMER timer); -DXDEC void AILCALL AIL_start_all_timers (void); +DXDEC void AILCALL AIL_start_timer (HTIMER timer); +DXDEC void AILCALL AIL_start_all_timers (void); -DXDEC void AILCALL AIL_stop_timer (HTIMER timer); -DXDEC void AILCALL AIL_stop_all_timers (void); +DXDEC void AILCALL AIL_stop_timer (HTIMER timer); +DXDEC void AILCALL AIL_stop_all_timers (void); -DXDEC void AILCALL AIL_release_timer_handle (HTIMER timer); -DXDEC void AILCALL AIL_release_all_timers (void); +DXDEC void AILCALL AIL_release_timer_handle (HTIMER timer); +DXDEC void AILCALL AIL_release_all_timers (void); #ifdef IS_WIN32 -DXDEC U32 AILCALL AIL_get_timer_highest_delay (void); +DXDEC U32 AILCALL AIL_get_timer_highest_delay (void); -DXDEC HWND AILCALL AIL_HWND (void); +DXDEC HWND AILCALL AIL_HWND (void); #endif @@ -2601,30 +2601,30 @@ DXDEC HWND AILCALL AIL_HWND (void); #ifdef IS_WINDOWS -#define AIL_DLL_version(str,len) \ -{ \ +#define AIL_DLL_version(str,len) \ +{ \ HINSTANCE l=LoadLibrary(MSSDLLNAME); \ - if ((U32)l<=32) \ - *(str)=0; \ - else { \ - LoadString(l,1,str,len); \ - FreeLibrary(l); \ - } \ + if ((U32)l<=32) \ + *(str)=0; \ + else { \ + LoadString(l,1,str,len); \ + FreeLibrary(l); \ + } \ } -DXDEC S32 AILCALL AIL_waveOutOpen (HDIGDRIVER FAR *drvr, - LPHWAVEOUT FAR *lphWaveOut, - S32 wDeviceID, - LPWAVEFORMAT lpFormat); +DXDEC S32 AILCALL AIL_waveOutOpen (HDIGDRIVER FAR *drvr, + LPHWAVEOUT FAR *lphWaveOut, + S32 wDeviceID, + LPWAVEFORMAT lpFormat); -DXDEC void AILCALL AIL_waveOutClose (HDIGDRIVER drvr); +DXDEC void AILCALL AIL_waveOutClose (HDIGDRIVER drvr); -DXDEC S32 AILCALL AIL_digital_handle_release(HDIGDRIVER drvr); +DXDEC S32 AILCALL AIL_digital_handle_release(HDIGDRIVER drvr); -DXDEC S32 AILCALL AIL_digital_handle_reacquire - (HDIGDRIVER drvr); +DXDEC S32 AILCALL AIL_digital_handle_reacquire + (HDIGDRIVER drvr); -DXDEC void AILCALL AIL_serve(void); +DXDEC void AILCALL AIL_serve(void); #else @@ -2632,199 +2632,199 @@ DXDEC void AILCALL AIL_serve(void); // DOS installation services // -DXDEC IO_PARMS * AILCALL AIL_get_IO_environment (AIL_DRIVER *drvr); +DXDEC IO_PARMS * AILCALL AIL_get_IO_environment (AIL_DRIVER *drvr); -DXDEC AIL_DRIVER* AILCALL AIL_install_driver (U8 *driver_image, - U32 n_bytes); +DXDEC AIL_DRIVER* AILCALL AIL_install_driver (U8 *driver_image, + U32 n_bytes); -DXDEC void AILCALL AIL_uninstall_driver (AIL_DRIVER *drvr); +DXDEC void AILCALL AIL_uninstall_driver (AIL_DRIVER *drvr); -DXDEC S32 AILCALL AIL_install_DIG_INI (HDIGDRIVER *dig); +DXDEC S32 AILCALL AIL_install_DIG_INI (HDIGDRIVER *dig); DXDEC HDIGDRIVER AILCALL AIL_install_DIG_driver_file - (char *filename, - IO_PARMS *IO); + (char *filename, + IO_PARMS *IO); -DXDEC void AILCALL AIL_uninstall_DIG_driver (HDIGDRIVER dig); +DXDEC void AILCALL AIL_uninstall_DIG_driver (HDIGDRIVER dig); DXDEC HDIGDRIVER AILCALL AIL_install_DIG_driver_image - (void *driver_image, - U32 size, - IO_PARMS *IO); + (void *driver_image, + U32 size, + IO_PARMS *IO); #endif -DXDEC S32 AILCALL AIL_digital_CPU_percent(HDIGDRIVER dig); +DXDEC S32 AILCALL AIL_digital_CPU_percent(HDIGDRIVER dig); -DXDEC HSAMPLE AILCALL AIL_allocate_sample_handle - (HDIGDRIVER dig); +DXDEC HSAMPLE AILCALL AIL_allocate_sample_handle + (HDIGDRIVER dig); -DXDEC HSAMPLE AILCALL AIL_allocate_file_sample (HDIGDRIVER dig, - void FAR *file_image, - S32 block); +DXDEC HSAMPLE AILCALL AIL_allocate_file_sample (HDIGDRIVER dig, + void FAR *file_image, + S32 block); -DXDEC void AILCALL AIL_release_sample_handle (HSAMPLE S); +DXDEC void AILCALL AIL_release_sample_handle (HSAMPLE S); -DXDEC void AILCALL AIL_init_sample (HSAMPLE S); +DXDEC void AILCALL AIL_init_sample (HSAMPLE S); -DXDEC S32 AILCALL AIL_set_sample_file (HSAMPLE S, - void FAR *file_image, - S32 block); +DXDEC S32 AILCALL AIL_set_sample_file (HSAMPLE S, + void FAR *file_image, + S32 block); -DXDEC S32 AILCALL AIL_set_named_sample_file (HSAMPLE S, - C8 FAR *file_type_suffix, - void FAR *file_image, - S32 file_size, - S32 block); +DXDEC S32 AILCALL AIL_set_named_sample_file (HSAMPLE S, + C8 FAR *file_type_suffix, + void FAR *file_image, + S32 file_size, + S32 block); -DXDEC HPROVIDER AILCALL AIL_set_sample_processor (HSAMPLE S, - SAMPLESTAGE pipeline_stage, - HPROVIDER provider); +DXDEC HPROVIDER AILCALL AIL_set_sample_processor (HSAMPLE S, + SAMPLESTAGE pipeline_stage, + HPROVIDER provider); -DXDEC HPROVIDER AILCALL AIL_set_digital_driver_processor - (HDIGDRIVER dig, - DIGDRVSTAGE pipeline_stage, - HPROVIDER provider); +DXDEC HPROVIDER AILCALL AIL_set_digital_driver_processor + (HDIGDRIVER dig, + DIGDRVSTAGE pipeline_stage, + HPROVIDER provider); -DXDEC void AILCALL AIL_set_sample_adpcm_block_size - (HSAMPLE S, - U32 blocksize); +DXDEC void AILCALL AIL_set_sample_adpcm_block_size + (HSAMPLE S, + U32 blocksize); -DXDEC void AILCALL AIL_set_sample_address (HSAMPLE S, - void FAR *start, - U32 len); +DXDEC void AILCALL AIL_set_sample_address (HSAMPLE S, + void FAR *start, + U32 len); -DXDEC void AILCALL AIL_set_sample_type (HSAMPLE S, - S32 format, - U32 flags); +DXDEC void AILCALL AIL_set_sample_type (HSAMPLE S, + S32 format, + U32 flags); -DXDEC void AILCALL AIL_start_sample (HSAMPLE S); +DXDEC void AILCALL AIL_start_sample (HSAMPLE S); -DXDEC void AILCALL AIL_stop_sample (HSAMPLE S); +DXDEC void AILCALL AIL_stop_sample (HSAMPLE S); -DXDEC void AILCALL AIL_resume_sample (HSAMPLE S); +DXDEC void AILCALL AIL_resume_sample (HSAMPLE S); -DXDEC void AILCALL AIL_end_sample (HSAMPLE S); +DXDEC void AILCALL AIL_end_sample (HSAMPLE S); -DXDEC void AILCALL AIL_set_sample_playback_rate - (HSAMPLE S, - S32 playback_rate); +DXDEC void AILCALL AIL_set_sample_playback_rate + (HSAMPLE S, + S32 playback_rate); -DXDEC void AILCALL AIL_set_sample_volume (HSAMPLE S, - S32 volume); +DXDEC void AILCALL AIL_set_sample_volume (HSAMPLE S, + S32 volume); -DXDEC void AILCALL AIL_set_sample_pan (HSAMPLE S, - S32 pan); +DXDEC void AILCALL AIL_set_sample_pan (HSAMPLE S, + S32 pan); -DXDEC void AILCALL AIL_set_sample_loop_count (HSAMPLE S, - S32 loop_count); +DXDEC void AILCALL AIL_set_sample_loop_count (HSAMPLE S, + S32 loop_count); -DXDEC void AILCALL AIL_set_sample_loop_block (HSAMPLE S, - S32 loop_start_offset, - S32 loop_end_offset); +DXDEC void AILCALL AIL_set_sample_loop_block (HSAMPLE S, + S32 loop_start_offset, + S32 loop_end_offset); -DXDEC U32 AILCALL AIL_sample_status (HSAMPLE S); +DXDEC U32 AILCALL AIL_sample_status (HSAMPLE S); -DXDEC S32 AILCALL AIL_sample_playback_rate (HSAMPLE S); +DXDEC S32 AILCALL AIL_sample_playback_rate (HSAMPLE S); -DXDEC S32 AILCALL AIL_sample_volume (HSAMPLE S); +DXDEC S32 AILCALL AIL_sample_volume (HSAMPLE S); -DXDEC S32 AILCALL AIL_sample_pan (HSAMPLE S); +DXDEC S32 AILCALL AIL_sample_pan (HSAMPLE S); -DXDEC S32 AILCALL AIL_sample_loop_count (HSAMPLE S); +DXDEC S32 AILCALL AIL_sample_loop_count (HSAMPLE S); -DXDEC void AILCALL AIL_set_digital_master_volume - (HDIGDRIVER dig, - S32 master_volume); +DXDEC void AILCALL AIL_set_digital_master_volume + (HDIGDRIVER dig, + S32 master_volume); -DXDEC S32 AILCALL AIL_digital_master_volume (HDIGDRIVER dig); +DXDEC S32 AILCALL AIL_digital_master_volume (HDIGDRIVER dig); -DXDEC void AILCALL AIL_set_sample_reverb(HSAMPLE S, - F32 reverb_level, - F32 reverb_reflect_time, - F32 reverb_decay_time); +DXDEC void AILCALL AIL_set_sample_reverb(HSAMPLE S, + F32 reverb_level, + F32 reverb_reflect_time, + F32 reverb_decay_time); -DXDEC void AILCALL AIL_sample_reverb (HSAMPLE S, - F32 FAR *reverb_level, - F32 FAR *reverb_reflect_time, - F32 FAR *reverb_decay_time); +DXDEC void AILCALL AIL_sample_reverb (HSAMPLE S, + F32 FAR *reverb_level, + F32 FAR *reverb_reflect_time, + F32 FAR *reverb_decay_time); // // low-level digital services // -DXDEC S32 AILCALL AIL_minimum_sample_buffer_size(HDIGDRIVER dig, - S32 playback_rate, - S32 format); +DXDEC S32 AILCALL AIL_minimum_sample_buffer_size(HDIGDRIVER dig, + S32 playback_rate, + S32 format); -DXDEC S32 AILCALL AIL_sample_buffer_ready (HSAMPLE S); +DXDEC S32 AILCALL AIL_sample_buffer_ready (HSAMPLE S); -DXDEC void AILCALL AIL_load_sample_buffer (HSAMPLE S, - U32 buff_num, - void FAR *buffer, - U32 len); +DXDEC void AILCALL AIL_load_sample_buffer (HSAMPLE S, + U32 buff_num, + void FAR *buffer, + U32 len); -DXDEC S32 AILCALL AIL_sample_buffer_info (HSAMPLE S, //) - U32 FAR *pos0, - U32 FAR *len0, - U32 FAR *pos1, - U32 FAR *len1); +DXDEC S32 AILCALL AIL_sample_buffer_info (HSAMPLE S, //) + U32 FAR *pos0, + U32 FAR *len0, + U32 FAR *pos1, + U32 FAR *len1); -DXDEC U32 AILCALL AIL_sample_granularity (HSAMPLE S); +DXDEC U32 AILCALL AIL_sample_granularity (HSAMPLE S); -DXDEC void AILCALL AIL_set_sample_position (HSAMPLE S, - U32 pos); +DXDEC void AILCALL AIL_set_sample_position (HSAMPLE S, + U32 pos); -DXDEC U32 AILCALL AIL_sample_position (HSAMPLE S); +DXDEC U32 AILCALL AIL_sample_position (HSAMPLE S); DXDEC AILSAMPLECB AILCALL AIL_register_SOB_callback - (HSAMPLE S, - AILSAMPLECB SOB); + (HSAMPLE S, + AILSAMPLECB SOB); DXDEC AILSAMPLECB AILCALL AIL_register_EOB_callback - (HSAMPLE S, - AILSAMPLECB EOB); + (HSAMPLE S, + AILSAMPLECB EOB); DXDEC AILSAMPLECB AILCALL AIL_register_EOS_callback - (HSAMPLE S, - AILSAMPLECB EOS); + (HSAMPLE S, + AILSAMPLECB EOS); DXDEC AILSAMPLECB AILCALL AIL_register_EOF_callback - (HSAMPLE S, - AILSAMPLECB EOFILE); + (HSAMPLE S, + AILSAMPLECB EOFILE); -DXDEC void AILCALL AIL_set_sample_user_data (HSAMPLE S, - U32 index, - S32 value); +DXDEC void AILCALL AIL_set_sample_user_data (HSAMPLE S, + U32 index, + S32 value); -DXDEC S32 AILCALL AIL_sample_user_data (HSAMPLE S, - U32 index); +DXDEC S32 AILCALL AIL_sample_user_data (HSAMPLE S, + U32 index); -DXDEC S32 AILCALL AIL_active_sample_count (HDIGDRIVER dig); +DXDEC S32 AILCALL AIL_active_sample_count (HDIGDRIVER dig); -DXDEC void AILCALL AIL_digital_configuration (HDIGDRIVER dig, - S32 FAR *rate, - S32 FAR *format, - char FAR *string); +DXDEC void AILCALL AIL_digital_configuration (HDIGDRIVER dig, + S32 FAR *rate, + S32 FAR *format, + char FAR *string); #ifdef IS_WIN32 -DXDEC S32 AILCALL AIL_set_direct_buffer_control (HSAMPLE S, - U32 command); +DXDEC S32 AILCALL AIL_set_direct_buffer_control (HSAMPLE S, + U32 command); -DXDEC void AILCALL AIL_get_DirectSound_info (HSAMPLE S, - AILLPDIRECTSOUND *lplpDS, - AILLPDIRECTSOUNDBUFFER *lplpDSB); +DXDEC void AILCALL AIL_get_DirectSound_info (HSAMPLE S, + AILLPDIRECTSOUND *lplpDS, + AILLPDIRECTSOUNDBUFFER *lplpDSB); -DXDEC S32 AILCALL AIL_set_DirectSound_HWND(HDIGDRIVER dig, HWND wnd); +DXDEC S32 AILCALL AIL_set_DirectSound_HWND(HDIGDRIVER dig, HWND wnd); #endif -DXDEC void AILCALL AIL_set_sample_ms_position (HSAMPLE S, //) - S32 milliseconds); +DXDEC void AILCALL AIL_set_sample_ms_position (HSAMPLE S, //) + S32 milliseconds); -DXDEC void AILCALL AIL_sample_ms_position (HSAMPLE S, //) - S32 FAR * total_milliseconds, - S32 FAR * current_milliseconds); +DXDEC void AILCALL AIL_sample_ms_position (HSAMPLE S, //) + S32 FAR * total_milliseconds, + S32 FAR * current_milliseconds); // @@ -2833,17 +2833,17 @@ DXDEC void AILCALL AIL_sample_ms_position (HSAMPLE S, //) #ifdef IS_WINDOWS -DXDEC HDIGINPUT AILCALL AIL_input_open (AILINPUTINFO FAR *info, - U32 constraints, - U32 callback_user_value); +DXDEC HDIGINPUT AILCALL AIL_input_open (AILINPUTINFO FAR *info, + U32 constraints, + U32 callback_user_value); -DXDEC void AILCALL AIL_input_close (HDIGINPUT dig); +DXDEC void AILCALL AIL_input_close (HDIGINPUT dig); DXDEC AILINPUTINFO FAR * - AILCALL AIL_input_info (HDIGINPUT dig); + AILCALL AIL_input_info (HDIGINPUT dig); -DXDEC S32 AILCALL AIL_set_input_state (HDIGINPUT dig, - S32 enable); +DXDEC S32 AILCALL AIL_set_input_state (HDIGINPUT dig, + S32 enable); #endif @@ -2853,189 +2853,189 @@ DXDEC S32 AILCALL AIL_set_input_state (HDIGINPUT dig, #ifdef IS_WINDOWS -DXDEC S32 AILCALL AIL_midiOutOpen(HMDIDRIVER FAR *drvr, - LPHMIDIOUT FAR *lphMidiOut, - S32 dwDeviceID); +DXDEC S32 AILCALL AIL_midiOutOpen(HMDIDRIVER FAR *drvr, + LPHMIDIOUT FAR *lphMidiOut, + S32 dwDeviceID); -DXDEC void AILCALL AIL_midiOutClose (HMDIDRIVER mdi); +DXDEC void AILCALL AIL_midiOutClose (HMDIDRIVER mdi); -DXDEC S32 AILCALL AIL_MIDI_handle_release - (HMDIDRIVER mdi); +DXDEC S32 AILCALL AIL_MIDI_handle_release + (HMDIDRIVER mdi); -DXDEC S32 AILCALL AIL_MIDI_handle_reacquire - (HMDIDRIVER mdi); +DXDEC S32 AILCALL AIL_MIDI_handle_reacquire + (HMDIDRIVER mdi); #else -DXDEC S32 AILCALL AIL_install_MDI_INI (HMDIDRIVER *mdi); +DXDEC S32 AILCALL AIL_install_MDI_INI (HMDIDRIVER *mdi); DXDEC HMDIDRIVER AILCALL AIL_install_MDI_driver_file - (char *filename, - IO_PARMS *IO); + (char *filename, + IO_PARMS *IO); -DXDEC void AILCALL AIL_uninstall_MDI_driver (HMDIDRIVER mdi); +DXDEC void AILCALL AIL_uninstall_MDI_driver (HMDIDRIVER mdi); DXDEC HMDIDRIVER AILCALL AIL_install_MDI_driver_image - (void *driver_image, - U32 size, - IO_PARMS *IO); + (void *driver_image, + U32 size, + IO_PARMS *IO); -DXDEC S32 AILCALL AIL_MDI_driver_type (HMDIDRIVER mdi); +DXDEC S32 AILCALL AIL_MDI_driver_type (HMDIDRIVER mdi); -DXDEC void AILCALL AIL_set_GTL_filename_prefix (char *prefix); +DXDEC void AILCALL AIL_set_GTL_filename_prefix (char *prefix); -DXDEC S32 AILCALL AIL_timbre_status (HMDIDRIVER mdi, - S32 bank, - S32 patch); +DXDEC S32 AILCALL AIL_timbre_status (HMDIDRIVER mdi, + S32 bank, + S32 patch); -DXDEC S32 AILCALL AIL_install_timbre (HMDIDRIVER mdi, - S32 bank, - S32 patch); +DXDEC S32 AILCALL AIL_install_timbre (HMDIDRIVER mdi, + S32 bank, + S32 patch); -DXDEC void AILCALL AIL_protect_timbre (HMDIDRIVER mdi, - S32 bank, - S32 patch); +DXDEC void AILCALL AIL_protect_timbre (HMDIDRIVER mdi, + S32 bank, + S32 patch); -DXDEC void AILCALL AIL_unprotect_timbre (HMDIDRIVER mdi, - S32 bank, - S32 patch); +DXDEC void AILCALL AIL_unprotect_timbre (HMDIDRIVER mdi, + S32 bank, + S32 patch); #endif -DXDEC HSEQUENCE AILCALL AIL_allocate_sequence_handle - (HMDIDRIVER mdi); +DXDEC HSEQUENCE AILCALL AIL_allocate_sequence_handle + (HMDIDRIVER mdi); -DXDEC void AILCALL AIL_release_sequence_handle - (HSEQUENCE S); +DXDEC void AILCALL AIL_release_sequence_handle + (HSEQUENCE S); -DXDEC S32 AILCALL AIL_init_sequence (HSEQUENCE S, - void FAR *start, - S32 sequence_num); +DXDEC S32 AILCALL AIL_init_sequence (HSEQUENCE S, + void FAR *start, + S32 sequence_num); -DXDEC void AILCALL AIL_start_sequence (HSEQUENCE S); +DXDEC void AILCALL AIL_start_sequence (HSEQUENCE S); -DXDEC void AILCALL AIL_stop_sequence (HSEQUENCE S); +DXDEC void AILCALL AIL_stop_sequence (HSEQUENCE S); -DXDEC void AILCALL AIL_resume_sequence (HSEQUENCE S); +DXDEC void AILCALL AIL_resume_sequence (HSEQUENCE S); -DXDEC void AILCALL AIL_end_sequence (HSEQUENCE S); +DXDEC void AILCALL AIL_end_sequence (HSEQUENCE S); -DXDEC void AILCALL AIL_set_sequence_tempo (HSEQUENCE S, - S32 tempo, - S32 milliseconds); +DXDEC void AILCALL AIL_set_sequence_tempo (HSEQUENCE S, + S32 tempo, + S32 milliseconds); -DXDEC void AILCALL AIL_set_sequence_volume (HSEQUENCE S, - S32 volume, - S32 milliseconds); +DXDEC void AILCALL AIL_set_sequence_volume (HSEQUENCE S, + S32 volume, + S32 milliseconds); -DXDEC void AILCALL AIL_set_sequence_loop_count - (HSEQUENCE S, - S32 loop_count); +DXDEC void AILCALL AIL_set_sequence_loop_count + (HSEQUENCE S, + S32 loop_count); -DXDEC U32 AILCALL AIL_sequence_status (HSEQUENCE S); +DXDEC U32 AILCALL AIL_sequence_status (HSEQUENCE S); -DXDEC S32 AILCALL AIL_sequence_tempo (HSEQUENCE S); +DXDEC S32 AILCALL AIL_sequence_tempo (HSEQUENCE S); -DXDEC S32 AILCALL AIL_sequence_volume (HSEQUENCE S); +DXDEC S32 AILCALL AIL_sequence_volume (HSEQUENCE S); -DXDEC S32 AILCALL AIL_sequence_loop_count (HSEQUENCE S); +DXDEC S32 AILCALL AIL_sequence_loop_count (HSEQUENCE S); -DXDEC void AILCALL AIL_set_XMIDI_master_volume - (HMDIDRIVER mdi, - S32 master_volume); +DXDEC void AILCALL AIL_set_XMIDI_master_volume + (HMDIDRIVER mdi, + S32 master_volume); -DXDEC S32 AILCALL AIL_XMIDI_master_volume (HMDIDRIVER mdi); +DXDEC S32 AILCALL AIL_XMIDI_master_volume (HMDIDRIVER mdi); // // Low-level XMIDI services // -DXDEC S32 AILCALL AIL_active_sequence_count (HMDIDRIVER mdi); +DXDEC S32 AILCALL AIL_active_sequence_count (HMDIDRIVER mdi); -DXDEC S32 AILCALL AIL_controller_value (HSEQUENCE S, - S32 channel, - S32 controller_num); +DXDEC S32 AILCALL AIL_controller_value (HSEQUENCE S, + S32 channel, + S32 controller_num); -DXDEC S32 AILCALL AIL_channel_notes (HSEQUENCE S, - S32 channel); +DXDEC S32 AILCALL AIL_channel_notes (HSEQUENCE S, + S32 channel); -DXDEC void AILCALL AIL_sequence_position (HSEQUENCE S, - S32 FAR *beat, - S32 FAR *measure); +DXDEC void AILCALL AIL_sequence_position (HSEQUENCE S, + S32 FAR *beat, + S32 FAR *measure); -DXDEC void AILCALL AIL_branch_index (HSEQUENCE S, - U32 marker); +DXDEC void AILCALL AIL_branch_index (HSEQUENCE S, + U32 marker); DXDEC AILPREFIXCB AILCALL AIL_register_prefix_callback - (HSEQUENCE S, - AILPREFIXCB callback); + (HSEQUENCE S, + AILPREFIXCB callback); DXDEC AILTRIGGERCB AILCALL AIL_register_trigger_callback - (HSEQUENCE S, - AILTRIGGERCB callback); + (HSEQUENCE S, + AILTRIGGERCB callback); DXDEC AILSEQUENCECB AILCALL AIL_register_sequence_callback - (HSEQUENCE S, - AILSEQUENCECB callback); + (HSEQUENCE S, + AILSEQUENCECB callback); DXDEC AILBEATCB AILCALL AIL_register_beat_callback (HSEQUENCE S, - AILBEATCB callback); + AILBEATCB callback); DXDEC AILEVENTCB AILCALL AIL_register_event_callback (HMDIDRIVER mdi, - AILEVENTCB callback); + AILEVENTCB callback); DXDEC AILTIMBRECB AILCALL AIL_register_timbre_callback - (HMDIDRIVER mdi, - AILTIMBRECB callback); + (HMDIDRIVER mdi, + AILTIMBRECB callback); -DXDEC void AILCALL AIL_set_sequence_user_data (HSEQUENCE S, - U32 index, - S32 value); +DXDEC void AILCALL AIL_set_sequence_user_data (HSEQUENCE S, + U32 index, + S32 value); -DXDEC S32 AILCALL AIL_sequence_user_data (HSEQUENCE S, - U32 index); +DXDEC S32 AILCALL AIL_sequence_user_data (HSEQUENCE S, + U32 index); -DXDEC void AILCALL AIL_register_ICA_array (HSEQUENCE S, - U8 FAR *array); +DXDEC void AILCALL AIL_register_ICA_array (HSEQUENCE S, + U8 FAR *array); -DXDEC S32 AILCALL AIL_lock_channel (HMDIDRIVER mdi); +DXDEC S32 AILCALL AIL_lock_channel (HMDIDRIVER mdi); -DXDEC void AILCALL AIL_release_channel (HMDIDRIVER mdi, - S32 channel); +DXDEC void AILCALL AIL_release_channel (HMDIDRIVER mdi, + S32 channel); -DXDEC void AILCALL AIL_map_sequence_channel (HSEQUENCE S, - S32 seq_channel, - S32 new_channel); +DXDEC void AILCALL AIL_map_sequence_channel (HSEQUENCE S, + S32 seq_channel, + S32 new_channel); -DXDEC S32 AILCALL AIL_true_sequence_channel (HSEQUENCE S, - S32 seq_channel); +DXDEC S32 AILCALL AIL_true_sequence_channel (HSEQUENCE S, + S32 seq_channel); -DXDEC void AILCALL AIL_send_channel_voice_message - (HMDIDRIVER mdi, - HSEQUENCE S, - S32 status, - S32 data_1, - S32 data_2); +DXDEC void AILCALL AIL_send_channel_voice_message + (HMDIDRIVER mdi, + HSEQUENCE S, + S32 status, + S32 data_1, + S32 data_2); -DXDEC void AILCALL AIL_send_sysex_message (HMDIDRIVER mdi, - void FAR *buffer); +DXDEC void AILCALL AIL_send_sysex_message (HMDIDRIVER mdi, + void FAR *buffer); DXDEC HWAVESYNTH - AILCALL AIL_create_wave_synthesizer (HDIGDRIVER dig, - HMDIDRIVER mdi, - void FAR *wave_lib, - S32 polyphony); + AILCALL AIL_create_wave_synthesizer (HDIGDRIVER dig, + HMDIDRIVER mdi, + void FAR *wave_lib, + S32 polyphony); -DXDEC void AILCALL AIL_destroy_wave_synthesizer (HWAVESYNTH W); +DXDEC void AILCALL AIL_destroy_wave_synthesizer (HWAVESYNTH W); -DXDEC void AILCALL AIL_set_sequence_ms_position (HSEQUENCE S, //) - S32 milliseconds); +DXDEC void AILCALL AIL_set_sequence_ms_position (HSEQUENCE S, //) + S32 milliseconds); -DXDEC void AILCALL AIL_sequence_ms_position(HSEQUENCE S, //) - S32 FAR *total_milliseconds, - S32 FAR *current_milliseconds); +DXDEC void AILCALL AIL_sequence_ms_position(HSEQUENCE S, //) + S32 FAR *total_milliseconds, + S32 FAR *current_milliseconds); @@ -3063,7 +3063,7 @@ typedef struct _REDBOOK { typedef struct _REDBOOK FAR* HREDBOOK; -#define REDBOOK_ERROR 0 +#define REDBOOK_ERROR 0 #define REDBOOK_PLAYING 1 #define REDBOOK_PAUSED 2 #define REDBOOK_STOPPED 3 @@ -3073,36 +3073,36 @@ DXDEC HREDBOOK AILCALL AIL_redbook_open(U32 which); DXDEC HREDBOOK AILCALL AIL_redbook_open_drive(S32 drive); -DXDEC void AILCALL AIL_redbook_close(HREDBOOK hand); +DXDEC void AILCALL AIL_redbook_close(HREDBOOK hand); -DXDEC void AILCALL AIL_redbook_eject(HREDBOOK hand); +DXDEC void AILCALL AIL_redbook_eject(HREDBOOK hand); -DXDEC void AILCALL AIL_redbook_retract(HREDBOOK hand); +DXDEC void AILCALL AIL_redbook_retract(HREDBOOK hand); -DXDEC U32 AILCALL AIL_redbook_status(HREDBOOK hand); +DXDEC U32 AILCALL AIL_redbook_status(HREDBOOK hand); -DXDEC U32 AILCALL AIL_redbook_tracks(HREDBOOK hand); +DXDEC U32 AILCALL AIL_redbook_tracks(HREDBOOK hand); -DXDEC U32 AILCALL AIL_redbook_track(HREDBOOK hand); +DXDEC U32 AILCALL AIL_redbook_track(HREDBOOK hand); -DXDEC void AILCALL AIL_redbook_track_info(HREDBOOK hand,U32 tracknum, - U32 FAR* startmsec,U32 FAR* endmsec); +DXDEC void AILCALL AIL_redbook_track_info(HREDBOOK hand,U32 tracknum, + U32 FAR* startmsec,U32 FAR* endmsec); -DXDEC U32 AILCALL AIL_redbook_id(HREDBOOK hand); +DXDEC U32 AILCALL AIL_redbook_id(HREDBOOK hand); -DXDEC U32 AILCALL AIL_redbook_position(HREDBOOK hand); +DXDEC U32 AILCALL AIL_redbook_position(HREDBOOK hand); -DXDEC U32 AILCALL AIL_redbook_play(HREDBOOK hand,U32 startmsec, U32 endmsec); +DXDEC U32 AILCALL AIL_redbook_play(HREDBOOK hand,U32 startmsec, U32 endmsec); -DXDEC U32 AILCALL AIL_redbook_stop(HREDBOOK hand); +DXDEC U32 AILCALL AIL_redbook_stop(HREDBOOK hand); -DXDEC U32 AILCALL AIL_redbook_pause(HREDBOOK hand); +DXDEC U32 AILCALL AIL_redbook_pause(HREDBOOK hand); -DXDEC U32 AILCALL AIL_redbook_resume(HREDBOOK hand); +DXDEC U32 AILCALL AIL_redbook_resume(HREDBOOK hand); -DXDEC S32 AILCALL AIL_redbook_volume(HREDBOOK hand); +DXDEC S32 AILCALL AIL_redbook_volume(HREDBOOK hand); -DXDEC S32 AILCALL AIL_redbook_set_volume(HREDBOOK hand, S32 volume); +DXDEC S32 AILCALL AIL_redbook_set_volume(HREDBOOK hand, S32 volume); #ifdef IS_WIN16 #define AIL_ms_count timeGetTime @@ -3113,59 +3113,59 @@ DXDEC S32 AILCALL AIL_redbook_set_volume(HREDBOOK hand, S32 volume); #endif -typedef struct _STREAM FAR* HSTREAM; // Handle to stream +typedef struct _STREAM FAR* HSTREAM; // Handle to stream typedef void (AILCALLBACK FAR* AILSTREAMCB) (HSTREAM stream); typedef struct _STREAM { S32 block_oriented; // 1 if this is an ADPCM or ASI-compressed stream - S32 using_ASI; // 1 if using ASI decoder to uncompress stream data + S32 using_ASI; // 1 if using ASI decoder to uncompress stream data ASISTAGE FAR *ASI; // handy pointer to our ASI coded - HSAMPLE samp; // the sample handle + HSAMPLE samp; // the sample handle - U32 fileh; // the open file handle + U32 fileh; // the open file handle U8 FAR* bufs[3]; // the data buffers U32 bufsizes[3]; // the size of each buffer - S32 bufsize; // size of each buffer - S32 readsize; // size of each read block + S32 bufsize; // size of each buffer + S32 readsize; // size of each read block - U32 buf1; // 0,1,2 (current buffer that we are reading into) - S32 size1; // holds the current amount of data read + U32 buf1; // 0,1,2 (current buffer that we are reading into) + S32 size1; // holds the current amount of data read - U32 buf2; // 0,1,2 (the next buffer that we are reading into) - S32 size2; // next buffer loaded up to + U32 buf2; // 0,1,2 (the next buffer that we are reading into) + S32 size2; // next buffer loaded up to - U32 buf3; // 0,1,2 (the next buffer that we are reading into) - S32 size3; // next buffer loaded up to + U32 buf3; // 0,1,2 (the next buffer that we are reading into) + S32 size3; // next buffer loaded up to - U32 datarate; // datarate in bytes per second - S32 filerate; // original datarate of the file - S32 filetype; // file format type + U32 datarate; // datarate in bytes per second + S32 filerate; // original datarate of the file + S32 filetype; // file format type U32 fileflags; // file format flags (signed or unsigned) - S32 totallen; // total length of the sound data + S32 totallen; // total length of the sound data U32 blocksize; // ADPCM block size - S32 padding; // padding to be done - S32 padded; // padding done + S32 padding; // padding to be done + S32 padded; // padding done S32 loadedsize; // size that has been loaded S32 loadedsome; // have we done any loads? - U32 startpos; // point that the sound data begins + U32 startpos; // point that the sound data begins U32 totalread; // total bytes read from the disk U32 loopsleft; // how many loops are left - U32 error; // read error has occurred + U32 error; // read error has occurred - S32 preload; // preload the file into the first buffer + S32 preload; // preload the file into the first buffer S32 dontclose; // don't close the file - S32 noback; // no background processing - S32 alldone; // alldone + S32 noback; // no background processing + S32 alldone; // alldone S32 primeamount; // amount to load after a seek S32 readatleast; // forced amount to read on next service @@ -3173,12 +3173,12 @@ typedef struct _STREAM { AILSTREAMCB callback; // end of stream callback - S32 user_data[8]; // Miscellaneous user data - void FAR* next; // pointer to next stream + S32 user_data[8]; // Miscellaneous user data + void FAR* next; // pointer to next stream #ifdef IS_WINDOWS - S32 autostreaming; // are we autostreaming this stream - S32 cb_IsWin32s; // Is the callback win32s? + S32 autostreaming; // are we autostreaming this stream + S32 cb_IsWin32s; // Is the callback win32s? #endif S32 docallback; // set when it time to poll for a callback @@ -3224,29 +3224,29 @@ DXDEC AILSTREAMCB AILCALL AIL_register_stream_callback(HSTREAM stream, AILSTREAM DXDEC void AILCALL AIL_auto_service_stream(HSTREAM stream, S32 onoff); -DXDEC void AILCALL AIL_set_stream_user_data (HSTREAM S, - U32 index, - S32 value); +DXDEC void AILCALL AIL_set_stream_user_data (HSTREAM S, + U32 index, + S32 value); -DXDEC S32 AILCALL AIL_stream_user_data (HSTREAM S, - U32 index); +DXDEC S32 AILCALL AIL_stream_user_data (HSTREAM S, + U32 index); -DXDEC void AILCALL AIL_set_stream_ms_position (HSTREAM S, - S32 milliseconds); +DXDEC void AILCALL AIL_set_stream_ms_position (HSTREAM S, + S32 milliseconds); -DXDEC void AILCALL AIL_stream_ms_position (HSTREAM S, //) - S32 FAR * total_milliseconds, - S32 FAR * current_milliseconds); +DXDEC void AILCALL AIL_stream_ms_position (HSTREAM S, //) + S32 FAR * total_milliseconds, + S32 FAR * current_milliseconds); -DXDEC void AILCALL AIL_set_stream_reverb(HSTREAM S, - F32 reverb_level, - F32 reverb_reflect_time, - F32 reverb_decay_time); +DXDEC void AILCALL AIL_set_stream_reverb(HSTREAM S, + F32 reverb_level, + F32 reverb_reflect_time, + F32 reverb_decay_time); -DXDEC void AILCALL AIL_stream_reverb (HSTREAM S, - F32 FAR *reverb_level, - F32 FAR *reverb_reflect_time, - F32 FAR *reverb_decay_time); +DXDEC void AILCALL AIL_stream_reverb (HSTREAM S, + F32 FAR *reverb_level, + F32 FAR *reverb_reflect_time, + F32 FAR *reverb_decay_time); // @@ -3321,11 +3321,11 @@ typedef struct _AILDOSDLS { DXDEC HDLSDEVICE AILCALL AIL_DLS_open(HMDIDRIVER mdi, HDIGDRIVER dig, #ifdef IS_WINDOWS - char FAR* libname, + char FAR* libname, #else - AILDOSDLS FAR* dosdls, + AILDOSDLS FAR* dosdls, #endif - U32 flags, U32 rate, S32 bits, S32 channels); + U32 flags, U32 rate, S32 bits, S32 channels); // // Parameters for the dwFlag used in DLSClose() and flags in AIL_DLS_close @@ -3334,7 +3334,7 @@ DXDEC HDLSDEVICE AILCALL AIL_DLS_open(HMDIDRIVER mdi, HDIGDRIVER dig, #define RETAIN_DLS_COLLECTION 0x00000001 #define RETURN_TO_BOOTUP_STATE 0x00000002 #define RETURN_TO_GM_ONLY_STATE 0x00000004 -#define DLS_COMPACT_MEMORY 0x00000008 +#define DLS_COMPACT_MEMORY 0x00000008 DXDEC void AILCALL AIL_DLS_close(HDLSDEVICE dls, U32 flags); @@ -3356,14 +3356,14 @@ DXDEC void AILCALL AIL_DLS_compact(HDLSDEVICE dls); DXDEC void AILCALL AIL_DLS_get_info(HDLSDEVICE dls, AILDLSINFO FAR* info, S32 FAR* PercentCPU); DXDEC void AILCALL AIL_DLS_set_reverb(HDLSDEVICE dls, - F32 reverb_level, - F32 reverb_reflect_time, - F32 reverb_decay_time); + F32 reverb_level, + F32 reverb_reflect_time, + F32 reverb_decay_time); DXDEC void AILCALL AIL_DLS_get_reverb(HDLSDEVICE dls, - F32 FAR* reverb_level, - F32 FAR* reverb_reflect_time, - F32 FAR* reverb_decay_time); + F32 FAR* reverb_level, + F32 FAR* reverb_reflect_time, + F32 FAR* reverb_decay_time); // @@ -3394,78 +3394,78 @@ typedef struct AUDIO_TYPE; -#define QSTAT_DONE 1 // Data has finished playing -#define QSTAT_LOADED 2 // Data has been loaded, but not yet played -#define QSTAT_PLAYING 3 // Data is currently playing +#define QSTAT_DONE 1 // Data has finished playing +#define QSTAT_LOADED 2 // Data has been loaded, but not yet played +#define QSTAT_PLAYING 3 // Data is currently playing -typedef AUDIO_TYPE FAR * HAUDIO; // Generic handle to any audio data type +typedef AUDIO_TYPE FAR * HAUDIO; // Generic handle to any audio data type -#define AIL_QUICK_USE_WAVEOUT 2 -#define AIL_QUICK_MIDI_AND_DLS 2 -#define AIL_QUICK_DLS_ONLY 3 -#define AIL_QUICK_MIDI_AND_VORTEX_DLS 4 +#define AIL_QUICK_USE_WAVEOUT 2 +#define AIL_QUICK_MIDI_AND_DLS 2 +#define AIL_QUICK_DLS_ONLY 3 +#define AIL_QUICK_MIDI_AND_VORTEX_DLS 4 #define AIL_QUICK_MIDI_AND_SONICVIBES_DLS 5 -DXDEC S32 AILCALL +DXDEC S32 AILCALL #ifdef IS_WINDOWS - AIL_quick_startup ( + AIL_quick_startup ( #else - AIL_quick_startup_with_start(void* startup, + AIL_quick_startup_with_start(void* startup, #endif - S32 use_digital, - S32 use_MIDI, - U32 output_rate, - S32 output_bits, - S32 output_channels); + S32 use_digital, + S32 use_MIDI, + U32 output_rate, + S32 output_bits, + S32 output_channels); -DXDEC void AILCALL AIL_quick_shutdown (void); +DXDEC void AILCALL AIL_quick_shutdown (void); -DXDEC void AILCALL AIL_quick_handles (HDIGDRIVER FAR* pdig, - HMDIDRIVER FAR* pmdi, - HDLSDEVICE FAR* pdls ); +DXDEC void AILCALL AIL_quick_handles (HDIGDRIVER FAR* pdig, + HMDIDRIVER FAR* pmdi, + HDLSDEVICE FAR* pdls ); -DXDEC HAUDIO AILCALL AIL_quick_load (char FAR *filename); +DXDEC HAUDIO AILCALL AIL_quick_load (char FAR *filename); -DXDEC HAUDIO AILCALL AIL_quick_load_mem (void FAR *mem, - U32 size); +DXDEC HAUDIO AILCALL AIL_quick_load_mem (void FAR *mem, + U32 size); -DXDEC HAUDIO AILCALL AIL_quick_copy (HAUDIO audio); +DXDEC HAUDIO AILCALL AIL_quick_copy (HAUDIO audio); -DXDEC void AILCALL AIL_quick_unload (HAUDIO audio); +DXDEC void AILCALL AIL_quick_unload (HAUDIO audio); -DXDEC S32 AILCALL AIL_quick_play (HAUDIO audio, - U32 loop_count); +DXDEC S32 AILCALL AIL_quick_play (HAUDIO audio, + U32 loop_count); -DXDEC void AILCALL AIL_quick_halt (HAUDIO audio); +DXDEC void AILCALL AIL_quick_halt (HAUDIO audio); -DXDEC S32 AILCALL AIL_quick_status (HAUDIO audio); +DXDEC S32 AILCALL AIL_quick_status (HAUDIO audio); -DXDEC HAUDIO AILCALL AIL_quick_load_and_play (char FAR *filename, - U32 loop_count, - S32 wait_request); +DXDEC HAUDIO AILCALL AIL_quick_load_and_play (char FAR *filename, + U32 loop_count, + S32 wait_request); DXDEC void AILCALL AIL_quick_set_speed (HAUDIO audio, S32 speed); DXDEC void AILCALL AIL_quick_set_volume (HAUDIO audio, S32 volume, S32 extravol); DXDEC void AILCALL AIL_quick_set_reverb (HAUDIO audio, - F32 reverb_level, - F32 reverb_reflect_time, - F32 reverb_decay_time); + F32 reverb_level, + F32 reverb_reflect_time, + F32 reverb_decay_time); DXDEC void AILCALL AIL_quick_set_ms_position(HAUDIO audio,S32 milliseconds); -DXDEC S32 AILCALL AIL_quick_ms_position(HAUDIO audio); +DXDEC S32 AILCALL AIL_quick_ms_position(HAUDIO audio); -DXDEC S32 AILCALL AIL_quick_ms_length(HAUDIO audio); +DXDEC S32 AILCALL AIL_quick_ms_length(HAUDIO audio); -#define AIL_QUICK_XMIDI_TYPE 1 -#define AIL_QUICK_DIGITAL_TYPE 2 -#define AIL_QUICK_DLS_XMIDI_TYPE 3 +#define AIL_QUICK_XMIDI_TYPE 1 +#define AIL_QUICK_DIGITAL_TYPE 2 +#define AIL_QUICK_DLS_XMIDI_TYPE 3 #define AIL_QUICK_MPEG_DIGITAL_TYPE 4 -DXDEC S32 AILCALL AIL_quick_type(HAUDIO audio); +DXDEC S32 AILCALL AIL_quick_type(HAUDIO audio); // // used for AIL_process @@ -3484,116 +3484,116 @@ typedef struct _AILMIXINFO { DXDEC S32 AILCALL AIL_WAV_info(void FAR* data, AILSOUNDINFO FAR* info); DXDEC S32 AILCALL AIL_size_processed_digital_audio( - U32 dest_rate, - U32 dest_format, - S32 num_srcs, - AILMIXINFO FAR* src); + U32 dest_rate, + U32 dest_format, + S32 num_srcs, + AILMIXINFO FAR* src); DXDEC S32 AILCALL AIL_process_digital_audio( - void FAR *dest_buffer, - S32 dest_buffer_size, - U32 dest_rate, - U32 dest_format, - S32 num_srcs, - AILMIXINFO FAR* src); + void FAR *dest_buffer, + S32 dest_buffer_size, + U32 dest_rate, + U32 dest_format, + S32 num_srcs, + AILMIXINFO FAR* src); -#define AIL_LENGTHY_INIT 0 +#define AIL_LENGTHY_INIT 0 #define AIL_LENGTHY_SET_PREFERENCE 1 -#define AIL_LENGTHY_UPDATE 2 -#define AIL_LENGTHY_DONE 3 +#define AIL_LENGTHY_UPDATE 2 +#define AIL_LENGTHY_DONE 3 typedef S32 (AILCALLBACK FAR* AILLENGTHYCB)(U32 state,U32 user); typedef S32 (AILCALLBACK FAR* AILCODECSETPREF)(char FAR* preference,U32 value); DXDEC S32 AILCALL AIL_compress_ASI(AILSOUNDINFO FAR* info, //) - char FAR* filename_ext, - void FAR* FAR* outdata, - U32 FAR* outsize, - AILLENGTHYCB callback); + char FAR* filename_ext, + void FAR* FAR* outdata, + U32 FAR* outsize, + AILLENGTHYCB callback); DXDEC S32 AILCALL AIL_decompress_ASI(void FAR* indata, //) - U32 insize, - char FAR* filename_ext, - void FAR* FAR* wav, - U32 FAR* wavsize, - AILLENGTHYCB callback); + U32 insize, + char FAR* filename_ext, + void FAR* FAR* wav, + U32 FAR* wavsize, + AILLENGTHYCB callback); DXDEC S32 AILCALL AIL_compress_ADPCM(AILSOUNDINFO FAR * info, - void FAR* FAR* outdata, U32 FAR* outsize); + void FAR* FAR* outdata, U32 FAR* outsize); DXDEC S32 AILCALL AIL_decompress_ADPCM(AILSOUNDINFO FAR * info, - void FAR* FAR* outdata, U32 FAR* outsize); + void FAR* FAR* outdata, U32 FAR* outsize); DXDEC S32 AILCALL AIL_compress_DLS(void FAR* dls, - char FAR* compression_extension, - void FAR* FAR* mls, U32 FAR* mlssize, - AILLENGTHYCB callback); + char FAR* compression_extension, + void FAR* FAR* mls, U32 FAR* mlssize, + AILLENGTHYCB callback); DXDEC S32 AILCALL AIL_merge_DLS_with_XMI(void FAR* xmi, void FAR* dls, - void FAR* FAR* mss, U32 FAR* msssize); + void FAR* FAR* mss, U32 FAR* msssize); -DXDEC S32 AILCALL AIL_extract_DLS( void FAR *source_image, //) - S32 source_size, - void FAR * FAR *XMI_output_data, - S32 FAR *XMI_output_size, - void FAR * FAR *DLS_output_data, - S32 FAR *DLS_output_size, - AILLENGTHYCB callback); +DXDEC S32 AILCALL AIL_extract_DLS( void FAR *source_image, //) + S32 source_size, + void FAR * FAR *XMI_output_data, + S32 FAR *XMI_output_size, + void FAR * FAR *DLS_output_data, + S32 FAR *DLS_output_size, + AILLENGTHYCB callback); #define AILFILTERDLS_USINGLIST 1 DXDEC S32 AILCALL AIL_filter_DLS_with_XMI(void FAR* xmi, void FAR* dls, - void FAR* FAR* dlsout, U32 FAR* dlssize, - S32 flags, AILLENGTHYCB callback); + void FAR* FAR* dlsout, U32 FAR* dlssize, + S32 flags, AILLENGTHYCB callback); #define AILMIDITOXMI_USINGLIST 1 #define AILMIDITOXMI_TOLERANT 2 -DXDEC S32 AILCALL AIL_MIDI_to_XMI (void FAR* MIDI, - U32 MIDI_size, - void FAR* FAR*XMIDI, - U32 FAR* XMIDI_size, - S32 flags); +DXDEC S32 AILCALL AIL_MIDI_to_XMI (void FAR* MIDI, + U32 MIDI_size, + void FAR* FAR*XMIDI, + U32 FAR* XMIDI_size, + S32 flags); #define AILMIDILIST_ROLANDSYSEX 1 -#define AILMIDILIST_ROLANDUN 2 -#define AILMIDILIST_ROLANDAB 4 +#define AILMIDILIST_ROLANDUN 2 +#define AILMIDILIST_ROLANDAB 4 -DXDEC S32 AILCALL AIL_list_MIDI (void FAR* MIDI, - U32 MIDI_size, - char FAR* FAR* lst, - U32 FAR* lst_size, - S32 flags); +DXDEC S32 AILCALL AIL_list_MIDI (void FAR* MIDI, + U32 MIDI_size, + char FAR* FAR* lst, + U32 FAR* lst_size, + S32 flags); #define AILDLSLIST_ARTICULATION 1 -#define AILDLSLIST_DUMP_WAVS 2 +#define AILDLSLIST_DUMP_WAVS 2 -DXDEC S32 AILCALL AIL_list_DLS (void FAR* DLS, - char FAR* FAR* lst, - U32 FAR* lst_size, - S32 flags, - C8 FAR* title); +DXDEC S32 AILCALL AIL_list_DLS (void FAR* DLS, + char FAR* FAR* lst, + U32 FAR* lst_size, + S32 flags, + C8 FAR* title); -#define AILFILETYPE_UNKNOWN 0 -#define AILFILETYPE_PCM_WAV 1 +#define AILFILETYPE_UNKNOWN 0 +#define AILFILETYPE_PCM_WAV 1 #define AILFILETYPE_ADPCM_WAV 2 #define AILFILETYPE_OTHER_WAV 3 -#define AILFILETYPE_VOC 4 -#define AILFILETYPE_MIDI 5 -#define AILFILETYPE_XMIDI 6 +#define AILFILETYPE_VOC 4 +#define AILFILETYPE_MIDI 5 +#define AILFILETYPE_XMIDI 6 #define AILFILETYPE_XMIDI_DLS 7 #define AILFILETYPE_XMIDI_MLS 8 -#define AILFILETYPE_DLS 9 -#define AILFILETYPE_MLS 10 +#define AILFILETYPE_DLS 9 +#define AILFILETYPE_MLS 10 #define AILFILETYPE_MPEG_L1_AUDIO 11 #define AILFILETYPE_MPEG_L2_AUDIO 12 #define AILFILETYPE_MPEG_L3_AUDIO 13 DXDEC S32 AILCALL AIL_file_type(void FAR* data, U32 size); -DXDEC S32 AILCALL AIL_find_DLS (void FAR* data, U32 size, - void FAR* FAR* xmi, U32 FAR* xmisize, - void FAR* FAR* dls, U32 FAR* dlssize); +DXDEC S32 AILCALL AIL_find_DLS (void FAR* data, U32 size, + void FAR* FAR* xmi, U32 FAR* xmisize, + void FAR* FAR* dls, U32 FAR* dlssize); #ifdef IS_WIN32 @@ -3609,21 +3609,21 @@ DXDEC HDIGDRIVER AILCALL AIL_primary_digital_driver (HDIGDRIVER new_primary); typedef S32 FLTRESULT; -#define FLT_NOERR 0 // Success -- no error -#define FLT_NOT_ENABLED 1 // FLT not enabled -#define FLT_ALREADY_STARTED 2 // FLT already started -#define FLT_INVALID_PARAM 3 // Invalid parameters used -#define FLT_INTERNAL_ERR 4 // Internal error in FLT driver -#define FLT_OUT_OF_MEM 5 // Out of system RAM -#define FLT_ERR_NOT_IMPLEMENTED 6 // Feature not implemented -#define FLT_NOT_FOUND 7 // FLT supported device not found -#define FLT_NOT_INIT 8 // FLT not initialized -#define FLT_CLOSE_ERR 9 // FLT not closed correctly +#define FLT_NOERR 0 // Success -- no error +#define FLT_NOT_ENABLED 1 // FLT not enabled +#define FLT_ALREADY_STARTED 2 // FLT already started +#define FLT_INVALID_PARAM 3 // Invalid parameters used +#define FLT_INTERNAL_ERR 4 // Internal error in FLT driver +#define FLT_OUT_OF_MEM 5 // Out of system RAM +#define FLT_ERR_NOT_IMPLEMENTED 6 // Feature not implemented +#define FLT_NOT_FOUND 7 // FLT supported device not found +#define FLT_NOT_INIT 8 // FLT not initialized +#define FLT_CLOSE_ERR 9 // FLT not closed correctly //############################################################################ -//## ## -//## Interface "MSS pipeline filter" ## -//## ## +//## ## +//## Interface "MSS pipeline filter" ## +//## ## //############################################################################ typedef FLTRESULT (AILCALL FAR *FLT_STARTUP)(void); @@ -3632,136 +3632,136 @@ typedef FLTRESULT (AILCALL FAR *FLT_SHUTDOWN)(void); typedef C8 FAR * (AILCALL FAR *FLT_ERROR)(void); -typedef S32 (AILCALL FAR *FLT_SET_PROVIDER_PREFERENCE)(HATTRIB preference, - void FAR* value); +typedef S32 (AILCALL FAR *FLT_SET_PROVIDER_PREFERENCE)(HATTRIB preference, + void FAR* value); typedef HDRIVERSTATE (AILCALL FAR *FLT_OPEN_DRIVER) (HDIGDRIVER dig, - S32 FAR *build_buffer, - S32 build_buffer_size); + S32 FAR *build_buffer, + S32 build_buffer_size); -typedef FLTRESULT (AILCALL FAR *FLT_CLOSE_DRIVER) (HDRIVERSTATE state); +typedef FLTRESULT (AILCALL FAR *FLT_CLOSE_DRIVER) (HDRIVERSTATE state); -typedef void (AILCALL FAR *FLT_PREMIX_PROCESS) (HDRIVERSTATE driver); +typedef void (AILCALL FAR *FLT_PREMIX_PROCESS) (HDRIVERSTATE driver); -typedef void (AILCALL FAR *FLT_POSTMIX_PROCESS) (HDRIVERSTATE driver); +typedef void (AILCALL FAR *FLT_POSTMIX_PROCESS) (HDRIVERSTATE driver); //############################################################################ -//## ## -//## Interface "Pipeline filter sample services" ## -//## ## +//## ## +//## Interface "Pipeline filter sample services" ## +//## ## //############################################################################ typedef HSAMPLESTATE (AILCALL FAR * FLTSMP_OPEN_SAMPLE) (HDRIVERSTATE driver, - HSAMPLE S); + HSAMPLE S); -typedef FLTRESULT (AILCALL FAR * FLTSMP_CLOSE_SAMPLE) (HSAMPLESTATE state); +typedef FLTRESULT (AILCALL FAR * FLTSMP_CLOSE_SAMPLE) (HSAMPLESTATE state); -typedef S32 (AILCALL FAR * FLTSMP_SAMPLE_PROCESS) (HSAMPLESTATE state, - void FAR * FAR *orig_src, - U32 FAR * orig_src_fract, - void FAR * orig_src_end, - S32 FAR * FAR *build_dest, - void FAR * build_dest_end, - S32 FAR * left_val, - S32 FAR * right_val, - S32 playback_ratio, - S32 left_scale, - S32 right_scale, - S32 base_scale, - MIXSTAGE FAR * mixer_provider, - U32 mixer_operation); +typedef S32 (AILCALL FAR * FLTSMP_SAMPLE_PROCESS) (HSAMPLESTATE state, + void FAR * FAR *orig_src, + U32 FAR * orig_src_fract, + void FAR * orig_src_end, + S32 FAR * FAR *build_dest, + void FAR * build_dest_end, + S32 FAR * left_val, + S32 FAR * right_val, + S32 playback_ratio, + S32 left_scale, + S32 right_scale, + S32 base_scale, + MIXSTAGE FAR * mixer_provider, + U32 mixer_operation); -typedef S32 (AILCALL FAR * FLTSMP_SAMPLE_ATTRIBUTE) (HSAMPLESTATE state, - HATTRIB attribute); +typedef S32 (AILCALL FAR * FLTSMP_SAMPLE_ATTRIBUTE) (HSAMPLESTATE state, + HATTRIB attribute); -typedef S32 (AILCALL FAR * FLTSMP_SET_SAMPLE_PREFERENCE) (HSAMPLESTATE state, - HATTRIB preference, - void FAR* value); +typedef S32 (AILCALL FAR * FLTSMP_SET_SAMPLE_PREFERENCE) (HSAMPLESTATE state, + HATTRIB preference, + void FAR* value); // // Pipeline filter calls // -DXDEC S32 AILCALL AIL_enumerate_filters (HPROENUM FAR *next, - HPROVIDER FAR *dest, - C8 FAR * FAR *name); +DXDEC S32 AILCALL AIL_enumerate_filters (HPROENUM FAR *next, + HPROVIDER FAR *dest, + C8 FAR * FAR *name); DXDEC HDRIVERSTATE - AILCALL AIL_open_filter (HPROVIDER lib, - HDIGDRIVER dig); + AILCALL AIL_open_filter (HPROVIDER lib, + HDIGDRIVER dig); -DXDEC void AILCALL AIL_close_filter (HDRIVERSTATE filter); +DXDEC void AILCALL AIL_close_filter (HDRIVERSTATE filter); -DXDEC S32 AILCALL AIL_enumerate_filter_attributes - (HPROVIDER lib, - HINTENUM FAR * next, - RIB_INTERFACE_ENTRY FAR * dest); +DXDEC S32 AILCALL AIL_enumerate_filter_attributes + (HPROVIDER lib, + HINTENUM FAR * next, + RIB_INTERFACE_ENTRY FAR * dest); -DXDEC void AILCALL AIL_filter_attribute (HPROVIDER lib, - C8 FAR * name, - void FAR * val); +DXDEC void AILCALL AIL_filter_attribute (HPROVIDER lib, + C8 FAR * name, + void FAR * val); -DXDEC void AILCALL AIL_set_filter_preference - (HPROVIDER lib, - C8 FAR * name, - void FAR * val); +DXDEC void AILCALL AIL_set_filter_preference + (HPROVIDER lib, + C8 FAR * name, + void FAR * val); -DXDEC S32 AILCALL AIL_enumerate_filter_sample_attributes - (HPROVIDER lib, - HINTENUM FAR * next, - RIB_INTERFACE_ENTRY FAR * dest); +DXDEC S32 AILCALL AIL_enumerate_filter_sample_attributes + (HPROVIDER lib, + HINTENUM FAR * next, + RIB_INTERFACE_ENTRY FAR * dest); -DXDEC void AILCALL AIL_filter_sample_attribute - (HSAMPLE S, - C8 FAR * name, - void FAR * val); +DXDEC void AILCALL AIL_filter_sample_attribute + (HSAMPLE S, + C8 FAR * name, + void FAR * val); -DXDEC void AILCALL AIL_filter_stream_attribute - (HSTREAM S, - C8 FAR * name, - void FAR * val); +DXDEC void AILCALL AIL_filter_stream_attribute + (HSTREAM S, + C8 FAR * name, + void FAR * val); -DXDEC void AILCALL AIL_filter_DLS_attribute - (HDLSDEVICE dls, - C8 FAR * name, - void FAR * val); +DXDEC void AILCALL AIL_filter_DLS_attribute + (HDLSDEVICE dls, + C8 FAR * name, + void FAR * val); -DXDEC void AILCALL AIL_set_filter_sample_preference - (HSAMPLE S, - C8 FAR * name, - void FAR * val); +DXDEC void AILCALL AIL_set_filter_sample_preference + (HSAMPLE S, + C8 FAR * name, + void FAR * val); -DXDEC void AILCALL AIL_set_filter_stream_preference - (HSTREAM S, - C8 FAR * name, - void FAR * val); +DXDEC void AILCALL AIL_set_filter_stream_preference + (HSTREAM S, + C8 FAR * name, + void FAR * val); -DXDEC void AILCALL AIL_set_filter_DLS_preference - (HDLSDEVICE dls, - C8 FAR * name, - void FAR * val); +DXDEC void AILCALL AIL_set_filter_DLS_preference + (HDLSDEVICE dls, + C8 FAR * name, + void FAR * val); typedef struct _FLTPROVIDER { - PROVIDER_QUERY_ATTRIBUTE PROVIDER_query_attribute; + PROVIDER_QUERY_ATTRIBUTE PROVIDER_query_attribute; - FLT_STARTUP startup; - FLT_ERROR error; - FLT_SHUTDOWN shutdown; - FLT_SET_PROVIDER_PREFERENCE set_provider_preference; - FLT_OPEN_DRIVER open_driver; - FLT_CLOSE_DRIVER close_driver; - FLT_PREMIX_PROCESS premix_process; - FLT_POSTMIX_PROCESS postmix_process; + FLT_STARTUP startup; + FLT_ERROR error; + FLT_SHUTDOWN shutdown; + FLT_SET_PROVIDER_PREFERENCE set_provider_preference; + FLT_OPEN_DRIVER open_driver; + FLT_CLOSE_DRIVER close_driver; + FLT_PREMIX_PROCESS premix_process; + FLT_POSTMIX_PROCESS postmix_process; - FLTSMP_OPEN_SAMPLE open_sample; - FLTSMP_CLOSE_SAMPLE close_sample; - FLTSMP_SAMPLE_PROCESS sample_process; - FLTSMP_SAMPLE_ATTRIBUTE sample_attribute; - FLTSMP_SET_SAMPLE_PREFERENCE set_sample_preference; + FLTSMP_OPEN_SAMPLE open_sample; + FLTSMP_CLOSE_SAMPLE close_sample; + FLTSMP_SAMPLE_PROCESS sample_process; + FLTSMP_SAMPLE_ATTRIBUTE sample_attribute; + FLTSMP_SET_SAMPLE_PREFERENCE set_sample_preference; HDIGDRIVER dig; - HPROVIDER provider; + HPROVIDER provider; HDRIVERSTATE driver_state; struct _FLTPROVIDER FAR *next; @@ -3772,78 +3772,78 @@ FLTPROVIDER; // 3D provider calls // -DXDEC S32 AILCALL AIL_enumerate_3D_providers (HPROENUM FAR *next, - HPROVIDER FAR *dest, - C8 FAR * FAR *name); +DXDEC S32 AILCALL AIL_enumerate_3D_providers (HPROENUM FAR *next, + HPROVIDER FAR *dest, + C8 FAR * FAR *name); -DXDEC M3DRESULT AILCALL AIL_open_3D_provider (HPROVIDER lib); +DXDEC M3DRESULT AILCALL AIL_open_3D_provider (HPROVIDER lib); -DXDEC void AILCALL AIL_close_3D_provider (HPROVIDER lib); +DXDEC void AILCALL AIL_close_3D_provider (HPROVIDER lib); -DXDEC S32 AILCALL AIL_enumerate_3D_provider_attributes - (HPROVIDER lib, - HINTENUM FAR * next, - RIB_INTERFACE_ENTRY FAR * dest); +DXDEC S32 AILCALL AIL_enumerate_3D_provider_attributes + (HPROVIDER lib, + HINTENUM FAR * next, + RIB_INTERFACE_ENTRY FAR * dest); -DXDEC void AILCALL AIL_3D_provider_attribute (HPROVIDER lib, - C8 FAR * name, - void FAR * val); +DXDEC void AILCALL AIL_3D_provider_attribute (HPROVIDER lib, + C8 FAR * name, + void FAR * val); -DXDEC void AILCALL AIL_set_3D_provider_preference(HPROVIDER lib, - C8 FAR * name, - void FAR * val); +DXDEC void AILCALL AIL_set_3D_provider_preference(HPROVIDER lib, + C8 FAR * name, + void FAR * val); struct H3D { H3DPOBJECT actual; HPROVIDER owner; - S32 user_data[8]; + S32 user_data[8]; }; typedef struct _M3DPROVIDER { - PROVIDER_QUERY_ATTRIBUTE PROVIDER_query_attribute; - M3D_STARTUP startup; - M3D_ERROR error; - M3D_SHUTDOWN shutdown; - M3D_SET_PROVIDER_PREFERENCE set_provider_preference; - M3D_ACTIVATE activate; + PROVIDER_QUERY_ATTRIBUTE PROVIDER_query_attribute; + M3D_STARTUP startup; + M3D_ERROR error; + M3D_SHUTDOWN shutdown; + M3D_SET_PROVIDER_PREFERENCE set_provider_preference; + M3D_ACTIVATE activate; M3D_ALLOCATE_3D_SAMPLE_HANDLE allocate_3D_sample_handle; - M3D_RELEASE_3D_SAMPLE_HANDLE release_3D_sample_handle; - M3D_START_3D_SAMPLE start_3D_sample; - M3D_STOP_3D_SAMPLE stop_3D_sample; - M3D_RESUME_3D_SAMPLE resume_3D_sample; - M3D_END_3D_SAMPLE end_3D_sample; - M3D_SET_3D_SAMPLE_DATA set_3D_sample_data; - M3D_SET_3D_SAMPLE_VOLUME set_3D_sample_volume; + M3D_RELEASE_3D_SAMPLE_HANDLE release_3D_sample_handle; + M3D_START_3D_SAMPLE start_3D_sample; + M3D_STOP_3D_SAMPLE stop_3D_sample; + M3D_RESUME_3D_SAMPLE resume_3D_sample; + M3D_END_3D_SAMPLE end_3D_sample; + M3D_SET_3D_SAMPLE_DATA set_3D_sample_data; + M3D_SET_3D_SAMPLE_VOLUME set_3D_sample_volume; M3D_SET_3D_SAMPLE_PLAYBACK_RATE set_3D_sample_playback_rate; - M3D_SET_3D_SAMPLE_OFFSET set_3D_sample_offset; - M3D_SET_3D_SAMPLE_LOOP_COUNT set_3D_sample_loop_count; - M3D_SET_3D_SAMPLE_LOOP_BLOCK set_3D_sample_loop_block; - M3D_3D_SAMPLE_STATUS sample_status; - M3D_3D_SAMPLE_VOLUME sample_volume; - M3D_3D_SAMPLE_PLAYBACK_RATE sample_playback_rate; - M3D_3D_SAMPLE_OFFSET sample_offset; - M3D_3D_SAMPLE_LENGTH sample_length; - M3D_3D_SAMPLE_LOOP_COUNT sample_loop_count; - M3D_SET_3D_SAMPLE_DISTANCES set_3D_sample_distances; - M3D_3D_SAMPLE_DISTANCES sample_distances; - M3D_ACTIVE_3D_SAMPLE_COUNT active_3D_sample_count; - M3D_3D_OPEN_LISTENER open_listener; - M3D_3D_CLOSE_LISTENER close_listener; - M3D_3D_OPEN_OBJECT open_object; - M3D_3D_CLOSE_OBJECT close_object; - M3D_SET_3D_POSITION set_3D_position; - M3D_SET_3D_VELOCITY set_3D_velocity; - M3D_SET_3D_VELOCITY_VECTOR set_3D_velocity_vector; - M3D_SET_3D_ORIENTATION set_3D_orientation; - M3D_3D_POSITION position; - M3D_3D_VELOCITY velocity; - M3D_3D_ORIENTATION orientation; - M3D_3D_UPDATE_POSITION update_position; - M3D_3D_AUTO_UPDATE_POSITION auto_update_position; - M3D_3D_SAMPLE_ATTRIBUTE sample_query_attribute; - M3D_3D_SET_SAMPLE_PREFERENCE set_sample_preference; + M3D_SET_3D_SAMPLE_OFFSET set_3D_sample_offset; + M3D_SET_3D_SAMPLE_LOOP_COUNT set_3D_sample_loop_count; + M3D_SET_3D_SAMPLE_LOOP_BLOCK set_3D_sample_loop_block; + M3D_3D_SAMPLE_STATUS sample_status; + M3D_3D_SAMPLE_VOLUME sample_volume; + M3D_3D_SAMPLE_PLAYBACK_RATE sample_playback_rate; + M3D_3D_SAMPLE_OFFSET sample_offset; + M3D_3D_SAMPLE_LENGTH sample_length; + M3D_3D_SAMPLE_LOOP_COUNT sample_loop_count; + M3D_SET_3D_SAMPLE_DISTANCES set_3D_sample_distances; + M3D_3D_SAMPLE_DISTANCES sample_distances; + M3D_ACTIVE_3D_SAMPLE_COUNT active_3D_sample_count; + M3D_3D_OPEN_LISTENER open_listener; + M3D_3D_CLOSE_LISTENER close_listener; + M3D_3D_OPEN_OBJECT open_object; + M3D_3D_CLOSE_OBJECT close_object; + M3D_SET_3D_POSITION set_3D_position; + M3D_SET_3D_VELOCITY set_3D_velocity; + M3D_SET_3D_VELOCITY_VECTOR set_3D_velocity_vector; + M3D_SET_3D_ORIENTATION set_3D_orientation; + M3D_3D_POSITION position; + M3D_3D_VELOCITY velocity; + M3D_3D_ORIENTATION orientation; + M3D_3D_UPDATE_POSITION update_position; + M3D_3D_AUTO_UPDATE_POSITION auto_update_position; + M3D_3D_SAMPLE_ATTRIBUTE sample_query_attribute; + M3D_3D_SET_SAMPLE_PREFERENCE set_sample_preference; } M3DPROVIDER; // @@ -3851,162 +3851,162 @@ typedef struct _M3DPROVIDER // DXDEC H3DSAMPLE AILCALL AIL_allocate_3D_sample_handle - (HPROVIDER lib); + (HPROVIDER lib); -DXDEC void AILCALL AIL_release_3D_sample_handle - (H3DSAMPLE S); +DXDEC void AILCALL AIL_release_3D_sample_handle + (H3DSAMPLE S); -DXDEC void AILCALL AIL_start_3D_sample (H3DSAMPLE S); +DXDEC void AILCALL AIL_start_3D_sample (H3DSAMPLE S); -DXDEC void AILCALL AIL_stop_3D_sample (H3DSAMPLE S); +DXDEC void AILCALL AIL_stop_3D_sample (H3DSAMPLE S); -DXDEC void AILCALL AIL_resume_3D_sample (H3DSAMPLE S); +DXDEC void AILCALL AIL_resume_3D_sample (H3DSAMPLE S); -DXDEC void AILCALL AIL_end_3D_sample (H3DSAMPLE S); +DXDEC void AILCALL AIL_end_3D_sample (H3DSAMPLE S); -DXDEC S32 AILCALL AIL_set_3D_sample_file (H3DSAMPLE S, - void FAR *file_image); +DXDEC S32 AILCALL AIL_set_3D_sample_file (H3DSAMPLE S, + void FAR *file_image); -DXDEC S32 AILCALL AIL_set_3D_sample_info (H3DSAMPLE S, - AILSOUNDINFO FAR *info); +DXDEC S32 AILCALL AIL_set_3D_sample_info (H3DSAMPLE S, + AILSOUNDINFO FAR *info); -DXDEC void AILCALL AIL_set_3D_sample_volume (H3DSAMPLE S, - S32 volume); +DXDEC void AILCALL AIL_set_3D_sample_volume (H3DSAMPLE S, + S32 volume); -DXDEC void AILCALL AIL_set_3D_sample_offset (H3DSAMPLE S, - U32 offset); +DXDEC void AILCALL AIL_set_3D_sample_offset (H3DSAMPLE S, + U32 offset); -DXDEC void AILCALL AIL_set_3D_sample_playback_rate - (H3DSAMPLE S, - S32 playback_rate); +DXDEC void AILCALL AIL_set_3D_sample_playback_rate + (H3DSAMPLE S, + S32 playback_rate); -DXDEC void AILCALL AIL_set_3D_sample_loop_count(H3DSAMPLE S, - U32 loops); +DXDEC void AILCALL AIL_set_3D_sample_loop_count(H3DSAMPLE S, + U32 loops); -DXDEC void AILCALL AIL_set_3D_sample_loop_block(H3DSAMPLE S, - S32 loop_start_offset, - S32 loop_end_offset); +DXDEC void AILCALL AIL_set_3D_sample_loop_block(H3DSAMPLE S, + S32 loop_start_offset, + S32 loop_end_offset); -DXDEC U32 AILCALL AIL_3D_sample_status (H3DSAMPLE S); +DXDEC U32 AILCALL AIL_3D_sample_status (H3DSAMPLE S); -DXDEC S32 AILCALL AIL_3D_sample_volume (H3DSAMPLE S); +DXDEC S32 AILCALL AIL_3D_sample_volume (H3DSAMPLE S); -DXDEC U32 AILCALL AIL_3D_sample_offset (H3DSAMPLE S); +DXDEC U32 AILCALL AIL_3D_sample_offset (H3DSAMPLE S); -DXDEC S32 AILCALL AIL_3D_sample_playback_rate (H3DSAMPLE S); +DXDEC S32 AILCALL AIL_3D_sample_playback_rate (H3DSAMPLE S); -DXDEC U32 AILCALL AIL_3D_sample_length (H3DSAMPLE S); +DXDEC U32 AILCALL AIL_3D_sample_length (H3DSAMPLE S); -DXDEC U32 AILCALL AIL_3D_sample_loop_count (H3DSAMPLE S); +DXDEC U32 AILCALL AIL_3D_sample_loop_count (H3DSAMPLE S); #define AIL_set_3D_sample_distances AIL_set_3D_sample_float_distances #define AIL_3D_sample_distances AIL_3D_sample_float_distances -DXDEC void AILCALL AIL_set_3D_sample_float_distances - (H3DSAMPLE S, - F32 max_front_dist, - F32 min_front_dist, - F32 max_back_dist, - F32 min_back_dist); +DXDEC void AILCALL AIL_set_3D_sample_float_distances + (H3DSAMPLE S, + F32 max_front_dist, + F32 min_front_dist, + F32 max_back_dist, + F32 min_back_dist); -DXDEC void AILCALL AIL_3D_sample_float_distances - (H3DSAMPLE S, - F32 FAR * max_front_dist, - F32 FAR * min_front_dist, - F32 FAR * max_back_dist, - F32 FAR * min_back_dist); +DXDEC void AILCALL AIL_3D_sample_float_distances + (H3DSAMPLE S, + F32 FAR * max_front_dist, + F32 FAR * min_front_dist, + F32 FAR * max_back_dist, + F32 FAR * min_back_dist); -DXDEC S32 AILCALL AIL_active_3D_sample_count (HPROVIDER lib); +DXDEC S32 AILCALL AIL_active_3D_sample_count (HPROVIDER lib); -DXDEC S32 AILCALL AIL_enumerate_3D_sample_attributes - (HPROVIDER lib, - HINTENUM FAR * next, - RIB_INTERFACE_ENTRY FAR * dest); +DXDEC S32 AILCALL AIL_enumerate_3D_sample_attributes + (HPROVIDER lib, + HINTENUM FAR * next, + RIB_INTERFACE_ENTRY FAR * dest); -DXDEC void AILCALL AIL_3D_sample_attribute (H3DSAMPLE samp, - C8 FAR * name, - void FAR * val); +DXDEC void AILCALL AIL_3D_sample_attribute (H3DSAMPLE samp, + C8 FAR * name, + void FAR * val); -DXDEC void AILCALL AIL_set_3D_sample_preference (H3DSAMPLE samp, - C8 FAR * name, - void FAR * val); +DXDEC void AILCALL AIL_set_3D_sample_preference (H3DSAMPLE samp, + C8 FAR * name, + void FAR * val); // // Positioning-object allocation calls // -DXDEC H3DPOBJECT AILCALL AIL_open_3D_listener (HPROVIDER lib); +DXDEC H3DPOBJECT AILCALL AIL_open_3D_listener (HPROVIDER lib); -DXDEC void AILCALL AIL_close_3D_listener (H3DPOBJECT listener); +DXDEC void AILCALL AIL_close_3D_listener (H3DPOBJECT listener); -DXDEC H3DPOBJECT AILCALL AIL_open_3D_object (HPROVIDER lib); +DXDEC H3DPOBJECT AILCALL AIL_open_3D_object (HPROVIDER lib); -DXDEC void AILCALL AIL_close_3D_object (H3DPOBJECT obj); +DXDEC void AILCALL AIL_close_3D_object (H3DPOBJECT obj); // // 3D object calls // -DXDEC void AILCALL AIL_set_3D_position (H3DPOBJECT obj, - F32 X, - F32 Y, - F32 Z); +DXDEC void AILCALL AIL_set_3D_position (H3DPOBJECT obj, + F32 X, + F32 Y, + F32 Z); -DXDEC void AILCALL AIL_set_3D_velocity (H3DPOBJECT obj, - F32 dX_per_ms, - F32 dY_per_ms, - F32 dZ_per_ms, - F32 magnitude); +DXDEC void AILCALL AIL_set_3D_velocity (H3DPOBJECT obj, + F32 dX_per_ms, + F32 dY_per_ms, + F32 dZ_per_ms, + F32 magnitude); -DXDEC void AILCALL AIL_set_3D_velocity_vector (H3DPOBJECT obj, - F32 dX_per_ms, - F32 dY_per_ms, - F32 dZ_per_ms); +DXDEC void AILCALL AIL_set_3D_velocity_vector (H3DPOBJECT obj, + F32 dX_per_ms, + F32 dY_per_ms, + F32 dZ_per_ms); -DXDEC void AILCALL AIL_set_3D_orientation (H3DPOBJECT obj, - F32 X_face, - F32 Y_face, - F32 Z_face, - F32 X_up, - F32 Y_up, - F32 Z_up); +DXDEC void AILCALL AIL_set_3D_orientation (H3DPOBJECT obj, + F32 X_face, + F32 Y_face, + F32 Z_face, + F32 X_up, + F32 Y_up, + F32 Z_up); -DXDEC void AILCALL AIL_3D_position (H3DPOBJECT obj, - F32 FAR *X, - F32 FAR *Y, - F32 FAR *Z); +DXDEC void AILCALL AIL_3D_position (H3DPOBJECT obj, + F32 FAR *X, + F32 FAR *Y, + F32 FAR *Z); -DXDEC void AILCALL AIL_3D_velocity (H3DPOBJECT obj, - F32 FAR *dX_per_ms, - F32 FAR *dY_per_ms, - F32 FAR *dZ_per_ms); +DXDEC void AILCALL AIL_3D_velocity (H3DPOBJECT obj, + F32 FAR *dX_per_ms, + F32 FAR *dY_per_ms, + F32 FAR *dZ_per_ms); -DXDEC void AILCALL AIL_3D_orientation (H3DPOBJECT obj, - F32 FAR *X_face, - F32 FAR *Y_face, - F32 FAR *Z_face, - F32 FAR *X_up, - F32 FAR *Y_up, - F32 FAR *Z_up); +DXDEC void AILCALL AIL_3D_orientation (H3DPOBJECT obj, + F32 FAR *X_face, + F32 FAR *Y_face, + F32 FAR *Z_face, + F32 FAR *X_up, + F32 FAR *Y_up, + F32 FAR *Z_up); -DXDEC void AILCALL AIL_3D_update_position (H3DPOBJECT obj, - F32 dt_milliseconds); +DXDEC void AILCALL AIL_3D_update_position (H3DPOBJECT obj, + F32 dt_milliseconds); -DXDEC void AILCALL AIL_3D_auto_update_position (H3DPOBJECT obj, - S32 enable); +DXDEC void AILCALL AIL_3D_auto_update_position (H3DPOBJECT obj, + S32 enable); -DXDEC void AILCALL AIL_set_3D_user_data (H3DPOBJECT obj, - U32 index, - S32 value); +DXDEC void AILCALL AIL_set_3D_user_data (H3DPOBJECT obj, + U32 index, + S32 value); -DXDEC S32 AILCALL AIL_3D_user_data (H3DPOBJECT obj, - U32 index); +DXDEC S32 AILCALL AIL_3D_user_data (H3DPOBJECT obj, + U32 index); // Obsolete 3D function names: #define AIL_set_3D_object_user_data AIL_set_3D_user_data @@ -4024,34 +4024,34 @@ DXDEC S32 AILCALL AIL_3D_user_data (H3DPOBJECT obj, enum { - EAX_ENVIRONMENT_GENERIC, // factory default - EAX_ENVIRONMENT_PADDEDCELL, - EAX_ENVIRONMENT_ROOM, // standard environments - EAX_ENVIRONMENT_BATHROOM, - EAX_ENVIRONMENT_LIVINGROOM, - EAX_ENVIRONMENT_STONEROOM, - EAX_ENVIRONMENT_AUDITORIUM, - EAX_ENVIRONMENT_CONCERTHALL, - EAX_ENVIRONMENT_CAVE, - EAX_ENVIRONMENT_ARENA, - EAX_ENVIRONMENT_HANGAR, - EAX_ENVIRONMENT_CARPETEDHALLWAY, - EAX_ENVIRONMENT_HALLWAY, - EAX_ENVIRONMENT_STONECORRIDOR, - EAX_ENVIRONMENT_ALLEY, - EAX_ENVIRONMENT_FOREST, - EAX_ENVIRONMENT_CITY, - EAX_ENVIRONMENT_MOUNTAINS, - EAX_ENVIRONMENT_QUARRY, - EAX_ENVIRONMENT_PLAIN, - EAX_ENVIRONMENT_PARKINGLOT, - EAX_ENVIRONMENT_SEWERPIPE, - EAX_ENVIRONMENT_UNDERWATER, - EAX_ENVIRONMENT_DRUGGED, - EAX_ENVIRONMENT_DIZZY, - EAX_ENVIRONMENT_PSYCHOTIC, + EAX_ENVIRONMENT_GENERIC, // factory default + EAX_ENVIRONMENT_PADDEDCELL, + EAX_ENVIRONMENT_ROOM, // standard environments + EAX_ENVIRONMENT_BATHROOM, + EAX_ENVIRONMENT_LIVINGROOM, + EAX_ENVIRONMENT_STONEROOM, + EAX_ENVIRONMENT_AUDITORIUM, + EAX_ENVIRONMENT_CONCERTHALL, + EAX_ENVIRONMENT_CAVE, + EAX_ENVIRONMENT_ARENA, + EAX_ENVIRONMENT_HANGAR, + EAX_ENVIRONMENT_CARPETEDHALLWAY, + EAX_ENVIRONMENT_HALLWAY, + EAX_ENVIRONMENT_STONECORRIDOR, + EAX_ENVIRONMENT_ALLEY, + EAX_ENVIRONMENT_FOREST, + EAX_ENVIRONMENT_CITY, + EAX_ENVIRONMENT_MOUNTAINS, + EAX_ENVIRONMENT_QUARRY, + EAX_ENVIRONMENT_PLAIN, + EAX_ENVIRONMENT_PARKINGLOT, + EAX_ENVIRONMENT_SEWERPIPE, + EAX_ENVIRONMENT_UNDERWATER, + EAX_ENVIRONMENT_DRUGGED, + EAX_ENVIRONMENT_DIZZY, + EAX_ENVIRONMENT_PSYCHOTIC, - EAX_ENVIRONMENT_COUNT // total number of environments + EAX_ENVIRONMENT_COUNT // total number of environments }; #define EAX_REVERBMIX_USEDISTANCE (-1.0F) diff --git a/Standard Gaming Platform/Mss.h b/Standard Gaming Platform/Mss.h index f725cca3..c89f8e5d 100644 --- a/Standard Gaming Platform/Mss.h +++ b/Standard Gaming Platform/Mss.h @@ -1,35 +1,35 @@ //############################################################################ -//## ## -//## Miles Sound System ## -//## ## -//## MSS.H: Miles Sound System main header file ## -//## ## -//## Version 1.00 of 15-Feb-95: Initial, derived from AIL.H V3.02 ## -//## 1.01 of 19-Jun-95: Added various functions for V3.03 release ## -//## 1.02 of 22-Nov-95: C++ typedef problem fixed, declspecs added ## -//## 1.03 of 15-Feb-96: Changes for 16 bit callbacks and multiple ## -//## 16 bit DLL loads (JKR) ## -//## 1.04 of 2-Nov-97: Changes made to handle DLS in future ## -//## versions ## -//## 1.05 of 1-Jan-98: Massive changes for version 4.0 ## -//## 1.06 of 17-Sep-98: Massive changes for version 5.0 ## -//## 1.07 of 2-Feb-99: Changes for new input API ## -//## 1.08 of 8-Feb-99: Changes for new filter helper functions ## -//## ## -//## Author: John Miles ## -//## ## +//## ## +//## Miles Sound System ## +//## ## +//## MSS.H: Miles Sound System main header file ## +//## ## +//## Version 1.00 of 15-Feb-95: Initial, derived from AIL.H V3.02 ## +//## 1.01 of 19-Jun-95: Added various functions for V3.03 release ## +//## 1.02 of 22-Nov-95: C++ typedef problem fixed, declspecs added ## +//## 1.03 of 15-Feb-96: Changes for 16 bit callbacks and multiple ## +//## 16 bit DLL loads (JKR) ## +//## 1.04 of 2-Nov-97: Changes made to handle DLS in future ## +//## versions ## +//## 1.05 of 1-Jan-98: Massive changes for version 4.0 ## +//## 1.06 of 17-Sep-98: Massive changes for version 5.0 ## +//## 1.07 of 2-Feb-99: Changes for new input API ## +//## 1.08 of 8-Feb-99: Changes for new filter helper functions ## +//## ## +//## Author: John Miles ## +//## ## //############################################################################ -//## ## -//## Contact RAD Game Tools at 425-893-4300 for technical support. ## -//## ## +//## ## +//## Contact RAD Game Tools at 425-893-4300 for technical support. ## +//## ## //############################################################################ #ifndef MSS_VERSION -#define MSS_VERSION "6.1a" +#define MSS_VERSION "6.1a" #define MSS_MAJOR_VERSION 6 #define MSS_MINOR_VERSION 1 -#define MSS_SUB_VERSION 1 +#define MSS_SUB_VERSION 1 #define MSS_VERSION_DATE "06-Mar-01" #define MSS_COPYRIGHT "Copyright (C) 1991-2001, RAD Game Tools, Inc." @@ -102,106 +102,106 @@ #endif #ifdef __DOS__ - #define IS_DOS - #define IS_32 - #define IS_LE - #define IS_X86 + #define IS_DOS + #define IS_32 + #define IS_LE + #define IS_X86 #else - #ifdef _WIN32 - #define IS_WINDOWS - #define IS_WIN32 - #define IS_32 - #define IS_LE - #define IS_X86 - #else - #ifdef WIN32 - #define IS_WINDOWS - #define IS_WIN32 - #define IS_32 - #define IS_LE - #define IS_X86 - #else - #ifdef __NT__ - #define IS_WINDOWS - #define IS_WIN32 - #define IS_32 - #define IS_LE - #define IS_X86 - #else - #ifdef __WIN32__ - #define IS_WINDOWS - #define IS_WIN32 - #define IS_32 - #define IS_LE - #define IS_X86 - #else - #ifdef _WINDOWS - #define IS_WINDOWS - #define IS_WIN16 - #define IS_16 - #define IS_LE - #define IS_X86 - #else - #ifdef _WINDLL - #define IS_WINDOWS - #define IS_WIN16 - #define IS_16 - #define IS_LE - #define IS_X86 - #else - #ifdef WINDOWS - #define IS_WINDOWS - #define IS_WIN16 - #define IS_16 - #define IS_LE - #define IS_X86 - #else - #ifdef __WINDOWS__ - #define IS_WINDOWS - #define IS_WIN16 - #define IS_16 - #define IS_LE - #define IS_X86 - #else - #ifdef _Windows - #define IS_WINDOWS - #define IS_WIN16 - #define IS_16 - #define IS_LE - #define IS_X86 - #else - #if defined(macintosh) || defined(__powerc) || defined(powerc) || defined(__POWERPC__) || defined(__MC68K__) - #define IS_MAC - #define IS_32 - #define IS_BE - #if defined(__powerc) || defined(powerc) || defined(__POWERPC__) - #define IS_PPC - #else - #if defined(__MC68K__) - #define IS_68K - #endif - #endif - #endif - #endif - #endif - #endif - #endif - #endif - #endif - #endif - #endif - #endif + #ifdef _WIN32 + #define IS_WINDOWS + #define IS_WIN32 + #define IS_32 + #define IS_LE + #define IS_X86 + #else + #ifdef WIN32 + #define IS_WINDOWS + #define IS_WIN32 + #define IS_32 + #define IS_LE + #define IS_X86 + #else + #ifdef __NT__ + #define IS_WINDOWS + #define IS_WIN32 + #define IS_32 + #define IS_LE + #define IS_X86 + #else + #ifdef __WIN32__ + #define IS_WINDOWS + #define IS_WIN32 + #define IS_32 + #define IS_LE + #define IS_X86 + #else + #ifdef _WINDOWS + #define IS_WINDOWS + #define IS_WIN16 + #define IS_16 + #define IS_LE + #define IS_X86 + #else + #ifdef _WINDLL + #define IS_WINDOWS + #define IS_WIN16 + #define IS_16 + #define IS_LE + #define IS_X86 + #else + #ifdef WINDOWS + #define IS_WINDOWS + #define IS_WIN16 + #define IS_16 + #define IS_LE + #define IS_X86 + #else + #ifdef __WINDOWS__ + #define IS_WINDOWS + #define IS_WIN16 + #define IS_16 + #define IS_LE + #define IS_X86 + #else + #ifdef _Windows + #define IS_WINDOWS + #define IS_WIN16 + #define IS_16 + #define IS_LE + #define IS_X86 + #else + #if defined(macintosh) || defined(__powerc) || defined(powerc) || defined(__POWERPC__) || defined(__MC68K__) + #define IS_MAC + #define IS_32 + #define IS_BE + #if defined(__powerc) || defined(powerc) || defined(__POWERPC__) + #define IS_PPC + #else + #if defined(__MC68K__) + #define IS_68K + #endif + #endif + #endif + #endif + #endif + #endif + #endif + #endif + #endif + #endif + #endif + #endif #endif #if (!defined(IS_LE) && !defined(IS_BE)) - #error MSS.H did not detect your platform. Define __DOS__, _WINDOWS, WIN32, or macintosh. + #error MSS.H did not detect your platform. Define __DOS__, _WINDOWS, WIN32, or macintosh. #endif #if defined(_PUSHPOP_SUPPORTED) || PRAGMA_STRUCT_PACKPUSH - #pragma pack(push,1) + #pragma pack(push,1) #else - #pragma pack(1) + #pragma pack(1) #endif #ifdef __cplusplus @@ -221,9 +221,9 @@ extern "C" { #define FOURCC U32 -#define MAKEFOURCC(ch0, ch1, ch2, ch3) \ - ((U32)(U8)(ch0) | ((U32)(U8)(ch1) << 8) | \ - ((U32)(U8)(ch2) << 16) | ((U32)(U8)(ch3) << 24 )) +#define MAKEFOURCC(ch0, ch1, ch2, ch3) \ + ((U32)(U8)(ch0) | ((U32)(U8)(ch1) << 8) | \ + ((U32)(U8)(ch2) << 16) | ((U32)(U8)(ch3) << 24 )) #define mmioFOURCC(w,x,y,z) MAKEFOURCC(w,x,y,z) @@ -270,42 +270,42 @@ extern "C" { #ifdef IS_WIN32 - #define AILEXPORT WINAPI + #define AILEXPORT WINAPI - #ifdef BUILD_MSS - #define DXDEC __declspec(dllexport) - #define DXDEF __declspec(dllexport) - #else + #ifdef BUILD_MSS + #define DXDEC __declspec(dllexport) + #define DXDEF __declspec(dllexport) + #else - #if 1 /*def __BORLANDC__*/ - #define DXDEC extern - #define DXDEF - #else - #define DXDEC __declspec(dllimport) - #endif + #if 1 /*def __BORLANDC__*/ + #define DXDEC extern + #define DXDEF + #else + #define DXDEC __declspec(dllimport) + #endif - #endif + #endif - #define MSSDLLNAME "MSS32.DLL" - #define MSS_REDIST_DIR_NAME "WIN32" + #define MSSDLLNAME "MSS32.DLL" + #define MSS_REDIST_DIR_NAME "WIN32" - #define MSS_DIR_SEP "\\" - #define MSS_DIR_UP ".." MSS_DIR_SEP - #define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_UP + #define MSS_DIR_SEP "\\" + #define MSS_DIR_UP ".." MSS_DIR_SEP + #define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_UP #else - #define AILEXPORT __export WINAPI + #define AILEXPORT __export WINAPI - #define DXDEC extern - #define DXDEF + #define DXDEC extern + #define DXDEF - #define MSSDLLNAME "MSS16.DLL" - #define MSS_REDIST_DIR_NAME "WIN16" - - #define MSS_DIR_SEP "\\" - #define MSS_DIR_UP ".." MSS_DIR_SEP - #define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_UP + #define MSSDLLNAME "MSS16.DLL" + #define MSS_REDIST_DIR_NAME "WIN16" + + #define MSS_DIR_SEP "\\" + #define MSS_DIR_UP ".." MSS_DIR_SEP + #define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_UP #endif @@ -327,16 +327,16 @@ typedef LPVOID AILLPDIRECTSOUNDBUFFER; #define FAR #define AILLIBCALLBACK //pascal -#define AILCALL //pascal -#define AILEXPORT //pascal -#define AILCALLBACK //pascal +#define AILCALL //pascal +#define AILEXPORT //pascal +#define AILCALLBACK //pascal #ifdef BUILD_MSS - #define DXDEC __declspec(export) - #define DXDEF + #define DXDEC __declspec(export) + #define DXDEF #else - #define DXDEC extern - #define DXDEF + #define DXDEC extern + #define DXDEF #endif #define MSS_REDIST_DIR_NAME "MAC" @@ -351,9 +351,9 @@ typedef LPVOID AILLPDIRECTSOUNDBUFFER; #define FOURCC U32 #ifndef MAKEFOURCC -#define MAKEFOURCC(ch0, ch1, ch2, ch3) \ - (((U32)(U8)(ch0) << 24) | ((U32)(U8)(ch1) << 16) | \ - ((U32)(U8)(ch2) << 8) | ((U32)(U8)(ch3) )) +#define MAKEFOURCC(ch0, ch1, ch2, ch3) \ + (((U32)(U8)(ch0) << 24) | ((U32)(U8)(ch1) << 16) | \ + ((U32)(U8)(ch2) << 8) | ((U32)(U8)(ch3) )) #endif #define mmioFOURCC(w,x,y,z) MAKEFOURCC(w,x,y,z) @@ -374,81 +374,81 @@ typedef LPVOID AILLPDIRECTSOUNDBUFFER; // Misc. constant definitions // -#define MAX_DRVRS 16 // Max. # of simultaneous drivers -#define MAX_TIMERS 16 // Max. # of simultaneous timers -#define MAX_NOTES 32 // Max # of notes "on" -#define FOR_NEST 4 // # of nested XMIDI FOR loops -#define NUM_CHANS 16 // # of possible MIDI channels -#define MAX_W_VOICES 16 // Max virtual wave synth voice cnt -#define MAX_W_ENTRIES 512 // 512 wave library entries max. +#define MAX_DRVRS 16 // Max. # of simultaneous drivers +#define MAX_TIMERS 16 // Max. # of simultaneous timers +#define MAX_NOTES 32 // Max # of notes "on" +#define FOR_NEST 4 // # of nested XMIDI FOR loops +#define NUM_CHANS 16 // # of possible MIDI channels +#define MAX_W_VOICES 16 // Max virtual wave synth voice cnt +#define MAX_W_ENTRIES 512 // 512 wave library entries max. #ifdef IS_MAC -#define MAX_INSTR 150 // Max # of instruments 128 + 32 +#define MAX_INSTR 150 // Max # of instruments 128 + 32 #endif -#define MIN_CHAN ( 1-1) // Min channel recognized (0-based) -#define MAX_CHAN (16-1) // Max channel recognized -#define MIN_LOCK_CHAN ( 2-1) // Min channel available for locking -#define MAX_LOCK_CHAN ( 9-1) // Max channel available for locking -#define PERCUSS_CHAN (10-1) // Percussion channel (no locking) +#define MIN_CHAN ( 1-1) // Min channel recognized (0-based) +#define MAX_CHAN (16-1) // Max channel recognized +#define MIN_LOCK_CHAN ( 2-1) // Min channel available for locking +#define MAX_LOCK_CHAN ( 9-1) // Max channel available for locking +#define PERCUSS_CHAN (10-1) // Percussion channel (no locking) -#define AIL_MAX_FILE_HEADER_SIZE 5120 // AIL_set_named_sample_file() requires at least 4K - // of data or the entire file image, whichever is less, - // to determine sample format -#define DIG_F_16BITS_MASK 1 -#define DIG_F_STEREO_MASK 2 -#define DIG_F_ADPCM_MASK 4 +#define AIL_MAX_FILE_HEADER_SIZE 5120 // AIL_set_named_sample_file() requires at least 4K + // of data or the entire file image, whichever is less, + // to determine sample format +#define DIG_F_16BITS_MASK 1 +#define DIG_F_STEREO_MASK 2 +#define DIG_F_ADPCM_MASK 4 -#define DIG_F_MONO_8 0 // PCM data formats -#define DIG_F_MONO_16 (DIG_F_16BITS_MASK) -#define DIG_F_STEREO_8 (DIG_F_STEREO_MASK) -#define DIG_F_STEREO_16 (DIG_F_STEREO_MASK|DIG_F_16BITS_MASK) -#define DIG_F_ADPCM_MONO_16 (DIG_F_ADPCM_MASK |DIG_F_16BITS_MASK) -#define DIG_F_ADPCM_STEREO_16 (DIG_F_ADPCM_MASK |DIG_F_16BITS_MASK|DIG_F_STEREO_MASK) -#define DIG_F_USING_ASI 16 +#define DIG_F_MONO_8 0 // PCM data formats +#define DIG_F_MONO_16 (DIG_F_16BITS_MASK) +#define DIG_F_STEREO_8 (DIG_F_STEREO_MASK) +#define DIG_F_STEREO_16 (DIG_F_STEREO_MASK|DIG_F_16BITS_MASK) +#define DIG_F_ADPCM_MONO_16 (DIG_F_ADPCM_MASK |DIG_F_16BITS_MASK) +#define DIG_F_ADPCM_STEREO_16 (DIG_F_ADPCM_MASK |DIG_F_16BITS_MASK|DIG_F_STEREO_MASK) +#define DIG_F_USING_ASI 16 -#define DIG_PCM_SIGN 0x0001 // (obsolete) -#define DIG_PCM_ORDER 0x0002 +#define DIG_PCM_SIGN 0x0001 // (obsolete) +#define DIG_PCM_ORDER 0x0002 -#define DIG_PCM_POLARITY 0x0004 // PCM flags used by driver hardware -#define DIG_PCM_SPLIT 0x0008 -#define DIG_BUFFER_SERVICE 0x0010 -#define DIG_DUAL_DMA 0x0020 -#define DIG_RECORDING_SUPPORTED 0x8000 +#define DIG_PCM_POLARITY 0x0004 // PCM flags used by driver hardware +#define DIG_PCM_SPLIT 0x0008 +#define DIG_BUFFER_SERVICE 0x0010 +#define DIG_DUAL_DMA 0x0020 +#define DIG_RECORDING_SUPPORTED 0x8000 -#define WAVE_FORMAT_PCM 1 -#define WAVE_FORMAT_IMA_ADPCM 0x0011 +#define WAVE_FORMAT_PCM 1 +#define WAVE_FORMAT_IMA_ADPCM 0x0011 #ifdef IS_DOS -#define AIL3DIG 0 // .DIG driver -#define AIL3MDI 1 // .MDI driver +#define AIL3DIG 0 // .DIG driver +#define AIL3MDI 1 // .MDI driver -#define DIG_DETECT_8_BIT_ONLY 0x0001 // Detect 8-bit DMA only -#define DIG_DETECT_16_BIT_ONLY 0x0002 // Detect 16-bit DMA only -#define DIG_DETECT_8_AND_16_BITS 0x0003 // Detect both 8- and 16-bit DMA +#define DIG_DETECT_8_BIT_ONLY 0x0001 // Detect 8-bit DMA only +#define DIG_DETECT_16_BIT_ONLY 0x0002 // Detect 16-bit DMA only +#define DIG_DETECT_8_AND_16_BITS 0x0003 // Detect both 8- and 16-bit DMA -#define DRV_INIT 0x300 // Functions common to .MDI and .DIG -#define DRV_GET_INFO 0x301 // drivers -#define DRV_SERVE 0x302 -#define DRV_PARSE_ENV 0x303 -#define DRV_VERIFY_IO 0x304 -#define DRV_INIT_DEV 0x305 -#define DRV_SHUTDOWN_DEV 0x306 +#define DRV_INIT 0x300 // Functions common to .MDI and .DIG +#define DRV_GET_INFO 0x301 // drivers +#define DRV_SERVE 0x302 +#define DRV_PARSE_ENV 0x303 +#define DRV_VERIFY_IO 0x304 +#define DRV_INIT_DEV 0x305 +#define DRV_SHUTDOWN_DEV 0x306 -#define DIG_HW_VOLUME 0x400 // .DIG driver functions -#define DIG_START_P_CMD 0x401 -#define DIG_STOP_P_REQ 0x402 -#define DIG_START_R_CMD 0x403 -#define DIG_STOP_R_REQ 0x404 -#define DIG_VSE 0x405 +#define DIG_HW_VOLUME 0x400 // .DIG driver functions +#define DIG_START_P_CMD 0x401 +#define DIG_STOP_P_REQ 0x402 +#define DIG_START_R_CMD 0x403 +#define DIG_STOP_R_REQ 0x404 +#define DIG_VSE 0x405 -#define MDI_HW_VOLUME 0x500 // .MDI driver functions -#define MDI_INIT_INS_MGR 0x501 -#define MDI_MIDI_XMIT 0x502 +#define MDI_HW_VOLUME 0x500 // .MDI driver functions +#define MDI_INIT_INS_MGR 0x501 +#define MDI_MIDI_XMIT 0x502 #define MDI_INSTALL_T_SET 0x503 -#define MDI_GET_T_STATUS 0x504 +#define MDI_GET_T_STATUS 0x504 #define MDI_PROT_UNPROT_T 0x505 -#define MDI_VSE 0x506 +#define MDI_VSE 0x506 #else @@ -465,94 +465,94 @@ typedef LPVOID AILLPDIRECTSOUNDBUFFER; // Non-specific XMIDI/MIDI controllers and event types // -#define SYSEX_BYTE 105 -#define PB_RANGE 106 -#define CHAN_MUTE 107 -#define CALLBACK_PFX 108 -#define SEQ_BRANCH 109 -#define CHAN_LOCK 110 -#define CHAN_PROTECT 111 -#define VOICE_PROTECT 112 -#define TIMBRE_PROTECT 113 -#define PATCH_BANK_SEL 114 -#define INDIRECT_C_PFX 115 -#define FOR_LOOP 116 -#define NEXT_LOOP 117 -#define CLEAR_BEAT_BAR 118 -#define CALLBACK_TRIG 119 -#define SEQ_INDEX 120 +#define SYSEX_BYTE 105 +#define PB_RANGE 106 +#define CHAN_MUTE 107 +#define CALLBACK_PFX 108 +#define SEQ_BRANCH 109 +#define CHAN_LOCK 110 +#define CHAN_PROTECT 111 +#define VOICE_PROTECT 112 +#define TIMBRE_PROTECT 113 +#define PATCH_BANK_SEL 114 +#define INDIRECT_C_PFX 115 +#define FOR_LOOP 116 +#define NEXT_LOOP 117 +#define CLEAR_BEAT_BAR 118 +#define CALLBACK_TRIG 119 +#define SEQ_INDEX 120 -#define GM_BANK_MSB 0 -#define MODULATION 1 -#define DATA_MSB 6 -#define PART_VOLUME 7 -#define PANPOT 10 -#define EXPRESSION 11 -#define GM_BANK_LSB 32 -#define DATA_LSB 38 -#define SUSTAIN 64 -#define REVERB 91 -#define CHORUS 93 -#define RPN_LSB 100 -#define RPN_MSB 101 -#define RESET_ALL_CTRLS 121 -#define ALL_NOTES_OFF 123 +#define GM_BANK_MSB 0 +#define MODULATION 1 +#define DATA_MSB 6 +#define PART_VOLUME 7 +#define PANPOT 10 +#define EXPRESSION 11 +#define GM_BANK_LSB 32 +#define DATA_LSB 38 +#define SUSTAIN 64 +#define REVERB 91 +#define CHORUS 93 +#define RPN_LSB 100 +#define RPN_MSB 101 +#define RESET_ALL_CTRLS 121 +#define ALL_NOTES_OFF 123 -#define EV_NOTE_OFF 0x80 -#define EV_NOTE_ON 0x90 -#define EV_POLY_PRESS 0xa0 -#define EV_CONTROL 0xb0 -#define EV_PROGRAM 0xc0 -#define EV_CHAN_PRESS 0xd0 -#define EV_PITCH 0xe0 -#define EV_SYSEX 0xf0 -#define EV_ESC 0xf7 -#define EV_META 0xff +#define EV_NOTE_OFF 0x80 +#define EV_NOTE_ON 0x90 +#define EV_POLY_PRESS 0xa0 +#define EV_CONTROL 0xb0 +#define EV_PROGRAM 0xc0 +#define EV_CHAN_PRESS 0xd0 +#define EV_PITCH 0xe0 +#define EV_SYSEX 0xf0 +#define EV_ESC 0xf7 +#define EV_META 0xff -#define META_EOT 0x2f -#define META_TEMPO 0x51 -#define META_TIME_SIG 0x58 +#define META_EOT 0x2f +#define META_TEMPO 0x51 +#define META_TIME_SIG 0x58 // // SAMPLE.system_data[] usage // -#define SSD_EOD_CALLBACK 0 // Application end-of-data callback if not NULL -#define VOC_BLK_PTR 1 // Pointer to current block -#define VOC_REP_BLK 2 // Pointer to beginning of repeat loop block -#define VOC_N_REPS 3 // # of iterations left in repeat loop -#define VOC_MARKER 4 // Marker to search for, or -1 if all -#define VOC_MARKER_FOUND 5 // Desired marker found if 1, else 0 -#define SSD_RELEASE 6 // Release sample handle upon termination if >0 +#define SSD_EOD_CALLBACK 0 // Application end-of-data callback if not NULL +#define VOC_BLK_PTR 1 // Pointer to current block +#define VOC_REP_BLK 2 // Pointer to beginning of repeat loop block +#define VOC_N_REPS 3 // # of iterations left in repeat loop +#define VOC_MARKER 4 // Marker to search for, or -1 if all +#define VOC_MARKER_FOUND 5 // Desired marker found if 1, else 0 +#define SSD_RELEASE 6 // Release sample handle upon termination if >0 #ifdef IS_WINDOWS -#define SSD_EOD_CB_WIN32S 7 // Application end-of-data callback is in Win32s +#define SSD_EOD_CB_WIN32S 7 // Application end-of-data callback is in Win32s #else -#define SSD_TEMP 7 // Temporary storage location for general use +#define SSD_TEMP 7 // Temporary storage location for general use #endif // // Timer status values // -#define AILT_FREE 0 // Timer handle is free for allocation -#define AILT_STOPPED 1 // Timer is stopped -#define AILT_RUNNING 2 // Timer is running +#define AILT_FREE 0 // Timer handle is free for allocation +#define AILT_STOPPED 1 // Timer is stopped +#define AILT_RUNNING 2 // Timer is running // // SAMPLE.status flag values // -#define SMP_FREE 0x0001 // Sample is available for allocation +#define SMP_FREE 0x0001 // Sample is available for allocation -#define SMP_DONE 0x0002 // Sample has finished playing, or has - // never been started +#define SMP_DONE 0x0002 // Sample has finished playing, or has + // never been started -#define SMP_PLAYING 0x0004 // Sample is playing +#define SMP_PLAYING 0x0004 // Sample is playing -#define SMP_STOPPED 0x0008 // Sample has been stopped +#define SMP_STOPPED 0x0008 // Sample has been stopped #define SMP_PLAYINGBUTRELEASED 0x0010 // Sample is playing, but digital handle - // has been temporarily released + // has been temporarily released @@ -560,17 +560,17 @@ typedef LPVOID AILLPDIRECTSOUNDBUFFER; // SEQUENCE.status flag values // -#define SEQ_FREE 0x0001 // Sequence is available for allocation +#define SEQ_FREE 0x0001 // Sequence is available for allocation -#define SEQ_DONE 0x0002 // Sequence has finished playing, or has - // never been started +#define SEQ_DONE 0x0002 // Sequence has finished playing, or has + // never been started -#define SEQ_PLAYING 0x0004 // Sequence is playing +#define SEQ_PLAYING 0x0004 // Sequence is playing -#define SEQ_STOPPED 0x0008 // Sequence has been stopped +#define SEQ_STOPPED 0x0008 // Sequence has been stopped #define SEQ_PLAYINGBUTRELEASED 0x0010 // Sequence is playing, but MIDI handle - // has been temporarily released + // has been temporarily released #ifdef IS_DOS @@ -578,24 +578,24 @@ typedef LPVOID AILLPDIRECTSOUNDBUFFER; // MIDI driver types // -#define MDIDRVRTYPE_GM 0 // General MIDI driver (Roland-compatible) -#define MDIDRVRTYPE_FM_2 1 // 2-operator FM MIDI driver (OPL2) -#define MDIDRVRTYPE_FM_4 2 // 4-operator FM MIDI driver (OPL3) -#define MDIDRVRTYPE_SPKR 3 // Tandy or PC speaker "beep" driver +#define MDIDRVRTYPE_GM 0 // General MIDI driver (Roland-compatible) +#define MDIDRVRTYPE_FM_2 1 // 2-operator FM MIDI driver (OPL2) +#define MDIDRVRTYPE_FM_4 2 // 4-operator FM MIDI driver (OPL3) +#define MDIDRVRTYPE_SPKR 3 // Tandy or PC speaker "beep" driver // // .INI installation result codes // -#define AIL_INIT_SUCCESS 0 // Driver installed successfully -#define AIL_NO_INI_FILE 1 // No MDI.INI or DIG.INI file exists -#define AIL_INIT_FAILURE 2 // Driver could not be initialized +#define AIL_INIT_SUCCESS 0 // Driver installed successfully +#define AIL_NO_INI_FILE 1 // No MDI.INI or DIG.INI file exists +#define AIL_INIT_FAILURE 2 // Driver could not be initialized #ifdef __BORLANDC__ #ifndef REALPTR #define REALPTR(x) ((void *) (U32) ((((U32) (x))>>16<<4) + ((x) & 0xffff) \ - - AIL_sel_base(_DS))) + - AIL_sel_base(_DS))) #endif #else @@ -614,9 +614,9 @@ typedef LPVOID AILLPDIRECTSOUNDBUFFER; // AIL_set_direct_buffer_control() command values // -#define AILDS_RELINQUISH 0 // App returns control of secondary buffer -#define AILDS_SEIZE 1 // App takes control of secondary buffer -#define AILDS_SEIZE_LOOP 2 // App wishes to loop the secondary buffer +#define AILDS_RELINQUISH 0 // App returns control of secondary buffer +#define AILDS_SEIZE 1 // App takes control of secondary buffer +#define AILDS_SEIZE_LOOP 2 // App wishes to loop the secondary buffer #endif @@ -670,13 +670,13 @@ typedef LPVOID AILLPDIRECTSOUNDBUFFER; #ifndef FILE_ERRS #define FILE_ERRS -#define AIL_NO_ERROR 0 -#define AIL_IO_ERROR 1 -#define AIL_OUT_OF_MEMORY 2 -#define AIL_FILE_NOT_FOUND 3 +#define AIL_NO_ERROR 0 +#define AIL_IO_ERROR 1 +#define AIL_OUT_OF_MEMORY 2 +#define AIL_FILE_NOT_FOUND 3 #define AIL_CANT_WRITE_FILE 4 -#define AIL_CANT_READ_FILE 5 -#define AIL_DISK_FULL 6 +#define AIL_CANT_READ_FILE 5 +#define AIL_DISK_FULL 6 #endif @@ -689,7 +689,7 @@ typedef LPVOID AILLPDIRECTSOUNDBUFFER; #endif #ifndef NO -#define NO 0 +#define NO 0 #endif #ifndef TRUE @@ -697,146 +697,146 @@ typedef LPVOID AILLPDIRECTSOUNDBUFFER; #endif #ifndef FALSE -#define FALSE 0 +#define FALSE 0 #endif // // Preference names and default values // -#define DIG_RESAMPLING_TOLERANCE 0 -#define DEFAULT_DRT 131 // Resampling triggered at +/- 0.2% +#define DIG_RESAMPLING_TOLERANCE 0 +#define DEFAULT_DRT 131 // Resampling triggered at +/- 0.2% -#define DIG_MIXER_CHANNELS 1 -#define DEFAULT_DMC 64 // 64 allocatable SAMPLE structures +#define DIG_MIXER_CHANNELS 1 +#define DEFAULT_DMC 64 // 64 allocatable SAMPLE structures -#define DIG_DEFAULT_VOLUME 2 -#define DEFAULT_DDV 127 // Default sample volume = 127 (0-127) +#define DIG_DEFAULT_VOLUME 2 +#define DEFAULT_DDV 127 // Default sample volume = 127 (0-127) -#define MDI_SERVICE_RATE 3 -#define DEFAULT_MSR 120 // XMIDI sequencer timing = 120 Hz +#define MDI_SERVICE_RATE 3 +#define DEFAULT_MSR 120 // XMIDI sequencer timing = 120 Hz -#define MDI_SEQUENCES 4 -#define DEFAULT_MS 8 // 8 sequence handles/driver +#define MDI_SEQUENCES 4 +#define DEFAULT_MS 8 // 8 sequence handles/driver -#define MDI_DEFAULT_VOLUME 5 -#define DEFAULT_MDV 127 // Default sequence volume = 127 (0-127) +#define MDI_DEFAULT_VOLUME 5 +#define DEFAULT_MDV 127 // Default sequence volume = 127 (0-127) -#define MDI_QUANT_ADVANCE 6 -#define DEFAULT_MQA 1 // Beat/bar count +1 interval +#define MDI_QUANT_ADVANCE 6 +#define DEFAULT_MQA 1 // Beat/bar count +1 interval -#define MDI_ALLOW_LOOP_BRANCHING 7 -#define DEFAULT_ALB NO // Branches cancel XMIDI FOR loops +#define MDI_ALLOW_LOOP_BRANCHING 7 +#define DEFAULT_ALB NO // Branches cancel XMIDI FOR loops -#define MDI_DEFAULT_BEND_RANGE 8 -#define DEFAULT_MDBR 2 // Default pitch-bend range = 2 +#define MDI_DEFAULT_BEND_RANGE 8 +#define DEFAULT_MDBR 2 // Default pitch-bend range = 2 #ifdef IS_X86 -#define MDI_DOUBLE_NOTE_OFF 9 -#define DEFAULT_MDNO NO // For stuck notes on SB daughterboards +#define MDI_DOUBLE_NOTE_OFF 9 +#define DEFAULT_MDNO NO // For stuck notes on SB daughterboards #endif -#define DIG_ENABLE_RESAMPLE_FILTER 31 // Enable resampling filter by -#define DEFAULT_DERF YES // default +#define DIG_ENABLE_RESAMPLE_FILTER 31 // Enable resampling filter by +#define DEFAULT_DERF YES // default -#define DIG_DECODE_BUFFER_SIZE 32 // 2K decode buffer size by default -#define DEFAULT_DDBS 2048 +#define DIG_DECODE_BUFFER_SIZE 32 // 2K decode buffer size by default +#define DEFAULT_DDBS 2048 #if defined(IS_WINDOWS) || defined(IS_MAC) -#define MDI_SYSEX_BUFFER_SIZE 10 -#define DEFAULT_MSBS 1536 // Default sysex buffer = 1536 bytes +#define MDI_SYSEX_BUFFER_SIZE 10 +#define DEFAULT_MSBS 1536 // Default sysex buffer = 1536 bytes -#define DIG_OUTPUT_BUFFER_SIZE 11 -#define DEFAULT_DOBS 49152 // 48K output buffer size +#define DIG_OUTPUT_BUFFER_SIZE 11 +#define DEFAULT_DOBS 49152 // 48K output buffer size -#define AIL_MM_PERIOD 12 -#define DEFAULT_AMP 5 // Default MM timer period = 5 msec. +#define AIL_MM_PERIOD 12 +#define DEFAULT_AMP 5 // Default MM timer period = 5 msec. #endif #ifdef IS_WINDOWS -#define DIG_DS_FRAGMENT_SIZE 34 -#define DEFAULT_DDFS 8 // Use 8 millisecond buffer fragments with DirectSound if MSS mixer in use +#define DIG_DS_FRAGMENT_SIZE 34 +#define DEFAULT_DDFS 8 // Use 8 millisecond buffer fragments with DirectSound if MSS mixer in use -#define DIG_DS_FRAGMENT_CNT 35 -#define DEFAULT_DDFC 96 // Use 96 buffer fragments with DirectSound if MSS mixer in use +#define DIG_DS_FRAGMENT_CNT 35 +#define DEFAULT_DDFC 96 // Use 96 buffer fragments with DirectSound if MSS mixer in use -#define DIG_DS_MIX_FRAGMENT_CNT 42 -#define DEFAULT_DDMFC 8 // Mix ahead 8 buffer fragments +#define DIG_DS_MIX_FRAGMENT_CNT 42 +#define DEFAULT_DDMFC 8 // Mix ahead 8 buffer fragments -#define DIG_DS_USE_PRIMARY 36 -#define DEFAULT_DDUP NO // Mix into secondary DirectSound buffer by default +#define DIG_DS_USE_PRIMARY 36 +#define DEFAULT_DDUP NO // Mix into secondary DirectSound buffer by default -#define DIG_DS_DSBCAPS_CTRL3D 37 -#define DEFAULT_DDDC NO // Do not use DSBCAPS_CTRL3D by default +#define DIG_DS_DSBCAPS_CTRL3D 37 +#define DEFAULT_DDDC NO // Do not use DSBCAPS_CTRL3D by default -#define DIG_DS_CREATION_HANDLER 38 -#define DEFAULT_DDCH NULL // Use DirectSoundCreate() by default +#define DIG_DS_CREATION_HANDLER 38 +#define DEFAULT_DDCH NULL // Use DirectSoundCreate() by default -#define AIL_TIMERS 13 -#define DEFAULT_AT 16 // 16 allocatable HTIMER handles +#define AIL_TIMERS 13 +#define DEFAULT_AT 16 // 16 allocatable HTIMER handles #define DIG_MAX_CHAIN_ELEMENT_SIZE 14 -#define DEFAULT_MCES 8192 // max of 8192 bytes/waveOut buffer +#define DEFAULT_MCES 8192 // max of 8192 bytes/waveOut buffer #define DIG_MIN_CHAIN_ELEMENT_TIME 45 -#define DEFAULT_MCET 100 // 100 milliseconds buffers +#define DEFAULT_MCET 100 // 100 milliseconds buffers -#define DIG_USE_WAVEOUT 15 -#define DEFAULT_DUW NO // Use DirectSound by default +#define DIG_USE_WAVEOUT 15 +#define DEFAULT_DUW NO // Use DirectSound by default -#define DIG_DS_SECONDARY_SIZE 16 -#define DEFAULT_DDSS (32*1024L) // Must be 2^n -- use 32K by default +#define DIG_DS_SECONDARY_SIZE 16 +#define DEFAULT_DDSS (32*1024L) // Must be 2^n -- use 32K by default -#define DIG_DS_SAMPLE_CEILING 17 -#define DEFAULT_DDSC 44100 // Allow up to 44 kHz samples +#define DIG_DS_SAMPLE_CEILING 17 +#define DEFAULT_DDSC 44100 // Allow up to 44 kHz samples -#define AIL_LOCK_PROTECTION 18 -#define DEFAULT_ALP NO // Don't suspend foreground thread by default +#define AIL_LOCK_PROTECTION 18 +#define DEFAULT_ALP NO // Don't suspend foreground thread by default -#define AIL_WIN32S_CALLBACK_SIZE 19 -#define DEFAULT_WCS 4096 // Size of callback data in bytes +#define AIL_WIN32S_CALLBACK_SIZE 19 +#define DEFAULT_WCS 4096 // Size of callback data in bytes -#define AIL_MUTEX_PROTECTION 44 -#define DEFAULT_AMPR YES // Lock each call into Miles with a mutex +#define AIL_MUTEX_PROTECTION 44 +#define DEFAULT_AMPR YES // Lock each call into Miles with a mutex #else #ifdef IS_DOS -#define DIG_SERVICE_RATE 10 -#define DEFAULT_DSR 200 // DMA buffer-polling rate = 200 Hz +#define DIG_SERVICE_RATE 10 +#define DEFAULT_DSR 200 // DMA buffer-polling rate = 200 Hz -#define DIG_HARDWARE_SAMPLE_RATE 11 -#define DEFAULT_DHSR NOM_VAL // Use nominal sample rate by default +#define DIG_HARDWARE_SAMPLE_RATE 11 +#define DEFAULT_DHSR NOM_VAL // Use nominal sample rate by default -#define DIG_DMA_RESERVE 12 -#define DEFAULT_DDR 32768 // Reserve 32K real-mode mem for DMA +#define DIG_DMA_RESERVE 12 +#define DEFAULT_DDR 32768 // Reserve 32K real-mode mem for DMA -#define DIG_LATENCY 13 -#define DEFAULT_DL 100 // Half-buffer size in ms = 100 +#define DIG_LATENCY 13 +#define DEFAULT_DL 100 // Half-buffer size in ms = 100 -#define DIG_USE_STEREO 14 -#define DEFAULT_DUS NO // Use mono output only +#define DIG_USE_STEREO 14 +#define DEFAULT_DUS NO // Use mono output only -#define DIG_USE_16_BITS 15 -#define DEFAULT_DU16 NO // Use 8-bit output by default +#define DIG_USE_16_BITS 15 +#define DEFAULT_DU16 NO // Use 8-bit output by default -#define DIG_ALLOW_16_BIT_DMA 16 -#define DEFAULT_DA16DMA YES // OK to use 16-bit DMA if necessary +#define DIG_ALLOW_16_BIT_DMA 16 +#define DEFAULT_DA16DMA YES // OK to use 16-bit DMA if necessary -#define DIG_SS_LOCK 17 -#define DEFAULT_DSL NO // Don't disable IRQs while mixing +#define DIG_SS_LOCK 17 +#define DEFAULT_DSL NO // Don't disable IRQs while mixing -#define AIL_SCAN_FOR_HARDWARE 18 -#define DEFAULT_ASH YES // Scan for I/O settings if necessary +#define AIL_SCAN_FOR_HARDWARE 18 +#define DEFAULT_ASH YES // Scan for I/O settings if necessary -#define AIL_ALLOW_VDM_EXECUTION 19 -#define DEFAULT_AVE YES // Allow Windows "DOS box" execution +#define AIL_ALLOW_VDM_EXECUTION 19 +#define DEFAULT_AVE YES // Allow Windows "DOS box" execution #endif @@ -848,67 +848,67 @@ typedef LPVOID AILLPDIRECTSOUNDBUFFER; // BEFORE calling DLSMSSOpen()! // ---------------------------------- -#define DLS_TIMEBASE 20 -#define DEFAULT_DTB 120 // 120 intervals/second by default +#define DLS_TIMEBASE 20 +#define DEFAULT_DTB 120 // 120 intervals/second by default -#define DLS_VOICE_LIMIT 21 -#define DEFAULT_DVL 24 // 24 voices supported +#define DLS_VOICE_LIMIT 21 +#define DEFAULT_DVL 24 // 24 voices supported -#define DLS_BANK_SELECT_ALIAS 22 -#define DEFAULT_DBSA NO // Do not treat controller 114 as bank +#define DLS_BANK_SELECT_ALIAS 22 +#define DEFAULT_DBSA NO // Do not treat controller 114 as bank -#define DLS_STREAM_BOOTSTRAP 23 // Don't submit first stream buffer -#define DEFAULT_DSB YES // until at least 2 available +#define DLS_STREAM_BOOTSTRAP 23 // Don't submit first stream buffer +#define DEFAULT_DSB YES // until at least 2 available -#define DLS_VOLUME_BOOST 24 -#define DEFAULT_DVB 0 // Boost final volume by 0 dB +#define DLS_VOLUME_BOOST 24 +#define DEFAULT_DVB 0 // Boost final volume by 0 dB -#define DLS_ENABLE_FILTERING 25 // Filtering = on by default -#define DEFAULT_DEF YES // (may be changed at any time) +#define DLS_ENABLE_FILTERING 25 // Filtering = on by default +#define DEFAULT_DEF YES // (may be changed at any time) #ifdef IS_X86 -#define AIL_ENABLE_MMX_SUPPORT 27 // Enable MMX support if present -#define DEFAULT_AEMS YES // (may be changed at any time) +#define AIL_ENABLE_MMX_SUPPORT 27 // Enable MMX support if present +#define DEFAULT_AEMS YES // (may be changed at any time) #endif -#define DLS_GM_PASSTHROUGH 28 // Pass unrecognized traffic on to -#define DEFAULT_DGP YES // default GM driver layer - // (may be changed at any time) +#define DLS_GM_PASSTHROUGH 28 // Pass unrecognized traffic on to +#define DEFAULT_DGP YES // default GM driver layer + // (may be changed at any time) -#define DLS_ADPCM_TO_ASI_THRESHOLD 39 // Size in samples to switch to ASI -#define DEFAULT_DATAT 32768 +#define DLS_ADPCM_TO_ASI_THRESHOLD 39 // Size in samples to switch to ASI +#define DEFAULT_DATAT 32768 // // Add'l platform-independent prefs // -#define DIG_REVERB_BUFFER_SIZE 40 -#define DEFAULT_DRBS 0 // No reverb support by default +#define DIG_REVERB_BUFFER_SIZE 40 +#define DEFAULT_DRBS 0 // No reverb support by default -#define DIG_INPUT_LATENCY 41 // Use >= 250-millisecond input buffers if -#define DEFAULT_DIL 250 // explicit size request cannot be satisfied +#define DIG_INPUT_LATENCY 41 // Use >= 250-millisecond input buffers if +#define DEFAULT_DIL 250 // explicit size request cannot be satisfied #ifdef IS_WINDOWS -#define DIG_USE_WAVEIN 43 -#define DEFAULT_DUWI YES // Use waveIn for input by default +#define DIG_USE_WAVEIN 43 +#define DEFAULT_DUWI YES // Use waveIn for input by default #endif -#define N_PREFS 46 // # of preference types +#define N_PREFS 46 // # of preference types typedef struct _AILSOUNDINFO { - S32 format; - void const FAR* data_ptr; - U32 data_len; - U32 rate; - S32 bits; - S32 channels; - U32 samples; - U32 block_size; - void const FAR* initial_ptr; + S32 format; + void const FAR* data_ptr; + U32 data_len; + U32 rate; + S32 bits; + S32 channels; + U32 samples; + U32 block_size; + void const FAR* initial_ptr; } AILSOUNDINFO; @@ -918,48 +918,48 @@ typedef struct _AILSOUNDINFO { #ifdef BUILD_MSS - #define MSSLockedIncrement(var) _asm { lock inc [var] } - #define MSSLockedDecrement(var) _asm { lock dec [var] } + #define MSSLockedIncrement(var) _asm { lock inc [var] } + #define MSSLockedDecrement(var) _asm { lock dec [var] } - static void __MSSLockedIncrementAddr(void * addr) - { - _asm - { - mov eax,[addr] - lock inc dword ptr [eax] - } - } + static void __MSSLockedIncrementAddr(void * addr) + { + _asm + { + mov eax,[addr] + lock inc dword ptr [eax] + } + } - static void __MSSLockedDecrementAddr(void * addr) - { - _asm { - mov eax,[addr] - lock dec dword ptr [eax] - } - } + static void __MSSLockedDecrementAddr(void * addr) + { + _asm { + mov eax,[addr] + lock dec dword ptr [eax] + } + } - #define MSSLockedIncrementPtr(var) __MSSLockedIncrementAddr(&(var)) - #define MSSLockedDecrementPtr(var) __MSSLockedDecrementAddr(&(var)) + #define MSSLockedIncrementPtr(var) __MSSLockedIncrementAddr(&(var)) + #define MSSLockedDecrementPtr(var) __MSSLockedDecrementAddr(&(var)) #else - #define MSSLockedIncrement(var) (++var) - #define MSSLockedDecrement(var) (--var) + #define MSSLockedIncrement(var) (++var) + #define MSSLockedDecrement(var) (--var) - #define MSSLockedIncrementPtr(var) (++var) - #define MSSLockedDecrementPtr(var) (--var) + #define MSSLockedIncrementPtr(var) (++var) + #define MSSLockedDecrementPtr(var) (--var) #endif #else - #define MSSLockedIncrement(var) (++var) - #define MSSLockedDecrement(var) (--var) + #define MSSLockedIncrement(var) (++var) + #define MSSLockedDecrement(var) (--var) - #define MSSLockedIncrementPtr(var) (++var) - #define MSSLockedDecrementPtr(var) (--var) + #define MSSLockedIncrementPtr(var) (++var) + #define MSSLockedDecrementPtr(var) (--var) #endif -#ifndef RIB_H // RIB.H contents included if RIB.H not already included +#ifndef RIB_H // RIB.H contents included if RIB.H not already included // #include "rib.h" @@ -972,10 +972,10 @@ typedef struct _AILSOUNDINFO { typedef S32 RIBRESULT; -#define RIB_NOERR 0 // Success -- no error -#define RIB_NOT_ALL_AVAILABLE 1 // Some requested functions/attribs not available -#define RIB_NOT_FOUND 2 // Resource not found -#define RIB_OUT_OF_MEM 3 // Out of system RAM +#define RIB_NOERR 0 // Success -- no error +#define RIB_NOT_ALL_AVAILABLE 1 // Some requested functions/attribs not available +#define RIB_NOT_FOUND 2 // Resource not found +#define RIB_OUT_OF_MEM 3 // Out of system RAM // // Handle to interface provider @@ -1016,14 +1016,14 @@ typedef U32 HPROENUM; typedef enum { - RIB_NONE = 0, // No type - RIB_CUSTOM, // Used for pointers to application-specific structures - RIB_DEC, // Used for 32-bit integer values to be reported in decimal - RIB_HEX, // Used for 32-bit integer values to be reported in hex - RIB_FLOAT, // Used for 32-bit single-precision FP values - RIB_PERCENT, // Used for 32-bit single-precision FP values to be reported as percentages - RIB_BOOL, // Used for Boolean-constrained integer values to be reported as TRUE or FALSE - RIB_STRING // Used for pointers to null-terminated ASCII strings + RIB_NONE = 0, // No type + RIB_CUSTOM, // Used for pointers to application-specific structures + RIB_DEC, // Used for 32-bit integer values to be reported in decimal + RIB_HEX, // Used for 32-bit integer values to be reported in hex + RIB_FLOAT, // Used for 32-bit single-precision FP values + RIB_PERCENT, // Used for 32-bit single-precision FP values to be reported as percentages + RIB_BOOL, // Used for Boolean-constrained integer values to be reported as TRUE or FALSE + RIB_STRING // Used for pointers to null-terminated ASCII strings } RIB_DATA_SUBTYPE; @@ -1033,9 +1033,9 @@ RIB_DATA_SUBTYPE; typedef enum { - RIB_FUNCTION = 0, - RIB_ATTRIBUTE, // Attribute: read-only data type used for status/info communication - RIB_PREFERENCE // Preference: read/write data type used to control behavior + RIB_FUNCTION = 0, + RIB_ATTRIBUTE, // Attribute: read-only data type used for status/info communication + RIB_PREFERENCE // Preference: read/write data type used to control behavior } RIB_ENTRY_TYPE; @@ -1046,10 +1046,10 @@ RIB_ENTRY_TYPE; typedef struct { - RIB_ENTRY_TYPE type; // See list above - C8 FAR *entry_name; // Name of desired function or attribute - U32 token; // Function pointer or attribute token - RIB_DATA_SUBTYPE subtype; // Data (attrib or preference) subtype + RIB_ENTRY_TYPE type; // See list above + C8 FAR *entry_name; // Name of desired function or attribute + U32 token; // Function pointer or attribute token + RIB_DATA_SUBTYPE subtype; // Data (attrib or preference) subtype } RIB_INTERFACE_ENTRY; @@ -1057,8 +1057,8 @@ RIB_INTERFACE_ENTRY; // Standard RAD Interface Broker provider identification attributes // -#define PROVIDER_NAME (-100) // RIB_STRING name of decoder -#define PROVIDER_VERSION (-101) // RIB_HEX BCD version number +#define PROVIDER_NAME (-100) // RIB_STRING name of decoder +#define PROVIDER_VERSION (-101) // RIB_HEX BCD version number // // Standard function to obtain provider attributes (see PROVIDER_ defines @@ -1074,106 +1074,106 @@ typedef U32 (AILCALL FAR *PROVIDER_QUERY_ATTRIBUTE) (HATTRIB index); // attributes, and preferences // -#define FN(entry_name) { RIB_FUNCTION, #entry_name, (U32) &(entry_name), RIB_NONE } -#define REG_FN(entry_name) { RIB_FUNCTION, #entry_name, (U32) &(entry_name), RIB_NONE } +#define FN(entry_name) { RIB_FUNCTION, #entry_name, (U32) &(entry_name), RIB_NONE } +#define REG_FN(entry_name) { RIB_FUNCTION, #entry_name, (U32) &(entry_name), RIB_NONE } -#define AT(entry_name,ID) { RIB_ATTRIBUTE, (entry_name), (U32) &(ID), RIB_NONE } -#define REG_AT(entry_name,ID,subtype) { RIB_ATTRIBUTE, (entry_name), (U32) (ID), subtype } +#define AT(entry_name,ID) { RIB_ATTRIBUTE, (entry_name), (U32) &(ID), RIB_NONE } +#define REG_AT(entry_name,ID,subtype) { RIB_ATTRIBUTE, (entry_name), (U32) (ID), subtype } -#define PR(entry_name,ID) { RIB_PREFERENCE, (entry_name), (U32) &(ID), RIB_NONE } -#define REG_PR(entry_name,ID,subtype) { RIB_PREFERENCE, (entry_name), (U32) (ID), subtype } +#define PR(entry_name,ID) { RIB_PREFERENCE, (entry_name), (U32) &(ID), RIB_NONE } +#define REG_PR(entry_name,ID,subtype) { RIB_PREFERENCE, (entry_name), (U32) (ID), subtype } -#define RIB_register(x,y,z) RIB_register_interface (HPROVIDER(x), y, ARY_CNT(z), z) +#define RIB_register(x,y,z) RIB_register_interface (HPROVIDER(x), y, ARY_CNT(z), z) #define RIB_unregister(x,y,z) RIB_unregister_interface(HPROVIDER(x), y, ARY_CNT(z), z) #define RIB_unregister_all(x) RIB_unregister_interface(HPROVIDER(x), NULL, 0, NULL) -#define RIB_free_libraries() RIB_free_provider_library(HPROVIDER(NULL)); -#define RIB_request(x,y,z) RIB_request_interface (x, y, ARY_CNT(z), z) +#define RIB_free_libraries() RIB_free_provider_library(HPROVIDER(NULL)); +#define RIB_request(x,y,z) RIB_request_interface (x, y, ARY_CNT(z), z) // ---------------------------------- // Standard RIB API prototypes // ---------------------------------- -DXDEC HPROVIDER AILCALL RIB_alloc_provider_handle (U32 module); -DXDEC void AILCALL RIB_free_provider_handle (HPROVIDER provider); +DXDEC HPROVIDER AILCALL RIB_alloc_provider_handle (U32 module); +DXDEC void AILCALL RIB_free_provider_handle (HPROVIDER provider); -DXDEC HPROVIDER AILCALL RIB_load_provider_library (C8 const FAR *filename); -DXDEC void AILCALL RIB_free_provider_library (HPROVIDER provider); +DXDEC HPROVIDER AILCALL RIB_load_provider_library (C8 const FAR *filename); +DXDEC void AILCALL RIB_free_provider_library (HPROVIDER provider); -DXDEC HPROVIDER AILCALL RIB_provider_library_handle (void); +DXDEC HPROVIDER AILCALL RIB_provider_library_handle (void); -DXDEC RIBRESULT AILCALL RIB_register_interface (HPROVIDER provider, - C8 const FAR *interface_name, - S32 entry_count, - RIB_INTERFACE_ENTRY const FAR *rlist); +DXDEC RIBRESULT AILCALL RIB_register_interface (HPROVIDER provider, + C8 const FAR *interface_name, + S32 entry_count, + RIB_INTERFACE_ENTRY const FAR *rlist); -DXDEC RIBRESULT AILCALL RIB_unregister_interface (HPROVIDER provider, - C8 const FAR *interface_name, - S32 entry_count, - RIB_INTERFACE_ENTRY const FAR *rlist); +DXDEC RIBRESULT AILCALL RIB_unregister_interface (HPROVIDER provider, + C8 const FAR *interface_name, + S32 entry_count, + RIB_INTERFACE_ENTRY const FAR *rlist); -DXDEC RIBRESULT AILCALL RIB_request_interface (HPROVIDER provider, - C8 const FAR *interface_name, - S32 entry_count, - RIB_INTERFACE_ENTRY FAR *rlist); +DXDEC RIBRESULT AILCALL RIB_request_interface (HPROVIDER provider, + C8 const FAR *interface_name, + S32 entry_count, + RIB_INTERFACE_ENTRY FAR *rlist); -DXDEC RIBRESULT AILCALL RIB_request_interface_entry (HPROVIDER provider, - C8 const FAR *interface_name, - RIB_ENTRY_TYPE entry_type, - C8 const FAR *entry_name, - U32 FAR *token); +DXDEC RIBRESULT AILCALL RIB_request_interface_entry (HPROVIDER provider, + C8 const FAR *interface_name, + RIB_ENTRY_TYPE entry_type, + C8 const FAR *entry_name, + U32 FAR *token); -DXDEC S32 AILCALL RIB_enumerate_interface (HPROVIDER provider, - C8 FAR *interface_name, - RIB_ENTRY_TYPE type, - HINTENUM FAR *next, - RIB_INTERFACE_ENTRY FAR *dest); +DXDEC S32 AILCALL RIB_enumerate_interface (HPROVIDER provider, + C8 FAR *interface_name, + RIB_ENTRY_TYPE type, + HINTENUM FAR *next, + RIB_INTERFACE_ENTRY FAR *dest); -DXDEC S32 AILCALL RIB_enumerate_providers (C8 FAR *interface_name, - HPROENUM FAR *next, - HPROVIDER FAR *dest); +DXDEC S32 AILCALL RIB_enumerate_providers (C8 FAR *interface_name, + HPROENUM FAR *next, + HPROVIDER FAR *dest); -DXDEC C8 FAR * AILCALL RIB_type_string (U32 data, - RIB_DATA_SUBTYPE subtype); +DXDEC C8 FAR * AILCALL RIB_type_string (U32 data, + RIB_DATA_SUBTYPE subtype); -DXDEC HPROVIDER AILCALL RIB_find_file_provider (C8 const FAR *interface_name, - C8 const FAR *attribute_name, - C8 const FAR *file_suffix); +DXDEC HPROVIDER AILCALL RIB_find_file_provider (C8 const FAR *interface_name, + C8 const FAR *attribute_name, + C8 const FAR *file_suffix); -DXDEC HPROVIDER AILCALL RIB_find_provider (C8 const FAR *interface_name, - C8 const FAR *attribute_name, - C8 const FAR *attribute_value); +DXDEC HPROVIDER AILCALL RIB_find_provider (C8 const FAR *interface_name, + C8 const FAR *attribute_name, + C8 const FAR *attribute_value); -DXDEC HPROVIDER AILCALL RIB_find_files_provider (C8 const FAR *interface_name, - C8 const FAR *attribute_name_1, - C8 const FAR *file_suffix_1, - C8 const FAR *attribute_name_2, - C8 const FAR *file_suffix_2); +DXDEC HPROVIDER AILCALL RIB_find_files_provider (C8 const FAR *interface_name, + C8 const FAR *attribute_name_1, + C8 const FAR *file_suffix_1, + C8 const FAR *attribute_name_2, + C8 const FAR *file_suffix_2); -DXDEC HPROVIDER AILCALL RIB_find_file_dec_provider (C8 const FAR *interface_name, - C8 const FAR *attribute_name_1, - U32 attribute_value_1, - C8 const FAR *attribute_name_2, - C8 const FAR *file_suffix_2); +DXDEC HPROVIDER AILCALL RIB_find_file_dec_provider (C8 const FAR *interface_name, + C8 const FAR *attribute_name_1, + U32 attribute_value_1, + C8 const FAR *attribute_name_2, + C8 const FAR *file_suffix_2); -DXDEC S32 AILCALL RIB_load_application_providers - (C8 const FAR *filespec); +DXDEC S32 AILCALL RIB_load_application_providers + (C8 const FAR *filespec); -DXDEC void AILCALL RIB_set_provider_user_data (HPROVIDER provider, - U32 index, - S32 value); +DXDEC void AILCALL RIB_set_provider_user_data (HPROVIDER provider, + U32 index, + S32 value); -DXDEC S32 AILCALL RIB_provider_user_data (HPROVIDER provider, - U32 index); +DXDEC S32 AILCALL RIB_provider_user_data (HPROVIDER provider, + U32 index); -DXDEC void AILCALL RIB_set_provider_system_data - (HPROVIDER provider, - U32 index, - S32 value); +DXDEC void AILCALL RIB_set_provider_system_data + (HPROVIDER provider, + U32 index, + S32 value); -DXDEC S32 AILCALL RIB_provider_system_data (HPROVIDER provider, - U32 index); +DXDEC S32 AILCALL RIB_provider_system_data (HPROVIDER provider, + U32 index); -DXDEC C8 FAR * AILCALL RIB_error (void); +DXDEC C8 FAR * AILCALL RIB_error (void); #endif @@ -1181,7 +1181,7 @@ DXDEC C8 FAR * AILCALL RIB_error (void); // #include "mssasi.h" -#define AIL_ASI_VERSION 1 +#define AIL_ASI_VERSION 1 #define AIL_ASI_REVISION 0 // @@ -1196,16 +1196,16 @@ typedef S32 HASISTREAM; typedef S32 ASIRESULT; -#define ASI_NOERR 0 // Success -- no error -#define ASI_NOT_ENABLED 1 // ASI not enabled -#define ASI_ALREADY_STARTED 2 // ASI already started -#define ASI_INVALID_PARAM 3 // Invalid parameters used -#define ASI_INTERNAL_ERR 4 // Internal error in ASI driver -#define ASI_OUT_OF_MEM 5 // Out of system RAM -#define ASI_ERR_NOT_IMPLEMENTED 6 // Feature not implemented -#define ASI_NOT_FOUND 7 // ASI supported device not found -#define ASI_NOT_INIT 8 // ASI not initialized -#define ASI_CLOSE_ERR 9 // ASI not closed correctly +#define ASI_NOERR 0 // Success -- no error +#define ASI_NOT_ENABLED 1 // ASI not enabled +#define ASI_ALREADY_STARTED 2 // ASI already started +#define ASI_INVALID_PARAM 3 // Invalid parameters used +#define ASI_INTERNAL_ERR 4 // Internal error in ASI driver +#define ASI_OUT_OF_MEM 5 // Out of system RAM +#define ASI_ERR_NOT_IMPLEMENTED 6 // Feature not implemented +#define ASI_NOT_FOUND 7 // ASI supported device not found +#define ASI_NOT_INIT 8 // ASI not initialized +#define ASI_CLOSE_ERR 9 // ASI not closed correctly // ---------------------------------- // Application-provided ASI callbacks @@ -1216,7 +1216,7 @@ typedef S32 ASIRESULT; // // offset normally will be either 0 at the first call made by the codec // or -1 to specify a continuous stream, except when ASI_stream_seek() -// is called to restart the stream codec at a new stream offset. In this +// is called to restart the stream codec at a new stream offset. In this // case, the application must execute the seek operation on the ASI codec's // behalf. // @@ -1226,15 +1226,15 @@ typedef S32 ASIRESULT; // the stream is reached). // -typedef S32 (AILCALLBACK FAR * AILASIFETCHCB) (U32 user, // User value passed to ASI_open_stream() - void FAR *dest, // Location to which stream data should be copied by app - S32 bytes_requested, // # of bytes requested by ASI codec - S32 offset); // If not -1, application should seek to this point in stream +typedef S32 (AILCALLBACK FAR * AILASIFETCHCB) (U32 user, // User value passed to ASI_open_stream() + void FAR *dest, // Location to which stream data should be copied by app + S32 bytes_requested, // # of bytes requested by ASI codec + S32 offset); // If not -1, application should seek to this point in stream //############################################################################ -//## ## -//## Interface "ASI codec" ## -//## ## +//## ## +//## Interface "ASI codec" ## +//## ## //############################################################################ // @@ -1242,7 +1242,7 @@ typedef S32 (AILCALLBACK FAR * AILASIFETCHCB) (U32 user, // Use // // No other ASI functions may be called outside an ASI_startup() / // ASI_shutdown() pair, except for the standard RIB function -// PROVIDER_query_attribute(). All provider attributes must be accessible +// PROVIDER_query_attribute(). All provider attributes must be accessible // without starting up the codec. // @@ -1261,33 +1261,33 @@ typedef ASIRESULT (AILCALL FAR * ASI_SHUTDOWN)(void); // The ASI error text state is global to all streams // -typedef C8 FAR * (AILCALL FAR * ASI_ERROR)(void); +typedef C8 FAR * (AILCALL FAR * ASI_ERROR)(void); //############################################################################ -//## ## -//## Interface "ASI stream" ## -//## ## +//## ## +//## Interface "ASI stream" ## +//## ## //############################################################################ // // Open a stream, returning handle to stream // -typedef HASISTREAM (AILCALL FAR *ASI_STREAM_OPEN) (U32 user, // User value passed to fetch callback - AILASIFETCHCB fetch_CB, // Source data fetch handler - U32 total_size); // Total size for %-done calculations (0=unknown) +typedef HASISTREAM (AILCALL FAR *ASI_STREAM_OPEN) (U32 user, // User value passed to fetch callback + AILASIFETCHCB fetch_CB, // Source data fetch handler + U32 total_size); // Total size for %-done calculations (0=unknown) // // Translate data in stream, returning # of bytes actually decoded or encoded // -// Any number of bytes may be requested. Requesting more data than is +// Any number of bytes may be requested. Requesting more data than is // available in the codec's internal buffer will cause the AILASIFETCHCB // handler to be called to fetch more data from the stream. // -typedef S32 (AILCALL FAR *ASI_STREAM_PROCESS) (HASISTREAM stream, // Handle of stream - void FAR *buffer, // Destination for processed data - S32 buffer_size); // # of bytes to return in buffer +typedef S32 (AILCALL FAR *ASI_STREAM_PROCESS) (HASISTREAM stream, // Handle of stream + void FAR *buffer, // Destination for processed data + S32 buffer_size); // # of bytes to return in buffer // // Restart stream decoding process at new offset @@ -1304,33 +1304,33 @@ typedef S32 (AILCALL FAR *ASI_STREAM_PROCESS) (HASISTREAM stream, // // Warning: some decoders may need to implement seeking by reparsing // the entire stream up to the specified offset, through multiple calls -// to the data-fetch callback. This operation may be extremely +// to the data-fetch callback. This operation may be extremely // time-consuming on large files or slow network connections. // // A stream_offset value of -1 may be used to inform the decoder that the // application has changed the input stream offset on its own, e.g. for a // double-buffering application where the ASI decoder is not accessing the -// stream directly. ASI decoders should respond to this by flushing all +// stream directly. ASI decoders should respond to this by flushing all // internal buffers and resynchronizing themselves to the data stream. // -typedef ASIRESULT (AILCALL FAR *ASI_STREAM_SEEK) (HASISTREAM stream, - S32 stream_offset); +typedef ASIRESULT (AILCALL FAR *ASI_STREAM_SEEK) (HASISTREAM stream, + S32 stream_offset); // // Retrieve an ASI stream attribute or preference value by index // typedef S32 (AILCALL FAR *ASI_STREAM_ATTRIBUTE) (HASISTREAM stream, - HATTRIB attrib); + HATTRIB attrib); // // Set an ASI stream preference value by index // typedef S32 (AILCALL FAR *ASI_STREAM_SET_PREFERENCE) (HASISTREAM stream, - HATTRIB preference, - void const FAR * value); + HATTRIB preference, + void const FAR * value); // // Close stream, freeing handle and all internally-allocated resources @@ -1341,9 +1341,9 @@ typedef ASIRESULT (AILCALL FAR *ASI_STREAM_CLOSE) (HASISTREAM stream); #endif //############################################################################ -//## ## -//## Interface "MSS 3D audio services" ## -//## ## +//## ## +//## Interface "MSS 3D audio services" ## +//## ## //############################################################################ // @@ -1353,7 +1353,7 @@ typedef ASIRESULT (AILCALL FAR *ASI_STREAM_CLOSE) (HASISTREAM stream); typedef struct h3DPOBJECT { - U32 junk; + U32 junk; } h3DPOBJECT; typedef h3DPOBJECT FAR * H3DPOBJECT; @@ -1365,183 +1365,183 @@ typedef H3DPOBJECT H3DSAMPLE; typedef S32 M3DRESULT; -#define M3D_NOERR 0 // Success -- no error -#define M3D_NOT_ENABLED 1 // M3D not enabled -#define M3D_ALREADY_STARTED 2 // M3D already started -#define M3D_INVALID_PARAM 3 // Invalid parameters used -#define M3D_INTERNAL_ERR 4 // Internal error in M3D driver -#define M3D_OUT_OF_MEM 5 // Out of system RAM -#define M3D_ERR_NOT_IMPLEMENTED 6 // Feature not implemented -#define M3D_NOT_FOUND 7 // M3D supported device not found -#define M3D_NOT_INIT 8 // M3D not initialized -#define M3D_CLOSE_ERR 9 // M3D not closed correctly +#define M3D_NOERR 0 // Success -- no error +#define M3D_NOT_ENABLED 1 // M3D not enabled +#define M3D_ALREADY_STARTED 2 // M3D already started +#define M3D_INVALID_PARAM 3 // Invalid parameters used +#define M3D_INTERNAL_ERR 4 // Internal error in M3D driver +#define M3D_OUT_OF_MEM 5 // Out of system RAM +#define M3D_ERR_NOT_IMPLEMENTED 6 // Feature not implemented +#define M3D_NOT_FOUND 7 // M3D supported device not found +#define M3D_NOT_INIT 8 // M3D not initialized +#define M3D_CLOSE_ERR 9 // M3D not closed correctly -typedef void (AILCALLBACK FAR* AIL3DSAMPLECB) (H3DSAMPLE sample); +typedef void (AILCALLBACK FAR* AIL3DSAMPLECB) (H3DSAMPLE sample); typedef M3DRESULT (AILCALL FAR *M3D_STARTUP)(void); typedef M3DRESULT (AILCALL FAR *M3D_SHUTDOWN)(void); -typedef C8 FAR * (AILCALL FAR *M3D_ERROR)(void); +typedef C8 FAR * (AILCALL FAR *M3D_ERROR)(void); -typedef S32 (AILCALL FAR *M3D_SET_PROVIDER_PREFERENCE)(HATTRIB preference, - void const FAR * value); +typedef S32 (AILCALL FAR *M3D_SET_PROVIDER_PREFERENCE)(HATTRIB preference, + void const FAR * value); -typedef M3DRESULT (AILCALL FAR * M3D_ACTIVATE)(S32 enable); +typedef M3DRESULT (AILCALL FAR * M3D_ACTIVATE)(S32 enable); -typedef H3DSAMPLE (AILCALL FAR * M3D_ALLOCATE_3D_SAMPLE_HANDLE)(void); +typedef H3DSAMPLE (AILCALL FAR * M3D_ALLOCATE_3D_SAMPLE_HANDLE)(void); -typedef void (AILCALL FAR * M3D_RELEASE_3D_SAMPLE_HANDLE)(H3DSAMPLE samp); - +typedef void (AILCALL FAR * M3D_RELEASE_3D_SAMPLE_HANDLE)(H3DSAMPLE samp); + -typedef void (AILCALL FAR * M3D_START_3D_SAMPLE)(H3DSAMPLE samp); +typedef void (AILCALL FAR * M3D_START_3D_SAMPLE)(H3DSAMPLE samp); -typedef void (AILCALL FAR * M3D_STOP_3D_SAMPLE)(H3DSAMPLE samp); - +typedef void (AILCALL FAR * M3D_STOP_3D_SAMPLE)(H3DSAMPLE samp); + -typedef void (AILCALL FAR * M3D_RESUME_3D_SAMPLE)(H3DSAMPLE samp); - -typedef void (AILCALL FAR * M3D_END_3D_SAMPLE)(H3DSAMPLE samp); +typedef void (AILCALL FAR * M3D_RESUME_3D_SAMPLE)(H3DSAMPLE samp); + +typedef void (AILCALL FAR * M3D_END_3D_SAMPLE)(H3DSAMPLE samp); -typedef S32 (AILCALL FAR * M3D_SET_3D_SAMPLE_DATA)(H3DSAMPLE samp, - AILSOUNDINFO const FAR *info); +typedef S32 (AILCALL FAR * M3D_SET_3D_SAMPLE_DATA)(H3DSAMPLE samp, + AILSOUNDINFO const FAR *info); -typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_VOLUME)(H3DSAMPLE samp, - S32 volume); +typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_VOLUME)(H3DSAMPLE samp, + S32 volume); -typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_PLAYBACK_RATE)(H3DSAMPLE samp, - S32 playback_rate); +typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_PLAYBACK_RATE)(H3DSAMPLE samp, + S32 playback_rate); -typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_OFFSET)(H3DSAMPLE samp, - U32 offset); +typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_OFFSET)(H3DSAMPLE samp, + U32 offset); -typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_LOOP_COUNT)(H3DSAMPLE samp, - U32 loops); +typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_LOOP_COUNT)(H3DSAMPLE samp, + U32 loops); -typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_LOOP_BLOCK)(H3DSAMPLE S, - S32 loop_start_offset, - S32 loop_end_offset); +typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_LOOP_BLOCK)(H3DSAMPLE S, + S32 loop_start_offset, + S32 loop_end_offset); -typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_STATUS)(H3DSAMPLE samp); +typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_STATUS)(H3DSAMPLE samp); -typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_ATTRIBUTE)(H3DSAMPLE samp, HATTRIB index); +typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_ATTRIBUTE)(H3DSAMPLE samp, HATTRIB index); -typedef S32 (AILCALL FAR * M3D_3D_SET_SAMPLE_PREFERENCE)(H3DSAMPLE samp, HATTRIB preference, void const FAR * value); +typedef S32 (AILCALL FAR * M3D_3D_SET_SAMPLE_PREFERENCE)(H3DSAMPLE samp, HATTRIB preference, void const FAR * value); -typedef S32 (AILCALL FAR * M3D_3D_SAMPLE_VOLUME)(H3DSAMPLE samp); +typedef S32 (AILCALL FAR * M3D_3D_SAMPLE_VOLUME)(H3DSAMPLE samp); -typedef S32 (AILCALL FAR * M3D_3D_SAMPLE_PLAYBACK_RATE)(H3DSAMPLE samp); +typedef S32 (AILCALL FAR * M3D_3D_SAMPLE_PLAYBACK_RATE)(H3DSAMPLE samp); -typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_OFFSET)(H3DSAMPLE samp); +typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_OFFSET)(H3DSAMPLE samp); -typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_LENGTH)(H3DSAMPLE samp); +typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_LENGTH)(H3DSAMPLE samp); -typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_LOOP_COUNT)(H3DSAMPLE samp); +typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_LOOP_COUNT)(H3DSAMPLE samp); -typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_DISTANCES)(H3DSAMPLE samp, - F32 max_dist, - F32 min_dist); +typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_DISTANCES)(H3DSAMPLE samp, + F32 max_dist, + F32 min_dist); -typedef void (AILCALL FAR * M3D_3D_SAMPLE_DISTANCES)(H3DSAMPLE samp, - F32 FAR * max_dist, - F32 FAR * min_dist); +typedef void (AILCALL FAR * M3D_3D_SAMPLE_DISTANCES)(H3DSAMPLE samp, + F32 FAR * max_dist, + F32 FAR * min_dist); -typedef S32 (AILCALL FAR * M3D_ACTIVE_3D_SAMPLE_COUNT)(void); +typedef S32 (AILCALL FAR * M3D_ACTIVE_3D_SAMPLE_COUNT)(void); typedef H3DPOBJECT (AILCALL FAR * M3D_3D_OPEN_LISTENER)(void); -typedef void (AILCALL FAR * M3D_3D_CLOSE_LISTENER)(H3DPOBJECT listener); +typedef void (AILCALL FAR * M3D_3D_CLOSE_LISTENER)(H3DPOBJECT listener); typedef H3DPOBJECT (AILCALL FAR * M3D_3D_OPEN_OBJECT)(void); -typedef void (AILCALL FAR * M3D_3D_CLOSE_OBJECT)(H3DPOBJECT obj); +typedef void (AILCALL FAR * M3D_3D_CLOSE_OBJECT)(H3DPOBJECT obj); -typedef void (AILCALL FAR * M3D_SET_3D_POSITION)(H3DPOBJECT obj, - F32 X, - F32 Y, - F32 Z); +typedef void (AILCALL FAR * M3D_SET_3D_POSITION)(H3DPOBJECT obj, + F32 X, + F32 Y, + F32 Z); -typedef void (AILCALL FAR * M3D_SET_3D_VELOCITY)(H3DPOBJECT obj, - F32 dX_per_ms, - F32 dY_per_ms, - F32 dZ_per_ms, - F32 magnitude); +typedef void (AILCALL FAR * M3D_SET_3D_VELOCITY)(H3DPOBJECT obj, + F32 dX_per_ms, + F32 dY_per_ms, + F32 dZ_per_ms, + F32 magnitude); -typedef void (AILCALL FAR * M3D_SET_3D_VELOCITY_VECTOR)(H3DPOBJECT obj, - F32 dX_per_ms, - F32 dY_per_ms, - F32 dZ_per_ms); +typedef void (AILCALL FAR * M3D_SET_3D_VELOCITY_VECTOR)(H3DPOBJECT obj, + F32 dX_per_ms, + F32 dY_per_ms, + F32 dZ_per_ms); -typedef void (AILCALL FAR * M3D_SET_3D_ORIENTATION)(H3DPOBJECT obj, - F32 X_face, - F32 Y_face, - F32 Z_face, - F32 X_up, - F32 Y_up, - F32 Z_up); +typedef void (AILCALL FAR * M3D_SET_3D_ORIENTATION)(H3DPOBJECT obj, + F32 X_face, + F32 Y_face, + F32 Z_face, + F32 X_up, + F32 Y_up, + F32 Z_up); -typedef void (AILCALL FAR * M3D_3D_POSITION)(H3DPOBJECT obj, - F32 FAR *X, - F32 FAR *Y, - F32 FAR *Z); +typedef void (AILCALL FAR * M3D_3D_POSITION)(H3DPOBJECT obj, + F32 FAR *X, + F32 FAR *Y, + F32 FAR *Z); -typedef void (AILCALL FAR * M3D_3D_VELOCITY)(H3DPOBJECT obj, - F32 FAR *dX_per_ms, - F32 FAR *dY_per_ms, - F32 FAR *dZ_per_ms); +typedef void (AILCALL FAR * M3D_3D_VELOCITY)(H3DPOBJECT obj, + F32 FAR *dX_per_ms, + F32 FAR *dY_per_ms, + F32 FAR *dZ_per_ms); -typedef void (AILCALL FAR * M3D_3D_ORIENTATION)(H3DPOBJECT obj, - F32 FAR *X_face, - F32 FAR *Y_face, - F32 FAR *Z_face, - F32 FAR *X_up, - F32 FAR *Y_up, - F32 FAR *Z_up); +typedef void (AILCALL FAR * M3D_3D_ORIENTATION)(H3DPOBJECT obj, + F32 FAR *X_face, + F32 FAR *Y_face, + F32 FAR *Z_face, + F32 FAR *X_up, + F32 FAR *Y_up, + F32 FAR *Z_up); -typedef void (AILCALL FAR * M3D_3D_UPDATE_POSITION)(H3DPOBJECT obj, - F32 dt_milliseconds); +typedef void (AILCALL FAR * M3D_3D_UPDATE_POSITION)(H3DPOBJECT obj, + F32 dt_milliseconds); -typedef void (AILCALL FAR * M3D_3D_AUTO_UPDATE_POSITION)(H3DPOBJECT obj, - S32 enable); +typedef void (AILCALL FAR * M3D_3D_AUTO_UPDATE_POSITION)(H3DPOBJECT obj, + S32 enable); -typedef S32 (AILCALL FAR * M3D_3D_ROOM_TYPE)(void); -typedef void (AILCALL FAR * M3D_SET_3D_ROOM_TYPE)(S32 EAX_room_type); -typedef S32 (AILCALL FAR * M3D_3D_SPEAKER_TYPE)(void); -typedef void (AILCALL FAR * M3D_SET_3D_SPEAKER_TYPE)(S32 speaker_type); -typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_OBSTRUCTION)(H3DSAMPLE samp, F32 obstruction); -typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_OCCLUSION)(H3DSAMPLE samp, F32 occlusion); -typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_EFFECTS_LEVEL)(H3DSAMPLE samp, F32 effects_level); -typedef F32 (AILCALL FAR * M3D_3D_SAMPLE_OBSTRUCTION)(H3DSAMPLE samp); -typedef F32 (AILCALL FAR * M3D_3D_SAMPLE_OCCLUSION)(H3DSAMPLE samp); -typedef F32 (AILCALL FAR * M3D_3D_SAMPLE_EFFECTS_LEVEL)(H3DSAMPLE samp); +typedef S32 (AILCALL FAR * M3D_3D_ROOM_TYPE)(void); +typedef void (AILCALL FAR * M3D_SET_3D_ROOM_TYPE)(S32 EAX_room_type); +typedef S32 (AILCALL FAR * M3D_3D_SPEAKER_TYPE)(void); +typedef void (AILCALL FAR * M3D_SET_3D_SPEAKER_TYPE)(S32 speaker_type); +typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_OBSTRUCTION)(H3DSAMPLE samp, F32 obstruction); +typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_OCCLUSION)(H3DSAMPLE samp, F32 occlusion); +typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_EFFECTS_LEVEL)(H3DSAMPLE samp, F32 effects_level); +typedef F32 (AILCALL FAR * M3D_3D_SAMPLE_OBSTRUCTION)(H3DSAMPLE samp); +typedef F32 (AILCALL FAR * M3D_3D_SAMPLE_OCCLUSION)(H3DSAMPLE samp); +typedef F32 (AILCALL FAR * M3D_3D_SAMPLE_EFFECTS_LEVEL)(H3DSAMPLE samp); typedef AIL3DSAMPLECB (AILCALL FAR * M3D_SET_3D_EOS)(H3DSAMPLE client,H3DSAMPLE samp,AIL3DSAMPLECB cb); -typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_CONE)(H3DSAMPLE samp, F32 inner_angle, F32 outer_angle, S32 outer_volume); -typedef void (AILCALL FAR * M3D_3D_SAMPLE_CONE)(H3DSAMPLE samp, F32 FAR* inner_angle, F32 FAR* outer_angle, S32 FAR* outer_volume); +typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_CONE)(H3DSAMPLE samp, F32 inner_angle, F32 outer_angle, S32 outer_volume); +typedef void (AILCALL FAR * M3D_3D_SAMPLE_CONE)(H3DSAMPLE samp, F32 FAR* inner_angle, F32 FAR* outer_angle, S32 FAR* outer_volume); //############################################################################ -//## ## -//## Interface "MSS mixer services" ## -//## ## +//## ## +//## Interface "MSS mixer services" ## +//## ## //############################################################################ // // Operation flags used by mixer module // -#define M_DEST_STEREO 1 // Set to enable stereo mixer output -#define M_SRC_16 2 // Set to enable mixing of 16-bit samples -#define M_FILTER 4 // Set to enable filtering when resampling -#define M_SRC_STEREO 8 // Set to enable mixing of stereo input samples -#define M_VOL_SCALING 16 // Set to enable volume scalars other than 2047 -#define M_RESAMPLE 32 // Set to enable playback ratios other than 65536 -#define M_ORDER 64 // Set to reverse L/R stereo order for sample +#define M_DEST_STEREO 1 // Set to enable stereo mixer output +#define M_SRC_16 2 // Set to enable mixing of 16-bit samples +#define M_FILTER 4 // Set to enable filtering when resampling +#define M_SRC_STEREO 8 // Set to enable mixing of stereo input samples +#define M_VOL_SCALING 16 // Set to enable volume scalars other than 2047 +#define M_RESAMPLE 32 // Set to enable playback ratios other than 65536 +#define M_ORDER 64 // Set to reverse L/R stereo order for sample #ifdef IS_32 @@ -1550,7 +1550,7 @@ typedef void (AILCALL FAR * M3D_3D_SAMPLE_CONE)(H3DSAMPLE samp, F32 FAR* i // // No other mixer functions may be called outside a MIXER_startup() / // MIXER_shutdown() pair, except for the standard RIB function -// PROVIDER_query_attribute(). All provider attributes must be accessible +// PROVIDER_query_attribute(). All provider attributes must be accessible // without starting up the module. // @@ -1566,34 +1566,34 @@ typedef void (AILCALL FAR *MIXER_SHUTDOWN)(void); // Flush mixer buffer // -typedef void (AILCALL FAR *MIXER_FLUSH) (S32 FAR *dest, - S32 len, - S32 FAR *reverb_buffer, - S32 reverb_level +typedef void (AILCALL FAR *MIXER_FLUSH) (S32 FAR *dest, + S32 len, + S32 FAR *reverb_buffer, + S32 reverb_level #ifdef IS_X86 - ,U32 MMX_available + ,U32 MMX_available #endif - ); + ); // // Perform audio mixing operation // -typedef void (AILCALL FAR *MIXER_MERGE) (void const FAR * FAR *src, - U32 FAR *src_fract, - void const FAR *src_end, - S32 FAR * FAR *dest, - void FAR *dest_end, - S32 FAR *left_val, - S32 FAR *right_val, - S32 playback_ratio, - S32 scale_left, - S32 scale_right, - U32 operation +typedef void (AILCALL FAR *MIXER_MERGE) (void const FAR * FAR *src, + U32 FAR *src_fract, + void const FAR *src_end, + S32 FAR * FAR *dest, + void FAR *dest_end, + S32 FAR *left_val, + S32 FAR *right_val, + S32 playback_ratio, + S32 scale_left, + S32 scale_right, + U32 operation #ifdef IS_X86 - ,U32 MMX_available + ,U32 MMX_available #endif - ); + ); // // Translate mixer buffer contents to final output format @@ -1601,18 +1601,18 @@ typedef void (AILCALL FAR *MIXER_MERGE) (void const FAR * FAR *src, #ifdef IS_MAC -typedef void (AILCALL FAR *MIXER_COPY) (void const FAR *src, - S32 src_len, - void FAR *dest, - U32 operation, - U32 big_endian_output); +typedef void (AILCALL FAR *MIXER_COPY) (void const FAR *src, + S32 src_len, + void FAR *dest, + U32 operation, + U32 big_endian_output); #else -typedef void (AILCALL FAR *MIXER_COPY) (void const FAR *src, - S32 src_len, - void FAR *dest, - U32 operation, - U32 MMX_available); +typedef void (AILCALL FAR *MIXER_COPY) (void const FAR *src, + S32 src_len, + void FAR *dest, + U32 operation, + U32 MMX_available); #endif #else @@ -1621,7 +1621,7 @@ typedef void (AILCALL FAR *MIXER_COPY) (void const FAR *src, // // No other mixer functions may be called outside a MIXER_startup() / // MIXER_shutdown() pair, except for the standard RIB function -// PROVIDER_query_attribute(). All provider attributes must be accessible +// PROVIDER_query_attribute(). All provider attributes must be accessible // without starting up the module. // @@ -1637,38 +1637,38 @@ typedef void (AILCALL FAR *MIXER_SHUTDOWN)(void); // Flush mixer buffer // -typedef void (AILCALL FAR *MIXER_FLUSH) (S32 FAR *dest, - S32 len, - S32 FAR *reverb_buffer, - S32 reverb_level, - U32 MMX_available); +typedef void (AILCALL FAR *MIXER_FLUSH) (S32 FAR *dest, + S32 len, + S32 FAR *reverb_buffer, + S32 reverb_level, + U32 MMX_available); // // Perform audio mixing operation // -typedef void (AILCALL FAR *MIXER_MERGE) (U32 src_sel, - U32 dest_sel, - U32 FAR *src_fract, - U32 FAR *src_offset, - U32 FAR *dest_offset, - U32 src_end_offset, - U32 dest_end_offset, - S32 FAR *left_val, - S32 FAR *right_val, - S32 playback_ratio, - S32 scale_both, - U32 operation); +typedef void (AILCALL FAR *MIXER_MERGE) (U32 src_sel, + U32 dest_sel, + U32 FAR *src_fract, + U32 FAR *src_offset, + U32 FAR *dest_offset, + U32 src_end_offset, + U32 dest_end_offset, + S32 FAR *left_val, + S32 FAR *right_val, + S32 playback_ratio, + S32 scale_both, + U32 operation); // // Translate mixer buffer contents to final output format // typedef void (AILCALL FAR *MIXER_COPY) (void const FAR *src, - S32 src_len, - void FAR *dest, - U32 operation, - U32 MMX_available); + S32 src_len, + void FAR *dest, + U32 operation, + U32 MMX_available); #endif // @@ -1679,15 +1679,15 @@ struct _DIG_DRIVER; struct _MDI_DRIVER; -typedef struct _DIG_DRIVER FAR * HDIGDRIVER; // Handle to digital driver +typedef struct _DIG_DRIVER FAR * HDIGDRIVER; // Handle to digital driver -typedef struct _MDI_DRIVER FAR * HMDIDRIVER; // Handle to XMIDI driver +typedef struct _MDI_DRIVER FAR * HMDIDRIVER; // Handle to XMIDI driver -typedef struct _SAMPLE FAR * HSAMPLE; // Handle to sample +typedef struct _SAMPLE FAR * HSAMPLE; // Handle to sample -typedef struct _SEQUENCE FAR * HSEQUENCE; // Handle to sequence +typedef struct _SEQUENCE FAR * HSEQUENCE; // Handle to sequence -typedef S32 HTIMER; // Handle to timer +typedef S32 HTIMER; // Handle to timer #ifdef IS_DOS @@ -1696,134 +1696,134 @@ typedef S32 HTIMER; // Handle to timer // Type definitions // -typedef struct // I/O parameters structure +typedef struct // I/O parameters structure { - S16 IO; - S16 IRQ; - S16 DMA_8_bit; - S16 DMA_16_bit; - S32 IO_reserved[4]; + S16 IO; + S16 IRQ; + S16 DMA_8_bit; + S16 DMA_16_bit; + S32 IO_reserved[4]; } IO_PARMS; -typedef struct // Standard MSS 3.X VDI driver header +typedef struct // Standard MSS 3.X VDI driver header { - S8 ID[8]; // "AIL3xxx" ID string, followed by ^Z + S8 ID[8]; // "AIL3xxx" ID string, followed by ^Z - U32 driver_version; + U32 driver_version; - REALFAR common_IO_configurations; - U16 num_IO_configurations; + REALFAR common_IO_configurations; + U16 num_IO_configurations; - REALFAR environment_string; + REALFAR environment_string; - IO_PARMS IO; + IO_PARMS IO; - S16 service_rate; + S16 service_rate; - U16 busy; + U16 busy; - U16 driver_num; // Driver number + U16 driver_num; // Driver number - U16 this_ISR; // Offset of INT 66H dispatcher - REALFAR prev_ISR; // Pointer to previous INT 66H ISR + U16 this_ISR; // Offset of INT 66H dispatcher + REALFAR prev_ISR; // Pointer to previous INT 66H ISR - S8 scratch[128]; // Shared scratch workspace + S8 scratch[128]; // Shared scratch workspace - S8 dev_name[80]; // Device name (VDI version >= 1.12 only) + S8 dev_name[80]; // Device name (VDI version >= 1.12 only) } VDI_HDR; typedef struct { - U16 minimum_physical_sample_rate; - U16 nominal_physical_sample_rate; - U16 maximum_physical_sample_rate; + U16 minimum_physical_sample_rate; + U16 nominal_physical_sample_rate; + U16 maximum_physical_sample_rate; - U16 minimum_DMA_half_buffer_size; - U16 maximum_DMA_half_buffer_size; + U16 minimum_DMA_half_buffer_size; + U16 maximum_DMA_half_buffer_size; - U32 flags; + U32 flags; } DIG_MODE; typedef struct { - U8 format_supported[16]; - DIG_MODE format_data[16]; + U8 format_supported[16]; + DIG_MODE format_data[16]; } DIG_DDT; typedef struct { - REALFAR DMA_buffer_A; - REALFAR DMA_buffer_B; - S16 active_buffer; + REALFAR DMA_buffer_A; + REALFAR DMA_buffer_B; + S16 active_buffer; } DIG_DST; typedef struct { - REALFAR library_environment; - REALFAR GTL_suffix; + REALFAR library_environment; + REALFAR GTL_suffix; - U16 num_voices; + U16 num_voices; - U16 max_melodic_channel; - U16 min_melodic_channel; - U16 percussion_channel; + U16 max_melodic_channel; + U16 min_melodic_channel; + U16 percussion_channel; } MDI_DDT; typedef struct { - S8 library_directory[128]; - S8 GTL_filename[128]; + S8 library_directory[128]; + S8 GTL_filename[128]; - S8 MIDI_data[512]; + S8 MIDI_data[512]; } MDI_DST; -typedef struct // Initialization file structure +typedef struct // Initialization file structure { - char device_name[128]; // Device name - char driver_name[128]; // Driver filename - IO_PARMS IO; // I/O parameters for driver + char device_name[128]; // Device name + char driver_name[128]; // Driver filename + IO_PARMS IO; // I/O parameters for driver } AIL_INI; -typedef struct // Handle to driver +typedef struct // Handle to driver { - REALFAR seg; // Seg:off pointer to driver (off=0) - U32 sel; // Selector for driver (off=0) - void *buf; // Protected-mode pointer to driver - U32 size; // Size of driver image - VDI_HDR *VHDR; // Pointer to driver header (same as buf) - S32 type; // AIL3DIG or AIL3MDI (see below) + REALFAR seg; // Seg:off pointer to driver (off=0) + U32 sel; // Selector for driver (off=0) + void *buf; // Protected-mode pointer to driver + U32 size; // Size of driver image + VDI_HDR *VHDR; // Pointer to driver header (same as buf) + S32 type; // AIL3DIG or AIL3MDI (see below) - S32 initialized; // 1 if hardware successfully init'd, else 0 + S32 initialized; // 1 if hardware successfully init'd, else 0 - S32 PM_ISR; // -1 if no PM ISR hooked, else IRQ # + S32 PM_ISR; // -1 if no PM ISR hooked, else IRQ # - HTIMER server; // DRV_SERVE periodic timer, if requested + HTIMER server; // DRV_SERVE periodic timer, if requested - // Vector to high-level destructor, if any + // Vector to high-level destructor, if any - void (AILCALL *destructor)(HDIGDRIVER); + void (AILCALL *destructor)(HDIGDRIVER); - // High-level descriptor (DIG_ or MDI_DRIVER) - void *descriptor; + // High-level descriptor (DIG_ or MDI_DRIVER) + void *descriptor; } AIL_DRIVER; -typedef struct // VDI interface register structure +typedef struct // VDI interface register structure { - S16 AX; - S16 BX; - S16 CX; - S16 DX; - S16 SI; - S16 DI; + S16 AX; + S16 BX; + S16 CX; + S16 DX; + S16 SI; + S16 DI; } VDI_CALL; @@ -1833,21 +1833,21 @@ VDI_CALL; // Function pointer types // -typedef void (AILCALLBACK FAR* AILINCB) (void const FAR *data, S32 len, U32 user_data); +typedef void (AILCALLBACK FAR* AILINCB) (void const FAR *data, S32 len, U32 user_data); -typedef void (AILCALLBACK FAR* AILTIMERCB) (U32 user); +typedef void (AILCALLBACK FAR* AILTIMERCB) (U32 user); -typedef void (AILCALLBACK FAR* AILSAMPLECB) (HSAMPLE sample); +typedef void (AILCALLBACK FAR* AILSAMPLECB) (HSAMPLE sample); -typedef S32 (AILCALLBACK FAR* AILEVENTCB) (HMDIDRIVER hmi,HSEQUENCE seq,S32 status,S32 data_1,S32 data_2); +typedef S32 (AILCALLBACK FAR* AILEVENTCB) (HMDIDRIVER hmi,HSEQUENCE seq,S32 status,S32 data_1,S32 data_2); -typedef S32 (AILCALLBACK FAR* AILTIMBRECB) (HMDIDRIVER hmi,S32 bank,S32 patch); +typedef S32 (AILCALLBACK FAR* AILTIMBRECB) (HMDIDRIVER hmi,S32 bank,S32 patch); -typedef S32 (AILCALLBACK FAR* AILPREFIXCB) (HSEQUENCE seq,S32 log,S32 data); +typedef S32 (AILCALLBACK FAR* AILPREFIXCB) (HSEQUENCE seq,S32 log,S32 data); -typedef void (AILCALLBACK FAR* AILTRIGGERCB) (HSEQUENCE seq,S32 log,S32 data); +typedef void (AILCALLBACK FAR* AILTRIGGERCB) (HSEQUENCE seq,S32 log,S32 data); -typedef void (AILCALLBACK FAR* AILBEATCB) (HMDIDRIVER hmi,HSEQUENCE seq,S32 beat,S32 measure); +typedef void (AILCALLBACK FAR* AILBEATCB) (HMDIDRIVER hmi,HSEQUENCE seq,S32 beat,S32 measure); typedef void (AILCALLBACK FAR* AILSEQUENCECB) (HSEQUENCE seq); @@ -1867,83 +1867,83 @@ typedef S32 HDRIVERSTATE; typedef enum { - DP_ASI_DECODER=0, // Must be "ASI codec stream" provider - DP_FILTER, // Must be "MSS pipeline filter" provider - DP_MERGE, // Must be "MSS mixer" provider - N_SAMPLE_STAGES, // Placeholder for end of list (= # of valid stages) - SAMPLE_ALL_STAGES // Used to signify all pipeline stages, for shutdown + DP_ASI_DECODER=0, // Must be "ASI codec stream" provider + DP_FILTER, // Must be "MSS pipeline filter" provider + DP_MERGE, // Must be "MSS mixer" provider + N_SAMPLE_STAGES, // Placeholder for end of list (= # of valid stages) + SAMPLE_ALL_STAGES // Used to signify all pipeline stages, for shutdown } SAMPLESTAGE; typedef enum { - DP_FLUSH = 0, // Must be "MSS mixer" provider - DP_DEFAULT_FILTER, // Must be "MSS pipeline filter" provider (sets the default) - DP_DEFAULT_MERGE, // Must be "MSS mixer" provider (sets the default) - DP_COPY, // Must be "MSS mixer" provider - N_DIGDRV_STAGES, // Placeholder for end of list (= # of valid stages) - DIGDRV_ALL_STAGES // Used to signify all pipeline stages, for shutdown + DP_FLUSH = 0, // Must be "MSS mixer" provider + DP_DEFAULT_FILTER, // Must be "MSS pipeline filter" provider (sets the default) + DP_DEFAULT_MERGE, // Must be "MSS mixer" provider (sets the default) + DP_COPY, // Must be "MSS mixer" provider + N_DIGDRV_STAGES, // Placeholder for end of list (= # of valid stages) + DIGDRV_ALL_STAGES // Used to signify all pipeline stages, for shutdown } DIGDRVSTAGE; typedef struct - { - ASI_STREAM_OPEN ASI_stream_open; - ASI_STREAM_PROCESS ASI_stream_process; - ASI_STREAM_SEEK ASI_stream_seek; - ASI_STREAM_CLOSE ASI_stream_close; - ASI_STREAM_ATTRIBUTE ASI_stream_attribute; - ASI_STREAM_SET_PREFERENCE ASI_stream_set_preference; + { + ASI_STREAM_OPEN ASI_stream_open; + ASI_STREAM_PROCESS ASI_stream_process; + ASI_STREAM_SEEK ASI_stream_seek; + ASI_STREAM_CLOSE ASI_stream_close; + ASI_STREAM_ATTRIBUTE ASI_stream_attribute; + ASI_STREAM_SET_PREFERENCE ASI_stream_set_preference; - HATTRIB INPUT_BIT_RATE; - HATTRIB INPUT_SAMPLE_RATE; - HATTRIB INPUT_BITS; - HATTRIB INPUT_CHANNELS; - HATTRIB OUTPUT_BIT_RATE; - HATTRIB OUTPUT_SAMPLE_RATE; - HATTRIB OUTPUT_BITS; - HATTRIB OUTPUT_CHANNELS; - HATTRIB POSITION; - HATTRIB PERCENT_DONE; - HATTRIB MIN_INPUT_BLOCK_SIZE; - HATTRIB RAW_RATE; - HATTRIB RAW_BITS; - HATTRIB RAW_CHANNELS; - HATTRIB REQUESTED_RATE; - HATTRIB REQUESTED_BITS; - HATTRIB REQUESTED_CHANS; + HATTRIB INPUT_BIT_RATE; + HATTRIB INPUT_SAMPLE_RATE; + HATTRIB INPUT_BITS; + HATTRIB INPUT_CHANNELS; + HATTRIB OUTPUT_BIT_RATE; + HATTRIB OUTPUT_SAMPLE_RATE; + HATTRIB OUTPUT_BITS; + HATTRIB OUTPUT_CHANNELS; + HATTRIB POSITION; + HATTRIB PERCENT_DONE; + HATTRIB MIN_INPUT_BLOCK_SIZE; + HATTRIB RAW_RATE; + HATTRIB RAW_BITS; + HATTRIB RAW_CHANNELS; + HATTRIB REQUESTED_RATE; + HATTRIB REQUESTED_BITS; + HATTRIB REQUESTED_CHANS; - HASISTREAM stream; - } + HASISTREAM stream; + } ASISTAGE; typedef struct - { - MIXER_FLUSH MSS_mixer_flush; - MIXER_MERGE MSS_mixer_merge; - MIXER_COPY MSS_mixer_copy; - } + { + MIXER_FLUSH MSS_mixer_flush; + MIXER_MERGE MSS_mixer_merge; + MIXER_COPY MSS_mixer_copy; + } MIXSTAGE; typedef struct - { - struct _FLTPROVIDER FAR *provider; - HSAMPLESTATE sample_state; - } + { + struct _FLTPROVIDER FAR *provider; + HSAMPLESTATE sample_state; + } FLTSTAGE; typedef struct { - S32 active; // Pass-through if 0, active if 1 - HPROVIDER provider; + S32 active; // Pass-through if 0, active if 1 + HPROVIDER provider; - union - { - ASISTAGE ASI; - MIXSTAGE MIX; - FLTSTAGE FLT; - } - TYPE; + union + { + ASISTAGE ASI; + MIXSTAGE MIX; + FLTSTAGE FLT; + } + TYPE; } DPINFO; @@ -1951,144 +1951,144 @@ DPINFO; // Other data types // -typedef struct _AIL_INPUT_INFO // Input descriptor type +typedef struct _AIL_INPUT_INFO // Input descriptor type { - U32 device_ID; // DS LPGUID or wave device ID - U32 hardware_format; // e.g., DIG_F_STEREO_16 - U32 hardware_rate; // e.g., 22050 - AILINCB callback; // Callback function to receive incoming data - S32 buffer_size; // Maximum # of bytes to be passed to callback (-1 to use DIG_INPUT_LATENCY) - U32 user_data; // this is a user defined value + U32 device_ID; // DS LPGUID or wave device ID + U32 hardware_format; // e.g., DIG_F_STEREO_16 + U32 hardware_rate; // e.g., 22050 + AILINCB callback; // Callback function to receive incoming data + S32 buffer_size; // Maximum # of bytes to be passed to callback (-1 to use DIG_INPUT_LATENCY) + U32 user_data; // this is a user defined value } AIL_INPUT_INFO; -typedef struct _AILTIMER // Timer instance +typedef struct _AILTIMER // Timer instance { - U32 status; - AILTIMERCB callback; - U32 user; + U32 status; + AILTIMERCB callback; + U32 user; - S32 elapsed; - S32 value; - S32 callingCT; // Calling EXE's task number (16 bit only) - S32 callingDS; // Calling EXE's DS (used in 16 bit only) - S32 IsWin32s; // Is this a Win32s callback + S32 elapsed; + S32 value; + S32 callingCT; // Calling EXE's task number (16 bit only) + S32 callingDS; // Calling EXE's DS (used in 16 bit only) + S32 IsWin32s; // Is this a Win32s callback } AILTIMERSTR; typedef struct _ADPCMDATATAG { - U32 blocksize; - U32 extrasamples; - U32 blockleft; - U32 step; - U32 savesrc; - U32 sample; - U32 destend; - U32 srcend; - U32 samplesL; - U32 samplesR; - U16 moresamples[16]; + U32 blocksize; + U32 extrasamples; + U32 blockleft; + U32 step; + U32 savesrc; + U32 sample; + U32 destend; + U32 srcend; + U32 samplesL; + U32 samplesR; + U16 moresamples[16]; } ADPCMDATA; -typedef struct _SAMPLE // Sample instance +typedef struct _SAMPLE // Sample instance { - char tag[4]; // HSAM + char tag[4]; // HSAM - HDIGDRIVER driver; // Driver for playback + HDIGDRIVER driver; // Driver for playback - U32 status; // SMP_ flags: _FREE, _DONE, _PLAYING + U32 status; // SMP_ flags: _FREE, _DONE, _PLAYING - void const FAR *start[2]; // Sample buffer address (W) - U32 len [2]; // Sample buffer size in bytes (W) - U32 pos [2]; // Index to next byte (R/W) - U32 done [2]; // Nonzero if buffer with len=0 sent by app - S32 reset_ASI [2]; // Reset the ASI decoder at the end of the buffer + void const FAR *start[2]; // Sample buffer address (W) + U32 len [2]; // Sample buffer size in bytes (W) + U32 pos [2]; // Index to next byte (R/W) + U32 done [2]; // Nonzero if buffer with len=0 sent by app + S32 reset_ASI [2]; // Reset the ASI decoder at the end of the buffer - U32 src_fract; // Fractional part of source address - S32 left_val; // Mixer source value from end of last buffer - S32 right_val; // Mixer source value from end of last buffer + U32 src_fract; // Fractional part of source address + S32 left_val; // Mixer source value from end of last buffer + S32 right_val; // Mixer source value from end of last buffer - S32 current_buffer; // Buffer # active (0/1) - S32 last_buffer; // Last active buffer (for double-buffering) - S32 starved; // Buffer stream has run out of data + S32 current_buffer; // Buffer # active (0/1) + S32 last_buffer; // Last active buffer (for double-buffering) + S32 starved; // Buffer stream has run out of data - S32 loop_count; // # of cycles-1 (1=one-shot, 0=indefinite) - S32 loop_start; // Starting offset of loop block (0=SOF) - S32 loop_end; // End offset of loop block (-1=EOF) + S32 loop_count; // # of cycles-1 (1=one-shot, 0=indefinite) + S32 loop_start; // Starting offset of loop block (0=SOF) + S32 loop_end; // End offset of loop block (-1=EOF) - S32 format; // DIG_F format (8/16 bits, mono/stereo) - U32 flags; // DIG_PCM_SIGN / DIG_PCM_ORDER (stereo only) + S32 format; // DIG_F format (8/16 bits, mono/stereo) + U32 flags; // DIG_PCM_SIGN / DIG_PCM_ORDER (stereo only) - S32 playback_rate; // Playback rate in hertz + S32 playback_rate; // Playback rate in hertz - S32 volume; // Sample volume 0-127 - S32 pan; // Mono panpot/stereo balance (0=L ... 127=R) + S32 volume; // Sample volume 0-127 + S32 pan; // Mono panpot/stereo balance (0=L ... 127=R) - S32 left_scale; // Left/mono volume scalar 0-2047 - S32 right_scale; // Right volume scalar 0-2047 + S32 left_scale; // Left/mono volume scalar 0-2047 + S32 right_scale; // Right volume scalar 0-2047 - S32 service_type; // 1 if single-buffered; 2 if streamed + S32 service_type; // 1 if single-buffered; 2 if streamed - AILSAMPLECB SOB; // Start-of-block callback function - AILSAMPLECB EOB; // End-of-buffer callback function - AILSAMPLECB EOS; // End-of-sample callback function + AILSAMPLECB SOB; // Start-of-block callback function + AILSAMPLECB EOB; // End-of-buffer callback function + AILSAMPLECB EOS; // End-of-sample callback function - S32 user_data [8]; // Miscellaneous user data - S32 system_data[8]; // Miscellaneous system data + S32 user_data [8]; // Miscellaneous user data + S32 system_data[8]; // Miscellaneous system data - ADPCMDATA adpcm; + ADPCMDATA adpcm; #ifdef IS_WINDOWS - S32 SOB_IsWin32s; // Is this a Win32s callback - S32 EOB_IsWin32s; // Is this a Win32s callback - S32 EOS_IsWin32s; // Is this a Win32s callback + S32 SOB_IsWin32s; // Is this a Win32s callback + S32 EOB_IsWin32s; // Is this a Win32s callback + S32 EOS_IsWin32s; // Is this a Win32s callback - // - // DirectSound-specific data - // + // + // DirectSound-specific data + // - S32 secondary_buffer; // Secondary buffer index + S32 secondary_buffer; // Secondary buffer index - S32 service_interval; // Service sample every n ms - S32 service_tick; // Current service countdown value - S32 buffer_segment_size; // Buffer segment size to fill + S32 service_interval; // Service sample every n ms + S32 service_tick; // Current service countdown value + S32 buffer_segment_size; // Buffer segment size to fill - S32 prev_segment; // Previous segment # (0...n) - S32 prev_cursor; // Previous play cursor location + S32 prev_segment; // Previous segment # (0...n) + S32 prev_cursor; // Previous play cursor location - S32 bytes_remaining; // # of bytes left to play (if not -1) + S32 bytes_remaining; // # of bytes left to play (if not -1) - S32 direct_control; // 1 if app controls buffer, 0 if MSS + S32 direct_control; // 1 if app controls buffer, 0 if MSS #endif - S32 doeob; // Flags to trigger callbacks - S32 dosob; - S32 doeos; + S32 doeob; // Flags to trigger callbacks + S32 dosob; + S32 doeos; - // - // Sample pipeline stages - // + // + // Sample pipeline stages + // - DPINFO pipeline[N_SAMPLE_STAGES]; + DPINFO pipeline[N_SAMPLE_STAGES]; - // - // Reverb parms - // + // + // Reverb parms + // - F32 reverb_level; // Level [0.0, 1.0] - F32 reverb_reflect_time; // Reflect time in milliseconds - F32 reverb_decay_time; // Decay time [0.1, 20.0] - S32 base_scale; // Original 12-bit volume scalar + F32 reverb_level; // Level [0.0, 1.0] + F32 reverb_reflect_time; // Reflect time in milliseconds + F32 reverb_decay_time; // Decay time [0.1, 20.0] + S32 base_scale; // Original 12-bit volume scalar } SAMPLE; #if defined(IS_WINDOWS) || defined(IS_MAC) -DXDEC U32 AILCALL AIL_get_timer_highest_delay (void); +DXDEC U32 AILCALL AIL_get_timer_highest_delay (void); -DXDEC void AILCALL AIL_serve(void); +DXDEC void AILCALL AIL_serve(void); #ifdef IS_MAC @@ -2098,21 +2098,21 @@ typedef void * LPSTR; typedef struct _WAVEIN { - long temp; + long temp; } * HWAVEIN; typedef struct _WAVEHDR { - S32 dwFlags; - S32 dwBytesRecorded; - S32 dwUser; - S32 temp; - void * lpData; - S32 dwBufferLength; - S32 longdwLoops; - S32 dwLoops; - void * lpNext; - U32 * reserved; + S32 dwFlags; + S32 dwBytesRecorded; + S32 dwUser; + S32 temp; + void * lpData; + S32 dwBufferLength; + S32 longdwLoops; + S32 dwLoops; + void * lpNext; + U32 * reserved; } WAVEHDR, * LPWAVEHDR; @@ -2120,86 +2120,86 @@ typedef struct _WAVEHDR typedef struct _DIG_INPUT_DRIVER FAR *HDIGINPUT; // Handle to digital input driver -typedef struct _DIG_INPUT_DRIVER // Handle to digital input driver +typedef struct _DIG_INPUT_DRIVER // Handle to digital input driver { - C8 tag[4]; // HDIN + C8 tag[4]; // HDIN - HTIMER background_timer; // Background timer handle + HTIMER background_timer; // Background timer handle - AIL_INPUT_INFO info; // Input device descriptor - - S32 input_enabled; // 1 if enabled, 0 if not + AIL_INPUT_INFO info; // Input device descriptor + + S32 input_enabled; // 1 if enabled, 0 if not #ifndef IS_MAC - U32 callback_user; // Callback user value + U32 callback_user; // Callback user value - // - // Provider-independent data - // + // + // Provider-independent data + // - U32 DMA_size; // Size of each DMA sub-buffer in bytes - void FAR *DMA[2]; // Simulated DMA buffers + U32 DMA_size; // Size of each DMA sub-buffer in bytes + void FAR *DMA[2]; // Simulated DMA buffers - U8 silence; // Silence value for current format (0 or 128) + U8 silence; // Silence value for current format (0 or 128) - S32 device_active; // 1 if buffers submittable, 0 if not + S32 device_active; // 1 if buffers submittable, 0 if not - // - // waveOut-specific data - // + // + // waveOut-specific data + // - HWAVEIN hWaveIn; // Handle to wave input device - volatile WAVEHDR wavehdr[2]; // Handles to wave headers + HWAVEIN hWaveIn; // Handle to wave input device + volatile WAVEHDR wavehdr[2]; // Handles to wave headers #else - Boolean timer_started; - Boolean locked; - Boolean enter_lock; - U32 saved_period; + Boolean timer_started; + Boolean locked; + Boolean enter_lock; + U32 saved_period; - void* my_vars; + void* my_vars; - // - // Input related - // + // + // Input related + // - U32 input_buffer_size; - char * input_buffers[2]; + U32 input_buffer_size; + char * input_buffers[2]; - // - // Mix related - // + // + // Mix related + // - char * build_buffer; - U32 build_buffer_size; + char * build_buffer; + U32 build_buffer_size; - // - // Output related - // - struct - { - S8 * buffer; - S8 * buffer_end; + // + // Output related + // + struct + { + S8 * buffer; + S8 * buffer_end; - U32 size; - S8 * right_margine; - S8 * current_head; - S8 * current_tail; - } output_buffer; + U32 size; + S8 * right_margine; + S8 * current_head; + S8 * current_tail; + } output_buffer; - S32 mix_operation; - S32 playback_ratio; - U32 src_fract; - S8 * current_head; - S32 left_val; - S32 right_val; + S32 mix_operation; + S32 playback_ratio; + U32 src_fract; + S8 * current_head; + S32 left_val; + S32 right_val; - U32 stored_sample_size; - U32 stored_number_of_channels; + U32 stored_sample_size; + U32 stored_number_of_channels; - U32 last_rw_delta; - U32 period; + U32 last_rw_delta; + U32 period; #endif } @@ -2207,294 +2207,294 @@ DIG_INPUT_DRIVER; #endif -typedef struct _DIG_DRIVER // Handle to digital audio driver +typedef struct _DIG_DRIVER // Handle to digital audio driver { - char tag[4]; // HDIG + char tag[4]; // HDIG - HTIMER backgroundtimer; // Background timer handle + HTIMER backgroundtimer; // Background timer handle - S32 quiet; // # of consecutive quiet sample periods + S32 quiet; // # of consecutive quiet sample periods - S32 n_active_samples; // # of samples being processed + S32 n_active_samples; // # of samples being processed - S32 master_volume; // Master sample volume 0-127 + S32 master_volume; // Master sample volume 0-127 - S32 DMA_rate; // Hardware sample rate - S32 hw_format; // DIG_F code in use - U32 hw_mode_flags; // DIG_PCM_ flags for mode in use + S32 DMA_rate; // Hardware sample rate + S32 hw_format; // DIG_F code in use + U32 hw_mode_flags; // DIG_PCM_ flags for mode in use - S32 channels_per_sample; // # of channels per sample (1 or 2) - S32 bytes_per_channel; // # of bytes per channel (1 or 2) - S32 channels_per_buffer; // # of channels per half-buffer - S32 samples_per_buffer; // # of samples per half-buffer + S32 channels_per_sample; // # of channels per sample (1 or 2) + S32 bytes_per_channel; // # of bytes per channel (1 or 2) + S32 channels_per_buffer; // # of channels per half-buffer + S32 samples_per_buffer; // # of samples per half-buffer - S32 playing; // Playback active if non-zero + S32 playing; // Playback active if non-zero #ifdef IS_MAC - U32 n_samples_allocated; - U32 n_samples_used; - U32 n_samples_played; - SAMPLE *samples; // Pointer to SAMPLEs + U32 n_samples_allocated; + U32 n_samples_used; + U32 n_samples_played; + SAMPLE *samples; // Pointer to SAMPLEs - HDIGDRIVER next; // Pointer to next HDIGDRIVER in use - U32 reset_works; // TRUE if OK to do waveOutReset - U32 request_reset; // If nonzero, do waveOutReset ASAP - S32 released; // has the sound manager been released? + HDIGDRIVER next; // Pointer to next HDIGDRIVER in use + U32 reset_works; // TRUE if OK to do waveOutReset + U32 request_reset; // If nonzero, do waveOutReset ASAP + S32 released; // has the sound manager been released? - ExtSoundHeader sound_header; - SndChannelPtr sound_channel; - SndCallBackUPP global_callback; - Ptr buffers[2]; - Boolean loaded[2]; - U32 work_buffer; - U32 play_buffer; - U32 load_pos; - U32 load_size; - Boolean load; - U32 start_time; - void* background_processor; + ExtSoundHeader sound_header; + SndChannelPtr sound_channel; + SndCallBackUPP global_callback; + Ptr buffers[2]; + Boolean loaded[2]; + U32 work_buffer; + U32 play_buffer; + U32 load_pos; + U32 load_size; + Boolean load; + U32 start_time; + void* background_processor; #else - HSAMPLE samples; // Pointer to list of SAMPLEs + HSAMPLE samples; // Pointer to list of SAMPLEs #endif - S32 n_samples; // # of SAMPLEs + S32 n_samples; // # of SAMPLEs - S32 build_size; // # of bytes in build buffer - S32 FAR *build_buffer; // Build buffer (4 * samples_per_buffer) + S32 build_size; // # of bytes in build buffer + S32 FAR *build_buffer; // Build buffer (4 * samples_per_buffer) - S32 system_data[8]; // Miscellaneous system data + S32 system_data[8]; // Miscellaneous system data - S32 buffer_size; // Size of each output buffer + S32 buffer_size; // Size of each output buffer #ifdef IS_WINDOWS - // - // waveOut-specific interface data - // + // + // waveOut-specific interface data + // - HWAVEOUT hWaveOut; // Wave output driver + HWAVEOUT hWaveOut; // Wave output driver - U32 reset_works; // TRUE if OK to do waveOutReset - U32 request_reset; // If nonzero, do waveOutReset ASAP + U32 reset_works; // TRUE if OK to do waveOutReset + U32 request_reset; // If nonzero, do waveOutReset ASAP - LPWAVEHDR first; // Pointer to first WAVEHDR in chain - S32 n_buffers; // # of output WAVEHDRs in chain + LPWAVEHDR first; // Pointer to first WAVEHDR in chain + S32 n_buffers; // # of output WAVEHDRs in chain - LPWAVEHDR volatile FAR *return_list; // Circular list of returned WAVEHDRs - S32 volatile return_head; // Head of WAVEHDR list (insertion point) - S32 volatile return_tail; // Tail of WAVEHDR list (retrieval point) + LPWAVEHDR volatile FAR *return_list; // Circular list of returned WAVEHDRs + S32 volatile return_head; // Head of WAVEHDR list (insertion point) + S32 volatile return_tail; // Tail of WAVEHDR list (retrieval point) - U32 deviceid; // id from waveout open - PCMWAVEFORMAT wformat; // format from waveout open + U32 deviceid; // id from waveout open + PCMWAVEFORMAT wformat; // format from waveout open - // - // DirectSound-specific interface data - // + // + // DirectSound-specific interface data + // - U32 guid; // The guid id of the ds driver - AILLPDIRECTSOUND pDS; // DirectSound output driver (don't - // use with Smacker directly anymore!) + U32 guid; // The guid id of the ds driver + AILLPDIRECTSOUND pDS; // DirectSound output driver (don't + // use with Smacker directly anymore!) - U32 ds_priority; // priority opened with + U32 ds_priority; // priority opened with - S32 emulated_ds; // is ds emulated or not? - AILLPDIRECTSOUNDBUFFER lppdsb; // primary buffer or null + S32 emulated_ds; // is ds emulated or not? + AILLPDIRECTSOUNDBUFFER lppdsb; // primary buffer or null - U32 dsHwnd; // HWND used with DirectSound + U32 dsHwnd; // HWND used with DirectSound - AILLPDIRECTSOUNDBUFFER FAR * lpbufflist; // List of pointers to secondary buffers - HSAMPLE FAR *samp_list; // HSAMPLE associated with each buffer - S32 FAR *sec_format; // DIG_F_ format for secondary buffer - S32 max_buffs; // Max. allowable # of secondary buffers + AILLPDIRECTSOUNDBUFFER FAR * lpbufflist; // List of pointers to secondary buffers + HSAMPLE FAR *samp_list; // HSAMPLE associated with each buffer + S32 FAR *sec_format; // DIG_F_ format for secondary buffer + S32 max_buffs; // Max. allowable # of secondary buffers - // - // Misc. data - // + // + // Misc. data + // - S32 released; // has the sound manager been released? + S32 released; // has the sound manager been released? - U32 foreground_timer; // Foreground timer handle + U32 foreground_timer; // Foreground timer handle - HDIGDRIVER next; // Pointer to next HDIGDRIVER in use - S32 callingCT; // Calling EXE's task number (16 bit only) - S32 callingDS; // Calling EXE's DS (used in 16 bit only) + HDIGDRIVER next; // Pointer to next HDIGDRIVER in use + S32 callingCT; // Calling EXE's task number (16 bit only) + S32 callingDS; // Calling EXE's DS (used in 16 bit only) - // - // Vars for waveOut emulation - // + // + // Vars for waveOut emulation + // - S32 DS_initialized; + S32 DS_initialized; - AILLPDIRECTSOUNDBUFFER DS_sec_buff; // Secondary buffer (or NULL if none) - AILLPDIRECTSOUNDBUFFER DS_out_buff; // Output buffer (may be sec or prim) - S32 DS_buffer_size; // Size of entire output buffer + AILLPDIRECTSOUNDBUFFER DS_sec_buff; // Secondary buffer (or NULL if none) + AILLPDIRECTSOUNDBUFFER DS_out_buff; // Output buffer (may be sec or prim) + S32 DS_buffer_size; // Size of entire output buffer - S32 DS_frag_cnt; // Total fragment count and size, and - S32 DS_frag_size; // last fragment occupied by play cursor - S32 DS_last_frag; - S32 DS_last_write; - S32 DS_last_timer; - S32 DS_skip_time; + S32 DS_frag_cnt; // Total fragment count and size, and + S32 DS_frag_size; // last fragment occupied by play cursor + S32 DS_last_frag; + S32 DS_last_write; + S32 DS_last_timer; + S32 DS_skip_time; - S32 DS_use_default_format; // 1 to force use of default DS primary buffer format + S32 DS_use_default_format; // 1 to force use of default DS primary buffer format #else - #ifdef IS_DOS + #ifdef IS_DOS - // must be first in the DOS section - void *DMA[2]; // Protected-mode pointers to half-buffers - // (note that DMA[0] may != DMA_buf) + // must be first in the DOS section + void *DMA[2]; // Protected-mode pointers to half-buffers + // (note that DMA[0] may != DMA_buf) - REALFAR DMA_seg; // Seg:off pointer to DMA buffers (off=0) - U32 DMA_sel; // Selector for DMA buffers (off=0) - void *DMA_buf; // Protected-mode pointer to DMA buffers + REALFAR DMA_seg; // Seg:off pointer to DMA buffers (off=0) + U32 DMA_sel; // Selector for DMA buffers (off=0) + void *DMA_buf; // Protected-mode pointer to DMA buffers - S16 *buffer_flag; // Protected-mode pointer to buffer flag - S32 last_buffer; // Last active buffer flag value in driver + S16 *buffer_flag; // Protected-mode pointer to buffer flag + S32 last_buffer; // Last active buffer flag value in driver - AIL_DRIVER *drvr; // Base driver descriptor + AIL_DRIVER *drvr; // Base driver descriptor - DIG_DDT *DDT; // Protected-mode pointer to DDT - DIG_DST *DST; // Protected-mode pointer to DST - - #endif + DIG_DDT *DDT; // Protected-mode pointer to DDT + DIG_DST *DST; // Protected-mode pointer to DST + + #endif #endif #ifdef IS_X86 - S32 use_MMX; // Use MMX with this driver if TRUE + S32 use_MMX; // Use MMX with this driver if TRUE #endif - void FAR *decode_buffer; // Buffer used by optional ASI pipeline decoder - S32 decode_buffer_size; // # of bytes in decode buffer + void FAR *decode_buffer; // Buffer used by optional ASI pipeline decoder + S32 decode_buffer_size; // # of bytes in decode buffer - U32 us_count; - U32 ms_count; - U32 last_ms_polled; - U32 last_percent; + U32 us_count; + U32 ms_count; + U32 last_ms_polled; + U32 last_percent; - // - // Digital driver pipeline stages - // + // + // Digital driver pipeline stages + // - DPINFO pipeline[N_DIGDRV_STAGES]; + DPINFO pipeline[N_DIGDRV_STAGES]; - // - // Reverb buffer - // + // + // Reverb buffer + // - S32 FAR *reverb_buffer; - S32 reverb_buffer_size; - S32 reverb_buffer_position; + S32 FAR *reverb_buffer; + S32 reverb_buffer_size; + S32 reverb_buffer_position; #ifdef IS_WINDOWS - S32 no_wom_done; // don't process WOM_DONEs on this driver - U32 wom_done_buffers; + S32 no_wom_done; // don't process WOM_DONEs on this driver + U32 wom_done_buffers; #endif } DIG_DRIVER; -typedef struct // MIDI status log structure - { - S32 program [NUM_CHANS]; // Program Change - S32 pitch_l [NUM_CHANS]; // Pitch Bend LSB - S32 pitch_h [NUM_CHANS]; // Pitch Bend MSB +typedef struct // MIDI status log structure + { + S32 program [NUM_CHANS]; // Program Change + S32 pitch_l [NUM_CHANS]; // Pitch Bend LSB + S32 pitch_h [NUM_CHANS]; // Pitch Bend MSB - S32 c_lock [NUM_CHANS]; // Channel Lock - S32 c_prot [NUM_CHANS]; // Channel Lock Protection - S32 c_mute [NUM_CHANS]; // Channel Mute - S32 c_v_prot [NUM_CHANS]; // Voice Protection - S32 bank [NUM_CHANS]; // Patch Bank Select - S32 gm_bank_l [NUM_CHANS]; // GM Bank Select - S32 gm_bank_m [NUM_CHANS]; // GM Bank Select - S32 indirect [NUM_CHANS]; // ICA indirect controller value - S32 callback [NUM_CHANS]; // Callback Trigger + S32 c_lock [NUM_CHANS]; // Channel Lock + S32 c_prot [NUM_CHANS]; // Channel Lock Protection + S32 c_mute [NUM_CHANS]; // Channel Mute + S32 c_v_prot [NUM_CHANS]; // Voice Protection + S32 bank [NUM_CHANS]; // Patch Bank Select + S32 gm_bank_l [NUM_CHANS]; // GM Bank Select + S32 gm_bank_m [NUM_CHANS]; // GM Bank Select + S32 indirect [NUM_CHANS]; // ICA indirect controller value + S32 callback [NUM_CHANS]; // Callback Trigger - S32 mod [NUM_CHANS]; // Modulation - S32 vol [NUM_CHANS]; // Volume - S32 pan [NUM_CHANS]; // Panpot - S32 exp [NUM_CHANS]; // Expression - S32 sus [NUM_CHANS]; // Sustain - S32 reverb [NUM_CHANS]; // Reverb - S32 chorus [NUM_CHANS]; // Chorus + S32 mod [NUM_CHANS]; // Modulation + S32 vol [NUM_CHANS]; // Volume + S32 pan [NUM_CHANS]; // Panpot + S32 exp [NUM_CHANS]; // Expression + S32 sus [NUM_CHANS]; // Sustain + S32 reverb [NUM_CHANS]; // Reverb + S32 chorus [NUM_CHANS]; // Chorus - S32 bend_range[NUM_CHANS]; // Bender Range (data MSB, RPN 0 assumed) + S32 bend_range[NUM_CHANS]; // Bender Range (data MSB, RPN 0 assumed) - S32 RPN_L [NUM_CHANS]; // RPN # LSB - S32 RPN_M [NUM_CHANS]; // RPN # MSB - } + S32 RPN_L [NUM_CHANS]; // RPN # LSB + S32 RPN_M [NUM_CHANS]; // RPN # MSB + } CTRL_LOG; -typedef struct _SEQUENCE // XMIDI sequence state table +typedef struct _SEQUENCE // XMIDI sequence state table { - char tag[4]; // HSEQ + char tag[4]; // HSEQ - HMDIDRIVER driver; // Driver for playback + HMDIDRIVER driver; // Driver for playback - U32 status; // SEQ_ flags + U32 status; // SEQ_ flags - void const FAR *TIMB; // XMIDI IFF chunk pointers - void const FAR *RBRN; - void const FAR *EVNT; + void const FAR *TIMB; // XMIDI IFF chunk pointers + void const FAR *RBRN; + void const FAR *EVNT; - U8 const FAR *EVNT_ptr; // Current event pointer + U8 const FAR *EVNT_ptr; // Current event pointer - U8 FAR *ICA; // Indirect Controller Array + U8 FAR *ICA; // Indirect Controller Array - AILPREFIXCB prefix_callback; // XMIDI Callback Prefix handler - AILTRIGGERCB trigger_callback; // XMIDI Callback Trigger handler - AILBEATCB beat_callback; // XMIDI beat/bar change handler - AILSEQUENCECB EOS; // End-of-sequence callback function + AILPREFIXCB prefix_callback; // XMIDI Callback Prefix handler + AILTRIGGERCB trigger_callback; // XMIDI Callback Trigger handler + AILBEATCB beat_callback; // XMIDI beat/bar change handler + AILSEQUENCECB EOS; // End-of-sequence callback function - S32 loop_count; // 0=one-shot, -1=indefinite, ... + S32 loop_count; // 0=one-shot, -1=indefinite, ... - S32 interval_count; // # of intervals until next event - S32 interval_num; // # of intervals since start + S32 interval_count; // # of intervals until next event + S32 interval_num; // # of intervals since start - S32 volume; // Sequence volume 0-127 - S32 volume_target; // Target sequence volume 0-127 - S32 volume_accum; // Accumulated volume period - S32 volume_period; // Period for volume stepping + S32 volume; // Sequence volume 0-127 + S32 volume_target; // Target sequence volume 0-127 + S32 volume_accum; // Accumulated volume period + S32 volume_period; // Period for volume stepping - S32 tempo_percent; // Relative tempo percentage 0-100 - S32 tempo_target; // Target tempo 0-100 - S32 tempo_accum; // Accumulated tempo period - S32 tempo_period; // Period for tempo stepping - S32 tempo_error; // Error counter for tempo DDA + S32 tempo_percent; // Relative tempo percentage 0-100 + S32 tempo_target; // Target tempo 0-100 + S32 tempo_accum; // Accumulated tempo period + S32 tempo_period; // Period for tempo stepping + S32 tempo_error; // Error counter for tempo DDA - S32 beat_count; // Sequence playback position - S32 measure_count; + S32 beat_count; // Sequence playback position + S32 measure_count; - S32 time_numerator; // Sequence timing data - S32 time_fraction; - S32 beat_fraction; - S32 time_per_beat; + S32 time_numerator; // Sequence timing data + S32 time_fraction; + S32 beat_fraction; + S32 time_per_beat; - void const FAR *FOR_ptrs[FOR_NEST]; // Loop stack - S32 FOR_loop_count [FOR_NEST]; + void const FAR *FOR_ptrs[FOR_NEST]; // Loop stack + S32 FOR_loop_count [FOR_NEST]; - S32 chan_map [NUM_CHANS]; // Physical channel map for sequence + S32 chan_map [NUM_CHANS]; // Physical channel map for sequence - CTRL_LOG shadow; // Controller values for sequence + CTRL_LOG shadow; // Controller values for sequence - S32 note_count; // # of notes "on" + S32 note_count; // # of notes "on" - S32 note_chan [MAX_NOTES]; // Channel for queued note (-1=free) - S32 note_num [MAX_NOTES]; // Note # for queued note - S32 note_time [MAX_NOTES]; // Remaining duration in intervals + S32 note_chan [MAX_NOTES]; // Channel for queued note (-1=free) + S32 note_num [MAX_NOTES]; // Note # for queued note + S32 note_time [MAX_NOTES]; // Remaining duration in intervals - S32 user_data [8]; // Miscellaneous user data - S32 system_data[8]; // Miscellaneous system data + S32 user_data [8]; // Miscellaneous user data + S32 system_data[8]; // Miscellaneous system data #ifdef IS_WINDOWS - S32 PREFIX_IsWin32s; // Is this a Win32s callback - S32 TRIGGER_IsWin32s; // Is this a Win32s callback - S32 BEAT_IsWin32s; // Is this a Win32s callback - S32 EOS_IsWin32s; // Is this a Win32s callback + S32 PREFIX_IsWin32s; // Is this a Win32s callback + S32 TRIGGER_IsWin32s; // Is this a Win32s callback + S32 BEAT_IsWin32s; // Is this a Win32s callback + S32 EOS_IsWin32s; // Is this a Win32s callback #endif } SEQUENCE; @@ -2506,144 +2506,144 @@ typedef struct MIDIOUT* HMIDIOUT; #endif -typedef struct _MDI_DRIVER // Handle to XMIDI driver +typedef struct _MDI_DRIVER // Handle to XMIDI driver { - char tag[4]; // HMDI + char tag[4]; // HMDI - HTIMER timer; // XMIDI quantization timer - S32 interval_time; // XMIDI quantization timer interval in uS + HTIMER timer; // XMIDI quantization timer + S32 interval_time; // XMIDI quantization timer interval in uS - S32 disable; // > 0 to disable XMIDI service + S32 disable; // > 0 to disable XMIDI service - HSEQUENCE sequences; // Pointer to list of SEQUENCEs - S32 n_sequences; // # of SEQUENCEs + HSEQUENCE sequences; // Pointer to list of SEQUENCEs + S32 n_sequences; // # of SEQUENCEs - S32 lock [NUM_CHANS]; // 1 if locked, 2 if protected, else 0 - HSEQUENCE locker[NUM_CHANS]; // HSEQUENCE which locked channel - HSEQUENCE owner [NUM_CHANS]; // HSEQUENCE which owned locked channel - HSEQUENCE user [NUM_CHANS]; // Last sequence to use channel - S32 state [NUM_CHANS]; // Lock state prior to being locked + S32 lock [NUM_CHANS]; // 1 if locked, 2 if protected, else 0 + HSEQUENCE locker[NUM_CHANS]; // HSEQUENCE which locked channel + HSEQUENCE owner [NUM_CHANS]; // HSEQUENCE which owned locked channel + HSEQUENCE user [NUM_CHANS]; // Last sequence to use channel + S32 state [NUM_CHANS]; // Lock state prior to being locked - S32 notes [NUM_CHANS]; // # of active notes in channel + S32 notes [NUM_CHANS]; // # of active notes in channel - AILEVENTCB event_trap; // MIDI event trap callback function - AILTIMBRECB timbre_trap; // Timbre request callback function + AILEVENTCB event_trap; // MIDI event trap callback function + AILTIMBRECB timbre_trap; // Timbre request callback function - S32 master_volume; // Master XMIDI note volume 0-127 + S32 master_volume; // Master XMIDI note volume 0-127 - S32 system_data[8]; // Miscellaneous system data + S32 system_data[8]; // Miscellaneous system data #if defined(IS_WINDOWS) || defined(IS_MAC) - - S32 released; // has the hmidiout handle been released - U32 deviceid; // ID of the MIDI device - U8 FAR *sysdata; // SysEx buffer + + S32 released; // has the hmidiout handle been released + U32 deviceid; // ID of the MIDI device + U8 FAR *sysdata; // SysEx buffer #endif #ifdef IS_WINDOWS - S32 EVENT_IsWin32s; // Is this a Win32s callback - S32 TIMBRE_IsWin32s; // Is this a Win32s callback + S32 EVENT_IsWin32s; // Is this a Win32s callback + S32 TIMBRE_IsWin32s; // Is this a Win32s callback - MIDIHDR FAR *mhdr; // SysEx header + MIDIHDR FAR *mhdr; // SysEx header - HMDIDRIVER next; // Pointer to next HMDIDRIVER in use - S32 callingCT; // Calling EXE's task number (16 bit only) - S32 callingDS; // Calling EXE's DS (used in 16 bit only) + HMDIDRIVER next; // Pointer to next HMDIDRIVER in use + S32 callingCT; // Calling EXE's task number (16 bit only) + S32 callingDS; // Calling EXE's DS (used in 16 bit only) - HMIDIOUT hMidiOut; // MIDI output driver + HMIDIOUT hMidiOut; // MIDI output driver #else - #ifdef IS_DOS + #ifdef IS_DOS - S32 message_count; // MIDI message count - S32 offset; // MIDI buffer offset + S32 message_count; // MIDI message count + S32 offset; // MIDI buffer offset - AIL_DRIVER *drvr; // Base driver descriptor + AIL_DRIVER *drvr; // Base driver descriptor - MDI_DDT *DDT; // Protected-mode pointer to DDT - MDI_DST *DST; // Protected-mode pointer to DST - #else - #ifdef IS_MAC - struct MIDIHDR FAR *mhdr; // SysEx header - HMDIDRIVER next; // Pointer to next HMDIDRIVER in use - HMIDIOUT hMidiOut; // MIDI output driver - U32 last_us_time; - long period_counter; - long current_period_sum; - #endif - #endif + MDI_DDT *DDT; // Protected-mode pointer to DDT + MDI_DST *DST; // Protected-mode pointer to DST + #else + #ifdef IS_MAC + struct MIDIHDR FAR *mhdr; // SysEx header + HMDIDRIVER next; // Pointer to next HMDIDRIVER in use + HMIDIOUT hMidiOut; // MIDI output driver + U32 last_us_time; + long period_counter; + long current_period_sum; + #endif + #endif #endif } MDI_DRIVER; -typedef struct // XMIDI TIMB IFF chunk - { - S8 name[4]; +typedef struct // XMIDI TIMB IFF chunk + { + S8 name[4]; - U8 msb; - U8 lsb; - U8 lsb2; - U8 lsb3; + U8 msb; + U8 lsb; + U8 lsb2; + U8 lsb3; - U16 n_entries; + U16 n_entries; - U16 timbre[1]; - } + U16 timbre[1]; + } TIMB_chunk; -typedef struct // XMIDI RBRN IFF entry - { - S16 bnum; - U32 offset; - } +typedef struct // XMIDI RBRN IFF entry + { + S16 bnum; + U32 offset; + } RBRN_entry; -typedef struct // Wave library entry +typedef struct // Wave library entry { - S32 bank; // XMIDI bank, MIDI patch for sample - S32 patch; + S32 bank; // XMIDI bank, MIDI patch for sample + S32 patch; - S32 root_key; // Root MIDI note # for sample (or -1) + S32 root_key; // Root MIDI note # for sample (or -1) - U32 file_offset; // Offset of wave data from start-of-file - U32 size; // Size of wave sample in bytes + U32 file_offset; // Offset of wave data from start-of-file + U32 size; // Size of wave sample in bytes - S32 format; // DIG_F format (8/16 bits, mono/stereo) - U32 flags; // DIG_PCM_SIGN / DIG_PCM_ORDER (stereo) - S32 playback_rate; // Playback rate in hertz + S32 format; // DIG_F format (8/16 bits, mono/stereo) + U32 flags; // DIG_PCM_SIGN / DIG_PCM_ORDER (stereo) + S32 playback_rate; // Playback rate in hertz } WAVE_ENTRY; -typedef struct // Virtual "wave synthesizer" descriptor +typedef struct // Virtual "wave synthesizer" descriptor { - HMDIDRIVER mdi; // MIDI driver for use with synthesizer - HDIGDRIVER dig; // Digital driver for use with synthesizer + HMDIDRIVER mdi; // MIDI driver for use with synthesizer + HDIGDRIVER dig; // Digital driver for use with synthesizer - WAVE_ENTRY FAR *library; // Pointer to wave library + WAVE_ENTRY FAR *library; // Pointer to wave library - AILEVENTCB prev_event_fn; // Previous MIDI event trap function - AILTIMBRECB prev_timb_fn; // Previous timbre request trap function + AILEVENTCB prev_event_fn; // Previous MIDI event trap function + AILTIMBRECB prev_timb_fn; // Previous timbre request trap function - CTRL_LOG controls; // MIDI controller states + CTRL_LOG controls; // MIDI controller states - WAVE_ENTRY FAR *wave [NUM_CHANS];// Pointer to WAVE_ENTRY for each channel + WAVE_ENTRY FAR *wave [NUM_CHANS];// Pointer to WAVE_ENTRY for each channel - HSAMPLE S [MAX_W_VOICES]; // List of HSAMPLE voices - S32 n_voices; // Actual # of voices allocated to synth + HSAMPLE S [MAX_W_VOICES]; // List of HSAMPLE voices + S32 n_voices; // Actual # of voices allocated to synth - S32 chan [MAX_W_VOICES]; // MIDI channel for each voice, or -1 - S32 note [MAX_W_VOICES]; // MIDI note number for voice - S32 root [MAX_W_VOICES]; // MIDI root note for voice - S32 rate [MAX_W_VOICES]; // Playback rate for voice - S32 vel [MAX_W_VOICES]; // MIDI note velocity for voice - U32 time [MAX_W_VOICES]; // Timestamp for voice + S32 chan [MAX_W_VOICES]; // MIDI channel for each voice, or -1 + S32 note [MAX_W_VOICES]; // MIDI note number for voice + S32 root [MAX_W_VOICES]; // MIDI root note for voice + S32 rate [MAX_W_VOICES]; // Playback rate for voice + S32 vel [MAX_W_VOICES]; // MIDI note velocity for voice + U32 time [MAX_W_VOICES]; // Timestamp for voice - U32 event; // Event counter for LRU timestamps + U32 event; // Event counter for LRU timestamps } WAVE_SYNTH; @@ -2666,25 +2666,25 @@ extern HANDLE hAppThread; // Background flag for timers // -extern volatile S32 AIL_bkgnd_flag; +extern volatile S32 AIL_bkgnd_flag; // // Global preference array // -extern S32 AIL_preference [N_PREFS]; +extern S32 AIL_preference [N_PREFS]; // // DIG_DRIVER list // -extern HDIGDRIVER DIG_first; +extern HDIGDRIVER DIG_first; // // MDI_DRIVER list // -extern HMDIDRIVER MDI_first; +extern HMDIDRIVER MDI_first; // // Miscellaneous system services @@ -2695,163 +2695,163 @@ extern HMDIDRIVER MDI_first; #ifndef NO_OLD_SYS_FUNCTIONS #define MEM_alloc_lock AIL_mem_alloc_lock -#define MEM_free_lock AIL_mem_free_lock -#define FILE_error AIL_file_error -#define FILE_size AIL_file_size -#define FILE_read AIL_file_read -#define FILE_write AIL_file_write +#define MEM_free_lock AIL_mem_free_lock +#define FILE_error AIL_file_error +#define FILE_size AIL_file_size +#define FILE_read AIL_file_read +#define FILE_write AIL_file_write #ifdef IS_DOS -#define MEM_alloc AIL_mem_alloc -#define MEM_free AIL_mem_free -#define MEM_use_malloc AIL_mem_use_malloc -#define MEM_use_free AIL_mem_use_free -#define MEM_alloc_DOS AIL_mem_alloc_DOS -#define MEM_free_DOS AIL_mem_free_DOS -#define VMM_lock_range AIL_vmm_lock_range +#define MEM_alloc AIL_mem_alloc +#define MEM_free AIL_mem_free +#define MEM_use_malloc AIL_mem_use_malloc +#define MEM_use_free AIL_mem_use_free +#define MEM_alloc_DOS AIL_mem_alloc_DOS +#define MEM_free_DOS AIL_mem_free_DOS +#define VMM_lock_range AIL_vmm_lock_range #define VMM_unlock_range AIL_vmm_unlock_range -#define VMM_lock AIL_vmm_lock -#define VMM_unlock AIL_vmm_unlock +#define VMM_lock AIL_vmm_lock +#define VMM_unlock AIL_vmm_unlock #endif #endif -extern S32 AILCALLBACK DP_ASI_DECODER_callback(U32 user, - void FAR *dest, - S32 bytes_requested, - S32 offset); +extern S32 AILCALLBACK DP_ASI_DECODER_callback(U32 user, + void FAR *dest, + S32 bytes_requested, + S32 offset); -DXDEC void FAR * AILCALL AIL_mem_alloc_lock(U32 size); -DXDEC void AILCALL AIL_mem_free_lock (void FAR *ptr); +DXDEC void FAR * AILCALL AIL_mem_alloc_lock(U32 size); +DXDEC void AILCALL AIL_mem_free_lock (void FAR *ptr); -DXDEC S32 AILCALL AIL_file_error (void); +DXDEC S32 AILCALL AIL_file_error (void); -DXDEC S32 AILCALL AIL_file_size (char const FAR *filename); +DXDEC S32 AILCALL AIL_file_size (char const FAR *filename); -DXDEC void FAR * AILCALL AIL_file_read (char const FAR *filename, - void FAR *dest); +DXDEC void FAR * AILCALL AIL_file_read (char const FAR *filename, + void FAR *dest); -DXDEC S32 AILCALL AIL_file_write (char const FAR *filename, - void const FAR *buf, - U32 len); +DXDEC S32 AILCALL AIL_file_write (char const FAR *filename, + void const FAR *buf, + U32 len); -DXDEC S32 AILCALL AIL_WAV_file_write - (char const FAR *filename, - void const FAR *buf, - U32 len, - S32 rate, - S32 format); +DXDEC S32 AILCALL AIL_WAV_file_write + (char const FAR *filename, + void const FAR *buf, + U32 len, + S32 rate, + S32 format); -DXDEC S32 AILCALL AIL_file_append (char const FAR *filename, - void const FAR *buf, U32 len); +DXDEC S32 AILCALL AIL_file_append (char const FAR *filename, + void const FAR *buf, U32 len); #ifdef IS_MAC -DXDEC S32 AILCALL AIL_file_fss_size(FSSpec const FAR *filename); +DXDEC S32 AILCALL AIL_file_fss_size(FSSpec const FAR *filename); -DXDEC void FAR * AILCALL AIL_file_fss_read(FSSpec const FAR *filename, - void FAR *dest); +DXDEC void FAR * AILCALL AIL_file_fss_read(FSSpec const FAR *filename, + void FAR *dest); -DXDEC S32 AILCALL AIL_file_fss_write(FSSpec const FAR *filename, - void const FAR *buf, - U32 len); +DXDEC S32 AILCALL AIL_file_fss_write(FSSpec const FAR *filename, + void const FAR *buf, + U32 len); -DXDEC S32 AILCALL AIL_file_fss_attrib_write - (FSSpec const FAR *filename, - void const FAR *buf, - U32 len, - U32 type, - U32 creator ); +DXDEC S32 AILCALL AIL_file_fss_attrib_write + (FSSpec const FAR *filename, + void const FAR *buf, + U32 len, + U32 type, + U32 creator ); -DXDEC S32 AILCALL AIL_WAV_file_fss_write - (FSSpec const FAR *filename, - void const FAR *buf, - U32 len, - S32 rate, - S32 format); +DXDEC S32 AILCALL AIL_WAV_file_fss_write + (FSSpec const FAR *filename, + void const FAR *buf, + U32 len, + S32 rate, + S32 format); DXDEC void * AILCALL AIL_mem_use_malloc(void * AILCALLBACK (*fn)(U32)); -DXDEC void * AILCALL AIL_mem_use_free (void AILCALLBACK (*fn)(void *)); +DXDEC void * AILCALL AIL_mem_use_free (void AILCALLBACK (*fn)(void *)); #endif #ifdef IS_DOS extern void * AILCALLBACK (*AIL_mem_alloc) (U32); -extern void AILCALLBACK (*AIL_mem_free) (void *); +extern void AILCALLBACK (*AIL_mem_free) (void *); void * cdecl AIL_mem_use_malloc(void * AILCALLBACK (*fn)(U32)); -void * cdecl AIL_mem_use_free (void AILCALLBACK (*fn)(void *)); +void * cdecl AIL_mem_use_free (void AILCALLBACK (*fn)(void *)); // // Other memory-management functions // -DXDEC S32 AILCALL AIL_mem_alloc_DOS (U32 n_paras, - void **protected_ptr, - U32 *segment_far_ptr, - U32 *selector); +DXDEC S32 AILCALL AIL_mem_alloc_DOS (U32 n_paras, + void **protected_ptr, + U32 *segment_far_ptr, + U32 *selector); -DXDEC void AILCALL AIL_mem_free_DOS (void *protected_ptr, - U32 segment_far_ptr, - U32 selector); +DXDEC void AILCALL AIL_mem_free_DOS (void *protected_ptr, + U32 segment_far_ptr, + U32 selector); -DXDEC S32 AILCALL AIL_vmm_lock_range (void *p1, void *p2); -DXDEC S32 AILCALL AIL_vmm_unlock_range (void *p1, void *p2); +DXDEC S32 AILCALL AIL_vmm_lock_range (void *p1, void *p2); +DXDEC S32 AILCALL AIL_vmm_unlock_range (void *p1, void *p2); -DXDEC S32 AILCALL AIL_vmm_lock (void *start, U32 size); -DXDEC S32 AILCALL AIL_vmm_unlock (void *start, U32 size); +DXDEC S32 AILCALL AIL_vmm_lock (void *start, U32 size); +DXDEC S32 AILCALL AIL_vmm_unlock (void *start, U32 size); -DXDEC U32 AILCALL AIL_sel_base (U32 sel); +DXDEC U32 AILCALL AIL_sel_base (U32 sel); -DXDEC void AILCALL AIL_sel_set_limit (U32 sel, - U32 limit); +DXDEC void AILCALL AIL_sel_set_limit (U32 sel, + U32 limit); // // Last IO_PARMS structure used to attempt device detection // -extern IO_PARMS AIL_last_IO_attempt; +extern IO_PARMS AIL_last_IO_attempt; // // Low-level support services // -DXDEC REALFAR AILCALL AIL_get_real_vect (U32 vectnum); +DXDEC REALFAR AILCALL AIL_get_real_vect (U32 vectnum); -DXDEC void AILCALL AIL_set_real_vect (U32 vectnum, - REALFAR real_ptr); +DXDEC void AILCALL AIL_set_real_vect (U32 vectnum, + REALFAR real_ptr); -DXDEC void AILCALL AIL_set_USE16_ISR (S32 IRQ, - REALFAR real_base, - U32 ISR_offset); +DXDEC void AILCALL AIL_set_USE16_ISR (S32 IRQ, + REALFAR real_base, + U32 ISR_offset); -DXDEC void AILCALL AIL_restore_USE16_ISR (S32 IRQ); +DXDEC void AILCALL AIL_restore_USE16_ISR (S32 IRQ); -DXDEC U32 AILCALL AIL_disable_interrupts (void); -DXDEC void AILCALL AIL_restore_interrupts (U32 FD_register); +DXDEC U32 AILCALL AIL_disable_interrupts (void); +DXDEC void AILCALL AIL_restore_interrupts (U32 FD_register); -DXDEC void AILCALL AIL_switch_stack (void *stack, - U32 size, - U32 *SS, - void **ESP, - void **EBP); +DXDEC void AILCALL AIL_switch_stack (void *stack, + U32 size, + U32 *SS, + void **ESP, + void **EBP); -DXDEC void AILCALL AIL_restore_stack (U32 SS, - void *ESP, - void *EBP); +DXDEC void AILCALL AIL_restore_stack (U32 SS, + void *ESP, + void *EBP); -DXDEC S32 AILCALL AIL_call_driver (AIL_DRIVER *drvr, - S32 fn, - VDI_CALL *in, - VDI_CALL *out); +DXDEC S32 AILCALL AIL_call_driver (AIL_DRIVER *drvr, + S32 fn, + VDI_CALL *in, + VDI_CALL *out); -DXDEC S32 AILCALL AIL_read_INI (AIL_INI *INI, - char *filename); +DXDEC S32 AILCALL AIL_read_INI (AIL_INI *INI, + char *filename); -DXDEC U32 AILCALL AIL_interrupt_divisor (void); +DXDEC U32 AILCALL AIL_interrupt_divisor (void); #endif @@ -2875,10 +2875,10 @@ void MSSBreakPoint(); #ifdef IS_MAC #if !defined(max) -#define max(a,b) (((a) > (b)) ? (a) : (b)) +#define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #if !defined(min) -#define min(a,b) (((a) < (b)) ? (a) : (b)) +#define min(a,b) (((a) < (b)) ? (a) : (b)) #endif #endif @@ -2888,19 +2888,19 @@ void MSSBreakPoint(); #ifdef IS_WATCOM #if !defined(max) // Watcom stdlib.h doesn't define these for C++ -#define max(a,b) (((a) > (b)) ? (a) : (b)) +#define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #if !defined(min) -#define min(a,b) (((a) < (b)) ? (a) : (b)) +#define min(a,b) (((a) < (b)) ? (a) : (b)) #endif #endif #ifdef __SW_3R -extern S32 AILCALL AIL_startup_reg (void); +extern S32 AILCALL AIL_startup_reg (void); #define AIL_startup AIL_startup_reg #else -extern S32 AILCALL AIL_startup_stack (void); +extern S32 AILCALL AIL_startup_stack (void); #define AIL_startup AIL_startup_stack #endif @@ -2910,77 +2910,77 @@ extern S32 AILCALL AIL_startup_stack (void); #else -DXDEC S32 AILCALL AIL_startup (void); +DXDEC S32 AILCALL AIL_startup (void); -DXDEC S32 AILCALL AIL_get_preference (U32 number); +DXDEC S32 AILCALL AIL_get_preference (U32 number); #endif -DXDEC void AILCALL AIL_shutdown (void); +DXDEC void AILCALL AIL_shutdown (void); -DXDEC S32 AILCALL AIL_set_preference (U32 number, - S32 value); +DXDEC S32 AILCALL AIL_set_preference (U32 number, + S32 value); -DXDEC char FAR *AILCALL AIL_last_error (void); +DXDEC char FAR *AILCALL AIL_last_error (void); -DXDEC void AILCALL AIL_set_error (char const FAR * error_msg); +DXDEC void AILCALL AIL_set_error (char const FAR * error_msg); // // Low-level support services // -DXDEC void +DXDEC void #ifndef IS_MAC __cdecl #endif -AIL_debug_printf (C8 const FAR *fmt, ...); +AIL_debug_printf (C8 const FAR *fmt, ...); #ifdef IS_X86 -DXDEC U32 AILCALL AIL_MMX_available (void); +DXDEC U32 AILCALL AIL_MMX_available (void); #endif -DXDEC void AILCALL AIL_lock (void); -DXDEC void AILCALL AIL_unlock (void); +DXDEC void AILCALL AIL_lock (void); +DXDEC void AILCALL AIL_unlock (void); #ifdef IS_WIN32 -DXDEC void AILCALL AIL_lock_mutex (void); -DXDEC void AILCALL AIL_unlock_mutex (void); +DXDEC void AILCALL AIL_lock_mutex (void); +DXDEC void AILCALL AIL_unlock_mutex (void); #endif -DXDEC void AILCALL AIL_delay (S32 intervals); +DXDEC void AILCALL AIL_delay (S32 intervals); -DXDEC S32 AILCALL AIL_background (void); +DXDEC S32 AILCALL AIL_background (void); // // Process services // -DXDEC HTIMER AILCALL AIL_register_timer (AILTIMERCB fn); +DXDEC HTIMER AILCALL AIL_register_timer (AILTIMERCB fn); -DXDEC U32 AILCALL AIL_set_timer_user (HTIMER timer, - U32 user); +DXDEC U32 AILCALL AIL_set_timer_user (HTIMER timer, + U32 user); -DXDEC void AILCALL AIL_set_timer_period (HTIMER timer, - U32 microseconds); +DXDEC void AILCALL AIL_set_timer_period (HTIMER timer, + U32 microseconds); -DXDEC void AILCALL AIL_set_timer_frequency (HTIMER timer, - U32 hertz); +DXDEC void AILCALL AIL_set_timer_frequency (HTIMER timer, + U32 hertz); -DXDEC void AILCALL AIL_set_timer_divisor (HTIMER timer, - U32 PIT_divisor); +DXDEC void AILCALL AIL_set_timer_divisor (HTIMER timer, + U32 PIT_divisor); -DXDEC void AILCALL AIL_start_timer (HTIMER timer); -DXDEC void AILCALL AIL_start_all_timers (void); +DXDEC void AILCALL AIL_start_timer (HTIMER timer); +DXDEC void AILCALL AIL_start_all_timers (void); -DXDEC void AILCALL AIL_stop_timer (HTIMER timer); -DXDEC void AILCALL AIL_stop_all_timers (void); +DXDEC void AILCALL AIL_stop_timer (HTIMER timer); +DXDEC void AILCALL AIL_stop_all_timers (void); -DXDEC void AILCALL AIL_release_timer_handle (HTIMER timer); -DXDEC void AILCALL AIL_release_all_timers (void); +DXDEC void AILCALL AIL_release_timer_handle (HTIMER timer); +DXDEC void AILCALL AIL_release_all_timers (void); #ifdef IS_WIN32 @@ -2997,12 +2997,12 @@ int __cdecl MSS_auto_cleanup(void); #endif -DXDEC HWND AILCALL AIL_HWND (void); +DXDEC HWND AILCALL AIL_HWND (void); #else - #ifdef IS_MAC - DXDEC ProcessSerialNumber AIL_Process(void); - #endif + #ifdef IS_MAC + DXDEC ProcessSerialNumber AIL_Process(void); + #endif #endif // @@ -3010,9 +3010,9 @@ DXDEC HWND AILCALL AIL_HWND (void); // DXDEC HDIGDRIVER AILCALL AIL_open_digital_driver( U32 frequency, - S32 bits, - S32 channel, - U32 flags ); + S32 bits, + S32 channel, + U32 flags ); #define AIL_OPEN_DIGITAL_FORCE_PREFERENCE 1 @@ -3020,28 +3020,28 @@ DXDEC void AILCALL AIL_close_digital_driver( HDIGDRIVER dig ); #ifdef IS_WINDOWS -#define AIL_MSS_version(str,len) \ -{ \ - HINSTANCE l=LoadLibrary(MSSDLLNAME); \ - if ((U32)l<=32) \ - *(str)=0; \ - else { \ - LoadString(l,1,str,len); \ - FreeLibrary(l); \ - } \ +#define AIL_MSS_version(str,len) \ +{ \ + HINSTANCE l=LoadLibrary(MSSDLLNAME); \ + if ((U32)l<=32) \ + *(str)=0; \ + else { \ + LoadString(l,1,str,len); \ + FreeLibrary(l); \ + } \ } -DXDEC S32 AILCALL AIL_waveOutOpen (HDIGDRIVER FAR *drvr, - LPHWAVEOUT FAR *lphWaveOut, - S32 wDeviceID, - LPWAVEFORMAT lpFormat); +DXDEC S32 AILCALL AIL_waveOutOpen (HDIGDRIVER FAR *drvr, + LPHWAVEOUT FAR *lphWaveOut, + S32 wDeviceID, + LPWAVEFORMAT lpFormat); -DXDEC void AILCALL AIL_waveOutClose (HDIGDRIVER drvr); +DXDEC void AILCALL AIL_waveOutClose (HDIGDRIVER drvr); -DXDEC S32 AILCALL AIL_digital_handle_release(HDIGDRIVER drvr); +DXDEC S32 AILCALL AIL_digital_handle_release(HDIGDRIVER drvr); -DXDEC S32 AILCALL AIL_digital_handle_reacquire - (HDIGDRIVER drvr); +DXDEC S32 AILCALL AIL_digital_handle_reacquire + (HDIGDRIVER drvr); #else @@ -3049,61 +3049,61 @@ DXDEC S32 AILCALL AIL_digital_handle_reacquire typedef struct MSS_VersionType_ { - Str255 version_name; + Str255 version_name; } MSS_VersionType; -#define AIL_MSS_version(str,len) \ -{ \ - long _res = OpenResFile("\pMiles Shared Library"); \ - if (_res==-1) \ - { \ - str[0]=0; \ - } \ - else \ - { \ - Handle _H; \ - short _Err; \ - long _cur= CurResFile(); \ - UseResFile(_res); \ - _H = GetResource('vers', 2); \ - _Err = ResError(); \ - if((_Err != noErr) || (_H==0)) \ - { \ - str[0]=0; \ - UseResFile(_cur); \ - CloseResFile(_res); \ - } \ - else \ - { \ - if (GetHandleSize(_H)==0) \ - { \ - str[0]=0; \ - UseResFile(_cur); \ - CloseResFile(_res); \ - } \ - else \ - { \ - MSS_VersionType * _vt = (MSS_VersionType*)*_H; \ - if ((U32)_vt->version_name[6]>4) \ - _vt->version_name[6]-=4; \ - else \ - _vt->version_name[6]=0; \ - if (((U32)len) <= ((U32)_vt->version_name[6])) \ - _vt->version_name[6] = (U8)len-1; \ - memcpy( str, _vt->version_name+11, _vt->version_name[6] ); \ - str[_vt->version_name[6]]=0; \ - UseResFile(_cur); \ - CloseResFile(_res); \ - } \ - ReleaseResource(_H); \ - } \ - } \ +#define AIL_MSS_version(str,len) \ +{ \ + long _res = OpenResFile("\pMiles Shared Library"); \ + if (_res==-1) \ + { \ + str[0]=0; \ + } \ + else \ + { \ + Handle _H; \ + short _Err; \ + long _cur= CurResFile(); \ + UseResFile(_res); \ + _H = GetResource('vers', 2); \ + _Err = ResError(); \ + if((_Err != noErr) || (_H==0)) \ + { \ + str[0]=0; \ + UseResFile(_cur); \ + CloseResFile(_res); \ + } \ + else \ + { \ + if (GetHandleSize(_H)==0) \ + { \ + str[0]=0; \ + UseResFile(_cur); \ + CloseResFile(_res); \ + } \ + else \ + { \ + MSS_VersionType * _vt = (MSS_VersionType*)*_H; \ + if ((U32)_vt->version_name[6]>4) \ + _vt->version_name[6]-=4; \ + else \ + _vt->version_name[6]=0; \ + if (((U32)len) <= ((U32)_vt->version_name[6])) \ + _vt->version_name[6] = (U8)len-1; \ + memcpy( str, _vt->version_name+11, _vt->version_name[6] ); \ + str[_vt->version_name[6]]=0; \ + UseResFile(_cur); \ + CloseResFile(_res); \ + } \ + ReleaseResource(_H); \ + } \ + } \ } -DXDEC S32 AILCALL AIL_digital_handle_release(HDIGDRIVER drvr); +DXDEC S32 AILCALL AIL_digital_handle_release(HDIGDRIVER drvr); -DXDEC S32 AILCALL AIL_digital_handle_reacquire - (HDIGDRIVER drvr); +DXDEC S32 AILCALL AIL_digital_handle_reacquire + (HDIGDRIVER drvr); #else @@ -3111,207 +3111,207 @@ DXDEC S32 AILCALL AIL_digital_handle_reacquire // DOS installation services // -DXDEC IO_PARMS * AILCALL AIL_get_IO_environment (AIL_DRIVER *drvr); +DXDEC IO_PARMS * AILCALL AIL_get_IO_environment (AIL_DRIVER *drvr); -DXDEC AIL_DRIVER* AILCALL AIL_install_driver (U8 const *driver_image, - U32 n_bytes); +DXDEC AIL_DRIVER* AILCALL AIL_install_driver (U8 const *driver_image, + U32 n_bytes); -DXDEC void AILCALL AIL_uninstall_driver (AIL_DRIVER *drvr); +DXDEC void AILCALL AIL_uninstall_driver (AIL_DRIVER *drvr); -DXDEC S32 AILCALL AIL_install_DIG_INI (HDIGDRIVER *dig); +DXDEC S32 AILCALL AIL_install_DIG_INI (HDIGDRIVER *dig); -DXDEC HDIGDRIVER AILCALL AIL_install_DIG_driver_file - (char const *filename, - IO_PARMS *IO); +DXDEC HDIGDRIVER AILCALL AIL_install_DIG_driver_file + (char const *filename, + IO_PARMS *IO); -DXDEC void AILCALL AIL_uninstall_DIG_driver (HDIGDRIVER dig); +DXDEC void AILCALL AIL_uninstall_DIG_driver (HDIGDRIVER dig); -DXDEC HDIGDRIVER AILCALL AIL_install_DIG_driver_image - (void const *driver_image, - U32 size, - IO_PARMS *IO); +DXDEC HDIGDRIVER AILCALL AIL_install_DIG_driver_image + (void const *driver_image, + U32 size, + IO_PARMS *IO); #endif #endif -DXDEC char FAR* AILCALL AIL_set_redist_directory(char const FAR*dir); +DXDEC char FAR* AILCALL AIL_set_redist_directory(char const FAR*dir); -DXDEC S32 AILCALL AIL_digital_CPU_percent (HDIGDRIVER dig); +DXDEC S32 AILCALL AIL_digital_CPU_percent (HDIGDRIVER dig); -DXDEC S32 AILCALL AIL_digital_latency (HDIGDRIVER dig); +DXDEC S32 AILCALL AIL_digital_latency (HDIGDRIVER dig); -DXDEC HSAMPLE AILCALL AIL_allocate_sample_handle - (HDIGDRIVER dig); +DXDEC HSAMPLE AILCALL AIL_allocate_sample_handle + (HDIGDRIVER dig); -DXDEC HSAMPLE AILCALL AIL_allocate_file_sample (HDIGDRIVER dig, - void const FAR *file_image, - S32 block); +DXDEC HSAMPLE AILCALL AIL_allocate_file_sample (HDIGDRIVER dig, + void const FAR *file_image, + S32 block); -DXDEC void AILCALL AIL_release_sample_handle (HSAMPLE S); +DXDEC void AILCALL AIL_release_sample_handle (HSAMPLE S); -DXDEC void AILCALL AIL_init_sample (HSAMPLE S); +DXDEC void AILCALL AIL_init_sample (HSAMPLE S); -DXDEC S32 AILCALL AIL_set_sample_file (HSAMPLE S, - void const FAR *file_image, - S32 block); +DXDEC S32 AILCALL AIL_set_sample_file (HSAMPLE S, + void const FAR *file_image, + S32 block); -DXDEC S32 AILCALL AIL_set_named_sample_file (HSAMPLE S, - C8 const FAR *file_type_suffix, - void const FAR *file_image, - S32 file_size, - S32 block); +DXDEC S32 AILCALL AIL_set_named_sample_file (HSAMPLE S, + C8 const FAR *file_type_suffix, + void const FAR *file_image, + S32 file_size, + S32 block); -DXDEC HPROVIDER AILCALL AIL_set_sample_processor (HSAMPLE S, - SAMPLESTAGE pipeline_stage, - HPROVIDER provider); +DXDEC HPROVIDER AILCALL AIL_set_sample_processor (HSAMPLE S, + SAMPLESTAGE pipeline_stage, + HPROVIDER provider); -DXDEC HPROVIDER AILCALL AIL_set_digital_driver_processor - (HDIGDRIVER dig, - DIGDRVSTAGE pipeline_stage, - HPROVIDER provider); +DXDEC HPROVIDER AILCALL AIL_set_digital_driver_processor + (HDIGDRIVER dig, + DIGDRVSTAGE pipeline_stage, + HPROVIDER provider); -DXDEC void AILCALL AIL_set_sample_adpcm_block_size - (HSAMPLE S, - U32 blocksize); +DXDEC void AILCALL AIL_set_sample_adpcm_block_size + (HSAMPLE S, + U32 blocksize); -DXDEC void AILCALL AIL_set_sample_address (HSAMPLE S, - void const FAR *start, - U32 len); +DXDEC void AILCALL AIL_set_sample_address (HSAMPLE S, + void const FAR *start, + U32 len); -DXDEC void AILCALL AIL_set_sample_type (HSAMPLE S, - S32 format, - U32 flags); +DXDEC void AILCALL AIL_set_sample_type (HSAMPLE S, + S32 format, + U32 flags); -DXDEC void AILCALL AIL_start_sample (HSAMPLE S); +DXDEC void AILCALL AIL_start_sample (HSAMPLE S); -DXDEC void AILCALL AIL_stop_sample (HSAMPLE S); +DXDEC void AILCALL AIL_stop_sample (HSAMPLE S); -DXDEC void AILCALL AIL_resume_sample (HSAMPLE S); +DXDEC void AILCALL AIL_resume_sample (HSAMPLE S); -DXDEC void AILCALL AIL_end_sample (HSAMPLE S); +DXDEC void AILCALL AIL_end_sample (HSAMPLE S); -DXDEC void AILCALL AIL_set_sample_playback_rate - (HSAMPLE S, - S32 playback_rate); +DXDEC void AILCALL AIL_set_sample_playback_rate + (HSAMPLE S, + S32 playback_rate); -DXDEC void AILCALL AIL_set_sample_volume (HSAMPLE S, - S32 volume); +DXDEC void AILCALL AIL_set_sample_volume (HSAMPLE S, + S32 volume); -DXDEC void AILCALL AIL_set_sample_pan (HSAMPLE S, - S32 pan); +DXDEC void AILCALL AIL_set_sample_pan (HSAMPLE S, + S32 pan); -DXDEC void AILCALL AIL_set_sample_loop_count (HSAMPLE S, - S32 loop_count); +DXDEC void AILCALL AIL_set_sample_loop_count (HSAMPLE S, + S32 loop_count); -DXDEC void AILCALL AIL_set_sample_loop_block (HSAMPLE S, - S32 loop_start_offset, - S32 loop_end_offset); +DXDEC void AILCALL AIL_set_sample_loop_block (HSAMPLE S, + S32 loop_start_offset, + S32 loop_end_offset); -DXDEC U32 AILCALL AIL_sample_status (HSAMPLE S); +DXDEC U32 AILCALL AIL_sample_status (HSAMPLE S); -DXDEC S32 AILCALL AIL_sample_playback_rate (HSAMPLE S); +DXDEC S32 AILCALL AIL_sample_playback_rate (HSAMPLE S); -DXDEC S32 AILCALL AIL_sample_volume (HSAMPLE S); +DXDEC S32 AILCALL AIL_sample_volume (HSAMPLE S); -DXDEC S32 AILCALL AIL_sample_pan (HSAMPLE S); +DXDEC S32 AILCALL AIL_sample_pan (HSAMPLE S); -DXDEC S32 AILCALL AIL_sample_loop_count (HSAMPLE S); +DXDEC S32 AILCALL AIL_sample_loop_count (HSAMPLE S); -DXDEC void AILCALL AIL_set_digital_master_volume - (HDIGDRIVER dig, - S32 master_volume); +DXDEC void AILCALL AIL_set_digital_master_volume + (HDIGDRIVER dig, + S32 master_volume); -DXDEC S32 AILCALL AIL_digital_master_volume (HDIGDRIVER dig); +DXDEC S32 AILCALL AIL_digital_master_volume (HDIGDRIVER dig); -DXDEC void AILCALL AIL_set_sample_reverb(HSAMPLE S, - F32 reverb_level, - F32 reverb_reflect_time, - F32 reverb_decay_time); +DXDEC void AILCALL AIL_set_sample_reverb(HSAMPLE S, + F32 reverb_level, + F32 reverb_reflect_time, + F32 reverb_decay_time); -DXDEC void AILCALL AIL_sample_reverb (HSAMPLE S, - F32 FAR *reverb_level, - F32 FAR *reverb_reflect_time, - F32 FAR *reverb_decay_time); +DXDEC void AILCALL AIL_sample_reverb (HSAMPLE S, + F32 FAR *reverb_level, + F32 FAR *reverb_reflect_time, + F32 FAR *reverb_decay_time); // // low-level digital services // -DXDEC S32 AILCALL AIL_minimum_sample_buffer_size(HDIGDRIVER dig, - S32 playback_rate, - S32 format); +DXDEC S32 AILCALL AIL_minimum_sample_buffer_size(HDIGDRIVER dig, + S32 playback_rate, + S32 format); -DXDEC S32 AILCALL AIL_sample_buffer_ready (HSAMPLE S); +DXDEC S32 AILCALL AIL_sample_buffer_ready (HSAMPLE S); -DXDEC void AILCALL AIL_load_sample_buffer (HSAMPLE S, - U32 buff_num, - void const FAR *buffer, - U32 len); +DXDEC void AILCALL AIL_load_sample_buffer (HSAMPLE S, + U32 buff_num, + void const FAR *buffer, + U32 len); -DXDEC void AILCALL AIL_request_EOB_ASI_reset (HSAMPLE S, - U32 buff_num); +DXDEC void AILCALL AIL_request_EOB_ASI_reset (HSAMPLE S, + U32 buff_num); -DXDEC S32 AILCALL AIL_sample_buffer_info (HSAMPLE S, //) - U32 FAR *pos0, - U32 FAR *len0, - U32 FAR *pos1, - U32 FAR *len1); +DXDEC S32 AILCALL AIL_sample_buffer_info (HSAMPLE S, //) + U32 FAR *pos0, + U32 FAR *len0, + U32 FAR *pos1, + U32 FAR *len1); -DXDEC U32 AILCALL AIL_sample_granularity (HSAMPLE S); +DXDEC U32 AILCALL AIL_sample_granularity (HSAMPLE S); -DXDEC void AILCALL AIL_set_sample_position (HSAMPLE S, - U32 pos); +DXDEC void AILCALL AIL_set_sample_position (HSAMPLE S, + U32 pos); -DXDEC U32 AILCALL AIL_sample_position (HSAMPLE S); +DXDEC U32 AILCALL AIL_sample_position (HSAMPLE S); -DXDEC AILSAMPLECB AILCALL AIL_register_SOB_callback - (HSAMPLE S, - AILSAMPLECB SOB); +DXDEC AILSAMPLECB AILCALL AIL_register_SOB_callback + (HSAMPLE S, + AILSAMPLECB SOB); -DXDEC AILSAMPLECB AILCALL AIL_register_EOB_callback - (HSAMPLE S, - AILSAMPLECB EOB); +DXDEC AILSAMPLECB AILCALL AIL_register_EOB_callback + (HSAMPLE S, + AILSAMPLECB EOB); -DXDEC AILSAMPLECB AILCALL AIL_register_EOS_callback - (HSAMPLE S, - AILSAMPLECB EOS); +DXDEC AILSAMPLECB AILCALL AIL_register_EOS_callback + (HSAMPLE S, + AILSAMPLECB EOS); -DXDEC AILSAMPLECB AILCALL AIL_register_EOF_callback - (HSAMPLE S, - AILSAMPLECB EOFILE); +DXDEC AILSAMPLECB AILCALL AIL_register_EOF_callback + (HSAMPLE S, + AILSAMPLECB EOFILE); -DXDEC void AILCALL AIL_set_sample_user_data (HSAMPLE S, - U32 index, - S32 value); +DXDEC void AILCALL AIL_set_sample_user_data (HSAMPLE S, + U32 index, + S32 value); -DXDEC S32 AILCALL AIL_sample_user_data (HSAMPLE S, - U32 index); +DXDEC S32 AILCALL AIL_sample_user_data (HSAMPLE S, + U32 index); -DXDEC S32 AILCALL AIL_active_sample_count (HDIGDRIVER dig); +DXDEC S32 AILCALL AIL_active_sample_count (HDIGDRIVER dig); -DXDEC void AILCALL AIL_digital_configuration (HDIGDRIVER dig, - S32 FAR *rate, - S32 FAR *format, - char FAR *string); +DXDEC void AILCALL AIL_digital_configuration (HDIGDRIVER dig, + S32 FAR *rate, + S32 FAR *format, + char FAR *string); #ifdef IS_WIN32 -DXDEC S32 AILCALL AIL_set_direct_buffer_control (HSAMPLE S, - U32 command); +DXDEC S32 AILCALL AIL_set_direct_buffer_control (HSAMPLE S, + U32 command); -DXDEC void AILCALL AIL_get_DirectSound_info (HSAMPLE S, - AILLPDIRECTSOUND *lplpDS, - AILLPDIRECTSOUNDBUFFER *lplpDSB); +DXDEC void AILCALL AIL_get_DirectSound_info (HSAMPLE S, + AILLPDIRECTSOUND *lplpDS, + AILLPDIRECTSOUNDBUFFER *lplpDSB); -DXDEC S32 AILCALL AIL_set_DirectSound_HWND(HDIGDRIVER dig, HWND wnd); +DXDEC S32 AILCALL AIL_set_DirectSound_HWND(HDIGDRIVER dig, HWND wnd); #endif -DXDEC void AILCALL AIL_set_sample_ms_position (HSAMPLE S, //) - S32 milliseconds); +DXDEC void AILCALL AIL_set_sample_ms_position (HSAMPLE S, //) + S32 milliseconds); -DXDEC void AILCALL AIL_sample_ms_position (HSAMPLE S, //) - S32 FAR * total_milliseconds, - S32 FAR * current_milliseconds); +DXDEC void AILCALL AIL_sample_ms_position (HSAMPLE S, //) + S32 FAR * total_milliseconds, + S32 FAR * current_milliseconds); // @@ -3320,15 +3320,15 @@ DXDEC void AILCALL AIL_sample_ms_position (HSAMPLE S, //) #if defined(IS_WINDOWS) || defined (IS_MAC) -DXDEC HDIGINPUT AILCALL AIL_open_input (AIL_INPUT_INFO FAR *info); +DXDEC HDIGINPUT AILCALL AIL_open_input (AIL_INPUT_INFO FAR *info); -DXDEC void AILCALL AIL_close_input (HDIGINPUT dig); +DXDEC void AILCALL AIL_close_input (HDIGINPUT dig); DXDEC AIL_INPUT_INFO FAR * - AILCALL AIL_get_input_info (HDIGINPUT dig); + AILCALL AIL_get_input_info (HDIGINPUT dig); -DXDEC S32 AILCALL AIL_set_input_state (HDIGINPUT dig, - S32 enable); +DXDEC S32 AILCALL AIL_set_input_state (HDIGINPUT dig, + S32 enable); #endif @@ -3344,65 +3344,65 @@ DXDEC void AILCALL AIL_close_XMIDI_driver( HMDIDRIVER mdi ); #ifdef IS_MAC -DXDEC S32 AILCALL AIL_MIDI_handle_release - (HMDIDRIVER mdi); +DXDEC S32 AILCALL AIL_MIDI_handle_release + (HMDIDRIVER mdi); -DXDEC S32 AILCALL AIL_MIDI_handle_reacquire - (HMDIDRIVER mdi); +DXDEC S32 AILCALL AIL_MIDI_handle_reacquire + (HMDIDRIVER mdi); #else #ifdef IS_WINDOWS -DXDEC S32 AILCALL AIL_midiOutOpen(HMDIDRIVER FAR *drvr, - LPHMIDIOUT FAR *lphMidiOut, - S32 dwDeviceID); +DXDEC S32 AILCALL AIL_midiOutOpen(HMDIDRIVER FAR *drvr, + LPHMIDIOUT FAR *lphMidiOut, + S32 dwDeviceID); -DXDEC void AILCALL AIL_midiOutClose (HMDIDRIVER mdi); +DXDEC void AILCALL AIL_midiOutClose (HMDIDRIVER mdi); -DXDEC S32 AILCALL AIL_MIDI_handle_release - (HMDIDRIVER mdi); +DXDEC S32 AILCALL AIL_MIDI_handle_release + (HMDIDRIVER mdi); -DXDEC S32 AILCALL AIL_MIDI_handle_reacquire - (HMDIDRIVER mdi); +DXDEC S32 AILCALL AIL_MIDI_handle_reacquire + (HMDIDRIVER mdi); #else #ifdef IS_DOS -DXDEC S32 AILCALL AIL_install_MDI_INI (HMDIDRIVER *mdi); +DXDEC S32 AILCALL AIL_install_MDI_INI (HMDIDRIVER *mdi); -DXDEC HMDIDRIVER AILCALL AIL_install_MDI_driver_file - (char const *filename, - IO_PARMS *IO); +DXDEC HMDIDRIVER AILCALL AIL_install_MDI_driver_file + (char const *filename, + IO_PARMS *IO); -DXDEC void AILCALL AIL_uninstall_MDI_driver (HMDIDRIVER mdi); +DXDEC void AILCALL AIL_uninstall_MDI_driver (HMDIDRIVER mdi); -DXDEC HMDIDRIVER AILCALL AIL_install_MDI_driver_image - (void const *driver_image, - U32 size, - IO_PARMS *IO); +DXDEC HMDIDRIVER AILCALL AIL_install_MDI_driver_image + (void const *driver_image, + U32 size, + IO_PARMS *IO); -DXDEC S32 AILCALL AIL_MDI_driver_type (HMDIDRIVER mdi); +DXDEC S32 AILCALL AIL_MDI_driver_type (HMDIDRIVER mdi); -DXDEC void AILCALL AIL_set_GTL_filename_prefix (char const*prefix); +DXDEC void AILCALL AIL_set_GTL_filename_prefix (char const*prefix); -DXDEC S32 AILCALL AIL_timbre_status (HMDIDRIVER mdi, - S32 bank, - S32 patch); +DXDEC S32 AILCALL AIL_timbre_status (HMDIDRIVER mdi, + S32 bank, + S32 patch); -DXDEC S32 AILCALL AIL_install_timbre (HMDIDRIVER mdi, - S32 bank, - S32 patch); +DXDEC S32 AILCALL AIL_install_timbre (HMDIDRIVER mdi, + S32 bank, + S32 patch); -DXDEC void AILCALL AIL_protect_timbre (HMDIDRIVER mdi, - S32 bank, - S32 patch); +DXDEC void AILCALL AIL_protect_timbre (HMDIDRIVER mdi, + S32 bank, + S32 patch); -DXDEC void AILCALL AIL_unprotect_timbre (HMDIDRIVER mdi, - S32 bank, - S32 patch); +DXDEC void AILCALL AIL_unprotect_timbre (HMDIDRIVER mdi, + S32 bank, + S32 patch); #endif @@ -3410,139 +3410,139 @@ DXDEC void AILCALL AIL_unprotect_timbre (HMDIDRIVER mdi, #endif -DXDEC HSEQUENCE AILCALL AIL_allocate_sequence_handle - (HMDIDRIVER mdi); +DXDEC HSEQUENCE AILCALL AIL_allocate_sequence_handle + (HMDIDRIVER mdi); -DXDEC void AILCALL AIL_release_sequence_handle - (HSEQUENCE S); +DXDEC void AILCALL AIL_release_sequence_handle + (HSEQUENCE S); -DXDEC S32 AILCALL AIL_init_sequence (HSEQUENCE S, - void const FAR *start, - S32 sequence_num); +DXDEC S32 AILCALL AIL_init_sequence (HSEQUENCE S, + void const FAR *start, + S32 sequence_num); -DXDEC void AILCALL AIL_start_sequence (HSEQUENCE S); +DXDEC void AILCALL AIL_start_sequence (HSEQUENCE S); -DXDEC void AILCALL AIL_stop_sequence (HSEQUENCE S); +DXDEC void AILCALL AIL_stop_sequence (HSEQUENCE S); -DXDEC void AILCALL AIL_resume_sequence (HSEQUENCE S); +DXDEC void AILCALL AIL_resume_sequence (HSEQUENCE S); -DXDEC void AILCALL AIL_end_sequence (HSEQUENCE S); +DXDEC void AILCALL AIL_end_sequence (HSEQUENCE S); -DXDEC void AILCALL AIL_set_sequence_tempo (HSEQUENCE S, - S32 tempo, - S32 milliseconds); +DXDEC void AILCALL AIL_set_sequence_tempo (HSEQUENCE S, + S32 tempo, + S32 milliseconds); -DXDEC void AILCALL AIL_set_sequence_volume (HSEQUENCE S, - S32 volume, - S32 milliseconds); +DXDEC void AILCALL AIL_set_sequence_volume (HSEQUENCE S, + S32 volume, + S32 milliseconds); -DXDEC void AILCALL AIL_set_sequence_loop_count - (HSEQUENCE S, - S32 loop_count); +DXDEC void AILCALL AIL_set_sequence_loop_count + (HSEQUENCE S, + S32 loop_count); -DXDEC U32 AILCALL AIL_sequence_status (HSEQUENCE S); +DXDEC U32 AILCALL AIL_sequence_status (HSEQUENCE S); -DXDEC S32 AILCALL AIL_sequence_tempo (HSEQUENCE S); +DXDEC S32 AILCALL AIL_sequence_tempo (HSEQUENCE S); -DXDEC S32 AILCALL AIL_sequence_volume (HSEQUENCE S); +DXDEC S32 AILCALL AIL_sequence_volume (HSEQUENCE S); -DXDEC S32 AILCALL AIL_sequence_loop_count (HSEQUENCE S); +DXDEC S32 AILCALL AIL_sequence_loop_count (HSEQUENCE S); -DXDEC void AILCALL AIL_set_XMIDI_master_volume - (HMDIDRIVER mdi, - S32 master_volume); +DXDEC void AILCALL AIL_set_XMIDI_master_volume + (HMDIDRIVER mdi, + S32 master_volume); -DXDEC S32 AILCALL AIL_XMIDI_master_volume (HMDIDRIVER mdi); +DXDEC S32 AILCALL AIL_XMIDI_master_volume (HMDIDRIVER mdi); // // Low-level XMIDI services // -DXDEC S32 AILCALL AIL_active_sequence_count (HMDIDRIVER mdi); +DXDEC S32 AILCALL AIL_active_sequence_count (HMDIDRIVER mdi); -DXDEC S32 AILCALL AIL_controller_value (HSEQUENCE S, - S32 channel, - S32 controller_num); +DXDEC S32 AILCALL AIL_controller_value (HSEQUENCE S, + S32 channel, + S32 controller_num); -DXDEC S32 AILCALL AIL_channel_notes (HSEQUENCE S, - S32 channel); +DXDEC S32 AILCALL AIL_channel_notes (HSEQUENCE S, + S32 channel); -DXDEC void AILCALL AIL_sequence_position (HSEQUENCE S, - S32 FAR *beat, - S32 FAR *measure); +DXDEC void AILCALL AIL_sequence_position (HSEQUENCE S, + S32 FAR *beat, + S32 FAR *measure); -DXDEC void AILCALL AIL_branch_index (HSEQUENCE S, - U32 marker); +DXDEC void AILCALL AIL_branch_index (HSEQUENCE S, + U32 marker); -DXDEC AILPREFIXCB AILCALL AIL_register_prefix_callback - (HSEQUENCE S, - AILPREFIXCB callback); +DXDEC AILPREFIXCB AILCALL AIL_register_prefix_callback + (HSEQUENCE S, + AILPREFIXCB callback); -DXDEC AILTRIGGERCB AILCALL AIL_register_trigger_callback - (HSEQUENCE S, - AILTRIGGERCB callback); +DXDEC AILTRIGGERCB AILCALL AIL_register_trigger_callback + (HSEQUENCE S, + AILTRIGGERCB callback); -DXDEC AILSEQUENCECB AILCALL AIL_register_sequence_callback - (HSEQUENCE S, - AILSEQUENCECB callback); +DXDEC AILSEQUENCECB AILCALL AIL_register_sequence_callback + (HSEQUENCE S, + AILSEQUENCECB callback); -DXDEC AILBEATCB AILCALL AIL_register_beat_callback (HSEQUENCE S, - AILBEATCB callback); +DXDEC AILBEATCB AILCALL AIL_register_beat_callback (HSEQUENCE S, + AILBEATCB callback); -DXDEC AILEVENTCB AILCALL AIL_register_event_callback (HMDIDRIVER mdi, - AILEVENTCB callback); +DXDEC AILEVENTCB AILCALL AIL_register_event_callback (HMDIDRIVER mdi, + AILEVENTCB callback); -DXDEC AILTIMBRECB AILCALL AIL_register_timbre_callback - (HMDIDRIVER mdi, - AILTIMBRECB callback); +DXDEC AILTIMBRECB AILCALL AIL_register_timbre_callback + (HMDIDRIVER mdi, + AILTIMBRECB callback); -DXDEC void AILCALL AIL_set_sequence_user_data (HSEQUENCE S, - U32 index, - S32 value); +DXDEC void AILCALL AIL_set_sequence_user_data (HSEQUENCE S, + U32 index, + S32 value); -DXDEC S32 AILCALL AIL_sequence_user_data (HSEQUENCE S, - U32 index); +DXDEC S32 AILCALL AIL_sequence_user_data (HSEQUENCE S, + U32 index); -DXDEC void AILCALL AIL_register_ICA_array (HSEQUENCE S, - U8 FAR *array); +DXDEC void AILCALL AIL_register_ICA_array (HSEQUENCE S, + U8 FAR *array); -DXDEC S32 AILCALL AIL_lock_channel (HMDIDRIVER mdi); +DXDEC S32 AILCALL AIL_lock_channel (HMDIDRIVER mdi); -DXDEC void AILCALL AIL_release_channel (HMDIDRIVER mdi, - S32 channel); +DXDEC void AILCALL AIL_release_channel (HMDIDRIVER mdi, + S32 channel); -DXDEC void AILCALL AIL_map_sequence_channel (HSEQUENCE S, - S32 seq_channel, - S32 new_channel); +DXDEC void AILCALL AIL_map_sequence_channel (HSEQUENCE S, + S32 seq_channel, + S32 new_channel); -DXDEC S32 AILCALL AIL_true_sequence_channel (HSEQUENCE S, - S32 seq_channel); +DXDEC S32 AILCALL AIL_true_sequence_channel (HSEQUENCE S, + S32 seq_channel); -DXDEC void AILCALL AIL_send_channel_voice_message - (HMDIDRIVER mdi, - HSEQUENCE S, - S32 status, - S32 data_1, - S32 data_2); +DXDEC void AILCALL AIL_send_channel_voice_message + (HMDIDRIVER mdi, + HSEQUENCE S, + S32 status, + S32 data_1, + S32 data_2); -DXDEC void AILCALL AIL_send_sysex_message (HMDIDRIVER mdi, - void const FAR *buffer); +DXDEC void AILCALL AIL_send_sysex_message (HMDIDRIVER mdi, + void const FAR *buffer); -DXDEC HWAVESYNTH - AILCALL AIL_create_wave_synthesizer (HDIGDRIVER dig, - HMDIDRIVER mdi, - void const FAR *wave_lib, - S32 polyphony); +DXDEC HWAVESYNTH + AILCALL AIL_create_wave_synthesizer (HDIGDRIVER dig, + HMDIDRIVER mdi, + void const FAR *wave_lib, + S32 polyphony); -DXDEC void AILCALL AIL_destroy_wave_synthesizer (HWAVESYNTH W); +DXDEC void AILCALL AIL_destroy_wave_synthesizer (HWAVESYNTH W); -DXDEC void AILCALL AIL_set_sequence_ms_position (HSEQUENCE S, //) - S32 milliseconds); +DXDEC void AILCALL AIL_set_sequence_ms_position (HSEQUENCE S, //) + S32 milliseconds); -DXDEC void AILCALL AIL_sequence_ms_position(HSEQUENCE S, //) - S32 FAR *total_milliseconds, - S32 FAR *current_milliseconds); +DXDEC void AILCALL AIL_sequence_ms_position(HSEQUENCE S, //) + S32 FAR *total_milliseconds, + S32 FAR *current_milliseconds); @@ -3552,178 +3552,178 @@ DXDEC void AILCALL AIL_sequence_ms_position(HSEQUENCE S, //) #ifdef IS_DOS typedef struct _REDBOOKTRACKINFO { - U32 tracks; - U32 trackstarts[100]; + U32 tracks; + U32 trackstarts[100]; } REDBOOKTRACKINFO; #endif typedef struct _REDBOOK { - U32 DeviceID; - U32 paused; - U32 pausedsec; - U32 lastendsec; + U32 DeviceID; + U32 paused; + U32 pausedsec; + U32 lastendsec; #ifdef IS_DOS - U32 readcontents; - REDBOOKTRACKINFO info; + U32 readcontents; + REDBOOKTRACKINFO info; #endif #ifdef IS_MAC - short vDRefNum; + short vDRefNum; #endif } REDBOOK; typedef struct _REDBOOK FAR* HREDBOOK; -#define REDBOOK_ERROR 0 -#define REDBOOK_PLAYING 1 -#define REDBOOK_PAUSED 2 -#define REDBOOK_STOPPED 3 +#define REDBOOK_ERROR 0 +#define REDBOOK_PLAYING 1 +#define REDBOOK_PAUSED 2 +#define REDBOOK_STOPPED 3 -DXDEC HREDBOOK AILCALL AIL_redbook_open(U32 which); +DXDEC HREDBOOK AILCALL AIL_redbook_open(U32 which); #ifdef IS_MAC -DXDEC HREDBOOK AILCALL AIL_redbook_open_volume(char const * drive); +DXDEC HREDBOOK AILCALL AIL_redbook_open_volume(char const * drive); #else -DXDEC HREDBOOK AILCALL AIL_redbook_open_drive(S32 drive); +DXDEC HREDBOOK AILCALL AIL_redbook_open_drive(S32 drive); #endif -DXDEC void AILCALL AIL_redbook_close(HREDBOOK hand); +DXDEC void AILCALL AIL_redbook_close(HREDBOOK hand); -DXDEC void AILCALL AIL_redbook_eject(HREDBOOK hand); +DXDEC void AILCALL AIL_redbook_eject(HREDBOOK hand); -DXDEC void AILCALL AIL_redbook_retract(HREDBOOK hand); +DXDEC void AILCALL AIL_redbook_retract(HREDBOOK hand); -DXDEC U32 AILCALL AIL_redbook_status(HREDBOOK hand); +DXDEC U32 AILCALL AIL_redbook_status(HREDBOOK hand); -DXDEC U32 AILCALL AIL_redbook_tracks(HREDBOOK hand); +DXDEC U32 AILCALL AIL_redbook_tracks(HREDBOOK hand); -DXDEC U32 AILCALL AIL_redbook_track(HREDBOOK hand); +DXDEC U32 AILCALL AIL_redbook_track(HREDBOOK hand); -DXDEC void AILCALL AIL_redbook_track_info(HREDBOOK hand,U32 tracknum, - U32 FAR* startmsec,U32 FAR* endmsec); +DXDEC void AILCALL AIL_redbook_track_info(HREDBOOK hand,U32 tracknum, + U32 FAR* startmsec,U32 FAR* endmsec); -DXDEC U32 AILCALL AIL_redbook_id(HREDBOOK hand); +DXDEC U32 AILCALL AIL_redbook_id(HREDBOOK hand); -DXDEC U32 AILCALL AIL_redbook_position(HREDBOOK hand); +DXDEC U32 AILCALL AIL_redbook_position(HREDBOOK hand); -DXDEC U32 AILCALL AIL_redbook_play(HREDBOOK hand,U32 startmsec, U32 endmsec); +DXDEC U32 AILCALL AIL_redbook_play(HREDBOOK hand,U32 startmsec, U32 endmsec); -DXDEC U32 AILCALL AIL_redbook_stop(HREDBOOK hand); +DXDEC U32 AILCALL AIL_redbook_stop(HREDBOOK hand); -DXDEC U32 AILCALL AIL_redbook_pause(HREDBOOK hand); +DXDEC U32 AILCALL AIL_redbook_pause(HREDBOOK hand); -DXDEC U32 AILCALL AIL_redbook_resume(HREDBOOK hand); +DXDEC U32 AILCALL AIL_redbook_resume(HREDBOOK hand); -DXDEC S32 AILCALL AIL_redbook_volume(HREDBOOK hand); +DXDEC S32 AILCALL AIL_redbook_volume(HREDBOOK hand); -DXDEC S32 AILCALL AIL_redbook_set_volume(HREDBOOK hand, S32 volume); +DXDEC S32 AILCALL AIL_redbook_set_volume(HREDBOOK hand, S32 volume); #ifdef IS_WIN16 - #define AIL_ms_count timeGetTime - DXDEC U32 AILCALL AIL_us_count(void); + #define AIL_ms_count timeGetTime + DXDEC U32 AILCALL AIL_us_count(void); #else - DXDEC U32 AILCALL AIL_ms_count(void); - DXDEC U32 AILCALL AIL_us_count(void); + DXDEC U32 AILCALL AIL_ms_count(void); + DXDEC U32 AILCALL AIL_us_count(void); #endif -typedef struct _STREAM FAR* HSTREAM; // Handle to stream +typedef struct _STREAM FAR* HSTREAM; // Handle to stream -typedef void (AILCALLBACK FAR* AILSTREAMCB) (HSTREAM stream); +typedef void (AILCALLBACK FAR* AILSTREAMCB) (HSTREAM stream); typedef struct _STREAM { - S32 block_oriented; // 1 if this is an ADPCM or ASI-compressed stream - S32 using_ASI; // 1 if using ASI decoder to uncompress stream data - ASISTAGE FAR *ASI; // handy pointer to our ASI coded + S32 block_oriented; // 1 if this is an ADPCM or ASI-compressed stream + S32 using_ASI; // 1 if using ASI decoder to uncompress stream data + ASISTAGE FAR *ASI; // handy pointer to our ASI coded - HSAMPLE samp; // the sample handle + HSAMPLE samp; // the sample handle - U32 fileh; // the open file handle + U32 fileh; // the open file handle - U8 FAR* bufs[3]; // the data buffers - U32 bufsizes[3]; // the size of each buffer - S32 reset_ASI[3]; // should we reset the ASI at the end of the buffer? - S32 bufstart[3]; // offset of where this buffer started - void FAR* asyncs[3];// async read structures + U8 FAR* bufs[3]; // the data buffers + U32 bufsizes[3]; // the size of each buffer + S32 reset_ASI[3]; // should we reset the ASI at the end of the buffer? + S32 bufstart[3]; // offset of where this buffer started + void FAR* asyncs[3];// async read structures - S32 loadedbufstart[2]; // offset of where the loaded buffer started - S32 loadedorder[2]; // order of the buffers as they were loaded - S32 loadorder; // incremented as each buffer is loaded + S32 loadedbufstart[2]; // offset of where the loaded buffer started + S32 loadedorder[2]; // order of the buffers as they were loaded + S32 loadorder; // incremented as each buffer is loaded - S32 bufsize; // size of each buffer - S32 readsize; // size of each read block + S32 bufsize; // size of each buffer + S32 readsize; // size of each read block - U32 buf1; // 0,1,2 (current buffer that we are reading into) - S32 size1; // holds the current amount of data read + U32 buf1; // 0,1,2 (current buffer that we are reading into) + S32 size1; // holds the current amount of data read - U32 buf2; // 0,1,2 (the next buffer that we are reading into) - S32 size2; // next buffer loaded up to + U32 buf2; // 0,1,2 (the next buffer that we are reading into) + S32 size2; // next buffer loaded up to - U32 buf3; // 0,1,2 (the next buffer that we are reading into) - S32 size3; // next buffer loaded up to + U32 buf3; // 0,1,2 (the next buffer that we are reading into) + S32 size3; // next buffer loaded up to - U32 datarate; // datarate in bytes per second - S32 filerate; // original datarate of the file - S32 filetype; // file format type - U32 fileflags; // file format flags (signed or unsigned) - S32 totallen; // total length of the sound data + U32 datarate; // datarate in bytes per second + S32 filerate; // original datarate of the file + S32 filetype; // file format type + U32 fileflags; // file format flags (signed or unsigned) + S32 totallen; // total length of the sound data - S32 substart; // subblock loop start - S32 sublen; // subblock loop len - S32 subpadding; // amount to pad the final block + S32 substart; // subblock loop start + S32 sublen; // subblock loop len + S32 subpadding; // amount to pad the final block - U32 blocksize; // ADPCM block size - S32 padding; // padding to be done - S32 padded; // padding done + U32 blocksize; // ADPCM block size + S32 padding; // padding to be done + S32 padded; // padding done - S32 loadedsome; // have we done any loads? + S32 loadedsome; // have we done any loads? - U32 startpos; // point that the sound data begins - U32 totalread; // total bytes read from the disk + U32 startpos; // point that the sound data begins + U32 totalread; // total bytes read from the disk - U32 loopsleft; // how many loops are left + U32 loopsleft; // how many loops are left - U32 error; // read error has occurred + U32 error; // read error has occurred - S32 preload; // preload the file into the first buffer - U32 preloadpos; // position to use in preload - S32 noback; // no background processing - S32 alldone; // alldone - S32 primeamount; // amount to load after a seek - S32 readatleast; // forced amount to read on next service + S32 preload; // preload the file into the first buffer + U32 preloadpos; // position to use in preload + S32 noback; // no background processing + S32 alldone; // alldone + S32 primeamount; // amount to load after a seek + S32 readatleast; // forced amount to read on next service - S32 playcontrol; // control: 0=stopped, 1=started, |8=paused, |16=sample paused + S32 playcontrol; // control: 0=stopped, 1=started, |8=paused, |16=sample paused - AILSTREAMCB callback; // end of stream callback + AILSTREAMCB callback; // end of stream callback - S32 user_data[8]; // Miscellaneous user data - void FAR* next; // pointer to next stream + S32 user_data[8]; // Miscellaneous user data + void FAR* next; // pointer to next stream #if defined(IS_WINDOWS) || defined(IS_MAC) - S32 autostreaming; // are we autostreaming this stream + S32 autostreaming; // are we autostreaming this stream #endif #ifdef IS_WINDOWS - S32 cb_IsWin32s; // Is the callback win32s? + S32 cb_IsWin32s; // Is the callback win32s? #endif - S32 docallback; // set when it time to poll for a callback + S32 docallback; // set when it time to poll for a callback #ifdef IS_MAC - IOParam stream_param; - S32 donext; - S32 donext1; - U32 fillup; - U32 session; - U32 tamt; - U32 buf; - S32* size; - S32* done; - S32 done1; - S32 done2; - S32 done3; - Boolean force_quit; + IOParam stream_param; + S32 donext; + S32 donext1; + U32 fillup; + U32 session; + U32 tamt; + U32 buf; + S32* size; + S32* done; + S32 done1; + S32 done2; + S32 done3; + Boolean force_quit; #endif } MSTREAM_TYPE; @@ -3756,8 +3756,8 @@ DXDEC S32 AILCALL AIL_stream_loop_count(HSTREAM stream); DXDEC void AILCALL AIL_set_stream_loop_count(HSTREAM stream, S32 count); DXDEC void AILCALL AIL_set_stream_loop_block (HSTREAM S, - S32 loop_start_offset, - S32 loop_end_offset); + S32 loop_start_offset, + S32 loop_end_offset); DXDEC S32 AILCALL AIL_stream_status(HSTREAM stream); @@ -3771,81 +3771,81 @@ DXDEC AILSTREAMCB AILCALL AIL_register_stream_callback(HSTREAM stream, AILSTREAM DXDEC void AILCALL AIL_auto_service_stream(HSTREAM stream, S32 onoff); -DXDEC void AILCALL AIL_set_stream_user_data (HSTREAM S, - U32 index, - S32 value); +DXDEC void AILCALL AIL_set_stream_user_data (HSTREAM S, + U32 index, + S32 value); -DXDEC S32 AILCALL AIL_stream_user_data (HSTREAM S, - U32 index); +DXDEC S32 AILCALL AIL_stream_user_data (HSTREAM S, + U32 index); -DXDEC void AILCALL AIL_set_stream_ms_position (HSTREAM S, - S32 milliseconds); +DXDEC void AILCALL AIL_set_stream_ms_position (HSTREAM S, + S32 milliseconds); -DXDEC void AILCALL AIL_stream_ms_position (HSTREAM S, //) - S32 FAR * total_milliseconds, - S32 FAR * current_milliseconds); +DXDEC void AILCALL AIL_stream_ms_position (HSTREAM S, //) + S32 FAR * total_milliseconds, + S32 FAR * current_milliseconds); -DXDEC void AILCALL AIL_set_stream_reverb(HSTREAM S, - F32 reverb_level, - F32 reverb_reflect_time, - F32 reverb_decay_time); +DXDEC void AILCALL AIL_set_stream_reverb(HSTREAM S, + F32 reverb_level, + F32 reverb_reflect_time, + F32 reverb_decay_time); -DXDEC void AILCALL AIL_stream_reverb (HSTREAM S, - F32 FAR *reverb_level, - F32 FAR *reverb_reflect_time, - F32 FAR *reverb_decay_time); +DXDEC void AILCALL AIL_stream_reverb (HSTREAM S, + F32 FAR *reverb_level, + F32 FAR *reverb_reflect_time, + F32 FAR *reverb_decay_time); -DXDEC HPROVIDER AILCALL AIL_set_stream_processor (HSTREAM S, - SAMPLESTAGE pipeline_stage, - HPROVIDER provider); +DXDEC HPROVIDER AILCALL AIL_set_stream_processor (HSTREAM S, + SAMPLESTAGE pipeline_stage, + HPROVIDER provider); #ifdef IS_MAC typedef struct MSS_FILE { - S32 file_type; // 0 = char*, 1 = FSSpec* - void const FAR* file; + S32 file_type; // 0 = char*, 1 = FSSpec* + void const FAR* file; } MSS_FILE; #else typedef char MSS_FILE; #endif -typedef U32 (AILCALLBACK FAR*AIL_file_open_callback) (MSS_FILE const FAR* Filename, - U32 FAR* FileHandle); +typedef U32 (AILCALLBACK FAR*AIL_file_open_callback) (MSS_FILE const FAR* Filename, + U32 FAR* FileHandle); typedef void (AILCALLBACK FAR*AIL_file_close_callback) (U32 FileHandle); -#define AIL_FILE_SEEK_BEGIN 0 +#define AIL_FILE_SEEK_BEGIN 0 #define AIL_FILE_SEEK_CURRENT 1 -#define AIL_FILE_SEEK_END 2 +#define AIL_FILE_SEEK_END 2 -typedef S32 (AILCALLBACK FAR*AIL_file_seek_callback) (U32 FileHandle, - S32 Offset, - U32 Type); +typedef S32 (AILCALLBACK FAR*AIL_file_seek_callback) (U32 FileHandle, + S32 Offset, + U32 Type); -typedef U32 (AILCALLBACK FAR*AIL_file_read_callback) (U32 FileHandle, - void FAR* Buffer, - U32 Bytes); +typedef U32 (AILCALLBACK FAR*AIL_file_read_callback) (U32 FileHandle, + void FAR* Buffer, + U32 Bytes); -DXDEC void AILCALL AIL_set_file_callbacks (AIL_file_open_callback opencb, - AIL_file_close_callback closecb, - AIL_file_seek_callback seekcb, - AIL_file_read_callback readcb); +DXDEC void AILCALL AIL_set_file_callbacks (AIL_file_open_callback opencb, + AIL_file_close_callback closecb, + AIL_file_seek_callback seekcb, + AIL_file_read_callback readcb); #ifdef IS_32 typedef void FAR* (AILCALLBACK FAR*AIL_file_async_read_callback) (U32 FileHandle, - void FAR* Buffer, - U32 Bytes); + void FAR* Buffer, + U32 Bytes); -typedef S32 (AILCALLBACK FAR*AIL_file_async_status_callback) (void FAR* async, - S32 wait, - U32 FAR* BytesRead); +typedef S32 (AILCALLBACK FAR*AIL_file_async_status_callback) (void FAR* async, + S32 wait, + U32 FAR* BytesRead); -DXDEC void AILCALL AIL_set_file_async_callbacks (AIL_file_open_callback opencb, - AIL_file_close_callback closecb, - AIL_file_seek_callback seekcb, - AIL_file_async_read_callback areadcb, - AIL_file_async_status_callback statuscb); +DXDEC void AILCALL AIL_set_file_async_callbacks (AIL_file_open_callback opencb, + AIL_file_close_callback closecb, + AIL_file_seek_callback seekcb, + AIL_file_async_read_callback areadcb, + AIL_file_async_status_callback statuscb); #endif @@ -3854,122 +3854,122 @@ DXDEC void AILCALL AIL_set_file_async_callbacks (AIL_file_open_callback opencb // typedef struct _DLSFILEID { - S32 id; - struct _DLSFILEID FAR* next; + S32 id; + struct _DLSFILEID FAR* next; } DLSFILEID; typedef struct _DLSFILEID FAR* HDLSFILEID; typedef struct _DLSDEVICE { - void FAR* pGetPref; - void FAR* pSetPref; - void FAR* pMSSOpen; - void FAR* pOpen; - void FAR* pClose; - void FAR* pLoadFile; - void FAR* pLoadMem; - void FAR* pUnloadFile; - void FAR* pUnloadAll; - void FAR* pGetInfo; - void FAR* pCompact; - void FAR* pSetAttr; - S32 DLSHandle; - U32 format; - U32 buffer_size; - void FAR* buffer[2]; - HSAMPLE sample; - HMDIDRIVER mdi; - HDIGDRIVER dig; - HDLSFILEID first; + void FAR* pGetPref; + void FAR* pSetPref; + void FAR* pMSSOpen; + void FAR* pOpen; + void FAR* pClose; + void FAR* pLoadFile; + void FAR* pLoadMem; + void FAR* pUnloadFile; + void FAR* pUnloadAll; + void FAR* pGetInfo; + void FAR* pCompact; + void FAR* pSetAttr; + S32 DLSHandle; + U32 format; + U32 buffer_size; + void FAR* buffer[2]; + HSAMPLE sample; + HMDIDRIVER mdi; + HDIGDRIVER dig; + HDLSFILEID first; #ifdef IS_WINDOWS - HMODULE lib; + HMODULE lib; #else - #ifdef IS_DOS - char FAR* DOSname; - #endif + #ifdef IS_DOS + char FAR* DOSname; + #endif #endif } DLSDEVICE; typedef struct _DLSDEVICE FAR* HDLSDEVICE; typedef struct _AILDLSINFO { - char Description[128]; - S32 MaxDLSMemory; - S32 CurrentDLSMemory; - S32 LargestSize; - S32 GMAvailable; - S32 GMBankSize; + char Description[128]; + S32 MaxDLSMemory; + S32 CurrentDLSMemory; + S32 LargestSize; + S32 GMAvailable; + S32 GMBankSize; } AILDLSINFO; #ifdef IS_DOS typedef struct _AILDOSDLS { - char FAR* description; - void FAR* pDLSOpen; - void FAR* pMSSOpen; - void FAR* pOpen; - void FAR* pClose; - void FAR* pLoadFile; - void FAR* pLoadMem; - void FAR* pUnloadFile; - void FAR* pUnloadAll; - void FAR* pGetInfo; - void FAR* pCompact; - void FAR* pSetAttr; + char FAR* description; + void FAR* pDLSOpen; + void FAR* pMSSOpen; + void FAR* pOpen; + void FAR* pClose; + void FAR* pLoadFile; + void FAR* pLoadMem; + void FAR* pUnloadFile; + void FAR* pUnloadAll; + void FAR* pGetInfo; + void FAR* pCompact; + void FAR* pSetAttr; } AILDOSDLS; #endif -DXDEC HDLSDEVICE AILCALL AIL_DLS_open(HMDIDRIVER mdi, HDIGDRIVER dig, +DXDEC HDLSDEVICE AILCALL AIL_DLS_open(HMDIDRIVER mdi, HDIGDRIVER dig, #if defined(IS_WINDOWS) || defined(IS_MAC) - char const FAR * libname, + char const FAR * libname, #else - AILDOSDLS const FAR * dosdls, + AILDOSDLS const FAR * dosdls, #endif - U32 flags, U32 rate, S32 bits, S32 channels); + U32 flags, U32 rate, S32 bits, S32 channels); // // Parameters for the dwFlag used in DLSClose() and flags in AIL_DLS_close // -#define RETAIN_DLS_COLLECTION 0x00000001 -#define RETURN_TO_BOOTUP_STATE 0x00000002 +#define RETAIN_DLS_COLLECTION 0x00000001 +#define RETURN_TO_BOOTUP_STATE 0x00000002 #define RETURN_TO_GM_ONLY_STATE 0x00000004 -#define DLS_COMPACT_MEMORY 0x00000008 +#define DLS_COMPACT_MEMORY 0x00000008 -DXDEC void AILCALL AIL_DLS_close(HDLSDEVICE dls, U32 flags); +DXDEC void AILCALL AIL_DLS_close(HDLSDEVICE dls, U32 flags); -DXDEC HDLSFILEID AILCALL AIL_DLS_load_file(HDLSDEVICE dls, char const FAR* filename, U32 flags); +DXDEC HDLSFILEID AILCALL AIL_DLS_load_file(HDLSDEVICE dls, char const FAR* filename, U32 flags); -DXDEC HDLSFILEID AILCALL AIL_DLS_load_memory(HDLSDEVICE dls, void const FAR* memfile, U32 flags); +DXDEC HDLSFILEID AILCALL AIL_DLS_load_memory(HDLSDEVICE dls, void const FAR* memfile, U32 flags); // // other parameters for AIL_DLS_unload // #define AIL_DLS_UNLOAD_MINE 0 -#define AIL_DLS_UNLOAD_ALL ((HDLSFILEID)(U32)(S32)-1) +#define AIL_DLS_UNLOAD_ALL ((HDLSFILEID)(U32)(S32)-1) -DXDEC void AILCALL AIL_DLS_unload(HDLSDEVICE dls, HDLSFILEID dlsid); +DXDEC void AILCALL AIL_DLS_unload(HDLSDEVICE dls, HDLSFILEID dlsid); -DXDEC void AILCALL AIL_DLS_compact(HDLSDEVICE dls); +DXDEC void AILCALL AIL_DLS_compact(HDLSDEVICE dls); -DXDEC void AILCALL AIL_DLS_get_info(HDLSDEVICE dls, AILDLSINFO FAR* info, S32 FAR* PercentCPU); +DXDEC void AILCALL AIL_DLS_get_info(HDLSDEVICE dls, AILDLSINFO FAR* info, S32 FAR* PercentCPU); -DXDEC void AILCALL AIL_DLS_set_reverb(HDLSDEVICE dls, - F32 reverb_level, - F32 reverb_reflect_time, - F32 reverb_decay_time); +DXDEC void AILCALL AIL_DLS_set_reverb(HDLSDEVICE dls, + F32 reverb_level, + F32 reverb_reflect_time, + F32 reverb_decay_time); -DXDEC void AILCALL AIL_DLS_get_reverb(HDLSDEVICE dls, - F32 FAR* reverb_level, - F32 FAR* reverb_reflect_time, - F32 FAR* reverb_decay_time); +DXDEC void AILCALL AIL_DLS_get_reverb(HDLSDEVICE dls, + F32 FAR* reverb_level, + F32 FAR* reverb_reflect_time, + F32 FAR* reverb_decay_time); -DXDEC HPROVIDER AILCALL AIL_set_DLS_processor (HDLSDEVICE dev, - SAMPLESTAGE pipeline_stage, - HPROVIDER provider); +DXDEC HPROVIDER AILCALL AIL_set_DLS_processor (HDLSDEVICE dev, + SAMPLESTAGE pipeline_stage, + HPROVIDER provider); // @@ -3978,121 +3978,121 @@ DXDEC HPROVIDER AILCALL AIL_set_DLS_processor (HDLSDEVICE dev, typedef struct { - U32 const FAR *data; - S32 size; - S32 type; - void FAR *handle; - S32 status; - void FAR* next; - S32 speed; - S32 volume; - S32 extravol; - F32 rlevel; - F32 rrtime; - F32 rdtime; - HDLSFILEID dlsid; - void FAR* dlsmem; - void FAR* dlsmemunc; - S32 milliseconds; - S32 length; - S32 userdata; + U32 const FAR *data; + S32 size; + S32 type; + void FAR *handle; + S32 status; + void FAR* next; + S32 speed; + S32 volume; + S32 extravol; + F32 rlevel; + F32 rrtime; + F32 rdtime; + HDLSFILEID dlsid; + void FAR* dlsmem; + void FAR* dlsmemunc; + S32 milliseconds; + S32 length; + S32 userdata; } AUDIO_TYPE; -#define QSTAT_DONE 1 // Data has finished playing -#define QSTAT_LOADED 2 // Data has been loaded, but not yet played -#define QSTAT_PLAYING 3 // Data is currently playing +#define QSTAT_DONE 1 // Data has finished playing +#define QSTAT_LOADED 2 // Data has been loaded, but not yet played +#define QSTAT_PLAYING 3 // Data is currently playing -typedef AUDIO_TYPE FAR * HAUDIO; // Generic handle to any audio data type +typedef AUDIO_TYPE FAR * HAUDIO; // Generic handle to any audio data type -#define AIL_QUICK_USE_WAVEOUT 2 -#define AIL_QUICK_MIDI_AND_DLS 2 -#define AIL_QUICK_DLS_ONLY 3 -#define AIL_QUICK_MIDI_AND_VORTEX_DLS 4 +#define AIL_QUICK_USE_WAVEOUT 2 +#define AIL_QUICK_MIDI_AND_DLS 2 +#define AIL_QUICK_DLS_ONLY 3 +#define AIL_QUICK_MIDI_AND_VORTEX_DLS 4 #define AIL_QUICK_MIDI_AND_SONICVIBES_DLS 5 -DXDEC S32 AILCALL +DXDEC S32 AILCALL #if defined(IS_WINDOWS) || defined(IS_MAC) - AIL_quick_startup ( + AIL_quick_startup ( #else - AIL_quick_startup_with_start(void* startup, + AIL_quick_startup_with_start(void* startup, #endif - S32 use_digital, - S32 use_MIDI, - U32 output_rate, - S32 output_bits, - S32 output_channels); + S32 use_digital, + S32 use_MIDI, + U32 output_rate, + S32 output_bits, + S32 output_channels); -DXDEC void AILCALL AIL_quick_shutdown (void); +DXDEC void AILCALL AIL_quick_shutdown (void); -DXDEC void AILCALL AIL_quick_handles (HDIGDRIVER FAR* pdig, - HMDIDRIVER FAR* pmdi, - HDLSDEVICE FAR* pdls ); +DXDEC void AILCALL AIL_quick_handles (HDIGDRIVER FAR* pdig, + HMDIDRIVER FAR* pmdi, + HDLSDEVICE FAR* pdls ); -DXDEC HAUDIO AILCALL AIL_quick_load (char const FAR *filename); +DXDEC HAUDIO AILCALL AIL_quick_load (char const FAR *filename); #ifdef IS_MAC -DXDEC HAUDIO AILCALL AIL_quick_fss_load (FSSpec const FAR *filename); +DXDEC HAUDIO AILCALL AIL_quick_fss_load (FSSpec const FAR *filename); #endif -DXDEC HAUDIO AILCALL AIL_quick_load_mem (void const FAR *mem, - U32 size); +DXDEC HAUDIO AILCALL AIL_quick_load_mem (void const FAR *mem, + U32 size); -DXDEC HAUDIO AILCALL AIL_quick_copy (HAUDIO audio); +DXDEC HAUDIO AILCALL AIL_quick_copy (HAUDIO audio); -DXDEC void AILCALL AIL_quick_unload (HAUDIO audio); +DXDEC void AILCALL AIL_quick_unload (HAUDIO audio); -DXDEC S32 AILCALL AIL_quick_play (HAUDIO audio, - U32 loop_count); +DXDEC S32 AILCALL AIL_quick_play (HAUDIO audio, + U32 loop_count); -DXDEC void AILCALL AIL_quick_halt (HAUDIO audio); +DXDEC void AILCALL AIL_quick_halt (HAUDIO audio); -DXDEC S32 AILCALL AIL_quick_status (HAUDIO audio); +DXDEC S32 AILCALL AIL_quick_status (HAUDIO audio); -DXDEC HAUDIO AILCALL AIL_quick_load_and_play (char const FAR *filename, - U32 loop_count, - S32 wait_request); +DXDEC HAUDIO AILCALL AIL_quick_load_and_play (char const FAR *filename, + U32 loop_count, + S32 wait_request); #ifdef IS_MAC -DXDEC HAUDIO AILCALL AIL_quick_fss_load_and_play (FSSpec const FAR *filename, - U32 loop_count, - S32 wait_request); +DXDEC HAUDIO AILCALL AIL_quick_fss_load_and_play (FSSpec const FAR *filename, + U32 loop_count, + S32 wait_request); #endif -DXDEC void AILCALL AIL_quick_set_speed (HAUDIO audio, S32 speed); +DXDEC void AILCALL AIL_quick_set_speed (HAUDIO audio, S32 speed); -DXDEC void AILCALL AIL_quick_set_volume (HAUDIO audio, S32 volume, S32 extravol); +DXDEC void AILCALL AIL_quick_set_volume (HAUDIO audio, S32 volume, S32 extravol); -DXDEC void AILCALL AIL_quick_set_reverb (HAUDIO audio, - F32 reverb_level, - F32 reverb_reflect_time, - F32 reverb_decay_time); +DXDEC void AILCALL AIL_quick_set_reverb (HAUDIO audio, + F32 reverb_level, + F32 reverb_reflect_time, + F32 reverb_decay_time); -DXDEC void AILCALL AIL_quick_set_ms_position(HAUDIO audio,S32 milliseconds); +DXDEC void AILCALL AIL_quick_set_ms_position(HAUDIO audio,S32 milliseconds); -DXDEC S32 AILCALL AIL_quick_ms_position(HAUDIO audio); +DXDEC S32 AILCALL AIL_quick_ms_position(HAUDIO audio); -DXDEC S32 AILCALL AIL_quick_ms_length(HAUDIO audio); +DXDEC S32 AILCALL AIL_quick_ms_length(HAUDIO audio); -#define AIL_QUICK_XMIDI_TYPE 1 -#define AIL_QUICK_DIGITAL_TYPE 2 -#define AIL_QUICK_DLS_XMIDI_TYPE 3 +#define AIL_QUICK_XMIDI_TYPE 1 +#define AIL_QUICK_DIGITAL_TYPE 2 +#define AIL_QUICK_DLS_XMIDI_TYPE 3 #define AIL_QUICK_MPEG_DIGITAL_TYPE 4 -DXDEC S32 AILCALL AIL_quick_type(HAUDIO audio); +DXDEC S32 AILCALL AIL_quick_type(HAUDIO audio); // // used for AIL_process // typedef struct _AILMIXINFO { - AILSOUNDINFO Info; - ADPCMDATA mss_adpcm; - U32 src_fract; - S32 left_val; - S32 right_val; + AILSOUNDINFO Info; + ADPCMDATA mss_adpcm; + U32 src_fract; + S32 left_val; + S32 right_val; } AILMIXINFO; @@ -4100,107 +4100,107 @@ typedef struct _AILMIXINFO { DXDEC S32 AILCALL AIL_WAV_info(void const FAR* data, AILSOUNDINFO FAR* info); DXDEC S32 AILCALL AIL_size_processed_digital_audio( - U32 dest_rate, - U32 dest_format, - S32 num_srcs, - AILMIXINFO const FAR* src); + U32 dest_rate, + U32 dest_format, + S32 num_srcs, + AILMIXINFO const FAR* src); DXDEC S32 AILCALL AIL_process_digital_audio( - void FAR *dest_buffer, - S32 dest_buffer_size, - U32 dest_rate, - U32 dest_format, - S32 num_srcs, - AILMIXINFO FAR* src); + void FAR *dest_buffer, + S32 dest_buffer_size, + U32 dest_rate, + U32 dest_format, + S32 num_srcs, + AILMIXINFO FAR* src); -#define AIL_LENGTHY_INIT 0 +#define AIL_LENGTHY_INIT 0 #define AIL_LENGTHY_SET_PREFERENCE 1 -#define AIL_LENGTHY_UPDATE 2 -#define AIL_LENGTHY_DONE 3 +#define AIL_LENGTHY_UPDATE 2 +#define AIL_LENGTHY_DONE 3 typedef S32 (AILCALLBACK FAR* AILLENGTHYCB)(U32 state,U32 user); typedef S32 (AILCALLBACK FAR* AILCODECSETPREF)(char const FAR* preference,U32 value); DXDEC S32 AILCALL AIL_compress_ASI(AILSOUNDINFO const FAR * info, //) - char const FAR* filename_ext, - void FAR* FAR* outdata, - U32 FAR* outsize, - AILLENGTHYCB callback); + char const FAR* filename_ext, + void FAR* FAR* outdata, + U32 FAR* outsize, + AILLENGTHYCB callback); DXDEC S32 AILCALL AIL_decompress_ASI(void const FAR* indata, //) - U32 insize, - char const FAR* filename_ext, - void FAR* FAR* wav, - U32 FAR* wavsize, - AILLENGTHYCB callback); + U32 insize, + char const FAR* filename_ext, + void FAR* FAR* wav, + U32 FAR* wavsize, + AILLENGTHYCB callback); DXDEC S32 AILCALL AIL_compress_ADPCM(AILSOUNDINFO const FAR * info, - void FAR* FAR* outdata, U32 FAR* outsize); + void FAR* FAR* outdata, U32 FAR* outsize); DXDEC S32 AILCALL AIL_decompress_ADPCM(AILSOUNDINFO const FAR * info, - void FAR* FAR* outdata, U32 FAR* outsize); + void FAR* FAR* outdata, U32 FAR* outsize); DXDEC S32 AILCALL AIL_compress_DLS(void const FAR* dls, - char const FAR* compression_extension, - void FAR* FAR* mls, U32 FAR* mlssize, - AILLENGTHYCB callback); + char const FAR* compression_extension, + void FAR* FAR* mls, U32 FAR* mlssize, + AILLENGTHYCB callback); DXDEC S32 AILCALL AIL_merge_DLS_with_XMI(void const FAR* xmi, void const FAR* dls, - void FAR* FAR* mss, U32 FAR* msssize); + void FAR* FAR* mss, U32 FAR* msssize); -DXDEC S32 AILCALL AIL_extract_DLS( void const FAR *source_image, //) - U32 source_size, - void FAR * FAR *XMI_output_data, - U32 FAR *XMI_output_size, - void FAR * FAR *DLS_output_data, - U32 FAR *DLS_output_size, - AILLENGTHYCB callback); +DXDEC S32 AILCALL AIL_extract_DLS( void const FAR *source_image, //) + U32 source_size, + void FAR * FAR *XMI_output_data, + U32 FAR *XMI_output_size, + void FAR * FAR *DLS_output_data, + U32 FAR *DLS_output_size, + AILLENGTHYCB callback); #define AILFILTERDLS_USINGLIST 1 DXDEC S32 AILCALL AIL_filter_DLS_with_XMI(void const FAR* xmi, void const FAR* dls, - void FAR* FAR* dlsout, U32 FAR* dlssize, - S32 flags, AILLENGTHYCB callback); + void FAR* FAR* dlsout, U32 FAR* dlssize, + S32 flags, AILLENGTHYCB callback); #define AILMIDITOXMI_USINGLIST 1 -#define AILMIDITOXMI_TOLERANT 2 +#define AILMIDITOXMI_TOLERANT 2 -DXDEC S32 AILCALL AIL_MIDI_to_XMI (void const FAR* MIDI, - U32 MIDI_size, - void FAR* FAR*XMIDI, - U32 FAR* XMIDI_size, - S32 flags); +DXDEC S32 AILCALL AIL_MIDI_to_XMI (void const FAR* MIDI, + U32 MIDI_size, + void FAR* FAR*XMIDI, + U32 FAR* XMIDI_size, + S32 flags); #define AILMIDILIST_ROLANDSYSEX 1 -#define AILMIDILIST_ROLANDUN 2 -#define AILMIDILIST_ROLANDAB 4 +#define AILMIDILIST_ROLANDUN 2 +#define AILMIDILIST_ROLANDAB 4 -DXDEC S32 AILCALL AIL_list_MIDI (void const FAR* MIDI, - U32 MIDI_size, - char FAR* FAR* lst, - U32 FAR* lst_size, - S32 flags); +DXDEC S32 AILCALL AIL_list_MIDI (void const FAR* MIDI, + U32 MIDI_size, + char FAR* FAR* lst, + U32 FAR* lst_size, + S32 flags); #define AILDLSLIST_ARTICULATION 1 -#define AILDLSLIST_DUMP_WAVS 2 +#define AILDLSLIST_DUMP_WAVS 2 -DXDEC S32 AILCALL AIL_list_DLS (void const FAR* DLS, - char FAR* FAR* lst, - U32 FAR* lst_size, - S32 flags, - C8 FAR* title); +DXDEC S32 AILCALL AIL_list_DLS (void const FAR* DLS, + char FAR* FAR* lst, + U32 FAR* lst_size, + S32 flags, + C8 FAR* title); -#define AILFILETYPE_UNKNOWN 0 -#define AILFILETYPE_PCM_WAV 1 -#define AILFILETYPE_ADPCM_WAV 2 -#define AILFILETYPE_OTHER_WAV 3 -#define AILFILETYPE_VOC 4 -#define AILFILETYPE_MIDI 5 -#define AILFILETYPE_XMIDI 6 -#define AILFILETYPE_XMIDI_DLS 7 -#define AILFILETYPE_XMIDI_MLS 8 -#define AILFILETYPE_DLS 9 -#define AILFILETYPE_MLS 10 +#define AILFILETYPE_UNKNOWN 0 +#define AILFILETYPE_PCM_WAV 1 +#define AILFILETYPE_ADPCM_WAV 2 +#define AILFILETYPE_OTHER_WAV 3 +#define AILFILETYPE_VOC 4 +#define AILFILETYPE_MIDI 5 +#define AILFILETYPE_XMIDI 6 +#define AILFILETYPE_XMIDI_DLS 7 +#define AILFILETYPE_XMIDI_MLS 8 +#define AILFILETYPE_DLS 9 +#define AILFILETYPE_MLS 10 #define AILFILETYPE_MPEG_L1_AUDIO 11 #define AILFILETYPE_MPEG_L2_AUDIO 12 #define AILFILETYPE_MPEG_L3_AUDIO 13 @@ -4209,9 +4209,9 @@ DXDEC S32 AILCALL AIL_list_DLS (void const FAR* DLS, DXDEC S32 AILCALL AIL_file_type(void const FAR* data, U32 size); -DXDEC S32 AILCALL AIL_find_DLS (void const FAR* data, U32 size, - void FAR* FAR* xmi, U32 FAR* xmisize, - void FAR* FAR* dls, U32 FAR* dlssize); +DXDEC S32 AILCALL AIL_find_DLS (void const FAR* data, U32 size, + void FAR* FAR* xmi, U32 FAR* xmisize, + void FAR* FAR* dls, U32 FAR* dlssize); #if defined(IS_WIN32) || defined(IS_MAC) @@ -4219,7 +4219,7 @@ DXDEC S32 AILCALL AIL_find_DLS (void const FAR* data, U32 size, // Auxiliary 2D interface calls // -DXDEC HDIGDRIVER AILCALL AIL_primary_digital_driver (HDIGDRIVER new_primary); +DXDEC HDIGDRIVER AILCALL AIL_primary_digital_driver (HDIGDRIVER new_primary); // // Filter result codes @@ -4227,170 +4227,170 @@ DXDEC HDIGDRIVER AILCALL AIL_primary_digital_driver (HDIGDRIVER new_primary); typedef S32 FLTRESULT; -#define FLT_NOERR 0 // Success -- no error -#define FLT_NOT_ENABLED 1 // FLT not enabled -#define FLT_ALREADY_STARTED 2 // FLT already started -#define FLT_INVALID_PARAM 3 // Invalid parameters used -#define FLT_INTERNAL_ERR 4 // Internal error in FLT driver -#define FLT_OUT_OF_MEM 5 // Out of system RAM -#define FLT_ERR_NOT_IMPLEMENTED 6 // Feature not implemented -#define FLT_NOT_FOUND 7 // FLT supported device not found -#define FLT_NOT_INIT 8 // FLT not initialized -#define FLT_CLOSE_ERR 9 // FLT not closed correctly +#define FLT_NOERR 0 // Success -- no error +#define FLT_NOT_ENABLED 1 // FLT not enabled +#define FLT_ALREADY_STARTED 2 // FLT already started +#define FLT_INVALID_PARAM 3 // Invalid parameters used +#define FLT_INTERNAL_ERR 4 // Internal error in FLT driver +#define FLT_OUT_OF_MEM 5 // Out of system RAM +#define FLT_ERR_NOT_IMPLEMENTED 6 // Feature not implemented +#define FLT_NOT_FOUND 7 // FLT supported device not found +#define FLT_NOT_INIT 8 // FLT not initialized +#define FLT_CLOSE_ERR 9 // FLT not closed correctly //############################################################################ -//## ## -//## Interface "MSS pipeline filter" ## -//## ## +//## ## +//## Interface "MSS pipeline filter" ## +//## ## //############################################################################ typedef FLTRESULT (AILCALL FAR *FLT_STARTUP)(void); typedef FLTRESULT (AILCALL FAR *FLT_SHUTDOWN)(void); -typedef C8 FAR * (AILCALL FAR *FLT_ERROR)(void); +typedef C8 FAR * (AILCALL FAR *FLT_ERROR)(void); -typedef S32 (AILCALL FAR *FLT_SET_PROVIDER_PREFERENCE)(HATTRIB preference, - void const FAR* value); +typedef S32 (AILCALL FAR *FLT_SET_PROVIDER_PREFERENCE)(HATTRIB preference, + void const FAR* value); typedef HDRIVERSTATE (AILCALL FAR *FLT_OPEN_DRIVER) (HDIGDRIVER dig, - S32 FAR *build_buffer, - S32 build_buffer_size); + S32 FAR *build_buffer, + S32 build_buffer_size); -typedef FLTRESULT (AILCALL FAR *FLT_CLOSE_DRIVER) (HDRIVERSTATE state); +typedef FLTRESULT (AILCALL FAR *FLT_CLOSE_DRIVER) (HDRIVERSTATE state); -typedef void (AILCALL FAR *FLT_PREMIX_PROCESS) (HDRIVERSTATE driver +typedef void (AILCALL FAR *FLT_PREMIX_PROCESS) (HDRIVERSTATE driver #ifdef IS_MAC - ,U32 buffer_size + ,U32 buffer_size #endif ); -typedef void (AILCALL FAR *FLT_POSTMIX_PROCESS) (HDRIVERSTATE driver +typedef void (AILCALL FAR *FLT_POSTMIX_PROCESS) (HDRIVERSTATE driver #ifdef IS_MAC - ,U32 buffer_size + ,U32 buffer_size #endif ); //############################################################################ -//## ## -//## Interface "Pipeline filter sample services" ## -//## ## +//## ## +//## Interface "Pipeline filter sample services" ## +//## ## //############################################################################ typedef HSAMPLESTATE (AILCALL FAR * FLTSMP_OPEN_SAMPLE) (HDRIVERSTATE driver, - HSAMPLE S); + HSAMPLE S); -typedef FLTRESULT (AILCALL FAR * FLTSMP_CLOSE_SAMPLE) (HSAMPLESTATE state); +typedef FLTRESULT (AILCALL FAR * FLTSMP_CLOSE_SAMPLE) (HSAMPLESTATE state); -typedef S32 (AILCALL FAR * FLTSMP_SAMPLE_PROCESS) (HSAMPLESTATE state, - void const FAR * FAR *orig_src, - U32 FAR * orig_src_fract, - void FAR * orig_src_end, - S32 FAR * FAR *build_dest, - void FAR * build_dest_end, - S32 FAR * left_val, - S32 FAR * right_val, - S32 playback_ratio, - S32 left_scale, - S32 right_scale, - S32 base_scale, - MIXSTAGE FAR * mixer_provider, - U32 mixer_operation); +typedef S32 (AILCALL FAR * FLTSMP_SAMPLE_PROCESS) (HSAMPLESTATE state, + void const FAR * FAR *orig_src, + U32 FAR * orig_src_fract, + void FAR * orig_src_end, + S32 FAR * FAR *build_dest, + void FAR * build_dest_end, + S32 FAR * left_val, + S32 FAR * right_val, + S32 playback_ratio, + S32 left_scale, + S32 right_scale, + S32 base_scale, + MIXSTAGE FAR * mixer_provider, + U32 mixer_operation); -typedef S32 (AILCALL FAR * FLTSMP_SAMPLE_ATTRIBUTE) (HSAMPLESTATE state, - HATTRIB attribute); +typedef S32 (AILCALL FAR * FLTSMP_SAMPLE_ATTRIBUTE) (HSAMPLESTATE state, + HATTRIB attribute); -typedef S32 (AILCALL FAR * FLTSMP_SET_SAMPLE_PREFERENCE) (HSAMPLESTATE state, - HATTRIB preference, - void const FAR* value); +typedef S32 (AILCALL FAR * FLTSMP_SET_SAMPLE_PREFERENCE) (HSAMPLESTATE state, + HATTRIB preference, + void const FAR* value); // // Pipeline filter calls // -DXDEC S32 AILCALL AIL_enumerate_filters (HPROENUM FAR *next, - HPROVIDER FAR *dest, - C8 FAR * FAR *name); +DXDEC S32 AILCALL AIL_enumerate_filters (HPROENUM FAR *next, + HPROVIDER FAR *dest, + C8 FAR * FAR *name); DXDEC HDRIVERSTATE - AILCALL AIL_open_filter (HPROVIDER lib, - HDIGDRIVER dig); + AILCALL AIL_open_filter (HPROVIDER lib, + HDIGDRIVER dig); -DXDEC void AILCALL AIL_close_filter (HDRIVERSTATE filter); +DXDEC void AILCALL AIL_close_filter (HDRIVERSTATE filter); -DXDEC S32 AILCALL AIL_enumerate_filter_attributes - (HPROVIDER lib, - HINTENUM FAR * next, - RIB_INTERFACE_ENTRY FAR * dest); +DXDEC S32 AILCALL AIL_enumerate_filter_attributes + (HPROVIDER lib, + HINTENUM FAR * next, + RIB_INTERFACE_ENTRY FAR * dest); -DXDEC void AILCALL AIL_filter_attribute (HPROVIDER lib, - C8 const FAR* name, - void FAR * val); +DXDEC void AILCALL AIL_filter_attribute (HPROVIDER lib, + C8 const FAR* name, + void FAR * val); -DXDEC void AILCALL AIL_set_filter_preference - (HPROVIDER lib, - C8 const FAR* name, - void const FAR* val); +DXDEC void AILCALL AIL_set_filter_preference + (HPROVIDER lib, + C8 const FAR* name, + void const FAR* val); -DXDEC S32 AILCALL AIL_enumerate_filter_sample_attributes - (HPROVIDER lib, - HINTENUM FAR * next, - RIB_INTERFACE_ENTRY FAR * dest); +DXDEC S32 AILCALL AIL_enumerate_filter_sample_attributes + (HPROVIDER lib, + HINTENUM FAR * next, + RIB_INTERFACE_ENTRY FAR * dest); -DXDEC void AILCALL AIL_filter_sample_attribute - (HSAMPLE S, - C8 const FAR* name, - void FAR * val); +DXDEC void AILCALL AIL_filter_sample_attribute + (HSAMPLE S, + C8 const FAR* name, + void FAR * val); -DXDEC void AILCALL AIL_filter_stream_attribute - (HSTREAM S, - C8 const FAR* name, - void FAR* val); +DXDEC void AILCALL AIL_filter_stream_attribute + (HSTREAM S, + C8 const FAR* name, + void FAR* val); -DXDEC void AILCALL AIL_filter_DLS_attribute - (HDLSDEVICE dls, - C8 const FAR* name, - void FAR * val); +DXDEC void AILCALL AIL_filter_DLS_attribute + (HDLSDEVICE dls, + C8 const FAR* name, + void FAR * val); -DXDEC void AILCALL AIL_set_filter_sample_preference - (HSAMPLE S, - C8 const FAR * name, - void const FAR * val); +DXDEC void AILCALL AIL_set_filter_sample_preference + (HSAMPLE S, + C8 const FAR * name, + void const FAR * val); -DXDEC void AILCALL AIL_set_filter_stream_preference - (HSTREAM S, - C8 const FAR * name, - void const FAR * val); +DXDEC void AILCALL AIL_set_filter_stream_preference + (HSTREAM S, + C8 const FAR * name, + void const FAR * val); -DXDEC void AILCALL AIL_set_filter_DLS_preference - (HDLSDEVICE dls, - C8 const FAR * name, - void const FAR * val); +DXDEC void AILCALL AIL_set_filter_DLS_preference + (HDLSDEVICE dls, + C8 const FAR * name, + void const FAR * val); typedef struct _FLTPROVIDER { - PROVIDER_QUERY_ATTRIBUTE PROVIDER_query_attribute; + PROVIDER_QUERY_ATTRIBUTE PROVIDER_query_attribute; - FLT_STARTUP startup; - FLT_ERROR error; - FLT_SHUTDOWN shutdown; - FLT_SET_PROVIDER_PREFERENCE set_provider_preference; - FLT_OPEN_DRIVER open_driver; - FLT_CLOSE_DRIVER close_driver; - FLT_PREMIX_PROCESS premix_process; - FLT_POSTMIX_PROCESS postmix_process; + FLT_STARTUP startup; + FLT_ERROR error; + FLT_SHUTDOWN shutdown; + FLT_SET_PROVIDER_PREFERENCE set_provider_preference; + FLT_OPEN_DRIVER open_driver; + FLT_CLOSE_DRIVER close_driver; + FLT_PREMIX_PROCESS premix_process; + FLT_POSTMIX_PROCESS postmix_process; - FLTSMP_OPEN_SAMPLE open_sample; - FLTSMP_CLOSE_SAMPLE close_sample; - FLTSMP_SAMPLE_PROCESS sample_process; - FLTSMP_SAMPLE_ATTRIBUTE sample_attribute; - FLTSMP_SET_SAMPLE_PREFERENCE set_sample_preference; + FLTSMP_OPEN_SAMPLE open_sample; + FLTSMP_CLOSE_SAMPLE close_sample; + FLTSMP_SAMPLE_PROCESS sample_process; + FLTSMP_SAMPLE_ATTRIBUTE sample_attribute; + FLTSMP_SET_SAMPLE_PREFERENCE set_sample_preference; - HDIGDRIVER dig; - HPROVIDER provider; - HDRIVERSTATE driver_state; + HDIGDRIVER dig; + HPROVIDER provider; + HDRIVERSTATE driver_state; - struct _FLTPROVIDER FAR *next; + struct _FLTPROVIDER FAR *next; } FLTPROVIDER; @@ -4398,302 +4398,302 @@ FLTPROVIDER; // 3D provider calls // -DXDEC S32 AILCALL AIL_enumerate_3D_providers (HPROENUM FAR *next, - HPROVIDER FAR *dest, - C8 FAR * FAR *name); +DXDEC S32 AILCALL AIL_enumerate_3D_providers (HPROENUM FAR *next, + HPROVIDER FAR *dest, + C8 FAR * FAR *name); -DXDEC M3DRESULT AILCALL AIL_open_3D_provider (HPROVIDER lib); +DXDEC M3DRESULT AILCALL AIL_open_3D_provider (HPROVIDER lib); -DXDEC void AILCALL AIL_close_3D_provider (HPROVIDER lib); +DXDEC void AILCALL AIL_close_3D_provider (HPROVIDER lib); -DXDEC S32 AILCALL AIL_enumerate_3D_provider_attributes - (HPROVIDER lib, - HINTENUM FAR * next, - RIB_INTERFACE_ENTRY FAR * dest); +DXDEC S32 AILCALL AIL_enumerate_3D_provider_attributes + (HPROVIDER lib, + HINTENUM FAR * next, + RIB_INTERFACE_ENTRY FAR * dest); -DXDEC void AILCALL AIL_3D_provider_attribute (HPROVIDER lib, - C8 const FAR* name, - void FAR * val); +DXDEC void AILCALL AIL_3D_provider_attribute (HPROVIDER lib, + C8 const FAR* name, + void FAR * val); -DXDEC void AILCALL AIL_set_3D_provider_preference(HPROVIDER lib, - C8 const FAR* name, - void const FAR* val); +DXDEC void AILCALL AIL_set_3D_provider_preference(HPROVIDER lib, + C8 const FAR* name, + void const FAR* val); struct H3D { - H3DPOBJECT actual; - HPROVIDER owner; - S32 user_data[8]; + H3DPOBJECT actual; + HPROVIDER owner; + S32 user_data[8]; }; typedef struct _M3DPROVIDER { - PROVIDER_QUERY_ATTRIBUTE PROVIDER_query_attribute; - M3D_STARTUP startup; - M3D_ERROR error; - M3D_SHUTDOWN shutdown; - M3D_SET_PROVIDER_PREFERENCE set_provider_preference; - M3D_ACTIVATE activate; - M3D_ALLOCATE_3D_SAMPLE_HANDLE allocate_3D_sample_handle; - M3D_RELEASE_3D_SAMPLE_HANDLE release_3D_sample_handle; - M3D_START_3D_SAMPLE start_3D_sample; - M3D_STOP_3D_SAMPLE stop_3D_sample; - M3D_RESUME_3D_SAMPLE resume_3D_sample; - M3D_END_3D_SAMPLE end_3D_sample; - M3D_SET_3D_SAMPLE_DATA set_3D_sample_data; - M3D_SET_3D_SAMPLE_VOLUME set_3D_sample_volume; - M3D_SET_3D_SAMPLE_PLAYBACK_RATE set_3D_sample_playback_rate; - M3D_SET_3D_SAMPLE_OFFSET set_3D_sample_offset; - M3D_SET_3D_SAMPLE_LOOP_COUNT set_3D_sample_loop_count; - M3D_SET_3D_SAMPLE_LOOP_BLOCK set_3D_sample_loop_block; - M3D_3D_SAMPLE_STATUS sample_status; - M3D_3D_SAMPLE_VOLUME sample_volume; - M3D_3D_SAMPLE_PLAYBACK_RATE sample_playback_rate; - M3D_3D_SAMPLE_OFFSET sample_offset; - M3D_3D_SAMPLE_LENGTH sample_length; - M3D_3D_SAMPLE_LOOP_COUNT sample_loop_count; - M3D_SET_3D_SAMPLE_DISTANCES set_3D_sample_distances; - M3D_3D_SAMPLE_DISTANCES sample_distances; - M3D_ACTIVE_3D_SAMPLE_COUNT active_3D_sample_count; - M3D_3D_OPEN_LISTENER open_listener; - M3D_3D_CLOSE_LISTENER close_listener; - M3D_3D_OPEN_OBJECT open_object; - M3D_3D_CLOSE_OBJECT close_object; - M3D_SET_3D_POSITION set_3D_position; - M3D_SET_3D_VELOCITY set_3D_velocity; - M3D_SET_3D_VELOCITY_VECTOR set_3D_velocity_vector; - M3D_SET_3D_ORIENTATION set_3D_orientation; - M3D_3D_POSITION position; - M3D_3D_VELOCITY velocity; - M3D_3D_ORIENTATION orientation; - M3D_3D_UPDATE_POSITION update_position; - M3D_3D_AUTO_UPDATE_POSITION auto_update_position; - M3D_3D_SAMPLE_ATTRIBUTE sample_query_attribute; - M3D_3D_SET_SAMPLE_PREFERENCE set_sample_preference; - M3D_3D_ROOM_TYPE room_type; - M3D_SET_3D_ROOM_TYPE set_3D_room_type; - M3D_3D_SPEAKER_TYPE speaker_type; - M3D_SET_3D_SPEAKER_TYPE set_3D_speaker_type; - M3D_SET_3D_SAMPLE_OBSTRUCTION set_3D_sample_obstruction; - M3D_SET_3D_SAMPLE_OCCLUSION set_3D_sample_occlusion; - M3D_SET_3D_SAMPLE_CONE set_3D_sample_cone; - M3D_SET_3D_SAMPLE_EFFECTS_LEVEL set_3D_sample_effects_level; - M3D_3D_SAMPLE_OBSTRUCTION sample_obstruction; - M3D_3D_SAMPLE_OCCLUSION sample_occlusion; - M3D_3D_SAMPLE_CONE sample_cone; - M3D_3D_SAMPLE_EFFECTS_LEVEL sample_effects_level; - M3D_SET_3D_EOS set_3D_EOS; + PROVIDER_QUERY_ATTRIBUTE PROVIDER_query_attribute; + M3D_STARTUP startup; + M3D_ERROR error; + M3D_SHUTDOWN shutdown; + M3D_SET_PROVIDER_PREFERENCE set_provider_preference; + M3D_ACTIVATE activate; + M3D_ALLOCATE_3D_SAMPLE_HANDLE allocate_3D_sample_handle; + M3D_RELEASE_3D_SAMPLE_HANDLE release_3D_sample_handle; + M3D_START_3D_SAMPLE start_3D_sample; + M3D_STOP_3D_SAMPLE stop_3D_sample; + M3D_RESUME_3D_SAMPLE resume_3D_sample; + M3D_END_3D_SAMPLE end_3D_sample; + M3D_SET_3D_SAMPLE_DATA set_3D_sample_data; + M3D_SET_3D_SAMPLE_VOLUME set_3D_sample_volume; + M3D_SET_3D_SAMPLE_PLAYBACK_RATE set_3D_sample_playback_rate; + M3D_SET_3D_SAMPLE_OFFSET set_3D_sample_offset; + M3D_SET_3D_SAMPLE_LOOP_COUNT set_3D_sample_loop_count; + M3D_SET_3D_SAMPLE_LOOP_BLOCK set_3D_sample_loop_block; + M3D_3D_SAMPLE_STATUS sample_status; + M3D_3D_SAMPLE_VOLUME sample_volume; + M3D_3D_SAMPLE_PLAYBACK_RATE sample_playback_rate; + M3D_3D_SAMPLE_OFFSET sample_offset; + M3D_3D_SAMPLE_LENGTH sample_length; + M3D_3D_SAMPLE_LOOP_COUNT sample_loop_count; + M3D_SET_3D_SAMPLE_DISTANCES set_3D_sample_distances; + M3D_3D_SAMPLE_DISTANCES sample_distances; + M3D_ACTIVE_3D_SAMPLE_COUNT active_3D_sample_count; + M3D_3D_OPEN_LISTENER open_listener; + M3D_3D_CLOSE_LISTENER close_listener; + M3D_3D_OPEN_OBJECT open_object; + M3D_3D_CLOSE_OBJECT close_object; + M3D_SET_3D_POSITION set_3D_position; + M3D_SET_3D_VELOCITY set_3D_velocity; + M3D_SET_3D_VELOCITY_VECTOR set_3D_velocity_vector; + M3D_SET_3D_ORIENTATION set_3D_orientation; + M3D_3D_POSITION position; + M3D_3D_VELOCITY velocity; + M3D_3D_ORIENTATION orientation; + M3D_3D_UPDATE_POSITION update_position; + M3D_3D_AUTO_UPDATE_POSITION auto_update_position; + M3D_3D_SAMPLE_ATTRIBUTE sample_query_attribute; + M3D_3D_SET_SAMPLE_PREFERENCE set_sample_preference; + M3D_3D_ROOM_TYPE room_type; + M3D_SET_3D_ROOM_TYPE set_3D_room_type; + M3D_3D_SPEAKER_TYPE speaker_type; + M3D_SET_3D_SPEAKER_TYPE set_3D_speaker_type; + M3D_SET_3D_SAMPLE_OBSTRUCTION set_3D_sample_obstruction; + M3D_SET_3D_SAMPLE_OCCLUSION set_3D_sample_occlusion; + M3D_SET_3D_SAMPLE_CONE set_3D_sample_cone; + M3D_SET_3D_SAMPLE_EFFECTS_LEVEL set_3D_sample_effects_level; + M3D_3D_SAMPLE_OBSTRUCTION sample_obstruction; + M3D_3D_SAMPLE_OCCLUSION sample_occlusion; + M3D_3D_SAMPLE_CONE sample_cone; + M3D_3D_SAMPLE_EFFECTS_LEVEL sample_effects_level; + M3D_SET_3D_EOS set_3D_EOS; } M3DPROVIDER; // // Sample calls // -DXDEC H3DSAMPLE AILCALL AIL_allocate_3D_sample_handle - (HPROVIDER lib); +DXDEC H3DSAMPLE AILCALL AIL_allocate_3D_sample_handle + (HPROVIDER lib); -DXDEC void AILCALL AIL_release_3D_sample_handle - (H3DSAMPLE S); +DXDEC void AILCALL AIL_release_3D_sample_handle + (H3DSAMPLE S); -DXDEC void AILCALL AIL_start_3D_sample (H3DSAMPLE S); +DXDEC void AILCALL AIL_start_3D_sample (H3DSAMPLE S); -DXDEC void AILCALL AIL_stop_3D_sample (H3DSAMPLE S); +DXDEC void AILCALL AIL_stop_3D_sample (H3DSAMPLE S); -DXDEC void AILCALL AIL_resume_3D_sample (H3DSAMPLE S); +DXDEC void AILCALL AIL_resume_3D_sample (H3DSAMPLE S); -DXDEC void AILCALL AIL_end_3D_sample (H3DSAMPLE S); +DXDEC void AILCALL AIL_end_3D_sample (H3DSAMPLE S); -DXDEC S32 AILCALL AIL_set_3D_sample_file (H3DSAMPLE S, - void const FAR*file_image); +DXDEC S32 AILCALL AIL_set_3D_sample_file (H3DSAMPLE S, + void const FAR*file_image); -DXDEC S32 AILCALL AIL_set_3D_sample_info (H3DSAMPLE S, - AILSOUNDINFO const FAR*info); +DXDEC S32 AILCALL AIL_set_3D_sample_info (H3DSAMPLE S, + AILSOUNDINFO const FAR*info); -DXDEC void AILCALL AIL_set_3D_sample_volume (H3DSAMPLE S, - S32 volume); +DXDEC void AILCALL AIL_set_3D_sample_volume (H3DSAMPLE S, + S32 volume); -DXDEC void AILCALL AIL_set_3D_sample_offset (H3DSAMPLE S, - U32 offset); +DXDEC void AILCALL AIL_set_3D_sample_offset (H3DSAMPLE S, + U32 offset); -DXDEC void AILCALL AIL_set_3D_sample_playback_rate - (H3DSAMPLE S, - S32 playback_rate); +DXDEC void AILCALL AIL_set_3D_sample_playback_rate + (H3DSAMPLE S, + S32 playback_rate); -DXDEC void AILCALL AIL_set_3D_sample_loop_count(H3DSAMPLE S, - U32 loops); +DXDEC void AILCALL AIL_set_3D_sample_loop_count(H3DSAMPLE S, + U32 loops); -DXDEC void AILCALL AIL_set_3D_sample_loop_block(H3DSAMPLE S, - S32 loop_start_offset, - S32 loop_end_offset); +DXDEC void AILCALL AIL_set_3D_sample_loop_block(H3DSAMPLE S, + S32 loop_start_offset, + S32 loop_end_offset); -DXDEC U32 AILCALL AIL_3D_sample_status (H3DSAMPLE S); +DXDEC U32 AILCALL AIL_3D_sample_status (H3DSAMPLE S); -DXDEC S32 AILCALL AIL_3D_sample_volume (H3DSAMPLE S); +DXDEC S32 AILCALL AIL_3D_sample_volume (H3DSAMPLE S); -DXDEC U32 AILCALL AIL_3D_sample_offset (H3DSAMPLE S); +DXDEC U32 AILCALL AIL_3D_sample_offset (H3DSAMPLE S); -DXDEC S32 AILCALL AIL_3D_sample_playback_rate (H3DSAMPLE S); +DXDEC S32 AILCALL AIL_3D_sample_playback_rate (H3DSAMPLE S); -DXDEC U32 AILCALL AIL_3D_sample_length (H3DSAMPLE S); +DXDEC U32 AILCALL AIL_3D_sample_length (H3DSAMPLE S); -DXDEC U32 AILCALL AIL_3D_sample_loop_count (H3DSAMPLE S); +DXDEC U32 AILCALL AIL_3D_sample_loop_count (H3DSAMPLE S); -DXDEC S32 AILCALL AIL_3D_room_type (HPROVIDER lib); +DXDEC S32 AILCALL AIL_3D_room_type (HPROVIDER lib); -DXDEC void AILCALL AIL_set_3D_room_type (HPROVIDER lib, - S32 room_type); +DXDEC void AILCALL AIL_set_3D_room_type (HPROVIDER lib, + S32 room_type); -#define AIL_3D_2_SPEAKER 0 -#define AIL_3D_HEADPHONE 1 -#define AIL_3D_SURROUND 2 -#define AIL_3D_4_SPEAKER 3 +#define AIL_3D_2_SPEAKER 0 +#define AIL_3D_HEADPHONE 1 +#define AIL_3D_SURROUND 2 +#define AIL_3D_4_SPEAKER 3 -DXDEC S32 AILCALL AIL_3D_speaker_type (HPROVIDER lib); +DXDEC S32 AILCALL AIL_3D_speaker_type (HPROVIDER lib); -DXDEC void AILCALL AIL_set_3D_speaker_type (HPROVIDER lib, - S32 speaker_type); +DXDEC void AILCALL AIL_set_3D_speaker_type (HPROVIDER lib, + S32 speaker_type); // // Changed the definition of distances to only be max and min, vs. front -// min/max and back min/max. Only RSX supported the concept of different -// front and distances, so we changed the API to make it more orthogonal -// to most of the 3D providers. Sorry in advance. +// min/max and back min/max. Only RSX supported the concept of different +// front and distances, so we changed the API to make it more orthogonal +// to most of the 3D providers. Sorry in advance. // -DXDEC void AILCALL AIL_set_3D_sample_distances (H3DSAMPLE S, - F32 max_dist, - F32 min_dist); +DXDEC void AILCALL AIL_set_3D_sample_distances (H3DSAMPLE S, + F32 max_dist, + F32 min_dist); -DXDEC void AILCALL AIL_3D_sample_distances (H3DSAMPLE S, - F32 FAR * max_dist, - F32 FAR * min_dist); +DXDEC void AILCALL AIL_3D_sample_distances (H3DSAMPLE S, + F32 FAR * max_dist, + F32 FAR * min_dist); -DXDEC S32 AILCALL AIL_active_3D_sample_count (HPROVIDER lib); +DXDEC S32 AILCALL AIL_active_3D_sample_count (HPROVIDER lib); -DXDEC S32 AILCALL AIL_enumerate_3D_sample_attributes - (HPROVIDER lib, - HINTENUM FAR * next, - RIB_INTERFACE_ENTRY FAR * dest); +DXDEC S32 AILCALL AIL_enumerate_3D_sample_attributes + (HPROVIDER lib, + HINTENUM FAR * next, + RIB_INTERFACE_ENTRY FAR * dest); -DXDEC void AILCALL AIL_3D_sample_attribute (H3DSAMPLE samp, - C8 const FAR* name, - void FAR * val); +DXDEC void AILCALL AIL_3D_sample_attribute (H3DSAMPLE samp, + C8 const FAR* name, + void FAR * val); -DXDEC void AILCALL AIL_set_3D_sample_preference (H3DSAMPLE samp, - C8 const FAR* name, - void const FAR* val); +DXDEC void AILCALL AIL_set_3D_sample_preference (H3DSAMPLE samp, + C8 const FAR* name, + void const FAR* val); -DXDEC void AILCALL AIL_set_3D_sample_obstruction (H3DSAMPLE S, - F32 obstruction); +DXDEC void AILCALL AIL_set_3D_sample_obstruction (H3DSAMPLE S, + F32 obstruction); -DXDEC void AILCALL AIL_set_3D_sample_occlusion (H3DSAMPLE S, - F32 occlusion); +DXDEC void AILCALL AIL_set_3D_sample_occlusion (H3DSAMPLE S, + F32 occlusion); -DXDEC void AILCALL AIL_set_3D_sample_cone (H3DSAMPLE S, - F32 inner_angle, - F32 outer_angle, - S32 outer_volume); +DXDEC void AILCALL AIL_set_3D_sample_cone (H3DSAMPLE S, + F32 inner_angle, + F32 outer_angle, + S32 outer_volume); -DXDEC void AILCALL AIL_set_3D_sample_effects_level - (H3DSAMPLE S, - F32 effects_level); +DXDEC void AILCALL AIL_set_3D_sample_effects_level + (H3DSAMPLE S, + F32 effects_level); -DXDEC F32 AILCALL AIL_3D_sample_obstruction (H3DSAMPLE S); +DXDEC F32 AILCALL AIL_3D_sample_obstruction (H3DSAMPLE S); -DXDEC F32 AILCALL AIL_3D_sample_occlusion (H3DSAMPLE S); +DXDEC F32 AILCALL AIL_3D_sample_occlusion (H3DSAMPLE S); -DXDEC void AILCALL AIL_3D_sample_cone (H3DSAMPLE S, - F32 FAR* inner_angle, - F32 FAR* outer_angle, - S32 FAR* outer_volume); +DXDEC void AILCALL AIL_3D_sample_cone (H3DSAMPLE S, + F32 FAR* inner_angle, + F32 FAR* outer_angle, + S32 FAR* outer_volume); -DXDEC F32 AILCALL AIL_3D_sample_effects_level (H3DSAMPLE S); +DXDEC F32 AILCALL AIL_3D_sample_effects_level (H3DSAMPLE S); DXDEC AIL3DSAMPLECB AILCALL AIL_register_3D_EOS_callback - (H3DSAMPLE S, - AIL3DSAMPLECB EOS); + (H3DSAMPLE S, + AIL3DSAMPLECB EOS); // // Positioning-object allocation calls // -DXDEC H3DPOBJECT AILCALL AIL_open_3D_listener (HPROVIDER lib); +DXDEC H3DPOBJECT AILCALL AIL_open_3D_listener (HPROVIDER lib); -DXDEC void AILCALL AIL_close_3D_listener (H3DPOBJECT listener); +DXDEC void AILCALL AIL_close_3D_listener (H3DPOBJECT listener); -DXDEC H3DPOBJECT AILCALL AIL_open_3D_object (HPROVIDER lib); +DXDEC H3DPOBJECT AILCALL AIL_open_3D_object (HPROVIDER lib); -DXDEC void AILCALL AIL_close_3D_object (H3DPOBJECT obj); +DXDEC void AILCALL AIL_close_3D_object (H3DPOBJECT obj); // // 3D object calls // -DXDEC void AILCALL AIL_set_3D_position (H3DPOBJECT obj, - F32 X, - F32 Y, - F32 Z); +DXDEC void AILCALL AIL_set_3D_position (H3DPOBJECT obj, + F32 X, + F32 Y, + F32 Z); -DXDEC void AILCALL AIL_set_3D_velocity (H3DPOBJECT obj, - F32 dX_per_ms, - F32 dY_per_ms, - F32 dZ_per_ms, - F32 magnitude); +DXDEC void AILCALL AIL_set_3D_velocity (H3DPOBJECT obj, + F32 dX_per_ms, + F32 dY_per_ms, + F32 dZ_per_ms, + F32 magnitude); -DXDEC void AILCALL AIL_set_3D_velocity_vector (H3DPOBJECT obj, - F32 dX_per_ms, - F32 dY_per_ms, - F32 dZ_per_ms); +DXDEC void AILCALL AIL_set_3D_velocity_vector (H3DPOBJECT obj, + F32 dX_per_ms, + F32 dY_per_ms, + F32 dZ_per_ms); -DXDEC void AILCALL AIL_set_3D_orientation (H3DPOBJECT obj, - F32 X_face, - F32 Y_face, - F32 Z_face, - F32 X_up, - F32 Y_up, - F32 Z_up); +DXDEC void AILCALL AIL_set_3D_orientation (H3DPOBJECT obj, + F32 X_face, + F32 Y_face, + F32 Z_face, + F32 X_up, + F32 Y_up, + F32 Z_up); -DXDEC void AILCALL AIL_3D_position (H3DPOBJECT obj, - F32 FAR *X, - F32 FAR *Y, - F32 FAR *Z); +DXDEC void AILCALL AIL_3D_position (H3DPOBJECT obj, + F32 FAR *X, + F32 FAR *Y, + F32 FAR *Z); -DXDEC void AILCALL AIL_3D_velocity (H3DPOBJECT obj, - F32 FAR *dX_per_ms, - F32 FAR *dY_per_ms, - F32 FAR *dZ_per_ms); +DXDEC void AILCALL AIL_3D_velocity (H3DPOBJECT obj, + F32 FAR *dX_per_ms, + F32 FAR *dY_per_ms, + F32 FAR *dZ_per_ms); -DXDEC void AILCALL AIL_3D_orientation (H3DPOBJECT obj, - F32 FAR *X_face, - F32 FAR *Y_face, - F32 FAR *Z_face, - F32 FAR *X_up, - F32 FAR *Y_up, - F32 FAR *Z_up); +DXDEC void AILCALL AIL_3D_orientation (H3DPOBJECT obj, + F32 FAR *X_face, + F32 FAR *Y_face, + F32 FAR *Z_face, + F32 FAR *X_up, + F32 FAR *Y_up, + F32 FAR *Z_up); -DXDEC void AILCALL AIL_update_3D_position (H3DPOBJECT obj, - F32 dt_milliseconds); +DXDEC void AILCALL AIL_update_3D_position (H3DPOBJECT obj, + F32 dt_milliseconds); -DXDEC void AILCALL AIL_auto_update_3D_position (H3DPOBJECT obj, - S32 enable); +DXDEC void AILCALL AIL_auto_update_3D_position (H3DPOBJECT obj, + S32 enable); -DXDEC void AILCALL AIL_set_3D_user_data (H3DPOBJECT obj, - U32 index, - S32 value); +DXDEC void AILCALL AIL_set_3D_user_data (H3DPOBJECT obj, + U32 index, + S32 value); -DXDEC S32 AILCALL AIL_3D_user_data (H3DPOBJECT obj, - U32 index); +DXDEC S32 AILCALL AIL_3D_user_data (H3DPOBJECT obj, + U32 index); // Obsolete 3D function names: #define AIL_set_3D_object_user_data AIL_set_3D_user_data @@ -4709,34 +4709,34 @@ DXDEC S32 AILCALL AIL_3D_user_data (H3DPOBJECT obj, enum { - ENVIRONMENT_GENERIC, // factory default - ENVIRONMENT_PADDEDCELL, - ENVIRONMENT_ROOM, // standard environments - ENVIRONMENT_BATHROOM, - ENVIRONMENT_LIVINGROOM, - ENVIRONMENT_STONEROOM, - ENVIRONMENT_AUDITORIUM, - ENVIRONMENT_CONCERTHALL, - ENVIRONMENT_CAVE, - ENVIRONMENT_ARENA, - ENVIRONMENT_HANGAR, - ENVIRONMENT_CARPETEDHALLWAY, - ENVIRONMENT_HALLWAY, - ENVIRONMENT_STONECORRIDOR, - ENVIRONMENT_ALLEY, - ENVIRONMENT_FOREST, - ENVIRONMENT_CITY, - ENVIRONMENT_MOUNTAINS, - ENVIRONMENT_QUARRY, - ENVIRONMENT_PLAIN, - ENVIRONMENT_PARKINGLOT, - ENVIRONMENT_SEWERPIPE, - ENVIRONMENT_UNDERWATER, - ENVIRONMENT_DRUGGED, - ENVIRONMENT_DIZZY, - ENVIRONMENT_PSYCHOTIC, + ENVIRONMENT_GENERIC, // factory default + ENVIRONMENT_PADDEDCELL, + ENVIRONMENT_ROOM, // standard environments + ENVIRONMENT_BATHROOM, + ENVIRONMENT_LIVINGROOM, + ENVIRONMENT_STONEROOM, + ENVIRONMENT_AUDITORIUM, + ENVIRONMENT_CONCERTHALL, + ENVIRONMENT_CAVE, + ENVIRONMENT_ARENA, + ENVIRONMENT_HANGAR, + ENVIRONMENT_CARPETEDHALLWAY, + ENVIRONMENT_HALLWAY, + ENVIRONMENT_STONECORRIDOR, + ENVIRONMENT_ALLEY, + ENVIRONMENT_FOREST, + ENVIRONMENT_CITY, + ENVIRONMENT_MOUNTAINS, + ENVIRONMENT_QUARRY, + ENVIRONMENT_PLAIN, + ENVIRONMENT_PARKINGLOT, + ENVIRONMENT_SEWERPIPE, + ENVIRONMENT_UNDERWATER, + ENVIRONMENT_DRUGGED, + ENVIRONMENT_DIZZY, + ENVIRONMENT_PSYCHOTIC, - ENVIRONMENT_COUNT // total number of environments + ENVIRONMENT_COUNT // total number of environments }; // @@ -4747,34 +4747,34 @@ enum enum { - EAX_ENVIRONMENT_GENERIC, // factory default - EAX_ENVIRONMENT_PADDEDCELL, - EAX_ENVIRONMENT_ROOM, // standard environments - EAX_ENVIRONMENT_BATHROOM, - EAX_ENVIRONMENT_LIVINGROOM, - EAX_ENVIRONMENT_STONEROOM, - EAX_ENVIRONMENT_AUDITORIUM, - EAX_ENVIRONMENT_CONCERTHALL, - EAX_ENVIRONMENT_CAVE, - EAX_ENVIRONMENT_ARENA, - EAX_ENVIRONMENT_HANGAR, - EAX_ENVIRONMENT_CARPETEDHALLWAY, - EAX_ENVIRONMENT_HALLWAY, - EAX_ENVIRONMENT_STONECORRIDOR, - EAX_ENVIRONMENT_ALLEY, - EAX_ENVIRONMENT_FOREST, - EAX_ENVIRONMENT_CITY, - EAX_ENVIRONMENT_MOUNTAINS, - EAX_ENVIRONMENT_QUARRY, - EAX_ENVIRONMENT_PLAIN, - EAX_ENVIRONMENT_PARKINGLOT, - EAX_ENVIRONMENT_SEWERPIPE, - EAX_ENVIRONMENT_UNDERWATER, - EAX_ENVIRONMENT_DRUGGED, - EAX_ENVIRONMENT_DIZZY, - EAX_ENVIRONMENT_PSYCHOTIC, + EAX_ENVIRONMENT_GENERIC, // factory default + EAX_ENVIRONMENT_PADDEDCELL, + EAX_ENVIRONMENT_ROOM, // standard environments + EAX_ENVIRONMENT_BATHROOM, + EAX_ENVIRONMENT_LIVINGROOM, + EAX_ENVIRONMENT_STONEROOM, + EAX_ENVIRONMENT_AUDITORIUM, + EAX_ENVIRONMENT_CONCERTHALL, + EAX_ENVIRONMENT_CAVE, + EAX_ENVIRONMENT_ARENA, + EAX_ENVIRONMENT_HANGAR, + EAX_ENVIRONMENT_CARPETEDHALLWAY, + EAX_ENVIRONMENT_HALLWAY, + EAX_ENVIRONMENT_STONECORRIDOR, + EAX_ENVIRONMENT_ALLEY, + EAX_ENVIRONMENT_FOREST, + EAX_ENVIRONMENT_CITY, + EAX_ENVIRONMENT_MOUNTAINS, + EAX_ENVIRONMENT_QUARRY, + EAX_ENVIRONMENT_PLAIN, + EAX_ENVIRONMENT_PARKINGLOT, + EAX_ENVIRONMENT_SEWERPIPE, + EAX_ENVIRONMENT_UNDERWATER, + EAX_ENVIRONMENT_DRUGGED, + EAX_ENVIRONMENT_DIZZY, + EAX_ENVIRONMENT_PSYCHOTIC, - EAX_ENVIRONMENT_COUNT // total number of environments + EAX_ENVIRONMENT_COUNT // total number of environments }; #define EAX_REVERBMIX_USEDISTANCE (-1.0F) @@ -4785,7 +4785,7 @@ enum typedef struct _FLTPROVIDER { - U32 junk; + U32 junk; } FLTPROVIDER; #endif @@ -4796,9 +4796,9 @@ typedef struct _FLTPROVIDER #if defined(_PUSHPOP_SUPPORTED) || PRAGMA_STRUCT_PACKPUSH - #pragma pack(pop) + #pragma pack(pop) #else - #pragma pack() + #pragma pack() #endif diff --git a/Standard Gaming Platform/Mutex Manager.cpp b/Standard Gaming Platform/Mutex Manager.cpp index 1e398d4a..088a4bcd 100644 --- a/Standard Gaming Platform/Mutex Manager.cpp +++ b/Standard Gaming Platform/Mutex Manager.cpp @@ -18,129 +18,129 @@ HANDLE MutexTable[MAX_MUTEX_HANDLES]; BOOLEAN InitializeMutexManager(void) { - UINT32 uiIndex; + UINT32 uiIndex; - // - // Register the Mutex Manager debug topic - // + // + // Register the Mutex Manager debug topic + // - RegisterDebugTopic(TOPIC_MUTEX, "Mutex Manager"); - DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "Initializing the Mutex Manager"); + RegisterDebugTopic(TOPIC_MUTEX, "Mutex Manager"); + DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "Initializing the Mutex Manager"); - // - // Initialize the table of mutex handles to NULL - // + // + // Initialize the table of mutex handles to NULL + // - for (uiIndex = 0; uiIndex < MAX_MUTEX_HANDLES; uiIndex++) - { - MutexTable[uiIndex] = NULL; - } + for (uiIndex = 0; uiIndex < MAX_MUTEX_HANDLES; uiIndex++) + { + MutexTable[uiIndex] = NULL; + } - return TRUE; + return TRUE; } void ShutdownMutexManager(void) { - UINT32 uiIndex; + UINT32 uiIndex; - DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "Shutting down the Mutex Manager"); + DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "Shutting down the Mutex Manager"); - // - // Make sure all mutex handles are closed - // + // + // Make sure all mutex handles are closed + // - for (uiIndex = 0; uiIndex < MAX_MUTEX_HANDLES; uiIndex++) - { - if (MutexTable[uiIndex] != NULL) - { - CloseHandle(MutexTable[uiIndex]); - MutexTable[uiIndex] = NULL; - } - } + for (uiIndex = 0; uiIndex < MAX_MUTEX_HANDLES; uiIndex++) + { + if (MutexTable[uiIndex] != NULL) + { + CloseHandle(MutexTable[uiIndex]); + MutexTable[uiIndex] = NULL; + } + } - UnRegisterDebugTopic(TOPIC_MUTEX, "Mutex Manager"); + UnRegisterDebugTopic(TOPIC_MUTEX, "Mutex Manager"); } BOOLEAN InitializeMutex(UINT32 uiMutexIndex, UINT8 *ubMutexName) { - MutexTable[uiMutexIndex] = CreateMutex(NULL, FALSE, ubMutexName); - if (MutexTable[uiMutexIndex] == NULL) - { - // - // Mutex creation has failed. - // - DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Mutex initialization has failed."); - return FALSE; - } + MutexTable[uiMutexIndex] = CreateMutex(NULL, FALSE, ubMutexName); + if (MutexTable[uiMutexIndex] == NULL) + { + // + // Mutex creation has failed. + // + DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Mutex initialization has failed."); + return FALSE; + } - return TRUE; + return TRUE; } BOOLEAN DeleteMutex(UINT32 uiMutexIndex) { - if (MutexTable[uiMutexIndex] == NULL) - { - // - // Hum ?? We just tried to initialize a mutex entry which doesn't have a reserved slot - // - - DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Mutex cannot be deleted since it does not exit"); - return FALSE; - } - - if (CloseHandle(MutexTable[uiMutexIndex]) == FALSE) - { - // - // Hum, the mutex deletion has failed - // - - DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Mutex cannot be deleted since it does not exit"); - return FALSE; - } + if (MutexTable[uiMutexIndex] == NULL) + { + // + // Hum ?? We just tried to initialize a mutex entry which doesn't have a reserved slot + // - MutexTable[uiMutexIndex] = NULL; - - return TRUE; + DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Mutex cannot be deleted since it does not exit"); + return FALSE; + } + + if (CloseHandle(MutexTable[uiMutexIndex]) == FALSE) + { + // + // Hum, the mutex deletion has failed + // + + DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Mutex cannot be deleted since it does not exit"); + return FALSE; + } + + MutexTable[uiMutexIndex] = NULL; + + return TRUE; } BOOLEAN EnterMutex(UINT32 uiMutexIndex, INT32 nLine, STR8 szFilename) { - switch (WaitForSingleObject(MutexTable[uiMutexIndex], INFINITE)) - { - case WAIT_OBJECT_0 - : return TRUE; - case WAIT_TIMEOUT - : DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Possible infinite loop detected due to enter mutex timeout"); - return FALSE; - case WAIT_ABANDONED - : DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Abandoned mutex has been found"); - return FALSE; - } + switch (WaitForSingleObject(MutexTable[uiMutexIndex], INFINITE)) + { + case WAIT_OBJECT_0 + : return TRUE; + case WAIT_TIMEOUT + : DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Possible infinite loop detected due to enter mutex timeout"); + return FALSE; + case WAIT_ABANDONED + : DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Abandoned mutex has been found"); + return FALSE; + } } BOOLEAN EnterMutexWithTimeout(UINT32 uiMutexIndex, UINT32 uiTimeout, INT32 nLine, STR8 szFilename) { - switch (WaitForSingleObject(MutexTable[uiMutexIndex], uiTimeout)) - { - case WAIT_OBJECT_0 - : return TRUE; - case WAIT_TIMEOUT - : return FALSE; - case WAIT_ABANDONED - : return FALSE; - } - return TRUE; + switch (WaitForSingleObject(MutexTable[uiMutexIndex], uiTimeout)) + { + case WAIT_OBJECT_0 + : return TRUE; + case WAIT_TIMEOUT + : return FALSE; + case WAIT_ABANDONED + : return FALSE; + } + return TRUE; } BOOLEAN LeaveMutex(UINT32 uiMutexIndex, INT32 nLine, STR8 szFilename) { - if (ReleaseMutex(MutexTable[uiMutexIndex]) == FALSE) - { - DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Failed to leave mutex"); - return FALSE; - } - - return TRUE; + if (ReleaseMutex(MutexTable[uiMutexIndex]) == FALSE) + { + DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "ERROR : Failed to leave mutex"); + return FALSE; + } + + return TRUE; } #else @@ -153,71 +153,71 @@ CRITICAL_SECTION MutexTable[MAX_MUTEX_HANDLES]; BOOLEAN InitializeMutexManager(void) { - UINT32 uiIndex; + UINT32 uiIndex; - // - // Make sure all mutex handles are opened - // + // + // Make sure all mutex handles are opened + // - for (uiIndex = 0; uiIndex < MAX_MUTEX_HANDLES; uiIndex++) - { - InitializeCriticalSection(&MutexTable[uiIndex]); - } - - RegisterDebugTopic(TOPIC_MUTEX, "Mutex Manager"); + for (uiIndex = 0; uiIndex < MAX_MUTEX_HANDLES; uiIndex++) + { + InitializeCriticalSection(&MutexTable[uiIndex]); + } - return TRUE; + RegisterDebugTopic(TOPIC_MUTEX, "Mutex Manager"); + + return TRUE; } void ShutdownMutexManager(void) { - UINT32 uiIndex; + UINT32 uiIndex; - DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "Shutting down the Mutex Manager"); + DbgMessage(TOPIC_MUTEX, DBG_LEVEL_0, "Shutting down the Mutex Manager"); - // - // Make sure all mutex handles are closed - // + // + // Make sure all mutex handles are closed + // - for (uiIndex = 0; uiIndex < MAX_MUTEX_HANDLES; uiIndex++) - { - DeleteCriticalSection(&MutexTable[uiIndex]); - } + for (uiIndex = 0; uiIndex < MAX_MUTEX_HANDLES; uiIndex++) + { + DeleteCriticalSection(&MutexTable[uiIndex]); + } - UnRegisterDebugTopic(TOPIC_MUTEX, "Mutex Manager"); + UnRegisterDebugTopic(TOPIC_MUTEX, "Mutex Manager"); } BOOLEAN InitializeMutex(UINT32 uiMutexIndex, UINT8 *ubMutexName) { - //InitializeCriticalSection(&MutexTable[uiMutexIndex]); + //InitializeCriticalSection(&MutexTable[uiMutexIndex]); - return TRUE; + return TRUE; } BOOLEAN DeleteMutex(UINT32 uiMutexIndex) { - //DeleteCriticalSection(&MutexTable[uiMutexIndex]); - - return TRUE; + //DeleteCriticalSection(&MutexTable[uiMutexIndex]); + + return TRUE; } BOOLEAN EnterMutex(UINT32 uiMutexIndex, INT32 nLine, STR8 szFilename) { - EnterCriticalSection(&MutexTable[uiMutexIndex]); - return TRUE; + EnterCriticalSection(&MutexTable[uiMutexIndex]); + return TRUE; } BOOLEAN EnterMutexWithTimeout(UINT32 uiMutexIndex, UINT32 uiTimeout, INT32 nLine, STR8 szFilename) { - EnterCriticalSection(&MutexTable[uiMutexIndex]); - return TRUE; + EnterCriticalSection(&MutexTable[uiMutexIndex]); + return TRUE; } BOOLEAN LeaveMutex(UINT32 uiMutexIndex, INT32 nLine, STR8 szFilename) { - LeaveCriticalSection(&MutexTable[uiMutexIndex]); - - return TRUE; + LeaveCriticalSection(&MutexTable[uiMutexIndex]); + + return TRUE; } -#endif \ No newline at end of file +#endif diff --git a/Standard Gaming Platform/Mutex Manager.h b/Standard Gaming Platform/Mutex Manager.h index 63bdcdfb..b428dea4 100644 --- a/Standard Gaming Platform/Mutex Manager.h +++ b/Standard Gaming Platform/Mutex Manager.h @@ -6,7 +6,7 @@ #include "Local.h" extern BOOLEAN InitializeMutexManager(void); -extern void ShutdownMutexManager(void); +extern void ShutdownMutexManager(void); extern BOOLEAN InitializeMutex(UINT32 uiMutexIndex, UINT8 *ubMutexName); extern BOOLEAN DeleteMutex(UINT32 uiMutexIndex); extern BOOLEAN EnterMutex(UINT32 uiMutexIndex, INT32 nLine, STR8 szFilename); diff --git a/Standard Gaming Platform/PCX.cpp b/Standard Gaming Platform/PCX.cpp index e9774930..ced980b0 100644 --- a/Standard Gaming Platform/PCX.cpp +++ b/Standard Gaming Platform/PCX.cpp @@ -10,22 +10,22 @@ #include "fileman.h" #endif -// Local typedefs +// Local typedefs -#define PCX_NORMAL 1 -#define PCX_RLE 2 -#define PCX_256COLOR 4 -#define PCX_TRANSPARENT 8 -#define PCX_CLIPPED 16 +#define PCX_NORMAL 1 +#define PCX_RLE 2 +#define PCX_256COLOR 4 +#define PCX_TRANSPARENT 8 +#define PCX_CLIPPED 16 #define PCX_REALIZEPALETTE 32 -#define PCX_X_CLIPPING 64 -#define PCX_Y_CLIPPING 128 -#define PCX_NOTLOADED 256 +#define PCX_X_CLIPPING 64 +#define PCX_Y_CLIPPING 128 +#define PCX_NOTLOADED 256 -#define PCX_ERROROPENING 1 -#define PCX_INVALIDFORMAT 2 -#define PCX_INVALIDLEN 4 -#define PCX_OUTOFMEMORY 8 +#define PCX_ERROROPENING 1 +#define PCX_INVALIDFORMAT 2 +#define PCX_INVALIDLEN 4 +#define PCX_OUTOFMEMORY 8 BOOLEAN SetPcxPalette( PcxObject *pCurrentPcxObject, HIMAGE hImage ); @@ -68,7 +68,7 @@ BOOLEAN LoadPCXFileToImage( HIMAGE hImage, UINT16 fContents ) { SetPcxPalette( pPcxObject, hImage ); - // Create 16 BPP palette if flags and BPP justify + // Create 16 BPP palette if flags and BPP justify hImage->pui16BPPPalette = Create16BPPPalette( hImage->pPalette ); } @@ -82,24 +82,24 @@ BOOLEAN LoadPCXFileToImage( HIMAGE hImage, UINT16 fContents ) PcxObject *LoadPcx(STR8 pFilename) -{ - PcxHeader Header; - PcxObject *pCurrentPcxObject; - HWFILE hFileHandle; - UINT32 uiFileSize; - UINT8 *pPcxBuffer; - - // Open and read in the file - if ((hFileHandle = FileOpen(pFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE)) == 0) - { // damn we failed to open the file - return NULL; - } +{ + PcxHeader Header; + PcxObject *pCurrentPcxObject; + HWFILE hFileHandle; + UINT32 uiFileSize; + UINT8 *pPcxBuffer; - uiFileSize = FileGetSize(hFileHandle); - if (uiFileSize == 0) - { // we failed to size up the file - return NULL; - } + // Open and read in the file + if ((hFileHandle = FileOpen(pFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE)) == 0) + { // damn we failed to open the file + return NULL; + } + + uiFileSize = FileGetSize(hFileHandle); + if (uiFileSize == 0) + { // we failed to size up the file + return NULL; + } // Create enw pCX object pCurrentPcxObject = (PcxObject *) MemAlloc( sizeof( PcxObject ) ); @@ -115,241 +115,241 @@ PcxObject *LoadPcx(STR8 pFilename) { return( NULL ); } - - // Ok we now have a file handle, so let's read in the data - FileRead(hFileHandle, &Header, sizeof(PcxHeader), NULL); - if ((Header.ubManufacturer != 10)||(Header.ubEncoding != 1)) - { // We have an invalid pcx format - // Delete the object - MemFree( pCurrentPcxObject->pPcxBuffer ); + + // Ok we now have a file handle, so let's read in the data + FileRead(hFileHandle, &Header, sizeof(PcxHeader), NULL); + if ((Header.ubManufacturer != 10)||(Header.ubEncoding != 1)) + { // We have an invalid pcx format + // Delete the object + MemFree( pCurrentPcxObject->pPcxBuffer ); MemFree( pCurrentPcxObject ); - return( NULL ); - } + return( NULL ); + } - if (Header.ubBitsPerPixel == 8) - { - pCurrentPcxObject->usPcxFlags = PCX_256COLOR; - } else - { - pCurrentPcxObject->usPcxFlags = 0; - } + if (Header.ubBitsPerPixel == 8) + { + pCurrentPcxObject->usPcxFlags = PCX_256COLOR; + } else + { + pCurrentPcxObject->usPcxFlags = 0; + } - pCurrentPcxObject->usWidth = 1 + (Header.usRight - Header.usLeft); - pCurrentPcxObject->usHeight = 1 + (Header.usBottom - Header.usTop); - pCurrentPcxObject->uiBufferSize = uiFileSize - 768 - sizeof(PcxHeader); + pCurrentPcxObject->usWidth = 1 + (Header.usRight - Header.usLeft); + pCurrentPcxObject->usHeight = 1 + (Header.usBottom - Header.usTop); + pCurrentPcxObject->uiBufferSize = uiFileSize - 768 - sizeof(PcxHeader); - // We are ready to read in the pcx buffer data. Therefore we must lock the buffer - pPcxBuffer = pCurrentPcxObject->pPcxBuffer; + // We are ready to read in the pcx buffer data. Therefore we must lock the buffer + pPcxBuffer = pCurrentPcxObject->pPcxBuffer; - FileRead(hFileHandle, pPcxBuffer, pCurrentPcxObject->uiBufferSize, NULL); + FileRead(hFileHandle, pPcxBuffer, pCurrentPcxObject->uiBufferSize, NULL); + + // Read in the palette + FileRead(hFileHandle, &(pCurrentPcxObject->ubPalette[0]), 768, NULL); - // Read in the palette - FileRead(hFileHandle, &(pCurrentPcxObject->ubPalette[0]), 768, NULL); - // Close file FileClose( hFileHandle ); - return pCurrentPcxObject; + return pCurrentPcxObject; } BOOLEAN BlitPcxToBuffer( PcxObject *pCurrentPcxObject, UINT8 *pBuffer, UINT16 usBufferWidth, UINT16 usBufferHeight, UINT16 usX, UINT16 usY, BOOLEAN fTransp) -{ - UINT8 *pPcxBuffer; - UINT8 ubRepCount; - UINT16 usMaxX, usMaxY; - UINT32 uiImageSize; - UINT8 ubCurrentByte = 0; - UINT8 ubMode; - UINT16 usCurrentX, usCurrentY; - UINT32 uiOffset, uiIndex; - UINT32 uiNextLineOffset, uiStartOffset, uiCurrentOffset; +{ + UINT8 *pPcxBuffer; + UINT8 ubRepCount; + UINT16 usMaxX, usMaxY; + UINT32 uiImageSize; + UINT8 ubCurrentByte = 0; + UINT8 ubMode; + UINT16 usCurrentX, usCurrentY; + UINT32 uiOffset, uiIndex; + UINT32 uiNextLineOffset, uiStartOffset, uiCurrentOffset; - pPcxBuffer = pCurrentPcxObject->pPcxBuffer; + pPcxBuffer = pCurrentPcxObject->pPcxBuffer; - if (((pCurrentPcxObject->usWidth + usX) == usBufferWidth)&&((pCurrentPcxObject->usHeight + usY)== usBufferHeight)) - { // Pre-compute PCX blitting aspects. - uiImageSize = usBufferWidth * usBufferHeight; - ubMode = PCX_NORMAL; - uiOffset = 0; - ubRepCount = 0; + if (((pCurrentPcxObject->usWidth + usX) == usBufferWidth)&&((pCurrentPcxObject->usHeight + usY)== usBufferHeight)) + { // Pre-compute PCX blitting aspects. + uiImageSize = usBufferWidth * usBufferHeight; + ubMode = PCX_NORMAL; + uiOffset = 0; + ubRepCount = 0; - // Blit Pcx object. Two main cases, one for transparency (0's are skipped and for without transparency. - if (fTransp == TRUE) - { - for (uiIndex = 0; uiIndex < uiImageSize; uiIndex++) - { - if (ubMode == PCX_NORMAL) - { - ubCurrentByte = *(pPcxBuffer + uiOffset++); - if (ubCurrentByte > 0x0BF) - { - ubRepCount = ubCurrentByte & 0x03F; - ubCurrentByte = *(pPcxBuffer + uiOffset++); - if (--ubRepCount > 0) - { - ubMode = PCX_RLE; - } - } - } - else - { - if (--ubRepCount == 0) - { - ubMode = PCX_NORMAL; - } - } - if (ubCurrentByte != 0) - { - *(pBuffer + uiIndex) = ubCurrentByte; - } - } - } - else - { - for (uiIndex = 0; uiIndex < uiImageSize; uiIndex++) - { - if (ubMode == PCX_NORMAL) - { - ubCurrentByte = *(pPcxBuffer + uiOffset++); - if (ubCurrentByte > 0x0BF) - { - ubRepCount = ubCurrentByte & 0x03F; - ubCurrentByte = *(pPcxBuffer + uiOffset++); - if (--ubRepCount > 0) - { - ubMode = PCX_RLE; - } - } - } - else - { - if (--ubRepCount == 0) - { ubMode = PCX_NORMAL; - } - } - *(pBuffer + uiIndex) = ubCurrentByte; - } - } - } else - { // Pre-compute PCX blitting aspects. - if ((pCurrentPcxObject->usWidth + usX) >= usBufferWidth) - { - pCurrentPcxObject->usPcxFlags |= PCX_X_CLIPPING; - usMaxX = usBufferWidth - 1; - } - else - { - usMaxX = pCurrentPcxObject->usWidth + usX; - } + // Blit Pcx object. Two main cases, one for transparency (0's are skipped and for without transparency. + if (fTransp == TRUE) + { + for (uiIndex = 0; uiIndex < uiImageSize; uiIndex++) + { + if (ubMode == PCX_NORMAL) + { + ubCurrentByte = *(pPcxBuffer + uiOffset++); + if (ubCurrentByte > 0x0BF) + { + ubRepCount = ubCurrentByte & 0x03F; + ubCurrentByte = *(pPcxBuffer + uiOffset++); + if (--ubRepCount > 0) + { + ubMode = PCX_RLE; + } + } + } + else + { + if (--ubRepCount == 0) + { + ubMode = PCX_NORMAL; + } + } + if (ubCurrentByte != 0) + { + *(pBuffer + uiIndex) = ubCurrentByte; + } + } + } + else + { + for (uiIndex = 0; uiIndex < uiImageSize; uiIndex++) + { + if (ubMode == PCX_NORMAL) + { + ubCurrentByte = *(pPcxBuffer + uiOffset++); + if (ubCurrentByte > 0x0BF) + { + ubRepCount = ubCurrentByte & 0x03F; + ubCurrentByte = *(pPcxBuffer + uiOffset++); + if (--ubRepCount > 0) + { + ubMode = PCX_RLE; + } + } + } + else + { + if (--ubRepCount == 0) + { ubMode = PCX_NORMAL; + } + } + *(pBuffer + uiIndex) = ubCurrentByte; + } + } + } else + { // Pre-compute PCX blitting aspects. + if ((pCurrentPcxObject->usWidth + usX) >= usBufferWidth) + { + pCurrentPcxObject->usPcxFlags |= PCX_X_CLIPPING; + usMaxX = usBufferWidth - 1; + } + else + { + usMaxX = pCurrentPcxObject->usWidth + usX; + } - if ((pCurrentPcxObject->usHeight + usY) >= usBufferHeight) - { - pCurrentPcxObject->usPcxFlags |= PCX_Y_CLIPPING; - uiImageSize = pCurrentPcxObject->usWidth * (usBufferHeight - usY); - usMaxY = usBufferHeight - 1; - } - else - { uiImageSize = pCurrentPcxObject->usWidth * pCurrentPcxObject->usHeight; - usMaxY = pCurrentPcxObject->usHeight + usY; - } + if ((pCurrentPcxObject->usHeight + usY) >= usBufferHeight) + { + pCurrentPcxObject->usPcxFlags |= PCX_Y_CLIPPING; + uiImageSize = pCurrentPcxObject->usWidth * (usBufferHeight - usY); + usMaxY = usBufferHeight - 1; + } + else + { uiImageSize = pCurrentPcxObject->usWidth * pCurrentPcxObject->usHeight; + usMaxY = pCurrentPcxObject->usHeight + usY; + } - ubMode = PCX_NORMAL; - uiOffset = 0; - ubRepCount = 0; - usCurrentX = usX; - usCurrentY = usY; + ubMode = PCX_NORMAL; + uiOffset = 0; + ubRepCount = 0; + usCurrentX = usX; + usCurrentY = usY; - // Blit Pcx object. Two main cases, one for transparency (0's are skipped and for without transparency. - if (fTransp == TRUE) - { - for (uiIndex = 0; uiIndex < uiImageSize; uiIndex++) - { - if (ubMode == PCX_NORMAL) - { - ubCurrentByte = *(pPcxBuffer + uiOffset++); - if (ubCurrentByte > 0x0BF) - { - ubRepCount = ubCurrentByte & 0x03F; - ubCurrentByte = *(pPcxBuffer + uiOffset++); - if (--ubRepCount > 0) - { - ubMode = PCX_RLE; - } - } - } - else - { - if (--ubRepCount == 0) - { ubMode = PCX_NORMAL; - } - } - if (ubCurrentByte != 0) - { *(pBuffer + (usCurrentY*usBufferWidth) + usCurrentX) = ubCurrentByte; - } - usCurrentX++; - if (usCurrentX > usMaxX) - { - usCurrentX = usX; - usCurrentY++; - } - } - } else - { - uiStartOffset = (usCurrentY*usBufferWidth) + usCurrentX; - uiNextLineOffset = uiStartOffset + usBufferWidth; - uiCurrentOffset = uiStartOffset; + // Blit Pcx object. Two main cases, one for transparency (0's are skipped and for without transparency. + if (fTransp == TRUE) + { + for (uiIndex = 0; uiIndex < uiImageSize; uiIndex++) + { + if (ubMode == PCX_NORMAL) + { + ubCurrentByte = *(pPcxBuffer + uiOffset++); + if (ubCurrentByte > 0x0BF) + { + ubRepCount = ubCurrentByte & 0x03F; + ubCurrentByte = *(pPcxBuffer + uiOffset++); + if (--ubRepCount > 0) + { + ubMode = PCX_RLE; + } + } + } + else + { + if (--ubRepCount == 0) + { ubMode = PCX_NORMAL; + } + } + if (ubCurrentByte != 0) + { *(pBuffer + (usCurrentY*usBufferWidth) + usCurrentX) = ubCurrentByte; + } + usCurrentX++; + if (usCurrentX > usMaxX) + { + usCurrentX = usX; + usCurrentY++; + } + } + } else + { + uiStartOffset = (usCurrentY*usBufferWidth) + usCurrentX; + uiNextLineOffset = uiStartOffset + usBufferWidth; + uiCurrentOffset = uiStartOffset; - for (uiIndex = 0; uiIndex < uiImageSize; uiIndex++) - { - - if (ubMode == PCX_NORMAL) - { - ubCurrentByte = *(pPcxBuffer + uiOffset++); - if (ubCurrentByte > 0x0BF) - { - ubRepCount = ubCurrentByte & 0x03F; - ubCurrentByte = *(pPcxBuffer + uiOffset++); - if (--ubRepCount > 0) - { - ubMode = PCX_RLE; - } - } - } - else - { - if (--ubRepCount == 0) - { - ubMode = PCX_NORMAL; - } - } + for (uiIndex = 0; uiIndex < uiImageSize; uiIndex++) + { - if (usCurrentX < usMaxX) - { // We are within the visible bounds so we write the byte to buffer - *(pBuffer + uiCurrentOffset) = ubCurrentByte; - uiCurrentOffset++; - usCurrentX++; - } - else - { if ((uiCurrentOffset + 1)< uiNextLineOffset) - { // Increment the uiCurrentOffset - uiCurrentOffset++; - } - else - { // Go to next line - usCurrentX = usX; - usCurrentY++; - if (usCurrentY > usMaxY) - { - break; - } - uiStartOffset = (usCurrentY*usBufferWidth) + usCurrentX; - uiNextLineOffset = uiStartOffset + usBufferWidth; - uiCurrentOffset = uiStartOffset; - } - } - } - } - } + if (ubMode == PCX_NORMAL) + { + ubCurrentByte = *(pPcxBuffer + uiOffset++); + if (ubCurrentByte > 0x0BF) + { + ubRepCount = ubCurrentByte & 0x03F; + ubCurrentByte = *(pPcxBuffer + uiOffset++); + if (--ubRepCount > 0) + { + ubMode = PCX_RLE; + } + } + } + else + { + if (--ubRepCount == 0) + { + ubMode = PCX_NORMAL; + } + } + + if (usCurrentX < usMaxX) + { // We are within the visible bounds so we write the byte to buffer + *(pBuffer + uiCurrentOffset) = ubCurrentByte; + uiCurrentOffset++; + usCurrentX++; + } + else + { if ((uiCurrentOffset + 1)< uiNextLineOffset) + { // Increment the uiCurrentOffset + uiCurrentOffset++; + } + else + { // Go to next line + usCurrentX = usX; + usCurrentY++; + if (usCurrentY > usMaxY) + { + break; + } + uiStartOffset = (usCurrentY*usBufferWidth) + usCurrentX; + uiNextLineOffset = uiStartOffset + usBufferWidth; + uiCurrentOffset = uiStartOffset; + } + } + } + } + } return( TRUE ); } @@ -357,7 +357,7 @@ BOOLEAN BlitPcxToBuffer( PcxObject *pCurrentPcxObject, UINT8 *pBuffer, UINT16 us BOOLEAN SetPcxPalette( PcxObject *pCurrentPcxObject, HIMAGE hImage ) { UINT16 Index; - UINT8 *pubPalette; + UINT8 *pubPalette; pubPalette = &(pCurrentPcxObject->ubPalette[0]); @@ -369,14 +369,14 @@ BOOLEAN SetPcxPalette( PcxObject *pCurrentPcxObject, HIMAGE hImage ) return( FALSE ); } - // Initialize the proper palette entries - for (Index = 0; Index < 256; Index++) - { - hImage->pPalette[ Index ].peRed = *(pubPalette+(Index*3)); - hImage->pPalette[ Index ].peGreen = *(pubPalette+(Index*3)+1); - hImage->pPalette[ Index ].peBlue = *(pubPalette+(Index*3)+2); - hImage->pPalette[ Index ].peFlags = 0; - } + // Initialize the proper palette entries + for (Index = 0; Index < 256; Index++) + { + hImage->pPalette[ Index ].peRed = *(pubPalette+(Index*3)); + hImage->pPalette[ Index ].peGreen = *(pubPalette+(Index*3)+1); + hImage->pPalette[ Index ].peBlue = *(pubPalette+(Index*3)+2); + hImage->pPalette[ Index ].peFlags = 0; + } - return TRUE; -} \ No newline at end of file + return TRUE; +} diff --git a/Standard Gaming Platform/RAD.H b/Standard Gaming Platform/RAD.H index b4866509..baced4bd 100644 --- a/Standard Gaming Platform/RAD.H +++ b/Standard Gaming Platform/RAD.H @@ -5,175 +5,175 @@ #ifndef __RADRES__ -// __RADDOS__ means DOS code (16 or 32 bit) -// __RAD16__ means 16 bit code (Win16) -// __RAD32__ means 32 bit code (DOS, Win386, Win32s, Mac) -// __RADWIN__ means Windows code (Win16, Win386, Win32s) -// __RADWINEXT__ means Windows 386 extender (Win386) -// __RADNT__ means Win32s code -// __RADMAC__ means Macintosh -// __RAD68K__ means 68K Macintosh -// __RADPPC__ means PowerMac +// __RADDOS__ means DOS code (16 or 32 bit) +// __RAD16__ means 16 bit code (Win16) +// __RAD32__ means 32 bit code (DOS, Win386, Win32s, Mac) +// __RADWIN__ means Windows code (Win16, Win386, Win32s) +// __RADWINEXT__ means Windows 386 extender (Win386) +// __RADNT__ means Win32s code +// __RADMAC__ means Macintosh +// __RAD68K__ means 68K Macintosh +// __RADPPC__ means PowerMac #if (defined(__MWERKS__) && !defined(__INTEL__)) || defined(THINK_C) || defined(powerc) || defined(macintosh) || defined(__powerc) - #define __RADMAC__ - #if defined(powerc) || defined(__powerc) - #define __RADPPC__ - #else - #define __RAD68K__ - #endif + #define __RADMAC__ + #if defined(powerc) || defined(__powerc) + #define __RADPPC__ + #else + #define __RAD68K__ + #endif - #define __RAD32__ + #define __RAD32__ #else - #ifdef __DOS__ - #define __RADDOS__ - #endif + #ifdef __DOS__ + #define __RADDOS__ + #endif - #ifdef __386__ - #define __RAD32__ - #endif + #ifdef __386__ + #define __RAD32__ + #endif - #ifdef _Windows //For Borland - #ifdef __WIN32__ - #define WIN32 - #else - #define __WINDOWS__ - #endif - #endif + #ifdef _Windows //For Borland + #ifdef __WIN32__ + #define WIN32 + #else + #define __WINDOWS__ + #endif + #endif - #ifdef _WINDOWS //For MS - #ifndef _WIN32 - #define __WINDOWS__ - #endif - #endif + #ifdef _WINDOWS //For MS + #ifndef _WIN32 + #define __WINDOWS__ + #endif + #endif - #ifdef _WIN32 - #define __RADWIN__ - #define __RADNT__ - #define __RAD32__ - #else - #ifdef __NT__ - #define __RADWIN__ - #define __RADNT__ - #define __RAD32__ - #else - #ifdef __WINDOWS_386__ - #define __RADWIN__ - #define __RADWINEXT__ - #define __RAD32__ - #else - #ifdef __WINDOWS__ - #define __RADWIN__ - #define __RAD16__ - #else - #ifdef WIN32 - #define __RADWIN__ - #define __RADNT__ - #define __RAD32__ - #endif - #endif - #endif - #endif - #endif + #ifdef _WIN32 + #define __RADWIN__ + #define __RADNT__ + #define __RAD32__ + #else + #ifdef __NT__ + #define __RADWIN__ + #define __RADNT__ + #define __RAD32__ + #else + #ifdef __WINDOWS_386__ + #define __RADWIN__ + #define __RADWINEXT__ + #define __RAD32__ + #else + #ifdef __WINDOWS__ + #define __RADWIN__ + #define __RAD16__ + #else + #ifdef WIN32 + #define __RADWIN__ + #define __RADNT__ + #define __RAD32__ + #endif + #endif + #endif + #endif + #endif #endif #if (!defined(__RADDOS__) && !defined(__RADWIN__) && !defined(__RADMAC__)) - #error RAD.H did not detect your platform. Define __DOS__, __WINDOWS__, WIN32, macintosh, or powerc. + #error RAD.H did not detect your platform. Define __DOS__, __WINDOWS__, WIN32, macintosh, or powerc. #endif #ifdef __RADMAC__ - // this define is for CodeWarrior 11's stupid new libs (even though - // we don't use longlong's). + // this define is for CodeWarrior 11's stupid new libs (even though + // we don't use longlong's). - #define __MSL_LONGLONG_SUPPORT__ + #define __MSL_LONGLONG_SUPPORT__ - #define RADLINK - #define RADEXPLINK + #define RADLINK + #define RADEXPLINK - #ifdef __CFM68K__ - #ifdef __RADINDLL__ - #define RADEXPFUNC RADDEFFUNC __declspec(export) - #else - #define RADEXPFUNC RADDEFFUNC __declspec(import) - #endif - #else - #define RADEXPFUNC RADDEFFUNC - #endif - #define RADASMLINK + #ifdef __CFM68K__ + #ifdef __RADINDLL__ + #define RADEXPFUNC RADDEFFUNC __declspec(export) + #else + #define RADEXPFUNC RADDEFFUNC __declspec(import) + #endif + #else + #define RADEXPFUNC RADDEFFUNC + #endif + #define RADASMLINK #else - #ifdef __RADNT__ - #ifndef _WIN32 - #define _WIN32 - #endif - #ifndef WIN32 - #define WIN32 - #endif - #endif + #ifdef __RADNT__ + #ifndef _WIN32 + #define _WIN32 + #endif + #ifndef WIN32 + #define WIN32 + #endif + #endif - #ifdef __RADWIN__ - #ifdef __RAD32__ - #ifdef __RADNT__ + #ifdef __RADWIN__ + #ifdef __RAD32__ + #ifdef __RADNT__ - #define RADLINK __stdcall - #define RADEXPLINK __stdcall + #define RADLINK __stdcall + #define RADEXPLINK __stdcall - #ifdef __RADINEXE__ - #define RADEXPFUNC RADDEFFUNC - #else - #ifndef __RADINDLL__ - #define RADEXPFUNC RADDEFFUNC __declspec(dllimport) - #ifdef __BORLANDC__ - #if __BORLANDC__<=0x460 - #undef RADEXPFUNC - #define RADEXPFUNC RADDEFFUNC - #endif - #endif - #else - #define RADEXPFUNC RADDEFFUNC __declspec(dllexport) - #endif - #endif - #else - #define RADLINK __pascal - #define RADEXPLINK __far __pascal - #define RADEXPFUNC RADDEFFUNC - #endif - #else - #define RADLINK __pascal - #define RADEXPLINK __far __pascal __export - #define RADEXPFUNC RADDEFFUNC - #endif - #else - #define RADLINK __pascal - #define RADEXPLINK __pascal - #define RADEXPFUNC RADDEFFUNC - #endif + #ifdef __RADINEXE__ + #define RADEXPFUNC RADDEFFUNC + #else + #ifndef __RADINDLL__ + #define RADEXPFUNC RADDEFFUNC __declspec(dllimport) + #ifdef __BORLANDC__ + #if __BORLANDC__<=0x460 + #undef RADEXPFUNC + #define RADEXPFUNC RADDEFFUNC + #endif + #endif + #else + #define RADEXPFUNC RADDEFFUNC __declspec(dllexport) + #endif + #endif + #else + #define RADLINK __pascal + #define RADEXPLINK __far __pascal + #define RADEXPFUNC RADDEFFUNC + #endif + #else + #define RADLINK __pascal + #define RADEXPLINK __far __pascal __export + #define RADEXPFUNC RADDEFFUNC + #endif + #else + #define RADLINK __pascal + #define RADEXPLINK __pascal + #define RADEXPFUNC RADDEFFUNC + #endif - #define RADASMLINK __cdecl + #define RADASMLINK __cdecl #endif #ifdef __RADWIN__ - #ifndef _WINDOWS - #define _WINDOWS - #endif + #ifndef _WINDOWS + #define _WINDOWS + #endif #endif #ifdef __cplusplus - #define RADDEFFUNC extern "C" - #define RADDEFSTART extern "C" { - #define RADDEFEND } + #define RADDEFFUNC extern "C" + #define RADDEFSTART extern "C" { + #define RADDEFEND } #else - #define RADDEFFUNC - #define RADDEFSTART - #define RADDEFEND + #define RADDEFFUNC + #define RADDEFSTART + #define RADDEFEND #endif @@ -187,404 +187,404 @@ RADDEFSTART #define s64 signed __int64 #ifdef __RAD32__ - #define PTR4 + #define PTR4 - #define u16 unsigned short - #define s16 signed short + #define u16 unsigned short + #define s16 signed short - #ifdef __RADMAC__ + #ifdef __RADMAC__ - #include - #include - #include + #include + #include + #include - #define radstrlen strlen + #define radstrlen strlen - #define radmemset memset + #define radmemset memset - #define radmemcmp memcmp + #define radmemcmp memcmp - #define radmemcpy(dest,source,size) BlockMoveData((Ptr)(source),(Ptr)(dest),size) + #define radmemcpy(dest,source,size) BlockMoveData((Ptr)(source),(Ptr)(dest),size) - #define radmemcpydb(dest,source,size) BlockMoveData((Ptr)(source),(Ptr)(dest),size) + #define radmemcpydb(dest,source,size) BlockMoveData((Ptr)(source),(Ptr)(dest),size) - #define radstrcat strcat + #define radstrcat strcat - #define radstrcpy strcpy + #define radstrcpy strcpy - static u32 inline radsqr(s32 a) { return(a*a); } - - #ifdef __RAD68K__ + static u32 inline radsqr(s32 a) { return(a*a); } + + #ifdef __RAD68K__ - #pragma parameter __D0 mult64anddiv(__D0,__D1,__D2) - u32 mult64anddiv(u32 m1,u32 m2,u32 d) ={0x4C01,0x0C01,0x4C42,0x0C01}; - // muls.l d1,d1:d0 divs.l d2,d1:d0 - - #pragma parameter radconv32a(__A0,__D0) - void radconv32a(void* p,u32 n) ={0x4A80,0x600C,0x2210,0xE059,0x4841,0xE059,0x20C1,0x5380,0x6EF2}; - // tst.l d0 bra.s @loope @loop: move.l (a0),d1 ror.w #8,d1 swap d1 ror.w #8,d1 move.l d1,(a0)+ sub.l #1,d0 bgt.s @loop @loope: - - #else + #pragma parameter __D0 mult64anddiv(__D0,__D1,__D2) + u32 mult64anddiv(u32 m1,u32 m2,u32 d) ={0x4C01,0x0C01,0x4C42,0x0C01}; + // muls.l d1,d1:d0 divs.l d2,d1:d0 + + #pragma parameter radconv32a(__A0,__D0) + void radconv32a(void* p,u32 n) ={0x4A80,0x600C,0x2210,0xE059,0x4841,0xE059,0x20C1,0x5380,0x6EF2}; + // tst.l d0 bra.s @loope @loop: move.l (a0),d1 ror.w #8,d1 swap d1 ror.w #8,d1 move.l d1,(a0)+ sub.l #1,d0 bgt.s @loop @loope: + + #else - u32 mult64anddiv(u32 m1,u32 m2,u32 d); + u32 mult64anddiv(u32 m1,u32 m2,u32 d); - void radconv32a(void* p,u32 n); + void radconv32a(void* p,u32 n); - #endif + #endif - #else + #else - #ifdef __WATCOMC__ + #ifdef __WATCOMC__ - u32 radsqr(s32 a); - #pragma aux radsqr = "mul eax" parm [eax] modify [EDX eax]; + u32 radsqr(s32 a); + #pragma aux radsqr = "mul eax" parm [eax] modify [EDX eax]; - u32 mult64anddiv(u32 m1,u32 m2,u32 d); - #pragma aux mult64anddiv = "mul ecx" "div ebx" parm [eax] [ecx] [ebx] modify [EDX eax]; + u32 mult64anddiv(u32 m1,u32 m2,u32 d); + #pragma aux mult64anddiv = "mul ecx" "div ebx" parm [eax] [ecx] [ebx] modify [EDX eax]; - s32 radabs(s32 ab); - #pragma aux radabs = "test eax,eax" "jge skip" "neg eax" "skip:" parm [eax]; + s32 radabs(s32 ab); + #pragma aux radabs = "test eax,eax" "jge skip" "neg eax" "skip:" parm [eax]; - #define radabs32 radabs + #define radabs32 radabs - u32 DOSOut(const char* str); - #pragma aux DOSOut = "cld" "mov ecx,0xffffffff" "xor eax,eax" "mov edx,edi" "repne scasb" "not ecx" "dec ecx" "mov ebx,1" "mov ah,0x40" "int 0x21" parm [EDI] modify [EAX EBX ECX EDX EDI] value [ecx]; - - void DOSOutNum(const char* str,u32 len); - #pragma aux DOSOutNum = "mov ah,0x40" "mov ebx,1" "int 0x21" parm [edx] [ecx] modify [eax ebx]; + u32 DOSOut(const char* str); + #pragma aux DOSOut = "cld" "mov ecx,0xffffffff" "xor eax,eax" "mov edx,edi" "repne scasb" "not ecx" "dec ecx" "mov ebx,1" "mov ah,0x40" "int 0x21" parm [EDI] modify [EAX EBX ECX EDX EDI] value [ecx]; + + void DOSOutNum(const char* str,u32 len); + #pragma aux DOSOutNum = "mov ah,0x40" "mov ebx,1" "int 0x21" parm [edx] [ecx] modify [eax ebx]; - u32 ErrOut(const char* str); - #pragma aux ErrOut = "cld" "mov ecx,0xffffffff" "xor eax,eax" "mov edx,edi" "repne scasb" "not ecx" "dec ecx" "xor ebx,ebx" "mov ah,0x40" "int 0x21" parm [EDI] modify [EAX EBX ECX EDX EDI] value [ecx]; - - void ErrOutNum(const char* str,u32 len); - #pragma aux ErrOutNum = "mov ah,0x40" "xor ebx,ebx" "int 0x21" parm [edx] [ecx] modify [eax ebx]; + u32 ErrOut(const char* str); + #pragma aux ErrOut = "cld" "mov ecx,0xffffffff" "xor eax,eax" "mov edx,edi" "repne scasb" "not ecx" "dec ecx" "xor ebx,ebx" "mov ah,0x40" "int 0x21" parm [EDI] modify [EAX EBX ECX EDX EDI] value [ecx]; + + void ErrOutNum(const char* str,u32 len); + #pragma aux ErrOutNum = "mov ah,0x40" "xor ebx,ebx" "int 0x21" parm [edx] [ecx] modify [eax ebx]; - void radmemset16(void* dest,u16 value,u32 size); - #pragma aux radmemset16 = "cld" "mov bx,ax" "shl eax,16" "mov ax,bx" "mov bl,cl" "shr ecx,1" "rep stosd" "mov cl,bl" "and cl,1" "rep stosw" parm [EDI] [EAX] [ECX] modify [EAX EDX EBX ECX EDI]; - - void radmemset(void* dest,u8 value,u32 size); - #pragma aux radmemset = "cld" "mov ah,al" "mov bx,ax" "shl eax,16" "mov ax,bx" "mov bl,cl" "shr ecx,2" "and bl,3" "rep stosd" "mov cl,bl" "rep stosb" parm [EDI] [AL] [ECX] modify [EAX EDX EBX ECX EDI]; + void radmemset16(void* dest,u16 value,u32 size); + #pragma aux radmemset16 = "cld" "mov bx,ax" "shl eax,16" "mov ax,bx" "mov bl,cl" "shr ecx,1" "rep stosd" "mov cl,bl" "and cl,1" "rep stosw" parm [EDI] [EAX] [ECX] modify [EAX EDX EBX ECX EDI]; + + void radmemset(void* dest,u8 value,u32 size); + #pragma aux radmemset = "cld" "mov ah,al" "mov bx,ax" "shl eax,16" "mov ax,bx" "mov bl,cl" "shr ecx,2" "and bl,3" "rep stosd" "mov cl,bl" "rep stosb" parm [EDI] [AL] [ECX] modify [EAX EDX EBX ECX EDI]; - void radmemset32(void* dest,u32 value,u32 size); - #pragma aux radmemset32 = "cld" "rep stosd" parm [EDI] [EAX] [ECX] modify [EAX EDX EBX ECX EDI]; + void radmemset32(void* dest,u32 value,u32 size); + #pragma aux radmemset32 = "cld" "rep stosd" parm [EDI] [EAX] [ECX] modify [EAX EDX EBX ECX EDI]; - void radmemcpy(void* dest,const void* source,u32 size); - #pragma aux radmemcpy = "cld" "mov bl,cl" "shr ecx,2" "rep movsd" "mov cl,bl" "and cl,3" "rep movsb" parm [EDI] [ESI] [ECX] modify [EBX ECX EDI ESI]; + void radmemcpy(void* dest,const void* source,u32 size); + #pragma aux radmemcpy = "cld" "mov bl,cl" "shr ecx,2" "rep movsd" "mov cl,bl" "and cl,3" "rep movsb" parm [EDI] [ESI] [ECX] modify [EBX ECX EDI ESI]; - void __far *radfmemcpy(void __far* dest,const void __far* source,u32 size); - #pragma aux radfmemcpy = "cld" "push es" "push ds" "mov es,cx" "mov ds,dx" "mov ecx,eax" "shr ecx,2" "rep movsd" "mov cl,al" "and cl,3" "rep movsb" "pop ds" "pop es" parm [CX EDI] [DX ESI] [EAX] modify [ECX EDI ESI] value [CX EDI]; + void __far *radfmemcpy(void __far* dest,const void __far* source,u32 size); + #pragma aux radfmemcpy = "cld" "push es" "push ds" "mov es,cx" "mov ds,dx" "mov ecx,eax" "shr ecx,2" "rep movsd" "mov cl,al" "and cl,3" "rep movsb" "pop ds" "pop es" parm [CX EDI] [DX ESI] [EAX] modify [ECX EDI ESI] value [CX EDI]; - void radmemcpydb(void* dest,const void* source,u32 size); //Destination bigger - #pragma aux radmemcpydb = "std" "mov bl,cl" "lea esi,[esi+ecx-4]" "lea edi,[edi+ecx-4]" "shr ecx,2" "rep movsd" "and bl,3" "jz dne" "add esi,3" "add edi,3" "mov cl,bl" "rep movsb" "dne:" "cld" parm [EDI] [ESI] [ECX] modify [EBX ECX EDI ESI]; + void radmemcpydb(void* dest,const void* source,u32 size); //Destination bigger + #pragma aux radmemcpydb = "std" "mov bl,cl" "lea esi,[esi+ecx-4]" "lea edi,[edi+ecx-4]" "shr ecx,2" "rep movsd" "and bl,3" "jz dne" "add esi,3" "add edi,3" "mov cl,bl" "rep movsb" "dne:" "cld" parm [EDI] [ESI] [ECX] modify [EBX ECX EDI ESI]; - char* radstrcpy(void* dest,const void* source); - #pragma aux radstrcpy = "cld" "mov edx,edi" "lp:" "mov al,[esi]" "inc esi" "mov [edi],al" "inc edi" "cmp al,0" "jne lp" parm [EDI] [ESI] modify [EAX EDX EDI ESI] value [EDX]; + char* radstrcpy(void* dest,const void* source); + #pragma aux radstrcpy = "cld" "mov edx,edi" "lp:" "mov al,[esi]" "inc esi" "mov [edi],al" "inc edi" "cmp al,0" "jne lp" parm [EDI] [ESI] modify [EAX EDX EDI ESI] value [EDX]; - char __far* radfstrcpy(void __far* dest,const void __far* source); - #pragma aux radfstrcpy = "cld" "push es" "push ds" "mov es,cx" "mov ds,dx" "mov edx,edi" "lp:" "lodsb" "stosb" "test al,0xff" "jnz lp" "pop ds" "pop es" parm [CX EDI] [DX ESI] modify [EAX EDX EDI ESI] value [CX EDX]; + char __far* radfstrcpy(void __far* dest,const void __far* source); + #pragma aux radfstrcpy = "cld" "push es" "push ds" "mov es,cx" "mov ds,dx" "mov edx,edi" "lp:" "lodsb" "stosb" "test al,0xff" "jnz lp" "pop ds" "pop es" parm [CX EDI] [DX ESI] modify [EAX EDX EDI ESI] value [CX EDX]; - char* radstpcpy(void* dest,const void* source); - #pragma aux radstpcpy = "cld" "lp:" "mov al,[esi]" "inc esi" "mov [edi],al" "inc edi" "cmp al,0" "jne lp" "dec edi" parm [EDI] [ESI] modify [EAX EDI ESI] value [EDI]; + char* radstpcpy(void* dest,const void* source); + #pragma aux radstpcpy = "cld" "lp:" "mov al,[esi]" "inc esi" "mov [edi],al" "inc edi" "cmp al,0" "jne lp" "dec edi" parm [EDI] [ESI] modify [EAX EDI ESI] value [EDI]; - char* radstpcpyrs(void* dest,const void* source); - #pragma aux radstpcpyrs = "cld" "lp:" "mov al,[esi]" "inc esi" "mov [edi],al" "inc edi" "cmp al,0" "jne lp" "dec esi" parm [EDI] [ESI] modify [EAX EDI ESI] value [ESI]; + char* radstpcpyrs(void* dest,const void* source); + #pragma aux radstpcpyrs = "cld" "lp:" "mov al,[esi]" "inc esi" "mov [edi],al" "inc edi" "cmp al,0" "jne lp" "dec esi" parm [EDI] [ESI] modify [EAX EDI ESI] value [ESI]; - u32 radstrlen(const void* dest); - #pragma aux radstrlen = "cld" "mov ecx,0xffffffff" "xor eax,eax" "repne scasb" "not ecx" "dec ecx" parm [EDI] modify [EAX ECX EDI] value [ECX]; - - char* radstrcat(void* dest,const void* source); - #pragma aux radstrcat = "cld" "mov ecx,0xffffffff" "mov edx,edi" "xor eax,eax" "repne scasb" "dec edi" "lp:" "lodsb" "stosb" "test al,0xff" "jnz lp" \ - parm [EDI] [ESI] modify [EAX ECX EDI ESI] value [EDX]; - - char* radstrchr(const void* dest,char chr); - #pragma aux radstrchr = "cld" "lp:" "lodsb" "cmp al,dl" "je fnd" "cmp al,0" "jnz lp" "mov esi,1" "fnd:" "dec esi" parm [ESI] [DL] modify [EAX ESI] value [esi]; + u32 radstrlen(const void* dest); + #pragma aux radstrlen = "cld" "mov ecx,0xffffffff" "xor eax,eax" "repne scasb" "not ecx" "dec ecx" parm [EDI] modify [EAX ECX EDI] value [ECX]; + + char* radstrcat(void* dest,const void* source); + #pragma aux radstrcat = "cld" "mov ecx,0xffffffff" "mov edx,edi" "xor eax,eax" "repne scasb" "dec edi" "lp:" "lodsb" "stosb" "test al,0xff" "jnz lp" \ + parm [EDI] [ESI] modify [EAX ECX EDI ESI] value [EDX]; + + char* radstrchr(const void* dest,char chr); + #pragma aux radstrchr = "cld" "lp:" "lodsb" "cmp al,dl" "je fnd" "cmp al,0" "jnz lp" "mov esi,1" "fnd:" "dec esi" parm [ESI] [DL] modify [EAX ESI] value [esi]; - s8 radmemcmp(const void* s1,const void* s2,u32 len); - #pragma aux radmemcmp = "cld" "rep cmpsb" "setne al" "jbe end" "neg al" "end:" parm [EDI] [ESI] [ECX] modify [ECX EDI ESI]; + s8 radmemcmp(const void* s1,const void* s2,u32 len); + #pragma aux radmemcmp = "cld" "rep cmpsb" "setne al" "jbe end" "neg al" "end:" parm [EDI] [ESI] [ECX] modify [ECX EDI ESI]; - s8 radstrcmp(const void* s1,const void* s2); - #pragma aux radstrcmp = "lp:" "mov al,[esi]" "mov ah,[edi]" "cmp al,ah" "jne set" "cmp al,0" "je set" "inc esi" "inc edi" "jmp lp" "set:" "setne al" "jbe end" "neg al" "end:" \ - parm [EDI] [ESI] modify [EAX EDI ESI]; + s8 radstrcmp(const void* s1,const void* s2); + #pragma aux radstrcmp = "lp:" "mov al,[esi]" "mov ah,[edi]" "cmp al,ah" "jne set" "cmp al,0" "je set" "inc esi" "inc edi" "jmp lp" "set:" "setne al" "jbe end" "neg al" "end:" \ + parm [EDI] [ESI] modify [EAX EDI ESI]; - s8 radstricmp(const void* s1,const void* s2); - #pragma aux radstricmp = "lp:" "mov al,[esi]" "mov ah,[edi]" "cmp al,'a'" "jb c1" "cmp al,'z'" "ja c1" "sub al,32" "c1:" "cmp ah,'a'" "jb c2" "cmp ah,'z'" "ja c2" "sub ah,32" "c2:" "cmp al,ah" "jne set" "cmp al,0" "je set" \ - "inc esi" "inc edi" "jmp lp" "set:" "setne al" "jbe end" "neg al" "end:" \ - parm [EDI] [ESI] modify [EAX EDI ESI]; + s8 radstricmp(const void* s1,const void* s2); + #pragma aux radstricmp = "lp:" "mov al,[esi]" "mov ah,[edi]" "cmp al,'a'" "jb c1" "cmp al,'z'" "ja c1" "sub al,32" "c1:" "cmp ah,'a'" "jb c2" "cmp ah,'z'" "ja c2" "sub ah,32" "c2:" "cmp al,ah" "jne set" "cmp al,0" "je set" \ + "inc esi" "inc edi" "jmp lp" "set:" "setne al" "jbe end" "neg al" "end:" \ + parm [EDI] [ESI] modify [EAX EDI ESI]; - s8 radstrnicmp(const void* s1,const void* s2,u32 len); - #pragma aux radstrnicmp = "lp:" "mov al,[esi]" "mov ah,[edi]" "cmp al,'a'" "jb c1" "cmp al,'z'" "ja c1" "sub al,32" "c1:" "cmp ah,'a'" "jb c2" "cmp ah,'z'" "ja c2" "sub ah,32" "c2:" "cmp al,ah" "jne set" "cmp al,0" "je set" \ - "dec ecx" "jz set" "inc esi" "inc edi" "jmp lp" "set:" "setne al" "jbe end" "neg al" "end:" \ - parm [EDI] [ESI] [ECX] modify [EAX ECX EDI ESI]; + s8 radstrnicmp(const void* s1,const void* s2,u32 len); + #pragma aux radstrnicmp = "lp:" "mov al,[esi]" "mov ah,[edi]" "cmp al,'a'" "jb c1" "cmp al,'z'" "ja c1" "sub al,32" "c1:" "cmp ah,'a'" "jb c2" "cmp ah,'z'" "ja c2" "sub ah,32" "c2:" "cmp al,ah" "jne set" "cmp al,0" "je set" \ + "dec ecx" "jz set" "inc esi" "inc edi" "jmp lp" "set:" "setne al" "jbe end" "neg al" "end:" \ + parm [EDI] [ESI] [ECX] modify [EAX ECX EDI ESI]; - char* radstrupr(void* s1); - #pragma aux radstrupr = "mov ecx,edi" "lp:" "mov al,[edi]" "cmp al,'a'" "jb c1" "cmp al,'z'" "ja c1" "sub [edi],32" "c1:" "inc edi" "cmp al,0" "jne lp" parm [EDI] modify [EAX EDI] value [ecx]; + char* radstrupr(void* s1); + #pragma aux radstrupr = "mov ecx,edi" "lp:" "mov al,[edi]" "cmp al,'a'" "jb c1" "cmp al,'z'" "ja c1" "sub [edi],32" "c1:" "inc edi" "cmp al,0" "jne lp" parm [EDI] modify [EAX EDI] value [ecx]; - char* radstrlwr(void* s1); - #pragma aux radstrlwr = "mov ecx,edi" "lp:" "mov al,[edi]" "cmp al,'A'" "jb c1" "cmp al,'Z'" "ja c1" "add [edi],32" "c1:" "inc edi" "cmp al,0" "jne lp" parm [EDI] modify [EAX EDI] value [ecx]; + char* radstrlwr(void* s1); + #pragma aux radstrlwr = "mov ecx,edi" "lp:" "mov al,[edi]" "cmp al,'A'" "jb c1" "cmp al,'Z'" "ja c1" "add [edi],32" "c1:" "inc edi" "cmp al,0" "jne lp" parm [EDI] modify [EAX EDI] value [ecx]; - u32 radstru32(const void* dest); - #pragma aux radstru32 = "cld" "xor ecx,ecx" "xor ebx,ebx" "xor edi,edi" "lodsb" "cmp al,45" "jne skip2" "mov edi,1" "jmp skip" "lp:" "mov eax,10" "mul ecx" "lea ecx,[eax+ebx]" \ - "skip:" "lodsb" "skip2:" "cmp al,0x39" "ja dne" "cmp al,0x30" "jb dne" "mov bl,al" "sub bl,0x30" "jmp lp" "dne:" "test edi,1" "jz pos" "neg ecx" "pos:" \ - parm [ESI] modify [EAX EBX EDX EDI ESI] value [ecx]; - - u16 GetDS(); - #pragma aux GetDS = "mov ax,ds" value [ax]; + u32 radstru32(const void* dest); + #pragma aux radstru32 = "cld" "xor ecx,ecx" "xor ebx,ebx" "xor edi,edi" "lodsb" "cmp al,45" "jne skip2" "mov edi,1" "jmp skip" "lp:" "mov eax,10" "mul ecx" "lea ecx,[eax+ebx]" \ + "skip:" "lodsb" "skip2:" "cmp al,0x39" "ja dne" "cmp al,0x30" "jb dne" "mov bl,al" "sub bl,0x30" "jmp lp" "dne:" "test edi,1" "jz pos" "neg ecx" "pos:" \ + parm [ESI] modify [EAX EBX EDX EDI ESI] value [ecx]; + + u16 GetDS(); + #pragma aux GetDS = "mov ax,ds" value [ax]; - #ifdef __RADWINEXT__ - - #define _16To32(ptr16) ((void*)(((GetSelectorBase((u16)(((u32)(ptr16))>>16))+((u16)(u32)(ptr16)))-GetSelectorBase(GetDS())))) + #ifdef __RADWINEXT__ + + #define _16To32(ptr16) ((void*)(((GetSelectorBase((u16)(((u32)(ptr16))>>16))+((u16)(u32)(ptr16)))-GetSelectorBase(GetDS())))) - #endif + #endif - #ifndef __RADWIN__ - #define int86 int386 - #define int86x int386x - #endif - - #define u32regs x - #define u16regs w - - #else + #ifndef __RADWIN__ + #define int86 int386 + #define int86x int386x + #endif + + #define u32regs x + #define u16regs w + + #else - #define radstrcpy strcpy - #define radstrcat strcat - #define radmemcpy memcpy - #define radmemcpydb memmove - #define radmemcmp memcmp - #define radmemset memset - #define radstrlen strlen - #define radstrchr strchr - #define radtoupper toupper - #define radstru32(s) ((u32)atol(s)) - #define radstricmp _stricmp - #define radstrcmp strcmp - #define radstrupr _strupr - #define radstrlwr _strlwr - #define BreakPoint() _asm {int 3} + #define radstrcpy strcpy + #define radstrcat strcat + #define radmemcpy memcpy + #define radmemcpydb memmove + #define radmemcmp memcmp + #define radmemset memset + #define radstrlen strlen + #define radstrchr strchr + #define radtoupper toupper + #define radstru32(s) ((u32)atol(s)) + #define radstricmp _stricmp + #define radstrcmp strcmp + #define radstrupr _strupr + #define radstrlwr _strlwr + #define BreakPoint() _asm {int 3} - #ifdef _MSC_VER + #ifdef _MSC_VER - #pragma warning( disable : 4035) + #pragma warning( disable : 4035) - typedef char* RADPCHAR; + typedef char* RADPCHAR; - u32 __inline radsqr(u32 m) { - _asm { - mov eax,[m] - mul eax - } - } + u32 __inline radsqr(u32 m) { + _asm { + mov eax,[m] + mul eax + } + } - u32 __inline mult64anddiv(u32 m1,u32 m2, u32 d) { - _asm { - mov eax,[m1] - mov ecx,[m2] - mul ecx - mov ecx,[d] - div ecx - } - } + u32 __inline mult64anddiv(u32 m1,u32 m2, u32 d) { + _asm { + mov eax,[m1] + mov ecx,[m2] + mul ecx + mov ecx,[d] + div ecx + } + } - s32 __inline radabs(s32 ab) { - _asm { - mov eax,[ab] - test eax,eax - jge skip - neg eax - skip: - } - } + s32 __inline radabs(s32 ab) { + _asm { + mov eax,[ab] + test eax,eax + jge skip + neg eax + skip: + } + } - u8 __inline radinp(u16 p) { - _asm { - mov dx,[p] - in al,dx - } - } + u8 __inline radinp(u16 p) { + _asm { + mov dx,[p] + in al,dx + } + } - void __inline radoutp(u16 p,u8 v) { - _asm { - mov dx,[p] - mov al,[v] - out dx,al - } - } + void __inline radoutp(u16 p,u8 v) { + _asm { + mov dx,[p] + mov al,[v] + out dx,al + } + } - RADPCHAR __inline radstpcpy(char* p1, char* p2) { - _asm { - mov edx,[p1] - mov ecx,[p2] - cld - lp: - mov al,[ecx] - inc ecx - mov [edx],al - inc edx - cmp al,0 - jne lp - dec edx - mov eax,edx - } - } - - RADPCHAR __inline radstpcpyrs(char* p1, char* p2) { - _asm { - mov edx,[p1] - mov ecx,[p2] - cld - lp: - mov al,[ecx] - inc ecx - mov [edx],al - inc edx - cmp al,0 - jne lp - dec ecx - mov eax,ecx - } - } + RADPCHAR __inline radstpcpy(char* p1, char* p2) { + _asm { + mov edx,[p1] + mov ecx,[p2] + cld + lp: + mov al,[ecx] + inc ecx + mov [edx],al + inc edx + cmp al,0 + jne lp + dec edx + mov eax,edx + } + } + + RADPCHAR __inline radstpcpyrs(char* p1, char* p2) { + _asm { + mov edx,[p1] + mov ecx,[p2] + cld + lp: + mov al,[ecx] + inc ecx + mov [edx],al + inc edx + cmp al,0 + jne lp + dec ecx + mov eax,ecx + } + } - void __inline radmemset16(void* dest,u16 value,u32 sizeb) { - _asm { - mov edi,[dest] - mov ax,[value] - mov ecx,[sizeb] - shl eax,16 - cld - mov ax,[value] - mov bl,cl - shr ecx,1 - rep stosd - mov cl,bl - and cl,1 - rep stosw - } - } + void __inline radmemset16(void* dest,u16 value,u32 sizeb) { + _asm { + mov edi,[dest] + mov ax,[value] + mov ecx,[sizeb] + shl eax,16 + cld + mov ax,[value] + mov bl,cl + shr ecx,1 + rep stosd + mov cl,bl + and cl,1 + rep stosw + } + } - void __inline radmemset32(void* dest,u32 value,u32 sizeb) { - _asm { - mov edi,[dest] - mov eax,[value] - mov ecx,[sizeb] - cld - rep stosd - } - } + void __inline radmemset32(void* dest,u32 value,u32 sizeb) { + _asm { + mov edi,[dest] + mov eax,[value] + mov ecx,[sizeb] + cld + rep stosd + } + } - u32 __inline __stdcall RADsqrt(u32 sq) { - _asm { - fild dword ptr [sq] - fsqrt - fistp word ptr [sq] - movzx eax,word ptr [sq] - } - } + u32 __inline __stdcall RADsqrt(u32 sq) { + _asm { + fild dword ptr [sq] + fsqrt + fistp word ptr [sq] + movzx eax,word ptr [sq] + } + } - void __inline RADCycleTimerStartAddr(u32* addr) - { - _asm { - mov ecx,[addr] - __asm __emit 0fh __asm __emit 031h - mov [ecx],eax - } - } + void __inline RADCycleTimerStartAddr(u32* addr) + { + _asm { + mov ecx,[addr] + __asm __emit 0fh __asm __emit 031h + mov [ecx],eax + } + } - u32 __inline RADCycleTimerDeltaAddr(u32* addr) - { - _asm { - __asm __emit 0fh __asm __emit 031h - mov ecx,[addr] - sub eax,[ecx] - } - } + u32 __inline RADCycleTimerDeltaAddr(u32* addr) + { + _asm { + __asm __emit 0fh __asm __emit 031h + mov ecx,[addr] + sub eax,[ecx] + } + } - #define RADCycleTimerStart(var) RADCycleTimerStartAddr(&var) - #define RADCycleTimerDelta(var) RADCycleTimerDeltaAddr(&var) + #define RADCycleTimerStart(var) RADCycleTimerStartAddr(&var) + #define RADCycleTimerDelta(var) RADCycleTimerDeltaAddr(&var) - #pragma warning( default : 4035) + #pragma warning( default : 4035) - #endif + #endif - #endif + #endif - #endif + #endif #else - #define PTR4 __far - - #define u16 unsigned int - #define s16 signed int + #define PTR4 __far + + #define u16 unsigned int + #define s16 signed int - #ifdef __WATCOMC__ - - u32 radsqr(s32 a); - #pragma aux radsqr = "shl edx,16" "mov dx,ax" "mov eax,edx" "xor edx,edx" "mul eax" "shld edx,eax,16" parm [dx ax] modify [DX ax] value [dx ax]; + #ifdef __WATCOMC__ + + u32 radsqr(s32 a); + #pragma aux radsqr = "shl edx,16" "mov dx,ax" "mov eax,edx" "xor edx,edx" "mul eax" "shld edx,eax,16" parm [dx ax] modify [DX ax] value [dx ax]; - s16 radabs(s16 ab); - #pragma aux radabs = "test ax,ax" "jge skip" "neg ax" "skip:" parm [ax] value [ax]; - - s32 radabs32(s32 ab); - #pragma aux radabs32 = "test dx,dx" "jge skip" "neg dx" "neg ax" "sbb dx,0" "skip:" parm [dx ax] value [dx ax]; - - u32 DOSOut(const char far* dest); - #pragma aux DOSOut = "cld" "and edi,0xffff" "mov dx,di" "mov ecx,0xffffffff" "xor eax,eax" 0x67 "repne scasb" "not ecx" "dec ecx" "mov bx,1" "push ds" "push es" "pop ds" "mov ah,0x40" "int 0x21" "pop ds" "movzx eax,cx" "shr ecx,16" \ - parm [ES DI] modify [AX BX CX DX DI ES] value [CX AX]; - - void DOSOutNum(const char far* str,u16 len); - #pragma aux DOSOutNum = "push ds" "mov ds,cx" "mov cx,bx" "mov ah,0x40" "mov bx,1" "int 0x21" "pop ds" parm [cx dx] [bx] modify [ax bx cx]; + s16 radabs(s16 ab); + #pragma aux radabs = "test ax,ax" "jge skip" "neg ax" "skip:" parm [ax] value [ax]; + + s32 radabs32(s32 ab); + #pragma aux radabs32 = "test dx,dx" "jge skip" "neg dx" "neg ax" "sbb dx,0" "skip:" parm [dx ax] value [dx ax]; + + u32 DOSOut(const char far* dest); + #pragma aux DOSOut = "cld" "and edi,0xffff" "mov dx,di" "mov ecx,0xffffffff" "xor eax,eax" 0x67 "repne scasb" "not ecx" "dec ecx" "mov bx,1" "push ds" "push es" "pop ds" "mov ah,0x40" "int 0x21" "pop ds" "movzx eax,cx" "shr ecx,16" \ + parm [ES DI] modify [AX BX CX DX DI ES] value [CX AX]; + + void DOSOutNum(const char far* str,u16 len); + #pragma aux DOSOutNum = "push ds" "mov ds,cx" "mov cx,bx" "mov ah,0x40" "mov bx,1" "int 0x21" "pop ds" parm [cx dx] [bx] modify [ax bx cx]; - u32 ErrOut(const char far* dest); - #pragma aux ErrOut = "cld" "and edi,0xffff" "mov dx,di" "mov ecx,0xffffffff" "xor eax,eax" 0x67 "repne scasb" "not ecx" "dec ecx" "xor bx,bx" "push ds" "push es" "pop ds" "mov ah,0x40" "int 0x21" "pop ds" "movzx eax,cx" "shr ecx,16" \ - parm [ES DI] modify [AX BX CX DX DI ES] value [CX AX]; - - void ErrOutNum(const char far* str,u16 len); - #pragma aux ErrOutNum = "push ds" "mov ds,cx" "mov cx,bx" "mov ah,0x40" "xor bx,bx" "int 0x21" "pop ds" parm [cx dx] [bx] modify [ax bx cx]; + u32 ErrOut(const char far* dest); + #pragma aux ErrOut = "cld" "and edi,0xffff" "mov dx,di" "mov ecx,0xffffffff" "xor eax,eax" 0x67 "repne scasb" "not ecx" "dec ecx" "xor bx,bx" "push ds" "push es" "pop ds" "mov ah,0x40" "int 0x21" "pop ds" "movzx eax,cx" "shr ecx,16" \ + parm [ES DI] modify [AX BX CX DX DI ES] value [CX AX]; + + void ErrOutNum(const char far* str,u16 len); + #pragma aux ErrOutNum = "push ds" "mov ds,cx" "mov cx,bx" "mov ah,0x40" "xor bx,bx" "int 0x21" "pop ds" parm [cx dx] [bx] modify [ax bx cx]; - void radmemset(void far *dest,u8 value,u32 size); - #pragma aux radmemset = "cld" "and edi,0ffffh" "shl ecx,16" "mov cx,bx" "mov ah,al" "mov bx,ax" "shl eax,16" "mov ax,bx" "mov bl,cl" "shr ecx,2" 0x67 "rep stosd" "mov cl,bl" "and cl,3" "rep stosb" parm [ES DI] [AL] [CX BX]; - - void radmemset16(void far* dest,u16 value,u32 size); - #pragma aux radmemset16 = "cld" "and edi,0ffffh" "shl ecx,16" "mov cx,bx" "mov bx,ax" "shl eax,16" "mov ax,bx" "mov bl,cl" "shr ecx,1" "rep stosd" "mov cl,bl" "and cl,1" "rep stosw" parm [ES DI] [AX] [CX BX]; + void radmemset(void far *dest,u8 value,u32 size); + #pragma aux radmemset = "cld" "and edi,0ffffh" "shl ecx,16" "mov cx,bx" "mov ah,al" "mov bx,ax" "shl eax,16" "mov ax,bx" "mov bl,cl" "shr ecx,2" 0x67 "rep stosd" "mov cl,bl" "and cl,3" "rep stosb" parm [ES DI] [AL] [CX BX]; + + void radmemset16(void far* dest,u16 value,u32 size); + #pragma aux radmemset16 = "cld" "and edi,0ffffh" "shl ecx,16" "mov cx,bx" "mov bx,ax" "shl eax,16" "mov ax,bx" "mov bl,cl" "shr ecx,1" "rep stosd" "mov cl,bl" "and cl,1" "rep stosw" parm [ES DI] [AX] [CX BX]; - void radmemcpy(void far* dest,const void far* source,u32 size); - #pragma aux radmemcpy = "cld" "push ds" "mov ds,dx" "and esi,0ffffh" "and edi,0ffffh" "shl ecx,16" "mov cx,bx" "shr ecx,2" 0x67 "rep movsd" "mov cl,bl" "and cl,3" "rep movsb" "pop ds" parm [ES DI] [DX SI] [CX BX] modify [CX SI DI ES]; - - s8 radmemcmp(const void far* s1,const void far* s2,u32 len); - #pragma aux radmemcmp = "cld" "push ds" "mov ds,dx" "shl ecx,16" "mov cx,bx" "rep cmpsb" "setne al" "jbe end" "neg al" "end:" "pop ds" parm [ES DI] [DX SI] [CX BX] modify [CX SI DI ES]; + void radmemcpy(void far* dest,const void far* source,u32 size); + #pragma aux radmemcpy = "cld" "push ds" "mov ds,dx" "and esi,0ffffh" "and edi,0ffffh" "shl ecx,16" "mov cx,bx" "shr ecx,2" 0x67 "rep movsd" "mov cl,bl" "and cl,3" "rep movsb" "pop ds" parm [ES DI] [DX SI] [CX BX] modify [CX SI DI ES]; + + s8 radmemcmp(const void far* s1,const void far* s2,u32 len); + #pragma aux radmemcmp = "cld" "push ds" "mov ds,dx" "shl ecx,16" "mov cx,bx" "rep cmpsb" "setne al" "jbe end" "neg al" "end:" "pop ds" parm [ES DI] [DX SI] [CX BX] modify [CX SI DI ES]; - char far* radstrcpy(void far* dest,const void far* source); - #pragma aux radstrcpy = "cld" "push ds" "mov ds,dx" "and esi,0xffff" "and edi,0xffff" "mov dx,di" "lp:" "lodsb" "stosb" "test al,0xff" "jnz lp" "pop ds" parm [ES DI] [DX SI] modify [AX DX DI SI ES] value [es dx]; + char far* radstrcpy(void far* dest,const void far* source); + #pragma aux radstrcpy = "cld" "push ds" "mov ds,dx" "and esi,0xffff" "and edi,0xffff" "mov dx,di" "lp:" "lodsb" "stosb" "test al,0xff" "jnz lp" "pop ds" parm [ES DI] [DX SI] modify [AX DX DI SI ES] value [es dx]; - char far* radstpcpy(void far* dest,const void far* source); - #pragma aux radstpcpy = "cld" "push ds" "mov ds,dx" "and esi,0xffff" "and edi,0xffff" "lp:" "lodsb" "stosb" "test al,0xff" "jnz lp" "dec di" "pop ds" parm [ES DI] [DX SI] modify [DI SI ES] value [es di]; + char far* radstpcpy(void far* dest,const void far* source); + #pragma aux radstpcpy = "cld" "push ds" "mov ds,dx" "and esi,0xffff" "and edi,0xffff" "lp:" "lodsb" "stosb" "test al,0xff" "jnz lp" "dec di" "pop ds" parm [ES DI] [DX SI] modify [DI SI ES] value [es di]; - u32 radstrlen(const void far* dest); - #pragma aux radstrlen = "cld" "and edi,0xffff" "mov ecx,0xffffffff" "xor eax,eax" 0x67 "repne scasb" "not ecx" "dec ecx" "movzx eax,cx" "shr ecx,16" parm [ES DI] modify [AX CX DI ES] value [CX AX]; - - char far* radstrcat(void far* dest,const void far* source); - #pragma aux radstrcat = "cld" "and edi,0xffff" "mov ecx,0xffffffff" "and esi,0xffff" "push ds" "mov ds,dx" "mov dx,di" "xor eax,eax" 0x67 "repne scasb" "dec edi" "lp:" "lodsb" "stosb" "test al,0xff" "jnz lp" "pop ds" \ - parm [ES DI] [DX SI] modify [AX CX DI SI ES] value [es dx]; - - char far* radstrchr(const void far* dest,char chr); - #pragma aux radstrchr = "cld" "lp:" 0x26 "lodsb" "cmp al,dl" "je fnd" "cmp al,0" "jnz lp" "xor ax,ax" "mov es,ax" "mov si,1" "fnd:" "dec si" parm [ES SI] [DL] modify [AX SI ES] value [es si]; - - s8 radstricmp(const void far* s1,const void far* s2); - #pragma aux radstricmp = "and edi,0xffff" "push ds" "mov ds,dx" "and esi,0xffff" "lp:" "mov al,[esi]" "mov ah,[edi]" "cmp al,'a'" "jb c1" "cmp al,'z'" "ja c1" "sub al,32" "c1:" \ - "cmp ah,'a'" "jb c2" "cmp ah,'z'" "ja c2" "sub ah,32" "c2:" "cmp al,ah" "jne set" "cmp al,0" "je set" \ - "inc esi" "inc edi" "jmp lp" "set:" "setne al" "jbe end" "neg al" "end:" "pop ds" \ - parm [ES DI] [DX SI] modify [AX DI SI]; + u32 radstrlen(const void far* dest); + #pragma aux radstrlen = "cld" "and edi,0xffff" "mov ecx,0xffffffff" "xor eax,eax" 0x67 "repne scasb" "not ecx" "dec ecx" "movzx eax,cx" "shr ecx,16" parm [ES DI] modify [AX CX DI ES] value [CX AX]; + + char far* radstrcat(void far* dest,const void far* source); + #pragma aux radstrcat = "cld" "and edi,0xffff" "mov ecx,0xffffffff" "and esi,0xffff" "push ds" "mov ds,dx" "mov dx,di" "xor eax,eax" 0x67 "repne scasb" "dec edi" "lp:" "lodsb" "stosb" "test al,0xff" "jnz lp" "pop ds" \ + parm [ES DI] [DX SI] modify [AX CX DI SI ES] value [es dx]; + + char far* radstrchr(const void far* dest,char chr); + #pragma aux radstrchr = "cld" "lp:" 0x26 "lodsb" "cmp al,dl" "je fnd" "cmp al,0" "jnz lp" "xor ax,ax" "mov es,ax" "mov si,1" "fnd:" "dec si" parm [ES SI] [DL] modify [AX SI ES] value [es si]; + + s8 radstricmp(const void far* s1,const void far* s2); + #pragma aux radstricmp = "and edi,0xffff" "push ds" "mov ds,dx" "and esi,0xffff" "lp:" "mov al,[esi]" "mov ah,[edi]" "cmp al,'a'" "jb c1" "cmp al,'z'" "ja c1" "sub al,32" "c1:" \ + "cmp ah,'a'" "jb c2" "cmp ah,'z'" "ja c2" "sub ah,32" "c2:" "cmp al,ah" "jne set" "cmp al,0" "je set" \ + "inc esi" "inc edi" "jmp lp" "set:" "setne al" "jbe end" "neg al" "end:" "pop ds" \ + parm [ES DI] [DX SI] modify [AX DI SI]; - u32 radstru32(const void far* dest); - #pragma aux radstru32 = "cld" "xor ecx,ecx" "xor ebx,ebx" "xor edi,edi" 0x26 "lodsb" "cmp al,45" "jne skip2" "mov edi,1" "jmp skip" "lp:" "mov eax,10" "mul ecx" "lea ecx,[eax+ebx]" \ - "skip:" 0x26 "lodsb" "skip2:" "cmp al,0x39" "ja dne" "cmp al,0x30" "jb dne" "mov bl,al" "sub bl,0x30" "jmp lp" "dne:" "test edi,1" "jz pos" "neg ecx" "pos:" \ - "movzx eax,cx" "shr ecx,16" parm [ES SI] modify [AX BX DX DI SI] value [cx ax]; + u32 radstru32(const void far* dest); + #pragma aux radstru32 = "cld" "xor ecx,ecx" "xor ebx,ebx" "xor edi,edi" 0x26 "lodsb" "cmp al,45" "jne skip2" "mov edi,1" "jmp skip" "lp:" "mov eax,10" "mul ecx" "lea ecx,[eax+ebx]" \ + "skip:" 0x26 "lodsb" "skip2:" "cmp al,0x39" "ja dne" "cmp al,0x30" "jb dne" "mov bl,al" "sub bl,0x30" "jmp lp" "dne:" "test edi,1" "jz pos" "neg ecx" "pos:" \ + "movzx eax,cx" "shr ecx,16" parm [ES SI] modify [AX BX DX DI SI] value [cx ax]; - u32 mult64anddiv(u32 m1,u32 m2,u32 d); - #pragma aux mult64anddiv = "shl ecx,16" "mov cx,ax" "shrd eax,edx,16" "mov ax,si" "mul ecx" "shl edi,16" "mov di,bx" "div edi" "shld edx,eax,16" "and edx,0xffff" "and eax,0xffff" parm [cx ax] [dx si] [di bx] \ - modify [ax bx cx dx si di] value [dx ax]; - - #endif + u32 mult64anddiv(u32 m1,u32 m2,u32 d); + #pragma aux mult64anddiv = "shl ecx,16" "mov cx,ax" "shrd eax,edx,16" "mov ax,si" "mul ecx" "shl edi,16" "mov di,bx" "div edi" "shld edx,eax,16" "and edx,0xffff" "and eax,0xffff" parm [cx ax] [dx si] [di bx] \ + modify [ax bx cx dx si di] value [dx ax]; + + #endif #endif @@ -602,34 +602,34 @@ RADEXPFUNC void RADEXPLINK radfree(void PTR4* ptr); #ifdef __WATCOMC__ - char bkbhit(); - #pragma aux bkbhit = "mov ah,1" "int 0x16" "lahf" "shr eax,14" "and eax,1" "xor al,1" ; + char bkbhit(); + #pragma aux bkbhit = "mov ah,1" "int 0x16" "lahf" "shr eax,14" "and eax,1" "xor al,1" ; - char bgetch(); - #pragma aux bgetch = "xor ah,ah" "int 0x16" "test al,0xff" "jnz done" "mov al,ah" "or al,0x80" "done:" modify [AX]; + char bgetch(); + #pragma aux bgetch = "xor ah,ah" "int 0x16" "test al,0xff" "jnz done" "mov al,ah" "or al,0x80" "done:" modify [AX]; - void BreakPoint(); - #pragma aux BreakPoint = "int 3"; + void BreakPoint(); + #pragma aux BreakPoint = "int 3"; - u8 radinp(u16 p); - #pragma aux radinp = "in al,dx" parm [DX]; - - u8 radtoupper(u8 p); - #pragma aux radtoupper = "cmp al,'a'" "jb c1" "cmp al,'z'" "ja c1" "sub al,32" "c1:" parm [al] value [al]; - - void radoutp(u16 p,u8 v); - #pragma aux radoutp = "out dx,al" parm [DX] [AL]; + u8 radinp(u16 p); + #pragma aux radinp = "in al,dx" parm [DX]; + + u8 radtoupper(u8 p); + #pragma aux radtoupper = "cmp al,'a'" "jb c1" "cmp al,'z'" "ja c1" "sub al,32" "c1:" parm [al] value [al]; + + void radoutp(u16 p,u8 v); + #pragma aux radoutp = "out dx,al" parm [DX] [AL]; #endif // for multi-processor machines #ifdef __RADNT__ - #define LockedIncrement(var) _asm { lock inc [var] } - #define LockedDecrement(var) _asm { lock dec [var] } + #define LockedIncrement(var) _asm { lock inc [var] } + #define LockedDecrement(var) _asm { lock dec [var] } #else - #define LockedIncrement(var) _asm { inc [var] } - #define LockedDecrement(var) _asm { dec [var] } + #define LockedIncrement(var) _asm { inc [var] } + #define LockedDecrement(var) _asm { dec [var] } #endif #endif diff --git a/Standard Gaming Platform/Random.cpp b/Standard Gaming Platform/Random.cpp index c096bbd6..abbb4521 100644 --- a/Standard Gaming Platform/Random.cpp +++ b/Standard Gaming Platform/Random.cpp @@ -22,9 +22,9 @@ void InitializeRandom() { - // Seed the random-number generator with current time so that - // the numbers will be different every time we run. - srand( (unsigned) time(NULL) ); + // Seed the random-number generator with current time so that + // the numbers will be different every time we run. + srand( (unsigned) time(NULL) ); #ifdef PRERANDOM_GENERATOR //Pregenerate all of the random numbers. for( guiPreRandomIndex = 0; guiPreRandomIndex < MAX_PREGENERATED_NUMS; guiPreRandomIndex++ ) @@ -46,7 +46,7 @@ UINT32 Random(UINT32 uiRange) } #endif - if (uiRange == 0) + if (uiRange == 0) return(0); return rand() * uiRange / RAND_MAX % uiRange; } @@ -73,7 +73,7 @@ UINT32 PreRandom( UINT32 uiRange ) uiNum = guiPreRandomNums[ guiPreRandomIndex ] * uiRange / RAND_MAX % uiRange; //Replace the current pregenerated number with a new one. - //This was removed in the name of optimization. Uncomment if you hate recycling. + //This was removed in the name of optimization. Uncomment if you hate recycling. //guiPreRandomNums[ guiPreRandomIndex ] = rand(); //Go to the next index. diff --git a/Standard Gaming Platform/RegInst.cpp b/Standard Gaming Platform/RegInst.cpp index f625dbca..1a1c34d2 100644 --- a/Standard Gaming Platform/RegInst.cpp +++ b/Standard Gaming Platform/RegInst.cpp @@ -62,8 +62,8 @@ BOOLEAN InitializeRegistryKeys(STR lpszAppName, STR lpszRegistryKey) //CHECKF(gpszProfileName == NULL); // Note: this will leak the original gpszProfileName, but it - // will be freed when the application exits. No assumptions - // can be made on how gpszProfileName was allocated. + // will be freed when the application exits. No assumptions + // can be made on how gpszProfileName was allocated. strcpy( gszAppName, lpszAppName); strcpy( gszRegistryKey, lpszRegistryKey ); @@ -106,7 +106,7 @@ HKEY GetAppRegistryKey() } // returns key for: -// HKEY_CURRENT_USER\"Software"\RegistryKey\AppName\lpszSection +// HKEY_CURRENT_USER\"Software"\RegistryKey\AppName\lpszSection // creating it if it doesn't exist. // responsibility of the caller to call RegCloseKey() on the returned HKEY HKEY GetSectionKey(STR lpszSection) @@ -203,7 +203,7 @@ BOOLEAN GetProfileChar(STR lpszSection, STR lpszEntry, STR lpszDefault, STR lpsz // assert(gpszProfileName != NULL); // // if (lpszDefault == NULL) -// lpszDefault = &afxChNil; // don't pass in NULL +// lpszDefault = &afxChNil; // don't pass in NULL // TCHAR szT[4096]; // DWORD dw = ::GetPrivateProfileString(lpszSection, lpszEntry, // lpszDefault, szT, _countof(szT), gpszProfileName); diff --git a/Standard Gaming Platform/RegInst.h b/Standard Gaming Platform/RegInst.h index f2bde2c3..660d65ba 100644 --- a/Standard Gaming Platform/RegInst.h +++ b/Standard Gaming Platform/RegInst.h @@ -56,7 +56,7 @@ extern BOOLEAN InitializeRegistryKeys(STR strAppName, STR strRegistryKey); extern HKEY GetAppRegistryKey(); // returns key for: -// HKEY_CURRENT_USER\"Software"\RegistryKey\AppName\lpszSection +// HKEY_CURRENT_USER\"Software"\RegistryKey\AppName\lpszSection // creating it if it doesn't exist. // responsibility of the caller to call RegCloseKey() on the returned HKEY extern HKEY GetSectionKey(STR lpszSection); diff --git a/Standard Gaming Platform/SGP_2005Express.vcproj b/Standard Gaming Platform/SGP_2005Express.vcproj index 94f67bc9..cd89ff60 100644 --- a/Standard Gaming Platform/SGP_2005Express.vcproj +++ b/Standard Gaming Platform/SGP_2005Express.vcproj @@ -1,7 +1,7 @@ - + + + + + + + + + + + + + + + + + + @@ -418,6 +480,10 @@ RelativePath=".\Button System.cpp" > + + @@ -458,6 +524,10 @@ RelativePath=".\FileMan.cpp" > + + @@ -478,6 +548,10 @@ RelativePath=".\Install.cpp" > + + diff --git a/Standard Gaming Platform/SMACK.H b/Standard Gaming Platform/SMACK.H index 6dffbe69..2bb08aeb 100644 --- a/Standard Gaming Platform/SMACK.H +++ b/Standard Gaming Platform/SMACK.H @@ -10,126 +10,126 @@ RADDEFSTART typedef struct SmackTag { - u32 Version; // SMK2 only right now - u32 Width; // Width (1 based, 640 for example) - u32 Height; // Height (1 based, 480 for example) - u32 Frames; // Number of frames (1 based, 100 = 100 frames) - u32 MSPerFrame; // Frame Rate - u32 SmackerType; // bit 0 set=ring frame - u32 LargestInTrack[7]; // Largest single size for each track - u32 tablesize; // Size of the init tables - u32 codesize; // Compression info - u32 absize; // ditto - u32 detailsize; // ditto - u32 typesize; // ditto - u32 TrackType[7]; // high byte=0x80-Comp,0x40-PCM data,0x20-16 bit,0x10-stereo - u32 extra; // extra value (should be zero) - u32 NewPalette; // set to one if the palette changed - u8 Palette[772]; // palette data - u32 PalType; // type of palette - u32 FrameNum; // Frame Number to be displayed - u32 FrameSize; // The current frame's size in bytes - u32 SndSize; // The current frame sound tracks' size in bytes - s32 LastRectx; // Rect set in from SmackToBufferRect (X coord) - s32 LastRecty; // Rect set in from SmackToBufferRect (Y coord) - s32 LastRectw; // Rect set in from SmackToBufferRect (Width) - s32 LastRecth; // Rect set in from SmackToBufferRect (Height) - u32 OpenFlags; // flags used on open - u32 LeftOfs; // Left Offset used in SmackTo - u32 TopOfs; // Top Offset used in SmackTo - u32 LargestFrameSize; // Largest frame size - u32 Highest1SecRate; // Highest 1 sec data rate - u32 Highest1SecFrame; // Highest 1 sec data rate starting frame - u32 ReadError; // Set to non-zero if a read error has ocurred - u32 addr32; // translated address for 16 bit interface -} Smack; + u32 Version; // SMK2 only right now + u32 Width; // Width (1 based, 640 for example) + u32 Height; // Height (1 based, 480 for example) + u32 Frames; // Number of frames (1 based, 100 = 100 frames) + u32 MSPerFrame; // Frame Rate + u32 SmackerType; // bit 0 set=ring frame + u32 LargestInTrack[7]; // Largest single size for each track + u32 tablesize; // Size of the init tables + u32 codesize; // Compression info + u32 absize; // ditto + u32 detailsize; // ditto + u32 typesize; // ditto + u32 TrackType[7]; // high byte=0x80-Comp,0x40-PCM data,0x20-16 bit,0x10-stereo + u32 extra; // extra value (should be zero) + u32 NewPalette; // set to one if the palette changed + u8 Palette[772]; // palette data + u32 PalType; // type of palette + u32 FrameNum; // Frame Number to be displayed + u32 FrameSize; // The current frame's size in bytes + u32 SndSize; // The current frame sound tracks' size in bytes + s32 LastRectx; // Rect set in from SmackToBufferRect (X coord) + s32 LastRecty; // Rect set in from SmackToBufferRect (Y coord) + s32 LastRectw; // Rect set in from SmackToBufferRect (Width) + s32 LastRecth; // Rect set in from SmackToBufferRect (Height) + u32 OpenFlags; // flags used on open + u32 LeftOfs; // Left Offset used in SmackTo + u32 TopOfs; // Top Offset used in SmackTo + u32 LargestFrameSize; // Largest frame size + u32 Highest1SecRate; // Highest 1 sec data rate + u32 Highest1SecFrame; // Highest 1 sec data rate starting frame + u32 ReadError; // Set to non-zero if a read error has ocurred + u32 addr32; // translated address for 16 bit interface +} Smack; #define SmackHeaderSize(smk) ((((u8*)&((smk)->extra))-((u8*)(smk)))+4) typedef struct SmackSumTag { - u32 TotalTime; // total time - u32 MS100PerFrame; // MS*100 per frame (100000/MS100PerFrame=Frames/Sec) - u32 TotalOpenTime; // Time to open and prepare for decompression - u32 TotalFrames; // Total Frames displayed - u32 SkippedFrames; // Total number of skipped frames - u32 SoundSkips; // Total number of sound skips - u32 TotalBlitTime; // Total time spent blitting - u32 TotalReadTime; // Total time spent reading - u32 TotalDecompTime; // Total time spent decompressing - u32 TotalBackReadTime; // Total time spent reading in background - u32 TotalReadSpeed; // Total io speed (bytes/second) - u32 SlowestFrameTime; // Slowest single frame time - u32 Slowest2FrameTime; // Second slowest single frame time - u32 SlowestFrameNum; // Slowest single frame number - u32 Slowest2FrameNum; // Second slowest single frame number - u32 AverageFrameSize; // Average size of the frame - u32 HighestMemAmount; // Highest amount of memory allocated - u32 TotalExtraMemory; // Total extra memory allocated - u32 HighestExtraUsed; // Highest extra memory actually used + u32 TotalTime; // total time + u32 MS100PerFrame; // MS*100 per frame (100000/MS100PerFrame=Frames/Sec) + u32 TotalOpenTime; // Time to open and prepare for decompression + u32 TotalFrames; // Total Frames displayed + u32 SkippedFrames; // Total number of skipped frames + u32 SoundSkips; // Total number of sound skips + u32 TotalBlitTime; // Total time spent blitting + u32 TotalReadTime; // Total time spent reading + u32 TotalDecompTime; // Total time spent decompressing + u32 TotalBackReadTime; // Total time spent reading in background + u32 TotalReadSpeed; // Total io speed (bytes/second) + u32 SlowestFrameTime; // Slowest single frame time + u32 Slowest2FrameTime; // Second slowest single frame time + u32 SlowestFrameNum; // Slowest single frame number + u32 Slowest2FrameNum; // Second slowest single frame number + u32 AverageFrameSize; // Average size of the frame + u32 HighestMemAmount; // Highest amount of memory allocated + u32 TotalExtraMemory; // Total extra memory allocated + u32 HighestExtraUsed; // Highest extra memory actually used } SmackSum; //======================================================================= -#define SMACKNEEDPAN 0x00020L // Will be setting the pan +#define SMACKNEEDPAN 0x00020L // Will be setting the pan #define SMACKNEEDVOLUME 0x00040L // Will be setting the volume -#define SMACKFRAMERATE 0x00080L // Override fr (call SmackFrameRate first) -#define SMACKLOADEXTRA 0x00100L // Load the extra buffer during SmackOpen +#define SMACKFRAMERATE 0x00080L // Override fr (call SmackFrameRate first) +#define SMACKLOADEXTRA 0x00100L // Load the extra buffer during SmackOpen #define SMACKPRELOADALL 0x00200L // Preload the entire animation -#define SMACKNOSKIP 0x00400L // Don't skip frames if falling behind -#define SMACKSIMULATE 0x00800L // Simulate the speed (call SmackSim first) +#define SMACKNOSKIP 0x00400L // Don't skip frames if falling behind +#define SMACKSIMULATE 0x00800L // Simulate the speed (call SmackSim first) #define SMACKFILEHANDLE 0x01000L // Use when passing in a file handle -#define SMACKTRACK1 0x02000L // Play audio track 1 -#define SMACKTRACK2 0x04000L // Play audio track 2 -#define SMACKTRACK3 0x08000L // Play audio track 3 -#define SMACKTRACK4 0x10000L // Play audio track 4 -#define SMACKTRACK5 0x20000L // Play audio track 5 -#define SMACKTRACK6 0x40000L // Play audio track 6 -#define SMACKTRACK7 0x80000L // Play audio track 7 +#define SMACKTRACK1 0x02000L // Play audio track 1 +#define SMACKTRACK2 0x04000L // Play audio track 2 +#define SMACKTRACK3 0x08000L // Play audio track 3 +#define SMACKTRACK4 0x10000L // Play audio track 4 +#define SMACKTRACK5 0x20000L // Play audio track 5 +#define SMACKTRACK6 0x40000L // Play audio track 6 +#define SMACKTRACK7 0x80000L // Play audio track 7 #define SMACKTRACKS (SMACKTRACK1|SMACKTRACK2|SMACKTRACK3|SMACKTRACK4|SMACKTRACK5|SMACKTRACK6|SMACKTRACK7) #define SMACKBUFFERREVERSED 0x00000001 -#define SMACKBUFFER555 0x80000000 -#define SMACKBUFFER565 0xc0000000 -#define SMACKBUFFER16 (SMACKBUFFER555|SMACKBUFFER565) +#define SMACKBUFFER555 0x80000000 +#define SMACKBUFFER565 0xc0000000 +#define SMACKBUFFER16 (SMACKBUFFER555|SMACKBUFFER565) #define SMACKYINTERLACE 0x100000L // Force interleaving Y scaling -#define SMACKYDOUBLE 0x200000L // Force doubling Y scaling -#define SMACKYNONE (SMACKYINTERLACE|SMACKYDOUBLE) // Force normal Y scaling +#define SMACKYDOUBLE 0x200000L // Force doubling Y scaling +#define SMACKYNONE (SMACKYINTERLACE|SMACKYDOUBLE) // Force normal Y scaling #define SMACKFILEISSMK 0x2000000L // Internal flag for 16 to 32 bit thunking #define SMACKAUTOEXTRA 0xffffffffL // NOT A FLAG! - Use as extrabuf param //======================================================================= -#define SMACKSURFACEFAST 0 -#define SMACKSURFACESLOW 1 -#define SMACKSURFACEDIRECT 2 +#define SMACKSURFACEFAST 0 +#define SMACKSURFACESLOW 1 +#define SMACKSURFACEDIRECT 2 RADEXPFUNC Smack PTR4* RADEXPLINK SmackOpen(const char PTR4* name,u32 flags,u32 extrabuf); #ifdef __RADMAC__ - #include + #include - RADEXPFUNC Smack PTR4* RADEXPLINK SmackMacOpen(FSSpec* fsp,u32 flags,u32 extrabuf); + RADEXPFUNC Smack PTR4* RADEXPLINK SmackMacOpen(FSSpec* fsp,u32 flags,u32 extrabuf); #endif -RADEXPFUNC u32 RADEXPLINK SmackDoFrame(Smack PTR4* smk); +RADEXPFUNC u32 RADEXPLINK SmackDoFrame(Smack PTR4* smk); RADEXPFUNC void RADEXPLINK SmackNextFrame(Smack PTR4* smk); -RADEXPFUNC u32 RADEXPLINK SmackWait(Smack PTR4* smk); +RADEXPFUNC u32 RADEXPLINK SmackWait(Smack PTR4* smk); RADEXPFUNC void RADEXPLINK SmackClose(Smack PTR4* smk); RADEXPFUNC void RADEXPLINK SmackVolumePan(Smack PTR4* smk, u32 trackflag,u32 volume,u32 pan); RADEXPFUNC void RADEXPLINK SmackSummary(Smack PTR4* smk,SmackSum PTR4* sum); -RADEXPFUNC u32 RADEXPLINK SmackSoundInTrack(Smack PTR4* smk,u32 trackflags); -RADEXPFUNC u32 RADEXPLINK SmackSoundOnOff(Smack PTR4* smk,u32 on); +RADEXPFUNC u32 RADEXPLINK SmackSoundInTrack(Smack PTR4* smk,u32 trackflags); +RADEXPFUNC u32 RADEXPLINK SmackSoundOnOff(Smack PTR4* smk,u32 on); #ifndef __RADMAC__ RADEXPFUNC void RADEXPLINK SmackToScreen(Smack PTR4* smk,u32 left,u32 top,u32 BytePS,const u16 PTR4* WinTbl,void* SetBank,u32 Flags); #endif RADEXPFUNC void RADEXPLINK SmackToBuffer(Smack PTR4* smk,u32 left,u32 top,u32 Pitch,u32 destheight,const void PTR4* buf,u32 Flags); -RADEXPFUNC u32 RADEXPLINK SmackToBufferRect(Smack PTR4* smk, u32 SmackSurface); +RADEXPFUNC u32 RADEXPLINK SmackToBufferRect(Smack PTR4* smk, u32 SmackSurface); RADEXPFUNC void RADEXPLINK SmackGoto(Smack PTR4* smk,u32 frame); RADEXPFUNC void RADEXPLINK SmackColorRemapWithTrans(Smack PTR4* smk,const void PTR4* remappal,u32 numcolors,u32 paltype,u32 transindex); @@ -138,7 +138,7 @@ RADEXPFUNC void RADEXPLINK SmackColorTrans(Smack PTR4* smk,const void PTR4* tran RADEXPFUNC void RADEXPLINK SmackFrameRate(u32 forcerate); RADEXPFUNC void RADEXPLINK SmackSimulate(u32 sim); -RADEXPFUNC u32 RADEXPLINK SmackGetTrackData(Smack PTR4* smk,void PTR4* dest,u32 trackflag); +RADEXPFUNC u32 RADEXPLINK SmackGetTrackData(Smack PTR4* smk,void PTR4* dest,u32 trackflag); RADEXPFUNC void RADEXPLINK SmackSoundCheck(void); @@ -150,23 +150,23 @@ RADEXPFUNC void RADEXPLINK SmackSoundCheck(void); typedef struct _SMACKBLIT PTR4* HSMACKBLIT; typedef struct _SMACKBLIT { - u32 Flags; - u8 PTR4* Palette; - u32 PalType; - u16 PTR4* SmoothTable; - u16 PTR4* Conv8to16Table; - u32 whichmode; - u32 palindex; - u32 t16index; - u32 smoothindex; - u32 smoothtype; - u32 firstpalette; + u32 Flags; + u8 PTR4* Palette; + u32 PalType; + u16 PTR4* SmoothTable; + u16 PTR4* Conv8to16Table; + u32 whichmode; + u32 palindex; + u32 t16index; + u32 smoothindex; + u32 smoothtype; + u32 firstpalette; } SMACKBLIT; -#define SMACKBLIT1X 1 -#define SMACKBLIT2X 2 -#define SMACKBLIT2XSMOOTHING 4 -#define SMACKBLIT2XINTERLACE 8 +#define SMACKBLIT1X 1 +#define SMACKBLIT2X 2 +#define SMACKBLIT2XSMOOTHING 4 +#define SMACKBLIT2XINTERLACE 8 RADEXPFUNC HSMACKBLIT RADEXPLINK SmackBlitOpen(u32 flags); RADEXPFUNC void RADEXPLINK SmackBlitSetPalette(HSMACKBLIT sblit, void PTR4* Palette,u32 PalType); @@ -186,244 +186,244 @@ RADEXPFUNC u32 RADEXPLINK SmackUseMMX(u32 flag); //0=off, 1=on, 2=query current //====================================================================== #ifdef __RADDOS__ - #define SMACKSOUNDNONE -1 + #define SMACKSOUNDNONE -1 - extern void* SmackTimerSetupAddr; - extern void* SmackTimerReadAddr; - extern void* SmackTimerDoneAddr; + extern void* SmackTimerSetupAddr; + extern void* SmackTimerReadAddr; + extern void* SmackTimerDoneAddr; - typedef void RADEXPLINK (*SmackTimerSetupType)(void); - typedef u32 RADEXPLINK (*SmackTimerReadType)(void); - typedef void RADEXPLINK (*SmackTimerDoneType)(void); + typedef void RADEXPLINK (*SmackTimerSetupType)(void); + typedef u32 RADEXPLINK (*SmackTimerReadType)(void); + typedef void RADEXPLINK (*SmackTimerDoneType)(void); - #define SmackTimerSetup() ((SmackTimerSetupType)(SmackTimerSetupAddr))() - #define SmackTimerRead() ((SmackTimerReadType)(SmackTimerReadAddr))() - #define SmackTimerDone() ((SmackTimerDoneType)(SmackTimerDoneAddr))() + #define SmackTimerSetup() ((SmackTimerSetupType)(SmackTimerSetupAddr))() + #define SmackTimerRead() ((SmackTimerReadType)(SmackTimerReadAddr))() + #define SmackTimerDone() ((SmackTimerDoneType)(SmackTimerDoneAddr))() - RADEXPFUNC u8 RADEXPLINK SmackSoundUseMSS(void* DigDriver); + RADEXPFUNC u8 RADEXPLINK SmackSoundUseMSS(void* DigDriver); - #ifndef AIL_startup - #ifdef __SW_3R - extern s32 cdecl AIL_startup_reg(void); - #define AIL_startup AIL_startup_reg - #else - extern s32 cdecl AIL_startup_stack(void); - #define AIL_startup AIL_startup_stack - #endif - #endif - #define SmackSoundMSSLiteInit() SmackSoundMSSLiteInitWithStart(&AIL_startup); - RADEXPFUNC void RADEXPLINK SmackSoundMSSLiteInitWithStart(void* start); - RADEXPFUNC void RADEXPLINK SmackSoundMSSLiteDone(void); + #ifndef AIL_startup + #ifdef __SW_3R + extern s32 cdecl AIL_startup_reg(void); + #define AIL_startup AIL_startup_reg + #else + extern s32 cdecl AIL_startup_stack(void); + #define AIL_startup AIL_startup_stack + #endif + #endif + #define SmackSoundMSSLiteInit() SmackSoundMSSLiteInitWithStart(&AIL_startup); + RADEXPFUNC void RADEXPLINK SmackSoundMSSLiteInitWithStart(void* start); + RADEXPFUNC void RADEXPLINK SmackSoundMSSLiteDone(void); - RADEXPFUNC u8 RADEXPLINK SmackSoundUseSOS3r(u32 SOSDriver,u32 MaxTimerSpeed); - RADEXPFUNC u8 RADEXPLINK SmackSoundUseSOS3s(u32 SOSDriver,u32 MaxTimerSpeed); - RADEXPFUNC u8 RADEXPLINK SmackSoundUseSOS4r(u32 SOSDriver,u32 MaxTimerSpeed); - RADEXPFUNC u8 RADEXPLINK SmackSoundUseSOS4s(u32 SOSDriver,u32 MaxTimerSpeed); + RADEXPFUNC u8 RADEXPLINK SmackSoundUseSOS3r(u32 SOSDriver,u32 MaxTimerSpeed); + RADEXPFUNC u8 RADEXPLINK SmackSoundUseSOS3s(u32 SOSDriver,u32 MaxTimerSpeed); + RADEXPFUNC u8 RADEXPLINK SmackSoundUseSOS4r(u32 SOSDriver,u32 MaxTimerSpeed); + RADEXPFUNC u8 RADEXPLINK SmackSoundUseSOS4s(u32 SOSDriver,u32 MaxTimerSpeed); - #ifdef __SW_3R - #define SmackSoundUseSOS3 SmackSoundUseSOS3r - #define SmackSoundUseSOS4 SmackSoundUseSOS4r - #else - #define SmackSoundUseSOS3 SmackSoundUseSOS3s - #define SmackSoundUseSOS4 SmackSoundUseSOS4s - #endif + #ifdef __SW_3R + #define SmackSoundUseSOS3 SmackSoundUseSOS3r + #define SmackSoundUseSOS4 SmackSoundUseSOS4r + #else + #define SmackSoundUseSOS3 SmackSoundUseSOS3s + #define SmackSoundUseSOS4 SmackSoundUseSOS4s + #endif #else - #define SMACKRESRESET 0 - #define SMACKRES640X400 1 - #define SMACKRES640X480 2 - #define SMACKRES800X600 3 - #define SMACKRES1024X768 4 + #define SMACKRESRESET 0 + #define SMACKRES640X400 1 + #define SMACKRES640X480 2 + #define SMACKRES800X600 3 + #define SMACKRES1024X768 4 - RADEXPFUNC u32 RADEXPLINK SmackSetSystemRes(u32 mode); // use SMACKRES* values + RADEXPFUNC u32 RADEXPLINK SmackSetSystemRes(u32 mode); // use SMACKRES* values - #define SMACKNOCUSTOMBLIT 128 - #define SMACKSMOOTHBLIT 256 - #define SMACKINTERLACEBLIT 512 + #define SMACKNOCUSTOMBLIT 128 + #define SMACKSMOOTHBLIT 256 + #define SMACKINTERLACEBLIT 512 - #ifdef __RADMAC__ + #ifdef __RADMAC__ - #include - #include - #include + #include + #include + #include - #define SmackTimerSetup() - #define SmackTimerDone() - RADEXPFUNC u32 RADEXPLINK SmackTimerRead(void); + #define SmackTimerSetup() + #define SmackTimerDone() + RADEXPFUNC u32 RADEXPLINK SmackTimerRead(void); - RADEXPFUNC s32 RADEXPLINK SmackGDSurfaceType( GDHandle gd ); + RADEXPFUNC s32 RADEXPLINK SmackGDSurfaceType( GDHandle gd ); - #define SMACKAUTOBLIT 0 - #define SMACKDIRECTBLIT 1 - #define SMACKGWORLDBLIT 2 + #define SMACKAUTOBLIT 0 + #define SMACKDIRECTBLIT 1 + #define SMACKGWORLDBLIT 2 - typedef struct SmackBufTag { - u32 Reversed; - u32 SurfaceType; // SMACKSURFACExxxxxx - u32 BlitType; // SMACKxxxxxBLIT - u32 Width; - u32 Height; - u32 Pitch; - u32 Zoomed; - u32 ZWidth; - u32 ZHeight; - u32 DispColors; // colors on screen - u32 MaxPalColors; - u32 PalColorsInUse; - u32 StartPalColor; - u32 EndPalColor; - void* Buffer; - void* Palette; - u32 PalType; - u32 SoftwareCursor; + typedef struct SmackBufTag { + u32 Reversed; + u32 SurfaceType; // SMACKSURFACExxxxxx + u32 BlitType; // SMACKxxxxxBLIT + u32 Width; + u32 Height; + u32 Pitch; + u32 Zoomed; + u32 ZWidth; + u32 ZHeight; + u32 DispColors; // colors on screen + u32 MaxPalColors; + u32 PalColorsInUse; + u32 StartPalColor; + u32 EndPalColor; + void* Buffer; + void* Palette; + u32 PalType; + u32 SoftwareCursor; - WindowPtr wp; - GWorldPtr gwp; - CTabHandle cth; - PaletteHandle palh; + WindowPtr wp; + GWorldPtr gwp; + CTabHandle cth; + PaletteHandle palh; - GDHandle gd; - u32 gdSurfaceType; - HSMACKBLIT sblit; - void * ScreenAddr; - u32 ScreenPitch; - - s32 manyblits; - s32 PTR4* blitrects; - s32 PTR4* rectsptr; - s32 maxrects; - s32 numrects; + GDHandle gd; + u32 gdSurfaceType; + HSMACKBLIT sblit; + void * ScreenAddr; + u32 ScreenPitch; + + s32 manyblits; + s32 PTR4* blitrects; + s32 PTR4* rectsptr; + s32 maxrects; + s32 numrects; - } SmackBuf; + } SmackBuf; - #else + #else - #ifdef __RADWIN__ + #ifdef __RADWIN__ - #define INCLUDE_MMSYSTEM_H - #include "windows.h" - #include "windowsx.h" + #define INCLUDE_MMSYSTEM_H + #include "windows.h" + #include "windowsx.h" - #ifdef __RADNT__ // to combat WIN32_LEAN_AND_MEAN + #ifdef __RADNT__ // to combat WIN32_LEAN_AND_MEAN - #include "mmsystem.h" + #include "mmsystem.h" - RADEXPFUNC s32 RADEXPLINK SmackDDSurfaceType(void* lpDDS); + RADEXPFUNC s32 RADEXPLINK SmackDDSurfaceType(void* lpDDS); - #endif + #endif - #define SMACKAUTOBLIT 0 - #define SMACKFULL320X240BLIT 1 - #define SMACKFULL320X200BLIT 2 - #define SMACKFULL320X200DIRECTBLIT 3 - #define SMACKSTANDARDBLIT 4 - #define SMACKWINGBLIT 5 - #define SMACKDIBSECTIONBLIT 5 + #define SMACKAUTOBLIT 0 + #define SMACKFULL320X240BLIT 1 + #define SMACKFULL320X200BLIT 2 + #define SMACKFULL320X200DIRECTBLIT 3 + #define SMACKSTANDARDBLIT 4 + #define SMACKWINGBLIT 5 + #define SMACKDIBSECTIONBLIT 5 - #define WM_SMACKACTIVATE WM_USER+0x5678 + #define WM_SMACKACTIVATE WM_USER+0x5678 - typedef struct SmackBufTag { - u32 Reversed; // 1 if the buffer is upside down - u32 SurfaceType; // SMACKSURFACExxxx defines - u32 BlitType; // SMACKxxxxBLIT defines - u32 FullScreen; // 1 if full-screen - u32 Width; - u32 Height; - u32 Pitch; - u32 Zoomed; - u32 ZWidth; - u32 ZHeight; - u32 DispColors; // colors on the screen - u32 MaxPalColors; // total possible colors in palette (usually 256) - u32 PalColorsInUse; // Used colors in palette (usually 236) - u32 StartPalColor; // first usable color index (usually 10) - u32 EndPalColor; // last usable color index (usually 246) - RGBQUAD Palette[256]; - u32 PalType; - u32 forceredraw; // force a complete redraw on next blit (for >8bit) - u32 didapalette; // force an invalidate on the next palette change + typedef struct SmackBufTag { + u32 Reversed; // 1 if the buffer is upside down + u32 SurfaceType; // SMACKSURFACExxxx defines + u32 BlitType; // SMACKxxxxBLIT defines + u32 FullScreen; // 1 if full-screen + u32 Width; + u32 Height; + u32 Pitch; + u32 Zoomed; + u32 ZWidth; + u32 ZHeight; + u32 DispColors; // colors on the screen + u32 MaxPalColors; // total possible colors in palette (usually 256) + u32 PalColorsInUse; // Used colors in palette (usually 236) + u32 StartPalColor; // first usable color index (usually 10) + u32 EndPalColor; // last usable color index (usually 246) + RGBQUAD Palette[256]; + u32 PalType; + u32 forceredraw; // force a complete redraw on next blit (for >8bit) + u32 didapalette; // force an invalidate on the next palette change - void PTR4* Buffer; - void PTR4* DIBRestore; - u32 OurBitmap; - u32 OrigBitmap; - u32 OurPalette; - u32 WinGDC; - u32 FullFocused; - u32 ParentHwnd; - u32 OldParWndProc; - u32 OldDispWndProc; - u32 DispHwnd; - u32 WinGBufHandle; - void PTR4* lpDD; - void PTR4* lpDDSP; - u32 DDSurfaceType; - HSMACKBLIT DDblit; - s32 ddSoftwarecur; - s32 didaddblit; - s32 lastwasdd; - RECT ddscreen; - s32 manyblits; - s32 PTR4* blitrects; - s32 PTR4* rectsptr; - s32 maxrects; - s32 numrects; - HDC lastdc; - } SmackBuf; + void PTR4* Buffer; + void PTR4* DIBRestore; + u32 OurBitmap; + u32 OrigBitmap; + u32 OurPalette; + u32 WinGDC; + u32 FullFocused; + u32 ParentHwnd; + u32 OldParWndProc; + u32 OldDispWndProc; + u32 DispHwnd; + u32 WinGBufHandle; + void PTR4* lpDD; + void PTR4* lpDDSP; + u32 DDSurfaceType; + HSMACKBLIT DDblit; + s32 ddSoftwarecur; + s32 didaddblit; + s32 lastwasdd; + RECT ddscreen; + s32 manyblits; + s32 PTR4* blitrects; + s32 PTR4* rectsptr; + s32 maxrects; + s32 numrects; + HDC lastdc; + } SmackBuf; - RADEXPFUNC void RADEXPLINK SmackGet(Smack PTR4* smk,void PTR4* dest); - RADEXPFUNC void RADEXPLINK SmackBufferGet( SmackBuf PTR4* sbuf, void PTR4* dest); - - RADEXPFUNC u8 RADEXPLINK SmackSoundUseMSS(void PTR4* dd); - RADEXPFUNC u8 RADEXPLINK SmackSoundUseDirectSound(void PTR4* dd); // NULL=Create - RADEXPFUNC void RADEXPLINK SmackSoundSetDirectSoundHWND(HWND hw); - RADEXPFUNC u8 RADEXPLINK SmackSoundUseDW(u32 openfreq, u32 openbits, u32 openchans); + RADEXPFUNC void RADEXPLINK SmackGet(Smack PTR4* smk,void PTR4* dest); + RADEXPFUNC void RADEXPLINK SmackBufferGet( SmackBuf PTR4* sbuf, void PTR4* dest); + + RADEXPFUNC u8 RADEXPLINK SmackSoundUseMSS(void PTR4* dd); + RADEXPFUNC u8 RADEXPLINK SmackSoundUseDirectSound(void PTR4* dd); // NULL=Create + RADEXPFUNC void RADEXPLINK SmackSoundSetDirectSoundHWND(HWND hw); + RADEXPFUNC u8 RADEXPLINK SmackSoundUseDW(u32 openfreq, u32 openbits, u32 openchans); - #define SmackTimerSetup() - #define SmackTimerDone() - #define SmackTimerRead timeGetTime + #define SmackTimerSetup() + #define SmackTimerDone() + #define SmackTimerRead timeGetTime - #endif + #endif - #endif + #endif - #ifdef __RADMAC__ - RADEXPFUNC SmackBuf PTR4* RADEXPLINK SmackBufferOpen( WindowPtr wp, u32 BlitType, u32 width, u32 height, u32 ZoomW, u32 ZoomH ); - RADEXPFUNC u32 RADEXPLINK SmackBufferBlit( SmackBuf PTR4* sbuf, s32 hwndx, s32 hwndy, s32 subx, s32 suby, s32 subw, s32 subh ); - RADEXPFUNC void RADEXPLINK SmackBufferFromScreen( SmackBuf PTR4* destbuf, s32 x, s32 y); + #ifdef __RADMAC__ + RADEXPFUNC SmackBuf PTR4* RADEXPLINK SmackBufferOpen( WindowPtr wp, u32 BlitType, u32 width, u32 height, u32 ZoomW, u32 ZoomH ); + RADEXPFUNC u32 RADEXPLINK SmackBufferBlit( SmackBuf PTR4* sbuf, s32 hwndx, s32 hwndy, s32 subx, s32 suby, s32 subw, s32 subh ); + RADEXPFUNC void RADEXPLINK SmackBufferFromScreen( SmackBuf PTR4* destbuf, s32 x, s32 y); - RADEXPFUNC s32 RADEXPLINK SmackIsSoftwareCursor(GDHandle gd); - RADEXPFUNC s32 RADEXPLINK SmackCheckCursor(WindowPtr wp,s32 x,s32 y,s32 w,s32 h); - RADEXPFUNC void RADEXPLINK SmackRestoreCursor(s32 checkcount); - #else - RADEXPFUNC SmackBuf PTR4* RADEXPLINK SmackBufferOpen( HWND wnd, u32 BlitType, u32 width, u32 height, u32 ZoomW, u32 ZoomH ); - RADEXPFUNC u32 RADEXPLINK SmackBufferBlit( SmackBuf PTR4* sbuf, HDC dc, s32 hwndx, s32 hwndy, s32 subx, s32 suby, s32 subw, s32 subh ); - RADEXPFUNC void RADEXPLINK SmackBufferFromScreen( SmackBuf PTR4* destbuf, HWND hw, s32 x, s32 y); + RADEXPFUNC s32 RADEXPLINK SmackIsSoftwareCursor(GDHandle gd); + RADEXPFUNC s32 RADEXPLINK SmackCheckCursor(WindowPtr wp,s32 x,s32 y,s32 w,s32 h); + RADEXPFUNC void RADEXPLINK SmackRestoreCursor(s32 checkcount); + #else + RADEXPFUNC SmackBuf PTR4* RADEXPLINK SmackBufferOpen( HWND wnd, u32 BlitType, u32 width, u32 height, u32 ZoomW, u32 ZoomH ); + RADEXPFUNC u32 RADEXPLINK SmackBufferBlit( SmackBuf PTR4* sbuf, HDC dc, s32 hwndx, s32 hwndy, s32 subx, s32 suby, s32 subw, s32 subh ); + RADEXPFUNC void RADEXPLINK SmackBufferFromScreen( SmackBuf PTR4* destbuf, HWND hw, s32 x, s32 y); - RADEXPFUNC s32 RADEXPLINK SmackIsSoftwareCursor(void* lpDDSP,HCURSOR cur); - RADEXPFUNC s32 RADEXPLINK SmackCheckCursor(HWND wnd,s32 x,s32 y,s32 w,s32 h); - RADEXPFUNC void RADEXPLINK SmackRestoreCursor(s32 checkcount); - #endif + RADEXPFUNC s32 RADEXPLINK SmackIsSoftwareCursor(void* lpDDSP,HCURSOR cur); + RADEXPFUNC s32 RADEXPLINK SmackCheckCursor(HWND wnd,s32 x,s32 y,s32 w,s32 h); + RADEXPFUNC void RADEXPLINK SmackRestoreCursor(s32 checkcount); + #endif - RADEXPFUNC void RADEXPLINK SmackBufferStartMultipleBlits( SmackBuf PTR4* sbuf ); - RADEXPFUNC void RADEXPLINK SmackBufferEndMultipleBlits( SmackBuf PTR4* sbuf ); + RADEXPFUNC void RADEXPLINK SmackBufferStartMultipleBlits( SmackBuf PTR4* sbuf ); + RADEXPFUNC void RADEXPLINK SmackBufferEndMultipleBlits( SmackBuf PTR4* sbuf ); - RADEXPFUNC char PTR4* RADEXPLINK SmackBufferString(SmackBuf PTR4* sb,char PTR4* dest); + RADEXPFUNC char PTR4* RADEXPLINK SmackBufferString(SmackBuf PTR4* sb,char PTR4* dest); - RADEXPFUNC void RADEXPLINK SmackBufferNewPalette( SmackBuf PTR4* sbuf, const void PTR4* pal, u32 paltype ); - RADEXPFUNC u32 RADEXPLINK SmackBufferSetPalette( SmackBuf PTR4* sbuf ); - RADEXPFUNC void RADEXPLINK SmackBufferClose( SmackBuf PTR4* sbuf ); + RADEXPFUNC void RADEXPLINK SmackBufferNewPalette( SmackBuf PTR4* sbuf, const void PTR4* pal, u32 paltype ); + RADEXPFUNC u32 RADEXPLINK SmackBufferSetPalette( SmackBuf PTR4* sbuf ); + RADEXPFUNC void RADEXPLINK SmackBufferClose( SmackBuf PTR4* sbuf ); - RADEXPFUNC void RADEXPLINK SmackBufferClear( SmackBuf PTR4* destbuf, u32 color); + RADEXPFUNC void RADEXPLINK SmackBufferClear( SmackBuf PTR4* destbuf, u32 color); - RADEXPFUNC void RADEXPLINK SmackBufferToBuffer( SmackBuf PTR4* destbuf, s32 destx, s32 desty, const SmackBuf PTR4* sourcebuf,s32 sourcex,s32 sourcey,s32 sourcew,s32 sourceh); - RADEXPFUNC void RADEXPLINK SmackBufferToBufferTrans( SmackBuf PTR4* destbuf, s32 destx, s32 desty, const SmackBuf PTR4* sourcebuf,s32 sourcex,s32 sourcey,s32 sourcew,s32 sourceh,u32 TransColor); - RADEXPFUNC void RADEXPLINK SmackBufferToBufferMask( SmackBuf PTR4* destbuf, s32 destx, s32 desty, const SmackBuf PTR4* sourcebuf,s32 sourcex,s32 sourcey,s32 sourcew,s32 sourceh,u32 TransColor,const SmackBuf PTR4* maskbuf); - RADEXPFUNC void RADEXPLINK SmackBufferToBufferMerge( SmackBuf PTR4* destbuf, s32 destx, s32 desty, const SmackBuf PTR4* sourcebuf,s32 sourcex,s32 sourcey,s32 sourcew,s32 sourceh,u32 TransColor,const SmackBuf PTR4* mergebuf); - RADEXPFUNC void RADEXPLINK SmackBufferCopyPalette( SmackBuf PTR4* destbuf, SmackBuf PTR4* sourcebuf, u32 remap); + RADEXPFUNC void RADEXPLINK SmackBufferToBuffer( SmackBuf PTR4* destbuf, s32 destx, s32 desty, const SmackBuf PTR4* sourcebuf,s32 sourcex,s32 sourcey,s32 sourcew,s32 sourceh); + RADEXPFUNC void RADEXPLINK SmackBufferToBufferTrans( SmackBuf PTR4* destbuf, s32 destx, s32 desty, const SmackBuf PTR4* sourcebuf,s32 sourcex,s32 sourcey,s32 sourcew,s32 sourceh,u32 TransColor); + RADEXPFUNC void RADEXPLINK SmackBufferToBufferMask( SmackBuf PTR4* destbuf, s32 destx, s32 desty, const SmackBuf PTR4* sourcebuf,s32 sourcex,s32 sourcey,s32 sourcew,s32 sourceh,u32 TransColor,const SmackBuf PTR4* maskbuf); + RADEXPFUNC void RADEXPLINK SmackBufferToBufferMerge( SmackBuf PTR4* destbuf, s32 destx, s32 desty, const SmackBuf PTR4* sourcebuf,s32 sourcex,s32 sourcey,s32 sourcew,s32 sourceh,u32 TransColor,const SmackBuf PTR4* mergebuf); + RADEXPFUNC void RADEXPLINK SmackBufferCopyPalette( SmackBuf PTR4* destbuf, SmackBuf PTR4* sourcebuf, u32 remap); - RADEXPFUNC u32 RADEXPLINK SmackBufferFocused( SmackBuf PTR4* sbuf); + RADEXPFUNC u32 RADEXPLINK SmackBufferFocused( SmackBuf PTR4* sbuf); #endif diff --git a/Standard Gaming Platform/STCI.cpp b/Standard Gaming Platform/STCI.cpp index 4e193b2a..810e90fb 100644 --- a/Standard Gaming Platform/STCI.cpp +++ b/Standard Gaming Platform/STCI.cpp @@ -82,7 +82,7 @@ BOOLEAN LoadSTCIFileToImage( HIMAGE hImage, UINT16 fContents ) TempImage.ubBitDepth = Header.ubDepth; *hImage = TempImage; - return( TRUE ); + return( TRUE ); } BOOLEAN STCILoadRGB( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHeader * pHeader ) @@ -93,9 +93,9 @@ BOOLEAN STCILoadRGB( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHeader * { // RGB doesn't have a palette! return( FALSE ); } - + if (fContents & IMAGE_BITMAPDATA) - { + { // Allocate memory for the image data and read it in hImage->pImageData = MemAlloc( pHeader->uiStoredSize ); if (hImage->pImageData == NULL) @@ -103,7 +103,7 @@ BOOLEAN STCILoadRGB( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHeader * return( FALSE ); } else if (!FileRead( hFile, hImage->pImageData, pHeader->uiStoredSize, &uiBytesRead ) || uiBytesRead != pHeader->uiStoredSize) - { + { MemFree( hImage->pImageData ); return( FALSE ); } @@ -116,7 +116,7 @@ BOOLEAN STCILoadRGB( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHeader * if (gusRedMask != (UINT16) pHeader->RGB.uiRedMask || gusGreenMask != (UINT16) pHeader->RGB.uiGreenMask || gusBlueMask != (UINT16) pHeader->RGB.uiBlueMask ) { - // colour distribution of the file is different from hardware! We have to change it! + // colour distribution of the file is different from hardware! We have to change it! DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Converting to current RGB distribution!" ); // Convert the image to the current hardware's specifications if (gusRedMask > gusGreenMask && gusGreenMask > gusBlueMask) @@ -137,7 +137,7 @@ BOOLEAN STCILoadRGB( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHeader * ConvertRGBDistribution565To556( hImage->p16BPPData, pHeader->usWidth * pHeader->usHeight ); return( TRUE ); } - else + else { // take the long route ConvertRGBDistribution565ToAny( hImage->p16BPPData, pHeader->usWidth * pHeader->usHeight ); @@ -153,7 +153,7 @@ BOOLEAN STCILoadRGB( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHeader * } } } -#ifdef JA2 +#ifdef JA2 return( TRUE ); #else // Anything else is an ERROR! --DB @@ -171,7 +171,7 @@ BOOLEAN STCILoadIndexed( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHead if (fContents & IMAGE_PALETTE) { // Allocate memory for reading in the palette if (pHeader->Indexed.uiNumberOfColours != 256) - { + { DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Palettized image has bad palette size." ); return( FALSE ); } @@ -200,7 +200,7 @@ BOOLEAN STCILoadIndexed( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHead DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Problem setting hImage-format palette!" ); FileClose( hFile ); MemFree( pSTCIPalette ); - return( FALSE ); + return( FALSE ); } hImage->fFlags |= IMAGE_PALETTE; // Free the temporary buffer @@ -213,11 +213,11 @@ BOOLEAN STCILoadIndexed( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHead { DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Problem seeking past palette!" ); FileClose( hFile ); - return( FALSE ); + return( FALSE ); } } if (fContents & IMAGE_BITMAPDATA) - { + { if (pHeader->fFlags & STCI_ETRLE_COMPRESSED) { // load data for the subimage (object) structures @@ -229,17 +229,17 @@ BOOLEAN STCILoadIndexed( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHead { DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Out of memory!" ); FileClose( hFile ); - if (fContents & IMAGE_PALETTE) + if (fContents & IMAGE_PALETTE) { MemFree( hImage->pPalette ); } return( FALSE ); } if (!FileRead( hFile, hImage->pETRLEObject, uiFileSectionSize, &uiBytesRead ) || uiBytesRead != uiFileSectionSize) - { + { DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Error loading subimage structures!" ); FileClose( hFile ); - if (fContents & IMAGE_PALETTE) + if (fContents & IMAGE_PALETTE) { MemFree( hImage->pPalette ); } @@ -255,7 +255,7 @@ BOOLEAN STCILoadIndexed( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHead { DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Out of memory!" ); FileClose( hFile ); - if (fContents & IMAGE_PALETTE) + if (fContents & IMAGE_PALETTE) { MemFree( hImage->pPalette ); } @@ -270,7 +270,7 @@ BOOLEAN STCILoadIndexed( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHead DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Error loading image data!" ); FileClose( hFile ); MemFree( hImage->pImageData ); - if (fContents & IMAGE_PALETTE) + if (fContents & IMAGE_PALETTE) { MemFree( hImage->pPalette ); } @@ -288,7 +288,7 @@ BOOLEAN STCILoadIndexed( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHead { DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Problem seeking past image data!" ); FileClose( hFile ); - return( FALSE ); + return( FALSE ); } } @@ -301,7 +301,7 @@ BOOLEAN STCILoadIndexed( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHead DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Out of memory!" ); FileClose( hFile ); MemFree( hImage->pAppData ); - if (fContents & IMAGE_PALETTE) + if (fContents & IMAGE_PALETTE) { MemFree( hImage->pPalette ); } @@ -316,11 +316,11 @@ BOOLEAN STCILoadIndexed( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHead return( FALSE ); } if (!FileRead( hFile, hImage->pAppData, pHeader->uiAppDataSize, &uiBytesRead ) || uiBytesRead != pHeader->uiAppDataSize) - { + { DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Error loading application-specific data!" ); FileClose( hFile ); MemFree( hImage->pAppData ); - if (fContents & IMAGE_PALETTE) + if (fContents & IMAGE_PALETTE) { MemFree( hImage->pPalette ); } @@ -362,16 +362,16 @@ BOOLEAN STCISetPalette( PTR pSTCIPalette, HIMAGE hImage ) return( FALSE ); } - // Initialize the proper palette entries - for (usIndex = 0; usIndex < 256; usIndex++) - { - hImage->pPalette[ usIndex ].peRed = pubPalette->ubRed; + // Initialize the proper palette entries + for (usIndex = 0; usIndex < 256; usIndex++) + { + hImage->pPalette[ usIndex ].peRed = pubPalette->ubRed; hImage->pPalette[ usIndex ].peGreen = pubPalette->ubGreen; - hImage->pPalette[ usIndex ].peBlue = pubPalette->ubBlue; - hImage->pPalette[ usIndex ].peFlags = 0; + hImage->pPalette[ usIndex ].peBlue = pubPalette->ubBlue; + hImage->pPalette[ usIndex ].peFlags = 0; pubPalette ++; - } - return TRUE; + } + return TRUE; } @@ -396,10 +396,10 @@ BOOLEAN IsSTCIETRLEFile( CHAR8 * ImageFile ) FileClose( hFile ); if (Header.fFlags & STCI_ETRLE_COMPRESSED) { - return( TRUE ); + return( TRUE ); } else { - return( FALSE ); + return( FALSE ); } -} \ No newline at end of file +} diff --git a/Standard Gaming Platform/Standard Gaming Platform.vcproj b/Standard Gaming Platform/Standard Gaming Platform.vcproj index adbf529c..c5d93fd2 100644 --- a/Standard Gaming Platform/Standard Gaming Platform.vcproj +++ b/Standard Gaming Platform/Standard Gaming Platform.vcproj @@ -1,135 +1,200 @@ + ProjectGUID="{1D052886-AE6B-437A-BE0C-D074CA940818}" + TargetFrameworkVersion="131072" + > + Name="Win32" + /> + + + ATLMinimizesCRunTimeLibraryUsage="false" + > + + + + + + CompileAs="0" + /> + Name="VCManagedResourceCompilerTool" + /> + + + SuppressStartupBanner="true" + /> + Name="VCALinkTool" + /> + Name="VCXDCMakeTool" + /> + Name="VCBscMakeTool" + /> + Name="VCFxCopTool" + /> - - - - + Name="VCPostBuildEventTool" + /> + ATLMinimizesCRunTimeLibraryUsage="false" + > + + + + + + CompileAs="0" + /> + Name="VCManagedResourceCompilerTool" + /> + + + SuppressStartupBanner="true" + /> + Name="VCALinkTool" + /> + Name="VCXDCMakeTool" + /> + Name="VCBscMakeTool" + /> + Name="VCFxCopTool" + /> - - - - + Name="VCPostBuildEventTool" + /> + ATLMinimizesCRunTimeLibraryUsage="false" + > + + + + + + CompileAs="0" + /> + Name="VCManagedResourceCompilerTool" + /> + + + SuppressStartupBanner="true" + /> + Name="VCALinkTool" + /> + Name="VCXDCMakeTool" + /> + Name="VCBscMakeTool" + /> + Name="VCFxCopTool" + /> - - - - + Name="VCPostBuildEventTool" + /> + ATLMinimizesCRunTimeLibraryUsage="false" + > + + + + + + SuppressStartupBanner="true" + CompileAs="0" + /> + Name="VCManagedResourceCompilerTool" + /> + + + SuppressStartupBanner="true" + /> + Name="VCALinkTool" + /> + Name="VCXDCMakeTool" + /> + Name="VCBscMakeTool" + /> + Name="VCFxCopTool" + /> - - - - + Name="VCPostBuildEventTool" + /> + ATLMinimizesCRunTimeLibraryUsage="false" + > + + + + + + CompileAs="0" + /> + Name="VCManagedResourceCompilerTool" + /> + + + SuppressStartupBanner="true" + /> + Name="VCALinkTool" + /> + Name="VCXDCMakeTool" + /> + Name="VCBscMakeTool" + /> + Name="VCFxCopTool" + /> - - - - + Name="VCPostBuildEventTool" + /> + ATLMinimizesCRunTimeLibraryUsage="false" + > + + + + + + CompileAs="0" + /> + Name="VCManagedResourceCompilerTool" + /> + + + SuppressStartupBanner="true" + /> + Name="VCALinkTool" + /> + Name="VCXDCMakeTool" + /> + Name="VCBscMakeTool" + /> + Name="VCFxCopTool" + /> - - - - + Name="VCPostBuildEventTool" + /> + ATLMinimizesCRunTimeLibraryUsage="false" + > + + + + + + CompileAs="0" + /> + Name="VCManagedResourceCompilerTool" + /> + + + SuppressStartupBanner="true" + /> + Name="VCALinkTool" + /> + Name="VCXDCMakeTool" + /> + Name="VCBscMakeTool" + /> + Name="VCFxCopTool" + /> - - - - + Name="VCPostBuildEventTool" + /> @@ -376,2518 +539,3138 @@ + Filter="cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" + > + RelativePath="Button Sound Control.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="Button System.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="Container.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="Cursor Control.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="DbMan.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="ddraw.lib" + > + RelativePath="DEBUG.cpp" + > - - - - - - - - - + Name="Demo Release with Debug Info|Win32" + > + /> - - - + Name="Release Demo|Win32" + > + PreprocessorDefinitions="_DEBUG" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + + + + + + + + + + + + + RelativePath="DirectDraw Calls.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="DirectX Common.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="English.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="ExceptionHandling.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="FileCat.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="FileMan.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="Font.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="himage.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="impTGA.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="input.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="Install.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="LibraryDataBase.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="line.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="MemMan.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="mousesystem.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="Mutex Manager.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="PCX.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="Random.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="readdir.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="RegInst.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="sgp.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="shading.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="soundman.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="STCI.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="stringicmp.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="timer.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="video.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="vobject.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="vobject_blitters.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="vsurface.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + RelativePath="WinFont.cpp" + > + Name="Demo Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Release Demo|Win32" + > + PreprocessorDefinitions="" + /> + Name="Bounds Checker|Win32" + > + BrowseInformation="1" + /> + Name="Release|Win32" + > + BrowseInformation="1" + /> + Name="Debug Demo|Win32" + > + BrowseInformation="1" + /> + Name="Release with Debug Info|Win32" + > + PreprocessorDefinitions="" + /> + Name="Debug|Win32" + > + BrowseInformation="1" + /> + Filter="h;hpp;hxx;hm;inl;fi;fd" + > + RelativePath="Button System.h" + > + RelativePath=".\Compression.h" + > + RelativePath="container.h" + > + RelativePath="Cursor Control.h" + > + RelativePath="DbMan.h" + > + RelativePath="Debug.h" + > + RelativePath="DirectDraw Calls.h" + > + RelativePath="DirectX Common.h" + > + RelativePath="english.h" + > + RelativePath="ExceptionHandling.h" + > + RelativePath="FileCat.h" + > + RelativePath="FileMan.h" + > + RelativePath=".\fmod.h" + > + RelativePath=".\fmod_errors.h" + > + RelativePath="..\Utils\Font Control.h" + > + RelativePath="font.h" + > + RelativePath="gameloop.h" + > + RelativePath="himage.h" + > + RelativePath="imgfmt.h" + > + RelativePath="impTGA.h" + > + RelativePath="Input.h" + > + RelativePath="Install.h" + > + RelativePath="JA2 SGP ALL.H" + > + RelativePath="..\jascreens.h" + > + RelativePath="LibraryDataBase.h" + > + RelativePath="line.h" + > + RelativePath="..\local.h" + > + RelativePath="MemMan.h" + > + RelativePath="mousesystem.h" + > + RelativePath="mousesystem_macros.h" + > + RelativePath="Mutex Manager.h" + > + RelativePath="pcx.h" + > + RelativePath="random.h" + > + RelativePath="readdir.h" + > + RelativePath="RegInst.h" + > + RelativePath="..\TileEngine\render dirty.h" + > + RelativePath="..\screenids.h" + > + RelativePath="..\SCREENS.H" + > + RelativePath="sgp.h" + > + RelativePath="shading.h" + > + RelativePath="soundman.h" + > + RelativePath="STCI.h" + > + RelativePath="stringicmp.h" + > + RelativePath="timer.h" + > + RelativePath="TopicIDs.h" + > + RelativePath="TopicOps.h" + > + RelativePath="trle.h" + > + RelativePath="Types.h" + > + RelativePath="Video.h" + > + RelativePath="video_private.h" + > + RelativePath="vobject.h" + > + RelativePath="vobject_blitters.h" + > + RelativePath="vobject_private.h" + > + RelativePath="vsurface.h" + > + RelativePath="vsurface_private.h" + > + RelativePath="WCheck.h" + > + RelativePath="WinFont.h" + > + RelativePath="WizShare.h" + > + + diff --git a/Standard Gaming Platform/TopicIDs.h b/Standard Gaming Platform/TopicIDs.h index 9bd0f27a..b9d4c6eb 100644 --- a/Standard Gaming Platform/TopicIDs.h +++ b/Standard Gaming Platform/TopicIDs.h @@ -3,28 +3,28 @@ // YOU MUST KEEP THIS VARIABLE UP TO DATE !!!! -#define NUM_TOPIC_IDS 23 +#define NUM_TOPIC_IDS 23 -/* #define TOPIC_MEMORY_MANAGER 0 -#define TOPIC_FILE_MANAGER 1 -#define TOPIC_DATABASE_MANAGER 2 -#define TOPIC_GAME 3 -#define TOPIC_SGP 4 -#define TOPIC_VIDEO 5 -#define TOPIC_INPUT 6 -#define TOPIC_STACK_CONTAINERS 7 -#define TOPIC_LIST_CONTAINERS 8 -#define TOPIC_QUEUE_CONTAINERS 9 -#define TOPIC_PRILIST_CONTAINERS 10 -#define TOPIC_HIMAGE 11 +/* #define TOPIC_MEMORY_MANAGER 0 +#define TOPIC_FILE_MANAGER 1 +#define TOPIC_DATABASE_MANAGER 2 +#define TOPIC_GAME 3 +#define TOPIC_SGP 4 +#define TOPIC_VIDEO 5 +#define TOPIC_INPUT 6 +#define TOPIC_STACK_CONTAINERS 7 +#define TOPIC_LIST_CONTAINERS 8 +#define TOPIC_QUEUE_CONTAINERS 9 +#define TOPIC_PRILIST_CONTAINERS 10 +#define TOPIC_HIMAGE 11 #define TOPIC_ORDLIST_CONTAINERS 12 -#define TOPIC_3DENGINE 13 -#define TOPIC_VIDEOOBJECT 14 -#define TOPIC_FONT_HANDLER 15 -#define TOPIC_VIDEOSURFACE 16 -#define TOPIC_MOUSE_SYSTEM 17 -#define TOPIC_BUTTON_HANDLER 18 -#define TOPIC_MUTEX 19 +#define TOPIC_3DENGINE 13 +#define TOPIC_VIDEOOBJECT 14 +#define TOPIC_FONT_HANDLER 15 +#define TOPIC_VIDEOSURFACE 16 +#define TOPIC_MOUSE_SYSTEM 17 +#define TOPIC_BUTTON_HANDLER 18 +#define TOPIC_MUTEX 19 #define TOPIC_JA2 20 #define TOPIC_BLIT_QUEUE 21 #define TOPIC_JA2OPPLIST 22 diff --git a/Standard Gaming Platform/TopicOps.h b/Standard Gaming Platform/TopicOps.h index c1d7989b..0a087a39 100644 --- a/Standard Gaming Platform/TopicOps.h +++ b/Standard Gaming Platform/TopicOps.h @@ -3,23 +3,23 @@ // debug levels -#define DBG_LEVEL_0 0 // for registering and unregistering topics only -#define DBG_LEVEL_1 1 // for basic stuff -#define DBG_LEVEL_2 2 // for ordinary, I usually want to see them, messages -#define DBG_LEVEL_3 3 // nitty gritty detail +#define DBG_LEVEL_0 0 // for registering and unregistering topics only +#define DBG_LEVEL_1 1 // for basic stuff +#define DBG_LEVEL_2 2 // for ordinary, I usually want to see them, messages +#define DBG_LEVEL_3 3 // nitty gritty detail // from client -#define TOPIC_REGISTER 0 -#define TOPIC_UNREGISTER 1 -#define TOPIC_MESSAGE 2 -#define CLIENT_REGISTER 3 -#define CLIENT_SHUTDOWN 4 +#define TOPIC_REGISTER 0 +#define TOPIC_UNREGISTER 1 +#define TOPIC_MESSAGE 2 +#define CLIENT_REGISTER 3 +#define CLIENT_SHUTDOWN 4 // from server -#define SYSTEM_SHUTDOWN 0 -#define MODULE_RESET 1 -#define SET_DEBUG_LEVEL 2 +#define SYSTEM_SHUTDOWN 0 +#define MODULE_RESET 1 +#define SET_DEBUG_LEVEL 2 #endif diff --git a/Standard Gaming Platform/Types.h b/Standard Gaming Platform/Types.h index 939f6172..49e0d92c 100644 --- a/Standard Gaming Platform/Types.h +++ b/Standard Gaming Platform/Types.h @@ -32,21 +32,21 @@ // HEY WIZARDRY DUDES, JA2 ISN'T THE ONLY PROGRAM WE COMPILE! :-) #if defined( JA2 ) || defined( UTILS ) -typedef unsigned int UINT32; -typedef signed int INT32; +typedef unsigned int UINT32; +typedef signed int INT32; #else -typedef unsigned int UINT32; -typedef int INT32; +typedef unsigned int UINT32; +typedef int INT32; #endif // integers -typedef unsigned char UINT8; -typedef signed char INT8; -typedef unsigned short UINT16; -typedef signed short INT16; +typedef unsigned char UINT8; +typedef signed char INT8; +typedef unsigned short UINT16; +typedef signed short INT16; // floats -typedef float FLOAT; -typedef double DOUBLE; +typedef float FLOAT; +typedef double DOUBLE; // strings typedef char CHAR8; typedef wchar_t CHAR16; @@ -94,38 +94,38 @@ typedef CHAR8 SGPFILENAME[SGPFILENAME_LEN]; typedef struct { - INT32 iLeft; - INT32 iTop; - INT32 iRight; - INT32 iBottom; + INT32 iLeft; + INT32 iTop; + INT32 iRight; + INT32 iBottom; } SGPRect; typedef struct { INT32 iX; - INT32 iY; + INT32 iY; } SGPPoint; typedef struct { - INT32 Min; - INT32 Max; + INT32 Min; + INT32 Max; } SGPRange; -typedef FLOAT VECTOR2[2]; // 2d vector (2x1 matrix) -typedef FLOAT VECTOR3[3]; // 3d vector (3x1 matrix) -typedef FLOAT VECTOR4[4]; // 4d vector (4x1 matrix) +typedef FLOAT VECTOR2[2]; // 2d vector (2x1 matrix) +typedef FLOAT VECTOR3[3]; // 3d vector (3x1 matrix) +typedef FLOAT VECTOR4[4]; // 4d vector (4x1 matrix) typedef INT32 IVECTOR2[2]; // 2d vector (2x1 matrix) typedef INT32 IVECTOR3[3]; // 3d vector (3x1 matrix) typedef INT32 IVECTOR4[4]; // 4d vector (4x1 matrix) -typedef VECTOR3 MATRIX3[3]; // 3x3 matrix -typedef VECTOR4 MATRIX4[4]; // 4x4 matrix +typedef VECTOR3 MATRIX3[3]; // 3x3 matrix +typedef VECTOR4 MATRIX4[4]; // 4x4 matrix //typedef VECTOR3 ANGLE; // angle return array //lal removed typedef VECTOR4 COLOR; // rgba color array diff --git a/Standard Gaming Platform/WCheck.h b/Standard Gaming Platform/WCheck.h index 7aa1a85c..b6e1d69a 100644 --- a/Standard Gaming Platform/WCheck.h +++ b/Standard Gaming Platform/WCheck.h @@ -1,14 +1,14 @@ #ifndef __WCHECK_ #define __WCHECK_ -#define CHECKF(exp) if (!(exp)) { return(FALSE); } -#define CHECKV(exp) if (!(exp)) { return; } -#define CHECKN(exp) if (!(exp)) { return(NULL); } -#define CHECKBI(exp) if (!(exp)) { return(-1); } +#define CHECKF(exp) if (!(exp)) { return(FALSE); } +#define CHECKV(exp) if (!(exp)) { return; } +#define CHECKN(exp) if (!(exp)) { return(NULL); } +#define CHECKBI(exp) if (!(exp)) { return(-1); } -#define CHECKASSERTF(exp) if (!(exp)) { ASSERT(0); return(FALSE); } -#define CHECKASSERTV(exp) if (!(exp)) { ASSERT(0); return; } -#define CHECKASSERTN(exp) if (!(exp)) { ASSERT(0); return(NULL); } +#define CHECKASSERTF(exp) if (!(exp)) { ASSERT(0); return(FALSE); } +#define CHECKASSERTV(exp) if (!(exp)) { ASSERT(0); return; } +#define CHECKASSERTN(exp) if (!(exp)) { ASSERT(0); return(NULL); } #define CHECKASSERTBI(exp) if (!(exp)) { ASSERT(0); return(-1); } #endif diff --git a/Standard Gaming Platform/WinFont.cpp b/Standard Gaming Platform/WinFont.cpp index 36399900..7badeb3a 100644 --- a/Standard Gaming Platform/WinFont.cpp +++ b/Standard Gaming Platform/WinFont.cpp @@ -27,15 +27,15 @@ BOOLEAN gfEnumSucceed = FALSE; -#define MAX_WIN_FONTS 10 +#define MAX_WIN_FONTS 10 // Private struct not to be exported // to other modules typedef struct { - HFONT hFont; - COLORVAL ForeColor; - COLORVAL BackColor; + HFONT hFont; + COLORVAL ForeColor; + COLORVAL BackColor; } HWINFONT; @@ -44,7 +44,7 @@ LOGFONT gLogFont; HWINFONT WinFonts[ MAX_WIN_FONTS ]; -void Convert16BitStringTo8BitChineseBig5String( UINT8 *dst, UINT16 *src ) +void Convert16BitStringTo8BitChineseBig5String( CHAR8 *dst, CHAR16 *src ) { INT32 i, j; STR8 ptr; @@ -67,7 +67,7 @@ void Convert16BitStringTo8BitChineseBig5String( UINT8 *dst, UINT16 *src ) void InitWinFonts( ) { - memset( WinFonts, 0, sizeof( WinFonts ) ); + memset( WinFonts, 0, sizeof( WinFonts ) ); } void ShutdownWinFonts( ) @@ -77,15 +77,15 @@ void ShutdownWinFonts( ) INT32 FindFreeWinFont( void ) { - INT32 iCount; + INT32 iCount; for( iCount = 0; iCount < MAX_WIN_FONTS; iCount++ ) - { + { if( WinFonts[ iCount ].hFont == NULL ) - { + { return( iCount ); - } - } + } + } return( -1 ); } @@ -93,42 +93,42 @@ INT32 FindFreeWinFont( void ) HWINFONT *GetWinFont( INT32 iFont ) { - if ( iFont == -1 ) - { - return( NULL ); - } + if ( iFont == -1 ) + { + return( NULL ); + } - if ( WinFonts[ iFont ].hFont == NULL ) - { - return( NULL ); - } - else - { - return( &( WinFonts[ iFont ] ) ); - } + if ( WinFonts[ iFont ].hFont == NULL ) + { + return( NULL ); + } + else + { + return( &( WinFonts[ iFont ] ) ); + } } CHAR16 gzFontName[32]; -INT32 CreateWinFont( INT32 iHeight, INT32 iWidth, INT32 iEscapement, - INT32 iWeight, BOOLEAN fItalic, BOOLEAN fUnderline, BOOLEAN fStrikeOut, STR16 szFontName, INT32 iCharSet ) +INT32 CreateWinFont( INT32 iHeight, INT32 iWidth, INT32 iEscapement, + INT32 iWeight, BOOLEAN fItalic, BOOLEAN fUnderline, BOOLEAN fStrikeOut, STR16 szFontName, INT32 iCharSet ) { - INT32 iFont; - HFONT hFont; - CHAR8 szCharFontName[32]; //32 characters including null terminator (matches max font name length) - // Find free slot - iFont = FindFreeWinFont( ); + INT32 iFont; + HFONT hFont; + CHAR8 szCharFontName[32]; //32 characters including null terminator (matches max font name length) + // Find free slot + iFont = FindFreeWinFont( ); - if ( iFont == -1 ) - { - return( iFont ); - } + if ( iFont == -1 ) + { + return( iFont ); + } //SET UP FONT WE WANT TO LOAD HERE wcscpy( gzFontName, szFontName ); //ATTEMPT TO LOAD THE FONT NOW - sprintf( szCharFontName, "%S", szFontName ); + sprintf( szCharFontName, "%S", szFontName ); if( DoesWinFontExistOnSystem( szFontName, iCharSet ) ) { gLogFont.lfHeight = iHeight; @@ -141,77 +141,77 @@ INT32 CreateWinFont( INT32 iHeight, INT32 iWidth, INT32 iEscapement, return( -1 ); } - if ( hFont == NULL ) - { - return( -1 ); - } + if ( hFont == NULL ) + { + return( -1 ); + } - // Set font.... - WinFonts[ iFont ].hFont = hFont; + // Set font.... + WinFonts[ iFont ].hFont = hFont; - return( iFont ); + return( iFont ); } -void DeleteWinFont( INT32 iFont ) +void DeleteWinFont( INT32 iFont ) { - HWINFONT *pWinFont; - - pWinFont = GetWinFont( iFont ); + HWINFONT *pWinFont; + + pWinFont = GetWinFont( iFont ); - if ( pWinFont != NULL ) - { - DeleteObject( pWinFont->hFont ); - } + if ( pWinFont != NULL ) + { + DeleteObject( pWinFont->hFont ); + } } - + void SetWinFontForeColor( INT32 iFont, COLORVAL *pColor ) { - HWINFONT *pWinFont; - - pWinFont = GetWinFont( iFont ); + HWINFONT *pWinFont; + + pWinFont = GetWinFont( iFont ); - if ( pWinFont != NULL ) - { - pWinFont->ForeColor = ( *pColor ); - } + if ( pWinFont != NULL ) + { + pWinFont->ForeColor = ( *pColor ); + } } - + void SetWinFontBackColor( INT32 iFont, COLORVAL *pColor ) { - HWINFONT *pWinFont; - - pWinFont = GetWinFont( iFont ); + HWINFONT *pWinFont; + + pWinFont = GetWinFont( iFont ); - if ( pWinFont != NULL ) - { - pWinFont->BackColor = ( *pColor ); - } + if ( pWinFont != NULL ) + { + pWinFont->BackColor = ( *pColor ); + } } void PrintWinFont( UINT32 uiDestBuf, INT32 iFont, INT32 x, INT32 y, STR16 pFontString, ...) { - va_list argptr; - CHAR16 string2[512]; - CHAR8 string[512]; - HVSURFACE hVSurface; - LPDIRECTDRAWSURFACE2 pDDSurface; - HDC hdc; - RECT rc; - HWINFONT *pWinFont; - int len; - SIZE RectSize; - - pWinFont = GetWinFont( iFont ); + va_list argptr; + CHAR16 string2[512]; + CHAR8 string[512]; + HVSURFACE hVSurface; + LPDIRECTDRAWSURFACE2 pDDSurface; + HDC hdc; + RECT rc; + HWINFONT *pWinFont; + int len; + SIZE RectSize; + + pWinFont = GetWinFont( iFont ); - if ( pWinFont == NULL ) - { - return; - } + if ( pWinFont == NULL ) + { + return; + } - va_start(argptr, pFontString); // Set up variable argument pointer + va_start(argptr, pFontString); // Set up variable argument pointer len = vswprintf(string2, pFontString, argptr); // process gprintf string (get output str) va_end(argptr); @@ -221,38 +221,38 @@ void PrintWinFont( UINT32 uiDestBuf, INT32 iFont, INT32 x, INT32 y, STR16 pFontS sprintf( string, "%S", string2 ); #endif - // Get surface... - GetVideoSurface( &hVSurface, uiDestBuf ); + // Get surface... + GetVideoSurface( &hVSurface, uiDestBuf ); - pDDSurface = GetVideoSurfaceDDSurface( hVSurface ); + pDDSurface = GetVideoSurfaceDDSurface( hVSurface ); - IDirectDrawSurface2_GetDC( pDDSurface, &hdc ); + IDirectDrawSurface2_GetDC( pDDSurface, &hdc ); - SelectObject(hdc, pWinFont->hFont ); - SetTextColor( hdc, pWinFont->ForeColor ); - SetBkColor(hdc, pWinFont->BackColor ); - SetBkMode(hdc, TRANSPARENT); + SelectObject(hdc, pWinFont->hFont ); + SetTextColor( hdc, pWinFont->ForeColor ); + SetBkColor(hdc, pWinFont->BackColor ); + SetBkMode(hdc, TRANSPARENT); - GetTextExtentPoint32( hdc, string, len, &RectSize ); - SetRect(&rc, x, y, x + RectSize.cx, y + RectSize.cy ); - ExtTextOut( hdc, x, y, ETO_OPAQUE, &rc, string, len, NULL ); - IDirectDrawSurface2_ReleaseDC( pDDSurface, hdc ); + GetTextExtentPoint32( hdc, string, len, &RectSize ); + SetRect(&rc, x, y, x + RectSize.cx, y + RectSize.cy ); + ExtTextOut( hdc, x, y, ETO_OPAQUE, &rc, string, len, NULL ); + IDirectDrawSurface2_ReleaseDC( pDDSurface, hdc ); } INT16 WinFontStringPixLength( STR16 string2, INT32 iFont ) { - HWINFONT *pWinFont; - HDC hdc; - SIZE RectSize; - CHAR8 string[512]; - - pWinFont = GetWinFont( iFont ); + HWINFONT *pWinFont; + HDC hdc; + SIZE RectSize; + CHAR8 string[512]; + + pWinFont = GetWinFont( iFont ); - if ( pWinFont == NULL ) - { - return( 0 ); - } + if ( pWinFont == NULL ) + { + return( 0 ); + } #ifdef TAIWANESE Convert16BitStringTo8BitChineseBig5String( string, string2 ); @@ -260,28 +260,28 @@ INT16 WinFontStringPixLength( STR16 string2, INT32 iFont ) sprintf( string, "%S", string2 ); #endif - hdc = GetDC(NULL); - SelectObject(hdc, pWinFont->hFont ); - GetTextExtentPoint32( hdc, string, strlen(string), &RectSize ); - ReleaseDC(NULL, hdc); - - return( (INT16)RectSize.cx ); + hdc = GetDC(NULL); + SelectObject(hdc, pWinFont->hFont ); + GetTextExtentPoint32( hdc, string, strlen(string), &RectSize ); + ReleaseDC(NULL, hdc); + + return( (INT16)RectSize.cx ); } INT16 GetWinFontHeight( STR16 string2, INT32 iFont ) { - HWINFONT *pWinFont; - HDC hdc; - SIZE RectSize; - CHAR8 string[512]; + HWINFONT *pWinFont; + HDC hdc; + SIZE RectSize; + CHAR8 string[512]; - pWinFont = GetWinFont( iFont ); + pWinFont = GetWinFont( iFont ); - if ( pWinFont == NULL ) - { - return( 0 ); - } + if ( pWinFont == NULL ) + { + return( 0 ); + } #ifdef TAIWANESE Convert16BitStringTo8BitChineseBig5String( string, string2 ); @@ -289,34 +289,34 @@ INT16 GetWinFontHeight( STR16 string2, INT32 iFont ) sprintf( string, "%S", string2 ); #endif - hdc = GetDC(NULL); - SelectObject(hdc, pWinFont->hFont ); - GetTextExtentPoint32( hdc, string, strlen(string), &RectSize ); - ReleaseDC(NULL, hdc); - - return( (INT16)RectSize.cy ); + hdc = GetDC(NULL); + SelectObject(hdc, pWinFont->hFont ); + GetTextExtentPoint32( hdc, string, strlen(string), &RectSize ); + ReleaseDC(NULL, hdc); + + return( (INT16)RectSize.cy ); } UINT32 WinFont_mprintf( INT32 iFont, INT32 x, INT32 y, STR16 pFontString, ...) { - va_list argptr; - CHAR16 string[512]; + va_list argptr; + CHAR16 string[512]; - va_start(argptr, pFontString); // Set up variable argument pointer + va_start(argptr, pFontString); // Set up variable argument pointer vswprintf(string, pFontString, argptr); // process gprintf string (get output str) va_end(argptr); - PrintWinFont( FontDestBuffer, iFont, x, y, string ); + PrintWinFont( FontDestBuffer, iFont, x, y, string ); - return( 1 ); + return( 1 ); } -int CALLBACK EnumFontFamProc( CONST LOGFONT *lplf, CONST TEXTMETRIC *lptm, DWORD dwType, LPARAM lpData ) +int CALLBACK EnumFontFamProc( CONST LOGFONT *lplf, CONST TEXTMETRIC *lptm, DWORD dwType, LPARAM lpData ) { - gfEnumSucceed = TRUE; + gfEnumSucceed = TRUE; - return( TRUE ); + return( TRUE ); } @@ -325,7 +325,7 @@ int CALLBACK EnumFontFamExProc( ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme, CHAR8 szFontName[32]; sprintf( szFontName, "%S", gzFontName ); - if( !strcmp( szFontName, (STR8) lpelfe->elfFullName ) ) + if( !strcmp( szFontName, (STR8) lpelfe->elfFullName ) ) { gfEnumSucceed = TRUE; memcpy( &gLogFont, &(lpelfe->elfLogFont), sizeof( LOGFONT ) ); @@ -337,12 +337,12 @@ int CALLBACK EnumFontFamExProc( ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme, BOOLEAN DoesWinFontExistOnSystem( STR16 pTypeFaceName, INT32 iCharSet ) { - HDC hdc; + HDC hdc; char string[512]; LOGFONT LogFont; - hdc = GetDC(NULL); + hdc = GetDC(NULL); - gfEnumSucceed = FALSE; + gfEnumSucceed = FALSE; // Copy into 8-bit! sprintf( string, "%S", pTypeFaceName ); @@ -351,8 +351,8 @@ BOOLEAN DoesWinFontExistOnSystem( STR16 pTypeFaceName, INT32 iCharSet ) lstrcpy( (LPSTR)&LogFont.lfFaceName, string ); EnumFontFamiliesEx( hdc, &LogFont, (FONTENUMPROCA) EnumFontFamExProc, 0, 0 ); - + ReleaseDC(NULL, hdc); - return( gfEnumSucceed ); + return( gfEnumSucceed ); } \ No newline at end of file diff --git a/Standard Gaming Platform/WinFont.h b/Standard Gaming Platform/WinFont.h index 5643c4e3..7c897b76 100644 --- a/Standard Gaming Platform/WinFont.h +++ b/Standard Gaming Platform/WinFont.h @@ -4,16 +4,16 @@ void InitWinFonts( ); void ShutdownWinFonts( ); -INT32 CreateWinFont( INT32 iHeight, INT32 iWidth, INT32 iEscapement, - INT32 iWeight, BOOLEAN fItalic, BOOLEAN fUnderline, BOOLEAN fStrikeOut, STR16 szFontName, INT32 iCharSet ); -void DeleteWinFont( INT32 iFont ); +INT32 CreateWinFont( INT32 iHeight, INT32 iWidth, INT32 iEscapement, + INT32 iWeight, BOOLEAN fItalic, BOOLEAN fUnderline, BOOLEAN fStrikeOut, STR16 szFontName, INT32 iCharSet ); +void DeleteWinFont( INT32 iFont ); void SetWinFontBackColor( INT32 iFont, COLORVAL *pColor ); void SetWinFontForeColor( INT32 iFont, COLORVAL *pColor ); void PrintWinFont( UINT32 uiDestBuf, INT32 iFont, INT32 x, INT32 y, STR16 pFontString, ...); -INT16 WinFontStringPixLength( STR16 string, INT32 iFont ); +INT16 WinFontStringPixLength( STR16 string, INT32 iFont ); INT16 GetWinFontHeight( STR16 string, INT32 iFont ); UINT32 WinFont_mprintf( INT32 iFont, INT32 x, INT32 y, STR16 pFontString, ...); diff --git a/Standard Gaming Platform/WizShare.h b/Standard Gaming Platform/WizShare.h index 9e561184..73216e57 100644 --- a/Standard Gaming Platform/WizShare.h +++ b/Standard Gaming Platform/WizShare.h @@ -28,7 +28,7 @@ //************************************************************************** #define MAX_MSG_LENGTH 128 -#define NUM_MESSAGES 100 +#define NUM_MESSAGES 100 //************************************************************************** // diff --git a/Standard Gaming Platform/ZCONF.H b/Standard Gaming Platform/ZCONF.H index 836a21c6..38df56c4 100644 --- a/Standard Gaming Platform/ZCONF.H +++ b/Standard Gaming Platform/ZCONF.H @@ -13,49 +13,49 @@ * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. */ #ifdef Z_PREFIX -# define deflateInit_ z_deflateInit_ -# define deflate z_deflate -# define deflateEnd z_deflateEnd -# define inflateInit_ z_inflateInit_ -# define inflate z_inflate -# define inflateEnd z_inflateEnd -# define deflateInit2_ z_deflateInit2_ -# define deflateSetDictionary z_deflateSetDictionary -# define deflateCopy z_deflateCopy -# define deflateReset z_deflateReset -# define deflateParams z_deflateParams -# define inflateInit2_ z_inflateInit2_ -# define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync -# define inflateReset z_inflateReset -# define compress z_compress -# define uncompress z_uncompress -# define adler32 z_adler32 -# define crc32 z_crc32 -# define get_crc_table z_get_crc_table +# define deflateInit_ z_deflateInit_ +# define deflate z_deflate +# define deflateEnd z_deflateEnd +# define inflateInit_ z_inflateInit_ +# define inflate z_inflate +# define inflateEnd z_inflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateSetDictionary z_deflateSetDictionary +# define deflateCopy z_deflateCopy +# define deflateReset z_deflateReset +# define deflateParams z_deflateParams +# define inflateInit2_ z_inflateInit2_ +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateReset z_inflateReset +# define compress z_compress +# define uncompress z_uncompress +# define adler32 z_adler32 +# define crc32 z_crc32 +# define get_crc_table z_get_crc_table -# define Byte z_Byte -# define uInt z_uInt -# define uLong z_uLong -# define Bytef z_Bytef -# define charf z_charf -# define intf z_intf -# define uIntf z_uIntf -# define uLongf z_uLongf -# define voidpf z_voidpf -# define voidp z_voidp +# define Byte z_Byte +# define uInt z_uInt +# define uLong z_uLong +# define Bytef z_Bytef +# define charf z_charf +# define intf z_intf +# define uIntf z_uIntf +# define uLongf z_uLongf +# define voidpf z_voidpf +# define voidp z_voidp #endif #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) -# define WIN32 +# define WIN32 #endif #if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386) -# ifndef __32BIT__ -# define __32BIT__ -# endif +# ifndef __32BIT__ +# define __32BIT__ +# endif #endif #if defined(__MSDOS__) && !defined(MSDOS) -# define MSDOS +# define MSDOS #endif /* @@ -63,122 +63,122 @@ * than 64k bytes at a time (needed on systems with 16-bit int). */ #if defined(MSDOS) && !defined(__32BIT__) -# define MAXSEG_64K +# define MAXSEG_64K #endif #ifdef MSDOS -# define UNALIGNED_OK +# define UNALIGNED_OK #endif -#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC) -# define STDC +#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC) +# define STDC #endif #if (defined(__STDC__) || defined(__cplusplus)) && !defined(STDC) -# define STDC +# define STDC #endif #ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const -# endif +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const +# endif #endif /* Some Mac compilers merge all .h files incorrectly: */ #if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__) -# define NO_DUMMY_DECL +# define NO_DUMMY_DECL #endif /* Maximum value for memLevel in deflateInit2 */ #ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif #endif /* Maximum value for windowBits in deflateInit2 and inflateInit2 */ #ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ +# define MAX_WBITS 15 /* 32K LZ77 window */ #endif /* The memory requirements for deflate are (in bytes): - 1 << (windowBits+2) + 1 << (memLevel+9) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + 1 << (windowBits+2) + 1 << (memLevel+9) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) plus a few kilobytes for small objects. For example, if you want to reduce the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" Of course this will generally degrade compression (there's no free lunch). - The memory requirements for inflate are (in bytes) 1 << windowBits + The memory requirements for inflate are (in bytes) 1 << windowBits that is, 32K for windowBits=15 (default value) plus a few kilobytes for small objects. */ - /* Type declarations */ + /* Type declarations */ #ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif #endif /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have - * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, * just define FAR to be empty. */ #if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR __far -# else -# define FAR far -# endif + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR __far +# else +# define FAR far +# endif #endif #if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) -# ifndef __32BIT__ -# define SMALL_MEDIUM -# define FAR __far -# endif +# ifndef __32BIT__ +# define SMALL_MEDIUM +# define FAR __far +# endif #endif #ifndef FAR -# define FAR +# define FAR #endif -typedef unsigned char Byte; /* 8 bits */ -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ +typedef unsigned char Byte; /* 8 bits */ +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ #if defined(__BORLANDC__) && defined(SMALL_MEDIUM) - /* Borland C/C++ ignores FAR inside typedef */ -# define Bytef Byte FAR + /* Borland C/C++ ignores FAR inside typedef */ +# define Bytef Byte FAR #else - typedef Byte FAR Bytef; + typedef Byte FAR Bytef; #endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; typedef uLong FAR uLongf; #ifdef STDC - typedef void FAR *voidpf; - typedef void *voidp; + typedef void FAR *voidpf; + typedef void *voidp; #else - typedef Byte FAR *voidpf; - typedef Byte *voidp; + typedef Byte FAR *voidpf; + typedef Byte *voidp; #endif /* Compile with -DZLIB_DLL for Windows DLL support */ #if (defined(_WINDOWS) || defined(WINDOWS)) && defined(ZLIB_DLL) -# include -# define EXPORT WINAPI +# include +# define EXPORT WINAPI #else -# define EXPORT +# define EXPORT #endif #endif /* _ZCONF_H */ diff --git a/Standard Gaming Platform/ZLIB.H b/Standard Gaming Platform/ZLIB.H index 58f66695..91dd11dc 100644 --- a/Standard Gaming Platform/ZLIB.H +++ b/Standard Gaming Platform/ZLIB.H @@ -1,31 +1,31 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.0.4, Jul 24th, 1996. + version 1.0.4, Jul 24th, 1996. - Copyright (C) 1995-1996 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-1996 Jean-loup Gailly and Mark Adler - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. - Jean-loup Gailly Mark Adler - gzip@prep.ai.mit.edu madler@alumni.caltech.edu + Jean-loup Gailly Mark Adler + gzip@prep.ai.mit.edu madler@alumni.caltech.edu - The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt - (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt + (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). */ #ifndef _ZLIB_H @@ -40,735 +40,735 @@ extern "C" { #define ZLIB_VERSION "1.0.4" /* - The 'zlib' compression library provides in-memory compression and - decompression functions, including integrity checks of the uncompressed - data. This version of the library supports only one compression method - (deflation) but other algorithms may be added later and will have the same - stream interface. + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed + data. This version of the library supports only one compression method + (deflation) but other algorithms may be added later and will have the same + stream interface. - For compression the application must provide the output buffer and - may optionally provide the input buffer for optimization. For decompression, - the application must provide the input buffer and may optionally provide - the output buffer for optimization. + For compression the application must provide the output buffer and + may optionally provide the input buffer for optimization. For decompression, + the application must provide the input buffer and may optionally provide + the output buffer for optimization. - Compression can be done in a single step if the buffers are large - enough (for example if an input file is mmap'ed), or can be done by - repeated calls of the compression function. In the latter case, the - application must provide more input and/or consume the output - (providing more output space) before each call. + Compression can be done in a single step if the buffers are large + enough (for example if an input file is mmap'ed), or can be done by + repeated calls of the compression function. In the latter case, the + application must provide more input and/or consume the output + (providing more output space) before each call. - The library does not install any signal handler. It is recommended to - add at least a handler for SIGSEGV when decompressing; the library checks - the consistency of the input data whenever possible but may go nuts - for some forms of corrupted input. + The library does not install any signal handler. It is recommended to + add at least a handler for SIGSEGV when decompressing; the library checks + the consistency of the input data whenever possible but may go nuts + for some forms of corrupted input. */ typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); -typedef void (*free_func) OF((voidpf opaque, voidpf address)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); struct internal_state; typedef struct z_stream_s { - Bytef *next_in; /* next input byte */ - uInt avail_in; /* number of bytes available at next_in */ - uLong total_in; /* total nb of input bytes read so far */ + Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total nb of input bytes read so far */ - Bytef *next_out; /* next output byte should be put there */ - uInt avail_out; /* remaining free space at next_out */ - uLong total_out; /* total nb of bytes output so far */ + Bytef *next_out; /* next output byte should be put there */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total nb of bytes output so far */ - char *msg; /* last error message, NULL if no error */ - struct internal_state FAR *state; /* not visible by applications */ + char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ - alloc_func zalloc; /* used to allocate the internal state */ - free_func zfree; /* used to free the internal state */ - voidpf opaque; /* private data object passed to zalloc and zfree */ + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ - int data_type; /* best guess about the data type: ascii or binary */ - uLong adler; /* adler32 value of the uncompressed data */ - uLong reserved; /* reserved for future use */ + int data_type; /* best guess about the data type: ascii or binary */ + uLong adler; /* adler32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ } z_stream; typedef z_stream FAR *z_streamp; /* - The application must update next_in and avail_in when avail_in has - dropped to zero. It must update next_out and avail_out when avail_out - has dropped to zero. The application must initialize zalloc, zfree and - opaque before calling the init function. All other fields are set by the - compression library and must not be updated by the application. + The application must update next_in and avail_in when avail_in has + dropped to zero. It must update next_out and avail_out when avail_out + has dropped to zero. The application must initialize zalloc, zfree and + opaque before calling the init function. All other fields are set by the + compression library and must not be updated by the application. - The opaque value provided by the application will be passed as the first - parameter for calls of zalloc and zfree. This can be useful for custom - memory management. The compression library attaches no meaning to the - opaque value. + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. - zalloc must return Z_NULL if there is not enough memory for the object. - On 16-bit systems, the functions zalloc and zfree must be able to allocate - exactly 65536 bytes, but will not be required to allocate more than this - if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, - pointers returned by zalloc for objects of exactly 65536 bytes *must* - have their offset normalized to zero. The default allocation function - provided by this library ensures this (see zutil.c). To reduce memory - requirements and avoid any allocation of 64K objects, at the expense of - compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). + zalloc must return Z_NULL if there is not enough memory for the object. + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this + if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, + pointers returned by zalloc for objects of exactly 65536 bytes *must* + have their offset normalized to zero. The default allocation function + provided by this library ensures this (see zutil.c). To reduce memory + requirements and avoid any allocation of 64K objects, at the expense of + compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). - The fields total_in and total_out can be used for statistics or - progress reports. After compression, total_in holds the total size of - the uncompressed data and may be saved for use in the decompressor - (particularly if the decompressor wants to decompress everything in - a single step). + The fields total_in and total_out can be used for statistics or + progress reports. After compression, total_in holds the total size of + the uncompressed data and may be saved for use in the decompressor + (particularly if the decompressor wants to decompress everything in + a single step). */ - /* constants */ + /* constants */ -#define Z_NO_FLUSH 0 +#define Z_NO_FLUSH 0 #define Z_PARTIAL_FLUSH 1 -#define Z_SYNC_FLUSH 2 -#define Z_FULL_FLUSH 3 -#define Z_FINISH 4 +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 /* Allowed flush values; see deflate() below for details */ -#define Z_OK 0 -#define Z_STREAM_END 1 -#define Z_NEED_DICT 2 -#define Z_ERRNO (-1) +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) #define Z_STREAM_ERROR (-2) -#define Z_DATA_ERROR (-3) -#define Z_MEM_ERROR (-4) -#define Z_BUF_ERROR (-5) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) #define Z_VERSION_ERROR (-6) /* Return codes for the compression/decompression functions. Negative * values are errors, positive values are used for special but normal events. */ -#define Z_NO_COMPRESSION 0 -#define Z_BEST_SPEED 1 -#define Z_BEST_COMPRESSION 9 -#define Z_DEFAULT_COMPRESSION (-1) +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) /* compression levels */ -#define Z_FILTERED 1 -#define Z_HUFFMAN_ONLY 2 -#define Z_DEFAULT_STRATEGY 0 +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_DEFAULT_STRATEGY 0 /* compression strategy; see deflateInit2() below for details */ -#define Z_BINARY 0 -#define Z_ASCII 1 -#define Z_UNKNOWN 2 +#define Z_BINARY 0 +#define Z_ASCII 1 +#define Z_UNKNOWN 2 /* Possible values of the data_type field */ -#define Z_DEFLATED 8 +#define Z_DEFLATED 8 /* The deflate compression method (the only one supported in this version) */ -#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ #define zlib_version zlibVersion() /* for compatibility with versions < 1.0.2 */ - /* basic functions */ + /* basic functions */ extern const char * EXPORT zlibVersion OF((void)); /* The application can compare zlibVersion and ZLIB_VERSION for consistency. - If the first character differs, the library code actually used is - not compatible with the zlib.h header file used by the application. - This check is automatically made by deflateInit and inflateInit. + If the first character differs, the library code actually used is + not compatible with the zlib.h header file used by the application. + This check is automatically made by deflateInit and inflateInit. */ /* extern int EXPORT deflateInit OF((z_streamp strm, int level)); - Initializes the internal stream state for compression. The fields - zalloc, zfree and opaque must be initialized before by the caller. - If zalloc and zfree are set to Z_NULL, deflateInit updates them to - use default allocation functions. + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. + If zalloc and zfree are set to Z_NULL, deflateInit updates them to + use default allocation functions. - The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: - 1 gives best speed, 9 gives best compression, 0 gives no compression at - all (the input data is simply copied a block at a time). - Z_DEFAULT_COMPRESSION requests a default compromise between speed and - compression (currently equivalent to level 6). + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at + all (the input data is simply copied a block at a time). + Z_DEFAULT_COMPRESSION requests a default compromise between speed and + compression (currently equivalent to level 6). - deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if level is not a valid compression level, - Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible - with the version assumed by the caller (ZLIB_VERSION). - msg is set to null if there is no error message. deflateInit does not - perform any compression: this will be done by deflate(). + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if level is not a valid compression level, + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). + msg is set to null if there is no error message. deflateInit does not + perform any compression: this will be done by deflate(). */ extern int EXPORT deflate OF((z_streamp strm, int flush)); /* - Performs one or both of the following actions: + Performs one or both of the following actions: - - Compress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in and avail_in are updated and - processing will resume at this point for the next call of deflate(). + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). - - Provide more output starting at next_out and update next_out and avail_out - accordingly. This action is forced if the parameter flush is non zero. - Forcing flush frequently degrades the compression ratio, so this parameter - should be set only when necessary (in interactive applications). - Some output may be provided even if flush is not set. + - Provide more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary (in interactive applications). + Some output may be provided even if flush is not set. - Before the call of deflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating avail_in or avail_out accordingly; avail_out - should never be zero before the call. The application can consume the - compressed output when it wants, for example when the output buffer is full - (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK - and with zero avail_out, it must be called again after making room in the - output buffer because there might be more output pending. + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating avail_in or avail_out accordingly; avail_out + should never be zero before the call. The application can consume the + compressed output when it wants, for example when the output buffer is full + (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK + and with zero avail_out, it must be called again after making room in the + output buffer because there might be more output pending. - If the parameter flush is set to Z_PARTIAL_FLUSH, the current compression - block is terminated and flushed to the output buffer so that the - decompressor can get all input data available so far. For method 9, a future - variant on method 8, the current block will be flushed but not terminated. - Z_SYNC_FLUSH has the same effect as partial flush except that the compressed - output is byte aligned (the compressor can clear its internal bit buffer) - and the current block is always terminated; this can be useful if the - compressor has to be restarted from scratch after an interruption (in which - case the internal state of the compressor may be lost). - If flush is set to Z_FULL_FLUSH, the compression block is terminated, a - special marker is output and the compression dictionary is discarded; this - is useful to allow the decompressor to synchronize if one compressed block - has been damaged (see inflateSync below). Flushing degrades compression and - so should be used only when necessary. Using Z_FULL_FLUSH too often can - seriously degrade the compression. If deflate returns with avail_out == 0, - this function must be called again with the same value of the flush - parameter and more output space (updated avail_out), until the flush is - complete (deflate returns with non-zero avail_out). + If the parameter flush is set to Z_PARTIAL_FLUSH, the current compression + block is terminated and flushed to the output buffer so that the + decompressor can get all input data available so far. For method 9, a future + variant on method 8, the current block will be flushed but not terminated. + Z_SYNC_FLUSH has the same effect as partial flush except that the compressed + output is byte aligned (the compressor can clear its internal bit buffer) + and the current block is always terminated; this can be useful if the + compressor has to be restarted from scratch after an interruption (in which + case the internal state of the compressor may be lost). + If flush is set to Z_FULL_FLUSH, the compression block is terminated, a + special marker is output and the compression dictionary is discarded; this + is useful to allow the decompressor to synchronize if one compressed block + has been damaged (see inflateSync below). Flushing degrades compression and + so should be used only when necessary. Using Z_FULL_FLUSH too often can + seriously degrade the compression. If deflate returns with avail_out == 0, + this function must be called again with the same value of the flush + parameter and more output space (updated avail_out), until the flush is + complete (deflate returns with non-zero avail_out). - If the parameter flush is set to Z_FINISH, pending input is processed, - pending output is flushed and deflate returns with Z_STREAM_END if there - was enough output space; if deflate returns with Z_OK, this function must be - called again with Z_FINISH and more output space (updated avail_out) but no - more input data, until it returns with Z_STREAM_END or an error. After - deflate has returned Z_STREAM_END, the only possible operations on the - stream are deflateReset or deflateEnd. - - Z_FINISH can be used immediately after deflateInit if all the compression - is to be done in a single step. In this case, avail_out must be at least - 0.1% larger than avail_in plus 12 bytes. If deflate does not return - Z_STREAM_END, then it must be called again as described above. + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there + was enough output space; if deflate returns with Z_OK, this function must be + called again with Z_FINISH and more output space (updated avail_out) but no + more input data, until it returns with Z_STREAM_END or an error. After + deflate has returned Z_STREAM_END, the only possible operations on the + stream are deflateReset or deflateEnd. + + Z_FINISH can be used immediately after deflateInit if all the compression + is to be done in a single step. In this case, avail_out must be at least + 0.1% larger than avail_in plus 12 bytes. If deflate does not return + Z_STREAM_END, then it must be called again as described above. - deflate() may update data_type if it can make a good guess about - the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered - binary. This field is only for information purposes and does not affect - the compression algorithm in any manner. + deflate() may update data_type if it can make a good guess about + the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered + binary. This field is only for information purposes and does not affect + the compression algorithm in any manner. - deflate() returns Z_OK if some progress has been made (more input - processed or more output produced), Z_STREAM_END if all input has been - consumed and all output has been produced (only when flush is set to - Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible. + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible. */ extern int EXPORT deflateEnd OF((z_streamp strm)); /* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. - deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the - stream state was inconsistent, Z_DATA_ERROR if the stream was freed - prematurely (some input or output was discarded). In the error case, - msg may be set but then points to a static string (which must not be - deallocated). + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, + msg may be set but then points to a static string (which must not be + deallocated). */ /* extern int EXPORT inflateInit OF((z_streamp strm)); - Initializes the internal stream state for decompression. The fields - zalloc, zfree and opaque must be initialized before by the caller. If - zalloc and zfree are set to Z_NULL, inflateInit updates them to use default - allocation functions. + Initializes the internal stream state for decompression. The fields + zalloc, zfree and opaque must be initialized before by the caller. If + zalloc and zfree are set to Z_NULL, inflateInit updates them to use default + allocation functions. - inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_VERSION_ERROR if the zlib library version is incompatible - with the version assumed by the caller. msg is set to null if there is no - error message. inflateInit does not perform any decompression: this will be - done by inflate(). + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_VERSION_ERROR if the zlib library version is incompatible + with the version assumed by the caller. msg is set to null if there is no + error message. inflateInit does not perform any decompression: this will be + done by inflate(). */ extern int EXPORT inflate OF((z_streamp strm, int flush)); /* - Performs one or both of the following actions: + Performs one or both of the following actions: - - Decompress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in is updated and processing - will resume at this point for the next call of inflate(). + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in is updated and processing + will resume at this point for the next call of inflate(). - - Provide more output starting at next_out and update next_out and avail_out - accordingly. inflate() provides as much output as possible, until there - is no more input data or no more space in the output buffer (see below - about the flush parameter). + - Provide more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there + is no more input data or no more space in the output buffer (see below + about the flush parameter). - Before the call of inflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating the next_* and avail_* values accordingly. - The application can consume the uncompressed output when it wants, for - example when the output buffer is full (avail_out == 0), or after each - call of inflate(). If inflate returns Z_OK and with zero avail_out, it - must be called again after making room in the output buffer because there - might be more output pending. + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating the next_* and avail_* values accordingly. + The application can consume the uncompressed output when it wants, for + example when the output buffer is full (avail_out == 0), or after each + call of inflate(). If inflate returns Z_OK and with zero avail_out, it + must be called again after making room in the output buffer because there + might be more output pending. - If the parameter flush is set to Z_PARTIAL_FLUSH, inflate flushes as much - output as possible to the output buffer. The flushing behavior of inflate is - not specified for values of the flush parameter other than Z_PARTIAL_FLUSH - and Z_FINISH, but the current implementation actually flushes as much output - as possible anyway. + If the parameter flush is set to Z_PARTIAL_FLUSH, inflate flushes as much + output as possible to the output buffer. The flushing behavior of inflate is + not specified for values of the flush parameter other than Z_PARTIAL_FLUSH + and Z_FINISH, but the current implementation actually flushes as much output + as possible anyway. - inflate() should normally be called until it returns Z_STREAM_END or an - error. However if all decompression is to be performed in a single step - (a single call of inflate), the parameter flush should be set to - Z_FINISH. In this case all pending input is processed and all pending - output is flushed; avail_out must be large enough to hold all the - uncompressed data. (The size of the uncompressed data may have been saved - by the compressor for this purpose.) The next operation on this stream must - be inflateEnd to deallocate the decompression state. The use of Z_FINISH - is never required, but can be used to inform inflate that a faster routine - may be used for the single inflate() call. + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step + (a single call of inflate), the parameter flush should be set to + Z_FINISH. In this case all pending input is processed and all pending + output is flushed; avail_out must be large enough to hold all the + uncompressed data. (The size of the uncompressed data may have been saved + by the compressor for this purpose.) The next operation on this stream must + be inflateEnd to deallocate the decompression state. The use of Z_FINISH + is never required, but can be used to inform inflate that a faster routine + may be used for the single inflate() call. - inflate() returns Z_OK if some progress has been made (more input - processed or more output produced), Z_STREAM_END if the end of the - compressed data has been reached and all uncompressed output has been - produced, Z_NEED_DICT if a preset dictionary is needed at this point (see - inflateSetDictionary below), Z_DATA_ERROR if the input data was corrupted, - Z_STREAM_ERROR if the stream structure was inconsistent (for example if - next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, - Z_BUF_ERROR if no progress is possible or if there was not enough room in - the output buffer when Z_FINISH is used. In the Z_DATA_ERROR case, the - application may then call inflateSync to look for a good compression block. - In the Z_NEED_DICT case, strm->adler is set to the Adler32 value of the - dictionary chosen by the compressor. + inflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if the end of the + compressed data has been reached and all uncompressed output has been + produced, Z_NEED_DICT if a preset dictionary is needed at this point (see + inflateSetDictionary below), Z_DATA_ERROR if the input data was corrupted, + Z_STREAM_ERROR if the stream structure was inconsistent (for example if + next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, + Z_BUF_ERROR if no progress is possible or if there was not enough room in + the output buffer when Z_FINISH is used. In the Z_DATA_ERROR case, the + application may then call inflateSync to look for a good compression block. + In the Z_NEED_DICT case, strm->adler is set to the Adler32 value of the + dictionary chosen by the compressor. */ extern int EXPORT inflateEnd OF((z_streamp strm)); /* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. - inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state - was inconsistent. In the error case, msg may be set but then points to a - static string (which must not be deallocated). + inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state + was inconsistent. In the error case, msg may be set but then points to a + static string (which must not be deallocated). */ - /* Advanced functions */ + /* Advanced functions */ /* - The following functions are needed only in some special applications. + The following functions are needed only in some special applications. */ -/* +/* extern int EXPORT deflateInit2 OF((z_streamp strm, - int level, - int method, - int windowBits, - int memLevel, - int strategy)); + int level, + int method, + int windowBits, + int memLevel, + int strategy)); - This is another version of deflateInit with more compression options. The - fields next_in, zalloc, zfree and opaque must be initialized before by - the caller. + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by + the caller. - The method parameter is the compression method. It must be Z_DEFLATED in - this version of the library. (Method 9 will allow a 64K history buffer and - partial block flushes.) + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. (Method 9 will allow a 64K history buffer and + partial block flushes.) - The windowBits parameter is the base two logarithm of the window size - (the size of the history buffer). It should be in the range 8..15 for this - version of the library (the value 16 will be allowed for method 9). Larger - values of this parameter result in better compression at the expense of - memory usage. The default value is 15 if deflateInit is used instead. + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library (the value 16 will be allowed for method 9). Larger + values of this parameter result in better compression at the expense of + memory usage. The default value is 15 if deflateInit is used instead. - The memLevel parameter specifies how much memory should be allocated - for the internal compression state. memLevel=1 uses minimum memory but - is slow and reduces compression ratio; memLevel=9 uses maximum memory - for optimal speed. The default value is 8. See zconf.h for total memory - usage as a function of windowBits and memLevel. + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but + is slow and reduces compression ratio; memLevel=9 uses maximum memory + for optimal speed. The default value is 8. See zconf.h for total memory + usage as a function of windowBits and memLevel. - The strategy parameter is used to tune the compression algorithm. Use the - value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a - filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no - string match). Filtered data consists mostly of small values with a - somewhat random distribution. In this case, the compression algorithm is - tuned to compress them better. The effect of Z_FILTERED is to force more - Huffman coding and less string matching; it is somewhat intermediate - between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects - the compression ratio but not the correctness of the compressed output even - if it is not set appropriately. + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match). Filtered data consists mostly of small values with a + somewhat random distribution. In this case, the compression algorithm is + tuned to compress them better. The effect of Z_FILTERED is to force more + Huffman coding and less string matching; it is somewhat intermediate + between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects + the compression ratio but not the correctness of the compressed output even + if it is not set appropriately. - If next_in is not null, the library will use this buffer to hold also - some history information; the buffer must either hold the entire input - data, or have at least 1<<(windowBits+1) bytes and be writable. If next_in - is null, the library will allocate its own history buffer (and leave next_in - null). next_out need not be provided here but must be provided by the - application for the next call of deflate(). + If next_in is not null, the library will use this buffer to hold also + some history information; the buffer must either hold the entire input + data, or have at least 1<<(windowBits+1) bytes and be writable. If next_in + is null, the library will allocate its own history buffer (and leave next_in + null). next_out need not be provided here but must be provided by the + application for the next call of deflate(). - If the history buffer is provided by the application, next_in must - must never be changed by the application since the compressor maintains - information inside this buffer from call to call; the application - must provide more input only by increasing avail_in. next_in is always - reset by the library in this case. + If the history buffer is provided by the application, next_in must + must never be changed by the application since the compressor maintains + information inside this buffer from call to call; the application + must provide more input only by increasing avail_in. next_in is always + reset by the library in this case. - deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was - not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as - an invalid method). msg is set to null if there is no error message. - deflateInit2 does not perform any compression: this will be done by - deflate(). + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was + not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as + an invalid method). msg is set to null if there is no error message. + deflateInit2 does not perform any compression: this will be done by + deflate(). */ - + extern int EXPORT deflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); + const Bytef *dictionary, + uInt dictLength)); /* - Initializes the compression dictionary (history buffer) from the given - byte sequence without producing any compressed output. This function must - be called immediately after deflateInit or deflateInit2, before any call - of deflate. The compressor and decompressor must use exactly the same - dictionary (see inflateSetDictionary). - The dictionary should consist of strings (byte sequences) that are likely - to be encountered later in the data to be compressed, with the most commonly - used strings preferably put towards the end of the dictionary. Using a - dictionary is most useful when the data to be compressed is short and - can be predicted with good accuracy; the data can then be compressed better - than with the default empty dictionary. In this version of the library, - only the last 32K bytes of the dictionary are used. - Upon return of this function, strm->adler is set to the Adler32 value - of the dictionary; the decompressor may later use this value to determine - which dictionary has been used by the compressor. (The Adler32 value - applies to the whole dictionary even if only a subset of the dictionary is - actually used by the compressor.) + Initializes the compression dictionary (history buffer) from the given + byte sequence without producing any compressed output. This function must + be called immediately after deflateInit or deflateInit2, before any call + of deflate. The compressor and decompressor must use exactly the same + dictionary (see inflateSetDictionary). + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and + can be predicted with good accuracy; the data can then be compressed better + than with the default empty dictionary. In this version of the library, + only the last 32K bytes of the dictionary are used. + Upon return of this function, strm->adler is set to the Adler32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The Adler32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) - deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state - is inconsistent (for example if deflate has already been called for this - stream). deflateSetDictionary does not perform any compression: this will - be done by deflate(). + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state + is inconsistent (for example if deflate has already been called for this + stream). deflateSetDictionary does not perform any compression: this will + be done by deflate(). */ extern int EXPORT deflateCopy OF((z_streamp dest, - z_streamp source)); + z_streamp source)); /* - Sets the destination stream as a complete copy of the source stream. If - the source stream is using an application-supplied history buffer, a new - buffer is allocated for the destination stream. The compressed output - buffer is always application-supplied. It's the responsibility of the - application to provide the correct values of next_out and avail_out for the - next call of deflate. + Sets the destination stream as a complete copy of the source stream. If + the source stream is using an application-supplied history buffer, a new + buffer is allocated for the destination stream. The compressed output + buffer is always application-supplied. It's the responsibility of the + application to provide the correct values of next_out and avail_out for the + next call of deflate. - This function can be useful when several compression strategies will be - tried, for example when there are several ways of pre-processing the input - data with a filter. The streams that will be discarded should then be freed - by calling deflateEnd. Note that deflateCopy duplicates the internal - compression state which can be quite large, so this strategy is slow and - can consume lots of memory. + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and + can consume lots of memory. - deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and - destination. + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being NULL). msg is left unchanged in both source and + destination. */ extern int EXPORT deflateReset OF((z_streamp strm)); /* - This function is equivalent to deflateEnd followed by deflateInit, - but does not free and reallocate all the internal compression state. - The stream will keep the same compression level and any other attributes - that may have been set by deflateInit2. + This function is equivalent to deflateEnd followed by deflateInit, + but does not free and reallocate all the internal compression state. + The stream will keep the same compression level and any other attributes + that may have been set by deflateInit2. - deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). */ extern int EXPORT deflateParams OF((z_streamp strm, int level, int strategy)); /* - Dynamically update the compression level and compression strategy. - This can be used to switch between compression and straight copy of - the input data, or to switch to a different kind of input data requiring - a different strategy. If the compression level is changed, the input - available so far is compressed with the old level (and may be flushed); - the new level will take effect only at the next call of deflate(). + Dynamically update the compression level and compression strategy. + This can be used to switch between compression and straight copy of + the input data, or to switch to a different kind of input data requiring + a different strategy. If the compression level is changed, the input + available so far is compressed with the old level (and may be flushed); + the new level will take effect only at the next call of deflate(). - Before the call of deflateParams, the stream state must be set as for - a call of deflate(), since the currently available input may have to - be compressed and flushed. In particular, strm->avail_out must be non-zero. + Before the call of deflateParams, the stream state must be set as for + a call of deflate(), since the currently available input may have to + be compressed and flushed. In particular, strm->avail_out must be non-zero. - deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source - stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR - if strm->avail_out was zero. + deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source + stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR + if strm->avail_out was zero. */ -/* +/* extern int EXPORT inflateInit2 OF((z_streamp strm, - int windowBits)); + int windowBits)); - This is another version of inflateInit with more compression options. The - fields next_out, zalloc, zfree and opaque must be initialized before by - the caller. + This is another version of inflateInit with more compression options. The + fields next_out, zalloc, zfree and opaque must be initialized before by + the caller. - The windowBits parameter is the base two logarithm of the maximum window - size (the size of the history buffer). It should be in the range 8..15 for - this version of the library (the value 16 will be allowed soon). The - default value is 15 if inflateInit is used instead. If a compressed stream - with a larger window size is given as input, inflate() will return with - the error code Z_DATA_ERROR instead of trying to allocate a larger window. + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library (the value 16 will be allowed soon). The + default value is 15 if inflateInit is used instead. If a compressed stream + with a larger window size is given as input, inflate() will return with + the error code Z_DATA_ERROR instead of trying to allocate a larger window. - If next_out is not null, the library will use this buffer for the history - buffer; the buffer must either be large enough to hold the entire output - data, or have at least 1< #else -#define IUnknown void +#define IUnknown void #define CO_E_NOTINITIALIZED 0x800401F0L #endif -#define _FACDD 0x876 -#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) +#define _FACDD 0x876 +#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) #ifdef __cplusplus extern "C" { @@ -28,16 +28,16 @@ extern "C" { * GUIDS used by DirectDraw objects */ #if defined( _WIN32 ) && !defined( _NO_COM ) -DEFINE_GUID( CLSID_DirectDraw, 0xD7B70EE0,0x4340,0x11CF,0xB0,0x63,0x00,0x20,0xAF,0xC2,0xCD,0x35 ); -DEFINE_GUID( CLSID_DirectDrawClipper, 0x593817A0,0x7DB3,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xb9,0x33,0x56 ); -DEFINE_GUID( IID_IDirectDraw, 0x6C14DB80,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); -DEFINE_GUID( IID_IDirectDraw2, 0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 ); -DEFINE_GUID( IID_IDirectDrawSurface, 0x6C14DB81,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); -DEFINE_GUID( IID_IDirectDrawSurface2, 0x57805885,0x6eec,0x11cf,0x94,0x41,0xa8,0x23,0x03,0xc1,0x0e,0x27 ); +DEFINE_GUID( CLSID_DirectDraw, 0xD7B70EE0,0x4340,0x11CF,0xB0,0x63,0x00,0x20,0xAF,0xC2,0xCD,0x35 ); +DEFINE_GUID( CLSID_DirectDrawClipper, 0x593817A0,0x7DB3,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xb9,0x33,0x56 ); +DEFINE_GUID( IID_IDirectDraw, 0x6C14DB80,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); +DEFINE_GUID( IID_IDirectDraw2, 0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 ); +DEFINE_GUID( IID_IDirectDrawSurface, 0x6C14DB81,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); +DEFINE_GUID( IID_IDirectDrawSurface2, 0x57805885,0x6eec,0x11cf,0x94,0x41,0xa8,0x23,0x03,0xc1,0x0e,0x27 ); -DEFINE_GUID( IID_IDirectDrawPalette, 0x6C14DB84,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); -DEFINE_GUID( IID_IDirectDrawClipper, 0x6C14DB85,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); - +DEFINE_GUID( IID_IDirectDrawPalette, 0x6C14DB84,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); +DEFINE_GUID( IID_IDirectDrawClipper, 0x6C14DB85,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); + #endif /*============================================================================ @@ -53,47 +53,47 @@ struct IDirectDrawSurface; struct IDirectDrawPalette; struct IDirectDrawClipper; -typedef struct IDirectDraw FAR *LPDIRECTDRAW; -typedef struct IDirectDraw2 FAR *LPDIRECTDRAW2; -typedef struct IDirectDrawSurface FAR *LPDIRECTDRAWSURFACE; -typedef struct IDirectDrawSurface2 FAR *LPDIRECTDRAWSURFACE2; +typedef struct IDirectDraw FAR *LPDIRECTDRAW; +typedef struct IDirectDraw2 FAR *LPDIRECTDRAW2; +typedef struct IDirectDrawSurface FAR *LPDIRECTDRAWSURFACE; +typedef struct IDirectDrawSurface2 FAR *LPDIRECTDRAWSURFACE2; -typedef struct IDirectDrawPalette FAR *LPDIRECTDRAWPALETTE; -typedef struct IDirectDrawClipper FAR *LPDIRECTDRAWCLIPPER; +typedef struct IDirectDrawPalette FAR *LPDIRECTDRAWPALETTE; +typedef struct IDirectDrawClipper FAR *LPDIRECTDRAWCLIPPER; -typedef struct _DDFXROP FAR *LPDDFXROP; -typedef struct _DDSURFACEDESC FAR *LPDDSURFACEDESC; +typedef struct _DDFXROP FAR *LPDDFXROP; +typedef struct _DDSURFACEDESC FAR *LPDDSURFACEDESC; /* * API's */ #if (defined (WIN32) || defined( _WIN32 ) ) && !defined( _NO_COM ) //#if defined( _WIN32 ) && !defined( _NO_ENUM ) - typedef BOOL (FAR PASCAL * LPDDENUMCALLBACKA)(GUID FAR *, LPSTR, LPSTR, LPVOID); - typedef BOOL (FAR PASCAL * LPDDENUMCALLBACKW)(GUID FAR *, LPWSTR, LPWSTR, LPVOID); - extern HRESULT WINAPI DirectDrawEnumerateW( LPDDENUMCALLBACKW lpCallback, LPVOID lpContext ); - extern HRESULT WINAPI DirectDrawEnumerateA( LPDDENUMCALLBACKA lpCallback, LPVOID lpContext ); - #ifdef UNICODE - typedef LPDDENUMCALLBACKW LPDDENUMCALLBACK; - #define DirectDrawEnumerate DirectDrawEnumerateW - #else - typedef LPDDENUMCALLBACKA LPDDENUMCALLBACK; - #define DirectDrawEnumerate DirectDrawEnumerateA - #endif - extern HRESULT WINAPI DirectDrawCreate( GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter ); - extern HRESULT WINAPI DirectDrawCreateClipper( DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter ); - #ifdef WINNT - //This is the user-mode entry stub to the kernel mode procedure. - extern HRESULT NtDirectDrawCreate( GUID FAR *lpGUID, HANDLE *lplpDD, IUnknown FAR *pUnkOuter ); - #endif + typedef BOOL (FAR PASCAL * LPDDENUMCALLBACKA)(GUID FAR *, LPSTR, LPSTR, LPVOID); + typedef BOOL (FAR PASCAL * LPDDENUMCALLBACKW)(GUID FAR *, LPWSTR, LPWSTR, LPVOID); + extern HRESULT WINAPI DirectDrawEnumerateW( LPDDENUMCALLBACKW lpCallback, LPVOID lpContext ); + extern HRESULT WINAPI DirectDrawEnumerateA( LPDDENUMCALLBACKA lpCallback, LPVOID lpContext ); + #ifdef UNICODE + typedef LPDDENUMCALLBACKW LPDDENUMCALLBACK; + #define DirectDrawEnumerate DirectDrawEnumerateW + #else + typedef LPDDENUMCALLBACKA LPDDENUMCALLBACK; + #define DirectDrawEnumerate DirectDrawEnumerateA + #endif + extern HRESULT WINAPI DirectDrawCreate( GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter ); + extern HRESULT WINAPI DirectDrawCreateClipper( DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter ); + #ifdef WINNT + //This is the user-mode entry stub to the kernel mode procedure. + extern HRESULT NtDirectDrawCreate( GUID FAR *lpGUID, HANDLE *lplpDD, IUnknown FAR *pUnkOuter ); + #endif #endif -#define REGSTR_KEY_DDHW_DESCRIPTION "Description" -#define REGSTR_KEY_DDHW_DRIVERNAME "DriverName" -#define REGSTR_PATH_DDHW "Hardware\\DirectDrawDrivers" +#define REGSTR_KEY_DDHW_DESCRIPTION "Description" +#define REGSTR_KEY_DDHW_DRIVERNAME "DriverName" +#define REGSTR_PATH_DDHW "Hardware\\DirectDrawDrivers" -#define DDCREATE_HARDWAREONLY 0x00000001l -#define DDCREATE_EMULATIONONLY 0x00000002l +#define DDCREATE_HARDWAREONLY 0x00000001l +#define DDCREATE_EMULATIONONLY 0x00000002l #ifdef WINNT typedef long HRESULT; @@ -108,10 +108,10 @@ typedef HRESULT (FAR PASCAL * LPDDENUMSURFACESCALLBACK)(LPDIRECTDRAWSURFACE, LPD */ typedef struct _DDCOLORKEY { - DWORD dwColorSpaceLowValue; // low boundary of color space that is to - // be treated as Color Key, inclusive - DWORD dwColorSpaceHighValue; // high boundary of color space that is - // to be treated as Color Key, inclusive + DWORD dwColorSpaceLowValue; // low boundary of color space that is to + // be treated as Color Key, inclusive + DWORD dwColorSpaceHighValue; // high boundary of color space that is + // to be treated as Color Key, inclusive } DDCOLORKEY; typedef DDCOLORKEY FAR* LPDDCOLORKEY; @@ -122,50 +122,50 @@ typedef DDCOLORKEY FAR* LPDDCOLORKEY; */ typedef struct _DDBLTFX { - DWORD dwSize; // size of structure - DWORD dwDDFX; // FX operations - DWORD dwROP; // Win32 raster operations - DWORD dwDDROP; // Raster operations new for DirectDraw - DWORD dwRotationAngle; // Rotation angle for blt - DWORD dwZBufferOpCode; // ZBuffer compares - DWORD dwZBufferLow; // Low limit of Z buffer - DWORD dwZBufferHigh; // High limit of Z buffer - DWORD dwZBufferBaseDest; // Destination base value - DWORD dwZDestConstBitDepth; // Bit depth used to specify Z constant for destination - union - { - DWORD dwZDestConst; // Constant to use as Z buffer for dest - LPDIRECTDRAWSURFACE lpDDSZBufferDest; // Surface to use as Z buffer for dest - }; - DWORD dwZSrcConstBitDepth; // Bit depth used to specify Z constant for source - union - { - DWORD dwZSrcConst; // Constant to use as Z buffer for src - LPDIRECTDRAWSURFACE lpDDSZBufferSrc; // Surface to use as Z buffer for src - }; - DWORD dwAlphaEdgeBlendBitDepth; // Bit depth used to specify constant for alpha edge blend - DWORD dwAlphaEdgeBlend; // Alpha for edge blending - DWORD dwReserved; - DWORD dwAlphaDestConstBitDepth; // Bit depth used to specify alpha constant for destination - union - { - DWORD dwAlphaDestConst; // Constant to use as Alpha Channel - LPDIRECTDRAWSURFACE lpDDSAlphaDest; // Surface to use as Alpha Channel - }; - DWORD dwAlphaSrcConstBitDepth; // Bit depth used to specify alpha constant for source - union - { - DWORD dwAlphaSrcConst; // Constant to use as Alpha Channel - LPDIRECTDRAWSURFACE lpDDSAlphaSrc; // Surface to use as Alpha Channel - }; - union - { - DWORD dwFillColor; // color in RGB or Palettized - DWORD dwFillDepth; // depth value for z-buffer - LPDIRECTDRAWSURFACE lpDDSPattern; // Surface to use as pattern - }; - DDCOLORKEY ddckDestColorkey; // DestColorkey override - DDCOLORKEY ddckSrcColorkey; // SrcColorkey override + DWORD dwSize; // size of structure + DWORD dwDDFX; // FX operations + DWORD dwROP; // Win32 raster operations + DWORD dwDDROP; // Raster operations new for DirectDraw + DWORD dwRotationAngle; // Rotation angle for blt + DWORD dwZBufferOpCode; // ZBuffer compares + DWORD dwZBufferLow; // Low limit of Z buffer + DWORD dwZBufferHigh; // High limit of Z buffer + DWORD dwZBufferBaseDest; // Destination base value + DWORD dwZDestConstBitDepth; // Bit depth used to specify Z constant for destination + union + { + DWORD dwZDestConst; // Constant to use as Z buffer for dest + LPDIRECTDRAWSURFACE lpDDSZBufferDest; // Surface to use as Z buffer for dest + }; + DWORD dwZSrcConstBitDepth; // Bit depth used to specify Z constant for source + union + { + DWORD dwZSrcConst; // Constant to use as Z buffer for src + LPDIRECTDRAWSURFACE lpDDSZBufferSrc; // Surface to use as Z buffer for src + }; + DWORD dwAlphaEdgeBlendBitDepth; // Bit depth used to specify constant for alpha edge blend + DWORD dwAlphaEdgeBlend; // Alpha for edge blending + DWORD dwReserved; + DWORD dwAlphaDestConstBitDepth; // Bit depth used to specify alpha constant for destination + union + { + DWORD dwAlphaDestConst; // Constant to use as Alpha Channel + LPDIRECTDRAWSURFACE lpDDSAlphaDest; // Surface to use as Alpha Channel + }; + DWORD dwAlphaSrcConstBitDepth; // Bit depth used to specify alpha constant for source + union + { + DWORD dwAlphaSrcConst; // Constant to use as Alpha Channel + LPDIRECTDRAWSURFACE lpDDSAlphaSrc; // Surface to use as Alpha Channel + }; + union + { + DWORD dwFillColor; // color in RGB or Palettized + DWORD dwFillDepth; // depth value for z-buffer + LPDIRECTDRAWSURFACE lpDDSPattern; // Surface to use as pattern + }; + DDCOLORKEY ddckDestColorkey; // DestColorkey override + DDCOLORKEY ddckSrcColorkey; // SrcColorkey override } DDBLTFX; typedef DDBLTFX FAR* LPDDBLTFX; @@ -176,7 +176,7 @@ typedef DDBLTFX FAR* LPDDBLTFX; */ typedef struct _DDSCAPS { - DWORD dwCaps; // capabilities of surface wanted + DWORD dwCaps; // capabilities of surface wanted } DDSCAPS; typedef DDSCAPS FAR* LPDDSCAPS; @@ -184,61 +184,61 @@ typedef DDSCAPS FAR* LPDDSCAPS; /* * DDCAPS */ -#define DD_ROP_SPACE (256/32) // space required to store ROP array +#define DD_ROP_SPACE (256/32) // space required to store ROP array typedef struct _DDCAPS { - DWORD dwSize; // size of the DDDRIVERCAPS structure - DWORD dwCaps; // driver specific capabilities - DWORD dwCaps2; // more driver specific capabilites - DWORD dwCKeyCaps; // color key capabilities of the surface - DWORD dwFXCaps; // driver specific stretching and effects capabilites - DWORD dwFXAlphaCaps; // alpha driver specific capabilities - DWORD dwPalCaps; // palette capabilities - DWORD dwSVCaps; // stereo vision capabilities - DWORD dwAlphaBltConstBitDepths; // DDBD_2,4,8 - DWORD dwAlphaBltPixelBitDepths; // DDBD_1,2,4,8 - DWORD dwAlphaBltSurfaceBitDepths; // DDBD_1,2,4,8 - DWORD dwAlphaOverlayConstBitDepths; // DDBD_2,4,8 - DWORD dwAlphaOverlayPixelBitDepths; // DDBD_1,2,4,8 - DWORD dwAlphaOverlaySurfaceBitDepths; // DDBD_1,2,4,8 - DWORD dwZBufferBitDepths; // DDBD_8,16,24,32 - DWORD dwVidMemTotal; // total amount of video memory - DWORD dwVidMemFree; // amount of free video memory - DWORD dwMaxVisibleOverlays; // maximum number of visible overlays - DWORD dwCurrVisibleOverlays; // current number of visible overlays - DWORD dwNumFourCCCodes; // number of four cc codes - DWORD dwAlignBoundarySrc; // source rectangle alignment - DWORD dwAlignSizeSrc; // source rectangle byte size - DWORD dwAlignBoundaryDest; // dest rectangle alignment - DWORD dwAlignSizeDest; // dest rectangle byte size - DWORD dwAlignStrideAlign; // stride alignment - DWORD dwRops[DD_ROP_SPACE]; // ROPS supported - DDSCAPS ddsCaps; // DDSCAPS structure has all the general capabilities - DWORD dwMinOverlayStretch; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 - DWORD dwMaxOverlayStretch; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 - DWORD dwMinLiveVideoStretch; // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 - DWORD dwMaxLiveVideoStretch; // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 - DWORD dwMinHwCodecStretch; // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 - DWORD dwMaxHwCodecStretch; // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 - DWORD dwReserved1; // reserved - DWORD dwReserved2; // reserved - DWORD dwReserved3; // reserved - DWORD dwSVBCaps; // driver specific capabilities for System->Vmem blts - DWORD dwSVBCKeyCaps; // driver color key capabilities for System->Vmem blts - DWORD dwSVBFXCaps; // driver FX capabilities for System->Vmem blts - DWORD dwSVBRops[DD_ROP_SPACE];// ROPS supported for System->Vmem blts - DWORD dwVSBCaps; // driver specific capabilities for Vmem->System blts - DWORD dwVSBCKeyCaps; // driver color key capabilities for Vmem->System blts - DWORD dwVSBFXCaps; // driver FX capabilities for Vmem->System blts - DWORD dwVSBRops[DD_ROP_SPACE];// ROPS supported for Vmem->System blts - DWORD dwSSBCaps; // driver specific capabilities for System->System blts - DWORD dwSSBCKeyCaps; // driver color key capabilities for System->System blts - DWORD dwSSBFXCaps; // driver FX capabilities for System->System blts - DWORD dwSSBRops[DD_ROP_SPACE];// ROPS supported for System->System blts - DWORD dwReserved4; // reserved - DWORD dwReserved5; // reserved - DWORD dwReserved6; // reserved + DWORD dwSize; // size of the DDDRIVERCAPS structure + DWORD dwCaps; // driver specific capabilities + DWORD dwCaps2; // more driver specific capabilites + DWORD dwCKeyCaps; // color key capabilities of the surface + DWORD dwFXCaps; // driver specific stretching and effects capabilites + DWORD dwFXAlphaCaps; // alpha driver specific capabilities + DWORD dwPalCaps; // palette capabilities + DWORD dwSVCaps; // stereo vision capabilities + DWORD dwAlphaBltConstBitDepths; // DDBD_2,4,8 + DWORD dwAlphaBltPixelBitDepths; // DDBD_1,2,4,8 + DWORD dwAlphaBltSurfaceBitDepths; // DDBD_1,2,4,8 + DWORD dwAlphaOverlayConstBitDepths; // DDBD_2,4,8 + DWORD dwAlphaOverlayPixelBitDepths; // DDBD_1,2,4,8 + DWORD dwAlphaOverlaySurfaceBitDepths; // DDBD_1,2,4,8 + DWORD dwZBufferBitDepths; // DDBD_8,16,24,32 + DWORD dwVidMemTotal; // total amount of video memory + DWORD dwVidMemFree; // amount of free video memory + DWORD dwMaxVisibleOverlays; // maximum number of visible overlays + DWORD dwCurrVisibleOverlays; // current number of visible overlays + DWORD dwNumFourCCCodes; // number of four cc codes + DWORD dwAlignBoundarySrc; // source rectangle alignment + DWORD dwAlignSizeSrc; // source rectangle byte size + DWORD dwAlignBoundaryDest; // dest rectangle alignment + DWORD dwAlignSizeDest; // dest rectangle byte size + DWORD dwAlignStrideAlign; // stride alignment + DWORD dwRops[DD_ROP_SPACE]; // ROPS supported + DDSCAPS ddsCaps; // DDSCAPS structure has all the general capabilities + DWORD dwMinOverlayStretch; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMaxOverlayStretch; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMinLiveVideoStretch; // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMaxLiveVideoStretch; // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMinHwCodecStretch; // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMaxHwCodecStretch; // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwReserved1; // reserved + DWORD dwReserved2; // reserved + DWORD dwReserved3; // reserved + DWORD dwSVBCaps; // driver specific capabilities for System->Vmem blts + DWORD dwSVBCKeyCaps; // driver color key capabilities for System->Vmem blts + DWORD dwSVBFXCaps; // driver FX capabilities for System->Vmem blts + DWORD dwSVBRops[DD_ROP_SPACE];// ROPS supported for System->Vmem blts + DWORD dwVSBCaps; // driver specific capabilities for Vmem->System blts + DWORD dwVSBCKeyCaps; // driver color key capabilities for Vmem->System blts + DWORD dwVSBFXCaps; // driver FX capabilities for Vmem->System blts + DWORD dwVSBRops[DD_ROP_SPACE];// ROPS supported for Vmem->System blts + DWORD dwSSBCaps; // driver specific capabilities for System->System blts + DWORD dwSSBCKeyCaps; // driver color key capabilities for System->System blts + DWORD dwSSBFXCaps; // driver FX capabilities for System->System blts + DWORD dwSSBRops[DD_ROP_SPACE];// ROPS supported for System->System blts + DWORD dwReserved4; // reserved + DWORD dwReserved5; // reserved + DWORD dwReserved6; // reserved } DDCAPS; typedef DDCAPS FAR* LPDDCAPS; @@ -250,36 +250,36 @@ typedef DDCAPS FAR* LPDDCAPS; */ typedef struct _DDPIXELFORMAT { - DWORD dwSize; // size of structure - DWORD dwFlags; // pixel format flags - DWORD dwFourCC; // (FOURCC code) - union - { - DWORD dwRGBBitCount; // how many bits per pixel - DWORD dwYUVBitCount; // how many bits per pixel - DWORD dwZBufferBitDepth; // how many bits for z buffers - DWORD dwAlphaBitDepth; // how many bits for alpha channels - }; - union - { - DWORD dwRBitMask; // mask for red bit - DWORD dwYBitMask; // mask for Y bits - }; - union - { - DWORD dwGBitMask; // mask for green bits - DWORD dwUBitMask; // mask for U bits - }; - union - { - DWORD dwBBitMask; // mask for blue bits - DWORD dwVBitMask; // mask for V bits - }; - union - { - DWORD dwRGBAlphaBitMask; // mask for alpha channel - DWORD dwYUVAlphaBitMask; // mask for alpha channel - }; + DWORD dwSize; // size of structure + DWORD dwFlags; // pixel format flags + DWORD dwFourCC; // (FOURCC code) + union + { + DWORD dwRGBBitCount; // how many bits per pixel + DWORD dwYUVBitCount; // how many bits per pixel + DWORD dwZBufferBitDepth; // how many bits for z buffers + DWORD dwAlphaBitDepth; // how many bits for alpha channels + }; + union + { + DWORD dwRBitMask; // mask for red bit + DWORD dwYBitMask; // mask for Y bits + }; + union + { + DWORD dwGBitMask; // mask for green bits + DWORD dwUBitMask; // mask for U bits + }; + union + { + DWORD dwBBitMask; // mask for blue bits + DWORD dwVBitMask; // mask for V bits + }; + union + { + DWORD dwRGBAlphaBitMask; // mask for alpha channel + DWORD dwYUVAlphaBitMask; // mask for alpha channel + }; } DDPIXELFORMAT; typedef DDPIXELFORMAT FAR* LPDDPIXELFORMAT; @@ -289,26 +289,26 @@ typedef DDPIXELFORMAT FAR* LPDDPIXELFORMAT; */ typedef struct _DDOVERLAYFX { - DWORD dwSize; // size of structure - DWORD dwAlphaEdgeBlendBitDepth; // Bit depth used to specify constant for alpha edge blend - DWORD dwAlphaEdgeBlend; // Constant to use as alpha for edge blend - DWORD dwReserved; - DWORD dwAlphaDestConstBitDepth; // Bit depth used to specify alpha constant for destination - union - { - DWORD dwAlphaDestConst; // Constant to use as alpha channel for dest - LPDIRECTDRAWSURFACE lpDDSAlphaDest; // Surface to use as alpha channel for dest - }; - DWORD dwAlphaSrcConstBitDepth; // Bit depth used to specify alpha constant for source - union - { - DWORD dwAlphaSrcConst; // Constant to use as alpha channel for src - LPDIRECTDRAWSURFACE lpDDSAlphaSrc; // Surface to use as alpha channel for src - }; - DDCOLORKEY dckDestColorkey; // DestColorkey override - DDCOLORKEY dckSrcColorkey; // DestColorkey override - DWORD dwDDFX; // Overlay FX - DWORD dwFlags; // flags + DWORD dwSize; // size of structure + DWORD dwAlphaEdgeBlendBitDepth; // Bit depth used to specify constant for alpha edge blend + DWORD dwAlphaEdgeBlend; // Constant to use as alpha for edge blend + DWORD dwReserved; + DWORD dwAlphaDestConstBitDepth; // Bit depth used to specify alpha constant for destination + union + { + DWORD dwAlphaDestConst; // Constant to use as alpha channel for dest + LPDIRECTDRAWSURFACE lpDDSAlphaDest; // Surface to use as alpha channel for dest + }; + DWORD dwAlphaSrcConstBitDepth; // Bit depth used to specify alpha constant for source + union + { + DWORD dwAlphaSrcConst; // Constant to use as alpha channel for src + LPDIRECTDRAWSURFACE lpDDSAlphaSrc; // Surface to use as alpha channel for src + }; + DDCOLORKEY dckDestColorkey; // DestColorkey override + DDCOLORKEY dckSrcColorkey; // DestColorkey override + DWORD dwDDFX; // Overlay FX + DWORD dwFlags; // flags } DDOVERLAYFX; typedef DDOVERLAYFX FAR *LPDDOVERLAYFX; @@ -318,11 +318,11 @@ typedef DDOVERLAYFX FAR *LPDDOVERLAYFX; */ typedef struct _DDBLTBATCH { - LPRECT lprDest; - LPDIRECTDRAWSURFACE lpDDSSrc; - LPRECT lprSrc; - DWORD dwFlags; - LPDDBLTFX lpDDBltFx; + LPRECT lprDest; + LPDIRECTDRAWSURFACE lpDDSSrc; + LPRECT lprSrc; + DWORD dwFlags; + LPDDBLTFX lpDDBltFx; } DDBLTBATCH; typedef DDBLTBATCH FAR * LPDDBLTBATCH; @@ -330,18 +330,18 @@ typedef DDBLTBATCH FAR * LPDDBLTBATCH; /* * callbacks */ -typedef DWORD (FAR PASCAL *LPCLIPPERCALLBACK)(LPDIRECTDRAWCLIPPER lpDDClipper, HWND hWnd, DWORD code, LPVOID lpContext ); +typedef DWORD (FAR PASCAL *LPCLIPPERCALLBACK)(LPDIRECTDRAWCLIPPER lpDDClipper, HWND hWnd, DWORD code, LPVOID lpContext ); #ifdef STREAMING -typedef DWORD (FAR PASCAL *LPSURFACESTREAMINGCALLBACK)(DWORD); +typedef DWORD (FAR PASCAL *LPSURFACESTREAMINGCALLBACK)(DWORD); #endif /* * INTERACES FOLLOW: - * IDirectDraw - * IDirectDrawClipper - * IDirectDrawPalette - * IDirectDrawSurface + * IDirectDraw + * IDirectDrawClipper + * IDirectDrawPalette + * IDirectDrawSurface */ /* @@ -352,57 +352,57 @@ typedef DWORD (FAR PASCAL *LPSURFACESTREAMINGCALLBACK)(DWORD); #define INTERFACE IDirectDraw DECLARE_INTERFACE_( IDirectDraw, IUnknown ) { - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - STDMETHOD_(ULONG,Release) (THIS) PURE; - /*** IDirectDraw methods ***/ - STDMETHOD(Compact)(THIS) PURE; - STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE; - STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE; - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE; - STDMETHOD(DuplicateSurface)( THIS_ LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE FAR * ) PURE; - STDMETHOD(EnumDisplayModes)( THIS_ DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK ) PURE; - STDMETHOD(EnumSurfaces)(THIS_ DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK ) PURE; - STDMETHOD(FlipToGDISurface)(THIS) PURE; - STDMETHOD(GetCaps)( THIS_ LPDDCAPS, LPDDCAPS) PURE; - STDMETHOD(GetDisplayMode)( THIS_ LPDDSURFACEDESC) PURE; - STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD, LPDWORD ) PURE; - STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE FAR *) PURE; - STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD) PURE; - STDMETHOD(GetScanLine)(THIS_ LPDWORD) PURE; - STDMETHOD(GetVerticalBlankStatus)(THIS_ LPBOOL ) PURE; - STDMETHOD(Initialize)(THIS_ GUID FAR *) PURE; - STDMETHOD(RestoreDisplayMode)(THIS) PURE; - STDMETHOD(SetCooperativeLevel)(THIS_ HWND, DWORD) PURE; - STDMETHOD(SetDisplayMode)(THIS_ DWORD, DWORD,DWORD) PURE; - STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD, HANDLE ) PURE; + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDraw methods ***/ + STDMETHOD(Compact)(THIS) PURE; + STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE; + STDMETHOD(DuplicateSurface)( THIS_ LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE FAR * ) PURE; + STDMETHOD(EnumDisplayModes)( THIS_ DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK ) PURE; + STDMETHOD(EnumSurfaces)(THIS_ DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK ) PURE; + STDMETHOD(FlipToGDISurface)(THIS) PURE; + STDMETHOD(GetCaps)( THIS_ LPDDCAPS, LPDDCAPS) PURE; + STDMETHOD(GetDisplayMode)( THIS_ LPDDSURFACEDESC) PURE; + STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD, LPDWORD ) PURE; + STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE FAR *) PURE; + STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD) PURE; + STDMETHOD(GetScanLine)(THIS_ LPDWORD) PURE; + STDMETHOD(GetVerticalBlankStatus)(THIS_ LPBOOL ) PURE; + STDMETHOD(Initialize)(THIS_ GUID FAR *) PURE; + STDMETHOD(RestoreDisplayMode)(THIS) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND, DWORD) PURE; + STDMETHOD(SetDisplayMode)(THIS_ DWORD, DWORD,DWORD) PURE; + STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD, HANDLE ) PURE; }; #if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirectDraw_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) -#define IDirectDraw_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirectDraw_Release(p) (p)->lpVtbl->Release(p) -#define IDirectDraw_Compact(p) (p)->lpVtbl->Compact(p) -#define IDirectDraw_CreateClipper(p, a, b, c) (p)->lpVtbl->CreateClipper(p, a, b, c) -#define IDirectDraw_CreatePalette(p, a, b, c, d) (p)->lpVtbl->CreatePalette(p, a, b, c, d) -#define IDirectDraw_CreateSurface(p, a, b, c) (p)->lpVtbl->CreateSurface(p, a, b, c) -#define IDirectDraw_DuplicateSurface(p, a, b) (p)->lpVtbl->DuplicateSurface(p, a, b) +#define IDirectDraw_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDraw_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDraw_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDraw_Compact(p) (p)->lpVtbl->Compact(p) +#define IDirectDraw_CreateClipper(p, a, b, c) (p)->lpVtbl->CreateClipper(p, a, b, c) +#define IDirectDraw_CreatePalette(p, a, b, c, d) (p)->lpVtbl->CreatePalette(p, a, b, c, d) +#define IDirectDraw_CreateSurface(p, a, b, c) (p)->lpVtbl->CreateSurface(p, a, b, c) +#define IDirectDraw_DuplicateSurface(p, a, b) (p)->lpVtbl->DuplicateSurface(p, a, b) #define IDirectDraw_EnumDisplayModes(p, a, b, c, d) (p)->lpVtbl->EnumDisplayModes(p, a, b, c, d) -#define IDirectDraw_EnumSurfaces(p, a, b, c, d) (p)->lpVtbl->EnumSurfaces(p, a, b, c, d) -#define IDirectDraw_FlipToGDISurface(p) (p)->lpVtbl->FlipToGDISurface(p) -#define IDirectDraw_GetCaps(p, a, b) (p)->lpVtbl->GetCaps(p, a, b) -#define IDirectDraw_GetDisplayMode(p, a) (p)->lpVtbl->GetDisplayMode(p, a) -#define IDirectDraw_GetFourCCCodes(p, a, b) (p)->lpVtbl->GetFourCCCodes(p, a, b) -#define IDirectDraw_GetGDISurface(p, a) (p)->lpVtbl->GetGDISurface(p, a) -#define IDirectDraw_GetMonitorFrequency(p, a) (p)->lpVtbl->GetMonitorFrequency(p, a) -#define IDirectDraw_GetScanLine(p, a) (p)->lpVtbl->GetScanLine(p, a) -#define IDirectDraw_GetVerticalBlankStatus(p, a) (p)->lpVtbl->GetVerticalBlankStatus(p, a) -#define IDirectDraw_Initialize(p, a) (p)->lpVtbl->Initialize(p, a) -#define IDirectDraw_RestoreDisplayMode(p) (p)->lpVtbl->RestoreDisplayMode(p) -#define IDirectDraw_SetCooperativeLevel(p, a, b) (p)->lpVtbl->SetCooperativeLevel(p, a, b) -#define IDirectDraw_SetDisplayMode(p, a, b, c) (p)->lpVtbl->SetDisplayMode(p, a, b, c) -#define IDirectDraw_WaitForVerticalBlank(p, a, b) (p)->lpVtbl->WaitForVerticalBlank(p, a, b) +#define IDirectDraw_EnumSurfaces(p, a, b, c, d) (p)->lpVtbl->EnumSurfaces(p, a, b, c, d) +#define IDirectDraw_FlipToGDISurface(p) (p)->lpVtbl->FlipToGDISurface(p) +#define IDirectDraw_GetCaps(p, a, b) (p)->lpVtbl->GetCaps(p, a, b) +#define IDirectDraw_GetDisplayMode(p, a) (p)->lpVtbl->GetDisplayMode(p, a) +#define IDirectDraw_GetFourCCCodes(p, a, b) (p)->lpVtbl->GetFourCCCodes(p, a, b) +#define IDirectDraw_GetGDISurface(p, a) (p)->lpVtbl->GetGDISurface(p, a) +#define IDirectDraw_GetMonitorFrequency(p, a) (p)->lpVtbl->GetMonitorFrequency(p, a) +#define IDirectDraw_GetScanLine(p, a) (p)->lpVtbl->GetScanLine(p, a) +#define IDirectDraw_GetVerticalBlankStatus(p, a) (p)->lpVtbl->GetVerticalBlankStatus(p, a) +#define IDirectDraw_Initialize(p, a) (p)->lpVtbl->Initialize(p, a) +#define IDirectDraw_RestoreDisplayMode(p) (p)->lpVtbl->RestoreDisplayMode(p) +#define IDirectDraw_SetCooperativeLevel(p, a, b) (p)->lpVtbl->SetCooperativeLevel(p, a, b) +#define IDirectDraw_SetDisplayMode(p, a, b, c) (p)->lpVtbl->SetDisplayMode(p, a, b, c) +#define IDirectDraw_WaitForVerticalBlank(p, a, b) (p)->lpVtbl->WaitForVerticalBlank(p, a, b) #endif #endif @@ -412,59 +412,59 @@ DECLARE_INTERFACE_( IDirectDraw, IUnknown ) #define INTERFACE IDirectDraw2 DECLARE_INTERFACE_( IDirectDraw2, IUnknown ) { - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - STDMETHOD_(ULONG,Release) (THIS) PURE; - /*** IDirectDraw methods ***/ - STDMETHOD(Compact)(THIS) PURE; - STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE; - STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE; - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE; - STDMETHOD(DuplicateSurface)( THIS_ LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE FAR * ) PURE; - STDMETHOD(EnumDisplayModes)( THIS_ DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK ) PURE; - STDMETHOD(EnumSurfaces)(THIS_ DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK ) PURE; - STDMETHOD(FlipToGDISurface)(THIS) PURE; - STDMETHOD(GetCaps)( THIS_ LPDDCAPS, LPDDCAPS) PURE; - STDMETHOD(GetDisplayMode)( THIS_ LPDDSURFACEDESC) PURE; - STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD, LPDWORD ) PURE; - STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE FAR *) PURE; - STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD) PURE; - STDMETHOD(GetScanLine)(THIS_ LPDWORD) PURE; - STDMETHOD(GetVerticalBlankStatus)(THIS_ LPBOOL ) PURE; - STDMETHOD(Initialize)(THIS_ GUID FAR *) PURE; - STDMETHOD(RestoreDisplayMode)(THIS) PURE; - STDMETHOD(SetCooperativeLevel)(THIS_ HWND, DWORD) PURE; - STDMETHOD(SetDisplayMode)(THIS_ DWORD, DWORD,DWORD, DWORD, DWORD) PURE; - STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD, HANDLE ) PURE; - /*** Added in the v2 interface ***/ - STDMETHOD(GetAvailableVidMem)(THIS_ LPDDSCAPS, LPDWORD, LPDWORD) PURE; + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDraw methods ***/ + STDMETHOD(Compact)(THIS) PURE; + STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE; + STDMETHOD(DuplicateSurface)( THIS_ LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE FAR * ) PURE; + STDMETHOD(EnumDisplayModes)( THIS_ DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK ) PURE; + STDMETHOD(EnumSurfaces)(THIS_ DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK ) PURE; + STDMETHOD(FlipToGDISurface)(THIS) PURE; + STDMETHOD(GetCaps)( THIS_ LPDDCAPS, LPDDCAPS) PURE; + STDMETHOD(GetDisplayMode)( THIS_ LPDDSURFACEDESC) PURE; + STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD, LPDWORD ) PURE; + STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE FAR *) PURE; + STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD) PURE; + STDMETHOD(GetScanLine)(THIS_ LPDWORD) PURE; + STDMETHOD(GetVerticalBlankStatus)(THIS_ LPBOOL ) PURE; + STDMETHOD(Initialize)(THIS_ GUID FAR *) PURE; + STDMETHOD(RestoreDisplayMode)(THIS) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND, DWORD) PURE; + STDMETHOD(SetDisplayMode)(THIS_ DWORD, DWORD,DWORD, DWORD, DWORD) PURE; + STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD, HANDLE ) PURE; + /*** Added in the v2 interface ***/ + STDMETHOD(GetAvailableVidMem)(THIS_ LPDDSCAPS, LPDWORD, LPDWORD) PURE; }; #if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirectDraw2_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) -#define IDirectDraw2_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirectDraw2_Release(p) (p)->lpVtbl->Release(p) -#define IDirectDraw2_Compact(p) (p)->lpVtbl->Compact(p) -#define IDirectDraw2_CreateClipper(p, a, b, c) (p)->lpVtbl->CreateClipper(p, a, b, c) -#define IDirectDraw2_CreatePalette(p, a, b, c, d) (p)->lpVtbl->CreatePalette(p, a, b, c, d) -#define IDirectDraw2_CreateSurface(p, a, b, c) (p)->lpVtbl->CreateSurface(p, a, b, c) -#define IDirectDraw2_DuplicateSurface(p, a, b) (p)->lpVtbl->DuplicateSurface(p, a, b) +#define IDirectDraw2_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDraw2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDraw2_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDraw2_Compact(p) (p)->lpVtbl->Compact(p) +#define IDirectDraw2_CreateClipper(p, a, b, c) (p)->lpVtbl->CreateClipper(p, a, b, c) +#define IDirectDraw2_CreatePalette(p, a, b, c, d) (p)->lpVtbl->CreatePalette(p, a, b, c, d) +#define IDirectDraw2_CreateSurface(p, a, b, c) (p)->lpVtbl->CreateSurface(p, a, b, c) +#define IDirectDraw2_DuplicateSurface(p, a, b) (p)->lpVtbl->DuplicateSurface(p, a, b) #define IDirectDraw2_EnumDisplayModes(p, a, b, c, d) (p)->lpVtbl->EnumDisplayModes(p, a, b, c, d) -#define IDirectDraw2_EnumSurfaces(p, a, b, c, d) (p)->lpVtbl->EnumSurfaces(p, a, b, c, d) -#define IDirectDraw2_FlipToGDISurface(p) (p)->lpVtbl->FlipToGDISurface(p) -#define IDirectDraw2_GetCaps(p, a, b) (p)->lpVtbl->GetCaps(p, a, b) -#define IDirectDraw2_GetDisplayMode(p, a) (p)->lpVtbl->GetDisplayMode(p, a) -#define IDirectDraw2_GetFourCCCodes(p, a, b) (p)->lpVtbl->GetFourCCCodes(p, a, b) -#define IDirectDraw2_GetGDISurface(p, a) (p)->lpVtbl->GetGDISurface(p, a) -#define IDirectDraw2_GetMonitorFrequency(p, a) (p)->lpVtbl->GetMonitorFrequency(p, a) -#define IDirectDraw2_GetScanLine(p, a) (p)->lpVtbl->GetScanLine(p, a) -#define IDirectDraw2_GetVerticalBlankStatus(p, a) (p)->lpVtbl->GetVerticalBlankStatus(p, a) -#define IDirectDraw2_Initialize(p, a) (p)->lpVtbl->Initialize(p, a) -#define IDirectDraw2_RestoreDisplayMode(p) (p)->lpVtbl->RestoreDisplayMode(p) -#define IDirectDraw2_SetCooperativeLevel(p, a, b) (p)->lpVtbl->SetCooperativeLevel(p, a, b) +#define IDirectDraw2_EnumSurfaces(p, a, b, c, d) (p)->lpVtbl->EnumSurfaces(p, a, b, c, d) +#define IDirectDraw2_FlipToGDISurface(p) (p)->lpVtbl->FlipToGDISurface(p) +#define IDirectDraw2_GetCaps(p, a, b) (p)->lpVtbl->GetCaps(p, a, b) +#define IDirectDraw2_GetDisplayMode(p, a) (p)->lpVtbl->GetDisplayMode(p, a) +#define IDirectDraw2_GetFourCCCodes(p, a, b) (p)->lpVtbl->GetFourCCCodes(p, a, b) +#define IDirectDraw2_GetGDISurface(p, a) (p)->lpVtbl->GetGDISurface(p, a) +#define IDirectDraw2_GetMonitorFrequency(p, a) (p)->lpVtbl->GetMonitorFrequency(p, a) +#define IDirectDraw2_GetScanLine(p, a) (p)->lpVtbl->GetScanLine(p, a) +#define IDirectDraw2_GetVerticalBlankStatus(p, a) (p)->lpVtbl->GetVerticalBlankStatus(p, a) +#define IDirectDraw2_Initialize(p, a) (p)->lpVtbl->Initialize(p, a) +#define IDirectDraw2_RestoreDisplayMode(p) (p)->lpVtbl->RestoreDisplayMode(p) +#define IDirectDraw2_SetCooperativeLevel(p, a, b) (p)->lpVtbl->SetCooperativeLevel(p, a, b) #define IDirectDraw2_SetDisplayMode(p, a, b, c, d, e) (p)->lpVtbl->SetDisplayMode(p, a, b, c, d, e) -#define IDirectDraw2_WaitForVerticalBlank(p, a, b) (p)->lpVtbl->WaitForVerticalBlank(p, a, b) -#define IDirectDraw2_GetAvailableVidMem(p, a, b, c) (p)->lpVtbl->GetAvailableVidMem(p, a, b, c) +#define IDirectDraw2_WaitForVerticalBlank(p, a, b) (p)->lpVtbl->WaitForVerticalBlank(p, a, b) +#define IDirectDraw2_GetAvailableVidMem(p, a, b, c) (p)->lpVtbl->GetAvailableVidMem(p, a, b, c) #endif #endif @@ -477,25 +477,25 @@ DECLARE_INTERFACE_( IDirectDraw2, IUnknown ) #define INTERFACE IDirectDrawPalette DECLARE_INTERFACE_( IDirectDrawPalette, IUnknown ) { - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - STDMETHOD_(ULONG,Release) (THIS) PURE; - /*** IDirectDrawPalette methods ***/ - STDMETHOD(GetCaps)(THIS_ LPDWORD) PURE; - STDMETHOD(GetEntries)(THIS_ DWORD,DWORD,DWORD,LPPALETTEENTRY) PURE; - STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, DWORD, LPPALETTEENTRY) PURE; - STDMETHOD(SetEntries)(THIS_ DWORD,DWORD,DWORD,LPPALETTEENTRY) PURE; + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawPalette methods ***/ + STDMETHOD(GetCaps)(THIS_ LPDWORD) PURE; + STDMETHOD(GetEntries)(THIS_ DWORD,DWORD,DWORD,LPPALETTEENTRY) PURE; + STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, DWORD, LPPALETTEENTRY) PURE; + STDMETHOD(SetEntries)(THIS_ DWORD,DWORD,DWORD,LPPALETTEENTRY) PURE; }; #if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirectDrawPalette_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) -#define IDirectDrawPalette_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirectDrawPalette_Release(p) (p)->lpVtbl->Release(p) -#define IDirectDrawPalette_GetCaps(p, a) (p)->lpVtbl->GetCaps(p, a) -#define IDirectDrawPalette_GetEntries(p, a, b, c, d) (p)->lpVtbl->GetEntries(p, a, b, c, d) -#define IDirectDrawPalette_Initialize(p, a, b, c) (p)->lpVtbl->Initialize(p, a, b, c) -#define IDirectDrawPalette_SetEntries(p, a, b, c, d) (p)->lpVtbl->SetEntries(p, a, b, c, d) +#define IDirectDrawPalette_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDrawPalette_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawPalette_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawPalette_GetCaps(p, a) (p)->lpVtbl->GetCaps(p, a) +#define IDirectDrawPalette_GetEntries(p, a, b, c, d) (p)->lpVtbl->GetEntries(p, a, b, c, d) +#define IDirectDrawPalette_Initialize(p, a, b, c) (p)->lpVtbl->Initialize(p, a, b, c) +#define IDirectDrawPalette_SetEntries(p, a, b, c, d) (p)->lpVtbl->SetEntries(p, a, b, c, d) #endif #endif @@ -508,29 +508,29 @@ DECLARE_INTERFACE_( IDirectDrawPalette, IUnknown ) #define INTERFACE IDirectDrawClipper DECLARE_INTERFACE_( IDirectDrawClipper, IUnknown ) { - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - STDMETHOD_(ULONG,Release) (THIS) PURE; - /*** IDirectDrawClipper methods ***/ - STDMETHOD(GetClipList)(THIS_ LPRECT, LPRGNDATA, LPDWORD) PURE; - STDMETHOD(GetHWnd)(THIS_ HWND FAR *) PURE; - STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, DWORD) PURE; - STDMETHOD(IsClipListChanged)(THIS_ BOOL FAR *) PURE; - STDMETHOD(SetClipList)(THIS_ LPRGNDATA,DWORD) PURE; - STDMETHOD(SetHWnd)(THIS_ DWORD, HWND ) PURE; + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawClipper methods ***/ + STDMETHOD(GetClipList)(THIS_ LPRECT, LPRGNDATA, LPDWORD) PURE; + STDMETHOD(GetHWnd)(THIS_ HWND FAR *) PURE; + STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, DWORD) PURE; + STDMETHOD(IsClipListChanged)(THIS_ BOOL FAR *) PURE; + STDMETHOD(SetClipList)(THIS_ LPRGNDATA,DWORD) PURE; + STDMETHOD(SetHWnd)(THIS_ DWORD, HWND ) PURE; }; #if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirectDrawClipper_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) -#define IDirectDrawClipper_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirectDrawClipper_Release(p) (p)->lpVtbl->Release(p) -#define IDirectDrawClipper_GetClipList(p, a, b, c) (p)->lpVtbl->GetClipList(p, a, b, c) -#define IDirectDrawClipper_GetHWnd(p, a) (p)->lpVtbl->GetHWnd(p, a) -#define IDirectDrawClipper_Initialize(p, a, b) (p)->lpVtbl->Initialize(p, a, b) -#define IDirectDrawClipper_IsClipListChanged(p, a) (p)->lpVtbl->IsClipListChanged(p, a) -#define IDirectDrawClipper_SetClipList(p, a, b) (p)->lpVtbl->SetClipList(p, a, b) -#define IDirectDrawClipper_SetHWnd(p, a, b) (p)->lpVtbl->SetHWnd(p, a, b) +#define IDirectDrawClipper_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDrawClipper_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawClipper_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawClipper_GetClipList(p, a, b, c) (p)->lpVtbl->GetClipList(p, a, b, c) +#define IDirectDrawClipper_GetHWnd(p, a) (p)->lpVtbl->GetHWnd(p, a) +#define IDirectDrawClipper_Initialize(p, a, b) (p)->lpVtbl->Initialize(p, a, b) +#define IDirectDrawClipper_IsClipListChanged(p, a) (p)->lpVtbl->IsClipListChanged(p, a) +#define IDirectDrawClipper_SetClipList(p, a, b) (p)->lpVtbl->SetClipList(p, a, b) +#define IDirectDrawClipper_SetHWnd(p, a, b) (p)->lpVtbl->SetHWnd(p, a, b) #endif #endif @@ -543,83 +543,83 @@ DECLARE_INTERFACE_( IDirectDrawClipper, IUnknown ) #define INTERFACE IDirectDrawSurface DECLARE_INTERFACE_( IDirectDrawSurface, IUnknown ) { - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - STDMETHOD_(ULONG,Release) (THIS) PURE; - /*** IDirectDrawSurface methods ***/ - STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE) PURE; - STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT) PURE; - STDMETHOD(Blt)(THIS_ LPRECT,LPDIRECTDRAWSURFACE, LPRECT,DWORD, LPDDBLTFX) PURE; - STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH, DWORD, DWORD ) PURE; - STDMETHOD(BltFast)(THIS_ DWORD,DWORD,LPDIRECTDRAWSURFACE, LPRECT,DWORD) PURE; - STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD,LPDIRECTDRAWSURFACE) PURE; - STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID,LPDDENUMSURFACESCALLBACK) PURE; - STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD,LPVOID,LPDDENUMSURFACESCALLBACK) PURE; - STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE, DWORD) PURE; - STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS, LPDIRECTDRAWSURFACE FAR *) PURE; - STDMETHOD(GetBltStatus)(THIS_ DWORD) PURE; - STDMETHOD(GetCaps)(THIS_ LPDDSCAPS) PURE; - STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER FAR*) PURE; - STDMETHOD(GetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; - STDMETHOD(GetDC)(THIS_ HDC FAR *) PURE; - STDMETHOD(GetFlipStatus)(THIS_ DWORD) PURE; - STDMETHOD(GetOverlayPosition)(THIS_ LPLONG, LPLONG ) PURE; - STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE FAR*) PURE; - STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT) PURE; - STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC) PURE; - STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, LPDDSURFACEDESC) PURE; - STDMETHOD(IsLost)(THIS) PURE; - STDMETHOD(Lock)(THIS_ LPRECT,LPDDSURFACEDESC,DWORD,HANDLE) PURE; - STDMETHOD(ReleaseDC)(THIS_ HDC) PURE; - STDMETHOD(Restore)(THIS) PURE; - STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER) PURE; - STDMETHOD(SetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; - STDMETHOD(SetOverlayPosition)(THIS_ LONG, LONG ) PURE; - STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE) PURE; - STDMETHOD(Unlock)(THIS_ LPVOID) PURE; - STDMETHOD(UpdateOverlay)(THIS_ LPRECT, LPDIRECTDRAWSURFACE,LPRECT,DWORD, LPDDOVERLAYFX) PURE; - STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD) PURE; - STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD, LPDIRECTDRAWSURFACE) PURE; + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawSurface methods ***/ + STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT) PURE; + STDMETHOD(Blt)(THIS_ LPRECT,LPDIRECTDRAWSURFACE, LPRECT,DWORD, LPDDBLTFX) PURE; + STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH, DWORD, DWORD ) PURE; + STDMETHOD(BltFast)(THIS_ DWORD,DWORD,LPDIRECTDRAWSURFACE, LPRECT,DWORD) PURE; + STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD,LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID,LPDDENUMSURFACESCALLBACK) PURE; + STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD,LPVOID,LPDDENUMSURFACESCALLBACK) PURE; + STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE, DWORD) PURE; + STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS, LPDIRECTDRAWSURFACE FAR *) PURE; + STDMETHOD(GetBltStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetCaps)(THIS_ LPDDSCAPS) PURE; + STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER FAR*) PURE; + STDMETHOD(GetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(GetDC)(THIS_ HDC FAR *) PURE; + STDMETHOD(GetFlipStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetOverlayPosition)(THIS_ LPLONG, LPLONG ) PURE; + STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE FAR*) PURE; + STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT) PURE; + STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC) PURE; + STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, LPDDSURFACEDESC) PURE; + STDMETHOD(IsLost)(THIS) PURE; + STDMETHOD(Lock)(THIS_ LPRECT,LPDDSURFACEDESC,DWORD,HANDLE) PURE; + STDMETHOD(ReleaseDC)(THIS_ HDC) PURE; + STDMETHOD(Restore)(THIS) PURE; + STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER) PURE; + STDMETHOD(SetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(SetOverlayPosition)(THIS_ LONG, LONG ) PURE; + STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE) PURE; + STDMETHOD(Unlock)(THIS_ LPVOID) PURE; + STDMETHOD(UpdateOverlay)(THIS_ LPRECT, LPDIRECTDRAWSURFACE,LPRECT,DWORD, LPDDOVERLAYFX) PURE; + STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD) PURE; + STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD, LPDIRECTDRAWSURFACE) PURE; }; #if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirectDrawSurface_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirectDrawSurface_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirectDrawSurface_Release(p) (p)->lpVtbl->Release(p) -#define IDirectDrawSurface_AddAttachedSurface(p,a) (p)->lpVtbl->AddAttachedSurface(p,a) -#define IDirectDrawSurface_AddOverlayDirtyRect(p,a) (p)->lpVtbl->AddOverlayDirtyRect(p,a) -#define IDirectDrawSurface_Blt(p,a,b,c,d,e) (p)->lpVtbl->Blt(p,a,b,c,d,e) -#define IDirectDrawSurface_BltBatch(p,a,b,c) (p)->lpVtbl->BltBatch(p,a,b,c) -#define IDirectDrawSurface_BltFast(p,a,b,c,d,e) (p)->lpVtbl->BltFast(p,a,b,c,d,e) +#define IDirectDrawSurface_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectDrawSurface_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawSurface_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawSurface_AddAttachedSurface(p,a) (p)->lpVtbl->AddAttachedSurface(p,a) +#define IDirectDrawSurface_AddOverlayDirtyRect(p,a) (p)->lpVtbl->AddOverlayDirtyRect(p,a) +#define IDirectDrawSurface_Blt(p,a,b,c,d,e) (p)->lpVtbl->Blt(p,a,b,c,d,e) +#define IDirectDrawSurface_BltBatch(p,a,b,c) (p)->lpVtbl->BltBatch(p,a,b,c) +#define IDirectDrawSurface_BltFast(p,a,b,c,d,e) (p)->lpVtbl->BltFast(p,a,b,c,d,e) #define IDirectDrawSurface_DeleteAttachedSurface(p,a,b) (p)->lpVtbl->DeleteAttachedSurface(p,a,b) -#define IDirectDrawSurface_EnumAttachedSurfaces(p,a,b) (p)->lpVtbl->EnumAttachedSurfaces(p,a,b) -#define IDirectDrawSurface_EnumOverlayZOrders(p,a,b,c) (p)->lpVtbl->EnumOverlayZOrders(p,a,b,c) -#define IDirectDrawSurface_Flip(p,a,b) (p)->lpVtbl->Flip(p,a,b) -#define IDirectDrawSurface_GetAttachedSurface(p,a,b) (p)->lpVtbl->GetAttachedSurface(p,a,b) -#define IDirectDrawSurface_GetBltStatus(p,a) (p)->lpVtbl->GetBltStatus(p,a) -#define IDirectDrawSurface_GetCaps(p,b) (p)->lpVtbl->GetCaps(p,b) -#define IDirectDrawSurface_GetClipper(p,a) (p)->lpVtbl->GetClipper(p,a) -#define IDirectDrawSurface_GetColorKey(p,a,b) (p)->lpVtbl->GetColorKey(p,a,b) -#define IDirectDrawSurface_GetDC(p,a) (p)->lpVtbl->GetDC(p,a) -#define IDirectDrawSurface_GetFlipStatus(p,a) (p)->lpVtbl->GetFlipStatus(p,a) -#define IDirectDrawSurface_GetOverlayPosition(p,a,b) (p)->lpVtbl->GetOverlayPosition(p,a,b) -#define IDirectDrawSurface_GetPalette(p,a) (p)->lpVtbl->GetPalette(p,a) -#define IDirectDrawSurface_GetPixelFormat(p,a) (p)->lpVtbl->GetPixelFormat(p,a) -#define IDirectDrawSurface_GetSurfaceDesc(p,a) (p)->lpVtbl->GetSurfaceDesc(p,a) -#define IDirectDrawSurface_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) -#define IDirectDrawSurface_IsLost(p) (p)->lpVtbl->IsLost(p) -#define IDirectDrawSurface_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) -#define IDirectDrawSurface_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a) -#define IDirectDrawSurface_Restore(p) (p)->lpVtbl->Restore(p) -#define IDirectDrawSurface_SetClipper(p,a) (p)->lpVtbl->SetClipper(p,a) -#define IDirectDrawSurface_SetColorKey(p,a,b) (p)->lpVtbl->SetColorKey(p,a,b) -#define IDirectDrawSurface_SetOverlayPosition(p,a,b) (p)->lpVtbl->SetOverlayPosition(p,a,b) -#define IDirectDrawSurface_SetPalette(p,a) (p)->lpVtbl->SetPalette(p,a) -#define IDirectDrawSurface_Unlock(p,b) (p)->lpVtbl->Unlock(p,b) -#define IDirectDrawSurface_UpdateOverlay(p,a,b,c,d,e) (p)->lpVtbl->UpdateOverlay(p,a,b,c,d,e) -#define IDirectDrawSurface_UpdateOverlayDisplay(p,a) (p)->lpVtbl->UpdateOverlayDisplay(p,a) -#define IDirectDrawSurface_UpdateOverlayZOrder(p,a,b) (p)->lpVtbl->UpdateOverlayZOrder(p,a,b) +#define IDirectDrawSurface_EnumAttachedSurfaces(p,a,b) (p)->lpVtbl->EnumAttachedSurfaces(p,a,b) +#define IDirectDrawSurface_EnumOverlayZOrders(p,a,b,c) (p)->lpVtbl->EnumOverlayZOrders(p,a,b,c) +#define IDirectDrawSurface_Flip(p,a,b) (p)->lpVtbl->Flip(p,a,b) +#define IDirectDrawSurface_GetAttachedSurface(p,a,b) (p)->lpVtbl->GetAttachedSurface(p,a,b) +#define IDirectDrawSurface_GetBltStatus(p,a) (p)->lpVtbl->GetBltStatus(p,a) +#define IDirectDrawSurface_GetCaps(p,b) (p)->lpVtbl->GetCaps(p,b) +#define IDirectDrawSurface_GetClipper(p,a) (p)->lpVtbl->GetClipper(p,a) +#define IDirectDrawSurface_GetColorKey(p,a,b) (p)->lpVtbl->GetColorKey(p,a,b) +#define IDirectDrawSurface_GetDC(p,a) (p)->lpVtbl->GetDC(p,a) +#define IDirectDrawSurface_GetFlipStatus(p,a) (p)->lpVtbl->GetFlipStatus(p,a) +#define IDirectDrawSurface_GetOverlayPosition(p,a,b) (p)->lpVtbl->GetOverlayPosition(p,a,b) +#define IDirectDrawSurface_GetPalette(p,a) (p)->lpVtbl->GetPalette(p,a) +#define IDirectDrawSurface_GetPixelFormat(p,a) (p)->lpVtbl->GetPixelFormat(p,a) +#define IDirectDrawSurface_GetSurfaceDesc(p,a) (p)->lpVtbl->GetSurfaceDesc(p,a) +#define IDirectDrawSurface_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectDrawSurface_IsLost(p) (p)->lpVtbl->IsLost(p) +#define IDirectDrawSurface_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirectDrawSurface_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a) +#define IDirectDrawSurface_Restore(p) (p)->lpVtbl->Restore(p) +#define IDirectDrawSurface_SetClipper(p,a) (p)->lpVtbl->SetClipper(p,a) +#define IDirectDrawSurface_SetColorKey(p,a,b) (p)->lpVtbl->SetColorKey(p,a,b) +#define IDirectDrawSurface_SetOverlayPosition(p,a,b) (p)->lpVtbl->SetOverlayPosition(p,a,b) +#define IDirectDrawSurface_SetPalette(p,a) (p)->lpVtbl->SetPalette(p,a) +#define IDirectDrawSurface_Unlock(p,b) (p)->lpVtbl->Unlock(p,b) +#define IDirectDrawSurface_UpdateOverlay(p,a,b,c,d,e) (p)->lpVtbl->UpdateOverlay(p,a,b,c,d,e) +#define IDirectDrawSurface_UpdateOverlayDisplay(p,a) (p)->lpVtbl->UpdateOverlayDisplay(p,a) +#define IDirectDrawSurface_UpdateOverlayZOrder(p,a,b) (p)->lpVtbl->UpdateOverlayZOrder(p,a,b) #endif /* @@ -629,90 +629,90 @@ DECLARE_INTERFACE_( IDirectDrawSurface, IUnknown ) #define INTERFACE IDirectDrawSurface2 DECLARE_INTERFACE_( IDirectDrawSurface2, IUnknown ) { - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - STDMETHOD_(ULONG,Release) (THIS) PURE; - /*** IDirectDrawSurface methods ***/ - STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE2) PURE; - STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT) PURE; - STDMETHOD(Blt)(THIS_ LPRECT,LPDIRECTDRAWSURFACE2, LPRECT,DWORD, LPDDBLTFX) PURE; - STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH, DWORD, DWORD ) PURE; - STDMETHOD(BltFast)(THIS_ DWORD,DWORD,LPDIRECTDRAWSURFACE2, LPRECT,DWORD) PURE; - STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD,LPDIRECTDRAWSURFACE2) PURE; - STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID,LPDDENUMSURFACESCALLBACK) PURE; - STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD,LPVOID,LPDDENUMSURFACESCALLBACK) PURE; - STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE2, DWORD) PURE; - STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS, LPDIRECTDRAWSURFACE2 FAR *) PURE; - STDMETHOD(GetBltStatus)(THIS_ DWORD) PURE; - STDMETHOD(GetCaps)(THIS_ LPDDSCAPS) PURE; - STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER FAR*) PURE; - STDMETHOD(GetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; - STDMETHOD(GetDC)(THIS_ HDC FAR *) PURE; - STDMETHOD(GetFlipStatus)(THIS_ DWORD) PURE; - STDMETHOD(GetOverlayPosition)(THIS_ LPLONG, LPLONG ) PURE; - STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE FAR*) PURE; - STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT) PURE; - STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC) PURE; - STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, LPDDSURFACEDESC) PURE; - STDMETHOD(IsLost)(THIS) PURE; - STDMETHOD(Lock)(THIS_ LPRECT,LPDDSURFACEDESC,DWORD,HANDLE) PURE; - STDMETHOD(ReleaseDC)(THIS_ HDC) PURE; - STDMETHOD(Restore)(THIS) PURE; - STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER) PURE; - STDMETHOD(SetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; - STDMETHOD(SetOverlayPosition)(THIS_ LONG, LONG ) PURE; - STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE) PURE; - STDMETHOD(Unlock)(THIS_ LPVOID) PURE; - STDMETHOD(UpdateOverlay)(THIS_ LPRECT, LPDIRECTDRAWSURFACE2,LPRECT,DWORD, LPDDOVERLAYFX) PURE; - STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD) PURE; - STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD, LPDIRECTDRAWSURFACE2) PURE; - /*** Added in the v2 interface ***/ - STDMETHOD(GetDDInterface)(THIS_ LPVOID FAR *) PURE; - STDMETHOD(PageLock)(THIS_ DWORD) PURE; - STDMETHOD(PageUnlock)(THIS_ DWORD) PURE; + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawSurface methods ***/ + STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE2) PURE; + STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT) PURE; + STDMETHOD(Blt)(THIS_ LPRECT,LPDIRECTDRAWSURFACE2, LPRECT,DWORD, LPDDBLTFX) PURE; + STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH, DWORD, DWORD ) PURE; + STDMETHOD(BltFast)(THIS_ DWORD,DWORD,LPDIRECTDRAWSURFACE2, LPRECT,DWORD) PURE; + STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD,LPDIRECTDRAWSURFACE2) PURE; + STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID,LPDDENUMSURFACESCALLBACK) PURE; + STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD,LPVOID,LPDDENUMSURFACESCALLBACK) PURE; + STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE2, DWORD) PURE; + STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS, LPDIRECTDRAWSURFACE2 FAR *) PURE; + STDMETHOD(GetBltStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetCaps)(THIS_ LPDDSCAPS) PURE; + STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER FAR*) PURE; + STDMETHOD(GetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(GetDC)(THIS_ HDC FAR *) PURE; + STDMETHOD(GetFlipStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetOverlayPosition)(THIS_ LPLONG, LPLONG ) PURE; + STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE FAR*) PURE; + STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT) PURE; + STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC) PURE; + STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, LPDDSURFACEDESC) PURE; + STDMETHOD(IsLost)(THIS) PURE; + STDMETHOD(Lock)(THIS_ LPRECT,LPDDSURFACEDESC,DWORD,HANDLE) PURE; + STDMETHOD(ReleaseDC)(THIS_ HDC) PURE; + STDMETHOD(Restore)(THIS) PURE; + STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER) PURE; + STDMETHOD(SetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(SetOverlayPosition)(THIS_ LONG, LONG ) PURE; + STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE) PURE; + STDMETHOD(Unlock)(THIS_ LPVOID) PURE; + STDMETHOD(UpdateOverlay)(THIS_ LPRECT, LPDIRECTDRAWSURFACE2,LPRECT,DWORD, LPDDOVERLAYFX) PURE; + STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD) PURE; + STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD, LPDIRECTDRAWSURFACE2) PURE; + /*** Added in the v2 interface ***/ + STDMETHOD(GetDDInterface)(THIS_ LPVOID FAR *) PURE; + STDMETHOD(PageLock)(THIS_ DWORD) PURE; + STDMETHOD(PageUnlock)(THIS_ DWORD) PURE; }; #if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirectDrawSurface2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirectDrawSurface2_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirectDrawSurface2_Release(p) (p)->lpVtbl->Release(p) -#define IDirectDrawSurface2_AddAttachedSurface(p,a) (p)->lpVtbl->AddAttachedSurface(p,a) -#define IDirectDrawSurface2_AddOverlayDirtyRect(p,a) (p)->lpVtbl->AddOverlayDirtyRect(p,a) -#define IDirectDrawSurface2_Blt(p,a,b,c,d,e) (p)->lpVtbl->Blt(p,a,b,c,d,e) -#define IDirectDrawSurface2_BltBatch(p,a,b,c) (p)->lpVtbl->BltBatch(p,a,b,c) -#define IDirectDrawSurface2_BltFast(p,a,b,c,d,e) (p)->lpVtbl->BltFast(p,a,b,c,d,e) +#define IDirectDrawSurface2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectDrawSurface2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawSurface2_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawSurface2_AddAttachedSurface(p,a) (p)->lpVtbl->AddAttachedSurface(p,a) +#define IDirectDrawSurface2_AddOverlayDirtyRect(p,a) (p)->lpVtbl->AddOverlayDirtyRect(p,a) +#define IDirectDrawSurface2_Blt(p,a,b,c,d,e) (p)->lpVtbl->Blt(p,a,b,c,d,e) +#define IDirectDrawSurface2_BltBatch(p,a,b,c) (p)->lpVtbl->BltBatch(p,a,b,c) +#define IDirectDrawSurface2_BltFast(p,a,b,c,d,e) (p)->lpVtbl->BltFast(p,a,b,c,d,e) #define IDirectDrawSurface2_DeleteAttachedSurface(p,a,b) (p)->lpVtbl->DeleteAttachedSurface(p,a,b) -#define IDirectDrawSurface2_EnumAttachedSurfaces(p,a,b) (p)->lpVtbl->EnumAttachedSurfaces(p,a,b) -#define IDirectDrawSurface2_EnumOverlayZOrders(p,a,b,c) (p)->lpVtbl->EnumOverlayZOrders(p,a,b,c) -#define IDirectDrawSurface2_Flip(p,a,b) (p)->lpVtbl->Flip(p,a,b) -#define IDirectDrawSurface2_GetAttachedSurface(p,a,b) (p)->lpVtbl->GetAttachedSurface(p,a,b) -#define IDirectDrawSurface2_GetBltStatus(p,a) (p)->lpVtbl->GetBltStatus(p,a) -#define IDirectDrawSurface2_GetCaps(p,b) (p)->lpVtbl->GetCaps(p,b) -#define IDirectDrawSurface2_GetClipper(p,a) (p)->lpVtbl->GetClipper(p,a) -#define IDirectDrawSurface2_GetColorKey(p,a,b) (p)->lpVtbl->GetColorKey(p,a,b) -#define IDirectDrawSurface2_GetDC(p,a) (p)->lpVtbl->GetDC(p,a) -#define IDirectDrawSurface2_GetFlipStatus(p,a) (p)->lpVtbl->GetFlipStatus(p,a) -#define IDirectDrawSurface2_GetOverlayPosition(p,a,b) (p)->lpVtbl->GetOverlayPosition(p,a,b) -#define IDirectDrawSurface2_GetPalette(p,a) (p)->lpVtbl->GetPalette(p,a) -#define IDirectDrawSurface2_GetPixelFormat(p,a) (p)->lpVtbl->GetPixelFormat(p,a) -#define IDirectDrawSurface2_GetSurfaceDesc(p,a) (p)->lpVtbl->GetSurfaceDesc(p,a) -#define IDirectDrawSurface2_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) -#define IDirectDrawSurface2_IsLost(p) (p)->lpVtbl->IsLost(p) -#define IDirectDrawSurface2_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) -#define IDirectDrawSurface2_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a) -#define IDirectDrawSurface2_Restore(p) (p)->lpVtbl->Restore(p) -#define IDirectDrawSurface2_SetClipper(p,a) (p)->lpVtbl->SetClipper(p,a) -#define IDirectDrawSurface2_SetColorKey(p,a,b) (p)->lpVtbl->SetColorKey(p,a,b) -#define IDirectDrawSurface2_SetOverlayPosition(p,a,b) (p)->lpVtbl->SetOverlayPosition(p,a,b) -#define IDirectDrawSurface2_SetPalette(p,a) (p)->lpVtbl->SetPalette(p,a) -#define IDirectDrawSurface2_Unlock(p,b) (p)->lpVtbl->Unlock(p,b) -#define IDirectDrawSurface2_UpdateOverlay(p,a,b,c,d,e) (p)->lpVtbl->UpdateOverlay(p,a,b,c,d,e) -#define IDirectDrawSurface2_UpdateOverlayDisplay(p,a) (p)->lpVtbl->UpdateOverlayDisplay(p,a) -#define IDirectDrawSurface2_UpdateOverlayZOrder(p,a,b) (p)->lpVtbl->UpdateOverlayZOrder(p,a,b) -#define IDirectDrawSurface2_GetDDInterface(p,a) (p)->lpVtbl->GetDDInterface(p,a) -#define IDirectDrawSurface2_PageLock(p,a) (p)->lpVtbl->PageLock(p,a) -#define IDirectDrawSurface2_PageUnlock(p,a) (p)->lpVtbl->PageUnlock(p,a) +#define IDirectDrawSurface2_EnumAttachedSurfaces(p,a,b) (p)->lpVtbl->EnumAttachedSurfaces(p,a,b) +#define IDirectDrawSurface2_EnumOverlayZOrders(p,a,b,c) (p)->lpVtbl->EnumOverlayZOrders(p,a,b,c) +#define IDirectDrawSurface2_Flip(p,a,b) (p)->lpVtbl->Flip(p,a,b) +#define IDirectDrawSurface2_GetAttachedSurface(p,a,b) (p)->lpVtbl->GetAttachedSurface(p,a,b) +#define IDirectDrawSurface2_GetBltStatus(p,a) (p)->lpVtbl->GetBltStatus(p,a) +#define IDirectDrawSurface2_GetCaps(p,b) (p)->lpVtbl->GetCaps(p,b) +#define IDirectDrawSurface2_GetClipper(p,a) (p)->lpVtbl->GetClipper(p,a) +#define IDirectDrawSurface2_GetColorKey(p,a,b) (p)->lpVtbl->GetColorKey(p,a,b) +#define IDirectDrawSurface2_GetDC(p,a) (p)->lpVtbl->GetDC(p,a) +#define IDirectDrawSurface2_GetFlipStatus(p,a) (p)->lpVtbl->GetFlipStatus(p,a) +#define IDirectDrawSurface2_GetOverlayPosition(p,a,b) (p)->lpVtbl->GetOverlayPosition(p,a,b) +#define IDirectDrawSurface2_GetPalette(p,a) (p)->lpVtbl->GetPalette(p,a) +#define IDirectDrawSurface2_GetPixelFormat(p,a) (p)->lpVtbl->GetPixelFormat(p,a) +#define IDirectDrawSurface2_GetSurfaceDesc(p,a) (p)->lpVtbl->GetSurfaceDesc(p,a) +#define IDirectDrawSurface2_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectDrawSurface2_IsLost(p) (p)->lpVtbl->IsLost(p) +#define IDirectDrawSurface2_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirectDrawSurface2_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a) +#define IDirectDrawSurface2_Restore(p) (p)->lpVtbl->Restore(p) +#define IDirectDrawSurface2_SetClipper(p,a) (p)->lpVtbl->SetClipper(p,a) +#define IDirectDrawSurface2_SetColorKey(p,a,b) (p)->lpVtbl->SetColorKey(p,a,b) +#define IDirectDrawSurface2_SetOverlayPosition(p,a,b) (p)->lpVtbl->SetOverlayPosition(p,a,b) +#define IDirectDrawSurface2_SetPalette(p,a) (p)->lpVtbl->SetPalette(p,a) +#define IDirectDrawSurface2_Unlock(p,b) (p)->lpVtbl->Unlock(p,b) +#define IDirectDrawSurface2_UpdateOverlay(p,a,b,c,d,e) (p)->lpVtbl->UpdateOverlay(p,a,b,c,d,e) +#define IDirectDrawSurface2_UpdateOverlayDisplay(p,a) (p)->lpVtbl->UpdateOverlayDisplay(p,a) +#define IDirectDrawSurface2_UpdateOverlayZOrder(p,a,b) (p)->lpVtbl->UpdateOverlayZOrder(p,a,b) +#define IDirectDrawSurface2_GetDDInterface(p,a) (p)->lpVtbl->GetDDInterface(p,a) +#define IDirectDrawSurface2_PageLock(p,a) (p)->lpVtbl->PageLock(p,a) +#define IDirectDrawSurface2_PageUnlock(p,a) (p)->lpVtbl->PageUnlock(p,a) #endif @@ -724,106 +724,106 @@ DECLARE_INTERFACE_( IDirectDrawSurface2, IUnknown ) */ typedef struct _DDSURFACEDESC { - DWORD dwSize; // size of the DDSURFACEDESC structure - DWORD dwFlags; // determines what fields are valid - DWORD dwHeight; // height of surface to be created - DWORD dwWidth; // width of input surface - LONG lPitch; // distance to start of next line (return value only) - DWORD dwBackBufferCount; // number of back buffers requested - union - { - DWORD dwMipMapCount; // number of mip-map levels requested - DWORD dwZBufferBitDepth; // depth of Z buffer requested - DWORD dwRefreshRate; // refresh rate (used when display mode is described) - }; - DWORD dwAlphaBitDepth; // depth of alpha buffer requested - DWORD dwReserved; // reserved - LPVOID lpSurface; // pointer to the associated surface memory - DDCOLORKEY ddckCKDestOverlay; // color key for destination overlay use - DDCOLORKEY ddckCKDestBlt; // color key for destination blt use - DDCOLORKEY ddckCKSrcOverlay; // color key for source overlay use - DDCOLORKEY ddckCKSrcBlt; // color key for source blt use - DDPIXELFORMAT ddpfPixelFormat; // pixel format description of the surface - DDSCAPS ddsCaps; // direct draw surface capabilities + DWORD dwSize; // size of the DDSURFACEDESC structure + DWORD dwFlags; // determines what fields are valid + DWORD dwHeight; // height of surface to be created + DWORD dwWidth; // width of input surface + LONG lPitch; // distance to start of next line (return value only) + DWORD dwBackBufferCount; // number of back buffers requested + union + { + DWORD dwMipMapCount; // number of mip-map levels requested + DWORD dwZBufferBitDepth; // depth of Z buffer requested + DWORD dwRefreshRate; // refresh rate (used when display mode is described) + }; + DWORD dwAlphaBitDepth; // depth of alpha buffer requested + DWORD dwReserved; // reserved + LPVOID lpSurface; // pointer to the associated surface memory + DDCOLORKEY ddckCKDestOverlay; // color key for destination overlay use + DDCOLORKEY ddckCKDestBlt; // color key for destination blt use + DDCOLORKEY ddckCKSrcOverlay; // color key for source overlay use + DDCOLORKEY ddckCKSrcBlt; // color key for source blt use + DDPIXELFORMAT ddpfPixelFormat; // pixel format description of the surface + DDSCAPS ddsCaps; // direct draw surface capabilities } DDSURFACEDESC; /* * ddsCaps field is valid. */ -#define DDSD_CAPS 0x00000001l // default +#define DDSD_CAPS 0x00000001l // default /* * dwHeight field is valid. */ -#define DDSD_HEIGHT 0x00000002l +#define DDSD_HEIGHT 0x00000002l /* * dwWidth field is valid. */ -#define DDSD_WIDTH 0x00000004l +#define DDSD_WIDTH 0x00000004l /* * lPitch is valid. */ -#define DDSD_PITCH 0x00000008l +#define DDSD_PITCH 0x00000008l /* * dwBackBufferCount is valid. */ -#define DDSD_BACKBUFFERCOUNT 0x00000020l +#define DDSD_BACKBUFFERCOUNT 0x00000020l /* * dwZBufferBitDepth is valid. */ -#define DDSD_ZBUFFERBITDEPTH 0x00000040l +#define DDSD_ZBUFFERBITDEPTH 0x00000040l /* * dwAlphaBitDepth is valid. */ -#define DDSD_ALPHABITDEPTH 0x00000080l +#define DDSD_ALPHABITDEPTH 0x00000080l /* * ddpfPixelFormat is valid. */ -#define DDSD_PIXELFORMAT 0x00001000l +#define DDSD_PIXELFORMAT 0x00001000l /* * ddckCKDestOverlay is valid. */ -#define DDSD_CKDESTOVERLAY 0x00002000l +#define DDSD_CKDESTOVERLAY 0x00002000l /* * ddckCKDestBlt is valid. */ -#define DDSD_CKDESTBLT 0x00004000l +#define DDSD_CKDESTBLT 0x00004000l /* * ddckCKSrcOverlay is valid. */ -#define DDSD_CKSRCOVERLAY 0x00008000l +#define DDSD_CKSRCOVERLAY 0x00008000l /* * ddckCKSrcBlt is valid. */ -#define DDSD_CKSRCBLT 0x00010000l +#define DDSD_CKSRCBLT 0x00010000l /* * dwMipMapCount is valid. */ -#define DDSD_MIPMAPCOUNT 0x00020000l +#define DDSD_MIPMAPCOUNT 0x00020000l /* - * dwRefreshRate is valid - */ -#define DDSD_REFRESHRATE 0x00040000l + * dwRefreshRate is valid + */ +#define DDSD_REFRESHRATE 0x00040000l /* * All input fields are valid. */ -#define DDSD_ALL 0x0007f9eel +#define DDSD_ALL 0x0007f9eel /*============================================================================ @@ -843,166 +843,166 @@ typedef struct _DDSURFACEDESC /* * This bit currently has no meaning. */ -#define DDSCAPS_3D 0x00000001l +#define DDSCAPS_3D 0x00000001l /* - * Indicates that this surface contains alpha information. The pixel + * Indicates that this surface contains alpha information. The pixel * format must be interrogated to determine whether this surface * contains only alpha information or alpha information interlaced * with pixel color data (e.g. RGBA or YUVA). */ -#define DDSCAPS_ALPHA 0x00000002l +#define DDSCAPS_ALPHA 0x00000002l /* - * Indicates that this surface is a backbuffer. It is generally + * Indicates that this surface is a backbuffer. It is generally * set by CreateSurface when the DDSCAPS_FLIP capability bit is set. * It indicates that this surface is THE back buffer of a surface - * flipping structure. DirectDraw supports N surfaces in a - * surface flipping structure. Only the surface that immediately + * flipping structure. DirectDraw supports N surfaces in a + * surface flipping structure. Only the surface that immediately * precedeces the DDSCAPS_FRONTBUFFER has this capability bit set. * The other surfaces are identified as back buffers by the presence * of the DDSCAPS_FLIP capability, their attachment order, and the * absence of the DDSCAPS_FRONTBUFFER and DDSCAPS_BACKBUFFER - * capabilities. The bit is sent to CreateSurface when a standalone - * back buffer is being created. This surface could be attached to + * capabilities. The bit is sent to CreateSurface when a standalone + * back buffer is being created. This surface could be attached to * a front buffer and/or back buffers to form a flipping surface - * structure after the CreateSurface call. See AddAttachments for + * structure after the CreateSurface call. See AddAttachments for * a detailed description of the behaviors in this case. */ -#define DDSCAPS_BACKBUFFER 0x00000004l +#define DDSCAPS_BACKBUFFER 0x00000004l /* - * Indicates a complex surface structure is being described. A + * Indicates a complex surface structure is being described. A * complex surface structure results in the creation of more than - * one surface. The additional surfaces are attached to the root - * surface. The complex structure can only be destroyed by + * one surface. The additional surfaces are attached to the root + * surface. The complex structure can only be destroyed by * destroying the root. */ -#define DDSCAPS_COMPLEX 0x00000008l +#define DDSCAPS_COMPLEX 0x00000008l /* * Indicates that this surface is a part of a surface flipping structure. * When it is passed to CreateSurface the DDSCAPS_FRONTBUFFER and - * DDSCAP_BACKBUFFER bits are not set. They are set by CreateSurface - * on the resulting creations. The dwBackBufferCount field in the + * DDSCAP_BACKBUFFER bits are not set. They are set by CreateSurface + * on the resulting creations. The dwBackBufferCount field in the * DDSURFACEDESC structure must be set to at least 1 in order for - * the CreateSurface call to succeed. The DDSCAPS_COMPLEX capability + * the CreateSurface call to succeed. The DDSCAPS_COMPLEX capability * must always be set with creating multiple surfaces through CreateSurface. */ -#define DDSCAPS_FLIP 0x00000010l +#define DDSCAPS_FLIP 0x00000010l /* * Indicates that this surface is THE front buffer of a surface flipping - * structure. It is generally set by CreateSurface when the DDSCAPS_FLIP + * structure. It is generally set by CreateSurface when the DDSCAPS_FLIP * capability bit is set. * If this capability is sent to CreateSurface then a standalonw front buffer - * is created. This surface will not have the DDSCAPS_FLIP capability. + * is created. This surface will not have the DDSCAPS_FLIP capability. * It can be attached to other back buffers to form a flipping structure. * See AddAttachments for a detailed description of the behaviors in this * case. */ -#define DDSCAPS_FRONTBUFFER 0x00000020l +#define DDSCAPS_FRONTBUFFER 0x00000020l /* * Indicates that this surface is any offscreen surface that is not an overlay, - * texture, zbuffer, front buffer, back buffer, or alpha surface. It is used + * texture, zbuffer, front buffer, back buffer, or alpha surface. It is used * to identify plain vanilla surfaces. */ -#define DDSCAPS_OFFSCREENPLAIN 0x00000040l +#define DDSCAPS_OFFSCREENPLAIN 0x00000040l /* - * Indicates that this surface is an overlay. It may or may not be directly visible + * Indicates that this surface is an overlay. It may or may not be directly visible * depending on whether or not it is currently being overlayed onto the primary - * surface. DDSCAPS_VISIBLE can be used to determine whether or not it is being + * surface. DDSCAPS_VISIBLE can be used to determine whether or not it is being * overlayed at the moment. */ -#define DDSCAPS_OVERLAY 0x00000080l +#define DDSCAPS_OVERLAY 0x00000080l /* * Indicates that unique DirectDrawPalette objects can be created and * attached to this surface. */ -#define DDSCAPS_PALETTE 0x00000100l +#define DDSCAPS_PALETTE 0x00000100l /* - * Indicates that this surface is the primary surface. The primary + * Indicates that this surface is the primary surface. The primary * surface represents what the user is seeing at the moment. */ -#define DDSCAPS_PRIMARYSURFACE 0x00000200l +#define DDSCAPS_PRIMARYSURFACE 0x00000200l /* * Indicates that this surface is the primary surface for the left eye. * The primary surface for the left eye represents what the user is seeing - * at the moment with the users left eye. When this surface is created the + * at the moment with the users left eye. When this surface is created the * DDSCAPS_PRIMARYSURFACE represents what the user is seeing with the users * right eye. */ -#define DDSCAPS_PRIMARYSURFACELEFT 0x00000400l +#define DDSCAPS_PRIMARYSURFACELEFT 0x00000400l /* * Indicates that this surface memory was allocated in system memory */ -#define DDSCAPS_SYSTEMMEMORY 0x00000800l +#define DDSCAPS_SYSTEMMEMORY 0x00000800l /* - * Indicates that this surface can be used as a 3D texture. It does not + * Indicates that this surface can be used as a 3D texture. It does not * indicate whether or not the surface is being used for that purpose. */ -#define DDSCAPS_TEXTURE 0x00001000l +#define DDSCAPS_TEXTURE 0x00001000l /* - * Indicates that a surface may be a destination for 3D rendering. This + * Indicates that a surface may be a destination for 3D rendering. This * bit must be set in order to query for a Direct3D Device Interface * from this surface. */ -#define DDSCAPS_3DDEVICE 0x00002000l +#define DDSCAPS_3DDEVICE 0x00002000l /* * Indicates that this surface exists in video memory. */ -#define DDSCAPS_VIDEOMEMORY 0x00004000l +#define DDSCAPS_VIDEOMEMORY 0x00004000l /* - * Indicates that changes made to this surface are immediately visible. + * Indicates that changes made to this surface are immediately visible. * It is always set for the primary surface and is set for overlays while * they are being overlayed and texture maps while they are being textured. */ -#define DDSCAPS_VISIBLE 0x00008000l +#define DDSCAPS_VISIBLE 0x00008000l /* - * Indicates that only writes are permitted to the surface. Read accesses + * Indicates that only writes are permitted to the surface. Read accesses * from the surface may or may not generate a protection fault, but the - * results of a read from this surface will not be meaningful. READ ONLY. + * results of a read from this surface will not be meaningful. READ ONLY. */ -#define DDSCAPS_WRITEONLY 0x00010000l +#define DDSCAPS_WRITEONLY 0x00010000l /* * Indicates that this surface is a z buffer. A z buffer does not contain - * displayable information. Instead it contains bit depth information that is + * displayable information. Instead it contains bit depth information that is * used to determine which pixels are visible and which are obscured. */ -#define DDSCAPS_ZBUFFER 0x00020000l +#define DDSCAPS_ZBUFFER 0x00020000l /* * Indicates surface will have a DC associated long term */ -#define DDSCAPS_OWNDC 0x00040000l +#define DDSCAPS_OWNDC 0x00040000l /* * Indicates surface should be able to receive live video */ -#define DDSCAPS_LIVEVIDEO 0x00080000l +#define DDSCAPS_LIVEVIDEO 0x00080000l /* * Indicates surface should be able to have a stream decompressed * to it by the hardware. */ -#define DDSCAPS_HWCODEC 0x00100000l +#define DDSCAPS_HWCODEC 0x00100000l /* * Surface is a 320x200 or 320x240 ModeX surface */ -#define DDSCAPS_MODEX 0x00200000l +#define DDSCAPS_MODEX 0x00200000l /* * Indicates surface is one level of a mip-map. This surface will @@ -1011,7 +1011,7 @@ typedef struct _DDSURFACEDESC * attaching them with AddAttachedSurface or by implicitly by CreateSurface. * If this bit is set then DDSCAPS_TEXTURE must also be set. */ -#define DDSCAPS_MIPMAP 0x00400000l +#define DDSCAPS_MIPMAP 0x00400000l @@ -1019,7 +1019,7 @@ typedef struct _DDSURFACEDESC * Indicates that memory for the surface is not allocated until the surface * is loaded (via the Direct3D texture Load() function). */ -#define DDSCAPS_ALLOCONLOAD 0x04000000l +#define DDSCAPS_ALLOCONLOAD 0x04000000l @@ -1032,172 +1032,172 @@ typedef struct _DDSURFACEDESC /* * Display hardware has 3D acceleration. */ -#define DDCAPS_3D 0x00000001l +#define DDCAPS_3D 0x00000001l /* * Indicates that DirectDraw will support only dest rectangles that are aligned * on DIRECTDRAWCAPS.dwAlignBoundaryDest boundaries of the surface, respectively. * READ ONLY. */ -#define DDCAPS_ALIGNBOUNDARYDEST 0x00000002l +#define DDCAPS_ALIGNBOUNDARYDEST 0x00000002l /* - * Indicates that DirectDraw will support only source rectangles whose sizes in - * BYTEs are DIRECTDRAWCAPS.dwAlignSizeDest multiples, respectively. READ ONLY. + * Indicates that DirectDraw will support only source rectangles whose sizes in + * BYTEs are DIRECTDRAWCAPS.dwAlignSizeDest multiples, respectively. READ ONLY. */ -#define DDCAPS_ALIGNSIZEDEST 0x00000004l +#define DDCAPS_ALIGNSIZEDEST 0x00000004l /* * Indicates that DirectDraw will support only source rectangles that are aligned * on DIRECTDRAWCAPS.dwAlignBoundarySrc boundaries of the surface, respectively. * READ ONLY. */ -#define DDCAPS_ALIGNBOUNDARYSRC 0x00000008l +#define DDCAPS_ALIGNBOUNDARYSRC 0x00000008l /* - * Indicates that DirectDraw will support only source rectangles whose sizes in - * BYTEs are DIRECTDRAWCAPS.dwAlignSizeSrc multiples, respectively. READ ONLY. + * Indicates that DirectDraw will support only source rectangles whose sizes in + * BYTEs are DIRECTDRAWCAPS.dwAlignSizeSrc multiples, respectively. READ ONLY. */ -#define DDCAPS_ALIGNSIZESRC 0x00000010l +#define DDCAPS_ALIGNSIZESRC 0x00000010l /* * Indicates that DirectDraw will create video memory surfaces that have a stride - * alignment equal to DIRECTDRAWCAPS.dwAlignStride. READ ONLY. + * alignment equal to DIRECTDRAWCAPS.dwAlignStride. READ ONLY. */ -#define DDCAPS_ALIGNSTRIDE 0x00000020l +#define DDCAPS_ALIGNSTRIDE 0x00000020l /* * Display hardware is capable of blt operations. */ -#define DDCAPS_BLT 0x00000040l +#define DDCAPS_BLT 0x00000040l /* * Display hardware is capable of asynchronous blt operations. */ -#define DDCAPS_BLTQUEUE 0x00000080l +#define DDCAPS_BLTQUEUE 0x00000080l /* * Display hardware is capable of color space conversions during the blt operation. */ -#define DDCAPS_BLTFOURCC 0x00000100l +#define DDCAPS_BLTFOURCC 0x00000100l /* * Display hardware is capable of stretching during blt operations. */ -#define DDCAPS_BLTSTRETCH 0x00000200l +#define DDCAPS_BLTSTRETCH 0x00000200l /* * Display hardware is shared with GDI. */ -#define DDCAPS_GDI 0x00000400l +#define DDCAPS_GDI 0x00000400l /* * Display hardware can overlay. */ -#define DDCAPS_OVERLAY 0x00000800l +#define DDCAPS_OVERLAY 0x00000800l /* * Set if display hardware supports overlays but can not clip them. */ -#define DDCAPS_OVERLAYCANTCLIP 0x00001000l +#define DDCAPS_OVERLAYCANTCLIP 0x00001000l /* * Indicates that overlay hardware is capable of color space conversions during * the overlay operation. */ -#define DDCAPS_OVERLAYFOURCC 0x00002000l +#define DDCAPS_OVERLAYFOURCC 0x00002000l /* * Indicates that stretching can be done by the overlay hardware. */ -#define DDCAPS_OVERLAYSTRETCH 0x00004000l +#define DDCAPS_OVERLAYSTRETCH 0x00004000l /* * Indicates that unique DirectDrawPalettes can be created for DirectDrawSurfaces * other than the primary surface. */ -#define DDCAPS_PALETTE 0x00008000l +#define DDCAPS_PALETTE 0x00008000l /* * Indicates that palette changes can be syncd with the veritcal refresh. */ -#define DDCAPS_PALETTEVSYNC 0x00010000l +#define DDCAPS_PALETTEVSYNC 0x00010000l /* * Display hardware can return the current scan line. */ -#define DDCAPS_READSCANLINE 0x00020000l +#define DDCAPS_READSCANLINE 0x00020000l /* - * Display hardware has stereo vision capabilities. DDSCAPS_PRIMARYSURFACELEFT + * Display hardware has stereo vision capabilities. DDSCAPS_PRIMARYSURFACELEFT * can be created. */ -#define DDCAPS_STEREOVIEW 0x00040000l +#define DDCAPS_STEREOVIEW 0x00040000l /* * Display hardware is capable of generating a vertical blank interrupt. */ -#define DDCAPS_VBI 0x00080000l +#define DDCAPS_VBI 0x00080000l /* * Supports the use of z buffers with blt operations. */ -#define DDCAPS_ZBLTS 0x00100000l +#define DDCAPS_ZBLTS 0x00100000l /* * Supports Z Ordering of overlays. */ -#define DDCAPS_ZOVERLAYS 0x00200000l +#define DDCAPS_ZOVERLAYS 0x00200000l /* * Supports color key */ -#define DDCAPS_COLORKEY 0x00400000l +#define DDCAPS_COLORKEY 0x00400000l /* * Supports alpha surfaces */ -#define DDCAPS_ALPHA 0x00800000l +#define DDCAPS_ALPHA 0x00800000l /* * colorkey is hardware assisted(DDCAPS_COLORKEY will also be set) */ -#define DDCAPS_COLORKEYHWASSIST 0x01000000l +#define DDCAPS_COLORKEYHWASSIST 0x01000000l /* * no hardware support at all */ -#define DDCAPS_NOHARDWARE 0x02000000l +#define DDCAPS_NOHARDWARE 0x02000000l /* * Display hardware is capable of color fill with bltter */ -#define DDCAPS_BLTCOLORFILL 0x04000000l +#define DDCAPS_BLTCOLORFILL 0x04000000l /* * Display hardware is bank switched, and potentially very slow at * random access to VRAM. */ -#define DDCAPS_BANKSWITCHED 0x08000000l +#define DDCAPS_BANKSWITCHED 0x08000000l /* * Display hardware is capable of depth filling Z-buffers with bltter */ -#define DDCAPS_BLTDEPTHFILL 0x10000000l +#define DDCAPS_BLTDEPTHFILL 0x10000000l /* * Display hardware is capable of clipping while bltting. */ -#define DDCAPS_CANCLIP 0x20000000l +#define DDCAPS_CANCLIP 0x20000000l /* * Display hardware is capable of clipping while stretch bltting. */ -#define DDCAPS_CANCLIPSTRETCHED 0x40000000l +#define DDCAPS_CANCLIPSTRETCHED 0x40000000l /* * Display hardware is capable of bltting to or from system memory */ -#define DDCAPS_CANBLTSYSMEM 0x80000000l +#define DDCAPS_CANBLTSYSMEM 0x80000000l /**************************************************************************** @@ -1209,13 +1209,13 @@ typedef struct _DDSURFACEDESC /* * Display hardware is certified */ -#define DDCAPS2_CERTIFIED 0x00000001l +#define DDCAPS2_CERTIFIED 0x00000001l /* * Driver cannot interleave 2D operations (lock and blt) to surfaces with * Direct3D rendering operations between calls to BeginScene() and EndScene() */ -#define DDCAPS2_NO2DDURING3DSCENE 0x00000002l +#define DDCAPS2_NO2DDURING3DSCENE 0x00000002l /**************************************************************************** * @@ -1227,81 +1227,81 @@ typedef struct _DDSURFACEDESC * Supports alpha blending around the edge of a source color keyed surface. * For Blt. */ -#define DDFXALPHACAPS_BLTALPHAEDGEBLEND 0x00000001l +#define DDFXALPHACAPS_BLTALPHAEDGEBLEND 0x00000001l /* - * Supports alpha information in the pixel format. The bit depth of alpha - * information in the pixel format can be 1,2,4, or 8. The alpha value becomes - * more opaque as the alpha value increases. (0 is transparent.) + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value becomes + * more opaque as the alpha value increases. (0 is transparent.) * For Blt. */ -#define DDFXALPHACAPS_BLTALPHAPIXELS 0x00000002l +#define DDFXALPHACAPS_BLTALPHAPIXELS 0x00000002l /* - * Supports alpha information in the pixel format. The bit depth of alpha - * information in the pixel format can be 1,2,4, or 8. The alpha value - * becomes more transparent as the alpha value increases. (0 is opaque.) + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value + * becomes more transparent as the alpha value increases. (0 is opaque.) * This flag can only be set if DDCAPS_ALPHA is set. * For Blt. */ -#define DDFXALPHACAPS_BLTALPHAPIXELSNEG 0x00000004l +#define DDFXALPHACAPS_BLTALPHAPIXELSNEG 0x00000004l /* - * Supports alpha only surfaces. The bit depth of an alpha only surface can be - * 1,2,4, or 8. The alpha value becomes more opaque as the alpha value increases. + * Supports alpha only surfaces. The bit depth of an alpha only surface can be + * 1,2,4, or 8. The alpha value becomes more opaque as the alpha value increases. * (0 is transparent.) * For Blt. */ -#define DDFXALPHACAPS_BLTALPHASURFACES 0x00000008l +#define DDFXALPHACAPS_BLTALPHASURFACES 0x00000008l /* - * The depth of the alpha channel data can range can be 1,2,4, or 8. + * The depth of the alpha channel data can range can be 1,2,4, or 8. * The NEG suffix indicates that this alpha channel becomes more transparent - * as the alpha value increases. (0 is opaque.) This flag can only be set if + * as the alpha value increases. (0 is opaque.) This flag can only be set if * DDCAPS_ALPHA is set. * For Blt. */ -#define DDFXALPHACAPS_BLTALPHASURFACESNEG 0x00000010l +#define DDFXALPHACAPS_BLTALPHASURFACESNEG 0x00000010l /* * Supports alpha blending around the edge of a source color keyed surface. * For Overlays. */ -#define DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND 0x00000020l +#define DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND 0x00000020l /* - * Supports alpha information in the pixel format. The bit depth of alpha - * information in the pixel format can be 1,2,4, or 8. The alpha value becomes - * more opaque as the alpha value increases. (0 is transparent.) + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value becomes + * more opaque as the alpha value increases. (0 is transparent.) * For Overlays. */ -#define DDFXALPHACAPS_OVERLAYALPHAPIXELS 0x00000040l +#define DDFXALPHACAPS_OVERLAYALPHAPIXELS 0x00000040l /* - * Supports alpha information in the pixel format. The bit depth of alpha - * information in the pixel format can be 1,2,4, or 8. The alpha value - * becomes more transparent as the alpha value increases. (0 is opaque.) + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value + * becomes more transparent as the alpha value increases. (0 is opaque.) * This flag can only be set if DDCAPS_ALPHA is set. * For Overlays. */ -#define DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG 0x00000080l +#define DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG 0x00000080l /* - * Supports alpha only surfaces. The bit depth of an alpha only surface can be - * 1,2,4, or 8. The alpha value becomes more opaque as the alpha value increases. + * Supports alpha only surfaces. The bit depth of an alpha only surface can be + * 1,2,4, or 8. The alpha value becomes more opaque as the alpha value increases. * (0 is transparent.) * For Overlays. */ -#define DDFXALPHACAPS_OVERLAYALPHASURFACES 0x00000100l +#define DDFXALPHACAPS_OVERLAYALPHASURFACES 0x00000100l /* - * The depth of the alpha channel data can range can be 1,2,4, or 8. + * The depth of the alpha channel data can range can be 1,2,4, or 8. * The NEG suffix indicates that this alpha channel becomes more transparent - * as the alpha value increases. (0 is opaque.) This flag can only be set if + * as the alpha value increases. (0 is opaque.) This flag can only be set if * DDCAPS_ALPHA is set. * For Overlays. */ -#define DDFXALPHACAPS_OVERLAYALPHASURFACESNEG 0x00000200l +#define DDFXALPHACAPS_OVERLAYALPHASURFACESNEG 0x00000200l /**************************************************************************** * @@ -1311,146 +1311,146 @@ typedef struct _DDSURFACEDESC /* * Uses arithmetic operations to stretch and shrink surfaces during blt - * rather than pixel doubling techniques. Along the Y axis. + * rather than pixel doubling techniques. Along the Y axis. */ -#define DDFXCAPS_BLTARITHSTRETCHY 0x00000020l +#define DDFXCAPS_BLTARITHSTRETCHY 0x00000020l /* * Uses arithmetic operations to stretch during blt - * rather than pixel doubling techniques. Along the Y axis. Only + * rather than pixel doubling techniques. Along the Y axis. Only * works for x1, x2, etc. */ -#define DDFXCAPS_BLTARITHSTRETCHYN 0x00000010l +#define DDFXCAPS_BLTARITHSTRETCHYN 0x00000010l /* * Supports mirroring left to right in blt. */ -#define DDFXCAPS_BLTMIRRORLEFTRIGHT 0x00000040l +#define DDFXCAPS_BLTMIRRORLEFTRIGHT 0x00000040l /* * Supports mirroring top to bottom in blt. */ -#define DDFXCAPS_BLTMIRRORUPDOWN 0x00000080l +#define DDFXCAPS_BLTMIRRORUPDOWN 0x00000080l /* * Supports arbitrary rotation for blts. */ -#define DDFXCAPS_BLTROTATION 0x00000100l +#define DDFXCAPS_BLTROTATION 0x00000100l /* * Supports 90 degree rotations for blts. */ -#define DDFXCAPS_BLTROTATION90 0x00000200l +#define DDFXCAPS_BLTROTATION90 0x00000200l /* * DirectDraw supports arbitrary shrinking of a surface along the * x axis (horizontal direction) for blts. */ -#define DDFXCAPS_BLTSHRINKX 0x00000400l +#define DDFXCAPS_BLTSHRINKX 0x00000400l /* * DirectDraw supports integer shrinking (1x,2x,) of a surface * along the x axis (horizontal direction) for blts. */ -#define DDFXCAPS_BLTSHRINKXN 0x00000800l +#define DDFXCAPS_BLTSHRINKXN 0x00000800l /* * DirectDraw supports arbitrary shrinking of a surface along the - * y axis (horizontal direction) for blts. + * y axis (horizontal direction) for blts. */ -#define DDFXCAPS_BLTSHRINKY 0x00001000l +#define DDFXCAPS_BLTSHRINKY 0x00001000l /* * DirectDraw supports integer shrinking (1x,2x,) of a surface - * along the y axis (vertical direction) for blts. + * along the y axis (vertical direction) for blts. */ -#define DDFXCAPS_BLTSHRINKYN 0x00002000l +#define DDFXCAPS_BLTSHRINKYN 0x00002000l /* * DirectDraw supports arbitrary stretching of a surface along the * x axis (horizontal direction) for blts. */ -#define DDFXCAPS_BLTSTRETCHX 0x00004000l +#define DDFXCAPS_BLTSTRETCHX 0x00004000l /* * DirectDraw supports integer stretching (1x,2x,) of a surface * along the x axis (horizontal direction) for blts. */ -#define DDFXCAPS_BLTSTRETCHXN 0x00008000l +#define DDFXCAPS_BLTSTRETCHXN 0x00008000l /* * DirectDraw supports arbitrary stretching of a surface along the - * y axis (horizontal direction) for blts. + * y axis (horizontal direction) for blts. */ -#define DDFXCAPS_BLTSTRETCHY 0x00010000l +#define DDFXCAPS_BLTSTRETCHY 0x00010000l /* * DirectDraw supports integer stretching (1x,2x,) of a surface - * along the y axis (vertical direction) for blts. + * along the y axis (vertical direction) for blts. */ -#define DDFXCAPS_BLTSTRETCHYN 0x00020000l +#define DDFXCAPS_BLTSTRETCHYN 0x00020000l /* * Uses arithmetic operations to stretch and shrink surfaces during - * overlay rather than pixel doubling techniques. Along the Y axis + * overlay rather than pixel doubling techniques. Along the Y axis * for overlays. */ -#define DDFXCAPS_OVERLAYARITHSTRETCHY 0x00040000l +#define DDFXCAPS_OVERLAYARITHSTRETCHY 0x00040000l /* * Uses arithmetic operations to stretch surfaces during - * overlay rather than pixel doubling techniques. Along the Y axis + * overlay rather than pixel doubling techniques. Along the Y axis * for overlays. Only works for x1, x2, etc. */ -#define DDFXCAPS_OVERLAYARITHSTRETCHYN 0x00000008l +#define DDFXCAPS_OVERLAYARITHSTRETCHYN 0x00000008l /* * DirectDraw supports arbitrary shrinking of a surface along the * x axis (horizontal direction) for overlays. */ -#define DDFXCAPS_OVERLAYSHRINKX 0x00080000l +#define DDFXCAPS_OVERLAYSHRINKX 0x00080000l /* * DirectDraw supports integer shrinking (1x,2x,) of a surface * along the x axis (horizontal direction) for overlays. */ -#define DDFXCAPS_OVERLAYSHRINKXN 0x00100000l +#define DDFXCAPS_OVERLAYSHRINKXN 0x00100000l /* * DirectDraw supports arbitrary shrinking of a surface along the - * y axis (horizontal direction) for overlays. + * y axis (horizontal direction) for overlays. */ -#define DDFXCAPS_OVERLAYSHRINKY 0x00200000l +#define DDFXCAPS_OVERLAYSHRINKY 0x00200000l /* * DirectDraw supports integer shrinking (1x,2x,) of a surface - * along the y axis (vertical direction) for overlays. + * along the y axis (vertical direction) for overlays. */ -#define DDFXCAPS_OVERLAYSHRINKYN 0x00400000l +#define DDFXCAPS_OVERLAYSHRINKYN 0x00400000l /* * DirectDraw supports arbitrary stretching of a surface along the * x axis (horizontal direction) for overlays. */ -#define DDFXCAPS_OVERLAYSTRETCHX 0x00800000l +#define DDFXCAPS_OVERLAYSTRETCHX 0x00800000l /* * DirectDraw supports integer stretching (1x,2x,) of a surface * along the x axis (horizontal direction) for overlays. */ -#define DDFXCAPS_OVERLAYSTRETCHXN 0x01000000l +#define DDFXCAPS_OVERLAYSTRETCHXN 0x01000000l /* * DirectDraw supports arbitrary stretching of a surface along the - * y axis (horizontal direction) for overlays. + * y axis (horizontal direction) for overlays. */ -#define DDFXCAPS_OVERLAYSTRETCHY 0x02000000l +#define DDFXCAPS_OVERLAYSTRETCHY 0x02000000l /* * DirectDraw supports integer stretching (1x,2x,) of a surface - * along the y axis (vertical direction) for overlays. + * along the y axis (vertical direction) for overlays. */ -#define DDFXCAPS_OVERLAYSTRETCHYN 0x04000000l +#define DDFXCAPS_OVERLAYSTRETCHYN 0x04000000l /* * DirectDraw supports mirroring of overlays across the vertical axis @@ -1460,7 +1460,7 @@ typedef struct _DDSURFACEDESC /* * DirectDraw supports mirroring of overlays across the horizontal axis */ -#define DDFXCAPS_OVERLAYMIRRORUPDOWN 0x10000000l +#define DDFXCAPS_OVERLAYMIRRORUPDOWN 0x10000000l /**************************************************************************** * @@ -1471,24 +1471,24 @@ typedef struct _DDSURFACEDESC /* * The stereo view is accomplished via enigma encoding. */ -#define DDSVCAPS_ENIGMA 0x00000001l +#define DDSVCAPS_ENIGMA 0x00000001l /* * The stereo view is accomplished via high frequency flickering. */ -#define DDSVCAPS_FLICKER 0x00000002l +#define DDSVCAPS_FLICKER 0x00000002l /* * The stereo view is accomplished via red and blue filters applied - * to the left and right eyes. All images must adapt their colorspaces + * to the left and right eyes. All images must adapt their colorspaces * for this process. */ -#define DDSVCAPS_REDBLUE 0x00000004l +#define DDSVCAPS_REDBLUE 0x00000004l /* * The stereo view is accomplished with split screen technology. */ -#define DDSVCAPS_SPLIT 0x00000008l +#define DDSVCAPS_SPLIT 0x00000008l /**************************************************************************** * @@ -1497,64 +1497,64 @@ typedef struct _DDSURFACEDESC ****************************************************************************/ /* - * Index is 4 bits. There are sixteen color entries in the palette table. + * Index is 4 bits. There are sixteen color entries in the palette table. */ -#define DDPCAPS_4BIT 0x00000001l +#define DDPCAPS_4BIT 0x00000001l /* - * Index is onto a 8 bit color index. This field is only valid with the + * Index is onto a 8 bit color index. This field is only valid with the * DDPCAPS_1BIT, DDPCAPS_2BIT or DDPCAPS_4BIT capability and the target * surface is in 8bpp. Each color entry is one byte long and is an index * into destination surface's 8bpp palette. */ -#define DDPCAPS_8BITENTRIES 0x00000002l +#define DDPCAPS_8BITENTRIES 0x00000002l /* - * Index is 8 bits. There are 256 color entries in the palette table. + * Index is 8 bits. There are 256 color entries in the palette table. */ -#define DDPCAPS_8BIT 0x00000004l +#define DDPCAPS_8BIT 0x00000004l /* * Indicates that this DIRECTDRAWPALETTE should use the palette color array * passed into the lpDDColorArray parameter to initialize the DIRECTDRAWPALETTE * object. */ -#define DDPCAPS_INITIALIZE 0x00000008l +#define DDPCAPS_INITIALIZE 0x00000008l /* - * This palette is the one attached to the primary surface. Changing this + * This palette is the one attached to the primary surface. Changing this * table has immediate effect on the display unless DDPSETPAL_VSYNC is specified * and supported. */ -#define DDPCAPS_PRIMARYSURFACE 0x00000010l +#define DDPCAPS_PRIMARYSURFACE 0x00000010l /* - * This palette is the one attached to the primary surface left. Changing + * This palette is the one attached to the primary surface left. Changing * this table has immediate effect on the display for the left eye unless * DDPSETPAL_VSYNC is specified and supported. */ -#define DDPCAPS_PRIMARYSURFACELEFT 0x00000020l +#define DDPCAPS_PRIMARYSURFACELEFT 0x00000020l /* * This palette can have all 256 entries defined */ -#define DDPCAPS_ALLOW256 0x00000040l +#define DDPCAPS_ALLOW256 0x00000040l /* * This palette can have modifications to it synced with the monitors * refresh rate. */ -#define DDPCAPS_VSYNC 0x00000080l +#define DDPCAPS_VSYNC 0x00000080l /* - * Index is 1 bit. There are two color entries in the palette table. + * Index is 1 bit. There are two color entries in the palette table. */ -#define DDPCAPS_1BIT 0x00000100l +#define DDPCAPS_1BIT 0x00000100l /* - * Index is 2 bit. There are four color entries in the palette table. + * Index is 2 bit. There are four color entries in the palette table. */ -#define DDPCAPS_2BIT 0x00000200l +#define DDPCAPS_2BIT 0x00000200l /**************************************************************************** @@ -1583,8 +1583,8 @@ typedef struct _DDSURFACEDESC * * DIRECTDRAW BITDEPTH CONSTANTS * - * NOTE: These are only used to indicate supported bit depths. These - * are flags only, they are not to be used as an actual bit depth. The + * NOTE: These are only used to indicate supported bit depths. These + * are flags only, they are not to be used as an actual bit depth. The * absolute numbers 1, 2, 4, 8, 16, 24 and 32 are used to indicate actual * bit depths in a surface or for changing the display mode. * @@ -1593,37 +1593,37 @@ typedef struct _DDSURFACEDESC /* * 1 bit per pixel. */ -#define DDBD_1 0x00004000l +#define DDBD_1 0x00004000l /* * 2 bits per pixel. */ -#define DDBD_2 0x00002000l +#define DDBD_2 0x00002000l /* * 4 bits per pixel. */ -#define DDBD_4 0x00001000l +#define DDBD_4 0x00001000l /* * 8 bits per pixel. */ -#define DDBD_8 0x00000800l +#define DDBD_8 0x00000800l /* * 16 bits per pixel. */ -#define DDBD_16 0x00000400l +#define DDBD_16 0x00000400l /* * 24 bits per pixel. */ -#define DDBD_24 0X00000200l +#define DDBD_24 0X00000200l /* * 32 bits per pixel. */ -#define DDBD_32 0x00000100l +#define DDBD_32 0x00000100l /**************************************************************************** * @@ -1632,34 +1632,34 @@ typedef struct _DDSURFACEDESC ****************************************************************************/ /* - * Set if the structure contains a color space. Not set if the structure + * Set if the structure contains a color space. Not set if the structure * contains a single color key. */ -#define DDCKEY_COLORSPACE 0x00000001l +#define DDCKEY_COLORSPACE 0x00000001l /* * Set if the structure specifies a color key or color space which is to be * used as a destination color key for blt operations. */ -#define DDCKEY_DESTBLT 0x00000002l +#define DDCKEY_DESTBLT 0x00000002l /* * Set if the structure specifies a color key or color space which is to be * used as a destination color key for overlay operations. */ -#define DDCKEY_DESTOVERLAY 0x00000004l +#define DDCKEY_DESTOVERLAY 0x00000004l /* * Set if the structure specifies a color key or color space which is to be * used as a source color key for blt operations. */ -#define DDCKEY_SRCBLT 0x00000008l +#define DDCKEY_SRCBLT 0x00000008l /* * Set if the structure specifies a color key or color space which is to be * used as a source color key for overlay operations. */ -#define DDCKEY_SRCOVERLAY 0x00000010l +#define DDCKEY_SRCOVERLAY 0x00000010l /**************************************************************************** @@ -1672,112 +1672,112 @@ typedef struct _DDSURFACEDESC * Supports transparent blting using a color key to identify the replaceable * bits of the destination surface for RGB colors. */ -#define DDCKEYCAPS_DESTBLT 0x00000001l +#define DDCKEYCAPS_DESTBLT 0x00000001l /* * Supports transparent blting using a color space to identify the replaceable * bits of the destination surface for RGB colors. */ -#define DDCKEYCAPS_DESTBLTCLRSPACE 0x00000002l +#define DDCKEYCAPS_DESTBLTCLRSPACE 0x00000002l /* * Supports transparent blting using a color space to identify the replaceable * bits of the destination surface for YUV colors. */ -#define DDCKEYCAPS_DESTBLTCLRSPACEYUV 0x00000004l +#define DDCKEYCAPS_DESTBLTCLRSPACEYUV 0x00000004l /* * Supports transparent blting using a color key to identify the replaceable * bits of the destination surface for YUV colors. */ -#define DDCKEYCAPS_DESTBLTYUV 0x00000008l +#define DDCKEYCAPS_DESTBLTYUV 0x00000008l /* * Supports overlaying using colorkeying of the replaceable bits of the surface * being overlayed for RGB colors. */ -#define DDCKEYCAPS_DESTOVERLAY 0x00000010l +#define DDCKEYCAPS_DESTOVERLAY 0x00000010l /* * Supports a color space as the color key for the destination for RGB colors. */ -#define DDCKEYCAPS_DESTOVERLAYCLRSPACE 0x00000020l +#define DDCKEYCAPS_DESTOVERLAYCLRSPACE 0x00000020l /* * Supports a color space as the color key for the destination for YUV colors. */ -#define DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV 0x00000040l +#define DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV 0x00000040l /* * Supports only one active destination color key value for visible overlay * surfaces. */ -#define DDCKEYCAPS_DESTOVERLAYONEACTIVE 0x00000080l +#define DDCKEYCAPS_DESTOVERLAYONEACTIVE 0x00000080l /* * Supports overlaying using colorkeying of the replaceable bits of the * surface being overlayed for YUV colors. */ -#define DDCKEYCAPS_DESTOVERLAYYUV 0x00000100l +#define DDCKEYCAPS_DESTOVERLAYYUV 0x00000100l /* * Supports transparent blting using the color key for the source with * this surface for RGB colors. */ -#define DDCKEYCAPS_SRCBLT 0x00000200l +#define DDCKEYCAPS_SRCBLT 0x00000200l /* * Supports transparent blting using a color space for the source with * this surface for RGB colors. */ -#define DDCKEYCAPS_SRCBLTCLRSPACE 0x00000400l +#define DDCKEYCAPS_SRCBLTCLRSPACE 0x00000400l /* * Supports transparent blting using a color space for the source with * this surface for YUV colors. */ -#define DDCKEYCAPS_SRCBLTCLRSPACEYUV 0x00000800l +#define DDCKEYCAPS_SRCBLTCLRSPACEYUV 0x00000800l /* * Supports transparent blting using the color key for the source with * this surface for YUV colors. */ -#define DDCKEYCAPS_SRCBLTYUV 0x00001000l +#define DDCKEYCAPS_SRCBLTYUV 0x00001000l /* * Supports overlays using the color key for the source with this * overlay surface for RGB colors. */ -#define DDCKEYCAPS_SRCOVERLAY 0x00002000l +#define DDCKEYCAPS_SRCOVERLAY 0x00002000l /* * Supports overlays using a color space as the source color key for * the overlay surface for RGB colors. */ -#define DDCKEYCAPS_SRCOVERLAYCLRSPACE 0x00004000l +#define DDCKEYCAPS_SRCOVERLAYCLRSPACE 0x00004000l /* * Supports overlays using a color space as the source color key for * the overlay surface for YUV colors. */ -#define DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV 0x00008000l +#define DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV 0x00008000l /* * Supports only one active source color key value for visible * overlay surfaces. */ -#define DDCKEYCAPS_SRCOVERLAYONEACTIVE 0x00010000l +#define DDCKEYCAPS_SRCOVERLAYONEACTIVE 0x00010000l /* * Supports overlays using the color key for the source with this * overlay surface for YUV colors. */ -#define DDCKEYCAPS_SRCOVERLAYYUV 0x00020000l +#define DDCKEYCAPS_SRCOVERLAYYUV 0x00020000l /* * there are no bandwidth trade-offs for using colorkey with an overlay */ -#define DDCKEYCAPS_NOCOSTOVERLAY 0x00040000l +#define DDCKEYCAPS_NOCOSTOVERLAY 0x00040000l /**************************************************************************** @@ -1789,72 +1789,72 @@ typedef struct _DDSURFACEDESC /* * The surface has alpha channel information in the pixel format. */ -#define DDPF_ALPHAPIXELS 0x00000001l +#define DDPF_ALPHAPIXELS 0x00000001l /* * The pixel format contains alpha only information */ -#define DDPF_ALPHA 0x00000002l +#define DDPF_ALPHA 0x00000002l /* * The FourCC code is valid. */ -#define DDPF_FOURCC 0x00000004l +#define DDPF_FOURCC 0x00000004l /* * The surface is 4-bit color indexed. */ -#define DDPF_PALETTEINDEXED4 0x00000008l +#define DDPF_PALETTEINDEXED4 0x00000008l /* * The surface is indexed into a palette which stores indices * into the destination surface's 8-bit palette. */ -#define DDPF_PALETTEINDEXEDTO8 0x00000010l +#define DDPF_PALETTEINDEXEDTO8 0x00000010l /* * The surface is 8-bit color indexed. */ -#define DDPF_PALETTEINDEXED8 0x00000020l +#define DDPF_PALETTEINDEXED8 0x00000020l /* * The RGB data in the pixel format structure is valid. */ -#define DDPF_RGB 0x00000040l +#define DDPF_RGB 0x00000040l /* * The surface will accept pixel data in the format specified * and compress it during the write. */ -#define DDPF_COMPRESSED 0x00000080l +#define DDPF_COMPRESSED 0x00000080l /* * The surface will accept RGB data and translate it during - * the write to YUV data. The format of the data to be written - * will be contained in the pixel format structure. The DDPF_RGB + * the write to YUV data. The format of the data to be written + * will be contained in the pixel format structure. The DDPF_RGB * flag will be set. */ -#define DDPF_RGBTOYUV 0x00000100l +#define DDPF_RGBTOYUV 0x00000100l /* * pixel format is YUV - YUV data in pixel format struct is valid */ -#define DDPF_YUV 0x00000200l +#define DDPF_YUV 0x00000200l /* * pixel format is a z buffer only surface */ -#define DDPF_ZBUFFER 0x00000400l +#define DDPF_ZBUFFER 0x00000400l /* * The surface is 1-bit color indexed. */ -#define DDPF_PALETTEINDEXED1 0x00000800l +#define DDPF_PALETTEINDEXED1 0x00000800l /* * The surface is 2-bit color indexed. */ -#define DDPF_PALETTEINDEXED2 0x00001000l +#define DDPF_PALETTEINDEXED2 0x00001000l /*=========================================================================== * @@ -1873,27 +1873,27 @@ typedef struct _DDSURFACEDESC /* * Enumerate all of the surfaces that meet the search criterion. */ -#define DDENUMSURFACES_ALL 0x00000001l +#define DDENUMSURFACES_ALL 0x00000001l /* * A search hit is a surface that matches the surface description. */ -#define DDENUMSURFACES_MATCH 0x00000002l +#define DDENUMSURFACES_MATCH 0x00000002l /* * A search hit is a surface that does not match the surface description. */ -#define DDENUMSURFACES_NOMATCH 0x00000004l +#define DDENUMSURFACES_NOMATCH 0x00000004l /* * Enumerate the first surface that can be created which meets the search criterion. */ -#define DDENUMSURFACES_CANBECREATED 0x00000008l +#define DDENUMSURFACES_CANBECREATED 0x00000008l /* * Enumerate the surfaces that already exist that meet the search criterion. */ -#define DDENUMSURFACES_DOESEXIST 0x00000010l +#define DDENUMSURFACES_DOESEXIST 0x00000010l /**************************************************************************** @@ -1903,11 +1903,11 @@ typedef struct _DDSURFACEDESC ****************************************************************************/ /* - * Enumerate Modes with different refresh rates. EnumDisplayModes guarantees - * that a particular mode will be enumerated only once. This flag specifies whether + * Enumerate Modes with different refresh rates. EnumDisplayModes guarantees + * that a particular mode will be enumerated only once. This flag specifies whether * the refresh rate is taken into account when determining if a mode is unique. */ -#define DDEDM_REFRESHRATES 0x00000001l +#define DDEDM_REFRESHRATES 0x00000001l /**************************************************************************** @@ -1920,34 +1920,34 @@ typedef struct _DDSURFACEDESC * Exclusive mode owner will be responsible for the entire primary surface. * GDI can be ignored. used with DD */ -#define DDSCL_FULLSCREEN 0x00000001l +#define DDSCL_FULLSCREEN 0x00000001l /* * allow CTRL_ALT_DEL to work while in fullscreen exclusive mode */ -#define DDSCL_ALLOWREBOOT 0x00000002l +#define DDSCL_ALLOWREBOOT 0x00000002l /* * prevents DDRAW from modifying the application window. * prevents DDRAW from minimize/restore the application window on activation. */ -#define DDSCL_NOWINDOWCHANGES 0x00000004l +#define DDSCL_NOWINDOWCHANGES 0x00000004l /* * app wants to work as a regular Windows application */ -#define DDSCL_NORMAL 0x00000008l +#define DDSCL_NORMAL 0x00000008l /* * app wants exclusive access */ -#define DDSCL_EXCLUSIVE 0x00000010l +#define DDSCL_EXCLUSIVE 0x00000010l /* * app can deal with non-windows display modes */ -#define DDSCL_ALLOWMODEX 0x00000040l +#define DDSCL_ALLOWMODEX 0x00000040l /**************************************************************************** @@ -1960,161 +1960,161 @@ typedef struct _DDSURFACEDESC * Use the alpha information in the pixel format or the alpha channel surface * attached to the destination surface as the alpha channel for this blt. */ -#define DDBLT_ALPHADEST 0x00000001l +#define DDBLT_ALPHADEST 0x00000001l /* * Use the dwConstAlphaDest field in the DDBLTFX structure as the alpha channel * for the destination surface for this blt. */ -#define DDBLT_ALPHADESTCONSTOVERRIDE 0x00000002l +#define DDBLT_ALPHADESTCONSTOVERRIDE 0x00000002l /* * The NEG suffix indicates that the destination surface becomes more * transparent as the alpha value increases. (0 is opaque) */ -#define DDBLT_ALPHADESTNEG 0x00000004l +#define DDBLT_ALPHADESTNEG 0x00000004l /* * Use the lpDDSAlphaDest field in the DDBLTFX structure as the alpha * channel for the destination for this blt. */ -#define DDBLT_ALPHADESTSURFACEOVERRIDE 0x00000008l +#define DDBLT_ALPHADESTSURFACEOVERRIDE 0x00000008l /* * Use the dwAlphaEdgeBlend field in the DDBLTFX structure as the alpha channel * for the edges of the image that border the color key colors. */ -#define DDBLT_ALPHAEDGEBLEND 0x00000010l +#define DDBLT_ALPHAEDGEBLEND 0x00000010l /* * Use the alpha information in the pixel format or the alpha channel surface * attached to the source surface as the alpha channel for this blt. */ -#define DDBLT_ALPHASRC 0x00000020l +#define DDBLT_ALPHASRC 0x00000020l /* * Use the dwConstAlphaSrc field in the DDBLTFX structure as the alpha channel * for the source for this blt. */ -#define DDBLT_ALPHASRCCONSTOVERRIDE 0x00000040l +#define DDBLT_ALPHASRCCONSTOVERRIDE 0x00000040l /* * The NEG suffix indicates that the source surface becomes more transparent * as the alpha value increases. (0 is opaque) */ -#define DDBLT_ALPHASRCNEG 0x00000080l +#define DDBLT_ALPHASRCNEG 0x00000080l /* * Use the lpDDSAlphaSrc field in the DDBLTFX structure as the alpha channel * for the source for this blt. */ -#define DDBLT_ALPHASRCSURFACEOVERRIDE 0x00000100l +#define DDBLT_ALPHASRCSURFACEOVERRIDE 0x00000100l /* - * Do this blt asynchronously through the FIFO in the order received. If + * Do this blt asynchronously through the FIFO in the order received. If * there is no room in the hardware FIFO fail the call. */ -#define DDBLT_ASYNC 0x00000200l +#define DDBLT_ASYNC 0x00000200l /* * Uses the dwFillColor field in the DDBLTFX structure as the RGB color * to fill the destination rectangle on the destination surface with. */ -#define DDBLT_COLORFILL 0x00000400l +#define DDBLT_COLORFILL 0x00000400l /* * Uses the dwDDFX field in the DDBLTFX structure to specify the effects * to use for the blt. */ -#define DDBLT_DDFX 0x00000800l +#define DDBLT_DDFX 0x00000800l /* * Uses the dwDDROPS field in the DDBLTFX structure to specify the ROPS * that are not part of the Win32 API. */ -#define DDBLT_DDROPS 0x00001000l +#define DDBLT_DDROPS 0x00001000l /* * Use the color key associated with the destination surface. */ -#define DDBLT_KEYDEST 0x00002000l +#define DDBLT_KEYDEST 0x00002000l /* * Use the dckDestColorkey field in the DDBLTFX structure as the color key * for the destination surface. */ -#define DDBLT_KEYDESTOVERRIDE 0x00004000l +#define DDBLT_KEYDESTOVERRIDE 0x00004000l /* * Use the color key associated with the source surface. */ -#define DDBLT_KEYSRC 0x00008000l +#define DDBLT_KEYSRC 0x00008000l /* * Use the dckSrcColorkey field in the DDBLTFX structure as the color key * for the source surface. */ -#define DDBLT_KEYSRCOVERRIDE 0x00010000l +#define DDBLT_KEYSRCOVERRIDE 0x00010000l /* * Use the dwROP field in the DDBLTFX structure for the raster operation - * for this blt. These ROPs are the same as the ones defined in the Win32 API. + * for this blt. These ROPs are the same as the ones defined in the Win32 API. */ -#define DDBLT_ROP 0x00020000l +#define DDBLT_ROP 0x00020000l /* * Use the dwRotationAngle field in the DDBLTFX structure as the angle * (specified in 1/100th of a degree) to rotate the surface. */ -#define DDBLT_ROTATIONANGLE 0x00040000l +#define DDBLT_ROTATIONANGLE 0x00040000l /* * Z-buffered blt using the z-buffers attached to the source and destination * surfaces and the dwZBufferOpCode field in the DDBLTFX structure as the * z-buffer opcode. */ -#define DDBLT_ZBUFFER 0x00080000l +#define DDBLT_ZBUFFER 0x00080000l /* * Z-buffered blt using the dwConstDest Zfield and the dwZBufferOpCode field * in the DDBLTFX structure as the z-buffer and z-buffer opcode respectively * for the destination. */ -#define DDBLT_ZBUFFERDESTCONSTOVERRIDE 0x00100000l +#define DDBLT_ZBUFFERDESTCONSTOVERRIDE 0x00100000l /* * Z-buffered blt using the lpDDSDestZBuffer field and the dwZBufferOpCode * field in the DDBLTFX structure as the z-buffer and z-buffer opcode * respectively for the destination. */ -#define DDBLT_ZBUFFERDESTOVERRIDE 0x00200000l +#define DDBLT_ZBUFFERDESTOVERRIDE 0x00200000l /* * Z-buffered blt using the dwConstSrcZ field and the dwZBufferOpCode field * in the DDBLTFX structure as the z-buffer and z-buffer opcode respectively * for the source. */ -#define DDBLT_ZBUFFERSRCCONSTOVERRIDE 0x00400000l +#define DDBLT_ZBUFFERSRCCONSTOVERRIDE 0x00400000l /* * Z-buffered blt using the lpDDSSrcZBuffer field and the dwZBufferOpCode * field in the DDBLTFX structure as the z-buffer and z-buffer opcode * respectively for the source. */ -#define DDBLT_ZBUFFERSRCOVERRIDE 0x00800000l +#define DDBLT_ZBUFFERSRCOVERRIDE 0x00800000l /* * wait until the device is ready to handle the blt * this will cause blt to not return DDERR_WASSTILLDRAWING */ -#define DDBLT_WAIT 0x01000000l +#define DDBLT_WAIT 0x01000000l /* * Uses the dwFillDepth field in the DDBLTFX structure as the depth value * to fill the destination rectangle on the destination Z-buffer surface * with. */ -#define DDBLT_DEPTHFILL 0x02000000l +#define DDBLT_DEPTHFILL 0x02000000l /**************************************************************************** @@ -2123,10 +2123,10 @@ typedef struct _DDSURFACEDESC * ****************************************************************************/ -#define DDBLTFAST_NOCOLORKEY 0x00000000 -#define DDBLTFAST_SRCCOLORKEY 0x00000001 -#define DDBLTFAST_DESTCOLORKEY 0x00000002 -#define DDBLTFAST_WAIT 0x00000010 +#define DDBLTFAST_NOCOLORKEY 0x00000000 +#define DDBLTFAST_SRCCOLORKEY 0x00000001 +#define DDBLTFAST_DESTCOLORKEY 0x00000002 +#define DDBLTFAST_WAIT 0x00000010 /**************************************************************************** * @@ -2134,7 +2134,7 @@ typedef struct _DDSURFACEDESC * ****************************************************************************/ -#define DDFLIP_WAIT 0x00000001l +#define DDFLIP_WAIT 0x00000001l /**************************************************************************** @@ -2148,108 +2148,108 @@ typedef struct _DDSURFACEDESC * attached to the destination surface as the alpha channel for the * destination overlay. */ -#define DDOVER_ALPHADEST 0x00000001l +#define DDOVER_ALPHADEST 0x00000001l /* * Use the dwConstAlphaDest field in the DDOVERLAYFX structure as the * destination alpha channel for this overlay. */ -#define DDOVER_ALPHADESTCONSTOVERRIDE 0x00000002l +#define DDOVER_ALPHADESTCONSTOVERRIDE 0x00000002l /* * The NEG suffix indicates that the destination surface becomes more * transparent as the alpha value increases. */ -#define DDOVER_ALPHADESTNEG 0x00000004l +#define DDOVER_ALPHADESTNEG 0x00000004l /* * Use the lpDDSAlphaDest field in the DDOVERLAYFX structure as the alpha * channel destination for this overlay. */ -#define DDOVER_ALPHADESTSURFACEOVERRIDE 0x00000008l +#define DDOVER_ALPHADESTSURFACEOVERRIDE 0x00000008l /* * Use the dwAlphaEdgeBlend field in the DDOVERLAYFX structure as the alpha * channel for the edges of the image that border the color key colors. */ -#define DDOVER_ALPHAEDGEBLEND 0x00000010l +#define DDOVER_ALPHAEDGEBLEND 0x00000010l /* * Use the alpha information in the pixel format or the alpha channel surface * attached to the source surface as the source alpha channel for this overlay. */ -#define DDOVER_ALPHASRC 0x00000020l +#define DDOVER_ALPHASRC 0x00000020l /* * Use the dwConstAlphaSrc field in the DDOVERLAYFX structure as the source * alpha channel for this overlay. */ -#define DDOVER_ALPHASRCCONSTOVERRIDE 0x00000040l +#define DDOVER_ALPHASRCCONSTOVERRIDE 0x00000040l /* * The NEG suffix indicates that the source surface becomes more transparent * as the alpha value increases. */ -#define DDOVER_ALPHASRCNEG 0x00000080l +#define DDOVER_ALPHASRCNEG 0x00000080l /* * Use the lpDDSAlphaSrc field in the DDOVERLAYFX structure as the alpha channel * source for this overlay. */ -#define DDOVER_ALPHASRCSURFACEOVERRIDE 0x00000100l +#define DDOVER_ALPHASRCSURFACEOVERRIDE 0x00000100l /* * Turn this overlay off. */ -#define DDOVER_HIDE 0x00000200l +#define DDOVER_HIDE 0x00000200l /* * Use the color key associated with the destination surface. */ -#define DDOVER_KEYDEST 0x00000400l +#define DDOVER_KEYDEST 0x00000400l /* * Use the dckDestColorkey field in the DDOVERLAYFX structure as the color key * for the destination surface */ -#define DDOVER_KEYDESTOVERRIDE 0x00000800l +#define DDOVER_KEYDESTOVERRIDE 0x00000800l /* * Use the color key associated with the source surface. */ -#define DDOVER_KEYSRC 0x00001000l +#define DDOVER_KEYSRC 0x00001000l /* * Use the dckSrcColorkey field in the DDOVERLAYFX structure as the color key * for the source surface. */ -#define DDOVER_KEYSRCOVERRIDE 0x00002000l +#define DDOVER_KEYSRCOVERRIDE 0x00002000l /* * Turn this overlay on. */ -#define DDOVER_SHOW 0x00004000l +#define DDOVER_SHOW 0x00004000l /* * Add a dirty rect to an emulated overlayed surface. */ -#define DDOVER_ADDDIRTYRECT 0x00008000l +#define DDOVER_ADDDIRTYRECT 0x00008000l /* * Redraw all dirty rects on an emulated overlayed surface. */ -#define DDOVER_REFRESHDIRTYRECTS 0x00010000l +#define DDOVER_REFRESHDIRTYRECTS 0x00010000l /* * Redraw the entire surface on an emulated overlayed surface. */ -#define DDOVER_REFRESHALL 0x00020000l +#define DDOVER_REFRESHALL 0x00020000l /* * Use the overlay FX flags to define special overlay FX */ -#define DDOVER_DDFX 0x00080000l +#define DDOVER_DDFX 0x00080000l /**************************************************************************** @@ -2259,34 +2259,34 @@ typedef struct _DDSURFACEDESC ****************************************************************************/ /* - * The default. Set to indicate that Lock should return a valid memory pointer - * to the top of the specified rectangle. If no rectangle is specified then a + * The default. Set to indicate that Lock should return a valid memory pointer + * to the top of the specified rectangle. If no rectangle is specified then a * pointer to the top of the surface is returned. */ -#define DDLOCK_SURFACEMEMORYPTR 0x00000000L // default +#define DDLOCK_SURFACEMEMORYPTR 0x00000000L // default /* * Set to indicate that Lock should wait until it can obtain a valid memory - * pointer before returning. If this bit is set, Lock will never return + * pointer before returning. If this bit is set, Lock will never return * DDERR_WASSTILLDRAWING. */ -#define DDLOCK_WAIT 0x00000001L +#define DDLOCK_WAIT 0x00000001L /* - * Set if an event handle is being passed to Lock. Lock will trigger the event + * Set if an event handle is being passed to Lock. Lock will trigger the event * when it can return the surface memory pointer requested. */ -#define DDLOCK_EVENT 0x00000002L +#define DDLOCK_EVENT 0x00000002L /* * Indicates that the surface being locked will only be read from. */ -#define DDLOCK_READONLY 0x00000010L +#define DDLOCK_READONLY 0x00000010L /* * Indicates that the surface being locked will only be written to */ -#define DDLOCK_WRITEONLY 0x00000020L +#define DDLOCK_WRITEONLY 0x00000020L /**************************************************************************** @@ -2320,51 +2320,51 @@ typedef struct _DDSURFACEDESC /* * If stretching, use arithmetic stretching along the Y axis for this blt. */ -#define DDBLTFX_ARITHSTRETCHY 0x00000001l +#define DDBLTFX_ARITHSTRETCHY 0x00000001l /* - * Do this blt mirroring the surface left to right. Spin the + * Do this blt mirroring the surface left to right. Spin the * surface around its y-axis. */ -#define DDBLTFX_MIRRORLEFTRIGHT 0x00000002l +#define DDBLTFX_MIRRORLEFTRIGHT 0x00000002l /* - * Do this blt mirroring the surface up and down. Spin the surface + * Do this blt mirroring the surface up and down. Spin the surface * around its x-axis. */ -#define DDBLTFX_MIRRORUPDOWN 0x00000004l +#define DDBLTFX_MIRRORUPDOWN 0x00000004l /* * Schedule this blt to avoid tearing. */ -#define DDBLTFX_NOTEARING 0x00000008l +#define DDBLTFX_NOTEARING 0x00000008l /* * Do this blt rotating the surface one hundred and eighty degrees. */ -#define DDBLTFX_ROTATE180 0x00000010l +#define DDBLTFX_ROTATE180 0x00000010l /* * Do this blt rotating the surface two hundred and seventy degrees. */ -#define DDBLTFX_ROTATE270 0x00000020l +#define DDBLTFX_ROTATE270 0x00000020l /* * Do this blt rotating the surface ninety degrees. */ -#define DDBLTFX_ROTATE90 0x00000040l +#define DDBLTFX_ROTATE90 0x00000040l /* - * Do this z blt using dwZBufferLow and dwZBufferHigh as range values + * Do this z blt using dwZBufferLow and dwZBufferHigh as range values * specified to limit the bits copied from the source surface. */ -#define DDBLTFX_ZBUFFERRANGE 0x00000080l +#define DDBLTFX_ZBUFFERRANGE 0x00000080l /* * Do this z blt adding the dwZBufferBaseDest to each of the sources z values * before comparing it with the desting z values. */ -#define DDBLTFX_ZBUFFERBASEDEST 0x00000100l +#define DDBLTFX_ZBUFFERBASEDEST 0x00000100l /**************************************************************************** * @@ -2375,17 +2375,17 @@ typedef struct _DDSURFACEDESC /* * If stretching, use arithmetic stretching along the Y axis for this overlay. */ -#define DDOVERFX_ARITHSTRETCHY 0x00000001l +#define DDOVERFX_ARITHSTRETCHY 0x00000001l /* * Mirror the overlay across the vertical axis */ -#define DDOVERFX_MIRRORLEFTRIGHT 0x00000002l +#define DDOVERFX_MIRRORLEFTRIGHT 0x00000002l /* * Mirror the overlay across the horizontal axis */ -#define DDOVERFX_MIRRORUPDOWN 0x00000004l +#define DDOVERFX_MIRRORUPDOWN 0x00000004l /**************************************************************************** * @@ -2396,17 +2396,17 @@ typedef struct _DDSURFACEDESC /* * return when the vertical blank interval begins */ -#define DDWAITVB_BLOCKBEGIN 0x00000001l +#define DDWAITVB_BLOCKBEGIN 0x00000001l /* * set up an event to trigger when the vertical blank begins */ -#define DDWAITVB_BLOCKBEGINEVENT 0x00000002l +#define DDWAITVB_BLOCKBEGINEVENT 0x00000002l /* * return when the vertical blank interval ends and display begins */ -#define DDWAITVB_BLOCKEND 0x00000004l +#define DDWAITVB_BLOCKEND 0x00000004l /**************************************************************************** * @@ -2417,12 +2417,12 @@ typedef struct _DDSURFACEDESC /* * is it OK to flip now? */ -#define DDGFS_CANFLIP 0x00000001l +#define DDGFS_CANFLIP 0x00000001l /* * is the last flip finished? */ -#define DDGFS_ISFLIPDONE 0x00000002l +#define DDGFS_ISFLIPDONE 0x00000002l /**************************************************************************** * @@ -2433,12 +2433,12 @@ typedef struct _DDSURFACEDESC /* * is it OK to blt now? */ -#define DDGBS_CANBLT 0x00000001l +#define DDGBS_CANBLT 0x00000001l /* * is the blt to the surface finished? */ -#define DDGBS_ISBLTDONE 0x00000002l +#define DDGBS_ISBLTDONE 0x00000002l /**************************************************************************** @@ -2450,12 +2450,12 @@ typedef struct _DDSURFACEDESC /* * Enumerate overlays back to front. */ -#define DDENUMOVERLAYZ_BACKTOFRONT 0x00000000l +#define DDENUMOVERLAYZ_BACKTOFRONT 0x00000000l /* * Enumerate overlays front to back */ -#define DDENUMOVERLAYZ_FRONTTOBACK 0x00000001l +#define DDENUMOVERLAYZ_FRONTTOBACK 0x00000001l /**************************************************************************** * @@ -2466,32 +2466,32 @@ typedef struct _DDSURFACEDESC /* * Send overlay to front */ -#define DDOVERZ_SENDTOFRONT 0x00000000l +#define DDOVERZ_SENDTOFRONT 0x00000000l /* * Send overlay to back */ -#define DDOVERZ_SENDTOBACK 0x00000001l +#define DDOVERZ_SENDTOBACK 0x00000001l /* * Move Overlay forward */ -#define DDOVERZ_MOVEFORWARD 0x00000002l +#define DDOVERZ_MOVEFORWARD 0x00000002l /* * Move Overlay backward */ -#define DDOVERZ_MOVEBACKWARD 0x00000003l +#define DDOVERZ_MOVEBACKWARD 0x00000003l /* * Move Overlay in front of relative surface */ -#define DDOVERZ_INSERTINFRONTOF 0x00000004l +#define DDOVERZ_INSERTINFRONTOF 0x00000004l /* * Move Overlay in back of relative surface */ -#define DDOVERZ_INSERTINBACKOF 0x00000005l +#define DDOVERZ_INSERTINBACKOF 0x00000005l /*=========================================================================== * @@ -2509,14 +2509,14 @@ typedef struct _DDSURFACEDESC * * Issued by: DirectDraw Commands and all callbacks */ -#define DD_OK 0 +#define DD_OK 0 /**************************************************************************** * * DIRECTDRAW ENUMCALLBACK RETURN VALUES * * EnumCallback returns are used to control the flow of the DIRECTDRAW and - * DIRECTDRAWSURFACE object enumerations. They can only be returned by + * DIRECTDRAWSURFACE object enumerations. They can only be returned by * enumeration callback routines. * ****************************************************************************/ @@ -2524,12 +2524,12 @@ typedef struct _DDSURFACEDESC /* * stop the enumeration */ -#define DDENUMRET_CANCEL 0 +#define DDENUMRET_CANCEL 0 /* * continue the enumeration */ -#define DDENUMRET_OK 1 +#define DDENUMRET_OK 1 /**************************************************************************** * @@ -2542,276 +2542,276 @@ typedef struct _DDSURFACEDESC /* * This object is already initialized */ -#define DDERR_ALREADYINITIALIZED MAKE_DDHRESULT( 5 ) +#define DDERR_ALREADYINITIALIZED MAKE_DDHRESULT( 5 ) /* * This surface can not be attached to the requested surface. */ -#define DDERR_CANNOTATTACHSURFACE MAKE_DDHRESULT( 10 ) +#define DDERR_CANNOTATTACHSURFACE MAKE_DDHRESULT( 10 ) /* * This surface can not be detached from the requested surface. */ -#define DDERR_CANNOTDETACHSURFACE MAKE_DDHRESULT( 20 ) +#define DDERR_CANNOTDETACHSURFACE MAKE_DDHRESULT( 20 ) /* * Support is currently not available. */ -#define DDERR_CURRENTLYNOTAVAIL MAKE_DDHRESULT( 40 ) +#define DDERR_CURRENTLYNOTAVAIL MAKE_DDHRESULT( 40 ) /* * An exception was encountered while performing the requested operation */ -#define DDERR_EXCEPTION MAKE_DDHRESULT( 55 ) +#define DDERR_EXCEPTION MAKE_DDHRESULT( 55 ) /* * Generic failure. */ -#define DDERR_GENERIC E_FAIL +#define DDERR_GENERIC E_FAIL /* * Height of rectangle provided is not a multiple of reqd alignment */ -#define DDERR_HEIGHTALIGN MAKE_DDHRESULT( 90 ) +#define DDERR_HEIGHTALIGN MAKE_DDHRESULT( 90 ) /* * Unable to match primary surface creation request with existing * primary surface. */ -#define DDERR_INCOMPATIBLEPRIMARY MAKE_DDHRESULT( 95 ) +#define DDERR_INCOMPATIBLEPRIMARY MAKE_DDHRESULT( 95 ) /* * One or more of the caps bits passed to the callback are incorrect. */ -#define DDERR_INVALIDCAPS MAKE_DDHRESULT( 100 ) +#define DDERR_INVALIDCAPS MAKE_DDHRESULT( 100 ) /* * DirectDraw does not support provided Cliplist. */ -#define DDERR_INVALIDCLIPLIST MAKE_DDHRESULT( 110 ) +#define DDERR_INVALIDCLIPLIST MAKE_DDHRESULT( 110 ) /* * DirectDraw does not support the requested mode */ -#define DDERR_INVALIDMODE MAKE_DDHRESULT( 120 ) +#define DDERR_INVALIDMODE MAKE_DDHRESULT( 120 ) /* * DirectDraw received a pointer that was an invalid DIRECTDRAW object. */ -#define DDERR_INVALIDOBJECT MAKE_DDHRESULT( 130 ) +#define DDERR_INVALIDOBJECT MAKE_DDHRESULT( 130 ) /* * One or more of the parameters passed to the callback function are * incorrect. */ -#define DDERR_INVALIDPARAMS E_INVALIDARG +#define DDERR_INVALIDPARAMS E_INVALIDARG /* * pixel format was invalid as specified */ -#define DDERR_INVALIDPIXELFORMAT MAKE_DDHRESULT( 145 ) +#define DDERR_INVALIDPIXELFORMAT MAKE_DDHRESULT( 145 ) /* * Rectangle provided was invalid. */ -#define DDERR_INVALIDRECT MAKE_DDHRESULT( 150 ) +#define DDERR_INVALIDRECT MAKE_DDHRESULT( 150 ) /* * Operation could not be carried out because one or more surfaces are locked */ -#define DDERR_LOCKEDSURFACES MAKE_DDHRESULT( 160 ) +#define DDERR_LOCKEDSURFACES MAKE_DDHRESULT( 160 ) /* * There is no 3D present. */ -#define DDERR_NO3D MAKE_DDHRESULT( 170 ) +#define DDERR_NO3D MAKE_DDHRESULT( 170 ) /* * Operation could not be carried out because there is no alpha accleration * hardware present or available. */ -#define DDERR_NOALPHAHW MAKE_DDHRESULT( 180 ) +#define DDERR_NOALPHAHW MAKE_DDHRESULT( 180 ) /* * no clip list available */ -#define DDERR_NOCLIPLIST MAKE_DDHRESULT( 205 ) +#define DDERR_NOCLIPLIST MAKE_DDHRESULT( 205 ) /* * Operation could not be carried out because there is no color conversion * hardware present or available. */ -#define DDERR_NOCOLORCONVHW MAKE_DDHRESULT( 210 ) +#define DDERR_NOCOLORCONVHW MAKE_DDHRESULT( 210 ) /* * Create function called without DirectDraw object method SetCooperativeLevel * being called. */ -#define DDERR_NOCOOPERATIVELEVELSET MAKE_DDHRESULT( 212 ) +#define DDERR_NOCOOPERATIVELEVELSET MAKE_DDHRESULT( 212 ) /* * Surface doesn't currently have a color key */ -#define DDERR_NOCOLORKEY MAKE_DDHRESULT( 215 ) +#define DDERR_NOCOLORKEY MAKE_DDHRESULT( 215 ) /* * Operation could not be carried out because there is no hardware support * of the dest color key. */ -#define DDERR_NOCOLORKEYHW MAKE_DDHRESULT( 220 ) +#define DDERR_NOCOLORKEYHW MAKE_DDHRESULT( 220 ) /* * No DirectDraw support possible with current display driver */ -#define DDERR_NODIRECTDRAWSUPPORT MAKE_DDHRESULT( 222 ) +#define DDERR_NODIRECTDRAWSUPPORT MAKE_DDHRESULT( 222 ) /* * Operation requires the application to have exclusive mode but the * application does not have exclusive mode. */ -#define DDERR_NOEXCLUSIVEMODE MAKE_DDHRESULT( 225 ) +#define DDERR_NOEXCLUSIVEMODE MAKE_DDHRESULT( 225 ) /* * Flipping visible surfaces is not supported. */ -#define DDERR_NOFLIPHW MAKE_DDHRESULT( 230 ) +#define DDERR_NOFLIPHW MAKE_DDHRESULT( 230 ) /* * There is no GDI present. */ -#define DDERR_NOGDI MAKE_DDHRESULT( 240 ) +#define DDERR_NOGDI MAKE_DDHRESULT( 240 ) /* * Operation could not be carried out because there is no hardware present * or available. */ -#define DDERR_NOMIRRORHW MAKE_DDHRESULT( 250 ) +#define DDERR_NOMIRRORHW MAKE_DDHRESULT( 250 ) /* * Requested item was not found */ -#define DDERR_NOTFOUND MAKE_DDHRESULT( 255 ) +#define DDERR_NOTFOUND MAKE_DDHRESULT( 255 ) /* * Operation could not be carried out because there is no overlay hardware * present or available. */ -#define DDERR_NOOVERLAYHW MAKE_DDHRESULT( 260 ) +#define DDERR_NOOVERLAYHW MAKE_DDHRESULT( 260 ) /* * Operation could not be carried out because there is no appropriate raster * op hardware present or available. */ -#define DDERR_NORASTEROPHW MAKE_DDHRESULT( 280 ) +#define DDERR_NORASTEROPHW MAKE_DDHRESULT( 280 ) /* * Operation could not be carried out because there is no rotation hardware * present or available. */ -#define DDERR_NOROTATIONHW MAKE_DDHRESULT( 290 ) +#define DDERR_NOROTATIONHW MAKE_DDHRESULT( 290 ) /* * Operation could not be carried out because there is no hardware support * for stretching */ -#define DDERR_NOSTRETCHHW MAKE_DDHRESULT( 310 ) +#define DDERR_NOSTRETCHHW MAKE_DDHRESULT( 310 ) /* * DirectDrawSurface is not in 4 bit color palette and the requested operation * requires 4 bit color palette. */ -#define DDERR_NOT4BITCOLOR MAKE_DDHRESULT( 316 ) +#define DDERR_NOT4BITCOLOR MAKE_DDHRESULT( 316 ) /* * DirectDrawSurface is not in 4 bit color index palette and the requested * operation requires 4 bit color index palette. */ -#define DDERR_NOT4BITCOLORINDEX MAKE_DDHRESULT( 317 ) +#define DDERR_NOT4BITCOLORINDEX MAKE_DDHRESULT( 317 ) /* * DirectDraw Surface is not in 8 bit color mode and the requested operation * requires 8 bit color. */ -#define DDERR_NOT8BITCOLOR MAKE_DDHRESULT( 320 ) +#define DDERR_NOT8BITCOLOR MAKE_DDHRESULT( 320 ) /* * Operation could not be carried out because there is no texture mapping * hardware present or available. */ -#define DDERR_NOTEXTUREHW MAKE_DDHRESULT( 330 ) +#define DDERR_NOTEXTUREHW MAKE_DDHRESULT( 330 ) /* * Operation could not be carried out because there is no hardware support * for vertical blank synchronized operations. */ -#define DDERR_NOVSYNCHW MAKE_DDHRESULT( 335 ) +#define DDERR_NOVSYNCHW MAKE_DDHRESULT( 335 ) /* * Operation could not be carried out because there is no hardware support * for zbuffer blting. */ -#define DDERR_NOZBUFFERHW MAKE_DDHRESULT( 340 ) +#define DDERR_NOZBUFFERHW MAKE_DDHRESULT( 340 ) /* * Overlay surfaces could not be z layered based on their BltOrder because * the hardware does not support z layering of overlays. */ -#define DDERR_NOZOVERLAYHW MAKE_DDHRESULT( 350 ) +#define DDERR_NOZOVERLAYHW MAKE_DDHRESULT( 350 ) /* * The hardware needed for the requested operation has already been * allocated. */ -#define DDERR_OUTOFCAPS MAKE_DDHRESULT( 360 ) +#define DDERR_OUTOFCAPS MAKE_DDHRESULT( 360 ) /* * DirectDraw does not have enough memory to perform the operation. */ -#define DDERR_OUTOFMEMORY E_OUTOFMEMORY +#define DDERR_OUTOFMEMORY E_OUTOFMEMORY /* * DirectDraw does not have enough memory to perform the operation. */ -#define DDERR_OUTOFVIDEOMEMORY MAKE_DDHRESULT( 380 ) +#define DDERR_OUTOFVIDEOMEMORY MAKE_DDHRESULT( 380 ) /* * hardware does not support clipped overlays */ -#define DDERR_OVERLAYCANTCLIP MAKE_DDHRESULT( 382 ) +#define DDERR_OVERLAYCANTCLIP MAKE_DDHRESULT( 382 ) /* * Can only have ony color key active at one time for overlays */ -#define DDERR_OVERLAYCOLORKEYONLYONEACTIVE MAKE_DDHRESULT( 384 ) +#define DDERR_OVERLAYCOLORKEYONLYONEACTIVE MAKE_DDHRESULT( 384 ) /* * Access to this palette is being refused because the palette is already * locked by another thread. */ -#define DDERR_PALETTEBUSY MAKE_DDHRESULT( 387 ) +#define DDERR_PALETTEBUSY MAKE_DDHRESULT( 387 ) /* * No src color key specified for this operation. */ -#define DDERR_COLORKEYNOTSET MAKE_DDHRESULT( 400 ) +#define DDERR_COLORKEYNOTSET MAKE_DDHRESULT( 400 ) /* * This surface is already attached to the surface it is being attached to. */ -#define DDERR_SURFACEALREADYATTACHED MAKE_DDHRESULT( 410 ) +#define DDERR_SURFACEALREADYATTACHED MAKE_DDHRESULT( 410 ) /* * This surface is already a dependency of the surface it is being made a * dependency of. */ -#define DDERR_SURFACEALREADYDEPENDENT MAKE_DDHRESULT( 420 ) +#define DDERR_SURFACEALREADYDEPENDENT MAKE_DDHRESULT( 420 ) /* * Access to this surface is being refused because the surface is already * locked by another thread. */ -#define DDERR_SURFACEBUSY MAKE_DDHRESULT( 430 ) +#define DDERR_SURFACEBUSY MAKE_DDHRESULT( 430 ) /* * Access to this surface is being refused because no driver exists @@ -2819,249 +2819,249 @@ typedef struct _DDSURFACEDESC * This is most likely to happen when attempting to lock the primary * surface when no DCI provider is present. */ -#define DDERR_CANTLOCKSURFACE MAKE_DDHRESULT( 435 ) +#define DDERR_CANTLOCKSURFACE MAKE_DDHRESULT( 435 ) /* * Access to Surface refused because Surface is obscured. */ -#define DDERR_SURFACEISOBSCURED MAKE_DDHRESULT( 440 ) +#define DDERR_SURFACEISOBSCURED MAKE_DDHRESULT( 440 ) /* * Access to this surface is being refused because the surface is gone. * The DIRECTDRAWSURFACE object representing this surface should * have Restore called on it. */ -#define DDERR_SURFACELOST MAKE_DDHRESULT( 450 ) +#define DDERR_SURFACELOST MAKE_DDHRESULT( 450 ) /* * The requested surface is not attached. */ -#define DDERR_SURFACENOTATTACHED MAKE_DDHRESULT( 460 ) +#define DDERR_SURFACENOTATTACHED MAKE_DDHRESULT( 460 ) /* * Height requested by DirectDraw is too large. */ -#define DDERR_TOOBIGHEIGHT MAKE_DDHRESULT( 470 ) +#define DDERR_TOOBIGHEIGHT MAKE_DDHRESULT( 470 ) /* - * Size requested by DirectDraw is too large -- The individual height and + * Size requested by DirectDraw is too large -- The individual height and * width are OK. */ -#define DDERR_TOOBIGSIZE MAKE_DDHRESULT( 480 ) +#define DDERR_TOOBIGSIZE MAKE_DDHRESULT( 480 ) /* * Width requested by DirectDraw is too large. */ -#define DDERR_TOOBIGWIDTH MAKE_DDHRESULT( 490 ) +#define DDERR_TOOBIGWIDTH MAKE_DDHRESULT( 490 ) /* * Action not supported. */ -#define DDERR_UNSUPPORTED E_NOTIMPL +#define DDERR_UNSUPPORTED E_NOTIMPL /* * FOURCC format requested is unsupported by DirectDraw */ -#define DDERR_UNSUPPORTEDFORMAT MAKE_DDHRESULT( 510 ) +#define DDERR_UNSUPPORTEDFORMAT MAKE_DDHRESULT( 510 ) /* * Bitmask in the pixel format requested is unsupported by DirectDraw */ -#define DDERR_UNSUPPORTEDMASK MAKE_DDHRESULT( 520 ) +#define DDERR_UNSUPPORTEDMASK MAKE_DDHRESULT( 520 ) /* * vertical blank is in progress */ -#define DDERR_VERTICALBLANKINPROGRESS MAKE_DDHRESULT( 537 ) +#define DDERR_VERTICALBLANKINPROGRESS MAKE_DDHRESULT( 537 ) /* * Informs DirectDraw that the previous Blt which is transfering information * to or from this Surface is incomplete. */ -#define DDERR_WASSTILLDRAWING MAKE_DDHRESULT( 540 ) +#define DDERR_WASSTILLDRAWING MAKE_DDHRESULT( 540 ) /* * Rectangle provided was not horizontally aligned on reqd. boundary */ -#define DDERR_XALIGN MAKE_DDHRESULT( 560 ) +#define DDERR_XALIGN MAKE_DDHRESULT( 560 ) /* * The GUID passed to DirectDrawCreate is not a valid DirectDraw driver * identifier. */ -#define DDERR_INVALIDDIRECTDRAWGUID MAKE_DDHRESULT( 561 ) +#define DDERR_INVALIDDIRECTDRAWGUID MAKE_DDHRESULT( 561 ) /* * A DirectDraw object representing this driver has already been created * for this process. */ -#define DDERR_DIRECTDRAWALREADYCREATED MAKE_DDHRESULT( 562 ) +#define DDERR_DIRECTDRAWALREADYCREATED MAKE_DDHRESULT( 562 ) /* * A hardware only DirectDraw object creation was attempted but the driver * did not support any hardware. */ -#define DDERR_NODIRECTDRAWHW MAKE_DDHRESULT( 563 ) +#define DDERR_NODIRECTDRAWHW MAKE_DDHRESULT( 563 ) /* * this process already has created a primary surface */ -#define DDERR_PRIMARYSURFACEALREADYEXISTS MAKE_DDHRESULT( 564 ) +#define DDERR_PRIMARYSURFACEALREADYEXISTS MAKE_DDHRESULT( 564 ) /* * software emulation not available. */ -#define DDERR_NOEMULATION MAKE_DDHRESULT( 565 ) +#define DDERR_NOEMULATION MAKE_DDHRESULT( 565 ) /* * region passed to Clipper::GetClipList is too small. */ -#define DDERR_REGIONTOOSMALL MAKE_DDHRESULT( 566 ) +#define DDERR_REGIONTOOSMALL MAKE_DDHRESULT( 566 ) /* * an attempt was made to set a clip list for a clipper objec that * is already monitoring an hwnd. */ -#define DDERR_CLIPPERISUSINGHWND MAKE_DDHRESULT( 567 ) +#define DDERR_CLIPPERISUSINGHWND MAKE_DDHRESULT( 567 ) /* * No clipper object attached to surface object */ -#define DDERR_NOCLIPPERATTACHED MAKE_DDHRESULT( 568 ) +#define DDERR_NOCLIPPERATTACHED MAKE_DDHRESULT( 568 ) /* * Clipper notification requires an HWND or * no HWND has previously been set as the CooperativeLevel HWND. */ -#define DDERR_NOHWND MAKE_DDHRESULT( 569 ) +#define DDERR_NOHWND MAKE_DDHRESULT( 569 ) /* * HWND used by DirectDraw CooperativeLevel has been subclassed, * this prevents DirectDraw from restoring state. */ -#define DDERR_HWNDSUBCLASSED MAKE_DDHRESULT( 570 ) +#define DDERR_HWNDSUBCLASSED MAKE_DDHRESULT( 570 ) /* * The CooperativeLevel HWND has already been set. * It can not be reset while the process has surfaces or palettes created. */ -#define DDERR_HWNDALREADYSET MAKE_DDHRESULT( 571 ) +#define DDERR_HWNDALREADYSET MAKE_DDHRESULT( 571 ) /* * No palette object attached to this surface. */ -#define DDERR_NOPALETTEATTACHED MAKE_DDHRESULT( 572 ) +#define DDERR_NOPALETTEATTACHED MAKE_DDHRESULT( 572 ) /* * No hardware support for 16 or 256 color palettes. */ -#define DDERR_NOPALETTEHW MAKE_DDHRESULT( 573 ) +#define DDERR_NOPALETTEHW MAKE_DDHRESULT( 573 ) /* * If a clipper object is attached to the source surface passed into a * BltFast call. */ -#define DDERR_BLTFASTCANTCLIP MAKE_DDHRESULT( 574 ) +#define DDERR_BLTFASTCANTCLIP MAKE_DDHRESULT( 574 ) /* * No blter. */ -#define DDERR_NOBLTHW MAKE_DDHRESULT( 575 ) +#define DDERR_NOBLTHW MAKE_DDHRESULT( 575 ) /* * No DirectDraw ROP hardware. */ -#define DDERR_NODDROPSHW MAKE_DDHRESULT( 576 ) +#define DDERR_NODDROPSHW MAKE_DDHRESULT( 576 ) /* * returned when GetOverlayPosition is called on a hidden overlay */ -#define DDERR_OVERLAYNOTVISIBLE MAKE_DDHRESULT( 577 ) +#define DDERR_OVERLAYNOTVISIBLE MAKE_DDHRESULT( 577 ) /* * returned when GetOverlayPosition is called on a overlay that UpdateOverlay * has never been called on to establish a destionation. */ -#define DDERR_NOOVERLAYDEST MAKE_DDHRESULT( 578 ) +#define DDERR_NOOVERLAYDEST MAKE_DDHRESULT( 578 ) /* * returned when the position of the overlay on the destionation is no longer * legal for that destionation. */ -#define DDERR_INVALIDPOSITION MAKE_DDHRESULT( 579 ) +#define DDERR_INVALIDPOSITION MAKE_DDHRESULT( 579 ) /* * returned when an overlay member is called for a non-overlay surface */ -#define DDERR_NOTAOVERLAYSURFACE MAKE_DDHRESULT( 580 ) +#define DDERR_NOTAOVERLAYSURFACE MAKE_DDHRESULT( 580 ) /* * An attempt was made to set the cooperative level when it was already * set to exclusive. */ -#define DDERR_EXCLUSIVEMODEALREADYSET MAKE_DDHRESULT( 581 ) +#define DDERR_EXCLUSIVEMODEALREADYSET MAKE_DDHRESULT( 581 ) /* * An attempt has been made to flip a surface that is not flippable. */ -#define DDERR_NOTFLIPPABLE MAKE_DDHRESULT( 582 ) +#define DDERR_NOTFLIPPABLE MAKE_DDHRESULT( 582 ) /* * Can't duplicate primary & 3D surfaces, or surfaces that are implicitly * created. */ -#define DDERR_CANTDUPLICATE MAKE_DDHRESULT( 583 ) +#define DDERR_CANTDUPLICATE MAKE_DDHRESULT( 583 ) /* - * Surface was not locked. An attempt to unlock a surface that was not + * Surface was not locked. An attempt to unlock a surface that was not * locked at all, or by this process, has been attempted. */ -#define DDERR_NOTLOCKED MAKE_DDHRESULT( 584 ) +#define DDERR_NOTLOCKED MAKE_DDHRESULT( 584 ) /* * Windows can not create any more DCs */ -#define DDERR_CANTCREATEDC MAKE_DDHRESULT( 585 ) +#define DDERR_CANTCREATEDC MAKE_DDHRESULT( 585 ) /* * No DC was ever created for this surface. */ -#define DDERR_NODC MAKE_DDHRESULT( 586 ) +#define DDERR_NODC MAKE_DDHRESULT( 586 ) /* * This surface can not be restored because it was created in a different * mode. */ -#define DDERR_WRONGMODE MAKE_DDHRESULT( 587 ) +#define DDERR_WRONGMODE MAKE_DDHRESULT( 587 ) /* * This surface can not be restored because it is an implicitly created * surface. */ -#define DDERR_IMPLICITLYCREATED MAKE_DDHRESULT( 588 ) +#define DDERR_IMPLICITLYCREATED MAKE_DDHRESULT( 588 ) /* * The surface being used is not a palette-based surface */ -#define DDERR_NOTPALETTIZED MAKE_DDHRESULT( 589 ) +#define DDERR_NOTPALETTIZED MAKE_DDHRESULT( 589 ) /* * The display is currently in an unsupported mode */ -#define DDERR_UNSUPPORTEDMODE MAKE_DDHRESULT( 590 ) +#define DDERR_UNSUPPORTEDMODE MAKE_DDHRESULT( 590 ) /* * Operation could not be carried out because there is no mip-map * texture mapping hardware present or available. */ -#define DDERR_NOMIPMAPHW MAKE_DDHRESULT( 591 ) +#define DDERR_NOMIPMAPHW MAKE_DDHRESULT( 591 ) /* * The requested action could not be performed because the surface was of * the wrong type. */ -#define DDERR_INVALIDSURFACETYPE MAKE_DDHRESULT( 592 ) +#define DDERR_INVALIDSURFACETYPE MAKE_DDHRESULT( 592 ) @@ -3069,28 +3069,28 @@ typedef struct _DDSURFACEDESC * A DC has already been returned for this surface. Only one DC can be * retrieved per surface. */ -#define DDERR_DCALREADYCREATED MAKE_DDHRESULT( 620 ) +#define DDERR_DCALREADYCREATED MAKE_DDHRESULT( 620 ) /* * The attempt to page lock a surface failed. */ -#define DDERR_CANTPAGELOCK MAKE_DDHRESULT( 640 ) +#define DDERR_CANTPAGELOCK MAKE_DDHRESULT( 640 ) /* * The attempt to page unlock a surface failed. */ -#define DDERR_CANTPAGEUNLOCK MAKE_DDHRESULT( 660 ) +#define DDERR_CANTPAGEUNLOCK MAKE_DDHRESULT( 660 ) /* * An attempt was made to page unlock a surface with no outstanding page locks. */ -#define DDERR_NOTPAGELOCKED MAKE_DDHRESULT( 680 ) +#define DDERR_NOTPAGELOCKED MAKE_DDHRESULT( 680 ) /* * An attempt was made to invoke an interface member of a DirectDraw object * created by CoCreateInstance() before it was initialized. */ -#define DDERR_NOTINITIALIZED CO_E_NOTINITIALIZED +#define DDERR_NOTINITIALIZED CO_E_NOTINITIALIZED /* Alpha bit depth constants */ diff --git a/Standard Gaming Platform/dsound.h b/Standard Gaming Platform/dsound.h index 11a243ef..eff45bca 100644 --- a/Standard Gaming Platform/dsound.h +++ b/Standard Gaming Platform/dsound.h @@ -1,9 +1,9 @@ /*==========================================================================; * - * Copyright (C) 1995,1996 Microsoft Corporation. All Rights Reserved. + * Copyright (C) 1995,1996 Microsoft Corporation. All Rights Reserved. * - * File: dsound.h - * Content: DirectSound include file + * File: dsound.h + * Content: DirectSound include file * ***************************************************************************/ @@ -15,14 +15,14 @@ #include #endif -#define _FACDS 0x878 -#define MAKE_DSHRESULT( code ) MAKE_HRESULT( 1, _FACDS, code ) +#define _FACDS 0x878 +#define MAKE_DSHRESULT( code ) MAKE_HRESULT( 1, _FACDS, code ) #ifdef __cplusplus extern "C" { #endif -// Direct Sound Component GUID {47D4D946-62E8-11cf-93BC-444553540000} +// Direct Sound Component GUID {47D4D946-62E8-11cf-93BC-444553540000} DEFINE_GUID(CLSID_DirectSound, 0x47d4d946, 0x62e8, 0x11cf, 0x93, 0xbc, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0); @@ -35,7 +35,7 @@ DEFINE_GUID(IID_IDirectSoundBuffer,0x279AFA85,0x4981,0x11CE,0xA5,0x21,0x00,0x20, //==========================================================================; // -// Structures... +// Structures... // //==========================================================================; #ifdef __cplusplus @@ -44,56 +44,56 @@ struct IDirectSound; struct IDirectSoundBuffer; #endif -typedef struct IDirectSound *LPDIRECTSOUND; -typedef struct IDirectSoundBuffer *LPDIRECTSOUNDBUFFER; -typedef struct IDirectSoundBuffer **LPLPDIRECTSOUNDBUFFER; +typedef struct IDirectSound *LPDIRECTSOUND; +typedef struct IDirectSoundBuffer *LPDIRECTSOUNDBUFFER; +typedef struct IDirectSoundBuffer **LPLPDIRECTSOUNDBUFFER; typedef struct _DSCAPS { - DWORD dwSize; - DWORD dwFlags; - DWORD dwMinSecondarySampleRate; - DWORD dwMaxSecondarySampleRate; - DWORD dwPrimaryBuffers; - DWORD dwMaxHwMixingAllBuffers; - DWORD dwMaxHwMixingStaticBuffers; - DWORD dwMaxHwMixingStreamingBuffers; - DWORD dwFreeHwMixingAllBuffers; - DWORD dwFreeHwMixingStaticBuffers; - DWORD dwFreeHwMixingStreamingBuffers; - DWORD dwMaxHw3DAllBuffers; - DWORD dwMaxHw3DStaticBuffers; - DWORD dwMaxHw3DStreamingBuffers; - DWORD dwFreeHw3DAllBuffers; - DWORD dwFreeHw3DStaticBuffers; - DWORD dwFreeHw3DStreamingBuffers; - DWORD dwTotalHwMemBytes; - DWORD dwFreeHwMemBytes; - DWORD dwMaxContigFreeHwMemBytes; - DWORD dwUnlockTransferRateHwBuffers; - DWORD dwPlayCpuOverheadSwBuffers; - DWORD dwReserved1; - DWORD dwReserved2; + DWORD dwSize; + DWORD dwFlags; + DWORD dwMinSecondarySampleRate; + DWORD dwMaxSecondarySampleRate; + DWORD dwPrimaryBuffers; + DWORD dwMaxHwMixingAllBuffers; + DWORD dwMaxHwMixingStaticBuffers; + DWORD dwMaxHwMixingStreamingBuffers; + DWORD dwFreeHwMixingAllBuffers; + DWORD dwFreeHwMixingStaticBuffers; + DWORD dwFreeHwMixingStreamingBuffers; + DWORD dwMaxHw3DAllBuffers; + DWORD dwMaxHw3DStaticBuffers; + DWORD dwMaxHw3DStreamingBuffers; + DWORD dwFreeHw3DAllBuffers; + DWORD dwFreeHw3DStaticBuffers; + DWORD dwFreeHw3DStreamingBuffers; + DWORD dwTotalHwMemBytes; + DWORD dwFreeHwMemBytes; + DWORD dwMaxContigFreeHwMemBytes; + DWORD dwUnlockTransferRateHwBuffers; + DWORD dwPlayCpuOverheadSwBuffers; + DWORD dwReserved1; + DWORD dwReserved2; } DSCAPS, *LPDSCAPS; typedef struct _DSBCAPS { - - DWORD dwSize; - DWORD dwFlags; - DWORD dwBufferBytes; - DWORD dwUnlockTransferRate; - DWORD dwPlayCpuOverhead; + + DWORD dwSize; + DWORD dwFlags; + DWORD dwBufferBytes; + DWORD dwUnlockTransferRate; + DWORD dwPlayCpuOverhead; } DSBCAPS, *LPDSBCAPS; typedef struct _DSBUFFERDESC { - DWORD dwSize; - DWORD dwFlags; - DWORD dwBufferBytes; - DWORD dwReserved; - LPWAVEFORMATEX lpwfxFormat; + DWORD dwSize; + DWORD dwFlags; + DWORD dwBufferBytes; + DWORD dwReserved; + LPWAVEFORMATEX lpwfxFormat; } DSBUFFERDESC, *LPDSBUFFERDESC; @@ -109,11 +109,11 @@ extern HRESULT WINAPI DirectSoundEnumerateW(LPDSENUMCALLBACKW lpCallback, LPVOID extern HRESULT WINAPI DirectSoundEnumerateA(LPDSENUMCALLBACKA lpCallback, LPVOID lpContext ); #ifdef UNICODE -#define LPDSENUMCALLBACK LPDSENUMCALLBACKW -#define DirectSoundEnumerate DirectSoundEnumerateW +#define LPDSENUMCALLBACK LPDSENUMCALLBACKW +#define DirectSoundEnumerate DirectSoundEnumerateW #else -#define LPDSENUMCALLBACK LPDSENUMCALLBACKA -#define DirectSoundEnumerate DirectSoundEnumerateA +#define LPDSENUMCALLBACK LPDSENUMCALLBACKA +#define DirectSoundEnumerate DirectSoundEnumerateA #endif // @@ -124,34 +124,34 @@ extern HRESULT WINAPI DirectSoundEnumerateA(LPDSENUMCALLBACKA lpCallback, LPVOID #ifdef _WIN32 DECLARE_INTERFACE_( IDirectSound, IUnknown ) { - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - STDMETHOD_(ULONG,Release) (THIS) PURE; - /*** IDirectSound methods ***/ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectSound methods ***/ - STDMETHOD( CreateSoundBuffer)(THIS_ LPDSBUFFERDESC, LPLPDIRECTSOUNDBUFFER, IUnknown FAR *) PURE; - STDMETHOD( GetCaps)(THIS_ LPDSCAPS ) PURE; - STDMETHOD( DuplicateSoundBuffer)(THIS_ LPDIRECTSOUNDBUFFER, LPLPDIRECTSOUNDBUFFER ) PURE; - STDMETHOD( SetCooperativeLevel)(THIS_ HWND, DWORD ) PURE; - STDMETHOD( Compact)(THIS ) PURE; - STDMETHOD( GetSpeakerConfig)(THIS_ LPDWORD ) PURE; - STDMETHOD( SetSpeakerConfig)(THIS_ DWORD ) PURE; - STDMETHOD( Initialize)(THIS_ GUID FAR * ) PURE; + STDMETHOD( CreateSoundBuffer)(THIS_ LPDSBUFFERDESC, LPLPDIRECTSOUNDBUFFER, IUnknown FAR *) PURE; + STDMETHOD( GetCaps)(THIS_ LPDSCAPS ) PURE; + STDMETHOD( DuplicateSoundBuffer)(THIS_ LPDIRECTSOUNDBUFFER, LPLPDIRECTSOUNDBUFFER ) PURE; + STDMETHOD( SetCooperativeLevel)(THIS_ HWND, DWORD ) PURE; + STDMETHOD( Compact)(THIS ) PURE; + STDMETHOD( GetSpeakerConfig)(THIS_ LPDWORD ) PURE; + STDMETHOD( SetSpeakerConfig)(THIS_ DWORD ) PURE; + STDMETHOD( Initialize)(THIS_ GUID FAR * ) PURE; }; #if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirectSound_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirectSound_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirectSound_Release(p) (p)->lpVtbl->Release(p) -#define IDirectSound_CreateSoundBuffer(p,a,b,c) (p)->lpVtbl->CreateSoundBuffer(p,a,b,c) -#define IDirectSound_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectSound_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectSound_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectSound_Release(p) (p)->lpVtbl->Release(p) +#define IDirectSound_CreateSoundBuffer(p,a,b,c) (p)->lpVtbl->CreateSoundBuffer(p,a,b,c) +#define IDirectSound_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) #define IDirectSound_DuplicateSoundBuffer(p,a,b) (p)->lpVtbl->DuplicateSoundBuffer(p,a,b) -#define IDirectSound_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) -#define IDirectSound_Compact(p) (p)->lpVtbl->Compact(p) -#define IDirectSound_GetSpeakerConfig(p,a) (p)->lpVtbl->GetSpeakerConfig(p,a) -#define IDirectSound_SetSpeakerConfig(p,b) (p)->lpVtbl->SetSpeakerConfig(p,b) -#define IDirectSound_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirectSound_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectSound_Compact(p) (p)->lpVtbl->Compact(p) +#define IDirectSound_GetSpeakerConfig(p,a) (p)->lpVtbl->GetSpeakerConfig(p,a) +#define IDirectSound_SetSpeakerConfig(p,b) (p)->lpVtbl->SetSpeakerConfig(p,b) +#define IDirectSound_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) #endif #endif @@ -164,54 +164,54 @@ DECLARE_INTERFACE_( IDirectSound, IUnknown ) #ifdef _WIN32 DECLARE_INTERFACE_( IDirectSoundBuffer, IUnknown ) { - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - STDMETHOD_(ULONG,Release) (THIS) PURE; - /*** IDirectSoundBuffer methods ***/ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectSoundBuffer methods ***/ - STDMETHOD( GetCaps)(THIS_ LPDSBCAPS ) PURE; - STDMETHOD(GetCurrentPosition)(THIS_ LPDWORD,LPDWORD ) PURE; - STDMETHOD( GetFormat)(THIS_ LPWAVEFORMATEX, DWORD, LPDWORD ) PURE; - STDMETHOD( GetVolume)(THIS_ LPLONG ) PURE; - STDMETHOD( GetPan)(THIS_ LPLONG ) PURE; - STDMETHOD( GetFrequency)(THIS_ LPDWORD ) PURE; - STDMETHOD( GetStatus)(THIS_ LPDWORD ) PURE; - STDMETHOD( Initialize)(THIS_ LPDIRECTSOUND, LPDSBUFFERDESC ) PURE; - STDMETHOD( Lock)(THIS_ DWORD,DWORD,LPVOID,LPDWORD,LPVOID,LPDWORD,DWORD ) PURE; - STDMETHOD( Play)(THIS_ DWORD,DWORD,DWORD ) PURE; - STDMETHOD(SetCurrentPosition)(THIS_ DWORD ) PURE; - STDMETHOD( SetFormat)(THIS_ LPWAVEFORMATEX ) PURE; - STDMETHOD( SetVolume)(THIS_ LONG ) PURE; - STDMETHOD( SetPan)(THIS_ LONG ) PURE; - STDMETHOD( SetFrequency)(THIS_ DWORD ) PURE; - STDMETHOD( Stop)(THIS ) PURE; - STDMETHOD( Unlock)(THIS_ LPVOID,DWORD,LPVOID,DWORD ) PURE; - STDMETHOD( Restore)(THIS ) PURE; + STDMETHOD( GetCaps)(THIS_ LPDSBCAPS ) PURE; + STDMETHOD(GetCurrentPosition)(THIS_ LPDWORD,LPDWORD ) PURE; + STDMETHOD( GetFormat)(THIS_ LPWAVEFORMATEX, DWORD, LPDWORD ) PURE; + STDMETHOD( GetVolume)(THIS_ LPLONG ) PURE; + STDMETHOD( GetPan)(THIS_ LPLONG ) PURE; + STDMETHOD( GetFrequency)(THIS_ LPDWORD ) PURE; + STDMETHOD( GetStatus)(THIS_ LPDWORD ) PURE; + STDMETHOD( Initialize)(THIS_ LPDIRECTSOUND, LPDSBUFFERDESC ) PURE; + STDMETHOD( Lock)(THIS_ DWORD,DWORD,LPVOID,LPDWORD,LPVOID,LPDWORD,DWORD ) PURE; + STDMETHOD( Play)(THIS_ DWORD,DWORD,DWORD ) PURE; + STDMETHOD(SetCurrentPosition)(THIS_ DWORD ) PURE; + STDMETHOD( SetFormat)(THIS_ LPWAVEFORMATEX ) PURE; + STDMETHOD( SetVolume)(THIS_ LONG ) PURE; + STDMETHOD( SetPan)(THIS_ LONG ) PURE; + STDMETHOD( SetFrequency)(THIS_ DWORD ) PURE; + STDMETHOD( Stop)(THIS ) PURE; + STDMETHOD( Unlock)(THIS_ LPVOID,DWORD,LPVOID,DWORD ) PURE; + STDMETHOD( Restore)(THIS ) PURE; }; #if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirectSoundBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirectSoundBuffer_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirectSoundBuffer_Release(p) (p)->lpVtbl->Release(p) -#define IDirectSoundBuffer_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) -#define IDirectSoundBuffer_GetCurrentPosition(p,a,b) (p)->lpVtbl->GetCurrentPosition(p,a,b) -#define IDirectSoundBuffer_GetFormat(p,a,b,c) (p)->lpVtbl->GetFormat(p,a,b,c) -#define IDirectSoundBuffer_GetVolume(p,a) (p)->lpVtbl->GetVolume(p,a) -#define IDirectSoundBuffer_GetPan(p,a) (p)->lpVtbl->GetPan(p,a) -#define IDirectSoundBuffer_GetFrequency(p,a) (p)->lpVtbl->GetFrequency(p,a) -#define IDirectSoundBuffer_GetStatus(p,a) (p)->lpVtbl->GetStatus(p,a) -#define IDirectSoundBuffer_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) -#define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g) (p)->lpVtbl->Lock(p,a,b,c,d,e,f,g) -#define IDirectSoundBuffer_Play(p,a,b,c) (p)->lpVtbl->Play(p,a,b,c) -#define IDirectSoundBuffer_SetCurrentPosition(p,a) (p)->lpVtbl->SetCurrentPosition(p,a) -#define IDirectSoundBuffer_SetFormat(p,a) (p)->lpVtbl->SetFormat(p,a) -#define IDirectSoundBuffer_SetVolume(p,a) (p)->lpVtbl->SetVolume(p,a) -#define IDirectSoundBuffer_SetPan(p,a) (p)->lpVtbl->SetPan(p,a) -#define IDirectSoundBuffer_SetFrequency(p,a) (p)->lpVtbl->SetFrequency(p,a) -#define IDirectSoundBuffer_Stop(p) (p)->lpVtbl->Stop(p) -#define IDirectSoundBuffer_Unlock(p,a,b,c,d) (p)->lpVtbl->Unlock(p,a,b,c,d) -#define IDirectSoundBuffer_Restore(p) (p)->lpVtbl->Restore(p) +#define IDirectSoundBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectSoundBuffer_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectSoundBuffer_Release(p) (p)->lpVtbl->Release(p) +#define IDirectSoundBuffer_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectSoundBuffer_GetCurrentPosition(p,a,b) (p)->lpVtbl->GetCurrentPosition(p,a,b) +#define IDirectSoundBuffer_GetFormat(p,a,b,c) (p)->lpVtbl->GetFormat(p,a,b,c) +#define IDirectSoundBuffer_GetVolume(p,a) (p)->lpVtbl->GetVolume(p,a) +#define IDirectSoundBuffer_GetPan(p,a) (p)->lpVtbl->GetPan(p,a) +#define IDirectSoundBuffer_GetFrequency(p,a) (p)->lpVtbl->GetFrequency(p,a) +#define IDirectSoundBuffer_GetStatus(p,a) (p)->lpVtbl->GetStatus(p,a) +#define IDirectSoundBuffer_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g) (p)->lpVtbl->Lock(p,a,b,c,d,e,f,g) +#define IDirectSoundBuffer_Play(p,a,b,c) (p)->lpVtbl->Play(p,a,b,c) +#define IDirectSoundBuffer_SetCurrentPosition(p,a) (p)->lpVtbl->SetCurrentPosition(p,a) +#define IDirectSoundBuffer_SetFormat(p,a) (p)->lpVtbl->SetFormat(p,a) +#define IDirectSoundBuffer_SetVolume(p,a) (p)->lpVtbl->SetVolume(p,a) +#define IDirectSoundBuffer_SetPan(p,a) (p)->lpVtbl->SetPan(p,a) +#define IDirectSoundBuffer_SetFrequency(p,a) (p)->lpVtbl->SetFrequency(p,a) +#define IDirectSoundBuffer_Stop(p) (p)->lpVtbl->Stop(p) +#define IDirectSoundBuffer_Unlock(p,a,b,c,d) (p)->lpVtbl->Unlock(p,a,b,c,d) +#define IDirectSoundBuffer_Restore(p) (p)->lpVtbl->Restore(p) #endif #endif @@ -222,137 +222,137 @@ DECLARE_INTERFACE_( IDirectSoundBuffer, IUnknown ) * Return Codes */ -#define DS_OK 0 +#define DS_OK 0 /* * The call failed because resources (such as a priority level) - * were already being used by another caller. + * were already being used by another caller. */ -#define DSERR_ALLOCATED MAKE_DSHRESULT( 10 ) +#define DSERR_ALLOCATED MAKE_DSHRESULT( 10 ) /* * The control (vol,pan,etc.) requested by the caller is not available. */ -#define DSERR_CONTROLUNAVAIL MAKE_DSHRESULT( 30 ) +#define DSERR_CONTROLUNAVAIL MAKE_DSHRESULT( 30 ) /* * An invalid parameter was passed to the returning function */ -#define DSERR_INVALIDPARAM E_INVALIDARG +#define DSERR_INVALIDPARAM E_INVALIDARG /* * This call is not valid for the current state of this object */ -#define DSERR_INVALIDCALL MAKE_DSHRESULT( 50 ) +#define DSERR_INVALIDCALL MAKE_DSHRESULT( 50 ) /* * An undetermined error occured inside the DSound subsystem */ -#define DSERR_GENERIC E_FAIL +#define DSERR_GENERIC E_FAIL /* * The caller does not have the priority level required for the function to * succeed. */ -#define DSERR_PRIOLEVELNEEDED MAKE_DSHRESULT( 70 ) +#define DSERR_PRIOLEVELNEEDED MAKE_DSHRESULT( 70 ) /* * The DSound subsystem couldn't allocate sufficient memory to complete the * caller's request. */ -#define DSERR_OUTOFMEMORY E_OUTOFMEMORY +#define DSERR_OUTOFMEMORY E_OUTOFMEMORY /* * The specified WAVE format is not supported */ -#define DSERR_BADFORMAT MAKE_DSHRESULT( 100 ) +#define DSERR_BADFORMAT MAKE_DSHRESULT( 100 ) /* * The function called is not supported at this time */ -#define DSERR_UNSUPPORTED E_NOTIMPL +#define DSERR_UNSUPPORTED E_NOTIMPL /* * No sound driver is available for use */ -#define DSERR_NODRIVER MAKE_DSHRESULT( 120 ) +#define DSERR_NODRIVER MAKE_DSHRESULT( 120 ) /* * This object is already initialized */ -#define DSERR_ALREADYINITIALIZED MAKE_DSHRESULT( 130 ) +#define DSERR_ALREADYINITIALIZED MAKE_DSHRESULT( 130 ) /* * This object does not support aggregation */ -#define DSERR_NOAGGREGATION CLASS_E_NOAGGREGATION +#define DSERR_NOAGGREGATION CLASS_E_NOAGGREGATION /* * The buffer memory has been lost, and must be Restored. */ -#define DSERR_BUFFERLOST MAKE_DSHRESULT( 150 ) +#define DSERR_BUFFERLOST MAKE_DSHRESULT( 150 ) /* * Another app has a higher priority level, preventing this call from * succeeding. */ -#define DSERR_OTHERAPPHASPRIO MAKE_DSHRESULT( 160 ) +#define DSERR_OTHERAPPHASPRIO MAKE_DSHRESULT( 160 ) /* * The Initialize() member on the Direct Sound Object has not been * called or called successfully before calls to other members. */ -#define DSERR_UNINITIALIZED MAKE_DSHRESULT( 170 ) +#define DSERR_UNINITIALIZED MAKE_DSHRESULT( 170 ) //==========================================================================; // -// Flags... +// Flags... // //==========================================================================; -#define DSCAPS_PRIMARYMONO 0x00000001 -#define DSCAPS_PRIMARYSTEREO 0x00000002 -#define DSCAPS_PRIMARY8BIT 0x00000004 -#define DSCAPS_PRIMARY16BIT 0x00000008 -#define DSCAPS_CONTINUOUSRATE 0x00000010 -#define DSCAPS_EMULDRIVER 0x00000020 -#define DSCAPS_CERTIFIED 0x00000040 -#define DSCAPS_SECONDARYMONO 0x00000100 -#define DSCAPS_SECONDARYSTEREO 0x00000200 -#define DSCAPS_SECONDARY8BIT 0x00000400 -#define DSCAPS_SECONDARY16BIT 0x00000800 +#define DSCAPS_PRIMARYMONO 0x00000001 +#define DSCAPS_PRIMARYSTEREO 0x00000002 +#define DSCAPS_PRIMARY8BIT 0x00000004 +#define DSCAPS_PRIMARY16BIT 0x00000008 +#define DSCAPS_CONTINUOUSRATE 0x00000010 +#define DSCAPS_EMULDRIVER 0x00000020 +#define DSCAPS_CERTIFIED 0x00000040 +#define DSCAPS_SECONDARYMONO 0x00000100 +#define DSCAPS_SECONDARYSTEREO 0x00000200 +#define DSCAPS_SECONDARY8BIT 0x00000400 +#define DSCAPS_SECONDARY16BIT 0x00000800 -#define DSBPLAY_LOOPING 0x00000001 +#define DSBPLAY_LOOPING 0x00000001 - -#define DSBSTATUS_PLAYING 0x00000001 -#define DSBSTATUS_BUFFERLOST 0x00000002 -#define DSBSTATUS_LOOPING 0x00000004 - + +#define DSBSTATUS_PLAYING 0x00000001 +#define DSBSTATUS_BUFFERLOST 0x00000002 +#define DSBSTATUS_LOOPING 0x00000004 + -#define DSBLOCK_FROMWRITECURSOR 0x00000001 +#define DSBLOCK_FROMWRITECURSOR 0x00000001 -#define DSSCL_NORMAL 1 -#define DSSCL_PRIORITY 2 -#define DSSCL_EXCLUSIVE 3 -#define DSSCL_WRITEPRIMARY 4 +#define DSSCL_NORMAL 1 +#define DSSCL_PRIORITY 2 +#define DSSCL_EXCLUSIVE 3 +#define DSSCL_WRITEPRIMARY 4 -#define DSBCAPS_PRIMARYBUFFER 0x00000001 -#define DSBCAPS_STATIC 0x00000002 -#define DSBCAPS_LOCHARDWARE 0x00000004 -#define DSBCAPS_LOCSOFTWARE 0x00000008 -#define DSBCAPS_CTRLFREQUENCY 0x00000020 -#define DSBCAPS_CTRLPAN 0x00000040 -#define DSBCAPS_CTRLVOLUME 0x00000080 -#define DSBCAPS_CTRLDEFAULT 0x000000E0 // Pan + volume + frequency. -#define DSBCAPS_CTRLALL 0x000000E0 // All control capabilities -#define DSBCAPS_STICKYFOCUS 0x00004000 -#define DSBCAPS_GETCURRENTPOSITION2 0x00010000 // More accurate play cursor under emulation +#define DSBCAPS_PRIMARYBUFFER 0x00000001 +#define DSBCAPS_STATIC 0x00000002 +#define DSBCAPS_LOCHARDWARE 0x00000004 +#define DSBCAPS_LOCSOFTWARE 0x00000008 +#define DSBCAPS_CTRLFREQUENCY 0x00000020 +#define DSBCAPS_CTRLPAN 0x00000040 +#define DSBCAPS_CTRLVOLUME 0x00000080 +#define DSBCAPS_CTRLDEFAULT 0x000000E0 // Pan + volume + frequency. +#define DSBCAPS_CTRLALL 0x000000E0 // All control capabilities +#define DSBCAPS_STICKYFOCUS 0x00004000 +#define DSBCAPS_GETCURRENTPOSITION2 0x00010000 // More accurate play cursor under emulation -#define DSSPEAKER_HEADPHONE 1 -#define DSSPEAKER_MONO 2 -#define DSSPEAKER_QUAD 3 -#define DSSPEAKER_STEREO 4 -#define DSSPEAKER_SURROUND 5 +#define DSSPEAKER_HEADPHONE 1 +#define DSSPEAKER_MONO 2 +#define DSSPEAKER_QUAD 3 +#define DSSPEAKER_STEREO 4 +#define DSSPEAKER_SURROUND 5 @@ -363,4 +363,4 @@ DECLARE_INTERFACE_( IDirectSoundBuffer, IUnknown ) }; #endif -#endif /* __DSOUND_INCLUDED__ */ +#endif /* __DSOUND_INCLUDED__ */ diff --git a/Standard Gaming Platform/english.h b/Standard Gaming Platform/english.h index 4bd6c88f..89c99496 100644 --- a/Standard Gaming Platform/english.h +++ b/Standard Gaming Platform/english.h @@ -3,131 +3,131 @@ #include "types.h" -#define SHIFT 16 -#define CTRL 17 -#define ALT 18 +#define SHIFT 16 +#define CTRL 17 +#define ALT 18 -#define F1 124 -#define F2 125 -#define F3 126 -#define F4 127 -#define F5 128 -#define F6 129 -#define F7 130 -#define F8 131 -#define F9 132 -#define F10 133 -#define F11 134 -#define F12 135 +#define F1 124 +#define F2 125 +#define F3 126 +#define F4 127 +#define F5 128 +#define F6 129 +#define F7 130 +#define F8 131 +#define F9 132 +#define F10 133 +#define F11 134 +#define F12 135 -#define SHIFT_F1 368 -#define SHIFT_F2 369 -#define SHIFT_F3 370 -#define SHIFT_F4 371 -#define SHIFT_F5 372 -#define SHIFT_F6 373 -#define SHIFT_F7 374 -#define SHIFT_F8 375 -#define SHIFT_F9 376 -#define SHIFT_F10 377 -#define SHIFT_F11 378 -#define SHIFT_F12 379 +#define SHIFT_F1 368 +#define SHIFT_F2 369 +#define SHIFT_F3 370 +#define SHIFT_F4 371 +#define SHIFT_F5 372 +#define SHIFT_F6 373 +#define SHIFT_F7 374 +#define SHIFT_F8 375 +#define SHIFT_F9 376 +#define SHIFT_F10 377 +#define SHIFT_F11 378 +#define SHIFT_F12 379 -#define ALT_F1 624 -#define ALT_F2 625 -#define ALT_F3 626 -#define ALT_F4 627 -#define ALT_F5 628 -#define ALT_F6 629 -#define ALT_F7 630 -#define ALT_F8 631 -#define ALT_F9 632 -#define ALT_F10 633 -#define ALT_F11 634 -#define ALT_F12 635 +#define ALT_F1 624 +#define ALT_F2 625 +#define ALT_F3 626 +#define ALT_F4 627 +#define ALT_F5 628 +#define ALT_F6 629 +#define ALT_F7 630 +#define ALT_F8 631 +#define ALT_F9 632 +#define ALT_F10 633 +#define ALT_F11 634 +#define ALT_F12 635 -#define CTRL_F1 880 -#define CTRL_F2 881 -#define CTRL_F3 882 -#define CTRL_F4 883 -#define CTRL_F5 884 -#define CTRL_F6 885 -#define CTRL_F7 886 -#define CTRL_F8 887 -#define CTRL_F9 888 -#define CTRL_F10 889 -#define CTRL_F11 890 -#define CTRL_F12 891 +#define CTRL_F1 880 +#define CTRL_F2 881 +#define CTRL_F3 882 +#define CTRL_F4 883 +#define CTRL_F5 884 +#define CTRL_F6 885 +#define CTRL_F7 886 +#define CTRL_F8 887 +#define CTRL_F9 888 +#define CTRL_F10 889 +#define CTRL_F11 890 +#define CTRL_F12 891 -#define ESC 27 -#define TAB 9 -#define CAPS 20 -#define SCRL_LOCK 145 //*** this may be incorrect! DB +#define ESC 27 +#define TAB 9 +#define CAPS 20 +#define SCRL_LOCK 145 //*** this may be incorrect! DB #define SNAPSHOT 44 -#define PAUSE 19 -#define NUM_LOCK 144 -#define BACKSPACE 8 +#define PAUSE 19 +#define NUM_LOCK 144 +#define BACKSPACE 8 -#define INSERT 245 -#define DEL 246 +#define INSERT 245 +#define DEL 246 #ifndef JA2 // Stupid definition causes problems with headers that use the keyword END -- DB - #define KEY_END 247 + #define KEY_END 247 #else #define END 247 #endif -#define DNARROW 248 -#define PGDN 249 -#define LEFTARROW 250 -#define RIGHTARROW 251 -#define HOME 252 -#define UPARROW 253 -#define PGUP 254 +#define DNARROW 248 +#define PGDN 249 +#define LEFTARROW 250 +#define RIGHTARROW 251 +#define HOME 252 +#define UPARROW 253 +#define PGUP 254 -#define SHIFT_TAB 265 +#define SHIFT_TAB 265 -#define SHIFT_INSERT 501 -#define SHIFT_DELETE 502 -#define SHIFT_END 503 -#define SHIFT_DNARROW 504 -#define SHIFT_PGDN 505 -#define SHIFT_LEFTARROW 506 -#define SHIFT_RIGHTARROW 507 -#define SHIFT_HOME 508 -#define SHIFT_UPARROW 509 -#define SHIFT_PGUP 510 +#define SHIFT_INSERT 501 +#define SHIFT_DELETE 502 +#define SHIFT_END 503 +#define SHIFT_DNARROW 504 +#define SHIFT_PGDN 505 +#define SHIFT_LEFTARROW 506 +#define SHIFT_RIGHTARROW 507 +#define SHIFT_HOME 508 +#define SHIFT_UPARROW 509 +#define SHIFT_PGUP 510 -#define ALT_TAB 521 +#define ALT_TAB 521 -#define ALT_INSERT 757 -#define ALT_DELETE 758 -#define ALT_END 759 -#define ALT_DNARROW 760 -#define ALT_PGDN 761 -#define ALT_LEFTARROW 762 -#define ALT_RIGHTARROW 763 -#define ALT_HOME 764 -#define ALT_UPARROW 765 -#define ALT_PGUP 766 +#define ALT_INSERT 757 +#define ALT_DELETE 758 +#define ALT_END 759 +#define ALT_DNARROW 760 +#define ALT_PGDN 761 +#define ALT_LEFTARROW 762 +#define ALT_RIGHTARROW 763 +#define ALT_HOME 764 +#define ALT_UPARROW 765 +#define ALT_PGUP 766 -#define CTRL_TAB 777 +#define CTRL_TAB 777 -#define CTRL_INSERT 1013 -#define CTRL_DELETE 1014 -#define CTRL_END 1015 -#define CTRL_DNARROW 1016 -#define CTRL_PGDN 1017 -#define CTRL_LEFTARROW 1018 -#define CTRL_RIGHTARROW 1019 -#define CTRL_HOME 1020 -#define CTRL_UPARROW 1021 -#define CTRL_PGUP 1022 +#define CTRL_INSERT 1013 +#define CTRL_DELETE 1014 +#define CTRL_END 1015 +#define CTRL_DNARROW 1016 +#define CTRL_PGDN 1017 +#define CTRL_LEFTARROW 1018 +#define CTRL_RIGHTARROW 1019 +#define CTRL_HOME 1020 +#define CTRL_UPARROW 1021 +#define CTRL_PGUP 1022 -#define CURSOR 1023 +#define CURSOR 1023 -#define ENTER 13 -#define SPACE 32 +#define ENTER 13 +#define SPACE 32 #endif \ No newline at end of file diff --git a/Standard Gaming Platform/expat.h b/Standard Gaming Platform/expat.h index 99678856..86bf7d9a 100644 --- a/Standard Gaming Platform/expat.h +++ b/Standard Gaming Platform/expat.h @@ -1,17 +1,17 @@ /* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. + See the file COPYING for copying permission. */ #ifndef XmlParse_INCLUDED #define XmlParse_INCLUDED 1 #ifdef __VMS -/* 0 1 2 3 0 1 2 3 - 1234567890123456789012345678901 1234567890123456789012345678901 */ +/* 0 1 2 3 0 1 2 3 + 1234567890123456789012345678901 1234567890123456789012345678901 */ #define XML_SetProcessingInstructionHandler XML_SetProcessingInstrHandler -#define XML_SetUnparsedEntityDeclHandler XML_SetUnparsedEntDeclHandler -#define XML_SetStartNamespaceDeclHandler XML_SetStartNamespcDeclHandler -#define XML_SetExternalEntityRefHandlerArg XML_SetExternalEntRefHandlerArg +#define XML_SetUnparsedEntityDeclHandler XML_SetUnparsedEntDeclHandler +#define XML_SetStartNamespaceDeclHandler XML_SetStartNamespcDeclHandler +#define XML_SetExternalEntityRefHandlerArg XML_SetExternalEntRefHandlerArg #endif #include @@ -21,26 +21,26 @@ #endif /* Expat tries very hard to make the API boundary very specifically - defined. There are two macros defined to control this boundary; - each of these can be defined before including this header to - achieve some different behavior, but doing so it not recommended or - tested frequently. + defined. There are two macros defined to control this boundary; + each of these can be defined before including this header to + achieve some different behavior, but doing so it not recommended or + tested frequently. - XMLCALL - The calling convention to use for all calls across the - "library boundary." This will default to cdecl, and - try really hard to tell the compiler that's what we - want. + XMLCALL - The calling convention to use for all calls across the + "library boundary." This will default to cdecl, and + try really hard to tell the compiler that's what we + want. - XMLIMPORT - Whatever magic is needed to note that a function is - to be imported from a dynamically loaded library - (.dll, .so, or .sl, depending on your platform). + XMLIMPORT - Whatever magic is needed to note that a function is + to be imported from a dynamically loaded library + (.dll, .so, or .sl, depending on your platform). - The XMLCALL macro was added in Expat 1.95.7. The only one which is - expected to be directly useful in client code is XMLCALL. + The XMLCALL macro was added in Expat 1.95.7. The only one which is + expected to be directly useful in client code is XMLCALL. - Note that on at least some Unix versions, the Expat library must be - compiled with the cdecl calling convention as the default since - system headers may assume the cdecl convention. + Note that on at least some Unix versions, the Expat library must be + compiled with the cdecl calling convention as the default since + system headers may assume the cdecl convention. */ #ifndef XMLCALL #if defined(XML_USE_MSC_EXTENSIONS) @@ -49,18 +49,18 @@ #define XMLCALL __attribute__((cdecl)) #else /* For any platform which uses this definition and supports more than - one calling convention, we need to extend this definition to - declare the convention used on that platform, if it's possible to - do so. + one calling convention, we need to extend this definition to + declare the convention used on that platform, if it's possible to + do so. - If this is the case for your platform, please file a bug report - with information on how to identify your platform via the C - pre-processor and how to specify the same calling convention as the - platform's malloc() implementation. + If this is the case for your platform, please file a bug report + with information on how to identify your platform via the C + pre-processor and how to specify the same calling convention as the + platform's malloc() implementation. */ #define XMLCALL #endif -#endif /* not defined XMLCALL */ +#endif /* not defined XMLCALL */ #if !defined(XML_STATIC) && !defined(XMLIMPORT) @@ -72,7 +72,7 @@ #endif #endif -#endif /* not defined XML_STATIC */ +#endif /* not defined XML_STATIC */ /* If we didn't define it above, define it away: */ #ifndef XMLIMPORT @@ -93,7 +93,7 @@ extern "C" { struct XML_ParserStruct; typedef struct XML_ParserStruct *XML_Parser; -#ifdef XML_UNICODE /* Information is UTF-16 encoded. */ +#ifdef XML_UNICODE /* Information is UTF-16 encoded. */ #ifdef XML_UNICODE_WCHAR_T typedef wchar_t XML_Char; typedef wchar_t XML_LChar; @@ -101,503 +101,503 @@ typedef wchar_t XML_LChar; typedef unsigned short XML_Char; typedef char XML_LChar; #endif /* XML_UNICODE_WCHAR_T */ -#else /* Information is UTF-8 encoded. */ +#else /* Information is UTF-8 encoded. */ typedef char XML_Char; typedef char XML_LChar; #endif /* XML_UNICODE */ /* Should this be defined using stdbool.h when C99 is available? */ typedef unsigned char XML_Bool; -#define XML_TRUE ((XML_Bool) 1) -#define XML_FALSE ((XML_Bool) 0) +#define XML_TRUE ((XML_Bool) 1) +#define XML_FALSE ((XML_Bool) 0) /* The XML_Status enum gives the possible return values for several - API functions. The preprocessor #defines are included so this - stanza can be added to code that still needs to support older - versions of Expat 1.95.x: + API functions. The preprocessor #defines are included so this + stanza can be added to code that still needs to support older + versions of Expat 1.95.x: - #ifndef XML_STATUS_OK - #define XML_STATUS_OK 1 - #define XML_STATUS_ERROR 0 - #endif + #ifndef XML_STATUS_OK + #define XML_STATUS_OK 1 + #define XML_STATUS_ERROR 0 + #endif - Otherwise, the #define hackery is quite ugly and would have been - dropped. + Otherwise, the #define hackery is quite ugly and would have been + dropped. */ enum XML_Status { - XML_STATUS_ERROR = 0, + XML_STATUS_ERROR = 0, #define XML_STATUS_ERROR XML_STATUS_ERROR - XML_STATUS_OK = 1 + XML_STATUS_OK = 1 #define XML_STATUS_OK XML_STATUS_OK }; enum XML_Error { - XML_ERROR_NONE, - XML_ERROR_NO_MEMORY, - XML_ERROR_SYNTAX, - XML_ERROR_NO_ELEMENTS, - XML_ERROR_INVALID_TOKEN, - XML_ERROR_UNCLOSED_TOKEN, - XML_ERROR_PARTIAL_CHAR, - XML_ERROR_TAG_MISMATCH, - XML_ERROR_DUPLICATE_ATTRIBUTE, - XML_ERROR_JUNK_AFTER_DOC_ELEMENT, - XML_ERROR_PARAM_ENTITY_REF, - XML_ERROR_UNDEFINED_ENTITY, - XML_ERROR_RECURSIVE_ENTITY_REF, - XML_ERROR_ASYNC_ENTITY, - XML_ERROR_BAD_CHAR_REF, - XML_ERROR_BINARY_ENTITY_REF, - XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, - XML_ERROR_MISPLACED_XML_PI, - XML_ERROR_UNKNOWN_ENCODING, - XML_ERROR_INCORRECT_ENCODING, - XML_ERROR_UNCLOSED_CDATA_SECTION, - XML_ERROR_EXTERNAL_ENTITY_HANDLING, - XML_ERROR_NOT_STANDALONE, - XML_ERROR_UNEXPECTED_STATE, - XML_ERROR_ENTITY_DECLARED_IN_PE, - XML_ERROR_FEATURE_REQUIRES_XML_DTD, - XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING, - XML_ERROR_UNBOUND_PREFIX + XML_ERROR_NONE, + XML_ERROR_NO_MEMORY, + XML_ERROR_SYNTAX, + XML_ERROR_NO_ELEMENTS, + XML_ERROR_INVALID_TOKEN, + XML_ERROR_UNCLOSED_TOKEN, + XML_ERROR_PARTIAL_CHAR, + XML_ERROR_TAG_MISMATCH, + XML_ERROR_DUPLICATE_ATTRIBUTE, + XML_ERROR_JUNK_AFTER_DOC_ELEMENT, + XML_ERROR_PARAM_ENTITY_REF, + XML_ERROR_UNDEFINED_ENTITY, + XML_ERROR_RECURSIVE_ENTITY_REF, + XML_ERROR_ASYNC_ENTITY, + XML_ERROR_BAD_CHAR_REF, + XML_ERROR_BINARY_ENTITY_REF, + XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, + XML_ERROR_MISPLACED_XML_PI, + XML_ERROR_UNKNOWN_ENCODING, + XML_ERROR_INCORRECT_ENCODING, + XML_ERROR_UNCLOSED_CDATA_SECTION, + XML_ERROR_EXTERNAL_ENTITY_HANDLING, + XML_ERROR_NOT_STANDALONE, + XML_ERROR_UNEXPECTED_STATE, + XML_ERROR_ENTITY_DECLARED_IN_PE, + XML_ERROR_FEATURE_REQUIRES_XML_DTD, + XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING, + XML_ERROR_UNBOUND_PREFIX }; enum XML_Content_Type { - XML_CTYPE_EMPTY = 1, - XML_CTYPE_ANY, - XML_CTYPE_MIXED, - XML_CTYPE_NAME, - XML_CTYPE_CHOICE, - XML_CTYPE_SEQ + XML_CTYPE_EMPTY = 1, + XML_CTYPE_ANY, + XML_CTYPE_MIXED, + XML_CTYPE_NAME, + XML_CTYPE_CHOICE, + XML_CTYPE_SEQ }; enum XML_Content_Quant { - XML_CQUANT_NONE, - XML_CQUANT_OPT, - XML_CQUANT_REP, - XML_CQUANT_PLUS + XML_CQUANT_NONE, + XML_CQUANT_OPT, + XML_CQUANT_REP, + XML_CQUANT_PLUS }; /* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be - XML_CQUANT_NONE, and the other fields will be zero or NULL. - If type == XML_CTYPE_MIXED, then quant will be NONE or REP and - numchildren will contain number of elements that may be mixed in - and children point to an array of XML_Content cells that will be - all of XML_CTYPE_NAME type with no quantification. + XML_CQUANT_NONE, and the other fields will be zero or NULL. + If type == XML_CTYPE_MIXED, then quant will be NONE or REP and + numchildren will contain number of elements that may be mixed in + and children point to an array of XML_Content cells that will be + all of XML_CTYPE_NAME type with no quantification. - If type == XML_CTYPE_NAME, then the name points to the name, and - the numchildren field will be zero and children will be NULL. The - quant fields indicates any quantifiers placed on the name. + If type == XML_CTYPE_NAME, then the name points to the name, and + the numchildren field will be zero and children will be NULL. The + quant fields indicates any quantifiers placed on the name. - CHOICE and SEQ will have name NULL, the number of children in - numchildren and children will point, recursively, to an array - of XML_Content cells. + CHOICE and SEQ will have name NULL, the number of children in + numchildren and children will point, recursively, to an array + of XML_Content cells. - The EMPTY, ANY, and MIXED types will only occur at top level. + The EMPTY, ANY, and MIXED types will only occur at top level. */ typedef struct XML_cp XML_Content; struct XML_cp { - enum XML_Content_Type type; - enum XML_Content_Quant quant; - XML_Char * name; - unsigned int numchildren; - XML_Content * children; + enum XML_Content_Type type; + enum XML_Content_Quant quant; + XML_Char * name; + unsigned int numchildren; + XML_Content * children; }; /* This is called for an element declaration. See above for - description of the model argument. It's the caller's responsibility - to free model when finished with it. + description of the model argument. It's the caller's responsibility + to free model when finished with it. */ typedef void (XMLCALL *XML_ElementDeclHandler) (void *userData, - const XML_Char *name, - XML_Content *model); + const XML_Char *name, + XML_Content *model); XMLPARSEAPI(void) XML_SetElementDeclHandler(XML_Parser parser, - XML_ElementDeclHandler eldecl); + XML_ElementDeclHandler eldecl); /* The Attlist declaration handler is called for *each* attribute. So - a single Attlist declaration with multiple attributes declared will - generate multiple calls to this handler. The "default" parameter - may be NULL in the case of the "#IMPLIED" or "#REQUIRED" - keyword. The "isrequired" parameter will be true and the default - value will be NULL in the case of "#REQUIRED". If "isrequired" is - true and default is non-NULL, then this is a "#FIXED" default. + a single Attlist declaration with multiple attributes declared will + generate multiple calls to this handler. The "default" parameter + may be NULL in the case of the "#IMPLIED" or "#REQUIRED" + keyword. The "isrequired" parameter will be true and the default + value will be NULL in the case of "#REQUIRED". If "isrequired" is + true and default is non-NULL, then this is a "#FIXED" default. */ typedef void (XMLCALL *XML_AttlistDeclHandler) ( - void *userData, - const XML_Char *elname, - const XML_Char *attname, - const XML_Char *att_type, - const XML_Char *dflt, - int isrequired); + void *userData, + const XML_Char *elname, + const XML_Char *attname, + const XML_Char *att_type, + const XML_Char *dflt, + int isrequired); XMLPARSEAPI(void) XML_SetAttlistDeclHandler(XML_Parser parser, - XML_AttlistDeclHandler attdecl); + XML_AttlistDeclHandler attdecl); /* The XML declaration handler is called for *both* XML declarations - and text declarations. The way to distinguish is that the version - parameter will be NULL for text declarations. The encoding - parameter may be NULL for XML declarations. The standalone - parameter will be -1, 0, or 1 indicating respectively that there - was no standalone parameter in the declaration, that it was given - as no, or that it was given as yes. + and text declarations. The way to distinguish is that the version + parameter will be NULL for text declarations. The encoding + parameter may be NULL for XML declarations. The standalone + parameter will be -1, 0, or 1 indicating respectively that there + was no standalone parameter in the declaration, that it was given + as no, or that it was given as yes. */ -typedef void (XMLCALL *XML_XmlDeclHandler) (void *userData, - const XML_Char *version, - const XML_Char *encoding, - int standalone); +typedef void (XMLCALL *XML_XmlDeclHandler) (void *userData, + const XML_Char *version, + const XML_Char *encoding, + int standalone); XMLPARSEAPI(void) XML_SetXmlDeclHandler(XML_Parser parser, - XML_XmlDeclHandler xmldecl); + XML_XmlDeclHandler xmldecl); typedef struct { - void *(XMLCALL *malloc_fcn)(size_t size); - void *(XMLCALL *realloc_fcn)(void *ptr, size_t size); - void (XMLCALL *free_fcn)(void *ptr); + void *(XMLCALL *malloc_fcn)(size_t size); + void *(XMLCALL *realloc_fcn)(void *ptr, size_t size); + void (XMLCALL *free_fcn)(void *ptr); } XML_Memory_Handling_Suite; /* Constructs a new parser; encoding is the encoding specified by the - external protocol or NULL if there is none specified. + external protocol or NULL if there is none specified. */ XMLPARSEAPI(XML_Parser) XML_ParserCreate(const XML_Char *encoding); -/* Constructs a new parser and namespace processor. Element type - names and attribute names that belong to a namespace will be - expanded; unprefixed attribute names are never expanded; unprefixed - element type names are expanded only if there is a default - namespace. The expanded name is the concatenation of the namespace - URI, the namespace separator character, and the local part of the - name. If the namespace separator is '\0' then the namespace URI - and the local part will be concatenated without any separator. - When a namespace is not declared, the name and prefix will be - passed through without expansion. +/* Constructs a new parser and namespace processor. Element type + names and attribute names that belong to a namespace will be + expanded; unprefixed attribute names are never expanded; unprefixed + element type names are expanded only if there is a default + namespace. The expanded name is the concatenation of the namespace + URI, the namespace separator character, and the local part of the + name. If the namespace separator is '\0' then the namespace URI + and the local part will be concatenated without any separator. + When a namespace is not declared, the name and prefix will be + passed through without expansion. */ XMLPARSEAPI(XML_Parser) XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); /* Constructs a new parser using the memory management suite referred to - by memsuite. If memsuite is NULL, then use the standard library memory - suite. If namespaceSeparator is non-NULL it creates a parser with - namespace processing as described above. The character pointed at - will serve as the namespace separator. + by memsuite. If memsuite is NULL, then use the standard library memory + suite. If namespaceSeparator is non-NULL it creates a parser with + namespace processing as described above. The character pointed at + will serve as the namespace separator. - All further memory operations used for the created parser will come from - the given suite. + All further memory operations used for the created parser will come from + the given suite. */ XMLPARSEAPI(XML_Parser) XML_ParserCreate_MM(const XML_Char *encoding, - const XML_Memory_Handling_Suite *memsuite, - const XML_Char *namespaceSeparator); + const XML_Memory_Handling_Suite *memsuite, + const XML_Char *namespaceSeparator); -/* Prepare a parser object to be re-used. This is particularly - valuable when memory allocation overhead is disproportionatly high, - such as when a large number of small documnents need to be parsed. - All handlers are cleared from the parser, except for the - unknownEncodingHandler. The parser's external state is re-initialized - except for the values of ns and ns_triplets. +/* Prepare a parser object to be re-used. This is particularly + valuable when memory allocation overhead is disproportionatly high, + such as when a large number of small documnents need to be parsed. + All handlers are cleared from the parser, except for the + unknownEncodingHandler. The parser's external state is re-initialized + except for the values of ns and ns_triplets. - Added in Expat 1.95.3. + Added in Expat 1.95.3. */ XMLPARSEAPI(XML_Bool) XML_ParserReset(XML_Parser parser, const XML_Char *encoding); /* atts is array of name/value pairs, terminated by 0; - names and values are 0 terminated. + names and values are 0 terminated. */ typedef void (XMLCALL *XML_StartElementHandler) (void *userData, - const XML_Char *name, - const XML_Char **atts); + const XML_Char *name, + const XML_Char **atts); typedef void (XMLCALL *XML_EndElementHandler) (void *userData, - const XML_Char *name); + const XML_Char *name); /* s is not 0 terminated. */ typedef void (XMLCALL *XML_CharacterDataHandler) (void *userData, - const XML_Char *s, - int len); + const XML_Char *s, + int len); /* target and data are 0 terminated */ typedef void (XMLCALL *XML_ProcessingInstructionHandler) ( - void *userData, - const XML_Char *target, - const XML_Char *data); + void *userData, + const XML_Char *target, + const XML_Char *data); /* data is 0 terminated */ typedef void (XMLCALL *XML_CommentHandler) (void *userData, - const XML_Char *data); + const XML_Char *data); typedef void (XMLCALL *XML_StartCdataSectionHandler) (void *userData); typedef void (XMLCALL *XML_EndCdataSectionHandler) (void *userData); /* This is called for any characters in the XML document for which - there is no applicable handler. This includes both characters that - are part of markup which is of a kind that is not reported - (comments, markup declarations), or characters that are part of a - construct which could be reported but for which no handler has been - supplied. The characters are passed exactly as they were in the XML - document except that they will be encoded in UTF-8 or UTF-16. - Line boundaries are not normalized. Note that a byte order mark - character is not passed to the default handler. There are no - guarantees about how characters are divided between calls to the - default handler: for example, a comment might be split between - multiple calls. + there is no applicable handler. This includes both characters that + are part of markup which is of a kind that is not reported + (comments, markup declarations), or characters that are part of a + construct which could be reported but for which no handler has been + supplied. The characters are passed exactly as they were in the XML + document except that they will be encoded in UTF-8 or UTF-16. + Line boundaries are not normalized. Note that a byte order mark + character is not passed to the default handler. There are no + guarantees about how characters are divided between calls to the + default handler: for example, a comment might be split between + multiple calls. */ typedef void (XMLCALL *XML_DefaultHandler) (void *userData, - const XML_Char *s, - int len); + const XML_Char *s, + int len); /* This is called for the start of the DOCTYPE declaration, before - any DTD or internal subset is parsed. + any DTD or internal subset is parsed. */ typedef void (XMLCALL *XML_StartDoctypeDeclHandler) ( - void *userData, - const XML_Char *doctypeName, - const XML_Char *sysid, - const XML_Char *pubid, - int has_internal_subset); + void *userData, + const XML_Char *doctypeName, + const XML_Char *sysid, + const XML_Char *pubid, + int has_internal_subset); /* This is called for the start of the DOCTYPE declaration when the - closing > is encountered, but after processing any external - subset. + closing > is encountered, but after processing any external + subset. */ typedef void (XMLCALL *XML_EndDoctypeDeclHandler)(void *userData); /* This is called for entity declarations. The is_parameter_entity - argument will be non-zero if the entity is a parameter entity, zero - otherwise. + argument will be non-zero if the entity is a parameter entity, zero + otherwise. - For internal entities (), value will - be non-NULL and systemId, publicID, and notationName will be NULL. - The value string is NOT nul-terminated; the length is provided in - the value_length argument. Since it is legal to have zero-length - values, do not use this argument to test for internal entities. + For internal entities (), value will + be non-NULL and systemId, publicID, and notationName will be NULL. + The value string is NOT nul-terminated; the length is provided in + the value_length argument. Since it is legal to have zero-length + values, do not use this argument to test for internal entities. - For external entities, value will be NULL and systemId will be - non-NULL. The publicId argument will be NULL unless a public - identifier was provided. The notationName argument will have a - non-NULL value only for unparsed entity declarations. + For external entities, value will be NULL and systemId will be + non-NULL. The publicId argument will be NULL unless a public + identifier was provided. The notationName argument will have a + non-NULL value only for unparsed entity declarations. - Note that is_parameter_entity can't be changed to XML_Bool, since - that would break binary compatibility. + Note that is_parameter_entity can't be changed to XML_Bool, since + that would break binary compatibility. */ typedef void (XMLCALL *XML_EntityDeclHandler) ( - void *userData, - const XML_Char *entityName, - int is_parameter_entity, - const XML_Char *value, - int value_length, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName); + void *userData, + const XML_Char *entityName, + int is_parameter_entity, + const XML_Char *value, + int value_length, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId, + const XML_Char *notationName); XMLPARSEAPI(void) XML_SetEntityDeclHandler(XML_Parser parser, - XML_EntityDeclHandler handler); + XML_EntityDeclHandler handler); /* OBSOLETE -- OBSOLETE -- OBSOLETE - This handler has been superceded by the EntityDeclHandler above. - It is provided here for backward compatibility. + This handler has been superceded by the EntityDeclHandler above. + It is provided here for backward compatibility. - This is called for a declaration of an unparsed (NDATA) entity. - The base argument is whatever was set by XML_SetBase. The - entityName, systemId and notationName arguments will never be - NULL. The other arguments may be. + This is called for a declaration of an unparsed (NDATA) entity. + The base argument is whatever was set by XML_SetBase. The + entityName, systemId and notationName arguments will never be + NULL. The other arguments may be. */ typedef void (XMLCALL *XML_UnparsedEntityDeclHandler) ( - void *userData, - const XML_Char *entityName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName); + void *userData, + const XML_Char *entityName, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId, + const XML_Char *notationName); -/* This is called for a declaration of notation. The base argument is - whatever was set by XML_SetBase. The notationName will never be - NULL. The other arguments can be. +/* This is called for a declaration of notation. The base argument is + whatever was set by XML_SetBase. The notationName will never be + NULL. The other arguments can be. */ typedef void (XMLCALL *XML_NotationDeclHandler) ( - void *userData, - const XML_Char *notationName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId); + void *userData, + const XML_Char *notationName, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId); /* When namespace processing is enabled, these are called once for - each namespace declaration. The call to the start and end element - handlers occur between the calls to the start and end namespace - declaration handlers. For an xmlns attribute, prefix will be - NULL. For an xmlns="" attribute, uri will be NULL. + each namespace declaration. The call to the start and end element + handlers occur between the calls to the start and end namespace + declaration handlers. For an xmlns attribute, prefix will be + NULL. For an xmlns="" attribute, uri will be NULL. */ typedef void (XMLCALL *XML_StartNamespaceDeclHandler) ( - void *userData, - const XML_Char *prefix, - const XML_Char *uri); + void *userData, + const XML_Char *prefix, + const XML_Char *uri); typedef void (XMLCALL *XML_EndNamespaceDeclHandler) ( - void *userData, - const XML_Char *prefix); + void *userData, + const XML_Char *prefix); /* This is called if the document is not standalone, that is, it has an - external subset or a reference to a parameter entity, but does not - have standalone="yes". If this handler returns XML_STATUS_ERROR, - then processing will not continue, and the parser will return a - XML_ERROR_NOT_STANDALONE error. - If parameter entity parsing is enabled, then in addition to the - conditions above this handler will only be called if the referenced - entity was actually read. + external subset or a reference to a parameter entity, but does not + have standalone="yes". If this handler returns XML_STATUS_ERROR, + then processing will not continue, and the parser will return a + XML_ERROR_NOT_STANDALONE error. + If parameter entity parsing is enabled, then in addition to the + conditions above this handler will only be called if the referenced + entity was actually read. */ typedef int (XMLCALL *XML_NotStandaloneHandler) (void *userData); /* This is called for a reference to an external parsed general - entity. The referenced entity is not automatically parsed. The - application can parse it immediately or later using - XML_ExternalEntityParserCreate. + entity. The referenced entity is not automatically parsed. The + application can parse it immediately or later using + XML_ExternalEntityParserCreate. - The parser argument is the parser parsing the entity containing the - reference; it can be passed as the parser argument to - XML_ExternalEntityParserCreate. The systemId argument is the - system identifier as specified in the entity declaration; it will - not be NULL. + The parser argument is the parser parsing the entity containing the + reference; it can be passed as the parser argument to + XML_ExternalEntityParserCreate. The systemId argument is the + system identifier as specified in the entity declaration; it will + not be NULL. - The base argument is the system identifier that should be used as - the base for resolving systemId if systemId was relative; this is - set by XML_SetBase; it may be NULL. + The base argument is the system identifier that should be used as + the base for resolving systemId if systemId was relative; this is + set by XML_SetBase; it may be NULL. - The publicId argument is the public identifier as specified in the - entity declaration, or NULL if none was specified; the whitespace - in the public identifier will have been normalized as required by - the XML spec. + The publicId argument is the public identifier as specified in the + entity declaration, or NULL if none was specified; the whitespace + in the public identifier will have been normalized as required by + the XML spec. - The context argument specifies the parsing context in the format - expected by the context argument to XML_ExternalEntityParserCreate; - context is valid only until the handler returns, so if the - referenced entity is to be parsed later, it must be copied. - context is NULL only when the entity is a parameter entity. + The context argument specifies the parsing context in the format + expected by the context argument to XML_ExternalEntityParserCreate; + context is valid only until the handler returns, so if the + referenced entity is to be parsed later, it must be copied. + context is NULL only when the entity is a parameter entity. - The handler should return XML_STATUS_ERROR if processing should not - continue because of a fatal error in the handling of the external - entity. In this case the calling parser will return an - XML_ERROR_EXTERNAL_ENTITY_HANDLING error. + The handler should return XML_STATUS_ERROR if processing should not + continue because of a fatal error in the handling of the external + entity. In this case the calling parser will return an + XML_ERROR_EXTERNAL_ENTITY_HANDLING error. - Note that unlike other handlers the first argument is the parser, - not userData. + Note that unlike other handlers the first argument is the parser, + not userData. */ typedef int (XMLCALL *XML_ExternalEntityRefHandler) ( - XML_Parser parser, - const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId); + XML_Parser parser, + const XML_Char *context, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId); /* This is called in two situations: - 1) An entity reference is encountered for which no declaration - has been read *and* this is not an error. - 2) An internal entity reference is read, but not expanded, because - XML_SetDefaultHandler has been called. - Note: skipped parameter entities in declarations and skipped general - entities in attribute values cannot be reported, because - the event would be out of sync with the reporting of the - declarations or attribute values + 1) An entity reference is encountered for which no declaration + has been read *and* this is not an error. + 2) An internal entity reference is read, but not expanded, because + XML_SetDefaultHandler has been called. + Note: skipped parameter entities in declarations and skipped general + entities in attribute values cannot be reported, because + the event would be out of sync with the reporting of the + declarations or attribute values */ typedef void (XMLCALL *XML_SkippedEntityHandler) ( - void *userData, - const XML_Char *entityName, - int is_parameter_entity); + void *userData, + const XML_Char *entityName, + int is_parameter_entity); /* This structure is filled in by the XML_UnknownEncodingHandler to - provide information to the parser about encodings that are unknown - to the parser. + provide information to the parser about encodings that are unknown + to the parser. - The map[b] member gives information about byte sequences whose - first byte is b. + The map[b] member gives information about byte sequences whose + first byte is b. - If map[b] is c where c is >= 0, then b by itself encodes the - Unicode scalar value c. + If map[b] is c where c is >= 0, then b by itself encodes the + Unicode scalar value c. - If map[b] is -1, then the byte sequence is malformed. + If map[b] is -1, then the byte sequence is malformed. - If map[b] is -n, where n >= 2, then b is the first byte of an - n-byte sequence that encodes a single Unicode scalar value. + If map[b] is -n, where n >= 2, then b is the first byte of an + n-byte sequence that encodes a single Unicode scalar value. - The data member will be passed as the first argument to the convert - function. + The data member will be passed as the first argument to the convert + function. - The convert function is used to convert multibyte sequences; s will - point to a n-byte sequence where map[(unsigned char)*s] == -n. The - convert function must return the Unicode scalar value represented - by this byte sequence or -1 if the byte sequence is malformed. + The convert function is used to convert multibyte sequences; s will + point to a n-byte sequence where map[(unsigned char)*s] == -n. The + convert function must return the Unicode scalar value represented + by this byte sequence or -1 if the byte sequence is malformed. - The convert function may be NULL if the encoding is a single-byte - encoding, that is if map[b] >= -1 for all bytes b. + The convert function may be NULL if the encoding is a single-byte + encoding, that is if map[b] >= -1 for all bytes b. - When the parser is finished with the encoding, then if release is - not NULL, it will call release passing it the data member; once - release has been called, the convert function will not be called - again. + When the parser is finished with the encoding, then if release is + not NULL, it will call release passing it the data member; once + release has been called, the convert function will not be called + again. - Expat places certain restrictions on the encodings that are supported - using this mechanism. + Expat places certain restrictions on the encodings that are supported + using this mechanism. - 1. Every ASCII character that can appear in a well-formed XML document, - other than the characters + 1. Every ASCII character that can appear in a well-formed XML document, + other than the characters - $@\^`{}~ + $@\^`{}~ - must be represented by a single byte, and that byte must be the - same byte that represents that character in ASCII. + must be represented by a single byte, and that byte must be the + same byte that represents that character in ASCII. - 2. No character may require more than 4 bytes to encode. + 2. No character may require more than 4 bytes to encode. - 3. All characters encoded must have Unicode scalar values <= - 0xFFFF, (i.e., characters that would be encoded by surrogates in - UTF-16 are not allowed). Note that this restriction doesn't - apply to the built-in support for UTF-8 and UTF-16. + 3. All characters encoded must have Unicode scalar values <= + 0xFFFF, (i.e., characters that would be encoded by surrogates in + UTF-16 are not allowed). Note that this restriction doesn't + apply to the built-in support for UTF-8 and UTF-16. - 4. No Unicode character may be encoded by more than one distinct - sequence of bytes. + 4. No Unicode character may be encoded by more than one distinct + sequence of bytes. */ typedef struct { - int map[256]; - void *data; - int (XMLCALL *convert)(void *data, const char *s); - void (XMLCALL *release)(void *data); + int map[256]; + void *data; + int (XMLCALL *convert)(void *data, const char *s); + void (XMLCALL *release)(void *data); } XML_Encoding; /* This is called for an encoding that is unknown to the parser. - The encodingHandlerData argument is that which was passed as the - second argument to XML_SetUnknownEncodingHandler. + The encodingHandlerData argument is that which was passed as the + second argument to XML_SetUnknownEncodingHandler. - The name argument gives the name of the encoding as specified in - the encoding declaration. + The name argument gives the name of the encoding as specified in + the encoding declaration. - If the callback can provide information about the encoding, it must - fill in the XML_Encoding structure, and return XML_STATUS_OK. - Otherwise it must return XML_STATUS_ERROR. + If the callback can provide information about the encoding, it must + fill in the XML_Encoding structure, and return XML_STATUS_OK. + Otherwise it must return XML_STATUS_ERROR. - If info does not describe a suitable encoding, then the parser will - return an XML_UNKNOWN_ENCODING error. + If info does not describe a suitable encoding, then the parser will + return an XML_UNKNOWN_ENCODING error. */ typedef int (XMLCALL *XML_UnknownEncodingHandler) ( - void *encodingHandlerData, - const XML_Char *name, - XML_Encoding *info); + void *encodingHandlerData, + const XML_Char *name, + XML_Encoding *info); XMLPARSEAPI(void) XML_SetElementHandler(XML_Parser parser, - XML_StartElementHandler start, - XML_EndElementHandler end); + XML_StartElementHandler start, + XML_EndElementHandler end); XMLPARSEAPI(void) XML_SetStartElementHandler(XML_Parser, XML_StartElementHandler); @@ -607,121 +607,121 @@ XML_SetEndElementHandler(XML_Parser, XML_EndElementHandler); XMLPARSEAPI(void) XML_SetCharacterDataHandler(XML_Parser parser, - XML_CharacterDataHandler handler); + XML_CharacterDataHandler handler); XMLPARSEAPI(void) XML_SetProcessingInstructionHandler(XML_Parser parser, - XML_ProcessingInstructionHandler handler); + XML_ProcessingInstructionHandler handler); XMLPARSEAPI(void) XML_SetCommentHandler(XML_Parser parser, - XML_CommentHandler handler); + XML_CommentHandler handler); XMLPARSEAPI(void) XML_SetCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start, - XML_EndCdataSectionHandler end); + XML_StartCdataSectionHandler start, + XML_EndCdataSectionHandler end); XMLPARSEAPI(void) XML_SetStartCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start); + XML_StartCdataSectionHandler start); XMLPARSEAPI(void) XML_SetEndCdataSectionHandler(XML_Parser parser, - XML_EndCdataSectionHandler end); + XML_EndCdataSectionHandler end); /* This sets the default handler and also inhibits expansion of - internal entities. These entity references will be passed to the - default handler, or to the skipped entity handler, if one is set. + internal entities. These entity references will be passed to the + default handler, or to the skipped entity handler, if one is set. */ XMLPARSEAPI(void) XML_SetDefaultHandler(XML_Parser parser, - XML_DefaultHandler handler); + XML_DefaultHandler handler); /* This sets the default handler but does not inhibit expansion of - internal entities. The entity reference will not be passed to the - default handler. + internal entities. The entity reference will not be passed to the + default handler. */ XMLPARSEAPI(void) XML_SetDefaultHandlerExpand(XML_Parser parser, - XML_DefaultHandler handler); + XML_DefaultHandler handler); XMLPARSEAPI(void) XML_SetDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start, - XML_EndDoctypeDeclHandler end); + XML_StartDoctypeDeclHandler start, + XML_EndDoctypeDeclHandler end); XMLPARSEAPI(void) XML_SetStartDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start); + XML_StartDoctypeDeclHandler start); XMLPARSEAPI(void) XML_SetEndDoctypeDeclHandler(XML_Parser parser, - XML_EndDoctypeDeclHandler end); + XML_EndDoctypeDeclHandler end); XMLPARSEAPI(void) XML_SetUnparsedEntityDeclHandler(XML_Parser parser, - XML_UnparsedEntityDeclHandler handler); + XML_UnparsedEntityDeclHandler handler); XMLPARSEAPI(void) XML_SetNotationDeclHandler(XML_Parser parser, - XML_NotationDeclHandler handler); + XML_NotationDeclHandler handler); XMLPARSEAPI(void) XML_SetNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start, - XML_EndNamespaceDeclHandler end); + XML_StartNamespaceDeclHandler start, + XML_EndNamespaceDeclHandler end); XMLPARSEAPI(void) XML_SetStartNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start); + XML_StartNamespaceDeclHandler start); XMLPARSEAPI(void) XML_SetEndNamespaceDeclHandler(XML_Parser parser, - XML_EndNamespaceDeclHandler end); + XML_EndNamespaceDeclHandler end); XMLPARSEAPI(void) XML_SetNotStandaloneHandler(XML_Parser parser, - XML_NotStandaloneHandler handler); + XML_NotStandaloneHandler handler); XMLPARSEAPI(void) XML_SetExternalEntityRefHandler(XML_Parser parser, - XML_ExternalEntityRefHandler handler); + XML_ExternalEntityRefHandler handler); /* If a non-NULL value for arg is specified here, then it will be - passed as the first argument to the external entity ref handler - instead of the parser object. + passed as the first argument to the external entity ref handler + instead of the parser object. */ XMLPARSEAPI(void) XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg); XMLPARSEAPI(void) XML_SetSkippedEntityHandler(XML_Parser parser, - XML_SkippedEntityHandler handler); + XML_SkippedEntityHandler handler); XMLPARSEAPI(void) XML_SetUnknownEncodingHandler(XML_Parser parser, - XML_UnknownEncodingHandler handler, - void *encodingHandlerData); + XML_UnknownEncodingHandler handler, + void *encodingHandlerData); /* This can be called within a handler for a start element, end - element, processing instruction or character data. It causes the - corresponding markup to be passed to the default handler. + element, processing instruction or character data. It causes the + corresponding markup to be passed to the default handler. */ XMLPARSEAPI(void) XML_DefaultCurrent(XML_Parser parser); /* If do_nst is non-zero, and namespace processing is in effect, and - a name has a prefix (i.e. an explicit namespace qualifier) then - that name is returned as a triplet in a single string separated by - the separator character specified when the parser was created: URI - + sep + local_name + sep + prefix. + a name has a prefix (i.e. an explicit namespace qualifier) then + that name is returned as a triplet in a single string separated by + the separator character specified when the parser was created: URI + + sep + local_name + sep + prefix. - If do_nst is zero, then namespace information is returned in the - default manner (URI + sep + local_name) whether or not the name - has a prefix. + If do_nst is zero, then namespace information is returned in the + default manner (URI + sep + local_name) whether or not the name + has a prefix. - Note: Calling XML_SetReturnNSTriplet after XML_Parse or - XML_ParseBuffer has no effect. + Note: Calling XML_SetReturnNSTriplet after XML_Parse or + XML_ParseBuffer has no effect. */ XMLPARSEAPI(void) @@ -735,47 +735,47 @@ XML_SetUserData(XML_Parser parser, void *userData); #define XML_GetUserData(parser) (*(void **)(parser)) /* This is equivalent to supplying an encoding argument to - XML_ParserCreate. On success XML_SetEncoding returns non-zero, - zero otherwise. - Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer - has no effect and returns XML_STATUS_ERROR. + XML_ParserCreate. On success XML_SetEncoding returns non-zero, + zero otherwise. + Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer + has no effect and returns XML_STATUS_ERROR. */ XMLPARSEAPI(enum XML_Status) XML_SetEncoding(XML_Parser parser, const XML_Char *encoding); /* If this function is called, then the parser will be passed as the - first argument to callbacks instead of userData. The userData will - still be accessible using XML_GetUserData. + first argument to callbacks instead of userData. The userData will + still be accessible using XML_GetUserData. */ XMLPARSEAPI(void) XML_UseParserAsHandlerArg(XML_Parser parser); /* If useDTD == XML_TRUE is passed to this function, then the parser - will assume that there is an external subset, even if none is - specified in the document. In such a case the parser will call the - externalEntityRefHandler with a value of NULL for the systemId - argument (the publicId and context arguments will be NULL as well). - Note: If this function is called, then this must be done before - the first call to XML_Parse or XML_ParseBuffer, since it will - have no effect after that. Returns - XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING. - Note: If the document does not have a DOCTYPE declaration at all, - then startDoctypeDeclHandler and endDoctypeDeclHandler will not - be called, despite an external subset being parsed. - Note: If XML_DTD is not defined when Expat is compiled, returns - XML_ERROR_FEATURE_REQUIRES_XML_DTD. + will assume that there is an external subset, even if none is + specified in the document. In such a case the parser will call the + externalEntityRefHandler with a value of NULL for the systemId + argument (the publicId and context arguments will be NULL as well). + Note: If this function is called, then this must be done before + the first call to XML_Parse or XML_ParseBuffer, since it will + have no effect after that. Returns + XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING. + Note: If the document does not have a DOCTYPE declaration at all, + then startDoctypeDeclHandler and endDoctypeDeclHandler will not + be called, despite an external subset being parsed. + Note: If XML_DTD is not defined when Expat is compiled, returns + XML_ERROR_FEATURE_REQUIRES_XML_DTD. */ XMLPARSEAPI(enum XML_Error) XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD); /* Sets the base to be used for resolving relative URIs in system - identifiers in declarations. Resolving relative identifiers is - left to the application: this value will be passed through as the - base argument to the XML_ExternalEntityRefHandler, - XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base - argument will be copied. Returns XML_STATUS_ERROR if out of memory, - XML_STATUS_OK otherwise. + identifiers in declarations. Resolving relative identifiers is + left to the application: this value will be passed through as the + base argument to the XML_ExternalEntityRefHandler, + XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base + argument will be copied. Returns XML_STATUS_ERROR if out of memory, + XML_STATUS_OK otherwise. */ XMLPARSEAPI(enum XML_Status) XML_SetBase(XML_Parser parser, const XML_Char *base); @@ -784,30 +784,30 @@ XMLPARSEAPI(const XML_Char *) XML_GetBase(XML_Parser parser); /* Returns the number of the attribute/value pairs passed in last call - to the XML_StartElementHandler that were specified in the start-tag - rather than defaulted. Each attribute/value pair counts as 2; thus - this correspondds to an index into the atts array passed to the - XML_StartElementHandler. + to the XML_StartElementHandler that were specified in the start-tag + rather than defaulted. Each attribute/value pair counts as 2; thus + this correspondds to an index into the atts array passed to the + XML_StartElementHandler. */ XMLPARSEAPI(int) XML_GetSpecifiedAttributeCount(XML_Parser parser); /* Returns the index of the ID attribute passed in the last call to - XML_StartElementHandler, or -1 if there is no ID attribute. Each - attribute/value pair counts as 2; thus this correspondds to an - index into the atts array passed to the XML_StartElementHandler. + XML_StartElementHandler, or -1 if there is no ID attribute. Each + attribute/value pair counts as 2; thus this correspondds to an + index into the atts array passed to the XML_StartElementHandler. */ XMLPARSEAPI(int) XML_GetIdAttributeIndex(XML_Parser parser); /* Parses some input. Returns XML_STATUS_ERROR if a fatal error is - detected. The last call to XML_Parse must have isFinal true; len - may be zero for this call (or any other). + detected. The last call to XML_Parse must have isFinal true; len + may be zero for this call (or any other). - Though the return values for these functions has always been - described as a Boolean value, the implementation, at least for the - 1.95.x series, has always returned exactly one of the XML_Status - values. + Though the return values for these functions has always been + described as a Boolean value, the implementation, at least for the + 1.95.x series, has always returned exactly one of the XML_Status + values. */ XMLPARSEAPI(enum XML_Status) XML_Parse(XML_Parser parser, const char *s, int len, int isFinal); @@ -819,110 +819,110 @@ XMLPARSEAPI(enum XML_Status) XML_ParseBuffer(XML_Parser parser, int len, int isFinal); /* Creates an XML_Parser object that can parse an external general - entity; context is a '\0'-terminated string specifying the parse - context; encoding is a '\0'-terminated string giving the name of - the externally specified encoding, or NULL if there is no - externally specified encoding. The context string consists of a - sequence of tokens separated by formfeeds (\f); a token consisting - of a name specifies that the general entity of the name is open; a - token of the form prefix=uri specifies the namespace for a - particular prefix; a token of the form =uri specifies the default - namespace. This can be called at any point after the first call to - an ExternalEntityRefHandler so longer as the parser has not yet - been freed. The new parser is completely independent and may - safely be used in a separate thread. The handlers and userData are - initialized from the parser argument. Returns NULL if out of memory. - Otherwise returns a new XML_Parser object. + entity; context is a '\0'-terminated string specifying the parse + context; encoding is a '\0'-terminated string giving the name of + the externally specified encoding, or NULL if there is no + externally specified encoding. The context string consists of a + sequence of tokens separated by formfeeds (\f); a token consisting + of a name specifies that the general entity of the name is open; a + token of the form prefix=uri specifies the namespace for a + particular prefix; a token of the form =uri specifies the default + namespace. This can be called at any point after the first call to + an ExternalEntityRefHandler so longer as the parser has not yet + been freed. The new parser is completely independent and may + safely be used in a separate thread. The handlers and userData are + initialized from the parser argument. Returns NULL if out of memory. + Otherwise returns a new XML_Parser object. */ XMLPARSEAPI(XML_Parser) XML_ExternalEntityParserCreate(XML_Parser parser, - const XML_Char *context, - const XML_Char *encoding); + const XML_Char *context, + const XML_Char *encoding); enum XML_ParamEntityParsing { - XML_PARAM_ENTITY_PARSING_NEVER, - XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE, - XML_PARAM_ENTITY_PARSING_ALWAYS + XML_PARAM_ENTITY_PARSING_NEVER, + XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE, + XML_PARAM_ENTITY_PARSING_ALWAYS }; /* Controls parsing of parameter entities (including the external DTD - subset). If parsing of parameter entities is enabled, then - references to external parameter entities (including the external - DTD subset) will be passed to the handler set with - XML_SetExternalEntityRefHandler. The context passed will be 0. + subset). If parsing of parameter entities is enabled, then + references to external parameter entities (including the external + DTD subset) will be passed to the handler set with + XML_SetExternalEntityRefHandler. The context passed will be 0. - Unlike external general entities, external parameter entities can - only be parsed synchronously. If the external parameter entity is - to be parsed, it must be parsed during the call to the external - entity ref handler: the complete sequence of - XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and - XML_ParserFree calls must be made during this call. After - XML_ExternalEntityParserCreate has been called to create the parser - for the external parameter entity (context must be 0 for this - call), it is illegal to make any calls on the old parser until - XML_ParserFree has been called on the newly created parser. - If the library has been compiled without support for parameter - entity parsing (ie without XML_DTD being defined), then - XML_SetParamEntityParsing will return 0 if parsing of parameter - entities is requested; otherwise it will return non-zero. - Note: If XML_SetParamEntityParsing is called after XML_Parse or - XML_ParseBuffer, then it has no effect and will always return 0. + Unlike external general entities, external parameter entities can + only be parsed synchronously. If the external parameter entity is + to be parsed, it must be parsed during the call to the external + entity ref handler: the complete sequence of + XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and + XML_ParserFree calls must be made during this call. After + XML_ExternalEntityParserCreate has been called to create the parser + for the external parameter entity (context must be 0 for this + call), it is illegal to make any calls on the old parser until + XML_ParserFree has been called on the newly created parser. + If the library has been compiled without support for parameter + entity parsing (ie without XML_DTD being defined), then + XML_SetParamEntityParsing will return 0 if parsing of parameter + entities is requested; otherwise it will return non-zero. + Note: If XML_SetParamEntityParsing is called after XML_Parse or + XML_ParseBuffer, then it has no effect and will always return 0. */ XMLPARSEAPI(int) XML_SetParamEntityParsing(XML_Parser parser, - enum XML_ParamEntityParsing parsing); + enum XML_ParamEntityParsing parsing); /* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then - XML_GetErrorCode returns information about the error. + XML_GetErrorCode returns information about the error. */ XMLPARSEAPI(enum XML_Error) XML_GetErrorCode(XML_Parser parser); /* These functions return information about the current parse - location. They may be called from any callback called to report - some parse event; in this case the location is the location of the - first of the sequence of characters that generated the event. When - called from callbacks generated by declarations in the document - prologue, the location identified isn't as neatly defined, but will - be within the relevant markup. When called outside of the callback - functions, the position indicated will be just past the last parse - event (regardless of whether there was an associated callback). - - They may also be called after returning from a call to XML_Parse - or XML_ParseBuffer. If the return value is XML_STATUS_ERROR then - the location is the location of the character at which the error - was detected; otherwise the location is the location of the last - parse event, as described above. + location. They may be called from any callback called to report + some parse event; in this case the location is the location of the + first of the sequence of characters that generated the event. When + called from callbacks generated by declarations in the document + prologue, the location identified isn't as neatly defined, but will + be within the relevant markup. When called outside of the callback + functions, the position indicated will be just past the last parse + event (regardless of whether there was an associated callback). + + They may also be called after returning from a call to XML_Parse + or XML_ParseBuffer. If the return value is XML_STATUS_ERROR then + the location is the location of the character at which the error + was detected; otherwise the location is the location of the last + parse event, as described above. */ XMLPARSEAPI(int) XML_GetCurrentLineNumber(XML_Parser parser); XMLPARSEAPI(int) XML_GetCurrentColumnNumber(XML_Parser parser); XMLPARSEAPI(long) XML_GetCurrentByteIndex(XML_Parser parser); /* Return the number of bytes in the current event. - Returns 0 if the event is in an internal entity. + Returns 0 if the event is in an internal entity. */ XMLPARSEAPI(int) XML_GetCurrentByteCount(XML_Parser parser); /* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets - the integer pointed to by offset to the offset within this buffer - of the current parse position, and sets the integer pointed to by size - to the size of this buffer (the number of input bytes). Otherwise - returns a NULL pointer. Also returns a NULL pointer if a parse isn't - active. + the integer pointed to by offset to the offset within this buffer + of the current parse position, and sets the integer pointed to by size + to the size of this buffer (the number of input bytes). Otherwise + returns a NULL pointer. Also returns a NULL pointer if a parse isn't + active. - NOTE: The character pointer returned should not be used outside - the handler that makes the call. + NOTE: The character pointer returned should not be used outside + the handler that makes the call. */ XMLPARSEAPI(const char *) XML_GetInputContext(XML_Parser parser, - int *offset, - int *size); + int *offset, + int *size); /* For backwards compatibility with previous versions. */ -#define XML_GetErrorLineNumber XML_GetCurrentLineNumber +#define XML_GetErrorLineNumber XML_GetCurrentLineNumber #define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber -#define XML_GetErrorByteIndex XML_GetCurrentByteIndex +#define XML_GetErrorByteIndex XML_GetCurrentByteIndex /* Frees the content model passed to the element declaration handler */ XMLPARSEAPI(void) @@ -951,34 +951,34 @@ XMLPARSEAPI(const XML_LChar *) XML_ExpatVersion(void); typedef struct { - int major; - int minor; - int micro; + int major; + int minor; + int micro; } XML_Expat_Version; /* Return an XML_Expat_Version structure containing numeric version - number information for this version of expat. + number information for this version of expat. */ XMLPARSEAPI(XML_Expat_Version) XML_ExpatVersionInfo(void); /* Added in Expat 1.95.5. */ enum XML_FeatureEnum { - XML_FEATURE_END = 0, - XML_FEATURE_UNICODE, - XML_FEATURE_UNICODE_WCHAR_T, - XML_FEATURE_DTD, - XML_FEATURE_CONTEXT_BYTES, - XML_FEATURE_MIN_SIZE, - XML_FEATURE_SIZEOF_XML_CHAR, - XML_FEATURE_SIZEOF_XML_LCHAR - /* Additional features must be added to the end of this enum. */ + XML_FEATURE_END = 0, + XML_FEATURE_UNICODE, + XML_FEATURE_UNICODE_WCHAR_T, + XML_FEATURE_DTD, + XML_FEATURE_CONTEXT_BYTES, + XML_FEATURE_MIN_SIZE, + XML_FEATURE_SIZEOF_XML_CHAR, + XML_FEATURE_SIZEOF_XML_LCHAR + /* Additional features must be added to the end of this enum. */ }; typedef struct { - enum XML_FeatureEnum feature; - const XML_LChar *name; - long int value; + enum XML_FeatureEnum feature; + const XML_LChar *name; + long int value; } XML_Feature; XMLPARSEAPI(const XML_Feature *) @@ -986,9 +986,9 @@ XML_GetFeatureList(void); /* Expat follows the GNU/Linux convention of odd number minor version for - beta/development releases and even number minor version for stable - releases. Micro is bumped with each release, and set to 0 with each - change to major or minor version. + beta/development releases and even number minor version for stable + releases. Micro is bumped with each release, and set to 0 with each + change to major or minor version. */ #define XML_MAJOR_VERSION 1 #define XML_MINOR_VERSION 95 diff --git a/Standard Gaming Platform/flic.h b/Standard Gaming Platform/flic.h index 556f50b1..a0b9b4a9 100644 --- a/Standard Gaming Platform/flic.h +++ b/Standard Gaming Platform/flic.h @@ -26,7 +26,7 @@ // //************************************************************************** -#define ErrFlicLibAccess -1 +#define ErrFlicLibAccess -1 #define ErrFlicAccess -2 #define ErrFlicSeek -3 #define ErrFlicRead -4 @@ -76,7 +76,7 @@ typedef struct Ushort frames; /* Number of frames in flic. */ Ushort width; /* Flic width in pixels. */ Ushort height; /* Flic height in pixels. */ - Ushort depth; /* Bits per pixel. (Always 8 now.) */ + Ushort depth; /* Bits per pixel. (Always 8 now.) */ Ushort flags; /* FLI_FINISHED | FLI_LOOPED ideally. */ Long speed; /* Delay between frames. */ Short reserved1; /* Set to zero. */ @@ -104,38 +104,38 @@ typedef struct { Pixel *pixels; /* Set to AOOO:0000 for hardware. */ int width, height; /* Dimensions of screen. (320x200) */ - char change_palette; /*True means that the flic changes the palette */ + char change_palette; /*True means that the flic changes the palette */ } FlicScreen; /* Device specific screen type. */ typedef struct { - Ulong max_loop_count, + Ulong max_loop_count, loop_count; - Ushort max_frame_index, - frame_index; + Ushort max_frame_index, + frame_index; } FlicFrameStatus; typedef struct { -// lmlib_t *names; - long offset, - length; +// lmlib_t *names; + long offset, + length; }FlicLib; typedef struct _Flic { - FlicHead head; /* Flic file header. */ - FILE *file; /* File handle. */ - const char *name; /* Name from flic_open. Helps error reporting. */ - int xoff,yoff; /* Offset to display flic at. */ + FlicHead head; /* Flic file header. */ + FILE *file; /* File handle. */ + const char *name; /* Name from flic_open. Helps error reporting. */ + int xoff,yoff; /* Offset to display flic at. */ - FlicFrameStatus status; - FlicScreen screen; - FlicLib lib; + FlicFrameStatus status; + FlicScreen screen; + FlicLib lib; - FlicOpenFunc *open; - FlicCheckFrameFunc *check_frame; - FlicSeekFunc *seek; + FlicOpenFunc *open; + FlicCheckFrameFunc *check_frame; + FlicSeekFunc *seek; } Flic; @@ -144,7 +144,7 @@ typedef struct _Flic #define FLC_TYPE 0xAF12u /* Variable rez .FLC type ID */ /* Values for FlicHead.flags */ #define FLI_FINISHED 0x0001 -#define FLI_LOOPED 0x0002 +#define FLI_LOOPED 0x0002 /* Optional Prefix Header */ typedef struct @@ -156,7 +156,7 @@ typedef struct } PrefixHead; /* Value for PrefixHead.type */ -#define PREFIX_TYPE 0xF100u +#define PREFIX_TYPE 0xF100u /* Frame Header */ typedef struct @@ -205,9 +205,9 @@ void FlicSetOrigin(Flic *flic, unsigned x, unsigned y); ErrCode FlicPlay(Flic *flic, Ulong max_loop); void FlicClose(Flic *flic); void FlicSeekFirst(Flic *flic); -int FlicAdvance(Flic *flic, BOOL fDecode); -int FlicAdvanceNoDecode(Flic *flic); -int FlicStart(char *filename, int width, int height, char *buffer, Flic *flic, char usepal); +int FlicAdvance(Flic *flic, BOOL fDecode); +int FlicAdvanceNoDecode(Flic *flic); +int FlicStart(char *filename, int width, int height, char *buffer, Flic *flic, char usepal); void FlicStop(Flic *flic); ErrCode FlicGetStats(char *filename, int width, int height, Flic *flic, int *piBufferSize, int *piColourPalSize); ErrCode FlicGetColourPalette(CHAR *filename, int width, int height, CHAR **ppBuffer, INT *piNumColours); diff --git a/Standard Gaming Platform/fmod.h b/Standard Gaming Platform/fmod.h index 1b85eec9..f5003e1e 100644 --- a/Standard Gaming Platform/fmod.h +++ b/Standard Gaming Platform/fmod.h @@ -1,304 +1,304 @@ /* ========================================================================================== */ -/* FMOD Main header file. Copyright (c), Firelight Technologies Pty, Ltd. 1999-2004. */ +/* FMOD Main header file. Copyright (c), Firelight Technologies Pty, Ltd. 1999-2004. */ /* ========================================================================================== */ #ifndef _FMOD_H_ #define _FMOD_H_ /* ========================================================================================== */ -/* DEFINITIONS */ +/* DEFINITIONS */ /* ========================================================================================== */ #if (!defined(WIN32) && !defined(_WIN32) && !defined(__WIN32__) && !defined(_WIN64) && !defined(_WIN32_WCE) && !defined(_XBOX)) || (defined(__GNUC__) && defined(WIN32)) - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __stdcall - #define __stdcall - #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __stdcall + #define __stdcall + #endif #endif #if defined(_WIN32_WCE) - #define F_API _cdecl - #define F_CALLBACKAPI _cdecl + #define F_API _cdecl + #define F_CALLBACKAPI _cdecl #else - #define F_API __stdcall - #define F_CALLBACKAPI __stdcall + #define F_API __stdcall + #define F_CALLBACKAPI __stdcall #endif #ifdef DLL_EXPORTS - #define DLL_API __declspec(dllexport) + #define DLL_API __declspec(dllexport) #else - #if defined(__LCC__) || defined(__MINGW32__) || defined(__CYGWIN32__) - #define DLL_API F_API - #else - #define DLL_API - #endif /* __LCC__ || __MINGW32__ || __CYGWIN32__ */ + #if defined(__LCC__) || defined(__MINGW32__) || defined(__CYGWIN32__) + #define DLL_API F_API + #else + #define DLL_API + #endif /* __LCC__ || __MINGW32__ || __CYGWIN32__ */ #endif /* DLL_EXPORTS */ -#define FMOD_VERSION 3.75f +#define FMOD_VERSION 3.75f /* - FMOD defined types + FMOD defined types */ -typedef struct FSOUND_SAMPLE FSOUND_SAMPLE; -typedef struct FSOUND_STREAM FSOUND_STREAM; -typedef struct FSOUND_DSPUNIT FSOUND_DSPUNIT; +typedef struct FSOUND_SAMPLE FSOUND_SAMPLE; +typedef struct FSOUND_STREAM FSOUND_STREAM; +typedef struct FSOUND_DSPUNIT FSOUND_DSPUNIT; typedef struct FSOUND_SYNCPOINT FSOUND_SYNCPOINT; -typedef struct FMUSIC_MODULE FMUSIC_MODULE; +typedef struct FMUSIC_MODULE FMUSIC_MODULE; /* - Callback types + Callback types */ -typedef void * (F_CALLBACKAPI *FSOUND_OPENCALLBACK) (const STR8 name); -typedef void (F_CALLBACKAPI *FSOUND_CLOSECALLBACK) (void *handle); -typedef int (F_CALLBACKAPI *FSOUND_READCALLBACK) (void *buffer, int size, void *handle); -typedef int (F_CALLBACKAPI *FSOUND_SEEKCALLBACK) (void *handle, int pos, signed char mode); -typedef int (F_CALLBACKAPI *FSOUND_TELLCALLBACK) (void *handle); +typedef void * (F_CALLBACKAPI *FSOUND_OPENCALLBACK) (const STR8 name); +typedef void (F_CALLBACKAPI *FSOUND_CLOSECALLBACK) (void *handle); +typedef int (F_CALLBACKAPI *FSOUND_READCALLBACK) (void *buffer, int size, void *handle); +typedef int (F_CALLBACKAPI *FSOUND_SEEKCALLBACK) (void *handle, int pos, signed char mode); +typedef int (F_CALLBACKAPI *FSOUND_TELLCALLBACK) (void *handle); -typedef void * (F_CALLBACKAPI *FSOUND_ALLOCCALLBACK) (unsigned int size); -typedef void * (F_CALLBACKAPI *FSOUND_REALLOCCALLBACK) (void *ptr, unsigned int size); -typedef void (F_CALLBACKAPI *FSOUND_FREECALLBACK) (void *ptr); +typedef void * (F_CALLBACKAPI *FSOUND_ALLOCCALLBACK) (unsigned int size); +typedef void * (F_CALLBACKAPI *FSOUND_REALLOCCALLBACK) (void *ptr, unsigned int size); +typedef void (F_CALLBACKAPI *FSOUND_FREECALLBACK) (void *ptr); -typedef void * (F_CALLBACKAPI *FSOUND_DSPCALLBACK) (void *originalbuffer, void *newbuffer, int length, void *userdata); -typedef signed char (F_CALLBACKAPI *FSOUND_STREAMCALLBACK) (FSOUND_STREAM *stream, void *buff, int len, void *userdata); +typedef void * (F_CALLBACKAPI *FSOUND_DSPCALLBACK) (void *originalbuffer, void *newbuffer, int length, void *userdata); +typedef signed char (F_CALLBACKAPI *FSOUND_STREAMCALLBACK) (FSOUND_STREAM *stream, void *buff, int len, void *userdata); typedef signed char (F_CALLBACKAPI *FSOUND_METADATACALLBACK)(STR8 name, STR8 value, void *userdata); -typedef void (F_CALLBACKAPI *FMUSIC_CALLBACK) (FMUSIC_MODULE *mod, unsigned char param); +typedef void (F_CALLBACKAPI *FMUSIC_CALLBACK) (FMUSIC_MODULE *mod, unsigned char param); /* [ENUM] [ - [DESCRIPTION] - On failure of commands in FMOD, use FSOUND_GetError to attain what happened. - - [SEE_ALSO] - FSOUND_GetError + [DESCRIPTION] + On failure of commands in FMOD, use FSOUND_GetError to attain what happened. + + [SEE_ALSO] + FSOUND_GetError ] */ enum FMOD_ERRORS { - FMOD_ERR_NONE, /* No errors */ - FMOD_ERR_BUSY, /* Cannot call this command after FSOUND_Init. Call FSOUND_Close first. */ - FMOD_ERR_UNINITIALIZED, /* This command failed because FSOUND_Init or FSOUND_SetOutput was not called */ - FMOD_ERR_INIT, /* Error initializing output device. */ - FMOD_ERR_ALLOCATED, /* Error initializing output device, but more specifically, the output device is already in use and cannot be reused. */ - FMOD_ERR_PLAY, /* Playing the sound failed. */ - FMOD_ERR_OUTPUT_FORMAT, /* Soundcard does not support the features needed for this soundsystem (16bit stereo output) */ - FMOD_ERR_COOPERATIVELEVEL, /* Error setting cooperative level for hardware. */ - FMOD_ERR_CREATEBUFFER, /* Error creating hardware sound buffer. */ - FMOD_ERR_FILE_NOTFOUND, /* File not found */ - FMOD_ERR_FILE_FORMAT, /* Unknown file format */ - FMOD_ERR_FILE_BAD, /* Error loading file */ - FMOD_ERR_MEMORY, /* Not enough memory or resources */ - FMOD_ERR_VERSION, /* The version number of this file format is not supported */ - FMOD_ERR_INVALID_PARAM, /* An invalid parameter was passed to this function */ - FMOD_ERR_NO_EAX, /* Tried to use an EAX command on a non EAX enabled channel or output. */ - FMOD_ERR_CHANNEL_ALLOC, /* Failed to allocate a new channel */ - FMOD_ERR_RECORD, /* Recording is not supported on this machine */ - FMOD_ERR_MEDIAPLAYER, /* Windows Media Player not installed so cannot play wma or use internet streaming. */ - FMOD_ERR_CDDEVICE /* An error occured trying to open the specified CD device */ + FMOD_ERR_NONE, /* No errors */ + FMOD_ERR_BUSY, /* Cannot call this command after FSOUND_Init. Call FSOUND_Close first. */ + FMOD_ERR_UNINITIALIZED, /* This command failed because FSOUND_Init or FSOUND_SetOutput was not called */ + FMOD_ERR_INIT, /* Error initializing output device. */ + FMOD_ERR_ALLOCATED, /* Error initializing output device, but more specifically, the output device is already in use and cannot be reused. */ + FMOD_ERR_PLAY, /* Playing the sound failed. */ + FMOD_ERR_OUTPUT_FORMAT, /* Soundcard does not support the features needed for this soundsystem (16bit stereo output) */ + FMOD_ERR_COOPERATIVELEVEL, /* Error setting cooperative level for hardware. */ + FMOD_ERR_CREATEBUFFER, /* Error creating hardware sound buffer. */ + FMOD_ERR_FILE_NOTFOUND, /* File not found */ + FMOD_ERR_FILE_FORMAT, /* Unknown file format */ + FMOD_ERR_FILE_BAD, /* Error loading file */ + FMOD_ERR_MEMORY, /* Not enough memory or resources */ + FMOD_ERR_VERSION, /* The version number of this file format is not supported */ + FMOD_ERR_INVALID_PARAM, /* An invalid parameter was passed to this function */ + FMOD_ERR_NO_EAX, /* Tried to use an EAX command on a non EAX enabled channel or output. */ + FMOD_ERR_CHANNEL_ALLOC, /* Failed to allocate a new channel */ + FMOD_ERR_RECORD, /* Recording is not supported on this machine */ + FMOD_ERR_MEDIAPLAYER, /* Windows Media Player not installed so cannot play wma or use internet streaming. */ + FMOD_ERR_CDDEVICE /* An error occured trying to open the specified CD device */ }; /* [ENUM] [ - [DESCRIPTION] - These output types are used with FSOUND_SetOutput, to choose which output driver to use. - - FSOUND_OUTPUT_DSOUND will not support hardware 3d acceleration if the sound card driver - does not support DirectX 6 Voice Manager Extensions. + [DESCRIPTION] + These output types are used with FSOUND_SetOutput, to choose which output driver to use. + + FSOUND_OUTPUT_DSOUND will not support hardware 3d acceleration if the sound card driver + does not support DirectX 6 Voice Manager Extensions. - FSOUND_OUTPUT_WINMM is recommended for NT and CE. + FSOUND_OUTPUT_WINMM is recommended for NT and CE. - [SEE_ALSO] - FSOUND_SetOutput - FSOUND_GetOutput + [SEE_ALSO] + FSOUND_SetOutput + FSOUND_GetOutput ] */ enum FSOUND_OUTPUTTYPES { - FSOUND_OUTPUT_NOSOUND, /* NoSound driver, all calls to this succeed but do nothing. */ - FSOUND_OUTPUT_WINMM, /* Windows Multimedia driver. */ - FSOUND_OUTPUT_DSOUND, /* DirectSound driver. You need this to get EAX2 or EAX3 support, or FX api support. */ - FSOUND_OUTPUT_A3D, /* A3D driver. */ + FSOUND_OUTPUT_NOSOUND, /* NoSound driver, all calls to this succeed but do nothing. */ + FSOUND_OUTPUT_WINMM, /* Windows Multimedia driver. */ + FSOUND_OUTPUT_DSOUND, /* DirectSound driver. You need this to get EAX2 or EAX3 support, or FX api support. */ + FSOUND_OUTPUT_A3D, /* A3D driver. */ - FSOUND_OUTPUT_OSS, /* Linux/Unix OSS (Open Sound System) driver, i.e. the kernel sound drivers. */ - FSOUND_OUTPUT_ESD, /* Linux/Unix ESD (Enlightment Sound Daemon) driver. */ - FSOUND_OUTPUT_ALSA, /* Linux Alsa driver. */ + FSOUND_OUTPUT_OSS, /* Linux/Unix OSS (Open Sound System) driver, i.e. the kernel sound drivers. */ + FSOUND_OUTPUT_ESD, /* Linux/Unix ESD (Enlightment Sound Daemon) driver. */ + FSOUND_OUTPUT_ALSA, /* Linux Alsa driver. */ - FSOUND_OUTPUT_ASIO, /* Low latency ASIO driver */ - FSOUND_OUTPUT_XBOX, /* Xbox driver */ - FSOUND_OUTPUT_PS2, /* PlayStation 2 driver */ - FSOUND_OUTPUT_MAC, /* Mac SoundManager driver */ - FSOUND_OUTPUT_GC, /* Gamecube driver */ - FSOUND_OUTPUT_PSP, /* PlayStation Portable driver */ + FSOUND_OUTPUT_ASIO, /* Low latency ASIO driver */ + FSOUND_OUTPUT_XBOX, /* Xbox driver */ + FSOUND_OUTPUT_PS2, /* PlayStation 2 driver */ + FSOUND_OUTPUT_MAC, /* Mac SoundManager driver */ + FSOUND_OUTPUT_GC, /* Gamecube driver */ + FSOUND_OUTPUT_PSP, /* PlayStation Portable driver */ - FSOUND_OUTPUT_NOSOUND_NONREALTIME /* This is the same as nosound, but the sound generation is driven by FSOUND_Update */ + FSOUND_OUTPUT_NOSOUND_NONREALTIME /* This is the same as nosound, but the sound generation is driven by FSOUND_Update */ }; /* [ENUM] [ - [DESCRIPTION] - These mixer types are used with FSOUND_SetMixer, to choose which mixer to use, or to act - upon for other reasons using FSOUND_GetMixer. - It is not nescessary to set the mixer. FMOD will autodetect the best mixer for you. + [DESCRIPTION] + These mixer types are used with FSOUND_SetMixer, to choose which mixer to use, or to act + upon for other reasons using FSOUND_GetMixer. + It is not nescessary to set the mixer. FMOD will autodetect the best mixer for you. - [SEE_ALSO] - FSOUND_SetMixer - FSOUND_GetMixer + [SEE_ALSO] + FSOUND_SetMixer + FSOUND_GetMixer ] */ enum FSOUND_MIXERTYPES { - FSOUND_MIXER_AUTODETECT, /* CE/PS2/GC Only - Non interpolating/low quality mixer. */ - FSOUND_MIXER_BLENDMODE, /* Removed / obsolete. */ - FSOUND_MIXER_MMXP5, /* Removed / obsolete. */ - FSOUND_MIXER_MMXP6, /* Removed / obsolete. */ + FSOUND_MIXER_AUTODETECT, /* CE/PS2/GC Only - Non interpolating/low quality mixer. */ + FSOUND_MIXER_BLENDMODE, /* Removed / obsolete. */ + FSOUND_MIXER_MMXP5, /* Removed / obsolete. */ + FSOUND_MIXER_MMXP6, /* Removed / obsolete. */ - FSOUND_MIXER_QUALITY_AUTODETECT,/* All platforms - Autodetect the fastest quality mixer based on your cpu. */ - FSOUND_MIXER_QUALITY_FPU, /* Win32/Linux only - Interpolating/volume ramping FPU mixer. */ - FSOUND_MIXER_QUALITY_MMXP5, /* Win32/Linux only - Interpolating/volume ramping P5 MMX mixer. */ - FSOUND_MIXER_QUALITY_MMXP6, /* Win32/Linux only - Interpolating/volume ramping ppro+ MMX mixer. */ + FSOUND_MIXER_QUALITY_AUTODETECT,/* All platforms - Autodetect the fastest quality mixer based on your cpu. */ + FSOUND_MIXER_QUALITY_FPU, /* Win32/Linux only - Interpolating/volume ramping FPU mixer. */ + FSOUND_MIXER_QUALITY_MMXP5, /* Win32/Linux only - Interpolating/volume ramping P5 MMX mixer. */ + FSOUND_MIXER_QUALITY_MMXP6, /* Win32/Linux only - Interpolating/volume ramping ppro+ MMX mixer. */ - FSOUND_MIXER_MONO, /* CE/PS2/GC only - MONO non interpolating/low quality mixer. For speed*/ - FSOUND_MIXER_QUALITY_MONO, /* CE/PS2/GC only - MONO Interpolating mixer. For speed */ + FSOUND_MIXER_MONO, /* CE/PS2/GC only - MONO non interpolating/low quality mixer. For speed*/ + FSOUND_MIXER_QUALITY_MONO, /* CE/PS2/GC only - MONO Interpolating mixer. For speed */ - FSOUND_MIXER_MAX + FSOUND_MIXER_MAX }; /* [ENUM] [ - [DESCRIPTION] - These definitions describe the type of song being played. + [DESCRIPTION] + These definitions describe the type of song being played. - [SEE_ALSO] - FMUSIC_GetType + [SEE_ALSO] + FMUSIC_GetType ] */ enum FMUSIC_TYPES { - FMUSIC_TYPE_NONE, - FMUSIC_TYPE_MOD, /* Protracker / Fasttracker */ - FMUSIC_TYPE_S3M, /* ScreamTracker 3 */ - FMUSIC_TYPE_XM, /* FastTracker 2 */ - FMUSIC_TYPE_IT, /* Impulse Tracker. */ - FMUSIC_TYPE_MIDI, /* MIDI file */ - FMUSIC_TYPE_FSB /* FMOD Sample Bank file */ + FMUSIC_TYPE_NONE, + FMUSIC_TYPE_MOD, /* Protracker / Fasttracker */ + FMUSIC_TYPE_S3M, /* ScreamTracker 3 */ + FMUSIC_TYPE_XM, /* FastTracker 2 */ + FMUSIC_TYPE_IT, /* Impulse Tracker. */ + FMUSIC_TYPE_MIDI, /* MIDI file */ + FMUSIC_TYPE_FSB /* FMOD Sample Bank file */ }; /* [DEFINE_START] [ - [NAME] - FSOUND_DSP_PRIORITIES + [NAME] + FSOUND_DSP_PRIORITIES - [DESCRIPTION] - These default priorities are used by FMOD internal system DSP units. They describe the - position of the DSP chain, and the order of how audio processing is executed. - You can actually through the use of FSOUND_DSP_GetxxxUnit (where xxx is the name of the DSP - unit), disable or even change the priority of a DSP unit. + [DESCRIPTION] + These default priorities are used by FMOD internal system DSP units. They describe the + position of the DSP chain, and the order of how audio processing is executed. + You can actually through the use of FSOUND_DSP_GetxxxUnit (where xxx is the name of the DSP + unit), disable or even change the priority of a DSP unit. - [SEE_ALSO] - FSOUND_DSP_Create - FSOUND_DSP_SetPriority - FSOUND_DSP_GetSpectrum + [SEE_ALSO] + FSOUND_DSP_Create + FSOUND_DSP_SetPriority + FSOUND_DSP_GetSpectrum ] */ -#define FSOUND_DSP_DEFAULTPRIORITY_CLEARUNIT 0 /* DSP CLEAR unit - done first */ -#define FSOUND_DSP_DEFAULTPRIORITY_SFXUNIT 100 /* DSP SFX unit - done second */ -#define FSOUND_DSP_DEFAULTPRIORITY_MUSICUNIT 200 /* DSP MUSIC unit - done third */ -#define FSOUND_DSP_DEFAULTPRIORITY_USER 300 /* User priority, use this as reference for your own DSP units */ -#define FSOUND_DSP_DEFAULTPRIORITY_FFTUNIT 900 /* This reads data for FSOUND_DSP_GetSpectrum, so it comes after user units */ -#define FSOUND_DSP_DEFAULTPRIORITY_CLIPANDCOPYUNIT 1000 /* DSP CLIP AND COPY unit - last */ +#define FSOUND_DSP_DEFAULTPRIORITY_CLEARUNIT 0 /* DSP CLEAR unit - done first */ +#define FSOUND_DSP_DEFAULTPRIORITY_SFXUNIT 100 /* DSP SFX unit - done second */ +#define FSOUND_DSP_DEFAULTPRIORITY_MUSICUNIT 200 /* DSP MUSIC unit - done third */ +#define FSOUND_DSP_DEFAULTPRIORITY_USER 300 /* User priority, use this as reference for your own DSP units */ +#define FSOUND_DSP_DEFAULTPRIORITY_FFTUNIT 900 /* This reads data for FSOUND_DSP_GetSpectrum, so it comes after user units */ +#define FSOUND_DSP_DEFAULTPRIORITY_CLIPANDCOPYUNIT 1000 /* DSP CLIP AND COPY unit - last */ /* [DEFINE_END] */ /* [DEFINE_START] [ - [NAME] - FSOUND_CAPS + [NAME] + FSOUND_CAPS - [DESCRIPTION] - Driver description bitfields. Use FSOUND_Driver_GetCaps to determine if a driver enumerated - has the settings you are after. The enumerated driver depends on the output mode, see - FSOUND_OUTPUTTYPES + [DESCRIPTION] + Driver description bitfields. Use FSOUND_Driver_GetCaps to determine if a driver enumerated + has the settings you are after. The enumerated driver depends on the output mode, see + FSOUND_OUTPUTTYPES - [SEE_ALSO] - FSOUND_GetDriverCaps - FSOUND_OUTPUTTYPES + [SEE_ALSO] + FSOUND_GetDriverCaps + FSOUND_OUTPUTTYPES ] */ -#define FSOUND_CAPS_HARDWARE 0x1 /* This driver supports hardware accelerated 3d sound. */ -#define FSOUND_CAPS_EAX2 0x2 /* This driver supports EAX 2 reverb */ -#define FSOUND_CAPS_EAX3 0x10 /* This driver supports EAX 3 reverb */ +#define FSOUND_CAPS_HARDWARE 0x1 /* This driver supports hardware accelerated 3d sound. */ +#define FSOUND_CAPS_EAX2 0x2 /* This driver supports EAX 2 reverb */ +#define FSOUND_CAPS_EAX3 0x10 /* This driver supports EAX 3 reverb */ /* [DEFINE_END] */ /* [DEFINE_START] [ - [NAME] - FSOUND_MODES - - [DESCRIPTION] - Sample description bitfields, OR them together for loading and describing samples. - NOTE. If the file format being loaded already has a defined format, such as WAV or MP3, then - trying to override the pre-defined format with a new set of format flags will not work. For - example, an 8 bit WAV file will not load as 16bit if you specify FSOUND_16BITS. It will just - ignore the flag and go ahead loading it as 8bits. For these type of formats the only flags - you can specify that will really alter the behaviour of how it is loaded, are the following. - --------- - Looping behaviour - FSOUND_LOOP_OFF, FSOUND_LOOP_NORMAL, FSOUND_LOOP_BIDI - Load destination - FSOUND_HW3D, FSOUND_HW2D, FSOUND_2D - Loading behaviour - FSOUND_NONBLOCKING, FSOUND_LOADMEMORY, FSOUND_LOADRAW, FSOUND_MPEGACCURATE, FSOUND_MPEGHALFRATE, FSOUND_FORCEMONO - Playback behaviour - FSOUND_STREAMABLE, FSOUND_ENABLEFX - PlayStation 2 only - FSOUND_USECORE0, FSOUND_USECORE1, FSOUND_LOADMEMORYIOP - --------- - See flag descriptions for what these do. + [NAME] + FSOUND_MODES + + [DESCRIPTION] + Sample description bitfields, OR them together for loading and describing samples. + NOTE. If the file format being loaded already has a defined format, such as WAV or MP3, then + trying to override the pre-defined format with a new set of format flags will not work. For + example, an 8 bit WAV file will not load as 16bit if you specify FSOUND_16BITS. It will just + ignore the flag and go ahead loading it as 8bits. For these type of formats the only flags + you can specify that will really alter the behaviour of how it is loaded, are the following. + --------- + Looping behaviour - FSOUND_LOOP_OFF, FSOUND_LOOP_NORMAL, FSOUND_LOOP_BIDI + Load destination - FSOUND_HW3D, FSOUND_HW2D, FSOUND_2D + Loading behaviour - FSOUND_NONBLOCKING, FSOUND_LOADMEMORY, FSOUND_LOADRAW, FSOUND_MPEGACCURATE, FSOUND_MPEGHALFRATE, FSOUND_FORCEMONO + Playback behaviour - FSOUND_STREAMABLE, FSOUND_ENABLEFX + PlayStation 2 only - FSOUND_USECORE0, FSOUND_USECORE1, FSOUND_LOADMEMORYIOP + --------- + See flag descriptions for what these do. ] */ -#define FSOUND_LOOP_OFF 0x00000001 /* For non looping samples. */ -#define FSOUND_LOOP_NORMAL 0x00000002 /* For forward looping samples. */ -#define FSOUND_LOOP_BIDI 0x00000004 /* For bidirectional looping samples. (no effect if in hardware). */ -#define FSOUND_8BITS 0x00000008 /* For 8 bit samples. */ -#define FSOUND_16BITS 0x00000010 /* For 16 bit samples. */ -#define FSOUND_MONO 0x00000020 /* For mono samples. */ -#define FSOUND_STEREO 0x00000040 /* For stereo samples. */ -#define FSOUND_UNSIGNED 0x00000080 /* For user created source data containing unsigned samples. */ -#define FSOUND_SIGNED 0x00000100 /* For user created source data containing signed data. */ -#define FSOUND_DELTA 0x00000200 /* For user created source data stored as delta values. */ -#define FSOUND_IT214 0x00000400 /* For user created source data stored using IT214 compression. */ -#define FSOUND_IT215 0x00000800 /* For user created source data stored using IT215 compression. */ -#define FSOUND_HW3D 0x00001000 /* Attempts to make samples use 3d hardware acceleration. (if the card supports it) */ -#define FSOUND_2D 0x00002000 /* Tells software (not hardware) based sample not to be included in 3d processing. */ -#define FSOUND_STREAMABLE 0x00004000 /* For a streamimg sound where you feed the data to it. */ -#define FSOUND_LOADMEMORY 0x00008000 /* "name" will be interpreted as a pointer to data for streaming and samples. */ -#define FSOUND_LOADRAW 0x00010000 /* Will ignore file format and treat as raw pcm. */ -#define FSOUND_MPEGACCURATE 0x00020000 /* For FSOUND_Stream_Open - for accurate FSOUND_Stream_GetLengthMs/FSOUND_Stream_SetTime. WARNING, see FSOUND_Stream_Open for inital opening time performance issues. */ -#define FSOUND_FORCEMONO 0x00040000 /* For forcing stereo streams and samples to be mono - needed if using FSOUND_HW3D and stereo data - incurs a small speed hit for streams */ -#define FSOUND_HW2D 0x00080000 /* 2D hardware sounds. allows hardware specific effects */ -#define FSOUND_ENABLEFX 0x00100000 /* Allows DX8 FX to be played back on a sound. Requires DirectX 8 - Note these sounds cannot be played more than once, be 8 bit, be less than a certain size, or have a changing frequency */ -#define FSOUND_MPEGHALFRATE 0x00200000 /* For FMODCE only - decodes mpeg streams using a lower quality decode, but faster execution */ -#define FSOUND_IMAADPCM 0x00400000 /* Contents are stored compressed as IMA ADPCM */ -#define FSOUND_VAG 0x00800000 /* For PS2 only - Contents are compressed as Sony VAG format */ -#define FSOUND_NONBLOCKING 0x01000000 /* For FSOUND_Stream_Open/FMUSIC_LoadSong - Causes stream or music to open in the background and not block the foreground app. See FSOUND_Stream_GetOpenState or FMUSIC_GetOpenState to determine when it IS ready. */ -#define FSOUND_GCADPCM 0x02000000 /* For Gamecube only - Contents are compressed as Gamecube DSP-ADPCM format */ -#define FSOUND_MULTICHANNEL 0x04000000 /* For PS2 and Gamecube only - Contents are interleaved into a multi-channel (more than stereo) format */ -#define FSOUND_USECORE0 0x08000000 /* For PS2 only - Sample/Stream is forced to use hardware voices 00-23 */ -#define FSOUND_USECORE1 0x10000000 /* For PS2 only - Sample/Stream is forced to use hardware voices 24-47 */ -#define FSOUND_LOADMEMORYIOP 0x20000000 /* For PS2 only - "name" will be interpreted as a pointer to data for streaming and samples. The address provided will be an IOP address */ -#define FSOUND_IGNORETAGS 0x40000000 /* Skips id3v2 etc tag checks when opening a stream, to reduce seek/read overhead when opening files (helps with CD performance) */ -#define FSOUND_STREAM_NET 0x80000000 /* Specifies an internet stream */ +#define FSOUND_LOOP_OFF 0x00000001 /* For non looping samples. */ +#define FSOUND_LOOP_NORMAL 0x00000002 /* For forward looping samples. */ +#define FSOUND_LOOP_BIDI 0x00000004 /* For bidirectional looping samples. (no effect if in hardware). */ +#define FSOUND_8BITS 0x00000008 /* For 8 bit samples. */ +#define FSOUND_16BITS 0x00000010 /* For 16 bit samples. */ +#define FSOUND_MONO 0x00000020 /* For mono samples. */ +#define FSOUND_STEREO 0x00000040 /* For stereo samples. */ +#define FSOUND_UNSIGNED 0x00000080 /* For user created source data containing unsigned samples. */ +#define FSOUND_SIGNED 0x00000100 /* For user created source data containing signed data. */ +#define FSOUND_DELTA 0x00000200 /* For user created source data stored as delta values. */ +#define FSOUND_IT214 0x00000400 /* For user created source data stored using IT214 compression. */ +#define FSOUND_IT215 0x00000800 /* For user created source data stored using IT215 compression. */ +#define FSOUND_HW3D 0x00001000 /* Attempts to make samples use 3d hardware acceleration. (if the card supports it) */ +#define FSOUND_2D 0x00002000 /* Tells software (not hardware) based sample not to be included in 3d processing. */ +#define FSOUND_STREAMABLE 0x00004000 /* For a streamimg sound where you feed the data to it. */ +#define FSOUND_LOADMEMORY 0x00008000 /* "name" will be interpreted as a pointer to data for streaming and samples. */ +#define FSOUND_LOADRAW 0x00010000 /* Will ignore file format and treat as raw pcm. */ +#define FSOUND_MPEGACCURATE 0x00020000 /* For FSOUND_Stream_Open - for accurate FSOUND_Stream_GetLengthMs/FSOUND_Stream_SetTime. WARNING, see FSOUND_Stream_Open for inital opening time performance issues. */ +#define FSOUND_FORCEMONO 0x00040000 /* For forcing stereo streams and samples to be mono - needed if using FSOUND_HW3D and stereo data - incurs a small speed hit for streams */ +#define FSOUND_HW2D 0x00080000 /* 2D hardware sounds. allows hardware specific effects */ +#define FSOUND_ENABLEFX 0x00100000 /* Allows DX8 FX to be played back on a sound. Requires DirectX 8 - Note these sounds cannot be played more than once, be 8 bit, be less than a certain size, or have a changing frequency */ +#define FSOUND_MPEGHALFRATE 0x00200000 /* For FMODCE only - decodes mpeg streams using a lower quality decode, but faster execution */ +#define FSOUND_IMAADPCM 0x00400000 /* Contents are stored compressed as IMA ADPCM */ +#define FSOUND_VAG 0x00800000 /* For PS2 only - Contents are compressed as Sony VAG format */ +#define FSOUND_NONBLOCKING 0x01000000 /* For FSOUND_Stream_Open/FMUSIC_LoadSong - Causes stream or music to open in the background and not block the foreground app. See FSOUND_Stream_GetOpenState or FMUSIC_GetOpenState to determine when it IS ready. */ +#define FSOUND_GCADPCM 0x02000000 /* For Gamecube only - Contents are compressed as Gamecube DSP-ADPCM format */ +#define FSOUND_MULTICHANNEL 0x04000000 /* For PS2 and Gamecube only - Contents are interleaved into a multi-channel (more than stereo) format */ +#define FSOUND_USECORE0 0x08000000 /* For PS2 only - Sample/Stream is forced to use hardware voices 00-23 */ +#define FSOUND_USECORE1 0x10000000 /* For PS2 only - Sample/Stream is forced to use hardware voices 24-47 */ +#define FSOUND_LOADMEMORYIOP 0x20000000 /* For PS2 only - "name" will be interpreted as a pointer to data for streaming and samples. The address provided will be an IOP address */ +#define FSOUND_IGNORETAGS 0x40000000 /* Skips id3v2 etc tag checks when opening a stream, to reduce seek/read overhead when opening files (helps with CD performance) */ +#define FSOUND_STREAM_NET 0x80000000 /* Specifies an internet stream */ -#define FSOUND_NORMAL (FSOUND_16BITS | FSOUND_SIGNED | FSOUND_MONO) +#define FSOUND_NORMAL (FSOUND_16BITS | FSOUND_SIGNED | FSOUND_MONO) /* [DEFINE_END] */ @@ -306,47 +306,47 @@ enum FMUSIC_TYPES /* [DEFINE_START] [ - [NAME] - FSOUND_CDPLAYMODES - - [DESCRIPTION] - Playback method for a CD Audio track, with FSOUND_CD_SetPlayMode + [NAME] + FSOUND_CDPLAYMODES + + [DESCRIPTION] + Playback method for a CD Audio track, with FSOUND_CD_SetPlayMode - [SEE_ALSO] - FSOUND_CD_SetPlayMode - FSOUND_CD_Play + [SEE_ALSO] + FSOUND_CD_SetPlayMode + FSOUND_CD_Play ] */ -#define FSOUND_CD_PLAYCONTINUOUS 0 /* Starts from the current track and plays to end of CD. */ -#define FSOUND_CD_PLAYONCE 1 /* Plays the specified track then stops. */ -#define FSOUND_CD_PLAYLOOPED 2 /* Plays the specified track looped, forever until stopped manually. */ -#define FSOUND_CD_PLAYRANDOM 3 /* Plays tracks in random order */ +#define FSOUND_CD_PLAYCONTINUOUS 0 /* Starts from the current track and plays to end of CD. */ +#define FSOUND_CD_PLAYONCE 1 /* Plays the specified track then stops. */ +#define FSOUND_CD_PLAYLOOPED 2 /* Plays the specified track looped, forever until stopped manually. */ +#define FSOUND_CD_PLAYRANDOM 3 /* Plays tracks in random order */ /* [DEFINE_END] */ /* [DEFINE_START] [ - [NAME] - FSOUND_MISC_VALUES - - [DESCRIPTION] - Miscellaneous values for FMOD functions. + [NAME] + FSOUND_MISC_VALUES + + [DESCRIPTION] + Miscellaneous values for FMOD functions. - [SEE_ALSO] - FSOUND_PlaySound - FSOUND_PlaySoundEx - FSOUND_Sample_Alloc - FSOUND_Sample_Load - FSOUND_SetPan + [SEE_ALSO] + FSOUND_PlaySound + FSOUND_PlaySoundEx + FSOUND_Sample_Alloc + FSOUND_Sample_Load + FSOUND_SetPan ] */ -#define FSOUND_FREE -1 /* value to play on any free channel, or to allocate a sample in a free sample slot. */ -#define FSOUND_UNMANAGED -2 /* value to allocate a sample that is NOT managed by FSOUND or placed in a sample slot. */ -#define FSOUND_ALL -3 /* for a channel index , this flag will affect ALL channels available! Not supported by every function. */ -#define FSOUND_STEREOPAN -1 /* value for FSOUND_SetPan so that stereo sounds are not played at half volume. See FSOUND_SetPan for more on this. */ -#define FSOUND_SYSTEMCHANNEL -1000 /* special 'channel' ID for all channel based functions that want to alter the global FSOUND software mixing output channel */ -#define FSOUND_SYSTEMSAMPLE -1000 /* special 'sample' ID for all sample based functions that want to alter the global FSOUND software mixing output sample */ +#define FSOUND_FREE -1 /* value to play on any free channel, or to allocate a sample in a free sample slot. */ +#define FSOUND_UNMANAGED -2 /* value to allocate a sample that is NOT managed by FSOUND or placed in a sample slot. */ +#define FSOUND_ALL -3 /* for a channel index , this flag will affect ALL channels available! Not supported by every function. */ +#define FSOUND_STEREOPAN -1 /* value for FSOUND_SetPan so that stereo sounds are not played at half volume. See FSOUND_SetPan for more on this. */ +#define FSOUND_SYSTEMCHANNEL -1000 /* special 'channel' ID for all channel based functions that want to alter the global FSOUND software mixing output channel */ +#define FSOUND_SYSTEMSAMPLE -1000 /* special 'sample' ID for all sample based functions that want to alter the global FSOUND software mixing output sample */ /* [DEFINE_END] */ @@ -354,88 +354,88 @@ enum FMUSIC_TYPES /* [STRUCTURE] [ - [DESCRIPTION] - Structure defining a reverb environment. - For more indepth descriptions of the reverb properties under win32, please see the EAX2 and EAX3 - documentation at http://developer.creative.com/ under the 'downloads' section. - If they do not have the EAX3 documentation, then most information can be attained from - the EAX2 documentation, as EAX3 only adds some more parameters and functionality on top of EAX2. - Note the default reverb properties are the same as the FSOUND_PRESET_GENERIC preset. - Note that integer values that typically range from -10,000 to 1000 are represented in decibels, and are of a logarithmic scale, not linear, wheras float values are typically linear. - PORTABILITY: Each member has the platform it supports in braces ie (win32/xbox). - Some reverb parameters are only supported in win32 and some only on xbox. If all parameters are set then the reverb should product a similar effect on either platform. - - The numerical values listed below are the maximum, minimum and default values for each variable respectively. + [DESCRIPTION] + Structure defining a reverb environment. + For more indepth descriptions of the reverb properties under win32, please see the EAX2 and EAX3 + documentation at http://developer.creative.com/ under the 'downloads' section. + If they do not have the EAX3 documentation, then most information can be attained from + the EAX2 documentation, as EAX3 only adds some more parameters and functionality on top of EAX2. + Note the default reverb properties are the same as the FSOUND_PRESET_GENERIC preset. + Note that integer values that typically range from -10,000 to 1000 are represented in decibels, and are of a logarithmic scale, not linear, wheras float values are typically linear. + PORTABILITY: Each member has the platform it supports in braces ie (win32/xbox). + Some reverb parameters are only supported in win32 and some only on xbox. If all parameters are set then the reverb should product a similar effect on either platform. + + The numerical values listed below are the maximum, minimum and default values for each variable respectively. - [SEE_ALSO] - FSOUND_Reverb_SetProperties - FSOUND_Reverb_GetProperties - FSOUND_REVERB_PRESETS - FSOUND_REVERB_FLAGS + [SEE_ALSO] + FSOUND_Reverb_SetProperties + FSOUND_Reverb_GetProperties + FSOUND_REVERB_PRESETS + FSOUND_REVERB_FLAGS ] */ -typedef struct _FSOUND_REVERB_PROPERTIES /* MIN MAX DEFAULT DESCRIPTION */ -{ - unsigned int Environment; /* 0 , 25 , 0 , sets all listener properties (WIN32/PS2 only) */ - float EnvSize; /* 1.0 , 100.0 , 7.5 , environment size in meters (WIN32 only) */ - float EnvDiffusion; /* 0.0 , 1.0 , 1.0 , environment diffusion (WIN32/XBOX) */ - int Room; /* -10000, 0 , -1000 , room effect level (at mid frequencies) (WIN32/XBOX/PS2) */ - int RoomHF; /* -10000, 0 , -100 , relative room effect level at high frequencies (WIN32/XBOX) */ - int RoomLF; /* -10000, 0 , 0 , relative room effect level at low frequencies (WIN32 only) */ - float DecayTime; /* 0.1 , 20.0 , 1.49 , reverberation decay time at mid frequencies (WIN32/XBOX) */ - float DecayHFRatio; /* 0.1 , 2.0 , 0.83 , high-frequency to mid-frequency decay time ratio (WIN32/XBOX) */ - float DecayLFRatio; /* 0.1 , 2.0 , 1.0 , low-frequency to mid-frequency decay time ratio (WIN32 only) */ - int Reflections; /* -10000, 1000 , -2602 , early reflections level relative to room effect (WIN32/XBOX) */ - float ReflectionsDelay; /* 0.0 , 0.3 , 0.007 , initial reflection delay time (WIN32/XBOX) */ - float ReflectionsPan[3]; /* , , [0,0,0], early reflections panning vector (WIN32 only) */ - int Reverb; /* -10000, 2000 , 200 , late reverberation level relative to room effect (WIN32/XBOX) */ - float ReverbDelay; /* 0.0 , 0.1 , 0.011 , late reverberation delay time relative to initial reflection (WIN32/XBOX) */ - float ReverbPan[3]; /* , , [0,0,0], late reverberation panning vector (WIN32 only) */ - float EchoTime; /* .075 , 0.25 , 0.25 , echo time (WIN32/PS2 only. PS2 = Delay time for ECHO/DELAY modes only) */ - float EchoDepth; /* 0.0 , 1.0 , 0.0 , echo depth (WIN32/PS2 only. PS2 = Feedback level for ECHO mode only) */ - float ModulationTime; /* 0.04 , 4.0 , 0.25 , modulation time (WIN32 only) */ - float ModulationDepth; /* 0.0 , 1.0 , 0.0 , modulation depth (WIN32 only) */ - float AirAbsorptionHF; /* -100 , 0.0 , -5.0 , change in level per meter at high frequencies (WIN32 only) */ - float HFReference; /* 1000.0, 20000 , 5000.0 , reference high frequency (hz) (WIN32/XBOX) */ - float LFReference; /* 20.0 , 1000.0, 250.0 , reference low frequency (hz) (WIN32 only) */ - float RoomRolloffFactor; /* 0.0 , 10.0 , 0.0 , like FSOUND_3D_SetRolloffFactor but for room effect (WIN32/XBOX) */ - float Diffusion; /* 0.0 , 100.0 , 100.0 , Value that controls the echo density in the late reverberation decay. (XBOX only) */ - float Density; /* 0.0 , 100.0 , 100.0 , Value that controls the modal density in the late reverberation decay (XBOX only) */ - unsigned int Flags; /* FSOUND_REVERB_FLAGS - modifies the behavior of above properties (WIN32/PS2 only) */ +typedef struct _FSOUND_REVERB_PROPERTIES /* MIN MAX DEFAULT DESCRIPTION */ +{ + unsigned int Environment; /* 0 , 25 , 0 , sets all listener properties (WIN32/PS2 only) */ + float EnvSize; /* 1.0 , 100.0 , 7.5 , environment size in meters (WIN32 only) */ + float EnvDiffusion; /* 0.0 , 1.0 , 1.0 , environment diffusion (WIN32/XBOX) */ + int Room; /* -10000, 0 , -1000 , room effect level (at mid frequencies) (WIN32/XBOX/PS2) */ + int RoomHF; /* -10000, 0 , -100 , relative room effect level at high frequencies (WIN32/XBOX) */ + int RoomLF; /* -10000, 0 , 0 , relative room effect level at low frequencies (WIN32 only) */ + float DecayTime; /* 0.1 , 20.0 , 1.49 , reverberation decay time at mid frequencies (WIN32/XBOX) */ + float DecayHFRatio; /* 0.1 , 2.0 , 0.83 , high-frequency to mid-frequency decay time ratio (WIN32/XBOX) */ + float DecayLFRatio; /* 0.1 , 2.0 , 1.0 , low-frequency to mid-frequency decay time ratio (WIN32 only) */ + int Reflections; /* -10000, 1000 , -2602 , early reflections level relative to room effect (WIN32/XBOX) */ + float ReflectionsDelay; /* 0.0 , 0.3 , 0.007 , initial reflection delay time (WIN32/XBOX) */ + float ReflectionsPan[3]; /* , , [0,0,0], early reflections panning vector (WIN32 only) */ + int Reverb; /* -10000, 2000 , 200 , late reverberation level relative to room effect (WIN32/XBOX) */ + float ReverbDelay; /* 0.0 , 0.1 , 0.011 , late reverberation delay time relative to initial reflection (WIN32/XBOX) */ + float ReverbPan[3]; /* , , [0,0,0], late reverberation panning vector (WIN32 only) */ + float EchoTime; /* .075 , 0.25 , 0.25 , echo time (WIN32/PS2 only. PS2 = Delay time for ECHO/DELAY modes only) */ + float EchoDepth; /* 0.0 , 1.0 , 0.0 , echo depth (WIN32/PS2 only. PS2 = Feedback level for ECHO mode only) */ + float ModulationTime; /* 0.04 , 4.0 , 0.25 , modulation time (WIN32 only) */ + float ModulationDepth; /* 0.0 , 1.0 , 0.0 , modulation depth (WIN32 only) */ + float AirAbsorptionHF; /* -100 , 0.0 , -5.0 , change in level per meter at high frequencies (WIN32 only) */ + float HFReference; /* 1000.0, 20000 , 5000.0 , reference high frequency (hz) (WIN32/XBOX) */ + float LFReference; /* 20.0 , 1000.0, 250.0 , reference low frequency (hz) (WIN32 only) */ + float RoomRolloffFactor; /* 0.0 , 10.0 , 0.0 , like FSOUND_3D_SetRolloffFactor but for room effect (WIN32/XBOX) */ + float Diffusion; /* 0.0 , 100.0 , 100.0 , Value that controls the echo density in the late reverberation decay. (XBOX only) */ + float Density; /* 0.0 , 100.0 , 100.0 , Value that controls the modal density in the late reverberation decay (XBOX only) */ + unsigned int Flags; /* FSOUND_REVERB_FLAGS - modifies the behavior of above properties (WIN32/PS2 only) */ } FSOUND_REVERB_PROPERTIES; /* [DEFINE_START] [ - [NAME] - FSOUND_REVERB_FLAGS - - [DESCRIPTION] - Values for the Flags member of the FSOUND_REVERB_PROPERTIES structure. + [NAME] + FSOUND_REVERB_FLAGS + + [DESCRIPTION] + Values for the Flags member of the FSOUND_REVERB_PROPERTIES structure. - [SEE_ALSO] - FSOUND_REVERB_PROPERTIES + [SEE_ALSO] + FSOUND_REVERB_PROPERTIES ] */ -#define FSOUND_REVERB_FLAGS_DECAYTIMESCALE 0x00000001 /* 'EnvSize' affects reverberation decay time */ -#define FSOUND_REVERB_FLAGS_REFLECTIONSSCALE 0x00000002 /* 'EnvSize' affects reflection level */ +#define FSOUND_REVERB_FLAGS_DECAYTIMESCALE 0x00000001 /* 'EnvSize' affects reverberation decay time */ +#define FSOUND_REVERB_FLAGS_REFLECTIONSSCALE 0x00000002 /* 'EnvSize' affects reflection level */ #define FSOUND_REVERB_FLAGS_REFLECTIONSDELAYSCALE 0x00000004 /* 'EnvSize' affects initial reflection delay time */ -#define FSOUND_REVERB_FLAGS_REVERBSCALE 0x00000008 /* 'EnvSize' affects reflections level */ -#define FSOUND_REVERB_FLAGS_REVERBDELAYSCALE 0x00000010 /* 'EnvSize' affects late reverberation delay time */ -#define FSOUND_REVERB_FLAGS_DECAYHFLIMIT 0x00000020 /* AirAbsorptionHF affects DecayHFRatio */ -#define FSOUND_REVERB_FLAGS_ECHOTIMESCALE 0x00000040 /* 'EnvSize' affects echo time */ -#define FSOUND_REVERB_FLAGS_MODULATIONTIMESCALE 0x00000080 /* 'EnvSize' affects modulation time */ -#define FSOUND_REVERB_FLAGS_CORE0 0x00000100 /* PS2 Only - Reverb is applied to CORE0 (hw voices 0-23) */ -#define FSOUND_REVERB_FLAGS_CORE1 0x00000200 /* PS2 Only - Reverb is applied to CORE1 (hw voices 24-47) */ -#define FSOUND_REVERB_FLAGS_DEFAULT (FSOUND_REVERB_FLAGS_DECAYTIMESCALE | \ - FSOUND_REVERB_FLAGS_REFLECTIONSSCALE | \ - FSOUND_REVERB_FLAGS_REFLECTIONSDELAYSCALE | \ - FSOUND_REVERB_FLAGS_REVERBSCALE | \ - FSOUND_REVERB_FLAGS_REVERBDELAYSCALE | \ - FSOUND_REVERB_FLAGS_DECAYHFLIMIT | \ - FSOUND_REVERB_FLAGS_CORE0 | \ - FSOUND_REVERB_FLAGS_CORE1 ) +#define FSOUND_REVERB_FLAGS_REVERBSCALE 0x00000008 /* 'EnvSize' affects reflections level */ +#define FSOUND_REVERB_FLAGS_REVERBDELAYSCALE 0x00000010 /* 'EnvSize' affects late reverberation delay time */ +#define FSOUND_REVERB_FLAGS_DECAYHFLIMIT 0x00000020 /* AirAbsorptionHF affects DecayHFRatio */ +#define FSOUND_REVERB_FLAGS_ECHOTIMESCALE 0x00000040 /* 'EnvSize' affects echo time */ +#define FSOUND_REVERB_FLAGS_MODULATIONTIMESCALE 0x00000080 /* 'EnvSize' affects modulation time */ +#define FSOUND_REVERB_FLAGS_CORE0 0x00000100 /* PS2 Only - Reverb is applied to CORE0 (hw voices 0-23) */ +#define FSOUND_REVERB_FLAGS_CORE1 0x00000200 /* PS2 Only - Reverb is applied to CORE1 (hw voices 24-47) */ +#define FSOUND_REVERB_FLAGS_DEFAULT (FSOUND_REVERB_FLAGS_DECAYTIMESCALE | \ + FSOUND_REVERB_FLAGS_REFLECTIONSSCALE | \ + FSOUND_REVERB_FLAGS_REFLECTIONSDELAYSCALE | \ + FSOUND_REVERB_FLAGS_REVERBSCALE | \ + FSOUND_REVERB_FLAGS_REVERBDELAYSCALE | \ + FSOUND_REVERB_FLAGS_DECAYHFLIMIT | \ + FSOUND_REVERB_FLAGS_CORE0 | \ + FSOUND_REVERB_FLAGS_CORE1 ) /* [DEFINE_END] */ @@ -444,62 +444,62 @@ typedef struct _FSOUND_REVERB_PROPERTIES /* MIN MAX DEFAULT DESCRIPTION /* [DEFINE_START] [ - [NAME] - FSOUND_REVERB_PRESETS - - [DESCRIPTION] - A set of predefined environment PARAMETERS, created by Creative Labs - These are used to initialize an FSOUND_REVERB_PROPERTIES structure statically. - ie - FSOUND_REVERB_PROPERTIES prop = FSOUND_PRESET_GENERIC; + [NAME] + FSOUND_REVERB_PRESETS + + [DESCRIPTION] + A set of predefined environment PARAMETERS, created by Creative Labs + These are used to initialize an FSOUND_REVERB_PROPERTIES structure statically. + ie + FSOUND_REVERB_PROPERTIES prop = FSOUND_PRESET_GENERIC; - [SEE_ALSO] - FSOUND_Reverb_SetProperties + [SEE_ALSO] + FSOUND_Reverb_SetProperties ] */ -/* Env Size Diffus Room RoomHF RmLF DecTm DecHF DecLF Refl RefDel RefPan Revb RevDel ReverbPan EchoTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff Diffus Densty FLAGS */ -#define FSOUND_PRESET_OFF {0, 7.5f, 1.00f, -10000, -10000, 0, 1.00f, 1.00f, 1.0f, -2602, 0.007f, { 0.0f,0.0f,0.0f }, 200, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 0.0f, 0.0f, 0x33f } -#define FSOUND_PRESET_GENERIC {0, 7.5f, 1.00f, -1000, -100, 0, 1.49f, 0.83f, 1.0f, -2602, 0.007f, { 0.0f,0.0f,0.0f }, 200, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_PADDEDCELL {1, 1.4f, 1.00f, -1000, -6000, 0, 0.17f, 0.10f, 1.0f, -1204, 0.001f, { 0.0f,0.0f,0.0f }, 207, 0.002f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_ROOM {2, 1.9f, 1.00f, -1000, -454, 0, 0.40f, 0.83f, 1.0f, -1646, 0.002f, { 0.0f,0.0f,0.0f }, 53, 0.003f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_BATHROOM {3, 1.4f, 1.00f, -1000, -1200, 0, 1.49f, 0.54f, 1.0f, -370, 0.007f, { 0.0f,0.0f,0.0f }, 1030, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 60.0f, 0x3f } -#define FSOUND_PRESET_LIVINGROOM {4, 2.5f, 1.00f, -1000, -6000, 0, 0.50f, 0.10f, 1.0f, -1376, 0.003f, { 0.0f,0.0f,0.0f }, -1104, 0.004f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_STONEROOM {5, 11.6f, 1.00f, -1000, -300, 0, 2.31f, 0.64f, 1.0f, -711, 0.012f, { 0.0f,0.0f,0.0f }, 83, 0.017f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_AUDITORIUM {6, 21.6f, 1.00f, -1000, -476, 0, 4.32f, 0.59f, 1.0f, -789, 0.020f, { 0.0f,0.0f,0.0f }, -289, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_CONCERTHALL {7, 19.6f, 1.00f, -1000, -500, 0, 3.92f, 0.70f, 1.0f, -1230, 0.020f, { 0.0f,0.0f,0.0f }, -2, 0.029f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_CAVE {8, 14.6f, 1.00f, -1000, 0, 0, 2.91f, 1.30f, 1.0f, -602, 0.015f, { 0.0f,0.0f,0.0f }, -302, 0.022f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f } -#define FSOUND_PRESET_ARENA {9, 36.2f, 1.00f, -1000, -698, 0, 7.24f, 0.33f, 1.0f, -1166, 0.020f, { 0.0f,0.0f,0.0f }, 16, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_HANGAR {10, 50.3f, 1.00f, -1000, -1000, 0, 10.05f, 0.23f, 1.0f, -602, 0.020f, { 0.0f,0.0f,0.0f }, 198, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_CARPETTEDHALLWAY {11, 1.9f, 1.00f, -1000, -4000, 0, 0.30f, 0.10f, 1.0f, -1831, 0.002f, { 0.0f,0.0f,0.0f }, -1630, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_HALLWAY {12, 1.8f, 1.00f, -1000, -300, 0, 1.49f, 0.59f, 1.0f, -1219, 0.007f, { 0.0f,0.0f,0.0f }, 441, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_STONECORRIDOR {13, 13.5f, 1.00f, -1000, -237, 0, 2.70f, 0.79f, 1.0f, -1214, 0.013f, { 0.0f,0.0f,0.0f }, 395, 0.020f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_ALLEY {14, 7.5f, 0.30f, -1000, -270, 0, 1.49f, 0.86f, 1.0f, -1204, 0.007f, { 0.0f,0.0f,0.0f }, -4, 0.011f, { 0.0f,0.0f,0.0f }, 0.125f, 0.95f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_FOREST {15, 38.0f, 0.30f, -1000, -3300, 0, 1.49f, 0.54f, 1.0f, -2560, 0.162f, { 0.0f,0.0f,0.0f }, -229, 0.088f, { 0.0f,0.0f,0.0f }, 0.125f, 1.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 79.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_CITY {16, 7.5f, 0.50f, -1000, -800, 0, 1.49f, 0.67f, 1.0f, -2273, 0.007f, { 0.0f,0.0f,0.0f }, -1691, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 50.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_MOUNTAINS {17, 100.0f, 0.27f, -1000, -2500, 0, 1.49f, 0.21f, 1.0f, -2780, 0.300f, { 0.0f,0.0f,0.0f }, -1434, 0.100f, { 0.0f,0.0f,0.0f }, 0.250f, 1.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 27.0f, 100.0f, 0x1f } -#define FSOUND_PRESET_QUARRY {18, 17.5f, 1.00f, -1000, -1000, 0, 1.49f, 0.83f, 1.0f, -10000, 0.061f, { 0.0f,0.0f,0.0f }, 500, 0.025f, { 0.0f,0.0f,0.0f }, 0.125f, 0.70f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_PLAIN {19, 42.5f, 0.21f, -1000, -2000, 0, 1.49f, 0.50f, 1.0f, -2466, 0.179f, { 0.0f,0.0f,0.0f }, -1926, 0.100f, { 0.0f,0.0f,0.0f }, 0.250f, 1.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 21.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_PARKINGLOT {20, 8.3f, 1.00f, -1000, 0, 0, 1.65f, 1.50f, 1.0f, -1363, 0.008f, { 0.0f,0.0f,0.0f }, -1153, 0.012f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f } -#define FSOUND_PRESET_SEWERPIPE {21, 1.7f, 0.80f, -1000, -1000, 0, 2.81f, 0.14f, 1.0f, 429, 0.014f, { 0.0f,0.0f,0.0f }, 1023, 0.021f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 80.0f, 60.0f, 0x3f } -#define FSOUND_PRESET_UNDERWATER {22, 1.8f, 1.00f, -1000, -4000, 0, 1.49f, 0.10f, 1.0f, -449, 0.007f, { 0.0f,0.0f,0.0f }, 1700, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 1.18f, 0.348f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +/* Env Size Diffus Room RoomHF RmLF DecTm DecHF DecLF Refl RefDel RefPan Revb RevDel ReverbPan EchoTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff Diffus Densty FLAGS */ +#define FSOUND_PRESET_OFF {0, 7.5f, 1.00f, -10000, -10000, 0, 1.00f, 1.00f, 1.0f, -2602, 0.007f, { 0.0f,0.0f,0.0f }, 200, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 0.0f, 0.0f, 0x33f } +#define FSOUND_PRESET_GENERIC {0, 7.5f, 1.00f, -1000, -100, 0, 1.49f, 0.83f, 1.0f, -2602, 0.007f, { 0.0f,0.0f,0.0f }, 200, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_PADDEDCELL {1, 1.4f, 1.00f, -1000, -6000, 0, 0.17f, 0.10f, 1.0f, -1204, 0.001f, { 0.0f,0.0f,0.0f }, 207, 0.002f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_ROOM {2, 1.9f, 1.00f, -1000, -454, 0, 0.40f, 0.83f, 1.0f, -1646, 0.002f, { 0.0f,0.0f,0.0f }, 53, 0.003f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_BATHROOM {3, 1.4f, 1.00f, -1000, -1200, 0, 1.49f, 0.54f, 1.0f, -370, 0.007f, { 0.0f,0.0f,0.0f }, 1030, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 60.0f, 0x3f } +#define FSOUND_PRESET_LIVINGROOM {4, 2.5f, 1.00f, -1000, -6000, 0, 0.50f, 0.10f, 1.0f, -1376, 0.003f, { 0.0f,0.0f,0.0f }, -1104, 0.004f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_STONEROOM {5, 11.6f, 1.00f, -1000, -300, 0, 2.31f, 0.64f, 1.0f, -711, 0.012f, { 0.0f,0.0f,0.0f }, 83, 0.017f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_AUDITORIUM {6, 21.6f, 1.00f, -1000, -476, 0, 4.32f, 0.59f, 1.0f, -789, 0.020f, { 0.0f,0.0f,0.0f }, -289, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_CONCERTHALL {7, 19.6f, 1.00f, -1000, -500, 0, 3.92f, 0.70f, 1.0f, -1230, 0.020f, { 0.0f,0.0f,0.0f }, -2, 0.029f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_CAVE {8, 14.6f, 1.00f, -1000, 0, 0, 2.91f, 1.30f, 1.0f, -602, 0.015f, { 0.0f,0.0f,0.0f }, -302, 0.022f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f } +#define FSOUND_PRESET_ARENA {9, 36.2f, 1.00f, -1000, -698, 0, 7.24f, 0.33f, 1.0f, -1166, 0.020f, { 0.0f,0.0f,0.0f }, 16, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_HANGAR {10, 50.3f, 1.00f, -1000, -1000, 0, 10.05f, 0.23f, 1.0f, -602, 0.020f, { 0.0f,0.0f,0.0f }, 198, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_CARPETTEDHALLWAY {11, 1.9f, 1.00f, -1000, -4000, 0, 0.30f, 0.10f, 1.0f, -1831, 0.002f, { 0.0f,0.0f,0.0f }, -1630, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_HALLWAY {12, 1.8f, 1.00f, -1000, -300, 0, 1.49f, 0.59f, 1.0f, -1219, 0.007f, { 0.0f,0.0f,0.0f }, 441, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_STONECORRIDOR {13, 13.5f, 1.00f, -1000, -237, 0, 2.70f, 0.79f, 1.0f, -1214, 0.013f, { 0.0f,0.0f,0.0f }, 395, 0.020f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_ALLEY {14, 7.5f, 0.30f, -1000, -270, 0, 1.49f, 0.86f, 1.0f, -1204, 0.007f, { 0.0f,0.0f,0.0f }, -4, 0.011f, { 0.0f,0.0f,0.0f }, 0.125f, 0.95f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_FOREST {15, 38.0f, 0.30f, -1000, -3300, 0, 1.49f, 0.54f, 1.0f, -2560, 0.162f, { 0.0f,0.0f,0.0f }, -229, 0.088f, { 0.0f,0.0f,0.0f }, 0.125f, 1.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 79.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_CITY {16, 7.5f, 0.50f, -1000, -800, 0, 1.49f, 0.67f, 1.0f, -2273, 0.007f, { 0.0f,0.0f,0.0f }, -1691, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 50.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_MOUNTAINS {17, 100.0f, 0.27f, -1000, -2500, 0, 1.49f, 0.21f, 1.0f, -2780, 0.300f, { 0.0f,0.0f,0.0f }, -1434, 0.100f, { 0.0f,0.0f,0.0f }, 0.250f, 1.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 27.0f, 100.0f, 0x1f } +#define FSOUND_PRESET_QUARRY {18, 17.5f, 1.00f, -1000, -1000, 0, 1.49f, 0.83f, 1.0f, -10000, 0.061f, { 0.0f,0.0f,0.0f }, 500, 0.025f, { 0.0f,0.0f,0.0f }, 0.125f, 0.70f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_PLAIN {19, 42.5f, 0.21f, -1000, -2000, 0, 1.49f, 0.50f, 1.0f, -2466, 0.179f, { 0.0f,0.0f,0.0f }, -1926, 0.100f, { 0.0f,0.0f,0.0f }, 0.250f, 1.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 21.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_PARKINGLOT {20, 8.3f, 1.00f, -1000, 0, 0, 1.65f, 1.50f, 1.0f, -1363, 0.008f, { 0.0f,0.0f,0.0f }, -1153, 0.012f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f } +#define FSOUND_PRESET_SEWERPIPE {21, 1.7f, 0.80f, -1000, -1000, 0, 2.81f, 0.14f, 1.0f, 429, 0.014f, { 0.0f,0.0f,0.0f }, 1023, 0.021f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 80.0f, 60.0f, 0x3f } +#define FSOUND_PRESET_UNDERWATER {22, 1.8f, 1.00f, -1000, -4000, 0, 1.49f, 0.10f, 1.0f, -449, 0.007f, { 0.0f,0.0f,0.0f }, 1700, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 1.18f, 0.348f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } /* Non I3DL2 presets */ -#define FSOUND_PRESET_DRUGGED {23, 1.9f, 0.50f, -1000, 0, 0, 8.39f, 1.39f, 1.0f, -115, 0.002f, { 0.0f,0.0f,0.0f }, 985, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 1.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f } -#define FSOUND_PRESET_DIZZY {24, 1.8f, 0.60f, -1000, -400, 0, 17.23f, 0.56f, 1.0f, -1713, 0.020f, { 0.0f,0.0f,0.0f }, -613, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 1.00f, 0.81f, 0.310f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f } -#define FSOUND_PRESET_PSYCHOTIC {25, 1.0f, 0.50f, -1000, -151, 0, 7.56f, 0.91f, 1.0f, -626, 0.020f, { 0.0f,0.0f,0.0f }, 774, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 4.00f, 1.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f } +#define FSOUND_PRESET_DRUGGED {23, 1.9f, 0.50f, -1000, 0, 0, 8.39f, 1.39f, 1.0f, -115, 0.002f, { 0.0f,0.0f,0.0f }, 985, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 1.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f } +#define FSOUND_PRESET_DIZZY {24, 1.8f, 0.60f, -1000, -400, 0, 17.23f, 0.56f, 1.0f, -1713, 0.020f, { 0.0f,0.0f,0.0f }, -613, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 1.00f, 0.81f, 0.310f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f } +#define FSOUND_PRESET_PSYCHOTIC {25, 1.0f, 0.50f, -1000, -151, 0, 7.56f, 0.91f, 1.0f, -626, 0.020f, { 0.0f,0.0f,0.0f }, 774, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 4.00f, 1.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f } /* PlayStation 2 and PlayStation Portable only presets */ -#define FSOUND_PRESET_PS2_ROOM {1, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FSOUND_PRESET_PS2_STUDIO_A {2, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FSOUND_PRESET_PS2_STUDIO_B {3, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FSOUND_PRESET_PS2_STUDIO_C {4, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FSOUND_PRESET_PS2_HALL {5, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FSOUND_PRESET_PS2_SPACE {6, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FSOUND_PRESET_PS2_ECHO {7, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FSOUND_PRESET_PS2_DELAY {8, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FSOUND_PRESET_PS2_PIPE {9, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } +#define FSOUND_PRESET_PS2_ROOM {1, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } +#define FSOUND_PRESET_PS2_STUDIO_A {2, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } +#define FSOUND_PRESET_PS2_STUDIO_B {3, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } +#define FSOUND_PRESET_PS2_STUDIO_C {4, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } +#define FSOUND_PRESET_PS2_HALL {5, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } +#define FSOUND_PRESET_PS2_SPACE {6, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } +#define FSOUND_PRESET_PS2_ECHO {7, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } +#define FSOUND_PRESET_PS2_DELAY {8, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } +#define FSOUND_PRESET_PS2_PIPE {9, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } /* [DEFINE_END] */ @@ -507,266 +507,266 @@ typedef struct _FSOUND_REVERB_PROPERTIES /* MIN MAX DEFAULT DESCRIPTION /* [STRUCTURE] [ - [DESCRIPTION] - Structure defining the properties for a reverb source, related to a FSOUND channel. - For more indepth descriptions of the reverb properties under win32, please see the EAX3 - documentation at http://developer.creative.com/ under the 'downloads' section. - If they do not have the EAX3 documentation, then most information can be attained from - the EAX2 documentation, as EAX3 only adds some more parameters and functionality on top of - EAX2. - - Note the default reverb properties are the same as the FSOUND_PRESET_GENERIC preset. - Note that integer values that typically range from -10,000 to 1000 are represented in - decibels, and are of a logarithmic scale, not linear, wheras float values are typically linear. - PORTABILITY: Each member has the platform it supports in braces ie (win32/xbox). - Some reverb parameters are only supported in win32 and some only on xbox. If all parameters are set then - the reverb should product a similar effect on either platform. - Linux and FMODCE do not support the reverb api. - - The numerical values listed below are the maximum, minimum and default values for each variable respectively. + [DESCRIPTION] + Structure defining the properties for a reverb source, related to a FSOUND channel. + For more indepth descriptions of the reverb properties under win32, please see the EAX3 + documentation at http://developer.creative.com/ under the 'downloads' section. + If they do not have the EAX3 documentation, then most information can be attained from + the EAX2 documentation, as EAX3 only adds some more parameters and functionality on top of + EAX2. + + Note the default reverb properties are the same as the FSOUND_PRESET_GENERIC preset. + Note that integer values that typically range from -10,000 to 1000 are represented in + decibels, and are of a logarithmic scale, not linear, wheras float values are typically linear. + PORTABILITY: Each member has the platform it supports in braces ie (win32/xbox). + Some reverb parameters are only supported in win32 and some only on xbox. If all parameters are set then + the reverb should product a similar effect on either platform. + Linux and FMODCE do not support the reverb api. + + The numerical values listed below are the maximum, minimum and default values for each variable respectively. - [SEE_ALSO] - FSOUND_Reverb_SetChannelProperties - FSOUND_Reverb_GetChannelProperties - FSOUND_REVERB_CHANNELFLAGS + [SEE_ALSO] + FSOUND_Reverb_SetChannelProperties + FSOUND_Reverb_GetChannelProperties + FSOUND_REVERB_CHANNELFLAGS ] */ -typedef struct _FSOUND_REVERB_CHANNELPROPERTIES /* MIN MAX DEFAULT */ -{ - int Direct; /* -10000, 1000, 0, direct path level (at low and mid frequencies) (WIN32/XBOX) */ - int DirectHF; /* -10000, 0, 0, relative direct path level at high frequencies (WIN32/XBOX) */ - int Room; /* -10000, 1000, 0, room effect level (at low and mid frequencies) (WIN32/XBOX/PS2) */ - int RoomHF; /* -10000, 0, 0, relative room effect level at high frequencies (WIN32/XBOX) */ - int Obstruction; /* -10000, 0, 0, main obstruction control (attenuation at high frequencies) (WIN32/XBOX) */ - float ObstructionLFRatio; /* 0.0, 1.0, 0.0, obstruction low-frequency level re. main control (WIN32/XBOX) */ - int Occlusion; /* -10000, 0, 0, main occlusion control (attenuation at high frequencies) (WIN32/XBOX) */ - float OcclusionLFRatio; /* 0.0, 1.0, 0.25, occlusion low-frequency level re. main control (WIN32/XBOX) */ - float OcclusionRoomRatio; /* 0.0, 10.0, 1.5, relative occlusion control for room effect (WIN32) */ - float OcclusionDirectRatio; /* 0.0, 10.0, 1.0, relative occlusion control for direct path (WIN32) */ - int Exclusion; /* -10000, 0, 0, main exlusion control (attenuation at high frequencies) (WIN32) */ - float ExclusionLFRatio; /* 0.0, 1.0, 1.0, exclusion low-frequency level re. main control (WIN32) */ - int OutsideVolumeHF; /* -10000, 0, 0, outside sound cone level at high frequencies (WIN32) */ - float DopplerFactor; /* 0.0, 10.0, 0.0, like DS3D flDopplerFactor but per source (WIN32) */ - float RolloffFactor; /* 0.0, 10.0, 0.0, like DS3D flRolloffFactor but per source (WIN32) */ - float RoomRolloffFactor; /* 0.0, 10.0, 0.0, like DS3D flRolloffFactor but for room effect (WIN32/XBOX) */ - float AirAbsorptionFactor; /* 0.0, 10.0, 1.0, multiplies AirAbsorptionHF member of FSOUND_REVERB_PROPERTIES (WIN32) */ - int Flags; /* FSOUND_REVERB_CHANNELFLAGS - modifies the behavior of properties (WIN32) */ +typedef struct _FSOUND_REVERB_CHANNELPROPERTIES /* MIN MAX DEFAULT */ +{ + int Direct; /* -10000, 1000, 0, direct path level (at low and mid frequencies) (WIN32/XBOX) */ + int DirectHF; /* -10000, 0, 0, relative direct path level at high frequencies (WIN32/XBOX) */ + int Room; /* -10000, 1000, 0, room effect level (at low and mid frequencies) (WIN32/XBOX/PS2) */ + int RoomHF; /* -10000, 0, 0, relative room effect level at high frequencies (WIN32/XBOX) */ + int Obstruction; /* -10000, 0, 0, main obstruction control (attenuation at high frequencies) (WIN32/XBOX) */ + float ObstructionLFRatio; /* 0.0, 1.0, 0.0, obstruction low-frequency level re. main control (WIN32/XBOX) */ + int Occlusion; /* -10000, 0, 0, main occlusion control (attenuation at high frequencies) (WIN32/XBOX) */ + float OcclusionLFRatio; /* 0.0, 1.0, 0.25, occlusion low-frequency level re. main control (WIN32/XBOX) */ + float OcclusionRoomRatio; /* 0.0, 10.0, 1.5, relative occlusion control for room effect (WIN32) */ + float OcclusionDirectRatio; /* 0.0, 10.0, 1.0, relative occlusion control for direct path (WIN32) */ + int Exclusion; /* -10000, 0, 0, main exlusion control (attenuation at high frequencies) (WIN32) */ + float ExclusionLFRatio; /* 0.0, 1.0, 1.0, exclusion low-frequency level re. main control (WIN32) */ + int OutsideVolumeHF; /* -10000, 0, 0, outside sound cone level at high frequencies (WIN32) */ + float DopplerFactor; /* 0.0, 10.0, 0.0, like DS3D flDopplerFactor but per source (WIN32) */ + float RolloffFactor; /* 0.0, 10.0, 0.0, like DS3D flRolloffFactor but per source (WIN32) */ + float RoomRolloffFactor; /* 0.0, 10.0, 0.0, like DS3D flRolloffFactor but for room effect (WIN32/XBOX) */ + float AirAbsorptionFactor; /* 0.0, 10.0, 1.0, multiplies AirAbsorptionHF member of FSOUND_REVERB_PROPERTIES (WIN32) */ + int Flags; /* FSOUND_REVERB_CHANNELFLAGS - modifies the behavior of properties (WIN32) */ } FSOUND_REVERB_CHANNELPROPERTIES; /* [DEFINE_START] [ - [NAME] - FSOUND_REVERB_CHANNELFLAGS - - [DESCRIPTION] - Values for the Flags member of the FSOUND_REVERB_CHANNELPROPERTIES structure. + [NAME] + FSOUND_REVERB_CHANNELFLAGS + + [DESCRIPTION] + Values for the Flags member of the FSOUND_REVERB_CHANNELPROPERTIES structure. - [SEE_ALSO] - FSOUND_REVERB_CHANNELPROPERTIES + [SEE_ALSO] + FSOUND_REVERB_CHANNELPROPERTIES ] */ -#define FSOUND_REVERB_CHANNELFLAGS_DIRECTHFAUTO 0x00000001 /* Automatic setting of 'Direct' due to distance from listener */ -#define FSOUND_REVERB_CHANNELFLAGS_ROOMAUTO 0x00000002 /* Automatic setting of 'Room' due to distance from listener */ -#define FSOUND_REVERB_CHANNELFLAGS_ROOMHFAUTO 0x00000004 /* Automatic setting of 'RoomHF' due to distance from listener */ -#define FSOUND_REVERB_CHANNELFLAGS_DEFAULT (FSOUND_REVERB_CHANNELFLAGS_DIRECTHFAUTO | \ - FSOUND_REVERB_CHANNELFLAGS_ROOMAUTO| \ - FSOUND_REVERB_CHANNELFLAGS_ROOMHFAUTO) +#define FSOUND_REVERB_CHANNELFLAGS_DIRECTHFAUTO 0x00000001 /* Automatic setting of 'Direct' due to distance from listener */ +#define FSOUND_REVERB_CHANNELFLAGS_ROOMAUTO 0x00000002 /* Automatic setting of 'Room' due to distance from listener */ +#define FSOUND_REVERB_CHANNELFLAGS_ROOMHFAUTO 0x00000004 /* Automatic setting of 'RoomHF' due to distance from listener */ +#define FSOUND_REVERB_CHANNELFLAGS_DEFAULT (FSOUND_REVERB_CHANNELFLAGS_DIRECTHFAUTO | \ + FSOUND_REVERB_CHANNELFLAGS_ROOMAUTO| \ + FSOUND_REVERB_CHANNELFLAGS_ROOMHFAUTO) /* [DEFINE_END] */ /* [ENUM] [ - [DESCRIPTION] - These values are used with FSOUND_FX_Enable to enable DirectX 8 FX for a channel. + [DESCRIPTION] + These values are used with FSOUND_FX_Enable to enable DirectX 8 FX for a channel. - [SEE_ALSO] - FSOUND_FX_Enable - FSOUND_FX_Disable - FSOUND_FX_SetChorus - FSOUND_FX_SetCompressor - FSOUND_FX_SetDistortion - FSOUND_FX_SetEcho - FSOUND_FX_SetFlanger - FSOUND_FX_SetGargle - FSOUND_FX_SetI3DL2Reverb - FSOUND_FX_SetParamEQ - FSOUND_FX_SetWavesReverb + [SEE_ALSO] + FSOUND_FX_Enable + FSOUND_FX_Disable + FSOUND_FX_SetChorus + FSOUND_FX_SetCompressor + FSOUND_FX_SetDistortion + FSOUND_FX_SetEcho + FSOUND_FX_SetFlanger + FSOUND_FX_SetGargle + FSOUND_FX_SetI3DL2Reverb + FSOUND_FX_SetParamEQ + FSOUND_FX_SetWavesReverb ] */ enum FSOUND_FX_MODES { - FSOUND_FX_CHORUS, - FSOUND_FX_COMPRESSOR, - FSOUND_FX_DISTORTION, - FSOUND_FX_ECHO, - FSOUND_FX_FLANGER, - FSOUND_FX_GARGLE, - FSOUND_FX_I3DL2REVERB, - FSOUND_FX_PARAMEQ, - FSOUND_FX_WAVES_REVERB, + FSOUND_FX_CHORUS, + FSOUND_FX_COMPRESSOR, + FSOUND_FX_DISTORTION, + FSOUND_FX_ECHO, + FSOUND_FX_FLANGER, + FSOUND_FX_GARGLE, + FSOUND_FX_I3DL2REVERB, + FSOUND_FX_PARAMEQ, + FSOUND_FX_WAVES_REVERB, - FSOUND_FX_MAX + FSOUND_FX_MAX }; /* [ENUM] [ - [DESCRIPTION] - These are speaker types defined for use with the FSOUND_SetSpeakerMode command. - Note - Only reliably works with FSOUND_OUTPUT_DSOUND or FSOUND_OUTPUT_XBOX output modes. Other output modes will only - interpret FSOUND_SPEAKERMODE_MONO and set everything else to be stereo. + [DESCRIPTION] + These are speaker types defined for use with the FSOUND_SetSpeakerMode command. + Note - Only reliably works with FSOUND_OUTPUT_DSOUND or FSOUND_OUTPUT_XBOX output modes. Other output modes will only + interpret FSOUND_SPEAKERMODE_MONO and set everything else to be stereo. - Using either DolbyDigital or DTS will use whatever 5.1 digital mode is available if destination hardware is unsure. + Using either DolbyDigital or DTS will use whatever 5.1 digital mode is available if destination hardware is unsure. - [SEE_ALSO] - FSOUND_SetSpeakerMode + [SEE_ALSO] + FSOUND_SetSpeakerMode ] */ enum FSOUND_SPEAKERMODES { - FSOUND_SPEAKERMODE_DOLBYDIGITAL, /* Dolby Digital Output (XBOX or PC only). */ - FSOUND_SPEAKERMODE_HEADPHONES, /* The speakers are headphones. */ - FSOUND_SPEAKERMODE_MONO, /* The speakers are monaural. */ - FSOUND_SPEAKERMODE_QUAD, /* The speakers are quadraphonic. */ - FSOUND_SPEAKERMODE_STEREO, /* The speakers are stereo (default value). */ - FSOUND_SPEAKERMODE_SURROUND, /* The speakers are surround sound. */ - FSOUND_SPEAKERMODE_DTS, /* DTS output (XBOX only). */ - FSOUND_SPEAKERMODE_PROLOGIC2, /* Dolby Prologic 2. Playstation 2 and Gamecube only. PlayStation 2 doesnt support interior panning, but supports 48 voices simultaneously. */ - FSOUND_SPEAKERMODE_PROLOGIC2_INTERIOR /* Dolby Prologic 2. Playstation 2 and Gamecube only. PlayStation 2 does support interior panning, but only supports 24 voices simultaneously. */ + FSOUND_SPEAKERMODE_DOLBYDIGITAL, /* Dolby Digital Output (XBOX or PC only). */ + FSOUND_SPEAKERMODE_HEADPHONES, /* The speakers are headphones. */ + FSOUND_SPEAKERMODE_MONO, /* The speakers are monaural. */ + FSOUND_SPEAKERMODE_QUAD, /* The speakers are quadraphonic. */ + FSOUND_SPEAKERMODE_STEREO, /* The speakers are stereo (default value). */ + FSOUND_SPEAKERMODE_SURROUND, /* The speakers are surround sound. */ + FSOUND_SPEAKERMODE_DTS, /* DTS output (XBOX only). */ + FSOUND_SPEAKERMODE_PROLOGIC2, /* Dolby Prologic 2. Playstation 2 and Gamecube only. PlayStation 2 doesnt support interior panning, but supports 48 voices simultaneously. */ + FSOUND_SPEAKERMODE_PROLOGIC2_INTERIOR /* Dolby Prologic 2. Playstation 2 and Gamecube only. PlayStation 2 does support interior panning, but only supports 24 voices simultaneously. */ }; /* [DEFINE_START] [ - [NAME] - FSOUND_INIT_FLAGS - - [DESCRIPTION] - Initialization flags. Use them with FSOUND_Init in the flags parameter to change various behaviour. - - FSOUND_INIT_ENABLESYSTEMCHANNELFX Is an init mode which enables the FSOUND mixer buffer to be affected by DirectX 8 effects. - Note that due to limitations of DirectSound, FSOUND_Init may fail if this is enabled because the buffersize is too small. - This can be fixed with FSOUND_SetBufferSize. Increase the BufferSize until it works. - When it is enabled you can use the FSOUND_FX api, and use FSOUND_SYSTEMCHANNEL as the channel id when setting parameters. + [NAME] + FSOUND_INIT_FLAGS + + [DESCRIPTION] + Initialization flags. Use them with FSOUND_Init in the flags parameter to change various behaviour. + + FSOUND_INIT_ENABLESYSTEMCHANNELFX Is an init mode which enables the FSOUND mixer buffer to be affected by DirectX 8 effects. + Note that due to limitations of DirectSound, FSOUND_Init may fail if this is enabled because the buffersize is too small. + This can be fixed with FSOUND_SetBufferSize. Increase the BufferSize until it works. + When it is enabled you can use the FSOUND_FX api, and use FSOUND_SYSTEMCHANNEL as the channel id when setting parameters. - [SEE_ALSO] - FSOUND_Init + [SEE_ALSO] + FSOUND_Init ] */ -#define FSOUND_INIT_USEDEFAULTMIDISYNTH 0x0001 /* Win32 only - Causes MIDI playback to force software decoding. */ -#define FSOUND_INIT_GLOBALFOCUS 0x0002 /* Win32 only - For DirectSound output - sound is not muted when window is out of focus. */ -#define FSOUND_INIT_ENABLESYSTEMCHANNELFX 0x0004 /* Win32 only - For DirectSound output - Allows FSOUND_FX api to be used on global software mixer output! (use FSOUND_SYSTEMCHANNEL as channel id) */ -#define FSOUND_INIT_ACCURATEVULEVELS 0x0008 /* This latency adjusts FSOUND_GetCurrentLevels, but incurs a small cpu and memory hit */ -#define FSOUND_INIT_PS2_DISABLECORE0REVERB 0x0010 /* PS2 only - Disable reverb on CORE 0 (SPU2 voices 00-23) to regain SRAM */ -#define FSOUND_INIT_PS2_DISABLECORE1REVERB 0x0020 /* PS2 only - Disable reverb on CORE 1 (SPU2 voices 24-47) to regain SRAM */ -#define FSOUND_INIT_PS2_SWAPDMACORES 0x0040 /* PS2 only - By default FMOD uses DMA CH0 for mixing, CH1 for uploads, this flag swaps them around */ -#define FSOUND_INIT_DONTLATENCYADJUST 0x0080 /* Callbacks are not latency adjusted, and are called at mix time. Also information functions are immediate */ -#define FSOUND_INIT_GC_INITLIBS 0x0100 /* GC only - Initializes GC audio libraries */ -#define FSOUND_INIT_STREAM_FROM_MAIN_THREAD 0x0200 /* Turns off fmod streamer thread, and makes streaming update from FSOUND_Update called by the user */ -#define FSOUND_INIT_PS2_USEVOLUMERAMPING 0x0400 /* PS2 only - Turns on volume ramping system to remove hardware clicks. */ -#define FSOUND_INIT_DSOUND_DEFERRED 0x0800 /* Win32 only - For DirectSound output. 3D commands are batched together and executed at FSOUND_Update. */ -#define FSOUND_INIT_DSOUND_HRTF_LIGHT 0x1000 /* Win32 only - For DirectSound output. FSOUND_HW3D buffers use a slightly higher quality algorithm when 3d hardware acceleration is not present. */ -#define FSOUND_INIT_DSOUND_HRTF_FULL 0x2000 /* Win32 only - For DirectSound output. FSOUND_HW3D buffers use full quality 3d playback when 3d hardware acceleration is not present. */ -#define FSOUND_INIT_XBOX_REMOVEHEADROOM 0x4000 /* XBox only - By default directsound attenuates all sound by 6db to avoid clipping/distortion. CAUTION. If you use this flag you are responsible for the final mix to make sure clipping / distortion doesn't happen. */ -#define FSOUND_INIT_PSP_SILENCEONUNDERRUN 0x8000 /* PSP only - If streams skip / stutter when device is powered on, either increase stream buffersize, or use this flag instead to play silence while the UMD is recovering. */ +#define FSOUND_INIT_USEDEFAULTMIDISYNTH 0x0001 /* Win32 only - Causes MIDI playback to force software decoding. */ +#define FSOUND_INIT_GLOBALFOCUS 0x0002 /* Win32 only - For DirectSound output - sound is not muted when window is out of focus. */ +#define FSOUND_INIT_ENABLESYSTEMCHANNELFX 0x0004 /* Win32 only - For DirectSound output - Allows FSOUND_FX api to be used on global software mixer output! (use FSOUND_SYSTEMCHANNEL as channel id) */ +#define FSOUND_INIT_ACCURATEVULEVELS 0x0008 /* This latency adjusts FSOUND_GetCurrentLevels, but incurs a small cpu and memory hit */ +#define FSOUND_INIT_PS2_DISABLECORE0REVERB 0x0010 /* PS2 only - Disable reverb on CORE 0 (SPU2 voices 00-23) to regain SRAM */ +#define FSOUND_INIT_PS2_DISABLECORE1REVERB 0x0020 /* PS2 only - Disable reverb on CORE 1 (SPU2 voices 24-47) to regain SRAM */ +#define FSOUND_INIT_PS2_SWAPDMACORES 0x0040 /* PS2 only - By default FMOD uses DMA CH0 for mixing, CH1 for uploads, this flag swaps them around */ +#define FSOUND_INIT_DONTLATENCYADJUST 0x0080 /* Callbacks are not latency adjusted, and are called at mix time. Also information functions are immediate */ +#define FSOUND_INIT_GC_INITLIBS 0x0100 /* GC only - Initializes GC audio libraries */ +#define FSOUND_INIT_STREAM_FROM_MAIN_THREAD 0x0200 /* Turns off fmod streamer thread, and makes streaming update from FSOUND_Update called by the user */ +#define FSOUND_INIT_PS2_USEVOLUMERAMPING 0x0400 /* PS2 only - Turns on volume ramping system to remove hardware clicks. */ +#define FSOUND_INIT_DSOUND_DEFERRED 0x0800 /* Win32 only - For DirectSound output. 3D commands are batched together and executed at FSOUND_Update. */ +#define FSOUND_INIT_DSOUND_HRTF_LIGHT 0x1000 /* Win32 only - For DirectSound output. FSOUND_HW3D buffers use a slightly higher quality algorithm when 3d hardware acceleration is not present. */ +#define FSOUND_INIT_DSOUND_HRTF_FULL 0x2000 /* Win32 only - For DirectSound output. FSOUND_HW3D buffers use full quality 3d playback when 3d hardware acceleration is not present. */ +#define FSOUND_INIT_XBOX_REMOVEHEADROOM 0x4000 /* XBox only - By default directsound attenuates all sound by 6db to avoid clipping/distortion. CAUTION. If you use this flag you are responsible for the final mix to make sure clipping / distortion doesn't happen. */ +#define FSOUND_INIT_PSP_SILENCEONUNDERRUN 0x8000 /* PSP only - If streams skip / stutter when device is powered on, either increase stream buffersize, or use this flag instead to play silence while the UMD is recovering. */ /* [DEFINE_END] */ /* [ENUM] [ - [DESCRIPTION] - Status values for internet streams. Use FSOUND_Stream_Net_GetStatus to get the current status of an internet stream. + [DESCRIPTION] + Status values for internet streams. Use FSOUND_Stream_Net_GetStatus to get the current status of an internet stream. - [SEE_ALSO] - FSOUND_Stream_Net_GetStatus + [SEE_ALSO] + FSOUND_Stream_Net_GetStatus ] */ enum FSOUND_STREAM_NET_STATUS { - FSOUND_STREAM_NET_NOTCONNECTED = 0, /* Stream hasn't connected yet */ - FSOUND_STREAM_NET_CONNECTING, /* Stream is connecting to remote host */ - FSOUND_STREAM_NET_BUFFERING, /* Stream is buffering data */ - FSOUND_STREAM_NET_READY, /* Stream is ready to play */ - FSOUND_STREAM_NET_ERROR /* Stream has suffered a fatal error */ + FSOUND_STREAM_NET_NOTCONNECTED = 0, /* Stream hasn't connected yet */ + FSOUND_STREAM_NET_CONNECTING, /* Stream is connecting to remote host */ + FSOUND_STREAM_NET_BUFFERING, /* Stream is buffering data */ + FSOUND_STREAM_NET_READY, /* Stream is ready to play */ + FSOUND_STREAM_NET_ERROR /* Stream has suffered a fatal error */ }; /* [ENUM] [ - [DESCRIPTION] - Describes the type of a particular tag field. + [DESCRIPTION] + Describes the type of a particular tag field. - [SEE_ALSO] - FSOUND_Stream_GetNumTagFields - FSOUND_Stream_GetTagField - FSOUND_Stream_FindTagField + [SEE_ALSO] + FSOUND_Stream_GetNumTagFields + FSOUND_Stream_GetTagField + FSOUND_Stream_FindTagField ] */ enum FSOUND_TAGFIELD_TYPE { - FSOUND_TAGFIELD_VORBISCOMMENT = 0, /* A vorbis comment */ - FSOUND_TAGFIELD_ID3V1, /* Part of an ID3v1 tag */ - FSOUND_TAGFIELD_ID3V2, /* An ID3v2 frame */ - FSOUND_TAGFIELD_SHOUTCAST, /* A SHOUTcast header line */ - FSOUND_TAGFIELD_ICECAST, /* An Icecast header line */ - FSOUND_TAGFIELD_ASF /* An Advanced Streaming Format header line */ + FSOUND_TAGFIELD_VORBISCOMMENT = 0, /* A vorbis comment */ + FSOUND_TAGFIELD_ID3V1, /* Part of an ID3v1 tag */ + FSOUND_TAGFIELD_ID3V2, /* An ID3v2 frame */ + FSOUND_TAGFIELD_SHOUTCAST, /* A SHOUTcast header line */ + FSOUND_TAGFIELD_ICECAST, /* An Icecast header line */ + FSOUND_TAGFIELD_ASF /* An Advanced Streaming Format header line */ }; /* [DEFINE_START] [ - [NAME] - FSOUND_STATUS_FLAGS - - [DESCRIPTION] - These values describe the protocol and format of an internet stream. Use FSOUND_Stream_Net_GetStatus to retrieve this information for an open internet stream. - - [SEE_ALSO] - FSOUND_Stream_Net_GetStatus + [NAME] + FSOUND_STATUS_FLAGS + + [DESCRIPTION] + These values describe the protocol and format of an internet stream. Use FSOUND_Stream_Net_GetStatus to retrieve this information for an open internet stream. + + [SEE_ALSO] + FSOUND_Stream_Net_GetStatus ] */ -#define FSOUND_PROTOCOL_SHOUTCAST 0x00000001 -#define FSOUND_PROTOCOL_ICECAST 0x00000002 -#define FSOUND_PROTOCOL_HTTP 0x00000004 -#define FSOUND_FORMAT_MPEG 0x00010000 -#define FSOUND_FORMAT_OGGVORBIS 0x00020000 +#define FSOUND_PROTOCOL_SHOUTCAST 0x00000001 +#define FSOUND_PROTOCOL_ICECAST 0x00000002 +#define FSOUND_PROTOCOL_HTTP 0x00000004 +#define FSOUND_FORMAT_MPEG 0x00010000 +#define FSOUND_FORMAT_OGGVORBIS 0x00020000 /* [DEFINE_END] */ /* [STRUCTURE] [ - [DESCRIPTION] - Structure defining a CD table of contents. This structure is returned as a tag from FSOUND_Stream_FindTagField when the tag name "CD_TOC" is specified. - Note: All tracks on the CD - including data tracks- will be represented in this structure so it's use for anything other than generating disc id information is not recommended. - See the cdda example program for info on retrieving and using this structure. + [DESCRIPTION] + Structure defining a CD table of contents. This structure is returned as a tag from FSOUND_Stream_FindTagField when the tag name "CD_TOC" is specified. + Note: All tracks on the CD - including data tracks- will be represented in this structure so it's use for anything other than generating disc id information is not recommended. + See the cdda example program for info on retrieving and using this structure. - [SEE_ALSO] - FSOUND_Stream_Open - FSOUND_Stream_FindTagField + [SEE_ALSO] + FSOUND_Stream_Open + FSOUND_Stream_FindTagField ] */ typedef struct _FSOUND_TOC_TAG { - char name[4]; /* The string "TOC", just in case this structure is accidentally treated as a string */ - int numtracks; /* The number of tracks on the CD */ - int min[100]; /* The start offset of each track in minutes */ - int sec[100]; /* The start offset of each track in seconds */ - int frame[100]; /* The start offset of each track in frames */ + char name[4]; /* The string "TOC", just in case this structure is accidentally treated as a string */ + int numtracks; /* The number of tracks on the CD */ + int min[100]; /* The start offset of each track in minutes */ + int sec[100]; /* The start offset of each track in seconds */ + int frame[100]; /* The start offset of each track in frames */ } FSOUND_TOC_TAG; /* ========================================================================================== */ -/* FUNCTION PROTOTYPES */ +/* FUNCTION PROTOTYPES */ /* ========================================================================================== */ #ifdef __cplusplus @@ -778,321 +778,321 @@ extern "C" { /* ================================== */ /* - PRE - FSOUND_Init functions. These can't be called after FSOUND_Init is - called (they will fail). They set up FMOD system functionality. + PRE - FSOUND_Init functions. These can't be called after FSOUND_Init is + called (they will fail). They set up FMOD system functionality. */ -DLL_API signed char F_API FSOUND_SetOutput(int outputtype); -DLL_API signed char F_API FSOUND_SetDriver(int driver); -DLL_API signed char F_API FSOUND_SetMixer(int mixer); -DLL_API signed char F_API FSOUND_SetBufferSize(int len_ms); -DLL_API signed char F_API FSOUND_SetHWND(void *hwnd); -DLL_API signed char F_API FSOUND_SetMinHardwareChannels(int min); -DLL_API signed char F_API FSOUND_SetMaxHardwareChannels(int max); -DLL_API signed char F_API FSOUND_SetMemorySystem(void *pool, - int poollen, - FSOUND_ALLOCCALLBACK useralloc, - FSOUND_REALLOCCALLBACK userrealloc, - FSOUND_FREECALLBACK userfree); +DLL_API signed char F_API FSOUND_SetOutput(int outputtype); +DLL_API signed char F_API FSOUND_SetDriver(int driver); +DLL_API signed char F_API FSOUND_SetMixer(int mixer); +DLL_API signed char F_API FSOUND_SetBufferSize(int len_ms); +DLL_API signed char F_API FSOUND_SetHWND(void *hwnd); +DLL_API signed char F_API FSOUND_SetMinHardwareChannels(int min); +DLL_API signed char F_API FSOUND_SetMaxHardwareChannels(int max); +DLL_API signed char F_API FSOUND_SetMemorySystem(void *pool, + int poollen, + FSOUND_ALLOCCALLBACK useralloc, + FSOUND_REALLOCCALLBACK userrealloc, + FSOUND_FREECALLBACK userfree); /* - Main initialization / closedown functions. - Note : Use FSOUND_INIT_USEDEFAULTMIDISYNTH with FSOUND_Init for software override - with MIDI playback. - : Use FSOUND_INIT_GLOBALFOCUS with FSOUND_Init to make sound audible no matter - which window is in focus. (FSOUND_OUTPUT_DSOUND only) + Main initialization / closedown functions. + Note : Use FSOUND_INIT_USEDEFAULTMIDISYNTH with FSOUND_Init for software override + with MIDI playback. + : Use FSOUND_INIT_GLOBALFOCUS with FSOUND_Init to make sound audible no matter + which window is in focus. (FSOUND_OUTPUT_DSOUND only) */ -DLL_API signed char F_API FSOUND_Init(int mixrate, int maxsoftwarechannels, unsigned int flags); -DLL_API void F_API FSOUND_Close(); +DLL_API signed char F_API FSOUND_Init(int mixrate, int maxsoftwarechannels, unsigned int flags); +DLL_API void F_API FSOUND_Close(); /* - Runtime system level functions + Runtime system level functions */ -DLL_API void F_API FSOUND_Update(); /* This is called to update 3d sound / non-realtime output */ +DLL_API void F_API FSOUND_Update(); /* This is called to update 3d sound / non-realtime output */ -DLL_API void F_API FSOUND_SetSpeakerMode(unsigned int speakermode); -DLL_API void F_API FSOUND_SetSFXMasterVolume(int volume); -DLL_API void F_API FSOUND_SetPanSeperation(float pansep); -DLL_API void F_API FSOUND_File_SetCallbacks(FSOUND_OPENCALLBACK useropen, - FSOUND_CLOSECALLBACK userclose, - FSOUND_READCALLBACK userread, - FSOUND_SEEKCALLBACK userseek, - FSOUND_TELLCALLBACK usertell); +DLL_API void F_API FSOUND_SetSpeakerMode(unsigned int speakermode); +DLL_API void F_API FSOUND_SetSFXMasterVolume(int volume); +DLL_API void F_API FSOUND_SetPanSeperation(float pansep); +DLL_API void F_API FSOUND_File_SetCallbacks(FSOUND_OPENCALLBACK useropen, + FSOUND_CLOSECALLBACK userclose, + FSOUND_READCALLBACK userread, + FSOUND_SEEKCALLBACK userseek, + FSOUND_TELLCALLBACK usertell); /* - System information functions. + System information functions. */ -DLL_API int F_API FSOUND_GetError(); -DLL_API float F_API FSOUND_GetVersion(); -DLL_API int F_API FSOUND_GetOutput(); -DLL_API void * F_API FSOUND_GetOutputHandle(); -DLL_API int F_API FSOUND_GetDriver(); -DLL_API int F_API FSOUND_GetMixer(); -DLL_API int F_API FSOUND_GetNumDrivers(); -DLL_API const STR8 F_API FSOUND_GetDriverName(int id); -DLL_API signed char F_API FSOUND_GetDriverCaps(int id, unsigned int *caps); -DLL_API int F_API FSOUND_GetOutputRate(); -DLL_API int F_API FSOUND_GetMaxChannels(); -DLL_API int F_API FSOUND_GetMaxSamples(); -DLL_API unsigned int F_API FSOUND_GetSpeakerMode(); -DLL_API int F_API FSOUND_GetSFXMasterVolume(); -DLL_API signed char F_API FSOUND_GetNumHWChannels(int *num2d, int *num3d, int *total); -DLL_API int F_API FSOUND_GetChannelsPlaying(); -DLL_API float F_API FSOUND_GetCPUUsage(); -DLL_API void F_API FSOUND_GetMemoryStats(unsigned int *currentalloced, unsigned int *maxalloced); +DLL_API int F_API FSOUND_GetError(); +DLL_API float F_API FSOUND_GetVersion(); +DLL_API int F_API FSOUND_GetOutput(); +DLL_API void * F_API FSOUND_GetOutputHandle(); +DLL_API int F_API FSOUND_GetDriver(); +DLL_API int F_API FSOUND_GetMixer(); +DLL_API int F_API FSOUND_GetNumDrivers(); +DLL_API const STR8 F_API FSOUND_GetDriverName(int id); +DLL_API signed char F_API FSOUND_GetDriverCaps(int id, unsigned int *caps); +DLL_API int F_API FSOUND_GetOutputRate(); +DLL_API int F_API FSOUND_GetMaxChannels(); +DLL_API int F_API FSOUND_GetMaxSamples(); +DLL_API unsigned int F_API FSOUND_GetSpeakerMode(); +DLL_API int F_API FSOUND_GetSFXMasterVolume(); +DLL_API signed char F_API FSOUND_GetNumHWChannels(int *num2d, int *num3d, int *total); +DLL_API int F_API FSOUND_GetChannelsPlaying(); +DLL_API float F_API FSOUND_GetCPUUsage(); +DLL_API void F_API FSOUND_GetMemoryStats(unsigned int *currentalloced, unsigned int *maxalloced); /* =================================== */ /* Sample management / load functions. */ /* =================================== */ /* - Sample creation and management functions - Note : Use FSOUND_LOADMEMORY flag with FSOUND_Sample_Load to load from memory. - Use FSOUND_LOADRAW flag with FSOUND_Sample_Load to treat as as raw pcm data. + Sample creation and management functions + Note : Use FSOUND_LOADMEMORY flag with FSOUND_Sample_Load to load from memory. + Use FSOUND_LOADRAW flag with FSOUND_Sample_Load to treat as as raw pcm data. */ DLL_API FSOUND_SAMPLE * F_API FSOUND_Sample_Load(int index, const STR8 name_or_data, unsigned int mode, int offset, int length); DLL_API FSOUND_SAMPLE * F_API FSOUND_Sample_Alloc(int index, int length, unsigned int mode, int deffreq, int defvol, int defpan, int defpri); -DLL_API void F_API FSOUND_Sample_Free(FSOUND_SAMPLE *sptr); -DLL_API signed char F_API FSOUND_Sample_Upload(FSOUND_SAMPLE *sptr, void *srcdata, unsigned int mode); -DLL_API signed char F_API FSOUND_Sample_Lock(FSOUND_SAMPLE *sptr, int offset, int length, void **ptr1, void **ptr2, unsigned int *len1, unsigned int *len2); -DLL_API signed char F_API FSOUND_Sample_Unlock(FSOUND_SAMPLE *sptr, void *ptr1, void *ptr2, unsigned int len1, unsigned int len2); +DLL_API void F_API FSOUND_Sample_Free(FSOUND_SAMPLE *sptr); +DLL_API signed char F_API FSOUND_Sample_Upload(FSOUND_SAMPLE *sptr, void *srcdata, unsigned int mode); +DLL_API signed char F_API FSOUND_Sample_Lock(FSOUND_SAMPLE *sptr, int offset, int length, void **ptr1, void **ptr2, unsigned int *len1, unsigned int *len2); +DLL_API signed char F_API FSOUND_Sample_Unlock(FSOUND_SAMPLE *sptr, void *ptr1, void *ptr2, unsigned int len1, unsigned int len2); /* - Sample control functions + Sample control functions */ -DLL_API signed char F_API FSOUND_Sample_SetMode(FSOUND_SAMPLE *sptr, unsigned int mode); -DLL_API signed char F_API FSOUND_Sample_SetLoopPoints(FSOUND_SAMPLE *sptr, int loopstart, int loopend); -DLL_API signed char F_API FSOUND_Sample_SetDefaults(FSOUND_SAMPLE *sptr, int deffreq, int defvol, int defpan, int defpri); -DLL_API signed char F_API FSOUND_Sample_SetDefaultsEx(FSOUND_SAMPLE *sptr, int deffreq, int defvol, int defpan, int defpri, int varfreq, int varvol, int varpan); -DLL_API signed char F_API FSOUND_Sample_SetMinMaxDistance(FSOUND_SAMPLE *sptr, float min, float max); -DLL_API signed char F_API FSOUND_Sample_SetMaxPlaybacks(FSOUND_SAMPLE *sptr, int max); +DLL_API signed char F_API FSOUND_Sample_SetMode(FSOUND_SAMPLE *sptr, unsigned int mode); +DLL_API signed char F_API FSOUND_Sample_SetLoopPoints(FSOUND_SAMPLE *sptr, int loopstart, int loopend); +DLL_API signed char F_API FSOUND_Sample_SetDefaults(FSOUND_SAMPLE *sptr, int deffreq, int defvol, int defpan, int defpri); +DLL_API signed char F_API FSOUND_Sample_SetDefaultsEx(FSOUND_SAMPLE *sptr, int deffreq, int defvol, int defpan, int defpri, int varfreq, int varvol, int varpan); +DLL_API signed char F_API FSOUND_Sample_SetMinMaxDistance(FSOUND_SAMPLE *sptr, float min, float max); +DLL_API signed char F_API FSOUND_Sample_SetMaxPlaybacks(FSOUND_SAMPLE *sptr, int max); /* - Sample information functions + Sample information functions */ DLL_API FSOUND_SAMPLE * F_API FSOUND_Sample_Get(int sampno); -DLL_API const STR8 F_API FSOUND_Sample_GetName(FSOUND_SAMPLE *sptr); -DLL_API unsigned int F_API FSOUND_Sample_GetLength(FSOUND_SAMPLE *sptr); -DLL_API signed char F_API FSOUND_Sample_GetLoopPoints(FSOUND_SAMPLE *sptr, int *loopstart, int *loopend); -DLL_API signed char F_API FSOUND_Sample_GetDefaults(FSOUND_SAMPLE *sptr, int *deffreq, int *defvol, int *defpan, int *defpri); -DLL_API signed char F_API FSOUND_Sample_GetDefaultsEx(FSOUND_SAMPLE *sptr, int *deffreq, int *defvol, int *defpan, int *defpri, int *varfreq, int *varvol, int *varpan); -DLL_API unsigned int F_API FSOUND_Sample_GetMode(FSOUND_SAMPLE *sptr); -DLL_API signed char F_API FSOUND_Sample_GetMinMaxDistance(FSOUND_SAMPLE *sptr, float *min, float *max); - +DLL_API const STR8 F_API FSOUND_Sample_GetName(FSOUND_SAMPLE *sptr); +DLL_API unsigned int F_API FSOUND_Sample_GetLength(FSOUND_SAMPLE *sptr); +DLL_API signed char F_API FSOUND_Sample_GetLoopPoints(FSOUND_SAMPLE *sptr, int *loopstart, int *loopend); +DLL_API signed char F_API FSOUND_Sample_GetDefaults(FSOUND_SAMPLE *sptr, int *deffreq, int *defvol, int *defpan, int *defpri); +DLL_API signed char F_API FSOUND_Sample_GetDefaultsEx(FSOUND_SAMPLE *sptr, int *deffreq, int *defvol, int *defpan, int *defpri, int *varfreq, int *varvol, int *varpan); +DLL_API unsigned int F_API FSOUND_Sample_GetMode(FSOUND_SAMPLE *sptr); +DLL_API signed char F_API FSOUND_Sample_GetMinMaxDistance(FSOUND_SAMPLE *sptr, float *min, float *max); + /* ============================ */ -/* Channel control functions. */ +/* Channel control functions. */ /* ============================ */ /* - Playing and stopping sounds. - Note : Use FSOUND_FREE as the 'channel' variable, to let FMOD pick a free channel for you. - Use FSOUND_ALL as the 'channel' variable to control ALL channels with one function call! + Playing and stopping sounds. + Note : Use FSOUND_FREE as the 'channel' variable, to let FMOD pick a free channel for you. + Use FSOUND_ALL as the 'channel' variable to control ALL channels with one function call! */ -DLL_API int F_API FSOUND_PlaySound(int channel, FSOUND_SAMPLE *sptr); -DLL_API int F_API FSOUND_PlaySoundEx(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused); -DLL_API signed char F_API FSOUND_StopSound(int channel); +DLL_API int F_API FSOUND_PlaySound(int channel, FSOUND_SAMPLE *sptr); +DLL_API int F_API FSOUND_PlaySoundEx(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused); +DLL_API signed char F_API FSOUND_StopSound(int channel); /* - Functions to control playback of a channel. - Note : FSOUND_ALL can be used on most of these functions as a channel value. + Functions to control playback of a channel. + Note : FSOUND_ALL can be used on most of these functions as a channel value. */ -DLL_API signed char F_API FSOUND_SetFrequency(int channel, int freq); -DLL_API signed char F_API FSOUND_SetVolume(int channel, int vol); -DLL_API signed char F_API FSOUND_SetVolumeAbsolute(int channel, int vol); -DLL_API signed char F_API FSOUND_SetPan(int channel, int pan); -DLL_API signed char F_API FSOUND_SetSurround(int channel, signed char surround); -DLL_API signed char F_API FSOUND_SetMute(int channel, signed char mute); -DLL_API signed char F_API FSOUND_SetPriority(int channel, int priority); -DLL_API signed char F_API FSOUND_SetReserved(int channel, signed char reserved); -DLL_API signed char F_API FSOUND_SetPaused(int channel, signed char paused); -DLL_API signed char F_API FSOUND_SetLoopMode(int channel, unsigned int loopmode); -DLL_API signed char F_API FSOUND_SetCurrentPosition(int channel, unsigned int offset); -DLL_API signed char F_API FSOUND_3D_SetAttributes(int channel, const float *pos, const float *vel); -DLL_API signed char F_API FSOUND_3D_SetMinMaxDistance(int channel, float min, float max); +DLL_API signed char F_API FSOUND_SetFrequency(int channel, int freq); +DLL_API signed char F_API FSOUND_SetVolume(int channel, int vol); +DLL_API signed char F_API FSOUND_SetVolumeAbsolute(int channel, int vol); +DLL_API signed char F_API FSOUND_SetPan(int channel, int pan); +DLL_API signed char F_API FSOUND_SetSurround(int channel, signed char surround); +DLL_API signed char F_API FSOUND_SetMute(int channel, signed char mute); +DLL_API signed char F_API FSOUND_SetPriority(int channel, int priority); +DLL_API signed char F_API FSOUND_SetReserved(int channel, signed char reserved); +DLL_API signed char F_API FSOUND_SetPaused(int channel, signed char paused); +DLL_API signed char F_API FSOUND_SetLoopMode(int channel, unsigned int loopmode); +DLL_API signed char F_API FSOUND_SetCurrentPosition(int channel, unsigned int offset); +DLL_API signed char F_API FSOUND_3D_SetAttributes(int channel, const float *pos, const float *vel); +DLL_API signed char F_API FSOUND_3D_SetMinMaxDistance(int channel, float min, float max); /* - Channel information functions. + Channel information functions. */ -DLL_API signed char F_API FSOUND_IsPlaying(int channel); -DLL_API int F_API FSOUND_GetFrequency(int channel); -DLL_API int F_API FSOUND_GetVolume(int channel); -DLL_API int F_API FSOUND_GetAmplitude(int channel); -DLL_API int F_API FSOUND_GetPan(int channel); -DLL_API signed char F_API FSOUND_GetSurround(int channel); -DLL_API signed char F_API FSOUND_GetMute(int channel); -DLL_API int F_API FSOUND_GetPriority(int channel); -DLL_API signed char F_API FSOUND_GetReserved(int channel); -DLL_API signed char F_API FSOUND_GetPaused(int channel); -DLL_API unsigned int F_API FSOUND_GetLoopMode(int channel); -DLL_API unsigned int F_API FSOUND_GetCurrentPosition(int channel); +DLL_API signed char F_API FSOUND_IsPlaying(int channel); +DLL_API int F_API FSOUND_GetFrequency(int channel); +DLL_API int F_API FSOUND_GetVolume(int channel); +DLL_API int F_API FSOUND_GetAmplitude(int channel); +DLL_API int F_API FSOUND_GetPan(int channel); +DLL_API signed char F_API FSOUND_GetSurround(int channel); +DLL_API signed char F_API FSOUND_GetMute(int channel); +DLL_API int F_API FSOUND_GetPriority(int channel); +DLL_API signed char F_API FSOUND_GetReserved(int channel); +DLL_API signed char F_API FSOUND_GetPaused(int channel); +DLL_API unsigned int F_API FSOUND_GetLoopMode(int channel); +DLL_API unsigned int F_API FSOUND_GetCurrentPosition(int channel); DLL_API FSOUND_SAMPLE * F_API FSOUND_GetCurrentSample(int channel); -DLL_API signed char F_API FSOUND_GetCurrentLevels(int channel, float *l, float *r); -DLL_API int F_API FSOUND_GetNumSubChannels(int channel); -DLL_API int F_API FSOUND_GetSubChannel(int channel, int subchannel); -DLL_API signed char F_API FSOUND_3D_GetAttributes(int channel, float *pos, float *vel); -DLL_API signed char F_API FSOUND_3D_GetMinMaxDistance(int channel, float *min, float *max); +DLL_API signed char F_API FSOUND_GetCurrentLevels(int channel, float *l, float *r); +DLL_API int F_API FSOUND_GetNumSubChannels(int channel); +DLL_API int F_API FSOUND_GetSubChannel(int channel, int subchannel); +DLL_API signed char F_API FSOUND_3D_GetAttributes(int channel, float *pos, float *vel); +DLL_API signed char F_API FSOUND_3D_GetMinMaxDistance(int channel, float *min, float *max); /* ========================== */ /* Global 3D sound functions. */ /* ========================== */ /* - See also 3d sample and channel based functions above. - Call FSOUND_Update once a frame to process 3d information. + See also 3d sample and channel based functions above. + Call FSOUND_Update once a frame to process 3d information. */ -DLL_API void F_API FSOUND_3D_Listener_SetAttributes(const float *pos, const float *vel, float fx, float fy, float fz, float tx, float ty, float tz); -DLL_API void F_API FSOUND_3D_Listener_GetAttributes(float *pos, float *vel, float *fx, float *fy, float *fz, float *tx, float *ty, float *tz); -DLL_API void F_API FSOUND_3D_Listener_SetCurrent(int current, int numlisteners); /* use this if you use multiple listeners / splitscreen */ -DLL_API void F_API FSOUND_3D_SetDopplerFactor(float scale); -DLL_API void F_API FSOUND_3D_SetDistanceFactor(float scale); -DLL_API void F_API FSOUND_3D_SetRolloffFactor(float scale); +DLL_API void F_API FSOUND_3D_Listener_SetAttributes(const float *pos, const float *vel, float fx, float fy, float fz, float tx, float ty, float tz); +DLL_API void F_API FSOUND_3D_Listener_GetAttributes(float *pos, float *vel, float *fx, float *fy, float *fz, float *tx, float *ty, float *tz); +DLL_API void F_API FSOUND_3D_Listener_SetCurrent(int current, int numlisteners); /* use this if you use multiple listeners / splitscreen */ +DLL_API void F_API FSOUND_3D_SetDopplerFactor(float scale); +DLL_API void F_API FSOUND_3D_SetDistanceFactor(float scale); +DLL_API void F_API FSOUND_3D_SetRolloffFactor(float scale); /* =================== */ -/* FX functions. */ +/* FX functions. */ /* =================== */ /* - Functions to control DX8 only effects processing. + Functions to control DX8 only effects processing. - - FX enabled samples can only be played once at a time, not multiple times at once. - - Sounds have to be created with FSOUND_HW2D or FSOUND_HW3D for this to work. - - FSOUND_INIT_ENABLESYSTEMCHANNELFX can be used to apply hardware effect processing to the - global mixed output of FMOD's software channels. - - FSOUND_FX_Enable returns an FX handle that you can use to alter fx parameters. - - FSOUND_FX_Enable can be called multiple times in a row, even on the same FX type, - it will return a unique handle for each FX. - - FSOUND_FX_Enable cannot be called if the sound is playing or locked. - - FSOUND_FX_Disable must be called to reset/clear the FX from a channel. + - FX enabled samples can only be played once at a time, not multiple times at once. + - Sounds have to be created with FSOUND_HW2D or FSOUND_HW3D for this to work. + - FSOUND_INIT_ENABLESYSTEMCHANNELFX can be used to apply hardware effect processing to the + global mixed output of FMOD's software channels. + - FSOUND_FX_Enable returns an FX handle that you can use to alter fx parameters. + - FSOUND_FX_Enable can be called multiple times in a row, even on the same FX type, + it will return a unique handle for each FX. + - FSOUND_FX_Enable cannot be called if the sound is playing or locked. + - FSOUND_FX_Disable must be called to reset/clear the FX from a channel. */ -DLL_API int F_API FSOUND_FX_Enable(int channel, unsigned int fxtype); /* See FSOUND_FX_MODES */ -DLL_API signed char F_API FSOUND_FX_Disable(int channel); /* Disables all effects */ +DLL_API int F_API FSOUND_FX_Enable(int channel, unsigned int fxtype); /* See FSOUND_FX_MODES */ +DLL_API signed char F_API FSOUND_FX_Disable(int channel); /* Disables all effects */ -DLL_API signed char F_API FSOUND_FX_SetChorus(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase); -DLL_API signed char F_API FSOUND_FX_SetCompressor(int fxid, float Gain, float Attack, float Release, float Threshold, float Ratio, float Predelay); -DLL_API signed char F_API FSOUND_FX_SetDistortion(int fxid, float Gain, float Edge, float PostEQCenterFrequency, float PostEQBandwidth, float PreLowpassCutoff); -DLL_API signed char F_API FSOUND_FX_SetEcho(int fxid, float WetDryMix, float Feedback, float LeftDelay, float RightDelay, int PanDelay); -DLL_API signed char F_API FSOUND_FX_SetFlanger(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase); -DLL_API signed char F_API FSOUND_FX_SetGargle(int fxid, int RateHz, int WaveShape); -DLL_API signed char F_API FSOUND_FX_SetI3DL2Reverb(int fxid, int Room, int RoomHF, float RoomRolloffFactor, float DecayTime, float DecayHFRatio, int Reflections, float ReflectionsDelay, int Reverb, float ReverbDelay, float Diffusion, float Density, float HFReference); -DLL_API signed char F_API FSOUND_FX_SetParamEQ(int fxid, float Center, float Bandwidth, float Gain); -DLL_API signed char F_API FSOUND_FX_SetWavesReverb(int fxid, float InGain, float ReverbMix, float ReverbTime, float HighFreqRTRatio); +DLL_API signed char F_API FSOUND_FX_SetChorus(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase); +DLL_API signed char F_API FSOUND_FX_SetCompressor(int fxid, float Gain, float Attack, float Release, float Threshold, float Ratio, float Predelay); +DLL_API signed char F_API FSOUND_FX_SetDistortion(int fxid, float Gain, float Edge, float PostEQCenterFrequency, float PostEQBandwidth, float PreLowpassCutoff); +DLL_API signed char F_API FSOUND_FX_SetEcho(int fxid, float WetDryMix, float Feedback, float LeftDelay, float RightDelay, int PanDelay); +DLL_API signed char F_API FSOUND_FX_SetFlanger(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase); +DLL_API signed char F_API FSOUND_FX_SetGargle(int fxid, int RateHz, int WaveShape); +DLL_API signed char F_API FSOUND_FX_SetI3DL2Reverb(int fxid, int Room, int RoomHF, float RoomRolloffFactor, float DecayTime, float DecayHFRatio, int Reflections, float ReflectionsDelay, int Reverb, float ReverbDelay, float Diffusion, float Density, float HFReference); +DLL_API signed char F_API FSOUND_FX_SetParamEQ(int fxid, float Center, float Bandwidth, float Gain); +DLL_API signed char F_API FSOUND_FX_SetWavesReverb(int fxid, float InGain, float ReverbMix, float ReverbTime, float HighFreqRTRatio); /* ========================= */ /* File Streaming functions. */ /* ========================= */ /* - Note : Use FSOUND_LOADMEMORY flag with FSOUND_Stream_Open to stream from memory. - Use FSOUND_LOADRAW flag with FSOUND_Stream_Open to treat stream as raw pcm data. - Use FSOUND_MPEGACCURATE flag with FSOUND_Stream_Open to open mpegs in 'accurate mode' for settime/gettime/getlengthms. - Use FSOUND_FREE as the 'channel' variable, to let FMOD pick a free channel for you. + Note : Use FSOUND_LOADMEMORY flag with FSOUND_Stream_Open to stream from memory. + Use FSOUND_LOADRAW flag with FSOUND_Stream_Open to treat stream as raw pcm data. + Use FSOUND_MPEGACCURATE flag with FSOUND_Stream_Open to open mpegs in 'accurate mode' for settime/gettime/getlengthms. + Use FSOUND_FREE as the 'channel' variable, to let FMOD pick a free channel for you. */ -DLL_API signed char F_API FSOUND_Stream_SetBufferSize(int ms); /* call this before opening streams, not after */ - -DLL_API FSOUND_STREAM * F_API FSOUND_Stream_Open(const STR8 name_or_data, unsigned int mode, int offset, int length); -DLL_API FSOUND_STREAM * F_API FSOUND_Stream_Create(FSOUND_STREAMCALLBACK callback, int length, unsigned int mode, int samplerate, void *userdata); -DLL_API signed char F_API FSOUND_Stream_Close(FSOUND_STREAM *stream); - -DLL_API int F_API FSOUND_Stream_Play(int channel, FSOUND_STREAM *stream); -DLL_API int F_API FSOUND_Stream_PlayEx(int channel, FSOUND_STREAM *stream, FSOUND_DSPUNIT *dsp, signed char startpaused); -DLL_API signed char F_API FSOUND_Stream_Stop(FSOUND_STREAM *stream); - -DLL_API signed char F_API FSOUND_Stream_SetPosition(FSOUND_STREAM *stream, unsigned int position); -DLL_API unsigned int F_API FSOUND_Stream_GetPosition(FSOUND_STREAM *stream); -DLL_API signed char F_API FSOUND_Stream_SetTime(FSOUND_STREAM *stream, int ms); -DLL_API int F_API FSOUND_Stream_GetTime(FSOUND_STREAM *stream); -DLL_API int F_API FSOUND_Stream_GetLength(FSOUND_STREAM *stream); -DLL_API int F_API FSOUND_Stream_GetLengthMs(FSOUND_STREAM *stream); - -DLL_API signed char F_API FSOUND_Stream_SetMode(FSOUND_STREAM *stream, unsigned int mode); -DLL_API unsigned int F_API FSOUND_Stream_GetMode(FSOUND_STREAM *stream); -DLL_API signed char F_API FSOUND_Stream_SetLoopPoints(FSOUND_STREAM *stream, unsigned int loopstartpcm, unsigned int loopendpcm); -DLL_API signed char F_API FSOUND_Stream_SetLoopCount(FSOUND_STREAM *stream, int count); -DLL_API int F_API FSOUND_Stream_GetOpenState(FSOUND_STREAM *stream); /* use with FSOUND_NONBLOCKING opened streams */ -DLL_API FSOUND_SAMPLE * F_API FSOUND_Stream_GetSample(FSOUND_STREAM *stream); -DLL_API FSOUND_DSPUNIT * F_API FSOUND_Stream_CreateDSP(FSOUND_STREAM *stream, FSOUND_DSPCALLBACK callback, int priority, void *userdata); - -DLL_API signed char F_API FSOUND_Stream_SetEndCallback(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, void *userdata); -DLL_API signed char F_API FSOUND_Stream_SetSyncCallback(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, void *userdata); +DLL_API signed char F_API FSOUND_Stream_SetBufferSize(int ms); /* call this before opening streams, not after */ + +DLL_API FSOUND_STREAM * F_API FSOUND_Stream_Open(const STR8 name_or_data, unsigned int mode, int offset, int length); +DLL_API FSOUND_STREAM * F_API FSOUND_Stream_Create(FSOUND_STREAMCALLBACK callback, int length, unsigned int mode, int samplerate, void *userdata); +DLL_API signed char F_API FSOUND_Stream_Close(FSOUND_STREAM *stream); + +DLL_API int F_API FSOUND_Stream_Play(int channel, FSOUND_STREAM *stream); +DLL_API int F_API FSOUND_Stream_PlayEx(int channel, FSOUND_STREAM *stream, FSOUND_DSPUNIT *dsp, signed char startpaused); +DLL_API signed char F_API FSOUND_Stream_Stop(FSOUND_STREAM *stream); + +DLL_API signed char F_API FSOUND_Stream_SetPosition(FSOUND_STREAM *stream, unsigned int position); +DLL_API unsigned int F_API FSOUND_Stream_GetPosition(FSOUND_STREAM *stream); +DLL_API signed char F_API FSOUND_Stream_SetTime(FSOUND_STREAM *stream, int ms); +DLL_API int F_API FSOUND_Stream_GetTime(FSOUND_STREAM *stream); +DLL_API int F_API FSOUND_Stream_GetLength(FSOUND_STREAM *stream); +DLL_API int F_API FSOUND_Stream_GetLengthMs(FSOUND_STREAM *stream); + +DLL_API signed char F_API FSOUND_Stream_SetMode(FSOUND_STREAM *stream, unsigned int mode); +DLL_API unsigned int F_API FSOUND_Stream_GetMode(FSOUND_STREAM *stream); +DLL_API signed char F_API FSOUND_Stream_SetLoopPoints(FSOUND_STREAM *stream, unsigned int loopstartpcm, unsigned int loopendpcm); +DLL_API signed char F_API FSOUND_Stream_SetLoopCount(FSOUND_STREAM *stream, int count); +DLL_API int F_API FSOUND_Stream_GetOpenState(FSOUND_STREAM *stream); /* use with FSOUND_NONBLOCKING opened streams */ +DLL_API FSOUND_SAMPLE * F_API FSOUND_Stream_GetSample(FSOUND_STREAM *stream); +DLL_API FSOUND_DSPUNIT * F_API FSOUND_Stream_CreateDSP(FSOUND_STREAM *stream, FSOUND_DSPCALLBACK callback, int priority, void *userdata); + +DLL_API signed char F_API FSOUND_Stream_SetEndCallback(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, void *userdata); +DLL_API signed char F_API FSOUND_Stream_SetSyncCallback(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, void *userdata); DLL_API FSOUND_SYNCPOINT * F_API FSOUND_Stream_AddSyncPoint(FSOUND_STREAM *stream, unsigned int pcmoffset, const STR8 name); -DLL_API signed char F_API FSOUND_Stream_DeleteSyncPoint(FSOUND_SYNCPOINT *point); -DLL_API int F_API FSOUND_Stream_GetNumSyncPoints(FSOUND_STREAM *stream); +DLL_API signed char F_API FSOUND_Stream_DeleteSyncPoint(FSOUND_SYNCPOINT *point); +DLL_API int F_API FSOUND_Stream_GetNumSyncPoints(FSOUND_STREAM *stream); DLL_API FSOUND_SYNCPOINT * F_API FSOUND_Stream_GetSyncPoint(FSOUND_STREAM *stream, int index); -DLL_API STR8 F_API FSOUND_Stream_GetSyncPointInfo(FSOUND_SYNCPOINT *point, unsigned int *pcmoffset); +DLL_API STR8 F_API FSOUND_Stream_GetSyncPointInfo(FSOUND_SYNCPOINT *point, unsigned int *pcmoffset); -DLL_API signed char F_API FSOUND_Stream_SetSubStream(FSOUND_STREAM *stream, int index); /* For FMOD .FSB bank files. */ -DLL_API int F_API FSOUND_Stream_GetNumSubStreams(FSOUND_STREAM *stream); /* For FMOD .FSB bank files. */ -DLL_API signed char F_API FSOUND_Stream_SetSubStreamSentence(FSOUND_STREAM *stream, const int *sentencelist, int numitems); +DLL_API signed char F_API FSOUND_Stream_SetSubStream(FSOUND_STREAM *stream, int index); /* For FMOD .FSB bank files. */ +DLL_API int F_API FSOUND_Stream_GetNumSubStreams(FSOUND_STREAM *stream); /* For FMOD .FSB bank files. */ +DLL_API signed char F_API FSOUND_Stream_SetSubStreamSentence(FSOUND_STREAM *stream, const int *sentencelist, int numitems); -DLL_API signed char F_API FSOUND_Stream_GetNumTagFields(FSOUND_STREAM *stream, int *num); -DLL_API signed char F_API FSOUND_Stream_GetTagField(FSOUND_STREAM *stream, int num, int *type, STR8 *name, void **value, int *length); -DLL_API signed char F_API FSOUND_Stream_FindTagField(FSOUND_STREAM *stream, int type, const STR8 name, void **value, int *length); +DLL_API signed char F_API FSOUND_Stream_GetNumTagFields(FSOUND_STREAM *stream, int *num); +DLL_API signed char F_API FSOUND_Stream_GetTagField(FSOUND_STREAM *stream, int num, int *type, STR8 *name, void **value, int *length); +DLL_API signed char F_API FSOUND_Stream_FindTagField(FSOUND_STREAM *stream, int type, const STR8 name, void **value, int *length); /* - Internet streaming functions + Internet streaming functions */ -DLL_API signed char F_API FSOUND_Stream_Net_SetProxy(const STR8 proxy); -DLL_API signed char F_API FSOUND_Stream_Net_SetTimeout(int timeout); -DLL_API STR8 F_API FSOUND_Stream_Net_GetLastServerStatus(); -DLL_API signed char F_API FSOUND_Stream_Net_SetBufferProperties(int buffersize, int prebuffer_percent, int rebuffer_percent); -DLL_API signed char F_API FSOUND_Stream_Net_GetBufferProperties(int *buffersize, int *prebuffer_percent, int *rebuffer_percent); -DLL_API signed char F_API FSOUND_Stream_Net_SetMetadataCallback(FSOUND_STREAM *stream, FSOUND_METADATACALLBACK callback, void *userdata); -DLL_API signed char F_API FSOUND_Stream_Net_GetStatus(FSOUND_STREAM *stream, int *status, int *bufferpercentused, int *bitrate, unsigned int *flags); +DLL_API signed char F_API FSOUND_Stream_Net_SetProxy(const STR8 proxy); +DLL_API signed char F_API FSOUND_Stream_Net_SetTimeout(int timeout); +DLL_API STR8 F_API FSOUND_Stream_Net_GetLastServerStatus(); +DLL_API signed char F_API FSOUND_Stream_Net_SetBufferProperties(int buffersize, int prebuffer_percent, int rebuffer_percent); +DLL_API signed char F_API FSOUND_Stream_Net_GetBufferProperties(int *buffersize, int *prebuffer_percent, int *rebuffer_percent); +DLL_API signed char F_API FSOUND_Stream_Net_SetMetadataCallback(FSOUND_STREAM *stream, FSOUND_METADATACALLBACK callback, void *userdata); +DLL_API signed char F_API FSOUND_Stream_Net_GetStatus(FSOUND_STREAM *stream, int *status, int *bufferpercentused, int *bitrate, unsigned int *flags); /* =================== */ /* CD audio functions. */ /* =================== */ /* - Note : 0 = default cdrom. Otherwise specify the drive letter, for example. 'D'. + Note : 0 = default cdrom. Otherwise specify the drive letter, for example. 'D'. */ -DLL_API signed char F_API FSOUND_CD_Play(char drive, int track); -DLL_API void F_API FSOUND_CD_SetPlayMode(char drive, signed char mode); -DLL_API signed char F_API FSOUND_CD_Stop(char drive); -DLL_API signed char F_API FSOUND_CD_SetPaused(char drive, signed char paused); -DLL_API signed char F_API FSOUND_CD_SetVolume(char drive, int volume); -DLL_API signed char F_API FSOUND_CD_SetTrackTime(char drive, unsigned int ms); -DLL_API signed char F_API FSOUND_CD_OpenTray(char drive, signed char open); +DLL_API signed char F_API FSOUND_CD_Play(char drive, int track); +DLL_API void F_API FSOUND_CD_SetPlayMode(char drive, signed char mode); +DLL_API signed char F_API FSOUND_CD_Stop(char drive); +DLL_API signed char F_API FSOUND_CD_SetPaused(char drive, signed char paused); +DLL_API signed char F_API FSOUND_CD_SetVolume(char drive, int volume); +DLL_API signed char F_API FSOUND_CD_SetTrackTime(char drive, unsigned int ms); +DLL_API signed char F_API FSOUND_CD_OpenTray(char drive, signed char open); -DLL_API signed char F_API FSOUND_CD_GetPaused(char drive); -DLL_API int F_API FSOUND_CD_GetTrack(char drive); -DLL_API int F_API FSOUND_CD_GetNumTracks(char drive); -DLL_API int F_API FSOUND_CD_GetVolume(char drive); -DLL_API int F_API FSOUND_CD_GetTrackLength(char drive, int track); -DLL_API int F_API FSOUND_CD_GetTrackTime(char drive); +DLL_API signed char F_API FSOUND_CD_GetPaused(char drive); +DLL_API int F_API FSOUND_CD_GetTrack(char drive); +DLL_API int F_API FSOUND_CD_GetNumTracks(char drive); +DLL_API int F_API FSOUND_CD_GetVolume(char drive); +DLL_API int F_API FSOUND_CD_GetTrackLength(char drive, int track); +DLL_API int F_API FSOUND_CD_GetTrackTime(char drive); /* ============== */ /* DSP functions. */ /* ============== */ /* - DSP Unit control and information functions. - These functions allow you access to the mixed stream that FMOD uses to play back sound on. + DSP Unit control and information functions. + These functions allow you access to the mixed stream that FMOD uses to play back sound on. */ DLL_API FSOUND_DSPUNIT *F_API FSOUND_DSP_Create(FSOUND_DSPCALLBACK callback, int priority, void *userdata); -DLL_API void F_API FSOUND_DSP_Free(FSOUND_DSPUNIT *unit); -DLL_API void F_API FSOUND_DSP_SetPriority(FSOUND_DSPUNIT *unit, int priority); -DLL_API int F_API FSOUND_DSP_GetPriority(FSOUND_DSPUNIT *unit); -DLL_API void F_API FSOUND_DSP_SetActive(FSOUND_DSPUNIT *unit, signed char active); -DLL_API signed char F_API FSOUND_DSP_GetActive(FSOUND_DSPUNIT *unit); +DLL_API void F_API FSOUND_DSP_Free(FSOUND_DSPUNIT *unit); +DLL_API void F_API FSOUND_DSP_SetPriority(FSOUND_DSPUNIT *unit, int priority); +DLL_API int F_API FSOUND_DSP_GetPriority(FSOUND_DSPUNIT *unit); +DLL_API void F_API FSOUND_DSP_SetActive(FSOUND_DSPUNIT *unit, signed char active); +DLL_API signed char F_API FSOUND_DSP_GetActive(FSOUND_DSPUNIT *unit); /* - Functions to get hold of FSOUND 'system DSP unit' handles. + Functions to get hold of FSOUND 'system DSP unit' handles. */ DLL_API FSOUND_DSPUNIT *F_API FSOUND_DSP_GetClearUnit(); @@ -1102,120 +1102,120 @@ DLL_API FSOUND_DSPUNIT *F_API FSOUND_DSP_GetFFTUnit(); DLL_API FSOUND_DSPUNIT *F_API FSOUND_DSP_GetClipAndCopyUnit(); /* - Miscellaneous DSP functions - Note for the spectrum analysis function to work, you have to enable the FFT DSP unit with - the following code FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE); - It is off by default to save cpu usage. + Miscellaneous DSP functions + Note for the spectrum analysis function to work, you have to enable the FFT DSP unit with + the following code FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE); + It is off by default to save cpu usage. */ -DLL_API signed char F_API FSOUND_DSP_MixBuffers(void *destbuffer, void *srcbuffer, int len, int freq, int vol, int pan, unsigned int mode); -DLL_API void F_API FSOUND_DSP_ClearMixBuffer(); -DLL_API int F_API FSOUND_DSP_GetBufferLength(); /* Length of each DSP update */ -DLL_API int F_API FSOUND_DSP_GetBufferLengthTotal(); /* Total buffer length due to FSOUND_SetBufferSize */ -DLL_API float * F_API FSOUND_DSP_GetSpectrum(); /* Array of 512 floats - call FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE)) for this to work. */ +DLL_API signed char F_API FSOUND_DSP_MixBuffers(void *destbuffer, void *srcbuffer, int len, int freq, int vol, int pan, unsigned int mode); +DLL_API void F_API FSOUND_DSP_ClearMixBuffer(); +DLL_API int F_API FSOUND_DSP_GetBufferLength(); /* Length of each DSP update */ +DLL_API int F_API FSOUND_DSP_GetBufferLengthTotal(); /* Total buffer length due to FSOUND_SetBufferSize */ +DLL_API float * F_API FSOUND_DSP_GetSpectrum(); /* Array of 512 floats - call FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE)) for this to work. */ /* =================================================================================== */ -/* Reverb functions. (eax2/eax3 reverb) (ONLY SUPPORTED ON WIN32 W/ FSOUND_HW3D FLAG) */ +/* Reverb functions. (eax2/eax3 reverb) (ONLY SUPPORTED ON WIN32 W/ FSOUND_HW3D FLAG) */ /* =================================================================================== */ /* - See top of file for definitions and information on the reverb parameters. + See top of file for definitions and information on the reverb parameters. */ -DLL_API signed char F_API FSOUND_Reverb_SetProperties(const FSOUND_REVERB_PROPERTIES *prop); -DLL_API signed char F_API FSOUND_Reverb_GetProperties(FSOUND_REVERB_PROPERTIES *prop); -DLL_API signed char F_API FSOUND_Reverb_SetChannelProperties(int channel, const FSOUND_REVERB_CHANNELPROPERTIES *prop); -DLL_API signed char F_API FSOUND_Reverb_GetChannelProperties(int channel, FSOUND_REVERB_CHANNELPROPERTIES *prop); +DLL_API signed char F_API FSOUND_Reverb_SetProperties(const FSOUND_REVERB_PROPERTIES *prop); +DLL_API signed char F_API FSOUND_Reverb_GetProperties(FSOUND_REVERB_PROPERTIES *prop); +DLL_API signed char F_API FSOUND_Reverb_SetChannelProperties(int channel, const FSOUND_REVERB_CHANNELPROPERTIES *prop); +DLL_API signed char F_API FSOUND_Reverb_GetChannelProperties(int channel, FSOUND_REVERB_CHANNELPROPERTIES *prop); /* ===================================================== */ -/* Recording functions (ONLY SUPPORTED IN WIN32, WINCE) */ +/* Recording functions (ONLY SUPPORTED IN WIN32, WINCE) */ /* ===================================================== */ /* - Recording initialization functions + Recording initialization functions */ -DLL_API signed char F_API FSOUND_Record_SetDriver(int outputtype); -DLL_API int F_API FSOUND_Record_GetNumDrivers(); -DLL_API const STR8 F_API FSOUND_Record_GetDriverName(int id); -DLL_API int F_API FSOUND_Record_GetDriver(); +DLL_API signed char F_API FSOUND_Record_SetDriver(int outputtype); +DLL_API int F_API FSOUND_Record_GetNumDrivers(); +DLL_API const STR8 F_API FSOUND_Record_GetDriverName(int id); +DLL_API int F_API FSOUND_Record_GetDriver(); /* - Recording functionality. Only one recording session will work at a time. + Recording functionality. Only one recording session will work at a time. */ -DLL_API signed char F_API FSOUND_Record_StartSample(FSOUND_SAMPLE *sptr, signed char loop); -DLL_API signed char F_API FSOUND_Record_Stop(); -DLL_API int F_API FSOUND_Record_GetPosition(); +DLL_API signed char F_API FSOUND_Record_StartSample(FSOUND_SAMPLE *sptr, signed char loop); +DLL_API signed char F_API FSOUND_Record_Stop(); +DLL_API int F_API FSOUND_Record_GetPosition(); /* ========================================================================================== */ -/* FMUSIC API (MOD,S3M,XM,IT,MIDI PLAYBACK) */ +/* FMUSIC API (MOD,S3M,XM,IT,MIDI PLAYBACK) */ /* ========================================================================================== */ /* - Song management / playback functions. + Song management / playback functions. */ DLL_API FMUSIC_MODULE * F_API FMUSIC_LoadSong(const STR8 name); DLL_API FMUSIC_MODULE * F_API FMUSIC_LoadSongEx(const STR8 name_or_data, int offset, int length, unsigned int mode, const int *samplelist, int samplelistnum); -DLL_API int F_API FMUSIC_GetOpenState(FMUSIC_MODULE *mod); -DLL_API signed char F_API FMUSIC_FreeSong(FMUSIC_MODULE *mod); -DLL_API signed char F_API FMUSIC_PlaySong(FMUSIC_MODULE *mod); -DLL_API signed char F_API FMUSIC_StopSong(FMUSIC_MODULE *mod); -DLL_API void F_API FMUSIC_StopAllSongs(); +DLL_API int F_API FMUSIC_GetOpenState(FMUSIC_MODULE *mod); +DLL_API signed char F_API FMUSIC_FreeSong(FMUSIC_MODULE *mod); +DLL_API signed char F_API FMUSIC_PlaySong(FMUSIC_MODULE *mod); +DLL_API signed char F_API FMUSIC_StopSong(FMUSIC_MODULE *mod); +DLL_API void F_API FMUSIC_StopAllSongs(); -DLL_API signed char F_API FMUSIC_SetZxxCallback(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback); -DLL_API signed char F_API FMUSIC_SetRowCallback(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int rowstep); -DLL_API signed char F_API FMUSIC_SetOrderCallback(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int orderstep); -DLL_API signed char F_API FMUSIC_SetInstCallback(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int instrument); +DLL_API signed char F_API FMUSIC_SetZxxCallback(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback); +DLL_API signed char F_API FMUSIC_SetRowCallback(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int rowstep); +DLL_API signed char F_API FMUSIC_SetOrderCallback(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int orderstep); +DLL_API signed char F_API FMUSIC_SetInstCallback(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int instrument); -DLL_API signed char F_API FMUSIC_SetSample(FMUSIC_MODULE *mod, int sampno, FSOUND_SAMPLE *sptr); -DLL_API signed char F_API FMUSIC_SetUserData(FMUSIC_MODULE *mod, void *userdata); -DLL_API signed char F_API FMUSIC_OptimizeChannels(FMUSIC_MODULE *mod, int maxchannels, int minvolume); +DLL_API signed char F_API FMUSIC_SetSample(FMUSIC_MODULE *mod, int sampno, FSOUND_SAMPLE *sptr); +DLL_API signed char F_API FMUSIC_SetUserData(FMUSIC_MODULE *mod, void *userdata); +DLL_API signed char F_API FMUSIC_OptimizeChannels(FMUSIC_MODULE *mod, int maxchannels, int minvolume); /* - Runtime song functions. + Runtime song functions. */ -DLL_API signed char F_API FMUSIC_SetReverb(signed char reverb); /* MIDI only */ -DLL_API signed char F_API FMUSIC_SetLooping(FMUSIC_MODULE *mod, signed char looping); -DLL_API signed char F_API FMUSIC_SetOrder(FMUSIC_MODULE *mod, int order); -DLL_API signed char F_API FMUSIC_SetPaused(FMUSIC_MODULE *mod, signed char pause); -DLL_API signed char F_API FMUSIC_SetMasterVolume(FMUSIC_MODULE *mod, int volume); -DLL_API signed char F_API FMUSIC_SetMasterSpeed(FMUSIC_MODULE *mode, float speed); -DLL_API signed char F_API FMUSIC_SetPanSeperation(FMUSIC_MODULE *mod, float pansep); +DLL_API signed char F_API FMUSIC_SetReverb(signed char reverb); /* MIDI only */ +DLL_API signed char F_API FMUSIC_SetLooping(FMUSIC_MODULE *mod, signed char looping); +DLL_API signed char F_API FMUSIC_SetOrder(FMUSIC_MODULE *mod, int order); +DLL_API signed char F_API FMUSIC_SetPaused(FMUSIC_MODULE *mod, signed char pause); +DLL_API signed char F_API FMUSIC_SetMasterVolume(FMUSIC_MODULE *mod, int volume); +DLL_API signed char F_API FMUSIC_SetMasterSpeed(FMUSIC_MODULE *mode, float speed); +DLL_API signed char F_API FMUSIC_SetPanSeperation(FMUSIC_MODULE *mod, float pansep); /* - Static song information functions. + Static song information functions. */ -DLL_API const STR8 F_API FMUSIC_GetName(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetType(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetNumOrders(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetNumPatterns(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetNumInstruments(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetNumSamples(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetNumChannels(FMUSIC_MODULE *mod); +DLL_API const STR8 F_API FMUSIC_GetName(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetType(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetNumOrders(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetNumPatterns(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetNumInstruments(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetNumSamples(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetNumChannels(FMUSIC_MODULE *mod); DLL_API FSOUND_SAMPLE * F_API FMUSIC_GetSample(FMUSIC_MODULE *mod, int sampno); -DLL_API int F_API FMUSIC_GetPatternLength(FMUSIC_MODULE *mod, int orderno); +DLL_API int F_API FMUSIC_GetPatternLength(FMUSIC_MODULE *mod, int orderno); /* - Runtime song information. + Runtime song information. */ -DLL_API signed char F_API FMUSIC_IsFinished(FMUSIC_MODULE *mod); -DLL_API signed char F_API FMUSIC_IsPlaying(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetMasterVolume(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetGlobalVolume(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetOrder(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetPattern(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetSpeed(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetBPM(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetRow(FMUSIC_MODULE *mod); -DLL_API signed char F_API FMUSIC_GetPaused(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetTime(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetRealChannel(FMUSIC_MODULE *mod, int modchannel); -DLL_API void * F_API FMUSIC_GetUserData(FMUSIC_MODULE *mod); +DLL_API signed char F_API FMUSIC_IsFinished(FMUSIC_MODULE *mod); +DLL_API signed char F_API FMUSIC_IsPlaying(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetMasterVolume(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetGlobalVolume(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetOrder(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetPattern(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetSpeed(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetBPM(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetRow(FMUSIC_MODULE *mod); +DLL_API signed char F_API FMUSIC_GetPaused(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetTime(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetRealChannel(FMUSIC_MODULE *mod, int modchannel); +DLL_API void * F_API FMUSIC_GetUserData(FMUSIC_MODULE *mod); #ifdef __cplusplus } diff --git a/Standard Gaming Platform/fmod_errors.h b/Standard Gaming Platform/fmod_errors.h index 2083abd1..7a13f59b 100644 --- a/Standard Gaming Platform/fmod_errors.h +++ b/Standard Gaming Platform/fmod_errors.h @@ -1,12 +1,11 @@ #ifndef _FMOD_ERRORS_H #define _FMOD_ERRORS_H - static STR8 FMOD_ErrorString(int errcode) { switch (errcode) { case FMOD_ERR_NONE: return "No errors"; - case FMOD_ERR_BUSY: return "Cannot call this command after FSOUND_Init. Call FSOUND_Close first."; + case FMOD_ERR_BUSY: return "Cannot call this command after FSOUND_Init. Call FSOUND_Close first."; case FMOD_ERR_UNINITIALIZED: return "This command failed because FSOUND_Init was not called"; case FMOD_ERR_PLAY: return "Playing the sound failed."; case FMOD_ERR_INIT: return "Error initializing output device."; @@ -28,5 +27,4 @@ static STR8 FMOD_ErrorString(int errcode) default : return "Unknown error"; }; } - #endif diff --git a/Standard Gaming Platform/himage.cpp b/Standard Gaming Platform/himage.cpp index 84aa5a15..ffd797a9 100644 --- a/Standard Gaming Platform/himage.cpp +++ b/Standard Gaming Platform/himage.cpp @@ -19,19 +19,19 @@ #include "vobject.h" #endif -// This is the color substituted to keep a 24bpp -> 16bpp color +// This is the color substituted to keep a 24bpp->16bpp color // from going transparent (0x0000) -- DB -#define BLACK_SUBSTITUTE 0x0001 +#define BLACK_SUBSTITUTE 0x0001 UINT16 gusAlphaMask = 0; UINT16 gusRedMask = 0; UINT16 gusGreenMask = 0; UINT16 gusBlueMask = 0; -INT16 gusRedShift = 0; -INT16 gusBlueShift = 0; -INT16 gusGreenShift = 0; +INT16 gusRedShift = 0; +INT16 gusBlueShift = 0; +INT16 gusGreenShift = 0; // this funky union is used for fast 16-bit pixel format conversions @@ -73,7 +73,7 @@ HIMAGE CreateImage( SGPFILENAME ImageFile, UINT16 fContents ) do { iFileLoader = UNKNOWN_FILE_READER; - + if ( _stricmp( Extension, "PCX" ) == 0 ) { iFileLoader = PCX_FILE_READER; @@ -113,11 +113,11 @@ HIMAGE CreateImage( SGPFILENAME ImageFile, UINT16 fContents ) AssertMsg( hImage, "Failed to allocate memory for hImage in CreateImage"); // Initialize some values memset( hImage, 0, sizeof( image_type ) ); - + //hImage->fFlags = 0; // Set data pointers to NULL //hImage->pImageData = NULL; - //hImage->pPalette = NULL; + //hImage->pPalette = NULL; //hImage->pui16BPPPalette = NULL; // Set filename and loader @@ -151,7 +151,7 @@ BOOLEAN ReleaseImageData( HIMAGE hImage, UINT16 fContents ) { Assert( hImage != NULL ); - + if ( (fContents & IMAGE_PALETTE) && (hImage->fFlags & IMAGE_PALETTE) ) { //Destroy palette @@ -170,7 +170,7 @@ BOOLEAN ReleaseImageData( HIMAGE hImage, UINT16 fContents ) // Remove contents flag hImage->fFlags = hImage->fFlags ^ IMAGE_PALETTE; } - + if ( (fContents & IMAGE_BITMAPDATA) && (hImage->fFlags & IMAGE_BITMAPDATA) ) { //Destroy image data @@ -204,7 +204,7 @@ BOOLEAN LoadImageData( HIMAGE hImage, UINT16 fContents ) Assert( hImage != NULL ); - // Switch on file loader + // Switch on file loader switch( hImage->iFileLoader ) { case TGA_FILE_READER: @@ -226,7 +226,7 @@ BOOLEAN LoadImageData( HIMAGE hImage, UINT16 fContents ) DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_2, "Unknown image loader was specified." ); } - + if ( !fReturnVal ) { DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_2, "Error occured while reading image data." ); @@ -253,7 +253,7 @@ BOOLEAN CopyImageToBuffer( HIMAGE hImage, UINT32 fBufferType, BYTE *pDestBuf, UI // Default do here DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_2, "Copying 8 BPP Imagery." ); - return ( Copy8BPPImageTo8BPPBuffer( hImage, pDestBuf, usDestWidth, usDestHeight, usX, usY, srcRect ) ); + return ( Copy8BPPImageTo8BPPBuffer( hImage, pDestBuf, usDestWidth, usDestHeight, usX, usY, srcRect ) ); } @@ -303,7 +303,7 @@ BOOLEAN Copy8BPPCompressedImageTo8BPPBuffer( HIMAGE hImage, BYTE *pDestBuf, UINT UINT8 * pDest; UINT32 uiDestStart; - + UINT8 * pScanLine; PTR pDecompPtr; @@ -386,7 +386,7 @@ BOOLEAN Copy8BPPCompressedImageTo16BPPBuffer( HIMAGE hImage, BYTE *pDestBuf, UIN UINT16 * pDest; UINT16 * pDestTemp; UINT32 uiDestStart; - + UINT8 * pScanLine; UINT8 * pScanLineTemp; @@ -454,8 +454,8 @@ BOOLEAN Copy8BPPCompressedImageTo16BPPBuffer( HIMAGE hImage, BYTE *pDestBuf, UIN // decompress a scanline uiDecompressed = Decompress( pDecompPtr, pScanLine, hImage->usWidth ); Assert( uiDecompressed == hImage->usWidth ); - - // set pointers and blit + + // set pointers and blit pDestTemp = pDest; pScanLineTemp = pScanLine + srcRect->iLeft; for (uiCol = 0; uiCol < uiLineSize; uiCol++ ) @@ -466,9 +466,9 @@ BOOLEAN Copy8BPPCompressedImageTo16BPPBuffer( HIMAGE hImage, BYTE *pDestBuf, UIN } pDest += usDestWidth; } - + DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, String( "End Copying at %p", pDest ) ); - + DecompressFini( pDecompPtr ); return( TRUE ); } @@ -508,16 +508,16 @@ BOOLEAN Copy8BPPImageTo8BPPBuffer( HIMAGE hImage, BYTE *pDestBuf, UINT16 usDestW Assert( usDestWidth >= uiLineSize ); Assert( usDestHeight >= uiNumLines ); - + // Copy line by line pDest = ( UINT8*)pDestBuf + uiDestStart; - pSrc = hImage->p8BPPData + uiSrcStart; + pSrc = hImage->p8BPPData + uiSrcStart; for( cnt = 0; cnt < uiNumLines-1; cnt++ ) { memcpy( pDest, pSrc, uiLineSize ); pDest += usDestWidth; - pSrc += hImage->usWidth; + pSrc += hImage->usWidth; } // Do last line memcpy( pDest, pSrc, uiLineSize ); @@ -551,16 +551,16 @@ BOOLEAN Copy16BPPImageTo16BPPBuffer( HIMAGE hImage, BYTE *pDestBuf, UINT16 usDes CHECKF( usDestWidth >= uiLineSize ); CHECKF( usDestHeight >= uiNumLines ); - + // Copy line by line pDest = ( UINT16*)pDestBuf + uiDestStart; - pSrc = hImage->p16BPPData + uiSrcStart; + pSrc = hImage->p16BPPData + uiSrcStart; for( cnt = 0; cnt < uiNumLines-1; cnt++ ) { memcpy( pDest, pSrc, uiLineSize * 2 ); pDest += usDestWidth; - pSrc += hImage->usWidth; + pSrc += hImage->usWidth; } // Do last line memcpy( pDest, pSrc, uiLineSize * 2 ); @@ -586,11 +586,11 @@ BOOLEAN Copy8BPPImageTo16BPPBuffer( HIMAGE hImage, BYTE *pDestBuf, UINT16 usDest { UINT32 uiSrcStart, uiDestStart, uiNumLines, uiLineSize; UINT32 rows, cols; - UINT8 *pSrc, *pSrcTemp; + UINT8 *pSrc, *pSrcTemp; UINT16 *pDest, *pDestTemp; UINT16 *p16BPPPalette; - + p16BPPPalette = hImage->pui16BPPPalette; // Assertions @@ -614,10 +614,10 @@ BOOLEAN Copy8BPPImageTo16BPPBuffer( HIMAGE hImage, BYTE *pDestBuf, UINT16 usDest CHECKF( usDestWidth >= uiLineSize ); CHECKF( usDestHeight >= uiNumLines ); - + // Convert to Pixel specification pDest = ( UINT16*)pDestBuf + uiDestStart; - pSrc = hImage->p8BPPData + uiSrcStart; + pSrc = hImage->p8BPPData + uiSrcStart; DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, String( "Start Copying at %p", pDest ) ); // For every entry, look up into 16BPP palette @@ -634,7 +634,7 @@ BOOLEAN Copy8BPPImageTo16BPPBuffer( HIMAGE hImage, BYTE *pDestBuf, UINT16 usDest } pDest += usDestWidth; - pSrc += hImage->usWidth; + pSrc += hImage->usWidth; } // Do last line DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, String( "End Copying at %p", pDest ) ); @@ -647,7 +647,7 @@ UINT16 *Create16BPPPalette( SGPPaletteEntry *pPalette ) { UINT16 *p16BPPPalette, r16, g16, b16, usColor; UINT32 cnt; - UINT8 r,g,b; + UINT8 r,g,b; Assert( pPalette != NULL ); @@ -694,17 +694,17 @@ UINT16 *Create16BPPPalette( SGPPaletteEntry *pPalette ) /********************************************************************************************** Create16BPPPaletteShaded - - Creates an 8 bit to 16 bit palette table, and modifies the colors as it builds. - + + Creates an 8 bit to 16 bit palette table, and modifies the colors as it builds. + Parameters: - rscale, gscale, bscale: + rscale, gscale, bscale: Color mode: Percentages (255=100%) of color to translate into destination palette. - Mono mode: Color for monochrome palette. + Mono mode: Color for monochrome palette. mono: - TRUE or FALSE to create a monochrome palette. In mono mode, Luminance values for + TRUE or FALSE to create a monochrome palette. In mono mode, Luminance values for colors are calculated, and the RGB color is shaded according to each pixel's brightness. - + This can be used in several ways: 1) To "brighten" a palette, pass down RGB values that are higher than 100% ( > 255) for all @@ -721,7 +721,7 @@ UINT16 *Create16BPPPaletteShaded( SGPPaletteEntry *pPalette, UINT32 rscale, UINT UINT16 *p16BPPPalette, r16, g16, b16, usColor; UINT32 cnt, lumin; UINT32 rmod, gmod, bmod; - UINT8 r,g,b; + UINT8 r,g,b; Assert( pPalette != NULL ); @@ -743,7 +743,7 @@ UINT16 *Create16BPPPaletteShaded( SGPPaletteEntry *pPalette, UINT32 rscale, UINT gmod = (gscale*pPalette[ cnt ].peGreen/256); bmod = (bscale*pPalette[ cnt ].peBlue/256); } - + r = (UINT8)__min(rmod, 255); g = (UINT8)__min(gmod, 255); b = (UINT8)__min(bmod, 255); @@ -784,7 +784,7 @@ UINT16 *Create16BPPPaletteShaded( SGPPaletteEntry *pPalette, UINT32 rscale, UINT UINT16 Get16BPPColor( UINT32 RGBValue ) { UINT16 r16, g16, b16, usColor = 0; - UINT8 r, g, b; + UINT8 r,g,b; r = SGPGetRValue( RGBValue ); g = SGPGetGValue( RGBValue ); @@ -864,10 +864,10 @@ UINT32 GetRGBColor( UINT16 Value16BPP ) // // Parameter List : Converts from RGB to SGPPaletteEntry // -// Return Value pointer to the SGPPaletteEntry -// +// Return Value pointer to the SGPPaletteEntry +// // Modification History : -// Dec 15th 1996 -> modified for use by Wizardry +// Dec 15th 1996->modified for use by Wizardry // //***************************************************************************** @@ -881,8 +881,8 @@ SGPPaletteEntry *ConvertRGBToPaletteEntry(UINT8 sbStart, UINT8 sbEnd, UINT8 *pOl memset( pPalEntry, 0, sizeof(SGPPaletteEntry) * 256 ); pInitEntry = pPalEntry; - DbgMessage(TOPIC_HIMAGE, DBG_LEVEL_0, "Converting RGB palette to SGPPaletteEntry"); - + DbgMessage(TOPIC_HIMAGE, DBG_LEVEL_0, "Converting RGB palette to SGPPaletteEntry"); + for(Index=0; Index <= (sbEnd-sbStart);Index++) { pPalEntry->peRed = *(pOldPalette + (Index*3)); @@ -892,7 +892,7 @@ SGPPaletteEntry *ConvertRGBToPaletteEntry(UINT8 sbStart, UINT8 sbEnd, UINT8 *pOl pPalEntry++; } return pInitEntry; -} +} BOOLEAN GetETRLEImageData( HIMAGE hImage, ETRLEData *pBuffer ) { @@ -928,7 +928,7 @@ void ConvertRGBDistribution565To555( UINT16 * p16BPPData, UINT32 uiNumberOfPixel { UINT16 * pPixel; UINT32 uiLoop; - + SplitUINT32 Pixel; pPixel = p16BPPData; @@ -956,7 +956,7 @@ void ConvertRGBDistribution565To655( UINT16 * p16BPPData, UINT32 uiNumberOfPixel { UINT16 * pPixel; UINT32 uiLoop; - + SplitUINT32 Pixel; pPixel = p16BPPData; @@ -983,7 +983,7 @@ void ConvertRGBDistribution565To556( UINT16 * p16BPPData, UINT32 uiNumberOfPixel { UINT16 * pPixel; UINT32 uiLoop; - + SplitUINT32 Pixel; pPixel = p16BPPData; @@ -1022,4 +1022,4 @@ void ConvertRGBDistribution565ToAny( UINT16 * p16BPPData, UINT32 uiNumberOfPixel *pPixel = Get16BPPColor( uiTemp ); pPixel++; } -} \ No newline at end of file +} diff --git a/Standard Gaming Platform/imgfmt.h b/Standard Gaming Platform/imgfmt.h index 87b720f4..1d3b4463 100644 --- a/Standard Gaming Platform/imgfmt.h +++ b/Standard Gaming Platform/imgfmt.h @@ -2,7 +2,7 @@ #define STCI_H -// Sir-Tech's Crazy Image (STCI) file format specifications. Each file is composed of: +// Sir-Tech's Crazy Image (STCI) file format specifications. Each file is composed of: // 1 ImageFileHeader, uncompressed // * Palette (STCI_INDEXED, size = uiNumberOfColours * PALETTE_ELEMENT_SIZE), uncompressed // * SubRectInfo's (usNumberOfRects > 0, size = usNumberOfSubRects * sizeof(SubRectInfo) ), uncompressed @@ -10,8 +10,8 @@ #include "Types.h" -#define STCI_ID_STRING "STCI" -#define STCI_ID_LEN 4 +#define STCI_ID_STRING "STCI" +#define STCI_ID_LEN 4 #define STCI_ETRLE_COMPRESSED 0x0020 #define STCI_ZLIB_COMPRESSED 0x0010 diff --git a/Standard Gaming Platform/impTGA.cpp b/Standard Gaming Platform/impTGA.cpp index 419e0aab..b9aecb4c 100644 --- a/Standard Gaming Platform/impTGA.cpp +++ b/Standard Gaming Platform/impTGA.cpp @@ -105,7 +105,7 @@ BOOLEAN LoadTGAFileToImage( HIMAGE hImage, UINT16 fContents ) break; } - // Set remaining values + // Set remaining values end: FileClose( hFile ); @@ -122,7 +122,7 @@ end: // Return Value : // Modification history : // -// 20nov96:HJH -> creation +// 20nov96:HJH ->creation // //************************************************************************** @@ -141,7 +141,7 @@ BOOLEAN ReadUncompColMapImage( HIMAGE hImage, HWFILE hFile, UINT8 uiImgID, UINT8 // Return Value : // Modification history : // -// 20nov96:HJH -> creation +// 20nov96:HJH ->creation // //************************************************************************** @@ -161,7 +161,7 @@ BOOLEAN ReadUncompRGBImage( HIMAGE hImage, HWFILE hFile, UINT8 uiImgID, UINT8 ui UINT8 uiImagePixelSize; UINT8 uiImageDescriptor; UINT32 iNumValues; - UINT16 cnt; + UINT16 cnt; UINT32 i; UINT8 r; @@ -270,7 +270,7 @@ BOOLEAN ReadUncompRGBImage( HIMAGE hImage, HWFILE hFile, UINT8 uiImgID, UINT8 ui if ( !FileRead( hFile, &r, sizeof(UINT8), &uiBytesRead ) ) goto freeEnd; - pBMPtr[ i*3 ] = r; + pBMPtr[ i*3 ] = r; pBMPtr[ i*3+1 ] = g; pBMPtr[ i*3+2 ] = b; } @@ -296,7 +296,7 @@ BOOLEAN ReadUncompRGBImage( HIMAGE hImage, HWFILE hFile, UINT8 uiImgID, UINT8 ui if ( !FileRead( hFile, &a, sizeof(UINT8), &uiBytesRead ) ) goto freeEnd; - pBMData[ i*3 ] = r; + pBMData[ i*3 ] = r; pBMData[ i*3+1 ] = g; pBMData[ i*3+2 ] = b; } @@ -324,7 +324,7 @@ freeEnd: // Return Value : // Modification history : // -// 20nov96:HJH -> creation +// 20nov96:HJH ->creation // //************************************************************************** @@ -343,7 +343,7 @@ BOOLEAN ReadRLEColMapImage( HIMAGE hImage, HWFILE hFile, UINT8 uiImgID, UINT8 ui // Return Value : // Modification history : // -// 20nov96:HJH -> creation +// 20nov96:HJH ->creation // //************************************************************************** @@ -385,13 +385,13 @@ BOOLEAN ConvertTGAToSystemBPPFormat( HIMAGE hImage ) ubScaleR = 0; ubScaleG = 0; ubScaleB = 0; - ubRNewShift = 10; - ubGNewShift = 5; - ubBNewShift = 0; + ubRNewShift = 10; + ubGNewShift = 5; + ubBNewShift = 0; // Determine values - switch( uiBBitMask ) - { + switch( uiBBitMask ) + { case 0x3f: // 0000000000111111 pixel mask for blue // 5-5-6 @@ -400,30 +400,30 @@ BOOLEAN ConvertTGAToSystemBPPFormat( HIMAGE hImage ) ubScaleB = 1; break; - case 0x1f: // 0000000000011111 pixel mask for blue + case 0x1f: // 0000000000011111 pixel mask for blue switch( uiGBitMask ) - { + { case 0x7e0: // 0000011111100000 pixel mask for green - // 5-6-5 + // 5-6-5 ubRNewShift = 11; - ubScaleG = 1; + ubScaleG = 1; break; - case 0x3e0: // 0000001111100000 pixel mask for green + case 0x3e0: // 0000001111100000 pixel mask for green switch( uiRBitMask ) - { + { case 0xfc00: // 1111110000000000 pixel mask for red // 6-5-5 ubScaleR = 1; break; - } - break; - } - break; - } + } + break; + } + break; + } pData = hImage->pui16BPPPalette; usX = 0; @@ -448,7 +448,7 @@ BOOLEAN ConvertTGAToSystemBPPFormat( HIMAGE hImage ) usG = usG << ubScaleG; usB = usB << ubScaleB; - hImage->p16BPPData[ usX * hImage->usWidth + usY ] = ((UINT16) ( ( usR << ubRNewShift | usG << ubGNewShift ) | usB ) ); + hImage->p16BPPData[ usX * hImage->usWidth + usY ] = ((UINT16) ( ( usR << ubRNewShift | usG << ubGNewShift ) | usB ) ); usY++; diff --git a/Standard Gaming Platform/impTGA.h b/Standard Gaming Platform/impTGA.h index b486fbd5..21ccac15 100644 --- a/Standard Gaming Platform/impTGA.h +++ b/Standard Gaming Platform/impTGA.h @@ -44,7 +44,7 @@ extern "C" { #endif */ -BOOLEAN LoadTGAFileToImage( HIMAGE hImage, UINT16 fContents ); +BOOLEAN LoadTGAFileToImage( HIMAGE hImage, UINT16 fContents ); /* #ifdef __cplusplus } diff --git a/Standard Gaming Platform/input.cpp b/Standard Gaming Platform/input.cpp index 90fc312b..83e2e7cb 100644 --- a/Standard Gaming Platform/input.cpp +++ b/Standard Gaming Platform/input.cpp @@ -38,23 +38,23 @@ extern BOOLEAN gfApplicationActive; // The gfKeyState table is used to track which of the keys is up or down at any one time. This is used while polling // the interface. -BOOLEAN gfKeyState[256]; // TRUE = Pressed, FALSE = Not Pressed -BOOLEAN fCursorWasClipped = FALSE; -RECT gCursorClipRect; +BOOLEAN gfKeyState[256]; // TRUE = Pressed, FALSE = Not Pressed +BOOLEAN fCursorWasClipped = FALSE; +RECT gCursorClipRect; // The gsKeyTranslationTables basically translates scan codes to our own key value table. Please note that the table is 2 bytes // wide per entry. This will be used since we will use 2 byte characters for translation purposes. -UINT16 gfShiftState; // TRUE = Pressed, FALSE = Not Pressed -UINT16 gfAltState; // TRUE = Pressed, FALSE = Not Pressed -UINT16 gfCtrlState; // TRUE = Pressed, FALSE = Not Pressed +UINT16 gfShiftState; // SHIFT_DOWN = Pressed, FALSE = Not Pressed +UINT16 gfAltState; // ALT_DOWN = Pressed, FALSE = Not Pressed +UINT16 gfCtrlState; // CTRL_DOWN = Pressed, FALSE = Not Pressed // These data structure are used to track the mouse while polling -BOOLEAN gfTrackDblClick; -UINT32 guiDoubleClkDelay; // Current delay in milliseconds for a delay +BOOLEAN gfTrackDblClick; +UINT32 guiDoubleClkDelay; // Current delay in milliseconds for a delay UINT32 guiSingleClickTimer; UINT32 guiRecordedWParam; UINT32 guiRecordedLParam; @@ -64,18 +64,18 @@ BOOLEAN gfRecordedLeftButtonUp; UINT32 guiLeftButtonRepeatTimer; UINT32 guiRightButtonRepeatTimer; -BOOLEAN gfTrackMousePos; // TRUE = queue mouse movement events, FALSE = don't -BOOLEAN gfLeftButtonState; // TRUE = Pressed, FALSE = Not Pressed -BOOLEAN gfRightButtonState; // TRUE = Pressed, FALSE = Not Pressed -INT16 gusMouseXPos; // X position of the mouse on screen -INT16 gusMouseYPos; // y position of the mouse on screen +BOOLEAN gfTrackMousePos; // TRUE = queue mouse movement events, FALSE = don't +BOOLEAN gfLeftButtonState; // TRUE = Pressed, FALSE = Not Pressed +BOOLEAN gfRightButtonState; // TRUE = Pressed, FALSE = Not Pressed +INT16 gusMouseXPos; // X position of the mouse on screen +INT16 gusMouseYPos; // y position of the mouse on screen // The queue structures are used to track input events using queued events InputAtom gEventQueue[256]; -UINT16 gusQueueCount; -UINT16 gusHeadIndex; -UINT16 gusTailIndex; +UINT16 gusQueueCount; +UINT16 gusHeadIndex; +UINT16 gusTailIndex; // ATE: Added to signal if we have had input this frame - cleared by the SGP main loop BOOLEAN gfSGPInputReceived = FALSE; @@ -89,13 +89,13 @@ HHOOK ghMouseHook; // If the following pointer is non NULL then input characters are redirected to // the related string -BOOLEAN gfCurrentStringInputState; +BOOLEAN gfCurrentStringInputState; StringInput *gpCurrentStringDescriptor; // Local function headers -void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam); -void RedirectToString(UINT16 uiInputCharacter); +void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam); +void RedirectToString(UINT16 uiInputCharacter); void HandleSingleClicksAndButtonRepeats( void ); void AdjustMouseForWindowOrigin(void); @@ -104,138 +104,138 @@ void AdjustMouseForWindowOrigin(void); LRESULT CALLBACK KeyboardHandler(int Code, WPARAM wParam, LPARAM lParam) { #ifndef JA2 - if((Code < 0) || (!gfApplicationActive)) + if((Code < 0) || (!gfApplicationActive)) #else - if (Code < 0) + if (Code < 0) #endif - { // Do not handle this message, pass it on to another window - return CallNextHookEx(ghKeyboardHook, Code, wParam, lParam); - } + { // Do not handle this message, pass it on to another window + return CallNextHookEx(ghKeyboardHook, Code, wParam, lParam); + } - if (lParam & TRANSITION_MASK) - { // The key has been released - KeyUp(wParam, lParam); - //gfSGPInputReceived = TRUE; - } - else - { // Key was up - KeyDown(wParam, lParam); - gfSGPInputReceived = TRUE; - } + if (lParam & TRANSITION_MASK) + { // The key has been released + KeyUp(wParam, lParam); + //gfSGPInputReceived = TRUE; + } + else + { // Key was up + KeyDown(wParam, lParam); + gfSGPInputReceived = TRUE; + } - return TRUE; + return TRUE; } #ifdef JA2 LRESULT CALLBACK MouseHandler(int Code, WPARAM wParam, LPARAM lParam) { - UINT32 uiParam; - POINT mpos; + UINT32 uiParam; + POINT mpos; #ifndef JA2 - if((Code < 0) || (!gfApplicationActive)) + if((Code < 0) || (!gfApplicationActive)) #else - if (Code < 0) + if (Code < 0) #endif - { // Do not handle this message, pass it on to another window - return CallNextHookEx(ghMouseHook, Code, wParam, lParam); - } + { // Do not handle this message, pass it on to another window + return CallNextHookEx(ghMouseHook, Code, wParam, lParam); + } - switch (wParam) - { - case WM_LBUTTONDOWN - : // Update the current mouse position - mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt; - ScreenToClient( ghWindow, &mpos); - gusMouseXPos = (INT16)mpos.x; - gusMouseYPos = (INT16)mpos.y; - uiParam = gusMouseYPos; - uiParam = uiParam << 16; - uiParam = uiParam | gusMouseXPos; - // Update the button state + switch (wParam) + { + case WM_LBUTTONDOWN + : // Update the current mouse position + mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt; + ScreenToClient( ghWindow, &mpos); + gusMouseXPos = (INT16)mpos.x; + gusMouseYPos = (INT16)mpos.y; + uiParam = gusMouseYPos; + uiParam = uiParam << 16; + uiParam = uiParam | gusMouseXPos; + // Update the button state gfLeftButtonState = TRUE; //Set that we have input - gfSGPInputReceived = TRUE; - // Trigger an input event - QueueEvent(LEFT_BUTTON_DOWN, 0, uiParam); - break; - case WM_LBUTTONUP - : // Update the current mouse position - mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt; - ScreenToClient( ghWindow, &mpos); - gusMouseXPos = (INT16)mpos.x; - gusMouseYPos = (INT16)mpos.y; - uiParam = gusMouseYPos; - uiParam = uiParam << 16; - uiParam = uiParam | gusMouseXPos; - // Update the button state - gfLeftButtonState = FALSE; + gfSGPInputReceived = TRUE; + // Trigger an input event + QueueEvent(LEFT_BUTTON_DOWN, 0, uiParam); + break; + case WM_LBUTTONUP + : // Update the current mouse position + mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt; + ScreenToClient( ghWindow, &mpos); + gusMouseXPos = (INT16)mpos.x; + gusMouseYPos = (INT16)mpos.y; + uiParam = gusMouseYPos; + uiParam = uiParam << 16; + uiParam = uiParam | gusMouseXPos; + // Update the button state + gfLeftButtonState = FALSE; //Set that we have input - gfSGPInputReceived = TRUE; - // Trigger an input event - QueueEvent(LEFT_BUTTON_UP, 0, uiParam); - break; - case WM_RBUTTONDOWN - : // Update the current mouse position - mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt; - ScreenToClient( ghWindow, &mpos); - gusMouseXPos = (INT16)mpos.x; - gusMouseYPos = (INT16)mpos.y; - uiParam = gusMouseYPos; - uiParam = uiParam << 16; - uiParam = uiParam | gusMouseXPos; - // Update the button state - gfRightButtonState = TRUE; + gfSGPInputReceived = TRUE; + // Trigger an input event + QueueEvent(LEFT_BUTTON_UP, 0, uiParam); + break; + case WM_RBUTTONDOWN + : // Update the current mouse position + mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt; + ScreenToClient( ghWindow, &mpos); + gusMouseXPos = (INT16)mpos.x; + gusMouseYPos = (INT16)mpos.y; + uiParam = gusMouseYPos; + uiParam = uiParam << 16; + uiParam = uiParam | gusMouseXPos; + // Update the button state + gfRightButtonState = TRUE; //Set that we have input - gfSGPInputReceived = TRUE; - // Trigger an input event - QueueEvent(RIGHT_BUTTON_DOWN, 0, uiParam); - break; - case WM_RBUTTONUP - : // Update the current mouse position - mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt; - ScreenToClient( ghWindow, &mpos); - gusMouseXPos = (INT16)mpos.x; - gusMouseYPos = (INT16)mpos.y; - uiParam = gusMouseYPos; - uiParam = uiParam << 16; - uiParam = uiParam | gusMouseXPos; - // Update the button state - gfRightButtonState = FALSE; + gfSGPInputReceived = TRUE; + // Trigger an input event + QueueEvent(RIGHT_BUTTON_DOWN, 0, uiParam); + break; + case WM_RBUTTONUP + : // Update the current mouse position + mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt; + ScreenToClient( ghWindow, &mpos); + gusMouseXPos = (INT16)mpos.x; + gusMouseYPos = (INT16)mpos.y; + uiParam = gusMouseYPos; + uiParam = uiParam << 16; + uiParam = uiParam | gusMouseXPos; + // Update the button state + gfRightButtonState = FALSE; //Set that we have input - gfSGPInputReceived = TRUE; - // Trigger an input event - QueueEvent(RIGHT_BUTTON_UP, 0, uiParam); - break; - case WM_MOUSEMOVE - : // Update the current mouse position - mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt; - ScreenToClient( ghWindow, &mpos); - gusMouseXPos = (INT16)mpos.x; - gusMouseYPos = (INT16)mpos.y; - uiParam = gusMouseYPos; - uiParam = uiParam << 16; - uiParam = uiParam | gusMouseXPos; - // Trigger an input event - if (gfTrackMousePos == TRUE) - { - QueueEvent(MOUSE_POS, 0, uiParam); - } + gfSGPInputReceived = TRUE; + // Trigger an input event + QueueEvent(RIGHT_BUTTON_UP, 0, uiParam); + break; + case WM_MOUSEMOVE + : // Update the current mouse position + mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt; + ScreenToClient( ghWindow, &mpos); + gusMouseXPos = (INT16)mpos.x; + gusMouseYPos = (INT16)mpos.y; + uiParam = gusMouseYPos; + uiParam = uiParam << 16; + uiParam = uiParam | gusMouseXPos; + // Trigger an input event + if (gfTrackMousePos == TRUE) + { + QueueEvent(MOUSE_POS, 0, uiParam); + } //Set that we have input - gfSGPInputReceived = TRUE; - break; - default: - return CallNextHookEx(ghMouseHook, Code, wParam, lParam); - } + gfSGPInputReceived = TRUE; + break; + default: + return CallNextHookEx(ghMouseHook, Code, wParam, lParam); + } -// if (gusMouseXPos < 0 || gusMouseXPos >= SCREEN_WIDTH || -// gusMouseYPos < 0 || gusMouseYPos >= SCREEN_HEIGHT) - { - return CallNextHookEx(ghMouseHook, Code, wParam, lParam); - } +// if (gusMouseXPos < 0 || gusMouseXPos >= SCREEN_WIDTH || +// gusMouseYPos < 0 || gusMouseYPos >= SCREEN_HEIGHT) + { + return CallNextHookEx(ghMouseHook, Code, wParam, lParam); + } - return TRUE; + return TRUE; } #else @@ -251,8 +251,8 @@ BOOLEAN fOutsideClient=FALSE; static BOOLEAN fResizing=FALSE; LRESULT Result; - uiXPos= (((MOUSEHOOKSTRUCT *)lParam)->pt).x; - uiYPos= (((MOUSEHOOKSTRUCT *)lParam)->pt).y; + uiXPos= (((MOUSEHOOKSTRUCT *)lParam)->pt).x; + uiYPos= (((MOUSEHOOKSTRUCT *)lParam)->pt).y; if(!VideoIsFullScreen()) @@ -265,194 +265,195 @@ LRESULT Result; fOutsideClient=TRUE; } - if((Code < 0) || (!gfApplicationActive) || fOutsideClient || fResizing) - { // Do not handle this message, pass it on to another window - Result = CallNextHookEx(ghMouseHook, Code, wParam, lParam); + if((Code < 0) || (!gfApplicationActive) || fOutsideClient || fResizing) + { // Do not handle this message, pass it on to another window + Result = CallNextHookEx(ghMouseHook, Code, wParam, lParam); if((wParam==WM_LBUTTONUP) || (wParam==WM_NCLBUTTONUP)) fResizing=FALSE; return(Result); - } + } - switch (wParam) - { - case WM_LBUTTONUP: - case WM_LBUTTONDOWN: - case WM_RBUTTONDOWN: - case WM_RBUTTONUP: - case WM_MOUSEMOVE: + switch (wParam) + { + case WM_LBUTTONUP: + case WM_LBUTTONDOWN: + case WM_RBUTTONDOWN: + case WM_RBUTTONUP: + case WM_MOUSEMOVE: if(VideoIsFullScreen()) { - gusMouseXPos = (UINT16)(uiXPos); - gusMouseYPos = (UINT16)(uiYPos); + gusMouseXPos = (UINT16)(uiXPos); + gusMouseYPos = (UINT16)(uiYPos); } else { - gusMouseXPos = (UINT16)(uiXPos-rcClient.left); - gusMouseYPos = (UINT16)(uiYPos-rcClient.top); + gusMouseXPos = (UINT16)(uiXPos-rcClient.left); + gusMouseYPos = (UINT16)(uiYPos-rcClient.top); } - uiParam = (UINT32)gusMouseYPos<<16 | (UINT32)gusMouseXPos; + uiParam = (UINT32)gusMouseYPos<<16 | (UINT32)gusMouseXPos; //Set that we have input - gfSGPInputReceived = TRUE; - break; - } - + gfSGPInputReceived = TRUE; + break; + } + if ( wParam == WM_MOUSEWHEEL ) { return( FALSE ); } - - switch (wParam) - { - case WM_LBUTTONDOWN: - gfLeftButtonState = TRUE; - QueueEvent(LEFT_BUTTON_DOWN, 0, uiParam); - break; - case WM_LBUTTONUP: - gfLeftButtonState = FALSE; - QueueEvent(LEFT_BUTTON_UP, 0, uiParam); - break; - case WM_RBUTTONDOWN: - gfRightButtonState = TRUE; - QueueEvent(RIGHT_BUTTON_DOWN, 0, uiParam); - break; - case WM_RBUTTONUP: - gfRightButtonState = FALSE; - QueueEvent(RIGHT_BUTTON_UP, 0, uiParam); - break; - case WM_MOUSEMOVE: - if(gfTrackMousePos) - QueueEvent(MOUSE_POS, 0, uiParam); - break; - } - return(TRUE); + switch (wParam) + { + case WM_LBUTTONDOWN: + gfLeftButtonState = TRUE; + QueueEvent(LEFT_BUTTON_DOWN, 0, uiParam); + break; + case WM_LBUTTONUP: + gfLeftButtonState = FALSE; + QueueEvent(LEFT_BUTTON_UP, 0, uiParam); + break; + case WM_RBUTTONDOWN: + gfRightButtonState = TRUE; + QueueEvent(RIGHT_BUTTON_DOWN, 0, uiParam); + break; + case WM_RBUTTONUP: + gfRightButtonState = FALSE; + QueueEvent(RIGHT_BUTTON_UP, 0, uiParam); + break; + case WM_MOUSEMOVE: + if(gfTrackMousePos) + QueueEvent(MOUSE_POS, 0, uiParam); + break; + } + + return(TRUE); } #endif BOOLEAN InitializeInputManager(void) { - // Link to debugger - RegisterDebugTopic(TOPIC_INPUT, "Input Manager"); - // Initialize the gfKeyState table to FALSE everywhere - memset(gfKeyState, FALSE, 256); - // Initialize the Event Queue - gusQueueCount = 0; - gusHeadIndex = 0; - gusTailIndex = 0; - // By default, we will not queue mousemove events - gfTrackMousePos = FALSE; - // Initialize other variables - gfShiftState = FALSE; - gfAltState = FALSE; - gfCtrlState = FALSE; - // Initialize variables pertaining to DOUBLE CLIK stuff - gfTrackDblClick = TRUE; - guiDoubleClkDelay = DBL_CLK_TIME; - guiSingleClickTimer = 0; - gfRecordedLeftButtonUp = FALSE; - // Initialize variables pertaining to the button states - gfLeftButtonState = FALSE; - gfRightButtonState = FALSE; - // Initialize variables pertaining to the repeat mechanism - guiLeftButtonRepeatTimer = 0; + // Link to debugger + RegisterDebugTopic(TOPIC_INPUT, "Input Manager"); + // Initialize the gfKeyState table to FALSE everywhere + memset(gfKeyState, FALSE, 256); + // Initialize the Event Queue + gusQueueCount = 0; + gusHeadIndex = 0; + gusTailIndex = 0; + // By default, we will not queue mousemove events + gfTrackMousePos = FALSE; + // Initialize other variables + gfShiftState = FALSE; + gfAltState = FALSE; + gfCtrlState = FALSE; + // Initialize variables pertaining to DOUBLE CLIK stuff + gfTrackDblClick = TRUE; + guiDoubleClkDelay = DBL_CLK_TIME; + guiSingleClickTimer = 0; + gfRecordedLeftButtonUp = FALSE; + // Initialize variables pertaining to the button states + gfLeftButtonState = FALSE; + gfRightButtonState = FALSE; + // Initialize variables pertaining to the repeat mechanism + guiLeftButtonRepeatTimer = 0; guiRightButtonRepeatTimer = 0; - // Set the mouse to the center of the screen - gusMouseXPos = 320; - gusMouseYPos = 240; - // Initialize the string input mechanism - gfCurrentStringInputState = FALSE; - gpCurrentStringDescriptor = NULL; - // Activate the hook functions for both keyboard and Mouse -// ghKeyboardHook = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC) KeyboardHandler, (HINSTANCE) 0, GetCurrentThreadId()); -// DbgMessage(TOPIC_INPUT, DBG_LEVEL_2, String("Set keyboard hook returned %d", ghKeyboardHook)); + // Set the mouse to the center of the screen + gusMouseXPos = 320; + gusMouseYPos = 240; + // Initialize the string input mechanism + gfCurrentStringInputState = FALSE; + gpCurrentStringDescriptor = NULL; + // Activate the hook functions for both keyboard and Mouse +// ghKeyboardHook = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC) KeyboardHandler, (HINSTANCE) 0, GetCurrentThreadId()); +// DbgMessage(TOPIC_INPUT, DBG_LEVEL_2, String("Set keyboard hook returned %d", ghKeyboardHook)); - ghMouseHook = SetWindowsHookEx(WH_MOUSE, (HOOKPROC) MouseHandler, (HINSTANCE) 0, GetCurrentThreadId()); - DbgMessage(TOPIC_INPUT, DBG_LEVEL_2, String("Set mouse hook returned %d", ghMouseHook)); - return TRUE; + ghMouseHook = SetWindowsHookEx(WH_MOUSE, (HOOKPROC) MouseHandler, (HINSTANCE) 0, GetCurrentThreadId()); + DbgMessage(TOPIC_INPUT, DBG_LEVEL_2, String("Set mouse hook returned %d", ghMouseHook)); + return TRUE; } void ShutdownInputManager(void) -{ // There's very little to do when shutting down the input manager. In the future, this is where the keyboard and - // mouse hooks will be destroyed - UnRegisterDebugTopic(TOPIC_INPUT, "Input Manager"); -// UnhookWindowsHookEx(ghKeyboardHook); - UnhookWindowsHookEx(ghMouseHook); +{ + // There's very little to do when shutting down the input manager. In the future, this is where the keyboard and + // mouse hooks will be destroyed + UnRegisterDebugTopic(TOPIC_INPUT, "Input Manager"); +// UnhookWindowsHookEx(ghKeyboardHook); + UnhookWindowsHookEx(ghMouseHook); } void QueuePureEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam) { - UINT32 uiTimer; - UINT16 usKeyState; + UINT32 uiTimer; + UINT16 usKeyState; - uiTimer = GetTickCount(); - usKeyState = gfShiftState | gfCtrlState | gfAltState; + uiTimer = GetTickCount(); + usKeyState = gfShiftState | gfCtrlState | gfAltState; - // Can we queue up one more event, if not, the event is lost forever - if (gusQueueCount == 256) - { // No more queue space - return; - } + // Can we queue up one more event, if not, the event is lost forever + if (gusQueueCount == 256) + { // No more queue space + return; + } - // Okey Dokey, we can queue up the event, so we do it - gEventQueue[gusTailIndex].uiTimeStamp = uiTimer; - gEventQueue[gusTailIndex].usKeyState = usKeyState; - gEventQueue[gusTailIndex].usEvent = ubInputEvent; - gEventQueue[gusTailIndex].usParam = usParam; - gEventQueue[gusTailIndex].uiParam = uiParam; + // Okey Dokey, we can queue up the event, so we do it + gEventQueue[gusTailIndex].uiTimeStamp = uiTimer; + gEventQueue[gusTailIndex].usKeyState = usKeyState; + gEventQueue[gusTailIndex].usEvent = ubInputEvent; + gEventQueue[gusTailIndex].usParam = usParam; + gEventQueue[gusTailIndex].uiParam = uiParam; - // Increment the number of items on the input queue - gusQueueCount++; + // Increment the number of items on the input queue + gusQueueCount++; - // Increment the gusTailIndex pointer - if (gusTailIndex == 255) - { // The gusTailIndex is about to wrap around the queue ring - gusTailIndex = 0; - } - else - { // We simply increment the gusTailIndex - gusTailIndex++; - } + // Increment the gusTailIndex pointer + if (gusTailIndex == 255) + { // The gusTailIndex is about to wrap around the queue ring + gusTailIndex = 0; + } + else + { // We simply increment the gusTailIndex + gusTailIndex++; + } } void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam) { - UINT32 uiTimer; - UINT16 usKeyState; + UINT32 uiTimer; + UINT16 usKeyState; - uiTimer = GetTickCount(); - usKeyState = gfShiftState | gfCtrlState | gfAltState; + uiTimer = GetTickCount(); + usKeyState = gfShiftState | gfCtrlState | gfAltState; - // Can we queue up one more event, if not, the event is lost forever - if (gusQueueCount == 256) - { // No more queue space - return; - } + // Can we queue up one more event, if not, the event is lost forever + if (gusQueueCount == 256) + { // No more queue space + return; + } - if (ubInputEvent == LEFT_BUTTON_DOWN) - { - guiLeftButtonRepeatTimer = uiTimer + BUTTON_REPEAT_TIMEOUT; - } + if (ubInputEvent == LEFT_BUTTON_DOWN) + { + guiLeftButtonRepeatTimer = uiTimer + BUTTON_REPEAT_TIMEOUT; + } - if (ubInputEvent == RIGHT_BUTTON_DOWN) - { - guiRightButtonRepeatTimer = uiTimer + BUTTON_REPEAT_TIMEOUT; - } + if (ubInputEvent == RIGHT_BUTTON_DOWN) + { + guiRightButtonRepeatTimer = uiTimer + BUTTON_REPEAT_TIMEOUT; + } - if (ubInputEvent == LEFT_BUTTON_UP) - { - guiLeftButtonRepeatTimer = 0; - } + if (ubInputEvent == LEFT_BUTTON_UP) + { + guiLeftButtonRepeatTimer = 0; + } - if (ubInputEvent == RIGHT_BUTTON_UP) - { - guiRightButtonRepeatTimer = 0; - } + if (ubInputEvent == RIGHT_BUTTON_UP) + { + guiRightButtonRepeatTimer = 0; + } - if ( (ubInputEvent == LEFT_BUTTON_UP) ) - { + if ( (ubInputEvent == LEFT_BUTTON_UP) ) + { // Do we have a double click if ( ( uiTimer - guiSingleClickTimer ) < DBL_CLK_TIME ) { @@ -506,34 +507,34 @@ void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam) // Save time guiSingleClickTimer = uiTimer; } - } + } - // Okey Dokey, we can queue up the event, so we do it - gEventQueue[gusTailIndex].uiTimeStamp = uiTimer; - gEventQueue[gusTailIndex].usKeyState = usKeyState; - gEventQueue[gusTailIndex].usEvent = ubInputEvent; - gEventQueue[gusTailIndex].usParam = usParam; - gEventQueue[gusTailIndex].uiParam = uiParam; + // Okey Dokey, we can queue up the event, so we do it + gEventQueue[gusTailIndex].uiTimeStamp = uiTimer; + gEventQueue[gusTailIndex].usKeyState = usKeyState; + gEventQueue[gusTailIndex].usEvent = ubInputEvent; + gEventQueue[gusTailIndex].usParam = usParam; + gEventQueue[gusTailIndex].uiParam = uiParam; - // Increment the number of items on the input queue - gusQueueCount++; + // Increment the number of items on the input queue + gusQueueCount++; - // Increment the gusTailIndex pointer - if (gusTailIndex == 255) - { // The gusTailIndex is about to wrap around the queue ring - gusTailIndex = 0; - } - else - { // We simply increment the gusTailIndex - gusTailIndex++; - } + // Increment the gusTailIndex pointer + if (gusTailIndex == 255) + { // The gusTailIndex is about to wrap around the queue ring + gusTailIndex = 0; + } + else + { // We simply increment the gusTailIndex + gusTailIndex++; + } } BOOLEAN DequeueSpecificEvent(InputAtom *Event, UINT32 uiMaskFlags ) { - // Is there an event to dequeue - if (gusQueueCount > 0) - { + // Is there an event to dequeue + if (gusQueueCount > 0) + { memcpy( Event, &( gEventQueue[gusHeadIndex] ), sizeof( InputAtom ) ); // Check if it has the masks! @@ -550,9 +551,9 @@ BOOLEAN DequeueEvent(InputAtom *Event) { HandleSingleClicksAndButtonRepeats( ); - // Is there an event to dequeue - if (gusQueueCount > 0) - { + // Is there an event to dequeue + if (gusQueueCount > 0) + { // We have an event, so we dequeue it memcpy( Event, &( gEventQueue[gusHeadIndex] ), sizeof( InputAtom ) ); @@ -570,7 +571,7 @@ BOOLEAN DequeueEvent(InputAtom *Event) // dequeued an event, return TRUE return TRUE; - } + } else { // No events to dequeue, return FALSE @@ -580,477 +581,479 @@ BOOLEAN DequeueEvent(InputAtom *Event) void KeyChange(UINT32 usParam, UINT32 uiParam, UINT8 ufKeyState) { - UINT32 ubKey; - UINT16 ubChar; - POINT MousePos; - UINT32 uiTmpLParam; + UINT32 ubKey; + UINT16 ubChar; + POINT MousePos; + UINT32 uiTmpLParam; - if ((usParam >= 96)&&(usParam <= 110)) - { // Well this could be a NUMPAD character imitating the center console characters (when NUMLOCK is OFF). Well we - // gotta find out what was pressed and translate it to the actual physical key (i.e. if we think that HOME was - // pressed but NUM_7 was pressed, the we translate the key into NUM_7 - switch(usParam) - { case 96 // NUM_0 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 82) - { // Well its the NUM_9 key and not actually the PGUP key - ubKey = 223; - } - else - { // NOP, its the PGUP key all right - ubKey = usParam; - } - break; - case 110 // NUM_PERIOD - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 83) - { // Well its the NUM_3 key and not actually the PGDN key - ubKey = 224; - } - else - { // NOP, its the PGDN key all right - ubKey = usParam; - } - break; - case 97 // NUM_1 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 79) - { // Well its the NUM_1 key and not actually the END key - ubKey = 225; - } - else - { // NOP, its the END key all right - ubKey = usParam; - } - break; - case 98 // NUM_2 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 80) - { // Well its the NUM_7 key and not actually the HOME key - ubKey = 226; - } - else - { // NOP, its the HOME key all right - ubKey = usParam; - } - break; - case 99 // NUM_3 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 81) - { // Well its the NUM_4 key and not actually the LARROW key - ubKey = 227; - } - else - { // NOP, it's the LARROW key all right - ubKey = usParam; - } - break; - case 100 // NUM_4 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 75) - { // Well its the NUM_8 key and not actually the UPARROW key - ubKey = 228; - } - else - { // NOP, it's the UPARROW key all right - ubKey = usParam; - } - break; - case 101 // NUM_5 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 76) - { // Well its the NUM_6 key and not actually the RARROW key - ubKey = 229; - } - else - { // NOP, it's the RARROW key all right - ubKey = usParam; - } - break; - case 102 // NUM_6 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 77) - { // Well its the NUM_2 key and not actually the DNARROW key - ubKey = 230; - } - else - { // NOP, it's the DNARROW key all right - ubKey = usParam; - } - break; - case 103 // NUM_7 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 71) - { // Well its the NUM_0 key and not actually the INSERT key - ubKey = 231; - } - else - { // NOP, it's the INSERT key all right - ubKey = usParam; - } - break; - case 104 // NUM_8 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 72) - { // Well its the NUM_PERIOD key and not actually the DELETE key - ubKey = 232; - } - else - { // NOP, it's the DELETE key all right - ubKey = usParam; - } - break; - case 105 // NUM_9 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 73) - { // Well its the NUM_PERIOD key and not actually the DELETE key - ubKey = 233; - } - else - { // NOP, it's the DELETE key all right - ubKey = usParam; - } - break; - default - : ubKey = usParam; - break; - } - } - else - { - if ((usParam >= 33)&&(usParam <= 46)) - { // Well this could be a NUMPAD character imitating the center console characters (when NUMLOCK is OFF). Well we - // gotta find out what was pressed and translate it to the actual physical key (i.e. if we think that HOME was - // pressed but NUM_7 was pressed, the we translate the key into NUM_7 - switch(usParam) - { case 45 // NUM_0 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 82) - { // Is it the NUM_0 key or the INSERT key - if (((uiParam & EXT_CODE_MASK) >> 17) != 0) - { // It's the INSERT key - ubKey = 245; - } - else - { // Is the NUM_0 key with NUM lock off - ubKey = 234; - } - } - else - { - ubKey = usParam; - } - break; - case 46 // NUM_PERIOD - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 83) - { // Is it the NUM_PERIOD key or the DEL key - if (((uiParam & EXT_CODE_MASK) >> 17) != 0) - { // It's the DELETE key - ubKey = 246; - } - else - { // Is the NUM_PERIOD key with NUM lock off - ubKey = 235; - } - } - else - { - ubKey = usParam; - } - break; - case 35 // NUM_1 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 79) - { // Is it the NUM_1 key or the END key - if (((uiParam & EXT_CODE_MASK) >> 17) != 0) - { // It's the END key - ubKey = 247; - } - else - { // Is the NUM_1 key with NUM lock off - ubKey = 236; - } - } - else - { - ubKey = usParam; - } - break; - case 40 // NUM_2 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 80) - { // Is it the NUM_2 key or the DOWN key - if (((uiParam & EXT_CODE_MASK) >> 17) != 0) - { // It's the DOWN key - ubKey = 248; - } - else - { // Is the NUM_2 key with NUM lock off - ubKey = 237; - } - } - else - { - ubKey = usParam; - } - break; - case 34 // NUM_3 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 81) - { // Is it the NUM_3 key or the PGDN key - if (((uiParam & EXT_CODE_MASK) >> 17) != 0) - { // It's the PGDN key - ubKey = 249; - } - else - { // Is the NUM_3 key with NUM lock off - ubKey = 238; - } - } - else - { - ubKey = usParam; - } - break; - case 37 // NUM_4 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 75) - { // Is it the NUM_4 key or the LEFT key - if (((uiParam & EXT_CODE_MASK) >> 17) != 0) - { // It's the LEFT key - ubKey = 250; - } - else - { // Is the NUM_4 key with NUM lock off - ubKey = 239; - } - } - else - { - ubKey = usParam; - } - break; - case 39 // NUM_6 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 77) - { // Is it the NUM_6 key or the RIGHT key - if (((uiParam & EXT_CODE_MASK) >> 17) != 0) - { // It's the RIGHT key - ubKey = 251; - } - else - { // Is the NUM_6 key with NUM lock off - ubKey = 241; - } - } - else - { - ubKey = usParam; - } - break; - case 36 // NUM_7 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 71) - { // Is it the NUM_7 key or the HOME key - if (((uiParam & EXT_CODE_MASK) >> 17) != 0) - { // It's the HOME key - ubKey = 252; - } - else - { // Is the NUM_7 key with NUM lock off - ubKey = 242; - } - } - else - { - ubKey = usParam; - } - break; - case 38 // NUM_8 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 72) - { // Is it the NUM_8 key or the UP key - if (((uiParam & EXT_CODE_MASK) >> 17) != 0) - { // It's the UP key - ubKey = 253; - } - else - { // Is the NUM_8 key with NUM lock off - ubKey = 243; - } - } - else - { - ubKey = usParam; - } - break; - case 33 // NUM_9 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 73) - { // Is it the NUM_9 key or the PGUP key - if (((uiParam & EXT_CODE_MASK) >> 17) != 0) - { // It's the PGUP key - ubKey = 254; - } - else - { // Is the NUM_9 key with NUM lock off - ubKey = 244; - } - } - else - { - ubKey = usParam; - } - break; - default - : ubKey = usParam; - break; - } - } - else - { - if (usParam == 12) - { // NUM_5 with NUM_LOCK off - ubKey = 240; - } - else - { // Normal key - ubKey = usParam; - } - } - } + if ((usParam >= 96)&&(usParam <= 110)) + { // Well this could be a NUMPAD character imitating the center console characters (when NUMLOCK is OFF). Well we + // gotta find out what was pressed and translate it to the actual physical key (i.e. if we think that HOME was + // pressed but NUM_7 was pressed, the we translate the key into NUM_7 + switch(usParam) + { case 96 // NUM_0 + : if (((uiParam & SCAN_CODE_MASK) >> 16) == 82) + { // Well its the NUM_9 key and not actually the PGUP key + ubKey = 223; + } + else + { // NOP, its the PGUP key all right + ubKey = usParam; + } + break; + case 110 // NUM_PERIOD + : if (((uiParam & SCAN_CODE_MASK) >> 16) == 83) + { // Well its the NUM_3 key and not actually the PGDN key + ubKey = 224; + } + else + { // NOP, its the PGDN key all right + ubKey = usParam; + } + break; + case 97 // NUM_1 + : if (((uiParam & SCAN_CODE_MASK) >> 16) == 79) + { // Well its the NUM_1 key and not actually the END key + ubKey = 225; + } + else + { // NOP, its the END key all right + ubKey = usParam; + } + break; + case 98 // NUM_2 + : if (((uiParam & SCAN_CODE_MASK) >> 16) == 80) + { // Well its the NUM_7 key and not actually the HOME key + ubKey = 226; + } + else + { // NOP, its the HOME key all right + ubKey = usParam; + } + break; + case 99 // NUM_3 + : if (((uiParam & SCAN_CODE_MASK) >> 16) == 81) + { // Well its the NUM_4 key and not actually the LARROW key + ubKey = 227; + } + else + { // NOP, it's the LARROW key all right + ubKey = usParam; + } + break; + case 100 // NUM_4 + : if (((uiParam & SCAN_CODE_MASK) >> 16) == 75) + { // Well its the NUM_8 key and not actually the UPARROW key + ubKey = 228; + } + else + { // NOP, it's the UPARROW key all right + ubKey = usParam; + } + break; + case 101 // NUM_5 + : if (((uiParam & SCAN_CODE_MASK) >> 16) == 76) + { // Well its the NUM_6 key and not actually the RARROW key + ubKey = 229; + } + else + { // NOP, it's the RARROW key all right + ubKey = usParam; + } + break; + case 102 // NUM_6 + : if (((uiParam & SCAN_CODE_MASK) >> 16) == 77) + { // Well its the NUM_2 key and not actually the DNARROW key + ubKey = 230; + } + else + { // NOP, it's the DNARROW key all right + ubKey = usParam; + } + break; + case 103 // NUM_7 + : if (((uiParam & SCAN_CODE_MASK) >> 16) == 71) + { // Well its the NUM_0 key and not actually the INSERT key + ubKey = 231; + } + else + { // NOP, it's the INSERT key all right + ubKey = usParam; + } + break; + case 104 // NUM_8 + : if (((uiParam & SCAN_CODE_MASK) >> 16) == 72) + { // Well its the NUM_PERIOD key and not actually the DELETE key + ubKey = 232; + } + else + { // NOP, it's the DELETE key all right + ubKey = usParam; + } + break; + case 105 // NUM_9 + : if (((uiParam & SCAN_CODE_MASK) >> 16) == 73) + { // Well its the NUM_PERIOD key and not actually the DELETE key + ubKey = 233; + } + else + { // NOP, it's the DELETE key all right + ubKey = usParam; + } + break; + default + : ubKey = usParam; + break; + } + } + else + { + if ((usParam >= 33)&&(usParam <= 46)) + { // Well this could be a NUMPAD character imitating the center console characters (when NUMLOCK is OFF). Well we + // gotta find out what was pressed and translate it to the actual physical key (i.e. if we think that HOME was + // pressed but NUM_7 was pressed, the we translate the key into NUM_7 + switch(usParam) + { case 45 // NUM_0 + : if (((uiParam & SCAN_CODE_MASK) >> 16) == 82) + { // Is it the NUM_0 key or the INSERT key + if (((uiParam & EXT_CODE_MASK) >> 17) != 0) + { // It's the INSERT key + ubKey = 245; + } + else + { // Is the NUM_0 key with NUM lock off + ubKey = 234; + } + } + else + { + ubKey = usParam; + } + break; + case 46 // NUM_PERIOD + : if (((uiParam & SCAN_CODE_MASK) >> 16) == 83) + { // Is it the NUM_PERIOD key or the DEL key + if (((uiParam & EXT_CODE_MASK) >> 17) != 0) + { // It's the DELETE key + ubKey = 246; + } + else + { // Is the NUM_PERIOD key with NUM lock off + ubKey = 235; + } + } + else + { + ubKey = usParam; + } + break; + case 35 // NUM_1 + : if (((uiParam & SCAN_CODE_MASK) >> 16) == 79) + { // Is it the NUM_1 key or the END key + if (((uiParam & EXT_CODE_MASK) >> 17) != 0) + { // It's the END key + ubKey = 247; + } + else + { // Is the NUM_1 key with NUM lock off + ubKey = 236; + } + } + else + { + ubKey = usParam; + } + break; + case 40 // NUM_2 + : if (((uiParam & SCAN_CODE_MASK) >> 16) == 80) + { // Is it the NUM_2 key or the DOWN key + if (((uiParam & EXT_CODE_MASK) >> 17) != 0) + { // It's the DOWN key + ubKey = 248; + } + else + { // Is the NUM_2 key with NUM lock off + ubKey = 237; + } + } + else + { + ubKey = usParam; + } + break; + case 34 // NUM_3 + : if (((uiParam & SCAN_CODE_MASK) >> 16) == 81) + { // Is it the NUM_3 key or the PGDN key + if (((uiParam & EXT_CODE_MASK) >> 17) != 0) + { // It's the PGDN key + ubKey = 249; + } + else + { // Is the NUM_3 key with NUM lock off + ubKey = 238; + } + } + else + { + ubKey = usParam; + } + break; + case 37 // NUM_4 + : if (((uiParam & SCAN_CODE_MASK) >> 16) == 75) + { // Is it the NUM_4 key or the LEFT key + if (((uiParam & EXT_CODE_MASK) >> 17) != 0) + { // It's the LEFT key + ubKey = 250; + } + else + { // Is the NUM_4 key with NUM lock off + ubKey = 239; + } + } + else + { + ubKey = usParam; + } + break; + case 39 // NUM_6 + : if (((uiParam & SCAN_CODE_MASK) >> 16) == 77) + { // Is it the NUM_6 key or the RIGHT key + if (((uiParam & EXT_CODE_MASK) >> 17) != 0) + { // It's the RIGHT key + ubKey = 251; + } + else + { // Is the NUM_6 key with NUM lock off + ubKey = 241; + } + } + else + { + ubKey = usParam; + } + break; + case 36 // NUM_7 + : if (((uiParam & SCAN_CODE_MASK) >> 16) == 71) + { // Is it the NUM_7 key or the HOME key + if (((uiParam & EXT_CODE_MASK) >> 17) != 0) + { // It's the HOME key + ubKey = 252; + } + else + { // Is the NUM_7 key with NUM lock off + ubKey = 242; + } + } + else + { + ubKey = usParam; + } + break; + case 38 // NUM_8 + : if (((uiParam & SCAN_CODE_MASK) >> 16) == 72) + { // Is it the NUM_8 key or the UP key + if (((uiParam & EXT_CODE_MASK) >> 17) != 0) + { // It's the UP key + ubKey = 253; + } + else + { // Is the NUM_8 key with NUM lock off + ubKey = 243; + } + } + else + { + ubKey = usParam; + } + break; + case 33 // NUM_9 + : if (((uiParam & SCAN_CODE_MASK) >> 16) == 73) + { // Is it the NUM_9 key or the PGUP key + if (((uiParam & EXT_CODE_MASK) >> 17) != 0) + { // It's the PGUP key + ubKey = 254; + } + else + { // Is the NUM_9 key with NUM lock off + ubKey = 244; + } + } + else + { + ubKey = usParam; + } + break; + default + : ubKey = usParam; + break; + } + } + else + { + if (usParam == 12) + { // NUM_5 with NUM_LOCK off + ubKey = 240; + } + else + { // Normal key + ubKey = usParam; + } + } + } // Find ucChar by translating ubKey using the gsKeyTranslationTable. If the SHIFT, ALT or CTRL key are down, then - // the index into the translation table us changed from ubKey to ubKey+256, ubKey+512 and ubKey+768 respectively + // the index into the translation table us changed from ubKey to ubKey+256, ubKey+512 and ubKey+768 respectively if (gfShiftState == TRUE) - { // SHIFT is pressed, hence we add 256 to ubKey before translation to ubChar - ubChar = gsKeyTranslationTable[ubKey+256]; - } - else - { + { // SHIFT is pressed, hence we add 256 to ubKey before translation to ubChar + ubChar = gsKeyTranslationTable[ubKey+256]; + } + else + { // // Even though gfAltState is checked as if it was a BOOLEAN, it really contains 0x02, which - // is NOT == to true. This is broken, however to fix it would break Ja2 and Wizardry. + // is NOT == to true. This is broken, however to fix it would break Ja2 and Wizardry. // The same thing goes for gfCtrlState and gfShiftState, howver gfShiftState is assigned 0x01 which IS == to TRUE. - // Just something i found, and thought u should know about. DF. + // Just something i found, and thought u should know about. DF. // - if( gfAltState == TRUE ) - { // ALT is pressed, hence ubKey is multiplied by 3 before translation to ubChar - ubChar = gsKeyTranslationTable[ubKey+512]; - } - else - { - if (gfCtrlState == TRUE) - { // CTRL is pressed, hence ubKey is multiplied by 4 before translation to ubChar - ubChar = gsKeyTranslationTable[ubKey+768]; - } - else - { // None of the SHIFT, ALT or CTRL are pressed hence we have a default translation of ubKey - ubChar = gsKeyTranslationTable[ubKey]; - } - } - } + if( gfAltState == TRUE ) + { // ALT is pressed, hence ubKey is multiplied by 3 before translation to ubChar + ubChar = gsKeyTranslationTable[ubKey+512]; + } + else + { + if (gfCtrlState == TRUE) + { // CTRL is pressed, hence ubKey is multiplied by 4 before translation to ubChar + ubChar = gsKeyTranslationTable[ubKey+768]; + } + else + { // None of the SHIFT, ALT or CTRL are pressed hence we have a default translation of ubKey + ubChar = gsKeyTranslationTable[ubKey]; + } + } + } - GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! + GetCursorPos(&MousePos); + ScreenToClient(ghWindow, &MousePos); // In window coords! - uiTmpLParam = ((MousePos.y << 16) & 0xffff0000) | (MousePos.x & 0x0000ffff); + uiTmpLParam = ((MousePos.y << 16) & 0xffff0000) | (MousePos.x & 0x0000ffff); - if (ufKeyState == TRUE) - { // Key has been PRESSED - // Find out if the key is already pressed and if not, queue an event and update the gfKeyState array - if (gfKeyState[ubKey] == FALSE) - { // Well the key has just been pressed, therefore we queue up and event and update the gsKeyState - if (gfCurrentStringInputState == FALSE) - { - // There is no string input going on right now, so we queue up the event - gfKeyState[ubKey] = TRUE; - QueueEvent(KEY_DOWN, ubChar, uiTmpLParam); + if (ufKeyState == TRUE) + { // Key has been PRESSED + // Find out if the key is already pressed and if not, queue an event and update the gfKeyState array + if (gfKeyState[ubKey] == FALSE) + { // Well the key has just been pressed, therefore we queue up and event and update the gsKeyState + if (gfCurrentStringInputState == FALSE) + { + // There is no string input going on right now, so we queue up the event + gfKeyState[ubKey] = TRUE; + QueueEvent(KEY_DOWN, ubChar, uiTmpLParam); } - else - { // There is a current input string which will capture this event - RedirectToString(ubChar); - DbgMessage(TOPIC_INPUT, DBG_LEVEL_0, String("Pressed character %d (%d)", ubChar, ubKey)); - } - } - else - { // Well the key gets repeated - if (gfCurrentStringInputState == FALSE) - { // There is no string input going on right now, so we queue up the event - QueueEvent(KEY_REPEAT, ubChar, uiTmpLParam); - } - else - { // There is a current input string which will capture this event - RedirectToString(ubChar); - } - } - } - else - { // Key has been RELEASED - // Find out if the key is already pressed and if so, queue an event and update the gfKeyState array - if (gfKeyState[ubKey] == TRUE) - { // Well the key has just been pressed, therefore we queue up and event and update the gsKeyState - gfKeyState[ubKey] = FALSE; - QueueEvent(KEY_UP, ubChar, uiTmpLParam); - } + else + { // There is a current input string which will capture this event + RedirectToString(ubChar); + DbgMessage(TOPIC_INPUT, DBG_LEVEL_0, String("Pressed character %d (%d)", ubChar, ubKey)); + } + } + else + { // Well the key gets repeated + if (gfCurrentStringInputState == FALSE) + { // There is no string input going on right now, so we queue up the event + QueueEvent(KEY_REPEAT, ubChar, uiTmpLParam); + } + else + { // There is a current input string which will capture this event + RedirectToString(ubChar); + } + } + } + else + { // Key has been RELEASED + // Find out if the key is already pressed and if so, queue an event and update the gfKeyState array + if (gfKeyState[ubKey] == TRUE) + { // Well the key has just been pressed, therefore we queue up and event and update the gsKeyState + gfKeyState[ubKey] = FALSE; + QueueEvent(KEY_UP, ubChar, uiTmpLParam); + } //else if the alt tab key was pressed else if( ubChar == TAB && gfAltState ) { // therefore minimize the application - ShowWindow( ghWindow, SW_MINIMIZE ); - gfKeyState[ ALT ] = FALSE; + ShowWindow( ghWindow, SW_MINIMIZE ); + gfKeyState[ ALT ] = FALSE; gfAltState = FALSE; } - } + } } void KeyDown(UINT32 usParam, UINT32 uiParam) -{ // Are we PRESSING down one of SHIFT, ALT or CTRL ??? - if (usParam == 16) - { // SHIFT key is PRESSED - gfShiftState = SHIFT_DOWN; - gfKeyState[16] = TRUE; - } - else - { - if (usParam == 17) - { // CTRL key is PRESSED - gfCtrlState = CTRL_DOWN; - gfKeyState[17] = TRUE; - } - else - { - if (usParam == 18) - { // ALT key is pressed - gfAltState = ALT_DOWN; - gfKeyState[18] = TRUE; - } - else - { - if (usParam == SNAPSHOT) - { - //PrintScreen(); +{ + // Are we PRESSING down one of SHIFT, ALT or CTRL ??? + if (usParam == SHIFT) + { // SHIFT key is PRESSED + gfShiftState = SHIFT_DOWN; + gfKeyState[SHIFT] = TRUE; + } + else + { + if (usParam == CTRL) + { // CTRL key is PRESSED + gfCtrlState = CTRL_DOWN; + gfKeyState[CTRL] = TRUE; + } + else + { + if (usParam == ALT) + { // ALT key is pressed + gfAltState = ALT_DOWN; + gfKeyState[ALT] = TRUE; + } + else + { + if (usParam == SNAPSHOT) + { + //PrintScreen(); // DB Done in the KeyUp function // this used to be keyed to SCRL_LOCK // which I believe Luis gave the wrong value - } - else - { - // No special keys have been pressed - // Call KeyChange() and pass TRUE to indicate key has been PRESSED and not RELEASED - KeyChange(usParam, uiParam, TRUE); - } - } - } - } + } + else + { + // No special keys have been pressed + // Call KeyChange() and pass TRUE to indicate key has been PRESSED and not RELEASED + KeyChange(usParam, uiParam, TRUE); + } + } + } + } } void KeyUp(UINT32 usParam, UINT32 uiParam) -{ // Are we RELEASING one of SHIFT, ALT or CTRL ??? - if (usParam == 16) - { // SHIFT key is RELEASED - gfShiftState = FALSE; - gfKeyState[16] = FALSE; - } - else - { - if (usParam == 17) - { // CTRL key is RELEASED - gfCtrlState = FALSE; - gfKeyState[17] = FALSE; - } - else - { - if (usParam == 18) - { // ALT key is RELEASED - gfAltState = FALSE; - gfKeyState[18] = FALSE; - } - else - { - if (usParam == SNAPSHOT) - { +{ + // Are we RELEASING one of SHIFT, ALT or CTRL ??? + if (usParam == SHIFT) + { // SHIFT key is RELEASED + gfShiftState = FALSE; + gfKeyState[SHIFT] = FALSE; + } + else + { + if (usParam == CTRL) + { // CTRL key is RELEASED + gfCtrlState = FALSE; + gfKeyState[CTRL] = FALSE; + } + else + { + if (usParam == ALT) + { // ALT key is RELEASED + gfAltState = FALSE; + gfKeyState[ALT] = FALSE; + } + else + { + if (usParam == SNAPSHOT) + { // DB this used to be keyed to SCRL_LOCK // which I believe Luis gave the wrong value //#ifndef JA2 @@ -1059,16 +1062,16 @@ void KeyUp(UINT32 usParam, UINT32 uiParam) else //#endif PrintScreen(); - } - else - { + } + else + { // No special keys have been pressed // Call KeyChange() and pass FALSE to indicate key has been PRESSED and not RELEASED KeyChange(usParam, uiParam, FALSE); - } - } - } - } + } + } + } + } } void EnableDoubleClk(void) @@ -1083,15 +1086,15 @@ void DisableDoubleClk(void) void GetMousePos(SGPPoint *Point) { - POINT MousePos; + POINT MousePos; - GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! + GetCursorPos(&MousePos); + ScreenToClient(ghWindow, &MousePos); // In window coords! - Point->iX = (UINT32) MousePos.x; - Point->iY = (UINT32) MousePos.y; + Point->iX = (UINT32) MousePos.x; + Point->iY = (UINT32) MousePos.y; - return; + return; } // These functions will be used for string input @@ -1108,414 +1111,415 @@ void GetMousePos(SGPPoint *Point) StringInput *InitStringInput(UINT16 *pInputString, UINT16 usLength, UINT16 *pFilter) { - StringInput *pStringDescriptor; + StringInput *pStringDescriptor; - if ((pStringDescriptor = (StringInput *) MemAlloc(sizeof(StringInput))) == NULL) - { - // - // Hum we failed to allocate memory for the string descriptor - // + if ((pStringDescriptor = (StringInput *) MemAlloc(sizeof(StringInput))) == NULL) + { + // + // Hum we failed to allocate memory for the string descriptor + // - DbgMessage(TOPIC_INPUT, DBG_LEVEL_1, "Failed to allocate memory for string descriptor"); - return NULL; - } - else - { - if ((pStringDescriptor->pOriginalString = (UINT16 *) MemAlloc(usLength * 2)) == NULL) - { - // - // free up structure before aborting - // + DbgMessage(TOPIC_INPUT, DBG_LEVEL_1, "Failed to allocate memory for string descriptor"); + return NULL; + } + else + { + if ((pStringDescriptor->pOriginalString = (UINT16 *) MemAlloc(usLength * 2)) == NULL) + { + // + // free up structure before aborting + // - MemFree(pStringDescriptor); - DbgMessage(TOPIC_INPUT, DBG_LEVEL_1, "Failed to allocate memory for string duplicate"); - return NULL; - } + MemFree(pStringDescriptor); + DbgMessage(TOPIC_INPUT, DBG_LEVEL_1, "Failed to allocate memory for string duplicate"); + return NULL; + } - memcpy(pStringDescriptor->pOriginalString, pInputString, usLength * 2); + memcpy(pStringDescriptor->pOriginalString, pInputString, usLength * 2); - pStringDescriptor->pString = pInputString; - pStringDescriptor->pFilter = pFilter; - pStringDescriptor->usMaxStringLength = usLength; - pStringDescriptor->usStringOffset = 0; - pStringDescriptor->usCurrentStringLength = 0; - while ((pStringDescriptor->usStringOffset < pStringDescriptor->usMaxStringLength)&&(*(pStringDescriptor->pString + pStringDescriptor->usStringOffset) != 0)) - { - // - // Find the last character in the string - // + pStringDescriptor->pString = pInputString; + pStringDescriptor->pFilter = pFilter; + pStringDescriptor->usMaxStringLength = usLength; + pStringDescriptor->usStringOffset = 0; + pStringDescriptor->usCurrentStringLength = 0; + while ((pStringDescriptor->usStringOffset < pStringDescriptor->usMaxStringLength)&&(*(pStringDescriptor->pString + pStringDescriptor->usStringOffset) != 0)) + { + // + // Find the last character in the string + // - pStringDescriptor->usStringOffset++; - pStringDescriptor->usCurrentStringLength++; - } + pStringDescriptor->usStringOffset++; + pStringDescriptor->usCurrentStringLength++; + } - if (pStringDescriptor->usStringOffset == pStringDescriptor->usMaxStringLength) - { - // - // Hum the current string has no null terminator. Invalidate the string and - // start from scratch - // + if (pStringDescriptor->usStringOffset == pStringDescriptor->usMaxStringLength) + { + // + // Hum the current string has no null terminator. Invalidate the string and + // start from scratch + // - memset(pStringDescriptor->pString, 0, usLength * 2); - pStringDescriptor->usStringOffset = 0; - pStringDescriptor->usCurrentStringLength = 0; - } + memset(pStringDescriptor->pString, 0, usLength * 2); + pStringDescriptor->usStringOffset = 0; + pStringDescriptor->usCurrentStringLength = 0; + } - pStringDescriptor->fInsertMode = FALSE; - pStringDescriptor->fFocus = FALSE; - pStringDescriptor->pPreviousString = NULL; - pStringDescriptor->pNextString = NULL; + pStringDescriptor->fInsertMode = FALSE; + pStringDescriptor->fFocus = FALSE; + pStringDescriptor->pPreviousString = NULL; + pStringDescriptor->pNextString = NULL; - return pStringDescriptor; - } + return pStringDescriptor; + } } -void LinkPreviousString(StringInput *pCurrentString, StringInput *pPreviousString) +void LinkPreviousString(StringInput *pCurrentString, StringInput *pPreviousString) { - if (pCurrentString != NULL) - { - if (pCurrentString->pPreviousString != NULL) - { - pCurrentString->pPreviousString->pNextString = NULL; - } + if (pCurrentString != NULL) + { + if (pCurrentString->pPreviousString != NULL) + { + pCurrentString->pPreviousString->pNextString = NULL; + } - pCurrentString->pPreviousString = pPreviousString; + pCurrentString->pPreviousString = pPreviousString; - if (pPreviousString != NULL) - { - pPreviousString->pNextString = pCurrentString; - } - } + if (pPreviousString != NULL) + { + pPreviousString->pNextString = pCurrentString; + } + } } -void LinkNextString(StringInput *pCurrentString, StringInput *pNextString) +void LinkNextString(StringInput *pCurrentString, StringInput *pNextString) { - if (pCurrentString != NULL) - { - if (pCurrentString->pNextString != NULL) - { - pCurrentString->pNextString->pPreviousString = NULL; - } + if (pCurrentString != NULL) + { + if (pCurrentString->pNextString != NULL) + { + pCurrentString->pNextString->pPreviousString = NULL; + } - pCurrentString->pNextString = pNextString; + pCurrentString->pNextString = pNextString; - if (pNextString != NULL) - { - pNextString->pPreviousString = pCurrentString; - } - } + if (pNextString != NULL) + { + pNextString->pPreviousString = pCurrentString; + } + } } BOOLEAN CharacterIsValid(UINT16 usCharacter, UINT16 *pFilter) { - UINT32 uiIndex, uiEndIndex; + UINT32 uiIndex, uiEndIndex; - if (pFilter != NULL) - { - uiEndIndex = *pFilter; - for (uiIndex = 1; uiIndex <= *pFilter; uiIndex++) - { - if (usCharacter == *(pFilter + uiIndex)) - { - return TRUE; - } - } - return FALSE; - } + if (pFilter != NULL) + { + uiEndIndex = *pFilter; + for (uiIndex = 1; uiIndex <= *pFilter; uiIndex++) + { + if (usCharacter == *(pFilter + uiIndex)) + { + return TRUE; + } + } + return FALSE; + } - return TRUE; + return TRUE; } -void RedirectToString(UINT16 usInputCharacter) +void RedirectToString(UINT16 usInputCharacter) { - UINT16 usIndex; + UINT16 usIndex; - if (gpCurrentStringDescriptor != NULL) - { - // Handle the new character input - switch (usInputCharacter) - { - case ENTER - : // ENTER is pressed, the last character field should be set to ENTER - if (gpCurrentStringDescriptor->pNextString != NULL) - { - gpCurrentStringDescriptor->fFocus = FALSE; - gpCurrentStringDescriptor = gpCurrentStringDescriptor->pNextString; - gpCurrentStringDescriptor->fFocus = TRUE; - gpCurrentStringDescriptor->usLastCharacter = 0; - } - else - { - gpCurrentStringDescriptor->fFocus = FALSE; - gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; - gfCurrentStringInputState = FALSE; - } - break; - case ESC - : // ESC was pressed, the last character field should be set to ESC - gpCurrentStringDescriptor->fFocus = FALSE; - gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; - gfCurrentStringInputState = FALSE; - break; - case SHIFT_TAB - : // TAB was pressed, the last character field should be set to TAB - if (gpCurrentStringDescriptor->pPreviousString != NULL) - { - gpCurrentStringDescriptor->fFocus = FALSE; - gpCurrentStringDescriptor = gpCurrentStringDescriptor->pPreviousString; - gpCurrentStringDescriptor->fFocus = TRUE; - gpCurrentStringDescriptor->usLastCharacter = 0; - } - break; - case TAB - : // TAB was pressed, the last character field should be set to TAB - if (gpCurrentStringDescriptor->pNextString != NULL) - { - gpCurrentStringDescriptor->fFocus = FALSE; - gpCurrentStringDescriptor = gpCurrentStringDescriptor->pNextString; - gpCurrentStringDescriptor->fFocus = TRUE; - gpCurrentStringDescriptor->usLastCharacter = 0; - } - break; - case UPARROW - : // The UPARROW was pressed, the last character field should be set to UPARROW - if (gpCurrentStringDescriptor->pPreviousString != NULL) - { - gpCurrentStringDescriptor->fFocus = FALSE; - gpCurrentStringDescriptor = gpCurrentStringDescriptor->pPreviousString; - gpCurrentStringDescriptor->fFocus = TRUE; - gpCurrentStringDescriptor->usLastCharacter = 0; - } - break; - case DNARROW - : // The DNARROW was pressed, the last character field should be set to DNARROW - if (gpCurrentStringDescriptor->pNextString != NULL) - { - gpCurrentStringDescriptor->fFocus = FALSE; - gpCurrentStringDescriptor = gpCurrentStringDescriptor->pNextString; - gpCurrentStringDescriptor->fFocus = TRUE; - gpCurrentStringDescriptor->usLastCharacter = 0; - } - break; - case LEFTARROW - : // The LEFTARROW was pressed, move one character to the left - if (gpCurrentStringDescriptor->usStringOffset > 0) - { // Decrement the offset - gpCurrentStringDescriptor->usStringOffset--; - } - gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; - break; - case RIGHTARROW - : // The RIGHTARROW was pressed, move one character to the right - if (gpCurrentStringDescriptor->usStringOffset < gpCurrentStringDescriptor->usCurrentStringLength) - { // Ok we can move the cursor one up without going past the end of string - gpCurrentStringDescriptor->usStringOffset++; - } - gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; - break; - case BACKSPACE - : // Delete the character preceding the cursor - if (gpCurrentStringDescriptor->usStringOffset > 0) - { // Ok, we are not at the beginning of the string, so we may proceed - for (usIndex = gpCurrentStringDescriptor->usStringOffset; usIndex <= gpCurrentStringDescriptor->usCurrentStringLength; usIndex++) - { // Shift the characters one at a time - *(gpCurrentStringDescriptor->pString + usIndex - 1) = *(gpCurrentStringDescriptor->pString + usIndex); - } - gpCurrentStringDescriptor->usStringOffset--; - gpCurrentStringDescriptor->usCurrentStringLength--; - } + if (gpCurrentStringDescriptor != NULL) + { + // Handle the new character input + switch (usInputCharacter) + { + case ENTER + : // ENTER is pressed, the last character field should be set to ENTER + if (gpCurrentStringDescriptor->pNextString != NULL) + { + gpCurrentStringDescriptor->fFocus = FALSE; + gpCurrentStringDescriptor = gpCurrentStringDescriptor->pNextString; + gpCurrentStringDescriptor->fFocus = TRUE; + gpCurrentStringDescriptor->usLastCharacter = 0; + } + else + { + gpCurrentStringDescriptor->fFocus = FALSE; + gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; + gfCurrentStringInputState = FALSE; + } + break; + case ESC + : // ESC was pressed, the last character field should be set to ESC + gpCurrentStringDescriptor->fFocus = FALSE; + gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; + gfCurrentStringInputState = FALSE; + break; + case SHIFT_TAB + : // TAB was pressed, the last character field should be set to TAB + if (gpCurrentStringDescriptor->pPreviousString != NULL) + { + gpCurrentStringDescriptor->fFocus = FALSE; + gpCurrentStringDescriptor = gpCurrentStringDescriptor->pPreviousString; + gpCurrentStringDescriptor->fFocus = TRUE; + gpCurrentStringDescriptor->usLastCharacter = 0; + } + break; + case TAB + : // TAB was pressed, the last character field should be set to TAB + if (gpCurrentStringDescriptor->pNextString != NULL) + { + gpCurrentStringDescriptor->fFocus = FALSE; + gpCurrentStringDescriptor = gpCurrentStringDescriptor->pNextString; + gpCurrentStringDescriptor->fFocus = TRUE; + gpCurrentStringDescriptor->usLastCharacter = 0; + } + break; + case UPARROW + : // The UPARROW was pressed, the last character field should be set to UPARROW + if (gpCurrentStringDescriptor->pPreviousString != NULL) + { + gpCurrentStringDescriptor->fFocus = FALSE; + gpCurrentStringDescriptor = gpCurrentStringDescriptor->pPreviousString; + gpCurrentStringDescriptor->fFocus = TRUE; + gpCurrentStringDescriptor->usLastCharacter = 0; + } + break; + case DNARROW + : // The DNARROW was pressed, the last character field should be set to DNARROW + if (gpCurrentStringDescriptor->pNextString != NULL) + { + gpCurrentStringDescriptor->fFocus = FALSE; + gpCurrentStringDescriptor = gpCurrentStringDescriptor->pNextString; + gpCurrentStringDescriptor->fFocus = TRUE; + gpCurrentStringDescriptor->usLastCharacter = 0; + } + break; + case LEFTARROW + : // The LEFTARROW was pressed, move one character to the left + if (gpCurrentStringDescriptor->usStringOffset > 0) + { // Decrement the offset + gpCurrentStringDescriptor->usStringOffset--; + } + gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; + break; + case RIGHTARROW + : // The RIGHTARROW was pressed, move one character to the right + if (gpCurrentStringDescriptor->usStringOffset < gpCurrentStringDescriptor->usCurrentStringLength) + { // Ok we can move the cursor one up without going past the end of string + gpCurrentStringDescriptor->usStringOffset++; + } + gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; + break; + case BACKSPACE + : // Delete the character preceding the cursor + if (gpCurrentStringDescriptor->usStringOffset > 0) + { // Ok, we are not at the beginning of the string, so we may proceed + for (usIndex = gpCurrentStringDescriptor->usStringOffset; usIndex <= gpCurrentStringDescriptor->usCurrentStringLength; usIndex++) + { // Shift the characters one at a time + *(gpCurrentStringDescriptor->pString + usIndex - 1) = *(gpCurrentStringDescriptor->pString + usIndex); + } + gpCurrentStringDescriptor->usStringOffset--; + gpCurrentStringDescriptor->usCurrentStringLength--; + } - break; - case DEL - : // Delete the character which follows the cursor - if (gpCurrentStringDescriptor->usStringOffset < gpCurrentStringDescriptor->usCurrentStringLength) - { // Ok we are not at the end of the string, so we may proceed - for (usIndex = gpCurrentStringDescriptor->usStringOffset; usIndex < gpCurrentStringDescriptor->usCurrentStringLength; usIndex++) - { // Shift the characters one at a time - *(gpCurrentStringDescriptor->pString + usIndex) = *(gpCurrentStringDescriptor->pString + usIndex + 1); - } - gpCurrentStringDescriptor->usCurrentStringLength--; - } - gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; - break; - case INSERT - : // Toggle insert mode - if (gpCurrentStringDescriptor->fInsertMode == TRUE) - { - gpCurrentStringDescriptor->fInsertMode = FALSE; - } - else - { - gpCurrentStringDescriptor->fInsertMode = TRUE; - } - gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; - break; - case HOME - : // Go to the beginning of the input string - gpCurrentStringDescriptor->usStringOffset = 0 ; - gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; - break; + break; + case DEL + : // Delete the character which follows the cursor + if (gpCurrentStringDescriptor->usStringOffset < gpCurrentStringDescriptor->usCurrentStringLength) + { // Ok we are not at the end of the string, so we may proceed + for (usIndex = gpCurrentStringDescriptor->usStringOffset; usIndex < gpCurrentStringDescriptor->usCurrentStringLength; usIndex++) + { // Shift the characters one at a time + *(gpCurrentStringDescriptor->pString + usIndex) = *(gpCurrentStringDescriptor->pString + usIndex + 1); + } + gpCurrentStringDescriptor->usCurrentStringLength--; + } + gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; + break; + case INSERT + : // Toggle insert mode + if (gpCurrentStringDescriptor->fInsertMode == TRUE) + { + gpCurrentStringDescriptor->fInsertMode = FALSE; + } + else + { + gpCurrentStringDescriptor->fInsertMode = TRUE; + } + gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; + break; + case HOME + : // Go to the beginning of the input string + gpCurrentStringDescriptor->usStringOffset = 0 ; + gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; + break; #ifndef JA2 // Stupid definition causes problems with headers that use the keyword END -- DB case KEY_END #else case END #endif - : // Go to the end of the input string - gpCurrentStringDescriptor->usStringOffset = gpCurrentStringDescriptor->usCurrentStringLength; - gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; - break; - default - : // - // normal input - // - if (CharacterIsValid(usInputCharacter, gpCurrentStringDescriptor->pFilter) == TRUE) - { - if (gpCurrentStringDescriptor->fInsertMode == TRUE) - { // Before we can shift characters for the insert, we must make sure we have the space - if (gpCurrentStringDescriptor->usCurrentStringLength < (gpCurrentStringDescriptor->usMaxStringLength - 1)) - { // Before we can add a new character we must shift existing ones to for the insert - for (usIndex = gpCurrentStringDescriptor->usCurrentStringLength; usIndex > gpCurrentStringDescriptor->usStringOffset; usIndex--) - { // Shift the characters one at a time - *(gpCurrentStringDescriptor->pString + usIndex) = *(gpCurrentStringDescriptor->pString + usIndex - 1); - } - // Ok now we introduce the new character - *(gpCurrentStringDescriptor->pString + usIndex) = usInputCharacter; - gpCurrentStringDescriptor->usStringOffset++; - gpCurrentStringDescriptor->usCurrentStringLength++; - } - } - else - { - // Ok, add character to string (by overwriting) - if (gpCurrentStringDescriptor->usStringOffset < (gpCurrentStringDescriptor->usMaxStringLength - 1)) - { // Ok, we have not exceeded the maximum number of characters yet - *(gpCurrentStringDescriptor->pString + gpCurrentStringDescriptor->usStringOffset) = usInputCharacter; - gpCurrentStringDescriptor->usStringOffset++; - } - // Did we push back the current string length (i.e. add character to end of string) - if (gpCurrentStringDescriptor->usStringOffset > gpCurrentStringDescriptor->usCurrentStringLength) - { // Add a NULL character - *(gpCurrentStringDescriptor->pString + gpCurrentStringDescriptor->usStringOffset) = 0; - gpCurrentStringDescriptor->usCurrentStringLength++; - } - } - gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; - } - break; - } - } + : // Go to the end of the input string + gpCurrentStringDescriptor->usStringOffset = gpCurrentStringDescriptor->usCurrentStringLength; + gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; + break; + default + : // + // normal input + // + if (CharacterIsValid(usInputCharacter, gpCurrentStringDescriptor->pFilter) == TRUE) + { + if (gpCurrentStringDescriptor->fInsertMode == TRUE) + { // Before we can shift characters for the insert, we must make sure we have the space + if (gpCurrentStringDescriptor->usCurrentStringLength < (gpCurrentStringDescriptor->usMaxStringLength - 1)) + { // Before we can add a new character we must shift existing ones to for the insert + for (usIndex = gpCurrentStringDescriptor->usCurrentStringLength; usIndex > gpCurrentStringDescriptor->usStringOffset; usIndex--) + { // Shift the characters one at a time + *(gpCurrentStringDescriptor->pString + usIndex) = *(gpCurrentStringDescriptor->pString + usIndex - 1); + } + // Ok now we introduce the new character + *(gpCurrentStringDescriptor->pString + usIndex) = usInputCharacter; + gpCurrentStringDescriptor->usStringOffset++; + gpCurrentStringDescriptor->usCurrentStringLength++; + } + } + else + { + // Ok, add character to string (by overwriting) + if (gpCurrentStringDescriptor->usStringOffset < (gpCurrentStringDescriptor->usMaxStringLength - 1)) + { // Ok, we have not exceeded the maximum number of characters yet + *(gpCurrentStringDescriptor->pString + gpCurrentStringDescriptor->usStringOffset) = usInputCharacter; + gpCurrentStringDescriptor->usStringOffset++; + } + // Did we push back the current string length (i.e. add character to end of string) + if (gpCurrentStringDescriptor->usStringOffset > gpCurrentStringDescriptor->usCurrentStringLength) + { // Add a NULL character + *(gpCurrentStringDescriptor->pString + gpCurrentStringDescriptor->usStringOffset) = 0; + gpCurrentStringDescriptor->usCurrentStringLength++; + } + } + gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; + } + break; + } + } } UINT16 GetStringInputState(void) { - if (gpCurrentStringDescriptor != NULL) - { - return gpCurrentStringDescriptor->usLastCharacter; - } - else - { - return 0; - } + if (gpCurrentStringDescriptor != NULL) + { + return gpCurrentStringDescriptor->usLastCharacter; + } + else + { + return 0; + } } BOOLEAN StringInputHasFocus(void) { - return gfCurrentStringInputState; + return gfCurrentStringInputState; } BOOLEAN SetStringFocus(StringInput *pStringDescriptor) { - if (pStringDescriptor != NULL) - { - if (gpCurrentStringDescriptor != NULL) - { - gpCurrentStringDescriptor->fFocus = FALSE; - } - // Ok overide current entry - gfCurrentStringInputState = TRUE; - gpCurrentStringDescriptor = pStringDescriptor; - gpCurrentStringDescriptor->fFocus = TRUE; - gpCurrentStringDescriptor->usLastCharacter = 0; - return TRUE; - } - else - { - if (gpCurrentStringDescriptor != NULL) - { - gpCurrentStringDescriptor->fFocus = FALSE; - } - // Ok overide current entry - gfCurrentStringInputState = FALSE; - gpCurrentStringDescriptor = NULL; - return TRUE; - } + if (pStringDescriptor != NULL) + { + if (gpCurrentStringDescriptor != NULL) + { + gpCurrentStringDescriptor->fFocus = FALSE; + } + // Ok overide current entry + gfCurrentStringInputState = TRUE; + gpCurrentStringDescriptor = pStringDescriptor; + gpCurrentStringDescriptor->fFocus = TRUE; + gpCurrentStringDescriptor->usLastCharacter = 0; + return TRUE; + } + else + { + if (gpCurrentStringDescriptor != NULL) + { + gpCurrentStringDescriptor->fFocus = FALSE; + } + // Ok overide current entry + gfCurrentStringInputState = FALSE; + gpCurrentStringDescriptor = NULL; + return TRUE; + } } UINT16 GetCursorPositionInString(StringInput *pStringDescriptor) { - return pStringDescriptor->usStringOffset; + return pStringDescriptor->usStringOffset; } BOOLEAN StringHasFocus(StringInput *pStringDescriptor) { - if (pStringDescriptor != NULL) - { - return pStringDescriptor->fFocus; - } - else - { - return FALSE; - } + if (pStringDescriptor != NULL) + { + return pStringDescriptor->fFocus; + } + else + { + return FALSE; + } } void RestoreString(StringInput *pStringDescriptor) { - memcpy(pStringDescriptor->pString, pStringDescriptor->pOriginalString, pStringDescriptor->usMaxStringLength * 2); + memcpy(pStringDescriptor->pString, pStringDescriptor->pOriginalString, pStringDescriptor->usMaxStringLength * 2); - pStringDescriptor->usStringOffset = 0; - pStringDescriptor->usCurrentStringLength = 0; - while ((pStringDescriptor->usStringOffset < pStringDescriptor->usMaxStringLength)&&(*(pStringDescriptor->pString + pStringDescriptor->usStringOffset) != 0)) - { - // - // Find the last character in the string - // + pStringDescriptor->usStringOffset = 0; + pStringDescriptor->usCurrentStringLength = 0; + while ((pStringDescriptor->usStringOffset < pStringDescriptor->usMaxStringLength)&&(*(pStringDescriptor->pString + pStringDescriptor->usStringOffset) != 0)) + { + // + // Find the last character in the string + // - pStringDescriptor->usStringOffset++; - pStringDescriptor->usCurrentStringLength++; - } + pStringDescriptor->usStringOffset++; + pStringDescriptor->usCurrentStringLength++; + } - if (pStringDescriptor->usStringOffset == pStringDescriptor->usMaxStringLength) - { - // - // Hum the current string has no null terminator. Invalidate the string and - // start from scratch - // - memset(pStringDescriptor->pString, 0, pStringDescriptor->usMaxStringLength * 2); - pStringDescriptor->usStringOffset = 0; - pStringDescriptor->usCurrentStringLength = 0; - } + if (pStringDescriptor->usStringOffset == pStringDescriptor->usMaxStringLength) + { + // + // Hum the current string has no null terminator. Invalidate the string and + // start from scratch + // + memset(pStringDescriptor->pString, 0, pStringDescriptor->usMaxStringLength * 2); + pStringDescriptor->usStringOffset = 0; + pStringDescriptor->usCurrentStringLength = 0; + } - pStringDescriptor->fInsertMode = FALSE; + pStringDescriptor->fInsertMode = FALSE; } void EndStringInput(StringInput *pStringDescriptor) -{ // Make sure we have a valid pStringDescriptor - if (pStringDescriptor != NULL) - { // make sure the gpCurrentStringDescriptor is NULL if necessary - if (pStringDescriptor == gpCurrentStringDescriptor) - { - gpCurrentStringDescriptor = NULL; - gfCurrentStringInputState = FALSE; - } - // Make sure we have a valid string within the string descriptor - if (pStringDescriptor->pOriginalString != NULL) - { // free up the string - MemFree(pStringDescriptor->pOriginalString); - } - // free up the descriptor - MemFree(pStringDescriptor); - } +{ + // Make sure we have a valid pStringDescriptor + if (pStringDescriptor != NULL) + { // make sure the gpCurrentStringDescriptor is NULL if necessary + if (pStringDescriptor == gpCurrentStringDescriptor) + { + gpCurrentStringDescriptor = NULL; + gfCurrentStringInputState = FALSE; + } + // Make sure we have a valid string within the string descriptor + if (pStringDescriptor->pOriginalString != NULL) + { // free up the string + MemFree(pStringDescriptor->pOriginalString); + } + // free up the descriptor + MemFree(pStringDescriptor); + } } @@ -1528,9 +1532,9 @@ void RestrictMouseToXYXY(UINT16 usX1, UINT16 usY1, UINT16 usX2, UINT16 usY2) { SGPRect TempRect; - TempRect.iLeft = usX1; - TempRect.iTop = usY1; - TempRect.iRight = usX2; + TempRect.iLeft = usX1; + TempRect.iTop = usY1; + TempRect.iRight = usX2; TempRect.iBottom = usY2; RestrictMouseCursor(&TempRect); @@ -1538,26 +1542,26 @@ void RestrictMouseToXYXY(UINT16 usX1, UINT16 usY1, UINT16 usX2, UINT16 usY2) void RestrictMouseCursor(SGPRect *pRectangle) { - // Make a copy of our rect.... - memcpy( &gCursorClipRect, pRectangle, sizeof( gCursorClipRect ) ); - ClientToScreen( ghWindow, (LPPOINT)&gCursorClipRect); - ClientToScreen( ghWindow, ((LPPOINT)&gCursorClipRect)+1); - ClipCursor(&gCursorClipRect); + // Make a copy of our rect.... + memcpy( &gCursorClipRect, pRectangle, sizeof( gCursorClipRect ) ); + ClientToScreen( ghWindow, (LPPOINT)&gCursorClipRect); + ClientToScreen( ghWindow, ((LPPOINT)&gCursorClipRect)+1); + ClipCursor(&gCursorClipRect); fCursorWasClipped = TRUE; } void FreeMouseCursor(void) { - ClipCursor(NULL); + ClipCursor(NULL); fCursorWasClipped = FALSE; } void RestoreCursorClipRect( void ) { - if ( fCursorWasClipped ) - { - ClipCursor( &gCursorClipRect ); - } + if ( fCursorWasClipped ) + { + ClipCursor( &gCursorClipRect ); + } } void GetRestrictedClipCursor( SGPRect *pRectangle ) @@ -1578,9 +1582,9 @@ void SimulateMouseMovement( UINT32 uiNewXPos, UINT32 uiNewYPos ) FLOAT flNewXPos, flNewYPos; // Wizardry NOTE: This function currently doesn't quite work right for in any Windows resolution other than 640x480. - // mouse_event() uses your current Windows resolution to calculate the resulting x,y coordinates. So in order to get + // mouse_event() uses your current Windows resolution to calculate the resulting x,y coordinates. So in order to get // the right coordinates, you'd have to find out the current Windows resolution through a system call, and then do: - // uiNewXPos = uiNewXPos * SCREEN_WIDTH / WinScreenResX; + // uiNewXPos = uiNewXPos * SCREEN_WIDTH / WinScreenResX; // uiNewYPos = uiNewYPos * SCREEN_HEIGHT / WinScreenResY; // // JA2 doesn't have this problem, 'cause they use DirectDraw calls that change the Windows resolution properly. @@ -1594,7 +1598,7 @@ void SimulateMouseMovement( UINT32 uiNewXPos, UINT32 uiNewYPos ) mouse_event( MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, (UINT32)flNewXPos, (UINT32)flNewYPos, 0, 0 ); #endif // 0verhaul: - // The above is a bad hack. Especially in windowed mode. We don't want coords relative to the entire screen in that case. + // The above is a bad hack. Especially in windowed mode. We don't want coords relative to the entire screen in that case. // So instead, get screen coords and then use the setcursorpos call. POINT newmouse; newmouse.x = uiNewXPos; @@ -1607,19 +1611,19 @@ void SimulateMouseMovement( UINT32 uiNewXPos, UINT32 uiNewYPos ) BOOLEAN InputEventInside(InputAtom *Event, UINT32 uiX1, UINT32 uiY1, UINT32 uiX2, UINT32 uiY2) { - UINT32 uiEventX, uiEventY; + UINT32 uiEventX, uiEventY; - uiEventX = _EvMouseX(Event); - uiEventY = _EvMouseY(Event); + uiEventX = _EvMouseX(Event); + uiEventY = _EvMouseY(Event); - return((uiEventX >= uiX1) && (uiEventX <= uiX2) && (uiEventY >= uiY1) && (uiEventY <= uiY2)); + return((uiEventX >= uiX1) && (uiEventX <= uiX2) && (uiEventY >= uiY1) && (uiEventY <= uiY2)); } void DequeueAllKeyBoardEvents() { - InputAtom InputEvent; - MSG KeyMessage; + InputAtom InputEvent; + MSG KeyMessage; //dequeue all the events waiting in the windows queue @@ -1633,7 +1637,7 @@ void DequeueAllKeyBoardEvents() //Now deque all the events waiting in the SGP queue //Including those that were just posted in the code above while (DequeueEvent(&InputEvent) == TRUE) - { + { //dont do anything } } @@ -1642,51 +1646,51 @@ void DequeueAllKeyBoardEvents() void HandleSingleClicksAndButtonRepeats( void ) { - UINT32 uiTimer; + UINT32 uiTimer; - uiTimer = GetTickCount(); + uiTimer = GetTickCount(); - // Is there a LEFT mouse button repeat - if (gfLeftButtonState) - { - if ((guiLeftButtonRepeatTimer > 0)&&(guiLeftButtonRepeatTimer <= uiTimer)) - { - UINT32 uiTmpLParam; - POINT MousePos; + // Is there a LEFT mouse button repeat + if (gfLeftButtonState) + { + if ((guiLeftButtonRepeatTimer > 0)&&(guiLeftButtonRepeatTimer <= uiTimer)) + { + UINT32 uiTmpLParam; + POINT MousePos; - GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! - uiTmpLParam = ((MousePos.y << 16) & 0xffff0000) | (MousePos.x & 0x0000ffff); - QueueEvent(LEFT_BUTTON_REPEAT, 0, uiTmpLParam); - guiLeftButtonRepeatTimer = uiTimer + BUTTON_REPEAT_TIME; - } - } - else - { - guiLeftButtonRepeatTimer = 0; - } + GetCursorPos(&MousePos); + ScreenToClient(ghWindow, &MousePos); // In window coords! + uiTmpLParam = ((MousePos.y << 16) & 0xffff0000) | (MousePos.x & 0x0000ffff); + QueueEvent(LEFT_BUTTON_REPEAT, 0, uiTmpLParam); + guiLeftButtonRepeatTimer = uiTimer + BUTTON_REPEAT_TIME; + } + } + else + { + guiLeftButtonRepeatTimer = 0; + } // Is there a RIGHT mouse button repeat if (gfRightButtonState) - { - if ((guiRightButtonRepeatTimer > 0)&&(guiRightButtonRepeatTimer <= uiTimer)) - { - UINT32 uiTmpLParam; - POINT MousePos; + { + if ((guiRightButtonRepeatTimer > 0)&&(guiRightButtonRepeatTimer <= uiTimer)) + { + UINT32 uiTmpLParam; + POINT MousePos; - GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! - uiTmpLParam = ((MousePos.y << 16) & 0xffff0000) | (MousePos.x & 0x0000ffff); - QueueEvent(RIGHT_BUTTON_REPEAT, 0, uiTmpLParam); - guiRightButtonRepeatTimer = uiTimer + BUTTON_REPEAT_TIME; - } - } - else - { - guiRightButtonRepeatTimer = 0; - } + GetCursorPos(&MousePos); + ScreenToClient(ghWindow, &MousePos); // In window coords! + uiTmpLParam = ((MousePos.y << 16) & 0xffff0000) | (MousePos.x & 0x0000ffff); + QueueEvent(RIGHT_BUTTON_REPEAT, 0, uiTmpLParam); + guiRightButtonRepeatTimer = uiTimer + BUTTON_REPEAT_TIME; + } + } + else + { + guiRightButtonRepeatTimer = 0; + } } diff --git a/Standard Gaming Platform/input.h b/Standard Gaming Platform/input.h index 74d19945..5ff5b5b4 100644 --- a/Standard Gaming Platform/input.h +++ b/Standard Gaming Platform/input.h @@ -25,17 +25,17 @@ #define ALT_DOWN 0x04 #define MAX_STRING_INPUT 64 -#define DBL_CLK_TIME 300 // Increased by Alex, Jun-10-97, 200 felt too short +#define DBL_CLK_TIME 300 // Increased by Alex, Jun-10-97, 200 felt too short #define BUTTON_REPEAT_TIMEOUT 250 #define BUTTON_REPEAT_TIME 50 typedef struct { - UINT32 uiTimeStamp; - UINT16 usKeyState; - UINT16 usEvent; - UINT32 usParam; - UINT32 uiParam; + UINT32 uiTimeStamp; + UINT16 usKeyState; + UINT16 usEvent; + UINT32 usParam; + UINT32 uiParam; } InputAtom; @@ -46,17 +46,17 @@ typedef struct typedef struct StringInput { - UINT16 *pString; - UINT16 *pOriginalString; - UINT16 *pFilter; - UINT16 usMaxStringLength; - UINT16 usCurrentStringLength; - UINT16 usStringOffset; - UINT16 usLastCharacter; - BOOLEAN fInsertMode; - BOOLEAN fFocus; - struct StringInput *pPreviousString; - struct StringInput *pNextString; + UINT16 *pString; + UINT16 *pOriginalString; + UINT16 *pFilter; + UINT16 usMaxStringLength; + UINT16 usCurrentStringLength; + UINT16 usStringOffset; + UINT16 usLastCharacter; + BOOLEAN fInsertMode; + BOOLEAN fFocus; + struct StringInput *pPreviousString; + struct StringInput *pNextString; } StringInput; @@ -77,16 +77,16 @@ extern void DisableDoubleClk(void); extern void GetMousePos(SGPPoint *Point); extern StringInput *InitStringInput(UINT16 *pInputString, UINT16 usLength, UINT16 *pFilter); -extern void LinkPreviousString(StringInput *pCurrentString, StringInput *pPreviousString); -extern void LinkNextString(StringInput *pCurrentString, StringInput *pNextString); -extern UINT16 GetStringLastInput(void); -extern BOOLEAN StringInputHasFocus(void); -extern BOOLEAN SetStringFocus(StringInput *pStringDescriptor); -extern UINT16 GetCursorPositionInString(StringInput *pStringDescriptor); -extern UINT16 GetStringInputState(void); -extern BOOLEAN StringHasFocus(StringInput *pStringDescriptor); -extern UINT16 *GetString(StringInput *pStringDescriptor); -extern void EndStringInput(StringInput *pStringDescriptor); +extern void LinkPreviousString(StringInput *pCurrentString, StringInput *pPreviousString); +extern void LinkNextString(StringInput *pCurrentString, StringInput *pNextString); +extern UINT16 GetStringLastInput(void); +extern BOOLEAN StringInputHasFocus(void); +extern BOOLEAN SetStringFocus(StringInput *pStringDescriptor); +extern UINT16 GetCursorPositionInString(StringInput *pStringDescriptor); +extern UINT16 GetStringInputState(void); +extern BOOLEAN StringHasFocus(StringInput *pStringDescriptor); +extern UINT16 *GetString(StringInput *pStringDescriptor); +extern void EndStringInput(StringInput *pStringDescriptor); extern BOOLEAN DequeueSpecificEvent(InputAtom *Event, UINT32 uiMaskFlags ); extern void RestrictMouseToXYXY(UINT16 usX1, UINT16 usY1, UINT16 usX2, UINT16 usY2); @@ -94,7 +94,7 @@ extern void RestrictMouseCursor(SGPRect *pRectangle); extern void FreeMouseCursor(void); extern BOOLEAN IsCursorRestricted( void ); extern void GetRestrictedClipCursor( SGPRect *pRectangle ); -extern void RestoreCursorClipRect( void ); +extern void RestoreCursorClipRect( void ); void SimulateMouseMovement( UINT32 uiNewXPos, UINT32 uiNewYPos ); @@ -105,33 +105,33 @@ INT16 GetMouseWheelDeltaValue( UINT32 wParam ); extern void DequeueAllKeyBoardEvents(); -extern BOOLEAN gfKeyState[256]; // TRUE = Pressed, FALSE = Not Pressed +extern BOOLEAN gfKeyState[256]; // TRUE = Pressed, FALSE = Not Pressed -extern INT16 gusMouseXPos; // X position of the mouse on screen -extern INT16 gusMouseYPos; // y position of the mouse on screen -extern BOOLEAN gfLeftButtonState; // TRUE = Pressed, FALSE = Not Pressed -extern BOOLEAN gfRightButtonState; // TRUE = Pressed, FALSE = Not Pressed +extern INT16 gusMouseXPos; // X position of the mouse on screen +extern INT16 gusMouseYPos; // y position of the mouse on screen +extern BOOLEAN gfLeftButtonState; // TRUE = Pressed, FALSE = Not Pressed +extern BOOLEAN gfRightButtonState; // TRUE = Pressed, FALSE = Not Pressed extern BOOLEAN gfSGPInputReceived; -#define _KeyDown(a) gfKeyState[(a)] -#define _LeftButtonDown gfLeftButtonState -#define _RightButtonDown gfRightButtonState -#define _MouseXPos gusMouseXPos -#define _MouseYPos gusMouseYPos +#define _KeyDown(a) gfKeyState[(a)] +#define _LeftButtonDown gfLeftButtonState +#define _RightButtonDown gfRightButtonState +#define _MouseXPos gusMouseXPos +#define _MouseYPos gusMouseYPos // NOTE: this may not be the absolute most-latest current mouse co-ordinates, use GetCursorPos for that -#define _gusMouseInside(x1,y1,x2,y2) ((gusMouseXPos >= x1) && (gusMouseXPos <= x2) && (gusMouseYPos >= y1) && (gusMouseYPos <= y2)) +#define _gusMouseInside(x1,y1,x2,y2) ((gusMouseXPos >= x1) && (gusMouseXPos <= x2) && (gusMouseYPos >= y1) && (gusMouseYPos <= y2)) -#define _EvType(a) ((InputAtom *)(a))->usEvent -#define _EvTimeStamp(a) ((InputAtom *)(a))->uiTimeStamp -#define _EvKey(a) ((InputAtom *)(a))->usParam -#define _EvMouseX(a) (UINT16)(((InputAtom *)(a))->uiParam & 0x0000ffff) -#define _EvMouseY(a) (UINT16)((((InputAtom *)(a))->uiParam & 0xffff0000) >> 16) -#define _EvShiftDown(a) (((InputAtom *)(a))->usKeyState & SHIFT_DOWN) -#define _EvCtrlDown(a) (((InputAtom *)(a))->usKeyState & CTRL_DOWN) -#define _EvAltDown(a) (((InputAtom *)(a))->usKeyState & ALT_DOWN) +#define _EvType(a) ((InputAtom *)(a))->usEvent +#define _EvTimeStamp(a) ((InputAtom *)(a))->uiTimeStamp +#define _EvKey(a) ((InputAtom *)(a))->usParam +#define _EvMouseX(a) (UINT16)(((InputAtom *)(a))->uiParam & 0x0000ffff) +#define _EvMouseY(a) (UINT16)((((InputAtom *)(a))->uiParam & 0xffff0000) >> 16) +#define _EvShiftDown(a) (((InputAtom *)(a))->usKeyState & SHIFT_DOWN) +#define _EvCtrlDown(a) (((InputAtom *)(a))->usKeyState & CTRL_DOWN) +#define _EvAltDown(a) (((InputAtom *)(a))->usKeyState & ALT_DOWN) #ifdef __cplusplus } diff --git a/Standard Gaming Platform/line.cpp b/Standard Gaming Platform/line.cpp index 3724dccb..877d92d7 100644 --- a/Standard Gaming Platform/line.cpp +++ b/Standard Gaming Platform/line.cpp @@ -16,7 +16,7 @@ // SetClippingRegionAndImageWidth( uiPitch, 15, 15, 30, 30 ); // // LineDraw( TRUE, 10, 10, 200, 200, colour, pImageData); -// OR +// OR // RectangleDraw( TRUE, 10, 10, 200, 200, colour, pImageData); //************************************************************************** @@ -32,14 +32,14 @@ int giClipYMin=0; int giClipYMax=0; void DrawHorizontalRun(UINT8 **ScreenPtr, int XAdvance, int RunLength, - int Color, int ScreenWidth); + int Color, int ScreenWidth); void DrawVerticalRun(UINT8 **ScreenPtr, int XAdvance, int RunLength, - int Color, int ScreenWidth); + int Color, int ScreenWidth); void DrawHorizontalRun8(UINT8 **ScreenPtr, int XAdvance, - int RunLength, int Color, int ScreenWidth); + int RunLength, int Color, int ScreenWidth); void DrawVerticalRun8(UINT8 **ScreenPtr, int XAdvance, - int RunLength, int Color, int ScreenWidth); + int RunLength, int Color, int ScreenWidth); void SetClippingRegionAndImageWidth( @@ -88,7 +88,7 @@ BOOL Clipt( FLOAT denom, FLOAT num, FLOAT *tE, FLOAT *tL ) BOOL ClipPoint( int x, int y ) { - return( x <= giClipXMax && x >= giClipXMin && + return( x <= giClipXMax && x >= giClipXMin && y <= giClipYMax && y >= giClipYMin ); } @@ -225,128 +225,128 @@ void LineDraw( BOOL fClip, int XStart, int YStart, int XEnd, int YEnd, short Col return; } - /* Determine whether the line is X or Y major, and handle accordingly */ - if (XDelta >= YDelta) - { - /* X major line */ - /* Minimum # of pixels in a run in this line */ - WholeStep = XDelta / YDelta; + /* Determine whether the line is X or Y major, and handle accordingly */ + if (XDelta >= YDelta) + { + /* X major line */ + /* Minimum # of pixels in a run in this line */ + WholeStep = XDelta / YDelta; - /* Error term adjust each time Y steps by 1; used to tell when one - extra pixel should be drawn as part of a run, to account for - fractional steps along the X axis per 1-pixel steps along Y */ - AdjUp = (XDelta % YDelta) * 2; + /* Error term adjust each time Y steps by 1; used to tell when one + extra pixel should be drawn as part of a run, to account for + fractional steps along the X axis per 1-pixel steps along Y */ + AdjUp = (XDelta % YDelta) * 2; - /* Error term adjust when the error term turns over, used to factor - out the X step made at that time */ - AdjDown = YDelta * 2; + /* Error term adjust when the error term turns over, used to factor + out the X step made at that time */ + AdjDown = YDelta * 2; - /* Initial error term; reflects an initial step of 0.5 along the Y - axis */ - ErrorTerm = (XDelta % YDelta) - (YDelta * 2); + /* Initial error term; reflects an initial step of 0.5 along the Y + axis */ + ErrorTerm = (XDelta % YDelta) - (YDelta * 2); - /* The initial and last runs are partial, because Y advances only 0.5 - for these runs, rather than 1. Divide one full run, plus the - initial pixel, between the initial and last runs */ - InitialPixelCount = (WholeStep / 2) + 1; - FinalPixelCount = InitialPixelCount; + /* The initial and last runs are partial, because Y advances only 0.5 + for these runs, rather than 1. Divide one full run, plus the + initial pixel, between the initial and last runs */ + InitialPixelCount = (WholeStep / 2) + 1; + FinalPixelCount = InitialPixelCount; - /* If the basic run length is even and there's no fractional - advance, we have one pixel that could go to either the initial - or last partial run, which we'll arbitrarily allocate to the - last run */ - if ((AdjUp == 0) && ((WholeStep & 0x01) == 0)) - { - InitialPixelCount--; - } - /* If there're an odd number of pixels per run, we have 1 pixel that can't - be allocated to either the initial or last partial run, so we'll add 0.5 - to error term so this pixel will be handled by the normal full-run loop */ - if ((WholeStep & 0x01) != 0) - { - ErrorTerm += YDelta; - } - /* Draw the first, partial run of pixels */ - DrawHorizontalRun(&ScreenPtr, XAdvance, InitialPixelCount, Color, ScreenWidth); - /* Draw all full runs */ - for (i=0; i<(YDelta-1); i++) - { - RunLength = WholeStep; /* run is at least this long */ - /* Advance the error term and add an extra pixel if the error - term so indicates */ - if ((ErrorTerm += AdjUp) > 0) - { - RunLength++; - ErrorTerm -= AdjDown; /* reset the error term */ - } - /* Draw this scan line's run */ - DrawHorizontalRun(&ScreenPtr, XAdvance, RunLength, Color, ScreenWidth); - } - /* Draw the final run of pixels */ - DrawHorizontalRun(&ScreenPtr, XAdvance, FinalPixelCount, Color, ScreenWidth); - return; - } - else - { - /* Y major line */ + /* If the basic run length is even and there's no fractional + advance, we have one pixel that could go to either the initial + or last partial run, which we'll arbitrarily allocate to the + last run */ + if ((AdjUp == 0) && ((WholeStep & 0x01) == 0)) + { + InitialPixelCount--; + } + /* If there're an odd number of pixels per run, we have 1 pixel that can't + be allocated to either the initial or last partial run, so we'll add 0.5 + to error term so this pixel will be handled by the normal full-run loop */ + if ((WholeStep & 0x01) != 0) + { + ErrorTerm += YDelta; + } + /* Draw the first, partial run of pixels */ + DrawHorizontalRun(&ScreenPtr, XAdvance, InitialPixelCount, Color, ScreenWidth); + /* Draw all full runs */ + for (i=0; i<(YDelta-1); i++) + { + RunLength = WholeStep; /* run is at least this long */ + /* Advance the error term and add an extra pixel if the error + term so indicates */ + if ((ErrorTerm += AdjUp) > 0) + { + RunLength++; + ErrorTerm -= AdjDown; /* reset the error term */ + } + /* Draw this scan line's run */ + DrawHorizontalRun(&ScreenPtr, XAdvance, RunLength, Color, ScreenWidth); + } + /* Draw the final run of pixels */ + DrawHorizontalRun(&ScreenPtr, XAdvance, FinalPixelCount, Color, ScreenWidth); + return; + } + else + { + /* Y major line */ - /* Minimum # of pixels in a run in this line */ - WholeStep = YDelta / XDelta; + /* Minimum # of pixels in a run in this line */ + WholeStep = YDelta / XDelta; - /* Error term adjust each time X steps by 1; used to tell when 1 extra - pixel should be drawn as part of a run, to account for - fractional steps along the Y axis per 1-pixel steps along X */ - AdjUp = (YDelta % XDelta) * 2; + /* Error term adjust each time X steps by 1; used to tell when 1 extra + pixel should be drawn as part of a run, to account for + fractional steps along the Y axis per 1-pixel steps along X */ + AdjUp = (YDelta % XDelta) * 2; - /* Error term adjust when the error term turns over, used to factor - out the Y step made at that time */ - AdjDown = XDelta * 2; + /* Error term adjust when the error term turns over, used to factor + out the Y step made at that time */ + AdjDown = XDelta * 2; - /* Initial error term; reflects initial step of 0.5 along the X axis */ - ErrorTerm = (YDelta % XDelta) - (XDelta * 2); + /* Initial error term; reflects initial step of 0.5 along the X axis */ + ErrorTerm = (YDelta % XDelta) - (XDelta * 2); - /* The initial and last runs are partial, because X advances only 0.5 - for these runs, rather than 1. Divide one full run, plus the - initial pixel, between the initial and last runs */ - InitialPixelCount = (WholeStep / 2) + 1; - FinalPixelCount = InitialPixelCount; + /* The initial and last runs are partial, because X advances only 0.5 + for these runs, rather than 1. Divide one full run, plus the + initial pixel, between the initial and last runs */ + InitialPixelCount = (WholeStep / 2) + 1; + FinalPixelCount = InitialPixelCount; - /* If the basic run length is even and there's no fractional advance, we - have 1 pixel that could go to either the initial or last partial run, - which we'll arbitrarily allocate to the last run */ - if ((AdjUp == 0) && ((WholeStep & 0x01) == 0)) - { - InitialPixelCount--; - } - /* If there are an odd number of pixels per run, we have one pixel - that can't be allocated to either the initial or last partial - run, so we'll add 0.5 to the error term so this pixel will be - handled by the normal full-run loop */ - if ((WholeStep & 0x01) != 0) - { - ErrorTerm += XDelta; - } - /* Draw the first, partial run of pixels */ - DrawVerticalRun(&ScreenPtr, XAdvance, InitialPixelCount, Color, ScreenWidth); + /* If the basic run length is even and there's no fractional advance, we + have 1 pixel that could go to either the initial or last partial run, + which we'll arbitrarily allocate to the last run */ + if ((AdjUp == 0) && ((WholeStep & 0x01) == 0)) + { + InitialPixelCount--; + } + /* If there are an odd number of pixels per run, we have one pixel + that can't be allocated to either the initial or last partial + run, so we'll add 0.5 to the error term so this pixel will be + handled by the normal full-run loop */ + if ((WholeStep & 0x01) != 0) + { + ErrorTerm += XDelta; + } + /* Draw the first, partial run of pixels */ + DrawVerticalRun(&ScreenPtr, XAdvance, InitialPixelCount, Color, ScreenWidth); - /* Draw all full runs */ - for (i=0; i<(XDelta-1); i++) - { - RunLength = WholeStep; /* run is at least this long */ - /* Advance the error term and add an extra pixel if the error - term so indicates */ - if ((ErrorTerm += AdjUp) > 0) - { - RunLength++; - ErrorTerm -= AdjDown; /* reset the error term */ - } - /* Draw this scan line's run */ - DrawVerticalRun(&ScreenPtr, XAdvance, RunLength, Color, ScreenWidth); - } - /* Draw the final run of pixels */ - DrawVerticalRun(&ScreenPtr, XAdvance, FinalPixelCount, Color, ScreenWidth); - return; - } + /* Draw all full runs */ + for (i=0; i<(XDelta-1); i++) + { + RunLength = WholeStep; /* run is at least this long */ + /* Advance the error term and add an extra pixel if the error + term so indicates */ + if ((ErrorTerm += AdjUp) > 0) + { + RunLength++; + ErrorTerm -= AdjDown; /* reset the error term */ + } + /* Draw this scan line's run */ + DrawVerticalRun(&ScreenPtr, XAdvance, RunLength, Color, ScreenWidth); + } + /* Draw the final run of pixels */ + DrawVerticalRun(&ScreenPtr, XAdvance, FinalPixelCount, Color, ScreenWidth); + return; + } } //Draws a pixel in the specified color @@ -369,9 +369,9 @@ void PixelDraw( BOOLEAN fClip, INT32 xp, INT32 yp, INT16 sColor, UINT8 *pScreen } /* Draws a horizontal run of pixels, then advances the bitmap pointer to - the first pixel of the next run. */ + the first pixel of the next run. */ void DrawHorizontalRun(UINT8 **ScreenPtr, int XAdvance, - int RunLength, int Color, int ScreenWidth) + int RunLength, int Color, int ScreenWidth) { int i; UINT8 *WorkingScreenPtr = *ScreenPtr; @@ -390,9 +390,9 @@ void DrawHorizontalRun(UINT8 **ScreenPtr, int XAdvance, } /* Draws a vertical run of pixels, then advances the bitmap pointer to - the first pixel of the next run. */ + the first pixel of the next run. */ void DrawVerticalRun(UINT8 **ScreenPtr, int XAdvance, - int RunLength, int Color, int ScreenWidth) + int RunLength, int Color, int ScreenWidth) { int i; UINT8 *WorkingScreenPtr = *ScreenPtr; @@ -414,10 +414,10 @@ void DrawVerticalRun(UINT8 **ScreenPtr, int XAdvance, /* Draws a rectangle between the specified endpoints in color Color. */ void RectangleDraw( BOOL fClip, int XStart, int YStart, int XEnd, int YEnd, short Color, UINT8 *ScreenPtr) { - LineDraw( fClip, XStart, YStart, XEnd, YStart, Color, ScreenPtr); - LineDraw( fClip, XStart, YEnd, XEnd, YEnd, Color, ScreenPtr); - LineDraw( fClip, XStart, YStart, XStart, YEnd, Color, ScreenPtr); - LineDraw( fClip, XEnd, YStart, XEnd, YEnd, Color, ScreenPtr); + LineDraw( fClip, XStart, YStart, XEnd, YStart, Color, ScreenPtr); + LineDraw( fClip, XStart, YEnd, XEnd, YEnd, Color, ScreenPtr); + LineDraw( fClip, XStart, YStart, XStart, YEnd, Color, ScreenPtr); + LineDraw( fClip, XEnd, YStart, XEnd, YEnd, Color, ScreenPtr); } /*********************************************************************************** @@ -431,10 +431,10 @@ void RectangleDraw( BOOL fClip, int XStart, int YStart, int XEnd, int YEnd, shor /* Draws a rectangle between the specified endpoints in color Color. */ void RectangleDraw8( BOOL fClip, int XStart, int YStart, int XEnd, int YEnd, short Color, UINT8 *ScreenPtr) { - LineDraw8( fClip, XStart, YStart, XEnd, YStart, Color, ScreenPtr); - LineDraw8( fClip, XStart, YEnd, XEnd, YEnd, Color, ScreenPtr); - LineDraw8( fClip, XStart, YStart, XStart, YEnd, Color, ScreenPtr); - LineDraw8( fClip, XEnd, YStart, XEnd, YEnd, Color, ScreenPtr); + LineDraw8( fClip, XStart, YStart, XEnd, YStart, Color, ScreenPtr); + LineDraw8( fClip, XStart, YEnd, XEnd, YEnd, Color, ScreenPtr); + LineDraw8( fClip, XStart, YStart, XStart, YEnd, Color, ScreenPtr); + LineDraw8( fClip, XEnd, YStart, XEnd, YEnd, Color, ScreenPtr); } /* Draws a line between the specified endpoints in color Color. */ @@ -443,7 +443,6 @@ void LineDraw8( BOOL fClip, int XStart, int YStart, int XEnd, int YEnd, short Co int Temp, AdjUp, AdjDown, ErrorTerm, XAdvance, XDelta, YDelta; int WholeStep, InitialPixelCount, FinalPixelCount, i, RunLength; int ScreenWidth = giImageWidth; - UINT8 col2 = Color>>8; UINT8 col1 = Color & 0x00FF; if ( fClip ) @@ -513,139 +512,138 @@ void LineDraw8( BOOL fClip, int XStart, int YStart, int XEnd, int YEnd, short Co return; } - /* Determine whether the line is X or Y major, and handle accordingly */ - if (XDelta >= YDelta) - { - /* X major line */ - /* Minimum # of pixels in a run in this line */ - WholeStep = XDelta / YDelta; + /* Determine whether the line is X or Y major, and handle accordingly */ + if (XDelta >= YDelta) + { + /* X major line */ + /* Minimum # of pixels in a run in this line */ + WholeStep = XDelta / YDelta; - /* Error term adjust each time Y steps by 1; used to tell when one - extra pixel should be drawn as part of a run, to account for - fractional steps along the X axis per 1-pixel steps along Y */ - AdjUp = (XDelta % YDelta) * 2; + /* Error term adjust each time Y steps by 1; used to tell when one + extra pixel should be drawn as part of a run, to account for + fractional steps along the X axis per 1-pixel steps along Y */ + AdjUp = (XDelta % YDelta) * 2; - /* Error term adjust when the error term turns over, used to factor - out the X step made at that time */ - AdjDown = YDelta * 2; + /* Error term adjust when the error term turns over, used to factor + out the X step made at that time */ + AdjDown = YDelta * 2; - /* Initial error term; reflects an initial step of 0.5 along the Y - axis */ - ErrorTerm = (XDelta % YDelta) - (YDelta * 2); + /* Initial error term; reflects an initial step of 0.5 along the Y + axis */ + ErrorTerm = (XDelta % YDelta) - (YDelta * 2); - /* The initial and last runs are partial, because Y advances only 0.5 - for these runs, rather than 1. Divide one full run, plus the - initial pixel, between the initial and last runs */ - InitialPixelCount = (WholeStep / 2) + 1; - FinalPixelCount = InitialPixelCount; + /* The initial and last runs are partial, because Y advances only 0.5 + for these runs, rather than 1. Divide one full run, plus the + initial pixel, between the initial and last runs */ + InitialPixelCount = (WholeStep / 2) + 1; + FinalPixelCount = InitialPixelCount; - /* If the basic run length is even and there's no fractional - advance, we have one pixel that could go to either the initial - or last partial run, which we'll arbitrarily allocate to the - last run */ - if ((AdjUp == 0) && ((WholeStep & 0x01) == 0)) - { - InitialPixelCount--; - } - /* If there're an odd number of pixels per run, we have 1 pixel that can't - be allocated to either the initial or last partial run, so we'll add 0.5 - to error term so this pixel will be handled by the normal full-run loop */ - if ((WholeStep & 0x01) != 0) - { - ErrorTerm += YDelta; - } - /* Draw the first, partial run of pixels */ - DrawHorizontalRun8(&ScreenPtr, XAdvance, InitialPixelCount, Color, ScreenWidth); - /* Draw all full runs */ - for (i=0; i<(YDelta-1); i++) - { - RunLength = WholeStep; /* run is at least this long */ - /* Advance the error term and add an extra pixel if the error - term so indicates */ - if ((ErrorTerm += AdjUp) > 0) - { - RunLength++; - ErrorTerm -= AdjDown; /* reset the error term */ - } - /* Draw this scan line's run */ - DrawHorizontalRun8(&ScreenPtr, XAdvance, RunLength, Color, ScreenWidth); - } - /* Draw the final run of pixels */ - DrawHorizontalRun8(&ScreenPtr, XAdvance, FinalPixelCount, Color, ScreenWidth); - return; - } - else - { - /* Y major line */ + /* If the basic run length is even and there's no fractional + advance, we have one pixel that could go to either the initial + or last partial run, which we'll arbitrarily allocate to the + last run */ + if ((AdjUp == 0) && ((WholeStep & 0x01) == 0)) + { + InitialPixelCount--; + } + /* If there're an odd number of pixels per run, we have 1 pixel that can't + be allocated to either the initial or last partial run, so we'll add 0.5 + to error term so this pixel will be handled by the normal full-run loop */ + if ((WholeStep & 0x01) != 0) + { + ErrorTerm += YDelta; + } + /* Draw the first, partial run of pixels */ + DrawHorizontalRun8(&ScreenPtr, XAdvance, InitialPixelCount, Color, ScreenWidth); + /* Draw all full runs */ + for (i=0; i<(YDelta-1); i++) + { + RunLength = WholeStep; /* run is at least this long */ + /* Advance the error term and add an extra pixel if the error + term so indicates */ + if ((ErrorTerm += AdjUp) > 0) + { + RunLength++; + ErrorTerm -= AdjDown; /* reset the error term */ + } + /* Draw this scan line's run */ + DrawHorizontalRun8(&ScreenPtr, XAdvance, RunLength, Color, ScreenWidth); + } + /* Draw the final run of pixels */ + DrawHorizontalRun8(&ScreenPtr, XAdvance, FinalPixelCount, Color, ScreenWidth); + return; + } + else + { + /* Y major line */ - /* Minimum # of pixels in a run in this line */ - WholeStep = YDelta / XDelta; + /* Minimum # of pixels in a run in this line */ + WholeStep = YDelta / XDelta; - /* Error term adjust each time X steps by 1; used to tell when 1 extra - pixel should be drawn as part of a run, to account for - fractional steps along the Y axis per 1-pixel steps along X */ - AdjUp = (YDelta % XDelta) * 2; + /* Error term adjust each time X steps by 1; used to tell when 1 extra + pixel should be drawn as part of a run, to account for + fractional steps along the Y axis per 1-pixel steps along X */ + AdjUp = (YDelta % XDelta) * 2; - /* Error term adjust when the error term turns over, used to factor - out the Y step made at that time */ - AdjDown = XDelta * 2; + /* Error term adjust when the error term turns over, used to factor + out the Y step made at that time */ + AdjDown = XDelta * 2; - /* Initial error term; reflects initial step of 0.5 along the X axis */ - ErrorTerm = (YDelta % XDelta) - (XDelta * 2); + /* Initial error term; reflects initial step of 0.5 along the X axis */ + ErrorTerm = (YDelta % XDelta) - (XDelta * 2); - /* The initial and last runs are partial, because X advances only 0.5 - for these runs, rather than 1. Divide one full run, plus the - initial pixel, between the initial and last runs */ - InitialPixelCount = (WholeStep / 2) + 1; - FinalPixelCount = InitialPixelCount; + /* The initial and last runs are partial, because X advances only 0.5 + for these runs, rather than 1. Divide one full run, plus the + initial pixel, between the initial and last runs */ + InitialPixelCount = (WholeStep / 2) + 1; + FinalPixelCount = InitialPixelCount; - /* If the basic run length is even and there's no fractional advance, we - have 1 pixel that could go to either the initial or last partial run, - which we'll arbitrarily allocate to the last run */ - if ((AdjUp == 0) && ((WholeStep & 0x01) == 0)) - { - InitialPixelCount--; - } - /* If there are an odd number of pixels per run, we have one pixel - that can't be allocated to either the initial or last partial - run, so we'll add 0.5 to the error term so this pixel will be - handled by the normal full-run loop */ - if ((WholeStep & 0x01) != 0) - { - ErrorTerm += XDelta; - } - /* Draw the first, partial run of pixels */ - DrawVerticalRun8(&ScreenPtr, XAdvance, InitialPixelCount, Color, ScreenWidth); + /* If the basic run length is even and there's no fractional advance, we + have 1 pixel that could go to either the initial or last partial run, + which we'll arbitrarily allocate to the last run */ + if ((AdjUp == 0) && ((WholeStep & 0x01) == 0)) + { + InitialPixelCount--; + } + /* If there are an odd number of pixels per run, we have one pixel + that can't be allocated to either the initial or last partial + run, so we'll add 0.5 to the error term so this pixel will be + handled by the normal full-run loop */ + if ((WholeStep & 0x01) != 0) + { + ErrorTerm += XDelta; + } + /* Draw the first, partial run of pixels */ + DrawVerticalRun8(&ScreenPtr, XAdvance, InitialPixelCount, Color, ScreenWidth); - /* Draw all full runs */ - for (i=0; i<(XDelta-1); i++) - { - RunLength = WholeStep; /* run is at least this long */ - /* Advance the error term and add an extra pixel if the error - term so indicates */ - if ((ErrorTerm += AdjUp) > 0) - { - RunLength++; - ErrorTerm -= AdjDown; /* reset the error term */ - } - /* Draw this scan line's run */ - DrawVerticalRun8(&ScreenPtr, XAdvance, RunLength, Color, ScreenWidth); - } - /* Draw the final run of pixels */ - DrawVerticalRun8(&ScreenPtr, XAdvance, FinalPixelCount, Color, ScreenWidth); - return; - } + /* Draw all full runs */ + for (i=0; i<(XDelta-1); i++) + { + RunLength = WholeStep; /* run is at least this long */ + /* Advance the error term and add an extra pixel if the error + term so indicates */ + if ((ErrorTerm += AdjUp) > 0) + { + RunLength++; + ErrorTerm -= AdjDown; /* reset the error term */ + } + /* Draw this scan line's run */ + DrawVerticalRun8(&ScreenPtr, XAdvance, RunLength, Color, ScreenWidth); + } + /* Draw the final run of pixels */ + DrawVerticalRun8(&ScreenPtr, XAdvance, FinalPixelCount, Color, ScreenWidth); + return; + } } /* Draws a horizontal run of pixels, then advances the bitmap pointer to - the first pixel of the next run. */ + the first pixel of the next run. */ void DrawHorizontalRun8(UINT8 **ScreenPtr, int XAdvance, - int RunLength, int Color, int ScreenWidth) + int RunLength, int Color, int ScreenWidth) { int i; UINT8 *WorkingScreenPtr = *ScreenPtr; - UINT8 col2 = Color>>8; UINT8 col1 = Color & 0x00FF; for (i=0; i>8; UINT8 col1 = Color & 0x00FF; for (i=0; iprev) region->prev->next = region->next; - // If not last node in list, adjust following node's ->prev entry. + // If not last node in list, adjust following node's->prev entry. if( region->next ) region->next->prev = region->prev; region->prev = region->next = NULL; @@ -555,14 +555,14 @@ void MSYS_DeleteRegionFromList(MOUSE_REGION *region) //====================================================================================================== // MSYS_UpdateMouseRegion // -// Searches the list for the highest priority region and updates its info. It also dispatches +// Searches the list for the highest priority region and updates it's info. It also dispatches // the callback functions // void MSYS_UpdateMouseRegion(void) { INT32 found; UINT32 ButtonReason; - MOUSE_REGION *pTempRegion; + MOUSE_REGION *pTempRegion; BOOLEAN fFound=FALSE; found=FALSE; @@ -578,10 +578,10 @@ void MSYS_UpdateMouseRegion(void) while( !found && MSYS_CurrRegion ) { if( MSYS_CurrRegion->uiFlags & (MSYS_REGION_ENABLED | MSYS_ALLOW_DISABLED_FASTHELP) && - (MSYS_CurrRegion->RegionTopLeftX <= MSYS_CurrentMX) && // Check boundaries - (MSYS_CurrRegion->RegionTopLeftY <= MSYS_CurrentMY) && - (MSYS_CurrRegion->RegionBottomRightX >= MSYS_CurrentMX) && - (MSYS_CurrRegion->RegionBottomRightY >= MSYS_CurrentMY)) + (MSYS_CurrRegion->RegionTopLeftX <= MSYS_CurrentMX) && // Check boundaries + (MSYS_CurrRegion->RegionTopLeftY <= MSYS_CurrentMY) && + (MSYS_CurrRegion->RegionBottomRightX >= MSYS_CurrentMX) && + (MSYS_CurrRegion->RegionBottomRightY >= MSYS_CurrentMY)) { // We got the right region. We don't need to check for priorities 'cause // the whole list is sorted the right way! @@ -623,7 +623,7 @@ void MSYS_UpdateMouseRegion(void) } if (MSYS_CurrRegion) - MSYS_CurrRegion->FastHelpTimer = gsFastHelpDelay; + MSYS_CurrRegion->FastHelpTimer = gsFastHelpDelay; // Force a callbacks to happen on previous region to indicate that // the mouse has left the old region @@ -643,7 +643,7 @@ void MSYS_UpdateMouseRegion(void) { if( MSYS_CurrRegion->FastHelpText && !( MSYS_CurrRegion->uiFlags & MSYS_FASTHELP_RESET ) ) { - //ExecuteMouseHelpEndCallBack( MSYS_CurrRegion ); + //ExecuteMouseHelpEndCallBack( MSYS_CurrRegion ); MSYS_CurrRegion->FastHelpTimer = gsFastHelpDelay; #ifdef _JA2_RENDER_DIRTY if( MSYS_CurrRegion->uiFlags & MSYS_GOT_BACKGROUND ) @@ -666,7 +666,7 @@ void MSYS_UpdateMouseRegion(void) } // if the cursor is set and is not set to no cursor - if( MSYS_CurrRegion->uiFlags & MSYS_REGION_ENABLED && + if( MSYS_CurrRegion->uiFlags & MSYS_REGION_ENABLED && MSYS_CurrRegion->uiFlags & MSYS_SET_CURSOR && MSYS_CurrRegion->Cursor != MSYS_NO_CURSOR ) { @@ -674,26 +674,26 @@ void MSYS_UpdateMouseRegion(void) } else { - // Addition Oct 10/1997 Carter, patch for mouse cursor - // start at region and find another region encompassing - pTempRegion=MSYS_CurrRegion->next; - while((pTempRegion!=NULL)&&(!fFound)) - { - if((pTempRegion->uiFlags & MSYS_REGION_ENABLED) && - (pTempRegion->RegionTopLeftX <= MSYS_CurrentMX) && - (pTempRegion->RegionTopLeftY <= MSYS_CurrentMY) && - (pTempRegion->RegionBottomRightX >= MSYS_CurrentMX) && - (pTempRegion->RegionBottomRightY >= MSYS_CurrentMY)&&(pTempRegion->uiFlags & MSYS_SET_CURSOR)) + // Addition Oct 10/1997 Carter, patch for mouse cursor + // start at region and find another region encompassing + pTempRegion=MSYS_CurrRegion->next; + while((pTempRegion!=NULL)&&(!fFound)) + { + if((pTempRegion->uiFlags & MSYS_REGION_ENABLED) && + (pTempRegion->RegionTopLeftX <= MSYS_CurrentMX) && + (pTempRegion->RegionTopLeftY <= MSYS_CurrentMY) && + (pTempRegion->RegionBottomRightX >= MSYS_CurrentMX) && + (pTempRegion->RegionBottomRightY >= MSYS_CurrentMY)&&(pTempRegion->uiFlags & MSYS_SET_CURSOR)) { - fFound=TRUE; - if( pTempRegion->Cursor != MSYS_NO_CURSOR ) - { - MSYS_SetCurrentCursor(pTempRegion->Cursor); - } + fFound=TRUE; + if( pTempRegion->Cursor != MSYS_NO_CURSOR ) + { + MSYS_SetCurrentCursor(pTempRegion->Cursor); } - pTempRegion=pTempRegion->next; - } - } + } + pTempRegion=pTempRegion->next; + } + } } // OK, if we do not have a button down, any button is game! @@ -746,19 +746,19 @@ void MSYS_UpdateMouseRegion(void) gusClickedIDNumber = MSYS_CurrRegion->IDNumber; } - if(MSYS_Action & MSYS_DO_RBUTTON_UP ) + if(MSYS_Action & MSYS_DO_RBUTTON_UP ) { ButtonReason|=MSYS_CALLBACK_REASON_RBUTTON_UP; gfClickedModeOn = FALSE; } // ATE: Added repeat resons.... - if(MSYS_Action & MSYS_DO_LBUTTON_REPEAT ) + if(MSYS_Action & MSYS_DO_LBUTTON_REPEAT ) { ButtonReason|=MSYS_CALLBACK_REASON_LBUTTON_REPEAT; } - if(MSYS_Action & MSYS_DO_RBUTTON_REPEAT ) + if(MSYS_Action & MSYS_DO_RBUTTON_REPEAT ) { ButtonReason|=MSYS_CALLBACK_REASON_RBUTTON_REPEAT; } @@ -812,7 +812,7 @@ void MSYS_UpdateMouseRegion(void) UINT32 uiCurrTime = GetClock(); if( gpRegionLastLButtonDown == MSYS_CurrRegion && uiCurrTime <= guiRegionLastLButtonDownTime + MSYS_DOUBLECLICK_DELAY ) - { //Double click is Left down, then left up, then left down. We have just detected the left up here (step 2). + { //Double click is Left down, then left up, then left down. We have just detected the left up here (step 2). gpRegionLastLButtonUp = MSYS_CurrRegion; } else @@ -834,11 +834,11 @@ void MSYS_UpdateMouseRegion(void) { // OK here, if we have release a button, UNSET LOCK wherever you are.... // Just don't give this button the message.... - if(MSYS_Action & MSYS_DO_RBUTTON_UP ) + if(MSYS_Action & MSYS_DO_RBUTTON_UP ) { gfClickedModeOn = FALSE; } - if(MSYS_Action & MSYS_DO_LBUTTON_UP ) + if(MSYS_Action & MSYS_DO_LBUTTON_UP ) { gfClickedModeOn = FALSE; } @@ -871,7 +871,7 @@ void MSYS_UpdateMouseRegion(void) // Inits a MOUSE_REGION structure for use with the mouse system // void MSYS_DefineRegion(MOUSE_REGION *region,UINT16 tlx,UINT16 tly,UINT16 brx,UINT16 bry,INT8 priority, - UINT16 crsr,MOUSE_CALLBACK movecallback,MOUSE_CALLBACK buttoncallback) + UINT16 crsr,MOUSE_CALLBACK movecallback,MOUSE_CALLBACK buttoncallback) { #ifdef MOUSESYSTEM_DEBUGGING if( region->uiFlags & MSYS_REGION_EXISTS ) @@ -1175,38 +1175,38 @@ void MSYS_ReleaseMouse(MOUSE_REGION *region) /* ================================================================================== - MSYS_MoveMouseRegionTo( MOUSE_REGION *region, INT16 sX, INT16 sY) + MSYS_MoveMouseRegionTo( MOUSE_REGION *region, INT16 sX, INT16 sY) - Moves a Mouse region to X Y on the screen + Moves a Mouse region to X Y on the screen */ void MSYS_MoveMouseRegionTo( MOUSE_REGION *region, INT16 sX, INT16 sY) { - INT16 sWidth; + INT16 sWidth; INT16 sHeight; - sWidth = region ->RegionBottomRightX - region ->RegionTopLeftX; - sHeight = region ->RegionBottomRightY - region ->RegionTopLeftY; + sWidth = region->RegionBottomRightX - region->RegionTopLeftX; + sHeight = region->RegionBottomRightY - region->RegionTopLeftY; // move top left - region -> RegionTopLeftX = sX; - region -> RegionTopLeftY = sY; + region->RegionTopLeftX = sX; + region->RegionTopLeftY = sY; // now move bottom right based on topleft + width or height - region -> RegionBottomRightX = sX + sWidth; - region -> RegionBottomRightY = sY + sHeight; + region->RegionBottomRightX = sX + sWidth; + region->RegionBottomRightY = sY + sHeight; return; } /* ================================================================================== - MSYS_MoveMouseRegionBy( MOUSE_REGION *region, INT16 sDeltaX, INT16 sDeltaY) + MSYS_MoveMouseRegionBy( MOUSE_REGION *region, INT16 sDeltaX, INT16 sDeltaY) - Moves a Mouse region by sDeltaX sDeltaY on the screen + Moves a Mouse region by sDeltaX sDeltaY on the screen */ @@ -1214,12 +1214,12 @@ void MSYS_MoveMouseRegionBy( MOUSE_REGION *region, INT16 sDeltaX, INT16 sDeltaY) { // move top left - region -> RegionTopLeftX = region -> RegionTopLeftX + sDeltaX; - region -> RegionTopLeftY = region -> RegionTopLeftY + sDeltaY; + region->RegionTopLeftX = region->RegionTopLeftX + sDeltaX; + region->RegionTopLeftY = region->RegionTopLeftY + sDeltaY; // now move bottom right - region -> RegionBottomRightX = region -> RegionBottomRightX + sDeltaX; - region -> RegionBottomRightY = region -> RegionBottomRightY + sDeltaY; + region->RegionBottomRightX = region->RegionBottomRightX + sDeltaX; + region->RegionBottomRightY = region->RegionBottomRightY + sDeltaY; return; } @@ -1259,8 +1259,8 @@ void SetRegionFastHelpText( MOUSE_REGION *region, const STR16 szText ) wcscpy( region->FastHelpText, szText ); - // ATE: We could be replacing already existing, active text - // so let's remove the region so it be rebuilt... + // ATE: We could be replacing already existing, active text + // so let's remove the region so it be rebuilt... #ifdef JA2 if ( guiCurrentScreen != MAP_SCREEN ) @@ -1268,12 +1268,12 @@ void SetRegionFastHelpText( MOUSE_REGION *region, const STR16 szText ) #endif #ifdef _JA2_RENDER_DIRTY - if( region->uiFlags & MSYS_GOT_BACKGROUND ) - FreeBackgroundRectPending( region->FastHelpRect ); - #endif + if( region->uiFlags & MSYS_GOT_BACKGROUND ) + FreeBackgroundRectPending( region->FastHelpRect ); + #endif - region->uiFlags &= (~MSYS_GOT_BACKGROUND); - region->uiFlags &= (~MSYS_FASTHELP_RESET); + region->uiFlags &= (~MSYS_GOT_BACKGROUND); + region->uiFlags &= (~MSYS_FASTHELP_RESET); #ifdef JA2 } @@ -1294,9 +1294,9 @@ INT16 GetNumberOfLinesInHeight( const STR16 pStringA ) pToken = wcstok( pString, L"\n" ); while( pToken != NULL ) - { - pToken = wcstok( NULL, L"\n" ); - sCounter++; + { + pToken = wcstok( NULL, L"\n" ); + sCounter++; } return( sCounter ); @@ -1313,7 +1313,6 @@ void DisplayFastHelp( MOUSE_REGION *region ) { UINT16 usFillColor; INT32 iX,iY,iW,iH; - INT32 iNumberOfLines = 1; if ( region->uiFlags & MSYS_FASTHELP ) { @@ -1359,7 +1358,7 @@ void DisplayFastHelp( MOUSE_REGION *region ) SetFont( FONT10ARIAL ); SetFontShadow( FONT_NEARBLACK ); DisplayHelpTokenizedString( region->FastHelpText ,( INT16 )( iX + 5 ), ( INT16 )( iY + 5 ) ); - InvalidateRegion( iX, iY, (iX + iW) , (iY + iH) ); + InvalidateRegion( iX, iY, (iX + iW) , (iY + iH) ); } } } @@ -1376,7 +1375,7 @@ INT16 GetWidthOfString( const STR16 pStringA ) pToken = wcstok( pString, L"\n" ); while( pToken != NULL ) - { + { if( sWidth < StringPixLength( pToken, FONT10ARIAL ) ) { sWidth = StringPixLength( pToken, FONT10ARIAL ); @@ -1403,7 +1402,7 @@ void DisplayHelpTokenizedString( const STR16 pStringA, INT16 sX, INT16 sY ) pToken = wcstok( pString, L"\n" ); while( pToken != NULL ) - { + { iLength = (INT32)wcslen( pToken ); for( i = 0; i < iLength; i++ ) { @@ -1491,7 +1490,7 @@ INT16 GetWidthOfString( const STR16 pStringA ) pToken = wcstok( pString, L"\n" ); while( pToken != NULL ) - { + { if( sWidth < StringPixLength( pToken, ghTinyMonoFont ) ) { sWidth = StringPixLength( pToken, ghTinyMonoFont ); @@ -1548,7 +1547,7 @@ void DisplayHelpTokenizedString( const STR16 pStringA, INT16 sX, INT16 sY ) pToken = wcstok( pString, L"\n" ); while( pToken != NULL ) - { + { iLength = (INT32)wcslen( pToken ); for( i = 0; i < iLength; i++ ) { @@ -1656,7 +1655,7 @@ void SetRegionHelpEndCallback( MOUSE_REGION *region, MOUSE_HELPTEXT_DONE_CALLBAC } // now set the region help text - region-> HelpDoneCallback = CallbackFxn; + region->HelpDoneCallback = CallbackFxn; return; } @@ -1689,17 +1688,17 @@ void ExecuteMouseHelpEndCallBack( MOUSE_REGION *region ) void SetFastHelpDelay( INT16 sFastHelpDelay ) { - gsFastHelpDelay = sFastHelpDelay; + gsFastHelpDelay = sFastHelpDelay; } void EnableMouseFastHelp( void ) { - gfShowFastHelp = TRUE; + gfShowFastHelp = TRUE; } void DisableMouseFastHelp( void ) { - gfShowFastHelp = FALSE; + gfShowFastHelp = FALSE; } void ResetClickedMode(void) diff --git a/Standard Gaming Platform/mousesystem.h b/Standard Gaming Platform/mousesystem.h index f0793857..0903bb1f 100644 --- a/Standard Gaming Platform/mousesystem.h +++ b/Standard Gaming Platform/mousesystem.h @@ -6,7 +6,7 @@ // // Modification history : // -// 30jan97:Bret -> Creation +// 30jan97:Bret ->Creation // // ***************************************************************************** @@ -135,10 +135,10 @@ typedef struct _MOUSE_REGION { #define MSYS_CALLBACK_REASON_LBUTTON_REPEAT 256 #define MSYS_CALLBACK_REASON_RBUTTON_REPEAT 512 -//Kris: Nov 31, 1999 -//Added support for double clicks. The DOUBLECLICK event is passed combined with +//Kris: Nov 31, 1999 +//Added support for double clicks. The DOUBLECLICK event is passed combined with //the LBUTTON_DWN event if two LBUTTON_DWN events are detected on the same button/region -//within the delay defined by MSYS_DOUBLECLICK_DELAY (in milliseconds). If your button/region +//within the delay defined by MSYS_DOUBLECLICK_DELAY (in milliseconds). If your button/region //supports double clicks and single clicks, make sure the DOUBLECLICK event is checked first (rejecting //the LBUTTON_DWN event if detected) #define MSYS_CALLBACK_REASON_LBUTTON_DOUBLECLICK 1024 @@ -178,7 +178,7 @@ void MSYS_SetCurrentCursor(UINT16 Cursor); INT32 MSYS_Init(void); void MSYS_Shutdown(void); void MSYS_DefineRegion(MOUSE_REGION *region,UINT16 tlx,UINT16 tly,UINT16 brx,UINT16 bry,INT8 priority, - UINT16 crsr,MOUSE_CALLBACK movecallback,MOUSE_CALLBACK buttoncallback); + UINT16 crsr,MOUSE_CALLBACK movecallback,MOUSE_CALLBACK buttoncallback); void MSYS_ChangeRegionCursor(MOUSE_REGION *region,UINT16 crsr); INT32 MSYS_AddRegion(MOUSE_REGION *region); void MSYS_RemoveRegion(MOUSE_REGION *region); diff --git a/Standard Gaming Platform/pcx.h b/Standard Gaming Platform/pcx.h index 9b42358f..555eef6b 100644 --- a/Standard Gaming Platform/pcx.h +++ b/Standard Gaming Platform/pcx.h @@ -7,29 +7,29 @@ typedef struct { - UINT8 ubManufacturer; - UINT8 ubVersion; - UINT8 ubEncoding; - UINT8 ubBitsPerPixel; - UINT16 usLeft, usTop; - UINT16 usRight, usBottom; - UINT16 usHorRez, usVerRez; - UINT8 ubEgaPalette[48]; - UINT8 ubReserved; - UINT8 ubColorPlanes; - UINT16 usBytesPerLine; - UINT16 usPaletteType; - UINT8 ubFiller[58]; + UINT8 ubManufacturer; + UINT8 ubVersion; + UINT8 ubEncoding; + UINT8 ubBitsPerPixel; + UINT16 usLeft, usTop; + UINT16 usRight, usBottom; + UINT16 usHorRez, usVerRez; + UINT8 ubEgaPalette[48]; + UINT8 ubReserved; + UINT8 ubColorPlanes; + UINT16 usBytesPerLine; + UINT16 usPaletteType; + UINT8 ubFiller[58]; } PcxHeader; typedef struct { - UINT8 *pPcxBuffer; - UINT8 ubPalette[768]; - UINT16 usWidth, usHeight; - UINT32 uiBufferSize; - UINT16 usPcxFlags; + UINT8 *pPcxBuffer; + UINT8 ubPalette[768]; + UINT16 usWidth, usHeight; + UINT32 uiBufferSize; + UINT16 usPcxFlags; } PcxObject; diff --git a/Standard Gaming Platform/random.h b/Standard Gaming Platform/random.h index 1108efd8..6bea24ee 100644 --- a/Standard Gaming Platform/random.h +++ b/Standard Gaming Platform/random.h @@ -13,7 +13,7 @@ extern "C" { extern void InitializeRandom(void); extern UINT32 Random( UINT32 uiRange ); -//Chance( 74 ) returns TRUE 74% of the time. If uiChance >= 100, then it will always return TRUE. +//Chance( 74 ) returns TRUE 74% of the time. If uiChance >= 100, then it will always return TRUE. extern BOOLEAN Chance( UINT32 uiChance ); //Wizardry can use it too, but I'm saving them a K in the meantime... @@ -23,12 +23,12 @@ extern BOOLEAN Chance( UINT32 uiChance ); #endif #ifdef PRERANDOM_GENERATOR - //Returns a pregenerated random number. + //Returns a pregenerated random number. //Used to deter Ian's tactic of shoot, miss, restore saved game :) extern UINT32 PreRandom( UINT32 uiRange ); extern BOOLEAN PreChance( UINT32 uiChance ); - //IMPORTANT: Changing this define will invalidate the JA2 save. If this + //IMPORTANT: Changing this define will invalidate the JA2 save. If this // is necessary, please ifdef your own value. #define MAX_PREGENERATED_NUMS 256 extern UINT32 guiPreRandomIndex; diff --git a/Standard Gaming Platform/sgp.cpp b/Standard Gaming Platform/sgp.cpp index 2f7e629b..12d345c6 100644 --- a/Standard Gaming Platform/sgp.cpp +++ b/Standard Gaming Platform/sgp.cpp @@ -28,7 +28,7 @@ #include "Timer Control.h" #endif #if !defined( JA2 ) && !defined( UTIL ) - #include "GameData.h" // for MoveTimer() [Wizardry specific] + #include "GameData.h" // for MoveTimer() [Wizardry specific] #endif #include "LibraryDataBase.h" #include "utilities.h" @@ -60,21 +60,21 @@ extern UINT32 MemDebugCounter; #ifdef JA2 extern BOOLEAN gfPauseDueToPlayerGamePause; -extern int iScreenMode; -extern BOOL bScreenModeCmdLine; +extern int iScreenMode; +extern BOOL bScreenModeCmdLine; #endif extern BOOLEAN CheckIfGameCdromIsInCDromDrive(); -extern void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam); +extern void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam); // Prototype Declarations INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LPARAM lParam); -BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow); -void ShutdownStandardGamingPlatform(void); -void GetRuntimeSettings( ); +BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow); +void ShutdownStandardGamingPlatform(void); +void GetRuntimeSettings( ); -int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow); +int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow); Console g_Console("", "", "Lua Console", "no"); @@ -99,7 +99,7 @@ HINSTANCE ghInstance; // Global Variable Declarations RECT rcWindow; -POINT ptWindowSize; +POINT ptWindowSize; // moved from header file: 24mar98:HJH UINT32 giStartMem; @@ -125,7 +125,7 @@ BOOLEAN gfIgnoreMessages=FALSE; UINT8 gbPixelDepth = PIXEL_DEPTH; INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LPARAM lParam) -{ +{ static BOOLEAN fRestore = FALSE; if ( Message == WM_USER ) @@ -134,19 +134,19 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP return 0L; } BOOL visible = IsWindowVisible(hWindow); - + if(gfIgnoreMessages) return(DefWindowProc(hWindow, Message, wParam, lParam)); // ATE: This is for older win95 or NT 3.51 to get MOUSE_WHEEL Messages if ( Message == guiMouseWheelMsg ) { - QueueEvent(MOUSE_WHEEL, wParam, lParam); + QueueEvent(MOUSE_WHEEL, wParam, lParam); return( 0L ); } switch(Message) - { + { case WM_CLOSE: PostQuitMessage(0); break; @@ -158,15 +158,15 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP } #ifdef JA2 - case WM_MOVE: -// if( 1==iScreenMode ) + case WM_MOVE: +// if( 1==iScreenMode ) { - GetClientRect(hWindow, &rcWindow); - // Go ahead and clamp the client width and height - rcWindow.right = SCREEN_WIDTH; - rcWindow.bottom = SCREEN_HEIGHT; - ClientToScreen(hWindow, (LPPOINT)&rcWindow); - ClientToScreen(hWindow, (LPPOINT)&rcWindow+1); + GetClientRect(hWindow, &rcWindow); + // Go ahead and clamp the client width and height + rcWindow.right = SCREEN_WIDTH; + rcWindow.bottom = SCREEN_HEIGHT; + ClientToScreen(hWindow, (LPPOINT)&rcWindow); + ClientToScreen(hWindow, (LPPOINT)&rcWindow+1); int xPos = (int)(short) LOWORD(lParam); int yPos = (int)(short) HIWORD(lParam); BOOL needchange = FALSE; @@ -186,7 +186,7 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP } } - break; + break; case WM_GETMINMAXINFO: { MINMAXINFO *mmi = (MINMAXINFO*)lParam; @@ -206,7 +206,7 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP INT32 iWidth, iHeight, iX, iY; BOOLEAN fWidthByHeight=FALSE, fHoldRight=FALSE; - lpWindow = (LPRECT) lParam; + lpWindow = (LPRECT) lParam; iWidth=lpWindow->right-lpWindow->left; iHeight=lpWindow->bottom-lpWindow->top; @@ -315,9 +315,9 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP } break; - case WM_SIZE: + case WM_SIZE: { - UINT16 nWidth = LOWORD(lParam); // width of client area + UINT16 nWidth = LOWORD(lParam); // width of client area UINT16 nHeight = HIWORD(lParam); // height of client area if(nWidth && nHeight) @@ -336,10 +336,10 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP } break; - case WM_MOVE: + case WM_MOVE: { - INT32 xPos = (INT32)LOWORD(lParam); // horizontal position - INT32 yPos = (INT32)HIWORD(lParam); // vertical position + INT32 xPos = (INT32)LOWORD(lParam); // horizontal position + INT32 yPos = (INT32)HIWORD(lParam); // vertical position } break; #endif @@ -352,40 +352,40 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP PollConsole( ); #endif - if (gfApplicationActive) - { - GameLoop(); - } - break; + if (gfApplicationActive) + { + GameLoop(); + } + break; - case WM_ACTIVATEAPP: - switch(wParam) - { - case TRUE: // We are restarting DirectDraw - if (fRestore == TRUE) - { + case WM_ACTIVATEAPP: + switch(wParam) + { + case TRUE: // We are restarting DirectDraw + if (fRestore == TRUE) + { #ifdef JA2 - RestoreVideoManager(); - RestoreVideoSurfaces(); // Restore any video surfaces + RestoreVideoManager(); + RestoreVideoSurfaces(); // Restore any video surfaces // unpause the JA2 Global clock - if ( !gfPauseDueToPlayerGamePause ) - { - PauseTime( FALSE ); - } + if ( !gfPauseDueToPlayerGamePause ) + { + PauseTime( FALSE ); + } #else if(!VideoInspectorIsEnabled()) { - RestoreVideoManager(); - RestoreVideoSurfaces(); // Restore any video surfaces + RestoreVideoManager(); + RestoreVideoSurfaces(); // Restore any video surfaces } - MoveTimer(TIMER_RESUME); + MoveTimer(TIMER_RESUME); #endif - gfApplicationActive = TRUE; - } - break; - case FALSE: // We are suspending direct draw + gfApplicationActive = TRUE; + } + break; + case FALSE: // We are suspending direct draw #ifdef JA2 // pause the JA2 Global clock PauseTime( TRUE ); @@ -396,27 +396,27 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP SuspendVideoManager(); #endif #endif - // suspend movement timer, to prevent timer crash if delay becomes long - // * it doesn't matter whether the 3-D engine is actually running or not, or if it's even been initialized - // * restore is automatic, no need to do anything on reactivation + // suspend movement timer, to prevent timer crash if delay becomes long + // * it doesn't matter whether the 3-D engine is actually running or not, or if it's even been initialized + // * restore is automatic, no need to do anything on reactivation #if !defined( JA2 ) && !defined( UTIL ) - MoveTimer(TIMER_SUSPEND); + MoveTimer(TIMER_SUSPEND); #endif - gfApplicationActive = FALSE; - fRestore = TRUE; - break; - } - break; + gfApplicationActive = FALSE; + fRestore = TRUE; + break; + } + break; - case WM_CREATE: + case WM_CREATE: break; - case WM_DESTROY: + case WM_DESTROY: ShutdownStandardGamingPlatform(); -// ShowCursor(TRUE); - PostQuitMessage(0); - break; +// ShowCursor(TRUE); + PostQuitMessage(0); + break; case WM_SETFOCUS: #if !defined( JA2 ) && !defined( UTIL ) @@ -425,7 +425,7 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP gfApplicationActive=TRUE; // RestrictMouseToXYXY(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); #else - RestoreCursorClipRect( ); + RestoreCursorClipRect( ); #endif break; @@ -444,14 +444,14 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP #if defined( JA2 ) - case WM_DEVICECHANGE: + case WM_DEVICECHANGE: { - //DEV_BROADCAST_HDR *pHeader = (DEV_BROADCAST_HDR *)lParam; + //DEV_BROADCAST_HDR *pHeader = (DEV_BROADCAST_HDR *)lParam; ////if a device has been removed //if( wParam == DBT_DEVICEREMOVECOMPLETE ) //{ - // //if its a disk + // //if its a disk // if( pHeader->dbch_devicetype == DBT_DEVTYP_VOLUME ) // { // //check to see if the play cd is still in the cdrom @@ -466,13 +466,13 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP case WM_SYSKEYUP: case WM_KEYUP: - KeyUp(wParam, lParam); + KeyUp(wParam, lParam); break; case WM_SYSKEYDOWN: case WM_KEYDOWN: - KeyDown(wParam, lParam); - gfSGPInputReceived = TRUE; + KeyDown(wParam, lParam); + gfSGPInputReceived = TRUE; break; case WM_CHAR: @@ -500,10 +500,10 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP cout << "> "; } break; - default - : return DefWindowProc(hWindow, Message, wParam, lParam); - } - return 0L; + default + : return DefWindowProc(hWindow, Message, wParam, lParam); + } + return 0L; } @@ -532,7 +532,7 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow) // Now start up everything else. RegisterDebugTopic(TOPIC_SGP, "Standard Gaming Platform"); - // this one needs to go ahead of all others (except Debug), for MemDebugCounter to work right... + // this one needs to go ahead of all others (except Debug), for MemDebugCounter to work right... FastDebugMsg("Initializing Memory Manager"); // Initialize the Memory Manager if (InitializeMemoryManager() == FALSE) @@ -542,7 +542,7 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow) } #ifdef JA2 - FastDebugMsg("Initializing Mutex Manager"); + FastDebugMsg("Initializing Mutex Manager"); // Initialize the Dirty Rectangle Manager if (InitializeMutexManager() == FALSE) { // We were unable to initialize the game @@ -560,7 +560,7 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow) } FastDebugMsg("Initializing Containers Manager"); - InitializeContainers(); + InitializeContainers(); FastDebugMsg("Initializing Input Manager"); // Initialize the Input Manager @@ -629,9 +629,9 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow) InitJA2SplashScreen(); //#endif - // Make sure we start up our local clock (in milliseconds) - // We don't need to check for a return value here since so far its always TRUE - InitializeClockManager(); // must initialize after VideoManager, 'cause it uses ghWindow + // Make sure we start up our local clock (in milliseconds) + // We don't need to check for a return value here since so far its always TRUE + InitializeClockManager(); // must initialize after VideoManager, 'cause it uses ghWindow // Create font translation table (store in temp structure) pFontTable = CreateEnglishTransTable( ); @@ -658,12 +658,12 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow) { // We were unable to initialize the sound manager FastDebugMsg("FAILED : Initializing Sound Manager"); return FALSE; - } + } #endif FastDebugMsg("Initializing Random"); - // Initialize random number generator - InitializeRandom(); // no Shutdown + // Initialize random number generator + InitializeRandom(); // no Shutdown FastDebugMsg("Initializing Game Manager"); // Initialize the Game @@ -710,7 +710,7 @@ void ShutdownStandardGamingPlatform(void) if (gfGameInitialized) { - ShutdownGame(); + ShutdownGame(); } @@ -718,45 +718,45 @@ void ShutdownStandardGamingPlatform(void) MSYS_Shutdown(); #ifndef UTIL - ShutdownSoundManager(); + ShutdownSoundManager(); #endif - DestroyEnglishTransTable( ); // has to go before ShutdownFontManager() - ShutdownFontManager(); + DestroyEnglishTransTable( ); // has to go before ShutdownFontManager() + ShutdownFontManager(); - ShutdownClockManager(); // must shutdown before VideoManager, 'cause it uses ghWindow + ShutdownClockManager(); // must shutdown before VideoManager, 'cause it uses ghWindow #ifdef SGP_VIDEO_DEBUGGING PerformVideoInfoDumpIntoFile( "SGPVideoShutdownDump.txt", FALSE ); #endif ShutdownVideoSurfaceManager(); - ShutdownVideoObjectManager(); - ShutdownVideoManager(); + ShutdownVideoObjectManager(); + ShutdownVideoManager(); - ShutdownInputManager(); - ShutdownContainers(); - ShutdownFileManager(); + ShutdownInputManager(); + ShutdownContainers(); + ShutdownFileManager(); #ifdef JA2 - ShutdownMutexManager(); + ShutdownMutexManager(); #endif #ifdef EXTREME_MEMORY_DEBUGGING DumpMemoryInfoIntoFile( "ExtremeMemoryDump.txt", FALSE ); #endif - ShutdownMemoryManager(); // must go last (except for Debug), for MemDebugCounter to work right... + ShutdownMemoryManager(); // must go last (except for Debug), for MemDebugCounter to work right... // - // Make sure we unregister the last remaining debug topic before shutting - // down the debugging layer - UnRegisterDebugTopic(TOPIC_SGP, "Standard Gaming Platform"); + // Make sure we unregister the last remaining debug topic before shutting + // down the debugging layer + UnRegisterDebugTopic(TOPIC_SGP, "Standard Gaming Platform"); - ShutdownDebugManager(); + ShutdownDebugManager(); } -int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow) +int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow) { //If we are to use exception handling @@ -785,13 +785,13 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommand -int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow) +int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow) { //DO NOT REMOVE, used for exception handing list above in WinMain #endif - MSG Message; + MSG Message; HWND hPrevInstanceWindow; - UINT32 uiTimer = 0; + UINT32 uiTimer = 0; // Make sure that only one instance of this application is running at once // // Look for prev instance by searching for the window @@ -834,8 +834,8 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR p #endif // Mem Usage - giStartMem = MemGetFree( ) / 1024; - + giStartMem = MemGetFree( ) / 1024; + #ifdef JA2 // Handle Check for CD @@ -850,19 +850,19 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR p #endif -// ShowCursor(FALSE); +// ShowCursor(FALSE); - // Inititialize the SGP - if (InitializeStandardGamingPlatform(hInstance, sCommandShow) == FALSE) - { // We failed to initialize the SGP - return 0; - } + // Inititialize the SGP + if (InitializeStandardGamingPlatform(hInstance, sCommandShow) == FALSE) + { // We failed to initialize the SGP + return 0; + } #ifdef LUACONSOLE - if (1==iScreenMode) - { - CreateConsole(); - } + if (1==iScreenMode) + { + CreateConsole(); + } #endif #ifdef JA2 @@ -871,59 +871,59 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR p #endif #endif - gfApplicationActive = TRUE; - gfProgramIsRunning = TRUE; + gfApplicationActive = TRUE; + gfProgramIsRunning = TRUE; - FastDebugMsg("Running Game"); + FastDebugMsg("Running Game"); - // 0verhaul: Use the smallest available timer to make sure all animation updates happen at the speed they're supposed to - SetTimer( ghWindow, uiTimer, 1, NULL); + // 0verhaul: Use the smallest available timer to make sure all animation updates happen at the speed they're supposed to + SetTimer( ghWindow, uiTimer, 1, NULL); - // 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; + // 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)) -// { // We have a message on the WIN95 queue, let's get it - if (!GetMessage(&Message, NULL, 0, 0)) - { // It's quitting time - return Message.wParam; - } - // Ok, now that we have the message, let's handle it - TranslateMessage(&Message); - DispatchMessage(&Message); - } + while (gfProgramIsRunning) + { +// if (PeekMessage(&Message, NULL, 0, 0, PM_NOREMOVE)) +// { // We have a message on the WIN95 queue, let's get it + if (!GetMessage(&Message, NULL, 0, 0)) + { // It's quitting time + return Message.wParam; + } + // Ok, now that we have the message, let's handle it + TranslateMessage(&Message); + DispatchMessage(&Message); + } #if 0 - else - { // Windows hasn't processed any messages, therefore we handle the rest + else + { // Windows hasn't processed any messages, therefore we handle the rest #ifdef LUACONSOLE PollConsole( ); #endif - if (gfApplicationActive == FALSE) - { // Well we got nothing to do but to wait for a message to activate - WaitMessage(); - } - else - { // Well, the game is active, so we handle the game stuff - GameLoop(); + if (gfApplicationActive == FALSE) + { // Well we got nothing to do but to wait for a message to activate + WaitMessage(); + } + else + { // Well, the game is active, so we handle the game stuff + GameLoop(); // After this frame, reset input given flag - gfSGPInputReceived = FALSE; - } - } - } + gfSGPInputReceived = FALSE; + } + } + } #endif - KillTimer( ghWindow, uiTimer); + KillTimer( ghWindow, uiTimer); - // This is the normal exit point - FastDebugMsg("Exiting Game"); - PostQuitMessage(0); + // This is the normal exit point + FastDebugMsg("Exiting Game"); + PostQuitMessage(0); - // SGPExit() will be called next through the atexit() mechanism... This way we correctly process both normal exits and + // SGPExit() will be called next through the atexit() mechanism... This way we correctly process both normal exits and // emergency aborts (such as those caused by a failed assertion). // return wParam of the last message received @@ -935,9 +935,6 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR p void SGPExit(void) { static BOOLEAN fAlreadyExiting = FALSE; - BOOLEAN fUnloadScreens = TRUE; - - // helps prevent heap crashes when multiple assertions occur and call us if ( fAlreadyExiting ) { @@ -963,11 +960,11 @@ void SGPExit(void) #endif ShutdownStandardGamingPlatform(); -// ShowCursor(TRUE); +// ShowCursor(TRUE); if(strlen(gzErrorMsg)) - { - MessageBox(NULL, gzErrorMsg, "Error", MB_OK | MB_ICONERROR ); - } + { + MessageBox(NULL, gzErrorMsg, "Error", MB_OK | MB_ICONERROR ); + } #ifndef JA2 VideoDumpMemoryLeaks(); @@ -1032,10 +1029,10 @@ void GetRuntimeSettings( ) iScreenWidthOffset = (SCREEN_WIDTH - 640) / 2; iScreenHeightOffset = (SCREEN_HEIGHT - 480) / 2; - /* Sergeant_Kolja. 2007-02-20: runtime Windowed mode instead of compile-time */ - /* 1 for Windowed, 0 for Fullscreen */ - if( !bScreenModeCmdLine ) - iScreenMode = (int) GetPrivateProfileInt( "Ja2 Settings","SCREEN_MODE_WINDOWED", iScreenMode, INIFile ); + /* Sergeant_Kolja. 2007-02-20: runtime Windowed mode instead of compile-time */ + /* 1 for Windowed, 0 for Fullscreen */ + if( !bScreenModeCmdLine ) + iScreenMode = (int) GetPrivateProfileInt( "Ja2 Settings","SCREEN_MODE_WINDOWED", iScreenMode, INIFile ); // WANNE: Should we play the intro? iPlayIntro = (int) GetPrivateProfileInt( "Ja2 Settings","PLAY_INTRO", iPlayIntro, INIFile ); @@ -1152,18 +1149,18 @@ void ProcessJa2CommandLineBeforeInitialization(CHAR8 *pCommandLine) { //overwrite Graphic setting from JA2_settings.ini iScreenMode=0; /* 1 for Windowed, 0 for Fullscreen */ - bScreenModeCmdLine = TRUE; /* if set TRUE, INI is no longer evaluated */ - /* no resolution read from Args. Still from INI, but could be added here, too...*/ + bScreenModeCmdLine = TRUE; /* if set TRUE, INI is no longer evaluated */ + /* no resolution read from Args. Still from INI, but could be added here, too...*/ } else if(!_strnicmp(pToken, "/WINDOW", 7)) { //overwrite Graphic setting from JA2_settings.ini iScreenMode=1; /* 1 for Windowed, 0 for Fullscreen */ - bScreenModeCmdLine = TRUE; /* if set TRUE, INI is no longer evaluated */ - /* no resolution read from Args. Still from INI, but could be added here, too...*/ + bScreenModeCmdLine = TRUE; /* if set TRUE, INI is no longer evaluated */ + /* no resolution read from Args. Still from INI, but could be added here, too...*/ } - //get the next token + //get the next token pToken=strtok(NULL, cSeparators); } diff --git a/Standard Gaming Platform/shading.cpp b/Standard Gaming Platform/shading.cpp index d2f6abf1..c7e54331 100644 --- a/Standard Gaming Platform/shading.cpp +++ b/Standard Gaming Platform/shading.cpp @@ -31,8 +31,8 @@ UINT8 ubColorTables[HVOBJECT_SHADE_TABLES+3][256]; UINT16 IntensityTable[65536]; UINT16 ShadeTable[65536]; UINT16 White16BPPPalette[ 256 ]; -FLOAT guiShadePercent = (FLOAT)0.48; -FLOAT guiBrightPercent = (FLOAT)1.1; +FLOAT guiShadePercent = (FLOAT)0.48; +FLOAT guiBrightPercent = (FLOAT)1.1; BOOLEAN ShadesCalculateTables(SGPPaletteEntry *p8BPPPalette) { @@ -41,7 +41,7 @@ UINT32 uiCount; // Green palette ShadesCalculatePalette(p8BPPPalette, Shaded8BPPPalettes[0], 0, 255, 0, TRUE); // Blue palette - ShadesCalculatePalette(p8BPPPalette, Shaded8BPPPalettes[HVOBJECT_SHADE_TABLES], 0, 0, 255, TRUE); + ShadesCalculatePalette(p8BPPPalette, Shaded8BPPPalettes[HVOBJECT_SHADE_TABLES], 0, 0, 255, TRUE); // Yellow palette ShadesCalculatePalette(p8BPPPalette, Shaded8BPPPalettes[HVOBJECT_SHADE_TABLES+1], 255, 255, 0, TRUE); // Red palette @@ -150,19 +150,19 @@ DoNextIndex: xor bx,bx NextColor: - xor ah,ah ; Calc delta between shaded color + xor ah,ah ; Calc delta between shaded color mov al,[edi] ; and a color in the orig palette. mov bl,[esi] ; Formula: - sub ax,bx ; Delta = abs(red-origred) + - or ax,ax ; abs(green-origgreen) + + sub ax,bx ; Delta = abs(red-origred) + + or ax,ax ; abs(green-origgreen) + jns NC1 neg ax -NC1:mov dx,ax ; abs(blue-origblue) +NC1:mov dx,ax ; abs(blue-origblue) xor ah,ah mov al,[edi+1] mov bl,[esi+1] sub ax,bx - or ax,ax ; abs(green-origgreen) + + or ax,ax ; abs(green-origgreen) + jns NC2 neg ax NC2:add dx,ax @@ -170,21 +170,21 @@ NC2:add dx,ax mov al,[edi+2] mov bl,[esi+2] sub ax,bx - or ax,ax ; abs(green-origgreen) + + or ax,ax ; abs(green-origgreen) + jns NC3 neg ax NC3:add dx,ax cmp dx,usCurDelta ; If delta < old delta jae NotThisCol ; Save this delta and it's - mov ax,256 ; palette index + mov ax,256 ; palette index mov [usCurDelta],dx - sub ax,cx + sub ax,cx mov [usCurIndex],ax NotThisCol: add edi,4 ; Try next color in orginal pal dec cx - jnz NextColor + jnz NextColor pop ebx mov ax,usCurIndex ; By now, usCurIndex holds pal index @@ -241,7 +241,7 @@ void BuildIntensityTable(void) { UINT16 red, green, blue = 0; UINT16 index = 0; - FLOAT dShadedPercent = (FLOAT)0.80; + FLOAT dShadedPercent = (FLOAT)0.80; diff --git a/Standard Gaming Platform/shading.h b/Standard Gaming Platform/shading.h index 424ea092..f028520b 100644 --- a/Standard Gaming Platform/shading.h +++ b/Standard Gaming Platform/shading.h @@ -27,8 +27,8 @@ extern UINT8 ubColorTables[HVOBJECT_SHADE_TABLES+3][256]; extern UINT16 IntensityTable[65536]; extern UINT16 ShadeTable[65536]; extern UINT16 White16BPPPalette[ 256 ]; -extern FLOAT guiShadePercent; -extern FLOAT guiBrightPercent; +extern FLOAT guiShadePercent; +extern FLOAT guiBrightPercent; #ifdef __cplusplus } diff --git a/Standard Gaming Platform/soundman.cpp b/Standard Gaming Platform/soundman.cpp index 0e7360db..e9f6c802 100644 --- a/Standard Gaming Platform/soundman.cpp +++ b/Standard Gaming Platform/soundman.cpp @@ -2,7 +2,7 @@ * SGP Digital Sound Module * * This module handles the playing of digital samples, preloaded or streamed. -* +* * Derek Beland, May 28, 1997 * *********************************************************************************/ @@ -19,8 +19,8 @@ #include "debug.h" #include "MemMan.h" #include "random.h" - #include "fmod.h" - #include "fmod_errors.h" + #include "fmod.h" + #include "fmod_errors.h" #endif // Uncomment this to disable the startup of sound hardware @@ -48,11 +48,11 @@ #define SOUND_CALLBACK 0x00000008 // Max volume -#define MAX_VOLUME (127) +#define MAX_VOLUME (127) // Initialization parameters -#define AUDIO_BUFFER_LEN 100 -#define STREAM_BUFFER_LEN 100 +#define AUDIO_BUFFER_LEN 100 +#define STREAM_BUFFER_LEN 100 // Lesh modifications // Sound debug @@ -83,8 +83,8 @@ BOOLEAN SoundShutdownHardware(void); UINT32 SoundStartSample(UINT32 uiSample, UINT32 uiChannel, SOUNDPARMS *pParms); UINT32 SoundStartStream(STR pFilename, UINT32 uiChannel, SOUNDPARMS *pParms); BOOLEAN SoundPlayStreamed(STR pFilename); -UINT32 SoundStartRandom(UINT32 uiSample); -BOOLEAN SoundRandomShouldPlay(UINT32 uiSample); +UINT32 SoundStartRandom(UINT32 uiSample); +BOOLEAN SoundRandomShouldPlay(UINT32 uiSample); // Stopping BOOLEAN SoundStopIndex(UINT32 uiSound); @@ -92,7 +92,7 @@ BOOLEAN SoundStopIndex(UINT32 uiSound); // Checks BOOLEAN SoundSampleIsPlaying(UINT32 uiSample); BOOLEAN SoundIndexIsPlaying(UINT32 uiSound); -BOOLEAN SoundSampleIsInUse(UINT32 uiSample); +BOOLEAN SoundSampleIsInUse(UINT32 uiSample); // Volume operations UINT32 SoundGetVolumeIndex(UINT32 uiChannel); @@ -107,11 +107,11 @@ UINT32 SoundGetFreeChannel(void); UINT32 SoundGetUniqueID(void); // Callbacks -void * F_CALLBACKAPI SoundFileOpen (const STR8 pName); -void F_CALLBACKAPI SoundFileClose(void *uiHandle); -INT F_CALLBACKAPI SoundFileRead (void *pBuffer, INT iSize, void *uiHandle); -INT F_CALLBACKAPI SoundFileSeek (void *uiHandle, INT iPos, signed char cMode); -INT F_CALLBACKAPI SoundFileTell (void *uiHandle); +void * F_CALLBACKAPI SoundFileOpen (const STR8 pName); +void F_CALLBACKAPI SoundFileClose(void *uiHandle); +INT F_CALLBACKAPI SoundFileRead (void *pBuffer, INT iSize, void *uiHandle); +INT F_CALLBACKAPI SoundFileSeek (void *uiHandle, INT iPos, signed char cMode); +INT F_CALLBACKAPI SoundFileTell (void *uiHandle); // Global variables UINT32 guiSoundDefaultVolume = 127; @@ -119,7 +119,7 @@ UINT32 guiSoundMemoryLimit=SOUND_DEFAULT_MEMORY; // Maximum memory used for so UINT32 guiSoundMemoryUsed=0; // Memory currently in use UINT32 guiSoundCacheThreshold=SOUND_DEFAULT_THRESH; // Double-buffered threshold -BOOLEAN hSoundDriver; // Sound driver ready ? +BOOLEAN hSoundDriver; // Sound driver ready ? BOOLEAN fDirectSound=TRUE; // Using Direct Sound // Local module variables @@ -135,39 +135,39 @@ typedef struct { UINT32 uiSize; // Sample size UINT32 uiFlags; // Status flags PTR pData; // Pointer to loaded sample - UINT32 uiCacheHits; // Cache hits for this sample + UINT32 uiCacheHits; // Cache hits for this sample UINT32 uiTimeNext; // Random sound data UINT32 uiTimeMin, uiTimeMax; UINT32 uiVolMin, uiVolMax; UINT32 uiPanMin, uiPanMax; - UINT32 uiPriority; // Priority - UINT32 uiInstances; // Instances of sample sounding at this moment - UINT32 uiMaxInstances; // Max allowable instances of sample + UINT32 uiPriority; // Priority + UINT32 uiInstances; // Instances of sample sounding at this moment + UINT32 uiMaxInstances; // Max allowable instances of sample } SAMPLETAG; // Structure definition for slots in the sound output // These are used for both the cached and double-buffered // streams typedef struct { - UINT32 uiSample; // Sample slot in cache - FSOUND_STREAM* hStream; // Stream fmod handler - UINT32 uiFMODChannel; // Fmod channel - UINT32 uiFlags; // Sample flags - UINT32 uiSoundID; // Sound unique ID - UINT32 uiPriority; // Priority + UINT32 uiSample; // Sample slot in cache + FSOUND_STREAM* hStream; // Stream fmod handler + UINT32 uiFMODChannel; // Fmod channel + UINT32 uiFlags; // Sample flags + UINT32 uiSoundID; // Sound unique ID + UINT32 uiPriority; // Priority void (*EOSCallback)(void *); void *pCallbackData; - UINT32 uiTimeStamp; // Time stamp - BOOLEAN fLooping; // Loop flag - BOOLEAN fStopAtZero; // Stop at zero volume + UINT32 uiTimeStamp; // Time stamp + BOOLEAN fLooping; // Loop flag + BOOLEAN fStopAtZero; // Stop at zero volume UINT32 uiFadeVolume; UINT32 uiFadeRate; UINT32 uiFadeTime; } SOUNDTAG; // Sample cache list for files loaded -SAMPLETAG pSampleList[SOUND_MAX_CACHED]; +SAMPLETAG pSampleList[SOUND_MAX_CACHED]; // Sound channel list for output channels SOUNDTAG pSoundList[SOUND_MAX_CHANNELS]; @@ -196,10 +196,10 @@ void SoundEnableSound(BOOLEAN fEnable) //******************************************************************************* void *SoundGetDriverHandle( void ) { - if(fSoundSystemInit) - return(FSOUND_GetOutputHandle()); - else - return(NULL); + if(fSoundSystemInit) + return(FSOUND_GetOutputHandle()); + else + return(NULL); } //******************************************************************************* @@ -212,27 +212,27 @@ void *SoundGetDriverHandle( void ) //******************************************************************************* BOOLEAN InitializeSoundManager(void) { - UINT32 uiCount; + UINT32 uiCount; - InitLogging(); + InitLogging(); if(fSoundSystemInit) - { - SoundLog("Reopening JA2 sound manager"); + { + SoundLog("Reopening JA2 sound manager"); ShutdownSoundManager(); - } - else - SoundLog("Initialising JA2 sound manager"); - - SoundLog((CHAR8 *)String(" Using %d channels", SOUND_MAX_CHANNELS)); + } + else + SoundLog("Initialising JA2 sound manager"); + + SoundLog((CHAR8 *)String(" Using %d channels", SOUND_MAX_CHANNELS)); for(uiCount=0; uiCount < SOUND_MAX_CHANNELS; uiCount++) - { + { memset(&pSoundList[uiCount], 0, sizeof(SOUNDTAG)); - } + } - // Setup callbacks - FSOUND_File_SetCallbacks(SoundFileOpen, SoundFileClose, SoundFileRead, SoundFileSeek, SoundFileTell); + // Setup callbacks + FSOUND_File_SetCallbacks(SoundFileOpen, SoundFileClose, SoundFileRead, SoundFileSeek, SoundFileTell); #ifndef SOUND_DISABLE if(gfEnableStartup && SoundInitHardware()) @@ -241,8 +241,8 @@ BOOLEAN InitializeSoundManager(void) SoundInitCache(); - SoundLog((CHAR8 *)String(" Sound memory limit = %i", SOUND_DEFAULT_MEMORY)); - SoundLog((CHAR8 *)String(" Cache threshold = %i", SOUND_DEFAULT_THRESH)); + SoundLog((CHAR8 *)String(" Sound memory limit = %i", SOUND_DEFAULT_MEMORY)); + SoundLog((CHAR8 *)String(" Cache threshold = %i", SOUND_DEFAULT_THRESH)); guiSoundMemoryLimit=SOUND_DEFAULT_MEMORY; guiSoundMemoryUsed=0; @@ -260,20 +260,20 @@ BOOLEAN InitializeSoundManager(void) //******************************************************************************* void ShutdownSoundManager(void) { - SoundLog("Closing sound system..."); + SoundLog("Closing sound system..."); SoundStopAll(); SoundShutdownCache(); Sleep(1000); SoundShutdownHardware(); fSoundSystemInit=FALSE; - SoundLog("JA2 sound manager shutdown"); + SoundLog("JA2 sound manager shutdown"); } //******************************************************************************* // SoundPlay // -// Starts a sample playing. If the sample is not loaded in the cache, it will +// Starts a sample playing. If the sample is not loaded in the cache, it will // be found and loaded. The pParms structure is used to // override the attributes of the sample such as playback speed, and to specify // a volume. Any entry containing SOUND_PARMS_DEFAULT will be set by the system. @@ -283,7 +283,7 @@ void ShutdownSoundManager(void) // If an error occured, SOUND_ERROR will be returned // // -// !!Note: Can no longer play streamed files +// !!Note: Can no longer play streamed files // //******************************************************************************* @@ -339,7 +339,7 @@ UINT32 SoundPlayStreamedFile( STR pFilename, SOUNDPARMS *pParms ) hFile = FileOpen( pFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); if( !hFile ) { - SoundLog((CHAR8 *)String(" ERROR in SoundPlayStreamedFile(): Couldnt open '%s'", pFilename ) ); + SoundLog((CHAR8 *)String(" ERROR in SoundPlayStreamedFile(): Couldnt open '%s'", pFilename ) ); return( SOUND_ERROR ); } @@ -356,7 +356,7 @@ UINT32 SoundPlayStreamedFile( STR pFilename, SOUNDPARMS *pParms ) // Registers a sample to be played randomly within the specified parameters. // Parameters are passed in through pParms. Any parameter containing // SOUND_PARMS_DEFAULT will be set by the system. Only the uiTimeMin entry may -// NOT be defaulted. +// NOT be defaulted. // // * Samples designated "random" are ALWAYS loaded into the cache, and locked // in place. They are never double-buffered, and this call will fail if they @@ -369,14 +369,14 @@ UINT32 SoundPlayStreamedFile( STR pFilename, SOUNDPARMS *pParms ) UINT32 SoundPlayRandom(STR pFilename, RANDOMPARMS *pParms) { UINT32 uiSample; - + if(fSoundSystemInit) { if((uiSample=SoundLoadSample(pFilename))!=NO_SAMPLE) { // Sample loaded - marking slot pSampleList[uiSample].uiFlags|=(SAMPLE_RANDOM|SAMPLE_LOCKED); - + // Setup time intervals if(pParms->uiTimeMin==SOUND_PARMS_DEFAULT) return(SOUND_ERROR); @@ -401,15 +401,15 @@ UINT32 SoundPlayRandom(STR pFilename, RANDOMPARMS *pParms) // Panning if(pParms->uiPanMin==SOUND_PARMS_DEFAULT) - { + { pSampleList[uiSample].uiPanMin=128; - pSampleList[uiSample].uiPanMax=128; - } + pSampleList[uiSample].uiPanMax=128; + } else - { + { pSampleList[uiSample].uiPanMin=pParms->uiPanMin; - pSampleList[uiSample].uiPanMax=pParms->uiPanMax; - } + pSampleList[uiSample].uiPanMax=pParms->uiPanMax; + } // Max instances if(pParms->uiMaxInstances==SOUND_PARMS_DEFAULT) @@ -427,13 +427,13 @@ UINT32 SoundPlayRandom(STR pFilename, RANDOMPARMS *pParms) // Time stamp pSampleList[uiSample].uiTimeNext=GetTickCount()+pSampleList[uiSample].uiTimeMin+Random(pSampleList[uiSample].uiTimeMax-pSampleList[uiSample].uiTimeMin); - + return(uiSample); } - else - { - SoundLog((CHAR8 *)String(" ERROR in SoundPlayRandom(): Couldnt open '%s'", pFilename ) ); - } + else + { + SoundLog((CHAR8 *)String(" ERROR in SoundPlayRandom(): Couldnt open '%s'", pFilename ) ); + } } return(SOUND_ERROR); @@ -453,9 +453,9 @@ UINT32 uiSound; { uiSound=SoundGetIndexByID(uiSoundID); if(uiSound!=NO_SAMPLE) - { - return(SoundIndexIsPlaying(uiSound)); - } + { + return(SoundIndexIsPlaying(uiSound)); + } } return(FALSE); @@ -463,21 +463,21 @@ UINT32 uiSound; //***************************************************************************************** // SoundIndexIsPlaying -// -// Returns TRUE/FALSE whether a sound channel's sample is currently playing. -// -// Returns BOOLEAN - TRUE = playing, FALSE = stopped or nothing allocated -// -// UINT32 uiSound - Channel number of sound // -// Created: 2/24/00 Derek Beland +// Returns TRUE/FALSE whether a sound channel's sample is currently playing. +// +// Returns BOOLEAN - TRUE = playing, FALSE = stopped or nothing allocated +// +// UINT32 uiSound - Channel number of sound +// +// Created: 2/24/00 Derek Beland //***************************************************************************************** BOOLEAN SoundIndexIsPlaying(UINT32 uiSound) { if(fSoundSystemInit) { if( pSoundList[uiSound].hStream!=NULL ) - return(FSOUND_IsPlaying(pSoundList[uiSound].uiFMODChannel)); + return(FSOUND_IsPlaying(pSoundList[uiSound].uiFMODChannel)); } return(FALSE); @@ -495,7 +495,7 @@ BOOLEAN SoundIndexIsPlaying(UINT32 uiSound) BOOLEAN SoundStop(UINT32 uiSoundID) { UINT32 uiSound; - + if(fSoundSystemInit) { if(SoundIsPlaying(uiSoundID)) @@ -515,7 +515,7 @@ UINT32 uiSound; //******************************************************************************* // SoundSetMemoryLimit // -// Specifies how much memory the sound system is allowed to dynamically +// Specifies how much memory the sound system is allowed to dynamically // allocate. Once this limit is reached, the cache code will start dropping the // least-used samples. You should always set the limit higher by a good margin // than your actual memory requirements, to give the cache some elbow room. @@ -549,30 +549,30 @@ BOOLEAN SoundGetSystemInfo(void) //***************************************************************************************** // SoundSetDefaultVolume -// -// Sets the volume to use when a default is not chosen. -// -// Returns BOOLEAN - -// -// UINT32 uiVolume - // -// Created: 3/28/00 Derek Beland +// Sets the volume to use when a default is not chosen. +// +// Returns BOOLEAN - +// +// UINT32 uiVolume - +// +// Created: 3/28/00 Derek Beland //***************************************************************************************** void SoundSetDefaultVolume(UINT32 uiVolume) { guiSoundDefaultVolume=__min(uiVolume, MAX_VOLUME); } - + //***************************************************************************************** // SoundGetDefaultVolume -// -// -// -// Returns UINT32 - -// -// UINT32 uiVolume - // -// Created: 3/28/00 Derek Beland +// +// +// Returns UINT32 - +// +// UINT32 uiVolume - +// +// Created: 3/28/00 Derek Beland //***************************************************************************************** UINT32 SoundGetDefaultVolume(void) { @@ -591,14 +591,14 @@ BOOLEAN SoundStopAll(void) { UINT32 uiCount; - SoundLog(" Stopping all sounds"); + SoundLog(" Stopping all sounds"); if(fSoundSystemInit) { for(uiCount=0; uiCount < SOUND_MAX_CHANNELS; uiCount++) SoundStopIndex(uiCount); } - + return(TRUE); } @@ -606,7 +606,7 @@ UINT32 uiCount; //******************************************************************************* // SoundSetVolume // -// Sets the volume on a currently playing sound. +// Sets the volume on a currently playing sound. // // Returns: TRUE if the volume was actually set on the sample, FALSE if the // sample had already expired or couldn't be found @@ -616,32 +616,32 @@ BOOLEAN SoundSetVolume(UINT32 uiSoundID, UINT32 uiVolume) { UINT32 uiSound, uiVolCap; - if(fSoundSystemInit) + if(fSoundSystemInit) { - uiVolCap=__min(uiVolume, MAX_VOLUME); - + uiVolCap=__min(uiVolume, MAX_VOLUME); + if((uiSound=SoundGetIndexByID(uiSoundID))!=NO_SAMPLE) { pSoundList[uiSound].uiFadeVolume = uiVolume; - return(SoundSetVolumeIndex(uiSound, uiVolume)); + return(SoundSetVolumeIndex(uiSound, uiVolume)); } } - - return(FALSE); + + return(FALSE); } //***************************************************************************************** // SoundSetVolumeIndex -// -// Sounds the volume on a sound channel. -// -// Returns BOOLEAN - TRUE if the volume was set -// -// UINT32 uiChannel - Sound channel -// UINT32 uiVolume - New volume 0-127 // -// Created: 3/17/00 Derek Beland +// Sounds the volume on a sound channel. +// +// Returns BOOLEAN - TRUE if the volume was set +// +// UINT32 uiChannel - Sound channel +// UINT32 uiVolume - New volume 0-127 +// +// Created: 3/17/00 Derek Beland //***************************************************************************************** BOOLEAN SoundSetVolumeIndex(UINT32 uiChannel, UINT32 uiVolume) { @@ -649,12 +649,12 @@ UINT32 uiVolCap; if(fSoundSystemInit) { - uiVolCap=__min(uiVolume, MAX_VOLUME); - - if( pSoundList[uiChannel].hStream!=NULL ) - FSOUND_SetVolume(pSoundList[uiChannel].uiFMODChannel, uiVolCap * 2); + uiVolCap=__min(uiVolume, MAX_VOLUME); - return(TRUE); + if( pSoundList[uiChannel].hStream!=NULL ) + FSOUND_SetVolume(pSoundList[uiChannel].uiFMODChannel, uiVolCap * 2); + + return(TRUE); } return(FALSE); @@ -663,7 +663,7 @@ UINT32 uiVolCap; //******************************************************************************* // SoundSetPan // -// Sets the pan on a currently playing sound. +// Sets the pan on a currently playing sound. // // Returns: TRUE if the pan was actually set on the sample, FALSE if the // sample had already expired or couldn't be found @@ -675,8 +675,8 @@ UINT32 uiSound, uiPanCap; if(fSoundSystemInit) { - uiPanCap=__min(uiPan, 255); - + uiPanCap=__min(uiPan, 255); + if((uiSound=SoundGetIndexByID(uiSoundID))!=NO_SAMPLE) { if( pSoundList[uiSound].hStream!=NULL ) @@ -713,18 +713,18 @@ UINT32 uiSound; //***************************************************************************************** // SoundGetVolumeIndex -// -// Returns the current volume of a sound channel. -// -// Returns UINT32 - Volume 0-127 -// -// UINT32 uiChannel - Channel // -// Created: 3/17/00 Derek Beland +// Returns the current volume of a sound channel. +// +// Returns UINT32 - Volume 0-127 +// +// UINT32 uiChannel - Channel +// +// Created: 3/17/00 Derek Beland //***************************************************************************************** UINT32 SoundGetVolumeIndex(UINT32 uiChannel) { - if(fSoundSystemInit) + if(fSoundSystemInit) { if( pSoundList[uiChannel].hStream!=NULL ) return((UINT32)FSOUND_GetVolume(pSoundList[uiChannel].uiFMODChannel) / 2); @@ -739,10 +739,10 @@ UINT32 SoundGetVolumeIndex(UINT32 uiChannel) // This function should be polled by the application if random samples are // used. The time marks on each are checked and if it is time to spawn a new // instance of the sound, the number already in existance are checked, and if -// there is room, a new one is made and the count updated. +// there is room, a new one is made and the count updated. // If random samples are not being used, there is no purpose in polling this // function. -// +// // Returns: TRUE if a new random sound was created, FALSE if nothing was done. // //******************************************************************************* @@ -751,7 +751,7 @@ BOOLEAN SoundServiceRandom(void) UINT32 uiCount; BOOLEAN fRandomSoundWasCreated=FALSE; - for(uiCount=0; uiCount < SOUND_MAX_CACHED; uiCount++) + for(uiCount=0; uiCount < SOUND_MAX_CACHED; uiCount++) { if(!(pSampleList[uiCount].uiFlags&SAMPLE_RANDOM_MANUAL) && SoundRandomShouldPlay(uiCount)) fRandomSoundWasCreated |= SoundStartRandom(uiCount); @@ -764,7 +764,7 @@ BOOLEAN fRandomSoundWasCreated=FALSE; // SoundRandomShouldPlay // // Determines whether a random sound is ready for playing or not. -// +// // Returns: TRUE if a the sample should be played. // //******************************************************************************* @@ -773,9 +773,9 @@ BOOLEAN SoundRandomShouldPlay(UINT32 uiSample) if(pSampleList[uiSample].uiFlags&SAMPLE_RANDOM) if(pSampleList[uiSample].uiTimeNext <= GetTickCount()) if(pSampleList[uiSample].uiInstances < pSampleList[uiSample].uiMaxInstances) - { + { return(TRUE); - } + } return(FALSE); } @@ -784,7 +784,7 @@ BOOLEAN SoundRandomShouldPlay(UINT32 uiSample) // SoundStartRandom // // Starts an instance of a random sample. -// +// // Returns: TRUE if a new random sound was created, FALSE if nothing was done. // //******************************************************************************* @@ -793,7 +793,7 @@ UINT32 SoundStartRandom(UINT32 uiSample) UINT32 uiChannel, uiSoundID; SOUNDPARMS spParms; - if((uiChannel=SoundGetFreeChannel())!=SOUND_ERROR) + if((uiChannel=SoundGetFreeChannel())!=SOUND_ERROR) { memset(&spParms, 0xff, sizeof(SOUNDPARMS)); @@ -806,14 +806,14 @@ SOUNDPARMS spParms; { pSampleList[uiSample].uiTimeNext=GetTickCount()+pSampleList[uiSample].uiTimeMin+Random(pSampleList[uiSample].uiTimeMax-pSampleList[uiSample].uiTimeMin); pSampleList[uiSample].uiInstances++; - //SoundLog((CHAR8 *)String(" SoundPlayRandom(): Sample #%d = '%s'", uiSample, pFilename ) ); + //SoundLog((CHAR8 *)String(" SoundPlayRandom(): Sample #%d = '%s'", uiSample, pFilename ) ); return(TRUE); } - else - SoundLog((CHAR8 *)String(" ERROR in SoundStartRandom(): Sample #%d start error - %s", uiSample, FMOD_ErrorString(FSOUND_GetError()))); + else + SoundLog((CHAR8 *)String(" ERROR in SoundStartRandom(): Sample #%d start error - %s", uiSample, FMOD_ErrorString(FSOUND_GetError()))); } - else - SoundLog(" ERROR in SoundStartRandom(): Failed to get free channel"); + else + SoundLog(" ERROR in SoundStartRandom(): Failed to get free channel"); return(FALSE); } @@ -823,10 +823,10 @@ SOUNDPARMS spParms; // This function should be polled by the application if random samples are // used. The time marks on each are checked and if it is time to spawn a new // instance of the sound, the number already in existance are checked, and if -// there is room, a new one is made and the count updated. +// there is room, a new one is made and the count updated. // If random samples are not being used, there is no purpose in polling this // function. -// +// // Returns: TRUE if a new random sound was created, FALSE if nothing was done. // //******************************************************************************* @@ -837,10 +837,10 @@ UINT32 uiChannel, uiSample; // Stop all currently playing random sounds for(uiChannel=0; uiChannel < SOUND_MAX_CHANNELS; uiChannel++) { - if( pSoundList[uiChannel].hStream!=NULL ) + if( pSoundList[uiChannel].hStream!=NULL ) { uiSample=pSoundList[uiChannel].uiSample; - + // if this was a random sample, decrease the iteration count if ( (uiSample != -1) && (pSampleList[uiSample].uiFlags&SAMPLE_RANDOM) ) SoundStopIndex(uiChannel); @@ -854,7 +854,7 @@ UINT32 uiChannel, uiSample; if(pSampleList[uiSample].uiFlags & SAMPLE_RANDOM) pSampleList[uiSample].uiFlags &= (~(SAMPLE_RANDOM | SAMPLE_LOCKED)); } - + return(TRUE); } @@ -867,7 +867,7 @@ UINT32 uiChannel, uiSample; // // If you are using the end of sample callbacks, you must call this function // periodically to check the sample's status. -// +// // Returns: TRUE always. // //******************************************************************************* @@ -875,17 +875,17 @@ BOOLEAN SoundServiceStreams(void) { UINT32 uiCount; - if(fSoundSystemInit) + if(fSoundSystemInit) { for(uiCount=0; uiCount < SOUND_MAX_CHANNELS; uiCount++) { - if( (pSoundList[uiCount].hStream!=NULL) && (pSoundList[uiCount].uiSample==-1) ) + if( (pSoundList[uiCount].hStream!=NULL) && (pSoundList[uiCount].uiSample==-1) ) { // If a sound has a handle, but isn't playing, stop it and free up the handle if(!SoundIsPlaying(pSoundList[uiCount].uiSoundID)) - { + { SoundStopIndex(uiCount); - } + } else { // Check the volume fades on currently playing sounds UINT32 uiVolume = SoundGetVolumeIndex(uiCount); @@ -899,10 +899,10 @@ UINT32 uiCount; { uiVolume--; if(!uiVolume && pSoundList[uiCount].fStopAtZero) - { + { SoundStopIndex(uiCount); - SoundLog((CHAR8 *)String(" SoundServiceStreams(): Stop at zero volume on channel %d", uiCount)); - } + SoundLog((CHAR8 *)String(" SoundServiceStreams(): Stop at zero volume on channel %d", uiCount)); + } else SoundSetVolumeIndex(uiCount, uiVolume); } @@ -921,7 +921,7 @@ UINT32 uiCount; //******************************************************************************* // SoundGetPosition // -// Reports the current time position of the sample. +// Reports the current time position of the sample. // // Note: You should be checking SoundIsPlaying very carefully while // calling this function. @@ -946,7 +946,7 @@ UINT32 uiSound, uiTime, uiPosition; return(uiPosition); } - } + } return(0); } @@ -963,15 +963,15 @@ UINT32 uiSound, uiTime, uiPosition; //******************************************************************************* BOOLEAN SoundInitCache(void) { - UINT32 uiCount; + UINT32 uiCount; - SoundLog("Init cache..."); - SoundLog((CHAR8 *)String(" Using %d cache slots", SOUND_MAX_CACHED)); + SoundLog("Init cache..."); + SoundLog((CHAR8 *)String(" Using %d cache slots", SOUND_MAX_CACHED)); for(uiCount=0; uiCount < SOUND_MAX_CACHED; uiCount++) - { + { memset(&pSampleList[uiCount], 0, sizeof(SAMPLETAG)); - } + } return(TRUE); } @@ -987,14 +987,14 @@ BOOLEAN SoundInitCache(void) BOOLEAN SoundShutdownCache(void) { SoundEmptyCache(); - SoundLog("Cache shutdown"); + SoundLog("Cache shutdown"); return(TRUE); } //******************************************************************************* // SoundSetCacheThreshold // -// Sets the sound size above which samples will be played double-buffered, +// Sets the sound size above which samples will be played double-buffered, // below which they will be loaded into the cache. // // Returns: TRUE, always @@ -1014,7 +1014,7 @@ BOOLEAN SoundSetCacheThreshhold(UINT32 uiThreshold) // SoundEmptyCache // // Frees up all samples in the cache. -// +// // Returns: TRUE, always // //******************************************************************************* @@ -1022,7 +1022,7 @@ BOOLEAN SoundEmptyCache(void) { UINT32 uiCount; - SoundLog("Cleaning cache"); + SoundLog("Cleaning cache"); SoundStopAll(); for(uiCount=0; uiCount < SOUND_MAX_CACHED; uiCount++) @@ -1036,7 +1036,7 @@ UINT32 uiCount; // SoundLoadSample // // Loads a sample into cache. -// +// // Returns: Sample index, if OK. NO_SAMPLE - if error. // //******************************************************************************* @@ -1055,7 +1055,7 @@ UINT32 uiSample=NO_SAMPLE; // // Locks a sample into cache memory, so the cacheing system won't release it // when it needs room. -// +// // Returns: The sample index if successful, NO_SAMPLE if the file wasn't found // in the cache. // @@ -1077,7 +1077,7 @@ UINT32 uiSample; // SoundUnlockSample // // Removes the lock on a sample so the cache is free to dump it when necessary. -// +// // Returns: The sample index if successful, NO_SAMPLE if the file wasn't found // in the cache. // @@ -1099,7 +1099,7 @@ UINT32 uiSample; // SoundFreeSample // // Releases the resources associated with a sample from the cache. -// +// // Returns: The sample index if successful, NO_SAMPLE if the file wasn't found // in the cache. // @@ -1116,7 +1116,7 @@ UINT32 uiSample; return(uiSample); } } - + return(NO_SAMPLE); } @@ -1125,7 +1125,7 @@ UINT32 uiSample; // // Tries to locate a sound by looking at what is currently loaded in the // cache. -// +// // Returns: The sample index if successful, NO_SAMPLE if the file wasn't found // in the cache. // @@ -1139,7 +1139,7 @@ UINT32 uiCount; if(_stricmp(pSampleList[uiCount].pName, pFilename)==0) return(uiCount); } - + return(NO_SAMPLE); } @@ -1147,9 +1147,9 @@ UINT32 uiCount; // SoundLoadDisk // // Loads a sound file from disk into the cache, allocating memory and a slot -// for storage. -// -// +// for storage. +// +// // Returns: The sample index if successful, NO_SAMPLE if the file wasn't found // in the cache. // @@ -1163,7 +1163,7 @@ BOOLEAN fRemoved; if((hFile=FileOpen(pFilename, FILE_ACCESS_READ, FALSE))!=0) { uiSize=FileGetSize(hFile); - + // if insufficient memory, start unloading old samples until either // there's nothing left to unload, or we fit fRemoved=TRUE; @@ -1173,7 +1173,7 @@ BOOLEAN fRemoved; // if we still don't fit if((uiSize + guiSoundMemoryUsed) > guiSoundMemoryLimit) { - SoundLog((CHAR8 *)String(" ERROR in SoundLoadDisk(): trying to play '%s', not enough memory", pFilename ) ); + SoundLog((CHAR8 *)String(" ERROR in SoundLoadDisk(): trying to play '%s', not enough memory", pFilename ) ); FileClose(hFile); return(NO_SAMPLE); } @@ -1188,7 +1188,7 @@ BOOLEAN fRemoved; // if we still don't have a sample slot if(uiSample==NO_SAMPLE) { - SoundLog((CHAR8 *)String(" ERROR in SoundLoadDisk(): Trying to play '%s', cache slots are full", pFilename ) ); + SoundLog((CHAR8 *)String(" ERROR in SoundLoadDisk(): Trying to play '%s', cache slots are full", pFilename ) ); FileClose(hFile); return(NO_SAMPLE); } @@ -1197,7 +1197,7 @@ BOOLEAN fRemoved; if((pSampleList[uiSample].pData=MemAlloc(uiSize))==NULL) { - SoundLog((CHAR8 *)String(" ERROR in SoundLoadDisk(): Trying to play '%s', memory allocation failed", pFilename ) ); + SoundLog((CHAR8 *)String(" ERROR in SoundLoadDisk(): Trying to play '%s', memory allocation failed", pFilename ) ); FileClose(hFile); return(NO_SAMPLE); } @@ -1214,10 +1214,10 @@ BOOLEAN fRemoved; return(uiSample); } - else - { - SoundLog((CHAR8 *)String(" ERROR in SoundLoadDisk(): Failed to open '%s'", pFilename)); - } + else + { + SoundLog((CHAR8 *)String(" ERROR in SoundLoadDisk(): Failed to open '%s'", pFilename)); + } return(NO_SAMPLE); } @@ -1226,8 +1226,8 @@ BOOLEAN fRemoved; // SoundCleanCache // // Removes the least-used sound from the cache to make room. -// -// Returns: TRUE if a sample was freed, FALSE if none +// +// Returns: TRUE if a sample was freed, FALSE if none // //******************************************************************************* BOOLEAN SoundCleanCache(void) @@ -1250,7 +1250,7 @@ UINT32 uiCount, uiLowestHits=NO_SAMPLE, uiLowestHitsCount=0; } } - if(uiLowestHits!=NO_SAMPLE) + if(uiLowestHits!=NO_SAMPLE) { SoundFreeSampleIndex(uiLowestHits); return(TRUE); @@ -1286,7 +1286,7 @@ UINT32 uiCount; // SoundGetEmptySample // // Returns the slot number of an available sample index. -// +// // Returns: A free sample index, or NO_SAMPLE if none are left. // //******************************************************************************* @@ -1306,8 +1306,8 @@ UINT32 uiCount; //******************************************************************************* // SoundFreeSampleIndex // -// Frees up a sample referred to by it's index slot number. -// +// Frees up a sample referred to by it's index slot number. +// // Returns: Slot number if something was free, NO_SAMPLE otherwise. // //******************************************************************************* @@ -1324,7 +1324,7 @@ UINT32 SoundFreeSampleIndex(UINT32 uiSample) memset(&pSampleList[uiSample], 0, sizeof(SAMPLETAG)); return(uiSample); } - + return(NO_SAMPLE); } @@ -1332,7 +1332,7 @@ UINT32 SoundFreeSampleIndex(UINT32 uiSample) // SoundGetIndexByID // // Searches out a sound instance referred to by it's ID number. -// +// // Returns: If the instance was found, the slot number. NO_SAMPLE otherwise. // //******************************************************************************* @@ -1354,7 +1354,7 @@ UINT32 uiCount; // // Initializes the sound hardware through Windows/DirectX. THe highest possible // mixing rate and capabilities set are searched out and used. -// +// // Returns: TRUE if the hardware was initialized, FALSE otherwise. // //******************************************************************************* @@ -1362,45 +1362,45 @@ BOOLEAN SoundInitHardware(void) { UINT32 uiCaps; - SoundLog("Init hardware..."); + SoundLog("Init hardware..."); // Try to start up the FMOD Sound System - FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND); - FSOUND_SetBufferSize(AUDIO_BUFFER_LEN); - SoundLog((CHAR8 *)String(" Using DirectSound driver: %s", FSOUND_GetDriverName(FSOUND_GetDriver()))); - SoundLog(" Driver capabilities:"); + FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND); + FSOUND_SetBufferSize(AUDIO_BUFFER_LEN); + SoundLog((CHAR8 *)String(" Using DirectSound driver: %s", FSOUND_GetDriverName(FSOUND_GetDriver()))); + SoundLog(" Driver capabilities:"); FSOUND_GetDriverCaps( FSOUND_GetDriver(), &uiCaps ); if ( uiCaps & FSOUND_CAPS_HARDWARE ) - SoundLog(" - supports hardware accelerated 3d sound"); + SoundLog(" - supports hardware accelerated 3d sound"); if ( uiCaps & FSOUND_CAPS_EAX2 ) - SoundLog(" - supports EAX 2 reverb"); + SoundLog(" - supports EAX 2 reverb"); if ( uiCaps & FSOUND_CAPS_EAX3 ) - SoundLog(" - supports EAX 3 reverb"); + SoundLog(" - supports EAX 3 reverb"); if( !FSOUND_Init(44100, SOUND_MAX_CHANNELS, FSOUND_INIT_GLOBALFOCUS|FSOUND_INIT_DONTLATENCYADJUST) ) - { - SoundLog((CHAR8 *)String(" ERROR in SoundInitHardware(): %s", FMOD_ErrorString(FSOUND_GetError()))); + { + SoundLog((CHAR8 *)String(" ERROR in SoundInitHardware(): %s", FMOD_ErrorString(FSOUND_GetError()))); return(FALSE); - } + } - SoundLog(" FMOD started"); - SoundLog((CHAR8 *)String(" Mixing rate: %d", FSOUND_GetOutputRate())); + SoundLog(" FMOD started"); + SoundLog((CHAR8 *)String(" Mixing rate: %d", FSOUND_GetOutputRate())); // Driver is ready hSoundDriver = TRUE; fDirectSound = TRUE; - return(hSoundDriver); + return(hSoundDriver); } //******************************************************************************* // SoundShutdownHardware // -// Shuts down the system hardware. -// +// Shuts down the system hardware. +// // Returns: TRUE always. // //******************************************************************************* @@ -1408,8 +1408,8 @@ BOOLEAN SoundShutdownHardware(void) { if(fSoundSystemInit) FSOUND_Close(); - - SoundLog(" FMOD closed"); + + SoundLog(" FMOD closed"); return(TRUE); } @@ -1417,7 +1417,7 @@ BOOLEAN SoundShutdownHardware(void) // SoundGetFreeChannel // // Finds an unused sound channel in the channel list. -// +// // Returns: Index of a sound channel if one was found, SOUND_ERROR if not. // //******************************************************************************* @@ -1436,7 +1436,7 @@ UINT32 uiCount; return(uiCount); } - return(SOUND_ERROR); + return(SOUND_ERROR); } //******************************************************************************* @@ -1445,7 +1445,7 @@ UINT32 uiCount; // Starts up a sample on the specified channel. Override parameters are passed // in through the structure pointer pParms. Any entry with a value of 0xffffffff // will be filled in by the system. -// +// // Returns: Unique sound ID if successful, SOUND_ERROR if not. // //******************************************************************************* @@ -1453,22 +1453,22 @@ UINT32 SoundStartSample(UINT32 uiSample, UINT32 uiChannel, SOUNDPARMS *pParms) { UINT32 uiSoundID; - if(!fSoundSystemInit) + if(!fSoundSystemInit) return(SOUND_ERROR); - // Setting up stream buffer - FSOUND_Stream_SetBufferSize(STREAM_BUFFER_LEN); + // Setting up stream buffer + FSOUND_Stream_SetBufferSize(STREAM_BUFFER_LEN); - // Creating stream - pSoundList[uiChannel].hStream=FSOUND_Stream_Open((STR8) pSampleList[uiSample].pData, FSOUND_LOADMEMORY|FSOUND_LOOP_NORMAL|FSOUND_2D, 0, pSampleList[uiSample].uiSize); + // Creating stream + pSoundList[uiChannel].hStream=FSOUND_Stream_Open((STR8) pSampleList[uiSample].pData, FSOUND_LOADMEMORY|FSOUND_LOOP_NORMAL|FSOUND_2D, 0, pSampleList[uiSample].uiSize); if(pSoundList[uiChannel].hStream==NULL) { - SoundLog((CHAR8 *)String(" ERROR in SoundStartSample(): %s", FMOD_ErrorString(FSOUND_GetError()) )); + SoundLog((CHAR8 *)String(" ERROR in SoundStartSample(): %s", FMOD_ErrorString(FSOUND_GetError()) )); return(SOUND_ERROR); } - // Setup sample params - // Loop + // Setup sample params + // Loop if((pParms!=NULL) && (pParms->uiLoop!=SOUND_PARMS_DEFAULT)) { // If looping infinately, lock the sample so it can't be unloaded @@ -1478,43 +1478,43 @@ UINT32 uiSoundID; pSampleList[uiSample].uiFlags|=SAMPLE_LOCKED; pSoundList[uiChannel].fLooping=TRUE; } - else - FSOUND_Stream_SetLoopCount(pSoundList[uiChannel].hStream, pParms->uiLoop-1); + else + FSOUND_Stream_SetLoopCount(pSoundList[uiChannel].hStream, pParms->uiLoop-1); } - // Starting stream in pause - pSoundList[uiChannel].uiFMODChannel = FSOUND_Stream_PlayEx(uiChannel, pSoundList[uiChannel].hStream, NULL, TRUE); - if(pSoundList[uiChannel].uiFMODChannel==-1) - { - FSOUND_Stream_Close(pSoundList[uiChannel].hStream); - SoundLog((CHAR8 *)String(" ERROR in SoundStartSample(): %s", FMOD_ErrorString(FSOUND_GetError()) )); + // Starting stream in pause + pSoundList[uiChannel].uiFMODChannel = FSOUND_Stream_PlayEx(uiChannel, pSoundList[uiChannel].hStream, NULL, TRUE); + if(pSoundList[uiChannel].uiFMODChannel==-1) + { + FSOUND_Stream_Close(pSoundList[uiChannel].hStream); + SoundLog((CHAR8 *)String(" ERROR in SoundStartSample(): %s", FMOD_ErrorString(FSOUND_GetError()) )); return(SOUND_ERROR); - } + } // Speed and pitchbend don't use - // Volume + // Volume if((pParms!=NULL) && (pParms->uiVolume!=SOUND_PARMS_DEFAULT)) FSOUND_SetVolume(pSoundList[uiChannel].uiFMODChannel, pParms->uiVolume * 2); else FSOUND_SetVolume(pSoundList[uiChannel].uiFMODChannel, guiSoundDefaultVolume); - // Panning + // Panning if((pParms!=NULL) && (pParms->uiPan!=SOUND_PARMS_DEFAULT)) FSOUND_SetPan(pSoundList[uiChannel].uiFMODChannel, pParms->uiPan); - else - FSOUND_SetPan(pSoundList[uiChannel].uiFMODChannel, 128); + else + FSOUND_SetPan(pSoundList[uiChannel].uiFMODChannel, 128); - // Start sound! - FSOUND_SetPaused(pSoundList[uiChannel].uiFMODChannel, FALSE); + // Start sound! + FSOUND_SetPaused(pSoundList[uiChannel].uiFMODChannel, FALSE); - // Priority + // Priority if((pParms!=NULL) && (pParms->uiPriority!=SOUND_PARMS_DEFAULT)) pSoundList[uiChannel].uiPriority=pParms->uiPriority; else pSoundList[uiChannel].uiPriority=PRIORITY_MAX; - // Callback at end of playback + // Callback at end of playback if((pParms!=NULL) && ((UINT32)pParms->EOSCallback!=SOUND_PARMS_DEFAULT)) { pSoundList[uiChannel].EOSCallback=pParms->EOSCallback; @@ -1525,14 +1525,14 @@ UINT32 uiSoundID; pSoundList[uiChannel].EOSCallback=NULL; pSoundList[uiChannel].pCallbackData=NULL; } - - // Other stuff... + + // Other stuff... uiSoundID=SoundGetUniqueID(); pSoundList[uiChannel].uiSoundID=uiSoundID; pSoundList[uiChannel].uiSample=uiSample; pSoundList[uiChannel].uiTimeStamp=GetTickCount(); pSoundList[uiChannel].uiFadeVolume = SoundGetVolumeIndex(uiChannel); - + pSampleList[uiSample].uiCacheHits++; return(uiSoundID); @@ -1544,7 +1544,7 @@ UINT32 uiSoundID; // Starts up a stream on the specified channel. Override parameters are passed // in through the structure pointer pParms. Any entry with a value of 0xffffffff // will be filled in by the system. -// +// // Returns: Unique sound ID if successful, SOUND_ERROR if not. // //******************************************************************************* @@ -1555,60 +1555,60 @@ UINT32 uiSoundID; if(!fSoundSystemInit) return(SOUND_ERROR); - // Setting up stream buffer - FSOUND_Stream_SetBufferSize(STREAM_BUFFER_LEN); + // Setting up stream buffer + FSOUND_Stream_SetBufferSize(STREAM_BUFFER_LEN); - // Creating stream + // Creating stream pSoundList[uiChannel].hStream=FSOUND_Stream_Open(pFilename, FSOUND_LOOP_NORMAL|FSOUND_2D, 0, 0); if(pSoundList[uiChannel].hStream==NULL) { - SoundLog((CHAR8 *)String(" ERROR in SoundStartStream(): %s ('%s')", FMOD_ErrorString(FSOUND_GetError()), pFilename)); + SoundLog((CHAR8 *)String(" ERROR in SoundStartStream(): %s ('%s')", FMOD_ErrorString(FSOUND_GetError()), pFilename)); return(SOUND_ERROR); } - - // Setup params - // Loop + + // Setup params + // Loop if( (pParms!=NULL) && (pParms->uiLoop!=SOUND_PARMS_DEFAULT ) ) { if(pParms->uiLoop>0) - FSOUND_Stream_SetLoopCount(pSoundList[uiChannel].hStream, pParms->uiLoop-1); - } + FSOUND_Stream_SetLoopCount(pSoundList[uiChannel].hStream, pParms->uiLoop-1); + } - // Starting stream in pause - pSoundList[uiChannel].uiFMODChannel = FSOUND_Stream_PlayEx(uiChannel, pSoundList[uiChannel].hStream, NULL, TRUE); - if(pSoundList[uiChannel].uiFMODChannel==-1) - { - FSOUND_Stream_Close(pSoundList[uiChannel].hStream); - SoundLog((CHAR8 *)String(" ERROR in SoundStartStream(): %s ('%s')", FMOD_ErrorString(FSOUND_GetError()), pFilename)); + // Starting stream in pause + pSoundList[uiChannel].uiFMODChannel = FSOUND_Stream_PlayEx(uiChannel, pSoundList[uiChannel].hStream, NULL, TRUE); + if(pSoundList[uiChannel].uiFMODChannel==-1) + { + FSOUND_Stream_Close(pSoundList[uiChannel].hStream); + SoundLog((CHAR8 *)String(" ERROR in SoundStartStream(): %s ('%s')", FMOD_ErrorString(FSOUND_GetError()), pFilename)); return(SOUND_ERROR); - } + } - // Speed and pitchbend don't use + // Speed and pitchbend don't use - // Volume + // Volume if((pParms!=NULL) && (pParms->uiVolume!=SOUND_PARMS_DEFAULT)) FSOUND_SetVolume(pSoundList[uiChannel].uiFMODChannel, pParms->uiVolume * 2); else FSOUND_SetVolume(pSoundList[uiChannel].uiFMODChannel, guiSoundDefaultVolume); - // Panning + // Panning if((pParms!=NULL) && (pParms->uiPan!=SOUND_PARMS_DEFAULT)) FSOUND_SetPan(pSoundList[uiChannel].uiFMODChannel, pParms->uiPan); - // Start sound! + // Start sound! FSOUND_SetPaused(pSoundList[uiChannel].uiFMODChannel, FALSE); - // Get ID + // Get ID uiSoundID=SoundGetUniqueID(); pSoundList[uiChannel].uiSoundID=uiSoundID; - // Priority + // Priority if(pParms) pSoundList[uiChannel].uiPriority=pParms->uiPriority; else pSoundList[uiChannel].uiPriority=SOUND_PARMS_DEFAULT; - // Callback at end of playback + // Callback at end of playback if((pParms!=NULL) && ((UINT32)pParms->EOSCallback!=SOUND_PARMS_DEFAULT)) { pSoundList[uiChannel].EOSCallback=pParms->EOSCallback; @@ -1620,12 +1620,12 @@ UINT32 uiSoundID; pSoundList[uiChannel].pCallbackData=NULL; } - // Other stuff + // Other stuff pSoundList[uiChannel].uiTimeStamp=GetTickCount(); pSoundList[uiChannel].uiFadeVolume = SoundGetVolumeIndex(uiChannel); - pSoundList[uiChannel].uiSample = -1; // it's streaming directly from file !!!! + pSoundList[uiChannel].uiSample = -1; // it's streaming directly from file !!!! - return(uiSoundID); + return(uiSoundID); } // ------------------------ @@ -1633,44 +1633,44 @@ UINT32 uiSoundID; // ======================== static void * F_CALLBACKAPI SoundFileOpen(const STR8 pName) { - return((void*)FileOpen(pName, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE)); + return((void*)FileOpen(pName, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE)); } static void F_CALLBACKAPI SoundFileClose(void *uiHandle) { - FileClose((UINT32)uiHandle); + FileClose((UINT32)uiHandle); } static INT F_CALLBACKAPI SoundFileRead(void *pBuffer, INT iSize, void *uiHandle) { - UINT32 uiActuallyRead; + UINT32 uiActuallyRead; - FileRead((UINT32)uiHandle, pBuffer, iSize, &uiActuallyRead); - return(uiActuallyRead); + FileRead((UINT32)uiHandle, pBuffer, iSize, &uiActuallyRead); + return(uiActuallyRead); } static INT F_CALLBACKAPI SoundFileSeek(void *uiHandle, INT iPos, signed char cMode) { - UINT8 uiHow; + UINT8 uiHow; - switch(cMode) - { - case SEEK_END: - uiHow = FILE_SEEK_FROM_END; - break; - case SEEK_CUR: - uiHow = FILE_SEEK_FROM_CURRENT; - break; - default: - uiHow = FILE_SEEK_FROM_START; - } + switch(cMode) + { + case SEEK_END: + uiHow = FILE_SEEK_FROM_END; + break; + case SEEK_CUR: + uiHow = FILE_SEEK_FROM_CURRENT; + break; + default: + uiHow = FILE_SEEK_FROM_START; + } - return(!FileSeek((UINT32)uiHandle, iPos, uiHow)); + return(!FileSeek((UINT32)uiHandle, iPos, uiHow)); } static INT F_CALLBACKAPI SoundFileTell(void *uiHandle) { - return(FileGetPos((UINT32)uiHandle)); + return(FileGetPos((UINT32)uiHandle)); } //******************************************************************************* @@ -1696,7 +1696,7 @@ static UINT32 uiNextID=0; // Returns TRUE/FALSE whether a sound file should be played as a streamed // sample, or loaded into the cache. The decision is based on the size of the // file compared to the guiSoundCacheThreshold. -// +// // Returns: TRUE if it should be streamed, FALSE if loaded. // //******************************************************************************* @@ -1722,7 +1722,7 @@ UINT32 uiFilesize; // one that should be deallocating sample handles. The random sounds have to have // their counters maintained, and using this as the central function ensures // that they stay in sync. -// +// // Returns: TRUE if the sample was stopped, FALSE if it could not be found. // //******************************************************************************* @@ -1737,23 +1737,23 @@ UINT32 uiSample; if(pSoundList[uiChannel].hStream!=NULL) { FSOUND_Stream_Stop(pSoundList[uiChannel].hStream); - FSOUND_Stream_Close(pSoundList[uiChannel].hStream); + FSOUND_Stream_Close(pSoundList[uiChannel].hStream); - uiSample=pSoundList[uiChannel].uiSample; + uiSample=pSoundList[uiChannel].uiSample; - // if this was a random sample, decrease the iteration count + // if this was a random sample, decrease the iteration count if ( (uiSample != -1) && (pSampleList[uiSample].uiFlags&SAMPLE_RANDOM) ) pSampleList[uiSample].uiInstances--; - if(pSoundList[uiChannel].EOSCallback!=NULL) + if(pSoundList[uiChannel].EOSCallback!=NULL) pSoundList[uiChannel].EOSCallback(pSoundList[uiChannel].pCallbackData); - if(!pSoundList[uiChannel].fLooping && !SoundSampleIsInUse(uiChannel)) + if(!pSoundList[uiChannel].fLooping && !SoundSampleIsInUse(uiChannel)) SoundRemoveSampleFlags(uiSample, SAMPLE_LOCKED); - memset(&pSoundList[uiChannel], 0, sizeof(SOUNDTAG)); + memset(&pSoundList[uiChannel], 0, sizeof(SOUNDTAG)); } - + return(TRUE); } } @@ -1807,33 +1807,33 @@ UINT32 uiCount; //***************************************************************************************** // SoundLog -// Writes string into log file -// -// Returns nothing -// -// Created: 10.12.2005 Lesh +// Writes string into log file +// +// Returns nothing +// +// Created: 10.12.2005 Lesh //***************************************************************************************** void SoundLog(CHAR8 *strMessage) { if ((SndDebug = fopen(SndDebugFileName, "a+t")) != NULL) - { - fprintf(SndDebug, "%s\n", strMessage); + { + fprintf(SndDebug, "%s\n", strMessage); fclose(SndDebug); } } //***************************************************************************************** // InitLogging -// Creates empty log file -// -// Returns nothing -// -// Created: 10.12.2005 Lesh +// Creates empty log file +// +// Returns nothing +// +// Created: 10.12.2005 Lesh //***************************************************************************************** void InitLogging() { if ((SndDebug = fopen(SndDebugFileName, "wt")) != NULL) - { + { fclose(SndDebug); } -} \ No newline at end of file +} diff --git a/Standard Gaming Platform/soundman.h b/Standard Gaming Platform/soundman.h index 2d1f71f1..0ab6ce76 100644 --- a/Standard Gaming Platform/soundman.h +++ b/Standard Gaming Platform/soundman.h @@ -57,7 +57,7 @@ extern void ShutdownSoundManager(void); // Configuration functions extern BOOLEAN SoundSetMemoryLimit(UINT32 uiLimit); extern BOOLEAN SoundSetCacheThreshhold(UINT32 uiThreshold); -extern void * SoundGetDriverHandle( void ); +extern void * SoundGetDriverHandle( void ); // Master volume control functions extern void SoundSetDefaultVolume(UINT32 uiVolume); diff --git a/Standard Gaming Platform/stringicmp.cpp b/Standard Gaming Platform/stringicmp.cpp index 8a60e4da..b354b579 100644 --- a/Standard Gaming Platform/stringicmp.cpp +++ b/Standard Gaming Platform/stringicmp.cpp @@ -2,7 +2,6 @@ // Snap: Implementation of case-insensitive string comparison classes // #include "stringicmp.h" -//#include #include diff --git a/Standard Gaming Platform/timer.cpp b/Standard Gaming Platform/timer.cpp index 0c05b222..b1fb0250 100644 --- a/Standard Gaming Platform/timer.cpp +++ b/Standard Gaming Platform/timer.cpp @@ -22,52 +22,52 @@ UINT32 guiCurrentTime; void CALLBACK Clock( HWND hWindow, UINT uMessage, UINT idEvent, DWORD dwTime ) { - guiCurrentTime = GetTickCount(); - if (guiCurrentTime < guiStartupTime) - { // Adjust guiCurrentTime because of loopback on the timer value - guiCurrentTime = guiCurrentTime + (0xffffffff - guiStartupTime); - } - else - { // Adjust guiCurrentTime because of loopback on the timer value - guiCurrentTime = guiCurrentTime - guiStartupTime; - } + guiCurrentTime = GetTickCount(); + if (guiCurrentTime < guiStartupTime) + { // Adjust guiCurrentTime because of loopback on the timer value + guiCurrentTime = guiCurrentTime + (0xffffffff - guiStartupTime); + } + else + { // Adjust guiCurrentTime because of loopback on the timer value + guiCurrentTime = guiCurrentTime - guiStartupTime; + } } BOOLEAN InitializeClockManager(void) { - // Register the start time (use WIN95 API call) - guiCurrentTime = guiStartupTime = GetTickCount(); - SetTimer(ghWindow, MAIN_TIMER_ID, 10, (TIMERPROC)Clock); + // Register the start time (use WIN95 API call) + guiCurrentTime = guiStartupTime = GetTickCount(); + SetTimer(ghWindow, MAIN_TIMER_ID, 10, (TIMERPROC)Clock); - return TRUE; + return TRUE; } -void ShutdownClockManager(void) +void ShutdownClockManager(void) { - // Make sure we kill the timer - KillTimer(ghWindow, MAIN_TIMER_ID); + // Make sure we kill the timer + KillTimer(ghWindow, MAIN_TIMER_ID); } -TIMER GetClock(void) +TIMER GetClock(void) { - return guiCurrentTime; + return guiCurrentTime; } -TIMER SetCountdownClock(UINT32 uiTimeToElapse) +TIMER SetCountdownClock(UINT32 uiTimeToElapse) { - return (guiCurrentTime + uiTimeToElapse); + return (guiCurrentTime + uiTimeToElapse); } UINT32 ClockIsTicking(TIMER uiTimer) { - if (uiTimer > guiCurrentTime) - { // Well timer still hasn't elapsed - return (uiTimer - guiCurrentTime); - } - // Time's up - return 0; + if (uiTimer > guiCurrentTime) + { // Well timer still hasn't elapsed + return (uiTimer - guiCurrentTime); + } + // Time's up + return 0; } diff --git a/Standard Gaming Platform/timer.h b/Standard Gaming Platform/timer.h index 0d708243..e94e9ea5 100644 --- a/Standard Gaming Platform/timer.h +++ b/Standard Gaming Platform/timer.h @@ -5,7 +5,7 @@ typedef UINT32 TIMER; -#define MAIN_TIMER_ID 1 +#define MAIN_TIMER_ID 1 #define MILLISECONDS(a) (a) #define SECONDS(a) ((a) / 1000) @@ -18,10 +18,10 @@ extern "C" { #endif BOOLEAN InitializeClockManager(void); -void ShutdownClockManager(void); -TIMER GetClock(void); -TIMER SetCountdownClock(UINT32 TimeToElapse); -UINT32 ClockIsTicking(TIMER uiTimer); +void ShutdownClockManager(void); +TIMER GetClock(void); +TIMER SetCountdownClock(UINT32 TimeToElapse); +UINT32 ClockIsTicking(TIMER uiTimer); #ifdef __cplusplus } diff --git a/Standard Gaming Platform/trle.h b/Standard Gaming Platform/trle.h index c84b49c2..aebb607c 100644 --- a/Standard Gaming Platform/trle.h +++ b/Standard Gaming Platform/trle.h @@ -4,22 +4,22 @@ typedef struct { - UINT32 uiOffset; - UINT32 uiWidth; - UINT32 uiOffLen; - INT16 sOffsetX; - INT16 sOffsetY; + UINT32 uiOffset; + UINT32 uiWidth; + UINT32 uiOffLen; + INT16 sOffsetX; + INT16 sOffsetY; } TRLEObject; typedef struct { - UINT32 uiHeightEach; - UINT32 uiTotalElements; - TRLEObject *pTRLEObject; - PTR pPixData; - UINT32 uiSizePixDataElem; + UINT32 uiHeightEach; + UINT32 uiTotalElements; + TRLEObject *pTRLEObject; + PTR pPixData; + UINT32 uiSizePixDataElem; } TRLEData; diff --git a/Standard Gaming Platform/video.cpp b/Standard Gaming Platform/video.cpp index 35bbd881..52e2296c 100644 --- a/Standard Gaming Platform/video.cpp +++ b/Standard Gaming Platform/video.cpp @@ -34,16 +34,16 @@ extern int iScreenMode; // /////////////////////////////////////////////////////////////////////////////////////////////////// -#define MAX_DIRTY_REGIONS 128 +#define MAX_DIRTY_REGIONS 128 -#define VIDEO_OFF 0x00 -#define VIDEO_ON 0x01 -#define VIDEO_SHUTTING_DOWN 0x02 -#define VIDEO_SUSPENDED 0x04 +#define VIDEO_OFF 0x00 +#define VIDEO_ON 0x01 +#define VIDEO_SHUTTING_DOWN 0x02 +#define VIDEO_SUSPENDED 0x04 -#define THREAD_OFF 0x00 -#define THREAD_ON 0x01 -#define THREAD_SUSPENDED 0x02 +#define THREAD_OFF 0x00 +#define THREAD_ON 0x01 +#define THREAD_SUSPENDED 0x02 #define CURRENT_MOUSE_DATA 0 #define PREVIOUS_MOUSE_DATA 1 @@ -57,12 +57,12 @@ extern int iScreenMode; typedef struct { - BOOLEAN fRestore; - INT16 usMouseXPos, usMouseYPos; - INT16 usLeft, usTop, usRight, usBottom; + BOOLEAN fRestore; + INT16 usMouseXPos, usMouseYPos; + INT16 usLeft, usTop, usRight, usBottom; RECT Region; - LPDIRECTDRAWSURFACE _pSurface; - LPDIRECTDRAWSURFACE2 pSurface; + LPDIRECTDRAWSURFACE _pSurface; + LPDIRECTDRAWSURFACE2 pSurface; } MouseCursorBackground; @@ -76,11 +76,11 @@ typedef struct // Video state variables // -static UINT16 gusScreenWidth; -static UINT16 gusScreenHeight; -static UINT8 gubScreenPixelDepth; +static UINT16 gusScreenWidth; +static UINT16 gusScreenHeight; +static UINT8 gubScreenPixelDepth; -static RECT gScrollRegion; +static RECT gScrollRegion; #define MAX_NUM_FRAMES 25 @@ -94,42 +94,42 @@ INT32 giNumFrames = 0; // Direct Draw objects for both the Primary and Backbuffer surfaces // -static LPDIRECTDRAW _gpDirectDrawObject = NULL; -static LPDIRECTDRAW2 gpDirectDrawObject = NULL; +static LPDIRECTDRAW _gpDirectDrawObject = NULL; +static LPDIRECTDRAW2 gpDirectDrawObject = NULL; -static LPDIRECTDRAWSURFACE _gpPrimarySurface = NULL; -static LPDIRECTDRAWSURFACE2 gpPrimarySurface = NULL; -static LPDIRECTDRAWSURFACE2 gpBackBuffer = NULL; +static LPDIRECTDRAWSURFACE _gpPrimarySurface = NULL; +static LPDIRECTDRAWSURFACE2 gpPrimarySurface = NULL; +static LPDIRECTDRAWSURFACE2 gpBackBuffer = NULL; // // Direct Draw Objects for the frame buffer // -static LPDIRECTDRAWSURFACE _gpFrameBuffer = NULL; -static LPDIRECTDRAWSURFACE2 gpFrameBuffer = NULL; -static LPDIRECTDRAWSURFACE _gpBackBuffer = NULL; -extern RECT rcWindow; -extern POINT ptWindowSize; +static LPDIRECTDRAWSURFACE _gpFrameBuffer = NULL; +static LPDIRECTDRAWSURFACE2 gpFrameBuffer = NULL; +static LPDIRECTDRAWSURFACE _gpBackBuffer = NULL; +extern RECT rcWindow; +extern POINT ptWindowSize; // // Globals for mouse cursor // -static UINT16 gusMouseCursorWidth; -static UINT16 gusMouseCursorHeight; -static INT16 gsMouseCursorXOffset; -static INT16 gsMouseCursorYOffset; +static UINT16 gusMouseCursorWidth; +static UINT16 gusMouseCursorHeight; +static INT16 gsMouseCursorXOffset; +static INT16 gsMouseCursorYOffset; -static LPDIRECTDRAWSURFACE _gpMouseCursor = NULL; -static LPDIRECTDRAWSURFACE2 gpMouseCursor = NULL; +static LPDIRECTDRAWSURFACE _gpMouseCursor = NULL; +static LPDIRECTDRAWSURFACE2 gpMouseCursor = NULL; -static LPDIRECTDRAWSURFACE _gpMouseCursorOriginal = NULL; -static LPDIRECTDRAWSURFACE2 gpMouseCursorOriginal = NULL; +static LPDIRECTDRAWSURFACE _gpMouseCursorOriginal = NULL; +static LPDIRECTDRAWSURFACE2 gpMouseCursorOriginal = NULL; -static MouseCursorBackground gMouseCursorBackground[2]; +static MouseCursorBackground gMouseCursorBackground[2]; -static HVOBJECT gpCursorStore; +static HVOBJECT gpCursorStore; BOOLEAN gfFatalError = FALSE; char gFatalErrorString[ 512 ]; @@ -143,41 +143,41 @@ LPDIRECTDRAWPALETTE gpDirectDrawPalette; // Make sure we record the value of the hWindow (main window frame for the application) // -HWND ghWindow; +HWND ghWindow; // // Refresh thread based variables // -UINT32 guiFrameBufferState; // BUFFER_READY, BUFFER_DIRTY -UINT32 guiMouseBufferState; // BUFFER_READY, BUFFER_DIRTY, BUFFER_DISABLED -UINT32 guiVideoManagerState; // VIDEO_ON, VIDEO_OFF, VIDEO_SUSPENDED, VIDEO_SHUTTING_DOWN -UINT32 guiRefreshThreadState; // THREAD_ON, THREAD_OFF, THREAD_SUSPENDED +UINT32 guiFrameBufferState; // BUFFER_READY, BUFFER_DIRTY +UINT32 guiMouseBufferState; // BUFFER_READY, BUFFER_DIRTY, BUFFER_DISABLED +UINT32 guiVideoManagerState; // VIDEO_ON, VIDEO_OFF, VIDEO_SUSPENDED, VIDEO_SHUTTING_DOWN +UINT32 guiRefreshThreadState; // THREAD_ON, THREAD_OFF, THREAD_SUSPENDED // // Dirty rectangle management variables // -void (*gpFrameBufferRefreshOverride)(void); -SGPRect gListOfDirtyRegions[MAX_DIRTY_REGIONS]; -UINT32 guiDirtyRegionCount; -BOOLEAN gfForceFullScreenRefresh; +void (*gpFrameBufferRefreshOverride)(void); +SGPRect gListOfDirtyRegions[MAX_DIRTY_REGIONS]; +UINT32 guiDirtyRegionCount; +BOOLEAN gfForceFullScreenRefresh; -SGPRect gDirtyRegionsEx[MAX_DIRTY_REGIONS]; -UINT32 gDirtyRegionsFlagsEx[MAX_DIRTY_REGIONS]; -UINT32 guiDirtyRegionExCount; +SGPRect gDirtyRegionsEx[MAX_DIRTY_REGIONS]; +UINT32 gDirtyRegionsFlagsEx[MAX_DIRTY_REGIONS]; +UINT32 guiDirtyRegionExCount; -SGPRect gBACKUPListOfDirtyRegions[MAX_DIRTY_REGIONS]; -UINT32 gBACKUPuiDirtyRegionCount; -BOOLEAN gBACKUPfForceFullScreenRefresh; +SGPRect gBACKUPListOfDirtyRegions[MAX_DIRTY_REGIONS]; +UINT32 gBACKUPuiDirtyRegionCount; +BOOLEAN gBACKUPfForceFullScreenRefresh; // // Screen output stuff // -BOOLEAN gfPrintFrameBuffer; -UINT32 guiPrintFrameBufferIndex; +BOOLEAN gfPrintFrameBuffer; +UINT32 guiPrintFrameBufferIndex; /////////////////////////////////////////////////////////////////////////////////////////////////// // @@ -188,9 +188,9 @@ UINT32 guiPrintFrameBufferIndex; extern UINT16 gusRedMask; extern UINT16 gusGreenMask; extern UINT16 gusBlueMask; -extern INT16 gusRedShift; -extern INT16 gusBlueShift; -extern INT16 gusGreenShift; +extern INT16 gusRedShift; +extern INT16 gusBlueShift; +extern INT16 gusGreenShift; /////////////////////////////////////////////////////////////////////////////////////////////////// // @@ -208,16 +208,16 @@ void RefreshMovieCache( ); /////////////////////////////////////////////////////////////////////////////////////////////////// BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void *WindowProc) -{ - UINT32 uiIndex, uiPitch; - HRESULT ReturnCode; - HWND hWindow; - WNDCLASS WindowClass; - UINT8 ClassName[] = APPLICATION_NAME; +{ + UINT32 uiIndex, uiPitch; + HRESULT ReturnCode; + HWND hWindow; + WNDCLASS WindowClass; + UINT8 ClassName[] = APPLICATION_NAME; DDSURFACEDESC SurfaceDescription; - DDCOLORKEY ColorKey; - PTR pTmpPointer; - DDSCAPS SurfaceCaps; + DDCOLORKEY ColorKey; + PTR pTmpPointer; + DDSCAPS SurfaceCaps; // // Register debug topics @@ -228,8 +228,8 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void * ///////////////////////////////////////////////////////////////////////////////////////////////// // - // Register and Realize our display window. The DirectX surface will eventually overlay on top - // of this surface. + // Register and Realize our display window. The DirectX surface will eventually overlay on top + // of this surface. // // <<<<<<<<< Don't change this >>>>>>>> // @@ -279,7 +279,7 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void * hWindow = CreateWindowEx(WS_EX_TOPMOST, (LPCSTR) ClassName, (LPCSTR)ClassName, WS_POPUP | WS_VISIBLE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, NULL, NULL, hInstance, NULL); if (hWindow == NULL) - { + { DebugMsg(TOPIC_VIDEO, DBG_LEVEL_0, "Failed to create window frame for Direct Draw"); return FALSE; } @@ -302,7 +302,7 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void * // Display our full screen window // - // ShowCursor(FALSE); + // ShowCursor(FALSE); ShowWindow(hWindow, usCommandShow); UpdateWindow(hWindow); SetFocus(hWindow); @@ -319,14 +319,14 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void * ReturnCode = DirectDrawCreate(NULL, &_gpDirectDrawObject, NULL); if (ReturnCode != DD_OK) - { + { DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; } ReturnCode = IDirectDraw_QueryInterface( _gpDirectDrawObject, /*&*/IID_IDirectDraw2, (LPVOID *) &gpDirectDrawObject ); // (jonathanl) if (ReturnCode != DD_OK) - { + { DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; } @@ -340,7 +340,7 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void * ReturnCode = IDirectDraw2_SetCooperativeLevel(gpDirectDrawObject, ghWindow, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN ); if (ReturnCode != DD_OK) - { + { DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; } @@ -352,7 +352,7 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void * { ReturnCode = IDirectDraw2_SetDisplayMode( gpDirectDrawObject, SCREEN_WIDTH, SCREEN_HEIGHT, gbPixelDepth, 0, 0 ); if (ReturnCode != DD_OK) - { + { DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; } @@ -384,49 +384,49 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void * ReturnCode = IDirectDraw2_CreateSurface ( gpDirectDrawObject, &SurfaceDescription, &_gpPrimarySurface, NULL ); if (ReturnCode != DD_OK) - { + { DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; } ReturnCode = DirectDrawCreateClipper ( 0, &clip, NULL ); if (ReturnCode != DD_OK) - { + { DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; } ReturnCode = IDirectDrawClipper_SetHWnd( clip, 0, ghWindow); if (ReturnCode != DD_OK) - { + { DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; } ReturnCode = IDirectDrawSurface_SetClipper( _gpPrimarySurface, clip); if (ReturnCode != DD_OK) - { + { DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; } ReturnCode = IDirectDrawSurface_QueryInterface(_gpPrimarySurface, /*&*/IID_IDirectDrawSurface2, (LPVOID *)&gpPrimarySurface); // (jonathanl) if (ReturnCode != DD_OK) - { + { DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; } // Backbuffer ZEROMEM(SurfaceDescription); - SurfaceDescription.dwSize = sizeof(DDSURFACEDESC); - SurfaceDescription.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + SurfaceDescription.dwSize = sizeof(DDSURFACEDESC); + SurfaceDescription.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; SurfaceDescription.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; - SurfaceDescription.dwWidth = SCREEN_WIDTH; - SurfaceDescription.dwHeight = SCREEN_HEIGHT; + SurfaceDescription.dwWidth = SCREEN_WIDTH; + SurfaceDescription.dwHeight = SCREEN_HEIGHT; ReturnCode = IDirectDraw2_CreateSurface ( gpDirectDrawObject, &SurfaceDescription, &_gpBackBuffer, NULL ); if (ReturnCode != DD_OK) - { + { DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; } @@ -434,7 +434,7 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void * ReturnCode = IDirectDrawSurface_QueryInterface(_gpBackBuffer, /*&*/IID_IDirectDrawSurface2, (LPVOID *)&gpBackBuffer); // (jonathanl) if (ReturnCode != DD_OK) - { + { DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; } @@ -448,7 +448,7 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void * ReturnCode = IDirectDraw2_CreateSurface ( gpDirectDrawObject, &SurfaceDescription, &_gpPrimarySurface, NULL ); if (ReturnCode != DD_OK) - { + { DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; } @@ -456,7 +456,7 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void * ReturnCode = IDirectDrawSurface_QueryInterface(_gpPrimarySurface, /*&*/IID_IDirectDrawSurface2, (LPVOID *) &gpPrimarySurface); if (ReturnCode != DD_OK) - { + { DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; } @@ -464,7 +464,7 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void * SurfaceCaps.dwCaps = DDSCAPS_BACKBUFFER; ReturnCode = IDirectDrawSurface2_GetAttachedSurface( gpPrimarySurface, &SurfaceCaps, &gpBackBuffer ); if (ReturnCode != DD_OK) - { + { DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; } @@ -475,21 +475,21 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void * // ZEROMEM(SurfaceDescription); - SurfaceDescription.dwSize = sizeof(DDSURFACEDESC); - SurfaceDescription.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + SurfaceDescription.dwSize = sizeof(DDSURFACEDESC); + SurfaceDescription.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; SurfaceDescription.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; - SurfaceDescription.dwWidth = SCREEN_WIDTH; - SurfaceDescription.dwHeight = SCREEN_HEIGHT; + SurfaceDescription.dwWidth = SCREEN_WIDTH; + SurfaceDescription.dwHeight = SCREEN_HEIGHT; ReturnCode = IDirectDraw2_CreateSurface ( gpDirectDrawObject, &SurfaceDescription, &_gpFrameBuffer, NULL ); if (ReturnCode != DD_OK) - { + { DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; } ReturnCode = IDirectDrawSurface_QueryInterface(_gpFrameBuffer, /*&*/IID_IDirectDrawSurface2, (LPVOID *)&gpFrameBuffer); // (jonathanl) if (ReturnCode != DD_OK) - { + { DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; } @@ -507,23 +507,23 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void * // ZEROMEM(SurfaceDescription); - SurfaceDescription.dwSize = sizeof(DDSURFACEDESC); - SurfaceDescription.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + SurfaceDescription.dwSize = sizeof(DDSURFACEDESC); + SurfaceDescription.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; // SurfaceDescription.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; SurfaceDescription.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; - SurfaceDescription.dwWidth = MAX_CURSOR_WIDTH; - SurfaceDescription.dwHeight = MAX_CURSOR_HEIGHT; + SurfaceDescription.dwWidth = MAX_CURSOR_WIDTH; + SurfaceDescription.dwHeight = MAX_CURSOR_HEIGHT; ReturnCode = IDirectDraw2_CreateSurface ( gpDirectDrawObject, &SurfaceDescription, &_gpMouseCursor, NULL ); if (ReturnCode != DD_OK) - { + { DebugMsg(TOPIC_VIDEO, DBG_LEVEL_0, String("Failed to create MouseCursor witd %ld", ReturnCode & 0x0f)); DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; - } + } ReturnCode = IDirectDrawSurface_QueryInterface(_gpMouseCursor, /*&*/IID_IDirectDrawSurface2, (LPVOID *)&gpMouseCursor); // (jonathanl) if (ReturnCode != DD_OK) - { + { DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; } @@ -532,7 +532,7 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void * ColorKey.dwColorSpaceHighValue = 0; ReturnCode = IDirectDrawSurface2_SetColorKey(gpMouseCursor, DDCKEY_SRCBLT, &ColorKey); if (ReturnCode != DD_OK) - { + { DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; } @@ -542,14 +542,14 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void * // ZEROMEM(SurfaceDescription); - SurfaceDescription.dwSize = sizeof(DDSURFACEDESC); - SurfaceDescription.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + SurfaceDescription.dwSize = sizeof(DDSURFACEDESC); + SurfaceDescription.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; SurfaceDescription.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; - SurfaceDescription.dwWidth = MAX_CURSOR_WIDTH; - SurfaceDescription.dwHeight = MAX_CURSOR_HEIGHT; + SurfaceDescription.dwWidth = MAX_CURSOR_WIDTH; + SurfaceDescription.dwHeight = MAX_CURSOR_HEIGHT; ReturnCode = IDirectDraw2_CreateSurface ( gpDirectDrawObject, &SurfaceDescription, &_gpMouseCursorOriginal, NULL ); if (ReturnCode != DD_OK) - { + { DebugMsg(TOPIC_VIDEO, DBG_LEVEL_0, "Failed to create MouseCursorOriginal"); DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; @@ -557,7 +557,7 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void * ReturnCode = IDirectDrawSurface_QueryInterface(_gpMouseCursorOriginal, /*&*/IID_IDirectDrawSurface2, (LPVOID *)&gpMouseCursorOriginal); // (jonathanl) if (ReturnCode != DD_OK) - { + { DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; } @@ -580,15 +580,15 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void * // ZEROMEM(SurfaceDescription); - SurfaceDescription.dwSize = sizeof(DDSURFACEDESC); - SurfaceDescription.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + SurfaceDescription.dwSize = sizeof(DDSURFACEDESC); + SurfaceDescription.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; //SurfaceDescription.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; SurfaceDescription.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; - SurfaceDescription.dwWidth = MAX_CURSOR_WIDTH; - SurfaceDescription.dwHeight = MAX_CURSOR_HEIGHT; + SurfaceDescription.dwWidth = MAX_CURSOR_WIDTH; + SurfaceDescription.dwHeight = MAX_CURSOR_HEIGHT; ReturnCode = IDirectDraw2_CreateSurface ( gpDirectDrawObject, &SurfaceDescription, &(gMouseCursorBackground[uiIndex]._pSurface), NULL ); if (ReturnCode != DD_OK) - { + { DebugMsg(TOPIC_VIDEO, DBG_LEVEL_0, "Failed to create MouseCursorBackground"); DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; @@ -596,7 +596,7 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void * ReturnCode = IDirectDrawSurface_QueryInterface(gMouseCursorBackground[uiIndex]._pSurface, /*&*/IID_IDirectDrawSurface2, (LPVOID *)&(gMouseCursorBackground[uiIndex].pSurface)); // (jonathanl) if (ReturnCode != DD_OK) - { + { DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); return FALSE; } @@ -624,16 +624,16 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void * // Initialize state variables // - guiFrameBufferState = BUFFER_DIRTY; - guiMouseBufferState = BUFFER_DISABLED; - guiVideoManagerState = VIDEO_ON; - guiRefreshThreadState = THREAD_OFF; - guiDirtyRegionCount = 0; - gfForceFullScreenRefresh = TRUE; + guiFrameBufferState = BUFFER_DIRTY; + guiMouseBufferState = BUFFER_DISABLED; + guiVideoManagerState = VIDEO_ON; + guiRefreshThreadState = THREAD_OFF; + guiDirtyRegionCount = 0; + gfForceFullScreenRefresh = TRUE; gpFrameBufferRefreshOverride = NULL; - gpCursorStore = NULL; - gfPrintFrameBuffer = FALSE; - guiPrintFrameBufferIndex = 0; + gpCursorStore = NULL; + gfPrintFrameBuffer = FALSE; + guiPrintFrameBufferIndex = 0; // // This function must be called to setup RGB information @@ -647,10 +647,10 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void * /////////////////////////////////////////////////////////////////////////////////////////////////// void ShutdownVideoManager(void) -{ - //UINT32 uiRefreshThreadState; +{ + //UINT32 uiRefreshThreadState; - DebugMsg(TOPIC_VIDEO, DBG_LEVEL_0, "Shutting down the video manager"); + DebugMsg(TOPIC_VIDEO, DBG_LEVEL_0, "Shutting down the video manager"); // // Toggle the state of the video manager to indicate to the refresh thread that it needs to shut itself @@ -681,7 +681,7 @@ void ShutdownVideoManager(void) // ATE: Release mouse cursor! FreeMouseCursor( ); - UnRegisterDebugTopic(TOPIC_VIDEO, "Video"); + UnRegisterDebugTopic(TOPIC_VIDEO, "Video"); } /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -696,13 +696,13 @@ void DoTester( ) { IDirectDraw2_RestoreDisplayMode( gpDirectDrawObject ); IDirectDraw2_SetCooperativeLevel(gpDirectDrawObject, ghWindow, DDSCL_NORMAL ); - // ShowCursor(TRUE); + // ShowCursor(TRUE); } /////////////////////////////////////////////////////////////////////////////////////////////////// BOOLEAN RestoreVideoManager(void) -{ +{ HRESULT ReturnCode; // @@ -750,7 +750,7 @@ BOOLEAN RestoreVideoManager(void) guiMouseBufferState = BUFFER_DIRTY; } - // + // // Set the video state to VIDEO_ON // @@ -762,8 +762,8 @@ BOOLEAN RestoreVideoManager(void) } else { - return FALSE; - } + return FALSE; + } } /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -845,15 +845,15 @@ void InvalidateRegion(INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom) if ( iBottom > SCREEN_HEIGHT ) iBottom = SCREEN_HEIGHT; - if ( ( iRight - iLeft ) <= 0 ) + if ( ( iRight - iLeft ) <= 0 ) return; - if ( ( iBottom - iTop ) <= 0 ) + if ( ( iBottom - iTop ) <= 0 ) return; - gListOfDirtyRegions[guiDirtyRegionCount].iLeft = iLeft; - gListOfDirtyRegions[guiDirtyRegionCount].iTop = iTop; - gListOfDirtyRegions[guiDirtyRegionCount].iRight = iRight; + gListOfDirtyRegions[guiDirtyRegionCount].iLeft = iLeft; + gListOfDirtyRegions[guiDirtyRegionCount].iTop = iTop; + gListOfDirtyRegions[guiDirtyRegionCount].iRight = iRight; gListOfDirtyRegions[guiDirtyRegionCount].iBottom = iBottom; // gDirtyRegionFlags[ guiDirtyRegionCount ] = TRUE; @@ -888,7 +888,7 @@ void InvalidateRegionEx(INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom, UI AddRegionEx( iLeft, iTop, iRight, iBottom, uiFlags ); // Add new bottom region - iTop = gsVIEWPORT_WINDOW_END_Y; + iTop = gsVIEWPORT_WINDOW_END_Y; iBottom = iOldBottom; AddRegionEx( iLeft, iTop, iRight, iBottom, uiFlags ); @@ -919,17 +919,17 @@ void AddRegionEx(INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom, UINT32 ui if ( iBottom > SCREEN_HEIGHT ) iBottom = SCREEN_HEIGHT; - if ( ( iRight - iLeft ) <= 0 ) + if ( ( iRight - iLeft ) <= 0 ) return; - if ( ( iBottom - iTop ) <= 0 ) + if ( ( iBottom - iTop ) <= 0 ) return; - gDirtyRegionsEx[ guiDirtyRegionExCount ].iLeft = iLeft; - gDirtyRegionsEx[ guiDirtyRegionExCount ].iTop = iTop; - gDirtyRegionsEx[ guiDirtyRegionExCount ].iRight = iRight; + gDirtyRegionsEx[ guiDirtyRegionExCount ].iLeft = iLeft; + gDirtyRegionsEx[ guiDirtyRegionExCount ].iTop = iTop; + gDirtyRegionsEx[ guiDirtyRegionExCount ].iRight = iRight; gDirtyRegionsEx[ guiDirtyRegionExCount ].iBottom = iBottom; gDirtyRegionsFlagsEx[ guiDirtyRegionExCount ] = uiFlags; @@ -970,18 +970,18 @@ void InvalidateRegions(SGPRect *pArrayOfRegions, UINT32 uiRegionCount) // Well we haven't broken the MAX_DIRTY_REGIONS limit yet, so we register the new region // - gListOfDirtyRegions[guiDirtyRegionCount].iLeft = pArrayOfRegions[uiIndex].iLeft; - gListOfDirtyRegions[guiDirtyRegionCount].iTop = pArrayOfRegions[uiIndex].iTop; - gListOfDirtyRegions[guiDirtyRegionCount].iRight = pArrayOfRegions[uiIndex].iRight; + gListOfDirtyRegions[guiDirtyRegionCount].iLeft = pArrayOfRegions[uiIndex].iLeft; + gListOfDirtyRegions[guiDirtyRegionCount].iTop = pArrayOfRegions[uiIndex].iTop; + gListOfDirtyRegions[guiDirtyRegionCount].iRight = pArrayOfRegions[uiIndex].iRight; gListOfDirtyRegions[guiDirtyRegionCount].iBottom = pArrayOfRegions[uiIndex].iBottom; - guiDirtyRegionCount++; - } + guiDirtyRegionCount++; + } } else { guiDirtyRegionCount = 0; - gfForceFullScreenRefresh = TRUE; + gfForceFullScreenRefresh = TRUE; } } @@ -1032,16 +1032,16 @@ void SetFrameBufferRefreshOverride(PTR pFrameBufferRefreshOverride) void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScrollYIncrement, LPDIRECTDRAWSURFACE2 pSource, LPDIRECTDRAWSURFACE2 pDest, BOOLEAN fRenderStrip, UINT32 uiCurrentMouseBackbuffer ) { UINT16 usWidth, usHeight; - UINT8 ubBitDepth; + UINT8 ubBitDepth; HRESULT ReturnCode; - static RECT Region; - static UINT16 usMouseXPos, usMouseYPos; - static RECT StripRegions[ 2 ], MouseRegion; - UINT16 usNumStrips = 0; - INT32 cnt; - INT16 sShiftX, sShiftY; - INT32 uiCountY; - UINT32 uiDestPitchBYTES; + static RECT Region; + static UINT16 usMouseXPos, usMouseYPos; + static RECT StripRegions[ 2 ], MouseRegion; + UINT16 usNumStrips = 0; + INT32 cnt; + INT16 sShiftX, sShiftY; + INT32 uiCountY; + UINT32 uiDestPitchBYTES; GetCurrentVideoSettings( &usWidth, &usHeight, &ubBitDepth ); @@ -1052,13 +1052,13 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr // pDest = gpFrameBuffer; ///zmiany - StripRegions[ 0 ].left = gsVIEWPORT_START_X ; - StripRegions[ 0 ].right = gsVIEWPORT_END_X ; - StripRegions[ 0 ].top = gsVIEWPORT_WINDOW_START_Y ; + StripRegions[ 0 ].left = gsVIEWPORT_START_X ; + StripRegions[ 0 ].right = gsVIEWPORT_END_X ; + StripRegions[ 0 ].top = gsVIEWPORT_WINDOW_START_Y ; StripRegions[ 0 ].bottom = gsVIEWPORT_WINDOW_END_Y ; - StripRegions[ 1 ].left = gsVIEWPORT_START_X ; - StripRegions[ 1 ].right = gsVIEWPORT_END_X; - StripRegions[ 1 ].top = gsVIEWPORT_WINDOW_START_Y; + StripRegions[ 1 ].left = gsVIEWPORT_START_X ; + StripRegions[ 1 ].right = gsVIEWPORT_END_X; + StripRegions[ 1 ].top = gsVIEWPORT_WINDOW_START_Y; StripRegions[ 1 ].bottom = gsVIEWPORT_WINDOW_END_Y; MouseRegion.left = gMouseCursorBackground[ uiCurrentMouseBackbuffer ].usLeft; @@ -1101,9 +1101,7 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr // memset z-buffer for(uiCountY = gsVIEWPORT_WINDOW_START_Y; uiCountY < gsVIEWPORT_WINDOW_END_Y; uiCountY++) { - memset((UINT8 *)gpZBuffer+(uiCountY*uiDestPitchBYTES), 0, - sScrollXIncrement*2); - + memset((UINT8 *)gpZBuffer+(uiCountY*uiDestPitchBYTES), 0, sScrollXIncrement*2); } StripRegions[ 0 ].right =(INT16)(gsVIEWPORT_START_X+sScrollXIncrement); @@ -1148,9 +1146,9 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr // memset z-buffer for(uiCountY= gsVIEWPORT_WINDOW_START_Y; uiCountY < gsVIEWPORT_WINDOW_END_Y; uiCountY++) { - memset((UINT8 *)gpZBuffer+(uiCountY*uiDestPitchBYTES) + ( ( gsVIEWPORT_END_X - sScrollXIncrement ) * 2 ), 0, - sScrollXIncrement*2); - } + memset((UINT8 *)gpZBuffer+(uiCountY*uiDestPitchBYTES) + ( ( gsVIEWPORT_END_X - sScrollXIncrement ) * 2 ), 0, + sScrollXIncrement*2); + } //for(uiCountY=0; uiCountY < usHeight; uiCountY++) @@ -1196,9 +1194,9 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr for(uiCountY=sScrollYIncrement-1+gsVIEWPORT_WINDOW_START_Y; uiCountY >= gsVIEWPORT_WINDOW_START_Y; uiCountY--) { - memset((UINT8 *)gpZBuffer+(uiCountY*uiDestPitchBYTES), 0, + memset((UINT8 *)gpZBuffer+(uiCountY*uiDestPitchBYTES), 0, uiDestPitchBYTES); - } + } //for(uiCountY=usHeight-1; uiCountY >= sScrollYIncrement; uiCountY--) //{ @@ -1291,20 +1289,18 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr // memset z-buffer for(uiCountY=gsVIEWPORT_WINDOW_START_Y; uiCountY < gsVIEWPORT_WINDOW_END_Y; uiCountY++) { - memset((UINT8 *)gpZBuffer+(uiCountY*uiDestPitchBYTES), 0, - sScrollXIncrement*2); + memset((UINT8 *)gpZBuffer+(uiCountY*uiDestPitchBYTES), 0, sScrollXIncrement*2); - } + } for(uiCountY=gsVIEWPORT_WINDOW_START_Y + sScrollYIncrement-1; uiCountY >= gsVIEWPORT_WINDOW_START_Y; uiCountY--) { - memset((UINT8 *)gpZBuffer+(uiCountY*uiDestPitchBYTES), 0, - uiDestPitchBYTES); - } + memset((UINT8 *)gpZBuffer+(uiCountY*uiDestPitchBYTES), 0, uiDestPitchBYTES); + } - StripRegions[ 0 ].right = (INT16)(gsVIEWPORT_START_X+sScrollXIncrement); + StripRegions[ 0 ].right = (INT16)(gsVIEWPORT_START_X+sScrollXIncrement); StripRegions[ 1 ].bottom = (INT16)(gsVIEWPORT_WINDOW_START_Y+sScrollYIncrement); - StripRegions[ 1 ].left = (INT16)(gsVIEWPORT_START_X+sScrollXIncrement); + StripRegions[ 1 ].left = (INT16)(gsVIEWPORT_START_X+sScrollXIncrement); usNumStrips = 2; usMouseYPos += sScrollYIncrement; @@ -1342,19 +1338,18 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr // memset z-buffer for(uiCountY=gsVIEWPORT_WINDOW_START_Y; uiCountY < gsVIEWPORT_WINDOW_END_Y; uiCountY++) { - memset((UINT8 *)gpZBuffer+(uiCountY*uiDestPitchBYTES) + ( ( gsVIEWPORT_END_X - sScrollXIncrement ) * 2 ), 0, - sScrollXIncrement*2); - } + memset((UINT8 *)gpZBuffer+(uiCountY*uiDestPitchBYTES) + ( ( gsVIEWPORT_END_X - sScrollXIncrement ) * 2 ), 0, + sScrollXIncrement*2); + } for(uiCountY=gsVIEWPORT_WINDOW_START_Y + sScrollYIncrement-1; uiCountY >= gsVIEWPORT_WINDOW_START_Y; uiCountY--) { - memset((UINT8 *)gpZBuffer+(uiCountY*uiDestPitchBYTES), 0, - uiDestPitchBYTES); - } + memset((UINT8 *)gpZBuffer+(uiCountY*uiDestPitchBYTES), 0, uiDestPitchBYTES); + } - StripRegions[ 0 ].left = (INT16)(gsVIEWPORT_END_X-sScrollXIncrement); + StripRegions[ 0 ].left = (INT16)(gsVIEWPORT_END_X-sScrollXIncrement); StripRegions[ 1 ].bottom = (INT16)(gsVIEWPORT_WINDOW_START_Y+sScrollYIncrement); - StripRegions[ 1 ].right = (INT16)(gsVIEWPORT_END_X-sScrollXIncrement); + StripRegions[ 1 ].right = (INT16)(gsVIEWPORT_END_X-sScrollXIncrement); usNumStrips = 2; usMouseYPos += sScrollYIncrement; @@ -1392,14 +1387,11 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr // memset z-buffer for(uiCountY=gsVIEWPORT_WINDOW_START_Y; uiCountY < gsVIEWPORT_WINDOW_END_Y; uiCountY++) { - memset((UINT8 *)gpZBuffer+(uiCountY*uiDestPitchBYTES), 0, - sScrollXIncrement*2); - - } + memset((UINT8 *)gpZBuffer+(uiCountY*uiDestPitchBYTES), 0, sScrollXIncrement*2); + } for(uiCountY=(gsVIEWPORT_WINDOW_END_Y - sScrollYIncrement); uiCountY < gsVIEWPORT_WINDOW_END_Y; uiCountY++) { - memset((UINT8 *)gpZBuffer+(uiCountY*uiDestPitchBYTES), 0, - uiDestPitchBYTES); + memset((UINT8 *)gpZBuffer+(uiCountY*uiDestPitchBYTES), 0, uiDestPitchBYTES); } @@ -1407,7 +1399,7 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr StripRegions[ 1 ].top = (INT16)(gsVIEWPORT_WINDOW_END_Y-sScrollYIncrement); - StripRegions[ 1 ].left = (INT16)(gsVIEWPORT_START_X+sScrollXIncrement); + StripRegions[ 1 ].left = (INT16)(gsVIEWPORT_START_X+sScrollXIncrement); usNumStrips = 2; usMouseYPos -= sScrollYIncrement; @@ -1439,19 +1431,18 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr { break; } - } + } } while (ReturnCode != DD_OK); // memset z-buffer for(uiCountY=gsVIEWPORT_WINDOW_START_Y; uiCountY < gsVIEWPORT_WINDOW_END_Y; uiCountY++) { - memset((UINT8 *)gpZBuffer+(uiCountY*uiDestPitchBYTES) + ( ( gsVIEWPORT_END_X - sScrollXIncrement ) * 2 ), 0, - sScrollXIncrement*2); - } + memset((UINT8 *)gpZBuffer+(uiCountY*uiDestPitchBYTES) + ( ( gsVIEWPORT_END_X - sScrollXIncrement ) * 2 ), 0, + sScrollXIncrement*2); + } for(uiCountY=(gsVIEWPORT_WINDOW_END_Y - sScrollYIncrement); uiCountY < gsVIEWPORT_WINDOW_END_Y; uiCountY++) { - memset((UINT8 *)gpZBuffer+(uiCountY*uiDestPitchBYTES), 0, - uiDestPitchBYTES); + memset((UINT8 *)gpZBuffer+(uiCountY*uiDestPitchBYTES), 0, uiDestPitchBYTES); } @@ -1473,7 +1464,7 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr // Memset to 0 #ifdef SCROLL_TEST { - DDBLTFX BlitterFX; + DDBLTFX BlitterFX; BlitterFX.dwSize = sizeof( DDBLTFX ); BlitterFX.dwFillColor = 0; @@ -1484,9 +1475,9 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr #if 0 - StripRegions[ 0 ].left = gsVIEWPORT_START_X ; - StripRegions[ 0 ].right = gsVIEWPORT_END_X ; - StripRegions[ 0 ].top = gsVIEWPORT_WINDOW_START_Y ; + StripRegions[ 0 ].left = gsVIEWPORT_START_X ; + StripRegions[ 0 ].right = gsVIEWPORT_END_X ; + StripRegions[ 0 ].top = gsVIEWPORT_WINDOW_START_Y ; StripRegions[ 0 ].bottom = gsVIEWPORT_WINDOW_END_Y ; usNumStrips = 1; #endif @@ -1616,7 +1607,7 @@ void ScrollJA2Background(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScr //UpdateSaveBuffer(); //SaveBackgroundRects(); -} +} //rain @@ -1630,13 +1621,13 @@ BOOLEAN gfNextRefreshFullScreen = FALSE; void RefreshScreen(void *DummyVariable) { - static UINT32 uiRefreshThreadState, uiIndex; - UINT16 usScreenWidth, usScreenHeight; + static UINT32 uiRefreshThreadState, uiIndex; + UINT16 usScreenWidth, usScreenHeight; static BOOLEAN fShowMouse; HRESULT ReturnCode; - static RECT Region; - static INT16 sx, sy; - static POINT MousePos; + static RECT Region; + static INT16 sx, sy; + static POINT MousePos; static BOOLEAN fFirstTime = TRUE; UINT32 uiTime; @@ -1662,8 +1653,8 @@ void RefreshScreen(void *DummyVariable) //DebugMsg(TOPIC_VIDEO, DBG_LEVEL_0, "Looping in refresh"); /////////////////////////////////////////////////////////////////////////////////////////////// - // - // REFRESH_THREAD_MUTEX + // + // REFRESH_THREAD_MUTEX // /////////////////////////////////////////////////////////////////////////////////////////////// @@ -1673,7 +1664,7 @@ void RefreshScreen(void *DummyVariable) : // // Excellent, everything is cosher, we continue on // - uiRefreshThreadState = guiRefreshThreadState = THREAD_ON; + uiRefreshThreadState = guiRefreshThreadState = THREAD_ON; usScreenWidth = gusScreenWidth; usScreenHeight = gusScreenHeight; break; @@ -1709,8 +1700,8 @@ void RefreshScreen(void *DummyVariable) ScreenToClient(ghWindow, &MousePos); // In window coords! ///////////////////////////////////////////////////////////////////////////////////////////// - // - // FRAME_BUFFER_MUTEX + // + // FRAME_BUFFER_MUTEX // ///////////////////////////////////////////////////////////////////////////////////////////// @@ -1804,7 +1795,6 @@ void RefreshScreen(void *DummyVariable) { break; } - DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); if (ReturnCode == DDERR_SURFACELOST) @@ -1819,9 +1809,9 @@ void RefreshScreen(void *DummyVariable) { for (uiIndex = 0; uiIndex < guiDirtyRegionCount; uiIndex++) { - Region.left = gListOfDirtyRegions[uiIndex].iLeft; - Region.top = gListOfDirtyRegions[uiIndex].iTop; - Region.right = gListOfDirtyRegions[uiIndex].iRight; + Region.left = gListOfDirtyRegions[uiIndex].iLeft; + Region.top = gListOfDirtyRegions[uiIndex].iTop; + Region.right = gListOfDirtyRegions[uiIndex].iRight; Region.bottom = gListOfDirtyRegions[uiIndex].iBottom; do @@ -1843,17 +1833,17 @@ void RefreshScreen(void *DummyVariable) // Now do new, extended dirty regions for (uiIndex = 0; uiIndex < guiDirtyRegionExCount; uiIndex++) { - Region.left = gDirtyRegionsEx[uiIndex].iLeft; - Region.top = gDirtyRegionsEx[uiIndex].iTop; - Region.right = gDirtyRegionsEx[uiIndex].iRight; + Region.left = gDirtyRegionsEx[uiIndex].iLeft; + Region.top = gDirtyRegionsEx[uiIndex].iTop; + Region.right = gDirtyRegionsEx[uiIndex].iRight; Region.bottom = gDirtyRegionsEx[uiIndex].iBottom; - // Do some checks if we are in the process of scrolling! + // Do some checks if we are in the process of scrolling! if ( gfRenderScroll ) { // Check if we are completely out of bounds - if ( Region.top <= gsVIEWPORT_WINDOW_END_Y && Region.bottom <= gsVIEWPORT_WINDOW_END_Y ) + if ( Region.top <= gsVIEWPORT_WINDOW_END_Y && Region.bottom <= gsVIEWPORT_WINDOW_END_Y ) { continue; } @@ -1904,7 +1894,7 @@ void RefreshScreen(void *DummyVariable) uiTime=GetTickCount(); if((uiTime < guiLastFrame) || (uiTime > (guiLastFrame+guiFramePeriod))) { - SnapshotSmall( ); + SnapshotSmall( ); guiLastFrame=uiTime; } } @@ -1912,15 +1902,15 @@ void RefreshScreen(void *DummyVariable) if (gfPrintFrameBuffer == TRUE) { - LPDIRECTDRAWSURFACE _pTmpBuffer; - LPDIRECTDRAWSURFACE2 pTmpBuffer; - DDSURFACEDESC SurfaceDescription; - FILE *OutputFile; - CHAR8 FileName[64]; - INT32 iIndex; + LPDIRECTDRAWSURFACE _pTmpBuffer; + LPDIRECTDRAWSURFACE2 pTmpBuffer; + DDSURFACEDESC SurfaceDescription; + FILE *OutputFile; + CHAR8 FileName[64]; + INT32 iIndex; STRING512 DataDir; - STRING512 ExecDir; - UINT16 *p16BPPData; + STRING512 ExecDir; + UINT16 *p16BPPData; // Snap: save current directory GetFileManCurrentDirectory( DataDir ); @@ -1933,20 +1923,20 @@ void RefreshScreen(void *DummyVariable) // ZEROMEM(SurfaceDescription); - SurfaceDescription.dwSize = sizeof(DDSURFACEDESC); - SurfaceDescription.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + SurfaceDescription.dwSize = sizeof(DDSURFACEDESC); + SurfaceDescription.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; SurfaceDescription.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; - SurfaceDescription.dwWidth = SCREEN_WIDTH; - SurfaceDescription.dwHeight = SCREEN_HEIGHT; + SurfaceDescription.dwWidth = SCREEN_WIDTH; + SurfaceDescription.dwHeight = SCREEN_HEIGHT; ReturnCode = IDirectDraw2_CreateSurface ( gpDirectDrawObject, &SurfaceDescription, &_pTmpBuffer, NULL ); if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING)) - { + { DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); } ReturnCode = IDirectDrawSurface_QueryInterface(_pTmpBuffer, /*&*/IID_IDirectDrawSurface2, (LPVOID *)&pTmpBuffer); // (jonathanl) if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING)) - { + { DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); } @@ -1960,7 +1950,7 @@ void RefreshScreen(void *DummyVariable) Region.bottom = SCREEN_HEIGHT; do - { + { ReturnCode = IDirectDrawSurface2_SGPBltFast(pTmpBuffer, 0, 0, gpPrimarySurface, &rcWindow, DDBLTFAST_NOCOLORKEY); if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING)) { @@ -2006,13 +1996,13 @@ void RefreshScreen(void *DummyVariable) } for (iIndex = SCREEN_HEIGHT - 1; iIndex >= 0; iIndex--) - { + { // ATE: OK, fix this such that it converts pixel format to 5/5/5 // if current settings are 5/6/5.... if (gusRedMask == 0xF800 && gusGreenMask == 0x07E0 && gusBlueMask == 0x001F) { // Read into a buffer... - memcpy( p16BPPData, ( ((UINT8 *)SurfaceDescription.lpSurface) + (iIndex * SCREEN_WIDTH * 2) ), SCREEN_WIDTH * 2 ); + memcpy( p16BPPData, ( ((UINT8 *)SurfaceDescription.lpSurface) + (iIndex * SCREEN_WIDTH * 2) ), SCREEN_WIDTH * 2 ); // Convert.... ConvertRGBDistribution565To555( p16BPPData, SCREEN_WIDTH ); @@ -2043,7 +2033,7 @@ void RefreshScreen(void *DummyVariable) ReturnCode = IDirectDrawSurface2_Unlock(pTmpBuffer, &SurfaceDescription); if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING)) { - DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); + DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); } } @@ -2051,8 +2041,8 @@ void RefreshScreen(void *DummyVariable) // Release temp surface // - gfPrintFrameBuffer = FALSE; - IDirectDrawSurface2_Release(pTmpBuffer); + gfPrintFrameBuffer = FALSE; + IDirectDrawSurface2_Release(pTmpBuffer); // Snap: Restore the data directory once we are finished. SetFileManCurrentDirectory( DataDir ); @@ -2096,7 +2086,7 @@ void RefreshScreen(void *DummyVariable) { if (guiMouseBufferState == BUFFER_READY) { - fShowMouse = TRUE; + fShowMouse = TRUE; } else { @@ -2112,14 +2102,14 @@ void RefreshScreen(void *DummyVariable) } /////////////////////////////////////////////////////////////////////////////////////////////// - // + // // End of MOUSE_BUFFER_MUTEX // /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// - // + // // If fMouseState == TRUE // // (1) Save mouse background from gpBackBuffer to gpMouseCursorBackground @@ -2128,25 +2118,25 @@ void RefreshScreen(void *DummyVariable) /////////////////////////////////////////////////////////////////////////////////////////////// if (fShowMouse == TRUE ) - { + { // // Step (1) - Save mouse background - // + // - Region.left = MousePos.x - gsMouseCursorXOffset; - Region.top = MousePos.y - gsMouseCursorYOffset; - Region.right = Region.left + gusMouseCursorWidth; - Region.bottom = Region.top + gusMouseCursorHeight; + Region.left = MousePos.x - gsMouseCursorXOffset; + Region.top = MousePos.y - gsMouseCursorYOffset; + Region.right = Region.left + gusMouseCursorWidth; + Region.bottom = Region.top + gusMouseCursorHeight; if (Region.right > usScreenWidth) { - Region.right = usScreenWidth; + Region.right = usScreenWidth; } if (Region.bottom > usScreenHeight) { Region.bottom = usScreenHeight; - } + } if ((Region.right > Region.left)&&(Region.bottom > Region.top)) { @@ -2155,9 +2145,9 @@ void RefreshScreen(void *DummyVariable) // future restore // - gMouseCursorBackground[CURRENT_MOUSE_DATA].fRestore = TRUE; - gMouseCursorBackground[CURRENT_MOUSE_DATA].usRight = (INT16)Region.right - (INT16) Region.left; - gMouseCursorBackground[CURRENT_MOUSE_DATA].usBottom = (INT16)Region.bottom - (INT16) Region.top; + gMouseCursorBackground[CURRENT_MOUSE_DATA].fRestore = TRUE; + gMouseCursorBackground[CURRENT_MOUSE_DATA].usRight = (INT16)Region.right - (INT16) Region.left; + gMouseCursorBackground[CURRENT_MOUSE_DATA].usBottom = (INT16)Region.bottom - (INT16) Region.top; if (Region.left < 0) { gMouseCursorBackground[CURRENT_MOUSE_DATA].usLeft = (INT16) (0 - Region.left); @@ -2179,7 +2169,7 @@ void RefreshScreen(void *DummyVariable) { gMouseCursorBackground[CURRENT_MOUSE_DATA].usMouseYPos = (UINT16) MousePos.y - gsMouseCursorYOffset; gMouseCursorBackground[CURRENT_MOUSE_DATA].usTop = 0; - } + } if ((Region.right > Region.left)&&(Region.bottom > Region.top)) { @@ -2220,7 +2210,7 @@ void RefreshScreen(void *DummyVariable) Region.bottom = gMouseCursorBackground[CURRENT_MOUSE_DATA].usBottom; do - { + { ReturnCode = IDirectDrawSurface2_SGPBltFast(gpBackBuffer, gMouseCursorBackground[CURRENT_MOUSE_DATA].usMouseXPos, gMouseCursorBackground[CURRENT_MOUSE_DATA].usMouseYPos, gpMouseCursor, &Region, DDBLTFAST_SRCCOLORKEY); if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING)) { @@ -2263,7 +2253,7 @@ void RefreshScreen(void *DummyVariable) { // // Well since there was no mouse handling this round, we disable the mouse restore - // + // gMouseCursorBackground[CURRENT_MOUSE_DATA].fRestore = FALSE; @@ -2272,7 +2262,7 @@ void RefreshScreen(void *DummyVariable) /////////////////////////////////////////////////////////////////////////////////////////////// - // Rain // + // Rain // /////////////////////////////////////////////////////////////////////////////////////////////// if( IsItAllowedToRenderRain() && gfProgramIsRunning ) @@ -2284,12 +2274,12 @@ void RefreshScreen(void *DummyVariable) /////////////////////////////////////////////////////////////////////////////////////////////// - // + // // (1) Flip Pages // (2) If the page flipping worked, then we copy the contents of the primary surface back - // to the backbuffer + // to the backbuffer // (3) If step (2) was successfull we then restore the mouse background onto the backbuffer - // if fShowMouse is TRUE + // if fShowMouse is TRUE // /////////////////////////////////////////////////////////////////////////////////////////////// @@ -2305,10 +2295,10 @@ void RefreshScreen(void *DummyVariable) do { ReturnCode = IDirectDrawSurface_Blt( - gpPrimarySurface, // dest surface - &rcWindow, // dest rect - gpBackBuffer, // src surface - NULL, // src rect (all of it) + gpPrimarySurface, // dest surface + &rcWindow, // dest rect + gpBackBuffer, // src surface + NULL, // src rect (all of it) DDBLT_WAIT, NULL); if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING)) @@ -2318,7 +2308,6 @@ void RefreshScreen(void *DummyVariable) { return; } - DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); if (ReturnCode == DDERR_SURFACELOST) @@ -2329,9 +2318,9 @@ void RefreshScreen(void *DummyVariable) } while (ReturnCode != DD_OK); gfRenderScroll = FALSE; - gfScrollStart = FALSE; - guiDirtyRegionCount = 0; - guiDirtyRegionExCount = 0; + gfScrollStart = FALSE; + guiDirtyRegionCount = 0; + guiDirtyRegionExCount = 0; gfForceFullScreenRefresh = FALSE; } else @@ -2339,9 +2328,9 @@ void RefreshScreen(void *DummyVariable) do { ReturnCode = IDirectDrawSurface_Flip( - _gpPrimarySurface, - NULL, - gGameExternalOptions.gfVSync ? DDFLIP_WAIT : 0x00000008l + _gpPrimarySurface, + NULL, + gGameExternalOptions.gfVSync ? DDFLIP_WAIT : 0x00000008l ); if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING)) @@ -2351,7 +2340,6 @@ void RefreshScreen(void *DummyVariable) { return; } - DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); if (ReturnCode == DDERR_SURFACELOST) @@ -2395,7 +2383,7 @@ void RefreshScreen(void *DummyVariable) gfRenderScroll = FALSE; - gfScrollStart = FALSE; + gfScrollStart = FALSE; } @@ -2467,17 +2455,17 @@ void RefreshScreen(void *DummyVariable) } } while (ReturnCode != DD_OK); - guiDirtyRegionCount = 0; - guiDirtyRegionExCount = 0; + guiDirtyRegionCount = 0; + guiDirtyRegionExCount = 0; gfForceFullScreenRefresh = FALSE; } else { for (uiIndex = 0; uiIndex < guiDirtyRegionCount; uiIndex++) { - Region.left = gListOfDirtyRegions[uiIndex].iLeft; - Region.top = gListOfDirtyRegions[uiIndex].iTop; - Region.right = gListOfDirtyRegions[uiIndex].iRight; + Region.left = gListOfDirtyRegions[uiIndex].iLeft; + Region.top = gListOfDirtyRegions[uiIndex].iTop; + Region.right = gListOfDirtyRegions[uiIndex].iRight; Region.bottom = gListOfDirtyRegions[uiIndex].iBottom; do @@ -2503,9 +2491,9 @@ void RefreshScreen(void *DummyVariable) // Do extended dirty regions! for (uiIndex = 0; uiIndex < guiDirtyRegionExCount; uiIndex++) { - Region.left = gDirtyRegionsEx[uiIndex].iLeft; - Region.top = gDirtyRegionsEx[uiIndex].iTop; - Region.right = gDirtyRegionsEx[uiIndex].iRight; + Region.left = gDirtyRegionsEx[uiIndex].iLeft; + Region.top = gDirtyRegionsEx[uiIndex].iTop; + Region.right = gDirtyRegionsEx[uiIndex].iRight; Region.bottom = gDirtyRegionsEx[uiIndex].iBottom; if ( ( Region.top < gsVIEWPORT_WINDOW_END_Y ) && gfRenderScroll ) @@ -2528,7 +2516,7 @@ void RefreshScreen(void *DummyVariable) } while (ReturnCode != DD_OK); } } - guiDirtyRegionExCount = 0; + guiDirtyRegionExCount = 0; ENDOFLOOP: @@ -2590,13 +2578,13 @@ LPDIRECTDRAWSURFACE2 GetMouseBufferObject(void) /////////////////////////////////////////////////////////////////////////////////////////////////// // -// Buffer access functions +// Buffer access functions // /////////////////////////////////////////////////////////////////////////////////////////////////// PTR LockPrimarySurface(UINT32 *uiPitch) { - HRESULT ReturnCode; + HRESULT ReturnCode; DDSURFACEDESC SurfaceDescription; @@ -2624,14 +2612,14 @@ PTR LockPrimarySurface(UINT32 *uiPitch) void UnlockPrimarySurface(void) { DDSURFACEDESC SurfaceDescription; - HRESULT ReturnCode; + HRESULT ReturnCode; ZEROMEM(SurfaceDescription); SurfaceDescription.dwSize = sizeof(DDSURFACEDESC); ReturnCode = IDirectDrawSurface2_Unlock(gpPrimarySurface, &SurfaceDescription); if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING)) { - DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); + DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); } } @@ -2639,7 +2627,7 @@ void UnlockPrimarySurface(void) PTR LockBackBuffer(UINT32 *uiPitch) { - HRESULT ReturnCode; + HRESULT ReturnCode; DDSURFACEDESC SurfaceDescription; // @@ -2674,7 +2662,7 @@ PTR LockBackBuffer(UINT32 *uiPitch) void UnlockBackBuffer(void) { DDSURFACEDESC SurfaceDescription; - HRESULT ReturnCode; + HRESULT ReturnCode; // // W A R N I N G ---- W A R N I N G ---- W A R N I N G ---- W A R N I N G ---- W A R N I N G ---- @@ -2689,7 +2677,7 @@ void UnlockBackBuffer(void) ReturnCode = IDirectDrawSurface2_Unlock(gpBackBuffer, &SurfaceDescription); if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING)) { - DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); + DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); } } @@ -2697,7 +2685,7 @@ void UnlockBackBuffer(void) PTR LockFrameBuffer(UINT32 *uiPitch) { - HRESULT ReturnCode; + HRESULT ReturnCode; DDSURFACEDESC SurfaceDescription; @@ -2727,7 +2715,7 @@ PTR LockFrameBuffer(UINT32 *uiPitch) void UnlockFrameBuffer(void) { DDSURFACEDESC SurfaceDescription; - HRESULT ReturnCode; + HRESULT ReturnCode; ZEROMEM(SurfaceDescription); @@ -2735,7 +2723,7 @@ void UnlockFrameBuffer(void) ReturnCode = IDirectDrawSurface2_Unlock(gpFrameBuffer, &SurfaceDescription); if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING)) { - DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); + DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); } } @@ -2743,7 +2731,7 @@ void UnlockFrameBuffer(void) PTR LockMouseBuffer(UINT32 *uiPitch) { - HRESULT ReturnCode; + HRESULT ReturnCode; DDSURFACEDESC SurfaceDescription; @@ -2766,28 +2754,28 @@ PTR LockMouseBuffer(UINT32 *uiPitch) void UnlockMouseBuffer(void) { DDSURFACEDESC SurfaceDescription; - HRESULT ReturnCode; + HRESULT ReturnCode; ZEROMEM(SurfaceDescription); SurfaceDescription.dwSize = sizeof(DDSURFACEDESC); ReturnCode = IDirectDrawSurface2_Unlock(gpMouseCursorOriginal, &SurfaceDescription); if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING)) { - DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); + DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); } } /////////////////////////////////////////////////////////////////////////////////////////////////// // -// RGB color management functions +// RGB color management functions // /////////////////////////////////////////////////////////////////////////////////////////////////// BOOLEAN GetRGBDistribution(void) { DDSURFACEDESC SurfaceDescription; - UINT16 usBit; - HRESULT ReturnCode; + UINT16 usBit; + HRESULT ReturnCode; Assert ( gpPrimarySurface != NULL ); @@ -2811,9 +2799,9 @@ BOOLEAN GetRGBDistribution(void) // Ok we now have the surface description, we now can get the information that we need // - gusRedMask = (UINT16) SurfaceDescription.ddpfPixelFormat.dwRBitMask; + gusRedMask = (UINT16) SurfaceDescription.ddpfPixelFormat.dwRBitMask; gusGreenMask = (UINT16) SurfaceDescription.ddpfPixelFormat.dwGBitMask; - gusBlueMask = (UINT16) SurfaceDescription.ddpfPixelFormat.dwBBitMask; + gusBlueMask = (UINT16) SurfaceDescription.ddpfPixelFormat.dwBBitMask; if (!gusRedMask) { @@ -2861,9 +2849,9 @@ BOOLEAN GetRGBDistribution(void) BOOLEAN GetPrimaryRGBDistributionMasks(UINT32 *RedBitMask, UINT32 *GreenBitMask, UINT32 *BlueBitMask) { - *RedBitMask = gusRedMask; + *RedBitMask = gusRedMask; *GreenBitMask = gusGreenMask; - *BlueBitMask = gusBlueMask; + *BlueBitMask = gusBlueMask; return TRUE; } @@ -2872,10 +2860,10 @@ BOOLEAN GetPrimaryRGBDistributionMasks(UINT32 *RedBitMask, UINT32 *GreenBitMask, BOOLEAN SetMouseCursorFromObject(UINT32 uiVideoObjectHandle, UINT16 usVideoObjectSubIndex, UINT16 usOffsetX, UINT16 usOffsetY ) { - BOOLEAN ReturnValue; - PTR pTmpPointer; - UINT32 uiPitch; - ETRLEObject pETRLEPointer; + BOOLEAN ReturnValue; + PTR pTmpPointer; + UINT32 uiPitch; + ETRLEObject pETRLEPointer; // // Erase cursor background @@ -2914,8 +2902,8 @@ BOOLEAN SetMouseCursorFromObject(UINT32 uiVideoObjectHandle, UINT16 usVideoObjec BOOLEAN EraseMouseCursor( ) { - PTR pTmpPointer; - UINT32 uiPitch; + PTR pTmpPointer; + UINT32 uiPitch; // // Erase cursor background @@ -2933,14 +2921,14 @@ BOOLEAN SetMouseCursorProperties( INT16 sOffsetX, INT16 sOffsetY, UINT16 usCurso { gsMouseCursorXOffset = sOffsetX; gsMouseCursorYOffset = sOffsetY; - gusMouseCursorWidth = usCursorWidth; + gusMouseCursorWidth = usCursorWidth; gusMouseCursorHeight = usCursorHeight; return( TRUE ); } BOOLEAN BltToMouseCursor(UINT32 uiVideoObjectHandle, UINT16 usVideoObjectSubIndex, UINT16 usXPos, UINT16 usYPos ) { - BOOLEAN ReturnValue; + BOOLEAN ReturnValue; ReturnValue = BltVideoObjectFromIndex(MOUSE_BUFFER, uiVideoObjectHandle, usVideoObjectSubIndex, usXPos, usYPos, VO_BLT_SRCTRANSPARENCY, NULL); @@ -2998,7 +2986,7 @@ BOOLEAN LoadCursorFile(STR8 pFilename) gpCursorStore = CreateVideoObject(&VideoObjectDescription); // - // Were we successful in creating the cursor store ? + // Were we successful in creating the cursor store ? // if (gpCursorStore == NULL) @@ -3011,12 +2999,12 @@ BOOLEAN LoadCursorFile(STR8 pFilename) /////////////////////////////////////////////////////////////////////////////////////////////////// -BOOLEAN SetCurrentCursor(UINT16 usVideoObjectSubIndex, UINT16 usOffsetX, UINT16 usOffsetY ) +BOOLEAN SetCurrentCursor(UINT16 usVideoObjectSubIndex, UINT16 usOffsetX, UINT16 usOffsetY ) { - BOOLEAN ReturnValue; - PTR pTmpPointer; - UINT32 uiPitch; - ETRLEObject pETRLEPointer; + BOOLEAN ReturnValue; + PTR pTmpPointer; + UINT32 uiPitch; + ETRLEObject pETRLEPointer; // // Make sure we have a cursor store @@ -3093,7 +3081,7 @@ void PrintScreen(void) /////////////////////////////////////////////////////////////////////////////////////////////////// BOOLEAN Set8BPPPalette(SGPPaletteEntry *pPalette) { - HRESULT ReturnCode; + HRESULT ReturnCode; // If we are in 256 colors, then we have to initialize the palette system to 0 (faded out) memcpy(gSgpPalette, pPalette, sizeof(SGPPaletteEntry)*256); @@ -3101,28 +3089,28 @@ BOOLEAN Set8BPPPalette(SGPPaletteEntry *pPalette) ReturnCode = IDirectDraw_CreatePalette(gpDirectDrawObject, (DDPCAPS_8BIT | DDPCAPS_ALLOW256), (LPPALETTEENTRY)(&gSgpPalette[0]), &gpDirectDrawPalette, NULL); if (ReturnCode != DD_OK) { - DebugMsg(TOPIC_VIDEO, DBG_LEVEL_0, String("Failed to create palette (Rc = %d)", ReturnCode)); + DebugMsg(TOPIC_VIDEO, DBG_LEVEL_0, String("Failed to create palette (Rc = %d)", ReturnCode)); return(FALSE); } // Apply the palette to the surfaces ReturnCode = IDirectDrawSurface_SetPalette(gpPrimarySurface, gpDirectDrawPalette); if (ReturnCode != DD_OK) { - DebugMsg(TOPIC_VIDEO, DBG_LEVEL_0, String("Failed to apply 8-bit palette to primary surface")); + DebugMsg(TOPIC_VIDEO, DBG_LEVEL_0, String("Failed to apply 8-bit palette to primary surface")); return(FALSE); } ReturnCode = IDirectDrawSurface_SetPalette(gpBackBuffer, gpDirectDrawPalette); if (ReturnCode != DD_OK) { - DebugMsg(TOPIC_VIDEO, DBG_LEVEL_0, String("Failed to apply 8-bit palette to back buffer")); + DebugMsg(TOPIC_VIDEO, DBG_LEVEL_0, String("Failed to apply 8-bit palette to back buffer")); return(FALSE); } ReturnCode = IDirectDrawSurface_SetPalette(gpFrameBuffer, gpDirectDrawPalette); if (ReturnCode != DD_OK) { - DebugMsg(TOPIC_VIDEO, DBG_LEVEL_0, String("Failed to apply 8-bit palette to frame buffer")); + DebugMsg(TOPIC_VIDEO, DBG_LEVEL_0, String("Failed to apply 8-bit palette to frame buffer")); return(FALSE); } @@ -3134,8 +3122,8 @@ void FatalError( const STR8 pError, ...) { va_list argptr; - va_start(argptr, pError); // Set up variable argument pointer - vsprintf(gFatalErrorString, pError, argptr); + va_start(argptr, pError); // Set up variable argument pointer + vsprintf(gFatalErrorString, pError, argptr); va_end(argptr); @@ -3159,8 +3147,8 @@ void FatalError( const STR8 pError, ...) /********************************************************************************* * SnapshotSmall * -* Grabs a screen from the [rimary surface, and stuffs it into a 16-bit (RGB 5,5,5), -* uncompressed Targa file. Each time the routine is called, it increments the +* Grabs a screen from the [rimary surface, and stuffs it into a 16-bit (RGB 5,5,5), +* uncompressed Targa file. Each time the routine is called, it increments the * file number by one. The files are create in the current directory, usually the * EXE directory. This routine produces 1/4 sized images. * @@ -3194,7 +3182,7 @@ void SnapshotSmall(void) DDSURFACEDESC SurfaceDescription; UINT16 *pVideo, *pDest; - HRESULT ReturnCode; + HRESULT ReturnCode; ZEROMEM(SurfaceDescription); @@ -3231,7 +3219,7 @@ void SnapshotSmall(void) // uiData=(UINT16)*(pVideo+(iCountY*SCREEN_WIDTH*2)+ ( iCountX * 2 ) ); // 1111 1111 1100 0000 - // f f c + // f f c // usPixel555= (UINT16)(uiData&0xffff); // usPixel555= ((usPixel555 & 0xffc0) >> 1) | (usPixel555 & 0x1f); @@ -3258,7 +3246,7 @@ void SnapshotSmall(void) ReturnCode = IDirectDrawSurface2_Unlock(gpPrimarySurface, &SurfaceDescription); if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING)) { - DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); + DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); } // fclose(disk); diff --git a/Standard Gaming Platform/video.h b/Standard Gaming Platform/video.h index eef0d38a..1654e589 100644 --- a/Standard Gaming Platform/video.h +++ b/Standard Gaming Platform/video.h @@ -12,18 +12,18 @@ #include "VSurface.h" #include "Mutex Manager.h" -#define BUFFER_READY 0x00 -#define BUFFER_BUSY 0x01 -#define BUFFER_DIRTY 0x02 -#define BUFFER_DISABLED 0x03 +#define BUFFER_READY 0x00 +#define BUFFER_BUSY 0x01 +#define BUFFER_DIRTY 0x02 +#define BUFFER_DISABLED 0x03 -#define MAX_CURSOR_WIDTH 64 -#define MAX_CURSOR_HEIGHT 64 +#define MAX_CURSOR_WIDTH 64 +#define MAX_CURSOR_HEIGHT 64 #define VIDEO_NO_CURSOR 0xFFFF extern HWND ghWindow; -extern UINT32 guiMouseBufferState; // BUFFER_READY, BUFFER_DIRTY, BUFFER_DISABLED +extern UINT32 guiMouseBufferState; // BUFFER_READY, BUFFER_DIRTY, BUFFER_DISABLED /* #ifdef __cplusplus @@ -31,40 +31,40 @@ extern "C" { #endif */ -extern BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void *WindowProc); -extern void ShutdownVideoManager(void); -extern void SuspendVideoManager(void); -extern BOOLEAN RestoreVideoManager(void); -extern void GetCurrentVideoSettings(UINT16 *usWidth, UINT16 *usHeight, UINT8 *ubBitDepth); -extern BOOLEAN CanBlitToFrameBuffer(void); -extern BOOLEAN CanBlitToMouseBuffer(void); -extern void InvalidateRegion(INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom); -extern void InvalidateRegions(SGPRect *pArrayOfRegions, UINT32 uiRegionCount); -extern void InvalidateScreen(void); -extern void InvalidateFrameBuffer(void); -extern void SetFrameBufferRefreshOverride(PTR pFrameBufferRefreshOverride); -extern LPDIRECTDRAW2 GetDirectDraw2Object(void); +extern BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void *WindowProc); +extern void ShutdownVideoManager(void); +extern void SuspendVideoManager(void); +extern BOOLEAN RestoreVideoManager(void); +extern void GetCurrentVideoSettings(UINT16 *usWidth, UINT16 *usHeight, UINT8 *ubBitDepth); +extern BOOLEAN CanBlitToFrameBuffer(void); +extern BOOLEAN CanBlitToMouseBuffer(void); +extern void InvalidateRegion(INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom); +extern void InvalidateRegions(SGPRect *pArrayOfRegions, UINT32 uiRegionCount); +extern void InvalidateScreen(void); +extern void InvalidateFrameBuffer(void); +extern void SetFrameBufferRefreshOverride(PTR pFrameBufferRefreshOverride); +extern LPDIRECTDRAW2 GetDirectDraw2Object(void); extern LPDIRECTDRAWSURFACE2 GetPrimarySurfaceObject(void); extern LPDIRECTDRAWSURFACE2 GetBackBufferObject(void); extern LPDIRECTDRAWSURFACE2 GetFrameBufferObject(void); extern LPDIRECTDRAWSURFACE2 GetMouseBufferObject(void); -extern PTR LockPrimarySurface(UINT32 *uiPitch); -extern void UnlockPrimarySurface(void); -extern PTR LockBackBuffer(UINT32 *uiPitch); -extern void UnlockBackBuffer(void); -extern PTR LockFrameBuffer(UINT32 *uiPitch); -extern void UnlockFrameBuffer(void); -extern PTR LockMouseBuffer(UINT32 *uiPitch); -extern void UnlockMouseBuffer(void); -extern BOOLEAN GetRGBDistribution(void); -extern BOOLEAN GetPrimaryRGBDistributionMasks(UINT32 *RedBitMask, UINT32 *GreenBitMask, UINT32 *BblueBitMask); +extern PTR LockPrimarySurface(UINT32 *uiPitch); +extern void UnlockPrimarySurface(void); +extern PTR LockBackBuffer(UINT32 *uiPitch); +extern void UnlockBackBuffer(void); +extern PTR LockFrameBuffer(UINT32 *uiPitch); +extern void UnlockFrameBuffer(void); +extern PTR LockMouseBuffer(UINT32 *uiPitch); +extern void UnlockMouseBuffer(void); +extern BOOLEAN GetRGBDistribution(void); +extern BOOLEAN GetPrimaryRGBDistributionMasks(UINT32 *RedBitMask, UINT32 *GreenBitMask, UINT32 *BblueBitMask); extern BOOLEAN SetMouseCursorFromObject(UINT32 uiVideoObjectHandle, UINT16 usVideoObjectSubIndex, UINT16 usOffsetX, UINT16 usOffsetY ); -extern BOOLEAN HideMouseCursor(void); -extern BOOLEAN LoadCursorFile(STR8 pFilename); -extern BOOLEAN SetCurrentCursor(UINT16 usVideoObjectSubIndex, UINT16 usOffsetX, UINT16 usOffsetY ); -extern void StartFrameBufferRender(void); -extern void EndFrameBufferRender(void); -extern void PrintScreen(void); +extern BOOLEAN HideMouseCursor(void); +extern BOOLEAN LoadCursorFile(STR8 pFilename); +extern BOOLEAN SetCurrentCursor(UINT16 usVideoObjectSubIndex, UINT16 usOffsetX, UINT16 usOffsetY ); +extern void StartFrameBufferRender(void); +extern void EndFrameBufferRender(void); +extern void PrintScreen(void); diff --git a/Standard Gaming Platform/video_private.h b/Standard Gaming Platform/video_private.h index 9f3125fd..c2db612e 100644 --- a/Standard Gaming Platform/video_private.h +++ b/Standard Gaming Platform/video_private.h @@ -16,6 +16,6 @@ LPDIRECTDRAWSURFACE2 GetBackbufferInterface( ); BOOLEAN SetDirectDraw2Object( LPDIRECTDRAW2 pDirectDraw ); BOOLEAN SetPrimarySurfaceInterface( LPDIRECTDRAWSURFACE2 pSurface ); -BOOLEAN SetBackbufferInterface( LPDIRECTDRAWSURFACE2 pSurface ); +BOOLEAN SetBackbufferInterface( LPDIRECTDRAWSURFACE2 pSurface ); #endif diff --git a/Standard Gaming Platform/vobject.cpp b/Standard Gaming Platform/vobject.cpp index 0063099d..25765140 100644 --- a/Standard Gaming Platform/vobject.cpp +++ b/Standard Gaming Platform/vobject.cpp @@ -68,7 +68,7 @@ typedef struct VOBJECT_NODE { HVOBJECT hVObject; UINT32 uiIndex; - struct VOBJECT_NODE *next, *prev; + struct VOBJECT_NODE *next, *prev; #ifdef SGP_VIDEO_DEBUGGING STR8 pName; @@ -77,8 +77,8 @@ typedef struct VOBJECT_NODE }VOBJECT_NODE; -VOBJECT_NODE *gpVObjectHead = NULL; -VOBJECT_NODE *gpVObjectTail = NULL; +VOBJECT_NODE *gpVObjectHead = NULL; +VOBJECT_NODE *gpVObjectTail = NULL; UINT32 guiVObjectIndex = 1; UINT32 guiVObjectSize = 0; UINT32 guiVObjectTotalAdded = 0; @@ -111,19 +111,19 @@ void CheckValidVObjectIndex( UINT32 uiIndex ); // // ************************************************************** -int filter(unsigned int code, struct _EXCEPTION_POINTERS *ep) +int filter(unsigned int code, struct _EXCEPTION_POINTERS *ep) { - puts("in filter."); - if (code == EXCEPTION_ACCESS_VIOLATION) { - puts("caught AV as expected."); - return EXCEPTION_EXECUTE_HANDLER; - } + puts("in filter."); + if (code == EXCEPTION_ACCESS_VIOLATION) { + puts("caught AV as expected."); + return EXCEPTION_EXECUTE_HANDLER; + } - else - { - puts("didn't catch AV, unexpected."); - return EXCEPTION_CONTINUE_SEARCH; - }; + else + { + puts("didn't catch AV, unexpected."); + return EXCEPTION_CONTINUE_SEARCH; + }; } BOOLEAN InitializeVideoObjectManager( ) @@ -277,7 +277,7 @@ BOOLEAN GetVideoObject( HVOBJECT *hVObject, UINT32 uiIndex ) BOOLEAN BltVideoObjectFromIndex(UINT32 uiDestVSurface, UINT32 uiSrcVObject, UINT16 usRegionIndex, INT32 iDestX, INT32 iDestY, UINT32 fBltFlags, blt_fx *pBltFx ) { - UINT16 *pBuffer; + UINT16 *pBuffer; UINT32 uiPitch; HVOBJECT hSrcVObject; @@ -302,7 +302,7 @@ BOOLEAN BltVideoObjectFromIndex(UINT32 uiDestVSurface, UINT32 uiSrcVObject, UINT // Now we have the video object and surface, call the VO blitter function if ( !BltVideoObjectToBuffer( pBuffer, uiPitch, hSrcVObject, usRegionIndex, iDestX, iDestY, fBltFlags, pBltFx ) ) { - UnLockVideoSurface( uiDestVSurface ); + UnLockVideoSurface( uiDestVSurface ); // VO Blitter will set debug messages for error conditions return FALSE; } @@ -312,7 +312,7 @@ BOOLEAN BltVideoObjectFromIndex(UINT32 uiDestVSurface, UINT32 uiSrcVObject, UINT } -BOOLEAN DeleteVideoObjectFromIndex( UINT32 uiVObject ) +BOOLEAN DeleteVideoObjectFromIndex( UINT32 uiVObject ) { VOBJECT_NODE *curr; @@ -347,7 +347,7 @@ BOOLEAN DeleteVideoObjectFromIndex( UINT32 uiVObject ) { //Make the next node point to the prev curr->prev->next = curr->next; } - //The node is now detached. Now deallocate it. + //The node is now detached. Now deallocate it. #ifdef SGP_VIDEO_DEBUGGING if( curr->pName ) MemFree( curr->pName ); @@ -376,13 +376,13 @@ BOOLEAN DeleteVideoObjectFromIndex( UINT32 uiVObject ) // Based on flags, blit accordingly // There are two types, a BltFast and a Blt. BltFast is 10% faster, uses no // clipping lists -BOOLEAN BltVideoObject( UINT32 uiDestVSurface, - HVOBJECT hSrcVObject, - UINT16 usRegionIndex, - INT32 iDestX, - INT32 iDestY, - UINT32 fBltFlags, - blt_fx *pBltFx ) +BOOLEAN BltVideoObject( UINT32 uiDestVSurface, + HVOBJECT hSrcVObject, + UINT16 usRegionIndex, + INT32 iDestX, + INT32 iDestY, + UINT32 fBltFlags, + blt_fx *pBltFx ) { UINT16 *pBuffer; @@ -507,7 +507,7 @@ HVOBJECT CreateVideoObject( VOBJECT_DESC *VObjectDesc ) // while( FALSE ); // All is well -// DbgMessage( TOPIC_VIDEOOBJECT, DBG_LEVEL_3, String("Success in Creating Video Object" ) ); +// DbgMessage( TOPIC_VIDEOOBJECT, DBG_LEVEL_3, String("Success in Creating Video Object" ) ); return( hVObject ); } @@ -548,7 +548,7 @@ BOOLEAN SetVideoObjectPalette( HVOBJECT hVObject, SGPPaletteEntry *pSrcPalette ) hVObject->p16BPPPalette = Create16BPPPalette( pSrcPalette ); hVObject->pShadeCurrent = hVObject->p16BPPPalette; -// DbgMessage(TOPIC_VIDEOOBJECT, DBG_LEVEL_3, String("Video Object Palette change successfull" )); +// DbgMessage(TOPIC_VIDEOOBJECT, DBG_LEVEL_3, String("Video Object Palette change successfull" )); return( TRUE ); } @@ -727,7 +727,7 @@ BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJE if ( hSrcVObject == NULL ) { - int i=0; + //int breakpoint=0; } Assert( hSrcVObject != NULL ); @@ -756,7 +756,7 @@ BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJE } else #endif - if ( fBltFlags & VO_BLT_SRCTRANSPARENCY ) + if ( fBltFlags & VO_BLT_SRCTRANSPARENCY ) { if(BltIsClipped(hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect)) Blt8BPPDataTo16BPPBufferTransparentClip( pBuffer, uiDestPitchBYTES, hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect); @@ -764,7 +764,7 @@ BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJE Blt8BPPDataTo16BPPBufferTransparent( pBuffer, uiDestPitchBYTES, hSrcVObject, iDestX, iDestY, usIndex ); break; } - else if ( fBltFlags & VO_BLT_SHADOW ) + else if ( fBltFlags & VO_BLT_SHADOW ) { if(BltIsClipped(hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect)) Blt8BPPDataTo16BPPBufferShadowClip( pBuffer, uiDestPitchBYTES, hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect); @@ -776,7 +776,7 @@ BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJE } else if(gbPixelDepth==8) { - if ( fBltFlags & VO_BLT_SRCTRANSPARENCY ) + if ( fBltFlags & VO_BLT_SRCTRANSPARENCY ) { if(BltIsClipped(hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect)) Blt8BPPDataTo8BPPBufferTransparentClip( pBuffer, uiDestPitchBYTES, hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect); @@ -784,7 +784,7 @@ BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJE Blt8BPPDataTo8BPPBufferTransparent( pBuffer, uiDestPitchBYTES, hSrcVObject, iDestX, iDestY, usIndex ); break; } - else if ( fBltFlags & VO_BLT_SHADOW ) + else if ( fBltFlags & VO_BLT_SHADOW ) { if(BltIsClipped(hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect)) Blt8BPPDataTo8BPPBufferShadowClip( pBuffer, uiDestPitchBYTES, hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect); @@ -809,11 +809,11 @@ BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJE } } -BOOLEAN PixelateVideoObjectRect( UINT32 uiDestVSurface, INT32 X1, INT32 Y1, INT32 X2, INT32 Y2) +BOOLEAN PixelateVideoObjectRect( UINT32 uiDestVSurface, INT32 X1, INT32 Y1, INT32 X2, INT32 Y2) { UINT16 *pBuffer; UINT32 uiPitch; - SGPRect area; + SGPRect area; UINT8 uiPattern[8][8]={ {0,1,0,1,0,1,0,1}, {1,0,1,0,1,0,1,0}, {0,1,0,1,0,1,0,1}, @@ -911,7 +911,7 @@ UINT16 SetObjectShade(HVOBJECT pObj, UINT32 uiShade) if(pObj->pShades[uiShade]==NULL) { - DbgMessage(TOPIC_VIDEOOBJECT, DBG_LEVEL_2, String("Attempt to set shade level to NULL table")); + DbgMessage(TOPIC_VIDEOOBJECT, DBG_LEVEL_2, String("Attempt to set shade level to NULL table")); return(FALSE); } @@ -928,7 +928,7 @@ UINT16 SetObjectHandleShade(UINT32 uiHandle, UINT32 uiShade) #endif if(!GetVideoObject(&hObj, uiHandle)) { - DbgMessage(TOPIC_VIDEOOBJECT, DBG_LEVEL_2, String("Invalid object handle for setting shade level")); + DbgMessage(TOPIC_VIDEOOBJECT, DBG_LEVEL_2, String("Invalid object handle for setting shade level")); return(FALSE); } return(SetObjectShade(hObj, uiShade)); @@ -1259,7 +1259,7 @@ BOOLEAN ConvertVObjectRegionTo16BPP( HVOBJECT hVObject, UINT16 usRegionIndex, UI pInput++; //uiDataLoop++; if(uiLen!=p16BPPObject->usWidth) - DbgMessage(TOPIC_VIDEOOBJECT, DBG_LEVEL_1, String( "Actual pixel width different from header width" )); + DbgMessage(TOPIC_VIDEOOBJECT, DBG_LEVEL_1, String( "Actual pixel width different from header width" )); uiLen=0; } @@ -1296,7 +1296,7 @@ BOOLEAN ConvertVObjectRegionTo16BPP( HVOBJECT hVObject, UINT16 usRegionIndex, UI BOOLEAN BltVideoObjectOutlineFromIndex(UINT32 uiDestVSurface, UINT32 uiSrcVObject, UINT16 usIndex, INT32 iDestX, INT32 iDestY, INT16 s16BPPColor, BOOLEAN fDoOutline ) { - UINT16 *pBuffer; + UINT16 *pBuffer; UINT32 uiPitch; HVOBJECT hSrcVObject; @@ -1316,11 +1316,11 @@ BOOLEAN BltVideoObjectOutlineFromIndex(UINT32 uiDestVSurface, UINT32 uiSrcVObjec if( BltIsClipped( hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect) ) { - Blt8BPPDataTo16BPPBufferOutlineClip((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, s16BPPColor, fDoOutline, &ClippingRect ); + Blt8BPPDataTo16BPPBufferOutlineClip((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, s16BPPColor, fDoOutline, &ClippingRect ); } else { - Blt8BPPDataTo16BPPBufferOutline((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, s16BPPColor, fDoOutline ); + Blt8BPPDataTo16BPPBufferOutline((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, s16BPPColor, fDoOutline ); } // Now we have the video object and surface, call the VO blitter function @@ -1331,7 +1331,7 @@ BOOLEAN BltVideoObjectOutlineFromIndex(UINT32 uiDestVSurface, UINT32 uiSrcVObjec BOOLEAN BltVideoObjectOutline(UINT32 uiDestVSurface, HVOBJECT hSrcVObject, UINT16 usIndex, INT32 iDestX, INT32 iDestY, INT16 s16BPPColor, BOOLEAN fDoOutline ) { - UINT16 *pBuffer; + UINT16 *pBuffer; UINT32 uiPitch; // Lock video surface pBuffer = (UINT16*)LockVideoSurface( uiDestVSurface, &uiPitch ); @@ -1343,11 +1343,11 @@ BOOLEAN BltVideoObjectOutline(UINT32 uiDestVSurface, HVOBJECT hSrcVObject, UINT1 if( BltIsClipped( hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect) ) { - Blt8BPPDataTo16BPPBufferOutlineClip((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, s16BPPColor, fDoOutline, &ClippingRect ); + Blt8BPPDataTo16BPPBufferOutlineClip((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, s16BPPColor, fDoOutline, &ClippingRect ); } else { - Blt8BPPDataTo16BPPBufferOutline((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, s16BPPColor, fDoOutline ); + Blt8BPPDataTo16BPPBufferOutline((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, s16BPPColor, fDoOutline ); } // Now we have the video object and surface, call the VO blitter function @@ -1360,7 +1360,7 @@ BOOLEAN BltVideoObjectOutline(UINT32 uiDestVSurface, HVOBJECT hSrcVObject, UINT1 BOOLEAN BltVideoObjectOutlineShadowFromIndex(UINT32 uiDestVSurface, UINT32 uiSrcVObject, UINT16 usIndex, INT32 iDestX, INT32 iDestY ) { - UINT16 *pBuffer; + UINT16 *pBuffer; UINT32 uiPitch; HVOBJECT hSrcVObject; @@ -1380,11 +1380,11 @@ BOOLEAN BltVideoObjectOutlineShadowFromIndex(UINT32 uiDestVSurface, UINT32 uiSrc if( BltIsClipped( hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect) ) { - Blt8BPPDataTo16BPPBufferOutlineShadowClip((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect ); + Blt8BPPDataTo16BPPBufferOutlineShadowClip((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect ); } else { - Blt8BPPDataTo16BPPBufferOutlineShadow((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex ); + Blt8BPPDataTo16BPPBufferOutlineShadow((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex ); } // Now we have the video object and surface, call the VO blitter function @@ -1395,7 +1395,7 @@ BOOLEAN BltVideoObjectOutlineShadowFromIndex(UINT32 uiDestVSurface, UINT32 uiSrc BOOLEAN BltVideoObjectOutlineShadow(UINT32 uiDestVSurface, HVOBJECT hSrcVObject, UINT16 usIndex, INT32 iDestX, INT32 iDestY ) { - UINT16 *pBuffer; + UINT16 *pBuffer; UINT32 uiPitch; // Lock video surface pBuffer = (UINT16*)LockVideoSurface( uiDestVSurface, &uiPitch ); @@ -1407,11 +1407,11 @@ BOOLEAN BltVideoObjectOutlineShadow(UINT32 uiDestVSurface, HVOBJECT hSrcVObject, if( BltIsClipped( hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect) ) { - Blt8BPPDataTo16BPPBufferOutlineShadowClip((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect ); + Blt8BPPDataTo16BPPBufferOutlineShadowClip((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect ); } else { - Blt8BPPDataTo16BPPBufferOutlineShadow((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex ); + Blt8BPPDataTo16BPPBufferOutlineShadow((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex ); } // Now we have the video object and surface, call the VO blitter function @@ -1599,3 +1599,4 @@ void PerformVideoInfoDumpIntoFile( const STR8 filename, BOOLEAN fAppend ) #endif + diff --git a/Standard Gaming Platform/vobject_blitters.cpp b/Standard Gaming Platform/vobject_blitters.cpp index 73665bbb..91a01976 100644 --- a/Standard Gaming Platform/vobject_blitters.cpp +++ b/Standard Gaming Platform/vobject_blitters.cpp @@ -23,18 +23,18 @@ /* Here are bliting functions. If you dont know what kind of functions they are so : - * correct me if im wrong they copy array of bits from src image to dest image - * maby we can get ride this includes above? we dont need theme here i thinks so - * any questions? joker + * correct me if im wrong they copy array of bits from src image to dest image + * maby we can get ride this includes above? we dont need theme here i thinks so + * any questions? joker */ -/* ClipingRect was declared here with static initializer - * We need to change that and initialize it in run-time - * any questions? joker +/* ClipingRect was declared here with static initializer + * We need to change that and initialize it in run-time + * any questions? joker */ SGPRect ClippingRect; - + UINT32 guiTranslucentMask=0x3def; //0x7bef; // mask for halving 5,6,5 // GLOBALS for pre-calculating skip values @@ -270,7 +270,7 @@ BTrans1: sub LSCount, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -529,7 +529,7 @@ BTrans1: sub LSCount, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -585,11 +585,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZNBClipTranslucent( UINT16 *pBuffer, UINT32 UINT16 *p16BPPPalette; UINT32 uiOffset, uiLineFlag; UINT32 usHeight, usWidth, Unblitted; -UINT8 *SrcPtr, *DestPtr, *ZPtr; +UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; -INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; -INT32 ClipX1, ClipY1, ClipX2, ClipY2; +INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; +INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -799,7 +799,7 @@ BTrans1: sub LSCount, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -845,9 +845,9 @@ BlitDone: BOOLEAN Blt8BPPDataTo16BPPBufferTransZTranslucent( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) { UINT32 usHeight, usWidth, uiOffset, LineSkip; -INT32 iTempX, iTempY; +INT32 iTempX, iTempY; UINT16 *p16BPPPalette; -UINT8 *SrcPtr, *DestPtr, *ZPtr; +UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 uiLineFlag; ETRLEObject *pTrav; @@ -934,7 +934,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -974,11 +974,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZClipTranslucent( UINT16 *pBuffer, UINT32 u UINT16 *p16BPPPalette; UINT32 uiOffset, uiLineFlag; UINT32 usHeight, usWidth, Unblitted; -UINT8 *SrcPtr, *DestPtr, *ZPtr; +UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; -INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; -INT32 ClipX1, ClipY1, ClipX2, ClipY2; +INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; +INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -1190,7 +1190,7 @@ BTrans1: sub LSCount, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -1236,9 +1236,9 @@ BlitDone: BOOLEAN Blt8BPPDataTo16BPPBufferTransZNBTranslucent( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) { UINT32 usHeight, usWidth, uiOffset, LineSkip; -INT32 iTempX, iTempY; +INT32 iTempX, iTempY; UINT16 *p16BPPPalette; -UINT8 *SrcPtr, *DestPtr, *ZPtr; +UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 uiLineFlag; ETRLEObject *pTrav; @@ -1322,7 +1322,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -1370,12 +1370,12 @@ BOOLEAN Blt8BPPDataTo8BPPBufferTransZIncClip( UINT16 *pBuffer, UINT32 uiDestPitc { UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; + UINT8 *pPal8BPP; UINT16 usZLevel, usZLinesToGo; // Assertions @@ -1584,7 +1584,7 @@ BTrans1: sub LSCount, ecx add edi, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add ebx, ecx jmp BlitDispatch @@ -1637,11 +1637,11 @@ UINT16 *InitZBuffer(UINT32 uiPitch, UINT32 uiHeight) { UINT16 *pBuffer; /* - * ClippingRect was declared first with SCREEN_WIDTH and HEIGHT but now they are not - * constant so i will initialize it here - * any questions? joker - */ - + * ClippingRect was declared first with SCREEN_WIDTH and HEIGHT but now they are not + * constant so i will initialize it here + * any questions? joker + */ + ClippingRect.iLeft = 0; ClippingRect.iTop = 0; @@ -1728,10 +1728,10 @@ BOOLEAN Blt8BPPDataTo8BPPBuffer( UINT8 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJE { static UINT32 uiOffset; static UINT32 usHeight, usWidth; - static UINT8 *SrcPtr, *DestPtr; + static UINT8 *SrcPtr, *DestPtr; static UINT32 LineSkip; static ETRLEObject *pTrav; - static INT32 iTempX, iTempY; + static INT32 iTempX, iTempY; // Assertions @@ -1838,11 +1838,11 @@ BOOLEAN Blt8BPPDataTo8BPPBufferMonoShadow( UINT16 *pBuffer, UINT32 uiDestPitchBY { UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip, LineSkipZ; ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; + INT32 iTempX, iTempY; + UINT8 *pPal8BPP; // Assertions @@ -1971,12 +1971,12 @@ BOOLEAN Blt8BPPDataTo8BPPBufferMonoShadowClip( UINT8 *pBuffer, UINT32 uiDestPitc { UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; + UINT8 *pPal8BPP; // Assertions Assert( hSrcVObject != NULL ); @@ -2237,12 +2237,12 @@ BOOLEAN Blt8BPPDataTo8BPPBufferTransZPixelate( UINT16 *pBuffer, UINT32 uiDestPit { UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip, LineSkipZ; ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; UINT32 uiLineFlag; - UINT8 *pPal8BPP; + UINT8 *pPal8BPP; // Assertions Assert( hSrcVObject != NULL ); @@ -2331,7 +2331,7 @@ BlitTransparent: and ecx, 07fH add edi, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add ebx, ecx jmp BlitDispatch @@ -2367,12 +2367,12 @@ BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBPixelate( UINT16 *pBuffer, UINT32 uiDestP { UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip, LineSkipZ; ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; UINT32 uiLineFlag; - UINT8 *pPal8BPP; + UINT8 *pPal8BPP; // Assertions Assert( hSrcVObject != NULL ); @@ -2458,7 +2458,7 @@ BlitTransparent: and ecx, 07fH add edi, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add ebx, ecx jmp BlitDispatch @@ -2493,13 +2493,13 @@ BOOLEAN Blt8BPPDataTo8BPPBufferTransZClipPixelate( UINT16 *pBuffer, UINT32 uiDes { UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; UINT32 uiLineFlag; - UINT8 *pPal8BPP; + UINT8 *pPal8BPP; // Assertions Assert( hSrcVObject != NULL ); @@ -2719,7 +2719,7 @@ BTrans1: sub LSCount, ecx add edi, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add ebx, ecx jmp BlitDispatch @@ -2763,13 +2763,13 @@ BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBClipPixelate( UINT16 *pBuffer, UINT32 uiD { UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; UINT32 uiLineFlag; - UINT8 *pPal8BPP; + UINT8 *pPal8BPP; // Assertions Assert( hSrcVObject != NULL ); @@ -2986,7 +2986,7 @@ BTrans1: sub LSCount, ecx add edi, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add ebx, ecx jmp BlitDispatch @@ -3043,12 +3043,12 @@ BOOLEAN Blt8BPPDataTo8BPPBufferTransparentClip( UINT16 *pBuffer, UINT32 uiDestPi { UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; + UINT8 *pPal8BPP; // Assertions Assert( hSrcVObject != NULL ); @@ -3323,10 +3323,10 @@ BOOLEAN Blt8BPPDataTo8BPPBufferTransparent( UINT16 *pBuffer, UINT32 uiDestPitchB { UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *pPal8BPP; + UINT8 *SrcPtr, *DestPtr, *pPal8BPP; UINT32 LineSkip; ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; // Assertions @@ -3473,11 +3473,11 @@ BOOLEAN Blt8BPPDataTo8BPPBufferTransZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, { UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip, LineSkipZ, uiZComp; ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; + INT32 iTempX, iTempY; + UINT8 *pPal8BPP; // Assertions @@ -3668,7 +3668,7 @@ BlitTransparent: and ecx, 07fH add edi, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add ebx, ecx jmp BlitDispatch @@ -3703,11 +3703,11 @@ BOOLEAN Blt8BPPDataTo8BPPBufferTransZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYTE { UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip, LineSkipZ; ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; + INT32 iTempX, iTempY; + UINT8 *pPal8BPP; // Assertions @@ -3783,7 +3783,7 @@ BlitTransparent: and ecx, 07fH add edi, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add ebx, ecx jmp BlitDispatch @@ -3819,11 +3819,11 @@ BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBColor( UINT16 *pBuffer, UINT32 uiDestPitc { UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip, LineSkipZ; ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; + INT32 iTempX, iTempY; + UINT8 *pPal8BPP; // Assertions @@ -3906,7 +3906,7 @@ BlitTransparent: and ecx, 07fH add edi, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add ebx, ecx jmp BlitDispatch @@ -3941,12 +3941,12 @@ BOOLEAN Blt8BPPDataTo8BPPBufferTransZClip( UINT16 *pBuffer, UINT32 uiDestPitchBY { UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; + UINT8 *pPal8BPP; // Assertions Assert( hSrcVObject != NULL ); @@ -4151,7 +4151,7 @@ BTrans1: sub LSCount, ecx add edi, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add ebx, ecx jmp BlitDispatch @@ -4194,12 +4194,12 @@ BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBClip( UINT16 *pBuffer, UINT32 uiDestPitch { UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; + UINT8 *pPal8BPP; // Assertions Assert( hSrcVObject != NULL ); @@ -4401,7 +4401,7 @@ BTrans1: sub LSCount, ecx add edi, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add ebx, ecx jmp BlitDispatch @@ -4444,12 +4444,12 @@ BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBClipColor( UINT16 *pBuffer, UINT32 uiDest { UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; + UINT8 *pPal8BPP; // Assertions Assert( hSrcVObject != NULL ); @@ -4659,7 +4659,7 @@ BTrans1: sub LSCount, ecx add edi, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add ebx, ecx jmp BlitDispatch @@ -4700,11 +4700,11 @@ BOOLEAN Blt8BPPDataTo8BPPBufferShadowZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES { UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip, LineSkipZ; ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; + INT32 iTempX, iTempY; + UINT8 *pPal8BPP; // Assertions @@ -4781,7 +4781,7 @@ BlitTransparent: and ecx, 07fH add edi, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add ebx, ecx jmp BlitDispatch @@ -4814,11 +4814,11 @@ BOOLEAN Blt8BPPDataTo8BPPBufferShadowZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYT { UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip, LineSkipZ; ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; + INT32 iTempX, iTempY; + UINT8 *pPal8BPP; // Assertions @@ -4892,7 +4892,7 @@ BlitTransparent: and ecx, 07fH add edi, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add ebx, ecx jmp BlitDispatch @@ -4927,12 +4927,12 @@ BOOLEAN Blt8BPPDataTo8BPPBufferShadowZClip( UINT16 *pBuffer, UINT32 uiDestPitchB { UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; + UINT8 *pPal8BPP; // Assertions Assert( hSrcVObject != NULL ); @@ -5136,7 +5136,7 @@ BTrans1: sub LSCount, ecx add edi, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add ebx, ecx jmp BlitDispatch @@ -5179,12 +5179,12 @@ BOOLEAN Blt8BPPDataTo8BPPBufferShadowZNBClip( UINT16 *pBuffer, UINT32 uiDestPitc { UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; + UINT8 *pPal8BPP; // Assertions Assert( hSrcVObject != NULL ); @@ -5385,7 +5385,7 @@ BTrans1: sub LSCount, ecx add edi, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add ebx, ecx jmp BlitDispatch @@ -5429,11 +5429,11 @@ BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZ( UINT16 *pBuffer, UINT32 uiDestPitch { UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip, LineSkipZ; ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; + INT32 iTempX, iTempY; + UINT8 *pPal8BPP; // Assertions @@ -5520,7 +5520,7 @@ BlitTransparent: and ecx, 07fH add edi, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add ebx, ecx jmp BlitDispatch @@ -5556,11 +5556,11 @@ BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZNB( UINT16 *pBuffer, UINT32 uiDestPit { UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip, LineSkipZ; ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; + INT32 iTempX, iTempY; + UINT8 *pPal8BPP; // Assertions @@ -5644,7 +5644,7 @@ BlitTransparent: and ecx, 07fH add edi, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add ebx, ecx jmp BlitDispatch @@ -5681,12 +5681,12 @@ BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZClip( UINT16 *pBuffer, UINT32 uiDestP { UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; + UINT8 *pPal8BPP; // Assertions Assert( hSrcVObject != NULL ); @@ -5899,7 +5899,7 @@ BTrans1: sub LSCount, ecx add edi, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add ebx, ecx jmp BlitDispatch @@ -5943,12 +5943,12 @@ BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZNBClip( UINT16 *pBuffer, UINT32 uiDes { UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; + UINT8 *pPal8BPP; // Assertions Assert( hSrcVObject != NULL ); @@ -6158,7 +6158,7 @@ BTrans1: sub LSCount, ecx add edi, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add ebx, ecx jmp BlitDispatch @@ -6199,10 +6199,10 @@ BOOLEAN Blt8BPPDataTo8BPPBufferShadow( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT8 *pPal8BPP; UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; + ETRLEObject *pTrav; + INT32 iTempX, iTempY; // Assertions Assert( hSrcVObject != NULL ); @@ -6310,7 +6310,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx jmp BlitDispatch @@ -6343,11 +6343,11 @@ BOOLEAN Blt8BPPDataTo8BPPBufferShadowClip( UINT16 *pBuffer, UINT32 uiDestPitchBY UINT8 *pPal8BPP; UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -6583,7 +6583,7 @@ BTrans1: sub ebx, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx jmp BlitDispatch @@ -6632,11 +6632,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferMonoShadowClip( UINT16 *pBuffer, UINT32 uiDestPi { UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -6859,7 +6859,7 @@ BTrans1: BTrans2: // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx jmp BlitDispatch @@ -7037,7 +7037,7 @@ SGPRect *clipregion=NULL; if(clipregion==NULL) { ClipX1= ClippingRect.iLeft; //0; it was changed, why??? joker//; - ClipY1= ClippingRect.iTop; //0; //; + ClipY1= ClippingRect.iTop; //0; //; ClipX2= ClippingRect.iRight; //SCREEN_WIDTH; //; ClipY2= ClippingRect.iBottom; //SCREEN_HEIGHT; //; } @@ -7083,8 +7083,8 @@ __asm { BlitNewLine: mov ecx, BlitLength - //add edi, ecx - //add edi, ecx + //add edi, ecx + //add edi, ecx BlitNTL2: @@ -7184,9 +7184,9 @@ BlitLineDone: BOOLEAN Blt8BPPDataTo16BPPBufferTransZPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) { UINT32 usHeight, usWidth, uiOffset, LineSkip; -INT32 iTempX, iTempY; +INT32 iTempX, iTempY; UINT16 *p16BPPPalette; -UINT8 *SrcPtr, *DestPtr, *ZPtr; +UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 uiLineFlag; ETRLEObject *pTrav; @@ -7276,7 +7276,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -7317,9 +7317,9 @@ BlitDone: BOOLEAN Blt8BPPDataTo16BPPBufferTransZPixelateObscured( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) { UINT32 usHeight, usWidth, uiOffset, LineSkip; -INT32 iTempX, iTempY; +INT32 iTempX, iTempY; UINT16 *p16BPPPalette; -UINT8 *SrcPtr, *DestPtr, *ZPtr; +UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 uiLineFlag; ETRLEObject *pTrav; @@ -7397,7 +7397,7 @@ BlitNTL7: // Write normal z value mov ax, usZValue mov [ebx], ax - //jmp BlitNTL10 + //jmp BlitNTL10 BlitNTL9: @@ -7426,7 +7426,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -7467,11 +7467,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZClipPixelate( UINT16 *pBuffer, UINT32 uiDe UINT16 *p16BPPPalette; UINT32 uiOffset, uiLineFlag; UINT32 usHeight, usWidth, Unblitted; -UINT8 *SrcPtr, *DestPtr, *ZPtr; +UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; -INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; -INT32 ClipX1, ClipY1, ClipX2, ClipY2; +INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; +INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -7687,7 +7687,7 @@ BTrans1: sub LSCount, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -7733,9 +7733,9 @@ BlitDone: BOOLEAN Blt8BPPDataTo16BPPBufferTransZNBPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) { UINT32 usHeight, usWidth, uiOffset, LineSkip; -INT32 iTempX, iTempY; +INT32 iTempX, iTempY; UINT16 *p16BPPPalette; -UINT8 *SrcPtr, *DestPtr, *ZPtr; +UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 uiLineFlag; ETRLEObject *pTrav; @@ -7826,7 +7826,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -7866,11 +7866,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZNBClipPixelate( UINT16 *pBuffer, UINT32 ui UINT16 *p16BPPPalette; UINT32 uiOffset, uiLineFlag; UINT32 usHeight, usWidth, Unblitted; -UINT8 *SrcPtr, *DestPtr, *ZPtr; +UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; -INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; -INT32 ClipX1, ClipY1, ClipX2, ClipY2; +INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; +INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -8086,7 +8086,7 @@ BTrans1: sub LSCount, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -8132,10 +8132,10 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; // Assertions @@ -8214,7 +8214,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -8251,10 +8251,10 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYT UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; // Assertions @@ -8330,7 +8330,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -8368,10 +8368,10 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZNBColor( UINT16 *pBuffer, UINT32 uiDestPit UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; // Assertions @@ -8452,7 +8452,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -8489,10 +8489,10 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransShadow( UINT16 *pBuffer, UINT32 uiDestPitch { UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip; ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; // Assertions @@ -8566,7 +8566,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx jmp BlitDispatch @@ -8601,10 +8601,10 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransShadowZ( UINT16 *pBuffer, UINT32 uiDestPitc { UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; // Assertions @@ -8688,7 +8688,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -8725,10 +8725,10 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransShadowZNB( UINT16 *pBuffer, UINT32 uiDestPi { UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; // Assertions @@ -8813,7 +8813,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -8866,7 +8866,7 @@ BlitNTL7: // Write normal z value mov ax, usZValue mov [ebx], ax - jmp BlitNTL10 + jmp BlitNTL10 BlitNTL9: @@ -8898,10 +8898,10 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransShadowZNBObscured( UINT16 *pBuffer, UINT32 { UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; UINT32 uiLineFlag; @@ -9014,7 +9014,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -9053,11 +9053,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransShadowZClip( UINT16 *pBuffer, UINT32 uiDest { UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -9268,7 +9268,7 @@ BTrans1: sub LSCount, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -9314,11 +9314,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransShadowClip( UINT16 *pBuffer, UINT32 uiDestP { UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -9518,7 +9518,7 @@ BTrans1: sub LSCount, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx jmp BlitDispatch @@ -9561,11 +9561,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransShadowZNBClip( UINT16 *pBuffer, UINT32 uiDe { UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -9777,7 +9777,7 @@ BTrans1: sub LSCount, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -9823,11 +9823,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredClip( UINT16 *pBuffer, UIN { UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted, uiLineFlag; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -10062,7 +10062,7 @@ BTrans1: sub LSCount, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -10110,11 +10110,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransShadowBelowOrEqualZNBClip( UINT16 *pBuffer, { UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -10326,7 +10326,7 @@ BTrans1: sub LSCount, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -10370,10 +10370,10 @@ BOOLEAN Blt8BPPDataTo16BPPBufferShadowZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTE UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; // Assertions @@ -10447,7 +10447,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -10484,11 +10484,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferShadowZClip( UINT16 *pBuffer, UINT32 uiDestPitch UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -10691,7 +10691,7 @@ BTrans1: sub LSCount, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -10734,10 +10734,10 @@ BOOLEAN Blt8BPPDataTo16BPPBufferShadowZNB( UINT16 *pBuffer, UINT32 uiDestPitchBY UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; // Assertions @@ -10809,7 +10809,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -10846,11 +10846,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferShadowZNBClip( UINT16 *pBuffer, UINT32 uiDestPit UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -11050,7 +11050,7 @@ BTrans1: sub LSCount, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -11095,11 +11095,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZClip( UINT16 *pBuffer, UINT32 uiDestPitchB UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -11302,7 +11302,7 @@ BTrans1: sub LSCount, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -11346,11 +11346,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZNBClip( UINT16 *pBuffer, UINT32 uiDestPitc UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -11550,7 +11550,7 @@ BTrans1: sub LSCount, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -11596,11 +11596,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZNBClipColor( UINT16 *pBuffer, UINT32 uiDes UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -11808,7 +11808,7 @@ BTrans1: sub LSCount, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -11848,9 +11848,9 @@ BOOLEAN Blt8BPPDataSubTo16BPPBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, H { UINT16 *p16BPPPalette; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip, LeftSkip, RightSkip, TopSkip, BlitLength, SrcSkip, BlitHeight; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; // Assertions Assert( hSrcVSurface != NULL ); @@ -11933,10 +11933,10 @@ BOOLEAN Blt8BPPDataTo16BPPBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVSU UINT16 *p16BPPPalette; // UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip; // ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; UINT32 rows; // Assertions @@ -12072,9 +12072,9 @@ BOOLEAN Blt8BPPDataTo16BPPBufferHalf( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, { UINT16 *p16BPPPalette; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; UINT32 uiSrcSkip; // Assertions @@ -12162,9 +12162,9 @@ BOOLEAN Blt8BPPDataTo16BPPBufferHalfRect( UINT16 *pBuffer, UINT32 uiDestPitchBYT { UINT16 *p16BPPPalette; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; UINT32 uiSrcSkip; // Assertions @@ -12182,10 +12182,10 @@ BOOLEAN Blt8BPPDataTo16BPPBufferHalfRect( UINT16 *pBuffer, UINT32 uiDestPitchBYT iTempY = iY; // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - CHECKF( usWidth > 0 ); - CHECKF( usHeight > 0 ); + CHECKF( iTempX >= 0 ); + CHECKF( iTempY >= 0 ); + CHECKF( usWidth > 0 ); + CHECKF( usHeight > 0 ); CHECKF( usHeight <= hSrcVSurface->usHeight); CHECKF( usWidth <= hSrcVSurface->usWidth); @@ -12256,10 +12256,10 @@ BOOLEAN Blt8BPPDataTo16BPPBufferMask(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, H UINT32 uiMOffset; UINT32 usHeight, usWidth; UINT32 usMHeight, usMWidth; - UINT8 *SrcPtr, *DestPtr, *MaskPtr; + UINT8 *SrcPtr, *DestPtr, *MaskPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; + ETRLEObject *pTrav; + INT32 iTempX, iTempY; // Assertions Assert( hSrcVObject != NULL ); @@ -12374,7 +12374,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx jmp BlitDispatch @@ -12415,25 +12415,25 @@ void GetClippingRect(SGPRect *clip) Blt16BPPBufferPixelateRectWithColor Given an 8x8 pattern and a color, pixelates an area by repeatedly "applying the color" to pixels whereever there - is a non-zero value in the pattern. + is a non-zero value in the pattern. - KM: Added Nov. 23, 1998 - This is all the code that I moved from Blt16BPPBufferPixelateRect(). + KM: Added Nov. 23, 1998 + This is all the code that I moved from Blt16BPPBufferPixelateRect(). This function now takes a color field (which previously was - always black. The 3rd assembler line in this function: + always black. The 3rd assembler line in this function: mov ax, usColor // color of pixel - + used to be: - xor eax, eax // color of pixel (black or 0) + xor eax, eax // color of pixel (black or 0) - This was the only internal modification I made other than adding the usColor argument. + This was the only internal modification I made other than adding the usColor argument. *********************************************************************************************/ BOOLEAN Blt16BPPBufferPixelateRectWithColor(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, SGPRect *area, UINT8 Pattern[8][8], UINT16 usColor ) { - INT32 width, height; + INT32 width, height; UINT32 LineSkip; UINT16 *DestPtr; INT32 iLeft, iTop, iRight, iBottom; @@ -12491,12 +12491,12 @@ BlitLine2: return(TRUE); } -//KM: Modified Nov. 23, 1998 -//Original prototype (this function) didn't have a color field. I've added the color field to +//KM: Modified Nov. 23, 1998 +//Original prototype (this function) didn't have a color field. I've added the color field to //Blt16BPPBufferPixelateRectWithColor(), moved the previous implementation of this function there, and added //the modification to allow a specific color. BOOLEAN Blt16BPPBufferPixelateRect(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, SGPRect *area, UINT8 Pattern[8][8] ) -{ +{ return Blt16BPPBufferPixelateRectWithColor( pBuffer, uiDestPitchBYTES, area, Pattern, 0 ); } @@ -12584,10 +12584,10 @@ BOOLEAN Blt8BPPDataTo16BPPBufferShadow( UINT16 *pBuffer, UINT32 uiDestPitchBYTES UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; + ETRLEObject *pTrav; + INT32 iTempX, iTempY; // Assertions Assert( hSrcVObject != NULL ); @@ -12695,7 +12695,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx jmp BlitDispatch @@ -12729,10 +12729,10 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransparent( UINT16 *pBuffer, UINT32 uiDestPitch UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip; ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; // Assertions @@ -12841,7 +12841,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx jmp BlitDispatch @@ -12865,29 +12865,29 @@ BlitDone: //***************************************************************************************** // Blt8BPPDataTo16BPPBufferTransMirror -// -// Blits an 8bpp ETRLE to a 16-bit buffer, mirroring the image, with transparency. -// -// Returns BOOLEAN - TRUE if successful -// -// UINT16 *pBuffer - 16bpp Destination buffer -// UINT32 uiDestPitchBYTES - Destination pitch in bytes -// HVOBJECT hSrcVObject - Source VOBJECT handle -// INT32 iX - X-location of blit -// INT32 iY - Y-location of blit -// UINT16 usIndex - VOBJECT image index to blit from // -// Created: 7/28/99 Derek Beland +// Blits an 8bpp ETRLE to a 16-bit buffer, mirroring the image, with transparency. +// +// Returns BOOLEAN - TRUE if successful +// +// UINT16 *pBuffer - 16bpp Destination buffer +// UINT32 uiDestPitchBYTES - Destination pitch in bytes +// HVOBJECT hSrcVObject - Source VOBJECT handle +// INT32 iX - X-location of blit +// INT32 iY - Y-location of blit +// UINT16 usIndex - VOBJECT image index to blit from +// +// Created: 7/28/99 Derek Beland //***************************************************************************************** BOOLEAN Blt8BPPDataTo16BPPBufferTransMirror( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) { UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 uiDestSkip; ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; // Assertions @@ -13010,7 +13010,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx sub edi, ecx jmp BlitDispatch @@ -13043,11 +13043,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransparentClip( UINT16 *pBuffer, UINT32 uiDestP UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -13290,7 +13290,7 @@ BTrans1: sub ebx, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx jmp BlitDispatch @@ -13330,9 +13330,9 @@ BlitDone: BOOLEAN BltIsClipped(HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion ) { UINT32 usHeight, usWidth; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -13393,11 +13393,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferShadowClip( UINT16 *pBuffer, UINT32 uiDestPitchB UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -13632,7 +13632,7 @@ BTrans1: sub ebx, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx jmp BlitDispatch @@ -13674,7 +13674,7 @@ BlitDone: *********************************************************************************************/ BOOLEAN Blt16BPPBufferShadowRect(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, SGPRect *area) { -INT32 width, height; +INT32 width, height; UINT32 LineSkip; UINT16 *DestPtr; @@ -13742,7 +13742,7 @@ BlitLine: *********************************************************************************************/ BOOLEAN Blt16BPPBufferShadowRectAlternateTable(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, SGPRect *area) { -INT32 width, height; +INT32 width, height; UINT32 LineSkip; UINT16 *DestPtr; @@ -13812,10 +13812,10 @@ BOOLEAN Blt8BPPDataTo16BPPBufferMonoShadow( UINT16 *pBuffer, UINT32 uiDestPitchB UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip; ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; // Assertions @@ -13921,7 +13921,7 @@ BlitTransparent: BTrans1: // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx jmp BlitDispatch @@ -13956,7 +13956,7 @@ BOOLEAN Blt8BPPDataTo16BPPBufferFullTransparent( HVOBJECT hDestVObject, HVOBJECT UINT16 us16BPPDestTransColor; // UINT16 us16BPPValue; UINT32 count; - UINT8 maskcolor; + UINT8 maskcolor; // Assertions Assert( hSrcVObject != NULL ); @@ -14007,7 +14007,7 @@ BOOLEAN Blt8BPPDataTo16BPPBufferFullTransparent( HVOBJECT hDestVObject, HVOBJECT // Convert to Pixel specification pDest = pDest + uiDestStart; - pSrc = pSrc + uiSrcStart; + pSrc = pSrc + uiSrcStart; __asm { mov esi, pSrc // pointer to current line start address in source @@ -14096,7 +14096,7 @@ BOOLEAN ClipReleatedSrcAndDestRectangles( HVOBJECT hDestVObject, HVOBJECT hSrcVO { // Both have to be modified or by default streching occurs SrcRect->iRight = hSrcVObject->usWidth; - DestRect->iRight = DestRect->iLeft + ( SrcRect->iRight - SrcRect->iLeft ); + DestRect->iRight = DestRect->iLeft + ( SrcRect->iRight - SrcRect->iLeft ); } if ( SrcRect->iBottom > hSrcVObject->usHeight ) { @@ -14125,7 +14125,7 @@ BOOLEAN ClipReleatedSrcAndDestRectangles( HVOBJECT hDestVObject, HVOBJECT hSrcVO { // Both have to be modified or by default streching occurs SrcRect->iLeft = 0; - DestRect->iLeft = DestRect->iRight - ( SrcRect->iRight - SrcRect->iLeft ); + DestRect->iLeft = DestRect->iRight - ( SrcRect->iRight - SrcRect->iLeft ); } if ( SrcRect->iTop < 0 ) { @@ -14140,7 +14140,7 @@ BOOLEAN ClipReleatedSrcAndDestRectangles( HVOBJECT hDestVObject, HVOBJECT hSrcVO BOOLEAN FillSurface( HVOBJECT hDestVObject, blt_fx *pBltFx ) { - DDBLTFX BlitterFX; + DDBLTFX BlitterFX; Assert( hDestVObject != NULL ); CHECKF( pBltFx != NULL ); @@ -14160,7 +14160,7 @@ BOOLEAN FillSurface( HVOBJECT hDestVObject, blt_fx *pBltFx ) BOOLEAN FillSurfaceRect( HVOBJECT hDestVObject, blt_fx *pBltFx ) { - DDBLTFX BlitterFX; + DDBLTFX BlitterFX; Assert( hDestVObject != NULL ); CHECKF( pBltFx != NULL ); @@ -14184,7 +14184,7 @@ BOOLEAN BltVObjectUsingDD( HVOBJECT hDestVObject, HVOBJECT hSrcVObject, UINT32 f UINT32 uiDDFlags; RECT DestRect; - // Blit using the correct blitter + // Blit using the correct blitter if ( fBltFlags & VO_BLT_FAST ) { @@ -14230,7 +14230,7 @@ BOOLEAN BltVObjectUsingDD( HVOBJECT hDestVObject, HVOBJECT hSrcVObject, UINT32 f } // Setup dest rectangle - DestRect.top = (int)iDestY; + DestRect.top = (int)iDestY; DestRect.left = (int)iDestX; DestRect.bottom = (int)iDestY + ( SrcRect->iBottom - SrcRect->iTop ); DestRect.right = (int)iDestX + ( SrcRect->iRight - SrcRect->iLeft ); @@ -14417,7 +14417,7 @@ FillLineEnd: } return(TRUE); -} +} /********************************************************************************************** @@ -14429,9 +14429,9 @@ FillLineEnd: CHAR8 BltIsClippedOrOffScreen( HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion ) { UINT32 usHeight, usWidth; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -14503,10 +14503,10 @@ BOOLEAN Blt8BPPDataTo16BPPBufferOutline( UINT16 *pBuffer, UINT32 uiDestPitchBYTE { UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip; ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; UINT16 *p16BPPPalette; @@ -14587,7 +14587,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx jmp BlitDispatch @@ -14613,11 +14613,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferOutlineClip( UINT16 *pBuffer, UINT32 uiDestPitch { UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; UINT16 *p16BPPPalette; @@ -14825,7 +14825,7 @@ BTrans1: sub LSCount, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx jmp BlitDispatch @@ -14858,11 +14858,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferOutlineZClip( UINT16 *pBuffer, UINT32 uiDestPitc { UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; UINT16 *p16BPPPalette; @@ -15086,7 +15086,7 @@ BTrans1: sub LSCount, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -15121,11 +15121,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferOutlineZPixelateObscuredClip( UINT16 *pBuffer, U { UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; UINT16 *p16BPPPalette; UINT32 uiLineFlag; @@ -15376,7 +15376,7 @@ BTrans1: sub LSCount, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -15413,10 +15413,10 @@ BOOLEAN Blt8BPPDataTo16BPPBufferOutlineShadow( UINT16 *pBuffer, UINT32 uiDestPit { UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip; ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; UINT16 *p16BPPPalette; @@ -15487,7 +15487,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx jmp BlitDispatch @@ -15514,11 +15514,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferOutlineShadowClip( UINT16 *pBuffer, UINT32 uiDes UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -15760,7 +15760,7 @@ BTrans1: sub ebx, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx jmp BlitDispatch @@ -15794,10 +15794,10 @@ BOOLEAN Blt8BPPDataTo16BPPBufferOutlineZ( UINT16 *pBuffer, UINT32 uiDestPitchBYT UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; // Assertions @@ -15894,7 +15894,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -15922,10 +15922,10 @@ BOOLEAN Blt8BPPDataTo16BPPBufferOutlineZPixelateObscured( UINT16 *pBuffer, UINT3 UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; UINT32 uiLineFlag; @@ -16045,7 +16045,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -16075,10 +16075,10 @@ BOOLEAN Blt8BPPDataTo16BPPBufferOutlineZNB( UINT16 *pBuffer, UINT32 uiDestPitchB UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; // Assertions @@ -16175,7 +16175,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -16211,10 +16211,10 @@ BOOLEAN Blt8BPPDataTo16BPPBufferIntensityZ( UINT16 *pBuffer, UINT32 uiDestPitchB UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; // Assertions @@ -16288,7 +16288,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -16325,11 +16325,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferIntensityZClip( UINT16 *pBuffer, UINT32 uiDestPi UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -16532,7 +16532,7 @@ BTrans1: sub LSCount, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -16575,10 +16575,10 @@ BOOLEAN Blt8BPPDataTo16BPPBufferIntensityZNB( UINT16 *pBuffer, UINT32 uiDestPitc UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; // Assertions @@ -16650,7 +16650,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -16687,11 +16687,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferIntensityZNBClip( UINT16 *pBuffer, UINT32 uiDest UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; + UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -16891,7 +16891,7 @@ BTrans1: sub LSCount, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -16936,11 +16936,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferIntensityClip( UINT16 *pBuffer, UINT32 uiDestPit UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + ETRLEObject *pTrav; + INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -17175,7 +17175,7 @@ BTrans1: sub ebx, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx jmp BlitDispatch @@ -17216,10 +17216,10 @@ BOOLEAN Blt8BPPDataTo16BPPBufferIntensity( UINT16 *pBuffer, UINT32 uiDestPitchBY UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr; + UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; + ETRLEObject *pTrav; + INT32 iTempX, iTempY; // Assertions Assert( hSrcVObject != NULL ); @@ -17327,7 +17327,7 @@ BlitTransparent: and ecx, 07fH // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx jmp BlitDispatch @@ -17365,11 +17365,11 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZClipPixelateObscured( UINT16 *pBuffer, UIN UINT16 *p16BPPPalette; UINT32 uiOffset, uiLineFlag; UINT32 usHeight, usWidth, Unblitted; -UINT8 *SrcPtr, *DestPtr, *ZPtr; +UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; -INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; -INT32 ClipX1, ClipY1, ClipX2, ClipY2; +INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; +INT32 ClipX1, ClipY1, ClipX2, ClipY2; // Assertions Assert( hSrcVObject != NULL ); @@ -17546,7 +17546,7 @@ BlitNTL1: // ONLY WRITE DATA IF WE REALLY SHOULD mov ax, usZValue mov [ebx], ax - jmp BlitNTL7 + jmp BlitNTL7 BlitNTL8: @@ -17591,7 +17591,7 @@ BTrans1: sub LSCount, ecx // shl ecx, 1 - add ecx, ecx + add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch @@ -17620,4 +17620,4 @@ BlitDone: return(TRUE); -} +} diff --git a/Standard Gaming Platform/vsurface.cpp b/Standard Gaming Platform/vsurface.cpp index d896366f..a0df171b 100644 --- a/Standard Gaming Platform/vsurface.cpp +++ b/Standard Gaming Platform/vsurface.cpp @@ -1167,7 +1167,7 @@ BYTE *LockVideoSurfaceBuffer( HVSURFACE hVSurface, UINT32 *pPitch ) // Assertions if ( hVSurface == NULL ) { - int i = 0; + //int breakpoint = 0; } diff --git a/Standard Gaming Platform/vsurface.h b/Standard Gaming Platform/vsurface.h index 6b852845..ff9b2763 100644 --- a/Standard Gaming Platform/vsurface.h +++ b/Standard Gaming Platform/vsurface.h @@ -16,10 +16,10 @@ // Defines for special video object handles given to blit function // -#define PRIMARY_SURFACE 0xFFFFFFF0 -#define BACKBUFFER 0xFFFFFFF1 -#define FRAME_BUFFER 0xFFFFFFF2 -#define MOUSE_BUFFER 0xFFFFFFF3 +#define PRIMARY_SURFACE 0xFFFFFFF0 +#define BACKBUFFER 0xFFFFFFF1 +#define FRAME_BUFFER 0xFFFFFFF2 +#define MOUSE_BUFFER 0xFFFFFFF3 // // Defines for blitting @@ -43,9 +43,9 @@ typedef struct { COLORVAL ColorFill; // Used for fill effect - SGPRect SrcRect; // Given SRC subrect instead of srcregion - SGPRect FillRect; // Given SRC subrect instead of srcregion - UINT16 DestRegion; // Given a DEST region for dest positions within the VO + SGPRect SrcRect; // Given SRC subrect instead of srcregion + SGPRect FillRect; // Given SRC subrect instead of srcregion + UINT16 DestRegion; // Given a DEST region for dest positions within the VO } blt_vs_fx; @@ -64,8 +64,8 @@ typedef struct // Used in the VSurface_DESC structure to describe creation flags // -#define VSURFACE_CREATE_DEFAULT 0x00000020 // Creates and empty Surface of given width, height and BPP -#define VSURFACE_CREATE_FROMFILE 0x00000040 // Creates a video Surface from a file ( using HIMAGE ) +#define VSURFACE_CREATE_DEFAULT 0x00000020 // Creates and empty Surface of given width, height and BPP +#define VSURFACE_CREATE_FROMFILE 0x00000040 // Creates a video Surface from a file ( using HIMAGE ) // // The following structure is used to define a region of the video Surface @@ -96,7 +96,7 @@ typedef struct PTR pSavedSurfaceData; // A void pointer, but for this implementation, is really a lpDirectDrawSurface; // pSavedSurfaceData is used to hold all video memory Surfaces so that they my be restored UINT32 fFlags; // Used to describe memory usage, etc - PTR pPalette; // A void pointer, but for this implementation a DDPalette + PTR pPalette; // A void pointer, but for this implementation a DDPalette UINT16 *p16BPPPalette; // A 16BPP palette used for 8->16 blits COLORVAL TransparentColor; // Defaults to 0,0,0 PTR pClipper; // A void pointer encapsolated as a clipper Surface @@ -182,7 +182,7 @@ BOOLEAN GetVideoSurfaceDescription( UINT32 uiIndex, UINT16 *usWidth, UINT16 *usH /////////////////////////////////////////////////////////////////////////////////////////////////// // Darkens a rectangular area on a surface for menus etc. -BOOLEAN PixelateVideoSurfaceRect( UINT32 uiDestVSurface, INT32 X1, INT32 Y1, INT32 X2, INT32 Y2); +BOOLEAN PixelateVideoSurfaceRect( UINT32 uiDestVSurface, INT32 X1, INT32 Y1, INT32 X2, INT32 Y2); // Created from a VSurface_DESC structure. Can be from a file via HIMAGE or empty. HVSURFACE CreateVideoSurface( VSURFACE_DESC *VSurfaceDesc ); @@ -228,7 +228,7 @@ BOOLEAN AddVSurfaceRegionAtIndex( HVSURFACE hVSurface, UINT16 usIndex, VSURFACE_ BOOLEAN AddVSurfaceRegions( HVSURFACE hVSurface, VSURFACE_REGION **ppNewRegions, UINT16 uiNumRegions ); BOOLEAN RemoveVSurfaceRegion( HVSURFACE hVSurface, UINT16 usIndex ); BOOLEAN ClearAllVSurfaceRegions( HVSURFACE hVSurface ); -BOOLEAN GetVSurfaceRegion( HVSURFACE hVSurface, UINT16 usIndex, VSURFACE_REGION *aRegion ); +BOOLEAN GetVSurfaceRegion( HVSURFACE hVSurface, UINT16 usIndex, VSURFACE_REGION *aRegion ); BOOLEAN GetNumRegions( HVSURFACE hVSurface , UINT32 *puiNumRegions ); BOOLEAN ReplaceVSurfaceRegion( HVSURFACE hVSurface , UINT16 usIndex, VSURFACE_REGION *aRegion ); BOOLEAN DeleteVideoSurfaceFromIndex( UINT32 uiIndex ); @@ -255,7 +255,7 @@ BOOLEAN BltVideoSurfaceToVideoSurface( HVSURFACE hDestVSurface, HVSURFACE hSrcVS HVSURFACE GetPrimaryVideoSurface( ); HVSURFACE GetBackBufferVideoSurface( ); -BOOLEAN ShadowVideoSurfaceRect( UINT32 uiDestVSurface, INT32 X1, INT32 Y1, INT32 X2, INT32 Y2); +BOOLEAN ShadowVideoSurfaceRect( UINT32 uiDestVSurface, INT32 X1, INT32 Y1, INT32 X2, INT32 Y2); BOOLEAN ShadowVideoSurfaceImage( UINT32 uiDestVSurface, HVOBJECT hImageHandle, INT32 iPosX, INT32 iPosY); // If the Dest Rect and the source rect are not the same size, the source surface will be either @@ -264,7 +264,7 @@ BOOLEAN BltStretchVideoSurface(UINT32 uiDestVSurface, UINT32 uiSrcVSurface, INT3 BOOLEAN MakeVSurfaceFromVObject(UINT32 uiVObject, UINT16 usSubIndex, UINT32 *puiVSurface); -BOOLEAN ShadowVideoSurfaceRectUsingLowPercentTable( UINT32 uiDestVSurface, INT32 X1, INT32 Y1, INT32 X2, INT32 Y2); +BOOLEAN ShadowVideoSurfaceRectUsingLowPercentTable( UINT32 uiDestVSurface, INT32 X1, INT32 Y1, INT32 X2, INT32 Y2); /* #ifdef __cplusplus diff --git a/Standard Gaming Platform/vsurface_private.h b/Standard Gaming Platform/vsurface_private.h index d3f5d019..29310d90 100644 --- a/Standard Gaming Platform/vsurface_private.h +++ b/Standard Gaming Platform/vsurface_private.h @@ -10,8 +10,8 @@ // *********************************************************************** LPDIRECTDRAWSURFACE2 GetVideoSurfaceDDSurface( HVSURFACE hVSurface ); -LPDIRECTDRAWSURFACE GetVideoSurfaceDDSurfaceOne( HVSURFACE hVSurface ); -LPDIRECTDRAWPALETTE GetVideoSurfaceDDPalette( HVSURFACE hVSurface ); +LPDIRECTDRAWSURFACE GetVideoSurfaceDDSurfaceOne( HVSURFACE hVSurface ); +LPDIRECTDRAWPALETTE GetVideoSurfaceDDPalette( HVSURFACE hVSurface ); HVSURFACE CreateVideoSurfaceFromDDSurface( LPDIRECTDRAWSURFACE2 lpDDSurface ); diff --git a/Strategic/AI Viewer.cpp b/Strategic/AI Viewer.cpp index f3f3d0e8..95a1c0e9 100644 --- a/Strategic/AI Viewer.cpp +++ b/Strategic/AI Viewer.cpp @@ -42,7 +42,7 @@ #endif #ifdef JA2BETAVERSION - + #define VIEWER_LEFT 15 #define VIEWER_TOP 15 #define VIEWER_WIDTH 417 @@ -183,9 +183,9 @@ BOOLEAN gfRenderMap; BOOLEAN gfViewEnemies = TRUE; INT8 gbViewLevel = 0; -UINT16 gusBlue; -UINT16 gusLtBlue; -UINT16 gusDkBlue; +UINT16 gusBlue; +UINT16 gusLtBlue; +UINT16 gusDkBlue; INT16 gsAINumAdmins = -1; INT16 gsAINumTroops = -1; @@ -241,7 +241,7 @@ void StringFromValue( STR16 str, INT32 iValue, UINT32 uiMax ) BOOLEAN CreateAIViewer() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; CHAR16 str[6]; //Kaiden: Loading INI file to read Values... @@ -251,11 +251,11 @@ BOOLEAN CreateAIViewer() //INT32 iMaxEnemyGroupSize = iniReader.ReadInteger("Options","MAX_STRATEGIC_TEAM_SIZE",20); //Check to see if data exists. - if( !FileExists( "DevTools\\arulco.sti" ) || + if( !FileExists( "DevTools\\arulco.sti" ) || !FileExists( "DevTools\\icons.sti" ) || !FileExists( "DevTools\\SmCheckbox.sti" ) ) { - ScreenMsg( FONT_WHITE, MSG_BETAVERSION, L"AIViewer missing data. Aborted." ); + ScreenMsg( FONT_WHITE, MSG_BETAVERSION, L"AIViewer missing data. Aborted." ); gfExitViewer = FALSE; gfViewerEntry = TRUE; return FALSE; @@ -275,106 +275,106 @@ BOOLEAN CreateAIViewer() gfRenderViewer = TRUE; //Create all of the buttons here - iViewerButton[ VIEWER_EXIT ] = + iViewerButton[ VIEWER_EXIT ] = CreateTextButton(L"Exit", BLOCKFONT2, FONT_RED, FONT_BLACK, BUTTON_USE_DEFAULT, - 585, 425, 50, 30, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, + 585, 425, 50, 30, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, ViewerExitCallback ); - iViewerButton[ VIEWER_TIMEPANEL ] = + iViewerButton[ VIEWER_TIMEPANEL ] = CreateTextButton( WORLDTIMESTR, FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, VIEWER_RIGHT + 3, 0, 88, 20, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, BUTTON_NO_CALLBACK, BUTTON_NO_CALLBACK ); DisableButton( iViewerButton[ VIEWER_TIMEPANEL ] ); SpecifyDisabledButtonStyle( iViewerButton[ VIEWER_TIMEPANEL ], DISABLED_STYLE_NONE ); - iViewerButton[ COMPRESSION0 ] = + iViewerButton[ COMPRESSION0 ] = CreateTextButton( L"0", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, VIEWER_RIGHT + 3, 20, 17, 16, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, Compression0Callback ); - iViewerButton[ COMPRESSION5 ] = + iViewerButton[ COMPRESSION5 ] = CreateTextButton( L"5", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, VIEWER_RIGHT + 20, 20, 17, 16, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, Compression5Callback ); - iViewerButton[ COMPRESSION15 ] = + iViewerButton[ COMPRESSION15 ] = CreateTextButton( L"15", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, VIEWER_RIGHT + 37, 20, 18, 16, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, Compression15Callback ); - iViewerButton[ COMPRESSION60 ] = + iViewerButton[ COMPRESSION60 ] = CreateTextButton( L"60", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, VIEWER_RIGHT + 55, 20, 18, 16, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, Compression60Callback ); /* - iViewerButton[ COMPRESSION6H ] = + iViewerButton[ COMPRESSION6H ] = CreateTextButton( L"6H", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, VIEWER_RIGHT + 73, 20, 18, 16, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, Compression6HCallback ); */ - iViewerButton[ VIEWER_RESET ] = + iViewerButton[ VIEWER_RESET ] = CreateTextButton( L"Reset Enemies", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, 526, 0, 114, 20, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, BUTTON_NO_CALLBACK, BUTTON_NO_CALLBACK ); DisableButton( iViewerButton[ VIEWER_RESET ] ); SpecifyDisabledButtonStyle( iViewerButton[ VIEWER_RESET ], DISABLED_STYLE_NONE ); - iViewerButton[ RESET_EASY ] = + iViewerButton[ RESET_EASY ] = CreateTextButton( L"Easy", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, 526, 20, 35, 16, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, EasyCallback ); - iViewerButton[ RESET_NORMAL ] = + iViewerButton[ RESET_NORMAL ] = CreateTextButton( L"Normal", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, 561, 20, 44, 16, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, NormalCallback ); - iViewerButton[ RESET_HARD ] = + iViewerButton[ RESET_HARD ] = CreateTextButton( L"Hard", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, 605, 20, 35, 16, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, HardCallback ); - iViewerButton[ TEST_INCOMING_4SIDES ] = + iViewerButton[ TEST_INCOMING_4SIDES ] = CreateTextButton( L"Incoming 4 Sides", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, VIEWER_RIGHT + 20, 100, 120, 18, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, TestIncoming4SidesCallback ); - iViewerButton[ START_CREATURE_QUEST ] = + iViewerButton[ START_CREATURE_QUEST ] = CreateTextButton( L"Start Creature Quest", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, VIEWER_RIGHT + 20, 125, 120, 18, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, StartCreatureQuestCallback ); - iViewerButton[ SPREAD_CREATURES ] = + iViewerButton[ SPREAD_CREATURES ] = CreateTextButton( L"Spread Creatures", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, VIEWER_RIGHT + 20, 150, 120, 18, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, SpreadCreaturesCallback ); - iViewerButton[ CREATURE_ATTACK ] = + iViewerButton[ CREATURE_ATTACK ] = CreateTextButton( L"Creature Attack", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, VIEWER_RIGHT + 20, 175, 120, 18, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, CreatureAttackCallback ); - iViewerButton[ QUEEN_AWAKE_TOGGLE ] = + iViewerButton[ QUEEN_AWAKE_TOGGLE ] = CreateCheckBoxButton( 104, VIEWER_BOTTOM + 22, "DevTools//SmCheckbox.sti", MSYS_PRIORITY_HIGH, ToggleQueenAwake ); if( gfQueenAIAwake ) { ButtonList[ iViewerButton[ QUEEN_AWAKE_TOGGLE ] ]->uiFlags |= BUTTON_CLICKED_ON; } - iViewerButton[ RELOAD_SECTOR ] = + iViewerButton[ RELOAD_SECTOR ] = CreateTextButton( L"Override Sector", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, 10, VIEWER_BOTTOM + 5, 90, 18, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, ReloadSectorCallback ); - iViewerButton[ VIEW_ENEMIES ] = + iViewerButton[ VIEW_ENEMIES ] = CreateTextButton( L"View Enemies", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, VIEWER_RIGHT + 13, 40, 90, 20, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, ViewEnemiesCallback ); - iViewerButton[ VIEW_CREATURES ] = + iViewerButton[ VIEW_CREATURES ] = CreateTextButton( L"View Creatures", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, VIEWER_RIGHT + 103, 40, 90, 20, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, ViewCreaturesCallback ); - iViewerButton[ BASEMENT1_BTN ] = + iViewerButton[ BASEMENT1_BTN ] = CreateTextButton( L"B1", FONT16ARIAL, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, VIEWER_RIGHT + 58, 60, 30, 24, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, B1Callback ); - iViewerButton[ BASEMENT2_BTN ] = + iViewerButton[ BASEMENT2_BTN ] = CreateTextButton( L"B2", FONT16ARIAL, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, VIEWER_RIGHT + 88, 60, 30, 24, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, B2Callback ); - iViewerButton[ BASEMENT3_BTN ] = + iViewerButton[ BASEMENT3_BTN ] = CreateTextButton( L"B3", FONT16ARIAL, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, VIEWER_RIGHT + 118, 60, 30, 24, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, B3Callback ); @@ -402,7 +402,7 @@ BOOLEAN CreateAIViewer() ButtonList[ iViewerButton[ RESET_EASY + gGameOptions.ubDifficultyLevel - DIF_LEVEL_EASY ] ]->uiFlags |= BUTTON_CLICKED_ON; ButtonList[ iViewerButton[ COMPRESSION0 ] ]->uiFlags |= BUTTON_CLICKED_ON; if( !GamePaused() ) - SetGameMinutesPerSecond( 0 ); + SetGameMinutesPerSecond( 0 ); ClearViewerRegion( 0, 0, 640, 480 ); return TRUE; @@ -540,7 +540,6 @@ void RenderMovingGroupsAndMercs() UINT8 ubNumTroops, ubNumAdmins, ubNumElites; float ratio; INT32 minX, maxX, minY, maxY; - //INT32 iSector = 0; UINT8 ubIconType; UINT8 ubIconColor; UINT8 ubFontColor; @@ -633,7 +632,7 @@ void RenderMovingGroupsAndMercs() if( !pGroup->pWaypoints ) { if( GetJA2Clock() % 1000 < 750 ) - { + { SetFontForeground( FONT_WHITE ); } } @@ -665,8 +664,8 @@ void RenderInfoInSector() mprintf( 105, VIEWER_BOTTOM + 10, L"GLOBAL INFO" ); SetFontForeground( FONT_GRAY2 ); mprintf( 118, VIEWER_BOTTOM + 24, L"Strategic AI Awake" ); - mprintf( 105, VIEWER_BOTTOM + 36, L"Total Request Points: %d", giRequestPoints ); - mprintf( 105, VIEWER_BOTTOM + 46, L"Total Reinforcement Points: %d", giReinforcementPoints ); + mprintf( 105, VIEWER_BOTTOM + 36, L"Total Request Points: %d", giRequestPoints ); + mprintf( 105, VIEWER_BOTTOM + 46, L"Total Reinforcement Points: %d", giReinforcementPoints ); mprintf( 105, VIEWER_BOTTOM + 56, L"Progress (Current/Highest): %d%%/%d%%", CurrentPlayerProgressPercentage(), HighestPlayerProgressPercentage() ); PrintEnemyPopTable(); @@ -686,7 +685,7 @@ void RenderInfoInSector() ubSectorY = (UINT8)gsSelSectorY; } else - { + { return; } @@ -699,14 +698,14 @@ void RenderInfoInSector() pSoldier = MercPtrs[ i ]; if( pSoldier->bActive && pSoldier->sSectorX == ubSectorX && pSoldier->sSectorY == ubSectorY && pSoldier->bSectorZ == gbViewLevel ) { - if( pSoldier->bLife ) + if( pSoldier->stats.bLife ) { ubMercs++; - if( pSoldier->bLife >= OKLIFE ) + if( pSoldier->stats.bLife >= OKLIFE ) { if( pSoldier->bBreath < OKBREATH ) ubCollapsed++; - else + else ubActive++; } else @@ -741,25 +740,25 @@ void RenderInfoInSector() pGroup = pGroup->next; } ClearViewerRegion( 280, 375, 640, 480 ); - mprintf( 280, yp, L"SECTOR INFO: %c%d (ID: %d)", ubSectorY + 'A' - 1, ubSectorX, SECTOR( ubSectorX, ubSectorY ) ); + mprintf( 280, yp, L"SECTOR INFO: %c%d (ID: %d)", ubSectorY + 'A' - 1, ubSectorX, SECTOR( ubSectorX, ubSectorY ) ); yp += 10; SetFontForeground( FONT_LTGREEN ); - mprintf( 280, yp, L"%d Player Mercs: (%d Active, %d Unconcious, %d Collapsed)", + mprintf( 280, yp, L"%d Player Mercs: (%d Active, %d Unconcious, %d Collapsed)", ubMercs, ubActive, ubUnconcious, ubCollapsed ); yp += 10; SetFontForeground( FONT_LTBLUE ); - mprintf( 280, yp, L"Militia: (%d Green, %d Regular, %d Elite)", + mprintf( 280, yp, L"Militia: (%d Green, %d Regular, %d Elite)", pSector->ubNumberOfCivsAtLevel[0], pSector->ubNumberOfCivsAtLevel[1], pSector->ubNumberOfCivsAtLevel[2] ); yp += 10; SetFontForeground( FONT_ORANGE ); - mprintf( 280, yp, L"Garrison: (%d:%d Admins, %d:%d Troops, %d:%d Elites)", - pSector->ubAdminsInBattle, pSector->ubNumAdmins, - pSector->ubTroopsInBattle, pSector->ubNumTroops, + mprintf( 280, yp, L"Garrison: (%d:%d Admins, %d:%d Troops, %d:%d Elites)", + pSector->ubAdminsInBattle, pSector->ubNumAdmins, + pSector->ubTroopsInBattle, pSector->ubNumTroops, pSector->ubElitesInBattle, pSector->ubNumElites ); yp += 10; - mprintf( 280, yp, L"%d Groups: (%d:%d Admins, %d:%d Troops, %d:%d Elites)", ubNumGroups, - ubAdminsInBattle, ubNumAdmins, - ubTroopsInBattle, ubNumTroops, + mprintf( 280, yp, L"%d Groups: (%d:%d Admins, %d:%d Troops, %d:%d Elites)", ubNumGroups, + ubAdminsInBattle, ubNumAdmins, + ubTroopsInBattle, ubNumTroops, ubElitesInBattle, ubNumElites ); yp += 10; SetFontForeground( FONT_WHITE ); @@ -772,7 +771,7 @@ void RenderInfoInSector() else { SetFontForeground( FONT_YELLOW ); - mprintf( 280, yp, L"Monsters: (%d:%d)", pSector->ubCreaturesInBattle, pSector->ubNumCreatures ); + mprintf( 280, yp, L"Monsters: (%d:%d)", pSector->ubCreaturesInBattle, pSector->ubNumCreatures ); yp += 10; } } @@ -785,14 +784,14 @@ void RenderInfoInSector() { return; } - mprintf( 280, yp, L"SECTOR INFO: %c%d_b%d", ubSectorY + 'A' - 1, ubSectorX, gbViewLevel ); + mprintf( 280, yp, L"SECTOR INFO: %c%d_b%d", ubSectorY + 'A' - 1, ubSectorX, gbViewLevel ); yp += 10; SetFontForeground( FONT_LTGREEN ); - mprintf( 280, yp, L"%d Player Mercs: (%d Active, %d Unconcious, %d Collapsed)", + mprintf( 280, yp, L"%d Player Mercs: (%d Active, %d Unconcious, %d Collapsed)", ubMercs, ubActive, ubUnconcious, ubCollapsed ); yp += 10; SetFontForeground( FONT_YELLOW ); - mprintf( 280, yp, L"Monsters: (%d:%d)", pSector->ubCreaturesInBattle, pSector->ubNumCreatures ); + mprintf( 280, yp, L"Monsters: (%d:%d)", pSector->ubCreaturesInBattle, pSector->ubNumCreatures ); yp += 10; if( pSector->uiFlags & SF_PENDING_ALTERNATE_MAP ) { @@ -805,7 +804,7 @@ void RenderInfoInSector() yp += 10; } } - + } void RenderViewer() @@ -1121,16 +1120,16 @@ void ViewerMapClickCallback( MOUSE_REGION *reg, INT32 reason ) -UINT32 AIViewerScreenInit() +UINT32 AIViewerScreenInit() { gfViewerEntry = TRUE; - gusBlue = Get16BPPColor( FROMRGB( 65, 79, 94 ) ); + gusBlue = Get16BPPColor( FROMRGB( 65, 79, 94 ) ); gusLtBlue = Get16BPPColor( FROMRGB( 122, 124, 121 ) ); - gusDkBlue = Get16BPPColor( FROMRGB( 22, 55, 73 ) ); + gusDkBlue = Get16BPPColor( FROMRGB( 22, 55, 73 ) ); return TRUE; } -UINT32 AIViewerScreenHandle() +UINT32 AIViewerScreenHandle() { StartFrameBufferRender(); @@ -1151,7 +1150,7 @@ UINT32 AIViewerScreenHandle() gfRenderViewer = TRUE; SpecifyButtonText( iViewerButton[ VIEWER_TIMEPANEL ], WORLDTIMESTR ); } - + HandleViewerInput(); RenderViewer(); @@ -1173,7 +1172,7 @@ UINT32 AIViewerScreenHandle() return AIVIEWER_SCREEN; } -UINT32 AIViewerScreenShutdown() +UINT32 AIViewerScreenShutdown() { return TRUE; } @@ -1316,7 +1315,7 @@ void StartCreatureQuestCallback( GUI_BUTTON *btn, INT32 reason ) { if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { - //Madd: wtf? gGameOptions.ubGameStyle == STYLE_PLATINUM; + //Madd: wtf? gGameOptions.ubGameStyle == STYLE_PLATINUM; gfRenderMap = TRUE; ClearCreatureQuest(); InitCreatureQuest(); @@ -1440,7 +1439,7 @@ void ExtractAndUpdatePopulations() //Kaiden: Loading INI file to read Values... - //Tag for later - this is one of the reasons the + //Tag for later - this is one of the reasons the // Map Editor won't compile. And I feel stupid about it. // Pointing to a static location for the INI file. // Not only bad, the file is no longer there. @@ -1518,7 +1517,7 @@ CHAR16 EnemyTypeString[ POP_TABLE_ENEMY_TYPES ][ 10 ] = L"Stag", L"Rtrt", L" TOT", - L" %%", + L" %%", }; @@ -1612,14 +1611,14 @@ void PrintEnemyPopTable() for ( ubEnemyRank = 0; ubEnemyRank < ENEMY_RANK_PERCENT; ubEnemyRank++ ) { usEnemyPopTable[ ubEnemyRank ][ ENEMY_TYPE_PERCENT ] = ( ( 100 * usEnemyPopTable[ ubEnemyRank ][ ENEMY_TYPE_TOTAL ] ) / - usEnemyPopTable[ ENEMY_RANK_TOTAL ][ ENEMY_TYPE_TOTAL ] ); + usEnemyPopTable[ ENEMY_RANK_TOTAL ][ ENEMY_TYPE_TOTAL ] ); } // calculate type percentages for ( ubEnemyType = 0; ubEnemyType < ENEMY_TYPE_PERCENT; ubEnemyType++ ) { usEnemyPopTable[ ENEMY_RANK_PERCENT ][ ubEnemyType ] = ( ( 100 * usEnemyPopTable[ ENEMY_RANK_TOTAL ][ ubEnemyType ] ) / - usEnemyPopTable[ ENEMY_RANK_TOTAL ][ ENEMY_TYPE_TOTAL ] ); + usEnemyPopTable[ ENEMY_RANK_TOTAL ][ ENEMY_TYPE_TOTAL ] ); } } @@ -1658,7 +1657,7 @@ void PrintEnemyPopTable() { for ( ubEnemyType = 0; ubEnemyType < POP_TABLE_ENEMY_TYPES; ubEnemyType++ ) { - // an exclusive OR operator, how often do ya see that, huh? :-) + // an exclusive OR operator, how often do ya see that, huh? :-) if ( ( ubEnemyRank == ENEMY_RANK_PERCENT ) ^ ( ubEnemyType == ENEMY_TYPE_PERCENT ) ) { wcscpy( wPrintSpec, L"%3d%%%%" ); @@ -1695,7 +1694,7 @@ CHAR16 EnemiesKilledString[ KILLED_TABLE_ROWS ][ 10 ] = L"Tact", L"Auto", L" TOT", - L" %%", + L" %%", }; @@ -1751,14 +1750,14 @@ void PrintEnemiesKilledTable() for ( ubEnemyRank = 0; ubEnemyRank < ENEMY_RANK_PERCENT; ubEnemyRank++ ) { usEnemiesKilledTable[ ubEnemyRank ][ ENEMIES_KILLED_PERCENT ] = ( ( 100 * usEnemiesKilledTable[ ubEnemyRank ][ ENEMIES_KILLED_TOTAL ] ) / - usEnemiesKilledTable[ ENEMY_RANK_TOTAL ][ ENEMIES_KILLED_TOTAL ] ); + usEnemiesKilledTable[ ENEMY_RANK_TOTAL ][ ENEMIES_KILLED_TOTAL ] ); } // calculate kill type percentages for ( ubKillType = 0; ubKillType < ENEMIES_KILLED_PERCENT; ubKillType++ ) { usEnemiesKilledTable[ ENEMY_RANK_PERCENT ][ ubKillType ] = ( ( 100 * usEnemiesKilledTable[ ENEMY_RANK_TOTAL ][ ubKillType ] ) / - usEnemiesKilledTable[ ENEMY_RANK_TOTAL ][ ENEMIES_KILLED_TOTAL ] ); + usEnemiesKilledTable[ ENEMY_RANK_TOTAL ][ ENEMIES_KILLED_TOTAL ] ); } } @@ -1797,7 +1796,7 @@ void PrintEnemiesKilledTable() { for ( ubKillType = 0; ubKillType < KILLED_TABLE_ROWS; ubKillType++ ) { - // an exclusive OR operator, how often do ya see that, huh? :-) + // an exclusive OR operator, how often do ya see that, huh? :-) if ( ( ubEnemyRank == ENEMY_RANK_PERCENT ) ^ ( ubKillType == ENEMIES_KILLED_PERCENT ) ) { wcscpy( wPrintSpec, L"%3d%%%%" ); @@ -1887,12 +1886,12 @@ void PrintDetailedEnemiesInSectorInfo( INT32 iScreenX, INT32 iScreenY, UINT8 ubS pSector = &SectorInfo[ SECTOR( ubSectorX, ubSectorY ) ]; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ // handle garrisoned enemies if( pSector->ubGarrisonID != NO_GARRISON ) { - iDesired = gArmyComp[ gGarrisonGroup[ pSector->ubGarrisonID ].ubComposition ].bDesiredPopulation; + iDesired = gArmyComp[ gGarrisonGroup[ pSector->ubGarrisonID ].ubComposition ].bDesiredPopulation; iSurplus = pSector->ubNumTroops + pSector->ubNumAdmins + pSector->ubNumElites - iDesired; SetFontForeground( FONT_WHITE ); @@ -1905,7 +1904,7 @@ void PrintDetailedEnemiesInSectorInfo( INT32 iScreenX, INT32 iScreenY, UINT8 ubS } else { - swprintf( wSubString, L"%d reinforcements requested", -iSurplus ); + swprintf( wSubString, L"%d reinforcements requested", -iSurplus ); wcscat( wString, wSubString ); } mprintf( iScreenX, iScreenY, wString ); @@ -1920,7 +1919,7 @@ void PrintDetailedEnemiesInSectorInfo( INT32 iScreenX, INT32 iScreenY, UINT8 ubS pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX ); } else - { //ERROR! Should be a valid group... + { //ERROR! Should be a valid group... } } else @@ -2039,7 +2038,7 @@ void PrintDetailedEnemiesInSectorInfo( INT32 iScreenX, INT32 iScreenY, UINT8 ubS mprintf( iScreenX, iScreenY, wString ); iScreenY += 10; - + ubGroupCnt++; // no room on screen to display info for more than 3 groups in one sector! @@ -2055,4 +2054,4 @@ void PrintDetailedEnemiesInSectorInfo( INT32 iScreenX, INT32 iScreenY, UINT8 ubS } -#endif \ No newline at end of file +#endif diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index da27a269..f4342c8b 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -3,8 +3,6 @@ #include "GameSettings.h" #else #include "Assignments.h" - #include "Soldier Control.h" - #include "Item Types.h" #include "Strategic.h" #include "Items.h" #include "Overhead.h" @@ -64,6 +62,10 @@ #include "interface dialogue.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + #include "MilitiaSquads.h" // various reason an assignment can be aborted before completion @@ -94,28 +96,37 @@ enum{ }; +/* CHRISL: Adjusted enumerations to allow for seperation of the three different pocket types in the new +inventory system. */ enum { REPAIR_HANDS_AND_ARMOR = 0, REPAIR_HEADGEAR, - REPAIR_POCKETS, + REPAIR_BIG_POCKETS, + REPAIR_MED_POCKETS, + REPAIR_SML_POCKETS, NUM_REPAIR_PASS_TYPES, }; -#define FINAL_REPAIR_PASS REPAIR_POCKETS +#define FINAL_REPAIR_PASS REPAIR_SML_POCKETS +/* CHRISL: bSlot[xx] array declaration needs to reflect largest number of inventory locations. New inventory +system increses possible locations from 12 to 30. Also added a new field so we can set number of choices based +on game options. */ typedef struct REPAIR_PASS_SLOTS_TYPE { - UINT8 ubChoices; // how many valid choices there are in this pass - INT8 bSlot[ 12 ]; // list of slots to be repaired in this pass + UINT8 ubChoices[2]; // how many valid choices there are in this pass + INT8 bSlot[ 30 ]; // list of slots to be repaired in this pass } REPAIR_PASS_SLOTS_TYPE; - +/* CHRISL: Added new definitions introduced by the new inventory system.*/ REPAIR_PASS_SLOTS_TYPE gRepairPassSlotList[ NUM_REPAIR_PASS_TYPES ] = -{ // pass # choices slots repaired in this pass - { /* hands and armor */ 5, HANDPOS, SECONDHANDPOS, VESTPOS, HELMETPOS, LEGPOS, -1, -1, -1, -1, -1, -1, -1 }, - { /* headgear */ 2, HEAD1POS, HEAD2POS, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - { /* pockets */ 12, BIGPOCK1POS, BIGPOCK2POS, BIGPOCK3POS, BIGPOCK4POS, SMALLPOCK1POS, SMALLPOCK2POS, SMALLPOCK3POS, SMALLPOCK4POS, SMALLPOCK5POS, SMALLPOCK6POS, SMALLPOCK7POS, SMALLPOCK8POS }, +{ // pass # choices # new choices slots repaired in this pass + { /* hands and armor */ 5, 12, HANDPOS, SECONDHANDPOS, VESTPOS, HELMETPOS, LEGPOS, VESTPOCKPOS, LTHIGHPOCKPOS, RTHIGHPOCKPOS, CPACKPOCKPOS, BPACKPOCKPOS, GUNSLINGPOCKPOS, KNIFEPOCKPOS, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, + { /* headgear */ 2, 2, HEAD1POS, HEAD2POS, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, + { /* big pockets */ 4, 7, BIGPOCK1POS, BIGPOCK2POS, BIGPOCK3POS, BIGPOCK4POS, BIGPOCK5POS, BIGPOCK6POS, BIGPOCK7POS, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, + { /* med pockets */ 0, 4, MEDPOCK1POS, MEDPOCK2POS, MEDPOCK3POS, MEDPOCK4POS, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, + { /* sml pockets */ 8, 30, SMALLPOCK1POS, SMALLPOCK2POS, SMALLPOCK3POS, SMALLPOCK4POS, SMALLPOCK5POS, SMALLPOCK6POS, SMALLPOCK7POS, SMALLPOCK8POS, SMALLPOCK9POS, SMALLPOCK10POS, SMALLPOCK11POS, SMALLPOCK12POS, SMALLPOCK13POS, SMALLPOCK14POS, SMALLPOCK15POS, SMALLPOCK16POS, SMALLPOCK17POS, SMALLPOCK18POS, SMALLPOCK19POS, SMALLPOCK20POS, SMALLPOCK21POS, SMALLPOCK22POS, SMALLPOCK23POS, SMALLPOCK24POS, SMALLPOCK25POS, SMALLPOCK26POS, SMALLPOCK27POS, SMALLPOCK28POS, SMALLPOCK29POS, SMALLPOCK30POS }, }; extern STR16 sRepairsDoneString[]; @@ -138,19 +149,19 @@ INT16 gsAssignmentBoxesX, gsAssignmentBoxesY; // assignment menu mouse regions -MOUSE_REGION gAssignmentMenuRegion[ MAX_ASSIGN_STRING_COUNT ]; -MOUSE_REGION gTrainingMenuRegion[ MAX_TRAIN_STRING_COUNT ]; -MOUSE_REGION gAttributeMenuRegion[ MAX_ATTRIBUTE_STRING_COUNT ]; -MOUSE_REGION gSquadMenuRegion[ MAX_SQUAD_MENU_STRING_COUNT ]; -MOUSE_REGION gContractMenuRegion[ MAX_CONTRACT_MENU_STRING_COUNT ]; -MOUSE_REGION gRemoveMercAssignRegion[ MAX_REMOVE_MERC_COUNT ]; -MOUSE_REGION gEpcMenuRegion[ MAX_EPC_MENU_STRING_COUNT ]; -MOUSE_REGION gRepairMenuRegion[ 20 ]; +MOUSE_REGION gAssignmentMenuRegion[ MAX_ASSIGN_STRING_COUNT ]; +MOUSE_REGION gTrainingMenuRegion[ MAX_TRAIN_STRING_COUNT ]; +MOUSE_REGION gAttributeMenuRegion[ MAX_ATTRIBUTE_STRING_COUNT ]; +MOUSE_REGION gSquadMenuRegion[ MAX_SQUAD_MENU_STRING_COUNT ]; +MOUSE_REGION gContractMenuRegion[ MAX_CONTRACT_MENU_STRING_COUNT ]; +MOUSE_REGION gRemoveMercAssignRegion[ MAX_REMOVE_MERC_COUNT ]; +MOUSE_REGION gEpcMenuRegion[ MAX_EPC_MENU_STRING_COUNT ]; +MOUSE_REGION gRepairMenuRegion[ 20 ]; // mouse region for vehicle menu MOUSE_REGION gVehicleMenuRegion[ 20 ]; -MOUSE_REGION gAssignmentScreenMaskRegion; +MOUSE_REGION gAssignmentScreenMaskRegion; BOOLEAN fShownAssignmentMenu = FALSE; BOOLEAN fShowVehicleMenu = FALSE; @@ -232,7 +243,7 @@ BOOLEAN gfReEvaluateEveryonesNothingToDo = FALSE; // militia training bonus for EACH level of teaching skill (percentage points) #define TEACH_BONUS_TO_TRAIN 30 // militia training bonus for RPC (percentage points) -#define RPC_BONUS_TO_TRAIN 10 +#define RPC_BONUS_TO_TRAIN 10 // the bonus to training in marksmanship in the Alma gun range sector #define GUN_RANGE_TRAINING_BONUS 25 @@ -240,12 +251,12 @@ BOOLEAN gfReEvaluateEveryonesNothingToDo = FALSE; // breath bonus divider #define BREATH_BONUS_DIVIDER 10 -// the min rating that is need to teach a fellow teammate -#define MIN_RATING_TO_TEACH 25 +// the min rating that is need to teach a fellow teammate +#define MIN_RATING_TO_TEACH 25 // activity levels for natural healing ( the higher the number, the slower the natural recover rate -#define LOW_ACTIVITY_LEVEL 1 -#define MEDIUM_ACTIVITY_LEVEL 4 +#define LOW_ACTIVITY_LEVEL 1 +#define MEDIUM_ACTIVITY_LEVEL 4 #define HIGH_ACTIVITY_LEVEL 12 */ /* @@ -256,7 +267,7 @@ BOOLEAN gfReEvaluateEveryonesNothingToDo = FALSE; #define AVG_NUMBER_OF_HOURS_OF_SLEEP_NEEDED 7 */ -/* Assignment distance limits removed. Sep/11/98. ARM +/* Assignment distance limits removed. Sep/11/98. ARM #define MAX_DISTANCE_FOR_DOCTORING 5 #define MAX_DISTANCE_FOR_REPAIR 5 #define MAX_DISTANCE_FOR_TRAINING 5 @@ -285,7 +296,7 @@ void HandleDoctorsInSector( INT16 sX, INT16 sY, INT8 bZ ); void HandleRepairmenInSector( INT16 sX, INT16 sY, INT8 bZ ); // heal characters in this sector with this doctor -void HealCharacters( SOLDIERTYPE *pDoctor, INT16 sX, INT16 sY, INT8 bZ ); +void HealCharacters( SOLDIERTYPE *pDoctor, INT16 sX, INT16 sY, INT8 bZ ); // update characters who might done healing but are still patients void UpdatePatientsWhoAreDoneHealing( void ); @@ -297,10 +308,16 @@ UINT8 GetMinHealingSkillNeeded( SOLDIERTYPE *pPatient ); UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHundredthsHealed ); // can item be repaired? -BOOLEAN IsItemRepairable( UINT16 usItem, INT8 bStatus ); +BOOLEAN IsItemRepairable( UINT16 usItem, INT16 bStatus ); // does another merc have a repairable item on them? -INT8 FindRepairableItemOnOtherSoldier( SOLDIERTYPE * pSoldier, UINT8 ubPassType ); +OBJECTTYPE* FindRepairableItemOnOtherSoldier( SOLDIERTYPE * pSoldier, UINT8 ubPassType ); + +//CHRISL: This function will handle the actual searching for repairable items +OBJECTTYPE* FindRepairableItemInSpecificPocket( OBJECTTYPE * pObj, UINT8 subObject); + +//CHRISL: This function will search through LBENODE items for repairable items +OBJECTTYPE* FindRepairableItemInLBENODE( OBJECTTYPE * pObj, UINT8 subObject); // repair stuff void HandleRepairBySoldier( SOLDIERTYPE *pSoldier ); @@ -450,14 +467,14 @@ BOOLEAN RepairObject( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOwner, OBJECTTYPE * void RepairItemsOnOthers( SOLDIERTYPE *pSoldier, UINT8 *pubRepairPtsLeft ); BOOLEAN UnjamGunsOnSoldier( SOLDIERTYPE *pOwnerSoldier, SOLDIERTYPE *pRepairSoldier, UINT8 *pubRepairPtsLeft ); -/* No point in allowing SAM site repair any more. Jan/13/99. ARM +/* No point in allowing SAM site repair any more. Jan/13/99. ARM BOOLEAN IsTheSAMSiteInSectorRepairable( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ); BOOLEAN SoldierInSameSectorAsSAM( SOLDIERTYPE *pSoldier ); BOOLEAN CanSoldierRepairSAM( SOLDIERTYPE *pSoldier, INT8 bRepairPoints ); BOOLEAN IsSoldierCloseEnoughToSAMControlPanel( SOLDIERTYPE *pSoldier ); */ -/* Assignment distance limits removed. Sep/11/98. ARM +/* Assignment distance limits removed. Sep/11/98. ARM BOOLEAN IsSoldierCloseEnoughToADoctor( SOLDIERTYPE *pPatient ); */ @@ -480,31 +497,31 @@ void InitSectorsWithSoldiersList( void ) void BuildSectorsWithSoldiersList( void ) { SOLDIERTYPE *pSoldier, *pTeamSoldier; - INT32 cnt=0; + INT32 cnt=0; pSoldier = MercPtrs[ 0 ]; // fills array with pressence of player controlled characters - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier -> bTeam ].bLastID; cnt++,pTeamSoldier++) + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) { - if(pTeamSoldier -> bActive) + if(pTeamSoldier->bActive) { - fSectorsWithSoldiers[ pTeamSoldier -> sSectorX + pTeamSoldier -> sSectorY * MAP_WORLD_X ][ pTeamSoldier -> bSectorZ ] = TRUE; + fSectorsWithSoldiers[ pTeamSoldier->sSectorX + pTeamSoldier->sSectorY * MAP_WORLD_X ][ pTeamSoldier->bSectorZ ] = TRUE; } } } void ChangeSoldiersAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment ) { - // This is the most basic assignment-setting function. It must be called before setting any subsidiary - // values like fFixingRobot. It will clear all subsidiary values so we don't leave the merc in a messed + // This is the most basic assignment-setting function. It must be called before setting any subsidiary + // values like fFixingRobot. It will clear all subsidiary values so we don't leave the merc in a messed // up state! pSoldier->bAssignment = bAssignment; /// don't kill iVehicleId, though, 'cause militia training tries to put guys back in their vehicles when it's done(!) - pSoldier->fFixingSAMSite = FALSE; - pSoldier->fFixingRobot = FALSE; + pSoldier->flags.fFixingSAMSite = FALSE; + pSoldier->flags.fFixingRobot = FALSE; pSoldier->bVehicleUnderRepairID = -1; if ( ( bAssignment == DOCTOR ) || ( bAssignment == PATIENT ) || ( bAssignment == ASSIGNMENT_HOSPITAL ) ) @@ -527,7 +544,7 @@ BOOLEAN BasicCanCharacterAssignment( SOLDIERTYPE * pSoldier, BOOLEAN fNotInComba if ( SectorIsImpassable( (INT16) SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ) ) { return( FALSE ); - } + } if ( fNotInCombat && pSoldier->bActive && pSoldier->bInSector && gTacticalStatus.fEnemyInSector ) { @@ -557,13 +574,13 @@ BOOLEAN CanSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment ) return( CanCharacterTrainMilitia( pSoldier ) ); break; case( TRAIN_SELF ): - return( CanCharacterTrainStat( pSoldier, pSoldier -> bTrainStat, TRUE, FALSE ) ); + return( CanCharacterTrainStat( pSoldier, pSoldier->bTrainStat, TRUE, FALSE ) ); break; case( TRAIN_TEAMMATE ): - return( CanCharacterTrainStat( pSoldier, pSoldier -> bTrainStat, FALSE, TRUE ) ); + return( CanCharacterTrainStat( pSoldier, pSoldier->bTrainStat, FALSE, TRUE ) ); break; case TRAIN_BY_OTHER: - return( CanCharacterTrainStat( pSoldier, pSoldier -> bTrainStat, TRUE, FALSE ) ); + return( CanCharacterTrainStat( pSoldier, pSoldier->bTrainStat, TRUE, FALSE ) ); break; case( VEHICLE ): return( CanCharacterVehicle( pSoldier ) ); @@ -582,17 +599,17 @@ BOOLEAN CanCharacterDoctorButDoesntHaveMedKit( SOLDIERTYPE *pSoldier ) if ( !BasicCanCharacterAssignment( pSoldier, TRUE ) ) { return( FALSE ); - } + } // make sure character is alive and conscious - if( pSoldier -> bLife < OKLIFE ) + if( pSoldier->stats.bLife < OKLIFE ) { // dead or unconscious... return ( FALSE ); } // has medical skill? - if( pSoldier -> bMedical <= 0 ) + if( pSoldier->stats.bMedical <= 0 ) { // no skill whatsoever return ( FALSE ); @@ -610,19 +627,19 @@ BOOLEAN CanCharacterDoctorButDoesntHaveMedKit( SOLDIERTYPE *pSoldier ) return( FALSE ); } - if( pSoldier -> ubWhatKindOfMercAmI == MERC_TYPE__EPC ) + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC ) { // epcs can't do this return( FALSE ); } // check in helicopter in hostile sector - if( pSoldier -> bAssignment == VEHICLE ) + if( pSoldier->bAssignment == VEHICLE ) { - if( ( iHelicopterVehicleId != -1 ) && ( pSoldier -> iVehicleId == iHelicopterVehicleId ) ) + if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) ) { // enemies in sector - if( NumEnemiesInSector( pSoldier -> sSectorX, pSoldier -> sSectorY ) > 0 ) + if( NumEnemiesInSector( pSoldier->sSectorX, pSoldier->sSectorY ) > 0 ) { return( FALSE ); } @@ -650,7 +667,8 @@ BOOLEAN CanCharacterDoctor( SOLDIERTYPE *pSoldier ) } // find med kit - for (bPocket = HANDPOS; bPocket <= SMALLPOCK8POS; bPocket++) + // CHRISL: Changed to dynamically determine max inventory locations. + for (bPocket = HANDPOS; bPocket < NUM_INV_SLOTS; bPocket++) { // doctoring is allowed using either type of med kit (but first aid kit halves doctoring effectiveness) if( IsMedicalKitItem( &( pSoldier -> inv[ bPocket ] ) ) ) @@ -728,9 +746,9 @@ BOOLEAN HasCharacterFinishedRepairing( SOLDIERTYPE * pSoldier ) if ( pSoldier->bVehicleUnderRepairID != -1 ) { fCanStillRepair = CanCharacterRepairVehicle( pSoldier, pSoldier->bVehicleUnderRepairID ); - } + } // check if we are repairing a robot - else if( pSoldier -> fFixingRobot ) + else if( pSoldier->flags.fFixingRobot ) { fCanStillRepair = CanCharacterRepairRobot( pSoldier ); } @@ -756,15 +774,16 @@ BOOLEAN DoesCharacterHaveAnyItemsToRepair( SOLDIERTYPE *pSoldier, INT8 bHighestP // check for jams - for (bPocket = HELMETPOS; bPocket <= SMALLPOCK8POS; bPocket++) + // CHRISL: Changed to dynamically determine max inventory locations. + for (bPocket = HELMETPOS; bPocket < NUM_INV_SLOTS; bPocket++) { - ubItemsInPocket = pSoldier -> inv[ bPocket ].ubNumberOfObjects; + ubItemsInPocket = pSoldier->inv[ bPocket ].ubNumberOfObjects; // unjam any jammed weapons // run through pocket and repair for( ubObjectInPocketCounter = 0; ubObjectInPocketCounter < ubItemsInPocket; ubObjectInPocketCounter++ ) { // jammed gun? - if ( ( Item[ pSoldier -> inv[ bPocket ].usItem ].usItemClass == IC_GUN ) && ( pSoldier -> inv[ bPocket ].ItemData.Gun.bGunAmmoStatus < 0 ) ) + if ( ( Item[ pSoldier->inv[ bPocket ].usItem ].usItemClass == IC_GUN ) && ( pSoldier->inv[ bPocket ][0]->data.gun.bGunAmmoStatus < 0 ) ) { return( TRUE ); } @@ -772,37 +791,29 @@ BOOLEAN DoesCharacterHaveAnyItemsToRepair( SOLDIERTYPE *pSoldier, INT8 bHighestP } // now check for items to repair - for( bPocket = HELMETPOS; bPocket <= SMALLPOCK8POS; bPocket++ ) + // CHRISL: Changed to dynamically determine max inventory locations. + for( bPocket = HELMETPOS; bPocket < NUM_INV_SLOTS; bPocket++ ) { - pObj = &(pSoldier->inv[ bPocket ]); - - ubItemsInPocket = pObj->ubNumberOfObjects; - // run through pocket - for( ubObjectInPocketCounter = 0; ubObjectInPocketCounter < ubItemsInPocket; ubObjectInPocketCounter++ ) + for( ubObjectInPocketCounter = 0; ubObjectInPocketCounter < pSoldier->inv[ bPocket ].ubNumberOfObjects; ubObjectInPocketCounter++ ) { + pObj = FindRepairableItemInSpecificPocket(&(pSoldier->inv[ bPocket ]), ubObjectInPocketCounter); // if it's repairable and NEEDS repairing - if ( IsItemRepairable( pObj->usItem, pObj->ItemData.Generic.bStatus[ubObjectInPocketCounter] ) ) + if(pObj != 0) { return( TRUE ); - } - } - - // have to check for attachments... - for ( bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++ ) - { - if ( pObj->usAttachItem[ bLoop ] != NOTHING ) + } + if(UsingNewInventorySystem() == true && Item[pSoldier->inv[ bPocket ].usItem].usItemClass == IC_LBEGEAR) { - // if it's repairable and NEEDS repairing - if ( IsItemRepairable( pObj->usAttachItem[ bLoop ], pObj->bAttachStatus[ bLoop ] ) ) + pObj = FindRepairableItemInLBENODE( &pSoldier->inv[ bPocket ], ubObjectInPocketCounter); + if(pObj != 0) { return( TRUE ); - } + } } } } - // if we wanna check for the items belonging to others in the sector if ( bHighestPass != - 1 ) { @@ -813,23 +824,20 @@ BOOLEAN DoesCharacterHaveAnyItemsToRepair( SOLDIERTYPE *pSoldier, INT8 bHighestP if ( CanCharacterRepairAnotherSoldiersStuff( pSoldier, pOtherSoldier ) ) { - // okay, seems like a candidate! Check if he has anything that needs unjamming or repairs - - for ( bPocket = HANDPOS; bPocket <= SMALLPOCK8POS; bPocket++ ) + // okay, seems like a candidate! Check if he has anything that needs unjamming or repairs + // CHRISL: Changed to dynamically determine max inventory locations. + for ( bPocket = HANDPOS; bPocket < NUM_INV_SLOTS; bPocket++ ) { // the object a weapon? and jammed? - if ( ( Item[ pOtherSoldier->inv[ bPocket ].usItem ].usItemClass == IC_GUN ) && ( pOtherSoldier->inv[ bPocket ].ItemData.Gun.bGunAmmoStatus < 0 ) ) + if ( ( Item[ pOtherSoldier->inv[ bPocket ].usItem ].usItemClass == IC_GUN ) && ( pOtherSoldier->inv[ bPocket ][0]->data.gun.bGunAmmoStatus < 0 ) ) { return( TRUE ); } } - // repair everyone's hands and armor slots first, then headgear, and pockets last for ( ubPassType = REPAIR_HANDS_AND_ARMOR; ubPassType <= ( UINT8 ) bHighestPass; ubPassType++ ) { - bPocket = FindRepairableItemOnOtherSoldier( pOtherSoldier, ubPassType ); - if ( bPocket != NO_SLOT ) - { + if (FindRepairableItemOnOtherSoldier( pOtherSoldier, ubPassType )) { return( TRUE ); } } @@ -850,14 +858,14 @@ BOOLEAN BasicCanCharacterRepair( SOLDIERTYPE * pSoldier ) } // make sure character is alive and oklife - if( pSoldier -> bLife < OKLIFE ) + if( pSoldier->stats.bLife < OKLIFE ) { // dead or unconscious... return ( FALSE ); } // has repair skill? - if( pSoldier -> bMechanical <= 0 ) + if( pSoldier->stats.bMechanical <= 0 ) { // no skill whatsoever return ( FALSE ); @@ -875,19 +883,19 @@ BOOLEAN BasicCanCharacterRepair( SOLDIERTYPE * pSoldier ) return( FALSE ); } - if( pSoldier -> ubWhatKindOfMercAmI == MERC_TYPE__EPC ) + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC ) { // epcs can't do this return( FALSE ); } // check in helicopter in hostile sector - if( pSoldier -> bAssignment == VEHICLE ) + if( pSoldier->bAssignment == VEHICLE ) { - if( ( iHelicopterVehicleId != -1 ) && ( pSoldier -> iVehicleId == iHelicopterVehicleId ) ) + if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) ) { // enemies in sector - if( NumEnemiesInSector( pSoldier -> sSectorX, pSoldier -> sSectorY ) > 0 ) + if( NumEnemiesInSector( pSoldier->sSectorX, pSoldier->sSectorY ) > 0 ) { return( FALSE ); } @@ -917,8 +925,6 @@ BOOLEAN CanCharacterRepairButDoesntHaveARepairkit( SOLDIERTYPE *pSoldier ) // check that character is alive, oklife, has repair skill, and equipment, etc. BOOLEAN CanCharacterRepair( SOLDIERTYPE *pSoldier ) { - //INT8 bPocket = 0; - //BOOLEAN fToolKitFound = FALSE; if ( !BasicCanCharacterAssignment( pSoldier, TRUE ) ) { @@ -929,7 +935,7 @@ BOOLEAN CanCharacterRepair( SOLDIERTYPE *pSoldier ) { return( FALSE ); } - + // make sure he has a toolkit if ( FindToolkit( pSoldier ) == NO_SLOT ) { @@ -959,18 +965,18 @@ BOOLEAN CanCharacterPatient( SOLDIERTYPE *pSoldier ) } // Robot must be REPAIRED to be "healed", not doctored - if( ( pSoldier -> uiStatusFlags & SOLDIER_VEHICLE ) || AM_A_ROBOT( pSoldier ) ) + if( ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) || AM_A_ROBOT( pSoldier ) ) { return ( FALSE ); } - if( pSoldier -> bAssignment == ASSIGNMENT_POW ) + if( pSoldier->bAssignment == ASSIGNMENT_POW ) { return ( FALSE ); } // is character alive and not in perfect health? - if( ( pSoldier -> bLife <= 0 ) || ( pSoldier -> bLife == pSoldier -> bLifeMax ) ) + if( ( pSoldier->stats.bLife <= 0 ) || ( pSoldier->stats.bLife == pSoldier->stats.bLifeMax ) ) { // dead or in perfect health return ( FALSE ); @@ -989,12 +995,12 @@ BOOLEAN CanCharacterPatient( SOLDIERTYPE *pSoldier ) } // check in helicopter in hostile sector - if( pSoldier -> bAssignment == VEHICLE ) + if( pSoldier->bAssignment == VEHICLE ) { - if( ( iHelicopterVehicleId != -1 ) && ( pSoldier -> iVehicleId == iHelicopterVehicleId ) ) + if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) ) { // enemies in sector - if( NumEnemiesInSector( pSoldier -> sSectorX, pSoldier -> sSectorY ) > 0 ) + if( NumEnemiesInSector( pSoldier->sSectorX, pSoldier->sSectorY ) > 0 ) { return( FALSE ); } @@ -1019,22 +1025,22 @@ BOOLEAN BasicCanCharacterTrainMilitia( SOLDIERTYPE *pSoldier ) } // make sure character is alive and conscious - if( pSoldier -> bLife < OKLIFE ) + if( pSoldier->stats.bLife < OKLIFE ) { // dead or unconscious... return ( FALSE ); } // underground training is not allowed (code doesn't support and it's a reasonable enough limitation) - if( pSoldier -> bSectorZ != 0 ) + if( pSoldier->bSectorZ != 0 ) { - return( FALSE ); + return( FALSE ); } // is there a town in the character's current sector? if( StrategicMap[ CALCULATE_STRATEGIC_INDEX( pSoldier->sSectorX, pSoldier->sSectorY ) ].bNameId == BLANK_SECTOR ) { - fSamSitePresent = IsThisSectorASAMSector( pSoldier -> sSectorX, pSoldier -> sSectorY, pSoldier -> bSectorZ ); + fSamSitePresent = IsThisSectorASAMSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ); // check if sam site if( fSamSitePresent == FALSE ) @@ -1051,12 +1057,12 @@ BOOLEAN BasicCanCharacterTrainMilitia( SOLDIERTYPE *pSoldier ) // check in helicopter in hostile sector - if( pSoldier -> bAssignment == VEHICLE ) + if( pSoldier->bAssignment == VEHICLE ) { - if( ( iHelicopterVehicleId != -1 ) && ( pSoldier -> iVehicleId == iHelicopterVehicleId ) ) + if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) ) { // enemies in sector - if( NumEnemiesInSector( pSoldier -> sSectorX, pSoldier -> sSectorY ) > 0 ) + if( NumEnemiesInSector( pSoldier->sSectorX, pSoldier->sSectorY ) > 0 ) { return( FALSE ); } @@ -1075,19 +1081,19 @@ BOOLEAN BasicCanCharacterTrainMilitia( SOLDIERTYPE *pSoldier ) return( FALSE ); } - if( pSoldier -> ubWhatKindOfMercAmI == MERC_TYPE__EPC ) + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC ) { // epcs can't do this return( FALSE ); } - if ( ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) || AM_A_ROBOT( pSoldier ) ) + if ( ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) || AM_A_ROBOT( pSoldier ) ) { return( FALSE ); } // has leadership skill? - if( pSoldier -> bLeadership <= 0 ) + if( pSoldier->stats.bLeadership <= 0 ) { // no skill whatsoever return ( FALSE ); @@ -1099,14 +1105,14 @@ BOOLEAN BasicCanCharacterTrainMilitia( SOLDIERTYPE *pSoldier ) } // Kaiden: Roaming Militia Training: -// Commenting out the check for: +// Commenting out the check for: // IsMilitiaTrainableFromSoldiersSectorMaxed( // At this point, we don't care if it's full yet BOOLEAN CanCharacterTrainMilitia( SOLDIERTYPE *pSoldier ) { - if (gGameExternalOptions.gfmusttrainroaming + if (gGameExternalOptions.gfmusttrainroaming && (GetWorldDay( ) >= gGameExternalOptions.guiAllowMilitiaGroupsDelay) && (!IsThisSectorASAMSector(pSoldier->sSectorX,pSoldier->sSectorY,0 ))) { @@ -1165,9 +1171,9 @@ BOOLEAN DoesSectorMercIsInHaveSufficientLoyaltyToTrainMilitia( SOLDIERTYPE *pSol // underground training is not allowed (code doesn't support and it's a reasonable enough limitation) - if( pSoldier -> bSectorZ != 0 ) + if( pSoldier->bSectorZ != 0 ) { - return( FALSE ); + return( FALSE ); } bTownId = GetTownIdForSector( pSoldier->sSectorX, pSoldier->sSectorY ); @@ -1175,7 +1181,7 @@ BOOLEAN DoesSectorMercIsInHaveSufficientLoyaltyToTrainMilitia( SOLDIERTYPE *pSol // is there a town really here if( bTownId == BLANK_SECTOR ) { - fSamSitePresent = IsThisSectorASAMSector( pSoldier -> sSectorX, pSoldier -> sSectorY, pSoldier -> bSectorZ ); + fSamSitePresent = IsThisSectorASAMSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ); // if there is a sam site here if( fSamSitePresent ) @@ -1191,7 +1197,7 @@ BOOLEAN DoesSectorMercIsInHaveSufficientLoyaltyToTrainMilitia( SOLDIERTYPE *pSol { return( FALSE ); } - + return( TRUE ); } @@ -1206,7 +1212,7 @@ INT8 CountMilitiaTrainersInSoldiersSector( SOLDIERTYPE * pSoldier ) for ( bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; bLoop++ ) { pOtherSoldier = MercPtrs[ bLoop ]; - if ( pSoldier != pOtherSoldier && pOtherSoldier->bActive && pOtherSoldier->bLife >= OKLIFE && pOtherSoldier->sSectorX == pSoldier->sSectorX && pOtherSoldier->sSectorY == pSoldier->sSectorY && pSoldier->bSectorZ == pOtherSoldier->bSectorZ ) + if ( pSoldier != pOtherSoldier && pOtherSoldier->bActive && pOtherSoldier->stats.bLife >= OKLIFE && pOtherSoldier->sSectorX == pSoldier->sSectorX && pOtherSoldier->sSectorY == pSoldier->sSectorY && pSoldier->bSectorZ == pOtherSoldier->bSectorZ ) { if (pOtherSoldier->bAssignment == TRAIN_TOWN ) { @@ -1235,7 +1241,7 @@ BOOLEAN IsMilitiaTrainableFromSoldiersSectorMaxed( SOLDIERTYPE *pSoldier, INT8 i // is there a town really here if( bTownId == BLANK_SECTOR ) { - fSamSitePresent = IsThisSectorASAMSector( pSoldier -> sSectorX, pSoldier -> sSectorY, pSoldier -> bSectorZ ); + fSamSitePresent = IsThisSectorASAMSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ); // if there is a sam site here if( fSamSitePresent ) @@ -1262,39 +1268,39 @@ BOOLEAN IsMilitiaTrainableFromSoldiersSectorMaxed( SOLDIERTYPE *pSoldier, INT8 i BOOLEAN CanCharacterTrainStat( SOLDIERTYPE *pSoldier, INT8 bStat, BOOLEAN fTrainSelf, BOOLEAN fTrainTeammate ) { // is the character capable of training this stat? either self or as trainer - + if ( !BasicCanCharacterAssignment( pSoldier, TRUE ) ) { return( FALSE ); } // alive and conscious - if( pSoldier -> bLife < OKLIFE ) + if( pSoldier->stats.bLife < OKLIFE ) { // dead or unconscious... return ( FALSE ); } // underground training is not allowed (code doesn't support and it's a reasonable enough limitation) - if( pSoldier -> bSectorZ != 0 ) + if( pSoldier->bSectorZ != 0 ) { - return( FALSE ); + return( FALSE ); } // check in helicopter in hostile sector - if( pSoldier -> bAssignment == VEHICLE ) + if( pSoldier->bAssignment == VEHICLE ) { - if( ( iHelicopterVehicleId != -1 ) && ( pSoldier -> iVehicleId == iHelicopterVehicleId ) ) + if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) ) { // enemies in sector - if( NumEnemiesInSector( pSoldier -> sSectorX, pSoldier -> sSectorY ) > 0 ) + if( NumEnemiesInSector( pSoldier->sSectorX, pSoldier->sSectorY ) > 0 ) { return( FALSE ); } } } - if( pSoldier -> ubWhatKindOfMercAmI == MERC_TYPE__EPC ) + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC ) { // epcs can't do this return( FALSE ); @@ -1305,39 +1311,39 @@ BOOLEAN CanCharacterTrainStat( SOLDIERTYPE *pSoldier, INT8 bStat, BOOLEAN fTrain { case ( STRENGTH ): // strength - if ( pSoldier->bStrength < gGameExternalOptions.ubTrainingSkillMin ) + if ( pSoldier->stats.bStrength < gGameExternalOptions.ubTrainingSkillMin ) return FALSE; - else if( ( ( pSoldier -> bStrength < gGameExternalOptions.ubMinSkillToTeach ) && ( fTrainTeammate ) ) ) + else if( ( ( pSoldier->stats.bStrength < gGameExternalOptions.ubMinSkillToTeach ) && ( fTrainTeammate ) ) ) { return ( FALSE ); } - else if( ( pSoldier -> bStrength >= gGameExternalOptions.ubTrainingSkillMax ) && ( fTrainSelf ) ) + else if( ( pSoldier->stats.bStrength >= gGameExternalOptions.ubTrainingSkillMax ) && ( fTrainSelf ) ) { return ( FALSE ); } break; case( DEXTERITY ): // dexterity - if ( pSoldier->bDexterity < gGameExternalOptions.ubTrainingSkillMin ) + if ( pSoldier->stats.bDexterity < gGameExternalOptions.ubTrainingSkillMin ) return FALSE; - else if( ( ( pSoldier -> bDexterity < gGameExternalOptions.ubMinSkillToTeach ) && ( fTrainTeammate ) ) ) + else if( ( ( pSoldier->stats.bDexterity < gGameExternalOptions.ubMinSkillToTeach ) && ( fTrainTeammate ) ) ) { return ( FALSE ); } - else if( ( pSoldier -> bDexterity >= gGameExternalOptions.ubTrainingSkillMax )&&( fTrainSelf ) ) + else if( ( pSoldier->stats.bDexterity >= gGameExternalOptions.ubTrainingSkillMax )&&( fTrainSelf ) ) { return ( FALSE ); } break; case( AGILITY ): // agility - if ( pSoldier->bAgility < gGameExternalOptions.ubTrainingSkillMin ) + if ( pSoldier->stats.bAgility < gGameExternalOptions.ubTrainingSkillMin ) return FALSE; - else if( ( ( pSoldier -> bAgility < gGameExternalOptions.ubMinSkillToTeach ) && ( fTrainTeammate ) ) ) + else if( ( ( pSoldier->stats.bAgility < gGameExternalOptions.ubMinSkillToTeach ) && ( fTrainTeammate ) ) ) { return ( FALSE ); } - else if( ( pSoldier -> bAgility >= gGameExternalOptions.ubTrainingSkillMax )&&( fTrainSelf ) ) + else if( ( pSoldier->stats.bAgility >= gGameExternalOptions.ubTrainingSkillMax )&&( fTrainSelf ) ) { return ( FALSE ); } @@ -1345,13 +1351,13 @@ BOOLEAN CanCharacterTrainStat( SOLDIERTYPE *pSoldier, INT8 bStat, BOOLEAN fTrain break; case( HEALTH ): // health - if ( pSoldier->bLifeMax < gGameExternalOptions.ubTrainingSkillMin ) + if ( pSoldier->stats.bLifeMax < gGameExternalOptions.ubTrainingSkillMin ) return FALSE; - else if( ( ( pSoldier -> bLifeMax < gGameExternalOptions.ubMinSkillToTeach ) && ( fTrainTeammate ) ) ) + else if( ( ( pSoldier->stats.bLifeMax < gGameExternalOptions.ubMinSkillToTeach ) && ( fTrainTeammate ) ) ) { return ( FALSE ); } - else if( ( pSoldier -> bLifeMax >= gGameExternalOptions.ubTrainingSkillMax )&&( fTrainSelf ) ) + else if( ( pSoldier->stats.bLifeMax >= gGameExternalOptions.ubTrainingSkillMax )&&( fTrainSelf ) ) { return ( FALSE ); } @@ -1359,13 +1365,13 @@ BOOLEAN CanCharacterTrainStat( SOLDIERTYPE *pSoldier, INT8 bStat, BOOLEAN fTrain break; case( MARKSMANSHIP ): // marksmanship - if ( pSoldier->bMarksmanship < gGameExternalOptions.ubTrainingSkillMin ) + if ( pSoldier->stats.bMarksmanship < gGameExternalOptions.ubTrainingSkillMin ) return FALSE; - else if( ( ( pSoldier -> bMarksmanship < gGameExternalOptions.ubMinSkillToTeach ) && ( fTrainTeammate ) ) ) + else if( ( ( pSoldier->stats.bMarksmanship < gGameExternalOptions.ubMinSkillToTeach ) && ( fTrainTeammate ) ) ) { return ( FALSE ); } - else if( ( pSoldier -> bMarksmanship >= gGameExternalOptions.ubTrainingSkillMax )&&( fTrainSelf ) ) + else if( ( pSoldier->stats.bMarksmanship >= gGameExternalOptions.ubTrainingSkillMax )&&( fTrainSelf ) ) { return ( FALSE ); } @@ -1373,13 +1379,13 @@ BOOLEAN CanCharacterTrainStat( SOLDIERTYPE *pSoldier, INT8 bStat, BOOLEAN fTrain break; case( MEDICAL ): // medical - if ( pSoldier->bMedical < gGameExternalOptions.ubTrainingSkillMin ) + if ( pSoldier->stats.bMedical < gGameExternalOptions.ubTrainingSkillMin ) return FALSE; - else if( ( ( pSoldier -> bMedical < gGameExternalOptions.ubMinSkillToTeach ) && ( fTrainTeammate ) ) ) + else if( ( ( pSoldier->stats.bMedical < gGameExternalOptions.ubMinSkillToTeach ) && ( fTrainTeammate ) ) ) { return ( FALSE ); } - else if( ( pSoldier -> bMedical >= gGameExternalOptions.ubTrainingSkillMax )&&( fTrainSelf ) ) + else if( ( pSoldier->stats.bMedical >= gGameExternalOptions.ubTrainingSkillMax )&&( fTrainSelf ) ) { return ( FALSE ); } @@ -1387,39 +1393,39 @@ BOOLEAN CanCharacterTrainStat( SOLDIERTYPE *pSoldier, INT8 bStat, BOOLEAN fTrain break; case( MECHANICAL ): // mechanical - if ( pSoldier->bMechanical < gGameExternalOptions.ubTrainingSkillMin ) + if ( pSoldier->stats.bMechanical < gGameExternalOptions.ubTrainingSkillMin ) return FALSE; - else if( ( ( pSoldier -> bMechanical < gGameExternalOptions.ubMinSkillToTeach ) && ( fTrainTeammate ) ) ) + else if( ( ( pSoldier->stats.bMechanical < gGameExternalOptions.ubMinSkillToTeach ) && ( fTrainTeammate ) ) ) { return ( FALSE ); } - else if( ( pSoldier -> bMechanical >= gGameExternalOptions.ubTrainingSkillMax )&&( fTrainSelf ) ) + else if( ( pSoldier->stats.bMechanical >= gGameExternalOptions.ubTrainingSkillMax )&&( fTrainSelf ) ) { return ( FALSE ); } break; case( LEADERSHIP ): // leadership - if ( pSoldier->bLeadership < gGameExternalOptions.ubTrainingSkillMin ) + if ( pSoldier->stats.bLeadership < gGameExternalOptions.ubTrainingSkillMin ) return FALSE; - else if( ( ( pSoldier -> bLeadership < gGameExternalOptions.ubMinSkillToTeach ) && ( fTrainTeammate ) ) ) + else if( ( ( pSoldier->stats.bLeadership < gGameExternalOptions.ubMinSkillToTeach ) && ( fTrainTeammate ) ) ) { return ( FALSE ); } - else if( ( pSoldier -> bLeadership >= gGameExternalOptions.ubTrainingSkillMax )&&( fTrainSelf ) ) + else if( ( pSoldier->stats.bLeadership >= gGameExternalOptions.ubTrainingSkillMax )&&( fTrainSelf ) ) { return ( FALSE ); } break; case( EXPLOSIVE_ASSIGN ): // explosives - if ( pSoldier->bExplosive < gGameExternalOptions.ubTrainingSkillMin ) + if ( pSoldier->stats.bExplosive < gGameExternalOptions.ubTrainingSkillMin ) return FALSE; - else if( ( ( pSoldier -> bExplosive < gGameExternalOptions.ubMinSkillToTeach ) && ( fTrainTeammate ) ) ) + else if( ( ( pSoldier->stats.bExplosive < gGameExternalOptions.ubMinSkillToTeach ) && ( fTrainTeammate ) ) ) { return ( FALSE ); } - else if( ( pSoldier -> bExplosive >= gGameExternalOptions.ubTrainingSkillMax )&&( fTrainSelf ) ) + else if( ( pSoldier->stats.bExplosive >= gGameExternalOptions.ubTrainingSkillMax )&&( fTrainSelf ) ) { return ( FALSE ); } @@ -1449,7 +1455,7 @@ BOOLEAN CanCharacterOnDuty( SOLDIERTYPE *pSoldier ) // only need to be alive and well to do so right now // alive and conscious - if( pSoldier -> bLife < OKLIFE ) + if( pSoldier->stats.bLife < OKLIFE ) { // dead or unconscious... return ( FALSE ); @@ -1461,12 +1467,12 @@ BOOLEAN CanCharacterOnDuty( SOLDIERTYPE *pSoldier ) } // check in helicopter in hostile sector - if( pSoldier -> bAssignment == VEHICLE ) + if( pSoldier->bAssignment == VEHICLE ) { - if( ( iHelicopterVehicleId != -1 ) && ( pSoldier -> iVehicleId == iHelicopterVehicleId ) ) + if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) ) { // enemies in sector - if( NumEnemiesInSector( pSoldier -> sSectorX, pSoldier -> sSectorY ) > 0 ) + if( NumEnemiesInSector( pSoldier->sSectorX, pSoldier->sSectorY ) > 0 ) { return( TRUE ); } @@ -1480,17 +1486,17 @@ BOOLEAN CanCharacterOnDuty( SOLDIERTYPE *pSoldier ) // ARM: New rule: can't change squads or exit vehicles between sectors! - if( pSoldier -> fBetweenSectors ) + if( pSoldier->flags.fBetweenSectors ) { return ( FALSE ); } /* - if( pSoldier -> fBetweenSectors ) + if( pSoldier->flags.fBetweenSectors ) { - if( pSoldier -> bAssignment == VEHICLE ) + if( pSoldier->bAssignment == VEHICLE ) { - if( GetNumberInVehicle( pSoldier -> iVehicleId ) == 1 ) + if( GetNumberInVehicle( pSoldier->iVehicleId ) == 1 ) { // can't change, go away return( FALSE ); @@ -1515,15 +1521,15 @@ BOOLEAN CanCharacterPractise( SOLDIERTYPE *pSoldier ) // only need to be alive and well to do so right now // alive and conscious - if( pSoldier -> bLife < OKLIFE ) + if( pSoldier->stats.bLife < OKLIFE ) { // dead or unconscious... return ( FALSE ); } - if( pSoldier -> bSectorZ != 0 ) + if( pSoldier->bSectorZ != 0 ) { - return( FALSE ); + return( FALSE ); } // in transit? @@ -1539,19 +1545,19 @@ BOOLEAN CanCharacterPractise( SOLDIERTYPE *pSoldier ) } // check in helicopter in hostile sector - if( pSoldier -> bAssignment == VEHICLE ) + if( pSoldier->bAssignment == VEHICLE ) { - if( ( iHelicopterVehicleId != -1 ) && ( pSoldier -> iVehicleId == iHelicopterVehicleId ) ) + if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) ) { // enemies in sector - if( NumEnemiesInSector( pSoldier -> sSectorX, pSoldier -> sSectorY ) > 0 ) + if( NumEnemiesInSector( pSoldier->sSectorX, pSoldier->sSectorY ) > 0 ) { return( FALSE ); } } } - if( pSoldier -> ubWhatKindOfMercAmI == MERC_TYPE__EPC ) + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC ) { // epcs can't do this return( FALSE ); @@ -1565,8 +1571,6 @@ BOOLEAN CanCharacterPractise( SOLDIERTYPE *pSoldier ) BOOLEAN CanCharacterTrainTeammates( SOLDIERTYPE *pSoldier ) { - //INT32 cnt = 0; - //SOLDIERTYPE *pTeamSoldier = NULL; // can character train at all if( CanCharacterPractise( pSoldier ) == FALSE ) @@ -1581,14 +1585,13 @@ BOOLEAN CanCharacterTrainTeammates( SOLDIERTYPE *pSoldier ) return( FALSE ); } - // ARM: we allow this even if there are no students assigned yet. Flashing is warning enough. + // ARM: we allow this even if there are no students assigned yet. Flashing is warning enough. return( TRUE ); } BOOLEAN CanCharacterBeTrainedByOther( SOLDIERTYPE *pSoldier ) { - //INT32 iCounter = 0; // can character train at all if( CanCharacterPractise( pSoldier ) == FALSE ) @@ -1602,7 +1605,7 @@ BOOLEAN CanCharacterBeTrainedByOther( SOLDIERTYPE *pSoldier ) return( FALSE ); } - // ARM: we now allow this even if there are no trainers assigned yet. Flashing is warning enough. + // ARM: we now allow this even if there are no trainers assigned yet. Flashing is warning enough. return( TRUE ); } @@ -1614,13 +1617,13 @@ BOOLEAN CanCharacterSleep( SOLDIERTYPE *pSoldier, BOOLEAN fExplainWhyNot ) CHAR16 sString[ 128 ]; // dead or dying? - if( pSoldier -> bLife < OKLIFE ) + if( pSoldier->stats.bLife < OKLIFE ) { return( FALSE ); } // vehicle or robot? - if( ( pSoldier -> uiStatusFlags & SOLDIER_VEHICLE ) || AM_A_ROBOT( pSoldier ) ) + if( ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) || AM_A_ROBOT( pSoldier ) ) { return( FALSE ); } @@ -1632,14 +1635,14 @@ BOOLEAN CanCharacterSleep( SOLDIERTYPE *pSoldier, BOOLEAN fExplainWhyNot ) } // POW? - if( pSoldier -> bAssignment == ASSIGNMENT_POW ) + if( pSoldier->bAssignment == ASSIGNMENT_POW ) { return( FALSE ); } // traveling? - if ( pSoldier->fBetweenSectors ) + if ( pSoldier->flags.fBetweenSectors ) { // if walking if ( pSoldier->bAssignment != VEHICLE ) @@ -1724,14 +1727,14 @@ BOOLEAN CanCharacterBeAwakened( SOLDIERTYPE *pSoldier, BOOLEAN fExplainWhyNot ) CHAR16 sString[ 128 ]; // if dead tired - if( ( pSoldier -> bBreathMax <= BREATHMAX_ABSOLUTE_MINIMUM ) && !pSoldier->fMercCollapsedFlag ) + if( ( pSoldier->bBreathMax <= BREATHMAX_ABSOLUTE_MINIMUM ) && !pSoldier->flags.fMercCollapsedFlag ) { // should be collapsed, then! - pSoldier->fMercCollapsedFlag = TRUE; + pSoldier->flags.fMercCollapsedFlag = TRUE; } // merc collapsed due to being dead tired, you can't wake him up until he recovers substantially - if ( pSoldier->fMercCollapsedFlag == TRUE ) + if ( pSoldier->flags.fMercCollapsedFlag == TRUE ) { if ( fExplainWhyNot ) { @@ -1758,7 +1761,7 @@ BOOLEAN CanCharacterVehicle( SOLDIERTYPE *pSoldier ) // only need to be alive and well to do so right now // alive and conscious - if( pSoldier -> bLife < OKLIFE ) + if( pSoldier->stats.bLife < OKLIFE ) { // dead or unconscious... return ( FALSE ); @@ -1783,12 +1786,12 @@ BOOLEAN CanCharacterVehicle( SOLDIERTYPE *pSoldier ) } // check in helicopter in hostile sector - if( pSoldier -> bAssignment == VEHICLE ) + if( pSoldier->bAssignment == VEHICLE ) { - if( ( iHelicopterVehicleId != -1 ) && ( pSoldier -> iVehicleId == iHelicopterVehicleId ) ) + if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) ) { // enemies in sector - if( NumEnemiesInSector( pSoldier -> sSectorX, pSoldier -> sSectorY ) > 0 ) + if( NumEnemiesInSector( pSoldier->sSectorX, pSoldier->sSectorY ) > 0 ) { return( FALSE ); } @@ -1807,10 +1810,10 @@ BOOLEAN CanCharacterVehicle( SOLDIERTYPE *pSoldier ) return( FALSE ); } - // if we're in BATTLE in the current sector, disallow + // if we're in BATTLE in the current sector, disallow if ( gTacticalStatus.fEnemyInSector ) { - if ( ( pSoldier -> sSectorX == gWorldSectorX ) && ( pSoldier -> sSectorY == gWorldSectorY ) && ( pSoldier -> bSectorZ == gbWorldSectorZ) ) + if ( ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->sSectorY == gWorldSectorY ) && ( pSoldier->bSectorZ == gbWorldSectorZ) ) { return( FALSE ); } @@ -1834,7 +1837,7 @@ INT8 CanCharacterSquad( SOLDIERTYPE *pSoldier, INT8 bSquadValue ) } // is the character alive and well? - if( pSoldier -> bLife < OKLIFE ) + if( pSoldier->stats.bLife < OKLIFE ) { // dead or unconscious... return ( CHARACTER_CANT_JOIN_SQUAD ); @@ -1853,11 +1856,11 @@ INT8 CanCharacterSquad( SOLDIERTYPE *pSoldier, INT8 bSquadValue ) } /* Driver can't abandon vehicle between sectors - OBSOLETE - nobody is allowed to change squads between sectors now! - if( pSoldier -> fBetweenSectors ) + if( pSoldier->flags.fBetweenSectors ) { - if( pSoldier -> bAssignment == VEHICLE ) + if( pSoldier->bAssignment == VEHICLE ) { - if( GetNumberInVehicle( pSoldier -> iVehicleId ) == 1 ) + if( GetNumberInVehicle( pSoldier->iVehicleId ) == 1 ) { // can't change, go away return( CHARACTER_CANT_JOIN_SQUAD ); @@ -1868,9 +1871,9 @@ INT8 CanCharacterSquad( SOLDIERTYPE *pSoldier, INT8 bSquadValue ) // see if the squad us at the same x,y,z SectorSquadIsIn( bSquadValue, &sX, &sY, &sZ ); - + // check sector x y and z, if not same, cannot join squad - if( ( sX != pSoldier -> sSectorX ) || ( sY != pSoldier -> sSectorY ) || ( sZ != pSoldier -> bSectorZ ) ) + if( ( sX != pSoldier->sSectorX ) || ( sY != pSoldier->sSectorY ) || ( sZ != pSoldier->bSectorZ ) ) { // is there anyone on this squad? if( NumberOfPeopleInSquad( bSquadValue ) > 0 ) @@ -1910,7 +1913,7 @@ BOOLEAN IsCharacterInTransit( SOLDIERTYPE *pSoldier ) // check if character is currently in transit - if( pSoldier -> bAssignment == IN_TRANSIT ) + if( pSoldier->bAssignment == IN_TRANSIT ) { // yep return ( TRUE ); @@ -1918,7 +1921,7 @@ BOOLEAN IsCharacterInTransit( SOLDIERTYPE *pSoldier ) // no return ( FALSE ); -} +} void UpdateAssignments() @@ -1929,7 +1932,7 @@ void UpdateAssignments() InitSectorsWithSoldiersList( ); // build list - BuildSectorsWithSoldiersList( ); + BuildSectorsWithSoldiersList( ); // handle natural healing HandleNaturalHealing( ); @@ -1942,8 +1945,8 @@ void UpdateAssignments() // clear out the update list ClearSectorListForCompletedTrainingOfMilitia( ); - - + + // rest resting mercs, fatigue active mercs, // check for mercs tired enough go to sleep, and wake up well-rested mercs HandleRestFatigueAndSleepStatus( ); @@ -1964,7 +1967,7 @@ void UpdateAssignments() // handle militia squads movings and creating (not an assignment) if(!bZ && sX < 17 && sY < 17 && sX > 0 && sY > 0)UpdateMilitiaSquads( sX, sY ); // is there anyone in this sector? - if( fSectorsWithSoldiers[ sX + sY * MAP_WORLD_X ][ bZ ] == TRUE ) + if( fSectorsWithSoldiers[ sX + sY * MAP_WORLD_X ][ bZ ] == TRUE ) { // handle any doctors HandleDoctorsInSector( sX, sY, bZ ); @@ -1996,7 +1999,7 @@ void UpdateAssignments() // check if anyone is on an assignment where they have nothing to do ReEvaluateEveryonesNothingToDo(); - // update mapscreen + // update mapscreen fCharacterInfoPanelDirty = TRUE; fTeamPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; @@ -2021,13 +2024,13 @@ void VerifyTownTrainingIsPaidFor( void ) } pSoldier = &Menptr[ gCharactersList[ iCounter ].usSolID ]; - + if( pSoldier->bActive && ( pSoldier->bAssignment == TRAIN_TOWN ) ) { // make sure that sector is paid up! - if( SectorInfo[ SECTOR( pSoldier -> sSectorX, pSoldier -> sSectorY ) ].fMilitiaTrainingPaid == FALSE ) + if( SectorInfo[ SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ].fMilitiaTrainingPaid == FALSE ) { - // NOPE! We've got a bug somewhere + // NOPE! We've got a bug somewhere StopTimeCompression(); // report the error @@ -2048,21 +2051,20 @@ UINT8 FindNumberInSectorWithAssignment( INT16 sX, INT16 sY, INT8 bAssignment ) // run thought list of characters find number with this assignment SOLDIERTYPE *pSoldier, *pTeamSoldier; INT32 cnt=0; - //INT32 iCounter=0; INT8 bNumberOfPeople = 0; - + // set psoldier as first in merc ptrs - pSoldier = MercPtrs[0]; - + pSoldier = MercPtrs[0]; + // go through list of characters, find all who are on this assignment - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier -> bTeam ].bLastID; cnt++,pTeamSoldier++) + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) { - if( pTeamSoldier -> bActive ) + if( pTeamSoldier->bActive ) { - if( ( pTeamSoldier -> sSectorX == sX ) && ( pTeamSoldier -> sSectorY == sY ) &&( pTeamSoldier -> bAssignment == bAssignment ) ) + if( ( pTeamSoldier->sSectorX == sX ) && ( pTeamSoldier->sSectorY == sY ) &&( pTeamSoldier->bAssignment == bAssignment ) ) { // increment number of people who are on this assignment - if(pTeamSoldier -> bActive) + if(pTeamSoldier->bActive) bNumberOfPeople++; } } @@ -2080,9 +2082,9 @@ UINT8 GetNumberThatCanBeDoctored( SOLDIERTYPE *pDoctor, BOOLEAN fThisHour, BOOLE // go through list of characters, find all who are patients/doctors healable by this doctor - for ( cnt = 0, pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier -> bTeam ].bLastID; cnt++,pTeamSoldier++) + for ( cnt = 0, pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) { - if( pTeamSoldier -> bActive ) + if( pTeamSoldier->bActive ) { if( CanSoldierBeHealedByDoctor( pTeamSoldier, pDoctor, FALSE, fThisHour, fSkipKitCheck, fSkipSkillCheck ) == TRUE ) { @@ -2103,10 +2105,10 @@ SOLDIERTYPE *AnyDoctorWhoCanHealThisPatient( SOLDIERTYPE *pPatient, BOOLEAN fThi // go through list of characters, find all who are patients/doctors healable by this doctor - for ( cnt = 0, pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier -> bTeam ].bLastID; cnt++,pTeamSoldier++) + for ( cnt = 0, pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) { // doctor? - if( ( pTeamSoldier -> bActive ) && ( pTeamSoldier->bAssignment == DOCTOR ) ) + if( ( pTeamSoldier->bActive ) && ( pTeamSoldier->bAssignment == DOCTOR ) ) { if( CanSoldierBeHealedByDoctor( pPatient, pTeamSoldier, FALSE, fThisHour, FALSE, FALSE ) == TRUE ) { @@ -2141,7 +2143,7 @@ UINT16 CalculateHealingPointsForDoctor(SOLDIERTYPE *pDoctor, UINT16 *pusMaxPts, // calculate normal doctoring rate - what it would be if his stats were "normal" (ignoring drugs, fatigue, equipment condition) // and equipment was not a hindrance - *pusMaxPts = (UINT16) (( pDoctor -> bMedical * (( pDoctor -> bDexterity + pDoctor -> bWisdom ) / 2 ) * (100 + ( 5 * pDoctor->bExpLevel) ) ) / gGameExternalOptions.ubDoctoringRateDivisor); + *pusMaxPts = ( pDoctor->stats.bMedical * (( pDoctor->stats.bDexterity + pDoctor->stats.bWisdom ) / 2 ) * (100 + ( 5 * pDoctor->stats.bExpLevel) ) ) / gGameExternalOptions.ubDoctoringRateDivisor; // adjust for fatigue ReducePointsForFatigue( pDoctor, &usHealPts ); @@ -2156,7 +2158,7 @@ UINT16 CalculateHealingPointsForDoctor(SOLDIERTYPE *pDoctor, UINT16 *pusMaxPts, } // get the type of medkit being used - bMedFactor = IsMedicalKitItem( &( pDoctor -> inv[ HANDPOS ] ) ); + bMedFactor = IsMedicalKitItem( &( pDoctor->inv[ HANDPOS ] ) ); if( bMedFactor != 0 ) { @@ -2170,7 +2172,7 @@ UINT16 CalculateHealingPointsForDoctor(SOLDIERTYPE *pDoctor, UINT16 *pusMaxPts, usHealPts = 0; } - + // return healing pts value return( usHealPts ); } @@ -2180,7 +2182,7 @@ UINT8 CalculateRepairPointsForRepairman(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts { UINT16 usRepairPts; UINT16 usKitPts; - UINT8 ubKitEffectiveness; + UINT8 ubKitEffectiveness; // make sure toolkit in hand? if( fMakeSureKitIsInHand ) @@ -2189,7 +2191,7 @@ UINT8 CalculateRepairPointsForRepairman(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts } // can't repair at all without a toolkit - if (!Item[pSoldier -> inv[HANDPOS].usItem].toolkit ) + if (!Item[pSoldier->inv[HANDPOS].usItem].toolkit ) { *pusMaxPts = 0; return(0); @@ -2200,7 +2202,7 @@ UINT8 CalculateRepairPointsForRepairman(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts // calculate normal repair rate - what it would be if his stats were "normal" (ignoring drugs, fatigue, equipment condition) // and equipment was not a hindrance - *pusMaxPts = (UINT16) (( pSoldier -> bMechanical * pSoldier -> bDexterity * (100 + ( 5 * pSoldier->bExpLevel) ) ) / ( gGameExternalOptions.ubRepairRateDivisor * gGameExternalOptions.ubAssignmentUnitsPerDay )); + *pusMaxPts = ( pSoldier->stats.bMechanical * pSoldier->stats.bDexterity * (100 + ( 5 * pSoldier->stats.bExpLevel) ) ) / ( gGameExternalOptions.ubRepairRateDivisor * gGameExternalOptions.ubAssignmentUnitsPerDay ); // adjust for fatigue @@ -2240,12 +2242,13 @@ UINT16 ToolKitPoints(SOLDIERTYPE *pSoldier) UINT8 ubPocket; // add up kit points - for (ubPocket=HANDPOS; ubPocket <= SMALLPOCK8POS; ubPocket++) + // CHRISL: Changed to dynamically determine max inventory locations. + for (ubPocket=HANDPOS; ubPocket < NUM_INV_SLOTS; ubPocket++) { - if( Item[pSoldier -> inv[ ubPocket ].usItem].toolkit ) - { - usKitpts += TotalPoints( &( pSoldier -> inv[ ubPocket ] ) ); - } + if( Item[pSoldier->inv[ ubPocket ].usItem].toolkit ) + { + usKitpts += TotalPoints( &( pSoldier->inv[ ubPocket ] ) ); + } } return( usKitpts ); @@ -2258,13 +2261,14 @@ UINT16 TotalMedicalKitPoints(SOLDIERTYPE *pSoldier) UINT16 usKitpts=0; // add up kit points of all medkits - for (ubPocket = HANDPOS; ubPocket <= SMALLPOCK8POS; ubPocket++) + // CHRISL: Changed to dynamically determine max inventory locations. + for (ubPocket = HANDPOS; ubPocket < NUM_INV_SLOTS; ubPocket++) { // NOTE: Here, we don't care whether these are MEDICAL BAGS or FIRST AID KITS! - if ( IsMedicalKitItem( &( pSoldier -> inv[ ubPocket ] ) ) ) - { - usKitpts += TotalPoints( &( pSoldier -> inv[ ubPocket ] ) ); - } + if ( IsMedicalKitItem( &( pSoldier->inv[ ubPocket ] ) ) ) + { + usKitpts += TotalPoints( &( pSoldier->inv[ ubPocket ] ) ); + } } return( usKitpts ); @@ -2274,22 +2278,21 @@ UINT16 TotalMedicalKitPoints(SOLDIERTYPE *pSoldier) void HandleDoctorsInSector( INT16 sX, INT16 sY, INT8 bZ ) { SOLDIERTYPE *pSoldier, *pTeamSoldier; - INT32 cnt=0; - //INT32 iCounter=0; + INT32 cnt=0; // set psoldier as first in merc ptrs - pSoldier = MercPtrs[0]; - + pSoldier = MercPtrs[0]; + // will handle doctor/patient relationship in sector // go through list of characters, find all doctors in sector - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier -> bTeam ].bLastID; cnt++,pTeamSoldier++) + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) { - if(pTeamSoldier -> bActive) + if(pTeamSoldier->bActive) { - if( ( pTeamSoldier -> sSectorX == sX ) && ( pTeamSoldier -> sSectorY == sY ) && ( pTeamSoldier -> bSectorZ == bZ ) ) + if( ( pTeamSoldier->sSectorX == sX ) && ( pTeamSoldier->sSectorY == sY ) && ( pTeamSoldier->bSectorZ == bZ ) ) { - if ( ( pTeamSoldier -> bAssignment == DOCTOR ) && ( pTeamSoldier->fMercAsleep == FALSE ) ) + if ( ( pTeamSoldier->bAssignment == DOCTOR ) && ( pTeamSoldier->flags.fMercAsleep == FALSE ) ) { MakeSureMedKitIsInHand( pTeamSoldier ); // character is in sector, check if can doctor, if so...heal people @@ -2299,13 +2302,13 @@ void HandleDoctorsInSector( INT16 sX, INT16 sY, INT8 bZ ) } } /* - if( ( pTeamSoldier -> bAssignment == DOCTOR ) && ( pTeamSoldier->fMercAsleep == FALSE ) ) + if( ( pTeamSoldier->bAssignment == DOCTOR ) && ( pTeamSoldier->flags.fMercAsleep == FALSE ) ) { MakeSureMedKitIsInHand( pTeamSoldier ); } // character is in sector, check if can doctor, if so...heal people - if( CanCharacterDoctor( pTeamSoldier ) && ( pTeamSoldier -> bAssignment == DOCTOR ) && ( pTeamSoldier->fMercAsleep == FALSE ) && EnoughTimeOnAssignment( pTeamSoldier ) ) + if( CanCharacterDoctor( pTeamSoldier ) && ( pTeamSoldier->bAssignment == DOCTOR ) && ( pTeamSoldier->flags.fMercAsleep == FALSE ) && EnoughTimeOnAssignment( pTeamSoldier ) ) { HealCharacters( pTeamSoldier, sX, sY, bZ ); } @@ -2323,17 +2326,17 @@ void UpdatePatientsWhoAreDoneHealing( void ) { INT32 cnt = 0; SOLDIERTYPE *pSoldier = NULL, *pTeamSoldier = NULL; - + // set as first in list pSoldier = MercPtrs[0]; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier -> bTeam ].bLastID; cnt++,pTeamSoldier++) + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) { // active soldier? if( pTeamSoldier->bActive ) { // patient who doesn't need healing - if( ( pTeamSoldier->bAssignment == PATIENT ) &&( pTeamSoldier->bLife == pTeamSoldier->bLifeMax ) ) + if( ( pTeamSoldier->bAssignment == PATIENT ) &&( pTeamSoldier->stats.bLife == pTeamSoldier->stats.bLifeMax ) ) { AssignmentDone( pTeamSoldier, TRUE, TRUE ); } @@ -2352,7 +2355,7 @@ void HealCharacters( SOLDIERTYPE *pDoctor, INT16 sX, INT16 sY, INT8 bZ ) UINT16 usMax =0; UINT8 ubTotalNumberOfPatients = 0; SOLDIERTYPE *pSoldier = MercPtrs[0], *pTeamSoldier = NULL, *pWorstHurtSoldier = NULL; - INT32 cnt = 0; + INT32 cnt = 0; UINT16 usOldLeftOvers = 0; @@ -2371,9 +2374,9 @@ void HealCharacters( SOLDIERTYPE *pDoctor, INT16 sX, INT16 sY, INT8 bZ ) // heal each of the healable mercs by this equal amount - for ( cnt = 0, pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier -> bTeam ].bLastID; cnt++,pTeamSoldier++) + for ( cnt = 0, pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) { - if( pTeamSoldier -> bActive ) + if( pTeamSoldier->bActive ) { if( CanSoldierBeHealedByDoctor( pTeamSoldier, pDoctor, FALSE, HEALABLE_THIS_HOUR, FALSE, FALSE ) == TRUE ) { @@ -2393,9 +2396,9 @@ void HealCharacters( SOLDIERTYPE *pDoctor, INT16 sX, INT16 sY, INT8 bZ ) // find the worst hurt patient pWorstHurtSoldier = NULL; - for ( cnt = 0, pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier -> bTeam ].bLastID; cnt++,pTeamSoldier++) + for ( cnt = 0, pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) { - if( pTeamSoldier -> bActive ) + if( pTeamSoldier->bActive ) { if( CanSoldierBeHealedByDoctor( pTeamSoldier, pDoctor, FALSE, HEALABLE_THIS_HOUR, FALSE, FALSE ) == TRUE ) { @@ -2406,7 +2409,7 @@ void HealCharacters( SOLDIERTYPE *pDoctor, INT16 sX, INT16 sY, INT8 bZ ) else { // check to see if this guy is hurt worse than anyone previous? - if( pTeamSoldier -> bLife < pWorstHurtSoldier -> bLife ) + if( pTeamSoldier->stats.bLife < pWorstHurtSoldier->stats.bLife ) { // he is now the worse hurt guy pWorstHurtSoldier = pTeamSoldier; @@ -2467,7 +2470,7 @@ void HealCharacters( SOLDIERTYPE *pDoctor, INT16 sX, INT16 sY, INT8 bZ ) } -/* Assignment distance limits removed. Sep/11/98. ARM +/* Assignment distance limits removed. Sep/11/98. ARM BOOLEAN IsSoldierCloseEnoughToADoctor( SOLDIERTYPE *pPatient ) { // run through all doctors in sector, if it is loaded @@ -2528,22 +2531,21 @@ BOOLEAN IsSoldierCloseEnoughToADoctor( SOLDIERTYPE *pPatient ) BOOLEAN CanSoldierBeHealedByDoctor( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pDoctor, BOOLEAN fIgnoreAssignment, BOOLEAN fThisHour, BOOLEAN fSkipKitCheck, BOOLEAN fSkipSkillCheck ) { - INT16 sDistance = 0; // must be an active guy - if (pSoldier -> bActive == FALSE) + if (pSoldier->bActive == FALSE) { return(FALSE); } // must be a patient or a doctor - if( ( pSoldier -> bAssignment != PATIENT ) && ( pSoldier -> bAssignment != DOCTOR ) && ( fIgnoreAssignment == FALSE ) ) + if( ( pSoldier->bAssignment != PATIENT ) && ( pSoldier->bAssignment != DOCTOR ) && ( fIgnoreAssignment == FALSE ) ) { return(FALSE); } // if dead or unhurt - if ( (pSoldier -> bLife == 0) || (pSoldier -> bLife == pSoldier -> bLifeMax ) ) + if ( (pSoldier->stats.bLife == 0) || (pSoldier->stats.bLife == pSoldier->stats.bLifeMax ) ) { return(FALSE); } @@ -2555,19 +2557,19 @@ BOOLEAN CanSoldierBeHealedByDoctor( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pDoctor, } // must be in the same sector - if( ( pSoldier -> sSectorX != pDoctor -> sSectorX ) || ( pSoldier -> sSectorY != pDoctor -> sSectorY ) || ( pSoldier -> bSectorZ != pDoctor -> bSectorZ ) ) + if( ( pSoldier->sSectorX != pDoctor->sSectorX ) || ( pSoldier->sSectorY != pDoctor->sSectorY ) || ( pSoldier->bSectorZ != pDoctor->bSectorZ ) ) { return(FALSE); } // can't be between sectors (possible to get here if ignoring assignment) - if ( pSoldier->fBetweenSectors ) + if ( pSoldier->flags.fBetweenSectors ) { return(FALSE); } // if doctor's skill is unsufficient to save this guy - if ( !fSkipSkillCheck && ( pDoctor -> bMedical < GetMinHealingSkillNeeded( pSoldier ) ) ) + if ( !fSkipSkillCheck && ( pDoctor->stats.bMedical < GetMinHealingSkillNeeded( pSoldier ) ) ) { return(FALSE); } @@ -2577,7 +2579,7 @@ BOOLEAN CanSoldierBeHealedByDoctor( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pDoctor, // no medical kit to use! return( FALSE ); } - + return( TRUE ); } @@ -2586,10 +2588,10 @@ UINT8 GetMinHealingSkillNeeded( SOLDIERTYPE *pPatient ) { // get the minimum skill to handle a character under OKLIFE - if( pPatient -> bLife < OKLIFE ) + if( pPatient->stats.bLife < OKLIFE ) { // less than ok life, return skill needed - return( gGameExternalOptions.ubBaseMedicalSkillToDealWithEmergency + ( gGameExternalOptions.ubMultiplierForDifferenceInLifeValueForEmergency * ( OKLIFE - pPatient -> bLife ) ) ); + return( gGameExternalOptions.ubBaseMedicalSkillToDealWithEmergency + ( gGameExternalOptions.ubMultiplierForDifferenceInLifeValueForEmergency * ( OKLIFE - pPatient->stats.bLife ) ) ); } else { @@ -2610,7 +2612,7 @@ UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHundr INT8 bPointsHealed = 0; INT8 bPocket = 0; INT8 bMedFactor; -// INT8 bOldPatientLife = pPatient -> bLife; +// INT8 bOldPatientLife = pPatient->stats.bLife; pPatient->sFractLife += usHundredthsHealed; @@ -2627,37 +2629,37 @@ UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHundr } -/* ARM - Eliminated. We now have other methods of properly using doctors to auto-bandage bleeding, +/* ARM - Eliminated. We now have other methods of properly using doctors to auto-bandage bleeding, // using the correct kits points instead of this 1 pt. "special" - // stop all bleeding of patient..for 1 pt (it's fast). But still use up normal kit pts to do it - if (pPatient -> bBleeding > 0) + // stop all bleeding of patient..for 1 pt (it's fast). But still use up normal kit pts to do it + if (pPatient->bBleeding > 0) { usHealingPtsLeft--; usTotalFullPtsUsed++; // get points needed to heal him to dress bleeding wounds - bPointsToUse = pPatient -> bBleeding; + bPointsToUse = pPatient->bBleeding; // go through doctor's pockets and heal, starting at with his in-hand item // the healing pts are based on what type of medkit is in his hand, so we HAVE to start there first! for (bPocket = HANDPOS; bPocket <= SMALLPOCK8POS; bPocket++) { - bMedFactor = IsMedicalKitItem( &( pDoctor -> inv[ bPocket ] ) ); + bMedFactor = IsMedicalKitItem( &( pDoctor->inv[ bPocket ] ) ); if ( bMedFactor > 0 ) { // ok, we have med kit in this pocket, use it // The medFactor here doesn't affect how much the doctor can heal (that's already factored into lower healing pts) - // but it does effect how fast the medkit is used up! First aid kits disappear at double their doctoring rate! - bPointsUsed = (INT8) UseKitPoints( &( pDoctor -> inv[ bPocket ] ), (UINT16) (bPointsToUse * bMedFactor), pDoctor ); + // but it does effect how fast the medkit is used up! First aid kits disappear at double their doctoring rate! + bPointsUsed = (INT8) UseKitPoints( &( pDoctor->inv[ bPocket ] ), (UINT16) (bPointsToUse * bMedFactor), pDoctor ); bPointsHealed = bPointsUsed / bMedFactor; bPointsToUse -= bPointsHealed; - pPatient -> bBleeding -= bPointsHealed; + pPatient->bBleeding -= bPointsHealed; // if we're done all we're supposed to, or the guy's no longer bleeding, bail - if ( ( bPointsToUse <= 0 ) || ( pPatient -> bBleeding == 0 ) ) + if ( ( bPointsToUse <= 0 ) || ( pPatient->bBleeding == 0 ) ) { break; } @@ -2667,29 +2669,30 @@ UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHundr */ // if below ok life, heal these first at double point cost - if( pPatient -> bLife < OKLIFE ) + if( pPatient->stats.bLife < OKLIFE ) { // get points needed to heal him to OKLIFE - bPointsToUse = gGameExternalOptions.ubPointCostPerHealthBelowOkLife * ( OKLIFE - pPatient -> bLife ); + bPointsToUse = gGameExternalOptions.ubPointCostPerHealthBelowOkLife * ( OKLIFE - pPatient->stats.bLife ); // if he needs more than we have, reduce to that if( bPointsToUse > usHealingPtsLeft ) { - bPointsToUse = ( INT8 )usHealingPtsLeft; + bPointsToUse = ( INT8 )usHealingPtsLeft; } // go through doctor's pockets and heal, starting at with his in-hand item // the healing pts are based on what type of medkit is in his hand, so we HAVE to start there first! - for (bPocket = HANDPOS; bPocket <= SMALLPOCK8POS; bPocket++) + // CHRISL: Changed to dynamically determine max inventory locations. + for (bPocket = HANDPOS; bPocket < NUM_INV_SLOTS; bPocket++) { - bMedFactor = IsMedicalKitItem( &( pDoctor -> inv[ bPocket ] ) ); + bMedFactor = IsMedicalKitItem( &( pDoctor->inv[ bPocket ] ) ); if ( bMedFactor > 0 ) { // ok, we have med kit in this pocket, use it // The medFactor here doesn't affect how much the doctor can heal (that's already factored into lower healing pts) - // but it does effect how fast the medkit is used up! First aid kits disappear at double their doctoring rate! - bPointsUsed = (INT8) UseKitPoints( &( pDoctor -> inv[ bPocket ] ), (UINT16) (bPointsToUse * bMedFactor), pDoctor ); + // but it does effect how fast the medkit is used up! First aid kits disappear at double their doctoring rate! + bPointsUsed = (INT8) UseKitPoints( &( pDoctor->inv[ bPocket ] ), (UINT16) (bPointsToUse * bMedFactor), pDoctor ); bPointsHealed = bPointsUsed / bMedFactor; bPointsToUse -= bPointsHealed; @@ -2697,10 +2700,10 @@ UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHundr usTotalFullPtsUsed += bPointsHealed; // heal person the amount / POINT_COST_PER_HEALTH_BELOW_OKLIFE - pPatient -> bLife += (bPointsHealed / gGameExternalOptions.ubPointCostPerHealthBelowOkLife); + pPatient->stats.bLife += (bPointsHealed / gGameExternalOptions.ubPointCostPerHealthBelowOkLife); // if we're done all we're supposed to, or the guy's at OKLIFE, bail - if ( ( bPointsToUse <= 0 ) || ( pPatient -> bLife >= OKLIFE ) ) + if ( ( bPointsToUse <= 0 ) || ( pPatient->stats.bLife >= OKLIFE ) ) { break; } @@ -2710,11 +2713,11 @@ UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHundr // critical conditions handled, now apply normal healing - if (pPatient -> bLife < pPatient -> bLifeMax) + if (pPatient->stats.bLife < pPatient->stats.bLifeMax) { - bPointsToUse = ( pPatient -> bLifeMax - pPatient -> bLife ); - - // if guy is hurt more than points we have...heal only what we have + bPointsToUse = ( pPatient->stats.bLifeMax - pPatient->stats.bLife ); + + // if guy is hurt more than points we have...heal only what we have if( bPointsToUse > usHealingPtsLeft ) { bPointsToUse = ( INT8 )usHealingPtsLeft; @@ -2722,26 +2725,27 @@ UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHundr // go through doctor's pockets and heal, starting at with his in-hand item // the healing pts are based on what type of medkit is in his hand, so we HAVE to start there first! - for (bPocket = HANDPOS; bPocket <= SMALLPOCK8POS; bPocket++) + // CHRISL: Changed to dynamically determine max inventory locations. + for (bPocket = HANDPOS; bPocket < NUM_INV_SLOTS; bPocket++) { - bMedFactor = IsMedicalKitItem( &( pDoctor -> inv[ bPocket ] ) ); + bMedFactor = IsMedicalKitItem( &( pDoctor->inv[ bPocket ] ) ); if ( bMedFactor > 0 ) { - // ok, we have med kit in this pocket, use it (use only half if it's worth double) + // ok, we have med kit in this pocket, use it (use only half if it's worth double) // The medFactor here doesn't affect how much the doctor can heal (that's already factored into lower healing pts) - // but it does effect how fast the medkit is used up! First aid kits disappear at double their doctoring rate! - bPointsUsed = (INT8) UseKitPoints( &( pDoctor -> inv[ bPocket ] ), (UINT16) (bPointsToUse * bMedFactor), pDoctor ); + // but it does effect how fast the medkit is used up! First aid kits disappear at double their doctoring rate! + bPointsUsed = (INT8) UseKitPoints( &( pDoctor->inv[ bPocket ] ), (UINT16) (bPointsToUse * bMedFactor), pDoctor ); bPointsHealed = bPointsUsed / bMedFactor; bPointsToUse -= bPointsHealed; usHealingPtsLeft -= bPointsHealed; usTotalFullPtsUsed += bPointsHealed; - pPatient -> bLife += bPointsHealed; + pPatient->stats.bLife += bPointsHealed; // if we're done all we're supposed to, or the guy's fully healed, bail - if ( ( bPointsToUse <= 0 ) || ( pPatient -> bLife == pPatient -> bLifeMax ) ) + if ( ( bPointsToUse <= 0 ) || ( pPatient->stats.bLife == pPatient->stats.bLifeMax ) ) { break; } @@ -2751,7 +2755,7 @@ UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHundr // if this patient is fully healed - if( pPatient->bLife == pPatient->bLifeMax ) + if( pPatient->stats.bLife == pPatient->stats.bLifeMax ) { // don't count unused full healing points as being used usTotalHundredthsUsed -= (100 * usHealingPtsLeft); @@ -2760,7 +2764,7 @@ UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHundr usTotalHundredthsUsed -= pPatient->sFractLife; pPatient->sFractLife = 0; -/* ARM Removed. This is duplicating the check in UpdatePatientsWhoAreDoneHealing(), guy would show up twice! +/* ARM Removed. This is duplicating the check in UpdatePatientsWhoAreDoneHealing(), guy would show up twice! // if it isn't the doctor himself) if( ( pPatient != pDoctor ) { @@ -2776,7 +2780,7 @@ UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHundr void CheckForAndHandleHospitalPatients( void ) { SOLDIERTYPE *pSoldier, *pTeamSoldier; - INT32 cnt=0; + INT32 cnt=0; if( fSectorsWithSoldiers[ HOSPITAL_SECTOR_X + HOSPITAL_SECTOR_Y * MAP_WORLD_X ][ 0 ] == FALSE ) { @@ -2785,16 +2789,16 @@ void CheckForAndHandleHospitalPatients( void ) } // set pSoldier as first in merc ptrs - pSoldier = MercPtrs[0]; + pSoldier = MercPtrs[0]; // go through list of characters, find all who are on this assignment - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier -> bTeam ].bLastID; cnt++,pTeamSoldier++) + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) { - if( pTeamSoldier -> bActive ) + if( pTeamSoldier->bActive ) { - if ( pTeamSoldier -> bAssignment == ASSIGNMENT_HOSPITAL ) + if ( pTeamSoldier->bAssignment == ASSIGNMENT_HOSPITAL ) { - if ( ( pTeamSoldier -> sSectorX == HOSPITAL_SECTOR_X ) && ( pTeamSoldier -> sSectorY == HOSPITAL_SECTOR_Y ) && ( pTeamSoldier -> bSectorZ == 0 ) ) + if ( ( pTeamSoldier->sSectorX == HOSPITAL_SECTOR_X ) && ( pTeamSoldier->sSectorY == HOSPITAL_SECTOR_Y ) && ( pTeamSoldier->bSectorZ == 0 ) ) { // heal this character HealHospitalPatient( pTeamSoldier, gGameExternalOptions.ubHospitalHealingRate ); @@ -2814,40 +2818,40 @@ void HealHospitalPatient( SOLDIERTYPE *pPatient, UINT16 usHealingPtsLeft ) return; } -/* Stopping hospital patients' bleeding must be handled immediately, not during a regular hourly check +/* Stopping hospital patients' bleeding must be handled immediately, not during a regular hourly check // stop all bleeding of patient..for 1 pt. - if (pPatient -> bBleeding > 0) + if (pPatient->bBleeding > 0) { usHealingPtsLeft--; - pPatient -> bBleeding = 0; + pPatient->bBleeding = 0; } */ // if below ok life, heal these first at double cost - if( pPatient -> bLife < OKLIFE ) + if( pPatient->stats.bLife < OKLIFE ) { // get points needed to heal him to OKLIFE - bPointsToUse = gGameExternalOptions.ubPointCostPerHealthBelowOkLife * ( OKLIFE - pPatient -> bLife ); + bPointsToUse = gGameExternalOptions.ubPointCostPerHealthBelowOkLife * ( OKLIFE - pPatient->stats.bLife ); // if he needs more than we have, reduce to that if( bPointsToUse > usHealingPtsLeft ) { - bPointsToUse = ( INT8 )usHealingPtsLeft; + bPointsToUse = ( INT8 )usHealingPtsLeft; } usHealingPtsLeft -= bPointsToUse; // heal person the amount / POINT_COST_PER_HEALTH_BELOW_OKLIFE - pPatient -> bLife += ( bPointsToUse / gGameExternalOptions.ubPointCostPerHealthBelowOkLife ); + pPatient->stats.bLife += ( bPointsToUse / gGameExternalOptions.ubPointCostPerHealthBelowOkLife ); } // critical condition handled, now solve normal healing - if ( pPatient -> bLife < pPatient -> bLifeMax ) + if ( pPatient->stats.bLife < pPatient->stats.bLifeMax ) { - bPointsToUse = ( pPatient -> bLifeMax - pPatient -> bLife ); - - // if guy is hurt more than points we have...heal only what we have + bPointsToUse = ( pPatient->stats.bLifeMax - pPatient->stats.bLife ); + + // if guy is hurt more than points we have...heal only what we have if( bPointsToUse > usHealingPtsLeft ) { bPointsToUse = ( INT8 )usHealingPtsLeft; @@ -2856,11 +2860,11 @@ void HealHospitalPatient( SOLDIERTYPE *pPatient, UINT16 usHealingPtsLeft ) usHealingPtsLeft -= bPointsToUse; // heal person the amount - pPatient -> bLife += bPointsToUse; + pPatient->stats.bLife += bPointsToUse; } // if this patient is fully healed - if ( pPatient -> bLife == pPatient -> bLifeMax ) + if ( pPatient->stats.bLife == pPatient->stats.bLifeMax ) { AssignmentDone( pPatient, TRUE, TRUE ); } @@ -2870,22 +2874,21 @@ void HealHospitalPatient( SOLDIERTYPE *pPatient, UINT16 usHealingPtsLeft ) void HandleRepairmenInSector( INT16 sX, INT16 sY, INT8 bZ ) { SOLDIERTYPE *pSoldier, *pTeamSoldier; - INT32 cnt=0; - INT32 iCounter=0; + INT32 cnt=0; // set psoldier as first in merc ptrs - pSoldier = MercPtrs[0]; + pSoldier = MercPtrs[0]; // will handle doctor/patient relationship in sector // go through list of characters, find all doctors in sector - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier -> bTeam ].bLastID; cnt++,pTeamSoldier++) + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) { - if( pTeamSoldier -> bActive ) + if( pTeamSoldier->bActive ) { - if( ( pTeamSoldier -> sSectorX == sX ) && ( pTeamSoldier -> sSectorY == sY ) && ( pTeamSoldier -> bSectorZ == bZ) ) + if( ( pTeamSoldier->sSectorX == sX ) && ( pTeamSoldier->sSectorY == sY ) && ( pTeamSoldier->bSectorZ == bZ) ) { - if ( ( pTeamSoldier -> bAssignment == REPAIR ) && ( pTeamSoldier->fMercAsleep == FALSE ) ) + if ( ( pTeamSoldier->bAssignment == REPAIR ) && ( pTeamSoldier->flags.fMercAsleep == FALSE ) ) { MakeSureToolKitIsInHand( pTeamSoldier ); // character is in sector, check if can repair @@ -2902,17 +2905,17 @@ void HandleRepairmenInSector( INT16 sX, INT16 sY, INT8 bZ ) } -/* No point in allowing SAM site repair any more. Jan/13/99. ARM +/* No point in allowing SAM site repair any more. Jan/13/99. ARM INT8 HandleRepairOfSAMSite( SOLDIERTYPE *pSoldier, INT8 bPointsAvailable, BOOLEAN * pfNothingLeftToRepair ) { INT8 bPtsUsed = 0; INT16 sStrategicSector = 0; - if( IsThisSectorASAMSector( pSoldier -> sSectorX, pSoldier -> sSectorY, pSoldier -> bSectorZ ) == FALSE ) + if( IsThisSectorASAMSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) == FALSE ) { return( bPtsUsed ); } - else if( ( pSoldier -> sSectorX == gWorldSectorX ) && ( pSoldier -> bSectorZ == gbWorldSectorZ )&&( pSoldier -> sSectorY == gWorldSectorY ) ) + else if( ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->bSectorZ == gbWorldSectorZ )&&( pSoldier->sSectorY == gWorldSectorY ) ) { if( CanSoldierRepairSAM( pSoldier, bPointsAvailable ) == FALSE ) { @@ -2944,7 +2947,7 @@ INT8 HandleRepairOfSAMSite( SOLDIERTYPE *pSoldier, INT8 bPointsAvailable, BOOLEA // FULL STRENGTH (condition 100), but as soon as it reaches MIN_CONDITION_TO_FIX_SAM!!! // Bring Hit points back up to full, adjust graphic to full graphic..... - UpdateSAMDoneRepair( pSoldier -> sSectorX, pSoldier -> sSectorY, pSoldier -> bSectorZ ); + UpdateSAMDoneRepair( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ); } if ( StrategicMap[ sStrategicSector ].bSAMCondition == 100 ) @@ -2961,7 +2964,7 @@ INT8 HandleRepairOfSAMSite( SOLDIERTYPE *pSoldier, INT8 bPointsAvailable, BOOLEA -INT8 FindRepairableItemOnOtherSoldier( SOLDIERTYPE * pSoldier, UINT8 ubPassType ) +OBJECTTYPE* FindRepairableItemOnOtherSoldier( SOLDIERTYPE * pSoldier, UINT8 ubPassType ) { INT8 bLoop, bLoop2; REPAIR_PASS_SLOTS_TYPE *pPassList; @@ -2973,39 +2976,87 @@ INT8 FindRepairableItemOnOtherSoldier( SOLDIERTYPE * pSoldier, UINT8 ubPassType pPassList = &( gRepairPassSlotList[ ubPassType ] ); - for ( bLoop = 0; bLoop < pPassList->ubChoices; bLoop++ ) + // CHRISL: + for ( bLoop = 0; bLoop < pPassList->ubChoices[UsingNewInventorySystem()]; bLoop++ ) { bSlotToCheck = pPassList->bSlot[ bLoop ]; Assert( bSlotToCheck != -1 ); - pObj = &( pSoldier->inv[ bSlotToCheck ] ); for ( bLoop2 = 0; bLoop2 < pSoldier->inv[ bSlotToCheck ].ubNumberOfObjects; bLoop2++ ) { - if ( IsItemRepairable( pObj->usItem, pObj->ItemData.Generic.bStatus[bLoop2] ) ) + pObj = FindRepairableItemInSpecificPocket(&( pSoldier->inv[ bSlotToCheck ] ), bLoop2); + if(pObj != 0) { - return( bSlotToCheck ); + return( pObj ); } - } - - // have to check for attachments... - for ( bLoop2 = 0; bLoop2 < MAX_ATTACHMENTS; bLoop2++ ) - { - if ( pObj->usAttachItem[ bLoop2 ] != NOTHING ) + //CHRISL: In NewInv, we should also repair items stored in LBENODE items + if(UsingNewInventorySystem() == true && Item[pSoldier->inv[ bSlotToCheck ].usItem].usItemClass == IC_LBEGEAR) { - if ( IsItemRepairable( pObj->usAttachItem[ bLoop2 ], pObj->bAttachStatus[ bLoop2 ] ) ) + pObj = FindRepairableItemInLBENODE( &pSoldier->inv[ bSlotToCheck ], bLoop2); + if(pObj != 0) { - return( bSlotToCheck ); - } + return( pObj ); + } } } } - return( NO_SLOT ); + return( 0 ); +} + +OBJECTTYPE* FindRepairableItemInLBENODE( OBJECTTYPE * pObj, UINT8 subObject) +{ + OBJECTTYPE * pObject; + + if(UsingNewInventorySystem() == false) + return( 0 ); + + if(pObj->IsActiveLBE(subObject) == true) + { + LBENODE* pLBE = pObj->GetLBEPointer(subObject); + for(UINT8 lbePocket = 0; lbePocket < pLBE->inv.size(); lbePocket++) + { + for(UINT8 ubItemsInPocket = 0; ubItemsInPocket < pLBE->inv[lbePocket].ubNumberOfObjects; ubItemsInPocket++) + { + pObject = FindRepairableItemInSpecificPocket(&pLBE->inv[lbePocket], ubItemsInPocket); + if(pObject != 0) + { + return( pObject ); + } + if(Item[pLBE->inv[lbePocket].usItem].usItemClass == IC_LBEGEAR) + { + pObject = FindRepairableItemInLBENODE(&pLBE->inv[lbePocket], ubItemsInPocket); + if(pObject != 0) + { + return( pObject ); + } + } + } + } + } + return( 0 ); +} + +OBJECTTYPE* FindRepairableItemInSpecificPocket( OBJECTTYPE * pObj, UINT8 subObject) +{ + if ( IsItemRepairable( pObj->usItem, (*pObj)[subObject]->data.objectStatus ) ) + { + return( pObj ); + } + + // have to check for attachments after... + for (attachmentList::iterator iter = (*pObj)[subObject]->attachments.begin(); iter != (*pObj)[subObject]->attachments.end(); ++iter) { + // if it's repairable and NEEDS repairing + if ( IsItemRepairable( iter->usItem, (*iter)[subObject]->data.objectStatus ) ) { + return( &(*iter) ); + } + } + + return( 0 ); } - -void DoActualRepair( SOLDIERTYPE * pSoldier, UINT16 usItem, INT8 * pbStatus, UINT8 * pubRepairPtsLeft ) +void DoActualRepair( SOLDIERTYPE * pSoldier, UINT16 usItem, INT16 * pbStatus, UINT8 * pubRepairPtsLeft ) { INT16 sRepairCostAdj; UINT16 usDamagePts, usPtsFixed; @@ -3065,7 +3116,7 @@ void DoActualRepair( SOLDIERTYPE * pSoldier, UINT16 usItem, INT8 * pbStatus, UIN BOOLEAN RepairObject( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOwner, OBJECTTYPE * pObj, UINT8 * pubRepairPtsLeft ) { - UINT8 ubLoop, ubItemsInPocket; + UINT8 ubLoop, ubItemsInPocket, lbeLoop; BOOLEAN fSomethingWasRepaired = FALSE; @@ -3074,16 +3125,14 @@ BOOLEAN RepairObject( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOwner, OBJECTTYPE * for ( ubLoop = 0; ubLoop < ubItemsInPocket; ubLoop++ ) { // if it's repairable and NEEDS repairing - if ( IsItemRepairable( pObj->usItem, pObj->ItemData.Generic.bStatus[ubLoop] ) ) + if ( IsItemRepairable( pObj->usItem, (*pObj)[ubLoop]->data.objectStatus ) ) { // repairable, try to repair it + DoActualRepair( pSoldier, pObj->usItem, &((*pObj)[ubLoop]->data.objectStatus), pubRepairPtsLeft ); - //void DoActualRepair( SOLDIERTYPE * pSoldier, UINT16 usItem, INT8 * pbStatus, UINT8 * pubRepairPtsLeft ) - DoActualRepair( pSoldier, pObj->usItem, &(pObj->ItemData.Generic.bStatus[ ubLoop ]), pubRepairPtsLeft ); + fSomethingWasRepaired = true; - fSomethingWasRepaired = TRUE; - - if ( pObj->ItemData.Generic.bStatus[ ubLoop ] == 100 ) + if ( (*pObj)[ubLoop]->data.objectStatus == 100 ) { // report it as fixed if ( pSoldier == pOwner ) @@ -3096,51 +3145,43 @@ BOOLEAN RepairObject( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOwner, OBJECTTYPE * ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 35 ], pSoldier->name, pOwner->name, ItemNames[ pObj->usItem ] ); } } - if ( *pubRepairPtsLeft == 0 ) { // we're out of points! - break; + return true; } - } - } - - // now check for attachments - for ( ubLoop = 0; ubLoop < MAX_ATTACHMENTS; ubLoop++ ) - { - if ( pObj->usAttachItem[ ubLoop ] != NOTHING ) - { - if ( IsItemRepairable( pObj->usAttachItem[ ubLoop ], pObj->bAttachStatus[ ubLoop ] ) ) - { - // repairable, try to repair it - - DoActualRepair( pSoldier, pObj->usAttachItem[ ubLoop ], &(pObj->bAttachStatus[ ubLoop ]), pubRepairPtsLeft ); - - fSomethingWasRepaired = TRUE; - - if ( pObj->bAttachStatus[ ubLoop ] == 100 ) - { - // report it as fixed - if ( pSoldier == pOwner ) - { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[ STR_REPAIRED ], pSoldier->name, ItemNames[ pObj->usAttachItem[ ubLoop ] ] ); - } - else - { - // NOTE: may need to be changed for localized versions - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 35 ], pSoldier->name, pOwner->name, ItemNames[ pObj->usAttachItem[ ubLoop ] ] ); - } - } + } + // now check for attachments after + for (attachmentList::iterator iter = (*pObj)[ubLoop]->attachments.begin(); iter != (*pObj)[ubLoop]->attachments.end(); ++iter) { + if (RepairObject(pSoldier, pOwner, &(*iter), pubRepairPtsLeft)) { + fSomethingWasRepaired = true; if ( *pubRepairPtsLeft == 0 ) { // we're out of points! - break; + return true; } - } + } + } + //CHRISL: Now check and see if this is an LBENODE with items that need repairing + if(UsingNewInventorySystem() == true && Item[pObj->usItem].usItemClass == IC_LBEGEAR && pObj->IsActiveLBE(ubLoop) == true) + { + LBENODE* pLBE = pObj->GetLBEPointer(ubLoop); + for(lbeLoop = 0; lbeLoop < pLBE->inv.size(); lbeLoop++) + { + if(RepairObject(pSoldier, pOwner, &pLBE->inv[lbeLoop], pubRepairPtsLeft)) + { + fSomethingWasRepaired = true; + if ( *pubRepairPtsLeft == 0 ) + { + // we're out of points! + return true; + } + } + } } } - + return( fSomethingWasRepaired ); } @@ -3149,8 +3190,6 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier ) { UINT16 usMax=0; UINT8 ubRepairPtsLeft =0; - UINT8 ubItemsInPocket = 0; - UINT8 ubObjectInPocketCounter = 0; UINT8 ubInitialRepairPts = 0; UINT8 ubRepairPtsUsed = 0; INT8 bPocket =0; @@ -3161,18 +3200,18 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier ) // grab max number of repair pts open to this soldier - ubRepairPtsLeft = CalculateRepairPointsForRepairman( pSoldier, &usMax, TRUE ); + ubRepairPtsLeft = CalculateRepairPointsForRepairman( pSoldier, &usMax, TRUE ); // no points - if ( ubRepairPtsLeft == 0 ) + if ( ubRepairPtsLeft == 0 ) { AssignmentDone( pSoldier, TRUE, TRUE ); - return; + return; } // remember what we've started off with ubInitialRepairPts = ubRepairPtsLeft; - + // check if we are repairing a vehicle if ( pSoldier->bVehicleUnderRepairID != -1 ) { @@ -3181,9 +3220,9 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier ) // attempt to fix vehicle ubRepairPtsLeft -= RepairVehicle( pSoldier->bVehicleUnderRepairID, ubRepairPtsLeft, &fNothingLeftToRepair ); } - } + } // check if we are repairing a robot - else if( pSoldier->fFixingRobot ) + else if( pSoldier->flags.fFixingRobot ) { if ( CanCharacterRepairRobot( pSoldier ) ) { @@ -3211,17 +3250,24 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier ) if ( bLoop == 0 ) { bLoopStart = SECONDHANDPOS; - bLoopEnd = SMALLPOCK8POS; + // CHRISL: Changed to dynamically determine max inventory locations. + bLoopEnd = (NUM_INV_SLOTS - 1); } else { bLoopStart = HELMETPOS; - bLoopEnd = HEAD2POS; + bLoopEnd = UsingNewInventorySystem() == false ? HEAD2POS : BPACKPOCKPOS; } // now repair objects running from left hand to small pocket for( bPocket = bLoopStart; bPocket <= bLoopEnd; bPocket++ ) { + //CHRISL: These two conditions allow us to repair LBE pocket items at the same time as worn armor, while + // still letting us repair the item in our offhand first. + if(UsingNewInventorySystem() == true && bLoop == 0 && bPocket>SECONDHANDPOS && bPocketinv[ bPocket ]); if ( RepairObject( pSoldier, pSoldier, pObj, &ubRepairPtsLeft ) ) @@ -3250,18 +3296,18 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier ) } // what are the total amount of pts used by character? - ubRepairPtsUsed = ubInitialRepairPts - ubRepairPtsLeft; + ubRepairPtsUsed = ubInitialRepairPts - ubRepairPtsLeft; if( ubRepairPtsUsed > 0 ) { // improve stats StatChange( pSoldier, MECHANAMT, ( UINT16 ) (ubRepairPtsUsed / 2), FALSE ); - StatChange( pSoldier, DEXTAMT, ( UINT16 ) (ubRepairPtsUsed / 2), FALSE ); + StatChange( pSoldier, DEXTAMT, ( UINT16 ) (ubRepairPtsUsed / 2), FALSE ); // check if kit damaged/depleted if( ( Random( 100 ) ) < (UINT32) (ubRepairPtsUsed * 5) ) // CJC: added a x5 as this wasn't going down anywhere fast enough { // kit item damaged/depleted, burn up points of toolkit..which is in right hand - UseKitPoints( &( pSoldier -> inv[ HANDPOS ] ), 1, pSoldier ); + UseKitPoints( &( pSoldier->inv[ HANDPOS ] ), 1, pSoldier ); } } @@ -3296,11 +3342,11 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier ) -BOOLEAN IsItemRepairable( UINT16 usItem, INT8 bStatus ) +BOOLEAN IsItemRepairable( UINT16 usItem, INT16 bStatus ) { // check to see if item can/needs to be repaired // if ( ( bStatus < 100) && ( Item[ usItem ].fFlags & ITEM_REPAIRABLE ) ) - if ( ( bStatus < 100) && ( Item[ usItem ].repairable ) ) + if ( ( bStatus < 100) && ( Item[ usItem ].repairable ) ) { // yep return ( TRUE ); @@ -3315,16 +3361,16 @@ void HandleRestAndFatigueInSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) { // this will handle all sleeping characters in this sector SOLDIERTYPE *pSoldier, *pTeamSoldier; - INT32 cnt=0; + INT32 cnt=0; + + pSoldier = MercPtrs[0]; - pSoldier = MercPtrs[0]; - // go through list of characters, find all sleepers in sector - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier -> bTeam ].bLastID; cnt++,pTeamSoldier++) + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) { - if( ( pTeamSoldier -> bActive ) && ( pSoldier -> bAssignment != ASSIGNMENT_POW ) ) + if( ( pTeamSoldier->bActive ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) ) { - if( ( pTeamSoldier -> sSectorX == sMapX ) && ( pTeamSoldier -> sSectorY == sMapY ) && ( pTeamSoldier -> bSectorZ == bMapZ ) ) + if( ( pTeamSoldier->sSectorX == sMapX ) && ( pTeamSoldier->sSectorY == sMapY ) && ( pTeamSoldier->bSectorZ == bMapZ ) ) { } } @@ -3341,10 +3387,10 @@ INT8 GetRegainDueToSleepNeeded( SOLDIERTYPE *pSoldier, INT32 iRateOfReGain ) UINT8 ubNeedForSleep = 0; // get profile id and then grab sleep need value - ubNeedForSleep = gMercProfiles[ pSoldier -> ubProfile ].ubNeedForSleep; - + ubNeedForSleep = gMercProfiles[ pSoldier->ubProfile ].ubNeedForSleep; + bRate = ( AVG_NUMBER_OF_HOURS_OF_SLEEP_NEEDED - ( INT8 )ubNeedForSleep ); - + if( bRate >= iRateOfReGain ) { bRate = ( - iRateOfReGain ) + 1; @@ -3363,30 +3409,30 @@ void RestCharacter( SOLDIERTYPE *pSoldier ) bMaxBreathRegain = 50 / CalcSoldierNeedForSleep( pSoldier ); // if breath max is below the "really tired" threshold - if( pSoldier -> bBreathMax < BREATHMAX_PRETTY_TIRED ) + if( pSoldier->bBreathMax < BREATHMAX_PRETTY_TIRED ) { // real tired, rest rate is 50% higher (this is to prevent absurdly long sleep times for totally exhausted mercs) bMaxBreathRegain = ( bMaxBreathRegain * 3 / 2 ); } - pSoldier -> bBreathMax += bMaxBreathRegain; + pSoldier->bBreathMax += bMaxBreathRegain; - if( pSoldier -> bBreathMax > 100 ) + if( pSoldier->bBreathMax > 100 ) { - pSoldier -> bBreathMax = 100; + pSoldier->bBreathMax = 100; } - else if( pSoldier -> bBreathMax < BREATHMAX_ABSOLUTE_MINIMUM ) + else if( pSoldier->bBreathMax < BREATHMAX_ABSOLUTE_MINIMUM ) { - pSoldier -> bBreathMax = BREATHMAX_ABSOLUTE_MINIMUM; + pSoldier->bBreathMax = BREATHMAX_ABSOLUTE_MINIMUM; } - pSoldier -> bBreath = pSoldier -> bBreathMax; + pSoldier->bBreath = pSoldier->bBreathMax; - if ( pSoldier-> bBreathMax >= BREATHMAX_CANCEL_TIRED ) + if ( pSoldier->bBreathMax >= BREATHMAX_CANCEL_TIRED ) { - pSoldier->fComplainedThatTired = FALSE; + pSoldier->flags.fComplainedThatTired = FALSE; } return; @@ -3400,9 +3446,9 @@ void FatigueCharacter( SOLDIERTYPE *pSoldier ) INT32 iBreathLoss; INT8 bMaxBreathLoss = 0, bDivisor = 1; - + // vehicle or robot? - if( ( pSoldier -> uiStatusFlags & SOLDIER_VEHICLE ) || AM_A_ROBOT( pSoldier ) ) + if( ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) || AM_A_ROBOT( pSoldier ) ) { return; } @@ -3414,7 +3460,7 @@ void FatigueCharacter( SOLDIERTYPE *pSoldier ) } // POW? - if( pSoldier -> bAssignment == ASSIGNMENT_POW ) + if( pSoldier->bAssignment == ASSIGNMENT_POW ) { return; } @@ -3428,10 +3474,10 @@ void FatigueCharacter( SOLDIERTYPE *pSoldier ) bMaxBreathLoss = 2; } - //KM: Added encumbrance calculation to soldiers moving on foot. Anything above 100% will increase - // rate of fatigue. 200% encumbrance will cause soldiers to tire twice as quickly. - if( pSoldier->fBetweenSectors && pSoldier->bAssignment != VEHICLE ) - { //Soldier is on foot and travelling. Factor encumbrance into fatigue rate. + //KM: Added encumbrance calculation to soldiers moving on foot. Anything above 100% will increase + // rate of fatigue. 200% encumbrance will cause soldiers to tire twice as quickly. + if( pSoldier->flags.fBetweenSectors && pSoldier->bAssignment != VEHICLE ) + { //Soldier is on foot and travelling. Factor encumbrance into fatigue rate. iPercentEncumbrance = CalculateCarriedWeight( pSoldier ); if( iPercentEncumbrance > 100 ) { @@ -3441,28 +3487,28 @@ void FatigueCharacter( SOLDIERTYPE *pSoldier ) } // if breath max is below the "really tired" threshold - if( pSoldier -> bBreathMax < BREATHMAX_PRETTY_TIRED ) + if( pSoldier->bBreathMax < BREATHMAX_PRETTY_TIRED ) { // real tired, fatigue rate is 50% higher bMaxBreathLoss = ( bMaxBreathLoss * 3 / 2 ); } - pSoldier -> bBreathMax -= bMaxBreathLoss; + pSoldier->bBreathMax -= bMaxBreathLoss; - if( pSoldier -> bBreathMax > 100 ) + if( pSoldier->bBreathMax > 100 ) { - pSoldier -> bBreathMax = 100; + pSoldier->bBreathMax = 100; } - else if( pSoldier -> bBreathMax < BREATHMAX_ABSOLUTE_MINIMUM ) + else if( pSoldier->bBreathMax < BREATHMAX_ABSOLUTE_MINIMUM ) { - pSoldier -> bBreathMax = BREATHMAX_ABSOLUTE_MINIMUM; + pSoldier->bBreathMax = BREATHMAX_ABSOLUTE_MINIMUM; } - + // current breath can't exceed maximum - if( pSoldier -> bBreath > pSoldier -> bBreathMax ) + if( pSoldier->bBreath > pSoldier->bBreathMax ) { - pSoldier -> bBreath = pSoldier -> bBreathMax; + pSoldier->bBreath = pSoldier->bBreathMax; } return; @@ -3476,7 +3522,7 @@ void HandleTrainingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ ) SOLDIERTYPE *pStudent; UINT8 ubStat; BOOLEAN fAtGunRange = FALSE; - UINT32 uiCnt=0; + UINT32 uiCnt=0; INT16 sTotalTrainingPts = 0; INT16 sTrainingPtsDueToInstructor = 0; SOLDIERTYPE *pStatTrainerList[ NUM_TRAINABLE_STATS ]; // can't have more "best" trainers than trainable stats @@ -3501,7 +3547,7 @@ void HandleTrainingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ ) // if sector not under our control, has enemies in it, or is currently in combat mode if (!SectorOursAndPeaceful( sMapX, sMapY, bZ )) { - // then training is canceled for this hour. + // then training is canceled for this hour. // This is partly logical, but largely to prevent newly trained militia from appearing in mid-battle return; } @@ -3517,7 +3563,7 @@ void HandleTrainingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ ) // build list of teammate trainers in this sector. - // Only the trainer with the HIGHEST training ability in each stat is effective. This is mainly to avoid having to + // Only the trainer with the HIGHEST training ability in each stat is effective. This is mainly to avoid having to // sort them from highest to lowest if some form of trainer degradation formula was to be used for multiple trainers. // for each trainable stat @@ -3526,12 +3572,12 @@ void HandleTrainingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ ) sBestTrainingPts = -1; // search team for active instructors in this sector - for ( uiCnt = 0, pTrainer = MercPtrs[ uiCnt ]; uiCnt <= gTacticalStatus.Team[ MercPtrs[0] -> bTeam ].bLastID; uiCnt++, pTrainer++) + for ( uiCnt = 0, pTrainer = MercPtrs[ uiCnt ]; uiCnt <= gTacticalStatus.Team[ MercPtrs[0]->bTeam ].bLastID; uiCnt++, pTrainer++) { - if( pTrainer -> bActive && ( pTrainer -> sSectorX == sMapX ) && ( pTrainer -> sSectorY == sMapY ) && ( pTrainer -> bSectorZ == bZ) ) + if( pTrainer->bActive && ( pTrainer->sSectorX == sMapX ) && ( pTrainer->sSectorY == sMapY ) && ( pTrainer->bSectorZ == bZ) ) { // if he's training teammates in this stat - if( ( pTrainer -> bAssignment == TRAIN_TEAMMATE ) && ( pTrainer -> bTrainStat == ubStat) && ( EnoughTimeOnAssignment( pTrainer ) ) && ( pTrainer->fMercAsleep == FALSE ) ) + if( ( pTrainer->bAssignment == TRAIN_TEAMMATE ) && ( pTrainer->bTrainStat == ubStat) && ( EnoughTimeOnAssignment( pTrainer ) ) && ( pTrainer->flags.fMercAsleep == FALSE ) ) { sTrainingPtsDueToInstructor = GetBonusTrainingPtsDueToInstructor( pTrainer, NULL, ubStat, fAtGunRange, &usMaxPts ); @@ -3549,38 +3595,38 @@ void HandleTrainingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ ) // now search team for active self-trainers in this sector - for ( uiCnt = 0, pStudent = MercPtrs[ uiCnt ]; uiCnt <= gTacticalStatus.Team[ MercPtrs[0] -> bTeam ].bLastID; uiCnt++, pStudent++) + for ( uiCnt = 0, pStudent = MercPtrs[ uiCnt ]; uiCnt <= gTacticalStatus.Team[ MercPtrs[0]->bTeam ].bLastID; uiCnt++, pStudent++) { // see if this merc is active and in the same sector - if( ( pStudent -> bActive) && ( pStudent -> sSectorX == sMapX ) && ( pStudent -> sSectorY == sMapY ) && ( pStudent -> bSectorZ == bZ ) ) + if( ( pStudent->bActive) && ( pStudent->sSectorX == sMapX ) && ( pStudent->sSectorY == sMapY ) && ( pStudent->bSectorZ == bZ ) ) { // if he's training himself (alone, or by others), then he's a student - if ( ( pStudent -> bAssignment == TRAIN_SELF ) || ( pStudent -> bAssignment == TRAIN_BY_OTHER ) ) + if ( ( pStudent->bAssignment == TRAIN_SELF ) || ( pStudent->bAssignment == TRAIN_BY_OTHER ) ) { - if ( EnoughTimeOnAssignment( pStudent ) && ( pStudent->fMercAsleep == FALSE ) ) + if ( EnoughTimeOnAssignment( pStudent ) && ( pStudent->flags.fMercAsleep == FALSE ) ) { // figure out how much the grunt can learn in one training period - sTotalTrainingPts = GetSoldierTrainingPts( pStudent, pStudent -> bTrainStat, fAtGunRange, &usMaxPts ); + sTotalTrainingPts = GetSoldierTrainingPts( pStudent, pStudent->bTrainStat, fAtGunRange, &usMaxPts ); // if he's getting help - if ( pStudent -> bAssignment == TRAIN_BY_OTHER ) + if ( pStudent->bAssignment == TRAIN_BY_OTHER ) { // grab the pointer to the (potential) trainer for this stat - pTrainer = pStatTrainerList[ pStudent -> bTrainStat ]; + pTrainer = pStatTrainerList[ pStudent->bTrainStat ]; // if this stat HAS a trainer in sector at all if (pTrainer != NULL) { -/* Assignment distance limits removed. Sep/11/98. ARM +/* Assignment distance limits removed. Sep/11/98. ARM // if this sector either ISN'T currently loaded, or it is but the trainer is close enough to the student - if ( ( sMapX != gWorldSectorX ) || ( sMapY != gWorldSectorY ) || ( pStudent -> bSectorZ != gbWorldSectorZ ) || - ( PythSpacesAway( pStudent -> sGridNo, pTrainer -> sGridNo ) < MAX_DISTANCE_FOR_TRAINING ) && ( EnoughTimeOnAssignment( pTrainer ) ) ) + if ( ( sMapX != gWorldSectorX ) || ( sMapY != gWorldSectorY ) || ( pStudent->bSectorZ != gbWorldSectorZ ) || + ( PythSpacesAway( pStudent->sGridNo, pTrainer->sGridNo ) < MAX_DISTANCE_FOR_TRAINING ) && ( EnoughTimeOnAssignment( pTrainer ) ) ) */ // NB this EnoughTimeOnAssignment() call is redundent since it is called up above //if ( EnoughTimeOnAssignment( pTrainer ) ) { // valid trainer is available, this gives the student a large training bonus! - sTrainingPtsDueToInstructor = GetBonusTrainingPtsDueToInstructor( pTrainer, pStudent, pStudent -> bTrainStat, fAtGunRange, &usMaxPts ); + sTrainingPtsDueToInstructor = GetBonusTrainingPtsDueToInstructor( pTrainer, pStudent, pStudent->bTrainStat, fAtGunRange, &usMaxPts ); StatChange(pTrainer,LDRAMT,sTrainingPtsDueToInstructor,FALSE); StatChange(pTrainer,WISDOMAMT,sTrainingPtsDueToInstructor,FALSE); @@ -3607,11 +3653,11 @@ void HandleTrainingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ ) ubTownTrainers = 0; // build list of all the town trainers in this sector and their training pts - for ( uiCnt = 0, pTrainer = MercPtrs[ uiCnt ]; uiCnt <= gTacticalStatus.Team[ MercPtrs[0] -> bTeam ].bLastID; uiCnt++,pTrainer++) + for ( uiCnt = 0, pTrainer = MercPtrs[ uiCnt ]; uiCnt <= gTacticalStatus.Team[ MercPtrs[0]->bTeam ].bLastID; uiCnt++,pTrainer++) { - if( pTrainer -> bActive && ( pTrainer -> sSectorX == sMapX ) && ( pTrainer -> sSectorY == sMapY ) && ( pTrainer -> bSectorZ == bZ ) ) + if( pTrainer->bActive && ( pTrainer->sSectorX == sMapX ) && ( pTrainer->sSectorY == sMapY ) && ( pTrainer->bSectorZ == bZ ) ) { - if( ( pTrainer -> bAssignment == TRAIN_TOWN ) && ( EnoughTimeOnAssignment( pTrainer ) ) && ( pTrainer->fMercAsleep == FALSE ) ) + if( ( pTrainer->bAssignment == TRAIN_TOWN ) && ( EnoughTimeOnAssignment( pTrainer ) ) && ( pTrainer->flags.fMercAsleep == FALSE ) ) { sTownTrainingPts = GetTownTrainPtsForCharacter( pTrainer, &usMaxPts ); @@ -3646,7 +3692,7 @@ void HandleTrainingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ ) if (sTownTrainingPts > 0) { fTrainingCompleted = TrainTownInSector( TownTrainer[ uiCnt ].pSoldier, sMapX, sMapY, sTownTrainingPts ); - + if ( fTrainingCompleted ) { // there's no carryover into next session for extra training (cause player might cancel), so break out of loop @@ -3660,19 +3706,19 @@ void HandleTrainingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ ) int TownTrainerQsortCompare(const void *pArg1, const void *pArg2) { - if (((TOWN_TRAINER_TYPE *)pArg1) -> sTrainingPts > ((TOWN_TRAINER_TYPE *)pArg2) -> sTrainingPts) - { - return(-1); - } - else - if (((TOWN_TRAINER_TYPE *)pArg1) -> sTrainingPts < ((TOWN_TRAINER_TYPE *)pArg2) -> sTrainingPts) - { - return(1); - } - else - { - return(0); - } + if (((TOWN_TRAINER_TYPE *)pArg1)->sTrainingPts > ((TOWN_TRAINER_TYPE *)pArg2)->sTrainingPts) + { + return(-1); + } + else + if (((TOWN_TRAINER_TYPE *)pArg1)->sTrainingPts < ((TOWN_TRAINER_TYPE *)pArg2)->sTrainingPts) + { + return(1); + } + else + { + return(0); + } } @@ -3702,39 +3748,39 @@ INT16 GetBonusTrainingPtsDueToInstructor( SOLDIERTYPE *pInstructor, SOLDIERTYPE { case( STRENGTH ): bTrainerEffSkill = EffectiveStrength ( pInstructor ); - bTrainerNatSkill = pInstructor->bStrength; + bTrainerNatSkill = pInstructor->stats.bStrength; break; case( DEXTERITY ): bTrainerEffSkill = EffectiveDexterity ( pInstructor ); - bTrainerNatSkill = pInstructor->bDexterity; + bTrainerNatSkill = pInstructor->stats.bDexterity; break; case( AGILITY ): bTrainerEffSkill = EffectiveAgility( pInstructor ); - bTrainerNatSkill = pInstructor->bAgility; + bTrainerNatSkill = pInstructor->stats.bAgility; break; case( HEALTH ): - bTrainerEffSkill = pInstructor -> bLifeMax; - bTrainerNatSkill = pInstructor->bLifeMax; + bTrainerEffSkill = pInstructor->stats.bLifeMax; + bTrainerNatSkill = pInstructor->stats.bLifeMax; break; case( LEADERSHIP ): bTrainerEffSkill = EffectiveLeadership( pInstructor ); - bTrainerNatSkill = pInstructor->bLeadership; + bTrainerNatSkill = pInstructor->stats.bLeadership; break; case( MARKSMANSHIP ): bTrainerEffSkill = EffectiveMarksmanship( pInstructor ); - bTrainerNatSkill = pInstructor->bMarksmanship; + bTrainerNatSkill = pInstructor->stats.bMarksmanship; break; case( EXPLOSIVE_ASSIGN ): bTrainerEffSkill = EffectiveExplosive( pInstructor ); - bTrainerNatSkill = pInstructor->bExplosive; + bTrainerNatSkill = pInstructor->stats.bExplosive; break; case( MEDICAL ): bTrainerEffSkill = EffectiveMedical( pInstructor ); - bTrainerNatSkill = pInstructor->bMedical; + bTrainerNatSkill = pInstructor->stats.bMedical; break; case( MECHANICAL ): bTrainerEffSkill = EffectiveMechanical( pInstructor ); - bTrainerNatSkill = pInstructor->bMechanical; + bTrainerNatSkill = pInstructor->stats.bMechanical; break; // NOTE: Wisdom can't be trained! default: @@ -3750,46 +3796,46 @@ INT16 GetBonusTrainingPtsDueToInstructor( SOLDIERTYPE *pInstructor, SOLDIERTYPE if( pStudent == NULL ) { // assume these default values - bTraineeEffWisdom = 100; - bTraineeNatWisdom = 100; - bTraineeSkill = 0; + bTraineeEffWisdom = 100; + bTraineeNatWisdom = 100; + bTraineeSkill = 0; bOpinionFactor = 0; } else { // set student's variables bTraineeEffWisdom = EffectiveWisdom ( pStudent ); - bTraineeNatWisdom = pStudent->bWisdom; - + bTraineeNatWisdom = pStudent->stats.bWisdom; + // for trainee's stat skill, must use the natural value, not the effective one, to avoid drunks training beyond cap switch( bTrainStat ) { case( STRENGTH ): - bTraineeSkill = pStudent -> bStrength; + bTraineeSkill = pStudent->stats.bStrength; break; case( DEXTERITY ): - bTraineeSkill = pStudent -> bDexterity; + bTraineeSkill = pStudent->stats.bDexterity; break; case( AGILITY ): - bTraineeSkill = pStudent -> bAgility; + bTraineeSkill = pStudent->stats.bAgility; break; case( HEALTH ): - bTraineeSkill = pStudent -> bLifeMax; + bTraineeSkill = pStudent->stats.bLifeMax; break; case( LEADERSHIP ): - bTraineeSkill = pStudent -> bLeadership; + bTraineeSkill = pStudent->stats.bLeadership; break; case( MARKSMANSHIP ): - bTraineeSkill = pStudent -> bMarksmanship; + bTraineeSkill = pStudent->stats.bMarksmanship; break; case( EXPLOSIVE_ASSIGN ): - bTraineeSkill = pStudent -> bExplosive; + bTraineeSkill = pStudent->stats.bExplosive; break; case( MEDICAL ): - bTraineeSkill = pStudent -> bMedical; + bTraineeSkill = pStudent->stats.bMedical; break; case( MECHANICAL ): - bTraineeSkill = pStudent -> bMechanical; + bTraineeSkill = pStudent->stats.bMechanical; break; // NOTE: Wisdom can't be trained! default: @@ -3809,8 +3855,8 @@ INT16 GetBonusTrainingPtsDueToInstructor( SOLDIERTYPE *pInstructor, SOLDIERTYPE } // factor in their mutual relationship - bOpinionFactor = gMercProfiles[ pStudent->ubProfile ].bMercOpinion[ pInstructor->ubProfile ]; - bOpinionFactor += gMercProfiles[ pInstructor->ubProfile ].bMercOpinion[ pStudent->ubProfile ] / 2; + bOpinionFactor = gMercProfiles[ pStudent->ubProfile ].bMercOpinion[ pInstructor->ubProfile ]; + bOpinionFactor += gMercProfiles[ pInstructor->ubProfile ].bMercOpinion[ pStudent->ubProfile ] / 2; } @@ -3825,7 +3871,7 @@ INT16 GetBonusTrainingPtsDueToInstructor( SOLDIERTYPE *pInstructor, SOLDIERTYPE sTrainingPts = ( bTrainerEffSkill - bTraineeSkill ) * ( bTraineeEffWisdom + ( EffectiveWisdom( pInstructor ) + EffectiveLeadership( pInstructor ) ) / 2 ) / gGameExternalOptions.ubInstructedTrainingDivisor; // calculate normal training pts - what it would be if his stats were "normal" (ignoring drugs, fatigue) - *pusMaxPts = ( bTrainerNatSkill - bTraineeSkill ) * ( bTraineeNatWisdom + ( pInstructor->bWisdom + pInstructor->bLeadership ) / 2 ) / gGameExternalOptions.ubInstructedTrainingDivisor; + *pusMaxPts = ( bTrainerNatSkill - bTraineeSkill ) * ( bTraineeNatWisdom + ( pInstructor->stats.bWisdom + pInstructor->stats.bLeadership ) / 2 ) / gGameExternalOptions.ubInstructedTrainingDivisor; // put in a minimum (that can be reduced due to instructor being tired?) if (*pusMaxPts == 0) @@ -3839,11 +3885,11 @@ INT16 GetBonusTrainingPtsDueToInstructor( SOLDIERTYPE *pInstructor, SOLDIERTYPE } // check for teaching skill bonuses - if( gMercProfiles[ pInstructor -> ubProfile ].bSkillTrait == TEACHING ) + if( gMercProfiles[ pInstructor->ubProfile ].bSkillTrait == TEACHING ) { bTrainingBonus += gGameExternalOptions.ubTeachBonusToTrain; } - if( gMercProfiles[ pInstructor -> ubProfile ].bSkillTrait2 == TEACHING ) + if( gMercProfiles[ pInstructor->ubProfile ].bSkillTrait2 == TEACHING ) { bTrainingBonus += gGameExternalOptions.ubTeachBonusToTrain; } @@ -3880,31 +3926,31 @@ INT16 GetSoldierTrainingPts( SOLDIERTYPE *pSoldier, INT8 bTrainStat, BOOLEAN fAt switch( bTrainStat ) { case( STRENGTH ): - bSkill = pSoldier -> bStrength; + bSkill = pSoldier->stats.bStrength; break; case( DEXTERITY ): - bSkill = pSoldier -> bDexterity; + bSkill = pSoldier->stats.bDexterity; break; case( AGILITY ): - bSkill = pSoldier -> bAgility; + bSkill = pSoldier->stats.bAgility; break; case( HEALTH ): - bSkill = pSoldier -> bLifeMax; + bSkill = pSoldier->stats.bLifeMax; break; case( LEADERSHIP ): - bSkill = pSoldier -> bLeadership; + bSkill = pSoldier->stats.bLeadership; break; case( MARKSMANSHIP ): - bSkill = pSoldier -> bMarksmanship; + bSkill = pSoldier->stats.bMarksmanship; break; case( EXPLOSIVE_ASSIGN ): - bSkill = pSoldier -> bExplosive; + bSkill = pSoldier->stats.bExplosive; break; case( MEDICAL ): - bSkill = pSoldier -> bMedical; + bSkill = pSoldier->stats.bMedical; break; case( MECHANICAL ): - bSkill = pSoldier -> bMechanical; + bSkill = pSoldier->stats.bMechanical; break; // NOTE: Wisdom can't be trained! default: @@ -3923,7 +3969,7 @@ INT16 GetSoldierTrainingPts( SOLDIERTYPE *pSoldier, INT8 bTrainStat, BOOLEAN fAt // calculate normal training pts - what it would be if his stats were "normal" (ignoring drugs, fatigue) - *pusMaxPts = __max( ( ( pSoldier->bWisdom * ( gGameExternalOptions.ubTrainingSkillMax - bSkill ) ) / gGameExternalOptions.ubSelfTrainingDivisor ), 1 ); + *pusMaxPts = __max( ( ( pSoldier->stats.bWisdom * ( gGameExternalOptions.ubTrainingSkillMax - bSkill ) ) / gGameExternalOptions.ubSelfTrainingDivisor ), 1 ); // calculate effective training pts sTrainingPts = __max( ( ( EffectiveWisdom( pSoldier ) * ( gGameExternalOptions.ubTrainingSkillMax - bSkill ) ) / gGameExternalOptions.ubSelfTrainingDivisor ), 1 ); @@ -3961,39 +4007,39 @@ INT16 GetSoldierStudentPts( SOLDIERTYPE *pSoldier, INT8 bTrainStat, BOOLEAN fAtG switch( bTrainStat ) { case( STRENGTH ): - bSkill = pSoldier -> bStrength; + bSkill = pSoldier->stats.bStrength; break; case( DEXTERITY ): - bSkill = pSoldier -> bDexterity; + bSkill = pSoldier->stats.bDexterity; break; case( AGILITY ): - bSkill = pSoldier -> bAgility; + bSkill = pSoldier->stats.bAgility; break; case( HEALTH ): - bSkill = pSoldier -> bLifeMax; + bSkill = pSoldier->stats.bLifeMax; break; case( LEADERSHIP ): - bSkill = pSoldier -> bLeadership; + bSkill = pSoldier->stats.bLeadership; break; case( MARKSMANSHIP ): - bSkill = pSoldier -> bMarksmanship; + bSkill = pSoldier->stats.bMarksmanship; break; case( EXPLOSIVE_ASSIGN ): - bSkill = pSoldier -> bExplosive; + bSkill = pSoldier->stats.bExplosive; break; case( MEDICAL ): - bSkill = pSoldier -> bMedical; + bSkill = pSoldier->stats.bMedical; break; case( MECHANICAL ): - bSkill = pSoldier -> bMechanical; + bSkill = pSoldier->stats.bMechanical; break; // NOTE: Wisdom can't be trained! default: // BETA message #ifdef JA2BETAVERSION - ScreenMsg( FONT_ORANGE, MSG_BETAVERSION, L"GetSoldierTrainingPts: ERROR - Unknown bTrainStat %d", bTrainStat); + ScreenMsg( FONT_ORANGE, MSG_BETAVERSION, L"GetSoldierTrainingPts: ERROR - Unknown bTrainStat %d", bTrainStat); #endif - return(0); + return(0); } // if skill 0 or at/beyond the training cap, can't train @@ -4004,7 +4050,7 @@ INT16 GetSoldierStudentPts( SOLDIERTYPE *pSoldier, INT8 bTrainStat, BOOLEAN fAtG // calculate normal training pts - what it would be if his stats were "normal" (ignoring drugs, fatigue) - *pusMaxPts = __max( ( ( pSoldier->bWisdom * ( gGameExternalOptions.ubTrainingSkillMax - bSkill ) ) / gGameExternalOptions.ubSelfTrainingDivisor ), 1 ); + *pusMaxPts = __max( ( ( pSoldier->stats.bWisdom * ( gGameExternalOptions.ubTrainingSkillMax - bSkill ) ) / gGameExternalOptions.ubSelfTrainingDivisor ), 1 ); // calculate effective training pts sTrainingPts = __max( ( ( EffectiveWisdom( pSoldier ) * ( gGameExternalOptions.ubTrainingSkillMax - bSkill ) ) / gGameExternalOptions.ubSelfTrainingDivisor ), 1 ); @@ -4028,13 +4074,13 @@ INT16 GetSoldierStudentPts( SOLDIERTYPE *pSoldier, INT8 bTrainStat, BOOLEAN fAtG sBestTrainingPts = -1; // search team for active instructors in this sector - for ( uiCnt = 0, pTrainer = MercPtrs[ uiCnt ]; uiCnt <= gTacticalStatus.Team[ MercPtrs[0] -> bTeam ].bLastID; uiCnt++, pTrainer++) + for ( uiCnt = 0, pTrainer = MercPtrs[ uiCnt ]; uiCnt <= gTacticalStatus.Team[ MercPtrs[0]->bTeam ].bLastID; uiCnt++, pTrainer++) { if( pTrainer->bActive && ( pTrainer->sSectorX == pSoldier->sSectorX ) && ( pTrainer->sSectorY == pSoldier->sSectorY ) && ( pTrainer->bSectorZ == pSoldier->bSectorZ) ) { // if he's training teammates in this stat // NB skip the EnoughTime requirement to display what the value should be even if haven't been training long yet... - if ( ( pTrainer->bAssignment == TRAIN_TEAMMATE ) && ( pTrainer->bTrainStat == bTrainStat) && ( pTrainer->fMercAsleep == FALSE ) ) + if ( ( pTrainer->bAssignment == TRAIN_TEAMMATE ) && ( pTrainer->bTrainStat == bTrainStat) && ( pTrainer->flags.fMercAsleep == FALSE ) ) { sTrainingPtsDueToInstructor = GetBonusTrainingPtsDueToInstructor( pTrainer, pSoldier, bTrainStat, fAtGunRange, &usMaxTrainerPts ); @@ -4069,10 +4115,10 @@ void TrainSoldierWithPts( SOLDIERTYPE *pSoldier, INT16 sTrainPts ) { return; } - + BOOLEAN addWis = FALSE; - // which stat to modify? - switch( pSoldier -> bTrainStat ) + // which stat to modify? + switch( pSoldier->bTrainStat ) { case( STRENGTH ): ubChangeStat = STRAMT; @@ -4110,14 +4156,14 @@ void TrainSoldierWithPts( SOLDIERTYPE *pSoldier, INT16 sTrainPts ) default: // BETA message #ifdef JA2BETAVERSION - ScreenMsg( FONT_ORANGE, MSG_BETAVERSION, L"TrainSoldierWithPts: ERROR - Unknown bTrainStat %d", pSoldier -> bTrainStat); + ScreenMsg( FONT_ORANGE, MSG_BETAVERSION, L"TrainSoldierWithPts: ERROR - Unknown bTrainStat %d", pSoldier->bTrainStat); #endif - return; + return; } // give this merc a few chances to increase a stat (TRUE means it's training, reverse evolution doesn't apply) StatChange( pSoldier, ubChangeStat, sTrainPts, FROM_TRAINING ); - if (addWis) + if (addWis) StatChange( pSoldier, WISDOMAMT, sTrainPts/2, FROM_TRAINING ); } @@ -4128,8 +4174,6 @@ BOOLEAN TrainTownInSector( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMapY, INT1 { SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); UINT8 ubTownId = 0; - INT16 sCnt = 0; - INT8 bChance = 0; BOOLEAN fSamSiteInSector = FALSE; @@ -4137,36 +4181,36 @@ BOOLEAN TrainTownInSector( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMapY, INT1 fSamSiteInSector = IsThisSectorASAMSector( sMapX, sMapY, 0 ); // get town index - ubTownId = StrategicMap[ pTrainer -> sSectorX + pTrainer -> sSectorY * MAP_WORLD_X ].bNameId; + ubTownId = StrategicMap[ pTrainer->sSectorX + pTrainer->sSectorY * MAP_WORLD_X ].bNameId; if( fSamSiteInSector == FALSE ) { Assert(ubTownId != BLANK_SECTOR); } // trainer gains leadership - training argument is FALSE, because the trainer is not the one training! - StatChange( pTrainer, LDRAMT, (UINT16) ( 1 + ( sTrainingPts / 200 ) ), FALSE ); + StatChange( pTrainer, LDRAMT, (UINT16) ( 1 + ( sTrainingPts / 200 ) ), FALSE ); StatChange( pTrainer, WISDOMAMT, (UINT16) ( 1 + ( sTrainingPts / 400 ) ), FALSE ); // increase town's training completed percentage - pSectorInfo -> ubMilitiaTrainingPercentDone += (sTrainingPts / 100); - pSectorInfo -> ubMilitiaTrainingHundredths += (sTrainingPts % 100); + pSectorInfo->ubMilitiaTrainingPercentDone += (sTrainingPts / 100); + pSectorInfo->ubMilitiaTrainingHundredths += (sTrainingPts % 100); - if (pSectorInfo -> ubMilitiaTrainingHundredths >= 100) + if (pSectorInfo->ubMilitiaTrainingHundredths >= 100) { - pSectorInfo -> ubMilitiaTrainingPercentDone++; - pSectorInfo -> ubMilitiaTrainingHundredths -= 100; + pSectorInfo->ubMilitiaTrainingPercentDone++; + pSectorInfo->ubMilitiaTrainingHundredths -= 100; } - // NOTE: Leave this at 100, change TOWN_TRAINING_RATE if necessary. This value gets reported to player as a %age! - if( pSectorInfo -> ubMilitiaTrainingPercentDone >= 100 ) + // NOTE: Leave this at 100, change TOWN_TRAINING_RATE if necessary. This value gets reported to player as a %age! + if( pSectorInfo->ubMilitiaTrainingPercentDone >= 100 ) { // zero out training completion - there's no carryover to the next training session - pSectorInfo -> ubMilitiaTrainingPercentDone = 0; - pSectorInfo -> ubMilitiaTrainingHundredths = 0; + pSectorInfo->ubMilitiaTrainingPercentDone = 0; + pSectorInfo->ubMilitiaTrainingHundredths = 0; // make the player pay again next time he wants to train here - pSectorInfo -> fMilitiaTrainingPaid = FALSE; + pSectorInfo->fMilitiaTrainingPaid = FALSE; TownMilitiaTrainingCompleted( pTrainer, sMapX, sMapY ); @@ -4188,18 +4232,18 @@ INT16 GetTownTrainPtsForCharacter( SOLDIERTYPE *pTrainer, UINT16 *pusMaxPts ) // UINT8 ubTownId = 0; // calculate normal training pts - what it would be if his stats were "normal" (ignoring drugs, fatigue) - *pusMaxPts = ( pTrainer -> bWisdom + pTrainer -> bLeadership + ( 10 * pTrainer -> bExpLevel ) ) * gGameExternalOptions.ubTownMilitiaTrainingRate; + *pusMaxPts = ( pTrainer->stats.bWisdom + pTrainer->stats.bLeadership + ( 10 * pTrainer->stats.bExpLevel ) ) * gGameExternalOptions.ubTownMilitiaTrainingRate; // calculate effective training points (this is hundredths of pts / hour) // typical: 300/hr, maximum: 600/hr sTotalTrainingPts = ( EffectiveWisdom( pTrainer ) + EffectiveLeadership ( pTrainer ) + ( 10 * EffectiveExpLevel ( pTrainer ) ) ) * gGameExternalOptions.ubTownMilitiaTrainingRate; // check for teaching bonuses - if( gMercProfiles[ pTrainer -> ubProfile ].bSkillTrait == TEACHING ) + if( gMercProfiles[ pTrainer->ubProfile ].bSkillTrait == TEACHING ) { bTrainingBonus += gGameExternalOptions.ubTeachBonusToTrain; } - if( gMercProfiles[ pTrainer -> ubProfile ].bSkillTrait2 == TEACHING ) + if( gMercProfiles[ pTrainer->ubProfile ].bSkillTrait2 == TEACHING ) { bTrainingBonus += gGameExternalOptions.ubTeachBonusToTrain; } @@ -4213,7 +4257,7 @@ INT16 GetTownTrainPtsForCharacter( SOLDIERTYPE *pTrainer, UINT16 *pusMaxPts ) // adjust for teaching bonus (a percentage) sTotalTrainingPts += ( ( bTrainingBonus * sTotalTrainingPts ) / 100 ); // teach bonus is considered "normal" - it's always there - *pusMaxPts += ( ( bTrainingBonus * *pusMaxPts ) / 100 ); + *pusMaxPts += ( ( bTrainingBonus * *pusMaxPts ) / 100 ); // adjust for fatigue of trainer @@ -4222,7 +4266,7 @@ INT16 GetTownTrainPtsForCharacter( SOLDIERTYPE *pTrainer, UINT16 *pusMaxPts ) /* ARM: Decided this didn't make much sense - the guys I'm training damn well BETTER be loyal - and screw the rest! // get town index - ubTownId = StrategicMap[ pTrainer -> sSectorX + pTrainer -> sSectorY * MAP_WORLD_X ].bNameId; + ubTownId = StrategicMap[ pTrainer->sSectorX + pTrainer->sSectorY * MAP_WORLD_X ].bNameId; Assert(ubTownId != BLANK_SECTOR); // adjust for town loyalty @@ -4236,28 +4280,28 @@ INT16 GetTownTrainPtsForCharacter( SOLDIERTYPE *pTrainer, UINT16 *pusMaxPts ) void MakeSoldiersTacticalAnimationReflectAssignment( SOLDIERTYPE *pSoldier ) { // soldier is in tactical, world loaded, he's OKLIFE - if( ( pSoldier -> bInSector ) && gfWorldLoaded && ( pSoldier -> bLife >= OKLIFE ) ) + if( ( pSoldier->bInSector ) && gfWorldLoaded && ( pSoldier->stats.bLife >= OKLIFE ) ) { // Set animation based on his assignment - if ( pSoldier -> bAssignment == DOCTOR ) + if ( pSoldier->bAssignment == DOCTOR ) { - SoldierInSectorDoctor( pSoldier, pSoldier -> usStrategicInsertionData ); + SoldierInSectorDoctor( pSoldier, pSoldier->usStrategicInsertionData ); } - else if ( pSoldier -> bAssignment == PATIENT ) + else if ( pSoldier->bAssignment == PATIENT ) { - SoldierInSectorPatient( pSoldier, pSoldier -> usStrategicInsertionData ); + SoldierInSectorPatient( pSoldier, pSoldier->usStrategicInsertionData ); } - else if ( pSoldier -> bAssignment == REPAIR ) + else if ( pSoldier->bAssignment == REPAIR ) { - SoldierInSectorRepair( pSoldier, pSoldier -> usStrategicInsertionData ); + SoldierInSectorRepair( pSoldier, pSoldier->usStrategicInsertionData ); } else { - if ( pSoldier->usAnimState != WKAEUP_FROM_SLEEP && !(pSoldier->bOldAssignment < ON_DUTY ) ) - { + if ( pSoldier->usAnimState != WKAEUP_FROM_SLEEP && !(pSoldier->bOldAssignment < ON_DUTY ) ) + { // default: standing - ChangeSoldierState( pSoldier, STANDING, 1, TRUE ); - } + pSoldier->ChangeSoldierState( STANDING, 1, TRUE ); + } } } } @@ -4272,7 +4316,7 @@ void AssignmentAborted( SOLDIERTYPE *pSoldier, UINT8 ubReason ) StopTimeCompression(); - // update mapscreen + // update mapscreen fCharacterInfoPanelDirty = TRUE; fTeamPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; @@ -4282,40 +4326,40 @@ void AssignmentAborted( SOLDIERTYPE *pSoldier, UINT8 ubReason ) void AssignmentDone( SOLDIERTYPE *pSoldier, BOOLEAN fSayQuote, BOOLEAN fMeToo ) { - if ( ( pSoldier -> bInSector ) && ( gfWorldLoaded ) ) + if ( ( pSoldier->bInSector ) && ( gfWorldLoaded ) ) { - if ( pSoldier -> bAssignment == DOCTOR ) + if ( pSoldier->bAssignment == DOCTOR ) { if ( guiCurrentScreen == GAME_SCREEN ) { - ChangeSoldierState( pSoldier, END_DOCTOR, 1, TRUE ); + pSoldier->ChangeSoldierState( END_DOCTOR, 1, TRUE ); } else { - ChangeSoldierState( pSoldier, STANDING, 1, TRUE ); + pSoldier->ChangeSoldierState( STANDING, 1, TRUE ); } } - else if ( pSoldier -> bAssignment == REPAIR ) + else if ( pSoldier->bAssignment == REPAIR ) { if ( guiCurrentScreen == GAME_SCREEN ) { - ChangeSoldierState( pSoldier, END_REPAIRMAN, 1, TRUE ); + pSoldier->ChangeSoldierState( END_REPAIRMAN, 1, TRUE ); } else { - ChangeSoldierState( pSoldier, STANDING, 1, TRUE ); + pSoldier->ChangeSoldierState( STANDING, 1, TRUE ); } } - else if ( pSoldier -> bAssignment == PATIENT ) + else if ( pSoldier->bAssignment == PATIENT ) { if ( guiCurrentScreen == GAME_SCREEN ) { - ChangeSoldierStance( pSoldier, ANIM_CROUCH ); + pSoldier->ChangeSoldierStance( ANIM_CROUCH ); } else { - ChangeSoldierState( pSoldier, STANDING, 1, TRUE ); + pSoldier->ChangeSoldierState( STANDING, 1, TRUE ); } } } @@ -4328,17 +4372,17 @@ void AssignmentDone( SOLDIERTYPE *pSoldier, BOOLEAN fSayQuote, BOOLEAN fMeToo ) if ( fSayQuote ) { - if ( ( fMeToo == FALSE ) && (pSoldier->bAssignment == TRAIN_TOWN ) ) + if ( ( fMeToo == FALSE ) && (pSoldier->bAssignment == TRAIN_TOWN ) ) { TacticalCharacterDialogue( pSoldier, QUOTE_ASSIGNMENT_COMPLETE ); - if( pSoldier -> bAssignment == TRAIN_TOWN ) + if( pSoldier->bAssignment == TRAIN_TOWN ) { AddSectorForSoldierToListOfSectorsThatCompletedMilitiaTraining( pSoldier ); } } } - + // don't bother telling us again about guys we already know about if ( !( pSoldier->usQuoteSaidExtFlags & SOLDIER_QUOTE_SAID_DONE_ASSIGNMENT ) ) { @@ -4347,7 +4391,7 @@ void AssignmentDone( SOLDIERTYPE *pSoldier, BOOLEAN fSayQuote, BOOLEAN fMeToo ) if ( fSayQuote ) { if ( pSoldier->bAssignment == DOCTOR || pSoldier->bAssignment == REPAIR || - pSoldier->bAssignment == PATIENT || pSoldier->bAssignment == ASSIGNMENT_HOSPITAL ) + pSoldier->bAssignment == PATIENT || pSoldier->bAssignment == ASSIGNMENT_HOSPITAL ) { TacticalCharacterDialogue( pSoldier, QUOTE_ASSIGNMENT_COMPLETE ); } @@ -4359,9 +4403,9 @@ void AssignmentDone( SOLDIERTYPE *pSoldier, BOOLEAN fSayQuote, BOOLEAN fMeToo ) // trigger a single call AddDisplayBoxToWaitingQueue for assignments done gfAddDisplayBoxToWaitingQueue = TRUE; - } + } - // update mapscreen + // update mapscreen fCharacterInfoPanelDirty = TRUE; fTeamPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; @@ -4373,10 +4417,10 @@ BOOLEAN CharacterIsBetweenSectors( SOLDIERTYPE *pSoldier ) if( pSoldier == NULL ) { return ( FALSE ); - } + } else { - return( pSoldier -> fBetweenSectors ); + return( pSoldier->flags.fBetweenSectors ); } } @@ -4384,20 +4428,18 @@ BOOLEAN CharacterIsBetweenSectors( SOLDIERTYPE *pSoldier ) void HandleNaturalHealing( void ) { SOLDIERTYPE *pSoldier, *pTeamSoldier; - INT32 cnt=0; - INT32 iCounter=0; - INT8 bNumberOfPeople = 0; - + INT32 cnt=0; + // set psoldier as first in merc ptrs - pSoldier = MercPtrs[0]; - + pSoldier = MercPtrs[0]; + // go through list of characters, find all who are on this assignment - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier -> bTeam ].bLastID; cnt++,pTeamSoldier++) + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) { - if( pTeamSoldier -> bActive ) + if( pTeamSoldier->bActive ) { // mechanical members don't regenerate! - if( !( pTeamSoldier -> uiStatusFlags & SOLDIER_VEHICLE ) && !( AM_A_ROBOT( pTeamSoldier ) ) ) + if( !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !( AM_A_ROBOT( pTeamSoldier ) ) ) { HandleHealingByNaturalCauses( pTeamSoldier ); } @@ -4422,19 +4464,19 @@ void HandleHealingByNaturalCauses( SOLDIERTYPE *pSoldier ) } // dead - if( pSoldier -> bLife == 0 ) + if( pSoldier->stats.bLife == 0 ) { return; } // lost any pts? - if( pSoldier -> bLife == pSoldier -> bLifeMax ) + if( pSoldier->stats.bLife == pSoldier->stats.bLifeMax ) { return; } // any bleeding pts - can' recover if still bleeding! - if( pSoldier -> bBleeding != 0 ) + if( pSoldier->bBleeding != 0 ) { return; } @@ -4442,12 +4484,12 @@ void HandleHealingByNaturalCauses( SOLDIERTYPE *pSoldier ) // not bleeding and injured... - if( pSoldier -> bAssignment == ASSIGNMENT_POW ) + if( pSoldier->bAssignment == ASSIGNMENT_POW ) { // use high activity level to simulate stress, torture, poor conditions for healing bActivityLevelDivisor = gGameExternalOptions.ubHighActivityLevel; } - if( ( pSoldier -> fMercAsleep == TRUE ) || ( pSoldier -> bAssignment == PATIENT ) || ( pSoldier -> bAssignment == ASSIGNMENT_HOSPITAL ) ) + if( ( pSoldier->flags.fMercAsleep == TRUE ) || ( pSoldier->bAssignment == PATIENT ) || ( pSoldier->bAssignment == ASSIGNMENT_HOSPITAL ) ) { bActivityLevelDivisor = gGameExternalOptions.ubLowActivityLevel; } @@ -4472,7 +4514,7 @@ void HandleHealingByNaturalCauses( SOLDIERTYPE *pSoldier ) // what percentage of health is he down to - uiPercentHealth = ( pSoldier->bLife * 100 ) / pSoldier->bLifeMax; + uiPercentHealth = ( pSoldier->stats.bLife * 100 ) / pSoldier->stats.bLifeMax; // gain that many hundredths of life points back, divided by the activity level modifier pSoldier->sFractLife += ( INT16 ) ( uiPercentHealth / bActivityLevelDivisor ); @@ -4487,17 +4529,17 @@ void HandleHealingByNaturalCauses( SOLDIERTYPE *pSoldier ) void UpDateSoldierLife( SOLDIERTYPE *pSoldier ) { // update soldier life, make sure we don't go out of bounds - pSoldier -> bLife += pSoldier -> sFractLife / 100; - + pSoldier->stats.bLife += pSoldier->sFractLife / 100; + // keep remaining fract of life - pSoldier -> sFractLife %= 100; + pSoldier->sFractLife %= 100; // check if we have gone too far - if( pSoldier -> bLife >= pSoldier -> bLifeMax ) + if( pSoldier->stats.bLife >= pSoldier->stats.bLifeMax ) { // reduce - pSoldier -> bLife = pSoldier -> bLifeMax; - pSoldier -> sFractLife = 0; + pSoldier->stats.bLife = pSoldier->stats.bLifeMax; + pSoldier->sFractLife = 0; } return; } @@ -4514,52 +4556,52 @@ BOOLEAN AutoSleepMerc( SOLDIERTYPE *pSoldier ) } // already asleep - if( pSoldier -> fMercAsleep == TRUE ) + if( pSoldier->flags.fMercAsleep == TRUE ) { return ( FALSE ); } - if( pSoldier -> bBreathMax > MIN_BREATH_TO_STAY_AWAKE ) + if( pSoldier->bBreathMax > MIN_BREATH_TO_STAY_AWAKE ) { - if( ( pSoldier -> bAssignment < ON_DUTY ) ) + if( ( pSoldier->bAssignment < ON_DUTY ) ) { return ( FALSE ); } - if( pSoldier -> bLife < OKLIFE ) + if( pSoldier->stats.bLife < OKLIFE ) { // can't sleep return ( FALSE ); } - // if was forced to stay awake, leave - if( pSoldier -> fForcedToStayAwake == TRUE ) + // if was forced to stay awake, leave + if( pSoldier->fForcedToStayAwake == TRUE ) { return( FALSE ); } } else { - // ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s", pMercFellAsleepString[ 0 ], pSoldier -> name ); + // ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s", pMercFellAsleepString[ 0 ], pSoldier->name ); } - + // store old assignment - pSoldier -> bOldAssignment = pSoldier -> bAssignment; + pSoldier->bOldAssignment = pSoldier->bAssignment; - if( pSoldier -> bAssignment < ON_DUTY ) + if( pSoldier->bAssignment < ON_DUTY ) { - RemoveCharacterFromASquad( pSoldier, pSoldier -> bAssignment ); + RemoveCharacterFromASquad( pSoldier, pSoldier->bAssignment ); } if( SetMercAsleep( pSoldier, FALSE ) ) { // change soldier state - SoldierInSectorSleep( pSoldier, pSoldier -> usStrategicInsertionData ); + SoldierInSectorSleep( pSoldier, pSoldier->usStrategicInsertionData ); - // update mapscreen + // update mapscreen fCharacterInfoPanelDirty = TRUE; fTeamPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; @@ -4577,14 +4619,14 @@ BOOLEAN AutoSleepMerc( SOLDIERTYPE *pSoldier ) void CheckIfSoldierUnassigned( SOLDIERTYPE *pSoldier ) { - if( pSoldier -> bAssignment == NO_ASSIGNMENT ) + if( pSoldier->bAssignment == NO_ASSIGNMENT ) { // unassigned AddCharacterToAnySquad( pSoldier ); - + if( ( gfWorldLoaded ) && ( pSoldier->bInSector ) ) { - ChangeSoldierState( pSoldier, STANDING, 1, TRUE ); + pSoldier->ChangeSoldierState( STANDING, 1, TRUE ); } } @@ -4615,16 +4657,16 @@ void CreateDestroyMouseRegionsForAssignmentMenu( void ) { // dead guy handle menu stuff fShowRemoveMenu = fShowAssignmentMenu | fShowContractMenu; - + CreateDestroyMouseRegionsForRemoveMenu( ); return; } - if( ( Menptr[gCharactersList[bSelectedAssignChar].usSolID].bLife == 0 ) || ( Menptr[gCharactersList[bSelectedAssignChar].usSolID].bAssignment == ASSIGNMENT_POW ) ) + if( ( Menptr[gCharactersList[bSelectedAssignChar].usSolID].stats.bLife == 0 ) || ( Menptr[gCharactersList[bSelectedAssignChar].usSolID].bAssignment == ASSIGNMENT_POW ) ) { // dead guy handle menu stuff fShowRemoveMenu = fShowAssignmentMenu | fShowContractMenu; - + CreateDestroyMouseRegionsForRemoveMenu( ); return; @@ -4639,15 +4681,15 @@ void CreateDestroyMouseRegionsForAssignmentMenu( void ) if( ( fShowAssignmentMenu ) && ( guiCurrentScreen == MAP_SCREEN ) ) { - SetBoxPosition( ghAssignmentBox, AssignmentPosition ); + SetBoxPosition( ghAssignmentBox, AssignmentPosition ); } pSoldier = GetSelectedAssignSoldier( FALSE ); - if( pSoldier -> ubWhatKindOfMercAmI == MERC_TYPE__EPC ) + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC ) { // grab height of font - iFontHeight = GetLineSpace( ghEpcBox ) + GetFontHeight( GetBoxFont( ghEpcBox ) ); + iFontHeight = GetLineSpace( ghEpcBox ) + GetFontHeight( GetBoxFont( ghEpcBox ) ); // get x.y position of box GetBoxPosition( ghEpcBox, &pPosition); @@ -4667,7 +4709,7 @@ void CreateDestroyMouseRegionsForAssignmentMenu( void ) else { // grab height of font - iFontHeight = GetLineSpace( ghAssignmentBox ) + GetFontHeight( GetBoxFont( ghAssignmentBox ) ); + iFontHeight = GetLineSpace( ghAssignmentBox ) + GetFontHeight( GetBoxFont( ghAssignmentBox ) ); // get x.y position of box GetBoxPosition( ghAssignmentBox, &pPosition); @@ -4684,14 +4726,14 @@ void CreateDestroyMouseRegionsForAssignmentMenu( void ) SetCurrentBox( ghAssignmentBox ); } - + // define regions for( iCounter = 0; iCounter < GetNumberOfLinesOfTextInBox( ghAssignmentBox ); iCounter++ ) { // add mouse region for each line of text..and set user data MSYS_DefineRegion( &gAssignmentMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAssignmentBox ) + ( iFontHeight ) * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAssignmentBox ) + ( iFontHeight ) * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST - 4 , - MSYS_NO_CURSOR, AssignmentMenuMvtCallBack, AssignmentMenuBtnCallback ); + MSYS_NO_CURSOR, AssignmentMenuMvtCallBack, AssignmentMenuBtnCallback ); MSYS_SetRegionUserData( &gAssignmentMenuRegion[ iCounter ], 0, iCounter ); } @@ -4707,7 +4749,7 @@ void CreateDestroyMouseRegionsForAssignmentMenu( void ) } else if( ( fShowAssignmentMenu == FALSE ) && ( fCreated == TRUE ) ) { - // destroy + // destroy for( iCounter = 0; iCounter < GetNumberOfLinesOfTextInBox( ghAssignmentBox ); iCounter++ ) { MSYS_RemoveRegion( &gAssignmentMenuRegion[ iCounter ] ); @@ -4742,7 +4784,7 @@ void CreateDestroyMouseRegionForVehicleMenu( void ) if( fShowVehicleMenu ) { GetBoxPosition( ghAssignmentBox, &pPoint); - + // get dimensions..mostly for width GetBoxSize( ghAssignmentBox, &pDimensions ); @@ -4756,7 +4798,7 @@ void CreateDestroyMouseRegionForVehicleMenu( void ) if( ( fShowVehicleMenu == TRUE ) && ( fCreated == FALSE ) ) { // grab height of font - iFontHeight = GetLineSpace( ghVehicleBox ) + GetFontHeight( GetBoxFont( ghVehicleBox ) ); + iFontHeight = GetLineSpace( ghVehicleBox ) + GetFontHeight( GetBoxFont( ghVehicleBox ) ); // get x.y position of box GetBoxPosition( ghVehicleBox, &pPosition); @@ -4778,14 +4820,14 @@ void CreateDestroyMouseRegionForVehicleMenu( void ) // run through list of vehicles in sector for ( iVehicleId = 0; iVehicleId < ubNumberOfVehicles; iVehicleId++ ) - { + { if ( pVehicleList[ iVehicleId ].fValid == TRUE ) { if ( IsThisVehicleAccessibleToSoldier( pSoldier, iVehicleId ) ) { // add mouse region for each accessible vehicle MSYS_DefineRegion( &gVehicleMenuRegion[ uiMenuLine ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAssignmentBox ) + ( iFontHeight ) * uiMenuLine ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAssignmentBox ) + ( iFontHeight ) * ( uiMenuLine + 1 ) ), MSYS_PRIORITY_HIGHEST - 4 , - MSYS_NO_CURSOR, VehicleMenuMvtCallback, VehicleMenuBtnCallback ); + MSYS_NO_CURSOR, VehicleMenuMvtCallback, VehicleMenuBtnCallback ); MSYS_SetRegionUserData( &gVehicleMenuRegion[ uiMenuLine ], 0, uiMenuLine ); // store vehicle ID in the SECOND user data @@ -4805,7 +4847,7 @@ void CreateDestroyMouseRegionForVehicleMenu( void ) // created fCreated = TRUE; - // pause game + // pause game PauseGame( ); // unhighlight all strings in box @@ -4818,7 +4860,7 @@ void CreateDestroyMouseRegionForVehicleMenu( void ) else if( ( ( fShowVehicleMenu == FALSE ) || ( fShowAssignmentMenu == FALSE ) ) && ( fCreated == TRUE ) ) { fCreated = FALSE; - + // remove these regions for( uiMenuLine = 0; uiMenuLine < GetNumberOfLinesOfTextInBox( ghVehicleBox ); uiMenuLine++ ) { @@ -4828,7 +4870,7 @@ void CreateDestroyMouseRegionForVehicleMenu( void ) fShowVehicleMenu = FALSE; SetRenderFlags( RENDER_FLAG_FULL ); - + HideBox( ghVehicleBox ); if ( fShowAssignmentMenu ) @@ -4848,18 +4890,18 @@ void HandleShadingOfLinesForVehicleMenu( void ) SOLDIERTYPE *pSoldier = NULL; INT32 iVehicleId; UINT32 uiMenuLine = 0; - + if ( ( fShowVehicleMenu == FALSE ) || ( ghVehicleBox == - 1 ) ) { return; } - + pSoldier = GetSelectedAssignSoldier( FALSE ); // run through list of vehicles for ( iVehicleId = 0; iVehicleId < ubNumberOfVehicles; iVehicleId++ ) - { + { if ( pVehicleList[ iVehicleId ].fValid == TRUE ) { // inaccessible vehicles aren't listed at all! @@ -4939,7 +4981,7 @@ void VehicleMenuMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) { // mvt callback handler for assignment region INT32 iValue = -1; - + iValue = MSYS_GetRegionUserData( pRegion, 0 ); if (iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) @@ -4956,7 +4998,7 @@ void VehicleMenuMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) else { // highlight cancel line - HighLightBoxLine( ghVehicleBox, GetNumberOfLinesOfTextInBox( ghVehicleBox ) - 1 ); + HighLightBoxLine( ghVehicleBox, GetNumberOfLinesOfTextInBox( ghVehicleBox ) - 1 ); } } else if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) @@ -4981,8 +5023,8 @@ BOOLEAN DisplayRepairMenu( SOLDIERTYPE *pSoldier ) RemoveBox(ghRepairBox); ghRepairBox = -1; - CreateRepairBox(); - SetCurrentBox(ghRepairBox); + CreateRepairBox(); + SetCurrentBox(ghRepairBox); // PLEASE NOTE: make sure any changes you do here are reflected in all 3 routines which must remain in synch: // CreateDestroyMouseRegionForRepairMenu(), DisplayRepairMenu(), and HandleShadingOfLinesForRepairMenu(). @@ -5006,8 +5048,8 @@ BOOLEAN DisplayRepairMenu( SOLDIERTYPE *pSoldier ) } } - -/* No point in allowing SAM site repair any more. Jan/13/99. ARM + +/* No point in allowing SAM site repair any more. Jan/13/99. ARM // is there a SAM SITE Here? if( ( IsThisSectorASAMSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) == TRUE ) && ( IsTheSAMSiteInSectorRepairable( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) ) ) { @@ -5032,17 +5074,17 @@ BOOLEAN DisplayRepairMenu( SOLDIERTYPE *pSoldier ) // cancel AddMonoString((UINT32 *)&hStringHandle, pRepairStrings[ 2 ] ); - SetBoxFont(ghRepairBox, MAP_SCREEN_FONT); - SetBoxHighLight(ghRepairBox, FONT_WHITE); + SetBoxFont(ghRepairBox, MAP_SCREEN_FONT); + SetBoxHighLight(ghRepairBox, FONT_WHITE); SetBoxShade(ghRepairBox, FONT_GRAY7); - SetBoxForeground(ghRepairBox, FONT_LTGREEN); - SetBoxBackground(ghRepairBox, FONT_BLACK); + SetBoxForeground(ghRepairBox, FONT_LTGREEN); + SetBoxBackground(ghRepairBox, FONT_BLACK); // resize box to text ResizeBoxToText( ghRepairBox ); CheckAndUpdateTacticalAssignmentPopUpPositions( ); - + return TRUE; } @@ -5058,7 +5100,7 @@ void HandleShadingOfLinesForRepairMenu( void ) { return; } - + pSoldier = GetSelectedAssignSoldier( FALSE ); @@ -5068,7 +5110,7 @@ void HandleShadingOfLinesForRepairMenu( void ) if ( pSoldier->bSectorZ == 0 ) { for ( iVehicleIndex = 0; iVehicleIndex < ubNumberOfVehicles; iVehicleIndex++ ) - { + { if ( pVehicleList[ iVehicleIndex ].fValid == TRUE ) { // don't even list the helicopter, because it's NEVER repairable... @@ -5094,9 +5136,9 @@ void HandleShadingOfLinesForRepairMenu( void ) } } - -/* No point in allowing SAM site repair any more. Jan/13/99. ARM - if( ( IsThisSectorASAMSector( pSoldier -> sSectorX, pSoldier -> sSectorY, pSoldier -> bSectorZ ) == TRUE ) && ( IsTheSAMSiteInSectorRepairable( pSoldier -> sSectorX, pSoldier -> sSectorY, pSoldier -> bSectorZ ) ) ) + +/* No point in allowing SAM site repair any more. Jan/13/99. ARM + if( ( IsThisSectorASAMSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) == TRUE ) && ( IsTheSAMSiteInSectorRepairable( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) ) ) { // handle enable disable of repair sam option if( CanSoldierRepairSAM( pSoldier, SAM_SITE_REPAIR_DIVISOR ) ) @@ -5115,7 +5157,7 @@ void HandleShadingOfLinesForRepairMenu( void ) */ - if( IsRobotInThisSector( pSoldier -> sSectorX, pSoldier -> sSectorY, pSoldier -> bSectorZ ) ) + if( IsRobotInThisSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) ) { // handle shading of repair robot option if( CanCharacterRepairRobot( pSoldier ) ) @@ -5173,11 +5215,11 @@ void CreateDestroyMouseRegionForRepairMenu( void ) if( ( fShowRepairMenu ) && ( guiCurrentScreen == MAP_SCREEN ) ) { - //SetBoxPosition( ghRepairBox ,RepairPosition); + //SetBoxPosition( ghRepairBox ,RepairPosition); } // grab height of font - iFontHeight = GetLineSpace( ghRepairBox ) + GetFontHeight( GetBoxFont( ghRepairBox ) ); + iFontHeight = GetLineSpace( ghRepairBox ) + GetFontHeight( GetBoxFont( ghRepairBox ) ); // get x.y position of box GetBoxPosition( ghRepairBox, &pPosition); @@ -5215,7 +5257,7 @@ void CreateDestroyMouseRegionForRepairMenu( void ) { // add mouse region for each line of text..and set user data MSYS_DefineRegion( &gRepairMenuRegion[ iCount ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAssignmentBox ) + ( iFontHeight ) * iCount ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAssignmentBox ) + ( iFontHeight ) * ( iCount + 1 ) ), MSYS_PRIORITY_HIGHEST - 4 , - MSYS_NO_CURSOR, RepairMenuMvtCallback, RepairMenuBtnCallback ); + MSYS_NO_CURSOR, RepairMenuMvtCallback, RepairMenuBtnCallback ); MSYS_SetRegionUserData( &gRepairMenuRegion[ iCount ], 0, iCount ); // 2nd user data is the vehicle index, which can easily be different from the region index! @@ -5228,12 +5270,12 @@ void CreateDestroyMouseRegionForRepairMenu( void ) } -/* No point in allowing SAM site repair any more. Jan/13/99. ARM +/* No point in allowing SAM site repair any more. Jan/13/99. ARM // SAM site - if( ( IsThisSectorASAMSector( pSoldier -> sSectorX, pSoldier -> sSectorY, pSoldier -> bSectorZ ) == TRUE ) && ( IsTheSAMSiteInSectorRepairable( pSoldier -> sSectorX, pSoldier -> sSectorY, pSoldier -> bSectorZ ) ) ) + if( ( IsThisSectorASAMSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) == TRUE ) && ( IsTheSAMSiteInSectorRepairable( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) ) ) { MSYS_DefineRegion( &gRepairMenuRegion[ iCount ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAssignmentBox ) + ( iFontHeight ) * iCount ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAssignmentBox ) + ( iFontHeight ) * ( iCount + 1 ) ), MSYS_PRIORITY_HIGHEST - 4 , - MSYS_NO_CURSOR, RepairMenuMvtCallback, RepairMenuBtnCallback ); + MSYS_NO_CURSOR, RepairMenuMvtCallback, RepairMenuBtnCallback ); MSYS_SetRegionUserData( &gRepairMenuRegion[ iCount ], 0, REPAIR_MENU_SAM_SITE ); iCount++; @@ -5242,10 +5284,10 @@ void CreateDestroyMouseRegionForRepairMenu( void ) // robot - if( IsRobotInThisSector( pSoldier -> sSectorX, pSoldier -> sSectorY, pSoldier -> bSectorZ ) ) + if( IsRobotInThisSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) ) { MSYS_DefineRegion( &gRepairMenuRegion[ iCount ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAssignmentBox ) + ( iFontHeight ) * iCount ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAssignmentBox ) + ( iFontHeight ) * ( iCount + 1 ) ), MSYS_PRIORITY_HIGHEST - 4 , - MSYS_NO_CURSOR, RepairMenuMvtCallback, RepairMenuBtnCallback ); + MSYS_NO_CURSOR, RepairMenuMvtCallback, RepairMenuBtnCallback ); MSYS_SetRegionUserData( &gRepairMenuRegion[ iCount ], 0, iCount ); MSYS_SetRegionUserData( &gRepairMenuRegion[ iCount ], 1, REPAIR_MENU_ROBOT ); @@ -5255,7 +5297,7 @@ void CreateDestroyMouseRegionForRepairMenu( void ) // items MSYS_DefineRegion( &gRepairMenuRegion[ iCount ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAssignmentBox ) + ( iFontHeight ) * iCount ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAssignmentBox ) + ( iFontHeight ) * ( iCount + 1 ) ), MSYS_PRIORITY_HIGHEST - 4 , - MSYS_NO_CURSOR, RepairMenuMvtCallback, RepairMenuBtnCallback ); + MSYS_NO_CURSOR, RepairMenuMvtCallback, RepairMenuBtnCallback ); MSYS_SetRegionUserData( &gRepairMenuRegion[ iCount ], 0, iCount ); MSYS_SetRegionUserData( &gRepairMenuRegion[ iCount ], 1, REPAIR_MENU_ITEMS ); @@ -5264,12 +5306,12 @@ void CreateDestroyMouseRegionForRepairMenu( void ) // cancel MSYS_DefineRegion( &gRepairMenuRegion[ iCount ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAssignmentBox ) + ( iFontHeight ) * iCount ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAssignmentBox ) + ( iFontHeight ) * ( iCount + 1 ) ), MSYS_PRIORITY_HIGHEST - 4 , - MSYS_NO_CURSOR, RepairMenuMvtCallback, RepairMenuBtnCallback ); + MSYS_NO_CURSOR, RepairMenuMvtCallback, RepairMenuBtnCallback ); MSYS_SetRegionUserData( &gRepairMenuRegion[ iCount ], 0, iCount ); MSYS_SetRegionUserData( &gRepairMenuRegion[ iCount ], 1, REPAIR_MENU_CANCEL ); - - + + PauseGame( ); // unhighlight all strings in box @@ -5336,7 +5378,7 @@ void RepairMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) pSoldier->bOldAssignment = pSoldier->bAssignment; - if( ( pSoldier->bAssignment != REPAIR )|| ( pSoldier -> fFixingRobot ) || ( pSoldier -> fFixingSAMSite ) ) + if( ( pSoldier->bAssignment != REPAIR )|| ( pSoldier->flags.fFixingRobot ) || ( pSoldier->flags.fFixingSAMSite ) ) { SetTimeOfAssignmentChangeForMerc( pSoldier ); } @@ -5352,7 +5394,7 @@ void RepairMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) ChangeSoldiersAssignment( pSoldier, REPAIR ); - pSoldier -> bVehicleUnderRepairID = ( INT8 ) iRepairWhat; + pSoldier->bVehicleUnderRepairID = ( INT8 ) iRepairWhat; MakeSureToolKitIsInHand( pSoldier ); @@ -5364,7 +5406,7 @@ void RepairMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) fShowAssignmentMenu = FALSE; } -/* No point in allowing SAM site repair any more. Jan/13/99. ARM +/* No point in allowing SAM site repair any more. Jan/13/99. ARM else if( iRepairWhat == REPAIR_MENU_SAM_SITE ) { // repair SAM site @@ -5373,13 +5415,13 @@ void RepairMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) RemoveCharacterFromSquads( pSoldier ); MakeSureToolKitIsInHand( pSoldier ); - if( ( pSoldier->bAssignment != REPAIR )|| ( pSoldier -> fFixingSAMSite == FALSE ) ) + if( ( pSoldier->bAssignment != REPAIR )|| ( pSoldier->flags.fFixingSAMSite == FALSE ) ) { SetTimeOfAssignmentChangeForMerc( pSoldier ); } ChangeSoldiersAssignment( pSoldier, REPAIR ); - pSoldier -> fFixingSAMSite = TRUE; + pSoldier->flags.fFixingSAMSite = TRUE; // the second argument is irrelevant here, function looks at pSoldier itself to know what's being repaired SetAssignmentForList( ( INT8 ) REPAIR, 0 ); @@ -5405,13 +5447,13 @@ void RepairMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) RemoveCharacterFromSquads( pSoldier ); MakeSureToolKitIsInHand( pSoldier ); - if( ( pSoldier->bAssignment != REPAIR )|| ( pSoldier -> fFixingRobot == FALSE ) ) + if( ( pSoldier->bAssignment != REPAIR )|| ( pSoldier->flags.fFixingRobot == FALSE ) ) { SetTimeOfAssignmentChangeForMerc( pSoldier ); } ChangeSoldiersAssignment( pSoldier, REPAIR ); - pSoldier->fFixingRobot = TRUE; + pSoldier->flags.fFixingRobot = TRUE; // the second argument is irrelevant here, function looks at pSoldier itself to know what's being repaired SetAssignmentForList( ( INT8 ) REPAIR, 0 ); @@ -5437,7 +5479,7 @@ void RepairMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) fShowRepairMenu = FALSE; } - // update mapscreen + // update mapscreen fCharacterInfoPanelDirty = TRUE; fTeamPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; @@ -5477,20 +5519,21 @@ void RepairMenuMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) } } - - void MakeSureToolKitIsInHand( SOLDIERTYPE *pSoldier ) { INT8 bPocket = 0; // if there isn't a toolkit in his hand - if( !Item[pSoldier -> inv[ HANDPOS].usItem].toolkit ) + if( !Item[pSoldier->inv[ HANDPOS].usItem].toolkit ) { // run through rest of inventory looking for toolkits, swap the first one into hand if found - for (bPocket = SECONDHANDPOS; bPocket <= SMALLPOCK8POS; bPocket++) + // CHRISL: Changed to dynamically determine max inventory locations. + for (bPocket = SECONDHANDPOS; bPocket < NUM_INV_SLOTS; bPocket++) { - if( Item[pSoldier -> inv[ bPocket ].usItem].toolkit ) + if( Item[pSoldier->inv[ bPocket ].usItem].toolkit ) { + if(!CanItemFitInPosition(pSoldier, &pSoldier->inv[HANDPOS], bPocket, FALSE)) + SwapObjs(pSoldier, HANDPOS, SECONDHANDPOS, TRUE); SwapObjs( pSoldier, HANDPOS, bPocket, TRUE ); break; } @@ -5502,41 +5545,44 @@ void MakeSureToolKitIsInHand( SOLDIERTYPE *pSoldier ) BOOLEAN MakeSureMedKitIsInHand( SOLDIERTYPE *pSoldier ) { INT8 bPocket = 0; - BOOLEAN fFoundOne = FALSE; fTeamPanelDirty = TRUE; // if there is a MEDICAL BAG in his hand, we're set - if ( Item[pSoldier -> inv[ HANDPOS ].usItem].medicalkit ) + if ( Item[pSoldier->inv[ HANDPOS ].usItem].medicalkit ) { return(TRUE); } // run through rest of inventory looking 1st for MEDICAL BAGS, swap the first one into hand if found - for (bPocket = SECONDHANDPOS; bPocket <= SMALLPOCK8POS; bPocket++) + // CHRISL: Changed to dynamically determine max inventory locations. + for (bPocket = SECONDHANDPOS; bPocket < NUM_INV_SLOTS; bPocket++) { - if ( Item[pSoldier -> inv[ bPocket ].usItem].medicalkit ) + if ( Item[pSoldier->inv[ bPocket ].usItem].medicalkit ) { fCharacterInfoPanelDirty = TRUE; + if(!CanItemFitInPosition(pSoldier, &pSoldier->inv[HANDPOS], bPocket, FALSE)) + SwapObjs(pSoldier, HANDPOS, SECONDHANDPOS, TRUE); SwapObjs( pSoldier, HANDPOS, bPocket, TRUE ); return(TRUE); } } // we didn't find a medical bag, so settle for a FIRST AID KIT - if ( Item[pSoldier -> inv[ HANDPOS ].usItem].firstaidkit ) + if ( Item[pSoldier->inv[ HANDPOS ].usItem].firstaidkit ) { return(TRUE); } // run through rest of inventory looking 1st for MEDICAL BAGS, swap the first one into hand if found - for (bPocket = SECONDHANDPOS; bPocket <= SMALLPOCK8POS; bPocket++) + // CHRISL: Changed to dynamically determine max inventory locations. + for (bPocket = SECONDHANDPOS; bPocket < NUM_INV_SLOTS; bPocket++) { - if ( Item[pSoldier -> inv[ bPocket ].usItem].firstaidkit ) + if ( Item[pSoldier->inv[ bPocket ].usItem].firstaidkit ) { -// if( ( Item[ pSoldier -> inv[ HANDPOS ].usItem ].fFlags & IF_TWOHANDED_GUN ) && ( bPocket >= SMALLPOCK1POS ) ) - if( ( Item[ pSoldier -> inv[ HANDPOS ].usItem ].twohanded ) && ( bPocket >= SMALLPOCK1POS ) ) + // CHRISL: This needs to start with the first "non-big" pocket. + if( ( Item[ pSoldier -> inv[ HANDPOS ].usItem ].twohanded ) && ( bPocket >= SMALLPOCKSTART ) ) { // first move from hand to second hand SwapObjs( pSoldier, HANDPOS, SECONDHANDPOS, TRUE ); @@ -5545,10 +5591,8 @@ BOOLEAN MakeSureMedKitIsInHand( SOLDIERTYPE *pSoldier ) fCharacterInfoPanelDirty = TRUE; fInterfacePanelDirty = DIRTYLEVEL2; } - - SwapObjs( pSoldier, HANDPOS, bPocket, TRUE ); - + SwapObjs( pSoldier, HANDPOS, bPocket, TRUE ); return(TRUE); } } @@ -5570,13 +5614,13 @@ void HandleShadingOfLinesForAssignmentMenus( void ) { return; } - + pSoldier = GetSelectedAssignSoldier( FALSE ); if ( pSoldier && pSoldier->bActive ) { - if( pSoldier -> ubWhatKindOfMercAmI == MERC_TYPE__EPC ) + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC ) { // patient if( CanCharacterPatient( pSoldier ) ) @@ -5590,7 +5634,7 @@ void HandleShadingOfLinesForAssignmentMenus( void ) ShadeStringInBox( ghEpcBox, EPC_MENU_PATIENT ); } - + if( CanCharacterOnDuty( pSoldier ) ) { // unshade on duty line @@ -5670,7 +5714,7 @@ void HandleShadingOfLinesForAssignmentMenus( void ) // shade patient line ShadeStringInBox( ghAssignmentBox, ASSIGN_MENU_PATIENT ); } - + if( CanCharacterOnDuty( pSoldier ) ) { @@ -5772,10 +5816,10 @@ void DetermineWhichAssignmentMenusCanBeShown( void ) fShowAssignmentMenu = FALSE; fShowVehicleMenu = FALSE; fShowRepairMenu = FALSE; - + // destroy mask, if needed CreateDestroyScreenMaskForAssignmentAndContractMenus( ); - + // destroy menu if needed CreateDestroyMouseRegionForVehicleMenu( ); @@ -5827,11 +5871,11 @@ void DetermineWhichAssignmentMenusCanBeShown( void ) if( fShowContractMenu == FALSE ) { if ( IsBoxShown( ghRemoveMercAssignBox ) ) - { - HideBox( ghRemoveMercAssignBox ); + { + HideBox( ghRemoveMercAssignBox ); fTeamPanelDirty = TRUE; gfRenderPBInterface = TRUE; - } + } } //HideBox( ghSquadBox ); @@ -5854,10 +5898,10 @@ void DetermineWhichAssignmentMenusCanBeShown( void ) CreateDestroyMouseRegionsForTrainingMenu( ); CreateDestroyMouseRegionsForAttributeMenu( ); CreateDestroyMouseRegionsForSquadMenu( TRUE ); - CreateDestroyMouseRegionForRepairMenu( ); + CreateDestroyMouseRegionForRepairMenu( ); - if( ( ( Menptr[gCharactersList[ bSelectedInfoChar ].usSolID].bLife == 0 )||( Menptr[gCharactersList[bSelectedInfoChar].usSolID].bAssignment == ASSIGNMENT_POW ) ) && ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) ) + if( ( ( Menptr[gCharactersList[ bSelectedInfoChar ].usSolID].stats.bLife == 0 )||( Menptr[gCharactersList[bSelectedInfoChar].usSolID].bAssignment == ASSIGNMENT_POW ) ) && ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) ) { // show basic assignment menu ShowBox( ghRemoveMercAssignBox ); @@ -5866,14 +5910,14 @@ void DetermineWhichAssignmentMenusCanBeShown( void ) { pSoldier = GetSelectedAssignSoldier( FALSE ); - if( pSoldier -> ubWhatKindOfMercAmI == MERC_TYPE__EPC ) + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC ) { ShowBox( ghEpcBox ); } else { // show basic assignment menu - + ShowBox( ghAssignmentBox ); } } @@ -5927,8 +5971,8 @@ void DetermineWhichAssignmentMenusCanBeShown( void ) { HideBox( ghAttributeBox ); fTeamPanelDirty = TRUE; - fMapPanelDirty = TRUE; - gfRenderPBInterface = TRUE; + fMapPanelDirty = TRUE; + gfRenderPBInterface = TRUE; // SetRenderFlags(RENDER_FLAG_FULL); } @@ -5945,8 +5989,8 @@ void DetermineWhichAssignmentMenusCanBeShown( void ) { HideBox( ghVehicleBox ); fTeamPanelDirty = TRUE; - fMapPanelDirty = TRUE; - gfRenderPBInterface = TRUE; + fMapPanelDirty = TRUE; + gfRenderPBInterface = TRUE; // SetRenderFlags(RENDER_FLAG_FULL); } } @@ -5963,26 +6007,26 @@ void CreateDestroyScreenMaskForAssignmentAndContractMenus( void ) static BOOLEAN fCreated = FALSE; // will create a screen mask to catch mouse input to disable assignment menus - + // not created, create if( ( fCreated == FALSE ) && ( ( fShowAssignmentMenu == TRUE )||( fShowContractMenu == TRUE ) || ( fShowTownInfo == TRUE) ) ) { MSYS_DefineRegion( &gAssignmentScreenMaskRegion, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST - 4 , - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, AssignmentScreenMaskBtnCallback ); - + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, AssignmentScreenMaskBtnCallback ); + // created fCreated = TRUE; if ( !(guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) { - MSYS_ChangeRegionCursor( &gAssignmentScreenMaskRegion, 0 ); + MSYS_ChangeRegionCursor( &gAssignmentScreenMaskRegion, 0 ); } - + } - else if( ( fCreated == TRUE ) && ( fShowAssignmentMenu == FALSE )&&( fShowContractMenu == FALSE ) && ( fShowTownInfo == FALSE ) ) + else if( ( fCreated == TRUE ) && ( fShowAssignmentMenu == FALSE )&&( fShowContractMenu == FALSE ) && ( fShowTownInfo == FALSE ) ) { // created, get rid of it - MSYS_RemoveRegion( &gAssignmentScreenMaskRegion ); + MSYS_RemoveRegion( &gAssignmentScreenMaskRegion ); // not created fCreated = FALSE; @@ -5995,7 +6039,7 @@ void CreateDestroyScreenMaskForAssignmentAndContractMenus( void ) void AssignmentScreenMaskBtnCallback(MOUSE_REGION * pRegion, INT32 iReason ) { // btn callback handler for assignment screen mask region - + if( ( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP ) || ( iReason & MSYS_CALLBACK_REASON_RBUTTON_UP ) ) { if( fFirstClickInAssignmentScreenMask == TRUE ) @@ -6006,11 +6050,11 @@ void AssignmentScreenMaskBtnCallback(MOUSE_REGION * pRegion, INT32 iReason ) // button event, stop showing menus fShowAssignmentMenu = FALSE; - + fShowVehicleMenu = FALSE; fShowContractMenu = FALSE; - + // stop showing town mine info fShowTownInfo = FALSE; @@ -6019,13 +6063,13 @@ void AssignmentScreenMaskBtnCallback(MOUSE_REGION * pRegion, INT32 iReason ) bSelectedContractChar = -1; fGlowContractRegion = FALSE; - + // update mapscreen - fTeamPanelDirty = TRUE; + fTeamPanelDirty = TRUE; fCharacterInfoPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; - gfRenderPBInterface = TRUE; + gfRenderPBInterface = TRUE; SetRenderFlags( RENDER_FLAG_FULL ); } @@ -6052,7 +6096,7 @@ void ClearScreenMaskForMapScreenExit( void ) CreateDestroyMouseRegionsForTrainingMenu( ); CreateDestroyMouseRegionsForAttributeMenu( ); CreateDestroyMouseRegionsForSquadMenu( TRUE ); - CreateDestroyMouseRegionForRepairMenu( ); + CreateDestroyMouseRegionForRepairMenu( ); return; } @@ -6082,7 +6126,7 @@ void CreateDestroyMouseRegions( void ) { // grab height of font - iFontHeight = GetLineSpace( ghAssignmentBox ) + GetFontHeight( GetBoxFont( ghAssignmentBox ) ); + iFontHeight = GetLineSpace( ghAssignmentBox ) + GetFontHeight( GetBoxFont( ghAssignmentBox ) ); // get x.y position of box GetBoxPosition( ghAssignmentBox, &pPosition); @@ -6106,7 +6150,7 @@ void CreateDestroyMouseRegions( void ) MSYS_DefineRegion( &gAssignmentMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAssignmentBox ) + ( iFontHeight ) * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAssignmentBox ) + ( iFontHeight ) * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST - 4 , - MSYS_NO_CURSOR, AssignmentMenuMvtCallBack, AssignmentMenuBtnCallback ); + MSYS_NO_CURSOR, AssignmentMenuMvtCallBack, AssignmentMenuBtnCallback ); // set user defines MSYS_SetRegionUserData( &gAssignmentMenuRegion[ iCounter ], 0, iCounter ); @@ -6115,7 +6159,7 @@ void CreateDestroyMouseRegions( void ) // created fCreated = TRUE; - // pause game + // pause game PauseGame( ); fMapPanelDirty = TRUE; @@ -6129,14 +6173,14 @@ void CreateDestroyMouseRegions( void ) } else if( ( fShowAssignmentMenu == FALSE ) && ( fCreated == TRUE ) ) { - // destroy + // destroy for( iCounter = 0; iCounter < GetNumberOfLinesOfTextInBox( ghAssignmentBox ); iCounter++ ) { MSYS_RemoveRegion( &gAssignmentMenuRegion[ iCounter ] ); } RestorePopUpBoxes(); - + // not created fCreated = FALSE; } @@ -6165,26 +6209,26 @@ void CreateDestroyMouseRegionsForContractMenu( void ) if( fShowRemoveMenu == TRUE ) { // dead guy handle menu stuff - fShowRemoveMenu = fShowContractMenu; + fShowRemoveMenu = fShowContractMenu; - // ATE: Added this setting of global variable 'cause - // it will cause an assert failure in GetSelectedAssignSoldier() - bSelectedAssignChar = bSelectedContractChar; + // ATE: Added this setting of global variable 'cause + // it will cause an assert failure in GetSelectedAssignSoldier() + bSelectedAssignChar = bSelectedContractChar; CreateDestroyMouseRegionsForRemoveMenu( ); return; } - if( Menptr[gCharactersList[bSelectedContractChar].usSolID].bLife == 0 ) + if( Menptr[gCharactersList[bSelectedContractChar].usSolID].stats.bLife == 0 ) { // dead guy handle menu stuff - fShowRemoveMenu = fShowContractMenu; + fShowRemoveMenu = fShowContractMenu; + + // ATE: Added this setting of global variable 'cause + // it will cause an assert failure in GetSelectedAssignSoldier() + bSelectedAssignChar = bSelectedContractChar; - // ATE: Added this setting of global variable 'cause - // it will cause an assert failure in GetSelectedAssignSoldier() - bSelectedAssignChar = bSelectedContractChar; - CreateDestroyMouseRegionsForRemoveMenu( ); return; @@ -6201,10 +6245,10 @@ void CreateDestroyMouseRegionsForContractMenu( void ) if( fShowContractMenu ) { - SetBoxPosition( ghContractBox , ContractPosition ); + SetBoxPosition( ghContractBox , ContractPosition ); } // grab height of font - iFontHeight = GetLineSpace( ghContractBox ) + GetFontHeight( GetBoxFont( ghContractBox ) ); + iFontHeight = GetLineSpace( ghContractBox ) + GetFontHeight( GetBoxFont( ghContractBox ) ); // get x.y position of box GetBoxPosition( ghContractBox, &pPosition); @@ -6225,10 +6269,10 @@ void CreateDestroyMouseRegionsForContractMenu( void ) for( iCounter = 0; iCounter < GetNumberOfLinesOfTextInBox( ghContractBox ); iCounter++ ) { // add mouse region for each line of text..and set user data - + MSYS_DefineRegion( &gContractMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghContractBox ) + ( iFontHeight ) * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghContractBox ) + ( iFontHeight ) * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST - 4 , - MSYS_NO_CURSOR, ContractMenuMvtCallback, ContractMenuBtnCallback ); + MSYS_NO_CURSOR, ContractMenuMvtCallback, ContractMenuBtnCallback ); // set user defines MSYS_SetRegionUserData( &gContractMenuRegion[ iCounter ], 0, iCounter ); @@ -6237,7 +6281,7 @@ void CreateDestroyMouseRegionsForContractMenu( void ) // created fCreated = TRUE; - // pause game + // pause game PauseGame( ); // unhighlight all strings in box @@ -6246,7 +6290,7 @@ void CreateDestroyMouseRegionsForContractMenu( void ) } else if( ( fShowContractMenu == FALSE ) && ( fCreated == TRUE ) ) { - // destroy + // destroy for( iCounter = 0; iCounter < GetNumberOfLinesOfTextInBox( ghContractBox ); iCounter++ ) { MSYS_RemoveRegion( &gContractMenuRegion[ iCounter ] ); @@ -6297,15 +6341,15 @@ void CreateDestroyMouseRegionsForTrainingMenu( void ) if( ( fShowTrainingMenu ) && ( guiCurrentScreen == MAP_SCREEN ) ) { - SetBoxPosition( ghTrainingBox, TrainPosition ); + SetBoxPosition( ghTrainingBox, TrainPosition ); } - + HandleShadingOfLinesForTrainingMenu( ); CheckAndUpdateTacticalAssignmentPopUpPositions( ); // grab height of font - iFontHeight = GetLineSpace( ghTrainingBox ) + GetFontHeight( GetBoxFont( ghTrainingBox ) ); + iFontHeight = GetLineSpace( ghTrainingBox ) + GetFontHeight( GetBoxFont( ghTrainingBox ) ); // get x.y position of box GetBoxPosition( ghTrainingBox, &pPosition); @@ -6327,10 +6371,10 @@ void CreateDestroyMouseRegionsForTrainingMenu( void ) for( iCounter = 0; iCounter < GetNumberOfLinesOfTextInBox( ghTrainingBox ); iCounter++ ) { // add mouse region for each line of text..and set user data - + MSYS_DefineRegion( &gTrainingMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghTrainingBox ) + ( iFontHeight ) * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghTrainingBox ) + ( iFontHeight ) * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST - 3 , - MSYS_NO_CURSOR, TrainingMenuMvtCallBack, TrainingMenuBtnCallback ); + MSYS_NO_CURSOR, TrainingMenuMvtCallBack, TrainingMenuBtnCallback ); // set user defines MSYS_SetRegionUserData( &gTrainingMenuRegion[ iCounter ], 0, iCounter ); @@ -6345,7 +6389,7 @@ void CreateDestroyMouseRegionsForTrainingMenu( void ) } else if( ( ( fShowAssignmentMenu == FALSE ) || ( fShowTrainingMenu == FALSE ) ) && ( fCreated == TRUE ) ) { - // destroy + // destroy for( iCounter = 0; iCounter < GetNumberOfLinesOfTextInBox( ghTrainingBox ); iCounter++ ) { MSYS_RemoveRegion( &gTrainingMenuRegion[ iCounter ] ); @@ -6365,7 +6409,7 @@ void CreateDestroyMouseRegionsForTrainingMenu( void ) fMapScreenBottomDirty = TRUE; HideBox( ghTrainingBox ); SetRenderFlags( RENDER_FLAG_FULL ); - + // not created fCreated = FALSE; @@ -6390,7 +6434,7 @@ void CreateDestroyMouseRegionsForAttributeMenu( void ) INT32 iBoxWidth = 0; SGPRect pDimensions; - // will create/destroy mouse regions for the map screen attribute menu + // will create/destroy mouse regions for the map screen attribute menu @@ -6399,14 +6443,14 @@ void CreateDestroyMouseRegionsForAttributeMenu( void ) if( ( fShowAssignmentMenu ) && ( guiCurrentScreen == MAP_SCREEN ) ) { - SetBoxPosition( ghAssignmentBox, AssignmentPosition ); + SetBoxPosition( ghAssignmentBox, AssignmentPosition ); } HandleShadingOfLinesForAttributeMenus( ); CheckAndUpdateTacticalAssignmentPopUpPositions( ); // grab height of font - iFontHeight = GetLineSpace( ghAttributeBox ) + GetFontHeight( GetBoxFont( ghAttributeBox ) ); + iFontHeight = GetLineSpace( ghAttributeBox ) + GetFontHeight( GetBoxFont( ghAttributeBox ) ); // get x.y position of box GetBoxPosition( ghAttributeBox, &pPosition); @@ -6427,10 +6471,10 @@ void CreateDestroyMouseRegionsForAttributeMenu( void ) for( iCounter = 0; iCounter < GetNumberOfLinesOfTextInBox( ghAttributeBox ); iCounter++ ) { // add mouse region for each line of text..and set user data - + MSYS_DefineRegion( &gAttributeMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAttributeBox ) + ( iFontHeight ) * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAttributeBox ) + ( iFontHeight ) * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST - 2 , - MSYS_NO_CURSOR, AttributeMenuMvtCallBack, AttributesMenuBtnCallback ); + MSYS_NO_CURSOR, AttributeMenuMvtCallBack, AttributesMenuBtnCallback ); // set user defines MSYS_SetRegionUserData( &gAttributeMenuRegion[ iCounter ], 0, iCounter ); @@ -6445,14 +6489,14 @@ void CreateDestroyMouseRegionsForAttributeMenu( void ) } else if( ( ( fShowAssignmentMenu == FALSE ) || ( fShowTrainingMenu == FALSE ) ||( fShowAttributeMenu == FALSE) ) && ( fCreated == TRUE ) ) { - // destroy + // destroy for( iCounter = 0; iCounter < GetNumberOfLinesOfTextInBox( ghAttributeBox ); iCounter++ ) { MSYS_RemoveRegion( &gAttributeMenuRegion[ iCounter ] ); } // stop showing training menu - if( ( fShowAssignmentMenu == FALSE )||( fShowTrainingMenu == FALSE ) || ( fShowAttributeMenu == FALSE)) + if( ( fShowAssignmentMenu == FALSE )||( fShowTrainingMenu == FALSE ) || ( fShowAttributeMenu == FALSE)) { fShowAttributeMenu = FALSE; gfRenderPBInterface = TRUE; @@ -6492,13 +6536,13 @@ void CreateDestroyMouseRegionsForRemoveMenu( void ) INT32 iBoxWidth = 0; SGPRect pDimensions; - // will create/destroy mouse regions for the map screen attribute menu + // will create/destroy mouse regions for the map screen attribute menu if( ( ( fShowAssignmentMenu == TRUE ) || ( fShowContractMenu == TRUE ) ) && ( fCreated == FALSE ) ) { if( fShowContractMenu ) { - SetBoxPosition( ghContractBox , ContractPosition ); + SetBoxPosition( ghContractBox , ContractPosition ); } else { @@ -6519,7 +6563,7 @@ void CreateDestroyMouseRegionsForRemoveMenu( void ) CheckAndUpdateTacticalAssignmentPopUpPositions( ); // grab height of font - iFontHeight = GetLineSpace( ghRemoveMercAssignBox ) + GetFontHeight( GetBoxFont( ghRemoveMercAssignBox ) ); + iFontHeight = GetLineSpace( ghRemoveMercAssignBox ) + GetFontHeight( GetBoxFont( ghRemoveMercAssignBox ) ); // get x.y position of box GetBoxPosition( ghRemoveMercAssignBox, &pPosition); @@ -6540,10 +6584,10 @@ void CreateDestroyMouseRegionsForRemoveMenu( void ) for( iCounter = 0; iCounter < GetNumberOfLinesOfTextInBox( ghRemoveMercAssignBox ); iCounter++ ) { // add mouse region for each line of text..and set user data - + MSYS_DefineRegion( &gRemoveMercAssignRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAttributeBox ) + ( iFontHeight ) * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAttributeBox ) + ( iFontHeight ) * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST - 2 , - MSYS_NO_CURSOR, RemoveMercMenuMvtCallBack, RemoveMercMenuBtnCallback ); + MSYS_NO_CURSOR, RemoveMercMenuMvtCallBack, RemoveMercMenuBtnCallback ); // set user defines MSYS_SetRegionUserData( &gRemoveMercAssignRegion[ iCounter ], 0, iCounter ); @@ -6556,9 +6600,9 @@ void CreateDestroyMouseRegionsForRemoveMenu( void ) UnHighLightBox( ghRemoveMercAssignBox ); } - else if( ( fShowAssignmentMenu == FALSE ) && ( fCreated == TRUE ) && ( fShowContractMenu == FALSE ) ) + else if( ( fShowAssignmentMenu == FALSE ) && ( fCreated == TRUE ) && ( fShowContractMenu == FALSE ) ) { - // destroy + // destroy for( iCounter = 0; iCounter < GetNumberOfLinesOfTextInBox( ghRemoveMercAssignBox ); iCounter++ ) { MSYS_RemoveRegion( &gRemoveMercAssignRegion[ iCounter ] ); @@ -6566,8 +6610,8 @@ void CreateDestroyMouseRegionsForRemoveMenu( void ) fShownContractMenu = FALSE; - // stop showing menu - if( fShowRemoveMenu == FALSE ) + // stop showing menu + if( fShowRemoveMenu == FALSE ) { fShowAttributeMenu = FALSE; fMapPanelDirty = TRUE; @@ -6588,7 +6632,7 @@ void CreateDestroyMouseRegionsForRemoveMenu( void ) // and the assignment menu itself!!! fShowAssignmentMenu = FALSE; - // not created + // not created fCreated = FALSE; } @@ -6608,7 +6652,7 @@ void CreateDestroyMouseRegionsForSquadMenu( BOOLEAN fPositionBox ) SGPRect pDimensions; - // will create/destroy mouse regions for the map screen attribute menu + // will create/destroy mouse regions for the map screen attribute menu if( ( fShowSquadMenu == TRUE ) && ( fCreated == FALSE ) ) { @@ -6619,7 +6663,7 @@ void CreateDestroyMouseRegionsForSquadMenu( BOOLEAN fPositionBox ) CheckAndUpdateTacticalAssignmentPopUpPositions( ); // grab height of font - iFontHeight = GetLineSpace( ghSquadBox ) + GetFontHeight( GetBoxFont( ghSquadBox ) ); + iFontHeight = GetLineSpace( ghSquadBox ) + GetFontHeight( GetBoxFont( ghSquadBox ) ); // get x.y position of box GetBoxPosition( ghSquadBox, &pPosition); @@ -6642,14 +6686,14 @@ void CreateDestroyMouseRegionsForSquadMenu( BOOLEAN fPositionBox ) { // add mouse region for each line of text..and set user data MSYS_DefineRegion( &gSquadMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghSquadBox ) + ( iFontHeight ) * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghSquadBox ) + ( iFontHeight ) * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST - 2 , - MSYS_NO_CURSOR, SquadMenuMvtCallBack, SquadMenuBtnCallback ); + MSYS_NO_CURSOR, SquadMenuMvtCallBack, SquadMenuBtnCallback ); MSYS_SetRegionUserData( &gSquadMenuRegion[ iCounter ], 0, iCounter ); } // now create cancel region MSYS_DefineRegion( &gSquadMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghSquadBox ) + ( iFontHeight ) * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghSquadBox ) + ( iFontHeight ) * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST - 2 , - MSYS_NO_CURSOR, SquadMenuMvtCallBack, SquadMenuBtnCallback ); + MSYS_NO_CURSOR, SquadMenuMvtCallBack, SquadMenuBtnCallback ); MSYS_SetRegionUserData( &gSquadMenuRegion[ iCounter ], 0, SQUAD_MENU_CANCEL ); @@ -6668,7 +6712,7 @@ void CreateDestroyMouseRegionsForSquadMenu( BOOLEAN fPositionBox ) } else if( ( ( fShowAssignmentMenu == FALSE ) || ( fShowSquadMenu == FALSE ) ) && ( fCreated == TRUE ) ) { - // destroy + // destroy for( iCounter = 0; iCounter < GetNumberOfLinesOfTextInBox( ghSquadBox ); iCounter++ ) { MSYS_RemoveRegion( &gSquadMenuRegion[ iCounter ] ); @@ -6721,7 +6765,7 @@ void AssignmentMenuMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason ) if (iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) { // is the line shaded?..if so, don't highlight - if( pSoldier -> ubWhatKindOfMercAmI == MERC_TYPE__EPC ) + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC ) { if( GetBoxShadeFlag( ghEpcBox, iValue ) == FALSE ) { @@ -6738,7 +6782,7 @@ void AssignmentMenuMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { - if( pSoldier -> ubWhatKindOfMercAmI == MERC_TYPE__EPC ) + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC ) { // unhighlight all strings in box UnHighLightBox( ghEpcBox ); @@ -6756,7 +6800,7 @@ void RemoveMercMenuMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason ) { // mvt callback handler for assignment region INT32 iValue = -1; - + iValue = MSYS_GetRegionUserData( pRegion, 0 ); if (iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) @@ -6782,7 +6826,7 @@ void ContractMenuMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) { // mvt callback handler for Contract region INT32 iValue = -1; - + iValue = MSYS_GetRegionUserData( pRegion, 0 ); if (iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) @@ -6811,7 +6855,7 @@ void SquadMenuMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason ) { // mvt callback handler for assignment region INT32 iValue = -1; - + iValue = MSYS_GetRegionUserData( pRegion, 0 ); if (iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) @@ -6829,7 +6873,7 @@ void SquadMenuMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason ) else { // highlight cancel line - HighLightBoxLine( ghSquadBox, GetNumberOfLinesOfTextInBox( ghSquadBox ) - 1 ); + HighLightBoxLine( ghSquadBox, GetNumberOfLinesOfTextInBox( ghSquadBox ) - 1 ); } } else if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) @@ -6858,7 +6902,7 @@ void RemoveMercMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) { switch( iValue ) { - case( REMOVE_MERC_CANCEL ): + case( REMOVE_MERC_CANCEL ): // stop showing menus fShowAssignmentMenu = FALSE; @@ -6875,7 +6919,7 @@ void RemoveMercMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) fMapScreenBottomDirty = TRUE; gfRenderPBInterface = TRUE; - + // stop contratc glow if we are fGlowContractRegion = FALSE; giContractHighLine = -1; @@ -6903,8 +6947,8 @@ void RemoveMercMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) fShowAssignmentMenu = FALSE; fShowContractMenu = FALSE; - //Def: 10/13/99: When a merc is either dead or a POW, the Remove Merc popup comes up instead of the - // Assign menu popup. When the the user removes the merc, we need to make sure the assignment menu + //Def: 10/13/99: When a merc is either dead or a POW, the Remove Merc popup comes up instead of the + // Assign menu popup. When the the user removes the merc, we need to make sure the assignment menu //doesnt come up ( because the both assign menu and remove menu flags are needed for the remove pop up to appear //dont ask why?!! ) fShownContractMenu = FALSE; @@ -6919,11 +6963,11 @@ void RemoveMercMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) void BeginRemoveMercFromContract( SOLDIERTYPE *pSoldier ) { // This function will setup the quote, then start dialogue beginning the actual leave sequence - if( ( pSoldier->bLife > 0 ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) ) + if( ( pSoldier->stats.bLife > 0 ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) ) { if( ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__MERC ) || ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__NPC ) ) { - HandleImportantMercQuote( pSoldier, QUOTE_RESPONSE_TO_MIGUEL_SLASH_QUOTE_MERC_OR_RPC_LETGO ); + HandleImportantMercQuote( pSoldier, QUOTE_RESPONSE_TO_MIGUEL_SLASH_QUOTE_MERC_OR_RPC_LETGO ); SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,0 ,MAP_SCREEN ,0 ,0 ,0 ); TacticalCharacterDialogueWithSpecialEvent( pSoldier, 0, DIALOGUE_SPECIAL_EVENT_CONTRACT_ENDING, 1,0 ); @@ -6955,12 +6999,12 @@ void BeginRemoveMercFromContract( SOLDIERTYPE *pSoldier ) // Only do this if they want to renew..... if ( WillMercRenew( pSoldier, FALSE ) ) { - HandleImportantMercQuote( pSoldier, QUOTE_DEPARTING_COMMENT_CONTRACT_NOT_RENEWED_OR_48_OR_MORE ); + HandleImportantMercQuote( pSoldier, QUOTE_DEPARTING_COMMENT_CONTRACT_NOT_RENEWED_OR_48_OR_MORE ); } } else if( ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__MERC ) || ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__NPC ) ) { - HandleImportantMercQuote( pSoldier, QUOTE_RESPONSE_TO_MIGUEL_SLASH_QUOTE_MERC_OR_RPC_LETGO ); + HandleImportantMercQuote( pSoldier, QUOTE_RESPONSE_TO_MIGUEL_SLASH_QUOTE_MERC_OR_RPC_LETGO ); } SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,0 ,MAP_SCREEN ,0 ,0 ,0 ); @@ -6973,7 +7017,7 @@ void BeginRemoveMercFromContract( SOLDIERTYPE *pSoldier ) // 3-6 days (but the first 1-2 days of that are spent "returning" home) gMercProfiles[ pSoldier->ubProfile ].ubDaysOfMoraleHangover = (UINT8) (3 + Random(4)); - // if it's an AIM merc, word of this gets back to AIM... Bad rep. + // if it's an AIM merc, word of this gets back to AIM... Bad rep. if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) { ModifyPlayerReputation(REPUTATION_EARLY_FIRING); @@ -6986,13 +7030,13 @@ void BeginRemoveMercFromContract( SOLDIERTYPE *pSoldier ) void MercDismissConfirmCallBack( UINT8 bExitValue ) { - if ( bExitValue == MSG_BOX_RETURN_YES ) - { - // Setup history code - gpDismissSoldier->ubLeaveHistoryCode = HISTORY_MERC_FIRED; + if ( bExitValue == MSG_BOX_RETURN_YES ) + { + // Setup history code + gpDismissSoldier->ubLeaveHistoryCode = HISTORY_MERC_FIRED; - BeginRemoveMercFromContract( gpDismissSoldier ); - } + BeginRemoveMercFromContract( gpDismissSoldier ); + } } @@ -7057,7 +7101,7 @@ void ContractMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) switch( iValue ) { - case( CONTRACT_MENU_DAY ): + case( CONTRACT_MENU_DAY ): MercContractHandling( pSoldier, CONTRACT_EXTEND_1_DAY ); PostContractMessage( pSoldier, CONTRACT_EXTEND_1_DAY ); fOkToClose = TRUE; @@ -7074,22 +7118,22 @@ void ContractMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) break; case( CONTRACT_MENU_TERMINATE ): - gpDismissSoldier = pSoldier; + gpDismissSoldier = pSoldier; - // If in the renewal sequence.. do right away... - // else put up requester. - if ( gfInContractMenuFromRenewSequence ) - { - MercDismissConfirmCallBack( MSG_BOX_RETURN_YES ); - } - else - { + // If in the renewal sequence.. do right away... + // else put up requester. + if ( gfInContractMenuFromRenewSequence ) + { + MercDismissConfirmCallBack( MSG_BOX_RETURN_YES ); + } + else + { // The game should be unpaused when this message box disappears UnPauseGame(); - DoMapMessageBox( MSG_BOX_BASIC_STYLE, gzLateLocalizedString[ 48 ], MAP_SCREEN, MSG_BOX_FLAG_YESNO, MercDismissConfirmCallBack ); - } + DoMapMessageBox( MSG_BOX_BASIC_STYLE, gzLateLocalizedString[ 48 ], MAP_SCREEN, MSG_BOX_FLAG_YESNO, MercDismissConfirmCallBack ); + } - fOkToClose = TRUE; + fOkToClose = TRUE; break; } @@ -7107,11 +7151,11 @@ void ContractMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) fGlowContractRegion = FALSE; fShowContractMenu = FALSE; - // dirty region + // dirty region fTeamPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; fCharacterInfoPanelDirty = TRUE; - gfRenderPBInterface = TRUE; + gfRenderPBInterface = TRUE; } @@ -7124,7 +7168,7 @@ void TrainingMenuMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason ) { // mvt callback handler for assignment region INT32 iValue = -1; - + iValue = MSYS_GetRegionUserData( pRegion, 0 ); if( HandleAssignmentExpansionAndHighLightForTrainingMenu( ) == TRUE ) @@ -7139,8 +7183,8 @@ void TrainingMenuMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason ) // do not highlight current balance if( GetBoxShadeFlag( ghTrainingBox, iValue ) == FALSE ) { - // get the string line handle - HighLightBoxLine( ghTrainingBox, iValue ); + // get the string line handle + HighLightBoxLine( ghTrainingBox, iValue ); } } else if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) @@ -7156,7 +7200,7 @@ void AttributeMenuMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason ) { // mvt callback handler for assignment region INT32 iValue = -1; - + iValue = MSYS_GetRegionUserData( pRegion, 0 ); if (iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) @@ -7201,7 +7245,7 @@ void SquadMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) { // stop displaying, leave fShowSquadMenu = FALSE; - + // unhighlight the assignment box UnHighLightBox( ghAssignmentBox ); @@ -7214,10 +7258,10 @@ void SquadMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) return; } - bCanJoinSquad = CanCharacterSquad( pSoldier, ( INT8 )iValue ); - // can the character join this squad? (If already in it, accept that as a legal choice and exit menu) + bCanJoinSquad = CanCharacterSquad( pSoldier, ( INT8 )iValue ); + // can the character join this squad? (If already in it, accept that as a legal choice and exit menu) if ( ( bCanJoinSquad == CHARACTER_CAN_JOIN_SQUAD ) || - ( bCanJoinSquad == CHARACTER_CANT_JOIN_SQUAD_ALREADY_IN_IT ) ) + ( bCanJoinSquad == CHARACTER_CANT_JOIN_SQUAD_ALREADY_IN_IT ) ) { if ( bCanJoinSquad == CHARACTER_CAN_JOIN_SQUAD ) { @@ -7228,13 +7272,13 @@ void SquadMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) iOldSquadValue = SquadCharacterIsIn( pSoldier ); // grab if char was between sectors - fCharacterWasBetweenSectors = pSoldier -> fBetweenSectors; + fCharacterWasBetweenSectors = pSoldier->flags.fBetweenSectors; if( fCharacterWasBetweenSectors ) { - if( pSoldier -> bAssignment == VEHICLE ) + if( pSoldier->bAssignment == VEHICLE ) { - if( GetNumberInVehicle( pSoldier -> iVehicleId ) == 1 ) + if( GetNumberInVehicle( pSoldier->iVehicleId ) == 1 ) { // can't change, go away return; @@ -7242,9 +7286,9 @@ void SquadMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) } } - if( pSoldier -> ubGroupID ) + if( pSoldier->ubGroupID ) { - GetGroupPosition(&ubNextX, &ubNextY, &ubPrevX, &ubPrevY, &uiTraverseTime, &uiArriveTime, pSoldier -> ubGroupID ); + GetGroupPosition(&ubNextX, &ubNextY, &ubPrevX, &ubPrevY, &uiTraverseTime, &uiArriveTime, pSoldier->ubGroupID ); } */ pSoldier->bOldAssignment = pSoldier->bAssignment; @@ -7256,15 +7300,15 @@ void SquadMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) AddCharacterToSquad( pSoldier, ( INT8 )iValue ); - if( pSoldier->bOldAssignment == VEHICLE ) + if( pSoldier->bOldAssignment == VEHICLE ) { - SetSoldierExitVehicleInsertionData( pSoldier, pSoldier->iVehicleId ); + SetSoldierExitVehicleInsertionData( pSoldier, pSoldier->iVehicleId ); } //Clear any desired squad assignments -- seeing the player has physically changed it! - pSoldier -> ubNumTraversalsAllowedToMerge = 0; - pSoldier -> ubDesiredSquadAssignment = NO_ASSIGNMENT; - + pSoldier->ubNumTraversalsAllowedToMerge = 0; + pSoldier->ubDesiredSquadAssignment = NO_ASSIGNMENT; + /* ARM: Squad menu is now disabled for anyone between sectors if( fCharacterWasBetweenSectors ) @@ -7272,10 +7316,10 @@ void SquadMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) // grab location of old squad and set this value for new squad if( iOldSquadValue != -1 ) { - GetSquadPosition( &ubNextX, &ubNextY, &ubPrevX, &ubPrevY, &uiTraverseTime, &uiArriveTime, ( UINT8 )iOldSquadValue ); + GetSquadPosition( &ubNextX, &ubNextY, &ubPrevX, &ubPrevY, &uiTraverseTime, &uiArriveTime, ( UINT8 )iOldSquadValue ); } - SetGroupPosition( ubNextX, ubNextY, ubPrevX, ubPrevY, uiTraverseTime, uiArriveTime, pSoldier -> ubGroupID ); + SetGroupPosition( ubNextX, ubNextY, ubPrevX, ubPrevY, uiTraverseTime, uiArriveTime, pSoldier->ubGroupID ); } */ @@ -7381,7 +7425,7 @@ void TrainingMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) break; case( TRAIN_MENU_TOWN): - if( BasicCanCharacterTrainMilitia(pSoldier) ) + if( BasicCanCharacterTrainMilitia(pSoldier) ) { bTownId = GetTownIdForSector( pSoldier->sSectorX, pSoldier->sSectorY ); @@ -7413,7 +7457,7 @@ void TrainingMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) fCanTrainMilitia = FALSE; else if (IsThisSectorASAMSector(pSoldier->sSectorX,pSoldier->sSectorY,0 )) fCanTrainMilitia = FALSE; - else + else fCanTrainMilitia = TRUE; @@ -7422,7 +7466,7 @@ void TrainingMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) if( bTownId == BLANK_SECTOR ) { // SAM site - GetShortSectorString( pSoldier->sSectorX, pSoldier->sSectorY, sStringA ); + GetShortSectorString( pSoldier->sSectorX, pSoldier->sSectorY, sStringA ); swprintf( sString, zMarksMapScreenText[ 21 ], sStringA ); } else @@ -7433,7 +7477,7 @@ void TrainingMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) DoScreenIndependantMessageBox( sString, MSG_BOX_FLAG_OK, NULL ); break; - } + } if ( CountMilitiaTrainersInSoldiersSector( pSoldier ) >= gGameExternalOptions.ubMaxMilitiaTrainersPerSector ) { @@ -7445,8 +7489,8 @@ void TrainingMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) // PASSED ALL THE TESTS - ALLOW SOLDIER TO TRAIN MILITIA HERE - pSoldier -> bOldAssignment = pSoldier -> bAssignment; - + pSoldier->bOldAssignment = pSoldier->bAssignment; + if( ( pSoldier->bAssignment != TRAIN_TOWN ) ) { SetTimeOfAssignmentChangeForMerc( pSoldier ); @@ -7455,7 +7499,7 @@ void TrainingMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) MakeSoldiersTacticalAnimationReflectAssignment( pSoldier ); // stop showing menu - fShowAssignmentMenu = FALSE; + fShowAssignmentMenu = FALSE; giAssignHighLine = -1; // remove from squad @@ -7464,13 +7508,13 @@ void TrainingMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) { TakeSoldierOutOfVehicle( pSoldier ); } - RemoveCharacterFromSquads( pSoldier ); - + RemoveCharacterFromSquads( pSoldier ); + ChangeSoldiersAssignment( pSoldier, TRAIN_TOWN ); // assign to a movement group AssignMercToAMovementGroup( pSoldier ); - if( SectorInfo[ SECTOR( pSoldier -> sSectorX, pSoldier -> sSectorY ) ].fMilitiaTrainingPaid == FALSE ) + if( SectorInfo[ SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ].fMilitiaTrainingPaid == FALSE ) { // show a message to confirm player wants to charge cost HandleInterfaceMessageForCostOfTrainingMilitia( pSoldier ); @@ -7479,7 +7523,7 @@ void TrainingMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) { SetAssignmentForList( TRAIN_TOWN, 0 ); } - + gfRenderPBInterface = TRUE; } @@ -7510,14 +7554,14 @@ void TrainingMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) break; case( TRAIN_MENU_CANCEL ): // stop showing menu - fShowTrainingMenu = FALSE; - - // unhighlight the assignment box - UnHighLightBox( ghAssignmentBox ); + fShowTrainingMenu = FALSE; - // reset list - ResetSelectedListForMapScreen( ); - gfRenderPBInterface = TRUE; + // unhighlight the assignment box + UnHighLightBox( ghAssignmentBox ); + + // reset list + ResetSelectedListForMapScreen( ); + gfRenderPBInterface = TRUE; break; } @@ -7564,7 +7608,7 @@ void AttributesMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) // unhighlight the training box UnHighLightBox( ghTrainingBox ); } - else if( CanCharacterTrainStat( pSoldier, ( INT8 )( iValue ), ( BOOLEAN )( ( gbTrainingMode == TRAIN_SELF ) || ( gbTrainingMode == TRAIN_BY_OTHER ) ), ( BOOLEAN )( gbTrainingMode == TRAIN_TEAMMATE ) ) ) + else if( CanCharacterTrainStat( pSoldier, ( INT8 )( iValue ), ( BOOLEAN )( ( gbTrainingMode == TRAIN_SELF ) || ( gbTrainingMode == TRAIN_BY_OTHER ) ), ( BOOLEAN )( gbTrainingMode == TRAIN_TEAMMATE ) ) ) { pSoldier->bOldAssignment = pSoldier->bAssignment; @@ -7574,7 +7618,7 @@ void AttributesMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) } // set stat to train - pSoldier -> bTrainStat = ( INT8 )iValue; + pSoldier->bTrainStat = ( INT8 )iValue; MakeSoldiersTacticalAnimationReflectAssignment( pSoldier ); @@ -7632,7 +7676,7 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) UnHighLightBox( ghAssignmentBox ); - if( pSoldier -> ubWhatKindOfMercAmI == MERC_TYPE__EPC ) + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC ) { switch( iValue ) { @@ -7653,7 +7697,7 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) if( CanCharacterPatient( pSoldier ) ) { -/* Assignment distance limits removed. Sep/11/98. ARM +/* Assignment distance limits removed. Sep/11/98. ARM if( IsSoldierCloseEnoughToADoctor( pSoldier ) == FALSE ) { return; @@ -7683,7 +7727,7 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) { TakeSoldierOutOfVehicle( pSoldier ); } - RemoveCharacterFromSquads( pSoldier ); + RemoveCharacterFromSquads( pSoldier ); ChangeSoldiersAssignment( pSoldier, PATIENT ); AssignMercToAMovementGroup( pSoldier ); @@ -7691,7 +7735,7 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) SetAssignmentForList( ( INT8 ) PATIENT, 0 ); } break; - + case( EPC_MENU_VEHICLE ): if ( CanCharacterVehicle( pSoldier ) ) { @@ -7710,7 +7754,7 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) case( EPC_MENU_REMOVE ): fShowAssignmentMenu = FALSE; - UnEscortEPC( pSoldier ); + UnEscortEPC( pSoldier ); break; case( EPC_MENU_CANCEL ): @@ -7751,21 +7795,21 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) fShowAssignmentMenu = FALSE; giAssignHighLine = -1; - - pSoldier -> bOldAssignment = pSoldier -> bAssignment; + + pSoldier->bOldAssignment = pSoldier->bAssignment; if( ( pSoldier->bAssignment != DOCTOR ) ) { SetTimeOfAssignmentChangeForMerc( pSoldier ); } - + // remove from squad if( pSoldier->bOldAssignment == VEHICLE ) { TakeSoldierOutOfVehicle( pSoldier ); } - RemoveCharacterFromSquads( pSoldier ); + RemoveCharacterFromSquads( pSoldier ); ChangeSoldiersAssignment( pSoldier, DOCTOR ); @@ -7797,15 +7841,15 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) // can character patient? if( CanCharacterPatient( pSoldier ) ) { - -/* Assignment distance limits removed. Sep/11/98. ARM + +/* Assignment distance limits removed. Sep/11/98. ARM if( IsSoldierCloseEnoughToADoctor( pSoldier ) == FALSE ) { return; } */ - pSoldier -> bOldAssignment = pSoldier -> bAssignment; + pSoldier->bOldAssignment = pSoldier->bAssignment; if( ( pSoldier->bAssignment != PATIENT ) ) { @@ -7828,7 +7872,7 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) { TakeSoldierOutOfVehicle( pSoldier ); } - RemoveCharacterFromSquads( pSoldier ); + RemoveCharacterFromSquads( pSoldier ); ChangeSoldiersAssignment( pSoldier, PATIENT ); AssignMercToAMovementGroup( pSoldier ); @@ -7838,7 +7882,7 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) } break; - + case( ASSIGN_MENU_VEHICLE ): if ( CanCharacterVehicle( pSoldier ) ) { @@ -7846,7 +7890,7 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) { fShowVehicleMenu = TRUE; ShowBox( ghVehicleBox ); - } + } else { fShowVehicleMenu = FALSE; @@ -7862,11 +7906,11 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) fShowVehicleMenu = FALSE; fTeamPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; - - pSoldier -> bOldAssignment = pSoldier -> bAssignment; - - if( pSoldier -> bSectorZ ==0 ) + pSoldier->bOldAssignment = pSoldier->bAssignment; + + + if( pSoldier->bSectorZ ==0 ) { fShowRepairMenu = FALSE; @@ -7874,9 +7918,9 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) { fShowRepairMenu = TRUE; } - + } - + } else if( CanCharacterRepairButDoesntHaveARepairkit( pSoldier ) ) { @@ -7930,7 +7974,7 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) gfRenderPBInterface = TRUE; // set dirty flag - fTeamPanelDirty = TRUE; + fTeamPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; return; @@ -7943,11 +7987,11 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) void RestorePopUpBoxes( void ) { ContractPosition.iX = OrigContractPosition.iX; - AttributePosition.iX = OrigAttributePosition.iX; - SquadPosition.iX = OrigSquadPosition.iX ; - AssignmentPosition.iX = OrigAssignmentPosition.iX ; - TrainPosition.iX = OrigTrainPosition.iX; - VehiclePosition.iX = OrigVehiclePosition.iX; + AttributePosition.iX = OrigAttributePosition.iX; + SquadPosition.iX = OrigSquadPosition.iX ; + AssignmentPosition.iX = OrigAssignmentPosition.iX ; + TrainPosition.iX = OrigTrainPosition.iX; + VehiclePosition.iX = OrigVehiclePosition.iX; return; } @@ -7958,15 +8002,15 @@ void CreateSquadBox( void ) // will create a pop up box for squad selection SGPPoint pPoint; SGPRect pDimensions; - UINT32 hStringHandle; - UINT32 uiCounter; + UINT32 hStringHandle; + UINT32 uiCounter; CHAR16 sString[ 64 ]; UINT32 uiMaxSquad; - + // create basic box CreatePopUpBox(&ghSquadBox, SquadDimensions, SquadPosition, (POPUP_BOX_FLAG_CLIP_TEXT|POPUP_BOX_FLAG_RESIZE )); - + // which buffer will box render to SetBoxBuffer(ghSquadBox, FRAME_BUFFER); @@ -7991,16 +8035,16 @@ void CreateSquadBox( void ) // add strings for box for(uiCounter=0; uiCounter <= uiMaxSquad; uiCounter++) { - // get info about current squad and put in string - swprintf( sString, L"%s ( %d/%d )", pSquadMenuStrings[uiCounter], NumberOfPeopleInSquad( ( INT8 )uiCounter ), NUMBER_OF_SOLDIERS_PER_SQUAD ); - AddMonoString(&hStringHandle, sString ); + // get info about current squad and put in string + swprintf( sString, L"%s ( %d/%d )", pSquadMenuStrings[uiCounter], NumberOfPeopleInSquad( ( INT8 )uiCounter ), NUMBER_OF_SOLDIERS_PER_SQUAD ); + AddMonoString(&hStringHandle, sString ); - // make sure it is unhighlighted - UnHighLightLine(hStringHandle); + // make sure it is unhighlighted + UnHighLightLine(hStringHandle); } // add cancel line - AddMonoString(&hStringHandle, pSquadMenuStrings[ NUMBER_OF_SQUADS ]); + AddMonoString(&hStringHandle, pSquadMenuStrings[ NUMBER_OF_SQUADS ]); // set font type SetBoxFont(ghSquadBox, MAP_SCREEN_FONT); @@ -8027,7 +8071,7 @@ void CreateSquadBox( void ) GetBoxPosition( ghSquadBox, &pPoint); GetBoxSize( ghSquadBox, &pDimensions ); - + if( giBoxY + pDimensions.iBottom > 479 ) { pPoint.iY = SquadPosition.iY = 479 - pDimensions.iBottom; @@ -8041,61 +8085,61 @@ void CreateEPCBox( void ) // will create a pop up box for squad selection SGPPoint pPoint; SGPRect pDimensions; - UINT32 hStringHandle; - INT32 iCount; - - // create basic box - CreatePopUpBox(&ghEpcBox, SquadDimensions, AssignmentPosition, (POPUP_BOX_FLAG_CLIP_TEXT|POPUP_BOX_FLAG_RESIZE|POPUP_BOX_FLAG_CENTER_TEXT )); + UINT32 hStringHandle; + INT32 iCount; - // which buffer will box render to - SetBoxBuffer(ghEpcBox, FRAME_BUFFER); + // create basic box + CreatePopUpBox(&ghEpcBox, SquadDimensions, AssignmentPosition, (POPUP_BOX_FLAG_CLIP_TEXT|POPUP_BOX_FLAG_RESIZE|POPUP_BOX_FLAG_CENTER_TEXT )); - // border type? - SetBorderType(ghEpcBox,guiPOPUPBORDERS); + // which buffer will box render to + SetBoxBuffer(ghEpcBox, FRAME_BUFFER); - // background texture - SetBackGroundSurface(ghEpcBox, guiPOPUPTEX); + // border type? + SetBorderType(ghEpcBox,guiPOPUPBORDERS); - // margin sizes - SetMargins( ghEpcBox, 6, 6, 4, 4 ); + // background texture + SetBackGroundSurface(ghEpcBox, guiPOPUPTEX); - // space between lines - SetLineSpace(ghEpcBox, 2); + // margin sizes + SetMargins( ghEpcBox, 6, 6, 4, 4 ); - // set current box to this one - SetCurrentBox( ghEpcBox ); + // space between lines + SetLineSpace(ghEpcBox, 2); - for(iCount=0; iCount < MAX_EPC_MENU_STRING_COUNT; iCount++) - { - AddMonoString(&hStringHandle, pEpcMenuStrings[ iCount]); - } + // set current box to this one + SetCurrentBox( ghEpcBox ); - // set font type - SetBoxFont(ghEpcBox, MAP_SCREEN_FONT); + for(iCount=0; iCount < MAX_EPC_MENU_STRING_COUNT; iCount++) + { + AddMonoString(&hStringHandle, pEpcMenuStrings[ iCount]); + } - // set highlight color - SetBoxHighLight(ghEpcBox, FONT_WHITE); + // set font type + SetBoxFont(ghEpcBox, MAP_SCREEN_FONT); - // unhighlighted color - SetBoxForeground(ghEpcBox, FONT_LTGREEN); + // set highlight color + SetBoxHighLight(ghEpcBox, FONT_WHITE); - // background color - SetBoxBackground(ghEpcBox, FONT_BLACK); + // unhighlighted color + SetBoxForeground(ghEpcBox, FONT_LTGREEN); - // shaded color..for darkened text - SetBoxShade( ghEpcBox, FONT_GRAY7 ); + // background color + SetBoxBackground(ghEpcBox, FONT_BLACK); - // resize box to text - ResizeBoxToText( ghEpcBox ); + // shaded color..for darkened text + SetBoxShade( ghEpcBox, FONT_GRAY7 ); - GetBoxPosition( ghEpcBox, &pPoint); + // resize box to text + ResizeBoxToText( ghEpcBox ); - GetBoxSize( ghEpcBox, &pDimensions ); - - if( giBoxY + pDimensions.iBottom > 479 ) - { + GetBoxPosition( ghEpcBox, &pPoint); + + GetBoxSize( ghEpcBox, &pDimensions ); + + if( giBoxY + pDimensions.iBottom > 479 ) + { pPoint.iY = AssignmentPosition.iY = 479 - pDimensions.iBottom; - } + } SetBoxPosition( ghEpcBox, pPoint ); } @@ -8160,20 +8204,20 @@ void PostContractMessage( SOLDIERTYPE *pCharacter, INT32 iContract ) return; // send a message stating that offer of contract extension made - //MapScreenMessage(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Offered to extend %s's contract by another %s.", pCharacter -> name, pContractExtendStrings[ iContract ] ); - + //MapScreenMessage(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Offered to extend %s's contract by another %s.", pCharacter->name, pContractExtendStrings[ iContract ] ); + return; } void PostTerminateMessage( SOLDIERTYPE *pCharacter ) { - + // do nothing return; - + // send a message stating that termination of contract done - //MapScreenMessage(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s's contract has been terminated.", pCharacter -> name ); - + //MapScreenMessage(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s's contract has been terminated.", pCharacter->name ); + } BOOLEAN DisplayVehicleMenu( SOLDIERTYPE *pSoldier ) @@ -8186,12 +8230,12 @@ BOOLEAN DisplayVehicleMenu( SOLDIERTYPE *pSoldier ) RemoveBox(ghVehicleBox); ghVehicleBox = -1; - CreateVehicleBox(); - SetCurrentBox(ghVehicleBox); + CreateVehicleBox(); + SetCurrentBox(ghVehicleBox); // run through list of vehicles in sector and add them to pop up box for ( iCounter = 0; iCounter < ubNumberOfVehicles; iCounter++ ) - { + { if ( pVehicleList[iCounter].fValid == TRUE ) { if ( IsThisVehicleAccessibleToSoldier( pSoldier, iCounter ) ) @@ -8205,12 +8249,12 @@ BOOLEAN DisplayVehicleMenu( SOLDIERTYPE *pSoldier ) // cancel string (borrow the one in the squad menu) AddMonoString((UINT32 *)&hStringHandle, pSquadMenuStrings[ SQUAD_MENU_CANCEL ]); - SetBoxFont(ghVehicleBox, MAP_SCREEN_FONT); - SetBoxHighLight(ghVehicleBox, FONT_WHITE); - SetBoxForeground(ghVehicleBox, FONT_LTGREEN); - SetBoxBackground(ghVehicleBox, FONT_BLACK); - - return fVehiclePresent; + SetBoxFont(ghVehicleBox, MAP_SCREEN_FONT); + SetBoxHighLight(ghVehicleBox, FONT_WHITE); + SetBoxForeground(ghVehicleBox, FONT_LTGREEN); + SetBoxBackground(ghVehicleBox, FONT_BLACK); + + return fVehiclePresent; } void CreateVehicleBox() @@ -8246,7 +8290,7 @@ void CreateContractBox( SOLDIERTYPE *pCharacter ) if( giBoxY != 0 ) { - ContractPosition.iX = giBoxY; + ContractPosition.iX = giBoxY; } CreatePopUpBox(&ghContractBox, ContractDimensions, ContractPosition, (POPUP_BOX_FLAG_CLIP_TEXT|POPUP_BOX_FLAG_RESIZE )); @@ -8262,75 +8306,75 @@ void CreateContractBox( SOLDIERTYPE *pCharacter ) // not null character? if( pCharacter != NULL ) { - for(uiCounter=0; uiCounter < MAX_CONTRACT_MENU_STRING_COUNT; uiCounter++) - { - switch( uiCounter ) - { - case( CONTRACT_MENU_CURRENT_FUNDS ): + for(uiCounter=0; uiCounter < MAX_CONTRACT_MENU_STRING_COUNT; uiCounter++) + { + switch( uiCounter ) + { + case( CONTRACT_MENU_CURRENT_FUNDS ): /* // add current balance after title string - swprintf( sDollarString, L"%d", LaptopSaveInfo.iCurrentBalance); - InsertCommasForDollarFigure( sDollarString ); - InsertDollarSignInToString( sDollarString ); - swprintf( sString, L"%s %s", pContractStrings[uiCounter], sDollarString ); - AddMonoString(&hStringHandle, sString); + swprintf( sDollarString, L"%d", LaptopSaveInfo.iCurrentBalance); + InsertCommasForDollarFigure( sDollarString ); + InsertDollarSignInToString( sDollarString ); + swprintf( sString, L"%s %s", pContractStrings[uiCounter], sDollarString ); + AddMonoString(&hStringHandle, sString); */ - AddMonoString(&hStringHandle, pContractStrings[uiCounter]); - break; - case( CONTRACT_MENU_DAY ): - - if( pCharacter -> ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC ) - { - swprintf( sDollarString, L"%d", 0 ); - } - else - { - swprintf( sDollarString, L"%d", gMercProfiles[ pCharacter -> ubProfile ].sSalary ); - } - InsertCommasForDollarFigure( sDollarString ); - InsertDollarSignInToString( sDollarString ); - swprintf( sString, L"%s ( %s )", pContractStrings[uiCounter], sDollarString); - AddMonoString(&hStringHandle, sString); - break; - case( CONTRACT_MENU_WEEK ): + AddMonoString(&hStringHandle, pContractStrings[uiCounter]); + break; + case( CONTRACT_MENU_DAY ): - if( pCharacter -> ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC ) - { - swprintf( sDollarString, L"%d", 0 ); - } - else - { - swprintf( sDollarString, L"%d", gMercProfiles[ pCharacter -> ubProfile ].uiWeeklySalary ); - } + if( pCharacter->ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC ) + { + swprintf( sDollarString, L"%d", 0 ); + } + else + { + swprintf( sDollarString, L"%d", gMercProfiles[ pCharacter->ubProfile ].sSalary ); + } + InsertCommasForDollarFigure( sDollarString ); + InsertDollarSignInToString( sDollarString ); + swprintf( sString, L"%s ( %s )", pContractStrings[uiCounter], sDollarString); + AddMonoString(&hStringHandle, sString); + break; + case( CONTRACT_MENU_WEEK ): - InsertCommasForDollarFigure( sDollarString ); - InsertDollarSignInToString( sDollarString ); - swprintf( sString, L"%s ( %s )", pContractStrings[uiCounter], sDollarString ); - AddMonoString(&hStringHandle, sString); - break; - case( CONTRACT_MENU_TWO_WEEKS ): + if( pCharacter->ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC ) + { + swprintf( sDollarString, L"%d", 0 ); + } + else + { + swprintf( sDollarString, L"%d", gMercProfiles[ pCharacter->ubProfile ].uiWeeklySalary ); + } - if( pCharacter -> ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC ) - { - swprintf( sDollarString, L"%d", 0 ); - } - else - { - swprintf( sDollarString, L"%d", gMercProfiles[ pCharacter -> ubProfile ].uiBiWeeklySalary ); - } + InsertCommasForDollarFigure( sDollarString ); + InsertDollarSignInToString( sDollarString ); + swprintf( sString, L"%s ( %s )", pContractStrings[uiCounter], sDollarString ); + AddMonoString(&hStringHandle, sString); + break; + case( CONTRACT_MENU_TWO_WEEKS ): - - InsertCommasForDollarFigure( sDollarString ); - InsertDollarSignInToString( sDollarString ); - swprintf( sString, L"%s ( %s )", pContractStrings[uiCounter], sDollarString); - AddMonoString(&hStringHandle, sString); - break; - default: - AddMonoString(&hStringHandle, pContractStrings[uiCounter] ); - break; - } - UnHighLightLine(hStringHandle); - } + if( pCharacter->ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC ) + { + swprintf( sDollarString, L"%d", 0 ); + } + else + { + swprintf( sDollarString, L"%d", gMercProfiles[ pCharacter->ubProfile ].uiBiWeeklySalary ); + } + + + InsertCommasForDollarFigure( sDollarString ); + InsertDollarSignInToString( sDollarString ); + swprintf( sString, L"%s ( %s )", pContractStrings[uiCounter], sDollarString); + AddMonoString(&hStringHandle, sString); + break; + default: + AddMonoString(&hStringHandle, pContractStrings[uiCounter] ); + break; + } + UnHighLightLine(hStringHandle); + } } @@ -8341,11 +8385,11 @@ void CreateContractBox( SOLDIERTYPE *pCharacter ) // shaded color..for darkened text SetBoxShade( ghContractBox, FONT_GRAY7 ); - + if( pCharacter != NULL ) { - // now set the color for the current balance value - SetBoxLineForeground( ghContractBox, 0, FONT_YELLOW ); + // now set the color for the current balance value + SetBoxLineForeground( ghContractBox, 0, FONT_YELLOW ); } // resize box to text @@ -8365,7 +8409,7 @@ void CreateAttributeBox( void ) if( giBoxY != 0 ) { - AttributePosition.iY = giBoxY; + AttributePosition.iY = giBoxY; } // update screen assignment positions @@ -8373,7 +8417,7 @@ void CreateAttributeBox( void ) // create basic box CreatePopUpBox(&ghAttributeBox, AttributeDimensions, AttributePosition, (POPUP_BOX_FLAG_CLIP_TEXT|POPUP_BOX_FLAG_CENTER_TEXT|POPUP_BOX_FLAG_RESIZE )); - + // which buffer will box render to SetBoxBuffer(ghAttributeBox, FRAME_BUFFER); @@ -8397,8 +8441,8 @@ void CreateAttributeBox( void ) // add strings for box for(uiCounter=0; uiCounter < MAX_ATTRIBUTE_STRING_COUNT; uiCounter++) { - AddMonoString(&hStringHandle, pAttributeMenuStrings[uiCounter]); - + AddMonoString(&hStringHandle, pAttributeMenuStrings[uiCounter]); + // make sure it is unhighlighted UnHighLightLine(hStringHandle); } @@ -8435,7 +8479,7 @@ void CreateTrainingBox( void ) if( giBoxY != 0 ) { - TrainPosition.iY = giBoxY + ( ASSIGN_MENU_TRAIN * GetFontHeight( MAP_SCREEN_FONT ) ); + TrainPosition.iY = giBoxY + ( ASSIGN_MENU_TRAIN * GetFontHeight( MAP_SCREEN_FONT ) ); } // create basic box @@ -8463,8 +8507,8 @@ void CreateTrainingBox( void ) // add strings for box for(uiCounter=0; uiCounter < MAX_TRAIN_STRING_COUNT; uiCounter++) { - AddMonoString(&hStringHandle, pTrainingMenuStrings[uiCounter]); - + AddMonoString(&hStringHandle, pTrainingMenuStrings[uiCounter]); + // make sure it is unhighlighted UnHighLightLine(hStringHandle); } @@ -8511,11 +8555,11 @@ void CreateAssignmentsBox( void ) pSoldier = GetSelectedAssignSoldier( TRUE ); - // pSoldier NULL is legal here! Gets called during every mapscreen initialization even when nobody is assign char + // pSoldier NULL is legal here! Gets called during every mapscreen initialization even when nobody is assign char // create basic box CreatePopUpBox(&ghAssignmentBox, AssignmentDimensions, AssignmentPosition, (POPUP_BOX_FLAG_CLIP_TEXT|POPUP_BOX_FLAG_CENTER_TEXT|POPUP_BOX_FLAG_RESIZE )); - + // which buffer will box render to SetBoxBuffer(ghAssignmentBox, FRAME_BUFFER); @@ -8549,7 +8593,7 @@ void CreateAssignmentsBox( void ) } AddMonoString(&hStringHandle, sString ); - + // make sure it is unhighlighted UnHighLightLine(hStringHandle); } @@ -8570,7 +8614,7 @@ void CreateAssignmentsBox( void ) SetBoxShade( ghAssignmentBox, FONT_GRAY7 ); SetBoxSecondaryShade( ghAssignmentBox, FONT_YELLOW ); - // resize box to text + // resize box to text ResizeBoxToText( ghAssignmentBox ); DetermineBoxPositions( ); @@ -8585,7 +8629,7 @@ void CreateMercRemoveAssignBox( void ) UINT32 uiCounter; // create basic box CreatePopUpBox(&ghRemoveMercAssignBox, AssignmentDimensions, AssignmentPosition, (POPUP_BOX_FLAG_CLIP_TEXT|POPUP_BOX_FLAG_CENTER_TEXT|POPUP_BOX_FLAG_RESIZE )); - + // which buffer will box render to SetBoxBuffer(ghRemoveMercAssignBox, FRAME_BUFFER); @@ -8607,8 +8651,8 @@ void CreateMercRemoveAssignBox( void ) // add strings for box for(uiCounter=0; uiCounter < MAX_REMOVE_MERC_COUNT; uiCounter++) { - AddMonoString(&hStringHandle, pRemoveMercStrings[uiCounter]); - + AddMonoString(&hStringHandle, pRemoveMercStrings[uiCounter]); + // make sure it is unhighlighted UnHighLightLine(hStringHandle); } @@ -8637,7 +8681,7 @@ BOOLEAN CreateDestroyAssignmentPopUpBoxes( void ) { static BOOLEAN fCreated= FALSE; VSURFACE_DESC vs_desc; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; if( ( fShowAssignmentMenu == TRUE ) && ( fCreated == FALSE ) ) @@ -8652,7 +8696,7 @@ BOOLEAN CreateDestroyAssignmentPopUpBoxes( void ) // these boxes are always created while in mapscreen... CreateEPCBox( ); - + CreateAssignmentsBox( ); CreateTrainingBox( ); CreateAttributeBox(); @@ -8711,7 +8755,7 @@ void DetermineBoxPositions( void ) } pSoldier = GetSelectedAssignSoldier( TRUE ); - // pSoldier NULL is legal here! Gets called during every mapscreen initialization even when nobody is assign char + // pSoldier NULL is legal here! Gets called during every mapscreen initialization even when nobody is assign char if ( pSoldier == NULL ) { return; @@ -8727,7 +8771,7 @@ void DetermineBoxPositions( void ) pPoint.iX = gsAssignmentBoxesX; pPoint.iY = gsAssignmentBoxesY; - if( pSoldier -> ubWhatKindOfMercAmI == MERC_TYPE__EPC ) + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC ) { SetBoxPosition( ghEpcBox, pPoint ); GetBoxSize( ghEpcBox, &pDimensions ); @@ -8800,12 +8844,12 @@ void SetTacticalPopUpAssignmentBoxXY( void ) } gsAssignmentBoxesX = sX + 30; - + if( sY < 0 ) { sY = 0; } - + gsAssignmentBoxesY = sY; // ATE: Check if we are past tactical viewport.... @@ -8874,7 +8918,7 @@ void CheckAndUpdateTacticalAssignmentPopUpPositions( void ) //get the soldier pSoldier = GetSelectedAssignSoldier( FALSE ); - if( pSoldier -> ubWhatKindOfMercAmI == MERC_TYPE__EPC ) + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC ) { GetBoxSize( ghEpcBox, &pDimensions2 ); } @@ -8893,13 +8937,13 @@ void CheckAndUpdateTacticalAssignmentPopUpPositions( void ) SetRenderFlags( RENDER_FLAG_FULL ); } - if( pDimensions2.iBottom > pDimensions.iBottom ) + if( pDimensions2.iBottom > pDimensions.iBottom ) { - sLongest = ( INT16 )pDimensions2.iBottom + ( ( GetFontHeight( MAP_SCREEN_FONT ) + 2 ) * ASSIGN_MENU_REPAIR ); + sLongest = ( INT16 )pDimensions2.iBottom + ( ( GetFontHeight( MAP_SCREEN_FONT ) + 2 ) * ASSIGN_MENU_REPAIR ); } else { - sLongest = ( INT16 )pDimensions.iBottom + ( ( GetFontHeight( MAP_SCREEN_FONT ) + 2 ) * ASSIGN_MENU_REPAIR ); + sLongest = ( INT16 )pDimensions.iBottom + ( ( GetFontHeight( MAP_SCREEN_FONT ) + 2 ) * ASSIGN_MENU_REPAIR ); } if( gsAssignmentBoxesY + sLongest >= (SCREEN_HEIGHT - 120) ) @@ -8907,16 +8951,16 @@ void CheckAndUpdateTacticalAssignmentPopUpPositions( void ) gsAssignmentBoxesY = ( INT16 )( (SCREEN_HEIGHT - 121) - ( sLongest ) ); SetRenderFlags( RENDER_FLAG_FULL ); } - + pPoint.iX = gsAssignmentBoxesX + pDimensions2.iRight; - pPoint.iY = gsAssignmentBoxesY + ( ( GetFontHeight( MAP_SCREEN_FONT ) + 2 ) * ASSIGN_MENU_REPAIR ); - + pPoint.iY = gsAssignmentBoxesY + ( ( GetFontHeight( MAP_SCREEN_FONT ) + 2 ) * ASSIGN_MENU_REPAIR ); + SetBoxPosition( ghRepairBox, pPoint ); } else if( fShowSquadMenu == TRUE ) { GetBoxSize( ghSquadBox, &pDimensions ); - + if( gsAssignmentBoxesX + pDimensions2.iRight + pDimensions.iRight >= SCREEN_WIDTH ) { @@ -8924,13 +8968,13 @@ void CheckAndUpdateTacticalAssignmentPopUpPositions( void ) SetRenderFlags( RENDER_FLAG_FULL ); } - if( pDimensions2.iBottom > pDimensions.iBottom ) + if( pDimensions2.iBottom > pDimensions.iBottom ) { sLongest = ( INT16 )pDimensions2.iBottom; } else { - sLongest = ( INT16 )pDimensions.iBottom; + sLongest = ( INT16 )pDimensions.iBottom; } if( gsAssignmentBoxesY + sLongest >= (SCREEN_HEIGHT - 120) ) @@ -8938,7 +8982,7 @@ void CheckAndUpdateTacticalAssignmentPopUpPositions( void ) gsAssignmentBoxesY = ( INT16 )( (SCREEN_HEIGHT - 121) - ( sLongest ) ); SetRenderFlags( RENDER_FLAG_FULL ); } - + pPoint.iX = gsAssignmentBoxesX + pDimensions2.iRight; pPoint.iY = gsAssignmentBoxesY; @@ -8960,17 +9004,17 @@ void CheckAndUpdateTacticalAssignmentPopUpPositions( void ) gsAssignmentBoxesY = ( INT16 )( (SCREEN_HEIGHT - 121) - ( pDimensions3.iBottom ) ); SetRenderFlags( RENDER_FLAG_FULL ); } - + pPoint.iX = gsAssignmentBoxesX + pDimensions2.iRight + pDimensions.iRight; pPoint.iY = gsAssignmentBoxesY; - - pPoint.iY += ( ( GetFontHeight( MAP_SCREEN_FONT ) + 2 ) * ASSIGN_MENU_TRAIN ); + + pPoint.iY += ( ( GetFontHeight( MAP_SCREEN_FONT ) + 2 ) * ASSIGN_MENU_TRAIN ); SetBoxPosition( ghAttributeBox, pPoint ); pPoint.iX = gsAssignmentBoxesX + pDimensions2.iRight; pPoint.iY = gsAssignmentBoxesY; - pPoint.iY += ( ( GetFontHeight( MAP_SCREEN_FONT ) + 2 ) * ASSIGN_MENU_TRAIN ); + pPoint.iY += ( ( GetFontHeight( MAP_SCREEN_FONT ) + 2 ) * ASSIGN_MENU_TRAIN ); SetBoxPosition( ghTrainingBox, pPoint ); @@ -8980,45 +9024,45 @@ void CheckAndUpdateTacticalAssignmentPopUpPositions( void ) { GetBoxSize( ghTrainingBox, &pDimensions ); - if( gsAssignmentBoxesX + pDimensions2.iRight + pDimensions.iRight >= SCREEN_WIDTH ) + if( gsAssignmentBoxesX + pDimensions2.iRight + pDimensions.iRight >= SCREEN_WIDTH ) { - gsAssignmentBoxesX = ( INT16 ) ( (SCREEN_WIDTH - 1) - ( pDimensions2.iRight + pDimensions.iRight ) ); + gsAssignmentBoxesX = ( INT16 ) ( (SCREEN_WIDTH - 1) - ( pDimensions2.iRight + pDimensions.iRight ) ); SetRenderFlags( RENDER_FLAG_FULL ); } - if( gsAssignmentBoxesY + pDimensions2.iBottom + ( ( GetFontHeight( MAP_SCREEN_FONT ) + 2 ) * ASSIGN_MENU_TRAIN ) >= (SCREEN_HEIGHT - 120) ) + if( gsAssignmentBoxesY + pDimensions2.iBottom + ( ( GetFontHeight( MAP_SCREEN_FONT ) + 2 ) * ASSIGN_MENU_TRAIN ) >= (SCREEN_HEIGHT - 120) ) { - gsAssignmentBoxesY = ( INT16 )( (SCREEN_HEIGHT - 121) - ( pDimensions2.iBottom ) - ( ( GetFontHeight( MAP_SCREEN_FONT ) + 2 ) * ASSIGN_MENU_TRAIN ) ); + gsAssignmentBoxesY = ( INT16 )( (SCREEN_HEIGHT - 121) - ( pDimensions2.iBottom ) - ( ( GetFontHeight( MAP_SCREEN_FONT ) + 2 ) * ASSIGN_MENU_TRAIN ) ); SetRenderFlags( RENDER_FLAG_FULL ); } - - + + pPoint.iX = gsAssignmentBoxesX + pDimensions2.iRight; pPoint.iY = gsAssignmentBoxesY; pPoint.iY += ( ( GetFontHeight( MAP_SCREEN_FONT ) + 2 ) * ASSIGN_MENU_TRAIN ); - + SetBoxPosition( ghTrainingBox, pPoint ); } else { // just the assignment box - if( gsAssignmentBoxesX + pDimensions2.iRight >= SCREEN_WIDTH ) + if( gsAssignmentBoxesX + pDimensions2.iRight >= SCREEN_WIDTH ) { - gsAssignmentBoxesX = ( INT16 ) ( (SCREEN_WIDTH - 1) - ( pDimensions2.iRight ) ); + gsAssignmentBoxesX = ( INT16 ) ( (SCREEN_WIDTH - 1) - ( pDimensions2.iRight ) ); SetRenderFlags( RENDER_FLAG_FULL ); } - if( gsAssignmentBoxesY + pDimensions2.iBottom >= (SCREEN_HEIGHT - 120) ) + if( gsAssignmentBoxesY + pDimensions2.iBottom >= (SCREEN_HEIGHT - 120) ) { - gsAssignmentBoxesY = ( INT16 )( (SCREEN_HEIGHT - 121) - ( pDimensions2.iBottom ) ); + gsAssignmentBoxesY = ( INT16 )( (SCREEN_HEIGHT - 121) - ( pDimensions2.iBottom ) ); SetRenderFlags( RENDER_FLAG_FULL ); } - + pPoint.iX = gsAssignmentBoxesX; pPoint.iY = gsAssignmentBoxesY; - - if( pSoldier -> ubWhatKindOfMercAmI == MERC_TYPE__EPC) + + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC) { SetBoxPosition( ghEpcBox, pPoint ); } @@ -9046,7 +9090,7 @@ void PositionCursorForTacticalAssignmentBox( void ) // get dimensions..mostly for width GetBoxSize( ghAssignmentBox, &pDimensions ); - iFontHeight = GetLineSpace( ghAssignmentBox ) + GetFontHeight( GetBoxFont( ghAssignmentBox ) ); + iFontHeight = GetLineSpace( ghAssignmentBox ) + GetFontHeight( GetBoxFont( ghAssignmentBox ) ); if( gGameSettings.fOptions[ TOPTION_DONT_MOVE_MOUSE ] == FALSE ) { @@ -9072,14 +9116,14 @@ void HandleRestFatigueAndSleepStatus( void ) { pSoldier = &Menptr[ iCounter ]; - if( pSoldier -> bActive ) + if( pSoldier->bActive ) { - if( ( pSoldier -> uiStatusFlags & SOLDIER_VEHICLE ) || AM_A_ROBOT( pSoldier ) ) + if( ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) || AM_A_ROBOT( pSoldier ) ) { continue; } - if( ( pSoldier -> bAssignment == ASSIGNMENT_POW ) || ( pSoldier -> bAssignment == IN_TRANSIT ) ) + if( ( pSoldier->bAssignment == ASSIGNMENT_POW ) || ( pSoldier->bAssignment == IN_TRANSIT ) ) { continue; } @@ -9092,7 +9136,7 @@ void HandleRestFatigueAndSleepStatus( void ) RestCharacter( pSoldier ); } else - { + { // wear them down FatigueCharacter( pSoldier ); } @@ -9101,13 +9145,13 @@ void HandleRestFatigueAndSleepStatus( void ) // CHECK FOR MERCS GOING TO SLEEP // if awake - if ( !pSoldier->fMercAsleep ) + if ( !pSoldier->flags.fMercAsleep ) { // if dead tired - if( pSoldier -> bBreathMax <= BREATHMAX_ABSOLUTE_MINIMUM ) + if( pSoldier->bBreathMax <= BREATHMAX_ABSOLUTE_MINIMUM ) { - // if between sectors, don't put tired mercs to sleep... will be handled when they arrive at the next sector - if ( pSoldier->fBetweenSectors ) + // if between sectors, don't put tired mercs to sleep... will be handled when they arrive at the next sector + if ( pSoldier->flags.fBetweenSectors ) { continue; } @@ -9115,7 +9159,7 @@ void HandleRestFatigueAndSleepStatus( void ) // he goes to sleep, provided it's at all possible (it still won't happen in a hostile sector, etc.) if( SetMercAsleep( pSoldier, FALSE ) ) { - if( ( pSoldier -> bAssignment < ON_DUTY ) || ( pSoldier -> bAssignment == VEHICLE ) ) + if( ( pSoldier->bAssignment < ON_DUTY ) || ( pSoldier->bAssignment == VEHICLE ) ) { // on a squad/vehicle, complain, then drop TacticalCharacterDialogue( pSoldier, QUOTE_NEED_SLEEP ); @@ -9124,14 +9168,14 @@ void HandleRestFatigueAndSleepStatus( void ) } // guy collapses - pSoldier -> fMercCollapsedFlag = TRUE; + pSoldier->flags.fMercCollapsedFlag = TRUE; } } // if pretty tired, and not forced to stay awake - else if( ( pSoldier -> bBreathMax < BREATHMAX_PRETTY_TIRED ) && ( pSoldier -> fForcedToStayAwake == FALSE ) ) + else if( ( pSoldier->bBreathMax < BREATHMAX_PRETTY_TIRED ) && ( pSoldier->flags.fForcedToStayAwake == FALSE ) ) { // if not on squad/ in vehicle - if( ( pSoldier -> bAssignment >= ON_DUTY ) && ( pSoldier -> bAssignment != VEHICLE ) ) + if( ( pSoldier->bAssignment >= ON_DUTY ) && ( pSoldier->bAssignment != VEHICLE ) ) { // try to go to sleep on your own if( SetMercAsleep( pSoldier, FALSE ) ) @@ -9152,14 +9196,14 @@ void HandleRestFatigueAndSleepStatus( void ) fBoxSetUp = TRUE; } - // seems unnecessary now? ARM - pSoldier -> bOldAssignment = pSoldier -> bAssignment; + // seems unnecessary now? ARM + pSoldier->bOldAssignment = pSoldier->bAssignment; } } else // tired, in a squad / vehicle { // if he hasn't complained yet - if ( !pSoldier->fComplainedThatTired ) + if ( !pSoldier->flags.fComplainedThatTired ) { // say quote if( fMeToo == FALSE ) @@ -9172,9 +9216,9 @@ void HandleRestFatigueAndSleepStatus( void ) TacticalCharacterDialogue( pSoldier, QUOTE_ME_TOO ); } - pSoldier->fComplainedThatTired = TRUE; + pSoldier->flags.fComplainedThatTired = TRUE; } - } + } } } } @@ -9194,15 +9238,15 @@ void HandleRestFatigueAndSleepStatus( void ) for( iCounter = 0; iCounter < iNumberOnTeam; iCounter++ ) { pSoldier = &Menptr[ iCounter ]; - - if( pSoldier -> bActive ) + + if( pSoldier->bActive ) { - if( ( pSoldier -> uiStatusFlags & SOLDIER_VEHICLE ) || AM_A_ROBOT( pSoldier ) ) + if( ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) || AM_A_ROBOT( pSoldier ) ) { continue; } - if( ( pSoldier -> bAssignment == ASSIGNMENT_POW ) || ( pSoldier -> bAssignment == IN_TRANSIT ) ) + if( ( pSoldier->bAssignment == ASSIGNMENT_POW ) || ( pSoldier->bAssignment == IN_TRANSIT ) ) { continue; } @@ -9212,30 +9256,30 @@ void HandleRestFatigueAndSleepStatus( void ) // CHECK FOR MERCS WAKING UP - if ( pSoldier->bBreathMax >= BREATHMAX_CANCEL_COLLAPSE ) + if ( pSoldier->bBreathMax >= BREATHMAX_CANCEL_COLLAPSE ) { // reset the collapsed flag well before reaching the wakeup state - pSoldier -> fMercCollapsedFlag = FALSE; + pSoldier->flags.fMercCollapsedFlag = FALSE; } // if asleep - if ( pSoldier -> fMercAsleep ) + if ( pSoldier->flags.fMercAsleep ) { // but has had enough rest? - if( pSoldier -> bBreathMax >= BREATHMAX_FULLY_RESTED ) + if( pSoldier->bBreathMax >= BREATHMAX_FULLY_RESTED ) { // try to wake merc up if( SetMercAwake( pSoldier, FALSE, FALSE ) ) { // if not on squad/ in vehicle, tell player about it - if( ( pSoldier -> bAssignment >= ON_DUTY ) && ( pSoldier -> bAssignment != VEHICLE ) ) + if( ( pSoldier->bAssignment >= ON_DUTY ) && ( pSoldier->bAssignment != VEHICLE ) ) { if( gGameSettings.fOptions[ TOPTION_SLEEPWAKE_NOTIFICATION ] ) { if( fReasonAdded == FALSE ) { - AddReasonToWaitingListQueue( ASSIGNMENT_RETURNING_FOR_UPDATE ); + AddReasonToWaitingListQueue( ASSIGNMENT_RETURNING_FOR_UPDATE ); fReasonAdded = TRUE; } @@ -9266,7 +9310,7 @@ BOOLEAN CanCharacterRepairVehicle( SOLDIERTYPE *pSoldier, INT32 iVehicleId ) // is the vehicle valid? if( VehicleIdIsValid( iVehicleId ) == FALSE ) { - return( FALSE ); + return( FALSE ); } // is vehicle destroyed? @@ -9293,16 +9337,16 @@ BOOLEAN CanCharacterRepairVehicle( SOLDIERTYPE *pSoldier, INT32 iVehicleId ) return( FALSE ); } -/* Assignment distance limits removed. Sep/11/98. ARM +/* Assignment distance limits removed. Sep/11/98. ARM // if currently loaded sector, are we close enough? if( ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->sSectorY == gWorldSectorY ) && ( pSoldier->bSectorZ == gbWorldSectorZ ) ) { - if( PythSpacesAway( pSoldier -> sGridNo, pVehicleList[ iVehicleId ].sGridNo ) > MAX_DISTANCE_FOR_REPAIR ) + if( PythSpacesAway( pSoldier->sGridNo, pVehicleList[ iVehicleId ].sGridNo ) > MAX_DISTANCE_FOR_REPAIR ) { - return( FALSE ); + return( FALSE ); } } -*/ +*/ return( TRUE ); } @@ -9317,7 +9361,7 @@ BOOLEAN IsRobotInThisSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) if ( pSoldier != NULL ) { - if( ( pSoldier -> sSectorX == sSectorX ) && ( pSoldier -> sSectorY == sSectorY ) && ( pSoldier -> bSectorZ == bSectorZ ) && ( pSoldier -> fBetweenSectors == FALSE ) ) + if( ( pSoldier->sSectorX == sSectorX ) && ( pSoldier->sSectorY == sSectorY ) && ( pSoldier->bSectorZ == bSectorZ ) && ( pSoldier->flags.fBetweenSectors == FALSE ) ) { return( TRUE ); } @@ -9331,15 +9375,15 @@ BOOLEAN IsRobotInThisSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) SOLDIERTYPE * GetRobotSoldier( void ) { SOLDIERTYPE *pSoldier = NULL, *pTeamSoldier = NULL; - INT32 cnt=0; + INT32 cnt=0; // set pSoldier as first in merc ptrs - pSoldier = MercPtrs[0]; - + pSoldier = MercPtrs[0]; + // go through list of characters, find all who are on this assignment - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier -> bTeam ].bLastID; cnt++,pTeamSoldier++) + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) { - if( pTeamSoldier -> bActive ) + if( pTeamSoldier->bActive ) { if( AM_A_ROBOT( pTeamSoldier ) ) { @@ -9364,24 +9408,24 @@ BOOLEAN CanCharacterRepairRobot( SOLDIERTYPE *pSoldier ) } // if robot isn't damaged at all - if( pRobot -> bLife == pRobot -> bLifeMax ) + if( pRobot->stats.bLife == pRobot->stats.bLifeMax ) { return( FALSE ); } // is the robot in the same sector - if( IsRobotInThisSector( pSoldier -> sSectorX, pSoldier -> sSectorY, pSoldier -> bSectorZ ) == FALSE ) + if( IsRobotInThisSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) == FALSE ) { return( FALSE ); } -/* Assignment distance limits removed. Sep/11/98. ARM +/* Assignment distance limits removed. Sep/11/98. ARM // if that sector is currently loaded, check distance to robot - if( ( pSoldier -> sSectorX == gWorldSectorX ) && ( pSoldier -> sSectorY == gWorldSectorY ) && ( pSoldier -> bSectorZ == gbWorldSectorZ ) ) + if( ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->sSectorY == gWorldSectorY ) && ( pSoldier->bSectorZ == gbWorldSectorZ ) ) { - if( PythSpacesAway( pSoldier -> sGridNo, pRobot -> sGridNo ) > MAX_DISTANCE_FOR_REPAIR ) + if( PythSpacesAway( pSoldier->sGridNo, pRobot->sGridNo ) > MAX_DISTANCE_FOR_REPAIR ) { - return( FALSE ); + return( FALSE ); } } */ @@ -9402,39 +9446,39 @@ UINT8 HandleRepairOfRobotBySoldier( SOLDIERTYPE *pSoldier, UINT8 ubRepairPts, BO } -UINT8 RepairRobot( SOLDIERTYPE *pRobot, UINT8 ubRepairPts, BOOLEAN *pfNothingLeftToRepair ) +UINT8 RepairRobot( SOLDIERTYPE *pRobot, UINT8 ubRepairPts, BOOLEAN *pfNothingLeftToRepair ) { UINT8 ubPointsUsed = 0; // is it "dead" ? - if( pRobot -> bLife == 0 ) + if( pRobot->stats.bLife == 0 ) { *pfNothingLeftToRepair = TRUE; return( ubPointsUsed ); } - + // is it "unhurt" ? - if( pRobot -> bLife == pRobot -> bLifeMax ) + if( pRobot->stats.bLife == pRobot->stats.bLifeMax ) { *pfNothingLeftToRepair = TRUE; return( ubPointsUsed ); } // if we have enough or more than we need - if( pRobot -> bLife + ubRepairPts >= pRobot -> bLifeMax ) + if( pRobot->stats.bLife + ubRepairPts >= pRobot->stats.bLifeMax ) { - ubPointsUsed = ( pRobot -> bLifeMax - pRobot -> bLife ); - pRobot -> bLife = pRobot -> bLifeMax; + ubPointsUsed = ( pRobot->stats.bLifeMax - pRobot->stats.bLife ); + pRobot->stats.bLife = pRobot->stats.bLifeMax; } else { // not enough, do what we can ubPointsUsed = ubRepairPts; - pRobot -> bLife += ubRepairPts; + pRobot->stats.bLife += ubRepairPts; } - if ( pRobot->bLife == pRobot->bLifeMax ) + if ( pRobot->stats.bLife == pRobot->stats.bLifeMax ) { *pfNothingLeftToRepair = TRUE; } @@ -9454,17 +9498,17 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam case( ASSIGNMENT_HOSPITAL ): if( CanCharacterPatient( pSoldier ) ) { - - pSoldier -> bOldAssignment = pSoldier -> bAssignment; + + pSoldier->bOldAssignment = pSoldier->bAssignment; pSoldier->bBleeding = 0; - + // set dirty flag fTeamPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; // remove from squad - RemoveCharacterFromSquads( pSoldier ); + RemoveCharacterFromSquads( pSoldier ); // remove from any vehicle if( pSoldier->bOldAssignment == VEHICLE ) @@ -9477,7 +9521,7 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam SetTimeOfAssignmentChangeForMerc( pSoldier ); } - + RebuildCurrentSquad( ); ChangeSoldiersAssignment( pSoldier, ASSIGNMENT_HOSPITAL ); @@ -9489,23 +9533,23 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam if( CanCharacterPatient( pSoldier ) ) { // set as doctor - -/* Assignment distance limits removed. Sep/11/98. ARM + +/* Assignment distance limits removed. Sep/11/98. ARM if( IsSoldierCloseEnoughToADoctor( pSoldier ) == FALSE ) { return; } */ - pSoldier -> bOldAssignment = pSoldier -> bAssignment; - - + pSoldier->bOldAssignment = pSoldier->bAssignment; + + // set dirty flag fTeamPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; // remove from squad - RemoveCharacterFromSquads( pSoldier ); + RemoveCharacterFromSquads( pSoldier ); // remove from any vehicle if( pSoldier->bOldAssignment == VEHICLE ) @@ -9527,17 +9571,17 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam case( DOCTOR ): if( CanCharacterDoctor( pSoldier ) ) { - - pSoldier -> bOldAssignment = pSoldier -> bAssignment; - - + + pSoldier->bOldAssignment = pSoldier->bAssignment; + + // set dirty flag fTeamPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; gfRenderPBInterface = TRUE; // remove from squad - RemoveCharacterFromSquads( pSoldier ); + RemoveCharacterFromSquads( pSoldier ); // remove from any vehicle if( pSoldier->bOldAssignment == VEHICLE ) @@ -9560,14 +9604,14 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam if( CanCharacterTrainMilitia( pSoldier ) ) { // train militia - pSoldier -> bOldAssignment = pSoldier -> bAssignment; - + pSoldier->bOldAssignment = pSoldier->bAssignment; + // set dirty flag fTeamPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; // remove from squad - RemoveCharacterFromSquads( pSoldier ); + RemoveCharacterFromSquads( pSoldier ); // remove from any vehicle if( pSoldier->bOldAssignment == VEHICLE ) @@ -9584,7 +9628,7 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam if( pMilitiaTrainerSoldier == NULL ) { - if( SectorInfo[ SECTOR( pSoldier -> sSectorX, pSoldier -> sSectorY ) ].fMilitiaTrainingPaid == FALSE ) + if( SectorInfo[ SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ].fMilitiaTrainingPaid == FALSE ) { // show a message to confirm player wants to charge cost HandleInterfaceMessageForCostOfTrainingMilitia( pSoldier ); @@ -9602,7 +9646,7 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam if( CanCharacterTrainStat( pSoldier, ( INT8 )iParam1, TRUE, FALSE ) ) { // train stat - pSoldier -> bOldAssignment = pSoldier -> bAssignment; + pSoldier->bOldAssignment = pSoldier->bAssignment; // remove from squad RemoveCharacterFromSquads( pSoldier ); @@ -9619,11 +9663,11 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam } ChangeSoldiersAssignment( pSoldier, TRAIN_SELF ); - + AssignMercToAMovementGroup( pSoldier ); // set stat to train - pSoldier -> bTrainStat = ( INT8 )iParam1; + pSoldier->bTrainStat = ( INT8 )iParam1; // set dirty flag fTeamPanelDirty = TRUE; @@ -9635,7 +9679,7 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam if( CanCharacterTrainStat( pSoldier, ( INT8 )iParam1, FALSE, TRUE ) ) { - pSoldier -> bOldAssignment = pSoldier -> bAssignment; + pSoldier->bOldAssignment = pSoldier->bAssignment; // remove from squad RemoveCharacterFromSquads( pSoldier ); @@ -9654,7 +9698,7 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam AssignMercToAMovementGroup( pSoldier ); // set stat to train - pSoldier -> bTrainStat = ( INT8 )iParam1; + pSoldier->bTrainStat = ( INT8 )iParam1; // set dirty flag fTeamPanelDirty = TRUE; @@ -9666,7 +9710,7 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam if( CanCharacterTrainStat( pSoldier, ( INT8 )iParam1, TRUE, FALSE ) ) { // train stat - pSoldier -> bOldAssignment = pSoldier -> bAssignment; + pSoldier->bOldAssignment = pSoldier->bAssignment; // remove from squad RemoveCharacterFromSquads( pSoldier ); @@ -9687,7 +9731,7 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam AssignMercToAMovementGroup( pSoldier ); // set stat to train - pSoldier -> bTrainStat = ( INT8 )iParam1; + pSoldier->bTrainStat = ( INT8 )iParam1; // set dirty flag fTeamPanelDirty = TRUE; @@ -9698,7 +9742,7 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam case( REPAIR ): if( CanCharacterRepair( pSoldier ) ) { - pSoldier -> bOldAssignment = pSoldier -> bAssignment; + pSoldier->bOldAssignment = pSoldier->bAssignment; // remove from squad RemoveCharacterFromSquads( pSoldier ); @@ -9709,7 +9753,7 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam TakeSoldierOutOfVehicle( pSoldier ); } - if( ( pSoldier->bAssignment != REPAIR ) ||( pSoldier ->fFixingSAMSite != ( UINT8 )iParam1 ) || ( pSoldier ->fFixingRobot != ( UINT8 )iParam2 ) || ( pSoldier ->bVehicleUnderRepairID != ( UINT8 )iParam3 ) ) + if( ( pSoldier->bAssignment != REPAIR ) ||( pSoldier->flags.fFixingSAMSite != ( UINT8 )iParam1 ) || ( pSoldier->flags.fFixingRobot != ( UINT8 )iParam2 ) || ( pSoldier->bVehicleUnderRepairID != ( UINT8 )iParam3 ) ) { SetTimeOfAssignmentChangeForMerc( pSoldier ); } @@ -9717,9 +9761,9 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam ChangeSoldiersAssignment( pSoldier, REPAIR ); MakeSureToolKitIsInHand( pSoldier ); AssignMercToAMovementGroup( pSoldier ); - pSoldier -> fFixingSAMSite = ( UINT8 )iParam1; - pSoldier -> fFixingRobot = ( UINT8 )iParam2; - pSoldier -> bVehicleUnderRepairID = ( INT8 )iParam3; + pSoldier->flags.fFixingSAMSite = ( UINT8 )iParam1; + pSoldier->flags.fFixingRobot = ( UINT8 )iParam2; + pSoldier->bVehicleUnderRepairID = ( INT8 )iParam3; } break; case( VEHICLE ): @@ -9727,7 +9771,7 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam { if ( IsEnoughSpaceInVehicle( (INT8) iParam1 ) ) { - pSoldier -> bOldAssignment = pSoldier -> bAssignment; + pSoldier->bOldAssignment = pSoldier->bAssignment; // set dirty flag fTeamPanelDirty = TRUE; @@ -9741,7 +9785,7 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam } // remove from squad - RemoveCharacterFromSquads( pSoldier ); + RemoveCharacterFromSquads( pSoldier ); if( PutSoldierInVehicle( pSoldier, ( INT8 )( iParam1 ) ) == FALSE ) { @@ -9749,12 +9793,12 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam } else { - if( ( pSoldier->bAssignment != VEHICLE ) || ( pSoldier ->iVehicleId != ( UINT8 )iParam1 ) ) + if( ( pSoldier->bAssignment != VEHICLE ) || ( pSoldier->iVehicleId != ( UINT8 )iParam1 ) ) { SetTimeOfAssignmentChangeForMerc( pSoldier ); } - pSoldier -> iVehicleId = iParam1; + pSoldier->iVehicleId = iParam1; ChangeSoldiersAssignment( pSoldier, VEHICLE ); AssignMercToAMovementGroup( pSoldier ); } @@ -9772,11 +9816,11 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam -/* No point in allowing SAM site repair any more. Jan/13/99. ARM +/* No point in allowing SAM site repair any more. Jan/13/99. ARM BOOLEAN CanSoldierRepairSAM( SOLDIERTYPE *pSoldier, INT8 bRepairPoints) { INT16 sGridNoA = 0, sGridNoB = 0; - + // is the soldier in the sector as the SAM if( SoldierInSameSectorAsSAM( pSoldier ) == FALSE ) { @@ -9790,12 +9834,12 @@ BOOLEAN CanSoldierRepairSAM( SOLDIERTYPE *pSoldier, INT8 bRepairPoints) } //can it be fixed? - if( IsTheSAMSiteInSectorRepairable( pSoldier -> sSectorX, pSoldier -> sSectorY, pSoldier -> bSectorZ ) == FALSE ) + if( IsTheSAMSiteInSectorRepairable( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) == FALSE ) { return( FALSE ); } - // is he good enough? (Because of the division of repair pts in SAM repair formula, a guy with any less that this + // is he good enough? (Because of the division of repair pts in SAM repair formula, a guy with any less that this // can't make any headway if (bRepairPoints < SAM_SITE_REPAIR_DIVISOR ) { @@ -9844,7 +9888,7 @@ BOOLEAN SoldierInSameSectorAsSAM( SOLDIERTYPE *pSoldier ) INT32 iCounter = 0; // is the soldier on the surface? - if( pSoldier -> bSectorZ != 0 ) + if( pSoldier->bSectorZ != 0 ) { return( FALSE ); } @@ -9852,7 +9896,7 @@ BOOLEAN SoldierInSameSectorAsSAM( SOLDIERTYPE *pSoldier ) // now check each sam site in the list for( iCounter = 0; iCounter < NUMBER_OF_SAMS; iCounter++ ) { - if( pSamList[ iCounter] == SECTOR( pSoldier -> sSectorX, pSoldier -> sSectorY ) ) + if( pSamList[ iCounter] == SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ) { return( TRUE ); } @@ -9869,10 +9913,10 @@ BOOLEAN IsSoldierCloseEnoughToSAMControlPanel( SOLDIERTYPE *pSoldier ) // now check each sam site in the list for( iCounter = 0; iCounter < NUMBER_OF_SAMS; iCounter++ ) { - if( pSamList[ iCounter ] == SECTOR( pSoldier -> sSectorX, pSoldier -> sSectorY ) ) + if( pSamList[ iCounter ] == SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ) { -// Assignment distance limits removed. Sep/11/98. ARM -// if( ( PythSpacesAway( pSamGridNoAList[ iCounter ], pSoldier -> sGridNo ) < MAX_DISTANCE_FOR_REPAIR )||( PythSpacesAway( pSamGridNoBList[ iCounter ], pSoldier -> sGridNo ) < MAX_DISTANCE_FOR_REPAIR ) ) +// Assignment distance limits removed. Sep/11/98. ARM +// if( ( PythSpacesAway( pSamGridNoAList[ iCounter ], pSoldier->sGridNo ) < MAX_DISTANCE_FOR_REPAIR )||( PythSpacesAway( pSamGridNoBList[ iCounter ], pSoldier->sGridNo ) < MAX_DISTANCE_FOR_REPAIR ) ) { return( TRUE ); } @@ -9890,12 +9934,12 @@ BOOLEAN HandleAssignmentExpansionAndHighLightForAssignMenu( SOLDIERTYPE *pSoldie if( fShowSquadMenu ) { // squad menu up?..if so, highlight squad line the previous menu - if( pSoldier -> ubWhatKindOfMercAmI == MERC_TYPE__EPC ) + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC ) { - HighLightBoxLine( ghEpcBox, EPC_MENU_ON_DUTY ); + HighLightBoxLine( ghEpcBox, EPC_MENU_ON_DUTY ); } else - { + { HighLightBoxLine( ghAssignmentBox, ASSIGN_MENU_ON_DUTY ); } @@ -10011,8 +10055,6 @@ BOOLEAN HandleShowingOfMovementBox( void ) void HandleShadingOfLinesForTrainingMenu( void ) { SOLDIERTYPE *pSoldier = NULL; - INT32 iCounter = 0; - // check if valid if( ( fShowTrainingMenu == FALSE ) || ( ghTrainingBox == - 1 ) ) @@ -10067,7 +10109,7 @@ void HandleShadingOfLinesForTrainingMenu( void ) // can character be trained by others? - if( CanCharacterBeTrainedByOther( pSoldier ) == FALSE ) + if( CanCharacterBeTrainedByOther( pSoldier ) == FALSE ) { ShadeStringInBox( ghTrainingBox, TRAIN_MENU_TRAIN_BY_OTHER ); } @@ -10140,7 +10182,6 @@ void HandleShadingOfLinesForAttributeMenus( void ) void ResetAssignmentsForAllSoldiersInSectorWhoAreTrainingTown( SOLDIERTYPE *pSoldier ) { - INT16 sSectorX = 0, sSectorY = 0; INT32 iNumberOnTeam = 0, iCounter = 0; SOLDIERTYPE *pCurSoldier = NULL; @@ -10149,12 +10190,12 @@ void ResetAssignmentsForAllSoldiersInSectorWhoAreTrainingTown( SOLDIERTYPE *pSol for( iCounter = 0; iCounter < iNumberOnTeam; iCounter++ ) { pCurSoldier = &Menptr[ iCounter ]; - - if( ( pCurSoldier -> bActive ) && ( pCurSoldier -> bLife >= OKLIFE ) ) + + if( ( pCurSoldier->bActive ) && ( pCurSoldier->stats.bLife >= OKLIFE ) ) { - if( pCurSoldier -> bAssignment == TRAIN_TOWN ) + if( pCurSoldier->bAssignment == TRAIN_TOWN ) { - if( ( pCurSoldier -> sSectorX == pSoldier -> sSectorX ) && ( pCurSoldier -> sSectorY == pSoldier -> sSectorY ) && ( pSoldier -> bSectorZ == 0 ) ) + if( ( pCurSoldier->sSectorX == pSoldier->sSectorX ) && ( pCurSoldier->sSectorY == pSoldier->sSectorY ) && ( pSoldier->bSectorZ == 0 ) ) { AddCharacterToAnySquad( pCurSoldier ); } @@ -10170,7 +10211,6 @@ void ReportTrainersTraineesWithoutPartners( void ) { SOLDIERTYPE *pTeamSoldier = NULL; INT32 iCounter = 0, iNumberOnTeam = 0; - BOOLEAN fFound =FALSE; iNumberOnTeam = gTacticalStatus.Team[ OUR_TEAM ].bLastID; @@ -10180,7 +10220,7 @@ void ReportTrainersTraineesWithoutPartners( void ) { pTeamSoldier = &Menptr[ iCounter ]; - if( ( pTeamSoldier -> bAssignment == TRAIN_TEAMMATE ) && ( pTeamSoldier -> bLife > 0 ) ) + if( ( pTeamSoldier->bAssignment == TRAIN_TEAMMATE ) && ( pTeamSoldier->stats.bLife > 0 ) ) { if ( !ValidTrainingPartnerInSameSectorOnAssignmentFound( pTeamSoldier, TRAIN_BY_OTHER, pTeamSoldier->bTrainStat ) ) { @@ -10194,7 +10234,7 @@ void ReportTrainersTraineesWithoutPartners( void ) { pTeamSoldier = &Menptr[ iCounter ]; - if( ( pTeamSoldier -> bAssignment == TRAIN_BY_OTHER ) && ( pTeamSoldier -> bLife > 0 ) ) + if( ( pTeamSoldier->bAssignment == TRAIN_BY_OTHER ) && ( pTeamSoldier->stats.bLife > 0 ) ) { if ( !ValidTrainingPartnerInSameSectorOnAssignmentFound( pTeamSoldier, TRAIN_TEAMMATE, pTeamSoldier->bTrainStat ) ) { @@ -10228,22 +10268,22 @@ BOOLEAN SetMercAsleep( SOLDIERTYPE *pSoldier, BOOLEAN fGiveWarning ) BOOLEAN PutMercInAsleepState( SOLDIERTYPE *pSoldier ) { - if( pSoldier -> fMercAsleep == FALSE ) + if( pSoldier->flags.fMercAsleep == FALSE ) { if( ( gfWorldLoaded ) && ( pSoldier->bInSector ) ) { if( guiCurrentScreen == GAME_SCREEN ) { - ChangeSoldierState( pSoldier, GOTO_SLEEP, 1, TRUE ); + pSoldier->ChangeSoldierState( GOTO_SLEEP, 1, TRUE ); } else { - ChangeSoldierState( pSoldier, SLEEPING, 1, TRUE ); + pSoldier->ChangeSoldierState( SLEEPING, 1, TRUE ); } } // set merc asleep - pSoldier -> fMercAsleep = TRUE; + pSoldier->flags.fMercAsleep = TRUE; // refresh panels fCharacterInfoPanelDirty = TRUE; @@ -10272,22 +10312,22 @@ BOOLEAN SetMercAwake( SOLDIERTYPE *pSoldier, BOOLEAN fGiveWarning, BOOLEAN fForc BOOLEAN PutMercInAwakeState( SOLDIERTYPE *pSoldier ) { - if ( pSoldier->fMercAsleep ) + if ( pSoldier->flags.fMercAsleep ) { if ( ( gfWorldLoaded ) && ( pSoldier->bInSector ) ) { if ( guiCurrentScreen == GAME_SCREEN ) { - ChangeSoldierState( pSoldier, WKAEUP_FROM_SLEEP, 1, TRUE ); - } + pSoldier->ChangeSoldierState( WKAEUP_FROM_SLEEP, 1, TRUE ); + } else { - ChangeSoldierState( pSoldier, STANDING, 1, TRUE ); + pSoldier->ChangeSoldierState( STANDING, 1, TRUE ); } } // set merc awake - pSoldier->fMercAsleep = FALSE; + pSoldier->flags.fMercAsleep = FALSE; // refresh panels fCharacterInfoPanelDirty = TRUE; @@ -10296,11 +10336,11 @@ BOOLEAN PutMercInAwakeState( SOLDIERTYPE *pSoldier ) // determine if merc is being forced to stay awake if ( pSoldier->bBreathMax < BREATHMAX_PRETTY_TIRED ) { - pSoldier->fForcedToStayAwake = TRUE; + pSoldier->flags.fForcedToStayAwake = TRUE; } else { - pSoldier->fForcedToStayAwake = FALSE; + pSoldier->flags.fForcedToStayAwake = FALSE; } } @@ -10309,11 +10349,11 @@ BOOLEAN PutMercInAwakeState( SOLDIERTYPE *pSoldier ) BOOLEAN IsThereASoldierInThisSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) { - if( fSectorsWithSoldiers[ sSectorX + sSectorY * MAP_WORLD_X ][ bSectorZ ] == TRUE ) + if( fSectorsWithSoldiers[ sSectorX + sSectorY * MAP_WORLD_X ][ bSectorZ ] == TRUE ) { return( TRUE ); } - + return( FALSE ); } @@ -10366,7 +10406,7 @@ BOOLEAN AnyMercInGroupCantContinueMoving( GROUP *pGroup ) while( pPlayer ) { - // if group has player list... and a valid first soldier + // if group has player list... and a valid first soldier if( pPlayer && pPlayer->pSoldier ) { pSoldier = pPlayer->pSoldier; @@ -10391,7 +10431,7 @@ BOOLEAN AnyMercInGroupCantContinueMoving( GROUP *pGroup ) PutMercInAsleepState( pSoldier ); // player can't wake him up right away - pSoldier->fMercCollapsedFlag = TRUE; + pSoldier->flags.fMercCollapsedFlag = TRUE; } } @@ -10414,13 +10454,13 @@ BOOLEAN PlayerSoldierTooTiredToTravel( SOLDIERTYPE *pSoldier ) if ( ( pSoldier->bAssignment != VEHICLE ) || SoldierMustDriveVehicle( pSoldier, pSoldier->iVehicleId, TRUE ) ) { // if awake, but so tired they can't move/drive anymore - if ( ( !pSoldier->fMercAsleep ) && ( pSoldier->bBreathMax < BREATHMAX_GOTTA_STOP_MOVING ) ) + if ( ( !pSoldier->flags.fMercAsleep ) && ( pSoldier->bBreathMax < BREATHMAX_GOTTA_STOP_MOVING ) ) { return( TRUE ); } // asleep, and can't be awakened? - if ( ( pSoldier->fMercAsleep ) && !CanCharacterBeAwakened( pSoldier, FALSE ) ) + if ( ( pSoldier->flags.fMercAsleep ) && !CanCharacterBeAwakened( pSoldier, FALSE ) ) { return( TRUE ); } @@ -10460,7 +10500,7 @@ BOOLEAN AssignMercToAMovementGroup( SOLDIERTYPE *pSoldier ) { return( FALSE ); } - + // create group bGroupId = CreateNewPlayerGroupDepartingFromSector( ( UINT8 )( pSoldier->sSectorX ), ( UINT8 )( pSoldier->sSectorY ) ); @@ -10468,7 +10508,7 @@ BOOLEAN AssignMercToAMovementGroup( SOLDIERTYPE *pSoldier ) { // add merc AddPlayerToGroup( bGroupId, pSoldier ); - + // success return( TRUE ); } @@ -10489,7 +10529,7 @@ void NotifyPlayerOfAssignmentAttemptFailure( INT8 bAssignment ) // use screen msg instead! ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMapErrorString[ 18 ] ); } - + if ( bAssignment == TRAIN_TOWN ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMapErrorString[ 48 ] ); @@ -10593,9 +10633,9 @@ BOOLEAN IsAnyOneOnPlayersTeamOnThisAssignment( INT8 bAssignment ) for( iCounter = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; iCounter <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; iCounter++ ) { - // get the current soldier + // get the current soldier pSoldier = &Menptr[ iCounter ]; - + // active? if( pSoldier->bActive == FALSE ) { @@ -10650,7 +10690,7 @@ void BandageBleedingDyingPatientsBeingTreated( ) } // and he is bleeding or dying - if( ( pSoldier->bBleeding ) || ( pSoldier->bLife < OKLIFE ) ) + if( ( pSoldier->bBleeding ) || ( pSoldier->stats.bLife < OKLIFE ) ) { // if soldier is receiving care if( ( pSoldier->bAssignment == PATIENT ) || ( pSoldier->bAssignment == ASSIGNMENT_HOSPITAL ) || ( pSoldier->bAssignment == DOCTOR ) ) @@ -10663,9 +10703,9 @@ void BandageBleedingDyingPatientsBeingTreated( ) // stop bleeding automatically pSoldier->bBleeding = 0; - if ( pSoldier->bLife < OKLIFE ) + if ( pSoldier->stats.bLife < OKLIFE ) { - pSoldier->bLife = OKLIFE; + pSoldier->stats.bLife = OKLIFE; } } else // assigned to DOCTOR/PATIENT @@ -10686,7 +10726,7 @@ void BandageBleedingDyingPatientsBeingTreated( ) UseKitPoints( pKit, (UINT16)uiKitPtsUsed, pDoctor ); // if he is STILL bleeding or dying - if( ( pSoldier->bBleeding ) || ( pSoldier->bLife < OKLIFE ) ) + if( ( pSoldier->bBleeding ) || ( pSoldier->stats.bLife < OKLIFE ) ) { fSomeoneStillBleedingDying = TRUE; } @@ -10699,7 +10739,7 @@ void BandageBleedingDyingPatientsBeingTreated( ) } - // this event may be posted many times because of multiple assignment changes. Handle it only once per minute! + // this event may be posted many times because of multiple assignment changes. Handle it only once per minute! DeleteAllStrategicEventsOfType( EVENT_BANDAGE_BLEEDING_MERCS ); if ( fSomeoneStillBleedingDying ) @@ -10751,12 +10791,12 @@ void ReEvaluateEveryonesNothingToDo() case TRAIN_TEAMMATE: fNothingToDo = !CanCharacterTrainStat( pSoldier, pSoldier->bTrainStat, FALSE, TRUE ) || - !ValidTrainingPartnerInSameSectorOnAssignmentFound( pSoldier, TRAIN_BY_OTHER, pSoldier->bTrainStat ); + !ValidTrainingPartnerInSameSectorOnAssignmentFound( pSoldier, TRAIN_BY_OTHER, pSoldier->bTrainStat ); break; case TRAIN_BY_OTHER: fNothingToDo = !CanCharacterTrainStat( pSoldier, pSoldier->bTrainStat, TRUE, FALSE ) || - !ValidTrainingPartnerInSameSectorOnAssignmentFound( pSoldier, TRAIN_TEAMMATE, pSoldier->bTrainStat ); + !ValidTrainingPartnerInSameSectorOnAssignmentFound( pSoldier, TRAIN_TEAMMATE, pSoldier->bTrainStat ); break; case VEHICLE: @@ -10767,10 +10807,10 @@ void ReEvaluateEveryonesNothingToDo() // if his flag is wrong - if ( fNothingToDo != pSoldier->fDoneAssignmentAndNothingToDoFlag ) + if ( fNothingToDo != pSoldier->flags.fDoneAssignmentAndNothingToDoFlag ) { // update it! - pSoldier->fDoneAssignmentAndNothingToDoFlag = fNothingToDo; + pSoldier->flags.fDoneAssignmentAndNothingToDoFlag = fNothingToDo; // update mapscreen's character list display fDrawCharacterList = TRUE; @@ -10830,7 +10870,7 @@ void SetAssignmentForList( INT8 bAssignment, INT8 bParam ) if( ( gCharactersList[ iCounter ].fValid ) && ( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE ) && ( iCounter != bSelectedAssignChar ) && - !(Menptr[ gCharactersList[ iCounter ].usSolID].uiStatusFlags & SOLDIER_VEHICLE ) ) + !(Menptr[ gCharactersList[ iCounter ].usSolID].flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { pSoldier = MercPtrs[ gCharactersList[ iCounter ].usSolID ]; @@ -10855,7 +10895,7 @@ void SetAssignmentForList( INT8 bAssignment, INT8 bParam ) { // set as patient pSoldier->bOldAssignment = pSoldier->bAssignment; - SetSoldierAssignment( pSoldier, PATIENT, 0,0,0 ); + SetSoldierAssignment( pSoldier, PATIENT, 0,0,0 ); fItWorked = TRUE; } break; @@ -10879,7 +10919,7 @@ void SetAssignmentForList( INT8 bAssignment, INT8 bParam ) // make sure he can repair the SPECIFIC thing being repaired too (must be in its sector, for example) /* - if ( pSelectedSoldier->fFixingSAMSite ) + if ( pSelectedSoldier->flags.fFixingSAMSite ) { fCanFixSpecificTarget = CanSoldierRepairSAM( pSoldier, SAM_SITE_REPAIR_DIVISOR ); } @@ -10889,7 +10929,7 @@ void SetAssignmentForList( INT8 bAssignment, INT8 bParam ) { fCanFixSpecificTarget = CanCharacterRepairVehicle( pSoldier, pSelectedSoldier->bVehicleUnderRepairID ); } - else if( pSoldier->fFixingRobot ) + else if( pSoldier->flags.fFixingRobot ) { fCanFixSpecificTarget = CanCharacterRepairRobot( pSoldier ); } @@ -10898,7 +10938,7 @@ void SetAssignmentForList( INT8 bAssignment, INT8 bParam ) { // set as repair pSoldier->bOldAssignment = pSoldier->bAssignment; - SetSoldierAssignment( pSoldier, REPAIR, pSelectedSoldier->fFixingSAMSite, pSelectedSoldier->fFixingRobot, pSelectedSoldier->bVehicleUnderRepairID ); + SetSoldierAssignment( pSoldier, REPAIR, pSelectedSoldier->flags.fFixingSAMSite, pSelectedSoldier->flags.fFixingRobot, pSelectedSoldier->bVehicleUnderRepairID ); fItWorked = TRUE; } } @@ -10960,7 +11000,7 @@ void SetAssignmentForList( INT8 bAssignment, INT8 bParam ) // if already in it, don't repor that as an error... if ( ( bCanJoinSquad == CHARACTER_CAN_JOIN_SQUAD ) || - ( bCanJoinSquad == CHARACTER_CANT_JOIN_SQUAD_ALREADY_IN_IT ) ) + ( bCanJoinSquad == CHARACTER_CANT_JOIN_SQUAD_ALREADY_IN_IT ) ) { if ( bCanJoinSquad == CHARACTER_CAN_JOIN_SQUAD ) { @@ -10969,7 +11009,7 @@ void SetAssignmentForList( INT8 bAssignment, INT8 bParam ) // is the squad between sectors if( Squad[ bAssignment ][ 0 ] ) { - if( Squad[ bAssignment ][ 0 ]->fBetweenSectors ) + if( Squad[ bAssignment ][ 0 ]->flags.fBetweenSectors ) { // between sectors, remove from old mvt group if ( pSoldier->bOldAssignment >= ON_DUTY ) @@ -10993,7 +11033,7 @@ void SetAssignmentForList( INT8 bAssignment, INT8 bParam ) RemoveCharacterFromSquads( pSoldier ); // able to add, do it - AddCharacterToSquad( pSoldier, bAssignment ); + AddCharacterToSquad( pSoldier, bAssignment ); } fItWorked = TRUE; @@ -11040,6 +11080,34 @@ void SetAssignmentForList( INT8 bAssignment, INT8 bParam ) // reset list // ResetSelectedListForMapScreen( ); + //CHRISL: When setting mercs to a squad, resort the Squad list so we're in ubID order so team panel appears the same + // when switching between squads + switch( bAssignment ) + { + case( SQUAD_1 ): + case( SQUAD_2 ): + case( SQUAD_3 ): + case( SQUAD_4 ): + case( SQUAD_5 ): + case( SQUAD_6 ): + case( SQUAD_7 ): + case( SQUAD_8 ): + case( SQUAD_9 ): + case( SQUAD_10 ): + case( SQUAD_11 ): + case( SQUAD_12 ): + case( SQUAD_13 ): + case( SQUAD_14 ): + case( SQUAD_15 ): + case( SQUAD_16 ): + case( SQUAD_17 ): + case( SQUAD_18 ): + case( SQUAD_19 ): + case( SQUAD_20 ): + SortSquadByID(bAssignment); + break; + } + // check if we should start/stop flashing any mercs' assignment strings after these changes gfReEvaluateEveryonesNothingToDo = TRUE; @@ -11051,7 +11119,7 @@ void SetAssignmentForList( INT8 bAssignment, INT8 bParam ) BOOLEAN IsCharacterAliveAndConscious( SOLDIERTYPE *pCharacter ) { // is the character alive and conscious? - if( pCharacter -> bLife < CONSCIOUSNESS ) + if( pCharacter->stats.bLife < CONSCIOUSNESS ) { return( FALSE ); } @@ -11065,7 +11133,6 @@ BOOLEAN ValidTrainingPartnerInSameSectorOnAssignmentFound( SOLDIERTYPE *pTargetS { INT32 iCounter = 0; SOLDIERTYPE *pSoldier = NULL; - BOOLEAN fFound = FALSE; INT16 sTrainingPts = 0; BOOLEAN fAtGunRange = FALSE; UINT16 usMaxPts; @@ -11083,25 +11150,25 @@ BOOLEAN ValidTrainingPartnerInSameSectorOnAssignmentFound( SOLDIERTYPE *pTargetS // if the guy is not the target, has the assignment we want, is training the same stat, and is in our sector, alive // and is training the stat we want if( ( pSoldier != pTargetSoldier ) && - ( pSoldier -> bAssignment == bTargetAssignment ) && + ( pSoldier->bAssignment == bTargetAssignment ) && // CJC: this seems incorrect in light of the check for bTargetStat and in any case would // cause a problem if the trainer was assigned and we weren't! - //( pSoldier -> bTrainStat == pTargetSoldier -> bTrainStat ) && - ( pSoldier -> sSectorX == pTargetSoldier -> sSectorX ) && - ( pSoldier -> sSectorY == pTargetSoldier -> sSectorY ) && - ( pSoldier -> bSectorZ == pTargetSoldier -> bSectorZ ) && - ( pSoldier -> bTrainStat == bTargetStat ) && - ( pSoldier -> bLife > 0 ) ) + //( pSoldier->bTrainStat == pTargetSoldier->bTrainStat ) && + ( pSoldier->sSectorX == pTargetSoldier->sSectorX ) && + ( pSoldier->sSectorY == pTargetSoldier->sSectorY ) && + ( pSoldier->bSectorZ == pTargetSoldier->bSectorZ ) && + ( pSoldier->bTrainStat == bTargetStat ) && + ( pSoldier->stats.bLife > 0 ) ) { // so far so good, now let's see if the trainer can really teach the student anything new // are we training in the sector with gun range in Alma? - if ( ( pSoldier -> sSectorX == GUN_RANGE_X ) && (pSoldier -> sSectorY == GUN_RANGE_Y ) && ( pSoldier -> bSectorZ == GUN_RANGE_Z ) ) + if ( ( pSoldier->sSectorX == GUN_RANGE_X ) && (pSoldier->sSectorY == GUN_RANGE_Y ) && ( pSoldier->bSectorZ == GUN_RANGE_Z ) ) { fAtGunRange = TRUE; } - if ( pSoldier -> bAssignment == TRAIN_TEAMMATE ) + if ( pSoldier->bAssignment == TRAIN_TEAMMATE ) { // pSoldier is the instructor, target is the student sTrainingPts = GetBonusTrainingPtsDueToInstructor( pSoldier, pTargetSoldier, bTargetStat, fAtGunRange, &usMaxPts ); @@ -11127,37 +11194,37 @@ BOOLEAN ValidTrainingPartnerInSameSectorOnAssignmentFound( SOLDIERTYPE *pTargetS void UnEscortEPC( SOLDIERTYPE *pSoldier ) { - if ( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) - { - BOOLEAN fGotInfo; - UINT16 usQuoteNum; - UINT16 usFactToSetToTrue; + if ( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) + { + BOOLEAN fGotInfo; + UINT16 usQuoteNum; + UINT16 usFactToSetToTrue; - SetupProfileInsertionDataForSoldier( pSoldier ); + SetupProfileInsertionDataForSoldier( pSoldier ); - fGotInfo = GetInfoForAbandoningEPC( pSoldier->ubProfile, &usQuoteNum, &usFactToSetToTrue ); - if ( fGotInfo ) - { - // say quote usQuoteNum - gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags |= PROFILE_MISC_FLAG_FORCENPCQUOTE; - TacticalCharacterDialogue( pSoldier, usQuoteNum ); + fGotInfo = GetInfoForAbandoningEPC( pSoldier->ubProfile, &usQuoteNum, &usFactToSetToTrue ); + if ( fGotInfo ) + { + // say quote usQuoteNum + gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags |= PROFILE_MISC_FLAG_FORCENPCQUOTE; + TacticalCharacterDialogue( pSoldier, usQuoteNum ); // the flag will be turned off in the remove-epc event - //gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags &= ~PROFILE_MISC_FLAG_FORCENPCQUOTE; - SetFactTrue( usFactToSetToTrue ); - } - SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_REMOVE_EPC, pSoldier->ubProfile, 0, 0, 0, 0 ); + //gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags &= ~PROFILE_MISC_FLAG_FORCENPCQUOTE; + SetFactTrue( usFactToSetToTrue ); + } + SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_REMOVE_EPC, pSoldier->ubProfile, 0, 0, 0, 0 ); - HandleFactForNPCUnescorted( pSoldier->ubProfile ); + HandleFactForNPCUnescorted( pSoldier->ubProfile ); - if ( pSoldier->ubProfile == JOHN ) - { - SOLDIERTYPE * pSoldier2; + if ( pSoldier->ubProfile == JOHN ) + { + SOLDIERTYPE * pSoldier2; - // unrecruit Mary as well - pSoldier2 = FindSoldierByProfileID( MARY, TRUE ); - if ( pSoldier2 ) - { - SetupProfileInsertionDataForSoldier( pSoldier2 ); + // unrecruit Mary as well + pSoldier2 = FindSoldierByProfileID( MARY, TRUE ); + if ( pSoldier2 ) + { + SetupProfileInsertionDataForSoldier( pSoldier2 ); fGotInfo = GetInfoForAbandoningEPC( MARY, &usQuoteNum, &usFactToSetToTrue ); if ( fGotInfo ) { @@ -11165,22 +11232,22 @@ void UnEscortEPC( SOLDIERTYPE *pSoldier ) gMercProfiles[ MARY ].ubMiscFlags |= PROFILE_MISC_FLAG_FORCENPCQUOTE; TacticalCharacterDialogue( pSoldier2, usQuoteNum ); // the flag will be turned off in the remove-epc event - //gMercProfiles[ MARY ].ubMiscFlags &= ~PROFILE_MISC_FLAG_FORCENPCQUOTE; + //gMercProfiles[ MARY ].ubMiscFlags &= ~PROFILE_MISC_FLAG_FORCENPCQUOTE; SetFactTrue( usFactToSetToTrue ); } - SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_REMOVE_EPC, MARY, 0, 0, 0, 0 ); - } - } - else if ( pSoldier->ubProfile == MARY ) - { - SOLDIERTYPE * pSoldier2; + SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_REMOVE_EPC, MARY, 0, 0, 0, 0 ); + } + } + else if ( pSoldier->ubProfile == MARY ) + { + SOLDIERTYPE * pSoldier2; - // unrecruit John as well - pSoldier2 = FindSoldierByProfileID( JOHN, TRUE ); - if ( pSoldier2 ) - { - SetupProfileInsertionDataForSoldier( pSoldier2 ); + // unrecruit John as well + pSoldier2 = FindSoldierByProfileID( JOHN, TRUE ); + if ( pSoldier2 ) + { + SetupProfileInsertionDataForSoldier( pSoldier2 ); fGotInfo = GetInfoForAbandoningEPC( JOHN, &usQuoteNum, &usFactToSetToTrue ); if ( fGotInfo ) { @@ -11188,32 +11255,32 @@ void UnEscortEPC( SOLDIERTYPE *pSoldier ) gMercProfiles[ JOHN ].ubMiscFlags |= PROFILE_MISC_FLAG_FORCENPCQUOTE; TacticalCharacterDialogue( pSoldier2, usQuoteNum ); // the flag will be turned off in the remove-epc event - //gMercProfiles[ JOHN ].ubMiscFlags &= ~PROFILE_MISC_FLAG_FORCENPCQUOTE; + //gMercProfiles[ JOHN ].ubMiscFlags &= ~PROFILE_MISC_FLAG_FORCENPCQUOTE; SetFactTrue( usFactToSetToTrue ); } - SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_REMOVE_EPC, JOHN, 0, 0, 0, 0 ); - } - } - // stop showing menu - giAssignHighLine = -1; + SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_REMOVE_EPC, JOHN, 0, 0, 0, 0 ); + } + } + // stop showing menu + giAssignHighLine = -1; - // set dirty flag - fTeamPanelDirty = TRUE; - fMapScreenBottomDirty = TRUE; - fCharacterInfoPanelDirty = TRUE; - } - else - { - // how do we handle this if it's the right sector? - TriggerNPCWithGivenApproach( pSoldier->ubProfile, APPROACH_EPC_IN_WRONG_SECTOR, TRUE ); - } + // set dirty flag + fTeamPanelDirty = TRUE; + fMapScreenBottomDirty = TRUE; + fCharacterInfoPanelDirty = TRUE; + } + else + { + // how do we handle this if it's the right sector? + TriggerNPCWithGivenApproach( pSoldier->ubProfile, APPROACH_EPC_IN_WRONG_SECTOR, TRUE ); + } } BOOLEAN CharacterIsTakingItEasy( SOLDIERTYPE *pSoldier ) { // actually asleep? - if ( pSoldier -> fMercAsleep == TRUE ) + if ( pSoldier->flags.fMercAsleep == TRUE ) { return( TRUE ); } @@ -11223,19 +11290,19 @@ BOOLEAN CharacterIsTakingItEasy( SOLDIERTYPE *pSoldier ) { // on duty, but able to catch naps (either not traveling, or not the driver of the vehicle) // The actual checks for this are in the "can he sleep" check above - if ( ( pSoldier -> bAssignment < ON_DUTY ) || ( pSoldier -> bAssignment == VEHICLE ) ) + if ( ( pSoldier->bAssignment < ON_DUTY ) || ( pSoldier->bAssignment == VEHICLE ) ) { return( TRUE ); } // and healing up? - if ( ( pSoldier -> bAssignment == PATIENT ) || ( pSoldier -> bAssignment == ASSIGNMENT_HOSPITAL ) ) + if ( ( pSoldier->bAssignment == PATIENT ) || ( pSoldier->bAssignment == ASSIGNMENT_HOSPITAL ) ) { return( TRUE ); } // on a real assignment, but done with it? - if ( pSoldier -> fDoneAssignmentAndNothingToDoFlag ) + if ( pSoldier->flags.fDoneAssignmentAndNothingToDoFlag ) { return( TRUE ); } @@ -11255,10 +11322,10 @@ UINT8 CalcSoldierNeedForSleep( SOLDIERTYPE *pSoldier ) // base comes from profile - ubNeedForSleep = gMercProfiles[ pSoldier -> ubProfile ].ubNeedForSleep; + ubNeedForSleep = gMercProfiles[ pSoldier->ubProfile ].ubNeedForSleep; - ubPercentHealth = pSoldier->bLife / pSoldier->bLifeMax; + ubPercentHealth = pSoldier->stats.bLife / pSoldier->stats.bLifeMax; if ( ubPercentHealth < 75 ) { @@ -11320,28 +11387,28 @@ BOOLEAN CanCharacterRepairAnotherSoldiersStuff( SOLDIERTYPE *pSoldier, SOLDIERTY { return( FALSE ); } - if ( pOtherSoldier->bLife == 0 ) + if ( pOtherSoldier->stats.bLife == 0 ) { return( FALSE ); } if ( pOtherSoldier->sSectorX != pSoldier->sSectorX || - pOtherSoldier->sSectorY != pSoldier->sSectorY || - pOtherSoldier->bSectorZ != pSoldier->bSectorZ ) + pOtherSoldier->sSectorY != pSoldier->sSectorY || + pOtherSoldier->bSectorZ != pSoldier->bSectorZ ) { return( FALSE ); } - if ( pOtherSoldier->fBetweenSectors ) + if ( pOtherSoldier->flags.fBetweenSectors ) { return( FALSE ); } if ( ( pOtherSoldier->bAssignment == IN_TRANSIT ) || - ( pOtherSoldier->bAssignment == ASSIGNMENT_POW ) || - ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) || - ( AM_A_ROBOT( pSoldier ) ) || - ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC ) || - ( pOtherSoldier->bAssignment == ASSIGNMENT_DEAD ) ) + ( pOtherSoldier->bAssignment == ASSIGNMENT_POW ) || + ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) || + ( AM_A_ROBOT( pSoldier ) ) || + ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC ) || + ( pOtherSoldier->bAssignment == ASSIGNMENT_DEAD ) ) { return( FALSE ); } @@ -11379,7 +11446,7 @@ SOLDIERTYPE *GetSelectedAssignSoldier( BOOLEAN fNullOK ) { // better be an active person, not a vehicle Assert( pSoldier->bActive ); - Assert( !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ); + Assert( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ); } return( pSoldier ); @@ -11447,7 +11514,6 @@ void RepairItemsOnOthers( SOLDIERTYPE *pSoldier, UINT8 *pubRepairPtsLeft ) { UINT8 ubPassType; INT8 bLoop; - INT8 bPocket; SOLDIERTYPE * pOtherSoldier; SOLDIERTYPE * pBestOtherSoldier; INT8 bPriority, bBestPriority = -1; @@ -11490,9 +11556,9 @@ void RepairItemsOnOthers( SOLDIERTYPE *pSoldier, UINT8 *pubRepairPtsLeft ) if ( CanCharacterRepairAnotherSoldiersStuff( pSoldier, pOtherSoldier ) ) { // okay, seems like a candidate! - if ( FindRepairableItemOnOtherSoldier( pOtherSoldier, ubPassType ) != NO_SLOT ) + if ( FindRepairableItemOnOtherSoldier( pOtherSoldier, ubPassType ) != 0 ) { - bPriority = pOtherSoldier->bExpLevel; + bPriority = pOtherSoldier->stats.bExpLevel; if ( bPriority > bBestPriority ) { bBestPriority = bPriority; @@ -11506,18 +11572,19 @@ void RepairItemsOnOthers( SOLDIERTYPE *pSoldier, UINT8 *pubRepairPtsLeft ) if ( pBestOtherSoldier != NULL ) { // yes, repair all items (for this pass type!) on this soldier that need repair + OBJECTTYPE * pObjectToRepair; do { - bPocket = FindRepairableItemOnOtherSoldier( pBestOtherSoldier, ubPassType ); - if ( bPocket != NO_SLOT ) + pObjectToRepair = FindRepairableItemOnOtherSoldier( pBestOtherSoldier, ubPassType ); + if ( pObjectToRepair ) { - if ( RepairObject( pSoldier, pBestOtherSoldier, &(pBestOtherSoldier->inv[ bPocket ]), pubRepairPtsLeft ) ) + if ( RepairObject( pSoldier, pBestOtherSoldier, pObjectToRepair, pubRepairPtsLeft ) ) { fSomethingWasRepairedThisPass = TRUE; } } } - while ( bPocket != NO_SLOT && *pubRepairPtsLeft > 0 ); + while ( pObjectToRepair && *pubRepairPtsLeft > 0 ); } else { @@ -11544,16 +11611,17 @@ BOOLEAN UnjamGunsOnSoldier( SOLDIERTYPE *pOwnerSoldier, SOLDIERTYPE *pRepairSold // try to unjam everything before beginning any actual repairs.. successful unjamming costs 2 points per weapon - for (bPocket = HANDPOS; bPocket <= SMALLPOCK8POS; bPocket++) + // CHRISL: Changed to dynamically determine max inventory locations. + for (bPocket = HANDPOS; bPocket < NUM_INV_SLOTS; bPocket++) { // the object a weapon? and jammed? - if ( ( Item[ pOwnerSoldier->inv[ bPocket ].usItem ].usItemClass == IC_GUN ) && ( pOwnerSoldier->inv[ bPocket ].ItemData.Gun.bGunAmmoStatus < 0 ) ) + if ( ( Item[ pOwnerSoldier->inv[ bPocket ].usItem ].usItemClass == IC_GUN ) && ( pOwnerSoldier->inv[ bPocket ][0]->data.gun.bGunAmmoStatus < 0 ) ) { if ( *pubRepairPtsLeft >= gGameExternalOptions.ubRepairCostPerJam ) { *pubRepairPtsLeft -= gGameExternalOptions.ubRepairCostPerJam; - pOwnerSoldier->inv [ bPocket ].ItemData.Gun.bGunAmmoStatus *= -1; + pOwnerSoldier->inv [ bPocket ][0]->data.gun.bGunAmmoStatus *= -1; // MECHANICAL/DEXTERITY GAIN: Unjammed a gun StatChange( pRepairSoldier, MECHANAMT, 5, FALSE ); @@ -11586,6 +11654,6 @@ BOOLEAN UnjamGunsOnSoldier( SOLDIERTYPE *pOwnerSoldier, SOLDIERTYPE *pRepairSold - + diff --git a/Strategic/Assignments.h b/Strategic/Assignments.h index 7006e691..07b2c70d 100644 --- a/Strategic/Assignments.h +++ b/Strategic/Assignments.h @@ -15,7 +15,7 @@ #define HEALABLE_THIS_HOUR 1 -// merc collapses from fatigue if max breath drops to this. Can't go any lower! +// merc collapses from fatigue if max breath drops to this. Can't go any lower! #define BREATHMAX_ABSOLUTE_MINIMUM 10 #define BREATHMAX_GOTTA_STOP_MOVING 30 #define BREATHMAX_PRETTY_TIRED 50 @@ -71,9 +71,9 @@ enum{ // Train stats defines (must match ATTRIB_MENU_ defines, and pAttributeMenuStrings ) enum{ STRENGTH = 0, - DEXTERITY, + DEXTERITY, AGILITY, - HEALTH, + HEALTH, MARKSMANSHIP, MEDICAL, MECHANICAL, @@ -210,15 +210,15 @@ extern INT32 ghMoveBox; //extern INT32 ghUpdateBox; -extern MOUSE_REGION gAssignmentScreenMaskRegion; +extern MOUSE_REGION gAssignmentScreenMaskRegion; -extern MOUSE_REGION gAssignmentMenuRegion[ ]; -extern MOUSE_REGION gTrainingMenuRegion[ ]; -extern MOUSE_REGION gAttributeMenuRegion[ ]; -extern MOUSE_REGION gSquadMenuRegion[ ]; -extern MOUSE_REGION gContractMenuRegion[ ]; -extern MOUSE_REGION gRemoveMercAssignRegion[ ]; -extern MOUSE_REGION gVehicleMenuRegion[]; +extern MOUSE_REGION gAssignmentMenuRegion[ ]; +extern MOUSE_REGION gTrainingMenuRegion[ ]; +extern MOUSE_REGION gAttributeMenuRegion[ ]; +extern MOUSE_REGION gSquadMenuRegion[ ]; +extern MOUSE_REGION gContractMenuRegion[ ]; +extern MOUSE_REGION gRemoveMercAssignRegion[ ]; +extern MOUSE_REGION gVehicleMenuRegion[]; extern BOOLEAN fShownContractMenu; extern BOOLEAN fShownAssignmentMenu; diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index 44563727..2365e564 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -70,12 +70,10 @@ #include "Reinforcement.h" -//#include "vtuneapi.h" - //#define INVULNERABILITY // default = 7 (%) -#define EXP_BONUS 7 +#define EXP_BONUS 7 #define MAX_AR_TEAM_SIZE 255 // Must fit in 8 bits @@ -108,7 +106,7 @@ enum NUM_AR_BUTTONS }; - + typedef struct SOLDIERCELL { SOLDIERTYPE *pSoldier; @@ -140,10 +138,10 @@ typedef struct AUTORESOLVE_STRUCT INT32 iIndent; INT32 iInterfaceBuffer; INT32 iNumMercFaces; - INT32 iActualMercFaces; //this represents the real number of merc faces. Because - //my debug mode allows to freely add and subtract mercs, we - //can add/remove temp mercs, but we don't want to remove the - //actual mercs. + INT32 iActualMercFaces; //this represents the real number of merc faces. Because + //my debug mode allows to freely add and subtract mercs, we + //can add/remove temp mercs, but we don't want to remove the + //actual mercs. UINT32 uiTimeSlice; UINT32 uiTotalElapsedBattleTimeInMilliseconds; UINT32 uiPrevTime, uiCurrTime; @@ -215,7 +213,7 @@ typedef struct AUTORESOLVE_STRUCT #define CELL_HITBYATTACKER 0x00001000 #define CELL_HITLASTFRAME 0x00002000 //Cell statii -#define CELL_SHOWRETREATTEXT 0x00004000 +#define CELL_SHOWRETREATTEXT 0x00004000 #define CELL_RETREATING 0x00008000 #define CELL_RETREATED 0x00010000 #define CELL_DIRTY 0x00020000 @@ -228,7 +226,7 @@ typedef struct AUTORESOLVE_STRUCT #define CELL_PLAYER ( CELL_MERC | CELL_MILITIA ) #define CELL_ENEMY ( CELL_ELITE | CELL_TROOP | CELL_ADMIN ) #define CELL_CREATURE ( CELL_AF_CREATURE | CELL_AM_CREATURE | CELL_YF_CREATURE | CELL_YM_CREATURE ) -#define CELL_FEMALECREATURE ( CELL_AF_CREATURE | CELL_YF_CREATURE ) +#define CELL_FEMALECREATURE ( CELL_AF_CREATURE | CELL_YF_CREATURE ) #define CELL_MALECREATURE ( CELL_AM_CREATURE | CELL_YM_CREATURE ) #define CELL_YOUNGCREATURE ( CELL_YF_CREATURE | CELL_YM_CREATURE ) #define CELL_INVOLVEDINCOMBAT ( CELL_FIREDATTARGET | CELL_DODGEDATTACK | CELL_HITBYATTACKER ) @@ -354,7 +352,7 @@ SOLDIERCELL *gpMercs = NULL; SOLDIERCELL *gpCivs = NULL; SOLDIERCELL *gpEnemies = NULL; -//Simple wrappers for autoresolve sounds that are played. +//Simple wrappers for autoresolve sounds that are played. void PlayAutoResolveSample( UINT32 usNum, UINT32 usRate, UINT32 ubVolume, UINT32 ubLoops, UINT32 uiPan ) { if( gpAR->fSound ) @@ -363,7 +361,7 @@ void PlayAutoResolveSample( UINT32 usNum, UINT32 usRate, UINT32 ubVolume, UINT32 } } -void PlayAutoResolveSampleFromFile( STR8 szFileName, UINT32 usRate, UINT32 ubVolume, UINT32 ubLoops, UINT32 uiPan ) +void PlayAutoResolveSampleFromFile( STR8 szFileName, UINT32 usRate, UINT32 ubVolume, UINT32 ubLoops, UINT32 uiPan ) { if( gpAR->fSound ) { @@ -382,7 +380,7 @@ void EliminateAllMercs() { for( i = 0; i < gpAR->ubEnemies; i++ ) { - if( gpEnemies[ i ].pSoldier->bLife ) + if( gpEnemies[ i ].pSoldier->stats.bLife ) { pAttacker = &gpEnemies[ i ]; break; @@ -392,10 +390,10 @@ void EliminateAllMercs() { for( i = 0; i < gpAR->ubMercs; i++ ) { - if( gpMercs[ i ].pSoldier->bLife ) + if( gpMercs[ i ].pSoldier->stats.bLife ) { iNum++; - gpMercs[ i ].pSoldier->bLife = 1; + gpMercs[ i ].pSoldier->stats.bLife = 1; gpMercs[ i ].usNextHit[0] = (UINT16)(250 * iNum); gpMercs[ i ].usHitDamage[0] = 100; gpMercs[ i ].pAttacker[0] = pAttacker; @@ -412,12 +410,12 @@ void EliminateAllFriendlies() { for( i = 0; i < gpAR->ubMercs; i++ ) { - gpMercs[ i ].pSoldier->bLife = 0; + gpMercs[ i ].pSoldier->stats.bLife = 0; } gpAR->ubAliveMercs = 0; for( i = 0; i < gpAR->ubCivs; i++ ) { - gpCivs[ i ].pSoldier->bLife = 0; + gpCivs[ i ].pSoldier->stats.bLife = 0; } gpAR->ubAliveCivs = 0; } @@ -495,7 +493,7 @@ void EliminateAllEnemies( UINT8 ubSectorX, UINT8 ubSectorY ) { for( i = 0; i < gpAR->ubEnemies; i++ ) { - gpEnemies[ i ].pSoldier->bLife = 0; + gpEnemies[ i ].pSoldier->stats.bLife = 0; } gpAR->ubAliveEnemies = 0; } @@ -519,7 +517,7 @@ void DoTransitionFromPreBattleInterfaceToAutoResolve() PauseTime( FALSE ); gpAR->fShowInterface = TRUE; - + SrcRect.iLeft = gpAR->Rect.iLeft; SrcRect.iTop = gpAR->Rect.iTop; SrcRect.iRight = gpAR->Rect.iRight; @@ -527,7 +525,7 @@ void DoTransitionFromPreBattleInterfaceToAutoResolve() iWidth = SrcRect.iRight - SrcRect.iLeft + 1; iHeight = SrcRect.iBottom - SrcRect.iTop + 1; - + uiTimeRange = 1000; iPercentage = 0; uiStartTime = GetJA2Clock(); @@ -546,12 +544,12 @@ void DoTransitionFromPreBattleInterfaceToAutoResolve() RenderButtonsFastHelp(); //save it BlitBufferToBuffer( FRAME_BUFFER, guiSAVEBUFFER, (UINT16)SrcRect.iLeft, (UINT16)SrcRect.iTop, (UINT16)SrcRect.iRight, (UINT16)SrcRect.iBottom ); - + //hide the autoresolve BlitBufferToBuffer( guiEXTRABUFFER, FRAME_BUFFER, (UINT16)SrcRect.iLeft, (UINT16)SrcRect.iTop, (UINT16)SrcRect.iRight, (UINT16)SrcRect.iBottom ); PlayJA2SampleFromFile( "SOUNDS\\Laptop power up (8-11).wav", RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); - while( iPercentage < 100 ) + while( iPercentage < 100 ) { uiCurrTime = GetJA2Clock(); iPercentage = (uiCurrTime-uiStartTime) * 100 / uiTimeRange; @@ -578,7 +576,7 @@ void DoTransitionFromPreBattleInterfaceToAutoResolve() RefreshScreen( NULL ); //Restore the previous rect. - BlitBufferToBuffer( guiEXTRABUFFER, FRAME_BUFFER, (UINT16)DstRect.iLeft, (UINT16)DstRect.iTop, + BlitBufferToBuffer( guiEXTRABUFFER, FRAME_BUFFER, (UINT16)DstRect.iLeft, (UINT16)DstRect.iTop, (UINT16)(DstRect.iRight-DstRect.iLeft+1), (UINT16)(DstRect.iBottom-DstRect.iTop+1) ); } //BlitBufferToBuffer( FRAME_BUFFER, guiSAVEBUFFER, 0, 0, 640, 480 ); @@ -610,15 +608,15 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve1"); Assert( gpMercs ); memset( gpMercs, 0, sizeof( SOLDIERCELL ) * 20 ); //Militia -- MAX_ALLOWABLE_MILITIA_PER_SECTOR max - gpCivs = (SOLDIERCELL*)MemAlloc( sizeof( SOLDIERCELL) * MAX_AR_TEAM_SIZE ); + gpCivs = (SOLDIERCELL*)MemAlloc( sizeof( SOLDIERCELL) * MAX_AR_TEAM_SIZE ); Assert( gpCivs ); - memset( gpCivs, 0, sizeof( SOLDIERCELL ) * MAX_AR_TEAM_SIZE ); + memset( gpCivs, 0, sizeof( SOLDIERCELL ) * MAX_AR_TEAM_SIZE ); //Enemies -- 32 max - gpEnemies = (SOLDIERCELL*)MemAlloc( sizeof( SOLDIERCELL) * MAX_AR_TEAM_SIZE ); + gpEnemies = (SOLDIERCELL*)MemAlloc( sizeof( SOLDIERCELL) * MAX_AR_TEAM_SIZE ); Assert( gpEnemies ); - memset( gpEnemies, 0, sizeof( SOLDIERCELL ) * MAX_AR_TEAM_SIZE ); + memset( gpEnemies, 0, sizeof( SOLDIERCELL ) * MAX_AR_TEAM_SIZE ); - //Set up autoresolve + //Set up autoresolve gpAR->fEnteringAutoResolve = TRUE; gpAR->ubSectorX = ubSectorX; gpAR->ubSectorY = ubSectorY; @@ -636,14 +634,14 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve1"); gpAR->ubPlayerDefenceAdvantage = 21; //Skewed to the player's advantage for convenience purposes. break; case ENEMY_INVASION_CODE: - gpAR->ubPlayerDefenceAdvantage = 0; + gpAR->ubPlayerDefenceAdvantage = 0; break; case CREATURE_ATTACK_CODE: gpAR->ubPlayerDefenceAdvantage = 0; break; default: //shouldn't happen - #ifdef JA2BETAVERSION + #ifdef JA2BETAVERSION ScreenMsg( FONT_RED, MSG_ERROR, L"Autoresolving with entering enemy sector code %d -- illegal KM:1", gubEnemyEncounterCode ); #endif break; @@ -728,7 +726,7 @@ UINT32 AutoResolveScreenHandle() HandleAutoResolveInput(); RenderAutoResolve(); - + SaveBackgroundRects(); RenderButtons(); RenderButtonsFastHelp(); @@ -739,18 +737,18 @@ UINT32 AutoResolveScreenHandle() void RefreshMerc( SOLDIERTYPE *pSoldier ) { - pSoldier->bLife = pSoldier->bLifeMax; + pSoldier->stats.bLife = pSoldier->stats.bLifeMax; pSoldier->bBleeding = 0; pSoldier->bBreath = pSoldier->bBreathMax = 100; pSoldier->sBreathRed = 0; if( gpAR->pRobotCell) { - UpdateRobotControllerGivenRobot( gpAR->pRobotCell->pSoldier ); + gpAR->pRobotCell->pSoldier->UpdateRobotControllerGivenRobot( ); } //gpAR->fUnlimitedAmmo = TRUE; } -//Now assign the pSoldier->ubGroupIDs for the enemies, so we know where to remove them. Start with +//Now assign the pSoldier->ubGroupIDs for the enemies, so we know where to remove them. Start with //stationary groups first. void AssociateEnemiesWithStrategicGroups() { @@ -801,7 +799,7 @@ void AssociateEnemiesWithStrategicGroups() ubNumAdmins = gpAR->ubAdmins - pSector->ubNumAdmins; ubNumTroops = gpAR->ubTroops - pSector->ubNumTroops; ubNumElites = gpAR->ubElites - pSector->ubNumElites; - + if( !ubNumElites && !ubNumTroops && !ubNumAdmins ) { //All troops accounted for. return; @@ -852,7 +850,7 @@ void AssociateEnemiesWithStrategicGroups() pGroup = gpGroupList; while( pGroup ) { // Don't process road block. It'll be processed as static - if( pGroup->ubGroupID && !pGroup->fPlayer && IsGroupInARightSectorToReinforce( pGroup, gpAR->ubSectorX, gpAR->ubSectorY ) ) + if( pGroup->ubGroupID && !pGroup->fPlayer && IsGroupInARightSectorToReinforce( pGroup, gpAR->ubSectorX, gpAR->ubSectorY ) ) { ubNumElitesInGroup = pGroup->pEnemyGroup->ubNumElites; ubNumTroopsInGroup = pGroup->pEnemyGroup->ubNumTroops; @@ -945,15 +943,15 @@ void CalculateSoldierCells( BOOLEAN fReset ) INT32 i, x, y; INT32 index, iStartY, iTop, gapStartRow; INT32 iMaxTeamSize; - + gpAR->ubAliveMercs = gpAR->ubMercs; gpAR->ubAliveCivs = gpAR->ubCivs; gpAR->ubAliveEnemies = gpAR->ubEnemies; //iMaxTeamSize = max( gpAR->ubMercs + gpAR->ubCivs, gpAR->ubEnemies ); - iMaxTeamSize = max( min( 40, gpAR->ubMercs + gpAR->ubCivs ), min( 40, gpAR->ubEnemies ) ); + iMaxTeamSize = max( min( 40, gpAR->ubMercs + gpAR->ubCivs ), min( 40, gpAR->ubEnemies ) ); + - if( iMaxTeamSize > 12 ) { gpAR->ubTimeModifierPercentage = (UINT8)(118 - iMaxTeamSize*1.5); @@ -963,7 +961,7 @@ void CalculateSoldierCells( BOOLEAN fReset ) gpAR->ubTimeModifierPercentage = 100; } gpAR->uiTimeSlice = gpAR->uiTimeSlice * gpAR->ubTimeModifierPercentage / 100; - + iTop = iScreenHeightOffset + (240 - gpAR->sHeight/2); if( iTop > (iScreenHeightOffset + 120) ) iTop -= 40; @@ -976,7 +974,7 @@ void CalculateSoldierCells( BOOLEAN fReset ) x = gpAR->ubMercCols; i = gpAR->ubMercs; gapStartRow = gpAR->ubMercRows - gpAR->ubMercRows * gpAR->ubMercCols + gpAR->ubMercs; - for( x = 0; x < gpAR->ubMercCols; x++ ) for( y = 0; i && y < gpAR->ubMercRows; y++, i-- ) + for( x = 0; x < gpAR->ubMercCols; x++ ) for( y = 0; i && y < gpAR->ubMercRows; y++, i-- ) { index = y * gpAR->ubMercCols + gpAR->ubMercCols - x - 1; if( y >= gapStartRow ) @@ -984,7 +982,7 @@ void CalculateSoldierCells( BOOLEAN fReset ) Assert( index >= 0 && index < gpAR->ubMercs ); gpMercs[ index ].xp = gpAR->sCenterStartX + 3 - 55*(x+1); - gpMercs[ index ].yp = iStartY + y*47; + gpMercs[ index ].yp = iStartY + y*47; gpMercs[ index ].uiFlags = CELL_MERC; if( AM_AN_EPC( gpMercs[ index ].pSoldier ) ) { @@ -1000,12 +998,12 @@ void CalculateSoldierCells( BOOLEAN fReset ) gpMercs[ index ].pRegion = (MOUSE_REGION*)MemAlloc( sizeof( MOUSE_REGION ) ); Assert( gpMercs[ index ].pRegion ); memset( gpMercs[ index ].pRegion, 0, sizeof( MOUSE_REGION ) ); - MSYS_DefineRegion( gpMercs[ index ].pRegion, gpMercs[ index ].xp, gpMercs[ index ].yp, + MSYS_DefineRegion( gpMercs[ index ].pRegion, gpMercs[ index ].xp, gpMercs[ index ].yp, (UINT16)(gpMercs[ index ].xp + 50), (UINT16)(gpMercs[ index ].yp + 44), MSYS_PRIORITY_HIGH, 0, MercCellMouseMoveCallback, MercCellMouseClickCallback ); if( fReset ) RefreshMerc( gpMercs[ index ].pSoldier ); - if( !gpMercs[ index ].pSoldier->bLife ) + if( !gpMercs[ index ].pSoldier->stats.bLife ) gpAR->ubAliveMercs--; } } @@ -1018,7 +1016,7 @@ void CalculateSoldierCells( BOOLEAN fReset ) for( index = 0; index < gpAR->ubCivs ; ++index ) { - x = gpAR->ubCivCols - 1 - index % gpAR->ubCivCols; + x = gpAR->ubCivCols - 1 - index % gpAR->ubCivCols; y = index / gpAR->ubCivCols; gpCivs[ index ].xp = gpAR->sCenterStartX + 3 - 55*(x+1); @@ -1081,7 +1079,7 @@ INT32 DetermineCellID( SOLDIERCELL *pCell ) if( &gpCivs[ iIndex ] == pCell ) return iIndex; } - + return 0; } @@ -1120,7 +1118,7 @@ void RenderSoldierCell( SOLDIERCELL *pCell ) BltVideoObjectFromIndex( FRAME_BUFFER, gpAR->iPanelImages, OTHER_PANEL, pCell->xp, pCell->yp, VO_BLT_SRCTRANSPARENCY, NULL ); x = 6; } - if( !pCell->pSoldier->bLife ) + if( !pCell->pSoldier->stats.bLife ) { SetObjectHandleShade( pCell->uiVObjectID, 0 ); if( !(pCell->uiFlags & CELL_CREATURE) ) @@ -1146,8 +1144,8 @@ void RenderSoldierCell( SOLDIERCELL *pCell ) BltVideoObjectFromIndex( FRAME_BUFFER, pCell->uiVObjectID, pCell->usIndex, pCell->xp+3+x, pCell->yp+3, VO_BLT_SRCTRANSPARENCY, NULL ); } } - - if( pCell->pSoldier->bLife > 0 && pCell->pSoldier->bLife < OKLIFE && !(pCell->uiFlags & (CELL_HITBYATTACKER|CELL_HITLASTFRAME|CELL_CREATURE)) ) + + if( pCell->pSoldier->stats.bLife > 0 && pCell->pSoldier->stats.bLife < OKLIFE && !(pCell->uiFlags & (CELL_HITBYATTACKER|CELL_HITLASTFRAME|CELL_CREATURE)) ) { //Merc is unconcious (and not taking damage), so darken his portrait. UINT8 *pDestBuf; UINT32 uiDestPitchBYTES; @@ -1192,10 +1190,10 @@ void RenderSoldierCellBars( SOLDIERCELL *pCell ) { INT32 iStartY; //HEALTH BAR - if( !pCell->pSoldier->bLife ) + if( !pCell->pSoldier->stats.bLife ) return; //yellow one for bleeding - iStartY = pCell->yp + 29 - 25*pCell->pSoldier->bLifeMax/100; + iStartY = pCell->yp + 29 - 25*pCell->pSoldier->stats.bLifeMax/100; ColorFillVideoSurfaceArea( FRAME_BUFFER, pCell->xp+37, iStartY, pCell->xp+38, pCell->yp+29, Get16BPPColor( FROMRGB( 107, 107, 57 ) ) ); ColorFillVideoSurfaceArea( FRAME_BUFFER, pCell->xp+38, iStartY, pCell->xp+39, pCell->yp+29, Get16BPPColor( FROMRGB( 222, 181, 115 ) ) ); //pink one for bandaged. @@ -1203,7 +1201,7 @@ void RenderSoldierCellBars( SOLDIERCELL *pCell ) ColorFillVideoSurfaceArea( FRAME_BUFFER, pCell->xp+37, iStartY, pCell->xp+38, pCell->yp+29, Get16BPPColor( FROMRGB( 156, 57, 57 ) ) ); ColorFillVideoSurfaceArea( FRAME_BUFFER, pCell->xp+38, iStartY, pCell->xp+39, pCell->yp+29, Get16BPPColor( FROMRGB( 222, 132, 132 ) ) ); //red one for actual health - iStartY = pCell->yp + 29 - 25*pCell->pSoldier->bLife/100; + iStartY = pCell->yp + 29 - 25*pCell->pSoldier->stats.bLife/100; ColorFillVideoSurfaceArea( FRAME_BUFFER, pCell->xp+37, iStartY, pCell->xp+38, pCell->yp+29, Get16BPPColor( FROMRGB( 107, 8, 8 ) ) ); ColorFillVideoSurfaceArea( FRAME_BUFFER, pCell->xp+38, iStartY, pCell->xp+39, pCell->yp+29, Get16BPPColor( FROMRGB( 206, 0, 0 ) ) ); //BREATH BAR @@ -1211,7 +1209,7 @@ void RenderSoldierCellBars( SOLDIERCELL *pCell ) ColorFillVideoSurfaceArea( FRAME_BUFFER, pCell->xp+41, iStartY, pCell->xp+42, pCell->yp+29, Get16BPPColor( FROMRGB( 8, 8, 132 ) ) ); ColorFillVideoSurfaceArea( FRAME_BUFFER, pCell->xp+42, iStartY, pCell->xp+43, pCell->yp+29, Get16BPPColor( FROMRGB( 8, 8, 107 ) ) ); //MORALE BAR - iStartY = pCell->yp + 29 - 25*pCell->pSoldier->bMorale/100; + iStartY = pCell->yp + 29 - 25*pCell->pSoldier->aiData.bMorale/100; ColorFillVideoSurfaceArea( FRAME_BUFFER, pCell->xp+45, iStartY, pCell->xp+46, pCell->yp+29, Get16BPPColor( FROMRGB( 8, 156, 8 ) ) ); ColorFillVideoSurfaceArea( FRAME_BUFFER, pCell->xp+46, iStartY, pCell->xp+47, pCell->yp+29, Get16BPPColor( FROMRGB( 8, 107, 8 ) ) ); } @@ -1238,8 +1236,8 @@ void BuildInterfaceBuffer() DestRect.iRight = gpAR->sWidth; DestRect.iBottom = gpAR->sHeight; - //create buffer for the transition slot for merc items. This slot contains the newly - //selected item graphic in it's inventory size version. This buffer is then scaled down + //create buffer for the transition slot for merc items. This slot contains the newly + //selected item graphic in it's inventory size version. This buffer is then scaled down //into the associated merc inventory panel slot buffer which is approximately 20% smaller. GetCurrentVideoSettings( &usUselessWidth, &usUselessHeight, &ubBitDepth ); vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE; @@ -1400,10 +1398,10 @@ UINT32 VirtualSoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, OB if( pVictim->bBleeding < 1 ) return 0; // nothing to do, shouldn't have even been called! - if ( pVictim->bLife == 0 ) + if ( pVictim->stats.bLife == 0 ) return 0; - // calculate wound-dressing skill (3x medical, 2x equip,1x level, 1x dex) + // calculate wound-dressing skill (3x medical, 2x equip,1x level, 1x dex) uiDressSkill = ( ( 3 * EffectiveMedical( pSoldier ) ) + // medical knowledge ( 2 * sStatus) + // state of medical kit (10 * EffectiveExpLevel( pSoldier ) ) + // battle injury experience @@ -1415,7 +1413,7 @@ UINT32 VirtualSoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, OB // OK, If we are in real-time, use another value... if (!(gTacticalStatus.uiFlags & TURNBASED) || !(gTacticalStatus.uiFlags & INCOMBAT ) ) { // Set to a value which looks good based on out tactical turns duration - uiAvailAPs = RT_FIRST_AID_GAIN_MODIFIER; + uiAvailAPs = RT_FIRST_AID_GAIN_MODIFIER; } // calculate how much bandaging CAN be done this turn @@ -1431,10 +1429,10 @@ UINT32 VirtualSoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, OB uiActual = uiPossible; // start by assuming maximum possible // figure out how far below OKLIFE the victim is - if (pVictim->bLife >= OKLIFE) + if (pVictim->stats.bLife >= OKLIFE) bBelowOKlife = 0; else - bBelowOKlife = OKLIFE - pVictim->bLife; + bBelowOKlife = OKLIFE - pVictim->stats.bLife; // figure out how many healing pts we need to stop dying (2x cost) uiDeficiency = (2 * bBelowOKlife ); @@ -1455,7 +1453,7 @@ UINT32 VirtualSoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, OB uiMedcost = uiActual / 2; // cost is only half if ( uiMedcost == 0 && uiActual > 0) uiMedcost = 1; - if ( uiMedcost > (UINT32)sKitPts ) // if we can't afford this + if ( uiMedcost > (UINT32)sKitPts ) // if we can't afford this { uiMedcost = sKitPts; // what CAN we afford? uiActual = uiMedcost * 2; // give double this as aid @@ -1467,19 +1465,19 @@ UINT32 VirtualSoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, OB if ( uiMedcost == 0 && uiActual > 0) uiMedcost = 1; if ( uiMedcost > (UINT32)sKitPts) // can't afford it - uiMedcost = uiActual = sKitPts; // recalc cost AND aid + uiMedcost = uiActual = sKitPts; // recalc cost AND aid } - + bPtsLeft = (INT8)uiActual; // heal real life points first (if below OKLIFE) because we don't want the // patient still DYING if bandages run out, or medic is disabled/distracted! // NOTE: Dressing wounds for life below OKLIFE now costs 2 pts/life point! - if ( bPtsLeft && pVictim->bLife < OKLIFE) + if ( bPtsLeft && pVictim->stats.bLife < OKLIFE) { // if we have enough points to bring him all the way to OKLIFE this turn if ( bPtsLeft >= (2 * bBelowOKlife ) ) { // raise life to OKLIFE - pVictim->bLife = OKLIFE; + pVictim->stats.bLife = OKLIFE; // reduce bleeding by the same number of life points healed up pVictim->bBleeding -= bBelowOKlife; // use up appropriate # of actual healing points @@ -1487,7 +1485,7 @@ UINT32 VirtualSoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, OB } else { - pVictim->bLife += ( bPtsLeft / 2); + pVictim->stats.bLife += ( bPtsLeft / 2); pVictim->bBleeding -= ( bPtsLeft / 2); bPtsLeft = bPtsLeft % 2; // if ptsLeft was odd, ptsLeft = 1 } @@ -1497,14 +1495,14 @@ UINT32 VirtualSoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, OB pVictim->bBleeding = 0; // if this healing brought the patient out of the worst of it, cancel dying - if (pVictim->bLife >= OKLIFE ) + if (pVictim->stats.bLife >= OKLIFE ) { // turn off merc QUOTE flags - pVictim->fDyingComment = FALSE; + pVictim->flags.fDyingComment = FALSE; } if ( pVictim->bBleeding <= MIN_BLEEDING_THRESHOLD ) { - pVictim->fWarnedAboutBleeding = FALSE; + pVictim->flags.fWarnedAboutBleeding = FALSE; } } @@ -1534,11 +1532,11 @@ UINT32 VirtualSoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, OB uiUsedAPs = ( uiUsedAPs * 2) / 3; // reverse 50% bonus by taking 2/3rds if ( uiActual / 2) - // MEDICAL GAIN (actual / 2): Helped someone by giving first aid + // MEDICAL GAIN (actual / 2): Helped someone by giving first aid StatChange(pSoldier,MEDICALAMT,( (UINT16)(uiActual / 2) ),FALSE); if ( uiActual / 4) - // DEXTERITY GAIN (actual / 4): Helped someone by giving first aid + // DEXTERITY GAIN (actual / 4): Helped someone by giving first aid StatChange(pSoldier,DEXTAMT,(UINT16)( ( uiActual / 4) ),FALSE); return uiMedcost; @@ -1561,7 +1559,7 @@ OBJECTTYPE* FindMedicalKit() UINT32 AutoBandageMercs() { - INT32 i, iBest; + INT32 i, iBest; UINT32 uiPointsUsed, uiCurrPointsUsed, uiMaxPointsUsed, uiParallelPointsUsed; UINT16 usKitPts; OBJECTTYPE *pKit = NULL; @@ -1569,14 +1567,14 @@ UINT32 AutoBandageMercs() BOOLEAN fComplete = TRUE; INT8 bSlot, cnt; - //Do we have any doctors? If so, bandage selves first. + //Do we have any doctors? If so, bandage selves first. fFound = FALSE; uiMaxPointsUsed = uiParallelPointsUsed = 0; for( i = 0; i < gpAR->ubMercs; i++ ) { - if( gpMercs[ i ].pSoldier->bLife >= OKLIFE && - !gpMercs[ i ].pSoldier->bCollapsed && - gpMercs[ i ].pSoldier->bMedical > 0 && + if( gpMercs[ i ].pSoldier->stats.bLife >= OKLIFE && + !gpMercs[ i ].pSoldier->bCollapsed && + gpMercs[ i ].pSoldier->stats.bMedical > 0 && ( bSlot = FindObjClass( gpMercs[ i ].pSoldier, IC_MEDKIT ) ) != NO_SLOT ) { fFound = TRUE; @@ -1590,7 +1588,7 @@ UINT32 AutoBandageMercs() if( !usKitPts ) { //attempt to find another kit before stopping if( ( bSlot = FindObjClass( gpMercs[ i ].pSoldier, IC_MEDKIT ) ) != NO_SLOT ) - continue; + continue; break; } uiPointsUsed = VirtualSoldierDressWound( gpMercs[ i ].pSoldier, gpMercs[ i ].pSoldier, pKit, usKitPts, usKitPts ); @@ -1612,9 +1610,9 @@ UINT32 AutoBandageMercs() iBest = 0; for( i = 0; i < gpAR->ubMercs; i++ ) { - if( gpMercs[ i ].pSoldier->bLife >= OKLIFE && !gpMercs[ i ].pSoldier->bCollapsed && gpMercs[ i ].pSoldier->bMedical > 0 ) + if( gpMercs[ i ].pSoldier->stats.bLife >= OKLIFE && !gpMercs[ i ].pSoldier->bCollapsed && gpMercs[ i ].pSoldier->stats.bMedical > 0 ) { - if( gpMercs[ i ].pSoldier->bMedical > gpMercs[ iBest ].pSoldier->bMedical ) + if( gpMercs[ i ].pSoldier->stats.bMedical > gpMercs[ iBest ].pSoldier->stats.bMedical ) { iBest = i; } @@ -1623,7 +1621,7 @@ UINT32 AutoBandageMercs() for( i = 0; i < gpAR->ubMercs; i++ ) { - while( gpMercs[ i ].pSoldier->bBleeding && gpMercs[ i ].pSoldier->bLife ) + while( gpMercs[ i ].pSoldier->bBleeding && gpMercs[ i ].pSoldier->stats.bLife ) { //This merc needs medical attention if( !pKit ) { @@ -1665,12 +1663,9 @@ void RenderAutoResolve() INT32 i; HVSURFACE hVSurface; INT32 xp, yp; - SOLDIERCELL *pCell = NULL; - INT32 index = 0; CHAR16 str[100]; - UINT8 bTownId = 0; UINT8 ubGood, ubBad; - + if( gpAR->fExpanding ) { //animate the expansion of the window. ExpandWindow(); @@ -1740,12 +1735,12 @@ void RenderAutoResolve() { RenderSoldierCell( &gpEnemies[ i ] ); } - + //Render the titles SetFont( FONT10ARIALBOLD ); SetFontForeground( FONT_WHITE ); SetFontShadow( FONT_NEARBLACK ); - + switch( gubEnemyEncounterCode ) { case NO_ENCOUNTER_CODE: @@ -1758,7 +1753,7 @@ void RenderAutoResolve() case CREATURE_ATTACK_CODE: swprintf( str, gpStrategicString[STR_AR_DEFEND_HEADER] ); break; - default: + default: swprintf( str, gpStrategicString[STR_AR_ATTACK_HEADER] ); break; } @@ -1790,11 +1785,11 @@ void RenderAutoResolve() { SetFontForeground( FONT_LTGREEN ); } - else + else { SetFontForeground( FONT_YELLOW ); } - + xp = gpAR->sCenterStartX + 70 - StringPixLength( str, FONT14ARIAL )/2; yp += 11; mprintf( xp, yp, str ); @@ -1811,7 +1806,7 @@ void RenderAutoResolve() DisplayWrappedString( (UINT16)(gpAR->sCenterStartX+16), (UINT16)(iScreenHeightOffset + 230+gpAR->bVerticalOffset), 108, 2, (UINT8)FONT10ARIAL, FONT_YELLOW, gpStrategicString[ STR_ENEMY_SURRENDER_OFFER ], FONT_BLACK, FALSE, LEFT_JUSTIFIED ); } - + if( gpAR->ubBattleStatus != BATTLE_IN_PROGRESS ) { // Handle merc morale, Global loyalty, and change of sector control @@ -1837,7 +1832,7 @@ void RenderAutoResolve() HandleMoraleEvent( NULL, MORALE_BATTLE_WON, gpAR->ubSectorX, gpAR->ubSectorY, 0 ); if( ProcessLoyalty() )HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_BATTLE_WON, gpAR->ubSectorX, gpAR->ubSectorY, 0 ); - SectorInfo[ SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ) ].bLastKnownEnemies = 0; + SectorInfo[ SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ) ].bLastKnownEnemies = 0; SetThisSectorAsPlayerControlled( gpAR->ubSectorX, gpAR->ubSectorY, 0, TRUE ); SetMusicMode( MUSIC_TACTICAL_VICTORY ); @@ -1848,7 +1843,7 @@ void RenderAutoResolve() case BATTLE_CAPTURED: for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bLife && !(MercPtrs[ i ]->uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( MercPtrs[ i ] ) ) + if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && !(MercPtrs[ i ]->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( MercPtrs[ i ] ) ) { //Merc is active and alive, and not a vehicle or robot if ( PlayerMercInvolvedInThisCombat( MercPtrs[ i ] ) ) { @@ -1880,7 +1875,7 @@ void RenderAutoResolve() break; case BATTLE_RETREAT: - + //Tack on 5 minutes for retreat. gpAR->uiTotalElapsedBattleTimeInMilliseconds += 300000; @@ -1938,7 +1933,7 @@ void RenderAutoResolve() //Render the total battle time elapsed. SetFont( FONT10ARIAL ); - swprintf( str, L"%s: %dm %02ds", + swprintf( str, L"%s: %dm %02ds", gpStrategicString[ STR_AR_TIME_ELAPSED ], gpAR->uiTotalElapsedBattleTimeInMilliseconds/60000, (gpAR->uiTotalElapsedBattleTimeInMilliseconds%60000)/1000 ); @@ -2037,7 +2032,7 @@ static void ARCreateMilitiaSquad( UINT8 *cnt, UINT8 ubEliteMilitia, UINT8 ubRegM void CreateAutoResolveInterface() { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; INT32 i, index; HVOBJECT hVObject; UINT8 ubGreenMilitia, ubRegMilitia, ubEliteMilitia; @@ -2105,7 +2100,7 @@ void CreateAutoResolveInterface() hVObject->pShades[ 1 ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 250, 25, 25, TRUE ); } - //Add the battle over panels + //Add the battle over panels sprintf( VObjectDesc.ImageFile, "Interface\\indent.sti" ); if( !AddVideoObject( &VObjectDesc, (UINT32 *)&gpAR->iIndent ) ) { @@ -2134,9 +2129,9 @@ void CreateAutoResolveInterface() } } - // 0verhaul: The following code was modified so that militia bookkeeping could be handled. - // In the previous auto-resolve method, promotions were often lost because the sector did not - // actually have the militia to be promoted--they came from surrounding sectors. The + // 0verhaul: The following code was modified so that militia bookkeeping could be handled. + // In the previous auto-resolve method, promotions were often lost because the sector did not + // actually have the militia to be promoted--they came from surrounding sectors. The // sector X and Y are not actually used for auto-resolve itself, so I can use it to adjust // both the actual sector counts and the promotions, by using the origin sectors of each // soldier. @@ -2144,7 +2139,7 @@ void CreateAutoResolveInterface() ubRegMilitia = MilitiaInSectorOfRank( gpAR->ubSectorX, gpAR->ubSectorY, REGULAR_MILITIA ); ubGreenMilitia = MilitiaInSectorOfRank( gpAR->ubSectorX, gpAR->ubSectorY, GREEN_MILITIA ); - // This block should be unnecessary. If the counts do not line up, there is a bug. + // This block should be unnecessary. If the counts do not line up, there is a bug. #if 0 while( ubEliteMilitia + ubRegMilitia + ubGreenMilitia < gpAR->ubCivs ) { @@ -2162,7 +2157,7 @@ void CreateAutoResolveInterface() ARCreateMilitiaSquad( &cnt, ubEliteMilitia, ubRegMilitia, ubGreenMilitia, gpAR->ubSectorX, gpAR->ubSectorY); // Add the militia in the surrounding sectors - GenerateDirectionInfos( gpAR->ubSectorX, gpAR->ubSectorY, &uiDirNumber, pMoveDir, + GenerateDirectionInfos( gpAR->ubSectorX, gpAR->ubSectorY, &uiDirNumber, pMoveDir, ( GetTownIdForSector( gpAR->ubSectorX, gpAR->ubSectorY ) != BLANK_SECTOR ? TRUE : FALSE ), TRUE, FALSE ); for( i=0; iubElites; i++, index++ ) @@ -2263,7 +2257,7 @@ void CreateAutoResolveInterface() gfBlitBattleSectorLocator = FALSE; } - //Build the interface buffer, and blit the "shaded" background. This info won't + //Build the interface buffer, and blit the "shaded" background. This info won't //change from now on, but will be used to restore text. BuildInterfaceBuffer(); BlitBufferToBuffer( guiSAVEBUFFER, FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); @@ -2272,22 +2266,22 @@ void CreateAutoResolveInterface() //move the buttons up by the same amount. gpAR->bVerticalOffset = (240 - gpAR->sHeight/2) > 120 ? -40 : 0; - + //Create the buttons -- subject to relocation - gpAR->iButton[ PLAY_BUTTON ] = + gpAR->iButton[ PLAY_BUTTON ] = QuickCreateButton( gpAR->iButtonImage[ PLAY_BUTTON ] , (INT16)(gpAR->sCenterStartX+11), (INT16)(iScreenHeightOffset + 240+gpAR->bVerticalOffset), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, PlayButtonCallback ); - gpAR->iButton[ FAST_BUTTON ] = + gpAR->iButton[ FAST_BUTTON ] = QuickCreateButton( gpAR->iButtonImage[ FAST_BUTTON ] , (INT16)(gpAR->sCenterStartX+51), (INT16)(iScreenHeightOffset + 240+gpAR->bVerticalOffset), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, FastButtonCallback ); - gpAR->iButton[ FINISH_BUTTON ] = + gpAR->iButton[ FINISH_BUTTON ] = QuickCreateButton( gpAR->iButtonImage[ FINISH_BUTTON ] , (INT16)(gpAR->sCenterStartX+91), (INT16)(iScreenHeightOffset + 240+gpAR->bVerticalOffset), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, FinishButtonCallback ); - gpAR->iButton[ PAUSE_BUTTON ] = + gpAR->iButton[ PAUSE_BUTTON ] = QuickCreateButton( gpAR->iButtonImage[ PAUSE_BUTTON ] , (INT16)(gpAR->sCenterStartX+11), (INT16)(iScreenHeightOffset + 274+gpAR->bVerticalOffset), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, PauseButtonCallback ); - - gpAR->iButton[ RETREAT_BUTTON ] = + + gpAR->iButton[ RETREAT_BUTTON ] = QuickCreateButton( gpAR->iButtonImage[ RETREAT_BUTTON ], (INT16)(gpAR->sCenterStartX+51), (INT16)(iScreenHeightOffset + 274+gpAR->bVerticalOffset), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, RetreatButtonCallback ); if( !gpAR->ubMercs ) @@ -2296,23 +2290,23 @@ void CreateAutoResolveInterface() } SpecifyGeneralButtonTextAttributes( gpAR->iButton[ RETREAT_BUTTON ], gpStrategicString[STR_AR_RETREAT_BUTTON], BLOCKFONT2, 169, FONT_NEARBLACK ); - gpAR->iButton[ BANDAGE_BUTTON ] = + gpAR->iButton[ BANDAGE_BUTTON ] = QuickCreateButton( gpAR->iButtonImage[ BANDAGE_BUTTON ] , (INT16)(gpAR->sCenterStartX+11), (INT16)(iScreenHeightOffset + 245+gpAR->bVerticalOffset), BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BandageButtonCallback ); - gpAR->iButton[ DONEWIN_BUTTON ] = + gpAR->iButton[ DONEWIN_BUTTON ] = QuickCreateButton( gpAR->iButtonImage[ DONEWIN_BUTTON ], (INT16)(gpAR->sCenterStartX+51), (INT16)(iScreenHeightOffset + 245+gpAR->bVerticalOffset), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, DoneButtonCallback ); SpecifyGeneralButtonTextAttributes( gpAR->iButton[ DONEWIN_BUTTON ], gpStrategicString[STR_AR_DONE_BUTTON], BLOCKFONT2, 169, FONT_NEARBLACK ); - gpAR->iButton[ DONELOSE_BUTTON ] = + gpAR->iButton[ DONELOSE_BUTTON ] = QuickCreateButton( gpAR->iButtonImage[ DONELOSE_BUTTON ], (INT16)(gpAR->sCenterStartX+25), (INT16)(iScreenHeightOffset + 245+gpAR->bVerticalOffset), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, DoneButtonCallback ); SpecifyGeneralButtonTextAttributes( gpAR->iButton[ DONELOSE_BUTTON ], gpStrategicString[STR_AR_DONE_BUTTON], BLOCKFONT2, 169, FONT_NEARBLACK ); - gpAR->iButton[ YES_BUTTON ] = + gpAR->iButton[ YES_BUTTON ] = QuickCreateButton( gpAR->iButtonImage[ YES_BUTTON ], (INT16)(gpAR->sCenterStartX+21), (INT16)(iScreenHeightOffset + 257+gpAR->bVerticalOffset), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, AcceptSurrenderCallback ); - gpAR->iButton[ NO_BUTTON ] = + gpAR->iButton[ NO_BUTTON ] = QuickCreateButton( gpAR->iButtonImage[ NO_BUTTON ], (INT16)(gpAR->sCenterStartX+81), (INT16)(iScreenHeightOffset + 257+gpAR->bVerticalOffset), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, RejectSurrenderCallback ); HideButton( gpAR->iButton[ YES_BUTTON ] ); @@ -2332,7 +2326,7 @@ void RemoveAutoResolveInterface( BOOLEAN fDeleteForGood ) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve2"); //VtResumeSampling(); - + MSYS_RemoveRegion( &gpAR->AutoResolveRegion ); DeleteVideoObjectFromIndex( gpAR->iPanelImages ); DeleteVideoObjectFromIndex( gpAR->iFaces ); @@ -2343,11 +2337,11 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve2"); { //Delete the soldier instances -- done when we are completely finished. //KM: By request of AM, I have added this bleeding event in cases where autoresolve is - // complete and there are bleeding mercs remaining. AM coded the internals - // of the strategic event. + // complete and there are bleeding mercs remaining. AM coded the internals + // of the strategic event. for( i = 0; i < gpAR->ubMercs; i++ ) { - if( gpMercs[ i ].pSoldier->bBleeding && gpMercs[ i ].pSoldier->bLife ) + if( gpMercs[ i ].pSoldier->bBleeding && gpMercs[ i ].pSoldier->stats.bLife ) { // ARM: only one event is needed regardless of how many are bleeding AddStrategicEvent( EVENT_BANDAGE_BLEEDING_MERCS, GetWorldTotalMin() + 1, 0 ); @@ -2358,10 +2352,10 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve2"); // ARM: Update assignment flashing: Doctors may now have new patients or lost them all, etc. gfReEvaluateEveryonesNothingToDo = TRUE; - + if( gpAR->pRobotCell) { - UpdateRobotControllerGivenRobot( gpAR->pRobotCell->pSoldier ); + gpAR->pRobotCell->pSoldier->UpdateRobotControllerGivenRobot( ); } for( i = 0; i < gpAR->iNumMercFaces; i++ ) { @@ -2369,10 +2363,10 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve2"); TacticalRemoveSoldierPointer( gpMercs[ i ].pSoldier, FALSE ); else { //Record finishing information for our mercs - if( !gpMercs[ i ].pSoldier->bLife ) + if( !gpMercs[ i ].pSoldier->stats.bLife ) { StrategicHandlePlayerTeamMercDeath( gpMercs[ i ].pSoldier ); - + // now remove character from a squad RemoveCharacterFromSquads( gpMercs[ i ].pSoldier ); ChangeSoldiersAssignment( gpMercs[ i ].pSoldier, ASSIGNMENT_DEAD ); @@ -2392,7 +2386,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve2"); } for( i = 0; i < gpAR->iNumMercFaces; i++ ) { - if( gpAR->ubBattleStatus == BATTLE_VICTORY && gpMercs[ i ].pSoldier->bLife >= OKLIFE ) + if( gpAR->ubBattleStatus == BATTLE_VICTORY && gpMercs[ i ].pSoldier->stats.bLife >= OKLIFE ) { if( gpMercs[ i ].pSoldier->ubGroupID != ubCurrentGroupID ) { @@ -2448,7 +2442,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve2"); #endif break; } - if( fDeleteForGood && gpCivs[ i ].pSoldier->bLife < OKLIFE/2 ) + if( fDeleteForGood && gpCivs[ i ].pSoldier->stats.bLife < OKLIFE/2 ) { AddDeadSoldierToUnLoadedSector( gpAR->ubSectorX, gpAR->ubSectorY, 0, gpCivs[ i ].pSoldier, RandomGridNo(), ADD_DEAD_SOLDIER_TO_SWEETSPOT ); StrategicRemoveMilitiaFromSector( gpCivs[ i ].pSoldier->sSectorX, gpCivs[ i ].pSoldier->sSectorY, ubCurrentRank, 1 ); @@ -2492,7 +2486,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve2"); { if( gpEnemies[ i ].pSoldier ) { - if( fDeleteForGood && gpEnemies[ i ].pSoldier->bLife < OKLIFE ) + if( fDeleteForGood && gpEnemies[ i ].pSoldier->stats.bLife < OKLIFE ) { TrackEnemiesKilled( ENEMY_KILLED_IN_AUTO_RESOLVE, gpEnemies[ i ].pSoldier->ubSoldierClass ); if( ProcessLoyalty() )HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_ENEMY_KILLED, gpAR->ubSectorX, gpAR->ubSectorY, 0 ); @@ -2507,8 +2501,8 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve2"); if( fDeleteForGood ) { //Warp the game time accordingly if( gpAR->ubBattleStatus == BATTLE_VICTORY ) - { //Get rid of any extra enemies that could be here. It is possible for the number of total enemies to exceed 32, but - //autoresolve can only process 32. We basically cheat by eliminating the rest of them. + { //Get rid of any extra enemies that could be here. It is possible for the number of total enemies to exceed 32, but + //autoresolve can only process 32. We basically cheat by eliminating the rest of them. EliminateAllEnemies( gpAR->ubSectorX, gpAR->ubSectorY ); } else @@ -2531,7 +2525,6 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve2"); UnloadButtonImage( gpAR->iButtonImage[ i ] ); RemoveButton( gpAR->iButton[ i ] ); } - if( fDeleteForGood ) { //Warp the game time accordingly @@ -2544,10 +2537,10 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve2"); MemFree( gpMercs ); gpMercs = NULL; - + MemFree( gpCivs ); gpCivs = NULL; - + MemFree( gpEnemies ); gpEnemies = NULL; @@ -2555,7 +2548,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve2"); //KM : Aug 09, 1999 Patch fix -- Would break future dialog while time compressing gTacticalStatus.ubCurrentTeam = gbPlayerNum; - + gpBattleGroup = NULL; if( gubEnemyEncounterCode == CREATURE_ATTACK_CODE ) @@ -2564,11 +2557,6 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve2"); gubSectorIDOfCreatureAttack = 0; } //VtPauseSampling(); - - if (gfStrategicMilitiaChangesMade) - { - ResetMilitia(); - } } void PauseButtonCallback( GUI_BUTTON *btn, INT32 reason ) @@ -2639,9 +2627,9 @@ void RetreatButtonCallback( GUI_BUTTON *btn, INT32 reason ) if( gpAR->pRobotCell ) { //if robot is retreating, set the retreat time to be the same as the robot's controller. UINT8 ubRobotControllerID; - + ubRobotControllerID = gpAR->pRobotCell->pSoldier->ubRobotRemoteHolderID; - + if( ubRobotControllerID == NOBODY ) { gpAR->pRobotCell->uiFlags &= ~CELL_RETREATING; @@ -2663,14 +2651,14 @@ void RetreatButtonCallback( GUI_BUTTON *btn, INT32 reason ) void DetermineBandageButtonState() { - INT32 i; + INT32 i; OBJECTTYPE *pKit = NULL; BOOLEAN fFound = FALSE; //Does anyone need bandaging? for( i = 0; i < gpAR->ubMercs; i++ ) { - if( gpMercs[ i ].pSoldier->bBleeding && gpMercs[ i ].pSoldier->bLife ) + if( gpMercs[ i ].pSoldier->bBleeding && gpMercs[ i ].pSoldier->stats.bLife ) { fFound = TRUE; break; @@ -2683,13 +2671,13 @@ void DetermineBandageButtonState() return; } - //Do we have any doctors? + //Do we have any doctors? fFound = FALSE; for( i = 0; i < gpAR->ubMercs; i++ ) { - if( gpMercs[ i ].pSoldier->bLife >= OKLIFE && - !gpMercs[ i ].pSoldier->bCollapsed && - gpMercs[ i ].pSoldier->bMedical > 0 ) + if( gpMercs[ i ].pSoldier->stats.bLife >= OKLIFE && + !gpMercs[ i ].pSoldier->bCollapsed && + gpMercs[ i ].pSoldier->stats.bMedical > 0 ) { fFound = TRUE; } @@ -2728,7 +2716,7 @@ void DoneButtonCallback( GUI_BUTTON *btn, INT32 reason ) { if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { - gpAR->fExitAutoResolve = TRUE; + gpAR->fExitAutoResolve = TRUE; } } @@ -2800,7 +2788,7 @@ void MercCellMouseClickCallback( MOUSE_REGION *reg, INT32 reason ) { //robot retreats only when controller retreats return; } - + pCell->uiFlags |= CELL_RETREATING | CELL_DIRTY; //Gets to retreat after a total of 2 attacks. pCell->usNextAttack = (UINT16)((1000 + pCell->usNextAttack * 5 + PreRandom( 2000 - pCell->usAttack ))*2); @@ -2810,9 +2798,9 @@ void MercCellMouseClickCallback( MOUSE_REGION *reg, INT32 reason ) if( gpAR->pRobotCell ) { //if controller is retreating, make the robot retreat too. UINT8 ubRobotControllerID; - + ubRobotControllerID = gpAR->pRobotCell->pSoldier->ubRobotRemoteHolderID; - + if( ubRobotControllerID == NOBODY ) { gpAR->pRobotCell->uiFlags &= ~CELL_RETREATING; @@ -2832,7 +2820,7 @@ void MercCellMouseClickCallback( MOUSE_REGION *reg, INT32 reason ) } //Determine how many players, militia, and enemies that are going at it, and use these values -//to figure out how many rows and columns we can use. The will effect the size of the panel. +//to figure out how many rows and columns we can use. The will effect the size of the panel. void CalculateAutoResolveInfo() { VOBJECT_DESC VObjectDesc; @@ -2843,8 +2831,8 @@ void CalculateAutoResolveInfo() if( gubEnemyEncounterCode != CREATURE_ATTACK_CODE ) { -// GetNumberOfEnemiesInSector( gpAR->ubSectorX, gpAR->ubSectorY, - GetNumberOfEnemiesInFiveSectors( gpAR->ubSectorX, gpAR->ubSectorY, +// GetNumberOfEnemiesInSector( gpAR->ubSectorX, gpAR->ubSectorY, + GetNumberOfEnemiesInFiveSectors( gpAR->ubSectorX, gpAR->ubSectorY, &gpAR->ubAdmins, &gpAR->ubTroops, &gpAR->ubElites ); gpAR->ubEnemies = (UINT8)min( gpAR->ubAdmins + gpAR->ubTroops + gpAR->ubElites, MAX_AR_TEAM_SIZE ); } @@ -2852,13 +2840,13 @@ void CalculateAutoResolveInfo() { if( gfTransferTacticalOppositionToAutoResolve ) { - DetermineCreatureTownCompositionBasedOnTacticalInformation( &gubNumCreaturesAttackingTown, + DetermineCreatureTownCompositionBasedOnTacticalInformation( &gubNumCreaturesAttackingTown, &gpAR->ubYMCreatures, &gpAR->ubYFCreatures, &gpAR->ubAMCreatures, &gpAR->ubAFCreatures ); } else { - DetermineCreatureTownComposition( gubNumCreaturesAttackingTown, + DetermineCreatureTownComposition( gubNumCreaturesAttackingTown, &gpAR->ubYMCreatures, &gpAR->ubYFCreatures, &gpAR->ubAMCreatures, &gpAR->ubAFCreatures ); } @@ -2892,7 +2880,7 @@ void CalculateAutoResolveInfo() { gpMercs[ gpAR->ubMercs ].pSoldier = pPlayer->pSoldier; - //!!! CLEAR OPPCOUNT HERE. All of these soldiers are guaranteed to not be in tactical anymore. + //!!! CLEAR OPPCOUNT HERE. All of these soldiers are guaranteed to not be in tactical anymore. //ClearOppCount( pPlayer->pSoldier ); gpAR->ubMercs++; @@ -2903,7 +2891,7 @@ void CalculateAutoResolveInfo() if( AM_A_ROBOT( pPlayer->pSoldier ) ) { gpAR->pRobotCell = &gpMercs[ gpAR->ubMercs - 1 ]; - UpdateRobotControllerGivenRobot( gpAR->pRobotCell->pSoldier ); + gpAR->pRobotCell->pSoldier->UpdateRobotControllerGivenRobot( ); } } pPlayer = pPlayer->next; @@ -2912,10 +2900,10 @@ void CalculateAutoResolveInfo() pGroup = pGroup->next; } gpAR->iNumMercFaces = gpAR->ubMercs; - gpAR->iActualMercFaces = gpAR->ubMercs; - + gpAR->iActualMercFaces = gpAR->ubMercs; + giMaxMilitiaToRender = 50 - ( (gpAR->ubMercs + 4) / 5 ) * 5; - + CalculateRowsAndColumns(); } @@ -2935,7 +2923,7 @@ void ResetAutoResolveInterface() while( gpAR->ubElites + gpAR->ubAdmins + gpAR->ubTroops > gpAR->ubEnemies ) { switch( PreRandom( 5 ) ) - { + { case 0: if( gpAR->ubElites ) { gpAR->ubElites--; break; } case 1: case 2: if( gpAR->ubAdmins ) { gpAR->ubAdmins--; break; } case 3: case 4: if( gpAR->ubTroops ) { gpAR->ubTroops--; break; } @@ -2945,13 +2933,13 @@ void ResetAutoResolveInterface() { switch( PreRandom( 5 ) ) { - case 0: gpAR->ubElites++; break; + case 0: gpAR->ubElites++; break; case 1: case 2: gpAR->ubAdmins++; break; case 3: case 4: gpAR->ubTroops++; break; } } - - + + //Do the same for the player mercs. while( gpAR->iNumMercFaces > gpAR->ubMercs && gpAR->iNumMercFaces > gpAR->iActualMercFaces ) { //Removing temp mercs @@ -2969,7 +2957,7 @@ void ResetAutoResolveInterface() gpAR->fSound = TRUE; } gpAR->uiTimeSlice = 1000; - gpAR->uiTotalElapsedBattleTimeInMilliseconds = 0; + gpAR->uiTotalElapsedBattleTimeInMilliseconds = 0; gpAR->uiCurrTime = 0; gpAR->fPlayerRejectedSurrenderOffer = FALSE; gpAR->fPendingSurrender = FALSE; @@ -2983,8 +2971,8 @@ void ResetAutoResolveInterface() void CalculateRowsAndColumns() { - //now that we have the number on each team, calculate the number of rows and columns to be used on - //the player's sides. NOTE: Militia won't appear on the same row as mercs. + //now that we have the number on each team, calculate the number of rows and columns to be used on + //the player's sides. NOTE: Militia won't appear on the same row as mercs. if( !gpAR->ubMercs ) { //0 gpAR->ubMercCols = gpAR->ubMercRows = 0; @@ -3062,11 +3050,11 @@ void CalculateRowsAndColumns() //Now, that we have the number of mercs, militia, and enemies, it is possible that there - //may be some conflicts. Our goal is to make the window as small as possible. Bumping up - //the number of columns to 5 or rows to 10 will force one or both axes to go full screen. If we + //may be some conflicts. Our goal is to make the window as small as possible. Bumping up + //the number of columns to 5 or rows to 10 will force one or both axes to go full screen. If we //have high numbers of both, then we will have to. - //Step one: equalize the number of columns for both the mercs and civs. + //Step one: equalize the number of columns for both the mercs and civs. if( gpAR->ubMercs && gpAR->ubCivs && gpAR->ubMercCols != gpAR->ubCivCols ) { if( gpAR->ubMercCols < gpAR->ubCivCols ) @@ -3095,7 +3083,7 @@ void CalculateRowsAndColumns() if( gpAR->ubMercRows + gpAR->ubCivRows > 9 ) - { + { if( gpAR->ubMercCols < 5 ) { //bump it up gpAR->ubMercCols++; @@ -3115,7 +3103,7 @@ void CalculateRowsAndColumns() //gpAR->sCenterStartX = 323 - gpAR->sWidth/2 + max( max( gpAR->ubMercCols, 2), max( gpAR->ubCivCols, 2 ) ) *55; gpAR->sCenterStartX = iScreenWidthOffset + (323 - gpAR->sWidth/2 + max( max( gpAR->ubMercCols, 2), max( gpAR->ubCivCols, 2 ) ) *55); - + //Anywhere from 48*3 to 48*10 //gpAR->sHeight = 48 * max( 3, max( gpAR->ubMercRows + gpAR->ubCivRows, gpAR->ubEnemyRows ) ); @@ -3125,8 +3113,8 @@ void CalculateRowsAndColumns() gpAR->sHeight /= 40; gpAR->sHeight *= 40; - //Here is a extremely bitchy case. The formulae throughout this module work for most cases. - //However, when combining mercs and civs, the column must be the same. However, we retract that + //Here is a extremely bitchy case. The formulae throughout this module work for most cases. + //However, when combining mercs and civs, the column must be the same. However, we retract that //in cases where there are less mercs than available to fill up *most* of the designated space. if( gpAR->ubMercs && gpAR->ubCivs ) { @@ -3141,7 +3129,7 @@ void HandleAutoResolveInput() { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve3"); - + InputAtom InputEvent; BOOLEAN fResetAutoResolve = FALSE; while( DequeueEvent( &InputEvent ) ) @@ -3388,24 +3376,24 @@ void RenderSoldierCellHealth( SOLDIERCELL *pCell ) INT32 xp, yp; STR16 pStr; CHAR16 str[20]; - UINT8 *pDestBuf, *pSrcBuf; + UINT8 *pDestBuf, *pSrcBuf; UINT32 uiSrcPitchBYTES, uiDestPitchBYTES; UINT16 usColor; - + SetFont( SMALLCOMPFONT ); //Restore the background before drawing text. pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); pSrcBuf = LockVideoSurface( gpAR->iInterfaceBuffer, &uiSrcPitchBYTES ); xp = pCell->xp + 2; yp = pCell->yp + 32; - Blt16BPPTo16BPP( (UINT16*)pDestBuf, uiDestPitchBYTES, + Blt16BPPTo16BPP( (UINT16*)pDestBuf, uiDestPitchBYTES, (UINT16*)pSrcBuf, uiSrcPitchBYTES, xp, yp, xp-gpAR->Rect.iLeft, yp-gpAR->Rect.iTop, 46, 10 ); UnLockVideoSurface( gpAR->iInterfaceBuffer ); UnLockVideoSurface( FRAME_BUFFER ); - if( pCell->pSoldier->bLife ) + if( pCell->pSoldier->stats.bLife ) { - if( pCell->pSoldier->bLife == pCell->pSoldier->bLifeMax ) + if( pCell->pSoldier->stats.bLife == pCell->pSoldier->stats.bLifeMax ) { cntStart = 4; } @@ -3415,7 +3403,7 @@ void RenderSoldierCellHealth( SOLDIERCELL *pCell ) } for( cnt = cntStart; cnt < 6; cnt ++ ) { - if( pCell->pSoldier->bLife < bHealthStrRanges[ cnt ] ) + if( pCell->pSoldier->stats.bLife < bHealthStrRanges[ cnt ] ) { break; } @@ -3434,11 +3422,11 @@ void RenderSoldierCellHealth( SOLDIERCELL *pCell ) usColor = FONT_GRAY1; break; } - if( cnt > 3 && pCell->pSoldier->bLife != pCell->pSoldier->bLifeMax ) + if( cnt > 3 && pCell->pSoldier->stats.bLife != pCell->pSoldier->stats.bLifeMax ) { //Merc has taken damage, even though his life if good. usColor = FONT_YELLOW; } - if( pCell->pSoldier->bLife == pCell->pSoldier->bLifeMax ) + if( pCell->pSoldier->stats.bLife == pCell->pSoldier->stats.bLifeMax ) usColor = FONT_GRAY1; pStr = zHealthStr[ cnt ]; } @@ -3458,8 +3446,8 @@ void RenderSoldierCellHealth( SOLDIERCELL *pCell ) } else if( pCell->uiFlags & CELL_RETREATING && gpAR->ubBattleStatus == BATTLE_IN_PROGRESS ) { - if( pCell->pSoldier->bLife >= OKLIFE ) - { //Retreating is shared with the status string. Alternate between the + if( pCell->pSoldier->stats.bLife >= OKLIFE ) + { //Retreating is shared with the status string. Alternate between the //two every 450 milliseconds if( GetJA2Clock() % 900 < 450 ) { //override the health string with the retreating string. @@ -3471,7 +3459,7 @@ void RenderSoldierCellHealth( SOLDIERCELL *pCell ) } else if( pCell->uiFlags & CELL_SHOWRETREATTEXT && gpAR->ubBattleStatus == BATTLE_IN_PROGRESS ) { - if( pCell->pSoldier->bLife >= OKLIFE ) + if( pCell->pSoldier->stats.bLife >= OKLIFE ) { SetFontForeground( FONT_YELLOW ); swprintf( str, gpStrategicString[ STR_AR_MERC_RETREAT ] ); @@ -3510,12 +3498,10 @@ UINT8 GetUnusedMercProfileID() void CreateTempPlayerMerc() { SOLDIERCREATE_STRUCT MercCreateStruct; - static INT32 iSoldierCount=0; + static INT32 iSoldierCount=0; UINT8 ubID; //Init the merc create structure with basic information - // WDS - Clean up inventory handling - //memset( &MercCreateStruct, 0, sizeof( MercCreateStruct ) ); MercCreateStruct.bTeam = SOLDIER_CREATE_AUTO_TEAM; MercCreateStruct.ubProfile = GetUnusedMercProfileID(); MercCreateStruct.sSectorX = gpAR->ubSectorX; @@ -3537,24 +3523,24 @@ void DetermineTeamLeader( BOOLEAN fFriendlyTeam ) { INT32 i; SOLDIERCELL *pBestLeaderCell = NULL; - //For each team (civs and players count as same team), find the merc with the best + //For each team (civs and players count as same team), find the merc with the best //leadership ability. if( fFriendlyTeam ) { gpAR->ubPlayerLeadership = 0; for( i = 0; i < gpAR->ubMercs; i++ ) { - if( gpMercs[ i ].pSoldier->bLeadership > gpAR->ubPlayerLeadership ) + if( gpMercs[ i ].pSoldier->stats.bLeadership > gpAR->ubPlayerLeadership ) { - gpAR->ubPlayerLeadership = gpMercs[ i ].pSoldier->bLeadership; + gpAR->ubPlayerLeadership = gpMercs[ i ].pSoldier->stats.bLeadership; pBestLeaderCell = &gpMercs[ i ]; } } for( i = 0; i < gpAR->ubCivs; i++ ) { - if( gpCivs[ i ].pSoldier->bLeadership > gpAR->ubPlayerLeadership ) + if( gpCivs[ i ].pSoldier->stats.bLeadership > gpAR->ubPlayerLeadership ) { - gpAR->ubPlayerLeadership = gpCivs[ i ].pSoldier->bLeadership; + gpAR->ubPlayerLeadership = gpCivs[ i ].pSoldier->stats.bLeadership; pBestLeaderCell = &gpCivs[ i ]; } } @@ -3570,9 +3556,9 @@ void DetermineTeamLeader( BOOLEAN fFriendlyTeam ) gpAR->ubEnemyLeadership = 0; for( i = 0; i < gpAR->ubEnemies; i++ ) { - if( gpEnemies[ i ].pSoldier->bLeadership > gpAR->ubEnemyLeadership ) + if( gpEnemies[ i ].pSoldier->stats.bLeadership > gpAR->ubEnemyLeadership ) { - gpAR->ubEnemyLeadership = gpEnemies[ i ].pSoldier->bLeadership; + gpAR->ubEnemyLeadership = gpEnemies[ i ].pSoldier->stats.bLeadership; pBestLeaderCell = &gpEnemies[ i ]; } } @@ -3620,7 +3606,6 @@ void CalculateAttackValues() UINT16 usBestAttack = 0xffff; UINT16 usBreathStrengthPercentage; //INT16 sOutnumberBonus = 0; - INT16 sMaxBonus = 0; //PLAYER TEAM gpAR->usPlayerAttack = 0; gpAR->usPlayerDefence = 0; @@ -3635,15 +3620,15 @@ void CalculateAttackValues() for( i = 0; i < gpAR->ubMercs; i++ ) { - pCell = &gpMercs[ i ]; + pCell = &gpMercs[ i ]; pSoldier = pCell->pSoldier; - if( !pSoldier->bLife ) + if( !pSoldier->stats.bLife ) continue; - pCell->usAttack = pSoldier->bStrength + - pSoldier->bDexterity + - pSoldier->bWisdom + - pSoldier->bMarksmanship + - pSoldier->bMorale; + pCell->usAttack = pSoldier->stats.bStrength + + pSoldier->stats.bDexterity + + pSoldier->stats.bWisdom + + pSoldier->stats.bMarksmanship + + pSoldier->aiData.bMorale; //Give player controlled mercs a significant bonus to compensate for lack of control //as the player would typically do much better in tactical. if( pCell->usAttack < 1000 ) @@ -3653,17 +3638,17 @@ void CalculateAttackValues() } usBreathStrengthPercentage = 100 - ( 100 - pCell->pSoldier->bBreathMax ) / 3; pCell->usAttack = pCell->usAttack * usBreathStrengthPercentage / 100; - pCell->usDefence = pSoldier->bAgility + - pSoldier->bWisdom + + pCell->usDefence = pSoldier->stats.bAgility + + pSoldier->stats.bWisdom + pSoldier->bBreathMax + - pSoldier->bMedical + - pSoldier->bMorale; - //100 team leadership adds a bonus of 10%, + pSoldier->stats.bMedical + + pSoldier->aiData.bMorale; + //100 team leadership adds a bonus of 10%, usBonus = 100 + gpAR->ubPlayerLeadership/10;// + sOutnumberBonus; //bExpLevel adds a bonus of 7% per level after 2, level 1 soldiers get a 7% decrease - //usBonus += 7 * (pSoldier->bExpLevel-2); - usBonus += EXP_BONUS * (pSoldier->bExpLevel-5); + //usBonus += 7 * (pSoldier->stats.bExpLevel-2); + usBonus += EXP_BONUS * (pSoldier->stats.bExpLevel-5); usBonus += gpAR->ubPlayerDefenceAdvantage; pCell->usAttack = pCell->usAttack * usBonus / 100; pCell->usDefence = pCell->usDefence * usBonus / 100; @@ -3676,7 +3661,7 @@ void CalculateAttackValues() pCell->usAttack = min( pCell->usAttack, 1000 ); pCell->usDefence = min( pCell->usDefence, 1000 ); - + gpAR->usPlayerAttack += pCell->usAttack; gpAR->usPlayerDefence += pCell->usDefence; ResetNextAttackCounter( pCell ); @@ -3690,24 +3675,24 @@ void CalculateAttackValues() //CIVS for( i = 0; i < gpAR->ubCivs; i++ ) { - pCell = &gpCivs[ i ]; + pCell = &gpCivs[ i ]; pSoldier = pCell->pSoldier; - pCell->usAttack = pSoldier->bStrength + - pSoldier->bDexterity + - pSoldier->bWisdom + - pSoldier->bMarksmanship + - pSoldier->bMorale; + pCell->usAttack = pSoldier->stats.bStrength + + pSoldier->stats.bDexterity + + pSoldier->stats.bWisdom + + pSoldier->stats.bMarksmanship + + pSoldier->aiData.bMorale; pCell->usAttack = pCell->usAttack * pSoldier->bBreath / 100; - pCell->usDefence = pSoldier->bAgility + - pSoldier->bWisdom + + pCell->usDefence = pSoldier->stats.bAgility + + pSoldier->stats.bWisdom + pSoldier->bBreathMax + - pSoldier->bMedical + - pSoldier->bMorale; + pSoldier->stats.bMedical + + pSoldier->aiData.bMorale; //100 team leadership adds a bonus of 10% usBonus = 100 + gpAR->ubPlayerLeadership/10;// + sOutnumberBonus; //bExpLevel adds a bonus of 7% per level after 2, level 1 soldiers get a 7% decrease - //usBonus += 7 * (pSoldier->bExpLevel-2); - usBonus += EXP_BONUS * (pSoldier->bExpLevel-5); + //usBonus += 7 * (pSoldier->stats.bExpLevel-2); + usBonus += EXP_BONUS * (pSoldier->stats.bExpLevel-5); usBonus += gpAR->ubPlayerDefenceAdvantage; pCell->usAttack = pCell->usAttack * usBonus / 100; pCell->usDefence = pCell->usDefence * usBonus / 100; @@ -3717,7 +3702,7 @@ void CalculateAttackValues() pCell->usAttack = min( pCell->usAttack, 1000 ); pCell->usDefence = min( pCell->usDefence, 1000 ); - + gpAR->usPlayerAttack += pCell->usAttack; gpAR->usPlayerDefence += pCell->usDefence; ResetNextAttackCounter( pCell ); @@ -3727,9 +3712,9 @@ void CalculateAttackValues() } - if( i >= CountAllMilitiaInSector( gpAR->ubSectorX, gpAR->ubSectorY ) ) + if( i >= CountAllMilitiaInSector( gpAR->ubSectorX, gpAR->ubSectorY ) ) { //Extra delay if soldier's from reinforcement - pCell->usNextAttack += REINFORCMENT_ATTACK_DELAY_PER_SOLDIER_IN_SECTOR * CountAllMilitiaInSector( gpAR->ubSectorX, gpAR->ubSectorY ); + pCell->usNextAttack += REINFORCMENT_ATTACK_DELAY_PER_SOLDIER_IN_SECTOR * CountAllMilitiaInSector( gpAR->ubSectorX, gpAR->ubSectorY ); } @@ -3749,33 +3734,33 @@ void CalculateAttackValues() for( i = 0; i < gpAR->ubEnemies; i++ ) { - pCell = &gpEnemies[ i ]; + pCell = &gpEnemies[ i ]; pSoldier = pCell->pSoldier; - pCell->usAttack = pSoldier->bStrength + - pSoldier->bDexterity + - pSoldier->bWisdom + - pSoldier->bMarksmanship + - pSoldier->bMorale; + pCell->usAttack = pSoldier->stats.bStrength + + pSoldier->stats.bDexterity + + pSoldier->stats.bWisdom + + pSoldier->stats.bMarksmanship + + pSoldier->aiData.bMorale; pCell->usAttack = pCell->usAttack * pSoldier->bBreath / 100; - pCell->usDefence = pSoldier->bAgility + - pSoldier->bWisdom + + pCell->usDefence = pSoldier->stats.bAgility + + pSoldier->stats.bWisdom + pSoldier->bBreathMax + - pSoldier->bMedical + - pSoldier->bMorale; + pSoldier->stats.bMedical + + pSoldier->aiData.bMorale; //100 team leadership adds a bonus of 10% usBonus = 100 + gpAR->ubPlayerLeadership/10;// + sOutnumberBonus; //bExpLevel adds a bonus of 7% per level after 2, level 1 soldiers get a 7% decrease - //usBonus += 7 * (pSoldier->bExpLevel-2); - usBonus += EXP_BONUS * (pSoldier->bExpLevel-5); + //usBonus += 7 * (pSoldier->stats.bExpLevel-2); + usBonus += EXP_BONUS * (pSoldier->stats.bExpLevel-5); usBonus += gpAR->ubEnemyDefenceAdvantage; - pCell->usAttack = pCell->usAttack * usBonus / 100; + pCell->usAttack = pCell->usAttack * usBonus / 100; pCell->usDefence = pCell->usDefence * usBonus / 100; - pCell->usAttack = (UINT16)( pCell->usAttack * CalcClassBonusOrPenalty( pCell->pSoldier ) ); + pCell->usAttack = (UINT16)( pCell->usAttack * CalcClassBonusOrPenalty( pCell->pSoldier ) ); pCell->usDefence = (UINT16)( pCell->usDefence * CalcClassBonusOrPenalty( pCell->pSoldier ) ); pCell->usAttack = min( pCell->usAttack, 1000 ); pCell->usDefence = min( pCell->usDefence, 1000 ); - + gpAR->usEnemyAttack += pCell->usAttack; gpAR->usEnemyDefence += pCell->usDefence; ResetNextAttackCounter( pCell ); @@ -3785,24 +3770,24 @@ void CalculateAttackValues() pCell->usNextAttack += (UINT32)( ( i - 4 ) * 1000 ); } - if(i >= NumEnemiesInSector( gpAR->ubSectorX, gpAR->ubSectorY ) && !(pCell->uiFlags & CELL_CREATURE) ) + if(i >= NumEnemiesInSector( gpAR->ubSectorX, gpAR->ubSectorY ) && !(pCell->uiFlags & CELL_CREATURE) ) { //Extra delay if it's a reinforcement - pCell->usNextAttack += REINFORCMENT_ATTACK_DELAY_PER_SOLDIER_IN_SECTOR * NumEnemiesInSector( gpAR->ubSectorX, gpAR->ubSectorY ); + pCell->usNextAttack += REINFORCMENT_ATTACK_DELAY_PER_SOLDIER_IN_SECTOR * NumEnemiesInSector( gpAR->ubSectorX, gpAR->ubSectorY ); } - + if( pCell->usNextAttack < usBestAttack ) usBestAttack = pCell->usNextAttack; } - //Now, because we are starting a new battle, we want to get the ball rolling a bit earlier. So, + //Now, because we are starting a new battle, we want to get the ball rolling a bit earlier. So, //we will take the usBestAttack value and subtract 60% of it from everybody's next attack. usBestAttack = usBestAttack * 60 / 100; for( i = 0; i < gpAR->ubMercs; i++ ) - gpMercs[ i ].usNextAttack -= usBestAttack; + gpMercs[ i ].usNextAttack -= usBestAttack; for( i = 0; i < gpAR->ubCivs; i++ ) - gpCivs[ i ].usNextAttack -= usBestAttack; + gpCivs[ i ].usNextAttack -= usBestAttack; for( i = 0; i < gpAR->ubEnemies; i++ ) - gpEnemies[ i ].usNextAttack -= usBestAttack; + gpEnemies[ i ].usNextAttack -= usBestAttack; } void DrawDebugText( SOLDIERCELL *pCell ) @@ -3868,7 +3853,7 @@ SOLDIERCELL* ChooseTarget( SOLDIERCELL *pAttacker ) while( iAvailableTargets ) { pTarget = ( index < gpAR->ubMercs ) ? &gpMercs[ index ] : &gpCivs[ index - gpAR->ubMercs ]; - if( !pTarget->pSoldier->bLife || pTarget->uiFlags & CELL_RETREATED ) + if( !pTarget->pSoldier->stats.bLife || pTarget->uiFlags & CELL_RETREATED ) { index++; iAvailableTargets--; @@ -3886,7 +3871,7 @@ SOLDIERCELL* ChooseTarget( SOLDIERCELL *pAttacker ) } if( !IsBattleOver() ) { - AssertMsg( 0, String("***Please send PRIOR save and screenshot of this message*** iAvailableTargets %d, index %d, iRandom %d, defence %d. ", + AssertMsg( 0, String("***Please send PRIOR save and screenshot of this message*** iAvailableTargets %d, index %d, iRandom %d, defence %d. ", iAvailableTargets, index, iRandom, gpAR->usPlayerDefence) ); } } @@ -3898,7 +3883,7 @@ SOLDIERCELL* ChooseTarget( SOLDIERCELL *pAttacker ) while( iAvailableTargets ) { pTarget = &gpEnemies[ index ]; - if( !pTarget->pSoldier->bLife ) + if( !pTarget->pSoldier->stats.bLife ) { index++; iAvailableTargets--; @@ -3923,7 +3908,6 @@ BOOLEAN FireAShot( SOLDIERCELL *pAttacker ) { OBJECTTYPE *pItem; SOLDIERTYPE *pSoldier; - INT32 i; pSoldier = pAttacker->pSoldier; @@ -3933,7 +3917,7 @@ BOOLEAN FireAShot( SOLDIERCELL *pAttacker ) pAttacker->bWeaponSlot = SECONDHANDPOS; return TRUE; } - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( UINT32 i = 0; i < pSoldier->inv.size(); i++ ) { pItem = &pSoldier->inv[ i ]; @@ -3942,20 +3926,20 @@ BOOLEAN FireAShot( SOLDIERCELL *pAttacker ) pAttacker->bWeaponSlot = (INT8)i; if( gpAR->fUnlimitedAmmo ) { - PlayAutoResolveSample( Weapon[ pItem->usItem ].sSound, RATE_11025, 50, 1, MIDDLEPAN ); + PlayAutoResolveSample( Weapon[ pItem->usItem ].sSound, RATE_11025, 50, 1, MIDDLEPAN ); return TRUE; } - if( !pItem->ItemData.Gun.ubGunShotsLeft ) + if( !(*pItem)[0]->data.gun.ubGunShotsLeft ) { AutoReload( pSoldier ); - if ( pItem->ItemData.Gun.ubGunShotsLeft && Weapon[ pItem->usItem ].sLocknLoadSound ) + if ( (*pItem)[0]->data.gun.ubGunShotsLeft && Weapon[ pItem->usItem ].sLocknLoadSound ) { PlayAutoResolveSample( Weapon[ pItem->usItem ].sLocknLoadSound, RATE_11025, 50, 1, MIDDLEPAN ); } } - if( pItem->ItemData.Gun.ubGunShotsLeft ) + if( (*pItem)[0]->data.gun.ubGunShotsLeft ) { - PlayAutoResolveSample( Weapon[ pItem->usItem ].sSound, RATE_11025, 50, 1, MIDDLEPAN ); + PlayAutoResolveSample( Weapon[ pItem->usItem ].sSound, RATE_11025, 50, 1, MIDDLEPAN ); if( pAttacker->uiFlags & CELL_MERC ) { gMercProfiles[ pAttacker->pSoldier->ubProfile ].usShotsFired++; @@ -3963,7 +3947,7 @@ BOOLEAN FireAShot( SOLDIERCELL *pAttacker ) StatChange( pAttacker->pSoldier, MARKAMT, 3, FALSE ); } - pItem->ItemData.Gun.ubGunShotsLeft--; + (*pItem)[0]->data.gun.ubGunShotsLeft--; return TRUE; } } @@ -3974,8 +3958,7 @@ BOOLEAN FireAShot( SOLDIERCELL *pAttacker ) BOOLEAN AttackerHasKnife( SOLDIERCELL *pAttacker ) { - INT32 i; - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( UINT32 i = 0; i < pAttacker->pSoldier->inv.size(); i++ ) { if( Item[ pAttacker->pSoldier->inv[ i ].usItem ].usItemClass == IC_BLADE ) { @@ -3989,9 +3972,8 @@ BOOLEAN AttackerHasKnife( SOLDIERCELL *pAttacker ) BOOLEAN TargetHasLoadedGun( SOLDIERTYPE *pSoldier ) { - INT32 i; OBJECTTYPE *pItem; - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( UINT32 i = 0; i < pSoldier->inv.size(); i++ ) { pItem = &pSoldier->inv[ i ]; if( Item[ pItem->usItem ].usItemClass == IC_GUN ) @@ -4000,7 +3982,7 @@ BOOLEAN TargetHasLoadedGun( SOLDIERTYPE *pSoldier ) { return TRUE; } - if( pItem->ItemData.Gun.ubGunShotsLeft ) + if( (*pItem)[0]->data.gun.ubGunShotsLeft ) { return TRUE; } @@ -4027,16 +4009,16 @@ void AttackTarget( SOLDIERCELL *pAttacker, SOLDIERCELL *pTarget ) pAttacker->uiFlags |= CELL_FIREDATTARGET | CELL_DIRTY; if( pAttacker->usAttack < 950 ) usAttack = (UINT16)(pAttacker->usAttack + PreRandom(2000 - pAttacker->usAttack )); - else + else usAttack = (UINT16)(950 + PreRandom( 50 )); if( pTarget->uiFlags & CELL_RETREATING && !(pAttacker->uiFlags & CELL_FEMALECREATURE) ) - { //Attacking a retreating merc is harder. Modify the attack value to 70% of it's value. + { //Attacking a retreating merc is harder. Modify the attack value to 70% of it's value. //This allows retreaters to have a better chance of escaping. usAttack = usAttack * 7 / 10; } if( pTarget->usDefence < 950 ) usDefence = (UINT16)(pTarget->usDefence + PreRandom(2000 - pTarget->usDefence )); - else + else usDefence = (UINT16)(950 + PreRandom( 50 )); if( pAttacker->uiFlags & CELL_FEMALECREATURE ) { @@ -4078,12 +4060,12 @@ void AttackTarget( SOLDIERCELL *pAttacker, SOLDIERCELL *pTarget ) { pTarget->usNextHit[ bAttackIndex ] = (UINT16)( 50 + PreRandom( 400 ) ); pTarget->pAttacker[ bAttackIndex ] = pAttacker; - } + } } if( usAttack < usDefence ) { - if( pTarget->pSoldier->bLife >= OKLIFE || !PreRandom( 5 ) ) - { //Attacker misses -- use up a round of ammo. If target is unconcious, then 80% chance of hitting. + if( pTarget->pSoldier->stats.bLife >= OKLIFE || !PreRandom( 5 ) ) + { //Attacker misses -- use up a round of ammo. If target is unconcious, then 80% chance of hitting. pTarget->uiFlags |= CELL_DODGEDATTACK | CELL_DIRTY; if( fMelee ) { @@ -4100,7 +4082,7 @@ void AttackTarget( SOLDIERCELL *pAttacker, SOLDIERCELL *pTarget ) PlayAutoResolveSample( ACR_LUNGE, RATE_11025, 50, 1, MIDDLEPAN ); } } - else + else PlayAutoResolveSample( SWOOSH_1 + PreRandom( 6 ), RATE_11025, 50, 1, MIDDLEPAN ); if( pTarget->uiFlags & CELL_MERC ) // AGILITY GAIN: Target "dodged" an attack @@ -4119,7 +4101,7 @@ void AttackTarget( SOLDIERCELL *pAttacker, SOLDIERCELL *pTarget ) ubLocation = AIM_SHOT_HEAD; else if( iRandom < 30 ) ubLocation = AIM_SHOT_LEGS; - else + else ubLocation = AIM_SHOT_TORSO; ubAccuracy = (UINT8)((usAttack - usDefence + PreRandom( usDefence - pTarget->usDefence ) )/10); iImpact = BulletImpact( pAttacker->pSoldier, pTarget->pSoldier, ubLocation, ubImpact, ubAccuracy, NULL ); @@ -4139,14 +4121,14 @@ void AttackTarget( SOLDIERCELL *pAttacker, SOLDIERCELL *pTarget ) { OBJECTTYPE *pItem; OBJECTTYPE tempItem; - + PlayAutoResolveSample( (UINT8)(BULLET_IMPACT_1+PreRandom(3)), RATE_11025, 50, 1, MIDDLEPAN ); - if( !pTarget->pSoldier->bLife ) + if( !pTarget->pSoldier->stats.bLife ) { //Soldier already dead (can't kill him again!) return; } - ubAccuracy = (UINT8)((usAttack - usDefence + PreRandom( usDefence - pTarget->usDefence ) )/10); + ubAccuracy = (UINT8)((usAttack - usDefence + PreRandom( usDefence - pTarget->usDefence ) )/10); //Determine attacking weapon. pAttacker->pSoldier->usAttackingWeapon = 0; @@ -4156,23 +4138,23 @@ void AttackTarget( SOLDIERCELL *pAttacker, SOLDIERCELL *pTarget ) if( Item[ pItem->usItem ].usItemClass & IC_WEAPON ) pAttacker->pSoldier->usAttackingWeapon = pAttacker->pSoldier->inv[ pAttacker->bWeaponSlot ].usItem; } - + // WANNE: Does this lead to a CTD -> no I did not get any CTD, so I reenabled it if( pAttacker->bWeaponSlot != HANDPOS ) - { - //switch items - memcpy( &tempItem, &pAttacker->pSoldier->inv[ HANDPOS ], sizeof( OBJECTTYPE ) ); - memcpy( &pAttacker->pSoldier->inv[ HANDPOS ], &pAttacker->pSoldier->inv[ pAttacker->bWeaponSlot ], sizeof( OBJECTTYPE ) ); //CTD + { + //switch items + tempItem = pAttacker->pSoldier->inv[ HANDPOS ]; + pAttacker->pSoldier->inv[ HANDPOS ] = pAttacker->pSoldier->inv[ pAttacker->bWeaponSlot ]; //CTD iImpact = HTHImpact( pAttacker->pSoldier, pTarget->pSoldier, ubAccuracy, (BOOLEAN)(fKnife | fClaw) ); - memcpy( &pAttacker->pSoldier->inv[ pAttacker->bWeaponSlot ], &pAttacker->pSoldier->inv[ HANDPOS ], sizeof( OBJECTTYPE ) ); - memcpy( &pAttacker->pSoldier->inv[ HANDPOS ], &tempItem, sizeof( OBJECTTYPE ) ); + pAttacker->pSoldier->inv[ pAttacker->bWeaponSlot ] = pAttacker->pSoldier->inv[ HANDPOS ]; + pAttacker->pSoldier->inv[ HANDPOS ] = tempItem; } else { iImpact = HTHImpact( pAttacker->pSoldier, pTarget->pSoldier, ubAccuracy, (BOOLEAN)(fKnife || fClaw) ); } - - iNewLife = pTarget->pSoldier->bLife - iImpact; + iImpact = 0; + iNewLife = pTarget->pSoldier->stats.bLife - iImpact; if( pAttacker->uiFlags & CELL_MERC ) { //Attacker is a player, so increment the number of shots that hit. @@ -4186,13 +4168,13 @@ void AttackTarget( SOLDIERCELL *pAttacker, SOLDIERCELL *pTarget ) // EXPERIENCE GAIN: Took some damage StatChange( pTarget->pSoldier, EXPERAMT, ( UINT16 )( 5 * ( iImpact / 10 ) ), FALSE ); } - if( pTarget->pSoldier->bLife >= CONSCIOUSNESS || pTarget->uiFlags & CELL_CREATURE ) + if( pTarget->pSoldier->stats.bLife >= CONSCIOUSNESS || pTarget->uiFlags & CELL_CREATURE ) { if( gpAR->fSound ) - DoMercBattleSound( pTarget->pSoldier, (INT8)( BATTLE_SOUND_HIT1 + PreRandom( 2 ) ) ); + pTarget->pSoldier->DoMercBattleSound( (INT8)( BATTLE_SOUND_HIT1 + PreRandom( 2 ) ) ); } - if( !(pTarget->uiFlags & CELL_CREATURE) && iNewLife < OKLIFE && pTarget->pSoldier->bLife >= OKLIFE ) - { //the hit caused the merc to fall. Play the falling sound + if( !(pTarget->uiFlags & CELL_CREATURE) && iNewLife < OKLIFE && pTarget->pSoldier->stats.bLife >= OKLIFE ) + { //the hit caused the merc to fall. Play the falling sound PlayAutoResolveSample( (UINT8)FALL_1, RATE_11025, 50, 1, MIDDLEPAN ); pTarget->uiFlags &= ~CELL_RETREATING; } @@ -4214,19 +4196,19 @@ void AttackTarget( SOLDIERCELL *pAttacker, SOLDIERCELL *pTarget ) } } //Adjust the soldiers stats based on the damage. - pTarget->pSoldier->bLife = (INT8)max( iNewLife, 0 ); + pTarget->pSoldier->stats.bLife = (INT8)max( iNewLife, 0 ); if( pTarget->uiFlags & CELL_MERC && gpAR->pRobotCell) { - UpdateRobotControllerGivenRobot( gpAR->pRobotCell->pSoldier ); + gpAR->pRobotCell->pSoldier->UpdateRobotControllerGivenRobot( ); } if( fKnife || fClaw ) { - if( pTarget->pSoldier->bLifeMax - pTarget->pSoldier->bBleeding - iImpact >= pTarget->pSoldier->bLife ) + if( pTarget->pSoldier->stats.bLifeMax - pTarget->pSoldier->bBleeding - iImpact >= pTarget->pSoldier->stats.bLife ) pTarget->pSoldier->bBleeding += (INT8)iImpact; else - pTarget->pSoldier->bBleeding = (INT8)(pTarget->pSoldier->bLifeMax - pTarget->pSoldier->bLife); + pTarget->pSoldier->bBleeding = (INT8)(pTarget->pSoldier->stats.bLifeMax - pTarget->pSoldier->stats.bLife); } - if( !pTarget->pSoldier->bLife ) + if( !pTarget->pSoldier->stats.bLife ) { gpAR->fRenderAutoResolve = TRUE; #ifdef INVULNERABILITY @@ -4267,7 +4249,7 @@ void TargetHitCallback( SOLDIERCELL *pTarget, INT32 index ) { INT32 iNewLife; SOLDIERCELL *pAttacker; - if( !pTarget->pSoldier->bLife ) + if( !pTarget->pSoldier->stats.bLife ) { //Soldier already dead (can't kill him again!) return; } @@ -4291,8 +4273,8 @@ void TargetHitCallback( SOLDIERCELL *pTarget, INT32 index ) pTarget->usHitDamage[index] = (pTarget->usHitDamage[index] + 4) / 8; break; } - - iNewLife = pTarget->pSoldier->bLife - pTarget->usHitDamage[index]; + + iNewLife = pTarget->pSoldier->stats.bLife - pTarget->usHitDamage[index]; if( !pTarget->usHitDamage[index] ) { //bullet missed -- play a ricochet sound. if( pTarget->uiFlags & CELL_MERC ) @@ -4301,7 +4283,7 @@ void TargetHitCallback( SOLDIERCELL *pTarget, INT32 index ) PlayAutoResolveSample( MISS_1 + PreRandom(8), RATE_11025, 50, 1, MIDDLEPAN ); return; } - + if( pAttacker->uiFlags & CELL_MERC ) { //Attacker is a player, so increment the number of shots that hit. gMercProfiles[ pAttacker->pSoldier->ubProfile ].usShotsHit++; @@ -4318,13 +4300,13 @@ void TargetHitCallback( SOLDIERCELL *pTarget, INT32 index ) //bullet hit -- play an impact sound and a merc hit sound PlayAutoResolveSample( (UINT8)(BULLET_IMPACT_1+PreRandom(3)), RATE_11025, 50, 1, MIDDLEPAN ); - if( pTarget->pSoldier->bLife >= CONSCIOUSNESS ) + if( pTarget->pSoldier->stats.bLife >= CONSCIOUSNESS ) { if( gpAR->fSound ) - DoMercBattleSound( pTarget->pSoldier, (INT8)( BATTLE_SOUND_HIT1 + PreRandom( 2 ) ) ); + pTarget->pSoldier->DoMercBattleSound( (INT8)( BATTLE_SOUND_HIT1 + PreRandom( 2 ) ) ); } - if( iNewLife < OKLIFE && pTarget->pSoldier->bLife >= OKLIFE ) - { //the hit caused the merc to fall. Play the falling sound + if( iNewLife < OKLIFE && pTarget->pSoldier->stats.bLife >= OKLIFE ) + { //the hit caused the merc to fall. Play the falling sound PlayAutoResolveSample( (UINT8)FALL_1, RATE_11025, 50, 1, MIDDLEPAN ); pTarget->uiFlags &= ~CELL_RETREATING; } @@ -4349,9 +4331,9 @@ void TargetHitCallback( SOLDIERCELL *pTarget, INT32 index ) { gMercProfiles[ pKiller->pSoldier->ubProfile ].usKills++; gStrategicStatus.usPlayerKills++; - // EXPERIENCE CLASS GAIN: Earned a kill - StatChange( pKiller->pSoldier, EXPERAMT, ( UINT16 )( 10 * pTarget->pSoldier->bLevel ), FALSE ); - HandleMoraleEvent( pKiller->pSoldier, MORALE_KILLED_ENEMY, gpAR->ubSectorX, gpAR->ubSectorY, 0 ); + // EXPERIENCE CLASS GAIN: Earned a kill + StatChange( pKiller->pSoldier, EXPERAMT, ( UINT16 )( 10 * pTarget->pSoldier->pathing.bLevel ), FALSE ); + HandleMoraleEvent( pKiller->pSoldier, MORALE_KILLED_ENEMY, gpAR->ubSectorX, gpAR->ubSectorY, 0 ); } else if( pKiller->uiFlags & CELL_MILITIA ) pKiller->pSoldier->ubMilitiaKills += 2; @@ -4361,8 +4343,8 @@ void TargetHitCallback( SOLDIERCELL *pTarget, INT32 index ) if( pAssister1->uiFlags & CELL_MERC ) { gMercProfiles[ pAssister1->pSoldier->ubProfile ].usAssists++; - // EXPERIENCE CLASS GAIN: Earned an assist - StatChange( pAssister1->pSoldier, EXPERAMT, ( UINT16 )( 5 * pTarget->pSoldier->bLevel ), FALSE ); + // EXPERIENCE CLASS GAIN: Earned an assist + StatChange( pAssister1->pSoldier, EXPERAMT, ( UINT16 )( 5 * pTarget->pSoldier->pathing.bLevel ), FALSE ); } else if( pAssister1->uiFlags & CELL_MILITIA ) pAssister1->pSoldier->ubMilitiaKills++; @@ -4372,8 +4354,8 @@ void TargetHitCallback( SOLDIERCELL *pTarget, INT32 index ) if( pAssister2->uiFlags & CELL_MERC ) { gMercProfiles[ pAssister2->pSoldier->ubProfile ].usAssists++; - // EXPERIENCE CLASS GAIN: Earned an assist - StatChange( pAssister2->pSoldier, EXPERAMT, ( UINT16 )( 5 * pTarget->pSoldier->bLevel ), FALSE ); + // EXPERIENCE CLASS GAIN: Earned an assist + StatChange( pAssister2->pSoldier, EXPERAMT, ( UINT16 )( 5 * pTarget->pSoldier->pathing.bLevel ), FALSE ); } else if( pAssister2->uiFlags & CELL_MILITIA ) pAssister2->pSoldier->ubMilitiaKills++; @@ -4398,7 +4380,7 @@ void TargetHitCallback( SOLDIERCELL *pTarget, INT32 index ) { //Normal death if( gpAR->fSound ) { - DoMercBattleSound( pTarget->pSoldier, BATTLE_SOUND_DIE1 ); + pTarget->pSoldier->DoMercBattleSound( BATTLE_SOUND_DIE1 ); } } #ifdef INVULNERABILITY @@ -4407,17 +4389,17 @@ void TargetHitCallback( SOLDIERCELL *pTarget, INT32 index ) #endif } //Adjust the soldiers stats based on the damage. - pTarget->pSoldier->bLife = (INT8)max( iNewLife, 0 ); + pTarget->pSoldier->stats.bLife = (INT8)max( iNewLife, 0 ); if( pTarget->uiFlags & CELL_MERC && gpAR->pRobotCell) { - UpdateRobotControllerGivenRobot( gpAR->pRobotCell->pSoldier ); + gpAR->pRobotCell->pSoldier->UpdateRobotControllerGivenRobot( ); } - if( pTarget->pSoldier->bLifeMax - pTarget->pSoldier->bBleeding - pTarget->usHitDamage[index] >= pTarget->pSoldier->bLife ) + if( pTarget->pSoldier->stats.bLifeMax - pTarget->pSoldier->bBleeding - pTarget->usHitDamage[index] >= pTarget->pSoldier->stats.bLife ) pTarget->pSoldier->bBleeding += (INT8)pTarget->usHitDamage[index]; else - pTarget->pSoldier->bBleeding = (INT8)(pTarget->pSoldier->bLifeMax - pTarget->pSoldier->bLife); - if( !pTarget->pSoldier->bLife ) + pTarget->pSoldier->bBleeding = (INT8)(pTarget->pSoldier->stats.bLifeMax - pTarget->pSoldier->stats.bLife); + if( !pTarget->pSoldier->stats.bLife ) { gpAR->fRenderAutoResolve = TRUE; if( pTarget->uiFlags & CELL_MERC ) @@ -4465,7 +4447,7 @@ BOOLEAN IsBattleOver() return TRUE; for( i = 0; i < gpAR->ubMercs; i++ ) { - if( !(gpMercs[ i ].uiFlags & CELL_RETREATED) && gpMercs[ i ].pSoldier->bLife ) + if( !(gpMercs[ i ].uiFlags & CELL_RETREATED) && gpMercs[ i ].pSoldier->stats.bLife ) { if( !(gpMercs[ i ].uiFlags & CELL_EPC) ) { @@ -4488,8 +4470,8 @@ BOOLEAN IsBattleOver() gpAR->pRobotCell->usAttack = 0; if( iNumInvolvedMercs == 1 && !gpAR->ubAliveCivs ) { //Robot is the only one left in battle, so instantly kill him. - DoMercBattleSound( pRobot, BATTLE_SOUND_DIE1 ); - pRobot->bLife = 0; + pRobot->DoMercBattleSound( BATTLE_SOUND_DIE1 ); + pRobot->stats.bLife = 0; gpAR->ubAliveMercs--; iNumInvolvedMercs = 0; } @@ -4512,19 +4494,19 @@ BOOLEAN IsBattleOver() { if( gpMercs[ i ].uiFlags & CELL_EPC ) { - DoMercBattleSound( gpMercs[ i ].pSoldier, BATTLE_SOUND_DIE1 ); - gpMercs[ i ].pSoldier->bLife = 0; + gpMercs[ i ].pSoldier->DoMercBattleSound( BATTLE_SOUND_DIE1 ); + gpMercs[ i ].pSoldier->stats.bLife = 0; gpAR->ubAliveMercs--; } } } for( i = 0; i < gpAR->ubEnemies; i++ ) { - if( gpEnemies[ i ].pSoldier->bLife ) + if( gpEnemies[ i ].pSoldier->stats.bLife ) { if( gubEnemyEncounterCode != CREATURE_ATTACK_CODE ) { - DoMercBattleSound( gpEnemies[ i ].pSoldier, BATTLE_SOUND_LAUGH1 ); + gpEnemies[ i ].pSoldier->DoMercBattleSound( BATTLE_SOUND_LAUGH1 ); } else { @@ -4572,7 +4554,7 @@ BOOLEAN AttemptPlayerCapture() return FALSE; } if( gpAR->fCaptureNotPermittedDueToEPCs ) - { //EPCs make things much more difficult when considering capture. Simply don't allow it. + { //EPCs make things much more difficult when considering capture. Simply don't allow it. return FALSE; } //Only attempt capture of mercs if there are 2 or 3 of them alive @@ -4589,7 +4571,7 @@ BOOLEAN AttemptPlayerCapture() iConciousEnemies = 0; for( i = 0; i < gpAR->ubEnemies; i++ ) { - if( gpEnemies[ i ].pSoldier->bLife >= OKLIFE ) + if( gpEnemies[ i ].pSoldier->stats.bLife >= OKLIFE ) { iConciousEnemies++; } @@ -4599,8 +4581,8 @@ BOOLEAN AttemptPlayerCapture() return FALSE; } - //So far, the conditions are right. Now, we will determine if the the remaining players are - //wounded and/or unconcious. If any are concious, we will prompt for a surrender, otherwise, + //So far, the conditions are right. Now, we will determine if the the remaining players are + //wounded and/or unconcious. If any are concious, we will prompt for a surrender, otherwise, //it is automatic. fConcious = FALSE; for( i = 0; i < gpAR->ubMercs; i++ ) @@ -4610,16 +4592,16 @@ BOOLEAN AttemptPlayerCapture() { return FALSE; } - if( gpMercs[ i ].pSoldier->bLife*100 > gpMercs[ i ].pSoldier->bLifeMax*60 ) + if( gpMercs[ i ].pSoldier->stats.bLife*100 > gpMercs[ i ].pSoldier->stats.bLifeMax*60 ) { return FALSE; } - if( gpMercs[ i ].pSoldier->bLife >= OKLIFE ) + if( gpMercs[ i ].pSoldier->stats.bLife >= OKLIFE ) { fConcious = TRUE; } } - if( fConcious ) + if( fConcious ) { if( PreRandom( 100 ) < 2 ) { @@ -4783,8 +4765,8 @@ void ProcessBattleFrame() //Now process each of the players iTotal = gpAR->ubMercs + gpAR->ubCivs + gpAR->ubEnemies + 1; - iMercs = iMercsLeft = gpAR->ubMercs; - iCivs = iCivsLeft = gpAR->ubCivs; + iMercs = iMercsLeft = gpAR->ubMercs; + iCivs = iCivsLeft = gpAR->ubCivs; iEnemies = iEnemiesLeft = gpAR->ubEnemies; for( i = 0; i < gpAR->ubMercs; i++ ) gpMercs[ i ].uiFlags &= ~CELL_PROCESSED; @@ -4797,9 +4779,9 @@ void ProcessBattleFrame() INT32 cnt; if( iTimeSlice != 0x7fffffff && GetJA2Clock() > gpAR->uiCurrTime+17 || !gpAR->fInstantFinish && iAttacksThisFrame > (gpAR->ubMercs+gpAR->ubCivs+gpAR->ubEnemies)/4 ) - { //We have spent too much time in here. In order to maintain 60FPS, we will + { //We have spent too much time in here. In order to maintain 60FPS, we will //leave now, which will allow for updating of the graphics (and mouse cursor), - //and all of the necessary locals are saved via static variables. It'll check + //and all of the necessary locals are saved via static variables. It'll check //the fContinue flag, and goto the CONTINUE_BATTLE label the next time this function //is called. fContinue = TRUE; @@ -4865,7 +4847,7 @@ void ProcessBattleFrame() iTime = pAttacker->usNextHit[ cnt ]; iTime -= uiSlice; if( iTime >= 0 ) - { //Bullet still on route. + { //Bullet still on route. pAttacker->usNextHit[ cnt ] = (UINT16)iTime; } else @@ -4876,9 +4858,9 @@ void ProcessBattleFrame() } } } - if( pAttacker->pSoldier->bLife < OKLIFE || pAttacker->uiFlags & CELL_RETREATED ) + if( pAttacker->pSoldier->stats.bLife < OKLIFE || pAttacker->uiFlags & CELL_RETREATED ) { - if( !(pAttacker->uiFlags & CELL_CREATURE) || !pAttacker->pSoldier->bLife ) + if( !(pAttacker->uiFlags & CELL_CREATURE) || !pAttacker->pSoldier->stats.bLife ) continue; //can't attack if you are unconcious or not around (Or a live creature) } iTime = pAttacker->usNextAttack; @@ -4891,7 +4873,7 @@ void ProcessBattleFrame() else { if( pAttacker->uiFlags & CELL_RETREATING ) - { //The merc has successfully retreated. Remove the stats, and continue on. + { //The merc has successfully retreated. Remove the stats, and continue on. if( pAttacker == gpAR->pRobotCell ) { if( gpAR->pRobotCell->pSoldier->ubRobotRemoteHolderID == NOBODY ) @@ -4952,9 +4934,9 @@ BOOLEAN GetCurrentBattleSectorXYZ( INT16 *psSectorX, INT16 *psSectorY, INT16 *ps { if( gpAR ) { - *psSectorX = gpAR->ubSectorX; - *psSectorY = gpAR->ubSectorY; - *psSectorZ = 0; + *psSectorX = gpAR->ubSectorX; + *psSectorY = gpAR->ubSectorY; + *psSectorZ = 0; return TRUE; } else if( gfPreBattleInterfaceActive ) @@ -4984,15 +4966,15 @@ BOOLEAN GetCurrentBattleSectorXYZ( INT16 *psSectorX, INT16 *psSectorY, INT16 *ps BOOLEAN GetCurrentBattleSectorXYZAndReturnTRUEIfThereIsABattle( INT16 *psSectorX, INT16 *psSectorY, INT16 *psSectorZ ) { if ( ( psSectorX == NULL )||(psSectorY == NULL )||(psSectorZ == NULL ) ) - { + { return FALSE; } if( gpAR ) { - *psSectorX = gpAR->ubSectorX; - *psSectorY = gpAR->ubSectorY; - *psSectorZ = 0; + *psSectorX = gpAR->ubSectorX; + *psSectorY = gpAR->ubSectorY; + *psSectorZ = 0; return TRUE; } else if( gfPreBattleInterfaceActive ) @@ -5034,8 +5016,8 @@ BOOLEAN ProcessLoyalty() if( PlayerMercsInSector( gpAR->ubSectorX, gpAR->ubSectorY, 0 ) ) return TRUE; - if( GetTownIdForSector( gpAR->ubSectorX, gpAR->ubSectorY ) != BLANK_SECTOR || - IsThisSectorASAMSector( gpAR->ubSectorX, gpAR->ubSectorY, 0 ) ) + if( GetTownIdForSector( gpAR->ubSectorX, gpAR->ubSectorY ) != BLANK_SECTOR || + IsThisSectorASAMSector( gpAR->ubSectorX, gpAR->ubSectorY, 0 ) ) return TRUE; return FALSE; diff --git a/Strategic/Campaign Init.cpp b/Strategic/Campaign Init.cpp index f8a68027..2a5cd6c1 100644 --- a/Strategic/Campaign Init.cpp +++ b/Strategic/Campaign Init.cpp @@ -27,10 +27,10 @@ UNDERGROUND_SECTORINFO* gpUndergroundSectorInfoTail = NULL; // Lesh: this array controls randomization of sectors // Note that some sectors in game already using alternative map // It is Skyrider quest: B15, E14, D12, C16 -// weapon caches: E11, H5, H10, J12, M9 -// Madlab quest: H7, H16, I11, E4 +// weapon caches: E11, H5, H10, J12, M9 +// Madlab quest: H7, H16, I11, E4 // Do not enable randomization of this sectors until you are know what you're doing -BOOLEAN RandomSector[256] = +BOOLEAN RandomSector[256] = { // 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 /* A */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -62,7 +62,7 @@ typedef struct ALTSECTORS_PARSE_STAGE curElement; CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; UINT32 uiRowNumber; - + UINT32 currentDepth; UINT32 maxReadDepth; } altSectorsParseData; @@ -152,14 +152,14 @@ BOOLEAN ReadInAltSectors(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + altSectorsParseData pData; // Open xml file hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -174,16 +174,16 @@ BOOLEAN ReadInAltSectors(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, altSectorsStartElementHandle, altSectorsEndElementHandle); XML_SetCharacterDataHandler(parser, altSectorsCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -221,14 +221,14 @@ BOOLEAN WriteInAltSectors(STR fileName) fprintf (outfile, "\n"); fclose(outfile); - + return (TRUE); } UNDERGROUND_SECTORINFO* NewUndergroundNode( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubSectorZ ) { UNDERGROUND_SECTORINFO *curr; - curr = (UNDERGROUND_SECTORINFO*)MemAlloc( sizeof( UNDERGROUND_SECTORINFO ) ); + curr = (UNDERGROUND_SECTORINFO*)MemAlloc( sizeof( UNDERGROUND_SECTORINFO ) ); AssertMsg( curr, "Failed to create an underground sector info node." ); memset( curr, 0, sizeof( UNDERGROUND_SECTORINFO ) ); @@ -292,34 +292,34 @@ void InitMiningLocations() { SECTORINFO *pSector; //Set up mining sites - + pSector = &SectorInfo[SEC_D4]; pSector->uiFlags |= SF_MINING_SITE; -// pSector->ubIncomeValue = 33; +// pSector->ubIncomeValue = 33; pSector = &SectorInfo[SEC_D13]; pSector->uiFlags |= SF_MINING_SITE; // pSector->ubIncomeValue = 41; - + pSector = &SectorInfo[SEC_B2]; pSector->uiFlags |= SF_MINING_SITE; // pSector->ubIncomeValue = 20; - + pSector = &SectorInfo[SEC_H8]; pSector->uiFlags |= SF_MINING_SITE; // pSector->ubIncomeValue = 64; - + pSector = &SectorInfo[SEC_I14]; pSector->uiFlags |= SF_MINING_SITE; // pSector->ubIncomeValue = 80; - + //Grumm pSector = &SectorInfo[SEC_H3]; pSector->uiFlags |= SF_MINING_SITE; // pSector->ubIncomeValue = 100; } -//Mobile groups are handled separately from sectors, because they are on the move. +//Mobile groups are handled separately from sectors, because they are on the move. void GeneratePatrolGroups() { GROUP *pGroup; @@ -379,14 +379,13 @@ void TrashUndergroundSectorInfo() gpUndergroundSectorInfoTail = NULL; } -//Defines the sectors that can be occupied by enemies, creatures, etc. It also +//Defines the sectors that can be occupied by enemies, creatures, etc. It also //contains the network of cave connections critical for strategic creature spreading, as we can't -//know how the levels connect without loading the maps. This is completely hardcoded, and any +//know how the levels connect without loading the maps. This is completely hardcoded, and any //changes to the maps, require changes accordingly. void BuildUndergroundSectorInfoList() { UNDERGROUND_SECTORINFO *curr; - SECTORINFO *pSector = NULL; TrashUndergroundSectorInfo(); @@ -394,13 +393,13 @@ void BuildUndergroundSectorInfoList() //* BASEMENT LEVEL 1 * //******************** - //Miguel's basement. Nothing here. + //Miguel's basement. Nothing here. curr = NewUndergroundNode( 10, 1, 1 ); - - //Chitzena mine. Nothing here. + + //Chitzena mine. Nothing here. curr = NewUndergroundNode( 2, 2, 1 ); - //San mona mine. Nothing here. + //San mona mine. Nothing here. curr = NewUndergroundNode( 4, 4, 1 ); curr = NewUndergroundNode( 5, 4, 1 ); @@ -429,13 +428,13 @@ void BuildUndergroundSectorInfoList() curr = NewUndergroundNode( 4, 11, 1 ); curr->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel*2 + Random( 3 )); curr->ubNumElites = (UINT8)(4 + gGameOptions.ubDifficultyLevel + Random( 2 )); - + //O3 curr = NewUndergroundNode( 3, 15, 1 ); curr->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel*2 + Random( 3 )); curr->ubNumElites = (UINT8)(4 + gGameOptions.ubDifficultyLevel + Random( 2 )); curr->ubAdjacentSectors |= SOUTH_ADJACENT_SECTOR; - + //P3 curr = NewUndergroundNode( 3, 16, 1 ); switch( gGameOptions.ubDifficultyLevel ) @@ -456,7 +455,7 @@ void BuildUndergroundSectorInfoList() curr->ubAdjacentSectors |= NORTH_ADJACENT_SECTOR; //Do all of the mandatory underground mine sectors - + //Drassen's mine //D13_B1 curr = NewUndergroundNode( 13, 4, 1 ); @@ -549,8 +548,8 @@ void BuildUndergroundSectorInfoList() } // Lesh: this function creates randomized world -// every sector can be randomized between common and alternative, chances 50/50 -// randomization of individual sectors can be switched off via array RandomSector[] +// every sector can be randomized between common and alternative, chances 50/50 +// randomization of individual sectors can be switched off via array RandomSector[] void InitWorld() { INT16 sSectorCounter; @@ -565,28 +564,28 @@ void InitWorld() } } -//This is the function that is called only once, when the player begins a new game. This will calculate +//This is the function that is called only once, when the player begins a new game. This will calculate //starting numbers of the queen's army in various parts of the map, which will vary from campaign to campaign. //This is also highly effected by the game's difficulty setting. void InitNewCampaign() { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"InitNewCampaign"); - //First clear all the sector information of all enemy existance. Conveniently, the + //First clear all the sector information of all enemy existance. Conveniently, the //ubGroupType is also cleared, which is perceived to be an empty group. memset( &SectorInfo, 0, sizeof( SECTORINFO ) * 256 ); InitStrategicMovementCosts(); RemoveAllGroups(); - InitWorld(); // Lesh: generate different world each time using alternative maps + InitWorld(); // Lesh: generate different world each time using alternative maps InitMiningLocations(); InitKnowFacilitiesFlags( ); BuildUndergroundSectorInfoList(); - + // allow overhead view of omerta A9 on game onset SetSectorFlag( 9, 1, 0, SF_ALREADY_VISITED ); - //Generates the initial forces in a new campaign. The idea is to randomize numbers and sectors + //Generates the initial forces in a new campaign. The idea is to randomize numbers and sectors //so that no two games are the same. InitStrategicAI(); diff --git a/Strategic/Campaign Types.h b/Strategic/Campaign Types.h index 4baa39b0..e5451731 100644 --- a/Strategic/Campaign Types.h +++ b/Strategic/Campaign Types.h @@ -56,8 +56,8 @@ enum //strategic values for each sector #define SF_USE_MAP_SETTINGS 0x00000001 #define SF_ENEMY_AMBUSH_LOCATION 0x00000002 -//Special case flag used when players encounter enemies in a sector, then retreat. The number of enemies -//will display on mapscreen until time is compressed. When time is compressed, the flag is cleared, and +//Special case flag used when players encounter enemies in a sector, then retreat. The number of enemies +//will display on mapscreen until time is compressed. When time is compressed, the flag is cleared, and //a question mark is displayed to reflect that the player no longer knows. #define SF_PLAYER_KNOWS_ENEMIES_ARE_HERE 0x00000004 @@ -172,7 +172,7 @@ extern UINT8 gszTerrain[NUM_TRAVTERRAIN_TYPES][15]; #define TRAVELRATING_HIGH 75 #define TRAVELRATING_EXTREME 100 -//Used by ubGarrisonID when a sector doesn't point to a garrison. Used by strategic AI only. +//Used by ubGarrisonID when a sector doesn't point to a garrison. Used by strategic AI only. #define NO_GARRISON 255 typedef struct SECTORINFO @@ -194,7 +194,7 @@ typedef struct SECTORINFO UINT8 ubNumElites; //the actual number of elites here. UINT8 ubNumAdmins; //the actual number of admins here. UINT8 ubNumCreatures; //only set when immediately before ground attack made! - UINT8 ubTroopsInBattle, ubElitesInBattle, ubAdminsInBattle, ubCreaturesInBattle; + UINT8 ubTroopsInBattle, ubElitesInBattle, ubAdminsInBattle, ubCreaturesInBattle; INT8 bLastKnownEnemies; // -1 means never been there, no idea, otherwise it's what we'd observed most recently // while this is being maintained (partially, surely buggy), nothing uses it anymore. ARM @@ -206,15 +206,15 @@ typedef struct SECTORINFO //The last index represents the traversability if travelling //throught the sector without entering it. INT8 bNameId; - INT8 bUSUSED; + INT8 bUSUSED; INT8 bBloodCats; INT8 bBloodCatPlacements; INT8 UNUSEDbSAMCondition; - UINT8 ubTravelRating; //Represents how travelled a sector is. Typically, the higher the travel rating, - //the more people go near it. A travel rating of 0 means there are never people - //around. This value is used for determining how often items would "vanish" from - //a sector (nice theory, except it isn't being used that way. Stealing is only in towns. ARM) + UINT8 ubTravelRating; //Represents how travelled a sector is. Typically, the higher the travel rating, + //the more people go near it. A travel rating of 0 means there are never people + //around. This value is used for determining how often items would "vanish" from + //a sector (nice theory, except it isn't being used that way. Stealing is only in towns. ARM) UINT8 ubNumberOfCivsAtLevel[ MAX_MILITIA_LEVELS ]; // town militia per experience class, 0/1/2 is GREEN/REGULAR/ELITE UINT16 usUNUSEDMilitiaLevels; // unused (ARM) UINT8 ubUNUSEDNumberOfJoeBlowCivilians; // unused (ARM) @@ -247,9 +247,9 @@ typedef struct UNDERGROUND_SECTORINFO UINT8 ubSectorX, ubSectorY, ubSectorZ; UINT8 ubNumElites, ubNumTroops, ubNumAdmins, ubNumCreatures; UINT8 fVisited; - INT8 ubTravelRating; //Represents how travelled a sector is. Typically, the higher the travel rating, - //the more people go near it. A travel rating of 0 means there are never people - //around. This value is used for determining how often items would "vanish" from + INT8 ubTravelRating; //Represents how travelled a sector is. Typically, the higher the travel rating, + //the more people go near it. A travel rating of 0 means there are never people + //around. This value is used for determining how often items would "vanish" from //a sector. UINT32 uiTimeCurrentSectorWasLastLoaded; //Specifies the last time the player was in the sector struct UNDERGROUND_SECTORINFO *next; @@ -262,7 +262,7 @@ typedef struct UNDERGROUND_SECTORINFO //no padding left! }UNDERGROUND_SECTORINFO; -//The sector information required for the strategic AI. Contains the number of enemy troops, +//The sector information required for the strategic AI. Contains the number of enemy troops, //as well as intentions, etc. extern SECTORINFO SectorInfo[256]; extern UNDERGROUND_SECTORINFO *gpUndergroundSectorInfoHead; diff --git a/Strategic/Creature Spreading.cpp b/Strategic/Creature Spreading.cpp index e122e9ba..6bd14dbb 100644 --- a/Strategic/Creature Spreading.cpp +++ b/Strategic/Creature Spreading.cpp @@ -53,8 +53,8 @@ //#define HARD_QUEEN_START_DAY 7 //hard start day 7-8 //#define HARD_QUEEN_START_BONUS 1 -//This is how often the creatures spread, once the quest begins. The smaller the gap, -//the faster the creatures will advance. This is also directly related to the reproduction +//This is how often the creatures spread, once the quest begins. The smaller the gap, +//the faster the creatures will advance. This is also directly related to the reproduction //rates which are applied each time the creatures spread. #define EASY_SPREAD_TIME_IN_MINUTES 510 //easy spreads every 8.5 hours #define NORMAL_SPREAD_TIME_IN_MINUTES 450 //normal spreads every 7.5 hours @@ -62,26 +62,26 @@ #define INSANE_SPREAD_TIME_IN_MINUTES 150 //insane spreads every 2.5 hours //Once the queen is added to the game, we can instantly let her spread x number of times -//to give her a head start. This can also be a useful tool for having slow reproduction rates +//to give her a head start. This can also be a useful tool for having slow reproduction rates //but quicker head start to compensate to make the creatures less aggressive overall. #define EASY_QUEEN_INIT_BONUS_SPREADS 1 #define NORMAL_QUEEN_INIT_BONUS_SPREADS 2 #define HARD_QUEEN_INIT_BONUS_SPREADS 3 #define INSANE_QUEEN_INIT_BONUS_SPREADS 5 -//This value modifies the chance to populate a given sector. This is different from the previous definition. +//This value modifies the chance to populate a given sector. This is different from the previous definition. //This value gets applied to a potentially complicated formula, using the creature habitat to modify //chance to populate, along with factoring in the relative distance to the hive range (to promote deeper lair -//population increases), etc. I would recommend not tweaking the value too much in either direction from -//zero due to the fact that this can greatly effect spread times and maximum populations. Basically, if the +//population increases), etc. I would recommend not tweaking the value too much in either direction from +//zero due to the fact that this can greatly effect spread times and maximum populations. Basically, if the //creatures are spreading too quickly, increase the value, otherwise decrease it to a negative value #define EASY_POPULATION_MODIFIER 0 #define NORMAL_POPULATION_MODIFIER 0 #define HARD_POPULATION_MODIFIER 0 #define INSANE_POPULATION_MODIFIER 0 -//Augments the chance that the creatures will attack a town. The conditions for attacking a town -//are based strictly on the occupation of the creatures in each of the four mine exits. For each creature +//Augments the chance that the creatures will attack a town. The conditions for attacking a town +//are based strictly on the occupation of the creatures in each of the four mine exits. For each creature //there is a base chance of 10% that the creatures will feed sometime during the night. #define EASY_CREATURE_TOWN_AGGRESSIVENESS -10 #define NORMAL_CREATURE_TOWN_AGGRESSIVENESS 0 @@ -89,7 +89,7 @@ #define INSANE_CREATURE_TOWN_AGGRESSIVENESS 50 -//This is how many creatures the queen produces for each cycle of spreading. The higher +//This is how many creatures the queen produces for each cycle of spreading. The higher //the numbers the faster the creatures will advance. #define EASY_QUEEN_REPRODUCTION_BASE 6 //6-7 #define EASY_QUEEN_REPRODUCTION_BONUS 1 @@ -101,15 +101,15 @@ #define INSANE_QUEEN_REPRODUCTION_BONUS 5 //When either in a cave level with blue lights or there is a creature presence, then -//we override the normal music with the creature music. The conditions are maintained +//we override the normal music with the creature music. The conditions are maintained //inside the function PrepareCreaturesForBattle() in this module. BOOLEAN gfUseCreatureMusic = FALSE; BOOLEAN gfCreatureMeanwhileScenePlayed = FALSE; enum { - QUEEN_LAIR, //where the queen lives. Highly protected + QUEEN_LAIR, //where the queen lives. Highly protected LAIR, //part of the queen's lair -- lots of babies and defending mothers - LAIR_ENTRANCE, //where the creatures access the mine. + LAIR_ENTRANCE, //where the creatures access the mine. INNER_MINE, //parts of the mines that aren't close to the outside world OUTER_MINE, //area's where miners work, close to towns, creatures love to eat :) FEEDING_GROUNDS, //creatures love to populate these sectors :) @@ -287,7 +287,7 @@ void InitCreatureQuest() #ifdef JA2BETAVERSION if( guiCurrentScreen != AIVIEWER_SCREEN ) - { + { fPlayMeanwhile = TRUE; } #else @@ -301,7 +301,7 @@ void InitCreatureQuest() gfCreatureMeanwhileScenePlayed = TRUE; } - giHabitatedDistance = 0; + giHabitatedDistance = 0; switch( gGameOptions.ubDifficultyLevel ) { case DIF_LEVEL_EASY: @@ -318,32 +318,32 @@ void InitCreatureQuest() break; } - //Determine which of the four maps are infectible by creatures. Infectible mines - //are those that are player controlled and unlimited. We don't want the creatures to + //Determine which of the four maps are infectible by creatures. Infectible mines + //are those that are player controlled and unlimited. We don't want the creatures to //infect the mine that runs out. //Default them all to infectible memset( fMineInfectible, 1, sizeof( BOOLEAN ) * 4 ); - if( gMineStatus[ MINE_DRASSEN ].fAttackedHeadMiner || + if( gMineStatus[ MINE_DRASSEN ].fAttackedHeadMiner || gMineStatus[ MINE_DRASSEN ].uiOreRunningOutPoint || StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_D13 ) ].fEnemyControlled ) { //If head miner was attacked, ore will/has run out, or enemy controlled fMineInfectible[ 0 ] = FALSE; } - if( gMineStatus[ MINE_CAMBRIA ].fAttackedHeadMiner || + if( gMineStatus[ MINE_CAMBRIA ].fAttackedHeadMiner || gMineStatus[ MINE_CAMBRIA ].uiOreRunningOutPoint || StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_H8 ) ].fEnemyControlled ) { //If head miner was attacked, ore will/has run out, or enemy controlled fMineInfectible[ 1 ] = FALSE; } - if( gMineStatus[ MINE_ALMA ].fAttackedHeadMiner || + if( gMineStatus[ MINE_ALMA ].fAttackedHeadMiner || gMineStatus[ MINE_ALMA ].uiOreRunningOutPoint || StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_I14 ) ].fEnemyControlled ) { //If head miner was attacked, ore will/has run out, or enemy controlled fMineInfectible[ 2 ] = FALSE; } - if( gMineStatus[ MINE_GRUMM ].fAttackedHeadMiner || + if( gMineStatus[ MINE_GRUMM ].fAttackedHeadMiner || gMineStatus[ MINE_GRUMM ].uiOreRunningOutPoint || StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_H3 ) ].fEnemyControlled ) { //If head miner was attacked, ore will/has run out, or enemy controlled @@ -391,7 +391,7 @@ void InitCreatureQuest() case 1: //Drassen InitLairDrassen(); curr = FindUnderGroundSector( 13, 5, 1 ); - curr->uiFlags |= SF_PENDING_ALTERNATE_MAP; + curr->uiFlags |= SF_PENDING_ALTERNATE_MAP; break; case 2: //Cambria InitLairCambria(); @@ -412,12 +412,12 @@ void InitCreatureQuest() #ifdef JA2BETAVERSION { CHAR16 str[512]; - swprintf( str, L"Creature quest never chose a lair and won't infect any mines. Infectible mines = %d, iRandom = %d. " - L"This isn't a bug if you are not receiving income from any mines.", iNumMinesInfectible, iOrigRandom ); + swprintf( str, L"Creature quest never chose a lair and won't infect any mines. Infectible mines = %d, iRandom = %d. " + L"This isn't a bug if you are not receiving income from any mines.", iNumMinesInfectible, iOrigRandom ); DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, NULL ); } #endif - return; + return; } //Now determine how often we will spread the creatures. @@ -442,7 +442,7 @@ void InitCreatureQuest() } //Set things up so that the creatures can plan attacks on helpless miners and civilians while - //they are sleeping. They do their planning at 10PM every day, and decide to attack sometime + //they are sleeping. They do their planning at 10PM every day, and decide to attack sometime //during the night. AddEveryDayStrategicEvent( EVENT_CREATURE_NIGHT_PLANNING, 1320, 0 ); @@ -456,9 +456,9 @@ void InitCreatureQuest() void AddCreatureToNode( CREATURE_DIRECTIVE *node ) { node->pLevel->ubNumCreatures++; - + if( node->pLevel->uiFlags & SF_PENDING_ALTERNATE_MAP ) - { //there is an alternate map meaning that there is a dynamic opening. From now on + { //there is an alternate map meaning that there is a dynamic opening. From now on //we substitute this map. node->pLevel->uiFlags &= ~SF_PENDING_ALTERNATE_MAP; node->pLevel->uiFlags |= SF_USE_ALTERNATE_MAP; @@ -470,35 +470,35 @@ BOOLEAN PlaceNewCreature( CREATURE_DIRECTIVE *node, INT32 iDistance ) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CreatureSpreading1"); if( !node ) return FALSE; - //check to see if the creatures are permitted to spread into certain areas. There are 4 mines (human perspective), and - //creatures won't spread to them until the player controls them. Additionally, if the player has recently cleared the + //check to see if the creatures are permitted to spread into certain areas. There are 4 mines (human perspective), and + //creatures won't spread to them until the player controls them. Additionally, if the player has recently cleared the //mine, then temporarily prevent the spreading of creatures. - if( giHabitatedDistance == iDistance ) - { //FRONT-LINE CONDITIONS -- consider expansion or frontline fortification. The formulae used + if( giHabitatedDistance == iDistance ) + { //FRONT-LINE CONDITIONS -- consider expansion or frontline fortification. The formulae used //in this sector are geared towards outer expansion. - //we have reached the distance limitation for the spreading. We will determine if - //the area is populated enough to spread further. The minimum population must be 4 before + //we have reached the distance limitation for the spreading. We will determine if + //the area is populated enough to spread further. The minimum population must be 4 before //spreading is even considered. if( node->pLevel->ubNumCreatures*10 - 10 <= (INT32)Random( 60 ) ) - { // x<=1 100% - // x==2 83% - // x==3 67% - // x==4 50% - // x==5 33% - // x==6 17% - // x>=7 0% + { // x<=1 100% + // x==2 83% + // x==3 67% + // x==4 50% + // x==5 33% + // x==6 17% + // x>=7 0% AddCreatureToNode( node ); return TRUE; } } else if( giHabitatedDistance > iDistance ) - { //we are within the "safe" habitated area of the creature's area of influence. The chance of + { //we are within the "safe" habitated area of the creature's area of influence. The chance of //increasing the population inside this sector depends on how deep we are within the sector. if( node->pLevel->ubNumCreatures < gGameExternalOptions.iMaxEnemyGroupSize || - node->pLevel->ubNumCreatures < 32 && node->pLevel->ubCreatureHabitat == QUEEN_LAIR ) - { //there is ALWAYS a chance to habitate an interior sector, though the chances are slim for - //highly occupied sectors. This chance is modified by the type of area we are in. + node->pLevel->ubNumCreatures < 32 && node->pLevel->ubCreatureHabitat == QUEEN_LAIR ) + { //there is ALWAYS a chance to habitate an interior sector, though the chances are slim for + //highly occupied sectors. This chance is modified by the type of area we are in. INT32 iAbsoluteMaxPopulation; INT32 iMaxPopulation=-1; INT32 iChanceToPopulate; @@ -519,7 +519,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CreatureSpreading1"); case OUTER_MINE: //neg bonus -- actually promotes expansion over population, and decrease max pop here. iAbsoluteMaxPopulation = 10; break; - case FEEDING_GROUNDS: //get free food bonus! yummy humans :) + case FEEDING_GROUNDS: //get free food bonus! yummy humans :) iAbsoluteMaxPopulation = 15; break; case MINE_EXIT: //close access to humans (don't want to overwhelm them) @@ -552,13 +552,13 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CreatureSpreading1"); //Now, convert the previous value into a numeric population. iMaxPopulation = iAbsoluteMaxPopulation * iMaxPopulation / 100; iMaxPopulation = max( iMaxPopulation, 4 ); - - //The chance to populate a sector is higher for lower populations. This is calculated on + + //The chance to populate a sector is higher for lower populations. This is calculated on //the ratio of current population to the max population. iChanceToPopulate = 100 - node->pLevel->ubNumCreatures * 100 / iMaxPopulation; - if( !node->pLevel->ubNumCreatures || iChanceToPopulate > (INT32)Random( 100 ) + if( !node->pLevel->ubNumCreatures || iChanceToPopulate > (INT32)Random( 100 ) && iMaxPopulation > node->pLevel->ubNumCreatures ) { AddCreatureToNode( node ); @@ -586,8 +586,8 @@ void SpreadCreatures() DecayCreatures(); return; } - - //queen just produced a litter of creature larvae. Let's do some spreading now. + + //queen just produced a litter of creature larvae. Let's do some spreading now. switch( gGameOptions.ubDifficultyLevel ) { case DIF_LEVEL_EASY: @@ -605,16 +605,17 @@ void SpreadCreatures() } while( usNewCreatures-- ) - { - //Note, this function can and will fail if the population gets dense. This is a necessary - //feature. Otherwise, the queen would fill all the cave levels with MAX_STRATEGIC_TEAM_SIZE monsters, and that would + { + //Note, this function can and will fail if the population gets dense. This is a necessary + //feature. Otherwise, the queen would fill all the cave levels with MAX_STRATEGIC_TEAM_SIZE monsters, and that would //be bad. PlaceNewCreature( lair, 0 ); } } void DecayCreatures() -{ //when the queen dies, we need to kill off the creatures over a period of time. +{ + //when the queen dies, we need to kill off the creatures over a period of time. } @@ -633,7 +634,7 @@ void AddCreaturesToBattle( UINT8 ubNumYoungMales, UINT8 ubNumYoungFemales, UINT8 case INSERTION_CODE_SOUTH: bDesiredDirection = NORTHWEST; break; case INSERTION_CODE_WEST: bDesiredDirection = NORTHEAST; break; case INSERTION_CODE_GRIDNO: break; - default: AssertMsg( 0, "Illegal direction passed to AddCreaturesToBattle()" ); break; + default: AssertMsg( 0, "Illegal direction passed to AddCreaturesToBattle()" ); break; } #ifdef JA2TESTVERSION @@ -648,7 +649,7 @@ void AddCreaturesToBattle( UINT8 ubNumYoungMales, UINT8 ubNumYoungFemales, UINT8 while( ubNumYoungMales || ubNumYoungFemales || ubNumAdultMales || ubNumAdultFemales ) { iRandom = (INT32)Random( ubNumYoungMales + ubNumYoungFemales + ubNumAdultMales + ubNumAdultFemales ); - if( ubNumYoungMales && iRandom < (INT32)ubNumYoungMales ) + if( ubNumYoungMales && iRandom < (INT32)ubNumYoungMales ) { ubNumYoungMales--; pSoldier = TacticalCreateCreature( YAM_MONSTER ); @@ -687,14 +688,14 @@ void AddCreaturesToBattle( UINT8 ubNumYoungMales, UINT8 ubNumYoungFemales, UINT8 pSoldier->ubInsertionDirection = bDesiredDirection; //Setup the position pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; - pSoldier->bHunting = TRUE; + pSoldier->aiData.bHunting = TRUE; if( gsCreatureInsertionCode != INSERTION_CODE_GRIDNO ) { if( ubCurrSlot < MapEdgepointInfo.ubNumPoints ) { //using an edgepoint pSoldier->usStrategicInsertionData = MapEdgepointInfo.sGridNo[ ubCurrSlot++ ]; } - else + else { //no edgepoints left, so put him at the entrypoint. pSoldier->ubStrategicInsertionCode = (UINT8)gsCreatureInsertionCode; } @@ -840,7 +841,8 @@ void ChooseTownSectorToAttack( UINT8 ubSectorID, BOOLEAN fOverrideTest ) } void CreatureAttackTown( UINT8 ubSectorID, BOOLEAN fOverrideTest ) -{ //This is the launching point of the creature attack. +{ + //This is the launching point of the creature attack. UNDERGROUND_SECTORINFO *pSector; UINT8 ubSectorX, ubSectorY; @@ -851,7 +853,7 @@ void CreatureAttackTown( UINT8 ubSectorID, BOOLEAN fOverrideTest ) } gubCreatureBattleCode = CREATURE_BATTLE_CODE_NONE; - + ubSectorX = (UINT8)((ubSectorID % 16) + 1); ubSectorY = (UINT8)((ubSectorID / 16) + 1); @@ -872,8 +874,8 @@ void CreatureAttackTown( UINT8 ubSectorID, BOOLEAN fOverrideTest ) } pSector->ubNumCreatures = 0; - - //Choose one of the town sectors to attack. Sectors closer to + + //Choose one of the town sectors to attack. Sectors closer to //the mine entrance have a greater chance of being chosen. ChooseTownSectorToAttack( ubSectorID, FALSE ); ubSectorX = (UINT8)((gubSectorIDOfCreatureAttack % 16) + 1); @@ -884,12 +886,12 @@ void CreatureAttackTown( UINT8 ubSectorID, BOOLEAN fOverrideTest ) ChooseTownSectorToAttack( ubSectorID, TRUE ); gubNumCreaturesAttackingTown = 5; } - + //Now that the sector has been chosen, attack it! if( PlayerGroupsInSector( ubSectorX, ubSectorY, 0 ) ) { //we have players in the sector if( ubSectorX == gWorldSectorX && ubSectorY == gWorldSectorY && !gbWorldSectorZ ) - { //This is the currently loaded sector. All we have to do is change the music and insert + { //This is the currently loaded sector. All we have to do is change the music and insert //the creatures tactically. if( guiCurrentScreen == GAME_SCREEN ) { @@ -907,7 +909,7 @@ void CreatureAttackTown( UINT8 ubSectorID, BOOLEAN fOverrideTest ) } else if( CountAllMilitiaInSector( ubSectorX, ubSectorY ) ) { //we have militia in the sector - gubCreatureBattleCode = CREATURE_BATTLE_CODE_AUTORESOLVE; + gubCreatureBattleCode = CREATURE_BATTLE_CODE_AUTORESOLVE; } else if( !StrategicMap[ ubSectorX + MAP_WORLD_X * ubSectorY ].fEnemyControlled ) { //player controlled sector -- eat some civilians @@ -915,7 +917,7 @@ void CreatureAttackTown( UINT8 ubSectorID, BOOLEAN fOverrideTest ) SectorInfo[ ubSectorID ].ubDayOfLastCreatureAttack = (UINT8)GetWorldDay(); return; } - else + else { //enemy controlled sectors don't get attacked. return; } @@ -945,7 +947,7 @@ void ChooseCreatureQuestStartDay() // INT32 iRandom, iDay; if( !(gGameOptions.ubGameStyle == STYLE_SCIFI) || !gGameExternalOptions.fEnableCrepitus) return; //only available in science fiction mode. - //Post the event. Once it becomes due, it will setup the queen monster's location, and + //Post the event. Once it becomes due, it will setup the queen monster's location, and //begin spreading and attacking towns from there. switch( gGameOptions.ubDifficultyLevel ) { @@ -966,7 +968,7 @@ void ChooseCreatureQuestStartDay() void DeleteDirectiveNode( CREATURE_DIRECTIVE **node ) { - if( (*node)->next ) + if( (*node)->next ) DeleteDirectiveNode( &((*node)->next) ); MemFree( *node ); *node = NULL; @@ -994,13 +996,13 @@ void EndCreatureQuest() CREATURE_DIRECTIVE *curr; UNDERGROUND_SECTORINFO *pSector; INT32 i; - + //By setting the lairID to -1, when it comes time to spread creatures, //They will get subtracted instead. giDestroyedLairID = giLairID; giLairID = -1; - //Also nuke all of the creatures in all of the other mine sectors. This + //Also nuke all of the creatures in all of the other mine sectors. This //is keyed on the fact that the queen monster is killed. curr = lair; if( curr ) @@ -1092,7 +1094,7 @@ BOOLEAN MineClearOfMonsters( UINT8 ubMineIndex ) } } else - { //mine was previously invaded by creatures. Don't allow mine production until queen is dead. + { //mine was previously invaded by creatures. Don't allow mine production until queen is dead. if( giLairID != -1 ) { return FALSE; @@ -1101,16 +1103,16 @@ BOOLEAN MineClearOfMonsters( UINT8 ubMineIndex ) return TRUE; } -void DetermineCreatureTownComposition( UINT8 ubNumCreatures, - UINT8 *pubNumYoungMales, UINT8 *pubNumYoungFemales, - UINT8 *pubNumAdultMales, UINT8 *pubNumAdultFemales ) +void DetermineCreatureTownComposition( UINT8 ubNumCreatures, + UINT8 *pubNumYoungMales, UINT8 *pubNumYoungFemales, + UINT8 *pubNumAdultMales, UINT8 *pubNumAdultFemales ) { INT32 i, iRandom; UINT8 ubYoungMalePercentage = 10; UINT8 ubYoungFemalePercentage = 65; UINT8 ubAdultMalePercentage = 5; UINT8 ubAdultFemalePercentage = 20; - + //First step is to convert the percentages into the numbers we will use. ubYoungFemalePercentage += ubYoungMalePercentage; ubAdultMalePercentage += ubYoungFemalePercentage; @@ -1135,9 +1137,9 @@ void DetermineCreatureTownComposition( UINT8 ubNumCreatures, } } -void DetermineCreatureTownCompositionBasedOnTacticalInformation( UINT8 *pubNumCreatures, - UINT8 *pubNumYoungMales, UINT8 *pubNumYoungFemales, - UINT8 *pubNumAdultMales, UINT8 *pubNumAdultFemales ) +void DetermineCreatureTownCompositionBasedOnTacticalInformation( UINT8 *pubNumCreatures, + UINT8 *pubNumYoungMales, UINT8 *pubNumYoungFemales, + UINT8 *pubNumAdultMales, UINT8 *pubNumAdultFemales ) { SECTORINFO *pSector; INT32 i; @@ -1150,7 +1152,7 @@ void DetermineCreatureTownCompositionBasedOnTacticalInformation( UINT8 *pubNumCr for( i = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; i++ ) { pSoldier = MercPtrs[ i ]; - if( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife ) + if( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife ) { switch( pSoldier->ubBodyType ) { @@ -1197,7 +1199,6 @@ BOOLEAN PrepareCreaturesForBattle() UINT8 ubNumYoungFemales = 0; UINT8 ubNumAdultMales = 0; UINT8 ubNumAdultFemales = 0; - UINT8 ubPercentage = 0; UINT8 ubNumCreatures; if( !gubCreatureBattleCode ) @@ -1207,7 +1208,7 @@ BOOLEAN PrepareCreaturesForBattle() // ScreenMsg( FONT_RED, MSG_ERROR, L"This map has more than one light color -- KM, LC : 1" ); //By default, we only play creature music in the cave levels (the creature levels all consistently - //have blue lights while human occupied mines have red lights. We always play creature music + //have blue lights while human occupied mines have red lights. We always play creature music //when creatures are in the level. if( LColors->peBlue ) gfUseCreatureMusic = TRUE; @@ -1215,7 +1216,7 @@ BOOLEAN PrepareCreaturesForBattle() gfUseCreatureMusic = FALSE; if( !gbWorldSectorZ ) - return FALSE; //Creatures don't attack overworld with this battle code. + return FALSE; //Creatures don't attack overworld with this battle code. pSector = FindUnderGroundSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); if( !pSector ) { @@ -1239,7 +1240,7 @@ BOOLEAN PrepareCreaturesForBattle() switch( ubCreatureHabitat ) { - case QUEEN_LAIR: + case QUEEN_LAIR: fQueen = TRUE; ubLarvaePercentage = 20; ubInfantPercentage = 40; @@ -1248,7 +1249,7 @@ BOOLEAN PrepareCreaturesForBattle() ubAdultMalePercentage = 30; ubAdultFemalePercentage = 10; break; - case LAIR: + case LAIR: fQueen = FALSE; ubLarvaePercentage = 15; ubInfantPercentage = 35; @@ -1257,7 +1258,7 @@ BOOLEAN PrepareCreaturesForBattle() ubAdultMalePercentage = 25; ubAdultFemalePercentage = 10; break; - case LAIR_ENTRANCE: + case LAIR_ENTRANCE: fQueen = FALSE; ubLarvaePercentage = 0; ubInfantPercentage = 15; @@ -1266,7 +1267,7 @@ BOOLEAN PrepareCreaturesForBattle() ubAdultMalePercentage = 35; ubAdultFemalePercentage = 10; break; - case INNER_MINE: + case INNER_MINE: fQueen = FALSE; ubLarvaePercentage = 0; ubInfantPercentage = 0; @@ -1275,8 +1276,8 @@ BOOLEAN PrepareCreaturesForBattle() ubAdultMalePercentage = 10; ubAdultFemalePercentage = 30; break; - case OUTER_MINE: - case MINE_EXIT: + case OUTER_MINE: + case MINE_EXIT: fQueen = FALSE; ubLarvaePercentage = 0; ubInfantPercentage = 0; @@ -1287,11 +1288,11 @@ BOOLEAN PrepareCreaturesForBattle() break; default: #ifdef JA2BETAVERSION - ScreenMsg( FONT_RED, MSG_ERROR, L"Invalid creature habitat ID of %d for PrepareCreaturesForBattle. Ignoring...", ubCreatureHabitat ); + ScreenMsg( FONT_RED, MSG_ERROR, L"Invalid creature habitat ID of %d for PrepareCreaturesForBattle. Ignoring...", ubCreatureHabitat ); #endif return FALSE; } - + //First step is to convert the percentages into the numbers we will use. if( fQueen ) { @@ -1331,7 +1332,7 @@ BOOLEAN PrepareCreaturesForBattle() pUndergroundSector = FindUnderGroundSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); if( !pUndergroundSector ) { //No info?!!!!! - AssertMsg( 0, "Please report underground sector you are in or going to and send save if possible. KM : 0" ); + AssertMsg( 0, "Please report underground sector you are in or going to and send save if possible. KM : 0" ); return FALSE; } pUndergroundSector->ubCreaturesInBattle = pUndergroundSector->ubNumCreatures; @@ -1347,7 +1348,7 @@ BOOLEAN PrepareCreaturesForBattle() switch( gubCreatureBattleCode ) { case CREATURE_BATTLE_CODE_NONE: //in the mines - AddSoldierInitListCreatures( fQueen, ubNumLarvae, ubNumInfants, + AddSoldierInitListCreatures( fQueen, ubNumLarvae, ubNumInfants, ubNumYoungMales, ubNumYoungFemales, ubNumAdultMales, ubNumAdultFemales ); break; case CREATURE_BATTLE_CODE_TACTICALLYADD: //creature attacking a town sector @@ -1361,7 +1362,8 @@ BOOLEAN PrepareCreaturesForBattle() } void CreatureNightPlanning() -{ //Check the populations of the mine exits, and factor a chance for them to attack at night. +{ + //Check the populations of the mine exits, and factor a chance for them to attack at night. UINT8 ubNumCreatures; ubNumCreatures = CreaturesInUndergroundSector( SEC_H3, 1 ); if( ubNumCreatures > 1 && ubNumCreatures * 10 > (INT32)PreRandom( 100 ) ) @@ -1396,15 +1398,15 @@ void CheckConditionsForTriggeringCreatureQuest( INT16 sSectorX, INT16 sSectorY, //Count the number of "infectible mines" the player occupies if( !StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_D13 ) ].fEnemyControlled ) - { + { ubValidMines++; } if( !StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_H8 ) ].fEnemyControlled ) - { + { ubValidMines++; } if( !StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_I14 ) ].fEnemyControlled ) - { + { ubValidMines++; } if( !StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_H3 ) ].fEnemyControlled ) @@ -1472,7 +1474,7 @@ BOOLEAN LoadCreatureDirectives( HWFILE hFile, UINT32 uiSavedGameVersion ) { return( FALSE ); } - + FileRead( hFile, &gfUseCreatureMusic, 1, &uiNumBytesRead ); if( uiNumBytesRead != sizeof( BOOLEAN ) ) { @@ -1512,7 +1514,7 @@ BOOLEAN LoadCreatureDirectives( HWFILE hFile, UINT32 uiSavedGameVersion ) case 4: InitLairGrumm(); break; default: #ifdef JA2BETAVERSION - ScreenMsg( FONT_RED, MSG_ERROR, L"Invalid restoration of creature lair ID of %d. Save game potentially hosed.", giLairID ); + ScreenMsg( FONT_RED, MSG_ERROR, L"Invalid restoration of creature lair ID of %d. Save game potentially hosed.", giLairID ); #endif break; } @@ -1532,7 +1534,6 @@ BOOLEAN PlayerGroupIsInACreatureInfestedMine() INT32 i; INT16 sSectorX, sSectorY; INT8 bSectorZ; - BOOLEAN fPlayerInSector = FALSE; if( giLairID <= 0 ) { //Creature quest inactive @@ -1551,11 +1552,11 @@ BOOLEAN PlayerGroupIsInACreatureInfestedMine() for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) { pSoldier = MercPtrs[ i ]; - if( pSoldier->bActive && pSoldier->bLife && + if( pSoldier->bActive && pSoldier->stats.bLife && pSoldier->sSectorX == sSectorX && - pSoldier->sSectorY == sSectorY && + pSoldier->sSectorY == sSectorY && pSoldier->bSectorZ == bSectorZ && - !pSoldier->fBetweenSectors ) + !pSoldier->flags.fBetweenSectors ) { return TRUE; } @@ -1570,19 +1571,19 @@ BOOLEAN PlayerGroupIsInACreatureInfestedMine() //Returns TRUE if valid and creature quest over, FALSE if creature quest active or not yet started BOOLEAN GetWarpOutOfMineCodes( INT16 *psSectorX, INT16 *psSectorY, INT8 *pbSectorZ, INT16 *psInsertionGridNo ) { - INT32 iSwitchValue; + INT32 iSwitchValue; if( !gfWorldLoaded ) { return FALSE; } - if ( gbWorldSectorZ == 0 ) - { - return( FALSE ); - } + if ( gbWorldSectorZ == 0 ) + { + return( FALSE ); + } - iSwitchValue = giLairID; + iSwitchValue = giLairID; if( iSwitchValue == -1 ) { diff --git a/Strategic/Creature Spreading.h b/Strategic/Creature Spreading.h index b5f0e0af..650c7aca 100644 --- a/Strategic/Creature Spreading.h +++ b/Strategic/Creature Spreading.h @@ -45,12 +45,12 @@ enum{ extern UINT8 gubCreatureBattleCode; void DetermineCreatureTownComposition( UINT8 ubNumCreatures, - UINT8 *pubNumYoungMales, UINT8 *pubNumYoungFemales, - UINT8 *pubNumAdultMales, UINT8 *pubNumAdultFemales ); + UINT8 *pubNumYoungMales, UINT8 *pubNumYoungFemales, + UINT8 *pubNumAdultMales, UINT8 *pubNumAdultFemales ); void DetermineCreatureTownCompositionBasedOnTacticalInformation( UINT8 *pubNumCreatures, - UINT8 *pubNumYoungMales, UINT8 *pubNumYoungFemales, - UINT8 *pubNumAdultMales, UINT8 *pubNumAdultFemales ); + UINT8 *pubNumYoungMales, UINT8 *pubNumYoungFemales, + UINT8 *pubNumAdultMales, UINT8 *pubNumAdultFemales ); BOOLEAN PlayerGroupIsInACreatureInfestedMine(); diff --git a/Strategic/Game Clock.cpp b/Strategic/Game Clock.cpp index 793554e7..dcb0236f 100644 --- a/Strategic/Game Clock.cpp +++ b/Strategic/Game Clock.cpp @@ -47,9 +47,9 @@ BOOLEAN fClockMouseRegionCreated = FALSE; BOOLEAN fTimeCompressHasOccured = FALSE; -//This value represents the time that the sector was loaded. If you are in sector A9, and leave -//the game clock at that moment will get saved into the temp file associated with it. The next time you -//enter A9, this value will contain that time. Used for scheduling purposes. +//This value represents the time that the sector was loaded. If you are in sector A9, and leave +//the game clock at that moment will get saved into the temp file associated with it. The next time you +//enter A9, this value will contain that time. Used for scheduling purposes. UINT32 guiTimeCurrentSectorWasLastLoaded = 0; // did we JUST finish up a game pause by the player @@ -63,7 +63,7 @@ void AdvanceClock( UINT8 ubWarpCode ); extern BOOLEAN fMapScreenBottomDirty; -#define SECONDS_PER_COMPRESSION 1 // 1/2 minute passes every 1 second of real time +#define SECONDS_PER_COMPRESSION 1 // 1/2 minute passes every 1 second of real time #define SECONDS_PER_COMPRESSION_IN_RTCOMBAT 10 #define SECONDS_PER_COMPRESSION_IN_TBCOMBAT 10 #define CLOCK_STRING_HEIGHT 13 @@ -77,19 +77,19 @@ INT32 giTimeCompressMode = TIME_COMPRESS_X0; UINT8 gubClockResolution = 1; BOOLEAN gfGamePaused = TRUE; BOOLEAN gfTimeInterrupt = FALSE; -BOOLEAN gfTimeInterruptPause = FALSE; +BOOLEAN gfTimeInterruptPause = FALSE; BOOLEAN fSuperCompression = FALSE; UINT32 guiGameClock = gGameExternalOptions.iGameStartingTime; UINT32 guiPreviousGameClock = 0; // used only for error-checking purposes UINT32 guiGameSecondsPerRealSecond; UINT32 guiTimesThisSecondProcessed = 0; -INT32 iPausedPopUpBox = -1; +INT32 iPausedPopUpBox = -1; UINT32 guiDay; UINT32 guiHour; UINT32 guiMin; CHAR16 gswzWorldTimeStr[20]; INT32 giTimeCompressSpeeds[ NUM_TIME_COMPRESS_SPEEDS ] = { 0, 1, 5 * 60, 30 * 60, 60 * 60 }; -UINT16 usPausedActualWidth; +UINT16 usPausedActualWidth; UINT16 usPausedActualHeight; UINT32 guiTimeOfLastEventQuery = 0; BOOLEAN gfLockPauseState = FALSE; @@ -98,7 +98,7 @@ BOOLEAN gfResetAllPlayerKnowsEnemiesFlags = FALSE; BOOLEAN gfTimeCompressionOn = FALSE; UINT32 guiLockPauseStateLastReasonId = 0; //***When adding new saved time variables, make sure you remove the appropriate amount from the paddingbytes and -// more IMPORTANTLY, add appropriate code in Save/LoadGameClock()! +// more IMPORTANTLY, add appropriate code in Save/LoadGameClock()! #define TIME_PADDINGBYTES 20 UINT8 gubUnusedTimePadding[TIME_PADDINGBYTES]; @@ -151,23 +151,23 @@ UINT32 GetWorldDay( ) UINT32 GetWorldDayInSeconds( ) { - return( guiDay * NUM_SEC_IN_DAY ); + return( guiDay * NUM_SEC_IN_DAY ); } UINT32 GetWorldDayInMinutes( ) { - return( ( guiDay * NUM_SEC_IN_DAY ) / NUM_SEC_IN_MIN ); + return( ( guiDay * NUM_SEC_IN_DAY ) / NUM_SEC_IN_MIN ); } UINT32 GetFutureDayInMinutes( UINT32 uiDay ) { - return( ( uiDay * NUM_SEC_IN_DAY ) / NUM_SEC_IN_MIN ); + return( ( uiDay * NUM_SEC_IN_DAY ) / NUM_SEC_IN_MIN ); } -//this function returns the amount of minutes there has been from start of game to midnight of the uiDay. +//this function returns the amount of minutes there has been from start of game to midnight of the uiDay. UINT32 GetMidnightOfFutureDayInMinutes( UINT32 uiDay ) { - return( GetWorldTotalMin() + ( uiDay * 1440 ) - GetWorldMinutesInDay( ) ); + return( GetWorldTotalMin() + ( uiDay * 1440 ) - GetWorldMinutesInDay( ) ); } // Not to be used too often by things other than internally @@ -208,14 +208,14 @@ void AdvanceClock( UINT8 ubWarpCode ) if( ubWarpCode != WARPTIME_NO_PROCESSING_OF_EVENTS ) { guiTimeOfLastEventQuery = guiGameClock; - //First of all, events are posted for movements, pending attacks, equipment arrivals, etc. This time - //adjustment using time compression can possibly pass one or more events in a single pass. So, this list + //First of all, events are posted for movements, pending attacks, equipment arrivals, etc. This time + //adjustment using time compression can possibly pass one or more events in a single pass. So, this list //is looked at and processed in sequential order, until the uiAdjustment is fully applied. if( GameEventsPending( guiGameSecondsPerRealSecond ) ) { //If a special event, justifying the cancellation of time compression is reached, the adjustment //will be shortened to the time of that event, and will stop processing events, otherwise, all - //of the events in the time slice will be processed. The time is adjusted internally as events + //of the events in the time slice will be processed. The time is adjusted internally as events //are processed. ProcessPendingGameEvents( guiGameSecondsPerRealSecond, ubWarpCode ); } @@ -265,9 +265,9 @@ void AdvanceClock( UINT8 ubWarpCode ) void AdvanceToNextDay() { - INT32 uiDiff; + INT32 uiDiff; UINT32 uiTomorrowTimeInSec; - + uiTomorrowTimeInSec = (guiDay+1)*NUM_SEC_IN_DAY + 8*NUM_SEC_IN_HOUR + 15*NUM_SEC_IN_MIN; uiDiff = uiTomorrowTimeInSec - guiGameClock; WarpGameTime( uiDiff, WARPTIME_PROCESS_EVENTS_NORMALLY ); @@ -294,7 +294,7 @@ void ResetTimeCompressHasOccured( void ) // has time compress occured? BOOLEAN HasTimeCompressOccured( void ) { - return( fTimeCompressHasOccured ); + return( fTimeCompressHasOccured ); } @@ -328,7 +328,7 @@ void RenderClock( INT16 sX, INT16 sY ) // Erase first! RestoreExternBackgroundRect(sX, sY, CLOCK_STRING_WIDTH, CLOCK_STRING_HEIGHT ); - + if( ( gfPauseDueToPlayerGamePause == FALSE ) ) { mprintf( sX + (CLOCK_STRING_WIDTH - StringPixLength( WORLDTIMESTR, CLOCK_FONT ))/2, sY, WORLDTIMESTR ); @@ -348,7 +348,7 @@ void ToggleSuperCompression() // Display message if ( gTacticalStatus.uiFlags & INCOMBAT ) { - //ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, L"Cannot toggle compression in Combat Mode." ); + //ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, L"Cannot toggle compression in Combat Mode." ); return; } @@ -360,16 +360,16 @@ void ToggleSuperCompression() giTimeCompressMode = TIME_SUPER_COMPRESS; guiGameSecondsPerRealSecond = giTimeCompressSpeeds[ giTimeCompressMode ] * SECONDS_PER_COMPRESSION; - //ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, L"Time compression ON." ); + //ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, L"Time compression ON." ); } else { giTimeCompressMode = uiOldTimeCompressMode; guiGameSecondsPerRealSecond = giTimeCompressSpeeds[ giTimeCompressMode ] * SECONDS_PER_COMPRESSION; - //ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, L"Time compression OFF." ); + //ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, L"Time compression OFF." ); } -} +} BOOLEAN DidGameJustStart() @@ -393,7 +393,7 @@ void StopTimeCompression( void ) void StartTimeCompression( void ) { - DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"StartTimeCompression"); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"StartTimeCompression"); if ( !gfTimeCompressionOn ) { @@ -645,7 +645,7 @@ BOOLEAN PauseStateLocked() void PauseGame() { - // always allow pausing, even if "locked". Locking applies only to trying to compress time, not to pausing it + // always allow pausing, even if "locked". Locking applies only to trying to compress time, not to pausing it if( !gfGamePaused ) { gfGamePaused = TRUE; @@ -702,9 +702,9 @@ void PauseTimeForInterupt() } //USING CLOCK RESOLUTION -//Note, that changing the clock resolution doesn't affect the amount of game time that passes per -//real second, but how many times per second the clock is updated. This rate will break up the actual -//time slices per second into smaller chunks. This is useful for animating strategic movement under +//Note, that changing the clock resolution doesn't effect the amount of game time that passes per +//real second, but how many times per second the clock is updated. This rate will break up the actual +//time slices per second into smaller chunks. This is useful for animating strategic movement under //fast time compression, so objects don't warp around. void SetClockResolutionToDefault() { @@ -726,11 +726,11 @@ UINT8 ClockResolution() //There are two factors that influence the flow of time in the game. -//-Speed: The speed is the amount of game time passes per real second of time. The higher this -// value, the faster the game time flows. -//-Resolution: The higher the resolution, the more often per second the clock is actually updated. -// This value doesn't affect how much game time passes per real second, but allows for -// a more accurate representation of faster time flows. +//-Speed: The speed is the amount of game time passes per real second of time. The higher this +// value, the faster the game time flows. +//-Resolution: The higher the resolution, the more often per second the clock is actually updated. +// This value doesn't affect how much game time passes per real second, but allows for +// a more accurate representation of faster time flows. void UpdateClock() { //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"UpdateClock"); @@ -788,7 +788,7 @@ void UpdateClock() #endif //Because we debug so much, breakpoints tend to break the game, and cause unnecessary headaches. - //This line ensures that no more than 1 real-second passes between frames. This otherwise has + //This line ensures that no more than 1 real-second passes between frames. This otherwise has //no effect on anything else. uiLastSecondTime = max( uiNewTime - 1000, uiLastSecondTime ); @@ -799,7 +799,7 @@ void UpdateClock() { uiLastSecondTime = uiNewTime; guiTimesThisSecondProcessed = uiLastTimeProcessed = 0; - AdvanceClock( WARPTIME_PROCESS_EVENTS_NORMALLY ); + AdvanceClock( WARPTIME_PROCESS_EVENTS_NORMALLY ); } else if( gubClockResolution > 1 ) { @@ -830,7 +830,7 @@ void UpdateClock() WarpGameTime( uiNewTimeProcessed - uiLastTimeProcessed, WARPTIME_PROCESS_EVENTS_NORMALLY ); if( uiNewTimeProcessed < guiGameSecondsPerRealSecond ) { //Processed the same real second - uiLastTimeProcessed = uiNewTimeProcessed; + uiLastTimeProcessed = uiNewTimeProcessed; } else { //We have moved into a new real second. @@ -1027,7 +1027,7 @@ BOOLEAN LoadGameClock( HWFILE hFile ) swprintf( WORLDTIMESTR, L"%s %d, %02d:%02d", pDayStrings[ 0 ], guiDay, guiHour, guiMin ); if( !gfBasement && !gfCaves ) - gfDoLighting = TRUE; + gfDoLighting = TRUE; return( TRUE ); } @@ -1039,8 +1039,8 @@ void CreateMouseRegionForPauseOfClock( INT16 sX, INT16 sY ) { // create a mouse region for pausing of game clock MSYS_DefineRegion( &gClockMouseRegion, (UINT16)( sX ), (UINT16)( sY ),(UINT16)( sX + CLOCK_REGION_WIDTH ), (UINT16)( sY + CLOCK_REGION_HEIGHT ), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, PauseOfClockBtnCallback ); - + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, PauseOfClockBtnCallback ); + fClockMouseRegionCreated = TRUE; if ( gfGamePaused == FALSE ) @@ -1071,7 +1071,7 @@ void PauseOfClockBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) { if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) { - HandlePlayerPauseUnPauseOfGame( ); + HandlePlayerPauseUnPauseOfGame( ); } } @@ -1139,13 +1139,13 @@ void CreateDestroyScreenMaskForPauseGame( void ) { // create a mouse region for pausing of game clock MSYS_DefineRegion( &gClockScreenMaskMouseRegion, 0, 0 ,SCREEN_WIDTH, SCREEN_HEIGHT , MSYS_PRIORITY_HIGHEST, - 0, MSYS_NO_CALLBACK, ScreenMaskForGamePauseBtnCallBack ); + 0, MSYS_NO_CALLBACK, ScreenMaskForGamePauseBtnCallBack ); fCreated = TRUE; // get region x and y values - sX = ( &gClockMouseRegion ) -> RegionTopLeftX; - sY = ( &gClockMouseRegion ) -> RegionTopLeftY; - + sX = ( &gClockMouseRegion )->RegionTopLeftX; + sY = ( &gClockMouseRegion )->RegionTopLeftY; + //re create region on top of this RemoveMouseRegionForPauseOfClock( ); CreateMouseRegionForPauseOfClock( sX, sY ); @@ -1176,7 +1176,7 @@ void RenderPausedGameBox( void ) if( ( gfPauseDueToPlayerGamePause == TRUE ) && ( gfGamePaused == TRUE ) && ( iPausedPopUpBox != -1 ) ) { RenderMercPopUpBoxFromIndex( iPausedPopUpBox, ( INT16 )( 320 - usPausedActualWidth / 2 ), ( INT16 )( 200 - usPausedActualHeight / 2 ), FRAME_BUFFER ); - InvalidateRegion( ( INT16 )( 320 - usPausedActualWidth / 2 ), ( INT16 )( 200 - usPausedActualHeight / 2 ), ( INT16 )( 320 - usPausedActualWidth / 2 + usPausedActualWidth ), ( INT16 )( 200 - usPausedActualHeight / 2 + usPausedActualHeight ) ); + InvalidateRegion( ( INT16 )( 320 - usPausedActualWidth / 2 ), ( INT16 )( 200 - usPausedActualHeight / 2 ), ( INT16 )( 320 - usPausedActualWidth / 2 + usPausedActualWidth ), ( INT16 )( 200 - usPausedActualHeight / 2 + usPausedActualHeight ) ); } // reset we've just finished a pause by the player @@ -1184,12 +1184,14 @@ void RenderPausedGameBox( void ) } BOOLEAN DayTime() -{ //between 7AM and 9PM +{ + //between 7AM and 9PM return ( guiHour >= 7 && guiHour < 21 ); } BOOLEAN NightTime() -{ //before 7AM or after 9PM +{ + //before 7AM or after 9PM return ( guiHour < 7 || guiHour >= 21 ); } @@ -1197,7 +1199,7 @@ BOOLEAN NightTime() void ClearTacticalStuffDueToTimeCompression( void ) { - // is this test the right thing? ARM + // is this test the right thing? ARM if ( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) { // clear tactical event queue diff --git a/Strategic/Game Clock.h b/Strategic/Game Clock.h index bfbc70ec..89d63822 100644 --- a/Strategic/Game Clock.h +++ b/Strategic/Game Clock.h @@ -24,16 +24,16 @@ //Kris: //This is the plan for game time... -//Game time should be restricted to outside code. Think of it as encapsulation. Anyway, using these -//simple functions, you will be able to change the amount of time that passes per frame. The gameloop will +//Game time should be restricted to outside code. Think of it as encapsulation. Anyway, using these +//simple functions, you will be able to change the amount of time that passes per frame. The gameloop will //automatically update the clock once per cycle, regardless of the mode you are in. //This does pose potential problems in modes such as the editor, or similar where time shouldn't pass, and -//isn't currently handled. The best thing to do in these cases is call the PauseGame() function when entering -//such a mode, and UnPauseGame() when finished. Everything will be restored just the way you left it. This -//is much simpler to handle in the overall scheme of things. +//isn't currently handled. The best thing to do in these cases is call the PauseGame() function when entering +//such a mode, and UnPauseGame() when finished. Everything will be restored just the way you left it. This +//is much simpler to handle in the overall scheme of things. //PAUSE FEATURES -//Pauses and unpauses the game. It sets and clears a flag which preserves the time rate. +//Pauses and unpauses the game. It sets and clears a flag which preserves the time rate. extern void PauseGame(); extern void UnPauseGame(); extern void TogglePause(); @@ -60,8 +60,8 @@ BOOLEAN IsTimeCompressionOn( void ); // returns TRUE if the player currently wa //USING TIME COMPRESSION //Allows the setting/changing/access of time rate via predefined compression values. //These functions change the index in giTimeCompressSpeeds which aren't in any -//particular mathematical pattern. The higher the index, the faster the time is processed -//per frame. These functions have their limits, so game time will also be between +//particular mathematical pattern. The higher the index, the faster the time is processed +//per frame. These functions have their limits, so game time will also be between //TIME_COMPRESS_X1 to TIME_COMPRESS_X8 based in the laptop time compression. void SetGameTimeCompressionLevel( UINT32 uiCompressionRate ); void DecreaseGameTimeCompressionRate(); @@ -69,10 +69,10 @@ void IncreaseGameTimeCompressionRate(); //USING CLOCK RESOLUTION //Note, that changing the clock resolution doesn't effect the amount of game time that passes per -//real second, but how many times per second the clock is updated. This rate will break up the actual -//time slices per second into smaller chunks. This is useful for animating strategic movement under +//real second, but how many times per second the clock is updated. This rate will break up the actual +//time slices per second into smaller chunks. This is useful for animating strategic movement under //fast time compression, so objects don't warp around. -void SetClockResolutionToDefault(); //1 time per second +void SetClockResolutionToDefault(); //1 time per second //Valid range is 1 - 60 times per second. void SetClockResolutionPerSecond( UINT8 ubNumTimesPerSecond ); //Function for accessing the current rate @@ -118,7 +118,7 @@ void WarpGameTime( UINT32 uiAdjustment, UINT8 ubWarpCode ); void AdvanceToNextDay(); -//This function is called once per cycle in the game loop. This determine how often the clock should be +//This function is called once per cycle in the game loop. This determine how often the clock should be //as well as how much to update the clock by. void UpdateClock(); @@ -129,14 +129,14 @@ extern UINT32 guiDay; extern UINT32 guiHour; extern UINT32 guiMin; -//Advanced function used by certain event callbacks. In the case where time is warped, certain event -//need to know how much time was warped since the last query to the event list. +//Advanced function used by certain event callbacks. In the case where time is warped, certain event +//need to know how much time was warped since the last query to the event list. //This function returns that value extern UINT32 guiTimeOfLastEventQuery; -//This value represents the time that the sector was loaded. If you are in sector A9, and leave -//the game clock at that moment will get saved into the temp file associated with it. The next time you -//enter A9, this value will contain that time. Used for scheduling purposes. +//This value represents the time that the sector was loaded. If you are in sector A9, and leave +//the game clock at that moment will get saved into the temp file associated with it. The next time you +//enter A9, this value will contain that time. Used for scheduling purposes. extern UINT32 guiTimeCurrentSectorWasLastLoaded; // is the current pause state due to the player? @@ -170,9 +170,9 @@ void RenderClock( INT16 sX, INT16 sY ); void ToggleSuperCompression(); -//IMPORTANT FUNCTION: Used whenever an event or situation is deemed important enough to cancel the -//further processing of time in this current time slice! This can only be used inside of event callback -//functions -- otherwise, it'll be ignored and automatically reset. An example of this would be when arriving +//IMPORTANT FUNCTION: Used whenever an event or situation is deemed important enough to cancel the +//further processing of time in this current time slice! This can only be used inside of event callback +//functions -- otherwise, it'll be ignored and automatically reset. An example of this would be when arriving //in a new sector and being prompted to attack or retreat. void InterruptTime(); void PauseTimeForInterupt(); diff --git a/Strategic/Game Event Hook.cpp b/Strategic/Game Event Hook.cpp index e17e2122..0ab7a241 100644 --- a/Strategic/Game Event Hook.cpp +++ b/Strategic/Game Event Hook.cpp @@ -8,7 +8,7 @@ #include "environment.h" #include "Ambient Control.h" #include "Quests.h" - #include "Sound Control.h" +// #include "Sound Control.h" #include "AimMembers.h" #include "Strategic Event Handler.h" #include "BobbyR.h" @@ -22,7 +22,7 @@ #include "Assignments.h" #include "Strategic Mines.h" #include "Strategic Town Loyalty.h" - #include "Message.h" + #include "Message.h" #include "Map Screen Interface.h" #include "Map Screen Helicopter.h" #include "Scheduling.h" @@ -82,14 +82,14 @@ BOOLEAN DelayEventIfBattleInProgress( STRATEGICEVENT *pEvent ) BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent ) { - BOOLEAN bMercDayOne = FALSE; + BOOLEAN bMercDayOne = FALSE; // Kaiden: Opening the INI File CIniReader iniReader("..\\Ja2_Options.ini"); //Kaiden: Getting Value for MERC Available on Day one? // for some reason, this can't be in gamesettings.cpp - // or it won't work. + // or it won't work. bMercDayOne = iniReader.ReadBoolean("Options","MERC_DAY_ONE",FALSE); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"ExecuteStrategicEvent"); @@ -99,7 +99,7 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent ) ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Strategic event skipped!" ); return TRUE; } - + BOOLEAN fOrigPreventFlag; fOrigPreventFlag = gfPreventDeletionOfAnyEvent; @@ -135,7 +135,7 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent ) if( gfMercsNeverQuit ) { if( pEvent->ubCallbackID == EVENT_MERC_ABOUT_TO_LEAVE_COMMENT || - pEvent->ubCallbackID == EVENT_MERC_CONTRACT_OVER ) + pEvent->ubCallbackID == EVENT_MERC_CONTRACT_OVER ) { gfPreventDeletionOfAnyEvent = fOrigPreventFlag; return FALSE; @@ -151,7 +151,7 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent ) // Change light to value gubEnvLightValue = (UINT8)pEvent->uiParam; if( !gfBasement && !gfCaves ) - gfDoLighting = TRUE; + gfDoLighting = TRUE; break; case EVENT_CHECKFORQUESTS: CheckForQuests( GetWorldDay() ); @@ -180,7 +180,7 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent ) case EVENT_BOBBYRAY_PURCHASE: BobbyRayPurchaseEventCallback( (UINT8) pEvent->uiParam); break; - //Gets called once a day ( at BOBBYRAY_UPDATE_TIME). To simulate the items being bought and sold at bobby rays + //Gets called once a day ( at BOBBYRAY_UPDATE_TIME). To simulate the items being bought and sold at bobby rays case EVENT_DAILY_UPDATE_BOBBY_RAY_INVENTORY: DailyUpdateOfBobbyRaysNewInventory(); DailyUpdateOfBobbyRaysUsedInventory(); @@ -195,7 +195,7 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent ) case EVENT_DAILY_UPDATE_OF_MERC_SITE: DailyUpdateOfMercSite( (UINT16)GetWorldDay() ); break; - case EVENT_DAY3_ADD_EMAIL_FROM_SPECK: + case EVENT_DAY3_ADD_EMAIL_FROM_SPECK: if(!bMercDayOne) { AddEmail(MERC_INTRO, MERC_INTRO_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin( ), -1 ); @@ -205,7 +205,7 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent ) AddEmail(IMP_EMAIL_PROFILE_RESULTS, IMP_EMAIL_PROFILE_RESULTS_LENGTH, IMP_PROFILE_RESULTS, GetWorldTotalMin( ), -1 ); break; //If a merc gets hired and they dont show up immediately, the merc gets added to the queue and shows up - // uiTimeTillMercArrives minutes later + // uiTimeTillMercArrives minutes later case EVENT_DELAYED_HIRING_OF_MERC: MercArrivesCallback( (UINT8) pEvent->uiParam ); break; @@ -296,7 +296,7 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent ) break; case EVENT_DAILY_EARLY_MORNING_EVENTS: HandleEarlyMorningEvents(); - break; + break; case EVENT_GROUP_ABOUT_TO_ARRIVE: HandleGroupAboutToArrive(); break; @@ -311,8 +311,8 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent ) break; case EVENT_RAINSTORM: - // ATE: Disabled - //rain + // ATE: Disabled + //rain if( pEvent->ubEventType == ENDRANGED_EVENT ) { EnvEndRainStorm( ); @@ -453,14 +453,14 @@ void CrippledVersionEndGameCheck() if( guiDay >= 8 ) { - swprintf( zString, L"Game Over. We hope you have enjoyed playing the limited version of Jagged Alliance 2." ); + swprintf( zString, L"Game Over. We hope you have enjoyed playing the limited version of Jagged Alliance 2." ); } else { - swprintf( zString, L"You have %d game days left in this limited version of Jagged Alliance 2.", ( 8 - guiDay ) ); + swprintf( zString, L"You have %d game days left in this limited version of Jagged Alliance 2.", ( 8 - guiDay ) ); } - DoScreenIndependantMessageBox( zString, MSG_BOX_FLAG_OK, CrippledVersionEndGameCheckCallBack ); + DoScreenIndependantMessageBox( zString, MSG_BOX_FLAG_OK, CrippledVersionEndGameCheckCallBack ); } void CrippledVersionEndGameCheckCallBack( UINT8 bExitValue ) @@ -486,3 +486,4 @@ void CrippledVersionEndGameCheckCallBack( UINT8 bExitValue ) #endif + diff --git a/Strategic/Game Event Hook.h b/Strategic/Game Event Hook.h index 4bd6afcd..1ee15559 100644 --- a/Strategic/Game Event Hook.h +++ b/Strategic/Game Event Hook.h @@ -47,7 +47,7 @@ enum EVENT_SETUP_TOWN_OPINION, EVENT_MAKE_CIV_GROUP_HOSTILE_ON_NEXT_SECTOR_ENTRANCE, EVENT_BEGIN_AIR_RAID, - EVENT_TOWN_LOYALTY_UPDATE, /* Delayed loyalty effects elimininated. Sep.12/98. ARM */ + EVENT_TOWN_LOYALTY_UPDATE, /* Delayed loyalty effects elimininated. Sep.12/98. ARM */ EVENT_MEANWHILE, EVENT_BEGIN_CREATURE_QUEST, EVENT_CREATURE_SPREAD, @@ -80,7 +80,7 @@ enum EVENT_RPC_WHINE_ABOUT_PAY, EVENT_HAVENT_MADE_IMP_CHARACTER_EMAIL, EVENT_RAINSTORM, - EVENT_QUARTER_HOUR_UPDATE, + EVENT_QUARTER_HOUR_UPDATE, EVENT_MERC_MERC_WENT_UP_LEVEL_EMAIL_DELAY, EVENT_MERC_SITE_NEW_MERC_AVAILABLE, // EVENT_CHECK_FOR_AIR_RAID, @@ -89,14 +89,14 @@ enum EVENT_CRIPPLED_VERSION_END_GAME_CHECK, #endif /* - HEY, YOU GUYS AREN'T DOING THIS!!!!!! (see below) + HEY, YOU GUYS AREN'T DOING THIS!!!!!! (see below) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! IMPORTANT NOTE !! - !! FOR ALL NEW EVENTS: For text debug support, make sure you add the text version of the !! - !! new event into the gEventName[] at the top of Game Events.c. !! + !! IMPORTANT NOTE !! + !! FOR ALL NEW EVENTS: For text debug support, make sure you add the text version of the !! + !! new event into the gEventName[] at the top of Game Events.c. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ @@ -110,7 +110,7 @@ enum //One Time Events //These events are scheduled to happen, and when their time is up, they are processed -//once, and deleted. The first prototype requires the actual world time in minutes +//once, and deleted. The first prototype requires the actual world time in minutes //included the current day, and the additional ones are wrappers which calculate the //actual world time for you. BOOLEAN AddStrategicEvent( UINT8 ubCallbackID, UINT32 uiMinStamp, UINT32 uiParam ); @@ -123,11 +123,11 @@ BOOLEAN AddFutureDayStrategicEventUsingSeconds( UINT8 ubCallbackID, UINT32 uiSec //Ranged Events //In certain cases, you may wish to create an event that has a start time and an end -//time. If this is used, then the execution of the event will happen once at the -//beginning of the event and once at the expiration time of the event. A flag, -//pEvent->fEndEvent is set for the second call. It is up to you process it -//separately. An example use of ranged events would be for ambient sounds. The -//start time would be called to define the sounds for use within the game. The end +//time. If this is used, then the execution of the event will happen once at the +//beginning of the event and once at the expiration time of the event. A flag, +//pEvent->fEndEvent is set for the second call. It is up to you process it +//separately. An example use of ranged events would be for ambient sounds. The +//start time would be called to define the sounds for use within the game. The end //time would be used to remove the sound from the system. BOOLEAN AddRangedStrategicEvent( UINT8 ubCallbackID, UINT32 uiStartMin, UINT32 uiLengthMin, UINT32 uiParam ); BOOLEAN AddSameDayRangedStrategicEvent( UINT8 ubCallbackID, UINT32 uiStartMin, UINT32 uiLengthMin, UINT32 uiParam); @@ -138,23 +138,23 @@ BOOLEAN AddFutureDayRangedStrategicEventUsingSeconds( UINT8 ubCallbackID, UINT32 //EveryDay Events //A second special case event, this event will get processed automatically at the -//same time every day. Time of day lighting is a perfect example. Other events -//such as checking for quests, can also be automated using this system. NOTE: +//same time every day. Time of day lighting is a perfect example. Other events +//such as checking for quests, can also be automated using this system. NOTE: //Only specify the time of day in minutes (don't add the actual day to this value) BOOLEAN AddEveryDayStrategicEvent( UINT8 ubCallbackID, UINT32 uiStartMin, UINT32 uiParam ); BOOLEAN AddEveryDayStrategicEventUsingSeconds( UINT8 ubCallbackID, UINT32 uiStartSeconds, UINT32 uiParam ); //Periodic Events -//Event will get processed automatically once every X minutes. The period is added to the current time for -//the time stamp. +//Event will get processed automatically once every X minutes. The period is added to the current time for +//the time stamp. BOOLEAN AddPeriodStrategicEvent( UINT8 ubCallbackID, UINT32 uiOnceEveryXMinutes, UINT32 uiParam ); BOOLEAN AddPeriodStrategicEventUsingSeconds( UINT8 ubCallbackID, UINT32 uiOnceEveryXSeconds, UINT32 uiParam ); -//Hybrids that aren't based from the current time. They are offsetted from the current time first. +//Hybrids that aren't based from the current time. They are offsetted from the current time first. BOOLEAN AddPeriodStrategicEventWithOffset( UINT8 ubCallbackID, UINT32 uiOnceEveryXMinutes, UINT32 uiOffsetFromCurrent, UINT32 uiParam ); BOOLEAN AddPeriodStrategicEventUsingSecondsWithOffset( UINT8 ubCallbackID, UINT32 uiOnceEveryXSeconds, UINT32 uiOffsetFromCurrent, UINT32 uiParam ); -//Searches for and removes the first event matching the supplied information. There may very well be a need -//for more specific event removal, so let me know (Kris), of any support needs. Function returns FALSE if +//Searches for and removes the first event matching the supplied information. There may very well be a need +//for more specific event removal, so let me know (Kris), of any support needs. Function returns FALSE if //no events were found. BOOLEAN DeleteStrategicEvent( UINT8 ubCallbackID, UINT32 uiParam ); void DeleteAllStrategicEventsOfType( UINT8 ubCallbackID ); diff --git a/Strategic/Game Events.cpp b/Strategic/Game Events.cpp index 419ff4ca..4f77960f 100644 --- a/Strategic/Game Events.cpp +++ b/Strategic/Game Events.cpp @@ -14,7 +14,7 @@ #endif #ifdef JA2TESTVERSION - + CHAR16 gEventName[NUMBER_OF_EVENT_TYPES_PLUS_ONE][40]={ //1234567890123456789012345678901234567890 (increase size of array if necessary) L"Null", @@ -231,11 +231,11 @@ void ProcessPendingGameEvents( UINT32 uiAdjustment, UINT8 ubWarpCode ) curr = gpEventList; prev = NULL; //prev only used when warping time to target time. while( !gfTimeInterrupt && curr && curr->uiTimeStamp <= guiGameClock + uiAdjustment ) - { + { fDeleteEvent = FALSE; //Update the time by the difference, but ONLY if the event comes after the current time. //In the beginning of the game, series of events are created that are placed in the list - //BEFORE the start time. Those events will be processed without influencing the actual time. + //BEFORE the start time. Those events will be processed without influencing the actual time. if( curr->uiTimeStamp > guiGameClock && ubWarpCode != WARPTIME_PROCESS_TARGET_TIME_FIRST ) { AdjustClockToEventStamp( curr, &uiAdjustment ); @@ -252,7 +252,7 @@ void ProcessPendingGameEvents( UINT32 uiAdjustment, UINT8 ubWarpCode ) AdjustClockToEventStamp( curr, &uiAdjustment ); fDeleteEvent = ExecuteStrategicEvent( curr ); - + if( curr && prev && fDeleteQueuedEvent ) { //The only case where we are deleting a node in the middle of the list prev->next = curr->next; @@ -260,15 +260,15 @@ void ProcessPendingGameEvents( UINT32 uiAdjustment, UINT8 ubWarpCode ) } else { //We are at the current target warp time however, there are still other events following in this time cycle. - //We will only target the final event in this time. NOTE: Events are posted using a FIFO method + //We will only target the final event in this time. NOTE: Events are posted using a FIFO method prev = curr; curr = curr->next; continue; } } else - { //We are warping time to the target time. We haven't found the event yet, - //so continuing will keep processing the list until we find it. NOTE: Events are posted using a FIFO method + { //We are warping time to the target time. We haven't found the event yet, + //so continuing will keep processing the list until we find it. NOTE: Events are posted using a FIFO method prev = curr; curr = curr->next; continue; @@ -298,7 +298,7 @@ void ProcessPendingGameEvents( UINT32 uiAdjustment, UINT8 ubWarpCode ) prev = NULL; //ValidateGameEvents(); } - else + else { temp = curr; prev->next = curr->next; @@ -313,7 +313,7 @@ void ProcessPendingGameEvents( UINT32 uiAdjustment, UINT8 ubWarpCode ) curr = curr->next; } } - + gfProcessingGameEvents = FALSE; if( gfEventDeletionPending ) @@ -362,11 +362,11 @@ STRATEGICEVENT* AddAdvancedStrategicEvent( UINT8 ubEventType, UINT8 ubCallbackID #ifdef JA2TESTVERSION //if( ubCallbackID == EVENT_PROCESS_TACTICAL_SCHEDULE ) { - ScreenMsg( FONT_RED, MSG_DEBUG, L"%s Event Rejected: Can't post events <= time while inside an event callback. This is a special case situation that isn't a bug.", gEventName[ ubCallbackID ] ); + ScreenMsg( FONT_RED, MSG_DEBUG, L"%s Event Rejected: Can't post events <= time while inside an event callback. This is a special case situation that isn't a bug.", gEventName[ ubCallbackID ] ); } //else //{ - // AssertMsg( 0, String( "%S Event Rejected: Can't post events <= time while inside an event callback.", gEventName[ ubCallbackID ] ) ); + // AssertMsg( 0, String( "%S Event Rejected: Can't post events <= time while inside an event callback.", gEventName[ ubCallbackID ] ) ); //} #endif return NULL; @@ -407,7 +407,7 @@ STRATEGICEVENT* AddAdvancedStrategicEvent( UINT8 ubEventType, UINT8 ubCallbackID if ( !pNode ) { pPrevNode->next = pNewNode; - pNewNode->next = NULL; + pNewNode->next = NULL; } else { @@ -443,7 +443,7 @@ BOOLEAN AddStrategicEventUsingSeconds( UINT8 ubCallbackID, UINT32 uiSecondStamp, return FALSE; } - + BOOLEAN AddRangedStrategicEvent( UINT8 ubCallbackID, UINT32 uiStartMin, UINT32 uiLengthMin, UINT32 uiParam ) { STRATEGICEVENT *pEvent; @@ -502,7 +502,7 @@ BOOLEAN AddEveryDayStrategicEventUsingSeconds( UINT8 ubCallbackID, UINT32 uiStar return FALSE; } -//NEW: Period Events +//NEW: Period Events //Event will get processed automatically once every X minutes. BOOLEAN AddPeriodStrategicEvent( UINT8 ubCallbackID, UINT32 uiOnceEveryXMinutes, UINT32 uiParam ) { @@ -574,7 +574,7 @@ void DeleteAllStrategicEventsOfType( UINT8 ubCallbackID ) prev->next = curr->next; else gpEventList = curr->next; - + //isolate and remove curr temp = curr; curr = curr->next; @@ -603,8 +603,8 @@ void DeleteAllStrategicEvents() gpEventList = NULL; } -//Searches for and removes the first event matching the supplied information. There may very well be a need -//for more specific event removal, so let me know (Kris), of any support needs. Function returns FALSE if +//Searches for and removes the first event matching the supplied information. There may very well be a need +//for more specific event removal, so let me know (Kris), of any support needs. Function returns FALSE if //no events were found or if the event wasn't deleted due to delete lock, BOOLEAN DeleteStrategicEvent( UINT8 ubCallbackID, UINT32 uiParam ) { @@ -652,7 +652,7 @@ BOOLEAN SaveStrategicEventsToSavedGame( HWFILE hFile ) UINT32 uiNumGameEvents=0; STRATEGICEVENT *pTempEvent = gpEventList; - + //Go through the list and determine the number of events while( pTempEvent ) { @@ -686,7 +686,7 @@ BOOLEAN SaveStrategicEventsToSavedGame( HWFILE hFile ) pTempEvent = pTempEvent->next; } - + return( TRUE ); } @@ -703,7 +703,7 @@ BOOLEAN LoadStrategicEventsFromSavedGame( HWFILE hFile ) //erase the old Game Event queue DeleteAllStrategicEvents(); - + //Read the number of strategic events FileRead( hFile, &uiNumGameEvents, sizeof( UINT32 ), &uiNumBytesRead ); if( uiNumBytesRead != sizeof( UINT32 ) ) @@ -736,7 +736,7 @@ BOOLEAN LoadStrategicEventsFromSavedGame( HWFILE hFile ) // Add the new node to the list - //if its the first node, + //if its the first node, if( cnt == 0 ) { // assign it as the head node @@ -783,4 +783,4 @@ void ValidateGameEvents() return; } } -} \ No newline at end of file +} diff --git a/Strategic/Game Events.h b/Strategic/Game Events.h index bd4ee074..ff293b96 100644 --- a/Strategic/Game Events.h +++ b/Strategic/Game Events.h @@ -9,7 +9,7 @@ typedef struct STRATEGICEVENT { - struct STRATEGICEVENT *next; + struct STRATEGICEVENT *next; UINT32 uiTimeStamp; UINT32 uiParam; UINT32 uiTimeOffset; diff --git a/Strategic/Game Init.cpp b/Strategic/Game Init.cpp index e159d375..352deba8 100644 --- a/Strategic/Game Init.cpp +++ b/Strategic/Game Init.cpp @@ -11,7 +11,7 @@ #include "Soldier Control.h" #include "overhead.h" #include "fade screen.h" - #include "gamescreen.h" + #include "gamescreen.h" #include "email.h" #include "Game Clock.h" #include "soldier profile.h" @@ -60,8 +60,13 @@ #include "Air Raid.h" #include "Interface.h" #include "cheats.h" + #include "Interface Panels.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + // Temp function void QuickSetupOfMercProfileItems( UINT32 uiCount, UINT8 ubProfileIndex ); BOOLEAN QuickGameMemberHireMerc( UINT8 ubCurrentSoldier ); @@ -130,7 +135,7 @@ void InitNPCs( void ) SectorInfo[ SECTOR( 4, MAP_ROW_E ) ].uiFlags |= SF_USE_ALTERNATE_MAP; break; } - + // add Micky in random location pProfile = &(gMercProfiles[MICKY]); @@ -170,10 +175,10 @@ void InitNPCs( void ) // use alternate map in this sector //SectorInfo[ SECTOR( pProfile->sSectorX, pProfile->sSectorY ) ].uiFlags |= SF_USE_ALTERNATE_MAP; - gfPlayerTeamSawJoey = FALSE; + gfPlayerTeamSawJoey = FALSE; - if ( gGameOptions.ubGameStyle == STYLE_SCIFI && gGameExternalOptions.fEnableCrepitus ) + if ( gGameOptions.ubGameStyle == STYLE_SCIFI && gGameExternalOptions.fEnableCrepitus ) { // add Bob pProfile = &(gMercProfiles[BOB]); @@ -226,9 +231,9 @@ void InitNPCs( void ) void InitBloodCatSectors() { INT32 i; - //Hard coded table of bloodcat populations. We don't have - //access to the real population (if different) until we physically - //load the map. If the real population is different, then an error + //Hard coded table of bloodcat populations. We don't have + //access to the real population (if different) until we physically + //load the map. If the real population is different, then an error //will be reported. for( i = 0; i < 255; i++ ) { @@ -374,6 +379,24 @@ BOOLEAN InitNewGame( BOOLEAN fReset ) // Reset the selected soldier gusSelectedSoldier = NOBODY; + // CHRISL: Init inventory + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"InitNewGame: set initial inventory coords"); + if( gubScreenCount == 0 ) + { + if((UsingNewInventorySystem() == true)) + { + InitNewInventorySystem(); + InitializeSMPanelCoordsNew(); + InitializeInvPanelCoordsNew(); + } + else + { + InitOldInventorySystem(); + InitializeSMPanelCoordsOld(); + InitializeInvPanelCoordsOld(); + } + } + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"InitNewGame: loading merc profiles"); if( gubScreenCount == 0 ) { @@ -391,7 +414,7 @@ BOOLEAN InitNewGame( BOOLEAN fReset ) } DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"InitNewGame: clearing messages"); - // clear tactical + // clear tactical ClearTacticalMessageQueue( ); // clear mapscreen messages @@ -413,11 +436,11 @@ BOOLEAN InitNewGame( BOOLEAN fReset ) ResetHeliSeats( ); // Setup two new messages! - AddPreReadEmail(OLD_ENRICO_1,OLD_ENRICO_1_LENGTH,MAIL_ENRICO, GetWorldTotalMin() ); - AddPreReadEmail(OLD_ENRICO_2,OLD_ENRICO_2_LENGTH,MAIL_ENRICO, GetWorldTotalMin() ); - AddPreReadEmail(RIS_REPORT,RIS_REPORT_LENGTH,RIS_EMAIL, GetWorldTotalMin() ); - AddPreReadEmail(OLD_ENRICO_3,OLD_ENRICO_3_LENGTH,MAIL_ENRICO, GetWorldTotalMin() ); - AddEmail(IMP_EMAIL_INTRO,IMP_EMAIL_INTRO_LENGTH,CHAR_PROFILE_SITE, GetWorldTotalMin(), -1); + AddPreReadEmail(OLD_ENRICO_1,OLD_ENRICO_1_LENGTH,MAIL_ENRICO, GetWorldTotalMin() ); + AddPreReadEmail(OLD_ENRICO_2,OLD_ENRICO_2_LENGTH,MAIL_ENRICO, GetWorldTotalMin() ); + AddPreReadEmail(RIS_REPORT,RIS_REPORT_LENGTH,RIS_EMAIL, GetWorldTotalMin() ); + AddPreReadEmail(OLD_ENRICO_3,OLD_ENRICO_3_LENGTH,MAIL_ENRICO, GetWorldTotalMin() ); + AddEmail(IMP_EMAIL_INTRO,IMP_EMAIL_INTRO_LENGTH,CHAR_PROFILE_SITE, GetWorldTotalMin(), -1); //AddEmail(ENRICO_CONGRATS,ENRICO_CONGRATS_LENGTH,MAIL_ENRICO, GetWorldTotalMin() ); if(gGameExternalOptions.fMercDayOne) { @@ -449,7 +472,7 @@ BOOLEAN InitNewGame( BOOLEAN fReset ) case DIF_LEVEL_INSANE: - iStartingCash = gGameExternalOptions.iStartingCashInsane; + iStartingCash = gGameExternalOptions.iStartingCashInsane; // iStartingCash = 15000; break; @@ -481,7 +504,7 @@ BOOLEAN InitNewGame( BOOLEAN fReset ) } } - //Add an event to check for the end of the crippled version + //Add an event to check for the end of the crippled version AddEveryDayStrategicEvent( EVENT_CRIPPLED_VERSION_END_GAME_CHECK, 0, 0 ); #endif @@ -518,7 +541,7 @@ BOOLEAN InitNewGame( BOOLEAN fReset ) /* if ( gubScreenCount == 2 ) { - + if ( !SetCurrentWorldSector( 9, 1, 0 ) ) { @@ -531,12 +554,12 @@ BOOLEAN InitNewGame( BOOLEAN fReset ) EnterTacticalScreen( ); if( gfAtLeastOneMercWasHired == TRUE ) - { + { gubScreenCount = 3; } else { - + } return( TRUE ); @@ -553,16 +576,16 @@ BOOLEAN AnyMercsHired( ) { INT32 cnt; SOLDIERTYPE *pTeamSoldier; - INT16 bLastTeamID; + INT16 bLastTeamID; // Find first guy availible in team cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - // look for all mercs on the same team, - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pTeamSoldier++) - { + // look for all mercs on the same team, + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pTeamSoldier++) + { if ( pTeamSoldier->bActive ) { return( TRUE ); @@ -571,7 +594,7 @@ BOOLEAN AnyMercsHired( ) return( FALSE ); } - + void QuickStartGame( ) { @@ -604,7 +627,7 @@ void QuickStartGame( ) do { usVal = (UINT16)Random( 40 ); - } + } while( usVal != ub1 && usVal != ub2 ); QuickSetupOfMercProfileItems( cnt, (UINT8)usVal ); @@ -619,7 +642,7 @@ void QuickStartGame( ) void QuickSetupOfMercProfileItems( UINT32 uiCount, UINT8 ubProfileIndex ) { // Quickly give some guys we hire some items - + if ( uiCount == 0 ) { //CreateGun( GLOCK_17, &(pSoldier->inv[ HANDPOS ] ) ); @@ -655,7 +678,7 @@ void QuickSetupOfMercProfileItems( UINT32 uiCount, UINT8 ubProfileIndex ) // TEMP! // make carman's opinion of us high! - gMercProfiles[ 78 ].bMercOpinion[ ubProfileIndex ] = 25; + gMercProfiles[ 78 ].bMercOpinion[ ubProfileIndex ] = 25; } else if ( uiCount == 1 ) @@ -721,7 +744,7 @@ void QuickSetupOfMercProfileItems( UINT32 uiCount, UINT8 ubProfileIndex ) gMercProfiles[ ubProfileIndex ].inv[ BIGPOCK2POS ] = RDX; gMercProfiles[ ubProfileIndex ].bInvStatus[ BIGPOCK2POS ] = 10; gMercProfiles[ ubProfileIndex ].bInvNumber[ BIGPOCK2POS ] = 1; - + gMercProfiles[ ubProfileIndex ].inv[ SMALLPOCK4POS ] = HAND_GRENADE; gMercProfiles[ ubProfileIndex ].bInvStatus[ SMALLPOCK4POS ] = 100; gMercProfiles[ ubProfileIndex ].bInvNumber[ SMALLPOCK4POS ] = 4; @@ -759,10 +782,10 @@ BOOLEAN QuickGameMemberHireMerc( UINT8 ubCurrentSoldier ) { return(FALSE); } - + //add an entry in the finacial page for the hiring of the merc AddTransactionToPlayersBook(HIRED_MERC, ubCurrentSoldier, GetWorldTotalMin(), -(INT32) gMercProfiles[ubCurrentSoldier].uiWeeklySalary ); - + if( gMercProfiles[ ubCurrentSoldier ].bMedicalDeposit ) { //add an entry in the finacial page for the medical deposit @@ -778,7 +801,7 @@ BOOLEAN QuickGameMemberHireMerc( UINT8 ubCurrentSoldier ) -//This function is called when the game is REstarted. Things that need to be reinited are placed in here +//This function is called when the game is REstarted. Things that need to be reinited are placed in here void ReStartingGame() { UINT16 cnt; @@ -800,7 +823,7 @@ void ReStartingGame() //Loop through all the soldier and delete them all for( cnt=0; cnt< TOTAL_SOLDIERS; cnt++) - { + { TacticalRemoveSoldier( cnt ); } @@ -834,7 +857,7 @@ void ReStartingGame() if ( InAirRaid( ) ) { EndAirRaid( ); - } + } #ifdef JA2TESTVERSION //Reset so we can use the 'cheat key' to start with mercs diff --git a/Strategic/Game Init.h b/Strategic/Game Init.h index 20b1d773..30200de5 100644 --- a/Strategic/Game Init.h +++ b/Strategic/Game Init.h @@ -2,7 +2,7 @@ #define __GAME_INIT_H -BOOLEAN InitNewGame( BOOLEAN fReset ); +BOOLEAN InitNewGame( BOOLEAN fReset ); BOOLEAN AnyMercsHired( ); void QuickStartGame( ); diff --git a/Strategic/Hourly Update.cpp b/Strategic/Hourly Update.cpp index 9cd25363..d277258a 100644 --- a/Strategic/Hourly Update.cpp +++ b/Strategic/Hourly Update.cpp @@ -43,7 +43,7 @@ void HandleHourlyUpdate() if ( DidGameJustStart() ) return; - // hourly update of town loyalty + // hourly update of town loyalty HandleTownLoyalty(); // hourly update of team assignments @@ -83,7 +83,7 @@ void HandleHourlyUpdate() void UpdateRegenCounters( void ) { UINT8 ubID; - + for ( ubID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; ubID <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubID++ ) { if ( MercPtrs[ ubID ]->bRegenBoostersUsedToday > 0 ) @@ -99,7 +99,7 @@ void HandleQuarterHourUpdate() if ( DidGameJustStart() ) return; - DecayTacticalMoraleModifiers( ); + DecayTacticalMoraleModifiers( ); } @@ -107,7 +107,7 @@ void HourlyQuestUpdate( void ) { UINT32 uiHour = GetWorldHour(); - // brothel + // brothel if ( uiHour == 4 ) { SetFactFalse( FACT_BROTHEL_OPEN ); @@ -124,7 +124,7 @@ void HourlyQuestUpdate( void ) SetFactTrue( FACT_CLUB_OPEN ); SetFactFalse( FACT_PAST_CLUB_CLOSING_AND_PLAYER_WARNED ); - + // reset boxes fought for ( ubLoop = 0; ubLoop < NUM_BOXERS; ubLoop++ ) { @@ -168,9 +168,9 @@ UINT16 LarryItems[ NUM_LARRY_ITEMS ][ 3 ] = { // item, temptation, points to use { ADRENALINE_BOOSTER, 5, 100 }, - { ALCOHOL, BAR_TEMPTATION, 25 }, - { MEDICKIT, 4, 10 }, - { WINE, 3, 50 }, + { ALCOHOL, BAR_TEMPTATION, 25 }, + { MEDICKIT, 4, 10 }, + { WINE, 3, 50 }, { REGEN_BOOSTER, 3, 100 }, { BEER, 2, 100 }, }; @@ -197,7 +197,7 @@ void HourlyLarryUpdate( void ) { return; } - if ( pSoldier->fBetweenSectors ) + if ( pSoldier->flags.fBetweenSectors ) { return; } @@ -217,17 +217,17 @@ void HourlyLarryUpdate( void ) } } - // check to see if we're in a bar sector, if we are, we have access to alcohol + // check to see if we're in a bar sector, if we are, we have access to alcohol // which may be better than anything we've got... if ( usTemptation < BAR_TEMPTATION && GetCurrentBalance() >= Item[ ALCOHOL ].usPrice ) { - if ( pSoldier->bSectorZ == 0 && + if ( pSoldier->bSectorZ == 0 && ( ( pSoldier->sSectorX == 13 && pSoldier->sSectorY == MAP_ROW_B) || ( pSoldier->sSectorX == 13 && pSoldier->sSectorY == MAP_ROW_C) || ( pSoldier->sSectorX == 5 && pSoldier->sSectorY == MAP_ROW_C) || ( pSoldier->sSectorX == 6 && pSoldier->sSectorY == MAP_ROW_C) || ( pSoldier->sSectorX == 5 && pSoldier->sSectorY == MAP_ROW_D) || - ( pSoldier->sSectorX == 2 && pSoldier->sSectorY == MAP_ROW_H) + ( pSoldier->sSectorX == 2 && pSoldier->sSectorY == MAP_ROW_H) ) ) { @@ -235,10 +235,10 @@ void HourlyLarryUpdate( void ) fBar = TRUE; usTemptation = BAR_TEMPTATION; } - } + } if ( usTemptation > 0 ) - { + { if ( pSoldier->ubProfile == LARRY_NORMAL ) { gMercProfiles[ LARRY_NORMAL ].bNPCData += (INT8) Random( usTemptation ); @@ -250,7 +250,8 @@ void HourlyLarryUpdate( void ) usCashAmount = Item[ ALCOHOL ].usPrice; AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, pSoldier->ubProfile, GetWorldTotalMin() , -( usCashAmount ) ); // give Larry some booze and set slot etc values appropriately - bBoozeSlot = FindEmptySlotWithin( pSoldier, HANDPOS, SMALLPOCK8POS ); + // CHRISL: Change final parameter to allow dynamic control of inventory slots + bBoozeSlot = FindEmptySlotWithin( pSoldier, HANDPOS, NUM_INV_SLOTS ); if ( bBoozeSlot != NO_SLOT ) { // give Larry booze here @@ -281,7 +282,8 @@ void HourlyLarryUpdate( void ) usCashAmount = Item[ ALCOHOL ].usPrice; AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, pSoldier->ubProfile, GetWorldTotalMin() , -( usCashAmount ) ); // give Larry some booze and set slot etc values appropriately - bBoozeSlot = FindEmptySlotWithin( pSoldier, HANDPOS, SMALLPOCK8POS ); + // CHRISL: Change final parameter to allow dynamic control of inventory slots + bBoozeSlot = FindEmptySlotWithin( pSoldier, HANDPOS, NUM_INV_SLOTS ); if ( bBoozeSlot != NO_SLOT ) { // give Larry booze here @@ -308,7 +310,7 @@ void HourlyLarryUpdate( void ) } } - + } void HourlyCheckIfSlayAloneSoHeCanLeave() @@ -319,11 +321,11 @@ void HourlyCheckIfSlayAloneSoHeCanLeave() { return; } - if( pSoldier->fBetweenSectors ) + if( pSoldier->flags.fBetweenSectors ) { return; } - if( !pSoldier->bActive || !pSoldier->bLife ) + if( !pSoldier->bActive || !pSoldier->stats.bLife ) { return; } diff --git a/Strategic/Map Screen Helicopter.cpp b/Strategic/Map Screen Helicopter.cpp index 3b8ca1ef..935a297c 100644 --- a/Strategic/Map Screen Helicopter.cpp +++ b/Strategic/Map Screen Helicopter.cpp @@ -1,43 +1,43 @@ #ifdef PRECOMPILEDHEADERS -#include "Strategic All.h" + #include "Strategic All.h" #else -#include "Map Screen Helicopter.h" -#include "LaptopSave.h" -#include "Vehicles.h" -#include "Finances.h" -#include "Quests.h" -#include "Game Clock.h" -#include "strategic.h" -#include "Queen Command.h" -#include "Strategic Pathing.h" -#include "Random.h" -#include "Game Event Hook.h" -#include "String.h" -#include "Dialogue Control.h" -#include "Message.h" -#include "Strategic Movement.h" -#include "Soldier Profile.h" -#include "Assignments.h" -#include "PreBattle Interface.h" -#include "strategicmap.h" -#include "worlddef.h" -#include "worldman.h" -#include "tiledat.h" -#include "Map Screen Interface.h" -#include "Text.h" -#include "Squads.h" -#include "Player Command.h" -#include "Sound Control.h" -#include "GameSettings.h" -#include "meanwhile.h" -#include "Map Screen Interface Border.h" -#include "Strategic Event Handler.h" -#include "Overhead.h" -#include "Soldier Create.h" -#include "renderworld.h" -#include "soundman.h" -#include "Isometric Utils.h" -#include "Scheduling.h" + #include "Map Screen Helicopter.h" + #include "LaptopSave.h" + #include "Vehicles.h" + #include "Finances.h" + #include "Quests.h" + #include "Game Clock.h" + #include "strategic.h" + #include "Queen Command.h" + #include "Strategic Pathing.h" + #include "Random.h" + #include "Game Event Hook.h" + #include "String.h" + #include "Dialogue Control.h" + #include "Message.h" + #include "Strategic Movement.h" + #include "Soldier Profile.h" + #include "Assignments.h" + #include "PreBattle Interface.h" + #include "strategicmap.h" + #include "worlddef.h" + #include "worldman.h" + #include "tiledat.h" + #include "Map Screen Interface.h" + #include "Text.h" + #include "Squads.h" + #include "Player Command.h" + #include "Sound Control.h" + #include "GameSettings.h" + #include "meanwhile.h" + #include "Map Screen Interface Border.h" + #include "Strategic Event Handler.h" + #include "Overhead.h" + #include "Soldier Create.h" + #include "renderworld.h" + #include "soundman.h" + #include "Isometric Utils.h" + #include "Scheduling.h" #endif @@ -111,7 +111,7 @@ BOOLEAN fHelicopterDestroyed = FALSE; UINT8 ubRefuelList[ NUMBER_OF_REFUEL_SITES ][ 2 ] = { { 13, 2 }, // Drassen airport - { 6, 9 }, // Estoni + { 6, 9 }, // Estoni }; @@ -171,7 +171,7 @@ BOOLEAN EndOfHelicoptersPath( void ); INT32 FindLocationOfClosestRefuelSite( BOOLEAN fMustBeAvailable ); -// add the tactical heli graphic +// add the tactical heli graphic void AddHelicopterToMaps( BOOLEAN fAdd, UINT8 ubSite ); void PaySkyriderBill( void ); @@ -193,7 +193,7 @@ void InitializeHelicopter( void ) fSkyRiderAvailable = FALSE; fSkyRiderSetUp = FALSE; pSkyRider = NULL; - memset ( &SoldierSkyRider, 0, sizeof( SoldierSkyRider ) ); + SoldierSkyRider.initialize(); fHelicopterIsAirBorne = FALSE; fHeliReturnStraightToBase = FALSE; @@ -204,7 +204,7 @@ void InitializeHelicopter( void ) fPlotForHelicopter = FALSE; pTempHelicopterPath = NULL; - // iTotalHeliDistanceSinceRefuel = 0; +// iTotalHeliDistanceSinceRefuel = 0; iTotalAccumulatedCostByPlayer = 0; fHelicopterDestroyed = FALSE; @@ -274,12 +274,12 @@ BOOLEAN RemoveSoldierFromHelicopter( SOLDIERTYPE *pSoldier ) return( FALSE ); } - pSoldier -> sSectorX = pVehicleList[ iHelicopterVehicleId ].sSectorX; - pSoldier -> sSectorY = pVehicleList[ iHelicopterVehicleId ].sSectorY; - pSoldier -> bSectorZ = 0; + pSoldier->sSectorX = pVehicleList[ iHelicopterVehicleId ].sSectorX; + pSoldier->sSectorY = pVehicleList[ iHelicopterVehicleId ].sSectorY; + pSoldier->bSectorZ = 0; // reset between sectors - pSoldier->fBetweenSectors = FALSE; + pSoldier->flags.fBetweenSectors = FALSE; // remove from the vehicle @@ -293,7 +293,7 @@ BOOLEAN HandleHeliEnteringSector( INT16 sX, INT16 sY ) UINT8 ubNumEnemies; - // check for SAM attack upon the chopper. If it's destroyed by the attack, do nothing else here + // check for SAM attack upon the chopper. If it's destroyed by the attack, do nothing else here if( HandleSAMSiteAttackOfHelicopterInSector( sX, sY ) == TRUE ) { // destroyed @@ -344,7 +344,7 @@ BOOLEAN HandleHeliEnteringSector( INT16 sX, INT16 sY ) } // accumulate distance travelled - // AddSectorToHelicopterDistanceTravelled( ); +// AddSectorToHelicopterDistanceTravelled( ); // check if heli has any real path left @@ -365,12 +365,12 @@ BOOLEAN HandleHeliEnteringSector( INT16 sX, INT16 sY ) StopTimeCompression(); } - // destination reached, payment due. If player can't pay, mercs get kicked off and heli flies to base! + // destination reached, payment due. If player can't pay, mercs get kicked off and heli flies to base! PaySkyriderBill(); } else { - // Say quote: "Gonna have to abort. Enemies below" + // Say quote: "Gonna have to abort. Enemies below" if(gGameSettings.fOptions[ TOPTION_SILENT_SKYRIDER ] == FALSE) HeliCharacterDialogue( pSkyRider, ARRIVED_IN_HOSTILE_SECTOR ); StopTimeCompression(); } @@ -387,30 +387,30 @@ BOOLEAN HandleHeliEnteringSector( INT16 sX, INT16 sY ) /* INT32 GetTotalDistanceHelicopterCanTravel( void ) { -return( MAX_HELICOPTER_DISTANCE ); + return( MAX_HELICOPTER_DISTANCE ); } INT32 HowFarHelicopterhasTravelledSinceRefueling( void ) { -// return total distance -return( iTotalHeliDistanceSinceRefuel ); + // return total distance + return( iTotalHeliDistanceSinceRefuel ); } INT32 HowFurtherCanHelicopterTravel( void ) { -// how many sectors further can we go on remaining fuel? -return( MAX_HELICOPTER_DISTANCE - ( HowFarHelicopterhasTravelledSinceRefueling( ) + DistanceOfIntendedHelicopterPath( ) ) ); + // how many sectors further can we go on remaining fuel? + return( MAX_HELICOPTER_DISTANCE - ( HowFarHelicopterhasTravelledSinceRefueling( ) + DistanceOfIntendedHelicopterPath( ) ) ); } void AddSectorToHelicopterDistanceTravelled( void ) { -// up the distance -iTotalHeliDistanceSinceRefuel++; + // up the distance + iTotalHeliDistanceSinceRefuel++; -//reset hover time -uiStartHoverTime = 0; + //reset hover time + uiStartHoverTime = 0; -return; + return; } */ @@ -421,7 +421,7 @@ INT32 LocationOfNearestRefuelPoint( BOOLEAN fNotifyPlayerIfNoSafeLZ ) // try to find one, any one under the players control iClosestLocation = FindLocationOfClosestRefuelSite( TRUE ); - // no go?...then find + // no go?...then find if( iClosestLocation == -1 ) { if( fNotifyPlayerIfNoSafeLZ ) @@ -486,14 +486,14 @@ INT32 DistanceToNearestRefuelPoint( INT16 sX, INT16 sY ) /* BOOLEAN IsSectorOutOfTheWay( INT16 sX, INT16 sY ) { -// check distance to nearest refuel point -if( DistanceToNearestRefuelPoint( sX, sY ) > HowFurtherCanHelicopterTravel( ) ) -{ -return( TRUE ); -} + // check distance to nearest refuel point + if( DistanceToNearestRefuelPoint( sX, sY ) > HowFurtherCanHelicopterTravel( ) ) + { + return( TRUE ); + } -return( FALSE ); + return( FALSE ); } */ @@ -505,12 +505,12 @@ void ReFuelHelicopter( void ) LandHelicopter( ); - /* +/* AddStrategicEvent( EVENT_HELICOPTER_DONE_REFUELING, GetWorldTotalMin() + REFUEL_HELICOPTER_DELAY, 0 ); // reset distance traveled iTotalHeliDistanceSinceRefuel = 0; - */ +*/ return; } @@ -546,7 +546,7 @@ void SkyriderDestroyed( void ) // kill skyrider fSkyRiderAvailable = FALSE; - SoldierSkyRider.bLife = 0; + SoldierSkyRider.stats.bLife = 0; gMercProfiles[ SKYRIDER ].bLife = 0; // heli no longer available @@ -557,7 +557,7 @@ void SkyriderDestroyed( void ) // zero out balance due gMercProfiles[ SKYRIDER ].iBalance = 0; - // iTotalHeliDistanceSinceRefuel = 0; +// iTotalHeliDistanceSinceRefuel = 0; iTotalAccumulatedCostByPlayer = 0; // remove vehicle and reset @@ -583,13 +583,13 @@ BOOLEAN CanHelicopterFly( void ) return( FALSE ); } - /* +/* // travelled too far? if( iTotalHeliDistanceSinceRefuel > MAX_HELICOPTER_DISTANCE ) { - return( FALSE ); + return( FALSE ); } - */ +*/ // is the pilot alive, well, and willing to help us? if( IsHelicopterPilotAvailable( ) == FALSE ) @@ -708,7 +708,7 @@ void HandleHeliHoverLong( void ) } else { - // reset + // reset uiStartHoverTime = 0; } } @@ -786,10 +786,10 @@ INT32 DistanceOfIntendedHelicopterPath( void ) // any path yet? if( pNode != NULL ) { - while( pNode -> pNext ) + while( pNode->pNext ) { iLength++; - pNode = pNode ->pNext; + pNode = pNode->pNext; } } @@ -798,10 +798,10 @@ INT32 DistanceOfIntendedHelicopterPath( void ) // any path yet? if( pNode != NULL ) { - while( pNode -> pNext ) + while( pNode->pNext ) { iLength++; - pNode = pNode ->pNext; + pNode = pNode->pNext; } } @@ -904,8 +904,8 @@ void UpdateRefuelSiteAvailability( void ) { // if enemy controlled sector (ground OR air, don't want to fly into enemy air territory) if( ( StrategicMap[ CALCULATE_STRATEGIC_INDEX( ubRefuelList[ iCounter ][ 0 ], ubRefuelList[ iCounter ][ 1 ] ) ].fEnemyControlled == TRUE ) || - ( StrategicMap[ CALCULATE_STRATEGIC_INDEX( ubRefuelList[ iCounter ][ 0 ], ubRefuelList[ iCounter ][ 1 ] ) ].fEnemyAirControlled == TRUE ) || - ( ( iCounter == ESTONI_REFUELING_SITE ) && ( CheckFact( FACT_ESTONI_REFUELLING_POSSIBLE, 0 ) == FALSE ) ) ) + ( StrategicMap[ CALCULATE_STRATEGIC_INDEX( ubRefuelList[ iCounter ][ 0 ], ubRefuelList[ iCounter ][ 1 ] ) ].fEnemyAirControlled == TRUE ) || + ( ( iCounter == ESTONI_REFUELING_SITE ) && ( CheckFact( FACT_ESTONI_REFUELLING_POSSIBLE, 0 ) == FALSE ) ) ) { // mark refueling site as unavailable fRefuelingSiteAvailable[ iCounter ] = FALSE; @@ -941,11 +941,9 @@ void SetUpHelicopterForPlayer( INT16 sX, INT16 sY ) Assert( iHelicopterVehicleId != -1 ); - // WDS - Clean up inventory handling - //memset( &SoldierSkyRider, 0, SIZEOF_SOLDIERTYPE ); SoldierSkyRider.initialize(); SoldierSkyRider.ubProfile = SKYRIDER; - SoldierSkyRider.bLife = 80; + SoldierSkyRider.stats.bLife = 80; pSkyRider = &( SoldierSkyRider ); @@ -971,9 +969,9 @@ UINT8 MoveAllInHelicopterToFootMovementGroup( void ) INT8 bNewSquad; BOOLEAN fAnyoneAboard = FALSE; BOOLEAN fSuccess; - UINT8 ubInsertionCode = 0; + UINT8 ubInsertionCode = 0; BOOLEAN fInsertionCodeSet = FALSE; - UINT16 usInsertionData = 0; + UINT16 usInsertionData = 0; // put these guys on their own squad (we need to return their group ID, and can only return one, so they need a unique one @@ -1048,22 +1046,22 @@ void HandleSkyRiderMonologueEvent( UINT32 uiEventCode, UINT32 uiSpecialCode ) switch( uiEventCode ) { - case( SKYRIDER_MONOLOGUE_EVENT_DRASSEN_SAM_SITE ): - SetExternMapscreenSpeechPanelXY( DEFAULT_EXTERN_PANEL_X_POS, 117 ); - HandleSkyRiderMonologueAboutDrassenSAMSite( uiSpecialCode ); - break; - case SKYRIDER_MONOLOGUE_EVENT_CAMBRIA_HOSPITAL: - SetExternMapscreenSpeechPanelXY( DEFAULT_EXTERN_PANEL_X_POS, 172 ); - HandleSkyRiderMonologueAboutCambriaHospital( uiSpecialCode ); - break; - case( SKYRIDER_MONOLOGUE_EVENT_OTHER_SAM_SITES ): - SetExternMapscreenSpeechPanelXY( 335, DEFAULT_EXTERN_PANEL_Y_POS ); - HandleSkyRiderMonologueAboutOtherSAMSites( uiSpecialCode ); - break; - case( SKYRIDER_MONOLOGUE_EVENT_ESTONI_REFUEL ): - SetExternMapscreenSpeechPanelXY( DEFAULT_EXTERN_PANEL_X_POS, DEFAULT_EXTERN_PANEL_Y_POS ); - HandleSkyRiderMonologueAboutEstoniRefuel( uiSpecialCode ); - break; + case( SKYRIDER_MONOLOGUE_EVENT_DRASSEN_SAM_SITE ): + SetExternMapscreenSpeechPanelXY( DEFAULT_EXTERN_PANEL_X_POS, 117 ); + HandleSkyRiderMonologueAboutDrassenSAMSite( uiSpecialCode ); + break; + case SKYRIDER_MONOLOGUE_EVENT_CAMBRIA_HOSPITAL: + SetExternMapscreenSpeechPanelXY( DEFAULT_EXTERN_PANEL_X_POS, 172 ); + HandleSkyRiderMonologueAboutCambriaHospital( uiSpecialCode ); + break; + case( SKYRIDER_MONOLOGUE_EVENT_OTHER_SAM_SITES ): + SetExternMapscreenSpeechPanelXY( 335, DEFAULT_EXTERN_PANEL_Y_POS ); + HandleSkyRiderMonologueAboutOtherSAMSites( uiSpecialCode ); + break; + case( SKYRIDER_MONOLOGUE_EVENT_ESTONI_REFUEL ): + SetExternMapscreenSpeechPanelXY( DEFAULT_EXTERN_PANEL_X_POS, DEFAULT_EXTERN_PANEL_Y_POS ); + HandleSkyRiderMonologueAboutEstoniRefuel( uiSpecialCode ); + break; } // update time @@ -1077,22 +1075,22 @@ void HandleSkyRiderMonologueAboutEstoniRefuel( UINT32 uiSpecialCode ) switch( uiSpecialCode ) { - case( 0 ): - CharacterDialogueWithSpecialEvent( SKYRIDER, SPIEL_ABOUT_ESTONI_AIRSPACE, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ] , DIALOGUE_EXTERNAL_NPC_UI , FALSE , FALSE , DIALOGUE_SPECIAL_EVENT_SKYRIDERMAPSCREENEVENT ,SKYRIDER_MONOLOGUE_EVENT_ESTONI_REFUEL, 1 ); - // if special event data 2 is true, then do dialogue, else this is just a trigger for an event + case( 0 ): + CharacterDialogueWithSpecialEvent( SKYRIDER, SPIEL_ABOUT_ESTONI_AIRSPACE, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ] , DIALOGUE_EXTERNAL_NPC_UI , FALSE , FALSE , DIALOGUE_SPECIAL_EVENT_SKYRIDERMAPSCREENEVENT ,SKYRIDER_MONOLOGUE_EVENT_ESTONI_REFUEL, 1 ); + // if special event data 2 is true, then do dialogue, else this is just a trigger for an event CharacterDialogue( SKYRIDER, SPIEL_ABOUT_ESTONI_AIRSPACE, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI, FALSE, FALSE ); - CharacterDialogueWithSpecialEvent( SKYRIDER, SPIEL_ABOUT_ESTONI_AIRSPACE, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ] , DIALOGUE_EXTERNAL_NPC_UI , FALSE , FALSE , DIALOGUE_SPECIAL_EVENT_SKYRIDERMAPSCREENEVENT ,SKYRIDER_MONOLOGUE_EVENT_ESTONI_REFUEL, 2 ); - break; + CharacterDialogueWithSpecialEvent( SKYRIDER, SPIEL_ABOUT_ESTONI_AIRSPACE, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ] , DIALOGUE_EXTERNAL_NPC_UI , FALSE , FALSE , DIALOGUE_SPECIAL_EVENT_SKYRIDERMAPSCREENEVENT ,SKYRIDER_MONOLOGUE_EVENT_ESTONI_REFUEL, 2 ); + break; - case( 1 ): - // highlight Estoni - fShowEstoniRefuelHighLight = TRUE; - break; + case( 1 ): + // highlight Estoni + fShowEstoniRefuelHighLight = TRUE; + break; - case( 2 ): - fShowEstoniRefuelHighLight = FALSE; - break; + case( 2 ): + fShowEstoniRefuelHighLight = FALSE; + break; } return; } @@ -1102,40 +1100,40 @@ void HandleSkyRiderMonologueAboutDrassenSAMSite( UINT32 uiSpecialCode ) { switch( uiSpecialCode ) { - case( 0 ): - //gpCurrentTalkingFace = &gFacesData[ uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ] ]; - //gubCurrentTalkingID = SKYRIDER; + case( 0 ): + //gpCurrentTalkingFace = &gFacesData[ uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ] ]; + //gubCurrentTalkingID = SKYRIDER; - // if special event data 2 is true, then do dialogue, else this is just a trigger for an event - CharacterDialogue( SKYRIDER, MENTION_DRASSEN_SAM_SITE, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI, FALSE, FALSE ); - CharacterDialogueWithSpecialEvent( SKYRIDER, MENTION_DRASSEN_SAM_SITE, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI , FALSE , TRUE , DIALOGUE_SPECIAL_EVENT_SKYRIDERMAPSCREENEVENT ,SKYRIDER_MONOLOGUE_EVENT_DRASSEN_SAM_SITE, 1 ); + // if special event data 2 is true, then do dialogue, else this is just a trigger for an event + CharacterDialogue( SKYRIDER, MENTION_DRASSEN_SAM_SITE, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI, FALSE, FALSE ); + CharacterDialogueWithSpecialEvent( SKYRIDER, MENTION_DRASSEN_SAM_SITE, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI , FALSE , TRUE , DIALOGUE_SPECIAL_EVENT_SKYRIDERMAPSCREENEVENT ,SKYRIDER_MONOLOGUE_EVENT_DRASSEN_SAM_SITE, 1 ); - if( SAMSitesUnderPlayerControl( SAM_2_X, SAM_2_Y ) == FALSE ) - { - CharacterDialogue( SKYRIDER, SECOND_HALF_OF_MENTION_DRASSEN_SAM_SITE, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI, FALSE, FALSE ); - } - else - { - // Ian says don't use the SAM site quote unless player has tried flying already - if ( CheckFact( FACT_SKYRIDER_USED_IN_MAPSCREEN, SKYRIDER ) ) + if( SAMSitesUnderPlayerControl( SAM_2_X, SAM_2_Y ) == FALSE ) { - CharacterDialogue( SKYRIDER, SAM_SITE_TAKEN, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI, FALSE, FALSE ); - gfSkyriderSaidCongratsOnTakingSAM = TRUE; + CharacterDialogue( SKYRIDER, SECOND_HALF_OF_MENTION_DRASSEN_SAM_SITE, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI, FALSE, FALSE ); + } + else + { + // Ian says don't use the SAM site quote unless player has tried flying already + if ( CheckFact( FACT_SKYRIDER_USED_IN_MAPSCREEN, SKYRIDER ) ) + { + CharacterDialogue( SKYRIDER, SAM_SITE_TAKEN, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI, FALSE, FALSE ); + gfSkyriderSaidCongratsOnTakingSAM = TRUE; + } } - } - CharacterDialogueWithSpecialEvent( SKYRIDER, MENTION_DRASSEN_SAM_SITE, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI , FALSE , TRUE , DIALOGUE_SPECIAL_EVENT_SKYRIDERMAPSCREENEVENT ,SKYRIDER_MONOLOGUE_EVENT_DRASSEN_SAM_SITE, 2 ); - break; + CharacterDialogueWithSpecialEvent( SKYRIDER, MENTION_DRASSEN_SAM_SITE, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI , FALSE , TRUE , DIALOGUE_SPECIAL_EVENT_SKYRIDERMAPSCREENEVENT ,SKYRIDER_MONOLOGUE_EVENT_DRASSEN_SAM_SITE, 2 ); + break; - case( 1 ): - // highlight Drassen SAM site sector - fShowDrassenSAMHighLight = TRUE; - SetSAMSiteAsFound( SAM_SITE_TWO ); - break; + case( 1 ): + // highlight Drassen SAM site sector + fShowDrassenSAMHighLight = TRUE; + SetSAMSiteAsFound( SAM_SITE_TWO ); + break; - case( 2 ): - fShowDrassenSAMHighLight = FALSE; - break; + case( 2 ): + fShowDrassenSAMHighLight = FALSE; + break; } return; } @@ -1145,21 +1143,21 @@ void HandleSkyRiderMonologueAboutCambriaHospital( UINT32 uiSpecialCode ) { switch( uiSpecialCode ) { - case( 0 ): - //gpCurrentTalkingFace = &gFacesData[ uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ] ]; - //gubCurrentTalkingID = SKYRIDER; + case( 0 ): + //gpCurrentTalkingFace = &gFacesData[ uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ] ]; + //gubCurrentTalkingID = SKYRIDER; - // if special event data 2 is true, then do dialogue, else this is just a trigger for an event - CharacterDialogue( SKYRIDER, MENTION_HOSPITAL_IN_CAMBRIA, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI, FALSE, FALSE ); - CharacterDialogueWithSpecialEvent( SKYRIDER, MENTION_HOSPITAL_IN_CAMBRIA, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI , FALSE , TRUE , DIALOGUE_SPECIAL_EVENT_SKYRIDERMAPSCREENEVENT ,SKYRIDER_MONOLOGUE_EVENT_CAMBRIA_HOSPITAL, 1 ); + // if special event data 2 is true, then do dialogue, else this is just a trigger for an event + CharacterDialogue( SKYRIDER, MENTION_HOSPITAL_IN_CAMBRIA, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI, FALSE, FALSE ); + CharacterDialogueWithSpecialEvent( SKYRIDER, MENTION_HOSPITAL_IN_CAMBRIA, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI , FALSE , TRUE , DIALOGUE_SPECIAL_EVENT_SKYRIDERMAPSCREENEVENT ,SKYRIDER_MONOLOGUE_EVENT_CAMBRIA_HOSPITAL, 1 ); - // highlight Drassen hospital sector - fShowCambriaHospitalHighLight = TRUE; - break; + // highlight Drassen hospital sector + fShowCambriaHospitalHighLight = TRUE; + break; - case( 1 ): - fShowCambriaHospitalHighLight = FALSE; - break; + case( 1 ): + fShowCambriaHospitalHighLight = FALSE; + break; } return; } @@ -1171,35 +1169,35 @@ void HandleSkyRiderMonologueAboutOtherSAMSites( UINT32 uiSpecialCode ) switch( uiSpecialCode ) { - case( 0 ): - // do quote 21 - gpCurrentTalkingFace = &gFacesData[ uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ] ]; - gubCurrentTalkingID = SKYRIDER; + case( 0 ): + // do quote 21 + gpCurrentTalkingFace = &gFacesData[ uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ] ]; + gubCurrentTalkingID = SKYRIDER; - // if special event data 2 is true, then do dialogue, else this is just a trigger for an event - CharacterDialogue( SKYRIDER, SPIEL_ABOUT_OTHER_SAM_SITES, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI, FALSE, FALSE ); - CharacterDialogueWithSpecialEvent( SKYRIDER, SPIEL_ABOUT_OTHER_SAM_SITES, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ] , DIALOGUE_EXTERNAL_NPC_UI , FALSE , FALSE , DIALOGUE_SPECIAL_EVENT_SKYRIDERMAPSCREENEVENT ,SKYRIDER_MONOLOGUE_EVENT_OTHER_SAM_SITES, 1 ); + // if special event data 2 is true, then do dialogue, else this is just a trigger for an event + CharacterDialogue( SKYRIDER, SPIEL_ABOUT_OTHER_SAM_SITES, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI, FALSE, FALSE ); + CharacterDialogueWithSpecialEvent( SKYRIDER, SPIEL_ABOUT_OTHER_SAM_SITES, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ] , DIALOGUE_EXTERNAL_NPC_UI , FALSE , FALSE , DIALOGUE_SPECIAL_EVENT_SKYRIDERMAPSCREENEVENT ,SKYRIDER_MONOLOGUE_EVENT_OTHER_SAM_SITES, 1 ); - CharacterDialogue( SKYRIDER, SECOND_HALF_OF_SPIEL_ABOUT_OTHER_SAM_SITES, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI, FALSE, FALSE ); - CharacterDialogueWithSpecialEvent( SKYRIDER, SPIEL_ABOUT_OTHER_SAM_SITES, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ] , DIALOGUE_EXTERNAL_NPC_UI , FALSE , FALSE , DIALOGUE_SPECIAL_EVENT_SKYRIDERMAPSCREENEVENT ,SKYRIDER_MONOLOGUE_EVENT_OTHER_SAM_SITES, 2 ); + CharacterDialogue( SKYRIDER, SECOND_HALF_OF_SPIEL_ABOUT_OTHER_SAM_SITES, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI, FALSE, FALSE ); + CharacterDialogueWithSpecialEvent( SKYRIDER, SPIEL_ABOUT_OTHER_SAM_SITES, uiExternalStaticNPCFaces[ SKYRIDER_EXTERNAL_FACE ] , DIALOGUE_EXTERNAL_NPC_UI , FALSE , FALSE , DIALOGUE_SPECIAL_EVENT_SKYRIDERMAPSCREENEVENT ,SKYRIDER_MONOLOGUE_EVENT_OTHER_SAM_SITES, 2 ); - break; + break; - case( 1 ): - // highlight other SAMs - fShowOtherSAMHighLight = TRUE; - // reveal other 3 SAM sites - SetSAMSiteAsFound( SAM_SITE_ONE ); - SetSAMSiteAsFound( SAM_SITE_THREE ); - SetSAMSiteAsFound( SAM_SITE_FOUR ); - break; + case( 1 ): + // highlight other SAMs + fShowOtherSAMHighLight = TRUE; + // reveal other 3 SAM sites + SetSAMSiteAsFound( SAM_SITE_ONE ); + SetSAMSiteAsFound( SAM_SITE_THREE ); + SetSAMSiteAsFound( SAM_SITE_FOUR ); + break; - case( 2 ): - fShowOtherSAMHighLight = FALSE; - break; + case( 2 ): + fShowOtherSAMHighLight = FALSE; + break; } return; -} +} void CheckAndHandleSkyriderMonologues( void ) @@ -1316,12 +1314,12 @@ void HandleAnimationOfSectors( void ) { switch( gubBlitSectorLocatorCode ) { - case LOCATOR_COLOR_RED: // normal one used for mines (will now be overriden with yellow) - HandleBlitOfSectorLocatorIcon( gsSectorLocatorX, gsSectorLocatorY, 0, LOCATOR_COLOR_RED ); - break; - case LOCATOR_COLOR_YELLOW: // used for all other dialogues - HandleBlitOfSectorLocatorIcon( gsSectorLocatorX, gsSectorLocatorY, 0, LOCATOR_COLOR_YELLOW ); - break; + case LOCATOR_COLOR_RED: // normal one used for mines (will now be overriden with yellow) + HandleBlitOfSectorLocatorIcon( gsSectorLocatorX, gsSectorLocatorY, 0, LOCATOR_COLOR_RED ); + break; + case LOCATOR_COLOR_YELLOW: // used for all other dialogues + HandleBlitOfSectorLocatorIcon( gsSectorLocatorX, gsSectorLocatorY, 0, LOCATOR_COLOR_YELLOW ); + break; } } @@ -1350,9 +1348,9 @@ INT16 LastSectorInHelicoptersPath( void ) { while( pNode) { - uiLocation = pNode -> uiSectorId; + uiLocation = pNode->uiSectorId; - pNode = pNode ->pNext; + pNode = pNode->pNext; } } @@ -1362,9 +1360,9 @@ INT16 LastSectorInHelicoptersPath( void ) { while( pNode ) { - uiLocation = pNode -> uiSectorId; + uiLocation = pNode->uiSectorId; - pNode = pNode ->pNext; + pNode = pNode->pNext; } } @@ -1375,166 +1373,166 @@ INT16 LastSectorInHelicoptersPath( void ) /* INT32 GetTotalCostOfHelicopterTrip( void ) { -// get cost of helicopter trip + // get cost of helicopter trip -PathStPtr pNode = NULL, pTempNode = NULL; -UINT32 uiCost = 0; -UINT32 uiLastTempPathSectorId = 0; -UINT32 iClosestRefuelPoint = 0; -UINT32 uiStartSectorNum = 0; -UINT32 uiLength = 0; + PathStPtr pNode = NULL, pTempNode = NULL; + UINT32 uiCost = 0; + UINT32 uiLastTempPathSectorId = 0; + UINT32 iClosestRefuelPoint = 0; + UINT32 uiStartSectorNum = 0; + UINT32 uiLength = 0; -// if the heli is on the move, what is the distance it will move..the length of the merc path, less the first node -if( CanHelicopterFly( ) == FALSE ) -{ -// big number, no go -return( 0 ); -} + // if the heli is on the move, what is the distance it will move..the length of the merc path, less the first node + if( CanHelicopterFly( ) == FALSE ) + { + // big number, no go + return( 0 ); + } -pNode = pVehicleList[ iHelicopterVehicleId ].pMercPath; + pNode = pVehicleList[ iHelicopterVehicleId ].pMercPath; -// any path yet? -uiLastTempPathSectorId = pVehicleList[ iHelicopterVehicleId ].sSectorX + pVehicleList[ iHelicopterVehicleId ].sSectorY * MAP_WORLD_X; -uiStartSectorNum = uiLastTempPathSectorId; + // any path yet? + uiLastTempPathSectorId = pVehicleList[ iHelicopterVehicleId ].sSectorX + pVehicleList[ iHelicopterVehicleId ].sSectorY * MAP_WORLD_X; + uiStartSectorNum = uiLastTempPathSectorId; -if( pNode ) -{ -pNode = pNode->pNext; -} + if( pNode ) + { + pNode = pNode->pNext; + } -if( pNode != NULL ) -{ -while( pNode) -{ -if( uiLength == 0 ) -{ -if( pNode->pNext ) -{ -if( uiLastTempPathSectorId == pNode->pNext->uiSectorId ) -{ -// do nothing -} -else -{ -uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) ); -} -} -else -{ -uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) ); -} -} -else -{ -uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) ); -} + if( pNode != NULL ) + { + while( pNode) + { + if( uiLength == 0 ) + { + if( pNode->pNext ) + { + if( uiLastTempPathSectorId == pNode->pNext->uiSectorId ) + { + // do nothing + } + else + { + uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode->uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) ); + } + } + else + { + uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode->uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) ); + } + } + else + { + uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode->uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) ); + } -uiLength++; + uiLength++; -uiLastTempPathSectorId = pNode ->uiSectorId; -pNode = pNode ->pNext; -} -} + uiLastTempPathSectorId = pNode->uiSectorId; + pNode = pNode->pNext; + } + } -pNode = NULL; + pNode = NULL; -if( pTempHelicopterPath ) -{ -pNode = MoveToBeginningOfPathList( pTempHelicopterPath ); -} + if( pTempHelicopterPath ) + { + pNode = MoveToBeginningOfPathList( pTempHelicopterPath ); + } -if( pNode ) -{ -pNode = pNode->pNext; -} + if( pNode ) + { + pNode = pNode->pNext; + } -// any path yet? -if( pNode != NULL ) -{ -while( pNode ) -{ -if( uiLength == 0 ) -{ -if( pNode->pNext ) -{ -if( uiLastTempPathSectorId == pNode->pNext->uiSectorId ) -{ -// do nothing -} -else -{ -uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) ); -} -} -else -{ -uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) ); -} -} -else -{ -uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) ); -} + // any path yet? + if( pNode != NULL ) + { + while( pNode ) + { + if( uiLength == 0 ) + { + if( pNode->pNext ) + { + if( uiLastTempPathSectorId == pNode->pNext->uiSectorId ) + { + // do nothing + } + else + { + uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode->uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) ); + } + } + else + { + uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode->uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) ); + } + } + else + { + uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pNode->uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) ); + } -uiLength++; + uiLength++; -//uiCost += GetCostOfPassageForHelicopter( ( UINT16 ) ( pNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) ); -uiLastTempPathSectorId = pNode ->uiSectorId; -pNode = pNode ->pNext; -} -} + //uiCost += GetCostOfPassageForHelicopter( ( UINT16 ) ( pNode->uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pNode->uiSectorId / MAP_WORLD_X ) ); + uiLastTempPathSectorId = pNode->uiSectorId; + pNode = pNode->pNext; + } + } -iClosestRefuelPoint = ( INT16 )( CALCULATE_STRATEGIC_INDEX( ubRefuelList[ LocationOfNearestRefuelPoint( FALSE ) ][ 0 ], ubRefuelList[ LocationOfNearestRefuelPoint( FALSE ) ][ 1 ] ) ); + iClosestRefuelPoint = ( INT16 )( CALCULATE_STRATEGIC_INDEX( ubRefuelList[ LocationOfNearestRefuelPoint( FALSE ) ][ 0 ], ubRefuelList[ LocationOfNearestRefuelPoint( FALSE ) ][ 1 ] ) ); -pNode = NULL; + pNode = NULL; -if( uiLastTempPathSectorId != iClosestRefuelPoint ) -{ -pNode = BuildAStrategicPath( pNode, ( INT16 )( uiLastTempPathSectorId ), ( INT16 )iClosestRefuelPoint, pVehicleList[ iHelicopterVehicleId ].ubMovementGroup, FALSE ); + if( uiLastTempPathSectorId != iClosestRefuelPoint ) + { + pNode = BuildAStrategicPath( pNode, ( INT16 )( uiLastTempPathSectorId ), ( INT16 )iClosestRefuelPoint, pVehicleList[ iHelicopterVehicleId ].ubMovementGroup, FALSE ); // pNode = BuildAStrategicPath( pNode, ( INT16 )( uiLastTempPathSectorId ), ( INT16 )iClosestRefuelPoint, pVehicleList[ iHelicopterVehicleId ].ubMovementGroup, FALSE, TRUE ); -pNode = MoveToBeginningOfPathList( pNode ); -} + pNode = MoveToBeginningOfPathList( pNode ); + } -pTempNode = pNode; -uiLength = 0; + pTempNode = pNode; + uiLength = 0; -if( pTempNode ) -{ -pTempNode = pTempNode->pNext; -} + if( pTempNode ) + { + pTempNode = pTempNode->pNext; + } -while( pTempNode ) -{ -if( uiLength == 0 ) -{ -if( pTempNode->pNext ) -{ -if( uiLastTempPathSectorId == pNode->pNext->uiSectorId ) -{ -// do nothing -} -else -{ -uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pTempNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pTempNode->uiSectorId / MAP_WORLD_X ) ); -} -} -else -{ -uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pTempNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pTempNode->uiSectorId / MAP_WORLD_X ) ); -} -} -else -{ -uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pTempNode -> uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pTempNode->uiSectorId / MAP_WORLD_X ) ); -} + while( pTempNode ) + { + if( uiLength == 0 ) + { + if( pTempNode->pNext ) + { + if( uiLastTempPathSectorId == pNode->pNext->uiSectorId ) + { + // do nothing + } + else + { + uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pTempNode->uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pTempNode->uiSectorId / MAP_WORLD_X ) ); + } + } + else + { + uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pTempNode->uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pTempNode->uiSectorId / MAP_WORLD_X ) ); + } + } + else + { + uiCost += GetCostOfPassageForHelicopter( ( UINT16 )( pTempNode->uiSectorId % MAP_WORLD_X ), ( UINT16 ) ( pTempNode->uiSectorId / MAP_WORLD_X ) ); + } -uiLength++; -pTempNode = pTempNode->pNext; -} + uiLength++; + pTempNode = pTempNode->pNext; + } -return( ( INT32 )uiCost ); + return( ( INT32 )uiCost ); } */ @@ -1556,11 +1554,11 @@ void HandleHelicopterOnGroundGraphic( void ) if ( ( ubRefuelList[ ubSite ][ 0 ] == gWorldSectorX ) && ( ubRefuelList[ ubSite ][ 1 ] == gWorldSectorY ) ) { // YES, so find out if the chopper is landed here - if ( IsHelicopterOnGroundAtRefuelingSite( ubSite ) ) + if ( IsHelicopterOnGroundAtRefuelingSite( ubSite ) ) { // Add.... AddHelicopterToMaps( TRUE, ubSite ); - // ATE: Add skyridder too + // ATE: Add skyridder too // ATE: only if hired...... if ( fHelicopterAvailable ) { @@ -1583,10 +1581,10 @@ void HandleHelicopterOnGroundGraphic( void ) // see if we can find him and remove him if so.... pSoldier = FindSoldierByProfileID( SKYRIDER, FALSE ); - // ATE: Don't do this if buddy is on our team! + // ATE: Don't do this if buddy is on our team! if ( pSoldier != NULL && pSoldier->bTeam != gbPlayerNum ) { - TacticalRemoveSoldier( pSoldier->ubID ); + TacticalRemoveSoldier( pSoldier->ubID ); } } } @@ -1618,9 +1616,9 @@ void HandleHelicopterOnGroundSkyriderProfile( void ) if ( ( ubRefuelList[ ubSite ][ 0 ] == gWorldSectorX ) && ( ubRefuelList[ ubSite ][ 1 ] == gWorldSectorY ) ) { // YES, so find out if the chopper is landed here - if ( IsHelicopterOnGroundAtRefuelingSite( ubSite ) ) + if ( IsHelicopterOnGroundAtRefuelingSite( ubSite ) ) { - // ATE: Add skyridder too + // ATE: Add skyridder too // ATE: only if hired...... if ( fHelicopterAvailable ) { @@ -1639,10 +1637,10 @@ void HandleHelicopterOnGroundSkyriderProfile( void ) // see if we can find him and remove him if so.... pSoldier = FindSoldierByProfileID( SKYRIDER, FALSE ); - // ATE: Don't do this if buddy is on our team! + // ATE: Don't do this if buddy is on our team! if ( pSoldier != NULL && pSoldier->bTeam != gbPlayerNum ) { - TacticalRemoveSoldier( pSoldier->ubID ); + TacticalRemoveSoldier( pSoldier->ubID ); } } } @@ -1684,8 +1682,8 @@ BOOLEAN IsHelicopterOnGroundAtRefuelingSite( UINT8 ubRefuelingSite ) Assert( iHelicopterVehicleId != -1 ); // on the ground, but is it at this site or at another one? - if ( ( ubRefuelList[ ubRefuelingSite ][ 0 ] == pVehicleList[ iHelicopterVehicleId ].sSectorX ) && - ( ubRefuelList[ ubRefuelingSite ][ 1 ] == pVehicleList[ iHelicopterVehicleId ].sSectorY ) ) + if ( ( ubRefuelList[ ubRefuelingSite ][ 0 ] == pVehicleList[ iHelicopterVehicleId ].sSectorX ) && + ( ubRefuelList[ ubRefuelingSite ][ 1 ] == pVehicleList[ iHelicopterVehicleId ].sSectorY ) ) { return(TRUE); } @@ -1695,11 +1693,11 @@ BOOLEAN IsHelicopterOnGroundAtRefuelingSite( UINT8 ubRefuelingSite ) } // drassen airport sector -#define AIRPORT_X 13 +#define AIRPORT_X 13 #define AIRPORT_Y 2 // meduna airport sector -#define AIRPORT2_X 3 +#define AIRPORT2_X 3 #define AIRPORT2_Y 14 BOOLEAN WillAirRaidBeStopped( INT16 sSectorX, INT16 sSectorY ) @@ -1724,7 +1722,7 @@ BOOLEAN WillAirRaidBeStopped( INT16 sSectorX, INT16 sSectorY ) // which SAM controls this sector? - ubSamNumber = ubSAMControlledSectors[ sSectorY ][ sSectorX ]; + ubSamNumber = ubSAMControlledSectors[ sSectorY ][ sSectorX ]; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("WillAirRaidBeStopped: SAM number = %d",ubSamNumber)); // if none of them @@ -1787,7 +1785,7 @@ BOOLEAN HandleSAMSiteAttackOfHelicopterInSector( INT16 sSectorX, INT16 sSectorY } // which SAM controls this sector? - ubSamNumber = ubSAMControlledSectors[ sSectorY ][ sSectorX ]; + ubSamNumber = ubSAMControlledSectors[ sSectorY ][ sSectorX ]; // if none of them if (ubSamNumber == 0) @@ -1828,7 +1826,7 @@ BOOLEAN HandleSAMSiteAttackOfHelicopterInSector( INT16 sSectorX, INT16 sSectorY // another hit! gubHelicopterHitsTaken++; - // Took a hit! Pause time so player can reconsider + // Took a hit! Pause time so player can reconsider StopTimeCompression(); // first hit? @@ -1852,16 +1850,16 @@ BOOLEAN HandleSAMSiteAttackOfHelicopterInSector( INT16 sSectorX, INT16 sSectorY // everyone die die die // play sound if ( PlayJA2StreamingSampleFromFile( "stsounds\\blah2.wav", RATE_11025, HIGHVOLUME, 1, MIDDLEPAN, HeliCrashSoundStopCallback ) == SOUND_ERROR ) - { - // Destroy here if we cannot play streamed sound sample.... + { + // Destroy here if we cannot play streamed sound sample.... SkyriderDestroyed( ); - } - else - { - // otherwise it's handled in the callback - // remove any arrival events for the helicopter's group - DeleteStrategicEvent( EVENT_GROUP_ARRIVAL, pVehicleList[ iHelicopterVehicleId ].ubMovementGroup ); - } + } + else + { + // otherwise it's handled in the callback + // remove any arrival events for the helicopter's group + DeleteStrategicEvent( EVENT_GROUP_ARRIVAL, pVehicleList[ iHelicopterVehicleId ].ubMovementGroup ); + } // special return code indicating heli was destroyed return( TRUE ); @@ -1898,7 +1896,7 @@ BOOLEAN CanHelicopterTakeOff( void ) // if it's already in the air if( fHelicopterIsAirBorne == TRUE ) { - return( TRUE ); + return( TRUE ); } // grab location @@ -1927,9 +1925,8 @@ void AddHeliPeice( INT16 sGridNo, UINT16 sOStruct ) void AddHelicopterToMaps( BOOLEAN fAdd, UINT8 ubSite ) { - INT16 sGridNo = sRefuelStartGridNo[ ubSite ]; + INT16 sGridNo = sRefuelStartGridNo[ ubSite ]; INT16 sOStruct = 0; - INT16 usGridNo; INT16 sGridX, sGridY; INT16 sCentreGridX, sCentreGridY; @@ -1959,19 +1956,19 @@ void AddHelicopterToMaps( BOOLEAN fAdd, UINT8 ubSite ) InvalidateWorldRedundency(); SetRenderFlags( RENDER_FLAG_FULL ); - // ATE: If any mercs here, bump them off! + // ATE: If any mercs here, bump them off! ConvertGridNoToXY( sGridNo, &sCentreGridX, &sCentreGridY ); - for( sGridY = sCentreGridY - 5; sGridY < sCentreGridY + 5; sGridY++ ) + for( sGridY = sCentreGridY - 5; sGridY < sCentreGridY + 5; sGridY++ ) + { + for( sGridX = sCentreGridX - 5; sGridX < sCentreGridX + 5; sGridX++ ) { - for( sGridX = sCentreGridX - 5; sGridX < sCentreGridX + 5; sGridX++ ) - { - usGridNo = MAPROWCOLTOPOS( sGridY, sGridX ); + sGridNo = MAPROWCOLTOPOS( sGridY, sGridX ); - BumpAnyExistingMerc( usGridNo ); - } + BumpAnyExistingMerc( sGridNo ); } } + } else { // remove from the world @@ -2014,8 +2011,8 @@ BOOLEAN IsSkyriderIsFlyingInSector( INT16 sSectorX, INT16 sSectorY ) BOOLEAN IsGroupTheHelicopterGroup( GROUP *pGroup ) { if( ( iHelicopterVehicleId != -1 ) && VehicleIdIsValid( iHelicopterVehicleId ) && - ( pVehicleList[ iHelicopterVehicleId ].ubMovementGroup != 0 ) && - ( pVehicleList[ iHelicopterVehicleId ].ubMovementGroup == pGroup->ubGroupID ) ) + ( pVehicleList[ iHelicopterVehicleId ].ubMovementGroup != 0 ) && + ( pVehicleList[ iHelicopterVehicleId ].ubMovementGroup == pGroup->ubGroupID ) ) { return( TRUE ); } @@ -2029,7 +2026,7 @@ INT16 GetNumSafeSectorsInPath( void ) // get the last sector value in the helictoper's path PathStPtr pNode = NULL; UINT32 uiLocation = 0; - UINT32 uiCount = 0; + UINT32 uiCount = 0; INT32 iHeliSector = -1; GROUP *pGroup; @@ -2055,21 +2052,21 @@ INT16 GetNumSafeSectorsInPath( void ) // first node: skip it if that's the sector the chopper is currently in, AND // we're NOT gonna be changing directions (not actually performed until waypoints are rebuilt AFTER plotting is done) if ( ( ( INT32 ) pNode->uiSectorId == iHeliSector ) && ( pNode->pNext != NULL ) && - !GroupBetweenSectorsAndSectorXYIsInDifferentDirection( pGroup, ( UINT8 ) GET_X_FROM_STRATEGIC_INDEX( pNode->pNext->uiSectorId ), ( UINT8 ) GET_Y_FROM_STRATEGIC_INDEX( pNode->pNext->uiSectorId ) ) ) + !GroupBetweenSectorsAndSectorXYIsInDifferentDirection( pGroup, ( UINT8 ) GET_X_FROM_STRATEGIC_INDEX( pNode->pNext->uiSectorId ), ( UINT8 ) GET_Y_FROM_STRATEGIC_INDEX( pNode->pNext->uiSectorId ) ) ) { pNode = pNode->pNext; } while( pNode) { - uiLocation = pNode -> uiSectorId; + uiLocation = pNode->uiSectorId; - if ( !StrategicMap[ uiLocation ].fEnemyAirControlled ) - { - uiCount++; - } + if ( !StrategicMap[ uiLocation ].fEnemyAirControlled ) + { + uiCount++; + } - pNode = pNode ->pNext; + pNode = pNode->pNext; } } @@ -2082,22 +2079,22 @@ INT16 GetNumSafeSectorsInPath( void ) // we're NOT gonna be changing directions (not actually performed until waypoints are rebuilt AFTER plotting is done) // OR if the chopper has a mercpath, in which case this a continuation of it that would count the sector twice if ( ( ( ( INT32 ) pNode->uiSectorId == iHeliSector ) && ( pNode->pNext != NULL ) && - !GroupBetweenSectorsAndSectorXYIsInDifferentDirection( pGroup, ( UINT8 ) GET_X_FROM_STRATEGIC_INDEX( pNode->pNext->uiSectorId ), ( UINT8 ) GET_Y_FROM_STRATEGIC_INDEX( pNode->pNext->uiSectorId ) ) ) || - ( GetLengthOfPath( pVehicleList[ iHelicopterVehicleId ].pMercPath ) > 0 ) ) + !GroupBetweenSectorsAndSectorXYIsInDifferentDirection( pGroup, ( UINT8 ) GET_X_FROM_STRATEGIC_INDEX( pNode->pNext->uiSectorId ), ( UINT8 ) GET_Y_FROM_STRATEGIC_INDEX( pNode->pNext->uiSectorId ) ) ) || + ( GetLengthOfPath( pVehicleList[ iHelicopterVehicleId ].pMercPath ) > 0 ) ) { pNode = pNode->pNext; } while( pNode) { - uiLocation = pNode -> uiSectorId; + uiLocation = pNode->uiSectorId; - if ( !StrategicMap[ uiLocation ].fEnemyAirControlled ) - { - uiCount++; - } + if ( !StrategicMap[ uiLocation ].fEnemyAirControlled ) + { + uiCount++; + } - pNode = pNode ->pNext; + pNode = pNode->pNext; } } @@ -2110,7 +2107,7 @@ INT16 GetNumUnSafeSectorsInPath( void ) // get the last sector value in the helictoper's path PathStPtr pNode = NULL; UINT32 uiLocation = 0; - UINT32 uiCount = 0; + UINT32 uiCount = 0; INT32 iHeliSector = -1; GROUP *pGroup; @@ -2137,21 +2134,21 @@ INT16 GetNumUnSafeSectorsInPath( void ) // first node: skip it if that's the sector the chopper is currently in, AND // we're NOT gonna be changing directions (not actually performed until waypoints are rebuilt AFTER plotting is done) if ( ( ( INT32 ) pNode->uiSectorId == iHeliSector ) && ( pNode->pNext != NULL ) && - !GroupBetweenSectorsAndSectorXYIsInDifferentDirection( pGroup, ( UINT8 ) GET_X_FROM_STRATEGIC_INDEX( pNode->pNext->uiSectorId ), ( UINT8 ) GET_Y_FROM_STRATEGIC_INDEX( pNode->pNext->uiSectorId ) ) ) + !GroupBetweenSectorsAndSectorXYIsInDifferentDirection( pGroup, ( UINT8 ) GET_X_FROM_STRATEGIC_INDEX( pNode->pNext->uiSectorId ), ( UINT8 ) GET_Y_FROM_STRATEGIC_INDEX( pNode->pNext->uiSectorId ) ) ) { pNode = pNode->pNext; } while( pNode) { - uiLocation = pNode -> uiSectorId; + uiLocation = pNode->uiSectorId; - if ( StrategicMap[ uiLocation ].fEnemyAirControlled ) - { - uiCount++; - } + if ( StrategicMap[ uiLocation ].fEnemyAirControlled ) + { + uiCount++; + } - pNode = pNode ->pNext; + pNode = pNode->pNext; } } @@ -2163,22 +2160,22 @@ INT16 GetNumUnSafeSectorsInPath( void ) // we're NOT gonna be changing directions (not actually performed until waypoints are rebuilt AFTER plotting is done) // OR if the chopper has a mercpath, in which case this a continuation of it that would count the sector twice if ( ( ( ( INT32 ) pNode->uiSectorId == iHeliSector ) && ( pNode->pNext != NULL ) && - !GroupBetweenSectorsAndSectorXYIsInDifferentDirection( pGroup, ( UINT8 ) GET_X_FROM_STRATEGIC_INDEX( pNode->pNext->uiSectorId ), ( UINT8 ) GET_Y_FROM_STRATEGIC_INDEX( pNode->pNext->uiSectorId ) ) ) || - ( GetLengthOfPath( pVehicleList[ iHelicopterVehicleId ].pMercPath ) > 0 ) ) + !GroupBetweenSectorsAndSectorXYIsInDifferentDirection( pGroup, ( UINT8 ) GET_X_FROM_STRATEGIC_INDEX( pNode->pNext->uiSectorId ), ( UINT8 ) GET_Y_FROM_STRATEGIC_INDEX( pNode->pNext->uiSectorId ) ) ) || + ( GetLengthOfPath( pVehicleList[ iHelicopterVehicleId ].pMercPath ) > 0 ) ) { pNode = pNode->pNext; } while( pNode) { - uiLocation = pNode -> uiSectorId; + uiLocation = pNode->uiSectorId; - if ( StrategicMap[ uiLocation ].fEnemyAirControlled ) - { - uiCount++; - } + if ( StrategicMap[ uiLocation ].fEnemyAirControlled ) + { + uiCount++; + } - pNode = pNode ->pNext; + pNode = pNode->pNext; } } @@ -2283,7 +2280,7 @@ void MakeHeliReturnToBase( void ) // plot path to that sector pVehicleList[ iHelicopterVehicleId ].pMercPath = AppendStrategicPath( MoveToBeginningOfPathList( BuildAStrategicPath( NULL, GetLastSectorIdInVehiclePath( iHelicopterVehicleId ) , ( INT16 )( CALCULATE_STRATEGIC_INDEX( ubRefuelList[ iLocation ][ 0 ], ubRefuelList[ iLocation ][ 1 ] ) ) , pVehicleList[ iHelicopterVehicleId ].ubMovementGroup, FALSE /*, FALSE */ ) ), pVehicleList[ iHelicopterVehicleId ].pMercPath ); - pVehicleList[ iHelicopterVehicleId ].pMercPath = MoveToBeginningOfPathList( pVehicleList[ iHelicopterVehicleId ].pMercPath ); + pVehicleList[ iHelicopterVehicleId ].pMercPath = MoveToBeginningOfPathList( pVehicleList[ iHelicopterVehicleId ].pMercPath ); // rebuild the movement waypoints RebuildWayPointsForGroupPath( pVehicleList[ iHelicopterVehicleId ].pMercPath, pVehicleList[ iHelicopterVehicleId ].ubMovementGroup ); diff --git a/Strategic/Map Screen Helicopter.h b/Strategic/Map Screen Helicopter.h index 62520576..4c34ed51 100644 --- a/Strategic/Map Screen Helicopter.h +++ b/Strategic/Map Screen Helicopter.h @@ -5,8 +5,8 @@ #include "Soldier Control.h" // costs of flying through sectors -#define COST_AIRSPACE_SAFE 100 -#define COST_AIRSPACE_UNSAFE 1000 // VERY dangerous +#define COST_AIRSPACE_SAFE 100 +#define COST_AIRSPACE_UNSAFE 1000 // VERY dangerous #define MIN_PROGRESS_FOR_SKYRIDER_QUOTE_DOING_WELL 25 // scale of 0-100 #define MIN_REGRESS_FOR_SKYRIDER_QUOTE_DOING_BADLY 10 // scale of 0-100 @@ -29,7 +29,7 @@ #define BELIEVED_ENEMY_SECTOR 30 // may become unused #define ARRIVED_IN_NON_HOSTILE_SECTOR 31 #define HOVERING_A_WHILE 32 -#define RETURN_TO_BASE 33 +#define RETURN_TO_BASE 33 #define ENEMIES_SPOTTED_EN_ROUTE_IN_FRIENDLY_SECTOR_A 34 #define ENEMIES_SPOTTED_EN_ROUTE_IN_FRIENDLY_SECTOR_B 35 #define MENTION_HOSPITAL_IN_CAMBRIA 45 diff --git a/Strategic/Map Screen Interface Border.cpp b/Strategic/Map Screen Interface Border.cpp index 2b026a06..c9ccd8f4 100644 --- a/Strategic/Map Screen Interface Border.cpp +++ b/Strategic/Map Screen Interface Border.cpp @@ -34,7 +34,7 @@ // extern to anchored button in winbart97 extern GUI_BUTTON *gpAnchoredButton; -extern BOOLEAN gfAnchoredState; +extern BOOLEAN gfAnchoredState; // mouse levels MOUSE_REGION LevelMouseRegions[ 4 ]; @@ -130,7 +130,7 @@ void DrawTextOnMapBorder( void ) SetFontDestBuffer( guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); - //FindFontCenterCoordinates( MAP_INV_X_OFFSET + MAP_INVENTORY_POOL_SLOT_START_X, MAP_INVENTORY_POOL_SLOT_START_Y - 20, 630 - MAP_INVENTORY_POOL_SLOT_START_X, GetFontHeight( FONT14ARIAL ), sString, FONT14ARIAL, &sX, &sY ); + //FindFontCenterCoordinates( MAP_INV_X_OFFSET + MAP_INVENTORY_POOL_SLOT_START_X, MAP_INVENTORY_POOL_SLOT_START_Y - 20, 630 - MAP_INVENTORY_POOL_SLOT_START_X, GetFontHeight( FONT14ARIAL ), sString, FONT14ARIAL, &sX, &sY ); FindFontCenterCoordinates( 271, 18, SCREEN_WIDTH - 271, GetFontHeight( FONT14ARIAL ), sString, FONT14ARIAL, &sX, &sY ); @@ -147,10 +147,10 @@ void DrawTextOnMapBorder( void ) BOOLEAN LoadMapBorderGraphics( void ) { - // this procedure will load the graphics needed for the map border - VOBJECT_DESC VObjectDesc; + // this procedure will load the graphics needed for the map border + VOBJECT_DESC VObjectDesc; - // will load map border + // will load map border VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; if (iResolution == 0) @@ -176,7 +176,7 @@ BOOLEAN LoadMapBorderGraphics( void ) fCursorIsOnMapScrollButtons = FALSE; */ - + return ( TRUE ); } @@ -184,7 +184,7 @@ BOOLEAN LoadMapBorderGraphics( void ) void DeleteMapBorderGraphics( void ) { - // procedure will delete graphics loaded for map border + // procedure will delete graphics loaded for map border DeleteVideoObjectFromIndex( guiMapBorder ); // DeleteVideoObjectFromIndex( guiMapBorderCorner ); @@ -197,9 +197,9 @@ void DeleteMapBorderGraphics( void ) void RenderMapBorder( void ) { // renders the actual border to the guiSAVEBUFFER - HVOBJECT hHandle; + HVOBJECT hHandle; -/* +/* if( fDisabledMapBorder ) { return; @@ -214,7 +214,7 @@ void RenderMapBorder( void ) } // get and blt border - GetVideoObject(&hHandle, guiMapBorder ); + GetVideoObject(&hHandle, guiMapBorder ); BltVideoObject( guiSAVEBUFFER , hHandle, 0, MAP_BORDER_X, MAP_BORDER_Y, VO_BLT_SRCTRANSPARENCY,NULL ); if (iResolution == 1 || iResolution == 2) @@ -223,11 +223,11 @@ void RenderMapBorder( void ) } RestoreExternBackgroundRect( MAP_BORDER_X, MAP_BORDER_Y, SCREEN_WIDTH - MAP_BORDER_X, SCREEN_HEIGHT ); - + // show the level marker DisplayCurrentLevelMarker( ); - - + + return; } @@ -237,12 +237,12 @@ void RenderMapBorderCorner( void ) { // renders map border corner to the FRAME_BUFFER HVOBJECT hHandle; - + if( fDisabledMapBorder ) { return; } - + if( fShowMapInventoryPool ) { return; @@ -250,9 +250,9 @@ void RenderMapBorderCorner( void ) // get and blt corner - GetVideoObject(&hHandle, guiMapBorderCorner ); + GetVideoObject(&hHandle, guiMapBorderCorner ); BltVideoObject( FRAME_BUFFER , hHandle, 0,MAP_BORDER_CORNER_X, MAP_BORDER_CORNER_Y, VO_BLT_SRCTRANSPARENCY,NULL ); - + InvalidateRegion( MAP_BORDER_CORNER_X, MAP_BORDER_CORNER_Y, 635, 315); return; @@ -284,14 +284,14 @@ void RenderMapBorderEtaPopUp( void ) } // get and blt ETA box - GetVideoObject(&hHandle, guiMapBorderEtaPopUp ); + GetVideoObject(&hHandle, guiMapBorderEtaPopUp ); /*BltVideoObject( FRAME_BUFFER , hHandle, 0, MAP_BORDER_X + 215, 291, VO_BLT_SRCTRANSPARENCY,NULL ); - + InvalidateRegion( MAP_BORDER_X + 215, 291, MAP_BORDER_X + 215 + 100 , 310);*/ BltVideoObject( FRAME_BUFFER , hHandle, 0, MAP_BORDER_X + MAP_BORDER_X_OFFSET + 215, MAP_BORDER_Y_OFFSET + 291, VO_BLT_SRCTRANSPARENCY,NULL ); - + InvalidateRegion( MAP_BORDER_X + MAP_BORDER_X_OFFSET + 215, MAP_BORDER_Y_OFFSET + 291, MAP_BORDER_X + MAP_BORDER_X_OFFSET + 215 + 100 , MAP_BORDER_Y_OFFSET + 310); return; @@ -304,25 +304,25 @@ BOOLEAN CreateButtonsForMapBorder( void ) /* // up button guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_UP ] = LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,11,4,-1,6,-1 ); - guiMapBorderScrollButtons[ ZOOM_MAP_SCROLL_UP ] = QuickCreateButton( guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_UP ], 602, 303, + guiMapBorderScrollButtons[ ZOOM_MAP_SCROLL_UP ] = QuickCreateButton( guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_UP ], 602, 303, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnScrollNorthMapScreenCallback); // dwn button guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_DWN ] = LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,12,5,-1,7,-1 ); - guiMapBorderScrollButtons[ ZOOM_MAP_SCROLL_DWN ] = QuickCreateButton( guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_DWN ], 602, 338, + guiMapBorderScrollButtons[ ZOOM_MAP_SCROLL_DWN ] = QuickCreateButton( guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_DWN ], 602, 338, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnScrollSouthMapScreenCallback); - + // left button guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_LEFT ] = LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,9,0,-1,2,-1 ); - guiMapBorderScrollButtons[ ZOOM_MAP_SCROLL_LEFT ] = QuickCreateButton( guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_LEFT ], 584, 322, + guiMapBorderScrollButtons[ ZOOM_MAP_SCROLL_LEFT ] = QuickCreateButton( guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_LEFT ], 584, 322, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnScrollWestMapScreenCallback); - + // right button guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_RIGHT ] = LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,10,1,-1,3,-1 ); - guiMapBorderScrollButtons[ ZOOM_MAP_SCROLL_RIGHT ] = QuickCreateButton( guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_RIGHT ], 619, 322, + guiMapBorderScrollButtons[ ZOOM_MAP_SCROLL_RIGHT ] = QuickCreateButton( guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_RIGHT ], 619, 322, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnScrollEastMapScreenCallback); @@ -335,38 +335,38 @@ BOOLEAN CreateButtonsForMapBorder( void ) // towns giMapBorderButtonsImage[ MAP_BORDER_TOWN_BTN ] = LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,5,-1,14,-1 ); - giMapBorderButtons[ MAP_BORDER_TOWN_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_TOWN_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 - 152), (SCREEN_HEIGHT - 160), + giMapBorderButtons[ MAP_BORDER_TOWN_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_TOWN_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 - 152), (SCREEN_HEIGHT - 160), BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnTownCallback); - + // mines giMapBorderButtonsImage[ MAP_BORDER_MINE_BTN ] = LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,4,-1,13,-1 ); - giMapBorderButtons[ MAP_BORDER_MINE_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_MINE_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 - 109), (SCREEN_HEIGHT - 160), + giMapBorderButtons[ MAP_BORDER_MINE_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_MINE_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 - 109), (SCREEN_HEIGHT - 160), BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnMineCallback); - + // people giMapBorderButtonsImage[ MAP_BORDER_TEAMS_BTN ] = LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,3,-1,12,-1 ); - giMapBorderButtons[ MAP_BORDER_TEAMS_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_TEAMS_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 - 66), (SCREEN_HEIGHT - 160), + giMapBorderButtons[ MAP_BORDER_TEAMS_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_TEAMS_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 - 66), (SCREEN_HEIGHT - 160), BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnTeamCallback); - + // militia giMapBorderButtonsImage[ MAP_BORDER_MILITIA_BTN ] = LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,8,-1,17,-1 ); - giMapBorderButtons[ MAP_BORDER_MILITIA_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_MILITIA_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 - 23), (SCREEN_HEIGHT - 160), + giMapBorderButtons[ MAP_BORDER_MILITIA_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_MILITIA_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 - 23), (SCREEN_HEIGHT - 160), BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnMilitiaCallback); - + // airspace giMapBorderButtonsImage[ MAP_BORDER_AIRSPACE_BTN ] = LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,2,-1,11,-1 ); - giMapBorderButtons[ MAP_BORDER_AIRSPACE_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_AIRSPACE_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 + 20), (SCREEN_HEIGHT - 160), + giMapBorderButtons[ MAP_BORDER_AIRSPACE_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_AIRSPACE_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 + 20), (SCREEN_HEIGHT - 160), BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnAircraftCallback); - + // items giMapBorderButtonsImage[ MAP_BORDER_ITEM_BTN ] = LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,1,-1,10,-1 ); - giMapBorderButtons[ MAP_BORDER_ITEM_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_ITEM_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 + 63), (SCREEN_HEIGHT - 160), + giMapBorderButtons[ MAP_BORDER_ITEM_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_ITEM_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 + 63), (SCREEN_HEIGHT - 160), BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnItemCallback); @@ -381,7 +381,7 @@ BOOLEAN CreateButtonsForMapBorder( void ) (GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnRaiseLevelBtnCallback); // lower - guiMapBorderLandRaiseButtonsImage[ MAP_BORDER_LOWER_LEVEL ] = LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,12,5,-1,7,-1 ); + guiMapBorderLandRaiseButtonsImage[ MAP_BORDER_LOWER_LEVEL ] = LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,12,5,-1,7,-1 ); guiMapBorderLandRaiseButtons[ MAP_BORDER_LOWER_LEVEL ] = QuickCreateButton( guiMapBorderLandRaiseButtonsImage[ MAP_BORDER_LOWER_LEVEL ], MAP_BORDER_X + 264, 340, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnLowerLevelBtnCallback); @@ -468,7 +468,7 @@ void DeleteMapBorderButtons( void ) /* void BtnLowerLevelBtnCallback(GUI_BUTTON *btn,INT32 reason) { - + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { @@ -480,19 +480,19 @@ void BtnLowerLevelBtnCallback(GUI_BUTTON *btn,INT32 reason) MarkButtonsDirty( ); - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); - // go down one level - GoDownOneLevelInMap( ); + // go down one level + GoDownOneLevelInMap( ); } - } -} + } +} void BtnRaiseLevelBtnCallback(GUI_BUTTON *btn,INT32 reason) @@ -505,21 +505,21 @@ void BtnRaiseLevelBtnCallback(GUI_BUTTON *btn,INT32 reason) fMapPanelDirty = TRUE; } - + MarkButtonsDirty( ); - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); // go up one level - GoUpOneLevelInMap( ); + GoUpOneLevelInMap( ); } - } -} + } +} */ @@ -548,7 +548,7 @@ void BtnTeamCallback(GUI_BUTTON *btn,INT32 reason) { CommonBtnCallbackBtnDownChecks(); } -} +} void BtnTownCallback(GUI_BUTTON *btn,INT32 reason) @@ -557,12 +557,12 @@ void BtnTownCallback(GUI_BUTTON *btn,INT32 reason) { CommonBtnCallbackBtnDownChecks(); ToggleShowTownsMode(); - } + } else if(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN ) { CommonBtnCallbackBtnDownChecks(); } -} +} void BtnMineCallback(GUI_BUTTON *btn,INT32 reason) @@ -576,17 +576,17 @@ void BtnMineCallback(GUI_BUTTON *btn,INT32 reason) { CommonBtnCallbackBtnDownChecks(); } -} +} void BtnAircraftCallback(GUI_BUTTON *btn,INT32 reason) { - if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) - { + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { CommonBtnCallbackBtnDownChecks(); ToggleAirspaceMode(); - } + } else if(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN ) { CommonBtnCallbackBtnDownChecks(); @@ -596,17 +596,17 @@ void BtnAircraftCallback(GUI_BUTTON *btn,INT32 reason) void BtnItemCallback(GUI_BUTTON *btn,INT32 reason) { - if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) - { + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { CommonBtnCallbackBtnDownChecks(); ToggleItemsFilter(); - } + } else if(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN ) { CommonBtnCallbackBtnDownChecks(); } -} +} /* @@ -622,40 +622,40 @@ void BtnZoomCallback(GUI_BUTTON *btn,INT32 reason) if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - fZoomFlag=FALSE; + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fZoomFlag=FALSE; } else { - btn->uiFlags|=(BUTTON_CLICKED_ON); - fZoomFlag=TRUE; - if( sSelMapX > 14 ) - { - iZoomX = ( ( sSelMapX + 2 ) / 2 ) * ( MAP_GRID_X * 2 ); - } - else - { - iZoomX=sSelMapX/2*MAP_GRID_X*2; - } - - if( sOldSelMapY > 14 ) - { - iZoomY = ( ( sSelMapY + 2 ) / 2 ) * ( MAP_GRID_Y * 2 ); - } - else - { - iZoomY=sSelMapY/2*MAP_GRID_Y*2; - } - + btn->uiFlags|=(BUTTON_CLICKED_ON); + fZoomFlag=TRUE; + if( sSelMapX > 14 ) + { + iZoomX = ( ( sSelMapX + 2 ) / 2 ) * ( MAP_GRID_X * 2 ); + } + else + { + iZoomX=sSelMapX/2*MAP_GRID_X*2; } - fMapPanelDirty=TRUE; - } + if( sOldSelMapY > 14 ) + { + iZoomY = ( ( sSelMapY + 2 ) / 2 ) * ( MAP_GRID_Y * 2 ); + } + else + { + iZoomY=sSelMapY/2*MAP_GRID_Y*2; + } + + } + + fMapPanelDirty=TRUE; + } else if(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN ) { CommonBtnCallbackBtnDownChecks(); } -} +} */ @@ -864,15 +864,15 @@ void ShowDestinationOfPlottedPath( STR16 pLoc ) INT16 sFontX, sFontY; SetFontDestBuffer( FRAME_BUFFER, 0, 0, 640, 480, FALSE ); - + SetFont( COMPFONT ); SetFontForeground( 183 ); SetFontBackground( FONT_BLACK ); - VarFindFontCenterCoordinates( 461, 344, 70, 12, COMPFONT, &sFontX, &sFontY, pLoc ); + VarFindFontCenterCoordinates( 461, 344, 70, 12, COMPFONT, &sFontX, &sFontY, pLoc ); gprintfdirty(sFontX, sFontY, pLoc ); - mprintf(sFontX, sFontY, pLoc ); - + mprintf(sFontX, sFontY, pLoc ); + return; } */ @@ -882,9 +882,9 @@ void BtnScrollNorthMapScreenCallback( GUI_BUTTON *btn,INT32 reason ) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - + // not zoomed in?...don't push down - if( fZoomFlag == FALSE ) + if( fZoomFlag == FALSE ) { return; } @@ -895,21 +895,21 @@ void BtnScrollNorthMapScreenCallback( GUI_BUTTON *btn,INT32 reason ) fMapPanelDirty = TRUE; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - giScrollButtonState = NORTH_DIR; - fMapScrollDueToPanelButton = TRUE; - } - } + btn->uiFlags&=~(BUTTON_CLICKED_ON); + giScrollButtonState = NORTH_DIR; + fMapScrollDueToPanelButton = TRUE; + } + } if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) { giScrollButtonState = NORTH_DIR; - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } } @@ -918,45 +918,9 @@ void BtnScrollSouthMapScreenCallback( GUI_BUTTON *btn,INT32 reason ) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - + // not zoomed in?...don't push down - if( fZoomFlag == FALSE ) - { - return; - } - - // are help messages being displayed?..redraw - if( ScrollButtonsDisplayingHelpMessage( ) ) - { - fMapPanelDirty = TRUE; - } - - btn->uiFlags|=(BUTTON_CLICKED_ON); - } - else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) - { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - giScrollButtonState = SOUTH_DIR; - fMapScrollDueToPanelButton = TRUE; - - } - } - if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) - { - giScrollButtonState = SOUTH_DIR; - btn->uiFlags|=(BUTTON_CLICKED_ON); - } -} - -void BtnScrollEastMapScreenCallback( GUI_BUTTON *btn,INT32 reason ) -{ - - if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) - { - // not zoomed in?...don't push down - if( fZoomFlag == FALSE ) + if( fZoomFlag == FALSE ) { return; } @@ -967,22 +931,58 @@ void BtnScrollEastMapScreenCallback( GUI_BUTTON *btn,INT32 reason ) fMapPanelDirty = TRUE; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - giScrollButtonState = EAST_DIR; - fMapScrollDueToPanelButton = TRUE; + btn->uiFlags&=~(BUTTON_CLICKED_ON); + giScrollButtonState = SOUTH_DIR; + fMapScrollDueToPanelButton = TRUE; - } - } + } + } if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) { - giScrollButtonState = EAST_DIR; - btn->uiFlags|=(BUTTON_CLICKED_ON); + giScrollButtonState = SOUTH_DIR; + btn->uiFlags|=(BUTTON_CLICKED_ON); + } +} + +void BtnScrollEastMapScreenCallback( GUI_BUTTON *btn,INT32 reason ) +{ + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + // not zoomed in?...don't push down + if( fZoomFlag == FALSE ) + { + return; + } + + // are help messages being displayed?..redraw + if( ScrollButtonsDisplayingHelpMessage( ) ) + { + fMapPanelDirty = TRUE; + } + + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + giScrollButtonState = EAST_DIR; + fMapScrollDueToPanelButton = TRUE; + + } + } + if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) + { + giScrollButtonState = EAST_DIR; + btn->uiFlags|=(BUTTON_CLICKED_ON); } } @@ -992,8 +992,8 @@ void BtnScrollWestMapScreenCallback( GUI_BUTTON *btn,INT32 reason ) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - // not zoomed in?...don't push down - if( fZoomFlag == FALSE ) + // not zoomed in?...don't push down + if( fZoomFlag == FALSE ) { return; } @@ -1004,47 +1004,47 @@ void BtnScrollWestMapScreenCallback( GUI_BUTTON *btn,INT32 reason ) fMapPanelDirty = TRUE; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - giScrollButtonState = WEST_DIR; - fMapScrollDueToPanelButton = TRUE; + btn->uiFlags&=~(BUTTON_CLICKED_ON); + giScrollButtonState = WEST_DIR; + fMapScrollDueToPanelButton = TRUE; - } - } + } + } if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) { - giScrollButtonState = WEST_DIR; - btn->uiFlags|=(BUTTON_CLICKED_ON); + giScrollButtonState = WEST_DIR; + btn->uiFlags|=(BUTTON_CLICKED_ON); } } -void MapScrollButtonMvtCheck( void ) +void MapScrollButtonMvtCheck( void ) { // run through each button's mouse region, if mouse cursor there...don't show map white sector highlight fCursorIsOnMapScrollButtons = FALSE; - if( ButtonList[ guiMapBorderScrollButtons[ 0 ] ] ->Area.uiFlags & MSYS_MOUSE_IN_AREA ) + if( ButtonList[ guiMapBorderScrollButtons[ 0 ] ]->Area.uiFlags & MSYS_MOUSE_IN_AREA ) { fCursorIsOnMapScrollButtons = TRUE; } - if( ButtonList[ guiMapBorderScrollButtons[ 1 ] ] ->Area.uiFlags & MSYS_MOUSE_IN_AREA ) + if( ButtonList[ guiMapBorderScrollButtons[ 1 ] ]->Area.uiFlags & MSYS_MOUSE_IN_AREA ) { fCursorIsOnMapScrollButtons = TRUE; } - if( ButtonList[ guiMapBorderScrollButtons[ 2 ] ] ->Area.uiFlags & MSYS_MOUSE_IN_AREA ) + if( ButtonList[ guiMapBorderScrollButtons[ 2 ] ]->Area.uiFlags & MSYS_MOUSE_IN_AREA ) { fCursorIsOnMapScrollButtons = TRUE; } - if( ButtonList[ guiMapBorderScrollButtons[ 3 ] ] ->Area.uiFlags & MSYS_MOUSE_IN_AREA ) + if( ButtonList[ guiMapBorderScrollButtons[ 3 ] ]->Area.uiFlags & MSYS_MOUSE_IN_AREA ) { fCursorIsOnMapScrollButtons = TRUE; } @@ -1082,21 +1082,21 @@ void HandleMapScrollButtonStates( void ) if( fZoomFlag ) { EnableButton( guiMapBorderScrollButtons[ 0 ]); - EnableButton( guiMapBorderScrollButtons[ 1 ]); - EnableButton( guiMapBorderScrollButtons[ 2 ]); - EnableButton( guiMapBorderScrollButtons[ 3 ]); - - UpdateScrollButtonStatesWhileScrolling( ); + EnableButton( guiMapBorderScrollButtons[ 1 ]); + EnableButton( guiMapBorderScrollButtons[ 2 ]); + EnableButton( guiMapBorderScrollButtons[ 3 ]); + + UpdateScrollButtonStatesWhileScrolling( ); } else { DisableButton( guiMapBorderScrollButtons[ 0 ]); - DisableButton( guiMapBorderScrollButtons[ 1 ]); - DisableButton( guiMapBorderScrollButtons[ 2 ]); - DisableButton( guiMapBorderScrollButtons[ 3 ]); - + DisableButton( guiMapBorderScrollButtons[ 1 ]); + DisableButton( guiMapBorderScrollButtons[ 2 ]); + DisableButton( guiMapBorderScrollButtons[ 3 ]); + } // check mvt too @@ -1112,15 +1112,15 @@ void HandleMapScrollButtonStates( void ) void BtnGenericMouseMoveButtonCallbackForMapBorder(GUI_BUTTON *btn,INT32 reason) { //If the button isn't the anchored button, then we don't want to modify the button state. - + if( btn != gpAnchoredButton ) { if( reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { if( btn->Area.uiFlags & MSYS_FASTHELP ) - { - // redraw area - fMapPanelDirty = TRUE; + { + // redraw area + fMapPanelDirty = TRUE; } } return; @@ -1129,15 +1129,15 @@ void BtnGenericMouseMoveButtonCallbackForMapBorder(GUI_BUTTON *btn,INT32 reason) if( reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { if( !gfAnchoredState ) - btn->uiFlags &= (~BUTTON_CLICKED_ON ); + btn->uiFlags &= (~BUTTON_CLICKED_ON ); InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } else if( reason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) { - btn->uiFlags |= BUTTON_CLICKED_ON ; + btn->uiFlags |= BUTTON_CLICKED_ON ; InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} /* @@ -1162,7 +1162,7 @@ void DisplayCurrentLevelMarker( void ) { // display the current level marker on the map border HVOBJECT hHandle; - + /* if( fDisabledMapBorder ) { @@ -1171,7 +1171,7 @@ void DisplayCurrentLevelMarker( void ) */ // it's actually a white rectangle, not a green arrow! - GetVideoObject(&hHandle, guiLEVELMARKER ); + GetVideoObject(&hHandle, guiLEVELMARKER ); BltVideoObject( guiSAVEBUFFER , hHandle, 0, MAP_LEVEL_MARKER_X + 1, MAP_LEVEL_MARKER_Y + ( MAP_LEVEL_MARKER_DELTA * ( INT16 )iCurrentMapSectorZ ), VO_BLT_SRCTRANSPARENCY,NULL ); RestoreExternBackgroundRect(MAP_LEVEL_MARKER_X + 1, MAP_LEVEL_MARKER_Y + ( MAP_LEVEL_MARKER_DELTA * ( INT16 )iCurrentMapSectorZ ), 55, 9); @@ -1185,17 +1185,17 @@ void CreateMouseRegionsForLevelMarkers( void ) { INT16 sCounter = 0; CHAR16 sString[ 64 ]; - - for( sCounter = 0; sCounter < 4 ; sCounter++ ) + + for( sCounter = 0; sCounter < 4 ; sCounter++ ) { - MSYS_DefineRegion(&LevelMouseRegions[ sCounter ], MAP_LEVEL_MARKER_X, ( INT16 )( MAP_LEVEL_MARKER_Y + ( MAP_LEVEL_MARKER_DELTA * sCounter ) ), MAP_LEVEL_MARKER_X + MAP_LEVEL_MARKER_WIDTH, ( INT16 )( MAP_LEVEL_MARKER_Y + ( MAP_LEVEL_MARKER_DELTA * ( sCounter + 1 ) ) ), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, + MSYS_DefineRegion(&LevelMouseRegions[ sCounter ], MAP_LEVEL_MARKER_X, ( INT16 )( MAP_LEVEL_MARKER_Y + ( MAP_LEVEL_MARKER_DELTA * sCounter ) ), MAP_LEVEL_MARKER_X + MAP_LEVEL_MARKER_WIDTH, ( INT16 )( MAP_LEVEL_MARKER_Y + ( MAP_LEVEL_MARKER_DELTA * ( sCounter + 1 ) ) ), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, LevelMarkerBtnCallback ); MSYS_SetRegionUserData(&LevelMouseRegions[sCounter],0,sCounter); swprintf( sString, L"%s %d", zMarksMapScreenText[ 0 ], sCounter + 1 ); SetRegionFastHelpText( &LevelMouseRegions[ sCounter ], sString ); - } + } } @@ -1208,7 +1208,7 @@ void DeleteMouseRegionsForLevelMarkers( void ) for( sCounter = 0; sCounter < 4; sCounter++ ) { - MSYS_RemoveRegion( &LevelMouseRegions[ sCounter ] ); + MSYS_RemoveRegion( &LevelMouseRegions[ sCounter ] ); } } @@ -1216,7 +1216,7 @@ void LevelMarkerBtnCallback(MOUSE_REGION * pRegion, INT32 iReason ) { // btn callback handler for assignment screen mask region INT32 iCounter = 0; - + iCounter = MSYS_GetRegionUserData( pRegion, 0 ); if( ( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP ) ) @@ -1352,7 +1352,7 @@ void TurnOnAirSpaceMode( void ) } - // if showing underground + // if showing underground if ( iCurrentMapSectorZ != 0 ) { // switch to the surface @@ -1507,7 +1507,7 @@ void InitializeMapBorderButtonStates( void ) { MapBorderButtonOff( MAP_BORDER_MINE_BTN ); } - + if( fShowTeamFlag ) { MapBorderButtonOn( MAP_BORDER_TEAMS_BTN ); @@ -1516,7 +1516,7 @@ void InitializeMapBorderButtonStates( void ) { MapBorderButtonOff( MAP_BORDER_TEAMS_BTN ); } - + if( fShowAircraftFlag ) { MapBorderButtonOn( MAP_BORDER_AIRSPACE_BTN ); @@ -1547,7 +1547,7 @@ BOOLEAN DoesPlayerHaveAnyMilitia( void ) { for( sY = 1; sY < MAP_WORLD_Y - 1; sY++ ) { - if( ( SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ GREEN_MILITIA ] + SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] + if( ( SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ GREEN_MILITIA ] + SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] + SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ ELITE_MILITIA ] ) > 0 ) { // found at least one diff --git a/Strategic/Map Screen Interface Border.h b/Strategic/Map Screen Interface Border.h index 4d07c281..7430dc96 100644 --- a/Strategic/Map Screen Interface Border.h +++ b/Strategic/Map Screen Interface Border.h @@ -3,8 +3,8 @@ #include "Types.h" -//#define MAP_BORDER_START_X 261 -//#define MAP_BORDER_START_Y 0 +//#define MAP_BORDER_START_X 261 +//#define MAP_BORDER_START_Y 0 @@ -12,16 +12,16 @@ // scroll directions enum{ ZOOM_MAP_SCROLL_UP =0, - ZOOM_MAP_SCROLL_DWN, + ZOOM_MAP_SCROLL_DWN, ZOOM_MAP_SCROLL_RIGHT, ZOOM_MAP_SCROLL_LEFT, }; enum{ - EAST_DIR = 0, - WEST_DIR, - NORTH_DIR, - SOUTH_DIR, + EAST_DIR = 0, + WEST_DIR, + NORTH_DIR, + SOUTH_DIR, }; enum{ MAP_BORDER_TOWN_BTN =0, @@ -92,7 +92,7 @@ void EnableMapBorderRegion( void ); void DeleteMapBorderButtons( void ); BOOLEAN CreateButtonsForMapBorder( void ); -// render the pop up for eta in path plotting in map screen +// render the pop up for eta in path plotting in map screen void RenderMapBorderEtaPopUp( void ); BOOLEAN DoesPlayerHaveAnyMilitia( void ); diff --git a/Strategic/Map Screen Interface Bottom.cpp b/Strategic/Map Screen Interface Bottom.cpp index 138d7a22..06b0ea5a 100644 --- a/Strategic/Map Screen Interface Bottom.cpp +++ b/Strategic/Map Screen Interface Bottom.cpp @@ -51,17 +51,23 @@ #include "SaveLoadScreen.h" #endif +/* CHRISL: Adjusted settings to allow new Map_Screen_Bottom_800x600.sti to work. This is needed if we +want to have the new inventory panel not overlap the message text area. */ #define MAP_BOTTOM_X 0 #define MAP_BOTTOM_Y (SCREEN_HEIGHT - 121) //359 -#define MESSAGE_SCROLL_AREA_START_X 330 -#define MESSAGE_SCROLL_AREA_END_X 344 +//#define MESSAGE_SCROLL_AREA_START_X (SCREEN_WIDTH - 534) //330 +//#define MESSAGE_SCROLL_AREA_END_X (SCREEN_WIDTH - 522) //344 #define MESSAGE_SCROLL_AREA_WIDTH ( MESSAGE_SCROLL_AREA_END_X - MESSAGE_SCROLL_AREA_START_X + 1 ) #define MESSAGE_SCROLL_AREA_START_Y (SCREEN_HEIGHT - 90) //390 #define MESSAGE_SCROLL_AREA_END_Y (SCREEN_HEIGHT - 32) //448 #define MESSAGE_SCROLL_AREA_HEIGHT ( MESSAGE_SCROLL_AREA_END_Y - MESSAGE_SCROLL_AREA_START_Y + 1 ) +// CHRISL: Use these if we want scroll bar based on left edge of screen +#define MESSAGE_SCROLL_AREA_START_X 330 +#define MESSAGE_SCROLL_AREA_END_X 344 + #define SLIDER_HEIGHT 11 #define SLIDER_WIDTH 11 @@ -79,7 +85,7 @@ /* // delay to start auto message scroll #define DELAY_TO_START_MESSAGE_SCROLL 3000 -// delay per auto message scroll +// delay per auto message scroll #define DELAY_PER_MESSAGE_SCROLL 300 */ @@ -160,6 +166,7 @@ extern BOOLEAN fShowDescriptionFlag; extern MOUSE_REGION gMPanelRegion; +extern BOOLEAN gfDisableTacticalPanelButtons; // PROTOTYPES @@ -210,9 +217,9 @@ void MapScreenMessageScrollBarCallBack(MOUSE_REGION * pRegion, INT32 iReason ); void HandleLoadOfMapBottomGraphics( void ) { // will load the graphics needed for the mapscreen interface bottom - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; - // will create buttons for interface bottom + // will create buttons for interface bottom VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; if (iResolution == 0) @@ -245,7 +252,7 @@ BOOLEAN LoadMapScreenInterfaceBottom( void ) // create pause region CreateCompressModePause( ); - + return( TRUE ); } @@ -273,24 +280,27 @@ void DeleteMapScreenInterfaceBottom( void ) } -void RenderMapScreenInterfaceBottom( void ) +// Headrock: this function used to accept no arguments. It now accepts a Boolean so it can be forced to run +// the whole process when we call it from other files. See also .h file!!! +void RenderMapScreenInterfaceBottom( BOOLEAN fForceMapscreenFullRender ) { // will render the map screen bottom interface HVOBJECT hHandle; CHAR8 bFilename[ 32 ]; - + fDisplayOverheadMap = FALSE; // render whole panel - if( fMapScreenBottomDirty == TRUE ) + // HEADROCK Changed this line to accept outside influence through the new boolean: + if ( fForceMapscreenFullRender == TRUE || fMapScreenBottomDirty == TRUE ) { // get and blt panel - GetVideoObject(&hHandle, guiMAPBOTTOMPANEL ); - BltVideoObject( guiSAVEBUFFER , hHandle, 0, MAP_BOTTOM_X, MAP_BOTTOM_Y, VO_BLT_SRCTRANSPARENCY,NULL ); + GetVideoObject(&hHandle, guiMAPBOTTOMPANEL ); + BltVideoObject( guiSAVEBUFFER , hHandle, 0, MAP_BOTTOM_X, MAP_BOTTOM_Y, VO_BLT_SRCTRANSPARENCY,NULL ); if( GetSectorFlagStatus( sSelMapX, sSelMapY, ( UINT8 )iCurrentMapSectorZ, SF_ALREADY_VISITED ) == TRUE ) { - GetMapFileName( sSelMapX, sSelMapY, ( UINT8 )iCurrentMapSectorZ, bFilename, TRUE, TRUE ); + GetMapFileName( sSelMapX, sSelMapY, ( UINT8 )iCurrentMapSectorZ, bFilename, TRUE, TRUE ); LoadRadarScreenBitmap( bFilename ); } else @@ -307,7 +317,7 @@ void RenderMapScreenInterfaceBottom( void ) MarkButtonsDirty( ); // invalidate region - RestoreExternBackgroundRect( MAP_BOTTOM_X, MAP_BOTTOM_Y, SCREEN_WIDTH, SCREEN_HEIGHT - MAP_BOTTOM_Y ); + RestoreExternBackgroundRect( MAP_BOTTOM_X, MAP_BOTTOM_Y, SCREEN_WIDTH - MAP_BOTTOM_X, SCREEN_HEIGHT - MAP_BOTTOM_Y ); // re render radar map RenderRadarScreen( ); @@ -315,6 +325,9 @@ void RenderMapScreenInterfaceBottom( void ) // reset dirty flag fMapScreenBottomDirty = FALSE; fMapBottomDirtied = TRUE; + + // Headrock: Moved this next line from the above marker ^ + fMapScreenBottomDirty = FALSE; } DisplayCompressMode( ); @@ -324,13 +337,16 @@ void RenderMapScreenInterfaceBottom( void ) // draw the name of the loaded sector DrawNameOfLoadedSector( ); - + // display slider on the scroll bar DisplayScrollBarSlider( ); + // CHRISL: Don't display messagelist if inventory panel is open + // CHRISL: Only run this condition if we're drawing the message list on the left // display messages that can be scrolled through - DisplayStringsInMapScreenMessageList( ); - + if(!fShowInventoryFlag) + DisplayStringsInMapScreenMessageList( ); + // handle auto scroll //CheckForAndHandleAutoMessageScroll( ); @@ -346,25 +362,25 @@ void RenderMapScreenInterfaceBottom( void ) BOOLEAN CreateButtonsForMapScreenInterfaceBottom( void ) { // laptop - guiMapBottomExitButtonsImage[ MAP_EXIT_TO_LAPTOP ]= LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,6,-1,15,-1 ); - guiMapBottomExitButtons[ MAP_EXIT_TO_LAPTOP ] = QuickCreateButton( guiMapBottomExitButtonsImage[ MAP_EXIT_TO_LAPTOP ], (SCREEN_WIDTH - 184), (SCREEN_HEIGHT - 70), + guiMapBottomExitButtonsImage[ MAP_EXIT_TO_LAPTOP ]= LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,6,-1,15,-1 ); + guiMapBottomExitButtons[ MAP_EXIT_TO_LAPTOP ] = QuickCreateButton( guiMapBottomExitButtonsImage[ MAP_EXIT_TO_LAPTOP ], (SCREEN_WIDTH - 184), (SCREEN_HEIGHT - 70), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnLaptopCallback); - + // tactical - guiMapBottomExitButtonsImage[ MAP_EXIT_TO_TACTICAL ]= LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,7,-1,16,-1 ); - + guiMapBottomExitButtonsImage[ MAP_EXIT_TO_TACTICAL ]= LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,7,-1,16,-1 ); + guiMapBottomExitButtons[ MAP_EXIT_TO_TACTICAL ] = QuickCreateButton( guiMapBottomExitButtonsImage[ MAP_EXIT_TO_TACTICAL ], (SCREEN_WIDTH - 144), (SCREEN_HEIGHT - 70), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnTacticalCallback); // options - guiMapBottomExitButtonsImage[ MAP_EXIT_TO_OPTIONS ]= LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,18,-1,19,-1 ); - guiMapBottomExitButtons[ MAP_EXIT_TO_OPTIONS ] = QuickCreateButton( guiMapBottomExitButtonsImage[ MAP_EXIT_TO_OPTIONS ], (SCREEN_WIDTH - 182), (SCREEN_HEIGHT - 108), + guiMapBottomExitButtonsImage[ MAP_EXIT_TO_OPTIONS ]= LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,18,-1,19,-1 ); + guiMapBottomExitButtons[ MAP_EXIT_TO_OPTIONS ] = QuickCreateButton( guiMapBottomExitButtonsImage[ MAP_EXIT_TO_OPTIONS ], (SCREEN_WIDTH - 182), (SCREEN_HEIGHT - 108), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnOptionsFromMapScreenCallback); - - + + SetButtonFastHelpText( guiMapBottomExitButtons[ 0 ], pMapScreenBottomFastHelp[ 0 ] ); SetButtonFastHelpText( guiMapBottomExitButtons[ 1 ], pMapScreenBottomFastHelp[ 1 ] ); SetButtonFastHelpText( guiMapBottomExitButtons[ 2 ], pMapScreenBottomFastHelp[ 2 ] ); @@ -375,37 +391,45 @@ BOOLEAN CreateButtonsForMapScreenInterfaceBottom( void ) // time compression buttons - guiMapBottomTimeButtonsImage[ MAP_TIME_COMPRESS_MORE ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,10,1,-1,3,-1 ); - guiMapBottomTimeButtons[ MAP_TIME_COMPRESS_MORE ] = QuickCreateButton( guiMapBottomTimeButtonsImage[ MAP_TIME_COMPRESS_MORE ], (SCREEN_WIDTH - 112), (SCREEN_HEIGHT - 24), + guiMapBottomTimeButtonsImage[ MAP_TIME_COMPRESS_MORE ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,10,1,-1,3,-1 ); + guiMapBottomTimeButtons[ MAP_TIME_COMPRESS_MORE ] = QuickCreateButton( guiMapBottomTimeButtonsImage[ MAP_TIME_COMPRESS_MORE ], (SCREEN_WIDTH - 112), (SCREEN_HEIGHT - 24), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 2 , (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnTimeCompressMoreMapScreenCallback); - - guiMapBottomTimeButtonsImage[ MAP_TIME_COMPRESS_LESS ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,9,0,-1,2,-1 ); - guiMapBottomTimeButtons[ MAP_TIME_COMPRESS_LESS ] = QuickCreateButton( guiMapBottomTimeButtonsImage[ MAP_TIME_COMPRESS_LESS ], (SCREEN_WIDTH - 174), (SCREEN_HEIGHT - 24), + + guiMapBottomTimeButtonsImage[ MAP_TIME_COMPRESS_LESS ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,9,0,-1,2,-1 ); + guiMapBottomTimeButtons[ MAP_TIME_COMPRESS_LESS ] = QuickCreateButton( guiMapBottomTimeButtonsImage[ MAP_TIME_COMPRESS_LESS ], (SCREEN_WIDTH - 174), (SCREEN_HEIGHT - 24), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 2, - (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnTimeCompressLessMapScreenCallback); + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnTimeCompressLessMapScreenCallback); SetButtonFastHelpText( guiMapBottomTimeButtons[ 0 ], pMapScreenBottomFastHelp[ 3 ] ); - SetButtonFastHelpText( guiMapBottomTimeButtons[ 1 ], pMapScreenBottomFastHelp[ 4 ] ); + SetButtonFastHelpText( guiMapBottomTimeButtons[ 1 ], pMapScreenBottomFastHelp[ 4 ] ); SetButtonCursor(guiMapBottomTimeButtons[ 0 ], MSYS_NO_CURSOR ); SetButtonCursor(guiMapBottomTimeButtons[ 1 ], MSYS_NO_CURSOR ); // scroll buttons +// CHRISL: Changed coordinates to dynamically place scroll buttons from the right edge of screen. guiMapMessageScrollButtonsImage[ MAP_SCROLL_MESSAGE_UP ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,11,4,-1,6,-1 ); +// guiMapMessageScrollButtons[ MAP_SCROLL_MESSAGE_UP ] = QuickCreateButton( guiMapMessageScrollButtonsImage[ MAP_SCROLL_MESSAGE_UP ], (SCREEN_WIDTH - 533), (SCREEN_HEIGHT - 109), +// BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, +// (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnMessageUpMapScreenCallback); + + guiMapMessageScrollButtonsImage[ MAP_SCROLL_MESSAGE_DOWN ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,12,5,-1,7,-1 ); +// guiMapMessageScrollButtons[ MAP_SCROLL_MESSAGE_DOWN ] = QuickCreateButton( guiMapMessageScrollButtonsImage[ MAP_SCROLL_MESSAGE_DOWN ], (SCREEN_WIDTH - 533), (SCREEN_HEIGHT - 28), +// BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, +// (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnMessageDownMapScreenCallback); +// CHRISL: Use these if we want buttons based on left edge of screen guiMapMessageScrollButtons[ MAP_SCROLL_MESSAGE_UP ] = QuickCreateButton( guiMapMessageScrollButtonsImage[ MAP_SCROLL_MESSAGE_UP ], 331, (SCREEN_HEIGHT - 109), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnMessageUpMapScreenCallback); - - guiMapMessageScrollButtonsImage[ MAP_SCROLL_MESSAGE_DOWN ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,12,5,-1,7,-1 ); guiMapMessageScrollButtons[ MAP_SCROLL_MESSAGE_DOWN ] = QuickCreateButton( guiMapMessageScrollButtonsImage[ MAP_SCROLL_MESSAGE_DOWN ], 331, (SCREEN_HEIGHT - 28), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnMessageDownMapScreenCallback); SetButtonFastHelpText( guiMapMessageScrollButtons[ 0 ], pMapScreenBottomFastHelp[ 5 ] ); - SetButtonFastHelpText( guiMapMessageScrollButtons[ 1 ], pMapScreenBottomFastHelp[ 6 ] ); + SetButtonFastHelpText( guiMapMessageScrollButtons[ 1 ], pMapScreenBottomFastHelp[ 6 ] ); SetButtonCursor(guiMapMessageScrollButtons[ 0 ], MSYS_NO_CURSOR ); SetButtonCursor(guiMapMessageScrollButtons[ 1 ], MSYS_NO_CURSOR ); @@ -425,7 +449,7 @@ void DestroyButtonsForMapScreenInterfaceBottom( void ) RemoveButton( guiMapMessageScrollButtons[ 0 ] ); RemoveButton( guiMapMessageScrollButtons[ 1 ] ); RemoveButton( guiMapBottomTimeButtons[ 0 ] ); - RemoveButton( guiMapBottomTimeButtons[ 1 ] ); + RemoveButton( guiMapBottomTimeButtons[ 1 ] ); UnloadButtonImage( guiMapBottomExitButtonsImage[ 0 ] ); @@ -438,7 +462,7 @@ void DestroyButtonsForMapScreenInterfaceBottom( void ) // reset dirty flag fMapScreenBottomDirty = TRUE; - + return; } @@ -459,24 +483,24 @@ void BtnLaptopCallback(GUI_BUTTON *btn,INT32 reason) fMapScreenBottomDirty = TRUE; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { + { if( IsMapScreenHelpTextUp() ) { // stop mapscreen text StopMapScreenHelpText( ); } - if (btn->uiFlags & BUTTON_CLICKED_ON) + if (btn->uiFlags & BUTTON_CLICKED_ON) { btn->uiFlags&=~(BUTTON_CLICKED_ON | BUTTON_DIRTY); DrawButton( btn->IDNum ); RequestTriggerExitFromMapscreen( MAP_EXIT_TO_LAPTOP ); - } - } + } + } else if(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN ) { if( IsMapScreenHelpTextUp() ) @@ -485,12 +509,12 @@ void BtnLaptopCallback(GUI_BUTTON *btn,INT32 reason) StopMapScreenHelpText( ); } } -} +} void BtnTacticalCallback( GUI_BUTTON *btn,INT32 reason ) { - + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { if( IsMapScreenHelpTextUp() ) @@ -506,16 +530,16 @@ void BtnTacticalCallback( GUI_BUTTON *btn,INT32 reason ) fMapScreenBottomDirty = TRUE; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { btn->uiFlags&=~(BUTTON_CLICKED_ON); RequestTriggerExitFromMapscreen( MAP_EXIT_TO_TACTICAL ); - } + } } else if( reason & MSYS_CALLBACK_REASON_RBUTTON_DWN ) { @@ -542,22 +566,22 @@ void BtnOptionsFromMapScreenCallback( GUI_BUTTON *btn, INT32 reason ) } // redraw region - if( btn ->uiFlags & MSYS_HAS_BACKRECT ) + if( btn->uiFlags & MSYS_HAS_BACKRECT ) { fMapScreenBottomDirty = TRUE; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { btn->uiFlags&=~(BUTTON_CLICKED_ON); fMapScreenBottomDirty = TRUE; RequestTriggerExitFromMapscreen( MAP_EXIT_TO_OPTIONS ); - } + } } else if( reason & MSYS_CALLBACK_REASON_RBUTTON_DWN ) { @@ -573,15 +597,15 @@ void BtnOptionsFromMapScreenCallback( GUI_BUTTON *btn, INT32 reason ) void DrawNameOfLoadedSector( void ) { CHAR16 sString[ 128 ]; - INT16 sFontX, sFontY; + INT16 sFontX, sFontY; - SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); + SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); SetFont( COMPFONT ); SetFontForeground( 183 ); SetFontBackground( FONT_BLACK ); - + GetSectorIDString( sSelMapX, sSelMapY, ( INT8 )( iCurrentMapSectorZ ),sString, TRUE ); ReduceStringLength( sString, 80, COMPFONT ); @@ -595,7 +619,7 @@ void DrawNameOfLoadedSector( void ) void CompressModeClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) { if( iReason & ( MSYS_CALLBACK_REASON_RBUTTON_UP | MSYS_CALLBACK_REASON_LBUTTON_UP ) ) - { + { if ( CommonTimeCompressionChecks() == TRUE ) return; @@ -613,22 +637,22 @@ void BtnTimeCompressMoreMapScreenCallback( GUI_BUTTON *btn,INT32 reason ) return; // redraw region - if( btn ->uiFlags & MSYS_HAS_BACKRECT ) + if( btn->uiFlags & MSYS_HAS_BACKRECT ) { fMapScreenBottomDirty = TRUE; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { + { if (btn->uiFlags & BUTTON_CLICKED_ON) { btn->uiFlags&=~(BUTTON_CLICKED_ON); fMapScreenBottomDirty = TRUE; RequestIncreaseInTimeCompression(); - } + } } else if(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN ) { @@ -642,29 +666,29 @@ void BtnTimeCompressMoreMapScreenCallback( GUI_BUTTON *btn,INT32 reason ) void BtnTimeCompressLessMapScreenCallback( GUI_BUTTON *btn,INT32 reason ) { - if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { if ( CommonTimeCompressionChecks() == TRUE ) return; // redraw region - if( btn ->uiFlags & MSYS_HAS_BACKRECT ) + if( btn->uiFlags & MSYS_HAS_BACKRECT ) { fMapScreenBottomDirty = TRUE; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { + { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); fMapScreenBottomDirty = TRUE; RequestDecreaseInTimeCompression(); - } - } + } + } else if(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN ) { if ( CommonTimeCompressionChecks() == TRUE ) @@ -688,39 +712,39 @@ void BtnMessageDownMapScreenCallback( GUI_BUTTON *btn,INT32 reason ) } // redraw region - if( btn ->uiFlags & MSYS_HAS_BACKRECT ) + if( btn->uiFlags & MSYS_HAS_BACKRECT ) { fMapScreenBottomDirty = TRUE; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); - iLastRepeatScrollTime = 0; + iLastRepeatScrollTime = 0; } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { + { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); // redraw region - if( btn ->uiFlags & MSYS_HAS_BACKRECT ) + if( btn->uiFlags & MSYS_HAS_BACKRECT ) { fMapScreenBottomDirty = TRUE; } // down a line MapScreenMsgScrollDown( 1 ); - } - } + } + } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) - { + { if( GetJA2Clock() - iLastRepeatScrollTime >= MESSAGE_BTN_SCROLL_TIME ) { // down a line MapScreenMsgScrollDown( 1 ); - iLastRepeatScrollTime = GetJA2Clock( ); + iLastRepeatScrollTime = GetJA2Clock( ); } } else if( reason & MSYS_CALLBACK_REASON_RBUTTON_DWN ) @@ -733,39 +757,39 @@ void BtnMessageDownMapScreenCallback( GUI_BUTTON *btn,INT32 reason ) } // redraw region - if( btn ->uiFlags & MSYS_HAS_BACKRECT ) + if( btn->uiFlags & MSYS_HAS_BACKRECT ) { fMapScreenBottomDirty = TRUE; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); - iLastRepeatScrollTime = 0; + iLastRepeatScrollTime = 0; } else if(reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) - { + { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); // redraw region - if( btn ->uiFlags & MSYS_HAS_BACKRECT ) + if( btn->uiFlags & MSYS_HAS_BACKRECT ) { fMapScreenBottomDirty = TRUE; } // down a page MapScreenMsgScrollDown( MAX_MESSAGES_ON_MAP_BOTTOM ); - } + } } else if( reason & MSYS_CALLBACK_REASON_RBUTTON_REPEAT ) - { + { if( GetJA2Clock() - iLastRepeatScrollTime >= MESSAGE_BTN_SCROLL_TIME ) { // down a page MapScreenMsgScrollDown( MAX_MESSAGES_ON_MAP_BOTTOM ); - iLastRepeatScrollTime = GetJA2Clock( ); + iLastRepeatScrollTime = GetJA2Clock( ); } } } @@ -785,41 +809,41 @@ void BtnMessageUpMapScreenCallback( GUI_BUTTON *btn,INT32 reason ) return; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); - // redraw region + // redraw region if( btn->Area.uiFlags & MSYS_HAS_BACKRECT ) { fMapScreenBottomDirty = TRUE; } - iLastRepeatScrollTime = 0; + iLastRepeatScrollTime = 0; } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { + { if (btn->uiFlags & BUTTON_CLICKED_ON) { btn->uiFlags&=~(BUTTON_CLICKED_ON); // redraw region - if( btn ->uiFlags & MSYS_HAS_BACKRECT ) + if( btn->uiFlags & MSYS_HAS_BACKRECT ) { fMapScreenBottomDirty = TRUE; } - + // up a line MapScreenMsgScrollUp( 1 ); - } + } } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) - { + { if( GetJA2Clock() - iLastRepeatScrollTime >= MESSAGE_BTN_SCROLL_TIME ) { // up a line MapScreenMsgScrollUp( 1 ); - iLastRepeatScrollTime = GetJA2Clock( ); + iLastRepeatScrollTime = GetJA2Clock( ); } } else if( reason & MSYS_CALLBACK_REASON_RBUTTON_DWN ) @@ -832,30 +856,30 @@ void BtnMessageUpMapScreenCallback( GUI_BUTTON *btn,INT32 reason ) } // redraw region - if( btn ->uiFlags & MSYS_HAS_BACKRECT ) + if( btn->uiFlags & MSYS_HAS_BACKRECT ) { fMapScreenBottomDirty = TRUE; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); - iLastRepeatScrollTime = 0; + iLastRepeatScrollTime = 0; } else if(reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) - { + { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); // redraw region - if( btn ->uiFlags & MSYS_HAS_BACKRECT ) + if( btn->uiFlags & MSYS_HAS_BACKRECT ) { fMapScreenBottomDirty = TRUE; } // up a page MapScreenMsgScrollUp( MAX_MESSAGES_ON_MAP_BOTTOM ); - } + } } else if( reason & MSYS_CALLBACK_REASON_RBUTTON_REPEAT ) { @@ -864,7 +888,7 @@ void BtnMessageUpMapScreenCallback( GUI_BUTTON *btn,INT32 reason ) // up a page MapScreenMsgScrollUp( MAX_MESSAGES_ON_MAP_BOTTOM ); - iLastRepeatScrollTime = GetJA2Clock( ); + iLastRepeatScrollTime = GetJA2Clock( ); } } } @@ -875,7 +899,7 @@ void EnableDisableMessageScrollButtonsAndRegions( void ) { UINT8 ubNumMessages; - ubNumMessages = GetRangeOfMapScreenMessages(); + ubNumMessages = GetRangeOfMapScreenMessages(); // if no scrolling required, or already showing the topmost message if( ( ubNumMessages <= MAX_MESSAGES_ON_MAP_BOTTOM ) || ( gubFirstMapscreenMessageIndex == 0 ) ) @@ -935,7 +959,7 @@ void DisplayCompressMode( void ) SetFontDestBuffer( FRAME_BUFFER, 0,0,SCREEN_WIDTH,SCREEN_HEIGHT, FALSE ); SetFont( COMPFONT ); - + if( GetJA2Clock() - guiCompressionStringBaseTime >= PAUSE_GAME_TIMER ) { if( usColor == FONT_LTGREEN ) @@ -957,11 +981,11 @@ void DisplayCompressMode( void ) SetFontForeground( usColor ); SetFontBackground( FONT_BLACK ); - + //FindFontCenterCoordinates( 489, 456, 522 - 489, 467 - 454, sString, COMPFONT, &sX, &sY ); FindFontCenterCoordinates( (SCREEN_WIDTH - 151), (SCREEN_HEIGHT - 24), 33, 13, sString, COMPFONT, &sX, &sY ); mprintf( sX, sY, sString ); - + return; } @@ -986,9 +1010,9 @@ void RemoveCompressModePause( void ) void LoadMessageSliderBar( void ) { - // this function will load the message slider bar - VOBJECT_DESC VObjectDesc; - + // this function will load the message slider bar + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP( "INTERFACE\\map_screen_bottom_arrows.sti", VObjectDesc.ImageFile ); if( !AddVideoObject( &VObjectDesc, &guiSliderBar ) ) @@ -1006,13 +1030,13 @@ void CreateMapScreenBottomMessageScrollBarRegion( void ) { MSYS_DefineRegion( &gMapMessageScrollBarRegion, MESSAGE_SCROLL_AREA_START_X, MESSAGE_SCROLL_AREA_START_Y, MESSAGE_SCROLL_AREA_END_X, MESSAGE_SCROLL_AREA_END_Y, - MSYS_PRIORITY_NORMAL, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MapScreenMessageScrollBarCallBack ); + MSYS_PRIORITY_NORMAL, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MapScreenMessageScrollBarCallBack ); } void DeleteMapScreenBottomMessageScrollRegion( void ) { - MSYS_RemoveRegion( &gMapMessageScrollBarRegion ); + MSYS_RemoveRegion( &gMapMessageScrollBarRegion ); } @@ -1026,23 +1050,23 @@ void MapScreenMessageScrollBarCallBack( MOUSE_REGION *pRegion, INT32 iReason ) UINT8 ubNumMessages; - if (iReason & MSYS_CALLBACK_REASON_INIT) - { - return; - } + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + return; + } if ( iReason & ( MSYS_CALLBACK_REASON_LBUTTON_DWN | MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) ) - { + { // how many messages are there? - ubNumMessages = GetRangeOfMapScreenMessages(); + ubNumMessages = GetRangeOfMapScreenMessages(); - // region is supposed to be disabled if there aren't enough messages to scroll. Formulas assume this + // region is supposed to be disabled if there aren't enough messages to scroll. Formulas assume this if ( ubNumMessages > MAX_MESSAGES_ON_MAP_BOTTOM ) { // where is the mouse? GetCursorPos( &MousePos ); - ScreenToClient(ghWindow, &MousePos); // In window coords! + ScreenToClient(ghWindow, &MousePos); // In window coords! ubMouseYOffset = (UINT8) MousePos.y - MESSAGE_SCROLL_AREA_START_Y; @@ -1087,7 +1111,7 @@ void DisplayScrollBarSlider( ) HVOBJECT hHandle; - ubNumMessages = GetRangeOfMapScreenMessages(); + ubNumMessages = GetRangeOfMapScreenMessages(); // only show the slider if there are more messages than will fit on screen if ( ubNumMessages > MAX_MESSAGES_ON_MAP_BOTTOM ) @@ -1124,7 +1148,7 @@ void CheckForAndHandleAutoMessageScroll( void ) // we just scrolled to a new message, reset timer iBaseScrollTime = GetJA2Clock( ); - // reset flag + // reset flag gfNewScrollMessage = FALSE; fScrollMessage = FALSE; } @@ -1133,13 +1157,13 @@ void CheckForAndHandleAutoMessageScroll( void ) if( GetJA2Clock( ) - iBaseScrollTime > DELAY_TO_START_MESSAGE_SCROLL ) { - + if( fScrollMessage == FALSE ) { - // set up scroll delay - iBaseScrollDelay = GetJA2Clock( ); + // set up scroll delay + iBaseScrollDelay = GetJA2Clock( ); - // start scroll + // start scroll fScrollMessage = TRUE; } @@ -1180,7 +1204,7 @@ void EnableDisableBottomButtonsAndRegions( void ) { EnableButton( guiMapBottomExitButtons[ iExitButtonIndex ]); } - else + else { DisableButton( guiMapBottomExitButtons[ iExitButtonIndex ]); } @@ -1201,7 +1225,7 @@ void EnableDisableBottomButtonsAndRegions( void ) { DisableButton( giMapInvDoneButton ); } - else + else { EnableButton( giMapInvDoneButton ); } @@ -1358,7 +1382,7 @@ BOOLEAN AllowedToTimeCompress( void ) { return( FALSE ); } - + // hostile sector / in battle if( (gTacticalStatus.uiFlags & INCOMBAT ) || ( gTacticalStatus.fEnemyInSector ) ) { @@ -1389,8 +1413,10 @@ void DisplayCurrentBalanceTitleForMapBottom( void ) swprintf( sString, L"%s", pMapScreenBottomText[ 0 ] ); // center it + // CHRISL: Replaced X coordinate with dynamic coordinate set from right edge of screen + //VarFindFontCenterCoordinates( (SCREEN_WIDTH - 637), (SCREEN_HEIGHT - 107), 78, 10, COMPFONT, &sFontX, &sFontY, sString ); + // CHRISL: Use this if we want to display from the left edge VarFindFontCenterCoordinates( 359, (SCREEN_HEIGHT - 107), 78, 10, COMPFONT, &sFontX, &sFontY, sString ); - //VarFindFontCenterCoordinates( 359, 387 - 14, 437 - 359, 10, COMPFONT, &sFontX, &sFontY, sString ); // print it mprintf( sFontX, sFontY, L"%s", sString ); @@ -1398,7 +1424,9 @@ void DisplayCurrentBalanceTitleForMapBottom( void ) swprintf( sString, L"%s", zMarksMapScreenText[ 2 ] ); // center it - //VarFindFontCenterCoordinates( 359, 433 - 14, 437 - 359, 10, COMPFONT, &sFontX, &sFontY, sString ); + // CHRISL: Replaced X coordinate with dynamic coordinate set from right edge of screen + //VarFindFontCenterCoordinates( (SCREEN_WIDTH - 637), (SCREEN_HEIGHT - 61), 78, 10, COMPFONT, &sFontX, &sFontY, sString ); + // CHRISL: Use this if we want to display from the left edge VarFindFontCenterCoordinates( 359, (SCREEN_HEIGHT - 61), 78, 10, COMPFONT, &sFontX, &sFontY, sString ); // print it @@ -1425,12 +1453,15 @@ void DisplayCurrentBalanceForMapBottom( void ) swprintf( sString, L"%d", LaptopSaveInfo.iCurrentBalance ); - // insert - + // insert + InsertCommasForDollarFigure( sString ); InsertDollarSignInToString( sString ); // center it + // CHRISL: Replaced X coordinate with dynamic coordinate set from right edge of screen + //VarFindFontCenterCoordinates( (SCREEN_WIDTH - 637), (SCREEN_HEIGHT - 91), 78, 10, COMPFONT, &sFontX, &sFontY, sString ); + // CHRISL: Use this if we want to display from the left edge VarFindFontCenterCoordinates( 359, (SCREEN_HEIGHT - 91), 78, 10, COMPFONT, &sFontX, &sFontY, sString ); // print it @@ -1509,13 +1540,13 @@ void CompressMaskClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) void DisplayProjectedDailyMineIncome( void ) { INT32 iRate = 0; - static INT32 iOldRate = -1; + static INT32 iOldRate = -1; CHAR16 sString[ 128 ]; INT16 sFontX, sFontY; // grab the rate from the financial system iRate = GetProjectedTotalDailyIncome( ); - + if( iRate != iOldRate ) { iOldRate = iRate; @@ -1537,16 +1568,19 @@ void DisplayProjectedDailyMineIncome( void ) swprintf( sString, L"%d", iRate ); - // insert + // insert InsertCommasForDollarFigure( sString ); InsertDollarSignInToString( sString ); // center it + // CHRISL: Replaced X coordinate with dynamic coordinate set from right edge of screen + //VarFindFontCenterCoordinates( (SCREEN_WIDTH - 637), (SCREEN_HEIGHT - 45), 78, 10, COMPFONT, &sFontX, &sFontY, sString ); + // CHRISL: Use this if we want to display from the left edge VarFindFontCenterCoordinates( 359, (SCREEN_HEIGHT - 45), 78, 10, COMPFONT, &sFontX, &sFontY, sString ); // print it mprintf( sFontX, sFontY, L"%s", sString ); - + return; } @@ -1589,8 +1623,8 @@ BOOLEAN AnyUsableRealMercenariesOnTeam( void ) { pSoldier = &Menptr[ iCounter ]; - if( ( pSoldier->bActive ) && ( pSoldier->bLife > 0 ) && - !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) && + if( ( pSoldier->bActive ) && ( pSoldier->stats.bLife > 0 ) && + !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) && ( pSoldier->bAssignment != ASSIGNMENT_DEAD ) && ( pSoldier->ubWhatKindOfMercAmI != MERC_TYPE__EPC ) ) @@ -1627,6 +1661,9 @@ void RequestTriggerExitFromMapscreen( INT8 bExitToWhere ) // delay until mapscreen has had a chance to render at least one full frame gfOneFramePauseOnExit = TRUE; + + //CHRISL: To force activation of tactical team panel buttons when switching to tactical + gfDisableTacticalPanelButtons = FALSE; } } @@ -1703,7 +1740,7 @@ BOOLEAN AllowedToExitFromMapscreenTo( INT8 bExitToWhere ) { // if in battle or air raid, the ONLY sector we can go tactical in is the one that's loaded if ( ( ( gTacticalStatus.uiFlags & INCOMBAT ) || ( gTacticalStatus.fEnemyInSector ) /*|| InAirRaid( )*/ ) && - ( ( sSelMapX != gWorldSectorX ) || ( sSelMapY != gWorldSectorY ) || ( ( UINT8 )iCurrentMapSectorZ ) != gbWorldSectorZ ) ) + ( ( sSelMapX != gWorldSectorX ) || ( sSelMapY != gWorldSectorY ) || ( ( UINT8 )iCurrentMapSectorZ ) != gbWorldSectorZ ) ) { return( FALSE ); } @@ -1751,7 +1788,7 @@ void HandleExitsFromMapScreen( void ) if( gfExtraBuffer ) { //Then initiate the transition animation from the mapscreen to laptop... - + BlitBufferToBuffer( FRAME_BUFFER, guiEXTRABUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); gfStartMapScreenToLaptopTransition = TRUE; } @@ -1796,7 +1833,7 @@ void MapScreenMsgScrollDown( UINT8 ubLinesDown ) { UINT8 ubNumMessages; - ubNumMessages = GetRangeOfMapScreenMessages(); + ubNumMessages = GetRangeOfMapScreenMessages(); // check if we can go that far, only go as far as we can if ( ( gubFirstMapscreenMessageIndex + MAX_MESSAGES_ON_MAP_BOTTOM + ubLinesDown ) > ubNumMessages ) @@ -1815,7 +1852,7 @@ void MapScreenMsgScrollUp( UINT8 ubLinesUp ) { UINT8 ubNumMessages; - ubNumMessages = GetRangeOfMapScreenMessages(); + ubNumMessages = GetRangeOfMapScreenMessages(); // check if we can go that far, only go as far as we can if ( gubFirstMapscreenMessageIndex < ubLinesUp ) @@ -1836,7 +1873,7 @@ void MoveToEndOfMapScreenMessageList( void ) UINT8 ubDesiredMessageIndex; UINT8 ubNumMessages; - ubNumMessages = GetRangeOfMapScreenMessages(); + ubNumMessages = GetRangeOfMapScreenMessages(); ubDesiredMessageIndex = ubNumMessages - min( ubNumMessages, MAX_MESSAGES_ON_MAP_BOTTOM ); ChangeCurrentMapscreenMessageIndex( ubDesiredMessageIndex ); diff --git a/Strategic/Map Screen Interface Bottom.h b/Strategic/Map Screen Interface Bottom.h index 4c9cc6fc..25bb2820 100644 --- a/Strategic/Map Screen Interface Bottom.h +++ b/Strategic/Map Screen Interface Bottom.h @@ -5,7 +5,7 @@ #include "Soldier Control.h" -#define MAX_MESSAGES_ON_MAP_BOTTOM 9 +#define MAX_MESSAGES_ON_MAP_BOTTOM 9 // exit to where defines @@ -32,7 +32,8 @@ BOOLEAN LoadMapScreenInterfaceBottom( void ); void DeleteMapScreenInterfaceBottom( void ); void DestroyButtonsForMapScreenInterfaceBottom( void ); BOOLEAN CreateButtonsForMapScreenInterfaceBottom( void ); -void RenderMapScreenInterfaceBottom( void ); +// Headrock: Added argument to this function: +void RenderMapScreenInterfaceBottom( BOOLEAN fForceMapscreenBottomRerender ); // delete map bottom graphics void DeleteMapBottomGraphics( void ); diff --git a/Strategic/Map Screen Interface Map Inventory.cpp b/Strategic/Map Screen Interface Map Inventory.cpp index 9cba815d..4cebaaab 100644 --- a/Strategic/Map Screen Interface Map Inventory.cpp +++ b/Strategic/Map Screen Interface Map Inventory.cpp @@ -19,7 +19,6 @@ #include "Font Control.h" #include "strategicmap.h" #include "Tactical Save.h" - #include "Soldier Control.h" #include "Overhead.h" #include "english.h" #include "Multi Language Graphic Utils.h" @@ -36,11 +35,17 @@ #include "ShopKeeper Interface.h" #include "ArmsDealerInvInit.h" +#include -extern BOOLEAN SaveWorldItemsToTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ, UINT32 uiNumberOfItems, WORLDITEM *pData ); +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + +extern BOOLEAN SaveWorldItemsToTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ, UINT32 uiNumberOfItems, WORLDITEM* pData ); #define MAP_INV_X_OFFSET (((SCREEN_WIDTH - 261) - 380) / 2) -//#define MAP_INV_Y_OFFSET (((SCREEN_HEIGHT - 121) - +//#define MAP_INV_Y_OFFSET (((SCREEN_HEIGHT - 121) - // status bar colors #define DESC_STATUS_BAR FROMRGB( 201, 172, 133 ) @@ -48,7 +53,7 @@ extern BOOLEAN SaveWorldItemsToTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bMap // page display positions #define MAP_INVENTORY_POOL_PAGE_X (MAP_INV_X_OFFSET + 506) -#define MAP_INVENTORY_POOL_PAGE_Y (SCREEN_HEIGHT - 121 - 23) //336 +#define MAP_INVENTORY_POOL_PAGE_Y (SCREEN_HEIGHT - 121 - 23) //336 #define MAP_INVENTORY_POOL_PAGE_WIDTH 46 #define MAP_INVENTORY_POOL_PAGE_HEIGHT 13 @@ -56,7 +61,7 @@ extern BOOLEAN SaveWorldItemsToTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bMap #define MAP_INVENTORY_POOL_NUMBER_X (MAP_INV_X_OFFSET + 436) #define MAP_INVENTORY_POOL_NUMBER_WIDTH 40 -// location +// location #define MAP_INVENTORY_POOL_LOC_X MAP_INV_X_OFFSET + 326 #define MAP_INVENTORY_POOL_LOC_WIDTH 40 @@ -71,12 +76,12 @@ extern BOOLEAN SaveWorldItemsToTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bMap #define INVEN_POOL_Y 0 // inventory Graphic Offset X and y -#define MAP_INVENTORY_POOL_SLOT_OFFSET_X 2 +#define MAP_INVENTORY_POOL_SLOT_OFFSET_X 2 #define MAP_INVENTORY_POOL_SLOT_OFFSET_Y 5 // height of map inventory pool bar #define ITEMDESC_ITEM_STATUS_HEIGHT_INV_POOL 20 -#define ITEMDESC_ITEM_STATUS_WIDTH_INV_POOL 2 +#define ITEMDESC_ITEM_STATUS_WIDTH_INV_POOL 2 // map bar offsets #define ITEMDESC_ITEM_STATUS_INV_POOL_OFFSET_X 5 @@ -87,8 +92,8 @@ extern BOOLEAN SaveWorldItemsToTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bMap //#define MAP_INVENTORY_POOL_SLOT_START_Y 36 #define MAP_INVEN_SLOT_WIDTH 65 #define MAP_INVEN_SPACE_BTWN_SLOTS 72 -#define MAP_INVEN_SLOT_HEIGHT 32 -#define MAP_INVEN_SLOT_IMAGE_HEIGHT 24 +#define MAP_INVEN_SLOT_HEIGHT 32 +#define MAP_INVEN_SLOT_IMAGE_HEIGHT 24 // Number of inventory slots in 1024x768 #define MAP_INVENTORY_POOL_MAX_SLOTS 170 @@ -106,20 +111,18 @@ BOOLEAN fFlashHighLightInventoryItemOnradarMap = FALSE; // whether we are showing the inventory pool graphic BOOLEAN fShowMapInventoryPool = FALSE; -// the v-object index value for the background +// the v-object index value for the background UINT32 guiMapInventoryPoolBackground; // inventory pool list -WORLDITEM *pInventoryPoolList = NULL; +std::vector pInventoryPoolList; // current page of inventory INT32 iCurrentInventoryPoolPage = 0; INT32 iLastInventoryPoolPage = 0; -// total number of slots allocated -INT32 iTotalNumberOfSlots = 0; - INT16 sObjectSourceGridNo = 0; +INT8 sObjectSourseSoldierID = -1; // number of unseen items in sector UINT32 uiNumberOfUnSeenItems = 0; @@ -151,7 +154,6 @@ UINT32 guiMapInvenButton[ 3 ]; BOOLEAN gfCheckForCursorOverMapSectorInventoryItem = FALSE; -extern UINT32 guiNumWorldItems; extern BOOLEAN fShowInventoryFlag; extern BOOLEAN fMapScreenBottomDirty; @@ -176,11 +178,8 @@ void CreateMapInventoryPoolSlots( void ); void DestroyMapInventoryPoolSlots( void ); void CreateMapInventoryButtons( void ); void DestroyMapInventoryButtons( void ); -void ReSizeStashListByThisAmount( INT32 iNumberOfItems ); void DestroyStash( void ); void BuildStashForSelectedSector( INT16 sMapX, INT16 sMapY, INT16 sMapZ ); -BOOLEAN GetObjFromInventoryStashSlot( OBJECTTYPE *pInventorySlot, OBJECTTYPE *pItemPtr ); -BOOLEAN RemoveObjectFromStashSlot( OBJECTTYPE *pInventorySlot, OBJECTTYPE *pItemPtr ); void BeginInventoryPoolPtr( OBJECTTYPE *pInventorySlot ); BOOLEAN PlaceObjectInInventoryStash( OBJECTTYPE *pInventorySlot, OBJECTTYPE *pItemPtr ); void RenderItemsForCurrentPageOfInventoryPool( void ); @@ -194,7 +193,7 @@ void CreateMapInventoryPoolDoneButton( void ); void DestroyInventoryPoolDoneButton( void ); void MapInventoryPoolDoneBtn( GUI_BUTTON *btn, INT32 reason ); void DisplayCurrentSector( void ); -void CheckAndUnDateSlotAllocation( void ); +void ResizeInventoryList( void ); void ClearUpTempUnSeenList( void ); void SaveSeenAndUnseenItems( void ); void DrawTextOnMapInventoryBackground( void ); @@ -207,21 +206,20 @@ BOOLEAN IsMapScreenWorldItemVisibleInMapInventory( WORLDITEM *pWorldItem ); BOOLEAN IsMapScreenWorldItemInvisibleInMapInventory( WORLDITEM *pWorldItem ); void CheckGridNoOfItemsInMapScreenMapInventory(); INT32 MapScreenSectorInventoryCompare( const void *pNum1, const void *pNum2); -void SortSectorInventory( WORLDITEM *pInventory, UINT32 uiSizeOfArray ); +void SortSectorInventory( std::vector& pInventory, UINT32 uiSizeOfArray ); BOOLEAN CanPlayerUseSectorInventory( SOLDIERTYPE *pSelectedSoldier ); -extern void StackObjs( OBJECTTYPE * pSourceObj, OBJECTTYPE * pTargetObj, UINT8 ubNumberToCopy ); extern void MAPEndItemPointer( ); extern BOOLEAN GetCurrentBattleSectorXYZAndReturnTRUEIfThereIsABattle( INT16 *psSectorX, INT16 *psSectorY, INT16 *psSectorZ ); void DeleteAllItemsInInventoryPool(); void DeleteItemsOfType( UINT16 usItemType ); -INT32 SellItem( OBJECTTYPE& object ); +INT32 SellItem( OBJECTTYPE& object, BOOLEAN useModifier = TRUE ); // load the background panel graphics for inventory BOOLEAN LoadInventoryPoolGraphic( void ) { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; // load the file VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; @@ -250,10 +248,10 @@ BOOLEAN LoadInventoryPoolGraphic( void ) MAP_INVENTORY_POOL_SLOT_START_Y = 50; sprintf( VObjectDesc.ImageFile, "INTERFACE\\sector_inventory_1024x768.sti" ); } - + // add to V-object index CHECKF(AddVideoObject(&VObjectDesc, &guiMapInventoryPoolBackground)); - + return( TRUE ); } @@ -268,7 +266,7 @@ void RemoveInventoryPoolGraphic( void ) DeleteVideoObjectFromIndex( guiMapInventoryPoolBackground ); guiMapInventoryPoolBackground = 0; } - + return; } @@ -280,9 +278,9 @@ void BlitInventoryPoolGraphic( void ) // blit inventory pool graphic to the screen GetVideoObject(&hHandle, guiMapInventoryPoolBackground); BltVideoObject( guiSAVEBUFFER , hHandle, 0,INVEN_POOL_X, INVEN_POOL_Y , VO_BLT_SRCTRANSPARENCY,NULL ); - + // resize list - CheckAndUnDateSlotAllocation( ); + ResizeInventoryList( ); // now the items @@ -337,17 +335,18 @@ BOOLEAN RenderItemInPoolSlot( INT32 iCurrentSlot, INT32 iFirstSlotOnPage ) CHAR16 sString[ 64 ]; INT16 sWidth = 0, sHeight = 0; INT16 sOutLine = 0; - BOOLEAN fOutLine = FALSE; + BOOLEAN fOutLine = FALSE; // check if anything there - if( pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].o.ubNumberOfObjects == 0 ) + + if( pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].object.exists() == false ) { return ( FALSE ); } - GetVideoObject( &hHandle, GetInterfaceGraphicForItem( &(Item[ pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].o.usItem ] ) ) ); + GetVideoObject( &hHandle, GetInterfaceGraphicForItem( &(Item[ pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].object.usItem ] ) ) ); - pTrav = &( hHandle->pETRLEObject[ Item[pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].o.usItem ].ubGraphicNum] ); + pTrav = &( hHandle->pETRLEObject[ Item[pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].object.usItem ].ubGraphicNum] ); usHeight = (UINT16)pTrav->usHeight; usWidth = (UINT16)pTrav->usWidth; @@ -373,15 +372,15 @@ BOOLEAN RenderItemInPoolSlot( INT32 iCurrentSlot, INT32 iFirstSlotOnPage ) SetFontDestBuffer( guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); - INVRenderItem( guiSAVEBUFFER, NULL, &(pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].o), + INVRenderItem( guiSAVEBUFFER, NULL, &(pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].object), (INT16)(sX + 7), sY, 60, 25, DIRTYLEVEL2, NULL, 0, fOutLine, sOutLine );//67 SetFontDestBuffer( FRAME_BUFFER, 0,0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); // now blit this object in the box - //BltVideoObjectOutlineFromIndex( guiSAVEBUFFER, GetInterfaceGraphicForItem( &(Item[ pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].o.usItem ]) ), - // Item[ pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].o.usItem ].ubGraphicNum, + //BltVideoObjectOutlineFromIndex( guiSAVEBUFFER, GetInterfaceGraphicForItem( &(Item[ pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].object.usItem ]) ), + // Item[ pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].object.usItem ].ubGraphicNum, // sCenX, sCenY, //sOutLine, TRUE ); @@ -390,8 +389,8 @@ BOOLEAN RenderItemInPoolSlot( INT32 iCurrentSlot, INT32 iFirstSlotOnPage ) // now draw bar for condition // Display ststus - DrawItemUIBarEx( &( pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].o ), 0, - (INT16)( ITEMDESC_ITEM_STATUS_INV_POOL_OFFSET_X + MAP_INVENTORY_POOL_SLOT_START_X + ( ( MAP_INVEN_SPACE_BTWN_SLOTS ) * ( iCurrentSlot / MAP_INV_SLOT_COLS ) ) ), + DrawItemUIBarEx( &( pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].object ), 0, + (INT16)( ITEMDESC_ITEM_STATUS_INV_POOL_OFFSET_X + MAP_INVENTORY_POOL_SLOT_START_X + ( ( MAP_INVEN_SPACE_BTWN_SLOTS ) * ( iCurrentSlot / MAP_INV_SLOT_COLS ) ) ), ( INT16 )( ITEMDESC_ITEM_STATUS_INV_POOL_OFFSET_Y + MAP_INVENTORY_POOL_SLOT_START_Y + ( ( MAP_INVEN_SLOT_HEIGHT ) * ( iCurrentSlot % ( MAP_INV_SLOT_COLS ) ) ) ) , ITEMDESC_ITEM_STATUS_WIDTH_INV_POOL, ITEMDESC_ITEM_STATUS_HEIGHT_INV_POOL, Get16BPPColor( DESC_STATUS_BAR ), Get16BPPColor( DESC_STATUS_BAR_SHADOW ), TRUE, guiSAVEBUFFER ); @@ -405,14 +404,16 @@ BOOLEAN RenderItemInPoolSlot( INT32 iCurrentSlot, INT32 iFirstSlotOnPage ) ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].bSectorZ == iCurrentMapSectorZ ) ) ) { - //Shade the item - DrawHatchOnInventory( guiSAVEBUFFER, sX, sY, MAP_INVEN_SLOT_WIDTH, MAP_INVEN_SLOT_IMAGE_HEIGHT ); + //Shade the item, but only if it is an active item! + if ( pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].object.exists() == true) { + DrawHatchOnInventory( guiSAVEBUFFER, sX, sY, MAP_INVEN_SLOT_WIDTH, MAP_INVEN_SLOT_IMAGE_HEIGHT ); + } } // the name - wcscpy( sString, ShortItemNames[ pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].o.usItem ] ); + wcscpy( sString, ShortItemNames[ pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].object.usItem ] ); if( StringPixLength( sString, MAP_IVEN_FONT ) >= ( MAP_INVEN_SLOT_WIDTH ) ) { @@ -420,8 +421,8 @@ BOOLEAN RenderItemInPoolSlot( INT32 iCurrentSlot, INT32 iFirstSlotOnPage ) } FindFontCenterCoordinates( (INT16)( 4 + MAP_INVENTORY_POOL_SLOT_START_X + ( ( MAP_INVEN_SPACE_BTWN_SLOTS ) * ( iCurrentSlot / MAP_INV_SLOT_COLS ) ) ), - 0, MAP_INVEN_SLOT_WIDTH, 0, - sString, MAP_IVEN_FONT, + 0, MAP_INVEN_SLOT_WIDTH, 0, + sString, MAP_IVEN_FONT, &sWidth, &sHeight ); SetFontDestBuffer( guiSAVEBUFFER, 0,0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); @@ -430,20 +431,20 @@ BOOLEAN RenderItemInPoolSlot( INT32 iCurrentSlot, INT32 iFirstSlotOnPage ) SetFontForeground( FONT_WHITE ); SetFontBackground( FONT_BLACK ); - mprintf( sWidth, + mprintf( sWidth, ( INT16 )( 3 + ITEMDESC_ITEM_STATUS_INV_POOL_OFFSET_Y + MAP_INVENTORY_POOL_SLOT_START_Y + ( ( MAP_INVEN_SLOT_HEIGHT ) * ( iCurrentSlot % ( MAP_INV_SLOT_COLS ) ) ) ) , sString ); /* - if( pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].o.ubNumberOfObjects > 1 ) + if( pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].object.ubNumberOfObjects > 1 ) { - swprintf( sString, L"x%d", pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].o.ubNumberOfObjects ); + swprintf( sString, L"x%d", pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].object.ubNumberOfObjects ); // find font right coord FindFontRightCoordinates( ( INT16 )( ITEMDESC_ITEM_STATUS_INV_POOL_OFFSET_X + MAP_INVENTORY_POOL_SLOT_START_X - 1 + ( ( MAP_INVEN_SPACE_BTWN_SLOTS ) * ( iCurrentSlot / MAP_INV_SLOT_COLS ) ) ),0, MAP_INVEN_SPACE_BTWN_SLOTS - 10, 0, sString, MAP_IVEN_FONT, &sX, &sY ); - + sY = ( INT16 )( 3 + ITEMDESC_ITEM_STATUS_INV_POOL_OFFSET_Y + MAP_INVENTORY_POOL_SLOT_START_Y + ( ( MAP_INVEN_SLOT_HEIGHT ) * ( iCurrentSlot % ( MAP_INV_SLOT_COLS ) ) ) ) - 7; - + // print string mprintf( sX, sY, sString ); } @@ -460,34 +461,34 @@ void UpdateHelpTextForInvnentoryStashSlots( void ) CHAR16 pStr[ 512 ]; INT32 iCounter = 0; INT32 iFirstSlotOnPage = ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ); - - + + // run through list of items in slots and update help text for mouse regions for( iCounter = 0; iCounter < MAP_INVENTORY_POOL_SLOT_COUNT; iCounter++ ) { - if( pInventoryPoolList[ iCounter + iFirstSlotOnPage ].o.ubNumberOfObjects > 0 ) + if( pInventoryPoolList[ iCounter + iFirstSlotOnPage ].object.exists() == true ) + { + GetHelpTextForItem( pStr , &( pInventoryPoolList[ iCounter + iFirstSlotOnPage ].object ), NULL ); + SetRegionFastHelpText( &(MapInventoryPoolSlots[ iCounter ] ), pStr ); + + /* + // set text for current item + if( pInventoryPoolList[ iCounter + iFirstSlotOnPage ].object.usItem == MONEY ) { - GetHelpTextForItem( pStr , &( pInventoryPoolList[ iCounter + iFirstSlotOnPage ].o ), NULL ); - SetRegionFastHelpText( &(MapInventoryPoolSlots[ iCounter ] ), pStr ); - - /* - // set text for current item - if( pInventoryPoolList[ iCounter + iFirstSlotOnPage ].o.usItem == MONEY ) - { - swprintf( pStr, L"$%ld", pInventoryPoolList[ iCounter + iFirstSlotOnPage ].o.uiMoneyAmount ); - SetRegionFastHelpText( &(MapInventoryPoolSlots[ iCounter ]), pStr ); - } - else - { - SetRegionFastHelpText( &(MapInventoryPoolSlots[ iCounter ]), ItemNames[ pInventoryPoolList[ iCounter + iFirstSlotOnPage ].o.usItem ] ); - } - */ + swprintf( pStr, L"$%ld", pInventoryPoolList[ iCounter + iFirstSlotOnPage ].object[0]->data.money.uiMoneyAmount ); + SetRegionFastHelpText( &(MapInventoryPoolSlots[ iCounter ]), pStr ); } else { - //OK, for each item, set dirty text if applicable! - SetRegionFastHelpText( &(MapInventoryPoolSlots[ iCounter ]), L"" ); + SetRegionFastHelpText( &(MapInventoryPoolSlots[ iCounter ]), ItemNames[ pInventoryPoolList[ iCounter + iFirstSlotOnPage ].object.usItem ] ); } + */ + } + else + { + //OK, for each item, set dirty text if applicable! + SetRegionFastHelpText( &(MapInventoryPoolSlots[ iCounter ]), L"" ); + } } return; @@ -561,7 +562,7 @@ void CreateDestroyMapInventoryPoolButtons( BOOLEAN fExitFromMapScreen ) DestroyStash( ); - + fMapPanelDirty = TRUE; fTeamPanelDirty = TRUE; @@ -600,7 +601,7 @@ void ClearUpTempUnSeenList( void ) return; } - // build the list based on this + // build the list based on this pSaveList = pUnSeenItems; pUnSeenItems = NULL; @@ -610,7 +611,7 @@ void ClearUpTempUnSeenList( void ) void SaveSeenAndUnseenItems( void ) { WORLDITEM *pSeenItemsList = NULL; - INT32 iCounter = 0; + UINT32 iCounter = 0; INT32 iItemCount = 0; INT32 iTotalNumberItems = 0; @@ -620,15 +621,15 @@ void SaveSeenAndUnseenItems( void ) // if there are seen items, build a temp world items list of them and save them if( iTotalNumberItems > 0 ) { - pSeenItemsList = (WORLDITEM *) MemAlloc( ( sizeof( WORLDITEM ) * ( iTotalNumberItems ) ) ); + pSeenItemsList = new WORLDITEM[ iTotalNumberItems ]; // copy - for( iCounter = 0; iCounter < iTotalNumberOfSlots; iCounter++ ) + for( iCounter = 0; iCounter < pInventoryPoolList.size(); iCounter++ ) { - if( pInventoryPoolList[ iCounter ].o.ubNumberOfObjects > 0 ) + if( pInventoryPoolList[ iCounter ].object.exists() == true ) { // copy object stuff - memcpy( &( pSeenItemsList[ iItemCount ] ), &( pInventoryPoolList[ iCounter ] ), sizeof( WORLDITEM ) ); + pSeenItemsList[ iItemCount ] = pInventoryPoolList[ iCounter ]; // check if item actually lives at a gridno // if not, check predicessor, iItemCount is not 0 @@ -687,14 +688,14 @@ void SaveSeenAndUnseenItems( void ) // now clear out seen list if( pSeenItemsList != NULL ) { - MemFree( pSeenItemsList ); + delete[]( pSeenItemsList ); pSeenItemsList = NULL; } // clear out unseen list if( pSaveList != NULL ) { - MemFree( pSaveList ); + delete[]( pSaveList ); pSaveList = NULL; } @@ -725,7 +726,7 @@ void CreateMapInventoryPoolSlots( void ) INT16 sULX = 0, sULY = 0; INT16 sBRX = 0, sBRY = 0; - MSYS_DefineRegion( &MapInventoryPoolMask, + MSYS_DefineRegion( &MapInventoryPoolMask, MAP_INVENTORY_POOL_SLOT_START_X, 0, SCREEN_WIDTH - MAP_INVENTORY_POOL_SLOT_START_X, SCREEN_HEIGHT - 120, MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MapInvenPoolScreenMaskCallback); @@ -746,7 +747,7 @@ void CreateMapInventoryPoolSlots( void ) sBRX = ( INT16 ) ( MAP_INVENTORY_POOL_SLOT_START_X + ( sXA * MAP_INVEN_SPACE_BTWN_SLOTS ) ); sBRY = ( INT16 ) ( MAP_INVENTORY_POOL_SLOT_START_Y + ( sYA * MAP_INVEN_SLOT_HEIGHT ) ) - 1; - MSYS_DefineRegion( &MapInventoryPoolSlots[ iCounter ], + MSYS_DefineRegion( &MapInventoryPoolSlots[ iCounter ], sULX, sULY, sBRX, sBRY, MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MapInvenPoolSlotsMove, MapInvenPoolSlots ); @@ -788,7 +789,7 @@ void MapInvenPoolSlotsMove( MOUSE_REGION * pRegion, INT32 iReason ) iCurrentlyHighLightedItem = -1; fChangedInventorySlots = TRUE; gfCheckForCursorOverMapSectorInventoryItem = FALSE; - + // re render radar map RenderRadarScreen( ); } @@ -800,7 +801,6 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) // btn callback handler for assignment screen mask region INT32 iCounter = 0; UINT16 usOldItemIndex, usNewItemIndex; - INT16 sGridNo = 0; INT32 iOldNumberOfObjects = 0; INT16 sDistanceFromObject = 0; SOLDIERTYPE *pSoldier = NULL; @@ -813,7 +813,7 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) if ( gpItemPointer == NULL ) { fShowMapInventoryPool = FALSE; - } + } // else do nothing } else if( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP ) @@ -823,16 +823,16 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) if ( gpItemPointer == NULL ) { // Return if empty - if ( pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].o.usItem == NOTHING ) + if ( pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].object.exists() == false ) return; } - + // is this item reachable if( !( pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].usFlags & WORLD_ITEM_REACHABLE ) ) { - if ( pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].o.usItem != NOTHING ) + if ( pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].object.exists() == true ) { // not reachable DoMapMessageBox( MSG_BOX_BASIC_STYLE, gzLateLocalizedString[38], MAP_SCREEN, MSG_BOX_FLAG_OK, NULL ); @@ -842,7 +842,7 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) // check if selected merc is in this sector, if not, warn them and leave - + // valid character? if( gCharactersList[ bSelectedInfoChar ].fValid == FALSE ) { @@ -850,7 +850,7 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) return; } - + //if( fShowInventoryFlag ) { @@ -858,7 +858,7 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) if( ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorX != sSelMapX ) || ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorY != sSelMapY ) || ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].bSectorZ != iCurrentMapSectorZ ) || - ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].fBetweenSectors ) ) + ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].flags.fBetweenSectors ) ) { if ( gpItemPointer == NULL ) { @@ -872,15 +872,15 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) return; } } - + // If we do not have an item in hand, start moving it if ( gpItemPointer == NULL ) { - + // Return if empty - if ( pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].o.usItem == NOTHING ) + if ( pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].object.exists() == false ) return; // if in battle inform player they will have to do this in tactical @@ -892,6 +892,7 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) } sObjectSourceGridNo = pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].sGridNo; + sObjectSourseSoldierID = pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].soldierID; // check if this is the loaded sector, if so, then notify player, can't do anything if( ( sSelMapX == gWorldSectorX )&&( gWorldSectorY == sSelMapY ) &&(gbWorldSectorZ == iCurrentMapSectorZ ) ) @@ -899,19 +900,19 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) // notify pSoldier = &( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ] ); - sDistanceFromObject = PythSpacesAway( sObjectSourceGridNo, pSoldier -> sGridNo); + sDistanceFromObject = PythSpacesAway( sObjectSourceGridNo, pSoldier->sGridNo); /* if( sDistanceFromObject > MAX_DISTANCE_TO_PICKUP_ITEM ) { // see for the loaded sector if the merc is cloase enough? - swprintf( sString, pMapInventoryErrorString[ 0 ], Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].name ); + swprintf( sString, pMapInventoryErrorString[ 0 ], Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].name ); DoMapMessageBox( MSG_BOX_BASIC_STYLE, sString, MAP_SCREEN, MSG_BOX_FLAG_OK, NULL ); return; } */ } - BeginInventoryPoolPtr( &( pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].o ) ); + BeginInventoryPoolPtr( &( pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].object ) ); } else { @@ -924,19 +925,19 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) return; } - usOldItemIndex = pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].o.usItem; - usNewItemIndex = gpItemPointer->usItem; - iOldNumberOfObjects = pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].o.ubNumberOfObjects; - - + usOldItemIndex = pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].object.usItem; + usNewItemIndex = gpItemPointer->usItem; + iOldNumberOfObjects = pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].object.ubNumberOfObjects; + + // Else, try to place here - if ( PlaceObjectInInventoryStash( &( pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].o ), gpItemPointer ) ) + if ( PlaceObjectInInventoryStash( &( pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].object ), gpItemPointer ) ) { // set as reachable and set gridno pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].usFlags |= WORLD_ITEM_REACHABLE; - - // if loaded sector, grab grid no of dropping soldier + + // if loaded sector, grab grid no of dropping soldier //if( ( sSelMapX == gWorldSectorX )&&( gWorldSectorY == sSelMapY ) &&(gbWorldSectorZ == iCurrentMapSectorZ ) ) //{ // nothing here before, then place here @@ -951,11 +952,13 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) { pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].sGridNo = sObjectSourceGridNo; } + if( sObjectSourseSoldierID != -1 ) + pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].soldierID = sObjectSourseSoldierID; } //} // Check if it's the same now! - if ( gpItemPointer->ubNumberOfObjects == 0 ) + if ( gpItemPointer->exists() == false ) { MAPEndItemPointer( ); } @@ -965,9 +968,9 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) // now set the cursor guiExternVo = GetInterfaceGraphicForItem( &(Item[ gpItemPointer->usItem ]) ); gusExternVoSubIndex = Item[ gpItemPointer->usItem ].ubGraphicNum; - + fMapInventoryItem = TRUE; - MSYS_ChangeRegionCursor( &gMPanelRegion , EXTERN_CURSOR ); + MSYS_ChangeRegionCursor( &gMPanelRegion , EXTERN_CURSOR ); SetCurrentCursorFromDatabase( EXTERN_CURSOR ); } @@ -1012,7 +1015,7 @@ void DestroyMapInventoryButtons( void ) RemoveButton( guiMapInvenButton[ 0 ] ); - RemoveButton( guiMapInvenButton[ 1 ] ); + RemoveButton( guiMapInvenButton[ 1 ] ); UnloadButtonImage( guiMapInvenButtonImage[ 0 ] ); UnloadButtonImage( guiMapInvenButtonImage[ 1 ] ); @@ -1023,13 +1026,12 @@ void DestroyMapInventoryButtons( void ) void BuildStashForSelectedSector( INT16 sMapX, INT16 sMapY, INT16 sMapZ ) { INT32 iSize = 0; - OBJECTTYPE *pTempList = NULL; UINT32 uiItemCount = 0; UINT32 uiTotalNumberOfItems = 0, uiTotalNumberOfRealItems = 0; WORLDITEM * pTotalSectorList = NULL; INT32 iCounter = 0; UINT32 uiTotalNumberOfSeenItems=0; - + // #ifdef _DEBUG BOOLEAN fReturn = TRUE; // #endif @@ -1038,16 +1040,13 @@ void BuildStashForSelectedSector( INT16 sMapX, INT16 sMapY, INT16 sMapZ ) iSize = GetSizeOfStashInSector( sMapX, sMapY, sMapZ, TRUE ); // round off .. we want at least 1 free page of space... - iSize = ( iSize - ( iSize % MAP_INVENTORY_POOL_SLOT_COUNT ) ) + MAP_INVENTORY_POOL_SLOT_COUNT; - - iTotalNumberOfSlots = iSize; + iSize = ((iSize / MAP_INVENTORY_POOL_SLOT_COUNT) + 1) * MAP_INVENTORY_POOL_SLOT_COUNT; // allocate space for list - pInventoryPoolList = (WORLDITEM *) MemAlloc( sizeof( WORLDITEM ) * iSize ); + pInventoryPoolList.clear(); + pInventoryPoolList.resize( iSize ); - memset( pInventoryPoolList, 0, sizeof( WORLDITEM ) * iSize ); - - iLastInventoryPoolPage = ( ( iTotalNumberOfSlots - 1 ) / MAP_INVENTORY_POOL_SLOT_COUNT ); + iLastInventoryPoolPage = ( ( iSize - 1 ) / MAP_INVENTORY_POOL_SLOT_COUNT ); uiNumberOfUnSeenItems = 0; @@ -1062,15 +1061,15 @@ void BuildStashForSelectedSector( INT16 sMapX, INT16 sMapY, INT16 sMapZ ) // if visible to player, then state fact /* - if( gWorldItems[ iCounter].bVisible == 1 && - gWorldItems[ iCounter ].fExists && - gWorldItems[ iCounter ].o.usItem != SWITCH && - gWorldItems[ iCounter ].o.bTrap <= 0 ) + if( gWorldItems[ iCounter].bVisible == 1 && + gWorldItems[ iCounter ].fExists && + gWorldItems[ iCounter ].object.usItem != SWITCH && + gWorldItems[ iCounter ].object.bTrap <= 0 ) */ if( IsMapScreenWorldItemVisibleInMapInventory( &gWorldItems[ iCounter ] ) ) { // one more item - memcpy( &( pInventoryPoolList[ uiItemCount ] ), &( gWorldItems[ iCounter ] ), sizeof( WORLDITEM ) ); + pInventoryPoolList[ uiItemCount ] = gWorldItems[ iCounter ]; uiItemCount++; } } @@ -1082,20 +1081,17 @@ void BuildStashForSelectedSector( INT16 sMapX, INT16 sMapY, INT16 sMapZ ) // now allocate space for all the unseen items if( guiNumWorldItems > uiItemCount ) { - pUnSeenItems = (WORLDITEM *) MemAlloc( ( guiNumWorldItems - uiItemCount ) * sizeof( WORLDITEM ) ); + pUnSeenItems = new WORLDITEM[ guiNumWorldItems - uiItemCount ]; uiItemCount = 0; // now copy over for( iCounter = 0; ( UINT32 )iCounter < guiNumWorldItems; iCounter++ ) { -// if( ( gWorldItems[ iCounter ].bVisible != 1 ) && -// ( gWorldItems[ iCounter ].o.ubNumberOfObjects > 0 ) && -// gWorldItems[ iCounter ].fExists ) if( IsMapScreenWorldItemInvisibleInMapInventory( &gWorldItems[ iCounter ] ) ) { // one more item - memcpy( &( pUnSeenItems[ uiItemCount ] ), &( gWorldItems[ iCounter ] ), sizeof( WORLDITEM ) ); + pUnSeenItems[ uiItemCount ] = gWorldItems[ iCounter ]; uiItemCount++; } @@ -1114,33 +1110,33 @@ void BuildStashForSelectedSector( INT16 sMapX, INT16 sMapY, INT16 sMapZ ) fReturn = GetNumberOfActiveWorldItemsFromTempFile( sMapX, sMapY, ( INT8 )( sMapZ ), &( uiTotalNumberOfRealItems ) ); Assert( fReturn ); - + if( uiTotalNumberOfRealItems > 0 ) { // allocate space for the list - pTotalSectorList = (WORLDITEM *) MemAlloc( sizeof( WORLDITEM ) * uiTotalNumberOfItems ); - - + pTotalSectorList = new WORLDITEM[ uiTotalNumberOfItems ]; + + // now load into mem LoadWorldItemsFromTempItemFile( sMapX, sMapY, ( INT8 ) ( sMapZ ), pTotalSectorList ); } - // now run through list and + // now run through list and for( iCounter = 0; ( UINT32 )( iCounter )< uiTotalNumberOfRealItems; iCounter++ ) { // if visible to player, then state fact /* - if( pTotalSectorList[ iCounter].bVisible == 1 && + if( pTotalSectorList[ iCounter].bVisible == 1 && pTotalSectorList[ iCounter].fExists && - pTotalSectorList[ iCounter].o.usItem != SWITCH && - pTotalSectorList[ iCounter].o.bTrap <= 0 ) + pTotalSectorList[ iCounter].object.usItem != SWITCH && + pTotalSectorList[ iCounter].object.bTrap <= 0 ) */ //TEST!! If the item exists, and is NOT VALID, report it - if( pTotalSectorList[ iCounter].fExists && pTotalSectorList[ iCounter].o.usItem > MAXITEMS ) + if( pTotalSectorList[ iCounter].fExists && pTotalSectorList[ iCounter].object.usItem > MAXITEMS ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"The %d item in the list is NOT valid. Please send save. DF 1.", iCounter ); } @@ -1149,33 +1145,28 @@ void BuildStashForSelectedSector( INT16 sMapX, INT16 sMapY, INT16 sMapZ ) if( IsMapScreenWorldItemVisibleInMapInventory( &pTotalSectorList[ iCounter] ) ) { // one more item - memcpy( &( pInventoryPoolList[ uiItemCount ] ), &( pTotalSectorList[ iCounter ] ), sizeof( WORLDITEM ) ); + pInventoryPoolList[ uiItemCount ] = pTotalSectorList[ iCounter ]; uiItemCount++; } } - + uiTotalNumberOfSeenItems = uiItemCount; // now allocate space for all the unseen items if( uiTotalNumberOfRealItems > uiItemCount ) { - pUnSeenItems = (WORLDITEM *) MemAlloc( ( uiTotalNumberOfRealItems - uiItemCount ) * sizeof( WORLDITEM ) ); + pUnSeenItems = new WORLDITEM[ uiTotalNumberOfRealItems - uiItemCount ]; uiItemCount = 0; // now copy over for( iCounter = 0; ( UINT32 )iCounter < uiTotalNumberOfItems; iCounter++ ) { -/* - if( ( pTotalSectorList[ iCounter].bVisible != 1 ) && - ( pTotalSectorList[ iCounter].o.ubNumberOfObjects > 0 ) && - pTotalSectorList[ iCounter].fExists ) -*/ if( IsMapScreenWorldItemInvisibleInMapInventory( &pTotalSectorList[ iCounter] ) ) { // one more item - memcpy( &( pUnSeenItems[ uiItemCount ] ), &( pTotalSectorList[ iCounter ] ), sizeof( WORLDITEM ) ); + pUnSeenItems[ uiItemCount ] = pTotalSectorList[ iCounter ]; uiItemCount++; } @@ -1188,7 +1179,7 @@ void BuildStashForSelectedSector( INT16 sMapX, INT16 sMapY, INT16 sMapZ ) // if anything was alloced, then get rid of it if( uiTotalNumberOfRealItems > 0 ) { - MemFree( pTotalSectorList ); + delete[]( pTotalSectorList ); } } @@ -1219,29 +1210,23 @@ void ReBuildWorldItemStashForLoadedSector( INT32 iNumberSeenItems, INT32 iNumber // if there is a remainder, then add onto end of list if( iRemainder ) { - iTotalNumberOfItems += 10 - iRemainder; + iTotalNumberOfItems += 10 - iRemainder; } // allocate space for items - pTotalList = (WORLDITEM *) MemAlloc( sizeof( WORLDITEM ) * iTotalNumberOfItems ); - - for( iCounter = 0; iCounter < iTotalNumberOfItems; iCounter++ ) - { - // clear out the structure - memset( &( pTotalList[ iCounter ] ), 0, sizeof( WORLDITEM ) ); - } + pTotalList = new WORLDITEM[ iTotalNumberOfItems ]; // place seen items in the world for( iCounter = 0; iCounter < iNumberSeenItems; iCounter++ ) { - memcpy( &( pTotalList[ iCurrentItem ] ), &( pSeenItemsList[ iCounter ] ), sizeof( WORLDITEM ) ); + pTotalList[ iCurrentItem ] = pSeenItemsList[ iCounter ]; iCurrentItem++; } // now store the unseen item list for( iCounter = 0; iCounter < iNumberUnSeenItems; iCounter++ ) { - memcpy( &( pTotalList[ iCurrentItem ] ), &( pUnSeenItemsList[ iCounter ] ), sizeof( WORLDITEM ) ); + pTotalList[ iCurrentItem ] = pUnSeenItemsList[ iCounter ]; iCurrentItem++; } @@ -1250,14 +1235,14 @@ void ReBuildWorldItemStashForLoadedSector( INT32 iNumberSeenItems, INT32 iNumber //Count the total number of visible items for( iCounter = 0; iCounter < iNumberSeenItems; iCounter++ ) { - uiTotalNumberOfVisibleItems += pSeenItemsList[ iCounter ].o.ubNumberOfObjects; + uiTotalNumberOfVisibleItems += pSeenItemsList[ iCounter ].object.ubNumberOfObjects; } //reset the visible item count in the sector info struct SetNumberOfVisibleWorldItemsInSectorStructureForSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ , uiTotalNumberOfVisibleItems ); // clear out allocated space for total list - MemFree( pTotalList ); + delete[]( pTotalList ); // reset total list pTotalList = NULL; @@ -1265,48 +1250,13 @@ void ReBuildWorldItemStashForLoadedSector( INT32 iNumberSeenItems, INT32 iNumber return; } -void ReSizeStashListByThisAmount( INT32 iNumberOfItems ) -{ - INT32 iSizeOfList = iTotalNumberOfSlots; - WORLDITEM * pOldList; - - // no items added, leave - if( iNumberOfItems == 0 ) - { - return; - } - - iTotalNumberOfSlots+= iNumberOfItems; - - pOldList = (WORLDITEM *) MemAlloc( sizeof( WORLDITEM ) * iSizeOfList ); - memset( pOldList, 0, sizeof( WORLDITEM ) * iSizeOfList ); - - memcpy( pOldList, pInventoryPoolList, sizeof( WORLDITEM ) * iSizeOfList ); - - // rebuild stash - pInventoryPoolList = (WORLDITEM *) MemRealloc( pInventoryPoolList, sizeof( WORLDITEM ) * iTotalNumberOfSlots ); - - // set new mem to 0 - memset( pInventoryPoolList, 0, sizeof( WORLDITEM ) * iTotalNumberOfSlots ); - - // copy old info over - memcpy( pInventoryPoolList, pOldList, sizeof( WORLDITEM ) * iSizeOfList ); - - // free memeory - MemFree( pOldList ); - - return; -} - void DestroyStash( void ) { // clear out stash - MemFree( pInventoryPoolList ); + pInventoryPoolList.clear(); } - - INT32 GetSizeOfStashInSector( INT16 sMapX, INT16 sMapY, INT16 sMapZ, BOOLEAN fCountStacksAsOne ) { // get # of items in sector that are visible to the player @@ -1320,7 +1270,7 @@ INT32 GetSizeOfStashInSector( INT16 sMapX, INT16 sMapY, INT16 sMapZ, BOOLEAN fCo { uiTotalNumberOfItems = guiNumWorldItems; - // now run through list and + // now run through list and for( iCounter = 0; ( UINT32 )( iCounter )< uiTotalNumberOfItems; iCounter++ ) { // if visible to player, then state fact @@ -1334,7 +1284,7 @@ INT32 GetSizeOfStashInSector( INT16 sMapX, INT16 sMapY, INT16 sMapZ, BOOLEAN fCo } else { - uiItemCount += gWorldItems[ iCounter ].o.ubNumberOfObjects; + uiItemCount += gWorldItems[ iCounter ].object.ubNumberOfObjects; } } } @@ -1351,13 +1301,13 @@ INT32 GetSizeOfStashInSector( INT16 sMapX, INT16 sMapY, INT16 sMapZ, BOOLEAN fCo if( uiTotalNumberOfItems > 0 ) { // allocate space for the list - pTotalSectorList = (WORLDITEM *) MemAlloc( sizeof( WORLDITEM ) * uiTotalNumberOfItems ); + pTotalSectorList = new WORLDITEM[ uiTotalNumberOfItems ]; // now load into mem LoadWorldItemsFromTempItemFile( sMapX, sMapY, ( INT8 ) ( sMapZ ), pTotalSectorList ); } - // now run through list and + // now run through list and for( iCounter = 0; ( UINT32 )( iCounter )< uiTotalNumberOfRealItems; iCounter++ ) { // if visible to player, then state fact @@ -1371,18 +1321,18 @@ INT32 GetSizeOfStashInSector( INT16 sMapX, INT16 sMapY, INT16 sMapZ, BOOLEAN fCo } else { - uiItemCount += pTotalSectorList[ iCounter ].o.ubNumberOfObjects; + uiItemCount += pTotalSectorList[ iCounter ].object.ubNumberOfObjects; } } } - + // if anything was alloced, then get rid of it if( pTotalSectorList != NULL ) { - MemFree( pTotalSectorList ); + delete[]( pTotalSectorList ); pTotalSectorList = NULL; - #ifdef JA2BETAVERSION + #ifdef JA2BETAVERSION if( uiTotalNumberOfItems == 0 ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"pTotalSectorList is NOT NULL when uiTotalNumberOfRealItems is %d.", uiTotalNumberOfRealItems ); @@ -1401,8 +1351,6 @@ void BeginInventoryPoolPtr( OBJECTTYPE *pInventorySlot ) { BOOLEAN fOk = FALSE; BOOLEAN fSELLALL = gGameExternalOptions.fSellAll; - INT16 iPriceModifier = gGameExternalOptions.iPriceModifier; - // If not null return if ( gpItemPointer != NULL ) @@ -1415,64 +1363,73 @@ void BeginInventoryPoolPtr( OBJECTTYPE *pInventorySlot ) if (_KeyDown( SHIFT )) { // Remove all from soldier's slot - fOk = RemoveObjectFromStashSlot( pInventorySlot, &gItemPointer ); + fOk = (0 == pInventorySlot->MoveThisObjectTo(gItemPointer,-1,0,NUM_INV_SLOTS,MAX_OBJECTS_PER_SLOT)); } else { - GetObjFromInventoryStashSlot( pInventorySlot, &gItemPointer ); - fOk = (gItemPointer.ubNumberOfObjects == 1); + fOk = (0 == pInventorySlot->MoveThisObjectTo(gItemPointer, 1)); } if (fOk) { + if (pInventorySlot->exists() == false) { + pInventorySlot->initialize(); + } // Dirty interface fMapPanelDirty = TRUE; gpItemPointer = &gItemPointer; - if ( _KeyDown ( CTRL )) + if ( _KeyDown ( CTRL ))//Delete Item { - INT16 usDesiredItemType = gItemPointer.usItem; - gpItemPointer = NULL; fMapInventoryItem = FALSE; - if ( _KeyDown ( 89 )) //Lalien: delete all items of this type on Ctrl+Y + if ( _KeyDown ( 89 )) //Lalien: delete all items of this type on Ctrl+Y { - DeleteItemsOfType( usDesiredItemType ); + DeleteItemsOfType( gItemPointer.usItem ); + ScreenMsg( FONT_MCOLOR_LTRED, MSG_INTERFACE, L"Deleted all items of this type" ); + } + else { + ScreenMsg( FONT_MCOLOR_LTRED, MSG_INTERFACE, L"Deleted item" ); } - if ( fShowMapInventoryPool ) HandleButtonStatesWhileMapInventoryActive(); } - else if ( _KeyDown ( ALT ) && fSELLALL) + else if ( _KeyDown ( ALT ) && fSELLALL)//Sell Item { INT32 iPrice = SellItem( gItemPointer ); - PlayJA2Sample( COMPUTER_BEEP2_IN, RATE_11025, 15, 1, MIDDLEPAN ); + PlayJA2Sample( COMPUTER_BEEP2_IN, RATE_11025, 15, 1, MIDDLEPAN ); gpItemPointer = NULL; fMapInventoryItem = FALSE; - if ( _KeyDown ( 89 )) //Lalien: sell all items of this type on Alt+Y + if ( _KeyDown ( 89 )) //Lalien: sell all items of this type on Alt+Y { - for( INT32 iNumber = 0; iNumber < iTotalNumberOfSlots ; ++iNumber) + for( UINT32 iNumber = 0 ; iNumber < pInventoryPoolList.size() ; ++iNumber) { - if ( pInventoryPoolList[ iNumber ].o.usItem == gItemPointer.usItem ) + if ( pInventoryPoolList[ iNumber ].object.usItem == gItemPointer.usItem ) { - iPrice += SellItem( pInventoryPoolList[ iNumber ].o ); - DeleteObj( &pInventoryPoolList [ iNumber ].o ); + iPrice += SellItem( pInventoryPoolList[ iNumber ].object ); + DeleteObj( &pInventoryPoolList [ iNumber ].object ); } } } - //ADB you can sell items for 0, but that's not fair //and it's not easy to stop the sale so make the price 1 if (iPrice == 0) { iPrice = 1; } + if ( _KeyDown ( 89 )) //Lalien: sell all items of this type on Alt+Y + { + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Sold all items of this type" ); + } + else { + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Sold item" ); + } + AddTransactionToPlayersBook( SOLD_ITEMS, 0, GetWorldTotalMin(), iPrice ); if ( fShowMapInventoryPool ) - HandleButtonStatesWhileMapInventoryActive(); - + HandleButtonStatesWhileMapInventoryActive(); } else { @@ -1483,7 +1440,7 @@ void BeginInventoryPoolPtr( OBJECTTYPE *pInventorySlot ) gusExternVoSubIndex = Item[ gpItemPointer->usItem ].ubGraphicNum; fMapInventoryItem = TRUE; - MSYS_ChangeRegionCursor( &gMPanelRegion , EXTERN_CURSOR ); + MSYS_ChangeRegionCursor( &gMPanelRegion , EXTERN_CURSOR ); SetCurrentCursorFromDatabase( EXTERN_CURSOR ); if ( fShowInventoryFlag && bSelectedInfoChar >= 0 ) @@ -1495,173 +1452,86 @@ void BeginInventoryPoolPtr( OBJECTTYPE *pInventorySlot ) } } -// get this item out of the stash slot -BOOLEAN GetObjFromInventoryStashSlot( OBJECTTYPE *pInventorySlot, OBJECTTYPE *pItemPtr ) -{ - // item ptr - if (!pItemPtr ) - { - return( FALSE ); - } - - // if there are only one item in slot, just copy - if (pInventorySlot->ubNumberOfObjects == 1) - { - memcpy( pItemPtr, pInventorySlot, sizeof( OBJECTTYPE ) ); - DeleteObj( pInventorySlot ); - } - else - { - // take one item - pItemPtr->usItem = pInventorySlot->usItem; - - // find first unempty slot - pItemPtr->ItemData.Generic.bStatus[0] = pInventorySlot->ItemData.Generic.bStatus[0]; - pItemPtr->ubNumberOfObjects = 1; - pItemPtr->ubWeight = CalculateObjectWeight( pItemPtr ); - RemoveObjFrom( pInventorySlot, 0 ); - pInventorySlot->ubWeight = CalculateObjectWeight( pInventorySlot ); - - } - - return ( TRUE ); -} - - -BOOLEAN RemoveObjectFromStashSlot( OBJECTTYPE *pInventorySlot, OBJECTTYPE *pItemPtr ) -{ - - CHECKF( pInventorySlot ); - - if (pInventorySlot -> ubNumberOfObjects == 0) - { - return( FALSE ); - } - else - { - memcpy( pItemPtr, pInventorySlot, sizeof( OBJECTTYPE ) ); - DeleteObj( pInventorySlot ); - return( TRUE ); - } -} - BOOLEAN PlaceObjectInInventoryStash( OBJECTTYPE *pInventorySlot, OBJECTTYPE *pItemPtr ) { - UINT8 ubNumberToDrop, ubSlotLimit, ubLoop; - // if there is something there, swap it, if they are of the same type and stackable then add to the count - - ubSlotLimit = Item[pItemPtr -> usItem].ubPerPocket; - - if (pInventorySlot->ubNumberOfObjects == 0) + if (pInventorySlot->exists() == false) { // placement in an empty slot - ubNumberToDrop = pItemPtr->ubNumberOfObjects; - - if (ubNumberToDrop > ubSlotLimit && ubSlotLimit != 0) - { - // drop as many as possible into pocket - ubNumberToDrop = ubSlotLimit; - } - - // could be wrong type of object for slot... need to check... - // but assuming it isn't - memcpy( pInventorySlot, pItemPtr, sizeof( OBJECTTYPE ) ); - - if (ubNumberToDrop != pItemPtr->ubNumberOfObjects) - { - // in the InSlot copy, zero out all the objects we didn't drop - for (ubLoop = ubNumberToDrop; ubLoop < pItemPtr->ubNumberOfObjects; ubLoop++) - { - pInventorySlot->ItemData.Generic.bStatus[ubLoop] = 0; - } - } - pInventorySlot->ubNumberOfObjects = ubNumberToDrop; - - // remove a like number of objects from pObj - RemoveObjs( pItemPtr, ubNumberToDrop ); + pItemPtr->MoveThisObjectTo(*pInventorySlot); } else { - // replacement/reloading/merging/stacking - - // placement in an empty slot - ubNumberToDrop = pItemPtr->ubNumberOfObjects; - - if (pItemPtr->usItem == pInventorySlot->usItem) + if (pItemPtr->usItem == pInventorySlot->usItem && ItemSlotLimit(pItemPtr, STACK_SIZE_LIMIT) >= 2) { - if (pItemPtr->usItem == MONEY) - { - // always allow money to be combined! - // average out the status values using a weighted average... - pInventorySlot->ItemData.Generic.bStatus[0] = (INT8) ( ( (UINT32)pInventorySlot->ItemData.Money.bMoneyStatus * pInventorySlot->ItemData.Money.uiMoneyAmount + (UINT32)pItemPtr->ItemData.Money.bMoneyStatus * pItemPtr->ItemData.Money.uiMoneyAmount )/ (pInventorySlot->ItemData.Money.uiMoneyAmount + pItemPtr->ItemData.Money.uiMoneyAmount) ); - pInventorySlot->ItemData.Money.uiMoneyAmount += pItemPtr->ItemData.Money.uiMoneyAmount; - - DeleteObj( pItemPtr ); - } - else if (ubSlotLimit < 2) - { - // swapping - SwapObjs( pItemPtr, pInventorySlot ); - } - else - { - // stacking - if( ubNumberToDrop > ubSlotLimit - pInventorySlot -> ubNumberOfObjects ) - { - ubNumberToDrop = ubSlotLimit - pInventorySlot -> ubNumberOfObjects; - } - - StackObjs( pItemPtr, pInventorySlot, ubNumberToDrop ); - } + // stacking + pInventorySlot->AddObjectsToStack(*pItemPtr); } else { - - SwapObjs( pItemPtr, pInventorySlot ); + SwapObjs( pItemPtr, pInventorySlot ); } } return( TRUE ); } -BOOLEAN AutoPlaceObjectInInventoryStash( OBJECTTYPE *pItemPtr ) +BOOLEAN AutoPlaceObjectInInventoryStash( OBJECTTYPE *pItemPtr, INT16 sGridNo ) { - UINT8 ubNumberToDrop, ubSlotLimit, ubLoop; OBJECTTYPE *pInventorySlot; + INT32 cnt = 0; + + //CHRISL: I'm not sure why this never fails. Maybe it just isn't used often. But if we try and look for index + // pInventoryPoolList.size() we're going to crash since "size()" returns the total number of indecies in human terms (1-xxx) + // but we have to start with 0. In other words, size() might return a value of 10 but those are numbers 0-9. + + while(1) + { + //if we run out of indecies before running out of items to place, make new indecies + if(cnt == pInventoryPoolList.size()) + { + ResizeInventoryList(); + } + pInventorySlot = &pInventoryPoolList[cnt].object; + if(pInventorySlot->usItem == pItemPtr->usItem) + { + pInventorySlot->AddObjectsToStack(*pItemPtr); + } + else if(pInventorySlot->exists() == false) + { + pItemPtr->MoveThisObjectTo(*pInventorySlot); + if(sGridNo != 0) + { + pInventoryPoolList[cnt].sGridNo = sGridNo; + pInventoryPoolList[cnt].usFlags = 512; + pInventoryPoolList[cnt].bVisible = 1; + pInventoryPoolList[cnt].fExists = TRUE; + } + } + else + { + cnt++; + continue; + } + if(pItemPtr->exists() == false) + { + break; + } + else + { + cnt++; + } + } // if there is something there, swap it, if they are of the same type and stackable then add to the count - pInventorySlot = &( pInventoryPoolList[ iTotalNumberOfSlots ].o ); - +// pInventorySlot = &( pInventoryPoolList[ pInventoryPoolList.size() ].object ); + // placement in an empty slot - ubNumberToDrop = pItemPtr->ubNumberOfObjects; - - ubSlotLimit = ItemSlotLimit( pItemPtr->usItem, BIGPOCK1POS ); - - if (ubNumberToDrop > ubSlotLimit && ubSlotLimit != 0) - { - // drop as many as possible into pocket - ubNumberToDrop = ubSlotLimit; - } - // could be wrong type of object for slot... need to check... // but assuming it isn't - memcpy( pInventorySlot, pItemPtr, sizeof( OBJECTTYPE ) ); +// pItemPtr->MoveThisObjectTo(*pInventorySlot); - if (ubNumberToDrop != pItemPtr->ubNumberOfObjects) - { - // in the InSlot copy, zero out all the objects we didn't drop - for (ubLoop = ubNumberToDrop; ubLoop < pItemPtr->ubNumberOfObjects; ubLoop++) - { - pInventorySlot->ItemData.Generic.bStatus[ubLoop] = 0; - } - } - pInventorySlot->ubNumberOfObjects = ubNumberToDrop; - - // remove a like number of objects from pObj - RemoveObjs( pItemPtr, ubNumberToDrop ); - return( TRUE ); } @@ -1669,7 +1539,7 @@ void MapInventoryPoolNextBtn( GUI_BUTTON *btn, INT32 reason ) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { @@ -1684,14 +1554,14 @@ void MapInventoryPoolNextBtn( GUI_BUTTON *btn, INT32 reason ) fMapPanelDirty = TRUE; } } - } + } } void MapInventoryPoolPrevBtn( GUI_BUTTON *btn, INT32 reason ) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { @@ -1706,7 +1576,7 @@ void MapInventoryPoolPrevBtn( GUI_BUTTON *btn, INT32 reason ) fMapPanelDirty = TRUE; } } - } + } } @@ -1714,7 +1584,7 @@ void MapInventoryPoolDoneBtn( GUI_BUTTON *btn, INT32 reason ) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { @@ -1725,7 +1595,7 @@ void MapInventoryPoolDoneBtn( GUI_BUTTON *btn, INT32 reason ) // done fShowMapInventoryPool = FALSE; } - } + } } @@ -1742,10 +1612,10 @@ void DisplayPagesForMapInventoryPool( void ) // set the buffer SetFontDestBuffer( guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); - + // grab current and last pages swprintf( sString, L"%d / %d", iCurrentInventoryPoolPage + 1, iLastInventoryPoolPage + 1 ); - + // grab centered coords FindFontCenterCoordinates(MAP_INVENTORY_POOL_PAGE_X, MAP_INVENTORY_POOL_PAGE_Y ,MAP_INVENTORY_POOL_PAGE_WIDTH ,MAP_INVENTORY_POOL_PAGE_HEIGHT ,sString , MAP_SCREEN_FONT, &sX, &sY); @@ -1758,14 +1628,14 @@ void DisplayPagesForMapInventoryPool( void ) INT32 GetTotalNumberOfItemsInSectorStash( void ) { - INT32 iCounter, iCount = 0; + INT32 iCount = 0; // run through list of items and find out how many are there - for( iCounter = 0; iCounter < iTotalNumberOfSlots; iCounter++ ) + for( UINT32 iCounter = 0; iCounter < pInventoryPoolList.size(); iCounter++ ) { - if( pInventoryPoolList[ iCounter].o.ubNumberOfObjects > 0 ) + if( pInventoryPoolList[ iCounter].object.exists() == true ) { - iCount += pInventoryPoolList[ iCounter].o.ubNumberOfObjects; + iCount += pInventoryPoolList[ iCounter].object.ubNumberOfObjects; } } @@ -1775,12 +1645,12 @@ INT32 GetTotalNumberOfItemsInSectorStash( void ) INT32 GetTotalNumberOfItems( void ) { - INT32 iCounter, iCount = 0; + INT32 iCount = 0; // run through list of items and find out how many are there - for( iCounter = 0; iCounter < iTotalNumberOfSlots; iCounter++ ) + for(UINT32 iCounter = 0; iCounter < pInventoryPoolList.size(); iCounter++ ) { - if( pInventoryPoolList[ iCounter].o.ubNumberOfObjects > 0 ) + if( pInventoryPoolList[ iCounter].object.exists() == true ) { iCount++; } @@ -1837,10 +1707,10 @@ void DestroyInventoryPoolDoneButton( void ) { // destroy ddone button - RemoveButton( guiMapInvenButton[ 2 ] ); + RemoveButton( guiMapInvenButton[ 2 ] ); UnloadButtonImage( guiMapInvenButtonImage[ 2 ] ); - - + + return; } @@ -1848,7 +1718,7 @@ void DestroyInventoryPoolDoneButton( void ) void DisplayCurrentSector( void ) { // grab current sector being displayed - CHAR16 sString[ 32 ]; + CHAR16 sString[ 32 ]; INT16 sX, sY; @@ -1871,23 +1741,41 @@ void DisplayCurrentSector( void ) } -void CheckAndUnDateSlotAllocation( void ) +void ResizeInventoryList( void ) { - // will check number of available slots, if less than half a page, allocate a new page - INT32 iNumberOfTakenSlots = 0; - - // get number of taken slots - iNumberOfTakenSlots = GetTotalNumberOfItems( ); - - if( ( iTotalNumberOfSlots - iNumberOfTakenSlots ) < 2 ) - { - // not enough space - // need to make more space - ReSizeStashListByThisAmount( MAP_INVENTORY_POOL_SLOT_COUNT ); + if (pInventoryPoolList.empty() == true) { + pInventoryPoolList.resize(MAP_INVENTORY_POOL_SLOT_COUNT); } - iLastInventoryPoolPage = ( ( iTotalNumberOfSlots - 1 ) / MAP_INVENTORY_POOL_SLOT_COUNT ); - + int emptySlots = 0; + //if it's not the exact size of a page, then make it so + if (pInventoryPoolList.size() % MAP_INVENTORY_POOL_SLOT_COUNT) { + emptySlots = MAP_INVENTORY_POOL_SLOT_COUNT - (pInventoryPoolList.size() % MAP_INVENTORY_POOL_SLOT_COUNT); + pInventoryPoolList.resize(pInventoryPoolList.size() + emptySlots); + } + + //This lets us determine whether to create a new page based on the contents of the last page instead of every page + // which lets players move things around without having to first hunt down and fill up blank slots on other pages + iLastInventoryPoolPage = ( ( pInventoryPoolList.size() - 1 ) / MAP_INVENTORY_POOL_SLOT_COUNT ); + int lastPageIndex = iLastInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT; + int activeSlotsOnPage = 0; + for (int x = 0; x < MAP_INVENTORY_POOL_SLOT_COUNT; ++x) { + //don't test fExists because that hasn't been set yet, test object.exists + if (pInventoryPoolList[lastPageIndex + x].object.exists() == true) { + ++activeSlotsOnPage; + } + } + + //if there aren't enough empty slots we need to grow it further + emptySlots = MAP_INVENTORY_POOL_SLOT_COUNT - activeSlotsOnPage; + if (emptySlots < 3) { + //we want 1 blank page + pInventoryPoolList.resize(pInventoryPoolList.size() + MAP_INVENTORY_POOL_SLOT_COUNT); + } + + //do this again, it may have changed + iLastInventoryPoolPage = ( ( pInventoryPoolList.size() - 1 ) / MAP_INVENTORY_POOL_SLOT_COUNT ); + return; } @@ -1920,7 +1808,7 @@ void DrawTextOnMapInventoryBackground( void ) DisplayWrappedString( MAP_INV_X_OFFSET + 369, (UINT16)((SCREEN_HEIGHT - 138) - (usStringHeight / 2) ), 65, 1, MAP_IVEN_FONT, FONT_BEIGE, pMapInventoryStrings[ 1 ], FONT_BLACK, FALSE, RIGHT_JUSTIFIED ); DrawTextOnSectorInventory( ); - + SetFontDestBuffer( FRAME_BUFFER, 0,0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); return; @@ -2052,7 +1940,7 @@ void HandleMouseInCompatableItemForMapSectorInventory( INT32 iCurrentSlot ) if( giCompatibleItemBaseTime == 0 ) { giCompatibleItemBaseTime = GetJA2Clock( ); - + if( fItemWasHighLighted == TRUE ) { fTeamPanelDirty = TRUE; @@ -2060,7 +1948,7 @@ void HandleMouseInCompatableItemForMapSectorInventory( INT32 iCurrentSlot ) fItemWasHighLighted = FALSE; } } - + ResetCompatibleItemArray( ); ResetMapSectorInventoryPoolHighLights( ); @@ -2096,7 +1984,7 @@ void HandleMouseInCompatableItemForMapSectorInventory( INT32 iCurrentSlot ) giCompatibleItemBaseTime = 0; } } - + // now handle for the sector inventory if( fShowMapInventoryPool ) @@ -2153,11 +2041,12 @@ void HandleMapSectorInventory( void ) //CJC look here to add/remove checks for the sector inventory BOOLEAN IsMapScreenWorldItemVisibleInMapInventory( WORLDITEM *pWorldItem ) { - if( pWorldItem->bVisible == 1 && - pWorldItem->fExists && - pWorldItem->o.usItem != SWITCH && - pWorldItem->o.usItem != ACTION_ITEM && - pWorldItem->o.bTrap <= 0 ) + if( pWorldItem->bVisible == 1 && + pWorldItem->fExists && + pWorldItem->object.exists() == true && + pWorldItem->object.usItem != SWITCH && + pWorldItem->object.usItem != ACTION_ITEM && + pWorldItem->object[0]->data.bTrap <= 0 ) { return( TRUE ); } @@ -2169,7 +2058,8 @@ BOOLEAN IsMapScreenWorldItemVisibleInMapInventory( WORLDITEM *pWorldItem ) BOOLEAN IsMapScreenWorldItemInvisibleInMapInventory( WORLDITEM *pWorldItem ) { if( pWorldItem->fExists && - !IsMapScreenWorldItemVisibleInMapInventory( pWorldItem ) ) + pWorldItem->object.exists() == true && + !IsMapScreenWorldItemVisibleInMapInventory( pWorldItem ) ) { return( TRUE ); } @@ -2211,7 +2101,7 @@ void CheckGridNoOfItemsInMapScreenMapInventory() } } -#ifdef JA2BETAVERSION +#ifdef JA2BETAVERSION if( uiNumFlagsNotSet > 0 ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Item with invalid gridno doesnt have flag set.", uiNumFlagsNotSet ); @@ -2220,9 +2110,73 @@ void CheckGridNoOfItemsInMapScreenMapInventory() } -void SortSectorInventory( WORLDITEM *pInventory, UINT32 uiSizeOfArray ) +void SortSectorInventory( std::vector& pInventory, UINT32 uiSizeOfArray ) { - qsort( (LPVOID)pInventory, (size_t) uiSizeOfArray, sizeof(WORLDITEM), MapScreenSectorInventoryCompare ); + //first, compress the inventory by stacking like items that are reachable, while moving empty items towards the back + for (std::vector::iterator iter = pInventory.begin(); iter != pInventory.end(); ++iter) { + //if object exists, we want to try to stack it + if (iter->fExists && iter->object.exists() == true) { + + //ADB TODO if it is active and reachable etc, alternatively if it's on the same gridNo +#if 0 + if (iter->object.ubNumberOfObjects < ItemSlotLimit( iter->object.usItem, STACK_SIZE_LIMIT )) { + std::vector::iterator second = iter; + for (++second; second != pInventory.end(); ++second) { + if (second->object.usItem == iter->object.usItem + && second->object.exists() == true) { + iter->object.AddObjectsToStack(second->object, second->object.ubNumberOfObjects); + if (iter->object.ubNumberOfObjects >= ItemSlotLimit( iter->object.usItem, STACK_SIZE_LIMIT )) { + break; + } + } + } + } +#endif + } + else { + //object does not exist, so compress the list + std::vector::iterator second = iter; + for (++second; second != pInventory.end(); ++second) { + if (second->fExists && second->object.exists() == true) { + *iter = *second; + second->initialize(); + break; + } + } + if (second == pInventory.end()) { + //we reached the end of the list without finding any active item, so we can break out of this loop too! + break; + } + } + } + + //once compressed, we need only sort the existing items + //all empty items should be at the back!!! + std::vector::iterator endSort = pInventory.begin(); + for (unsigned int x = 1; x < pInventory.size(); ++x) { + if (pInventory[x].fExists && pInventory[x].object.exists() == true) { + ++endSort; + } + else { + break; + } + } + ++endSort; + + //ADB I'm not sure qsort will work with OO data, so replace it with stl sort, which is faster anyways + std::sort(pInventory.begin(), endSort); + + //then compress it by removing the empty objects, we know they are at the back + //we want the size to equal x * MAP_INVENTORY_POOL_SLOT_COUNT + for (unsigned int x = 1; x <= pInventory.size() / MAP_INVENTORY_POOL_SLOT_COUNT && pInventory.size() > x * MAP_INVENTORY_POOL_SLOT_COUNT; ++x) { + if (pInventory[x * MAP_INVENTORY_POOL_SLOT_COUNT].fExists == false + && pInventory[x * MAP_INVENTORY_POOL_SLOT_COUNT].object.exists() == false) { + //we have found a page where the first item on the page does not exist, resize to this + //we may have just cut off a blank page leaving the previous page full with no place to put + //any new objects, but ResizeInventoryList after this will take care of that. + pInventory.resize(x * MAP_INVENTORY_POOL_SLOT_COUNT); + } + } } @@ -2232,14 +2186,14 @@ INT32 MapScreenSectorInventoryCompare( const void *pNum1, const void *pNum2) WORLDITEM *pSecond = (WORLDITEM *)pNum2; UINT16 usItem1Index; UINT16 usItem2Index; - UINT8 ubItem1Quality; - UINT8 ubItem2Quality; + UINT16 ubItem1Quality; + UINT16 ubItem2Quality; - usItem1Index = pFirst->o.usItem; - usItem2Index = pSecond->o.usItem; + usItem1Index = pFirst->object.usItem; + usItem2Index = pSecond->object.usItem; - ubItem1Quality = pFirst->o.ItemData.Generic.bStatus[ 0 ]; - ubItem2Quality = pSecond->o.ItemData.Generic.bStatus[ 0 ]; + ubItem1Quality = pFirst->object[0]->data.objectStatus; + ubItem2Quality = pSecond->object[0]->data.objectStatus; return( CompareItemsForSorting( usItem1Index, usItem2Index, ubItem1Quality, ubItem2Quality ) ); } @@ -2271,12 +2225,7 @@ BOOLEAN CanPlayerUseSectorInventory( SOLDIERTYPE *pSelectedSoldier ) void DeleteAllItemsInInventoryPool() { - INT32 iNumber; - - for( iNumber = 0 ; iNumber < iTotalNumberOfSlots ; ++iNumber) - { - DeleteObj( &pInventoryPoolList [ iNumber ].o ); - } + pInventoryPoolList.clear(); fMapPanelDirty = TRUE; @@ -2293,52 +2242,85 @@ void DeleteAllItemsInInventoryPool() void DeleteItemsOfType( UINT16 usItemType ) { - INT32 iNumber; - - for( iNumber = 0 ; iNumber < iTotalNumberOfSlots ; ++iNumber) + for( UINT32 iNumber = 0 ; iNumber < pInventoryPoolList.size() ; ++iNumber) { - if ( pInventoryPoolList [ iNumber ].o.usItem == usItemType ) + if ( pInventoryPoolList [ iNumber ].object.usItem == usItemType ) { - DeleteObj( &pInventoryPoolList [ iNumber ].o ); + DeleteObj( &pInventoryPoolList [ iNumber ].object ); } } } - -INT32 SellItem( OBJECTTYPE& object ) +extern UINT8 CurrentPlayerProgressPercentage(void); +INT32 SellItem( OBJECTTYPE& object, BOOLEAN useModifier ) { INT32 iPrice = 0; INT16 iPriceModifier = gGameExternalOptions.iPriceModifier; UINT16 usItemType = object.usItem; UINT16 itemPrice = Item[usItemType].usPrice; + //CHRISL: make price modifier based on current game progress + if(iPriceModifier == 0) + { + iPriceModifier = __max(1, (INT16)((CurrentPlayerProgressPercentage()/5)+.5)); + } + else if(iPriceModifier == -1) + { + iPriceModifier = __max(1, (INT16)(((100-CurrentPlayerProgressPercentage())/5)+.5)); + } + if( Item[ usItemType ].usItemClass == IC_AMMO ) { //we are selling ammo - UINT8 magSize = Magazine[ Item[ usItemType ].ubClassIndex ].ubMagSize; + UINT16 magSize = Magazine[ Item[ usItemType ].ubClassIndex ].ubMagSize; for (INT8 bLoop = 0; bLoop < object.ubNumberOfObjects; bLoop++) { - iPrice += (INT32)( itemPrice * (float) object.ItemData.Ammo.ubShotsLeft[bLoop] / magSize ); + iPrice += (INT32)( itemPrice * (float) object[bLoop]->data.ubShotsLeft / magSize ); + } + } + else if(Item[usItemType].usItemClass == IC_LBEGEAR && UsingNewInventorySystem() == true) + { + //CHRISL: If we're selling an LBE Item, we need to verify if it's an LBENODE, first. If it is, we need to sell + // everything stored in the LBENODE before we sell teh LBE Item itself. + for(INT8 bLoop = 0; bLoop < object.ubNumberOfObjects; bLoop++) + { + if(object.IsActiveLBE(bLoop) == true) + { + LBENODE* pLBE = object.GetLBEPointer(bLoop); + if(pLBE) + { + for(unsigned int x = 0; x < pLBE->inv.size(); x++) + { + if(pLBE->inv[x].exists() == true) + { + iPrice += SellItem(pLBE->inv[x], FALSE); + } + } + } + } + iPrice += ( itemPrice * object[bLoop]->data.objectStatus / 100 ); + for (attachmentList::iterator iter = object[bLoop]->attachments.begin(); iter != object[bLoop]->attachments.end(); ++iter) { + iPrice += SellItem(*iter, FALSE); + } } } else { - //we are selling a gun or something - it could be stacked or single, and each one could have attachments + //we are selling a gun or something - it could be stacked or single, and if single it could have attachments for (INT8 bLoop = 0; bLoop < object.ubNumberOfObjects; bLoop++) { - iPrice += ( itemPrice * object.ItemData.Generic.bStatus[bLoop] / 100 ); - - for (INT8 numAttachments = 0; numAttachments < MAX_ATTACHMENTS; numAttachments++) - { - iPrice += (INT32) ( Item[object.usAttachItem[numAttachments]].usPrice * (float)object.bAttachStatus[numAttachments] / 100); + iPrice += ( itemPrice * object[bLoop]->data.objectStatus / 100 ); + for (attachmentList::iterator iter = object[bLoop]->attachments.begin(); iter != object[bLoop]->attachments.end(); ++iter) { + iPrice += SellItem(*iter, FALSE); } - } + } + } - if( iPriceModifier > 1) { + if( iPriceModifier > 1 && useModifier == TRUE) { iPrice /= iPriceModifier; } return iPrice; -} \ No newline at end of file +} diff --git a/Strategic/Map Screen Interface Map Inventory.h b/Strategic/Map Screen Interface Map Inventory.h index a956032b..fd9918d2 100644 --- a/Strategic/Map Screen Interface Map Inventory.h +++ b/Strategic/Map Screen Interface Map Inventory.h @@ -40,16 +40,15 @@ INT32 GetTotalNumberOfItems( void ); void HandleFlashForHighLightedItem( void ); // the list for the inventory -extern WORLDITEM *pInventoryPoolList; +extern std::vector pInventoryPoolList; // autoplace down object -BOOLEAN AutoPlaceObjectInInventoryStash( OBJECTTYPE *pItemPtr ); +BOOLEAN AutoPlaceObjectInInventoryStash( OBJECTTYPE *pItemPtr, INT16 sGridNo=0 ); // the current inventory item extern INT32 iCurrentlyHighLightedItem; extern BOOLEAN fFlashHighLightInventoryItemOnradarMap; extern INT16 sObjectSourceGridNo; -extern WORLDITEM *pInventoryPoolList; extern INT32 iCurrentInventoryPoolPage; extern BOOLEAN fMapInventoryItemCompatable[ ]; extern INT32 MAP_INVENTORY_POOL_SLOT_COUNT; diff --git a/Strategic/Map Screen Interface Map.cpp b/Strategic/Map Screen Interface Map.cpp index 94b203b1..5a5b9cd6 100644 --- a/Strategic/Map Screen Interface Map.cpp +++ b/Strategic/Map Screen Interface Map.cpp @@ -68,7 +68,7 @@ INT32 iZoomY = 0; // Map Scroll Defines #define SCROLL_EAST 0 -#define SCROLL_WEST 1 +#define SCROLL_WEST 1 #define SCROLL_NORTH 2 #define SCROLL_SOUTH 3 #define SCROLL_DELAY 50 @@ -85,14 +85,14 @@ INT32 iZoomY = 0; #define MAP_LEVEL_STRING_X (SCREEN_WIDTH - 208) //432 #define MAP_LEVEL_STRING_Y (SCREEN_HEIGHT - 175) //305 -// font +// font #define MAP_FONT BLOCKFONT2 // index color #define MAP_INDEX_COLOR 32*4-9 // max number of sectors viewable -#define MAX_VIEW_SECTORS 16 +#define MAX_VIEW_SECTORS 16 //Map Location index regions @@ -100,7 +100,7 @@ INT32 iZoomY = 0; // WANNE: The numbers above the map // x start of hort index -#define MAP_HORT_INDEX_X (MAP_BORDER_X + MAP_BORDER_X_OFFSET + 31)//(SCREEN_WIDTH - 348) //292 +#define MAP_HORT_INDEX_X (MAP_BORDER_X + MAP_BORDER_X_OFFSET + 31)//(SCREEN_WIDTH - 348) //292 // y position of hort index #define MAP_HORT_INDEX_Y (MAP_BORDER_Y + MAP_BORDER_Y_OFFSET + 8) // height of hort index @@ -136,33 +136,33 @@ INT32 iZoomY = 0; #define MAP_Y_ICON_OFFSET 1 // Arrow Offsets -#define UP_X 13 -#define UP_Y 7 -#define DOWN_X 0 -#define DOWN_Y -2 -#define RIGHT_X -2 -#define RIGHT_Y 11 -#define LEFT_X 2 -#define LEFT_Y 5 +#define UP_X 13 +#define UP_Y 7 +#define DOWN_X 0 +#define DOWN_Y -2 +#define RIGHT_X -2 +#define RIGHT_Y 11 +#define LEFT_X 2 +#define LEFT_Y 5 // The Path Lines -#define NORTH_LINE 1 -#define SOUTH_LINE 0 -#define WEST_LINE 3 -#define EAST_LINE 2 -#define N_TO_E_LINE 4 -#define E_TO_S_LINE 5 -#define W_TO_N_LINE 6 -#define S_TO_W_LINE 7 -#define W_TO_S_LINE 8 -#define N_TO_W_LINE 9 -#define S_TO_E_LINE 10 -#define E_TO_N_LINE 11 -#define W_TO_E_LINE 12 -#define N_TO_S_LINE 13 -#define E_TO_W_LINE 14 -#define S_TO_N_LINE 15 +#define NORTH_LINE 1 +#define SOUTH_LINE 0 +#define WEST_LINE 3 +#define EAST_LINE 2 +#define N_TO_E_LINE 4 +#define E_TO_S_LINE 5 +#define W_TO_N_LINE 6 +#define S_TO_W_LINE 7 +#define W_TO_S_LINE 8 +#define N_TO_W_LINE 9 +#define S_TO_E_LINE 10 +#define E_TO_N_LINE 11 +#define W_TO_E_LINE 12 +#define N_TO_S_LINE 13 +#define E_TO_W_LINE 14 +#define S_TO_N_LINE 15 #define W_TO_E_PART1_LINE 16 #define W_TO_E_PART2_LINE 17 #define E_TO_W_PART1_LINE 18 @@ -171,28 +171,28 @@ INT32 iZoomY = 0; #define N_TO_S_PART2_LINE 21 #define S_TO_N_PART1_LINE 22 #define S_TO_N_PART2_LINE 23 -#define GREEN_X_WEST 36 -#define GREEN_X_EAST 37 -#define GREEN_X_NORTH 38 -#define GREEN_X_SOUTH 39 -#define RED_X_WEST 40 -#define RED_X_EAST 41 -#define RED_X_NORTH 42 -#define RED_X_SOUTH 43 +#define GREEN_X_WEST 36 +#define GREEN_X_EAST 37 +#define GREEN_X_NORTH 38 +#define GREEN_X_SOUTH 39 +#define RED_X_WEST 40 +#define RED_X_EAST 41 +#define RED_X_NORTH 42 +#define RED_X_SOUTH 43 // The arrows -#define Y_NORTH_ARROW 24 -#define Y_SOUTH_ARROW 25 -#define Y_EAST_ARROW 26 -#define Y_WEST_ARROW 27 -#define W_NORTH_ARROW 28 -#define W_SOUTH_ARROW 29 -#define W_EAST_ARROW 30 -#define W_WEST_ARROW 31 -#define NORTH_ARROW 32 -#define SOUTH_ARROW 33 -#define EAST_ARROW 34 -#define WEST_ARROW 35 +#define Y_NORTH_ARROW 24 +#define Y_SOUTH_ARROW 25 +#define Y_EAST_ARROW 26 +#define Y_WEST_ARROW 27 +#define W_NORTH_ARROW 28 +#define W_SOUTH_ARROW 29 +#define W_EAST_ARROW 30 +#define W_WEST_ARROW 31 +#define NORTH_ARROW 32 +#define SOUTH_ARROW 33 +#define EAST_ARROW 34 +#define WEST_ARROW 35 #define ZOOM_Y_NORTH_ARROW 68 #define ZOOM_Y_SOUTH_ARROW 69 @@ -202,38 +202,38 @@ INT32 iZoomY = 0; #define ZOOM_W_SOUTH_ARROW 73 #define ZOOM_W_EAST_ARROW 74 #define ZOOM_W_WEST_ARROW 75 -#define ZOOM_NORTH_ARROW 76 -#define ZOOM_SOUTH_ARROW 77 -#define ZOOM_EAST_ARROW 78 -#define ZOOM_WEST_ARROW 79 -#define ARROW_DELAY 20 -#define PAUSE_DELAY 1000 +#define ZOOM_NORTH_ARROW 76 +#define ZOOM_SOUTH_ARROW 77 +#define ZOOM_EAST_ARROW 78 +#define ZOOM_WEST_ARROW 79 +#define ARROW_DELAY 20 +#define PAUSE_DELAY 1000 // The zoomed in path lines -#define SOUTH_ZOOM_LINE 44 -#define NORTH_ZOOM_LINE 45 -#define EAST_ZOOM_LINE 46 -#define WEST_ZOOM_LINE 47 -#define N_TO_E_ZOOM_LINE 48 -#define E_TO_S_ZOOM_LINE 49 -#define W_TO_N_ZOOM_LINE 50 -#define S_TO_W_ZOOM_LINE 51 -#define W_TO_S_ZOOM_LINE 52 -#define N_TO_W_ZOOM_LINE 53 -#define S_TO_E_ZOOM_LINE 54 -#define E_TO_N_ZOOM_LINE 55 -#define W_TO_E_ZOOM_LINE 56 -#define N_TO_S_ZOOM_LINE 57 -#define E_TO_W_ZOOM_LINE 58 -#define S_TO_N_ZOOM_LINE 59 -#define ZOOM_GREEN_X_WEST 80 -#define ZOOM_GREEN_X_EAST 81 -#define ZOOM_GREEN_X_NORTH 82 -#define ZOOM_GREEN_X_SOUTH 83 -#define ZOOM_RED_X_WEST 84 -#define ZOOM_RED_X_EAST 85 -#define ZOOM_RED_X_NORTH 86 -#define ZOOM_RED_X_SOUTH 87 +#define SOUTH_ZOOM_LINE 44 +#define NORTH_ZOOM_LINE 45 +#define EAST_ZOOM_LINE 46 +#define WEST_ZOOM_LINE 47 +#define N_TO_E_ZOOM_LINE 48 +#define E_TO_S_ZOOM_LINE 49 +#define W_TO_N_ZOOM_LINE 50 +#define S_TO_W_ZOOM_LINE 51 +#define W_TO_S_ZOOM_LINE 52 +#define N_TO_W_ZOOM_LINE 53 +#define S_TO_E_ZOOM_LINE 54 +#define E_TO_N_ZOOM_LINE 55 +#define W_TO_E_ZOOM_LINE 56 +#define N_TO_S_ZOOM_LINE 57 +#define E_TO_W_ZOOM_LINE 58 +#define S_TO_N_ZOOM_LINE 59 +#define ZOOM_GREEN_X_WEST 80 +#define ZOOM_GREEN_X_EAST 81 +#define ZOOM_GREEN_X_NORTH 82 +#define ZOOM_GREEN_X_SOUTH 83 +#define ZOOM_RED_X_WEST 84 +#define ZOOM_RED_X_EAST 85 +#define ZOOM_RED_X_NORTH 86 +#define ZOOM_RED_X_SOUTH 87 #define CHAR_FONT_COLOR 32*4-9 @@ -248,9 +248,9 @@ INT32 iZoomY = 0; #define WEST_OFFSET_Y 0 #define WEST_TO_SOUTH_OFFSET_Y 0 #define EAST_TO_NORTH_OFFSET_Y 0 -#define RED_WEST_OFF_X -MAP_GRID_X +#define RED_WEST_OFF_X -MAP_GRID_X #define RED_EAST_OFF_X MAP_GRID_X -#define RED_NORTH_OFF_Y -21 +#define RED_NORTH_OFF_Y -21 #define RED_SOUTH_OFF_Y 21 // the font use on the mvt icons for mapscreen @@ -286,7 +286,7 @@ UINT32 guiBULLSEYE; #define MAP_MILITIA_LOWER_ROW_Y 142 #define NUMBER_OF_MILITIA_ICONS_PER_LOWER_ROW 25 #define MILITIA_BOX_ROWS 3 -#define MILITIA_BOX_BOX_HEIGHT 36 +#define MILITIA_BOX_BOX_HEIGHT 36 #define MILITIA_BOX_BOX_WIDTH 42 #define MAP_MILITIA_BOX_POS_X 400 #define MAP_MILITIA_BOX_POS_Y 125 @@ -300,7 +300,7 @@ UINT32 guiBULLSEYE; #define MILITIA_BOX_WIDTH 133 #define MILITIA_BOX_TEXT_OFFSET_Y 4 #define MILITIA_BOX_UNASSIGNED_TEXT_OFFSET_Y 132 -#define MILITIA_BOX_TEXT_TITLE_HEIGHT 13 +#define MILITIA_BOX_TEXT_TITLE_HEIGHT 13 #define MAP_MILITIA_BOX_AUTO_BOX_X 4 #define MAP_MILITIA_BOX_AUTO_BOX_Y 167 @@ -342,7 +342,7 @@ extern MINE_STATUS_TYPE gMineStatus[]; UINT32 guiSubLevel1, guiSubLevel2, guiSubLevel3; // the between sector icons -UINT32 guiCHARBETWEENSECTORICONS; +UINT32 guiCHARBETWEENSECTORICONS; UINT32 guiCHARBETWEENSECTORICONSCLOSE; extern BOOLEAN fMapScreenBottomDirty; @@ -368,10 +368,10 @@ UINT16 *pMapLTGreenPalette; UINT16 *pMapDKGreenPalette; -// the map border eta pop up +// the map border eta pop up UINT32 guiMapBorderEtaPopUp; -// heli pop up +// heli pop up UINT32 guiMapBorderHeliSectors; // list of map sectors that player isn't allowed to even highlight @@ -479,7 +479,7 @@ UINT16 gusUndergroundNearBlack; BOOLEAN gfMilitiaPopupCreated = FALSE; INT32 giAnimateRouteBaseTime = 0; -INT32 giPotHeliPathBaseTime = 0; +INT32 giPotHeliPathBaseTime = 0; INT32 giClickHeliIconBaseTime = 0; @@ -562,35 +562,35 @@ void DrawMapIndexBigMap( BOOLEAN fSelectedCursorIsYellow ) SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); - //SetFontColors(FONT_FCOLOR_GREEN) + //SetFontColors(FONT_FCOLOR_GREEN) SetFont(MAP_FONT); SetFontForeground(MAP_INDEX_COLOR); // Dk Red is 163 SetFontBackground(FONT_MCOLOR_BLACK); fDrawCursors = CanDrawSectorCursor( ); - + for(iCount=1; iCount <= MAX_VIEW_SECTORS; iCount++) { - if( fDrawCursors && ( iCount == sSelMapX ) && ( bSelectedDestChar == -1 ) && ( fPlotForHelicopter == FALSE ) ) + if( fDrawCursors && ( iCount == sSelMapX ) && ( bSelectedDestChar == -1 ) && ( fPlotForHelicopter == FALSE ) ) SetFontForeground( ( UINT8 ) ( fSelectedCursorIsYellow ? FONT_YELLOW : FONT_WHITE ) ); else if( fDrawCursors && ( iCount == gsHighlightSectorX ) ) - SetFontForeground(FONT_WHITE); + SetFontForeground(FONT_WHITE); else - SetFontForeground(MAP_INDEX_COLOR); + SetFontForeground(MAP_INDEX_COLOR); - FindFontCenterCoordinates(((INT16)(MAP_HORT_INDEX_X+( iCount - 1) *MAP_GRID_X)), MAP_HORT_INDEX_Y, MAP_GRID_X, MAP_HORT_HEIGHT, pMapHortIndex[iCount], MAP_FONT, &usX, &usY); - mprintf(usX,usY,pMapHortIndex[iCount]); - - if( fDrawCursors && ( iCount == sSelMapY) && ( bSelectedDestChar == -1 ) && ( fPlotForHelicopter == FALSE ) ) + FindFontCenterCoordinates(((INT16)(MAP_HORT_INDEX_X+( iCount - 1) *MAP_GRID_X)), MAP_HORT_INDEX_Y, MAP_GRID_X, MAP_HORT_HEIGHT, pMapHortIndex[iCount], MAP_FONT, &usX, &usY); + mprintf(usX,usY,pMapHortIndex[iCount]); + + if( fDrawCursors && ( iCount == sSelMapY) && ( bSelectedDestChar == -1 ) && ( fPlotForHelicopter == FALSE ) ) SetFontForeground( ( UINT8 ) ( fSelectedCursorIsYellow ? FONT_YELLOW : FONT_WHITE ) ); else if( fDrawCursors && ( iCount == gsHighlightSectorY ) ) - SetFontForeground(FONT_WHITE); + SetFontForeground(FONT_WHITE); else - SetFontForeground(MAP_INDEX_COLOR); + SetFontForeground(MAP_INDEX_COLOR); - FindFontCenterCoordinates(MAP_VERT_INDEX_X, ((INT16)(MAP_VERT_INDEX_Y+ ( iCount - 1) *MAP_GRID_Y)), MAP_HORT_HEIGHT, MAP_GRID_Y, pMapVertIndex[iCount], MAP_FONT, &usX, &usY); - mprintf(usX,usY,pMapVertIndex[iCount]); + FindFontCenterCoordinates(MAP_VERT_INDEX_X, ((INT16)(MAP_VERT_INDEX_Y+ ( iCount - 1) *MAP_GRID_Y)), MAP_HORT_HEIGHT, MAP_GRID_Y, pMapVertIndex[iCount], MAP_FONT, &usX, &usY); + mprintf(usX,usY,pMapVertIndex[iCount]); } InvalidateRegion(MAP_VERT_INDEX_X, MAP_VERT_INDEX_Y,MAP_VERT_INDEX_X+MAP_HORT_HEIGHT, MAP_VERT_INDEX_Y+( iCount - 1 ) * MAP_GRID_Y ); @@ -611,38 +611,38 @@ void DrawMapIndexSmallMap( BOOLEAN fSelectedCursorIsYellow ) SetFont(MAP_FONT); SetFontDestBuffer( FRAME_BUFFER, MAP_HORT_INDEX_X, MAP_HORT_INDEX_Y, MAP_HORT_INDEX_X+(MAX_VIEW_SECTORS)*MAP_GRID_X, MAP_HORT_INDEX_Y+MAP_GRID_Y, FALSE ); - //SetFontColors(FONT_FCOLOR_GREEN) + //SetFontColors(FONT_FCOLOR_GREEN) SetFont(MAP_FONT); SetFontForeground(MAP_INDEX_COLOR); SetFontBackground(FONT_MCOLOR_BLACK); fDrawCursors = CanDrawSectorCursor( ); - + for(iCount=1; iCount <= MAX_VIEW_SECTORS; iCount++) { - if( fDrawCursors && ( iCount == sSelMapX ) && ( bSelectedDestChar == -1 ) && ( fPlotForHelicopter == FALSE ) ) + if( fDrawCursors && ( iCount == sSelMapX ) && ( bSelectedDestChar == -1 ) && ( fPlotForHelicopter == FALSE ) ) SetFontForeground( ( UINT8 ) ( fSelectedCursorIsYellow ? FONT_YELLOW : FONT_WHITE ) ); else if( fDrawCursors && ( iCount == gsHighlightSectorX ) ) - SetFontForeground(FONT_WHITE); + SetFontForeground(FONT_WHITE); else - SetFontForeground(MAP_INDEX_COLOR); + SetFontForeground(MAP_INDEX_COLOR); FindFontCenterCoordinates(((INT16)(MAP_HORT_INDEX_X+((iCount)*MAP_GRID_X)*2-iZoomX)), MAP_HORT_INDEX_Y, MAP_GRID_X*2, MAP_HORT_HEIGHT, pMapHortIndex[iCount], MAP_FONT, &usX, &usY); - mprintf(usX,usY,pMapHortIndex[iCount]); + mprintf(usX,usY,pMapHortIndex[iCount]); } SetFontDestBuffer( FRAME_BUFFER, MAP_VERT_INDEX_X, MAP_VERT_INDEX_Y, MAP_VERT_INDEX_X+MAP_GRID_X, MAP_VERT_INDEX_Y+(MAX_VIEW_SECTORS)*MAP_GRID_Y, FALSE ); - + for(iCount=1; iCount <= MAX_VIEW_SECTORS; iCount++) { - if( fDrawCursors && ( iCount == sSelMapY) && ( bSelectedDestChar == -1 ) && ( fPlotForHelicopter == FALSE ) ) + if( fDrawCursors && ( iCount == sSelMapY) && ( bSelectedDestChar == -1 ) && ( fPlotForHelicopter == FALSE ) ) SetFontForeground( ( UINT8 ) ( fSelectedCursorIsYellow ? FONT_YELLOW : FONT_WHITE ) ); else if( fDrawCursors && ( iCount == gsHighlightSectorY ) ) - SetFontForeground(FONT_WHITE); + SetFontForeground(FONT_WHITE); else - SetFontForeground(MAP_INDEX_COLOR); + SetFontForeground(MAP_INDEX_COLOR); - FindFontCenterCoordinates(MAP_VERT_INDEX_X, ((INT16)(MAP_VERT_INDEX_Y+(iCount*MAP_GRID_Y)*2-iZoomY)), MAP_HORT_HEIGHT, MAP_GRID_Y*2, pMapVertIndex[iCount], MAP_FONT, &usX, &usY); - mprintf(usX,usY,pMapVertIndex[iCount]); + FindFontCenterCoordinates(MAP_VERT_INDEX_X, ((INT16)(MAP_VERT_INDEX_Y+(iCount*MAP_GRID_Y)*2-iZoomY)), MAP_HORT_HEIGHT, MAP_GRID_Y*2, pMapVertIndex[iCount], MAP_FONT, &usX, &usY); + mprintf(usX,usY,pMapVertIndex[iCount]); } InvalidateRegion(MAP_VERT_INDEX_X, MAP_VERT_INDEX_Y,MAP_VERT_INDEX_X+MAP_HORT_HEIGHT, MAP_VERT_INDEX_Y+iCount*MAP_GRID_Y ); @@ -704,7 +704,7 @@ UINT32 DrawMap( void ) // clip blits to mapscreen region //ClipBlitsToMapViewRegion( ); - + if (fZoomFlag) { // set up bounds @@ -721,7 +721,7 @@ UINT32 DrawMap( void ) clip.iRight=clip.iLeft + MAP_VIEW_WIDTH + 2; clip.iTop=iZoomY - 3; clip.iBottom=clip.iTop + MAP_VIEW_HEIGHT - 1; - + /* clip.iLeft=clip.iLeft - 1; clip.iRight=clip.iLeft + MapScreenRect.iRight - MapScreenRect.iLeft; @@ -750,7 +750,7 @@ UINT32 DrawMap( void ) UnLockVideoSurface( guiSAVEBUFFER ); - // shade map sectors (must be done after Tixa/Orta/Mine icons have been blitted, but before icons!) + // shade map sectors (must be done after Tixa/Orta/Mine icons have been blitted, but before icons!) for ( cnt = 1; cnt < MAP_WORLD_X - 1; cnt++ ) { for ( cnt2 = 1; cnt2 < MAP_WORLD_Y - 1; cnt2++ ) @@ -838,7 +838,7 @@ UINT32 DrawMap( void ) if( fShowTownFlag ) { BlitTownGridMarkers( ); - ShowTownText( ); + ShowTownText( ); } // draw militia icons @@ -875,7 +875,7 @@ UINT32 DrawMap( void ) /* if((fShowTeamFlag)&&(fShowVehicleFlag)) - ShowTeamAndVehicles(SHOW_TEAMMATES | SHOW_VEHICLES); + ShowTeamAndVehicles(SHOW_TEAMMATES | SHOW_VEHICLES); else if(fShowTeamFlag) ShowTeamAndVehicles(SHOW_TEAMMATES); else if(fShowVehicleFlag) @@ -913,7 +913,7 @@ void GetScreenXYFromMapXY( INT16 sMapX, INT16 sMapY, INT16 *psX, INT16 *psY ) { *psX = ( sMapX * MAP_GRID_X ) + MAP_VIEW_START_X; *psY = ( sMapY * MAP_GRID_Y ) + MAP_VIEW_START_Y; - } + } } void GetScreenXYFromMapXYStationary( INT16 sMapX, INT16 sMapY, INT16 *psX, INT16 *psY ) @@ -982,9 +982,9 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen1"); } // red for low loyalty, green otherwise - SetFontForeground( ( UINT8 ) ( fLoyaltyTooLowToTrainMilitia ? FONT_MCOLOR_RED : FONT_MCOLOR_LTGREEN ) ); + SetFontForeground( ( UINT8 ) ( fLoyaltyTooLowToTrainMilitia ? FONT_MCOLOR_RED : FONT_MCOLOR_LTGREEN ) ); - DrawTownLabels(sString, sStringA, usX, usY); + DrawTownLabels(sString, sStringA, usX, usY); } } } @@ -1006,7 +1006,7 @@ void DrawTownLabels(STR16 pString, STR16 pStringA, UINT16 usFirstX, UINT16 usFir SetFontDestBuffer( guiSAVEBUFFER, MapScreenRect.iLeft + 2, MapScreenRect.iTop, MapScreenRect.iRight, MapScreenRect.iBottom , FALSE ); - + // clip blits to mapscreen region ClipBlitsToMapViewRegion( ); @@ -1056,13 +1056,13 @@ INT32 ShowOnDutyTeam( INT16 sMapX, INT16 sMapY ) { pSoldier = MercPtrs[ gCharactersList[ ubCounter ].usSolID ]; - if( !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && - ( pSoldier->sSectorX == sMapX) && - ( pSoldier->sSectorY == sMapY) && - ( pSoldier->bSectorZ == iCurrentMapSectorZ ) && - ( ( pSoldier->bAssignment < ON_DUTY ) || ( ( pSoldier->bAssignment == VEHICLE ) && ( pSoldier->iVehicleId != iHelicopterVehicleId ) ) ) && - ( pSoldier->bLife > 0) && - ( !PlayerIDGroupInMotion( pSoldier->ubGroupID ) ) ) + if( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && + ( pSoldier->sSectorX == sMapX) && + ( pSoldier->sSectorY == sMapY) && + ( pSoldier->bSectorZ == iCurrentMapSectorZ ) && + ( ( pSoldier->bAssignment < ON_DUTY ) || ( ( pSoldier->bAssignment == VEHICLE ) && ( pSoldier->iVehicleId != iHelicopterVehicleId ) ) ) && + ( pSoldier->stats.bLife > 0) && + ( !PlayerIDGroupInMotion( pSoldier->ubGroupID ) ) ) { DrawMapBoxIcon( hIconHandle, SMALL_YELLOW_BOX, sMapX, sMapY, ubIconPosition ); ubIconPosition++; @@ -1084,24 +1084,24 @@ INT32 ShowAssignedTeam(INT16 sMapX, INT16 sMapY, INT32 iCount) GetVideoObject(&hIconHandle, guiCHARICONS); ubCounter=0; - // run through list + // run through list ubIconPosition = ( UINT8 ) iCount; while(gCharactersList[ubCounter].fValid) { pSoldier = MercPtrs[ gCharactersList[ ubCounter ].usSolID ]; - // given number of on duty members, find number of assigned chars + // given number of on duty members, find number of assigned chars // start at beginning of list, look for people who are in sector and assigned - if( !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && - ( pSoldier->sSectorX == sMapX) && - ( pSoldier->sSectorY == sMapY) && - ( pSoldier->bSectorZ == iCurrentMapSectorZ ) && - ( pSoldier->bAssignment >= ON_DUTY ) && ( pSoldier->bAssignment != VEHICLE ) && - ( pSoldier->bAssignment != IN_TRANSIT ) && - ( pSoldier->bAssignment != ASSIGNMENT_POW ) && - ( pSoldier->bLife > 0 ) && - ( !PlayerIDGroupInMotion( pSoldier->ubGroupID ) ) ) + if( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && + ( pSoldier->sSectorX == sMapX) && + ( pSoldier->sSectorY == sMapY) && + ( pSoldier->bSectorZ == iCurrentMapSectorZ ) && + ( pSoldier->bAssignment >= ON_DUTY ) && ( pSoldier->bAssignment != VEHICLE ) && + ( pSoldier->bAssignment != IN_TRANSIT ) && + ( pSoldier->bAssignment != ASSIGNMENT_POW ) && + ( pSoldier->stats.bLife > 0 ) && + ( !PlayerIDGroupInMotion( pSoldier->ubGroupID ) ) ) { // skip mercs inside the helicopter if we're showing airspace level - they show up inside chopper icon instead if ( !fShowAircraftFlag || ( pSoldier->bAssignment != VEHICLE ) || ( pSoldier->iVehicleId != iHelicopterVehicleId ) ) @@ -1137,7 +1137,7 @@ INT32 ShowVehicles(INT16 sMapX, INT16 sMapY, INT32 iCount) if ( (pVehicleList[ ubCounter ].sSectorX == sMapX) && ( pVehicleList[ ubCounter ].sSectorY == sMapY ) ) { // don't show vehicles between sectors (in motion - they're counted as "people in motion" - if( ( pVehicleList[ ubCounter ].sSectorZ == iCurrentMapSectorZ ) && + if( ( pVehicleList[ ubCounter ].sSectorZ == iCurrentMapSectorZ ) && !PlayerIDGroupInMotion( pVehicleList[ ubCounter ].ubMovementGroup ) ) { // ATE: Check if this vehicle has a soldier and it's on our team..... @@ -1156,7 +1156,7 @@ INT32 ShowVehicles(INT16 sMapX, INT16 sMapY, INT32 iCount) } } - ubCounter++; + ubCounter++; } return ubIconPosition; @@ -1201,16 +1201,16 @@ void ShowUncertainNumberEnemiesInSector( INT16 sSectorX, INT16 sSectorY ) sYPosition -= 2; // small question mark - BltVideoObject(guiSAVEBUFFER, hIconHandle, SMALL_QUESTION_MARK, sXPosition, sYPosition, VO_BLT_SRCTRANSPARENCY, NULL ); - InvalidateRegion( sXPosition ,sYPosition, sXPosition + DMAP_GRID_X, sYPosition + DMAP_GRID_Y ); + BltVideoObject(guiSAVEBUFFER, hIconHandle, SMALL_QUESTION_MARK, sXPosition, sYPosition, VO_BLT_SRCTRANSPARENCY, NULL ); + InvalidateRegion( sXPosition ,sYPosition, sXPosition + DMAP_GRID_X, sYPosition + DMAP_GRID_Y ); } /* else { INT16 sX = 0, sY = 0; - GetScreenXYFromMapXYStationary( sSectorX, sSectorY, &sX, &sY ); - sYPosition = sY-MAP_GRID_Y; + GetScreenXYFromMapXYStationary( sSectorX, sSectorY, &sX, &sY ); + sYPosition = sY-MAP_GRID_Y; sXPosition = sX-MAP_GRID_X; // get the x and y position @@ -1225,8 +1225,8 @@ void ShowUncertainNumberEnemiesInSector( INT16 sSectorX, INT16 sSectorY ) // restore clip blits RestoreClipRegionToFullScreen( ); - - InvalidateRegion( sXPosition, sYPosition, sXPosition + DMAP_GRID_ZOOM_X, sYPosition + DMAP_GRID_ZOOM_Y ); + + InvalidateRegion( sXPosition, sYPosition, sXPosition + DMAP_GRID_ZOOM_X, sYPosition + DMAP_GRID_ZOOM_Y ); } */ } @@ -1282,8 +1282,8 @@ BOOLEAN ShadeMapElem( INT16 sMapX, INT16 sMapY, INT32 iColor ) UINT32 uiDestPitchBYTES; UINT32 uiSrcPitchBYTES; UINT16 *pDestBuf; - UINT8 *pSrcBuf; - SGPRect clip; + UINT8 *pSrcBuf; + SGPRect clip; UINT16 *pOriginalPallette; @@ -1308,7 +1308,7 @@ BOOLEAN ShadeMapElem( INT16 sMapX, INT16 sMapY, INT32 iColor ) sScreenX += 1; // compensate for original BIG_MAP blit being done at MAP_VIEW_START_X + 1 - clip.iLeft = 2 * ( sScreenX - ( MAP_VIEW_START_X + 1 ) ); + clip.iLeft = 2 * ( sScreenX - ( MAP_VIEW_START_X + 1 ) ); clip.iTop = 2 * ( sScreenY - MAP_VIEW_START_Y ); clip.iRight = clip.iLeft + ( 2 * MAP_GRID_X ); clip.iBottom = clip.iTop + ( 2 * MAP_GRID_Y ); @@ -1337,7 +1337,7 @@ BOOLEAN ShadeMapElem( INT16 sMapX, INT16 sMapY, INT32 iColor ) switch( iColor ) { - case( MAP_SHADE_BLACK ): + case( MAP_SHADE_BLACK ): // simply shade darker ShadowVideoSurfaceRect( guiSAVEBUFFER, sScreenX, sScreenY, sScreenX + MAP_GRID_X - 1, sScreenY + MAP_GRID_Y - 1 ); break; @@ -1363,7 +1363,7 @@ BOOLEAN ShadeMapElem( INT16 sMapX, INT16 sMapY, INT32 iColor ) // unlock source and dest buffers UnLockVideoSurface( guiBIGMAP ); - UnLockVideoSurface( guiSAVEBUFFER ); + UnLockVideoSurface( guiSAVEBUFFER ); break; @@ -1386,7 +1386,7 @@ BOOLEAN ShadeMapElem( INT16 sMapX, INT16 sMapY, INT32 iColor ) // unlock source and dest buffers UnLockVideoSurface( guiBIGMAP ); - UnLockVideoSurface( guiSAVEBUFFER ); + UnLockVideoSurface( guiSAVEBUFFER ); break; @@ -1409,7 +1409,7 @@ BOOLEAN ShadeMapElem( INT16 sMapX, INT16 sMapY, INT32 iColor ) // unlock source and dest buffers UnLockVideoSurface( guiBIGMAP ); - UnLockVideoSurface( guiSAVEBUFFER ); + UnLockVideoSurface( guiSAVEBUFFER ); break; @@ -1432,7 +1432,7 @@ BOOLEAN ShadeMapElem( INT16 sMapX, INT16 sMapY, INT32 iColor ) // unlock source and dest buffers UnLockVideoSurface( guiBIGMAP ); - UnLockVideoSurface( guiSAVEBUFFER ); + UnLockVideoSurface( guiSAVEBUFFER ); break; } @@ -1460,18 +1460,18 @@ BOOLEAN ShadeMapElemZoomIn(INT16 sMapX, INT16 sMapY, INT32 iColor ) UINT8 *pSrcBuf; SGPRect clip; UINT16 *pOriginalPallette; - + // get sX and sY iX=(INT32)sMapX; iY=(INT32)sMapY; - + // trabslate to screen co-ords for zoomed - GetScreenXYFromMapXYStationary( ((UINT16)(iX)),((UINT16)(iY)) , &sScreenX, &sScreenY ); - + GetScreenXYFromMapXYStationary( ((UINT16)(iX)),((UINT16)(iY)) , &sScreenX, &sScreenY ); + // shift left by one sector iY=(INT32)sScreenY-MAP_GRID_Y; - iX=(INT32)sScreenX-MAP_GRID_X; - + iX=(INT32)sScreenX-MAP_GRID_X; + // get original video surface palette CHECKF( GetVideoSurface( &hSrcVSurface, guiBIGMAP) ); pOriginalPallette = hSrcVSurface->p16BPPPalette; @@ -1479,28 +1479,28 @@ BOOLEAN ShadeMapElemZoomIn(INT16 sMapX, INT16 sMapY, INT32 iColor ) if((iX >MapScreenRect.iLeft-MAP_GRID_X*2)&&(iX MapScreenRect.iTop-MAP_GRID_Y*2)&&(iY < MapScreenRect.iBottom)) { sScreenX=(INT16)iX; - sScreenY=(INT16)iY; + sScreenY=(INT16)iY; + + if( iColor == MAP_SHADE_BLACK ) + { + clip.iLeft = sScreenX + 1; + clip.iRight = sScreenX + MAP_GRID_X*2 - 1; + clip.iTop = sScreenY; + clip.iBottom = sScreenY + MAP_GRID_Y*2 - 1; + } + else + { + clip.iLeft=iZoomX + sScreenX - MAP_VIEW_START_X - MAP_GRID_X ; + clip.iRight=clip.iLeft + MAP_GRID_X*2; + clip.iTop=iZoomY + sScreenY - MAP_VIEW_START_Y - MAP_GRID_Y; + clip.iBottom=clip.iTop + MAP_GRID_Y*2; - if( iColor == MAP_SHADE_BLACK ) - { - clip.iLeft = sScreenX + 1; - clip.iRight = sScreenX + MAP_GRID_X*2 - 1; - clip.iTop = sScreenY; - clip.iBottom = sScreenY + MAP_GRID_Y*2 - 1; - } - else - { - clip.iLeft=iZoomX + sScreenX - MAP_VIEW_START_X - MAP_GRID_X ; - clip.iRight=clip.iLeft + MAP_GRID_X*2; - clip.iTop=iZoomY + sScreenY - MAP_VIEW_START_Y - MAP_GRID_Y; - clip.iBottom=clip.iTop + MAP_GRID_Y*2; - if( sScreenY <= MapScreenRect.iTop + 10 ) { clip.iTop -= 5; sScreenY -= 5; } - + if( sMapX == 1 ) { @@ -1510,30 +1510,30 @@ BOOLEAN ShadeMapElemZoomIn(INT16 sMapX, INT16 sMapY, INT32 iColor ) else { sScreenX +=1; - } - } - - if( sScreenX >= MapScreenRect.iRight - 2 * MAP_GRID_X ) - { - clip.iRight++; - } + } + } - if( sScreenY >= MapScreenRect.iBottom - 2 * MAP_GRID_X ) - { - clip.iBottom++; - } + if( sScreenX >= MapScreenRect.iRight - 2 * MAP_GRID_X ) + { + clip.iRight++; + } - sScreenX += 1; - sScreenY += 1; + if( sScreenY >= MapScreenRect.iBottom - 2 * MAP_GRID_X ) + { + clip.iBottom++; + } - if( ( sScreenX > MapScreenRect.iRight ) || ( sScreenY > MapScreenRect.iBottom ) ) - { - return( FALSE ); - } + sScreenX += 1; + sScreenY += 1; - switch( iColor ) - { - case( MAP_SHADE_BLACK ): + if( ( sScreenX > MapScreenRect.iRight ) || ( sScreenY > MapScreenRect.iBottom ) ) + { + return( FALSE ); + } + + switch( iColor ) + { + case( MAP_SHADE_BLACK ): // simply shade darker if( iCurrentMapSectorZ > 0 ) { @@ -1546,7 +1546,7 @@ BOOLEAN ShadeMapElemZoomIn(INT16 sMapX, INT16 sMapY, INT32 iColor ) // grab video surface and set palette CHECKF( GetVideoSurface( &hSrcVSurface, guiBIGMAP) ); hSrcVSurface->p16BPPPalette = pMapLTGreenPalette; - + // lock source and dest buffers pDestBuf = (UINT16*)LockVideoSurface( guiSAVEBUFFER, &uiDestPitchBYTES); CHECKF( GetVideoSurface( &hSrcVSurface, guiBIGMAP) ); @@ -1557,7 +1557,7 @@ BOOLEAN ShadeMapElemZoomIn(INT16 sMapX, INT16 sMapY, INT32 iColor ) // unlock source and dest buffers UnLockVideoSurface( guiBIGMAP ); - UnLockVideoSurface( guiSAVEBUFFER ); + UnLockVideoSurface( guiSAVEBUFFER ); break; @@ -1577,7 +1577,7 @@ BOOLEAN ShadeMapElemZoomIn(INT16 sMapX, INT16 sMapY, INT32 iColor ) // unlock source and dest buffers UnLockVideoSurface( guiBIGMAP ); - UnLockVideoSurface( guiSAVEBUFFER ); + UnLockVideoSurface( guiSAVEBUFFER ); break; @@ -1597,7 +1597,7 @@ BOOLEAN ShadeMapElemZoomIn(INT16 sMapX, INT16 sMapY, INT32 iColor ) // unlock source and dest buffers UnLockVideoSurface( guiBIGMAP ); - UnLockVideoSurface( guiSAVEBUFFER ); + UnLockVideoSurface( guiSAVEBUFFER ); break; @@ -1617,7 +1617,7 @@ BOOLEAN ShadeMapElemZoomIn(INT16 sMapX, INT16 sMapY, INT32 iColor ) // unlock source and dest buffers UnLockVideoSurface( guiBIGMAP ); - UnLockVideoSurface( guiSAVEBUFFER ); + UnLockVideoSurface( guiSAVEBUFFER ); break; @@ -1714,7 +1714,7 @@ void PlotPathForCharacter( SOLDIERTYPE *pCharacter, INT16 sX, INT16 sY, BOOLEAN return; } - if( ( pCharacter->bAssignment == VEHICLE ) || ( pCharacter->uiStatusFlags & SOLDIER_VEHICLE ) ) + if( ( pCharacter->bAssignment == VEHICLE ) || ( pCharacter->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { SetUpMvtGroupForVehicle( pCharacter ); } @@ -1730,9 +1730,9 @@ void PlotPathForCharacter( SOLDIERTYPE *pCharacter, INT16 sX, INT16 sY, BOOLEAN pCharacter->pMercPath = MoveToBeginningOfPathList( pCharacter->pMercPath ); // check if in vehicle, if so, copy path to vehicle - if( ( pCharacter->bAssignment == VEHICLE ) || ( pCharacter->uiStatusFlags & SOLDIER_VEHICLE ) ) + if( ( pCharacter->bAssignment == VEHICLE ) || ( pCharacter->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { - MoveCharactersPathToVehicle( pCharacter ); + MoveCharactersPathToVehicle( pCharacter ); } else { @@ -1796,7 +1796,7 @@ UINT32 ClearPathAfterThisSectorForCharacter( SOLDIERTYPE *pCharacter, INT16 sX, // be canceled. // if a vehicle - if( pCharacter->uiStatusFlags & SOLDIER_VEHICLE ) + if( pCharacter->flags.uiStatusFlags & SOLDIER_VEHICLE ) { pVehicle = &( pVehicleList[ pCharacter->bVehicleID ] ); } @@ -1912,7 +1912,7 @@ void CancelPathForGroup( GROUP *pGroup ) if( pGroup->pPlayerList ) { if( pGroup->pPlayerList->pSoldier ) - { + { // clearing one merc should be enough, it copies changes to his squad on its own CancelPathForCharacter( pGroup->pPlayerList->pSoldier ); } @@ -1959,7 +1959,7 @@ void DisplaySoldierPath( SOLDIERTYPE *pCharacter ) /* ARM: Hopefully no longer required once using GetSoldierMercPathPtr() ??? // check if in vehicle, if so, copy path to vehicle - if( ( pCharacter->bAssignment == VEHICLE )||( pCharacter->uiStatusFlags & SOLDIER_VEHICLE ) ) + if( ( pCharacter->bAssignment == VEHICLE )||( pCharacter->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { // get the real path from vehicle's structure and copy it into this soldier's CopyVehiclePathToSoldier( pCharacter ); @@ -2010,7 +2010,7 @@ void DisplayHelicopterTempPath( void ) //should we draw temp path? if( fDrawTempHeliPath ) { - TracePathRoute( TRUE, TRUE, pTempHelicopterPath ); + TracePathRoute( TRUE, TRUE, pTempHelicopterPath ); } return; @@ -2019,14 +2019,14 @@ void DisplayHelicopterTempPath( void ) void PlotPathForHelicopter( INT16 sX, INT16 sY ) { - // will plot the path for the helicopter + // will plot the path for the helicopter // no heli...go back if( !fShowAircraftFlag || !fHelicopterAvailable ) { return; } - + // is cursor allowed here?..if not..don't build path if( !IsTheCursorAllowedToHighLightThisSector( sX, sY ) ) { @@ -2147,10 +2147,7 @@ INT16 GetLastSectorOfHelicoptersPath( void ) BOOLEAN TracePathRoute(BOOLEAN fCheckFlag, BOOLEAN fForceUpDate, PathStPtr pPath ) { - PathStPtr pCurrentNode=NULL; BOOLEAN fSpeedFlag=FALSE; - BOOLEAN fUpDate=FALSE; - INT32 iDifference=0; INT32 iArrow=-1; INT32 iX, iY; INT16 sX, sY; @@ -2158,216 +2155,213 @@ BOOLEAN TracePathRoute(BOOLEAN fCheckFlag, BOOLEAN fForceUpDate, PathStPtr pPath INT32 iDeltaA, iDeltaB, iDeltaB1; INT32 iDirection = 0; BOOLEAN fUTurnFlag=FALSE; - BOOLEAN fNextNode=FALSE; - PathStPtr pTempNode=NULL; PathStPtr pNode=NULL; PathStPtr pPastNode=NULL; PathStPtr pNextNode=NULL; - UINT ubCounter = 1; HVOBJECT hMapHandle; if ( pPath==NULL ) { - return FALSE; + return FALSE; } - + while( pPath->pPrev ) { - pPath = pPath->pPrev; + pPath = pPath->pPrev; } pNode = pPath; iDirection=-1; if (pNode->pNext) - pNextNode=pNode->pNext; + pNextNode=pNode->pNext; else pNextNode=NULL; if (pNode->pPrev) - pPastNode=pNode->pPrev; + pPastNode=pNode->pPrev; else pPastNode=NULL; - GetVideoObject(&hMapHandle, guiMAPCURSORS); + GetVideoObject(&hMapHandle, guiMAPCURSORS); // go through characters list and display arrows for path while(pNode) { - fUTurnFlag=FALSE; - if ((pPastNode)&&(pNextNode)) - { - iDeltaA=(INT16)pNode->uiSectorId-(INT16)pPastNode->uiSectorId; - iDeltaB=(INT16)pNode->uiSectorId-(INT16)pNextNode->uiSectorId; + fUTurnFlag=FALSE; + if ((pPastNode)&&(pNextNode)) + { + iDeltaA=(INT16)pNode->uiSectorId-(INT16)pPastNode->uiSectorId; + iDeltaB=(INT16)pNode->uiSectorId-(INT16)pNextNode->uiSectorId; if (iDeltaA ==0) - return( FALSE ); - if(pNode->fSpeed) - fSpeedFlag=FALSE; - else - fSpeedFlag=TRUE; + return( FALSE ); + if(pNode->fSpeed) + fSpeedFlag=FALSE; + else + fSpeedFlag=TRUE; if(!fZoomFlag) { - iX=(pNode->uiSectorId%MAP_WORLD_X); - iY=(pNode->uiSectorId/MAP_WORLD_X); - iX=(iX*MAP_GRID_X)+MAP_VIEW_START_X; - iY=(iY*MAP_GRID_Y)+MAP_VIEW_START_Y; - + iX=(pNode->uiSectorId%MAP_WORLD_X); + iY=(pNode->uiSectorId/MAP_WORLD_X); + iX=(iX*MAP_GRID_X)+MAP_VIEW_START_X; + iY=(iY*MAP_GRID_Y)+MAP_VIEW_START_Y; + } else { - GetScreenXYFromMapXYStationary( ((UINT16)(pNode->uiSectorId%MAP_WORLD_X)),((UINT16)(pNode->uiSectorId/MAP_WORLD_X)) , &sX, &sY ); - iY=sY-MAP_GRID_Y; - iX=sX-MAP_GRID_X; + GetScreenXYFromMapXYStationary( ((UINT16)(pNode->uiSectorId%MAP_WORLD_X)),((UINT16)(pNode->uiSectorId/MAP_WORLD_X)) , &sX, &sY ); + iY=sY-MAP_GRID_Y; + iX=sX-MAP_GRID_X; } iArrowX=iX; - iArrowY=iY; - if ((pPastNode->pPrev)&&(pNextNode->pNext)) - { - fUTurnFlag=FALSE; + iArrowY=iY; + if ((pPastNode->pPrev)&&(pNextNode->pNext)) + { + fUTurnFlag=FALSE; // check to see if out-of sector U-turn - // for placement of arrows - iDeltaB1=pNextNode->uiSectorId-pNextNode->pNext->uiSectorId; - if ((iDeltaB1==-WORLD_MAP_X)&&(iDeltaA==-WORLD_MAP_X)&&(iDeltaB==-1)) - { - fUTurnFlag=TRUE; - } - else if((iDeltaB1==-WORLD_MAP_X)&&(iDeltaA==-WORLD_MAP_X)&&(iDeltaB==1)) - { - fUTurnFlag=TRUE; - } - else if((iDeltaB1==WORLD_MAP_X)&&(iDeltaA==WORLD_MAP_X)&&(iDeltaB==1)) - { - fUTurnFlag=TRUE; - } - else if((iDeltaB1==-WORLD_MAP_X)&&(iDeltaA==-WORLD_MAP_X)&&(iDeltaB==1)) - { - fUTurnFlag=TRUE; - } - else if((iDeltaB1==-1)&&(iDeltaA==-1)&&(iDeltaB==-WORLD_MAP_X)) - { - fUTurnFlag=TRUE; - } - else if((iDeltaB1==-1)&&(iDeltaA==-1)&&(iDeltaB==WORLD_MAP_X)) - { - fUTurnFlag=TRUE; - } - else if((iDeltaB1==1)&&(iDeltaA==1)&&(iDeltaB==-WORLD_MAP_X)) - { - fUTurnFlag=TRUE; - } - else if((iDeltaB1==1)&&(iDeltaA==1)&&(iDeltaB==WORLD_MAP_X)) - { - fUTurnFlag=TRUE; - } - else - fUTurnFlag=FALSE; - } - - - - if ((pPastNode->uiSectorId==pNextNode->uiSectorId)) + // for placement of arrows + iDeltaB1=pNextNode->uiSectorId-pNextNode->pNext->uiSectorId; + if ((iDeltaB1==-WORLD_MAP_X)&&(iDeltaA==-WORLD_MAP_X)&&(iDeltaB==-1)) + { + fUTurnFlag=TRUE; + } + else if((iDeltaB1==-WORLD_MAP_X)&&(iDeltaA==-WORLD_MAP_X)&&(iDeltaB==1)) + { + fUTurnFlag=TRUE; + } + else if((iDeltaB1==WORLD_MAP_X)&&(iDeltaA==WORLD_MAP_X)&&(iDeltaB==1)) + { + fUTurnFlag=TRUE; + } + else if((iDeltaB1==-WORLD_MAP_X)&&(iDeltaA==-WORLD_MAP_X)&&(iDeltaB==1)) + { + fUTurnFlag=TRUE; + } + else if((iDeltaB1==-1)&&(iDeltaA==-1)&&(iDeltaB==-WORLD_MAP_X)) + { + fUTurnFlag=TRUE; + } + else if((iDeltaB1==-1)&&(iDeltaA==-1)&&(iDeltaB==WORLD_MAP_X)) + { + fUTurnFlag=TRUE; + } + else if((iDeltaB1==1)&&(iDeltaA==1)&&(iDeltaB==-WORLD_MAP_X)) + { + fUTurnFlag=TRUE; + } + else if((iDeltaB1==1)&&(iDeltaA==1)&&(iDeltaB==WORLD_MAP_X)) + { + fUTurnFlag=TRUE; + } + else + fUTurnFlag=FALSE; + } + + + + if ((pPastNode->uiSectorId==pNextNode->uiSectorId)) { - if (pPastNode->uiSectorId+WORLD_MAP_X==pNode->uiSectorId) - { - if(!(pNode->fSpeed)) - fSpeedFlag=TRUE; - else - fSpeedFlag=FALSE; - - if(fZoomFlag) + if (pPastNode->uiSectorId+WORLD_MAP_X==pNode->uiSectorId) + { + if(!(pNode->fSpeed)) + fSpeedFlag=TRUE; + else + fSpeedFlag=FALSE; + + if(fZoomFlag) { - iDirection=S_TO_N_ZOOM_LINE; - if(fSpeedFlag) - iArrow=ZOOM_Y_NORTH_ARROW; - else - iArrow=ZOOM_NORTH_ARROW; - iArrowX+=NORTH_OFFSET_X*2; - iArrowY+=NORTH_OFFSET_Y*2; + iDirection=S_TO_N_ZOOM_LINE; + if(fSpeedFlag) + iArrow=ZOOM_Y_NORTH_ARROW; + else + iArrow=ZOOM_NORTH_ARROW; + iArrowX+=NORTH_OFFSET_X*2; + iArrowY+=NORTH_OFFSET_Y*2; } - else - { - iDirection=S_TO_N_LINE; - if(fSpeedFlag) - iArrow=Y_NORTH_ARROW; - else - iArrow=NORTH_ARROW; - iArrowX+=NORTH_OFFSET_X; - iArrowY+=NORTH_OFFSET_Y; + else + { + iDirection=S_TO_N_LINE; + if(fSpeedFlag) + iArrow=Y_NORTH_ARROW; + else + iArrow=NORTH_ARROW; + iArrowX+=NORTH_OFFSET_X; + iArrowY+=NORTH_OFFSET_Y; } - } - else if(pPastNode->uiSectorId-WORLD_MAP_X==pNode->uiSectorId) - { - if(fZoomFlag) - { - iDirection=N_TO_S_ZOOM_LINE; - if(fSpeedFlag) - iArrow=ZOOM_Y_SOUTH_ARROW; - else - iArrow=ZOOM_SOUTH_ARROW; - iArrowX+=SOUTH_OFFSET_X*2; - iArrowY+=SOUTH_OFFSET_Y*2; - } - else - { - iDirection=N_TO_S_LINE; - if(fSpeedFlag) - iArrow=Y_SOUTH_ARROW; - else - iArrow=SOUTH_ARROW; - iArrowX+=SOUTH_OFFSET_X; - iArrowY+=SOUTH_OFFSET_Y; - } - } - else if (pPastNode->uiSectorId+1==pNode->uiSectorId) - { - if(fZoomFlag) - { - iDirection=E_TO_W_ZOOM_LINE; - if(fSpeedFlag) - iArrow=ZOOM_Y_WEST_ARROW; - else - iArrow=ZOOM_WEST_ARROW; - iArrowX+=WEST_OFFSET_X*2; - iArrowY+=WEST_OFFSET_Y*2; - } - else - { - iDirection=E_TO_W_LINE; - if(fSpeedFlag) - iArrow=Y_WEST_ARROW; - else - iArrow=WEST_ARROW; - iArrowX+=WEST_OFFSET_X; - iArrowY+=WEST_OFFSET_Y; - } - } - else - { - if(fZoomFlag) - { - iDirection=W_TO_E_ZOOM_LINE; - if(fSpeedFlag) - iArrow=ZOOM_Y_EAST_ARROW; - else - iArrow=ZOOM_EAST_ARROW; - iArrowX+=EAST_OFFSET_X*2; - iArrowY+=EAST_OFFSET_Y*2; - } - else - { - iDirection=W_TO_E_LINE; - if(fSpeedFlag) - iArrow=Y_EAST_ARROW; - else - iArrow=EAST_ARROW; - iArrowX+=EAST_OFFSET_X; - iArrowY+=EAST_OFFSET_Y; - } - } } - else - { - if ((iDeltaA==-1)&&(iDeltaB==1)) + else if(pPastNode->uiSectorId-WORLD_MAP_X==pNode->uiSectorId) + { + if(fZoomFlag) + { + iDirection=N_TO_S_ZOOM_LINE; + if(fSpeedFlag) + iArrow=ZOOM_Y_SOUTH_ARROW; + else + iArrow=ZOOM_SOUTH_ARROW; + iArrowX+=SOUTH_OFFSET_X*2; + iArrowY+=SOUTH_OFFSET_Y*2; + } + else + { + iDirection=N_TO_S_LINE; + if(fSpeedFlag) + iArrow=Y_SOUTH_ARROW; + else + iArrow=SOUTH_ARROW; + iArrowX+=SOUTH_OFFSET_X; + iArrowY+=SOUTH_OFFSET_Y; + } + } + else if (pPastNode->uiSectorId+1==pNode->uiSectorId) + { + if(fZoomFlag) + { + iDirection=E_TO_W_ZOOM_LINE; + if(fSpeedFlag) + iArrow=ZOOM_Y_WEST_ARROW; + else + iArrow=ZOOM_WEST_ARROW; + iArrowX+=WEST_OFFSET_X*2; + iArrowY+=WEST_OFFSET_Y*2; + } + else + { + iDirection=E_TO_W_LINE; + if(fSpeedFlag) + iArrow=Y_WEST_ARROW; + else + iArrow=WEST_ARROW; + iArrowX+=WEST_OFFSET_X; + iArrowY+=WEST_OFFSET_Y; + } + } + else + { + if(fZoomFlag) + { + iDirection=W_TO_E_ZOOM_LINE; + if(fSpeedFlag) + iArrow=ZOOM_Y_EAST_ARROW; + else + iArrow=ZOOM_EAST_ARROW; + iArrowX+=EAST_OFFSET_X*2; + iArrowY+=EAST_OFFSET_Y*2; + } + else + { + iDirection=W_TO_E_LINE; + if(fSpeedFlag) + iArrow=Y_EAST_ARROW; + else + iArrow=EAST_ARROW; + iArrowX+=EAST_OFFSET_X; + iArrowY+=EAST_OFFSET_Y; + } + } + } + else + { + if ((iDeltaA==-1)&&(iDeltaB==1)) { /* if( pPastNode == NULL ) @@ -2376,496 +2370,496 @@ BOOLEAN TracePathRoute(BOOLEAN fCheckFlag, BOOLEAN fForceUpDate, PathStPtr pPath } */ - if(fZoomFlag) + if(fZoomFlag) { - iDirection=WEST_ZOOM_LINE; - if(fSpeedFlag) - iArrow=ZOOM_Y_WEST_ARROW; - else - iArrow=ZOOM_WEST_ARROW; - iArrowX+=WEST_OFFSET_X*2; - iArrowY+=WEST_OFFSET_Y*2; + iDirection=WEST_ZOOM_LINE; + if(fSpeedFlag) + iArrow=ZOOM_Y_WEST_ARROW; + else + iArrow=ZOOM_WEST_ARROW; + iArrowX+=WEST_OFFSET_X*2; + iArrowY+=WEST_OFFSET_Y*2; } - else + else { - iDirection=WEST_LINE; - if(fSpeedFlag) - iArrow=Y_WEST_ARROW; - else - iArrow=WEST_ARROW; - iArrowX+=WEST_OFFSET_X; - iArrowY+=WEST_OFFSET_Y; + iDirection=WEST_LINE; + if(fSpeedFlag) + iArrow=Y_WEST_ARROW; + else + iArrow=WEST_ARROW; + iArrowX+=WEST_OFFSET_X; + iArrowY+=WEST_OFFSET_Y; } } else if((iDeltaA==1)&&(iDeltaB==-1)) { - if(fZoomFlag) + if(fZoomFlag) { - iDirection=EAST_ZOOM_LINE; - if(fSpeedFlag) - iArrow=ZOOM_Y_EAST_ARROW; - else - iArrow=ZOOM_EAST_ARROW; - iArrowX+=EAST_OFFSET_X*2; - iArrowY+=EAST_OFFSET_Y*2; + iDirection=EAST_ZOOM_LINE; + if(fSpeedFlag) + iArrow=ZOOM_Y_EAST_ARROW; + else + iArrow=ZOOM_EAST_ARROW; + iArrowX+=EAST_OFFSET_X*2; + iArrowY+=EAST_OFFSET_Y*2; } - else + else { - iDirection=EAST_LINE; - if(fSpeedFlag) - iArrow=Y_EAST_ARROW; - else - iArrow=EAST_ARROW; - iArrowX+=EAST_OFFSET_X; - iArrowY+=EAST_OFFSET_Y; + iDirection=EAST_LINE; + if(fSpeedFlag) + iArrow=Y_EAST_ARROW; + else + iArrow=EAST_ARROW; + iArrowX+=EAST_OFFSET_X; + iArrowY+=EAST_OFFSET_Y; } } else if((iDeltaA==-WORLD_MAP_X)&&(iDeltaB==WORLD_MAP_X)) { - if(fZoomFlag) + if(fZoomFlag) { - iDirection=NORTH_ZOOM_LINE; - if(fSpeedFlag) - iArrow=ZOOM_Y_NORTH_ARROW; - else - iArrow=ZOOM_NORTH_ARROW; - iArrowX+=NORTH_OFFSET_X*2; - iArrowY+=NORTH_OFFSET_Y*2; + iDirection=NORTH_ZOOM_LINE; + if(fSpeedFlag) + iArrow=ZOOM_Y_NORTH_ARROW; + else + iArrow=ZOOM_NORTH_ARROW; + iArrowX+=NORTH_OFFSET_X*2; + iArrowY+=NORTH_OFFSET_Y*2; } - else + else { - iDirection=NORTH_LINE; - if(fSpeedFlag) - iArrow=Y_NORTH_ARROW; - else - iArrow=NORTH_ARROW; - iArrowX+=NORTH_OFFSET_X; - iArrowY+=NORTH_OFFSET_Y; + iDirection=NORTH_LINE; + if(fSpeedFlag) + iArrow=Y_NORTH_ARROW; + else + iArrow=NORTH_ARROW; + iArrowX+=NORTH_OFFSET_X; + iArrowY+=NORTH_OFFSET_Y; } } else if((iDeltaA==WORLD_MAP_X)&&(iDeltaB==-WORLD_MAP_X)) { - if(fZoomFlag) - { + if(fZoomFlag) + { iDirection=SOUTH_ZOOM_LINE; - if(fSpeedFlag) - iArrow=ZOOM_Y_SOUTH_ARROW; - else + if(fSpeedFlag) + iArrow=ZOOM_Y_SOUTH_ARROW; + else iArrow=ZOOM_SOUTH_ARROW; - iArrowX+=SOUTH_OFFSET_X*2; - iArrowY+=SOUTH_OFFSET_Y*2; - } - else - { + iArrowX+=SOUTH_OFFSET_X*2; + iArrowY+=SOUTH_OFFSET_Y*2; + } + else + { iDirection=SOUTH_LINE; - if(fSpeedFlag) - iArrow=Y_SOUTH_ARROW; + if(fSpeedFlag) + iArrow=Y_SOUTH_ARROW; else iArrow=SOUTH_ARROW; - iArrowX+=SOUTH_OFFSET_X; - iArrowY+=SOUTH_OFFSET_Y; - } + iArrowX+=SOUTH_OFFSET_X; + iArrowY+=SOUTH_OFFSET_Y; + } } else if((iDeltaA==-WORLD_MAP_X)&&(iDeltaB==-1)) { - if(fZoomFlag) + if(fZoomFlag) { - iDirection=N_TO_E_ZOOM_LINE; - if(fSpeedFlag) - iArrow=ZOOM_Y_EAST_ARROW; - else - iArrow=ZOOM_EAST_ARROW; - iArrowX+=EAST_OFFSET_X*2; - iArrowY+=EAST_OFFSET_Y*2; + iDirection=N_TO_E_ZOOM_LINE; + if(fSpeedFlag) + iArrow=ZOOM_Y_EAST_ARROW; + else + iArrow=ZOOM_EAST_ARROW; + iArrowX+=EAST_OFFSET_X*2; + iArrowY+=EAST_OFFSET_Y*2; } - else + else { - iDirection=N_TO_E_LINE; - if(fSpeedFlag) - iArrow=Y_EAST_ARROW; - else - iArrow=EAST_ARROW; - iArrowX+=EAST_OFFSET_X; - iArrowY+=EAST_OFFSET_Y; + iDirection=N_TO_E_LINE; + if(fSpeedFlag) + iArrow=Y_EAST_ARROW; + else + iArrow=EAST_ARROW; + iArrowX+=EAST_OFFSET_X; + iArrowY+=EAST_OFFSET_Y; } } else if((iDeltaA==WORLD_MAP_X)&&(iDeltaB==1)) { - if(fZoomFlag) + if(fZoomFlag) { - iDirection=S_TO_W_ZOOM_LINE; - if(fSpeedFlag) - iArrow=ZOOM_Y_WEST_ARROW; + iDirection=S_TO_W_ZOOM_LINE; + if(fSpeedFlag) + iArrow=ZOOM_Y_WEST_ARROW; else - iArrow=ZOOM_WEST_ARROW; - iArrowX+=WEST_OFFSET_X*2; - iArrowY+=WEST_OFFSET_Y*2; + iArrow=ZOOM_WEST_ARROW; + iArrowX+=WEST_OFFSET_X*2; + iArrowY+=WEST_OFFSET_Y*2; } - else + else { - iDirection=S_TO_W_LINE; - if(fSpeedFlag) - iArrow=Y_WEST_ARROW; + iDirection=S_TO_W_LINE; + if(fSpeedFlag) + iArrow=Y_WEST_ARROW; else - iArrow=WEST_ARROW; - iArrowX+=WEST_OFFSET_X; - iArrowY+=WEST_OFFSET_Y; + iArrow=WEST_ARROW; + iArrowX+=WEST_OFFSET_X; + iArrowY+=WEST_OFFSET_Y; } } else if((iDeltaA==1)&&(iDeltaB==-WORLD_MAP_X)) { - if(fZoomFlag) + if(fZoomFlag) { - iDirection=E_TO_S_ZOOM_LINE; - if(fSpeedFlag) - iArrow=ZOOM_Y_SOUTH_ARROW; - else - iArrow=ZOOM_SOUTH_ARROW; - iArrowX+=SOUTH_OFFSET_X*2; - iArrowY+=SOUTH_OFFSET_Y*2; + iDirection=E_TO_S_ZOOM_LINE; + if(fSpeedFlag) + iArrow=ZOOM_Y_SOUTH_ARROW; + else + iArrow=ZOOM_SOUTH_ARROW; + iArrowX+=SOUTH_OFFSET_X*2; + iArrowY+=SOUTH_OFFSET_Y*2; } - else + else { - iDirection=E_TO_S_LINE; - if(fSpeedFlag) - iArrow=Y_SOUTH_ARROW; - else - iArrow=SOUTH_ARROW; - iArrowX+=SOUTH_OFFSET_X; - iArrowY+=SOUTH_OFFSET_Y; + iDirection=E_TO_S_LINE; + if(fSpeedFlag) + iArrow=Y_SOUTH_ARROW; + else + iArrow=SOUTH_ARROW; + iArrowX+=SOUTH_OFFSET_X; + iArrowY+=SOUTH_OFFSET_Y; } } else if ((iDeltaA==-1)&&(iDeltaB==WORLD_MAP_X)) { - if(fZoomFlag) + if(fZoomFlag) { - iDirection=W_TO_N_ZOOM_LINE; - if(fSpeedFlag) - iArrow=ZOOM_Y_NORTH_ARROW; - else - iArrow=ZOOM_NORTH_ARROW; - iArrowX+=NORTH_OFFSET_X*2; - iArrowY+=NORTH_OFFSET_Y*2; + iDirection=W_TO_N_ZOOM_LINE; + if(fSpeedFlag) + iArrow=ZOOM_Y_NORTH_ARROW; + else + iArrow=ZOOM_NORTH_ARROW; + iArrowX+=NORTH_OFFSET_X*2; + iArrowY+=NORTH_OFFSET_Y*2; } - else + else { - iDirection=W_TO_N_LINE; - if(fSpeedFlag) - iArrow=Y_NORTH_ARROW; - else - iArrow=NORTH_ARROW; - iArrowX+=NORTH_OFFSET_X; - iArrowY+=NORTH_OFFSET_Y; + iDirection=W_TO_N_LINE; + if(fSpeedFlag) + iArrow=Y_NORTH_ARROW; + else + iArrow=NORTH_ARROW; + iArrowX+=NORTH_OFFSET_X; + iArrowY+=NORTH_OFFSET_Y; } } else if ((iDeltaA==-1)&&(iDeltaB==-WORLD_MAP_X)) { - if(fZoomFlag) + if(fZoomFlag) { - iDirection=W_TO_S_ZOOM_LINE; - if(fSpeedFlag) - iArrow=ZOOM_Y_SOUTH_ARROW; - else - iArrow=ZOOM_SOUTH_ARROW; - iArrowX+=SOUTH_OFFSET_X*2; - iArrowY+=(SOUTH_OFFSET_Y+WEST_TO_SOUTH_OFFSET_Y)*2; + iDirection=W_TO_S_ZOOM_LINE; + if(fSpeedFlag) + iArrow=ZOOM_Y_SOUTH_ARROW; + else + iArrow=ZOOM_SOUTH_ARROW; + iArrowX+=SOUTH_OFFSET_X*2; + iArrowY+=(SOUTH_OFFSET_Y+WEST_TO_SOUTH_OFFSET_Y)*2; } - else + else { - iDirection=W_TO_S_LINE; - if(fSpeedFlag) - iArrow=Y_SOUTH_ARROW; - else - iArrow=SOUTH_ARROW; - iArrowX+=SOUTH_OFFSET_X; - iArrowY+=(SOUTH_OFFSET_Y+WEST_TO_SOUTH_OFFSET_Y); + iDirection=W_TO_S_LINE; + if(fSpeedFlag) + iArrow=Y_SOUTH_ARROW; + else + iArrow=SOUTH_ARROW; + iArrowX+=SOUTH_OFFSET_X; + iArrowY+=(SOUTH_OFFSET_Y+WEST_TO_SOUTH_OFFSET_Y); } } else if ((iDeltaA==-WORLD_MAP_X)&&(iDeltaB==1)) { - if(fZoomFlag) + if(fZoomFlag) { - iDirection=N_TO_W_ZOOM_LINE; - if(fSpeedFlag) - iArrow=ZOOM_Y_WEST_ARROW; - else - iArrow=ZOOM_WEST_ARROW; - iArrowX+=WEST_OFFSET_X*2; - iArrowY+=WEST_OFFSET_Y*2; + iDirection=N_TO_W_ZOOM_LINE; + if(fSpeedFlag) + iArrow=ZOOM_Y_WEST_ARROW; + else + iArrow=ZOOM_WEST_ARROW; + iArrowX+=WEST_OFFSET_X*2; + iArrowY+=WEST_OFFSET_Y*2; } - else + else { - iDirection=N_TO_W_LINE; - if(fSpeedFlag) - iArrow=Y_WEST_ARROW; - else - iArrow=WEST_ARROW; - iArrowX+=WEST_OFFSET_X; - iArrowY+=WEST_OFFSET_Y; + iDirection=N_TO_W_LINE; + if(fSpeedFlag) + iArrow=Y_WEST_ARROW; + else + iArrow=WEST_ARROW; + iArrowX+=WEST_OFFSET_X; + iArrowY+=WEST_OFFSET_Y; } } else if ((iDeltaA==WORLD_MAP_X)&&(iDeltaB==-1)) { - if(fZoomFlag) + if(fZoomFlag) { - iDirection=S_TO_E_ZOOM_LINE; - if(fSpeedFlag) - iArrow=ZOOM_Y_EAST_ARROW; - else - iArrow=ZOOM_EAST_ARROW; - iArrowX+=EAST_OFFSET_X*2; - iArrowY+=EAST_OFFSET_Y*2; + iDirection=S_TO_E_ZOOM_LINE; + if(fSpeedFlag) + iArrow=ZOOM_Y_EAST_ARROW; + else + iArrow=ZOOM_EAST_ARROW; + iArrowX+=EAST_OFFSET_X*2; + iArrowY+=EAST_OFFSET_Y*2; } - else + else { - iDirection=S_TO_E_LINE; - if(fSpeedFlag) - iArrow=Y_EAST_ARROW; - else - iArrow=EAST_ARROW; - iArrowX+=EAST_OFFSET_X; - iArrowY+=EAST_OFFSET_Y; + iDirection=S_TO_E_LINE; + if(fSpeedFlag) + iArrow=Y_EAST_ARROW; + else + iArrow=EAST_ARROW; + iArrowX+=EAST_OFFSET_X; + iArrowY+=EAST_OFFSET_Y; } } else if ((iDeltaA==1)&&(iDeltaB==WORLD_MAP_X)) { - if(fZoomFlag) + if(fZoomFlag) { - iDirection=E_TO_N_ZOOM_LINE; - if(fSpeedFlag) - iArrow=ZOOM_Y_NORTH_ARROW; - else - iArrow=ZOOM_NORTH_ARROW; - iArrowX+=(NORTH_OFFSET_X*2); - iArrowY+=(NORTH_OFFSET_Y+EAST_TO_NORTH_OFFSET_Y)*2; + iDirection=E_TO_N_ZOOM_LINE; + if(fSpeedFlag) + iArrow=ZOOM_Y_NORTH_ARROW; + else + iArrow=ZOOM_NORTH_ARROW; + iArrowX+=(NORTH_OFFSET_X*2); + iArrowY+=(NORTH_OFFSET_Y+EAST_TO_NORTH_OFFSET_Y)*2; } - else + else { - iDirection=E_TO_N_LINE; - if(fSpeedFlag) - iArrow=Y_NORTH_ARROW; - else - iArrow=NORTH_ARROW; - iArrowX+=NORTH_OFFSET_X; - iArrowY+=NORTH_OFFSET_Y+EAST_TO_NORTH_OFFSET_Y; + iDirection=E_TO_N_LINE; + if(fSpeedFlag) + iArrow=Y_NORTH_ARROW; + else + iArrow=NORTH_ARROW; + iArrowX+=NORTH_OFFSET_X; + iArrowY+=NORTH_OFFSET_Y+EAST_TO_NORTH_OFFSET_Y; } } - } - } - else - { + } + } + else + { if(!fZoomFlag) { - iX=(pNode->uiSectorId%MAP_WORLD_X); - iY=(pNode->uiSectorId/MAP_WORLD_X); - iX=(iX*MAP_GRID_X)+MAP_VIEW_START_X; - iY=(iY*MAP_GRID_Y)+MAP_VIEW_START_Y; - + iX=(pNode->uiSectorId%MAP_WORLD_X); + iY=(pNode->uiSectorId/MAP_WORLD_X); + iX=(iX*MAP_GRID_X)+MAP_VIEW_START_X; + iY=(iY*MAP_GRID_Y)+MAP_VIEW_START_Y; + } else { - GetScreenXYFromMapXYStationary( ((UINT16)(pNode->uiSectorId%MAP_WORLD_X)),((UINT16)(pNode->uiSectorId/MAP_WORLD_X)) , &sX, &sY ); - iY=sY-MAP_GRID_Y; - iX=sX-MAP_GRID_X; + GetScreenXYFromMapXYStationary( ((UINT16)(pNode->uiSectorId%MAP_WORLD_X)),((UINT16)(pNode->uiSectorId/MAP_WORLD_X)) , &sX, &sY ); + iY=sY-MAP_GRID_Y; + iX=sX-MAP_GRID_X; } iArrowX=iX; iArrowY=iY; - if((pNode->fSpeed)) + if((pNode->fSpeed)) fSpeedFlag=FALSE; else - fSpeedFlag=TRUE; + fSpeedFlag=TRUE; // display enter and exit 'X's - if (pPastNode) + if (pPastNode) + { + fUTurnFlag=TRUE; + iDeltaA=(INT16)pNode->uiSectorId-(INT16)pPastNode->uiSectorId; + if (iDeltaA==-1) { - fUTurnFlag=TRUE; - iDeltaA=(INT16)pNode->uiSectorId-(INT16)pPastNode->uiSectorId; - if (iDeltaA==-1) - { if(fZoomFlag) { - iDirection=ZOOM_RED_X_WEST; - //iX-=MAP_GRID_X; - //iY-=MAP_GRID_Y; + iDirection=ZOOM_RED_X_WEST; + //iX-=MAP_GRID_X; + //iY-=MAP_GRID_Y; } else - iDirection=RED_X_WEST; - //iX+=RED_WEST_OFF_X; - } - else if (iDeltaA==1) - { - if(fZoomFlag) + iDirection=RED_X_WEST; + //iX+=RED_WEST_OFF_X; + } + else if (iDeltaA==1) + { + if(fZoomFlag) { - iDirection=ZOOM_RED_X_EAST; + iDirection=ZOOM_RED_X_EAST; } else iDirection=RED_X_EAST; //iX+=RED_EAST_OFF_X; - } - else if(iDeltaA==-WORLD_MAP_X) - { - if(fZoomFlag) + } + else if(iDeltaA==-WORLD_MAP_X) + { + if(fZoomFlag) { - iDirection=ZOOM_RED_X_NORTH; + iDirection=ZOOM_RED_X_NORTH; } else - iDirection=RED_X_NORTH; - //iY+=RED_NORTH_OFF_Y; - } - else - { - if(fZoomFlag) + iDirection=RED_X_NORTH; + //iY+=RED_NORTH_OFF_Y; + } + else + { + if(fZoomFlag) { - iDirection=ZOOM_RED_X_SOUTH; + iDirection=ZOOM_RED_X_SOUTH; } else - iDirection=RED_X_SOUTH; - // iY+=RED_SOUTH_OFF_Y; - } + iDirection=RED_X_SOUTH; + // iY+=RED_SOUTH_OFF_Y; + } } if (pNextNode) { - fUTurnFlag=FALSE; - iDeltaB=(INT16)pNode->uiSectorId-(INT16)pNextNode->uiSectorId; - if((pNode->fSpeed)) + fUTurnFlag=FALSE; + iDeltaB=(INT16)pNode->uiSectorId-(INT16)pNextNode->uiSectorId; + if((pNode->fSpeed)) fSpeedFlag=FALSE; - else - fSpeedFlag=TRUE; + else + fSpeedFlag=TRUE; - if (iDeltaB==-1) + if (iDeltaB==-1) { - if(fZoomFlag) - { - iDirection=ZOOM_GREEN_X_EAST; - if(fSpeedFlag) - iArrow=ZOOM_Y_EAST_ARROW; - else - iArrow=ZOOM_EAST_ARROW; + if(fZoomFlag) + { + iDirection=ZOOM_GREEN_X_EAST; + if(fSpeedFlag) + iArrow=ZOOM_Y_EAST_ARROW; + else + iArrow=ZOOM_EAST_ARROW; iX-=0;MAP_GRID_X; iY-=0;MAP_GRID_Y; - iArrowX+=EAST_OFFSET_X*2; + iArrowX+=EAST_OFFSET_X*2; iArrowY+=EAST_OFFSET_Y*2; - } - else - { + } + else + { iDirection=GREEN_X_EAST; - if(fSpeedFlag) - iArrow=Y_EAST_ARROW; - else - iArrow=EAST_ARROW; - iArrowX+=EAST_OFFSET_X; + if(fSpeedFlag) + iArrow=Y_EAST_ARROW; + else + iArrow=EAST_ARROW; + iArrowX+=EAST_OFFSET_X; iArrowY+=EAST_OFFSET_Y; - } + } //iX+=RED_EAST_OFF_X; } else if (iDeltaB==1) - { - if(fZoomFlag) - { - iDirection=ZOOM_GREEN_X_WEST; - if(fSpeedFlag) - iArrow=ZOOM_Y_WEST_ARROW; + { + if(fZoomFlag) + { + iDirection=ZOOM_GREEN_X_WEST; + if(fSpeedFlag) + iArrow=ZOOM_Y_WEST_ARROW; else - iArrow=ZOOM_WEST_ARROW; - iArrowX+=WEST_OFFSET_X*2; + iArrow=ZOOM_WEST_ARROW; + iArrowX+=WEST_OFFSET_X*2; iArrowY+=WEST_OFFSET_Y*2; - } - else - { + } + else + { iDirection=GREEN_X_WEST; - if(fSpeedFlag) - iArrow=Y_WEST_ARROW; + if(fSpeedFlag) + iArrow=Y_WEST_ARROW; else - iArrow=WEST_ARROW; - iArrowX+=WEST_OFFSET_X; + iArrow=WEST_ARROW; + iArrowX+=WEST_OFFSET_X; iArrowY+=WEST_OFFSET_Y; - } + } //iX+=RED_WEST_OFF_X; } else if(iDeltaB==WORLD_MAP_X) { - if(fZoomFlag) - { - iDirection=ZOOM_GREEN_X_NORTH; - if(fSpeedFlag) - iArrow=ZOOM_Y_NORTH_ARROW; + if(fZoomFlag) + { + iDirection=ZOOM_GREEN_X_NORTH; + if(fSpeedFlag) + iArrow=ZOOM_Y_NORTH_ARROW; else - iArrow=ZOOM_NORTH_ARROW; - iArrowX+=NORTH_OFFSET_X*2; + iArrow=ZOOM_NORTH_ARROW; + iArrowX+=NORTH_OFFSET_X*2; iArrowY+=NORTH_OFFSET_Y*2; - } - else - { + } + else + { iDirection=GREEN_X_NORTH; - if(fSpeedFlag) - iArrow=Y_NORTH_ARROW; + if(fSpeedFlag) + iArrow=Y_NORTH_ARROW; else - iArrow=NORTH_ARROW; - iArrowX+=NORTH_OFFSET_X; + iArrow=NORTH_ARROW; + iArrowX+=NORTH_OFFSET_X; iArrowY+=NORTH_OFFSET_Y; //iY+=RED_NORTH_OFF_Y; - } } - else + } + else { - if(fZoomFlag) - { - iDirection=ZOOM_GREEN_X_SOUTH; - if(fSpeedFlag) - iArrow=ZOOM_Y_SOUTH_ARROW; - else + if(fZoomFlag) + { + iDirection=ZOOM_GREEN_X_SOUTH; + if(fSpeedFlag) + iArrow=ZOOM_Y_SOUTH_ARROW; + else iArrow=ZOOM_SOUTH_ARROW; - iArrowX+=SOUTH_OFFSET_X*2; + iArrowX+=SOUTH_OFFSET_X*2; iArrowY+=SOUTH_OFFSET_Y*2; - } - else - { + } + else + { iDirection=GREEN_X_SOUTH; - if(fSpeedFlag) - iArrow=Y_SOUTH_ARROW; - else + if(fSpeedFlag) + iArrow=Y_SOUTH_ARROW; + else iArrow=SOUTH_ARROW; - iArrowX+=SOUTH_OFFSET_X; + iArrowX+=SOUTH_OFFSET_X; iArrowY+=SOUTH_OFFSET_Y; //iY+=RED_SOUTH_OFF_Y; - } + } } } - - } - if ((iDirection !=-1)) - { - if((!fZoomFlag)||((fZoomFlag)&&(iX >MAP_VIEW_START_X)&&(iY >MAP_VIEW_START_Y)&&(iX < 640-MAP_GRID_X*2)&&(iY < MAP_VIEW_START_Y+MAP_VIEW_HEIGHT))) - { - - BltVideoObject(FRAME_BUFFER, hMapHandle, (UINT16)iDirection, iX,iY, VO_BLT_SRCTRANSPARENCY, NULL ); + } + if ((iDirection !=-1)) + { + if((!fZoomFlag)||((fZoomFlag)&&(iX >MAP_VIEW_START_X)&&(iY >MAP_VIEW_START_Y)&&(iX < 640-MAP_GRID_X*2)&&(iY < MAP_VIEW_START_Y+MAP_VIEW_HEIGHT))) + { - if(!fUTurnFlag) - { - BltVideoObject(FRAME_BUFFER, hMapHandle, (UINT16)iArrow, iArrowX, iArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); - InvalidateRegion( iArrowX, iArrowY, iArrowX + 2 * MAP_GRID_X, iArrowY + 2 * MAP_GRID_Y ); - } + BltVideoObject(FRAME_BUFFER, hMapHandle, (UINT16)iDirection, iX,iY, VO_BLT_SRCTRANSPARENCY, NULL ); + + if(!fUTurnFlag) + { + BltVideoObject(FRAME_BUFFER, hMapHandle, (UINT16)iArrow, iArrowX, iArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); + InvalidateRegion( iArrowX, iArrowY, iArrowX + 2 * MAP_GRID_X, iArrowY + 2 * MAP_GRID_Y ); + + } + + InvalidateRegion( iX, iY, iX + 2 * MAP_GRID_X, iY + 2 * MAP_GRID_Y ); + - InvalidateRegion( iX, iY, iX + 2 * MAP_GRID_X, iY + 2 * MAP_GRID_Y ); - - fUTurnFlag=FALSE; - - } - } - // check to see if there is a turn - - - pPastNode=pNode; - pNode=pNode->pNext; - if(!pNode) - return( FALSE ); - if (pNode->pNext) - pNextNode=pNode->pNext; - else - pNextNode=NULL; + + } + } + // check to see if there is a turn + + + pPastNode=pNode; + pNode=pNode->pNext; + if(!pNode) + return( FALSE ); + if (pNode->pNext) + pNextNode=pNode->pNext; + else + pNextNode=NULL; } return ( TRUE ); @@ -2882,8 +2876,8 @@ void AnimateRoute( PathStPtr pPath ) if( TraceCharAnimatedRoute( pPath, FALSE, FALSE )) { // ARM? Huh? Why the same thing twice more? - TraceCharAnimatedRoute( pPath, FALSE, TRUE ); - TraceCharAnimatedRoute( pPath, FALSE, TRUE ); + TraceCharAnimatedRoute( pPath, FALSE, TRUE ); + TraceCharAnimatedRoute( pPath, FALSE, TRUE ); } } @@ -2893,10 +2887,10 @@ void RestoreArrowBackgroundsForTrace(INT32 iArrow, INT32 iArrowX, INT32 iArrowY, INT16 sArrow=0; INT32 iX = -1, iY = -1; // find location of arrow and restore appropriate background - + if((iArrow==SOUTH_ARROW)||(iArrow==W_SOUTH_ARROW)||(iArrow==ZOOM_W_SOUTH_ARROW)||(ZOOM_SOUTH_ARROW==iArrow)) { - sArrow=SOUTH_ARROW; + sArrow=SOUTH_ARROW; } else if((iArrow==NORTH_ARROW)||(iArrow==W_NORTH_ARROW)||(iArrow==ZOOM_W_NORTH_ARROW)||(ZOOM_NORTH_ARROW==iArrow)) { @@ -2914,19 +2908,19 @@ void RestoreArrowBackgroundsForTrace(INT32 iArrow, INT32 iArrowX, INT32 iArrowY, switch(sArrow) { case(SOUTH_ARROW): - iX=iArrowX; + iX=iArrowX; iY=iArrowY; break; case(NORTH_ARROW): - iX=iArrowX; + iX=iArrowX; iY=iArrowY; break; case(WEST_ARROW): - iX=iArrowX; + iX=iArrowX; iY=iArrowY; break; case(EAST_ARROW): - iX=iArrowX; + iX=iArrowX; iY=iArrowY; break; } @@ -2934,15 +2928,15 @@ void RestoreArrowBackgroundsForTrace(INT32 iArrow, INT32 iArrowX, INT32 iArrowY, // error check if( iX == -1 ) { - return; + return; } if(!fZoom) - RestoreExternBackgroundRect(((INT16)iX),((INT16)iY),DMAP_GRID_X/2 ,DMAP_GRID_Y/2 ); + RestoreExternBackgroundRect(((INT16)iX),((INT16)iY),DMAP_GRID_X/2 ,DMAP_GRID_Y/2 ); else - RestoreExternBackgroundRect(((INT16)iX), ((INT16)iY),DMAP_GRID_ZOOM_X, DMAP_GRID_ZOOM_Y); - - + RestoreExternBackgroundRect(((INT16)iX), ((INT16)iY),DMAP_GRID_ZOOM_X, DMAP_GRID_ZOOM_Y); + + return; } @@ -2957,7 +2951,6 @@ BOOLEAN TraceCharAnimatedRoute( PathStPtr pPath, BOOLEAN fCheckFlag, BOOLEAN fFo HVOBJECT hMapHandle; BOOLEAN fSpeedFlag=FALSE; - BOOLEAN fUpDate=FALSE; INT32 iDifference=0; INT32 iArrow=-1; INT32 iX = 0, iY = 0; @@ -2977,35 +2970,35 @@ BOOLEAN TraceCharAnimatedRoute( PathStPtr pPath, BOOLEAN fCheckFlag, BOOLEAN fFo // must be plotting movement if ( ( bSelectedDestChar == -1 ) && ( fPlotForHelicopter == FALSE ) ) { - return FALSE; + return FALSE; } // if any nodes have been deleted, reset current node to beginning of the list if( fDeletedNode ) { - fDeletedNode = FALSE; - pCurrentNode = NULL; + fDeletedNode = FALSE; + pCurrentNode = NULL; } // Valid path? if ( pPath == NULL ) { - return FALSE; + return FALSE; } else { - if(pCurrentNode==NULL) - { - pCurrentNode = pPath; - } + if(pCurrentNode==NULL) + { + pCurrentNode = pPath; + } } // Check Timer if (giAnimateRouteBaseTime==0) { - giAnimateRouteBaseTime=GetJA2Clock(); - return FALSE; + giAnimateRouteBaseTime=GetJA2Clock(); + return FALSE; } // check difference in time @@ -3014,15 +3007,15 @@ BOOLEAN TraceCharAnimatedRoute( PathStPtr pPath, BOOLEAN fCheckFlag, BOOLEAN fFo // if pause flag, check time, if time passed, reset, continue on, else return if(fPauseFlag) { - if(iDifference < PAUSE_DELAY) - { - return FALSE; - } - else - { - fPauseFlag=FALSE; - giAnimateRouteBaseTime=GetJA2Clock(); - } + if(iDifference < PAUSE_DELAY) + { + return FALSE; + } + else + { + fPauseFlag=FALSE; + giAnimateRouteBaseTime=GetJA2Clock(); + } } @@ -3037,627 +3030,627 @@ BOOLEAN TraceCharAnimatedRoute( PathStPtr pPath, BOOLEAN fCheckFlag, BOOLEAN fFo else { // sufficient time, update base time - giAnimateRouteBaseTime=GetJA2Clock(); - fUpDateFlag=!fUpDateFlag; + giAnimateRouteBaseTime=GetJA2Clock(); + fUpDateFlag=!fUpDateFlag; if(fCheckFlag) - return TRUE; + return TRUE; fNextNode=TRUE; } } - + // check to see if Current node has not been deleted pTempNode = pPath; - + while(pTempNode) { - if(pTempNode==pCurrentNode) + if(pTempNode==pCurrentNode) { - //not deleted - //reset pause flag - break; - } - else - pTempNode=pTempNode->pNext; + //not deleted + //reset pause flag + break; + } + else + pTempNode=pTempNode->pNext; } // if deleted, restart at beginnning if(pTempNode==NULL) { - pCurrentNode = pPath; + pCurrentNode = pPath; + + // set pause flag + if(!pCurrentNode) + return FALSE; - // set pause flag - if(!pCurrentNode) - return FALSE; - } - + // Grab Video Objects - GetVideoObject(&hMapHandle, guiMAPCURSORS); - + GetVideoObject(&hMapHandle, guiMAPCURSORS); + // Handle drawing of arrow pNode=pCurrentNode; if((!pNode->pPrev)&&(ubCounter==1)&&(fForceUpDate)) { - ubCounter=0; - return FALSE; + ubCounter=0; + return FALSE; } else if((ubCounter==1)&&(fForceUpDate)) { - pNode=pCurrentNode->pPrev; + pNode=pCurrentNode->pPrev; } if (pNode->pNext) - pNextNode=pNode->pNext; + pNextNode=pNode->pNext; else - pNextNode=NULL; + pNextNode=NULL; if (pNode->pPrev) pPastNode=pNode->pPrev; else - pPastNode=NULL; - + pPastNode=NULL; + // go through characters list and display arrows for path fUTurnFlag=FALSE; if ((pPastNode)&&(pNextNode)) - { - iDeltaA=(INT16)pNode->uiSectorId-(INT16)pPastNode->uiSectorId; - iDeltaB=(INT16)pNode->uiSectorId-(INT16)pNextNode->uiSectorId; + { + iDeltaA=(INT16)pNode->uiSectorId-(INT16)pPastNode->uiSectorId; + iDeltaB=(INT16)pNode->uiSectorId-(INT16)pNextNode->uiSectorId; if(!pNode->fSpeed) fSpeedFlag=TRUE; else fSpeedFlag=FALSE; if (iDeltaA ==0) - return FALSE; - if(!fZoomFlag) + return FALSE; + if(!fZoomFlag) { - iX=(pNode->uiSectorId%MAP_WORLD_X); - iY=(pNode->uiSectorId/MAP_WORLD_X); - iX=(iX*MAP_GRID_X)+MAP_VIEW_START_X; - iY=(iY*MAP_GRID_Y)+MAP_VIEW_START_Y; + iX=(pNode->uiSectorId%MAP_WORLD_X); + iY=(pNode->uiSectorId/MAP_WORLD_X); + iX=(iX*MAP_GRID_X)+MAP_VIEW_START_X; + iY=(iY*MAP_GRID_Y)+MAP_VIEW_START_Y; } else { - GetScreenXYFromMapXYStationary( ((UINT16)(pNode->uiSectorId%MAP_WORLD_X)),((UINT16)(pNode->uiSectorId/MAP_WORLD_X)) , &sX, &sY ); - iY=sY-MAP_GRID_Y; - iX=sX-MAP_GRID_X; + GetScreenXYFromMapXYStationary( ((UINT16)(pNode->uiSectorId%MAP_WORLD_X)),((UINT16)(pNode->uiSectorId/MAP_WORLD_X)) , &sX, &sY ); + iY=sY-MAP_GRID_Y; + iX=sX-MAP_GRID_X; } iArrowX=iX; iArrowY=iY; - if ((pPastNode->pPrev)&&(pNextNode->pNext)) - { - fUTurnFlag=FALSE; + if ((pPastNode->pPrev)&&(pNextNode->pNext)) + { + fUTurnFlag=FALSE; // check to see if out-of sector U-turn - // for placement of arrows - iDeltaB1=pNextNode->uiSectorId-pNextNode->pNext->uiSectorId; - if ((iDeltaB1==-WORLD_MAP_X)&&(iDeltaA==-WORLD_MAP_X)&&(iDeltaB==-1)) - { - fUTurnFlag=TRUE; - } - else if((iDeltaB1==-WORLD_MAP_X)&&(iDeltaA==-WORLD_MAP_X)&&(iDeltaB==1)) - { - fUTurnFlag=TRUE; - } - else if((iDeltaB1==WORLD_MAP_X)&&(iDeltaA==WORLD_MAP_X)&&(iDeltaB==1)) - { - fUTurnFlag=TRUE; - } - else if((iDeltaB1==-WORLD_MAP_X)&&(iDeltaA==-WORLD_MAP_X)&&(iDeltaB==1)) - { - fUTurnFlag=TRUE; - } - else if((iDeltaB1==-1)&&(iDeltaA==-1)&&(iDeltaB==-WORLD_MAP_X)) - { - fUTurnFlag=TRUE; - } - else if((iDeltaB1==-1)&&(iDeltaA==-1)&&(iDeltaB==WORLD_MAP_X)) - { - fUTurnFlag=TRUE; - } - else if((iDeltaB1==1)&&(iDeltaA==1)&&(iDeltaB==-WORLD_MAP_X)) - { - fUTurnFlag=TRUE; - } - else if((iDeltaB1==1)&&(iDeltaA==1)&&(iDeltaB==WORLD_MAP_X)) - { - fUTurnFlag=TRUE; - } - else - fUTurnFlag=FALSE; - } - - + // for placement of arrows + iDeltaB1=pNextNode->uiSectorId-pNextNode->pNext->uiSectorId; + if ((iDeltaB1==-WORLD_MAP_X)&&(iDeltaA==-WORLD_MAP_X)&&(iDeltaB==-1)) + { + fUTurnFlag=TRUE; + } + else if((iDeltaB1==-WORLD_MAP_X)&&(iDeltaA==-WORLD_MAP_X)&&(iDeltaB==1)) + { + fUTurnFlag=TRUE; + } + else if((iDeltaB1==WORLD_MAP_X)&&(iDeltaA==WORLD_MAP_X)&&(iDeltaB==1)) + { + fUTurnFlag=TRUE; + } + else if((iDeltaB1==-WORLD_MAP_X)&&(iDeltaA==-WORLD_MAP_X)&&(iDeltaB==1)) + { + fUTurnFlag=TRUE; + } + else if((iDeltaB1==-1)&&(iDeltaA==-1)&&(iDeltaB==-WORLD_MAP_X)) + { + fUTurnFlag=TRUE; + } + else if((iDeltaB1==-1)&&(iDeltaA==-1)&&(iDeltaB==WORLD_MAP_X)) + { + fUTurnFlag=TRUE; + } + else if((iDeltaB1==1)&&(iDeltaA==1)&&(iDeltaB==-WORLD_MAP_X)) + { + fUTurnFlag=TRUE; + } + else if((iDeltaB1==1)&&(iDeltaA==1)&&(iDeltaB==WORLD_MAP_X)) + { + fUTurnFlag=TRUE; + } + else + fUTurnFlag=FALSE; + } + + if ((pPastNode->uiSectorId==pNextNode->uiSectorId)) { - if (pPastNode->uiSectorId+WORLD_MAP_X==pNode->uiSectorId) - { - if(fZoomFlag) - { - iDirection=S_TO_N_ZOOM_LINE; - if(!ubCounter) - iArrow=ZOOM_W_NORTH_ARROW; - else if(fSpeedFlag) - iArrow=ZOOM_Y_NORTH_ARROW; - else - iArrow=ZOOM_NORTH_ARROW; - iArrowX+=NORTH_OFFSET_X*2; - iArrowY+=NORTH_OFFSET_Y*2; - } - else - { - iDirection=S_TO_N_LINE; - if(!ubCounter) - iArrow=W_NORTH_ARROW; - else if(fSpeedFlag) - iArrow=Y_NORTH_ARROW; - else - iArrow=NORTH_ARROW; - - iArrowX+=NORTH_OFFSET_X; - iArrowY+=NORTH_OFFSET_Y; - } - } - else if(pPastNode->uiSectorId-WORLD_MAP_X==pNode->uiSectorId) - { - if(fZoomFlag) - { - iDirection=N_TO_S_ZOOM_LINE; - if(!ubCounter) - iArrow=ZOOM_W_SOUTH_ARROW; - else if(fSpeedFlag) - iArrow=ZOOM_Y_SOUTH_ARROW; - else - iArrow=ZOOM_SOUTH_ARROW; - iArrowX+=SOUTH_OFFSET_X*2; - iArrowY+=SOUTH_OFFSET_Y*2; - } - else - { - iDirection=N_TO_S_LINE; - if(!ubCounter) - iArrow=W_SOUTH_ARROW; - else if(fSpeedFlag) - iArrow=Y_SOUTH_ARROW; - else - iArrow=SOUTH_ARROW; - iArrowX+=SOUTH_OFFSET_X; - iArrowY+=SOUTH_OFFSET_Y; - } - } - else if (pPastNode->uiSectorId+1==pNode->uiSectorId) - { - if(fZoomFlag) - { - iDirection=E_TO_W_ZOOM_LINE; - if(!ubCounter) - iArrow=ZOOM_W_WEST_ARROW; - else if (fSpeedFlag) - iArrow=ZOOM_Y_WEST_ARROW; - else - iArrow=ZOOM_WEST_ARROW; - iArrowX+=WEST_OFFSET_X*2; - iArrowY+=WEST_OFFSET_Y*2; - } - else - { - iDirection=E_TO_W_LINE; - if(!ubCounter) - iArrow=W_WEST_ARROW; - else if (fSpeedFlag) - iArrow=Y_WEST_ARROW; - else - iArrow=WEST_ARROW; - iArrowX+=WEST_OFFSET_X; - iArrowY+=WEST_OFFSET_Y; - } - } - else - { - if(fZoomFlag) - { - iDirection=W_TO_E_ZOOM_LINE; - if(!ubCounter) - iArrow=ZOOM_W_EAST_ARROW; - else if (fSpeedFlag) - iArrow=ZOOM_Y_EAST_ARROW; - else - iArrow=ZOOM_EAST_ARROW; - iArrowX+=EAST_OFFSET_X*2; - iArrowY+=EAST_OFFSET_Y*2; - } - else - { - iDirection=W_TO_E_LINE; - if(!ubCounter) - iArrow=W_EAST_ARROW; - else if (fSpeedFlag) - iArrow=Y_EAST_ARROW; - else - iArrow=EAST_ARROW; - iArrowX+=EAST_OFFSET_X; - iArrowY+=EAST_OFFSET_Y; - } - } - } - else - { - if ((iDeltaA==-1)&&(iDeltaB==1)) + if (pPastNode->uiSectorId+WORLD_MAP_X==pNode->uiSectorId) { - if(fZoomFlag) + if(fZoomFlag) { - iDirection=WEST_ZOOM_LINE; - if(!ubCounter) - iArrow=ZOOM_W_WEST_ARROW; - else if (fSpeedFlag) - iArrow=ZOOM_Y_WEST_ARROW; - else - iArrow=ZOOM_WEST_ARROW; - - iArrowX+=WEST_OFFSET_X*2; - iArrowY+=WEST_OFFSET_Y*2; + iDirection=S_TO_N_ZOOM_LINE; + if(!ubCounter) + iArrow=ZOOM_W_NORTH_ARROW; + else if(fSpeedFlag) + iArrow=ZOOM_Y_NORTH_ARROW; + else + iArrow=ZOOM_NORTH_ARROW; + iArrowX+=NORTH_OFFSET_X*2; + iArrowY+=NORTH_OFFSET_Y*2; } - else + else + { + iDirection=S_TO_N_LINE; + if(!ubCounter) + iArrow=W_NORTH_ARROW; + else if(fSpeedFlag) + iArrow=Y_NORTH_ARROW; + else + iArrow=NORTH_ARROW; + + iArrowX+=NORTH_OFFSET_X; + iArrowY+=NORTH_OFFSET_Y; + } + } + else if(pPastNode->uiSectorId-WORLD_MAP_X==pNode->uiSectorId) + { + if(fZoomFlag) { - iDirection=WEST_LINE; - if(!ubCounter) - iArrow=W_WEST_ARROW; - else if (fSpeedFlag) - iArrow=Y_WEST_ARROW; - else + iDirection=N_TO_S_ZOOM_LINE; + if(!ubCounter) + iArrow=ZOOM_W_SOUTH_ARROW; + else if(fSpeedFlag) + iArrow=ZOOM_Y_SOUTH_ARROW; + else + iArrow=ZOOM_SOUTH_ARROW; + iArrowX+=SOUTH_OFFSET_X*2; + iArrowY+=SOUTH_OFFSET_Y*2; + } + else + { + iDirection=N_TO_S_LINE; + if(!ubCounter) + iArrow=W_SOUTH_ARROW; + else if(fSpeedFlag) + iArrow=Y_SOUTH_ARROW; + else + iArrow=SOUTH_ARROW; + iArrowX+=SOUTH_OFFSET_X; + iArrowY+=SOUTH_OFFSET_Y; + } + } + else if (pPastNode->uiSectorId+1==pNode->uiSectorId) + { + if(fZoomFlag) + { + iDirection=E_TO_W_ZOOM_LINE; + if(!ubCounter) + iArrow=ZOOM_W_WEST_ARROW; + else if (fSpeedFlag) + iArrow=ZOOM_Y_WEST_ARROW; + else + iArrow=ZOOM_WEST_ARROW; + iArrowX+=WEST_OFFSET_X*2; + iArrowY+=WEST_OFFSET_Y*2; + } + else + { + iDirection=E_TO_W_LINE; + if(!ubCounter) + iArrow=W_WEST_ARROW; + else if (fSpeedFlag) + iArrow=Y_WEST_ARROW; + else iArrow=WEST_ARROW; - - - iArrowX+=WEST_OFFSET_X; - iArrowY+=WEST_OFFSET_Y; + iArrowX+=WEST_OFFSET_X; + iArrowY+=WEST_OFFSET_Y; + } + } + else + { + if(fZoomFlag) + { + iDirection=W_TO_E_ZOOM_LINE; + if(!ubCounter) + iArrow=ZOOM_W_EAST_ARROW; + else if (fSpeedFlag) + iArrow=ZOOM_Y_EAST_ARROW; + else + iArrow=ZOOM_EAST_ARROW; + iArrowX+=EAST_OFFSET_X*2; + iArrowY+=EAST_OFFSET_Y*2; + } + else + { + iDirection=W_TO_E_LINE; + if(!ubCounter) + iArrow=W_EAST_ARROW; + else if (fSpeedFlag) + iArrow=Y_EAST_ARROW; + else + iArrow=EAST_ARROW; + iArrowX+=EAST_OFFSET_X; + iArrowY+=EAST_OFFSET_Y; + } + } + } + else + { + if ((iDeltaA==-1)&&(iDeltaB==1)) + { + if(fZoomFlag) + { + iDirection=WEST_ZOOM_LINE; + if(!ubCounter) + iArrow=ZOOM_W_WEST_ARROW; + else if (fSpeedFlag) + iArrow=ZOOM_Y_WEST_ARROW; + else + iArrow=ZOOM_WEST_ARROW; + + iArrowX+=WEST_OFFSET_X*2; + iArrowY+=WEST_OFFSET_Y*2; + } + else + { + iDirection=WEST_LINE; + if(!ubCounter) + iArrow=W_WEST_ARROW; + else if (fSpeedFlag) + iArrow=Y_WEST_ARROW; + else + iArrow=WEST_ARROW; + + + iArrowX+=WEST_OFFSET_X; + iArrowY+=WEST_OFFSET_Y; } } else if((iDeltaA==1)&&(iDeltaB==-1)) { - if(fZoomFlag) + if(fZoomFlag) { - iDirection=EAST_ZOOM_LINE; - if(!ubCounter) - iArrow=ZOOM_W_EAST_ARROW; - else + iDirection=EAST_ZOOM_LINE; + if(!ubCounter) + iArrow=ZOOM_W_EAST_ARROW; + else iArrow=ZOOM_EAST_ARROW; - - iArrowX+=EAST_OFFSET_X*2; - iArrowY+=EAST_OFFSET_Y*2; + + iArrowX+=EAST_OFFSET_X*2; + iArrowY+=EAST_OFFSET_Y*2; } - else + else { - iDirection=EAST_LINE; - if(!ubCounter) - iArrow=W_EAST_ARROW; - else if (fSpeedFlag) - iArrow=Y_EAST_ARROW; - else + iDirection=EAST_LINE; + if(!ubCounter) + iArrow=W_EAST_ARROW; + else if (fSpeedFlag) + iArrow=Y_EAST_ARROW; + else iArrow=EAST_ARROW; - - iArrowX+=EAST_OFFSET_X; - iArrowY+=EAST_OFFSET_Y; + + iArrowX+=EAST_OFFSET_X; + iArrowY+=EAST_OFFSET_Y; } } else if((iDeltaA==-WORLD_MAP_X)&&(iDeltaB==WORLD_MAP_X)) { - if(fZoomFlag) + if(fZoomFlag) { - iDirection=NORTH_ZOOM_LINE; - if(!ubCounter) - iArrow=ZOOM_W_NORTH_ARROW; - else if (fSpeedFlag) - iArrow=ZOOM_Y_NORTH_ARROW; - else - iArrow=ZOOM_NORTH_ARROW; - - iArrowX+=NORTH_OFFSET_X*2; - iArrowY+=NORTH_OFFSET_Y*2; + iDirection=NORTH_ZOOM_LINE; + if(!ubCounter) + iArrow=ZOOM_W_NORTH_ARROW; + else if (fSpeedFlag) + iArrow=ZOOM_Y_NORTH_ARROW; + else + iArrow=ZOOM_NORTH_ARROW; + + iArrowX+=NORTH_OFFSET_X*2; + iArrowY+=NORTH_OFFSET_Y*2; } - else + else { - iDirection=NORTH_LINE; - if(!ubCounter) - iArrow=W_NORTH_ARROW; - else if (fSpeedFlag) - iArrow=Y_NORTH_ARROW; - else - iArrow=NORTH_ARROW; - - iArrowX+=NORTH_OFFSET_X; - iArrowY+=NORTH_OFFSET_Y; + iDirection=NORTH_LINE; + if(!ubCounter) + iArrow=W_NORTH_ARROW; + else if (fSpeedFlag) + iArrow=Y_NORTH_ARROW; + else + iArrow=NORTH_ARROW; + + iArrowX+=NORTH_OFFSET_X; + iArrowY+=NORTH_OFFSET_Y; } } else if((iDeltaA==WORLD_MAP_X)&&(iDeltaB==-WORLD_MAP_X)) { - if(fZoomFlag) - { + if(fZoomFlag) + { iDirection=SOUTH_ZOOM_LINE; - if(!ubCounter) - iArrow=ZOOM_W_SOUTH_ARROW; - else if (fSpeedFlag) - iArrow=ZOOM_Y_SOUTH_ARROW; + if(!ubCounter) + iArrow=ZOOM_W_SOUTH_ARROW; + else if (fSpeedFlag) + iArrow=ZOOM_Y_SOUTH_ARROW; else - iArrow=ZOOM_SOUTH_ARROW; - - iArrowX+=SOUTH_OFFSET_X*2; - iArrowY+=SOUTH_OFFSET_Y*2; - } - else - { + iArrow=ZOOM_SOUTH_ARROW; + + iArrowX+=SOUTH_OFFSET_X*2; + iArrowY+=SOUTH_OFFSET_Y*2; + } + else + { iDirection=SOUTH_LINE; - if(!ubCounter) - iArrow=W_SOUTH_ARROW; + if(!ubCounter) + iArrow=W_SOUTH_ARROW; else if (fSpeedFlag) - iArrow=Y_SOUTH_ARROW; + iArrow=Y_SOUTH_ARROW; else - iArrow=SOUTH_ARROW; - - iArrowX+=SOUTH_OFFSET_X; - iArrowY+=SOUTH_OFFSET_Y; - } + iArrow=SOUTH_ARROW; + + iArrowX+=SOUTH_OFFSET_X; + iArrowY+=SOUTH_OFFSET_Y; + } } else if((iDeltaA==-WORLD_MAP_X)&&(iDeltaB==-1)) { - if(fZoomFlag) + if(fZoomFlag) { - iDirection=N_TO_E_ZOOM_LINE; - if(!ubCounter) - iArrow=ZOOM_W_EAST_ARROW; - else if (fSpeedFlag) - iArrow=ZOOM_Y_EAST_ARROW; - else - iArrow=ZOOM_EAST_ARROW; - - iArrowX+=EAST_OFFSET_X*2; - iArrowY+=EAST_OFFSET_Y*2; + iDirection=N_TO_E_ZOOM_LINE; + if(!ubCounter) + iArrow=ZOOM_W_EAST_ARROW; + else if (fSpeedFlag) + iArrow=ZOOM_Y_EAST_ARROW; + else + iArrow=ZOOM_EAST_ARROW; + + iArrowX+=EAST_OFFSET_X*2; + iArrowY+=EAST_OFFSET_Y*2; } - else + else { - iDirection=N_TO_E_LINE; - if(!ubCounter) - iArrow=W_EAST_ARROW; - else if (fSpeedFlag) - iArrow=Y_EAST_ARROW; - else - iArrow=EAST_ARROW; - - iArrowX+=EAST_OFFSET_X; - iArrowY+=EAST_OFFSET_Y; + iDirection=N_TO_E_LINE; + if(!ubCounter) + iArrow=W_EAST_ARROW; + else if (fSpeedFlag) + iArrow=Y_EAST_ARROW; + else + iArrow=EAST_ARROW; + + iArrowX+=EAST_OFFSET_X; + iArrowY+=EAST_OFFSET_Y; } } else if((iDeltaA==WORLD_MAP_X)&&(iDeltaB==1)) { - if(fZoomFlag) + if(fZoomFlag) { - iDirection=S_TO_W_ZOOM_LINE; - if(!ubCounter) - iArrow=ZOOM_W_WEST_ARROW; - else if (fSpeedFlag) - iArrow=ZOOM_Y_WEST_ARROW; - else - iArrow=ZOOM_WEST_ARROW; - - iArrowX+=WEST_OFFSET_X*2; - iArrowY+=WEST_OFFSET_Y*2; + iDirection=S_TO_W_ZOOM_LINE; + if(!ubCounter) + iArrow=ZOOM_W_WEST_ARROW; + else if (fSpeedFlag) + iArrow=ZOOM_Y_WEST_ARROW; + else + iArrow=ZOOM_WEST_ARROW; + + iArrowX+=WEST_OFFSET_X*2; + iArrowY+=WEST_OFFSET_Y*2; } - else + else { - iDirection=S_TO_W_LINE; - if(!ubCounter) - iArrow=W_WEST_ARROW; - else if (fSpeedFlag) - iArrow=Y_WEST_ARROW; - else - iArrow=WEST_ARROW; - - - iArrowX+=WEST_OFFSET_X; - iArrowY+=WEST_OFFSET_Y; + iDirection=S_TO_W_LINE; + if(!ubCounter) + iArrow=W_WEST_ARROW; + else if (fSpeedFlag) + iArrow=Y_WEST_ARROW; + else + iArrow=WEST_ARROW; + + + iArrowX+=WEST_OFFSET_X; + iArrowY+=WEST_OFFSET_Y; } } else if((iDeltaA==1)&&(iDeltaB==-WORLD_MAP_X)) { - if(fZoomFlag) + if(fZoomFlag) { - iDirection=E_TO_S_ZOOM_LINE; - if(!ubCounter) - iArrow=ZOOM_W_SOUTH_ARROW; - else if (fSpeedFlag) - iArrow=ZOOM_Y_SOUTH_ARROW; - else - iArrow=ZOOM_SOUTH_ARROW; - - iArrowX+=SOUTH_OFFSET_X*2; - iArrowY+=SOUTH_OFFSET_Y*2; + iDirection=E_TO_S_ZOOM_LINE; + if(!ubCounter) + iArrow=ZOOM_W_SOUTH_ARROW; + else if (fSpeedFlag) + iArrow=ZOOM_Y_SOUTH_ARROW; + else + iArrow=ZOOM_SOUTH_ARROW; + + iArrowX+=SOUTH_OFFSET_X*2; + iArrowY+=SOUTH_OFFSET_Y*2; } - else + else { - iDirection=E_TO_S_LINE; - if(!ubCounter) - iArrow=W_SOUTH_ARROW; - else if (fSpeedFlag) - iArrow=Y_SOUTH_ARROW; - else - iArrow=SOUTH_ARROW; - - iArrowX+=SOUTH_OFFSET_X; - iArrowY+=SOUTH_OFFSET_Y; + iDirection=E_TO_S_LINE; + if(!ubCounter) + iArrow=W_SOUTH_ARROW; + else if (fSpeedFlag) + iArrow=Y_SOUTH_ARROW; + else + iArrow=SOUTH_ARROW; + + iArrowX+=SOUTH_OFFSET_X; + iArrowY+=SOUTH_OFFSET_Y; } } else if ((iDeltaA==-1)&&(iDeltaB==WORLD_MAP_X)) { - if(fZoomFlag) + if(fZoomFlag) { - iDirection=W_TO_N_ZOOM_LINE; - if(!ubCounter) - iArrow=ZOOM_W_NORTH_ARROW; - else if (fSpeedFlag) - iArrow=ZOOM_Y_NORTH_ARROW; - else - iArrow=ZOOM_NORTH_ARROW; - - iArrowX+=NORTH_OFFSET_X*2; - iArrowY+=NORTH_OFFSET_Y*2; + iDirection=W_TO_N_ZOOM_LINE; + if(!ubCounter) + iArrow=ZOOM_W_NORTH_ARROW; + else if (fSpeedFlag) + iArrow=ZOOM_Y_NORTH_ARROW; + else + iArrow=ZOOM_NORTH_ARROW; + + iArrowX+=NORTH_OFFSET_X*2; + iArrowY+=NORTH_OFFSET_Y*2; } - else + else { - iDirection=W_TO_N_LINE; - if(!ubCounter) - iArrow=W_NORTH_ARROW; - else if (fSpeedFlag) - iArrow=Y_NORTH_ARROW; - else - iArrow=NORTH_ARROW; - - iArrowX+=NORTH_OFFSET_X; - iArrowY+=NORTH_OFFSET_Y; + iDirection=W_TO_N_LINE; + if(!ubCounter) + iArrow=W_NORTH_ARROW; + else if (fSpeedFlag) + iArrow=Y_NORTH_ARROW; + else + iArrow=NORTH_ARROW; + + iArrowX+=NORTH_OFFSET_X; + iArrowY+=NORTH_OFFSET_Y; } } else if ((iDeltaA==-1)&&(iDeltaB==-WORLD_MAP_X)) { - if(fZoomFlag) + if(fZoomFlag) { - iDirection=W_TO_S_ZOOM_LINE; - if(!ubCounter) - iArrow=ZOOM_W_SOUTH_ARROW; - else if (fSpeedFlag) - iArrow=ZOOM_Y_SOUTH_ARROW; - else - iArrow=ZOOM_SOUTH_ARROW; - - iArrowX+=SOUTH_OFFSET_X*2; - iArrowY+=(SOUTH_OFFSET_Y+WEST_TO_SOUTH_OFFSET_Y)*2; + iDirection=W_TO_S_ZOOM_LINE; + if(!ubCounter) + iArrow=ZOOM_W_SOUTH_ARROW; + else if (fSpeedFlag) + iArrow=ZOOM_Y_SOUTH_ARROW; + else + iArrow=ZOOM_SOUTH_ARROW; + + iArrowX+=SOUTH_OFFSET_X*2; + iArrowY+=(SOUTH_OFFSET_Y+WEST_TO_SOUTH_OFFSET_Y)*2; } - else + else { - iDirection=W_TO_S_LINE; - if(!ubCounter) - iArrow=W_SOUTH_ARROW; - else if (fSpeedFlag) - iArrow=Y_SOUTH_ARROW; - else - iArrow=SOUTH_ARROW; - iArrowX+=SOUTH_OFFSET_X; - iArrowY+=(SOUTH_OFFSET_Y+WEST_TO_SOUTH_OFFSET_Y); + iDirection=W_TO_S_LINE; + if(!ubCounter) + iArrow=W_SOUTH_ARROW; + else if (fSpeedFlag) + iArrow=Y_SOUTH_ARROW; + else + iArrow=SOUTH_ARROW; + iArrowX+=SOUTH_OFFSET_X; + iArrowY+=(SOUTH_OFFSET_Y+WEST_TO_SOUTH_OFFSET_Y); } } else if ((iDeltaA==-WORLD_MAP_X)&&(iDeltaB==1)) { - if(fZoomFlag) + if(fZoomFlag) { - iDirection=N_TO_W_ZOOM_LINE; - if(!ubCounter) - iArrow=ZOOM_W_WEST_ARROW; - else if (fSpeedFlag) - iArrow=ZOOM_Y_WEST_ARROW; - else - iArrow=ZOOM_WEST_ARROW; - - iArrowX+=WEST_OFFSET_X*2; - iArrowY+=WEST_OFFSET_Y*2; + iDirection=N_TO_W_ZOOM_LINE; + if(!ubCounter) + iArrow=ZOOM_W_WEST_ARROW; + else if (fSpeedFlag) + iArrow=ZOOM_Y_WEST_ARROW; + else + iArrow=ZOOM_WEST_ARROW; + + iArrowX+=WEST_OFFSET_X*2; + iArrowY+=WEST_OFFSET_Y*2; } - else + else { - iDirection=N_TO_W_LINE; - if(!ubCounter) - iArrow=W_WEST_ARROW; - else if (fSpeedFlag) - iArrow=Y_WEST_ARROW; - else - iArrow=WEST_ARROW; - - iArrowX+=WEST_OFFSET_X; - iArrowY+=WEST_OFFSET_Y; + iDirection=N_TO_W_LINE; + if(!ubCounter) + iArrow=W_WEST_ARROW; + else if (fSpeedFlag) + iArrow=Y_WEST_ARROW; + else + iArrow=WEST_ARROW; + + iArrowX+=WEST_OFFSET_X; + iArrowY+=WEST_OFFSET_Y; } } else if ((iDeltaA==WORLD_MAP_X)&&(iDeltaB==-1)) { - if(fZoomFlag) + if(fZoomFlag) { - iDirection=S_TO_E_ZOOM_LINE; - if(!ubCounter) - iArrow=ZOOM_W_EAST_ARROW; - else if (fSpeedFlag) - iArrow=ZOOM_Y_EAST_ARROW; - else - iArrow=ZOOM_EAST_ARROW; - iArrowX+=EAST_OFFSET_X*2; - iArrowY+=EAST_OFFSET_Y*2; + iDirection=S_TO_E_ZOOM_LINE; + if(!ubCounter) + iArrow=ZOOM_W_EAST_ARROW; + else if (fSpeedFlag) + iArrow=ZOOM_Y_EAST_ARROW; + else + iArrow=ZOOM_EAST_ARROW; + iArrowX+=EAST_OFFSET_X*2; + iArrowY+=EAST_OFFSET_Y*2; } - else + else { - iDirection=S_TO_E_LINE; - if(!ubCounter) - iArrow=W_EAST_ARROW; - else if (fSpeedFlag) - iArrow=Y_EAST_ARROW; - else - iArrow=EAST_ARROW; - iArrowX+=EAST_OFFSET_X; - iArrowY+=EAST_OFFSET_Y; + iDirection=S_TO_E_LINE; + if(!ubCounter) + iArrow=W_EAST_ARROW; + else if (fSpeedFlag) + iArrow=Y_EAST_ARROW; + else + iArrow=EAST_ARROW; + iArrowX+=EAST_OFFSET_X; + iArrowY+=EAST_OFFSET_Y; } } else if ((iDeltaA==1)&&(iDeltaB==WORLD_MAP_X)) { - if(fZoomFlag) + if(fZoomFlag) { - iDirection=E_TO_N_ZOOM_LINE; - if(!ubCounter) - iArrow=ZOOM_W_NORTH_ARROW; - else if (fSpeedFlag) - iArrow=ZOOM_Y_NORTH_ARROW; - else - iArrow=ZOOM_NORTH_ARROW; - iArrowX+=(NORTH_OFFSET_X*2); - iArrowY+=(NORTH_OFFSET_Y+EAST_TO_NORTH_OFFSET_Y)*2; + iDirection=E_TO_N_ZOOM_LINE; + if(!ubCounter) + iArrow=ZOOM_W_NORTH_ARROW; + else if (fSpeedFlag) + iArrow=ZOOM_Y_NORTH_ARROW; + else + iArrow=ZOOM_NORTH_ARROW; + iArrowX+=(NORTH_OFFSET_X*2); + iArrowY+=(NORTH_OFFSET_Y+EAST_TO_NORTH_OFFSET_Y)*2; } - else + else { - iDirection=E_TO_N_LINE; - if(!ubCounter) - iArrow=W_NORTH_ARROW; - else if (fSpeedFlag) - iArrow=Y_NORTH_ARROW; - else - iArrow=NORTH_ARROW; - - iArrowX+=NORTH_OFFSET_X; - iArrowY+=NORTH_OFFSET_Y+EAST_TO_NORTH_OFFSET_Y; + iDirection=E_TO_N_LINE; + if(!ubCounter) + iArrow=W_NORTH_ARROW; + else if (fSpeedFlag) + iArrow=Y_NORTH_ARROW; + else + iArrow=NORTH_ARROW; + + iArrowX+=NORTH_OFFSET_X; + iArrowY+=NORTH_OFFSET_Y+EAST_TO_NORTH_OFFSET_Y; } } - } - - } - - else - { - iX=(pNode->uiSectorId%MAP_WORLD_X); - iY=(pNode->uiSectorId/MAP_WORLD_X); - iX=(iX*MAP_GRID_X)+MAP_VIEW_START_X; - iY=(iY*MAP_GRID_Y)+MAP_VIEW_START_Y; + } + + } + + else + { + iX=(pNode->uiSectorId%MAP_WORLD_X); + iY=(pNode->uiSectorId/MAP_WORLD_X); + iX=(iX*MAP_GRID_X)+MAP_VIEW_START_X; + iY=(iY*MAP_GRID_Y)+MAP_VIEW_START_Y; if(pPastNode) { - iPastX=(pPastNode->uiSectorId%MAP_WORLD_X); - iPastY=(pPastNode->uiSectorId/MAP_WORLD_X); - iPastX=(iPastX*MAP_GRID_X)+MAP_VIEW_START_X; - iPastY=(iPastY*MAP_GRID_Y)+MAP_VIEW_START_Y; + iPastX=(pPastNode->uiSectorId%MAP_WORLD_X); + iPastY=(pPastNode->uiSectorId/MAP_WORLD_X); + iPastX=(iPastX*MAP_GRID_X)+MAP_VIEW_START_X; + iPastY=(iPastY*MAP_GRID_Y)+MAP_VIEW_START_Y; } - if(pNode->fSpeed) + if(pNode->fSpeed) fSpeedFlag=TRUE; else fSpeedFlag=FALSE; iArrowX=iX; iArrowY=iY; // display enter and exit 'X's - if (pPastNode) + if (pPastNode) { // red 'X' fUTurnFlag=TRUE; - iDeltaA=(INT16)pNode->uiSectorId-(INT16)pPastNode->uiSectorId; + iDeltaA=(INT16)pNode->uiSectorId-(INT16)pPastNode->uiSectorId; if (iDeltaA==-1) { iDirection=RED_X_WEST; - //iX+=RED_WEST_OFF_X; + //iX+=RED_WEST_OFF_X; } else if (iDeltaA==1) { @@ -3669,7 +3662,7 @@ BOOLEAN TraceCharAnimatedRoute( PathStPtr pPath, BOOLEAN fCheckFlag, BOOLEAN fFo iDirection=RED_X_NORTH; //iY+=RED_NORTH_OFF_Y; } - else + else { iDirection=RED_X_SOUTH; // iY+=RED_SOUTH_OFF_Y; @@ -3677,109 +3670,109 @@ BOOLEAN TraceCharAnimatedRoute( PathStPtr pPath, BOOLEAN fCheckFlag, BOOLEAN fFo } if (pNextNode) { - fUTurnFlag=FALSE; - iDeltaB=(INT16)pNode->uiSectorId-(INT16)pNextNode->uiSectorId; - if (iDeltaB==-1) + fUTurnFlag=FALSE; + iDeltaB=(INT16)pNode->uiSectorId-(INT16)pNextNode->uiSectorId; + if (iDeltaB==-1) { iDirection=GREEN_X_EAST; - if(!ubCounter) - iArrow=W_EAST_ARROW; + if(!ubCounter) + iArrow=W_EAST_ARROW; else if (fSpeedFlag) - iArrow=Y_EAST_ARROW; + iArrow=Y_EAST_ARROW; else - iArrow=EAST_ARROW; - - iArrowX+=EAST_OFFSET_X; + iArrow=EAST_ARROW; + + iArrowX+=EAST_OFFSET_X; iArrowY+=EAST_OFFSET_Y; //iX+=RED_EAST_OFF_X; } else if (iDeltaB==1) { iDirection=GREEN_X_WEST; - if(!ubCounter) - iArrow=W_WEST_ARROW; - else if (fSpeedFlag) - iArrow=Y_WEST_ARROW; - else - iArrow=WEST_ARROW; - - iArrowX+=WEST_OFFSET_X; + if(!ubCounter) + iArrow=W_WEST_ARROW; + else if (fSpeedFlag) + iArrow=Y_WEST_ARROW; + else + iArrow=WEST_ARROW; + + iArrowX+=WEST_OFFSET_X; iArrowY+=WEST_OFFSET_Y; //iX+=RED_WEST_OFF_X; } else if(iDeltaB==WORLD_MAP_X) { iDirection=GREEN_X_NORTH; - if(!ubCounter) - iArrow=W_NORTH_ARROW; + if(!ubCounter) + iArrow=W_NORTH_ARROW; else if (fSpeedFlag) - iArrow=Y_NORTH_ARROW; + iArrow=Y_NORTH_ARROW; else - iArrow=NORTH_ARROW; - - iArrowX+=NORTH_OFFSET_X; + iArrow=NORTH_ARROW; + + iArrowX+=NORTH_OFFSET_X; iArrowY+=NORTH_OFFSET_Y; //iY+=RED_NORTH_OFF_Y; } - else + else { iDirection=GREEN_X_SOUTH; - if(!ubCounter) - iArrow=W_SOUTH_ARROW; + if(!ubCounter) + iArrow=W_SOUTH_ARROW; else if (fSpeedFlag) - iArrow=Y_SOUTH_ARROW; + iArrow=Y_SOUTH_ARROW; else - iArrow=SOUTH_ARROW; - iArrowX+=SOUTH_OFFSET_X; + iArrow=SOUTH_ARROW; + iArrowX+=SOUTH_OFFSET_X; iArrowY+=SOUTH_OFFSET_Y; //iY+=RED_SOUTH_OFF_Y; } - - - } - } - if(fNextNode) + + + } + } + if(fNextNode) { if(!ubCounter) { - pCurrentNode=pCurrentNode->pNext; - if(!pCurrentNode) - fPauseFlag=TRUE; + pCurrentNode=pCurrentNode->pNext; + if(!pCurrentNode) + fPauseFlag=TRUE; } } if ((iDirection !=-1)&&(iArrow!=-1)) { - - if(!fUTurnFlag) - { - if((!fZoomFlag)||((fZoomFlag)&&(iX >MAP_VIEW_START_X)&&(iY >MAP_VIEW_START_Y)&&(iX < 640-MAP_GRID_X*2)&&(iY < MAP_VIEW_START_Y+MAP_VIEW_HEIGHT))) - { - - //if(!fZoomFlag) - //RestoreExternBackgroundRect(((INT16)iArrowX),((INT16)iArrowY),DMAP_GRID_X, DMAP_GRID_Y); - //else - //RestoreExternBackgroundRect(((INT16)iArrowX), ((INT16)iArrowY),DMAP_GRID_ZOOM_X, DMAP_GRID_ZOOM_Y); - if( pNode != pPath ) - { - BltVideoObject(FRAME_BUFFER, hMapHandle, (UINT16)iArrow, iArrowX, iArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); - InvalidateRegion( iArrowX, iArrowY, iArrowX + 2 * MAP_GRID_X, iArrowY + 2 * MAP_GRID_Y ); - } - } - if(ubCounter==1) - ubCounter=0; - else - ubCounter=1; - return TRUE; - } - if(ubCounter==1) - ubCounter=0; - else - ubCounter=1; - + if(!fUTurnFlag) + { + if((!fZoomFlag)||((fZoomFlag)&&(iX >MAP_VIEW_START_X)&&(iY >MAP_VIEW_START_Y)&&(iX < 640-MAP_GRID_X*2)&&(iY < MAP_VIEW_START_Y+MAP_VIEW_HEIGHT))) + { + + //if(!fZoomFlag) + //RestoreExternBackgroundRect(((INT16)iArrowX),((INT16)iArrowY),DMAP_GRID_X, DMAP_GRID_Y); + //else + //RestoreExternBackgroundRect(((INT16)iArrowX), ((INT16)iArrowY),DMAP_GRID_ZOOM_X, DMAP_GRID_ZOOM_Y); + if( pNode != pPath ) + { + BltVideoObject(FRAME_BUFFER, hMapHandle, (UINT16)iArrow, iArrowX, iArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); + InvalidateRegion( iArrowX, iArrowY, iArrowX + 2 * MAP_GRID_X, iArrowY + 2 * MAP_GRID_Y ); + } + } + if(ubCounter==1) + ubCounter=0; + else + ubCounter=1; + return TRUE; + } + if(ubCounter==1) + ubCounter=0; + else + ubCounter=1; + + } // move to next arrow - + //ARM who knows what it should return here? return FALSE; @@ -3797,8 +3790,8 @@ void DisplayThePotentialPathForHelicopter(INT16 sMapX, INT16 sMapY ) if( fOldShowAirCraft != fShowAircraftFlag ) { fOldShowAirCraft = fShowAircraftFlag; - giPotHeliPathBaseTime = GetJA2Clock( ); - + giPotHeliPathBaseTime = GetJA2Clock( ); + sOldMapX = sMapX; sOldMapY = sMapY; fTempPathAlreadyDrawn = FALSE; @@ -3809,7 +3802,7 @@ void DisplayThePotentialPathForHelicopter(INT16 sMapX, INT16 sMapY ) if( ( sMapX != sOldMapX) || ( sMapY != sOldMapY ) ) { giPotHeliPathBaseTime = GetJA2Clock( ); - + sOldMapX = sMapX; sOldMapY = sMapY; @@ -3824,7 +3817,7 @@ void DisplayThePotentialPathForHelicopter(INT16 sMapX, INT16 sMapY ) } iDifference = GetJA2Clock( ) - giPotHeliPathBaseTime ; - + if( fTempPathAlreadyDrawn ) { return; @@ -3833,7 +3826,7 @@ void DisplayThePotentialPathForHelicopter(INT16 sMapX, INT16 sMapY ) if( iDifference > MIN_WAIT_TIME_FOR_TEMP_PATH ) { fDrawTempHeliPath = TRUE; - giPotHeliPathBaseTime = GetJA2Clock( ); + giPotHeliPathBaseTime = GetJA2Clock( ); fTempPathAlreadyDrawn = TRUE; } @@ -3866,16 +3859,16 @@ void SetUpBadSectorsList( void ) // the border regions for( bY = 0; bY < WORLD_MAP_X; bY++ ) { - sBadSectorsList[ 0 ][ bY ] = sBadSectorsList[ WORLD_MAP_X - 1 ][ bY ] = sBadSectorsList[ bY ][ 0 ] = sBadSectorsList[ bY ][ WORLD_MAP_X - 1 ] = TRUE; + sBadSectorsList[ 0 ][ bY ] = sBadSectorsList[ WORLD_MAP_X - 1 ][ bY ] = sBadSectorsList[ bY ][ 0 ] = sBadSectorsList[ bY ][ WORLD_MAP_X - 1 ] = TRUE; } - + sBadSectorsList[ 4 ][ 1 ] = TRUE; sBadSectorsList[ 5 ][ 1 ] = TRUE; sBadSectorsList[ 16 ][ 1 ] = TRUE; sBadSectorsList[ 16 ][ 5 ] = TRUE; sBadSectorsList[ 16 ][ 6 ] = TRUE; - + sBadSectorsList[ 16 ][ 10 ] = TRUE; sBadSectorsList[ 16 ][ 11 ] = TRUE; @@ -3908,8 +3901,8 @@ void RestoreBackgroundForMapGrid( INT16 sMapX, INT16 sMapY ) { // screen values sX=(sMapX * MAP_GRID_X ) + MAP_VIEW_START_X; - sY=(sMapY * MAP_GRID_Y ) + MAP_VIEW_START_Y; - + sY=(sMapY * MAP_GRID_Y ) + MAP_VIEW_START_Y; + // restore background RestoreExternBackgroundRect( sX, sY ,DMAP_GRID_X ,DMAP_GRID_Y ); } @@ -3917,17 +3910,17 @@ void RestoreBackgroundForMapGrid( INT16 sMapX, INT16 sMapY ) { // get screen coords from map values - GetScreenXYFromMapXYStationary( sMapX, sMapY, &sX, &sY ); - + GetScreenXYFromMapXYStationary( sMapX, sMapY, &sX, &sY ); + // is this on the screen? if( ( sX > MapScreenRect.iLeft ) && ( sX < MapScreenRect.iRight ) && ( sY > MapScreenRect.iTop ) && ( sY < MapScreenRect.iBottom ) ) { // offset sY=sY-MAP_GRID_Y; - sX=sX-MAP_GRID_X; - + sX=sX-MAP_GRID_X; + // restore - RestoreExternBackgroundRect( sX, sY ,DMAP_GRID_ZOOM_X ,DMAP_GRID_ZOOM_Y ); + RestoreExternBackgroundRect( sX, sY ,DMAP_GRID_ZOOM_X ,DMAP_GRID_ZOOM_Y ); } } @@ -4106,7 +4099,7 @@ void ShowPeopleInMotion( INT16 sX, INT16 sY ) { sOffsetX = ( !fZoomFlag ? NORTH_SOUTH_CENTER_OFFSET : NORTH_SOUTH_CENTER_OFFSET_ZOOM ); } - + if( !iCounter ) { // going north @@ -4121,10 +4114,10 @@ void ShowPeopleInMotion( INT16 sX, INT16 sY ) else { // going east/west - + if( sEntering > 0 ) { - // people also entering, offset from middle + // people also entering, offset from middle sOffsetY = ( iCounter == 1? ( !fZoomFlag ? EAST_Y_MVT_OFFSET: EAST_Y_MVT_OFFSET_ZOOM ) : ( !fZoomFlag ? WEST_Y_MVT_OFFSET: WEST_Y_MVT_OFFSET_ZOOM ) ); } else @@ -4197,18 +4190,18 @@ void ShowPeopleInMotion( INT16 sX, INT16 sY ) // zoomed in or not? if(!fZoomFlag) { - iX = MAP_VIEW_START_X+( iX * MAP_GRID_X ) + sOffsetX; + iX = MAP_VIEW_START_X+( iX * MAP_GRID_X ) + sOffsetX; iY = MAP_Y_ICON_OFFSET + MAP_VIEW_START_Y + ( iY * MAP_GRID_Y ) + sOffsetY; - + BltVideoObject(guiSAVEBUFFER, hIconHandle, ( UINT16 )iCounter , ( INT16 ) iX, ( INT16 ) iY , VO_BLT_SRCTRANSPARENCY, NULL ); } else { GetScreenXYFromMapXYStationary( ((UINT16)(iX)),((UINT16)(iY)) , &sXPosition, &sYPosition ); - + iY=sYPosition-MAP_GRID_Y + sOffsetY; iX=sXPosition-MAP_GRID_X + sOffsetX; - + // clip blits to mapscreen region ClipBlitsToMapViewRegion( ); @@ -4234,7 +4227,7 @@ void ShowPeopleInMotion( INT16 sX, INT16 sY ) iWidth = 12; iHeight = 7; break; - + } // error correction for scrolling with people on the move @@ -4303,7 +4296,7 @@ void DisplayDistancesForHelicopter( void ) // blit in background GetVideoObject( &hHandle, guiMapBorderHeliSectors ); - BltVideoObject( FRAME_BUFFER, hHandle, 0, MAP_HELICOPTER_ETA_POPUP_X, sYPosition, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( FRAME_BUFFER, hHandle, 0, MAP_HELICOPTER_ETA_POPUP_X, sYPosition, VO_BLT_SRCTRANSPARENCY, NULL ); // sTotalCanTravel = ( INT16 )GetTotalDistanceHelicopterCanTravel( ); @@ -4314,8 +4307,8 @@ void DisplayDistancesForHelicopter( void ) sNumUnSafeSectors = GetNumUnSafeSectorsInPath( ); // sDistanceSoFar = ( INT16 )HowFarHelicopterhasTravelledSinceRefueling( ); -// sTotalDistanceOfTrip = ( INT16 )DistanceToNearestRefuelPoint( ) - +// sTotalDistanceOfTrip = ( INT16 )DistanceToNearestRefuelPoint( ) + if( sDistanceToGo == 9999) { sDistanceToGo = 0; @@ -4329,7 +4322,7 @@ void DisplayDistancesForHelicopter( void ) swprintf( sString, L"%s", pHelicopterEtaStrings[ 0 ] ); mprintf( MAP_HELICOPTER_ETA_POPUP_X + 5, sYPosition + 5, sString ); -/* +/* if ( IsSectorOutOfTheWay( sMapX, sMapY ) ) { SetFontForeground( FONT_RED ); @@ -4339,7 +4332,7 @@ void DisplayDistancesForHelicopter( void ) { SetFontForeground( FONT_LTGREEN ); } - + swprintf( sString, L"%d", sTotalOfTrip ); FindFontRightCoordinates( MAP_HELICOPTER_ETA_POPUP_X + 5, MAP_HELICOPTER_ETA_POPUP_Y + 5, MAP_HELICOPTER_ETA_POPUP_WIDTH, 0, sString, MAP_FONT, &sX, &sY ); mprintf( sX, sYPosition + 5, sString ); @@ -4473,17 +4466,17 @@ void DisplayPositionOfHelicopter( void ) // grab coords for nextx,y and current x,y // zoomed in, takes a little more work - GetScreenXYFromMapXYStationary( ((UINT16)(pGroup->ubSectorX)),((UINT16)(pGroup->ubSectorY)) , &sX, &sY ); - sY=sY-MAP_GRID_Y; + GetScreenXYFromMapXYStationary( ((UINT16)(pGroup->ubSectorX)),((UINT16)(pGroup->ubSectorY)) , &sX, &sY ); + sY=sY-MAP_GRID_Y; sX=sX-MAP_GRID_X; minX = ( sX ); minY = ( sY ); - GetScreenXYFromMapXYStationary( ((UINT16)(pGroup->ubNextX)),((UINT16)(pGroup->ubNextY)) , &sX, &sY ); - sY=sY-MAP_GRID_Y; + GetScreenXYFromMapXYStationary( ((UINT16)(pGroup->ubNextX)),((UINT16)(pGroup->ubNextY)) , &sX, &sY ); + sY=sY-MAP_GRID_Y; sX=sX-MAP_GRID_X; - + maxX = ( sX ); maxY = ( sY ); } @@ -4533,7 +4526,7 @@ void DisplayPositionOfHelicopter( void ) SetFontBackground( FONT_BLACK ); mprintf( x + 5, y + 1 , sString ); - + InvalidateRegion( x, y, x + HELI_ICON_WIDTH, y + HELI_ICON_HEIGHT ); RestoreClipRegionToFullScreen( ); @@ -4617,12 +4610,12 @@ BOOLEAN CheckForClickOverHelicopterIcon( INT16 sClickedSectorX, INT16 sClickedSe } if( !fHelicopterAvailable || !fShowAircraftFlag ) - { + { return( FALSE ); } if ( iHelicopterVehicleId == -1 ) - { + { return( FALSE ); } @@ -4687,7 +4680,7 @@ void BlitMineIcon( INT16 sMapX, INT16 sMapY ) pDestBuf2 = LockVideoSurface( guiSAVEBUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, MAP_VIEW_START_X+MAP_GRID_X - 1, MAP_VIEW_START_Y+MAP_GRID_Y - 1, MAP_VIEW_WIDTH+1,MAP_VIEW_HEIGHT-9 ); UnLockVideoSurface(guiSAVEBUFFER); - + if( fZoomFlag ) { GetScreenXYFromMapXYStationary( ( INT16 )( sMapX ), ( INT16 )( sMapY ) , &sScreenX, &sScreenY ); @@ -4715,14 +4708,14 @@ void BlitMineText( INT16 sMapX, INT16 sMapY ) { GetScreenXYFromMapXYStationary( ( INT16 )( sMapX ), ( INT16 )( sMapY ) , &sScreenX, &sScreenY ); - // set coordinates for start of mine text + // set coordinates for start of mine text sScreenY += MAP_GRID_ZOOM_Y / 2 + 1; // slightly below } else { GetScreenXYFromMapXY( ( INT16 )( sMapX ), ( INT16 )( sMapY ), &sScreenX, &sScreenY ); - // set coordinates for start of mine text + // set coordinates for start of mine text sScreenX += MAP_GRID_X / 2; // centered around middle of mine square sScreenY += MAP_GRID_Y + 1; // slightly below } @@ -4796,7 +4789,7 @@ void BlitMineText( INT16 sMapX, INT16 sMapY ) swprintf( wSubString, L" (%d%%%%)", (PredictDailyIncomeFromAMine(ubMineIndex) * 100 ) / GetMaxDailyRemovalFromMine(ubMineIndex) ); wcscat( wString, wSubString ); } - + AdjustXForLeftMapEdge(wString, &sScreenX); mprintf( ( sScreenX - StringPixLengthArg( MAP_FONT, wcslen(wString), wString ) / 2 ) , sScreenY + ubLineCnt * GetFontHeight( MAP_FONT ), wString ); ubLineCnt++; @@ -4827,8 +4820,8 @@ void AdjustXForLeftMapEdge(STR16 wString, INT16 *psX) void BlitTownGridMarkers( void ) { INT16 sScreenX = 0, sScreenY = 0; - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; UINT16 usColor = 0; INT32 iCounter = 0; INT16 sWidth = 0, sHeight = 0; @@ -4838,12 +4831,12 @@ void BlitTownGridMarkers( void ) // blit in the highlighted sector - pDestBuf = LockVideoSurface( guiSAVEBUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( guiSAVEBUFFER, &uiDestPitchBYTES ); // clip to view region ClipBlitsToMapViewRegionForRectangleAndABit( uiDestPitchBYTES ); - + // go through list of towns and place on screen while( pTownNamesList[ iCounter ] != 0 ) { @@ -4895,7 +4888,7 @@ void BlitTownGridMarkers( void ) // restore clips RestoreClipRegionToFullScreenForRectangle( uiDestPitchBYTES ); - + // unlock surface UnLockVideoSurface( guiSAVEBUFFER ); @@ -4907,8 +4900,8 @@ void BlitTownGridMarkers( void ) void BlitMineGridMarkers( void ) { INT16 sScreenX = 0, sScreenY = 0; - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; UINT16 usColor = 0; INT32 iCounter = 0; INT16 sWidth = 0, sHeight = 0; @@ -4918,13 +4911,13 @@ void BlitMineGridMarkers( void ) // blit in the highlighted sector - pDestBuf = LockVideoSurface( guiSAVEBUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( guiSAVEBUFFER, &uiDestPitchBYTES ); // clip to view region ClipBlitsToMapViewRegionForRectangleAndABit( uiDestPitchBYTES ); for( iCounter = 0; iCounter < MAX_NUMBER_OF_MINES; iCounter++ ) - { + { if( fZoomFlag ) { GetScreenXYFromMapXYStationary( ( INT16 )( gMineLocation[ iCounter ].sSectorX), ( INT16 )( gMineLocation[ iCounter ].sSectorY ) , &sScreenX, &sScreenY ); @@ -4940,16 +4933,16 @@ void BlitMineGridMarkers( void ) GetScreenXYFromMapXY( ( INT16 )( gMineLocation[ iCounter ].sSectorX ), ( INT16 )( gMineLocation[ iCounter ].sSectorY ), &sScreenX, &sScreenY ); sWidth = MAP_GRID_X; sHeight= MAP_GRID_Y; - + } // draw rectangle - RectangleDraw( TRUE, sScreenX, sScreenY - 1, sScreenX + sWidth, sScreenY + sHeight - 1, usColor, pDestBuf ); + RectangleDraw( TRUE, sScreenX, sScreenY - 1, sScreenX + sWidth, sScreenY + sHeight - 1, usColor, pDestBuf ); } // restore clips RestoreClipRegionToFullScreenForRectangle( uiDestPitchBYTES ); - + // unlock surface UnLockVideoSurface( guiSAVEBUFFER ); @@ -4986,7 +4979,7 @@ UINT8 NumFriendlyInSector( INT16 sX, INT16 sY, INT8 bZ ) // Loop through all mercs and make go for ( pTeamSoldier = Menptr, cnt = 0; cnt < TOTAL_SOLDIERS; pTeamSoldier++, cnt++ ) { - if ( pTeamSoldier->bActive && pTeamSoldier->bLife > 0 ) + if ( pTeamSoldier->bActive && pTeamSoldier->stats.bLife > 0 ) { if ( (pTeamSoldier->bSide == gbPlayerNum ) && ( pTeamSoldier->sSectorX == sX ) && ( pTeamSoldier->sSectorY == sY ) && ( pTeamSoldier->bSectorZ == bZ ) ) { @@ -5021,7 +5014,7 @@ void DisplayLevelString( void ) SetFontForeground( MAP_INDEX_COLOR ); SetFontBackground( FONT_BLACK ); swprintf( sString, L"%s %d", sMapLevelString[ 0 ], iCurrentMapSectorZ ); - + mprintf( MAP_LEVEL_STRING_X, MAP_LEVEL_STRING_Y, sString ); SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); @@ -5033,6 +5026,9 @@ void DisplayLevelString( void ) // function to manipulate the number of towns people on the cursor BOOLEAN PickUpATownPersonFromSector( UINT8 ubType, INT16 sX, INT16 sY ) { + + + // see if there are any militia of this type in this sector if( !SectorInfo[ SECTOR( sX, sY ) ].ubNumberOfCivsAtLevel[ ubType ] ) { @@ -5088,7 +5084,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen2"); return( FALSE ); } - if( SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ GREEN_MILITIA ] + SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] + if( SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ GREEN_MILITIA ] + SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] + SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ ELITE_MILITIA ] >= iMaxMilitiaPerSector ) { return( FALSE ); @@ -5104,12 +5100,11 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen2"); gfStrategicMilitiaChangesMade = TRUE; } - // drop the guy into this sector switch( ubType ) { case( GREEN_MILITIA ): - + if( !sGreensOnCursor ) { return( FALSE ); @@ -5146,21 +5141,21 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen2"); BOOLEAN LoadMilitiaPopUpBox( void ) { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; - // load the militia pop up box + // load the militia pop up box VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("INTERFACE\\Militia.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiMilitia)); - + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("INTERFACE\\Militiamaps.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiMilitiaMaps)); - + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("INTERFACE\\MilitiamapsectorOutline2.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiMilitiaSectorHighLight)); - + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("INTERFACE\\MilitiamapsectorOutline.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiMilitiaSectorOutline )); @@ -5171,7 +5166,7 @@ BOOLEAN LoadMilitiaPopUpBox( void ) void RemoveMilitiaPopUpBox( void ) { - // delete the militia pop up box graphic + // delete the militia pop up box graphic DeleteVideoObjectFromIndex( guiMilitia ); DeleteVideoObjectFromIndex( guiMilitiaMaps ); DeleteVideoObjectFromIndex( guiMilitiaSectorHighLight ); @@ -5184,7 +5179,7 @@ void RemoveMilitiaPopUpBox( void ) BOOLEAN DrawMilitiaPopUpBox( void ) { - HVOBJECT hVObject; + HVOBJECT hVObject; ETRLEObject *pTrav; @@ -5237,13 +5232,13 @@ BOOLEAN DrawMilitiaPopUpBox( void ) pTrav = &(hVObject->pETRLEObject[ 0 ] ); InvalidateRegion( MAP_MILITIA_BOX_POS_X, MAP_MILITIA_BOX_POS_Y, MAP_MILITIA_BOX_POS_X + pTrav->usWidth, MAP_MILITIA_BOX_POS_Y + pTrav->usHeight ); - + // set the text for the militia map sector info buttons SetMilitiaMapButtonsText( ); // render buttons MarkButtonsDirty( ); - + return( TRUE ); } @@ -5266,10 +5261,10 @@ void CreateDestroyMilitiaPopUPRegions( void ) for( iCounter = 0; iCounter < 9; iCounter++ ) { MSYS_DefineRegion( &gMapScreenMilitiaBoxRegions[ iCounter ], ( INT16 ) ( MAP_MILITIA_BOX_POS_X + MAP_MILITIA_MAP_X + ( iCounter % MILITIA_BOX_ROWS ) * MILITIA_BOX_BOX_WIDTH ), ( INT16 )( MAP_MILITIA_BOX_POS_Y + MAP_MILITIA_MAP_Y + ( iCounter / MILITIA_BOX_ROWS ) * MILITIA_BOX_BOX_HEIGHT ), ( INT16 )( MAP_MILITIA_BOX_POS_X + MAP_MILITIA_MAP_X + ( ( ( iCounter ) % MILITIA_BOX_ROWS ) + 1 ) * MILITIA_BOX_BOX_WIDTH ), ( INT16 )( MAP_MILITIA_BOX_POS_Y + MAP_MILITIA_MAP_Y + ( ( ( iCounter ) / MILITIA_BOX_ROWS ) + 1 ) * MILITIA_BOX_BOX_HEIGHT ), MSYS_PRIORITY_HIGHEST - 3, - MSYS_NO_CURSOR, MilitiaRegionMoveCallback, MilitiaRegionClickCallback ); + MSYS_NO_CURSOR, MilitiaRegionMoveCallback, MilitiaRegionClickCallback ); MSYS_SetRegionUserData( &gMapScreenMilitiaBoxRegions[ iCounter ], 0, iCounter ); - + } // create militia panel buttons @@ -5291,7 +5286,7 @@ void CreateDestroyMilitiaPopUPRegions( void ) HandleShutDownOfMilitiaPanelIfPeopleOnTheCursor( sOldTown ); DeleteMilitiaPanelBottomButton( ); - + gfMilitiaPopupCreated = FALSE; } @@ -5309,7 +5304,7 @@ void RenderIconsPerSectorForSelectedTown( void ) INT32 iNumberOfElites = 0; INT32 iTotalNumberOfTroops = 0; INT32 iCurrentTroopIcon = 0; - HVOBJECT hVObject; + HVOBJECT hVObject; INT32 iCurrentIcon = 0; INT16 sX, sY; CHAR16 sString[ 32 ]; @@ -5342,14 +5337,14 @@ void RenderIconsPerSectorForSelectedTown( void ) iNumberOfRegulars = SectorInfo[ sCurrentSectorValue ].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]; iNumberOfElites = SectorInfo[ sCurrentSectorValue ].ubNumberOfCivsAtLevel[ ELITE_MILITIA ]; - // get total + // get total iTotalNumberOfTroops = iNumberOfGreens + iNumberOfRegulars + iNumberOfElites; // printf number of troops SetFont( FONT10ARIAL ); swprintf( sString, L"%d", iTotalNumberOfTroops ); - FindFontRightCoordinates( ( INT16 )( MAP_MILITIA_BOX_POS_X + MAP_MILITIA_MAP_X + ( ( iCounter % MILITIA_BOX_ROWS ) * MILITIA_BOX_BOX_WIDTH ) ), ( INT16 ) ( MAP_MILITIA_BOX_POS_Y + MAP_MILITIA_MAP_Y + ( ( iCounter / MILITIA_BOX_ROWS ) * MILITIA_BOX_BOX_HEIGHT ) ), MILITIA_BOX_BOX_WIDTH, 0, sString, FONT10ARIAL, &sX, &sY ); - + FindFontRightCoordinates( ( INT16 )( MAP_MILITIA_BOX_POS_X + MAP_MILITIA_MAP_X + ( ( iCounter % MILITIA_BOX_ROWS ) * MILITIA_BOX_BOX_WIDTH ) ), ( INT16 ) ( MAP_MILITIA_BOX_POS_Y + MAP_MILITIA_MAP_Y + ( ( iCounter / MILITIA_BOX_ROWS ) * MILITIA_BOX_BOX_HEIGHT ) ), MILITIA_BOX_BOX_WIDTH, 0, sString, FONT10ARIAL, &sX, &sY ); + if( StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( sCurrentSectorValue ) ].bNameId != BLANK_SECTOR && !StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( sCurrentSectorValue ) ].fEnemyControlled ) { @@ -5430,7 +5425,7 @@ INT16 GetBaseSectorForCurrentTown( void ) void ShowHighLightedSectorOnMilitiaMap( void ) { // show the highlighted sector on the militia map - HVOBJECT hVObject; + HVOBJECT hVObject; INT16 sX = 0, sY = 0; @@ -5439,10 +5434,10 @@ void ShowHighLightedSectorOnMilitiaMap( void ) { sX = MAP_MILITIA_BOX_POS_X + MAP_MILITIA_MAP_X + ( ( sSectorMilitiaMapSector % MILITIA_BOX_ROWS ) * MILITIA_BOX_BOX_WIDTH ); sY = MAP_MILITIA_BOX_POS_Y + MAP_MILITIA_MAP_Y + ( ( sSectorMilitiaMapSector / MILITIA_BOX_ROWS ) * MILITIA_BOX_BOX_HEIGHT ); - + // get the object GetVideoObject( &hVObject, guiMilitiaSectorHighLight ); - + // blt the object BltVideoObject( FRAME_BUFFER, hVObject, 0, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL ); } @@ -5451,10 +5446,10 @@ void ShowHighLightedSectorOnMilitiaMap( void ) { sX = MAP_MILITIA_BOX_POS_X + MAP_MILITIA_MAP_X + ( ( sSectorMilitiaMapSectorOutline % MILITIA_BOX_ROWS ) * MILITIA_BOX_BOX_WIDTH ); sY = MAP_MILITIA_BOX_POS_Y + MAP_MILITIA_MAP_Y + ( ( sSectorMilitiaMapSectorOutline / MILITIA_BOX_ROWS ) * MILITIA_BOX_BOX_HEIGHT ); - + // get the object GetVideoObject( &hVObject, guiMilitiaSectorOutline ); - + // blt the object BltVideoObject( FRAME_BUFFER, hVObject, 0, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL ); } @@ -5505,7 +5500,7 @@ void MilitiaRegionMoveCallback( MOUSE_REGION *pRegion, INT32 iReason ) { if( IsThisMilitiaTownSectorAllowable( ( INT16 )iValue ) ) { - sSectorMilitiaMapSectorOutline = ( INT16 )iValue; + sSectorMilitiaMapSectorOutline = ( INT16 )iValue; } else { @@ -5514,7 +5509,7 @@ void MilitiaRegionMoveCallback( MOUSE_REGION *pRegion, INT32 iReason ) } else if( iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { - sSectorMilitiaMapSectorOutline = -1; + sSectorMilitiaMapSectorOutline = -1; } } @@ -5524,7 +5519,7 @@ void CreateDestroyMilitiaSectorButtons( void ) static INT16 sOldSectorValue = -1; INT16 sX = 0, sY = 0; INT32 iCounter = 0; - HVOBJECT hVObject; + HVOBJECT hVObject; ETRLEObject *pTrav; @@ -5540,7 +5535,7 @@ void CreateDestroyMilitiaSectorButtons( void ) // set screen x and y positions sX = MAP_MILITIA_BOX_POS_X + MAP_MILITIA_MAP_X + ( ( sSectorMilitiaMapSector % MILITIA_BOX_ROWS ) * MILITIA_BOX_BOX_WIDTH ); sY = MAP_MILITIA_BOX_POS_Y + MAP_MILITIA_MAP_Y + ( ( sSectorMilitiaMapSector / MILITIA_BOX_ROWS ) * MILITIA_BOX_BOX_HEIGHT ); - + // adjust offsets sX += MILITIA_BTN_OFFSET_X; sY += ( iCounter * ( MILITIA_BTN_HEIGHT ) + 2 ); @@ -5558,23 +5553,23 @@ void CreateDestroyMilitiaSectorButtons( void ) SpecifyButtonFont( giMapMilitiaButton[ iCounter ], FONT10ARIAL ); SpecifyButtonUpTextColors( giMapMilitiaButton[ iCounter ], gsMilitiaSectorButtonColors[ iCounter ], FONT_BLACK ); SpecifyButtonDownTextColors( giMapMilitiaButton[ iCounter ], gsMilitiaSectorButtonColors[ iCounter ], FONT_BLACK ); - + GetVideoObject( &hVObject, guiMilitia ); pTrav = &(hVObject->pETRLEObject[ 0 ] ); - + SetButtonFastHelpText( giMapMilitiaButton[ iCounter ], pMilitiaButtonsHelpText[ iCounter ] ); - - - } + + + } // mark here the militia box left click region //MSYS_DefineRegion( &gMapScreenMilitiaRegion, ( INT16 ) ( MAP_MILITIA_BOX_POS_X ), ( INT16 )( MAP_MILITIA_BOX_POS_Y ), ( INT16 )( MAP_MILITIA_BOX_POS_X + pTrav->usWidth ), ( INT16 )( MAP_MILITIA_BOX_POS_Y + pTrav->usHeight ), MSYS_PRIORITY_HIGHEST - 2, - // MSYS_NO_CURSOR, MilitiaRegionMoveCallback, MilitiaBoxMaskBtnCallback ); + // MSYS_NO_CURSOR, MilitiaRegionMoveCallback, MilitiaBoxMaskBtnCallback ); CreateScreenMaskForMoveBox( ); // ste the fact that the buttons were in fact created - fMilitiaMapButtonsCreated = TRUE; + fMilitiaMapButtonsCreated = TRUE; } else if( fCreated && ( sOldSectorValue != sSectorMilitiaMapSector || !fShowMilitia || !sSelectedMilitiaTown || sSectorMilitiaMapSector == -1 ) ) { @@ -5615,7 +5610,7 @@ void SetMilitiaMapButtonsText( void ) INT32 iNumberOfGreens = 0, iNumberOfRegulars = 0, iNumberOfElites = 0; INT16 sBaseSectorValue = 0, sGlobalMapSector = 0; - + if( !fMilitiaMapButtonsCreated ) { return; @@ -5666,7 +5661,7 @@ void MilitiaButtonCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { @@ -5678,7 +5673,7 @@ void MilitiaButtonCallback(GUI_BUTTON *btn,INT32 reason) } else if(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) { @@ -5696,14 +5691,14 @@ void DisplayUnallocatedMilitia( void ) INT32 iTotalNumberOfTroops =0, iNumberOfGreens = 0, iNumberOfRegulars =0, iNumberOfElites = 0, iCurrentTroopIcon = 0; INT32 iCurrentIcon = 0; INT16 sX = 0, sY = 0; - HVOBJECT hVObject; + HVOBJECT hVObject; // get number of each iNumberOfGreens = sGreensOnCursor; iNumberOfRegulars = sRegularsOnCursor; iNumberOfElites = sElitesOnCursor; - // get total + // get total iTotalNumberOfTroops = iNumberOfGreens + iNumberOfRegulars + iNumberOfElites; // get militia video object @@ -5766,7 +5761,7 @@ void DrawTownMilitiaName( void ) CHAR16 sString[ 64 ]; INT16 sX, sY; - // get the name for the current militia town + // get the name for the current militia town swprintf( sString, L"%s %s", pTownNames[ sSelectedMilitiaTown ], pMilitiaString[ 0 ] ); FindFontCenterCoordinates( MAP_MILITIA_BOX_POS_X, MAP_MILITIA_BOX_POS_Y + MILITIA_BOX_TEXT_OFFSET_Y, MILITIA_BOX_WIDTH, MILITIA_BOX_TEXT_TITLE_HEIGHT, sString, FONT10ARIAL, &sX, &sY ); mprintf( sX, sY, sString ); @@ -5811,14 +5806,14 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen3"); while( ( iCount < iNumberThatCanFitInSector )&&( ( sGreensOnCursor ) || ( sRegularsOnCursor ) || ( sElitesOnCursor ) ) ) { - // green + // green if( ( iCount + 1 <= iNumberThatCanFitInSector )&&( sGreensOnCursor ) ) { SectorInfo[ STRATEGIC_INDEX_TO_SECTOR_INFO( pTownLocationsList[ iCounter ] ) ].ubNumberOfCivsAtLevel[ GREEN_MILITIA ]++; iCount++; sGreensOnCursor--; } - + // regular if( ( iCount + 1 <= iNumberThatCanFitInSector ) && ( sRegularsOnCursor ) ) { @@ -5826,7 +5821,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen3"); iCount++; sRegularsOnCursor--; } - + // elite if( ( iCount + 1 <= iNumberThatCanFitInSector ) && ( sElitesOnCursor ) ) { @@ -5840,7 +5835,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen3"); { gfStrategicMilitiaChangesMade = TRUE; } - + } fLastOne = TRUE; @@ -5853,7 +5848,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen3"); { fLastOne = FALSE; } - + iCounterB++; } @@ -5906,7 +5901,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen4"); { // grab current sector value sCurrentSectorValue = sBaseSectorValue + ( ( iCounter % MILITIA_BOX_ROWS ) + ( iCounter / MILITIA_BOX_ROWS ) * ( 16 ) ); - + sSectorX = SECTORX( sCurrentSectorValue ); sSectorY = SECTORY( sCurrentSectorValue ); @@ -6071,7 +6066,7 @@ void MilitiaAutoButtonCallback(GUI_BUTTON *btn,INT32 reason) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { @@ -6093,7 +6088,7 @@ void MilitiaDoneButtonCallback(GUI_BUTTON *btn,INT32 reason) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { @@ -6104,7 +6099,6 @@ void MilitiaDoneButtonCallback(GUI_BUTTON *btn,INT32 reason) // reset fact we are in the box sSelectedMilitiaTown = 0; fMapPanelDirty = TRUE; - // Go ahead and reset the militia in the selected sector (even if we didn't change it here) if (gfStrategicMilitiaChangesMade) { @@ -6134,7 +6128,7 @@ void RenderShadingForUnControlledSectors( void ) sCurrentSectorValue = sBaseSectorValue + ( ( iCounter % MILITIA_BOX_ROWS ) + ( iCounter / MILITIA_BOX_ROWS ) * ( 16 ) ); if( ( StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( sCurrentSectorValue ) ].bNameId != BLANK_SECTOR ) && - ( ( StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( sCurrentSectorValue ) ].fEnemyControlled ) || + ( ( StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( sCurrentSectorValue ) ].fEnemyControlled ) || ( NumHostilesInSector( ( INT16 ) SECTORX( sCurrentSectorValue ), ( INT16 ) SECTORY( sCurrentSectorValue ), 0 ) ) ) ) { // shade this sector, not under our control @@ -6151,9 +6145,9 @@ void RenderShadingForUnControlledSectors( void ) void DrawTownMilitiaForcesOnMap( void ) { - INT32 iCounter = 0, iCounterB = 0, iTotalNumberOfTroops = 0, iIconValue = 0; + INT32 iCounterB = 0, iTotalNumberOfTroops = 0, iIconValue = 0; INT32 iNumberOfGreens = 0, iNumberOfRegulars = 0, iNumberOfElites = 0; - HVOBJECT hVObject; + HVOBJECT hVObject; INT16 sSectorX = 0, sSectorY = 0; // get militia video object @@ -6161,7 +6155,7 @@ void DrawTownMilitiaForcesOnMap( void ) // clip blits to mapscreen region ClipBlitsToMapViewRegion( ); -/* +/* while( pTownNamesList[ iCounter ] != 0 ) { // run through each town sector and plot the icons for the militia forces in the town @@ -6226,7 +6220,7 @@ void DrawTownMilitiaForcesOnMap( void ) iNumberOfGreens = SectorInfo[ SECTOR( sSectorX, sSectorY ) ].ubNumberOfCivsAtLevel[ GREEN_MILITIA ]; iNumberOfRegulars = SectorInfo[ SECTOR( sSectorX, sSectorY ) ].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]; iNumberOfElites = SectorInfo[ SECTOR( sSectorX, sSectorY ) ].ubNumberOfCivsAtLevel[ ELITE_MILITIA ]; - + // ste the total for loop upper bound iTotalNumberOfTroops = iNumberOfGreens + iNumberOfRegulars + iNumberOfElites; @@ -6274,7 +6268,7 @@ void CheckAndUpdateStatesOfSelectedMilitiaSectorButtons( void ) INT32 iNumberOfGreens = 0, iNumberOfRegulars = 0, iNumberOfElites = 0; INT16 sBaseSectorValue = 0, sGlobalMapSector = 0; - + if( !fMilitiaMapButtonsCreated ) { EnableButton( giMapMilitiaButton[ 4 ] ); @@ -6288,7 +6282,7 @@ void CheckAndUpdateStatesOfSelectedMilitiaSectorButtons( void ) iNumberOfGreens = SectorInfo[ sGlobalMapSector ].ubNumberOfCivsAtLevel[ GREEN_MILITIA ] + sGreensOnCursor; iNumberOfRegulars = SectorInfo[ sGlobalMapSector ].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] + sRegularsOnCursor; iNumberOfElites = SectorInfo[ sGlobalMapSector ].ubNumberOfCivsAtLevel[ ELITE_MILITIA ] + sElitesOnCursor; - + if( ( sGreensOnCursor > 0 ) || ( sRegularsOnCursor > 0 ) || ( sElitesOnCursor > 0 ) ) { DisableButton( giMapMilitiaButton[ 4 ] ); // DONE @@ -6385,7 +6379,7 @@ void HandleLowerLevelMapBlit( void ) case( 2 ): GetVideoObject( &hHandle, guiSubLevel2 ); break; - case( 3 ): + case( 3 ): GetVideoObject( &hHandle, guiSubLevel3 ); break; default: @@ -6422,11 +6416,11 @@ void MilitiaBoxMaskBtnCallback(MOUSE_REGION * pRegion, INT32 iReason ) INT32 GetNumberOfMilitiaInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) { INT32 iNumberInSector = 0; - + if( !bSectorZ ) { - iNumberInSector = SectorInfo[ SECTOR( sSectorX, sSectorY )].ubNumberOfCivsAtLevel[ GREEN_MILITIA ] - + SectorInfo[ SECTOR( sSectorX, sSectorY )].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] + iNumberInSector = SectorInfo[ SECTOR( sSectorX, sSectorY )].ubNumberOfCivsAtLevel[ GREEN_MILITIA ] + + SectorInfo[ SECTOR( sSectorX, sSectorY )].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] + SectorInfo[ SECTOR( sSectorX, sSectorY )].ubNumberOfCivsAtLevel[ ELITE_MILITIA ]; } @@ -6462,8 +6456,8 @@ UINT32 WhatPlayerKnowsAboutEnemiesInSector( INT16 sSectorX, INT16 sSectorY ) //will display on mapscreen until time is compressed. When time is compressed, the flag is cleared, and //a question mark is displayed to reflect that the player no longer knows. if ( CanMercsScoutThisSector( sSectorX, sSectorY, 0 ) || - CanNearbyMilitiaScoutThisSector( sSectorX, sSectorY ) || - ( uiSectorFlags & SF_PLAYER_KNOWS_ENEMIES_ARE_HERE ) ) + CanNearbyMilitiaScoutThisSector( sSectorX, sSectorY ) || + ( uiSectorFlags & SF_PLAYER_KNOWS_ENEMIES_ARE_HERE ) ) { // if the enemies are stationary (i.e. mercs attacking a garrison) if ( NumStationaryEnemiesInSector( sSectorX, sSectorY ) > 0 ) @@ -6530,17 +6524,17 @@ BOOLEAN CanMercsScoutThisSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) } // vehicles can't scout! - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { continue; } // POWs, dead guys, guys in transit, sleeping, and really hurt guys can't scout! if ( ( pSoldier->bAssignment == IN_TRANSIT ) || - ( pSoldier->bAssignment == ASSIGNMENT_POW ) || - ( pSoldier->bAssignment == ASSIGNMENT_DEAD ) || - ( pSoldier -> fMercAsleep == TRUE ) || - ( pSoldier->bLife < OKLIFE ) ) + ( pSoldier->bAssignment == ASSIGNMENT_POW ) || + ( pSoldier->bAssignment == ASSIGNMENT_DEAD ) || + ( pSoldier->flags.fMercAsleep == TRUE ) || + ( pSoldier->stats.bLife < OKLIFE ) ) { continue; } @@ -6552,7 +6546,7 @@ BOOLEAN CanMercsScoutThisSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) } // mercs on the move can't scout - if ( pSoldier->fBetweenSectors ) + if ( pSoldier->flags.fBetweenSectors ) { continue; } @@ -6630,7 +6624,7 @@ UINT8 NumActiveCharactersInSector( INT16 sSectorX, INT16 sSectorY, INT16 bSector { pSoldier = &( Menptr[ gCharactersList[ iCounter ].usSolID ] ); - if( pSoldier->bActive && ( pSoldier->bLife > 0 ) && + if( pSoldier->bActive && ( pSoldier->stats.bLife > 0 ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) && ( pSoldier->bAssignment != IN_TRANSIT ) ) { if( ( pSoldier->sSectorX == sSectorX ) && ( pSoldier->sSectorY == sSectorY ) && ( pSoldier->bSectorZ == bSectorZ ) ) @@ -6752,8 +6746,8 @@ void ShowSAMSitesOnStrategicMap( void ) void BlitSAMGridMarkers( void ) { INT16 sScreenX = 0, sScreenY = 0; - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; UINT16 usColor = 0; INT32 iCounter = 0; INT16 sWidth = 0, sHeight = 0; @@ -6762,13 +6756,13 @@ void BlitSAMGridMarkers( void ) // get 16 bpp color usColor = Get16BPPColor( FROMRGB( 100, 100, 100) ); - pDestBuf = LockVideoSurface( guiSAVEBUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( guiSAVEBUFFER, &uiDestPitchBYTES ); // clip to view region ClipBlitsToMapViewRegionForRectangleAndABit( uiDestPitchBYTES ); for( iCounter = 0; iCounter < NUMBER_OF_SAMS; iCounter++ ) - { + { // has the sam site here been found? if( !fSamSiteFound[ iCounter ] ) { @@ -6793,12 +6787,12 @@ void BlitSAMGridMarkers( void ) } // draw rectangle - RectangleDraw( TRUE, sScreenX, sScreenY - 1, sScreenX + sWidth, sScreenY + sHeight - 1, usColor, pDestBuf ); + RectangleDraw( TRUE, sScreenX, sScreenY - 1, sScreenX + sWidth, sScreenY + sHeight - 1, usColor, pDestBuf ); } // restore clips RestoreClipRegionToFullScreenForRectangle( uiDestPitchBYTES ); - + // unlock surface UnLockVideoSurface( guiSAVEBUFFER ); @@ -6817,7 +6811,7 @@ BOOLEAN CanMilitiaAutoDistribute( void ) // can't auto-distribute if we don't have a town selected (this excludes SAM sites) - if( sSelectedMilitiaTown == BLANK_SECTOR ) + if( sSelectedMilitiaTown == BLANK_SECTOR ) return( FALSE ); // can't auto-distribute if we don't control any sectors in the the town @@ -6833,7 +6827,7 @@ BOOLEAN CanMilitiaAutoDistribute( void ) { // grab current sector value sCurrentSectorValue = sBaseSectorValue + ( ( iCounter % MILITIA_BOX_ROWS ) + ( iCounter / MILITIA_BOX_ROWS ) * ( 16 ) ); - + sSectorX = SECTORX( sCurrentSectorValue ); sSectorY = SECTORY( sCurrentSectorValue ); @@ -6932,7 +6926,7 @@ void DrawMapBoxIcon( HVOBJECT hIconHandle, UINT16 usVOIndex, INT16 sMapX, INT16 iColumnNumber = ubIconPosition % MERC_ICONS_PER_LINE; - iRowNumber = ubIconPosition / MERC_ICONS_PER_LINE; + iRowNumber = ubIconPosition / MERC_ICONS_PER_LINE; if ( !fZoomFlag ) { @@ -6947,8 +6941,8 @@ void DrawMapBoxIcon( HVOBJECT hIconHandle, UINT16 usVOIndex, INT16 sMapX, INT16 { INT sX, sY; - GetScreenXYFromMapXYStationary( ( UINT16 ) sX,( UINT16 ) sY, &sX, &sY ); - iY = sY-MAP_GRID_Y; + GetScreenXYFromMapXYStationary( ( UINT16 ) sX,( UINT16 ) sY, &sX, &sY ); + iY = sY-MAP_GRID_Y; iX = sX-MAP_GRID_X; // clip blits to mapscreen region @@ -6958,8 +6952,8 @@ void DrawMapBoxIcon( HVOBJECT hIconHandle, UINT16 usVOIndex, INT16 sMapX, INT16 // restore clip blits RestoreClipRegionToFullScreen( ); - - InvalidateRegion(MAP_X_ICON_OFFSET+iX+6*iColumnNumber+2, MAP_Y_ICON_OFFSET+iY+6*iRowNumber,MAP_X_ICON_OFFSET+iX+6*iColumnNumber+2+ DMAP_GRID_ZOOM_X, MAP_Y_ICON_OFFSET+iY+6*iRowNumber + DMAP_GRID_ZOOM_Y ); + + InvalidateRegion(MAP_X_ICON_OFFSET+iX+6*iColumnNumber+2, MAP_Y_ICON_OFFSET+iY+6*iRowNumber,MAP_X_ICON_OFFSET+iX+6*iColumnNumber+2+ DMAP_GRID_ZOOM_X, MAP_Y_ICON_OFFSET+iY+6*iRowNumber + DMAP_GRID_ZOOM_Y ); } */ } @@ -7079,12 +7073,6 @@ void InitMapSecrets( void ) BOOLEAN CanRedistributeMilitiaInSector( INT16 sClickedSectorX, INT16 sClickedSectorY, INT8 bClickedTownId ) { - INT32 iCounter = 0; - INT16 sBaseSectorValue = 0, sCurrentSectorValue = 0; - INT16 sSectorX = 0, sSectorY = 0; - INT32 iTotalTroopsInTown = 0; - - // if no world is loaded, we can't be in combat (PBI/Auto-resolve locks out normal mapscreen interface for this) if( !gfWorldLoaded ) { @@ -7107,6 +7095,9 @@ BOOLEAN CanRedistributeMilitiaInSector( INT16 sClickedSectorX, INT16 sClickedSec } + INT32 iCounter = 0; + INT16 sBaseSectorValue = 0, sCurrentSectorValue = 0; + INT16 sSectorX = 0, sSectorY = 0; // currently loaded surface sector IS hostile - so we must check if it's also one of the sectors in this "militia map" // get the sector value for the upper left corner @@ -7117,7 +7108,7 @@ BOOLEAN CanRedistributeMilitiaInSector( INT16 sClickedSectorX, INT16 sClickedSec { // grab current sector value sCurrentSectorValue = sBaseSectorValue + ( ( iCounter % MILITIA_BOX_ROWS ) + ( iCounter / MILITIA_BOX_ROWS ) * ( 16 ) ); - + sSectorX = SECTORX( sCurrentSectorValue ); sSectorY = SECTORY( sCurrentSectorValue ); diff --git a/Strategic/Map Screen Interface Map.h b/Strategic/Map Screen Interface Map.h index e9ddeb7a..1b8eae3a 100644 --- a/Strategic/Map Screen Interface Map.h +++ b/Strategic/Map Screen Interface Map.h @@ -54,7 +54,7 @@ void CancelPathForCharacter( SOLDIERTYPE *pCharacter ); void CancelPathForVehicle( VEHICLETYPE *pVehicle, BOOLEAN fAlreadyReversed ); void CancelPathForGroup( GROUP *pGroup ); -// check if we have waited long enought o update temp path +// check if we have waited long enought object update temp path void DisplayThePotentialPathForHelicopter(INT16 sMapX, INT16 sMapY ); // clear out helicopter list after this sector @@ -115,13 +115,13 @@ void CreateDestroyMilitiaPopUPRegions( void ); BOOLEAN DrawMilitiaPopUpBox( void ); -//Returns true if the player knows how many enemies are in the sector if that number is greater than 0. +//Returns true if the player knows how many enemies are in the sector if that number is greater than 0. //Returns false for all other cases. UINT32 WhatPlayerKnowsAboutEnemiesInSector( INT16 sSectorX, INT16 sSectorY ); -//There is a special case flag used when players encounter enemies in a sector, then retreat. The number of enemies -//will display on mapscreen until time is compressed. When time is compressed, the flag is cleared, and -//a question mark is displayed to reflect that the player no longer knows. This is the function that clears that +//There is a special case flag used when players encounter enemies in a sector, then retreat. The number of enemies +//will display on mapscreen until time is compressed. When time is compressed, the flag is cleared, and +//a question mark is displayed to reflect that the player no longer knows. This is the function that clears that //flag. void ClearAnySectorsFlashingNumberOfEnemies(); @@ -177,17 +177,17 @@ enum { //#define MAP_VIEW_HEIGHT 298 // zoomed in grid sizes -#define MAP_GRID_ZOOM_X MAP_GRID_X*2 -#define MAP_GRID_ZOOM_Y MAP_GRID_Y*2 +#define MAP_GRID_ZOOM_X MAP_GRID_X*2 +#define MAP_GRID_ZOOM_Y MAP_GRID_Y*2 // number of units wide -#define WORLD_MAP_X 18 +#define WORLD_MAP_X 18 // dirty regions for the map #define DMAP_GRID_X ( MAP_GRID_X + 1 ) #define DMAP_GRID_Y ( MAP_GRID_Y + 1 ) -#define DMAP_GRID_ZOOM_X ( MAP_GRID_ZOOM_X+1) -#define DMAP_GRID_ZOOM_Y ( MAP_GRID_ZOOM_Y+1) +#define DMAP_GRID_ZOOM_X ( MAP_GRID_ZOOM_X+1) +#define DMAP_GRID_ZOOM_Y ( MAP_GRID_ZOOM_Y+1) // Orta position on the map @@ -200,7 +200,7 @@ enum { // what are we showing?..teams/vehicles // Show values #define SHOW_TEAMMATES 1 -#define SHOW_VEHICLES 2 +#define SHOW_VEHICLES 2 // wait time until temp path is drawn, from placing cursor on a map grid @@ -263,7 +263,7 @@ extern INT8 bSelectedContractChar; extern UINT32 guiMAPCURSORS; // has temp path for character path or helicopter been already drawn -extern BOOLEAN fTempPathAlreadyDrawn; +extern BOOLEAN fTempPathAlreadyDrawn; // map view region clipping rect extern SGPRect MapScreenRect; diff --git a/Strategic/Map Screen Interface TownMine Info.cpp b/Strategic/Map Screen Interface TownMine Info.cpp index b07f0097..d5c36990 100644 --- a/Strategic/Map Screen Interface TownMine Info.cpp +++ b/Strategic/Map Screen Interface TownMine Info.cpp @@ -18,7 +18,7 @@ #include "Strategic Town Loyalty.h" #include "Strategic Mines.h" #include "finances.h" - #include "Map Screen Interface Map Inventory.h" + #include "Map Screen Interface Map Inventory.h" #include "Strategic.h" #include "Utilities.h" #include "video.h" @@ -78,7 +78,7 @@ void AddItemsInSectorToBox(void); // position town/mine info box on the screen void PositionTownMineInfoBox( void ); -// add the pop up button for the map inventory pop up activation +// add the pop up button for the map inventory pop up activation void AddInventoryButtonForMapPopUpBox( void ); // now remove the above button @@ -98,14 +98,14 @@ void DisplayTownInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) // set current sector if( ( bCurrentTownMineSectorX != sMapX ) || ( bCurrentTownMineSectorY != sMapY ) || ( bCurrentTownMineSectorZ != bMapZ ) ) { - bCurrentTownMineSectorX = ( INT8 )sMapX; - bCurrentTownMineSectorY = ( INT8 )sMapY; - bCurrentTownMineSectorZ = bMapZ; + bCurrentTownMineSectorX = ( INT8 )sMapX; + bCurrentTownMineSectorY = ( INT8 )sMapY; + bCurrentTownMineSectorZ = bMapZ; } //create destroy the box CreateDestroyTownInfoBox( ); - + } void CreateDestroyTownInfoBox( void ) @@ -114,7 +114,6 @@ void CreateDestroyTownInfoBox( void ) static BOOLEAN fCreated = FALSE; SGPRect pDimensions; SGPPoint pPosition; - INT16 sButtonX = 0, sButtonY = 0; INT8 bTownId = 0; if( ( fCreated == FALSE ) && ( fShowTownInfo == TRUE ) ) @@ -161,7 +160,7 @@ void CreateDestroyTownInfoBox( void ) // set font type - SetBoxFont(ghTownMineBox, BLOCKFONT2); + SetBoxFont(ghTownMineBox, BLOCKFONT2); // set highlight color SetBoxHighLight(ghTownMineBox, FONT_WHITE); @@ -198,7 +197,7 @@ void CreateDestroyTownInfoBox( void ) } pDimensions.iBottom += BOX_BUTTON_HEIGHT; - + SetBoxSize( ghTownMineBox, pDimensions ); ShowBox( ghTownMineBox ); @@ -237,7 +236,7 @@ void CreateDestroyTownInfoBox( void ) fCreated = FALSE; } - + return; } @@ -246,7 +245,7 @@ void CreateTownInfoBox( void ) { // create basic box CreatePopUpBox(&ghTownMineBox, TownMineDimensions, TownMinePosition, (POPUP_BOX_FLAG_CLIP_TEXT )); - + // which buffer will box render to SetBoxBuffer(ghTownMineBox, FRAME_BUFFER); @@ -329,7 +328,7 @@ void AddTextToTownBox( void ) // town size swprintf( wString, L"%s:", pwTownInfoStrings[ 0 ] ); AddMonoString( &hStringHandle, wString ); - swprintf( wString, L"%d", GetTownSectorSize( ubTownId ) ); + swprintf( wString, L"%d", GetTownSectorSize( ubTownId ) ); AddSecondColumnMonoString( &hStringHandle, wString ); // main facilities @@ -345,7 +344,7 @@ void AddTextToTownBox( void ) // town control swprintf( wString, L"%s:", pwTownInfoStrings[ 2 ] ); AddMonoString( &hStringHandle, wString ); - swprintf( wString, L"%d%%%%", (GetTownSectorsUnderControl( ubTownId ) * 100) / GetTownSectorSize( ubTownId )); + swprintf( wString, L"%d%%%%", (GetTownSectorsUnderControl( ubTownId ) * 100) / GetTownSectorSize( ubTownId )); AddSecondColumnMonoString( &hStringHandle, wString ); } @@ -364,9 +363,9 @@ void AddTextToTownBox( void ) if( sMineSector != -1 ) { // Associated Mine: Sector - swprintf( wString, L"%s:", pwTownInfoStrings[ 4 ] ); + swprintf( wString, L"%s:", pwTownInfoStrings[ 4 ] ); AddMonoString( &hStringHandle, wString ); - GetShortSectorString( ( INT16 )( sMineSector % MAP_WORLD_X ), ( INT16 )( sMineSector / MAP_WORLD_X ), wString ); + GetShortSectorString( ( INT16 )( sMineSector % MAP_WORLD_X ), ( INT16 )( sMineSector / MAP_WORLD_X ), wString ); AddSecondColumnMonoString( &hStringHandle, wString ); } } @@ -461,7 +460,7 @@ void AddTextToMineBox( void ) // town control percentage swprintf( wString, L"%s:", pwMineStrings[ 12 ]); AddMonoString( &hStringHandle, wString ); - swprintf( wString, L"%d%%%%", (GetTownSectorsUnderControl( gMineLocation[ ubMineIndex ].bAssociatedTown ) * 100) / GetTownSectorSize( gMineLocation[ ubMineIndex ].bAssociatedTown )); + swprintf( wString, L"%d%%%%", (GetTownSectorsUnderControl( gMineLocation[ ubMineIndex ].bAssociatedTown ) * 100) / GetTownSectorSize( gMineLocation[ ubMineIndex ].bAssociatedTown )); AddSecondColumnMonoString( &hStringHandle, wString ); ubTown = gMineLocation[ ubMineIndex ].bAssociatedTown; @@ -599,7 +598,7 @@ void AddCommonInfoToBox(void) // in sector where militia can be trained, - // control of the sector matters, display who controls this sector. Map brightness no longer gives this! + // control of the sector matters, display who controls this sector. Map brightness no longer gives this! if ( MilitiaTrainingAllowedInSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY, 0 ) && !fUnknownSAMSite ) { // controlled: @@ -619,7 +618,7 @@ void AddCommonInfoToBox(void) if (ubMilitiaTotal > 0) { // some militia, show total & their breakdown by level - swprintf( wString, L"%d (%d/%d/%d)", ubMilitiaTotal, + swprintf( wString, L"%d (%d/%d/%d)", ubMilitiaTotal, MilitiaInSectorOfRank(bCurrentTownMineSectorX, bCurrentTownMineSectorY, GREEN_MILITIA), MilitiaInSectorOfRank(bCurrentTownMineSectorX, bCurrentTownMineSectorY, REGULAR_MILITIA), MilitiaInSectorOfRank(bCurrentTownMineSectorX, bCurrentTownMineSectorY, ELITE_MILITIA)); @@ -647,7 +646,7 @@ void AddCommonInfoToBox(void) // how many are there, really? ubNumEnemies = NumEnemiesInSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY ); - + switch ( WhatPlayerKnowsAboutEnemiesInSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY ) ) { case KNOWS_NOTHING: @@ -701,10 +700,9 @@ void PositionTownMineInfoBox( void ) SGPRect pDimensions; SGPPoint pPosition; INT16 sX =0, sY = 0; - INT16 sNewMargin = 0; // position the box based on x and y of the selected sector - GetScreenXYFromMapXY( bCurrentTownMineSectorX, bCurrentTownMineSectorY, &sX, &sY); + GetScreenXYFromMapXY( bCurrentTownMineSectorX, bCurrentTownMineSectorY, &sX, &sY); // set box position pPosition.iX = sX; @@ -721,7 +719,7 @@ void PositionTownMineInfoBox( void ) if( pDimensions.iRight < ( sTotalButtonWidth + 30 ) ) { - SpecifyBoxMinWidth( ghTownMineBox, ( sTotalButtonWidth + 30 ) ); + SpecifyBoxMinWidth( ghTownMineBox, ( sTotalButtonWidth + 30 ) ); pDimensions.iRight = sTotalButtonWidth + 30; } @@ -733,7 +731,7 @@ void PositionTownMineInfoBox( void ) if( pPosition.iX + pDimensions.iRight > MapScreenRect.iRight ) { - pPosition.iX = MapScreenRect.iRight - pDimensions.iRight - 5; + pPosition.iX = MapScreenRect.iRight - pDimensions.iRight - 5; } @@ -743,12 +741,12 @@ void PositionTownMineInfoBox( void ) pPosition.iY = MapScreenRect.iTop + 5; } - if( pPosition.iY + pDimensions.iBottom > MapScreenRect.iBottom ) + if( pPosition.iY + pDimensions.iBottom > MapScreenRect.iBottom ) { - pPosition.iY = MapScreenRect.iBottom - pDimensions.iBottom - 8; + pPosition.iY = MapScreenRect.iBottom - pDimensions.iBottom - 8; } - + // reset position SetBoxPosition( ghTownMineBox, pPosition ); @@ -768,50 +766,50 @@ void AddInventoryButtonForMapPopUpBox( void ) INT16 sWidthA = 0, sWidthB = 0, sTotalBoxWidth = 0; HVOBJECT hHandle; - + // load the button VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; FilenameForBPP("INTERFACE\\mapinvbtns.sti", VObjectDesc.ImageFile); - AddVideoObject( &VObjectDesc, &uiObject ); + AddVideoObject( &VObjectDesc, &uiObject ); // Calculate smily face positions... GetVideoObject( &hHandle, uiObject ); pTrav = &(hHandle->pETRLEObject[ 0 ] ); sWidthA = pTrav->usWidth; - + pTrav = &(hHandle->pETRLEObject[ 1 ] ); sWidthB = pTrav->usWidth; - + sTotalBoxWidth = sTotalButtonWidth; GetBoxSize( ghTownMineBox , &pDimensions ); GetBoxPosition( ghTownMineBox, &pPosition ); sX = pPosition.iX + ( pDimensions.iRight - sTotalBoxWidth ) / 3; - sY = pPosition.iY + pDimensions.iBottom - ( ( BOX_BUTTON_HEIGHT + 5 ) ); + sY = pPosition.iY + pDimensions.iBottom - ( ( BOX_BUTTON_HEIGHT + 5 ) ); - guiMapButtonInventoryImage[0] = LoadButtonImage( "INTERFACE\\mapinvbtns.sti" ,-1,0,-1,2,-1 ); + guiMapButtonInventoryImage[0] = LoadButtonImage( "INTERFACE\\mapinvbtns.sti" ,-1,0,-1,2,-1 ); + + guiMapButtonInventory[0] = CreateIconAndTextButton( guiMapButtonInventoryImage[0], pMapPopUpInventoryText[ 0 ], BLOCKFONT2, + FONT_WHITE, FONT_BLACK, + FONT_WHITE, FONT_BLACK, + TEXT_CJUSTIFIED, + (INT16)(sX ), (INT16)( sY ), BUTTON_TOGGLE , MSYS_PRIORITY_HIGHEST - 1, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)MapTownMineInventoryButtonCallBack ); - guiMapButtonInventory[0] = CreateIconAndTextButton( guiMapButtonInventoryImage[0], pMapPopUpInventoryText[ 0 ], BLOCKFONT2, - FONT_WHITE, FONT_BLACK, - FONT_WHITE, FONT_BLACK, - TEXT_CJUSTIFIED, - (INT16)(sX ), (INT16)( sY ), BUTTON_TOGGLE , MSYS_PRIORITY_HIGHEST - 1, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)MapTownMineInventoryButtonCallBack ); - sX = sX + sWidthA + ( pDimensions.iRight - sTotalBoxWidth ) / 3; sY = pPosition.iY + pDimensions.iBottom - ( ( BOX_BUTTON_HEIGHT + 5) ); - guiMapButtonInventoryImage[1] = LoadButtonImage( "INTERFACE\\mapinvbtns.sti" ,-1,1,-1,3,-1 ); + guiMapButtonInventoryImage[1] = LoadButtonImage( "INTERFACE\\mapinvbtns.sti" ,-1,1,-1,3,-1 ); - guiMapButtonInventory[1] = CreateIconAndTextButton( guiMapButtonInventoryImage[1], pMapPopUpInventoryText[ 1 ], BLOCKFONT2, - FONT_WHITE, FONT_BLACK, - FONT_WHITE, FONT_BLACK, - TEXT_CJUSTIFIED, - (INT16)(sX ), (INT16)( sY ), BUTTON_TOGGLE , MSYS_PRIORITY_HIGHEST - 1, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)MapTownMineExitButtonCallBack ); + guiMapButtonInventory[1] = CreateIconAndTextButton( guiMapButtonInventoryImage[1], pMapPopUpInventoryText[ 1 ], BLOCKFONT2, + FONT_WHITE, FONT_BLACK, + FONT_WHITE, FONT_BLACK, + TEXT_CJUSTIFIED, + (INT16)(sX ), (INT16)( sY ), BUTTON_TOGGLE , MSYS_PRIORITY_HIGHEST - 1, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)MapTownMineExitButtonCallBack ); // delete video object DeleteVideoObjectFromIndex( uiObject ); @@ -832,11 +830,11 @@ void RemoveInventoryButtonForMapPopUpBox( void ) // get rid of button RemoveButton( guiMapButtonInventory[0] ); - UnloadButtonImage( guiMapButtonInventoryImage[0] ); + UnloadButtonImage( guiMapButtonInventoryImage[0] ); RemoveButton( guiMapButtonInventory[1] ); - UnloadButtonImage( guiMapButtonInventoryImage[1] ); - + UnloadButtonImage( guiMapButtonInventoryImage[1] ); + return; } @@ -845,13 +843,13 @@ void MapTownMineInventoryButtonCallBack( GUI_BUTTON *btn, INT32 reason ) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); // done fShowMapInventoryPool = TRUE; @@ -866,7 +864,7 @@ void MapTownMineInventoryButtonCallBack( GUI_BUTTON *btn, INT32 reason ) ShouldTheHelpScreenComeUp( HELP_SCREEN_MAPSCREEN_SECTOR_INVENTORY, TRUE ); } } - } + } } @@ -874,13 +872,13 @@ void MapTownMineExitButtonCallBack( GUI_BUTTON *btn, INT32 reason ) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); // done fMapPanelDirty = TRUE; @@ -888,7 +886,7 @@ void MapTownMineExitButtonCallBack( GUI_BUTTON *btn, INT32 reason ) fShowTownInfo = FALSE; } - } + } } @@ -903,17 +901,17 @@ void MinWidthOfTownMineInfoBox( void ) VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; FilenameForBPP("INTERFACE\\mapinvbtns.sti", VObjectDesc.ImageFile); - AddVideoObject( &VObjectDesc, &uiObject ); + AddVideoObject( &VObjectDesc, &uiObject ); // Calculate smily face positions... GetVideoObject( &hHandle, uiObject ); pTrav = &(hHandle->pETRLEObject[ 0 ] ); sWidthA = pTrav->usWidth; - + pTrav = &(hHandle->pETRLEObject[ 1 ] ); sWidthB = pTrav->usWidth; - + sTotalBoxWidth = sWidthA + sWidthB; sTotalButtonWidth = sTotalBoxWidth; @@ -921,4 +919,4 @@ void MinWidthOfTownMineInfoBox( void ) DeleteVideoObjectFromIndex( uiObject ); return; -} \ No newline at end of file +} diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index 946c716e..25938819 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -7,7 +7,7 @@ #include "Render Dirty.h" #include "Font Control.h" #include "Assignments.h" - #include "Soldier Control.h" + #include "Overhead.h" #include "Squads.h" #include "Sound Control.h" @@ -55,6 +55,11 @@ #include "Render Fun.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + // inventory pool position on screen #define MAP_INVEN_POOL_X 300 #define MAP_INVEN_POOL_Y 300 @@ -211,7 +216,7 @@ extern BOOLEAN fShowInventoryFlag; extern FACETYPE *gpCurrentTalkingFace; extern UINT8 gubCurrentTalkingID; extern BOOLEAN fMapScreenBottomDirty; -extern MOUSE_REGION gMPanelRegion; +extern MOUSE_REGION gMPanelRegion; // has the inventory pool been selected to be on or off? @@ -219,7 +224,7 @@ BOOLEAN fMapInventoryPoolInited = FALSE; BOOLEAN fShowMapScreenMovementList = FALSE; -MapScreenCharacterSt gCharactersList[ MAX_CHARACTER_COUNT+1]; +MapScreenCharacterSt gCharactersList[ MAX_CHARACTER_COUNT+1]; extern MOUSE_REGION gCharInfoHandRegion; MOUSE_REGION gMapStatusBarsRegion; @@ -236,7 +241,7 @@ UINT32 guiSAMICON; // disable team info panels due to battle roster -BOOLEAN fDisableDueToBattleRoster = FALSE; +BOOLEAN fDisableDueToBattleRoster = FALSE; // track old contract times INT32 iOldContractTimes[ MAX_CHARACTER_COUNT ]; @@ -267,8 +272,8 @@ INT32 giContractHighLine = -1; INT32 giSleepHighLine = -1; // pop up box textures -UINT32 guiPOPUPTEX; -UINT32 guiPOPUPBORDERS; +UINT32 guiPOPUPTEX; +UINT32 guiPOPUPBORDERS; // the currently selected character arrow UINT32 guiSelectedCharArrow; @@ -302,9 +307,9 @@ BOOLEAN fShowTrainingMenu = FALSE; BOOLEAN fShowAttributeMenu = FALSE; BOOLEAN fShowSquadMenu = FALSE; BOOLEAN fShowContractMenu = FALSE; -BOOLEAN fShowRemoveMenu = FALSE; -BOOLEAN fShowMilitiaControlMenu = FALSE; //lal -//BOOLEAN fShowTalkToAllMenu = FALSE;//lal +BOOLEAN fShowRemoveMenu = FALSE; +BOOLEAN fShowMilitiaControlMenu = FALSE; //lal +//BOOLEAN fShowTalkToAllMenu = FALSE;//lal BOOLEAN fRebuildMoveBox = FALSE; @@ -322,7 +327,7 @@ SGPPoint RepairPosition={160,150}; SGPRect RepairDimensions={0,0,80,80}; //lal -SGPPoint MilitiaControlPosition={120,150}; +SGPPoint MilitiaControlPosition={120,150}; SGPRect MilitiaControlDimensions={0,0,100,95}; //SGPPoint TalkToAllPosition={160,150}; @@ -463,7 +468,7 @@ BOOLEAN IsEntryInSelectedListSet( INT8 bEntry ) Assert( ( bEntry >= 0 ) && ( bEntry < MAX_CHARACTER_COUNT ) ); // is this entry in the selected list set? - + return( fSelectedListOfMercsForMapScreen[ bEntry ] ); } @@ -513,7 +518,7 @@ BOOLEAN MultipleCharacterListEntriesSelected( void ) INT32 iCounter = 0; // check if more than one person is selected in the selected list - for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ ) + for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ ) { if( fSelectedListOfMercsForMapScreen[iCounter] == TRUE ) { @@ -548,7 +553,7 @@ void ResetAssignmentsForMercsTrainingUnpaidSectorsInSelectedList( INT8 bAssignme } pSoldier = &Menptr[ gCharactersList[ iCounter ].usSolID ]; - + if( pSoldier->bActive == FALSE ) { continue; @@ -580,7 +585,7 @@ void ResetAssignmentOfMercsThatWereTrainingMilitiaInThisSector( INT16 sSectorX, } pSoldier = &Menptr[ gCharactersList[ iCounter ].usSolID ]; - + if( pSoldier->bActive == FALSE ) { continue; @@ -653,7 +658,7 @@ void DeselectSelectedListMercsWhoCantMoveWithThisGuy( SOLDIERTYPE *pSoldier ) } } // if anchor guy IS a vehicle - else if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + else if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { if ( !CanSoldierMoveWithVehicleId( pSoldier2, pSoldier->bVehicleID ) ) { @@ -671,7 +676,7 @@ void DeselectSelectedListMercsWhoCantMoveWithThisGuy( SOLDIERTYPE *pSoldier ) } } // if this guy IS a vehicle - else if ( pSoldier2->uiStatusFlags & SOLDIER_VEHICLE ) + else if ( pSoldier2->flags.uiStatusFlags & SOLDIER_VEHICLE ) { if ( !CanSoldierMoveWithVehicleId( pSoldier, pSoldier2->bVehicleID ) ) { @@ -694,9 +699,9 @@ void DeselectSelectedListMercsWhoCantMoveWithThisGuy( SOLDIERTYPE *pSoldier ) ResetEntryForSelectedList( ( INT8 )iCounter ); } - // if either is between sectors, they must be in the same movement group - if ( ( pSoldier->fBetweenSectors || pSoldier2->fBetweenSectors ) && - ( pSoldier->ubGroupID != pSoldier2->ubGroupID ) ) + // if either is between sectors, they must be in the same movement group + if ( ( pSoldier->flags.fBetweenSectors || pSoldier2->flags.fBetweenSectors ) && + ( pSoldier->ubGroupID != pSoldier2->ubGroupID ) ) { ResetEntryForSelectedList( ( INT8 )iCounter ); } @@ -776,14 +781,14 @@ BOOLEAN AnyMercInSameSquadOrVehicleIsSelected( SOLDIERTYPE *pSoldier ) } // target guy is in a vehicle, and this guy IS that vehicle - if( ( pSoldier->bAssignment == VEHICLE ) && ( pSoldier2->uiStatusFlags & SOLDIER_VEHICLE ) && + if( ( pSoldier->bAssignment == VEHICLE ) && ( pSoldier2->flags.uiStatusFlags & SOLDIER_VEHICLE ) && ( pSoldier->iVehicleId == pSoldier2->bVehicleID ) ) { return ( TRUE ); } // this guy is in a vehicle, and the target guy IS that vehicle - if( ( pSoldier2->bAssignment == VEHICLE ) && ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && + if( ( pSoldier2->bAssignment == VEHICLE ) && ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && ( pSoldier2->iVehicleId == pSoldier->bVehicleID ) ) { return ( TRUE ); @@ -835,7 +840,7 @@ void RestoreBackgroundForAssignmentGlowRegionList( void ) fTeamPanelDirty = TRUE; // set old to current - iOldAssignmentLine = giAssignHighLine; + iOldAssignmentLine = giAssignHighLine; } // leave @@ -863,7 +868,7 @@ void RestoreBackgroundForDestinationGlowRegionList( void ) fTeamPanelDirty = TRUE; // set old to current - iOldDestinationLine = giDestHighLine; + iOldDestinationLine = giDestHighLine; } // leave @@ -891,7 +896,7 @@ void RestoreBackgroundForContractGlowRegionList( void ) fTeamPanelDirty = TRUE; // set old to current - iOldContractLine = giContractHighLine; + iOldContractLine = giContractHighLine; // reset color rotation fResetContractGlow = TRUE; @@ -923,7 +928,7 @@ void RestoreBackgroundForSleepGlowRegionList( void ) fTeamPanelDirty = TRUE; // set old to current - iOldSleepHighLine = giSleepHighLine; + iOldSleepHighLine = giSleepHighLine; // reset color rotation fResetContractGlow = TRUE; @@ -942,7 +947,7 @@ void PlayGlowRegionSound( void ) { // is sound playing?..don't play new one if( SoundIsPlaying( uiSoundId ) == TRUE ) - { + { return; } } @@ -971,7 +976,7 @@ INT16 CharacterIsGettingPathPlotted( INT16 sCharNumber ) // if the highlighted line character is also selected if ( ( ( giDestHighLine != -1 ) && IsEntryInSelectedListSet ( ( INT8 ) giDestHighLine ) ) || - ( ( bSelectedDestChar != -1 ) && IsEntryInSelectedListSet ( bSelectedDestChar ) ) ) + ( ( bSelectedDestChar != -1 ) && IsEntryInSelectedListSet ( bSelectedDestChar ) ) ) { // then ALL selected lines will be affected if( IsEntryInSelectedListSet( ( INT8 ) sCharNumber ) ) @@ -984,7 +989,7 @@ INT16 CharacterIsGettingPathPlotted( INT16 sCharNumber ) // if he is *the* selected dude if( bSelectedDestChar == sCharNumber ) { - return ( TRUE ); + return ( TRUE ); } // ONLY the highlighted line will be affected @@ -1118,7 +1123,7 @@ void ActivateSoldierPopup( SOLDIERTYPE *pSoldier, UINT8 ubPopupType, INT16 xp, I bSelectedDestChar = -1; bSelectedContractChar = -1; bSelectedAssignChar = bCharacter; - if( ( pSoldier->bLife > 0 ) &&( pSoldier->bAssignment != ASSIGNMENT_POW ) ) + if( ( pSoldier->stats.bLife > 0 ) &&( pSoldier->bAssignment != ASSIGNMENT_POW ) ) { fShowAssignmentMenu = TRUE; } @@ -1128,7 +1133,7 @@ void ActivateSoldierPopup( SOLDIERTYPE *pSoldier, UINT8 ubPopupType, INT16 xp, I } // set box y positions - AssignmentPosition.iY = giBoxY; + AssignmentPosition.iY = giBoxY; TrainPosition.iY = AssignmentPosition.iY + GetFontHeight( MAP_SCREEN_FONT )* ASSIGN_MENU_TRAIN; AttributePosition.iY = TrainPosition.iY; SquadPosition.iY = AssignmentPosition.iY; @@ -1147,7 +1152,7 @@ void ActivateSoldierPopup( SOLDIERTYPE *pSoldier, UINT8 ubPopupType, INT16 xp, I bSelectedAssignChar = -1; RebuildContractBoxForMerc( pSoldier ); - if( ( pSoldier->bLife > 0 ) &&( pSoldier->bAssignment != ASSIGNMENT_POW ) ) + if( ( pSoldier->stats.bLife > 0 ) &&( pSoldier->bAssignment != ASSIGNMENT_POW ) ) { fShowContractMenu = TRUE; } @@ -1163,21 +1168,22 @@ void ActivateSoldierPopup( SOLDIERTYPE *pSoldier, UINT8 ubPopupType, INT16 xp, I INT32 DoMapMessageBoxWithRect( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect ) -{ // reset the highlighted line +{ + // reset the highlighted line giHighLine = -1; - return DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT16 ) ( usFlags | MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, pCenteringRect ); + return DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT16 ) ( usFlags | MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, pCenteringRect ); } -INT32 DoMapMessageBox( UINT8 ubStyle, STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ) +INT32 DoMapMessageBox( UINT8 ubStyle, STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ) { - SGPRect CenteringRect= {0, 0, SCREEN_WIDTH, INV_INTERFACE_START_Y }; + SGPRect CenteringRect= {0, 0, SCREEN_WIDTH, INV_INTERFACE_START_Y }; // reset the highlighted line giHighLine = -1; // do message box and return - return DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT16 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, &CenteringRect ); + return DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT16 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, &CenteringRect ); } @@ -1244,29 +1250,29 @@ void CheckAndUpdateBasedOnContractTimes( void ) if( gCharactersList[iCounter].fValid == TRUE ) { // what kind of merc - if(Menptr[gCharactersList[iCounter].usSolID].ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) - { - // amount of time left on contract - iTimeRemaining=Menptr[gCharactersList[iCounter].usSolID].iEndofContractTime-GetWorldTotalMin(); - if(iTimeRemaining >60*24) - { - // more than a day, display in green - iTimeRemaining/=(60*24); + if(Menptr[gCharactersList[iCounter].usSolID].ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) + { + // amount of time left on contract + iTimeRemaining=Menptr[gCharactersList[iCounter].usSolID].iEndofContractTime-GetWorldTotalMin(); + if(iTimeRemaining >60*24) + { + // more than a day, display in green + iTimeRemaining/=(60*24); - // check if real change in contract time - if( iTimeRemaining != iOldContractTimes[ iCounter ]) - { - iOldContractTimes[ iCounter ] = iTimeRemaining; - - // dirty screen - fTeamPanelDirty = TRUE; - fCharacterInfoPanelDirty = TRUE; - } + // check if real change in contract time + if( iTimeRemaining != iOldContractTimes[ iCounter ]) + { + iOldContractTimes[ iCounter ] = iTimeRemaining; + + // dirty screen + fTeamPanelDirty = TRUE; + fCharacterInfoPanelDirty = TRUE; + } } else { // less than a day, display hours left in red - iTimeRemaining/=60; + iTimeRemaining/=60; // check if real change in contract time if( iTimeRemaining != iOldContractTimes[ iCounter ]) @@ -1281,11 +1287,11 @@ void CheckAndUpdateBasedOnContractTimes( void ) else if( Menptr[gCharactersList[iCounter].usSolID].ubWhatKindOfMercAmI == MERC_TYPE__MERC ) { iTimeRemaining = Menptr[gCharactersList[iCounter].usSolID].iTotalContractLength; - + if( iTimeRemaining != iOldContractTimes[ iCounter ]) { iOldContractTimes[ iCounter ] = iTimeRemaining; - + // dirty screen fTeamPanelDirty = TRUE; fCharacterInfoPanelDirty = TRUE; @@ -1322,8 +1328,8 @@ void HandleDisplayOfSelectedMercArrows( void ) } // now blit one by the selected merc sYPosition = Y_START+( bSelectedInfoChar * ( Y_SIZE + 2 ) ) - 1; - - + + if( bSelectedInfoChar >= FIRST_VEHICLE ) { usVehicleCount = bSelectedInfoChar - FIRST_VEHICLE; @@ -1344,7 +1350,7 @@ void HandleDisplayOfSelectedMercArrows( void ) if( ( IsEntryInSelectedListSet( ubCount ) == TRUE ) || ( ( bSelectedDestChar != - 1 ) ? ( ( Menptr[ gCharactersList[ ubCount ].usSolID ].ubGroupID != 0 ) ? ( Menptr[ gCharactersList[ bSelectedDestChar ].usSolID ].ubGroupID == Menptr[ gCharactersList[ ubCount ].usSolID ].ubGroupID ) : FALSE ) : FALSE ) ) { sYPosition = Y_START+( ubCount * ( Y_SIZE + 2) ) - 1; - + if( ubCount >= FIRST_VEHICLE ) { usVehicleCount = ubCount - FIRST_VEHICLE; @@ -1372,13 +1378,13 @@ void HandleDisplayOfItemPopUpForSector( INT16 sMapX, INT16 sMapY, INT16 sMapZ ) { return; } - - + + if( ( fWasInited == FALSE ) && ( fMapInventoryPoolInited ) ) { if( gCharactersList[ bSelectedInfoChar ].fValid == TRUE ) { - if( ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID].sSectorX == sMapX ) && ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID].sSectorY == sMapY ) && ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID].bSectorZ == sMapZ ) && ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID].bActive ) && ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID].bLife >= OKLIFE ) ) + if( ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID].sSectorX == sMapX ) && ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID].sSectorY == sMapY ) && ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID].bSectorZ == sMapZ ) && ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID].bActive ) && ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID].stats.bLife >= OKLIFE ) ) { // valid character InitializeItemPickupMenu( &( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID] ), NOWHERE , pItemPool, MAP_INVEN_POOL_X, MAP_INVEN_POOL_Y, -1 ); @@ -1418,9 +1424,9 @@ void HandleDisplayOfItemPopUpForSector( INT16 sMapX, INT16 sMapY, INT16 sMapZ ) void CreateScreenMaskForInventoryPoolPopUp( void ) { - // a screen mask for the inventory pop up + // a screen mask for the inventory pop up MSYS_DefineRegion( &gInventoryScreenMask, 0, 0 , SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGH - 1, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, InventoryScreenMaskBtnCallback ); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, InventoryScreenMaskBtnCallback ); } @@ -1433,21 +1439,21 @@ void RemoveScreenMaskForInventoryPoolPopUp( void ) // invnetory screen mask btn callback void InventoryScreenMaskBtnCallback(MOUSE_REGION * pRegion, INT32 iReason ) -{ - // inventory screen mask btn callback - if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) - { - fMapInventoryPoolInited = FALSE; - } +{ + // inventory screen mask btn callback + if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + fMapInventoryPoolInited = FALSE; + } } void GetMoraleString( SOLDIERTYPE *pSoldier, STR16 sString ) { - INT8 bMorale = pSoldier->bMorale; + INT8 bMorale = pSoldier->aiData.bMorale; - if ( pSoldier->uiStatusFlags & SOLDIER_DEAD ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) { - wcscpy( sString, pMoralStrings[ 5 ] ); + wcscpy( sString, pMoralStrings[ 5 ] ); } else if( bMorale > 80 ) { @@ -1455,11 +1461,11 @@ void GetMoraleString( SOLDIERTYPE *pSoldier, STR16 sString ) } else if( bMorale > 65 ) { - wcscpy( sString, pMoralStrings[ 1 ] ); + wcscpy( sString, pMoralStrings[ 1 ] ); } else if( bMorale > 35 ) { - wcscpy( sString, pMoralStrings[ 2 ] ); + wcscpy( sString, pMoralStrings[ 2 ] ); } else if( bMorale > 20 ) { @@ -1467,7 +1473,7 @@ void GetMoraleString( SOLDIERTYPE *pSoldier, STR16 sString ) } else { - wcscpy( sString, pMoralStrings[ 4 ] ); + wcscpy( sString, pMoralStrings[ 4 ] ); } } @@ -1477,61 +1483,61 @@ void GetMoraleString( SOLDIERTYPE *pSoldier, STR16 sString ) void HandleLeavingOfEquipmentInCurrentSector( UINT32 uiMercId ) { // just drop the stuff in the current sector - INT32 iCounter = 0; - INT16 sGridNo, sTempGridNo; + //INT32 iCounter = 0; + INT16 sGridNo, sTempGridNo; if( Menptr[ uiMercId ].sSectorX != gWorldSectorX || Menptr[ uiMercId ].sSectorY != gWorldSectorY || Menptr[ uiMercId ].bSectorZ != gbWorldSectorZ ) { - // ATE: Use insertion gridno if not nowhere and insertion is gridno - if ( Menptr[ uiMercId ].ubStrategicInsertionCode == INSERTION_CODE_GRIDNO && Menptr[ uiMercId ].usStrategicInsertionData != NOWHERE ) - { - sGridNo = Menptr[ uiMercId ].usStrategicInsertionData; - } - else - { - // Set flag for item... - sGridNo = RandomGridNo(); - } + // ATE: Use insertion gridno if not nowhere and insertion is gridno + if ( Menptr[ uiMercId ].ubStrategicInsertionCode == INSERTION_CODE_GRIDNO && Menptr[ uiMercId ].usStrategicInsertionData != NOWHERE ) + { + sGridNo = Menptr[ uiMercId ].usStrategicInsertionData; } - else - { - // ATE: Mercs can have a gridno of NOWHERE..... - sGridNo = Menptr[ uiMercId ].sGridNo; + else + { + // Set flag for item... + sGridNo = RandomGridNo(); + } + } + else + { + // ATE: Mercs can have a gridno of NOWHERE..... + sGridNo = Menptr[ uiMercId ].sGridNo; - if ( sGridNo == NOWHERE ) - { - sGridNo = RandomGridNo(); + if ( sGridNo == NOWHERE ) + { + sGridNo = RandomGridNo(); sTempGridNo = FindNearestAvailableGridNoForItem( sGridNo, 5 ); if( sTempGridNo == NOWHERE ) sTempGridNo = FindNearestAvailableGridNoForItem( sGridNo, 15 ); - if ( sTempGridNo != NOWHERE ) - { - sGridNo = sTempGridNo; - } - } - } - - for( iCounter = 0; iCounter < NUM_INV_SLOTS; iCounter++ ) - { - // slot found, - // check if actual item - if( Menptr[ uiMercId ].inv[ iCounter ].ubNumberOfObjects > 0 ) + if ( sTempGridNo != NOWHERE ) { - if( Menptr[ uiMercId ].sSectorX != gWorldSectorX || Menptr[ uiMercId ].sSectorY != gWorldSectorY || Menptr[ uiMercId ].bSectorZ != gbWorldSectorZ ) - { - // Set flag for item... - AddItemsToUnLoadedSector( Menptr[ uiMercId ].sSectorX, Menptr[ uiMercId ].sSectorY, Menptr[ uiMercId ].bSectorZ , sGridNo, 1, &( Menptr[ uiMercId ].inv[ iCounter ]) , Menptr[ uiMercId ].bLevel, WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO | WORLD_ITEM_REACHABLE, 0, 1, FALSE ); - } + sGridNo = sTempGridNo; + } + } + } + + for( UINT32 iCounter = 0; iCounter < Menptr[ uiMercId ].inv.size(); iCounter++ ) + { + // slot found, + // check if actual item + if( Menptr[ uiMercId ].inv[ iCounter ].exists() == true ) + { + if( Menptr[ uiMercId ].sSectorX != gWorldSectorX || Menptr[ uiMercId ].sSectorY != gWorldSectorY || Menptr[ uiMercId ].bSectorZ != gbWorldSectorZ ) + { + // Set flag for item... + AddItemsToUnLoadedSector( Menptr[ uiMercId ].sSectorX, Menptr[ uiMercId ].sSectorY, Menptr[ uiMercId ].bSectorZ , sGridNo, 1, &( Menptr[ uiMercId ].inv[ iCounter ]) , Menptr[ uiMercId ].pathing.bLevel, WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO | WORLD_ITEM_REACHABLE, 0, 1, FALSE ); + } else { - AddItemToPool( sGridNo, &( Menptr[ uiMercId ].inv[ iCounter ] ) , 1, Menptr[ uiMercId ].bLevel, WORLD_ITEM_REACHABLE, 0 ); + AddItemToPool( sGridNo, &( Menptr[ uiMercId ].inv[ iCounter ] ) , 1, Menptr[ uiMercId ].pathing.bLevel, WORLD_ITEM_REACHABLE, 0 ); } } } - DropKeysInKeyRing( MercPtrs[ uiMercId ], sGridNo, MercPtrs[ uiMercId ]->bLevel, 1, FALSE, 0, FALSE ); + DropKeysInKeyRing( MercPtrs[ uiMercId ], sGridNo, MercPtrs[ uiMercId ]->pathing.bLevel, 1, FALSE, 0, FALSE ); } @@ -1599,16 +1605,16 @@ void HandleEquipmentLeftInOmerta( UINT32 uiSlotIndex ) while( pItem ) { - if( gWorldSectorX != OMERTA_LEAVE_EQUIP_SECTOR_X || gWorldSectorY != OMERTA_LEAVE_EQUIP_SECTOR_Y || gbWorldSectorZ != OMERTA_LEAVE_EQUIP_SECTOR_Z ) + if( gWorldSectorX != OMERTA_LEAVE_EQUIP_SECTOR_X || gWorldSectorY != OMERTA_LEAVE_EQUIP_SECTOR_Y || gbWorldSectorZ != OMERTA_LEAVE_EQUIP_SECTOR_Z ) { // given this slot value, add to sector item list - AddItemsToUnLoadedSector( OMERTA_LEAVE_EQUIP_SECTOR_X, OMERTA_LEAVE_EQUIP_SECTOR_Y, OMERTA_LEAVE_EQUIP_SECTOR_Z, OMERTA_LEAVE_EQUIP_GRIDNO, 1, &( pItem -> o ) , 0, WORLD_ITEM_REACHABLE, 0, 1, FALSE ); + AddItemsToUnLoadedSector( OMERTA_LEAVE_EQUIP_SECTOR_X, OMERTA_LEAVE_EQUIP_SECTOR_Y, OMERTA_LEAVE_EQUIP_SECTOR_Z, OMERTA_LEAVE_EQUIP_GRIDNO, 1, &( pItem->object ) , 0, WORLD_ITEM_REACHABLE, 0, 1, FALSE ); } else { - AddItemToPool( OMERTA_LEAVE_EQUIP_GRIDNO, &( pItem->o ), 1, 0, WORLD_ITEM_REACHABLE, 0 ); + AddItemToPool( OMERTA_LEAVE_EQUIP_GRIDNO, &( pItem->object ), 1, 0, WORLD_ITEM_REACHABLE, 0 ); } - pItem = pItem -> pNext; + pItem = pItem->pNext; } FreeLeaveListSlot( uiSlotIndex ); @@ -1642,14 +1648,14 @@ void HandleEquipmentLeftInDrassen( UINT32 uiSlotIndex ) while( pItem ) { - if( gWorldSectorX != BOBBYR_SHIPPING_DEST_SECTOR_X || gWorldSectorY != BOBBYR_SHIPPING_DEST_SECTOR_Y || gbWorldSectorZ != BOBBYR_SHIPPING_DEST_SECTOR_Z ) + if( gWorldSectorX != BOBBYR_SHIPPING_DEST_SECTOR_X || gWorldSectorY != BOBBYR_SHIPPING_DEST_SECTOR_Y || gbWorldSectorZ != BOBBYR_SHIPPING_DEST_SECTOR_Z ) { // given this slot value, add to sector item list - AddItemsToUnLoadedSector( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, 10433, 1, &( pItem -> o ) , 0, WORLD_ITEM_REACHABLE, 0, 1, FALSE ); + AddItemsToUnLoadedSector( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, 10433, 1, &( pItem->object ) , 0, WORLD_ITEM_REACHABLE, 0, 1, FALSE ); } else { - AddItemToPool( 10433, &( pItem->o ), 1, 0, WORLD_ITEM_REACHABLE, 0 ); + AddItemToPool( 10433, &( pItem->object ), 1, 0, WORLD_ITEM_REACHABLE, 0 ); } pItem = pItem->pNext; } @@ -1686,24 +1692,24 @@ void ShutDownLeaveList( void ) } -BOOLEAN AddItemToLeaveIndex( OBJECTTYPE *o, UINT32 uiSlotIndex ) +BOOLEAN AddItemToLeaveIndex( OBJECTTYPE *object, UINT32 uiSlotIndex ) { MERC_LEAVE_ITEM *pItem, *pCurrentItem; Assert( uiSlotIndex < NUM_LEAVE_LIST_SLOTS ); - if( o == NULL ) + if( object == NULL ) { return( FALSE ); } // allocate space - pItem = (MERC_LEAVE_ITEM *) MemAlloc( sizeof( MERC_LEAVE_ITEM ) ); + pItem = new MERC_LEAVE_ITEM; // copy object - memcpy( &( pItem->o ), o, sizeof( OBJECTTYPE ) ); - + pItem->object = *object; + // nobody afterwards pItem->pNext = NULL; @@ -1717,9 +1723,9 @@ BOOLEAN AddItemToLeaveIndex( OBJECTTYPE *o, UINT32 uiSlotIndex ) } // move through list - while( pCurrentItem ->pNext ) + while( pCurrentItem->pNext ) { - pCurrentItem = pCurrentItem->pNext; + pCurrentItem = pCurrentItem->pNext; } // found @@ -1771,7 +1777,6 @@ INT32 SetUpDropItemListForMerc( UINT32 uiMercId ) { // will set up a drop list for this grunt, remove items from inventory, and profile INT32 iSlotIndex = -1; - INT32 iCounter = 0; iSlotIndex = FindFreeSlotInLeaveList( ); if( iSlotIndex == -1 ) @@ -1779,11 +1784,11 @@ INT32 SetUpDropItemListForMerc( UINT32 uiMercId ) return( -1 ); } - for( iCounter = 0; iCounter < NUM_INV_SLOTS; iCounter++ ) + for( UINT32 iCounter = 0; iCounter < Menptr[ uiMercId ].inv.size(); iCounter++ ) { // slot found, // check if actual item - if( Menptr[ uiMercId ].inv[ iCounter ].ubNumberOfObjects > 0 ) + if( Menptr[ uiMercId ].inv[ iCounter ].exists() == true ) { // make a linked list of the items left behind, with the ptr to its head in this free slot AddItemToLeaveIndex( &( Menptr[ uiMercId ].inv[ iCounter ] ), iSlotIndex ); @@ -1793,15 +1798,11 @@ INT32 SetUpDropItemListForMerc( UINT32 uiMercId ) } } - // ATE: Added this to drop keyring keys - the 2nd last paramter says to add it to a leave list... - // the gridno, level and visiblity are ignored - DropKeysInKeyRing( MercPtrs[ uiMercId ], NOWHERE, 0, 0, TRUE, iSlotIndex, FALSE ); + // ATE: Added this to drop keyring keys - the 2nd last paramter says to add it to a leave list... + // the gridno, level and visiblity are ignored + DropKeysInKeyRing( MercPtrs[ uiMercId ], NOWHERE, 0, 0, TRUE, iSlotIndex, FALSE ); // zero out profiles - // WDS - Clean up inventory handling - //memset( ( gMercProfiles[ Menptr[ uiMercId ].ubProfile ].bInvStatus ), 0, sizeof( UINT8 ) * 19 ); - //memset( ( gMercProfiles[ Menptr[ uiMercId ].ubProfile ].bInvNumber ), 0, sizeof( UINT8 ) * 19 ); - //memset( ( gMercProfiles[ Menptr[ uiMercId ].ubProfile ].inv ), 0, sizeof( UINT16 ) * 19 ); gMercProfiles[ Menptr[ uiMercId ].ubProfile ].clearInventory(); return( iSlotIndex ); @@ -1835,16 +1836,16 @@ BOOLEAN RemoveItemFromLeaveIndex( MERC_LEAVE_ITEM *pItem, UINT32 uiSlotIndex ) //ARM: THIS DOESN'T MAKE SENSE, pCurrentItem is always NULL at this stage! if( pItem == pCurrentItem ) { - gpLeaveListHead[ uiSlotIndex ] = pCurrentItem ->pNext; + gpLeaveListHead[ uiSlotIndex ] = pCurrentItem->pNext; MemFree( pItem ); pItem = NULL; return( TRUE ); } // in the body - while( ( pCurrentItem->pNext != pItem ) && ( pCurrentItem -> pNext != NULL ) ) + while( ( pCurrentItem->pNext != pItem ) && ( pCurrentItem->pNext != NULL ) ) { - pCurrentItem = pCurrentItem -> pNext; + pCurrentItem = pCurrentItem->pNext; } // item not found @@ -1855,7 +1856,7 @@ BOOLEAN RemoveItemFromLeaveIndex( MERC_LEAVE_ITEM *pItem, UINT32 uiSlotIndex ) // set to next after next pCurrentItem->pNext = pCurrentItem->pNext->pNext; - + // free space and null ptr MemFree( pItem ); pItem = NULL; @@ -1890,7 +1891,7 @@ void HandleMapScreenUpArrow( void ) { if( GetBoxShadeFlag( ghAssignmentBox, iValue ) == FALSE ) { - if( iHighLine == 0) + if( iHighLine == 0) { iHighLine = ( INT32 )GetNumberOfLinesOfTextInBox( ghAssignmentBox ); } @@ -1902,7 +1903,7 @@ void HandleMapScreenUpArrow( void ) } else { - if( ( giHighLine == 0 ) || ( giHighLine == -1 ) ) + if( ( giHighLine == 0 ) || ( giHighLine == -1 ) ) { giHighLine = GetNumberOfCharactersOnPlayersTeam( ) - 1; fTeamPanelDirty = TRUE; @@ -1912,7 +1913,7 @@ void HandleMapScreenUpArrow( void ) giHighLine--; fTeamPanelDirty = TRUE; } - + } } @@ -1952,7 +1953,7 @@ void HandleMapScreenDownArrow( void ) } else { - if( ( giHighLine == GetNumberOfCharactersOnPlayersTeam( ) - 1 ) || ( giHighLine == -1 ) ) + if( ( giHighLine == GetNumberOfCharactersOnPlayersTeam( ) - 1 ) || ( giHighLine == -1 ) ) { giHighLine = 0; fTeamPanelDirty = TRUE; @@ -1962,7 +1963,7 @@ void HandleMapScreenDownArrow( void ) giHighLine++; fTeamPanelDirty = TRUE; } - + } } @@ -1990,7 +1991,7 @@ void CreateMapStatusBarsRegion( void ) // create the status region over the bSelectedCharacter info region, to get quick rundown of merc's status MSYS_DefineRegion( &gMapStatusBarsRegion, BAR_INFO_X - 3, BAR_INFO_Y - 42,(INT16)( BAR_INFO_X + 17), (INT16)(BAR_INFO_Y ), MSYS_PRIORITY_HIGH + 5, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); - + return; } @@ -2019,19 +2020,19 @@ void UpdateCharRegionHelpText( void ) // health/energy/morale if( pSoldier->bAssignment != ASSIGNMENT_POW ) { - if ( pSoldier->bLife != 0 ) + if ( pSoldier->stats.bLife != 0 ) { if ( AM_A_ROBOT( MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ] ) ) { // robot (condition only) swprintf( sString, L"%s: %d/%d", - pMapScreenStatusStrings[ 3 ], pSoldier->bLife, pSoldier->bLifeMax ); + pMapScreenStatusStrings[ 3 ], pSoldier->stats.bLife, pSoldier->stats.bLifeMax ); } - else if ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].uiStatusFlags & SOLDIER_VEHICLE ) + else if ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].flags.uiStatusFlags & SOLDIER_VEHICLE ) { // vehicle (condition/fuel) swprintf( sString, L"%s: %d/%d, %s: %d/%d", - pMapScreenStatusStrings[ 3 ], pSoldier->bLife, pSoldier->bLifeMax, + pMapScreenStatusStrings[ 3 ], pSoldier->stats.bLife, pSoldier->stats.bLifeMax, pMapScreenStatusStrings[ 4 ], pSoldier->bBreath, pSoldier->bBreathMax ); } else @@ -2039,7 +2040,7 @@ void UpdateCharRegionHelpText( void ) // person (health/energy/morale) GetMoraleString( pSoldier, pMoraleStr ); swprintf( sString, L"%s: %d/%d, %s: %d/%d, %s: %s", - pMapScreenStatusStrings[ 0 ], pSoldier->bLife, pSoldier->bLifeMax, + pMapScreenStatusStrings[ 0 ], pSoldier->stats.bLife, pSoldier->stats.bLifeMax, pMapScreenStatusStrings[ 1 ], pSoldier->bBreath, pSoldier->bBreathMax, pMapScreenStatusStrings[ 2 ], pMoraleStr ); } @@ -2105,8 +2106,8 @@ void FindAndSetThisContractSoldier( SOLDIERTYPE *pSoldier ) INT32 iCounter = 0; fShowContractMenu = FALSE; - - for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ ) + + for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ ) { if( gCharactersList[ iCounter].fValid == TRUE ) { @@ -2114,8 +2115,8 @@ void FindAndSetThisContractSoldier( SOLDIERTYPE *pSoldier ) { ChangeSelectedInfoChar( ( INT8 )iCounter, TRUE ); bSelectedContractChar = ( INT8 )iCounter; - fShowContractMenu = TRUE; - + fShowContractMenu = TRUE; + // create RebuildContractBoxForMerc( pSoldier ); @@ -2144,7 +2145,7 @@ void UpdateMapScreenAssignmentPositions( void ) { // set the position of the pop up boxes SGPPoint pPoint; - + if( guiCurrentScreen != MAP_SCREEN ) { @@ -2185,8 +2186,8 @@ void UpdateMapScreenAssignmentPositions( void ) */ } - - + + AssignmentPosition.iY = giBoxY; AttributePosition.iY = TrainPosition.iY = AssignmentPosition.iY + ( GetFontHeight( MAP_SCREEN_FONT ) + 2 )* ASSIGN_MENU_TRAIN; @@ -2225,7 +2226,7 @@ void UpdateMapScreenAssignmentPositions( void ) } - + return; } @@ -2267,7 +2268,7 @@ void UpdateMapScreenMilitiaControlPositions( void ) { giBoxY = ( Y_START + ( bSelectedAssignChar ) * ( Y_SIZE + 2 ) ); } - + MilitiaControlPosition.iY = giBoxY; //TalkToAllPosition.iY = MilitiaControlPosition.iY + ( GetFontHeight( MAP_SCREEN_FONT ) + 2 )* MILCON_MENU_ALL; @@ -2314,8 +2315,8 @@ void RandomMercInGroupSaysQuote( GROUP *pGroup, UINT16 usQuoteNum ) pSoldier = pPlayer->pSoldier; Assert( pSoldier ); - if ( pSoldier->bLife >= OKLIFE && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && - !AM_A_ROBOT( pSoldier ) && !AM_AN_EPC( pSoldier ) && !pSoldier->fMercAsleep ) + if ( pSoldier->stats.bLife >= OKLIFE && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && + !AM_A_ROBOT( pSoldier ) && !AM_AN_EPC( pSoldier ) && !pSoldier->flags.fMercAsleep ) { ubMercsInGroup[ ubNumMercs ] = pSoldier->ubID; ubNumMercs++; @@ -2419,13 +2420,13 @@ BOOLEAN MapscreenCanPassItemToCharNum( INT32 iNewCharSlot ) { // disallow passing items to anyone not in that sector if ( pNewSoldier->sSectorX != sSelMapX || - pNewSoldier->sSectorY != sSelMapY || - pNewSoldier->bSectorZ != ( INT8 )( iCurrentMapSectorZ ) ) + pNewSoldier->sSectorY != sSelMapY || + pNewSoldier->bSectorZ != ( INT8 )( iCurrentMapSectorZ ) ) { return( FALSE ); } - if ( pNewSoldier->fBetweenSectors ) + if ( pNewSoldier->flags.fBetweenSectors ) { return( FALSE ); } @@ -2456,17 +2457,17 @@ BOOLEAN MapscreenCanPassItemToCharNum( INT32 iNewCharSlot ) { // disallow passing items to a merc not in the same sector if ( pNewSoldier->sSectorX != pOldSoldier->sSectorX || - pNewSoldier->sSectorY != pOldSoldier->sSectorY || - pNewSoldier->bSectorZ != pOldSoldier->bSectorZ ) + pNewSoldier->sSectorY != pOldSoldier->sSectorY || + pNewSoldier->bSectorZ != pOldSoldier->bSectorZ ) { return( FALSE ); } // if on the road - if ( pNewSoldier->fBetweenSectors ) + if ( pNewSoldier->flags.fBetweenSectors ) { // other guy must also be on the road... - if ( !pOldSoldier->fBetweenSectors ) + if ( !pOldSoldier->flags.fBetweenSectors ) { return( FALSE ); } @@ -2621,14 +2622,14 @@ void HandleMinerEvent( UINT8 bMinerNumber, INT16 sSectorX, INT16 sSectorY, INT16 fMapPanelDirty = TRUE; // post dialogue events for miners to say this quote and flash the sector where his mine is - CharacterDialogueWithSpecialEvent( ( UINT8 )uiExternalFaceProfileIds[ bMinerNumber ], sQuoteNumber, bMinerNumber , DIALOGUE_EXTERNAL_NPC_UI , FALSE , FALSE , DIALOGUE_SPECIAL_EVENT_MINESECTOREVENT, START_RED_SECTOR_LOCATOR, 1 ); - CharacterDialogue( ( UINT8 )uiExternalFaceProfileIds[ bMinerNumber ], sQuoteNumber, ( UINT8 )( UINT8 )uiExternalStaticNPCFaces[ bMinerNumber ], DIALOGUE_EXTERNAL_NPC_UI, FALSE , FALSE ); - CharacterDialogueWithSpecialEvent( ( UINT8 )uiExternalFaceProfileIds[ bMinerNumber ], sQuoteNumber, bMinerNumber , DIALOGUE_EXTERNAL_NPC_UI , FALSE , FALSE , DIALOGUE_SPECIAL_EVENT_MINESECTOREVENT, STOP_RED_SECTOR_LOCATOR, 1 ); + CharacterDialogueWithSpecialEvent( ( UINT8 )uiExternalFaceProfileIds[ bMinerNumber ], sQuoteNumber, bMinerNumber , DIALOGUE_EXTERNAL_NPC_UI , FALSE , FALSE , DIALOGUE_SPECIAL_EVENT_MINESECTOREVENT, START_RED_SECTOR_LOCATOR, 1 ); + CharacterDialogue( ( UINT8 )uiExternalFaceProfileIds[ bMinerNumber ], sQuoteNumber, ( UINT8 )( UINT8 )uiExternalStaticNPCFaces[ bMinerNumber ], DIALOGUE_EXTERNAL_NPC_UI, FALSE , FALSE ); + CharacterDialogueWithSpecialEvent( ( UINT8 )uiExternalFaceProfileIds[ bMinerNumber ], sQuoteNumber, bMinerNumber , DIALOGUE_EXTERNAL_NPC_UI , FALSE , FALSE , DIALOGUE_SPECIAL_EVENT_MINESECTOREVENT, STOP_RED_SECTOR_LOCATOR, 1 ); } else // stay in tactical { // no need to to highlight mine sector - CharacterDialogue( ( UINT8 )uiExternalFaceProfileIds[ bMinerNumber ], sQuoteNumber, ( UINT8 )( UINT8 )uiExternalStaticNPCFaces[ bMinerNumber ], DIALOGUE_EXTERNAL_NPC_UI, FALSE , FALSE ); + CharacterDialogue( ( UINT8 )uiExternalFaceProfileIds[ bMinerNumber ], sQuoteNumber, ( UINT8 )( UINT8 )uiExternalStaticNPCFaces[ bMinerNumber ], DIALOGUE_EXTERNAL_NPC_UI, FALSE , FALSE ); } } @@ -2718,7 +2719,7 @@ void HandleShowingOfTacticalInterfaceFastHelpText( void ) fTextActive = TRUE; } - else if( ( fInterfaceFastHelpTextActive == FALSE ) && ( fTextActive ) ) + else if( ( fInterfaceFastHelpTextActive == FALSE ) && ( fTextActive ) ) { fTextActive = FALSE; UnPauseGame(); @@ -2739,7 +2740,7 @@ void StartShowingInterfaceFastHelpText( void ) // stop showing interface fast help text void StopShowingInterfaceFastHelpText( void ) -{ +{ fInterfaceFastHelpTextActive = FALSE; } @@ -2770,14 +2771,13 @@ void DisplayUserDefineHelpTextRegions( FASTHELPREGION *pRegion ) { UINT16 usFillColor; INT32 iX,iY,iW,iH; - INT32 iNumberOfLines = 1; UINT8 *pDestBuf; UINT32 uiDestPitchBYTES; // grab the color for the background region usFillColor = Get16BPPColor(FROMRGB(250, 240, 188)); - + iX = pRegion->iX; iY = pRegion->iY; @@ -2797,7 +2797,7 @@ void DisplayUserDefineHelpTextRegions( FASTHELPREGION *pRegion ) iX = (SCREEN_WIDTH - iW - 4); // what about the y value? - iY = (INT32)pRegion->iY - ( iH * 3 / 4); + iY = (INT32)pRegion->iY - ( iH * 3 / 4); // not far enough if (iY < 0) @@ -2826,7 +2826,7 @@ void DisplayUserDefineHelpTextRegions( FASTHELPREGION *pRegion ) iHeightOfInitFastHelpText = iH + 20; - InvalidateRegion( iX, iY, (iX + iW) , (iY + iH + 20 ) ); + InvalidateRegion( iX, iY, (iX + iW) , (iY + iH + 20 ) ); } @@ -2841,14 +2841,13 @@ void DisplaySoldierToolTip( FASTHELPREGION *pRegion ) { UINT16 usFillColor; INT32 iX,iY,iW,iH; - INT32 iNumberOfLines = 1; UINT8 *pDestBuf; UINT32 uiDestPitchBYTES; // grab the color for the background region usFillColor = Get16BPPColor(FROMRGB(250, 240, 188)); - + iX = pRegion->iX; iY = pRegion->iY; @@ -2871,7 +2870,7 @@ void DisplaySoldierToolTip( FASTHELPREGION *pRegion ) iX = (SCREEN_WIDTH - iW - 4); // what about the y value? - iY = (INT32)pRegion->iY - ( iH * 3 / 4); + iY = (INT32)pRegion->iY - ( iH * 3 / 4); // not far enough if (iY < 0) @@ -2897,12 +2896,12 @@ void DisplaySoldierToolTip( FASTHELPREGION *pRegion ) SetFontForeground( FONT_BEIGE ); //iH = ( INT32 )DisplayWrappedString( ( INT16 )( iX + 10 ), ( INT16 )( iY + 6 ), ( INT16 )pRegion->iW, 0, FONT10ARIAL, FONT_BEIGE, pRegion->FastHelpText, FONT_NEARBLACK, TRUE, 0 ); - + DisplayHelpTokenizedString( pRegion->FastHelpText ,( INT16 )( iX + 5 ), ( INT16 )( iY + 5 ) ); - + iHeightOfInitFastHelpText = iH + 20; - InvalidateRegion( iX, iY, (iX + iW) , (iY + iH + 20 ) ); + InvalidateRegion( iX, iY, (iX + iW) , (iY + iH + 20 ) ); } @@ -2913,7 +2912,7 @@ void DisplaySoldierToolTip( FASTHELPREGION *pRegion ) -void DisplayFastHelpForInitialTripInToMapScreen( FASTHELPREGION *pRegion ) +void DisplayFastHelpForInitialTripInToMapScreen( FASTHELPREGION *pRegion ) { if( gTacticalStatus.fDidGameJustStart ) { @@ -2941,9 +2940,9 @@ void DisplayFastHelpForInitialTripInToMapScreen( FASTHELPREGION *pRegion ) void DisplayMapScreenFastHelpList( void ) { INT32 iCounter = 0; - + DisplayFastHelpForInitialTripInToMapScreen( &pFastHelpMapScreenList[ iCounter ] ); - + return; } @@ -2997,17 +2996,17 @@ void SetUpShutDownMapScreenHelpTextScreenMask( void ) { if( gTacticalStatus.fDidGameJustStart ) { - MSYS_DefineRegion( &gMapScreenHelpTextMask , ( INT16 )( pMapScreenFastHelpLocationList[ 9 ].iX ), ( INT16 )( pMapScreenFastHelpLocationList[ 9 ].iY ), ( INT16 )( pMapScreenFastHelpLocationList[ 9 ].iX + pMapScreenFastHelpWidthList[ 9 ] ), ( INT16 )( pMapScreenFastHelpLocationList[ 9 ].iY + iHeightOfInitFastHelpText ), MSYS_PRIORITY_HIGHEST, + MSYS_DefineRegion( &gMapScreenHelpTextMask , ( INT16 )( pMapScreenFastHelpLocationList[ 9 ].iX ), ( INT16 )( pMapScreenFastHelpLocationList[ 9 ].iY ), ( INT16 )( pMapScreenFastHelpLocationList[ 9 ].iX + pMapScreenFastHelpWidthList[ 9 ] ), ( INT16 )( pMapScreenFastHelpLocationList[ 9 ].iY + iHeightOfInitFastHelpText ), MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MapScreenHelpTextScreenMaskBtnCallback ); } else { - MSYS_DefineRegion( &gMapScreenHelpTextMask , 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST, + MSYS_DefineRegion( &gMapScreenHelpTextMask , 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MapScreenHelpTextScreenMaskBtnCallback ); } fCreated = TRUE; - + } else if( ( fShowMapScreenHelpText == FALSE ) && ( fInterfaceFastHelpTextActive == FALSE ) && ( fCreated == TRUE ) ) { @@ -3149,7 +3148,7 @@ void SelectSquadForMovement( INT32 iSquadNumber ) if ( pSoldier && pSoldier->bActive ) { - // is he able & allowed to move? (Report only the first reason for failure encountered) + // is he able & allowed to move? (Report only the first reason for failure encountered) if ( CanMoveBoxSoldierMoveStrategically( pSoldier, fFirstFailure ) ) { SelectSoldierForMovement( pSoldier ); @@ -3161,7 +3160,7 @@ void SelectSquadForMovement( INT32 iSquadNumber ) } } } - + if ( !fSomeCantMove ) { fSquadIsMoving[ iCounter ] = TRUE; @@ -3206,7 +3205,7 @@ void DeselectSquadForMovement( INT32 iSquadNumber ) BOOLEAN AllSoldiersInSquadSelected( INT32 iSquadNumber ) { - INT32 iCounter = 0, iCount = 0; + INT32 iCounter = 0; // is everyone on this squad moving? for( iCounter = 0; iCounter < giNumberOfSoldiersInSectorMoving; iCounter++ ) @@ -3318,8 +3317,8 @@ INT32 HowManyMovingSoldiersInVehicle( INT32 iVehicleId ) for( iCounter = 0; iCounter < giNumberOfSoldiersInSectorMoving; iCounter++ ) { - // is he in the right vehicle - if( ( pSoldierMovingList[ iCounter ] ->bAssignment == VEHICLE )&&( pSoldierMovingList[ iCounter ] ->iVehicleId == iVehicleId ) ) + // is he in the right vehicle + if( ( pSoldierMovingList[ iCounter ]->bAssignment == VEHICLE )&&( pSoldierMovingList[ iCounter ]->iVehicleId == iVehicleId ) ) { // if he moving? if ( fSoldierIsMoving[ iCounter ] ) @@ -3340,7 +3339,7 @@ INT32 HowManyMovingSoldiersInSquad( INT32 iSquadNumber ) for( iCounter = 0; iCounter < giNumberOfSoldiersInSectorMoving; iCounter++ ) { // is he in the right squad - if( pSoldierMovingList[ iCounter ] ->bAssignment == iSquadNumber ) + if( pSoldierMovingList[ iCounter ]->bAssignment == iSquadNumber ) { // if he moving? if ( fSoldierIsMoving[ iCounter ] ) @@ -3452,7 +3451,7 @@ void InitializeMovingLists( void ) giNumberOfSoldiersInSectorMoving = 0; - giNumberOfSquadsInSectorMoving = 0; + giNumberOfSquadsInSectorMoving = 0; giNumberOfVehiclesInSectorMoving = 0; // init the soldiers @@ -3484,7 +3483,7 @@ void InitializeMovingLists( void ) } return; -} +} @@ -3542,7 +3541,7 @@ void CreateDestroyMovementBox( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) CreatePopUpBoxForMovementBox( ); BuildMouseRegionsForMoveBox( ); CreateScreenMaskForMoveBox( ); - fMapPanelDirty = TRUE; + fMapPanelDirty = TRUE; } else if( ( fShowMapScreenMovementList == FALSE ) && ( fCreated == TRUE ) ) { @@ -3553,7 +3552,7 @@ void CreateDestroyMovementBox( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) RemoveBox( ghMoveBox ); ghMoveBox = -1; RemoveScreenMaskForMoveBox( ); - fMapPanelDirty = TRUE; + fMapPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; // really long move boxes can overlap bottom panel } @@ -3587,7 +3586,7 @@ void SetUpMovingListsForSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) ( pSoldier->bAssignment != IN_TRANSIT ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) && ( pSoldier->sSectorX == sSectorX ) && ( pSoldier->sSectorY == sSectorY ) && ( pSoldier->bSectorZ == sSectorZ ) ) { - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // vehicle // if it can move (can't be empty) @@ -3600,13 +3599,13 @@ void SetUpMovingListsForSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) else // soldier { // alive, not aboard Skyrider (airborne or not!) - if ( ( pSoldier->bLife >= OKLIFE ) && - ( ( pSoldier->bAssignment != VEHICLE ) || ( pSoldier->iVehicleId != iHelicopterVehicleId ) ) ) + if ( ( pSoldier->stats.bLife >= OKLIFE ) && + ( ( pSoldier->bAssignment != VEHICLE ) || ( pSoldier->iVehicleId != iHelicopterVehicleId ) ) ) { // add soldier AddSoldierToMovingLists( pSoldier ); - // if on a squad, + // if on a squad, if ( pSoldier->bAssignment < ON_DUTY ) { // add squad (duplicates ok, they're ignored inside the function) @@ -3630,10 +3629,10 @@ void CreatePopUpBoxForMovementBox( void ) SGPRect Dimensions; // create the pop up box and mouse regions for movement list - + // create basic box CreatePopUpBox(&ghMoveBox, AssignmentDimensions, MovePosition, (POPUP_BOX_FLAG_CLIP_TEXT|POPUP_BOX_FLAG_RESIZE )); - + // which buffer will box render to SetBoxBuffer(ghMoveBox, FRAME_BUFFER); @@ -3742,21 +3741,21 @@ void AddStringsToMoveBox( void ) { swprintf( sString, L"%s", pSquadMenuStrings[iSquadMovingList[ iCount ] ] ); } - AddMonoString(&hStringHandle, sString ); + AddMonoString(&hStringHandle, sString ); // now add all the grunts in it for( iCountB = 0; iCountB < giNumberOfSoldiersInSectorMoving; iCountB++ ) { - if( pSoldierMovingList[ iCountB ] -> bAssignment == iSquadMovingList[ iCount ] ) + if( pSoldierMovingList[ iCountB ]->bAssignment == iSquadMovingList[ iCount ] ) { // add mercs in squads if( IsSoldierSelectedForMovement( pSoldierMovingList[ iCountB ] ) == TRUE ) { - swprintf( sString, L" *%s*", pSoldierMovingList[ iCountB ]->name ); + swprintf( sString, L" *%s*", pSoldierMovingList[ iCountB ]->name ); } else { - swprintf( sString, L" %s", pSoldierMovingList[ iCountB ]->name ); + swprintf( sString, L" %s", pSoldierMovingList[ iCountB ]->name ); } AddMonoString(&hStringHandle, sString ); } @@ -3774,23 +3773,23 @@ void AddStringsToMoveBox( void ) } else { - swprintf( sString, L"%s", pVehicleStrings[ pVehicleList[ iVehicleMovingList[ iCount ] ].ubVehicleType ] ); + swprintf( sString, L"%s", pVehicleStrings[ pVehicleList[ iVehicleMovingList[ iCount ] ].ubVehicleType ] ); } - AddMonoString(&hStringHandle, sString ); + AddMonoString(&hStringHandle, sString ); // now add all the grunts in it for( iCountB = 0; iCountB < giNumberOfSoldiersInSectorMoving; iCountB++ ) { - if( ( pSoldierMovingList[ iCountB ] -> bAssignment == VEHICLE ) &&( pSoldierMovingList[ iCountB ] -> iVehicleId == iVehicleMovingList[ iCount ] ) ) + if( ( pSoldierMovingList[ iCountB ]->bAssignment == VEHICLE ) &&( pSoldierMovingList[ iCountB ]->iVehicleId == iVehicleMovingList[ iCount ] ) ) { // add mercs in vehicles if( IsSoldierSelectedForMovement( pSoldierMovingList[ iCountB ] ) == TRUE ) { - swprintf( sString, L" *%s*", pSoldierMovingList[ iCountB ]->name ); + swprintf( sString, L" *%s*", pSoldierMovingList[ iCountB ]->name ); } else { - swprintf( sString, L" %s", pSoldierMovingList[ iCountB ]->name ); + swprintf( sString, L" %s", pSoldierMovingList[ iCountB ]->name ); } AddMonoString(&hStringHandle, sString ); } @@ -3825,11 +3824,11 @@ void AddStringsToMoveBox( void ) // add OTHER soldiers (not on duty nor in a vehicle) if( IsSoldierSelectedForMovement( pSoldierMovingList[ iCount ] ) == TRUE ) { - swprintf( sString, L" *%s ( %s )*", pSoldierMovingList[ iCount ]->name, pAssignmentStrings[ pSoldierMovingList[ iCount ]->bAssignment ] ); + swprintf( sString, L" *%s ( %s )*", pSoldierMovingList[ iCount ]->name, pAssignmentStrings[ pSoldierMovingList[ iCount ]->bAssignment ] ); } else { - swprintf( sString, L" %s ( %s )", pSoldierMovingList[ iCount ]->name, pAssignmentStrings[ pSoldierMovingList[ iCount ]->bAssignment ] ); + swprintf( sString, L" %s ( %s )", pSoldierMovingList[ iCount ]->name, pAssignmentStrings[ pSoldierMovingList[ iCount ]->bAssignment ] ); } AddMonoString(&hStringHandle, sString ); } @@ -3851,7 +3850,7 @@ void AddStringsToMoveBox( void ) // blank line AddMonoString(&hStringHandle, L"" ); } - + // add cancel line swprintf( sString, L"%s", pMovementMenuStrings[ 2 ] ); @@ -3874,7 +3873,7 @@ void BuildMouseRegionsForMoveBox( void ) // grab height of font - iFontHeight = GetLineSpace( ghMoveBox ) + GetFontHeight( GetBoxFont( ghMoveBox ) ); + iFontHeight = GetLineSpace( ghMoveBox ) + GetFontHeight( GetBoxFont( ghMoveBox ) ); // get x.y position of box GetBoxPosition( ghMoveBox, &pPosition); @@ -3895,12 +3894,12 @@ void BuildMouseRegionsForMoveBox( void ) // box heading MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); iCounter++; // blank line MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); iCounter++; // calc total number of "moving" lines in the box @@ -3916,7 +3915,7 @@ void BuildMouseRegionsForMoveBox( void ) for( iCount = 0; iCount < giNumberOfSquadsInSectorMoving; iCount++ ) { MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); + MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 0, iCounter ); @@ -3926,10 +3925,10 @@ void BuildMouseRegionsForMoveBox( void ) for( iCountB = 0; iCountB < giNumberOfSoldiersInSectorMoving; iCountB++ ) { - if( pSoldierMovingList[ iCountB ] -> bAssignment == iSquadMovingList[ iCount ] ) + if( pSoldierMovingList[ iCountB ]->bAssignment == iSquadMovingList[ iCount ] ) { MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); + MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 0, iCounter ); @@ -3944,7 +3943,7 @@ void BuildMouseRegionsForMoveBox( void ) { // define regions for vehicle lines MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); + MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 0, iCounter ); @@ -3954,10 +3953,10 @@ void BuildMouseRegionsForMoveBox( void ) for( iCountB = 0; iCountB < giNumberOfSoldiersInSectorMoving; iCountB++ ) { - if( ( pSoldierMovingList[ iCountB ] -> bAssignment == VEHICLE ) &&( pSoldierMovingList[ iCountB ] -> iVehicleId == iVehicleMovingList[ iCount ] ) ) + if( ( pSoldierMovingList[ iCountB ]->bAssignment == VEHICLE ) &&( pSoldierMovingList[ iCountB ]->iVehicleId == iVehicleMovingList[ iCount ] ) ) { MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); + MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 0, iCounter ); @@ -3968,7 +3967,7 @@ void BuildMouseRegionsForMoveBox( void ) } } - + // define regions for "other" soldiers for( iCount = 0; iCount < giNumberOfSoldiersInSectorMoving; iCount++ ) { @@ -3979,7 +3978,7 @@ void BuildMouseRegionsForMoveBox( void ) if( !fDefinedOtherRegion ) { MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); + MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 0, iCounter ); @@ -4005,7 +4004,7 @@ void BuildMouseRegionsForMoveBox( void ) // blank line MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); iCounter++; @@ -4013,7 +4012,7 @@ void BuildMouseRegionsForMoveBox( void ) { // DONE line MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); + MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 0, iCounter ); @@ -4025,13 +4024,13 @@ void BuildMouseRegionsForMoveBox( void ) { // blank line MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); iCounter++; } // CANCEL line MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); + MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 0, iCounter ); @@ -4067,7 +4066,7 @@ void MoveMenuMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) if (iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) { // highlight string - HighLightBoxLine( ghMoveBox, iValue ); + HighLightBoxLine( ghMoveBox, iValue ); } else if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { @@ -4086,13 +4085,13 @@ void MoveMenuBtnCallback(MOUSE_REGION * pRegion, INT32 iReason ) iMoveBoxLine = MSYS_GetRegionUserData( pRegion, 0 ); - iRegionType = MSYS_GetRegionUserData( pRegion, 1 ); - iListIndex = MSYS_GetRegionUserData( pRegion, 2 ); - iClickTime = GetJA2Clock(); + iRegionType = MSYS_GetRegionUserData( pRegion, 1 ); + iListIndex = MSYS_GetRegionUserData( pRegion, 2 ); + iClickTime = GetJA2Clock(); - if( ( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP ) ) + if( ( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP ) ) { - if( iClickTime - giDblClickTimersForMoveBoxMouseRegions[ iMoveBoxLine ] < DBL_CLICK_DELAY_FOR_MOVE_MENU ) + if( iClickTime - giDblClickTimersForMoveBoxMouseRegions[ iMoveBoxLine ] < DBL_CLICK_DELAY_FOR_MOVE_MENU ) { // dbl click, and something is selected? if ( IsAnythingSelectedForMoving() ) @@ -4151,7 +4150,7 @@ void MoveMenuBtnCallback(MOUSE_REGION * pRegion, INT32 iReason ) { pSoldier = pSoldierMovingList[ iListIndex ]; - if ( pSoldier->fBetweenSectors ) + if ( pSoldier->flags.fBetweenSectors ) { // we don't allow mercs to change squads or get out of vehicles between sectors, easiest way to handle this // is to prevent any toggling of individual soldiers on the move at the outset. @@ -4200,7 +4199,7 @@ void MoveMenuBtnCallback(MOUSE_REGION * pRegion, INT32 iReason ) } else // currently NOT moving { - // is he able & allowed to move? (Errors with a reason are reported within) + // is he able & allowed to move? (Errors with a reason are reported within) if ( CanMoveBoxSoldierMoveStrategically( pSoldier, TRUE ) ) { // change him to move instead @@ -4243,7 +4242,7 @@ void MoveMenuBtnCallback(MOUSE_REGION * pRegion, INT32 iReason ) AssertMsg( 0, String( "MoveMenuBtnCallback: Invalid regionType %d, moveBoxLine %d", iRegionType, iMoveBoxLine ) ); return; } - + fRebuildMoveBox = TRUE; fTeamPanelDirty = TRUE; fMapPanelDirty = TRUE; @@ -4290,10 +4289,10 @@ void SelectAllOtherSoldiersInList( void ) INT32 iCounter = 0; BOOLEAN fSomeCantMove = FALSE; - + for( iCounter = 0; iCounter < giNumberOfSoldiersInSectorMoving; iCounter++ ) { - if( ( pSoldierMovingList[ iCounter ] ->bAssignment >= ON_DUTY ) && ( pSoldierMovingList[ iCounter ] ->bAssignment != VEHICLE ) ) + if( ( pSoldierMovingList[ iCounter ]->bAssignment >= ON_DUTY ) && ( pSoldierMovingList[ iCounter ]->bAssignment != VEHICLE ) ) { if ( CanMoveBoxSoldierMoveStrategically( pSoldierMovingList[ iCounter ], FALSE ) ) { @@ -4318,10 +4317,10 @@ void SelectAllOtherSoldiersInList( void ) void DeselectAllOtherSoldiersInList( void ) { INT32 iCounter = 0; - + for( iCounter = 0; iCounter < giNumberOfSoldiersInSectorMoving; iCounter++ ) { - if( ( pSoldierMovingList[ iCounter ] ->bAssignment >= ON_DUTY ) && ( pSoldierMovingList[ iCounter ] ->bAssignment != VEHICLE ) ) + if( ( pSoldierMovingList[ iCounter ]->bAssignment >= ON_DUTY ) && ( pSoldierMovingList[ iCounter ]->bAssignment != VEHICLE ) ) { fSoldierIsMoving[ iCounter ] = FALSE; } @@ -4398,7 +4397,7 @@ void HandleMoveoutOfSectorMovementTroops( void ) iSquadNumber = AddCharacterToUniqueSquad( pSoldier ); if ( iSquadNumber != -1 ) { - // It worked. Add his new squad to the "moving squads" list so others can join it, too! + // It worked. Add his new squad to the "moving squads" list so others can join it, too! AddSquadToMovingLists( iSquadNumber ); // If this guy is moving @@ -4446,7 +4445,7 @@ void HandleSettingTheSelectedListOfMercs( void ) { pSoldier = MercPtrs[ gCharactersList[ iCounter ].usSolID ]; - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { fSelected = IsVehicleSelectedForMovement( pSoldier->bVehicleID ); } @@ -4517,7 +4516,7 @@ BOOLEAN AllOtherSoldiersInListAreSelected( void ) for( iCounter = 0; iCounter < giNumberOfSoldiersInSectorMoving; iCounter++ ) { - if( ( pSoldierMovingList[ iCounter ]->bAssignment >= ON_DUTY ) && ( pSoldierMovingList[ iCounter ]->bAssignment >= VEHICLE ) ) + if( ( pSoldierMovingList[ iCounter ]->bAssignment >= ON_DUTY ) && ( pSoldierMovingList[ iCounter ]->bAssignment >= VEHICLE ) ) { if( fSoldierIsMoving[ iCounter ] == FALSE ) { @@ -4610,7 +4609,7 @@ void ReBuildMoveBox( void ) // stop showing the box fShowMapScreenMovementList = FALSE; CreateDestroyMovementBox( sSelMapX, sSelMapY, ( INT16 )iCurrentMapSectorZ ); - + // show the box fShowMapScreenMovementList = TRUE; CreateDestroyMovementBox( sSelMapX, sSelMapY, ( INT16 )iCurrentMapSectorZ ); @@ -4624,9 +4623,9 @@ void CreateScreenMaskForMoveBox( void ) if( fScreenMaskForMoveCreated == FALSE ) { // set up the screen mask - MSYS_DefineRegion( &gMoveBoxScreenMask, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST - 4, + MSYS_DefineRegion( &gMoveBoxScreenMask, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST - 4, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MoveScreenMaskBtnCallback ); - + fScreenMaskForMoveCreated = TRUE; } } @@ -4645,7 +4644,7 @@ void RemoveScreenMaskForMoveBox( void ) void MoveScreenMaskBtnCallback(MOUSE_REGION * pRegion, INT32 iReason ) { // btn callback handler for move box screen mask region - if( ( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP ) ) + if( ( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP ) ) { fShowMapScreenMovementList = FALSE; } @@ -4687,7 +4686,7 @@ void ResetSoldierUpdateBox( void ) pUpdateSoldierBox[ iCounter ] = NULL; } - + return; } @@ -4736,23 +4735,23 @@ void AddSoldierToWaitingListQueue( SOLDIERTYPE *pSoldier ) // get soldier profile iSoldierId = pSoldier->ubID; - SpecialCharacterDialogueEvent( DIALOGUE_ADD_EVENT_FOR_SOLDIER_UPDATE_BOX, UPDATE_BOX_REASON_ADDSOLDIER, iSoldierId, 0, 0, 0 ); + SpecialCharacterDialogueEvent( DIALOGUE_ADD_EVENT_FOR_SOLDIER_UPDATE_BOX, UPDATE_BOX_REASON_ADDSOLDIER, iSoldierId, 0, 0, 0 ); return; } void AddReasonToWaitingListQueue( INT32 iReason ) { - SpecialCharacterDialogueEvent( DIALOGUE_ADD_EVENT_FOR_SOLDIER_UPDATE_BOX, UPDATE_BOX_REASON_SET_REASON, iReason, 0, 0, 0 ); + SpecialCharacterDialogueEvent( DIALOGUE_ADD_EVENT_FOR_SOLDIER_UPDATE_BOX, UPDATE_BOX_REASON_SET_REASON, iReason, 0, 0, 0 ); return; } void AddDisplayBoxToWaitingQueue( void ) { - SpecialCharacterDialogueEvent( DIALOGUE_ADD_EVENT_FOR_SOLDIER_UPDATE_BOX, UPDATE_BOX_REASON_SHOW_BOX, 0, 0, 0, 0 ); + SpecialCharacterDialogueEvent( DIALOGUE_ADD_EVENT_FOR_SOLDIER_UPDATE_BOX, UPDATE_BOX_REASON_SHOW_BOX, 0, 0, 0, 0 ); + - return; } @@ -4768,22 +4767,22 @@ void AddSoldierToUpdateBox( SOLDIERTYPE *pSoldier ) INT32 iCounter = 0; VOBJECT_DESC VObjectDesc; - + // going to load face VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; - - if( pSoldier->bLife == 0 ) + + if( pSoldier->stats.bLife == 0 ) { return; } - if( pSoldier -> bActive == FALSE ) + if( pSoldier->bActive == FALSE ) { return; } - // if update + // if update if( pUpdateSoldierBox[ iCounter ] == NULL ) { sprintf( VObjectDesc.ImageFile, "Interface\\panels.sti" ); @@ -4801,7 +4800,7 @@ void AddSoldierToUpdateBox( SOLDIERTYPE *pSoldier ) { // add to box pUpdateSoldierBox[ iCounter ] = pSoldier; - + if( gMercProfiles[ pSoldier->ubProfile ].ubFaceIndex < 100 ) { // grab filename of face @@ -4815,7 +4814,7 @@ void AddSoldierToUpdateBox( SOLDIERTYPE *pSoldier ) // load the face AddVideoObject( &VObjectDesc, (UINT32 *)&giUpdateSoldierFaces[ iCounter ] ); - + return; } } @@ -4842,18 +4841,14 @@ void DisplaySoldierUpdateBox( ) HVOBJECT hBackGroundHandle; INT32 iCounter = 0; CHAR16 sString[ 32 ]; - INT16 sX = 0, sY = 0; - INT32 iHeightOfString = 0; - INT32 iCounterB = 0; - INT32 iOrigNumberHigh = 0, iOrigY = 0; - INT32 iUpperLimit = 0; - - + INT32 iUpperLimit = 0; + + if( fShowUpdateBox == FALSE ) { return; } - + // get the number of mercs iNumberOfMercsOnUpdatePanel = GetNumberOfMercsInUpdateList( ); @@ -4886,11 +4881,11 @@ void DisplaySoldierUpdateBox( ) } // get number of rows - iNumberHigh = ( fFourWideMode ? iNumberOfMercsOnUpdatePanel / NUMBER_OF_MERC_COLUMNS_FOR_FOUR_WIDE_MODE - : iNumberOfMercsOnUpdatePanel / NUMBER_OF_MERC_COLUMNS_FOR_TWO_WIDE_MODE); + iNumberHigh = ( fFourWideMode ? iNumberOfMercsOnUpdatePanel / NUMBER_OF_MERC_COLUMNS_FOR_FOUR_WIDE_MODE + : iNumberOfMercsOnUpdatePanel / NUMBER_OF_MERC_COLUMNS_FOR_TWO_WIDE_MODE); - //number of columns - iNumberWide = ( fFourWideMode ? NUMBER_OF_MERC_COLUMNS_FOR_FOUR_WIDE_MODE + //number of columns + iNumberWide = ( fFourWideMode ? NUMBER_OF_MERC_COLUMNS_FOR_FOUR_WIDE_MODE : NUMBER_OF_MERC_COLUMNS_FOR_TWO_WIDE_MODE ); @@ -4913,15 +4908,15 @@ void DisplaySoldierUpdateBox( ) } } - // round off - if( fFourWideMode ) + // round off + if( fFourWideMode ) { if(iNumberOfMercsOnUpdatePanel % NUMBER_OF_MERC_COLUMNS_FOR_FOUR_WIDE_MODE ) { iNumberOfMercsOnUpdatePanel += NUMBER_OF_MERC_COLUMNS_FOR_FOUR_WIDE_MODE - ( iNumberOfMercsOnUpdatePanel % NUMBER_OF_MERC_COLUMNS_FOR_FOUR_WIDE_MODE ); } } - else + else { if(iNumberOfMercsOnUpdatePanel % NUMBER_OF_MERC_COLUMNS_FOR_TWO_WIDE_MODE ) { @@ -4942,7 +4937,7 @@ void DisplaySoldierUpdateBox( ) BltVideoObject( guiSAVEBUFFER, hBackGroundHandle, 0, iX-4, iY - 4 , VO_BLT_SRCTRANSPARENCY,NULL ); BltVideoObject( guiSAVEBUFFER, hBackGroundHandle, 2, iX+iUpdatePanelWidth, iY - 4 , VO_BLT_SRCTRANSPARENCY,NULL ); - if( fFourWideMode ) + if( fFourWideMode ) { //Display 2 vertical lines starting at the bottom BltVideoObject( guiSAVEBUFFER , hBackGroundHandle, 3, iX - 4, iY + iUpdatePanelHeight - 3 - 70, VO_BLT_SRCTRANSPARENCY,NULL ); @@ -4955,7 +4950,7 @@ void DisplaySoldierUpdateBox( ) SetFontDestBuffer( guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); - + iUpperLimit = fFourWideMode ? ( iNumberOfMercsOnUpdatePanel + NUMBER_OF_MERC_COLUMNS_FOR_FOUR_WIDE_MODE ) : ( iNumberOfMercsOnUpdatePanel + NUMBER_OF_MERC_COLUMNS_FOR_TWO_WIDE_MODE ); //need to put the background down first @@ -4964,7 +4959,7 @@ void DisplaySoldierUpdateBox( ) // blt the face and name // get the face x and y - iFaceX = iX + ( iCounter % iNumberWide ) * TACT_UPDATE_MERC_FACE_X_WIDTH; + iFaceX = iX + ( iCounter % iNumberWide ) * TACT_UPDATE_MERC_FACE_X_WIDTH; iFaceY = iY + ( iCounter / iNumberWide ) * TACT_UPDATE_MERC_FACE_X_HEIGHT; BltVideoObject( guiSAVEBUFFER , hBackGroundHandle, 20, iFaceX, iFaceY , VO_BLT_SRCTRANSPARENCY,NULL ); @@ -4978,8 +4973,8 @@ void DisplaySoldierUpdateBox( ) // // get the face x and y - iFaceX = iX + ( iCounter % iNumberWide ) * TACT_UPDATE_MERC_FACE_X_WIDTH; - iFaceY = iY + ( iCounter / iNumberWide ) * TACT_UPDATE_MERC_FACE_X_HEIGHT + REASON_FOR_SOLDIER_UPDATE_OFFSET_Y; + iFaceX = iX + ( iCounter % iNumberWide ) * TACT_UPDATE_MERC_FACE_X_WIDTH; + iFaceY = iY + ( iCounter / iNumberWide ) * TACT_UPDATE_MERC_FACE_X_HEIGHT + REASON_FOR_SOLDIER_UPDATE_OFFSET_Y; // now get the face if( pUpdateSoldierBox[ iCounter ] ) @@ -4989,7 +4984,7 @@ void DisplaySoldierUpdateBox( ) // there is a face RenderSoldierSmallFaceForUpdatePanel( iCounter, iFaceX, iFaceY ); - + // display the mercs name swprintf( sString, L"%s", pUpdateSoldierBox[ iCounter ]->name ); DrawTextToScreen( sString, (UINT16)(iFaceX-5), (UINT16)(iFaceY + 31), 57, TINYFONT1, FONT_LTRED, FONT_BLACK, 0, CENTER_JUSTIFIED ); @@ -4997,21 +4992,21 @@ void DisplaySoldierUpdateBox( ) } // the button container box - if( fFourWideMode ) + if( fFourWideMode ) { - //def: 3/1/99 WAS SUBINDEX 6, - BltVideoObject( guiSAVEBUFFER , hBackGroundHandle, 19, iX - 4 + TACT_UPDATE_MERC_FACE_X_WIDTH, iY + iNumberHigh * TACT_UPDATE_MERC_FACE_X_HEIGHT + REASON_FOR_SOLDIER_UPDATE_OFFSET_Y+3, VO_BLT_SRCTRANSPARENCY,NULL ); - + //def: 3/1/99 WAS SUBINDEX 6, + BltVideoObject( guiSAVEBUFFER , hBackGroundHandle, 19, iX - 4 + TACT_UPDATE_MERC_FACE_X_WIDTH, iY + iNumberHigh * TACT_UPDATE_MERC_FACE_X_HEIGHT + REASON_FOR_SOLDIER_UPDATE_OFFSET_Y+3, VO_BLT_SRCTRANSPARENCY,NULL ); + // ATE: Display string for time compression - DisplayWrappedString( ( UINT16 )( iX ), ( UINT16 )( iY + iNumberHigh * TACT_UPDATE_MERC_FACE_X_HEIGHT + 5 + REASON_FOR_SOLDIER_UPDATE_OFFSET_Y + 3), ( UINT16 )( iUpdatePanelWidth ), 0, MAP_SCREEN_FONT, FONT_WHITE, gzLateLocalizedString[49], FONT_BLACK, 0, CENTER_JUSTIFIED ); + DisplayWrappedString( ( UINT16 )( iX ), ( UINT16 )( iY + iNumberHigh * TACT_UPDATE_MERC_FACE_X_HEIGHT + 5 + REASON_FOR_SOLDIER_UPDATE_OFFSET_Y + 3), ( UINT16 )( iUpdatePanelWidth ), 0, MAP_SCREEN_FONT, FONT_WHITE, gzLateLocalizedString[49], FONT_BLACK, 0, CENTER_JUSTIFIED ); } else { - //def: 3/1/99 WAS SUBINDEX 6, + //def: 3/1/99 WAS SUBINDEX 6, BltVideoObject( guiSAVEBUFFER , hBackGroundHandle, 19, iX - 4 , iY + iNumberHigh * TACT_UPDATE_MERC_FACE_X_HEIGHT + REASON_FOR_SOLDIER_UPDATE_OFFSET_Y+3, VO_BLT_SRCTRANSPARENCY,NULL ); // ATE: Display string for time compression - DisplayWrappedString( ( UINT16 )( iX ), ( UINT16 )( iY + iNumberHigh * TACT_UPDATE_MERC_FACE_X_HEIGHT + 5 + REASON_FOR_SOLDIER_UPDATE_OFFSET_Y+3 ), ( UINT16 )( iUpdatePanelWidth ), 0, MAP_SCREEN_FONT, FONT_WHITE, gzLateLocalizedString[49], FONT_BLACK, 0, CENTER_JUSTIFIED ); + DisplayWrappedString( ( UINT16 )( iX ), ( UINT16 )( iY + iNumberHigh * TACT_UPDATE_MERC_FACE_X_HEIGHT + 5 + REASON_FOR_SOLDIER_UPDATE_OFFSET_Y+3 ), ( UINT16 )( iUpdatePanelWidth ), 0, MAP_SCREEN_FONT, FONT_WHITE, gzLateLocalizedString[49], FONT_BLACK, 0, CENTER_JUSTIFIED ); } iCounter = 0; @@ -5034,21 +5029,21 @@ void DisplaySoldierUpdateBox( ) //Display the reason for the update box - if( fFourWideMode ) + if( fFourWideMode ) { - DisplayWrappedString( ( INT16 )( iX ), ( INT16 )( iY + 6 ), (INT16)iUpdatePanelWidth, 0, MAP_SCREEN_FONT, FONT_WHITE, pUpdateMercStrings[ iReasonForSoldierUpDate ], FONT_BLACK, 0, CENTER_JUSTIFIED ); + DisplayWrappedString( ( INT16 )( iX ), ( INT16 )( iY + 6 ), (INT16)iUpdatePanelWidth, 0, MAP_SCREEN_FONT, FONT_WHITE, pUpdateMercStrings[ iReasonForSoldierUpDate ], FONT_BLACK, 0, CENTER_JUSTIFIED ); } else { - DisplayWrappedString( ( INT16 )( iX ), ( INT16 )( iY + 3 ), (INT16)iUpdatePanelWidth, 0, MAP_SCREEN_FONT, FONT_WHITE, pUpdateMercStrings[ iReasonForSoldierUpDate ], FONT_BLACK, 0, CENTER_JUSTIFIED ); + DisplayWrappedString( ( INT16 )( iX ), ( INT16 )( iY + 3 ), (INT16)iUpdatePanelWidth, 0, MAP_SCREEN_FONT, FONT_WHITE, pUpdateMercStrings[ iReasonForSoldierUpDate ], FONT_BLACK, 0, CENTER_JUSTIFIED ); } SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); // restore extern background rect - RestoreExternBackgroundRect( ( INT16 )( iX - 5 ), ( INT16 )( iY - 5 ), ( INT16 )( iUpdatePanelWidth + 10 ), ( INT16 )(iUpdatePanelHeight + 6 ) ); - + RestoreExternBackgroundRect( ( INT16 )( iX - 5 ), ( INT16 )( iY - 5 ), ( INT16 )( iUpdatePanelWidth + 10 ), ( INT16 )(iUpdatePanelHeight + 6 ) ); + CreateDestroyUpdatePanelButtons( iX, ( iY + iUpdatePanelHeight - 18 ), fFourWideMode ); MarkAButtonDirty( guiUpdatePanelButtons[ 0 ] ); MarkAButtonDirty( guiUpdatePanelButtons[ 1 ] ); @@ -5068,12 +5063,12 @@ void CreateDestroyUpdatePanelButtons(INT32 iX, INT32 iY, BOOLEAN fFourWideMode ) fShowAssignmentMenu = FALSE; fShowContractMenu = FALSE; -// guiUpdatePanelButtonsImage[ 0 ]= LoadButtonImage( "INTERFACE\\group_confirm.sti" ,-1,7,-1,8,-1 ); +// guiUpdatePanelButtonsImage[ 0 ]= LoadButtonImage( "INTERFACE\\group_confirm.sti" ,-1,7,-1,8,-1 ); // guiUpdatePanelButtonsImage[ 1 ] = LoadButtonImage( "INTERFACE\\group_confirm.sti" ,-1,7,-1,8,-1 ); - guiUpdatePanelButtonsImage[ 0 ]= LoadButtonImage( "INTERFACE\\group_confirm_tactical.sti" ,-1,7,-1,8,-1 ); + guiUpdatePanelButtonsImage[ 0 ]= LoadButtonImage( "INTERFACE\\group_confirm_tactical.sti" ,-1,7,-1,8,-1 ); guiUpdatePanelButtonsImage[ 1 ] = LoadButtonImage( "INTERFACE\\group_confirm_tactical.sti" ,-1,7,-1,8,-1 ); - if( fFourWideMode ) + if( fFourWideMode ) { guiUpdatePanelButtons[ 0 ] = QuickCreateButton( guiUpdatePanelButtonsImage[ 0 ], ( INT16 )( iX - 4 + TACT_UPDATE_MERC_FACE_X_WIDTH + 4), (INT16)iY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, @@ -5118,7 +5113,7 @@ void CreateDestroyUpdatePanelButtons(INT32 iX, INT32 iY, BOOLEAN fFourWideMode ) UnloadButtonImage( guiUpdatePanelButtonsImage[ 0 ]); UnloadButtonImage( guiUpdatePanelButtonsImage[ 1 ]); - + // unpause UnPauseDialogueQueue( ); } @@ -5130,7 +5125,7 @@ void CreateUpdateBox( void ) { // create basic box CreatePopUpBox(&ghUpdateBox, AssignmentDimensions, MovePosition, (POPUP_BOX_FLAG_CLIP_TEXT|POPUP_BOX_FLAG_RESIZE )); - + // which buffer will box render to SetBoxBuffer(ghUpdateBox, FRAME_BUFFER); @@ -5197,7 +5192,7 @@ void CreateUpdateBoxStrings( void ) AddMonoString(&hStringHandle, sString ); } } - + // add a few blank lines sString[ 0 ] = 0; @@ -5265,7 +5260,7 @@ void CreateDestroyTheUpdateBox( void ) // display the box DisplaySoldierUpdateBox( ); - + // Do beep PlayJA2SampleFromFile( "Sounds\\newbeep.wav", RATE_11025, MIDVOLUME, 1 , MIDDLEPAN ); } @@ -5320,43 +5315,43 @@ void RenderSoldierSmallFaceForUpdatePanel( INT32 iIndex, INT32 iX, INT32 iY ) // fill the background for the info bars black ColorFillVideoSurfaceArea( guiSAVEBUFFER, iX+36, iY+2, iX+44, iY+30, 0 ); - + // put down the background BltVideoObjectFromIndex( guiSAVEBUFFER, giMercPanelImage, 0, iX, iY, VO_BLT_SRCTRANSPARENCY, NULL ); - + // grab the face BltVideoObjectFromIndex( guiSAVEBUFFER , giUpdateSoldierFaces[ iIndex ], 0, iX+2, iY+2, VO_BLT_SRCTRANSPARENCY, NULL ); - + //HEALTH BAR pSoldier = pUpdateSoldierBox[ iIndex ]; // is the merc alive? - if( !pSoldier->bLife ) + if( !pSoldier->stats.bLife ) return; //yellow one for bleeding - iStartY = iY + 29 - 27*pSoldier->bLifeMax/100; + iStartY = iY + 29 - 27*pSoldier->stats.bLifeMax/100; ColorFillVideoSurfaceArea( guiSAVEBUFFER, iX+36, iStartY, iX+37, iY+29, Get16BPPColor( FROMRGB( 107, 107, 57 ) ) ); ColorFillVideoSurfaceArea( guiSAVEBUFFER, iX+37, iStartY, iX+38, iY+29, Get16BPPColor( FROMRGB( 222, 181, 115 ) ) ); - + //pink one for bandaged. iStartY += 27*pSoldier->bBleeding/100; ColorFillVideoSurfaceArea( guiSAVEBUFFER, iX+36, iStartY, iX+37, iY+29, Get16BPPColor( FROMRGB( 156, 57, 57 ) ) ); ColorFillVideoSurfaceArea( guiSAVEBUFFER, iX+37, iStartY, iX+38, iY+29, Get16BPPColor( FROMRGB( 222, 132, 132 ) ) ); - + //red one for actual health - iStartY = iY + 29 - 27*pSoldier->bLife/100; + iStartY = iY + 29 - 27*pSoldier->stats.bLife/100; ColorFillVideoSurfaceArea( guiSAVEBUFFER, iX+36, iStartY, iX+37, iY+29, Get16BPPColor( FROMRGB( 107, 8, 8 ) ) ); ColorFillVideoSurfaceArea( guiSAVEBUFFER, iX+37, iStartY, iX+38, iY+29, Get16BPPColor( FROMRGB( 206, 0, 0 ) ) ); - + //BREATH BAR iStartY = iY + 29 - 27*pSoldier->bBreathMax/100; ColorFillVideoSurfaceArea( guiSAVEBUFFER, iX+39, iStartY, iX+40, iY+29, Get16BPPColor( FROMRGB( 8, 8, 132 ) ) ); ColorFillVideoSurfaceArea( guiSAVEBUFFER, iX+40, iStartY, iX+41, iY+29, Get16BPPColor( FROMRGB( 8, 8, 107 ) ) ); - + //MORALE BAR - iStartY = iY + 29 - 27*pSoldier->bMorale/100; + iStartY = iY + 29 - 27*pSoldier->aiData.bMorale/100; ColorFillVideoSurfaceArea( guiSAVEBUFFER, iX+42, iStartY, iX+43, iY+29, Get16BPPColor( FROMRGB( 8, 156, 8 ) ) ); ColorFillVideoSurfaceArea( guiSAVEBUFFER, iX+43, iStartY, iX+44, iY+29, Get16BPPColor( FROMRGB( 8, 107, 8 ) ) ); @@ -5368,13 +5363,13 @@ void ContinueUpdateButtonCallback(GUI_BUTTON *btn,INT32 reason) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); EndUpdateBox( TRUE ); // restart time compression } @@ -5388,15 +5383,15 @@ void StopUpdateButtonCallback(GUI_BUTTON *btn,INT32 reason) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); - EndUpdateBox( FALSE ); // stop time compression + EndUpdateBox( FALSE ); // stop time compression } } @@ -5513,13 +5508,13 @@ void CreateDestroyInsuranceMouseRegionForMercs( BOOLEAN fCreate ) if( ( fCreated == FALSE ) && ( fCreate == TRUE ) ) { MSYS_DefineRegion( &gContractIconRegion, CHAR_ICON_X, CHAR_ICON_CONTRACT_Y, CHAR_ICON_X + CHAR_ICON_WIDTH, CHAR_ICON_CONTRACT_Y + CHAR_ICON_HEIGHT, - MSYS_PRIORITY_HIGH - 1, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + MSYS_PRIORITY_HIGH - 1, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); MSYS_DefineRegion( &gInsuranceIconRegion, CHAR_ICON_X, CHAR_ICON_CONTRACT_Y + CHAR_ICON_SPACING, CHAR_ICON_X + CHAR_ICON_WIDTH, CHAR_ICON_CONTRACT_Y + CHAR_ICON_SPACING + CHAR_ICON_HEIGHT, - MSYS_PRIORITY_HIGH - 1, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + MSYS_PRIORITY_HIGH - 1, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); MSYS_DefineRegion( &gDepositIconRegion, CHAR_ICON_X, CHAR_ICON_CONTRACT_Y + ( 2 * CHAR_ICON_SPACING ), CHAR_ICON_X + CHAR_ICON_WIDTH, CHAR_ICON_CONTRACT_Y + ( 2 * CHAR_ICON_SPACING ) + CHAR_ICON_HEIGHT, - MSYS_PRIORITY_HIGH - 1, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + MSYS_PRIORITY_HIGH - 1, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); fCreated = TRUE; } @@ -5555,19 +5550,19 @@ void HandlePlayerEnteringMapScreenBeforeGoingToTactical( void ) // now inform the player - + if( fShowMapScreenHelpText ) { fShowMapScreenHelpText = FALSE; SetUpShutDownMapScreenHelpTextScreenMask( ); fShowMapScreenHelpText = TRUE; } - + return; } -void DoneHandlePlayerFirstEntryToMapScreen( UINT8 bExitValue ) +void DoneHandlePlayerFirstEntryToMapScreen( UINT8 bExitValue ) { static BOOLEAN fFirstTime = TRUE; @@ -5606,15 +5601,15 @@ BOOLEAN HandleTimeCompressWithTeamJackedInAndGearedToGo( void ) { return( FALSE ); } - - //Setup variables in the PBI for this first battle. We need to support the + + //Setup variables in the PBI for this first battle. We need to support the //non-persistant PBI in case the user goes to mapscreen. gfBlitBattleSectorLocator = TRUE; gubPBSectorX = 9; gubPBSectorY = 1; gubPBSectorZ = 0; gubEnemyEncounterCode = ENTERING_ENEMY_SECTOR_CODE; - + InitHelicopterEntranceByMercs( ); FadeInGameScreen( ); @@ -5658,7 +5653,7 @@ void HandleDisplayOfExitToTacticalMessageForFirstEntryToMapScreen( void ) iTime = GetJA2Clock(); iDifference = iTime - giExitToTactBaseTime; - + if( iDifference > TIMER_FOR_SHOW_EXIT_TO_TACTICAL_MESSAGE ) { fShowMapScreenHelpText = FALSE; @@ -5668,7 +5663,7 @@ void HandleDisplayOfExitToTacticalMessageForFirstEntryToMapScreen( void ) giExitToTactBaseTime = 0; } - + return; } @@ -5699,7 +5694,7 @@ BOOLEAN NotifyPlayerWhenEnemyTakesControlOfImportantSector( INT16 sSectorX, INT1 { swprintf( sStringB, pMapErrorString[ 15 ], sString ); - // put up the message informing the player of the event + // put up the message informing the player of the event DoScreenIndependantMessageBox( sStringB, MSG_BOX_FLAG_OK, MapScreenDefaultOkBoxCallback ); return( TRUE ); } @@ -5715,17 +5710,17 @@ BOOLEAN NotifyPlayerWhenEnemyTakesControlOfImportantSector( INT16 sSectorX, INT1 { // get how much we now will get from the mines iValue = GetProjectedTotalDailyIncome( ); - + // parse the string swprintf( sStringC, L"%d", iValue ); - - // insert + + // insert InsertCommasForDollarFigure( sStringC ); InsertDollarSignInToString( sStringC ); swprintf( sStringB, pMapErrorString[ 16 ], sString, sStringC ); - // put up the message informing the player of the event + // put up the message informing the player of the event DoScreenIndependantMessageBox( sStringB, MSG_BOX_FLAG_OK, MapScreenDefaultOkBoxCallback ); return( TRUE ); } @@ -5740,11 +5735,11 @@ BOOLEAN NotifyPlayerWhenEnemyTakesControlOfImportantSector( INT16 sSectorX, INT1 } swprintf( sStringB, pMapErrorString[ 25 ], sString ); - // put up the message informing the player of the event + // put up the message informing the player of the event DoScreenIndependantMessageBox( sStringB, MSG_BOX_FLAG_OK, MapScreenDefaultOkBoxCallback ); return( TRUE ); } - + // get the strategic sector value sSector = sSectorX + MAP_WORLD_X * sSectorY; @@ -5821,7 +5816,6 @@ void NotifyPlayerOfInvasionByEnemyForces( INT16 sSectorX, INT16 sSectorY, INT8 b BOOLEAN CanCharacterMoveInStrategic( SOLDIERTYPE *pSoldier, INT8 *pbErrorNumber ) { - BOOLEAN fCanMove = TRUE; INT16 sSector = 0; BOOLEAN fProblemExists = FALSE; @@ -5859,7 +5853,7 @@ BOOLEAN CanCharacterMoveInStrategic( SOLDIERTYPE *pSoldier, INT8 *pbErrorNumber // vehicle checks - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // empty (needs a driver!)? if ( GetNumberInVehicle( pSoldier->bVehicleID ) == 0 ) @@ -5869,7 +5863,7 @@ BOOLEAN CanCharacterMoveInStrategic( SOLDIERTYPE *pSoldier, INT8 *pbErrorNumber } // too damaged? - if ( pSoldier->bLife < OKLIFE ) + if ( pSoldier->stats.bLife < OKLIFE ) { *pbErrorNumber = 47; return( FALSE ); @@ -5885,7 +5879,7 @@ BOOLEAN CanCharacterMoveInStrategic( SOLDIERTYPE *pSoldier, INT8 *pbErrorNumber else // non-vehicle { // dead? - if ( pSoldier->bLife <= 0 ) + if ( pSoldier->stats.bLife <= 0 ) { swprintf( gsCustomErrorString, pMapErrorString[ 35 ], pSoldier->name ); *pbErrorNumber = -99; // customized error message! @@ -5893,7 +5887,7 @@ BOOLEAN CanCharacterMoveInStrategic( SOLDIERTYPE *pSoldier, INT8 *pbErrorNumber } // too injured? - if ( pSoldier->bLife < OKLIFE ) + if ( pSoldier->stats.bLife < OKLIFE ) { swprintf( gsCustomErrorString, pMapErrorString[ 33 ], pSoldier->name ); *pbErrorNumber = -99; // customized error message! @@ -5903,7 +5897,7 @@ BOOLEAN CanCharacterMoveInStrategic( SOLDIERTYPE *pSoldier, INT8 *pbErrorNumber // if merc is in a particular sector, not somewhere in between - if ( pSoldier->fBetweenSectors == FALSE ) + if ( pSoldier->flags.fBetweenSectors == FALSE ) { // and he's NOT flying above it all in a working helicopter if( !SoldierAboardAirborneHeli( pSoldier ) ) @@ -5921,7 +5915,7 @@ BOOLEAN CanCharacterMoveInStrategic( SOLDIERTYPE *pSoldier, INT8 *pbErrorNumber // hostile sector? if ( gTacticalStatus.fEnemyInSector ) - { + { *pbErrorNumber = 2; return( FALSE ); } @@ -5946,7 +5940,7 @@ BOOLEAN CanCharacterMoveInStrategic( SOLDIERTYPE *pSoldier, INT8 *pbErrorNumber // if in L12 museum, and the museum alarm went off, and Eldin still around? if ( ( pSoldier->sSectorX == 12 ) && ( pSoldier->sSectorY == MAP_ROW_L ) && ( pSoldier->bSectorZ == 0 ) && - ( !pSoldier->fBetweenSectors ) && gMercProfiles[ ELDIN ].bMercStatus != MERC_IS_DEAD ) + ( !pSoldier->flags.fBetweenSectors ) && gMercProfiles[ ELDIN ].bMercStatus != MERC_IS_DEAD ) { UINT8 ubRoom, cnt; SOLDIERTYPE * pSoldier2; @@ -5994,7 +5988,7 @@ BOOLEAN CanCharacterMoveInStrategic( SOLDIERTYPE *pSoldier, INT8 *pbErrorNumber { // going alone? if ( ( ( pSoldier->bAssignment == VEHICLE ) && ( !IsRobotControllerInVehicle( pSoldier->iVehicleId ) ) ) || - ( ( pSoldier->bAssignment < ON_DUTY ) && ( !IsRobotControllerInSquad( pSoldier->bAssignment ) ) ) ) + ( ( pSoldier->bAssignment < ON_DUTY ) && ( !IsRobotControllerInSquad( pSoldier->bAssignment ) ) ) ) { *pbErrorNumber = 49; return( FALSE ); @@ -6005,7 +5999,7 @@ BOOLEAN CanCharacterMoveInStrategic( SOLDIERTYPE *pSoldier, INT8 *pbErrorNumber { // going alone? if ( ( ( pSoldier->bAssignment == VEHICLE ) && ( GetNumberOfNonEPCsInVehicle( pSoldier->iVehicleId ) == 0 ) ) || - ( ( pSoldier->bAssignment < ON_DUTY ) && ( NumberOfNonEPCsInSquad( pSoldier->bAssignment ) == 0 ) ) ) + ( ( pSoldier->bAssignment < ON_DUTY ) && ( NumberOfNonEPCsInSquad( pSoldier->bAssignment ) == 0 ) ) ) { // are they male or female if( gMercProfiles[ pSoldier->ubProfile ].bSex == MALE ) @@ -6073,7 +6067,7 @@ BOOLEAN CanEntireMovementGroupMercIsInMove( SOLDIERTYPE *pSoldier, INT8 *pbError // now check anybody who would be travelling with him // does character have group? - if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // IS a vehicle - use vehicle's group ubGroup = pVehicleList[ pSoldier->bVehicleID ].ubMovementGroup; @@ -6111,7 +6105,7 @@ BOOLEAN CanEntireMovementGroupMercIsInMove( SOLDIERTYPE *pSoldier, INT8 *pbError } // does character have group? - if( pCurrentSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if( pCurrentSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // IS a vehicle ubCurrentGroup = pVehicleList[ pCurrentSoldier->bVehicleID ].ubMovementGroup; @@ -6140,7 +6134,7 @@ BOOLEAN CanEntireMovementGroupMercIsInMove( SOLDIERTYPE *pSoldier, INT8 *pbError } - // everybody can move... Yey! :-) + // everybody can move... Yey! :-) return( TRUE ); } @@ -6251,7 +6245,7 @@ BOOLEAN CanSoldierMoveWithVehicleId( SOLDIERTYPE *pSoldier, INT32 iVehicle1Id ) } else // if soldier IS a vehicle - if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { iVehicle2Id = pSoldier->bVehicleID; } @@ -6277,8 +6271,8 @@ BOOLEAN CanSoldierMoveWithVehicleId( SOLDIERTYPE *pSoldier, INT32 iVehicle1Id ) // as long as they're in the same location, amd neither is between sectors, different vehicles is also ok if( ( pVehicle1->sSectorX == pVehicle2->sSectorX ) && - ( pVehicle1->sSectorY == pVehicle2->sSectorY ) && - ( pVehicle1->sSectorZ == pVehicle2->sSectorZ ) && + ( pVehicle1->sSectorY == pVehicle2->sSectorY ) && + ( pVehicle1->sSectorZ == pVehicle2->sSectorZ ) && !pVehicle1->fBetweenSectors && !pVehicle2->fBetweenSectors ) { @@ -6321,8 +6315,8 @@ BOOLEAN SaveLeaveItemList( HWFILE hFile ) //loop through all the nodes to see how many there are while( pCurrentItem->pNext ) { - pCurrentItem = pCurrentItem->pNext; - uiCount++; + pCurrentItem = pCurrentItem->pNext; + uiCount++; } // Save the number specifing how many items there are in the list @@ -6337,9 +6331,8 @@ BOOLEAN SaveLeaveItemList( HWFILE hFile ) //loop through all the nodes to see how many there are for( uiCnt=0; uiCntSave(hFile) ) { return(FALSE); } @@ -6411,28 +6404,25 @@ BOOLEAN LoadLeaveItemList( HWFILE hFile ) } // allocate space - gpLeaveListHead[ iCounter ] = (MERC_LEAVE_ITEM *) MemAlloc( sizeof( MERC_LEAVE_ITEM ) ); + gpLeaveListHead[ iCounter ] = new MERC_LEAVE_ITEM; if( gpLeaveListHead[ iCounter ] == NULL ) { return( FALSE ); } - memset( gpLeaveListHead[ iCounter ], 0, sizeof( MERC_LEAVE_ITEM ) ); pCurrentItem = gpLeaveListHead[ iCounter ]; for( uiSubItem=0; uiSubItem< uiCount; uiSubItem++ ) { // allocate space - pItem = (MERC_LEAVE_ITEM *) MemAlloc( sizeof( MERC_LEAVE_ITEM ) ); + pItem = new MERC_LEAVE_ITEM; if( pItem == NULL ) { return( FALSE ); } - memset( pItem, 0, sizeof( MERC_LEAVE_ITEM ) ); - // Load the items - FileRead( hFile, pItem, sizeof( MERC_LEAVE_ITEM ), &uiNumBytesRead ); - if( uiNumBytesRead != sizeof( MERC_LEAVE_ITEM ) ) + // Load the items + if ( !pItem->Load(hFile) ) { return(FALSE); } @@ -6444,7 +6434,7 @@ BOOLEAN LoadLeaveItemList( HWFILE hFile ) if( uiSubItem == 0 ) { gpLeaveListHead[ iCounter ] = pItem; - pCurrentItem = gpLeaveListHead[ iCounter ]; + pCurrentItem = gpLeaveListHead[ iCounter ]; } else { @@ -6488,7 +6478,7 @@ void TurnOnSectorLocator( UINT8 ubProfileID ) if ( ( ubProfileID == SKYRIDER ) && fSkyRiderSetUp ) { // if helicopter position is being shown, don't do this, too, cause the helicopter icon is on top and it looks - // like crap. I tried moving the heli icon blit to before, but that screws up it's blitting. + // like crap. I tried moving the heli icon blit to before, but that screws up it's blitting. if ( !fShowAircraftFlag ) { // can't use his profile, he's where his chopper is @@ -6521,7 +6511,7 @@ void TurnOffSectorLocator() void HandleBlitOfSectorLocatorIcon( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, UINT8 ubLocatorID ) { - static UINT8 ubFrame = 0; + static UINT8 ubFrame = 0; UINT8 ubBaseFrame = 0; UINT32 uiTimer = 0; HVOBJECT hHandle; @@ -6531,10 +6521,10 @@ void HandleBlitOfSectorLocatorIcon( INT16 sSectorX, INT16 sSectorY, INT16 sSecto // blits at 0,0 had been observerd... Assert( ( sSectorX >= 1 ) && ( sSectorX <= 16 ) ); Assert( ( sSectorY >= 1 ) && ( sSectorY <= 16 ) ); - Assert( ( sSectorZ >= 0 ) && ( sSectorZ <= 3 ) ); + Assert( ( sSectorZ >= 0 ) && ( sSectorZ <= 3 ) ); if( sSectorZ != iCurrentMapSectorZ ) - { //if the z level of the map screen renderer is different than the + { //if the z level of the map screen renderer is different than the //sector z that we wish to locate, then don't render it return; } @@ -6572,7 +6562,7 @@ void HandleBlitOfSectorLocatorIcon( INT16 sSectorX, INT16 sSectorY, INT16 sSecto sScreenX = MAP_GRID_X; } sScreenY--; //Carterism ritual - if( sScreenY < MAP_GRID_Y ) + if( sScreenY < MAP_GRID_Y ) { sScreenY = MAP_GRID_Y; } @@ -6597,7 +6587,7 @@ void HandleBlitOfSectorLocatorIcon( INT16 sSectorX, INT16 sSectorY, INT16 sSecto } } - RestoreExternBackgroundRect( (INT16)(sScreenX + 1), (INT16)(sScreenY - 1), MAP_GRID_X , MAP_GRID_Y ); + RestoreExternBackgroundRect( (INT16)(sScreenX + 1), (INT16)(sScreenY - 1), MAP_GRID_X , MAP_GRID_Y ); // blit object to frame buffer BltVideoObject( FRAME_BUFFER, hHandle, ubFrame, sScreenX, sScreenY, VO_BLT_SRCTRANSPARENCY, NULL ); @@ -6613,7 +6603,7 @@ BOOLEAN CheckIfSalaryIncreasedAndSayQuote( SOLDIERTYPE *pSoldier, BOOLEAN fTrigg Assert( pSoldier ); // OK, check if their price has gone up - if( pSoldier->fContractPriceHasIncreased ) + if( pSoldier->flags.fContractPriceHasIncreased ) { if ( fTriggerContractMenu ) { @@ -6628,7 +6618,7 @@ BOOLEAN CheckIfSalaryIncreasedAndSayQuote( SOLDIERTYPE *pSoldier, BOOLEAN fTrigg HandleImportantMercQuote( pSoldier, QUOTE_MERC_GONE_UP_IN_PRICE ); } - pSoldier->fContractPriceHasIncreased = FALSE; + pSoldier->flags.fContractPriceHasIncreased = FALSE; // said quote / triggered contract menu return( TRUE ); diff --git a/Strategic/Map Screen Interface.h b/Strategic/Map Screen Interface.h index 44e12f72..85349995 100644 --- a/Strategic/Map Screen Interface.h +++ b/Strategic/Map Screen Interface.h @@ -48,9 +48,9 @@ typedef struct FASTHELPREGION { #define MAP_SCREEN_FONT BLOCKFONT2 // characterlist regions -#define Y_START 135 //146 -#define MAP_START_KEYRING_Y 107 -#define Y_SIZE GetFontHeight(MAP_SCREEN_FONT) +#define Y_START 135 //146 +#define MAP_START_KEYRING_Y 107 +#define Y_SIZE GetFontHeight(MAP_SCREEN_FONT) //lal // militia control menu @@ -211,7 +211,7 @@ enum{ #define UPDATE_MERC_FACE_X_HEIGHT 50 #define UPDATE_MERC_FACE_X_OFFSET 2 #define UPDATE_MERC_FACE_Y_OFFSET 2 -#define WIDTH_OF_UPDATE_PANEL_BLOCKS 50 +#define WIDTH_OF_UPDATE_PANEL_BLOCKS 50 #define HEIGHT_OF_UPDATE_PANEL_BLOCKS 50 #define UPDATE_MERC_Y_OFFSET 4 #define UPDATE_MERC_X_OFFSET 4 @@ -222,7 +222,7 @@ enum{ #define TACT_UPDATE_MERC_FACE_X_HEIGHT 49 #define TACT_UPDATE_MERC_FACE_X_OFFSET 8 #define TACT_UPDATE_MERC_FACE_Y_OFFSET 6 -#define TACT_WIDTH_OF_UPDATE_PANEL_BLOCKS 70 +#define TACT_WIDTH_OF_UPDATE_PANEL_BLOCKS 70 #define TACT_HEIGHT_OF_UPDATE_PANEL_BLOCKS 49 #define TACT_UPDATE_MERC_Y_OFFSET 4 #define TACT_UPDATE_MERC_X_OFFSET 4 @@ -231,10 +231,22 @@ enum{ // the first vehicle slot int he list #define FIRST_VEHICLE 18 -typedef struct MERC_LEAVE_ITEM{ - OBJECTTYPE o; - struct MERC_LEAVE_ITEM *pNext; -}MERC_LEAVE_ITEM; +class OLD_MERC_LEAVE_ITEM_101 +{ +public: + OLD_OBJECTTYPE_101 oldObject; + class MERC_LEAVE_ITEM *pNext; +}; + +class MERC_LEAVE_ITEM +{ +public: + BOOLEAN Save( HWFILE hFile); + BOOLEAN Load( HWFILE hFile); + void initialize() {object.initialize(); pNext = NULL;}; + OBJECTTYPE object; + class MERC_LEAVE_ITEM *pNext; +}; extern BOOLEAN fShowAssignmentMenu; extern BOOLEAN fShowTrainingMenu ; @@ -320,11 +332,11 @@ extern INT32 iCurrentMapSectorZ; extern INT32 giBoxY; // pop up box textures -extern UINT32 guiPOPUPTEX; -extern UINT32 guiPOPUPBORDERS; +extern UINT32 guiPOPUPTEX; +extern UINT32 guiPOPUPBORDERS; // the level-changing markers on the map border -extern UINT32 guiLEVELMARKER; +extern UINT32 guiLEVELMARKER; // the currently selected character arrow extern UINT32 guiSelectedCharArrow; @@ -392,7 +404,7 @@ void EnableTeamInfoPanels( void ); void ActivateSoldierPopup( SOLDIERTYPE *pSoldier, UINT8 ubPopupType, INT16 xp, INT16 yp ); // do mapscreen message box -INT32 DoMapMessageBox( UINT8 ubStyle, STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ); +INT32 DoMapMessageBox( UINT8 ubStyle, STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ); // hop up one leve,l int he map screen level interface void GoUpOneLevelInMap( void ); @@ -434,7 +446,7 @@ void InitLeaveList( void ); void ShutDownLeaveList( void ); // add item to leave equip index -BOOLEAN AddItemToLeaveIndex( OBJECTTYPE *o, UINT32 uiIndex ); +BOOLEAN AddItemToLeaveIndex( OBJECTTYPE *object, UINT32 uiIndex ); // release memory for all items in this slot's leave item list void FreeLeaveListSlot( UINT32 uiSlotIndex ); diff --git a/Strategic/Meanwhile.cpp b/Strategic/Meanwhile.cpp index c744d7a2..b1f4f6a8 100644 --- a/Strategic/Meanwhile.cpp +++ b/Strategic/Meanwhile.cpp @@ -40,7 +40,7 @@ #define MAX_MEANWHILE_PROFILES 10 -INT8 gzMeanwhileStr[][30] = +INT8 gzMeanwhileStr[][30] = { "End of player's first battle", "Drassen Lib. ", @@ -63,7 +63,7 @@ INT8 gzMeanwhileStr[][30] = // the snap to grid nos for meanwhile scenes -UINT16 gusMeanWhileGridNo[]= +INT16 gsMeanWhileGridNo[]= { 12248, 12248, @@ -96,7 +96,7 @@ typedef struct } NPC_SAVE_INFO; -// BEGIN SERALIZATION +// BEGIN SERALIZATION MEANWHILE_DEFINITION gCurrentMeanwhileDef; MEANWHILE_DEFINITION gMeanwhileDef[NUM_MEANWHILES]; BOOLEAN gfMeanwhileTryingToStart = FALSE; @@ -113,7 +113,7 @@ UINT32 guiOldScreen; NPC_SAVE_INFO gNPCSaveData[ MAX_MEANWHILE_PROFILES ]; UINT32 guiNumNPCSaves = 0; BOOLEAN gfReloadingScreenFromMeanwhile = FALSE; -INT16 gsOldCurInterfacePanel = 0; +INT16 gsOldCurInterfacePanel = 0; BOOLEAN gfWorldWasLoaded = FALSE; UINT8 ubCurrentMeanWhileId = 0; @@ -142,10 +142,10 @@ UINT32 uiMeanWhileFlags = 0; #define KILL_CHOPPER_FLAG 0x00001000 #define AWOL_SCIENTIST_FLAG 0x00002000 #define OUTSKIRTS_MEDUNA_FLAG 0x00004000 -#define INTERROGATION_FLAG 0x00008000 +#define INTERROGATION_FLAG 0x00008000 #define BALIME_LIBERATED_FLAG 0x00010000 -extern void InternalLocateGridNo( UINT16 sGridNo, BOOLEAN fForce ); +extern void InternalLocateGridNo( INT16 sGridNo, BOOLEAN fForce ); void ProcessImplicationsOfMeanwhile( void ); @@ -318,7 +318,7 @@ void ScheduleMeanwhileEvent( MEANWHILE_DEFINITION *pMeanwhileDef, UINT32 uiTime { return; } - + // set the meanwhile flag for this event SetMeanWhileFlag( pMeanwhileDef->ubMeanwhileID ); @@ -328,14 +328,14 @@ void ScheduleMeanwhileEvent( MEANWHILE_DEFINITION *pMeanwhileDef, UINT32 uiTime // Copy definiaiotn structure into position in global array.... memcpy( &(gMeanwhileDef[pMeanwhileDef->ubMeanwhileID]), pMeanwhileDef, sizeof( MEANWHILE_DEFINITION ) ); - // A meanwhile.. poor elliot! - // increment his slapped count... + // A meanwhile.. poor elliot! + // increment his slapped count... - // We need to do it here 'cause they may skip it... - if ( gMercProfiles[ ELLIOT ].bNPCData != 17 ) - { - gMercProfiles[ ELLIOT ].bNPCData++; - } + // We need to do it here 'cause they may skip it... + if ( gMercProfiles[ ELLIOT ].bNPCData != 17 ) + { + gMercProfiles[ ELLIOT ].bNPCData++; + } AddStrategicEvent( EVENT_MEANWHILE, uiTime, pMeanwhileDef->ubMeanwhileID ); } @@ -403,25 +403,25 @@ void CheckForMeanwhileOKStart( ) return; } - if ( !DialogueQueueIsEmptyOrSomebodyTalkingNow( ) ) - { - return; - } + if ( !DialogueQueueIsEmptyOrSomebodyTalkingNow( ) ) + { + return; + } gfMeanwhileTryingToStart = FALSE; guiOldScreen = guiCurrentScreen; - if ( guiCurrentScreen == GAME_SCREEN ) - { - LeaveTacticalScreen( GAME_SCREEN ); - } + if ( guiCurrentScreen == GAME_SCREEN ) + { + LeaveTacticalScreen( GAME_SCREEN ); + } - // We need to make sure we have no item - at least in tactical - // In mapscreen, time is paused when manipulating items... - CancelItemPointer( ); + // We need to make sure we have no item - at least in tactical + // In mapscreen, time is paused when manipulating items... + CancelItemPointer( ); BringupMeanwhileBox( ); } @@ -430,7 +430,6 @@ void CheckForMeanwhileOKStart( ) void StartMeanwhile( ) { INT32 iIndex; - INT8 bNumDone = 0; // OK, save old position... if ( gfWorldLoaded ) @@ -447,14 +446,14 @@ void StartMeanwhile( ) gfInMeanwhile = TRUE; // ATE: Change music before load - SetMusicMode( MUSIC_MAIN_MENU ); + SetMusicMode( MUSIC_MAIN_MENU ); gfWorldWasLoaded = gfWorldLoaded; // OK, we have been told to start..... SetCurrentInterfacePanel( (UINT8)TEAM_PANEL ); - + // Setup NPC locations, depending on meanwhile type... switch( gCurrentMeanwhileDef.ubMeanwhileID ) { @@ -464,7 +463,7 @@ void StartMeanwhile( ) case ALMA_LIBERATED: case GRUMM_LIBERATED: case CHITZENA_LIBERATED: - case BALIME_LIBERATED: + case BALIME_LIBERATED: case NW_SAM: case NE_SAM: case CENTRAL_SAM: @@ -480,10 +479,10 @@ void StartMeanwhile( ) if ( iIndex != -1 ) { gNPCSaveData[ iIndex ].ubProfile = QUEEN; - gNPCSaveData[ iIndex ].sX = gMercProfiles[ QUEEN ].sSectorX; - gNPCSaveData[ iIndex ].sY = gMercProfiles[ QUEEN ].sSectorY; - gNPCSaveData[ iIndex ].sZ = gMercProfiles[ QUEEN ].bSectorZ; - gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ QUEEN ].sGridNo; + gNPCSaveData[ iIndex ].sX = gMercProfiles[ QUEEN ].sSectorX; + gNPCSaveData[ iIndex ].sY = gMercProfiles[ QUEEN ].sSectorY; + gNPCSaveData[ iIndex ].sZ = gMercProfiles[ QUEEN ].bSectorZ; + gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ QUEEN ].sGridNo; // Force reload of NPC files... ReloadQuoteFile( QUEEN ); @@ -496,10 +495,10 @@ void StartMeanwhile( ) if ( iIndex != -1 ) { gNPCSaveData[ iIndex ].ubProfile = ELLIOT; - gNPCSaveData[ iIndex ].sX = gMercProfiles[ ELLIOT ].sSectorX; - gNPCSaveData[ iIndex ].sY = gMercProfiles[ ELLIOT ].sSectorY; - gNPCSaveData[ iIndex ].sZ = gMercProfiles[ ELLIOT ].bSectorZ; - gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ ELLIOT ].sGridNo; + gNPCSaveData[ iIndex ].sX = gMercProfiles[ ELLIOT ].sSectorX; + gNPCSaveData[ iIndex ].sY = gMercProfiles[ ELLIOT ].sSectorY; + gNPCSaveData[ iIndex ].sZ = gMercProfiles[ ELLIOT ].bSectorZ; + gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ ELLIOT ].sGridNo; // Force reload of NPC files... ReloadQuoteFile( ELLIOT ); @@ -514,10 +513,10 @@ void StartMeanwhile( ) if ( iIndex != -1 ) { gNPCSaveData[ iIndex ].ubProfile = JOE; - gNPCSaveData[ iIndex ].sX = gMercProfiles[ JOE ].sSectorX; - gNPCSaveData[ iIndex ].sY = gMercProfiles[ JOE ].sSectorY; - gNPCSaveData[ iIndex ].sZ = gMercProfiles[ JOE ].bSectorZ; - gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ JOE ].sGridNo; + gNPCSaveData[ iIndex ].sX = gMercProfiles[ JOE ].sSectorX; + gNPCSaveData[ iIndex ].sY = gMercProfiles[ JOE ].sSectorY; + gNPCSaveData[ iIndex ].sZ = gMercProfiles[ JOE ].bSectorZ; + gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ JOE ].sGridNo; // Force reload of NPC files... ReloadQuoteFile( JOE ); @@ -536,10 +535,10 @@ void StartMeanwhile( ) if ( iIndex != -1 ) { gNPCSaveData[ iIndex ].ubProfile = QUEEN; - gNPCSaveData[ iIndex ].sX = gMercProfiles[ QUEEN ].sSectorX; - gNPCSaveData[ iIndex ].sY = gMercProfiles[ QUEEN ].sSectorY; - gNPCSaveData[ iIndex ].sZ = gMercProfiles[ QUEEN ].bSectorZ; - gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ QUEEN ].sGridNo; + gNPCSaveData[ iIndex ].sX = gMercProfiles[ QUEEN ].sSectorX; + gNPCSaveData[ iIndex ].sY = gMercProfiles[ QUEEN ].sSectorY; + gNPCSaveData[ iIndex ].sZ = gMercProfiles[ QUEEN ].bSectorZ; + gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ QUEEN ].sGridNo; // Force reload of NPC files... ReloadQuoteFile( QUEEN ); @@ -552,10 +551,10 @@ void StartMeanwhile( ) if ( iIndex != -1 ) { gNPCSaveData[ iIndex ].ubProfile = ELLIOT; - gNPCSaveData[ iIndex ].sX = gMercProfiles[ ELLIOT ].sSectorX; - gNPCSaveData[ iIndex ].sY = gMercProfiles[ ELLIOT ].sSectorY; - gNPCSaveData[ iIndex ].sZ = gMercProfiles[ ELLIOT ].bSectorZ; - gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ ELLIOT ].sGridNo; + gNPCSaveData[ iIndex ].sX = gMercProfiles[ ELLIOT ].sSectorX; + gNPCSaveData[ iIndex ].sY = gMercProfiles[ ELLIOT ].sSectorY; + gNPCSaveData[ iIndex ].sZ = gMercProfiles[ ELLIOT ].bSectorZ; + gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ ELLIOT ].sGridNo; // Force reload of NPC files... ReloadQuoteFile( ELLIOT ); @@ -568,10 +567,10 @@ void StartMeanwhile( ) if ( iIndex != -1 ) { gNPCSaveData[ iIndex ].ubProfile = JOE; - gNPCSaveData[ iIndex ].sX = gMercProfiles[ JOE ].sSectorX; - gNPCSaveData[ iIndex ].sY = gMercProfiles[ JOE ].sSectorY; - gNPCSaveData[ iIndex ].sZ = gMercProfiles[ JOE ].bSectorZ; - gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ JOE ].sGridNo; + gNPCSaveData[ iIndex ].sX = gMercProfiles[ JOE ].sSectorX; + gNPCSaveData[ iIndex ].sY = gMercProfiles[ JOE ].sSectorY; + gNPCSaveData[ iIndex ].sZ = gMercProfiles[ JOE ].bSectorZ; + gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ JOE ].sGridNo; // Force reload of NPC files... ReloadQuoteFile( JOE ); @@ -597,7 +596,7 @@ void StartMeanwhile( ) void DoneFadeOutMeanwhile( ) { // OK, insertion data found, enter sector! - + SetCurrentWorldSector( gCurrentMeanwhileDef.sSectorX, gCurrentMeanwhileDef.sSectorY, 0 ); //LocateToMeanwhileCharacter( ); @@ -653,8 +652,8 @@ BOOLEAN AreInMeanwhile( ) { STRATEGICEVENT *curr; - //KM: April 6, 1999 - //Tactical traversal needs to take precedence over meanwhile events. When tactically traversing, we + //KM: April 6, 1999 + //Tactical traversal needs to take precedence over meanwhile events. When tactically traversing, we //expect to make it to the other side without interruption. if( gfTacticalTraversal ) { @@ -665,7 +664,7 @@ BOOLEAN AreInMeanwhile( ) { return TRUE; } - //Check to make sure a meanwhile scene isn't in the event list occurring at the exact same time as this call. Meanwhile + //Check to make sure a meanwhile scene isn't in the event list occurring at the exact same time as this call. Meanwhile //scenes have precedence over a new battle if they occur in the same second. curr = gpEventList; while( curr ) @@ -726,12 +725,12 @@ void ProcessImplicationsOfMeanwhile( void ) //HandleNPCDoAction( QUEEN, NPC_ACTION_SEND_SOLDIERS_TO_DRASSEN, 0 ); ExecuteStrategicAIAction( NPC_ACTION_SEND_SOLDIERS_TO_DRASSEN, 13, 4 ); break; - + case CREATURES: // add Rat HandleNPCDoAction( QUEEN, NPC_ACTION_ADD_RAT, 0 ); break; - + case AWOL_SCIENTIST: { INT16 sSectorX, sSectorY; @@ -781,7 +780,7 @@ void ProcessImplicationsOfMeanwhile( void ) case CENTRAL_SAM: ExecuteStrategicAIAction( NPC_ACTION_SEND_TROOPS_TO_SAM, SAM_3_X, SAM_3_X ); break; - + default: break; } @@ -804,8 +803,8 @@ void EndMeanwhile( ) UnLockPauseState(); UnPauseGame(); - // ATE: Make sure! - TurnOffSectorLocator(); + // ATE: Make sure! + TurnOffSectorLocator(); if ( gCurrentMeanwhileDef.ubMeanwhileID != INTERROGATION ) { @@ -823,23 +822,23 @@ void EndMeanwhile( ) // Set music mode to enemy present! SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); - // ATE: Restore people to saved positions... - // OK, restore NPC save info... - for ( cnt = 0; cnt < guiNumNPCSaves; cnt++ ) - { - ubProfile = gNPCSaveData[ cnt ].ubProfile; + // ATE: Restore people to saved positions... + // OK, restore NPC save info... + for ( cnt = 0; cnt < guiNumNPCSaves; cnt++ ) + { + ubProfile = gNPCSaveData[ cnt ].ubProfile; - if ( ubProfile != NO_PROFILE ) - { - gMercProfiles[ ubProfile ].sSectorX = gNPCSaveData[ cnt ].sX; - gMercProfiles[ ubProfile ].sSectorY = gNPCSaveData[ cnt ].sY; - gMercProfiles[ ubProfile ].bSectorZ = (INT8)gNPCSaveData[ cnt ].sZ; - gMercProfiles[ ubProfile ].sGridNo = (INT8)gNPCSaveData[ cnt ].sGridNo; + if ( ubProfile != NO_PROFILE ) + { + gMercProfiles[ ubProfile ].sSectorX = gNPCSaveData[ cnt ].sX; + gMercProfiles[ ubProfile ].sSectorY = gNPCSaveData[ cnt ].sY; + gMercProfiles[ ubProfile ].bSectorZ = (INT8)gNPCSaveData[ cnt ].sZ; + gMercProfiles[ ubProfile ].sGridNo = (INT8)gNPCSaveData[ cnt ].sGridNo; - // Ensure NPC files loaded... - ReloadQuoteFile( ubProfile ); - } - } + // Ensure NPC files loaded... + ReloadQuoteFile( ubProfile ); + } + } } @@ -853,13 +852,13 @@ void DoneFadeOutMeanwhileOnceDone( ) // OK, insertion data found, enter sector! gfReloadingScreenFromMeanwhile = TRUE; - + if( gfWorldWasLoaded ) { SetCurrentWorldSector( gsOldSectorX, gsOldSectorY, (INT8)gsOldSectorZ ); - ExamineCurrentSquadLights( ); - } + ExamineCurrentSquadLights( ); + } else { TrashWorld( ); @@ -883,7 +882,7 @@ void DoneFadeOutMeanwhileOnceDone( ) gMercProfiles[ ubProfile ].sSectorX = gNPCSaveData[ cnt ].sX; gMercProfiles[ ubProfile ].sSectorY = gNPCSaveData[ cnt ].sY; gMercProfiles[ ubProfile ].bSectorZ = (INT8)gNPCSaveData[ cnt ].sZ; - gMercProfiles[ ubProfile ].sGridNo = (INT8)gNPCSaveData[ cnt ].sGridNo; + gMercProfiles[ ubProfile ].sGridNo = (INT8)gNPCSaveData[ cnt ].sGridNo; // Ensure NPC files loaded... ReloadQuoteFile( ubProfile ); @@ -912,7 +911,7 @@ void DoneFadeOutMeanwhileOnceDone( ) void DoneFadeInMeanwhileOnceDone( ) { - + } void LocateMeanWhileGrid( void ) @@ -920,7 +919,7 @@ void LocateMeanWhileGrid( void ) INT16 sGridNo = 0; // go to the approp. gridno - sGridNo = gusMeanWhileGridNo[ ubCurrentMeanWhileId ]; + sGridNo = gsMeanWhileGridNo[ ubCurrentMeanWhileId ]; InternalLocateGridNo( sGridNo, TRUE ); @@ -958,14 +957,14 @@ void HandleCreatureRelease( void ) { UINT32 uiTime = 0; MEANWHILE_DEFINITION MeanwhileDef; - + MeanwhileDef.sSectorX = 3; MeanwhileDef.sSectorY = 16; MeanwhileDef.ubNPCNumber = QUEEN; MeanwhileDef.usTriggerEvent = 0; uiTime = GetWorldTotalMin() + 5; - + MeanwhileDef.ubMeanwhileID = CREATURES; // schedule the event @@ -987,7 +986,7 @@ void HandleMeanWhileEventPostingForTownLiberation( UINT8 bTownId ) MeanwhileDef.usTriggerEvent = 0; uiTime = GetWorldTotalMin() + 5; - + // which town iberated? switch( bTownId ) { @@ -1024,10 +1023,10 @@ void HandleMeanWhileEventPostingForTownLiberation( UINT8 bTownId ) // schedule the event ScheduleMeanwhileEvent( &MeanwhileDef, uiTime ); } -} +} void HandleMeanWhileEventPostingForTownLoss( UINT8 bTownId ) -{ +{ UINT32 uiTime = 0; MEANWHILE_DEFINITION MeanwhileDef; @@ -1043,7 +1042,7 @@ void HandleMeanWhileEventPostingForTownLoss( UINT8 bTownId ) MeanwhileDef.usTriggerEvent = 0; uiTime = GetWorldTotalMin() + 5; - + MeanwhileDef.ubMeanwhileID = LOST_TOWN; // schedule the event @@ -1072,9 +1071,9 @@ void HandleMeanWhileEventPostingForSAMLiberation( INT8 bSamId ) MeanwhileDef.sSectorY = 16; MeanwhileDef.ubNPCNumber = QUEEN; MeanwhileDef.usTriggerEvent = 0; - + uiTime = GetWorldTotalMin() + 5; - + // which SAM iberated? switch( bSamId ) { @@ -1103,15 +1102,13 @@ void HandleMeanWhileEventPostingForSAMLiberation( INT8 bSamId ) ScheduleMeanwhileEvent( &MeanwhileDef, uiTime ); } - + } void HandleFlowersMeanwhileScene( INT8 bTimeCode ) { UINT32 uiTime = 0; MEANWHILE_DEFINITION MeanwhileDef; - UINT8 ubId = 0; - // make sure scene hasn't been used before if ( GetMeanWhileFlag( FLOWERS ) ) { @@ -1134,7 +1131,7 @@ void HandleFlowersMeanwhileScene( INT8 bTimeCode ) // 2-4 days later uiTime = GetWorldTotalMin() + 60 * ( 24 + Random( 48 ) ); } - + MeanwhileDef.ubMeanwhileID = FLOWERS; // schedule the event @@ -1145,8 +1142,6 @@ void HandleOutskirtsOfMedunaMeanwhileScene( void ) { UINT32 uiTime = 0; MEANWHILE_DEFINITION MeanwhileDef; - UINT8 ubId = 0; - // make sure scene hasn't been used before if ( GetMeanWhileFlag( OUTSKIRTS_MEDUNA ) ) { @@ -1159,7 +1154,7 @@ void HandleOutskirtsOfMedunaMeanwhileScene( void ) MeanwhileDef.usTriggerEvent = 0; uiTime = GetWorldTotalMin() + 5; - + MeanwhileDef.ubMeanwhileID = OUTSKIRTS_MEDUNA; // schedule the event @@ -1170,8 +1165,6 @@ void HandleKillChopperMeanwhileScene( void ) { UINT32 uiTime = 0; MEANWHILE_DEFINITION MeanwhileDef; - UINT8 ubId = 0; - // make sure scene hasn't been used before if ( GetMeanWhileFlag( KILL_CHOPPER ) ) { @@ -1184,7 +1177,7 @@ void HandleKillChopperMeanwhileScene( void ) MeanwhileDef.usTriggerEvent = 0; uiTime = GetWorldTotalMin() + 55 + Random( 10 ); - + MeanwhileDef.ubMeanwhileID = KILL_CHOPPER; // schedule the event @@ -1195,8 +1188,6 @@ void HandleScientistAWOLMeanwhileScene( void ) { UINT32 uiTime = 0; MEANWHILE_DEFINITION MeanwhileDef; - UINT8 ubId = 0; - // make sure scene hasn't been used before if ( GetMeanWhileFlag( AWOL_SCIENTIST ) ) { @@ -1209,7 +1200,7 @@ void HandleScientistAWOLMeanwhileScene( void ) MeanwhileDef.usTriggerEvent = 0; uiTime = GetWorldTotalMin() + 5; - + MeanwhileDef.ubMeanwhileID = AWOL_SCIENTIST; // schedule the event @@ -1218,10 +1209,8 @@ void HandleScientistAWOLMeanwhileScene( void ) void HandleInterrogationMeanwhileScene( void ) { - UINT32 uiTime = 0; + UINT32 uiTime = 0; MEANWHILE_DEFINITION MeanwhileDef; - UINT8 ubId = 0; - // make sure scene hasn't been used before if ( GetMeanWhileFlag( INTERROGATION ) ) { @@ -1234,7 +1223,7 @@ void HandleInterrogationMeanwhileScene( void ) MeanwhileDef.usTriggerEvent = 0; uiTime = GetWorldTotalMin() + 60; - + MeanwhileDef.ubMeanwhileID = INTERROGATION; // schedule the event @@ -1251,14 +1240,14 @@ void HandleFirstBattleVictory( void ) { return; } - + MeanwhileDef.sSectorX = 3; MeanwhileDef.sSectorY = 16; MeanwhileDef.ubNPCNumber = QUEEN; MeanwhileDef.usTriggerEvent = 0; uiTime = GetWorldTotalMin() + 5; - + ubId = END_OF_PLAYERS_FIRST_BATTLE; MeanwhileDef.ubMeanwhileID = ubId; @@ -1279,7 +1268,7 @@ void HandleDelayedFirstBattleVictory( void ) { return; } - + MeanwhileDef.sSectorX = 3; MeanwhileDef.sSectorY = 16; MeanwhileDef.ubNPCNumber = QUEEN; @@ -1287,11 +1276,11 @@ void HandleDelayedFirstBattleVictory( void ) /* //It is theoretically impossible to liberate a town within 60 minutes of the first battle (which is supposed to - //occur outside of a town in this scenario). The delay is attributed to the info taking longer to reach the queen. + //occur outside of a town in this scenario). The delay is attributed to the info taking longer to reach the queen. uiTime = GetWorldTotalMin() + 60; */ uiTime = GetWorldTotalMin() + 5; - + ubId = END_OF_PLAYERS_FIRST_BATTLE; MeanwhileDef.ubMeanwhileID = ubId; @@ -1313,7 +1302,7 @@ void HandleFirstBattleEndingWhileInTown( INT16 sSectorX, INT16 sSectorY, INT16 b } // if this is in fact a town and it is the first battle, then set gfFirstBattleMeanwhileScenePending true - // if is true then this is the end of the second battle, post the first meanwhile OR, on call to trash world, that + // if is true then this is the end of the second battle, post the first meanwhile OR, on call to trash world, that // means player is leaving sector // grab sector value @@ -1357,6 +1346,7 @@ void HandleFirstMeanWhileSetUpWithTrashWorld( void ) - + + diff --git a/Strategic/Merc Contract.cpp b/Strategic/Merc Contract.cpp index d849d3d9..64402c7f 100644 --- a/Strategic/Merc Contract.cpp +++ b/Strategic/Merc Contract.cpp @@ -20,7 +20,7 @@ #include "strategic.h" #include "strategicmap.h" #include "Quests.h" - #include "worlddef.h" + #include "worlddef.h" #include "rotting corpses.h" #include "Animation Control.h" #include "Tactical Save.h" @@ -64,7 +64,7 @@ BOOLEAN fEnterMapDueToContract = FALSE; extern BOOLEAN fOneFrame; extern BOOLEAN fPausedTimeDuringQuote; UINT8 ubQuitType = 0; -BOOLEAN gfFirstMercSayQuote = FALSE; +BOOLEAN gfFirstMercSayQuote = FALSE; extern BOOLEAN gfFirstMercSayingQuoteWillLeaveNoMatterWhat; extern CHAR16 gzUserDefinedButton1[ 128 ]; @@ -82,12 +82,12 @@ UINT8 ubNumContractRenewals = 0; // end UINT8 ubCurrentContractRenewal = 0; UINT8 ubCurrentContractRenewalInProgress = FALSE; -BOOLEAN gfContractRenewalSquenceOn = FALSE; +BOOLEAN gfContractRenewalSquenceOn = FALSE; BOOLEAN gfInContractMenuFromRenewSequence = FALSE; - + // the airport sector -#define AIRPORT_X 13 +#define AIRPORT_X 13 #define AIRPORT_Y 2 @@ -108,7 +108,7 @@ BOOLEAN SaveContractRenewalDataToSaveGameFile( HWFILE hFile ) } - return( TRUE ); + return( TRUE ); } @@ -128,7 +128,7 @@ BOOLEAN LoadContractRenewalDataFromSaveGameFile( HWFILE hFile ) return( FALSE ); } - return( TRUE ); + return( TRUE ); } void BeginContractRenewalSequence( ) @@ -146,7 +146,7 @@ void BeginContractRenewalSequence( ) if ( pSoldier ) { - if( ( pSoldier->bActive == FALSE ) || ( pSoldier->bLife == 0 ) || ( pSoldier->bAssignment == IN_TRANSIT ) ||( pSoldier->bAssignment == ASSIGNMENT_POW ) ) + if( ( pSoldier->bActive == FALSE ) || ( pSoldier->stats.bLife == 0 ) || ( pSoldier->bAssignment == IN_TRANSIT ) ||( pSoldier->bAssignment == ASSIGNMENT_POW ) ) { // no continue; @@ -226,7 +226,7 @@ void HandleContractRenewalSequence( ) SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_CONTRACT_NOGO_TO_RENEW , pSoldier->ubID,0 ,0 ,0 ,0 ); } else - { + { // OK check what dialogue to play // If we have not used this one before.... if ( pSoldier->ubContractRenewalQuoteCode == SOLDIER_CONTRACT_RENEW_QUOTE_NOT_USED ) @@ -242,7 +242,7 @@ void HandleContractRenewalSequence( ) HandleImportantMercQuote( pSoldier, QUOTE_MERC_LEAVING_ALSUCO_SOON ); SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,0 ,MAP_SCREEN ,0 ,0 ,0 ); } - + // Do special dialogue event... SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_CONTRACT_WANTS_TO_RENEW , pSoldier->ubID,0 ,0 ,0 ,0 ); } @@ -263,7 +263,7 @@ void EndCurrentContractRenewal( ) { // OK stop this one and increment current one ubCurrentContractRenewalInProgress = FALSE; - gfInContractMenuFromRenewSequence = FALSE; + gfInContractMenuFromRenewSequence = FALSE; ubCurrentContractRenewal++; @@ -296,7 +296,7 @@ void HandleMercIsNotWillingToRenew( UINT8 ubID ) // We wish to lock interface SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,1,MAP_SCREEN,0,0,0 ); - + // Setup variable for this.... gfInContractMenuFromRenewSequence = TRUE; @@ -378,7 +378,7 @@ BOOLEAN MercContractHandling( SOLDIERTYPE *pSoldier, UINT8 ubDesiredAction ) return(FALSE); } - + fPausedTimeDuringQuote = TRUE; SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,1 ,MAP_SCREEN ,0 ,0 ,0 ); @@ -395,7 +395,7 @@ BOOLEAN MercContractHandling( SOLDIERTYPE *pSoldier, UINT8 ubDesiredAction ) //determine the end of the contract pSoldier->iEndofContractTime += ( iContractLength * 1440 ); - if( ( pSoldier->usLifeInsurance ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) ) // DEF: Removed cause they can extend a 1 day contract && ( iContractLength > 1 ) + if( ( pSoldier->usLifeInsurance ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) ) // DEF: Removed cause they can extend a 1 day contract && ( iContractLength > 1 ) { // check if player can afford insurance, if not, tell them iCostOfInsurance = CalculateInsuranceContractCost( iContractLength, pSoldier->ubProfile ); @@ -436,22 +436,22 @@ BOOLEAN MercContractHandling( SOLDIERTYPE *pSoldier, UINT8 ubDesiredAction ) SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,0 ,MAP_SCREEN ,0 ,0 ,0 ); - // ATE: Setup when they can be signed again! - // If they are 2-weeks this can be extended - // otherwise don't change from current - if ( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK ) - { - pSoldier->iTimeCanSignElsewhere = pSoldier->iEndofContractTime; - } + // ATE: Setup when they can be signed again! + // If they are 2-weeks this can be extended + // otherwise don't change from current + if ( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK ) + { + pSoldier->iTimeCanSignElsewhere = pSoldier->iEndofContractTime; + } -// ARM: Do not reset because of renewal! The quote is for early dismissal from *initial* time of hiring +// ARM: Do not reset because of renewal! The quote is for early dismissal from *initial* time of hiring // pSoldier->uiTimeOfLastContractUpdate = GetWorldTotalMin(); -// ARM: Do not reset because of renewal! The deposit in the profile goes up when merc levels, but the one in the soldier +// ARM: Do not reset because of renewal! The deposit in the profile goes up when merc levels, but the one in the soldier // structure must always reflect the deposit actually paid (which does NOT change when a merc levels). // pSoldier->usMedicalDeposit = gMercProfiles[ pSoldier->ubProfile ].sMedicalDepositAmount; - //add an entry in the finacial page for the extending of the mercs contract + //add an entry in the finacial page for the extending of the mercs contract AddTransactionToPlayersBook( ubFinancesContractType, pSoldier->ubProfile, GetWorldTotalMin(), -iContractCharge ); //add an entry in the history page for the extending of the merc contract @@ -476,7 +476,7 @@ BOOLEAN WillMercRenew( SOLDIERTYPE *pSoldier, BOOLEAN fSayQuote ) return( FALSE ); // does the merc have another contract already lined up? - if( pSoldier->fSignedAnotherContract ) + if( pSoldier->flags.fSignedAnotherContract ) { // NOTE: Having a buddy around will NOT stop a merc from leaving on another contract (IC's call) @@ -569,14 +569,14 @@ BOOLEAN WillMercRenew( SOLDIERTYPE *pSoldier, BOOLEAN fSayQuote ) if ( bMercID >= 0 ) { if ( IsMercOnTeamAndInOmertaAlreadyAndAlive( (UINT8) bMercID ) ) - { + { if ( gMercProfiles[ pSoldier->ubProfile ].bLearnToHateCount == 0 ) { // our tolerance has run out! fUnhappy = TRUE; usReasonQuote = QUOTE_LEARNED_TO_HATE_MERC_1_ON_TEAM_WONT_RENEW; - } + } else if ( gMercProfiles[ pSoldier->ubProfile ].bLearnToHateCount <= gMercProfiles[ pSoldier->ubProfile ].bLearnToHateTime / 2 ) { pHated = FindSoldierByProfileID( bMercID, TRUE ); @@ -596,7 +596,7 @@ BOOLEAN WillMercRenew( SOLDIERTYPE *pSoldier, BOOLEAN fSayQuote ) if (!fUnhappy) { // check if death rate is too high - if( MercThinksDeathRateTooHigh( pSoldier-> ubProfile ) ) + if( MercThinksDeathRateTooHigh( pSoldier->ubProfile ) ) { fUnhappy = TRUE; usReasonQuote = QUOTE_DEATH_RATE_RENEWAL; @@ -641,7 +641,7 @@ BOOLEAN WillMercRenew( SOLDIERTYPE *pSoldier, BOOLEAN fSayQuote ) } else { - SetMercPrecedentQuoteBitStatus( pSoldier->ubProfile , GetQuoteBitNumberFromQuoteID( ( UINT32 ) ( usReasonQuote ) ) ); + SetMercPrecedentQuoteBitStatus( pSoldier->ubProfile , GetQuoteBitNumberFromQuoteID( ( UINT32 ) ( usReasonQuote ) ) ); } } } @@ -682,7 +682,7 @@ BOOLEAN WillMercRenew( SOLDIERTYPE *pSoldier, BOOLEAN fSayQuote ) if( ( SoldierWantsToDelayRenewalOfContract( pSoldier ) ) ) { // has a new job lined up - HandleImportantMercQuote( pSoldier, QUOTE_DELAY_CONTRACT_RENEWAL ); + HandleImportantMercQuote( pSoldier, QUOTE_DELAY_CONTRACT_RENEWAL ); } else */ @@ -717,11 +717,11 @@ void HandleSoldierLeavingWithLowMorale( SOLDIERTYPE *pSoldier ) void HandleSoldierLeavingForAnotherContract( SOLDIERTYPE *pSoldier ) { - if (pSoldier->fSignedAnotherContract) + if (pSoldier->flags.fSignedAnotherContract) { // merc goes to work elsewhere gMercProfiles[ pSoldier->ubProfile ].bMercStatus = MERC_WORKING_ELSEWHERE; - gMercProfiles[ pSoldier->ubProfile ].uiDayBecomesAvailable += 1 + Random(6 + (pSoldier->bExpLevel / 2) ); // 1-(6 to 11) days + gMercProfiles[ pSoldier->ubProfile ].uiDayBecomesAvailable += 1 + Random(6 + (pSoldier->stats.bExpLevel / 2) ); // 1-(6 to 11) days } } @@ -738,11 +738,11 @@ BOOLEAN SoldierWantsToDelayRenewalOfContract( SOLDIERTYPE *pSoldier ) // does the soldier want to delay renew of contract, possibly due to poor performance by player if( pSoldier->ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC ) return( FALSE ); - + // type of contract the merc had - bTypeOfCurrentContract = pSoldier -> bTypeOfLastContract; + bTypeOfCurrentContract = pSoldier->bTypeOfLastContract; iLeftTimeOnContract = pSoldier->iEndofContractTime - GetWorldTotalMin(); - + // grab tolerance switch( bTypeOfCurrentContract ) { @@ -783,14 +783,14 @@ void CheckIfMercGetsAnotherContract( SOLDIERTYPE *pSoldier ) if( pSoldier->ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC ) return; - // ATE: check time we have and see if we can accept new contracts.... - if ( GetWorldTotalMin() <= (UINT32) pSoldier->iTimeCanSignElsewhere ) - { - return; - } + // ATE: check time we have and see if we can accept new contracts.... + if ( GetWorldTotalMin() <= (UINT32) pSoldier->iTimeCanSignElsewhere ) + { + return; + } // if he doesn't already have another contract - if (!pSoldier->fSignedAnotherContract) + if (!pSoldier->flags.fSignedAnotherContract) { // chance depends on how much time he has left in his contract, and his experience level (determines demand) uiFullDaysRemaining = (pSoldier->iEndofContractTime - GetWorldTotalMin()) / (24 * 60); @@ -820,36 +820,36 @@ void CheckIfMercGetsAnotherContract( SOLDIERTYPE *pSoldier ) } // multiply by experience level - iChance *= pSoldier->bExpLevel; + iChance *= pSoldier->stats.bExpLevel; if( (INT32) Random( 100 ) < iChance ) { // B'bye! - pSoldier->fSignedAnotherContract = TRUE; + pSoldier->flags.fSignedAnotherContract = TRUE; } } } -//for ubRemoveType pass in the enum from the .h, ( MERC_QUIT, MERC_FIRED ) +//for ubRemoveType pass in the enum from the .h, ( MERC_QUIT, MERC_FIRED ) BOOLEAN BeginStrategicRemoveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fAddRehireButton ) { InterruptTime( ); PauseGame(); LockPauseState( 8 ); - - //if the soldier may have some special action when he/she leaves the party, handle it - HandleUniqueEventWhenPlayerLeavesTeam( pSoldier ); - // IF the soldier is an EPC, don't ask about equipment - if ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC ) - { - UnEscortEPC( pSoldier ); - } - else - { - NotifyPlayerOfMercDepartureAndPromptEquipmentPlacement( pSoldier, fAddRehireButton ); - } + //if the soldier may have some special action when he/she leaves the party, handle it + HandleUniqueEventWhenPlayerLeavesTeam( pSoldier ); + + // IF the soldier is an EPC, don't ask about equipment + if ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC ) + { + UnEscortEPC( pSoldier ); + } + else + { + NotifyPlayerOfMercDepartureAndPromptEquipmentPlacement( pSoldier, fAddRehireButton ); + } return( TRUE ); } @@ -863,7 +863,7 @@ BOOLEAN StrategicRemoveMerc( SOLDIERTYPE *pSoldier ) { EndCurrentContractRenewal( ); } - + // ATE: Determine which HISTORY ENTRY to use... if ( pSoldier->ubLeaveHistoryCode == 0 ) { @@ -874,7 +874,7 @@ BOOLEAN StrategicRemoveMerc( SOLDIERTYPE *pSoldier ) ubHistoryCode = pSoldier->ubLeaveHistoryCode; //if the soldier is DEAD - if( pSoldier->bLife <= 0 ) + if( pSoldier->stats.bLife <= 0 ) { AddCharacterToDeadList( pSoldier ); } @@ -894,7 +894,7 @@ BOOLEAN StrategicRemoveMerc( SOLDIERTYPE *pSoldier ) if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__NPC ) { - SetupProfileInsertionDataForSoldier( pSoldier ); + SetupProfileInsertionDataForSoldier( pSoldier ); } //remove him from the soldier structure @@ -911,7 +911,7 @@ BOOLEAN StrategicRemoveMerc( SOLDIERTYPE *pSoldier ) { // remove him from any existing merc slot he could be in RemoveMercSlot( pSoldier ); - TakeSoldierOutOfVehicle( pSoldier ); + TakeSoldierOutOfVehicle( pSoldier ); } } @@ -937,7 +937,7 @@ BOOLEAN StrategicRemoveMerc( SOLDIERTYPE *pSoldier ) //add an entry in the history page for the firing/quiting of the merc // ATE: Don't do this if they are already dead! - if ( !( pSoldier->uiStatusFlags & SOLDIER_DEAD ) ) + if ( !( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) ) { AddHistoryToPlayersLog( ubHistoryCode, pSoldier->ubProfile, GetWorldTotalMin(), pSoldier->sSectorX, pSoldier->sSectorY ); } @@ -955,7 +955,7 @@ BOOLEAN StrategicRemoveMerc( SOLDIERTYPE *pSoldier ) CalculateMedicalDepositRefund( pSoldier ); } - //remove the merc from the tactical + //remove the merc from the tactical TacticalRemoveSoldier( pSoldier->ubID ); // Check if we should remove loaded world... @@ -973,7 +973,7 @@ BOOLEAN StrategicRemoveMerc( SOLDIERTYPE *pSoldier ) // stop time compression so player can react to the departure StopTimeCompression(); - // WDS: This allows for replacing dead IMP mercs. See "BtnIMPBeginScreenDoneCallback" in "IMP Begin Screen.cpp" + // WDS: This allows for replacing dead IMP mercs. See "BtnIMPBeginScreenDoneCallback" in "IMP Begin Screen.cpp" if( ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__PLAYER_CHARACTER ) && ( gMercProfiles[ pSoldier->ubProfile ].bMercStatus == MERC_IS_DEAD ) ) { // Replace the name with an empty string @@ -982,7 +982,7 @@ BOOLEAN StrategicRemoveMerc( SOLDIERTYPE *pSoldier ) // ATE: update team panels.... UpdateTeamPanelAssignments( ); - + // And unpause the @#$@#$ interface UnLockPauseState(); UnPauseGame(); @@ -1000,7 +1000,7 @@ void CalculateMedicalDepositRefund( SOLDIERTYPE *pSoldier ) return; //if the merc is at full health, refund the full medical deposit - if( pSoldier->bLife == pSoldier->bLifeMax ) + if( pSoldier->stats.bLife == pSoldier->stats.bLifeMax ) { //add an entry in the finacial page for the FULL refund of the medical deposit // use the medical deposit in pSoldier, not in profile, which goes up with leveling @@ -1010,7 +1010,7 @@ void CalculateMedicalDepositRefund( SOLDIERTYPE *pSoldier ) AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_REFUND, AIM_MEDICAL_DEPOSIT_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), pSoldier->usMedicalDeposit, pSoldier->ubProfile ); } //else if the merc is a dead, refund NOTHING!! - else if( pSoldier->bLife <= 0 ) + else if( pSoldier->stats.bLife <= 0 ) { //add an entry in the finacial page for NO refund of the medical deposit //AddTransactionToPlayersBook( NO_MEDICAL_REFUND, pSoldier->ubProfile, GetWorldTotalMin(), 0 ); @@ -1023,7 +1023,7 @@ void CalculateMedicalDepositRefund( SOLDIERTYPE *pSoldier ) else { // use the medical deposit in pSoldier, not in profile, which goes up with leveling - iRefundAmount = (INT32) ( ( pSoldier->bLife / ( FLOAT ) pSoldier->bLifeMax ) * pSoldier->usMedicalDeposit + 0.5 ); + iRefundAmount = (INT32) ( ( pSoldier->stats.bLife / ( FLOAT ) pSoldier->stats.bLifeMax ) * pSoldier->usMedicalDeposit + 0.5 ); //add an entry in the finacial page for a PARTIAL refund of the medical deposit AddTransactionToPlayersBook( PARTIAL_MEDICAL_REFUND, pSoldier->ubProfile, GetWorldTotalMin(), iRefundAmount ); @@ -1056,12 +1056,12 @@ void NotifyPlayerOfMercDepartureAndPromptEquipmentPlacement( SOLDIERTYPE *pSoldi pLeaveSoldier = pSoldier; - if( pSoldier->fSignedAnotherContract == TRUE ) + if( pSoldier->flags.fSignedAnotherContract == TRUE ) { fAddRehireButton = FALSE; } - if( pSoldier->fSignedAnotherContract == TRUE ) + if( pSoldier->flags.fSignedAnotherContract == TRUE ) { fAddRehireButton = FALSE; } @@ -1086,9 +1086,9 @@ void NotifyPlayerOfMercDepartureAndPromptEquipmentPlacement( SOLDIERTYPE *pSoldi } // check if drassen controlled - else if( StrategicMap[ ( AIRPORT_X + ( MAP_WORLD_X * AIRPORT_Y ) ) ].fEnemyControlled == FALSE ) + else if( StrategicMap[ ( AIRPORT_X + ( MAP_WORLD_X * AIRPORT_Y ) ) ].fEnemyControlled == FALSE ) { - + if( ( pSoldier->sSectorX == AIRPORT_X ) && ( pSoldier->sSectorY == AIRPORT_Y ) && ( pSoldier->bSectorZ == 0 ) ) { if( gMercProfiles[ pSoldier->ubProfile ].bSex == MALE ) @@ -1114,7 +1114,7 @@ void NotifyPlayerOfMercDepartureAndPromptEquipmentPlacement( SOLDIERTYPE *pSoldi { swprintf( sString, pMercSheLeaveString[ 0 ], pSoldier->name, zShortTownIDString ); } - + } } else @@ -1151,13 +1151,13 @@ void NotifyPlayerOfMercDepartureAndPromptEquipmentPlacement( SOLDIERTYPE *pSoldi if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) { if( fInSector == FALSE ) - { + { // set up for mapscreen DoMapMessageBox( MSG_BOX_BASIC_STYLE, sString, MAP_SCREEN, ( UINT16 )( ( fAddRehireButton ? MSG_BOX_FLAG_GENERICCONTRACT : MSG_BOX_FLAG_GENERIC ) ), MercDepartEquipmentBoxCallBack ); } else { - DoMapMessageBox( MSG_BOX_BASIC_STYLE, sString, MAP_SCREEN, ( UINT16 )( ( fAddRehireButton ? MSG_BOX_FLAG_OKCONTRACT : MSG_BOX_FLAG_OK ) ), MercDepartEquipmentBoxCallBack ); + DoMapMessageBox( MSG_BOX_BASIC_STYLE, sString, MAP_SCREEN, ( UINT16 )( ( fAddRehireButton ? MSG_BOX_FLAG_OKCONTRACT : MSG_BOX_FLAG_OK ) ), MercDepartEquipmentBoxCallBack ); } } @@ -1166,15 +1166,15 @@ void NotifyPlayerOfMercDepartureAndPromptEquipmentPlacement( SOLDIERTYPE *pSoldi if( fInSector == FALSE ) { // set up for all otherscreens - DoMessageBox( MSG_BOX_BASIC_STYLE, sString, guiCurrentScreen, ( UINT16 ) ( MSG_BOX_FLAG_USE_CENTERING_RECT | ( fAddRehireButton ? MSG_BOX_FLAG_GENERICCONTRACT : MSG_BOX_FLAG_GENERIC ) ), MercDepartEquipmentBoxCallBack, &pCenteringRect ); + DoMessageBox( MSG_BOX_BASIC_STYLE, sString, guiCurrentScreen, ( UINT16 ) ( MSG_BOX_FLAG_USE_CENTERING_RECT | ( fAddRehireButton ? MSG_BOX_FLAG_GENERICCONTRACT : MSG_BOX_FLAG_GENERIC ) ), MercDepartEquipmentBoxCallBack, &pCenteringRect ); } else { - DoMessageBox( MSG_BOX_BASIC_STYLE, sString, guiCurrentScreen, ( UINT16 ) ( MSG_BOX_FLAG_USE_CENTERING_RECT | ( fAddRehireButton ? MSG_BOX_FLAG_OKCONTRACT : MSG_BOX_FLAG_OK ) ) , MercDepartEquipmentBoxCallBack, &pCenteringRect ); + DoMessageBox( MSG_BOX_BASIC_STYLE, sString, guiCurrentScreen, ( UINT16 ) ( MSG_BOX_FLAG_USE_CENTERING_RECT | ( fAddRehireButton ? MSG_BOX_FLAG_OKCONTRACT : MSG_BOX_FLAG_OK ) ) , MercDepartEquipmentBoxCallBack, &pCenteringRect ); } } - - if( pSoldier->fSignedAnotherContract == TRUE ) + + if( pSoldier->flags.fSignedAnotherContract == TRUE ) { //fCurrentMercFired = FALSE; } @@ -1193,7 +1193,7 @@ void MercDepartEquipmentBoxCallBack( UINT8 bExitValue ) { // yep (NOTE that this passes the SOLDIER index, not the PROFILE index as the others do) HandleLeavingOfEquipmentInCurrentSector( pLeaveSoldier->ubID ); - + // aim merc will say goodbye when leaving if( ( pLeaveSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) && ( ubQuitType != HISTORY_MERC_FIRED ) ) { @@ -1205,7 +1205,7 @@ void MercDepartEquipmentBoxCallBack( UINT8 bExitValue ) HandleExtendMercsContract( pLeaveSoldier ); return; } - else if( bExitValue == MSG_BOX_RETURN_YES ) + else if( bExitValue == MSG_BOX_RETURN_YES ) { // yep (NOTE that this passes the SOLDIER index, not the PROFILE index as the others do) HandleLeavingOfEquipmentInCurrentSector( pLeaveSoldier->ubID ); @@ -1265,7 +1265,7 @@ BOOLEAN HandleFiredDeadMerc( SOLDIERTYPE *pSoldier ) SET_PALETTEREP_ID ( Corpse.HeadPal, pSoldier->HeadPal ); SET_PALETTEREP_ID ( Corpse.VestPal, pSoldier->VestPal ); SET_PALETTEREP_ID ( Corpse.SkinPal, pSoldier->SkinPal ); - SET_PALETTEREP_ID ( Corpse.PantsPal, pSoldier->PantsPal ); + SET_PALETTEREP_ID ( Corpse.PantsPal, pSoldier->PantsPal ); Corpse.bDirection = pSoldier->ubDirection; @@ -1301,12 +1301,12 @@ void HandleExtendMercsContract( SOLDIERTYPE *pSoldier ) pContractReHireSoldier = pSoldier; uiContractTimeMode = giTimeCompressMode; } - + fTeamPanelDirty = TRUE; fCharacterInfoPanelDirty = TRUE; SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE, 1, MAP_SCREEN, 0, 0, 0 ); - + CheckIfSalaryIncreasedAndSayQuote( pSoldier, TRUE ); SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE, 0 ,MAP_SCREEN, 0, 0, 0 ); @@ -1339,9 +1339,9 @@ void FindOutIfAnyMercAboutToLeaveIsGonnaRenew( void ) for( iCounter = 0; iCounter < iNumberOnTeam; iCounter++ ) { pSoldier = &Menptr[ iCounter ]; - + // valid soldier? - if( ( pSoldier->bActive == FALSE ) || ( pSoldier->bLife == 0 ) || ( pSoldier->bAssignment == IN_TRANSIT ) ||( pSoldier->bAssignment == ASSIGNMENT_POW ) ) + if( ( pSoldier->bActive == FALSE ) || ( pSoldier->stats.bLife == 0 ) || ( pSoldier->bAssignment == IN_TRANSIT ) ||( pSoldier->bAssignment == ASSIGNMENT_POW ) ) { // no continue; @@ -1392,7 +1392,7 @@ void FindOutIfAnyMercAboutToLeaveIsGonnaRenew( void ) // OK, he does not want to renew....... HandleImportantMercQuote( pSoldierWhoWillQuit, QUOTE_MERC_LEAVING_ALSUCO_SOON ); - AddReasonToWaitingListQueue( CONTRACT_EXPIRE_WARNING_REASON ); + AddReasonToWaitingListQueue( CONTRACT_EXPIRE_WARNING_REASON ); TacticalCharacterDialogueWithSpecialEvent( pSoldierWhoWillQuit, 0, DIALOGUE_SPECIAL_EVENT_SHOW_UPDATE_MENU, 0,0 ); pSoldierWhoWillQuit->ubContractRenewalQuoteCode = SOLDIER_CONTRACT_RENEW_QUOTE_115_USED; @@ -1409,7 +1409,7 @@ void FindOutIfAnyMercAboutToLeaveIsGonnaRenew( void ) HandleImportantMercQuote( MercPtrs[ ubPotentialMercs[ ubChosenMerc ] ], QUOTE_CONTRACTS_OVER ); SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,0 ,MAP_SCREEN ,0 ,0 ,0 ); - AddReasonToWaitingListQueue( CONTRACT_EXPIRE_WARNING_REASON ); + AddReasonToWaitingListQueue( CONTRACT_EXPIRE_WARNING_REASON ); TacticalCharacterDialogueWithSpecialEvent( MercPtrs[ ubPotentialMercs[ ubChosenMerc ] ], 0, DIALOGUE_SPECIAL_EVENT_SHOW_UPDATE_MENU, 0,0 ); MercPtrs[ ubPotentialMercs[ ubChosenMerc ] ]->ubContractRenewalQuoteCode = SOLDIER_CONTRACT_RENEW_QUOTE_89_USED; @@ -1446,13 +1446,13 @@ void HandleNotifyPlayerCanAffordInsurance( SOLDIERTYPE *pSoldier, UINT8 ubLength // now pop up the message box DoScreenIndependantMessageBox( sString, MSG_BOX_FLAG_YESNO, ExtendMercInsuranceContractCallBack ); - + return; } void ExtendMercInsuranceContractCallBack( UINT8 bExitValue ) { - if( bExitValue == MSG_BOX_RETURN_YES ) + if( bExitValue == MSG_BOX_RETURN_YES ) { PurchaseOrExtendInsuranceForSoldier( gpInsuranceSoldier, gubContractLength ); } @@ -1507,7 +1507,7 @@ BOOLEAN ContractIsExpiring( SOLDIERTYPE *pSoldier ) if ( GetWorldHour( ) == uiCheckHour ) { // All's good for go! - return( TRUE ); + return( TRUE ); } } @@ -1529,10 +1529,10 @@ BOOLEAN ContractIsGoingToExpireSoon( SOLDIERTYPE *pSoldier ) if ( GetWorldHour( ) >= ( uiCheckHour - 2 ) ) { // All's good for go! - return( TRUE ); + return( TRUE ); } } return( FALSE ); -} \ No newline at end of file +} diff --git a/Strategic/MilitiaSquads.cpp b/Strategic/MilitiaSquads.cpp index 848b2c4b..0b70f75e 100644 --- a/Strategic/MilitiaSquads.cpp +++ b/Strategic/MilitiaSquads.cpp @@ -48,9 +48,9 @@ #define BASE_DIR_PRIORITY 5 // little chance to move if below minimum -//#define MINIMUM_MILITIA_SQUAD_SIZE 10 +//#define MINIMUM_MILITIA_SQUAD_SIZE 10 // should be 2* Minimum -//#define MAXIMUM_MILITIA_SQUAD_SIZE 30 +//#define MAXIMUM_MILITIA_SQUAD_SIZE 30 //#define MAXIMUM_MILITIA_SQUAD_SIZE_BATTLE MAXIMUM_MILITIA_SQUAD_SIZE #define DIR_WITH_UNFULL_SQUAD_RATING_BONUS 100 @@ -63,7 +63,7 @@ #define DIR_SOUTH 2 #define DIR_WEST 3 -INT32 iRestrictedSectorArraySize; +INT32 iRestrictedSectorArraySize; UINT32 gRestrictMilitia[256]; UINT8 gpAttackDirs[5][4]; // 0. Green Militia 1. Regular Militia 2. Elite Militia 3. Insertion code @@ -87,16 +87,16 @@ BOOLEAN PlayerMercsInSector_MSE( UINT8 ubSectorX, UINT8 ubSectorY, BOOLEAN fDont while( pGroup ) { if( pGroup->fPlayer )// && !pGroup->fBetweenSectors) - { + { if ( ( pGroup->ubSectorX == ubSectorX && pGroup->ubSectorY == ubSectorY && pGroup->ubSectorZ == 0 ) || - ( !fDontConsiderNextSector && ( pGroup->ubNextX == ubSectorX && pGroup->ubNextY == ubSectorY && pGroup->ubSectorZ == 0 ) ) ) + ( !fDontConsiderNextSector && ( pGroup->ubNextX == ubSectorX && pGroup->ubNextY == ubSectorY && pGroup->ubSectorZ == 0 ) ) ) { //we have a group, make sure that it isn't a group containing only dead members. pPlayer = pGroup->pPlayerList; while( pPlayer ) { // robots count as mercs here, because they can fight, but vehicles don't - if( ( pPlayer->pSoldier->bLife ) && !( pPlayer->pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if( ( pPlayer->pSoldier->stats.bLife ) && !( pPlayer->pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { ubNumMercs++; } @@ -121,7 +121,7 @@ UINT8 GetEnemyGroupIdInSector( INT16 sMapX, INT16 sMapY ) if( curr->ubSectorX == sMapX && curr->ubSectorY == sMapY && !curr->fPlayer ) if( !curr->ubGroupID ) return curr->ubGroupID; - else + else ubRes = curr->ubGroupID; curr = curr->next; } @@ -141,7 +141,7 @@ UINT8 CountMilitia(SECTORINFO *pSectorInfo) void GenerateMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY ) { SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); - + StrategicAddMilitiaToSector( sTMapX, sTMapY, GREEN_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] / gGameExternalOptions.guiDivOfOriginalMilitia); StrategicAddMilitiaToSector( sTMapX, sTMapY, REGULAR_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] / gGameExternalOptions.guiDivOfOriginalMilitia); StrategicAddMilitiaToSector( sTMapX, sTMapY, ELITE_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ] / gGameExternalOptions.guiDivOfOriginalMilitia); @@ -149,9 +149,20 @@ void GenerateMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY ) pSectorInfo = &( SectorInfo[ SECTOR( sTMapX, sTMapY ) ] ); while( CountMilitia(pSectorInfo) > gGameExternalOptions.guiMaxMilitiaSquadSize ) - if(pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA])--pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA];else - if(pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA])--pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA];else - if(pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA])--pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA]; + { + if(pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA]) + { + --pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA]; + } + else if(pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA]) + { + --pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA]; + } + else if(pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA]) + { + --pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA]; + } + } // Update the militia if the current sector is affected if (gfStrategicMilitiaChangesMade) @@ -165,7 +176,7 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL { SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); SECTORINFO *pTSectorInfo = &( SectorInfo[ SECTOR( sTMapX, sTMapY ) ] ); - + StrategicAddMilitiaToSector( sTMapX, sTMapY, GREEN_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] ); StrategicAddMilitiaToSector( sTMapX, sTMapY, REGULAR_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] ); StrategicAddMilitiaToSector( sTMapX, sTMapY, ELITE_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ] ); @@ -176,12 +187,23 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL while( !fAlternativeMax && CountMilitia(pTSectorInfo) > gGameExternalOptions.guiMaxMilitiaSquadSize || fAlternativeMax && CountMilitia(pTSectorInfo) > gGameExternalOptions.guiMaxMilitiaSquadSizeBattle ) + { if(pTSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA]) - {--pTSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA];++pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA];}else - if(pTSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA]) - {--pTSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA];++pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA];}else - if(pTSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA]) - {--pTSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA];++pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA];} + { + --pTSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA]; + ++pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA]; + } + else if(pTSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA]) + { + --pTSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA]; + ++pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA]; + } + else if(pTSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA]) + { + --pTSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA]; + ++pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA]; + } + } if (gfStrategicMilitiaChangesMade) { @@ -245,7 +267,7 @@ UINT16 CountDirectionEnemyRating( INT16 sMapX, INT16 sMapY, UINT8 uiDir ) default: return 0; } - + //for( uiSector = 0 ; uiSector < 256 ; ++uiSector ) for( sLMX = 0; sLMX < 16 ; ++sLMX ) for( sLMY = 0; sLMY < 16 ; ++sLMY ) @@ -263,14 +285,14 @@ UINT16 CountDirectionEnemyRating( INT16 sMapX, INT16 sMapY, UINT8 uiDir ) else ddAngle = atan2( (double)(sLMY - sMapY), (double)(sLMX - sMapX) ); if( ddAngle < 0 && uiDir == DIR_WEST )ddAngle += pix2; - + // is it in a right direction? if( ddAngle >= ddMinAngle && ddAngle <= ddMaxAngle ) { DOUBLE ddDistance = sqrt( pow( (double)(sLMY - sMapY), 2 ) + pow( (double)(sLMX - sMapX), 2 ) ); ddRes += (DOUBLE)uiSumOfEnemyTroops / pow( ddDistance, 2 ); - + } } } @@ -310,17 +332,17 @@ UINT16 CountDirectionRating( INT16 sMapX, INT16 sMapY, UINT8 uiDir ) if( CountAllMilitiaInSector( sDMapX, sDMapY ) && (UINT32)( CountAllMilitiaInSector( sDMapX, sDMapY ) + CountAllMilitiaInSector( sMapX, sMapY ) ) <= gGameExternalOptions.guiMaxMilitiaSquadSize ) iRes += DIR_WITH_UNFULL_SQUAD_RATING_BONUS; - - if( NumEnemiesInSector( sDMapX, sDMapY ) ) + + if( NumEnemiesInSector( sDMapX, sDMapY ) ) { // if( GetTownIdForSector( sMapX, sMapY ) == BLANK_SECTOR ) iDiff = (INT32)( (FLOAT)iRes * ( (FLOAT)CountAllMilitiaInFiveSectors( sDMapX, sDMapY ) / (FLOAT)NumEnemiesInFiveSectors( sDMapX, sDMapY ) ) ); - // else + // else // iDiff = iRes * ( (FLOAT)CountAllMilitiaInFiveSectors( sMapX, sMapY ) / DIV_OF_ORIGINAL_MILITIA / (FLOAT)NumEnemiesInFiveSectors( sDMapX, sDMapY ) ); - if( iDiff > (INT32)( (FLOAT)DIR_MIN_DIF * (FLOAT)iRes ) ) + if( iDiff > (INT32)( (FLOAT)DIR_MIN_DIF * (FLOAT)iRes ) ) iRes = iDiff; - else + else iRes = 0; } @@ -344,7 +366,7 @@ BOOLEAN CheckStandardConditionsForDirection( INT16 sSMapX, INT16 sSMapY, INT16 s if( !fForBattle && gfMSBattle && NumEnemiesInSector( sMapX, sMapY ) ) return FALSE; - return (GetTownIdForSector( sMapX, sMapY ) == BLANK_SECTOR || fWithCities) && !IsThisSectorASAMSector( sMapX, sMapY , 0 ) && + return (GetTownIdForSector( sMapX, sMapY ) == BLANK_SECTOR || fWithCities) && !IsThisSectorASAMSector( sMapX, sMapY , 0 ) && (GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR || !fOnlyCitySectors);// && // ( !NumEnemiesInSector( sMapX, sMapY ) || GetEnemyGroupIdInSector(sMapX, sMapY ) || fForBattle ) && // ( fForBattle || CountAllMilitiaInSector( sMapX, sMapY ) < gGameExternalOptions.guiMaxMilitiaSquadSize || PlayerMercsInSector( sMapX, sMapY, 0 ) ) @@ -360,7 +382,7 @@ void GenerateDirectionInfos( INT16 sMapX, INT16 sMapY, UINT8* uiDirNumber, UINT1 if(CheckStandardConditionsForDirection( sMapX, sMapY, sMapX, sMapY - 1, fWithCities, fForBattle, fOnlyCitySectors ) ) { - pMoveDir[ *uiDirNumber ][0] = SECTOR( sMapX, sMapY - 1 ); + pMoveDir[ *uiDirNumber ][0] = SECTOR( sMapX, sMapY - 1 ); if( fForBattle ) pMoveDir[ *uiDirNumber ][1] = 0; @@ -375,9 +397,9 @@ void GenerateDirectionInfos( INT16 sMapX, INT16 sMapY, UINT8* uiDirNumber, UINT1 ++(*uiDirNumber); } - if(CheckStandardConditionsForDirection( sMapX, sMapY, sMapX - 1, sMapY, fWithCities, fForBattle, fOnlyCitySectors )) + if(CheckStandardConditionsForDirection( sMapX, sMapY, sMapX - 1, sMapY, fWithCities, fForBattle, fOnlyCitySectors )) { - pMoveDir[ *uiDirNumber ][0] = SECTOR( sMapX - 1, sMapY ); + pMoveDir[ *uiDirNumber ][0] = SECTOR( sMapX - 1, sMapY ); if( fForBattle ) pMoveDir[ *uiDirNumber ][1] = 0; @@ -392,10 +414,10 @@ void GenerateDirectionInfos( INT16 sMapX, INT16 sMapY, UINT8* uiDirNumber, UINT1 ++(*uiDirNumber); } - if(CheckStandardConditionsForDirection( sMapX, sMapY, sMapX, sMapY + 1, fWithCities, fForBattle, fOnlyCitySectors )) + if(CheckStandardConditionsForDirection( sMapX, sMapY, sMapX, sMapY + 1, fWithCities, fForBattle, fOnlyCitySectors )) { - pMoveDir[ *uiDirNumber ][0] = SECTOR( sMapX, sMapY + 1 ); - + pMoveDir[ *uiDirNumber ][0] = SECTOR( sMapX, sMapY + 1 ); + if( fForBattle ) pMoveDir[ *uiDirNumber ][1] = 0; else @@ -409,10 +431,10 @@ void GenerateDirectionInfos( INT16 sMapX, INT16 sMapY, UINT8* uiDirNumber, UINT1 ++(*uiDirNumber); } - if(CheckStandardConditionsForDirection( sMapX, sMapY, sMapX + 1, sMapY, fWithCities, fForBattle, fOnlyCitySectors )) + if(CheckStandardConditionsForDirection( sMapX, sMapY, sMapX + 1, sMapY, fWithCities, fForBattle, fOnlyCitySectors )) { - pMoveDir[ *uiDirNumber ][0] = SECTOR( sMapX + 1, sMapY ); - + pMoveDir[ *uiDirNumber ][0] = SECTOR( sMapX + 1, sMapY ); + if( fForBattle ) pMoveDir[ *uiDirNumber ][1] = 0; else @@ -475,7 +497,7 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY ) if( CheckInBlockMoveList( sMapX, sMapY ) )return; uiMilitiaCount = CountMilitia(pSectorInfo); - + if( !uiMilitiaCount )return; // Kaiden: Moved Create Militia code into CreateMilitiaSquads @@ -483,7 +505,7 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY ) // If it's time, and this is a city sector create a new group. // But only if we're not training our own. - if( (!gGameExternalOptions.gfmusttrainroaming) && ( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR ) ) + if( (!gGameExternalOptions.gfmusttrainroaming) && ( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR ) ) { if (GetWorldDay( ) < gGameExternalOptions.guiAllowMilitiaGroupsDelay) return; @@ -492,7 +514,6 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY ) return; CreateMilitiaSquads( sMapX, sMapY ); - if (gfStrategicMilitiaChangesMade) { ResetMilitia(); @@ -501,8 +522,8 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY ) // moving squad, if it is not a SAM site - if( ( GetTownIdForSector( sMapX, sMapY ) == BLANK_SECTOR ) && (!IsThisSectorASAMSector( sMapX, sMapY, 0 )) ) - { + if( ( GetTownIdForSector( sMapX, sMapY ) == BLANK_SECTOR ) && (!IsThisSectorASAMSector( sMapX, sMapY, 0 )) ) + { if( !PlayerMercsInSector_MSE( (UINT8)sMapX, (UINT8)sMapY, FALSE ) ) // and there's no player's mercs in the sector { if( GetWorldHour() % 2 )return; @@ -514,8 +535,8 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY ) { for( x = 1; x < uiDirNumber ; ++x )pMoveDir[x][1] += pMoveDir[x-1][1]; // ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%ld,%ld", x, pMoveDir[x][1]); - - iRandom = Random( pMoveDir[ uiDirNumber - 1 ][1] + + + iRandom = Random( pMoveDir[ uiDirNumber - 1 ][1] + ( uiMilitiaCount >= gGameExternalOptions.guiMinMilitiaSquadSize ? CHANCE_TO_MOVE_A_SQUAD : CHANCE_TO_MOVE_AN_UNFULL_SQUAD ) ); //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Roll %ld", iRandomRes); @@ -528,13 +549,13 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY ) iRandomRes = x; break; } - + // "Decided" to stay here if(iRandomRes >= uiDirNumber) return; //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%ld,%ld:Dir count %ld, Rand %ld. Go to %ld,%ld. Have %ld militia men", sMapX, sMapY, uiDirNumber, iRandomRes, SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ), uiMilitiaCount); - //Kaiden: if Restricted Sectors List option is turned on, + //Kaiden: if Restricted Sectors List option is turned on, // militia can't move to any sectors in the list. // Unless they are following a group of mercs. if (gGameExternalOptions.gflimitedRoaming) @@ -552,6 +573,7 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY ) Assert(targetY >= 0 && targetY < MAP_WORLD_Y); MoveMilitiaSquad( sMapX, sMapY, targetX, targetY, FALSE ); AddToBlockMoveList( targetX, targetY ); + if ( gfStrategicMilitiaChangesMade) { ResetMilitia(); @@ -562,7 +584,7 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY ) extern GROUP *gpBattleGroup; gpBattleGroup = GetGroup( GetEnemyGroupIdInSector( targetX, targetY ) ); /* GROUP* pEnemyGroup = GetGroup( GetEnemyGroupIdInSector( targetX, targetY ) ); - + if(pEnemyGroup && pEnemyGroup->ubGroupID) { //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Attacking from %ld,%ld to %ld,%ld - enemy's group id %ld", sMapX, sMapY, targetX, SECTORY( pMoveDir[ iRandomRes ][0], pEnemyGroup->ubGroupID )); @@ -573,9 +595,9 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY ) pEnemyGroup->ubNextX = targetX; pEnemyGroup->ubNextY = targetY; - */ + */ gfMSBattle = TRUE; - + // GroupArrivedAtSector( pEnemyGroup->ubGroupID , TRUE, FALSE ); EnterAutoResolveMode( targetX, targetY ); // } @@ -587,7 +609,7 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY ) } // Kaiden: Roaming Militia Training: - // If we're training roaming militia, + // If we're training roaming militia, // we'll get our squad from here: // Don't need to check for delay, as this function won't be // called if there is a delay set. @@ -595,13 +617,13 @@ void CreateMilitiaSquads(INT16 sMapX, INT16 sMapY ) { UINT16 pMoveDir[4][3]; UINT8 uiDirNumber = 0; - UINT32 iRandomRes = 0, iRandom = 0; + UINT32 iRandomRes = 0; UINT8 x;//,y; SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); UINT8 uiMilitiaCount; - // If we're not allowing roaming groups, + // If we're not allowing roaming groups, // then we're not creating them either. // Remove this if you want to create them // for some other reason. But you also have to @@ -621,7 +643,7 @@ void CreateMilitiaSquads(INT16 sMapX, INT16 sMapY ) if( CheckInBlockMoveList( sMapX, sMapY ) )return; uiMilitiaCount = CountMilitia(pSectorInfo); - + if( !uiMilitiaCount )return; // Create new Militia Squad @@ -642,19 +664,19 @@ void CreateMilitiaSquads(INT16 sMapX, INT16 sMapY ) iRandomRes = x; break; } - + // shouldn't be! if(iRandomRes >= uiDirNumber)iRandomRes = 0; //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%ld,%ld:Dir count %ld, Rand %ld. Go to %ld,%ld", sMapX, sMapY, uiDirNumber, iRandomRes, SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] )); - GenerateMilitiaSquad( sMapX, sMapY, SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ); + GenerateMilitiaSquad( sMapX, sMapY, SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ); AddToBlockMoveList( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ); - + if( NumEnemiesInSector( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ) && CountAllMilitiaInSector( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ) ) { /* GROUP* pEnemyGroup = GetGroup( GetEnemyGroupIdInSector( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ) ); - + if(pEnemyGroup && pEnemyGroup->ubGroupID) { //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Attacking from %ld,%ld to %ld,%ld - enemy's group id %ld", sMapX, sMapY, SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0], pEnemyGroup->ubGroupID )); @@ -668,8 +690,8 @@ void CreateMilitiaSquads(INT16 sMapX, INT16 sMapY ) */ gfMSBattle = TRUE; // GroupArrivedAtSector( pEnemyGroup->ubGroupID , TRUE, FALSE ); - - EnterAutoResolveMode( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ); + + EnterAutoResolveMode( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ); // } } @@ -703,7 +725,7 @@ void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ) guiDirNumber = 0; - GenerateDirectionInfos( sMapX, sMapY, &uiDirNumber, pMoveDir, + GenerateDirectionInfos( sMapX, sMapY, &uiDirNumber, pMoveDir, ( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR ? TRUE : FALSE ), TRUE, FALSE ); ZeroMemory( gpAttackDirs, sizeof( gpAttackDirs ) ); @@ -713,7 +735,7 @@ void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ) gpAttackDirs[ guiDirNumber ][2] = uiNumElite = pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA]; gpAttackDirs[ guiDirNumber ][3] = INSERTION_CODE_CENTER; - guiDirNumber = uiDirNumber + 1; + guiDirNumber = uiDirNumber + 1; x = 0; while( CountMilitia(pSectorInfo ) < gGameExternalOptions.guiMaxMilitiaSquadSizeBattle && @@ -729,7 +751,7 @@ void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ) gpAttackDirs[ x + 1 ][1] += pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA] - uiNumReg; gpAttackDirs[ x + 1 ][2] += pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA] - uiNumElite; gpAttackDirs[ x + 1 ][3] = (UINT8)pMoveDir[ x ][2]; - + uiNumGreen = pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA]; uiNumReg = pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA]; uiNumElite = pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA]; @@ -743,10 +765,10 @@ void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ) } } - // If militia have been moved here, no reason to reset--just add them. If militia have not moved, then no strategic - // changes were made. Either case, this flag should be false. + // If militia have been moved here, no reason to reset--just add them. If militia have not moved, then no strategic + // changes were made. Either case, this flag should be false. gfStrategicMilitiaChangesMade = FALSE; -} + } void MSCallBack( UINT8 ubResult ) { @@ -764,7 +786,7 @@ BOOLEAN IsThereMilitiaInAdjacentSector( INT16 sMapX, INT16 sMapY ) UINT8 x; BOOLEAN fResult = FALSE; - GenerateDirectionInfos( sMapX, sMapY, &uiDirNumber, pMoveDir, + GenerateDirectionInfos( sMapX, sMapY, &uiDirNumber, pMoveDir, ( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR ? TRUE : FALSE ), TRUE, FALSE ); for( x = 0; x < uiDirNumber ; ++x ) @@ -778,7 +800,6 @@ void MilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ) { sMSMapX = sMapX; sMSMapY = sMapY; - SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); if( !gGameExternalOptions.gfAllowMilitiaGroups ) return; @@ -790,7 +811,7 @@ void MilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ) // if( CountAllMilitiaInSector( sMapX, sMapY ) ) MSCallBack( MSG_BOX_RETURN_YES ); // This is no longer a question of simply whether to have a full militia count, but also whether we want - // reinforcements. So if there are any available, always ask. + // reinforcements. So if there are any available, always ask. if( IsThereMilitiaInAdjacentSector( sMapX, sMapY ) ) // && CountAllMilitiaInSector( sMapX, sMapY ) < gGameExternalOptions.guiMaxMilitiaSquadSizeBattle ) DoScreenIndependantMessageBox( gzCWStrings[0], MSG_BOX_FLAG_YESNO, MSCallBack ); } @@ -798,11 +819,11 @@ void MilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ) void MilitiaFollowPlayer( INT16 sMapX, INT16 sMapY, INT16 sDMapX, INT16 sDMapY ) { if( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR || - IsThisSectorASAMSector( sMapX, sMapY, 0 ) || - PlayerMercsInSector_MSE( (UINT8)sMapX, (UINT8)sMapY, TRUE ) )return; + IsThisSectorASAMSector( sMapX, sMapY, 0 ) || + PlayerMercsInSector_MSE( (UINT8)sMapX, (UINT8)sMapY, TRUE ) )return; if( GetTownIdForSector( sDMapX, sDMapY ) != BLANK_SECTOR || - IsThisSectorASAMSector( sDMapX, sDMapY, 0 ) )return; + IsThisSectorASAMSector( sDMapX, sDMapY, 0 ) )return; MoveMilitiaSquad( sMapX, sMapY, sDMapX, sDMapY, FALSE ); diff --git a/Strategic/Player Command.cpp b/Strategic/Player Command.cpp index adeb7905..43750abb 100644 --- a/Strategic/Player Command.cpp +++ b/Strategic/Player Command.cpp @@ -37,7 +37,7 @@ void GetSectorFacilitiesFlags( INT16 sMapX, INT16 sMapY, STR16 sFacilitiesString if( SectorInfo[ SECTOR( sMapX, sMapY ) ].uiFacilitiesFlags == 0 ) { // none - swprintf( sFacilitiesString, L"%s", sFacilitiesStrings[ 0 ] ); + swprintf( sFacilitiesString, L"%s", sFacilitiesStrings[ 0 ] ); return; } @@ -53,7 +53,7 @@ void GetSectorFacilitiesFlags( INT16 sMapX, INT16 sMapY, STR16 sFacilitiesString { if( wcslen( sFacilitiesString ) == 0 ) { - swprintf( sFacilitiesString, L"%s", sFacilitiesStrings[ 2 ] ); + swprintf( sFacilitiesString, L"%s", sFacilitiesStrings[ 2 ] ); } else { @@ -67,7 +67,7 @@ void GetSectorFacilitiesFlags( INT16 sMapX, INT16 sMapY, STR16 sFacilitiesString { if( wcslen( sFacilitiesString ) == 0 ) { - swprintf( sFacilitiesString, L"%s", sFacilitiesStrings[ 3 ] ); + swprintf( sFacilitiesString, L"%s", sFacilitiesStrings[ 3 ] ); } else { @@ -81,7 +81,7 @@ void GetSectorFacilitiesFlags( INT16 sMapX, INT16 sMapY, STR16 sFacilitiesString { if( wcslen( sFacilitiesString ) == 0 ) { - swprintf( sFacilitiesString, L"%s", sFacilitiesStrings[ 5 ] ); + swprintf( sFacilitiesString, L"%s", sFacilitiesStrings[ 5 ] ); } else { @@ -95,7 +95,7 @@ void GetSectorFacilitiesFlags( INT16 sMapX, INT16 sMapY, STR16 sFacilitiesString { if( wcslen( sFacilitiesString ) == 0 ) { - swprintf( sFacilitiesString, L"%s", sFacilitiesStrings[ 6 ] ); + swprintf( sFacilitiesString, L"%s", sFacilitiesStrings[ 6 ] ); } else { @@ -103,7 +103,7 @@ void GetSectorFacilitiesFlags( INT16 sMapX, INT16 sMapY, STR16 sFacilitiesString wcscat( sFacilitiesString, sFacilitiesStrings[ 6 ]); } } - + sFacilitiesString[ wcslen( sFacilitiesString ) ] = 0; return; @@ -138,7 +138,7 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B } */ if( NumHostilesInSector( sMapX, sMapY, bMapZ ) ) - { //too premature: enemies still in sector. + { //too premature: enemies still in sector. return FALSE; } @@ -148,7 +148,7 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B LaptopSaveInfo.fBobbyRSiteCanBeAccessed = TRUE; //If the player has been to Bobbyr when it was down, and we havent already sent email, send him an email - if( LaptopSaveInfo.ubHaveBeenToBobbyRaysAtLeastOnceWhileUnderConstruction == BOBBYR_BEEN_TO_SITE_ONCE && LaptopSaveInfo.ubHaveBeenToBobbyRaysAtLeastOnceWhileUnderConstruction != BOBBYR_ALREADY_SENT_EMAIL ) + if( LaptopSaveInfo.ubHaveBeenToBobbyRaysAtLeastOnceWhileUnderConstruction == BOBBYR_BEEN_TO_SITE_ONCE && LaptopSaveInfo.ubHaveBeenToBobbyRaysAtLeastOnceWhileUnderConstruction != BOBBYR_ALREADY_SENT_EMAIL ) { AddEmail( BOBBYR_NOW_OPEN, BOBBYR_NOW_OPEN_LENGTH, BOBBY_R, GetWorldTotalMin(), -1); LaptopSaveInfo.ubHaveBeenToBobbyRaysAtLeastOnceWhileUnderConstruction = BOBBYR_ALREADY_SENT_EMAIL; @@ -206,7 +206,7 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B { if ( 1 /*!GetSectorFlagStatus( sMapX, sMapY, bMapZ, SF_SECTOR_HAS_BEEN_LIBERATED_ONCE ) */) { - // SAM site liberated for first time, schedule meanwhile + // SAM site liberated for first time, schedule meanwhile HandleMeanWhileEventPostingForSAMLiberation( GetSAMIdFromSector( sMapX, sMapY, bMapZ ) ); } @@ -268,13 +268,13 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B SectorInfo[ SECTOR( sMapX, sMapY ) ].fSurfaceWasEverPlayerControlled = TRUE; } - //KM : Aug 11, 1999 -- Patch fix: Relocated this check so it gets called everytime a sector changes hands, - // even if the sector isn't a SAM site. There is a bug _somewhere_ that fails to update the airspace, - // even though the player controls it. + //KM : Aug 11, 1999 -- Patch fix: Relocated this check so it gets called everytime a sector changes hands, + // even if the sector isn't a SAM site. There is a bug _somewhere_ that fails to update the airspace, + // even though the player controls it. UpdateAirspaceControl( ); // redraw map/income if in mapscreen - fMapPanelDirty = TRUE; + fMapPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; return fWasEnemyControlled; @@ -291,8 +291,8 @@ BOOLEAN SetThisSectorAsEnemyControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, BO UINT8 ubSectorID; //KM : August 6, 1999 Patch fix - // This check was added because this function gets called when player mercs retreat from an unresolved - // battle between militia and enemies. It will get called again AFTER autoresolve is finished. + // This check was added because this function gets called when player mercs retreat from an unresolved + // battle between militia and enemies. It will get called again AFTER autoresolve is finished. if( gfAutomaticallyStartAutoResolve ) { return( FALSE ); @@ -310,7 +310,7 @@ BOOLEAN SetThisSectorAsEnemyControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, BO if ( fWasPlayerControlled ) { if( PlayerMercsInSector( (UINT8)sMapX, (UINT8)sMapY, (UINT8)bMapZ ) ) - { //too premature: Player mercs still in sector. + { //too premature: Player mercs still in sector. return FALSE; } @@ -361,13 +361,13 @@ BOOLEAN SetThisSectorAsEnemyControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, BO NotifyPlayerWhenEnemyTakesControlOfImportantSector( sMapX, sMapY, 0, fContested ); } - // NOTE: Stealing is intentionally OUTSIDE the fWasPlayerControlled branch. This function gets called if new + // NOTE: Stealing is intentionally OUTSIDE the fWasPlayerControlled branch. This function gets called if new // enemy reinforcements arrive, and they deserve another crack at stealing what the first group missed! :-) // stealing should fail anyway 'cause there shouldn't be a temp file for unvisited sectors, but let's check anyway if ( GetSectorFlagStatus( sMapX, sMapY, ( UINT8 ) bMapZ, SF_ALREADY_VISITED ) == TRUE ) { - // enemies can steal items left lying about (random chance). The more there are, the more they take! + // enemies can steal items left lying about (random chance). The more there are, the more they take! ubTheftChance = 5 * NumEnemiesInAnySector( sMapX, sMapY, bMapZ ); // max 90%, some stuff may just simply not get found if (ubTheftChance > 90 ) @@ -386,13 +386,13 @@ BOOLEAN SetThisSectorAsEnemyControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, BO SectorInfo[ SECTOR( sMapX, sMapY ) ].fPlayer[ bMapZ ] = FALSE; } - //KM : Aug 11, 1999 -- Patch fix: Relocated this check so it gets called everytime a sector changes hands, - // even if the sector isn't a SAM site. There is a bug _somewhere_ that fails to update the airspace, - // even though the player controls it. + //KM : Aug 11, 1999 -- Patch fix: Relocated this check so it gets called everytime a sector changes hands, + // even if the sector isn't a SAM site. There is a bug _somewhere_ that fails to update the airspace, + // even though the player controls it. UpdateAirspaceControl( ); // redraw map/income if in mapscreen - fMapPanelDirty = TRUE; + fMapPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; return fWasPlayerControlled; @@ -440,7 +440,7 @@ void MakePlayerPerceptionOfSectorControlCorrect( INT16 sMapX, INT16 sMapY, INT8 { if (bMapZ == 0) { - SectorInfo[ SECTOR( sMapX, sMapY ) ].fPlayer[ bMapZ ] = !( StrategicMap[ CALCULATE_STRATEGIC_INDEX( sMapX, sMapY ) ].fEnemyControlled ); + SectorInfo[ SECTOR( sMapX, sMapY ) ].fPlayer[ bMapZ ] = !( StrategicMap[ CALCULATE_STRATEGIC_INDEX( sMapX, sMapY ) ].fEnemyControlled ); } // else nothing, underground sector control is always up to date, because we don't track control down there @@ -472,5 +472,5 @@ void ReplaceSoldierProfileInPlayerGroup( UINT8 ubGroupID, UINT8 ubOldProfile, UI } curr = curr->next; } - -} \ No newline at end of file + +} diff --git a/Strategic/PreBattle Interface.cpp b/Strategic/PreBattle Interface.cpp index d2b796dc..224854f7 100644 --- a/Strategic/PreBattle Interface.cpp +++ b/Strategic/PreBattle Interface.cpp @@ -141,7 +141,7 @@ extern INT32 giCharInfoButton[ 2 ]; extern void CreateDestroyMapCharacterScrollButtons( void ); extern void UpdateTheStateOfTheNextPrevMapScreenCharacterButtons( void ); -// were we showing the mapscreen inventory when the prebattle interface came up +// were we showing the mapscreen inventory when the prebattle interface came up extern BOOLEAN fShowInventoryFlag; UINT32 guiNumInvolved; @@ -149,18 +149,18 @@ UINT32 guiNumUninvolved; //SAVE START -//Using the ESC key in the PBI will get rid of the PBI and go back to mapscreen, but +//Using the ESC key in the PBI will get rid of the PBI and go back to mapscreen, but //only if the PBI isn't persistant (!gfPersistantPBI). BOOLEAN gfPersistantPBI = FALSE; -//Contains general information about the type of encounter the player is faced with. This -//determines whether or not you can autoresolve the battle or even retreat. This code +//Contains general information about the type of encounter the player is faced with. This +//determines whether or not you can autoresolve the battle or even retreat. This code //dictates the header that is used at the top of the PBI. UINT8 gubEnemyEncounterCode = NO_ENCOUNTER_CODE; -//The autoresolve during tactical battle option needs more detailed information than the -//gubEnemyEncounterCode can provide. The explicit version contains possibly unique codes -//for reasons not normally used in the PBI. For example, if we were fighting the enemy +//The autoresolve during tactical battle option needs more detailed information than the +//gubEnemyEncounterCode can provide. The explicit version contains possibly unique codes +//for reasons not normally used in the PBI. For example, if we were fighting the enemy //in a normal situation, then shot at a civilian, the civilians associated with the victim //would turn hostile, which would disable the ability to autoresolve the battle. BOOLEAN gubExplicitEnemyEncounterCode = NO_ENCOUNTER_CODE; @@ -226,16 +226,16 @@ void ValidateAndCorrectInBattleCounters( GROUP *pLocGroup ) if( ubInvalidGroups || pSector->ubAdminsInBattle || pSector->ubTroopsInBattle || pSector->ubElitesInBattle || pSector->ubCreaturesInBattle ) { CHAR16 str[ 512 ]; - swprintf( str, L"Strategic info warning: Sector 'in battle' counters are not clear when they should be. " - L"If you can provide information on how a previous battle was resolved here or nearby patrol " - L"(auto resolve, tactical battle, cheat keys, or retreat)," - L"please forward that info (no data files necessary) as well as the following code (very important): " - L"G(%02d:%c%d_b%d) A(%02d:%02d) T(%02d:%02d) E(%02d:%02d) C(%02d:%02d)", - ubInvalidGroups, pLocGroup->ubSectorY + 'A' - 1, pLocGroup->ubSectorX, pLocGroup->ubSectorZ, - pSector->ubNumAdmins, pSector->ubAdminsInBattle, - pSector->ubNumTroops, pSector->ubTroopsInBattle, - pSector->ubNumElites, pSector->ubElitesInBattle, - pSector->ubNumCreatures, pSector->ubCreaturesInBattle ); + swprintf( str, L"Strategic info warning: Sector 'in battle' counters are not clear when they should be. " + L"If you can provide information on how a previous battle was resolved here or nearby patrol " + L"(auto resolve, tactical battle, cheat keys, or retreat)," + L"please forward that info (no data files necessary) as well as the following code (very important): " + L"G(%02d:%c%d_b%d) A(%02d:%02d) T(%02d:%02d) E(%02d:%02d) C(%02d:%02d)", + ubInvalidGroups, pLocGroup->ubSectorY + 'A' - 1, pLocGroup->ubSectorX, pLocGroup->ubSectorZ, + pSector->ubNumAdmins, pSector->ubAdminsInBattle, + pSector->ubNumTroops, pSector->ubTroopsInBattle, + pSector->ubNumElites, pSector->ubElitesInBattle, + pSector->ubNumCreatures, pSector->ubCreaturesInBattle ); DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, NULL ); pSector->ubAdminsInBattle = 0; pSector->ubTroopsInBattle = 0; @@ -247,7 +247,7 @@ void ValidateAndCorrectInBattleCounters( GROUP *pLocGroup ) void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; INT32 i; UINT8 ubGroupID = 0; UINT8 ubNumStationaryEnemies = 0; @@ -292,7 +292,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) } } - //If we are currently in the AI Viewer development utility, then remove it first. It automatically + //If we are currently in the AI Viewer development utility, then remove it first. It automatically //returns to the mapscreen upon removal, which is where we want to go. #ifdef JA2BETAVERSION if( guiCurrentScreen == AIVIEWER_SCREEN ) @@ -318,8 +318,8 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) gfUsePersistantPBI = TRUE; return; } - - if( gfTacticalTraversal && (pBattleGroup == gpTacticalTraversalGroup || gbWorldSectorZ > 0) ) + + if( gfTacticalTraversal && (pBattleGroup == gpTacticalTraversalGroup || gbWorldSectorZ > 0) ) { return; } @@ -331,7 +331,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) gfDisplayPotentialRetreatPaths = FALSE; gpBattleGroup = pBattleGroup; - + //calc sector values if( gpBattleGroup ) { @@ -366,7 +366,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) { //We are underground, so no autoresolve allowed pSector = &SectorInfo[ SECTOR( gubPBSectorX, gubPBSectorY ) ]; if( pSector->ubCreaturesInBattle ) - { + { gubExplicitEnemyEncounterCode = FIGHTING_CREATURES_CODE; } else if( pSector->ubAdminsInBattle || pSector->ubTroopsInBattle || pSector->ubElitesInBattle ) @@ -375,19 +375,19 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) } } else if( gubEnemyEncounterCode == ENTERING_ENEMY_SECTOR_CODE || - gubEnemyEncounterCode == ENEMY_ENCOUNTER_CODE || - gubEnemyEncounterCode == ENEMY_AMBUSH_CODE || - gubEnemyEncounterCode == ENEMY_INVASION_CODE || - gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE || - gubEnemyEncounterCode == ENTERING_BLOODCAT_LAIR_CODE || - gubEnemyEncounterCode == CREATURE_ATTACK_CODE ) + gubEnemyEncounterCode == ENEMY_ENCOUNTER_CODE || + gubEnemyEncounterCode == ENEMY_AMBUSH_CODE || + gubEnemyEncounterCode == ENEMY_INVASION_CODE || + gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE || + gubEnemyEncounterCode == ENTERING_BLOODCAT_LAIR_CODE || + gubEnemyEncounterCode == CREATURE_ATTACK_CODE ) { //use same code gubExplicitEnemyEncounterCode = gubEnemyEncounterCode; } - else + else { #ifdef JA2BETAVERSION - DoScreenIndependantMessageBox( L"Can't determine valid reason for battle indicator. Please try to provide information as to when and why this indicator first appeared and send whatever files that may help.", MSG_BOX_FLAG_OK, NULL ); + DoScreenIndependantMessageBox( L"Can't determine valid reason for battle indicator. Please try to provide information as to when and why this indicator first appeared and send whatever files that may help.", MSG_BOX_FLAG_OK, NULL ); #endif gfBlitBattleSectorLocator = FALSE; return; @@ -396,7 +396,8 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) fMapScreenBottomDirty = TRUE; ChangeSelectedMapSector( gubPBSectorX, gubPBSectorY, gubPBSectorZ ); - RenderMapScreenInterfaceBottom(); + // Headrock: Added FALSE argument, We might need TRUE but not sure. Will need to initiate battle :) + RenderMapScreenInterfaceBottom( FALSE ); //If we are currently in tactical, then set the flag to automatically bring up the mapscreen. if( guiCurrentScreen == GAME_SCREEN ) @@ -475,21 +476,21 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) guiNumInvolved = 0; for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bLife && !(MercPtrs[ i ]->uiStatusFlags & SOLDIER_VEHICLE) ) + if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && !(MercPtrs[ i ]->flags.uiStatusFlags & SOLDIER_VEHICLE) ) { if ( PlayerMercInvolvedInThisCombat( MercPtrs[ i ] ) ) { // involved if( !ubGroupID ) - { //Record the first groupID. If there are more than one group in this battle, we - //can detect it by comparing the first value with future values. If we do, then + { //Record the first groupID. If there are more than one group in this battle, we + //can detect it by comparing the first value with future values. If we do, then //we set a flag which determines whether to use the singular help text or plural version //for the retreat button. ubGroupID = MercPtrs[ i ]->ubGroupID; if( !gpBattleGroup ) gpBattleGroup = GetGroup( ubGroupID ); - if( bBestExpLevel > MercPtrs[ i ]->bExpLevel ) - bBestExpLevel = MercPtrs[ i ]->bExpLevel; + if( bBestExpLevel > MercPtrs[ i ]->stats.bExpLevel ) + bBestExpLevel = MercPtrs[ i ]->stats.bExpLevel; if( MercPtrs[ i ]->ubPrevSectorID == 255 ) { //Not able to retreat (calculate it for group) GROUP *pTempGroup; @@ -547,7 +548,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) // WANNE: Added an ja2_options.ini Property "ENABLE_CHANCE_OF_ENEMY_AMBUSHES_ON_INSANE_DIFFICULT" else if( gGameExternalOptions.fEnableChanceOfEnemyAmbushesOnInsaneDifficult && gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE && - CurrentPlayerProgressPercentage() >= 25 ) + CurrentPlayerProgressPercentage() >= 25 ) { //if the enemy outnumbers the players, then there is a chance of the enemies ambushing the group if( ubNumMobileEnemies > ubNumMercs ) { @@ -568,8 +569,8 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) } } } - else if( WhatPlayerKnowsAboutEnemiesInSector( gubPBSectorX, gubPBSectorY ) == KNOWS_NOTHING && - CurrentPlayerProgressPercentage() >= 30 - gGameOptions.ubDifficultyLevel * 5 ) + else if( WhatPlayerKnowsAboutEnemiesInSector( gubPBSectorX, gubPBSectorY ) == KNOWS_NOTHING && + CurrentPlayerProgressPercentage() >= 30 - gGameOptions.ubDifficultyLevel * 5 ) { //if the enemy outnumbers the players, then there is a small chance of the enemies ambushing the group if( ubNumMobileEnemies > ubNumMercs ) { @@ -616,7 +617,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) gubEnemyEncounterCode = ENEMY_ENCOUNTER_CODE; break; } - } + } } } @@ -666,14 +667,14 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) //when necessary. if( gfPersistantPBI ) { - if( gubEnemyEncounterCode == ENTERING_ENEMY_SECTOR_CODE || + if( gubEnemyEncounterCode == ENTERING_ENEMY_SECTOR_CODE || gubEnemyEncounterCode == ENTERING_BLOODCAT_LAIR_CODE ) { //Don't allow autoresolve for player initiated invasion battle types DisableButton( iPBButton[ 0 ] ); SetButtonFastHelpText( iPBButton[ 0 ], gpStrategicString[ STR_PB_DISABLED_AUTORESOLVE_FASTHELP ] ); } - else if( gubEnemyEncounterCode == ENEMY_AMBUSH_CODE || - gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE ) + else if( gubEnemyEncounterCode == ENEMY_AMBUSH_CODE || + gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE ) { //Don't allow autoresolve for ambushes DisableButton( iPBButton[ 0 ] ); SetButtonFastHelpText( iPBButton[ 0 ], gzNonPersistantPBIText[ 3 ] ); @@ -692,9 +693,9 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) gfCantRetreatInPBI = FALSE; fRetreatAnOption = FALSE; } - if( gfAutomaticallyStartAutoResolve || !fRetreatAnOption || - gubEnemyEncounterCode == ENEMY_AMBUSH_CODE || - gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE || + if( gfAutomaticallyStartAutoResolve || !fRetreatAnOption || + gubEnemyEncounterCode == ENEMY_AMBUSH_CODE || + gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE || gubEnemyEncounterCode == CREATURE_ATTACK_CODE ) { DisableButton( iPBButton[ 2 ] ); @@ -714,7 +715,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) } else { //use the explicit encounter code to determine what get's disable and the associated help text that is used. - + //First of all, the retreat button is always disabled seeing a battle is in progress. DisableButton( iPBButton[ 2 ] ); SetButtonFastHelpText( iPBButton[ 2 ], gzNonPersistantPBIText[ 0 ] ); @@ -751,7 +752,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) } } - //Disable the options button when the auto resolve screen comes up + //Disable the options button when the auto resolve screen comes up EnableDisAbleMapScreenOptionsButton( FALSE ); SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); @@ -780,7 +781,7 @@ void DoTransitionFromMapscreenToPreBattleInterface() PBIRect.iBottom = 359; iWidth = 261; iHeight = 359; - + uiTimeRange = 1000; iPercentage = 0; uiStartTime = GetJA2Clock(); @@ -795,8 +796,8 @@ void DoTransitionFromMapscreenToPreBattleInterface() BlitBufferToBuffer( FRAME_BUFFER, guiEXTRABUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); if( gfEnterAutoResolveMode ) - { //If we are intending on immediately entering autoresolve, change the global flag so that it will actually - //render the interface once. If gfEnterAutoResolveMode is clear, then RenderPreBattleInterface() won't do + { //If we are intending on immediately entering autoresolve, change the global flag so that it will actually + //render the interface once. If gfEnterAutoResolveMode is clear, then RenderPreBattleInterface() won't do //anything. fEnterAutoResolveMode = TRUE; gfEnterAutoResolveMode = FALSE; @@ -822,7 +823,7 @@ void DoTransitionFromMapscreenToPreBattleInterface() InvalidateScreen(); RefreshScreen( NULL ); - while( iPercentage < 100 ) + while( iPercentage < 100 ) { uiCurrTime = GetJA2Clock(); iPercentage = (uiCurrTime-uiStartTime) * 100 / uiTimeRange; @@ -853,7 +854,7 @@ void DoTransitionFromMapscreenToPreBattleInterface() RefreshScreen( NULL ); //Restore the previous rect. - BlitBufferToBuffer( guiEXTRABUFFER, FRAME_BUFFER, (UINT16)DstRect.iLeft, (UINT16)DstRect.iTop, + BlitBufferToBuffer( guiEXTRABUFFER, FRAME_BUFFER, (UINT16)DstRect.iLeft, (UINT16)DstRect.iTop, (UINT16)(DstRect.iRight-DstRect.iLeft+1), (UINT16)(DstRect.iBottom-DstRect.iTop+1) ); } BlitBufferToBuffer( FRAME_BUFFER, guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); @@ -895,7 +896,7 @@ void KillPreBattleInterface() fCharacterInfoPanelDirty = TRUE; gfDisplayPotentialRetreatPaths = FALSE; - //Enable the options button when the auto resolve screen comes up + //Enable the options button when the auto resolve screen comes up EnableDisAbleMapScreenOptionsButton( TRUE ); ColorFillVideoSurfaceArea( guiSAVEBUFFER, 0, 0, 261, 359, 0 ); @@ -913,7 +914,6 @@ void KillPreBattleInterface() { ShowButton( giCharInfoButton[ 1 ] ); } - gfPersistantPBI = FALSE; // If killing the PBI, it must not be persistant anymore! } @@ -990,8 +990,8 @@ void RenderPreBattleInterface() UINT8 ubJunk; //PLAYERGROUP *pPlayer; - //This code determines if the cursor is inside the rectangle consisting of the - //retreat button. If it is inside, then we set up the variables so that the retreat + //This code determines if the cursor is inside the rectangle consisting of the + //retreat button. If it is inside, then we set up the variables so that the retreat //arrows get drawn in the mapscreen. if( ButtonList[ iPBButton[ 2 ] ]->uiFlags & BUTTON_ENABLED ) { @@ -1077,7 +1077,7 @@ void RenderPreBattleInterface() width = StringPixLength( str, BLOCKFONTNARROW ); } mprintf( 54 - width , 38, str ); - + SetFont( BLOCKFONT ); swprintf( str, gpStrategicString[ STR_PB_MERCS ] ); width = StringPixLength( str, BLOCKFONT ); @@ -1087,7 +1087,7 @@ void RenderPreBattleInterface() width = StringPixLength( str, BLOCKFONTNARROW ); } mprintf( 139 - width , 38, str ); - + SetFont( BLOCKFONT ); swprintf( str, gpStrategicString[ STR_PB_MILITIA ] ); width = StringPixLength( str, BLOCKFONT ); @@ -1119,10 +1119,10 @@ void RenderPreBattleInterface() GetSectorIDString( gubPBSectorX, gubPBSectorY, gubPBSectorZ, pSectorName, TRUE ); mprintf( 70, 17, L"%s %s", gpStrategicString[ STR_PB_SECTOR ], pSectorName ); - //enemy + //enemy SetFont( FONT14ARIAL ); - if( gubEnemyEncounterCode == CREATURE_ATTACK_CODE || - gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE || + if( gubEnemyEncounterCode == CREATURE_ATTACK_CODE || + gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE || gubEnemyEncounterCode == ENTERING_BLOODCAT_LAIR_CODE || WhatPlayerKnowsAboutEnemiesInSector( gubPBSectorX, gubPBSectorY ) != KNOWS_HOW_MANY ) { @@ -1154,12 +1154,12 @@ void RenderPreBattleInterface() SetFontForeground( FONT_YELLOW ); //print out the participants of the battle. - // | NAME | ASSIGN | COND | HP | BP | + // | NAME | ASSIGN | COND | HP | BP | line = 0; y = TOP_Y + 1; for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bLife && !(MercPtrs[ i ]->uiStatusFlags & SOLDIER_VEHICLE) ) + if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && !(MercPtrs[ i ]->flags.uiStatusFlags & SOLDIER_VEHICLE) ) { if ( PlayerMercInvolvedInThisCombat( MercPtrs[ i ] ) ) { //involved @@ -1197,7 +1197,7 @@ void RenderPreBattleInterface() } //print out the uninvolved members of the battle - // | NAME | ASSIGN | LOC | DEST | DEP | + // | NAME | ASSIGN | LOC | DEST | DEP | if( !guiNumUninvolved ) { SetFontForeground( FONT_YELLOW ); @@ -1212,7 +1212,7 @@ void RenderPreBattleInterface() y = BOTTOM_Y - ROW_HEIGHT * guiNumUninvolved + 2; for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bLife && !(MercPtrs[ i ]->uiStatusFlags & SOLDIER_VEHICLE) ) + if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && !(MercPtrs[ i ]->flags.uiStatusFlags & SOLDIER_VEHICLE) ) { if ( !PlayerMercInvolvedInThisCombat( MercPtrs[ i ] ) ) { @@ -1263,7 +1263,7 @@ void RenderPreBattleInterface() RenderPBHeader( &x, &width ); //the text is important enough to blink. } - //InvalidateRegion( 0, 0, 261, 359 ); + //InvalidateRegion( 0, 0, 261, 359 ); if( gfEnterAutoResolveMode ) { gfEnterAutoResolveMode = FALSE; @@ -1342,8 +1342,8 @@ void GoToSectorCallback( GUI_BUTTON *btn, INT32 reason ) SetMusicMode( MUSIC_TACTICAL_NOTHING ); return; } - if( gfPersistantPBI && gpBattleGroup && gpBattleGroup->fPlayer && - gubEnemyEncounterCode != ENEMY_AMBUSH_CODE && + if( gfPersistantPBI && gpBattleGroup && gpBattleGroup->fPlayer && + gubEnemyEncounterCode != ENEMY_AMBUSH_CODE && gubEnemyEncounterCode != CREATURE_ATTACK_CODE && gubEnemyEncounterCode != BLOODCAT_AMBUSH_CODE ) { @@ -1436,14 +1436,14 @@ enum void GetSoldierConditionInfo( SOLDIERTYPE *pSoldier, STR16 szCondition, UINT8 *pubHPPercent, UINT8 *pubBPPercent ) { Assert( pSoldier ); - *pubHPPercent = (UINT8)(pSoldier->bLife * 100 / pSoldier->bLifeMax); + *pubHPPercent = (UINT8)(pSoldier->stats.bLife * 100 / pSoldier->stats.bLifeMax); *pubBPPercent = pSoldier->bBreath; //Go from the worst condition to the best. - if( !pSoldier->bLife ) + if( !pSoldier->stats.bLife ) { //0 life swprintf( szCondition, pConditionStrings[ COND_DEAD ] ); } - else if( pSoldier->bLife < OKLIFE && pSoldier->bBleeding ) + else if( pSoldier->stats.bLife < OKLIFE && pSoldier->bBleeding ) { //life less than OKLIFE and bleeding swprintf( szCondition, pConditionStrings[ COND_DYING ] ); } @@ -1455,7 +1455,7 @@ void GetSoldierConditionInfo( SOLDIERTYPE *pSoldier, STR16 szCondition, UINT8 *p { //bleeding swprintf( szCondition, pConditionStrings[ COND_BLEEDING ] ); } - else if( pSoldier->bLife*100 < pSoldier->bLifeMax*50 ) + else if( pSoldier->stats.bLife*100 < pSoldier->stats.bLifeMax*50 ) { //less than 50% life swprintf( szCondition, pConditionStrings[ COND_WOUNDED ] ); } @@ -1463,11 +1463,11 @@ void GetSoldierConditionInfo( SOLDIERTYPE *pSoldier, STR16 szCondition, UINT8 *p { //breath less than half swprintf( szCondition, pConditionStrings[ COND_FATIGUED ] ); } - else if( pSoldier->bLife*100 < pSoldier->bLifeMax*67 ) + else if( pSoldier->stats.bLife*100 < pSoldier->stats.bLifeMax*67 ) { //less than 67% life swprintf( szCondition, pConditionStrings[ COND_FAIR ] ); } - else if( pSoldier->bLife*100 < pSoldier->bLifeMax*86 ) + else if( pSoldier->stats.bLife*100 < pSoldier->stats.bLifeMax*86 ) { //less than 86% life swprintf( szCondition, pConditionStrings[ COND_GOOD ] ); } @@ -1647,11 +1647,11 @@ void ActivateAutomaticAutoResolveStart() void CalculateNonPersistantPBIInfo() { //We need to set up the non-persistant PBI - if( !gfBlitBattleSectorLocator || + if( !gfBlitBattleSectorLocator || gubPBSectorX != gWorldSectorX || gubPBSectorY != gWorldSectorY || gubPBSectorZ != gbWorldSectorZ ) { //Either the locator isn't on or the locator info is in a different sector - - //Calculated the encounter type + + //Calculated the encounter type gubEnemyEncounterCode = NO_ENCOUNTER_CODE; gubExplicitEnemyEncounterCode = NO_ENCOUNTER_CODE; if( HostileCiviliansPresent() ) @@ -1667,7 +1667,7 @@ void CalculateNonPersistantPBIInfo() UNDERGROUND_SECTORINFO *pSector = FindUnderGroundSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); Assert( pSector ); if( pSector->ubCreaturesInBattle ) - { + { gubExplicitEnemyEncounterCode = FIGHTING_CREATURES_CODE; } else if( pSector->ubAdminsInBattle || pSector->ubTroopsInBattle || pSector->ubElitesInBattle ) @@ -1681,7 +1681,7 @@ void CalculateNonPersistantPBIInfo() SECTORINFO *pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ]; Assert( pSector ); if( pSector->ubCreaturesInBattle ) - { + { gubExplicitEnemyEncounterCode = FIGHTING_CREATURES_CODE; } else if( pSector->ubAdminsInBattle || pSector->ubTroopsInBattle || pSector->ubElitesInBattle ) @@ -1711,7 +1711,7 @@ void PutNonSquadMercsInBattleSectorOnSquads( BOOLEAN fExitVehicles ) { GROUP *pGroup, *pNextGroup; - // IMPORTANT: Have to do this by group, so everyone inside vehicles gets assigned to the same squad. Needed for + // IMPORTANT: Have to do this by group, so everyone inside vehicles gets assigned to the same squad. Needed for // the tactical placement interface to work in case of simultaneous multi-vehicle arrivals! pGroup = gpGroupList; @@ -1771,7 +1771,7 @@ void PutNonSquadMercsInPlayerGroupOnSquads( GROUP *pGroup, BOOLEAN fExitVehicles // store ptr to next soldier in group, once removed from group, his info will get memfree'd! pNextPlayer = pPlayer->next; - if ( pSoldier->bActive && pSoldier->bLife && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( pSoldier->bActive && pSoldier->stats.bLife && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { // if involved, but off-duty (includes mercs inside vehicles!) if ( PlayerMercInvolvedInThisCombat( pSoldier ) && ( pSoldier->bAssignment >= ON_DUTY ) ) @@ -1783,7 +1783,7 @@ void PutNonSquadMercsInPlayerGroupOnSquads( GROUP *pGroup, BOOLEAN fExitVehicles { TakeSoldierOutOfVehicle( pSoldier ); - // put them on the unique squad assigned to people leaving this vehicle. Can't add them to existing squads, + // put them on the unique squad assigned to people leaving this vehicle. Can't add them to existing squads, // because if this is a simultaneous group attack, the mercs could be coming from different sides, and the // placement screen can't handle mercs on the same squad arriving from difference edges! fSuccess = AddCharacterToSquad( pSoldier, bUniqueVehicleSquad ); @@ -1799,8 +1799,8 @@ void PutNonSquadMercsInPlayerGroupOnSquads( GROUP *pGroup, BOOLEAN fExitVehicles Assert( fSuccess ); // clear any desired squad assignments - pSoldier -> ubNumTraversalsAllowedToMerge = 0; - pSoldier -> ubDesiredSquadAssignment = NO_ASSIGNMENT; + pSoldier->ubNumTraversalsAllowedToMerge = 0; + pSoldier->ubDesiredSquadAssignment = NO_ASSIGNMENT; // stand him up MakeSoldiersTacticalAnimationReflectAssignment( pSoldier ); @@ -1826,10 +1826,10 @@ void WakeUpAllMercsInSectorUnderAttack( void ) { pSoldier = &( Menptr[ iCounter ] ); - if ( pSoldier->bActive && pSoldier->bLife && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( pSoldier->bActive && pSoldier->stats.bLife && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { // if involved, but asleep - if ( PlayerMercInvolvedInThisCombat( pSoldier ) && ( pSoldier->fMercAsleep == TRUE ) ) + if ( PlayerMercInvolvedInThisCombat( pSoldier ) && ( pSoldier->flags.fMercAsleep == TRUE ) ) { // FORCE him wake him up SetMercAwake( pSoldier, FALSE, TRUE ); @@ -1887,11 +1887,11 @@ BOOLEAN PlayerMercInvolvedInThisCombat( SOLDIERTYPE *pSoldier ) Assert( pSoldier ); Assert( pSoldier->bActive ); - if( !pSoldier->fBetweenSectors && + if( !pSoldier->flags.fBetweenSectors && pSoldier->bAssignment != IN_TRANSIT && pSoldier->bAssignment != ASSIGNMENT_POW && pSoldier->bAssignment != ASSIGNMENT_DEAD && - !(pSoldier->uiStatusFlags & SOLDIER_VEHICLE) && + !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && // Robot is involved if it has a valid controller with it, uninvolved otherwise ( !AM_A_ROBOT( pSoldier ) || ( pSoldier->ubRobotRemoteHolderID != NOBODY ) ) && !SoldierAboardAirborneHeli( pSoldier ) ) @@ -1960,15 +1960,15 @@ void CheckForRobotAndIfItsControlled( void ) // search for the robot on player's team for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bLife && AM_A_ROBOT( MercPtrs[ i ] )) + if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && AM_A_ROBOT( MercPtrs[ i ] )) { // check whether it has a valid controller with it. This sets its ubRobotRemoteHolderID field. - UpdateRobotControllerGivenRobot( MercPtrs[ i ] ); + MercPtrs[ i ]->UpdateRobotControllerGivenRobot( ); - // if he has a controller, set controllers + // if he has a controller, set controllers if ( MercPtrs[ i ]->ubRobotRemoteHolderID != NOBODY ) { - UpdateRobotControllerGivenController( MercPtrs[ MercPtrs[ i ]->ubRobotRemoteHolderID ] ); + MercPtrs[ MercPtrs[ i ]->ubRobotRemoteHolderID ]->UpdateRobotControllerGivenController( ); } break; diff --git a/Strategic/PreBattle Interface.h b/Strategic/PreBattle Interface.h index 55ff3142..3cca9d33 100644 --- a/Strategic/PreBattle Interface.h +++ b/Strategic/PreBattle Interface.h @@ -58,14 +58,14 @@ void ClearNonPersistantPBIInfo(); //only if the PBI isn't persistant (!gfPersistantPBI). extern BOOLEAN gfPersistantPBI; -//Contains general information about the type of encounter the player is faced with. This -//determines whether or not you can autoresolve the battle or even retreat. This code +//Contains general information about the type of encounter the player is faced with. This +//determines whether or not you can autoresolve the battle or even retreat. This code //dictates the header that is used at the top of the PBI. extern UINT8 gubEnemyEncounterCode; //The autoresolve during tactical battle option needs more detailed information than the -//gubEnemyEncounterCode can provide. The explicit version contains possibly unique codes -//for reasons not normally used in the PBI. For example, if we were fighting the enemy +//gubEnemyEncounterCode can provide. The explicit version contains possibly unique codes +//for reasons not normally used in the PBI. For example, if we were fighting the enemy //in a normal situation, then shot at a civilian, the civilians associated with the victim //would turn hostile, which would disable the ability to autoresolve the battle. extern BOOLEAN gubExplicitEnemyEncounterCode; diff --git a/Strategic/Queen Command.cpp b/Strategic/Queen Command.cpp index a32fcc6d..18e245a8 100644 --- a/Strategic/Queen Command.cpp +++ b/Strategic/Queen Command.cpp @@ -42,7 +42,7 @@ #include "Campaign Init.h" #include "meanwhile.h" #include "Soldier macros.h" - #include "Morale.h" + #include "Morale.h" #endif #ifdef JA2BETAVERSION @@ -132,7 +132,7 @@ UINT8 NumHostilesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) //Count stationary hostiles pSector = &SectorInfo[ SECTOR( sSectorX, sSectorY ) ]; ubNumHostiles = (UINT8)(pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumCreatures); - + //Count mobile enemies pGroup = gpGroupList; while( pGroup ) @@ -173,7 +173,7 @@ UINT8 NumEnemiesInAnySector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) //Count stationary enemies pSector = &SectorInfo[ SECTOR( sSectorX, sSectorY ) ]; ubNumEnemies = (UINT8)(pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites); - + //Count mobile enemies pGroup = gpGroupList; while( pGroup ) @@ -224,7 +224,7 @@ UINT8 NumStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY ) { //If no garrison, no stationary. return( 0 ); } - + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ // don't count roadblocks as stationary garrison, we want to see how many enemies are in them, not question marks @@ -334,7 +334,7 @@ void GetNumberOfStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 void GetNumberOfEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites ) { UINT8 ubNumAdmins, ubNumTroops, ubNumElites; - + GetNumberOfStationaryEnemiesInSector( sSectorX, sSectorY, pubNumAdmins, pubNumTroops, pubNumElites ); GetNumberOfMobileEnemiesInSector( sSectorX, sSectorY, &ubNumAdmins, &ubNumTroops, &ubNumElites ); @@ -347,7 +347,7 @@ void GetNumberOfEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAd void EndTacticalBattleForEnemy() { GROUP *pGroup; - INT32 i, iNumMilitia = 0, iNumEnemies = 0; + INT32 i; //Clear enemies in battle for all stationary groups in the sector. if( gbWorldSectorZ > 0 ) @@ -393,12 +393,12 @@ void EndTacticalBattleForEnemy() //severe loyalty blow. for( i = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; i <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bInSector && MercPtrs[ i ]->bLife >= OKLIFE ) + if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bInSector && MercPtrs[ i ]->stats.bLife >= OKLIFE ) { //found one live militia, so look for any enemies/creatures. // NOTE: this is relying on ENEMY_TEAM being immediately followed by CREATURE_TEAM for( i = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bInSector && MercPtrs[ i ]->bLife >= OKLIFE ) + if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bInSector && MercPtrs[ i ]->stats.bLife >= OKLIFE ) { //confirmed at least one enemy here, so do the loyalty penalty. HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_ABANDON_MILITIA, gWorldSectorX, gWorldSectorY, 0 ); break; @@ -452,7 +452,7 @@ BOOLEAN PrepareEnemyForSectorBattle() // Reinforcement groups? Bring it on! if( gGameExternalOptions.gfAllowReinforcements && - !( (GetTownIdForSector( gWorldSectorX, gWorldSectorY ) == OMERTA )&&( gGameOptions.ubDifficultyLevel != DIF_LEVEL_INSANE ) ) ) + !( (GetTownIdForSector( gWorldSectorX, gWorldSectorY ) == OMERTA )&&( gGameOptions.ubDifficultyLevel != DIF_LEVEL_INSANE ) ) ) { UINT16 pusMoveDir[4][3]; UINT8 ubDirNumber = 0, ubIndex; @@ -462,7 +462,7 @@ BOOLEAN PrepareEnemyForSectorBattle() // They arrived in multiple groups, so here they come pThisSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ]; - GenerateDirectionInfos( gWorldSectorX, gWorldSectorY, &ubDirNumber, pusMoveDir, + GenerateDirectionInfos( gWorldSectorX, gWorldSectorY, &ubDirNumber, pusMoveDir, ( GetTownIdForSector( gWorldSectorX, gWorldSectorY ) != BLANK_SECTOR ? TRUE : FALSE ), TRUE, IS_ONLY_IN_CITIES ); for( ubIndex = 0; ubIndex < ubDirNumber; ubIndex++ ) @@ -484,11 +484,11 @@ BOOLEAN PrepareEnemyForSectorBattle() while( pGroup ) { if( pGroup != gpBattleGroup && !pGroup->fPlayer && !pGroup->fVehicle && - pGroup->ubSectorX == gpBattleGroup->ubSectorX && - pGroup->ubSectorY == gpBattleGroup->ubSectorY && - !pGroup->pEnemyGroup->ubAdminsInBattle && - !pGroup->pEnemyGroup->ubTroopsInBattle && - !pGroup->pEnemyGroup->ubElitesInBattle ) + pGroup->ubSectorX == gpBattleGroup->ubSectorX && + pGroup->ubSectorY == gpBattleGroup->ubSectorY && + !pGroup->pEnemyGroup->ubAdminsInBattle && + !pGroup->pEnemyGroup->ubTroopsInBattle && + !pGroup->pEnemyGroup->ubElitesInBattle ) { HandleArrivalOfReinforcements( pGroup ); } @@ -524,7 +524,7 @@ BOOLEAN PrepareEnemyForSectorBattle() case SOLDIER_CLASS_ADMINISTRATOR: ubTotalAdmins++; break; case SOLDIER_CLASS_ARMY: ubTotalTroops++; break; case SOLDIER_CLASS_ELITE: ubTotalElites++; break; - } + } } curr = curr->next; } @@ -547,7 +547,7 @@ BOOLEAN PrepareEnemyForSectorBattle() if( ubStationaryEnemies > 32 ) { #ifdef JA2BETAVERSION - ScreenMsg( FONT_RED, MSG_ERROR, L"The total stationary enemy forces in sector %c%d is %d. (max %d)", + ScreenMsg( FONT_RED, MSG_ERROR, L"The total stationary enemy forces in sector %c%d is %d. (max %d)", gWorldSectorY + 'A' - 1, gWorldSectorX, ubTotalAdmins + ubTotalTroops + ubTotalElites, 32 ); #endif @@ -560,7 +560,7 @@ BOOLEAN PrepareEnemyForSectorBattle() pSector->ubTroopsInBattle += ubTotalTroops; pSector->ubElitesInBattle += ubTotalElites; - #ifdef JA2TESTVERSION + #ifdef JA2TESTVERSION if( gfOverrideSector ) { //if there are no troops in the current groups, then we're done. @@ -590,14 +590,14 @@ BOOLEAN PrepareEnemyForSectorBattle() sNumSlots -= ubTotalAdmins + ubTotalTroops + ubTotalElites; //Now, process all of the groups and search for both enemy and player groups in the sector. - //For enemy groups, we fill up the slots until we have none left or all of the groups have been + //For enemy groups, we fill up the slots until we have none left or all of the groups have been //processed. for( pGroup = gpGroupList; pGroup; pGroup = pGroup->next) { - if( !pGroup->fPlayer && !pGroup->fVehicle && + if( !pGroup->fPlayer && !pGroup->fVehicle && pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ ) { //Process enemy group in sector. if( sNumSlots > 0 ) @@ -619,7 +619,7 @@ BOOLEAN PrepareEnemyForSectorBattle() sNumSlots -= ubNumTroops; if( sNumSlots < 0 ) { //adjust the value to zero - ubNumTroops += sNumSlots; + ubNumTroops += sNumSlots; sNumSlots = 0; gfPendingEnemies = TRUE; } @@ -668,13 +668,13 @@ BOOLEAN PrepareEnemyForSectorBattle() AddSoldierInitListEnemyDefenceSoldiers( ubTotalAdmins, ubTotalTroops, ubTotalElites ); //Now, we have to go through all of the enemies in the new map, and assign their respective groups if - //in a mobile group, but only for the ones that were assigned from the + //in a mobile group, but only for the ones that were assigned from the sNumSlots = 32 - ubStationaryEnemies; pGroup = gpGroupList; while( pGroup && sNumSlots ) { - if( !pGroup->fPlayer && !pGroup->fVehicle && + if( !pGroup->fPlayer && !pGroup->fVehicle && pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ ) { ubNumAdmins = pGroup->pEnemyGroup->ubAdminsInBattle; @@ -682,7 +682,7 @@ BOOLEAN PrepareEnemyForSectorBattle() ubNumElites = pGroup->pEnemyGroup->ubElitesInBattle; num = ubNumAdmins + ubNumTroops + ubNumElites; - for (i= gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; + for (i= gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; i<= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID && num; i++) { @@ -690,7 +690,7 @@ BOOLEAN PrepareEnemyForSectorBattle() Assert( sNumSlots); pSoldier = &Menptr[ i ]; - + // Skip inactive and already grouped soldiers if (!pSoldier->bActive || pSoldier->ubGroupID) { @@ -746,7 +746,7 @@ BOOLEAN PrepareEnemyForUndergroundBattle() pUnderground = gpUndergroundSectorInfoHead; while( pUnderground ) { - if( pUnderground->ubSectorX == gWorldSectorX && + if( pUnderground->ubSectorX == gWorldSectorX && pUnderground->ubSectorY == gWorldSectorY && pUnderground->ubSectorZ == gbWorldSectorZ ) { //This is the sector we are going to be fighting in. @@ -819,7 +819,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand"); break; } - if( pSoldier->bNeutral || pSoldier->bTeam != ENEMY_TEAM && pSoldier->bTeam != CREATURE_TEAM ) + if( pSoldier->aiData.bNeutral || pSoldier->bTeam != ENEMY_TEAM && pSoldier->bTeam != CREATURE_TEAM ) return; //we are recording an enemy death if( pSoldier->ubGroupID ) @@ -941,7 +941,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand"); #ifdef JA2BETAVERSION UINT32 ubTotalEnemies; #endif - + // if( !IsAutoResolveActive() ) // { pSector = &SectorInfo[ SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ]; @@ -951,7 +951,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand"); // pSector = &SectorInfo[ GetAutoResolveSectorID() ]; // } - #ifdef JA2BETAVERSION + #ifdef JA2BETAVERSION ubTotalEnemies = pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites; #endif @@ -1148,7 +1148,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand"); if( pSoldier->ubBodyType == QUEENMONSTER ) { - //Need to call this, as the queen is really big, and killing her leaves a bunch + //Need to call this, as the queen is really big, and killing her leaves a bunch //of bad tiles in behind her. Calling this function cleans it up. InvalidateWorldRedundency(); //Now that the queen is dead, turn off the creature quest. @@ -1231,7 +1231,7 @@ void AddPossiblePendingEnemiesToBattle() // It's probable that the "pending enemies" flag isn't working right. So we'll go ahead and continue into // the group insertion code from here. - //return; + //return; } if( pSector->ubNumElites + pSector->ubNumTroops + pSector->ubNumAdmins ) @@ -1301,7 +1301,7 @@ void AddPossiblePendingEnemiesToBattle() else if( !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY - 1 ) ) ubStrategicInsertionCode = INSERTION_CODE_NORTH; } - + if( ubStrategicInsertionCode < INSERTION_CODE_NORTH ||ubStrategicInsertionCode > INSERTION_CODE_WEST ) ubStrategicInsertionCode = INSERTION_CODE_NORTH + Random( 4 ); @@ -1318,7 +1318,6 @@ void AddPossiblePendingEnemiesToBattle() if( !pGroup->fPlayer && !pGroup->fVehicle && pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ ) ubNumGroupsInSector++; } - pGroupInSectorList = (GROUP**) MemAlloc( ubNumGroupsInSector * sizeof( GROUP*)); for (ubNumGroupsInSector = 0, pGroup = gpGroupList; pGroup; pGroup = pGroup->next) { @@ -1422,7 +1421,7 @@ void NotifyPlayersOfNewEnemies() for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) { //find a merc that is aware. pSoldier = MercPtrs[ i ]; - if( pSoldier->bInSector && pSoldier->bActive && pSoldier->bLife >= OKLIFE && pSoldier->bBreath >= OKBREATH ) + if( pSoldier->bInSector && pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && pSoldier->bBreath >= OKBREATH ) { iSoldiers++; } @@ -1434,7 +1433,7 @@ void NotifyPlayersOfNewEnemies() for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) { //find a merc that is aware. pSoldier = MercPtrs[ i ]; - if( pSoldier->bInSector && pSoldier->bActive && pSoldier->bLife >= OKLIFE ) + if( pSoldier->bInSector && pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE ) { iSoldiers++; } @@ -1446,7 +1445,7 @@ void NotifyPlayersOfNewEnemies() for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) { //find a merc that is aware. pSoldier = MercPtrs[ i ]; - if( pSoldier->bInSector && pSoldier->bActive && pSoldier->bLife >= OKLIFE && + if( pSoldier->bInSector && pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && ( ( pSoldier->bBreath >= OKBREATH ) || fIgnoreBreath ) ) { if( !iChosenSoldier ) @@ -1488,7 +1487,7 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub #endif if( fMagicallyAppeared ) - { //update the strategic counters + { //update the strategic counters if( !gbWorldSectorZ ) { SECTORINFO *pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ]; @@ -1539,7 +1538,7 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; pSoldier->usStrategicInsertionData = MapEdgepointInfo.sGridNo[ ubCurrSlot++ ]; } - else + else { //no edgepoints left, so put him at the entrypoint. pSoldier->ubStrategicInsertionCode = ubStrategicInsertionCode; } @@ -1562,7 +1561,7 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; pSoldier->usStrategicInsertionData = MapEdgepointInfo.sGridNo[ ubCurrSlot++ ]; } - else + else { //no edgepoints left, so put him at the entrypoint. pSoldier->ubStrategicInsertionCode = ubStrategicInsertionCode; } @@ -1585,7 +1584,7 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; pSoldier->usStrategicInsertionData = MapEdgepointInfo.sGridNo[ ubCurrSlot++ ]; } - else + else { //no edgepoints left, so put him at the entrypoint. pSoldier->ubStrategicInsertionCode = ubStrategicInsertionCode; } @@ -1628,7 +1627,7 @@ BOOLEAN SaveUnderGroundSectorInfoToSaveGame( HWFILE hFile ) { return(FALSE); } - + TempNode = TempNode->next; } @@ -1710,10 +1709,10 @@ UNDERGROUND_SECTORINFO* FindUnderGroundSector( INT16 sMapX, INT16 sMapY, UINT8 b while( pUnderground ) { //If the sector is the right one - if( pUnderground->ubSectorX == sMapX && + if( pUnderground->ubSectorX == sMapX && pUnderground->ubSectorY == sMapY && pUnderground->ubSectorZ == bMapZ ) - { + { return( pUnderground ); } pUnderground = pUnderground->next; @@ -1771,7 +1770,7 @@ void EndCaptureSequence( ) } } // CJC Dec 1 2002: fixing multiple captures - else + else { // !?!? set both flags gStrategicStatus.uiFlags |= STRATEGIC_PLAYER_CAPTURED_FOR_RESCUE; @@ -1783,8 +1782,7 @@ void EndCaptureSequence( ) void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier ) { - INT32 i; - WORLDITEM WorldItem; + UINT32 i; BOOLEAN fMadeCorpse; INT32 iNumEnemiesInSector; @@ -1793,7 +1791,7 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier ) static INT16 sAlmaCaptureItemsGridNo[] = { 12246, 12406, 13046 }; static INT16 sInterrogationItemGridNo[] = { 12089, 12089, 12089 }; - + // ATE: Check first if ! in player captured sequence already // CJC Dec 1 2002: fixing multiple captures @@ -1812,18 +1810,18 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier ) // If this is an EPC , just kill them... if ( AM_AN_EPC( pSoldier ) ) { - pSoldier->bLife = 0; + pSoldier->stats.bLife = 0; HandleSoldierDeath( pSoldier, &fMadeCorpse ); return; } - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { return; } // ATE: Patch fix If in a vehicle, remove from vehicle... - TakeSoldierOutOfVehicle( pSoldier ); + TakeSoldierOutOfVehicle( pSoldier ); // Are there anemies in ALMA? ( I13 ) @@ -1840,7 +1838,7 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier ) // Change to POW.... //-add him to a POW assignment/group - if( ( pSoldier->bAssignment != ASSIGNMENT_POW ) ) + if( ( pSoldier->bAssignment != ASSIGNMENT_POW ) ) { SetTimeOfAssignmentChangeForMerc( pSoldier ); } @@ -1849,11 +1847,13 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier ) // ATE: Make them neutral! if ( gubQuest[ QUEST_HELD_IN_ALMA ] == QUESTNOTSTARTED ) { - pSoldier->bNeutral = TRUE; + pSoldier->aiData.bNeutral = TRUE; } - + RemoveCharacterFromSquads( pSoldier ); + WORLDITEM WorldItem; + // Is this the first one..? if ( gubQuest[ QUEST_HELD_IN_ALMA ] == QUESTNOTSTARTED ) { @@ -1863,12 +1863,12 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier ) pSoldier->bSectorZ = 0; // put him on the floor!! - pSoldier->bLevel = 0; + pSoldier->pathing.bLevel = 0; // OK, drop all items! - for ( i = 0; i < NUM_INV_SLOTS; i++ ) - { - if( pSoldier->inv[ i ].usItem != 0 ) + for ( i = 0; i < pSoldier->inv.size(); i++ ) + { + if( pSoldier->inv[ i ].exists() == true ) { WorldItem.fExists = TRUE; WorldItem.sGridNo = sAlmaCaptureItemsGridNo[ gStrategicStatus.ubNumCapturedForRescue ]; @@ -1876,11 +1876,9 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier ) WorldItem.usFlags = 0; WorldItem.bVisible = FALSE; WorldItem.bRenderZHeightAboveLevel = 0; - - memcpy( &(WorldItem.o), &pSoldier->inv[i], sizeof( OBJECTTYPE ) ); + pSoldier->inv[ i ].MoveThisObjectTo(WorldItem.object); AddWorldItemsToUnLoadedSector( 13, 9, 0, sAlmaCaptureItemsGridNo[ gStrategicStatus.ubNumCapturedForRescue ], 1, &WorldItem, FALSE ); - DeleteObj( &( pSoldier->inv[ i ] ) ); } } @@ -1897,12 +1895,12 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier ) pSoldier->bSectorZ = 0; // put him on the floor!! - pSoldier->bLevel = 0; + pSoldier->pathing.bLevel = 0; // OK, drop all items! - for ( i = 0; i < NUM_INV_SLOTS; i++ ) - { - if( pSoldier->inv[ i ].usItem != 0 ) + for ( i = 0; i < pSoldier->inv.size(); i++ ) + { + if( pSoldier->inv[ i ].exists() == true ) { WorldItem.fExists = TRUE; WorldItem.sGridNo = sInterrogationItemGridNo[ gStrategicStatus.ubNumCapturedForRescue ]; @@ -1910,11 +1908,9 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier ) WorldItem.usFlags = 0; WorldItem.bVisible = FALSE; WorldItem.bRenderZHeightAboveLevel = 0; - - memcpy( &(WorldItem.o), &pSoldier->inv[i], sizeof( OBJECTTYPE ) ); + pSoldier->inv[ i ].MoveThisObjectTo(WorldItem.object); AddWorldItemsToUnLoadedSector( 7, 14, 0, sInterrogationItemGridNo[ gStrategicStatus.ubNumCapturedForRescue ], 1, &WorldItem, FALSE ); - DeleteObj( &( pSoldier->inv[ i ] ) ); } } @@ -1928,27 +1924,27 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier ) pSoldier->bBleeding = 0; // wake him up - if ( pSoldier->fMercAsleep ) + if ( pSoldier->flags.fMercAsleep ) { PutMercInAwakeState( pSoldier ); - pSoldier->fForcedToStayAwake = FALSE; + pSoldier->flags.fForcedToStayAwake = FALSE; } //Set his life to 50% + or - 10 HP. - pSoldier->bLife = pSoldier->bLifeMax / 2; - if ( pSoldier->bLife <= 35 ) + pSoldier->stats.bLife = pSoldier->stats.bLifeMax / 2; + if ( pSoldier->stats.bLife <= 35 ) { - pSoldier->bLife = 35; + pSoldier->stats.bLife = 35; } - else if ( pSoldier->bLife >= 45 ) + else if ( pSoldier->stats.bLife >= 45 ) { - pSoldier->bLife += (INT8)(10 - Random( 21 ) ); + pSoldier->stats.bLife += (INT8)(10 - Random( 21 ) ); } // make him quite exhausted when found pSoldier->bBreath = pSoldier->bBreathMax = 50; pSoldier->sBreathRed = 0; - pSoldier->fMercCollapsedFlag = FALSE; + pSoldier->flags.fMercCollapsedFlag = FALSE; } @@ -1961,9 +1957,9 @@ void HandleEnemyStatusInCurrentMapBeforeLoadingNewMap() //If any of the soldiers are dying, kill them now. for( i = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; i <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bLife < OKLIFE && MercPtrs[ i ]->bLife ) + if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife < OKLIFE && MercPtrs[ i ]->stats.bLife ) { - MercPtrs[ i ]->bLife = 0; + MercPtrs[ i ]->stats.bLife = 0; HandleSoldierDeath( MercPtrs[ i ], &fMadeCorpse ); bKilledEnemies++; } @@ -1971,9 +1967,9 @@ void HandleEnemyStatusInCurrentMapBeforeLoadingNewMap() //Do the same for the creatures. for( i = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bLife < OKLIFE && MercPtrs[ i ]->bLife ) + if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife < OKLIFE && MercPtrs[ i ]->stats.bLife ) { - MercPtrs[ i ]->bLife = 0; + MercPtrs[ i ]->stats.bLife = 0; HandleSoldierDeath( MercPtrs[ i ], &fMadeCorpse ); bKilledCreatures++; } @@ -1981,9 +1977,9 @@ void HandleEnemyStatusInCurrentMapBeforeLoadingNewMap() //Militia for( i = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; i <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bLife < OKLIFE && MercPtrs[ i ]->bLife ) + if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife < OKLIFE && MercPtrs[ i ]->stats.bLife ) { - MercPtrs[ i ]->bLife = 0; + MercPtrs[ i ]->stats.bLife = 0; HandleSoldierDeath( MercPtrs[ i ], &fMadeCorpse ); bKilledRebels++; } @@ -1991,9 +1987,9 @@ void HandleEnemyStatusInCurrentMapBeforeLoadingNewMap() //Civilians for( i = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bLife < OKLIFE && MercPtrs[ i ]->bLife ) + if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife < OKLIFE && MercPtrs[ i ]->stats.bLife ) { - MercPtrs[ i ]->bLife = 0; + MercPtrs[ i ]->stats.bLife = 0; HandleSoldierDeath( MercPtrs[ i ], &fMadeCorpse ); bKilledCivilians++; } @@ -2008,7 +2004,7 @@ void HandleEnemyStatusInCurrentMapBeforeLoadingNewMap() ScreenMsg( FONT_BLUE, MSG_TESTVERSION, L"%d enemies died after you left the sector.", bKilledEnemies ); if( bKilledCreatures ) ScreenMsg( FONT_BLUE, MSG_TESTVERSION, L"%d creatures died after you left the sector.", bKilledCreatures ); - + if( !gbWorldSectorZ ) { SECTORINFO *pSector; @@ -2017,7 +2013,7 @@ void HandleEnemyStatusInCurrentMapBeforeLoadingNewMap() pSector->ubTroopsInBattle = 0; pSector->ubElitesInBattle = 0; pSector->ubCreaturesInBattle = 0; - //RecalculateSectorWeight( + //RecalculateSectorWeight( } else if( gbWorldSectorZ > 0 ) { @@ -2060,9 +2056,9 @@ BOOLEAN OnlyHostileCivsInSector() for( i = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; i++ ) { pSoldier = MercPtrs[ i ]; - if( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife ) + if( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife ) { - if( !pSoldier->bNeutral ) + if( !pSoldier->aiData.bNeutral ) { fHostileCivs = TRUE; break; @@ -2077,9 +2073,9 @@ BOOLEAN OnlyHostileCivsInSector() for( i = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; i <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; i++ ) { pSoldier = MercPtrs[ i ]; - if( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife ) + if( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife ) { - if( !pSoldier->bNeutral ) + if( !pSoldier->aiData.bNeutral ) { return FALSE; } @@ -2088,9 +2084,9 @@ BOOLEAN OnlyHostileCivsInSector() for( i = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; i++ ) { pSoldier = MercPtrs[ i ]; - if( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife ) + if( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife ) { - if( !pSoldier->bNeutral ) + if( !pSoldier->aiData.bNeutral ) { return FALSE; } @@ -2099,9 +2095,9 @@ BOOLEAN OnlyHostileCivsInSector() for( i = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; i <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; i++ ) { pSoldier = MercPtrs[ i ]; - if( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife ) + if( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife ) { - if( !pSoldier->bNeutral ) + if( !pSoldier->aiData.bNeutral ) { return FALSE; } @@ -2111,3 +2107,4 @@ BOOLEAN OnlyHostileCivsInSector() return TRUE; } + diff --git a/Strategic/Queen Command.h b/Strategic/Queen Command.h index df109b58..7ec22102 100644 --- a/Strategic/Queen Command.h +++ b/Strategic/Queen Command.h @@ -43,7 +43,7 @@ void HandleEnemyStatusInCurrentMapBeforeLoadingNewMap(); BOOLEAN SaveUnderGroundSectorInfoToSaveGame( HWFILE hFile ); BOOLEAN LoadUnderGroundSectorInfoFromSavedGame( HWFILE hFile ); -//Finds and returns the specified underground structure ( DONT MODIFY IT ). Else returns NULL +//Finds and returns the specified underground structure ( DONT MODIFY IT ). Else returns NULL UNDERGROUND_SECTORINFO* FindUnderGroundSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ ); void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier ); diff --git a/Strategic/Quest Debug System.cpp b/Strategic/Quest Debug System.cpp index fcc74697..7a65e0e4 100644 --- a/Strategic/Quest Debug System.cpp +++ b/Strategic/Quest Debug System.cpp @@ -24,26 +24,31 @@ #include "strategicmap.h" #include "soldier add.h" #include "Opplist.h" - #include "Handle Items.h" - #include "Game Clock.h" - #include "environment.h" + #include "Handle Items.h" + #include "Game Clock.h" + #include "environment.h" #include "dialogue control.h" - #include "Soldier Control.h" + //#include "Soldier Control.h" #include "overhead.h" #include "AimMembers.h" - #include "MessageBoxScreen.h" + #include "MessageBoxScreen.h" #include "Stdio.h" #include "english.h" #include "line.h" - #include "Keys.h" + #include "Keys.h" #include "Interface Dialogue.h" - #include "SysUtil.h" - #include "Message.h" + #include "SysUtil.h" + #include "Message.h" #include "Random.h" #endif //#ifdef JA2BETAVERSION +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + //******************************* // @@ -136,7 +141,7 @@ typedef void ( *DROP_DOWN_SELECT_CALLBACK ) ; #define QUEST_DBS_ADD_NPC_BTN_X QUEST_DBS_SELECTED_NPC_BUTN_X -#define QUEST_DBS_ADD_NPC_BTN_Y QUEST_DBS_SELECTED_ITEM_BUTN_Y + QUEST_DBS_LIST_TEXT_OFFSET +#define QUEST_DBS_ADD_NPC_BTN_Y QUEST_DBS_SELECTED_ITEM_BUTN_Y + QUEST_DBS_LIST_TEXT_OFFSET #define QUEST_DBS_ADD_ITEM_BTN_X QUEST_DBS_ADD_NPC_BTN_X #define QUEST_DBS_ADD_ITEM_BTN_Y QUEST_DBS_ADD_NPC_BTN_Y + QUEST_DBS_LIST_TEXT_OFFSET @@ -182,7 +187,7 @@ typedef void ( *DROP_DOWN_SELECT_CALLBACK ) ; #define QUEST_DBS_TEB_HEIGHT 140 #define QUEST_DBS_NUM_DISPLAYED_QUESTS MAX_QUESTS -#define QUEST_DBS_NUM_DISPLAYED_FACTS 25 +#define QUEST_DBS_NUM_DISPLAYED_FACTS 25 #define QUEST_DBS_TEXT_FIELD_WIDTH 7 @@ -201,14 +206,14 @@ typedef void ( *DROP_DOWN_SELECT_CALLBACK ) ; //#define CLOCK_X 554 //#define CLOCK_Y 459 - + #define QDS_BUTTON_HEIGHT 21 #define QDS_CURRENT_QUOTE_NUM_BOX_X 150 #define QDS_CURRENT_QUOTE_NUM_BOX_Y 300 -#define QDS_CURRENT_QUOTE_NUM_BOX_WIDTH 285 -#define QDS_CURRENT_QUOTE_NUM_BOX_HEIGHT 80 +#define QDS_CURRENT_QUOTE_NUM_BOX_WIDTH 285 +#define QDS_CURRENT_QUOTE_NUM_BOX_HEIGHT 80 // @@ -234,7 +239,7 @@ STR16 QuestStates[] = { L"Done", }; -STR16 QuestDebugText[] = +STR16 QuestDebugText[] = { L"Quest Debug System", L"Quests", @@ -278,10 +283,10 @@ STR16 QuestDebugText[] = L"Please enter a quote number for the selected merc to start talking from.", L"RPC is added to team", L"RPC says Sector Desc", - L"Space: Toggle Pausing Merc Speech", - L"Left Arrow: Previous Quote", + L"Space: Toggle Pausing Merc Speech", + L"Left Arrow: Previous Quote", L"Right Arrow: Next Quote", - L"ESC: To Stop the merc from Talking", + L"ESC: To Stop the merc from Talking", L"", L"", @@ -340,27 +345,63 @@ enum }; - +//TODO STR16 PocketText[] = { - L"Helmet", - L"Vest", - L"Leg", - L"Head1", - L"Head2", - L"Hand", - L"Second Hand", - L"Bigpock1", - L"Bigpock2", - L"Bigpock3", - L"Bigpock4", - L"Smallpock1", - L"Smallpock2", - L"Smallpock3", - L"Smallpock4", - L"Smallpock5", - L"Smallpock6", - L"Smallpock7", - L"Smallpock8", + L"HELMETPOS", + L"VESTPOS", + L"LEGPOS", + L"HEAD1POS", + L"HEAD2POS", + L"HANDPOS", + L"SECONDHANDPOS", + L"VESTPOCKPOS", + L"LTHIGHPOCKPOS", + L"RTHIGHPOCKPOS", + L"CPACKPOCKPOS", + L"BPACKPOCKPOS", + L"GUNSLINGPOCKPOS", + L"KNIFEPOCKPOS", + L"BIGPOCK1POS (BODYPOSFINAL)", + L"BIGPOCK2POS", + L"BIGPOCK3POS", + L"BIGPOCK4POS", + L"BIGPOCK5POS", + L"BIGPOCK6POS", + L"BIGPOCK7POS", + L"MEDPOCK1POS (BIGPOCKFINAL)", + L"MEDPOCK2POS", + L"MEDPOCK3POS", + L"MEDPOCK4POS", + L"SMALLPOCK1POS (MEDPOCKFINAL)", + L"SMALLPOCK2POS", + L"SMALLPOCK3POS", + L"SMALLPOCK4POS", + L"SMALLPOCK5POS", + L"SMALLPOCK6POS", + L"SMALLPOCK7POS", + L"SMALLPOCK8POS", + L"SMALLPOCK9POS", + L"SMALLPOCK10POS", + L"SMALLPOCK11POS", + L"SMALLPOCK12POS", + L"SMALLPOCK13POS", + L"SMALLPOCK14POS", + L"SMALLPOCK15POS", + L"SMALLPOCK16POS", + L"SMALLPOCK17POS", + L"SMALLPOCK18POS", + L"SMALLPOCK19POS", + L"SMALLPOCK20POS", + L"SMALLPOCK21POS", + L"SMALLPOCK22POS", + L"SMALLPOCK23POS", + L"SMALLPOCK24POS", + L"SMALLPOCK25POS", + L"SMALLPOCK26POS", + L"SMALLPOCK27POS", + L"SMALLPOCK28POS", + L"SMALLPOCK29POS", + L"SMALLPOCK30POS", }; @@ -380,7 +421,7 @@ typedef void (*TEXT_ENTRY_CALLBACK)( INT32 ); //Callback for when the text entr typedef struct { - LISTBOX_DISPLAY_FNCTN DisplayFunction; // The array of items + LISTBOX_DISPLAY_FNCTN DisplayFunction; // The array of items UINT16 usScrollPosX; // Top Left Pos of list box UINT16 usScrollPosY; // Top Left Pos of list box @@ -392,15 +433,15 @@ typedef struct UINT16 usScrollBoxY; // Current Vertical location of the scroll box UINT16 usScrollBoxEndY; // Bottom position on the scroll box UINT16 usScrollArrowHeight; // Scroll Arrow height - + INT16 sCurSelectedItem; // Currently selected item UINT16 usItemDisplayedOnTopOfList; // item at the top of displayed list UINT16 usStartIndex; // index to start at for the array of elements UINT16 usMaxArrayIndex; // Max Size of the array UINT16 usNumDisplayedItems; // Num of displayed item - UINT16 usMaxNumDisplayedItems; // Max number of Displayed items + UINT16 usMaxNumDisplayedItems; // Max number of Displayed items - UINT8 ubCurScrollBoxAction; // Holds the status of the current action ( create; destroy... ) + UINT8 ubCurScrollBoxAction; // Holds the status of the current action ( create; destroy... ) } SCROLL_BOX; @@ -422,9 +463,9 @@ BOOLEAN gfQuestDebugExit = FALSE; BOOLEAN gfRedrawQuestDebugSystem = TRUE; -UINT16 gusQuestDebugBlue; -UINT16 gusQuestDebugLtBlue; -UINT16 gusQuestDebugDkBlue; +UINT16 gusQuestDebugBlue; +UINT16 gusQuestDebugLtBlue; +UINT16 gusQuestDebugDkBlue; //UINT16 gusFactAtTopOfList; // duplicate definition in the same file (jonathanl) @@ -436,7 +477,7 @@ SCROLL_BOX gItemListBox; // The Npc Scroll box SCROLL_BOX *gpActiveListBox; // Only 1 scroll box is active at a time, this is set to it. -UINT16 gusQdsEnteringGridNo =0; +INT16 gsQdsEnteringGridNo =0; UINT8 gubTextEntryAction = QD_DROP_DOWN_NO_ACTION; @@ -454,7 +495,7 @@ UINT8 gubCurQuestSelected; UINT16 gusCurFactSelected; UINT16 gusFactAtTopOfList; -//INT16 gsCurrentNPCLog=-1; //If this is set, the value will be set to the +//INT16 gsCurrentNPCLog=-1; //If this is set, the value will be set to the BOOLEAN gfNpcLogButton = FALSE; @@ -540,21 +581,21 @@ void BtnQuestDebugRPCSaySectorDescToggleCallback(GUI_BUTTON *btn,INT32 reason); -MOUSE_REGION gSelectedNpcListRegion[ QUEST_DBS_MAX_DISPLAYED_ENTRIES ]; +MOUSE_REGION gSelectedNpcListRegion[ QUEST_DBS_MAX_DISPLAYED_ENTRIES ]; void SelectNpcListRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); void SelectNpcListMovementCallBack(MOUSE_REGION * pRegion, INT32 iReason ); -MOUSE_REGION gScrollAreaRegion[ QUEST_DBS_NUM_INCREMENTS_IN_SCROLL_BAR ]; +MOUSE_REGION gScrollAreaRegion[ QUEST_DBS_NUM_INCREMENTS_IN_SCROLL_BAR ]; void ScrollAreaRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); void ScrollAreaMovementCallBack(MOUSE_REGION * pRegion, INT32 iReason ); -MOUSE_REGION gScrollArrowsRegion[2]; +MOUSE_REGION gScrollArrowsRegion[2]; void ScrollArrowsRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //Text entry Disable the screen -MOUSE_REGION gQuestTextEntryDebugDisableScreenRegion; +MOUSE_REGION gQuestTextEntryDebugDisableScreenRegion; void QuestDebugTextEntryDisableScreenRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //Ok button on the text entry form @@ -567,11 +608,11 @@ void BtnQuestDebugNPCInventOkBtnButtonCallback(GUI_BUTTON *btn,INT32 reason); //Mouse regions for the Quests -MOUSE_REGION gQuestListRegion[ QUEST_DBS_NUM_DISPLAYED_QUESTS ]; +MOUSE_REGION gQuestListRegion[ QUEST_DBS_NUM_DISPLAYED_QUESTS ]; void ScrollQuestListRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); //Mouse regions for the Facts -MOUSE_REGION gFactListRegion[ QUEST_DBS_NUM_DISPLAYED_FACTS ]; +MOUSE_REGION gFactListRegion[ QUEST_DBS_NUM_DISPLAYED_FACTS ]; void ScrollFactListRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); @@ -659,8 +700,8 @@ UINT32 QuestDebugScreenInit() //Set so next time we come in, we can set up gfQuestDebugEntry = TRUE; - - gusQuestDebugBlue = Get16BPPColor( FROMRGB( 65, 79, 94 ) ); + + gusQuestDebugBlue = Get16BPPColor( FROMRGB( 65, 79, 94 ) ); //Initialize which facts are at the top of the list gusFactAtTopOfList = 0; @@ -683,7 +724,7 @@ UINT32 QuestDebugScreenInit() gNpcListBox.usScrollArrowHeight = QUEST_DBS_SCROLL_ARROW_HEIGHT; gNpcListBox.usScrollBarHeight = gNpcListBox.usScrollHeight - ( 2 * gNpcListBox.usScrollArrowHeight ); gNpcListBox.usScrollBarWidth = QUEST_DBS_SCROLL_BAR_WIDTH; - + gNpcListBox.sCurSelectedItem = -1; gNpcListBox.usItemDisplayedOnTopOfList = 0;//FIRST_RPC; gNpcListBox.usStartIndex = 0;//FIRST_RPC; @@ -708,7 +749,7 @@ UINT32 QuestDebugScreenInit() gItemListBox.usScrollArrowHeight = QUEST_DBS_SCROLL_ARROW_HEIGHT; gItemListBox.usScrollBarHeight = gItemListBox.usScrollHeight - ( 2 * gItemListBox.usScrollArrowHeight ); gItemListBox.usScrollBarWidth = QUEST_DBS_SCROLL_BAR_WIDTH; - + gItemListBox.sCurSelectedItem = -1; gItemListBox.usItemDisplayedOnTopOfList = 1; @@ -720,7 +761,7 @@ UINT32 QuestDebugScreenInit() gItemListBox.ubCurScrollBoxAction = QD_DROP_DOWN_NO_ACTION; - gfUseLocalNPCs = FALSE; + gfUseLocalNPCs = FALSE; //Set up the global list box @@ -791,8 +832,8 @@ UINT32 QuestDebugScreenHandle() } - // render buttons marked dirty - RenderButtons( ); + // render buttons marked dirty + RenderButtons( ); //To handle the dialog HandleDialogue(); @@ -848,7 +889,7 @@ BOOLEAN EnterQuestDebugSystem() // UINT16 zItemDesc[ SIZE_ITEM_INFO ]; UINT16 usFontHeight = GetFontHeight( QUEST_DBS_FONT_DYNAMIC_TEXT ) + 2; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; if( gfExitQdsDueToMessageBox ) { @@ -861,25 +902,25 @@ BOOLEAN EnterQuestDebugSystem() QuestDebug_ExitTactical(); MSYS_DefineRegion( &gQuestDebugSysScreenRegions, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGH, - CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); // Add region MSYS_AddRegion( &gQuestDebugSysScreenRegions ); - guiQuestDebugExitButton = + guiQuestDebugExitButton = CreateTextButton( QuestDebugText[ QUEST_DBS_EXIT_QUEST_DEBUG ], QUEST_DBS_FONT_STATIC_TEXT, QUEST_DBS_COLOR_STATIC_TEXT, FONT_BLACK, BUTTON_USE_DEFAULT, 535, 450, 100, 25, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+10, BUTTON_NO_CALLBACK, BtnQuestDebugExitButtonCallback ); //Check box to toggle between all and local npc's - guiQuestDebugAllOrSectorNPCToggle = + guiQuestDebugAllOrSectorNPCToggle = CreateCheckBoxButton( QUEST_DBS_NPC_CHCKBOX_TGL_X, QUEST_DBS_NPC_CHCKBOX_TGL_Y, "INTERFACE\\checkbox.sti", MSYS_PRIORITY_HIGH+2, BtnQuestDebugAllOrSectorNPCToggleCallback ); // ButtonList[ iSummaryButton[ SUMMARY_PROGRESSCHECKBOX ] ]->uiFlags |= BUTTON_CLICKED_ON; //Currently Selected NPC button - guiQuestDebugCurNPCButton = + guiQuestDebugCurNPCButton = CreateTextButton( QuestDebugText[ QUEST_DBS_SELECTED_NPC ], QUEST_DBS_FONT_STATIC_TEXT, QUEST_DBS_COLOR_STATIC_TEXT, FONT_BLACK, BUTTON_USE_DEFAULT, QUEST_DBS_SELECTED_NPC_BUTN_X, QUEST_DBS_SELECTED_NPC_BUTN_Y, QUEST_DBS_LIST_BOX_WIDTH, QDS_BUTTON_HEIGHT, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+2, BUTTON_NO_CALLBACK, BtnQuestDebugCurNPCButtonCallback ); @@ -887,91 +928,91 @@ BOOLEAN EnterQuestDebugSystem() // Currently Selected item button - guiQuestDebugCurItemButton = + guiQuestDebugCurItemButton = CreateTextButton( QuestDebugText[ QUEST_DBS_SELECTED_ITEM ], QUEST_DBS_FONT_STATIC_TEXT, QUEST_DBS_COLOR_STATIC_TEXT, FONT_BLACK, BUTTON_USE_DEFAULT, QUEST_DBS_SELECTED_ITEM_BUTN_X, QUEST_DBS_SELECTED_ITEM_BUTN_Y, QUEST_DBS_LIST_BOX_WIDTH, QDS_BUTTON_HEIGHT, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+2, BUTTON_NO_CALLBACK, BtnQuestDebugCurItemButtonCallback); // Add NPC to location - guiQuestDebugAddNpcToLocationButton = + guiQuestDebugAddNpcToLocationButton = CreateTextButton( QuestDebugText[ QUEST_DBS_ADD_CURRENT_NPC ], QUEST_DBS_FONT_STATIC_TEXT, QUEST_DBS_COLOR_STATIC_TEXT, FONT_BLACK, BUTTON_USE_DEFAULT, QUEST_DBS_ADD_NPC_BTN_X, QUEST_DBS_ADD_NPC_BTN_Y, QUEST_DBS_LIST_BOX_WIDTH, QDS_BUTTON_HEIGHT, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+2, BUTTON_NO_CALLBACK, BtnQuestDebugAddNpcToLocationButtonCallback); // Add item to location - guiQuestDebugAddItemToLocationButton = + guiQuestDebugAddItemToLocationButton = CreateTextButton( QuestDebugText[ QUEST_DBS_ADD_CURRENT_ITEM ], QUEST_DBS_FONT_STATIC_TEXT, QUEST_DBS_COLOR_STATIC_TEXT, FONT_BLACK, BUTTON_USE_DEFAULT, QUEST_DBS_ADD_ITEM_BTN_X, QUEST_DBS_ADD_ITEM_BTN_Y, QUEST_DBS_LIST_BOX_WIDTH, QDS_BUTTON_HEIGHT, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+2, BUTTON_NO_CALLBACK, BtnQuestDebugAddItemToLocationButtonCallback); // Give item to Npc - guiQuestDebugGiveItemToNPCButton = + guiQuestDebugGiveItemToNPCButton = CreateTextButton( QuestDebugText[ QUEST_DBS_GIVE_ITEM_TO_NPC ], QUEST_DBS_FONT_STATIC_TEXT, QUEST_DBS_COLOR_STATIC_TEXT, FONT_BLACK, BUTTON_USE_DEFAULT, QUEST_DBS_GIVE_ITEM_TO_NPC_BTN_X, QUEST_DBS_GIVE_ITEM_TO_NPC_BTN_Y, QUEST_DBS_LIST_BOX_WIDTH, QDS_BUTTON_HEIGHT, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+2, BUTTON_NO_CALLBACK, BtnQuestDebugGiveItemToNPCButtonCallback); - // Change Day - guiQuestDebugChangeDayButton = + // Change Day + guiQuestDebugChangeDayButton = CreateTextButton( QuestDebugText[ QUEST_DBS_CHANGE_DAY ], QUEST_DBS_FONT_STATIC_TEXT, QUEST_DBS_COLOR_STATIC_TEXT, FONT_BLACK, BUTTON_USE_DEFAULT, QUEST_DBS_CHANGE_DAY_BTN_X, QUEST_DBS_CHANGE_DAY_BTN_Y, QUEST_DBS_LIST_BOX_WIDTH, QDS_BUTTON_HEIGHT, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+2, BUTTON_NO_CALLBACK, BtnQuestDebugChangeDayButtonCallback ); // View NPC Inventory - guiQuestDebugViewNPCInvButton = + guiQuestDebugViewNPCInvButton = CreateTextButton( QuestDebugText[ QUEST_DBS_VIEW_NPC_INVENTORY ], QUEST_DBS_FONT_STATIC_TEXT, QUEST_DBS_COLOR_STATIC_TEXT, FONT_BLACK, BUTTON_USE_DEFAULT, QUEST_DBS_VIEW_NPC_INV_BTN_X, QUEST_DBS_VIEW_NPC_INV_BTN_Y, QUEST_DBS_LIST_BOX_WIDTH, QDS_BUTTON_HEIGHT, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+2, BUTTON_NO_CALLBACK, BtnQuestDebugViewNPCInvButtonCallback ); // Restore NPC Inventory - guiQuestDebugRestoreNPCInvButton = + guiQuestDebugRestoreNPCInvButton = CreateTextButton( QuestDebugText[ QUEST_DBS_RESTORE_NPC_INVENTORY ], QUEST_DBS_FONT_STATIC_TEXT, QUEST_DBS_COLOR_STATIC_TEXT, FONT_BLACK, BUTTON_USE_DEFAULT, QUEST_DBS_RESTORE_NPC_INV_BTN_X, QUEST_DBS_RESTORE_NPC_INV_BTN_Y, QUEST_DBS_LIST_BOX_WIDTH, QDS_BUTTON_HEIGHT, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+2, BUTTON_NO_CALLBACK, BtnQuestDebugRestoreNPCInvButtonCallback ); - // NPC log button + // NPC log button swprintf( zName, L"%s - (%s)", QuestDebugText[ QUEST_DBS_NPC_LOG_BUTTON ], gfNpcLogButton ? L"On" : L"Off"); - guiQuestDebugNPCLogButtonButton = + guiQuestDebugNPCLogButtonButton = CreateTextButton( zName, QUEST_DBS_FONT_STATIC_TEXT, QUEST_DBS_COLOR_STATIC_TEXT, FONT_BLACK, BUTTON_USE_DEFAULT, QUEST_DBS_NPC_LOG_BTN_X, QUEST_DBS_NPC_LOG_BTN_Y, QUEST_DBS_LIST_BOX_WIDTH, QDS_BUTTON_HEIGHT, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+2, BUTTON_NO_CALLBACK, BtnQuestDebugNPCLogButtonButtonCallback ); - guiQuestDebugNPCRefreshButtonButton = + guiQuestDebugNPCRefreshButtonButton = CreateTextButton( QuestDebugText[ QUEST_DBS_REFRESH_NPC ], QUEST_DBS_FONT_STATIC_TEXT, QUEST_DBS_COLOR_STATIC_TEXT, FONT_BLACK, BUTTON_USE_DEFAULT, QUEST_DBS_NPC_REFRESH_BTN_X, QUEST_DBS_NPC_REFRESH_BTN_Y, QUEST_DBS_LIST_BOX_WIDTH, QDS_BUTTON_HEIGHT, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+2, BUTTON_NO_CALLBACK, BtnQuestDebugNPCRefreshButtonButtonCallback ); //Start the selected merc talking - guiQuestDebugStartMercTalkingButtonButton = + guiQuestDebugStartMercTalkingButtonButton = CreateTextButton( QuestDebugText[ QUEST_DBS_START_MERC_TALKING ], QUEST_DBS_FONT_STATIC_TEXT, QUEST_DBS_COLOR_STATIC_TEXT, FONT_BLACK, BUTTON_USE_DEFAULT, QUEST_DBS_START_MERC_TALKING_BTN_X, QUEST_DBS_START_MERC_TALKING_BTN_Y, QUEST_DBS_LIST_BOX_WIDTH, QDS_BUTTON_HEIGHT, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+2, BUTTON_NO_CALLBACK, BtnQuestDebugStartMercTalkingButtonButtonCallback ); - guiQDPgUpButtonButton = + guiQDPgUpButtonButton = CreateTextButton( QuestDebugText[ QUEST_DBS_PG_FACTS_UP ], QUEST_DBS_FONT_STATIC_TEXT, QUEST_DBS_COLOR_STATIC_TEXT, FONT_BLACK, BUTTON_USE_DEFAULT, QUEST_DBS_SECOND_COL_NUMBER_X+5, QUEST_DBS_SECOND_COL_NUMBER_Y + QUEST_DBS_LIST_TEXT_OFFSET, QUEST_DBS_LIST_BOX_WIDTH, QDS_BUTTON_HEIGHT, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+2, BUTTON_NO_CALLBACK, BtnQDPgUpButtonButtonCallback ); - guiQDPgDownButtonButton = + guiQDPgDownButtonButton = CreateTextButton( QuestDebugText[ QUEST_DBS_PG_FACTS_DOWN ], QUEST_DBS_FONT_STATIC_TEXT, QUEST_DBS_COLOR_STATIC_TEXT, FONT_BLACK, BUTTON_USE_DEFAULT, QUEST_DBS_SECOND_COL_NUMBER_X+5, QUEST_DBS_SECOND_COL_NUMBER_Y + 15 * QUEST_DBS_NUM_DISPLAYED_FACTS + QUEST_DBS_LIST_TEXT_OFFSET, QUEST_DBS_LIST_BOX_WIDTH, QDS_BUTTON_HEIGHT, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+2, BUTTON_NO_CALLBACK, BtnQDPgDownButtonButtonCallback ); - + //checkbox for weather to add the merc to the players team - guiQuestDebugAddNpcToTeamToggle = + guiQuestDebugAddNpcToTeamToggle = CreateCheckBoxButton( QUEST_DBS_ADD_NPC_TO_TEAM_BTN_X, QUEST_DBS_ADD_NPC_TO_TEAM_BTN_Y, "INTERFACE\\checkbox.sti", MSYS_PRIORITY_HIGH+2, BtnQuestDebugAddNpcToTeamToggleCallback ); if( gfAddNpcToTeam ) ButtonList[ guiQuestDebugAddNpcToTeamToggle ]->uiFlags |= BUTTON_CLICKED_ON; //checkbox for weather have rpc say the sector description - guiQuestDebugRPCSaySectorDescToggle = + guiQuestDebugRPCSaySectorDescToggle = CreateCheckBoxButton( QUEST_DBS_RPC_TO_SAY_SECTOR_DESC_BTN_X, QUEST_DBS_RPC_TO_SAY_SECTOR_DESC_BTN_Y, "INTERFACE\\checkbox.sti", MSYS_PRIORITY_HIGH+2, BtnQuestDebugRPCSaySectorDescToggleCallback ); if( gfRpcToSaySectorDesc ) ButtonList[ guiQuestDebugRPCSaySectorDescToggle ]->uiFlags |= BUTTON_CLICKED_ON; @@ -979,7 +1020,7 @@ BOOLEAN EnterQuestDebugSystem() //Setup mouse regions for the Quest list usPosX = QUEST_DBS_FIRST_COL_NUMBER_X; - usPosY = QUEST_DBS_FIRST_COL_NUMBER_Y + QUEST_DBS_LIST_TEXT_OFFSET; + usPosY = QUEST_DBS_FIRST_COL_NUMBER_Y + QUEST_DBS_LIST_TEXT_OFFSET; for( i=0; i< QUEST_DBS_NUM_DISPLAYED_QUESTS; i++) { MSYS_DefineRegion( &gQuestListRegion[ i ], usPosX, usPosY, (UINT16)(usPosX+QUEST_DBS_FIRST_SECTION_WIDTH), (UINT16)(usPosY+usFontHeight), MSYS_PRIORITY_HIGH+2, @@ -1007,7 +1048,7 @@ BOOLEAN EnterQuestDebugSystem() } - + // load Scroll Horizontal Arrow graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("INTERFACE\\Qd_ScrollArrows.sti", VObjectDesc.ImageFile); @@ -1026,7 +1067,7 @@ BOOLEAN EnterQuestDebugSystem() AddNPCsInSectorToArray(); //Remove the mouse region over the clock - RemoveMouseRegionForPauseOfClock( ); + RemoveMouseRegionForPauseOfClock( ); //Disable the buttons the depend on a seleted item or npc @@ -1044,9 +1085,9 @@ BOOLEAN EnterQuestDebugSystem() CHAR16 zItemDesc[ SIZE_ITEM_INFO ]; if( gfUseLocalNPCs ) - swprintf( zItemDesc, L"%d - %s", gubCurrentNpcInSector[ giHaveSelectedNPC ], gMercProfiles[ gubCurrentNpcInSector[ giHaveSelectedNPC ] ].zNickname ); + swprintf( zItemDesc, L"%d - %s", gubCurrentNpcInSector[ giHaveSelectedNPC ], gMercProfiles[ gubCurrentNpcInSector[ giHaveSelectedNPC ] ].zNickname ); else - swprintf( zItemDesc, L"%d - %s", giHaveSelectedNPC, gMercProfiles[ giHaveSelectedNPC ].zNickname ); + swprintf( zItemDesc, L"%d - %s", giHaveSelectedNPC, gMercProfiles[ giHaveSelectedNPC ].zNickname ); SpecifyButtonText( guiQuestDebugCurNPCButton, zItemDesc ); gNpcListBox.sCurSelectedItem = (INT16)giHaveSelectedNPC; @@ -1082,7 +1123,7 @@ void ExitQuestDebugSystem() { return; } - MSYS_RemoveRegion( &gQuestDebugSysScreenRegions ); + MSYS_RemoveRegion( &gQuestDebugSysScreenRegions ); QuestDebug_EnterTactical(); RemoveButton( guiQuestDebugExitButton ); @@ -1178,7 +1219,7 @@ void HandleQuestDebugSystem() if( gfAddKeyNextPass ) { - swprintf( zTemp, L" Please enter the Keys ID. ( 0 - %d )", NUM_KEYS ); + swprintf( zTemp, L" Please enter the Keys ID. ( 0 - %d )", NUM_KEYS ); TextEntryBox( zTemp, AddKeyToGridNo ); gfAddKeyNextPass = FALSE; } @@ -1191,7 +1232,7 @@ void RenderQuestDebugSystem() { ColorFillQuestDebugScreenScreen( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); - //display the title + //display the title DisplayWrappedString( 0, 5, 640, 2, QUEST_DBS_FONT_TITLE, QUEST_DBS_COLOR_TITLE, QuestDebugText[ QUEST_DBS_TITLE], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); @@ -1215,13 +1256,13 @@ void RenderQuestDebugSystem() DisplayNPCInfo(); //Display the text beside the NPC in current sector toggle box - DrawTextToScreen( QuestDebugText[ QUEST_DBS_VIEW_LOCAL_NPC ], QUEST_DBS_NPC_CHCKBOX_TGL_X + 25, QUEST_DBS_NPC_CHCKBOX_TGL_Y+1, QUEST_DBS_NUMBER_COL_WIDTH, QUEST_DBS_FONT_DYNAMIC_TEXT, QUEST_DBS_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( QuestDebugText[ QUEST_DBS_VIEW_LOCAL_NPC ], QUEST_DBS_NPC_CHCKBOX_TGL_X + 25, QUEST_DBS_NPC_CHCKBOX_TGL_Y+1, QUEST_DBS_NUMBER_COL_WIDTH, QUEST_DBS_FONT_DYNAMIC_TEXT, QUEST_DBS_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); //Display the text beside the add npc to team toggle box - DrawTextToScreen( QuestDebugText[ QUEST_DBS_ADD_NPC_TO_TEAM ], QUEST_DBS_NPC_CHCKBOX_TGL_X + 25, QUEST_DBS_ADD_NPC_TO_TEAM_BTN_Y+1, QUEST_DBS_NUMBER_COL_WIDTH, QUEST_DBS_FONT_DYNAMIC_TEXT, QUEST_DBS_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( QuestDebugText[ QUEST_DBS_ADD_NPC_TO_TEAM ], QUEST_DBS_NPC_CHCKBOX_TGL_X + 25, QUEST_DBS_ADD_NPC_TO_TEAM_BTN_Y+1, QUEST_DBS_NUMBER_COL_WIDTH, QUEST_DBS_FONT_DYNAMIC_TEXT, QUEST_DBS_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); //Display the text beside the rpc say sector desc quotes - DrawTextToScreen( QuestDebugText[ QUEST_DBS_RPC_SAY_SECTOR_DESC ], QUEST_DBS_NPC_CHCKBOX_TGL_X + 25, QUEST_DBS_RPC_TO_SAY_SECTOR_DESC_BTN_Y, QUEST_DBS_NUMBER_COL_WIDTH, QUEST_DBS_FONT_DYNAMIC_TEXT, QUEST_DBS_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( QuestDebugText[ QUEST_DBS_RPC_SAY_SECTOR_DESC ], QUEST_DBS_NPC_CHCKBOX_TGL_X + 25, QUEST_DBS_RPC_TO_SAY_SECTOR_DESC_BTN_Y, QUEST_DBS_NUMBER_COL_WIDTH, QUEST_DBS_FONT_DYNAMIC_TEXT, QUEST_DBS_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); DisplayCurrentGridNo(); @@ -1238,22 +1279,22 @@ void RenderQuestDebugSystem() //if there is a merc talking if( giSelectedMercCurrentQuote != -1 ) DisplayQDSCurrentlyQuoteNum( ); - - MarkButtonsDirty( ); + + MarkButtonsDirty( ); //InvalidateRegion( 0, 0, 640, 480 ); - InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); } void DisplayCurrentGridNo() { - if( gusQdsEnteringGridNo != 0 ) + if( gsQdsEnteringGridNo != 0 ) { CHAR16 zTemp[512]; - swprintf( zTemp, L"%s: %d", QuestDebugText[ QUEST_DBS_CURRENT_GRIDNO ], gusQdsEnteringGridNo ); - DrawTextToScreen( zTemp, QUEST_DBS_NPC_CURRENT_GRIDNO_X, QUEST_DBS_NPC_CURRENT_GRIDNO_Y, QUEST_DBS_NUMBER_COL_WIDTH, QUEST_DBS_FONT_DYNAMIC_TEXT, QUEST_DBS_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + swprintf( zTemp, L"%s: %d", QuestDebugText[ QUEST_DBS_CURRENT_GRIDNO ], gsQdsEnteringGridNo ); + DrawTextToScreen( zTemp, QUEST_DBS_NPC_CURRENT_GRIDNO_X, QUEST_DBS_NPC_CURRENT_GRIDNO_Y, QUEST_DBS_NUMBER_COL_WIDTH, QUEST_DBS_FONT_DYNAMIC_TEXT, QUEST_DBS_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); } } @@ -1263,12 +1304,12 @@ void DisplayCurrentGridNo() void GetUserInput() { InputAtom Event; - POINT MousePos; + POINT MousePos; UINT8 ubPanelMercShouldUse = WhichPanelShouldTalkingMercUse( /*giSelectedMercCurrentQuote*/ ); // doesn't take parameters (jonathanl) GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! + ScreenToClient(ghWindow, &MousePos); // In window coords! while( DequeueEvent( &Event ) ) { @@ -1285,7 +1326,7 @@ void GetUserInput() gfAddKeyNextPass = FALSE; - + EndMercTalking(); break; @@ -1396,7 +1437,7 @@ void GetUserInput() break; } } - + else if( Event.usEvent == KEY_REPEAT ) { switch( Event.usParam ) @@ -1489,8 +1530,8 @@ void QuestDebug_EnterTactical() void DisplaySectionLine( ) { - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; UINT16 usStartX; UINT16 usStartY; UINT16 usEndX; @@ -1501,13 +1542,13 @@ void DisplaySectionLine( ) usStartY = QUEST_DBS_FIRST_COL_NUMBER_Y; usEndY = 475; - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); - // draw the line in b/n the first and second section + // draw the line in b/n the first and second section SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, 640, 480); LineDraw(FALSE, usStartX, usStartY, usEndX, usEndY, Get16BPPColor( FROMRGB( 255, 255, 255 ) ), pDestBuf); - // draw the line in b/n the second and third section + // draw the line in b/n the second and third section usStartX = usEndX = QUEST_DBS_FIRST_SECTION_WIDTH + QUEST_DBS_SECOND_SECTION_WIDTH; LineDraw(FALSE, usStartX, usStartY, usEndX, usEndY, Get16BPPColor( FROMRGB( 255, 255, 255 ) ), pDestBuf); @@ -1528,7 +1569,7 @@ void DisplaySectionLine( ) void DisplayQuestInformation() { //Display Quests - DisplayWrappedString( 0, QUEST_DBS_SECTION_TITLE_Y, QUEST_DBS_FIRST_SECTION_WIDTH, 2, QUEST_DBS_FONT_TITLE, QUEST_DBS_COLOR_SUBTITLE, QuestDebugText[ QUEST_DBS_QUESTS ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DisplayWrappedString( 0, QUEST_DBS_SECTION_TITLE_Y, QUEST_DBS_FIRST_SECTION_WIDTH, 2, QUEST_DBS_FONT_TITLE, QUEST_DBS_COLOR_SUBTITLE, QuestDebugText[ QUEST_DBS_QUESTS ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); //Display Quest Number text DisplayWrappedString( QUEST_DBS_FIRST_COL_NUMBER_X, QUEST_DBS_FIRST_COL_NUMBER_Y, QUEST_DBS_NUMBER_COL_WIDTH, 2, QUEST_DBS_FONT_STATIC_TEXT, QUEST_DBS_COLOR_SUBTITLE, QuestDebugText[ QUEST_DBS_QUEST_NUMBER ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); @@ -1545,7 +1586,7 @@ void DisplayQuestInformation() void DisplayFactInformation() { //Display Fact - DisplayWrappedString( QUEST_DBS_FIRST_SECTION_WIDTH, QUEST_DBS_SECTION_TITLE_Y, QUEST_DBS_SECOND_SECTION_WIDTH, 2, QUEST_DBS_FONT_TITLE, QUEST_DBS_COLOR_SUBTITLE, QuestDebugText[ QUEST_DBS_FACTS ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DisplayWrappedString( QUEST_DBS_FIRST_SECTION_WIDTH, QUEST_DBS_SECTION_TITLE_Y, QUEST_DBS_SECOND_SECTION_WIDTH, 2, QUEST_DBS_FONT_TITLE, QUEST_DBS_COLOR_SUBTITLE, QuestDebugText[ QUEST_DBS_FACTS ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); //Display Fact Number text DisplayWrappedString( QUEST_DBS_SECOND_COL_NUMBER_X, QUEST_DBS_SECOND_COL_NUMBER_Y, QUEST_DBS_NUMBER_COL_WIDTH, 2, QUEST_DBS_FONT_STATIC_TEXT, QUEST_DBS_COLOR_SUBTITLE, QuestDebugText[ QUEST_DBS_FACT_NUMBER ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); @@ -1587,19 +1628,19 @@ void DisplayQuestList() UINT16 usPosY; usPosY = QUEST_DBS_FIRST_COL_NUMBER_Y + QUEST_DBS_LIST_TEXT_OFFSET; //&& (usCount < QUEST_DBS_MAX_DISPLAYED_ENTRIES ) - for( usLoop1=0, usCount=0; (usLoop1usMaxArrayIndex == 0 ) return( FALSE ); @@ -1773,8 +1814,8 @@ BOOLEAN CreateDestroyDisplaySelectNpcDropDownBox( ) for( i=0; i< gpActiveListBox->usNumDisplayedItems; i++) { MSYS_DefineRegion( &gSelectedNpcListRegion[i], usPosX, (UINT16)(usPosY), (UINT16)(usPosX + gpActiveListBox->usScrollWidth), (UINT16)(usPosY+usFontHeight), MSYS_PRIORITY_HIGH+20, - CURSOR_WWW, SelectNpcListMovementCallBack, SelectNpcListRegionCallBack); - MSYS_AddRegion(&gSelectedNpcListRegion[i]); + CURSOR_WWW, SelectNpcListMovementCallBack, SelectNpcListRegionCallBack); + MSYS_AddRegion(&gSelectedNpcListRegion[i]); MSYS_SetRegionUserData( &gSelectedNpcListRegion[ i ], 0, i); usPosY += usFontHeight; @@ -1793,8 +1834,8 @@ BOOLEAN CreateDestroyDisplaySelectNpcDropDownBox( ) for(i=0; iusScrollBarWidth), (UINT16)(usPosY + gpActiveListBox->usScrollBarHeight ), MSYS_PRIORITY_HIGH+20, - CURSOR_WWW, ScrollAreaMovementCallBack, ScrollAreaRegionCallBack); - MSYS_AddRegion(&gScrollAreaRegion[i]); + CURSOR_WWW, ScrollAreaMovementCallBack, ScrollAreaRegionCallBack); + MSYS_AddRegion(&gScrollAreaRegion[i]); MSYS_SetRegionUserData( &gScrollAreaRegion[ i ], 0, i ); } @@ -1803,16 +1844,16 @@ BOOLEAN CreateDestroyDisplaySelectNpcDropDownBox( ) usPosY = gpActiveListBox->usScrollPosY + 2; MSYS_DefineRegion( &gScrollArrowsRegion[0], usPosX, (UINT16)(usPosY), (UINT16)(usPosX+gpActiveListBox->usScrollBarWidth), (UINT16)(usPosY+gpActiveListBox->usScrollArrowHeight), MSYS_PRIORITY_HIGH+20, - CURSOR_WWW, MSYS_NO_CALLBACK, ScrollArrowsRegionCallBack); - MSYS_AddRegion(&gScrollArrowsRegion[0]); + CURSOR_WWW, MSYS_NO_CALLBACK, ScrollArrowsRegionCallBack); + MSYS_AddRegion(&gScrollArrowsRegion[0]); MSYS_SetRegionUserData( &gScrollArrowsRegion[ 0 ], 0, 0 ); //Bottom Scroll arrow usPosY = gpActiveListBox->usScrollPosY + gpActiveListBox->usScrollHeight - gpActiveListBox->usScrollArrowHeight - 2; MSYS_DefineRegion( &gScrollArrowsRegion[1], usPosX, usPosY, (UINT16)(usPosX+gpActiveListBox->usScrollBarWidth), (UINT16)(usPosY + gpActiveListBox->usScrollArrowHeight), MSYS_PRIORITY_HIGH+20, - CURSOR_WWW, MSYS_NO_CALLBACK, ScrollArrowsRegionCallBack); - MSYS_AddRegion(&gScrollArrowsRegion[1]); + CURSOR_WWW, MSYS_NO_CALLBACK, ScrollArrowsRegionCallBack); + MSYS_AddRegion(&gScrollArrowsRegion[1]); MSYS_SetRegionUserData( &gScrollArrowsRegion[ 1 ], 0, 1 ); @@ -1820,8 +1861,8 @@ BOOLEAN CreateDestroyDisplaySelectNpcDropDownBox( ) if( !gfBackgroundMaskEnabled ) { MSYS_DefineRegion( &gQuestTextEntryDebugDisableScreenRegion, 0, 0, 640, 480, MSYS_PRIORITY_HIGH+15, - CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, QuestDebugTextEntryDisableScreenRegionCallBack ); - MSYS_AddRegion(&gQuestTextEntryDebugDisableScreenRegion); + CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, QuestDebugTextEntryDisableScreenRegionCallBack ); + MSYS_AddRegion(&gQuestTextEntryDebugDisableScreenRegion); gfBackgroundMaskEnabled = TRUE; } @@ -1846,14 +1887,14 @@ BOOLEAN CreateDestroyDisplaySelectNpcDropDownBox( ) { // delete the mouse regions for the words for( i=0; i< gpActiveListBox->usNumDisplayedItems; i++) - MSYS_RemoveRegion( &gSelectedNpcListRegion[i]); + MSYS_RemoveRegion( &gSelectedNpcListRegion[i]); fMouseRegionsCreated = FALSE; //scroll arrows for( i=0; i< 2; i++) - MSYS_RemoveRegion( &gScrollArrowsRegion[i]); - + MSYS_RemoveRegion( &gScrollArrowsRegion[i]); + for(i=0; iusMaxArrayIndex == 0 ) @@ -1921,7 +1962,7 @@ void DisplaySelectedListBox( ) usPosY = gpActiveListBox->usScrollPosY + 2; //clear the background - ColorFillVideoSurfaceArea( FRAME_BUFFER, usPosX, usPosY-1, usPosX+gpActiveListBox->usScrollWidth, usPosY + gpActiveListBox->usScrollHeight, Get16BPPColor( FROMRGB( 45, 59, 74 ) ) ); + ColorFillVideoSurfaceArea( FRAME_BUFFER, usPosX, usPosY-1, usPosX+gpActiveListBox->usScrollWidth, usPosY + gpActiveListBox->usScrollHeight, Get16BPPColor( FROMRGB( 45, 59, 74 ) ) ); //Display the selected list box's display function @@ -1932,15 +1973,15 @@ void DisplaySelectedListBox( ) usPosX = gpActiveListBox->usScrollPosX+gpActiveListBox->usScrollWidth; usPosY = gpActiveListBox->usScrollPosY + 2; - ColorFillVideoSurfaceArea( FRAME_BUFFER, usPosX, usPosY-1, usPosX+gpActiveListBox->usScrollBarWidth, usPosY+ gpActiveListBox->usScrollHeight, Get16BPPColor( FROMRGB( 192, 192, 192 ) ) ); + ColorFillVideoSurfaceArea( FRAME_BUFFER, usPosX, usPosY-1, usPosX+gpActiveListBox->usScrollBarWidth, usPosY+ gpActiveListBox->usScrollHeight, Get16BPPColor( FROMRGB( 192, 192, 192 ) ) ); //get and display the up and down arrows GetVideoObject(&hImageHandle, guiQdScrollArrowImage); - //top arrow + //top arrow BltVideoObject(FRAME_BUFFER, hImageHandle, 0, usPosX-5, usPosY-1, VO_BLT_SRCTRANSPARENCY,NULL); - //Bottom arrow + //Bottom arrow BltVideoObject(FRAME_BUFFER, hImageHandle, 1, usPosX, usPosY + gpActiveListBox->usScrollHeight - gpActiveListBox->usScrollArrowHeight, VO_BLT_SRCTRANSPARENCY,NULL); //display the scroll rectangle @@ -1955,9 +1996,9 @@ void DisplaySelectedNPC() { UINT16 i; UINT16 usPosX, usPosY; - INT16 usLocationX = 0, usLocationY = 0; + INT16 usLocationX = 0, usLocationY = 0; UINT16 usFontHeight = GetFontHeight( QUEST_DBS_FONT_LISTBOX_TEXT ) + 2; - CHAR16 sTempString[ 64 ]; + CHAR16 sTempString[ 64 ]; CHAR16 zButtonName[ 256 ]; @@ -1970,7 +2011,7 @@ void DisplaySelectedNPC() { if( gfUseLocalNPCs ) { - DrawTextToScreen( gMercProfiles[ gubCurrentNpcInSector[ i ] ].zNickname, usPosX, usPosY, 0, QUEST_DBS_FONT_DYNAMIC_TEXT, QUEST_DBS_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( gMercProfiles[ gubCurrentNpcInSector[ i ] ].zNickname, usPosX, usPosY, 0, QUEST_DBS_FONT_DYNAMIC_TEXT, QUEST_DBS_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); GetDebugLocationString( gubCurrentNpcInSector[ i ], sTempString ); @@ -2004,9 +2045,9 @@ void DisplaySelectedNPC() //display the name in the list ColorFillVideoSurfaceArea( FRAME_BUFFER, gpActiveListBox->usScrollPosX, usPosY - 1, gpActiveListBox->usScrollPosX+gpActiveListBox->usScrollWidth, usPosY+usFontHeight - 1, Get16BPPColor( FROMRGB( 255, 255, 255 ) ) ); - SetFontShadow(NO_SHADOW); + SetFontShadow(NO_SHADOW); + - // the highlighted name if( gfUseLocalNPCs ) { @@ -2031,14 +2072,14 @@ void DisplaySelectedNPC() SetFontShadow(DEFAULT_SHADOW); if( gfUseLocalNPCs ) - swprintf( zButtonName, L"%d - %s", gubCurrentNpcInSector[ gpActiveListBox->sCurSelectedItem ], gMercProfiles[ gubCurrentNpcInSector[ gpActiveListBox->sCurSelectedItem ] ].zNickname ); + swprintf( zButtonName, L"%d - %s", gubCurrentNpcInSector[ gpActiveListBox->sCurSelectedItem ], gMercProfiles[ gubCurrentNpcInSector[ gpActiveListBox->sCurSelectedItem ] ].zNickname ); else - swprintf( zButtonName, L"%d - %s", gpActiveListBox->sCurSelectedItem, gMercProfiles[ gpActiveListBox->sCurSelectedItem ].zNickname ); + swprintf( zButtonName, L"%d - %s", gpActiveListBox->sCurSelectedItem, gMercProfiles[ gpActiveListBox->sCurSelectedItem ].zNickname ); SpecifyButtonText( guiQuestDebugCurNPCButton, zButtonName ); } - - SetFontShadow( DEFAULT_SHADOW ); + + SetFontShadow( DEFAULT_SHADOW ); } @@ -2050,7 +2091,7 @@ void DisplaySelectedItem() UINT16 usFontHeight = GetFontHeight( QUEST_DBS_FONT_LISTBOX_TEXT ) + 2; CHAR16 zItemName[ SIZE_ITEM_NAME ]; // CHAR16 zItemDesc[ SIZE_ITEM_INFO ]; - + CHAR16 zButtonName[ 256 ]; @@ -2068,7 +2109,7 @@ void DisplaySelectedItem() if( zItemName[0] == '\0' ) wcscpy( zItemName, QuestDebugText[ QUEST_DBS_NO_ITEM ] ); - DrawTextToScreen( zItemName, usPosX, usPosY, 0, QUEST_DBS_FONT_DYNAMIC_TEXT, QUEST_DBS_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( zItemName, usPosX, usPosY, 0, QUEST_DBS_FONT_DYNAMIC_TEXT, QUEST_DBS_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); usPosY += usFontHeight; } @@ -2080,7 +2121,7 @@ void DisplaySelectedItem() //display the name in the list ColorFillVideoSurfaceArea( FRAME_BUFFER, gpActiveListBox->usScrollPosX, usPosY - 1, gpActiveListBox->usScrollPosX+gpActiveListBox->usScrollWidth, usPosY+usFontHeight - 1, Get16BPPColor( FROMRGB( 255, 255, 255 ) ) ); - SetFontShadow(NO_SHADOW); + SetFontShadow(NO_SHADOW); // if ( !LoadItemInfo( gpActiveListBox->sCurSelectedItem, zItemName, zItemDesc ) ) // Assert(0); @@ -2098,13 +2139,13 @@ void DisplaySelectedItem() SpecifyButtonText( guiQuestDebugCurItemButton, zButtonName ); } - SetFontShadow(DEFAULT_SHADOW); + SetFontShadow(DEFAULT_SHADOW); } void SelectNpcListRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -2114,13 +2155,13 @@ void SelectNpcListRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) gpActiveListBox->ubCurScrollBoxAction = QD_DROP_DOWN_DESTROY;//qq gpActiveListBox->sCurSelectedItem = ubSelected + gpActiveListBox->usItemDisplayedOnTopOfList; - } + } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { gpActiveListBox->ubCurScrollBoxAction = QD_DROP_DOWN_DESTROY; CreateDestroyDisplaySelectNpcDropDownBox(); gpActiveListBox->ubCurScrollBoxAction = QD_DROP_DOWN_NO_ACTION; - } + } } @@ -2169,13 +2210,13 @@ void SelectNpcListMovementCallBack(MOUSE_REGION * pRegion, INT32 reason ) InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); } -} +} void DrawQdsScrollRectangle( ) //INT16 sSelectedEntry, UINT16 usStartPosX, UINT16 usStartPosY, UINT16 usScrollAreaHeight, UINT16 usNumEntries ) { - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; UINT16 usWidth, usTempPosY; UINT16 usHeight, usPosY, usPosX; @@ -2187,11 +2228,11 @@ void DrawQdsScrollRectangle( ) //INT16 sSelectedEntry, UINT16 usStartPosX, UINT1 usTempPosY = gpActiveListBox->usScrollPosY + gpActiveListBox->usScrollArrowHeight; usPosX = gpActiveListBox->usScrollPosX + gpActiveListBox->usScrollWidth; usWidth = gpActiveListBox->usScrollBarWidth; - + usHeight = (UINT16)(gpActiveListBox->usScrollBarHeight / (FLOAT)( usNumEntries ) + .5 );//qq+ 1 ); if( usNumEntries > gpActiveListBox->usMaxNumDisplayedItems ) - usPosY = usTempPosY + (UINT16)( ( gpActiveListBox->usScrollBarHeight / (FLOAT)(usNumEntries +1) ) * ( gpActiveListBox->sCurSelectedItem - gpActiveListBox->usStartIndex ) ); + usPosY = usTempPosY + (UINT16)( ( gpActiveListBox->usScrollBarHeight / (FLOAT)(usNumEntries +1) ) * ( gpActiveListBox->sCurSelectedItem - gpActiveListBox->usStartIndex ) ); else usPosY = usTempPosY; @@ -2207,17 +2248,17 @@ void DrawQdsScrollRectangle( ) //INT16 sSelectedEntry, UINT16 usStartPosX, UINT1 ColorFillVideoSurfaceArea( FRAME_BUFFER, usPosX, usPosY, usPosX+usWidth-1, usPosY+usHeight, Get16BPPColor( FROMRGB( 130, 132, 128 ) ) ); //display the line - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, 640, 480); - // draw the gold highlite line on the top and left + // draw the gold highlite line on the top and left LineDraw(FALSE, usPosX, usPosY, usPosX+usWidth-1, usPosY, Get16BPPColor( FROMRGB( 255, 255, 255 ) ), pDestBuf); LineDraw(FALSE, usPosX, usPosY, usPosX, usPosY+usHeight, Get16BPPColor( FROMRGB( 255, 255, 255 ) ), pDestBuf); - // draw the shadow line on the bottom and right + // draw the shadow line on the bottom and right LineDraw(FALSE, usPosX, usPosY+usHeight, usPosX+usWidth-1, usPosY+usHeight, Get16BPPColor( FROMRGB( 112, 110, 112 ) ), pDestBuf); LineDraw(FALSE, usPosX+usWidth-1, usPosY, usPosX+usWidth-1, usPosY+usHeight, Get16BPPColor( FROMRGB( 112, 110, 112 ) ), pDestBuf); - + // unlock frame buffer UnLockVideoSurface( FRAME_BUFFER ); } @@ -2225,7 +2266,7 @@ void DrawQdsScrollRectangle( ) //INT16 sSelectedEntry, UINT16 usStartPosX, UINT1 void ScrollArrowsRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -2256,21 +2297,21 @@ void ScrollArrowsRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) if( gpActiveListBox->sCurSelectedItem < gpActiveListBox->usItemDisplayedOnTopOfList ) gpActiveListBox->usItemDisplayedOnTopOfList--; } - + DisplaySelectedListBox( ); - } + } } void ScrollAreaRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) { CalcPositionOfNewScrollBoxLocation(); - } + } else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT) { CalcPositionOfNewScrollBoxLocation(); @@ -2280,7 +2321,7 @@ void ScrollAreaRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) gpActiveListBox->ubCurScrollBoxAction = QD_DROP_DOWN_DESTROY; CreateDestroyDisplaySelectNpcDropDownBox(); gpActiveListBox->ubCurScrollBoxAction = QD_DROP_DOWN_NO_ACTION; - } + } } @@ -2310,7 +2351,7 @@ void ScrollAreaMovementCallBack(MOUSE_REGION * pRegion, INT32 reason ) InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); } -} +} void CalcPositionOfNewScrollBoxLocation() @@ -2319,8 +2360,6 @@ void CalcPositionOfNewScrollBoxLocation() INT16 sIncrementValue; FLOAT dValue; INT16 sHeight=0; -// INT16 sHeightOfScrollBox = (INT16)(gpActiveListBox->usScrollBarHeight / (FLOAT)(gpActiveListBox->usMaxArrayIndex - gpActiveListBox->usStartIndex ) + .5); - INT16 sHeightOfScrollBox = (INT16)(gpActiveListBox->usScrollBarHeight / (FLOAT)(gpActiveListBox->usMaxArrayIndex ) + .5); INT16 sStartPosOfScrollArea = gpActiveListBox->usScrollPosY + gpActiveListBox->usScrollArrowHeight; sMouseXPos = gusMouseXPos; @@ -2332,7 +2371,7 @@ void CalcPositionOfNewScrollBoxLocation() //Calculate the number of items we have to move sHeight = sMouseYPos - sStartPosOfScrollArea; - + dValue = sHeight / (FLOAT)( gpActiveListBox->usScrollBarHeight ); sIncrementValue = (INT16)( ( dValue ) * ( gpActiveListBox->usMaxArrayIndex - gpActiveListBox->usStartIndex ) + .5 ) + gpActiveListBox->usStartIndex; // sIncrementValue = (INT16)( ( dValue ) * ( gpActiveListBox->usMaxArrayIndex - gpActiveListBox->usStartIndex ) + .5 ); @@ -2349,7 +2388,7 @@ void CalcPositionOfNewScrollBoxLocation() } // else the mouse was clicked below the scroll box - else + else { if( sIncrementValue >= ( gpActiveListBox->usMaxArrayIndex - gpActiveListBox->usMaxNumDisplayedItems ) ) gpActiveListBox->usItemDisplayedOnTopOfList = gpActiveListBox->usMaxArrayIndex - gpActiveListBox->usMaxNumDisplayedItems; @@ -2478,13 +2517,11 @@ void BtnQuestDebugGiveItemToNPCButtonCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { SOLDIERTYPE *pSoldier; - OBJECTTYPE Object; - - CreateItem( gItemListBox.sCurSelectedItem, 100, &Object ); + CreateItem( gItemListBox.sCurSelectedItem, 100, &gTempObject ); btn->uiFlags &= (~BUTTON_CLICKED_ON ); - //if the selected merc is created + //if the selected merc is created if( gfUseLocalNPCs ) pSoldier = FindSoldierByProfileID( gubCurrentNpcInSector[ gNpcListBox.sCurSelectedItem ], FALSE ); else @@ -2497,7 +2534,7 @@ void BtnQuestDebugGiveItemToNPCButtonCallback(GUI_BUTTON *btn,INT32 reason) } //Give the selected item to the selected merc - if( !AutoPlaceObject( pSoldier, &Object, TRUE ) ) + if( !AutoPlaceObject( pSoldier, &gTempObject, TRUE ) ) { //failed to add item, put error message to screen } @@ -2526,7 +2563,7 @@ void BtnQuestDebugChangeDayButtonCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); - swprintf( zTemp, L"%s Current Day is %d", QuestDebugText[ QUEST_DBS_PLEASE_ENTER_DAY ], GetWorldDay() ); + swprintf( zTemp, L"%s Current Day is %d", QuestDebugText[ QUEST_DBS_PLEASE_ENTER_DAY ], GetWorldDay() ); //get the day to change the game day to TextEntryBox( zTemp, ChangeDayNumber ); @@ -2596,7 +2633,7 @@ void BtnQuestDebugNPCLogButtonButtonCallback(GUI_BUTTON *btn,INT32 reason) if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { CHAR16 zName[ 128 ]; - + // btn->uiFlags &= (~BUTTON_CLICKED_ON ); if( gfNpcLogButton ) @@ -2691,7 +2728,7 @@ void BtnQuestDebugStartMercTalkingButtonButtonCallback(GUI_BUTTON *btn,INT32 rea // DoQDSMessageBox( MSG_BOX_BASIC_STYLE, zTemp, QUEST_DEBUG_SCREEN, MSG_BOX_FLAG_OK, NULL ); //set the initial value - gusQdsEnteringGridNo = 0; + gsQdsEnteringGridNo = 0; TextEntryBox( QuestDebugText[ QUEST_DBS_START_MERC_TALKING_FROM ], StartMercTalkingFromQuoteNum ); @@ -2731,13 +2768,13 @@ BOOLEAN CreateDestroyDisplayTextEntryBox( UINT8 ubAction, STR16 pString, TEXT_EN if( !gfBackgroundMaskEnabled ) { MSYS_DefineRegion( &gQuestTextEntryDebugDisableScreenRegion, 0, 0, 640, 480, MSYS_PRIORITY_HIGH+40, - CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, QuestDebugTextEntryDisableScreenRegionCallBack ); - MSYS_AddRegion(&gQuestTextEntryDebugDisableScreenRegion); + CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, QuestDebugTextEntryDisableScreenRegionCallBack ); + MSYS_AddRegion(&gQuestTextEntryDebugDisableScreenRegion); gfBackgroundMaskEnabled = TRUE; } //create the ok button - guiQuestDebugTextEntryOkBtn = + guiQuestDebugTextEntryOkBtn = CreateTextButton( L"OK", QUEST_DBS_FONT_STATIC_TEXT, QUEST_DBS_COLOR_STATIC_TEXT, FONT_BLACK, BUTTON_USE_DEFAULT, QUEST_DBS_TEB_X+QUEST_DBS_TEB_WIDTH/2-12, QUEST_DBS_TEB_Y+QUEST_DBS_TEB_HEIGHT-30, 30, 25, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+50, BUTTON_NO_CALLBACK, BtnQuestDebugTextEntryOkBtnButtonCallback ); @@ -2791,7 +2828,7 @@ BOOLEAN CreateDestroyDisplayTextEntryBox( UINT8 ubAction, STR16 pString, TEXT_EN else iTextEntryNumber = 0; - + // remove the text input field DestroyQuestDebugTextInputBoxes(); @@ -2805,7 +2842,7 @@ BOOLEAN CreateDestroyDisplayTextEntryBox( UINT8 ubAction, STR16 pString, TEXT_EN case QD_DROP_DOWN_DISPLAY: { //Display the text entry box frame - ColorFillVideoSurfaceArea( FRAME_BUFFER, QUEST_DBS_TEB_X, QUEST_DBS_TEB_Y, QUEST_DBS_TEB_X+QUEST_DBS_TEB_WIDTH, QUEST_DBS_TEB_Y+QUEST_DBS_TEB_HEIGHT, Get16BPPColor( FROMRGB( 45, 59, 74 ) ) ); + ColorFillVideoSurfaceArea( FRAME_BUFFER, QUEST_DBS_TEB_X, QUEST_DBS_TEB_Y, QUEST_DBS_TEB_X+QUEST_DBS_TEB_WIDTH, QUEST_DBS_TEB_Y+QUEST_DBS_TEB_HEIGHT, Get16BPPColor( FROMRGB( 45, 59, 74 ) ) ); //Display the text box caption DisplayWrappedString( QUEST_DBS_TEB_X+10, QUEST_DBS_TEB_Y+10, QUEST_DBS_TEB_WIDTH-20, 2, QUEST_DBS_FONT_TEXT_ENTRY, QUEST_DBS_COLOR_TEXT_ENTRY, zString, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); @@ -2821,7 +2858,7 @@ BOOLEAN CreateDestroyDisplayTextEntryBox( UINT8 ubAction, STR16 pString, TEXT_EN void QuestDebugTextEntryDisableScreenRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -2830,13 +2867,13 @@ void QuestDebugTextEntryDisableScreenRegionCallBack(MOUSE_REGION * pRegion, INT3 gpActiveListBox->ubCurScrollBoxAction = QD_DROP_DOWN_DESTROY; CreateDestroyDisplaySelectNpcDropDownBox(); gpActiveListBox->ubCurScrollBoxAction = QD_DROP_DOWN_NO_ACTION; - } + } else if(iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { gpActiveListBox->ubCurScrollBoxAction = QD_DROP_DOWN_DESTROY; CreateDestroyDisplaySelectNpcDropDownBox(); gpActiveListBox->ubCurScrollBoxAction = QD_DROP_DOWN_NO_ACTION; - } + } } @@ -2872,7 +2909,7 @@ void TextEntryBox( STR16 pString, TEXT_ENTRY_CALLBACK TextEntryCallBack ) void ScrollQuestListRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -2888,7 +2925,7 @@ void ScrollQuestListRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) TextEntryBox( String, ChangeQuestState ); - } + } else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT) { @@ -2896,7 +2933,7 @@ void ScrollQuestListRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } void ScrollFactListRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if (iReason & MSYS_CALLBACK_REASON_INIT) { } @@ -2913,7 +2950,7 @@ void ScrollFactListRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) TextEntryBox( String, ChangeFactState ); - } + } else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT) { @@ -2924,17 +2961,16 @@ void ScrollFactListRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) void InitQuestDebugTextInputBoxes() { - UINT32 uiStartLoc=0; CHAR16 sTemp[ 640 ]; // CHAR16 sText[ 640 ]; - + InitTextInputMode(); SetTextInputFont( (UINT16)FONT12ARIAL ); Set16BPPTextFieldColor( Get16BPPColor(FROMRGB( 255, 255, 255) ) ); SetBevelColors( Get16BPPColor(FROMRGB(136, 138, 135)), Get16BPPColor(FROMRGB(24, 61, 81)) ); - SetTextInputRegularColors( 2, FONT_WHITE ); - SetTextInputHilitedColors( FONT_WHITE, 2, 141 ); + SetTextInputRegularColors( 2, FONT_WHITE ); + SetTextInputHilitedColors( FONT_WHITE, 2, 141 ); SetCursorColor( Get16BPPColor(FROMRGB(0, 0, 0) ) ); // AddUserInputField( NULL ); @@ -2946,7 +2982,7 @@ void InitQuestDebugTextInputBoxes() } */ - swprintf( sTemp, L"%d", gusQdsEnteringGridNo ); + swprintf( sTemp, L"%d", gsQdsEnteringGridNo ); //Text entry field AddTextInputField( QUEST_DBS_TEB_X+QUEST_DBS_TEB_WIDTH/2-30, QUEST_DBS_TEB_Y+65, 60, 15, MSYS_PRIORITY_HIGH+60, sTemp, QUEST_DBS_TEXT_FIELD_WIDTH, INPUTTYPE_NUMERICSTRICT ); @@ -2967,14 +3003,12 @@ void AddNPCToGridNo( INT32 iGridNo ) UINT8 ubID; GetCurrentWorldSector( &sSectorX, &sSectorY ); - - memset( &MercCreateStruct, 0, sizeof( MercCreateStruct ) ); MercCreateStruct.bTeam = CIV_TEAM; MercCreateStruct.ubProfile = (UINT8)gpActiveListBox->sCurSelectedItem; MercCreateStruct.sSectorX = sSectorX; MercCreateStruct.sSectorY = sSectorY; MercCreateStruct.bSectorZ = gbWorldSectorZ; - MercCreateStruct.sInsertionGridNo = (UINT16) iGridNo; + MercCreateStruct.sInsertionGridNo = (INT16) iGridNo; // RandomizeNewSoldierStats( &MercCreateStruct ); @@ -2989,16 +3023,14 @@ void AddNPCToGridNo( INT32 iGridNo ) //Add all the npc in the current sectory the npc array AddNPCsInSectorToArray(); - gusQdsEnteringGridNo = (INT16)iGridNo; + gsQdsEnteringGridNo = (INT16)iGridNo; } void AddItemToGridNo( INT32 iGridNo ) { - OBJECTTYPE Object; - - gusQdsEnteringGridNo = (INT16)iGridNo; + gsQdsEnteringGridNo = (INT16)iGridNo; if( Item[ gItemListBox.sCurSelectedItem ].usItemClass == IC_KEY ) @@ -3009,24 +3041,22 @@ void AddItemToGridNo( INT32 iGridNo ) } else { - CreateItem( gItemListBox.sCurSelectedItem, (UINT8)( gfDropDamagedItems ? ( 20 + Random( 60 ) ) : 100 ), &Object ); + CreateItem( gItemListBox.sCurSelectedItem, (UINT8)( gfDropDamagedItems ? ( 20 + Random( 60 ) ) : 100 ), &gTempObject ); //add the item to the world - AddItemToPool( (UINT16) iGridNo, &Object, -1, 0, 0, 0 ); + AddItemToPool( iGridNo, &gTempObject, -1, 0, 0, 0 ); } } void AddKeyToGridNo( INT32 iKeyID ) { - OBJECTTYPE Object; - if( iKeyID < NUM_KEYS ) { - CreateKeyObject( &Object, 1, (UINT8)iKeyID ); + CreateKeyObject( &gTempObject, 1, (UINT8)iKeyID ); //add the item to the world - AddItemToPool( gusQdsEnteringGridNo, &Object, -1, 0, 0, 0 ); + AddItemToPool( gsQdsEnteringGridNo, &gTempObject, -1, 0, 0, 0 ); } else gfAddKeyNextPass = TRUE; @@ -3036,7 +3066,7 @@ void AddKeyToGridNo( INT32 iKeyID ) void ChangeDayNumber( INT32 iDayToChangeTo ) { - INT32 uiDiff; + INT32 uiDiff; UINT32 uiNewDayTimeInSec; if( iDayToChangeTo ) @@ -3094,23 +3124,23 @@ void CreateDestroyDisplayNPCInventoryPopup( UINT8 ubAction ) if( !gfBackgroundMaskEnabled ) { MSYS_DefineRegion( &gQuestTextEntryDebugDisableScreenRegion, 0, 0, 640, 480, MSYS_PRIORITY_HIGH+40, - CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, QuestDebugTextEntryDisableScreenRegionCallBack ); - MSYS_AddRegion(&gQuestTextEntryDebugDisableScreenRegion); + CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, QuestDebugTextEntryDisableScreenRegionCallBack ); + MSYS_AddRegion(&gQuestTextEntryDebugDisableScreenRegion); gfBackgroundMaskEnabled = TRUE; } //create the ok button - guiQuestDebugNPCInventOkBtn = + guiQuestDebugNPCInventOkBtn = CreateTextButton( L"OK", QUEST_DBS_FONT_STATIC_TEXT, QUEST_DBS_COLOR_STATIC_TEXT, FONT_BLACK, BUTTON_USE_DEFAULT, QUEST_DBS_NPC_INV_POPUP_X+QUEST_DBS_NPC_INV_POPUP_WIDTH/2-12, QUEST_DBS_NPC_INV_POPUP_Y+QUEST_DBS_NPC_INV_POPUP_HEIGHT-30, 30, 25, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+50, BUTTON_NO_CALLBACK, BtnQuestDebugNPCInventOkBtnButtonCallback ); SetButtonCursor( guiQuestDebugNPCInventOkBtn, CURSOR_WWW ); - + break; case QD_DROP_DOWN_DESTROY: RemoveButton( guiQuestDebugNPCInventOkBtn ); - + if( gfBackgroundMaskEnabled ) MSYS_RemoveRegion( &gQuestTextEntryDebugDisableScreenRegion ); gfBackgroundMaskEnabled = FALSE; @@ -3138,35 +3168,38 @@ void CreateDestroyDisplayNPCInventoryPopup( UINT8 ubAction ) if( pSoldier ) { //color the background of the popup - ColorFillVideoSurfaceArea( FRAME_BUFFER, QUEST_DBS_NPC_INV_POPUP_X, QUEST_DBS_NPC_INV_POPUP_Y, QUEST_DBS_NPC_INV_POPUP_X+QUEST_DBS_NPC_INV_POPUP_WIDTH, QUEST_DBS_NPC_INV_POPUP_Y+QUEST_DBS_NPC_INV_POPUP_HEIGHT, Get16BPPColor( FROMRGB( 45, 59, 74 ) ) ); + ColorFillVideoSurfaceArea( FRAME_BUFFER, QUEST_DBS_NPC_INV_POPUP_X, QUEST_DBS_NPC_INV_POPUP_Y, QUEST_DBS_NPC_INV_POPUP_X+QUEST_DBS_NPC_INV_POPUP_WIDTH, QUEST_DBS_NPC_INV_POPUP_Y+QUEST_DBS_NPC_INV_POPUP_HEIGHT, Get16BPPColor( FROMRGB( 45, 59, 74 ) ) ); //Dispaly the NPC inve title - DrawTextToScreen( QuestDebugText[ QUEST_DBS_NPC_INVENTORY ], QUEST_DBS_NPC_INV_POPUP_X, QUEST_DBS_NPC_INV_POPUP_Y+5, QUEST_DBS_NPC_INV_POPUP_WIDTH, QUEST_DBS_FONT_TITLE, QUEST_DBS_COLOR_TITLE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DrawTextToScreen( QuestDebugText[ QUEST_DBS_NPC_INVENTORY ], QUEST_DBS_NPC_INV_POPUP_X, QUEST_DBS_NPC_INV_POPUP_Y+5, QUEST_DBS_NPC_INV_POPUP_WIDTH, QUEST_DBS_FONT_TITLE, QUEST_DBS_COLOR_TITLE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); //Dispaly the current npc name if( gfUseLocalNPCs ) - DrawTextToScreen( gMercProfiles[ gubCurrentNpcInSector[ gNpcListBox.sCurSelectedItem ] ].zNickname, QUEST_DBS_NPC_INV_POPUP_X, QUEST_DBS_NPC_INV_POPUP_Y+20, QUEST_DBS_NPC_INV_POPUP_WIDTH, QUEST_DBS_FONT_TITLE, QUEST_DBS_COLOR_SUBTITLE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DrawTextToScreen( gMercProfiles[ gubCurrentNpcInSector[ gNpcListBox.sCurSelectedItem ] ].zNickname, QUEST_DBS_NPC_INV_POPUP_X, QUEST_DBS_NPC_INV_POPUP_Y+20, QUEST_DBS_NPC_INV_POPUP_WIDTH, QUEST_DBS_FONT_TITLE, QUEST_DBS_COLOR_SUBTITLE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); else - DrawTextToScreen( gMercProfiles[ gNpcListBox.sCurSelectedItem ].zNickname, QUEST_DBS_NPC_INV_POPUP_X, QUEST_DBS_NPC_INV_POPUP_Y+20, QUEST_DBS_NPC_INV_POPUP_WIDTH, QUEST_DBS_FONT_TITLE, QUEST_DBS_COLOR_SUBTITLE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DrawTextToScreen( gMercProfiles[ gNpcListBox.sCurSelectedItem ].zNickname, QUEST_DBS_NPC_INV_POPUP_X, QUEST_DBS_NPC_INV_POPUP_Y+20, QUEST_DBS_NPC_INV_POPUP_WIDTH, QUEST_DBS_FONT_TITLE, QUEST_DBS_COLOR_SUBTITLE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); usPosY = QUEST_DBS_NPC_INV_POPUP_Y + 40; - for( i=0; iinv.size(); i++) { + if (pSoldier->inv[i].exists() == false) { + continue; + } // if ( !LoadItemInfo( pSoldier->inv[ i ].usItem, zItemName, zItemDesc ) ) // Assert(0); wcscpy( zItemName, ShortItemNames[ pSoldier->inv[ i ].usItem ] ); //Display Name of the pocket - DrawTextToScreen( PocketText[ i ], QUEST_DBS_NPC_INV_POPUP_X+10, usPosY, 0, QUEST_DBS_FONT_DYNAMIC_TEXT, QUEST_DBS_COLOR_SUBTITLE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( PocketText[ i ], QUEST_DBS_NPC_INV_POPUP_X+10, usPosY, 0, QUEST_DBS_FONT_DYNAMIC_TEXT, QUEST_DBS_COLOR_SUBTITLE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); //Display the contents of the pocket - DrawTextToScreen( zItemName, QUEST_DBS_NPC_INV_POPUP_X+140, usPosY, 0, QUEST_DBS_FONT_DYNAMIC_TEXT, QUEST_DBS_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( zItemName, QUEST_DBS_NPC_INV_POPUP_X+140, usPosY, 0, QUEST_DBS_FONT_DYNAMIC_TEXT, QUEST_DBS_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); usPosY += usFontHeight; } } InvalidateRegion( 0, 0, 640, 480 ); - MarkButtonsDirty( ); + MarkButtonsDirty( ); } break; } @@ -3265,7 +3298,7 @@ void AddNPCsInSectorToArray() i=0; for ( pSoldier = Menptr, cnt = 0; cnt < TOTAL_SOLDIERS; pSoldier++, cnt++ ) { - if ( ( pSoldier != NULL ) && pSoldier -> bActive ) + if ( ( pSoldier != NULL ) && pSoldier->bActive ) { //if soldier is a NPC, add him to the local NPC array if( ( pSoldier->ubProfile >= FIRST_RPC ) && ( pSoldier->ubProfile < GASTON ) ) @@ -3365,7 +3398,7 @@ void NpcRecordLoggingInit( UINT8 ubNpcID, UINT8 ubMercID, UINT8 ubQuoteNum, UINT HWFILE hFile; UINT32 uiByteWritten; - char DestString[1024]; + char DestString[1024]; // char MercName[ NICKNAME_LENGTH ]; // char NpcName[ NICKNAME_LENGTH ]; @@ -3411,14 +3444,14 @@ void NpcRecordLoggingInit( UINT8 ubNpcID, UINT8 ubMercID, UINT8 ubQuoteNum, UINT if( FileSeek( hFile,0,FILE_SEEK_FROM_END ) == FALSE ) { // error - FileClose( hFile ); + FileClose( hFile ); return; } - + sprintf( DestString, "\n\n\nNew Approach for NPC ID: %d '%S' against Merc: %d '%S'", ubNpcID, gMercProfiles[ ubNpcID ].zNickname, ubMercID, gMercProfiles[ ubMercID ].zNickname ); -// sprintf( DestString, "\n\n\nNew Approach for NPC ID: %d against Merc: %d ", ubNpcID, ubMercID ); +// sprintf( DestString, "\n\n\nNew Approach for NPC ID: %d against Merc: %d ", ubNpcID, ubMercID ); if( !FileWrite( hFile, DestString, strlen(DestString), &uiByteWritten ) ) { @@ -3426,7 +3459,7 @@ void NpcRecordLoggingInit( UINT8 ubNpcID, UINT8 ubMercID, UINT8 ubQuoteNum, UINT DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("FAILED to write to %s", QUEST_DEBUG_FILE) ); return; } - + //Testing Record # sprintf( DestString, "\n\tTesting Record #: %d", ubQuoteNum ); @@ -3449,9 +3482,9 @@ void NpcRecordLogging( UINT8 ubApproach, STR pStringA, ...) // static UINT32 uiRecordNumber = 1; HWFILE hFile; UINT32 uiByteWritten; - va_list argptr; - char TempString[1024]; - char DestString[1024]; + va_list argptr; + char TempString[1024]; + char DestString[1024]; TempString[0] = '\0'; DestString[0] = '\0'; @@ -3465,7 +3498,7 @@ void NpcRecordLogging( UINT8 ubApproach, STR pStringA, ...) return; - va_start(argptr, pStringA); // Set up variable argument pointer + va_start(argptr, pStringA); // Set up variable argument pointer vsprintf(TempString, pStringA, argptr); // process gprintf string (get output str) va_end(argptr); @@ -3482,7 +3515,7 @@ void NpcRecordLogging( UINT8 ubApproach, STR pStringA, ...) if( FileSeek( hFile,0,FILE_SEEK_FROM_END ) == FALSE ) { // error - FileClose( hFile ); + FileClose( hFile ); return; } @@ -3570,14 +3603,14 @@ void EnableQDSButtons() BOOLEAN DoQDSMessageBox( UINT8 ubStyle, STR16 zString, UINT32 uiExitScreen, UINT8 ubFlags, MSGBOX_CALLBACK ReturnCallback ) { - SGPRect pCenteringRect= {0, 0, 639, 479 }; - + SGPRect pCenteringRect= {0, 0, 639, 479 }; + // reset exit mode gfExitQdsDueToMessageBox = TRUE; gfQuestDebugEntry = TRUE; // do message box and return - giQdsMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT8 ) ( ubFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, &pCenteringRect ); + giQdsMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT8 ) ( ubFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, &pCenteringRect ); // send back return state return( ( giQdsMessageBox != -1 ) ); @@ -3602,7 +3635,7 @@ void IncrementActiveDropDownBox( INT16 sIncrementValue ) } } // else the mouse was clicked below the scroll box - else + else { if( sIncrementValue >= ( gpActiveListBox->usMaxArrayIndex - gpActiveListBox->usMaxNumDisplayedItems ) ) { @@ -3616,7 +3649,7 @@ void IncrementActiveDropDownBox( INT16 sIncrementValue ) if( sIncrementValue >= gpActiveListBox->usMaxArrayIndex ) sIncrementValue = gpActiveListBox->usMaxArrayIndex - 1; } - else if( sIncrementValue >= gpActiveListBox->usMaxArrayIndex ) + else if( sIncrementValue >= gpActiveListBox->usMaxArrayIndex ) { sIncrementValue = gpActiveListBox->usMaxArrayIndex - 1; gpActiveListBox->usItemDisplayedOnTopOfList = gpActiveListBox->usMaxArrayIndex - gpActiveListBox->usMaxNumDisplayedItems; @@ -3635,18 +3668,16 @@ void IncrementActiveDropDownBox( INT16 sIncrementValue ) INT16 IsMercInTheSector( UINT16 usMercID ) { - UINT8 cnt; - UINT8 ubCount=0; - if( usMercID == -1 ) return( FALSE ); + UINT8 cnt; for ( cnt=0; cnt <= TOTAL_SOLDIERS; cnt++ ) - { + { //if the merc is active if( Menptr[ cnt ].ubProfile == usMercID ) { - if( Menptr[ cnt ].bActive ) + if( Menptr[ cnt ].bActive ) return( Menptr[ cnt ].ubID ); } } @@ -3659,36 +3690,32 @@ void RefreshAllNPCInventory() { UINT16 usCnt; UINT16 usItemCnt; - OBJECTTYPE TempObject; UINT16 usItem; - for ( usCnt=0; usCnt < TOTAL_SOLDIERS; usCnt++ ) - { + for ( usCnt=0; usCnt < TOTAL_SOLDIERS; usCnt++ ) + { //if the is active - if( Menptr[ usCnt ].bActive == 1 ) + if( Menptr[ usCnt ].bActive == 1 ) { //is the merc a rpc or npc if( Menptr[ usCnt ].ubProfile >= FIRST_RPC && Menptr[ usCnt ].ubProfile < GASTON ) { //refresh the mercs inventory - for ( usItemCnt = 0; usItemCnt< NUM_INV_SLOTS; usItemCnt++ ) + for ( usItemCnt = 0; usItemCnt< Menptr[ usCnt ].inv.size(); usItemCnt++ ) { - //null out the items in the npc inventory - memset( &Menptr[ usCnt ].inv[ usItemCnt ], 0, sizeof( OBJECTTYPE ) ); - if ( gMercProfiles[ Menptr[ usCnt ].ubProfile ].inv[ usItemCnt ] != NOTHING ) { //get the item usItem = gMercProfiles[ Menptr[ usCnt ].ubProfile ].inv[ usItemCnt ]; //Create the object - CreateItem( usItem, 100, &TempObject ); - - //copy the item into the soldiers inventory - memcpy( &Menptr[ usCnt ].inv[ usItemCnt ], &TempObject, sizeof( OBJECTTYPE ) ); + CreateItem( usItem, 100, &Menptr[ usCnt ].inv[ usItemCnt ] ); + } + else { + //null out the items in the npc inventory + DeleteObj(&Menptr[ usCnt ].inv[ usItemCnt ]); } } - } } } @@ -3721,8 +3748,8 @@ void StartMercTalkingFromQuoteNum( INT32 iQuoteToStartTalkingFrom ) if( !gfBackgroundMaskEnabled ) { MSYS_DefineRegion( &gQuestTextEntryDebugDisableScreenRegion, 0, 0, 640, 480, MSYS_PRIORITY_HIGH+3, - CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, QuestDebugTextEntryDisableScreenRegionCallBack ); - MSYS_AddRegion(&gQuestTextEntryDebugDisableScreenRegion); + CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, QuestDebugTextEntryDisableScreenRegionCallBack ); + MSYS_AddRegion(&gQuestTextEntryDebugDisableScreenRegion); gfBackgroundMaskEnabled = TRUE; } @@ -3891,7 +3918,7 @@ void DisplayQDSCurrentlyQuoteNum( ) UINT16 usFontHeight = GetFontHeight( QUEST_DBS_FONT_TEXT_ENTRY ) + 2; //Display the box frame - ColorFillVideoSurfaceArea( FRAME_BUFFER, QDS_CURRENT_QUOTE_NUM_BOX_X, QDS_CURRENT_QUOTE_NUM_BOX_Y, QDS_CURRENT_QUOTE_NUM_BOX_X+QDS_CURRENT_QUOTE_NUM_BOX_WIDTH, QDS_CURRENT_QUOTE_NUM_BOX_Y+QDS_CURRENT_QUOTE_NUM_BOX_HEIGHT, Get16BPPColor( FROMRGB( 32, 41, 53 ) ) ); + ColorFillVideoSurfaceArea( FRAME_BUFFER, QDS_CURRENT_QUOTE_NUM_BOX_X, QDS_CURRENT_QUOTE_NUM_BOX_Y, QDS_CURRENT_QUOTE_NUM_BOX_X+QDS_CURRENT_QUOTE_NUM_BOX_WIDTH, QDS_CURRENT_QUOTE_NUM_BOX_Y+QDS_CURRENT_QUOTE_NUM_BOX_HEIGHT, Get16BPPColor( FROMRGB( 32, 41, 53 ) ) ); swprintf( zTemp, L"'%s' is currently saying quote #%d", gMercProfiles[ gTalkingMercSoldier->ubProfile ].zNickname, giSelectedMercCurrentQuote-1 ); @@ -4000,8 +4027,8 @@ INT32 GetMaxNumberOfQuotesToPlay( ) } // else if it is a RPC who is on our team - else if( gMercProfiles[ gNpcListBox.sCurSelectedItem ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED && - ubProfileID >=57 && + else if( gMercProfiles[ gNpcListBox.sCurSelectedItem ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED && + ubProfileID >=57 && ubProfileID <= 72 ) { iNumberOfQuotes = 119; @@ -4016,10 +4043,10 @@ INT32 GetMaxNumberOfQuotesToPlay( ) //else if it is speck else if( ubProfileID == 159 ) { - iNumberOfQuotes = 72; + iNumberOfQuotes = 72; } else - iNumberOfQuotes = 138; + iNumberOfQuotes = 138; return( iNumberOfQuotes + 1 ); @@ -4034,7 +4061,7 @@ void GetDebugLocationString( UINT16 usProfileID, STR16 pzText ) pSoldier = FindSoldierByProfileID( (UINT8)usProfileID, FALSE ); //if their is a soldier, the soldier is alive and the soldier is off the map - if( pSoldier != NULL && pSoldier->bActive && pSoldier->uiStatusFlags & SOLDIER_OFF_MAP ) + if( pSoldier != NULL && pSoldier->bActive && pSoldier->flags.uiStatusFlags & SOLDIER_OFF_MAP ) { //the soldier is on schedule swprintf( pzText, L"On Schdl."); diff --git a/Strategic/Quest Debug System.h b/Strategic/Quest Debug System.h index 9f2b5389..99f782c1 100644 --- a/Strategic/Quest Debug System.h +++ b/Strategic/Quest Debug System.h @@ -6,7 +6,7 @@ extern BOOLEAN gfNpcLogButton; -extern UINT16 gusQdsEnteringGridNo; +extern INT16 gsQdsEnteringGridNo; void NpcRecordLoggingInit( UINT8 ubNpcID, UINT8 ubMercID, UINT8 ubQuoteNum, UINT8 ubApproach ); diff --git a/Strategic/QuestText.cpp b/Strategic/QuestText.cpp index 2255f166..39654633 100644 --- a/Strategic/QuestText.cpp +++ b/Strategic/QuestText.cpp @@ -353,7 +353,7 @@ STR16 FactDescText[] = L"Fact keith out of business", // 274 L"Fact mike available to army",// 275 L"Fact kingpin can send assassins",// 276 - L"Fact estoni refuelling possible",// 277 + L"Fact estoni refuelling possible",// 277 L"Fact museum alarm went off",// 278 L"", diff --git a/Strategic/Quests.cpp b/Strategic/Quests.cpp index 100167c0..62e75831 100644 --- a/Strategic/Quests.cpp +++ b/Strategic/Quests.cpp @@ -76,9 +76,9 @@ BOOLEAN CheckForNewShipment( void ) { ITEM_POOL * pItemPool; - if ( ( gWorldSectorX == BOBBYR_SHIPPING_DEST_SECTOR_X ) && ( gWorldSectorY == BOBBYR_SHIPPING_DEST_SECTOR_Y ) && ( gbWorldSectorZ == BOBBYR_SHIPPING_DEST_SECTOR_Z ) ) + if ( ( gWorldSectorX == BOBBYR_SHIPPING_DEST_SECTOR_X ) && ( gWorldSectorY == BOBBYR_SHIPPING_DEST_SECTOR_Y ) && ( gbWorldSectorZ == BOBBYR_SHIPPING_DEST_SECTOR_Z ) ) { - if ( GetItemPool( BOBBYR_SHIPPING_DEST_GRIDNO, &pItemPool, 0 ) ) + if ( GetItemPoolFromGround( BOBBYR_SHIPPING_DEST_GRIDNO, &pItemPool ) ) { return( !( ITEMPOOL_VISIBLE( pItemPool ) ) ); } @@ -92,7 +92,7 @@ BOOLEAN CheckNPCWounded( UINT8 ubProfileID, BOOLEAN fByPlayerOnly ) // is the NPC is wounded at all? pSoldier = FindSoldierByProfileID( ubProfileID, FALSE ); - if (pSoldier && pSoldier->bLife < pSoldier->bLifeMax) + if (pSoldier && pSoldier->stats.bLife < pSoldier->stats.bLifeMax) { if (fByPlayerOnly) { @@ -104,7 +104,7 @@ BOOLEAN CheckNPCWounded( UINT8 ubProfileID, BOOLEAN fByPlayerOnly ) { return( FALSE ); } - } + } else { return( TRUE ); @@ -113,7 +113,7 @@ BOOLEAN CheckNPCWounded( UINT8 ubProfileID, BOOLEAN fByPlayerOnly ) else { return( FALSE ); - + } } @@ -123,7 +123,7 @@ BOOLEAN CheckNPCInOkayHealth( UINT8 ubProfileID ) // is the NPC at better than half health? pSoldier = FindSoldierByProfileID( ubProfileID, FALSE ); - if (pSoldier && pSoldier->bLife > (pSoldier->bLifeMax / 2) && pSoldier->bLife > 30) + if (pSoldier && pSoldier->stats.bLife > (pSoldier->stats.bLifeMax / 2) && pSoldier->stats.bLife > 30) { return( TRUE ); } @@ -139,7 +139,7 @@ BOOLEAN CheckNPCBleeding( UINT8 ubProfileID ) // the NPC is wounded... pSoldier = FindSoldierByProfileID( ubProfileID, FALSE ); - if (pSoldier && pSoldier->bLife > 0 && pSoldier->bBleeding > 0) + if (pSoldier && pSoldier->stats.bLife > 0 && pSoldier->bBleeding > 0) { return( TRUE ); } @@ -174,7 +174,7 @@ BOOLEAN CheckGuyVisible( UINT8 ubNPC, UINT8 ubGuy ) { return( FALSE ); } - if (pNPC->bOppList[ pGuy->ubID ] == SEEN_CURRENTLY ) + if (pNPC->aiData.bOppList[ pGuy->ubID ] == SEEN_CURRENTLY ) { return( TRUE ); } @@ -205,7 +205,7 @@ BOOLEAN CheckNPCIsEnemy( UINT8 ubProfileID ) { return( FALSE ); } - if (pNPC->bSide == gbPlayerNum || pNPC->bNeutral) + if (pNPC->bSide == gbPlayerNum || pNPC->aiData.bNeutral) { if (pNPC->ubCivilianGroup != NON_CIV_GROUP) { @@ -270,7 +270,7 @@ INT8 NumWoundedMercsNearby( UINT8 ubProfileID ) { pSoldier = MercSlots[ uiLoop ]; - if ( pSoldier && pSoldier->bTeam == gbPlayerNum && pSoldier->bLife > 0 && pSoldier->bLife < pSoldier->bLifeMax && pSoldier->bAssignment != ASSIGNMENT_HOSPITAL ) + if ( pSoldier && pSoldier->bTeam == gbPlayerNum && pSoldier->stats.bLife > 0 && pSoldier->stats.bLife < pSoldier->stats.bLifeMax && pSoldier->bAssignment != ASSIGNMENT_HOSPITAL ) { if (PythSpacesAway( sGridNo, pSoldier->sGridNo ) <= HOSPITAL_PATIENT_DISTANCE) { @@ -301,7 +301,7 @@ INT8 NumMercsNear( UINT8 ubProfileID, UINT8 ubMaxDist ) { pSoldier = MercSlots[ uiLoop ]; - if ( pSoldier && pSoldier->bTeam == gbPlayerNum && pSoldier->bLife >= OKLIFE ) + if ( pSoldier && pSoldier->bTeam == gbPlayerNum && pSoldier->stats.bLife >= OKLIFE ) { if (PythSpacesAway( sGridNo, pSoldier->sGridNo ) <= ubMaxDist) { @@ -379,7 +379,7 @@ BOOLEAN PCInSameRoom( UINT8 ubProfileID ) } } } - + return( FALSE ); } @@ -388,11 +388,11 @@ BOOLEAN CheckTalkerStrong( void ) { if (gpSrcSoldier && gpSrcSoldier->bTeam == gbPlayerNum) { - return( gpSrcSoldier->bStrength >= 84 ); + return( gpSrcSoldier->stats.bStrength >= 84 ); } else if (gpDestSoldier && gpDestSoldier->bTeam == gbPlayerNum) { - return( gpDestSoldier->bStrength >= 84 ); + return( gpDestSoldier->stats.bStrength >= 84 ); } return( FALSE ); } @@ -448,7 +448,7 @@ INT8 NumMalesPresent( UINT8 ubProfileID ) { pSoldier = MercSlots[ uiLoop ]; - if ( pSoldier && pSoldier->bTeam == gbPlayerNum && pSoldier->bLife >= OKLIFE) + if ( pSoldier && pSoldier->bTeam == gbPlayerNum && pSoldier->stats.bLife >= OKLIFE) { if ( pSoldier->ubProfile != NO_PROFILE && gMercProfiles[ pSoldier->ubProfile].bSex == MALE ) { @@ -482,7 +482,7 @@ BOOLEAN FemalePresent( UINT8 ubProfileID ) { pSoldier = MercSlots[ uiLoop ]; - if ( pSoldier && pSoldier->bTeam == gbPlayerNum && pSoldier->bLife >= OKLIFE) + if ( pSoldier && pSoldier->bTeam == gbPlayerNum && pSoldier->stats.bLife >= OKLIFE) { if ( pSoldier->ubProfile != NO_PROFILE && gMercProfiles[ pSoldier->ubProfile].bSex == FEMALE ) { @@ -507,17 +507,17 @@ BOOLEAN CheckPlayerHasHead( void ) { pSoldier = MercPtrs[ bLoop ]; - if ( pSoldier->bActive && pSoldier->bLife > 0 ) + if ( pSoldier->bActive && pSoldier->stats.bLife > 0 ) { if ( FindObjInObjRange( pSoldier, HEAD_2, HEAD_7 ) != NO_SLOT ) - { + { return( TRUE ); } } } return( FALSE ); - + } BOOLEAN CheckNPCSector( UINT8 ubProfileID, INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) @@ -555,7 +555,7 @@ BOOLEAN AIMMercWithin( INT16 sGridNo, INT16 sDistance ) { pSoldier = MercSlots[ uiLoop ]; - if ( pSoldier && (pSoldier->bTeam == gbPlayerNum) && (pSoldier->bLife >= OKLIFE) && ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) ) + if ( pSoldier && (pSoldier->bTeam == gbPlayerNum) && (pSoldier->stats.bLife >= OKLIFE) && ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) ) { if (PythSpacesAway( sGridNo, pSoldier->sGridNo ) <= sDistance) { @@ -576,7 +576,7 @@ BOOLEAN CheckNPCCowering( UINT8 ubProfileID ) { return( FALSE ); } - return( ( (pNPC->uiStatusFlags & SOLDIER_COWERING) != 0) ); + return( ( (pNPC->flags.uiStatusFlags & SOLDIER_COWERING) != 0) ); } UINT8 CountBartenders( void ) @@ -603,7 +603,7 @@ BOOLEAN CheckNPCIsUnderFire( UINT8 ubProfileID ) { return( FALSE ); } - return( pNPC->bUnderFire != 0 ); + return( pNPC->aiData.bUnderFire != 0 ); } BOOLEAN NPCHeardShot( UINT8 ubProfileID ) @@ -645,7 +645,7 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID ) case FACT_DIMITRI_DEAD: gubFact[ usFact ] = (gMercProfiles[ DIMITRI ].bMercStatus == MERC_IS_DEAD ); break; - case FACT_CURRENT_SECTOR_IS_SAFE: + case FACT_CURRENT_SECTOR_IS_SAFE: gubFact[FACT_CURRENT_SECTOR_IS_SAFE] = !( ( (gTacticalStatus.fEnemyInSector && NPCHeardShot( ubProfileID ) ) || gTacticalStatus.uiFlags & INCOMBAT ) ); break; case FACT_BOBBYRAY_SHIPMENT_IN_TRANSIT: @@ -716,7 +716,7 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID ) gubFact[FACT_NPC_BLEEDING_BUT_OKAY] = FALSE; } break; - + case FACT_PLAYER_HAS_HEAD_AND_CARMEN_IN_SAN_MONA: gubFact[usFact] = (CheckNPCSector( CARMEN, 5, MAP_ROW_C, 0 ) && CheckPlayerHasHead() ); break; @@ -746,7 +746,7 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID ) if ( gMercProfiles[ 85 ].bMercStatus == MERC_IS_DEAD) { gubFact[FACT_BRENDA_IN_STORE_AND_ALIVE] = FALSE; - } + } // ensure in a building and nearby else if ( !(NPCInRoom( 85, 47 ) ) ) { @@ -875,12 +875,12 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID ) break; case FACT_DYNAMO_IN_J9: gubFact[usFact] = CheckNPCSector( DYNAMO, 9, MAP_ROW_J, 0 ) && NumEnemiesInAnySector( 9, 10, 0 ); - break; + break; case FACT_DYNAMO_ALIVE: gubFact[usFact] = ( gMercProfiles[ DYNAMO ].bMercStatus != MERC_IS_DEAD ); break; case FACT_DYNAMO_SPEAKING_OR_NEARBY: - gubFact[usFact] = ( gpSrcSoldier != NULL && (gpSrcSoldier->ubProfile == DYNAMO || ( CheckNPCWithin( gpSrcSoldier->ubProfile, DYNAMO, 10 ) && CheckGuyVisible( gpSrcSoldier->ubProfile, DYNAMO ) ) ) ); + gubFact[usFact] = ( gpSrcSoldier != NULL && (gpSrcSoldier->ubProfile == DYNAMO || ( CheckNPCWithin( gpSrcSoldier->ubProfile, DYNAMO, 10 ) && CheckGuyVisible( gpSrcSoldier->ubProfile, DYNAMO ) ) ) ); break; case FACT_JOHN_EPC: gubFact[usFact] = CheckNPCIsEPC( JOHN ); @@ -909,10 +909,10 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID ) case FACT_ANOTHER_FIGHT_POSSIBLE: gubFact[usFact] = AnotherFightPossible(); - break; + break; case FACT_RECEIVING_INCOME_FROM_DCAC: - gubFact[usFact] = ( + gubFact[usFact] = ( ( PredictDailyIncomeFromAMine( MINE_DRASSEN ) > 0 ) && ( PredictDailyIncomeFromAMine( MINE_ALMA ) > 0 ) && ( PredictDailyIncomeFromAMine( MINE_CAMBRIA ) > 0 ) && @@ -939,7 +939,7 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID ) bTown = gMercProfiles[ ubProfileID ].bTown; if( ( bTown != BLANK_SECTOR ) && gTownLoyalty[ bTown ].fStarted && gfTownUsesLoyalty[ bTown ]) { - gubFact[usFact] = ( (gTownLoyalty[ bTown ].ubRating >= LOYALTY_LOW_THRESHOLD ) && (gTownLoyalty[ bTown ].ubRating < LOYALTY_OK_THRESHOLD ) ); + gubFact[usFact] = ( (gTownLoyalty[ bTown ].ubRating >= LOYALTY_LOW_THRESHOLD ) && (gTownLoyalty[ bTown ].ubRating < LOYALTY_OK_THRESHOLD ) ); } else { @@ -953,7 +953,7 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID ) { // if Skyrider, ignore low loyalty until he has monologues, and wait at least a day since the latest monologue to avoid a hot/cold attitude if ( ( ubProfileID == SKYRIDER ) && - ( ( guiHelicopterSkyriderTalkState == 0 ) || ( ( GetWorldTotalMin() - guiTimeOfLastSkyriderMonologue ) < ( 24 * 60 ) ) ) ) + ( ( guiHelicopterSkyriderTalkState == 0 ) || ( ( GetWorldTotalMin() - guiTimeOfLastSkyriderMonologue ) < ( 24 * 60 ) ) ) ) { gubFact[usFact] = FALSE; } @@ -1087,7 +1087,7 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID ) case FACT_TONY_IN_BUILDING: gubFact[usFact] = CheckNPCSector( TONY, 5, MAP_ROW_C, 0 ) && NPCInRoom( TONY, 50 ); - break; + break; case FACT_SHANK_SPEAKING: gubFact[usFact] = ( gpSrcSoldier && gpSrcSoldier->ubProfile == SHANK ); @@ -1120,7 +1120,7 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID ) case FACT_JENNY_ALIVE: gubFact[usFact] = gMercProfiles[ JENNY ].bMercStatus != MERC_IS_DEAD; break; - + case FACT_ARNOLD_ALIVE: gubFact[usFact] = gMercProfiles[ ARNIE ].bMercStatus != MERC_IS_DEAD; break; @@ -1193,7 +1193,7 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID ) break; case FACT_SKYRIDER_IN_C16: - gubFact[ usFact ] = CheckNPCSector( SKYRIDER, 16, MAP_ROW_C, 0 ); + gubFact[ usFact ] = CheckNPCSector( SKYRIDER, 16, MAP_ROW_C, 0 ); break; case FACT_SKYRIDER_IN_E14: gubFact[ usFact ] = CheckNPCSector( SKYRIDER, 14, MAP_ROW_E, 0 ); @@ -1206,8 +1206,8 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID ) gubFact[usFact] = (gTacticalStatus.fCivGroupHostile[ KINGPIN_CIV_GROUP ] >= CIV_GROUP_WILL_BECOME_HOSTILE); break; - case FACT_DYNAMO_NOT_SPEAKER: - gubFact[usFact] = !( gpSrcSoldier != NULL && (gpSrcSoldier->ubProfile == DYNAMO ) ); + case FACT_DYNAMO_NOT_SPEAKER: + gubFact[usFact] = !( gpSrcSoldier != NULL && (gpSrcSoldier->ubProfile == DYNAMO ) ); break; case FACT_PABLO_BRIBED: @@ -1238,7 +1238,7 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID ) void StartQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY ) { - InternalStartQuest( ubQuest, sSectorX, sSectorY, TRUE ); + InternalStartQuest( ubQuest, sSectorX, sSectorY, TRUE ); } @@ -1248,10 +1248,10 @@ void InternalStartQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY, BOOLEAN { gubQuest[ubQuest] = QUESTINPROGRESS; - if ( fUpdateHistory ) - { - SetHistoryFact( HISTORY_QUEST_STARTED, ubQuest, GetWorldTotalMin(), sSectorX, sSectorY ); - } + if ( fUpdateHistory ) + { + SetHistoryFact( HISTORY_QUEST_STARTED, ubQuest, GetWorldTotalMin(), sSectorX, sSectorY ); + } } else { @@ -1261,7 +1261,7 @@ void InternalStartQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY, BOOLEAN void EndQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY ) { - InternalEndQuest( ubQuest, sSectorX, sSectorY, TRUE ); + InternalEndQuest( ubQuest, sSectorX, sSectorY, TRUE ); } void InternalEndQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY, BOOLEAN fUpdateHistory ) @@ -1270,10 +1270,10 @@ void InternalEndQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY, BOOLEAN fU { gubQuest[ubQuest] = QUESTDONE; - if ( fUpdateHistory ) - { - ResetHistoryFact( ubQuest, sSectorX, sSectorY ); - } + if ( fUpdateHistory ) + { + ResetHistoryFact( ubQuest, sSectorX, sSectorY ); + } } else { @@ -1287,13 +1287,13 @@ void InternalEndQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY, BOOLEAN fU gMercProfiles[ MADAME ].bNPCData = 0; gMercProfiles[ MADAME ].bNPCData2 = 0; } - + }; void InitQuestEngine() { memset(gubQuest, 0, sizeof(gubQuest)); - memset(gubFact, 0, sizeof(gubFact)); + memset(gubFact, 0, sizeof(gubFact)); // semi-hack to make the letter quest start right away CheckForQuests( 1 ); @@ -1323,7 +1323,7 @@ void CheckForQuests( UINT32 uiDay ) ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Checking For Quests, Day %d", uiDay ); #endif - // ------------------------------------------------------------------------------- + // ------------------------------------------------------------------------------- // QUEST 0 : DELIVER LETTER // ------------------------------------------------------------------------------- // The game always starts with DELIVER LETTER quest, so turn it on if it hasn't @@ -1335,7 +1335,7 @@ void CheckForQuests( UINT32 uiDay ) ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Started DELIVER LETTER quest"); #endif } - + // This quest gets turned OFF through conversation with Miguel - when user hands // Miguel the letter } @@ -1389,6 +1389,7 @@ BOOLEAN LoadQuestInfoFromSavedGameFile( HWFILE hFile ) - + + diff --git a/Strategic/Quests.h b/Strategic/Quests.h index a4f777a7..75b47324 100644 --- a/Strategic/Quests.h +++ b/Strategic/Quests.h @@ -4,7 +4,7 @@ #include "FileMan.h" #include "strategicmap.h" -// Quest.ubStatus values +// Quest.ubStatus values #define QUESTNOTSTARTED 0 #define QUESTINPROGRESS 1 #define QUESTDONE 2 @@ -37,7 +37,7 @@ // -------------------------------------------------------------------------------------- -// Q U E S T D E F I N E S +// Q U E S T D E F I N E S // -------------------------------------------------------------------------------------- enum Quests @@ -216,7 +216,7 @@ enum Facts FACT_MIGUEL_FOUND, // 12 FACT_LETTER_DELIVERED, // 13 FACT_FOOD_ROUTE_EXISTS, // 14 - FACT_DIMITRI_DEAD, // 15 + FACT_DIMITRI_DEAD, // 15 FACT_MIGUEL_READ_LETTER = 23, @@ -447,7 +447,7 @@ enum Facts FACT_KEITH_OUT_OF_BUSINESS, // 274 FACT_MIKE_AVAILABLE_TO_ARMY,// 275 FACT_KINGPIN_CAN_SEND_ASSASSINS,// 276 - FACT_ESTONI_REFUELLING_POSSIBLE,// 277 + FACT_ESTONI_REFUELLING_POSSIBLE,// 277 FACT_MUSEUM_ALARM_WENT_OFF,// 278 FACT_MADDOG_IS_SPEAKER = 280, @@ -516,7 +516,7 @@ enum Facts FACT_CONRAD_SHOULD_GO = 367, FACT_PLAYER_KILLED_BOXERS = 368, } ; -//** END FACTS ************************* +//** END FACTS ************************* #define BOBBYR_SHIPPING_DEST_SECTOR_X 13 #define BOBBYR_SHIPPING_DEST_SECTOR_Y 2 diff --git a/Strategic/Reinforcement.cpp b/Strategic/Reinforcement.cpp index ff0821af..3a629e2f 100644 --- a/Strategic/Reinforcement.cpp +++ b/Strategic/Reinforcement.cpp @@ -1,29 +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 "Inventory Choosing.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" @@ -36,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 ); @@ -75,7 +75,6 @@ void GetNumberOfEnemiesInFiveSectors( INT16 sSectorX, INT16 sSectorY, UINT8 *pub } } - GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ), &ubNumAdmins, &ubNumTroops, &ubNumElites ); *pubNumAdmins += ubNumAdmins; @@ -89,7 +88,7 @@ UINT8 NumEnemiesInFiveSectors( INT16 sMapX, INT16 sMapY ) UINT8 ubNumAdmins, ubNumTroops, ubNumElites; GetNumberOfEnemiesInFiveSectors( sMapX, sMapY, &ubNumAdmins, &ubNumTroops, &ubNumElites ); - + return ubNumAdmins + ubNumTroops + ubNumElites; } @@ -134,7 +133,7 @@ UINT8 CountAllMilitiaInFiveSectors(INT16 sMapX, INT16 sMapY) UINT8 ubResult = 0; UINT16 pusMoveDir[4][3]; UINT8 ubDirNumber, ubIndex; - + ubResult = CountAllMilitiaInSector( sMapX, sMapY ); if( !gGameExternalOptions.gfAllowReinforcements ) @@ -155,7 +154,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 ) @@ -167,13 +166,11 @@ 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; } BOOLEAN ARMoveBestMilitiaManFromAdjacentSector(INT16 sMapX, INT16 sMapY) { - UINT8 ubResult = 0; UINT16 pusMoveDir[4][3]; UINT8 ubDirNumber; UINT8 ubRandom; @@ -383,7 +380,6 @@ UINT8 DoReinforcementAsPendingMilitia( INT16 sMapX, INT16 sMapY, UINT8 *pubRank return (UINT8)pusMoveDir[ ubIndex ][ 2 ]; } } - } @@ -392,7 +388,6 @@ void AddPossiblePendingMilitiaToBattle() UINT8 ubSlots; UINT8 ubNumElites, ubNumRegulars, ubNumGreens; - SECTORINFO *pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ]; static UINT8 ubPredefinedInsertionCode = 255; static UINT8 ubPredefinedRank = 255; @@ -452,5 +447,4 @@ void AddPossiblePendingMilitiaToBattle() gfStrategicMilitiaChangesMade = FALSE; // Handled them here } } - -} \ No newline at end of file +} diff --git a/Strategic/Scheduling.cpp b/Strategic/Scheduling.cpp index 5520bebb..a87dc92f 100644 --- a/Strategic/Scheduling.cpp +++ b/Strategic/Scheduling.cpp @@ -5,7 +5,7 @@ #include "Fileman.h" #include "types.h" #include "Scheduling.h" - #include "Soldier Control.h" + #include "message.h" #include "overhead.h" #include "Game Clock.h" @@ -30,6 +30,11 @@ #include "Quests.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + #ifdef JA2EDITOR extern CHAR16 gszScheduleActions[ NUM_SCHEDULE_ACTIONS ][20]; #endif @@ -52,8 +57,8 @@ void ReverseSchedules(); void PrepareScheduleForAutoProcessing( SCHEDULENODE *pSchedule, UINT32 uiStartTime, UINT32 uiEndTime ); //IMPORTANT: -//This function adds a NEWLY allocated schedule to the list. The pointer passed is totally -//separate. So make sure that you delete the pointer if you don't need it anymore. The editor +//This function adds a NEWLY allocated schedule to the list. The pointer passed is totally +//separate. So make sure that you delete the pointer if you don't need it anymore. The editor //uses a single static node to copy data from, hence this method. void CopyScheduleToList( SCHEDULENODE *pSchedule, SOLDIERINITNODE *pNode ) { @@ -170,7 +175,7 @@ void ProcessTacticalSchedule( UINT8 ubScheduleID ) if( !pSchedule ) { #ifdef JA2BETAVERSION - ScreenMsg( FONT_RED, MSG_BETAVERSION, L"Schedule callback: Schedule ID of %d not found.", ubScheduleID ); + ScreenMsg( FONT_RED, MSG_BETAVERSION, L"Schedule callback: Schedule ID of %d not found.", ubScheduleID ); #endif return; } @@ -178,7 +183,7 @@ void ProcessTacticalSchedule( UINT8 ubScheduleID ) if( pSchedule->ubSoldierID >= TOTAL_SOLDIERS ) { #ifdef JA2BETAVERSION - ScreenMsg( FONT_RED, MSG_BETAVERSION, L"Schedule callback: Illegal soldier ID of %d.", pSchedule->ubSoldierID ); + ScreenMsg( FONT_RED, MSG_BETAVERSION, L"Schedule callback: Illegal soldier ID of %d.", pSchedule->ubSoldierID ); #endif return; } @@ -190,7 +195,7 @@ void ProcessTacticalSchedule( UINT8 ubScheduleID ) //Validate the existance of the soldier. pSoldier = MercPtrs[ pSchedule->ubSoldierID ]; - if ( pSoldier->bLife < OKLIFE ) + if ( pSoldier->stats.bLife < OKLIFE ) { // dead or dying! return; @@ -199,7 +204,7 @@ void ProcessTacticalSchedule( UINT8 ubScheduleID ) if ( !pSoldier->bActive ) { #ifdef JA2BETAVERSION - ScreenMsg( FONT_RED, MSG_BETAVERSION, L"Schedule callback: Soldier isn't active. Name is %s.", pSoldier->name ); + ScreenMsg( FONT_RED, MSG_BETAVERSION, L"Schedule callback: Soldier isn't active. Name is %s.", pSoldier->name ); #endif } @@ -236,7 +241,7 @@ void ProcessTacticalSchedule( UINT8 ubScheduleID ) if ( fAutoProcess ) { UINT32 uiStartTime, uiEndTime; - //Grab the last time the eventlist was queued. This will tell us how much time has passed since that moment, + //Grab the last time the eventlist was queued. This will tell us how much time has passed since that moment, //and how long we need to auto process this schedule. uiStartTime = (guiTimeOfLastEventQuery / 60) % NUM_MIN_IN_DAY; uiEndTime = GetWorldMinutesInDay(); @@ -247,7 +252,7 @@ void ProcessTacticalSchedule( UINT8 ubScheduleID ) } else { - // turn off all active-schedule flags before setting + // turn off all active-schedule flags before setting // the one that should be active! pSchedule->usFlags &= ~SCHEDULE_FLAGS_ACTIVE_ALL; @@ -258,13 +263,13 @@ void ProcessTacticalSchedule( UINT8 ubScheduleID ) case 2: pSchedule->usFlags |= SCHEDULE_FLAGS_ACTIVE3; break; case 3: pSchedule->usFlags |= SCHEDULE_FLAGS_ACTIVE4; break; } - pSoldier->fAIFlags |= AI_CHECK_SCHEDULE; + pSoldier->aiData.fAIFlags |= AI_CHECK_SCHEDULE; pSoldier->bAIScheduleProgress = 0; } } -//Called before leaving the editor, or saving the map. This recalculates +//Called before leaving the editor, or saving the map. This recalculates //all of the schedule IDs from scratch and adjusts the effected structures accordingly. void OptimizeSchedules() { @@ -311,12 +316,12 @@ void OptimizeSchedules() } } -//Called when transferring from the game to the editor. +//Called when transferring from the game to the editor. void PrepareSchedulesForEditorEntry() { SCHEDULENODE *curr, *prev, *temp; - - //Delete all schedule events. The editor will automatically warp all civilians to their starting locations. + + //Delete all schedule events. The editor will automatically warp all civilians to their starting locations. DeleteAllStrategicEventsOfType( EVENT_PROCESS_TACTICAL_SCHEDULE ); //Now, delete all of the temporary schedules. @@ -336,14 +341,14 @@ void PrepareSchedulesForEditorEntry() MemFree( temp ); gubScheduleID--; } - else + else { if( curr->usFlags & SCHEDULE_FLAGS_SLEEP_CONVERTED ) { //uncovert it! INT32 i; for( i = 0 ; i < MAX_SCHEDULE_ACTIONS; i++ ) { - //if( i + //if( i } } prev = curr; @@ -352,7 +357,7 @@ void PrepareSchedulesForEditorEntry() } } -//Called when leaving the editor to enter the game. This posts all of the events that apply. +//Called when leaving the editor to enter the game. This posts all of the events that apply. void PrepareSchedulesForEditorExit() { PostSchedules(); @@ -463,7 +468,7 @@ BOOLEAN LoadSchedulesFromSave( HWFILE hFile ) } -//used to fix a bug in the editor where the schedules were reversed. Because only +//used to fix a bug in the editor where the schedules were reversed. Because only //some maps were effected, this feature was required. void ReverseSchedules() { @@ -566,7 +571,7 @@ BOOLEAN SaveSchedules( HWFILE hFile ) //Each schedule has upto four parts to it, so sort them chronologically. //Happily, the fields with no times actually are the highest. BOOLEAN SortSchedule( SCHEDULENODE *pSchedule ) -{ +{ INT32 index, i, iBestIndex; UINT16 usTime; UINT16 usData1; @@ -574,7 +579,7 @@ BOOLEAN SortSchedule( SCHEDULENODE *pSchedule ) UINT8 ubAction; BOOLEAN fSorted = FALSE; - //Use a bubblesort method (max: 3 switches). + //Use a bubblesort method (max: 3 switches). index = 0; while( index < 3 ) { @@ -609,7 +614,7 @@ BOOLEAN SortSchedule( SCHEDULENODE *pSchedule ) return fSorted; } -BOOLEAN BumpAnyExistingMerc( INT16 sGridNo ) +BOOLEAN BumpAnyExistingMerc( INT16 sGridNo ) { UINT8 ubID; SOLDIERTYPE * pSoldier; // NB this is the person already in the location, @@ -645,7 +650,7 @@ BOOLEAN BumpAnyExistingMerc( INT16 sGridNo ) } ConvertGridNoToCellXY( sNewGridNo, &sCellX, &sCellY ); - EVENT_SetSoldierPositionForceDelete( pSoldier, (FLOAT)sCellX, (FLOAT)sCellY ); + pSoldier->EVENT_SetSoldierPositionForceDelete( (FLOAT)sCellX, (FLOAT)sCellY ); return( TRUE ); } @@ -658,12 +663,12 @@ void AutoProcessSchedule( SCHEDULENODE *pSchedule, INT32 index ) if ( gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) { - // CJC, November 28th: when reloading a saved game we want events posted but no events autoprocessed since - // that could change civilian positions. So rather than doing a bunch of checks outside of this function, + // CJC, November 28th: when reloading a saved game we want events posted but no events autoprocessed since + // that could change civilian positions. So rather than doing a bunch of checks outside of this function, // I thought it easier to screen them out here. return; } - + pSoldier = MercPtrs[ pSchedule->ubSoldierID ]; if (pSoldier->ubID == 0) @@ -674,7 +679,7 @@ void AutoProcessSchedule( SCHEDULENODE *pSchedule, INT32 index ) #ifdef JA2EDITOR if ( pSoldier->ubProfile != NO_PROFILE ) { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Autoprocessing schedule action %S for %S (%d) at time %02ld:%02ld (set for %02d:%02d), data1 = %d", + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Autoprocessing schedule action %S for %S (%d) at time %02ld:%02ld (set for %02d:%02d), data1 = %d", gszScheduleActions[ pSchedule->ubAction[ index ] ], pSoldier->name, pSoldier->ubID, @@ -686,8 +691,8 @@ void AutoProcessSchedule( SCHEDULENODE *pSchedule, INT32 index ) } else { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Autoprocessing schedule action %S for civ (%d) at time %02ld:%02ld (set for %02d:%02d), data1 = %d", - gszScheduleActions[ pSchedule->ubAction[ index ] ], + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Autoprocessing schedule action %S for civ (%d) at time %02ld:%02ld (set for %02d:%02d), data1 = %d", + gszScheduleActions[ pSchedule->ubAction[ index ] ], pSoldier->ubID, GetWorldHour(), guiMin, @@ -698,7 +703,7 @@ void AutoProcessSchedule( SCHEDULENODE *pSchedule, INT32 index ) #endif // always assume the merc is going to wake, unless the event is a sleep - pSoldier->fAIFlags &= ~(AI_ASLEEP); + pSoldier->aiData.fAIFlags &= ~(AI_ASLEEP); switch( pSchedule->ubAction[ index ] ) { @@ -706,11 +711,11 @@ void AutoProcessSchedule( SCHEDULENODE *pSchedule, INT32 index ) case SCHEDULE_ACTION_UNLOCKDOOR: case SCHEDULE_ACTION_OPENDOOR: case SCHEDULE_ACTION_CLOSEDOOR: - PerformActionOnDoorAdjacentToGridNo( pSchedule->ubAction[ index ], pSchedule->usData1[ index ] ); + PerformActionOnDoorAdjacentToGridNo( pSchedule->ubAction[ index ], (INT16)pSchedule->usData1[ index ] ); BumpAnyExistingMerc( pSchedule->usData2[ index ] ); ConvertGridNoToCellXY( pSchedule->usData2[ index ], &sCellX, &sCellY ); - EVENT_SetSoldierPositionForceDelete( pSoldier, (FLOAT)sCellX, (FLOAT)sCellY ); + pSoldier->EVENT_SetSoldierPositionForceDelete( (FLOAT)sCellX, (FLOAT)sCellY ); if ( GridNoOnEdgeOfMap( pSchedule->usData2[ index ], &bDirection ) ) { // civ should go off map; this tells us where the civ will return @@ -721,15 +726,15 @@ void AutoProcessSchedule( SCHEDULENODE *pSchedule, INT32 index ) else { // let this person patrol from here from now on - pSoldier->usPatrolGrid[0] = pSchedule->usData2[ index ]; + pSoldier->aiData.sPatrolGrid[0] = pSchedule->usData2[ index ]; } break; case SCHEDULE_ACTION_GRIDNO: BumpAnyExistingMerc( pSchedule->usData1[ index ] ); ConvertGridNoToCellXY( pSchedule->usData1[ index ], &sCellX, &sCellY ); - EVENT_SetSoldierPositionForceDelete( pSoldier, (FLOAT)sCellX, (FLOAT)sCellY ); + pSoldier->EVENT_SetSoldierPositionForceDelete( (FLOAT)sCellX, (FLOAT)sCellY ); // let this person patrol from here from now on - pSoldier->usPatrolGrid[0] = pSchedule->usData1[ index ]; + pSoldier->aiData.sPatrolGrid[0] = pSchedule->usData1[ index ]; break; case SCHEDULE_ACTION_ENTERSECTOR: if ( pSoldier->ubProfile != NO_PROFILE && gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags2 & PROFILE_MISC_FLAG2_DONT_ADD_TO_SECTOR ) @@ -739,37 +744,37 @@ void AutoProcessSchedule( SCHEDULENODE *pSchedule, INT32 index ) } BumpAnyExistingMerc( pSchedule->usData1[ index ] ); ConvertGridNoToCellXY( pSchedule->usData1[ index ], &sCellX, &sCellY ); - EVENT_SetSoldierPositionForceDelete( pSoldier, (FLOAT)sCellX, (FLOAT)sCellY ); + pSoldier->EVENT_SetSoldierPositionForceDelete( (FLOAT)sCellX, (FLOAT)sCellY ); MoveSoldierFromAwayToMercSlot( pSoldier ); pSoldier->bInSector = TRUE; // let this person patrol from here from now on - pSoldier->usPatrolGrid[0] = pSchedule->usData1[ index ]; + pSoldier->aiData.sPatrolGrid[0] = pSchedule->usData1[ index ]; break; case SCHEDULE_ACTION_WAKE: BumpAnyExistingMerc( pSoldier->sInitialGridNo ); ConvertGridNoToCellXY( pSoldier->sInitialGridNo, &sCellX, &sCellY ); - EVENT_SetSoldierPositionForceDelete( pSoldier, (FLOAT)sCellX, (FLOAT)sCellY ); + pSoldier->EVENT_SetSoldierPositionForceDelete( (FLOAT)sCellX, (FLOAT)sCellY ); // let this person patrol from here from now on - pSoldier->usPatrolGrid[0] = pSoldier->sInitialGridNo; + pSoldier->aiData.sPatrolGrid[0] = pSoldier->sInitialGridNo; break; case SCHEDULE_ACTION_SLEEP: - pSoldier->fAIFlags |= AI_ASLEEP; + pSoldier->aiData.fAIFlags |= AI_ASLEEP; // check for someone else in the location BumpAnyExistingMerc( pSchedule->usData1[ index ] ); ConvertGridNoToCellXY( pSchedule->usData1[ index ], &sCellX, &sCellY ); - EVENT_SetSoldierPositionForceDelete( pSoldier, (FLOAT)sCellX, (FLOAT)sCellY ); - pSoldier->usPatrolGrid[0] = pSchedule->usData1[ index ]; + pSoldier->EVENT_SetSoldierPositionForceDelete( (FLOAT)sCellX, (FLOAT)sCellY ); + pSoldier->aiData.sPatrolGrid[0] = pSchedule->usData1[ index ]; break; case SCHEDULE_ACTION_LEAVESECTOR: sGridNo = FindNearestEdgePoint( pSoldier->sGridNo ); BumpAnyExistingMerc( sGridNo ); ConvertGridNoToCellXY( sGridNo, &sCellX, &sCellY ); - EVENT_SetSoldierPositionForceDelete( pSoldier, (FLOAT)sCellX, (FLOAT)sCellY ); + pSoldier->EVENT_SetSoldierPositionForceDelete( (FLOAT)sCellX, (FLOAT)sCellY ); sGridNo = FindNearbyPointOnEdgeOfMap( pSoldier, &bDirection ); BumpAnyExistingMerc( sGridNo ); ConvertGridNoToCellXY( sGridNo, &sCellX, &sCellY ); - EVENT_SetSoldierPositionForceDelete( pSoldier, (FLOAT)sCellX, (FLOAT)sCellY ); + pSoldier->EVENT_SetSoldierPositionForceDelete( (FLOAT)sCellX, (FLOAT)sCellY ); // ok, that tells us where the civ will return pSoldier->sOffWorldGridNo = sGridNo; @@ -787,13 +792,13 @@ void PostSchedule( SOLDIERTYPE *pSoldier ) SCHEDULENODE *pSchedule; UINT8 ubTempAction; UINT16 usTemp; - + if ( (pSoldier->ubCivilianGroup == KINGPIN_CIV_GROUP) && ( gTacticalStatus.fCivGroupHostile[ KINGPIN_CIV_GROUP ] || ( (gubQuest[ QUEST_KINGPIN_MONEY ] == QUESTINPROGRESS) && (CheckFact( FACT_KINGPIN_CAN_SEND_ASSASSINS, KINGPIN )) ) ) && (gWorldSectorX == 5 && gWorldSectorY == MAP_ROW_C) && (pSoldier->ubProfile == NO_PROFILE) ) { // no schedules for people guarding Tony's! return; } - + pSchedule = GetSchedule( pSoldier->ubScheduleID ); if( !pSchedule ) return; @@ -840,7 +845,7 @@ void PostSchedule( SOLDIERTYPE *pSoldier ) usTemp = pSchedule->usTime[ bEmpty ]; pSchedule->usTime[ bEmpty ] = pSchedule->usTime[ i ]; pSchedule->usTime[ i ] = usTemp; - + usTemp = pSchedule->usData1[ bEmpty ]; pSchedule->usData1[ bEmpty ] = pSchedule->usData1[ i ]; pSchedule->usData1[ i ] = usTemp; @@ -854,10 +859,10 @@ void PostSchedule( SOLDIERTYPE *pSoldier ) // no morning entries but no space for a wakeup either, will sleep till // next non-sleep event } - + } break; //The break is here because nobody should have more than one sleep schedule with no time specified. - } + } } } @@ -866,10 +871,10 @@ void PostSchedule( SOLDIERTYPE *pSoldier ) // always process previous 24 hours uiEndTime = GetWorldTotalMin(); uiStartTime = uiEndTime - (NUM_MIN_IN_DAY - 1); - + /* - //First thing we need is to get the time that the map was last loaded. If more than 24 hours, - //then process only 24 hours. If less, then process all the schedules that would have happened within + //First thing we need is to get the time that the map was last loaded. If more than 24 hours, + //then process only 24 hours. If less, then process all the schedules that would have happened within //that period of time. uiEndTime = GetWorldTotalMin(); if( GetWorldTotalMin() - guiTimeCurrentSectorWasLastLoaded > NUM_MIN_IN_DAY ) @@ -881,7 +886,7 @@ void PostSchedule( SOLDIERTYPE *pSoldier ) uiStartTime = guiTimeCurrentSectorWasLastLoaded; } */ - + //Need a way to determine if the player has actually modified doors since this civilian was last loaded uiEndTime %= NUM_MIN_IN_DAY; uiStartTime %= NUM_MIN_IN_DAY; @@ -894,7 +899,7 @@ void PrepareScheduleForAutoProcessing( SCHEDULENODE *pSchedule, UINT32 uiStartTi BOOLEAN fPostedNextEvent = FALSE; if ( uiStartTime > uiEndTime ) - { //The start time is later in the day than the end time, which means we'll be wrapping + { //The start time is later in the day than the end time, which means we'll be wrapping //through midnight and continuing to the end time. for( i = 0; i < MAX_SCHEDULE_ACTIONS; i++ ) { @@ -923,7 +928,7 @@ void PrepareScheduleForAutoProcessing( SCHEDULENODE *pSchedule, UINT32 uiStartTi } } else - { //Much simpler: start at the start and continue to the end. + { //Much simpler: start at the start and continue to the end. for( i = 0; i < MAX_SCHEDULE_ACTIONS; i++ ) { if( pSchedule->usTime[i] == 0xffff ) @@ -947,7 +952,7 @@ void PrepareScheduleForAutoProcessing( SCHEDULENODE *pSchedule, UINT32 uiStartTi { // reached end of schedule, post first event for soldier in the next day // 0th event will be first. - // Feb 1: ONLY IF THERE IS A VALID EVENT TO POST WITH A VALID TIME! + // Feb 1: ONLY IF THERE IS A VALID EVENT TO POST WITH A VALID TIME! if ( pSchedule->usTime[0] != 0xffff ) { AddStrategicEvent( EVENT_PROCESS_TACTICAL_SCHEDULE, GetWorldDayInMinutes() + NUM_MIN_IN_DAY + pSchedule->usTime[0], pSchedule->ubScheduleID ); @@ -955,7 +960,7 @@ void PrepareScheduleForAutoProcessing( SCHEDULENODE *pSchedule, UINT32 uiStartTi } } -//Leave at night, come back in the morning. The time variances are a couple hours, so +//Leave at night, come back in the morning. The time variances are a couple hours, so //the town doesn't turn into a ghost town in 5 minutes. void PostDefaultSchedule( SOLDIERTYPE *pSoldier ) { @@ -966,7 +971,7 @@ void PostDefaultSchedule( SOLDIERTYPE *pSoldier ) { //People in underground sectors don't get schedules. return; } - //Create a new node at the head of the list. The head will become the new schedule + //Create a new node at the head of the list. The head will become the new schedule //we are about to add. curr = gpScheduleList; gpScheduleList = (SCHEDULENODE*)MemAlloc( sizeof( SCHEDULENODE ) ); @@ -993,7 +998,7 @@ void PostDefaultSchedule( SOLDIERTYPE *pSoldier ) gpScheduleList->ubAction[1] = SCHEDULE_ACTION_LEAVESECTOR; gpScheduleList->usTime[1] = (UINT16)(1080 + Random( 121 )); gpScheduleList->usFlags |= SCHEDULE_FLAGS_TEMPORARY; - + if( gubScheduleID == 255 ) { //Too much fragmentation, clean it up... OptimizeSchedules(); @@ -1019,7 +1024,7 @@ void PostSchedules() #endif //If no way to leave the map, then don't post default schedules. if( gMapInformation.sNorthGridNo != -1 || gMapInformation.sEastGridNo != -1 || - gMapInformation.sSouthGridNo != -1 || gMapInformation.sWestGridNo != -1 ) + gMapInformation.sSouthGridNo != -1 || gMapInformation.sWestGridNo != -1 ) { fDefaultSchedulesPossible = TRUE; } @@ -1035,12 +1040,12 @@ void PostSchedules() else if( fDefaultSchedulesPossible ) { // ATE: There should be a better way here... - if( curr->pSoldier->ubBodyType != COW && - curr->pSoldier->ubBodyType != BLOODCAT && + if( curr->pSoldier->ubBodyType != COW && + curr->pSoldier->ubBodyType != BLOODCAT && curr->pSoldier->ubBodyType != HUMVEE && - curr->pSoldier->ubBodyType != ELDORADO && - curr->pSoldier->ubBodyType != ICECREAMTRUCK && - curr->pSoldier->ubBodyType != JEEP ) + curr->pSoldier->ubBodyType != ELDORADO && + curr->pSoldier->ubBodyType != ICECREAMTRUCK && + curr->pSoldier->ubBodyType != JEEP ) { PostDefaultSchedule( curr->pSoldier ); } @@ -1050,12 +1055,12 @@ void PostSchedules() } } -void PerformActionOnDoorAdjacentToGridNo( UINT8 ubScheduleAction, UINT16 usGridNo ) +void PerformActionOnDoorAdjacentToGridNo( UINT8 ubScheduleAction, INT16 sGridNo ) { INT16 sDoorGridNo; DOOR * pDoor; - sDoorGridNo = FindDoorAtGridNoOrAdjacent( (INT16) usGridNo ); + sDoorGridNo = FindDoorAtGridNoOrAdjacent( (INT16) sGridNo ); if (sDoorGridNo != NOWHERE) { switch( ubScheduleAction ) @@ -1086,7 +1091,7 @@ void PerformActionOnDoorAdjacentToGridNo( UINT8 ubScheduleAction, UINT16 usGridN } } -//Assumes that a schedule has just been processed. This takes the current time, and compares it to the +//Assumes that a schedule has just been processed. This takes the current time, and compares it to the //schedule, and looks for the next schedule action that would get processed and posts it. void PostNextSchedule( SOLDIERTYPE *pSoldier ) { @@ -1140,7 +1145,7 @@ BOOLEAN ExtractScheduleEntryAndExitInfo( SOLDIERTYPE * pSoldier, UINT32 * puiEnt pSchedule = GetSchedule( pSoldier->ubScheduleID ); if ( !pSchedule ) { - // If person had default schedule then would have been assigned and this would + // If person had default schedule then would have been assigned and this would // have succeeded. // Hence this is an error. return( FALSE ); @@ -1153,7 +1158,7 @@ BOOLEAN ExtractScheduleEntryAndExitInfo( SOLDIERTYPE * pSoldier, UINT32 * puiEnt fFoundEntryTime = TRUE; *puiEntryTime = pSchedule->usTime[ iLoop ]; } - else if ( pSchedule->ubAction[ iLoop ] == SCHEDULE_ACTION_LEAVESECTOR ) + else if ( pSchedule->ubAction[ iLoop ] == SCHEDULE_ACTION_LEAVESECTOR ) { fFoundExitTime = TRUE; *puiExitTime = pSchedule->usTime[ iLoop ]; @@ -1185,7 +1190,7 @@ BOOLEAN ExtractScheduleDoorLockAndUnlockInfo( SOLDIERTYPE * pSoldier, UINT32 * p pSchedule = GetSchedule( pSoldier->ubScheduleID ); if ( !pSchedule ) { - // If person had default schedule then would have been assigned and this would + // If person had default schedule then would have been assigned and this would // have succeeded. // Hence this is an error. return( FALSE ); @@ -1220,8 +1225,6 @@ BOOLEAN ExtractScheduleDoorLockAndUnlockInfo( SOLDIERTYPE * pSoldier, UINT32 * p BOOLEAN GetEarliestMorningScheduleEvent( SCHEDULENODE *pSchedule, UINT32 * puiTime ) { INT32 iLoop; - BOOLEAN fFoundTime = FALSE; - *puiTime = 100000; for ( iLoop = 0; iLoop < MAX_SCHEDULE_ACTIONS; iLoop++ ) @@ -1296,7 +1299,7 @@ void ReconnectSchedules( void ) else { // need default schedule! - //PostDefaultSchedule( pSoldier ); + //PostDefaultSchedule( pSoldier ); } } } @@ -1400,6 +1403,7 @@ void SecureSleepSpots( void ) - + + diff --git a/Strategic/Scheduling.h b/Strategic/Scheduling.h index 8d0ef1f2..b23b281c 100644 --- a/Strategic/Scheduling.h +++ b/Strategic/Scheduling.h @@ -5,8 +5,8 @@ #include "Soldier Init List.h" //Merc scheduling actions -//NOTE: Any modifications to this enumeration also require updating the text in EditorMercs.c used -// in the editor for merc schedule purposes. +//NOTE: Any modifications to this enumeration also require updating the text in EditorMercs.c used +// in the editor for merc schedule purposes. enum { SCHEDULE_ACTION_NONE, @@ -79,19 +79,19 @@ void PostNextSchedule( SOLDIERTYPE *pSoldier ); //we then need to post the events and process schedules for the time that we have been gone. void PostSchedules(); -//Sorts the schedule in chronological order. Returns TRUE if any sorting took place. +//Sorts the schedule in chronological order. Returns TRUE if any sorting took place. BOOLEAN SortSchedule( SCHEDULENODE *pSchedule ); -//Adds a schedule to the list. COPIES THE DATA OVER (ALLOCATES NEW NODE!) +//Adds a schedule to the list. COPIES THE DATA OVER (ALLOCATES NEW NODE!) void CopyScheduleToList( SCHEDULENODE *pSchedule, SOLDIERINITNODE *pNode ); //Entering the editor automatically removes all events posted. void PrepareSchedulesForEditorEntry(); //Leaving the editor and entering the game posts the events. void PrepareSchedulesForEditorExit(); -//Packs all of the scheduleIDs, and updates the links. This is done whenever necessary and +//Packs all of the scheduleIDs, and updates the links. This is done whenever necessary and //before saving the map, as this forces the IDs to align with the SOLDIERINITNODE->ubScheduleID's. void OptimizeSchedules(); -void PerformActionOnDoorAdjacentToGridNo( UINT8 ubScheduleAction, UINT16 usMapIndex ); +void PerformActionOnDoorAdjacentToGridNo( UINT8 ubScheduleAction, INT16 sMapIndex ); BOOLEAN ExtractScheduleEntryAndExitInfo( SOLDIERTYPE * pSoldier, UINT32 * puiEntryTime, UINT32 * puiExitTime ); BOOLEAN ExtractScheduleDoorLockAndUnlockInfo( SOLDIERTYPE * pSoldier, UINT32 * puiOpeningTime, UINT32 * puiClosingTime ); diff --git a/Strategic/Strategic AI.cpp b/Strategic/Strategic AI.cpp index adf71e3a..ce1dac3c 100644 --- a/Strategic/Strategic AI.cpp +++ b/Strategic/Strategic AI.cpp @@ -14,7 +14,7 @@ #include "Random.h" #include "Strategic Pathing.h" #include "message.h" - #include "Sound Control.h" +// #include "Sound Control.h" #include "strategicmap.h" #include "Game Clock.h" #include "strategic.h" @@ -43,51 +43,51 @@ /* STRATEGIC AI -- UNDERLYING PHILOSOPHY The most fundamental part of the strategic AI which takes from reality and gives to gameplay is the manner -the queen attempts to take her towns back. Finances and owning mines are the most important way -to win the game. As the player takes more mines over, the queen will focus more on quality and defense. In -the beginning of the game, she will focus more on offense than mid-game or end-game. +the queen attempts to take her towns back. Finances and owning mines are the most important way +to win the game. As the player takes more mines over, the queen will focus more on quality and defense. In +the beginning of the game, she will focus more on offense than mid-game or end-game. REALITY The queen owns the entire country, and the player starts the game with a small lump of cash, enough to hire -some mercenaries for about a week. In that week, the queen may not notice what is going on, and the player -would believably take over one of the towns before she could feasibly react. As soon as her military was -aware of the situation, she would likely proceed to send 300-400 troops to annihilate the opposition, and the -game would be over relatively quickly. If the player was a prodigy, and managed to hold the town against such -a major assault, he would probably lose in the long run being forced into a defensive position and running out -of money quickly while the queen could continue to pump out the troops. On the other hand, if the player -somehow managed to take over most of the mines, he would be able to casually walk over the queen eventually -just from the sheer income allowing him to purchase several of the best mercs. That would have the effect of +some mercenaries for about a week. In that week, the queen may not notice what is going on, and the player +would believably take over one of the towns before she could feasibly react. As soon as her military was +aware of the situation, she would likely proceed to send 300-400 troops to annihilate the opposition, and the +game would be over relatively quickly. If the player was a prodigy, and managed to hold the town against such +a major assault, he would probably lose in the long run being forced into a defensive position and running out +of money quickly while the queen could continue to pump out the troops. On the other hand, if the player +somehow managed to take over most of the mines, he would be able to casually walk over the queen eventually +just from the sheer income allowing him to purchase several of the best mercs. That would have the effect of making the game impossibly difficult in the beginning of the game, and a joke at the end (this is very much like Master Of Orion II on the more difficult settings ) GAMEPLAY -Because we want the game to be like a normal game and make it fun, we need to make the game easy in the -beginning and harder at the end. In order to accomplish this, I feel that pure income shouldn't be the factor -for the queen, because she would likely crucify a would-be leader in his early days. So, in the beginning of -the game, the forces would already be situated with the majority of forces being the administrators in the towns, -and army troops and elites in the more important sectors. Restricting the queen's offensive +Because we want the game to be like a normal game and make it fun, we need to make the game easy in the +beginning and harder at the end. In order to accomplish this, I feel that pure income shouldn't be the factor +for the queen, because she would likely crucify a would-be leader in his early days. So, in the beginning of +the game, the forces would already be situated with the majority of forces being the administrators in the towns, +and army troops and elites in the more important sectors. Restricting the queen's offensive abilities using a distance penalty would mean that the furthest sectors from the queen's palace would be -much easier to defend because she would only be allowed to send x number of troops. As you get closer to the -queen, she would be allowed to send larger forces to attack those towns in question. Also, to further +much easier to defend because she would only be allowed to send x number of troops. As you get closer to the +queen, she would be allowed to send larger forces to attack those towns in question. Also, to further increase the games difficulty as the campaign progresses in the player's favor, we could also increase the -quality of the queen's troops based purely on the peek progress percentage. This is calculated using a formula -that determines how well the player is doing by combining loyalty of towns owned, income generated, etc. So, -in the beginning of the game, the quality is at the worst, but once you capture your first mines/towns, it -permanently increase the queen's quality rating, effectively bumping up the stakes. By the time you capture -four or five mines, the queen is going to focus more (but not completely) on quality defense as she prepares -for your final onslaught. This quality rating will augment the experience level, equipment rating, and/or -attribute ratings of the queen's troops. I would maintain a table of these enhancements based on the current +quality of the queen's troops based purely on the peek progress percentage. This is calculated using a formula +that determines how well the player is doing by combining loyalty of towns owned, income generated, etc. So, +in the beginning of the game, the quality is at the worst, but once you capture your first mines/towns, it +permanently increase the queen's quality rating, effectively bumping up the stakes. By the time you capture +four or five mines, the queen is going to focus more (but not completely) on quality defense as she prepares +for your final onslaught. This quality rating will augment the experience level, equipment rating, and/or +attribute ratings of the queen's troops. I would maintain a table of these enhancements based on the current quality rating hooking into the difficulty all along. //EXPLANATION OF THE WEIGHT SYSTEM: -The strategic AI has two types of groups: garrisons and patrol groups. Each of these groups contain -information of it's needs, mainly desired population. If the current population is greater than the +The strategic AI has two types of groups: garrisons and patrol groups. Each of these groups contain +information of it's needs, mainly desired population. If the current population is greater than the desired population, and the group will get a negative weight assigned to it, which means that it is willing -to give up troops to areas that need them more. On the other hand, if a group has less than the desired population, +to give up troops to areas that need them more. On the other hand, if a group has less than the desired population, then the weight will be positive, meaning they are requesting reinforcements. -The weight generated will range between -100 and +100. The calculated weight is modified by the priority -of the group. If the priority of the group is high, they +The weight generated will range between -100 and +100. The calculated weight is modified by the priority +of the group. If the priority of the group is high, they */ @@ -98,10 +98,10 @@ of the group. If the priority of the group is high, they //#define BASIC_POOL_INCREMENT gGameExternalOptions.guiBaseQueenPoolIncrement //Modifies the number of troops the queen has at the beginning of the game on top -//of all of the garrison and patrol groups. Additionally, there are a total of -//16 sectors that are LEVEL 1, 2, or 3 garrison groups. The lower the level, the more +//of all of the garrison and patrol groups. Additionally, there are a total of +//16 sectors that are LEVEL 1, 2, or 3 garrison groups. The lower the level, the more //troops stay in that sector, and the rest will also be used as a secondary pool when -//the primary pool runs dry. So basically, this number is only part of the equation. +//the primary pool runs dry. So basically, this number is only part of the equation. //#define EASY_QUEENS_POOL_OF_TROOPS 150 //#define NORMAL_QUEENS_POOL_OF_TROOPS 200 //#define HARD_QUEENS_POOL_OF_TROOPS 400 @@ -122,23 +122,23 @@ of the group. If the priority of the group is high, they //#define HARD_MIN_ENEMY_GROUP_SIZE 6 //#define INSANE_MIN_ENEMY_GROUP_SIZE 8 -//Sets the starting alert chances. Everytime an enemy arrives in a new sector, or the player, -//this is the chance the enemy will detect the player in adjacent sectors. This chance is associated -//with each side checked. Stationary groups do this check periodically. +//Sets the starting alert chances. Everytime an enemy arrives in a new sector, or the player, +//this is the chance the enemy will detect the player in adjacent sectors. This chance is associated +//with each side checked. Stationary groups do this check periodically. //#define EASY_ENEMY_STARTING_ALERT_LEVEL 20 //#define NORMAL_ENEMY_STARTING_ALERT_LEVEL 50 //#define HARD_ENEMY_STARTING_ALERT_LEVEL 70 //#define INSANE_ENEMY_STARTING_ALERT_LEVEL 90 -//When an enemy spots and chases a player group, the alertness value decrements by this value. The -//higher the value, the less of a chance the enemy will spot and attack subsequent groups. This -//minimizes the aggressiveness of the enemy. Ranges from 1-100 (but recommend 20-60). +//When an enemy spots and chases a player group, the alertness value decrements by this value. The +//higher the value, the less of a chance the enemy will spot and attack subsequent groups. This +//minimizes the aggressiveness of the enemy. Ranges from 1-100 (but recommend 20-60). //#define EASY_ENEMY_STARTING_ALERT_DECAY 75 //#define NORMAL_ENEMY_STARTING_ALERT_DECAY 50 //#define HARD_ENEMY_STARTING_ALERT_DECAY 25 //#define INSANE_ENEMY_STARTING_ALERT_DECAY 10 -//The base time that the queen can think about reinforcements for refilling lost patrol groups, +//The base time that the queen can think about reinforcements for refilling lost patrol groups, //town garrisons, etc. She only is allowed one action per 'turn'. //#define EASY_TIME_EVALUATE_IN_MINUTES 480 //#define NORMAL_TIME_EVALUATE_IN_MINUTES 360 @@ -151,8 +151,8 @@ of the group. If the priority of the group is high, they //#define HARD_TIME_EVALUATE_VARIANCE 120 //#define INSANE_TIME_EVALUATE_VARIANCE 60 -//When a player takes control of a sector, don't allow any enemy reinforcements to enter the sector for a -//limited amount of time. This essentially dumbs down the AI, making it less aggressive. +//When a player takes control of a sector, don't allow any enemy reinforcements to enter the sector for a +//limited amount of time. This essentially dumbs down the AI, making it less aggressive. //#define EASY_GRACE_PERIOD_IN_HOURS 144 // 6 days //#define NORMAL_GRACE_PERIOD_IN_HOURS 96 // 4 days //#define HARD_GRACE_PERIOD_IN_HOURS 48 // 2 days @@ -164,8 +164,8 @@ of the group. If the priority of the group is high, they //#define HARD_PATROL_GRACE_PERIOD_IN_DAYS 8 //#define INSANE_PATROL_GRACE_PERIOD_IN_DAYS 2 -//Certain conditions can cause the queen to go into a "full alert" mode. This means that temporarily, the queen's -//forces will automatically succeed adjacent checks until x number of enemy initiated battles occur. The same variable +//Certain conditions can cause the queen to go into a "full alert" mode. This means that temporarily, the queen's +//forces will automatically succeed adjacent checks until x number of enemy initiated battles occur. The same variable //is what is used to determine the free checks. //#define EASY_NUM_AWARE_BATTLES 1 //#define NORMAL_NUM_AWARE_BATTLES 2 @@ -185,26 +185,26 @@ INT32 giGarrisonArraySize = 0; INT32 giPatrolArraySize = 0; INT32 giForcePercentage = 0; //Modifies the starting group sizes relative by percentage INT32 giArmyAlertness = 0; //The chance the group will spot an adjacent player/militia -INT32 giArmyAlertnessDecay = 0; //How much the spotting chance decreases when spot check succeeds -UINT8 gubNumAwareBattles = 0; //When non-zero, this means the queen is very aware and searching for players. Every time - //there is an enemy initiated battle, this counter decrements until zero. Until that point, +INT32 giArmyAlertnessDecay = 0; //How much the spotting chance decreases when spot check succeeds +UINT8 gubNumAwareBattles = 0; //When non-zero, this means the queen is very aware and searching for players. Every time + //there is an enemy initiated battle, this counter decrements until zero. Until that point, //all adjacent sector checks automatically succeed. -BOOLEAN gfQueenAIAwake = FALSE; //This flag turns on/off the strategic decisions. If it's off, no reinforcements - //or assaults will happen. - //@@@Alex, this flag is ONLY set by the first meanwhile scene which calls an action. If this - //action isn't called, the AI will never turn on. It is completely dependant on this action. It can +BOOLEAN gfQueenAIAwake = FALSE; //This flag turns on/off the strategic decisions. If it's off, no reinforcements + //or assaults will happen. + //@@@Alex, this flag is ONLY set by the first meanwhile scene which calls an action. If this + //action isn't called, the AI will never turn on. It is completely dependant on this action. It can //be toggled at will in the AIViewer for testing purposes. -INT32 giReinforcementPool = 0; //How many troops the queen has in reserve in noman's land. These guys are spawned as needed in P3. -INT32 giReinforcementPoints = 0; //the entire army's capacity to provide reinforcements. +INT32 giReinforcementPool = 0; //How many troops the queen has in reserve in noman's land. These guys are spawned as needed in P3. +INT32 giReinforcementPoints = 0; //the entire army's capacity to provide reinforcements. INT32 giRequestPoints = 0; //the entire army's need for reinforcements. -UINT8 gubSAIVersion = SAI_VERSION; //Used for adding new features to be saved. -UINT8 gubQueenPriorityPhase = 0; //Defines how far into defence the queen is -- abstractly related to defcon index ranging from 0-10. +UINT8 gubSAIVersion = SAI_VERSION; //Used for adding new features to be saved. +UINT8 gubQueenPriorityPhase = 0; //Defines how far into defence the queen is -- abstractly related to defcon index ranging from 0-10. BOOLEAN gfUnlimitedTroops = FALSE; BOOLEAN gfAggressiveQueen = FALSE; //10 is the most defensive -//Used for authorizing the use of the first battle meanwhile scene AFTER the battle is complete. This is the case used when +//Used for authorizing the use of the first battle meanwhile scene AFTER the battle is complete. This is the case used when //the player attacks a town, and is set once militia are sent to investigate. BOOLEAN gfFirstBattleMeanwhileScenePending = FALSE; @@ -212,7 +212,7 @@ BOOLEAN gfFirstBattleMeanwhileScenePending = FALSE; BOOLEAN gfMassFortificationOrdered = FALSE; UINT8 gubMinEnemyGroupSize = 0; -UINT8 gubHoursGracePeriod = 0; +UINT8 gubHoursGracePeriod = 0; UINT16 gusPlayerBattleVictories = 0; BOOLEAN gfUseAlternateQueenPosition = FALSE; @@ -229,17 +229,17 @@ ARMY_COMPOSITION gArmyComp[ MAX_ARMY_COMPOSITIONS ]; #define SAVED_GARRISON_GROUPS MAX_GARRISON_GROUPS GARRISON_GROUP *gGarrisonGroup = NULL; -// +// UINT8 NUM_ARMY_COMPOSITIONS; extern UINT8 gubNumGroupsArrivedSimultaneously; -//This refers to the number of force points that are *saved* for the AI to use. This is basically an array of each -//group. When the queen wants to send forces to attack a town that is defended, the initial number of forces that -//she would send would be considered too weak. So, instead, she will send that force to the sector's adjacent sector, -//and stage, while -UINT8 *gubGarrisonReinforcementsDenied = NULL; -UINT8 *gubPatrolReinforcementsDenied = NULL; +//This refers to the number of force points that are *saved* for the AI to use. This is basically an array of each +//group. When the queen wants to send forces to attack a town that is defended, the initial number of forces that +//she would send would be considered too weak. So, instead, she will send that force to the sector's adjacent sector, +//and stage, while +UINT8 *gubGarrisonReinforcementsDenied = NULL; +UINT8 *gubPatrolReinforcementsDenied = NULL; //Unsaved vars BOOLEAN gfDisplayStrategicAILogs = FALSE; @@ -252,17 +252,17 @@ void ValidateLargeGroup( GROUP *pGroup ); extern BOOLEAN TeleportSoldier( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fForce ); -//The army composition defines attributes for the various garrisons. The priority reflects how important the sector is -//to the queen, the elite/troop percentages refer to the desired composition of the group. The admin percentage has recently been -//changed to reflect the starting percentage of the garrison that are administrators. Note that elite% + troop% = 100, and the admin% is -//not related in this effect. If the admin% is non-zero, then that garrison is assigned only x% of the force as admins, with NO troops or elites. +//The army composition defines attributes for the various garrisons. The priority reflects how important the sector is +//to the queen, the elite/troop percentages refer to the desired composition of the group. The admin percentage has recently been +//changed to reflect the starting percentage of the garrison that are administrators. Note that elite% + troop% = 100, and the admin% is +//not related in this effect. If the admin% is non-zero, then that garrison is assigned only x% of the force as admins, with NO troops or elites. //All reinforcements use the composition of the troop/elite for refilling. -//@@@Alex, the send reinforcement composition isn't complete. Either sends all troops or troops based off of the composition of the source garrison. -// It is my intention to add this. +//@@@Alex, the send reinforcement composition isn't complete. Either sends all troops or troops based off of the composition of the source garrison. +// It is my intention to add this. //If you change the MAX_STRATEGIC_TEAM_SIZE, then all the garrison sizes (start, desired) will have to be changed accordingly. -ARMY_COMPOSITION gOrigArmyComp[ MAX_ARMY_COMPOSITIONS ];// = +ARMY_COMPOSITION gOrigArmyComp[ MAX_ARMY_COMPOSITIONS ];// = //{ //COMPOSITION PRIORITY ELITE% TROOP% ADMIN DESIRED# START# PADDING // // START% // QUEEN_DEFENCE, 100, 100, 0, 0, 32, 32, {0,0,0,0,0,0,0,0,0,0}, @@ -291,22 +291,22 @@ ARMY_COMPOSITION gOrigArmyComp[ MAX_ARMY_COMPOSITIONS ];// = // DRASSEN_MINE, 35, 0, 100, 75, 11, 9, {0,0,0,0,0,0,0,0,0,0}, // DRASSEN_SAMSITE, 50, 0, 100, 0, 10, 10, {0,0,0,0,0,0,0,0,0,0}, // ROADBLOCK, 20, 2, 98, 0, 8, 0, {0,0,0,0,0,0,0,0,0,0}, -// SANMONA_SMALL, 0, 0, 0, 0, 0, 0, {0,0,0,0,0,0,0,0,0,0}, +// SANMONA_SMALL, 0, 0, 0, 0, 0, 0, {0,0,0,0,0,0,0,0,0,0}, //}; //Patrol definitions -//NOTE: A point containing 0 is actually the same as SEC_A1, but because nobody is using SEC_A1 in any +//NOTE: A point containing 0 is actually the same as SEC_A1, but because nobody is using SEC_A1 in any // of the patrol groups, I am coding 0 to be ignored. //NOTE: Must have at least two points. -PATROL_GROUP gOrigPatrolGroup[MAX_PATROL_GROUPS];// = -//{ //SIZE PRIORITY POINT1 POINT2 POINT3 POINT4 MOD GROUPID WEIGHT PENDING +PATROL_GROUP gOrigPatrolGroup[MAX_PATROL_GROUPS];// = +//{ //SIZE PRIORITY POINT1 POINT2 POINT3 POINT4 MOD GROUPID WEIGHT PENDING // // DAY100 GROUP ID // 8, 40, SEC_B1, SEC_C1, SEC_C3, SEC_A3, -1, 0, 0, 0, {0,0,0,0,0,0,0,0,0,0}, // 6, 35, SEC_B4, SEC_B7, SEC_C7, 0, -1, 0, 0, 0, {0,0,0,0,0,0,0,0,0,0}, // 6, 25, SEC_A8, SEC_B8, SEC_B9, 0, -1, 0, 0, 0, {0,0,0,0,0,0,0,0,0,0}, // 6, 30, SEC_B10, SEC_B12, 0, 0, -1, 0, 0, 0, {0,0,0,0,0,0,0,0,0,0}, // 7, 45, SEC_A11, SEC_A14, SEC_D14, 0, -1, 0, 0, 0, {0,0,0,0,0,0,0,0,0,0}, -// //5 +// //5 // 6, 50, SEC_C8, SEC_C9, SEC_D9, 0, -1, 0, 0, 0, {0,0,0,0,0,0,0,0,0,0}, // 12, 55, SEC_D3, SEC_G3, 0, 0, -1, 0, 0, 0, {0,0,0,0,0,0,0,0,0,0}, // 10, 50, SEC_D6, SEC_D7, SEC_F7, 0, -1, 0, 0, 0, {0,0,0,0,0,0,0,0,0,0}, @@ -341,8 +341,8 @@ PATROL_GROUP gOrigPatrolGroup[MAX_PATROL_GROUPS];// = -GARRISON_GROUP gOrigGarrisonGroup[MAX_GARRISON_GROUPS];// = -//{ //SECTOR MILITARY WEIGHT UNUSED +GARRISON_GROUP gOrigGarrisonGroup[MAX_GARRISON_GROUPS];// = +//{ //SECTOR MILITARY WEIGHT UNUSED // // COMPOSITION GROUP ID // SEC_P3, QUEEN_DEFENCE, 0, 0, {0,0,0,0,0,0,0,0,0,0}, // SEC_O3, MEDUNA_DEFENCE, 0, 0, {0,0,0,0,0,0,0,0,0,0}, @@ -437,19 +437,19 @@ void EliminateSurplusTroopsForGarrison( GROUP *pGroup, SECTORINFO *pSector ); void ReinitializeUnvisitedGarrisons(); //Records any decisions that I deem important enough into an automatically appending AI log file called -//"Strategic Decisions.txt" in the JA2\Data directory. This also records the time that each log entry +//"Strategic Decisions.txt" in the JA2\Data directory. This also records the time that each log entry //was made. #ifdef JA2BETAVERSION -void LogStrategicEvent( STR8 str, ... ); //adds a timestamp. -void LogStrategicMsg( STR8 str, ... ); //doesn't use the time stamp +void LogStrategicEvent( STR8 str, ... ); //adds a timestamp. +void LogStrategicMsg( STR8 str, ... ); //doesn't use the time stamp void ClearStrategicLog(); #endif -//Recalculates a group's weight based on any changes. -//@@@Alex, this is possibly missing in some areas. It is hard to ensure it is -//everywhere with all the changes I've made. I'm sure you could probably find some missing calls. +//Recalculates a group's weight based on any changes. +//@@@Alex, this is possibly missing in some areas. It is hard to ensure it is +//everywhere with all the changes I've made. I'm sure you could probably find some missing calls. void RecalculatePatrolWeight( INT32 iPatrolID ); void RecalculateGarrisonWeight( INT32 iGarrisonID ); @@ -468,16 +468,16 @@ void ConvertGroupTroopsToComposition( GROUP *pGroup, INT32 iCompositionID ); void RemoveSoldiersFromGarrisonBasedOnComposition( INT32 iGarrisonID, UINT8 ubSize ); //If there are any enemy groups that will be moving through this sector due, they will have to repath which -//will cause them to avoid the sector. Returns the number of redirected groups. +//will cause them to avoid the sector. Returns the number of redirected groups. UINT8 RedirectEnemyGroupsMovingThroughSector( UINT8 ubSectorX, UINT8 ubSectorY ); -//As the player's progress changes in the game, the queen will adjust her priorities accordingly. +//As the player's progress changes in the game, the queen will adjust her priorities accordingly. //Basically, increasing priorities and numbers for sectors she owns, and lowering them. -//@@@Alex, this is tweakable. My philosophies could be incorrect. It might be better if instead of lowering -//priorities and numbers for towns the queen has lost, to instead lower the priority but increase the numbers so -//she would send larger attack forces. This is questionable. +//@@@Alex, this is tweakable. My philosophies could be incorrect. It might be better if instead of lowering +//priorities and numbers for towns the queen has lost, to instead lower the priority but increase the numbers so +//she would send larger attack forces. This is questionable. void EvolveQueenPriorityPhase( BOOLEAN fForceChange ); extern INT16 sWorldSectorLocationOfFirstBattle; @@ -486,7 +486,7 @@ void ReassignAIGroup( GROUP **pGroup ); void TransferGroupToPool( GROUP **pGroup ); void SendGroupToPool( GROUP **pGroup ); -//Simply orders all garrisons to take troops from the patrol groups and send the closest troops from them. Any garrison, +//Simply orders all garrisons to take troops from the patrol groups and send the closest troops from them. Any garrison, //whom there request isn't fulfilled (due to lack of troops), will recieve their reinforcements from the queen (P3). void MassFortifyTowns(); @@ -510,41 +510,42 @@ void MoveSAIGroupToSector( GROUP **pGroup, UINT8 ubSectorID, UINT32 uiMoveCode, -/* This is only a dirty fix to prevent CTD: +/* This is only a dirty fix to prevent CTD: * when loading a game, sometimes I found that * 'gGarrisonGroup' was not allocated. * so I did: * - added NULL check, - * - added some AssertMsg, + * - added some AssertMsg, * - added new allocation on different places * - condensed this paces to the following function * --------------------------- - * 2007-03-03, Sgt. Kolja + * 2007-03-03, Sgt. Kolja */ - + /* PUBLIC */ void Ensure_RepairedGarrisonGroup( GARRISON_GROUP **ppGarrison, INT32 *pGarraySize ) -{{ - GARRISON_GROUP *pG; +{ + { + GARRISON_GROUP *pG; - pG = *ppGarrison; + pG = *ppGarrison; - if( !pG ) - { - //AssertMsg( 0, "invalid global Array in" __FILE__ ); - //return; - pG = (GARRISON_GROUP*)MemAlloc( sizeof( gOrigGarrisonGroup ) ); - Assert( pG ); - memcpy( pG, gOrigGarrisonGroup, sizeof( gOrigGarrisonGroup ) ); - *pGarraySize = sizeof( gOrigGarrisonGroup ) / sizeof(GARRISON_GROUP); - *ppGarrison = pG; - } - return; + if( !pG ) + { + //AssertMsg( 0, "invalid global Array in" __FILE__ ); + //return; + pG = (GARRISON_GROUP*)MemAlloc( sizeof( gOrigGarrisonGroup ) ); + Assert( pG ); + memcpy( pG, gOrigGarrisonGroup, sizeof( gOrigGarrisonGroup ) ); + *pGarraySize = sizeof( gOrigGarrisonGroup ) / sizeof(GARRISON_GROUP); + *ppGarrison = pG; + } + return; }} -//returns the number of reinforcements permitted to be sent. Will increased if the denied counter is non-zero. +//returns the number of reinforcements permitted to be sent. Will increased if the denied counter is non-zero. INT32 GarrisonReinforcementsRequested( INT32 iGarrisonID, UINT8 *pubExtraReinforcements ) { INT32 iReinforcementsRequested; @@ -553,13 +554,13 @@ INT32 GarrisonReinforcementsRequested( INT32 iGarrisonID, UINT8 *pubExtraReinfor INT32 iMaxEnemyGroupSize = gGameExternalOptions.iMaxEnemyGroupSize; DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic1"); - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ pSector = &SectorInfo[ gGarrisonGroup[ iGarrisonID ].ubSectorID ]; iExistingForces = pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites; iReinforcementsRequested = gArmyComp[ gGarrisonGroup[ iGarrisonID ].ubComposition ].bDesiredPopulation - iExistingForces; - //Record how many of the reinforcements are additionally provided due to being denied in the past. This will grow + //Record how many of the reinforcements are additionally provided due to being denied in the past. This will grow //until it is finally excepted or an absolute max is made. *pubExtraReinforcements = (UINT8)(gubGarrisonReinforcementsDenied[ iGarrisonID ] / (6 - gGameOptions.ubDifficultyLevel)); //Make sure the number of extra reinforcements don't bump the force size past the max of MAX_STRATEGIC_TEAM_SIZE. @@ -594,7 +595,7 @@ INT32 ReinforcementsAvailable( INT32 iGarrisonID ) SECTORINFO *pSector; INT32 iReinforcementsAvailable; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ pSector = &SectorInfo[ gGarrisonGroup[ iGarrisonID ].ubSectorID ]; iReinforcementsAvailable = pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumAdmins; @@ -627,9 +628,9 @@ BOOLEAN PlayerForceTooStrong( UINT8 ubSectorID, UINT16 usOffensePoints, UINT16 * ubSectorY = (UINT8)SECTORY( ubSectorID ); pSector = &SectorInfo[ ubSectorID ]; - *pusDefencePoints = pSector->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] * 1 + + *pusDefencePoints = pSector->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] * 1 + pSector->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] * 2 + - pSector->ubNumberOfCivsAtLevel[ ELITE_MILITIA ] * 3 + + pSector->ubNumberOfCivsAtLevel[ ELITE_MILITIA ] * 3 + PlayerMercsInSector( ubSectorX, ubSectorY, 0 ) * 5; if( *pusDefencePoints > usOffensePoints ) { @@ -642,14 +643,14 @@ void RequestAttackOnSector( UINT8 ubSectorID, UINT16 usDefencePoints ) { INT32 i; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ for( i = 0; i < giGarrisonArraySize; i++ ) { if( gGarrisonGroup[ i ].ubSectorID == ubSectorID && !gGarrisonGroup[ i ].ubPendingGroupID ) { #ifdef JA2BETAVERSION - LogStrategicEvent( "An attack has been requested in sector %c%d.", + LogStrategicEvent( "An attack has been requested in sector %c%d.", SECTORY( ubSectorID ) + 'A' - 1, SECTORX( ubSectorID ) ); #endif SendReinforcementsForGarrison( i, usDefencePoints, NULL ); @@ -663,14 +664,14 @@ void RequestAttackOnSector( UINT8 ubSectorID, UINT16 usDefencePoints ) BOOLEAN AdjacentSectorIsImportantAndUndefended( UINT8 ubSectorID ) { SECTORINFO *pSector; - + switch( ubSectorID ) { //case SEC_A9: case SEC_A10: //Omerta case SEC_C5: case SEC_C6: case SEC_D5: //San Mona case SEC_I6: //Estoni - - //These sectors aren't important. //Lalien: changed this, need to externalize + + //These sectors aren't important. //Lalien: changed this, need to externalize return FALSE; } @@ -698,7 +699,7 @@ void ValidatePendingGroups() INT32 i, iErrorsForInvalidPendingGroup = 0; UINT8 ubGroupID; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ for( i = 0; i < giPatrolArraySize; i++ ) { @@ -716,21 +717,21 @@ void ValidatePendingGroups() for( i = 0; i < giGarrisonArraySize; i++ ) { ubGroupID = gGarrisonGroup[ i ].ubPendingGroupID; - if( ubGroupID ) - { - pGroup = GetGroup( ubGroupID ); - if( !pGroup || pGroup->fPlayer ) + if( ubGroupID ) + { + pGroup = GetGroup( ubGroupID ); + if( !pGroup || pGroup->fPlayer ) { - iErrorsForInvalidPendingGroup++; - gGarrisonGroup[ i ].ubPendingGroupID = 0; - } - } + iErrorsForInvalidPendingGroup++; + gGarrisonGroup[ i ].ubPendingGroupID = 0; + } + } } if( iErrorsForInvalidPendingGroup ) { CHAR16 str[256]; - swprintf( str, L"Strategic AI: Internal error -- %d pending groups were discovered to be invalid. Please report error and send save." - L"You can continue playing, as this has been auto-corrected. No need to send any debug files.", iErrorsForInvalidPendingGroup ); + swprintf( str, L"Strategic AI: Internal error -- %d pending groups were discovered to be invalid. Please report error and send save." + L"You can continue playing, as this has been auto-corrected. No need to send any debug files.", iErrorsForInvalidPendingGroup ); SAIReportError( str ); } #endif @@ -743,9 +744,9 @@ void ValidateWeights( INT32 iID ) INT32 iSumRequestPoints = 0; INT32 iSumReinforcementPoints = 0; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ - - for( i = 0; i < giPatrolArraySize; i++ ) + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + + for( i = 0; i < giPatrolArraySize; i++ ) { iSumRequestPoints += gPatrolGroup[ i ].bWeight; } @@ -760,12 +761,12 @@ void ValidateWeights( INT32 iID ) iSumReinforcementPoints -= gGarrisonGroup[ i ].bWeight; //double negative is positive! } } - + if( giReinforcementPoints != iSumReinforcementPoints || giRequestPoints != iSumRequestPoints ) { CHAR16 str[256]; - swprintf( str, L"Strategic AI: Internal error #%02d (total request/reinforcement points). Please report error including error#. " - L"You can continue playing, as the points have been auto-corrected. No need to send any save/debug files.", iID ); + swprintf( str, L"Strategic AI: Internal error #%02d (total request/reinforcement points). Please report error including error#. " + L"You can continue playing, as the points have been auto-corrected. No need to send any save/debug files.", iID ); //Correct the misalignment. giReinforcementPoints = iSumReinforcementPoints; giRequestPoints = iSumRequestPoints; @@ -779,7 +780,7 @@ void ValidateGroup( GROUP *pGroup ) INT32 iMaxEnemyGroupSize = gGameExternalOptions.iMaxEnemyGroupSize; DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic2"); - if (pGroup == NULL) + if (pGroup == NULL) { return; } @@ -791,8 +792,8 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic2"); #ifdef JA2BETAVERSION { CHAR16 str[256]; - swprintf( str, L"Strategic AI: Internal error (invalid enemy group #%d location at %c%d, destination %c%d). Please send PRIOR save file and Strategic Decisions.txt.", - pGroup->ubGroupID, pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX, pGroup->ubNextY + 'A' - 1, pGroup->ubNextX ); + swprintf( str, L"Strategic AI: Internal error (invalid enemy group #%d location at %c%d, destination %c%d). Please send PRIOR save file and Strategic Decisions.txt.", + pGroup->ubGroupID, pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX, pGroup->ubNextY + 'A' - 1, pGroup->ubNextX ); SAIReportError( str ); } #endif @@ -803,11 +804,11 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic2"); } if( !pGroup->ubNextX || !pGroup->ubNextY ) { - if( !pGroup->fPlayer && pGroup->pEnemyGroup->ubIntention != STAGING - && pGroup->pEnemyGroup->ubIntention != REINFORCEMENTS ) + if( !pGroup->fPlayer && pGroup->pEnemyGroup->ubIntention != STAGING + && pGroup->pEnemyGroup->ubIntention != REINFORCEMENTS ) { #ifdef JA2BETAVERSION - SAIReportError( L"Strategic AI: Internal error (floating group). Please send PRIOR save file and Strategic Decisions.txt." ); + SAIReportError( L"Strategic AI: Internal error (floating group). Please send PRIOR save file and Strategic Decisions.txt." ); #endif if( gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) { @@ -821,7 +822,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic2"); if( pGroup->pEnemyGroup->ubNumAdmins + pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites != pGroup->ubGroupSize || pGroup->ubGroupSize > iMaxEnemyGroupSize ) { - SAIReportError( L"Strategic AI: Internal error (bad group populations). Please send PRIOR save file and Strategic Decisions.txt." ); + SAIReportError( L"Strategic AI: Internal error (bad group populations). Please send PRIOR save file and Strategic Decisions.txt." ); } #endif } @@ -832,11 +833,11 @@ void ValidateLargeGroup( GROUP *pGroup ) if( pGroup->ubGroupSize > 25 ) { CHAR16 str[ 512 ]; - swprintf( str, L"Strategic AI warning: Enemy group containing %d soldiers " - L"(%d admins, %d troops, %d elites) in sector %c%d. This message is a temporary test message " - L"to evaluate a potential problems with very large enemy groups.", - pGroup->ubGroupSize, pGroup->pEnemyGroup->ubNumAdmins, pGroup->pEnemyGroup->ubNumTroops, pGroup->pEnemyGroup->ubNumElites, - pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX ); + swprintf( str, L"Strategic AI warning: Enemy group containing %d soldiers " + L"(%d admins, %d troops, %d elites) in sector %c%d. This message is a temporary test message " + L"to evaluate a potential problems with very large enemy groups.", + pGroup->ubGroupSize, pGroup->pEnemyGroup->ubNumAdmins, pGroup->pEnemyGroup->ubNumTroops, pGroup->pEnemyGroup->ubNumElites, + pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX ); SAIReportError( str ); } #endif @@ -897,7 +898,7 @@ void ValidatePlayersAreInOneGroupOnly() pSoldier = MercPtrs[ i ]; - if( !pSoldier->bActive || !pSoldier->bLife || !pSoldier->ubGroupID ) + if( !pSoldier->bActive || !pSoldier->stats.bLife || !pSoldier->ubGroupID ) { //non-existant, dead, or in no group (don't care, skip to next merc) continue; } @@ -911,7 +912,7 @@ void ValidatePlayersAreInOneGroupOnly() //Go through each group and determine if the player exists in multiple groups //iGroups ------ counts the number of groups the merc is in. //iMismatches -- counts the cases where the merc's ubGroupID doesn't match the ubGroupID of the group - // the merc exists in. + // the merc exists in. pGroup = gpGroupList; while( pGroup ) { @@ -943,7 +944,7 @@ void ValidatePlayersAreInOneGroupOnly() if( iNumErrors == 1 ) { //This is the first error, so we will provide detailed debug information to help fix the bug(s). if( iGroups == 1 && iMismatches == 1 ) - { //We have a very serious problem, as we have no way to know which group this merc is supposed to be in. + { //We have a very serious problem, as we have no way to know which group this merc is supposed to be in. //This problem cannot be corrected (so we will assign the merc to his own unique squad) and definately report it. //Get a pointer to the group that contains the merc @@ -980,18 +981,18 @@ void ValidatePlayersAreInOneGroupOnly() pGroup = GetGroup( pSoldier->ubGroupID ); Assert( pGroup ); Assert( pOtherGroup ); - swprintf( str, L"%s in %c%d thinks he/she is in group %d in %c%d but isn't. " - L"Group %d in %c%d thinks %s is in the group but isn't. %s will be assigned to a unique squad. " - L"Please send screenshot, PRIOR save (corrected by time you read this), and any theories.", - pSoldier->name, pSoldier->sSectorY + 'A' - 1, pSoldier->sSectorX, - pSoldier->ubGroupID, pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX, - pOtherGroup->ubGroupID, pOtherGroup->ubSectorY + 'A' - 1, pOtherGroup->ubSectorX, pSoldier->name, - pSoldier->name ); + swprintf( str, L"%s in %c%d thinks he/she is in group %d in %c%d but isn't. " + L"Group %d in %c%d thinks %s is in the group but isn't. %s will be assigned to a unique squad. " + L"Please send screenshot, PRIOR save (corrected by time you read this), and any theories.", + pSoldier->name, pSoldier->sSectorY + 'A' - 1, pSoldier->sSectorX, + pSoldier->ubGroupID, pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX, + pOtherGroup->ubGroupID, pOtherGroup->ubSectorY + 'A' - 1, pOtherGroup->ubSectorX, pSoldier->name, + pSoldier->name ); } else if( iGroups > 1 && iMismatches == iGroups - 1 ) - { //This is the error that is being targetted. This means that the merc exists in multiple groups though the merc - //knows what group he is supposed to be in. This error can be corrected, by manually removing the merc from all - //mismatch groups. This is indicative of a merc being reassigned to another group without removing him first. + { //This is the error that is being targetted. This means that the merc exists in multiple groups though the merc + //knows what group he is supposed to be in. This error can be corrected, by manually removing the merc from all + //mismatch groups. This is indicative of a merc being reassigned to another group without removing him first. //Get a pointer to the first mismatch group that contains the merc iMismatches = 0; @@ -1023,51 +1024,51 @@ void ValidatePlayersAreInOneGroupOnly() pGroup = GetGroup( pSoldier->ubGroupID ); Assert( pGroup ); Assert( pOtherGroup ); - - swprintf( str, L"%s in %c%d has been found in multiple groups. The group he/she is supposed " - L"to be in is group %d in %c%d, but %s was also found to be in group %d in %c%d. %s was found in %d groups " - L"total. Please send screenshot, PRIOR save (corrected by time you read this), and any theories.", - pSoldier->name, pSoldier->sSectorY + 'A' - 1, pSoldier->sSectorX, - pGroup->ubGroupID, pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX, - pSoldier->name, pOtherGroup->ubGroupID, pOtherGroup->ubSectorY + 'A' - 1, pOtherGroup->ubSectorX, - pSoldier->name, iGroups ); + + swprintf( str, L"%s in %c%d has been found in multiple groups. The group he/she is supposed " + L"to be in is group %d in %c%d, but %s was also found to be in group %d in %c%d. %s was found in %d groups " + L"total. Please send screenshot, PRIOR save (corrected by time you read this), and any theories.", + pSoldier->name, pSoldier->sSectorY + 'A' - 1, pSoldier->sSectorX, + pGroup->ubGroupID, pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX, + pSoldier->name, pOtherGroup->ubGroupID, pOtherGroup->ubSectorY + 'A' - 1, pOtherGroup->ubSectorX, + pSoldier->name, iGroups ); } else if( !iGroups ) - { //The merc cannot be found in any group! This should never happen! We will assign the merc into his + { //The merc cannot be found in any group! This should never happen! We will assign the merc into his //own unique squad as a correction. - swprintf( str, L"%s in %c%d cannot be found in any group. %s will be assigned to a unique group/squad. " - L"Please provide details on how you think this may have happened. Send screenshot and PRIOR save. Do not send a save " - L"you create after this point as the info will have been corrected by then.", - pSoldier->name, pSoldier->sSectorY + 'A' - 1, pSoldier->sSectorX, pSoldier->name ); + swprintf( str, L"%s in %c%d cannot be found in any group. %s will be assigned to a unique group/squad. " + L"Please provide details on how you think this may have happened. Send screenshot and PRIOR save. Do not send a save " + L"you create after this point as the info will have been corrected by then.", + pSoldier->name, pSoldier->sSectorY + 'A' - 1, pSoldier->sSectorX, pSoldier->name ); } } //CORRECT THE ERRORS NOW if( iGroups == 1 && iMismatches == 1 ) - { //We have a very serious problem, as we have no way to know which group this merc is supposed to be in. + { //We have a very serious problem, as we have no way to know which group this merc is supposed to be in. //This problem cannot be corrected (so we will assign the merc to his own unique squad). RemovePlayersFromAllMismatchGroups( pSoldier ); AddCharacterToUniqueSquad( pSoldier ); } else if( iGroups > 1 && iMismatches == iGroups - 1 ) - { //This is the error that is being targetted. This means that the merc exists in multiple groups though the merc - //knows what group he is supposed to be in. This error can be corrected, by manually removing the merc from all - //mismatch groups. This is indicative of a merc being reassigned to another group without removing him first. + { //This is the error that is being targetted. This means that the merc exists in multiple groups though the merc + //knows what group he is supposed to be in. This error can be corrected, by manually removing the merc from all + //mismatch groups. This is indicative of a merc being reassigned to another group without removing him first. RemovePlayersFromAllMismatchGroups( pSoldier ); pSoldier->ubGroupID = ubGroupID; } else if( !iGroups ) - { //The merc cannot be found in any group! This should never happen! We will assign the merc into his + { //The merc cannot be found in any group! This should never happen! We will assign the merc into his //own unique squad as a correction. AddCharacterToUniqueSquad( pSoldier ); } } } if( iNumErrors ) - { //The first error to be detected is the one responsible for building the strings. We will simply append another string containing + { //The first error to be detected is the one responsible for building the strings. We will simply append another string containing //the total number of detected errors. CHAR16 tempstr[ 128 ]; - swprintf( tempstr, L" A total of %d related errors have been detected.", iNumErrors ); + swprintf( tempstr, L" A total of %d related errors have been detected.", iNumErrors ); wcscat( str, tempstr ); SAIReportError( str ); } @@ -1124,25 +1125,25 @@ void InitStrategicAI() INT32 iPercentElitesBonus; INT32 iMaxEnemyGroupSize = gGameExternalOptions.iMaxEnemyGroupSize; DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic3"); - + //Initialize the basic variables. gbPadding2[0] = 0; gbPadding2[1] = 0; gbPadding2[2] = 0; - gfExtraElites = FALSE; + gfExtraElites = FALSE; //giGarrisonArraySize = 0; //giPatrolArraySize = 0; - giForcePercentage = 0; - giArmyAlertness = 0; - giArmyAlertnessDecay = 0; - gubNumAwareBattles = 0; - gfQueenAIAwake = FALSE; - giReinforcementPool = 0; - giReinforcementPoints = 0; - giRequestPoints = 0; - gubSAIVersion = SAI_VERSION; - gubQueenPriorityPhase = 0; + giForcePercentage = 0; + giArmyAlertness = 0; + giArmyAlertnessDecay = 0; + gubNumAwareBattles = 0; + gfQueenAIAwake = FALSE; + giReinforcementPool = 0; + giReinforcementPoints = 0; + giRequestPoints = 0; + gubSAIVersion = SAI_VERSION; + gubQueenPriorityPhase = 0; gfFirstBattleMeanwhileScenePending = FALSE; gfMassFortificationOrdered = FALSE; gubMinEnemyGroupSize = 0; @@ -1211,7 +1212,7 @@ void InitStrategicAI() SectorInfo[ i ].ubGarrisonID = NO_GARRISON; } - //copy over the original army composition as it does get modified during the campaign. This + //copy over the original army composition as it does get modified during the campaign. This //bulletproofs starting the game over again. memcpy( gArmyComp, gOrigArmyComp, sizeof( gArmyComp ) ); @@ -1225,7 +1226,7 @@ void InitStrategicAI() gArmyComp[ LEVEL3_DEFENCE ].bStartPopulation = 0; break; // Kaiden: original Experienced troop compositions: - //case DIF_LEVEL_MEDIUM: + //case DIF_LEVEL_MEDIUM: //gArmyComp[ LEVEL3_DEFENCE ].bDesiredPopulation = 0; //gArmyComp[ LEVEL3_DEFENCE ].bStartPopulation = 0; //break; @@ -1305,7 +1306,7 @@ void InitStrategicAI() gGarrisonGroup = (GARRISON_GROUP*)MemAlloc( sizeof( gOrigGarrisonGroup ) ); Assert( gGarrisonGroup ); memcpy( gGarrisonGroup, gOrigGarrisonGroup, sizeof( gOrigGarrisonGroup ) ); - + if ( gubGarrisonReinforcementsDenied ) { MemFree( gubGarrisonReinforcementsDenied ); @@ -1323,8 +1324,8 @@ void InitStrategicAI() { gArmyComp[ i ].bDesiredPopulation = (INT8)min( iMaxEnemyGroupSize, (gArmyComp[ i ].bDesiredPopulation * giForcePercentage / 100) ); if( gArmyComp[ i ].bStartPopulation != iMaxEnemyGroupSize ) - { //if the value is MAX_STRATEGIC_TEAM_SIZE, then that means the particular sector is a spawning location. - //Don't modify the value if it is MAX_STRATEGIC_TEAM_SIZE. Everything else is game. + { //if the value is MAX_STRATEGIC_TEAM_SIZE, then that means the particular sector is a spawning location. + //Don't modify the value if it is MAX_STRATEGIC_TEAM_SIZE. Everything else is game. gArmyComp[ i ].bStartPopulation = (INT8)min( iMaxEnemyGroupSize, (gArmyComp[ i ].bStartPopulation * giForcePercentage / 100) ); } } @@ -1426,7 +1427,7 @@ void InitStrategicAI() } //Calculate weight (range is -20 to +20 before multiplier). //The multiplier of 3 brings it to a range of -96 to +96 which is - //close enough to a plus/minus 100%. The resultant percentage is then + //close enough to a plus/minus 100%. The resultant percentage is then //converted based on the priority. iWeight = (iDesiredPop - iStartPop) * 3; if( iWeight > 0 ) @@ -1436,8 +1437,8 @@ void InitStrategicAI() iWeight = max( iWeight, 2 ); giRequestPoints += iWeight; } - else if( iWeight < 0 ) - { //modify it by it's reverse priority + else if( iWeight < 0 ) + { //modify it by it's reverse priority //generates a value between -2 and -100 iWeight = iWeight * (100-iPriority) / 96; iWeight = min( iWeight, -2 ); @@ -1453,7 +1454,7 @@ void InitStrategicAI() //Now, initialize each of the patrol groups for( i = 0; i < giPatrolArraySize; i++ ) { // IGNORE COMMENT, FEATURE REMOVED! - //Some of the patrol groups aren't there at the beginning of the game. This is + //Some of the patrol groups aren't there at the beginning of the game. This is //based on the difficulty settings in the above patrol table. //if( gPatrolGroup[ i ].ubUNUSEDStartIfDifficulty <= gGameOptions.ubDifficultyLevel ) { //Add this patrol group now. @@ -1467,20 +1468,20 @@ void InitStrategicAI() Assert( pGroup ); if( i == 3 || i == 4 ) - { //Special case: Two patrol groups are administrator groups -- rest are troops + { //Special case: Two patrol groups are administrator groups -- rest are troops pGroup->pEnemyGroup->ubNumAdmins = pGroup->pEnemyGroup->ubNumTroops; pGroup->pEnemyGroup->ubNumTroops = 0; } gPatrolGroup[ i ].ubGroupID = pGroup->ubGroupID; pGroup->pEnemyGroup->ubIntention = PATROL; pGroup->ubMoveType = ENDTOEND_FORWARDS; - AddWaypointIDToPGroup( pGroup, gPatrolGroup[ i ].ubSectorID[ 0 ] ); - AddWaypointIDToPGroup( pGroup, gPatrolGroup[ i ].ubSectorID[ 1 ] ); + AddWaypointIDToPGroup( pGroup, gPatrolGroup[ i ].ubSectorID[ 0 ] ); + AddWaypointIDToPGroup( pGroup, gPatrolGroup[ i ].ubSectorID[ 1 ] ); if( gPatrolGroup[ i ].ubSectorID[ 2 ] ) { //Add optional waypoints if included. - AddWaypointIDToPGroup( pGroup, gPatrolGroup[ i ].ubSectorID[ 2 ] ); + AddWaypointIDToPGroup( pGroup, gPatrolGroup[ i ].ubSectorID[ 2 ] ); if( gPatrolGroup[ i ].ubSectorID[ 3 ] ) - AddWaypointIDToPGroup( pGroup, gPatrolGroup[ i ].ubSectorID[ 3 ] ); + AddWaypointIDToPGroup( pGroup, gPatrolGroup[ i ].ubSectorID[ 3 ] ); } RandomizePatrolGroupLocation( pGroup ); ValidateGroup( pGroup ); @@ -1507,7 +1508,7 @@ void InitStrategicAI() //SectorInfo[SEC_I8].uiFlags |= SF_SAM_SITE; //SectorInfo[SEC_N4].uiFlags |= SF_SAM_SITE; - //final thing to do is choose 1 cache map out of 5 possible maps. Simply select the sector randomly, + //final thing to do is choose 1 cache map out of 5 possible maps. Simply select the sector randomly, //set up the flags to use the alternate map, then place 8-12 regular troops there (no ai though). //changing MAX_STRATEGIC_TEAM_SIZE may require changes to to the defending force here. if ( !gGameExternalOptions.fEnableAllWeaponCaches ) @@ -1592,8 +1593,8 @@ BOOLEAN EnemyPermittedToAttackSector( GROUP **pGroup, UINT8 ubSectorID ) SECTORINFO *pSector; BOOLEAN fPermittedToAttack = TRUE; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ - + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + pSector = &SectorInfo[ ubSectorID ]; fPermittedToAttack = OkayForEnemyToMoveThroughSector( ubSectorID ); if( pGroup && *pGroup && pSector->ubGarrisonID != NO_GARRISON ) @@ -1601,13 +1602,13 @@ BOOLEAN EnemyPermittedToAttackSector( GROUP **pGroup, UINT8 ubSectorID ) if( gGarrisonGroup[ pSector->ubGarrisonID ].ubPendingGroupID ) { GROUP *pPendingGroup; - pPendingGroup = GetGroup( gGarrisonGroup[ pSector->ubGarrisonID ].ubPendingGroupID ); + pPendingGroup = GetGroup( gGarrisonGroup[ pSector->ubGarrisonID ].ubPendingGroupID ); if( pPendingGroup == *pGroup ) { if( fPermittedToAttack ) { if( GroupAtFinalDestination( *pGroup ) ) - { //High priority reinforcements have arrived. This overrides most other situations. + { //High priority reinforcements have arrived. This overrides most other situations. return TRUE; } } @@ -1630,11 +1631,11 @@ BOOLEAN EnemyPermittedToAttackSector( GROUP **pGroup, UINT8 ubSectorID ) if( CheckFact( 273, FALSE ) ) return FALSE; break; - + //Lalien: deactivated //case SEC_A9: //case SEC_A10: - // //Omerta -- not until Day 2 at 7:45AM. + // //Omerta -- not until Day 2 at 7:45AM. // if( GetWorldTotalMin() < 3345 ) // return FALSE; // break; @@ -1687,22 +1688,22 @@ BOOLEAN HandlePlayerGroupNoticedByPatrolGroup( GROUP *pPlayerGroup, GROUP *pEnem if( pPlayerGroup->ubNextX ) { MoveSAIGroupToSector( &pEnemyGroup, (UINT8)SECTOR( pPlayerGroup->ubNextX, pPlayerGroup->ubNextY ), DIRECT, PURSUIT ); - + #ifdef JA2BETAVERSION - LogStrategicEvent( "Enemy group at %c%d detected player group at %c%d and is moving to intercept them at %c%d.", + LogStrategicEvent( "Enemy group at %c%d detected player group at %c%d and is moving to intercept them at %c%d.", pEnemyGroup->ubSectorY + 'A' - 1, pEnemyGroup->ubSectorX, - pPlayerGroup->ubSectorY + 'A' - 1, pPlayerGroup->ubSectorX, + pPlayerGroup->ubSectorY + 'A' - 1, pPlayerGroup->ubSectorX, pPlayerGroup->ubNextY + 'A' - 1, pPlayerGroup->ubNextX ); #endif } else { MoveSAIGroupToSector( &pEnemyGroup, (UINT8)SECTOR( pPlayerGroup->ubSectorX, pPlayerGroup->ubSectorY ), DIRECT, PURSUIT ); - + #ifdef JA2BETAVERSION - LogStrategicEvent( "Enemy group at %c%d detected player group at %c%d and is moving to intercept them at %c%d.", + LogStrategicEvent( "Enemy group at %c%d detected player group at %c%d and is moving to intercept them at %c%d.", pEnemyGroup->ubSectorY + 'A' - 1, pEnemyGroup->ubSectorX, - pPlayerGroup->ubSectorY + 'A' - 1, pPlayerGroup->ubSectorX, + pPlayerGroup->ubSectorY + 'A' - 1, pPlayerGroup->ubSectorX, pPlayerGroup->ubSectorY + 'A' - 1, pPlayerGroup->ubSectorX ); #endif } @@ -1734,7 +1735,7 @@ void HandlePlayerGroupNoticedByGarrison( GROUP *pPlayerGroup, UINT8 ubSectorID ) return; } - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ if( pSector->ubGarrisonID != NO_GARRISON ) { @@ -1742,9 +1743,9 @@ void HandlePlayerGroupNoticedByGarrison( GROUP *pPlayerGroup, UINT8 ubSectorID ) ubEnemies = (UINT8)(pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites); if ( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE ) iReinforcementsApproved = (ubEnemies - gArmyComp[ gGarrisonGroup[ pSector->ubGarrisonID ].ubComposition ].bDesiredPopulation ); - else + else iReinforcementsApproved = (ubEnemies - gArmyComp[ gGarrisonGroup[ pSector->ubGarrisonID ].ubComposition ].bDesiredPopulation / 2); - + if( iReinforcementsApproved*2 > pPlayerGroup->ubGroupSize*3 && iReinforcementsApproved > gubMinEnemyGroupSize ) { //Then enemy's available outnumber the player by at least 3:2, so attack them. pGroup = CreateNewEnemyGroupDepartingFromSector( ubSectorID, 0, (UINT8)iReinforcementsApproved, 0 ); @@ -1758,16 +1759,16 @@ void HandlePlayerGroupNoticedByGarrison( GROUP *pPlayerGroup, UINT8 ubSectorID ) if( pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumAdmins > iMaxEnemyGroupSize ) { #ifdef JA2BETAVERSION - LogStrategicEvent( "ERROR: Sector %c%d now has %d enemies (max %d).", + LogStrategicEvent( "ERROR: Sector %c%d now has %d enemies (max %d).", gGarrisonGroup[ pSector->ubGarrisonID ].ubSectorID / 16 + 'A' , gGarrisonGroup[ pSector->ubGarrisonID ].ubSectorID % 16, pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumAdmins, iMaxEnemyGroupSize ); #endif } - + #ifdef JA2BETAVERSION - LogStrategicEvent( "Enemy garrison at %c%d detected stopped player group at %c%d and is sending %d troops to attack.", + LogStrategicEvent( "Enemy garrison at %c%d detected stopped player group at %c%d and is sending %d troops to attack.", gGarrisonGroup[ pSector->ubGarrisonID ].ubSectorID / 16 + 'A' , gGarrisonGroup[ pSector->ubGarrisonID ].ubSectorID % 16, - pPlayerGroup->ubSectorY + 'A' - 1, pPlayerGroup->ubSectorX, + pPlayerGroup->ubSectorY + 'A' - 1, pPlayerGroup->ubSectorX, pGroup->pEnemyGroup->ubNumElites + pGroup->pEnemyGroup->ubNumTroops ); #endif } @@ -1790,9 +1791,9 @@ BOOLEAN HandleMilitiaNoticedByPatrolGroup( UINT8 ubSectorID, GROUP *pEnemyGroup } MoveSAIGroupToSector( &pEnemyGroup, (UINT8)SECTOR( ubSectorX, ubSectorY ), DIRECT, REINFORCEMENTS ); - + #ifdef JA2BETAVERSION - LogStrategicEvent( "Enemy group at %c%d detected militia at %c%d and is moving to attack them.", + LogStrategicEvent( "Enemy group at %c%d detected militia at %c%d and is moving to attack them.", pEnemyGroup->ubSectorY + 'A' - 1, pEnemyGroup->ubSectorX, ubSectorY + 'A' - 1, ubSectorX ); #endif @@ -1802,7 +1803,7 @@ BOOLEAN HandleMilitiaNoticedByPatrolGroup( UINT8 ubSectorID, GROUP *pEnemyGroup BOOLEAN AttemptToNoticeEmptySectorSucceeds() { if( gubNumAwareBattles || gfAutoAIAware ) - { //The queen is in high-alert and is searching for players. All adjacent checks will automatically succeed. + { //The queen is in high-alert and is searching for players. All adjacent checks will automatically succeed. return TRUE; } if( DayTime() ) @@ -1833,13 +1834,13 @@ BOOLEAN AttemptToNoticeEmptySectorSucceeds() } //Calling the function assumes that a player group is found to be adjacent to an enemy group. -//This uses the alertness rating to emulate the chance that the group will notice. If it does +//This uses the alertness rating to emulate the chance that the group will notice. If it does //notice, then the alertness drops accordingly to simulate a period of time where the enemy would -//not notice as much. If it fails, the alertness gradually increases until it succeeds. +//not notice as much. If it fails, the alertness gradually increases until it succeeds. BOOLEAN AttemptToNoticeAdjacentGroupSucceeds() { if( gubNumAwareBattles || gfAutoAIAware ) - { //The queen is in high-alert and is searching for players. All adjacent checks will automatically succeed. + { //The queen is in high-alert and is searching for players. All adjacent checks will automatically succeed. return TRUE; } if( DayTime() ) @@ -1875,13 +1876,13 @@ BOOLEAN HandleEmptySectorNoticedByPatrolGroup( GROUP *pGroup, UINT8 ubEmptySecto UINT8 ubSectorX = (UINT8)(ubEmptySectorID % 16) + 1; UINT8 ubSectorY = (UINT8)(ubEmptySectorID / 16) + 1; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ ubGarrisonID = SectorInfo[ ubEmptySectorID ].ubGarrisonID; if( ubGarrisonID != NO_GARRISON ) { if( gGarrisonGroup[ ubGarrisonID ].ubPendingGroupID ) - { + { return FALSE; } } @@ -1895,9 +1896,9 @@ BOOLEAN HandleEmptySectorNoticedByPatrolGroup( GROUP *pGroup, UINT8 ubEmptySecto gGarrisonGroup[ ubGarrisonID ].ubPendingGroupID = pGroup->ubGroupID; MoveSAIGroupToSector( &pGroup, (UINT8)SECTOR( ubSectorX, ubSectorY ), DIRECT, REINFORCEMENTS ); - + #ifdef JA2BETAVERSION - LogStrategicEvent( "Enemy group at %c%d detected undefended sector at %c%d and is moving to retake it.", + LogStrategicEvent( "Enemy group at %c%d detected undefended sector at %c%d and is moving to retake it.", pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX, ubSectorY + 'A' - 1, ubSectorX ); #endif @@ -1923,7 +1924,7 @@ void HandleEmptySectorNoticedByGarrison( UINT8 ubGarrisonSectorID, UINT8 ubEmpty return; } - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ if( gGarrisonGroup[ ubDstGarrisonID ].ubPendingGroupID ) { //A group is already on-route, so don't send anybody from here. @@ -1950,27 +1951,27 @@ BOOLEAN ReinforcementsApproved( INT32 iGarrisonID, UINT16 *pusDefencePoints ) UINT16 usOffensePoints; UINT8 ubSectorX, ubSectorY; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ pSector = &SectorInfo[ gGarrisonGroup[ iGarrisonID ].ubSectorID ]; ubSectorX = (UINT8)SECTORX( gGarrisonGroup[ iGarrisonID ].ubSectorID ); ubSectorY = (UINT8)SECTORY( gGarrisonGroup[ iGarrisonID ].ubSectorID ); - *pusDefencePoints = pSector->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] * 1 + + *pusDefencePoints = pSector->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] * 1 + pSector->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] * 2 + - pSector->ubNumberOfCivsAtLevel[ ELITE_MILITIA ] * 3 + + pSector->ubNumberOfCivsAtLevel[ ELITE_MILITIA ] * 3 + PlayerMercsInSector( ubSectorX, ubSectorY, 0 ) * 4; - usOffensePoints = gArmyComp[ gGarrisonGroup[ iGarrisonID ].ubComposition ].bAdminPercentage * 2 + - gArmyComp[ gGarrisonGroup[ iGarrisonID ].ubComposition ].bTroopPercentage * 3 + + usOffensePoints = gArmyComp[ gGarrisonGroup[ iGarrisonID ].ubComposition ].bAdminPercentage * 2 + + gArmyComp[ gGarrisonGroup[ iGarrisonID ].ubComposition ].bTroopPercentage * 3 + gArmyComp[ gGarrisonGroup[ iGarrisonID ].ubComposition ].bElitePercentage * 4 + - gubGarrisonReinforcementsDenied[ iGarrisonID ]; + gubGarrisonReinforcementsDenied[ iGarrisonID ]; usOffensePoints = usOffensePoints * gArmyComp[ gGarrisonGroup[ iGarrisonID ].ubComposition ].bDesiredPopulation / 100; if( usOffensePoints > *pusDefencePoints ) { return TRUE; } - //Before returning false, determine if reinforcements have been denied repeatedly. If so, then + //Before returning false, determine if reinforcements have been denied repeatedly. If so, then //we might send an augmented force to take it back. if( gubGarrisonReinforcementsDenied[ iGarrisonID ] + usOffensePoints > *pusDefencePoints ) { @@ -1980,7 +1981,7 @@ BOOLEAN ReinforcementsApproved( INT32 iGarrisonID, UINT16 *pusDefencePoints ) #endif return TRUE; } - //Reinforcements will have to wait. For now, increase the reinforcements denied. The amount increase is 20 percent + //Reinforcements will have to wait. For now, increase the reinforcements denied. The amount increase is 20 percent //of the garrison's priority. gubGarrisonReinforcementsDenied[ iGarrisonID ] += (UINT8)(gArmyComp[ gGarrisonGroup[ iGarrisonID ].ubComposition ].bPriority / 2); @@ -1989,7 +1990,7 @@ BOOLEAN ReinforcementsApproved( INT32 iGarrisonID, UINT16 *pusDefencePoints ) //if the group has arrived in a sector, and doesn't have any particular orders, then //send him back where they came from. -//RETURNS TRUE if the group is deleted or told to move somewhere else. +//RETURNS TRUE if the group is deleted or told to move somewhere else. //This is important as the calling function will need //to abort processing of the group for obvious reasons. BOOLEAN EvaluateGroupSituation( GROUP *pGroup ) @@ -2002,21 +2003,21 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic5"); INT32 iMaxEnemyGroupSize = gGameExternalOptions.iMaxEnemyGroupSize; DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic5"); ValidateWeights( 2 ); - + if( !gfQueenAIAwake ) { return FALSE; } Assert( !pGroup->fPlayer ); if( pGroup->pEnemyGroup->ubIntention == PURSUIT ) - { //Lost the player group that he was going to attack. Return to original position. + { //Lost the player group that he was going to attack. Return to original position. ReassignAIGroup( &pGroup ); return TRUE; } else if( pGroup->pEnemyGroup->ubIntention == REINFORCEMENTS ) - { - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ - //The group has arrived at the location where he is supposed to reinforce. + { + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + //The group has arrived at the location where he is supposed to reinforce. //Step 1 -- Check for matching garrison location for( i = 0; i < giGarrisonArraySize; i++ ) { @@ -2033,8 +2034,8 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic5"); pSector->ubNumElites = (UINT8)(pSector->ubNumElites + pGroup->pEnemyGroup->ubNumElites); #ifdef JA2BETAVERSION - LogStrategicEvent( "%d reinforcements have arrived to garrison sector %c%d", - pGroup->pEnemyGroup->ubNumAdmins + pGroup->pEnemyGroup->ubNumTroops + + LogStrategicEvent( "%d reinforcements have arrived to garrison sector %c%d", + pGroup->pEnemyGroup->ubNumAdmins + pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites, pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX ); #endif if( IsThisSectorASAMSector( pGroup->ubSectorX, pGroup->ubSectorY, 0 ) ) @@ -2044,8 +2045,8 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic5"); } } else - { //The group was sent back to the queen's palace (probably because they couldn't be reassigned - //anywhere else, but it is possible that the queen's sector is requesting the reinforcements. In + { //The group was sent back to the queen's palace (probably because they couldn't be reassigned + //anywhere else, but it is possible that the queen's sector is requesting the reinforcements. In //any case, if the queen's sector is less than full strength, fill it up first, then //simply add the rest to the global pool. if( pSector->ubNumElites < iMaxEnemyGroupSize ) @@ -2056,10 +2057,10 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic5"); //Madd: unlimited reinforcements?, if so never increase/decrease it if ( !gfUnlimitedTroops ) giReinforcementPool += iMaxEnemyGroupSize - pSector->ubNumElites; - + pSector->ubNumElites = iMaxEnemyGroupSize; #ifdef JA2BETAVERSION - LogStrategicEvent( "%d reinforcements have arrived to garrison queen's sector. The excess troops will be relocated to the reinforcement pool.", + LogStrategicEvent( "%d reinforcements have arrived to garrison queen's sector. The excess troops will be relocated to the reinforcement pool.", pGroup->ubGroupSize ); #endif } @@ -2067,7 +2068,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic5"); { //Add all the troops to the queen's guard. pSector->ubNumElites += pGroup->ubGroupSize; #ifdef JA2BETAVERSION - LogStrategicEvent( "%d reinforcements have arrived to garrison queen's sector.", + LogStrategicEvent( "%d reinforcements have arrived to garrison queen's sector.", pGroup->ubGroupSize, pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX ); #endif } @@ -2078,7 +2079,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic5"); if ( !gfUnlimitedTroops ) giReinforcementPool += pGroup->ubGroupSize; #ifdef JA2BETAVERSION - LogStrategicEvent( "%d reinforcements have arrived at queen's sector and have been added to the reinforcement pool.", + LogStrategicEvent( "%d reinforcements have arrived at queen's sector and have been added to the reinforcement pool.", pGroup->ubGroupSize, pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX ); #endif } @@ -2106,8 +2107,8 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic5"); pPatrolGroup->pEnemyGroup->ubNumAdmins += pGroup->pEnemyGroup->ubNumAdmins; pPatrolGroup->ubGroupSize += (UINT8)(pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites + pGroup->pEnemyGroup->ubNumAdmins ); #ifdef JA2BETAVERSION - LogStrategicEvent( "%d reinforcements have joined patrol group at sector %c%d (new size: %d)", - pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites + pGroup->pEnemyGroup->ubNumAdmins, + LogStrategicEvent( "%d reinforcements have joined patrol group at sector %c%d (new size: %d)", + pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites + pGroup->pEnemyGroup->ubNumAdmins, pPatrolGroup->ubSectorY + 'A' - 1, pPatrolGroup->ubSectorX, pPatrolGroup->ubGroupSize ); #endif if( pPatrolGroup->ubGroupSize > iMaxEnemyGroupSize ) @@ -2115,11 +2116,11 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic5"); UINT8 ubCut; #ifdef JA2BETAVERSION CHAR16 str[512]; - swprintf( str, L"Patrol group #%d in %c%d received too many reinforcements from group #%d that was created in %c%d. Size truncated from %d to %d." - L"Please send Strategic Decisions.txt and PRIOR save.", - pPatrolGroup->ubGroupID, pPatrolGroup->ubSectorY + 'A' - 1, pPatrolGroup->ubSectorX, - pGroup->ubGroupID, SECTORY( pGroup->ubCreatedSectorID ) + 'A' - 1, SECTORX( pGroup->ubCreatedSectorID ), - pPatrolGroup->ubGroupSize, iMaxEnemyGroupSize ); + swprintf( str, L"Patrol group #%d in %c%d received too many reinforcements from group #%d that was created in %c%d. Size truncated from %d to %d." + L"Please send Strategic Decisions.txt and PRIOR save.", + pPatrolGroup->ubGroupID, pPatrolGroup->ubSectorY + 'A' - 1, pPatrolGroup->ubSectorX, + pGroup->ubGroupID, SECTORY( pGroup->ubCreatedSectorID ) + 'A' - 1, SECTORX( pGroup->ubCreatedSectorID ), + pPatrolGroup->ubGroupSize, iMaxEnemyGroupSize ); SAIReportError( str ); #endif //truncate the group size. @@ -2143,8 +2144,8 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic5"); } } pPatrolGroup->ubGroupSize = iMaxEnemyGroupSize; - Assert( pPatrolGroup->pEnemyGroup->ubNumAdmins + - pPatrolGroup->pEnemyGroup->ubNumTroops + + Assert( pPatrolGroup->pEnemyGroup->ubNumAdmins + + pPatrolGroup->pEnemyGroup->ubNumTroops + pPatrolGroup->pEnemyGroup->ubNumElites == iMaxEnemyGroupSize ); } RemovePGroup( pGroup ); @@ -2157,21 +2158,21 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic5"); pGroup->pEnemyGroup->ubIntention = PATROL; pGroup->ubMoveType = ENDTOEND_FORWARDS; RemovePGroupWaypoints( pGroup ); - AddWaypointIDToPGroup( pGroup, gPatrolGroup[ i ].ubSectorID[ 0 ] ); - AddWaypointIDToPGroup( pGroup, gPatrolGroup[ i ].ubSectorID[ 1 ] ); + AddWaypointIDToPGroup( pGroup, gPatrolGroup[ i ].ubSectorID[ 0 ] ); + AddWaypointIDToPGroup( pGroup, gPatrolGroup[ i ].ubSectorID[ 1 ] ); if( gPatrolGroup[ i ].ubSectorID[ 2 ] ) { //Add optional waypoints if included. - AddWaypointIDToPGroup( pGroup, gPatrolGroup[ i ].ubSectorID[ 2 ] ); + AddWaypointIDToPGroup( pGroup, gPatrolGroup[ i ].ubSectorID[ 2 ] ); if( gPatrolGroup[ i ].ubSectorID[ 3 ] ) - AddWaypointIDToPGroup( pGroup, gPatrolGroup[ i ].ubSectorID[ 3 ] ); + AddWaypointIDToPGroup( pGroup, gPatrolGroup[ i ].ubSectorID[ 3 ] ); } - + //Otherwise, the engine assumes they are being deployed. //pGroup->fWaypointsCancelled = FALSE; #ifdef JA2BETAVERSION - LogStrategicEvent( "%d soldiers have arrived to patrol area near sector %c%d", - pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites + pGroup->pEnemyGroup->ubNumAdmins, + LogStrategicEvent( "%d soldiers have arrived to patrol area near sector %c%d", + pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites + pGroup->pEnemyGroup->ubNumAdmins, pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX ); #endif RecalculatePatrolWeight( i ); @@ -2205,14 +2206,14 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup ) if( !pGroup->fPlayer ) { //Exception case! - //In the beginning of the game, a group is sent to A9 after the first battle. If you leave A9, when they arrive, - //they will stay there indefinately because the AI isn't awake. What we do, is if this is a group in A9, then + //In the beginning of the game, a group is sent to A9 after the first battle. If you leave A9, when they arrive, + //they will stay there indefinately because the AI isn't awake. What we do, is if this is a group in A9, then //send them home. if( GroupAtFinalDestination( pGroup ) ) { //Wake up the queen now, if she hasn't woken up already. WakeUpQueen(); - if( pGroup->ubSectorX == 9 && pGroup->ubSectorY == 1 || + if( pGroup->ubSectorX == 9 && pGroup->ubSectorY == 1 || pGroup->ubSectorX == 3 && pGroup->ubSectorY == 16 ) { SendGroupToPool( &pGroup ); @@ -2223,14 +2224,14 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup ) } } } - + if( !gfQueenAIAwake ) { return FALSE; } } if( !pGroup->fPlayer ) - { //The enemy group has arrived at a new sector and now controls it. + { //The enemy group has arrived at a new sector and now controls it. //Look in each of the four directions, and the alertness rating will //determine the chance to detect any players that may exist in that sector. pEnemyGroup = pGroup; @@ -2246,7 +2247,7 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup ) { return HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup ); } - else if( CountAllMilitiaInSector( pEnemyGroup->ubSectorX, (UINT8)(pEnemyGroup->ubSectorY-1) ) && + else if( CountAllMilitiaInSector( pEnemyGroup->ubSectorX, (UINT8)(pEnemyGroup->ubSectorY-1) ) && AttemptToNoticeAdjacentGroupSucceeds() ) { return HandleMilitiaNoticedByPatrolGroup( (UINT8)SECTOR( pEnemyGroup->ubSectorX, pEnemyGroup->ubSectorY-1 ), pEnemyGroup ); @@ -2263,7 +2264,7 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup ) { return HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup ); } - else if( CountAllMilitiaInSector( (UINT8)(pEnemyGroup->ubSectorX-1), pEnemyGroup->ubSectorY ) && + else if( CountAllMilitiaInSector( (UINT8)(pEnemyGroup->ubSectorX-1), pEnemyGroup->ubSectorY ) && AttemptToNoticeAdjacentGroupSucceeds() ) { return HandleMilitiaNoticedByPatrolGroup( (UINT8)SECTOR( pEnemyGroup->ubSectorX-1, pEnemyGroup->ubSectorY ), pEnemyGroup ); @@ -2280,7 +2281,7 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup ) { return HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup ); } - else if( CountAllMilitiaInSector( pEnemyGroup->ubSectorX, (UINT8)(pEnemyGroup->ubSectorY+1) ) && + else if( CountAllMilitiaInSector( pEnemyGroup->ubSectorX, (UINT8)(pEnemyGroup->ubSectorY+1) ) && AttemptToNoticeAdjacentGroupSucceeds() ) { return HandleMilitiaNoticedByPatrolGroup( (UINT8)SECTOR( pEnemyGroup->ubSectorX, pEnemyGroup->ubSectorY+1 ), pEnemyGroup ); @@ -2297,7 +2298,7 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup ) { return HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup ); } - else if( CountAllMilitiaInSector( (UINT8)(pEnemyGroup->ubSectorX+1), pEnemyGroup->ubSectorY ) && + else if( CountAllMilitiaInSector( (UINT8)(pEnemyGroup->ubSectorX+1), pEnemyGroup->ubSectorY ) && AttemptToNoticeAdjacentGroupSucceeds() ) { return HandleMilitiaNoticedByPatrolGroup( (UINT8)SECTOR( pEnemyGroup->ubSectorX+1, pEnemyGroup->ubSectorY ), pEnemyGroup ); @@ -2312,14 +2313,14 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup ) return TRUE; } } - else - { //The player group has arrived at a new sector and now controls it. + else + { //The player group has arrived at a new sector and now controls it. //Look in each of the four directions, and the enemy alertness rating will //determine if the enemy notices that the player is here. //Additionally, there are also stationary enemy groups that may also notice the //player's new presence. - //NOTE: Always returns false because it is the player group that we are handling. We - // don't mess with the player group here! + //NOTE: Always returns false because it is the player group that we are handling. We + // don't mess with the player group here! pPlayerGroup = pGroup; if( pPlayerGroup->ubSectorZ ) return FALSE; @@ -2403,9 +2404,9 @@ void CheckEnemyControlledSector( UINT8 ubSectorID ) return; } - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ - - //First, determine if the sector is still owned by the enemy. + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + + //First, determine if the sector is still owned by the enemy. pSector = &SectorInfo[ ubSectorID ]; if( pSector->ubGarrisonID != NO_GARRISON ) { @@ -2437,7 +2438,7 @@ void CheckEnemyControlledSector( UINT8 ubSectorID ) } //RequestHighPriorityStagingGroupReinforcements( pGroup ); } - else if( SECTOR( pGroup->ubSectorX, pGroup->ubSectorY ) != gGarrisonGroup[ pSector->ubGarrisonID ].ubSectorID ) + else if( SECTOR( pGroup->ubSectorX, pGroup->ubSectorY ) != gGarrisonGroup[ pSector->ubGarrisonID ].ubSectorID ) { MoveSAIGroupToSector( &pGroup, gGarrisonGroup[ pSector->ubGarrisonID ].ubSectorID, DIRECT, pGroup->pEnemyGroup->ubIntention ); } @@ -2478,7 +2479,7 @@ void CheckEnemyControlledSector( UINT8 ubSectorID ) HandlePlayerGroupNoticedByGarrison( pPlayerGroup, ubSectorID ); return; } - else + else */ if( AdjacentSectorIsImportantAndUndefended( (UINT8)(ubSectorID+1) ) && AttemptToNoticeEmptySectorSucceeds() ) { @@ -2495,7 +2496,7 @@ void CheckEnemyControlledSector( UINT8 ubSectorID ) HandlePlayerGroupNoticedByGarrison( pPlayerGroup, ubSectorID ); return; } - else + else */ if( AdjacentSectorIsImportantAndUndefended( (UINT8)(ubSectorID+16) ) && AttemptToNoticeEmptySectorSucceeds() ) { @@ -2512,7 +2513,7 @@ void CheckEnemyControlledSector( UINT8 ubSectorID ) HandlePlayerGroupNoticedByGarrison( pPlayerGroup, ubSectorID ); return; } - else + else */ if( AdjacentSectorIsImportantAndUndefended( (UINT8)(ubSectorID-1) ) && AttemptToNoticeEmptySectorSucceeds() ) { @@ -2528,14 +2529,14 @@ void RemoveGroupFromStrategicAILists( UINT8 ubGroupID ) { INT32 i; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ for( i = 0; i < giPatrolArraySize; i++ ) { if( gPatrolGroup[ i ].ubGroupID == ubGroupID ) { //Patrol group was destroyed. gPatrolGroup[ i ].ubGroupID = 0; - RecalculatePatrolWeight( i ); + RecalculatePatrolWeight( i ); return; } if( gPatrolGroup[ i ].ubPendingGroupID == ubGroupID ) @@ -2577,7 +2578,7 @@ void RecalculatePatrolWeight( INT32 iPatrolID ) ValidateWeights( 27 ); return; } - } + } else { iNeedPopulation = gPatrolGroup[ iPatrolID ].bSize; @@ -2596,7 +2597,7 @@ void RecalculateGarrisonWeight( INT32 iGarrisonID ) INT32 iWeight, iPrevWeight; INT32 iDesiredPop, iCurrentPop, iPriority; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ ValidateWeights( 6 ); pSector = &SectorInfo[ gGarrisonGroup[ iGarrisonID ].ubSectorID ]; @@ -2613,7 +2614,7 @@ void RecalculateGarrisonWeight( INT32 iGarrisonID ) //Calculate weight (range is -20 to +20 before multiplier). //The multiplier of 3 brings it to a range of -96 to +96 which is - //close enough to a plus/minus 100%. The resultant percentage is then + //close enough to a plus/minus 100%. The resultant percentage is then //converted based on the priority. iWeight = (iDesiredPop - iCurrentPop) * 3; if( iWeight > 0 ) @@ -2623,8 +2624,8 @@ void RecalculateGarrisonWeight( INT32 iGarrisonID ) iWeight = max( iWeight, 2 ); giRequestPoints += iWeight; } - else if( iWeight < 0 ) - { //modify it by it's reverse priority + else if( iWeight < 0 ) + { //modify it by it's reverse priority //generates a value between -2 and -100 iWeight = iWeight * (100-iPriority) / 96; iWeight = min( iWeight, -2 ); @@ -2640,7 +2641,7 @@ void RecalculateSectorWeight( UINT8 ubSectorID ) { INT32 i; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ for( i = 0; i < giGarrisonArraySize; i++ ) { if( gGarrisonGroup[ i ].ubSectorID == ubSectorID ) @@ -2678,15 +2679,15 @@ INT32 ChooseSuitableGarrisonToProvideReinforcements( INT32 iDstGarrisonID, INT32 INT8 bBestWeight; UINT8 ubSectorID; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ - //Check to see if we could send reinforcements from Alma. Only Drassen/Cambria get preferred + //Check to see if we could send reinforcements from Alma. Only Drassen/Cambria get preferred //service from Alma, due to it's proximity and Alma's purpose as a forward military base. ubSectorID = gGarrisonGroup[ iDstGarrisonID ].ubSectorID; switch( ubSectorID ) { case SEC_B13: case SEC_C13: case SEC_D13: case SEC_D15: //Drassen + nearby SAM site - case SEC_F8: case SEC_F9: case SEC_G8: case SEC_G9: case SEC_H8: //Cambria + case SEC_F8: case SEC_F9: case SEC_G8: case SEC_G9: case SEC_H8: //Cambria //reinforcements will be primarily sent from Alma whenever possible. //find which the first sector that contains Alma soldiers. @@ -2696,7 +2697,7 @@ INT32 ChooseSuitableGarrisonToProvideReinforcements( INT32 iDstGarrisonID, INT32 break; } iSrcGarrisonID = i; - //which of these 4 Alma garrisons have the most reinforcements available? It is + //which of these 4 Alma garrisons have the most reinforcements available? It is //possible that none of these garrisons can provide any reinforcements. bBestWeight = 0; for( i = iSrcGarrisonID; i < iSrcGarrisonID + 4; i++ ) @@ -2721,7 +2722,7 @@ INT32 ChooseSuitableGarrisonToProvideReinforcements( INT32 iDstGarrisonID, INT32 break; } - //The Alma case either wasn't applicable or failed to have the right reinforcements. Do a general weighted search. + //The Alma case either wasn't applicable or failed to have the right reinforcements. Do a general weighted search. iRandom = Random( giReinforcementPoints ); for( iSrcGarrisonID = 0; iSrcGarrisonID < giGarrisonArraySize; iSrcGarrisonID++ ) { //go through the garrisons @@ -2741,7 +2742,7 @@ INT32 ChooseSuitableGarrisonToProvideReinforcements( INT32 iDstGarrisonID, INT32 } } - //So far we have failed on all accounts. Now, simply process all the garrisons, and return the first garrison that can + //So far we have failed on all accounts. Now, simply process all the garrisons, and return the first garrison that can //provide the reinforcements. for( iSrcGarrisonID = 0; iSrcGarrisonID < giGarrisonArraySize; iSrcGarrisonID++ ) { //go through the garrisons @@ -2757,7 +2758,7 @@ INT32 ChooseSuitableGarrisonToProvideReinforcements( INT32 iDstGarrisonID, INT32 } } - //Well, if we get this far, the queen must be low on troops. Send whatever we can. + //Well, if we get this far, the queen must be low on troops. Send whatever we can. iRandom = Random( giReinforcementPoints ); for( iSrcGarrisonID = 0; iSrcGarrisonID < giGarrisonArraySize; iSrcGarrisonID++ ) { //go through the garrisons @@ -2789,12 +2790,12 @@ void SendReinforcementsForGarrison( INT32 iDstGarrisonID, UINT16 usDefencePoints UINT8 ubGroupSize; BOOLEAN fLimitMaxTroopsAllowable = FALSE; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ ValidateWeights( 8 ); if( gGarrisonGroup[ iDstGarrisonID ].ubSectorID == SEC_B13 || - gGarrisonGroup[ iDstGarrisonID ].ubSectorID == SEC_C13 || - gGarrisonGroup[ iDstGarrisonID ].ubSectorID == SEC_D13 ) + gGarrisonGroup[ iDstGarrisonID ].ubSectorID == SEC_C13 || + gGarrisonGroup[ iDstGarrisonID ].ubSectorID == SEC_D13 ) { pSector = NULL; } @@ -2802,11 +2803,11 @@ void SendReinforcementsForGarrison( INT32 iDstGarrisonID, UINT16 usDefencePoints //Determine how many units the garrison needs. iReinforcementsRequested = GarrisonReinforcementsRequested( iDstGarrisonID, &ubNumExtraReinforcements ); - //The maximum number of reinforcements can't be offsetted past a certain point based on the + //The maximum number of reinforcements can't be offsetted past a certain point based on the //priority of the garrison. iMaxReinforcementsAllowed = //from 1 to 3 times the desired size of the normal force. - gArmyComp[ gGarrisonGroup[ iDstGarrisonID ].ubComposition ].bDesiredPopulation + - gArmyComp[ gGarrisonGroup[ iDstGarrisonID ].ubComposition ].bDesiredPopulation * + gArmyComp[ gGarrisonGroup[ iDstGarrisonID ].ubComposition ].bDesiredPopulation + + gArmyComp[ gGarrisonGroup[ iDstGarrisonID ].ubComposition ].bDesiredPopulation * gArmyComp[ gGarrisonGroup[ iDstGarrisonID ].ubComposition ].bPriority / 50; if( iReinforcementsRequested + ubNumExtraReinforcements > iMaxReinforcementsAllowed ) @@ -2831,9 +2832,9 @@ void SendReinforcementsForGarrison( INT32 iDstGarrisonID, UINT16 usDefencePoints pGroup = *pOptionalGroup; #ifdef JA2BETAVERSION - LogStrategicEvent( "%d troops have been reassigned from %c%d to garrison sector %c%d", - pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites + pGroup->pEnemyGroup->ubNumAdmins, - pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX, + LogStrategicEvent( "%d troops have been reassigned from %c%d to garrison sector %c%d", + pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites + pGroup->pEnemyGroup->ubNumAdmins, + pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX, ubDstSectorY + 'A' - 1, ubDstSectorX ); #endif @@ -2873,15 +2874,15 @@ void SendReinforcementsForGarrison( INT32 iDstGarrisonID, UINT16 usDefencePoints return; } else - { + { //The force is strong enough to be able to take the sector. gubGarrisonReinforcementsDenied[ iDstGarrisonID ] = 0; } - + //The chance she will send them is related with the strength difference between the //player's force and the queen's. if( ubNumExtraReinforcements && fLimitMaxTroopsAllowable && iReinforcementsApproved == iMaxReinforcementsAllowed ) - { + { iChance = (iReinforcementsApproved + ubNumExtraReinforcements) * 100 / max(usDefencePoints, 1); // lal bugfix: max 1 added to prevent division by 0 if( !Chance( iChance ) ) { @@ -2897,25 +2898,25 @@ void SendReinforcementsForGarrison( INT32 iDstGarrisonID, UINT16 usDefencePoints //Madd: unlimited reinforcements? if ( !gfUnlimitedTroops ) giReinforcementPool -= iReinforcementsApproved; - + pGroup->ubMoveType = ONE_WAY; gGarrisonGroup[ iDstGarrisonID ].ubPendingGroupID = pGroup->ubGroupID; ubGroupSize = (UINT8)(pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites + pGroup->pEnemyGroup->ubNumAdmins); - + if( ubNumExtraReinforcements ) { #ifdef JA2BETAVERSION - LogStrategicEvent( "%d troops have been sent from palace to stage assault near sector %c%d", + LogStrategicEvent( "%d troops have been sent from palace to stage assault near sector %c%d", ubGroupSize, ubDstSectorY + 'A' - 1, ubDstSectorX ); #endif - + MoveSAIGroupToSector( &pGroup, gGarrisonGroup[ iDstGarrisonID ].ubSectorID, STAGE, STAGING ); } else { #ifdef JA2BETAVERSION - LogStrategicEvent( "%d troops have been sent from palace to garrison sector %c%d", + LogStrategicEvent( "%d troops have been sent from palace to garrison sector %c%d", ubGroupSize, ubDstSectorY + 'A' - 1, ubDstSectorX ); #endif @@ -2924,7 +2925,7 @@ void SendReinforcementsForGarrison( INT32 iDstGarrisonID, UINT16 usDefencePoints ValidateWeights( 14 ); return; } - else + else { iSrcGarrisonID = ChooseSuitableGarrisonToProvideReinforcements( iDstGarrisonID, iReinforcementsRequested ); if( iSrcGarrisonID == -1 ) @@ -2943,7 +2944,7 @@ void SendReinforcementsForGarrison( INT32 iDstGarrisonID, UINT16 usDefencePoints SAIReportError( L"Attempting to send reinforcements from a garrison that doesn't have any! -- KM:0 (with prior saved game and strategic decisions.txt)" ); return; } - //Send the lowest of the two: number requested or number available + //Send the lowest of the two: number requested or number available iReinforcementsApproved = min( iReinforcementsRequested, iReinforcementsAvailable ); if( iReinforcementsApproved > iMaxReinforcementsAllowed - ubNumExtraReinforcements ) @@ -2957,7 +2958,7 @@ void SendReinforcementsForGarrison( INT32 iDstGarrisonID, UINT16 usDefencePoints return; } else - { + { //The force is strong enough to be able to take the sector. gubGarrisonReinforcementsDenied[ iDstGarrisonID ] = 0; } @@ -2965,7 +2966,7 @@ void SendReinforcementsForGarrison( INT32 iDstGarrisonID, UINT16 usDefencePoints //The chance she will send them is related with the strength difference between the //player's force and the queen's. if( iReinforcementsApproved + ubNumExtraReinforcements == iMaxReinforcementsAllowed && usDefencePoints ) - { + { iChance = (iReinforcementsApproved + ubNumExtraReinforcements) * 100 / max(usDefencePoints, 1); // lal bugfix: max 1 added to prevent division by 0 if( !Chance( iChance ) ) { @@ -2985,9 +2986,9 @@ void SendReinforcementsForGarrison( INT32 iDstGarrisonID, UINT16 usDefencePoints if( ubNumExtraReinforcements ) { pGroup->pEnemyGroup->ubPendingReinforcements = ubNumExtraReinforcements; - + #ifdef JA2BETAVERSION - LogStrategicEvent( "%d troops have been sent from sector %c%d to stage assault near sector %c%d", + LogStrategicEvent( "%d troops have been sent from sector %c%d to stage assault near sector %c%d", ubGroupSize, pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX, ubDstSectorY + 'A' - 1, ubDstSectorX ); #endif @@ -2996,18 +2997,18 @@ void SendReinforcementsForGarrison( INT32 iDstGarrisonID, UINT16 usDefencePoints else { #ifdef JA2BETAVERSION - LogStrategicEvent( "%d troops have been sent from sector %c%d to garrison sector %c%d", + LogStrategicEvent( "%d troops have been sent from sector %c%d to garrison sector %c%d", ubGroupSize, pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX, ubDstSectorY + 'A' - 1, ubDstSectorX ); #endif MoveSAIGroupToSector( &pGroup, gGarrisonGroup[ iDstGarrisonID ].ubSectorID, STAGE, REINFORCEMENTS ); } - + #ifdef JA2BETAVERSION - LogStrategicEvent( "%d troops have been sent from garrison sector %c%d to patrol area near sector %c%d", + LogStrategicEvent( "%d troops have been sent from garrison sector %c%d to patrol area near sector %c%d", ubGroupSize, ubSrcSectorY + 'A' - 1, ubSrcSectorX, ubDstSectorY + 'A' - 1, ubDstSectorX ); #endif - + ValidateWeights( 19 ); return; } @@ -3022,7 +3023,7 @@ void SendReinforcementsForPatrol( INT32 iPatrolID, GROUP **pOptionalGroup ) INT32 iReinforcementsAvailable, iReinforcementsRequested, iReinforcementsApproved; UINT8 ubSrcSectorX, ubSrcSectorY, ubDstSectorX, ubDstSectorY; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ ValidateWeights( 21 ); //Determine how many units the patrol group needs. @@ -3030,7 +3031,7 @@ void SendReinforcementsForPatrol( INT32 iPatrolID, GROUP **pOptionalGroup ) if( iReinforcementsRequested <= 0) return; - + ubDstSectorX = (gPatrolGroup[ iPatrolID ].ubSectorID[1] % 16) + 1; ubDstSectorY = (gPatrolGroup[ iPatrolID ].ubSectorID[1] / 16) + 1; @@ -3041,12 +3042,12 @@ void SendReinforcementsForPatrol( INT32 iPatrolID, GROUP **pOptionalGroup ) gPatrolGroup[ iPatrolID ].ubPendingGroupID = pGroup->ubGroupID; #ifdef JA2BETAVERSION - LogStrategicEvent( "%d troops have been reassigned from %c%d to reinforce patrol group covering sector %c%d", - pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites + pGroup->pEnemyGroup->ubNumAdmins, - pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX, + LogStrategicEvent( "%d troops have been reassigned from %c%d to reinforce patrol group covering sector %c%d", + pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites + pGroup->pEnemyGroup->ubNumAdmins, + pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX, ubDstSectorY + 'A' - 1, ubDstSectorX ); #endif - + MoveSAIGroupToSector( pOptionalGroup, gPatrolGroup[ iPatrolID ].ubSectorID[1], EVASIVE, REINFORCEMENTS ); ValidateWeights( 22 ); @@ -3070,17 +3071,17 @@ void SendReinforcementsForPatrol( INT32 iPatrolID, GROUP **pOptionalGroup ) gPatrolGroup[ iPatrolID ].ubPendingGroupID = pGroup->ubGroupID; #ifdef JA2BETAVERSION - LogStrategicEvent( "%d troops have been sent from palace to patrol area near sector %c%d", - pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites + pGroup->pEnemyGroup->ubNumAdmins, + LogStrategicEvent( "%d troops have been sent from palace to patrol area near sector %c%d", + pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites + pGroup->pEnemyGroup->ubNumAdmins, ubDstSectorY + 'A' - 1, ubDstSectorX ); #endif - + MoveSAIGroupToSector( &pGroup, gPatrolGroup[ iPatrolID ].ubSectorID[1], EVASIVE, REINFORCEMENTS ); ValidateWeights( 23 ); return; } - else + else { iRandom -= giReinforcementPool; for( iSrcGarrisonID = 0; iSrcGarrisonID < giGarrisonArraySize; iSrcGarrisonID++ ) @@ -3096,7 +3097,7 @@ void SendReinforcementsForPatrol( INT32 iPatrolID, GROUP **pOptionalGroup ) if( ubSrcSectorX != gWorldSectorX || ubSrcSectorY != gWorldSectorY || gbWorldSectorZ > 0 ) { //The reinforcements aren't coming from the currently loaded sector! iReinforcementsAvailable = ReinforcementsAvailable( iSrcGarrisonID ); - //Send the lowest of the two: number requested or number available + //Send the lowest of the two: number requested or number available iReinforcementsApproved = min( iReinforcementsRequested, iReinforcementsAvailable ); pGroup = CreateNewEnemyGroupDepartingFromSector( gGarrisonGroup[ iSrcGarrisonID ].ubSectorID, 0, (UINT8)iReinforcementsApproved, 0 ); pGroup->ubOriginalSector = (UINT8)SECTOR( ubDstSectorX, ubDstSectorY ); @@ -3105,14 +3106,14 @@ void SendReinforcementsForPatrol( INT32 iPatrolID, GROUP **pOptionalGroup ) RemoveSoldiersFromGarrisonBasedOnComposition( iSrcGarrisonID, pGroup->ubGroupSize ); #ifdef JA2BETAVERSION - LogStrategicEvent( "%d troops have been sent from garrison sector %c%d to patrol area near sector %c%d", - pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites + pGroup->pEnemyGroup->ubNumAdmins, - ubSrcSectorY + 'A' - 1, ubSrcSectorX, + LogStrategicEvent( "%d troops have been sent from garrison sector %c%d to patrol area near sector %c%d", + pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites + pGroup->pEnemyGroup->ubNumAdmins, + ubSrcSectorY + 'A' - 1, ubSrcSectorX, ubDstSectorY + 'A' - 1, ubDstSectorX ); #endif MoveSAIGroupToSector( &pGroup, gPatrolGroup[ iPatrolID ].ubSectorID[1], EVASIVE, REINFORCEMENTS ); - + ValidateWeights( 24 ); return; @@ -3161,9 +3162,9 @@ void EvaluateQueenSituation() } if( !giReinforcementPool ) - { //Queen has run out of reinforcements. Simulate recruiting and training new troops + { //Queen has run out of reinforcements. Simulate recruiting and training new troops uiOffset *= 10; - //Madd: don't need an unlimited troops check here, since they can never run out like this + //Madd: don't need an unlimited troops check here, since they can never run out like this giReinforcementPool += ( gGameExternalOptions.guiBaseQueenPoolIncrement * gGameOptions.ubDifficultyLevel ) * ( 100 + CurrentPlayerProgressPercentage() ) / 100 ; AddStrategicEvent( EVENT_EVALUATE_QUEEN_SITUATION, GetWorldTotalMin() + uiOffset, 0 ); return; @@ -3181,7 +3182,7 @@ void EvaluateQueenSituation() // Adjust queen's disposition based on player's progress EvolveQueenPriorityPhase( FALSE ); - // Gradually promote any remaining admins into troops + // Gradually promote any remaining admins into troops UpgradeAdminsToTroops(); if( ( giRequestPoints <= 0 ) || ( ( giReinforcementPoints <= 0 ) && ( giReinforcementPool <= 0 ) ) ) @@ -3195,7 +3196,7 @@ void EvaluateQueenSituation() iOrigRequestPoints = giRequestPoints; // debug only! - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ //go through garrisons first for( i = 0; i < giGarrisonArraySize; i++ ) @@ -3207,7 +3208,7 @@ void EvaluateQueenSituation() iSumOfAllWeights += iWeight; // debug only! - if( iRandom < iWeight && !gGarrisonGroup[ i ].ubPendingGroupID && + if( iRandom < iWeight && !gGarrisonGroup[ i ].ubPendingGroupID && EnemyPermittedToAttackSector( NULL, gGarrisonGroup[ i ].ubSectorID ) && GarrisonRequestingMinimumReinforcements( i ) ) { //This is the group that gets the reinforcements! @@ -3237,7 +3238,7 @@ void EvaluateQueenSituation() { iSumOfAllWeights += iWeight; // debug only! - if( iRandom < iWeight && !gPatrolGroup[ i ].ubPendingGroupID && PatrolRequestingMinimumReinforcements( i ) ) + if( iRandom < iWeight && !gPatrolGroup[ i ].ubPendingGroupID && PatrolRequestingMinimumReinforcements( i ) ) { //This is the group that gets the reinforcements! SendReinforcementsForPatrol( i, NULL ); return; @@ -3347,26 +3348,26 @@ BOOLEAN SaveStrategicAI( HWFILE hFile ) return FALSE; } //Save the garrison information! - /* Step 1: fill an EMPTY GARRISON for later padding */ + /* Step 1: fill an EMPTY GARRISON for later padding */ memset( &gTempGarrisonGroup, 0, sizeof( GARRISON_GROUP ) ); - if( giGarrisonArraySize > SAVED_GARRISON_GROUPS ) - { - giGarrisonArraySize = SAVED_GARRISON_GROUPS; - } + if( giGarrisonArraySize > SAVED_GARRISON_GROUPS ) + { + giGarrisonArraySize = SAVED_GARRISON_GROUPS; + } - /* Step 2: write current Garrison Block of Elements */ - FileWrite( hFile, gGarrisonGroup, giGarrisonArraySize * sizeof( GARRISON_GROUP ), &uiNumBytesWritten ); + /* Step 2: write current Garrison Block of Elements */ + FileWrite( hFile, gGarrisonGroup, giGarrisonArraySize * sizeof( GARRISON_GROUP ), &uiNumBytesWritten ); if( uiNumBytesWritten != giGarrisonArraySize * sizeof( GARRISON_GROUP ) ) return FALSE; - /* Step 3: after doing well, calculate how many Garrisons kept empty (and therefore are not saved) - * in it is defined as MAX_GARRISON_GROUPS 100. To have the same offset for the next field - * every time, we have to pad the unused garrisons until we have stored 100 - */ + /* Step 3: after doing well, calculate how many Garrisons kept empty (and therefore are not saved) + * in it is defined as MAX_GARRISON_GROUPS 100. To have the same offset for the next field + * every time, we have to pad the unused garrisons until we have stored 100 + */ i = SAVED_GARRISON_GROUPS - giGarrisonArraySize; while( i-- > 0 ) { - /* write an empty garison as a padding filling block */ + /* write an empty garison as a padding filling block */ FileWrite( hFile, &gTempGarrisonGroup, sizeof( GARRISON_GROUP ), &uiNumBytesWritten ); if( uiNumBytesWritten != sizeof( GARRISON_GROUP ) ) return FALSE; @@ -3374,20 +3375,20 @@ BOOLEAN SaveStrategicAI( HWFILE hFile ) FileWrite( hFile, gubPatrolReinforcementsDenied, giPatrolArraySize, &uiNumBytesWritten ); if( uiNumBytesWritten != (UINT32)giPatrolArraySize ) - { + { return FALSE; - } + } FileWrite( hFile, gubGarrisonReinforcementsDenied, giGarrisonArraySize, &uiNumBytesWritten ); if( uiNumBytesWritten != (UINT32)giGarrisonArraySize ) - { + { return FALSE; - } - + } + #ifdef JA2BETAVERSION ValidatePlayersAreInOneGroupOnly(); #endif - + return TRUE; } @@ -3487,7 +3488,7 @@ BOOLEAN LoadStrategicAI( HWFILE hFile ) if( uiNumBytesRead != SAI_PADDING_BYTES ) return FALSE; - //Restore the army composition + //Restore the army composition FileRead( hFile, gArmyComp, NUM_ARMY_COMPOSITIONS * sizeof( ARMY_COMPOSITION ), &uiNumBytesRead ); if( uiNumBytesRead != NUM_ARMY_COMPOSITIONS * sizeof( ARMY_COMPOSITION ) ) return FALSE; @@ -3523,28 +3524,28 @@ BOOLEAN LoadStrategicAI( HWFILE hFile ) MemFree( gGarrisonGroup ); } - /* giGarrisonArraySize has been zero here. Found it several times when loading - * a differnet build of JA2.1.13. Now fixed a little bit, I hope. - */ - if( giGarrisonArraySize SAVED_GARRISON_GROUPS ) - { - giGarrisonArraySize = SAVED_GARRISON_GROUPS; - } + /* giGarrisonArraySize has been zero here. Found it several times when loading + * a differnet build of JA2.1.13. Now fixed a little bit, I hope. + */ + if( giGarrisonArraySize SAVED_GARRISON_GROUPS ) + { + giGarrisonArraySize = SAVED_GARRISON_GROUPS; + } - gGarrisonGroup = (GARRISON_GROUP*)MemAlloc( giGarrisonArraySize * sizeof( GARRISON_GROUP ) ); - Assert( gGarrisonGroup ); + gGarrisonGroup = (GARRISON_GROUP*)MemAlloc( giGarrisonArraySize * sizeof( GARRISON_GROUP ) ); + Assert( gGarrisonGroup ); FileRead( hFile, gGarrisonGroup, giGarrisonArraySize * sizeof( GARRISON_GROUP ), &uiNumBytesRead ); if( uiNumBytesRead != giGarrisonArraySize * sizeof( GARRISON_GROUP ) ) { return FALSE; } - /* if the Savegame File contains more Garrisons then our Array, toss the remaining ones into the saucer */ - i = SAVED_GARRISON_GROUPS - giGarrisonArraySize; - while( i-- > 0 ) /* prevent underrun, 2007-03-03, Sgt. Kolja */ + /* if the Savegame File contains more Garrisons then our Array, toss the remaining ones into the saucer */ + i = SAVED_GARRISON_GROUPS - giGarrisonArraySize; + while( i-- > 0 ) /* prevent underrun, 2007-03-03, Sgt. Kolja */ { FileRead( hFile, &gTempGarrisonGroup, sizeof( GARRISON_GROUP ), &uiNumBytesRead ); if( uiNumBytesRead != sizeof( GARRISON_GROUP ) ) @@ -3552,7 +3553,7 @@ BOOLEAN LoadStrategicAI( HWFILE hFile ) return FALSE; } } - + //Load the list of reinforcement patrol points. if( gubPatrolReinforcementsDenied ) { @@ -3562,9 +3563,9 @@ BOOLEAN LoadStrategicAI( HWFILE hFile ) gubPatrolReinforcementsDenied = (UINT8*)MemAlloc( giPatrolArraySize ); FileRead( hFile, gubPatrolReinforcementsDenied, giPatrolArraySize, &uiNumBytesRead ); if( uiNumBytesRead != (UINT32)giPatrolArraySize ) - { + { return FALSE; - } + } //Load the list of reinforcement garrison points. if( gubGarrisonReinforcementsDenied ) @@ -3575,7 +3576,7 @@ BOOLEAN LoadStrategicAI( HWFILE hFile ) gubGarrisonReinforcementsDenied = (UINT8*)MemAlloc( giGarrisonArraySize ); FileRead( hFile, gubGarrisonReinforcementsDenied, giGarrisonArraySize, &uiNumBytesRead ); if( uiNumBytesRead != (UINT32)giGarrisonArraySize ) - { + { return FALSE; } @@ -3583,7 +3584,7 @@ BOOLEAN LoadStrategicAI( HWFILE hFile ) InitStrategicMovementCosts(); #endif - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ if( ubSAIVersion < 6 ) { //Reinitialize the costs since they have changed. @@ -3591,7 +3592,7 @@ BOOLEAN LoadStrategicAI( HWFILE hFile ) //Recreate the compositions memcpy( gArmyComp, gOrigArmyComp, MAX_ARMY_COMPOSITIONS * sizeof( ARMY_COMPOSITION ) ); EvolveQueenPriorityPhase( TRUE ); - + //Recreate the patrol desired sizes for( i = 0; i < giPatrolArraySize; i++ ) { @@ -3684,7 +3685,7 @@ BOOLEAN LoadStrategicAI( HWFILE hFile ) if( ubSAIVersion < 17 ) { //Patch all groups that have this flag set gubNumGroupsArrivedSimultaneously = 0; - { + { pGroup = gpGroupList; while( pGroup ) { @@ -3692,7 +3693,7 @@ BOOLEAN LoadStrategicAI( HWFILE hFile ) { pGroup->uiFlags &= ~GROUPFLAG_GROUP_ARRIVED_SIMULTANEOUSLY; } - pGroup = pGroup->next; + pGroup = pGroup->next; } } } @@ -3811,21 +3812,21 @@ BOOLEAN LoadStrategicAI( HWFILE hFile ) INT32 i; for( i = 0; i < 255; i++ ) { - if( SectorInfo[ i ].ubNumberOfCivsAtLevel[ GREEN_MILITIA ] + - SectorInfo[ i ].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] + + if( SectorInfo[ i ].ubNumberOfCivsAtLevel[ GREEN_MILITIA ] + + SectorInfo[ i ].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] + SectorInfo[ i ].ubNumberOfCivsAtLevel[ ELITE_MILITIA ] > 20 ) { SectorInfo[ i ].ubNumberOfCivsAtLevel[ GREEN_MILITIA ] = 0; - SectorInfo[ i ].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] = 20; + SectorInfo[ i ].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] = 20; SectorInfo[ i ].ubNumberOfCivsAtLevel[ ELITE_MILITIA ] = 0; } } } - + //KM : August 4, 1999 patch fix - // This addresses the problem of not having any soldiers in sector N7 when playing the game under easy difficulty. - // If captured and interrogated, the player would find no soldiers defending the sector. This changes the composition - // so that it will always be there, and adds the soldiers accordingly if the sector isn't loaded when the update is made. + // This addresses the problem of not having any soldiers in sector N7 when playing the game under easy difficulty. + // If captured and interrogated, the player would find no soldiers defending the sector. This changes the composition + // so that it will always be there, and adds the soldiers accordingly if the sector isn't loaded when the update is made. if( ubSAIVersion < 27 ) { if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY ) @@ -3840,7 +3841,7 @@ BOOLEAN LoadStrategicAI( HWFILE hFile ) //Change the garrison composition to LEVEL1_DEFENCE from LEVEL2_DEFENCE pSector = &SectorInfo[ SEC_N7 ]; gGarrisonGroup[ pSector->ubGarrisonID ].ubComposition = LEVEL1_DEFENCE; - + iStartPop = gArmyComp[ gGarrisonGroup[ pSector->ubGarrisonID ].ubComposition ].bStartPopulation; iDesiredPop = gArmyComp[ gGarrisonGroup[ pSector->ubGarrisonID ].ubComposition ].bDesiredPopulation; iPriority = gArmyComp[ gGarrisonGroup[ pSector->ubGarrisonID ].ubComposition ].bPriority; @@ -3910,9 +3911,9 @@ BOOLEAN LoadStrategicAI( HWFILE hFile ) InitStrategicMovementCosts(); } - //KM : Aug 11, 1999 -- Patch fix: Blindly update the airspace control. There is a bug somewhere - // that is failing to keep this information up to date, and I failed to find it. At least this - // will patch saves. + //KM : Aug 11, 1999 -- Patch fix: Blindly update the airspace control. There is a bug somewhere + // that is failing to keep this information up to date, and I failed to find it. At least this + // will patch saves. UpdateAirspaceControl( ); EvolveQueenPriorityPhase( TRUE ); @@ -3948,7 +3949,7 @@ BOOLEAN LoadStrategicAI( HWFILE hFile ) //Update the version number to the most current. gubSAIVersion = SAI_VERSION; - + ValidateWeights( 28 ); ValidatePendingGroups(); #ifdef JA2BETAVERSION @@ -3975,7 +3976,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic7"); return; } - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ if( gubQueenPriorityPhase > ubNewPhase ) { @@ -3988,20 +3989,20 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic7"); #ifdef JA2BETAVERSION LogStrategicEvent( "The queen's defence priority has increased from %d0%% to %d0%%.", gubQueenPriorityPhase, ubNewPhase ); #endif - } - else - { + } + else + { #ifdef JA2BETAVERSION LogStrategicEvent( "The queen's defence priority is the same (%d0%%), but has been forced to update.", gubQueenPriorityPhase ); #endif - } + } gubQueenPriorityPhase = ubNewPhase; - //The phase value refers to the deviation percentage she will apply to original garrison values. - //All sector values are evaluated to see how many of those sectors are enemy controlled. If they - //are controlled by her, the desired number will be increased as well as the priority. On the other - //hand, if she doesn't own those sectors, the values will be decreased instead. All values are based off of + //The phase value refers to the deviation percentage she will apply to original garrison values. + //All sector values are evaluated to see how many of those sectors are enemy controlled. If they + //are controlled by her, the desired number will be increased as well as the priority. On the other + //hand, if she doesn't own those sectors, the values will be decreased instead. All values are based off of //the originals. memset( ubOwned, 0, MAX_ARMY_COMPOSITIONS ); memset( ubTotal, 0, MAX_ARMY_COMPOSITIONS ); @@ -4034,8 +4035,8 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic7"); //don't consider these compositions continue; } - //If the queen owns them ALL, then she gets the maximum defensive bonus. If she owns NONE, - //then she gets a maximum defensive penalty. Everything else lies in the middle. The legal + //If the queen owns them ALL, then she gets the maximum defensive bonus. If she owns NONE, + //then she gets a maximum defensive penalty. Everything else lies in the middle. The legal //range is +-50. if( ubTotal[ i ] ) { @@ -4047,14 +4048,14 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic7"); } if ( gfAggressiveQueen ) - iFactor = abs(iFactor); // Madd: The Queen never gets a defensive penalty. The range for iFactor becomes 0-50. This should increase the priorities for sectors outside Meduna as the queen loses sectors and keep up the attacks. This is only going to work well if the reinforcement pool is unlimited, as sectors priorities won't ever go down really low. + iFactor = abs(iFactor); // Madd: The Queen never gets a defensive penalty. The range for iFactor becomes 0-50. This should increase the priorities for sectors outside Meduna as the queen loses sectors and keep up the attacks. This is only going to work well if the reinforcement pool is unlimited, as sectors priorities won't ever go down really low. iFactor = iFactor * gubQueenPriorityPhase / 10; //modify priority by + or - 25% of original if( gArmyComp[ i ].bPriority ) { - num = gOrigArmyComp[ i ].bPriority + iFactor / 2; + num = gOrigArmyComp[ i ].bPriority + iFactor / 2; num = min( max( 0, num ), 100 ); gArmyComp[ i ].bPriority = (INT8)num; } @@ -4087,7 +4088,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic7"); for( i = 0; i < giGarrisonArraySize; i++ ) { - //if we are dealing with extra elites, then augment elite compositions (but only if they exist in the sector). + //if we are dealing with extra elites, then augment elite compositions (but only if they exist in the sector). //If the queen still owns the town by more than 65% (iFactor >= 15), then upgrade troops to elites in those sectors. index = gGarrisonGroup[ i ].ubComposition; switch( index ) @@ -4115,7 +4116,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic7"); } if( iFactor >= 15 ) { //Make the actual elites in sector match the new garrison percentage - if( !gfWorldLoaded || gbWorldSectorZ || + if( !gfWorldLoaded || gbWorldSectorZ || gWorldSectorX != SECTORX( gGarrisonGroup[ i ].ubSectorID ) || gWorldSectorY != SECTORY( gGarrisonGroup[ i ].ubSectorID ) ) { //Also make sure the sector isn't currently loaded! @@ -4127,9 +4128,9 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic7"); while( iNumPromotions-- ) { if( pSector->ubNumAdmins ) - { + { pSector->ubNumAdmins--; - } + } else if( pSector->ubNumTroops ) { pSector->ubNumTroops--; @@ -4175,7 +4176,7 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto case STRATEGIC_AI_ACTION_KINGPIN_DEAD: //Immediate send a small garrison to C5 (to discourage access to Tony the dealer) /* - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); * added NULL fix, 2007-03-03, Sgt. Kolja * + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); * added NULL fix, 2007-03-03, Sgt. Kolja * for( i = 0; i < giGarrisonArraySize; i++ ) { @@ -4194,7 +4195,7 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto break; case NPC_ACTION_SEND_SOLDIERS_TO_DRASSEN: - //Send 6, 9, or 12 troops (based on difficulty) one of the Drassen sectors. If nobody is there when they arrive, + //Send 6, 9, or 12 troops (based on difficulty) one of the Drassen sectors. If nobody is there when they arrive, //those troops will get reassigned. //if( Chance( 50 ) ) @@ -4225,7 +4226,7 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto //Madd: unlimited reinforcements? //if ( !gfUnlimitedTroops ) // giReinforcementPool -= ubNumSoldiers; - + //giReinforcementPool = max( giReinforcementPool, 0 ); //MoveSAIGroupToSector( &pGroup, ubSectorID, EVASIVE, pGroup->pEnemyGroup->ubIntention ); @@ -4240,9 +4241,9 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto { ubSourceSectorID = SEC_P3; } - + ubNumSoldiers = (UINT8)( gubMinEnemyGroupSize + gGameOptions.ubDifficultyLevel * 3); - + pGroup0 = CreateNewEnemyGroupDepartingFromSector( ubSourceSectorID, 0, ubNumSoldiers, ubNumSoldiers - ubNumSoldiers / gGameOptions.ubDifficultyLevel ); pGroup1 = CreateNewEnemyGroupDepartingFromSector( ubSourceSectorID, 0, ubNumSoldiers, ubNumSoldiers - ubNumSoldiers / gGameOptions.ubDifficultyLevel ); pGroup2 = CreateNewEnemyGroupDepartingFromSector( ubSourceSectorID, 0, ubNumSoldiers, ubNumSoldiers - ubNumSoldiers / gGameOptions.ubDifficultyLevel ); @@ -4270,7 +4271,7 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto //Madd: unlimited reinforcements? //if ( !gfUnlimitedTroops ) // giReinforcementPool -= ubNumSoldiers; - + giReinforcementPool = max( giReinforcementPool, 0 ); MoveSAIGroupToSector( &pGroup0, SEC_D14, EVASIVE, pGroup0->pEnemyGroup->ubIntention ); @@ -4282,9 +4283,9 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto case NPC_ACTION_SEND_SOLDIERS_TO_BATTLE_LOCATION: - //Send 4, 8, or 12 troops (based on difficulty) to the location of the first battle. If nobody is there when they arrive, + //Send 4, 8, or 12 troops (based on difficulty) to the location of the first battle. If nobody is there when they arrive, //those troops will get reassigned. - ubSectorID = (UINT8)STRATEGIC_INDEX_TO_SECTOR_INFO( sWorldSectorLocationOfFirstBattle ); + ubSectorID = (UINT8)STRATEGIC_INDEX_TO_SECTOR_INFO( sWorldSectorLocationOfFirstBattle ); pSector = &SectorInfo[ ubSectorID ]; ubNumSoldiers = (UINT8)( gubMinEnemyGroupSize + gGameOptions.ubDifficultyLevel * 4); pGroup = CreateNewEnemyGroupDepartingFromSector( SEC_P3, 0, ubNumSoldiers, 0 ); @@ -4292,11 +4293,11 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto //Madd: unlimited reinforcements? if ( !gfUnlimitedTroops ) giReinforcementPool -= ubNumSoldiers; - + giReinforcementPool = max( giReinforcementPool, 0 ); - //Determine if the battle location actually has a garrison assignment. If so, and the following - //checks succeed, the enemies will be sent to attack and reinforce that sector. Otherwise, the + //Determine if the battle location actually has a garrison assignment. If so, and the following + //checks succeed, the enemies will be sent to attack and reinforce that sector. Otherwise, the //enemies will simply check it out, then leave. if( pSector->ubGarrisonID != NO_GARRISON ) { //sector has a garrison @@ -4328,7 +4329,7 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto //Madd: unlimited reinforcements if ( !gfUnlimitedTroops ) giReinforcementPool -= ubNumSoldiers; - + giReinforcementPool = max( giReinforcementPool, 0 ); if( PlayerMercsInSector( 9, 1, 1 ) && !PlayerMercsInSector( 10, 1, 1 ) && !PlayerMercsInSector( 10, 1, 2 ) ) { //send to A9 (if mercs in A9, but not in A10 or A10 basement) @@ -4351,7 +4352,7 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto //Madd: unlimited reinforcements? if ( !gfUnlimitedTroops ) giReinforcementPool -= ubNumSoldiers; - + giReinforcementPool = max( giReinforcementPool, 0 ); pGroup = CreateNewEnemyGroupDepartingFromSector( SEC_P3, 0, 0, ubNumSoldiers ); MoveSAIGroupToSector( &pGroup, ubSectorID, STAGE, REINFORCEMENTS ); @@ -4369,7 +4370,7 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto if( pPendingGroup ) { //Reassign the pending group ReassignAIGroup( &pPendingGroup ); - } + } break; case NPC_ACTION_ADD_MORE_ELITES: @@ -4404,7 +4405,7 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto #ifdef JA2BETAVERSION -void LogStrategicMsg( STR8 str, ... ) +void LogStrategicMsg( STR8 str, ... ) { va_list argptr; CHAR8 string[512]; @@ -4415,8 +4416,8 @@ void LogStrategicMsg( STR8 str, ... ) if( !fp ) return; - va_start(argptr, str ); - vsprintf( string, str, argptr); + va_start(argptr, str ); + vsprintf( string, str, argptr); va_end(argptr); fprintf( fp, "%s\n", string ); @@ -4433,7 +4434,7 @@ void LogStrategicMsg( STR8 str, ... ) fclose( fp ); } -void LogStrategicEvent( STR8 str, ... ) +void LogStrategicEvent( STR8 str, ... ) { va_list argptr; CHAR8 string[512]; @@ -4444,11 +4445,11 @@ void LogStrategicEvent( STR8 str, ... ) if( !fp ) return; - va_start(argptr, str ); - vsprintf( string, str, argptr); + va_start(argptr, str ); + vsprintf( string, str, argptr); va_end(argptr); - + fprintf( fp, "\n%S:\n", WORLDTIMESTR ); fprintf( fp, "%s\n", string ); @@ -4488,14 +4489,14 @@ void InvestigateSector( UINT8 ubSectorID ) UINT8 ubAdmins[4], ubTroops[4], ubElites[4], ubNumToSend, ubTotal; //Lalien: enabled again - //@@@ Disabled! Also commented out the posting of the event + //@@@ Disabled! Also commented out the posting of the event //return; sSectorX = (INT16)SECTORX( ubSectorID ); sSectorY = (INT16)SECTORY( ubSectorID ); if( guiCurrentScreen != GAME_SCREEN ) - { //If we aren't in tactical, then don't do this. It is strictly added flavour and would be irritating if + { //If we aren't in tactical, then don't do this. It is strictly added flavour and would be irritating if //you got the prebattle interface in mapscreen while compressing time (right after clearing it...) return; } @@ -4505,7 +4506,7 @@ void InvestigateSector( UINT8 ubSectorID ) return; } - //Now, we will investigate this sector if there are forces in adjacent towns. For each + //Now, we will investigate this sector if there are forces in adjacent towns. For each //sector that applies, we will add 1-2 soldiers. ubTotal = 0; @@ -4582,17 +4583,17 @@ void InvestigateSector( UINT8 ubSectorID ) { switch( i ) { - case 0: //NORTH - AddEnemiesToBattle( NULL, INSERTION_CODE_NORTH, ubAdmins[i], ubTroops[i], ubElites[i], TRUE ); + case 0: //NORTH + AddEnemiesToBattle( NULL, INSERTION_CODE_NORTH, ubAdmins[i], ubTroops[i], ubElites[i], TRUE ); break; - case 1: //EAST - AddEnemiesToBattle( NULL, INSERTION_CODE_EAST, ubAdmins[i], ubTroops[i], ubElites[i], TRUE ); + case 1: //EAST + AddEnemiesToBattle( NULL, INSERTION_CODE_EAST, ubAdmins[i], ubTroops[i], ubElites[i], TRUE ); break; - case 2: //SOUTH - AddEnemiesToBattle( NULL, INSERTION_CODE_SOUTH, ubAdmins[i], ubTroops[i], ubElites[i], TRUE ); + case 2: //SOUTH + AddEnemiesToBattle( NULL, INSERTION_CODE_SOUTH, ubAdmins[i], ubTroops[i], ubElites[i], TRUE ); break; - case 3: //WEST - AddEnemiesToBattle( NULL, INSERTION_CODE_WEST, ubAdmins[i], ubTroops[i], ubElites[i], TRUE ); + case 3: //WEST + AddEnemiesToBattle( NULL, INSERTION_CODE_WEST, ubAdmins[i], ubTroops[i], ubElites[i], TRUE ); break; } } @@ -4614,10 +4615,10 @@ void StrategicHandleQueenLosingControlOfSector( INT16 sSectorX, INT16 sSectorY, return; } - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ if( StrategicMap[ sSectorX + sSectorY * MAP_WORLD_X ].fEnemyControlled ) - { + { //If the sector doesn't belong to the player, then we shouldn't be calling this function! SAIReportError( L"StrategicHandleQueenLosingControlOfSector() was called for a sector that is internally considered to be enemy controlled." ); return; @@ -4642,15 +4643,15 @@ void StrategicHandleQueenLosingControlOfSector( INT16 sSectorX, INT16 sSectorY, //Lalien if ( gGameExternalOptions.gfReassignPendingReinforcements == TRUE ) { - //check to see if there are any pending reinforcements. If so, then cancel their orders and have them - //reassigned, so the player doesn't get pestered. This is a feature that *dumbs* down the AI, and is done - //for the sake of gameplay. We don't want the game to be tedious. + //check to see if there are any pending reinforcements. If so, then cancel their orders and have them + //reassigned, so the player doesn't get pestered. This is a feature that *dumbs* down the AI, and is done + //for the sake of gameplay. We don't want the game to be tedious. if( !pSector->uiTimeLastPlayerLiberated ) { pSector->uiTimeLastPlayerLiberated = GetWorldTotalSeconds(); } else - { + { //convert hours to seconds and subtract up to half of it randomly "seconds - (hours*3600 / 2)" pSector->uiTimeLastPlayerLiberated = GetWorldTotalSeconds() - Random( gubHoursGracePeriod * 1800 ); } @@ -4670,11 +4671,11 @@ void StrategicHandleQueenLosingControlOfSector( INT16 sSectorX, INT16 sSectorY, } //If there are any enemy groups that will be moving through this sector due, they will have to repath which - //will cause them to avoid the sector. Returns the number of redirected groups. + //will cause them to avoid the sector. Returns the number of redirected groups. RedirectEnemyGroupsMovingThroughSector( (UINT8)sSectorX, (UINT8)sSectorY ); //For the purposes of a town being lost, we shall check to see if the queen wishes to investigate quickly after - //losing. This is done in town sectors when the character first takes it. + //losing. This is done in town sectors when the character first takes it. switch( ubSectorID ) { case SEC_B13: @@ -4748,16 +4749,16 @@ void StrategicHandleQueenLosingControlOfSector( INT16 sSectorX, INT16 sSectorY, default: return; } - + //Madd: tweaked to increase attacks for experienced and expert to 8 and 12, and unlimited for insane if( pSector->ubInvestigativeState >= ( 4 * gGameOptions.ubDifficultyLevel ) && gGameOptions.ubDifficultyLevel < DIF_LEVEL_INSANE ) - { - //This is the 4th time the player has conquered this sector. We won't pester the player with probing attacks here anymore. - return; + { + //This is the 4th time the player has conquered this sector. We won't pester the player with probing attacks here anymore. + return; } if( sSectorX != gWorldSectorX || sSectorY != gWorldSectorY ) - { //The sector isn't loaded, so don't probe attack it. Otherwise, autoresolve would get them smoked! + { //The sector isn't loaded, so don't probe attack it. Otherwise, autoresolve would get them smoked! return; } @@ -4789,7 +4790,7 @@ UINT8 SectorDistance( UINT8 ubSectorID1, UINT8 ubSectorID2 ) ubSectorX2 = (UINT8)SECTORX( ubSectorID2 ); ubSectorY1 = (UINT8)SECTORY( ubSectorID1 ); ubSectorY2 = (UINT8)SECTORY( ubSectorID2 ); - + ubDist = (UINT8)( abs( ubSectorX1 - ubSectorX2 ) + abs( ubSectorY1 - ubSectorY2 ) ); return ubDist; @@ -4805,7 +4806,7 @@ void RequestHighPriorityGarrisonReinforcements( INT32 iGarrisonID, UINT8 ubSoldi ubBestDist = 255; iBestIndex = -1; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ for( i = 0; i < giPatrolArraySize; i++ ) { @@ -4876,14 +4877,14 @@ void RequestHighPriorityGarrisonReinforcements( INT32 iGarrisonID, UINT8 ubSoldi } else { - AssertMsg( 0, "Strategic AI group transfer error. KM : 0" ); + AssertMsg( 0, "Strategic AI group transfer error. KM : 0" ); return; } } pNewGroup->ubOriginalSector = (UINT8)SECTOR( ubDstSectorX, ubDstSectorY ); gGarrisonGroup[ iGarrisonID ].ubPendingGroupID = pNewGroup->ubGroupID; RecalculatePatrolWeight( iBestIndex ); - + MoveSAIGroupToSector( &pNewGroup, gGarrisonGroup[ iGarrisonID ].ubSectorID, EVASIVE, REINFORCEMENTS ); } else @@ -4892,16 +4893,16 @@ void RequestHighPriorityGarrisonReinforcements( INT32 iGarrisonID, UINT8 ubSoldi gGarrisonGroup[ iGarrisonID ].ubPendingGroupID = pGroup->ubGroupID; pGroup->ubOriginalSector = (UINT8)SECTOR( ubDstSectorX, ubDstSectorY ); RecalculatePatrolWeight( iBestIndex ); - //The ONLY case where the group is told to move somewhere else when they could be BETWEEN sectors. The movegroup functions - //don't work if this is the case. Teleporting them to their previous sector is the best and easiest way to deal with this. + //The ONLY case where the group is told to move somewhere else when they could be BETWEEN sectors. The movegroup functions + //don't work if this is the case. Teleporting them to their previous sector is the best and easiest way to deal with this. SetEnemyGroupSector( pGroup, (UINT8)SECTOR( pGroup->ubSectorX, pGroup->ubSectorY ) ); - + MoveSAIGroupToSector( &pGroup, gGarrisonGroup[ iGarrisonID ].ubSectorID, EVASIVE, REINFORCEMENTS ); ValidateGroup( pGroup ); } } else - { //There are no groups that have enough troops. Send a new force from the palace instead. + { //There are no groups that have enough troops. Send a new force from the palace instead. pGroup = CreateNewEnemyGroupDepartingFromSector( SEC_P3, 0, ubSoldiersRequested, 0 ); pGroup->ubMoveType = ONE_WAY; pGroup->pEnemyGroup->ubIntention = REINFORCEMENTS; @@ -4911,7 +4912,7 @@ void RequestHighPriorityGarrisonReinforcements( INT32 iGarrisonID, UINT8 ubSoldi //Madd: unlimited reinforcements? if ( !gfUnlimitedTroops ) giReinforcementPool -= (INT32)ubSoldiersRequested; - + MoveSAIGroupToSector( &pGroup, gGarrisonGroup[ iGarrisonID ].ubSectorID, EVASIVE, REINFORCEMENTS ); ValidateGroup( pGroup ); } @@ -4934,17 +4935,17 @@ void MassFortifyTowns() //GROUP *pGroup; UINT8 ubNumTroops, ubDesiredTroops; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ for( i = 0; i < giGarrisonArraySize; i++ ) { pSector = &SectorInfo[ gGarrisonGroup[ i ].ubSectorID ]; ubNumTroops = pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites; ubDesiredTroops = (UINT8)gArmyComp[ gGarrisonGroup[ i ].ubComposition ].bDesiredPopulation; - - if( ubNumTroops < ubDesiredTroops ) + + if( ubNumTroops < ubDesiredTroops ) { - if( !gGarrisonGroup[ i ].ubPendingGroupID && + if( !gGarrisonGroup[ i ].ubPendingGroupID && gGarrisonGroup[ i ].ubComposition != ROADBLOCK && EnemyPermittedToAttackSector( NULL, gGarrisonGroup[ i ].ubSectorID ) ) { @@ -4952,7 +4953,7 @@ void MassFortifyTowns() } } } - + //Lalien: removed, the queen should attack and stay in Omerta //Convert the garrison sitting in Omerta (if alive), and reassign them @@ -4972,7 +4973,7 @@ void MassFortifyTowns() void RenderAIViewerGarrisonInfo( INT32 x, INT32 y, SECTORINFO *pSector ) { - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ if( pSector->ubGarrisonID != NO_GARRISON ) { @@ -4992,7 +4993,7 @@ void RenderAIViewerGarrisonInfo( INT32 x, INT32 y, SECTORINFO *pSector ) { GROUP *pGroup; pGroup = GetGroup( gGarrisonGroup[ pSector->ubGarrisonID ].ubPendingGroupID ); - mprintf( x, y+10, L"%d reinforcements on route from group %d in %c%d", pGroup->ubGroupSize, pGroup->ubGroupID, + mprintf( x, y+10, L"%d reinforcements on route from group %d in %c%d", pGroup->ubGroupSize, pGroup->ubGroupID, pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX ); } else @@ -5009,7 +5010,7 @@ void RenderAIViewerGarrisonInfo( INT32 x, INT32 y, SECTORINFO *pSector ) void StrategicHandleMineThatRanOut( UINT8 ubSectorID ) { - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ switch( ubSectorID ) { @@ -5045,7 +5046,7 @@ BOOLEAN GarrisonCanProvideMinimumReinforcements( INT32 iGarrisonID ) SECTORINFO *pSector; UINT8 ubSectorX, ubSectorY; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ pSector = &SectorInfo[ gGarrisonGroup[ iGarrisonID ].ubSectorID ]; @@ -5073,7 +5074,7 @@ BOOLEAN GarrisonRequestingMinimumReinforcements( INT32 iGarrisonID ) INT32 iDesired; SECTORINFO *pSector; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ if( gGarrisonGroup[ iGarrisonID ].ubPendingGroupID ) { @@ -5122,7 +5123,7 @@ void EliminateSurplusTroopsForGarrison( GROUP *pGroup, SECTORINFO *pSector ) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic8"); iTotal = pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites + pGroup->pEnemyGroup->ubNumAdmins + - pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumAdmins; + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumAdmins; if( iTotal <= iMaxEnemyGroupSize ) { return; @@ -5151,7 +5152,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic8"); pSector->ubNumAdmins = 0; } else - { + { pSector->ubNumAdmins -= (UINT8)iTotal; iTotal = 0; } @@ -5177,7 +5178,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic8"); pSector->ubNumTroops = 0; } else - { + { pSector->ubNumTroops -= (UINT8)iTotal; iTotal = 0; } @@ -5203,7 +5204,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic8"); pSector->ubNumElites = 0; } else - { + { pSector->ubNumElites -= (UINT8)iTotal; iTotal = 0; } @@ -5213,8 +5214,8 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic8"); -// once Queen is awake, she'll gradually begin replacing admins with regular troops. This is mainly to keep player from -// fighting many more admins once they are no longer any challenge for him. Eventually all admins will vanish off map. +// once Queen is awake, she'll gradually begin replacing admins with regular troops. This is mainly to keep player from +// fighting many more admins once they are no longer any challenge for him. Eventually all admins will vanish off map. void UpgradeAdminsToTroops() { INT32 i; @@ -5224,8 +5225,8 @@ void UpgradeAdminsToTroops() GROUP *pGroup; INT16 sPatrolIndex; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ - // on normal, AI evaluates approximately every 10 hrs. There are about 130 administrators seeded on the map. + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + // on normal, AI evaluates approximately every 10 hrs. There are about 130 administrators seeded on the map. // Some of these will be killed by the player. // check all garrisons for administrators @@ -5243,8 +5244,8 @@ void UpgradeAdminsToTroops() if ( pSector->ubNumAdmins > 0 ) { bPriority = gArmyComp[ gGarrisonGroup[ i ].ubComposition ].bPriority; - - // highest priority sectors are upgraded first. Each 1% of progress lower the + + // highest priority sectors are upgraded first. Each 1% of progress lower the // priority threshold required to start triggering upgrades by 10%. if ( ( 100 - ( 10 * HighestPlayerProgressPercentage() ) ) < bPriority ) { @@ -5299,7 +5300,7 @@ void UpgradeAdminsToTroops() bPriority = 50; } - // highest priority groups are upgraded first. Each 1% of progress lower the + // highest priority groups are upgraded first. Each 1% of progress lower the // priority threshold required to start triggering upgrades by 10%. if ( ( 100 - ( 10 * HighestPlayerProgressPercentage() ) ) < bPriority ) { @@ -5319,7 +5320,7 @@ void UpgradeAdminsToTroops() } } } - + pGroup = pGroup->next; } } @@ -5364,7 +5365,7 @@ INT16 FindPatrolGroupIndexForGroupIDPending( UINT8 ubGroupID ) INT16 FindGarrisonIndexForGroupIDPending( UINT8 ubGroupID ) { INT16 sGarrisonIndex; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ for( sGarrisonIndex = 0; sGarrisonIndex < giGarrisonArraySize; sGarrisonIndex++ ) { @@ -5384,12 +5385,12 @@ void TransferGroupToPool( GROUP **pGroup ) //Madd: unlimited reinforcements? if ( !gfUnlimitedTroops ) giReinforcementPool += (*pGroup)->ubGroupSize; - + RemovePGroup( *pGroup ); *pGroup = NULL; } -//NOTE: Make sure you call SetEnemyGroupSector() first if the group is between sectors!! See example in ReassignAIGroup()... +//NOTE: Make sure you call SetEnemyGroupSector() first if the group is between sectors!! See example in ReassignAIGroup()... void SendGroupToPool( GROUP **pGroup ) { if( (*pGroup)->ubSectorX == 3 && (*pGroup)->ubSectorY == 16 ) @@ -5415,14 +5416,14 @@ void ReassignAIGroup( GROUP **pGroup ) (*pGroup)->ubSectorIDOfLastReassignment = ubSectorID; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ ClearPreviousAIGroupAssignment( *pGroup ); - //First thing to do, is teleport the group to be AT the sector he is currently moving from. Otherwise, the + //First thing to do, is teleport the group to be AT the sector he is currently moving from. Otherwise, the //strategic pathing can break if the group is between sectors upon reassignment. SetEnemyGroupSector( *pGroup, ubSectorID ); - if( giRequestPoints <= 0 ) + if( giRequestPoints <= 0 ) { //we have no request for reinforcements, so send the group to Meduna for reassignment in the pool. SendGroupToPool( pGroup ); return; @@ -5432,8 +5433,8 @@ void ReassignAIGroup( GROUP **pGroup ) // giRequestPoints is the combined sum of all the individual weights of all garrisons and patrols requesting reinforcements iRandom = Random( giRequestPoints ); - //go through garrisons first and begin considering where the random value dictates. If that garrison doesn't require - //reinforcements, it'll continue on considering all subsequent garrisons till the end of the array. If it fails at that + //go through garrisons first and begin considering where the random value dictates. If that garrison doesn't require + //reinforcements, it'll continue on considering all subsequent garrisons till the end of the array. If it fails at that //point, it'll restart the loop at zero, and consider all garrisons to the index that was first considered by the random value. for( i = 0; i < giGarrisonArraySize; i++ ) { @@ -5443,7 +5444,7 @@ void ReassignAIGroup( GROUP **pGroup ) { //if group is requesting reinforcements. if( iRandom < iWeight ) { - if( !gGarrisonGroup[ i ].ubPendingGroupID && + if( !gGarrisonGroup[ i ].ubPendingGroupID && EnemyPermittedToAttackSector( NULL, gGarrisonGroup[ i ].ubSectorID ) && GarrisonRequestingMinimumReinforcements( i ) ) { //This is the group that gets the reinforcements! @@ -5459,21 +5460,21 @@ void ReassignAIGroup( GROUP **pGroup ) iRandom = 0; } } - //Decrease the iRandom value until it hits 0. When that happens, all garrisons will get considered until + //Decrease the iRandom value until it hits 0. When that happens, all garrisons will get considered until //we either have a match or process all of the garrisons. iRandom -= iWeight; } } if( iReloopLastIndex >= 0 ) { //Process the loop again to the point where the original random slot started considering, and consider - //all of the garrisons. If this fails, all patrol groups will be considered next. + //all of the garrisons. If this fails, all patrol groups will be considered next. for( i = 0; i <= iReloopLastIndex; i++ ) { RecalculateGarrisonWeight( i ); iWeight = gGarrisonGroup[ i ].bWeight; if( iWeight > 0 ) { //if group is requesting reinforcements. - if( !gGarrisonGroup[ i ].ubPendingGroupID && + if( !gGarrisonGroup[ i ].ubPendingGroupID && EnemyPermittedToAttackSector( NULL, gGarrisonGroup[ i ].ubSectorID ) && GarrisonRequestingMinimumReinforcements( i ) ) { //This is the group that gets the reinforcements! @@ -5497,7 +5498,7 @@ void ReassignAIGroup( GROUP **pGroup ) { if( iRandom < iWeight ) { - if( !gPatrolGroup[ i ].ubPendingGroupID && PatrolRequestingMinimumReinforcements( i ) ) + if( !gPatrolGroup[ i ].ubPendingGroupID && PatrolRequestingMinimumReinforcements( i ) ) { //This is the group that gets the reinforcements! SendReinforcementsForPatrol( i, pGroup ); return; @@ -5523,7 +5524,7 @@ void ReassignAIGroup( GROUP **pGroup ) iWeight = gPatrolGroup[ i ].bWeight; if( iWeight > 0 ) { - if( !gPatrolGroup[ i ].ubPendingGroupID && PatrolRequestingMinimumReinforcements( i ) ) + if( !gPatrolGroup[ i ].ubPendingGroupID && PatrolRequestingMinimumReinforcements( i ) ) { //This is the group that gets the reinforcements! SendReinforcementsForPatrol( i, pGroup ); return; @@ -5533,7 +5534,7 @@ void ReassignAIGroup( GROUP **pGroup ) TransferGroupToPool( pGroup ); } -//When an enemy AI group is eliminated by the player, apply a grace period in which the +//When an enemy AI group is eliminated by the player, apply a grace period in which the //group isn't allowed to be filled for several days. void TagSAIGroupWithGracePeriod( GROUP *pGroup ) { @@ -5576,7 +5577,7 @@ void RepollSAIGroup( GROUP *pGroup ) INT32 i; Assert( !pGroup->fPlayer ); - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ if( GroupAtFinalDestination( pGroup ) ) { EvaluateGroupSituation( pGroup ); @@ -5594,7 +5595,7 @@ void RepollSAIGroup( GROUP *pGroup ) for( i = 0; i < giGarrisonArraySize; i++ ) { //KM : August 6, 1999 Patch fix - // Ack, wasn't checking for the matching group to garrison + // Ack, wasn't checking for the matching group to garrison if( gGarrisonGroup[ i ].ubPendingGroupID == pGroup->ubGroupID ) //end { @@ -5609,7 +5610,7 @@ void ClearPreviousAIGroupAssignment( GROUP *pGroup ) { INT32 i; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ for( i = 0; i < giPatrolArraySize; i++ ) { if( gPatrolGroup[ i ].ubGroupID == pGroup->ubGroupID ) @@ -5679,7 +5680,7 @@ void RemoveSoldiersFromGarrisonBasedOnComposition( INT32 iGarrisonID, UINT8 ubSi UINT8 ubOrigNumTroops; UINT8 ubOrigSize; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ iCompositionID = gGarrisonGroup[ iGarrisonID ].ubComposition; CalcNumTroopsBasedOnComposition( &ubNumTroops, &ubNumElites, ubSize, iCompositionID ); @@ -5706,8 +5707,8 @@ void RemoveSoldiersFromGarrisonBasedOnComposition( INT32 iGarrisonID, UINT8 ubSi ubNumElites--; } } - //No administrators are left. - + //No administrators are left. + //Eliminate the troops while( ubNumTroops ) { @@ -5726,7 +5727,7 @@ void RemoveSoldiersFromGarrisonBasedOnComposition( INT32 iGarrisonID, UINT8 ubSi ubNumTroops--; } - //Eliminate the elites + //Eliminate the elites while( ubNumElites ) { if( pSector->ubNumElites ) @@ -5763,7 +5764,7 @@ void MoveSAIGroupToSector( GROUP **pGroup, UINT8 ubSectorID, UINT32 uiMoveCode, (*pGroup)->ubMoveType = ONE_WAY; if( ubIntention == PURSUIT ) - { //Make sure that the group isn't moving into a garrison sector. These sectors should be using ASSAULT intentions! + { //Make sure that the group isn't moving into a garrison sector. These sectors should be using ASSAULT intentions! if( SectorInfo[ ubSectorID ].ubGarrisonID != NO_GARRISON ) { //Good place for a breakpoint. @@ -5772,7 +5773,7 @@ void MoveSAIGroupToSector( GROUP **pGroup, UINT8 ubSectorID, UINT32 uiMoveCode, } if( (*pGroup)->ubSectorX == ubDstSectorX && (*pGroup)->ubSectorY == ubDstSectorY ) - { //The destination sector is the current location. Instead of causing code logic problems, + { //The destination sector is the current location. Instead of causing code logic problems, //simply process them as if they just arrived. if( EvaluateGroupSituation( *pGroup ) ) { //The group was deleted. @@ -5794,12 +5795,12 @@ void MoveSAIGroupToSector( GROUP **pGroup, UINT8 ubSectorID, UINT32 uiMoveCode, MoveGroupFromSectorToSector( (*pGroup)->ubGroupID, (*pGroup)->ubSectorX, (*pGroup)->ubSectorY, ubDstSectorX, ubDstSectorY ); break; } - //Make sure that the group is moving. If this fails, then the pathing may have failed for some reason. + //Make sure that the group is moving. If this fails, then the pathing may have failed for some reason. ValidateGroup( *pGroup ); } //If there are any enemy groups that will be moving through this sector due, they will have to repath which -//will cause them to avoid the sector. Returns the number of redirected groups. +//will cause them to avoid the sector. Returns the number of redirected groups. UINT8 RedirectEnemyGroupsMovingThroughSector( UINT8 ubSectorX, UINT8 ubSectorY ) { GROUP *pGroup; @@ -5812,7 +5813,7 @@ UINT8 RedirectEnemyGroupsMovingThroughSector( UINT8 ubSectorX, UINT8 ubSectorY ) if( !pGroup->fPlayer && pGroup->ubMoveType == ONE_WAY ) { //check the waypoint list if( GroupWillMoveThroughSector( pGroup, ubSectorX, ubSectorY ) ) - { + { //extract the group's destination. pWaypoint = GetFinalWaypoint( pGroup ); Assert( pWaypoint ); @@ -5826,7 +5827,7 @@ UINT8 RedirectEnemyGroupsMovingThroughSector( UINT8 ubSectorX, UINT8 ubSectorY ) } if( ubNumGroupsRedirected ) { - ScreenMsg( FONT_LTBLUE, MSG_BETAVERSION, L"Test message for new feature: %d enemy groups were redirected away from moving through sector %c%d. Please don't report unless this number is greater than 5.", + ScreenMsg( FONT_LTBLUE, MSG_BETAVERSION, L"Test message for new feature: %d enemy groups were redirected away from moving through sector %c%d. Please don't report unless this number is greater than 5.", ubNumGroupsRedirected, ubSectorY + 'A' - 1, ubSectorX ); } return ubNumGroupsRedirected; @@ -5840,18 +5841,18 @@ void ReinitializeUnvisitedGarrisons() ARMY_COMPOSITION *pArmyComp; GROUP *pGroup; INT32 i, cnt, iEliteChance, iAdminChance; - + //Recreate the compositions memcpy( gArmyComp, gOrigArmyComp, NUM_ARMY_COMPOSITIONS * sizeof( ARMY_COMPOSITION ) ); EvolveQueenPriorityPhase( TRUE ); - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ - //Go through each unvisited sector and recreate the garrison forces based on + //Go through each unvisited sector and recreate the garrison forces based on //the desired population. for( i = 0; i < giGarrisonArraySize; i++ ) { if( gGarrisonGroup[ i ].ubComposition >= LEVEL1_DEFENCE && gGarrisonGroup[ i ].ubComposition <= LEVEL3_DEFENCE ) - { //These 3 compositions make up the perimeter around Meduna. The existance of these are based on the + { //These 3 compositions make up the perimeter around Meduna. The existance of these are based on the //difficulty level, and we don't want to reset these anyways, due to the fact that many of the reinforcements //come from these sectors, and it could potentially add upwards of 150 extra troops which would seriously //unbalance the difficulty. @@ -5874,8 +5875,8 @@ void ReinitializeUnvisitedGarrisons() } if( gGarrisonGroup[ i ].ubPendingGroupID ) - { //if the garrison has reinforcements on route, then subtract the number of - //reinforcements from the value we reset the size of the garrison. This is to + { //if the garrison has reinforcements on route, then subtract the number of + //reinforcements from the value we reset the size of the garrison. This is to //prevent overfilling the group. pGroup = GetGroup( gGarrisonGroup[ i ].ubPendingGroupID ); if( pGroup ) @@ -5884,7 +5885,7 @@ void ReinitializeUnvisitedGarrisons() cnt = max( cnt, 0 ); } } - + iEliteChance = pArmyComp->bElitePercentage; iAdminChance = pArmyComp->bAdminPercentage; if( iAdminChance && !gfQueenAIAwake && cnt ) @@ -5912,7 +5913,7 @@ GROUP* FindPendingGroupForGarrisonSector( UINT8 ubSectorID ) SECTORINFO *pSector; pSector = &SectorInfo[ ubSectorID ]; - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ if( pSector->ubGarrisonID != NO_GARRISON ) { diff --git a/Strategic/Strategic AI.h b/Strategic/Strategic AI.h index e25429d3..f75d08f5 100644 --- a/Strategic/Strategic AI.h +++ b/Strategic/Strategic AI.h @@ -86,7 +86,7 @@ enum BALIME_DEFENCE, //Rich town, paved roads, close to Meduna (in queen's favor) TIXA_PRISON, //Prison, well defended, but no point in retaking TIXA_SAMSITE, //The central-most sam site (important for queen to keep) - ALMA_DEFENCE, //The military town of Meduna. Also very important for queen. + ALMA_DEFENCE, //The military town of Meduna. Also very important for queen. ALMA_MINE, //Mine income AND administrators CAMBRIA_DEFENCE, //Medical town, large, central. CAMBRIA_MINE, @@ -106,26 +106,26 @@ extern UINT8 NUM_ARMY_COMPOSITIONS; typedef struct ARMY_COMPOSITION { INT32 iReadability; //contains the enumeration which is useless, but helps readability. - INT8 bPriority; - INT8 bElitePercentage; - INT8 bTroopPercentage; - INT8 bAdminPercentage; - INT8 bDesiredPopulation; - INT8 bStartPopulation; - INT8 bPadding[10]; + INT8 bPriority; + INT8 bElitePercentage; + INT8 bTroopPercentage; + INT8 bAdminPercentage; + INT8 bDesiredPopulation; + INT8 bStartPopulation; + INT8 bPadding[10]; }ARMY_COMPOSITION; //Defines the patrol groups -- movement groups. typedef struct PATROL_GROUP { - INT8 bSize; - INT8 bPriority; + INT8 bSize; + INT8 bPriority; UINT8 ubSectorID[4]; - INT8 bFillPermittedAfterDayMod100; + INT8 bFillPermittedAfterDayMod100; UINT8 ubGroupID; - INT8 bWeight; + INT8 bWeight; UINT8 ubPendingGroupID; - INT8 bPadding[10]; + INT8 bPadding[10]; }PATROL_GROUP; //Defines all stationary defence forces. @@ -133,13 +133,13 @@ typedef struct GARRISON_GROUP { UINT8 ubSectorID; UINT8 ubComposition; - INT8 bWeight; + INT8 bWeight; UINT8 ubPendingGroupID; - INT8 bPadding[10]; + INT8 bPadding[10]; }GARRISON_GROUP; -#define MAX_GARRISON_GROUPS 100 -#define MAX_PATROL_GROUPS 50 +#define MAX_GARRISON_GROUPS 100 +#define MAX_PATROL_GROUPS 50 #define MAX_ARMY_COMPOSITIONS 60 #endif \ No newline at end of file diff --git a/Strategic/Strategic All.h b/Strategic/Strategic All.h index cdaff001..fc01b826 100644 --- a/Strategic/Strategic All.h +++ b/Strategic/Strategic All.h @@ -155,7 +155,7 @@ #include #include #include "Interface Cursors.h" -#include "Interface Panels.h" +#include "Interface Panels.h" #include "sys globals.h" #include "faces.h" #include "strategic turns.h" @@ -189,21 +189,21 @@ #include "strategicmap.h" #include "soldier add.h" #include "Opplist.h" -#include "Handle Items.h" -#include "Game Clock.h" -#include "environment.h" +#include "Handle Items.h" +#include "Game Clock.h" +#include "environment.h" #include "dialogue control.h" #include "Soldier Control.h" #include "overhead.h" #include "AimMembers.h" -#include "MessageBoxScreen.h" +#include "MessageBoxScreen.h" #include "Stdio.h" #include "english.h" #include "line.h" -#include "Keys.h" +#include "Keys.h" #include "Interface Dialogue.h" -#include "SysUtil.h" -#include "Message.h" +#include "SysUtil.h" +#include "Message.h" #include "Interface Dialogue.h" #include "Render Fun.h" #include "Boxing.h" diff --git a/Strategic/Strategic Event Handler.cpp b/Strategic/Strategic Event Handler.cpp index c7f9700f..548325e3 100644 --- a/Strategic/Strategic Event Handler.cpp +++ b/Strategic/Strategic Event Handler.cpp @@ -4,7 +4,6 @@ #include "Strategic Event Handler.h" #include "MemMan.h" #include "message.h" - #include "Item Types.h" #include "Items.h" #include "Handle Items.h" #include "LaptopSave.h" @@ -34,6 +33,11 @@ #endif #include "BobbyRMailOrder.h" +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + #define MEDUNA_ITEM_DROP_OFF_GRIDNO 10959 #define MEDUNA_ITEM_DROP_OFF_SECTOR_X 3 #define MEDUNA_ITEM_DROP_OFF_SECTOR_Y 14 @@ -42,7 +46,6 @@ extern INT16 gsRobotGridNo; - UINT32 guiPabloExtraDaysBribed = 0; UINT8 gubCambriaMedicalObjects; @@ -54,8 +57,7 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID ) { UINT8 i,j; UINT16 usItem; - OBJECTTYPE Object; - UINT16 usMapPos, usStandardMapPos; + INT16 sMapPos, sStandardMapPos; UINT16 usNumberOfItems; BOOLEAN fSectorLoaded = FALSE; UINT16 usTotalNumberOfItemTypes; @@ -71,7 +73,7 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID ) UINT8 ubTempNumItems; UINT8 ubItemsPurchased; - usStandardMapPos = BOBBYR_SHIPPING_DEST_GRIDNO; + sStandardMapPos = BOBBYR_SHIPPING_DEST_GRIDNO; // if the delivery is for meduna, drop the items off there instead if( gpNewBobbyrShipments[ ubOrderID ].fActive && gpNewBobbyrShipments[ ubOrderID ].ubDeliveryLoc == BR_MEDUNA ) @@ -96,8 +98,8 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID ) { // shipment went to wrong airport... reroute all items to a temporary // gridno to represent the other airport (and damage them) - SetFactTrue( FACT_LAST_SHIPMENT_WENT_TO_WRONG_AIRPORT ); - usStandardMapPos = LOST_SHIPMENT_GRIDNO; + SetFactTrue( FACT_LAST_SHIPMENT_WENT_TO_WRONG_AIRPORT ); + sStandardMapPos = LOST_SHIPMENT_GRIDNO; SetFactFalse( FACT_NEXT_PACKAGE_CAN_BE_DELAYED ); } else if ( (gTownLoyalty[ DRASSEN ].ubRating < 20) || StrategicMap[ CALCULATE_STRATEGIC_INDEX( 13, MAP_ROW_B ) ].fEnemyControlled ) @@ -147,12 +149,10 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID ) if( !fSectorLoaded ) { //build an array of objects to be added - pObject = (OBJECTTYPE *) MemAlloc( sizeof( OBJECTTYPE ) * usNumberOfItems ); - pStolenObject = (OBJECTTYPE *) MemAlloc( sizeof( OBJECTTYPE ) * usNumberOfItems ); + pObject = new OBJECTTYPE[ usNumberOfItems ]; + pStolenObject = new OBJECTTYPE[ usNumberOfItems ]; if( pObject == NULL || pStolenObject == NULL) return; - memset( pObject, 0, sizeof( OBJECTTYPE ) * usNumberOfItems ); - memset( pStolenObject, 0, sizeof( OBJECTTYPE ) * usNumberOfItems ); } // WDS - Option to turn off stealing @@ -164,7 +164,7 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID ) } else if (CheckFact( FACT_PABLOS_BRIBED, 0 )) { - // Since Pacos has some money, reduce record of # of shipments since last bribed... + // Since Pacos has some money, reduce record of # of shipments since last bribed... ubShipmentsSinceNoBribes /= 2; uiChanceOfTheft = 0; } @@ -182,14 +182,14 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID ) usItem = gpNewBobbyrShipments[ ubOrderID ].BobbyRayPurchase[i].usItemIndex; //Create the item - CreateItem( usItem, gpNewBobbyrShipments[ ubOrderID ].BobbyRayPurchase[i].bItemQuality, &Object ); + CreateItem( usItem, gpNewBobbyrShipments[ ubOrderID ].BobbyRayPurchase[i].bItemQuality, &gTempObject ); // if it's a gun if (Item [ usItem ].usItemClass == IC_GUN ) { - // Empty out the bullets put in by CreateItem(). We now sell all guns empty of bullets. This is done for BobbyR + // Empty out the bullets put in by CreateItem(). We now sell all guns empty of bullets. This is done for BobbyR // simply to be consistent with the dealers in Arulco, who must sell guns empty to prevent ammo cheats by players. - Object.ItemData.Gun.ubGunShotsLeft = 0; + gTempObject[0]->data.gun.ubGunShotsLeft = 0; } ubItemsDelivered = 0; @@ -208,25 +208,25 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID ) if ( !fPablosStoleLastItem && uiChanceOfTheft > 0 && Random( 100 ) < (uiChanceOfTheft + ubItemsPurchased) ) { uiStolenCount++; - usMapPos = PABLOS_STOLEN_DEST_GRIDNO; // off screen! + sMapPos = PABLOS_STOLEN_DEST_GRIDNO; // off screen! fPablosStoleSomething = TRUE; fPablosStoleLastItem = TRUE; } else { - usMapPos = usStandardMapPos; + sMapPos = sStandardMapPos; fPablosStoleLastItem = FALSE; - if (usStandardMapPos == LOST_SHIPMENT_GRIDNO) + if (sStandardMapPos == LOST_SHIPMENT_GRIDNO) { // damage the item a random amount! - Object.ItemData.Generic.bStatus[0] = (INT8) ( ( (70 + Random( 11 )) * (INT32) Object.ItemData.Generic.bStatus[0] ) / 100 ); + gTempObject[0]->data.objectStatus = (INT8) ( ( (70 + Random( 11 )) * (INT32) gTempObject[0]->data.objectStatus ) / 100 ); // make damn sure it can't hit 0 - if (Object.ItemData.Generic.bStatus[0] == 0) + if (gTempObject[0]->data.objectStatus == 0) { - Object.ItemData.Generic.bStatus[0] = 1; + gTempObject[0]->data.objectStatus = 1; } - AddItemToPool( usMapPos, &Object, -1, 0, 0, 0 ); + AddItemToPool( sMapPos, &gTempObject, -1, 0, 0, 0 ); } else { @@ -239,7 +239,7 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID ) { if ( j > 1 && !fPablosStoleLastItem && uiChanceOfTheft > 0 && Random( 100 ) < (uiChanceOfTheft + j) ) { - memcpy( &pStolenObject[ uiStolenCount ], &Object, sizeof( OBJECTTYPE ) ); + pStolenObject[ uiStolenCount ] = gTempObject; uiStolenCount++; fPablosStoleSomething = TRUE; fPablosStoleLastItem = TRUE; @@ -251,16 +251,16 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID ) //else we are not currently in the sector, so we build an array of items to add in one lump //add the item to the item array - if (usStandardMapPos == LOST_SHIPMENT_GRIDNO) + if (sStandardMapPos == LOST_SHIPMENT_GRIDNO) { // damage the item a random amount! - Object.ItemData.Generic.bStatus[0] = (INT8) ( ( (70 + Random( 11 )) * (INT32) Object.ItemData.Generic.bStatus[0] ) / 100 ); + gTempObject[0]->data.objectStatus = (INT8) ( ( (70 + Random( 11 )) * (INT32) gTempObject[0]->data.objectStatus ) / 100 ); // make damn sure it can't hit 0 - if (Object.ItemData.Generic.bStatus[0] == 0) + if (gTempObject[0]->data.objectStatus == 0) { - Object.ItemData.Generic.bStatus[0] = 1; + gTempObject[0]->data.objectStatus = 1; } - memcpy( &pObject[ uiCount ], &Object, sizeof( OBJECTTYPE ) ); + pObject[ uiCount ] = gTempObject; uiCount++; } else @@ -273,14 +273,14 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID ) if ( gpNewBobbyrShipments[ ubOrderID ].BobbyRayPurchase[i].ubNumberPurchased == 1 && ubItemsDelivered == 1 ) { - // the item in Object will be the item to deliver + // the item in gTempObject will be the item to deliver if( fSectorLoaded ) { - AddItemToPool( usStandardMapPos, &Object, -1, 0, 0, 0 ); + AddItemToPool( sStandardMapPos, &gTempObject, -1, 0, 0, 0 ); } else { - memcpy( &pObject[ uiCount ], &Object, sizeof( OBJECTTYPE ) ); + pObject[ uiCount ] = gTempObject; uiCount++; } } @@ -289,17 +289,17 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID ) while ( ubItemsDelivered ) { // treat 0s as 1s :-) - ubTempNumItems = __min( ubItemsDelivered, __max( 1, Item[ usItem ].ubPerPocket ) ); - CreateItems( usItem, gpNewBobbyrShipments[ ubOrderID ].BobbyRayPurchase[i].bItemQuality, ubTempNumItems, &Object ); + ubTempNumItems = __min( ubItemsDelivered, ItemSlotLimit(&gTempObject, STACK_SIZE_LIMIT) ); + CreateItems( usItem, gpNewBobbyrShipments[ ubOrderID ].BobbyRayPurchase[i].bItemQuality, ubTempNumItems, &gTempObject ); // stack as many as possible if( fSectorLoaded ) { - AddItemToPool( usStandardMapPos, &Object, -1, 0, 0, 0 ); + AddItemToPool( sStandardMapPos, &gTempObject, -1, 0, 0, 0 ); } else { - memcpy( &pObject[ uiCount ], &Object, sizeof( OBJECTTYPE ) ); + pObject[ uiCount ] = gTempObject; uiCount++; } @@ -312,9 +312,9 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID ) if( !fSectorLoaded ) { //add all the items from the array that was built above - usMapPos = PABLOS_STOLEN_DEST_GRIDNO; - //The item are to be added to the Top part of Drassen, grid loc's 10112, 9950 - if( !AddItemsToUnLoadedSector( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, usStandardMapPos, uiCount, pObject, 0, 0, 0, -1, FALSE ) ) + sMapPos = PABLOS_STOLEN_DEST_GRIDNO; + //The item are to be added to the Top part of Drassen, grid loc's 10112, 9950 + if( !AddItemsToUnLoadedSector( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, sStandardMapPos, uiCount, pObject, 0, 0, 0, -1, FALSE ) ) { //Error adding the items //return; @@ -327,8 +327,8 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID ) //return; } } - MemFree( pObject ); - MemFree( pStolenObject ); + delete[] pObject ; + delete[]( pStolenObject ); pObject = NULL; pStolenObject = NULL; } @@ -402,15 +402,13 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID ) void HandleDelayedItemsArrival( UINT32 uiReason ) { - // This function moves all the items that Pablos has stolen - // (or items that were delayed) to the arrival location for new shipments, + // This function moves all the items that Pablos has stolen + // (or items that were delayed) to the arrival location for new shipments, INT16 sStartGridNo; UINT32 uiNumWorldItems, uiLoop; BOOLEAN fOk; - WORLDITEM * pTemp; + WORLDITEM * pTemp = 0; UINT8 ubLoop; - OBJECTTYPE Object; - if (uiReason == NPC_SYSTEM_EVENT_ACTION_PARAM_BONUS + NPC_ACTION_RETURN_STOLEN_SHIPMENT_ITEMS ) { if ( gMercProfiles[ PABLO ].bMercStatus == MERC_IS_DEAD ) @@ -431,34 +429,34 @@ void HandleDelayedItemsArrival( UINT32 uiReason ) { case 0: // 1 in 10 chance of a badly damaged gas mask - CreateItem( GASMASK, (INT8) (20 + Random( 10 )), &Object ); + CreateItem( GASMASK, (INT8) (20 + Random( 10 )), &gTempObject ); break; case 1: case 2: // 2 in 10 chance of a battered Desert Eagle - CreateItem( DESERTEAGLE, (INT8) (40 + Random( 10 )), &Object ); + CreateItem( DESERTEAGLE, (INT8) (40 + Random( 10 )), &gTempObject ); break; case 3: case 4: case 5: // 3 in 10 chance of a stun grenade - CreateItem( STUN_GRENADE, (INT8) (70 + Random( 10 )), &Object ); + CreateItem( STUN_GRENADE, (INT8) (70 + Random( 10 )), &gTempObject ); break; case 6: case 7: case 8: case 9: // 4 in 10 chance of two 38s! - CreateItems( SW38, (INT8) (90 + Random( 10 )), 2, &Object ); + CreateItems( SW38, (INT8) (90 + Random( 10 )), 2, &gTempObject ); break; } if ( ( gWorldSectorX == BOBBYR_SHIPPING_DEST_SECTOR_X ) && ( gWorldSectorY == BOBBYR_SHIPPING_DEST_SECTOR_Y ) && ( gbWorldSectorZ == BOBBYR_SHIPPING_DEST_SECTOR_Z ) ) { - AddItemToPool( BOBBYR_SHIPPING_DEST_GRIDNO, &Object, -1, 0, 0, 0 ); + AddItemToPool( BOBBYR_SHIPPING_DEST_GRIDNO, &gTempObject, -1, 0, 0, 0 ); } else { - AddItemsToUnLoadedSector( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, BOBBYR_SHIPPING_DEST_GRIDNO, 1, &Object, 0, 0, 0, -1, FALSE ); + AddItemsToUnLoadedSector( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, BOBBYR_SHIPPING_DEST_GRIDNO, 1, &gTempObject, 0, 0, 0, -1, FALSE ); } } } @@ -486,12 +484,12 @@ void HandleDelayedItemsArrival( UINT32 uiReason ) { return; } - pTemp = (WORLDITEM *) MemAlloc( sizeof( WORLDITEM ) * uiNumWorldItems); + pTemp = new WORLDITEM[ uiNumWorldItems]; if (!pTemp) { return; } - fOk = LoadWorldItemsFromTempItemFile( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, pTemp ); + fOk = LoadWorldItemsFromTempItemFile( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, pTemp ); if (fOk) { for (uiLoop = 0; uiLoop < uiNumWorldItems; uiLoop++) @@ -505,6 +503,9 @@ void HandleDelayedItemsArrival( UINT32 uiReason ) } } + if (pTemp) { + delete [] pTemp; + } } @@ -513,7 +514,7 @@ void AddSecondAirportAttendant( void ) // add the second airport attendant to the Drassen airport... gMercProfiles[99].sSectorX = BOBBYR_SHIPPING_DEST_SECTOR_X; gMercProfiles[99].sSectorY = BOBBYR_SHIPPING_DEST_SECTOR_Y; - gMercProfiles[99].bSectorZ = BOBBYR_SHIPPING_DEST_SECTOR_Z; + gMercProfiles[99].bSectorZ = BOBBYR_SHIPPING_DEST_SECTOR_Z; } void SetPabloToUnbribed( void ) @@ -557,9 +558,9 @@ void CheckForKingpinsMoneyMissing( BOOLEAN fFirstCheck ) for ( uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ ) { // loop through all items, look for ownership - if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].o.usItem == MONEY ) + if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].object.usItem == MONEY ) { - uiTotalCash += gWorldItems[uiLoop].o.ItemData.Money.uiMoneyAmount; + uiTotalCash += gWorldItems[uiLoop].object[0]->data.money.uiMoneyAmount; } } @@ -577,7 +578,7 @@ void CheckForKingpinsMoneyMissing( BOOLEAN fFirstCheck ) // add history log here AddHistoryToPlayersLog( HISTORY_FOUND_MONEY, 0, GetWorldTotalMin(), gWorldSectorX, gWorldSectorY ); - SetFactTrue( FACT_KINGPIN_WILL_LEARN_OF_MONEY_GONE ); + SetFactTrue( FACT_KINGPIN_WILL_LEARN_OF_MONEY_GONE ); } } @@ -591,17 +592,17 @@ void CheckForKingpinsMoneyMissing( BOOLEAN fFirstCheck ) if ( fFirstCheck ) { // add event to make Kingpin aware, two days from now - fKingpinWillDiscover = TRUE; + fKingpinWillDiscover = TRUE; } else { fKingpinDiscovers = TRUE; } } - + if ( fKingpinWillDiscover ) { - // set event for next day to check for real + // set event for next day to check for real AddFutureDayStrategicEvent( EVENT_SET_BY_NPC_SYSTEM, Random( 120 ), FACT_KINGPIN_KNOWS_MONEY_GONE, 1 ); // the sector is unloaded NOW so set Kingpin's balance and remove the cash @@ -610,7 +611,7 @@ void CheckForKingpinsMoneyMissing( BOOLEAN fFirstCheck ) for ( uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ ) { // loop through all items, look for ownership - if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].o.usItem == MONEY ) + if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].object.usItem == MONEY ) { // remove! gWorldItems[ uiLoop ].fExists = FALSE; @@ -647,7 +648,7 @@ void HandleNPCSystemEvent( UINT32 uiEvent ) { // set "really heavy old shipment" fact SetFactTrue( FACT_LARGE_SIZED_OLD_SHIPMENT_WAITING ); - } + } break; case FACT_SHIPMENT_DELAYED_24_HOURS: @@ -708,7 +709,7 @@ void HandleNPCSystemEvent( UINT32 uiEvent ) } break; case NPC_ACTION_DELAYED_MAKE_BRENDA_LEAVE: - //IC: + //IC: //TriggerNPCRecord( 85, 9 ); SetFactTrue( FACT_BRENDA_PATIENCE_TIMER_EXPIRED ); break; @@ -742,7 +743,7 @@ void HandleNPCSystemEvent( UINT32 uiEvent ) case NPC_ACTION_ADD_JOEY_TO_WORLD: // If Joey is not dead, escorted, or already delivered - if ( gMercProfiles[ JOEY ].bMercStatus != MERC_IS_DEAD && !CheckFact( FACT_JOEY_ESCORTED, 0 ) && + if ( gMercProfiles[ JOEY ].bMercStatus != MERC_IS_DEAD && !CheckFact( FACT_JOEY_ESCORTED, 0 ) && gMercProfiles[ JOEY ].sSectorX == 4 && gMercProfiles[ JOEY ].sSectorY == MAP_ROW_D && gMercProfiles[ JOEY ].bSectorZ == 1 ) @@ -816,7 +817,7 @@ void HandleEarlyMorningEvents( void ) } } } - + if( gMercProfiles[ TONY ].ubLastDateSpokenTo > 0 && !( gWorldSectorX == 5 && gWorldSectorY == MAP_ROW_C && gbWorldSectorZ == 0 ) ) { @@ -869,7 +870,7 @@ void HandleEarlyMorningEvents( void ) case 4: gMercProfiles[ DEVIN ].sSectorX = 6; gMercProfiles[ DEVIN ].sSectorY = MAP_ROW_C; - break; + break; } } } @@ -914,7 +915,7 @@ void HandleEarlyMorningEvents( void ) gMercProfiles[ HAMOUS ].sSectorY = MAP_ROW_D; gMercProfiles[ PROF_ICECREAM ].sSectorX = 9; gMercProfiles[ PROF_ICECREAM ].sSectorY = MAP_ROW_D; - break; + break; } } @@ -948,7 +949,7 @@ void HandleEarlyMorningEvents( void ) gMercProfiles[ CARMEN ].sSectorY = MAP_ROW_C; gMercProfiles[ CARMEN ].bSectorZ = 0; - // we should also reset # of terrorist heads and give him cash + // we should also reset # of terrorist heads and give him cash if (gMercProfiles[ CARMEN ].bNPCData2 > 0) { if (gMercProfiles[ CARMEN ].uiMoney < 10000) @@ -991,7 +992,7 @@ void HandleEarlyMorningEvents( void ) gMercProfiles[ CARMEN ].sSectorY = MAP_ROW_G; break; } - // he should have $5000... unless the player forgot to meet him + // he should have $5000... unless the player forgot to meet him if (gMercProfiles[ CARMEN ].uiMoney < 5000) { SetMoneyInSoldierProfile( CARMEN, 5000 ); @@ -1043,20 +1044,31 @@ void CheckForMissingHospitalSupplies( void ) for ( uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ ) { // loop through all items, look for ownership - if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].o.usItem == OWNERSHIP && gWorldItems[ uiLoop ].o.ItemData.Owner.ubOwnerCivGroup == DOCTORS_CIV_GROUP ) + if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].object.usItem == OWNERSHIP && gWorldItems[ uiLoop ].object[0]->data.owner.ubOwnerCivGroup == DOCTORS_CIV_GROUP ) { - GetItemPool( gWorldItems[ uiLoop ].sGridNo, &pItemPool, 0 ) ; - while( pItemPool ) + GetItemPoolFromGround( gWorldItems[ uiLoop ].sGridNo, &pItemPool ) ; + while( pItemPool ) { - pObj = &( gWorldItems[ pItemPool->iItemIndex ].o ); + pObj = &( gWorldItems[ pItemPool->iItemIndex ].object ); - if ( pObj->ItemData.Generic.bStatus[ 0 ] > 60 ) +#ifdef obsoleteCode + if ( (*pObj)[0]->data.objectStatus > 60 ) { if ( Item[pObj->usItem].firstaidkit || Item[pObj->usItem].medicalkit || pObj->usItem == REGEN_BOOSTER || pObj->usItem == ADRENALINE_BOOSTER ) { ubMedicalObjects++; } } +#endif//obsoleteCode + if ( Item[pObj->usItem].firstaidkit || Item[pObj->usItem].medicalkit || pObj->usItem == REGEN_BOOSTER || pObj->usItem == ADRENALINE_BOOSTER ) + { + for (StackedObjects::iterator iter = pObj->objectStack.begin(); iter != pObj->objectStack.end(); ++iter) { + if ( iter->data.objectStatus > 60 ) + { + ubMedicalObjects++; + } + } + } pItemPool = pItemPool->pNext; } @@ -1065,7 +1077,7 @@ void CheckForMissingHospitalSupplies( void ) if ( CheckFact( FACT_PLAYER_STOLE_MEDICAL_SUPPLIES_AGAIN, 0 ) == TRUE ) { - // player returning stuff! if back to full then can operate + // player returning stuff! if back to full then can operate if ( ubMedicalObjects >= gubCambriaMedicalObjects ) { SetFactFalse( FACT_PLAYER_STOLE_MEDICAL_SUPPLIES_AGAIN ); @@ -1073,7 +1085,7 @@ void CheckForMissingHospitalSupplies( void ) return; } } - + if ( ubMedicalObjects < gubCambriaMedicalObjects ) { // player's stolen something! @@ -1089,14 +1101,13 @@ void CheckForMissingHospitalSupplies( void ) SetFactTrue( FACT_PLAYER_STOLE_MEDICAL_SUPPLIES_AGAIN ); } } - + } void DropOffItemsInMeduna( UINT8 ubOrderNum ) { BOOLEAN fSectorLoaded = FALSE; - OBJECTTYPE Object; UINT32 uiCount = 0; OBJECTTYPE *pObject=NULL; UINT16 usNumberOfItems=0, usItem; @@ -1127,7 +1138,7 @@ void DropOffItemsInMeduna( UINT8 ubOrderNum ) ChangeStatusOfOpenableStructInUnloadedSector( MEDUNA_ITEM_DROP_OFF_SECTOR_X, MEDUNA_ITEM_DROP_OFF_SECTOR_Y, MEDUNA_ITEM_DROP_OFF_SECTOR_Z, MEDUNA_ITEM_DROP_OFF_GRIDNO, FALSE ); } - + for(i=0; iuiStatusFlags |= SOLDIER_DEAD; + + pSoldier->flags.uiStatusFlags |= SOLDIER_DEAD; // Set breath to 0! pSoldier->bBreathMax = pSoldier->bBreath = 0; // not asleep, DEAD! - pSoldier->fMercAsleep = FALSE; + pSoldier->flags.fMercAsleep = FALSE; //if the merc had life insurance @@ -169,7 +174,7 @@ void StrategicHandlePlayerTeamMercDeath( SOLDIERTYPE *pSoldier ) } -// MercDailyUpdate() gets called every day at midnight. If something is to happen to a merc that day, add an event for it. +// MercDailyUpdate() gets called every day at midnight. If something is to happen to a merc that day, add an event for it. void MercDailyUpdate() { INT32 cnt; @@ -179,8 +184,6 @@ void MercDailyUpdate() MERCPROFILESTRUCT *pProfile; UINT32 uiChance; INT32 iOffset = 0; - BOOLEAN fFoundSomeOneForMenuShowing = FALSE; - //if its the first day, leave if( GetWorldDay() == 1 ) return; @@ -211,10 +214,10 @@ void MercDailyUpdate() cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - - + + //loop though all the mercs - for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) + for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) { //if the merc is active if ( ( pSoldier->bActive )&&( pSoldier->bAssignment != ASSIGNMENT_POW ) && ( pSoldier->bAssignment != IN_TRANSIT ) ) @@ -228,13 +231,13 @@ void MercDailyUpdate() // ATE; Reset found something nice flag... pSoldier->usQuoteSaidFlags &= ( ~SOLDIER_QUOTE_SAID_FOUND_SOMETHING_NICE ); - // ATE: Decrement tolerance value... - pSoldier->bCorpseQuoteTolerance--; + // ATE: Decrement tolerance value... + pSoldier->bCorpseQuoteTolerance--; - if ( pSoldier->bCorpseQuoteTolerance < 0 ) - { - pSoldier->bCorpseQuoteTolerance = 0; - } + if ( pSoldier->bCorpseQuoteTolerance < 0 ) + { + pSoldier->bCorpseQuoteTolerance = 0; + } // CJC: For some personalities, reset personality quote said flag if ( pSoldier->ubProfile != NO_PROFILE ) @@ -266,13 +269,17 @@ void MercDailyUpdate() // player has hired him, so he'll eligible to get killed off on another job gMercProfiles[pSoldier->ubProfile].ubMiscFlags3 |= PROFILE_MISC_FLAG3_PLAYER_HAD_CHANCE_TO_HIRE; - - + + + //handle Slay differently if SlayForever is enabled + if( pSoldier->ubProfile == SLAY && gGameExternalOptions.fEnableSlayForever == TRUE) + { + } //if the character is an RPC - if( pSoldier->ubProfile >= FIRST_RPC && pSoldier->ubProfile < FIRST_NPC ) + else if( pSoldier->ubProfile >= FIRST_RPC && pSoldier->ubProfile < FIRST_NPC ) { INT16 sSalary = gMercProfiles[ pSoldier->ubProfile ].sSalary; - INT32 iMoneyOwedToMerc = 0; + INT32 iMoneyOwedToMerc = 0; //increment the number of days the mercs has been on the team pSoldier->iTotalContractLength++; @@ -353,7 +360,7 @@ void MercDailyUpdate() // if active, here, & alive (POW is ok, don't care) if( ( pSoldier->bActive ) && ( pSoldier->bAssignment != ASSIGNMENT_DEAD ) && - ( pSoldier->bAssignment != IN_TRANSIT ) ) + ( pSoldier->bAssignment != IN_TRANSIT ) ) { // increment the "man days" played counter for each such merc in the player's employment gStrategicStatus.uiManDaysPlayed++; @@ -438,7 +445,7 @@ void MercDailyUpdate() //if the merc CAN become ready if( pProfile->bMercStatus != MERC_FIRED_AS_A_POW ) { - pProfile->bMercStatus = MERC_OK; + pProfile->bMercStatus = MERC_OK; // if the player has left a message for this merc if ( pProfile->ubMiscFlags3 & PROFILE_MISC_FLAG3_PLAYER_LEFT_MSG_FOR_MERC_AT_AIM ) @@ -502,7 +509,7 @@ void MercDailyUpdate() HandleSlayDailyEvent( ); // rebuild list for mapscreen - ReBuildCharactersList( ); + ReBuildCharactersList( ); } /* @@ -519,7 +526,7 @@ void BuildMercQuitList( SOLDIERTYPE *pMercList ) bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; //loop though all the mercs - for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++, iCounter++ ) + for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++, iCounter++ ) { if ( pSoldier->bActive ) { @@ -542,27 +549,27 @@ void BuildMercQuitList( SOLDIERTYPE *pMercList ) if( IsTheSoldierAliveAndConcious( MercPtrs[ cntB ] ) ) { // swap - pSoldier = MercPtrs[ cntB ]; - MercPtrs[ cntB ] = MercPtrs[ cnt ]; + pSoldier = MercPtrs[ cntB ]; + MercPtrs[ cntB ] = MercPtrs[ cnt ]; MercPtrs[ cnt ] = pSoldier; } } } - else if( MercPtrs[ cntB ]->ubWhatKindOfMercAmI == MERC_TYPE__AIM ) + else if( MercPtrs[ cntB ]->ubWhatKindOfMercAmI == MERC_TYPE__AIM ) { if( MercPtrs[ cntB ]->iEndofContractTime < MercPtrs[ cnt ]->iEndofContractTime ) { // swap - pSoldier = MercPtrs[ cntB ]; - MercPtrs[ cntB ] = MercPtrs[ cnt ]; + pSoldier = MercPtrs[ cntB ]; + MercPtrs[ cntB ] = MercPtrs[ cnt ]; MercPtrs[ cnt ] = pSoldier; } } else { // not a hirable guy, move to the botton - pSoldier = MercPtrs[ cnt ]; - MercPtrs[ cnt ] = MercPtrs[ cntB ]; + pSoldier = MercPtrs[ cnt ]; + MercPtrs[ cnt ] = MercPtrs[ cntB ]; MercPtrs[ cntB ] = pSoldier; } } @@ -582,11 +589,11 @@ void HandleMercsAboutToLeave( SOLDIERTYPE *pMercList ) if( iCounter == 0 ) { // first guy, if he no leave today, no one is leave, go home - if( ( pSoldier->ubWhatKindOfMercAmI != MERC_TYPE__MERC ) && ( pSoldier->ubWhatKindOfMercAmI != MERC_TYPE__AIM ) ) + if( ( pSoldier->ubWhatKindOfMercAmI != MERC_TYPE__MERC ) && ( pSoldier->ubWhatKindOfMercAmI != MERC_TYPE__AIM ) ) { return; } - else + else { if( ( pSoldier->iEndofContractTime / 1440 ) > (INT32)GetWorldDay( ) ) { @@ -633,7 +640,7 @@ void MercsContractIsFinished( UINT8 ubID ) { fShowContractMenu = FALSE; } - + // go to mapscreen SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_ENTER_MAPSCREEN,0,0,0,0,0 ); @@ -694,7 +701,6 @@ void RPCWhineAboutNoPay( UINT8 ubID ) // OK loop through and check! BOOLEAN SoldierHasWorseEquipmentThanUsedTo( SOLDIERTYPE *pSoldier ) { - INT32 cnt; UINT16 usItem; INT32 bBestArmour = -1; INT32 bBestArmourIndex = -1; @@ -702,13 +708,13 @@ BOOLEAN SoldierHasWorseEquipmentThanUsedTo( SOLDIERTYPE *pSoldier ) INT32 bBestGunIndex = -1; - for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ ) + for ( UINT32 cnt = 0; cnt < pSoldier->inv.size(); cnt++ ) { - usItem = pSoldier->inv[ cnt ].usItem; - // Look for best gun/armour - if ( usItem != NOTHING ) + if ( pSoldier->inv[cnt].exists() == true ) { + usItem = pSoldier->inv[ cnt ].usItem; + // Check if it's a gun if ( Item[ usItem ].usItemClass & IC_GUN ) { @@ -735,11 +741,11 @@ BOOLEAN SoldierHasWorseEquipmentThanUsedTo( SOLDIERTYPE *pSoldier ) // this of course assumes default morale is 50 if ( bBestGun != -1 ) { - bBestGun = (bBestGun * (50 + pSoldier->bMorale)) / 100; + bBestGun = (bBestGun * (50 + pSoldier->aiData.bMorale)) / 100; } if ( bBestArmour != -1 ) { - bBestArmour = (bBestArmour * (50 + pSoldier->bMorale)) / 100; + bBestArmour = (bBestArmour * (50 + pSoldier->aiData.bMorale)) / 100; } // OK, check values! @@ -758,7 +764,7 @@ void MercComplainAboutEquipment( UINT8 ubProfile ) { SOLDIERTYPE *pSoldier; - if ( ubProfile == LARRY_NORMAL ) + if ( ubProfile == LARRY_NORMAL ) { if ( CheckFact( FACT_LARRY_CHANGED, 0 ) ) { @@ -777,7 +783,7 @@ void MercComplainAboutEquipment( UINT8 ubProfile ) if ( pSoldier != NULL ) { - if ( pSoldier->bLife >= OKLIFE && pSoldier->fMercAsleep != TRUE && pSoldier->bAssignment < ON_DUTY ) + if ( pSoldier->stats.bLife >= OKLIFE && pSoldier->flags.fMercAsleep != TRUE && pSoldier->bAssignment < ON_DUTY ) { //ATE: Double check that this problem still exists! if ( SoldierHasWorseEquipmentThanUsedTo( pSoldier ) ) @@ -809,8 +815,8 @@ void UpdateBuddyAndHatedCounters( void ) bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; //loop though all the mercs - for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; bMercID++,pSoldier++) - { + for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; bMercID++,pSoldier++) + { fSameGroupOnly = FALSE; //if the merc is active and on a combat assignment @@ -829,7 +835,7 @@ void UpdateBuddyAndHatedCounters( void ) bOtherID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; for ( pOtherSoldier = MercPtrs[ bOtherID ]; bOtherID <= bLastTeamID; bOtherID++, pOtherSoldier++) - { + { // is this guy in the same sector and on active duty (or in the same moving group) if (bOtherID != bMercID && pOtherSoldier->bActive && pOtherSoldier->bAssignment < ON_DUTY ) @@ -846,12 +852,12 @@ void UpdateBuddyAndHatedCounters( void ) { // check to see if the location is the same if (pOtherSoldier->sSectorX != pSoldier->sSectorX || - pOtherSoldier->sSectorY != pSoldier->sSectorY || + pOtherSoldier->sSectorY != pSoldier->sSectorY || pOtherSoldier->bSectorZ != pSoldier->bSectorZ) { continue; } - + // if the OTHER soldier is in motion then we don't do anything! if (pOtherSoldier->ubGroupID != 0 && PlayerIDGroupInMotion( pOtherSoldier->ubGroupID )) { @@ -875,7 +881,7 @@ void UpdateBuddyAndHatedCounters( void ) pProfile->bHatedCount[iLoop]--; if ( pProfile->bHatedCount[iLoop] == 0 && pSoldier->bInSector && gTacticalStatus.fEnemyInSector ) { - // just reduced count to 0 but we have enemy in sector... + // just reduced count to 0 but we have enemy in sector... pProfile->bHatedCount[iLoop] = 1; } else if (pProfile->bHatedCount[iLoop] > 0 && (pProfile->bHatedCount[iLoop] == pProfile->bHatedTime[iLoop] / 2 || ( pProfile->bHatedCount[iLoop] < pProfile->bHatedTime[iLoop] / 2 && pProfile->bHatedCount[iLoop] % TIME_BETWEEN_HATED_COMPLAINTS == 0 ) ) ) @@ -954,7 +960,7 @@ void UpdateBuddyAndHatedCounters( void ) { TacticalCharacterDialogue( pSoldier, QUOTE_HATED_MERC_TWO ); } - } + } } } break; @@ -966,7 +972,7 @@ void UpdateBuddyAndHatedCounters( void ) pProfile->bLearnToHateCount--; if ( pProfile->bLearnToHateCount == 0 && pSoldier->bInSector && gTacticalStatus.fEnemyInSector ) { - // just reduced count to 0 but we have enemy in sector... + // just reduced count to 0 but we have enemy in sector... pProfile->bLearnToHateCount = 1; } else if (pProfile->bLearnToHateCount > 0 && (pProfile->bLearnToHateCount == pProfile->bLearnToHateTime / 2 || pProfile->bLearnToHateCount < pProfile->bLearnToHateTime / 2 && pProfile->bLearnToHateCount % TIME_BETWEEN_HATED_COMPLAINTS == 0 ) ) @@ -995,7 +1001,7 @@ void UpdateBuddyAndHatedCounters( void ) TacticalCharacterDialogue( pSoldier, QUOTE_LEARNED_TO_HATE_MERC ); } - } + } if (pProfile->bLearnToHateCount < pProfile->bLearnToHateTime / 2) { // gradual opinion drop @@ -1020,10 +1026,10 @@ void UpdateBuddyAndHatedCounters( void ) if ( pProfile->ubTimeTillNextHatedComplaint == 0 ) { // complain! - TacticalCharacterDialogue( pSoldier, QUOTE_LEARNED_TO_HATE_MERC ); + TacticalCharacterDialogue( pSoldier, QUOTE_LEARNED_TO_HATE_MERC ); } } - } + } break; case 3: if (pProfile->bLearnToLikeCount > 0 && pProfile->bLearnToLike == ubOtherProfileID) @@ -1036,14 +1042,14 @@ void UpdateBuddyAndHatedCounters( void ) pProfile->bMercOpinion[ubOtherProfileID] = BUDDY_OPINION; } else if (pProfile->bLearnToLikeCount < pProfile->bLearnToLikeTime / 2) - { + { // increase opinion of them! pProfile->bMercOpinion[ubOtherProfileID] += (BUDDY_OPINION - pProfile->bMercOpinion[ubOtherProfileID]) / (pProfile->bLearnToLikeCount + 1); break; } } break; - } + } } } } @@ -1060,8 +1066,8 @@ void HourlyCamouflageUpdate( void ) bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; // loop through all mercs - for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; bMercID++,pSoldier++) - { + for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; bMercID++,pSoldier++) + { if ( pSoldier->bActive ) { // if the merc has non-zero camo, degrade it by 1% @@ -1106,8 +1112,8 @@ void HourlyCamouflageUpdate( void ) { // Reload palettes.... if ( pSoldier->bInSector ) - { - CreateSoldierPalettes( pSoldier ); + { + pSoldier->CreateSoldierPalettes( ); } ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[STR_CAMMO_WORN_OFF], pSoldier->name ); @@ -1116,22 +1122,22 @@ void HourlyCamouflageUpdate( void ) } // if the merc has non-zero monster smell, degrade it by 1 - if ( pSoldier->bMonsterSmell > 0 ) + if ( pSoldier->aiData.bMonsterSmell > 0 ) { - pSoldier->bMonsterSmell--; + pSoldier->aiData.bMonsterSmell--; /* - if (pSoldier->bMonsterSmell == 0) + if (pSoldier->aiData.bMonsterSmell == 0) { // Reload palettes.... if ( pSoldier->bInSector ) - { - CreateSoldierPalettes( pSoldier ); + { + pSoldier->CreateSoldierPalettes( ); } ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[STR_CAMMO_WORN_OFF], pSoldier->name ); - DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); + DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); } */ } diff --git a/Strategic/Strategic Merc Handler.h b/Strategic/Strategic Merc Handler.h index edfbd73f..1f9b4968 100644 --- a/Strategic/Strategic Merc Handler.h +++ b/Strategic/Strategic Merc Handler.h @@ -1,6 +1,8 @@ #ifndef _STRATEGIC_MERC_HANDLER_H_ #define _STRATEGIC_MERC_HANDLER_H_ +//forward declarations of common classes to eliminate includes +class SOLDIERTYPE; void StrategicHandlePlayerTeamMercDeath( SOLDIERTYPE *pSoldier ); void MercDailyUpdate(); diff --git a/Strategic/Strategic Mines.cpp b/Strategic/Strategic Mines.cpp index eeb6cc58..0d8cacad 100644 --- a/Strategic/Strategic Mines.cpp +++ b/Strategic/Strategic Mines.cpp @@ -67,12 +67,12 @@ MINE_STATUS_TYPE gMineStatus[ MAX_NUMBER_OF_MINES ]; // this table holds mine values that never change and don't need to be saved MINE_LOCATION_TYPE gMineLocation[MAX_NUMBER_OF_MINES] = { - { 4, 4, SAN_MONA }, + { 4, 4, SAN_MONA }, { 13, 4, DRASSEN }, { 14, 9, ALMA }, - { 8, 8, CAMBRIA }, - { 2, 2, CHITZENA }, - { 3, 8, GRUMM }, + { 8, 8, CAMBRIA }, + { 2, 2, CHITZENA }, + { 3, 8, GRUMM }, }; // the are not being randomized at all at this time @@ -87,16 +87,16 @@ UINT8 gubMineTypes[]={ // These values also determine the most likely ratios of mine sizes after random production increases are done UINT32 guiMinimumMineProduction[]={ - 0, // SAN MONA - 1000, // DRASSEN - 1500, // ALMA - 1500, // CAMBRIA - 500, // CHITZENA - 2000, // GRUMM + 0, // SAN MONA + 1000, // DRASSEN + 1500, // ALMA + 1500, // CAMBRIA + 500, // CHITZENA + 2000, // GRUMM }; -HEAD_MINER_TYPE gHeadMinerData[NUM_HEAD_MINERS] = +HEAD_MINER_TYPE gHeadMinerData[NUM_HEAD_MINERS] = { // Profile # running out creatures! all dead! creatures again! external face graphic { FRED, 17, 18, 27, 26, MINER_FRED_EXTERNAL_FACE }, @@ -159,7 +159,7 @@ void InitializeMines( void ) gMineStatus->fShutDownIsPermanent = FALSE; } - // randomize the exact size each mine. The total production is always the same and depends on the game difficulty, + // randomize the exact size each mine. The total production is always the same and depends on the game difficulty, // but some mines will produce more in one game than another, while others produce less // adjust for game difficulty @@ -195,7 +195,7 @@ void InitializeMines( void ) } - // choose which mine will run out of production. This will never be the Alma mine or an empty mine (San Mona)... + // choose which mine will run out of production. This will never be the Alma mine or an empty mine (San Mona)... do { ubDepletedMineIndex = ( UINT8 ) Random(MAX_NUMBER_OF_MINES); @@ -271,7 +271,7 @@ void HourlyMinesUpdate(void) IssueHeadMinerQuote( ubMineIndex, HEAD_MINER_STRATEGIC_QUOTE_CREATURES_GONE ); } - //Force the creatures to avoid the mine for a period of time. This gives the + //Force the creatures to avoid the mine for a period of time. This gives the //player a chance to rest and decide how to deal with the problem. ForceCreaturesToAvoidMineTemporarily( ubMineIndex ); @@ -282,7 +282,7 @@ void HourlyMinesUpdate(void) else // mine is monster infested { // 'Der be monsters crawling around in there, lad!!! - + // if it's still producing if (!IsMineShutDown( ubMineIndex )) { @@ -312,7 +312,7 @@ void HourlyMinesUpdate(void) IssueHeadMinerQuote( ubMineIndex, ubQuoteType ); } - // and immediately halt all work at the mine (whether it's ours or the queen's). This is a temporary shutdown + // and immediately halt all work at the mine (whether it's ours or the queen's). This is a temporary shutdown ShutOffMineProduction( ubMineIndex ); } } @@ -350,7 +350,7 @@ UINT32 GetMaxDailyRemovalFromMine( INT8 bMineIndex ) { UINT32 uiAmtExtracted; - // returns max amount that can be mined in one day + // returns max amount that can be mined in one day Assert( ( bMineIndex >= 0 ) && ( bMineIndex < MAX_NUMBER_OF_MINES ) ); @@ -405,7 +405,6 @@ UINT32 ExtractOreFromMine( INT8 bMineIndex, UINT32 uiAmount ) { // will remove the ore from the mine and return the amount that was removed UINT32 uiAmountExtracted = 0; - UINT32 uiOreRunningOutPoint = 0; INT16 sSectorX, sSectorY; @@ -437,11 +436,11 @@ UINT32 ExtractOreFromMine( INT8 bMineIndex, UINT32 uiAmount ) GetMineSector( bMineIndex, &sSectorX, &sSectorY ); StrategicHandleMineThatRanOut( ( UINT8 ) SECTOR( sSectorX, sSectorY ) ); - AddHistoryToPlayersLog( HISTORY_MINE_RAN_OUT, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY ); + AddHistoryToPlayersLog( HISTORY_MINE_RAN_OUT, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY ); } else // still some left after this extraction { - // set amount used, and decrement ore remaining in mine + // set amount used, and decrement ore remaining in mine uiAmountExtracted = uiAmount; gMineStatus[ bMineIndex ].uiRemainingOreSupply -= uiAmount; @@ -463,7 +462,7 @@ UINT32 ExtractOreFromMine( INT8 bMineIndex, UINT32 uiAmount ) // that mine's head miner tells player that the mine is running out IssueHeadMinerQuote( bMineIndex, HEAD_MINER_STRATEGIC_QUOTE_RUNNING_OUT ); gMineStatus[ bMineIndex ].fWarnedOfRunningOut = TRUE; - AddHistoryToPlayersLog( HISTORY_MINE_RUNNING_OUT, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY ); + AddHistoryToPlayersLog( HISTORY_MINE_RUNNING_OUT, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY ); } } } @@ -479,7 +478,7 @@ INT32 GetAvailableWorkForceForMineForPlayer( INT8 bMineIndex ) INT8 bTownId = 0; // return the loyalty of the town associated with the mine - + Assert( ( bMineIndex >= 0 ) && ( bMineIndex < MAX_NUMBER_OF_MINES ) ); // if mine is shut down @@ -493,7 +492,7 @@ INT32 GetAvailableWorkForceForMineForPlayer( INT8 bMineIndex ) { return ( 0 ); } - + bTownId = gMineLocation[ bMineIndex ].bAssociatedTown; @@ -503,7 +502,7 @@ INT32 GetAvailableWorkForceForMineForPlayer( INT8 bMineIndex ) // get workforce size (is 0-100 based on local town's loyalty) iWorkForceSize = gTownLoyalty[ bTownId ].ubRating; -/* +/* // adjust for monster infestation iWorkForceSize *= gubMonsterMineInfestation[ gMineStatus[ bMineIndex ].bMonsters ]; iWorkForceSize /= 100; @@ -523,7 +522,7 @@ INT32 GetAvailableWorkForceForMineForEnemy( INT8 bMineIndex ) INT8 bTownId = 0; // return the loyalty of the town associated with the mine - + Assert( ( bMineIndex >= 0 ) && ( bMineIndex < MAX_NUMBER_OF_MINES ) ); // if mine is shut down @@ -534,7 +533,7 @@ INT32 GetAvailableWorkForceForMineForEnemy( INT8 bMineIndex ) bTownId = gMineLocation[ bMineIndex ].bAssociatedTown; - if( GetTownSectorSize( bTownId ) == 0 ) + if( GetTownSectorSize( bTownId ) == 0 ) { return 0; } @@ -542,7 +541,7 @@ INT32 GetAvailableWorkForceForMineForEnemy( INT8 bMineIndex ) // get workforce size (is 0-100 based on REVERSE of local town's loyalty) iWorkForceSize = 100 - gTownLoyalty[ bTownId ].ubRating; -/* +/* // adjust for monster infestation iWorkForceSize *= gubMonsterMineInfestation[ gMineStatus[ bMineIndex ].bMonsters ]; iWorkForceSize /= 100; @@ -599,7 +598,7 @@ INT32 MineAMine( INT8 bMineIndex ) } - // who controls the PRODUCTION in the mine ? (Queen receives production unless player has spoken to the head miner) + // who controls the PRODUCTION in the mine ? (Queen receives production unless player has spoken to the head miner) if( PlayerControlsMine(bMineIndex) ) { // player controlled @@ -628,7 +627,7 @@ INT32 MineAMine( INT8 bMineIndex ) { // we didn't want mines to run out without player ever even going to them, so now the queen doesn't reduce the // amount remaining until the mine has produced for the player first (so she'd have to capture it). - + // WANNE: We do not want to give money to the player, when the queen has captured the mine! if ( gMineStatus[ bMineIndex ].fMineHasProducedForPlayer ) { @@ -667,7 +666,7 @@ void HandleIncomeFromMines( void ) } if( iIncome ) { - AddTransactionToPlayersBook( DEPOSIT_FROM_SILVER_MINE, 0, GetWorldTotalMin( ), iIncome ); + AddTransactionToPlayersBook( DEPOSIT_FROM_SILVER_MINE, 0, GetWorldTotalMin( ), iIncome ); } } @@ -690,7 +689,7 @@ UINT32 PredictDailyIncomeFromAMine( INT8 bMineIndex ) uiAmtExtracted = gMineStatus[ bMineIndex ].uiRemainingOreSupply; } } - + return( uiAmtExtracted ); } @@ -865,7 +864,7 @@ void ShutOffMineProduction( INT8 bMineIndex ) if ( !gMineStatus[ bMineIndex ].fShutDown ) { gMineStatus[ bMineIndex ].fShutDown = TRUE; - AddHistoryToPlayersLog( HISTORY_MINE_SHUTDOWN, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY ); + AddHistoryToPlayersLog( HISTORY_MINE_SHUTDOWN, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY ); } } @@ -879,7 +878,7 @@ void RestartMineProduction( INT8 bMineIndex ) if ( gMineStatus[ bMineIndex ].fShutDown ) { gMineStatus[ bMineIndex ].fShutDown = FALSE; - AddHistoryToPlayersLog( HISTORY_MINE_REOPENED, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY ); + AddHistoryToPlayersLog( HISTORY_MINE_REOPENED, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY ); } } } @@ -1019,7 +1018,7 @@ UINT8 GetHeadMinersMineIndex( UINT8 ubMinerProfileId) } } - // not found! Illegal profile id receieved or something is very wrong + // not found! Illegal profile id receieved or something is very wrong Assert(FALSE); return( 0 ); } @@ -1030,11 +1029,11 @@ void PlayerSpokeToHeadMiner( UINT8 ubMinerProfileId ) UINT8 ubMineIndex; ubMineIndex = GetHeadMinersMineIndex( ubMinerProfileId ); - - // if this is our first time set a history fact + + // if this is our first time set a history fact if( gMineStatus[ ubMineIndex ].fSpokeToHeadMiner == FALSE ) { - AddHistoryToPlayersLog( HISTORY_TALKED_TO_MINER, gMineLocation[ ubMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ ubMineIndex ].sSectorX, gMineLocation[ ubMineIndex ].sSectorY ); + AddHistoryToPlayersLog( HISTORY_TALKED_TO_MINER, gMineLocation[ ubMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ ubMineIndex ].sSectorX, gMineLocation[ ubMineIndex ].sSectorY ); gMineStatus[ ubMineIndex ].fSpokeToHeadMiner = TRUE; } } @@ -1187,7 +1186,7 @@ BOOLEAN HasHisMineBeenProducingForPlayerForSomeTime( UINT8 ubMinerProfileId ) ubMineIndex = GetHeadMinersMineIndex( ubMinerProfileId ); - if ( gMineStatus[ ubMineIndex ].fMineHasProducedForPlayer && + if ( gMineStatus[ ubMineIndex ].fMineHasProducedForPlayer && ( ( GetWorldTotalMin() - gMineStatus[ ubMineIndex ].uiTimePlayerProductionStarted ) >= ( 24 * 60 ) ) ) { return ( TRUE ); @@ -1287,10 +1286,10 @@ BOOLEAN PlayerForgotToTakeOverMine( UINT8 ubMineIndex ) // player hasn't spoken to the head miner, but hasn't attacked him either // miner is alive if ( (StrategicMap[( gMineLocation[ ubMineIndex ].sSectorX ) + ( MAP_WORLD_X * ( gMineLocation[ ubMineIndex ].sSectorY ) )].fEnemyControlled == FALSE ) && - ( !pMineStatus->fEmpty ) && - ( !pMineStatus->fSpokeToHeadMiner ) && - ( !pMineStatus->fAttackedHeadMiner ) && - ( gMercProfiles[ GetHeadMinerProfileIdForMine( ubMineIndex ) ].bLife > 0 ) ) + ( !pMineStatus->fEmpty ) && + ( !pMineStatus->fSpokeToHeadMiner ) && + ( !pMineStatus->fAttackedHeadMiner ) && + ( gMercProfiles[ GetHeadMinerProfileIdForMine( ubMineIndex ) ].bLife > 0 ) ) { return( TRUE ); } diff --git a/Strategic/Strategic Mines.h b/Strategic/Strategic Mines.h index 4aa48550..c2082aba 100644 --- a/Strategic/Strategic Mines.h +++ b/Strategic/Strategic Mines.h @@ -8,7 +8,7 @@ // the mines enum{ - MINE_SAN_MONA = 0, + MINE_SAN_MONA = 0, MINE_DRASSEN, MINE_ALMA, MINE_CAMBRIA, @@ -36,13 +36,13 @@ enum{ // monster infestatation level, as percieved by the villagers enum{ - MINES_NO_MONSTERS = 0, // nothing there at all - MINES_TRACE_MONSTERS, // monsters leave traces behind, but no one has seen them yet - MINES_SOME_MONSTERS, // there have been sightings but no one believes the witnesses - MINES_MODERATE_MONSTERS, // scattered reports of monsters in lower levels, leaves workers uneasy - MINES_HIGH_MONSTERS, // workers know they are there and all but a few refuse to work - MINES_RAMPANT_MONSTERS, // the few that go down don't seem to return, no one wants to work period - MINES_MONSTERS_SURFACE, // monsters are coming out of the mines into the town looking for any edibles + MINES_NO_MONSTERS = 0, // nothing there at all + MINES_TRACE_MONSTERS, // monsters leave traces behind, but no one has seen them yet + MINES_SOME_MONSTERS, // there have been sightings but no one believes the witnesses + MINES_MODERATE_MONSTERS, // scattered reports of monsters in lower levels, leaves workers uneasy + MINES_HIGH_MONSTERS, // workers know they are there and all but a few refuse to work + MINES_RAMPANT_MONSTERS, // the few that go down don't seem to return, no one wants to work period + MINES_MONSTERS_SURFACE, // monsters are coming out of the mines into the town looking for any edibles }; // head miner quote types @@ -59,36 +59,36 @@ enum{ // the strategic mine structures typedef struct MINE_LOCATION_TYPE { - INT16 sSectorX; // x value of sector mine is in - INT16 sSectorY; // y value of sector mine is in - INT8 bAssociatedTown; // associated town of this mine + INT16 sSectorX; // x value of sector mine is in + INT16 sSectorY; // y value of sector mine is in + INT8 bAssociatedTown; // associated town of this mine } MINE_LOCATION_TYPE; typedef struct MINE_STATUS_TYPE { - UINT8 ubMineType; // type of mine (silver or gold) - BYTE filler1[3]; - UINT32 uiMaxRemovalRate; // fastest rate we can move ore from this mine in period + UINT8 ubMineType; // type of mine (silver or gold) + BYTE filler1[3]; + UINT32 uiMaxRemovalRate; // fastest rate we can move ore from this mine in period - UINT32 uiRemainingOreSupply; // the total value left to this mine (-1 means unlimited) - UINT32 uiOreRunningOutPoint; // when supply drop below this, workers tell player the mine is running out of ore + UINT32 uiRemainingOreSupply; // the total value left to this mine (-1 means unlimited) + UINT32 uiOreRunningOutPoint; // when supply drop below this, workers tell player the mine is running out of ore - BOOLEAN fEmpty; // whether no longer minable - BOOLEAN fRunningOut; // whether mine is beginning to run out - BOOLEAN fWarnedOfRunningOut; // whether mine foreman has already told player the mine's running out - BOOLEAN fShutDownIsPermanent; // means will never produce again in the game (head miner was attacked & died/quit) - BOOLEAN fShutDown; // TRUE means mine production has been shut off - BOOLEAN fPrevInvadedByMonsters; // whether or not mine has been previously invaded by monsters - BOOLEAN fSpokeToHeadMiner; // player doesn't receive income from mine without speaking to the head miner first - BOOLEAN fMineHasProducedForPlayer; // player has earned income from this mine at least once + BOOLEAN fEmpty; // whether no longer minable + BOOLEAN fRunningOut; // whether mine is beginning to run out + BOOLEAN fWarnedOfRunningOut; // whether mine foreman has already told player the mine's running out + BOOLEAN fShutDownIsPermanent; // means will never produce again in the game (head miner was attacked & died/quit) + BOOLEAN fShutDown; // TRUE means mine production has been shut off + BOOLEAN fPrevInvadedByMonsters; // whether or not mine has been previously invaded by monsters + BOOLEAN fSpokeToHeadMiner; // player doesn't receive income from mine without speaking to the head miner first + BOOLEAN fMineHasProducedForPlayer; // player has earned income from this mine at least once - BOOLEAN fQueenRetookProducingMine; // whether or not queen ever retook a mine after a player had produced from it - BOOLEAN fAttackedHeadMiner; // player has attacked the head miner, shutting down mine & decreasing loyalty - UINT16 usValidDayCreaturesCanInfest; //Creatures will be permitted to spread if the game day is greater than this value. - UINT32 uiTimePlayerProductionStarted; // time in minutes when 'fMineHasProducedForPlayer' was first set + BOOLEAN fQueenRetookProducingMine; // whether or not queen ever retook a mine after a player had produced from it + BOOLEAN fAttackedHeadMiner; // player has attacked the head miner, shutting down mine & decreasing loyalty + UINT16 usValidDayCreaturesCanInfest; //Creatures will be permitted to spread if the game day is greater than this value. + UINT32 uiTimePlayerProductionStarted; // time in minutes when 'fMineHasProducedForPlayer' was first set - BYTE filler[11]; // reserved for expansion + BYTE filler[11]; // reserved for expansion } MINE_STATUS_TYPE; diff --git a/Strategic/Strategic Movement Costs.cpp b/Strategic/Strategic Movement Costs.cpp index e73ad147..fcc04edb 100644 --- a/Strategic/Strategic Movement Costs.cpp +++ b/Strategic/Strategic Movement Costs.cpp @@ -32,14 +32,14 @@ typedef struct //CHAR8 szCustomShortname[MAX_SECTORNAME_LENGTH+1]; UINT32 uiRowNumber; - UINT32 uiColNumber; + UINT32 uiColNumber; UINT32 travRating; UINT32 travNorth; UINT32 travEast; UINT32 travSouth; UINT32 travWest; UINT32 travHere; - + } smctableParseData; /** Process the opening tag in this expat callback. @@ -54,7 +54,7 @@ smctableStartElementHandle(void *userData, const XML_Char *name, const XML_Char { if(strcmp(name, "StrategicMovementCosts") == 0 && pData->curElement == SMCTABLE_ELEMENT_NONE) { - // Enter + // Enter pData->curElement = SMCTABLE_ELEMENT_STRATEGICMOVEMENTCOSTS; pData->maxReadDepth++; //we are not skipping this element //fprintf (outfile, "Entering Strategic Movement Costs\n"); @@ -160,8 +160,7 @@ smctableEndElementHandle(void *userData, const XML_Char *name) // We've read in a complete section. Process the contents of pData into the // SectionInfo array SECTORINFO *pSector; - UINT32 sec_index = ((pData->uiRowNumber - 1) * 16) + (pData->uiColNumber - 1); - pSector = &SectorInfo[ ((pData->uiRowNumber - 1) * 16) + (pData->uiColNumber - 1) ]; + pSector = &SectorInfo[ ((pData->uiRowNumber - 1) * 16) + (pData->uiColNumber - 1) ]; pSector->ubTravelRating = pData->travRating; pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = pData->travNorth; pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = pData->travEast; @@ -169,12 +168,12 @@ smctableEndElementHandle(void *userData, const XML_Char *name) pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = pData->travWest; pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = pData->travHere; //strncpy(pSector->szCustomShortname, pData->szCustomShortname, MAX_SECTORNAME_LENGTH); - //fprintf (outfile, "Added SectorInfo #%d: y %d, x %d, name: %s, tr %d, n %d, e %d, s %d, w %d, h %d\n", + //fprintf (outfile, "Added SectorInfo #%d: y %d, x %d, name: %s, tr %d, n %d, e %d, s %d, w %d, h %d\n", // sec_index, pData->uiRowNumber, pData->uiColNumber, pData->szCustomShortname, - // pSector->ubTravelRating, pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ], - // pSector->ubTraversability[ EAST_STRATEGIC_MOVE ], - // pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ], - // pSector->ubTraversability[ WEST_STRATEGIC_MOVE ], + // pSector->ubTravelRating, pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ], + // pSector->ubTraversability[ EAST_STRATEGIC_MOVE ], + // pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ], + // pSector->ubTraversability[ WEST_STRATEGIC_MOVE ], // pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ]); // And finish the sector. @@ -292,7 +291,7 @@ smctableEndElementHandle(void *userData, const XML_Char *name) { trav_type = SWAMP_ROAD; } - else + else { trav_type = GROUNDBARRIER; } @@ -340,7 +339,7 @@ smctableEndElementHandle(void *userData, const XML_Char *name) } pData->currentDepth--; - //fclose (outfile); + //fclose (outfile); } @@ -351,7 +350,7 @@ BOOLEAN ReadInStrategicMovementCosts(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + smctableParseData pData; // Open weapons file @@ -382,7 +381,7 @@ BOOLEAN ReadInStrategicMovementCosts(STR fileName) memset(&pData,0,sizeof(pData)); XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -467,7 +466,7 @@ BOOLEAN WriteInStrategicMovementCosts(STR fileName) case SPARSE: fprintf (outfile, "SPARSE"); break; - case DENSE: + case DENSE: fprintf (outfile, "DENSE"); break; case SWAMP: @@ -556,7 +555,7 @@ BOOLEAN WriteInStrategicMovementCosts(STR fileName) fprintf (outfile, "\n"); fclose(outfile); - + return (TRUE); } @@ -569,55 +568,55 @@ BOOLEAN WriteInStrategicMovementCosts(STR fileName) // //FILE *outfile = fopen("C:/JA2/debug.log", "a"); // { //Simply make sure all shared borders between sectors match. // INT32 x,y; -// OutputDebugString( "STRATEGIC MOVE COSTS: Testing validity of data (okay if no following debug msgs)...\n"); +// OutputDebugString( "STRATEGIC MOVE COSTS: Testing validity of data (okay if no following debug msgs)...\n"); // for( y = 1; y <= 16; y++ ) for( x = 1; x <= 16; x++ ) // { // if( y > 1 ) // { // if( SectorInfo[ SECTOR(x,y) ].ubTraversability[ NORTH_STRATEGIC_MOVE ] != -// SectorInfo[ SECTOR(x,y-1) ].ubTraversability[ SOUTH_STRATEGIC_MOVE ] ) +// SectorInfo[ SECTOR(x,y-1) ].ubTraversability[ SOUTH_STRATEGIC_MOVE ] ) // { //north -// OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: North mismatch for sector %c%d\n", y+'A'-1, x ) ); -// //fprintf(outfile, "STRATEGIC MOVE COSTS: North mismatch for sector %c%d\n", y+'A'-1, x); +// OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: North mismatch for sector %c%d\n", y+'A'-1, x ) ); +// //fprintf(outfile, "STRATEGIC MOVE COSTS: North mismatch for sector %c%d\n", y+'A'-1, x); // } // if( y == 16 && SectorInfo[ SECTOR(x,y) ].ubTraversability[ SOUTH_STRATEGIC_MOVE ] != EDGEOFWORLD ) // { -// OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: South should be EDGEOFWORLD for sector %c%d\n", y+'A'-1, x ) ); -// //fprintf(outfile, "STRATEGIC MOVE COSTS: South should be EDGEOFWORLD for sector %c%d\n", y+'A'-1, x ); +// OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: South should be EDGEOFWORLD for sector %c%d\n", y+'A'-1, x ) ); +// //fprintf(outfile, "STRATEGIC MOVE COSTS: South should be EDGEOFWORLD for sector %c%d\n", y+'A'-1, x ); // } // } -// else +// else // { // if( SectorInfo[ SECTOR(x,y) ].ubTraversability[ SOUTH_STRATEGIC_MOVE ] != -// SectorInfo[ SECTOR(x,y+1) ].ubTraversability[ NORTH_STRATEGIC_MOVE ] ) +// SectorInfo[ SECTOR(x,y+1) ].ubTraversability[ NORTH_STRATEGIC_MOVE ] ) // { //south -// OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: South mismatch for sector %c%d\n", y+'A'-1, x ) ); -// //fprintf(outfile, "STRATEGIC MOVE COSTS: South mismatch for sector %c%d\n", y+'A'-1, x); +// OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: South mismatch for sector %c%d\n", y+'A'-1, x ) ); +// //fprintf(outfile, "STRATEGIC MOVE COSTS: South mismatch for sector %c%d\n", y+'A'-1, x); // } // if( SectorInfo[ SECTOR(x,y) ].ubTraversability[ NORTH_STRATEGIC_MOVE ] != EDGEOFWORLD ) -// OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: North should be EDGEOFWORLD for sector %c%d\n", y+'A'-1, x ) ); +// OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: North should be EDGEOFWORLD for sector %c%d\n", y+'A'-1, x ) ); // } // if( x < 16 ) // { // if( SectorInfo[ SECTOR(x,y) ].ubTraversability[ EAST_STRATEGIC_MOVE ] != -// SectorInfo[ SECTOR(x+1,y) ].ubTraversability[ WEST_STRATEGIC_MOVE ] ) +// SectorInfo[ SECTOR(x+1,y) ].ubTraversability[ WEST_STRATEGIC_MOVE ] ) // { //east -// OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: East mismatch for sector %c%d\n", y+'A'-1, x ) ); -// //fprintf(outfile, "STRATEGIC MOVE COSTS: East mismatch for sector %c%d\n", y+'A'-1, x); +// OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: East mismatch for sector %c%d\n", y+'A'-1, x ) ); +// //fprintf(outfile, "STRATEGIC MOVE COSTS: East mismatch for sector %c%d\n", y+'A'-1, x); // } // if( x == 1 && SectorInfo[ SECTOR(x,y) ].ubTraversability[ WEST_STRATEGIC_MOVE ] != EDGEOFWORLD ) -// OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: West should be EDGEOFWORLD for sector %c%d\n", y+'A'-1, x ) ); +// OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: West should be EDGEOFWORLD for sector %c%d\n", y+'A'-1, x ) ); // } -// else +// else // { // if( SectorInfo[ SECTOR(x,y) ].ubTraversability[ WEST_STRATEGIC_MOVE ] != -// SectorInfo[ SECTOR(x-1,y) ].ubTraversability[ EAST_STRATEGIC_MOVE ] ) +// SectorInfo[ SECTOR(x-1,y) ].ubTraversability[ EAST_STRATEGIC_MOVE ] ) // { //west -// OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: West mismatch for sector %c%d\n", y+'A'-1, x ) ); -// //fprintf(outfile, "STRATEGIC MOVE COSTS: West mismatch for sector %c%d\n", y+'A'-1, x); +// OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: West mismatch for sector %c%d\n", y+'A'-1, x ) ); +// //fprintf(outfile, "STRATEGIC MOVE COSTS: West mismatch for sector %c%d\n", y+'A'-1, x); // } // if( SectorInfo[ SECTOR(x,y) ].ubTraversability[ EAST_STRATEGIC_MOVE ] != EDGEOFWORLD ) -// OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: East should be EDGEOFWORLD for sector %c%d\n", y+'A'-1, x ) ); +// OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: East should be EDGEOFWORLD for sector %c%d\n", y+'A'-1, x ) ); // } // } // } @@ -664,575 +663,575 @@ BOOLEAN SectorIsImpassable( INT16 sSector ) UINT8 gubEncryptionArray3[ BASE_NUMBER_OF_ROTATION_ARRAYS * 3 ][ NEW_ROTATION_ARRAY_SIZE ] = { - { - 250,224,3,197,156,209,110, - 159,75,119,221,42,212,180, - 223,115,13,246,173,221,211, - 148,3,78,214,195,102,155, - 5,128,5,204,42,72,240, - 65,177,242,226,81,255,139, - 70,150,95,124,203,83,248 - }, - - { - 234,33,49,205,144,43,212, - 44,249,86,116,150,112,80, - 244,150,120,207,182,110,50, - 179,160,41,114,31,130,253, - 243,221,106,120,118,181,252, - 103,30,238,119,10,242,187, - 99,99,210,197,153,71,176 - }, - - { - 137,180,252,121,200,124,8, - 111,186,110,245,102,71,247, - 195,157,232,115,191,169,136, - 138,98,54,253,14,34,248, - 106,226,167,185,48,19,112, - 183,175,155,66,76,150,34, - 114,38,225,8,126,236,96 - }, - - { - 16,220,169,218,40,146,208, - 171,96,114,57,235,189,141, - 227,252,238,194,231,160,128, - 231,91,85,175,137,143,46, - 106,176,119,234,149,173,154, - 114,52,93,90,126,142,222, - 243,157,223,56,7,82,175 - }, - - { - 214,11,122,112,113,118,195, - 111,55,4,85,186,203,217, - 125,14,7,2,128,91,236, - 239,85,23,213,142,125,198, - 74,130,186,4,118,41,195, - 123,188,1,212,1,94,239, - 40,89,169,57,55,203,169 - }, - - { - 107,224,17,213,57,56,188, - 177,120,49,183,211,64,230, - 226,84,84,171,122,18,226, - 165,77,205,198,31,112,139, - 65,93,107,58,110,22,144, - 19,97,87,140,177,42,4, - 192,72,174,177,138,11,166 - }, - - { - 9,11,33,144,120,134,56, - 4,91,241,26,37,93,204, - 71,167,75,221,9,34,10, - 219,253,35,235,183,134,199, - 28,130,28,63,91,151,1, - 3,187,36,59,41,166,150, - 104,162,205,29,72,186,83 - }, - - { - 196,130,182,208,71,167,231, - 133,59,210,10,82,151,243, - 72,199,77,48,187,1,229, - 90,194,112,224,238,252,108, - 206,154,86,168,215,178,231, - 84,179,166,10,22,174,219, - 127,163,226,226,243,31,38 - }, - - { - 151,198,6,214,2,99,210, - 26,142,255,31,154,133,47, - 111,116,53,2,99,76,220, - 32,138,65,181,182,139,192, - 37,121,215,223,133,181,173, - 70,135,166,142,83,146,1, - 243,133,54,3,113,189,13 - }, - - { - 218,245,135,17,201,119,232, - 222,199,170,217,219,28,16, - 3,178,162,3,204,38,47, - 12,104,170,218,33,215,196, - 149,34,158,166,210,45,34, - 243,172,26,99,60,84,204, - 28,18,35,143,222,62,46 - }, - - { - 60,75,3,168,92,248,239, - 242,4,39,47,181,156,203, - 212,206,79,31,30,121,87, - 53,27,131,225,189,185,224, - 197,139,173,133,179,233,43, - 197,57,111,229,53,35,75, - 91,56,162,191,210,60,204 - }, - - { - 204,16,230,187,172,49,5, - 6,62,173,174,199,231,242, - 88,238,27,145,67,3,252, - 116,22,44,104,24,248,161, - 191,68,19,63,190,51,179, - 124,223,155,19,121,99,175, - 236,86,157,100,225,151,149 - }, - - { - 20,225,193,156,236,144,244, - 233,27,222,169,213,53,207, - 99,209,213,167,118,171,224, - 107,166,60,107,5,215,26, - 193,227,130,90,118,110,40, - 15,9,41,122,128,4,213, - 119,214,25,121,36,43,50 - }, - - { - 145,47,181,236,88,31,32, - 115,104,90,150,49,168,172, - 179,101,188,142,221,234,236, - 228,41,88,211,109,94,201, - 158,144,56,104,73,210,109, - 23,168,157,173,64,144,150, - 18,68,3,56,48,116,165 - }, - - { - 244,90,27,112,128,36,134, - 214,150,207,139,84,223,171, - 128,173,54,7,27,180,4, - 201,54,253,233,84,240,76, - 115,170,33,14,5,159,140, - 205,195,253,229,225,165,86, - 11,58,114,131,107,165,215 - }, - - { - 127,30,93,91,165,158,58, - 91,236,151,103,207,65,207, - 224,16,142,150,170,76,137, - 179,3,245,230,90,117,207, - 4,1,32,217,158,175,10, - 214,182,171,214,154,51,253, - 189,234,95,204,17,14,207 - }, - - { - 251,51,223,223,24,80,138, - 60,244,179,168,186,1,21, - 12,239,194,171,206,186,121, - 108,254,72,86,66,135,179, - 75,154,160,214,228,28,109, - 100,31,230,13,217,190,45, - 212,123,22,131,225,202,182 - }, - - { - 185,198,186,9,155,133,18, - 53,111,146,55,105,127,17, - 220,228,159,10,193,193,233, - 209,13,3,157,84,98,206, - 113,120,76,80,52,103,3, - 69,15,214,66,155,70,31, - 44,43,203,79,226,242,132 - }, - - { - 243,234,219,137,211,230,117, - 77,78,213,164,239,148,89, - 188,164,131,43,255,119,66, - 78,239,81,106,25,124,145, - 243,179,114,20,144,27,54, - 248,181,69,49,9,19,129, - 246,21,163,160,145,26,21 - }, - - { - 19,244,140,188,119,3,162, - 214,207,50,237,66,223,44, - 37,110,211,126,117,193,202, - 185,39,26,89,15,255,186, - 152,204,45,61,223,196,18, - 230,196,12,213,241,104,9, - 2,33,192,82,18,67,223 - }, - - { - 74,68,234,227,249,134,5, - 155,29,216,149,124,210,253, - 70,1,251,206,7,6,169, - 11,110,69,164,249,34,121, - 124,192,237,83,24,179,204, - 195,70,140,154,203,57,204, - 154,84,113,52,162,44,11 - }, - - { - 149,12,210,227,237,40,13, - 145,9,125,242,172,155,114, - 134,79,24,170,101,90,40, - 201,183,100,21,213,235,222, - 1,235,97,78,63,140,139, - 41,175,36,176,69,106,21, - 222,78,151,1,31,62,206 - }, - - { - 111,142,87,207,172,114,135, - 240,251,218,183,28,227,230, - 7,172,200,86,82,11,141, - 106,27,97,114,183,48,49, - 236,5,27,61,172,200,203, - 128,129,90,113,165,107,124, - 2,196,116,74,95,198,166 - }, - - { - 36,157,67,183,185,88,56, - 196,189,140,108,182,108,4, - 207,158,104,168,192,176,19, - 219,132,39,248,42,196,176, - 100,106,126,180,172,179,32, - 32,102,40,67,229,250,6, - 212,3,207,255,251,39,137 - }, - - { - 75,159,202,137,103,226,221, - 61,6,107,208,82,34,206, - 43,111,163,245,105,131,160, - 221,86,66,164,127,159,241, - 252,63,209,15,117,177,134, - 241,155,33,226,253,211,145, - 55,122,105,182,231,179,227 - }, - - { - 157,96,103,188,105,64,44, - 218,9,130,220,208,31,209, - 165,84,23,196,202,232,165, - 52,185,56,150,110,141,11, - 65,114,137,84,121,247,180, - 97,83,114,27,129,147,201, - 227,59,40,2,192,121,117 - }, - - { - 141,213,168,224,119,181,65, - 98,40,127,183,126,248,200, - 61,116,77,83,91,13,104, - 56,217,205,187,161,226,238, - 229,156,224,248,17,35,26, - 72,247,255,100,102,62,145, - 12,135,83,17,77,255,163 - }, - - { - 114,95,19,65,117,142,233, - 198,248,84,19,166,59,238, - 91,165,4,102,92,171,109, - 125,153,177,72,137,125,255, - 201,156,23,103,141,9,230, - 198,139,174,164,127,20,8, - 55,25,105,110,215,204,24 - }, - - { - 158,164,46,157,212,125,174, - 116,154,138,38,34,169,58, - 43,99,220,22,105,253,182, - 66,163,101,91,9,182,186, - 147,53,45,66,185,174,198, - 244,21,25,133,42,145,223, - 147,19,91,117,172,252,72 - }, - - { - 49,66,21,133,143,27,168, - 148,62,162,138,247,194,151, - 175,153,19,96,160,84,252, - 176,202,168,181,193,91,4, - 91,206,171,158,213,18,227, - 101,224,241,223,225,148,168, - 252,160,86,4,213,6,111 - }, - - { - 144,151,17,65,208,251,3, - 77,204,130,87,4,157,7, - 28,165,66,66,8,17,95, - 85,91,208,59,252,247,77, - 146,111,174,109,148,149,48, - 134,177,171,170,239,125,216, - 120,18,77,240,230,76,226 - }, - - { - 210,134,132,192,156,253,190, - 117,63,210,141,138,131,45, - 185,81,35,254,244,69,17, - 145,239,66,118,235,177,58, - 145,10,125,173,254,99,41, - 155,144,176,54,26,63,107, - 135,92,92,2,13,83,139 - }, - - { - 51,60,163,170,147,164,49, - 58,161,146,230,89,121,242, - 4,248,134,113,158,82,65, - 18,148,65,101,47,159,144, - 148,39,206,229,233,148,16, - 64,113,112,11,203,242,240, - 255,1,19,113,237,186,66 - }, - - { - 89,159,78,103,56,246,78, - 204,4,21,252,53,204,162, - 14,168,189,244,222,214,188, - 53,154,156,141,90,137,154, - 195,28,5,79,102,155,54, - 192,149,251,61,20,11,162, - 196,30,206,82,172,93,1 - }, - - { - 226,222,85,249,190,223,200, - 178,240,60,187,187,232,97, - 207,164,185,5,211,32,8, - 168,23,210,90,85,110,5, - 12,44,92,46,148,220,104, - 161,95,153,5,51,231,168, - 13,54,84,34,77,166,72 - }, - - { - 252,15,213,37,242,26,114, - 115,99,46,77,163,196,100, - 157,235,193,113,53,117,144, - 72,105,138,167,8,22,7, - 97,184,138,186,169,200,185, - 7,73,199,135,77,234,79, - 143,149,114,153,47,242,186 - }, - - { - 187,60,9,83,243,54,78, - 90,20,70,81,255,107,243, - 177,221,63,217,7,159,51, - 56,113,50,168,185,8,252, - 138,74,218,63,120,74,198, - 59,206,5,205,40,123,185, - 46,167,40,14,241,178,153 - }, - - { - 75,41,175,215,50,141,196, - 250,196,198,238,44,224,253, - 14,195,247,8,102,7,200, - 205,196,115,107,61,202,22, - 142,105,139,229,44,24,255, - 154,171,123,119,239,174,72, - 160,219,106,222,45,158,228 - }, - - { - 201,188,54,248,57,37,25, - 96,199,162,200,176,46,20, - 27,160,39,217,196,100,58, - 103,23,127,168,47,95,229, - 39,234,244,187,179,238,89, - 154,37,140,111,160,190,49, - 56,56,126,62,22,213,80 - }, - - { - 81,12,160,241,248,231,70, - 171,127,226,220,168,223,151, - 45,22,115,217,54,204,131, - 100,66,186,63,198,114,191, - 69,158,2,56,67,137,48, - 242,216,196,25,192,64,253, - 95,93,232,65,242,229,139 - }, - - { - 134,221,148,217,202,95,252, - 95,61,51,127,170,99,97, - 40,82,194,103,179,250,244, - 25,250,229,172,5,102,45, - 149,205,194,61,150,45,7, - 167,96,27,110,234,204,213, - 117,58,248,57,20,234,161 - }, - - { - 38,213,157,169,107,23,175, - 84,238,15,28,30,134,243, - 88,168,69,218,79,201,159, - 159,4,16,64,125,5,223, - 214,149,64,121,210,33,68, - 249,64,123,162,195,195,200, - 107,77,238,103,118,198,207 - }, - - { - 232,120,145,34,201,147,8, - 220,158,104,126,144,240,77, - 8,89,132,187,230,206,52, - 139,46,181,45,26,125,223, - 181,244,93,1,55,20,46, - 220,205,75,29,161,7,5, - 34,193,17,215,109,50,25 - }, - - { - 25,89,86,245,1,51,123, - 253,111,240,58,28,252,69, - 144,241,90,250,19,53,165, - 34,9,11,197,1,207,136, - 105,56,90,29,184,34,29, - 30,96,214,85,38,248,211, - 231,131,125,190,194,106,204 - }, - - { - 61,15,48,227,80,24,43, - 221,58,41,146,86,89,88, - 250,64,248,115,177,207,134, - 12,182,142,54,217,120,46, - 111,96,32,51,32,37,151, - 15,72,90,11,200,212,66, - 17,187,46,58,64,154,125 - }, - - { - 176,94,60,25,239,233,78, - 19,10,51,143,104,187,179, - 159,185,176,236,250,20,228, - 122,71,189,152,144,122,121, - 149,165,253,58,50,118,92, - 202,216,34,158,78,119,147, - 232,32,175,242,105,5,20 - }, - - { - 88,62,37,83,109,101,204, - 176,66,65,101,138,12,229, - 157,97,249,172,65,38,232, - 47,177,45,30,73,118,158, - 209,49,230,186,172,61,84, - 202,3,116,192,24,3,129, - 135,189,122,24,1,172,139 - }, - - { - 115,137,193,238,244,237,60, - 4,136,178,113,108,224,44, - 23,96,32,227,245,129,17, - 62,100,83,120,217,93,33, - 161,164,138,122,190,26,26, - 17,48,159,188,27,71,132, - 155,5,167,136,166,149,216 - }, - - { - 124,10,86,29,212,50,96, - 40,191,32,87,212,177,122, - 184,100,207,41,78,103,73, - 208,226,235,2,23,9,255, - 153,233,21,34,48,194,23, - 194,249,39,252,94,6,68, - 157,81,56,5,229,1,239 - }, - - { - 109,209,104,83,161,130,167, - 172,101,12,168,226,109,80, - 124,120,101,130,117,14,239, - 162,172,222,143,156,249,47, - 182,69,250,40,239,237,75, - 18,96,198,112,106,145,201, - 171,208,196,95,49,54,187 - }, - - { - 125,238,86,66,116,112,229, - 80,35,251,120,41,196,128, - 141,64,28,109,190,69,41, - 7,139,44,39,89,183,137, - 4,83,178,29,23,51,255, - 218,62,204,31,93,41,202, - 220,250,247,133,158,120,253 - }, - - { - 117,124,147,199,242,198,81, - 46,74,212,97,166,187,160, - 98,132,139,36,127,115,172, - 244,19,206,38,12,210,29, - 201,63,54,94,83,86,145, - 105,132,61,162,21,95,76, - 244,88,13,24,242,35,139 - }, - - { - 191,252,45,196,59,89,93, - 15,158,95,25,209,189,162, - 46,60,61,146,124,209,115, - 74,54,193,42,248,209,175, - 155,184,122,14,184,40,48, - 143,46,158,66,212,21,89, - 120,234,207,110,136,175,12 - }, - - { - 239,25,187,91,249,22,224, - 99,40,115,213,19,41,56, - 53,221,222,229,82,112,215, - 23,12,215,126,112,44,146, - 209,173,116,133,9,253,233, - 75,235,96,117,211,69,72, - 120,209,63,49,107,230,5 - }, - - { - 98,24,14,131,155,143,55, - 150,221,114,139,140,10,153, - 84,73,144,203,3,226,232, - 129,64,28,254,91,143,128, - 99,100,112,138,96,179,122, - 168,183,133,108,113,69,98, - 167,230,45,116,11,32,225 - }, - - { - 153,169,41,171,77,85,127, - 241,6,111,247,245,26,2, - 97,66,194,143,211,123,90, - 150,228,211,108,60,176,209, - 165,35,7,167,82,207,143, - 205,104,166,75,33,202,249, - 58,54,206,10,136,19,166 - }, - - { - 146,29,30,194,190,208,94, - 195,8,67,217,18,255,127, - 64,188,106,114,153,172,177, - 98,54,195,32,99,153,14, - 221,5,133,140,46,33,255, - 187,212,29,98,102,47,125, - 80,232,235,19,180,106,219 - }, + { + 250,224,3,197,156,209,110, + 159,75,119,221,42,212,180, + 223,115,13,246,173,221,211, + 148,3,78,214,195,102,155, + 5,128,5,204,42,72,240, + 65,177,242,226,81,255,139, + 70,150,95,124,203,83,248 + }, + + { + 234,33,49,205,144,43,212, + 44,249,86,116,150,112,80, + 244,150,120,207,182,110,50, + 179,160,41,114,31,130,253, + 243,221,106,120,118,181,252, + 103,30,238,119,10,242,187, + 99,99,210,197,153,71,176 + }, + + { + 137,180,252,121,200,124,8, + 111,186,110,245,102,71,247, + 195,157,232,115,191,169,136, + 138,98,54,253,14,34,248, + 106,226,167,185,48,19,112, + 183,175,155,66,76,150,34, + 114,38,225,8,126,236,96 + }, + + { + 16,220,169,218,40,146,208, + 171,96,114,57,235,189,141, + 227,252,238,194,231,160,128, + 231,91,85,175,137,143,46, + 106,176,119,234,149,173,154, + 114,52,93,90,126,142,222, + 243,157,223,56,7,82,175 + }, + + { + 214,11,122,112,113,118,195, + 111,55,4,85,186,203,217, + 125,14,7,2,128,91,236, + 239,85,23,213,142,125,198, + 74,130,186,4,118,41,195, + 123,188,1,212,1,94,239, + 40,89,169,57,55,203,169 + }, + + { + 107,224,17,213,57,56,188, + 177,120,49,183,211,64,230, + 226,84,84,171,122,18,226, + 165,77,205,198,31,112,139, + 65,93,107,58,110,22,144, + 19,97,87,140,177,42,4, + 192,72,174,177,138,11,166 + }, + + { + 9,11,33,144,120,134,56, + 4,91,241,26,37,93,204, + 71,167,75,221,9,34,10, + 219,253,35,235,183,134,199, + 28,130,28,63,91,151,1, + 3,187,36,59,41,166,150, + 104,162,205,29,72,186,83 + }, + + { + 196,130,182,208,71,167,231, + 133,59,210,10,82,151,243, + 72,199,77,48,187,1,229, + 90,194,112,224,238,252,108, + 206,154,86,168,215,178,231, + 84,179,166,10,22,174,219, + 127,163,226,226,243,31,38 + }, + + { + 151,198,6,214,2,99,210, + 26,142,255,31,154,133,47, + 111,116,53,2,99,76,220, + 32,138,65,181,182,139,192, + 37,121,215,223,133,181,173, + 70,135,166,142,83,146,1, + 243,133,54,3,113,189,13 + }, + + { + 218,245,135,17,201,119,232, + 222,199,170,217,219,28,16, + 3,178,162,3,204,38,47, + 12,104,170,218,33,215,196, + 149,34,158,166,210,45,34, + 243,172,26,99,60,84,204, + 28,18,35,143,222,62,46 + }, + + { + 60,75,3,168,92,248,239, + 242,4,39,47,181,156,203, + 212,206,79,31,30,121,87, + 53,27,131,225,189,185,224, + 197,139,173,133,179,233,43, + 197,57,111,229,53,35,75, + 91,56,162,191,210,60,204 + }, + + { + 204,16,230,187,172,49,5, + 6,62,173,174,199,231,242, + 88,238,27,145,67,3,252, + 116,22,44,104,24,248,161, + 191,68,19,63,190,51,179, + 124,223,155,19,121,99,175, + 236,86,157,100,225,151,149 + }, + + { + 20,225,193,156,236,144,244, + 233,27,222,169,213,53,207, + 99,209,213,167,118,171,224, + 107,166,60,107,5,215,26, + 193,227,130,90,118,110,40, + 15,9,41,122,128,4,213, + 119,214,25,121,36,43,50 + }, + + { + 145,47,181,236,88,31,32, + 115,104,90,150,49,168,172, + 179,101,188,142,221,234,236, + 228,41,88,211,109,94,201, + 158,144,56,104,73,210,109, + 23,168,157,173,64,144,150, + 18,68,3,56,48,116,165 + }, + + { + 244,90,27,112,128,36,134, + 214,150,207,139,84,223,171, + 128,173,54,7,27,180,4, + 201,54,253,233,84,240,76, + 115,170,33,14,5,159,140, + 205,195,253,229,225,165,86, + 11,58,114,131,107,165,215 + }, + + { + 127,30,93,91,165,158,58, + 91,236,151,103,207,65,207, + 224,16,142,150,170,76,137, + 179,3,245,230,90,117,207, + 4,1,32,217,158,175,10, + 214,182,171,214,154,51,253, + 189,234,95,204,17,14,207 + }, + + { + 251,51,223,223,24,80,138, + 60,244,179,168,186,1,21, + 12,239,194,171,206,186,121, + 108,254,72,86,66,135,179, + 75,154,160,214,228,28,109, + 100,31,230,13,217,190,45, + 212,123,22,131,225,202,182 + }, + + { + 185,198,186,9,155,133,18, + 53,111,146,55,105,127,17, + 220,228,159,10,193,193,233, + 209,13,3,157,84,98,206, + 113,120,76,80,52,103,3, + 69,15,214,66,155,70,31, + 44,43,203,79,226,242,132 + }, + + { + 243,234,219,137,211,230,117, + 77,78,213,164,239,148,89, + 188,164,131,43,255,119,66, + 78,239,81,106,25,124,145, + 243,179,114,20,144,27,54, + 248,181,69,49,9,19,129, + 246,21,163,160,145,26,21 + }, + + { + 19,244,140,188,119,3,162, + 214,207,50,237,66,223,44, + 37,110,211,126,117,193,202, + 185,39,26,89,15,255,186, + 152,204,45,61,223,196,18, + 230,196,12,213,241,104,9, + 2,33,192,82,18,67,223 + }, + + { + 74,68,234,227,249,134,5, + 155,29,216,149,124,210,253, + 70,1,251,206,7,6,169, + 11,110,69,164,249,34,121, + 124,192,237,83,24,179,204, + 195,70,140,154,203,57,204, + 154,84,113,52,162,44,11 + }, + + { + 149,12,210,227,237,40,13, + 145,9,125,242,172,155,114, + 134,79,24,170,101,90,40, + 201,183,100,21,213,235,222, + 1,235,97,78,63,140,139, + 41,175,36,176,69,106,21, + 222,78,151,1,31,62,206 + }, + + { + 111,142,87,207,172,114,135, + 240,251,218,183,28,227,230, + 7,172,200,86,82,11,141, + 106,27,97,114,183,48,49, + 236,5,27,61,172,200,203, + 128,129,90,113,165,107,124, + 2,196,116,74,95,198,166 + }, + + { + 36,157,67,183,185,88,56, + 196,189,140,108,182,108,4, + 207,158,104,168,192,176,19, + 219,132,39,248,42,196,176, + 100,106,126,180,172,179,32, + 32,102,40,67,229,250,6, + 212,3,207,255,251,39,137 + }, + + { + 75,159,202,137,103,226,221, + 61,6,107,208,82,34,206, + 43,111,163,245,105,131,160, + 221,86,66,164,127,159,241, + 252,63,209,15,117,177,134, + 241,155,33,226,253,211,145, + 55,122,105,182,231,179,227 + }, + + { + 157,96,103,188,105,64,44, + 218,9,130,220,208,31,209, + 165,84,23,196,202,232,165, + 52,185,56,150,110,141,11, + 65,114,137,84,121,247,180, + 97,83,114,27,129,147,201, + 227,59,40,2,192,121,117 + }, + + { + 141,213,168,224,119,181,65, + 98,40,127,183,126,248,200, + 61,116,77,83,91,13,104, + 56,217,205,187,161,226,238, + 229,156,224,248,17,35,26, + 72,247,255,100,102,62,145, + 12,135,83,17,77,255,163 + }, + + { + 114,95,19,65,117,142,233, + 198,248,84,19,166,59,238, + 91,165,4,102,92,171,109, + 125,153,177,72,137,125,255, + 201,156,23,103,141,9,230, + 198,139,174,164,127,20,8, + 55,25,105,110,215,204,24 + }, + + { + 158,164,46,157,212,125,174, + 116,154,138,38,34,169,58, + 43,99,220,22,105,253,182, + 66,163,101,91,9,182,186, + 147,53,45,66,185,174,198, + 244,21,25,133,42,145,223, + 147,19,91,117,172,252,72 + }, + + { + 49,66,21,133,143,27,168, + 148,62,162,138,247,194,151, + 175,153,19,96,160,84,252, + 176,202,168,181,193,91,4, + 91,206,171,158,213,18,227, + 101,224,241,223,225,148,168, + 252,160,86,4,213,6,111 + }, + + { + 144,151,17,65,208,251,3, + 77,204,130,87,4,157,7, + 28,165,66,66,8,17,95, + 85,91,208,59,252,247,77, + 146,111,174,109,148,149,48, + 134,177,171,170,239,125,216, + 120,18,77,240,230,76,226 + }, + + { + 210,134,132,192,156,253,190, + 117,63,210,141,138,131,45, + 185,81,35,254,244,69,17, + 145,239,66,118,235,177,58, + 145,10,125,173,254,99,41, + 155,144,176,54,26,63,107, + 135,92,92,2,13,83,139 + }, + + { + 51,60,163,170,147,164,49, + 58,161,146,230,89,121,242, + 4,248,134,113,158,82,65, + 18,148,65,101,47,159,144, + 148,39,206,229,233,148,16, + 64,113,112,11,203,242,240, + 255,1,19,113,237,186,66 + }, + + { + 89,159,78,103,56,246,78, + 204,4,21,252,53,204,162, + 14,168,189,244,222,214,188, + 53,154,156,141,90,137,154, + 195,28,5,79,102,155,54, + 192,149,251,61,20,11,162, + 196,30,206,82,172,93,1 + }, + + { + 226,222,85,249,190,223,200, + 178,240,60,187,187,232,97, + 207,164,185,5,211,32,8, + 168,23,210,90,85,110,5, + 12,44,92,46,148,220,104, + 161,95,153,5,51,231,168, + 13,54,84,34,77,166,72 + }, + + { + 252,15,213,37,242,26,114, + 115,99,46,77,163,196,100, + 157,235,193,113,53,117,144, + 72,105,138,167,8,22,7, + 97,184,138,186,169,200,185, + 7,73,199,135,77,234,79, + 143,149,114,153,47,242,186 + }, + + { + 187,60,9,83,243,54,78, + 90,20,70,81,255,107,243, + 177,221,63,217,7,159,51, + 56,113,50,168,185,8,252, + 138,74,218,63,120,74,198, + 59,206,5,205,40,123,185, + 46,167,40,14,241,178,153 + }, + + { + 75,41,175,215,50,141,196, + 250,196,198,238,44,224,253, + 14,195,247,8,102,7,200, + 205,196,115,107,61,202,22, + 142,105,139,229,44,24,255, + 154,171,123,119,239,174,72, + 160,219,106,222,45,158,228 + }, + + { + 201,188,54,248,57,37,25, + 96,199,162,200,176,46,20, + 27,160,39,217,196,100,58, + 103,23,127,168,47,95,229, + 39,234,244,187,179,238,89, + 154,37,140,111,160,190,49, + 56,56,126,62,22,213,80 + }, + + { + 81,12,160,241,248,231,70, + 171,127,226,220,168,223,151, + 45,22,115,217,54,204,131, + 100,66,186,63,198,114,191, + 69,158,2,56,67,137,48, + 242,216,196,25,192,64,253, + 95,93,232,65,242,229,139 + }, + + { + 134,221,148,217,202,95,252, + 95,61,51,127,170,99,97, + 40,82,194,103,179,250,244, + 25,250,229,172,5,102,45, + 149,205,194,61,150,45,7, + 167,96,27,110,234,204,213, + 117,58,248,57,20,234,161 + }, + + { + 38,213,157,169,107,23,175, + 84,238,15,28,30,134,243, + 88,168,69,218,79,201,159, + 159,4,16,64,125,5,223, + 214,149,64,121,210,33,68, + 249,64,123,162,195,195,200, + 107,77,238,103,118,198,207 + }, + + { + 232,120,145,34,201,147,8, + 220,158,104,126,144,240,77, + 8,89,132,187,230,206,52, + 139,46,181,45,26,125,223, + 181,244,93,1,55,20,46, + 220,205,75,29,161,7,5, + 34,193,17,215,109,50,25 + }, + + { + 25,89,86,245,1,51,123, + 253,111,240,58,28,252,69, + 144,241,90,250,19,53,165, + 34,9,11,197,1,207,136, + 105,56,90,29,184,34,29, + 30,96,214,85,38,248,211, + 231,131,125,190,194,106,204 + }, + + { + 61,15,48,227,80,24,43, + 221,58,41,146,86,89,88, + 250,64,248,115,177,207,134, + 12,182,142,54,217,120,46, + 111,96,32,51,32,37,151, + 15,72,90,11,200,212,66, + 17,187,46,58,64,154,125 + }, + + { + 176,94,60,25,239,233,78, + 19,10,51,143,104,187,179, + 159,185,176,236,250,20,228, + 122,71,189,152,144,122,121, + 149,165,253,58,50,118,92, + 202,216,34,158,78,119,147, + 232,32,175,242,105,5,20 + }, + + { + 88,62,37,83,109,101,204, + 176,66,65,101,138,12,229, + 157,97,249,172,65,38,232, + 47,177,45,30,73,118,158, + 209,49,230,186,172,61,84, + 202,3,116,192,24,3,129, + 135,189,122,24,1,172,139 + }, + + { + 115,137,193,238,244,237,60, + 4,136,178,113,108,224,44, + 23,96,32,227,245,129,17, + 62,100,83,120,217,93,33, + 161,164,138,122,190,26,26, + 17,48,159,188,27,71,132, + 155,5,167,136,166,149,216 + }, + + { + 124,10,86,29,212,50,96, + 40,191,32,87,212,177,122, + 184,100,207,41,78,103,73, + 208,226,235,2,23,9,255, + 153,233,21,34,48,194,23, + 194,249,39,252,94,6,68, + 157,81,56,5,229,1,239 + }, + + { + 109,209,104,83,161,130,167, + 172,101,12,168,226,109,80, + 124,120,101,130,117,14,239, + 162,172,222,143,156,249,47, + 182,69,250,40,239,237,75, + 18,96,198,112,106,145,201, + 171,208,196,95,49,54,187 + }, + + { + 125,238,86,66,116,112,229, + 80,35,251,120,41,196,128, + 141,64,28,109,190,69,41, + 7,139,44,39,89,183,137, + 4,83,178,29,23,51,255, + 218,62,204,31,93,41,202, + 220,250,247,133,158,120,253 + }, + + { + 117,124,147,199,242,198,81, + 46,74,212,97,166,187,160, + 98,132,139,36,127,115,172, + 244,19,206,38,12,210,29, + 201,63,54,94,83,86,145, + 105,132,61,162,21,95,76, + 244,88,13,24,242,35,139 + }, + + { + 191,252,45,196,59,89,93, + 15,158,95,25,209,189,162, + 46,60,61,146,124,209,115, + 74,54,193,42,248,209,175, + 155,184,122,14,184,40,48, + 143,46,158,66,212,21,89, + 120,234,207,110,136,175,12 + }, + + { + 239,25,187,91,249,22,224, + 99,40,115,213,19,41,56, + 53,221,222,229,82,112,215, + 23,12,215,126,112,44,146, + 209,173,116,133,9,253,233, + 75,235,96,117,211,69,72, + 120,209,63,49,107,230,5 + }, + + { + 98,24,14,131,155,143,55, + 150,221,114,139,140,10,153, + 84,73,144,203,3,226,232, + 129,64,28,254,91,143,128, + 99,100,112,138,96,179,122, + 168,183,133,108,113,69,98, + 167,230,45,116,11,32,225 + }, + + { + 153,169,41,171,77,85,127, + 241,6,111,247,245,26,2, + 97,66,194,143,211,123,90, + 150,228,211,108,60,176,209, + 165,35,7,167,82,207,143, + 205,104,166,75,33,202,249, + 58,54,206,10,136,19,166 + }, + + { + 146,29,30,194,190,208,94, + 195,8,67,217,18,255,127, + 64,188,106,114,153,172,177, + 98,54,195,32,99,153,14, + 221,5,133,140,46,33,255, + 187,212,29,98,102,47,125, + 80,232,235,19,180,106,219 + }, }; /* @@ -1757,7 +1756,7 @@ void InitStrategicRowD() pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = PLAINS; pSector->ubTraversability[ SOUTH_STRATEGIC_MOVE ] = PLAINS; pSector->ubTraversability[ WEST_STRATEGIC_MOVE ] = DENSE; - pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = TOWN; + pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] = TOWN; pSector = &SectorInfo[ SEC_D16 ]; pSector->ubTravelRating = 5; @@ -3398,52 +3397,52 @@ BOOLEAN InitStrategicMovementCosts() #ifdef JA2TESTVERSION { //Simply make sure all shared borders between sectors match. INT32 x,y; - OutputDebugString( "STRATEGIC MOVE COSTS: Testing validity of data (okay if no following debug msgs)...\n"); + OutputDebugString( "STRATEGIC MOVE COSTS: Testing validity of data (okay if no following debug msgs)...\n"); for( y = 1; y <= 16; y++ ) for( x = 1; x <= 16; x++ ) { if( y > 1 ) { if( SectorInfo[ SECTOR(x,y) ].ubTraversability[ NORTH_STRATEGIC_MOVE ] != - SectorInfo[ SECTOR(x,y-1) ].ubTraversability[ SOUTH_STRATEGIC_MOVE ] ) + SectorInfo[ SECTOR(x,y-1) ].ubTraversability[ SOUTH_STRATEGIC_MOVE ] ) { //north - OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: North mismatch for sector %c%d\n", y+'A'-1, x ) ); + OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: North mismatch for sector %c%d\n", y+'A'-1, x ) ); } if( y == 16 && SectorInfo[ SECTOR(x,y) ].ubTraversability[ SOUTH_STRATEGIC_MOVE ] != EDGEOFWORLD ) - OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: South should be EDGEOFWORLD for sector %c%d\n", y+'A'-1, x ) ); + OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: South should be EDGEOFWORLD for sector %c%d\n", y+'A'-1, x ) ); } - else + else { if( SectorInfo[ SECTOR(x,y) ].ubTraversability[ SOUTH_STRATEGIC_MOVE ] != - SectorInfo[ SECTOR(x,y+1) ].ubTraversability[ NORTH_STRATEGIC_MOVE ] ) + SectorInfo[ SECTOR(x,y+1) ].ubTraversability[ NORTH_STRATEGIC_MOVE ] ) { //south - OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: South mismatch for sector %c%d\n", y+'A'-1, x ) ); + OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: South mismatch for sector %c%d\n", y+'A'-1, x ) ); } if( SectorInfo[ SECTOR(x,y) ].ubTraversability[ NORTH_STRATEGIC_MOVE ] != EDGEOFWORLD ) - OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: North should be EDGEOFWORLD for sector %c%d\n", y+'A'-1, x ) ); + OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: North should be EDGEOFWORLD for sector %c%d\n", y+'A'-1, x ) ); } if( x < 16 ) { if( SectorInfo[ SECTOR(x,y) ].ubTraversability[ EAST_STRATEGIC_MOVE ] != - SectorInfo[ SECTOR(x+1,y) ].ubTraversability[ WEST_STRATEGIC_MOVE ] ) + SectorInfo[ SECTOR(x+1,y) ].ubTraversability[ WEST_STRATEGIC_MOVE ] ) { //east - OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: East mismatch for sector %c%d\n", y+'A'-1, x ) ); + OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: East mismatch for sector %c%d\n", y+'A'-1, x ) ); } if( x == 1 && SectorInfo[ SECTOR(x,y) ].ubTraversability[ WEST_STRATEGIC_MOVE ] != EDGEOFWORLD ) - OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: West should be EDGEOFWORLD for sector %c%d\n", y+'A'-1, x ) ); + OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: West should be EDGEOFWORLD for sector %c%d\n", y+'A'-1, x ) ); } - else + else { if( SectorInfo[ SECTOR(x,y) ].ubTraversability[ WEST_STRATEGIC_MOVE ] != - SectorInfo[ SECTOR(x-1,y) ].ubTraversability[ EAST_STRATEGIC_MOVE ] ) + SectorInfo[ SECTOR(x-1,y) ].ubTraversability[ EAST_STRATEGIC_MOVE ] ) { //west - OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: West mismatch for sector %c%d\n", y+'A'-1, x ) ); + OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: West mismatch for sector %c%d\n", y+'A'-1, x ) ); } if( SectorInfo[ SECTOR(x,y) ].ubTraversability[ EAST_STRATEGIC_MOVE ] != EDGEOFWORLD ) - OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: East should be EDGEOFWORLD for sector %c%d\n", y+'A'-1, x ) ); + OutputDebugString( (LPCSTR)String( "STRATEGIC MOVE COSTS: East should be EDGEOFWORLD for sector %c%d\n", y+'A'-1, x ) ); } } } #endif return( TRUE ); -} \ No newline at end of file +} diff --git a/Strategic/Strategic Movement.cpp b/Strategic/Strategic Movement.cpp index 62c15b47..da000751 100644 --- a/Strategic/Strategic Movement.cpp +++ b/Strategic/Strategic Movement.cpp @@ -10,7 +10,7 @@ #include "Campaign Types.h" #include "Game Event Hook.h" #include "Game Clock.h" - #include "Soldier Control.h" + #include "Queen Command.h" #include "overhead.h" #include "strategicmap.h" @@ -51,6 +51,11 @@ #include "MilitiaSquads.h" +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + extern UINT32 guiLastTacticalRealTime; // the delay for a group about to arrive @@ -80,7 +85,7 @@ BOOLEAN gfRandomizingPatrolGroup = FALSE; UINT8 gubNumGroupsArrivedSimultaneously = 0; -//Doesn't require text localization. This is for debug strings only. +//Doesn't require text localization. This is for debug strings only. UINT8 gszTerrain[NUM_TRAVTERRAIN_TYPES][15] = { "TOWN", "ROAD", "PLAINS", "SAND", "SPARSE", "DENSE", "SWAMP", @@ -89,7 +94,7 @@ UINT8 gszTerrain[NUM_TRAVTERRAIN_TYPES][15] = BOOLEAN gfUndergroundTacticalTraversal = FALSE; -// remembers which player group is the Continue/Stop prompt about? No need to save as long as you can't save while prompt ON +// remembers which player group is the Continue/Stop prompt about? No need to save as long as you can't save while prompt ON GROUP *gpGroupPrompting = NULL; UINT32 uniqueIDMask[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -143,7 +148,7 @@ BOOLEAN gfWaitingForInput = FALSE; //Player grouping functions //......................... -//Creates a new player group, returning the unique ID of that group. This is the first +//Creates a new player group, returning the unique ID of that group. This is the first //step before adding waypoints and members to the player group. UINT8 CreateNewPlayerGroupDepartingFromSector( UINT8 ubSectorX, UINT8 ubSectorY ) { @@ -226,13 +231,13 @@ BOOLEAN AddPlayerToGroup( UINT8 ubGroupID, SOLDIERTYPE *pSoldier ) pGroup->ubSectorX = (UINT8)pSoldier->sSectorX; pGroup->ubSectorY = (UINT8)pSoldier->sSectorY; pGroup->ubSectorZ = (UINT8)pSoldier->bSectorZ; - + // set group id pSoldier->ubGroupID = ubGroupID; return TRUE; } - else + else { curr = pGroup->pPlayerList; pSoldier->ubNumTraversalsAllowedToMerge = curr->pSoldier->ubNumTraversalsAllowedToMerge; @@ -244,7 +249,7 @@ BOOLEAN AddPlayerToGroup( UINT8 ubGroupID, SOLDIERTYPE *pSoldier ) curr = curr->next; } curr->next = pPlayer; - + // set group id pSoldier->ubGroupID = ubGroupID; @@ -258,7 +263,7 @@ BOOLEAN AddPlayerToGroup( UINT8 ubGroupID, SOLDIERTYPE *pSoldier ) BOOLEAN RemoveAllPlayersFromGroup( UINT8 ubGroupId ) { GROUP *pGroup; - + // grab group id pGroup = GetGroup( ubGroupId ); @@ -273,7 +278,7 @@ BOOLEAN RemoveAllPlayersFromPGroup( GROUP *pGroup ) PLAYERGROUP *curr; AssertMsg( pGroup->fPlayer, "Attempting RemovePlayerFromGroup() on an ENEMY group!"); - + curr = pGroup->pPlayerList; while( curr ) { @@ -287,7 +292,7 @@ BOOLEAN RemoveAllPlayersFromPGroup( GROUP *pGroup ) curr = pGroup->pPlayerList; } pGroup->ubGroupSize = 0; - + if( !pGroup->fPersistant ) { //remove the empty group RemovePGroup( pGroup ); @@ -306,7 +311,7 @@ BOOLEAN RemovePlayerFromPGroup( GROUP *pGroup, SOLDIERTYPE *pSoldier ) AssertMsg( pGroup->fPlayer, "Attempting RemovePlayerFromGroup() on an ENEMY group!" ); curr = pGroup->pPlayerList; - + if( !curr ) { return FALSE; @@ -318,12 +323,12 @@ BOOLEAN RemovePlayerFromPGroup( GROUP *pGroup, SOLDIERTYPE *pSoldier ) //delete the node MemFree( curr ); - + //process info for soldier pGroup->ubGroupSize--; pSoldier->ubPrevSectorID = (UINT8)SECTOR( pGroup->ubPrevX, pGroup->ubPrevY ); pSoldier->ubGroupID = 0; - + // if there's nobody left in the group if( pGroup->ubGroupSize == 0 ) { @@ -363,7 +368,7 @@ BOOLEAN RemovePlayerFromPGroup( GROUP *pGroup, SOLDIERTYPE *pSoldier ) prev = curr; curr = curr->next; - + } // !curr @@ -376,8 +381,8 @@ BOOLEAN RemovePlayerFromGroup( UINT8 ubGroupID, SOLDIERTYPE *pSoldier ) pGroup = GetGroup( ubGroupID ); //KM : August 6, 1999 Patch fix - // Because the release build has no assertions, it was still possible for the group to be null, - // causing a crash. Instead of crashing, it'll simply return false. + // Because the release build has no assertions, it was still possible for the group to be null, + // causing a crash. Instead of crashing, it'll simply return false. if( !pGroup ) { return FALSE; @@ -416,14 +421,14 @@ BOOLEAN GroupReversingDirectionsBetweenSectors( GROUP *pGroup, UINT8 ubSectorX, if( pGroup->fPlayer ) { // ARM: because we've changed the group's ubSectoryX and ubSectorY, we must now also go and change the sSectorX and - // sSectorY of all the soldiers in this group so that they stay in synch. Otherwise pathing and movement problems + // sSectorY of all the soldiers in this group so that they stay in synch. Otherwise pathing and movement problems // will result since the group is in one place while the merc is in another... SetLocationOfAllPlayerSoldiersInGroup( pGroup, pGroup->ubSectorX, pGroup->ubSectorY, 0 ); } - // IMPORTANT: The traverse time doesn't change just because we reverse directions! It takes the same time no matter - // which direction you're going in! This becomes critical in case the player reverse directions again before moving! + // IMPORTANT: The traverse time doesn't change just because we reverse directions! It takes the same time no matter + // which direction you're going in! This becomes critical in case the player reverse directions again before moving! // The time it takes to arrive there will be exactly the amount of time we have been moving away from it. SetGroupArrivalTime( pGroup, pGroup->uiTraverseTime - pGroup->uiArrivalTime + GetWorldTotalMin() * 2 ); @@ -439,7 +444,7 @@ BOOLEAN GroupReversingDirectionsBetweenSectors( GROUP *pGroup, UINT8 ubSectorX, if( ( pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY ) > GetWorldTotalMin( ) ) { // Post the about to arrive event - AddStrategicEvent( EVENT_GROUP_ABOUT_TO_ARRIVE, pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY, pGroup->ubGroupID ); + AddStrategicEvent( EVENT_GROUP_ABOUT_TO_ARRIVE, pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY, pGroup->ubGroupID ); } } } @@ -450,7 +455,7 @@ BOOLEAN GroupReversingDirectionsBetweenSectors( GROUP *pGroup, UINT8 ubSectorX, // To handle this situation, RebuildWayPointsForGroupPath() will issue it's own call after it's ready for it. if ( !fBuildingWaypoints ) { - // never really left. Must set check for battle TRUE in order for HandleNonCombatGroupArrival() to run! + // never really left. Must set check for battle TRUE in order for HandleNonCombatGroupArrival() to run! GroupArrivedAtSector( pGroup->ubGroupID, TRUE, TRUE ); } } @@ -498,7 +503,7 @@ BOOLEAN GroupBetweenSectorsAndSectorXYIsInDifferentDirection( GROUP *pGroup, UIN return FALSE; } - // Compare the dx/dy's. If they're exactly the same, group is travelling in the same direction as before, so we're not + // Compare the dx/dy's. If they're exactly the same, group is travelling in the same direction as before, so we're not // changing directions. // Note that 90-degree orthogonal changes are considered changing direction, as well as the full 180-degree reversal. // That's because the party must return to the previous sector in each of those cases, too. @@ -511,7 +516,7 @@ BOOLEAN GroupBetweenSectorsAndSectorXYIsInDifferentDirection( GROUP *pGroup, UIN } -//Appends a waypoint to the end of the list. Waypoint MUST be on the +//Appends a waypoint to the end of the list. Waypoint MUST be on the //same horizontal or vertical level as the last waypoint added. BOOLEAN AddWaypointToPGroup( GROUP* pGroup, UINT8 ubSectorX, UINT8 ubSectorY ) //Same, but overloaded { @@ -526,7 +531,7 @@ BOOLEAN AddWaypointToPGroup( GROUP* pGroup, UINT8 ubSectorX, UINT8 ubSectorY ) / if( !pGroup ) return FALSE; - //At this point, we have the group, and a valid coordinate. Now we must + //At this point, we have the group, and a valid coordinate. Now we must //determine that this waypoint will be aligned exclusively to either the x or y axis of //the last waypoint in the list. pWay = pGroup->pWaypoints; @@ -540,10 +545,10 @@ BOOLEAN AddWaypointToPGroup( GROUP* pGroup, UINT8 ubSectorX, UINT8 ubSectorY ) / AddSectorToFrontOfMercPathForAllSoldiersInGroup( pGroup, pGroup->ubSectorX, pGroup->ubSectorY ); } - //Very special case that requiring specific coding. Check out the comments + //Very special case that requiring specific coding. Check out the comments //at the above function for more information. fReversingDirection = TRUE; - // ARM: Kris - new rulez. Must still fall through and add a waypoint anyway!!! + // ARM: Kris - new rulez. Must still fall through and add a waypoint anyway!!! } else { //No waypoints, so compare against the current location. @@ -557,7 +562,7 @@ BOOLEAN AddWaypointToPGroup( GROUP* pGroup, UINT8 ubSectorX, UINT8 ubSectorY ) / } } } - else + else { //we do have a waypoint list, so go to the last entry while( pWay->next ) { @@ -604,7 +609,7 @@ BOOLEAN AddWaypointToPGroup( GROUP* pGroup, UINT8 ubSectorX, UINT8 ubSectorY ) / pWay = pWay->next; } - AssertMsg( pWay, "Failed to allocate memory for waypoint." ); + AssertMsg( pWay, "Failed to allocate memory for waypoint." ); //Fill in the information for the new waypoint. pWay->x = ubSectorX; @@ -613,9 +618,9 @@ BOOLEAN AddWaypointToPGroup( GROUP* pGroup, UINT8 ubSectorX, UINT8 ubSectorY ) / //IMPORTANT: //The first waypoint added actually initiates the group's movement to the next sector. - if( pWay == pGroup->pWaypoints ) + if( pWay == pGroup->pWaypoints ) { - // don't do this if we have reversed directions!!! In that case, the required work has already been done back there + // don't do this if we have reversed directions!!! In that case, the required work has already been done back there if ( !fReversingDirection ) { //We need to calculate the next sector the group is moving to and post an event for it. @@ -690,7 +695,6 @@ GROUP* CreateNewEnemyGroupDepartingFromSector( UINT32 uiSector, UINT8 ubNumAdmin pNew->pEnemyGroup = (ENEMYGROUP*)MemAlloc( sizeof( ENEMYGROUP ) ); AssertMsg( pNew->pEnemyGroup, "MemAlloc failure during enemy group creation." ); memset( pNew->pEnemyGroup, 0, sizeof( ENEMYGROUP ) ); - // Make sure group is not bigger than allowed! while (ubNumAdmins + ubNumTroops + ubNumElites > gGameExternalOptions.iMaxEnemyGroupSize) { @@ -707,7 +711,6 @@ GROUP* CreateNewEnemyGroupDepartingFromSector( UINT32 uiSector, UINT8 ubNumAdmin ubNumElites--; } } - pNew->pWaypoints = NULL; pNew->ubSectorX = (UINT8)SECTORX( uiSector ); pNew->ubSectorY = (UINT8)SECTORY( uiSector ); @@ -731,19 +734,19 @@ GROUP* CreateNewEnemyGroupDepartingFromSector( UINT32 uiSector, UINT8 ubNumAdmin CHAR16 str[ 512 ]; if( PlayerMercsInSector( pNew->ubSectorX, pNew->ubSectorY, 0 ) || CountAllMilitiaInSector( pNew->ubSectorX, pNew->ubSectorY ) ) { - swprintf( str, L"Attempting to send enemy troops from player occupied location. " - L"Please ALT+TAB out of the game before doing anything else and send 'Strategic Decisions.txt' " - L"and this message. You'll likely need to revert to a previous save. If you can reproduce this " - L"with a save close to this event, that would really help me! -- KM:0" ); + swprintf( str, L"Attempting to send enemy troops from player occupied location. " + L"Please ALT+TAB out of the game before doing anything else and send 'Strategic Decisions.txt' " + L"and this message. You'll likely need to revert to a previous save. If you can reproduce this " + L"with a save close to this event, that would really help me! -- KM:0" ); DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, NULL ); } else if( pNew->ubGroupSize > 25 ) { - swprintf( str, L"Strategic AI warning: Creating an enemy group containing %d soldiers " - L"(%d admins, %d troops, %d elites) in sector %c%d. This message is a temporary test message " - L"to evaluate a potential problems with very large enemy groups.", - pNew->ubGroupSize, ubNumAdmins, ubNumTroops, ubNumElites, - pNew->ubSectorY + 'A' - 1, pNew->ubSectorX ); + swprintf( str, L"Strategic AI warning: Creating an enemy group containing %d soldiers " + L"(%d admins, %d troops, %d elites) in sector %c%d. This message is a temporary test message " + L"to evaluate a potential problems with very large enemy groups.", + pNew->ubGroupSize, ubNumAdmins, ubNumTroops, ubNumElites, + pNew->ubSectorY + 'A' - 1, pNew->ubSectorX ); DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, NULL ); } } @@ -757,9 +760,9 @@ GROUP* CreateNewEnemyGroupDepartingFromSector( UINT32 uiSector, UINT8 ubNumAdmin //INTERNAL LIST MANIPULATION FUNCTIONS //When adding any new group to the list, this is what must be done: -//1) Find the first unused ID (unique) -//2) Assign that ID to the new group -//3) Insert the group at the end of the list. +//1) Find the first unused ID (unique) +//2) Assign that ID to the new group +//3) Insert the group at the end of the list. UINT8 AddGroupToList( GROUP *pGroup ) { GROUP *curr; @@ -834,14 +837,14 @@ void RemoveGroupFromList( GROUP *pGroup ) temp->next = curr->next; break; } - curr = curr->next; + curr = curr->next; } if( curr == pGroup ) { //we found the group, so now remove it. UINT32 bit, index, mask; - + //clear the unique group ID index = pGroup->ubGroupID / 32; bit = pGroup->ubGroupID % 32; @@ -875,7 +878,7 @@ GROUP* GetGroup( UINT8 ubGroupID ) void HandleImportantPBIQuote( SOLDIERTYPE *pSoldier, GROUP *pInitiatingBattleGroup ) { // wake merc up for THIS quote - if( pSoldier->fMercAsleep ) + if( pSoldier->flags.fMercAsleep ) { TacticalCharacterDialogueWithSpecialEvent( pSoldier, QUOTE_ENEMY_PRESENCE, DIALOGUE_SPECIAL_EVENT_SLEEP, 0,0 ); TacticalCharacterDialogueWithSpecialEvent( pSoldier, QUOTE_ENEMY_PRESENCE, DIALOGUE_SPECIAL_EVENT_BEGINPREBATTLEINTERFACE, (UINT32)pInitiatingBattleGroup, 0 ); @@ -887,8 +890,8 @@ void HandleImportantPBIQuote( SOLDIERTYPE *pSoldier, GROUP *pInitiatingBattleGro } } -//If this is called, we are setting the game up to bring up the prebattle interface. Before doing so, -//one of the involved mercs will pipe up. When he is finished, we automatically go into the mapscreen, +//If this is called, we are setting the game up to bring up the prebattle interface. Before doing so, +//one of the involved mercs will pipe up. When he is finished, we automatically go into the mapscreen, //regardless of the mode we are in. void PrepareForPreBattleInterface( GROUP *pPlayerDialogGroup, GROUP *pInitiatingBattleGroup ) { @@ -901,9 +904,9 @@ void PrepareForPreBattleInterface( GROUP *pPlayerDialogGroup, GROUP *pInitiating SOLDIERTYPE *pSoldier; PLAYERGROUP *pPlayer; - if( fDisableMapInterfaceDueToBattle ) + if( fDisableMapInterfaceDueToBattle ) { - AssertMsg( 0, "fDisableMapInterfaceDueToBattle is set before attempting to bring up PBI. Please send PRIOR save if possible and details on anything that just happened before this battle." ); + AssertMsg( 0, "fDisableMapInterfaceDueToBattle is set before attempting to bring up PBI. Please send PRIOR save if possible and details on anything that just happened before this battle." ); return; } @@ -911,14 +914,14 @@ void PrepareForPreBattleInterface( GROUP *pPlayerDialogGroup, GROUP *pInitiating AssertMsg( pPlayerDialogGroup, "Didn't get a player dialog group for prebattle interface." ); pPlayer = pPlayerDialogGroup->pPlayerList; - AssertMsg( pPlayer, String( "Player group %d doesn't have *any* players in it! (Finding dialog group)", pPlayerDialogGroup->ubGroupID ) ); + AssertMsg( pPlayer, String( "Player group %d doesn't have *any* players in it! (Finding dialog group)", pPlayerDialogGroup->ubGroupID ) ); while( pPlayer != NULL ) { pSoldier = pPlayer->pSoldier; - if ( pSoldier->bLife >= OKLIFE && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && + if ( pSoldier->stats.bLife >= OKLIFE && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) && !AM_AN_EPC( pSoldier ) ) { ubMercsInGroup[ ubNumMercs ] = pSoldier->ubID; @@ -931,10 +934,10 @@ void PrepareForPreBattleInterface( GROUP *pPlayerDialogGroup, GROUP *pInitiating //Set music SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); - if( gfTacticalTraversal && pInitiatingBattleGroup == gpTacticalTraversalGroup || - pInitiatingBattleGroup && !pInitiatingBattleGroup->fPlayer && + if( gfTacticalTraversal && pInitiatingBattleGroup == gpTacticalTraversalGroup || + pInitiatingBattleGroup && !pInitiatingBattleGroup->fPlayer && pInitiatingBattleGroup->ubSectorX == gWorldSectorX && - pInitiatingBattleGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ ) + pInitiatingBattleGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ ) { // At least say quote.... if ( ubNumMercs > 0 ) { @@ -1005,17 +1008,16 @@ BOOLEAN CheckConditionsForBattle( GROUP *pGroup ) PLAYERGROUP *pPlayer; SOLDIERTYPE *pSoldier; BOOLEAN fBattlePending = FALSE; - BOOLEAN fPossibleQueuedBattle = FALSE; BOOLEAN fAliveMerc = FALSE; BOOLEAN fMilitiaPresent = FALSE; BOOLEAN fCombatAbleMerc = FALSE; BOOLEAN fBloodCatAmbush = FALSE; if( gfWorldLoaded ) - { //look for people arriving in the currently loaded sector. This handles reinforcements. + { //look for people arriving in the currently loaded sector. This handles reinforcements. curr = FindMovementGroupInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, TRUE ); - if( !gbWorldSectorZ && PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, gbWorldSectorZ ) && - pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && + if( !gbWorldSectorZ && PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, gbWorldSectorZ ) && + pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && curr ) { //Reinforcements have arrived! #ifdef JA2BETAVERSION @@ -1038,7 +1040,7 @@ BOOLEAN CheckConditionsForBattle( GROUP *pGroup ) } HandleOtherGroupsArrivingSimultaneously( pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubSectorZ ); - + curr = gpGroupList; while( curr ) { @@ -1052,21 +1054,21 @@ BOOLEAN CheckConditionsForBattle( GROUP *pGroup ) (!IsGroupTheHelicopterGroup( curr ) || !fHelicopterIsAirBorne) && (!curr->fVehicle || NumberMercsInVehicleGroup( curr )) ) { - //Now, a player group is in this sector. Determine if the group contains any mercs that can fight. - //Vehicles, EPCs and the robot doesn't count. Mercs below OKLIFE do. + //Now, a player group is in this sector. Determine if the group contains any mercs that can fight. + //Vehicles, EPCs and the robot doesn't count. Mercs below OKLIFE do. pPlayer = curr->pPlayerList; while( pPlayer ) { pSoldier = pPlayer->pSoldier; - if( !(pSoldier->uiStatusFlags & SOLDIER_VEHICLE) ) + if( !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) ) { - if( !AM_A_ROBOT( pSoldier ) && + if( !AM_A_ROBOT( pSoldier ) && !AM_AN_EPC( pSoldier ) && - pSoldier->bLife >= OKLIFE ) + pSoldier->stats.bLife >= OKLIFE ) { fCombatAbleMerc = TRUE; } - if( pSoldier->bLife > 0 ) + if( pSoldier->stats.bLife > 0 ) { fAliveMerc = TRUE; } @@ -1091,7 +1093,7 @@ BOOLEAN CheckConditionsForBattle( GROUP *pGroup ) if( pGroup->fPlayer ) { pPlayerDialogGroup = pGroup; - + if( NumEnemiesInSector( pGroup->ubSectorX, pGroup->ubSectorY ) ) { fBattlePending = TRUE; @@ -1114,7 +1116,7 @@ BOOLEAN CheckConditionsForBattle( GROUP *pGroup ) } if( fBattlePending && (!fBloodCatAmbush || gubEnemyEncounterCode == ENTERING_BLOODCAT_LAIR_CODE) ) - { + { if( PossibleToCoordinateSimultaneousGroupArrivals( pGroup ) ) { return FALSE; @@ -1135,16 +1137,16 @@ BOOLEAN CheckConditionsForBattle( GROUP *pGroup ) } if( !fAliveMerc && !fMilitiaPresent ) - { //empty vehicle, everyone dead, don't care. Enemies don't care. + { //empty vehicle, everyone dead, don't care. Enemies don't care. return FALSE; } if( fBattlePending ) { //A battle is pending, but the players could be all unconcious or dead. - //Go through every group until we find at least one concious merc. The looping will determine - //if there are any live mercs and/or concious ones. If there are no concious mercs, but alive ones, + //Go through every group until we find at least one concious merc. The looping will determine + //if there are any live mercs and/or concious ones. If there are no concious mercs, but alive ones, //then we will go straight to autoresolve, where the enemy will likely annihilate them or capture them. - //If there are no alive mercs, then there is nothing anybody can do. The enemy will completely ignore + //If there are no alive mercs, then there is nothing anybody can do. The enemy will completely ignore //this, and continue on. #ifdef JA2BETAVERSION ValidateGroups( pGroup ); @@ -1153,7 +1155,7 @@ BOOLEAN CheckConditionsForBattle( GROUP *pGroup ) StopTimeCompression(); if( gubNumGroupsArrivedSimultaneously ) - { //Because this is a battle case, clear all the group flags + { //Because this is a battle case, clear all the group flags curr = gpGroupList; while( curr && gubNumGroupsArrivedSimultaneously ) { @@ -1162,7 +1164,7 @@ BOOLEAN CheckConditionsForBattle( GROUP *pGroup ) curr->uiFlags &= ~GROUPFLAG_GROUP_ARRIVED_SIMULTANEOUSLY; gubNumGroupsArrivedSimultaneously--; } - curr = curr->next; + curr = curr->next; } } @@ -1244,7 +1246,7 @@ void CalculateNextMoveIntention( GROUP *pGroup ) Assert( pGroup ); - //TEMP: Ignore resting... + //TEMP: Ignore resting... //Should be surely an enemy group that has just made a new decision to go elsewhere! if( pGroup->fBetweenSectors ) @@ -1293,9 +1295,9 @@ void CalculateNextMoveIntention( GROUP *pGroup ) case CIRCULAR: wp = wp->next; if( !wp ) - { //reached the end of the patrol route. Set to the first waypoint in list, indefinately. - //NOTE: If the last waypoint isn't exclusively aligned to the x or y axis of the first - // waypoint, there will be an assertion failure inside the waypoint movement code. + { //reached the end of the patrol route. Set to the first waypoint in list, indefinately. + //NOTE: If the last waypoint isn't exclusively aligned to the x or y axis of the first + // waypoint, there will be an assertion failure inside the waypoint movement code. pGroup->ubNextWaypointID = 0; } else @@ -1328,12 +1330,9 @@ void CalculateNextMoveIntention( GROUP *pGroup ) BOOLEAN AttemptToMergeSeparatedGroups( GROUP *pGroup, BOOLEAN fDecrementTraversals ) { - GROUP *curr = NULL; - SOLDIERTYPE *pSoldier = NULL, *pCharacter = NULL; - PLAYERGROUP *pPlayer = NULL; - BOOLEAN fSuccess = FALSE; + //SOLDIERTYPE *pSoldier = NULL, *pCharacter = NULL; #ifdef JA2BETAVERSION - INT32 counter = 0; + //INT32 counter = 0; #endif return FALSE; #if 0 @@ -1348,7 +1347,7 @@ BOOLEAN AttemptToMergeSeparatedGroups( GROUP *pGroup, BOOLEAN fDecrementTraversa pPlayer = pGroup->pPlayerList; while( pPlayer ) { - pPlayer->pSoldier->uiStatusFlags &= ~SOLDIER_IS_TACTICALLY_VALID; + pPlayer->pSoldier->flags.uiStatusFlags &= ~SOLDIER_IS_TACTICALLY_VALID; pPlayer = pPlayer->next; } @@ -1378,18 +1377,18 @@ BOOLEAN AttemptToMergeSeparatedGroups( GROUP *pGroup, BOOLEAN fDecrementTraversa if( curr->ubSectorX == pGroup->ubSectorX && curr->ubSectorY == pGroup->ubSectorY && curr->pPlayerList->pSoldier->bSectorZ == pGroup->pPlayerList->pSoldier->bSectorZ ) { //This group is in the same sector as us - if( curr->pPlayerList->pSoldier->bAssignment == pGroup->pPlayerList->pSoldier->ubDesiredSquadAssignment || - curr->pPlayerList->pSoldier->ubDesiredSquadAssignment == pGroup->pPlayerList->pSoldier->ubDesiredSquadAssignment ) + if( curr->pPlayerList->pSoldier->bAssignment == pGroup->pPlayerList->pSoldier->ubDesiredSquadAssignment || + curr->pPlayerList->pSoldier->ubDesiredSquadAssignment == pGroup->pPlayerList->pSoldier->ubDesiredSquadAssignment ) { //This group is the one we want to join (or has the same desire)! pSoldier = pGroup->pPlayerList->pSoldier; - + //First, set up flags for the current group to not relocate and walk in sector (they are already there) pPlayer = curr->pPlayerList; while( pPlayer ) { - if( pPlayer->pSoldier->uiStatusFlags & SOLDIER_IS_TACTICALLY_VALID ) + if( pPlayer->pSoldier->flags.uiStatusFlags & SOLDIER_IS_TACTICALLY_VALID ) { - pPlayer->pSoldier->uiStatusFlags |= SOLDIER_IS_TACTICALLY_VALID; + pPlayer->pSoldier->flags.uiStatusFlags |= SOLDIER_IS_TACTICALLY_VALID; } pPlayer = pPlayer->next; } @@ -1437,16 +1436,16 @@ BOOLEAN AttemptToMergeSeparatedGroups( GROUP *pGroup, BOOLEAN fDecrementTraversa if( curr->ubSectorX == pGroup->ubSectorX && curr->ubSectorY == pGroup->ubSectorY ) { //This group is in the same sector as us if( curr->pPlayerList->pSoldier->ubDesiredSquadAssignment == pGroup->pPlayerList->pSoldier->bAssignment || - curr->pPlayerList->pSoldier->ubDesiredSquadAssignment == pGroup->pPlayerList->pSoldier->ubDesiredSquadAssignment ) + curr->pPlayerList->pSoldier->ubDesiredSquadAssignment == pGroup->pPlayerList->pSoldier->ubDesiredSquadAssignment ) { //This group wants to join our group! //First, set up flags for the current group to not relocate and walk in sector (they are already there) pPlayer = curr->pPlayerList; //if( curr->ubSectorX while( pPlayer ) { - if( pPlayer->pSoldier->uiStatusFlags & SOLDIER_IS_TACTICALLY_VALID ) + if( pPlayer->pSoldier->flags.uiStatusFlags & SOLDIER_IS_TACTICALLY_VALID ) { - pPlayer->pSoldier->uiStatusFlags |= SOLDIER_IS_TACTICALLY_VALID; + pPlayer->pSoldier->flags.uiStatusFlags |= SOLDIER_IS_TACTICALLY_VALID; } pPlayer = pPlayer->next; } @@ -1500,30 +1499,30 @@ void AwardExperienceForTravelling( GROUP * pGroup ) } pPlayerGroup = pGroup->pPlayerList; - while ( pPlayerGroup ) + while ( pPlayerGroup ) { pSoldier = pPlayerGroup->pSoldier; - if( pSoldier && !AM_A_ROBOT( pSoldier ) && - !AM_AN_EPC( pSoldier ) && !(pSoldier->uiStatusFlags & SOLDIER_VEHICLE) ) + if( pSoldier && !AM_A_ROBOT( pSoldier ) && + !AM_AN_EPC( pSoldier ) && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) ) { - if ( pSoldier->bLifeMax < 100 ) + if ( pSoldier->stats.bLifeMax < 100 ) { // award exp... // amount was originally based on getting 100-bLifeMax points for 12 hours of travel (720) // but changed to flat rate since StatChange makes roll vs 100-lifemax as well! - uiPoints = pGroup->uiTraverseTime / (450 / 100 - pSoldier->bLifeMax ); + uiPoints = pGroup->uiTraverseTime / (450 / 100 - pSoldier->stats.bLifeMax ); if ( uiPoints > 0 ) { StatChange( pSoldier, HEALTHAMT, (UINT8) uiPoints, FALSE ); } } - if ( pSoldier->bStrength < 100 ) + if ( pSoldier->stats.bStrength < 100 ) { uiCarriedPercent = CalculateCarriedWeight( pSoldier ); if ( uiCarriedPercent > 50 ) { - uiPoints = pGroup->uiTraverseTime / (450 / (100 - pSoldier->bStrength ) ); + uiPoints = pGroup->uiTraverseTime / (450 / (100 - pSoldier->stats.bStrength ) ); StatChange( pSoldier, STRAMT, ( UINT16 ) ( uiPoints * ( uiCarriedPercent - 50) / 100 ), FALSE ); } } @@ -1535,8 +1534,8 @@ void AwardExperienceForTravelling( GROUP * pGroup ) void AddCorpsesToBloodcatLair( INT16 sSectorX, INT16 sSectorY ) { - ROTTING_CORPSE_DEFINITION Corpse; - INT16 sXPos, sYPos; + ROTTING_CORPSE_DEFINITION Corpse; + INT16 sXPos, sYPos; memset( &Corpse, 0, sizeof( ROTTING_CORPSE_DEFINITION ) ); @@ -1549,19 +1548,19 @@ void AddCorpsesToBloodcatLair( INT16 sSectorX, INT16 sSectorY ) SET_PALETTEREP_ID ( Corpse.HeadPal, "BROWNHEAD" ); SET_PALETTEREP_ID ( Corpse.VestPal, "YELLOWVEST" ); SET_PALETTEREP_ID ( Corpse.SkinPal, "PINKSKIN" ); - SET_PALETTEREP_ID ( Corpse.PantsPal, "GREENPANTS" ); + SET_PALETTEREP_ID ( Corpse.PantsPal, "GREENPANTS" ); Corpse.ubDirection = (UINT8)Random(8); // Set time of death - // Make sure they will be rotting! + // Make sure they will be rotting! Corpse.uiTimeOfDeath = GetWorldTotalMin( ) - ( 2 * NUM_SEC_IN_DAY / 60 ); // Set type Corpse.ubType = (UINT8)SMERC_JFK; Corpse.usFlags = ROTTING_CORPSE_FIND_SWEETSPOT_FROM_GRIDNO; - // 1st gridno + // 1st gridno Corpse.sGridNo = 14319; ConvertGridNoToXY( Corpse.sGridNo, &sXPos, &sYPos ); Corpse.dXPos = (FLOAT)( CenterX( sXPos ) ); @@ -1571,7 +1570,7 @@ void AddCorpsesToBloodcatLair( INT16 sSectorX, INT16 sSectorY ) AddRottingCorpseToUnloadedSectorsRottingCorpseFile( sSectorX, sSectorY, 0, &Corpse); - // 2nd gridno + // 2nd gridno Corpse.sGridNo = 9835; ConvertGridNoToXY( Corpse.sGridNo, &sXPos, &sYPos ); Corpse.dXPos = (FLOAT)( CenterX( sXPos ) ); @@ -1581,7 +1580,7 @@ void AddCorpsesToBloodcatLair( INT16 sSectorX, INT16 sSectorY ) AddRottingCorpseToUnloadedSectorsRottingCorpseFile( sSectorX, sSectorY, 0, &Corpse); - // 3rd gridno + // 3rd gridno Corpse.sGridNo = 11262; ConvertGridNoToXY( Corpse.sGridNo, &sXPos, &sYPos ); Corpse.dXPos = (FLOAT)( CenterX( sXPos ) ); @@ -1599,7 +1598,7 @@ void AddCorpsesToBloodcatLair( INT16 sSectorX, INT16 sSectorY ) //............... //This is called whenever any group arrives in the next sector (player or enemy) //This function will first check to see if a battle should start, or if they -//aren't at the final destination, they will move to the next sector. +//aren't at the final destination, they will move to the next sector. void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNeverLeft ) { GROUP *pGroup; @@ -1610,7 +1609,6 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe BOOLEAN fExceptionQueue = FALSE; BOOLEAN fFirstTimeInSector = FALSE; BOOLEAN fGroupDestroyed = FALSE; - BOOLEAN fVehicleStranded = FALSE; // reset gfWaitingForInput = FALSE; @@ -1625,7 +1623,7 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe if( pGroup->fPlayer ) { - //Set the fact we have visited the sector + //Set the fact we have visited the sector curr = pGroup->pPlayerList; if( curr ) { @@ -1639,10 +1637,10 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe while( curr ) { - curr->pSoldier->uiStatusFlags &= ~SOLDIER_SHOULD_BE_TACTICALLY_VALID; + curr->pSoldier->flags.uiStatusFlags &= ~SOLDIER_SHOULD_BE_TACTICALLY_VALID; curr = curr->next; } - + if( pGroup->fVehicle ) { if( ( iVehId = ( GivenMvtGroupIdFindVehicleId( ubGroupID ) ) ) != -1 ) @@ -1663,12 +1661,12 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe if( pGroup->pPlayerList == NULL ) { // nobody here, better just get out now - AssertMsg( 0, String( "Player group %d arrived in sector empty. KM 0", ubGroupID ) ); + AssertMsg( 0, String( "Player group %d arrived in sector empty. KM 0", ubGroupID ) ); return; } } } - //Check for exception cases which + //Check for exception cases which if( gTacticalStatus.bBoxingState != NOT_BOXING ) { if( !pGroup->fPlayer && pGroup->ubNextX == 5 && pGroup->ubNextY == 4 && pGroup->ubSectorZ == 0 ) @@ -1677,15 +1675,15 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe } } //First check if the group arriving is going to queue another battle. - //NOTE: We can't have more than one battle ongoing at a time. - if( fExceptionQueue || fCheckForBattle && gTacticalStatus.fEnemyInSector && - FindMovementGroupInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, TRUE ) && - (pGroup->ubNextX != gWorldSectorX || pGroup->ubNextY != gWorldSectorY || gbWorldSectorZ > 0 ) || - AreInMeanwhile() || - //KM : Aug 11, 1999 -- Patch fix: Added additional checks to prevent a 2nd battle in the case - // where the player is involved in a potential battle with bloodcats/civilians + //NOTE: We can't have more than one battle ongoing at a time. + if( fExceptionQueue || fCheckForBattle && gTacticalStatus.fEnemyInSector && + FindMovementGroupInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, TRUE ) && + (pGroup->ubNextX != gWorldSectorX || pGroup->ubNextY != gWorldSectorY || gbWorldSectorZ > 0 ) || + AreInMeanwhile() || + //KM : Aug 11, 1999 -- Patch fix: Added additional checks to prevent a 2nd battle in the case + // where the player is involved in a potential battle with bloodcats/civilians fCheckForBattle && HostileCiviliansPresent() || - fCheckForBattle && HostileBloodcatsPresent() + fCheckForBattle && HostileBloodcatsPresent() ) { //QUEUE BATTLE! @@ -1693,8 +1691,8 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe //too suspicious after it happens to him a few times, which, by the way, is a rare occurrence. if( AreInMeanwhile() ) { - pGroup->uiArrivalTime ++; //tack on only 1 minute if we are in a meanwhile scene. This effectively - //prevents any battle from occurring while inside a meanwhile scene. + pGroup->uiArrivalTime ++; //tack on only 1 minute if we are in a meanwhile scene. This effectively + //prevents any battle from occurring while inside a meanwhile scene. } else { @@ -1709,7 +1707,7 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe { if( pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY > GetWorldTotalMin( ) ) { - AddStrategicEvent( EVENT_GROUP_ABOUT_TO_ARRIVE, pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY, pGroup->ubGroupID ); + AddStrategicEvent( EVENT_GROUP_ABOUT_TO_ARRIVE, pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY, pGroup->ubGroupID ); } } @@ -1744,10 +1742,10 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe SOLDIERTYPE *pSoldier; INT32 iVehicleID; iVehicleID = GivenMvtGroupIdFindVehicleId( pGroup->ubGroupID ); - AssertMsg( iVehicleID != -1, "GroupArrival for vehicle group. Invalid iVehicleID. " ); + AssertMsg( iVehicleID != -1, "GroupArrival for vehicle group. Invalid iVehicleID. " ); pSoldier = GetSoldierStructureForVehicle( iVehicleID ); - AssertMsg( pSoldier, "GroupArrival for vehicle group. Invalid soldier pointer." ); + AssertMsg( pSoldier, "GroupArrival for vehicle group. Invalid soldier pointer." ); SpendVehicleFuel( pSoldier, (INT16)(pGroup->uiTraverseTime*6) ); @@ -1827,7 +1825,7 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe curr = pGroup->pPlayerList; while( curr ) { - curr->pSoldier->fBetweenSectors = FALSE; + curr->pSoldier->flags.fBetweenSectors = FALSE; curr->pSoldier->sSectorX = pGroup->ubSectorX; curr->pSoldier->sSectorY = pGroup->ubSectorY; curr->pSoldier->bSectorZ = pGroup->ubSectorZ; @@ -1835,19 +1833,19 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe curr->pSoldier->ubInsertionDirection = ubInsertionDirection; // don't override if a tactical traversal - if( curr->pSoldier->ubStrategicInsertionCode != INSERTION_CODE_PRIMARY_EDGEINDEX && + if( curr->pSoldier->ubStrategicInsertionCode != INSERTION_CODE_PRIMARY_EDGEINDEX && curr->pSoldier->ubStrategicInsertionCode != INSERTION_CODE_SECONDARY_EDGEINDEX ) { curr->pSoldier->ubStrategicInsertionCode = ubStrategicInsertionCode; } - + if( curr->pSoldier->pMercPath ) { // remove head from their mapscreen path list curr->pSoldier->pMercPath = RemoveHeadFromStrategicPath( curr->pSoldier->pMercPath ); } - // ATE: Alrighty, check if this sector is currently loaded, if so, + // ATE: Alrighty, check if this sector is currently loaded, if so, // add them to the tactical engine! if ( pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && pGroup->ubSectorZ == gbWorldSectorZ ) { @@ -1871,7 +1869,7 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe else { // a loner - ScreenMsg( FONT_MCOLOR_DKRED, MSG_INTERFACE, pMessageStrings[ MSG_ARRIVE ], pGroup->pPlayerList->pSoldier->name, pMapVertIndex[ pGroup->pPlayerList->pSoldier->sSectorY ], pMapHortIndex[ pGroup->pPlayerList->pSoldier->sSectorX ] ); + ScreenMsg( FONT_MCOLOR_DKRED, MSG_INTERFACE, pMessageStrings[ MSG_ARRIVE ], pGroup->pPlayerList->pSoldier->name, pMapVertIndex[ pGroup->pPlayerList->pSoldier->sSectorY ], pMapHortIndex[ pGroup->pPlayerList->pSoldier->sSectorX ] ); } } } @@ -1881,7 +1879,7 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe iVehId = GivenMvtGroupIdFindVehicleId( ubGroupID ); Assert(iVehId != -1 ); - if( pVehicleList[ iVehId ].pMercPath ) + if( pVehicleList[ iVehId ].pMercPath ) { // remove head from vehicle's mapscreen path list pVehicleList[ iVehId ].pMercPath = RemoveHeadFromStrategicPath( pVehicleList[ iVehId ].pMercPath ); @@ -1900,14 +1898,14 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe pSoldier = GetSoldierStructureForVehicle( iVehId ); Assert( pSoldier ); - pSoldier->fBetweenSectors = FALSE; + pSoldier->flags.fBetweenSectors = FALSE; pSoldier->sSectorX = pGroup->ubSectorX; pSoldier->sSectorY = pGroup->ubSectorY; pSoldier->bSectorZ = pGroup->ubSectorZ; pSoldier->ubInsertionDirection = ubInsertionDirection; // ATE: Removed, may 21 - sufficient to use insertion direction... - //pSoldier->bDesiredDirection = ubInsertionDirection; + //pSoldier->pathing.bDesiredDirection = ubInsertionDirection; pSoldier->ubStrategicInsertionCode = ubStrategicInsertionCode; @@ -1924,14 +1922,14 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe curr = pGroup->pPlayerList; while( curr ) { - curr->pSoldier->fBetweenSectors = FALSE; + curr->pSoldier->flags.fBetweenSectors = FALSE; curr->pSoldier->sSectorX = pGroup->ubSectorX; curr->pSoldier->sSectorY = pGroup->ubSectorY; curr->pSoldier->bSectorZ = pGroup->ubSectorZ; curr->pSoldier->ubInsertionDirection = ubInsertionDirection; // ATE: Removed, may 21 - sufficient to use insertion direction... - // curr->pSoldier->bDesiredDirection = ubInsertionDirection; + // curr->pSoldier->pathing.bDesiredDirection = ubInsertionDirection; curr->pSoldier->ubStrategicInsertionCode = ubStrategicInsertionCode; @@ -1975,12 +1973,12 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe if ( !pGroup->fVehicle || !IsGroupTheHelicopterGroup( pGroup ) ) { - // ATE: Add a few corpse to the bloodcat lair... - if ( SECTOR( pGroup->ubSectorX, pGroup->ubSectorY ) == SEC_I16 && fFirstTimeInSector ) - { - AddCorpsesToBloodcatLair( pGroup->ubSectorX, pGroup->ubSectorY ); - } - + // ATE: Add a few corpse to the bloodcat lair... + if ( SECTOR( pGroup->ubSectorX, pGroup->ubSectorY ) == SEC_I16 && fFirstTimeInSector ) + { + AddCorpsesToBloodcatLair( pGroup->ubSectorX, pGroup->ubSectorY ); + } + // mark the sector as visited already SetSectorFlag( pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubSectorZ, SF_ALREADY_VISITED ); } @@ -1994,14 +1992,14 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe if ( !fGroupDestroyed ) { //Determine if a battle should start. - //if a battle does start, or gets delayed, then we will keep the group in memory including - //all waypoints, until after the battle is resolved. At that point, we will continue the processing. + //if a battle does start, or get's delayed, then we will keep the group in memory including + //all waypoints, until after the battle is resolved. At that point, we will continue the processing. if( fCheckForBattle && !CheckConditionsForBattle( pGroup ) && !gfWaitingForInput ) { GROUP *next; HandleNonCombatGroupArrival( pGroup, TRUE, fNeverLeft ); - if( gubNumGroupsArrivedSimultaneously ) + if( gubNumGroupsArrivedSimultaneously ) { pGroup = gpGroupList; while( gubNumGroupsArrivedSimultaneously && pGroup ) @@ -2020,7 +2018,7 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe { //Handle cases for pre battle conditions pGroup->uiFlags = 0; if( gubNumAwareBattles ) - { //When the AI is looking for the players, and a battle is initiated, then + { //When the AI is looking for the players, and a battle is initiated, then //decrement the value, otherwise the queen will continue searching to infinity. gubNumAwareBattles--; } @@ -2033,7 +2031,7 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe void HandleNonCombatGroupArrival( GROUP *pGroup, BOOLEAN fMainGroup, BOOLEAN fNeverLeft ) -{ +{ // if any mercs are actually in the group if( StrategicAILookForAdjacentGroups( pGroup ) ) @@ -2102,7 +2100,7 @@ void HandleNonCombatGroupArrival( GROUP *pGroup, BOOLEAN fMainGroup, BOOLEAN fNe //Because a battle is about to start, we need to go through the event list and look for other //groups that may arrive at the same time -- enemies or players, and blindly add them to the sector -//without checking for battle conditions, as it has already determined that a new battle is about to +//without checking for battle conditions, as it has already determined that a new battle is about to //start. void HandleOtherGroupsArrivingSimultaneously( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubSectorZ ) { @@ -2135,8 +2133,8 @@ void HandleOtherGroupsArrivingSimultaneously( UINT8 ubSectorX, UINT8 ubSectorY, } } -//The user has just approved to plan a simultaneous arrival. So we will syncronize all of the involved -//groups so that they arrive at the same time (which is the time the final group would arrive). +//The user has just approved to plan a simultaneous arrival. So we will syncronize all of the involved +//groups so that they arrive at the same time (which is the time the final group would arrive). void PrepareGroupsForSimultaneousArrival() { GROUP *pGroup; @@ -2147,10 +2145,10 @@ void PrepareGroupsForSimultaneousArrival() pGroup = gpGroupList; while( pGroup ) { //For all of the groups that haven't arrived yet, determine which one is going to take the longest. - if( pGroup != gpPendingSimultaneousGroup - && pGroup->fPlayer - && pGroup->fBetweenSectors - && pGroup->ubNextX == gpPendingSimultaneousGroup->ubSectorX + if( pGroup != gpPendingSimultaneousGroup + && pGroup->fPlayer + && pGroup->fBetweenSectors + && pGroup->ubNextX == gpPendingSimultaneousGroup->ubSectorX && pGroup->ubNextY == gpPendingSimultaneousGroup->ubSectorY && !IsGroupTheHelicopterGroup( pGroup ) ) { @@ -2158,7 +2156,7 @@ void PrepareGroupsForSimultaneousArrival() pGroup->uiFlags |= GROUPFLAG_SIMULTANEOUSARRIVAL_APPROVED | GROUPFLAG_MARKER; } pGroup = pGroup->next; - } + } //Now, go through the list again, and reset their arrival event to the latest arrival time. pGroup = gpGroupList; while( pGroup ) @@ -2171,12 +2169,12 @@ void PrepareGroupsForSimultaneousArrival() // if you have any code that uses these 3 values to figure out how far along its route a group is! SetGroupArrivalTime( pGroup, uiLatestArrivalTime ); AddStrategicEvent( EVENT_GROUP_ARRIVAL, pGroup->uiArrivalTime, pGroup->ubGroupID ); - + if( pGroup->fPlayer ) { if( pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY > GetWorldTotalMin( ) ) { - AddStrategicEvent( EVENT_GROUP_ABOUT_TO_ARRIVE, pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY, pGroup->ubGroupID ); + AddStrategicEvent( EVENT_GROUP_ABOUT_TO_ARRIVE, pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY, pGroup->ubGroupID ); } } @@ -2186,7 +2184,7 @@ void PrepareGroupsForSimultaneousArrival() } pGroup = pGroup->next; } - //We still have the first group that has arrived. Because they are set up to be in the destination + //We still have the first group that has arrived. Because they are set up to be in the destination //sector, we will "warp" them back to the last sector, and also setup a new arrival time for them. pGroup = gpPendingSimultaneousGroup; pGroup->ubNextX = pGroup->ubSectorX; @@ -2207,25 +2205,25 @@ void PrepareGroupsForSimultaneousArrival() if( pSoldier ) { - pSoldier->fBetweenSectors = TRUE; + pSoldier->flags.fBetweenSectors = TRUE; } } } AddStrategicEvent( EVENT_GROUP_ARRIVAL, pGroup->uiArrivalTime, pGroup->ubGroupID ); - + if( pGroup->fPlayer ) { if( pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY > GetWorldTotalMin( ) ) { - AddStrategicEvent( EVENT_GROUP_ABOUT_TO_ARRIVE, pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY, pGroup->ubGroupID ); + AddStrategicEvent( EVENT_GROUP_ABOUT_TO_ARRIVE, pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY, pGroup->ubGroupID ); } } DelayEnemyGroupsIfPathsCross( pGroup ); } -//See if there are other groups OTW. If so, and if we haven't asked the user yet to plan -//a simultaneous attack, do so now, and readjust the groups accordingly. If it is possible +//See if there are other groups OTW. If so, and if we haven't asked the user yet to plan +//a simultaneous attack, do so now, and readjust the groups accordingly. If it is possible //to do so, then we will set up the gui, and postpone the prebattle interface. BOOLEAN PossibleToCoordinateSimultaneousGroupArrivals( GROUP *pFirstGroup ) { @@ -2233,13 +2231,13 @@ BOOLEAN PossibleToCoordinateSimultaneousGroupArrivals( GROUP *pFirstGroup ) UINT8 ubNumNearbyGroups = 0; //If the user has already been asked, then don't ask the question again! - if( pFirstGroup->uiFlags & (GROUPFLAG_SIMULTANEOUSARRIVAL_APPROVED | GROUPFLAG_SIMULTANEOUSARRIVAL_CHECKED) || + if( pFirstGroup->uiFlags & (GROUPFLAG_SIMULTANEOUSARRIVAL_APPROVED | GROUPFLAG_SIMULTANEOUSARRIVAL_CHECKED) || IsGroupTheHelicopterGroup( pFirstGroup ) ) { return FALSE; } - //We can't coordinate simultaneous attacks on a sector without any stationary forces! Otherwise, it + //We can't coordinate simultaneous attacks on a sector without any stationary forces! Otherwise, it //is possible that they will be gone when you finally arrive. //if( !NumStationaryEnemiesInSector( pFirstGroup->ubSectorX, pFirstGroup->ubSectorY ) ) // return FALSE; @@ -2249,8 +2247,8 @@ BOOLEAN PossibleToCoordinateSimultaneousGroupArrivals( GROUP *pFirstGroup ) pGroup = gpGroupList; while( pGroup ) { - if( pGroup != pFirstGroup && pGroup->fPlayer && pGroup->fBetweenSectors && - pGroup->ubNextX == pFirstGroup->ubSectorX && pGroup->ubNextY == pFirstGroup->ubSectorY && + if( pGroup != pFirstGroup && pGroup->fPlayer && pGroup->fBetweenSectors && + pGroup->ubNextX == pFirstGroup->ubSectorX && pGroup->ubNextY == pFirstGroup->ubSectorY && !(pGroup->uiFlags & GROUPFLAG_SIMULTANEOUSARRIVAL_CHECKED) && !IsGroupTheHelicopterGroup( pGroup ) ) { @@ -2286,20 +2284,20 @@ BOOLEAN PossibleToCoordinateSimultaneousGroupArrivals( GROUP *pFirstGroup ) pEnemyType = gpStrategicString[ STR_PB_ENEMIES ]; } //header, sector, singular/plural str, confirmation string. - //Ex: Enemies have been detected in sector J9 and another squad is - // about to arrive. Do you wish to coordinate a simultaneous arrival? - swprintf( str, pStr, + //Ex: Enemies have been detected in sector J9 and another squad is + // about to arrive. Do you wish to coordinate a simultaneous arrival? + swprintf( str, pStr, pEnemyType, //Enemy type (Enemies or bloodcats) 'A' + gpPendingSimultaneousGroup->ubSectorY - 1, gpPendingSimultaneousGroup->ubSectorX ); //Sector location wcscat( str, L" " ); wcscat( str, gpStrategicString[ STR_COORDINATE ] ); //Setup the dialog - //Kris August 03, 1999 Bug fix: Changed 1st line to 2nd line to fix game breaking if this dialog came up while in tactical. - // It would kick you to mapscreen, where things would break... + //Kris August 03, 1999 Bug fix: Changed 1st line to 2nd line to fix game breaking if this dialog came up while in tactical. + // It would kick you to mapscreen, where things would break... //DoMapMessageBox( MSG_BOX_BASIC_STYLE, str, MAP_SCREEN, MSG_BOX_FLAG_YESNO, PlanSimultaneousGroupArrivalCallback ); DoMapMessageBox( MSG_BOX_BASIC_STYLE, str, guiCurrentScreen, MSG_BOX_FLAG_YESNO, PlanSimultaneousGroupArrivalCallback ); - + gfWaitingForInput = TRUE; return TRUE; } @@ -2308,7 +2306,7 @@ BOOLEAN PossibleToCoordinateSimultaneousGroupArrivals( GROUP *pFirstGroup ) void PlanSimultaneousGroupArrivalCallback( UINT8 bMessageValue ) { - if( bMessageValue == MSG_BOX_RETURN_YES ) + if( bMessageValue == MSG_BOX_RETURN_YES ) { PrepareGroupsForSimultaneousArrival(); } @@ -2378,11 +2376,11 @@ void InitiateGroupMovementToNextSector( GROUP *pGroup ) dy = wp->y - pGroup->ubSectorY; if( dx && dy ) { //Can't move diagonally! - AssertMsg( 0, String("Attempting to move to waypoint in a diagonal direction from sector %d,%d to sector %d,%d", + AssertMsg( 0, String("Attempting to move to waypoint in a diagonal direction from sector %d,%d to sector %d,%d", pGroup->ubSectorX, pGroup->ubSectorY, wp->x, wp->y ) ); } if( !dx && !dy ) //Can't move to position currently at! - AssertMsg( 0, String("Attempting to move to waypoint %d, %d that you are already at!", wp->x, wp->y ) ); + AssertMsg( 0, String("Attempting to move to waypoint %d, %d that you are already at!", wp->x, wp->y ) ); //Clip dx/dy value so that the move is for only one sector. if( dx >= 1 ) { @@ -2418,14 +2416,14 @@ void InitiateGroupMovementToNextSector( GROUP *pGroup ) { BOOLEAN fCalcRegularTime = TRUE; if( !pGroup->fPlayer ) - { //Determine if the enemy group is "sleeping". If so, then simply delay their arrival time by the amount of time + { //Determine if the enemy group is "sleeping". If so, then simply delay their arrival time by the amount of time //they are going to be sleeping for. if( GetWorldHour() >= 21 || GetWorldHour() <= 4 ) { //It is definitely night time. if( Chance( 67 ) ) { //2 in 3 chance of going to sleep. pGroup->uiTraverseTime = GetSectorMvtTimeForGroup( ubSector, ubDirection, pGroup ); - uiSleepMinutes = 360 + Random( 121 ); //6-8 hours sleep + uiSleepMinutes = 360 + Random( 121 ); //6-8 hours sleep fCalcRegularTime = FALSE; } } @@ -2442,7 +2440,7 @@ void InitiateGroupMovementToNextSector( GROUP *pGroup ) if( pGroup->uiTraverseTime == 0xffffffff ) { - AssertMsg( 0, String("Group %d (%s) attempting illegal move from %c%d to %c%d (%s).", + AssertMsg( 0, String("Group %d (%s) attempting illegal move from %c%d to %c%d (%s).", pGroup->ubGroupID, ( pGroup->fPlayer ) ? "Player" : "AI", pGroup->ubSectorY+'A'-1, pGroup->ubSectorX, pGroup->ubNextY+'A'-1, pGroup->ubNextX, gszTerrain[SectorInfo[ubSector].ubTraversability[ubDirection]] ) ); @@ -2471,7 +2469,7 @@ void InitiateGroupMovementToNextSector( GROUP *pGroup ) // and set it's arrival time SetGroupArrivalTime( pGroup, GetWorldTotalMin() + pGroup->uiTraverseTime ); } - // NOTE: if the group is already between sectors, DON'T MESS WITH ITS ARRIVAL TIME! THAT'S NOT OUR JOB HERE!!! + // NOTE: if the group is already between sectors, DON'T MESS WITH ITS ARRIVAL TIME! THAT'S NOT OUR JOB HERE!!! // special override for AI patrol initialization only @@ -2493,7 +2491,7 @@ void InitiateGroupMovementToNextSector( GROUP *pGroup ) if( pSoldier ) { - pSoldier->fBetweenSectors = TRUE; + pSoldier->flags.fBetweenSectors = TRUE; // OK, Remove the guy from tactical engine! RemoveSoldierFromTacticalSector( pSoldier, TRUE ); @@ -2513,13 +2511,13 @@ void InitiateGroupMovementToNextSector( GROUP *pGroup ) if( pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY > GetWorldTotalMin( ) ) { - AddStrategicEvent( EVENT_GROUP_ABOUT_TO_ARRIVE, pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY, pGroup->ubGroupID ); + AddStrategicEvent( EVENT_GROUP_ABOUT_TO_ARRIVE, pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY, pGroup->ubGroupID ); } curr = pGroup->pPlayerList; while( curr ) { - curr->pSoldier->fBetweenSectors = TRUE; + curr->pSoldier->flags.fBetweenSectors = TRUE; // OK, Remove the guy from tactical engine! RemoveSoldierFromTacticalSector( curr->pSoldier, TRUE ); @@ -2548,7 +2546,7 @@ void RemoveGroupWaypoints( UINT8 ubGroupID ) void RemovePGroupWaypoints( GROUP *pGroup ) { WAYPOINT* wp; - //if there aren't any waypoints to delete, then return. This also avoids setting + //if there aren't any waypoints to delete, then return. This also avoids setting //the fWaypointsCancelled flag. if( !pGroup->pWaypoints ) return; @@ -2563,9 +2561,9 @@ void RemovePGroupWaypoints( GROUP *pGroup ) pGroup->pWaypoints = NULL; //By setting this flag, it acknowledges the possibility that the group is currently between sectors, - //and will continue moving until it reaches the next sector. If the user decides to change directions, + //and will continue moving until it reaches the next sector. If the user decides to change directions, //during this process, the arrival event must be modified to send the group back. - //pGroup->fWaypointsCancelled = TRUE; + //pGroup->fWaypointsCancelled = TRUE; } @@ -2577,7 +2575,7 @@ void SetWayPointsAsCanceled( UINT8 ubGroupID ) pGroup = GetGroup( ubGroupID ); Assert( pGroup ); - //pGroup -> fWaypointsCancelled = TRUE; + //pGroup->fWaypointsCancelled = TRUE; return; } @@ -2591,8 +2589,8 @@ void SetGroupPrevSectors( UINT8 ubGroupID, UINT8 ubX, UINT8 ubY ) Assert( pGroup ); // since we have a group, set prev sector's x and y - pGroup -> ubPrevX = ubX; - pGroup -> ubPrevY = ubY; + pGroup->ubPrevX = ubX; + pGroup->ubPrevY = ubY; } @@ -2601,12 +2599,6 @@ void RemoveGroup( UINT8 ubGroupID ) { GROUP *pGroup; pGroup = GetGroup( ubGroupID ); - - if ( ubGroupID == 51 ) - { - int i = 0; - } - Assert( pGroup ); RemovePGroup( pGroup ); } @@ -2621,12 +2613,12 @@ void RemovePGroup( GROUP *pGroup ) { CancelEmptyPersistentGroupMovement( pGroup ); return; - DoScreenIndependantMessageBox( L"Strategic Info Warning: Attempting to delete a persistant group.", MSG_BOX_FLAG_OK, NULL ); + DoScreenIndependantMessageBox( L"Strategic Info Warning: Attempting to delete a persistant group.", MSG_BOX_FLAG_OK, NULL ); } //if removing head, then advance head first. if( pGroup == gpGroupList ) gpGroupList = gpGroupList->next; - else + else { //detach this node from the list. GROUP *curr; curr = gpGroupList; @@ -2659,7 +2651,7 @@ void RemovePGroup( GROUP *pGroup ) RemoveGroupFromStrategicAILists( pGroup->ubGroupID ); MemFree( pGroup->pEnemyGroup ); } - + //clear the unique group ID index = pGroup->ubGroupID / 32; bit = pGroup->ubGroupID % 32; @@ -2669,20 +2661,20 @@ void RemovePGroup( GROUP *pGroup ) { mask = mask; } - + uniqueIDMask[ index ] -= mask; if (gpBattleGroup == pGroup) { gpBattleGroup = NULL; } - + MemFree( pGroup ); pGroup = NULL; } void RemoveAllGroups() { - // Since we are removing all groups, clear the gpBattleGroup + // Since we are removing all groups, clear the gpBattleGroup gpBattleGroup = NULL; gfRemovingAllGroups = TRUE; @@ -2697,10 +2689,10 @@ void SetGroupSectorValue( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, UINT8 { GROUP *pGroup; PLAYERGROUP *pPlayer; - + // get the group pGroup = GetGroup( ubGroupID ); - + // make sure it is valid Assert( pGroup ); @@ -2724,13 +2716,12 @@ void SetGroupSectorValue( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, UINT8 pPlayer->pSoldier->sSectorX = sSectorX; pPlayer->pSoldier->sSectorY = sSectorY; pPlayer->pSoldier->bSectorZ = (UINT8)sSectorZ; - pPlayer->pSoldier->fBetweenSectors = FALSE; - pPlayer->pSoldier->uiStatusFlags &= ~SOLDIER_SHOULD_BE_TACTICALLY_VALID; + pPlayer->pSoldier->flags.fBetweenSectors = FALSE; + pPlayer->pSoldier->flags.uiStatusFlags &= ~SOLDIER_SHOULD_BE_TACTICALLY_VALID; pPlayer = pPlayer->next; } CheckAndHandleUnloadingOfCurrentWorld(); - SetSectorFlag( sSectorX, sSectorY, (UINT8) sSectorZ, SF_ALREADY_VISITED); } @@ -2758,10 +2749,10 @@ void SetEnemyGroupSector( GROUP *pGroup, UINT8 ubSectorID ) void SetGroupNextSectorValue( INT16 sSectorX, INT16 sSectorY, UINT8 ubGroupID ) { GROUP *pGroup; - + // get the group - pGroup = GetGroup( ubGroupID ); - + pGroup = GetGroup( ubGroupID ); + // make sure it is valid Assert( pGroup ); @@ -2782,14 +2773,14 @@ void SetGroupNextSectorValue( INT16 sSectorX, INT16 sSectorY, UINT8 ubGroupID ) INT32 CalculateTravelTimeOfGroupId( UINT8 ubId ) { GROUP *pGroup; - + // get the group pGroup = GetGroup( ubId ); - + if( pGroup == NULL ) { return( 0 ); - } + } return( CalculateTravelTimeOfGroup( pGroup ) ); } @@ -2800,9 +2791,6 @@ INT32 CalculateTravelTimeOfGroup( GROUP *pGroup ) UINT32 uiEtaTime = 0; WAYPOINT *pNode = NULL; WAYPOINT pCurrent, pDest; - INT8 ubCurrentSector = 0; - - // check if valid group if( pGroup == NULL ) { @@ -2811,7 +2799,7 @@ INT32 CalculateTravelTimeOfGroup( GROUP *pGroup ) } // set up next node - pNode = pGroup-> pWaypoints; + pNode = pGroup->pWaypoints; // now get the delta in current sector and next sector iDelta = ( INT32 )( SECTOR( pGroup->ubSectorX, pGroup->ubSectorY ) - SECTOR( pGroup->ubNextX, pGroup->ubNextY ) ); @@ -2861,7 +2849,7 @@ INT32 CalculateTravelTimeOfGroup( GROUP *pGroup ) return( uiEtaTime ); } -INT32 FindTravelTimeBetweenWaypoints( WAYPOINT * pSource, WAYPOINT * pDest, GROUP *pGroup ) +INT32 FindTravelTimeBetweenWaypoints( WAYPOINT * pSource, WAYPOINT * pDest, GROUP *pGroup ) { UINT8 ubStart=0, ubEnd = 0; INT32 iDelta = 0; @@ -2880,7 +2868,7 @@ INT32 FindTravelTimeBetweenWaypoints( WAYPOINT * pSource, WAYPOINT * pDest, GRO // get start and end setor values ubStart = SECTOR( pSource->x, pSource->y ); - ubEnd = SECTOR( pDest->x, pDest->y ); + ubEnd = SECTOR( pDest->x, pDest->y ); // are we in fact moving? if( ubStart == ubEnd ) @@ -2926,7 +2914,7 @@ INT32 FindTravelTimeBetweenWaypoints( WAYPOINT * pSource, WAYPOINT * pDest, GRO if( iThisCostInTime == 0xffffffff ) { - AssertMsg( 0, String("Group %d (%s) attempting illegal move from sector %d, dir %d (%s).", + AssertMsg( 0, String("Group %d (%s) attempting illegal move from sector %d, dir %d (%s).", pGroup->ubGroupID, ( pGroup->fPlayer ) ? "Player" : "AI", ubCurrentSector, ubDirection, gszTerrain[SectorInfo[ubCurrentSector].ubTraversability[ubDirection]] ) ); @@ -2947,7 +2935,7 @@ INT32 FindTravelTimeBetweenWaypoints( WAYPOINT * pSource, WAYPOINT * pDest, GRO #define TRACKED_TRAVEL_TIME 46 #define AIR_TRAVEL_TIME 10 -//CHANGES: ubDirection contains the strategic move value, not the delta value. +//CHANGES: ubDirection contains the strategic move value, not the delta value. INT32 GetSectorMvtTimeForGroup( UINT8 ubSector, UINT8 ubDirection, GROUP *pGroup ) { INT32 iTraverseTime; @@ -2959,10 +2947,10 @@ INT32 GetSectorMvtTimeForGroup( UINT8 ubSector, UINT8 ubDirection, GROUP *pGroup UINT8 ubTraverseType; UINT8 ubTraverseMod; - + // THIS FUNCTION WAS WRITTEN TO HANDLE MOVEMENT TYPES WHERE MORE THAN ONE TRANSPORTAION TYPE IS AVAILABLE. - //Determine the group's method(s) of tranportation. If more than one, + //Determine the group's method(s) of tranportation. If more than one, //we will always use the highest time. fFoot = (UINT8)(pGroup->ubTransportationMask & FOOT); fCar = (UINT8)(pGroup->ubTransportationMask & CAR); @@ -2975,9 +2963,9 @@ INT32 GetSectorMvtTimeForGroup( UINT8 ubSector, UINT8 ubDirection, GROUP *pGroup if( ubTraverseType == EDGEOFWORLD ) return 0xffffffff; //can't travel here! - // ARM: Made air-only travel take its normal time per sector even through towns. Because Skyrider charges by the sector, + // ARM: Made air-only travel take its normal time per sector even through towns. Because Skyrider charges by the sector, // not by flying time, it's annoying when his default route detours through a town to save time, but costs extra money. - // This isn't exactly unrealistic, since the chopper shouldn't be faster flying over a town anyway... Not that other + // This isn't exactly unrealistic, since the chopper shouldn't be faster flying over a town anyway... Not that other // kinds of travel should be either - but the towns represents a kind of warping of our space-time scale as it is... if( ( ubTraverseType == TOWN ) && ( pGroup->ubTransportationMask != AIR ) ) return 5; //very fast, and vehicle types don't matter. @@ -3003,7 +2991,7 @@ INT32 GetSectorMvtTimeForGroup( UINT8 ubSector, UINT8 ubDirection, GROUP *pGroup } if( ubTraverseMod == 0 ) return 0xffffffff; //Group can't traverse here. - iTraverseTime = FOOT_TRAVEL_TIME * 100 / ubTraverseMod; + iTraverseTime = FOOT_TRAVEL_TIME * 100 / ubTraverseMod; if( iTraverseTime < iBestTraverseTime ) iBestTraverseTime = iTraverseTime; @@ -3014,7 +3002,7 @@ INT32 GetSectorMvtTimeForGroup( UINT8 ubSector, UINT8 ubDirection, GROUP *pGroup { pSoldier = curr->pSoldier; if( pSoldier->bAssignment != VEHICLE ) - { //Soldier is on foot and travelling. Factor encumbrance into movement rate. + { //Soldier is on foot and travelling. Factor encumbrance into movement rate. iEncumbrance = CalculateCarriedWeight( pSoldier ); if( iEncumbrance > iHighestEncumbrance ) { @@ -3038,7 +3026,7 @@ INT32 GetSectorMvtTimeForGroup( UINT8 ubSector, UINT8 ubDirection, GROUP *pGroup } if( ubTraverseMod == 0 ) return 0xffffffff; //Group can't traverse here. - iTraverseTime = CAR_TRAVEL_TIME * 100 / ubTraverseMod; + iTraverseTime = CAR_TRAVEL_TIME * 100 / ubTraverseMod; if( iTraverseTime < iBestTraverseTime ) iBestTraverseTime = iTraverseTime; } @@ -3054,7 +3042,7 @@ INT32 GetSectorMvtTimeForGroup( UINT8 ubSector, UINT8 ubDirection, GROUP *pGroup } if( ubTraverseMod == 0 ) return 0xffffffff; //Group can't traverse here. - iTraverseTime = TRUCK_TRAVEL_TIME * 100 / ubTraverseMod; + iTraverseTime = TRUCK_TRAVEL_TIME * 100 / ubTraverseMod; if( iTraverseTime < iBestTraverseTime ) iBestTraverseTime = iTraverseTime; } @@ -3074,13 +3062,13 @@ INT32 GetSectorMvtTimeForGroup( UINT8 ubSector, UINT8 ubDirection, GROUP *pGroup } if( ubTraverseMod == 0 ) return 0xffffffff; //Group can't traverse here. - iTraverseTime = TRACKED_TRAVEL_TIME * 100 / ubTraverseMod; + iTraverseTime = TRACKED_TRAVEL_TIME * 100 / ubTraverseMod; if( iTraverseTime < iBestTraverseTime ) iBestTraverseTime = iTraverseTime; } if( fAir ) { - iTraverseTime = AIR_TRAVEL_TIME; + iTraverseTime = AIR_TRAVEL_TIME; if( iTraverseTime < iBestTraverseTime ) iBestTraverseTime = iTraverseTime; } @@ -3099,7 +3087,7 @@ UINT8 PlayerMercsInSector( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubSectorZ ) while( pGroup ) { if( pGroup->fPlayer && !pGroup->fBetweenSectors) - { + { if ( pGroup->ubSectorX == ubSectorX && pGroup->ubSectorY == ubSectorY && pGroup->ubSectorZ == ubSectorZ ) { //we have a group, make sure that it isn't a group containing only dead members. @@ -3107,7 +3095,7 @@ UINT8 PlayerMercsInSector( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubSectorZ ) while( pPlayer ) { // robots count as mercs here, because they can fight, but vehicles don't - if( ( pPlayer->pSoldier->bLife ) && !( pPlayer->pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if( ( pPlayer->pSoldier->stats.bLife ) && !( pPlayer->pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { ubNumMercs++; } @@ -3129,14 +3117,14 @@ UINT8 PlayerGroupsInSector( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubSectorZ ) while( pGroup ) { if( pGroup->fPlayer && !pGroup->fBetweenSectors) - { + { if ( pGroup->ubSectorX == ubSectorX && pGroup->ubSectorY == ubSectorY && pGroup->ubSectorZ == ubSectorZ ) { //we have a group, make sure that it isn't a group containing only dead members. pPlayer = pGroup->pPlayerList; while( pPlayer ) { - if( pPlayer->pSoldier->bLife ) + if( pPlayer->pSoldier->stats.bLife ) { ubNumGroups++; break; @@ -3155,12 +3143,12 @@ UINT8 PlayerGroupsInSector( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubSectorZ ) BOOLEAN PlayerIDGroupInMotion( UINT8 ubID ) { GROUP *pGroup; - + // get the group pGroup = GetGroup( ubID ); - + // make sure it is valid - + // no group if( pGroup == NULL ) { @@ -3174,18 +3162,18 @@ BOOLEAN PlayerIDGroupInMotion( UINT8 ubID ) // is the player group in motion? BOOLEAN PlayerGroupInMotion( GROUP *pGroup ) { - return( pGroup -> fBetweenSectors ); -} + return( pGroup->fBetweenSectors ); +} // get travel time for this group INT32 GetTravelTimeForGroup( UINT8 ubSector, UINT8 ubDirection, UINT8 ubGroup ) -{ +{ GROUP *pGroup; - + // get the group pGroup = GetGroup( ubGroup ); - + // make sure it is valid Assert( pGroup ); @@ -3204,7 +3192,7 @@ INT32 GetTravelTimeForFootTeam( UINT8 ubSector, UINT8 ubDirection ) } //Add this group to the current battle fray! -//NOTE: For enemies, only MAX_STRATEGIC_TEAM_SIZE at a time can be in a battle, so +//NOTE: For enemies, only MAX_STRATEGIC_TEAM_SIZE at a time can be in a battle, so //if it ever gets past that, god help the player, but we'll have to insert them //as those slots free up. void HandleArrivalOfReinforcements( GROUP *pGroup ) @@ -3284,7 +3272,6 @@ BOOLEAN PlayersBetweenTheseSectors( INT16 sSource, INT16 sDest, INT32 *iCountEnt INT16 sBattleSector = -1; BOOLEAN fMayRetreatFromBattle = FALSE; BOOLEAN fRetreatingFromBattle = FALSE; - BOOLEAN fHandleRetreats = FALSE; BOOLEAN fHelicopterGroup = FALSE; UINT8 ubMercsInGroup = 0; @@ -3307,7 +3294,7 @@ BOOLEAN PlayersBetweenTheseSectors( INT16 sSource, INT16 sDest, INT32 *iCountEnt } - // get number of characters entering/existing between these two sectors. Special conditions during + // get number of characters entering/existing between these two sectors. Special conditions during // pre-battle interface to return where this function is used to show potential retreating directions instead! // check all groups @@ -3325,24 +3312,24 @@ BOOLEAN PlayersBetweenTheseSectors( INT16 sSource, INT16 sDest, INT32 *iCountEnt // if only showing retreat paths, ignore groups not in the battle sector // if NOT showing retreat paths, ignore groups not between sectors if ( ( gfDisplayPotentialRetreatPaths == TRUE ) && ( sBattleSector == sSource ) || - ( gfDisplayPotentialRetreatPaths == FALSE ) && ( curr->fBetweenSectors == TRUE ) ) + ( gfDisplayPotentialRetreatPaths == FALSE ) && ( curr->fBetweenSectors == TRUE ) ) { fMayRetreatFromBattle = FALSE; fRetreatingFromBattle = FALSE; - if( ( sBattleSector == sSource ) && ( SECTOR( curr -> ubSectorX, curr -> ubSectorY ) == sSource ) && ( SECTOR( curr -> ubPrevX, curr->ubPrevY ) == sDest ) ) + if( ( sBattleSector == sSource ) && ( SECTOR( curr->ubSectorX, curr->ubSectorY ) == sSource ) && ( SECTOR( curr->ubPrevX, curr->ubPrevY ) == sDest ) ) { fMayRetreatFromBattle = TRUE; } - if( ( sBattleSector == sDest ) && ( SECTOR( curr -> ubSectorX, curr -> ubSectorY ) == sDest ) && ( SECTOR( curr -> ubPrevX, curr->ubPrevY ) == sSource ) ) + if( ( sBattleSector == sDest ) && ( SECTOR( curr->ubSectorX, curr->ubSectorY ) == sDest ) && ( SECTOR( curr->ubPrevX, curr->ubPrevY ) == sSource ) ) { fRetreatingFromBattle = TRUE; } ubMercsInGroup = curr->ubGroupSize; - if( ( ( SECTOR( curr -> ubSectorX, curr -> ubSectorY ) == sSource ) && ( SECTOR( curr -> ubNextX, curr->ubNextY ) == sDest) ) || ( fMayRetreatFromBattle == TRUE ) ) + if( ( ( SECTOR( curr->ubSectorX, curr->ubSectorY ) == sSource ) && ( SECTOR( curr->ubNextX, curr->ubNextY ) == sDest) ) || ( fMayRetreatFromBattle == TRUE ) ) { // if it's a valid vehicle, but not the helicopter (which can fly empty) if ( curr->fVehicle && !fHelicopterGroup && ( GivenMvtGroupIdFindVehicleId( curr->ubGroupID ) != -1 ) ) @@ -3360,7 +3347,7 @@ BOOLEAN PlayersBetweenTheseSectors( INT16 sSource, INT16 sDest, INT32 *iCountEnt *fAboutToArriveEnter = TRUE; } } - else if( ( SECTOR( curr -> ubSectorX, curr -> ubSectorY ) == sDest )&&( SECTOR( curr -> ubNextX, curr->ubNextY ) == sSource) || ( fRetreatingFromBattle == TRUE ) ) + else if( ( SECTOR( curr->ubSectorX, curr->ubSectorY ) == sDest )&&( SECTOR( curr->ubNextX, curr->ubNextY ) == sSource) || ( fRetreatingFromBattle == TRUE ) ) { // if it's a valid vehicle, but not the helicopter (which can fly empty) if ( curr->fVehicle && !fHelicopterGroup && ( GivenMvtGroupIdFindVehicleId( curr->ubGroupID ) != -1 ) ) @@ -3400,7 +3387,7 @@ void MoveAllGroupsInCurrentSectorToSector( UINT8 ubSectorX, UINT8 ubSectorY, UIN while( pGroup ) { if( pGroup->fPlayer && pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && - pGroup->ubSectorZ == gbWorldSectorZ && !pGroup->fBetweenSectors ) + pGroup->ubSectorZ == gbWorldSectorZ && !pGroup->fBetweenSectors ) { //This player group is in the currently loaded sector... pGroup->ubSectorX = ubSectorX; pGroup->ubSectorY = ubSectorY; @@ -3411,7 +3398,7 @@ void MoveAllGroupsInCurrentSectorToSector( UINT8 ubSectorX, UINT8 ubSectorY, UIN pPlayer->pSoldier->sSectorX = ubSectorX; pPlayer->pSoldier->sSectorY = ubSectorY; pPlayer->pSoldier->bSectorZ = ubSectorZ; - pPlayer->pSoldier->fBetweenSectors = FALSE; + pPlayer->pSoldier->flags.fBetweenSectors = FALSE; pPlayer = pPlayer->next; } } @@ -3427,15 +3414,15 @@ void GetGroupPosition( UINT8 *ubNextX, UINT8 *ubNextY, UINT8 *ubPrevX, UINT8 *ub // get the group pGroup = GetGroup( ubGroupId ); - + // make sure it is valid - + // no group if( pGroup == NULL ) { *ubNextX = 0; - *ubNextY = 0; - *ubPrevX = 0; + *ubNextY = 0; + *ubPrevX = 0; *ubPrevY = 0; *uiTraverseTime = 0; *uiArriveTime = 0; @@ -3444,8 +3431,8 @@ void GetGroupPosition( UINT8 *ubNextX, UINT8 *ubNextY, UINT8 *ubPrevX, UINT8 *ub // valid group, grab values *ubNextX = pGroup->ubNextX; - *ubNextY = pGroup->ubNextY; - *ubPrevX = pGroup->ubPrevX; + *ubNextY = pGroup->ubNextY; + *ubPrevX = pGroup->ubPrevX; *ubPrevY = pGroup->ubPrevY; *uiTraverseTime = pGroup->uiTraverseTime; *uiArriveTime = pGroup->uiArrivalTime; @@ -3464,18 +3451,18 @@ void SetGroupPosition( UINT8 ubNextX, UINT8 ubNextY, UINT8 ubPrevX, UINT8 ubPrev // get the group pGroup = GetGroup( ubGroupId ); - + // no group if( pGroup == NULL ) { - + return; } // valid group, grab values pGroup->ubNextX = ubNextX; - pGroup->ubNextY = ubNextY ; - pGroup->ubPrevX = ubPrevX; + pGroup->ubNextY = ubNextY ; + pGroup->ubPrevX = ubPrevX; pGroup->ubPrevY = ubPrevY; pGroup->uiTraverseTime = uiTraverseTime; SetGroupArrivalTime( pGroup, uiArriveTime ); @@ -3489,7 +3476,7 @@ void SetGroupPosition( UINT8 ubNextX, UINT8 ubNextY, UINT8 ubPrevX, UINT8 ubPrev pPlayer = pGroup->pPlayerList; while( pPlayer ) { - pPlayer->pSoldier->fBetweenSectors = TRUE; + pPlayer->pSoldier->flags.fBetweenSectors = TRUE; pPlayer = pPlayer->next; } } @@ -3522,7 +3509,7 @@ BOOLEAN SaveStrategicMovementGroupsToSaveGameFile( HWFILE hFile ) return( FALSE ); } - + pGroup = gpGroupList; //Loop through the linked lists and add each node @@ -3555,7 +3542,7 @@ BOOLEAN SaveStrategicMovementGroupsToSaveGameFile( HWFILE hFile ) //Make sure the pointer is valid Assert( pGroup->pEnemyGroup ); - // + // SaveEnemyGroupStruct( hFile, pGroup ); } @@ -3590,10 +3577,10 @@ BOOLEAN LoadStrategicMovementGroupsFromSavedGameFile( HWFILE hFile ) UINT32 uiNumBytesRead=0; UINT32 cnt; UINT32 bit, index, mask; - UINT8 ubNumPlayerGroupsEmpty = 0; - UINT8 ubNumEnemyGroupsEmpty = 0; - UINT8 ubNumPlayerGroupsFull = 0; - UINT8 ubNumEnemyGroupsFull = 0; + UINT8 ubNumPlayerGroupsEmpty = 0; + UINT8 ubNumEnemyGroupsEmpty = 0; + UINT8 ubNumPlayerGroupsFull = 0; + UINT8 ubNumEnemyGroupsFull = 0; @@ -3633,7 +3620,7 @@ BOOLEAN LoadStrategicMovementGroupsFromSavedGameFile( HWFILE hFile ) // // Add either the pointer or the linked list. // - + if( pTemp->fPlayer ) { //if there is a player list, add it @@ -3656,7 +3643,7 @@ BOOLEAN LoadStrategicMovementGroupsFromSavedGameFile( HWFILE hFile ) pTemp->next = NULL; //add the node to the list - + //if its the firs node if( cnt == 0 ) { @@ -3769,7 +3756,6 @@ BOOLEAN SavePlayerGroupList( HWFILE hFile, GROUP *pGroup ) BOOLEAN LoadPlayerGroupList( HWFILE hFile, GROUP **pGroup ) { - UINT32 uiNumberOfNodesInList=0; PLAYERGROUP *pTemp=NULL; PLAYERGROUP *pHead=NULL; UINT32 uiNumberOfNodes=0; @@ -3800,7 +3786,7 @@ BOOLEAN LoadPlayerGroupList( HWFILE hFile, GROUP **pGroup ) if( pTemp == NULL ) return( FALSE ); - + // Load the ubProfile ID for this node FileRead( hFile, &uiProfileID, sizeof( UINT32 ), &uiNumBytesRead ); if( uiNumBytesRead != sizeof( UINT32 ) ) @@ -3844,7 +3830,7 @@ BOOLEAN LoadPlayerGroupList( HWFILE hFile, GROUP **pGroup ) BOOLEAN SaveEnemyGroupStruct( HWFILE hFile, GROUP *pGroup ) { UINT32 uiNumBytesWritten=0; - + //Save the enemy struct info to the saved game file FileWrite( hFile, pGroup->pEnemyGroup, sizeof( ENEMYGROUP ), &uiNumBytesWritten ); if( uiNumBytesWritten != sizeof( ENEMYGROUP ) ) @@ -3887,7 +3873,7 @@ BOOLEAN LoadEnemyGroupStructFromSavedGame( HWFILE hFile, GROUP *pGroup ) void CheckMembersOfMvtGroupAndComplainAboutBleeding( SOLDIERTYPE *pSoldier ) { // run through members of group - UINT8 ubGroupId = pSoldier -> ubGroupID; + UINT8 ubGroupId = pSoldier->ubGroupID; GROUP *pGroup; PLAYERGROUP *pPlayer=NULL; SOLDIERTYPE *pCurrentSoldier=NULL; @@ -3908,7 +3894,7 @@ void CheckMembersOfMvtGroupAndComplainAboutBleeding( SOLDIERTYPE *pSoldier ) // make sure there are members in the group..if so, then run through and make each bleeder compain pPlayer = pGroup->pPlayerList; - + // is there a player list? if( pPlayer == NULL ) { @@ -3916,10 +3902,10 @@ void CheckMembersOfMvtGroupAndComplainAboutBleeding( SOLDIERTYPE *pSoldier ) } BeginLoggingForBleedMeToos( TRUE ); - + while( pPlayer ) { - pCurrentSoldier = pPlayer->pSoldier; + pCurrentSoldier = pPlayer->pSoldier; if( pCurrentSoldier->bBleeding > 0 ) { @@ -4075,7 +4061,7 @@ void CalculateGroupRetreatSector( GROUP *pGroup ) pGroup->ubPrevX = pGroup->ubSectorX; pGroup->ubPrevY = pGroup->ubSectorY + 1; } - else + else { AssertMsg( 0, String("Player group cannot retreat from sector %c%d ", pGroup->ubSectorY+'A'-1, pGroup->ubSectorX ) ); return; @@ -4092,7 +4078,7 @@ void CalculateGroupRetreatSector( GROUP *pGroup ) } } -//Called when all checks have been made for the group (if possible to retreat, etc.) This function +//Called when all checks have been made for the group (if possible to retreat, etc.) This function //blindly determines where to move the group. void RetreatGroupToPreviousSector( GROUP *pGroup ) { @@ -4117,15 +4103,15 @@ void RetreatGroupToPreviousSector( GROUP *pGroup ) ubDirection = SOUTH_STRATEGIC_MOVE; else if( dx == -1 && !dy ) ubDirection = WEST_STRATEGIC_MOVE; - else + else { - AssertMsg( 0, String("Player group attempting illegal retreat from %c%d to %c%d.", + AssertMsg( 0, String("Player group attempting illegal retreat from %c%d to %c%d.", pGroup->ubSectorY+'A'-1, pGroup->ubSectorX, pGroup->ubNextY+'A'-1, pGroup->ubNextX ) ); } } else - { //Group doesn't have a previous sector. Create one, then recurse + { //Group doesn't have a previous sector. Create one, then recurse CalculateGroupRetreatSector( pGroup ); RetreatGroupToPreviousSector( pGroup ); } @@ -4135,7 +4121,7 @@ void RetreatGroupToPreviousSector( GROUP *pGroup ) pGroup->uiTraverseTime = GetSectorMvtTimeForGroup( ubSector, ubDirection, pGroup ); if( pGroup->uiTraverseTime == 0xffffffff ) { - AssertMsg( 0, String("Group %d (%s) attempting illegal move from %c%d to %c%d (%s).", + AssertMsg( 0, String("Group %d (%s) attempting illegal move from %c%d to %c%d (%s).", pGroup->ubGroupID, ( pGroup->fPlayer ) ? "Player" : "AI", pGroup->ubSectorY+'A', pGroup->ubSectorX, pGroup->ubNextY+'A', pGroup->ubNextX, gszTerrain[SectorInfo[ubSector].ubTraversability[ubDirection]] ) ); @@ -4168,16 +4154,16 @@ void RetreatGroupToPreviousSector( GROUP *pGroup ) { PLAYERGROUP *curr; curr = pGroup->pPlayerList; - + if( pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY > GetWorldTotalMin( ) ) { - AddStrategicEvent( EVENT_GROUP_ABOUT_TO_ARRIVE, pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY, pGroup->ubGroupID ); + AddStrategicEvent( EVENT_GROUP_ABOUT_TO_ARRIVE, pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY, pGroup->ubGroupID ); } while( curr ) { - curr->pSoldier->fBetweenSectors = TRUE; + curr->pSoldier->flags.fBetweenSectors = TRUE; // OK, Remove the guy from tactical engine! RemoveSoldierFromTacticalSector( curr->pSoldier, TRUE ); @@ -4196,7 +4182,7 @@ GROUP* FindMovementGroupInSector( UINT8 ubSectorX, UINT8 ubSectorY, BOOLEAN fPla if( pGroup->fPlayer ) { // NOTE: These checks must always match the INVOLVED group checks in PBI!!! - if( fPlayer && pGroup->ubGroupSize && !pGroup->fBetweenSectors && + if( fPlayer && pGroup->ubGroupSize && !pGroup->fBetweenSectors && pGroup->ubSectorX == ubSectorX && pGroup->ubSectorY == ubSectorY && !pGroup->ubSectorZ && !GroupHasInTransitDeadOrPOWMercs( pGroup ) && ( !IsGroupTheHelicopterGroup( pGroup ) || !fHelicopterIsAirBorne ) ) @@ -4215,7 +4201,7 @@ GROUP* FindMovementGroupInSector( UINT8 ubSectorX, UINT8 ubSectorY, BOOLEAN fPla BOOLEAN GroupAtFinalDestination( GROUP *pGroup ) { WAYPOINT *wp; - + if( pGroup->ubMoveType != ONE_WAY ) return FALSE; //Group will continue to patrol, hence never stops. @@ -4223,7 +4209,7 @@ BOOLEAN GroupAtFinalDestination( GROUP *pGroup ) wp = GetFinalWaypoint( pGroup ); if( !wp ) - { //no waypoints, so the group is at it's destination. This happens when + { //no waypoints, so the group is at it's destination. This happens when //an enemy group is created in the destination sector (which is legal for //staging groups which always stop adjacent to their real sector destination) return TRUE; @@ -4260,7 +4246,7 @@ WAYPOINT *GetFinalWaypoint( GROUP *pGroup ) } -//The sector supplied resets ALL enemy groups in the sector specified. See comments in +//The sector supplied resets ALL enemy groups in the sector specified. See comments in //ResetMovementForEnemyGroup() for more details on what the resetting does. void ResetMovementForEnemyGroupsInLocation( UINT8 ubSectorX, UINT8 ubSectorY ) { @@ -4285,9 +4271,9 @@ void ResetMovementForEnemyGroupsInLocation( UINT8 ubSectorX, UINT8 ubSectorY ) //This function is used to reset the location of the enemy group if they are -//currently between sectors. If they were 50% of the way from sector A10 to A11, +//currently between sectors. If they were 50% of the way from sector A10 to A11, //then after this function is called, then that group would be 0% of the way from -//sector A10 to A11. In no way does this function effect the strategic path for +//sector A10 to A11. In no way does this function effect the strategic path for //the group. void ResetMovementForEnemyGroup( GROUP *pGroup ) { @@ -4307,13 +4293,13 @@ void ResetMovementForEnemyGroup( GROUP *pGroup ) //Calculate the new arrival time (all data pertaining to movement should be valid) if( pGroup->uiTraverseTime > 400 ) - { //The group was likely sleeping which makes for extremely long arrival times. Shorten it - //arbitrarily. Doesn't really matter if this isn't accurate. + { //The group was likely sleeping which makes for extremely long arrival times. Shorten it + //arbitrarily. Doesn't really matter if this isn't accurate. pGroup->uiTraverseTime = 90; } SetGroupArrivalTime( pGroup, GetWorldTotalMin() + pGroup->uiTraverseTime ); - //Add a new event + //Add a new event AddStrategicEvent( EVENT_GROUP_ARRIVAL, pGroup->uiArrivalTime, pGroup->ubGroupID ); } @@ -4327,7 +4313,7 @@ void UpdatePersistantGroupsFromOldSave( UINT32 uiSavedGameVersion ) // ATE: If saved game is < 61, we need to do something better! if( uiSavedGameVersion < 61 ) - { + { for( cnt = 0; cnt < 55; cnt++ ) { // create mvt groups @@ -4342,8 +4328,8 @@ void UpdatePersistantGroupsFromOldSave( UINT32 uiSavedGameVersion ) fDoChange = TRUE; } else if( uiSavedGameVersion < 63 ) - { - for( cnt = 0; cnt < NUMBER_OF_SQUADS; cnt++ ) + { + for( cnt = 0; cnt < NUMBER_OF_SQUADS; cnt++ ) { // create mvt groups pGroup = GetGroup( SquadMovementGroups[ cnt ] ); @@ -4354,7 +4340,7 @@ void UpdatePersistantGroupsFromOldSave( UINT32 uiSavedGameVersion ) } } - for( cnt = 0; cnt < MAX_VEHICLES; cnt++ ) + for( cnt = 0; cnt < MAX_VEHICLES; cnt++ ) { pGroup = GetGroup( gubVehicleMovementGroups[ cnt ] ); @@ -4379,7 +4365,7 @@ void UpdatePersistantGroupsFromOldSave( UINT32 uiSavedGameVersion ) if( !pGroup->ubGroupSize && !pGroup->fPersistant ) { RemovePGroup( pGroup ); - break; + break; } pGroup = pGroup->next; if( !pGroup ) @@ -4392,7 +4378,7 @@ void UpdatePersistantGroupsFromOldSave( UINT32 uiSavedGameVersion ) } //Determines if any particular group WILL be moving through a given sector given it's current -//position in the route and the pGroup->ubMoveType must be ONE_WAY. If the group is currently +//position in the route and the pGroup->ubMoveType must be ONE_WAY. If the group is currently //IN the sector, or just left the sector, it will return FALSE. BOOLEAN GroupWillMoveThroughSector( GROUP *pGroup, UINT8 ubSectorX, UINT8 ubSectorY ) { @@ -4401,8 +4387,8 @@ BOOLEAN GroupWillMoveThroughSector( GROUP *pGroup, UINT8 ubSectorX, UINT8 ubSect UINT8 ubOrigX, ubOrigY; Assert( pGroup ); - AssertMsg( pGroup->ubMoveType == ONE_WAY, String( "GroupWillMoveThroughSector() -- Attempting to test group with an invalid move type. ubGroupID: %d, ubMoveType: %d, sector: %c%d -- KM:0", - pGroup->ubGroupID, pGroup->ubMoveType, pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX ) ); + AssertMsg( pGroup->ubMoveType == ONE_WAY, String( "GroupWillMoveThroughSector() -- Attempting to test group with an invalid move type. ubGroupID: %d, ubMoveType: %d, sector: %c%d -- KM:0", + pGroup->ubGroupID, pGroup->ubMoveType, pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX ) ); //Preserve the original sector values, as we will be temporarily modifying the group's ubSectorX/Y values //as we traverse the waypoints. @@ -4423,7 +4409,7 @@ BOOLEAN GroupWillMoveThroughSector( GROUP *pGroup, UINT8 ubSectorX, UINT8 ubSect } Assert( wp ); - + while( wp ) { while( pGroup->ubSectorX != wp->x || pGroup->ubSectorY != wp->y ) @@ -4434,7 +4420,7 @@ BOOLEAN GroupWillMoveThroughSector( GROUP *pGroup, UINT8 ubSectorX, UINT8 ubSect dy = wp->y - pGroup->ubSectorY; if( dx && dy ) { //Can't move diagonally! - AssertMsg( 0, String( "GroupWillMoveThroughSector() -- Attempting to process waypoint in a diagonal direction from sector %c%d to sector %c%d for group at sector %c%d -- KM:0", + AssertMsg( 0, String( "GroupWillMoveThroughSector() -- Attempting to process waypoint in a diagonal direction from sector %c%d to sector %c%d for group at sector %c%d -- KM:0", pGroup->ubSectorY + 'A', pGroup->ubSectorX, wp->y + 'A' - 1, wp->x, ubOrigY + 'A' - 1, ubOrigX ) ); pGroup->ubSectorX = ubOrigX; pGroup->ubSectorY = ubOrigY; @@ -4442,8 +4428,8 @@ BOOLEAN GroupWillMoveThroughSector( GROUP *pGroup, UINT8 ubSectorX, UINT8 ubSect } if( !dx && !dy ) //Can't move to position currently at! { - AssertMsg( 0, String( "GroupWillMoveThroughSector() -- Attempting to process same waypoint at %c%d for group at %c%d -- KM:0", - wp->y + 'A' - 1, wp->x, ubOrigY + 'A' - 1, ubOrigX ) ); + AssertMsg( 0, String( "GroupWillMoveThroughSector() -- Attempting to process same waypoint at %c%d for group at %c%d -- KM:0", + wp->y + 'A' - 1, wp->x, ubOrigY + 'A' - 1, ubOrigX ) ); pGroup->ubSectorX = ubOrigX; pGroup->ubSectorY = ubOrigY; return TRUE; @@ -4500,7 +4486,7 @@ INT16 CalculateFuelCostBetweenSectors( UINT8 ubSectorID1, UINT8 ubSectorID2 ) BOOLEAN VehicleHasFuel( SOLDIERTYPE *pSoldier ) { - Assert( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ); + Assert( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ); if( pSoldier->sBreathRed ) { return TRUE; @@ -4510,13 +4496,13 @@ BOOLEAN VehicleHasFuel( SOLDIERTYPE *pSoldier ) INT16 VehicleFuelRemaining( SOLDIERTYPE *pSoldier ) { - Assert( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ); + Assert( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ); return pSoldier->sBreathRed; } BOOLEAN SpendVehicleFuel( SOLDIERTYPE* pSoldier, INT16 sFuelSpent ) { - Assert( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ); + Assert( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ); pSoldier->sBreathRed -= sFuelSpent; pSoldier->sBreathRed = (INT16)max( 0, pSoldier->sBreathRed ); pSoldier->bBreath = (INT8)((pSoldier->sBreathRed+99) / 100); @@ -4532,7 +4518,7 @@ void AddFuelToVehicle( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVehicle ) { #ifdef JA2BETAVERSION CHAR16 str[ 100 ]; - swprintf( str, L"%s is supposed to have gas can in hand. ATE:0", pSoldier->name ); + swprintf( str, L"%s is supposed to have gas can in hand. ATE:0", pSoldier->name ); DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, NULL ); #endif return; @@ -4543,19 +4529,19 @@ void AddFuelToVehicle( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVehicle ) { //Message for vehicle full? return; } - if( pItem->ItemData.Generic.bStatus ) + if( (*pItem)[0]->data.objectStatus ) { //Fill 'er up. sFuelNeeded = 10000 - pVehicle->sBreathRed; - sFuelAvailable = pItem->ItemData.Generic.bStatus[0] * 50; + sFuelAvailable = (*pItem)[0]->data.objectStatus * 50; sFuelAdded = min( sFuelNeeded, sFuelAvailable ); //Add to vehicle pVehicle->sBreathRed += sFuelAdded; pVehicle->bBreath = (INT8)(pVehicle->sBreathRed / 100); //Subtract from item - pItem->ItemData.Generic.bStatus[0] = (INT8)(pItem->ItemData.Generic.bStatus[0] - sFuelAdded / 50); - if( !pItem->ItemData.Generic.bStatus[0] ) + (*pItem)[0]->data.objectStatus = (INT8)((*pItem)[0]->data.objectStatus - sFuelAdded / 50); + if( !(*pItem)[0]->data.objectStatus ) { //Gas can is empty, so toast the item. - DeleteObj( pItem ); + pItem->RemoveObjectsFromStack(1); } } } @@ -4564,7 +4550,7 @@ void ReportVehicleOutOfGas( INT32 iVehicleID, UINT8 ubSectorX, UINT8 ubSectorY ) { CHAR16 str[255]; //Report that the vehicle that just arrived is out of gas. - swprintf( str, gzLateLocalizedString[ 5 ], + swprintf( str, gzLateLocalizedString[ 5 ], pVehicleStrings[ pVehicleList[ iVehicleID ].ubVehicleType ], ubSectorY + 'A' - 1, ubSectorX ); DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, NULL ); @@ -4612,7 +4598,7 @@ void SetLocationOfAllPlayerSoldiersInGroup( GROUP *pGroup, INT16 sSectorX, INT16 pSoldier = GetSoldierStructureForVehicle( iVehicleId ); Assert ( pSoldier ); - // these are apparently unnecessary, since vehicles are part of the pPlayerList in a vehicle group. Oh well. + // these are apparently unnecessary, since vehicles are part of the pPlayerList in a vehicle group. Oh well. pSoldier->sSectorX = sSectorX; pSoldier->sSectorY = sSectorY; pSoldier->bSectorZ = bSectorZ; @@ -4622,7 +4608,8 @@ void SetLocationOfAllPlayerSoldiersInGroup( GROUP *pGroup, INT16 sSectorX, INT16 void RandomizePatrolGroupLocation( GROUP *pGroup ) -{ //Make sure this is an enemy patrol group +{ + //Make sure this is an enemy patrol group WAYPOINT *wp; UINT8 ubMaxWaypointID = 0; UINT8 ubTotalWaypoints; @@ -4657,7 +4644,7 @@ void RandomizePatrolGroupLocation( GROUP *pGroup ) if( ubChosen >= ubMaxWaypointID ) { //They chose a waypoint going in the reverse direction, so translate it - //to an actual waypointID and switch directions. + //to an actual waypointID and switch directions. pGroup->ubMoveType = ENDTOEND_BACKWARDS; pGroup->ubNextWaypointID = ubChosen - ubMaxWaypointID; ubChosen = pGroup->ubNextWaypointID + 1; @@ -4675,8 +4662,8 @@ void RandomizePatrolGroupLocation( GROUP *pGroup ) ubChosen--; wp = wp->next; } - - //logic error if this fails. We should have a null value for ubChosen + + //logic error if this fails. We should have a null value for ubChosen Assert( !ubChosen ); Assert( wp ); @@ -4686,7 +4673,7 @@ void RandomizePatrolGroupLocation( GROUP *pGroup ) //Set up this global var to randomize the arrival time of the group from //1 minute to actual traverse time between the sectors. gfRandomizingPatrolGroup = TRUE; - + SetEnemyGroupSector( pGroup, ubSectorID ); InitiateGroupMovementToNextSector( pGroup ); @@ -4726,7 +4713,7 @@ BOOLEAN TestForBloodcatAmbush( GROUP *pGroup ) pSector->bBloodCats = pSector->bBloodCatPlacements; } else if( pSector->bBloodCats > 0 && pSector->bBloodCats < pSector->bBloodCatPlacements ) - { //Slowly have them recuperate if we haven't been here for a long time. The population will + { //Slowly have them recuperate if we haven't been here for a long time. The population will //come back up to the maximum if left long enough. INT32 iBloodCatDiff; iBloodCatDiff = pSector->bBloodCatPlacements - pSector->bBloodCats; @@ -4737,13 +4724,13 @@ BOOLEAN TestForBloodcatAmbush( GROUP *pGroup ) else if( pSector->bBloodCats == -1 ) { //If we haven't been ambushed by bloodcats yet... if( gfAutoAmbush || PreChance( ubChance ) ) - { + { //randomly choose from 5-8, 7-10, 9-12 bloodcats based on easy, normal, and hard, respectively bDifficultyMaxCats = (INT8)( Random( 4 ) + gGameOptions.ubDifficultyLevel*2 + 3 ); //maximum of 3 bloodcats or 1 for every 6%, 5%, 4% progress based on easy, normal, and hard, respectively bProgressMaxCats = (INT8)max( CurrentPlayerProgressPercentage() / (7 - gGameOptions.ubDifficultyLevel), 3 ); - + //make sure bloodcats don't outnumber mercs by a factor greater than 2 bNumMercMaxCats = (INT8)(PlayerMercsInSector( pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubSectorZ ) * 2); @@ -4763,12 +4750,12 @@ BOOLEAN TestForBloodcatAmbush( GROUP *pGroup ) else if( ubSectorID != SEC_I16 ) { if( !gfAutoAmbush && PreChance( 95 ) ) - { //already ambushed here. But 5% chance of getting ambushed again! + { //already ambushed here. But 5% chance of getting ambushed again! fAlreadyAmbushed = TRUE; } } - if( !fAlreadyAmbushed && ubSectorID != SEC_N5 && pSector->bBloodCats > 0 && + if( !fAlreadyAmbushed && ubSectorID != SEC_N5 && pSector->bBloodCats > 0 && !pGroup->fVehicle && !NumEnemiesInSector( pGroup->ubSectorX, pGroup->ubSectorY ) ) { if( ubSectorID != SEC_I16 || !gubFact[ FACT_PLAYER_KNOWS_ABOUT_BLOODCAT_LAIR ] ) @@ -4831,17 +4818,17 @@ void PlaceGroupInSector( UINT8 ubGroupID, INT16 sPrevX, INT16 sPrevY, INT16 sNex -// ARM: centralized it so we can do a comprehensive Assert on it. Causing problems with helicopter group! +// ARM: centralized it so we can do a comprehensive Assert on it. Causing problems with helicopter group! void SetGroupArrivalTime( GROUP *pGroup, UINT32 uiArrivalTime ) { // PLEASE CENTRALIZE ALL CHANGES TO THE ARRIVAL TIMES OF GROUPS THROUGH HERE, ESPECIALLY THE HELICOPTER GROUP!!! // if this group is the helicopter group, we have to make sure that its arrival time is never greater than the sum - // of the current time and its traverse time, 'cause those 3 values are used to plot its map position! Because of this + // of the current time and its traverse time, 'cause those 3 values are used to plot its map position! Because of this // the chopper groups must NEVER be delayed for any reason - it gets excluded from simultaneous arrival logic // Also note that non-chopper groups can currently be delayed such that this assetion would fail - enemy groups by - // DelayEnemyGroupsIfPathsCross(), and player groups via PrepareGroupsForSimultaneousArrival(). So we skip the assert. + // DelayEnemyGroupsIfPathsCross(), and player groups via PrepareGroupsForSimultaneousArrival(). So we skip the assert. if ( IsGroupTheHelicopterGroup( pGroup ) ) { @@ -4868,7 +4855,7 @@ void CancelEmptyPersistentGroupMovement( GROUP *pGroup ) Assert( pGroup->fPersistant ); - // don't do this for vehicle groups - the chopper can keep flying empty, + // don't do this for vehicle groups - the chopper can keep flying empty, // while other vehicles still exist and teleport to nearest sector instead if ( pGroup->fVehicle ) { @@ -4905,7 +4892,7 @@ void PlayerGroupArrivedSafelyInSector( GROUP *pGroup, BOOLEAN fCheckForNPCs ) Assert( pGroup->fPlayer ); - // if we haven't already checked for NPCs, and the group isn't empty + // if we haven't already checked for NPCs, and the group isn't empty if ( fCheckForNPCs && ( HandlePlayerGroupEnteringSectorToCheckForNPCsOfNote( pGroup ) == TRUE ) ) { // wait for player to answer/confirm prompt before doing anything else @@ -4925,8 +4912,8 @@ void PlayerGroupArrivedSafelyInSector( GROUP *pGroup, BOOLEAN fCheckForNPCs ) // NOTE: Of course, it would be better if they continued onwards once everyone was ready to go again, in which // case we'd want to preserve the plotted path, but since the player can mess with the squads, etc. - // in the mean-time, that just seemed to risky to try to support. They could get into a fight and be too - // injured to move, etc. Basically, we'd have run a complete CanCharacterMoveInStrategic(0 check on all of them. + // in the mean-time, that just seemed to risky to try to support. They could get into a fight and be too + // injured to move, etc. Basically, we'd have run a complete CanCharacterMoveInStrategic(0 check on all of them. // It's a wish list task for AM... // stop time so player can react if group was already on the move and suddenly halts @@ -5074,7 +5061,7 @@ BOOLEAN WildernessSectorWithAllProfiledNPCsNotSpokenWith( INT16 sSectorX, INT16 } } - + return( fFoundSomebody ); } @@ -5085,7 +5072,7 @@ void HandlePlayerGroupEnteringSectorToCheckForNPCsOfNoteCallback( UINT8 ubExitVa Assert( gpGroupPrompting ); if ( (ubExitValue == MSG_BOX_RETURN_YES) || - (ubExitValue == MSG_BOX_RETURN_OK) ) + (ubExitValue == MSG_BOX_RETURN_OK) ) { // NPCs now checked, continue moving if appropriate PlayerGroupArrivedSafelyInSector( gpGroupPrompting, FALSE ); @@ -5122,10 +5109,10 @@ BOOLEAN DoesPlayerExistInPGroup( UINT8 ubGroupID, SOLDIERTYPE *pSoldier ) PLAYERGROUP *curr; pGroup = GetGroup( ubGroupID ); - Assert( pGroup ); + Assert( pGroup ); curr = pGroup->pPlayerList; - + if( !curr ) { return FALSE; @@ -5139,7 +5126,7 @@ BOOLEAN DoesPlayerExistInPGroup( UINT8 ubGroupID, SOLDIERTYPE *pSoldier ) return TRUE; } - curr = curr->next; + curr = curr->next; } // !curr @@ -5195,22 +5182,22 @@ void ValidateGroups( GROUP *pGroup ) CHAR16 str[ 512 ]; if( pGroup->ubSectorIDOfLastReassignment == 255 ) { - swprintf( str, L"Enemy group found with 0 troops in it. This is illegal and group will be deleted." - L" Group %d in sector %c%d originated from sector %c%d.", - pGroup->ubGroupID, pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX, - SECTORY( pGroup->ubCreatedSectorID ) + 'A' - 1, SECTORX( pGroup->ubCreatedSectorID ) ); + swprintf( str, L"Enemy group found with 0 troops in it. This is illegal and group will be deleted." + L" Group %d in sector %c%d originated from sector %c%d.", + pGroup->ubGroupID, pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX, + SECTORY( pGroup->ubCreatedSectorID ) + 'A' - 1, SECTORX( pGroup->ubCreatedSectorID ) ); } else { - swprintf( str, L"Enemy group found with 0 troops in it. This is illegal and group will be deleted." - L" Group %d in sector %c%d originated from sector %c%d and last reassignment location was %c%d.", - pGroup->ubGroupID, pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX, - SECTORY( pGroup->ubCreatedSectorID ) + 'A' - 1, SECTORX( pGroup->ubCreatedSectorID ), - SECTORY( pGroup->ubSectorIDOfLastReassignment ) + 'A' - 1, SECTORX( pGroup->ubSectorIDOfLastReassignment ) ); + swprintf( str, L"Enemy group found with 0 troops in it. This is illegal and group will be deleted." + L" Group %d in sector %c%d originated from sector %c%d and last reassignment location was %c%d.", + pGroup->ubGroupID, pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX, + SECTORY( pGroup->ubCreatedSectorID ) + 'A' - 1, SECTORX( pGroup->ubCreatedSectorID ), + SECTORY( pGroup->ubSectorIDOfLastReassignment ) + 'A' - 1, SECTORX( pGroup->ubSectorIDOfLastReassignment ) ); } //correct error DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, NULL ); } } -#endif \ No newline at end of file +#endif diff --git a/Strategic/Strategic Movement.h b/Strategic/Strategic Movement.h index 2eb02a2c..784d344e 100644 --- a/Strategic/Strategic Movement.h +++ b/Strategic/Strategic Movement.h @@ -9,7 +9,7 @@ enum //enemy intentions, { NO_INTENTIONS, //enemy intentions are undefined. - PURSUIT, //enemy group has spotted a player group and is pursuing them. If they lose the player group, they + PURSUIT, //enemy group has spotted a player group and is pursuing them. If they lose the player group, they //will get reassigned. STAGING, //enemy is prepare to assault a town sector, but doesn't have enough troops. PATROL, //enemy is moving around determining safe areas. @@ -36,8 +36,8 @@ enum }; //This structure contains all of the information about a group moving in the strategic -//layer. This includes all troops, equipment, and waypoints, and location. -//NOTE: This is used for groups that are initiating a movement to another sector. +//layer. This includes all troops, equipment, and waypoints, and location. +//NOTE: This is used for groups that are initiating a movement to another sector. typedef struct WAYPOINT { UINT8 x; //sector x position of waypoint @@ -49,7 +49,7 @@ typedef struct WAYPOINT typedef struct PLAYERGROUP { - UINT8 ubProfileID; //SAVE THIS VALUE ONLY. The others are temp (for quick access) + UINT8 ubProfileID; //SAVE THIS VALUE ONLY. The others are temp (for quick access) UINT8 ubID; //index in the Menptr array SOLDIERTYPE *pSoldier; //direct access to the soldier pointer UINT8 bFlags; //flags referring to individual player soldiers @@ -65,22 +65,22 @@ typedef struct ENEMYGROUP UINT8 ubLeaderProfileID; //could be Mike, maybe the warden... someone new, but likely nobody. UINT8 ubPendingReinforcements;//This group is waiting for reinforcements before attacking or attempting to fortify newly aquired sector. UINT8 ubAdminsInBattle; //number of administrators in currently in battle. - UINT8 ubIntention; //the type of group this is: patrol, assault, spies, etc. + UINT8 ubIntention; //the type of group this is: patrol, assault, spies, etc. UINT8 ubTroopsInBattle; //number of soldiers currently in battle. UINT8 ubElitesInBattle; //number of elite soldiers currently in battle. - INT8 bPadding[20]; + INT8 bPadding[20]; }ENEMYGROUP; -//NOTE: ALL FLAGS ARE CLEARED WHENEVER A GROUP ARRIVES IN A SECTOR, OR ITS WAYPOINTS ARE -// DELETED!!! +//NOTE: ALL FLAGS ARE CLEARED WHENEVER A GROUP ARRIVES IN A SECTOR, OR ITS WAYPOINTS ARE +// DELETED!!! #define GROUPFLAG_SIMULTANEOUSARRIVAL_APPROVED 0x00000001 #define GROUPFLAG_SIMULTANEOUSARRIVAL_CHECKED 0x00000002 //I use this flag when traversing through a list to determine which groups meet whatever conditions, -//then add this marker flag. The second time I traverse the list, I simply check for this flag, -//apply my modifications to the group, and remove the flag. If you decide to use it, make sure the +//then add this marker flag. The second time I traverse the list, I simply check for this flag, +//apply my modifications to the group, and remove the flag. If you decide to use it, make sure the //flag is cleared. #define GROUPFLAG_MARKER 0x00000004 -//Set whenever a group retreats from battle. If the group arrives in the next sector and enemies are there +//Set whenever a group retreats from battle. If the group arrives in the next sector and enemies are there //retreat will not be an option. #define GROUPFLAG_JUST_RETREATED_FROM_BATTLE 0x00000008 #define GROUPFLAG_HIGH_POTENTIAL_FOR_AMBUSH 0x00000010 @@ -114,7 +114,7 @@ typedef struct GROUP UINT8 ubTransportationMask; //the mask combining all of the groups transportation methods. UINT32 uiFlags; //various conditions that apply to the group UINT8 ubCreatedSectorID; //used for debugging strategic AI for keeping track of the sector ID a group was created in. - UINT8 ubSectorIDOfLastReassignment; //used for debuggin strategic AI. Records location of any reassignments. + UINT8 ubSectorIDOfLastReassignment; //used for debuggin strategic AI. Records location of any reassignments. INT8 bPadding[29]; //***********************************************// union @@ -132,20 +132,20 @@ extern GROUP *gpGroupList; void RemoveAllGroups(); GROUP* GetGroup( UINT8 ubGroupID ); -//Remove a group from the list. This removes all of the waypoints as well as the members of the group. -//Calling this function doesn't position them in a sector. It is up to you to do that. The event system +//Remove a group from the list. This removes all of the waypoints as well as the members of the group. +//Calling this function doesn't position them in a sector. It is up to you to do that. The event system //will automatically handle their updating as they arrive in sectors. void RemoveGroup( UINT8 ubGroupID );//takes a groupID void RemovePGroup( GROUP *pGroup ); //same function, but takes a GROUP* void RemoveGroupIdFromList( UINT8 ubId ); -//Clears a groups waypoints. This is necessary when sending new orders such as different routes. +//Clears a groups waypoints. This is necessary when sending new orders such as different routes. void RemoveGroupWaypoints( UINT8 ubGroupID ); void RemovePGroupWaypoints( GROUP *pGroup ); //same function, but takes a GROUP* //Player grouping functions //......................... -//Creates a new player group, returning the unique ID of that group. This is the first +//Creates a new player group, returning the unique ID of that group. This is the first //step before adding waypoints and members to the player group. UINT8 CreateNewPlayerGroupDepartingFromSector( UINT8 ubSectorX, UINT8 ubSectorY ); //Allows you to add or remove players from the group. @@ -160,7 +160,7 @@ BOOLEAN RemoveAllPlayersFromPGroup( GROUP *pGroup ); UINT8 CreateNewVehicleGroupDepartingFromSector( UINT8 ubSectorX, UINT8 ubSectorY , UINT32 uiVehicleId ); -//Appends a waypoint to the end of the list. Waypoint MUST be on the +//Appends a waypoint to the end of the list. Waypoint MUST be on the //same horizontal xor vertical level as the last waypoint added. BOOLEAN AddWaypointToGroup( UINT8 ubGroupID, UINT8 ubSectorX, UINT8 ubSectorY ); BOOLEAN AddWaypointToPGroup( GROUP *pGroup, UINT8 ubSectorX, UINT8 ubSectorY ); @@ -249,12 +249,12 @@ void HandleArrivalOfReinforcements( GROUP *pGroup ); void PlanSimultaneousGroupArrivalCallback( UINT8 bMessageValue ); -//When groups meet up, then it is possible that they may join up. This only happens if +//When groups meet up, then it is possible that they may join up. This only happens if //the groups were separated because of singular tactical/exitgrid traversal, and the timing //expires. BOOLEAN AttemptToMergeSeparatedGroups( GROUP *pGroup, BOOLEAN fDecrementTraversals ); -//Called when all checks have been made for the group (if possible to retreat, etc.) This function +//Called when all checks have been made for the group (if possible to retreat, etc.) This function //blindly determines where to move the group. void RetreatGroupToPreviousSector( GROUP *pGroup ); @@ -263,7 +263,7 @@ GROUP* FindMovementGroupInSector( UINT8 ubSectorX, UINT8 ubSectorY, BOOLEAN fPla BOOLEAN GroupAtFinalDestination( GROUP *pGroup ); // find the travel time between waypts for this group -INT32 FindTravelTimeBetweenWaypoints( WAYPOINT * pSource, WAYPOINT * pDest, GROUP *pGroup ); +INT32 FindTravelTimeBetweenWaypoints( WAYPOINT * pSource, WAYPOINT * pDest, GROUP *pGroup ); BOOLEAN GroupReversingDirectionsBetweenSectors( GROUP *pGroup, UINT8 ubSectorX, UINT8 ubSectorY, BOOLEAN fBuildingWaypoints ); BOOLEAN GroupBetweenSectorsAndSectorXYIsInDifferentDirection( GROUP *pGroup, UINT8 ubSectorX, UINT8 ubSectorY ); @@ -276,7 +276,7 @@ void ResetMovementForEnemyGroupsInLocation( UINT8 ubSectorX, UINT8 ubSectorY ); void ResetMovementForEnemyGroup( GROUP *pGroup ); //Determines if any particular group WILL be moving through a given sector given it's current -//position in the route and TREATS the pGroup->ubMoveType as ONE_WAY EVEN IF IT ISN'T. If the +//position in the route and TREATS the pGroup->ubMoveType as ONE_WAY EVEN IF IT ISN'T. If the //group is currently IN the sector, or just left the sector, it will return FALSE. BOOLEAN GroupWillMoveThroughSector( GROUP *pGroup, UINT8 ubSectorX, UINT8 ubSectorY ); diff --git a/Strategic/Strategic Pathing.cpp b/Strategic/Strategic Pathing.cpp index 7f999693..c5f04ae1 100644 --- a/Strategic/Strategic Pathing.cpp +++ b/Strategic/Strategic Pathing.cpp @@ -3,10 +3,10 @@ #else #include #include - #include + #include #include "types.h" #include "worlddef.h" - #include "sgp.h" + #include "sgp.h" #include "strategic.h" #include "mapscreen.h" #include "overhead.h" @@ -21,7 +21,7 @@ #include "Assignments.h" #include "Squads.h" #include "Vehicles.h" - #include "Map Screen Helicopter.h" + #include "Map Screen Helicopter.h" #include "input.h" #include "english.h" #include "Map Screen Interface.h" @@ -56,12 +56,12 @@ UINT8 ubFromMapDirToInsertionCode[ ] = // Globals struct path_s { - INT16 nextLink; //2 - INT16 prevLink; //2 - INT16 location; //2 - INT32 costSoFar; //4 - INT32 costToGo; //4 - INT16 pathNdx; //2 + INT16 nextLink; //2 + INT16 prevLink; //2 + INT16 location; //2 + INT32 costSoFar; //4 + INT32 costToGo; //4 + INT16 pathNdx; //2 }; typedef struct path_s path_t; @@ -81,7 +81,7 @@ typedef struct trail_s trail_t; //#define EASYWATERCOST TRAVELCOST_FLAT / 2 //#define ISWATER(t) (((t)==TRAVELCOST_KNEEDEEP) || ((t)==TRAVELCOST_DEEPWATER)) //#define NOPASS (TRAVELCOST_OBSTACLE) -//#define VEINCOST TRAVELCOST_FLAT //actual cost for bridges and doors and such +//#define VEINCOST TRAVELCOST_FLAT //actual cost for bridges and doors and such //#define ISVEIN(v) ((v==TRAVELCOST_VEINMID) || (v==TRAVELCOST_VEINEND)) #define TRAILCELLTYPE UINT32 @@ -120,24 +120,24 @@ short trailStratTreedxB=0; } -#define DELQUENODE(ndx) \ -{ REMQUENODE(ndx); \ - INSQUENODEPREV(ndx,QPOOLNDX); \ +#define DELQUENODE(ndx) \ +{ REMQUENODE(ndx); \ + INSQUENODEPREV(ndx,QPOOLNDX); \ pathQB[ndx].location = -1; \ } -#define NEWQUENODE \ - if (queRequestsdy) ? (dx) : (dy)) +#define ESTIMATE0 ((dx>dy) ? (dx) : (dy)) #define ESTIMATE1 ((dxfSpeed=SLOW_MVT; - else + if ( _KeyDown( CTRL )) + pNode->fSpeed=SLOW_MVT; + else */ - pNode->fSpeed=NORMAL_MVT; - pNode->uiSectorId=iStartSectorNum; - pNode->pNext=NULL; - pNode->pPrev=NULL; - pNode->uiEta = GetWorldTotalMin( ); - pHeadOfPathList = pNode; + pNode->fSpeed=NORMAL_MVT; + pNode->uiSectorId=iStartSectorNum; + pNode->pNext=NULL; + pNode->pPrev=NULL; + pNode->uiEta = GetWorldTotalMin( ); + pHeadOfPathList = pNode; } iPathLength=((INT32)FindStratPath(((INT16)iStartSectorNum),((INT16)iEndSectorNum), sMvtGroupNumber, fTacticalTraversal )); while(iPathLength > iCount) { - switch(gusMapPathingData[iCount]) - { - case(NORTH): - iDelta=NORTH_MOVE; - break; - case(SOUTH): - iDelta=SOUTH_MOVE; - break; - case(EAST): - iDelta=EAST_MOVE; - break; - case(WEST): - iDelta=WEST_MOVE; - break; - } - iCount++; - // create new node - iCurrentSectorNum+=iDelta; - - if(!AddSectorToPathList(pHeadOfPathList, (UINT16)iCurrentSectorNum)) - { - pNode=pHeadOfPathList; - // intersected previous node, delete path to date - if(!pNode) - return NULL; - while(pNode->pNext) - pNode=pNode->pNext; - // start backing up + switch(gusMapPathingData[iCount]) + { + case(NORTH): + iDelta=NORTH_MOVE; + break; + case(SOUTH): + iDelta=SOUTH_MOVE; + break; + case(EAST): + iDelta=EAST_MOVE; + break; + case(WEST): + iDelta=WEST_MOVE; + break; + } + iCount++; + // create new node + iCurrentSectorNum+=iDelta; + + if(!AddSectorToPathList(pHeadOfPathList, (UINT16)iCurrentSectorNum)) + { + pNode=pHeadOfPathList; + // intersected previous node, delete path to date + if(!pNode) + return NULL; + while(pNode->pNext) + pNode=pNode->pNext; + // start backing up while(pNode->uiSectorId!=(UINT32)iStartSectorNum) { - pDeleteNode=pNode; - pNode=pNode->pPrev; - pNode->pNext=NULL; - MemFree(pDeleteNode); + pDeleteNode=pNode; + pNode=pNode->pPrev; + pNode->pNext=NULL; + MemFree(pDeleteNode); } - return NULL; - } + return NULL; + } - // for strategic mvt events - // we are at the new node, check if previous node was a change in deirection, ie change in delta..add waypoint - // if -1, do not - /* - if( iOldDelta != 0 ) - { - if( iOldDelta != iDelta ) - { - // ok add last waypt - if( fTempPath == FALSE ) - { - // change in direction..add waypoint - AddWaypointToGroup( ( UINT8 )sMvtGroupNumber, ( UINT8 )( ( iCurrentSectorNum - iDelta ) % MAP_WORLD_X ), ( UINT8 )( ( iCurrentSectorNum - iDelta ) / MAP_WORLD_X ) ); - } - } - } - */ - iOldDelta = iDelta; + // for strategic mvt events + // we are at the new node, check if previous node was a change in deirection, ie change in delta..add waypoint + // if -1, do not + /* + if( iOldDelta != 0 ) + { + if( iOldDelta != iDelta ) + { + // ok add last waypt + if( fTempPath == FALSE ) + { + // change in direction..add waypoint + AddWaypointToGroup( ( UINT8 )sMvtGroupNumber, ( UINT8 )( ( iCurrentSectorNum - iDelta ) % MAP_WORLD_X ), ( UINT8 )( ( iCurrentSectorNum - iDelta ) / MAP_WORLD_X ) ); + } + } + } + */ + iOldDelta = iDelta; - pHeadOfPathList = pNode; - if(!pNode) - return NULL; - while(pNode->pNext) - pNode=pNode->pNext; - - } - - pNode=pHeadOfPathList; - + pHeadOfPathList = pNode; if(!pNode) return NULL; - while(pNode->pNext) - pNode=pNode->pNext; - + while(pNode->pNext) + pNode=pNode->pNext; + + } + + pNode=pHeadOfPathList; + + if(!pNode) + return NULL; + while(pNode->pNext) + pNode=pNode->pNext; + if (!pNode->pPrev) { MemFree(pNode); pHeadOfPathList = NULL; pPath = pHeadOfPathList; - return FALSE; + return FALSE; } /* @@ -606,10 +603,10 @@ PathStPtr BuildAStrategicPath(PathStPtr pPath , INT16 iStartSectorNum, INT16 iEn { // change in direction..add waypoint AddWaypointToGroup( ( UINT8 )sMvtGroupNumber, ( UINT8 )( iCurrentSectorNum% MAP_WORLD_X ), ( UINT8 )( iCurrentSectorNum / MAP_WORLD_X ) ); - } + } */ - pPath=pHeadOfPathList; + pPath=pHeadOfPathList; return pPath; } @@ -620,46 +617,46 @@ PathStPtr BuildAStrategicPath(PathStPtr pPath , INT16 iStartSectorNum, INT16 iEn BOOLEAN AddSectorToPathList( PathStPtr pPath ,UINT16 uiSectorNum ) { - PathStPtr pNode=NULL; + PathStPtr pNode=NULL; PathStPtr pTempNode=NULL; PathStPtr pHeadOfList = pPath; - pNode=pPath; - - if(uiSectorNum < MAP_WORLD_X-1) + pNode=pPath; + + if(uiSectorNum < MAP_WORLD_X-1) return FALSE; if (pNode==NULL) - { - pNode = (PathStPtr) MemAlloc(sizeof(PathSt)); - - // Implement EtaCost Array as base EtaCosts of sectors - // pNode->uiEtaCost=EtaCost[uiSectorNum]; - pNode->uiSectorId=uiSectorNum; - pNode->uiEta= GetWorldTotalMin( ); - pNode->pNext=NULL; - pNode->pPrev=NULL; + { + pNode = (PathStPtr) MemAlloc(sizeof(PathSt)); + + // Implement EtaCost Array as base EtaCosts of sectors + // pNode->uiEtaCost=EtaCost[uiSectorNum]; + pNode->uiSectorId=uiSectorNum; + pNode->uiEta= GetWorldTotalMin( ); + pNode->pNext=NULL; + pNode->pPrev=NULL; /* - if ( _KeyDown( CTRL )) - pNode->fSpeed=SLOW_MVT; - else + if ( _KeyDown( CTRL )) + pNode->fSpeed=SLOW_MVT; + else */ - pNode->fSpeed=NORMAL_MVT; - - - return TRUE; + pNode->fSpeed=NORMAL_MVT; + + + return TRUE; } - else - { - //if (pNode->uiSectorId==uiSectorNum) - // return FALSE; + else + { + //if (pNode->uiSectorId==uiSectorNum) + // return FALSE; while(pNode->pNext) { - // if (pNode->uiSectorId==uiSectorNum) - // return FALSE; + // if (pNode->uiSectorId==uiSectorNum) + // return FALSE; pNode=pNode->pNext; - + } - + pTempNode = (PathStPtr) MemAlloc(sizeof(PathSt)); pTempNode->uiEta=0; pNode->pNext=pTempNode; @@ -667,16 +664,16 @@ BOOLEAN AddSectorToPathList( PathStPtr pPath ,UINT16 uiSectorNum ) pTempNode->pPrev=pNode; pTempNode->pNext=NULL; /* - if ( _KeyDown( CTRL )) - pTempNode->fSpeed=SLOW_MVT; - else + if ( _KeyDown( CTRL )) + pTempNode->fSpeed=SLOW_MVT; + else */ - pTempNode->fSpeed=NORMAL_MVT; - pNode=pTempNode; - - } - pPath = pHeadOfList; - return TRUE; + pTempNode->fSpeed=NORMAL_MVT; + pNode=pTempNode; + + } + pPath = pHeadOfList; + return TRUE; } @@ -685,7 +682,7 @@ BOOLEAN AddSectorToPathList( PathStPtr pPath ,UINT16 uiSectorNum ) BOOLEAN TravelBetweenSectorsIsBlockedFromVehicle( UINT16 sSourceSector, UINT16 sDestSector ) { INT16 sDelta; - + sDelta = sDestSector - sSourceSector; switch( sDelta ) @@ -694,11 +691,11 @@ BOOLEAN TravelBetweenSectorsIsBlockedFromVehicle( UINT16 sSourceSector, UINT16 s return( TRUE ); break; case( - MAP_WORLD_Y ): - return( StrategicMap[ sSourceSector ].uiBadVehicleSector[ 0 ] ); + return( StrategicMap[ sSourceSector ].uiBadVehicleSector[ 0 ] ); break; case( MAP_WORLD_Y): - return( StrategicMap[ sSourceSector ].uiBadVehicleSector[ 2 ] ); - break; + return( StrategicMap[ sSourceSector ].uiBadVehicleSector[ 2 ] ); + break; case( 1 ): return ( StrategicMap[ sSourceSector ].uiBadVehicleSector[ 1 ] ); break; @@ -712,7 +709,7 @@ BOOLEAN TravelBetweenSectorsIsBlockedFromVehicle( UINT16 sSourceSector, UINT16 s -BOOLEAN SectorIsBlockedFromVehicleExit( UINT16 sSourceSector, INT8 bToDirection ) +BOOLEAN SectorIsBlockedFromVehicleExit( UINT16 sSourceSector, INT8 bToDirection ) { if( StrategicMap[ sSourceSector ].uiBadVehicleSector[ bToDirection ] ) @@ -731,7 +728,7 @@ BOOLEAN SectorIsBlockedFromVehicleExit( UINT16 sSourceSector, INT8 bToDirection BOOLEAN TravelBetweenSectorsIsBlockedFromFoot( UINT16 sSourceSector, UINT16 sDestSector ) { INT16 sDelta; - + sDelta = sDestSector - sSourceSector; switch( sDelta ) @@ -740,11 +737,11 @@ BOOLEAN TravelBetweenSectorsIsBlockedFromFoot( UINT16 sSourceSector, UINT16 sDes return( TRUE ); break; case( - MAP_WORLD_Y ): - return( StrategicMap[ sSourceSector ].uiBadFootSector[ 0 ] ); + return( StrategicMap[ sSourceSector ].uiBadFootSector[ 0 ] ); break; case( MAP_WORLD_Y): - return( StrategicMap[ sSourceSector ].uiBadFootSector[ 2 ] ); - break; + return( StrategicMap[ sSourceSector ].uiBadFootSector[ 2 ] ); + break; case( 1 ): return ( StrategicMap[ sSourceSector ].uiBadFootSector[ 1 ] ); break; @@ -759,7 +756,7 @@ BOOLEAN TravelBetweenSectorsIsBlockedFromFoot( UINT16 sSourceSector, UINT16 sDes BOOLEAN SectorIsBlockedFromFootExit( UINT16 sSourceSector, INT8 bToDirection ) { - if( StrategicMap[ sSourceSector ].uiBadFootSector[ bToDirection ] ) + if( StrategicMap[ sSourceSector ].uiBadFootSector[ bToDirection ] ) { return ( TRUE ); } @@ -775,7 +772,7 @@ BOOLEAN SectorIsBlockedFromFootExit( UINT16 sSourceSector, INT8 bToDirection ) BOOLEAN CanThisMercMoveToThisSector( SOLDIERTYPE *pSoldier ,INT16 sX, INT16 sY ) { // this fucntion will return if this merc ( pSoldier ), can move to sector sX, sY - BOOLEAN fOkToMoveFlag = FALSE; + BOOLEAN fOkToMoveFlag = FALSE; return fOkToMoveFlag; @@ -785,8 +782,8 @@ BOOLEAN CanThisMercMoveToThisSector( SOLDIERTYPE *pSoldier ,INT16 sX, INT16 sY ) void SetThisMercsSectorXYToTheseValues( SOLDIERTYPE *pSoldier ,INT16 sX, INT16 sY, UINT8 ubFromDirection ) { - // will move a merc ( pSoldier )to a sector sX, sY - + // will move a merc ( pSoldier )to a sector sX, sY + // Ok, update soldier control pointer values pSoldier->sSectorX = sX; pSoldier->sSectorY = sY; @@ -809,7 +806,7 @@ void SetThisMercsSectorXYToTheseValues( SOLDIERTYPE *pSoldier ,INT16 sX, INT16 s RemovePlayerFromTeamSlotGivenMercID( pSoldier->ubID ); } - + return; } */ @@ -821,9 +818,8 @@ PathStPtr AppendStrategicPath( PathStPtr pNewSection, PathStPtr pHeadOfPathList // will append a new section onto the end of the head of list, then return the head of the new list PathStPtr pNode = pHeadOfPathList; - PathStPtr pPastNode = NULL; // move to end of original section - + if( pNewSection == NULL ) { return pHeadOfPathList; @@ -834,23 +830,23 @@ PathStPtr AppendStrategicPath( PathStPtr pNewSection, PathStPtr pHeadOfPathList if( pNode ) { // move to tail of old list - while( pNode -> pNext ) + while( pNode->pNext ) { // next node in list - pNode = pNode ->pNext; + pNode = pNode->pNext; } // make sure the 2 are not the same - if( pNode -> uiSectorId == pNewSection -> uiSectorId ) + if( pNode->uiSectorId == pNewSection->uiSectorId ) { // are the same, remove head of new list pNewSection = RemoveHeadFromStrategicPath( pNewSection ); } // append onto old list - pNode -> pNext = pNewSection; - pNewSection -> pPrev = pNode; + pNode->pNext = pNewSection; + pNewSection->pPrev = pNode; } else @@ -877,13 +873,13 @@ PathStPtr ClearStrategicPathList( PathStPtr pHeadOfPath, INT16 sMvtGroup ) } // clear list - while( pNode -> pNext ) + while( pNode->pNext ) { // set up delete node pDeleteNode = pNode; // move to next node - pNode = pNode -> pNext; + pNode = pNode->pNext; pNode->pPrev = NULL; // delete delete node @@ -898,8 +894,8 @@ PathStPtr ClearStrategicPathList( PathStPtr pHeadOfPath, INT16 sMvtGroup ) if( ( sMvtGroup != -1 ) && ( sMvtGroup != 0 ) ) { - // clear this groups mvt pathing - RemoveGroupWaypoints( ( UINT8 )sMvtGroup ); + // clear this groups mvt pathing + RemoveGroupWaypoints( ( UINT8 )sMvtGroup ); } return( pNode ); @@ -914,7 +910,7 @@ PathStPtr ClearStrategicPathListAfterThisSector( PathStPtr pHeadOfPath, INT16 sX INT16 sSector = 0; INT16 sCurrentSector = -1; - + // is there in fact a path? if( pNode == NULL ) @@ -926,24 +922,24 @@ PathStPtr ClearStrategicPathListAfterThisSector( PathStPtr pHeadOfPath, INT16 sX // get sector value sSector = sX + ( sY * MAP_WORLD_X ); - + // go to end of list pNode = MoveToEndOfPathList( pNode ); // get current sector value - sCurrentSector = ( INT16 )pNode -> uiSectorId; + sCurrentSector = ( INT16 )pNode->uiSectorId; // move through list while( ( pNode )&&( sSector != sCurrentSector ) ) { - + // next value - pNode = pNode -> pPrev; + pNode = pNode->pPrev; // get current sector value if( pNode != NULL ) { - sCurrentSector = ( INT16 )pNode -> uiSectorId; + sCurrentSector = ( INT16 )pNode->uiSectorId; } } @@ -956,7 +952,7 @@ PathStPtr ClearStrategicPathListAfterThisSector( PathStPtr pHeadOfPath, INT16 sX // we want to KEEP the target sector, not delete it, so advance to the next sector - pNode = pNode -> pNext; + pNode = pNode->pNext; // is nothing left? if( pNode == NULL ) @@ -967,10 +963,10 @@ PathStPtr ClearStrategicPathListAfterThisSector( PathStPtr pHeadOfPath, INT16 sX // if we're NOT about to clear the head (there's a previous entry) - if( pNode -> pPrev ) + if( pNode->pPrev ) { - // set next for tail to NULL - pNode -> pPrev -> pNext = NULL; + // set next for tail to NULL + pNode->pPrev->pNext = NULL; } else { @@ -981,13 +977,13 @@ PathStPtr ClearStrategicPathListAfterThisSector( PathStPtr pHeadOfPath, INT16 sX } // clear list - while( pNode -> pNext ) + while( pNode->pNext ) { // set up delete node pDeleteNode = pNode; // move to next node - pNode = pNode -> pNext; + pNode = pNode->pNext; // check if we are clearing the head of the list if( pDeleteNode == pHeadOfPath ) @@ -999,7 +995,7 @@ PathStPtr ClearStrategicPathListAfterThisSector( PathStPtr pHeadOfPath, INT16 sX // delete delete node MemFree( pDeleteNode ); } - + // clear out last node MemFree( pNode ); @@ -1021,9 +1017,9 @@ PathStPtr MoveToBeginningOfPathList( PathStPtr pList ) } // move to beginning of list - while( pList -> pPrev ) + while( pList->pPrev ) { - pList = pList -> pPrev; + pList = pList->pPrev; } return ( pList ); @@ -1041,9 +1037,9 @@ PathStPtr MoveToEndOfPathList( PathStPtr pList ) } // move to beginning of list - while( pList -> pNext ) + while( pList->pNext ) { - pList = pList -> pNext; + pList = pList->pNext; } return ( pList ); @@ -1063,16 +1059,16 @@ PathStPtr RemoveTailFromStrategicPath( PathStPtr pHeadOfList ) return( NULL ); } - while( pNode -> pNext ) + while( pNode->pNext ) { pLastNode = pNode; - pNode = pNode -> pNext; + pNode = pNode->pNext; } // end of list // set next to null - pLastNode -> pNext = NULL; + pLastNode->pNext = NULL; // now remove old last node MemFree( pNode ); @@ -1097,17 +1093,17 @@ PathStPtr RemoveHeadFromStrategicPath( PathStPtr pList ) } // move to head of list - while( pNode ->pPrev ) + while( pNode->pPrev ) { // back one node - pNode = pNode -> pPrev; + pNode = pNode->pPrev; } // set up new head - pNewHead = pNode -> pNext; + pNewHead = pNode->pNext; if( pNewHead ) { - pNewHead -> pPrev = NULL; + pNewHead->pPrev = NULL; } // free old head @@ -1132,14 +1128,14 @@ PathStPtr RemoveSectorFromStrategicPathList( PathStPtr pList , INT16 sX, INT16 s // get sector value sSector = sX + ( sY * MAP_WORLD_X ); - // check if there is a valid list + // check if there is a valid list if( pNode == NULL ) { return( pNode ); } // get current sector value - sCurrentSector = ( INT16 )pNode -> uiSectorId; + sCurrentSector = ( INT16 )pNode->uiSectorId; // move to end of list pNode = MoveToEndOfPathList( pNode ); @@ -1151,10 +1147,10 @@ PathStPtr RemoveSectorFromStrategicPathList( PathStPtr pList , INT16 sX, INT16 s pPastNode = pNode; // next value - pNode = pNode -> pPrev; + pNode = pNode->pPrev; // get current sector value - sCurrentSector = ( INT16 )pNode -> uiSectorId; + sCurrentSector = ( INT16 )pNode->uiSectorId; } // no list left, sector not found @@ -1164,13 +1160,13 @@ PathStPtr RemoveSectorFromStrategicPathList( PathStPtr pList , INT16 sX, INT16 s } // sector found...remove it - pPastNode->pNext = pNode -> pNext; + pPastNode->pNext = pNode->pNext; // remove node MemFree( pNode ); // set up prev for next - pPastNode -> pNext -> pPrev = pPastNode; + pPastNode->pNext->pPrev = pPastNode; pPastNode = MoveToBeginningOfPathList( pPastNode ); @@ -1181,15 +1177,15 @@ PathStPtr RemoveSectorFromStrategicPathList( PathStPtr pList , INT16 sX, INT16 s INT16 GetLastSectorIdInCharactersPath( SOLDIERTYPE *pCharacter ) { // will return the last sector of the current path, or the current sector if there's no path - INT16 sLastSector = ( pCharacter -> sSectorX ) + ( pCharacter ->sSectorY ) * ( MAP_WORLD_X ); + INT16 sLastSector = ( pCharacter->sSectorX ) + ( pCharacter->sSectorY ) * ( MAP_WORLD_X ); PathStPtr pNode = NULL; pNode = GetSoldierMercPathPtr( pCharacter ); while( pNode ) { - sLastSector = ( INT16 ) ( pNode -> uiSectorId ); - pNode = pNode -> pNext; + sLastSector = ( INT16 ) ( pNode->uiSectorId ); + pNode = pNode->pNext; } return sLastSector; @@ -1210,7 +1206,7 @@ INT16 GetLastSectorIdInVehiclePath( INT32 iId ) { return( sLastSector ); } - + // get current last sector sLastSector = ( pVehicleList[ iId ].sSectorX ) + ( pVehicleList[ iId ].sSectorY * MAP_WORLD_X ); @@ -1218,8 +1214,8 @@ INT16 GetLastSectorIdInVehiclePath( INT32 iId ) while( pNode ) { - sLastSector = ( INT16 ) ( pNode -> uiSectorId ); - pNode = pNode -> pNext; + sLastSector = ( INT16 ) ( pNode->uiSectorId ); + pNode = pNode->pNext; } return sLastSector; @@ -1229,7 +1225,7 @@ INT16 GetLastSectorIdInVehiclePath( INT32 iId ) -PathStPtr CopyPaths( PathStPtr pSourcePath, PathStPtr pDestPath ) +PathStPtr CopyPaths( PathStPtr pSourcePath, PathStPtr pDestPath ) { PathStPtr pDestNode = pDestPath; PathStPtr pCurNode = pSourcePath; @@ -1245,39 +1241,39 @@ PathStPtr CopyPaths( PathStPtr pSourcePath, PathStPtr pDestPath ) if ( pCurNode != NULL ) { pDestNode = (PathStPtr) MemAlloc( sizeof( PathSt ) ); - + // set next and prev nodes - pDestNode -> pPrev = NULL; - pDestNode -> pNext = NULL; + pDestNode->pPrev = NULL; + pDestNode->pNext = NULL; // copy sector value and times - pDestNode -> uiSectorId = pCurNode -> uiSectorId; - pDestNode -> uiEta = pCurNode -> uiEta; - pDestNode -> fSpeed = pCurNode -> fSpeed; + pDestNode->uiSectorId = pCurNode->uiSectorId; + pDestNode->uiEta = pCurNode->uiEta; + pDestNode->fSpeed = pCurNode->fSpeed; - pCurNode = pCurNode -> pNext; + pCurNode = pCurNode->pNext; } while( pCurNode != NULL ) - { + { - pDestNode -> pNext = (path *) MemAlloc( sizeof( PathSt ) ); + pDestNode->pNext = (path *) MemAlloc( sizeof( PathSt ) ); // set next's previous to current - pDestNode -> pNext -> pPrev = pDestNode; + pDestNode->pNext->pPrev = pDestNode; // set next's next to null - pDestNode -> pNext -> pNext = NULL; + pDestNode->pNext->pNext = NULL; // increment ptr - pDestNode = pDestNode -> pNext; + pDestNode = pDestNode->pNext; // copy sector value and times - pDestNode -> uiSectorId = pCurNode -> uiSectorId; - pDestNode -> uiEta = pCurNode -> uiEta; - pDestNode -> fSpeed = pCurNode -> fSpeed; + pDestNode->uiSectorId = pCurNode->uiSectorId; + pDestNode->uiEta = pCurNode->uiEta; + pDestNode->fSpeed = pCurNode->fSpeed; - pCurNode = pCurNode -> pNext; + pCurNode = pCurNode->pNext; } @@ -1295,9 +1291,9 @@ INT32 GetStrategicMvtSpeed( SOLDIERTYPE *pCharacter ) // avg of strength and agility * percentage health..very simple..replace later - iSpeed = ( INT32 )( ( pCharacter -> bAgility + pCharacter -> bStrength ) / 2 ); - iSpeed *= ( INT32 )(( pCharacter -> bLife ) ); - iSpeed /= ( INT32 )pCharacter -> bLifeMax; + iSpeed = ( INT32 )( ( pCharacter->stats.bAgility + pCharacter->stats.bStrength ) / 2 ); + iSpeed *= ( INT32 )(( pCharacter->stats.bLife ) ); + iSpeed /= ( INT32 )pCharacter->stats.bLifeMax; return ( iSpeed ); } @@ -1317,17 +1313,17 @@ void CalculateEtaForCharacterPath( SOLDIERTYPE *pCharacter ) } // the rules change a little for people in vehicles - if( pCharacter -> bAssignment == VEHICLE ) + if( pCharacter->bAssignment == VEHICLE ) { fInVehicle = TRUE; } - if( ( pCharacter -> pMercPath == NULL ) && ( fInVehicle == FALSE ) ) + if( ( pCharacter->pMercPath == NULL ) && ( fInVehicle == FALSE ) ) { return; } - if( ( fInVehicle == TRUE ) && ( VehicleIdIsValid( pCharacter -> iVehicleId ) ) ) + if( ( fInVehicle == TRUE ) && ( VehicleIdIsValid( pCharacter->iVehicleId ) ) ) { // valid vehicle, is there a path for it? if( pVehicleList[ iId ].pMercPath == NULL ) @@ -1345,14 +1341,14 @@ void CalculateEtaForCharacterPath( SOLDIERTYPE *pCharacter ) while( pNode ) { // first node, set eta to current time - if( pNode -> pPrev == NULL ) + if( pNode->pPrev == NULL ) { - pNode -> uiEta = GetWorldTotalMin( ); + pNode->uiEta = GetWorldTotalMin( ); } else { // get delta in sectors - switch( pNode -> uiSectorId - pNode -> pPrev -> uiSectorId ) + switch( pNode->uiSectorId - pNode->pPrev->uiSectorId ) { case( NORTH_MOVE ): iMveDelta = 0; @@ -1367,7 +1363,7 @@ void CalculateEtaForCharacterPath( SOLDIERTYPE *pCharacter ) iMveDelta = 3; break; } - + if( fInVehicle == TRUE ) { // which type @@ -1375,15 +1371,15 @@ void CalculateEtaForCharacterPath( SOLDIERTYPE *pCharacter ) } else { - // get delta..is the sector ( mvt cost * modifier ) / ( character strategic speed * mvt speed ) - uiDeltaEta = ( ( StrategicMap[ pNode -> uiSectorId ].uiFootEta[ iMveDelta ] * FOOT_MVT_MODIFIER ) / ( GetStrategicMvtSpeed( pCharacter ) * ( pNode -> fSpeed + 1 ) ) ); + // get delta..is the sector ( mvt cost * modifier ) / ( character strategic speed * mvt speed ) + uiDeltaEta = ( ( StrategicMap[ pNode->uiSectorId ].uiFootEta[ iMveDelta ] * FOOT_MVT_MODIFIER ) / ( GetStrategicMvtSpeed( pCharacter ) * ( pNode->fSpeed + 1 ) ) ); } // next sector eta - pNode -> uiEta = pNode -> pPrev -> uiEta + ( uiDeltaEta ); + pNode->uiEta = pNode->pPrev->uiEta + ( uiDeltaEta ); } - pNode = pNode -> pNext; + pNode = pNode->pNext; } return; } @@ -1403,36 +1399,36 @@ void MoveCharacterOnPath( SOLDIERTYPE *pCharacter ) return; } - if( pCharacter -> pMercPath == NULL ) + if( pCharacter->pMercPath == NULL ) { return; } - if( pCharacter -> pMercPath -> pNext == NULL ) + if( pCharacter->pMercPath->pNext == NULL ) { // simply set eta to current time - pCharacter -> pMercPath -> uiEta = GetWorldTotalMin( ); + pCharacter->pMercPath->uiEta = GetWorldTotalMin( ); return; } // set up node to beginning of path list - pNode = pCharacter -> pMercPath; + pNode = pCharacter->pMercPath; // while there are nodes left with eta less than current time - while( pNode -> pNext -> uiEta < GetWorldTotalMin( ) ) + while( pNode->pNext->uiEta < GetWorldTotalMin( ) ) { // delete node, move on pDeleteNode = pNode; // next node - pNode = pNode -> pNext; + pNode = pNode->pNext; // delete delete node MemFree( pDeleteNode ); // set up merc path to this sector - pCharacter -> pMercPath = pNode; + pCharacter->pMercPath = pNode; // no where left to go if( pNode == NULL ) @@ -1440,18 +1436,18 @@ void MoveCharacterOnPath( SOLDIERTYPE *pCharacter ) return; } - + // null out prev to beginning of merc path list - pNode -> pPrev = NULL; + pNode->pPrev = NULL; // set up new location - pCharacter -> sSectorX = ( INT16 )( pNode -> uiSectorId ) % MAP_WORLD_X ; - pCharacter -> sSectorY = ( INT16 )( pNode -> uiSectorId ) / MAP_WORLD_X; + pCharacter->sSectorX = ( INT16 )( pNode->uiSectorId ) % MAP_WORLD_X ; + pCharacter->sSectorY = ( INT16 )( pNode->uiSectorId ) / MAP_WORLD_X; // dirty map panel fMapPanelDirty = TRUE; - if( pNode -> pNext == NULL ) + if( pNode->pNext == NULL ) { return; } @@ -1463,11 +1459,11 @@ void MoveTeamOnFoot( void ) { // run through list of characters on player team, if on foot, move them SOLDIERTYPE *pSoldier, *pTeamSoldier; - INT32 cnt=0; - + INT32 cnt=0; + // set psoldier as first in merc ptrs - pSoldier = MercPtrs[0]; - + pSoldier = MercPtrs[0]; + // go through list of characters, move characters for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) { @@ -1492,21 +1488,21 @@ UINT32 GetEtaGivenRoute( PathStPtr pPath ) { return( GetWorldTotalMin( ) ); } - else if( pPath -> pNext == NULL ) + else if( pPath->pNext == NULL ) { return( GetWorldTotalMin( ) ); } else { // there is a path - while( pNode -> pNext ) + while( pNode->pNext ) { // run through list - pNode = pNode -> pNext; + pNode = pNode->pNext; } // have last sector, therefore the eta of the path - return( pNode -> uiEta ); + return( pNode->uiEta ); } // error @@ -1569,8 +1565,8 @@ void RebuildWayPointsForGroupPath( PathStPtr pHeadOfPath, INT16 sMvtGroup ) pGroup = GetGroup( ( UINT8 )sMvtGroup ); - //KRIS! Added this because it was possible to plot a new course to the same destination, and the - // group would add new arrival events without removing the existing one(s). + //KRIS! Added this because it was possible to plot a new course to the same destination, and the + // group would add new arrival events without removing the existing one(s). DeleteStrategicEvent( EVENT_GROUP_ARRIVAL, sMvtGroup ); RemoveGroupWaypoints( ( UINT8 )sMvtGroup ); @@ -1612,7 +1608,7 @@ void RebuildWayPointsForGroupPath( PathStPtr pHeadOfPath, INT16 sMvtGroup ) // if we're currently between sectors if( pGroup->fBetweenSectors ) { - // figure out which direction we're already going in (Otherwise iOldDelta starts at 0) + // figure out which direction we're already going in (Otherwise iOldDelta starts at 0) iOldDelta = CALCULATE_STRATEGIC_INDEX( pGroup->ubNextX, pGroup->ubNextY ) - CALCULATE_STRATEGIC_INDEX( pGroup->ubSectorX, pGroup->ubSectorY ); } @@ -1624,7 +1620,7 @@ void RebuildWayPointsForGroupPath( PathStPtr pHeadOfPath, INT16 sMvtGroup ) // Waypoints are only added at "pivot points" - whenever there is a change in orthogonal direction. // If we're NOT currently between sectors, iOldDelta will start off at 0, which means that the first node can't be - // added as a waypoint. This is what we want - for stationary mercs, the first node in a path is the CURRENT sector. + // added as a waypoint. This is what we want - for stationary mercs, the first node in a path is the CURRENT sector. if( ( iOldDelta != 0 ) && ( iDelta != iOldDelta ) ) { // add this strategic sector as a waypoint @@ -1647,17 +1643,17 @@ void RebuildWayPointsForGroupPath( PathStPtr pHeadOfPath, INT16 sMvtGroup ) // at this point, the final sector in the path must be identical to this group's last waypoint wp = GetFinalWaypoint( pGroup ); - AssertMsg( wp, "Path exists, but no waypoints were added! AM-0" ); - AssertMsg( pNode->uiSectorId == ( UINT32 ) CALCULATE_STRATEGIC_INDEX( wp->x, wp->y ), "Last waypoint differs from final path sector! AM-0" ); + AssertMsg( wp, "Path exists, but no waypoints were added! AM-0" ); + AssertMsg( pNode->uiSectorId == ( UINT32 ) CALCULATE_STRATEGIC_INDEX( wp->x, wp->y ), "Last waypoint differs from final path sector! AM-0" ); // see if we've already reached the first sector in the path (we never actually left the sector and reversed back to it) if( pGroup->uiArrivalTime == GetWorldTotalMin() ) { - // never really left. Must set check for battle TRUE in order for HandleNonCombatGroupArrival() to run! + // never really left. Must set check for battle TRUE in order for HandleNonCombatGroupArrival() to run! GroupArrivedAtSector( pGroup->ubGroupID, TRUE, TRUE ); } -} +} @@ -1889,20 +1885,20 @@ PathStPtr GetSoldierMercPathPtr( SOLDIERTYPE *pSoldier ) pMercPath = pVehicleList[ pSoldier->iVehicleId ].pMercPath; } // IS a vehicle? - else if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + else if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { - /* Sergeant_Kolja, 2007-02-20: got an pVehicleList==NULL Exception on loading an older save here... not REALY fixed! */ - if( !pVehicleList ) /*bcause we have no vehicle list at all, we act as we are a person*/ - { - pSoldier->uiStatusFlags &= ~SOLDIER_VEHICLE; - pMercPath = pSoldier->pMercPath; - /* after all, create an empty Vehicle list */ + /* Sergeant_Kolja, 2007-02-20: got an pVehicleList==NULL Exception on loading an older save here... not REALY fixed! */ + if( !pVehicleList ) /*bcause we have no vehicle list at all, we act as we are a person*/ + { + pSoldier->flags.uiStatusFlags &= ~SOLDIER_VEHICLE; + pMercPath = pSoldier->pMercPath; + /* after all, create an empty Vehicle list */ pVehicleList = (VEHICLETYPE *) MemAlloc( sizeof( VEHICLETYPE ) ); - memset( pVehicleList, 0, sizeof( VEHICLETYPE ) ); - pVehicleList->fValid = 0; - } - else - pMercPath = pVehicleList[ pSoldier->bVehicleID ].pMercPath; + memset( pVehicleList, 0, sizeof( VEHICLETYPE ) ); + pVehicleList->fValid = 0; + } + else + pMercPath = pVehicleList[ pSoldier->bVehicleID ].pMercPath; } else // a person { @@ -1956,7 +1952,7 @@ UINT8 GetSoldierGroupId( SOLDIERTYPE *pSoldier ) ubGroupId = pVehicleList[ pSoldier->iVehicleId ].ubMovementGroup; } // IS a vehicle? - else if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + else if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { ubGroupId = pVehicleList[ pSoldier->bVehicleID ].ubMovementGroup; } @@ -1994,7 +1990,7 @@ void ClearMercPathsAndWaypointsForAllInGroup( GROUP *pGroup ) { INT32 iVehicleId = -1; VEHICLETYPE *pVehicle = NULL; - + iVehicleId = GivenMvtGroupIdFindVehicleId( pGroup->ubGroupID ); Assert ( iVehicleId != -1 ); @@ -2022,7 +2018,7 @@ void ClearPathForSoldier( SOLDIERTYPE *pSoldier ) pSoldier->pMercPath = ClearStrategicPathList( pSoldier->pMercPath, pSoldier->ubGroupID ); // if a vehicle - if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { pVehicle = &( pVehicleList[ pSoldier->bVehicleID ] ); } @@ -2065,7 +2061,7 @@ void AddSectorToFrontOfMercPathForAllSoldiersInGroup( GROUP *pGroup, UINT8 ubSec { INT32 iVehicleId = -1; VEHICLETYPE *pVehicle = NULL; - + iVehicleId = GivenMvtGroupIdFindVehicleId( pGroup->ubGroupID ); Assert ( iVehicleId != -1 ); diff --git a/Strategic/Strategic Pathing.h b/Strategic/Strategic Pathing.h index 7ac52d5e..0a16785a 100644 --- a/Strategic/Strategic Pathing.h +++ b/Strategic/Strategic Pathing.h @@ -9,14 +9,14 @@ // Shortest Path Defines #define NORTH_MOVE -18 -#define EAST_MOVE 1 -#define WEST_MOVE -1 -#define SOUTH_MOVE 18 +#define EAST_MOVE 1 +#define WEST_MOVE -1 +#define SOUTH_MOVE 18 // Movement speed defines #define NORMAL_MVT 1 -#define SLOW_MVT 0 +#define SLOW_MVT 0 // movment modes @@ -29,7 +29,7 @@ enum{ INT32 FindStratPath(INT16 sStart, INT16 sDestination, INT16 sMvtGroupNumber, BOOLEAN fTacticalTraversal ); /* -BOOLEAN SectorIsBlockedFromVehicleExit( UINT16 sSectorDest, INT8 bToDirection ); +BOOLEAN SectorIsBlockedFromVehicleExit( UINT16 sSectorDest, INT8 bToDirection ); BOOLEAN SectorIsBlockedFromFootExit( UINT16 sSector, INT8 bToDirection ); BOOLEAN TravelBetweenSectorsIsBlockedFromVehicle( UINT16 sSourceSector, UINT16 sDestSector ); BOOLEAN TravelBetweenSectorsIsBlockedFromFoot( UINT16 sSourceSector, UINT16 sDestSector ); @@ -74,7 +74,7 @@ INT16 GetLastSectorIdInCharactersPath( SOLDIERTYPE *pCharacter ); INT16 GetLastSectorIdInVehiclePath( INT32 iId ); // copy paths -PathStPtr CopyPaths( PathStPtr pSourcePath, PathStPtr pDestPath ); +PathStPtr CopyPaths( PathStPtr pSourcePath, PathStPtr pDestPath ); // build eta's for characters path - no longer used //void CalculateEtaForCharacterPath( SOLDIERTYPE *pCharacter ); diff --git a/Strategic/Strategic Status.cpp b/Strategic/Strategic Status.cpp index 2bc0d2bc..879d9247 100644 --- a/Strategic/Strategic Status.cpp +++ b/Strategic/Strategic Status.cpp @@ -33,7 +33,7 @@ void InitStrategicStatus(void) BOOLEAN SaveStrategicStatusToSaveGameFile( HWFILE hFile ) { - UINT32 uiNumBytesWritten; + UINT32 uiNumBytesWritten; //Save the Strategic Status structure to the saved game file FileWrite( hFile, &gStrategicStatus, sizeof( STRATEGIC_STATUS ), &uiNumBytesWritten ); @@ -49,7 +49,7 @@ BOOLEAN SaveStrategicStatusToSaveGameFile( HWFILE hFile ) BOOLEAN LoadStrategicStatusFromSaveGameFile( HWFILE hFile ) { - UINT32 uiNumBytesRead; + UINT32 uiNumBytesRead; //Load the Strategic Status structure from the saved game file FileRead( hFile, &gStrategicStatus, sizeof( STRATEGIC_STATUS ), &uiNumBytesRead ); @@ -87,7 +87,7 @@ void ModifyPlayerReputation(INT8 bRepChange) iNewBadRep = (INT32) gStrategicStatus.ubBadReputation - bRepChange; // keep within a 0-100 range (0 = Saint, 100 = Satan) - iNewBadRep = __max( 0, iNewBadRep ); + iNewBadRep = __max( 0, iNewBadRep ); iNewBadRep = __min( 100, iNewBadRep ); gStrategicStatus.ubBadReputation = (UINT8) iNewBadRep; @@ -166,7 +166,7 @@ BOOLEAN MercThinksHisMoraleIsTooLow( SOLDIERTYPE *pSoldier ) // above 50, morale is GOOD, never below tolerance then bMoraleTolerance = (100 - bRepTolerance) / 2; - if (pSoldier->bMorale < bMoraleTolerance) + if (pSoldier->aiData.bMorale < bMoraleTolerance) { // too low - sorry return(TRUE); @@ -198,7 +198,7 @@ UINT8 LackOfProgressTolerance( void ) { return( 6 - gGameOptions.ubDifficultyLevel + gStrategicStatus.ubHighestProgress / 42 ); } - + } @@ -240,7 +240,7 @@ void HandleEnricoEmail(void) // test for a major setback OR a second minor setback if ((((ubHighestProgress - ubCurrentProgress) >= MAJOR_SETBACK_THRESHOLD) || - (((ubHighestProgress - ubCurrentProgress) >= MINOR_SETBACK_THRESHOLD) && (gStrategicStatus.usEnricoEmailFlags & ENRICO_EMAIL_FLAG_SETBACK_OVER))) && + (((ubHighestProgress - ubCurrentProgress) >= MINOR_SETBACK_THRESHOLD) && (gStrategicStatus.usEnricoEmailFlags & ENRICO_EMAIL_FLAG_SETBACK_OVER))) && !(gStrategicStatus.usEnricoEmailFlags & ENRICO_EMAIL_SENT_MAJOR_SETBACK)) { AddEmail(ENRICO_SETBACK, ENRICO_SETBACK_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1); @@ -249,7 +249,7 @@ void HandleEnricoEmail(void) else // test for a first minor setback if (((ubHighestProgress - ubCurrentProgress) >= MINOR_SETBACK_THRESHOLD) && - !(gStrategicStatus.usEnricoEmailFlags & (ENRICO_EMAIL_SENT_MINOR_SETBACK | ENRICO_EMAIL_SENT_MAJOR_SETBACK))) + !(gStrategicStatus.usEnricoEmailFlags & (ENRICO_EMAIL_SENT_MINOR_SETBACK | ENRICO_EMAIL_SENT_MAJOR_SETBACK))) { AddEmail(ENRICO_SETBACK_2, ENRICO_SETBACK_2_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1); gStrategicStatus.usEnricoEmailFlags |= ENRICO_EMAIL_SENT_MINOR_SETBACK; @@ -270,7 +270,7 @@ void HandleEnricoEmail(void) ubTolerance = LackOfProgressTolerance(); if ( gStrategicStatus.ubNumberOfDaysOfInactivity >= ubTolerance ) - { + { if ( gStrategicStatus.ubNumberOfDaysOfInactivity == ubTolerance ) { // send email @@ -344,7 +344,7 @@ void HandleEnricoEmail(void) } } - // reset # of new sectors visited 'today' + // reset # of new sectors visited 'today' // grant some leeway for the next day, could have started moving // at night... gStrategicStatus.ubNumNewSectorsVisitedToday = __min( gStrategicStatus.ubNumNewSectorsVisitedToday, NEW_SECTORS_EQUAL_TO_ACTIVITY ) / 3; @@ -354,9 +354,9 @@ void HandleEnricoEmail(void) void TrackEnemiesKilled( UINT8 ubKilledHow, UINT8 ubSoldierClass ) { INT8 bRankIndex; - + bRankIndex = SoldierClassToRankIndex( ubSoldierClass ); - + // if it's not a standard enemy-class soldier if ( bRankIndex == -1 ) { @@ -383,7 +383,7 @@ INT8 SoldierClassToRankIndex( UINT8 ubSoldierClass ) case SOLDIER_CLASS_ADMINISTRATOR: bRankIndex = 0; break; case SOLDIER_CLASS_ELITE: bRankIndex = 2; break; case SOLDIER_CLASS_ARMY: bRankIndex = 1; break; - + default: // this happens when an NPC joins the enemy team (e.g. Conrad, Iggy, Mike) break; @@ -408,4 +408,4 @@ UINT8 RankIndexToSoldierClass( UINT8 ubRankIndex ) } return( ubSoldierClass ); -} \ No newline at end of file +} diff --git a/Strategic/Strategic Status.h b/Strategic/Strategic Status.h index b3287501..3e55094e 100644 --- a/Strategic/Strategic Status.h +++ b/Strategic/Strategic Status.h @@ -2,9 +2,14 @@ #define __STRATEGIC_STATUS_H #include "types.h" -#include "Item Types.h" +//#include "Item Types.h" #include "Soldier Control.h" +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + //Enemy is allowed to capture the player after certain day #define STARTDAY_ALLOW_PLAYER_CAPTURE_FOR_RESCUE 4 @@ -92,9 +97,9 @@ typedef struct STRATEGIC_STATUS UINT8 ubUnhiredMercDeaths; // how many mercs have died while NOT working for the player - UINT16 usPlayerKills; // kills achieved by all mercs controlled by player together. *Excludes* militia kills! + UINT16 usPlayerKills; // kills achieved by all mercs controlled by player together. *Excludes* militia kills! - UINT16 usEnemiesKilled[NUM_WAYS_ENEMIES_KILLED][NUM_ENEMY_RANKS]; // admin/troop/elite. Includes kills by militia, too + UINT16 usEnemiesKilled[NUM_WAYS_ENEMIES_KILLED][NUM_ENEMY_RANKS]; // admin/troop/elite. Includes kills by militia, too UINT16 usLastDayOfPlayerActivity; UINT8 ubNumNewSectorsVisitedToday; UINT8 ubNumberOfDaysOfInactivity; diff --git a/Strategic/Strategic Town Loyalty.cpp b/Strategic/Strategic Town Loyalty.cpp index 130791f9..fc4feb6d 100644 --- a/Strategic/Strategic Town Loyalty.cpp +++ b/Strategic/Strategic Town Loyalty.cpp @@ -35,7 +35,6 @@ #include "Strategic Status.h" #endif - // the max loyalty rating for any given town #define MAX_LOYALTY_VALUE 100 @@ -100,7 +99,7 @@ // THESE VALUES ARE ALL AFFECTED BY CHANGES to "GAIN_PTS_PER_LOYALTY_PT", SO BEWARE IF THAT SHOULD CHANGE -/* Delayed loyalty effects elimininated. Sep.12/98. ARM +/* Delayed loyalty effects elimininated. Sep.12/98. ARM // macros for delayed town loyalty events // get increment @@ -117,8 +116,8 @@ TOWN_LOYALTY gTownLoyalty[ MAX_TOWNS ]; // town name and locations arrays, for town theft and what not -INT32 pTownNamesList [ MAX_TOWN_SECTORS ]; -INT32 pTownLocationsList [ MAX_TOWN_SECTORS ]; +INT32 pTownNamesList [ MAX_TOWN_SECTORS ]; +INT32 pTownLocationsList [ MAX_TOWN_SECTORS ]; INT32 iTownDistances[ MAX_TOWNS ][ MAX_TOWNS ]; @@ -127,14 +126,14 @@ INT32 iTownDistances[ MAX_TOWNS ][ MAX_TOWNS ]; UINT32 uiPercentLoyaltyDecreaseForCivMurder[]={ // These get multiplied by GAIN_PTS_PER_LOYALTY_PT so they're in % of loyalty decrease (for an average town) - (5 * GAIN_PTS_PER_LOYALTY_PT), // fat civ - (7 * GAIN_PTS_PER_LOYALTY_PT), // man civ - (8 * GAIN_PTS_PER_LOYALTY_PT), // min civ - (10 * GAIN_PTS_PER_LOYALTY_PT), // dress (woman) - (20 * GAIN_PTS_PER_LOYALTY_PT), // hat kid - (20 * GAIN_PTS_PER_LOYALTY_PT), // kid - (20 * GAIN_PTS_PER_LOYALTY_PT), // cripple - (1 * GAIN_PTS_PER_LOYALTY_PT), // cow + (5 * GAIN_PTS_PER_LOYALTY_PT), // fat civ + (7 * GAIN_PTS_PER_LOYALTY_PT), // man civ + (8 * GAIN_PTS_PER_LOYALTY_PT), // min civ + (10 * GAIN_PTS_PER_LOYALTY_PT), // dress (woman) + (20 * GAIN_PTS_PER_LOYALTY_PT), // hat kid + (20 * GAIN_PTS_PER_LOYALTY_PT), // kid + (20 * GAIN_PTS_PER_LOYALTY_PT), // cripple + (1 * GAIN_PTS_PER_LOYALTY_PT), // cow }; @@ -177,9 +176,6 @@ BOOLEAN gfTownUsesLoyalty[ MAX_TOWNS ];// = // location of first enocunter with enemy INT16 sWorldSectorLocationOfFirstBattle = 0; -// number of items in currently loaded sector -extern UINT32 guiNumWorldItems; - // preprocess sector for mercs in it extern BOOLEAN fSectorsWithSoldiers[ MAP_WORLD_X * MAP_WORLD_X ][ 4 ]; @@ -199,7 +195,7 @@ void UpdateTownLoyaltyBasedOnFriendliesInTown( INT8 bTownId ); // update town loyalty based on number of bad guys in this town void UpdateTownLoyaltyBasedOnBadGuysInTown( INT8 bTownId ); - + /* ARM: Civilian theft of items was removed // handle theft by civi in a town sector void HandleTheftByCiviliansInSector( INT16 sX, INT16 sY, INT32 iLoyalty ); @@ -245,7 +241,7 @@ void StartTownLoyaltyIfFirstTime( INT8 bTownId ) if (bTownId == OMERTA) { // start loyalty there at 0, since rebels distrust the player until Miguel receives the letter - gTownLoyalty[ bTownId ].ubRating = 0; + gTownLoyalty[ bTownId ].ubRating = 0; } else { @@ -435,7 +431,6 @@ void UpdateTownLoyaltyRating( INT8 bTownId ) // strategic handler, goes through and handles all strategic events for town loyalty updates...player controlled, monsters void HandleTownLoyalty( void ) { - INT8 bTownId = 0; /* ARM: removed to experiment with keeping loyalty from drifing without any direct causes from the player for( bTownId = FIRST_TOWN; bTownId < NUM_TOWNS; bTownId++ ) @@ -473,7 +468,7 @@ void HandleTownLoyalty( void ) // update of town loyalty based on if the player controls the town's sectors void UpdateLoyaltyBasedOnControl( INT8 bTownId ) { - // compare current loyalty to percent of sectors controlled, adjust in that direction + // compare current loyalty to percent of sectors controlled, adjust in that direction INT32 iUnderControl = 0; Assert( ( bTownId >= FIRST_TOWN ) && ( bTownId < NUM_TOWNS ) ); @@ -481,8 +476,8 @@ void UpdateLoyaltyBasedOnControl( INT8 bTownId ) // find how much of town is under control iUnderControl = GetTownSectorsUnderControl( bTownId ); iUnderControl *= 100; - iUnderControl /= GetTownSectorSize( bTownId ); - + iUnderControl /= GetTownSectorSize( bTownId ); + // the gain value will be the difference in iUnderControl and the current Loyalty rating / hours_per_day if( gTownLoyalty[ bTownId ].ubRating < ( UINT8 ) iUnderControl ) { @@ -497,13 +492,13 @@ void UpdateLoyaltyBasedOnControl( INT8 bTownId ) // we control less of the town, decrement gain DecrementTownLoyalty( bTownId, gTownLoyalty[ bTownId ].ubRating - iUnderControl ); } - } + } return; } -// updates the loyalty of the town in a sector based on number of friendly troops in that sector ...to a point, after max number to +// updates the loyalty of the town in a sector based on number of friendly troops in that sector ...to a point, after max number to void UpdateTownLoyaltyBasedOnFriendliesInTown( INT8 bTownId ) { // check if valid town @@ -521,17 +516,17 @@ void UpdateTownLoyaltyBasedOnFriendliesInTown( INT8 bTownId ) // find how much of town is under control iUnderControl = GetTownSectorsUnderControl( bTownId ); iUnderControl *= 100; - iUnderControl /= GetTownSectorSize( bTownId ); + iUnderControl /= GetTownSectorSize( bTownId ); // count how many of player's mercs are active in this town, then factor by number of sectors under control // run through list of grunts on team - for (iCounter = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; iCounter <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; iCounter++ ) + for (iCounter = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; iCounter <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; iCounter++ ) { pSoldier = MercPtrs[ iCounter ]; - if ( pSoldier->bLife >= OKLIFE && pSoldier->bActive ) + if ( pSoldier->stats.bLife >= OKLIFE && pSoldier->bActive ) { // if soldier is in this sector if( SectorIsPartOfTown( bTownId, pSoldier->sSectorX, pSoldier->sSectorY ) == TRUE ) @@ -542,11 +537,11 @@ void UpdateTownLoyaltyBasedOnFriendliesInTown( INT8 bTownId ) // increment soldier count iSoldierCount++; } - + // local influence: if the town is the character's home town if( bTownId == gMercProfiles[ pSoldier->ubProfile ].bTown ) { - // he needn't be soldiering to have an impact... presence is enough + // he needn't be soldiering to have an impact... presence is enough if( pSoldier->bAssignment < ASSIGNMENT_DEAD ) { iLocalNPCBonus = HOURLY_GAIN_FOR_LOCAL_NPC_IN_TOWN; @@ -637,7 +632,7 @@ void UpdateTownLoyaltyBasedOnBadGuysInTown( INT8 bTownId ) // regulars iTotalEnemies += ( INT32 ) ubRegs * NUMBER_OF_RANKS_PER_REGULAR; // elites - iTotalEnemies += ( INT32 ) ubElites * NUMBER_OF_RANKS_PER_ELITE; + iTotalEnemies += ( INT32 ) ubElites * NUMBER_OF_RANKS_PER_ELITE; } } } @@ -646,7 +641,7 @@ void UpdateTownLoyaltyBasedOnBadGuysInTown( INT8 bTownId ) // check vs. maximum influence possible if( iTotalEnemies > MAX_ENEMY_SOLDIER_RANKS_FOR_IN_TOWN_LOYALTY_DROP ) { - // we have, adjust + // we have, adjust iTotalEnemies = MAX_ENEMY_SOLDIER_RANKS_FOR_IN_TOWN_LOYALTY_DROP; } @@ -654,7 +649,7 @@ void UpdateTownLoyaltyBasedOnBadGuysInTown( INT8 bTownId ) // find how much of town is under enemy control iUnderControl = GetTownSectorSize( bTownId ) - GetTownSectorsUnderControl( bTownId ); iUnderControl *= 100; - iUnderControl /= GetTownSectorSize( bTownId ); + iUnderControl /= GetTownSectorSize( bTownId ); // adjust number of enemies for town control iTotalEnemies *= iUnderControl; @@ -669,7 +664,7 @@ void UpdateTownLoyaltyBasedOnBadGuysInTown( INT8 bTownId ) void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional ) { - // handle the impact on loyalty of the murder of a civilian + // handle the impact on loyalty of the murder of a civilian INT8 bTownId = 0; INT32 iLoyaltyChange = 0; INT8 bSeenState = 0; @@ -678,11 +673,9 @@ void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional ) UINT32 uiChanceFalseAccusal = 0; INT8 bKillerTeam = 0; BOOLEAN fIncrement = FALSE; - UINT32 uiLoyaltyEffectDelay = 0; - UINT32 uiValue = 0; - // ubAttacker CAN be NOBODY... Don't treat is as murder if NOBODY killed us... + // ubAttacker CAN be NOBODY... Don't treat is as murder if NOBODY killed us... if ( pSoldier->ubAttackerID == NOBODY ) { return; @@ -789,7 +782,7 @@ void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional ) { bSeenState |= 2; } - } + } // if player didn't do it if( bKillerTeam != OUR_TEAM ) @@ -798,7 +791,7 @@ void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional ) switch (bSeenState) { case 0: - // nobody saw anything. When body is found, chance player is blamed depends on the town's loyalty at this time + // nobody saw anything. When body is found, chance player is blamed depends on the town's loyalty at this time uiChanceFalseAccusal = MAX_LOYALTY_VALUE - gTownLoyalty[ bTownId ].ubRating; break; case 1: @@ -806,7 +799,7 @@ void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional ) uiChanceFalseAccusal = 10; break; case 2: - // civilians only saw the victim. 50/50 chance... + // civilians only saw the victim. 50/50 chance... uiChanceFalseAccusal = 50; break; case 3: @@ -833,7 +826,7 @@ void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional ) } } - + // check who town thinks killed the civ switch (bKillerTeam) { @@ -844,12 +837,12 @@ void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional ) // debug message ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Civilian killed by friendly forces."); break; - + case ENEMY_TEAM: // check whose sector this is - if( StrategicMap[( pSoldier -> sSectorX ) + ( MAP_WORLD_X * ( pSoldier -> sSectorY ) )].fEnemyControlled == TRUE ) + if( StrategicMap[( pSoldier->sSectorX ) + ( MAP_WORLD_X * ( pSoldier->sSectorY ) )].fEnemyControlled == TRUE ) { - // enemy soldiers... in enemy controlled sector. Gain loyalty + // enemy soldiers... in enemy controlled sector. Gain loyalty fIncrement = TRUE; // debug message @@ -893,7 +886,7 @@ void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional ) iLoyaltyChange *= MULTIPLIER_FOR_MURDER_BY_MONSTER; // check whose sector this is - if( StrategicMap[( pSoldier -> sSectorX ) + ( MAP_WORLD_X * ( pSoldier -> sSectorY ) )].fEnemyControlled == TRUE ) + if( StrategicMap[( pSoldier->sSectorX ) + ( MAP_WORLD_X * ( pSoldier->sSectorY ) )].fEnemyControlled == TRUE ) { // enemy controlled sector - gain loyalty fIncrement = TRUE; @@ -912,11 +905,11 @@ void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional ) } -/* Delayed loyalty effects elimininated. Sep.12/98. ARM +/* Delayed loyalty effects elimininated. Sep.12/98. ARM // figure out how long before the news of the murder spreads and lowers town loyalty if (bSeenState == 0) { - // nobody saw nothing. Will be some time before the grisly remains are discovered... + // nobody saw nothing. Will be some time before the grisly remains are discovered... uiLoyaltyEffectDelay = 60 * (1 + Random(12)); // 1-12 hrs in minutes } else @@ -957,12 +950,11 @@ void HandleTownLoyaltyForNPCRecruitment( SOLDIERTYPE *pSoldier ) { INT8 bTownId = 0; UINT32 uiLoyaltyValue = 0; - INT32 iRating = 0; // get town id civilian bTownId = GetTownIdForSector( pSoldier->sSectorX, pSoldier->sSectorY ); - // is the merc currently in their home town? + // is the merc currently in their home town? if( bTownId == gMercProfiles[ pSoldier->ubProfile ].bTown ) { // yep, value of loyalty bonus depends on his importance to this to town @@ -972,7 +964,7 @@ void HandleTownLoyaltyForNPCRecruitment( SOLDIERTYPE *pSoldier ) IncrementTownLoyalty( bTownId, uiLoyaltyValue ); // DESIGN QUESTION: How easy is it to abuse this bonus by repeatedly hiring the guy over & over - // (at worst daily? even more often if terminated & rehired?) (ARM) + // (at worst daily? even more often if terminated & rehired?) (ARM) } return; @@ -992,12 +984,12 @@ BOOLEAN HandleLoyaltyAdjustmentForRobbery( SOLDIERTYPE *pSoldier ) INT8 bTownId = 0; - // get town id + // get town id bTownId = GetTownIdForSector( pSoldier->sSectorX, pSoldier->sSectorY ); // debug message - ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Theft not yet implemented."); + ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Theft not yet implemented."); return ( FALSE ); */ @@ -1020,9 +1012,9 @@ void HandleLoyaltyForDemolitionOfBuilding( SOLDIERTYPE *pSoldier, INT16 sPointsD // penalty for not preventing the action sPolicingLoyalty = sPointsDmg * MULTIPLIER_FOR_NOT_PREVENTING_BUILDING_DAMAGE; - // get town id + // get town id bTownId = GetTownIdForSector( pSoldier->sSectorX, pSoldier->sSectorY ); - + // penalize the side that did it if( pSoldier->bTeam == OUR_TEAM ) { @@ -1091,12 +1083,12 @@ void RemoveRandomItemsInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, return; } - pItemList = (WORLDITEM *) MemAlloc( sizeof( WORLDITEM ) * uiNumberOfItems ); + pItemList = new WORLDITEM[ uiNumberOfItems ]; // now load items LoadWorldItemsFromTempItemFile( sSectorX, sSectorY, ( UINT8 )sSectorZ, pItemList ); uiNewTotal = uiNumberOfItems; - + // set up item list ptrs for( iCounter = 0; iCounter < uiNumberOfItems ; iCounter++ ) { @@ -1110,7 +1102,7 @@ void RemoveRandomItemsInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, pItemList[ iCounter ].fExists = FALSE; // debug message - ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"%s stolen in %s!", ItemNames[ pItemList[ iCounter ].o.usItem ], wSectorName ); + ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"%s stolen in %s!", ItemNames[ pItemList[ iCounter ].object.usItem ], wSectorName ); } } } @@ -1122,7 +1114,7 @@ void RemoveRandomItemsInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, } // mem free - MemFree( pItemList ); + delete[]( pItemList ); } else // handle a loaded sector { @@ -1135,7 +1127,7 @@ void RemoveRandomItemsInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, { RemoveItemFromPool( gWorldItems[ iCounter ].sGridNo , iCounter, gWorldItems[ iCounter ].ubLevel ); // debug message - ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"%s stolen in %s!", ItemNames[ gWorldItems[ iCounter ].o.usItem ], wSectorName ); + ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"%s stolen in %s!", ItemNames[ gWorldItems[ iCounter ].object.usItem ], wSectorName ); } } } @@ -1179,10 +1171,10 @@ void HandleTownTheft( void ) InitSectorsWithSoldiersList( ); // build list - BuildSectorsWithSoldiersList( ); + BuildSectorsWithSoldiersList( ); while( pTownNamesList[ iCounter ] != 0 ) - { + { ubTown = StrategicMap[ pTownLocationsList[ iCounter ] ].bNameId; // if this town tracks loyalty, and tracking has started @@ -1221,7 +1213,7 @@ void BuildListOfTownSectors( void ) { pTownNamesList[ iCounter] = StrategicMap[ usSector ].bNameId; pTownLocationsList[ iCounter ] = usSector; - + iCounter++; } } @@ -1280,11 +1272,11 @@ void CalcDistancesBetweenTowns( void ) // same town, distance is 0 by definition iDistance = 0; } - + // if it's the fastest route so far, store its length if( iDistance < iTownDistances[ ubTownA ][ ubTownB ] ) { - // store it going both ways! The inner while loop is optimized to search each pair only once. + // store it going both ways! The inner while loop is optimized to search each pair only once. iTownDistances[ ubTownA ][ ubTownB ] = iDistance; iTownDistances[ ubTownB ][ ubTownA ] = iDistance; } @@ -1306,10 +1298,10 @@ void WriteOutDistancesBetweenTowns( void ) hFileHandle = FileOpen( "BinaryData\\TownDistances.dat", FILE_ACCESS_WRITE|FILE_OPEN_ALWAYS, FALSE ); - FileWrite( hFileHandle, &( iTownDistances ), ( sizeof( INT32 ) * MAX_TOWNS * MAX_TOWNS ), NULL ); + FileWrite( hFileHandle, &( iTownDistances ), ( sizeof( INT32 ) * MAX_TOWNS * MAX_TOWNS ), NULL ); // close file - FileClose( hFileHandle ); + FileClose( hFileHandle ); return; } @@ -1317,35 +1309,35 @@ void WriteOutDistancesBetweenTowns( void ) void DumpDistancesBetweenTowns(void) { - CHAR8 zPrintFileName[60]; - FILE *FDump; + CHAR8 zPrintFileName[60]; + FILE *FDump; UINT8 ubTownA, ubTownB; CHAR16 wHeading[4]; - // open output file + // open output file strcpy(zPrintFileName, "TownDistances.txt"); - FDump = fopen(zPrintFileName, "wt"); + FDump = fopen(zPrintFileName, "wt"); - if (FDump == NULL) - { - return; - } + if (FDump == NULL) + { + return; + } // print headings - fprintf(FDump, " "); + fprintf(FDump, " "); for( ubTownB = FIRST_TOWN; ubTownB < NUM_TOWNS; ubTownB++ ) { wcsncpy(wHeading, pTownNames[ubTownB], 3); wHeading[3] = '\0'; - fprintf(FDump, " %ls", wHeading); + fprintf(FDump, " %ls", wHeading); } fprintf(FDump, "\n"); - fprintf(FDump, " "); + fprintf(FDump, " "); for( ubTownB = FIRST_TOWN; ubTownB < NUM_TOWNS; ubTownB++ ) { - fprintf(FDump, " ---"); + fprintf(FDump, " ---"); } fprintf(FDump, "\n"); @@ -1361,7 +1353,7 @@ void DumpDistancesBetweenTowns(void) fprintf(FDump, "\n"); } - fclose(FDump); + fclose(FDump); } //#endif @@ -1371,10 +1363,10 @@ void ReadInDistancesBetweenTowns( void ) hFileHandle = FileOpen( "BinaryData\\TownDistances.dat", FILE_ACCESS_READ, FALSE ); - FileRead( hFileHandle, &( iTownDistances ), ( sizeof( INT32 ) * MAX_TOWNS * MAX_TOWNS ), NULL ); + FileRead( hFileHandle, &( iTownDistances ), ( sizeof( INT32 ) * MAX_TOWNS * MAX_TOWNS ), NULL ); // close file - FileClose( hFileHandle ); + FileClose( hFileHandle ); return; } @@ -1386,7 +1378,7 @@ INT32 GetTownDistances( UINT8 ubTown, UINT8 ubTownA ) } -/* Delayed loyalty effects elimininated. Sep.12/98. ARM +/* Delayed loyalty effects elimininated. Sep.12/98. ARM void HandleDelayedTownLoyaltyEvent( UINT32 uiValue ) { INT8 bTownId = 0; @@ -1417,7 +1409,7 @@ void HandleDelayedTownLoyaltyEvent( UINT32 uiValue ) UINT32 BuildLoyaltyEventValue( INT8 bTownValue, UINT32 uiValue, BOOLEAN fIncrement ) { - UINT32 uiReturnValue = 0; + UINT32 uiReturnValue = 0; UINT32 uiTempValue = 0; // the town name in 8 most sig bits @@ -1425,14 +1417,14 @@ UINT32 BuildLoyaltyEventValue( INT8 bTownValue, UINT32 uiValue, BOOLEAN fIncreme uiReturnValue += ( uiTempValue << 24 ); - // the incrment decrement amount is + // the incrment decrement amount is uiTempValue = ( UINT32 )( uiValue ); uiTempValue = ( ( uiTempValue << 8 ) >> 7 ); uiReturnValue += uiTempValue; uiReturnValue += ( fIncrement != 0 ? 1: 0 ); - + return( uiReturnValue ); } */ @@ -1487,7 +1479,7 @@ void ReduceLoyaltyForRebelsBetrayed(void) } else { - + // loyalty in other places is also strongly affected by this falling out with rebels, but this is not permanent SetTownLoyalty(bTownId, (UINT8) (gTownLoyalty[ bTownId ].ubRating / 3)); } @@ -1498,7 +1490,7 @@ INT32 GetNumberOfWholeTownsUnderControl( void ) { INT32 iNumber = 0; INT8 bTownId = 0; - + // run through the list of towns..if the entire town is under player control, then increment the number of towns under player control // make sure that each town is one for which loyalty matters @@ -1518,7 +1510,7 @@ INT32 GetNumberOfWholeTownsUnderControlButExcludeCity( INT8 bCityToExclude ) { INT32 iNumber = 0; INT8 bTownId = 0; - + // run through the list of towns..if the entire town is under player control, then increment the number of towns under player control for( bTownId = FIRST_TOWN; bTownId < NUM_TOWNS; bTownId++ ) { @@ -1534,8 +1526,6 @@ INT32 GetNumberOfWholeTownsUnderControlButExcludeCity( INT8 bCityToExclude ) // is the ENTIRE town under player control? INT32 IsTownUnderCompleteControlByPlayer( INT8 bTownId ) { - INT32 iNumber = 0; - if( GetTownSectorSize( bTownId ) == GetTownSectorsUnderControl( bTownId ) ) { return( TRUE ); @@ -1547,8 +1537,6 @@ INT32 IsTownUnderCompleteControlByPlayer( INT8 bTownId ) // is the ENTIRE town under enemy control? INT32 IsTownUnderCompleteControlByEnemy( INT8 bTownId ) { - INT32 iNumber = 0; - if ( GetTownSectorsUnderControl( bTownId ) == 0 ) { return( TRUE ); @@ -1624,7 +1612,7 @@ void HandleGlobalLoyaltyEvent( UINT8 ubEventType, INT16 sSectorX, INT16 sSectorY } // determine what the base loyalty change of this event type is worth - // these are ->hundredths<- of loyalty points, so choose appropriate values accordingly! + // these are->hundredths<- of loyalty points, so choose appropriate values accordingly! // the closer a town is to the event, the more pronounced the effect upon that town is switch (ubEventType) { @@ -1714,7 +1702,7 @@ void AffectAllTownsLoyaltyByDistanceFrom( INT32 iLoyaltyChange, INT16 sSectorX, // skip path test if distance is already known to be zero to speed this up a bit if (iShortestDistance[ bTownId ] > 0 ) { - // calculate across how many sectors the fastest travel path from event to this town sector + // calculate across how many sectors the fastest travel path from event to this town sector iThisDistance = FindStratPath( sEventSector, ( INT16 )pTownLocationsList[ uiIndex ], ubTempGroupId, FALSE ); if (iThisDistance < iShortestDistance[ bTownId ]) @@ -1737,7 +1725,7 @@ void AffectAllTownsLoyaltyByDistanceFrom( INT32 iLoyaltyChange, INT16 sSectorX, { continue; } - + // if event was underground, double effective distance if (bSectorZ != 0) { @@ -1828,7 +1816,7 @@ void CheckIfEntireTownHasBeenLiberated( INT8 bTownId, INT16 sSectorX, INT16 sSec void CheckIfEntireTownHasBeenLost( INT8 bTownId, INT16 sSectorX, INT16 sSectorY ) { - // NOTE: only towns which allow you to train militia are important enough to get + // NOTE: only towns which allow you to train militia are important enough to get // reported here (and they're the only ones you can protect) if ( MilitiaTrainingAllowedInSector( sSectorX, sSectorY, 0 ) && IsTownUnderCompleteControlByEnemy(bTownId) ) { @@ -1873,7 +1861,7 @@ void HandleLoyaltyChangeForNPCAction( UINT8 ubNPCProfileId ) case YANNI: // Chalice of Chance returned to Chitzena IncrementTownLoyalty( CHITZENA, LOYALTY_BONUS_YANNI_WHEN_CHALICE_RETURNED_LOCAL ); - // NOTE: This affects Chitzena,too, a second time, so first value is discounted for it + // NOTE: This affects Chitzena,too, a second time, so first value is discounted for it IncrementTownLoyaltyEverywhere( LOYALTY_BONUS_YANNI_WHEN_CHALICE_RETURNED_GLOBAL ); break; @@ -1910,7 +1898,7 @@ BOOLEAN DidFirstBattleTakePlaceInThisTown( INT8 bTownId ) // get town id for sector bTownBattleId = GetTownIdForSector( ( INT16 ) ( sWorldSectorLocationOfFirstBattle % MAP_WORLD_X ), ( INT16 ) ( sWorldSectorLocationOfFirstBattle / MAP_WORLD_X ) ); - + return( bTownId == bTownBattleId ); } @@ -1925,10 +1913,10 @@ UINT32 PlayerStrength( void ) pSoldier = MercPtrs[ ubLoop ]; if ( pSoldier->bActive ) { - if ( pSoldier->bInSector || ( pSoldier->fBetweenSectors && ((pSoldier->ubPrevSectorID % 16) + 1) == gWorldSectorX && ((pSoldier->ubPrevSectorID / 16) + 1) == gWorldSectorY && ( pSoldier->bSectorZ == gbWorldSectorZ ) ) ) + if ( pSoldier->bInSector || ( pSoldier->flags.fBetweenSectors && ((pSoldier->ubPrevSectorID % 16) + 1) == gWorldSectorX && ((pSoldier->ubPrevSectorID / 16) + 1) == gWorldSectorY && ( pSoldier->bSectorZ == gbWorldSectorZ ) ) ) { // count this person's strength (condition), calculated as life reduced up to half according to maxbreath - uiStrength = pSoldier->bLife * ( pSoldier->bBreathMax + 100 ) / 200; + uiStrength = pSoldier->stats.bLife * ( pSoldier->bBreathMax + 100 ) / 200; uiTotal += uiStrength; } } @@ -1945,10 +1933,10 @@ UINT32 EnemyStrength( void ) for ( ubLoop = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; ubLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ubLoop++ ) { pSoldier = MercPtrs[ ubLoop ]; - if ( pSoldier->bActive && pSoldier->bInSector && !pSoldier->bNeutral ) + if ( pSoldier->bActive && pSoldier->bInSector && !pSoldier->aiData.bNeutral ) { // count this person's strength (condition), calculated as life reduced up to half according to maxbreath - uiStrength = pSoldier->bLife * ( pSoldier->bBreathMax + 100 ) / 200; + uiStrength = pSoldier->stats.bLife * ( pSoldier->bBreathMax + 100 ) / 200; uiTotal += uiStrength; } } @@ -1956,7 +1944,7 @@ UINT32 EnemyStrength( void ) return( uiTotal ); } -//Function assumes that mercs have retreated already. Handles two cases, one for general merc retreat +//Function assumes that mercs have retreated already. Handles two cases, one for general merc retreat //which slightly demoralizes the mercs, the other handles abandonment of militia forces which poses //as a serious loyalty penalty. void HandleLoyaltyImplicationsOfMercRetreat( INT8 bRetreatCode, INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) @@ -1975,7 +1963,7 @@ void HandleLoyaltyImplicationsOfMercRetreat( INT8 bRetreatCode, INT16 sSectorX, HandleMoraleEvent( NULL, MORALE_RAN_AWAY, sSectorX, sSectorY, (INT8)sSectorZ ); } } - else + else { HandleMoraleEvent( NULL, MORALE_RAN_AWAY, sSectorX, sSectorY, (INT8)sSectorZ ); } diff --git a/Strategic/Strategic Town Loyalty.h b/Strategic/Strategic Town Loyalty.h index 0e7fbedb..2662ed44 100644 --- a/Strategic/Strategic Town Loyalty.h +++ b/Strategic/Strategic Town Loyalty.h @@ -49,7 +49,7 @@ typedef enum { - // There are only for distance-adjusted global loyalty effects. Others go into list above instead! + // There are only for distance-adjusted global loyalty effects. Others go into list above instead! GLOBAL_LOYALTY_BATTLE_WON, GLOBAL_LOYALTY_BATTLE_LOST, GLOBAL_LOYALTY_ENEMY_KILLED, @@ -72,7 +72,7 @@ typedef struct TOWN_LOYALTY UINT8 ubRating; INT16 sChange; BOOLEAN fStarted; // starting loyalty of each town is initialized only when player first enters that town - UINT8 UNUSEDubRebelSentiment; // current rebel sentiment. Events could change the starting value... + UINT8 UNUSEDubRebelSentiment; // current rebel sentiment. Events could change the starting value... BOOLEAN fLiberatedAlready; BYTE filler[19]; // reserved for expansion @@ -153,7 +153,7 @@ void BuildListOfTownSectors( void ); void ReadInDistancesBetweenTowns( void ); -/* Delayed loyalty effects elimininated. Sep.12/98. ARM +/* Delayed loyalty effects elimininated. Sep.12/98. ARM // delayed town loyalty event void HandleDelayedTownLoyaltyEvent( UINT32 uiValue ); // build loyalty event value @@ -187,13 +187,13 @@ void CheckIfEntireTownHasBeenLost( INT8 bTownId, INT16 sSectorX, INT16 sSectorY void HandleLoyaltyChangeForNPCAction( UINT8 ubNPCProfileId ); -BOOLEAN DidFirstBattleTakePlaceInThisTown( INT8 bTownId ); +BOOLEAN DidFirstBattleTakePlaceInThisTown( INT8 bTownId ); void SetTheFirstBattleSector( INT16 sSectorValue ); // gte number of whole towns but exclude this one INT32 GetNumberOfWholeTownsUnderControlButExcludeCity( INT8 bCityToExclude ); -//Function assumes that mercs have retreated already. Handles two cases, one for general merc retreat +//Function assumes that mercs have retreated already. Handles two cases, one for general merc retreat //which slightly demoralizes the mercs, the other handles abandonment of militia forces which poses //as a serious loyalty penalty. diff --git a/Strategic/Strategic Turns.cpp b/Strategic/Strategic Turns.cpp index b82cbea0..7943312b 100644 --- a/Strategic/Strategic Turns.cpp +++ b/Strategic/Strategic Turns.cpp @@ -40,8 +40,8 @@ void StrategicTurnsNewGame( ) void SyncStrategicTurnTimes( ) { - guiLastStrategicTime = GetWorldTotalSeconds( ); - guiLastTacticalRealTime = GetJA2Clock( ); + guiLastStrategicTime = GetWorldTotalSeconds( ); + guiLastTacticalRealTime = GetJA2Clock( ); } void HandleStrategicTurn( ) @@ -90,7 +90,7 @@ void HandleStrategicTurn( ) // OK, if we have compressed time...., adjust our check value to be faster.... if( giTimeCompressSpeeds[ giTimeCompressMode ] > 0 ) { - uiCheckTime = NUM_REAL_SEC_PER_TACTICAL_TURN / ( giTimeCompressSpeeds[ giTimeCompressMode ] * RT_COMPRESSION_TACTICAL_TURN_MODIFIER ); + uiCheckTime = NUM_REAL_SEC_PER_TACTICAL_TURN / ( giTimeCompressSpeeds[ giTimeCompressMode ] * RT_COMPRESSION_TACTICAL_TURN_MODIFIER ); } } @@ -110,4 +110,4 @@ void HandleStrategicTurnImplicationsOfExitingCombatMode( void ) { SyncStrategicTurnTimes(); HandleTacticalEndTurn( /*GetWorldTotalSeconds()*/ ); // doesn't take parameters -} \ No newline at end of file +} diff --git a/Strategic/Strategic_2005Express.vcproj b/Strategic/Strategic_2005Express.vcproj index 63a587ae..149c48ef 100644 --- a/Strategic/Strategic_2005Express.vcproj +++ b/Strategic/Strategic_2005Express.vcproj @@ -1,7 +1,7 @@ - + + + + + + + + + + + + + + + + + + diff --git a/Strategic/Town Militia.cpp b/Strategic/Town Militia.cpp index 17812a23..50f432e5 100644 --- a/Strategic/Town Militia.cpp +++ b/Strategic/Town Militia.cpp @@ -100,7 +100,6 @@ void VerifyTownTrainingIsPaidFor( void ); void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMapY ) { - SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); UINT8 ubMilitiaTrained = 0; BOOLEAN fFoundOne; INT16 sNeighbourX, sNeighbourY; @@ -121,7 +120,7 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa // force tactical to update militia status gfStrategicMilitiaChangesMade = FALSE; - // ok, so what do we do with all this training? Well, in order of decreasing priority: + // ok, so what do we do with all this training? Well, in order of decreasing priority: // 1) If there's room in training sector, create new GREEN militia guys there // 2) If not enough room there, create new GREEN militia guys in friendly sectors of the same town // 3) If not enough room anywhere in town, promote a number of GREENs in this sector into regulars @@ -133,8 +132,8 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa // If we're not training roaming militia, // then we will handle everything as normal. - if( (IsMilitiaTrainableFromSoldiersSectorMaxed( pTrainer, ELITE_MILITIA )) - && (gGameExternalOptions.gfmusttrainroaming) + if( (IsMilitiaTrainableFromSoldiersSectorMaxed( pTrainer, ELITE_MILITIA )) + && (gGameExternalOptions.gfmusttrainroaming) &&(GetWorldDay( ) >= gGameExternalOptions.guiAllowMilitiaGroupsDelay)) { CreateMilitiaSquads(sMapX, sMapY ); @@ -148,7 +147,6 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa { // great! Create a new GREEN militia guy in the training sector StrategicAddMilitiaToSector(sMapX, sMapY, GREEN_MILITIA, 1); - if (sMapX == gWorldSectorX && sMapY == gWorldSectorY) { gfStrategicMilitiaChangesMade = TRUE; @@ -185,7 +183,7 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa // if we still haven't been able to train anyone if (!fFoundOne) { - // alrighty, then. We'll have to *promote* guys instead. + // alrighty, then. We'll have to *promote* guys instead. // are there any GREEN militia men in the training sector itself? if (MilitiaInSectorOfRank(sMapX, sMapY, GREEN_MILITIA) > 0) @@ -200,7 +198,7 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa } else { - if( ubTownId != BLANK_SECTOR ) + if( ubTownId != BLANK_SECTOR ) { // dammit! Last chance - try to find other eligible sectors in the same town with a Green guy to be promoted InitFriendlyTownSectorServer(ubTownId, sMapX, sMapY); @@ -228,7 +226,7 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa // Kaiden: Veteran militia training // This is essentially copy/pasted from above // But the names have been changed to protect the innocent - if ((!fFoundOne) && (gGameExternalOptions.gfTrainVeteranMilitia) + if ((!fFoundOne) && (gGameExternalOptions.gfTrainVeteranMilitia) && (GetWorldDay( ) >= gGameExternalOptions.guiTrainVeteranMilitiaDelay)) { // are there any REGULAR militia men in the training sector itself? @@ -236,7 +234,6 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa { // great! Promote a REGULAR militia guy in the training sector to a VETERAN StrategicPromoteMilitiaInSector(sMapX, sMapY, REGULAR_MILITIA, 1); - if (sMapX == gWorldSectorX && sMapY == gWorldSectorY) { gfStrategicMilitiaChangesMade = TRUE; @@ -269,14 +266,14 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa break; } } - } + } } } // if we still haven't been able to train anyone if (!fFoundOne) { - // Well, that's it. All eligible sectors of this town are full of REGULARs or ELITEs. + // Well, that's it. All eligible sectors of this town are full of REGULARs or ELITEs. // The training goes to waste in this situation. break; // the main while loop } @@ -308,7 +305,7 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa } } - // the trainer announces to player that he's finished his assignment. Make his sector flash! + // the trainer announces to player that he's finished his assignment. Make his sector flash! AssignmentDone( pTrainer, TRUE, FALSE ); // handle completion of town by training group @@ -390,7 +387,7 @@ void StrategicPromoteMilitiaInSector(INT16 sMapX, INT16 sMapY, UINT8 ubCurrentRa return; } - pSectorInfo->ubNumberOfCivsAtLevel[ ubCurrentRank ] -= ubHowMany; + pSectorInfo->ubNumberOfCivsAtLevel[ ubCurrentRank ] -= ubHowMany; pSectorInfo->ubNumberOfCivsAtLevel[ ubCurrentRank + 1 ] += ubHowMany; if (ubHowMany && sMapX == gWorldSectorX && sMapY == gWorldSectorY ) @@ -507,10 +504,10 @@ void HandleMilitiaDefections(INT16 sMapX, INT16 sMapY) return; } - // roll the bones; should I stay or should I go now? (for you music fans out there) + // roll the bones; should I stay or should I go now? (for you music fans out there) if (Random(100) < uiChanceToDefect) { - //B'bye! (for you SNL fans out there) + //B'bye! (for you SNL fans out there) StrategicRemoveMilitiaFromSector(sMapX, sMapY, ubRank, 1); } } @@ -601,7 +598,7 @@ BOOLEAN ServeNextFriendlySectorInTown( INT16 *sNeighbourX, INT16 *sNeighbourY ) // if this sector is in the town we're looking for if( StrategicMap[ iTownSector ].bNameId == gubTownSectorServerTownId ) { - // A sector in the specified town. Calculate its X & Y sector compotents + // A sector in the specified town. Calculate its X & Y sector compotents sMapX = iTownSector % MAP_WORLD_X; sMapY = iTownSector / MAP_WORLD_X; @@ -650,31 +647,31 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia2"); // We want to charge more for Roaming // get total cost - if( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, ELITE_MILITIA ) + if( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, ELITE_MILITIA ) && (gGameExternalOptions.gfmusttrainroaming) && (GetWorldDay( ) >= gGameExternalOptions.guiAllowMilitiaGroupsDelay)) { - giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iMilitiaCostModifier) * iNumberOfSectors; + giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iMilitiaCostModifier) * iNumberOfSectors; Assert( giTotalCostOfTraining > 0 ); gfAreWeTrainingMobile = TRUE; } - else if (IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, REGULAR_MILITIA ) + else if (IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, REGULAR_MILITIA ) && (gGameExternalOptions.gfTrainVeteranMilitia) && (GetWorldDay( ) >= gGameExternalOptions.guiTrainVeteranMilitiaDelay)) { - giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iVeteranCostModifier) * iNumberOfSectors; + giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iVeteranCostModifier) * iNumberOfSectors; Assert( giTotalCostOfTraining > 0 ); gfAreWePromotingRegular = TRUE; } else if (IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, GREEN_MILITIA )) { - giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iRegularCostModifier) * iNumberOfSectors; + giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iRegularCostModifier) * iNumberOfSectors; Assert( giTotalCostOfTraining > 0 ); gfAreWePromotingGreen = TRUE; } else { - giTotalCostOfTraining = iMilitiaTrainingCost * iNumberOfSectors; + giTotalCostOfTraining = iMilitiaTrainingCost * iNumberOfSectors; Assert( giTotalCostOfTraining > 0 ); } @@ -780,7 +777,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia3"); { // wilderness SAM site GetSectorIDString( sSectorX, sSectorY, 0, sStringB, TRUE ); - void (*tempFptr)(INT16 , INT16 , INT8 , CHAR16 *, BOOLEAN) = GetSectorIDString; + void (*tempFptr)(INT16 , INT16 , INT8 , CHAR16 *, BOOLEAN) = GetSectorIDString; swprintf( sString, pMilitiaConfirmStrings[ 10 ], sStringB, tempFptr, iMinLoyaltyToTrain ); } else @@ -796,14 +793,14 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia3"); // Charging more to train Roaming Militia // Also Charging more for promotions over Training - if( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, ELITE_MILITIA ) + if( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, ELITE_MILITIA ) && (gGameExternalOptions.gfmusttrainroaming) &&(GetWorldDay( ) >= gGameExternalOptions.guiAllowMilitiaGroupsDelay)) { giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iMilitiaCostModifier); gfAreWeTrainingMobile = TRUE; } - else if (IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, REGULAR_MILITIA ) + else if (IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, REGULAR_MILITIA ) && (gGameExternalOptions.gfTrainVeteranMilitia) && (GetWorldDay( ) >= gGameExternalOptions.guiTrainVeteranMilitiaDelay)) { @@ -850,7 +847,7 @@ void PayMilitiaTrainingYesNoBoxCallback( UINT8 bExitValue ) Assert( giTotalCostOfTraining > 0 ); // yes - if( bExitValue == MSG_BOX_RETURN_YES ) + if( bExitValue == MSG_BOX_RETURN_YES ) { // does the player have enough if( LaptopSaveInfo.iCurrentBalance >= giTotalCostOfTraining ) @@ -991,7 +988,7 @@ BOOLEAN IsTownFullMilitia( INT8 bTownId, INT8 iMilitiaType ) BOOLEAN fIncreaseCost = FALSE; while( pTownNamesList[ iCounter ] != 0 ) - { + { if( pTownNamesList[ iCounter ] == bTownId ) { // get the sector x and y @@ -1001,7 +998,7 @@ BOOLEAN IsTownFullMilitia( INT8 bTownId, INT8 iMilitiaType ) // if sector is ours get number of militia here if( SectorOursAndPeaceful( sSectorX, sSectorY, 0 ) ) { - + //Kaiden: Checking for Price Hikes. if (iMilitiaType == GREEN_MILITIA) { @@ -1010,8 +1007,8 @@ BOOLEAN IsTownFullMilitia( INT8 bTownId, INT8 iMilitiaType ) iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, ELITE_MILITIA ); iMaxNumber += iMaxMilitiaPerSector; - if (MilitiaInSectorOfRank( sSectorX, sSectorY, GREEN_MILITIA ) > 0) - fIncreaseCost = TRUE; + if (MilitiaInSectorOfRank( sSectorX, sSectorY, GREEN_MILITIA ) > 0) + fIncreaseCost = TRUE; } else if (iMilitiaType == REGULAR_MILITIA) { @@ -1020,11 +1017,11 @@ BOOLEAN IsTownFullMilitia( INT8 bTownId, INT8 iMilitiaType ) iMaxNumber += iMaxMilitiaPerSector; if (MilitiaInSectorOfRank( sSectorX, sSectorY, REGULAR_MILITIA ) > 0) - fIncreaseCost = TRUE; + fIncreaseCost = TRUE; } - //Kaiden: OK So iMilitiaType should be ELITE_MILITIA - // and we're just checking sectors for purposes + //Kaiden: OK So iMilitiaType should be ELITE_MILITIA + // and we're just checking sectors for purposes // of training mobile militia or ending training // don't count GREEN militia, they can be trained into regulars first @@ -1050,7 +1047,7 @@ BOOLEAN IsTownFullMilitia( INT8 bTownId, INT8 iMilitiaType ) if (iMilitiaType == GREEN_MILITIA) { - if (( iNumberOfMilitia == iMaxNumber ) && (fIncreaseCost)) + if (( iNumberOfMilitia == iMaxNumber ) && (fIncreaseCost)) return( TRUE ); else return( FALSE ); @@ -1083,7 +1080,7 @@ BOOLEAN IsSAMSiteFullOfMilitia( INT16 sSectorX, INT16 sSectorY, INT8 iMilitiaTyp INT32 iMaxMilitiaPerSector = gGameExternalOptions.iMaxMilitiaPerSector; DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia5"); // check if SAM site is ours? - fSamSitePresent = IsThisSectorASAMSector( sSectorX, sSectorY, 0 ); + fSamSitePresent = IsThisSectorASAMSector( sSectorX, sSectorY, 0 ); if( fSamSitePresent == FALSE ) { @@ -1093,14 +1090,14 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia5"); if( SectorOursAndPeaceful( sSectorX, sSectorY, 0 ) ) { - //Kaiden: If we're checking for specific Militia for Price Hikes: + //Kaiden: If we're checking for specific Militia for Price Hikes: if (iMilitiaType == GREEN_MILITIA) { iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, GREEN_MILITIA ); iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, REGULAR_MILITIA ); iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, ELITE_MILITIA ); - if (( iNumberOfMilitia == iMaxMilitiaPerSector) && + if (( iNumberOfMilitia == iMaxMilitiaPerSector) && (MilitiaInSectorOfRank( sSectorX, sSectorY, GREEN_MILITIA ) > 0)) return( TRUE ); else @@ -1112,14 +1109,14 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia5"); iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, REGULAR_MILITIA ); iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, ELITE_MILITIA ); - if (( iNumberOfMilitia == iMaxMilitiaPerSector) && + if (( iNumberOfMilitia == iMaxMilitiaPerSector) && (MilitiaInSectorOfRank( sSectorX, sSectorY, REGULAR_MILITIA ) > 0)) return( TRUE ); else return( FALSE ); } - // Kaiden: Ok we're not checking for militia promotions now, - // so MilitiaType should be ELITE_MILITIA for purposes + // Kaiden: Ok we're not checking for militia promotions now, + // so MilitiaType should be ELITE_MILITIA for purposes // of training Roaming or not. // don't count GREEN militia, they can be trained into regulars first @@ -1209,7 +1206,7 @@ void AddSectorForSoldierToListOfSectorsThatCompletedMilitiaTraining( SOLDIERTYPE // get the current sector value sCurrentSector = pCurrentSoldier->sSectorX + pCurrentSoldier->sSectorY * MAP_WORLD_X; - + // is the merc's sector already in the list? if( sCurrentSector == sSector ) { @@ -1224,7 +1221,7 @@ void AddSectorForSoldierToListOfSectorsThatCompletedMilitiaTraining( SOLDIERTYPE // add merc to the list giListOfMercsInSectorsCompletedMilitiaTraining[ iCounter ] = pSoldier->ubID; - + return; } @@ -1271,18 +1268,18 @@ void HandleContinueOfTownTraining( void ) ClearSectorListForCompletedTrainingOfMilitia( ); if( fContinueEventPosted ) - { - // ATE: If this event happens in tactical mode we will be switching at some time to mapscreen... - if ( guiCurrentScreen == GAME_SCREEN ) - { - gfEnteringMapScreen = TRUE; - } + { + // ATE: If this event happens in tactical mode we will be switching at some time to mapscreen... + if ( guiCurrentScreen == GAME_SCREEN ) + { + gfEnteringMapScreen = TRUE; + } //If the militia view isn't currently active, then turn it on when prompting to continue training. if ( !fShowMilitia ) - { - ToggleShowMilitiaMode(); - } + { + ToggleShowMilitiaMode(); + } } return; @@ -1371,7 +1368,7 @@ INT32 GetNumberOfUnpaidTrainableSectors( void ) } } - // return the result + // return the result return( iNumberOfSectors ); } @@ -1463,14 +1460,14 @@ void ResetDoneFlagForAllMilitiaTrainersInSector( UINT8 ubSector ) for( iCounter = 0; iCounter <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; iCounter++ ) { pSoldier = &Menptr[ iCounter ]; - + if( pSoldier->bActive ) { if( pSoldier->bAssignment == TRAIN_TOWN ) { if( ( SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) == ubSector ) && ( pSoldier->bSectorZ == 0 ) ) { - pSoldier->fDoneAssignmentAndNothingToDoFlag = FALSE; + pSoldier->flags.fDoneAssignmentAndNothingToDoFlag = FALSE; pSoldier->usQuoteSaidExtFlags &= ~SOLDIER_QUOTE_SAID_DONE_ASSIGNMENT; } } @@ -1572,7 +1569,7 @@ void BuildMilitiaPromotionsString( STR16 str ) wcscat( str, gzLateLocalizedString[31] ); fAddSpace = TRUE; } - + //Clear the fields gbGreenToElitePromotions = 0; gbGreenToRegPromotions = 0; diff --git a/Strategic/XML_Army.cpp b/Strategic/XML_Army.cpp index 4fc318ba..f04dfb2a 100644 --- a/Strategic/XML_Army.cpp +++ b/Strategic/XML_Army.cpp @@ -45,7 +45,7 @@ typedef struct CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; garrisonInfo curGarrisonInfo; UINT32 uiGarrisonCount; - + UINT32 currentDepth; UINT32 maxReadDepth; } garrisonParseData; @@ -115,7 +115,7 @@ garrisonEndElementHandle(void *userData, const XML_Char *name) if ( pData->curGarrisonInfo.fValidSector && pData->uiGarrisonCount < MAX_GARRISON_GROUPS ) { - gOrigGarrisonGroup[ pData->uiGarrisonCount ].ubSectorID = pData->curGarrisonInfo.ubSectorID; + gOrigGarrisonGroup[ pData->uiGarrisonCount ].ubSectorID = pData->curGarrisonInfo.ubSectorID; gOrigGarrisonGroup[ pData->uiGarrisonCount ].ubComposition = pData->curGarrisonInfo.ubComposition; pData->uiGarrisonCount++; } @@ -127,10 +127,10 @@ garrisonEndElementHandle(void *userData, const XML_Char *name) y = (UINT8)pData->szCharData[0] & 0x1F; x = (UINT8)atol(&pData->szCharData[1]); - if ( x > 0 && x <= 16 && y > 0 && y <= 16 ) + if ( x > 0 && x <= 16 && y > 0 && y <= 16 ) { pData->curGarrisonInfo.fValidSector = TRUE; - pData->curGarrisonInfo.ubSectorID = SECTOR(x,y); + pData->curGarrisonInfo.ubSectorID = SECTOR(x,y); } else { @@ -155,7 +155,7 @@ BOOLEAN ReadInGarrisonInfo(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + garrisonParseData pData; @@ -163,7 +163,7 @@ BOOLEAN ReadInGarrisonInfo(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -178,16 +178,16 @@ BOOLEAN ReadInGarrisonInfo(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, garrisonStartElementHandle, garrisonEndElementHandle); XML_SetCharacterDataHandler(parser, garrisonCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); XML_SetUserData(parser, &pData); iOrigGarrisonArraySize = 0; - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -209,11 +209,11 @@ BOOLEAN ReadInGarrisonInfo(STR fileName) BOOLEAN WriteInGarrisonInfo(STR fileName) { HWFILE hFile; - + hFile = FileOpen( fileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { INT8 cnt; @@ -270,7 +270,7 @@ typedef struct CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; patrolInfo curPatrolInfo; UINT32 uiPatrolCount; - + UINT32 currentDepth; UINT32 maxReadDepth; } patrolParseData; @@ -365,8 +365,8 @@ patrolEndElementHandle(void *userData, const XML_Char *name) if ( !pData->curPatrolInfo.fErrorState && pData->uiPatrolCount < MAX_PATROL_GROUPS ) { - gOrigPatrolGroup[ pData->uiPatrolCount ].bSize = pData->curPatrolInfo.bSize; - gOrigPatrolGroup[ pData->uiPatrolCount ].bPriority = pData->curPatrolInfo.bPriority; + gOrigPatrolGroup[ pData->uiPatrolCount ].bSize = pData->curPatrolInfo.bSize; + gOrigPatrolGroup[ pData->uiPatrolCount ].bPriority = pData->curPatrolInfo.bPriority; gOrigPatrolGroup[ pData->uiPatrolCount ].ubSectorID[0] = pData->curPatrolInfo.ubSectorID[0]; gOrigPatrolGroup[ pData->uiPatrolCount ].ubSectorID[1] = pData->curPatrolInfo.ubSectorID[1]; gOrigPatrolGroup[ pData->uiPatrolCount ].ubSectorID[2] = pData->curPatrolInfo.ubSectorID[2]; @@ -406,7 +406,7 @@ patrolEndElementHandle(void *userData, const XML_Char *name) UINT8 x, y; y = (UINT8)pData->szCharData[0] & 0x1F; x = (UINT8)atol(&pData->szCharData[1]); - if ( x > 0 && x <= 16 && y > 0 && y <= 16 ) + if ( x > 0 && x <= 16 && y > 0 && y <= 16 ) { pData->curPatrolInfo.ubSectorID[0] = SECTOR(x,y); } @@ -429,7 +429,7 @@ patrolEndElementHandle(void *userData, const XML_Char *name) UINT8 x, y; y = (UINT8)pData->szCharData[0] & 0x1F; x = (UINT8)atol(&pData->szCharData[1]); - if ( x > 0 && x <= 16 && y > 0 && y <= 16 ) + if ( x > 0 && x <= 16 && y > 0 && y <= 16 ) { pData->curPatrolInfo.ubSectorID[1] = SECTOR(x,y); } @@ -452,7 +452,7 @@ patrolEndElementHandle(void *userData, const XML_Char *name) UINT8 x, y; y = (UINT8)pData->szCharData[0] & 0x1F; x = (UINT8)atol(&pData->szCharData[1]); - if ( x > 0 && x <= 16 && y > 0 && y <= 16 ) + if ( x > 0 && x <= 16 && y > 0 && y <= 16 ) { pData->curPatrolInfo.ubSectorID[2] = SECTOR(x,y); } @@ -475,7 +475,7 @@ patrolEndElementHandle(void *userData, const XML_Char *name) UINT8 x, y; y = (UINT8)pData->szCharData[0] & 0x1F; x = (UINT8)atol(&pData->szCharData[1]); - if ( x > 0 && x <= 16 && y > 0 && y <= 16 ) + if ( x > 0 && x <= 16 && y > 0 && y <= 16 ) { pData->curPatrolInfo.ubSectorID[3] = SECTOR(x,y); } @@ -499,7 +499,7 @@ BOOLEAN ReadInPatrolInfo(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + patrolParseData pData; @@ -507,7 +507,7 @@ BOOLEAN ReadInPatrolInfo(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -522,16 +522,16 @@ BOOLEAN ReadInPatrolInfo(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, patrolStartElementHandle, patrolEndElementHandle); XML_SetCharacterDataHandler(parser, patrolCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); XML_SetUserData(parser, &pData); iOrigPatrolArraySize = 0; - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -553,11 +553,11 @@ BOOLEAN ReadInPatrolInfo(STR fileName) BOOLEAN WriteInPatrolInfo(STR fileName) { HWFILE hFile; - + hFile = FileOpen( fileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { INT8 cnt, i; @@ -620,12 +620,12 @@ typedef enum typedef struct { INT32 iIndex; - INT8 bPriority; - INT8 bElitePercentage; - INT8 bTroopPercentage; - INT8 bAdminPercentage; - INT8 bDesiredPopulation; - INT8 bStartPopulation; + INT8 bPriority; + INT8 bElitePercentage; + INT8 bTroopPercentage; + INT8 bAdminPercentage; + INT8 bDesiredPopulation; + INT8 bStartPopulation; } compositionInfo; typedef struct @@ -635,7 +635,7 @@ typedef struct CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; compositionInfo curCompositionInfo; INT32 iHighestIndex; - + UINT32 currentDepth; UINT32 maxReadDepth; } compositionParseData; @@ -730,13 +730,13 @@ compositionEndElementHandle(void *userData, const XML_Char *name) if ( pData->curCompositionInfo.iIndex < MAX_ARMY_COMPOSITIONS ) { - gOrigArmyComp[ pData->curCompositionInfo.iIndex ].iReadability = pData->curCompositionInfo.iIndex; - gOrigArmyComp[ pData->curCompositionInfo.iIndex ].bPriority = pData->curCompositionInfo.bPriority; - gOrigArmyComp[ pData->curCompositionInfo.iIndex ].bElitePercentage = pData->curCompositionInfo.bElitePercentage; - gOrigArmyComp[ pData->curCompositionInfo.iIndex ].bTroopPercentage = pData->curCompositionInfo.bTroopPercentage; - gOrigArmyComp[ pData->curCompositionInfo.iIndex ].bAdminPercentage = pData->curCompositionInfo.bAdminPercentage; + gOrigArmyComp[ pData->curCompositionInfo.iIndex ].iReadability = pData->curCompositionInfo.iIndex; + gOrigArmyComp[ pData->curCompositionInfo.iIndex ].bPriority = pData->curCompositionInfo.bPriority; + gOrigArmyComp[ pData->curCompositionInfo.iIndex ].bElitePercentage = pData->curCompositionInfo.bElitePercentage; + gOrigArmyComp[ pData->curCompositionInfo.iIndex ].bTroopPercentage = pData->curCompositionInfo.bTroopPercentage; + gOrigArmyComp[ pData->curCompositionInfo.iIndex ].bAdminPercentage = pData->curCompositionInfo.bAdminPercentage; gOrigArmyComp[ pData->curCompositionInfo.iIndex ].bDesiredPopulation = pData->curCompositionInfo.bDesiredPopulation; - gOrigArmyComp[ pData->curCompositionInfo.iIndex ].bStartPopulation = pData->curCompositionInfo.bStartPopulation; + gOrigArmyComp[ pData->curCompositionInfo.iIndex ].bStartPopulation = pData->curCompositionInfo.bStartPopulation; } } else if(strcmp(name, "Index") == 0 && pData->curElement == COMPOSITION_ELEMENT_INDEX) @@ -814,14 +814,14 @@ BOOLEAN ReadInArmyCompositionInfo(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + compositionParseData pData; // Open weapons file hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -836,16 +836,16 @@ BOOLEAN ReadInArmyCompositionInfo(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, compositionStartElementHandle, compositionEndElementHandle); XML_SetCharacterDataHandler(parser, compositionCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); XML_SetUserData(parser, &pData); NUM_ARMY_COMPOSITIONS = 0; - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -867,11 +867,11 @@ BOOLEAN ReadInArmyCompositionInfo(STR fileName) BOOLEAN WriteInArmyCompositionInfo(STR fileName) { HWFILE hFile; - + hFile = FileOpen( fileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { INT8 cnt; @@ -905,3 +905,4 @@ BOOLEAN WriteInArmyCompositionInfo(STR fileName) } + diff --git a/Strategic/XML_Roaming.cpp b/Strategic/XML_Roaming.cpp index cb6aeaef..3485b26f 100644 --- a/Strategic/XML_Roaming.cpp +++ b/Strategic/XML_Roaming.cpp @@ -15,7 +15,7 @@ #define MAX_CHAR_DATA_LENGTH 500 -extern INT32 iRestrictedSectorArraySize; +extern INT32 iRestrictedSectorArraySize; extern UINT32 gRestrictMilitia[256]; @@ -105,10 +105,10 @@ RoamingEndElementHandle(void *userData, const XML_Char *name) y = (UINT8)pData->szCharData[0] & 0x1F; x = (UINT8)atol(&pData->szCharData[1]); - if ( x > 0 && x <= 16 && y > 0 && y <= 16 ) + if ( x > 0 && x <= 16 && y > 0 && y <= 16 ) { pData->curRoamingInfo.fValidSector = TRUE; - pData->curRoamingInfo.ubSectorID = SECTOR(x,y); + pData->curRoamingInfo.ubSectorID = SECTOR(x,y); gRestrictMilitia[pData->uiSectorCount] = pData->curRoamingInfo.ubSectorID; pData->uiSectorCount++; } @@ -131,13 +131,13 @@ BOOLEAN ReadInRoamingInfo(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + RoamingParseData pData; hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -152,16 +152,16 @@ BOOLEAN ReadInRoamingInfo(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, RoamingStartElementHandle, RoamingEndElementHandle); XML_SetCharacterDataHandler(parser, RoamingCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); XML_SetUserData(parser, &pData); iRestrictedSectorArraySize = 0; - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; sprintf(errorBuf, "XML Parser Error in RestrictedRoamingMilitia.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); @@ -176,4 +176,4 @@ BOOLEAN ReadInRoamingInfo(STR fileName) XML_ParserFree(parser); return TRUE; -} \ No newline at end of file +} diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index c9ec3a13..1bf3ba2f 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -6,7 +6,7 @@ #include "mapscreen.h" #include #include - #include + #include #include "gameloop.h" #include "sgp.h" #include "vobject.h" @@ -110,6 +110,7 @@ #include "email.h" #include "Strategic Status.h" #include "Soldier Create.h" + #include "Animation Control.h" #endif @@ -147,198 +148,203 @@ #define MINS_TO_FLASH_CONTRACT_TIME (4 * 60) -// Coordinate defines +// CHRISL: Reclassify all coordinates as int variables and declare their values in an initialization function. +int TOWN_INFO_X; +int TOWN_INFO_Y; -#define TOWN_INFO_X 0 -#define TOWN_INFO_Y 1 - -#define PLAYER_INFO_X 0 -#define PLAYER_INFO_Y 107 +int PLAYER_INFO_X; +int PLAYER_INFO_Y; // item description -#define MAP_ITEMDESC_START_X 0 -#define MAP_ITEMDESC_START_Y PLAYER_INFO_Y +int MAP_ITEMDESC_START_X; +int MAP_ITEMDESC_START_Y; -#define INV_REGION_X PLAYER_INFO_X -#define INV_REGION_Y PLAYER_INFO_Y -#define INV_REGION_WIDTH 261 -#define INV_REGION_HEIGHT 359-94 -#define INV_BTN_X PLAYER_INFO_X + 217 -#define INV_BTN_Y PLAYER_INFO_Y + 210 +int INV_REGION_X; +int INV_REGION_Y; +int INV_REGION_WIDTH; +int INV_REGION_HEIGHT; +int INV_BTN_X; +int INV_BTN_Y; +int INV_BDROP_X; +int INV_BDROP_Y; -#define MAP_ARMOR_LABEL_X 208 -#define MAP_ARMOR_LABEL_Y 180 -#define MAP_ARMOR_X 209 -#define MAP_ARMOR_Y 189 -#define MAP_ARMOR_PERCENT_X 229 -#define MAP_ARMOR_PERCENT_Y 190 +int MAP_ARMOR_LABEL_X; +int MAP_ARMOR_LABEL_Y; +int MAP_ARMOR_X; +int MAP_ARMOR_Y; +int MAP_ARMOR_PERCENT_X; +int MAP_ARMOR_PERCENT_Y; -#define MAP_WEIGHT_LABEL_X 173 -#define MAP_WEIGHT_LABEL_Y 256 -#define MAP_WEIGHT_X 176 -#define MAP_WEIGHT_Y 266 -#define MAP_WEIGHT_PERCENT_X 196 -#define MAP_WEIGHT_PERCENT_Y 266 +int MAP_WEIGHT_LABEL_X; +int MAP_WEIGHT_LABEL_Y; +int MAP_WEIGHT_X; +int MAP_WEIGHT_Y; +int MAP_WEIGHT_PERCENT_X; +int MAP_WEIGHT_PERCENT_Y; -#define MAP_CAMMO_LABEL_X 178 -#define MAP_CAMMO_LABEL_Y 283 -#define MAP_CAMMO_X 176 -#define MAP_CAMMO_Y 292 -#define MAP_CAMMO_PERCENT_X 196 -#define MAP_CAMMO_PERCENT_Y 293 +int MAP_CAMMO_LABEL_X; +int MAP_CAMMO_LABEL_Y; +int MAP_CAMMO_X; +int MAP_CAMMO_Y; +int MAP_CAMMO_PERCENT_X; +int MAP_CAMMO_PERCENT_Y; -#define MAP_PERCENT_WIDTH 20 -#define MAP_PERCENT_HEIGHT 10 +int MAP_PERCENT_WIDTH; +int MAP_PERCENT_HEIGHT; -#define MAP_INV_STATS_TITLE_FONT_COLOR 6 -#define MAP_INV_STATS_TEXT_FONT_COLOR 5 +int MAP_INV_STATS_TITLE_FONT_COLOR; +int MAP_INV_STATS_TEXT_FONT_COLOR; -#define PLAYER_INFO_FACE_START_X 9 -#define PLAYER_INFO_FACE_START_Y 17 -#define PLAYER_INFO_FACE_END_X 60 -#define PLAYER_INFO_FACE_END_Y 76 +int PLAYER_INFO_FACE_START_X; +int PLAYER_INFO_FACE_START_Y; +int PLAYER_INFO_FACE_END_X; +int PLAYER_INFO_FACE_END_Y; -#define INV_BODY_X 71 -#define INV_BODY_Y 116 +int INV_BODY_X; +int INV_BODY_Y; -#define NAME_X 4 -#define NAME_WIDTH 55 - NAME_X +int NAME_X; +int NAME_WIDTH; -#define ASSIGN_X 60 -#define ASSIGN_WIDTH 111 - ASSIGN_X -#define SLEEP_X 116 -#define SLEEP_WIDTH 135 - SLEEP_X -#define LOC_X 140 -#define LOC_WIDTH 172 - LOC_X -#define DEST_ETA_X 177 -#define DEST_ETA_WIDTH 210 - DEST_ETA_X -#define TIME_REMAINING_X 215 -#define TIME_REMAINING_WIDTH 243 - TIME_REMAINING_X +int ASSIGN_X; +int ASSIGN_WIDTH; +int SLEEP_X; +int SLEEP_WIDTH; +int LOC_X; +int LOC_WIDTH; +int DEST_ETA_X; +int DEST_ETA_WIDTH; +int TIME_REMAINING_X; +int TIME_REMAINING_WIDTH; -#define CLOCK_Y_START (MAP_BORDER_Y_OFFSET + 298) // 298 +int CLOCK_Y_START; -#define DEST_PLOT_X (MAP_BORDER_X_OFFSET + 463) //463 -#define DEST_PLOT_Y (MAP_BORDER_Y_OFFSET + 345) //345 +int DEST_PLOT_X; +int DEST_PLOT_Y; -#define CLOCK_ETA_X (MAP_BORDER_X_OFFSET + 484) //463 - 15 + 6 + 30 -#define CLOCK_HOUR_X_START (MAP_BORDER_X_OFFSET + 518) //463 + 25 + 30 -#define CLOCK_MIN_X_START (MAP_BORDER_X_OFFSET + 538) //463 + 45 + 30 +int CLOCK_ETA_X; +int CLOCK_HOUR_X_START; +int CLOCK_MIN_X_START; // contract -#define CONTRACT_X 185 -#define CONTRACT_Y 50 +int CONTRACT_X; +int CONTRACT_Y; // trash can -#define TRASH_CAN_X 176 -#define TRASH_CAN_Y 211 + PLAYER_INFO_Y -#define TRASH_CAN_WIDTH 193 - 165 -#define TRASH_CAN_HEIGHT 239 - 217 +int TRASH_CAN_X; +int TRASH_CAN_Y; +int TRASH_CAN_WIDTH; +int TRASH_CAN_HEIGHT; + +// keyring +int MAP_KEYRING_X; +int MAP_KEYRING_Y; //Text offsets -#define Y_OFFSET 2 +int Y_OFFSET; // The boxes defines -#define TRAIN_Y_OFFSET 53 -#define TRAIN_X_OFF 65 -#define TRAIN_WID 80 -#define TRAIN_HEIG 47 -#define STRING_X_OFFSET 10 -#define STRING_Y_OFFSET 5 -#define POP_UP_BOX_X 120 -#define POP_UP_BOX_Y 0 -#define POP_UP_BOX_WIDTH 60 -#define POP_UP_BOX_HEIGHT 100 -#define MOUSE_PTR_Y_OFFSET 3 -#define POP_UP_Y_OFFSET 3 -#define TRAIN_TEXT_Y_OFFSET 4 +int TRAIN_Y_OFFSET; +int TRAIN_X_OFF; +int TRAIN_WID; +int TRAIN_HEIG; +int STRING_X_OFFSET; +int STRING_Y_OFFSET; +int POP_UP_BOX_X; +int POP_UP_BOX_Y; +int POP_UP_BOX_WIDTH; +int POP_UP_BOX_HEIGHT; +int MOUSE_PTR_Y_OFFSET; +int POP_UP_Y_OFFSET; +int TRAIN_TEXT_Y_OFFSET; // char stat positions -#define STR_X ( 112 ) -#define STR_Y 42 -#define DEX_X STR_X -#define DEX_Y 32 -#define AGL_X STR_X -#define AGL_Y 22 -#define LDR_X STR_X -#define LDR_Y 52 -#define WIS_X STR_X -#define WIS_Y 62 -#define LVL_X ( 159 ) -#define LVL_Y AGL_Y -#define MRK_X LVL_X -#define MRK_Y DEX_Y -#define EXP_X LVL_X -#define EXP_Y STR_Y -#define MEC_X LVL_X -#define MEC_Y LDR_Y -#define MED_X LVL_X -#define MED_Y WIS_Y +int STR_X; +int STR_Y; +int DEX_X; +int DEX_Y; +int AGL_X; +int AGL_Y; +int LDR_X; +int LDR_Y; +int WIS_X; +int WIS_Y; +int LVL_X; +int LVL_Y; +int MRK_X; +int MRK_Y; +int EXP_X; +int EXP_Y; +int MEC_X; +int MEC_Y; +int MED_X; +int MED_Y; -#define STAT_WID 15 -#define STAT_HEI GetFontHeight(CHAR_FONT) +int STAT_WID; +int STAT_HEI; -#define PIC_NAME_X 8 -#define PIC_NAME_Y (66 + 3) -#define PIC_NAME_WID 60 - PIC_NAME_X -#define PIC_NAME_HEI 75 - PIC_NAME_Y -#define CHAR_NAME_X 14 -#define CHAR_NAME_Y (2 + 3) -#define CHAR_NAME_WID 164 - CHAR_NAME_X -#define CHAR_NAME_HEI 11 - CHAR_NAME_Y -#define CHAR_LOC_X 76 -#define CHAR_LOC_Y 84 -#define CHAR_LOC_WID 16 -#define CHAR_LOC_HEI 9 -#define CHAR_TIME_REMAINING_X 207 -#define CHAR_TIME_REMAINING_Y 65 -#define CHAR_TIME_REMAINING_WID 258 - CHAR_TIME_REMAINING_X -#define CHAR_TIME_REMAINING_HEI GetFontHeight(CHAR_FONT) -#define CHAR_SALARY_X CHAR_TIME_REMAINING_X -#define CHAR_SALARY_Y 79 -#define CHAR_SALARY_WID CHAR_TIME_REMAINING_WID - 8 // for right justify -#define CHAR_SALARY_HEI CHAR_TIME_REMAINING_HEI -#define CHAR_MEDICAL_X CHAR_TIME_REMAINING_X -#define CHAR_MEDICAL_Y 93 -#define CHAR_MEDICAL_WID CHAR_TIME_REMAINING_WID - 8 // for right justify -#define CHAR_MEDICAL_HEI CHAR_TIME_REMAINING_HEI -#define CHAR_ASSIGN_X 182 -#define CHAR_ASSIGN1_Y 18 -#define CHAR_ASSIGN2_Y 31 -#define CHAR_ASSIGN_WID 257 - 178 -#define CHAR_ASSIGN_HEI 39 - 29 -#define CHAR_HP_X 133 -#define CHAR_HP_Y 77 + 3 -#define CHAR_HP_WID 175 - CHAR_HP_X -#define CHAR_HP_HEI 90 - CHAR_HP_Y -#define CHAR_MORALE_X 133 -#define CHAR_MORALE_Y 91 + 3 -#define CHAR_MORALE_WID 175 - CHAR_MORALE_X -#define CHAR_MORALE_HEI 101 - CHAR_MORALE_Y +int PIC_NAME_X; +int PIC_NAME_Y; +int PIC_NAME_WID; +int PIC_NAME_HEI; +int CHAR_NAME_X; +int CHAR_NAME_Y; +int CHAR_NAME_WID; +int CHAR_NAME_HEI; +int CHAR_LOC_X; +int CHAR_LOC_Y; +int CHAR_LOC_WID; +int CHAR_LOC_HEI; +int CHAR_TIME_REMAINING_X; +int CHAR_TIME_REMAINING_Y; +int CHAR_TIME_REMAINING_WID; +int CHAR_TIME_REMAINING_HEI; +int CHAR_SALARY_X; +int CHAR_SALARY_Y; +int CHAR_SALARY_WID; +int CHAR_SALARY_HEI; +int CHAR_MEDICAL_X; +int CHAR_MEDICAL_Y; +int CHAR_MEDICAL_WID; +int CHAR_MEDICAL_HEI; +int CHAR_ASSIGN_X; +int CHAR_ASSIGN1_Y; +int CHAR_ASSIGN2_Y; +int CHAR_ASSIGN_WID; +int CHAR_ASSIGN_HEI; +int CHAR_HP_X; +int CHAR_HP_Y; +int CHAR_HP_WID; +int CHAR_HP_HEI; +int CHAR_MORALE_X; +int CHAR_MORALE_Y; +int CHAR_MORALE_WID; +int CHAR_MORALE_HEI; -#define CROSS_X 195 -#define CROSS_Y 83 -#define CROSS_HEIGHT 20 -#define CROSS_WIDTH 20 -#define CHAR_PAY_X 150 -#define CHAR_PAY_Y 80+4 -#define CHAR_PAY_HEI GetFontHeight(CHAR_FONT) -#define CHAR_PAY_WID CROSS_X-CHAR_PAY_X -#define SOLDIER_PIC_X 9 -#define SOLDIER_PIC_Y 20 -#define SOLDIER_HAND_X 6 -#define SOLDIER_HAND_Y 81 -//#define TM_INV_WIDTH 58 -//#define TM_INV_HEIGHT 23 +int CROSS_X; +int CROSS_Y; +int CROSS_HEIGHT; +int CROSS_WIDTH; +int CHAR_PAY_X; +int CHAR_PAY_Y; +int CHAR_PAY_HEI; +int CHAR_PAY_WID; +int SOLDIER_PIC_X; +int SOLDIER_PIC_Y; +int SOLDIER_HAND_X; +int SOLDIER_HAND_Y; +//int TM_INV_WIDTH; +//int TM_INV_HEIGHT; // WANNE: The position of the clock in the strategy screen -//#define CLOCK_X (SCREEN_WIDTH - 86) //554 -//#define CLOCK_Y (SCREEN_HEIGHT - 21) //459 +//int CLOCK_X; +//int CLOCK_Y; #define RGB_WHITE ( FROMRGB( 255, 255, 255 ) ) -#define RGB_YELLOW ( FROMRGB( 255, 255, 0 ) ) -#define RGB_NEAR_BLACK ( FROMRGB( 0, 0, 1 ) ) +#define RGB_YELLOW ( FROMRGB( 255, 255, 0 ) ) +#define RGB_NEAR_BLACK ( FROMRGB( 0, 0, 1 ) ) // ENUMS @@ -464,33 +470,8 @@ SGPPoint gMapSortButtons[ MAX_SORT_METHODS ]={ // map screen's inventory panel pockets - top right corner coordinates -INV_REGION_DESC gMapScreenInvPocketXY[] = -{ - 204,116, // HELMETPOS - 204,145, // VESTPOS - 204,205, // LEGPOS, - 21, 116, // HEAD1POS - 21, 140, // HEAD2POS - 21, 194, // HANDPOS, - 21, 218, // SECONDHANDPOS - 98, 251, // BIGPOCK1 - 98, 275, // BIGPOCK2 - 98, 299, // BIGPOCK3 - 98, 323, // BIGPOCK4 - 22, 251, // SMALLPOCK1 - 22, 275, // SMALLPOCK2 - 22, 299, // SMALLPOCK3 - 22, 323, // SMALLPOCK4 - 60, 251, // SMALLPOCK5 - 60, 275, // SMALLPOCK6 - 60, 299, // SMALLPOCK7 - 60, 323 // SMALLPOCK8 -}; - -INV_REGION_DESC gSCamoXY = -{ - INV_BODY_X, INV_BODY_Y // X, Y Location of Map screen's Camouflage region -}; +INV_REGION_DESC gMapScreenInvPocketXY[NUM_INV_SLOTS]; // ARRAY FOR INV PANEL INTERFACE ITEM POSITIONS +INV_REGION_DESC gSCamoXY; // WANNE: @@ -538,6 +519,7 @@ BOOLEAN fFirstTimeInMapScreen = TRUE; BOOLEAN fShowInventoryFlag = FALSE; BOOLEAN fMapInventoryItem=FALSE; BOOLEAN fShowDescriptionFlag=FALSE; +BOOLEAN fResetMapCoords = FALSE; // are the graphics for mapscreen preloaded? BOOLEAN fPreLoadedMapGraphics = FALSE; @@ -578,7 +560,7 @@ BOOLEAN gfCharacterListInited = FALSE; BOOLEAN gfGlowTimerExpired = FALSE; -//not required to be saved. The flag is set to allow mapscreen to render once, then transition the +//not required to be saved. The flag is set to allow mapscreen to render once, then transition the //current tactical battle into autoresolve. BOOLEAN gfTransitionMapscreenToAutoResolve = FALSE; @@ -613,12 +595,13 @@ INT32 giMapContractButtonImage; //INT32 giMapInvButtonImage; INT32 giSortStateForMapScreenList = 0; +BOOLEAN giSortOrderAscending = TRUE; INT32 giCommonGlowBaseTime = 0; INT32 giFlashAssignBaseTime = 0; INT32 giFlashContractBaseTime = 0; UINT32 guiFlashCursorBaseTime = 0; -INT32 giPotCharPathBaseTime = 0; +INT32 giPotCharPathBaseTime = 0; /* // next and prev @@ -717,7 +700,7 @@ extern void HandlePreBattleInterfaceStates(); extern STR16 pContractButtonString[]; extern STR16 pBullseyeStrings[]; -extern OBJECTTYPE *gpItemDescObject; +extern OBJECTTYPE *gpItemDescObject; extern SOLDIERTYPE *pProcessingSoldier; @@ -727,7 +710,7 @@ extern FACETYPE *gpCurrentTalkingFace; //extern BOOLEAN gfFacePanelActive; // externs for highlighting of ammo/weapons -extern UINT32 guiMouseOverItemTime; +extern UINT32 guiMouseOverItemTime; extern BOOLEAN gfCheckForMouseOverItem; extern INT8 gbCheckForMouseOverItemPos; @@ -837,7 +820,7 @@ void CreateDestroyMapCharacterScrollButtons( void ); // sort buttons for team list void AddTeamPanelSortButtonsForMapScreen( void ); void RemoveTeamPanelSortButtonsForMapScreen( void ); -void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs ); +void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse = FALSE ); // Rendering @@ -939,7 +922,7 @@ void TrashCanBtnCallback( MOUSE_REGION *pRegion, INT32 iReason); extern void KeyRingItemPanelButtonCallback( MOUSE_REGION *pRegion, INT32 iReason ); -// handle talking +// handle talking void HandleSpontanousTalking( void ); BOOLEAN ContinueDialogue(SOLDIERTYPE *pSoldier, BOOLEAN fDone ); extern void CreateDestroyMilitiaSectorButtons( void ); @@ -993,7 +976,7 @@ void DisplayCharacterInfo( void ); void UpDateStatusOfContractBox( void ); // get which index in the mapscreen character list is this guy -INT32 GetIndexForThisSoldier( SOLDIERTYPE *pSoldier ); +INT32 GetIndexForthis( SOLDIERTYPE *pSoldier ); void CheckForAndRenderNewMailOverlay(); @@ -1067,6 +1050,7 @@ extern BOOLEAN CanRedistributeMilitiaInSector( INT16 sClickedSectorX, INT16 sCli extern INT32 GetNumberOfMercsInUpdateList( void ); void DeleteAllItemsInInventoryPool(); + #ifdef JA2TESTVERSION void TestDumpStatChanges( void ); void DumpSectorDifficultyInfo( void ); @@ -1074,6 +1058,636 @@ void DumpItemsList( void ); #endif +// CHRISL: New functions to handle initialization of inventory coordinates +BOOLEAN InitializeInvPanelCoordsOld() +{ + TOWN_INFO_X = 0; + TOWN_INFO_Y = 1; + + PLAYER_INFO_X = 0; + PLAYER_INFO_Y = 107; + + // Inventory slots + gMapScreenInvPocketXY[HELMETPOS].sX = PLAYER_INFO_X + 204; gMapScreenInvPocketXY[HELMETPOS].sY = PLAYER_INFO_Y + 9; // HELMETPOS + gMapScreenInvPocketXY[VESTPOS].sX = PLAYER_INFO_X + 204; gMapScreenInvPocketXY[VESTPOS].sY = PLAYER_INFO_Y + 38; // VESTPOS + gMapScreenInvPocketXY[LEGPOS].sX = PLAYER_INFO_X + 204; gMapScreenInvPocketXY[LEGPOS].sY = PLAYER_INFO_Y + 96; // LEGPOS, + gMapScreenInvPocketXY[HEAD1POS].sX = PLAYER_INFO_X + 21; gMapScreenInvPocketXY[HEAD1POS].sY = PLAYER_INFO_Y + 9; // HEAD1POS + gMapScreenInvPocketXY[HEAD2POS].sX = PLAYER_INFO_X + 21; gMapScreenInvPocketXY[HEAD2POS].sY = PLAYER_INFO_Y + 33; // HEAD2POS + gMapScreenInvPocketXY[HANDPOS].sX = PLAYER_INFO_X + 21; gMapScreenInvPocketXY[HANDPOS].sY = PLAYER_INFO_Y + 87; // HANDPOS, + gMapScreenInvPocketXY[SECONDHANDPOS].sX = PLAYER_INFO_X + 21; gMapScreenInvPocketXY[SECONDHANDPOS].sY = PLAYER_INFO_Y + 111; // SECONDHANDPOS + gMapScreenInvPocketXY[BIGPOCK1POS].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[BIGPOCK1POS].sY = PLAYER_INFO_Y + 144; // BIGPOCK1 + gMapScreenInvPocketXY[BIGPOCK2POS].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[BIGPOCK2POS].sY = PLAYER_INFO_Y + 168; // BIGPOCK2 + gMapScreenInvPocketXY[BIGPOCK3POS].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[BIGPOCK3POS].sY = PLAYER_INFO_Y + 192; // BIGPOCK3 + gMapScreenInvPocketXY[BIGPOCK4POS].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[BIGPOCK4POS].sY = PLAYER_INFO_Y + 216; // BIGPOCK4 + gMapScreenInvPocketXY[SMALLPOCK1POS].sX = PLAYER_INFO_X + 22; gMapScreenInvPocketXY[SMALLPOCK1POS].sY = PLAYER_INFO_Y + 144; // SMALLPOCK1 + gMapScreenInvPocketXY[SMALLPOCK2POS].sX = PLAYER_INFO_X + 22; gMapScreenInvPocketXY[SMALLPOCK2POS].sY = PLAYER_INFO_Y + 168; // SMALLPOCK2 + gMapScreenInvPocketXY[SMALLPOCK3POS].sX = PLAYER_INFO_X + 22; gMapScreenInvPocketXY[SMALLPOCK3POS].sY = PLAYER_INFO_Y + 192; // SMALLPOCK3 + gMapScreenInvPocketXY[SMALLPOCK4POS].sX = PLAYER_INFO_X + 22; gMapScreenInvPocketXY[SMALLPOCK4POS].sY = PLAYER_INFO_Y + 216; // SMALLPOCK4 + gMapScreenInvPocketXY[SMALLPOCK5POS].sX = PLAYER_INFO_X + 60; gMapScreenInvPocketXY[SMALLPOCK5POS].sY = PLAYER_INFO_Y + 144; // SMALLPOCK5 + gMapScreenInvPocketXY[SMALLPOCK6POS].sX = PLAYER_INFO_X + 60; gMapScreenInvPocketXY[SMALLPOCK6POS].sY = PLAYER_INFO_Y + 168; // SMALLPOCK6 + gMapScreenInvPocketXY[SMALLPOCK7POS].sX = PLAYER_INFO_X + 60; gMapScreenInvPocketXY[SMALLPOCK7POS].sY = PLAYER_INFO_Y + 192; // SMALLPOCK7 + gMapScreenInvPocketXY[SMALLPOCK8POS].sX = PLAYER_INFO_X + 60; gMapScreenInvPocketXY[SMALLPOCK8POS].sY = PLAYER_INFO_Y + 216; // SMALLPOCK8 + + // item description + MAP_ITEMDESC_START_X = 0; + MAP_ITEMDESC_START_Y = PLAYER_INFO_Y; + + INV_REGION_X = PLAYER_INFO_X; + INV_REGION_Y = PLAYER_INFO_Y; + INV_REGION_WIDTH = 261; + INV_REGION_HEIGHT = 359-94; + INV_BTN_X = PLAYER_INFO_X + 217; + INV_BTN_Y = PLAYER_INFO_Y + 210; + INV_BDROP_X = 0; // Not used in old inventory + INV_BDROP_Y = 0; // Not used in old inventory + + MAP_ARMOR_LABEL_X = 208; + MAP_ARMOR_LABEL_Y = 180; + MAP_ARMOR_X = 209; + MAP_ARMOR_Y = 189; + MAP_ARMOR_PERCENT_X = 229; + MAP_ARMOR_PERCENT_Y = 190; + + MAP_WEIGHT_LABEL_X = 173; + MAP_WEIGHT_LABEL_Y = 256; + MAP_WEIGHT_X = 176; + MAP_WEIGHT_Y = 266; + MAP_WEIGHT_PERCENT_X = 196; + MAP_WEIGHT_PERCENT_Y = 266; + + MAP_CAMMO_LABEL_X = 178; + MAP_CAMMO_LABEL_Y = 283; + MAP_CAMMO_X = 176; + MAP_CAMMO_Y = 292; + MAP_CAMMO_PERCENT_X = 196; + MAP_CAMMO_PERCENT_Y = 293; + + MAP_PERCENT_WIDTH = 20; + MAP_PERCENT_HEIGHT = 10; + + MAP_INV_STATS_TITLE_FONT_COLOR = 6; + MAP_INV_STATS_TEXT_FONT_COLOR = 5; + + PLAYER_INFO_FACE_START_X = 9; + PLAYER_INFO_FACE_START_Y = 17; + PLAYER_INFO_FACE_END_X = 60; + PLAYER_INFO_FACE_END_Y = 76; + + INV_BODY_X = 71; + INV_BODY_Y = 116; + + // WANNE 2 + NAME_X = 4; + NAME_WIDTH = 55 - NAME_X; + + ASSIGN_X = 60; + ASSIGN_WIDTH = 111 - ASSIGN_X; + SLEEP_X = 116; + SLEEP_WIDTH = 135 - SLEEP_X; + LOC_X = 140; + LOC_WIDTH = 172 - LOC_X; + DEST_ETA_X = 177; + DEST_ETA_WIDTH = 210 - DEST_ETA_X; + TIME_REMAINING_X = 215; + TIME_REMAINING_WIDTH = 243 - TIME_REMAINING_X; + + // WANNE 2 + CLOCK_Y_START = (MAP_BORDER_Y_OFFSET + 298); + + DEST_PLOT_X = (MAP_BORDER_X_OFFSET + 463); + DEST_PLOT_Y = (MAP_BORDER_Y_OFFSET + 345); + + // WANNE 2 + CLOCK_ETA_X = (MAP_BORDER_X_OFFSET + 484); + CLOCK_HOUR_X_START = (MAP_BORDER_X_OFFSET + 518); + CLOCK_MIN_X_START = (MAP_BORDER_X_OFFSET + 538); + + // contract + CONTRACT_X = 185; + CONTRACT_Y = 50; + + // trash can + TRASH_CAN_X = 176; + TRASH_CAN_Y = 211 + PLAYER_INFO_Y; + TRASH_CAN_WIDTH = 193 - 165; + TRASH_CAN_HEIGHT = 239 - 217; + + // keyring + MAP_KEYRING_X = 217; + MAP_KEYRING_Y = 271; + + //Text offsets + Y_OFFSET = 2; + + // The boxes defines + TRAIN_Y_OFFSET = 53; + TRAIN_X_OFF = 65; + TRAIN_WID = 80; + TRAIN_HEIG = 47; + STRING_X_OFFSET = 10; + STRING_Y_OFFSET = 5; + POP_UP_BOX_X = 120; + POP_UP_BOX_Y = 0; + POP_UP_BOX_WIDTH = 60; + POP_UP_BOX_HEIGHT = 100; + MOUSE_PTR_Y_OFFSET = 3; + POP_UP_Y_OFFSET = 3; + TRAIN_TEXT_Y_OFFSET = 4; + + // char stat positions + STR_X = 112; + STR_Y = 42; + DEX_X = STR_X; + DEX_Y = 32; + AGL_X = STR_X; + AGL_Y = 22; + LDR_X = STR_X; + LDR_Y = 52; + WIS_X = STR_X; + WIS_Y = 62; + LVL_X = 159; + LVL_Y = AGL_Y; + MRK_X = LVL_X; + MRK_Y = DEX_Y; + EXP_X = LVL_X; + EXP_Y = STR_Y; + MEC_X = LVL_X; + MEC_Y = LDR_Y; + MED_X = LVL_X; + MED_Y = WIS_Y; + + STAT_WID = 15; + STAT_HEI = GetFontHeight(CHAR_FONT); + + PIC_NAME_X = 8; + PIC_NAME_Y = (66 + 3); + PIC_NAME_WID = 60 - PIC_NAME_X; + PIC_NAME_HEI = 75 - PIC_NAME_Y; + CHAR_NAME_X = 14; + CHAR_NAME_Y = (2 + 3); + CHAR_NAME_WID = 164 - CHAR_NAME_X; + CHAR_NAME_HEI = 11 - CHAR_NAME_Y; + CHAR_LOC_X = 76; + CHAR_LOC_Y = 84; + CHAR_LOC_WID = 16; + CHAR_LOC_HEI = 9; + CHAR_TIME_REMAINING_X = 207; + CHAR_TIME_REMAINING_Y = 65; + CHAR_TIME_REMAINING_WID = 258 - CHAR_TIME_REMAINING_X; + CHAR_TIME_REMAINING_HEI = GetFontHeight(CHAR_FONT); + CHAR_SALARY_X = CHAR_TIME_REMAINING_X; + CHAR_SALARY_Y = 79; + CHAR_SALARY_WID = CHAR_TIME_REMAINING_WID - 8; + CHAR_SALARY_HEI = CHAR_TIME_REMAINING_HEI; + CHAR_MEDICAL_X = CHAR_TIME_REMAINING_X; + CHAR_MEDICAL_Y = 93; + CHAR_MEDICAL_WID = CHAR_TIME_REMAINING_WID - 8; + CHAR_MEDICAL_HEI = CHAR_TIME_REMAINING_HEI; + CHAR_ASSIGN_X = 182; + CHAR_ASSIGN1_Y = 18; + CHAR_ASSIGN2_Y = 31; + CHAR_ASSIGN_WID = 257 - 178; + CHAR_ASSIGN_HEI = 39 - 29; + CHAR_HP_X = 133; + CHAR_HP_Y = 77 + 3; + CHAR_HP_WID = 175 - CHAR_HP_X; + CHAR_HP_HEI = 90 - CHAR_HP_Y; + CHAR_MORALE_X = 133; + CHAR_MORALE_Y = 91 + 3; + CHAR_MORALE_WID = 175 - CHAR_MORALE_X; + CHAR_MORALE_HEI = 101 - CHAR_MORALE_Y; + + CROSS_X = 195; + CROSS_Y = 83; + CROSS_HEIGHT = 20; + CROSS_WIDTH = 20; + CHAR_PAY_X = 150; + CHAR_PAY_Y = 80+4; + CHAR_PAY_HEI = GetFontHeight(CHAR_FONT); + CHAR_PAY_WID = CROSS_X-CHAR_PAY_X; + SOLDIER_PIC_X = 9; + SOLDIER_PIC_Y = 20; + SOLDIER_HAND_X = 6; + SOLDIER_HAND_Y = 81; + //TM_INV_WIDTH = 58; + //TM_INV_HEIGHT = 23; + + // WANNE 2 (the position of the clock in the strategy screen) + //CLOCK_X = (SCREEN_WIDTH - 86); + //CLOCK_Y = (SCREEN_HEIGHT - 21); + + gSCamoXY.sX = INV_BODY_X; gSCamoXY.sY = INV_BODY_Y; // X, Y Location of Map screen's Camouflage region + + return ( TRUE ); +} +BOOLEAN InitializeInvPanelCoordsNew() +{ + TOWN_INFO_X = 0; + TOWN_INFO_Y = 1; + + PLAYER_INFO_X = 0; + PLAYER_INFO_Y = 107; + + //InitInventoryNew(); + + // Inventory slots + if(iResolution == 0){ + gMapScreenInvPocketXY[0].sX = PLAYER_INFO_X + 131; gMapScreenInvPocketXY[0].sY = PLAYER_INFO_Y + 9; // HELMETPOS + gMapScreenInvPocketXY[1].sX = PLAYER_INFO_X + 131; gMapScreenInvPocketXY[1].sY = PLAYER_INFO_Y + 38; // VESTPOS + gMapScreenInvPocketXY[2].sX = PLAYER_INFO_X + 131; gMapScreenInvPocketXY[2].sY = PLAYER_INFO_Y + 97; // LEGPOS + gMapScreenInvPocketXY[3].sX = PLAYER_INFO_X + 14; gMapScreenInvPocketXY[3].sY = PLAYER_INFO_Y + 9; // HEAD1POS + gMapScreenInvPocketXY[4].sX = PLAYER_INFO_X + 14; gMapScreenInvPocketXY[4].sY = PLAYER_INFO_Y + 33; // HEAD2POS + gMapScreenInvPocketXY[5].sX = PLAYER_INFO_X + 14; gMapScreenInvPocketXY[5].sY = PLAYER_INFO_Y + 86; // HANDPOS + gMapScreenInvPocketXY[6].sX = PLAYER_INFO_X + 14; gMapScreenInvPocketXY[6].sY = PLAYER_INFO_Y + 110; // SECONDHANDPOS + gMapScreenInvPocketXY[7].sX = PLAYER_INFO_X + 186; gMapScreenInvPocketXY[7].sY = PLAYER_INFO_Y + 134; // VESTPOCK + gMapScreenInvPocketXY[8].sX = PLAYER_INFO_X + 29; gMapScreenInvPocketXY[8].sY = PLAYER_INFO_Y + 197; // LTHIGHPOCK + gMapScreenInvPocketXY[9].sX = PLAYER_INFO_X + 112; gMapScreenInvPocketXY[9].sY = PLAYER_INFO_Y + 197; // RTHIGHPOCK + gMapScreenInvPocketXY[10].sX = PLAYER_INFO_X + 194; gMapScreenInvPocketXY[10].sY = PLAYER_INFO_Y + 197; // CPACKPOCK + gMapScreenInvPocketXY[11].sX = PLAYER_INFO_X + 173; gMapScreenInvPocketXY[11].sY = PLAYER_INFO_Y + 332; // BPACKPOCK + gMapScreenInvPocketXY[12].sX = PLAYER_INFO_X + 95; gMapScreenInvPocketXY[12].sY = PLAYER_INFO_Y + 134; // GUNSLINGPOCKPOS + gMapScreenInvPocketXY[13].sX = PLAYER_INFO_X + 36; gMapScreenInvPocketXY[13].sY = PLAYER_INFO_Y + 134; // KNIFEPOCKPOS + gMapScreenInvPocketXY[14].sX = PLAYER_INFO_X + 186; gMapScreenInvPocketXY[14].sY = PLAYER_INFO_Y + 260; // BIGPOCK1 + gMapScreenInvPocketXY[15].sX = PLAYER_INFO_X + 186; gMapScreenInvPocketXY[15].sY = PLAYER_INFO_Y + 281; // BIGPOCK2 + gMapScreenInvPocketXY[16].sX = PLAYER_INFO_X + 186; gMapScreenInvPocketXY[16].sY = PLAYER_INFO_Y + 302; // BIGPOCK3 + gMapScreenInvPocketXY[17].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[17].sY = PLAYER_INFO_Y + 281; // BIGPOCK4 + gMapScreenInvPocketXY[18].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[18].sY = PLAYER_INFO_Y + 302; // BIGPOCK5 + gMapScreenInvPocketXY[19].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[19].sY = PLAYER_INFO_Y + 323; // BIGPOCK6 + gMapScreenInvPocketXY[20].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[20].sY = PLAYER_INFO_Y + 344; // BIGPOCK7 + gMapScreenInvPocketXY[21].sX = PLAYER_INFO_X + 202; gMapScreenInvPocketXY[21].sY = PLAYER_INFO_Y + 155; // MEDPOCK1 + gMapScreenInvPocketXY[22].sX = PLAYER_INFO_X + 202; gMapScreenInvPocketXY[22].sY = PLAYER_INFO_Y + 176; // MEDPOCK2 + gMapScreenInvPocketXY[23].sX = PLAYER_INFO_X + 29; gMapScreenInvPocketXY[23].sY = PLAYER_INFO_Y + 260; // MEDPOCK3 + gMapScreenInvPocketXY[24].sX = PLAYER_INFO_X + 111; gMapScreenInvPocketXY[24].sY = PLAYER_INFO_Y + 260; // MEDPOCK4 + gMapScreenInvPocketXY[25].sX = PLAYER_INFO_X + 22; gMapScreenInvPocketXY[25].sY = PLAYER_INFO_Y + 155; // SMALLPOCK1 + gMapScreenInvPocketXY[26].sX = PLAYER_INFO_X + 58; gMapScreenInvPocketXY[26].sY = PLAYER_INFO_Y + 155; // SMALLPOCK2 + gMapScreenInvPocketXY[27].sX = PLAYER_INFO_X + 94; gMapScreenInvPocketXY[27].sY = PLAYER_INFO_Y + 155; // SMALLPOCK3 + gMapScreenInvPocketXY[28].sX = PLAYER_INFO_X + 130; gMapScreenInvPocketXY[28].sY = PLAYER_INFO_Y + 155; // SMALLPOCK4 + gMapScreenInvPocketXY[29].sX = PLAYER_INFO_X + 166; gMapScreenInvPocketXY[29].sY = PLAYER_INFO_Y + 155; // SMALLPOCK5 + gMapScreenInvPocketXY[30].sX = PLAYER_INFO_X + 22; gMapScreenInvPocketXY[30].sY = PLAYER_INFO_Y + 176; // SMALLPOCK6 + gMapScreenInvPocketXY[31].sX = PLAYER_INFO_X + 58; gMapScreenInvPocketXY[31].sY = PLAYER_INFO_Y + 176; // SMALLPOCK7 + gMapScreenInvPocketXY[32].sX = PLAYER_INFO_X + 94; gMapScreenInvPocketXY[32].sY = PLAYER_INFO_Y + 176; // SMALLPOCK8 + gMapScreenInvPocketXY[33].sX = PLAYER_INFO_X + 130; gMapScreenInvPocketXY[33].sY = PLAYER_INFO_Y + 176; // SMALLPOCK9 + gMapScreenInvPocketXY[34].sX = PLAYER_INFO_X + 166; gMapScreenInvPocketXY[34].sY = PLAYER_INFO_Y + 176; // SMALLPOCK10 + gMapScreenInvPocketXY[35].sX = PLAYER_INFO_X + 18; gMapScreenInvPocketXY[35].sY = PLAYER_INFO_Y + 218; // SMALLPOCK11 + gMapScreenInvPocketXY[36].sX = PLAYER_INFO_X + 54; gMapScreenInvPocketXY[36].sY = PLAYER_INFO_Y + 218; // SMALLPOCK12 + gMapScreenInvPocketXY[37].sX = PLAYER_INFO_X + 18; gMapScreenInvPocketXY[37].sY = PLAYER_INFO_Y + 239; // SMALLPOCK13 + gMapScreenInvPocketXY[38].sX = PLAYER_INFO_X + 54; gMapScreenInvPocketXY[38].sY = PLAYER_INFO_Y + 239; // SMALLPOCK14 + gMapScreenInvPocketXY[39].sX = PLAYER_INFO_X + 100; gMapScreenInvPocketXY[39].sY = PLAYER_INFO_Y + 218; // SMALLPOCK15 + gMapScreenInvPocketXY[40].sX = PLAYER_INFO_X + 136; gMapScreenInvPocketXY[40].sY = PLAYER_INFO_Y + 218; // SMALLPOCK16 + gMapScreenInvPocketXY[41].sX = PLAYER_INFO_X + 100; gMapScreenInvPocketXY[41].sY = PLAYER_INFO_Y + 239; // SMALLPOCK17 + gMapScreenInvPocketXY[42].sX = PLAYER_INFO_X + 136; gMapScreenInvPocketXY[42].sY = PLAYER_INFO_Y + 239; // SMALLPOCK18 + gMapScreenInvPocketXY[43].sX = PLAYER_INFO_X + 183; gMapScreenInvPocketXY[43].sY = PLAYER_INFO_Y + 218; // SMALLPOCK19 + gMapScreenInvPocketXY[44].sX = PLAYER_INFO_X + 219; gMapScreenInvPocketXY[44].sY = PLAYER_INFO_Y + 218; // SMALLPOCK20 + gMapScreenInvPocketXY[45].sX = PLAYER_INFO_X + 183; gMapScreenInvPocketXY[45].sY = PLAYER_INFO_Y + 239; // SMALLPOCK21 + gMapScreenInvPocketXY[46].sX = PLAYER_INFO_X + 219; gMapScreenInvPocketXY[46].sY = PLAYER_INFO_Y + 239; // SMALLPOCK22 + gMapScreenInvPocketXY[47].sX = PLAYER_INFO_X + 26; gMapScreenInvPocketXY[47].sY = PLAYER_INFO_Y + 281; // SMALLPOCK23 + gMapScreenInvPocketXY[48].sX = PLAYER_INFO_X + 26; gMapScreenInvPocketXY[48].sY = PLAYER_INFO_Y + 302; // SMALLPOCK24 + gMapScreenInvPocketXY[49].sX = PLAYER_INFO_X + 26; gMapScreenInvPocketXY[49].sY = PLAYER_INFO_Y + 323; // SMALLPOCK25 + gMapScreenInvPocketXY[50].sX = PLAYER_INFO_X + 26; gMapScreenInvPocketXY[50].sY = PLAYER_INFO_Y + 344; // SMALLPOCK26 + gMapScreenInvPocketXY[51].sX = PLAYER_INFO_X + 62; gMapScreenInvPocketXY[51].sY = PLAYER_INFO_Y + 281; // SMALLPOCK27 + gMapScreenInvPocketXY[52].sX = PLAYER_INFO_X + 62; gMapScreenInvPocketXY[52].sY = PLAYER_INFO_Y + 302; // SMALLPOCK28 + gMapScreenInvPocketXY[53].sX = PLAYER_INFO_X + 62; gMapScreenInvPocketXY[53].sY = PLAYER_INFO_Y + 323; // SMALLPOCK29 + gMapScreenInvPocketXY[54].sX = PLAYER_INFO_X + 62; gMapScreenInvPocketXY[54].sY = PLAYER_INFO_Y + 344; // SMALLPOCK30 + } + else{ + gMapScreenInvPocketXY[0].sX = PLAYER_INFO_X + 131; gMapScreenInvPocketXY[0].sY = PLAYER_INFO_Y + 9; // HELMETPOS + gMapScreenInvPocketXY[1].sX = PLAYER_INFO_X + 131; gMapScreenInvPocketXY[1].sY = PLAYER_INFO_Y + 38; // VESTPOS + gMapScreenInvPocketXY[2].sX = PLAYER_INFO_X + 131; gMapScreenInvPocketXY[2].sY = PLAYER_INFO_Y + 97; // LEGPOS + gMapScreenInvPocketXY[3].sX = PLAYER_INFO_X + 14; gMapScreenInvPocketXY[3].sY = PLAYER_INFO_Y + 9; // HEAD1POS + gMapScreenInvPocketXY[4].sX = PLAYER_INFO_X + 14; gMapScreenInvPocketXY[4].sY = PLAYER_INFO_Y + 33; // HEAD2POS + gMapScreenInvPocketXY[5].sX = PLAYER_INFO_X + 14; gMapScreenInvPocketXY[5].sY = PLAYER_INFO_Y + 86; // HANDPOS + gMapScreenInvPocketXY[6].sX = PLAYER_INFO_X + 14; gMapScreenInvPocketXY[6].sY = PLAYER_INFO_Y + 110; // SECONDHANDPOS + gMapScreenInvPocketXY[7].sX = PLAYER_INFO_X + 186; gMapScreenInvPocketXY[7].sY = PLAYER_INFO_Y + 156; // VESTPOCK + gMapScreenInvPocketXY[8].sX = PLAYER_INFO_X + 29; gMapScreenInvPocketXY[8].sY = PLAYER_INFO_Y + 256; // LTHIGHPOCK + gMapScreenInvPocketXY[9].sX = PLAYER_INFO_X + 112; gMapScreenInvPocketXY[9].sY = PLAYER_INFO_Y + 256; // RTHIGHPOCK + gMapScreenInvPocketXY[10].sX = PLAYER_INFO_X + 194; gMapScreenInvPocketXY[10].sY = PLAYER_INFO_Y + 256; // CPACKPOCK + gMapScreenInvPocketXY[11].sX = PLAYER_INFO_X + 173; gMapScreenInvPocketXY[11].sY = PLAYER_INFO_Y + 439; // BPACKPOCK + gMapScreenInvPocketXY[12].sX = PLAYER_INFO_X + 95; gMapScreenInvPocketXY[12].sY = PLAYER_INFO_Y + 156; // GUNSLINGPOCKPOS + gMapScreenInvPocketXY[13].sX = PLAYER_INFO_X + 36; gMapScreenInvPocketXY[13].sY = PLAYER_INFO_Y + 156; // KNIFEPOCKPOS + gMapScreenInvPocketXY[14].sX = PLAYER_INFO_X + 186; gMapScreenInvPocketXY[14].sY = PLAYER_INFO_Y + 336; // BIGPOCK1 + gMapScreenInvPocketXY[15].sX = PLAYER_INFO_X + 186; gMapScreenInvPocketXY[15].sY = PLAYER_INFO_Y + 360; // BIGPOCK2 + gMapScreenInvPocketXY[16].sX = PLAYER_INFO_X + 186; gMapScreenInvPocketXY[16].sY = PLAYER_INFO_Y + 384; // BIGPOCK3 + gMapScreenInvPocketXY[17].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[17].sY = PLAYER_INFO_Y + 379; // BIGPOCK4 + gMapScreenInvPocketXY[18].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[18].sY = PLAYER_INFO_Y + 403; // BIGPOCK5 + gMapScreenInvPocketXY[19].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[19].sY = PLAYER_INFO_Y + 427; // BIGPOCK6 + gMapScreenInvPocketXY[20].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[20].sY = PLAYER_INFO_Y + 451; // BIGPOCK7 + gMapScreenInvPocketXY[21].sX = PLAYER_INFO_X + 202; gMapScreenInvPocketXY[21].sY = PLAYER_INFO_Y + 188; // MEDPOCK1 + gMapScreenInvPocketXY[22].sX = PLAYER_INFO_X + 202; gMapScreenInvPocketXY[22].sY = PLAYER_INFO_Y + 212; // MEDPOCK2 + gMapScreenInvPocketXY[23].sX = PLAYER_INFO_X + 29; gMapScreenInvPocketXY[23].sY = PLAYER_INFO_Y + 336; // MEDPOCK3 + gMapScreenInvPocketXY[24].sX = PLAYER_INFO_X + 112; gMapScreenInvPocketXY[24].sY = PLAYER_INFO_Y + 336; // MEDPOCK4 + gMapScreenInvPocketXY[25].sX = PLAYER_INFO_X + 22; gMapScreenInvPocketXY[25].sY = PLAYER_INFO_Y + 188; // SMALLPOCK1 + gMapScreenInvPocketXY[26].sX = PLAYER_INFO_X + 58; gMapScreenInvPocketXY[26].sY = PLAYER_INFO_Y + 188; // SMALLPOCK2 + gMapScreenInvPocketXY[27].sX = PLAYER_INFO_X + 94; gMapScreenInvPocketXY[27].sY = PLAYER_INFO_Y + 188; // SMALLPOCK3 + gMapScreenInvPocketXY[28].sX = PLAYER_INFO_X + 130; gMapScreenInvPocketXY[28].sY = PLAYER_INFO_Y + 188; // SMALLPOCK4 + gMapScreenInvPocketXY[29].sX = PLAYER_INFO_X + 166; gMapScreenInvPocketXY[29].sY = PLAYER_INFO_Y + 188; // SMALLPOCK5 + gMapScreenInvPocketXY[30].sX = PLAYER_INFO_X + 22; gMapScreenInvPocketXY[30].sY = PLAYER_INFO_Y + 212; // SMALLPOCK6 + gMapScreenInvPocketXY[31].sX = PLAYER_INFO_X + 58; gMapScreenInvPocketXY[31].sY = PLAYER_INFO_Y + 212; // SMALLPOCK7 + gMapScreenInvPocketXY[32].sX = PLAYER_INFO_X + 94; gMapScreenInvPocketXY[32].sY = PLAYER_INFO_Y + 212; // SMALLPOCK8 + gMapScreenInvPocketXY[33].sX = PLAYER_INFO_X + 130; gMapScreenInvPocketXY[33].sY = PLAYER_INFO_Y + 212; // SMALLPOCK9 + gMapScreenInvPocketXY[34].sX = PLAYER_INFO_X + 166; gMapScreenInvPocketXY[34].sY = PLAYER_INFO_Y + 212; // SMALLPOCK10 + gMapScreenInvPocketXY[35].sX = PLAYER_INFO_X + 18; gMapScreenInvPocketXY[35].sY = PLAYER_INFO_Y + 288; // SMALLPOCK11 + gMapScreenInvPocketXY[36].sX = PLAYER_INFO_X + 54; gMapScreenInvPocketXY[36].sY = PLAYER_INFO_Y + 288; // SMALLPOCK12 + gMapScreenInvPocketXY[37].sX = PLAYER_INFO_X + 18; gMapScreenInvPocketXY[37].sY = PLAYER_INFO_Y + 312; // SMALLPOCK13 + gMapScreenInvPocketXY[38].sX = PLAYER_INFO_X + 54; gMapScreenInvPocketXY[38].sY = PLAYER_INFO_Y + 312; // SMALLPOCK14 + gMapScreenInvPocketXY[39].sX = PLAYER_INFO_X + 100; gMapScreenInvPocketXY[39].sY = PLAYER_INFO_Y + 288; // SMALLPOCK15 + gMapScreenInvPocketXY[40].sX = PLAYER_INFO_X + 136; gMapScreenInvPocketXY[40].sY = PLAYER_INFO_Y + 288; // SMALLPOCK16 + gMapScreenInvPocketXY[41].sX = PLAYER_INFO_X + 100; gMapScreenInvPocketXY[41].sY = PLAYER_INFO_Y + 312; // SMALLPOCK17 + gMapScreenInvPocketXY[42].sX = PLAYER_INFO_X + 136; gMapScreenInvPocketXY[42].sY = PLAYER_INFO_Y + 312; // SMALLPOCK18 + gMapScreenInvPocketXY[43].sX = PLAYER_INFO_X + 183; gMapScreenInvPocketXY[43].sY = PLAYER_INFO_Y + 288; // SMALLPOCK19 + gMapScreenInvPocketXY[44].sX = PLAYER_INFO_X + 219; gMapScreenInvPocketXY[44].sY = PLAYER_INFO_Y + 288; // SMALLPOCK20 + gMapScreenInvPocketXY[45].sX = PLAYER_INFO_X + 183; gMapScreenInvPocketXY[45].sY = PLAYER_INFO_Y + 312; // SMALLPOCK21 + gMapScreenInvPocketXY[46].sX = PLAYER_INFO_X + 219; gMapScreenInvPocketXY[46].sY = PLAYER_INFO_Y + 312; // SMALLPOCK22 + gMapScreenInvPocketXY[47].sX = PLAYER_INFO_X + 26; gMapScreenInvPocketXY[47].sY = PLAYER_INFO_Y + 379; // SMALLPOCK23 + gMapScreenInvPocketXY[48].sX = PLAYER_INFO_X + 26; gMapScreenInvPocketXY[48].sY = PLAYER_INFO_Y + 403; // SMALLPOCK24 + gMapScreenInvPocketXY[49].sX = PLAYER_INFO_X + 26; gMapScreenInvPocketXY[49].sY = PLAYER_INFO_Y + 427; // SMALLPOCK25 + gMapScreenInvPocketXY[50].sX = PLAYER_INFO_X + 26; gMapScreenInvPocketXY[50].sY = PLAYER_INFO_Y + 451; // SMALLPOCK26 + gMapScreenInvPocketXY[51].sX = PLAYER_INFO_X + 62; gMapScreenInvPocketXY[51].sY = PLAYER_INFO_Y + 379; // SMALLPOCK27 + gMapScreenInvPocketXY[52].sX = PLAYER_INFO_X + 62; gMapScreenInvPocketXY[52].sY = PLAYER_INFO_Y + 403; // SMALLPOCK28 + gMapScreenInvPocketXY[53].sX = PLAYER_INFO_X + 62; gMapScreenInvPocketXY[53].sY = PLAYER_INFO_Y + 427; // SMALLPOCK29 + gMapScreenInvPocketXY[54].sX = PLAYER_INFO_X + 62; gMapScreenInvPocketXY[54].sY = PLAYER_INFO_Y + 451; // SMALLPOCK30 + } + + // item description + MAP_ITEMDESC_START_X = 0; + MAP_ITEMDESC_START_Y = PLAYER_INFO_Y; + + INV_REGION_X = PLAYER_INFO_X; + INV_REGION_Y = PLAYER_INFO_Y; + INV_REGION_WIDTH = 261; + INV_REGION_HEIGHT = 359-94; + INV_BTN_X = PLAYER_INFO_X + 226; + INV_BTN_Y = PLAYER_INFO_Y + 19; + INV_BDROP_X = PLAYER_INFO_X + 220; + INV_BDROP_Y = PLAYER_INFO_Y + 441; + + MAP_ARMOR_LABEL_X = 136; + MAP_ARMOR_LABEL_Y = 177; + MAP_ARMOR_X = 138; + MAP_ARMOR_Y = 187; + MAP_ARMOR_PERCENT_X = 158; + MAP_ARMOR_PERCENT_Y = 188; + + MAP_WEIGHT_LABEL_X = 185; + MAP_WEIGHT_LABEL_Y = 209; + MAP_WEIGHT_X = 188; + MAP_WEIGHT_Y = 219; + MAP_WEIGHT_PERCENT_X = 208; + MAP_WEIGHT_PERCENT_Y = 219; + + MAP_CAMMO_LABEL_X = 226; + MAP_CAMMO_LABEL_Y = 209; + MAP_CAMMO_X = 224; + MAP_CAMMO_Y = 219; + MAP_CAMMO_PERCENT_X = 244; + MAP_CAMMO_PERCENT_Y = 219; + + MAP_PERCENT_WIDTH = 20; + MAP_PERCENT_HEIGHT = 10; + + MAP_INV_STATS_TITLE_FONT_COLOR = 6; + MAP_INV_STATS_TEXT_FONT_COLOR = 5; + + PLAYER_INFO_FACE_START_X = 9; + PLAYER_INFO_FACE_START_Y = 17; + PLAYER_INFO_FACE_END_X = 60; + PLAYER_INFO_FACE_END_Y = 76; + + INV_BODY_X = 31; + INV_BODY_Y = 8 + PLAYER_INFO_Y; + + // WANNE 2 + NAME_X = 4; + NAME_WIDTH = 55 - NAME_X; + + ASSIGN_X = 60; + ASSIGN_WIDTH = 111 - ASSIGN_X; + SLEEP_X = 116; + SLEEP_WIDTH = 135 - SLEEP_X; + LOC_X = 140; + LOC_WIDTH = 172 - LOC_X; + DEST_ETA_X = 177; + DEST_ETA_WIDTH = 210 - DEST_ETA_X; + TIME_REMAINING_X = 215; + TIME_REMAINING_WIDTH = 243 - TIME_REMAINING_X; + + // WANNE 2 + CLOCK_Y_START = (MAP_BORDER_Y_OFFSET + 298); + + DEST_PLOT_X = (MAP_BORDER_X_OFFSET + 463); + DEST_PLOT_Y = (MAP_BORDER_Y_OFFSET + 345); + + // WANNE 2 + CLOCK_ETA_X = (MAP_BORDER_X_OFFSET + 484); + CLOCK_HOUR_X_START = (MAP_BORDER_X_OFFSET + 518); + CLOCK_MIN_X_START = (MAP_BORDER_X_OFFSET + 538); + + // contract + CONTRACT_X = 185; + CONTRACT_Y = 50; + + // trash can + TRASH_CAN_X = 209; + TRASH_CAN_Y = 59 + PLAYER_INFO_Y; + TRASH_CAN_WIDTH = 193 - 165; + TRASH_CAN_HEIGHT = 239 - 217; + + // keyring + MAP_KEYRING_X = 180; + MAP_KEYRING_Y = 127; + + //Text offsets + Y_OFFSET = 2; + + // The boxes defines + TRAIN_Y_OFFSET = 53; + TRAIN_X_OFF = 65; + TRAIN_WID = 80; + TRAIN_HEIG = 47; + STRING_X_OFFSET = 10; + STRING_Y_OFFSET = 5; + POP_UP_BOX_X = 120; + POP_UP_BOX_Y = 0; + POP_UP_BOX_WIDTH = 60; + POP_UP_BOX_HEIGHT = 100; + MOUSE_PTR_Y_OFFSET = 3; + POP_UP_Y_OFFSET = 3; + TRAIN_TEXT_Y_OFFSET = 4; + + // char stat positions + STR_X = 112; + STR_Y = 42; + DEX_X = STR_X; + DEX_Y = 32; + AGL_X = STR_X; + AGL_Y = 22; + LDR_X = STR_X; + LDR_Y = 52; + WIS_X = STR_X; + WIS_Y = 62; + LVL_X = 159; + LVL_Y = AGL_Y; + MRK_X = LVL_X; + MRK_Y = DEX_Y; + EXP_X = LVL_X; + EXP_Y = STR_Y; + MEC_X = LVL_X; + MEC_Y = LDR_Y; + MED_X = LVL_X; + MED_Y = WIS_Y; + + STAT_WID = 15; + STAT_HEI = GetFontHeight(CHAR_FONT); + + PIC_NAME_X = 8; + PIC_NAME_Y = (66 + 3); + PIC_NAME_WID = 60 - PIC_NAME_X; + PIC_NAME_HEI = 75 - PIC_NAME_Y; + CHAR_NAME_X = 14; + CHAR_NAME_Y = (2 + 3); + CHAR_NAME_WID = 164 - CHAR_NAME_X; + CHAR_NAME_HEI = 11 - CHAR_NAME_Y; + CHAR_LOC_X = 76; + CHAR_LOC_Y = 84; + CHAR_LOC_WID = 16; + CHAR_LOC_HEI = 9; + CHAR_TIME_REMAINING_X = 207; + CHAR_TIME_REMAINING_Y = 65; + CHAR_TIME_REMAINING_WID = 258 - CHAR_TIME_REMAINING_X; + CHAR_TIME_REMAINING_HEI = GetFontHeight(CHAR_FONT); + CHAR_SALARY_X = CHAR_TIME_REMAINING_X; + CHAR_SALARY_Y = 79; + CHAR_SALARY_WID = CHAR_TIME_REMAINING_WID - 8; + CHAR_SALARY_HEI = CHAR_TIME_REMAINING_HEI; + CHAR_MEDICAL_X = CHAR_TIME_REMAINING_X; + CHAR_MEDICAL_Y = 93; + CHAR_MEDICAL_WID = CHAR_TIME_REMAINING_WID - 8; + CHAR_MEDICAL_HEI = CHAR_TIME_REMAINING_HEI; + CHAR_ASSIGN_X = 182; + CHAR_ASSIGN1_Y = 18; + CHAR_ASSIGN2_Y = 31; + CHAR_ASSIGN_WID = 257 - 178; + CHAR_ASSIGN_HEI = 39 - 29; + CHAR_HP_X = 133; + CHAR_HP_Y = 77 + 3; + CHAR_HP_WID = 175 - CHAR_HP_X; + CHAR_HP_HEI = 90 - CHAR_HP_Y; + CHAR_MORALE_X = 133; + CHAR_MORALE_Y = 91 + 3; + CHAR_MORALE_WID = 175 - CHAR_MORALE_X; + CHAR_MORALE_HEI = 101 - CHAR_MORALE_Y; + + CROSS_X = 195; + CROSS_Y = 83; + CROSS_HEIGHT = 20; + CROSS_WIDTH = 20; + CHAR_PAY_X = 150; + CHAR_PAY_Y = 80+4; + CHAR_PAY_HEI = GetFontHeight(CHAR_FONT); + CHAR_PAY_WID = CROSS_X-CHAR_PAY_X; + SOLDIER_PIC_X = 9; + SOLDIER_PIC_Y = 20; + SOLDIER_HAND_X = 6; + SOLDIER_HAND_Y = 81; + //TM_INV_WIDTH = 58; + //TM_INV_HEIGHT = 23; + + // WANNE 2 (the position of the clock in the strategy screen) + //CLOCK_X = (SCREEN_WIDTH - 86); + //CLOCK_Y = (SCREEN_HEIGHT - 21); + + gSCamoXY.sX = INV_BODY_X; gSCamoXY.sY = INV_BODY_Y; // X, Y Location of Map screen's Camouflage region + + return ( TRUE ); +} +BOOLEAN InitializeInvPanelCoordsVehicle( ) +{ + InitializeInvPanelCoordsNew(); + // Inventory slots + if(iResolution == 0){ + gMapScreenInvPocketXY[14].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[14].sY = PLAYER_INFO_Y + 89; + gMapScreenInvPocketXY[15].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[15].sY = PLAYER_INFO_Y + 89; + gMapScreenInvPocketXY[16].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[16].sY = PLAYER_INFO_Y + 89; + gMapScreenInvPocketXY[17].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[17].sY = PLAYER_INFO_Y + 110; + gMapScreenInvPocketXY[18].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[18].sY = PLAYER_INFO_Y + 110; + gMapScreenInvPocketXY[19].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[19].sY = PLAYER_INFO_Y + 110; + gMapScreenInvPocketXY[20].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[20].sY = PLAYER_INFO_Y + 131; + gMapScreenInvPocketXY[21].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[21].sY = PLAYER_INFO_Y + 131; + gMapScreenInvPocketXY[22].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[22].sY = PLAYER_INFO_Y + 131; + gMapScreenInvPocketXY[23].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[23].sY = PLAYER_INFO_Y + 152; + gMapScreenInvPocketXY[24].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[24].sY = PLAYER_INFO_Y + 152; + gMapScreenInvPocketXY[25].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[25].sY = PLAYER_INFO_Y + 152; + gMapScreenInvPocketXY[26].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[26].sY = PLAYER_INFO_Y + 173; + gMapScreenInvPocketXY[27].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[27].sY = PLAYER_INFO_Y + 173; + gMapScreenInvPocketXY[28].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[28].sY = PLAYER_INFO_Y + 173; + gMapScreenInvPocketXY[29].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[29].sY = PLAYER_INFO_Y + 194; + gMapScreenInvPocketXY[30].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[30].sY = PLAYER_INFO_Y + 194; + gMapScreenInvPocketXY[31].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[31].sY = PLAYER_INFO_Y + 194; + gMapScreenInvPocketXY[32].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[32].sY = PLAYER_INFO_Y + 215; + gMapScreenInvPocketXY[33].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[33].sY = PLAYER_INFO_Y + 215; + gMapScreenInvPocketXY[34].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[34].sY = PLAYER_INFO_Y + 215; + gMapScreenInvPocketXY[35].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[35].sY = PLAYER_INFO_Y + 236; + gMapScreenInvPocketXY[36].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[36].sY = PLAYER_INFO_Y + 236; + gMapScreenInvPocketXY[37].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[37].sY = PLAYER_INFO_Y + 236; + gMapScreenInvPocketXY[38].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[38].sY = PLAYER_INFO_Y + 257; + gMapScreenInvPocketXY[39].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[39].sY = PLAYER_INFO_Y + 257; + gMapScreenInvPocketXY[40].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[40].sY = PLAYER_INFO_Y + 257; + gMapScreenInvPocketXY[41].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[41].sY = PLAYER_INFO_Y + 278; + gMapScreenInvPocketXY[42].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[42].sY = PLAYER_INFO_Y + 278; + gMapScreenInvPocketXY[43].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[43].sY = PLAYER_INFO_Y + 278; + gMapScreenInvPocketXY[44].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[44].sY = PLAYER_INFO_Y + 299; + gMapScreenInvPocketXY[45].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[45].sY = PLAYER_INFO_Y + 299; + gMapScreenInvPocketXY[46].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[46].sY = PLAYER_INFO_Y + 299; + gMapScreenInvPocketXY[47].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[47].sY = PLAYER_INFO_Y + 320; + gMapScreenInvPocketXY[48].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[48].sY = PLAYER_INFO_Y + 320; + gMapScreenInvPocketXY[49].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[49].sY = PLAYER_INFO_Y + 320; + gMapScreenInvPocketXY[50].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[50].sY = PLAYER_INFO_Y + 341; + gMapScreenInvPocketXY[51].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[51].sY = PLAYER_INFO_Y + 341; + gMapScreenInvPocketXY[52].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[52].sY = PLAYER_INFO_Y + 341; + } + else{ + gMapScreenInvPocketXY[14].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[14].sY = PLAYER_INFO_Y + 156; + gMapScreenInvPocketXY[15].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[15].sY = PLAYER_INFO_Y + 156; + gMapScreenInvPocketXY[16].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[16].sY = PLAYER_INFO_Y + 156; + gMapScreenInvPocketXY[17].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[17].sY = PLAYER_INFO_Y + 180; + gMapScreenInvPocketXY[18].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[18].sY = PLAYER_INFO_Y + 180; + gMapScreenInvPocketXY[19].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[19].sY = PLAYER_INFO_Y + 180; + gMapScreenInvPocketXY[20].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[20].sY = PLAYER_INFO_Y + 204; + gMapScreenInvPocketXY[21].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[21].sY = PLAYER_INFO_Y + 204; + gMapScreenInvPocketXY[22].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[22].sY = PLAYER_INFO_Y + 204; + gMapScreenInvPocketXY[23].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[23].sY = PLAYER_INFO_Y + 228; + gMapScreenInvPocketXY[24].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[24].sY = PLAYER_INFO_Y + 228; + gMapScreenInvPocketXY[25].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[25].sY = PLAYER_INFO_Y + 228; + gMapScreenInvPocketXY[26].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[26].sY = PLAYER_INFO_Y + 252; + gMapScreenInvPocketXY[27].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[27].sY = PLAYER_INFO_Y + 252; + gMapScreenInvPocketXY[28].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[28].sY = PLAYER_INFO_Y + 252; + gMapScreenInvPocketXY[29].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[29].sY = PLAYER_INFO_Y + 276; + gMapScreenInvPocketXY[30].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[30].sY = PLAYER_INFO_Y + 276; + gMapScreenInvPocketXY[31].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[31].sY = PLAYER_INFO_Y + 276; + gMapScreenInvPocketXY[32].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[32].sY = PLAYER_INFO_Y + 300; + gMapScreenInvPocketXY[33].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[33].sY = PLAYER_INFO_Y + 300; + gMapScreenInvPocketXY[34].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[34].sY = PLAYER_INFO_Y + 300; + gMapScreenInvPocketXY[35].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[35].sY = PLAYER_INFO_Y + 324; + gMapScreenInvPocketXY[36].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[36].sY = PLAYER_INFO_Y + 324; + gMapScreenInvPocketXY[37].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[37].sY = PLAYER_INFO_Y + 324; + gMapScreenInvPocketXY[38].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[38].sY = PLAYER_INFO_Y + 348; + gMapScreenInvPocketXY[39].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[39].sY = PLAYER_INFO_Y + 348; + gMapScreenInvPocketXY[40].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[40].sY = PLAYER_INFO_Y + 348; + gMapScreenInvPocketXY[41].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[41].sY = PLAYER_INFO_Y + 372; + gMapScreenInvPocketXY[42].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[42].sY = PLAYER_INFO_Y + 372; + gMapScreenInvPocketXY[43].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[43].sY = PLAYER_INFO_Y + 372; + gMapScreenInvPocketXY[44].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[44].sY = PLAYER_INFO_Y + 396; + gMapScreenInvPocketXY[45].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[45].sY = PLAYER_INFO_Y + 396; + gMapScreenInvPocketXY[46].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[46].sY = PLAYER_INFO_Y + 396; + gMapScreenInvPocketXY[47].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[47].sY = PLAYER_INFO_Y + 420; + gMapScreenInvPocketXY[48].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[48].sY = PLAYER_INFO_Y + 420; + gMapScreenInvPocketXY[49].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[49].sY = PLAYER_INFO_Y + 420; + gMapScreenInvPocketXY[50].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[50].sY = PLAYER_INFO_Y + 444; + gMapScreenInvPocketXY[51].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[51].sY = PLAYER_INFO_Y + 444; + gMapScreenInvPocketXY[52].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[52].sY = PLAYER_INFO_Y + 444; + } + + return ( TRUE ); +} + // the tries to select a mapscreen character by his soldier ID BOOLEAN SetInfoChar( UINT8 ubID ) { @@ -1136,7 +1750,7 @@ void ContractBoxGlow( void ) { // restore background // RestoreExternBackgroundRect( CONTRACT_X, CONTRACT_Y, CONTRACT_WIDTH+1, CONTRACT_HEIGHT+1 ); - + // reset old fOldContractGlow = FALSE; } @@ -1161,7 +1775,7 @@ void ContractBoxGlow( void ) // change direction of glow? if((iColorNum==0)||(iColorNum==10)) { - fDelta=!fDelta; + fDelta=!fDelta; } // increment color @@ -1171,9 +1785,9 @@ void ContractBoxGlow( void ) iColorNum--; usColor=Get16BPPColor( FROMRGB( GlowColorsA[iColorNum].ubRed, GlowColorsA[iColorNum].ubGreen, GlowColorsA[iColorNum].ubBlue ) ); - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, 640, 480); - RectangleDraw( TRUE, CONTRACT_X, CONTRACT_Y, CONTRACT_X+CONTRACT_WIDTH, CONTRACT_Y+CONTRACT_HEIGHT, usColor, pDestBuf ); + RectangleDraw( TRUE, CONTRACT_X, CONTRACT_Y, CONTRACT_X+CONTRACT_WIDTH, CONTRACT_Y+CONTRACT_HEIGHT, usColor, pDestBuf ); InvalidateRegion(CONTRACT_X, CONTRACT_Y, CONTRACT_X+CONTRACT_WIDTH+1, CONTRACT_Y+CONTRACT_HEIGHT+1); UnLockVideoSurface( FRAME_BUFFER ); @@ -1192,7 +1806,6 @@ void ContractListRegionBoxGlow( UINT16 usCount ) UINT32 uiDestPitchBYTES; UINT8 *pDestBuf; INT16 usY = 0; - INT16 sYAdd = 0; INT16 sYStart = 0; INT16 usVehicleCount = 0; @@ -1213,7 +1826,7 @@ void ContractListRegionBoxGlow( UINT16 usCount ) // change direction of glow? if((iColorNum==0)||(iColorNum==10)) { - fDelta=!fDelta; + fDelta=!fDelta; } // increment color @@ -1227,24 +1840,24 @@ void ContractListRegionBoxGlow( UINT16 usCount ) { usVehicleCount = usCount - FIRST_VEHICLE; sYStart = usVehicleY; - usY=(Y_OFFSET*usVehicleCount-1)+(sYStart+(usVehicleCount*Y_SIZE)); + usY=(Y_OFFSET*usVehicleCount-1)+(sYStart+(usVehicleCount*Y_SIZE)); } else { sYStart = Y_START; - usY=(Y_OFFSET*usCount-1)+(sYStart+(usCount*Y_SIZE)); + usY=(Y_OFFSET*usCount-1)+(sYStart+(usCount*Y_SIZE)); } // y start position of box - //usY=(Y_OFFSET*usCount-1)+(Y_START+(usCount*Y_SIZE) + sYAdd ); + //usY=(Y_OFFSET*usCount-1)+(Y_START+(usCount*Y_SIZE) + sYAdd ); - //usY=(Y_OFFSET*usCount-1)+(sYStart+(usCount*Y_SIZE)); + //usY=(Y_OFFSET*usCount-1)+(sYStart+(usCount*Y_SIZE)); // glow contract box usColor=Get16BPPColor( FROMRGB( GlowColorsA[iColorNum].ubRed, GlowColorsA[iColorNum].ubGreen, GlowColorsA[iColorNum].ubBlue ) ); - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - RectangleDraw( TRUE, TIME_REMAINING_X, usY, TIME_REMAINING_X + TIME_REMAINING_WIDTH, usY + GetFontHeight( MAP_SCREEN_FONT ) + 2, usColor, pDestBuf ); + RectangleDraw( TRUE, TIME_REMAINING_X, usY, TIME_REMAINING_X + TIME_REMAINING_WIDTH, usY + GetFontHeight( MAP_SCREEN_FONT ) + 2, usColor, pDestBuf ); InvalidateRegion(TIME_REMAINING_X - 1, usY, TIME_REMAINING_X + TIME_REMAINING_WIDTH + 1, usY + GetFontHeight( MAP_SCREEN_FONT ) + 3 ); UnLockVideoSurface( FRAME_BUFFER ); @@ -1264,7 +1877,6 @@ void GlowFace( void ) UINT16 usColor; UINT32 uiDestPitchBYTES; UINT8 *pDestBuf; - INT16 usY = 0; // not glowing right now, leave @@ -1292,7 +1904,7 @@ void GlowFace( void ) // change direction of glow? if((iColorNum==0)||(iColorNum==10)) { - fDelta=!fDelta; + fDelta=!fDelta; } // increment color @@ -1303,9 +1915,9 @@ void GlowFace( void ) // glow contract box usColor=Get16BPPColor( FROMRGB( GlowColorsA[iColorNum].ubRed, GlowColorsA[iColorNum].ubGreen, GlowColorsA[iColorNum].ubBlue ) ); - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - RectangleDraw( TRUE, 9, 18, 60, 63 , usColor, pDestBuf ); + RectangleDraw( TRUE, 9, 18, 60, 63 , usColor, pDestBuf ); InvalidateRegion( 9, 18, 61, 64 ); UnLockVideoSurface( FRAME_BUFFER ); @@ -1323,7 +1935,6 @@ void GlowItem( void ) UINT16 usColor; UINT32 uiDestPitchBYTES; UINT8 *pDestBuf; - INT16 usY = 0; // not glowing right now, leave @@ -1351,7 +1962,7 @@ void GlowItem( void ) // change direction of glow? if((iColorNum==0)||(iColorNum==10)) { - fDelta=!fDelta; + fDelta=!fDelta; } // increment color @@ -1369,9 +1980,9 @@ void GlowItem( void ) // glow contract box usColor=Get16BPPColor( FROMRGB( GlowColorsA[iColorNum].ubRed, GlowColorsA[iColorNum].ubGreen, GlowColorsA[iColorNum].ubBlue ) ); - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - RectangleDraw( TRUE, 3, 80, 64, 104 , usColor, pDestBuf ); + RectangleDraw( TRUE, 3, 80, 64, 104 , usColor, pDestBuf ); InvalidateRegion( 3, 80, 65, 105 ); UnLockVideoSurface( FRAME_BUFFER ); } @@ -1385,7 +1996,6 @@ void GlowTrashCan( void ) UINT16 usColor; UINT32 uiDestPitchBYTES; UINT8 *pDestBuf; - INT16 usY = 0; if( fShowInventoryFlag == FALSE ) @@ -1417,9 +2027,9 @@ void GlowTrashCan( void ) // glow contract box usColor=Get16BPPColor( FROMRGB( GlowColorsA[iColorNum].ubRed, GlowColorsA[iColorNum].ubGreen, GlowColorsA[iColorNum].ubBlue ) ); - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - RectangleDraw( TRUE, TRASH_CAN_X, TRASH_CAN_Y , TRASH_CAN_X + TRASH_CAN_WIDTH, TRASH_CAN_Y + TRASH_CAN_HEIGHT , usColor, pDestBuf ); + RectangleDraw( TRUE, TRASH_CAN_X, TRASH_CAN_Y , TRASH_CAN_X + TRASH_CAN_WIDTH, TRASH_CAN_Y + TRASH_CAN_HEIGHT , usColor, pDestBuf ); InvalidateRegion( TRASH_CAN_X, TRASH_CAN_Y, TRASH_CAN_X + TRASH_CAN_WIDTH + 1, TRASH_CAN_Y + TRASH_CAN_HEIGHT + 1 ); UnLockVideoSurface( FRAME_BUFFER ); @@ -1434,7 +2044,7 @@ void DrawFace( INT16 sCharNumber ) { SOLDIERTYPE *pSoldier = NULL; static INT16 sOldId = -1; - + // draws the face of the currently selected merc, being displayed int he upper left hand corner // grab the soldier @@ -1466,7 +2076,7 @@ void DrawFace( INT16 sCharNumber ) // render their face RenderSoldierFace( pSoldier, SOLDIER_PIC_X, SOLDIER_PIC_Y, TRUE ); - + return; } @@ -1499,7 +2109,7 @@ void RenderHandPosItem( void ) } // check if still alive? - if( pSoldier -> bLife == 0 ) + if( pSoldier->stats.bLife == 0 ) { return; } @@ -1537,7 +2147,7 @@ void RenderIconsForUpperLeftCornerPiece( INT8 bCharNumber ) if( Menptr[ gCharactersList[ bCharNumber ].usSolID ].usMedicalDeposit > 0 ) { // draw medical deposit icon - BltVideoObject( guiSAVEBUFFER, hHandle, 1, CHAR_ICON_X, CHAR_ICON_CONTRACT_Y + ( 2 * CHAR_ICON_SPACING ), VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( guiSAVEBUFFER, hHandle, 1, CHAR_ICON_X, CHAR_ICON_CONTRACT_Y + ( 2 * CHAR_ICON_SPACING ), VO_BLT_SRCTRANSPARENCY, NULL ); } } @@ -1552,22 +2162,22 @@ void DrawPay(INT16 sCharNumber) // get merc id - usMercProfileID = MercPtrs[ gCharactersList[ sCharNumber ].usSolID ] -> ubProfile; - + usMercProfileID = MercPtrs[ gCharactersList[ sCharNumber ].usSolID ]->ubProfile; + // grab salary uiSalary=( ( UINT32 ) gMercProfiles[ usMercProfileID ].sSalary ); - - + + // font stuff SetFontForeground( CHAR_TITLE_FONT_COLOR ); SetFontBackground( FONT_BLACK ); - - // parse salary + + // parse salary swprintf( sString, L"%d", uiSalary ); - + // right justify salary FindFontRightCoordinates(CHAR_PAY_X,CHAR_PAY_Y , CHAR_PAY_WID,CHAR_PAY_HEI ,sString , CHAR_FONT, &usX, &usY); - + // draw salary DrawString(sString,usX, usY, CHAR_FONT); } @@ -1577,7 +2187,7 @@ void DrawCharBars( void ) UINT16 usSoldierID; SOLDIERTYPE *pSoldier; - // will draw the heath, morale and breath bars for a character being displayed in the upper left hand corner + // will draw the heath, morale and breath bars for a character being displayed in the upper left hand corner if( ( bSelectedInfoChar == -1 )&&( bSelectedDestChar == -1 ) ) { @@ -1606,7 +2216,7 @@ void DrawCharBars( void ) } // skip POWs, dead guys - if( ( pSoldier->bLife == 0 ) || + if( ( pSoldier->stats.bLife == 0 ) || ( pSoldier->bAssignment == ASSIGNMENT_DEAD ) || ( pSoldier->bAssignment == ASSIGNMENT_POW ) ) { @@ -1624,7 +2234,7 @@ void DrawCharBars( void ) } // vehicles and robot don't have morale - if ( !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) ) + if ( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) ) { // draw morale bar DrawMoraleUIBarEx( pSoldier, BAR_INFO_X + 12, BAR_INFO_Y,3,42, TRUE, FRAME_BUFFER ); @@ -1649,12 +2259,12 @@ void DrawCharStats( INT16 sCharNum ) SetFont(CHAR_FONT); SetFontForeground(CHAR_TEXT_FONT_COLOR); SetFontBackground(FONT_BLACK); - + // strength - swprintf( sString, L"%d", pSoldier->bStrength); + swprintf( sString, L"%d", pSoldier->stats.bStrength); - if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + pSoldier->uiChangeStrengthTime)&& ( pSoldier->uiChangeStrengthTime != 0 ) ) + if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + pSoldier->timeChanges.uiChangeStrengthTime)&& ( pSoldier->timeChanges.uiChangeStrengthTime != 0 ) ) { if( pSoldier->usValueGoneUp & STRENGTH_INCREASE ) { @@ -1674,10 +2284,10 @@ void DrawCharStats( INT16 sCharNum ) FindFontRightCoordinates(STR_X, STR_Y ,STAT_WID ,STAT_HEI ,sString, CHAR_FONT, &usX, &usY); DrawString(sString,usX, STR_Y,CHAR_FONT ); - // dexterity - swprintf( sString, L"%d", pSoldier->bDexterity ); + // dexterity + swprintf( sString, L"%d", pSoldier->stats.bDexterity ); - if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + pSoldier->uiChangeDexterityTime ) && ( pSoldier->uiChangeDexterityTime != 0 ) ) + if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + pSoldier->timeChanges.uiChangeDexterityTime ) && ( pSoldier->timeChanges.uiChangeDexterityTime != 0 ) ) { if( pSoldier->usValueGoneUp & DEX_INCREASE ) { @@ -1694,13 +2304,13 @@ void DrawCharStats( INT16 sCharNum ) } // right justify - FindFontRightCoordinates(DEX_X,DEX_Y ,STAT_WID ,STAT_HEI ,sString , CHAR_FONT, &usX, &usY); + FindFontRightCoordinates(DEX_X,DEX_Y ,STAT_WID ,STAT_HEI ,sString , CHAR_FONT, &usX, &usY); DrawString(sString,usX, DEX_Y,CHAR_FONT ); // agility - swprintf( sString, L"%d", pSoldier->bAgility ); + swprintf( sString, L"%d", pSoldier->stats.bAgility ); - if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + pSoldier->uiChangeAgilityTime)&& ( pSoldier->uiChangeAgilityTime != 0 ) ) + if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + pSoldier->timeChanges.uiChangeAgilityTime)&& ( pSoldier->timeChanges.uiChangeAgilityTime != 0 ) ) { if( pSoldier->usValueGoneUp & AGIL_INCREASE ) { @@ -1721,9 +2331,9 @@ void DrawCharStats( INT16 sCharNum ) DrawString(sString,usX, AGL_Y,CHAR_FONT ); // wisdom - swprintf( sString, L"%d", pSoldier->bWisdom ); + swprintf( sString, L"%d", pSoldier->stats.bWisdom ); - if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + pSoldier->uiChangeWisdomTime )&&( pSoldier->uiChangeWisdomTime != 0 )) + if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + pSoldier->timeChanges.uiChangeWisdomTime )&&( pSoldier->timeChanges.uiChangeWisdomTime != 0 )) { if( pSoldier->usValueGoneUp & WIS_INCREASE ) { @@ -1744,9 +2354,9 @@ void DrawCharStats( INT16 sCharNum ) DrawString(sString,usX, WIS_Y,CHAR_FONT ); // leadership - swprintf( sString, L"%d", pSoldier->bLeadership ); - - if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + pSoldier->uiChangeLeadershipTime ) && ( pSoldier->uiChangeLeadershipTime != 0 ) ) + swprintf( sString, L"%d", pSoldier->stats.bLeadership ); + + if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + pSoldier->timeChanges.uiChangeLeadershipTime ) && ( pSoldier->timeChanges.uiChangeLeadershipTime != 0 ) ) { if( pSoldier->usValueGoneUp & LDR_INCREASE ) { @@ -1767,9 +2377,9 @@ void DrawCharStats( INT16 sCharNum ) DrawString(sString,usX, LDR_Y,CHAR_FONT ); // experience level - swprintf( sString, L"%d", pSoldier->bExpLevel ); + swprintf( sString, L"%d", pSoldier->stats.bExpLevel ); - if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + pSoldier->uiChangeLevelTime)&&( pSoldier->uiChangeLevelTime != 0 ) ) + if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + pSoldier->timeChanges.uiChangeLevelTime)&&( pSoldier->timeChanges.uiChangeLevelTime != 0 ) ) { if( pSoldier->usValueGoneUp & LVL_INCREASE ) { @@ -1787,12 +2397,12 @@ void DrawCharStats( INT16 sCharNum ) // right justify FindFontRightCoordinates(LVL_X,LVL_Y,STAT_WID ,STAT_HEI,sString , CHAR_FONT, &usX, &usY); - DrawString(sString,usX, LVL_Y,CHAR_FONT ); + DrawString(sString,usX, LVL_Y,CHAR_FONT ); // marksmanship - swprintf( sString, L"%d", pSoldier->bMarksmanship ); + swprintf( sString, L"%d", pSoldier->stats.bMarksmanship ); - if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + pSoldier->uiChangeMarksmanshipTime) && ( pSoldier->uiChangeMarksmanshipTime != 0 ) ) + if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + pSoldier->timeChanges.uiChangeMarksmanshipTime) && ( pSoldier->timeChanges.uiChangeMarksmanshipTime != 0 ) ) { if( pSoldier->usValueGoneUp & MRK_INCREASE ) { @@ -1808,14 +2418,14 @@ void DrawCharStats( INT16 sCharNum ) SetFontForeground(CHAR_TEXT_FONT_COLOR); } - // right justify + // right justify FindFontRightCoordinates(MRK_X,MRK_Y,STAT_WID ,STAT_HEI,sString , CHAR_FONT, &usX, &usY); - DrawString(sString,usX, MRK_Y,CHAR_FONT ); + DrawString(sString,usX, MRK_Y,CHAR_FONT ); // explosives - swprintf( sString, L"%d", pSoldier->bExplosive ); + swprintf( sString, L"%d", pSoldier->stats.bExplosive ); - if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + pSoldier->uiChangeExplosivesTime)&& ( pSoldier->uiChangeExplosivesTime != 0 ) ) + if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + pSoldier->timeChanges.uiChangeExplosivesTime)&& ( pSoldier->timeChanges.uiChangeExplosivesTime != 0 ) ) { if( pSoldier->usValueGoneUp & EXP_INCREASE ) { @@ -1833,12 +2443,12 @@ void DrawCharStats( INT16 sCharNum ) // right justify FindFontRightCoordinates(EXP_X,EXP_Y,STAT_WID ,STAT_HEI,sString , CHAR_FONT, &usX, &usY); - DrawString(sString,usX, EXP_Y,CHAR_FONT ); - - // mechanical - swprintf( sString, L"%d", pSoldier->bMechanical ); + DrawString(sString,usX, EXP_Y,CHAR_FONT ); - if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + pSoldier->uiChangeMechanicalTime )&& ( pSoldier->uiChangeMechanicalTime != 0 ) ) + // mechanical + swprintf( sString, L"%d", pSoldier->stats.bMechanical ); + + if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + pSoldier->timeChanges.uiChangeMechanicalTime )&& ( pSoldier->timeChanges.uiChangeMechanicalTime != 0 ) ) { if( pSoldier->usValueGoneUp & MECH_INCREASE ) { @@ -1856,12 +2466,12 @@ void DrawCharStats( INT16 sCharNum ) // right justify FindFontRightCoordinates(MEC_X,MEC_Y,STAT_WID ,STAT_HEI,sString , CHAR_FONT, &usX, &usY); - DrawString(sString,usX, MEC_Y,CHAR_FONT ); - - // medical - swprintf( sString, L"%d", pSoldier->bMedical ); + DrawString(sString,usX, MEC_Y,CHAR_FONT ); - if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + pSoldier->uiChangeMedicalTime)&& ( pSoldier->uiChangeMedicalTime != 0 ) ) + // medical + swprintf( sString, L"%d", pSoldier->stats.bMedical ); + + if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + pSoldier->timeChanges.uiChangeMedicalTime)&& ( pSoldier->timeChanges.uiChangeMedicalTime != 0 ) ) { if( pSoldier->usValueGoneUp & MED_INCREASE ) { @@ -1901,13 +2511,13 @@ void DrawCharHealth( INT16 sCharNum ) if( pSoldier->bAssignment != ASSIGNMENT_POW ) { // find starting X coordinate by centering all 3 substrings together, then print them separately (different colors)! - swprintf( sString, L"%d/%d", pSoldier->bLife, pSoldier->bLifeMax ); + swprintf( sString, L"%d/%d", pSoldier->stats.bLife, pSoldier->stats.bLifeMax ); FindFontCenterCoordinates(CHAR_HP_X, CHAR_HP_Y, CHAR_HP_WID, CHAR_HP_HEI, sString, CHAR_FONT, &usX, &usY); - if ( pSoldier->bLifeMax > 0 ) + if ( pSoldier->stats.bLifeMax > 0 ) { - uiHealthPercent = ( pSoldier->bLife * 100 ) / pSoldier->bLifeMax; + uiHealthPercent = ( pSoldier->stats.bLife * 100 ) / pSoldier->stats.bLifeMax; } // how is characters life? @@ -1935,7 +2545,7 @@ void DrawCharHealth( INT16 sCharNum ) } // current life - swprintf( sString, L"%d", pSoldier->bLife ); + swprintf( sString, L"%d", pSoldier->stats.bLife ); DrawString( sString, usX, CHAR_HP_Y, CHAR_FONT ); usX += StringPixLength( sString, CHAR_FONT ); @@ -1947,7 +2557,7 @@ void DrawCharHealth( INT16 sCharNum ) usX += StringPixLength( sString, CHAR_FONT ); - if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + pSoldier->uiChangeHealthTime)&& ( pSoldier->uiChangeHealthTime != 0 ) ) + if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + pSoldier->timeChanges.uiChangeHealthTime)&& ( pSoldier->timeChanges.uiChangeHealthTime != 0 ) ) { if( pSoldier->usValueGoneUp & HEALTH_INCREASE ) { @@ -1964,7 +2574,7 @@ void DrawCharHealth( INT16 sCharNum ) } // maximum life - swprintf( sString, L"%d", pSoldier->bLifeMax ); + swprintf( sString, L"%d", pSoldier->stats.bLifeMax ); DrawString( sString, usX, CHAR_HP_Y, CHAR_FONT ); } else @@ -1989,7 +2599,6 @@ void DrawCharacterInfo(INT16 sCharNumber) INT16 usX, usY; INT16 usMercProfileID; INT32 iTimeRemaining=0; - INT8 bMorale =0; INT32 iDailyCost = 0; SOLDIERTYPE *pSoldier = NULL; UINT32 uiArrivalTime; @@ -2009,7 +2618,7 @@ void DrawCharacterInfo(INT16 sCharNumber) // draw particular info about a character that are neither attributes nor skills - + // get profile information usMercProfileID = pSoldier->ubProfile; @@ -2022,7 +2631,7 @@ void DrawCharacterInfo(INT16 sCharNumber) // Nickname (beneath Picture) - if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // vehicle wcscpy(sString, pShortVehicleStrings[ pVehicleList[ pSoldier->bVehicleID ].ubVehicleType ]); @@ -2038,7 +2647,7 @@ void DrawCharacterInfo(INT16 sCharNumber) // Full name (Top Box) - if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // vehicle wcscpy(sString, pVehicleStrings[ pVehicleList[ pSoldier->bVehicleID ].ubVehicleType ]); @@ -2083,13 +2692,13 @@ void DrawCharacterInfo(INT16 sCharNumber) // repairing? else if( pSoldier->bAssignment == REPAIR ) { - if ( pSoldier->fFixingRobot ) + if ( pSoldier->flags.fFixingRobot ) { // robot wcscpy( sString, pRepairStrings[ 3 ] ); } /* - else if ( pSoldier->fFixingSAMSite ) + else if ( pSoldier->flags.fFixingSAMSite ) { // SAM site wcscpy( sString, pRepairStrings[ 1 ] ); @@ -2137,20 +2746,20 @@ void DrawCharacterInfo(INT16 sCharNumber) // if a vehicle or robot - if( ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) || AM_A_ROBOT( pSoldier ) ) + if( ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) || AM_A_ROBOT( pSoldier ) ) { // we're done - the remainder applies only to people return; } - // draw attributes & skills for currently displayed character + // draw attributes & skills for currently displayed character DrawCharStats(sCharNumber); // remaining contract length // dead? - if( pSoldier->bLife <= 0 ) + if( pSoldier->stats.bLife <= 0 ) { swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); } @@ -2180,12 +2789,12 @@ void DrawCharacterInfo(INT16 sCharNumber) // more than a day, display in green iTimeRemaining /= (60*24); - if( pSoldier->bLife > 0 ) + if( pSoldier->stats.bLife > 0 ) { SetFontForeground(FONT_LTGREEN); } - swprintf(sString, L"%.1f%s/%d%s", dTimeLeft, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ], pSoldier->iTotalContractLength, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ]); + swprintf(sString, L"%.1f%s/%d%s", dTimeLeft, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ], pSoldier->iTotalContractLength, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ]); } else { @@ -2207,19 +2816,19 @@ void DrawCharacterInfo(INT16 sCharNumber) iTimeRemaining /= 60; } - if( pSoldier->bLife > 0 ) + if( pSoldier->stats.bLife > 0 ) { SetFontForeground(FONT_RED); } - swprintf(sString, L"%d%s/%d%s",iTimeRemaining, gpStrategicString[ STR_PB_HOURS_ABBREVIATION ], pSoldier->iTotalContractLength, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ]); + swprintf(sString, L"%d%s/%d%s",iTimeRemaining, gpStrategicString[ STR_PB_HOURS_ABBREVIATION ], pSoldier->iTotalContractLength, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ]); } } else if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__MERC ) { INT32 iBeenHiredFor = ( GetWorldTotalMin( ) / NUM_MIN_IN_DAY ) - pSoldier->iStartContractTime; - swprintf(sString, L"%d%s/%d%s",gMercProfiles[ pSoldier->ubProfile ].iMercMercContractLength, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ], iBeenHiredFor, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ] ); + swprintf(sString, L"%d%s/%d%s",gMercProfiles[ pSoldier->ubProfile ].iMercMercContractLength, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ], iBeenHiredFor, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ] ); } else { @@ -2262,8 +2871,8 @@ void DrawCharacterInfo(INT16 sCharNumber) // insert commas and dollar sign InsertCommasForDollarFigure( sString ); - InsertDollarSignInToString( sString ); - + InsertDollarSignInToString( sString ); + FindFontRightCoordinates(CHAR_SALARY_X, CHAR_SALARY_Y, CHAR_SALARY_WID, CHAR_SALARY_HEI, sString, CHAR_FONT, &usX, &usY); DrawString(sString,usX,usY, CHAR_FONT); @@ -2277,7 +2886,7 @@ void DrawCharacterInfo(INT16 sCharNumber) InsertCommasForDollarFigure( sString ); InsertDollarSignInToString( sString ); - FindFontRightCoordinates(CHAR_MEDICAL_X, CHAR_MEDICAL_Y, CHAR_MEDICAL_WID, CHAR_MEDICAL_HEI, sString, CHAR_FONT, &usX, &usY); + FindFontRightCoordinates(CHAR_MEDICAL_X, CHAR_MEDICAL_Y, CHAR_MEDICAL_WID, CHAR_MEDICAL_HEI, sString, CHAR_FONT, &usX, &usY); DrawString(sString,usX,CHAR_MEDICAL_Y, CHAR_FONT); } @@ -2293,7 +2902,7 @@ void DrawCharacterInfo(INT16 sCharNumber) // morale if( pSoldier->bAssignment != ASSIGNMENT_POW ) { - if ( pSoldier->bLife != 0 ) + if ( pSoldier->stats.bLife != 0 ) { GetMoraleString( MercPtrs[gCharactersList[sCharNumber].usSolID], sString ); } @@ -2308,10 +2917,10 @@ void DrawCharacterInfo(INT16 sCharNumber) swprintf( sString, pPOWStrings[ 1 ] ); } - FindFontCenterCoordinates(CHAR_MORALE_X, CHAR_MORALE_Y, CHAR_MORALE_WID, CHAR_MORALE_HEI, sString, CHAR_FONT, &usX, &usY); + FindFontCenterCoordinates(CHAR_MORALE_X, CHAR_MORALE_Y, CHAR_MORALE_WID, CHAR_MORALE_HEI, sString, CHAR_FONT, &usX, &usY); DrawString(sString,usX,CHAR_MORALE_Y, CHAR_FONT); - + return; } @@ -2414,13 +3023,13 @@ INT32 GetPathTravelTimeDuringPlotting( PathStPtr pPath ) if( pGroup == NULL ) { SetUpMvtGroupForVehicle( &( Menptr[gCharactersList[bSelectedDestChar].usSolID] ) ); - + // get vehicle id ubGroupId = pVehicleList[ Menptr[gCharactersList[bSelectedDestChar].usSolID].iVehicleId ].ubMovementGroup; pGroup = GetGroup( ubGroupId ); } } - else if( Menptr[gCharactersList[bSelectedDestChar].usSolID].uiStatusFlags & SOLDIER_VEHICLE ) + else if( Menptr[gCharactersList[bSelectedDestChar].usSolID].flags.uiStatusFlags & SOLDIER_VEHICLE ) { ubGroupId = pVehicleList[ Menptr[gCharactersList[bSelectedDestChar].usSolID].bVehicleID ].ubMovementGroup; pGroup = GetGroup( ubGroupId ); @@ -2485,7 +3094,7 @@ INT32 GetPathTravelTimeDuringPlotting( PathStPtr pPath ) pPath = pPath->pNext; } - + return( iTravelTime ); } @@ -2501,7 +3110,7 @@ void DisplayGroundEta( void ) return; } - if( bSelectedDestChar == -1 ) + if( bSelectedDestChar == -1 ) { return; } @@ -2519,7 +3128,7 @@ void DisplayGroundEta( void ) SetFontForeground( FONT_LTGREEN ); SetFontBackground( FONT_BLACK ); - mprintf( CLOCK_ETA_X, CLOCK_Y_START, pEtaString[ 0 ] ); + mprintf( CLOCK_ETA_X, CLOCK_Y_START, pEtaString[ 0 ] ); // if less than one day if( ( iTotalTime / ( 60 * 24 ) ) < 1 ) @@ -2541,7 +3150,7 @@ void DisplayGroundEta( void ) void HighLightAssignLine() { UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; + UINT8 *pDestBuf; UINT16 usColor; static INT32 iColorNum = STARTING_COLOR_NUM; static BOOLEAN fDelta=FALSE; @@ -2576,14 +3185,14 @@ void HighLightAssignLine() if((iColorNum==0)||(iColorNum==10)) { - fDelta=!fDelta; + fDelta=!fDelta; } if(!fDelta) iColorNum++; else iColorNum--; - - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); for( usCount = 0; usCount < MAX_CHARACTER_COUNT; usCount++ ) @@ -2593,15 +3202,15 @@ void HighLightAssignLine() usX=ASSIGN_X; //usY=Y_START+(giHighLine*GetFontHeight((MAP_SCREEN_FONT))); usY=(Y_OFFSET*usCount-1)+(Y_START+(usCount*Y_SIZE)); - + if( usCount >= FIRST_VEHICLE ) { usVehicleCount = usCount - FIRST_VEHICLE; usY = (Y_OFFSET*usVehicleCount-1)+(usVehicleY+(usVehicleCount*Y_SIZE)); } - + usColor=Get16BPPColor( FROMRGB( GlowColorsA[iColorNum].ubRed, GlowColorsA[iColorNum].ubGreen, GlowColorsA[iColorNum].ubBlue ) ); - + LineDraw(TRUE, usX, usY, usX, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf); LineDraw(TRUE, usX+ASSIGN_WIDTH, usY, usX+ASSIGN_WIDTH, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf); if( ( usCount == 0 ) || ( usCount != 0 ? !( IsCharacterSelectedForAssignment( ( UINT16 )( usCount - 1 ) ) ) : 0 ) || ( usCount == FIRST_VEHICLE ) ) @@ -2617,7 +3226,7 @@ void HighLightAssignLine() InvalidateRegion( usX, usY, usX+ASSIGN_WIDTH+1, usY+GetFontHeight(MAP_SCREEN_FONT)+3); } } - + UnLockVideoSurface( FRAME_BUFFER ); } @@ -2625,7 +3234,7 @@ void HighLightAssignLine() void HighLightDestLine() { UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; + UINT8 *pDestBuf; UINT16 usColor; static INT32 iColorNum = STARTING_COLOR_NUM; static BOOLEAN fDelta=FALSE; @@ -2641,13 +3250,13 @@ void HighLightDestLine() uiOldHighlight = MAX_CHARACTER_COUNT + 1; return; } - + // if not ready to change glow phase yet, leave if ( !gfGlowTimerExpired ) return; - // check if we have moved lines, if so, reset + // check if we have moved lines, if so, reset if( uiOldHighlight != giDestHighLine ) { iColorNum = STARTING_COLOR_NUM; @@ -2659,15 +3268,15 @@ void HighLightDestLine() if((iColorNum==0)||(iColorNum==10)) { - fDelta=!fDelta; + fDelta=!fDelta; } if(!fDelta) iColorNum++; else iColorNum--; - - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); for( usCount = 0; usCount < MAX_CHARACTER_COUNT; usCount++ ) @@ -2676,15 +3285,15 @@ void HighLightDestLine() { usX=DEST_ETA_X-4; usY=(Y_OFFSET*usCount-1)+(Y_START+(usCount*Y_SIZE)); - + if( usCount >= FIRST_VEHICLE ) { usVehicleCont = usCount - FIRST_VEHICLE; usY=(Y_OFFSET*usVehicleCont-1)+(usVehicleY+(usVehicleCont*Y_SIZE)); } - + usColor=Get16BPPColor( FROMRGB( GlowColorsA[iColorNum].ubRed, GlowColorsA[iColorNum].ubGreen, GlowColorsA[iColorNum].ubBlue ) ); - + if( ( usCount == 0 ) || ( usCount != 0 ? !( CharacterIsGettingPathPlotted( ( UINT16 )( usCount - 1 ) ) ) : 0 ) || ( usCount == FIRST_VEHICLE ) ) { LineDraw( TRUE, usX+4, usY, usX+DEST_ETA_WIDTH+4, usY, usColor,pDestBuf); @@ -2711,7 +3320,7 @@ void HighLightDestLine() void HighLightSleepLine() { UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; + UINT8 *pDestBuf; UINT16 usColor; static INT32 iColorNum = STARTING_COLOR_NUM; static BOOLEAN fDelta=FALSE; @@ -2746,15 +3355,15 @@ void HighLightSleepLine() if((iColorNum==0)||(iColorNum==10)) { - fDelta=!fDelta; + fDelta=!fDelta; } if(!fDelta) iColorNum++; else iColorNum--; - - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); for( usCount = 0; usCount < MAX_CHARACTER_COUNT; usCount++ ) @@ -2765,15 +3374,15 @@ void HighLightSleepLine() usX2 = SLEEP_X + SLEEP_WIDTH; usY=(Y_OFFSET*usCount-1)+(Y_START+(usCount*Y_SIZE)); - + if( usCount >= FIRST_VEHICLE ) { usVehicleCount = usCount - FIRST_VEHICLE; usY=(Y_OFFSET*usVehicleCount-1)+(usVehicleY+(usVehicleCount*Y_SIZE)); } - + usColor=Get16BPPColor( FROMRGB( GlowColorsA[iColorNum].ubRed, GlowColorsA[iColorNum].ubGreen, GlowColorsA[iColorNum].ubBlue ) ); - + if( ( usCount == 0 ) || ( usCount != 0 ? !( IsCharacterSelectedForSleep( ( UINT16 )( usCount - 1 ) ) ) : 0 ) || ( usCount == FIRST_VEHICLE ) ) { LineDraw( TRUE, usX+4, usY, usX2, usY, usColor,pDestBuf); @@ -2807,19 +3416,19 @@ void AddCharacter( SOLDIERTYPE *pCharacter ) } // valid character? - if( pCharacter -> bActive == FALSE ) + if( pCharacter->bActive == FALSE ) { return; } // adding a vehicle? - if( pCharacter->uiStatusFlags & SOLDIER_VEHICLE ) + if( pCharacter->flags.uiStatusFlags & SOLDIER_VEHICLE ) { while( usVehicleLoop < MAX_CHARACTER_COUNT ) { if ( gCharactersList[ usVehicleLoop ].fValid ) { - if ( Menptr[ usVehicleLoop ].uiStatusFlags & SOLDIER_VEHICLE ) + if ( Menptr[ usVehicleLoop ].flags.uiStatusFlags & SOLDIER_VEHICLE ) { usVehicleCount++; } @@ -2846,8 +3455,8 @@ void AddCharacter( SOLDIERTYPE *pCharacter ) } // copy over soldier id value - gCharactersList[usCount].usSolID = ( UINT16 )pCharacter -> ubID; - + gCharactersList[usCount].usSolID = ( UINT16 )pCharacter->ubID; + // valid character gCharactersList[usCount].fValid = TRUE; @@ -2861,7 +3470,7 @@ void MoveCharacter(UINT16 uiInitialPosition, UINT16 uiFinalPosition) if (!gCharactersList[uiInitialPosition].fValid) return; else - memcpy(&gCharactersList[uiFinalPosition], &gCharactersList[uiInitialPosition], sizeof(MapScreenCharacterSt)); + memcpy(&gCharactersList[uiFinalPosition], &gCharactersList[uiInitialPosition], sizeof(MapScreenCharacterSt)); } @@ -2947,9 +3556,9 @@ void DisplayCharacterList() if( sCount == ( INT16 ) giHighLine ) { ubForegroundColor = FONT_WHITE; - } + } // check to see if character is still alive - else if( Menptr[gCharactersList[sCount].usSolID].bLife == 0 ) + else if( Menptr[gCharactersList[sCount].usSolID].stats.bLife == 0 ) { ubForegroundColor = FONT_METALGRAY; } @@ -2959,8 +3568,8 @@ void DisplayCharacterList() } // in current sector? else if( ( Menptr[gCharactersList[sCount].usSolID].sSectorX == sSelMapX ) && - ( Menptr[gCharactersList[sCount].usSolID].sSectorY == sSelMapY ) && - ( Menptr[gCharactersList[sCount].usSolID].bSectorZ == iCurrentMapSectorZ ) ) + ( Menptr[gCharactersList[sCount].usSolID].sSectorY == sSelMapY ) && + ( Menptr[gCharactersList[sCount].usSolID].bSectorZ == iCurrentMapSectorZ ) ) { // mobile ? if( ( Menptr[gCharactersList[sCount].usSolID].bAssignment < ON_DUTY ) || @@ -2981,7 +3590,7 @@ void DisplayCharacterList() DrawLocation(sCount, sCount, MAP_SCREEN_FONT); DrawDestination(sCount, sCount, MAP_SCREEN_FONT); DrawAssignment(sCount, sCount, MAP_SCREEN_FONT); - DrawTimeRemaining(sCount, MAP_SCREEN_FONT, ubForegroundColor ); + DrawTimeRemaining(sCount, MAP_SCREEN_FONT, ubForegroundColor ); } } @@ -3067,15 +3676,10 @@ UINT32 MapScreenShutdown(void) UINT32 MapScreenHandle(void) { UINT32 uiNewScreen; - INT32 found=FALSE; - UINT32 uiMins=0; - UINT32 uiHours=0; - UINT32 uiDays=0; VSURFACE_DESC vs_desc; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; // static BOOLEAN fSecondFrame = FALSE; INT32 iCounter = 0; - SOLDIERTYPE *pSoldier = NULL; @@ -3085,7 +3689,7 @@ UINT32 MapScreenHandle(void) { // handle the help screen HelpScreenHandler(); - return( MAP_SCREEN ); + return( MAP_SCREEN ); } MoveRadarScreen(); @@ -3129,8 +3733,8 @@ UINT32 MapScreenHandle(void) InitPreviousPaths(); // if arrival sector is invalid, reset to A9 - if ( ( gsMercArriveSectorX < 1 ) || ( gsMercArriveSectorY < 1 ) || - ( gsMercArriveSectorX > 16 ) || ( gsMercArriveSectorY > 16 ) ) + if ( ( gsMercArriveSectorX < 1 ) || ( gsMercArriveSectorY < 1 ) || + ( gsMercArriveSectorX > 16 ) || ( gsMercArriveSectorY > 16 ) ) { gsMercArriveSectorX = 9; gsMercArriveSectorY = 1; @@ -3188,136 +3792,151 @@ UINT32 MapScreenHandle(void) // load border graphics LoadMapBorderGraphics( ); - //fInterfacePanelDirty=DIRTYLEVEL2; - //RenderTacticalInterface(); - vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; - // Grab the Map image - - strcpy(vs_desc.ImageFile, "INTERFACE\\b_map.pcx"); - CHECKF(AddVideoSurface(&vs_desc, &guiBIGMAP)); + //fInterfacePanelDirty=DIRTYLEVEL2; + //RenderTacticalInterface(); + vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; + // Grab the Map image - strcpy(vs_desc.ImageFile, "INTERFACE\\popupbackground.pcx"); - CHECKF(AddVideoSurface(&vs_desc, &guiPOPUPTEX)); + strcpy(vs_desc.ImageFile, "INTERFACE\\b_map.pcx"); + CHECKF(AddVideoSurface(&vs_desc, &guiBIGMAP)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\SAM.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiSAMICON)); - - // VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; - // FilenameForBPP("INTERFACE\\s_map.sti", VObjectDesc.ImageFile); - // CHECKF( AddVideoObject( &VObjectDesc, &guiMAP ) ); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\mapcursr.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiMAPCURSORS)); + strcpy(vs_desc.ImageFile, "INTERFACE\\popupbackground.pcx"); + CHECKF(AddVideoSurface(&vs_desc, &guiPOPUPTEX)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\Mine_1.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiSubLevel1)); - - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\Mine_2.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiSubLevel2)); - - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\Mine_3.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiSubLevel3)); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\SAM.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiSAMICON)); - //VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - //FilenameForBPP("INTERFACE\\addonslcp.sti", VObjectDesc.ImageFile); - //CHECKF(AddVideoObject(&VObjectDesc, &guiCORNERADDONS)); - - //VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - //FilenameForBPP("INTERFACE\\mapborder.sti", VObjectDesc.ImageFile); - //CHECKF(AddVideoObject(&VObjectDesc, &guiMAPBORDER)); + // VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + // FilenameForBPP("INTERFACE\\s_map.sti", VObjectDesc.ImageFile); + // CHECKF( AddVideoObject( &VObjectDesc, &guiMAP ) ); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\mapcursr.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiMAPCURSORS)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\sleepicon.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiSleepIcon)); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\Mine_1.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiSubLevel1)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\charinfo.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiCHARINFO)); - /*strcpy(vs_desc.ImageFile, "INTERFACE\\playlist3.pcx"); - CHECKF(AddVideoSurface( &vs_desc, &guiCHARLIST ));*/ - - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - if (iResolution == 0) - { + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\Mine_2.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiSubLevel2)); + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\Mine_3.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiSubLevel3)); + + //VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + //FilenameForBPP("INTERFACE\\addonslcp.sti", VObjectDesc.ImageFile); + //CHECKF(AddVideoObject(&VObjectDesc, &guiCORNERADDONS)); + + //VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + //FilenameForBPP("INTERFACE\\mapborder.sti", VObjectDesc.ImageFile); + //CHECKF(AddVideoObject(&VObjectDesc, &guiMAPBORDER)); + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\sleepicon.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiSleepIcon)); + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\charinfo.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiCHARINFO)); + /*strcpy(vs_desc.ImageFile, "INTERFACE\\playlist3.pcx"); + CHECKF(AddVideoSurface( &vs_desc, &guiCHARLIST ));*/ + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + if (iResolution == 0) + { FilenameForBPP("INTERFACE\\newgoldpiece3.sti", VObjectDesc.ImageFile ); - } - else if (iResolution == 1) - { - FilenameForBPP("INTERFACE\\newgoldpiece3_800x600.sti", VObjectDesc.ImageFile ); - } - else if (iResolution == 2) - { - FilenameForBPP("INTERFACE\\newgoldpiece3_1024x768.sti", VObjectDesc.ImageFile ); - } - CHECKF(AddVideoObject(&VObjectDesc, &guiCHARLIST)); + } + else if (iResolution == 1) + { + FilenameForBPP("INTERFACE\\newgoldpiece3_800x600.sti", VObjectDesc.ImageFile ); + } + else if (iResolution == 2) + { + FilenameForBPP("INTERFACE\\newgoldpiece3_1024x768.sti", VObjectDesc.ImageFile ); + } + CHECKF(AddVideoObject(&VObjectDesc, &guiCHARLIST)); - //VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - //FilenameForBPP("INTERFACE\\mapbordercorner.sti", VObjectDesc.ImageFile); - //CHECKF(AddVideoObject(&VObjectDesc, &guiMAPCORNER)); + //VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + //FilenameForBPP("INTERFACE\\mapbordercorner.sti", VObjectDesc.ImageFile); + //CHECKF(AddVideoObject(&VObjectDesc, &guiMAPCORNER)); // VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; // FilenameForBPP("INTERFACE\\popup.sti", VObjectDesc.ImageFile); // CHECKF(AddVideoObject(&VObjectDesc, &guiPOPUPBORDERS)); - - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\boxes.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiCHARICONS)); - - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\incross.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiCROSS)); - - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\mapinv.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiMAPINV)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\map_inv_2nd_gun_cover.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiMapInvSecondHandBlockout)); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\boxes.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiCHARICONS)); - // the upper left corner piece icons - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\top_left_corner_icons.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiULICONS)); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\incross.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiCROSS)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\map_item.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiORTAICON)); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + if (iResolution == 0) + { + FilenameForBPP("INTERFACE\\mapinv.sti", VObjectDesc.ImageFile); + } + else if (iResolution == 1) + { + FilenameForBPP("INTERFACE\\mapinv_800x600.sti", VObjectDesc.ImageFile); + } + else if (iResolution == 2) + { + FilenameForBPP("INTERFACE\\mapinv_1024x768.sti", VObjectDesc.ImageFile); + } + if(!AddVideoObject(&VObjectDesc, &guiMAPINV)) + { + FilenameForBPP("INTERFACE\\mapinv.sti", VObjectDesc.ImageFile); + } + CHECKF(AddVideoObject(&VObjectDesc, &guiMAPINV)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\prison.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiTIXAICON)); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\map_inv_2nd_gun_cover.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiMapInvSecondHandBlockout)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\merc_between_sector_icons.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiCHARBETWEENSECTORICONS)); + // the upper left corner piece icons + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\top_left_corner_icons.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiULICONS)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\merc_mvt_green_arrows.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiCHARBETWEENSECTORICONSCLOSE)); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\map_item.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiORTAICON)); + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\prison.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiTIXAICON)); + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\merc_between_sector_icons.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiCHARBETWEENSECTORICONS)); + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\merc_mvt_green_arrows.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiCHARBETWEENSECTORICONSCLOSE)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\GreenArr.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiLEVELMARKER)); - - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\Helicop.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiHelicopterIcon)); - - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\eta_pop_up.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiMapBorderEtaPopUp)); - - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\pos2.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiMapBorderHeliSectors)); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\GreenArr.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiLEVELMARKER)); + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\Helicop.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiHelicopterIcon)); + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\eta_pop_up.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiMapBorderEtaPopUp)); + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\pos2.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiMapBorderHeliSectors)); + - VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; FilenameForBPP("INTERFACE\\secondary_gun_hidden.sti", VObjectDesc.ImageFile); @@ -3326,8 +3945,8 @@ UINT32 MapScreenHandle(void) VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; FilenameForBPP("INTERFACE\\selectedchararrow.sti", VObjectDesc.ImageFile); CHECKF( AddVideoObject( &VObjectDesc, &guiSelectedCharArrow ) ); - - + + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; FilenameForBPP("INTERFACE\\mine.sti", VObjectDesc.ImageFile); CHECKF( AddVideoObject( &VObjectDesc, &guiMINEICON ) ); @@ -3348,7 +3967,7 @@ UINT32 MapScreenHandle(void) // graphic for pool inventory LoadInventoryPoolGraphic( ); - //Kris: Added this because I need to blink the icons button. + //Kris: Added this because I need to blink the icons button. VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; sprintf( VObjectDesc.ImageFile, "INTERFACE\\newemail.sti" ); AddVideoObject( &VObjectDesc, &guiNewMailIcons ); @@ -3409,7 +4028,7 @@ UINT32 MapScreenHandle(void) // reset show aircraft flag //fShowAircraftFlag = FALSE; - + // reset fact we are showing white bounding box around face fShowFaceHightLight = FALSE; fShowItemHighLight = FALSE; @@ -3436,17 +4055,17 @@ UINT32 MapScreenHandle(void) // set up regions MSYS_DefineRegion( &gMapViewRegion, MAP_VIEW_START_X + MAP_GRID_X, MAP_VIEW_START_Y + MAP_GRID_Y,MAP_VIEW_START_X + MAP_VIEW_WIDTH+MAP_GRID_X-1, MAP_VIEW_START_Y + MAP_VIEW_HEIGHT-1 + 8, MSYS_PRIORITY_HIGH - 3, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); MSYS_DefineRegion( &gCharInfoHandRegion, ((INT16)( 4 )), ((INT16)( 81 )) ,((INT16)(62)), ((INT16)(103)), MSYS_PRIORITY_HIGH, - MSYS_NO_CURSOR, ItemRegionMvtCallback , ItemRegionBtnCallback ); + MSYS_NO_CURSOR, ItemRegionMvtCallback , ItemRegionBtnCallback ); MSYS_DefineRegion( &gCharInfoFaceRegion, (INT16) PLAYER_INFO_FACE_START_X, (INT16) PLAYER_INFO_FACE_START_Y, (INT16) PLAYER_INFO_FACE_END_X, (INT16) PLAYER_INFO_FACE_END_Y, MSYS_PRIORITY_HIGH, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, FaceRegionBtnCallback ); - + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, FaceRegionBtnCallback ); + MSYS_DefineRegion(&gMPanelRegion, INV_REGION_X, INV_REGION_Y, INV_REGION_X+INV_REGION_WIDTH, INV_REGION_Y+INV_REGION_HEIGHT, MSYS_PRIORITY_HIGH, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK,InvmaskRegionBtnCallBack); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK,InvmaskRegionBtnCallBack); // screen mask for animated cursors MSYS_DefineRegion( &gMapScreenMaskRegion, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_LOW, - CURSOR_NORMAL, MSYS_NO_CALLBACK, MapScreenMarkRegionBtnCallback); + CURSOR_NORMAL, MSYS_NO_CALLBACK, MapScreenMarkRegionBtnCallback); // set help text for item glow region SetRegionFastHelpText( &gCharInfoHandRegion, pMiscMapScreenMouseRegionHelpText[ 0 ] ); @@ -3465,7 +4084,7 @@ UINT32 MapScreenHandle(void) SpecifyButtonFont( giMapContractButton, MAP_SCREEN_FONT ); SpecifyButtonUpTextColors( giMapContractButton, CHAR_TEXT_FONT_COLOR, FONT_BLACK ); SpecifyButtonDownTextColors( giMapContractButton, CHAR_TEXT_FONT_COLOR, FONT_BLACK ); - + // create mouse region for pause clock CreateMouseRegionForPauseOfClock( CLOCK_REGION_START_X, CLOCK_REGION_START_Y ); @@ -3495,10 +4114,10 @@ UINT32 MapScreenHandle(void) MSYS_AddRegion( &gCharInfoFaceRegion); MSYS_AddRegion( &gMPanelRegion); - if ( !gfFadeOutDone && !gfFadeIn ) - { - MSYS_SetCurrentCursor(SCREEN_CURSOR); - } + if ( !gfFadeOutDone && !gfFadeIn ) + { + MSYS_SetCurrentCursor(SCREEN_CURSOR); + } MSYS_DisableRegion(&gMPanelRegion); // create contract box @@ -3514,11 +4133,11 @@ UINT32 MapScreenHandle(void) CreateMercRemoveAssignBox( ); // test message - // TestMessageSystem( ); + // TestMessageSystem( ); - // fill in + // fill in ColorFillVideoSurfaceArea( guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( RGB_NEAR_BLACK ) ); - ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( RGB_NEAR_BLACK ) ); + ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( RGB_NEAR_BLACK ) ); if( ( fFirstTimeInMapScreen == TRUE ) && ( AnyMercsHired( ) == FALSE ) ) @@ -3545,10 +4164,10 @@ UINT32 MapScreenHandle(void) // make him continue talking - ContinueDialogue( MercPtrs[ gpCurrentTalkingFace -> ubSoldierID ], FALSE ); + ContinueDialogue( MercPtrs[ gpCurrentTalkingFace->ubSoldierID ], FALSE ); // reset diabled flag - //gpCurrentTalkingFace->fDisabled = FALSE; + //gpCurrentTalkingFace->fDisabled = FALSE; // Continue his talking! @@ -3597,10 +4216,10 @@ UINT32 MapScreenHandle(void) if( ( bSelectedDestChar == -1 ) && ( fPlotForHelicopter == FALSE ) && ( gfInChangeArrivalSectorMode == FALSE ) ) { // reset cursor - if ( !gfFadeIn ) - { - ChangeMapScreenMaskCursor( CURSOR_NORMAL ); - } + if ( !gfFadeIn ) + { + ChangeMapScreenMaskCursor( CURSOR_NORMAL ); + } } */ @@ -3683,7 +4302,7 @@ UINT32 MapScreenHandle(void) { HandleFlashForHighLightedItem( ); } - + // CreateDestroyMovementBox( 0,0,0 ); @@ -3732,7 +4351,7 @@ UINT32 MapScreenHandle(void) // restore background rects RestoreBackgroundRects( ); - + InterruptTimeForMenus( ); // place down background @@ -3746,14 +4365,14 @@ UINT32 MapScreenHandle(void) if( fDisableDueToBattleRoster == FALSE ) { /* - // ATE: OK mark is rendering the item every frame - which isn't good - // however, don't want to break the world here.. - // this line was added so that when the ItemGlow() is on, - // we're not rendering also, else glow looks bad - if ( !fShowItemHighLight ) - { - RenderHandPosItem(); - } + // ATE: OK mark is rendering the item every frame - which isn't good + // however, don't want to break the world here.. + // this line was added so that when the ItemGlow() is on, + // we're not rendering also, else glow looks bad + if ( !fShowItemHighLight ) + { + RenderHandPosItem(); + } */ if( fDrawCharacterList ) @@ -3779,11 +4398,11 @@ UINT32 MapScreenHandle(void) if( fDisableDueToBattleRoster == FALSE ) { - + // render status bar HandleCharBarRender( ); } - + if( fShowInventoryFlag || fDisableDueToBattleRoster ) { for( iCounter = 0; iCounter < MAX_SORT_METHODS; iCounter++ ) @@ -3807,7 +4426,7 @@ UINT32 MapScreenHandle(void) { // remove the move box once user leaves it CreateDestroyMovementBox( 0,0,0 ); - + // this updates the move box contents when changes took place ReBuildMoveBox( ); } @@ -3824,7 +4443,7 @@ UINT32 MapScreenHandle(void) // handle changing of highlighted lines HandleChangeOfHighLightedLine( ); } - + if( fDisableDueToBattleRoster == FALSE ) { // render face of current info char, for animation @@ -3837,7 +4456,7 @@ UINT32 MapScreenHandle(void) GlowFace( ); GlowItem( ); */ - + } @@ -3900,10 +4519,10 @@ UINT32 MapScreenHandle(void) // handle display of inventory pop up HandleDisplayOfItemPopUpForSector( 9, 1, 0 ); - + // Display Framerate DisplayFrameRate( ); - + // update paused states UpdatePausedStatesDueToTimeCompression( ); @@ -3936,32 +4555,34 @@ UINT32 MapScreenHandle(void) { if( InKeyRingPopup( ) == TRUE ) { - DeleteKeyRingPopup( ); + DeleteKeyRingPopup( ); } else { fShowInventoryFlag = FALSE; + // CHRISL: Added call to re-render the bottom panel + RenderMapScreenInterfaceBottom ( TRUE ); // set help text for item glow region SetRegionFastHelpText( &gCharInfoHandRegion, pMiscMapScreenMouseRegionHelpText[ 0 ] ); } - - - + + + fTeamPanelDirty = TRUE; fEndShowInventoryFlag = FALSE; } // handle animated cursor update - if ( !gfFadeIn ) - { - HandleAnimatedCursorsForMapScreen( ); - } + if ( !gfFadeIn ) + { + HandleAnimatedCursorsForMapScreen( ); + } // if inventory is being manipulated, update cursor HandleMapInventoryCursor(); - + if( fShowDescriptionFlag == TRUE ) { @@ -4036,9 +4657,9 @@ UINT32 MapScreenHandle(void) { RenderKeyRingPopup( FALSE ); } - + CheckForMeanwhileOKStart( ); - + // save background rects // ATE: DO this BEFORE rendering help text.... SaveBackgroundRects( ); @@ -4087,7 +4708,7 @@ UINT32 MapScreenHandle(void) // update cursor UpdateCursorIfInLastSector( ); - + // about to leave for new map if ( gfLoadPending == 1 ) @@ -4099,10 +4720,10 @@ UINT32 MapScreenHandle(void) SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); //Shadow area - ShadowVideoSurfaceRect( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + ShadowVideoSurfaceRect( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); InvalidateScreen( ); } - + //InvalidateRegion( 0,0, 640, 480); EndFrameBufferRender( ); @@ -4124,7 +4745,7 @@ UINT32 MapScreenHandle(void) HandlePreBattleInterfaceStates(); if( gfHotKeyEnterSector ) - { + { gfHotKeyEnterSector = FALSE; ActivatePreBattleEnterSectorAction(); } @@ -4162,7 +4783,7 @@ void DrawString(STR16 pString, UINT16 uiX, UINT16 uiY, UINT32 uiFont) // draw monochrome string SetFont(uiFont); gprintfdirty(uiX,uiY,pString); - mprintf(uiX,uiY,pString); + mprintf(uiX,uiY,pString); } @@ -4172,7 +4793,7 @@ void SetDayAlternate(STR16 pStringA, ...) // this sets the clock counter, unwind loop UINT16 uiX=0; UINT16 uiY=0; - CHAR16 String[80]; + CHAR16 String[80]; va_list argptr; va_start(argptr, pStringA); // Set up variable argument pointer @@ -4186,10 +4807,10 @@ void SetDayAlternate(STR16 pStringA, ...) } String[2]=gsTimeStrings[ 3 ][ 0 ]; String[3]=L' '; - String[4]=0; + String[4]=0; uiX=CLOCK_HOUR_X_START-9; - uiY=CLOCK_Y_START; + uiY=CLOCK_Y_START; SetFont( ETA_FONT ); SetFontForeground( FONT_LTGREEN ); @@ -4206,7 +4827,7 @@ void SetHourAlternate(STR16 pStringA, ...) // this sets the clock counter, unwind loop UINT16 uiX=0; UINT16 uiY=0; - CHAR16 String[80]; + CHAR16 String[80]; va_list argptr; va_start(argptr, pStringA); // Set up variable argument pointer @@ -4223,9 +4844,9 @@ void SetHourAlternate(STR16 pStringA, ...) String[3]=L' '; String[4]= 0; uiX=CLOCK_MIN_X_START-5; - uiY=CLOCK_Y_START; + uiY=CLOCK_Y_START; DrawString(String, uiX, uiY, ETA_FONT); - + SetFont( ETA_FONT ); SetFontForeground( FONT_LTGREEN ); SetFontBackground( FONT_BLACK ); @@ -4242,7 +4863,7 @@ void SetClockHour(STR16 pStringA, ...) // this sets the clock counter, unwind loop UINT16 uiX=0; UINT16 uiY=0; - CHAR16 String[80]; + CHAR16 String[80]; va_list argptr; va_start(argptr, pStringA); // Set up variable argument pointer @@ -4257,9 +4878,9 @@ void SetClockHour(STR16 pStringA, ...) String[3]=L' '; String[4]=0; uiX=CLOCK_HOUR_X_START-8; - uiY=CLOCK_Y_START; + uiY=CLOCK_Y_START; + - SetFont( ETA_FONT ); SetFontForeground( FONT_LTGREEN ); SetFontBackground( FONT_BLACK ); @@ -4277,7 +4898,7 @@ void SetClockMin(STR16 pStringA, ...) va_start(argptr, pStringA); // Set up variable argument pointer vswprintf(String, pStringA, argptr); // process gprintf string (get output str) va_end(argptr); - + if (String[1]==0) { String[1]=String[0]; @@ -4286,7 +4907,7 @@ void SetClockMin(STR16 pStringA, ...) String[2]=gsTimeStrings[ 1 ][ 0 ]; String[3]=L' '; String[4]=0; - + SetFont( ETA_FONT ); SetFontForeground( FONT_LTGREEN ); SetFontBackground( FONT_BLACK ); @@ -4314,7 +4935,7 @@ void DrawName(STR16 pName, INT16 sRowIndex, INT32 iFont) } //RestoreExternBackgroundRect(NAME_X, ((UINT16)(usY+(Y_OFFSET*sRowIndex+1))), NAME_WIDTH, Y_SIZE); - DrawString( pName, (UINT16)usX, ((UINT16)(usY+(Y_OFFSET*sRowIndex+1))), iFont); + DrawString( pName, (UINT16)usX, ((UINT16)(usY+(Y_OFFSET*sRowIndex+1))), iFont); } @@ -4340,7 +4961,7 @@ void DrawAssignment(INT16 sCharNumber, INT16 sRowIndex, INT32 iFont) if( fFlashAssignDone == TRUE ) { - if( Menptr[gCharactersList[sCharNumber].usSolID].fDoneAssignmentAndNothingToDoFlag ) + if( Menptr[gCharactersList[sCharNumber].usSolID].flags.fDoneAssignmentAndNothingToDoFlag ) { SetFontForeground( FONT_RED ); } @@ -4372,7 +4993,7 @@ void DrawLocation(INT16 sCharNumber, INT16 sRowIndex, INT32 iFont) } // restore background //RestoreExternBackgroundRect(LOC_X, ((UINT16)(usY+(Y_OFFSET*sRowIndex+1))), LOC_WIDTH, Y_SIZE); - + // draw string DrawString( sString,((UINT16)(usX)), ((UINT16)(usY+(Y_OFFSET*sRowIndex+1))), ((UINT32)iFont)); } @@ -4512,7 +5133,7 @@ void RenderMapCursorsIndexesAnims( ) { fSelectedSectorHighlighted = TRUE; - // do we need to flash the cursor? get the delta in time + // do we need to flash the cursor? get the delta in time uiDeltaTime = GetJA2Clock( ) - guiFlashCursorBaseTime; if ( uiDeltaTime > 300 ) @@ -4581,11 +5202,7 @@ UINT32 HandleMapUI( ) { UINT32 uiNewEvent = MAP_EVENT_NONE; INT16 sMapX = 0, sMapY = 0; - INT8 bMapZ = 0; INT16 sX, sY; - UINT8 ubCount=0; - PathStPtr pNode=NULL; - BOOLEAN fVehicle=FALSE; POINT MousePos; UINT32 uiNewScreen = MAP_SCREEN; BOOLEAN fWasAlreadySelected; @@ -4608,64 +5225,64 @@ UINT32 HandleMapUI( ) break; case MAP_EVENT_PLOT_PATH: - GetMouseMapXY(&sMapX, &sMapY); + GetMouseMapXY(&sMapX, &sMapY); /* - // translate screen values to map grid values for zoomed in - if(fZoomFlag) - { - sMapX=(UINT16)iZoomX/MAP_GRID_X+sMapX; - sMapX=sMapX/2; - sMapY=(UINT16)iZoomY/MAP_GRID_Y+sMapY; - sMapY=sMapY/2; - } + // translate screen values to map grid values for zoomed in + if(fZoomFlag) + { + sMapX=(UINT16)iZoomX/MAP_GRID_X+sMapX; + sMapX=sMapX/2; + sMapY=(UINT16)iZoomY/MAP_GRID_Y+sMapY; + sMapY=sMapY/2; + } */ - // plotting for the chopper? - if( fPlotForHelicopter == TRUE ) - { + // plotting for the chopper? + if( fPlotForHelicopter == TRUE ) + { /* - if( IsSectorOutOfTheWay( sMapX, sMapY ) == TRUE ) - { - if( gfAllowSkyriderTooFarQuote == TRUE ) - { - SkyRiderTalk( DESTINATION_TOO_FAR ); - } + if( IsSectorOutOfTheWay( sMapX, sMapY ) == TRUE ) + { + if( gfAllowSkyriderTooFarQuote == TRUE ) + { + SkyRiderTalk( DESTINATION_TOO_FAR ); + } - return( MAP_SCREEN ); - } + return( MAP_SCREEN ); + } */ - PlotPathForHelicopter( sMapX, sMapY ); - fTeamPanelDirty = TRUE; - } - else - { - // plot for character + PlotPathForHelicopter( sMapX, sMapY ); + fTeamPanelDirty = TRUE; + } + else + { + // plot for character - // check for valid character - Assert ( bSelectedDestChar != -1 ); - if ( bSelectedDestChar == -1 ) - break; + // check for valid character + Assert ( bSelectedDestChar != -1 ); + if ( bSelectedDestChar == -1 ) + break; - // check if last sector in character's path is same as where mouse is - if( GetLastSectorIdInCharactersPath( &Menptr[gCharactersList[bSelectedDestChar].usSolID] ) != ( sMapX + ( sMapY * MAP_WORLD_X ) ) ) - { - sX = ( GetLastSectorIdInCharactersPath( &Menptr[gCharactersList[bSelectedDestChar].usSolID] ) % MAP_WORLD_X ); - sY = ( GetLastSectorIdInCharactersPath( &Menptr[gCharactersList[bSelectedDestChar].usSolID] ) / MAP_WORLD_X ); - GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! - RestoreBackgroundForMapGrid( sX, sY ); + // check if last sector in character's path is same as where mouse is + if( GetLastSectorIdInCharactersPath( &Menptr[gCharactersList[bSelectedDestChar].usSolID] ) != ( sMapX + ( sMapY * MAP_WORLD_X ) ) ) + { + sX = ( GetLastSectorIdInCharactersPath( &Menptr[gCharactersList[bSelectedDestChar].usSolID] ) % MAP_WORLD_X ); + sY = ( GetLastSectorIdInCharactersPath( &Menptr[gCharactersList[bSelectedDestChar].usSolID] ) / MAP_WORLD_X ); + GetCursorPos(&MousePos); + ScreenToClient(ghWindow, &MousePos); // In window coords! + RestoreBackgroundForMapGrid( sX, sY ); // fMapPanelDirty = TRUE; - } + } //SetFontDestBuffer( FRAME_BUFFER, 0, 0, 640, 480, FALSE ); if( ( IsTheCursorAllowedToHighLightThisSector( sMapX, sMapY ) == TRUE ) && ( SectorInfo[ ( SECTOR( sMapX, sMapY ) ) ].ubTraversability[ THROUGH_STRATEGIC_MOVE ] != GROUNDBARRIER ) ) { - // Can we get go there? (NULL temp character path) + // Can we get go there? (NULL temp character path) if ( GetLengthOfPath( pTempCharacterPath ) > 0 ) { PlotPathForCharacter( &Menptr[gCharactersList[bSelectedDestChar].usSolID], sMapX, sMapY, FALSE ); @@ -4683,7 +5300,7 @@ UINT32 HandleMapUI( ) MapScreenMessage( FONT_MCOLOR_LTYELLOW, MSG_MAP_UI_POSITION_MIDDLE, pMapErrorString[ 40 ] ); } } - } + } break; @@ -4693,14 +5310,14 @@ UINT32 HandleMapUI( ) /* - case MAP_EVENT_SELECT_SECTOR: + case MAP_EVENT_SELECT_SECTOR: // will select the sector the selected merc is in sMapX=Menptr[gCharactersList[bSelectedInfoChar].usSolID].sSectorX; sMapY=Menptr[gCharactersList[bSelectedInfoChar].usSolID].sSectorY; bMapZ=Menptr[gCharactersList[bSelectedInfoChar].usSolID].bSectorZ; - if( ( sSelMapX != sMapX || sSelMapY != sMapY || iCurrentMapSectorZ != bMapZ ) && + if( ( sSelMapX != sMapX || sSelMapY != sMapY || iCurrentMapSectorZ != bMapZ ) && ( gTacticalStatus.fDidGameJustStart == FALSE ) && ( gfPreBattleInterfaceActive == FALSE ) ) { ChangeSelectedMapSector( sMapX, sMapY, bMapZ ); @@ -4708,8 +5325,8 @@ UINT32 HandleMapUI( ) fTeamPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; - bSelectedDestChar=-1; - } + bSelectedDestChar=-1; + } break; */ @@ -4723,17 +5340,17 @@ UINT32 HandleMapUI( ) if( fZoomFlag == TRUE ) { // convert to zoom out coords from screen coords - sMapX = ( INT16 )( iZoomX / MAP_GRID_X + sMapX ) / 2; - sMapY = ( INT16 )( iZoomY / MAP_GRID_Y + sMapY ) / 2; + sMapX = ( INT16 )( iZoomX / MAP_GRID_X + sMapX ) / 2; + sMapY = ( INT16 )( iZoomY / MAP_GRID_Y + sMapY ) / 2; //sMapX = ( INT16 ) ( ( ( iZoomX ) / ( MAP_GRID_X * 2) ) + sMapX / 2 ); //sMapX = ( INT16 ) ( ( ( iZoomY ) / ( MAP_GRID_Y * 2) ) + sMapY / 2 ); } */ // not zoomed out, make sure this is a valid sector - if( IsTheCursorAllowedToHighLightThisSector( sMapX, sMapY ) == FALSE ) + if( IsTheCursorAllowedToHighLightThisSector( sMapX, sMapY ) == FALSE ) { - // do nothing, return + // do nothing, return return( MAP_SCREEN ); } @@ -4753,8 +5370,8 @@ UINT32 HandleMapUI( ) { // make sure it's the owner's sector that's selected if ( ( gpItemPointerSoldier->sSectorX != sSelMapX ) || - ( gpItemPointerSoldier->sSectorY != sSelMapY ) || - ( gpItemPointerSoldier->bSectorZ != iCurrentMapSectorZ ) ) + ( gpItemPointerSoldier->sSectorY != sSelMapY ) || + ( gpItemPointerSoldier->bSectorZ != iCurrentMapSectorZ ) ) { ChangeSelectedMapSector( gpItemPointerSoldier->sSectorX, gpItemPointerSoldier->sSectorY, gpItemPointerSoldier->bSectorZ ); } @@ -4866,7 +5483,7 @@ UINT32 HandleMapUI( ) if( gfBlitBattleSectorLocator && sMapX == gubPBSectorX && sMapY == gubPBSectorY && iCurrentMapSectorZ == gubPBSectorZ ) - { //Bring up a non-persistant version of mapscreen if the user clicks on the sector where a + { //Bring up a non-persistant version of mapscreen if the user clicks on the sector where a //battle is taking place. InitPreBattleInterface( NULL, FALSE ); return( MAP_SCREEN ); @@ -4890,7 +5507,7 @@ UINT32 HandleMapUI( ) } else // not in airspace mode { - // sector must be already selected to initiate movement plotting! This is to allow selecting sectors with + // sector must be already selected to initiate movement plotting! This is to allow selecting sectors with // mercs in them without necessarily initiating movement right away. if( fWasAlreadySelected ) { @@ -4923,7 +5540,7 @@ UINT32 HandleMapUI( ) //Kris -- added hook so I can access AIView in non-release mode. #ifdef JA2BETAVERSION - case MAP_EVENT_VIEWAI: + case MAP_EVENT_VIEWAI: SetPendingNewScreen( AIVIEWER_SCREEN ); CreateDestroyMapInvButton(); break; @@ -4943,8 +5560,8 @@ UINT32 HandleMapUI( ) void GetMapKeyboardInput( UINT32 *puiNewEvent ) { - InputAtom InputEvent; - POINT MousePos; + InputAtom InputEvent; + POINT MousePos; INT8 bSquadNumber; UINT8 ubGroupId = 0; BOOLEAN fCtrl, fAlt; @@ -4954,34 +5571,34 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) fCtrl = _KeyDown( CTRL ); fAlt = _KeyDown( ALT ); - while( DequeueEvent( &InputEvent ) ) + while( DequeueEvent( &InputEvent ) ) // while( DequeueSpecificEvent( &InputEvent, KEY_DOWN ) ) // doesn't work for some reason - { + { GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! + ScreenToClient(ghWindow, &MousePos); // In window coords! // HOOK INTO MOUSE HOOKS switch(InputEvent.usEvent) - { + { case LEFT_BUTTON_DOWN: MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; case LEFT_BUTTON_UP: - MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); + MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); break; case RIGHT_BUTTON_DOWN: MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - case RIGHT_BUTTON_UP: - MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + case RIGHT_BUTTON_UP: + MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - case RIGHT_BUTTON_REPEAT: - MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + case RIGHT_BUTTON_REPEAT: + MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - case LEFT_BUTTON_REPEAT: - MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + case LEFT_BUTTON_REPEAT: + MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - } + } if( InputEvent.usEvent == KEY_DOWN ) @@ -5014,7 +5631,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) if( gfPreBattleInterfaceActive && !gfPersistantPBI ) - { //Non persistant PBI. Allow ESC to close it and return to mapscreen. + { //Non persistant PBI. Allow ESC to close it and return to mapscreen. KillPreBattleInterface(); gpBattleGroup = NULL; return; @@ -5034,19 +5651,19 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) { StopMapScreenHelpText( ); } - else if ( gpCurrentTalkingFace != NULL && gpCurrentTalkingFace->fTalking ) - { - // ATE: We want to stop speech if somebody is talking... - StopAnyCurrentlyTalkingSpeech( ); - } + else if ( gpCurrentTalkingFace != NULL && gpCurrentTalkingFace->fTalking ) + { + // ATE: We want to stop speech if somebody is talking... + StopAnyCurrentlyTalkingSpeech( ); + } else if( fShowUpdateBox ) { if( fShowUpdateBox ) { - EndUpdateBox( FALSE ); // stop time compression + EndUpdateBox( FALSE ); // stop time compression } } - else if(fShowDescriptionFlag) + else if(fShowDescriptionFlag) { DeleteItemDescriptionBox( ); } @@ -5109,7 +5726,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) fShowTownInfo = FALSE; CreateDestroyScreenMaskForAssignmentAndContractMenus( ); } - else if( fShowDescriptionFlag ) + else if( fShowDescriptionFlag ) { if( gMPanelRegion.Cursor != EXTERN_CURSOR ) { @@ -5152,10 +5769,12 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) case LEFTARROW: // previous character + fResetMapCoords = TRUE; GoToPrevCharacterInList( ); break; case RIGHTARROW: // next character + fResetMapCoords = TRUE; GoToNextCharacterInList( ); break; @@ -5209,7 +5828,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) break; case BACKSPACE: - StopAnyCurrentlyTalkingSpeech( ); + StopAnyCurrentlyTalkingSpeech( ); break; case F1: @@ -5228,9 +5847,9 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) if ( bSelectedInfoChar != -1 ) { SOLDIERTYPE *pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]; - if ( pSoldier->inv[ HANDPOS ].usItem != 0 ) + if ( pSoldier->inv[ HANDPOS ].exists() == true ) { - pSoldier->inv[ HANDPOS ].ItemData.Generic.bStatus[ 0 ] = 2; + pSoldier->inv[ HANDPOS ][0]->data.objectStatus = 2; } } } @@ -5239,7 +5858,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) if ( bSelectedInfoChar != -1 ) { SOLDIERTYPE *pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]; - if ( pSoldier->inv[ HANDPOS ].usItem != 0 ) + if ( pSoldier->inv[ HANDPOS ].exists() == true ) { pSoldier->inv[ HANDPOS ].usItem = GUN_BARREL_EXTENDER; } @@ -5320,7 +5939,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) case SPACE: if( fShowUpdateBox ) { - EndUpdateBox( TRUE ); // restart time compression + EndUpdateBox( TRUE ); // restart time compression } else { @@ -5366,9 +5985,9 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) case '?': #ifdef JA2TESTVERSION if( fCtrl ) - MapScreenMessage( 0, MSG_DEBUG, L"JA2Clock = %d", GetJA2Clock() ); + MapScreenMessage( 0, MSG_DEBUG, L"JA2Clock = %d", GetJA2Clock() ); else - MapScreenMessage( 0, MSG_DEBUG, L"Mouse X,Y = %d,%d", MSYS_CurrentMX, MSYS_CurrentMY ); + MapScreenMessage( 0, MSG_DEBUG, L"Mouse X,Y = %d,%d", MSYS_CurrentMX, MSYS_CurrentMY ); #endif break; @@ -5394,7 +6013,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) case '7': case '8': case '9': - // multi-selects all characters in that squad. SHIFT key and 1-0 for squads 11-20 + // multi-selects all characters in that squad. SHIFT key and 1-0 for squads 11-20 bSquadNumber = ( INT8 ) ( InputEvent.usParam - '1' ); // internal squad #s start at 0 SelectAllCharactersInSquad( bSquadNumber ); break; @@ -5485,7 +6104,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) } } break; - + case 'b': /* @@ -5523,6 +6142,74 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) gfHotKeyEnterSector = TRUE; } break; + case 'E': + if(bSelectedInfoChar != -1) + { + SOLDIERTYPE *pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]; + if(!fShowMapInventoryPool) + { + fShowMapInventoryPool = TRUE; + CreateDestroyMapInventoryPoolButtons( TRUE ); + } + if(!fShowInventoryFlag) + { + fShowInventoryFlag = TRUE; + } + if( fCtrl ) + { + //CHRISL: pickup all items to vehicle + if ( UsingNewInventorySystem() == true && fShowInventoryFlag && fShowMapInventoryPool && !(gTacticalStatus.fEnemyInSector) && gGameExternalOptions.fVehicleInventory && (pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE)) + { + for(unsigned int i = 0; iinv[x].exists() == true) + { + if(pSoldier->inv[x].usItem != pInventoryPoolList[i].object.usItem) + continue; + else + pInventoryPoolList[i].object.AddObjectsToStack(pSoldier->inv[x], -1, pSoldier, x); + } + else + pInventoryPoolList[i].object.MoveThisObjectTo(pSoldier->inv[x], -1, pSoldier, x); + if(pInventoryPoolList[i].object.ubNumberOfObjects < 0) + { + //RemoveItemFromWorld(i); + break; + } + } + } + fTeamPanelDirty = TRUE; + fMapPanelDirty = TRUE; + fInterfacePanelDirty = DIRTYLEVEL2; + } + } + } + else + { + //CHRISL: drop all items + if ( bSelectedInfoChar != -1 && fShowInventoryFlag && fShowMapInventoryPool && !(gTacticalStatus.fEnemyInSector) ) + { + for(int i = BODYPOSFINAL; iinv[i].exists() == true) + { + AutoPlaceObjectInInventoryStash(&pSoldier->inv[i], pSoldier->sGridNo); + DeleteObj(&pSoldier->inv[i]); + } + fTeamPanelDirty = TRUE; + fMapPanelDirty = TRUE; + fInterfacePanelDirty = DIRTYLEVEL2; + } + } + } + } + break; case 'f': #ifdef JA2TESTVERSION // CTRL-F: Refuel vehicle @@ -5530,7 +6217,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) { SOLDIERTYPE *pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]; - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { pSoldier->sBreathRed = 10000; pSoldier->bBreath = 100; @@ -5545,10 +6232,10 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) { if ( INFORMATION_CHEAT_LEVEL( ) ) { - //Toggle Frame Rate Display - gbFPSDisplay = !gbFPSDisplay; - DisableFPSOverlay( (BOOLEAN)!gbFPSDisplay ); - } + //Toggle Frame Rate Display + gbFPSDisplay = !gbFPSDisplay; + DisableFPSOverlay( (BOOLEAN)!gbFPSDisplay ); + } } break; case 'h': @@ -5610,6 +6297,24 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) #endif break; + + case 'K': + //CHRISL: Swap gunsling + if ( bSelectedInfoChar != -1 && fShowInventoryFlag && UsingNewInventorySystem() == true ) + { + SOLDIERTYPE *pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]; + BOOLEAN handFit = (CanItemFitInPosition(pSoldier, &pSoldier->inv[HANDPOS], GUNSLINGPOCKPOS, FALSE) || (pSoldier->inv[HANDPOS].exists() == false && pSoldier->inv[SECONDHANDPOS].exists() == false)); + BOOLEAN slingFit = (CanItemFitInPosition(pSoldier, &pSoldier->inv[GUNSLINGPOCKPOS], HANDPOS, FALSE) || pSoldier->inv[GUNSLINGPOCKPOS].exists() == false); + if( handFit == TRUE && slingFit == TRUE) + { + SwapObjs(&pSoldier->inv[HANDPOS], &pSoldier->inv[GUNSLINGPOCKPOS]); + } + fTeamPanelDirty = TRUE; + fMapPanelDirty = TRUE; + fInterfacePanelDirty = DIRTYLEVEL2; + } + break; + case 'l': if( fAlt ) { @@ -5753,7 +6458,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) // Teleport: CTRL-T if( ( fCtrl )&&( CHEATER_CHEAT_LEVEL( ) ) ) { - // check if selected dest char, + // check if selected dest char, if( ( bSelectedDestChar != -1 ) && ( fPlotForHelicopter == FALSE ) && ( iCurrentMapSectorZ == 0 ) && ( GetMouseMapXY( &sMapX, &sMapY ) ) ) { INT16 sDeltaX, sDeltaY; @@ -5786,11 +6491,11 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) ChangeSelectedMapSector( sMapX, sMapY, 0 ); // check to see if this person is moving, if not...then assign them to mvt group - if( pSoldier->ubGroupID == 0 ) + if( pSoldier->ubGroupID == 0 ) { ubGroupId = CreateNewPlayerGroupDepartingFromSector( ( INT8 ) ( pSoldier->sSectorX ) , ( INT8 ) ( pSoldier->sSectorY ) ); // assign to a group - AddPlayerToGroup( ubGroupId, pSoldier ); + AddPlayerToGroup( ubGroupId, pSoldier ); } // figure out where they would've come from @@ -5807,7 +6512,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) sPrevY = sMapY; } else - { + { // came in from the East sPrevX = sMapX + 1; sPrevY = sMapY; @@ -5823,7 +6528,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) sPrevY = sMapY - 1; } else - { + { // came in from the South sPrevX = sMapX; sPrevY = sMapY + 1; @@ -5837,8 +6542,8 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) CheckAndHandleUnloadingOfCurrentWorld(); } } - else - { + else + { // only handle border button keyboard equivalents if the button is visible! if ( !fShowMapInventoryPool ) { @@ -5868,8 +6573,8 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) if( fCtrl ) { #ifdef SGP_VIDEO_DEBUGGING - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"VObjects: %d", guiVObjectSize ); - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"VSurfaces: %d", guiVSurfaceSize ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"VObjects: %d", guiVObjectSize ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"VSurfaces: %d", guiVSurfaceSize ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"SGPVideoDump.txt updated..." ); PerformVideoInfoDumpIntoFile( "SGPVideoDump.txt", TRUE ); #endif @@ -5879,12 +6584,29 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) DisplayGameSettings( ); } break; + case 'W': case 'w': - // only handle border button keyboard equivalents if the button is visible! - if ( !fShowMapInventoryPool ) + if( fAlt ) { - // toggle show towns filter - ToggleShowTownsMode(); + if ( CHEATER_CHEAT_LEVEL( ) ) + { + if ( InItemDescriptionBox( ) ) + { + CycleItemDescriptionItem( MAP_ITEMDESC_START_X, MAP_ITEMDESC_START_Y ); + } + } + } + else if( fCtrl ) + { + } + else + { + // only handle border button keyboard equivalents if the button is visible! + if ( !fShowMapInventoryPool ) + { + // toggle show towns filter + ToggleShowTownsMode(); + } } break; case 'x': @@ -5983,8 +6705,8 @@ void EndMapScreen( BOOLEAN fDuringFade ) fLeavingMapScreen = FALSE; SetRenderFlags( RENDER_FLAG_FULL ); - //MSYS_EnableRegion( &gViewportRegion ); - //MSYS_EnableRegion( &gRadarRegion ); + //MSYS_EnableRegion( &gViewportRegion ); + //MSYS_EnableRegion( &gRadarRegion ); // ATE: Shutdown tactical interface panel // ShutdownCurrentPanel( ); @@ -5995,8 +6717,8 @@ void EndMapScreen( BOOLEAN fDuringFade ) return; } - - + + // still plotting movement? if( ( bSelectedDestChar != -1 ) || ( fPlotForHelicopter == TRUE ) ) { @@ -6004,9 +6726,9 @@ void EndMapScreen( BOOLEAN fDuringFade ) } DestroyMouseRegionsForTeamList( ); - + MSYS_RemoveRegion( &gMapViewRegion ); - MSYS_RemoveRegion( &gCharInfoFaceRegion); + MSYS_RemoveRegion( &gCharInfoFaceRegion); MSYS_RemoveRegion( &gCharInfoHandRegion ); MSYS_RemoveRegion( &gMPanelRegion); MSYS_RemoveRegion( &gMapScreenMaskRegion ); @@ -6023,10 +6745,10 @@ void EndMapScreen( BOOLEAN fDuringFade ) UnloadButtonImage( giMapContractButtonImage ); RemoveButton( giMapContractButton ); - + HandleShutDownOfMapScreenWhileExternfaceIsTalking( ); - fShowInventoryFlag = FALSE; + fShowInventoryFlag = FALSE; CreateDestroyMapInvButton(); // no longer can we show assignments menu @@ -6048,8 +6770,8 @@ void EndMapScreen( BOOLEAN fDuringFade ) RemoveBox(ghContractBox); ghContractBox = -1; - CreateDestroyAssignmentPopUpBoxes( ); - CreateDestroyMilitiaControlPopUpBoxes( ); //lal + CreateDestroyAssignmentPopUpBoxes( ); + CreateDestroyMilitiaControlPopUpBoxes( ); //lal // shutdown movement box if ( fShowMapScreenMovementList ) @@ -6073,7 +6795,7 @@ void EndMapScreen( BOOLEAN fDuringFade ) CreateDestroyTownInfoBox( ); // build squad list - RebuildCurrentSquad( ); + RebuildCurrentSquad( ); DeleteMouseRegionsForLevelMarkers( ); @@ -6085,20 +6807,20 @@ void EndMapScreen( BOOLEAN fDuringFade ) // delete buttons DeleteMapBorderButtons( ); } - + if(fShowDescriptionFlag) { - DeleteItemDescriptionBox( ); + DeleteItemDescriptionBox( ); } fShowInventoryFlag = FALSE; CreateDestroyTrashCanRegion( ); - if ( !fDuringFade ) - { - MSYS_SetCurrentCursor(SCREEN_CURSOR); - } + if ( !fDuringFade ) + { + MSYS_SetCurrentCursor(SCREEN_CURSOR); + } if(fPreLoadedMapGraphics == FALSE ) { @@ -6129,7 +6851,7 @@ void EndMapScreen( BOOLEAN fDuringFade ) DeleteVideoObjectFromIndex( guiCHARBETWEENSECTORICONSCLOSE ); DeleteVideoObjectFromIndex( guiLEVELMARKER ); DeleteVideoObjectFromIndex( guiMapBorderEtaPopUp ); - + DeleteVideoObjectFromIndex( guiSecItemHiddenVO ); DeleteVideoObjectFromIndex( guiSelectedCharArrow ); DeleteVideoObjectFromIndex( guiMapBorderHeliSectors ); @@ -6138,7 +6860,7 @@ void EndMapScreen( BOOLEAN fDuringFade ) DeleteVideoObjectFromIndex( guiSectorLocatorGraphicID ); DeleteVideoObjectFromIndex( guiBULLSEYE ); - + // remove the militia pop up box RemoveMilitiaPopUpBox( ); @@ -6148,14 +6870,14 @@ void EndMapScreen( BOOLEAN fDuringFade ) // get rid of border stuff DeleteMapBorderGraphics( ); - //Kris: Remove the email icons. + //Kris: Remove the email icons. DeleteVideoObjectFromIndex( guiNewMailIcons ); } DeleteVideoObjectFromIndex( guiBrownBackgroundForTeamPanel ); RemoveMapStatusBarsRegion( ); - + fShowUpdateBox = FALSE; CreateDestroyTheUpdateBox( ); @@ -6185,11 +6907,11 @@ void EndMapScreen( BOOLEAN fDuringFade ) if(fLapTop) { StopAnyCurrentlyTalkingSpeech( ); - guiCurrentScreen=LAPTOP_SCREEN; + guiCurrentScreen=LAPTOP_SCREEN; } else { - guiCurrentScreen = GAME_SCREEN; + guiCurrentScreen = GAME_SCREEN; // remove the progress bar RemoveProgressBar( 0 ); @@ -6215,7 +6937,7 @@ void EndMapScreen( BOOLEAN fDuringFade ) if( !gfDontStartTransitionFromLaptop ) { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; UINT32 uiLaptopOn; //Load a tiny graphic of the on screen and draw it to the buffer. @@ -6231,20 +6953,20 @@ void EndMapScreen( BOOLEAN fDuringFade ) DeleteVideoObjectFromIndex( uiLaptopOn ); RefreshScreen( NULL ); } - - //Kris: Removes the pre battle interface, but only if it exists. - // It is internally considered. + + //Kris: Removes the pre battle interface, but only if it exists. + // It is internally considered. KillPreBattleInterface(); // cancel request if we somehow leave first gfRequestGiveSkyriderNewDestination = FALSE; } - + BOOLEAN GetMouseMapXY( INT16 *psMapWorldX, INT16 *psMapWorldY ) { - POINT MousePos; + POINT MousePos; if( IsMapScreenHelpTextUp( ) ) { @@ -6254,20 +6976,20 @@ BOOLEAN GetMouseMapXY( INT16 *psMapWorldX, INT16 *psMapWorldY ) GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! + ScreenToClient(ghWindow, &MousePos); // In window coords! - if(fZoomFlag) + if(fZoomFlag) { - if(MousePos.x >MAP_GRID_X+MAP_VIEW_START_X) - MousePos.x-=MAP_GRID_X; - if(MousePos.x >MAP_VIEW_START_X+MAP_VIEW_WIDTH) + if(MousePos.x >MAP_GRID_X+MAP_VIEW_START_X) + MousePos.x-=MAP_GRID_X; + if(MousePos.x >MAP_VIEW_START_X+MAP_VIEW_WIDTH) MousePos.x=-1; - if(MousePos.y > MAP_GRID_Y+MAP_VIEW_START_Y) - MousePos.y-=MAP_GRID_Y; - if(MousePos.y >MAP_VIEW_START_Y+MAP_VIEW_HEIGHT-11) - MousePos.y=-11; - if(MousePos.y < MAP_VIEW_START_Y) - MousePos.y=-1; + if(MousePos.y > MAP_GRID_Y+MAP_VIEW_START_Y) + MousePos.y-=MAP_GRID_Y; + if(MousePos.y >MAP_VIEW_START_Y+MAP_VIEW_HEIGHT-11) + MousePos.y=-11; + if(MousePos.y < MAP_VIEW_START_Y) + MousePos.y=-1; } return( GetMapXY( (INT16)MousePos.x, (INT16)MousePos.y, psMapWorldX, psMapWorldY ) ); @@ -6286,7 +7008,7 @@ BOOLEAN GetMapXY( INT16 sX, INT16 sY, INT16 *psMapWorldX, INT16 *psMapWorldY ) if(!fZoomFlag) { - if ( sMapX < MAP_GRID_X || sMapY < MAP_GRID_Y ) + if ( sMapX < MAP_GRID_X || sMapY < MAP_GRID_Y ) { return( FALSE ); } @@ -6304,10 +7026,10 @@ BOOLEAN GetMapXY( INT16 sX, INT16 sY, INT16 *psMapWorldX, INT16 *psMapWorldY ) { return (FALSE); } - + *psMapWorldX = ( sMapX / MAP_GRID_X ); *psMapWorldY = ( sMapY / MAP_GRID_Y ); - + return( TRUE ); } @@ -6316,8 +7038,8 @@ BOOLEAN GetMapXY( INT16 sX, INT16 sY, INT16 *psMapWorldX, INT16 *psMapWorldY ) void RenderMapHighlight( INT16 sMapX, INT16 sMapY, UINT16 usLineColor, BOOLEAN fStationary ) { INT16 sScreenX, sScreenY; - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; Assert( ( sMapX >= 1 ) && ( sMapX <= 16 ) ); @@ -6325,7 +7047,7 @@ void RenderMapHighlight( INT16 sMapX, INT16 sMapY, UINT16 usLineColor, BOOLEAN f /* if((fZoomFlag)&&((sMapX > MAP_WORLD_X-1)||(sMapY> MAP_WORLD_Y-1))) - return; + return; */ // if we are not allowed to highlight, leave @@ -6339,7 +7061,7 @@ void RenderMapHighlight( INT16 sMapX, INT16 sMapY, UINT16 usLineColor, BOOLEAN f return; } else if( ( IsTheCursorAllowedToHighLightThisSector( ( INT16 ) ( ( ( iZoomX ) / ( MAP_GRID_X * 2 ) ) + sMapX / 2 ) ,( INT16 ) ( ( ( iZoomY ) / ( MAP_GRID_Y * 2 ) ) + sMapY / 2 ) ) == FALSE ) && ( fZoomFlag == TRUE ) &&( fStationary == FALSE ) ) - { + { return; } */ @@ -6347,37 +7069,37 @@ void RenderMapHighlight( INT16 sMapX, INT16 sMapY, UINT16 usLineColor, BOOLEAN f // if((!fStationary)||(!fZoomFlag)) { - GetScreenXYFromMapXY( sMapX, sMapY, &sScreenX, &sScreenY ); + GetScreenXYFromMapXY( sMapX, sMapY, &sScreenX, &sScreenY ); } /* - else + else { - GetScreenXYFromMapXYStationary( sMapX, sMapY, &sScreenX, &sScreenY ); + GetScreenXYFromMapXYStationary( sMapX, sMapY, &sScreenX, &sScreenY ); } */ // blit in the highlighted sector - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); // clip to view region ClipBlitsToMapViewRegionForRectangleAndABit( uiDestPitchBYTES ); if(gbPixelDepth==16) { - // DB Need to add a radar color for 8-bit + // DB Need to add a radar color for 8-bit /* if (fZoomFlag) { // draw rectangle for zoom in - RectangleDraw( TRUE, sScreenX-MAP_GRID_X, sScreenY-MAP_GRID_Y - 1, sScreenX + MAP_GRID_ZOOM_X - MAP_GRID_X, sScreenY + MAP_GRID_ZOOM_Y - MAP_GRID_Y - 1, usLineColor, pDestBuf ); - InvalidateRegion( sScreenX-MAP_GRID_X - 3, sScreenY-MAP_GRID_Y - 4, sScreenX + DMAP_GRID_ZOOM_X - MAP_GRID_X, sScreenY + DMAP_GRID_ZOOM_Y - MAP_GRID_Y - 1 ); + RectangleDraw( TRUE, sScreenX-MAP_GRID_X, sScreenY-MAP_GRID_Y - 1, sScreenX + MAP_GRID_ZOOM_X - MAP_GRID_X, sScreenY + MAP_GRID_ZOOM_Y - MAP_GRID_Y - 1, usLineColor, pDestBuf ); + InvalidateRegion( sScreenX-MAP_GRID_X - 3, sScreenY-MAP_GRID_Y - 4, sScreenX + DMAP_GRID_ZOOM_X - MAP_GRID_X, sScreenY + DMAP_GRID_ZOOM_Y - MAP_GRID_Y - 1 ); } - else + else */ { // draw rectangle for zoom out - RectangleDraw( TRUE, sScreenX, sScreenY - 1, sScreenX + MAP_GRID_X, sScreenY + MAP_GRID_Y - 1, usLineColor, pDestBuf ); - InvalidateRegion( sScreenX, sScreenY - 2, sScreenX + DMAP_GRID_X + 1, sScreenY + DMAP_GRID_Y - 1 ); + RectangleDraw( TRUE, sScreenX, sScreenY - 1, sScreenX + MAP_GRID_X, sScreenY + MAP_GRID_Y - 1, usLineColor, pDestBuf ); + InvalidateRegion( sScreenX, sScreenY - 2, sScreenX + DMAP_GRID_X + 1, sScreenY + DMAP_GRID_Y - 1 ); } } @@ -6390,11 +7112,11 @@ void RenderMapHighlight( INT16 sMapX, INT16 sMapY, UINT16 usLineColor, BOOLEAN f void PollLeftButtonInMapView( UINT32 *puiNewEvent ) { static BOOLEAN fLBBeenPressedInMapView = FALSE; - INT16 sMapX, sMapY; + INT16 sMapX, sMapY; // if the mouse is currently over the MAP area - if ( gMapViewRegion.uiFlags & MSYS_MOUSE_IN_AREA ) + if ( gMapViewRegion.uiFlags & MSYS_MOUSE_IN_AREA ) { // if L-button is down at the moment if ( gMapViewRegion.ButtonState & MSYS_LEFT_BUTTON ) @@ -6409,7 +7131,7 @@ void PollLeftButtonInMapView( UINT32 *puiNewEvent ) } else // L-button is NOT down at the moment { - if ( fLBBeenPressedInMapView ) + if ( fLBBeenPressedInMapView ) { fLBBeenPressedInMapView = FALSE; RESETCOUNTER( LMOUSECLICK_DELAY_COUNTER ); @@ -6443,22 +7165,22 @@ void PollLeftButtonInMapView( UINT32 *puiNewEvent ) // ignore left clicks in the map screen if: // game just started or we're in the prebattle interface or if we are about to hit pre-battle if ( ( gTacticalStatus.fDidGameJustStart == TRUE ) || - ( gfPreBattleInterfaceActive == TRUE ) || - ( fDisableMapInterfaceDueToBattle == TRUE ) ) + ( gfPreBattleInterfaceActive == TRUE ) || + ( fDisableMapInterfaceDueToBattle == TRUE ) ) { return; } // if in "plot route" mode - if ( ( bSelectedDestChar != -1 ) || ( fPlotForHelicopter == TRUE ) ) + if ( ( bSelectedDestChar != -1 ) || ( fPlotForHelicopter == TRUE ) ) { fEndPlotting = FALSE; GetMouseMapXY(&sMapX, &sMapY); /* - // translate screen values to map grid values for zoomed in + // translate screen values to map grid values for zoomed in if(fZoomFlag) { sMapX=(UINT16)iZoomX/MAP_GRID_X+sMapX; @@ -6481,7 +7203,7 @@ void PollLeftButtonInMapView( UINT32 *puiNewEvent ) *puiNewEvent = MAP_EVENT_PLOT_PATH; } } - else // not plotting movement + else // not plotting movement { // if not plotting a path if( ( fEndPlotting == FALSE ) && ( fJustFinishedPlotting == FALSE ) ) @@ -6506,11 +7228,11 @@ void PollLeftButtonInMapView( UINT32 *puiNewEvent ) void PollRightButtonInMapView( UINT32 *puiNewEvent ) { static BOOLEAN fRBBeenPressedInMapView = FALSE; - INT16 sMapX, sMapY; + INT16 sMapX, sMapY; // if the mouse is currently over the MAP area - if ( gMapViewRegion.uiFlags & MSYS_MOUSE_IN_AREA ) + if ( gMapViewRegion.uiFlags & MSYS_MOUSE_IN_AREA ) { // if R-button is down at the moment if ( gMapViewRegion.ButtonState & MSYS_RIGHT_BUTTON ) @@ -6561,8 +7283,8 @@ void PollRightButtonInMapView( UINT32 *puiNewEvent ) // ignore right clicks in the map area if: // game just started or we're in the prebattle interface or if we are about to hit pre-battle if ( ( gTacticalStatus.fDidGameJustStart == TRUE ) || - ( gfPreBattleInterfaceActive == TRUE ) || - ( fDisableMapInterfaceDueToBattle == TRUE ) ) + ( gfPreBattleInterfaceActive == TRUE ) || + ( fDisableMapInterfaceDueToBattle == TRUE ) ) { return; } @@ -6604,7 +7326,7 @@ void PollRightButtonInMapView( UINT32 *puiNewEvent ) { // if on the surface, or a real underground sector (we've visited it) if ( ( iCurrentMapSectorZ == 0 ) || - ( GetSectorFlagStatus( sMapX, sMapY, ( UINT8 ) iCurrentMapSectorZ, SF_ALREADY_VISITED ) == TRUE ) ) + ( GetSectorFlagStatus( sMapX, sMapY, ( UINT8 ) iCurrentMapSectorZ, SF_ALREADY_VISITED ) == TRUE ) ) { // toggle sector info for this sector fShowTownInfo = !fShowTownInfo; @@ -6629,15 +7351,15 @@ void PollRightButtonInMapView( UINT32 *puiNewEvent ) -void PopupText( STR16 pFontString, ... ) +void PopupText( STR16 pFontString, ... ) { - UINT8 *pDestBuf; + UINT8 *pDestBuf; UINT32 uiDestPitchBYTES; va_list argptr; INT16 sX, sY; CHAR16 PopupString[512]; - va_start(argptr, pFontString); // Set up variable argument pointer + va_start(argptr, pFontString); // Set up variable argument pointer vswprintf(PopupString, pFontString, argptr); // process gprintf string (get output str) va_end(argptr); @@ -6650,7 +7372,7 @@ void PopupText( STR16 pFontString, ... ) SetFont( LARGEFONT1 ); SetFontBackground( FONT_MCOLOR_BLACK ); - SetFontForeground( FONT_MCOLOR_DKGRAY ); + SetFontForeground( FONT_MCOLOR_DKGRAY ); mprintf_buffer( pDestBuf, uiDestPitchBYTES, LARGEFONT1, sX, sY, PopupString ); @@ -6673,32 +7395,32 @@ void BtnINVCallback(GUI_BUTTON *btn,INT32 reason) return; if(!(btn->uiFlags & BUTTON_CLICKED_ON)) { - fCharacterInfoPanelDirty = TRUE; + fCharacterInfoPanelDirty = TRUE; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if(btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&= ~(BUTTON_CLICKED_ON); + btn->uiFlags&= ~(BUTTON_CLICKED_ON); - if(!fMapInventoryItem) - { - fShowInventoryFlag = FALSE; - } + if(!fMapInventoryItem) + { + fShowInventoryFlag = FALSE; + } - // set help text for item glow region - if( fShowInventoryFlag ) - { - SetRegionFastHelpText( &gCharInfoHandRegion, pMiscMapScreenMouseRegionHelpText[ 2 ] ); - } - else - { - SetRegionFastHelpText( &gCharInfoHandRegion, pMiscMapScreenMouseRegionHelpText[ 0 ] ); - } + // set help text for item glow region + if( fShowInventoryFlag ) + { + SetRegionFastHelpText( &gCharInfoHandRegion, pMiscMapScreenMouseRegionHelpText[ 2 ] ); + } + else + { + SetRegionFastHelpText( &gCharInfoHandRegion, pMiscMapScreenMouseRegionHelpText[ 0 ] ); + } - fTeamPanelDirty = TRUE; + fTeamPanelDirty = TRUE; } } } @@ -6707,21 +7429,27 @@ void BtnINVCallback(GUI_BUTTON *btn,INT32 reason) void CreateDestroyMapInvButton() { - static BOOLEAN fOldShowInventoryFlag=FALSE; + static BOOLEAN fOldShowInventoryFlag=FALSE; if( fShowInventoryFlag && !fOldShowInventoryFlag ) { - // create inventory button - fOldShowInventoryFlag=TRUE; - //giMapInvButtonImage= LoadButtonImage( "INTERFACE\\mapinv.sti" ,-1,1,-1,2,-1 ); - //giMapInvButton= QuickCreateButton( giMapInvButtonImage, INV_BTN_X-1, INV_BTN_Y, + // create inventory button + fOldShowInventoryFlag=TRUE; + //giMapInvButtonImage= LoadButtonImage( "INTERFACE\\mapinv.sti" ,-1,1,-1,2,-1 ); + //giMapInvButton= QuickCreateButton( giMapInvButtonImage, INV_BTN_X-1, INV_BTN_Y, // BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, // BUTTON_NO_CALLBACK, (GUI_CALLBACK)BtnINVCallback); - // disable allmouse regions in this space - fTeamPanelDirty=TRUE; + // disable allmouse regions in this space + fTeamPanelDirty=TRUE; - InitInvSlotInterface( gMapScreenInvPocketXY, &gSCamoXY, MAPInvMoveCallback, MAPInvClickCallback, MAPInvMoveCamoCallback, MAPInvClickCamoCallback, FALSE ); - MSYS_EnableRegion(&gMPanelRegion); + // CHRISL: Setup default coords + if((UsingNewInventorySystem() == true)) + InitializeInvPanelCoordsNew(); + else + InitializeInvPanelCoordsOld(); + + InitInvSlotInterface( gMapScreenInvPocketXY, &gSCamoXY, MAPInvMoveCallback, MAPInvClickCallback, MAPInvMoveCamoCallback, MAPInvClickCamoCallback, FALSE ); + MSYS_EnableRegion(&gMPanelRegion); // switch hand region help text to "Exit Inventory" SetRegionFastHelpText( &gCharInfoHandRegion, pMiscMapScreenMouseRegionHelpText[ 2 ] ); @@ -6729,18 +7457,19 @@ void CreateDestroyMapInvButton() // reset inventory item help text memset( gubMAP_HandInvDispText, 0, sizeof( gubMAP_HandInvDispText ) ); - // dirty character info panel ( Why? ARM ) + // dirty character info panel ( Why? ARM ) fCharacterInfoPanelDirty=TRUE; + fResetMapCoords=TRUE; } else if( !fShowInventoryFlag && fOldShowInventoryFlag ) { - // destroy inventory button - ShutdownInvSlotInterface( ); - fOldShowInventoryFlag=FALSE; - //RemoveButton( giMapInvButton ); - //UnloadButtonImage( giMapInvButtonImage ); - fTeamPanelDirty=TRUE; - MSYS_DisableRegion(&gMPanelRegion); + // destroy inventory button + ShutdownInvSlotInterface( ); + fOldShowInventoryFlag=FALSE; + //RemoveButton( giMapInvButton ); + //UnloadButtonImage( giMapInvButtonImage ); + fTeamPanelDirty=TRUE; + MSYS_DisableRegion(&gMPanelRegion); // switch hand region help text to "Enter Inventory" SetRegionFastHelpText( &gCharInfoHandRegion, pMiscMapScreenMouseRegionHelpText[ 0 ] ); @@ -6755,27 +7484,54 @@ void CreateDestroyMapInvButton() void BltCharInvPanel() { UINT32 uiDestPitchBYTES; - UINT16 *pDestBuf; + UINT16 *pDestBuf; HVOBJECT hCharListHandle; SOLDIERTYPE *pSoldier; CHAR16 sString[ 32 ]; INT16 usX, usY; - INT32 iCounter = 0; + UINT8 disOpt = 0; // make sure we're here legally Assert( MapCharacterHasAccessibleInventory( bSelectedInfoChar ) ); - + GetSoldier( &pSoldier, gCharactersList[bSelectedInfoChar].usSolID ); - - pDestBuf = (UINT16*)LockVideoSurface( guiSAVEBUFFER, &uiDestPitchBYTES); - GetVideoObject(&hCharListHandle, guiMAPINV); - Blt8BPPDataTo16BPPBufferTransparent( pDestBuf, uiDestPitchBYTES, hCharListHandle, PLAYER_INFO_X, PLAYER_INFO_Y, 0); - UnLockVideoSurface( guiSAVEBUFFER ); - - Assert( pSoldier ); - CreateDestroyMapInvButton(); + + pDestBuf = (UINT16*)LockVideoSurface( guiSAVEBUFFER, &uiDestPitchBYTES); + GetVideoObject(&hCharListHandle, guiMAPINV); + // CHRISL: Changed last parameter so we can display graphic based on inventory system used + if((UsingNewInventorySystem() == true) && gGameExternalOptions.fVehicleInventory && (pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE)) + { + if(fResetMapCoords) + { + InitializeInvPanelCoordsVehicle(); + // This function sets the mouse regions for the vehicle inventory + InitInventoryVehicle(gMapScreenInvPocketXY, MAPInvMoveCallback, MAPInvClickCallback, FALSE); + fResetMapCoords=FALSE; + } + disOpt = 2; + } + else if((UsingNewInventorySystem() == true)) + { + if(fResetMapCoords) + { + InitializeInvPanelCoordsNew(); + // This function sets the mouse regions for the soldier inventory + InitInventorySoldier(gMapScreenInvPocketXY, MAPInvMoveCallback, MAPInvClickCallback, FALSE); + fResetMapCoords=FALSE; + } + disOpt = 1; + } + else + { + //InitializeInvPanelCoordsOld(); + } + Blt8BPPDataTo16BPPBufferTransparent( pDestBuf, uiDestPitchBYTES, hCharListHandle, PLAYER_INFO_X, PLAYER_INFO_Y, disOpt); + UnLockVideoSurface( guiSAVEBUFFER ); + + Assert( pSoldier ); + CreateDestroyMapInvButton(); if( gbCheckForMouseOverItemPos != -1 ) { @@ -6793,14 +7549,14 @@ void BltCharInvPanel() } } - RenderInvBodyPanel(pSoldier, INV_BODY_X, INV_BODY_Y ); - + RenderInvBodyPanel(pSoldier, INV_BODY_X, INV_BODY_Y ); + // reset font destination buffer to the save buffer SetFontDestBuffer( guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); - + // render items in each of chars slots - HandleRenderInvSlots( pSoldier, DIRTYLEVEL2 ); - + HandleRenderInvSlots( pSoldier, DIRTYLEVEL2 ); + // reset font destination buffer SetFontDestBuffer( FRAME_BUFFER, 0,0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); @@ -6813,35 +7569,42 @@ void BltCharInvPanel() SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( MAP_INV_STATS_TITLE_FONT_COLOR ); - // print armor/weight/camo labels - mprintf( MAP_ARMOR_LABEL_X, MAP_ARMOR_LABEL_Y, pInvPanelTitleStrings[ 0 ] ); - mprintf( MAP_ARMOR_PERCENT_X, MAP_ARMOR_PERCENT_Y, L"%%" ); + // CHRISL: Only display next three values if we're a merc +// if(!(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE)) + if(!(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE)) + { + // print armor/weight/camo labels + mprintf( MAP_ARMOR_LABEL_X, MAP_ARMOR_LABEL_Y, pInvPanelTitleStrings[ 0 ] ); + mprintf( MAP_ARMOR_PERCENT_X, MAP_ARMOR_PERCENT_Y, L"%%" ); - mprintf( MAP_WEIGHT_LABEL_X, MAP_WEIGHT_LABEL_Y, pInvPanelTitleStrings[ 1 ] ); - mprintf( MAP_WEIGHT_PERCENT_X, MAP_WEIGHT_PERCENT_Y, L"%%" ); - - mprintf( MAP_CAMMO_LABEL_X, MAP_CAMMO_LABEL_Y, pInvPanelTitleStrings[ 2 ] ); - mprintf( MAP_CAMMO_PERCENT_X, MAP_CAMMO_PERCENT_Y, L"%%" ); + mprintf( MAP_WEIGHT_LABEL_X, MAP_WEIGHT_LABEL_Y, pInvPanelTitleStrings[ 1 ] ); + mprintf( MAP_WEIGHT_PERCENT_X, MAP_WEIGHT_PERCENT_Y, L"%%" ); - // display armor value - swprintf( sString, L"%3d", ArmourPercent( pSoldier ) ); - FindFontRightCoordinates(MAP_ARMOR_X, MAP_ARMOR_Y, MAP_PERCENT_WIDTH, MAP_PERCENT_HEIGHT, sString, BLOCKFONT2, &usX, &usY); - mprintf( usX, usY, sString ); + mprintf( MAP_CAMMO_LABEL_X, MAP_CAMMO_LABEL_Y, pInvPanelTitleStrings[ 2 ] ); + mprintf( MAP_CAMMO_PERCENT_X, MAP_CAMMO_PERCENT_Y, L"%%" ); - // Display weight value - swprintf( sString, L"%3d", CalculateCarriedWeight( pSoldier ) ); - FindFontRightCoordinates(MAP_WEIGHT_X, MAP_WEIGHT_Y, MAP_PERCENT_WIDTH, MAP_PERCENT_HEIGHT, sString, BLOCKFONT2, &usX, &usY); - mprintf( usX, usY, sString ); + // display armor value + swprintf( sString, L"%3d", ArmourPercent( pSoldier ) ); + FindFontRightCoordinates(MAP_ARMOR_X, MAP_ARMOR_Y, MAP_PERCENT_WIDTH, MAP_PERCENT_HEIGHT, sString, BLOCKFONT2, &usX, &usY); + mprintf( usX, usY, sString ); - // Display camo value - swprintf( sString, L"%3d", max(0, min ((pSoldier->bCamo + pSoldier->wornCamo + pSoldier->urbanCamo+pSoldier->wornUrbanCamo+pSoldier->desertCamo+pSoldier->wornDesertCamo+pSoldier->snowCamo+pSoldier->wornSnowCamo ),100 )) ); - FindFontRightCoordinates(MAP_CAMMO_X, MAP_CAMMO_Y, MAP_PERCENT_WIDTH, MAP_PERCENT_HEIGHT, sString, BLOCKFONT2, &usX, &usY); - mprintf( usX, usY, sString ); + // Display weight value + swprintf( sString, L"%3d", CalculateCarriedWeight( pSoldier ) ); + FindFontRightCoordinates(MAP_WEIGHT_X, MAP_WEIGHT_Y, MAP_PERCENT_WIDTH, MAP_PERCENT_HEIGHT, sString, BLOCKFONT2, &usX, &usY); + mprintf( usX, usY, sString ); + + ApplyEquipmentBonuses(pSoldier); + + // Display camo value + swprintf( sString, L"%3d", max(0, min ((pSoldier->bCamo + pSoldier->wornCamo + pSoldier->urbanCamo+pSoldier->wornUrbanCamo+pSoldier->desertCamo+pSoldier->wornDesertCamo+pSoldier->snowCamo+pSoldier->wornSnowCamo ),100 )) ); + FindFontRightCoordinates(MAP_CAMMO_X, MAP_CAMMO_Y, MAP_PERCENT_WIDTH, MAP_PERCENT_HEIGHT, sString, BLOCKFONT2, &usX, &usY); + mprintf( usX, usY, sString ); + } if( InKeyRingPopup( ) ) { // shade the background - ShadowVideoSurfaceRect( guiSAVEBUFFER , PLAYER_INFO_X, PLAYER_INFO_Y, PLAYER_INFO_X + 261, PLAYER_INFO_Y + ( 359 - 107 )); + ShadowVideoSurfaceRect( guiSAVEBUFFER , PLAYER_INFO_X, PLAYER_INFO_Y, PLAYER_INFO_X + 261, PLAYER_INFO_Y + ( 359 - 107 )); } else { @@ -6851,7 +7614,7 @@ void BltCharInvPanel() SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); } -// check for and highlight any ammo +// check for and highlight any ammo void HandleCursorOverRifleAmmo( ) { if( fShowInventoryFlag == FALSE ) @@ -6865,7 +7628,7 @@ void HandleCursorOverRifleAmmo( ) } if ( gfCheckForMouseOverItem ) - { + { if ( HandleCompatibleAmmoUI( &Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ], (INT8)gbCheckForMouseOverItemPos, TRUE ) ) { if ( ( GetJA2Clock( ) - guiMouseOverItemTime ) > 100 ) @@ -6910,14 +7673,14 @@ void MAPInvMoveCallback( MOUSE_REGION *pRegion, INT32 iReason ) //gbCheckForMouseOverItemPos = -1; - if ( pSoldier->inv[ uiHandPos ].usItem == NOTHING ) + if ( pSoldier->inv[ uiHandPos ].exists() == false ) return; if (iReason == MSYS_CALLBACK_REASON_MOVE) { } else if (iReason == MSYS_CALLBACK_REASON_GAIN_MOUSE ) -// if( ( iReason == MSYS_CALLBACK_REASON_MOVE ) || ( iReason == MSYS_CALLBACK_REASON_GAIN_MOUSE ) ) +// if( ( iReason == MSYS_CALLBACK_REASON_MOVE ) || ( iReason == MSYS_CALLBACK_REASON_GAIN_MOUSE ) ) { gubMAP_HandInvDispText[ uiHandPos ] = 2; guiMouseOverItemTime = GetJA2Clock( ); @@ -6931,8 +7694,8 @@ void MAPInvMoveCallback( MOUSE_REGION *pRegion, INT32 iReason ) HandleCompatibleAmmoUI( pSoldier, (INT8)uiHandPos, FALSE ); gfCheckForMouseOverItem = FALSE; fTeamPanelDirty = TRUE; - gbCheckForMouseOverItemPos = -1; - } + gbCheckForMouseOverItemPos = -1; + } } // mapscreen wrapper to init the item description box @@ -6949,6 +7712,9 @@ BOOLEAN MAPInternalInitItemDescriptionBox( OBJECTTYPE *pObject, UINT8 ubStatusIn return( fRet ); } +//CHRISL: functons for LBENODE system +extern BOOLEAN ChangeZipperStatus(SOLDIERTYPE *pSoldier, BOOLEAN newStatus); + // this is Map Screen's version of SMInvClickCallback() void MAPInvClickCallback( MOUSE_REGION *pRegion, INT32 iReason ) { @@ -6970,13 +7736,17 @@ void MAPInvClickCallback( MOUSE_REGION *pRegion, INT32 iReason ) uiHandPos = MSYS_GetRegionUserData( pRegion, 0 ); + // CHRISL: Are we in combat, wearing a backpack with the zipper closed? Don't allow access to backpack items + if((UsingNewInventorySystem() == true)) + if(icLBE[uiHandPos] == BPACKPOCKPOS && (!(pSoldier->flags.ZipperFlag) || (pSoldier->flags.ZipperFlag && gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_STAND)) && (gTacticalStatus.uiFlags & INCOMBAT) && (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP )) + iReason = MSYS_CALLBACK_REASON_NONE; if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) { // If we do not have an item in hand, start moving it if ( gpItemPointer == NULL ) { // Return if empty - if ( pSoldier->inv[ uiHandPos ].usItem == NOTHING ) + if ( pSoldier->inv[ uiHandPos ].exists() == false ) { return; } @@ -6992,6 +7762,31 @@ void MAPInvClickCallback( MOUSE_REGION *pRegion, INT32 iReason ) CleanUpStack( &( pSoldier->inv[ uiHandPos ] ), NULL ); } + /* CHRISL: For New Inventory system. Are we removing an existing LBE item? If so, we need to pull + all items in the relevant IC Group pockets out of the soldiers inventory and put them into the LBE items + inventory. But first, find out if we already have a LBE item inventory for this item and this merc. If we + do, remove the items from it and place them into the sector the LBE inventory is located in.*/ + if((UsingNewInventorySystem() == true) && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE)) + { + /*if we pick up a backpack without reactivating the drop pack button, and we have a + dropkey, reactivate the button*/ + if(uiHandPos == BPACKPOCKPOS) + { + // Deal with the zipper before we do anything + if(pSoldier->flags.ZipperFlag) + if(!ChangeZipperStatus(pSoldier, FALSE)) + return; + // Do we still have a linked backpack? If so, reset droppackflag + for(unsigned int wi = 0; wi < guiNumWorldItems; wi++) + { + if(gWorldItems[wi].soldierID == pSoldier->ubID && gWorldItems[wi].object.exists() == true) + { + pSoldier->flags.DropPackFlag = TRUE; + } + } + } + } + // remember what it was usOldItemIndex = pSoldier->inv[ uiHandPos ].usItem; @@ -7003,7 +7798,7 @@ void MAPInvClickCallback( MOUSE_REGION *pRegion, INT32 iReason ) HandleTacticalEffectsOfEquipmentChange( pSoldier, uiHandPos, usOldItemIndex, NOTHING ); - fInterfacePanelDirty = DIRTYLEVEL2; + fInterfacePanelDirty = DIRTYLEVEL2; fCharacterInfoPanelDirty = TRUE; } else // item in cursor @@ -7026,7 +7821,7 @@ void MAPInvClickCallback( MOUSE_REGION *pRegion, INT32 iReason ) if ( _KeyDown(CTRL) ) { CleanUpStack( &( pSoldier->inv[ uiHandPos ] ), gpItemPointer ); - if ( gpItemPointer->ubNumberOfObjects == 0 ) + if ( gpItemPointer->exists() == false ) { MAPEndItemPointer( ); } @@ -7036,8 +7831,11 @@ void MAPInvClickCallback( MOUSE_REGION *pRegion, INT32 iReason ) // !!! ATTACHING/MERGING ITEMS IN MAP SCREEN IS NOT SUPPORTED !!! if ( uiHandPos == HANDPOS || uiHandPos == SECONDHANDPOS || uiHandPos == HELMETPOS || uiHandPos == VESTPOS || uiHandPos == LEGPOS ) { + if((UsingNewInventorySystem() == true) && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE)) + { + } //if ( ValidAttachmentClass( usNewItemIndex, usOldItemIndex ) ) - if ( ValidAttachment( usNewItemIndex, usOldItemIndex ) ) + else if ( ValidAttachment( usNewItemIndex, usOldItemIndex ) ) { // it's an attempt to attach; bring up the inventory panel if ( !InItemDescriptionBox( ) ) @@ -7068,6 +7866,23 @@ void MAPInvClickCallback( MOUSE_REGION *pRegion, INT32 iReason ) // else handle normally } + if((UsingNewInventorySystem() == true) && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE)) + { + if((uiHandPos == VESTPOCKPOS || uiHandPos == LTHIGHPOCKPOS || uiHandPos == RTHIGHPOCKPOS || uiHandPos == CPACKPOCKPOS || uiHandPos == BPACKPOCKPOS) && CanItemFitInPosition(pSoldier, gpItemPointer, uiHandPos, FALSE)) + { + //If we put a new pack in the backpack pocket, turn off the droppack button + if(uiHandPos == BPACKPOCKPOS) + { + // First, deal with the zipper + if(pSoldier->flags.ZipperFlag) + if(!ChangeZipperStatus(pSoldier, FALSE)) + return; + if(pSoldier->flags.DropPackFlag) + pSoldier->flags.DropPackFlag = FALSE; + } + } + } + // Else, try to place here if ( PlaceObject( pSoldier, (UINT8)uiHandPos, gpItemPointer ) ) { @@ -7080,7 +7895,7 @@ void MAPInvClickCallback( MOUSE_REGION *pRegion, INT32 iReason ) fMapPanelDirty = TRUE; // Check if cursor is empty now - if ( gpItemPointer->ubNumberOfObjects == 0 ) + if ( gpItemPointer->exists() == false ) { MAPEndItemPointer( ); } @@ -7090,7 +7905,7 @@ void MAPInvClickCallback( MOUSE_REGION *pRegion, INT32 iReason ) guiExternVo = GetInterfaceGraphicForItem( &(Item[ gpItemPointer->usItem ]) ); gusExternVoSubIndex = Item[ gpItemPointer->usItem ].ubGraphicNum; - MSYS_ChangeRegionCursor( &gMPanelRegion , EXTERN_CURSOR ); + MSYS_ChangeRegionCursor( &gMPanelRegion , EXTERN_CURSOR ); MSYS_SetCurrentCursor( EXTERN_CURSOR ); fMapInventoryItem=TRUE; fTeamPanelDirty=TRUE; @@ -7131,30 +7946,36 @@ void MAPInvClickCallback( MOUSE_REGION *pRegion, INT32 iReason ) fRightDown = FALSE; // Return if empty - if (pSoldier->inv[ uiHandPos ].usItem == NOTHING ) + if (pSoldier->inv[ uiHandPos ].exists() == false ) { return; } // Some global stuff here - for esc, etc // Check for # of slots in item - if ( ( pSoldier->inv[ uiHandPos ].ubNumberOfObjects > 1 ) && ( ItemSlotLimit( pSoldier->inv[ uiHandPos ].usItem, (UINT8)uiHandPos ) > 0 ) ) + // CHRISL: Use new ItemSlotLimit function if we're using the new inventory system + UINT8 isLimit = ItemSlotLimit(&pSoldier->inv[uiHandPos], uiHandPos, pSoldier); + if ( ( pSoldier->inv[ uiHandPos ].ubNumberOfObjects > 1 ) && ( isLimit > 0 ) ) { if ( !InItemStackPopup( ) ) { - InitItemStackPopup( pSoldier, (UINT8)uiHandPos, 0, INV_REGION_Y, 261, 248 ); - fTeamPanelDirty=TRUE; - fInterfacePanelDirty = DIRTYLEVEL2; + // CHRISL: Changed final parameter so that we fill the inventory screen + InitItemStackPopup( pSoldier, (UINT8)uiHandPos, 0, INV_REGION_Y, 261, ( SCREEN_HEIGHT - PLAYER_INFO_Y ) ); + fTeamPanelDirty=TRUE; + fInterfacePanelDirty = DIRTYLEVEL2; } } else { if ( !InItemDescriptionBox( ) ) { - InitItemDescriptionBox( pSoldier, (UINT8)uiHandPos, MAP_ITEMDESC_START_X, MAP_ITEMDESC_START_Y, 0 ); - fShowDescriptionFlag=TRUE; - fTeamPanelDirty=TRUE; - fInterfacePanelDirty = DIRTYLEVEL2; + //CHRISL: This could return a false in which case we don't want to activate the infobox. + if(InitItemDescriptionBox( pSoldier, (UINT8)uiHandPos, MAP_ITEMDESC_START_X, MAP_ITEMDESC_START_Y, 0 )) + { + fShowDescriptionFlag=TRUE; + fTeamPanelDirty=TRUE; + fInterfacePanelDirty = DIRTYLEVEL2; + } } } } @@ -7182,7 +8003,7 @@ void InternalMAPBeginItemPointer( SOLDIERTYPE *pSoldier ) guiExternVo = GetInterfaceGraphicForItem( &(Item[ gpItemPointer->usItem ]) ); gusExternVoSubIndex = Item[ gpItemPointer->usItem ].ubGraphicNum; - MSYS_ChangeRegionCursor( &gMPanelRegion , EXTERN_CURSOR ); + MSYS_ChangeRegionCursor( &gMPanelRegion , EXTERN_CURSOR ); MSYS_SetCurrentCursor( EXTERN_CURSOR ); fMapInventoryItem=TRUE; fTeamPanelDirty=TRUE; @@ -7197,7 +8018,6 @@ void InternalMAPBeginItemPointer( SOLDIERTYPE *pSoldier ) void MAPBeginItemPointer( SOLDIERTYPE *pSoldier, UINT8 ubHandPos ) { - BOOLEAN fOk; // If not null return if ( gpItemPointer != NULL ) @@ -7205,20 +8025,29 @@ void MAPBeginItemPointer( SOLDIERTYPE *pSoldier, UINT8 ubHandPos ) return; } + int numToMove = 0; if (_KeyDown( SHIFT )) { // Remove all from soldier's slot - fOk = RemoveObjectFromSlot( pSoldier, ubHandPos, &gItemPointer ); + numToMove = ALL_OBJECTS; } else { - GetObjFrom( &(pSoldier->inv[ubHandPos]), 0, &gItemPointer ); - fOk = (gItemPointer.ubNumberOfObjects == 1); + numToMove = 1; + } + pSoldier->inv[ubHandPos].MoveThisObjectTo(gItemPointer, numToMove, pSoldier, ubHandPos); + + if ( gItemPointer.exists() == false ) + { + //oops, the move failed. It might have failed because the object was force placed + //to a slot where the ItemSizeLimit is 0, try again + //this method won't work with LBEs in LBE pockets + pSoldier->inv[ubHandPos].MoveThisObjectTo(gItemPointer, numToMove); } - if ( fOk ) + if ( gItemPointer.exists() == true ) { - InternalMAPBeginItemPointer( pSoldier ); + InternalMAPBeginItemPointer( pSoldier ); } } @@ -7235,9 +8064,9 @@ void MAPBeginKeyRingItemPointer( SOLDIERTYPE *pSoldier, UINT8 uiKeySlot ) guiExternVo = GetInterfaceGraphicForItem( &(Item[ gpItemPointer->usItem ]) ); gusExternVoSubIndex = Item[ gpItemPointer->usItem ].ubGraphicNum; - MSYS_ChangeRegionCursor( &gMPanelRegion , EXTERN_CURSOR ); + MSYS_ChangeRegionCursor( &gMPanelRegion , EXTERN_CURSOR ); MSYS_SetCurrentCursor( EXTERN_CURSOR ); - fMapInventoryItem=TRUE; + fMapInventoryItem=TRUE; fTeamPanelDirty=TRUE; } @@ -7246,7 +8075,7 @@ void MAPEndItemPointer( ) if ( gpItemPointer != NULL ) { gpItemPointer = NULL; - MSYS_ChangeRegionCursor( &gMPanelRegion , CURSOR_NORMAL ); + MSYS_ChangeRegionCursor( &gMPanelRegion , CURSOR_NORMAL ); MSYS_SetCurrentCursor( CURSOR_NORMAL ); fMapInventoryItem=FALSE; fTeamPanelDirty=TRUE; @@ -7267,7 +8096,7 @@ void MAPEndItemPointer( ) void HandleMapInventoryCursor() { if(fMapInventoryItem) - MSYS_SetCurrentCursor( EXTERN_CURSOR ); + MSYS_SetCurrentCursor( EXTERN_CURSOR ); return; } @@ -7278,7 +8107,7 @@ void RenderAttributeStringsForUpperLeftHandCorner( UINT32 uiBufferToRenderTo ) INT32 iCounter = 0; SOLDIERTYPE *pSoldier = NULL; - + if ( ( bSelectedInfoChar != - 1) && ( gCharactersList[ bSelectedInfoChar ].fValid ) ) { pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]; @@ -7287,29 +8116,29 @@ void RenderAttributeStringsForUpperLeftHandCorner( UINT32 uiBufferToRenderTo ) SetFont( CHAR_FONT ); SetFontForeground( CHAR_TITLE_FONT_COLOR ); SetFontBackground( FONT_BLACK ); - SetFontDestBuffer( uiBufferToRenderTo, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); + SetFontDestBuffer( uiBufferToRenderTo, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); // assignment strings DrawString( pUpperLeftMapScreenStrings[ 0 ], (UINT16)(220 - StringPixLength( pUpperLeftMapScreenStrings[0], CHAR_FONT)/2), 6, CHAR_FONT); // vehicles and robot don't have attributes, contracts, or morale - if ( ( pSoldier == NULL ) || ( !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) ) ) + if ( ( pSoldier == NULL ) || ( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) ) ) { // health DrawString(pUpperLeftMapScreenStrings[ 2 ], 87, 80, CHAR_FONT); for( iCounter = 0; iCounter < 5; iCounter++ ) { - DrawString(pShortAttributeStrings[ iCounter ], 88, ( INT16 )( 22 + iCounter * 10 ) ,CHAR_FONT ); + DrawString(pShortAttributeStrings[ iCounter ], 88, ( INT16 )( 22 + iCounter * 10 ) ,CHAR_FONT ); DrawString(pShortAttributeStrings[ iCounter + 5 ] ,133, ( INT16 )( 22 + iCounter * 10 ), CHAR_FONT ); } - // contract - //DrawString(pUpperLeftMapScreenStrings[ 1 ], 194, 52, CHAR_FONT); + // contract + //DrawString(pUpperLeftMapScreenStrings[ 1 ], 194, 52, CHAR_FONT); // morale - DrawString(pUpperLeftMapScreenStrings[ 3 ], 87, 94, CHAR_FONT); + DrawString(pUpperLeftMapScreenStrings[ 3 ], 87, 94, CHAR_FONT); } else { @@ -7319,7 +8148,7 @@ void RenderAttributeStringsForUpperLeftHandCorner( UINT32 uiBufferToRenderTo ) // restore buffer - SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); + SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); } @@ -7327,15 +8156,15 @@ void DisplayThePotentialPathForCurrentDestinationCharacterForMapScreenInterface( { // simply check if we want to refresh the screen to display path static INT8 bOldDestChar = -1; - static INT16 sPrevMapX, sPrevMapY; + static INT16 sPrevMapX, sPrevMapY; INT32 iDifference = 0; if( bOldDestChar != bSelectedDestChar ) { bOldDestChar = bSelectedDestChar; - giPotCharPathBaseTime = GetJA2Clock( ); - + giPotCharPathBaseTime = GetJA2Clock( ); + sPrevMapX = sMapX; sPrevMapY = sMapY; fTempPathAlreadyDrawn = FALSE; @@ -7346,10 +8175,10 @@ void DisplayThePotentialPathForCurrentDestinationCharacterForMapScreenInterface( if( ( sMapX != sPrevMapX) || ( sMapY != sPrevMapY ) ) { giPotCharPathBaseTime = GetJA2Clock( ); - + sPrevMapX = sMapX; sPrevMapY = sMapY; - + // path was plotted and we moved, re draw map..to clean up mess if( fTempPathAlreadyDrawn == TRUE ) { @@ -7361,7 +8190,7 @@ void DisplayThePotentialPathForCurrentDestinationCharacterForMapScreenInterface( } iDifference = GetJA2Clock( ) - giPotCharPathBaseTime ; - + if( fTempPathAlreadyDrawn == TRUE ) { return; @@ -7370,7 +8199,7 @@ void DisplayThePotentialPathForCurrentDestinationCharacterForMapScreenInterface( if( iDifference > MIN_WAIT_TIME_FOR_TEMP_PATH ) { fDrawTempPath = TRUE; - giPotCharPathBaseTime = GetJA2Clock( ); + giPotCharPathBaseTime = GetJA2Clock( ); fTempPathAlreadyDrawn = TRUE; } @@ -7394,7 +8223,7 @@ void SetUpCursorForStrategicMap( void ) else // yes - by character { // set cursor based on foot or vehicle - if( ( Menptr[gCharactersList[ bSelectedDestChar ].usSolID].bAssignment != VEHICLE ) && !( Menptr[gCharactersList[ bSelectedDestChar ].usSolID].uiStatusFlags & SOLDIER_VEHICLE ) ) + if( ( Menptr[gCharactersList[ bSelectedDestChar ].usSolID].bAssignment != VEHICLE ) && !( Menptr[gCharactersList[ bSelectedDestChar ].usSolID].flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { ChangeMapScreenMaskCursor( CURSOR_STRATEGIC_FOOT ); } @@ -7424,9 +8253,9 @@ void HandleAnimatedCursorsForMapScreen( ) if ( COUNTERDONE( CURSORCOUNTER ) ) { - RESETCOUNTER( CURSORCOUNTER ); - UpdateAnimatedCursorFrames( gMapScreenMaskRegion.Cursor ); - SetCurrentCursorFromDatabase( gMapScreenMaskRegion.Cursor ); + RESETCOUNTER( CURSORCOUNTER ); + UpdateAnimatedCursorFrames( gMapScreenMaskRegion.Cursor ); + SetCurrentCursorFromDatabase( gMapScreenMaskRegion.Cursor ); } } @@ -7489,22 +8318,22 @@ void AbortMovementPlottingMode( void ) -void CheckToSeeIfMouseHasLeftMapRegionDuringPathPlotting( ) +void CheckToSeeIfMouseHasLeftMapRegionDuringPathPlotting( ) { static BOOLEAN fInArea = FALSE; - + if ( ( gMapViewRegion.uiFlags & MSYS_MOUSE_IN_AREA ) == 0 ) { - + if( fInArea == TRUE ) { fInArea = FALSE; - + // plotting path, clean up if( ( ( bSelectedDestChar != -1 ) || ( fPlotForHelicopter == TRUE ) || ( fDrawTempHeliPath == TRUE ) ) && ( fTempPathAlreadyDrawn == TRUE ) ) { fDrawTempHeliPath = FALSE; - fMapPanelDirty = TRUE; + fMapPanelDirty = TRUE; gfRenderPBInterface = TRUE; // clear the temp path @@ -7533,18 +8362,22 @@ void CheckToSeeIfMouseHasLeftMapRegionDuringPathPlotting( ) void BlitBackgroundToSaveBuffer( void ) { - INT8 bTempDestChar = -1; // render map RenderMapRegionBackground( ); + // Headrock: Moved the following line here from the marker below, so that the Inventory Bottom panel + // renders underneath the character info panel (and so doesn't truncate the large open inventory). We may + // need to put TRUE here if there's any problem, but I doubt it. + RenderMapScreenInterfaceBottom( FALSE ); + if( fDisableDueToBattleRoster == FALSE ) { - // render team - RenderTeamRegionBackground( ); + // render team + RenderTeamRegionBackground( ); - // render character info - RenderCharacterInfoBackground( ); + // render character info + RenderCharacterInfoBackground( ); } else if( gfPreBattleInterfaceActive ) { @@ -7558,7 +8391,8 @@ void BlitBackgroundToSaveBuffer( void ) } // now render lower panel - RenderMapScreenInterfaceBottom( ); + // HEADROCK - Moved the following line upwards, so it renders BEFORE the character info panel. + // RenderMapScreenInterfaceBottom( ); } void CreateMouseRegionsForTeamList( void ) @@ -7589,53 +8423,53 @@ void CreateMouseRegionsForTeamList( void ) // name region MSYS_DefineRegion( &gTeamListNameRegion[ sCounter ] , NAME_X, ( INT16 )( sYStart + ( sOffsetCounter ) * ( Y_SIZE + 2 )), NAME_X + NAME_WIDTH, ( INT16 )( (sYStart + 10) + ( sOffsetCounter + 1 ) * ( Y_SIZE + 2 )), MSYS_PRIORITY_NORMAL, - MSYS_NO_CURSOR, TeamListInfoRegionMvtCallBack, TeamListInfoRegionBtnCallBack ); + MSYS_NO_CURSOR, TeamListInfoRegionMvtCallBack, TeamListInfoRegionBtnCallBack ); // assignment region MSYS_DefineRegion( &gTeamListAssignmentRegion[ sCounter ] ,ASSIGN_X , ( INT16 )( sYStart + ( sOffsetCounter ) * ( Y_SIZE + 2 )), ASSIGN_X + ASSIGN_WIDTH, ( INT16 )( (sYStart + 10) + ( sOffsetCounter + 1 ) * ( Y_SIZE + 2 )), MSYS_PRIORITY_NORMAL + 1, - MSYS_NO_CURSOR, TeamListAssignmentRegionMvtCallBack, TeamListAssignmentRegionBtnCallBack ); + MSYS_NO_CURSOR, TeamListAssignmentRegionMvtCallBack, TeamListAssignmentRegionBtnCallBack ); // location region (same function as name regions, so uses the same callbacks) MSYS_DefineRegion( &gTeamListLocationRegion[ sCounter ] , LOC_X, ( INT16 )( sYStart + ( sOffsetCounter ) * ( Y_SIZE + 2 )), LOC_X + LOC_WIDTH, ( INT16 )( (sYStart + 10) + ( sOffsetCounter + 1 ) * ( Y_SIZE + 2 )), MSYS_PRIORITY_NORMAL + 1, - MSYS_NO_CURSOR, TeamListInfoRegionMvtCallBack, TeamListInfoRegionBtnCallBack ); + MSYS_NO_CURSOR, TeamListInfoRegionMvtCallBack, TeamListInfoRegionBtnCallBack ); // destination region MSYS_DefineRegion( &gTeamListDestinationRegion[ sCounter ] ,DEST_ETA_X , ( INT16 )( sYStart + ( sOffsetCounter ) * ( Y_SIZE + 2 )), DEST_ETA_X + DEST_ETA_WIDTH, ( INT16 )( (sYStart + 10) + ( sOffsetCounter + 1 ) * ( Y_SIZE + 2 )), MSYS_PRIORITY_NORMAL + 1, - MSYS_NO_CURSOR, TeamListDestinationRegionMvtCallBack, TeamListDestinationRegionBtnCallBack ); + MSYS_NO_CURSOR, TeamListDestinationRegionMvtCallBack, TeamListDestinationRegionBtnCallBack ); // contract region MSYS_DefineRegion( &gTeamListContractRegion[ sCounter ] ,TIME_REMAINING_X , ( INT16 )( sYStart + ( sOffsetCounter ) * ( Y_SIZE + 2 )), TIME_REMAINING_X + TIME_REMAINING_WIDTH, ( INT16 )( (sYStart + 10) + ( sOffsetCounter + 1 ) * ( Y_SIZE + 2 )), MSYS_PRIORITY_NORMAL + 1, - MSYS_NO_CURSOR, TeamListContractRegionMvtCallBack, TeamListContractRegionBtnCallBack ); + MSYS_NO_CURSOR, TeamListContractRegionMvtCallBack, TeamListContractRegionBtnCallBack ); // contract region MSYS_DefineRegion( &gTeamListSleepRegion[ sCounter ] ,SLEEP_X, ( INT16 )( sYStart + ( sOffsetCounter ) * ( Y_SIZE + 2 )), SLEEP_X + SLEEP_WIDTH, ( INT16 )( (sYStart + 10) + ( sOffsetCounter + 1 ) * ( Y_SIZE + 2 )), MSYS_PRIORITY_NORMAL + 1, - MSYS_NO_CURSOR, TeamListSleepRegionMvtCallBack, TeamListSleepRegionBtnCallBack ); + MSYS_NO_CURSOR, TeamListSleepRegionMvtCallBack, TeamListSleepRegionBtnCallBack ); + + - - //// name region //MSYS_DefineRegion( &gTeamListNameRegion[ sCounter ] , NAME_X, ( INT16 )( Y_START + ( sCounter ) * ( Y_SIZE + 2 ) + sYAdd ), NAME_X + NAME_WIDTH, ( INT16 )( 145 + ( sCounter + 1 ) * ( Y_SIZE + 2 ) + sYAdd ), MSYS_PRIORITY_NORMAL, - // MSYS_NO_CURSOR, TeamListInfoRegionMvtCallBack, TeamListInfoRegionBtnCallBack ); + // MSYS_NO_CURSOR, TeamListInfoRegionMvtCallBack, TeamListInfoRegionBtnCallBack ); //// assignment region //MSYS_DefineRegion( &gTeamListAssignmentRegion[ sCounter ] ,ASSIGN_X , ( INT16 )( Y_START + ( sCounter ) * ( Y_SIZE + 2 ) + sYAdd), ASSIGN_X + ASSIGN_WIDTH, ( INT16 )( 145 + ( sCounter + 1 ) * ( Y_SIZE + 2 ) + sYAdd ), MSYS_PRIORITY_NORMAL + 1, - // MSYS_NO_CURSOR, TeamListAssignmentRegionMvtCallBack, TeamListAssignmentRegionBtnCallBack ); + // MSYS_NO_CURSOR, TeamListAssignmentRegionMvtCallBack, TeamListAssignmentRegionBtnCallBack ); //// location region (same function as name regions, so uses the same callbacks) //MSYS_DefineRegion( &gTeamListLocationRegion[ sCounter ] , LOC_X, ( INT16 )( Y_START + ( sCounter ) * ( Y_SIZE + 2 ) + sYAdd ), LOC_X + LOC_WIDTH, ( INT16 )( 145 + ( sCounter + 1 ) * ( Y_SIZE + 2 ) + sYAdd ), MSYS_PRIORITY_NORMAL + 1, - // MSYS_NO_CURSOR, TeamListInfoRegionMvtCallBack, TeamListInfoRegionBtnCallBack ); + // MSYS_NO_CURSOR, TeamListInfoRegionMvtCallBack, TeamListInfoRegionBtnCallBack ); //// destination region //MSYS_DefineRegion( &gTeamListDestinationRegion[ sCounter ] ,DEST_ETA_X , ( INT16 )( Y_START + ( sCounter ) * ( Y_SIZE + 2 ) + sYAdd ), DEST_ETA_X + DEST_ETA_WIDTH, ( INT16 )( 145 + ( sCounter + 1 ) * ( Y_SIZE + 2 ) + sYAdd ), MSYS_PRIORITY_NORMAL + 1, - // MSYS_NO_CURSOR, TeamListDestinationRegionMvtCallBack, TeamListDestinationRegionBtnCallBack ); + // MSYS_NO_CURSOR, TeamListDestinationRegionMvtCallBack, TeamListDestinationRegionBtnCallBack ); //// contract region //MSYS_DefineRegion( &gTeamListContractRegion[ sCounter ] ,TIME_REMAINING_X , ( INT16 )( Y_START + ( sCounter ) * ( Y_SIZE + 2 ) + sYAdd), TIME_REMAINING_X + TIME_REMAINING_WIDTH, ( INT16 )( 145 + ( sCounter + 1 ) * ( Y_SIZE + 2 ) + sYAdd ), MSYS_PRIORITY_NORMAL + 1, - // MSYS_NO_CURSOR, TeamListContractRegionMvtCallBack, TeamListContractRegionBtnCallBack ); + // MSYS_NO_CURSOR, TeamListContractRegionMvtCallBack, TeamListContractRegionBtnCallBack ); //// contract region //MSYS_DefineRegion( &gTeamListSleepRegion[ sCounter ] ,SLEEP_X, ( INT16 )( Y_START + ( sCounter ) * ( Y_SIZE + 2 ) + sYAdd), SLEEP_X + SLEEP_WIDTH, ( INT16 )( 145 + ( sCounter + 1 ) * ( Y_SIZE + 2 ) + sYAdd ), MSYS_PRIORITY_NORMAL + 1, - // MSYS_NO_CURSOR, TeamListSleepRegionMvtCallBack, TeamListSleepRegionBtnCallBack ); + // MSYS_NO_CURSOR, TeamListSleepRegionMvtCallBack, TeamListSleepRegionBtnCallBack ); MSYS_SetRegionUserData(&gTeamListNameRegion[sCounter],0,sCounter); @@ -7666,7 +8500,7 @@ void DestroyMouseRegionsForTeamList( void ) for( sCounter = 0; sCounter < MAX_CHARACTER_COUNT; sCounter++ ) { - MSYS_RemoveRegion( &gTeamListNameRegion[ sCounter ]); + MSYS_RemoveRegion( &gTeamListNameRegion[ sCounter ]); MSYS_RemoveRegion( &gTeamListAssignmentRegion[ sCounter ]); MSYS_RemoveRegion( &gTeamListSleepRegion[ sCounter ]); MSYS_RemoveRegion( &gTeamListDestinationRegion[ sCounter ]); @@ -7722,22 +8556,22 @@ void ContractButtonCallback(GUI_BUTTON *btn,INT32 reason) fCharacterInfoPanelDirty = TRUE; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { + { if( IsMapScreenHelpTextUp() ) { // stop mapscreen text StopMapScreenHelpText( ); } - if (btn->uiFlags & BUTTON_CLICKED_ON) + if (btn->uiFlags & BUTTON_CLICKED_ON) { btn->uiFlags&= ~(BUTTON_CLICKED_ON); RequestContractMenu( ); - } + } } else if(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN ) { @@ -7788,14 +8622,14 @@ void TeamListInfoRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) // highlight giDestHighLine = -1; - // reset character + // reset character bSelectedAssignChar = -1; bSelectedDestChar = -1; bSelectedContractChar = -1; fPlotForHelicopter = FALSE; // if not dead or POW, select his sector - if( ( pSoldier->bLife > 0 ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) ) + if( ( pSoldier->stats.bLife > 0 ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) ) { ChangeSelectedMapSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ); } @@ -7834,7 +8668,7 @@ void TeamListInfoRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) // select this character ChangeSelectedInfoChar( ( INT8 ) iValue, TRUE ); - + RequestToggleMercInventoryPanel(); @@ -7842,14 +8676,14 @@ void TeamListInfoRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) // highlight giDestHighLine = -1; - // reset character + // reset character bSelectedAssignChar = -1; bSelectedDestChar = -1; bSelectedContractChar = -1; fPlotForHelicopter = FALSE; // if not dead or POW, select his sector - if( ( pSoldier->bLife > 0 ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) ) + if( ( pSoldier->stats.bLife > 0 ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) ) { ChangeSelectedMapSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ); } @@ -7938,7 +8772,7 @@ void TeamListAssignmentRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) // if alive (dead guys keep going, use remove menu instead), // and it's between sectors and it can be reassigned (non-vehicles) - if ( ( pSoldier->bAssignment != ASSIGNMENT_DEAD ) && ( pSoldier->bLife > 0 ) && ( pSoldier->fBetweenSectors ) && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( ( pSoldier->bAssignment != ASSIGNMENT_DEAD ) && ( pSoldier->stats.bLife > 0 ) && ( pSoldier->flags.fBetweenSectors ) && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { // can't reassign mercs while between sectors DoScreenIndependantMessageBox( pMapErrorString[ 41 ], MSG_BOX_FLAG_OK, NULL ); @@ -7957,7 +8791,7 @@ void TeamListAssignmentRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) giContractHighLine = -1; // can't highlight line, anymore..if we were - giDestHighLine = -1; + giDestHighLine = -1; // dirty team and map regions fTeamPanelDirty = TRUE; @@ -7965,13 +8799,13 @@ void TeamListAssignmentRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) gfRenderPBInterface = TRUE; // if this thing can be re-assigned - if( !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { giAssignHighLine = iValue; fShowAssignmentMenu = TRUE; - if( ( pSoldier->bLife == 0 ) || ( pSoldier->bAssignment == ASSIGNMENT_POW ) ) + if( ( pSoldier->stats.bLife == 0 ) || ( pSoldier->bAssignment == ASSIGNMENT_POW ) ) { fShowRemoveMenu = TRUE; } @@ -8018,7 +8852,7 @@ void TeamListAssignmentRegionMvtCallBack(MOUSE_REGION *pRegion, INT32 iReason ) { giHighLine = iValue; - if( !( Menptr[ gCharactersList[ iValue ].usSolID ].uiStatusFlags & SOLDIER_VEHICLE ) ) + if( !( Menptr[ gCharactersList[ iValue ].usSolID ].flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { giAssignHighLine = iValue; } @@ -8048,11 +8882,11 @@ void TeamListAssignmentRegionMvtCallBack(MOUSE_REGION *pRegion, INT32 iReason ) } else if( iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) { - if( ( gCharactersList[ iValue ].fValid == TRUE ) && - !( Menptr[ gCharactersList[ iValue ].usSolID ].uiStatusFlags & SOLDIER_VEHICLE ) ) + if( ( gCharactersList[ iValue ].fValid == TRUE ) && + !( Menptr[ gCharactersList[ iValue ].usSolID ].flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { // play click - PlayGlowRegionSound( ); + PlayGlowRegionSound( ); } } } @@ -8211,8 +9045,8 @@ void TeamListDestinationRegionMvtCallBack(MOUSE_REGION *pRegion, INT32 iReason ) if( bSelectedDestChar == -1 ) { - giDestHighLine = -1; - } + giDestHighLine = -1; + } // restore background RestoreBackgroundForDestinationGlowRegionList( ); @@ -8268,7 +9102,7 @@ void TeamListSleepRegionBtnCallBack( MOUSE_REGION *pRegion, INT32 iReason ) { pSoldier = &Menptr[ gCharactersList[ iValue ].usSolID ]; - if( pSoldier->fMercAsleep == TRUE ) + if( pSoldier->flags.fMercAsleep == TRUE ) { // try to wake him up if( SetMercAwake( pSoldier, TRUE, FALSE ) ) @@ -8448,7 +9282,7 @@ void TeamListContractRegionMvtCallBack(MOUSE_REGION *pRegion, INT32 iReason ) // no longer valid char?...reset display of highlight boxes if( fShowContractMenu == FALSE ) { - giContractHighLine = -1; + giContractHighLine = -1; } // restore background @@ -8466,7 +9300,7 @@ void TeamListContractRegionMvtCallBack(MOUSE_REGION *pRegion, INT32 iReason ) -INT32 GetIndexForThisSoldier( SOLDIERTYPE *pSoldier ) +INT32 GetIndexForthis( SOLDIERTYPE *pSoldier ) { INT32 iLastGuy; INT32 iIndex = 0; @@ -8497,7 +9331,7 @@ BOOLEAN IsCursorWithInRegion(INT16 sLeft, INT16 sRight, INT16 sTop, INT16 sBotto // get cursor position GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! + ScreenToClient(ghWindow, &MousePos); // In window coords! // is it within region? @@ -8528,13 +9362,13 @@ void HandleHighLightingOfLinesInTeamPanel( void ) RestoreBackgroundForSleepGlowRegionList( ); HighLightAssignLine( /*(UINT16)giAssignHighLine*/ ); // doesn't take parameters (jonathanl) - HighLightDestLine( /*(UINT16)giDestHighLine */); // doesn't take parameters (jonathanl) + HighLightDestLine( /*(UINT16)giDestHighLine */); // doesn't take parameters (jonathanl) HighLightSleepLine( /*(UINT16)giSleepHighLine */); // doesn't take parameters (jonathanl) // contracts? if( giContractHighLine != -1 ) { - ContractListRegionBoxGlow( ( UINT16 ) giContractHighLine ); + ContractListRegionBoxGlow( ( UINT16 ) giContractHighLine ); } } @@ -8547,7 +9381,7 @@ void PlotPermanentPaths( void ) } else if( bSelectedDestChar != -1 ) { - DisplaySoldierPath( &Menptr[ gCharactersList[ bSelectedDestChar ].usSolID ] ); + DisplaySoldierPath( &Menptr[ gCharactersList[ bSelectedDestChar ].usSolID ] ); } } @@ -8566,10 +9400,10 @@ void PlotTemporaryPaths( void ) /* if( fZoomFlag ) { - sMapX = ( INT16 )( ( ( iZoomX ) / ( WORLD_MAP_X ) ) + sMapX ); + sMapX = ( INT16 )( ( ( iZoomX ) / ( WORLD_MAP_X ) ) + sMapX ); sMapX /= 2; - sMapY = ( INT16 )( ( ( iZoomY ) / ( WORLD_MAP_X ) ) + sMapY ); + sMapY = ( INT16 )( ( ( iZoomY ) / ( WORLD_MAP_X ) ) + sMapY ); sMapY /= 2; } */ @@ -8591,16 +9425,16 @@ void PlotTemporaryPaths( void ) } } else - // dest char has been selected, + // dest char has been selected, if( bSelectedDestChar != -1 ) { /* if( fZoomFlag ) { - sMapX = ( INT16 )( ( ( iZoomX ) / ( MAP_GRID_X ) ) + sMapX ); + sMapX = ( INT16 )( ( ( iZoomX ) / ( MAP_GRID_X ) ) + sMapX ); sMapX /= 2; - sMapY = ( INT16 )( ( ( iZoomY ) / ( MAP_GRID_Y ) ) + sMapY ); + sMapY = ( INT16 )( ( ( iZoomY ) / ( MAP_GRID_Y ) ) + sMapY ); sMapY /= 2; } */ @@ -8608,7 +9442,7 @@ void PlotTemporaryPaths( void ) PlotATemporaryPathForCharacter( &Menptr[ gCharactersList[ bSelectedDestChar ].usSolID ], sMapX, sMapY ); // check to see if we are drawing path - DisplayThePotentialPathForCurrentDestinationCharacterForMapScreenInterface( sMapX, sMapY ); + DisplayThePotentialPathForCurrentDestinationCharacterForMapScreenInterface( sMapX, sMapY ); // if we need to draw path, do it if( fDrawTempPath == TRUE ) @@ -8697,8 +9531,8 @@ void RenderTeamRegionBackground( void ) { // not dirty, leave return; - } - + } + // show inventory or the team list? if(fShowInventoryFlag == FALSE ) { @@ -8709,7 +9543,7 @@ void RenderTeamRegionBackground( void ) { BltCharInvPanel(); } - + if ( !fShowInventoryFlag ) { @@ -8721,10 +9555,10 @@ void RenderTeamRegionBackground( void ) fDrawCharacterList = FALSE; - + // display arrows by selected people HandleDisplayOfSelectedMercArrows( ); - DisplayIconsForMercsAsleep( ); + DisplayIconsForMercsAsleep( ); // reset dirty flag @@ -8733,11 +9567,20 @@ void RenderTeamRegionBackground( void ) // mark all pop ups as dirty MarkAllBoxesAsAltered( ); - - // restore background for area - - RestoreExternBackgroundRect( 0, 107, 261, SCREEN_HEIGHT - 106 - 121 ); + // restore background for area + if(fShowInventoryFlag == TRUE && UsingNewInventorySystem() == false){ + RestoreExternBackgroundRect( 0, 107, 261, SCREEN_HEIGHT - 106 - 121 ); + } + else if(fShowInventoryFlag == TRUE && iResolution == 0){ + RestoreExternBackgroundRect( 0, 107, 261, SCREEN_HEIGHT - 107 ); + } + else if(fShowInventoryFlag == TRUE && iResolution == 1){ + RestoreExternBackgroundRect( 0, 107, 261, SCREEN_HEIGHT - 107 ); + } + else if(fShowInventoryFlag == FALSE || iResolution == 2){ + RestoreExternBackgroundRect( 0, 107, 261, SCREEN_HEIGHT - 107 - 121 ); + } MapscreenMarkButtonsDirty(); return; @@ -8761,10 +9604,10 @@ void RenderCharacterInfoBackground( void ) // the upleft hand corner character info panel GetVideoObject(&hHandle, guiCHARINFO); BltVideoObject( guiSAVEBUFFER , hHandle, 0,TOWN_INFO_X, TOWN_INFO_Y , VO_BLT_SRCTRANSPARENCY,NULL ); - + UpdateHelpTextForMapScreenMercIcons( ); - if( ( bSelectedInfoChar != -1) && ( fDisableDueToBattleRoster == FALSE ) ) + if( ( bSelectedInfoChar != -1) && ( fDisableDueToBattleRoster == FALSE ) ) { // valid char to display DisplayCharacterInfo(); @@ -8786,7 +9629,7 @@ void RenderCharacterInfoBackground( void ) // mark all pop ups as dirty MarkAllBoxesAsAltered( ); - + // restore background for area RestoreExternBackgroundRect( 0, 0, 261, 107 ); @@ -8809,7 +9652,7 @@ void DetermineIfContractMenuCanBeShown( void ) HideBox( ghRemoveMercAssignBox ); } - + return; } @@ -8822,7 +9665,7 @@ void DetermineIfContractMenuCanBeShown( void ) // determine which lines selectable HandleShadingOfLinesForContractMenu( ); - if( Menptr[gCharactersList[ bSelectedInfoChar ].usSolID].bLife == 0 ) + if( Menptr[gCharactersList[ bSelectedInfoChar ].usSolID].stats.bLife == 0 ) { // show basic assignment menu ShowBox( ghRemoveMercAssignBox ); @@ -8887,7 +9730,7 @@ void ContractRegionBtnCallback( MOUSE_REGION *pRegion, INT32 iReason ) // create RebuildContractBoxForMerc( pSoldier ); - + // reset selected characters ResetAllSelectedCharacterModes( ); @@ -8932,12 +9775,12 @@ void ContractRegionMvtCallback( MOUSE_REGION *pRegion, INT32 iReason ) // not showing box and lost mouse?..stop glowing if( fShowContractMenu == FALSE ) { - fGlowContractRegion = FALSE; - fCharacterInfoPanelDirty = TRUE; - giContractHighLine = -1; - - // reset glow - fResetContractGlow = TRUE; + fGlowContractRegion = FALSE; + fCharacterInfoPanelDirty = TRUE; + giContractHighLine = -1; + + // reset glow + fResetContractGlow = TRUE; } } @@ -8994,7 +9837,7 @@ void HandleShadingOfLinesForContractMenu( void ) // is guy in AIM? and well enough to talk and make such decisions? - if( ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) && ( pSoldier->bLife >= OKLIFE ) ) + if( ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) && ( pSoldier->stats.bLife >= OKLIFE ) ) { pProfile = &( gMercProfiles[ pSoldier->ubProfile ] ); @@ -9056,8 +9899,8 @@ void ReBuildCharactersList( void ) // add in characters - for ( sCount = 0; sCount < MAX_CHARACTER_COUNT; sCount++) - { + for ( sCount = 0; sCount < MAX_CHARACTER_COUNT; sCount++) + { // clear this slot gCharactersList[ sCount ].fValid = FALSE; gCharactersList[ sCount ].usSolID = 0; @@ -9065,8 +9908,8 @@ void ReBuildCharactersList( void ) for ( sCount = 0; sCount < MAX_CHARACTER_COUNT; sCount++) { - // add character into the cleared slot - AddCharacter( &Menptr[ gTacticalStatus.Team[ OUR_TEAM ].bFirstID + sCount ] ); + // add character into the cleared slot + AddCharacter( &Menptr[ gTacticalStatus.Team[ OUR_TEAM ].bFirstID + sCount ] ); } @@ -9143,7 +9986,7 @@ void TestMessageSystem( void ) for( iCounter = 0; iCounter < 300; iCounter++ ) { - MapScreenMessage( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"%d", iCounter ); + MapScreenMessage( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"%d", iCounter ); } MapScreenMessage( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"%d", iCounter ); @@ -9176,8 +10019,8 @@ void EnableDisableTeamListRegionsAndHelpText( void ) MSYS_EnableRegion( &gTeamListNameRegion[ bCharNum ] ); MSYS_EnableRegion( &gTeamListLocationRegion[ bCharNum ] ); - // valid character. If it's a vehicle, however - if ( Menptr[ gCharactersList[ bCharNum ].usSolID ].uiStatusFlags & SOLDIER_VEHICLE ) + // valid character. If it's a vehicle, however + if ( Menptr[ gCharactersList[ bCharNum ].usSolID ].flags.uiStatusFlags & SOLDIER_VEHICLE ) { // Can't change assignment for vehicles MSYS_DisableRegion( &gTeamListAssignmentRegion[ bCharNum ] ); @@ -9188,7 +10031,7 @@ void EnableDisableTeamListRegionsAndHelpText( void ) // POW or dead ? if ( ( Menptr[ gCharactersList[ bCharNum ].usSolID ].bAssignment == ASSIGNMENT_POW ) || - ( Menptr[ gCharactersList[ bCharNum ].usSolID ].bLife == 0 ) ) + ( Menptr[ gCharactersList[ bCharNum ].usSolID ].stats.bLife == 0 ) ) { // "Remove Merc" SetRegionFastHelpText( &gTeamListAssignmentRegion[ bCharNum ], pRemoveMercStrings[ 0 ] ); @@ -9264,7 +10107,7 @@ void ResetAllSelectedCharacterModes( void ) AbortMovementPlottingMode(); } - // reset assign character + // reset assign character bSelectedAssignChar = -1; // reset contract character @@ -9272,10 +10115,10 @@ void ResetAllSelectedCharacterModes( void ) // reset map cursor to normal - if ( !gfFadeOutDone && !gfFadeIn ) - { - SetUpCursorForStrategicMap( ); - } + if ( !gfFadeOutDone && !gfFadeIn ) + { + SetUpCursorForStrategicMap( ); + } return; } @@ -9322,7 +10165,7 @@ BOOLEAN ContinueDialogue(SOLDIERTYPE *pSoldier, BOOLEAN fDone ) INT8 bCounter = 0; - + if( fDone == TRUE ) @@ -9374,7 +10217,7 @@ BOOLEAN ContinueDialogue(SOLDIERTYPE *pSoldier, BOOLEAN fDone ) } -void HandleSpontanousTalking( ) +void HandleSpontanousTalking( ) { // simply polls if the talking guy is done, if so...send an end command to continue dialogue @@ -9426,7 +10269,7 @@ BOOLEAN CheckIfClickOnLastSectorInPath( INT16 sX, INT16 sY ) return( FALSE ); } - // invalid soldier? we shouldn't be here! + // invalid soldier? we shouldn't be here! if( gCharactersList[ bSelectedDestChar ].fValid == FALSE ) { bSelectedDestChar = -1; @@ -9438,7 +10281,7 @@ BOOLEAN CheckIfClickOnLastSectorInPath( INT16 sX, INT16 sY ) // clicked on last sector, reset plotting mode // if he's IN a vehicle or IS a vehicle - if( ( Menptr[gCharactersList[ bSelectedDestChar ].usSolID].bAssignment == VEHICLE ) || ( Menptr[gCharactersList[ bSelectedDestChar ].usSolID].uiStatusFlags & SOLDIER_VEHICLE ) ) + if( ( Menptr[gCharactersList[ bSelectedDestChar ].usSolID].bAssignment == VEHICLE ) || ( Menptr[gCharactersList[ bSelectedDestChar ].usSolID].flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { if( Menptr[gCharactersList[ bSelectedDestChar ].usSolID].bAssignment == VEHICLE ) { @@ -9524,7 +10367,7 @@ void RebuildWayPointsForAllSelectedCharsGroups( void ) // if he's IN a vehicle or IS a vehicle - if( ( pSoldier->bAssignment == VEHICLE ) || ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if( ( pSoldier->bAssignment == VEHICLE ) || ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { if( pSoldier->bAssignment == VEHICLE ) { @@ -9568,11 +10411,11 @@ void UpdateCursorIfInLastSector( void ) INT16 sMapX = 0, sMapY = 0; // check to see if we are plotting a path, if so, see if we are highlighting the last sector int he path, if so, change the cursor - if ( ( bSelectedDestChar != -1) || ( fPlotForHelicopter == TRUE ) ) - { + if ( ( bSelectedDestChar != -1) || ( fPlotForHelicopter == TRUE ) ) + { GetMouseMapXY(&sMapX, &sMapY); - // translate screen values to map grid values for zoomed in + // translate screen values to map grid values for zoomed in if(fZoomFlag) { sMapX=(UINT16)iZoomX/MAP_GRID_X+sMapX; @@ -9632,7 +10475,7 @@ void FaceRegionBtnCallback( MOUSE_REGION *pRegion, INT32 iReason ) { // error checking, make sure someone is there if( bSelectedInfoChar == -1 ) - { + { return; } else if( gCharactersList[ bSelectedInfoChar ].fValid == FALSE ) @@ -9682,7 +10525,7 @@ void FaceRegionMvtCallback( MOUSE_REGION *pRegion, INT32 iReason ) { fShowFaceHightLight = TRUE; } - else if( iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + else if( iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { fShowFaceHightLight = FALSE; } @@ -9703,7 +10546,7 @@ void ItemRegionBtnCallback( MOUSE_REGION *pRegion, INT32 iReason ) void ItemRegionMvtCallback( MOUSE_REGION *pRegion, INT32 iReason ) { if ( !CanToggleSelectedCharInventory() ) - { + { fShowItemHighLight = FALSE; return; } @@ -9712,7 +10555,7 @@ void ItemRegionMvtCallback( MOUSE_REGION *pRegion, INT32 iReason ) { fShowItemHighLight = TRUE; } - else if( iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + else if( iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { fShowItemHighLight = FALSE; } @@ -9765,7 +10608,7 @@ void UpdateTownMinePopUpDisplay( void ) void HandleCharBarRender( void ) { - // check if the panel is disbled, if so, do not render + // check if the panel is disbled, if so, do not render if( ( bSelectedInfoChar !=-1) && ( fDisableDueToBattleRoster == FALSE ) ) { // valid character?...render @@ -9791,12 +10634,12 @@ void UpDateStatusOfContractBox( void ) { ForceUpDateOfBox( ghContractBox ); - if( ( Menptr[gCharactersList[ bSelectedInfoChar ].usSolID].bLife == 0 )||( Menptr[gCharactersList[bSelectedInfoChar].usSolID].bAssignment == ASSIGNMENT_POW ) ) + if( ( Menptr[gCharactersList[ bSelectedInfoChar ].usSolID].stats.bLife == 0 )||( Menptr[gCharactersList[bSelectedInfoChar].usSolID].bAssignment == ASSIGNMENT_POW ) ) { ForceUpDateOfBox( ghRemoveMercAssignBox ); } } - + return; } @@ -9806,7 +10649,7 @@ void DestroyTheItemInCursor( ) { // actually destroy this item // End Item pickup - MAPEndItemPointer( ); + MAPEndItemPointer( ); gpItemPointer = NULL; } @@ -9820,7 +10663,7 @@ void TrashItemMessageBoxCallBack( UINT8 bExitValue ) DestroyTheItemInCursor( ); // reset cursor - MSYS_ChangeRegionCursor( &gSMPanelRegion , CURSOR_NORMAL ); + MSYS_ChangeRegionCursor( &gSMPanelRegion , CURSOR_NORMAL ); SetCurrentCursorFromDatabase( CURSOR_NORMAL ); HandleButtonStatesWhileMapInventoryActive( ); @@ -9830,7 +10673,7 @@ void TrashItemMessageBoxCallBack( UINT8 bExitValue ) void TrashCanBtnCallback( MOUSE_REGION *pRegion, INT32 iReason) { - + if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) { if( IsMapScreenHelpTextUp() ) @@ -9843,15 +10686,16 @@ void TrashCanBtnCallback( MOUSE_REGION *pRegion, INT32 iReason) // check if an item is in the cursor, if so, warn player if( gpItemPointer != NULL ) { - // set up for mapscreen - if( gpItemPointer -> ubMission ) - { + // set up for mapscreen + Assert(! gpItemPointer->ubMission); + //if( gpItemPointer->ubMission ) + //{ DoMapMessageBox( MSG_BOX_BASIC_STYLE, pTrashItemText[ 1 ], MAP_SCREEN, MSG_BOX_FLAG_YESNO, TrashItemMessageBoxCallBack ); - } - else - { - DoMapMessageBox( MSG_BOX_BASIC_STYLE, pTrashItemText[ 0 ], MAP_SCREEN, MSG_BOX_FLAG_YESNO, TrashItemMessageBoxCallBack ); - } + //} + //else + //{ + // DoMapMessageBox( MSG_BOX_BASIC_STYLE, pTrashItemText[ 0 ], MAP_SCREEN, MSG_BOX_FLAG_YESNO, TrashItemMessageBoxCallBack ); + //} } } } @@ -9859,17 +10703,17 @@ void TrashCanBtnCallback( MOUSE_REGION *pRegion, INT32 iReason) void TrashCanMoveCallback( MOUSE_REGION *pRegion, INT32 iReason) { - + if (iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) { if( gMPanelRegion.Cursor == EXTERN_CURSOR ) { - fShowTrashCanHighLight = TRUE; + fShowTrashCanHighLight = TRUE; } } else if( iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { - fShowTrashCanHighLight = FALSE; + fShowTrashCanHighLight = FALSE; } } @@ -9894,7 +10738,7 @@ void UpdateStatusOfMapSortButtons( void ) { HideButton( giMapSortButton[ iCounter ] ); } - if ( gfPreBattleInterfaceActive ) + if ( gfPreBattleInterfaceActive ) { HideButton( giCharInfoButton[ 0 ] ); HideButton( giCharInfoButton[ 1 ] ); @@ -9931,7 +10775,7 @@ INT8 GetLastValidCharacterInTeamPanelList( void ) { if( gCharactersList[ iCounter ].fValid == TRUE ) { - if(( Menptr[ gCharactersList[ iCounter ].usSolID ].bLife >= OKLIFE ) ) + if(( Menptr[ gCharactersList[ iCounter ].usSolID ].stats.bLife >= OKLIFE ) ) { if( fShowMapInventoryPool ) { @@ -9948,7 +10792,7 @@ INT8 GetLastValidCharacterInTeamPanelList( void ) { if( gCharactersList[ bSelectedInfoChar ].fValid == TRUE ) { - if( Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorX == Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorX && Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorY == Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorY && Menptr[ gCharactersList[ iCounter ].usSolID ].bSectorZ ==Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].bSectorZ ) + if( Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorX == Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorX && Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorY == Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorY && Menptr[ gCharactersList[ iCounter ].usSolID ].bSectorZ ==Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].bSectorZ ) { iValue = iCounter; } @@ -9969,7 +10813,7 @@ INT8 GetLastValidCharacterInTeamPanelList( void ) } /* -// NB These functions weren't being called anywhere! Use GoToNextCharacterInList etc instead +// NB These functions weren't being called anywhere! Use GoToNextCharacterInList etc instead INT8 GetPrevValidCharacterInTeamPanelList( INT8 bCurrentIndex ) { INT8 iCounter = bCurrentIndex, iValue = 0; @@ -9983,7 +10827,7 @@ INT8 GetPrevValidCharacterInTeamPanelList( INT8 bCurrentIndex ) { if( fShowMapInventoryPool ) { - if( Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorX == sSelMapX && Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorY == sSelMapY && Menptr[ gCharactersList[ iCounter ].usSolID ].bSectorZ == ( INT8 )( iCurrentMapSectorZ ) ) + if( Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorX == sSelMapX && Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorY == sSelMapY && Menptr[ gCharactersList[ iCounter ].usSolID ].bSectorZ == ( INT8 )( iCurrentMapSectorZ ) ) { iValue = iCounter; } @@ -9996,7 +10840,7 @@ INT8 GetPrevValidCharacterInTeamPanelList( INT8 bCurrentIndex ) { if( gCharactersList[ bSelectedInfoChar ].fValid == TRUE ) { - if( Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorX == Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorX && Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorY == Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorY && Menptr[ gCharactersList[ iCounter ].usSolID ].bSectorZ ==Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].bSectorZ ) + if( Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorX == Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorX && Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorY == Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorY && Menptr[ gCharactersList[ iCounter ].usSolID ].bSectorZ ==Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].bSectorZ ) { iValue = iCounter; iCounter = 0; @@ -10030,7 +10874,7 @@ INT8 GetNextValidCharacterInTeamPanelList( INT8 bCurrentIndex ) { if( fShowMapInventoryPool ) { - if( Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorX == sSelMapX && Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorY == sSelMapY && Menptr[ gCharactersList[ iCounter ].usSolID ].bSectorZ == ( INT8 )( iCurrentMapSectorZ ) ) + if( Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorX == sSelMapX && Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorY == sSelMapY && Menptr[ gCharactersList[ iCounter ].usSolID ].bSectorZ == ( INT8 )( iCurrentMapSectorZ ) ) { iValue = iCounter; } @@ -10043,7 +10887,7 @@ INT8 GetNextValidCharacterInTeamPanelList( INT8 bCurrentIndex ) { if( gCharactersList[ bSelectedInfoChar ].fValid == TRUE ) { - if( Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorX == Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorX && Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorY == Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorY && Menptr[ gCharactersList[ iCounter ].usSolID ].bSectorZ ==Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].bSectorZ ) + if( Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorX == Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorX && Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorY == Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorY && Menptr[ gCharactersList[ iCounter ].usSolID ].bSectorZ ==Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].bSectorZ ) { iValue = iCounter; } @@ -10079,32 +10923,32 @@ void CreateDestroyTrashCanRegion( void ) fCreated = TRUE; - // trash can + // trash can MSYS_DefineRegion( &gTrashCanRegion, TRASH_CAN_X, TRASH_CAN_Y, TRASH_CAN_X + TRASH_CAN_WIDTH, TRASH_CAN_Y + TRASH_CAN_HEIGHT , MSYS_PRIORITY_HIGHEST - 4 , - MSYS_NO_CURSOR, TrashCanMoveCallback, TrashCanBtnCallback ); - + MSYS_NO_CURSOR, TrashCanMoveCallback, TrashCanBtnCallback ); + // done inventory button define giMapInvButtonDoneImage = LoadButtonImage( "INTERFACE\\done_button2.sti" ,-1,0,-1,1,-1 ); - giMapInvDoneButton = QuickCreateButton( giMapInvButtonDoneImage, INV_BTN_X, INV_BTN_Y, + giMapInvDoneButton = QuickCreateButton( giMapInvButtonDoneImage, INV_BTN_X, INV_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, ( GUI_CALLBACK )BtnGenericMouseMoveButtonCallback, ( GUI_CALLBACK)DoneInventoryMapBtnCallback ); - + SetButtonFastHelpText( giMapInvDoneButton ,pMiscMapScreenMouseRegionHelpText[ 2 ] ); SetRegionFastHelpText( &gTrashCanRegion, pMiscMapScreenMouseRegionHelpText[ 1 ] ); InitMapKeyRingInterface( KeyRingItemPanelButtonCallback ); /* - giMapInvNextImage= LoadButtonImage( "INTERFACE\\inventory_buttons.sti" ,-1,20,-1,22,-1 ); - giMapInvNext= QuickCreateButton( giMapInvNextImage, ( 2 ), ( 79 ) , + giMapInvNextImage= LoadButtonImage( "INTERFACE\\inventory_buttons.sti" ,-1,20,-1,22,-1 ); + giMapInvNext= QuickCreateButton( giMapInvNextImage, ( 2 ), ( 79 ) , BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, ( GUI_CALLBACK )BtnGenericMouseMoveButtonCallback, ( GUI_CALLBACK)NextInventoryMapBtnCallback ); - - - giMapInvPrevImage= LoadButtonImage( "INTERFACE\\inventory_buttons.sti" ,-1,21,-1,23,-1 ); - giMapInvPrev= QuickCreateButton( giMapInvPrevImage, ( 30 ) , ( 79 ), + + + giMapInvPrevImage= LoadButtonImage( "INTERFACE\\inventory_buttons.sti" ,-1,21,-1,23,-1 ); + giMapInvPrev= QuickCreateButton( giMapInvPrevImage, ( 30 ) , ( 79 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, ( GUI_CALLBACK )BtnGenericMouseMoveButtonCallback, ( GUI_CALLBACK)PrevInventoryMapBtnCallback ); - + */ // reset the compatable item array at this point @@ -10119,7 +10963,7 @@ void CreateDestroyTrashCanRegion( void ) // map inv done button RemoveButton( giMapInvDoneButton ); - + // get rid of button image UnloadButtonImage( giMapInvButtonDoneImage ); @@ -10145,7 +10989,7 @@ void DoneInventoryMapBtnCallback( GUI_BUTTON *btn, INT32 reason ) // prevent inventory from being closed while stack popup up! if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { @@ -10158,7 +11002,7 @@ void DoneInventoryMapBtnCallback( GUI_BUTTON *btn, INT32 reason ) fEndShowInventoryFlag = TRUE; } } - } + } } @@ -10314,7 +11158,7 @@ BOOLEAN HandlePreloadOfMapGraphics( void ) { // check amt of memory, if above required amt...use it VSURFACE_DESC vs_desc; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; fPreLoadedMapGraphics = TRUE; @@ -10402,7 +11246,22 @@ BOOLEAN HandlePreloadOfMapGraphics( void ) CHECKF(AddVideoObject(&VObjectDesc, &guiCROSS)); VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\mapinv.sti", VObjectDesc.ImageFile); + if (iResolution == 0) + { + FilenameForBPP("INTERFACE\\mapinv.sti", VObjectDesc.ImageFile); + } + else if (iResolution == 1) + { + FilenameForBPP("INTERFACE\\mapinv_800x600.sti", VObjectDesc.ImageFile); + } + else if (iResolution == 2) + { + FilenameForBPP("INTERFACE\\mapinv_1024x768.sti", VObjectDesc.ImageFile); + } + if(!AddVideoObject(&VObjectDesc, &guiMAPINV)) + { + FilenameForBPP("INTERFACE\\mapinv.sti", VObjectDesc.ImageFile); + } CHECKF(AddVideoObject(&VObjectDesc, &guiMAPINV)); VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; @@ -10469,7 +11328,7 @@ BOOLEAN HandlePreloadOfMapGraphics( void ) sprintf( VObjectDesc.ImageFile, "INTERFACE\\hilite.sti" ); AddVideoObject( &VObjectDesc, &guiSectorLocatorGraphicID ); - //Kris: Added this because I need to blink the icons button. + //Kris: Added this because I need to blink the icons button. VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; sprintf( VObjectDesc.ImageFile, "INTERFACE\\newemail.sti" ); AddVideoObject( &VObjectDesc, &guiNewMailIcons ); @@ -10500,7 +11359,7 @@ void HandleRemovalOfPreLoadedMapGraphics( void ) DeleteMapBottomGraphics( ); DeleteVideoObjectFromIndex( guiMAPCURSORS ); DeleteVideoObjectFromIndex( guiSleepIcon ); - + //DeleteVideoObjectFromIndex(guiMAPBORDER); DeleteVideoObjectFromIndex(guiCHARLIST); //DeleteVideoObjectFromIndex(guiCORNERADDONS); @@ -10532,13 +11391,13 @@ void HandleRemovalOfPreLoadedMapGraphics( void ) DeleteVideoObjectFromIndex( guiMINEICON ); DeleteVideoObjectFromIndex( guiSectorLocatorGraphicID ); - //Kris: Remove the email icons. + //Kris: Remove the email icons. DeleteVideoObjectFromIndex( guiNewMailIcons ); DeleteVideoObjectFromIndex( guiBULLSEYE ); - // remove the graphic for the militia pop up box + // remove the graphic for the militia pop up box RemoveMilitiaPopUpBox( ); // remove inventory pool graphic @@ -10628,9 +11487,9 @@ void UpdateTheStateOfTheNextPrevMapScreenCharacterButtons( void ) { // standard checks if ( ( GetNumberOfPeopleInCharacterList( ) < 2 ) || - ( CharacterIsInLoadedSectorAndWantsToMoveInventoryButIsNotAllowed( bSelectedInfoChar ) ) || - ( CharacterIsInTransitAndHasItemPickedUp( bSelectedInfoChar ) ) || - ( fShowDescriptionFlag ) ) + ( CharacterIsInLoadedSectorAndWantsToMoveInventoryButIsNotAllowed( bSelectedInfoChar ) ) || + ( CharacterIsInTransitAndHasItemPickedUp( bSelectedInfoChar ) ) || + ( fShowDescriptionFlag ) ) { DisableButton( giCharInfoButton[ 0 ] ); DisableButton( giCharInfoButton[ 1 ] ); @@ -10648,17 +11507,17 @@ void PrevInventoryMapBtnCallback( GUI_BUTTON *btn, INT32 reason ) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { btn->uiFlags&= ~(BUTTON_CLICKED_ON); - + fResetMapCoords = TRUE; GoToPrevCharacterInList( ); } - } + } } @@ -10666,17 +11525,17 @@ void NextInventoryMapBtnCallback( GUI_BUTTON *btn, INT32 reason ) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&= ~(BUTTON_CLICKED_ON); - + btn->uiFlags&= ~(BUTTON_CLICKED_ON); + fResetMapCoords = TRUE; GoToNextCharacterInList( ); } - } + } } // WANNE: @@ -10751,31 +11610,31 @@ void NextInventoryMapBtnCallback( GUI_BUTTON *btn, INT32 reason ) // } // // // merc - scroll up -// guiMapMercsScrollButtonsImage[ MAP_SCROLL_MERCS_UP ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,11,4,-1,6,-1 ); +// guiMapMercsScrollButtonsImage[ MAP_SCROLL_MERCS_UP ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,11,4,-1,6,-1 ); // guiMapMercsScrollButtons[ MAP_SCROLL_MERCS_UP ] = QuickCreateButton( guiMapMercsScrollButtonsImage[ MAP_SCROLL_MERCS_UP ], iXPos, iMercUpY, // BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, // (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnMercsUpMapScreenCallback); // // // merc - scroll down -// guiMapMercsScrollButtonsImage[ MAP_SCROLL_MERCS_DOWN ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,12,5,-1,7,-1 ); +// guiMapMercsScrollButtonsImage[ MAP_SCROLL_MERCS_DOWN ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,12,5,-1,7,-1 ); // guiMapMercsScrollButtons[ MAP_SCROLL_MERCS_DOWN ] = QuickCreateButton( guiMapMercsScrollButtonsImage[ MAP_SCROLL_MERCS_DOWN ], iXPos, iMercUpY + 17, // BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, // (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnMercsDownMapScreenCallback); // // // vehicle - scroll up -// guiMapVehicleScrollButtonsImage[ MAP_SCROLL_VEHICLE_UP ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,11,4,-1,6,-1 ); +// guiMapVehicleScrollButtonsImage[ MAP_SCROLL_VEHICLE_UP ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,11,4,-1,6,-1 ); // guiMapVehicleScrollButtons[ MAP_SCROLL_VEHICLE_UP ] = QuickCreateButton( guiMapVehicleScrollButtonsImage[ MAP_SCROLL_VEHICLE_UP ], iXPos, iVehicleUpY, // BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, // (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnVehicleUpMapScreenCallback); // // // vehicle - scroll down -// guiMapVehicleScrollButtonsImage[ MAP_SCROLL_VEHICLE_DOWN ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,12,5,-1,7,-1 ); +// guiMapVehicleScrollButtonsImage[ MAP_SCROLL_VEHICLE_DOWN ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,12,5,-1,7,-1 ); // guiMapVehicleScrollButtons[ MAP_SCROLL_VEHICLE_DOWN ] = QuickCreateButton( guiMapVehicleScrollButtonsImage[ MAP_SCROLL_VEHICLE_DOWN ], iXPos, iVehicleUpY + 17, // BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, // (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnVehicleDownMapScreenCallback); // // fScrollButtonsInitialized = TRUE; -// } +// } //} @@ -10786,7 +11645,7 @@ void CreateDestroyMapCharacterScrollButtons( void ) if( ( fInMapMode == TRUE ) && ( fCreated == FALSE ) ) { // set the button image - giCharInfoButtonImage[ 0 ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,11,4,-1,6,-1 ); + giCharInfoButtonImage[ 0 ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,11,4,-1,6,-1 ); // set the button value giCharInfoButton[ 0 ] = QuickCreateButton( giCharInfoButtonImage[ 0 ], 67, 69, @@ -10794,14 +11653,14 @@ void CreateDestroyMapCharacterScrollButtons( void ) BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)PrevInventoryMapBtnCallback ); // set the button image - giCharInfoButtonImage[ 1 ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,12,5,-1,7,-1 ); + giCharInfoButtonImage[ 1 ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,12,5,-1,7,-1 ); // set the button value giCharInfoButton[ 1 ] = QuickCreateButton( giCharInfoButtonImage[ 1 ], 67, 87, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 5, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)NextInventoryMapBtnCallback ); - + SetButtonFastHelpText( giCharInfoButton[ 0 ], pMapScreenPrevNextCharButtonHelpText[ 0 ] ); SetButtonFastHelpText( giCharInfoButton[ 1 ], pMapScreenPrevNextCharButtonHelpText[ 1 ] ); @@ -10842,7 +11701,7 @@ void TellPlayerWhyHeCantCompressTime( void ) DoMapMessageBox( MSG_BOX_BASIC_STYLE, pMapErrorString[ 39 ], MAP_SCREEN, MSG_BOX_FLAG_OK, MapScreenDefaultOkBoxCallback ); } else if ( ActiveTimedBombExists() ) - { + { // can't time compress when a bomb is about to go off! DoMapMessageBox( MSG_BOX_BASIC_STYLE, gzLateLocalizedString[ 2 ], MAP_SCREEN, MSG_BOX_FLAG_OK, MapScreenDefaultOkBoxCallback ); } @@ -10875,7 +11734,7 @@ void TellPlayerWhyHeCantCompressTime( void ) DoMapMessageBox( MSG_BOX_BASIC_STYLE, gzLateLocalizedString[ 55 ], MAP_SCREEN, MSG_BOX_FLAG_OK, MapScreenDefaultOkBoxCallback ); } // ARM: THIS TEST SHOULD BE THE LAST ONE, BECAUSE IT ACTUALLY RESULTS IN SOMETHING HAPPENING NOW. - // KM: Except if we are in a creature lair and haven't loaded the sector yet (no battle yet) + // KM: Except if we are in a creature lair and haven't loaded the sector yet (no battle yet) else if( gTacticalStatus.uiFlags & INCOMBAT || gTacticalStatus.fEnemyInSector ) { if( OnlyHostileCivsInSector() ) @@ -10903,7 +11762,7 @@ void TellPlayerWhyHeCantCompressTime( void ) void MapScreenDefaultOkBoxCallback( UINT8 bExitValue ) { // yes, load the game - if( bExitValue == MSG_BOX_RETURN_OK ) + if( bExitValue == MSG_BOX_RETURN_OK ) { fMapPanelDirty = TRUE; fTeamPanelDirty = TRUE; @@ -10931,17 +11790,17 @@ void MapSortBtnCallback( GUI_BUTTON *btn, INT32 reason ) return; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags &= ~(BUTTON_CLICKED_ON); + btn->uiFlags &= ~(BUTTON_CLICKED_ON); ChangeCharacterListSortMethod( iValue ); } - } + } } @@ -10973,12 +11832,12 @@ void AddTeamPanelSortButtonsForMapScreen( void ) -void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs ) +void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse ) { INT32 iCounter = 0, iCounterA = 0; INT16 sEndSectorA, sEndSectorB; INT32 iExpiryTime, iExpiryTimeA; - BOOLEAN fEntrySelected = FALSE; + UINT8 uiID, uiIDA; SOLDIERTYPE *pSelectedSoldier[ MAX_CHARACTER_COUNT ]; SOLDIERTYPE *pCurrentSoldier = NULL; SOLDIERTYPE *pPreviousSelectedInfoChar = NULL; @@ -11018,7 +11877,7 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs ) if( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE ) { // yes, store pointer to them - pSelectedSoldier[ iCounter ] = pCurrentSoldier; + pSelectedSoldier[ iCounter ] = pCurrentSoldier; } } } @@ -11044,8 +11903,11 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs ) break; } - if( ( wcscmp( Menptr[ gCharactersList[ iCounterA ].usSolID ].name, Menptr[ gCharactersList[ iCounter ].usSolID ].name ) > 0 ) && ( iCounterA < iCounter ) ) + //if( ( wcscmp( Menptr[ gCharactersList[ iCounterA ].usSolID ].name, Menptr[ gCharactersList[ iCounter ].usSolID ].name ) > 0 ) && ( iCounterA < iCounter ) ) + if( iCounterA < iCounter ) { + if((fReverse && ( wcscmp( Menptr[ gCharactersList[ iCounterA ].usSolID ].name, Menptr[ gCharactersList[ iCounter ].usSolID ].name ) < 0 )) || + (!fReverse && ( wcscmp( Menptr[ gCharactersList[ iCounterA ].usSolID ].name, Menptr[ gCharactersList[ iCounter ].usSolID ].name ) > 0 ))) SwapCharactersInList( iCounter, iCounterA ); } } @@ -11060,7 +11922,11 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs ) break; } - if( ( Menptr[ gCharactersList[ iCounterA ].usSolID ].bAssignment > Menptr[ gCharactersList[ iCounter ].usSolID ].bAssignment ) && ( iCounterA < iCounter ) ) + if( !fReverse && ( Menptr[ gCharactersList[ iCounterA ].usSolID ].bAssignment > Menptr[ gCharactersList[ iCounter ].usSolID ].bAssignment ) && ( iCounterA < iCounter ) ) + { + SwapCharactersInList( iCounter, iCounterA ); + } + else if( fReverse && ( Menptr[ gCharactersList[ iCounterA ].usSolID ].bAssignment < Menptr[ gCharactersList[ iCounter ].usSolID ].bAssignment ) && ( iCounterA < iCounter ) ) { SwapCharactersInList( iCounter, iCounterA ); } @@ -11090,7 +11956,11 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs ) break; } - if( ( Menptr[ gCharactersList[ iCounterA ].usSolID ].fMercAsleep == TRUE ) && ( Menptr[ gCharactersList[ iCounter ].usSolID ].fMercAsleep == FALSE ) && ( iCounterA < iCounter ) ) + if( !fReverse && ( Menptr[ gCharactersList[ iCounterA ].usSolID ].flags.fMercAsleep == TRUE ) && ( Menptr[ gCharactersList[ iCounter ].usSolID ].flags.fMercAsleep == FALSE ) && ( iCounterA < iCounter ) ) + { + SwapCharactersInList( iCounter, iCounterA ); + } + else if( fReverse && ( Menptr[ gCharactersList[ iCounterA ].usSolID ].flags.fMercAsleep == FALSE ) && ( Menptr[ gCharactersList[ iCounter ].usSolID ].flags.fMercAsleep == TRUE ) && ( iCounterA < iCounter ) ) { SwapCharactersInList( iCounter, iCounterA ); } @@ -11111,7 +11981,11 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs ) sEndSectorB = CalcLocationValueForChar( iCounterA ); - if( ( sEndSectorB > sEndSectorA ) && ( iCounterA < iCounter ) ) + if( !fReverse && ( sEndSectorB > sEndSectorA ) && ( iCounterA < iCounter ) ) + { + SwapCharactersInList( iCounter, iCounterA ); + } + else if( fReverse && ( sEndSectorB < sEndSectorA ) && ( iCounterA < iCounter ) ) { SwapCharactersInList( iCounter, iCounterA ); } @@ -11145,7 +12019,11 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs ) sEndSectorB = GetLastSectorIdInCharactersPath( &Menptr[ gCharactersList[ iCounterA ].usSolID ] ); } - if( ( sEndSectorB > sEndSectorA ) && ( iCounterA < iCounter ) ) + if( !fReverse && ( sEndSectorB > sEndSectorA ) && ( iCounterA < iCounter ) ) + { + SwapCharactersInList( iCounter, iCounterA ); + } + else if( fReverse && ( sEndSectorB < sEndSectorA ) && ( iCounterA < iCounter ) ) { SwapCharactersInList( iCounter, iCounterA ); } @@ -11165,7 +12043,32 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs ) iExpiryTimeA = GetContractExpiryTime( &( Menptr[ gCharactersList[ iCounterA ].usSolID ] ) ); - if( ( iExpiryTimeA > iExpiryTime ) && ( iCounterA < iCounter ) ) + if( !fReverse && ( iExpiryTimeA > iExpiryTime ) && ( iCounterA < iCounter ) ) + { + SwapCharactersInList( iCounter, iCounterA ); + } + else if( fReverse && ( iExpiryTimeA < iExpiryTime ) && ( iCounterA < iCounter ) ) + { + SwapCharactersInList( iCounter, iCounterA ); + } + } + break; + + case( 6 ): + uiID = Menptr[ gCharactersList[ iCounter ].usSolID ].ubID; + //by ubID + for( iCounterA = 0; iCounterA < FIRST_VEHICLE; iCounterA++ ) + { + if( gCharactersList[ iCounterA ].fValid == FALSE) + { + break; + } + uiIDA = Menptr[ gCharactersList[ iCounterA ].usSolID ].ubID; + if( !fReverse && ( uiIDA > uiID ) && ( iCounterA < iCounter ) ) + { + SwapCharactersInList( iCounter, iCounterA ); + } + else if( fReverse && ( uiIDA < uiID ) && ( iCounterA < iCounter ) ) { SwapCharactersInList( iCounter, iCounterA ); } @@ -11177,7 +12080,7 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs ) return; } } - + if ( fRetainSelectedMercs ) { @@ -11229,7 +12132,7 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs ) } - // reset blinking animations + // reset blinking animations SetAllAutoFacesInactive( ); // dirty the screen parts affected @@ -11245,7 +12148,7 @@ void SwapCharactersInList( INT32 iCharA, INT32 iCharB ) // swap usTempSoldID = gCharactersList[ iCharA ].usSolID; - gCharactersList[ iCharA ].usSolID = gCharactersList[ iCharB ].usSolID; + gCharactersList[ iCharA ].usSolID = gCharactersList[ iCharB ].usSolID; gCharactersList[ iCharB ].usSolID = usTempSoldID; } @@ -11318,11 +12221,11 @@ void HandleAssignmentsDoneAndAwaitingFurtherOrders( void ) { break; } - + pSoldier = &( Menptr[ gCharactersList[ iCounter ].usSolID ] ); // toggle and redraw if flash was left ON even though the flag is OFF - if( pSoldier->fDoneAssignmentAndNothingToDoFlag || fFlashAssignDone ) + if( pSoldier->flags.fDoneAssignmentAndNothingToDoFlag || fFlashAssignDone ) { fFlashAssignDone = !fFlashAssignDone; fDrawCharacterList = TRUE; @@ -11355,7 +12258,7 @@ void DisplayIconsForMercsAsleep( void ) if( gCharactersList[ iCounter ].fValid == TRUE ) { pSoldier = MercPtrs[ gCharactersList[ iCounter ].usSolID ]; - if( pSoldier->bActive && pSoldier->fMercAsleep && CanChangeSleepStatusForSoldier( pSoldier ) ) + if( pSoldier->bActive && pSoldier->flags.fMercAsleep && CanChangeSleepStatusForSoldier( pSoldier ) ) { //BltVideoObject( guiSAVEBUFFER , hHandle, 0, 125, ( INT16 )( Y_START+(iCounter * ( Y_SIZE + 2 ) ) ) , VO_BLT_SRCTRANSPARENCY,NULL ); BltVideoObject( guiSAVEBUFFER , hHandle, 0, SLEEP_X + 2, ( INT16 )( Y_START+(iCounter * ( Y_SIZE + 2 ) ) ) , VO_BLT_SRCTRANSPARENCY,NULL ); @@ -11366,8 +12269,8 @@ void DisplayIconsForMercsAsleep( void ) } -//Kris: Added this function to blink the email icon on top of the laptop button whenever we are in -// mapscreen and we have new email to read. +//Kris: Added this function to blink the email icon on top of the laptop button whenever we are in +// mapscreen and we have new email to read. void CheckForAndRenderNewMailOverlay() { if( fNewMailFlag ) @@ -11388,10 +12291,10 @@ void CheckForAndRenderNewMailOverlay() if( !(ButtonList[ guiMapBottomExitButtons[ MAP_EXIT_TO_LAPTOP ] ]->uiFlags & BUTTON_ENABLED ) ) { UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; + UINT8 *pDestBuf; SGPRect area = { (SCREEN_WIDTH - 177), (SCREEN_HEIGHT - 63), (SCREEN_WIDTH - 163), (SCREEN_HEIGHT - 55) }; - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); Blt16BPPBufferHatchRect( (UINT16*)pDestBuf, uiDestPitchBYTES, &area ); UnLockVideoSurface( FRAME_BUFFER ); } @@ -11440,15 +12343,15 @@ BOOLEAN CanToggleSelectedCharInventory( void ) pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]; // if not in inventory, and holding an item from sector inventory - if( !fShowInventoryFlag && + if( !fShowInventoryFlag && ( ( gMPanelRegion.Cursor == EXTERN_CURSOR ) || gpItemPointer || fMapInventoryItem ) && ( gpItemPointerSoldier == NULL ) ) { // make sure he's in that sector if ( ( pSoldier->sSectorX != sSelMapX ) || - ( pSoldier->sSectorY != sSelMapY ) || - ( pSoldier->bSectorZ != iCurrentMapSectorZ ) || - pSoldier->fBetweenSectors ) + ( pSoldier->sSectorY != sSelMapY ) || + ( pSoldier->bSectorZ != iCurrentMapSectorZ ) || + pSoldier->flags.fBetweenSectors ) { return(FALSE); } @@ -11480,12 +12383,12 @@ BOOLEAN MapCharacterHasAccessibleInventory( INT8 bCharNumber ) if( ( pSoldier->bAssignment == IN_TRANSIT ) || ( pSoldier->bAssignment == ASSIGNMENT_POW ) || // Kaiden: Vehicle Inventory change - Commented the following line - // ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) || + // ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) || // And added this instead: - ( (!gGameExternalOptions.fVehicleInventory) && (pSoldier->uiStatusFlags & SOLDIER_VEHICLE) ) || + ( (!gGameExternalOptions.fVehicleInventory) && (pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) ) || ( AM_A_ROBOT( pSoldier ) ) || ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC ) || - ( pSoldier->bLife < OKLIFE ) + ( pSoldier->stats.bLife < OKLIFE ) ) { return(FALSE); @@ -11508,7 +12411,7 @@ void CheckForInventoryModeCancellation() if ( !CanToggleSelectedCharInventory( ) ) { - // get out of inventory mode if it's on! (could have just bled below OKLIFE) + // get out of inventory mode if it's on! (could have just bled below OKLIFE) if ( fShowInventoryFlag ) { fShowInventoryFlag = FALSE; @@ -11621,7 +12524,7 @@ BOOLEAN CanExtendContractForCharSlot( INT8 bCharNumber ) Assert( pSoldier->bActive ); // if a vehicle, in transit, or a POW - if( /*( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ||*/ + if( /*( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ||*/ ( pSoldier->bAssignment == IN_TRANSIT ) || ( pSoldier->bAssignment == ASSIGNMENT_POW ) ) { @@ -11630,7 +12533,7 @@ BOOLEAN CanExtendContractForCharSlot( INT8 bCharNumber ) } // if a vehicle has passengers - if ( (pSoldier->uiStatusFlags & SOLDIER_VEHICLE) && + if ( (pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && (DoesVehicleHaveAnyPassengers(pSoldier->bVehicleID) ) ) { // then restrict contract menu @@ -11668,7 +12571,7 @@ BOOLEAN CanChangeSleepStatusForSoldier( SOLDIERTYPE *pSoldier ) Assert( pSoldier->bActive ); // if a vehicle, robot, in transit, or a POW - if( ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) || AM_A_ROBOT( pSoldier ) || + if( ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) || AM_A_ROBOT( pSoldier ) || ( pSoldier->bAssignment == IN_TRANSIT ) || ( pSoldier->bAssignment == ASSIGNMENT_POW ) ) { // can't change the sleep status of such mercs @@ -11676,7 +12579,7 @@ BOOLEAN CanChangeSleepStatusForSoldier( SOLDIERTYPE *pSoldier ) } // if dead - if( ( pSoldier->bLife <= 0 ) || ( pSoldier->bAssignment == ASSIGNMENT_DEAD ) ) + if( ( pSoldier->stats.bLife <= 0 ) || ( pSoldier->bAssignment == ASSIGNMENT_DEAD ) ) { return ( FALSE ); } @@ -11698,11 +12601,11 @@ void ChangeMapScreenMaskCursor( UINT16 usCursor ) if ( usCursor == CURSOR_NORMAL ) { - if ( !InItemStackPopup( ) ) - { - // cancel mouse restriction - FreeMouseCursor(); - } + if ( !InItemStackPopup( ) ) + { + // cancel mouse restriction + FreeMouseCursor(); + } } else { @@ -11729,7 +12632,7 @@ void CancelOrShortenPlottedPath( void ) sMapX=sMapX/2; sMapY=(UINT16)iZoomY/MAP_GRID_Y+sMapY; sMapY=sMapY/2; - } + } */ // check if we are in aircraft mode @@ -11860,7 +12763,7 @@ void ChangeSelectedInfoChar( INT8 bCharNumber, BOOLEAN fResetSelectedList ) if ( fResetSelectedList ) { - // reset selections of all listed characters. Do this even if this guy is already selected. + // reset selections of all listed characters. Do this even if this guy is already selected. // NOTE: this keeps the currently selected info char selected ResetSelectedListForMapScreen( ); } @@ -11926,7 +12829,7 @@ void CopyPathToAllSelectedCharacters( PathStPtr pPath ) // skip itself! if ( GetSoldierMercPathPtr( pSoldier ) != pPath ) { - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { pVehicleList[ pSoldier->bVehicleID ].pMercPath = CopyPaths( pPath, pVehicleList[ pSoldier->bVehicleID ].pMercPath ); } @@ -11981,7 +12884,7 @@ void CancelPathsOfAllSelectedCharacters() // cancel the entire path (also clears vehicles for any passengers selected, and handles reversing directions) - if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { CancelPathForVehicle( &( pVehicleList[ pSoldier->bVehicleID ] ), FALSE ); } @@ -12000,9 +12903,9 @@ void ConvertMinTimeToETADayHourMinString( UINT32 uiTimeInMin, STR16 sString ) { UINT32 uiDay, uiHour, uiMin; - uiDay = ( uiTimeInMin / NUM_MIN_IN_DAY ); + uiDay = ( uiTimeInMin / NUM_MIN_IN_DAY ); uiHour = ( uiTimeInMin - ( uiDay * NUM_MIN_IN_DAY ) ) / NUM_MIN_IN_HOUR; - uiMin = uiTimeInMin - ( ( uiDay * NUM_MIN_IN_DAY ) + ( uiHour * NUM_MIN_IN_HOUR ) ); + uiMin = uiTimeInMin - ( ( uiDay * NUM_MIN_IN_DAY ) + ( uiHour * NUM_MIN_IN_HOUR ) ); // there ain't enough room to show both the day and ETA: and without ETA it's confused as the current time // swprintf( sString, L"%s %s %d, %02d:%02d", pEtaString[ 0 ], pDayStrings[ 0 ], uiDay, uiHour, uiMin ); @@ -12059,7 +12962,7 @@ INT16 CalcLocationValueForChar( INT32 iCounter ) void CancelChangeArrivalSectorMode( ) -{ +{ // "put him in change arrival sector" mode gfInChangeArrivalSectorMode = FALSE; @@ -12137,9 +13040,9 @@ BOOLEAN AnyMovableCharsInOrBetweenThisSector( INT16 sSectorX, INT16 sSectorY, IN // POWs, dead guys, guys in transit can't move if ( ( pSoldier->bAssignment == IN_TRANSIT ) || - ( pSoldier->bAssignment == ASSIGNMENT_POW ) || - ( pSoldier->bAssignment == ASSIGNMENT_DEAD ) || - ( pSoldier->bLife == 0 ) ) + ( pSoldier->bAssignment == ASSIGNMENT_POW ) || + ( pSoldier->bAssignment == ASSIGNMENT_DEAD ) || + ( pSoldier->stats.bLife == 0 ) ) { continue; } @@ -12151,7 +13054,7 @@ BOOLEAN AnyMovableCharsInOrBetweenThisSector( INT16 sSectorX, INT16 sSectorY, IN } // don't count vehicles - in order for them to move, somebody must be in the sector with them - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { continue; } @@ -12179,8 +13082,8 @@ BOOLEAN RequestGiveSkyriderNewDestination( void ) { // if not warned already, and chopper empty, but mercs are in this sector if ( !gfSkyriderEmptyHelpGiven && - ( GetNumberOfPassengersInHelicopter() == 0 ) && - ( PlayerMercsInHelicopterSector() > 0 ) ) + ( GetNumberOfPassengersInHelicopter() == 0 ) && + ( PlayerMercsInHelicopterSector() > 0 ) ) { DoMapMessageBox( MSG_BOX_BASIC_STYLE, pSkyriderText[ 6 ], MAP_SCREEN, MSG_BOX_FLAG_OK, MapScreenDefaultOkBoxCallback ); gfSkyriderEmptyHelpGiven = TRUE; @@ -12279,16 +13182,16 @@ void HandleNewDestConfirmation( INT16 sMapX, INT16 sMapY ) { // if there are no enemies in destination sector, or we don't know if ( ( NumEnemiesInSector( sMapX, sMapY ) == 0 ) || - ( WhatPlayerKnowsAboutEnemiesInSector( sMapX, sMapY ) == KNOWS_NOTHING ) ) + ( WhatPlayerKnowsAboutEnemiesInSector( sMapX, sMapY ) == KNOWS_NOTHING ) ) { // no problem - + // get current player progress ubCurrentProgress = CurrentPlayerProgressPercentage(); // if we're doing a lot better than last time he said anything if ( ( ubCurrentProgress > gubPlayerProgressSkyriderLastCommentedOn ) && - ( ( ubCurrentProgress - gubPlayerProgressSkyriderLastCommentedOn ) >= MIN_PROGRESS_FOR_SKYRIDER_QUOTE_DOING_WELL ) ) + ( ( ubCurrentProgress - gubPlayerProgressSkyriderLastCommentedOn ) >= MIN_PROGRESS_FOR_SKYRIDER_QUOTE_DOING_WELL ) ) { // kicking ass! SkyRiderTalk( THINGS_ARE_GOING_WELL ); @@ -12297,7 +13200,7 @@ void HandleNewDestConfirmation( INT16 sMapX, INT16 sMapY ) } // if we're doing noticably worse than last time he said anything else if ( ( ubCurrentProgress < gubPlayerProgressSkyriderLastCommentedOn ) && - ( ( gubPlayerProgressSkyriderLastCommentedOn - ubCurrentProgress ) >= MIN_REGRESS_FOR_SKYRIDER_QUOTE_DOING_BADLY ) ) + ( ( gubPlayerProgressSkyriderLastCommentedOn - ubCurrentProgress ) >= MIN_REGRESS_FOR_SKYRIDER_QUOTE_DOING_BADLY ) ) { // sucking rocks! SkyRiderTalk( THINGS_ARE_GOING_BADLY ); @@ -12347,8 +13250,8 @@ void RandomAwakeSelectedMercConfirmsStrategicMove( void ) { pSoldier = MercPtrs[ gCharactersList[ iCounter ].usSolID ]; - if ( pSoldier->bLife >= OKLIFE && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && - !AM_A_ROBOT( pSoldier ) && !AM_AN_EPC( pSoldier ) && !pSoldier->fMercAsleep ) + if ( pSoldier->stats.bLife >= OKLIFE && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && + !AM_A_ROBOT( pSoldier ) && !AM_AN_EPC( pSoldier ) && !pSoldier->flags.fMercAsleep ) { ubSelectedMercID[ ubNumMercs ] = pSoldier->ubID; ubSelectedMercIndex[ ubNumMercs ] = (UINT8)iCounter; @@ -12365,7 +13268,7 @@ void RandomAwakeSelectedMercConfirmsStrategicMove( void ) // select that merc so that when he speaks we're showing his portrait and not someone else ChangeSelectedInfoChar( ubSelectedMercIndex[ ubChosenMerc ], FALSE ); - DoMercBattleSound( MercPtrs[ ubSelectedMercID[ ubChosenMerc ] ], ( UINT8 ) ( Random(2) ? BATTLE_SOUND_OK1 : BATTLE_SOUND_OK2 ) ); + MercPtrs[ ubSelectedMercID[ ubChosenMerc ] ]->DoMercBattleSound( ( UINT8 ) ( Random(2) ? BATTLE_SOUND_OK1 : BATTLE_SOUND_OK2 ) ); //TacticalCharacterDialogue( MercPtrs[ ubSelectedMercID[ ubChosenMerc ] ], ubQuoteNum ); } } @@ -12553,11 +13456,11 @@ void WakeUpAnySleepingSelectedMercsOnFootOrDriving( void ) pSoldier = MercPtrs[ gCharactersList[ iCounter ].usSolID ]; // if asleep - if ( pSoldier->fMercAsleep ) + if ( pSoldier->flags.fMercAsleep ) { // and on foot or driving if ( ( pSoldier->bAssignment < ON_DUTY ) || - ( ( pSoldier->bAssignment == VEHICLE ) && SoldierMustDriveVehicle( pSoldier, pSoldier->iVehicleId, FALSE ) ) ) + ( ( pSoldier->bAssignment == VEHICLE ) && SoldierMustDriveVehicle( pSoldier, pSoldier->iVehicleId, FALSE ) ) ) { // we should be guaranteed that he CAN wake up to get this far, so report errors, but don't force it fSuccess = SetMercAwake( pSoldier, TRUE, FALSE ); @@ -12570,18 +13473,18 @@ void WakeUpAnySleepingSelectedMercsOnFootOrDriving( void ) void HandlePostAutoresolveMessages() { - //KM: Autoresolve sets up this global sector value whenever the enemy gains control of a sector. As soon as + //KM: Autoresolve sets up this global sector value whenever the enemy gains control of a sector. As soon as //we leave autoresolve and enter mapscreen, then this gets called and handles ownership change for the sector. //It also brings up a dialog stating to the player what happened, however, the internals of those functions - //breaks autoresolve and the game crashes after autoresolve is finished. The value doesn't need to be saved. + //breaks autoresolve and the game crashes after autoresolve is finished. The value doesn't need to be saved. // - //An additional case is when creatures kill all opposition in the sector. For each surviving monster, civilians + //An additional case is when creatures kill all opposition in the sector. For each surviving monster, civilians //are "virtually" murdered and loyalty hits will be processed. if( gsCiviliansEatenByMonsters >= 1 ) { - AdjustLoyaltyForCivsEatenByMonsters( (UINT8)SECTORX( gsEnemyGainedControlOfSectorID ), - (UINT8)SECTORY( gsEnemyGainedControlOfSectorID ), - (UINT8)gsCiviliansEatenByMonsters ); + AdjustLoyaltyForCivsEatenByMonsters( (UINT8)SECTORX( gsEnemyGainedControlOfSectorID ), + (UINT8)SECTORY( gsEnemyGainedControlOfSectorID ), + (UINT8)gsCiviliansEatenByMonsters ); gsCiviliansEatenByMonsters = -2; } else if( gsCiviliansEatenByMonsters == -2 ) @@ -12596,7 +13499,7 @@ void HandlePostAutoresolveMessages() gsEnemyGainedControlOfSectorID = -2; } else if( gsEnemyGainedControlOfSectorID == -2 ) - { //dirty the mapscreen after the dialog box goes away. + { //dirty the mapscreen after the dialog box goes away. fMapPanelDirty = TRUE; gsEnemyGainedControlOfSectorID = -1; } @@ -12644,9 +13547,9 @@ void GetMapscreenMercLocationString( SOLDIERTYPE *pSoldier, CHAR16 sString[] ) swprintf( pTempString, L"%s%s%s", pMapVertIndex[ pSoldier->sSectorY ], pMapHortIndex[ pSoldier->sSectorX ], pMapDepthIndex[ pSoldier->bSectorZ ] ); - if ( pSoldier->fBetweenSectors ) + if ( pSoldier->flags.fBetweenSectors ) { - // put brackets around it when he's between sectors! + // put brackets around it when he's between sectors! swprintf( sString, L"(%s)", pTempString ); } else @@ -12671,7 +13574,7 @@ void GetMapscreenMercDestinationString( SOLDIERTYPE *pSoldier, CHAR16 sString[] // if dead or POW - has no destination (no longer part of a group, for that matter) if( ( pSoldier->bAssignment == ASSIGNMENT_DEAD ) || ( pSoldier->bAssignment == ASSIGNMENT_POW ) || - ( pSoldier->bLife == 0 ) ) + ( pSoldier->stats.bLife == 0 ) ) { return; } @@ -12694,7 +13597,7 @@ void GetMapscreenMercDestinationString( SOLDIERTYPE *pSoldier, CHAR16 sString[] } else // no movement path is set... { - if ( pSoldier->fBetweenSectors ) + if ( pSoldier->flags.fBetweenSectors ) { // he must be returning to his previous (reversed so as to be the next) sector, so show that as his destination // individual soldiers don't store previous/next sector coordinates, must go to his group for that @@ -12723,7 +13626,7 @@ void GetMapscreenMercDepartureString( SOLDIERTYPE *pSoldier, CHAR16 sString[], U INT32 iHoursRemaining = 0; - if( ( pSoldier->ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC && pSoldier->ubProfile != SLAY ) || pSoldier->bLife == 0 ) + if( ( pSoldier->ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC && pSoldier->ubProfile != SLAY ) || pSoldier->stats.bLife == 0 ) { swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); } @@ -12748,7 +13651,7 @@ void GetMapscreenMercDepartureString( SOLDIERTYPE *pSoldier, CHAR16 sString[], U *pubFontColor = FONT_LTGREEN; - swprintf(sString, L"%d%s", iDaysRemaining, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ] ); + swprintf(sString, L"%d%s", iDaysRemaining, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ] ); } else // less than 3 days { @@ -12761,17 +13664,17 @@ void GetMapscreenMercDepartureString( SOLDIERTYPE *pSoldier, CHAR16 sString[], U iHoursRemaining = 0; } - // last 3 days is Red, last 4 hours start flashing red/white! - if( ( iMinsRemaining <= MINS_TO_FLASH_CONTRACT_TIME ) && ( fFlashContractFlag == TRUE ) ) - { - *pubFontColor = FONT_WHITE; - } - else - { - *pubFontColor = FONT_RED; - } + // last 3 days is Red, last 4 hours start flashing red/white! + if( ( iMinsRemaining <= MINS_TO_FLASH_CONTRACT_TIME ) && ( fFlashContractFlag == TRUE ) ) + { + *pubFontColor = FONT_WHITE; + } + else + { + *pubFontColor = FONT_RED; + } - swprintf(sString, L"%d%s", iHoursRemaining, gpStrategicString[ STR_PB_HOURS_ABBREVIATION ] ); + swprintf(sString, L"%d%s", iHoursRemaining, gpStrategicString[ STR_PB_HOURS_ABBREVIATION ] ); } } } @@ -12872,7 +13775,7 @@ void RestorePreviousPaths( void ) { pSoldier = MercPtrs[ gCharactersList[ iCounter ].usSolID ]; - if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { ppMovePath = &( pVehicleList[ pSoldier->bVehicleID ].pMercPath ); ubGroupId = pVehicleList[ pSoldier->bVehicleID ].ubMovementGroup; @@ -13052,7 +13955,7 @@ void RequestToggleMercInventoryPanel( void ) if ( !CanToggleSelectedCharInventory() ) - { + { return; } @@ -13073,6 +13976,8 @@ void RequestToggleMercInventoryPanel( void ) } else { + // Headrock. New line forces InvBottom rerender when the inventory is opened and closed. + RenderMapScreenInterfaceBottom ( TRUE ); SetRegionFastHelpText( &gCharInfoHandRegion, pMiscMapScreenMouseRegionHelpText[ 0 ] ); } } @@ -13159,9 +14064,15 @@ void ChangeCharacterListSortMethod( INT32 iValue ) AbortMovementPlottingMode( ); } + if(iValue == 0 && _KeyDown( ALT ) ) + iValue = 6; + if(iValue == giSortStateForMapScreenList && giSortOrderAscending == TRUE) + giSortOrderAscending = FALSE; + else if(iValue == giSortStateForMapScreenList && giSortOrderAscending == FALSE) + giSortOrderAscending = TRUE; giSortStateForMapScreenList = iValue; - SortListOfMercsInTeamPanel( TRUE ); + SortListOfMercsInTeamPanel( TRUE, giSortOrderAscending ); } @@ -13172,7 +14083,7 @@ void MapscreenMarkButtonsDirty() MarkButtonsDirty( ); // if border buttons are created - if( !fShowMapInventoryPool ) + if( !fShowMapInventoryPool ) { // if the attribute assignment menu is showing if ( fShowAttributeMenu ) diff --git a/Strategic/mapscreen.h b/Strategic/mapscreen.h index 27427e09..de248330 100644 --- a/Strategic/mapscreen.h +++ b/Strategic/mapscreen.h @@ -84,5 +84,9 @@ BOOLEAN CanChangeSleepStatusForSoldier( SOLDIERTYPE *pSoldier ); BOOLEAN MapCharacterHasAccessibleInventory( INT8 bCharNumber ); +// CHRISL: New functions to handle initialization of inventory coordinates +BOOLEAN InitializeInvPanelCoordsOld( ); +BOOLEAN InitializeInvPanelCoordsNew( ); +BOOLEAN InitializeInvPanelCoordsVehicle( ); #endif \ No newline at end of file diff --git a/Strategic/strategic town reputation.cpp b/Strategic/strategic town reputation.cpp index 0b34c621..e6745951 100644 --- a/Strategic/strategic town reputation.cpp +++ b/Strategic/strategic town reputation.cpp @@ -19,7 +19,7 @@ // the max and min town opinion of an individual merc can be #define MAX_TOWN_OPINION 50 -#define MIN_TOWN_OPINION -50 +#define MIN_TOWN_OPINION -50 // town reputation is currently updated 4x per day: at 9am, noon, 3pm, and 6pm @@ -80,7 +80,7 @@ UINT8 GetTownOpinionOfMercForSoldier( SOLDIERTYPE *pSoldier, UINT8 ubTownId ) Assert(ubTownId < NUM_TOWNS); - // pass on to + // pass on to return( GetTownOpinionOfMerc( pSoldier->ubProfile, ubTownId ) ); } @@ -104,7 +104,7 @@ void UpdateTownOpinionOfThisMerc( UINT8 ubProfileId, UINT8 ubTownId, INT8 bAmoun else { // update amount - gMercProfiles[ ubProfileId ].bMercTownReputation[ ubTownId ] += bAmount; + gMercProfiles[ ubProfileId ].bMercTownReputation[ ubTownId ] += bAmount; } } @@ -135,7 +135,7 @@ void HandleSpreadOfAllTownsOpinion( void ) for( ubProfileId = 0; ubProfileId < FIRST_NPC; ubProfileId++ ) { HandleSpreadOfTownOpinionForMerc( ubProfileId ); - } + } } diff --git a/Strategic/strategic.cpp b/Strategic/strategic.cpp index de23d677..8859c7dd 100644 --- a/Strategic/strategic.cpp +++ b/Strategic/strategic.cpp @@ -29,12 +29,12 @@ BOOLEAN HandleStrategicDeath( SOLDIERTYPE *pSoldier ) // add the guy to the dead list //AddCharacterToDeadList( pSoldier ); - // If in a vehicle, remove them! + // If in a vehicle, remove them! if( ( pSoldier->bAssignment == VEHICLE ) && ( pSoldier->iVehicleId != -1 ) ) { // remove from vehicle TakeSoldierOutOfVehicle( pSoldier ); - } + } // if not in mapscreen if ( !(guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) @@ -47,10 +47,10 @@ BOOLEAN HandleStrategicDeath( SOLDIERTYPE *pSoldier ) ChangeSoldiersAssignment( pSoldier, ASSIGNMENT_DEAD ); } - else if( ( pSoldier -> bLife == 0 )&&( pSoldier->bAssignment != ASSIGNMENT_DEAD ) ) + else if( ( pSoldier->stats.bLife == 0 )&&( pSoldier->bAssignment != ASSIGNMENT_DEAD ) ) { // died in mapscreen - + fReDrawFace = TRUE; // dead @@ -62,22 +62,22 @@ BOOLEAN HandleStrategicDeath( SOLDIERTYPE *pSoldier ) ChangeSoldiersAssignment( pSoldier, ASSIGNMENT_DEAD ); //s et breath and breath max to 0 - pSoldier -> bBreath = pSoldier->bBreathMax = 0; + pSoldier->bBreath = pSoldier->bBreathMax = 0; // rebuild list ReBuildCharactersList( ); // ste merc as dead - // pSoldier->fUIdeadMerc = TRUE; - - // attempt o remove character from squad + // pSoldier->flags.fUIdeadMerc = TRUE; + + // attempt to remove character from squad RemoveCharacterFromSquads( pSoldier ); - + // handle any passign comments by grunts HandleSoldierDeadComments( pSoldier ); - + // put the dead guys down - AddDeadSoldierToUnLoadedSector( ( UINT8 ) ( pSoldier->sSectorX ), ( UINT8 )( pSoldier->sSectorY ), pSoldier->bSectorZ, pSoldier, RandomGridNo(), ADD_DEAD_SOLDIER_TO_SWEETSPOT ); + AddDeadSoldierToUnLoadedSector( ( UINT8 ) ( pSoldier->sSectorX ), ( UINT8 )( pSoldier->sSectorY ), pSoldier->bSectorZ, pSoldier, RandomGridNo(), ADD_DEAD_SOLDIER_TO_SWEETSPOT ); fTeamPanelDirty = TRUE; fMapPanelDirty = TRUE; @@ -99,11 +99,11 @@ void HandleSoldierDeadComments( SOLDIERTYPE *pSoldier ) // IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED! cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; - + // see if this was the friend of a living merc for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) - { - if ( pTeamSoldier->bLife >= OKLIFE && pTeamSoldier->bActive ) + { + if ( pTeamSoldier->stats.bLife >= OKLIFE && pTeamSoldier->bActive ) { bBuddyIndex = WhichBuddy( pTeamSoldier->ubProfile, pSoldier->ubProfile ); switch( bBuddyIndex ) @@ -128,4 +128,4 @@ void HandleSoldierDeadComments( SOLDIERTYPE *pSoldier ) return; -} \ No newline at end of file +} diff --git a/Strategic/strategic.h b/Strategic/strategic.h index ac541eee..3e4e9818 100644 --- a/Strategic/strategic.h +++ b/Strategic/strategic.h @@ -7,12 +7,12 @@ struct strategicmapelement{ - UINT8 UNUSEDuiFootEta[4]; // eta/mvt costs for feet - UINT8 UNUSEDuiVehicleEta[4]; // eta/mvt costs for vehicles - UINT8 uiBadFootSector[4]; // blocking mvt for foot + UINT8 UNUSEDuiFootEta[4]; // eta/mvt costs for feet + UINT8 UNUSEDuiVehicleEta[4]; // eta/mvt costs for vehicles + UINT8 uiBadFootSector[4]; // blocking mvt for foot UINT8 uiBadVehicleSector[4]; // blocking mvt from vehicles - INT8 bNameId; - BOOLEAN fEnemyControlled; // enemy controlled or not + INT8 bNameId; + BOOLEAN fEnemyControlled; // enemy controlled or not BOOLEAN fEnemyAirControlled; BOOLEAN UNUSEDfLostControlAtSomeTime; INT8 bSAMCondition; // SAM Condition .. 0 - 100, just like an item's status diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index 60f5910f..d660d9a4 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -14,10 +14,10 @@ #include #include #include - #include + #include #include "jascreens.h" #include "worlddef.h" - #include "Soldier Control.h" + #include "overhead.h" #include "interface panels.h" #include "isometric utils.h" @@ -84,7 +84,7 @@ #include "dialogue control.h" #include "Town Militia.h" #include "sysutil.h" - #include "sound control.h" + #include "Sound Control.h" #include "points.h" #include "render dirty.h" #include "Debug Control.h" @@ -108,6 +108,11 @@ #include "SaveLoadGame.h" +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + //Used by PickGridNoToWalkIn #define MAX_ATTEMPTS 200 @@ -115,7 +120,7 @@ #define BOBBYRAY_UPDATE_TIME ( 9 * 60 ) #define INSURANCE_UPDATE_TIME 0 #define EARLY_MORNING_TIME ( 4 * 60 ) -#define ENRICO_MAIL_TIME ( 7 * 60 ) +#define ENRICO_MAIL_TIME ( 7 * 60 ) enum { @@ -146,7 +151,7 @@ UINT8 gubAdjacentJumpCode; UINT32 guiAdjacentTraverseTime; UINT8 gubTacticalDirection; INT16 gsAdditionalData; -UINT16 gusDestExitGridNo; +INT16 gusDestExitGridNo; BOOLEAN fUsingEdgePointsForStrategicEntry = FALSE; BOOLEAN gfInvalidTraversal = FALSE; @@ -182,7 +187,7 @@ INT16 pSamList[ MAX_NUMBER_OF_SAMS ]; INT16 pSamGridNoAList[ MAX_NUMBER_OF_SAMS ]; INT16 pSamGridNoBList[ MAX_NUMBER_OF_SAMS ]; -// ATE: Update this w/ graphic used +// ATE: Update this w/ graphic used // Use 3 if / orientation, 4 if \ orientation INT8 gbSAMGraphicList[ MAX_NUMBER_OF_SAMS ]; @@ -389,7 +394,7 @@ typedef struct samInfo curSamInfo; UINT32 uiRowNumber; UINT32 uiHighestIndex; - + UINT32 currentDepth; UINT32 maxReadDepth; } samsiteParseData; @@ -641,7 +646,7 @@ BOOLEAN ReadInSAMInfo(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + samsiteParseData pData; @@ -650,7 +655,7 @@ BOOLEAN ReadInSAMInfo(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -665,11 +670,11 @@ BOOLEAN ReadInSAMInfo(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, samsiteStartElementHandle, samsiteEndElementHandle); XML_SetCharacterDataHandler(parser, samsiteCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); NUMBER_OF_SAMS = 0; XML_SetUserData(parser, &pData); @@ -696,11 +701,11 @@ BOOLEAN ReadInSAMInfo(STR fileName) BOOLEAN WriteInSAMInfo(STR fileName) { HWFILE hFile; - + hFile = FileOpen( fileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 x, y; INT8 cnt; @@ -744,7 +749,7 @@ BOOLEAN WriteInSAMInfo(STR fileName) else FilePrintf(hFile,"%2d \r\n",ubSAMControlledSectors[y][x]); } - } + } FilePrintf(hFile,"\t\r\n"); FilePrintf(hFile,"\r\n"); } @@ -804,7 +809,7 @@ typedef struct cityInfo curCityInfo; UINT32 uiRowNumber; UINT32 uiHighestIndex; - + UINT32 currentDepth; UINT32 maxReadDepth; } citytableParseData; @@ -1079,11 +1084,11 @@ citytableEndElementHandle(void *userData, const XML_Char *name) BOOLEAN WriteInStrategicMapSectorTownNames(STR fileName) { HWFILE hFile; - + hFile = FileOpen( fileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 x, y; INT8 cnt; @@ -1134,7 +1139,7 @@ BOOLEAN WriteInStrategicMapSectorTownNames(STR fileName) else FilePrintf(hFile,"%3d \r\n",StrategicMap[x+y*MAP_WORLD_X].bNameId); } - } + } FilePrintf(hFile,"\t\r\n"); FilePrintf(hFile,"\r\n"); } @@ -1150,7 +1155,7 @@ BOOLEAN ReadInStrategicMapSectorTownNames(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + citytableParseData pData; @@ -1159,7 +1164,7 @@ BOOLEAN ReadInStrategicMapSectorTownNames(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -1174,11 +1179,11 @@ BOOLEAN ReadInStrategicMapSectorTownNames(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, citytableStartElementHandle, citytableEndElementHandle); XML_SetCharacterDataHandler(parser, citytableCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); NUM_TOWNS = 0; XML_SetUserData(parser, &pData); @@ -1210,7 +1215,8 @@ BOOLEAN ReadInMapStructure(STR fileName) } UINT32 UndergroundTacticalTraversalTime( INT8 bExitDirection ) -{ //We are attempting to traverse in an underground environment. We need to use a complete different +{ + //We are attempting to traverse in an underground environment. We need to use a complete different //method. When underground, all sectors are instantly adjacent. switch( bExitDirection ) { @@ -1281,7 +1287,7 @@ void BeginLoadScreen( void ) SrcRect.iRight = SCREEN_WIDTH - iPercentage / 20; SrcRect.iTop = 367 * iPercentage / 100; SrcRect.iBottom = SCREEN_HEIGHT - 39 * iPercentage / 100; - + BltStretchVideoSurface( FRAME_BUFFER, guiSAVEBUFFER, 0, 0, 0, &SrcRect, &DstRect ); InvalidateScreen(); RefreshScreen( NULL ); @@ -1346,12 +1352,12 @@ void EndLoadScreen( ) SetFontBackground( FONT_NEARBLACK ); if( !gbWorldSectorZ ) { - swprintf( str, L"%c%d ENTER SECTOR TIME: %d.%02d seconds.", + swprintf( str, L"%c%d ENTER SECTOR TIME: %d.%02d seconds.", 'A' + gWorldSectorY - 1, gWorldSectorX, uiSeconds, uiHundreths ); } else { - swprintf( str, L"%c%d_b%d ENTER SECTOR TIME: %d.%02d seconds.", + swprintf( str, L"%c%d_b%d ENTER SECTOR TIME: %d.%02d seconds.", 'A' + gWorldSectorY - 1, gWorldSectorX, gbWorldSectorZ, uiSeconds, uiHundreths ); } ScreenMsg( FONT_YELLOW, MSG_TESTVERSION, str ); @@ -1378,21 +1384,21 @@ void EndLoadScreen( ) //FileRead() fprintf( fp, "\n\nVARIOUS FUNCTION TIMINGS (exclusive of actual function timings in second heading)\n" ); uiSeconds = uiTotalFileReadTime / 1000; - uiHundreths = (uiTotalFileReadTime / 10) % 100; + uiHundreths = (uiTotalFileReadTime / 10) % 100; fprintf( fp, "FileRead: %d.%02d (called %d times)\n", uiSeconds, uiHundreths, uiTotalFileReadCalls ); - + fprintf( fp, "\n\nSECTIONS OF LOADWORLD (all parts should add up to 100%)\n" ); //TrashWorld() uiSeconds = uiTrashWorldTime / 1000; - uiHundreths = (uiTrashWorldTime / 10) % 100; + uiHundreths = (uiTrashWorldTime / 10) % 100; fprintf( fp, "TrashWorld: %d.%02d\n", uiSeconds, uiHundreths ); //LoadMapTilesets() uiSeconds = uiLoadMapTilesetTime / 1000; - uiHundreths = (uiLoadMapTilesetTime / 10) % 100; + uiHundreths = (uiLoadMapTilesetTime / 10) % 100; fprintf( fp, "LoadMapTileset: %d.%02d\n", uiSeconds, uiHundreths ); //LoadMapLights() uiSeconds = uiLoadMapLightsTime / 1000; - uiHundreths = (uiLoadMapLightsTime / 10) % 100; + uiHundreths = (uiLoadMapLightsTime / 10) % 100; fprintf( fp, "LoadMapLights: %d.%02d\n", uiSeconds, uiHundreths ); uiSeconds = uiBuildShadeTableTime / 1000; uiHundreths = (uiBuildShadeTableTime / 10) % 100; @@ -1416,13 +1422,13 @@ void EndLoadScreen( ) //Unaccounted uiUnaccounted = uiLoadWorldTime - uiTrashWorldTime - uiLoadMapTilesetTime - uiLoadMapLightsTime; uiSeconds = uiUnaccounted / 1000; - uiHundreths = (uiUnaccounted / 10) % 100; - fprintf( fp, "Unaccounted: %d.%02d\n", uiSeconds, uiHundreths ); + uiHundreths = (uiUnaccounted / 10) % 100; + fprintf( fp, "Unaccounted: %d.%02d\n", uiSeconds, uiHundreths ); //LoadWorld() uiSeconds = uiLoadWorldTime / 1000; - uiHundreths = (uiLoadWorldTime / 10) % 100; + uiHundreths = (uiLoadWorldTime / 10) % 100; fprintf( fp, "\nTotal: %d.%02d\n", uiSeconds, uiHundreths ); - + fclose( fp ); } #endif @@ -1447,7 +1453,7 @@ BOOLEAN InitStrategicEngine( ) // WriteOutDistancesBetweenTowns( ); // DumpDistancesBetweenTowns( ); //#endif - + // ReadInDistancesBetweenTowns( ); return( TRUE ); @@ -1633,7 +1639,7 @@ void HandleRPCDescriptionOfSector( INT16 sSectorX, INT16 sSectorY, INT16 sSector { 9, 13, 5 }, // i13 Alma * (extra quote 6 if Sci-fi ) * { 9, 14, 7 }, // i14 Alma { 6, 8, 8 }, // f8 Cambria - { 6, 9, 9 }, // f9 Cambria + { 6, 9, 9 }, // f9 Cambria { 7, 8, 10 }, // g8 Cambria { 7, 9, 11 }, // g9 Cambria @@ -1705,14 +1711,13 @@ void HandleRPCDescriptionOfSector( INT16 sSectorX, INT16 sSectorY, INT16 sSector BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) { - UNDERGROUND_SECTORINFO *pUnderWorld=NULL; BOOLEAN fChangeMusic = TRUE; #ifdef CRIPPLED_VERSION if( sMapY >= 5 && sMapY != 16 ) { CrippledVersionFailureToLoadMapCheck(); - return FALSE; + return FALSE; } #endif @@ -1749,7 +1754,7 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE); } - if( gubNumCreaturesAttackingTown && !gbWorldSectorZ && + if( gubNumCreaturesAttackingTown && !gbWorldSectorZ && gubSectorIDOfCreatureAttack == SECTOR( gWorldSectorX, gWorldSectorY ) ) { PrepareCreaturesForBattle(); @@ -1848,7 +1853,7 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) if ( fChangeMusic ) { - SetMusicMode( MUSIC_MAIN_MENU ); + SetMusicMode( MUSIC_MAIN_MENU ); } // ATE: Do this stuff earlier! @@ -1881,7 +1886,7 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) // this call to PrepareLoadedSector() //PostSchedules(); - // ATE: OK, add code here to update the states of doors if they should + // ATE: OK, add code here to update the states of doors if they should // be closed...... if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { @@ -1903,7 +1908,7 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { - if( (gubMusicMode != MUSIC_TACTICAL_ENEMYPRESENT && gubMusicMode != MUSIC_TACTICAL_BATTLE) || + if( (gubMusicMode != MUSIC_TACTICAL_ENEMYPRESENT && gubMusicMode != MUSIC_TACTICAL_BATTLE) || (!NumHostilesInSector( sMapX, sMapY, bMapZ ) && gubMusicMode == MUSIC_TACTICAL_ENEMYPRESENT) ) { // ATE; Fade FA.T.... @@ -1988,10 +1993,10 @@ void RemoveMercsInSector( ) // ATE: only for OUR guys.. the rest is taken care of in TrashWorld() when a new sector is added... for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++) - { + { if ( pSoldier->bActive ) { - RemoveSoldierFromGridNo( pSoldier ); + pSoldier->RemoveSoldierFromGridNo( ); } } @@ -1999,9 +2004,7 @@ void RemoveMercsInSector( ) void PrepareLoadedSector() { - INT32 iCounter = 0; BOOLEAN fEnemyPresenceInThisSector = FALSE; - BOOLEAN fUsingOverride = FALSE; BOOLEAN fAddCivs = TRUE; INT8 bMineIndex = -1; @@ -2039,7 +2042,7 @@ void PrepareLoadedSector() //Check to see if civilians should be added. Always add civs to maps unless they are - //in a mine that is shutdown. + //in a mine that is shutdown. if( gbWorldSectorZ ) { bMineIndex = GetIdOfMineForSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); @@ -2061,7 +2064,7 @@ void PrepareLoadedSector() //Creatures are only added if there are actually some of them. It has to go through some //additional checking. - #ifdef JA2TESTVERSION + #ifdef JA2TESTVERSION //Override the sector with the populations specified in the AIViewer if( gfOverrideSector ) { @@ -2102,7 +2105,7 @@ void PrepareLoadedSector() // fEnemyPresenceInThisSector = PrepareEnemyForSectorBattle(); } AddProfilesNotUsingProfileInsertionData(); - + if( !AreInMeanwhile() || GetMeanwhileID() == INTERROGATION ) { fEnemyPresenceInThisSector = PrepareEnemyForSectorBattle(); @@ -2140,7 +2143,7 @@ void PrepareLoadedSector() else { #ifdef JA2BETAVERSION - ScreenMsg( FONT_RED, MSG_ERROR, L"Ambush aborted in sector %c%d -- no center point in map. LC:1", + ScreenMsg( FONT_RED, MSG_ERROR, L"Ambush aborted in sector %c%d -- no center point in map. LC:1", gWorldSectorY + 'A' - 1, gWorldSectorX ); #endif } @@ -2220,13 +2223,13 @@ void HandleQuestCodeOnSectorEntry( INT16 sNewSectorX, INT16 sNewSectorY, INT8 bN // and San Mona is abandoned continue; } - + do { ubMiner = (UINT8) Random( RANDOM_HEAD_MINERS ); } while( ubRandomMiner[ ubMiner ] == 0 ); - + GetMineSector( ubMine, (INT16 *)&(gMercProfiles[ ubRandomMiner[ ubMiner ] ].sSectorX), (INT16 *)&(gMercProfiles[ ubRandomMiner[ ubMiner ] ].sSectorY) ); gMercProfiles[ ubRandomMiner[ ubMiner ] ].bSectorZ = 0; @@ -2260,7 +2263,7 @@ void HandleQuestCodeOnSectorEntry( INT16 sNewSectorX, INT16 sNewSectorY, INT8 bN } } - // Check to see if any player merc has the Chalice; if so, + // Check to see if any player merc has the Chalice; if so, // note it as stolen cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; @@ -2376,7 +2379,7 @@ BOOLEAN EnterSector( INT16 sSectorX, INT16 sSectorY , INT8 bSectorZ ) // This has tobe done before loadworld, as it will remmove old gridnos if present RemoveMercsInSector( ); - + if( AreInMeanwhile() == FALSE ) { SetSectorFlag( sSectorX, sSectorY, bSectorZ, SF_ALREADY_VISITED ); @@ -2408,7 +2411,7 @@ BOOLEAN EnterSector( INT16 sSectorX, INT16 sSectorY , INT8 bSectorZ ) // swprintf( str, L"Loading map: %S", bFilename ); // SetProgressBarTitle( 0, str, FONT12POINT1, FONT_BLACK, FONT_BLACK ); //#endif - if( !LoadWorld(bFilename ) ) + if( !LoadWorld(bFilename) ) { return( FALSE ); } @@ -2417,7 +2420,7 @@ BOOLEAN EnterSector( INT16 sSectorX, INT16 sSectorY , INT8 bSectorZ ) if( bSectorZ ) { pNode = FindUnderGroundSector( sSectorX, sSectorY, bSectorZ ); - + // is there a sector?..if so set flag if( pNode ) { @@ -2477,7 +2480,7 @@ void UpdateMercsInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { //DONT set these values - gusSelectedSoldier = NOBODY; + gusSelectedSoldier = NOBODY; gfGameScreenLocateToSoldier = TRUE; } @@ -2492,8 +2495,8 @@ void UpdateMercsInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) //if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { for ( cnt = 0, pSoldier = MercPtrs[ cnt ]; cnt < MAX_NUM_SOLDIERS; cnt++, pSoldier++) - { - if ( gfRestoringEnemySoldiersFromTempFile && + { + if ( gfRestoringEnemySoldiersFromTempFile && cnt >= gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID && cnt <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID ) { //Don't update enemies/creatures (consec. teams) if they were @@ -2509,20 +2512,20 @@ void UpdateMercsInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) { if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { - if( gMapInformation.sCenterGridNo != -1 && gfBlitBattleSectorLocator && + if( gMapInformation.sCenterGridNo != -1 && gfBlitBattleSectorLocator && (gubEnemyEncounterCode == ENEMY_AMBUSH_CODE || gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE) && pSoldier->bTeam != CIV_TEAM ) { pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; - pSoldier->usStrategicInsertionData = gMapInformation.sCenterGridNo; + pSoldier->usStrategicInsertionData = gMapInformation.sCenterGridNo; } else if( gfOverrideInsertionWithExitGrid ) { pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; - pSoldier->usStrategicInsertionData = gExitGrid.usGridNo; + pSoldier->usStrategicInsertionData = gExitGrid.sGridNo; } } - if ( pSoldier->sSectorX == sSectorX && pSoldier->sSectorY == sSectorY && pSoldier->bSectorZ == bSectorZ && !pSoldier->fBetweenSectors ) + if ( pSoldier->sSectorX == sSectorX && pSoldier->sSectorY == sSectorY && pSoldier->bSectorZ == bSectorZ && !pSoldier->flags.fBetweenSectors ) { gbMercIsNewInThisSector[ pSoldier->ubID ] = 1; @@ -2539,13 +2542,13 @@ void UpdateMercsInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) // ATE: If we are in i13 - pop up message! if ( sSectorY == MAP_ROW_I && sSectorX == 13 ) { - DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ POW_MERCS_ARE_HERE ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_OK, NULL, NULL ); + DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ POW_MERCS_ARE_HERE ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_OK, NULL, NULL ); } else { AddCharacterToUniqueSquad( pSoldier ); - ubPOWSquad = pSoldier->bAssignment; - pSoldier->bNeutral = FALSE; + ubPOWSquad = pSoldier->bAssignment; + pSoldier->aiData.bNeutral = FALSE; } } else @@ -2591,20 +2594,20 @@ void UpdateMercsInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) void UpdateMercInSector( SOLDIERTYPE *pSoldier, INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) { BOOLEAN fError = FALSE; - if( pSoldier->uiStatusFlags & SOLDIER_IS_TACTICALLY_VALID) + if( pSoldier->flags.uiStatusFlags & SOLDIER_IS_TACTICALLY_VALID) { pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; } // OK, determine entrence direction and get sweetspot // Only if we are an OK guy to control.... // SOME CHECKS HERE MUST BE FLESHED OUT...... - if ( pSoldier->bActive ) // This was in the if, removed by DEF: pSoldier->bLife >= OKLIFE && + if ( pSoldier->bActive ) // This was in the if, removed by DEF: pSoldier->stats.bLife >= OKLIFE && { // If we are not in transit... if ( pSoldier->bAssignment != IN_TRANSIT ) - { + { // CHECK UBINSERTION CODE.. - if( pSoldier->ubStrategicInsertionCode == INSERTION_CODE_PRIMARY_EDGEINDEX || + if( pSoldier->ubStrategicInsertionCode == INSERTION_CODE_PRIMARY_EDGEINDEX || pSoldier->ubStrategicInsertionCode == INSERTION_CODE_SECONDARY_EDGEINDEX ) { if ( !fUsingEdgePointsForStrategicEntry ) @@ -2619,7 +2622,7 @@ void UpdateMercInSector( SOLDIERTYPE *pSoldier, INT16 sSectorX, INT16 sSectorY, if ( pSoldier->ubProfile != NO_PROFILE && gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags3 & PROFILE_MISC_FLAG3_PERMANENT_INSERTION_CODE ) { // override orders - pSoldier->bOrders = STATIONARY; + pSoldier->aiData.bOrders = STATIONARY; } @@ -2656,13 +2659,13 @@ void UpdateMercInSector( SOLDIERTYPE *pSoldier, INT16 sSectorX, INT16 sSectorY, break; case INSERTION_CODE_PRIMARY_EDGEINDEX: - pSoldier->sInsertionGridNo = SearchForClosestPrimaryMapEdgepoint( pSoldier->sPendingActionData2, (UINT8)pSoldier->usStrategicInsertionData ); + pSoldier->sInsertionGridNo = SearchForClosestPrimaryMapEdgepoint( pSoldier->aiData.sPendingActionData2, (UINT8)pSoldier->usStrategicInsertionData ); #ifdef JA2BETAVERSION { CHAR8 str[256]; - sprintf( str, "%S's primary insertion gridno is %d using %d as initial search gridno and %d insertion code.", - pSoldier->name, pSoldier->sInsertionGridNo, pSoldier->sPendingActionData2, pSoldier->usStrategicInsertionData ); - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, str ); + sprintf( str, "%S's primary insertion gridno is %d using %d as initial search gridno and %d insertion code.", + pSoldier->name, pSoldier->sInsertionGridNo, pSoldier->aiData.sPendingActionData2, pSoldier->usStrategicInsertionData ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, str ); } #endif if( pSoldier->sInsertionGridNo == NOWHERE ) @@ -2673,13 +2676,13 @@ void UpdateMercInSector( SOLDIERTYPE *pSoldier, INT16 sSectorX, INT16 sSectorY, } break; case INSERTION_CODE_SECONDARY_EDGEINDEX: - pSoldier->sInsertionGridNo = SearchForClosestSecondaryMapEdgepoint( pSoldier->sPendingActionData2, (UINT8)pSoldier->usStrategicInsertionData ); + pSoldier->sInsertionGridNo = SearchForClosestSecondaryMapEdgepoint( pSoldier->aiData.sPendingActionData2, (UINT8)pSoldier->usStrategicInsertionData ); #ifdef JA2BETAVERSION { CHAR8 str[256]; - sprintf( str, "%S's isolated insertion gridno is %d using %d as initial search gridno and %d insertion code.", - pSoldier->name, pSoldier->sInsertionGridNo, pSoldier->sPendingActionData2, pSoldier->usStrategicInsertionData ); - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, str ); + sprintf( str, "%S's isolated insertion gridno is %d using %d as initial search gridno and %d insertion code.", + pSoldier->name, pSoldier->sInsertionGridNo, pSoldier->aiData.sPendingActionData2, pSoldier->usStrategicInsertionData ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, str ); } #endif if( pSoldier->sInsertionGridNo == NOWHERE ) @@ -2712,12 +2715,12 @@ void UpdateMercInSector( SOLDIERTYPE *pSoldier, INT16 sSectorX, INT16 sSectorY, break; default: pSoldier->sInsertionGridNo = 12880; - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Improper insertion code %d given to UpdateMercsInSector", pSoldier->ubStrategicInsertionCode ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Improper insertion code %d given to UpdateMercsInSector", pSoldier->ubStrategicInsertionCode ) ); break; } if( fError ) - { //strategic insertion failed because it expected to find an entry point. This is likely + { //strategic insertion failed because it expected to find an entry point. This is likely //a missing part of the map or possible fault in strategic movement costs, traversal logic, etc. CHAR16 szEntry[10]; CHAR16 szSector[10]; @@ -2748,7 +2751,7 @@ void UpdateMercInSector( SOLDIERTYPE *pSoldier, INT16 sSectorX, INT16 sSectorY, swprintf( szEntry, L"center" ); sGridNo = gMapInformation.sCenterGridNo; } - else + else { ScreenMsg( FONT_RED, MSG_BETAVERSION, L"Sector %s has NO entrypoints -- using precise center of map for %s.", szSector, pSoldier->name ); pSoldier->sInsertionGridNo = 12880; @@ -2778,7 +2781,7 @@ void UpdateMercInSector( SOLDIERTYPE *pSoldier, INT16 sSectorX, INT16 sSectorY, // If no insertion direction exists, this is bad! if ( pSoldier->sInsertionGridNo == -1 ) { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Insertion gridno for direction %d not added to map sector %d %d", pSoldier->ubStrategicInsertionCode, sSectorX, sSectorY ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Insertion gridno for direction %d not added to map sector %d %d", pSoldier->ubStrategicInsertionCode, sSectorX, sSectorY ) ); pSoldier->sInsertionGridNo = 12880; } @@ -2792,7 +2795,7 @@ void GetSectorIDString( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ , STR16 zS { SECTORINFO *pSector = NULL; UNDERGROUND_SECTORINFO *pUnderground; - INT8 bTownNameID; + INT8 bTownNameID; INT8 bMineIndex; UINT8 ubSectorID = 0; UINT8 ubLandType = 0; @@ -2857,7 +2860,7 @@ void GetSectorIDString( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ , STR16 zS wcscat( zString, pLandTypeStrings[ TROPICS ] ); else if( fDetailed ) wcscat( zString, pLandTypeStrings[ TROPICS_SAM_SITE ] ); - else + else wcscat( zString, pLandTypeStrings[ SAM_SITE ] ); break; case SEC_D15: //Drassen SAM @@ -2865,7 +2868,7 @@ void GetSectorIDString( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ , STR16 zS wcscat( zString, pLandTypeStrings[ SPARSE ] ); else if( fDetailed ) wcscat( zString, pLandTypeStrings[ SPARSE_SAM_SITE ] ); - else + else wcscat( zString, pLandTypeStrings[ SAM_SITE ] ); break; case SEC_I8: //Cambria SAM @@ -2873,7 +2876,7 @@ void GetSectorIDString( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ , STR16 zS wcscat( zString, pLandTypeStrings[ SAND ] ); else if( fDetailed ) wcscat( zString, pLandTypeStrings[ SAND_SAM_SITE ] ); - else + else wcscat( zString, pLandTypeStrings[ SAM_SITE ] ); break; default: @@ -2909,7 +2912,7 @@ void GetSectorIDString( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ , STR16 zS else wcscat( zString, pTownNames[ ORTA ] ); break; - case SEC_N3: + case SEC_N3: if( fDetailed ) wcscat( zString, pLandTypeStrings[ MEDUNA_AIRPORT_SITE ] ); else @@ -2923,7 +2926,7 @@ void GetSectorIDString( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ , STR16 zS else wcscat( zString, pLandTypeStrings[ SAM_SITE ] ); } - else + else { //All other towns that are known since beginning of the game. wcscat( zString, pTownNames[ bTownNameID ] ); if( fDetailed ) @@ -2967,9 +2970,9 @@ UINT8 SetInsertionDataFromAdjacentMoveDirection( SOLDIERTYPE *pSoldier, UINT8 ub } ubDirection = 255; pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; - pSoldier->usStrategicInsertionData = ExitGrid.usGridNo; + pSoldier->usStrategicInsertionData = ExitGrid.sGridNo; pSoldier->bUseExitGridForReentryDirection = TRUE; - break; + break; case NORTH: ubDirection = NORTH_STRATEGIC_MOVE; @@ -2990,7 +2993,7 @@ UINT8 SetInsertionDataFromAdjacentMoveDirection( SOLDIERTYPE *pSoldier, UINT8 ub default: // Wrong direction given! #ifdef JA2BETAVERSION - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Improper insertion direction %d given to SetInsertionDataFromAdjacentMoveDirection", ubTacticalDirection ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Improper insertion direction %d given to SetInsertionDataFromAdjacentMoveDirection", ubTacticalDirection ) ); ScreenMsg( FONT_RED, MSG_ERROR, L"Improper insertion direction %d given to SetInsertionDataFromAdjacentMoveDirection", ubTacticalDirection ); #endif ubDirection = EAST_STRATEGIC_MOVE; @@ -3014,7 +3017,7 @@ UINT8 GetInsertionDataFromAdjacentMoveDirection( UINT8 ubTacticalDirection, INT1 case 255: ubDirection = 255; - break; + break; case NORTH: ubDirection = NORTH_STRATEGIC_MOVE; @@ -3031,7 +3034,7 @@ UINT8 GetInsertionDataFromAdjacentMoveDirection( UINT8 ubTacticalDirection, INT1 default: // Wrong direction given! #ifdef JA2BETAVERSION - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Improper insertion direction %d given to GetInsertionDataFromAdjacentMoveDirection", ubTacticalDirection ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Improper insertion direction %d given to GetInsertionDataFromAdjacentMoveDirection", ubTacticalDirection ) ); ScreenMsg( FONT_RED, MSG_ERROR, L"Improper insertion direction %d given to GetInsertionDataFromAdjacentMoveDirection", ubTacticalDirection ); #endif ubDirection = EAST_STRATEGIC_MOVE; @@ -3054,7 +3057,7 @@ UINT8 GetStrategicInsertionDataFromAdjacentMoveDirection( UINT8 ubTacticalDirect case 255: ubDirection = 255; - break; + break; case NORTH: ubDirection = INSERTION_CODE_SOUTH; @@ -3071,7 +3074,7 @@ UINT8 GetStrategicInsertionDataFromAdjacentMoveDirection( UINT8 ubTacticalDirect default: // Wrong direction given! #ifdef JA2BETAVERSION - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Improper insertion direction %d given to SetInsertionDataFromAdjacentMoveDirection", ubTacticalDirection ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Improper insertion direction %d given to SetInsertionDataFromAdjacentMoveDirection", ubTacticalDirection ) ); ScreenMsg( FONT_RED, MSG_ERROR, L"Improper insertion direction %d given to GetStrategicInsertionDataFromAdjacentMoveDirection", ubTacticalDirection ); #endif ubDirection = EAST_STRATEGIC_MOVE; @@ -3093,7 +3096,7 @@ void JumpIntoAdjacentSector( UINT8 ubTacticalDirection, UINT8 ubJumpCode, INT16 EXITGRID ExitGrid; INT8 bPrevAssignment; UINT8 ubPrevGroupID; - + // Set initial selected // ATE: moved this towards top... gubPreferredInitialSelectedGuy = (UINT8)gusSelectedSoldier; @@ -3104,10 +3107,10 @@ void JumpIntoAdjacentSector( UINT8 ubTacticalDirection, UINT8 ubJumpCode, INT16 // Move controllable mercs! cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) - { - // If we are controllable + { + // If we are controllable if ( OK_CONTROLLABLE_MERC( pSoldier) && pSoldier->bAssignment == CurrentSquad( ) ) { pValidSoldier = pSoldier; @@ -3167,7 +3170,7 @@ void JumpIntoAdjacentSector( UINT8 ubTacticalDirection, UINT8 ubJumpCode, INT16 else { // OK, no jump code here given... - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Improper jump code %d given to JumpIntoAdjacentSector", ubJumpCode ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Improper jump code %d given to JumpIntoAdjacentSector", ubJumpCode ) ); } Assert( pValidSoldier ); @@ -3225,7 +3228,7 @@ void JumpIntoAdjacentSector( UINT8 ubTacticalDirection, UINT8 ubJumpCode, INT16 gsAdjacentSectorX = ExitGrid.ubGotoSectorX; gsAdjacentSectorY = ExitGrid.ubGotoSectorY; gbAdjacentSectorZ = ExitGrid.ubGotoSectorZ; - gusDestExitGridNo = ExitGrid.usGridNo; + gusDestExitGridNo = ExitGrid.sGridNo; } // Give guy(s) orders to walk off sector... @@ -3237,7 +3240,7 @@ void JumpIntoAdjacentSector( UINT8 ubTacticalDirection, UINT8 ubJumpCode, INT16 curr = pGroup->pPlayerList; while( curr ) - { + { if ( OK_CONTROLLABLE_MERC( curr->pSoldier) ) { if ( ubTacticalDirection != 255 ) @@ -3251,14 +3254,14 @@ void JumpIntoAdjacentSector( UINT8 ubTacticalDirection, UINT8 ubJumpCode, INT16 // Save wait code - this will make buddy walk off screen into oblivion curr->pSoldier->ubWaitActionToDo = 2; // This will set the direction so we know now to move into oblivion - curr->pSoldier->uiPendingActionData1 = ubTacticalDirection; + curr->pSoldier->aiData.uiPendingActionData1 = ubTacticalDirection; } else { AssertMsg( 0, String( "Failed to get good exit location for adjacentmove" ) ); } - EVENT_GetNewSoldierPath( curr->pSoldier, sGridNo, WALKING ); + curr->pSoldier->EVENT_GetNewSoldierPath( sGridNo, WALKING ); } else @@ -3282,7 +3285,7 @@ void JumpIntoAdjacentSector( UINT8 ubTacticalDirection, UINT8 ubJumpCode, INT16 // Set buddy go! gfPlotPathToExitGrid = TRUE; - EVENT_GetNewSoldierPath( curr->pSoldier, sGridNo, WALKING ); + curr->pSoldier->EVENT_GetNewSoldierPath( sGridNo, WALKING ); gfPlotPathToExitGrid = FALSE; } @@ -3300,7 +3303,7 @@ BEGINNING_LOOP: curr = pGroup->pPlayerList; while( curr ) - { + { if ( !OK_CONTROLLABLE_MERC( curr->pSoldier ) ) { RemoveCharacterFromSquads( curr->pSoldier ); @@ -3415,7 +3418,7 @@ void AllMercsWalkedToExitGrid() pPlayer = gpAdjacentGroup->pPlayerList; while( pPlayer ) { - if( pPlayer->pSoldier->bLife < OKLIFE ) + if( pPlayer->pSoldier->stats.bLife < OKLIFE ) { AddCharacterToUniqueSquad( pPlayer->pSoldier ); break; @@ -3468,7 +3471,7 @@ void AllMercsHaveWalkedOffSector( ) // ATE: Added here: donot load another screen if we were told not to.... if( ( gubAdjacentJumpCode == JUMP_ALL_NO_LOAD || gubAdjacentJumpCode == JUMP_SINGLE_NO_LOAD ) ) - { + { //Case 1: //Move the group the conventionally strategic method @@ -3478,7 +3481,7 @@ void AllMercsHaveWalkedOffSector( ) AddWaypointToPGroup( gpAdjacentGroup, (UINT8)gsAdjacentSectorX, (UINT8)gsAdjacentSectorY ); pPlayer = gpAdjacentGroup->pPlayerList; - while( pPlayer ) + while( pPlayer ) { // NOTE: This line is different from case 2 and 3... RemoveSoldierFromTacticalSector( pPlayer->pSoldier, TRUE ); @@ -3507,7 +3510,7 @@ void AllMercsHaveWalkedOffSector( ) // we bring up mapscreen // 2 ) We can move right away so do it! if( guiAdjacentTraverseTime <= 5 ) - { + { INT16 sScreenX, sScreenY, sNewGridNo; UINT32 sWorldX, sWorldY; @@ -3526,8 +3529,8 @@ void AllMercsHaveWalkedOffSector( ) // Determine 'mirror' gridno... // Convert to absolute xy - GetWorldXYAbsoluteScreenXY( (INT16)(pSoldier->sX / CELL_X_SIZE ), (INT16)(pSoldier->sY / CELL_Y_SIZE ), &sScreenX, &sScreenY ); - + GetWorldXYAbsoluteScreenXY( (INT16)(pSoldier->sX / CELL_X_SIZE ), (INT16)(pSoldier->sY / CELL_Y_SIZE ), &sScreenX, &sScreenY ); + // Get 'mirror', depending on what direction... switch( gubTacticalDirection ) { @@ -3536,13 +3539,13 @@ void AllMercsHaveWalkedOffSector( ) case EAST: sScreenX = 0; break; case WEST: sScreenX = 3160; break; } - + // Convert into a gridno again..... GetFromAbsoluteScreenXYWorldXY( &sWorldX, &sWorldY, sScreenX, sScreenY ); sNewGridNo = (INT16)GETWORLDINDEXFROMWORLDCOORDS( sWorldY, sWorldX ); - + // Save this gridNo.... - pSoldier->sPendingActionData2 = sNewGridNo; + pSoldier->aiData.sPendingActionData2 = sNewGridNo; // Copy CODe computed earlier into data pSoldier->usStrategicInsertionData = pSoldier->ubStrategicInsertionCode; // Now use NEW code.... @@ -3556,7 +3559,7 @@ void AllMercsHaveWalkedOffSector( ) gfTacticalTraversal = TRUE; gpTacticalTraversalGroup = gpAdjacentGroup; - + if( gbAdjacentSectorZ > 0 ) { //Nasty strategic movement logic doesn't like underground sectors! gfUndergroundTacticalTraversal = TRUE; @@ -3610,16 +3613,16 @@ void AllMercsHaveWalkedOffSector( ) BOOLEAN fWarpTime = FALSE; if( !gbAdjacentSectorZ && NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) ) - { //We are retreating from a sector with enemies in it and there are no mercs left so - //warp the game time by 5 minutes to simulate the actual retreat. This restricts the + { //We are retreating from a sector with enemies in it and there are no mercs left so + //warp the game time by 5 minutes to simulate the actual retreat. This restricts the //player from immediately coming back to the same sector they left to perhaps take advantage - //of the tactical placement gui to get into better position. Additionally, if there are any - //enemies in this sector that are part of a movement group, reset that movement group so that they + //of the tactical placement gui to get into better position. Additionally, if there are any + //enemies in this sector that are part of a movement group, reset that movement group so that they //are "in" the sector rather than 75% of the way to the next sector if that is the case. fWarpTime = TRUE; ResetMovementForEnemyGroupsInLocation( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY ); } - + //Lock game into mapscreen mode, but after the fade is done. gfEnteringMapScreen = TRUE; @@ -3664,13 +3667,13 @@ void SetupTacticalTraversalInformation() // pass flag that this is a tactical traversal, the path built MUST go in the traversed direction even if longer! PlotPathForCharacter( pSoldier, gsAdjacentSectorX, gsAdjacentSectorY, TRUE ); - + if( guiAdjacentTraverseTime <= 5 ) { // Determine 'mirror' gridno... // Convert to absolute xy - GetWorldXYAbsoluteScreenXY( (INT16)(pSoldier->sX / CELL_X_SIZE ), (INT16)(pSoldier->sY / CELL_Y_SIZE ), &sScreenX, &sScreenY ); - + GetWorldXYAbsoluteScreenXY( (INT16)(pSoldier->sX / CELL_X_SIZE ), (INT16)(pSoldier->sY / CELL_Y_SIZE ), &sScreenX, &sScreenY ); + // Get 'mirror', depending on what direction... switch( gubTacticalDirection ) { @@ -3679,13 +3682,13 @@ void SetupTacticalTraversalInformation() case EAST: sScreenX = 0; break; case WEST: sScreenX = 3160; break; } - + // Convert into a gridno again..... GetFromAbsoluteScreenXYWorldXY( (INT32 *)&sWorldX, (INT32 *)&sWorldY, sScreenX, sScreenY ); sNewGridNo = (INT16)GETWORLDINDEXFROMWORLDCOORDS( sWorldY, sWorldX ); - + // Save this gridNo.... - pSoldier->sPendingActionData2 = sNewGridNo; + pSoldier->aiData.sPendingActionData2 = sNewGridNo; // Copy CODe computed earlier into data pSoldier->usStrategicInsertionData = pSoldier->ubStrategicInsertionCode; // Now use NEW code.... @@ -3717,7 +3720,7 @@ void AllMercsHaveWalkedOffSector( ) if( NumEnemiesInAnySector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ) ) { - fEnemiesInLoadedSector = TRUE; + fEnemiesInLoadedSector = TRUE; } HandleLoyaltyImplicationsOfMercRetreat( RETREAT_TACTICAL_TRAVERSAL, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); @@ -3744,10 +3747,10 @@ void AllMercsHaveWalkedOffSector( ) // ATE: Added here: donot load another screen if we were told not to.... if( ( gubAdjacentJumpCode == JUMP_ALL_NO_LOAD || gubAdjacentJumpCode == JUMP_SINGLE_NO_LOAD ) ) - { //Case 1: Group is leaving sector, but there are other mercs in sector and player wants to stay, or + { //Case 1: Group is leaving sector, but there are other mercs in sector and player wants to stay, or // there are other mercs in sector while a battle is in progress. pPlayer = gpAdjacentGroup->pPlayerList; - while( pPlayer ) + while( pPlayer ) { RemoveSoldierFromTacticalSector( pPlayer->pSoldier, TRUE ); pPlayer = pPlayer->next; @@ -3757,11 +3760,11 @@ void AllMercsHaveWalkedOffSector( ) else { if( fEnemiesInLoadedSector ) - { //We are retreating from a sector with enemies in it and there are no mercs left so - //warp the game time by 5 minutes to simulate the actual retreat. This restricts the + { //We are retreating from a sector with enemies in it and there are no mercs left so + //warp the game time by 5 minutes to simulate the actual retreat. This restricts the //player from immediately coming back to the same sector they left to perhaps take advantage - //of the tactical placement gui to get into better position. Additionally, if there are any - //enemies in this sector that are part of a movement group, reset that movement group so that they + //of the tactical placement gui to get into better position. Additionally, if there are any + //enemies in this sector that are part of a movement group, reset that movement group so that they //are "in" the sector rather than 75% of the way to the next sector if that is the case. ResetMovementForEnemyGroupsInLocation( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY ); @@ -3795,7 +3798,7 @@ void AllMercsHaveWalkedOffSector( ) } else { //Case 3: Going directly to mapscreen - + //Lock game into mapscreen mode, but after the fade is done. gfEnteringMapScreen = TRUE; @@ -3847,10 +3850,10 @@ void DoneFadeOutAdjacentSector( ) // Set pathing flag to path through anything.... gfPathAroundObstacles = FALSE; } - + // OK, give our guys new orders... if( gpAdjacentGroup->fPlayer ) - { + { //For player groups, update the soldier information PLAYERGROUP *curr; UINT32 uiAttempts; @@ -3859,8 +3862,8 @@ void DoneFadeOutAdjacentSector( ) INT16 sWorldX, sWorldY; curr = gpAdjacentGroup->pPlayerList; while( curr ) - { - if( !(curr->pSoldier->uiStatusFlags & SOLDIER_IS_TACTICALLY_VALID) ) + { + if( !(curr->pSoldier->flags.uiStatusFlags & SOLDIER_IS_TACTICALLY_VALID) ) { if( curr->pSoldier->sGridNo != NOWHERE ) { @@ -3881,10 +3884,10 @@ void DoneFadeOutAdjacentSector( ) sOldGridNo = curr->pSoldier->sGridNo; sWorldX = CenterX( sGridNo ); sWorldY = CenterY( sGridNo ); - EVENT_SetSoldierPosition( curr->pSoldier, sWorldX, sWorldY ); + curr->pSoldier->EVENT_SetSoldierPosition( sWorldX, sWorldY ); if( sGridNo != sOldGridNo ) { - EVENT_GetNewSoldierPath( curr->pSoldier, sOldGridNo, WALKING ); + curr->pSoldier->EVENT_GetNewSoldierPath( sOldGridNo, WALKING ); } ubNum++; } @@ -3894,7 +3897,7 @@ void DoneFadeOutAdjacentSector( ) #ifdef JA2BETAVERSION CHAR8 str[256]; sprintf( str, "%S's gridno is NOWHERE, and is attempting to walk into sector.", curr->pSoldier->name ); - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, str ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, str ); #endif } } @@ -3928,7 +3931,7 @@ BOOLEAN SoldierOKForSectorExit( SOLDIERTYPE * pSoldier, INT8 bExitDirection, UIN return( FALSE ); // OK, anyone on roofs cannot! - if ( pSoldier->bLevel > 0 ) + if ( pSoldier->pathing.bLevel > 0 ) return( FALSE ); // get world absolute XY @@ -3939,7 +3942,7 @@ BOOLEAN SoldierOKForSectorExit( SOLDIERTYPE * pSoldier, INT8 bExitDirection, UIN // Check direction switch( bExitDirection ) - { + { case EAST_STRATEGIC_MOVE: if ( sWorldX < ( ( gsTRX - gsTLX ) - CHECK_DIR_X_DELTA ) ) @@ -3985,7 +3988,7 @@ BOOLEAN SoldierOKForSectorExit( SOLDIERTYPE * pSoldier, INT8 bExitDirection, UIN // FOR REALTIME - DO MOVEMENT BASED ON STANCE! if ( ( gTacticalStatus.uiFlags & REALTIME ) || !( gTacticalStatus.uiFlags & INCOMBAT ) ) { - pSoldier->usUIMovementMode = GetMoveStateBasedOnStance( pSoldier, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ); + pSoldier->usUIMovementMode = pSoldier->GetMoveStateBasedOnStance( gAnimControl[ pSoldier->usAnimState ].ubEndHeight ); } sGridNo = FindGridNoFromSweetSpotCloseToExitGrid( pSoldier, usAdditionalData, 10, &ubDirection ); @@ -4045,7 +4048,7 @@ BOOLEAN OKForSectorExit( INT8 bExitDirection, UINT16 usAdditionalData, UINT32 *p return FALSE; } */ - + gfInvalidTraversal = FALSE; gfLoneEPCAttemptingTraversal = FALSE; gubLoneMercAttemptingToAbandonEPCs = 0; @@ -4054,10 +4057,10 @@ BOOLEAN OKForSectorExit( INT8 bExitDirection, UINT16 usAdditionalData, UINT32 *p // Look through all mercs and check if they are within range of east end.... cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) - { - // If we are controllable + { + // If we are controllable if ( OK_CONTROLLABLE_MERC( pSoldier) && pSoldier->bAssignment == CurrentSquad( ) ) { //Need to keep a copy of a good soldier, so we can access it later, and @@ -4074,7 +4077,7 @@ BOOLEAN OKForSectorExit( INT8 bExitDirection, UINT16 usAdditionalData, UINT32 *p ubNumEPCs++; //Also record the EPC's slot ID incase we later build a string using the EPC's name. gbPotentiallyAbandonedEPCSlotID = (INT8)cnt; - if( AM_A_ROBOT( pSoldier ) && !CanRobotBeControlled( pSoldier ) ) + if( AM_A_ROBOT( pSoldier ) && !pSoldier->CanRobotBeControlled( ) ) { gfRobotWithoutControllerAttemptingTraversal = TRUE; ubNumControllableMercs--; @@ -4134,11 +4137,11 @@ BOOLEAN OKForSectorExit( INT8 bExitDirection, UINT16 usAdditionalData, UINT32 *p ubPlayerControllableMercsInSquad = (UINT8)NumberOfPlayerControllableMercsInSquad( MercPtrs[ gusSelectedSoldier ]->bAssignment ); if( fAtLeastOneMercControllable <= ubPlayerControllableMercsInSquad ) { //if the selected merc is an EPC and we can only leave with that merc, then prevent it - //as EPCs aren't allowed to leave by themselves. Instead of restricting this in the + //as EPCs aren't allowed to leave by themselves. Instead of restricting this in the //exiting sector gui, we restrict it by explaining it with a message box. if ( AM_AN_EPC( MercPtrs[ gusSelectedSoldier ] ) ) { - if( AM_A_ROBOT( pSoldier ) && !CanRobotBeControlled( pSoldier ) ) + if( AM_A_ROBOT( pSoldier ) && !pSoldier->CanRobotBeControlled( ) ) { //gfRobotWithoutControllerAttemptingTraversal = TRUE; return FALSE; @@ -4280,7 +4283,7 @@ INT8 GetSAMIdFromSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) { INT8 bCounter = 0; INT16 sSectorValue = 0; - + // check if valid sector if( bSectorZ != 0 ) { @@ -4322,15 +4325,15 @@ BOOLEAN CanGoToTacticalInSector( INT16 sX, INT16 sY, UINT8 ubZ ) //for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++) { // ARM: now allows loading of sector with all mercs below OKLIFE as long as they're alive - //if( ( pSoldier->bActive && pSoldier->bLife ) && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && + //if( ( pSoldier->bActive && pSoldier->stats.bLife ) && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && // ( pSoldier->bAssignment != IN_TRANSIT ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) && - // ( pSoldier->bAssignment != ASSIGNMENT_DEAD ) && !SoldierAboardAirborneHeli( pSoldier ) + // ( pSoldier->bAssignment != ASSIGNMENT_DEAD ) && !SoldierAboardAirborneHeli( pSoldier ) // ) //if( (SectorInfo[ SECTOR( gWorldSectorX,gWorldSectorY) ].uiFlags & SF_ALREADY_VISITED) ) if( GetSectorFlagStatus( sSelMapX, sSelMapY, ( UINT8 )iCurrentMapSectorZ, SF_ALREADY_VISITED ) == TRUE ) { - //if ( !pSoldier->fBetweenSectors && pSoldier->sSectorX == sX && pSoldier->sSectorY == sY && pSoldier->bSectorZ == ubZ ) + //if ( !pSoldier->flags.fBetweenSectors && pSoldier->sSectorX == sX && pSoldier->sSectorY == sY && pSoldier->bSectorZ == ubZ ) { return( TRUE ); } @@ -4371,8 +4374,8 @@ INT32 SAMSitesUnderPlayerControl( INT16 sX, INT16 sY ) // yes fSamSiteUnderControl = TRUE; } - } - + } + return( fSamSiteUnderControl ); } @@ -4490,7 +4493,7 @@ BOOLEAN IsThisSectorASAMSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) // is this sector part of the town? -BOOLEAN SectorIsPartOfTown( INT8 bTownId, INT16 sSectorX, INT16 sSectorY ) +BOOLEAN SectorIsPartOfTown( INT8 bTownId, INT16 sSectorX, INT16 sSectorY ) { if( StrategicMap[CALCULATE_STRATEGIC_INDEX( sSectorX, sSectorY ) ].bNameId == bTownId ) { @@ -4508,7 +4511,7 @@ BOOLEAN SaveStrategicInfoToSavedFile( HWFILE hFile ) UINT32 uiNumBytesWritten=0; UINT32 uiSize = sizeof( StrategicMapElement ) * ( MAP_WORLD_X * MAP_WORLD_Y ); - + // Save the strategic map information FileWrite( hFile, StrategicMap, uiSize, &uiNumBytesWritten ); if( uiNumBytesWritten != uiSize) @@ -4554,7 +4557,7 @@ BOOLEAN LoadStrategicInfoFromSavedFile( HWFILE hFile ) UINT32 uiNumBytesRead=0; UINT32 uiSize = sizeof( StrategicMapElement ) * ( MAP_WORLD_X * MAP_WORLD_Y ); - + // Load the strategic map information FileRead( hFile, StrategicMap, uiSize, &uiNumBytesRead ); if( uiNumBytesRead != uiSize) @@ -4622,7 +4625,7 @@ INT16 PickGridNoNearestEdge( SOLDIERTYPE *pSoldier, UINT8 ubTacticalDirection ) { sGridNo++; } - + bOdd = (INT8)!bOdd; } @@ -4632,17 +4635,17 @@ INT16 PickGridNoNearestEdge( SOLDIERTYPE *pSoldier, UINT8 ubTacticalDirection ) do { // OK, here we go back one, check for OK destination... - if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->bLevel ) && FindBestPath( pSoldier, sGridNo, pSoldier->bLevel, WALKING, NO_COPYROUTE, PATH_THROUGH_PEOPLE ) ) + if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) && FindBestPath( pSoldier, sGridNo, pSoldier->pathing.bLevel, WALKING, NO_COPYROUTE, PATH_THROUGH_PEOPLE ) ) { return( sGridNo ); } // If here, try another place! // ( alternate up/down ) - if ( bOdd2 ) + if ( bOdd2 ) { - bAdjustedDist++; - + bAdjustedDist++; + sGridNo = sStartGridNo; for ( cnt = 0; cnt < bAdjustedDist; cnt++ ) @@ -4685,7 +4688,7 @@ INT16 PickGridNoNearestEdge( SOLDIERTYPE *pSoldier, UINT8 ubTacticalDirection ) { sGridNo--; } - + bOdd = (INT8)!bOdd; } @@ -4695,17 +4698,17 @@ INT16 PickGridNoNearestEdge( SOLDIERTYPE *pSoldier, UINT8 ubTacticalDirection ) do { // OK, here we go back one, check for OK destination... - if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->bLevel ) && FindBestPath( pSoldier, sGridNo, pSoldier->bLevel, WALKING, NO_COPYROUTE, PATH_THROUGH_PEOPLE ) ) + if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) && FindBestPath( pSoldier, sGridNo, pSoldier->pathing.bLevel, WALKING, NO_COPYROUTE, PATH_THROUGH_PEOPLE ) ) { return( sGridNo ); } // If here, try another place! // ( alternate up/down ) - if ( bOdd2 ) + if ( bOdd2 ) { - bAdjustedDist++; - + bAdjustedDist++; + sGridNo = sStartGridNo; for ( cnt = 0; cnt < bAdjustedDist; cnt++ ) @@ -4748,7 +4751,7 @@ INT16 PickGridNoNearestEdge( SOLDIERTYPE *pSoldier, UINT8 ubTacticalDirection ) { sGridNo--; } - + bOdd = (INT8)(!bOdd); } @@ -4758,17 +4761,17 @@ INT16 PickGridNoNearestEdge( SOLDIERTYPE *pSoldier, UINT8 ubTacticalDirection ) do { // OK, here we go back one, check for OK destination... - if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->bLevel ) && FindBestPath( pSoldier, sGridNo, pSoldier->bLevel, WALKING, NO_COPYROUTE, PATH_THROUGH_PEOPLE ) ) + if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) && FindBestPath( pSoldier, sGridNo, pSoldier->pathing.bLevel, WALKING, NO_COPYROUTE, PATH_THROUGH_PEOPLE ) ) { return( sGridNo ); } // If here, try another place! // ( alternate left/right ) - if ( bOdd2 ) + if ( bOdd2 ) { - bAdjustedDist++; - + bAdjustedDist++; + sGridNo = sStartGridNo; for ( cnt = 0; cnt < bAdjustedDist; cnt++ ) @@ -4811,7 +4814,7 @@ INT16 PickGridNoNearestEdge( SOLDIERTYPE *pSoldier, UINT8 ubTacticalDirection ) { sGridNo++; } - + bOdd = (INT8)(!bOdd); } @@ -4821,17 +4824,17 @@ INT16 PickGridNoNearestEdge( SOLDIERTYPE *pSoldier, UINT8 ubTacticalDirection ) do { // OK, here we go back one, check for OK destination... - if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->bLevel ) && FindBestPath( pSoldier, sGridNo, pSoldier->bLevel, WALKING, NO_COPYROUTE, PATH_THROUGH_PEOPLE ) ) + if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) && FindBestPath( pSoldier, sGridNo, pSoldier->pathing.bLevel, WALKING, NO_COPYROUTE, PATH_THROUGH_PEOPLE ) ) { return( sGridNo ); } // If here, try another place! // ( alternate left/right ) - if ( bOdd2 ) + if ( bOdd2 ) { - bAdjustedDist++; - + bAdjustedDist++; + sGridNo = sStartGridNo; for ( cnt = 0; cnt < bAdjustedDist; cnt++ ) @@ -4867,22 +4870,22 @@ void AdjustSoldierPathToGoOffEdge( SOLDIERTYPE *pSoldier, INT16 sEndGridNo, UINT INT32 iLoop; // will this path segment actually take us to our desired destination in the first place? - if (pSoldier->usPathDataSize + 2 > MAX_PATH_LIST_SIZE) + if (pSoldier->pathing.usPathDataSize + 2 > MAX_PATH_LIST_SIZE) { sTempGridNo = pSoldier->sGridNo; - for (iLoop = 0; iLoop < pSoldier->usPathDataSize; iLoop++) + for (iLoop = 0; iLoop < pSoldier->pathing.usPathDataSize; iLoop++) { - sTempGridNo += DirectionInc( (UINT8) pSoldier->usPathingData[ iLoop ] ); + sTempGridNo += DirectionInc( (UINT8) pSoldier->pathing.usPathingData[ iLoop ] ); } if (sTempGridNo == sEndGridNo) { // we can make it, but there isn't enough path room for the two steps required. // truncate our path so there's guaranteed the merc will have to generate another - // path later on... - pSoldier->usPathDataSize -= 4; + // path later on... + pSoldier->pathing.usPathDataSize -= 4; return; } else @@ -4896,19 +4899,19 @@ void AdjustSoldierPathToGoOffEdge( SOLDIERTYPE *pSoldier, INT16 sEndGridNo, UINT { case EAST: - sNewGridNo = NewGridNo( (UINT16)sEndGridNo, (UINT16)DirectionInc( (UINT8)NORTHEAST ) ); + sNewGridNo = NewGridNo( (INT16)sEndGridNo, (UINT16)DirectionInc( (UINT8)NORTHEAST ) ); if ( OutOfBounds( sEndGridNo, sNewGridNo ) ) { return; } - pSoldier->usPathingData[ pSoldier->usPathDataSize ] = NORTHEAST; - pSoldier->usPathDataSize++; - pSoldier->sFinalDestination = sNewGridNo; - pSoldier->usActionData = sNewGridNo; + pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathDataSize ] = NORTHEAST; + pSoldier->pathing.usPathDataSize++; + pSoldier->pathing.sFinalDestination = sNewGridNo; + pSoldier->aiData.usActionData = sNewGridNo; - sTempGridNo = NewGridNo( (UINT16)sNewGridNo, (UINT16)DirectionInc( (UINT8)NORTHEAST ) ); + sTempGridNo = NewGridNo( (INT16)sNewGridNo, (UINT16)DirectionInc( (UINT8)NORTHEAST ) ); if ( OutOfBounds( sNewGridNo, sTempGridNo ) ) { @@ -4916,28 +4919,28 @@ void AdjustSoldierPathToGoOffEdge( SOLDIERTYPE *pSoldier, INT16 sEndGridNo, UINT } sNewGridNo = sTempGridNo; - pSoldier->usPathingData[ pSoldier->usPathDataSize ] = NORTHEAST; - pSoldier->usPathDataSize++; - pSoldier->sFinalDestination = sNewGridNo; - pSoldier->usActionData = sNewGridNo; + pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathDataSize ] = NORTHEAST; + pSoldier->pathing.usPathDataSize++; + pSoldier->pathing.sFinalDestination = sNewGridNo; + pSoldier->aiData.usActionData = sNewGridNo; break; case WEST: - sNewGridNo = NewGridNo( (UINT16)sEndGridNo, (UINT16)DirectionInc( (UINT8)SOUTHWEST ) ); + sNewGridNo = NewGridNo( (INT16)sEndGridNo, (UINT16)DirectionInc( (UINT8)SOUTHWEST ) ); if ( OutOfBounds( sEndGridNo, sNewGridNo ) ) { return; } - pSoldier->usPathingData[ pSoldier->usPathDataSize ] = SOUTHWEST; - pSoldier->usPathDataSize++; - pSoldier->sFinalDestination = sNewGridNo; - pSoldier->usActionData = sNewGridNo; + pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathDataSize ] = SOUTHWEST; + pSoldier->pathing.usPathDataSize++; + pSoldier->pathing.sFinalDestination = sNewGridNo; + pSoldier->aiData.usActionData = sNewGridNo; - sTempGridNo = NewGridNo( (UINT16)sNewGridNo, (UINT16)DirectionInc( (UINT8)SOUTHWEST ) ); + sTempGridNo = NewGridNo( (INT16)sNewGridNo, (UINT16)DirectionInc( (UINT8)SOUTHWEST ) ); if ( OutOfBounds( sNewGridNo, sTempGridNo ) ) { @@ -4945,27 +4948,27 @@ void AdjustSoldierPathToGoOffEdge( SOLDIERTYPE *pSoldier, INT16 sEndGridNo, UINT } sNewGridNo = sTempGridNo; - pSoldier->usPathingData[ pSoldier->usPathDataSize ] = SOUTHWEST; - pSoldier->usPathDataSize++; - pSoldier->sFinalDestination = sNewGridNo; - pSoldier->usActionData = sNewGridNo; + pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathDataSize ] = SOUTHWEST; + pSoldier->pathing.usPathDataSize++; + pSoldier->pathing.sFinalDestination = sNewGridNo; + pSoldier->aiData.usActionData = sNewGridNo; break; case NORTH: - sNewGridNo = NewGridNo( (UINT16)sEndGridNo, (UINT16)DirectionInc( (UINT8)NORTHWEST ) ); + sNewGridNo = NewGridNo( (INT16)sEndGridNo, (UINT16)DirectionInc( (UINT8)NORTHWEST ) ); if ( OutOfBounds( sEndGridNo, sNewGridNo ) ) { return; } - pSoldier->usPathingData[ pSoldier->usPathDataSize ] = NORTHWEST; - pSoldier->usPathDataSize++; - pSoldier->sFinalDestination = sNewGridNo; - pSoldier->usActionData = sNewGridNo; + pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathDataSize ] = NORTHWEST; + pSoldier->pathing.usPathDataSize++; + pSoldier->pathing.sFinalDestination = sNewGridNo; + pSoldier->aiData.usActionData = sNewGridNo; - sTempGridNo = NewGridNo( (UINT16)sNewGridNo, (UINT16)DirectionInc( (UINT8)NORTHWEST ) ); + sTempGridNo = NewGridNo( (INT16)sNewGridNo, (UINT16)DirectionInc( (UINT8)NORTHWEST ) ); if ( OutOfBounds( sNewGridNo, sTempGridNo ) ) { @@ -4973,28 +4976,28 @@ void AdjustSoldierPathToGoOffEdge( SOLDIERTYPE *pSoldier, INT16 sEndGridNo, UINT } sNewGridNo = sTempGridNo; - pSoldier->usPathingData[ pSoldier->usPathDataSize ] = NORTHWEST; - pSoldier->usPathDataSize++; - pSoldier->sFinalDestination = sNewGridNo; - pSoldier->usActionData = sNewGridNo; + pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathDataSize ] = NORTHWEST; + pSoldier->pathing.usPathDataSize++; + pSoldier->pathing.sFinalDestination = sNewGridNo; + pSoldier->aiData.usActionData = sNewGridNo; break; case SOUTH: - sNewGridNo = NewGridNo( (UINT16)sEndGridNo, (UINT16)DirectionInc( (UINT8)SOUTHEAST ) ); + sNewGridNo = NewGridNo( (INT16)sEndGridNo, (UINT16)DirectionInc( (UINT8)SOUTHEAST ) ); if ( OutOfBounds( sEndGridNo, sNewGridNo ) ) { return; } - pSoldier->usPathingData[ pSoldier->usPathDataSize ] = SOUTHEAST; - pSoldier->usPathDataSize++; - pSoldier->sFinalDestination = sNewGridNo; - pSoldier->usActionData = sNewGridNo; + pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathDataSize ] = SOUTHEAST; + pSoldier->pathing.usPathDataSize++; + pSoldier->pathing.sFinalDestination = sNewGridNo; + pSoldier->aiData.usActionData = sNewGridNo; - sTempGridNo = NewGridNo( (UINT16)sNewGridNo, (UINT16)DirectionInc( (UINT8)SOUTHEAST ) ); + sTempGridNo = NewGridNo( (INT16)sNewGridNo, (UINT16)DirectionInc( (UINT8)SOUTHEAST ) ); if ( OutOfBounds( sNewGridNo, sTempGridNo ) ) { @@ -5002,10 +5005,10 @@ void AdjustSoldierPathToGoOffEdge( SOLDIERTYPE *pSoldier, INT16 sEndGridNo, UINT } sNewGridNo = sTempGridNo; - pSoldier->usPathingData[ pSoldier->usPathDataSize ] = SOUTHEAST; - pSoldier->usPathDataSize++; - pSoldier->sFinalDestination = sNewGridNo; - pSoldier->usActionData = sNewGridNo; + pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathDataSize ] = SOUTHEAST; + pSoldier->pathing.usPathDataSize++; + pSoldier->pathing.sFinalDestination = sNewGridNo; + pSoldier->aiData.usActionData = sNewGridNo; break; } @@ -5043,7 +5046,7 @@ INT16 PickGridNoToWalkIn( SOLDIERTYPE *pSoldier, UINT8 ubInsertionDirection, UIN { sGridNo--; } - + bOdd = (INT8)(!bOdd); } @@ -5054,17 +5057,17 @@ INT16 PickGridNoToWalkIn( SOLDIERTYPE *pSoldier, UINT8 ubInsertionDirection, UIN { (*puiNumAttempts)++; // OK, here we go back one, check for OK destination... - if ( ( gTacticalStatus.uiFlags & IGNORE_ALL_OBSTACLES ) || ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->bLevel ) && FindBestPath( pSoldier, sGridNo, pSoldier->bLevel, WALKING, NO_COPYROUTE, PATH_THROUGH_PEOPLE ) ) ) + if ( ( gTacticalStatus.uiFlags & IGNORE_ALL_OBSTACLES ) || ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) && FindBestPath( pSoldier, sGridNo, pSoldier->pathing.bLevel, WALKING, NO_COPYROUTE, PATH_THROUGH_PEOPLE ) ) ) { return( sGridNo ); } // If here, try another place! // ( alternate up/down ) - if ( bOdd2 ) + if ( bOdd2 ) { - bAdjustedDist++; - + bAdjustedDist++; + sGridNo = sStartGridNo; for ( cnt = 0; cnt < bAdjustedDist; cnt++ ) @@ -5106,7 +5109,7 @@ INT16 PickGridNoToWalkIn( SOLDIERTYPE *pSoldier, UINT8 ubInsertionDirection, UIN { sGridNo++; } - + bOdd = (INT8)(!bOdd); } @@ -5117,17 +5120,17 @@ INT16 PickGridNoToWalkIn( SOLDIERTYPE *pSoldier, UINT8 ubInsertionDirection, UIN { (*puiNumAttempts)++; // OK, here we go back one, check for OK destination... - if ( ( gTacticalStatus.uiFlags & IGNORE_ALL_OBSTACLES ) || ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->bLevel ) && FindBestPath( pSoldier, sGridNo, pSoldier->bLevel, WALKING, NO_COPYROUTE, PATH_THROUGH_PEOPLE ) ) ) + if ( ( gTacticalStatus.uiFlags & IGNORE_ALL_OBSTACLES ) || ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) && FindBestPath( pSoldier, sGridNo, pSoldier->pathing.bLevel, WALKING, NO_COPYROUTE, PATH_THROUGH_PEOPLE ) ) ) { return( sGridNo ); } // If here, try another place! // ( alternate up/down ) - if ( bOdd2 ) + if ( bOdd2 ) { - bAdjustedDist++; - + bAdjustedDist++; + sGridNo = sStartGridNo; for ( cnt = 0; cnt < bAdjustedDist; cnt++ ) @@ -5169,7 +5172,7 @@ INT16 PickGridNoToWalkIn( SOLDIERTYPE *pSoldier, UINT8 ubInsertionDirection, UIN { sGridNo--; } - + bOdd = (INT8)(!bOdd); } @@ -5180,17 +5183,17 @@ INT16 PickGridNoToWalkIn( SOLDIERTYPE *pSoldier, UINT8 ubInsertionDirection, UIN { (*puiNumAttempts)++; // OK, here we go back one, check for OK destination... - if ( ( gTacticalStatus.uiFlags & IGNORE_ALL_OBSTACLES ) || ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->bLevel ) && FindBestPath( pSoldier, sGridNo, pSoldier->bLevel, WALKING, NO_COPYROUTE, PATH_THROUGH_PEOPLE ) ) ) + if ( ( gTacticalStatus.uiFlags & IGNORE_ALL_OBSTACLES ) || ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) && FindBestPath( pSoldier, sGridNo, pSoldier->pathing.bLevel, WALKING, NO_COPYROUTE, PATH_THROUGH_PEOPLE ) ) ) { return( sGridNo ); } // If here, try another place! // ( alternate left/right ) - if ( bOdd2 ) + if ( bOdd2 ) { - bAdjustedDist++; - + bAdjustedDist++; + sGridNo = sStartGridNo; for ( cnt = 0; cnt < bAdjustedDist; cnt++ ) @@ -5232,7 +5235,7 @@ INT16 PickGridNoToWalkIn( SOLDIERTYPE *pSoldier, UINT8 ubInsertionDirection, UIN { sGridNo++; } - + bOdd = (INT8)(!bOdd); } @@ -5243,17 +5246,17 @@ INT16 PickGridNoToWalkIn( SOLDIERTYPE *pSoldier, UINT8 ubInsertionDirection, UIN { (*puiNumAttempts)++; // OK, here we go back one, check for OK destination... - if ( ( gTacticalStatus.uiFlags & IGNORE_ALL_OBSTACLES ) || ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->bLevel ) && FindBestPath( pSoldier, sGridNo, pSoldier->bLevel, WALKING, NO_COPYROUTE, PATH_THROUGH_PEOPLE ) ) ) + if ( ( gTacticalStatus.uiFlags & IGNORE_ALL_OBSTACLES ) || ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) && FindBestPath( pSoldier, sGridNo, pSoldier->pathing.bLevel, WALKING, NO_COPYROUTE, PATH_THROUGH_PEOPLE ) ) ) { return( sGridNo ); } // If here, try another place! // ( alternate left/right ) - if ( bOdd2 ) + if ( bOdd2 ) { - bAdjustedDist++; - + bAdjustedDist++; + sGridNo = sStartGridNo; for ( cnt = 0; cnt < bAdjustedDist; cnt++ ) @@ -5316,7 +5319,7 @@ void HandleSlayDailyEvent( void ) } // valid soldier? - if( ( pSoldier->bActive == FALSE ) || ( pSoldier->bLife == 0 ) || ( pSoldier->bAssignment == IN_TRANSIT ) ||( pSoldier->bAssignment == ASSIGNMENT_POW ) ) + if( ( pSoldier->bActive == FALSE ) || ( pSoldier->stats.bLife == 0 ) || ( pSoldier->bAssignment == IN_TRANSIT ) ||( pSoldier->bAssignment == ASSIGNMENT_POW ) ) { // no return; @@ -5354,38 +5357,38 @@ BOOLEAN HandleDefiniteUnloadingOfWorld( UINT8 ubUnloadCode ) INT32 i; // clear tactical queue - ClearEventQueue(); + ClearEventQueue(); // ATE: End all bullets.... - DeleteAllBullets(); + DeleteAllBullets(); // End all physics objects... - RemoveAllPhysicsObjects(); + RemoveAllPhysicsObjects(); - RemoveAllActiveTimedBombs(); + RemoveAllActiveTimedBombs(); // handle any quest stuff here so world items can be affected - HandleQuestCodeOnSectorExit( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); + HandleQuestCodeOnSectorExit( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); //if we arent loading a saved game if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { //Clear any potential battle flags. They will be set if necessary. - gTacticalStatus.fEnemyInSector = FALSE; - gTacticalStatus.uiFlags &= ~INCOMBAT; + gTacticalStatus.fEnemyInSector = FALSE; + gTacticalStatus.uiFlags &= ~INCOMBAT; } if ( ubUnloadCode == ABOUT_TO_LOAD_NEW_MAP ) - { + { //if we arent loading a saved game if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { // Save the current sectors Item list to a temporary file, if its not the first time in - SaveCurrentSectorsInformationToTempItemFile(); + SaveCurrentSectorsInformationToTempItemFile(); // Update any mercs currently in sector, their profile info... - UpdateSoldierPointerDataIntoProfile( FALSE ); + UpdateSoldierPointerDataIntoProfile( FALSE ); } } else if( ubUnloadCode == ABOUT_TO_TRASH_WORLD ) @@ -5411,7 +5414,7 @@ BOOLEAN HandleDefiniteUnloadingOfWorld( UINT8 ubUnloadCode ) } //Handle cases for both types of unloading - HandleMilitiaStatusInCurrentMapBeforeLoadingNewMap(); + HandleMilitiaStatusInCurrentMapBeforeLoadingNewMap(); return TRUE; } @@ -5419,22 +5422,22 @@ BOOLEAN HandlePotentialBringUpAutoresolveToFinishBattle( ) { INT32 i; - //We don't have mercs in the sector. Now, we check to see if there are BOTH enemies and militia. If both + //We don't have mercs in the sector. Now, we check to see if there are BOTH enemies and militia. If both //co-exist in the sector, then make them fight for control of the sector via autoresolve. for( i = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bLife ) + if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife ) { - if( MercPtrs[ i ]->sSectorX == gWorldSectorX && - MercPtrs[ i ]->sSectorY == gWorldSectorY && + if( MercPtrs[ i ]->sSectorX == gWorldSectorX && + MercPtrs[ i ]->sSectorY == gWorldSectorY && MercPtrs[ i ]->bSectorZ == gbWorldSectorZ ) { //We have enemies, now look for militia! for( i = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; i <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bLife && MercPtrs[ i ]->bSide == OUR_TEAM ) + if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && MercPtrs[ i ]->bSide == OUR_TEAM ) { - if( MercPtrs[ i ]->sSectorX == gWorldSectorX && - MercPtrs[ i ]->sSectorY == gWorldSectorY && + if( MercPtrs[ i ]->sSectorX == gWorldSectorX && + MercPtrs[ i ]->sSectorY == gWorldSectorY && MercPtrs[ i ]->bSectorZ == gbWorldSectorZ ) { //We have militia and enemies and no mercs! Let's finish this battle in autoresolve. gfEnteringMapScreen = TRUE; @@ -5479,7 +5482,7 @@ BOOLEAN CheckAndHandleUnloadingOfCurrentWorld() } if( gTacticalStatus.fDidGameJustStart && gWorldSectorX == 9 && gWorldSectorY == 1 && !gbWorldSectorZ ) - { + { return FALSE; } @@ -5491,13 +5494,13 @@ BOOLEAN CheckAndHandleUnloadingOfCurrentWorld() { for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) { //If we have a live and valid soldier - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bLife && !MercPtrs[ i ]->fBetweenSectors && !(MercPtrs[ i ]->uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( MercPtrs[ i ] ) && !AM_AN_EPC( MercPtrs[ i ] ) ) + if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && !MercPtrs[ i ]->flags.fBetweenSectors && !(MercPtrs[ i ]->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( MercPtrs[ i ] ) && !AM_AN_EPC( MercPtrs[ i ] ) ) { - if( MercPtrs[ i ]->sSectorX == gWorldSectorX && - MercPtrs[ i ]->sSectorY == gWorldSectorY && + if( MercPtrs[ i ]->sSectorX == gWorldSectorX && + MercPtrs[ i ]->sSectorY == gWorldSectorY && MercPtrs[ i ]->bSectorZ == gbWorldSectorZ ) { - RemoveSoldierFromGridNo( MercPtrs[ i ] ); + MercPtrs[ i ]->RemoveSoldierFromGridNo( ); InitSoldierOppList( MercPtrs[ i ] ); } } @@ -5505,22 +5508,22 @@ BOOLEAN CheckAndHandleUnloadingOfCurrentWorld() } } else - { //Check and see if we have any live mercs in the sector. + { //Check and see if we have any live mercs in the sector. for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) { //If we have a live and valid soldier - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bLife && !MercPtrs[ i ]->fBetweenSectors && !(MercPtrs[ i ]->uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( MercPtrs[ i ] ) && !AM_AN_EPC( MercPtrs[ i ] )) + if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && !MercPtrs[ i ]->flags.fBetweenSectors && !(MercPtrs[ i ]->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( MercPtrs[ i ] ) && !AM_AN_EPC( MercPtrs[ i ] )) { - if( MercPtrs[ i ]->sSectorX == gWorldSectorX && - MercPtrs[ i ]->sSectorY == gWorldSectorY && + if( MercPtrs[ i ]->sSectorX == gWorldSectorX && + MercPtrs[ i ]->sSectorY == gWorldSectorY && MercPtrs[ i ]->bSectorZ == gbWorldSectorZ ) - { + { return FALSE; } } } //KM : August 6, 1999 Patch fix // Added logic to prevent a crash when player mercs would retreat from a battle involving militia and enemies. - // Without the return here, it would proceed to trash the world, and then when autoresolve would come up to + // Without the return here, it would proceed to trash the world, and then when autoresolve would come up to // finish the tactical battle, it would fail to find the existing soldier information (because it was trashed). if( HandlePotentialBringUpAutoresolveToFinishBattle( ) ) { @@ -5546,10 +5549,10 @@ BOOLEAN CheckAndHandleUnloadingOfCurrentWorld() if( guiCurrentScreen == GAME_SCREEN ) { if( !gfTacticalTraversal ) - { //if we are in tactical and don't intend on going to another sector immediately, then + { //if we are in tactical and don't intend on going to another sector immediately, then gfEnteringMapScreen = TRUE; } - else + else { //The trashing of the world will be handled automatically. return FALSE; } @@ -5562,7 +5565,7 @@ BOOLEAN CheckAndHandleUnloadingOfCurrentWorld() } if( guiCurrentScreen == AUTORESOLVE_SCREEN ) - { + { if( gWorldSectorX == sBattleSectorX && gWorldSectorY == sBattleSectorY && gbWorldSectorZ == sBattleSectorZ ) { //Yes, this is and looks like a hack. The conditions of this if statement doesn't work inside //TrashWorld() or more specifically, TacticalRemoveSoldier() from within TrashWorld(). Because @@ -5623,7 +5626,7 @@ void SetupProfileInsertionDataForSoldier( SOLDIERTYPE *pSoldier ) //@@@Evaluate -- insert code here //SAMPLE CODE: There are multiple situations that I didn't code. The gridno should be the final destination - //or reset??? + //or reset??? if ( pSoldier->ubQuoteRecord && pSoldier->ubQuoteActionID ) { @@ -5632,7 +5635,7 @@ void SetupProfileInsertionDataForSoldier( SOLDIERTYPE *pSoldier ) { // Handle traversal. This NPC's sector will NOT already be set correctly, so we have to call for that too HandleNPCChangesForTacticalTraversal( pSoldier ); - gMercProfiles[ pSoldier->ubProfile ].fUseProfileInsertionInfo = FALSE; + gMercProfiles[ pSoldier->ubProfile ].fUseProfileInsertionInfo = FALSE; if ( pSoldier->ubProfile != NO_PROFILE && NPCHasUnusedRecordWithGivenApproach( pSoldier->ubProfile, APPROACH_DONE_TRAVERSAL ) ) { gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags3 |= PROFILE_MISC_FLAG3_HANDLE_DONE_TRAVERSAL; @@ -5641,7 +5644,7 @@ void SetupProfileInsertionDataForSoldier( SOLDIERTYPE *pSoldier ) } else { - if ( pSoldier->sFinalDestination == pSoldier->sGridNo ) + if ( pSoldier->pathing.sFinalDestination == pSoldier->sGridNo ) { gMercProfiles[ pSoldier->ubProfile ].usStrategicInsertionData = pSoldier->sGridNo; } @@ -5651,8 +5654,8 @@ void SetupProfileInsertionDataForSoldier( SOLDIERTYPE *pSoldier ) } else { - gMercProfiles[ pSoldier->ubProfile ].usStrategicInsertionData = pSoldier->sFinalDestination; - } + gMercProfiles[ pSoldier->ubProfile ].usStrategicInsertionData = pSoldier->pathing.sFinalDestination; + } gMercProfiles[ pSoldier->ubProfile ].fUseProfileInsertionInfo = TRUE; gMercProfiles[ pSoldier->ubProfile ].ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; @@ -5673,7 +5676,7 @@ void SetupProfileInsertionDataForSoldier( SOLDIERTYPE *pSoldier ) //isn't needed for these cases as the code is a direction only. gMercProfiles[ pSoldier->ubProfile ].ubStrategicInsertionCode = pSoldier->ubStrategicInsertionCode; gMercProfiles[ pSoldier->ubProfile ].usStrategicInsertionData = 0; - + //Strategic system should now work. gMercProfiles[ pSoldier->ubProfile ].fUseProfileInsertionInfo = TRUE; } @@ -5687,7 +5690,7 @@ void HandlePotentialMoraleHitForSkimmingSectors( GROUP *pGroup ) if ( !gTacticalStatus.fHasEnteredCombatModeSinceEntering && gTacticalStatus.fEnemyInSector ) { //Flag is set so if "wilderness" enemies are in the adjacent sector of this group, the group has - //a 90% chance of ambush. Because this typically doesn't happen very often, the chance is high. + //a 90% chance of ambush. Because this typically doesn't happen very often, the chance is high. //This reflects the enemies radioing ahead to other enemies of the group's arrival, so they have //time to setup a good ambush! pGroup->uiFlags |= GROUPFLAG_HIGH_POTENTIAL_FOR_AMBUSH; @@ -5698,7 +5701,7 @@ void HandlePotentialMoraleHitForSkimmingSectors( GROUP *pGroup ) { // Do morale hit... // CC look here! - // pPlayer->pSoldier + // pPlayer->pSoldier pPlayer = pPlayer->next; } @@ -5714,7 +5717,7 @@ void CrippledVersionFailureToLoadMapCheck() swprintf( zString, L"Error! Sorry, you must stay between sectors A and E in this limited press version." ); - DoScreenIndependantMessageBox( zString, MSG_BOX_FLAG_OK, CrippledVersionFailureToLoadMapCallBack ); + DoScreenIndependantMessageBox( zString, MSG_BOX_FLAG_OK, CrippledVersionFailureToLoadMapCallBack ); } void CrippledVersionFailureToLoadMapCallBack( UINT8 bExitValue ) diff --git a/Strategic/strategicmap.h b/Strategic/strategicmap.h index 9c3f38a6..05a80dec 100644 --- a/Strategic/strategicmap.h +++ b/Strategic/strategicmap.h @@ -5,7 +5,7 @@ #include "soldier control.h" #include "FileMan.h" -//The maximum size for any team strategically speaking. For example, we can't have more than 20 enemies, militia, or creatures at a time. +//The maximum size for any team strategically speaking. For example, we can't have more than 20 enemies, militia, or creatures at a time. //#define MAX_STRATEGIC_TEAM_SIZE 20 // Codes for jumoing into adjacent sectors.. @@ -63,12 +63,12 @@ extern BOOLEAN gfUseAlternateMap; // get index into aray #define CALCULATE_STRATEGIC_INDEX( x, y ) ( x + ( y * MAP_WORLD_X ) ) -#define GET_X_FROM_STRATEGIC_INDEX( i ) ( i % MAP_WORLD_X ) -#define GET_Y_FROM_STRATEGIC_INDEX( i ) ( i / MAP_WORLD_X ) +#define GET_X_FROM_STRATEGIC_INDEX( i ) ( i % MAP_WORLD_X ) +#define GET_Y_FROM_STRATEGIC_INDEX( i ) ( i / MAP_WORLD_X ) // macros to convert between the 2 different sector numbering systems #define SECTOR_INFO_TO_STRATEGIC_INDEX( i ) ( CALCULATE_STRATEGIC_INDEX ( SECTORX( i ), SECTORY( i ) ) ) -#define STRATEGIC_INDEX_TO_SECTOR_INFO( i ) ( SECTOR( GET_X_FROM_STRATEGIC_INDEX( i ), GET_Y_FROM_STRATEGIC_INDEX( i ) ) ) +#define STRATEGIC_INDEX_TO_SECTOR_INFO( i ) ( SECTOR( GET_X_FROM_STRATEGIC_INDEX( i ), GET_Y_FROM_STRATEGIC_INDEX( i ) ) ) // grab the town id value @@ -171,7 +171,7 @@ void SetupProfileInsertionDataForSoldier( SOLDIERTYPE *pSoldier ); BOOLEAN HandlePotentialBringUpAutoresolveToFinishBattle( ); //Used for determining the type of error message that comes up when you can't traverse to -//an adjacent sector. THESE VALUES DO NOT NEED TO BE SAVED! +//an adjacent sector. THESE VALUES DO NOT NEED TO BE SAVED! extern BOOLEAN gfInvalidTraversal; extern BOOLEAN gfLoneEPCAttemptingTraversal; extern BOOLEAN gfRobotWithoutControllerAttemptingTraversal; diff --git a/Sys Globals.cpp b/Sys Globals.cpp index 5006f870..3b89ed75 100644 --- a/Sys Globals.cpp +++ b/Sys Globals.cpp @@ -22,21 +22,22 @@ BOOLEAN gfResetInputCheck = FALSE; BOOLEAN gfGlobalError = FALSE; UINT32 guiGameCycleCounter = 0; -CHAR8 gubErrorText[ 200 ]; +CHAR8 gubErrorText[ 512 ];//for long filenames -BOOLEAN SET_ERROR( const STR8 String, ...) +BOOLEAN SET_ERROR( const STR8 String, ...) { - va_list ArgPtr; + va_list ArgPtr; - va_start(ArgPtr, String); - vsprintf( gubErrorText, String, ArgPtr); - va_end(ArgPtr); + va_start(ArgPtr, String); + vsprintf( gubErrorText, String, ArgPtr); + va_end(ArgPtr); SetPendingNewScreen( ERROR_SCREEN ); - gfGlobalError = TRUE; - - return( FALSE ); + gfGlobalError = TRUE; + + return( FALSE ); } + diff --git a/Sys Globals.h b/Sys Globals.h index f899e545..7ed6acad 100644 --- a/Sys Globals.h +++ b/Sys Globals.h @@ -4,7 +4,7 @@ #define SHOW_MIN_FPS 0 #define SHOW_FULL_FPS 1 -extern CHAR8 gubErrorText[ 200 ]; +extern CHAR8 gubErrorText[ 512 ];//for long filenames extern BOOLEAN gfAniEditMode; extern BOOLEAN gfEditMode; extern BOOLEAN fFirstTimeInGameScreen; @@ -25,6 +25,6 @@ extern UINT32 guiGameCycleCounter; extern INT32 giFPSOverlay; extern INT32 giCounterPeriodOverlay; -extern BOOLEAN SET_ERROR( const STR8 String, ...); +extern BOOLEAN SET_ERROR( const STR8 String, ...); #endif diff --git a/Tactical/AStarPathfinder.cpp b/Tactical/AStarPathfinder.cpp new file mode 100644 index 00000000..0a49c22d --- /dev/null +++ b/Tactical/AStarPathfinder.cpp @@ -0,0 +1,186 @@ + +#include "stdafx.h" +#include "profiler.h" +#include "BinaryHeap.hpp" + +using namespace std; + +void AStarPathfinder::ResetAStarList() +{ + for each (CSmallPoint node in ClosedList) { + SetAStarStatus(node, AStar_Init); + SetAStarGCost(node, 0.0f); + SetAStarGTime(node, 0.0f); + } + for (int size = OpenHeap.size(); size > 0; --size) { + CSmallPoint node = OpenHeap.peekElement(size).data; + SetAStarStatus(node, AStar_Init); + SetAStarGCost(node, 0.0f); + SetAStarGTime(node, 0.0f); + } + ClosedList.clear(); + OpenHeap.clear(); + return; +}//end ResetAStarList + +AStarHeap AStarPathfinder::AStar(const CSmallPoint& StartCity, + const vector& acceptableDestCities, + const ePlayer player, + const unsigned int maxNodes) +{ + AStarHeap TopHeap(StartCity, 0); + CSmallPoint BestNode = StartCity; + for (;;) { + //this peg is now closed + //SetAStarStatus(BestNode, AStar_Closed); + ClosedList.push_back(BestNode); + if (isNodeDestCity(BestNode, acceptableDestCities) == true) { + //the best path to date leads to a city, other cities are not as good, so return this city + return TopHeap; + } + + //if we have run out of time and the best node isn't a city + if (OpenHeap.size() + ClosedList.size() > maxNodes) { + float best = -99999999.0f; + int bestIndex = 0; + for (int index = 1; index <= OpenHeap.size(); ++index) { + float key = OpenHeap.peekElement(index).key; + if (key > best) { + bestIndex = index; + best = key; + } + } + if (bestIndex) { + //but at least one city was opened, it might not be A* efficient, but it's a path + return OpenHeap.peekElement(bestIndex); + } + else { + //no cities were opened + return AStarHeap(CSmallPoint(0,0), 111); + } + } + + //this adds to the heap nodes that might be on a path to a city + ExecuteAStarLogic(StartCity, BestNode, acceptableDestCities, player); + + if (OpenHeap.size() == 0) { + return AStarHeap(CSmallPoint(0,0), -222); + } + + //get the best point so far from the heap + TopHeap = OpenHeap.popTopHeap(); + BestNode = TopHeap.data; + //ASSERT(GetAStarStatus(BestNode) == AStar_Open); + } + return TopHeap; +}//end AStar + +void AStarPathfinder::ExecuteAStarLogic(const CSmallPoint& StartCity, + const CSmallPoint& BestNode, + const vector& acceptableDestCities, + const ePlayer player) +{ + float baseGCost = GetAStarGCost(BestNode); + float baseGTime = GetAStarGTime(BestNode); + + for (int index = 0; index < 8; ++index) { + CSmallPoint ThisNode = BestNode + offsets[index]; + if (CWorldManager::isNodeInWorld(ThisNode) == false || + GetAStarStatus(ThisNode) == AStar_Closed) { + continue; + } + + float AStarGCost = baseGCost + CalcGCost(BestNode, ThisNode, player); + float AStarGTime = baseGTime + CalcGTime(BestNode, ThisNode); + + if (GetAStarStatus(ThisNode) == AStar_Open + && AStarGCost >= GetAStarGCost(ThisNode) + && AStarGTime >= GetAStarGTime(ThisNode)) { + //no matter what Dest City, this path is less profitable + continue; + } + + CSmallPoint bestCity(0,0); + float AStarF = 0.0f; + for each (AStarHeap city in acceptableDestCities) { + //is this path and Dest City combo profitable? + if (city.key > AStarGCost) { + //find the best H + float AStarHTime = CalcHTime(ThisNode, city.data); + float AStarHProfit = city.key; + float estimatedF = (AStarHProfit - AStarGCost) / (AStarHTime + AStarGTime); + if (AStarF < estimatedF) { + bestCity = city.data; + AStarF = estimatedF; + } + } + } + if (AStarF == 0.0f) { + //no profitable paths remain from this node + continue; + } + + //insert this node onto the heap + if (GetAStarStatus(ThisNode) == AStar_Init) { + OpenHeap.insertElement(ThisNode, -AStarF); + } + else { + if (GetAStarF(ThisNode) > AStarF) { + //the node is already open and this path is not more cost efficient + //we had to do the whole calculation and not just compare the GCost / GTime ratio + //because changing them affect the Dest City and AStarF + continue; + } + OpenHeap.editElement(ThisNode, -AStarF); + } + SetAStarStatus(ThisNode, AStar_Open); + SetAStarF(ThisNode, AStarF); + SetAStarGCost(ThisNode, AStarGCost); + SetAStarGTime(ThisNode, AStarGTime); + SetAStarParent(ThisNode, BestNode); + SetAStarCity(ThisNode, bestCity); + } + + return; +}//end ExecuteAStarLogic + +bool AStarPathfinder::isNodeDestCity(const CSmallPoint& BestNode, + const vector& acceptableDestCities) +{ + for each (AStarHeap city in acceptableDestCities) { + if (city.data == BestNode) return true; + } + return false; +}//end isNodeDestCity + +float AStarPathfinder::CalcHTime(const CSmallPoint& start, const CSmallPoint& dest) +{ + int x = abs(start.x - dest.x); + int y = abs(start.y - dest.y); + int diagonal, straight; + if (x > y) { + diagonal = x; + straight = x - y; + } + else { + diagonal = y; + straight = y - x; + } + //this can be made more exact by incorporating the traversal time + //of the start half of the next square, * 1.42f to be sure + return ((diagonal * 1.42f + straight) * MAX_TRAVERSAL_TIME); +}//end CalcHTime + +float AStarPathfinder::CalcGCost(const CSmallPoint& start, const CSmallPoint& dest, const ePlayer player) +{ + return 0.0f; +}//end CalcGCost + +float AStarPathfinder::CalcGTime(const CSmallPoint& start, const CSmallPoint& dest) +{ + //traversal costs are half the cost of traversing the whole node + //we are going from midpoint to midpoint + float traversalTime = CWorldManager::GetTerrainType(start) + CWorldManager::GetTerrainType(dest); + if (abs(start.x - dest.x) + abs(start.y + dest.y) == 2) traversalTime *= 1.42f; + return (traversalTime); +}//end CalcGTime diff --git a/Tactical/AStarPathfinder.h b/Tactical/AStarPathfinder.h new file mode 100644 index 00000000..630de46c --- /dev/null +++ b/Tactical/AStarPathfinder.h @@ -0,0 +1,57 @@ + +#ifndef ASTAR_PATHFINDER_H +#define ASTAR_PATHFINDER_H +#include "stdafx.h" +#include "BinaryHeap.hpp" + +using namespace std; + +typedef HEAP AStarHeap; + +class AStarPathfinder +{ +public: + AStarPathfinder(); + vector ClosedList; + CBinaryHeap OpenHeap; + + AStarHeap AStar (const CSmallPoint& StartCity, + const vector& acceptableDestCities, + const ePlayer player, + const unsigned int maxNodes); + + void ExecuteAStarLogic(const CSmallPoint& StartCity, + const CSmallPoint& BestNode, + + + const vector& acceptableDestCities, + const ePlayer player); + + bool isNodeDestCity (const CSmallPoint& BestNode, + const vector& acceptableDestCities); + + void ResetAStarList (); + +private: + AStar_Data AStarData[MAX_SIZE_X][MAX_SIZE_Y]; + + float CalcGCost (const CSmallPoint& start, const CSmallPoint& dest, const ePlayer player); + float CalcGTime (const CSmallPoint& start, const CSmallPoint& dest); + float CalcHTime (const CSmallPoint& start, const CSmallPoint& dest); + + eAStar GetAStarStatus (const CSmallPoint& node) const {return AStarData[node.x][node.y].status;}; + CSmallPoint GetAStarParent (const CSmallPoint& node) const {return AStarData[node.x][node.y].parent;}; + CSmallPoint GetAStarCity (const CSmallPoint& node) const {return AStarData[node.x][node.y].city;}; + float GetAStarGCost (const CSmallPoint& node) const {return AStarData[node.x][node.y].cost;}; + float GetAStarGTime (const CSmallPoint& node) const {return AStarData[node.x][node.y].time;}; + float GetAStarF (const CSmallPoint& node) const {return AStarData[node.x][node.y].profit;}; + + void SetAStarStatus (const CSmallPoint& node, const eAStar status) {AStarData[node.x][node.y].status = status;}; + void SetAStarParent (const CSmallPoint& node, const CSmallPoint& parent) {AStarData[node.x][node.y].parent = parent;}; + void SetAStarCity (const CSmallPoint& node, const CSmallPoint& city) {AStarData[node.x][node.y].city = city;}; + void SetAStarGCost (const CSmallPoint& node, const float cost) {AStarData[node.x][node.y].cost = cost;}; + void SetAStarGTime (const CSmallPoint& node, const float time) {AStarData[node.x][node.y].time = time;}; + void SetAStarF (const CSmallPoint& node, const float profit) {AStarData[node.x][node.y].profit = profit;}; +}; + +#endif diff --git a/Tactical/Air Raid.cpp b/Tactical/Air Raid.cpp index 4c2c8df5..98d01717 100644 --- a/Tactical/Air Raid.cpp +++ b/Tactical/Air Raid.cpp @@ -13,7 +13,7 @@ #include "jascreens.h" #include "random.h" #include "overhead types.h" - #include "sound control.h" + #include "Sound Control.h" #include "timer control.h" #include "dialogue control.h" #include "overhead.h" @@ -44,11 +44,11 @@ #define MOVE_X 5 #define MOVE_Y 5 #define STRAFE_DIST 80 -#define BOMB_DIST 150 +#define BOMB_DIST 150 -// BEGIN SERALIZATION +// BEGIN SERALIZATION extern INT32 giTimerAirRaidQuote; extern INT32 giTimerAirRaidDiveStarted; extern INT32 giTimerAirRaidUpdate; @@ -119,7 +119,7 @@ typedef struct INT16 sX; INT16 sY; INT16 sGridNo; - + UINT8 ubFiller[ 32 ]; @@ -197,7 +197,7 @@ BOOLEAN BeginAirRaid( ) SOLDIERTYPE *pSoldier; gfQuoteSaid = FALSE; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,"BeginAirRaid"); - + // OK, we have been told to start..... // First remove scheduled flag... @@ -213,22 +213,22 @@ BOOLEAN BeginAirRaid( ) } // CHECK IF WE CURRENTLY HAVE THIS SECTOR OPEN.... - /*if ( gAirRaidDef.sSectorX == gWorldSectorX && - gAirRaidDef.sSectorY == gWorldSectorY && + /*if ( gAirRaidDef.sSectorX == gWorldSectorX && + gAirRaidDef.sSectorY == gWorldSectorY && gAirRaidDef.sSectorZ == gbWorldSectorZ ) */ // Do we have any guys in here... DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("BeginAirRaid: check for mercs: first id = %d, last id = %d ",gTacticalStatus.Team[ gbPlayerNum ].bFirstID, gTacticalStatus.Team[ gbPlayerNum ].bLastID)); - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; for ( cnt = 0, pSoldier = MercPtrs[ cnt ]; cnt < gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++) - { + { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("BeginAirRaid: soldier id = %d, active = %d",pSoldier->ubID,pSoldier->bActive)); - if ( pSoldier->bActive ) + if ( pSoldier->bActive ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("BeginAirRaid: soldier sectors: x = %d, y = %d, z = %d",pSoldier->sSectorX,pSoldier->sSectorY,pSoldier->bSectorZ )); DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("BeginAirRaid: air raid sectors: x = %d, y = %d, z = %d",gAirRaidDef.sSectorX,gAirRaidDef.sSectorY,gAirRaidDef.sSectorZ )); - if( pSoldier->sSectorX == gAirRaidDef.sSectorX && pSoldier->sSectorY == gAirRaidDef.sSectorY && pSoldier->bSectorZ == gAirRaidDef.sSectorZ && !pSoldier->fBetweenSectors && pSoldier->bLife && pSoldier->bAssignment != IN_TRANSIT ) + if( pSoldier->sSectorX == gAirRaidDef.sSectorX && pSoldier->sSectorY == gAirRaidDef.sSectorY && pSoldier->bSectorZ == gAirRaidDef.sSectorZ && !pSoldier->flags.fBetweenSectors && pSoldier->stats.bLife && pSoldier->bAssignment != IN_TRANSIT ) { fOK = TRUE; break; @@ -253,10 +253,10 @@ BOOLEAN BeginAirRaid( ) DebugMsg(TOPIC_JA2,DBG_LEVEL_3,"BeginAirRaid: change to the right sector"); ChangeSelectedMapSector( gAirRaidDef.sSectorX, gAirRaidDef.sSectorY, ( INT8 )gAirRaidDef.sSectorZ ); - gfQuoteSaid = FALSE; + gfQuoteSaid = FALSE; - if ( gAirRaidDef.sSectorX != gWorldSectorX || - gAirRaidDef.sSectorY != gWorldSectorY || + if ( gAirRaidDef.sSectorX != gWorldSectorX || + gAirRaidDef.sSectorY != gWorldSectorY || gAirRaidDef.sSectorZ != gbWorldSectorZ || guiCurrentScreen == MAP_SCREEN ) { // sector not loaded @@ -269,7 +269,7 @@ BOOLEAN BeginAirRaid( ) else { gubAirRaidMode = AIR_RAID_TRYING_TO_START; - gfQuoteSaid = FALSE; + gfQuoteSaid = FALSE; } ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Incoming Air Strike!" ); @@ -279,25 +279,23 @@ BOOLEAN BeginAirRaid( ) gfInAirRaid = TRUE; giNumFrames = 0; - + guiRaidLastUpdate = GetJA2Clock( ); - + gbNumDives = 0; gfAirRaidHasHadTurn = FALSE; gpRaidSoldier = MercPtrs[ MAX_NUM_SOLDIERS - 1 ]; - // WDS - Clean up inventory handling - //memset( gpRaidSoldier, 0, SIZEOF_SOLDIERTYPE ); gpRaidSoldier->initialize(); - gpRaidSoldier->bLevel = 0; + gpRaidSoldier->pathing.bLevel = 0; gpRaidSoldier->bTeam = 1; gpRaidSoldier->bSide = 1; - gpRaidSoldier->ubID = MAX_NUM_SOLDIERS - 1; + gpRaidSoldier->ubID = MAX_NUM_SOLDIERS - 1; gpRaidSoldier->ubAttackerID = NOBODY; gpRaidSoldier->usAttackingWeapon = HK21E; - gpRaidSoldier->inv[HANDPOS].usItem = HK21E; + CreateItem(HK21E, 100, &gpRaidSoldier->inv[HANDPOS]); // Determine how many dives this one will be.... gbMaxDives = (INT8)( gAirRaidDef.bIntensity + Random( gAirRaidDef.bIntensity - 1 ) ); @@ -322,7 +320,7 @@ INT16 PickLocationNearAnyMercInSector( ) DebugMsg(TOPIC_JA2,DBG_LEVEL_3,"PickLocationNearAnyMercInSector"); // set up soldier ptr as first element in mercptrs list - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("PickLocationNearAnyMercInSector: total guys = %d", gTacticalStatus.Team[ gbPlayerNum ].bLastID)); @@ -344,7 +342,7 @@ INT16 PickLocationNearAnyMercInSector( ) ubChosenMerc = (UINT8)Random( ubNumMercs ); DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("PickLocationNearAnyMercInSector: chosen guy = %d",ubChosenMerc)); - return( MercPtrs[ ubMercsInSector[ ubChosenMerc ] ]->sGridNo ); + return( MercPtrs[ ubMercsInSector[ ubChosenMerc ] ]->sGridNo ); } DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("PickLocationNearAnyMercInSector: no target")); @@ -710,7 +708,7 @@ void MoveDiveAirplane( FLOAT dAngle ) } -void DoDive( ) +void DoDive( ) { INT16 sRange; INT16 sGridNo, sOldGridNo; @@ -779,20 +777,20 @@ void DoDive( ) DebugMsg(TOPIC_JA2,DBG_LEVEL_3,"DoDive: move plane"); MoveDiveAirplane( dAngle ); - gpRaidSoldier->dXPos = gsDiveX; - gpRaidSoldier->sX = gsDiveX; - gpRaidSoldier->dYPos = gsDiveY; - gpRaidSoldier->sY = gsDiveY; + gpRaidSoldier->dXPos = gsDiveX; + gpRaidSoldier->sX = gsDiveX; + gpRaidSoldier->dYPos = gsDiveY; + gpRaidSoldier->sY = gsDiveY; // Figure gridno.... sGridNo = GETWORLDINDEXFROMWORLDCOORDS( gsDiveY, gsDiveX ); gpRaidSoldier->sGridNo = sGridNo; - + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DoDive: figure out grid number, sgridno = %d, soldgridno = %d", sGridNo, sOldGridNo)); if ( sOldGridNo != sGridNo ) { gsNumGridNosMoved++; - + giNumGridNosMovedThisTurn++; // OK, shoot bullets.... @@ -841,10 +839,10 @@ void DoDive( ) sX = (INT16)( gsDiveX + ( (FLOAT)sin( dAngle + ( PI/2) ) * 40 ) ); sY = (INT16)( gsDiveY + ( (FLOAT)cos( dAngle + ( PI/2) ) * 40 ) ); - gpRaidSoldier->dXPos = sX; - gpRaidSoldier->sX = sX; - gpRaidSoldier->dYPos = sY; - gpRaidSoldier->sY = sY; + gpRaidSoldier->dXPos = sX; + gpRaidSoldier->sX = sX; + gpRaidSoldier->dYPos = sY; + gpRaidSoldier->sY = sY; gpRaidSoldier->sGridNo = GETWORLDINDEXFROMWORLDCOORDS( sY, sX ); // Get target..... @@ -887,7 +885,7 @@ void DoDive( ) } -void DoBombing( ) +void DoBombing( ) { INT16 sRange; INT16 sGridNo, sOldGridNo, sBombGridNo; @@ -951,15 +949,15 @@ void DoBombing( ) MoveDiveAirplane( dAngle ); - gpRaidSoldier->dXPos = gsDiveX; - gpRaidSoldier->sX = gsDiveX; - gpRaidSoldier->dYPos = gsDiveY; - gpRaidSoldier->sY = gsDiveY; + gpRaidSoldier->dXPos = gsDiveX; + gpRaidSoldier->sX = gsDiveX; + gpRaidSoldier->dYPos = gsDiveY; + gpRaidSoldier->sY = gsDiveY; // Figure gridno.... sGridNo = GETWORLDINDEXFROMWORLDCOORDS( gsDiveY, gsDiveX ); gpRaidSoldier->sGridNo = sGridNo; - + if ( sOldGridNo != sGridNo ) { // Every once and a while, drop bomb.... @@ -1035,7 +1033,7 @@ void HandleAirRaid( ) INT32 iVol; UINT32 uiClock; - // OK, + // OK, if ( gfInAirRaid ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleAirRaid: air raid mode = %d, quote said = %d",gubAirRaidMode,gfQuoteSaid)); @@ -1047,7 +1045,7 @@ void HandleAirRaid( ) // Are we in TB? if ( ( gTacticalStatus.uiFlags & INCOMBAT ) ) - { + { // Do we have the batton? if ( !gfHaveTBBatton ) { @@ -1067,15 +1065,15 @@ void HandleAirRaid( ) DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleAirRaid: check for mercs: first id = %d, last id = %d ",gTacticalStatus.Team[ gbPlayerNum ].bFirstID, gTacticalStatus.Team[ gbPlayerNum ].bLastID)); SOLDIERTYPE * pSoldier; BOOLEAN fOK = FALSE; - int cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + int cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; for ( cnt = 0, pSoldier = MercPtrs[ cnt ]; cnt < gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++) - { + { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleAirRaid: soldier id = %d, active = %d",pSoldier->ubID,pSoldier->bActive)); - if ( pSoldier->bActive ) + if ( pSoldier->bActive ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleAirRaid: soldier sectors: x = %d, y = %d, z = %d",pSoldier->sSectorX,pSoldier->sSectorY,pSoldier->bSectorZ )); DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleAirRaid: air raid sectors: x = %d, y = %d, z = %d",gAirRaidDef.sSectorX,gAirRaidDef.sSectorY,gAirRaidDef.sSectorZ )); - if( pSoldier->sSectorX == gAirRaidDef.sSectorX && pSoldier->sSectorY == gAirRaidDef.sSectorY && pSoldier->bSectorZ == gAirRaidDef.sSectorZ && !pSoldier->fBetweenSectors && pSoldier->bLife && pSoldier->bAssignment != IN_TRANSIT ) + if( pSoldier->sSectorX == gAirRaidDef.sSectorX && pSoldier->sSectorY == gAirRaidDef.sSectorY && pSoldier->bSectorZ == gAirRaidDef.sSectorZ && !pSoldier->flags.fBetweenSectors && pSoldier->stats.bLife && pSoldier->bAssignment != IN_TRANSIT ) { fOK = TRUE; break; @@ -1092,7 +1090,7 @@ void HandleAirRaid( ) uiClock = GetJA2Clock( ); - if ( ( uiClock - guiRaidLastUpdate ) > SCRIPT_DELAY ) + if ( ( uiClock - guiRaidLastUpdate ) > SCRIPT_DELAY ) { giNumFrames++; @@ -1160,17 +1158,17 @@ void HandleAirRaid( ) break; case AIR_RAID_START_END: - + AirRaidStartEnding( ); break; case AIR_RAID_END: - + EndAirRaid( ); break; case AIR_RAID_BEGIN_DIVE: - + BeginDive( ); break; @@ -1191,7 +1189,7 @@ void HandleAirRaid( ) break; case AIR_RAID_END_DIVE: - + giNumTurnsSinceLastDive = 0; RESETTIMECOUNTER( giTimerAirRaidDiveStarted, AIR_RAID_DIVE_INTERVAL ); @@ -1202,11 +1200,11 @@ void HandleAirRaid( ) DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("!!!!!!! Tried to free up attacker AIR RAID ENDING DIVE, attack count now %d", gTacticalStatus.ubAttackBusyCount) ); } - gubAirRaidMode = AIR_RAID_LOOK_FOR_DIVE; + gubAirRaidMode = AIR_RAID_LOOK_FOR_DIVE; break; case AIR_RAID_END_BOMBING: - + RESETTIMECOUNTER( giTimerAirRaidDiveStarted, AIR_RAID_DIVE_INTERVAL ); giNumTurnsSinceLastDive = 0; @@ -1217,7 +1215,7 @@ void HandleAirRaid( ) DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("!!!!!!! Tried to free up attacker AIR RAID ENDING DIVE, attack count now %d", gTacticalStatus.ubAttackBusyCount) ); } - gubAirRaidMode = AIR_RAID_LOOK_FOR_DIVE; + gubAirRaidMode = AIR_RAID_LOOK_FOR_DIVE; break; case AIR_RAID_BEGIN_BOMBING: @@ -1231,7 +1229,7 @@ void HandleAirRaid( ) } if ( ( gTacticalStatus.uiFlags & INCOMBAT ) ) - { + { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleAirRaid: in combat")); // Do we have the batton? if ( gfHaveTBBatton ) @@ -1344,7 +1342,7 @@ BOOLEAN SaveAirRaidInfoToSaveGameFile( HWFILE hFile ) // if( gpRaidSoldier ) // { -// sAirRaidSaveStruct.bLevel = gpRaidSoldier->bLevel; +// sAirRaidSaveStruct.bLevel = gpRaidSoldier->pathing.bLevel; // sAirRaidSaveStruct.bTeam = gpRaidSoldier->bTeam; // sAirRaidSaveStruct.bSide = gpRaidSoldier->bSide; // sAirRaidSaveStruct.ubAttackerID = gpRaidSoldier->ubAttackerID; @@ -1421,7 +1419,7 @@ BOOLEAN LoadAirRaidInfoFromSaveGameFile( HWFILE hFile ) { gpRaidSoldier = &Menptr[ sAirRaidSaveStruct.sRaidSoldierID ]; - gpRaidSoldier->bLevel = sAirRaidSaveStruct.bLevel; + gpRaidSoldier->pathing.bLevel = sAirRaidSaveStruct.bLevel; gpRaidSoldier->bTeam = sAirRaidSaveStruct.bTeam; gpRaidSoldier->bSide = sAirRaidSaveStruct.bSide; gpRaidSoldier->ubAttackerID = sAirRaidSaveStruct.ubAttackerID; @@ -1465,7 +1463,7 @@ void EndAirRaid( ) { if ( pTeamSoldier->bActive && pTeamSoldier->bInSector ) { - pTeamSoldier->bAlertStatus = STATUS_GREEN; + pTeamSoldier->aiData.bAlertStatus = STATUS_GREEN; } } gTacticalStatus.Team[ MILITIA_TEAM ].bAwareOfOpposition = FALSE; @@ -1476,14 +1474,14 @@ void EndAirRaid( ) { if ( pTeamSoldier->bActive && pTeamSoldier->bInSector ) { - pTeamSoldier->bAlertStatus = STATUS_GREEN; + pTeamSoldier->aiData.bAlertStatus = STATUS_GREEN; } } gTacticalStatus.Team[ CIV_TEAM ].bAwareOfOpposition = FALSE; } } - + // OK, look at flags... if ( gAirRaidDef.uiFlags & AIR_RAID_BEGINNING_GAME ) { // OK, make enemy appear in Omerta @@ -1493,13 +1491,13 @@ void EndAirRaid( ) //pGroup = CreateNewEnemyGroupDepartingFromSector( SEC_B9, (UINT8)(2 + Random( 2 ) + gGameOptions.ubDifficultyLevel), 0 ); //Move the patrol group north to attack Omerta //AddWaypointToPGroup( pGroup, 9, 1 ); //A9 - //Because we want them to arrive right away, we will toast the arrival event. The information + //Because we want them to arrive right away, we will toast the arrival event. The information //is already set up though. //DeleteStrategicEvent( EVENT_GROUP_ARRIVAL, pGroup->ubGroupID ); //Simply reinsert the event, but the time is now. //AddStrategicEvent( EVENT_GROUP_ARRIVAL, GetWorldTotalMin(), pGroup->ubGroupID ); } - + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Ending Air Raid." ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"The skies have cleared..." ); UnLockPauseState(); @@ -1536,7 +1534,7 @@ void CheckForAndSetupAirRaid () //} //for ( sSectorY = 0;sSectorY < MAP_WORLD_Y;sSectorY++ ) - //{ + //{ // for ( sSectorX = 0;sSectorX < MAP_WORLD_X;sSectorX++ ) // { // pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ]; diff --git a/Tactical/Animation Cache.cpp b/Tactical/Animation Cache.cpp index fd403343..9635efa1 100644 --- a/Tactical/Animation Cache.cpp +++ b/Tactical/Animation Cache.cpp @@ -73,7 +73,7 @@ BOOLEAN GetCachedAnimationSurface( UINT16 usSoldierID, AnimationSurfaceCacheType { UINT8 cnt; UINT8 ubLowestIndex = 0; - INT16 sMostHits = (INT16)32000; + INT16 sMostHits = (INT16)32000; UINT16 usCurrentAnimSurface; // Check to see if surface exists already @@ -81,10 +81,10 @@ BOOLEAN GetCachedAnimationSurface( UINT16 usSoldierID, AnimationSurfaceCacheType { if ( pAnimCache->usCachedSurfaces[ cnt ] == usSurfaceIndex ) { - // Found surface, return - AnimDebugMsg( String( "Anim Cache: Hit %d ( Soldier %d )", usSurfaceIndex, usSoldierID ) ); - pAnimCache->sCacheHits[cnt]++; - return( TRUE ); + // Found surface, return + AnimDebugMsg( String( "Anim Cache: Hit %d ( Soldier %d )", usSurfaceIndex, usSoldierID ) ); + pAnimCache->sCacheHits[cnt]++; + return( TRUE ); } } @@ -101,20 +101,20 @@ BOOLEAN GetCachedAnimationSurface( UINT16 usSoldierID, AnimationSurfaceCacheType // Loop through and pick one with lowest cache hits for ( cnt = 0; cnt < pAnimCache->ubCacheSize; cnt++ ) { - AnimDebugMsg( String( "Anim Cache: Slot %d Hits %d ( Soldier %d )", cnt, pAnimCache->sCacheHits[ cnt ], usSoldierID ) ); + AnimDebugMsg( String( "Anim Cache: Slot %d Hits %d ( Soldier %d )", cnt, pAnimCache->sCacheHits[ cnt ], usSoldierID ) ); - if ( pAnimCache->usCachedSurfaces[ cnt ] == usCurrentAnimSurface ) - { + if ( pAnimCache->usCachedSurfaces[ cnt ] == usCurrentAnimSurface ) + { AnimDebugMsg( String( "Anim Cache: REJECTING Slot %d EXISTING ANIM SURFACE ( Soldier %d )", cnt, usSoldierID ) ); - } - else - { - if ( pAnimCache->sCacheHits[ cnt ] < sMostHits ) - { + } + else + { + if ( pAnimCache->sCacheHits[ cnt ] < sMostHits ) + { sMostHits = pAnimCache->sCacheHits[ cnt ]; ubLowestIndex = cnt; - } - } + } + } } // Bump off lowest index diff --git a/Tactical/Animation Control.cpp b/Tactical/Animation Control.cpp index ee527d8f..2c24e3fa 100644 --- a/Tactical/Animation Control.cpp +++ b/Tactical/Animation Control.cpp @@ -50,910 +50,910 @@ RANDOM_ANI_DEF gRandomAnimDefs[ TOTALBODYTYPES ][ MAX_RANDOM_ANIMS_PER_BODYTYPE ANIMCONTROLTYPE gAnimControl[ NUMANIMATIONSTATES ] = { - //NAME //AP //SPEED // MOVE // FLAGS // HEIGHT + //NAME //AP //SPEED // MOVE // FLAGS // HEIGHT //WALKING - {"WALKING" , 20, 0, (FLOAT)1.6, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_VARIABLE_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"WALKING" , 20, 0, (FLOAT)1.6, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_VARIABLE_EFFORT, ANIM_STAND, ANIM_STAND, -1}, //Breathing - {"STANDING" , 0, 0, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_VARIABLE_EFFORT | ANIM_BREATH, ANIM_STAND, ANIM_STAND, -1}, + {"STANDING" , 0, 0, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_VARIABLE_EFFORT | ANIM_BREATH, ANIM_STAND, ANIM_STAND, -1}, //KNEEL DOWN - {"KNEEL DOWN" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NOMOVE_MARKER | ANIM_STANCECHANGEANIM | ANIM_NOCHANGE_WEAPON | ANIM_MIN_EFFORT, ANIM_STAND, ANIM_CROUCH, -1}, + {"KNEEL DOWN" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NOMOVE_MARKER | ANIM_STANCECHANGEANIM | ANIM_NOCHANGE_WEAPON | ANIM_MIN_EFFORT, ANIM_STAND, ANIM_CROUCH, -1}, //CROUCHING - {"CROUCHED" , 0, 0, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_RAISE_WEAPON | ANIM_NO_EFFORT | ANIM_BREATH, ANIM_CROUCH, ANIM_CROUCH, -1}, + {"CROUCHED" , 0, 0, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_RAISE_WEAPON | ANIM_NO_EFFORT | ANIM_BREATH, ANIM_CROUCH, ANIM_CROUCH, -1}, //KNEEL UP - {"KNEEL UP" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NOMOVE_MARKER | ANIM_STANCECHANGEANIM | ANIM_NOCHANGE_WEAPON | ANIM_MIN_EFFORT, ANIM_CROUCH, ANIM_STAND, -1}, + {"KNEEL UP" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NOMOVE_MARKER | ANIM_STANCECHANGEANIM | ANIM_NOCHANGE_WEAPON | ANIM_MIN_EFFORT, ANIM_CROUCH, ANIM_STAND, -1}, //SWAT - {"SWAT" , 0, 0, (FLOAT)2.2, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1}, + {"SWAT" , 0, 0, (FLOAT)2.2, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1}, //RUN - {"RUN" , 0, 0, (FLOAT)2.6, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_MODERATE_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"RUN" , 0, 0, (FLOAT)2.6, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_MODERATE_EFFORT, ANIM_STAND, ANIM_STAND, -1}, //PRONE DOWN - {"PRONE DOWN" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_NOMOVE_MARKER | ANIM_STANCECHANGEANIM | ANIM_NOCHANGE_WEAPON | ANIM_MIN_EFFORT, ANIM_CROUCH, ANIM_PRONE, -1}, + {"PRONE DOWN" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_NOMOVE_MARKER | ANIM_STANCECHANGEANIM | ANIM_NOCHANGE_WEAPON | ANIM_MIN_EFFORT, ANIM_CROUCH, ANIM_PRONE, -1}, //CRAWL - {"CRAWL" , 0, 0, (FLOAT).8, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_MODERATE_EFFORT, ANIM_PRONE, ANIM_PRONE, -1}, + {"CRAWL" , 0, 0, (FLOAT).8, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_MODERATE_EFFORT, ANIM_PRONE, ANIM_PRONE, -1}, //PRONE UP - {"PRONE UP" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_NOMOVE_MARKER | ANIM_STANCECHANGEANIM | ANIM_NOCHANGE_WEAPON | ANIM_MIN_EFFORT, ANIM_PRONE, ANIM_CROUCH, -1}, + {"PRONE UP" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_NOMOVE_MARKER | ANIM_STANCECHANGEANIM | ANIM_NOCHANGE_WEAPON | ANIM_MIN_EFFORT, ANIM_PRONE, ANIM_CROUCH, -1}, //PRONE BREATHING - {"PRONE" , 0, 0, (FLOAT)0, ANIM_STATIONARY | ANIM_FASTTURN | ANIM_RAISE_WEAPON | ANIM_NO_EFFORT | ANIM_BREATH, ANIM_PRONE, ANIM_PRONE, -1}, + {"PRONE" , 0, 0, (FLOAT)0, ANIM_STATIONARY | ANIM_FASTTURN | ANIM_RAISE_WEAPON | ANIM_NO_EFFORT | ANIM_BREATH, ANIM_PRONE, ANIM_PRONE, -1}, // READY_RIFLE_STAND - {"READY AIM (R) STAND" , 0, 0, (FLOAT)0, ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_RAISE_WEAPON | ANIM_MIN_EFFORT , ANIM_STAND, ANIM_STAND, -1}, + {"READY AIM (R) STAND" , 0, 0, (FLOAT)0, ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_RAISE_WEAPON | ANIM_MIN_EFFORT , ANIM_STAND, ANIM_STAND, -1}, // AIM_RIFLE_STAND - {"AIM (R) STAND" , 0, 250, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FIREREADY | ANIM_FASTTURN | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"AIM (R) STAND" , 0, 250, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FIREREADY | ANIM_FASTTURN | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1}, // SHOOT_RIFLE_STAND - {"SHOOT (R) STAND" , 0, 100, (FLOAT)0, ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_RT_NONINTERRUPT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, + {"SHOOT (R) STAND" , 0, 100, (FLOAT)0, ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_RT_NONINTERRUPT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, // END_RIFLE_STAND - {"END RIFLE STAND" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_NOCHANGE_PENDINGCOUNT | ANIM_MIN_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"END RIFLE STAND" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_NOCHANGE_PENDINGCOUNT | ANIM_MIN_EFFORT, ANIM_STAND, ANIM_STAND, -1}, // FROM CROUCH TO SWAT - {"CROUCH TO SWAT" , 0, 40, (FLOAT)1.3, ANIM_MOVING | ANIM_TURNING | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1}, + {"CROUCH TO SWAT" , 0, 40, (FLOAT)1.3, ANIM_MOVING | ANIM_TURNING | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1}, // FROM SWAT TO CROUCH - {"SWAT TO CROUCH" , 0, 40, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1}, + {"SWAT TO CROUCH" , 0, 40, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1}, // FLYBACK HIT ANIMATION - {"FLYBACK HIT" , 0, 80, (FLOAT)1.6, ANIM_SPECIALMOVE | ANIM_HITSTART | ANIM_HITFINISH | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_IGNORE_AUTOSTANCE | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1}, + {"FLYBACK HIT" , 0, 80, (FLOAT)1.6, ANIM_SPECIALMOVE | ANIM_HITSTART | ANIM_HITFINISH | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_IGNORE_AUTOSTANCE | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1}, // READY_RIFLE_PRONE - {"READY (R) PRONE" , 0, 150, (FLOAT)0, ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING| ANIM_RAISE_WEAPON | ANIM_MIN_EFFORT, ANIM_PRONE, ANIM_PRONE, -1}, + {"READY (R) PRONE" , 0, 150, (FLOAT)0, ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING| ANIM_RAISE_WEAPON | ANIM_MIN_EFFORT, ANIM_PRONE, ANIM_PRONE, -1}, // AIM_RIFLE_PRONE - {"AIM (R) PRONE" , 0, 250, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FIREREADY | ANIM_FASTTURN| ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT, ANIM_PRONE, ANIM_PRONE, -1}, + {"AIM (R) PRONE" , 0, 250, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FIREREADY | ANIM_FASTTURN| ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT, ANIM_PRONE, ANIM_PRONE, -1}, // SHOOT_RIFLE_PRONE - {"SHOOT (R) PRONE" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_RT_NONINTERRUPT | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"SHOOT (R) PRONE" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_RT_NONINTERRUPT | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, // END_RIFLE_PRONE - {"END (R) AIM PRONE" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_NOCHANGE_PENDINGCOUNT | ANIM_MIN_EFFORT, ANIM_PRONE, ANIM_PRONE, -1}, + {"END (R) AIM PRONE" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_NOCHANGE_PENDINGCOUNT | ANIM_MIN_EFFORT, ANIM_PRONE, ANIM_PRONE, -1}, // DEATH TWITCH ONE - {"DEATH TWITCH ONE" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"DEATH TWITCH ONE" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, // GENERIC_HIT STANDING - {"GENERIC HIT STAND" , 0, 130, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTART | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_IGNORE_AUTOSTANCE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, + {"GENERIC HIT STAND" , 0, 130, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTART | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_IGNORE_AUTOSTANCE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, // FLYBACK HIT ANIMATION W/ BLOOD - {"FLYBACK HIT w/B" , 0, 80, (FLOAT)1.6, ANIM_SPECIALMOVE | ANIM_HITSTART | ANIM_HITFINISH | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_IGNORE_AUTOSTANCE | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"FLYBACK HIT w/B" , 0, 80, (FLOAT)1.6, ANIM_SPECIALMOVE | ANIM_HITSTART | ANIM_HITFINISH | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_IGNORE_AUTOSTANCE | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, // FLYBACK HIT DEATH - {"FLYBACK HIT DEATH" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"FLYBACK HIT DEATH" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, // READY_RIFLE_CROUCH - {"READY (R) CROUCH" , 0, 150, (FLOAT)0, ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_MIN_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1}, + {"READY (R) CROUCH" , 0, 150, (FLOAT)0, ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_MIN_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1}, // AIM_RIFLE_CROUCH - {"AIM (R) CROUCH" , 0, 250, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FIREREADY | ANIM_FASTTURN | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1}, + {"AIM (R) CROUCH" , 0, 250, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FIREREADY | ANIM_FASTTURN | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1}, // SHOOT_RIFLE_CROUCH - {"SHOOT (R) CROUCH" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_RT_NONINTERRUPT | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1}, + {"SHOOT (R) CROUCH" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_RT_NONINTERRUPT | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1}, // END_RIFLE_CROUCH - {"END (R) CROUCH" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_NOCHANGE_PENDINGCOUNT | ANIM_MIN_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1}, + {"END (R) CROUCH" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_NOCHANGE_PENDINGCOUNT | ANIM_MIN_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1}, // FALLBACK HIT STANDING - {"FALLBACK HIT STAND" , 0, 130, (FLOAT)1.6, ANIM_SPECIALMOVE | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_IGNORE_AUTOSTANCE | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1}, + {"FALLBACK HIT STAND" , 0, 130, (FLOAT)1.6, ANIM_SPECIALMOVE | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_IGNORE_AUTOSTANCE | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1}, // ROLLOVER - {"ROOLOVER" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, + {"ROOLOVER" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, // CLIMBROOF - {"CLIMBROOF" , 0, 30, (FLOAT)0, ANIM_NONINTERRUPT | ANIM_NORESTART | ANIM_STATIONARY | ANIM_NOSHOW_MARKER | ANIM_MODERATE_EFFORT | ANIM_LOWER_WEAPON, ANIM_STAND, ANIM_CROUCH, -1}, + {"CLIMBROOF" , 0, 30, (FLOAT)0, ANIM_NONINTERRUPT | ANIM_NORESTART | ANIM_STATIONARY | ANIM_NOSHOW_MARKER | ANIM_MODERATE_EFFORT | ANIM_LOWER_WEAPON, ANIM_STAND, ANIM_CROUCH, -1}, // FALL - {"FALL" , 0, 60, (FLOAT)0, ANIM_NONINTERRUPT | ANIM_STATIONARY | ANIM_HITFINISH | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_IGNORE_AUTOSTANCE | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1}, + {"FALL" , 0, 60, (FLOAT)0, ANIM_NONINTERRUPT | ANIM_STATIONARY | ANIM_HITFINISH | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_IGNORE_AUTOSTANCE | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1}, //GETUP FROM ROLLOVER - {"GETUP FROM ROLLOVER" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_STAND, -1}, + {"GETUP FROM ROLLOVER" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_STAND, -1}, //CLIMBDOWNROOF - {"CLIMBDOWNROOF" , 0, 30, (FLOAT)0, ANIM_NONINTERRUPT | ANIM_NORESTART | ANIM_STATIONARY | ANIM_NOSHOW_MARKER | ANIM_MODERATE_EFFORT | ANIM_LOWER_WEAPON, ANIM_CROUCH, ANIM_STAND, -1}, + {"CLIMBDOWNROOF" , 0, 30, (FLOAT)0, ANIM_NONINTERRUPT | ANIM_NORESTART | ANIM_STATIONARY | ANIM_NOSHOW_MARKER | ANIM_MODERATE_EFFORT | ANIM_LOWER_WEAPON, ANIM_CROUCH, ANIM_STAND, -1}, // FALL FORWARD - {"FALL FORWARD ROOF" , 0, 60, (FLOAT)0, ANIM_NONINTERRUPT | ANIM_STATIONARY | ANIM_HITFINISH | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_IGNORE_AUTOSTANCE | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1}, + {"FALL FORWARD ROOF" , 0, 60, (FLOAT)0, ANIM_NONINTERRUPT | ANIM_STATIONARY | ANIM_HITFINISH | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_IGNORE_AUTOSTANCE | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1}, // GENERIC HIT DEATHTWICH NO BLOOD - {"BELLY DEATHHIT NB" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_HITWHENDOWN | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"BELLY DEATHHIT NB" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_HITWHENDOWN | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, // GENERIC HIT DEATHTWICH BLOOD - {"BELLY DEATHHIT B" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_HITWHENDOWN | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"BELLY DEATHHIT B" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_HITWHENDOWN | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, // FALLBACK HIT DEATHTWICH NO BLOOD - {"FALLBACK DEATHHIT NB", 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_HITWHENDOWN | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"FALLBACK DEATHHIT NB", 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_HITWHENDOWN | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, // FALLBACK HIT DEATHTWICH BLOOD - {"FALLBACK DEATHHIT B" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_HITWHENDOWN | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"FALLBACK DEATHHIT B" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_HITWHENDOWN | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, // GENERIC HIT DEATH - {"BELLY HIT DEATH" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"BELLY HIT DEATH" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, // FALLBACK HIT DEATH - {"FALLBACK HIT DEATH" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"FALLBACK HIT DEATH" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, // GENERIC HIT CROUCHED - {"GENERIC HIT CROUCH" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1}, + {"GENERIC HIT CROUCH" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1}, // STAND BURST // Lesh: AniDelay, speed=0 for control it - {"STAND BURST SHOOT" , 0, 0, (FLOAT)0, ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_FIRE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, + {"STAND BURST SHOOT" , 0, 0, (FLOAT)0, ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_FIRE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, // STANDING BURST HIT - {"STAND BUTST HIT" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_IGNORE_AUTOSTANCE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, + {"STAND BUTST HIT" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_IGNORE_AUTOSTANCE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, // FALL FORWARD FROM HIT STAND - {"FALL FROM STAND" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1}, + {"FALL FROM STAND" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1}, // FALL FORWARD FROM HIT CROUCH - {"FALL FROM CROUCH" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_CROUCH, ANIM_PRONE, -1}, + {"FALL FROM CROUCH" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_CROUCH, ANIM_PRONE, -1}, // END FALL FORWARD FROM HIT CROUCH - {"END FALL F CROUCH" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"END FALL F CROUCH" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, // GENERIC HIT PRONE - {"GENERIC HIT PRONE" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"GENERIC HIT PRONE" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, // PRONE HIT DEATH - {"PRONE HIT DEATH" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"PRONE HIT DEATH" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, // PRONE LAY FROM HIT - {"PRONE LAY FROM HIT" , 0, 160, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"PRONE LAY FROM HIT" , 0, 160, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, // PRONE HIT DEATHTWICH NO BLOOD - {"PRONE DEATHHIT NB", 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_HITWHENDOWN | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"PRONE DEATHHIT NB", 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_HITWHENDOWN | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, // PRONE HIT DEATHTWICH BLOOD - {"PRONE DEATHHIT B" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_HITWHENDOWN | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"PRONE DEATHHIT B" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_HITWHENDOWN | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, // FEMALE MONSTER BREATHING - {"FEMADMON BREATHING", 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1}, + {"FEMADMON BREATHING", 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1}, // FEMALE MONSTER BREATHING - {"FEMADMON WALKING", 0 , 30, (FLOAT)2.5, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1}, + {"FEMADMON WALKING", 0 , 30, (FLOAT)2.5, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1}, // FEMALE MONSTER ATTACK - {"FEMADMON ATTACK", 0 , 70, (FLOAT)2.5, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, + {"FEMADMON ATTACK", 0 , 70, (FLOAT)2.5, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, - {"FLYBACK HIT DEATH STOP" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, + {"FLYBACK HIT DEATH STOP" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, - {"BELLY HIT DEATH STOP" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, + {"BELLY HIT DEATH STOP" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, - {"FALLBACK HIT DEATH STOP" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, + {"FALLBACK HIT DEATH STOP" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, - {"PRONE HIT DEATH STOP" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, + {"PRONE HIT DEATH STOP" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, - {"FLYBACK HIT STOP" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, + {"FLYBACK HIT STOP" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, - {"FALLBACK HIT STOP" , 0, 350, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, + {"FALLBACK HIT STOP" , 0, 350, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, - {"FALLOFF STOP" , 0, 350, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, + {"FALLOFF STOP" , 0, 350, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, - {"FALLOFF FORWARD HIT STOP", 0, 350, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, + {"FALLOFF FORWARD HIT STOP", 0, 350, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, - {"FALLFORWARD HIT STOP", 0, 650, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, + {"FALLFORWARD HIT STOP", 0, 650, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, - {"PRONE_LAYFROMHIT STOP" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, + {"PRONE_LAYFROMHIT STOP" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, - {"HOP FENCE" , 0, 50, (FLOAT)0, ANIM_NOCHANGE_PENDINGCOUNT | ANIM_NORESTART | ANIM_STATIONARY | ANIM_NOSHOW_MARKER | ANIM_MODERATE_EFFORT | ANIM_LOWER_WEAPON | ANIM_NONINTERRUPT, ANIM_STAND, ANIM_CROUCH, -1}, + {"HOP FENCE" , 0, 50, (FLOAT)0, ANIM_NOCHANGE_PENDINGCOUNT | ANIM_NORESTART | ANIM_STATIONARY | ANIM_NOSHOW_MARKER | ANIM_MODERATE_EFFORT | ANIM_LOWER_WEAPON | ANIM_NONINTERRUPT, ANIM_STAND, ANIM_CROUCH, -1}, // GENERIC HIT CROUCHED - {"FEMMONS HIT" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, + {"FEMMONS HIT" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, // FALL FORWARD FROM HIT STAND - {"FEMMONS DIE" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1}, + {"FEMMONS DIE" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1}, // FALL FORWARD FROM HIT STAND - {"FEMMONS DIE STOP" , 0, 350, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, + {"FEMMONS DIE STOP" , 0, 350, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, //Breathing - {"PUNCH BREATH" , 0, 150, (FLOAT)0, ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1}, + {"PUNCH BREATH" , 0, 150, (FLOAT)0, ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1}, // Punch - {"PUNCH" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NORESTART | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, + {"PUNCH" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NORESTART | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, //Breathing - {"NOTHING_STAND" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1}, + {"NOTHING_STAND" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1}, // JFK HIT DEATH - {"JFK HIT DEATH" , 0, 160, (FLOAT)0, ANIM_STATIONARY | ANIM_NONINTERRUPT | ANIM_HITSTART | ANIM_HITFINISH | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1}, + {"JFK HIT DEATH" , 0, 160, (FLOAT)0, ANIM_STATIONARY | ANIM_NONINTERRUPT | ANIM_HITSTART | ANIM_HITFINISH | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1}, - {"JFK HIT DEATH STOP" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, + {"JFK HIT DEATH STOP" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, - {"JFK DEATHHIT B" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_HITWHENDOWN | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"JFK DEATHHIT B" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_HITWHENDOWN | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, // STAND BURST // Lesh: AniDelay, speed=0 for control it - {"STAND BURST SPREAD" , 0, 0, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_LIGHT_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, + {"STAND BURST SPREAD" , 0, 0, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_LIGHT_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, // FALLOFF DEATH - {"FALLOFF DEATH" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"FALLOFF DEATH" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, // FALLOFF DEATH STOP - {"FALLOFF DEATH STOP" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, + {"FALLOFF DEATH STOP" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, // FALLOFF TWITCHB - {"FALLOFF TWITCH BLOOD" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_HITWHENDOWN | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"FALLOFF TWITCH BLOOD" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_HITWHENDOWN | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, // FALLOFF TWITCH NB - {"FALLOFF TWITCH NOBLOOD" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_HITWHENDOWN | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"FALLOFF TWITCH NOBLOOD" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_HITWHENDOWN | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, // FALLOFF FORWARD DEATH - {"FALLOFF FORWARD DEATH" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"FALLOFF FORWARD DEATH" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, // FALLOFF FORWARD DEATH STOP - {"FALLOFF FORWARD DEATH STOP" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, + {"FALLOFF FORWARD DEATH STOP" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, // FALLOFF FORWARD TWITCHB - {"FALLOFF FORWARD TWITCH BLOOD" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_HITWHENDOWN | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"FALLOFF FORWARD TWITCH BLOOD" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_HITWHENDOWN | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, // FALLOFF TWITCH NB - {"FALLOFF FORWARD TWITCH NOBLOOD" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_HITWHENDOWN | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"FALLOFF FORWARD TWITCH NOBLOOD" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_HITWHENDOWN | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, //OPEN DOOR - {"OPEN DOOR" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"OPEN DOOR" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1}, //OPEN STRUCT - {"OPEN STRUCT" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"OPEN STRUCT" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1}, //OPEN STRUCT - {"PICKUP ITEM" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"PICKUP ITEM" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1}, //DROP ITEM - {"DROP ITEM" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"DROP ITEM" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1}, //SLICE - {"SLICE" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_ATTACK , ANIM_STAND, ANIM_STAND, -1}, + {"SLICE" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_ATTACK , ANIM_STAND, ANIM_STAND, -1}, //STAB - {"STAB" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_ATTACK , ANIM_STAND, ANIM_STAND, -1}, + {"STAB" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_ATTACK , ANIM_STAND, ANIM_STAND, -1}, //CROUCH STAB - {"CROUCH STAB" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_ATTACK , ANIM_CROUCH, ANIM_CROUCH, -1}, + {"CROUCH STAB" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_ATTACK , ANIM_CROUCH, ANIM_CROUCH, -1}, //START GIVING AID - {"START AID" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT , ANIM_CROUCH, ANIM_CROUCH, -1}, + {"START AID" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT , ANIM_CROUCH, ANIM_CROUCH, -1}, //GIVING AID - {"GIVING AID" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT , ANIM_CROUCH, ANIM_CROUCH, -1}, + {"GIVING AID" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT , ANIM_CROUCH, ANIM_CROUCH, -1}, //END GIVING AID - {"END AID" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_NO_EFFORT | ANIM_NOCHANGE_PENDINGCOUNT, ANIM_CROUCH, ANIM_CROUCH, -1}, + {"END AID" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_NO_EFFORT | ANIM_NOCHANGE_PENDINGCOUNT, ANIM_CROUCH, ANIM_CROUCH, -1}, //DODGE ONE - {"DODGE ONE" , 0, 40, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, + {"DODGE ONE" , 0, 40, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, //FATCIV_ASSSCRATCH - {"FATCIV ASS SCRATCH" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"FATCIV ASS SCRATCH" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, // READY_RIFLE_STAND - {"READY AIM (DW) STAND" , 0, 150, (FLOAT)0, ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"READY AIM (DW) STAND" , 0, 150, (FLOAT)0, ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1}, // AIM_RIFLE_STAND - {"AIM (DW) STAND" , 0, 250, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FIREREADY | ANIM_FASTTURN | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"AIM (DW) STAND" , 0, 250, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FIREREADY | ANIM_FASTTURN | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1}, // SHOOT_RIFLE_STAND - {"SHOOT (DW) STAND" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, + {"SHOOT (DW) STAND" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, // END_RIFLE_STAND - {"END DUAL STAND" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NOCHANGE_PENDINGCOUNT | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"END DUAL STAND" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NOCHANGE_PENDINGCOUNT | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1}, //RAISE RIFLE - {"RAISE RIFLE" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_NOMOVE_MARKER | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"RAISE RIFLE" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_NOMOVE_MARKER | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, //LOWER RIFLE - {"LOWER RIFLE" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_NOMOVE_MARKER | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"LOWER RIFLE" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_NOMOVE_MARKER | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, //BOD BLOW - {"BOD BLOW" , 0, 200, (FLOAT)0, ANIM_STATIONARY | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NONINTERRUPT | ANIM_NOCHANGE_WEAPON | ANIM_IGNORE_AUTOSTANCE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, + {"BOD BLOW" , 0, 200, (FLOAT)0, ANIM_STATIONARY | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NONINTERRUPT | ANIM_NOCHANGE_WEAPON | ANIM_IGNORE_AUTOSTANCE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, //THROW ITEM - {"THROW ITEM" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_NOMOVE_MARKER | ANIM_NONINTERRUPT | ANIM_MIN_EFFORT | ANIM_ATTACK , ANIM_STAND, ANIM_STAND, -1}, + {"THROW ITEM" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_NOMOVE_MARKER | ANIM_NONINTERRUPT | ANIM_MIN_EFFORT | ANIM_ATTACK , ANIM_STAND, ANIM_STAND, -1}, //LOB ITEM - {"LOB ITEM" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_NOMOVE_MARKER | ANIM_NONINTERRUPT | ANIM_MIN_EFFORT | ANIM_ATTACK , ANIM_STAND, ANIM_STAND, -1}, + {"LOB ITEM" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_NOMOVE_MARKER | ANIM_NONINTERRUPT | ANIM_MIN_EFFORT | ANIM_ATTACK , ANIM_STAND, ANIM_STAND, -1}, //QUEEN MONSTER STATIONARY - {"MONSTER_STATIONARY" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_BREATH, ANIM_STAND, ANIM_STAND, -1}, + {"MONSTER_STATIONARY" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_BREATH, ANIM_STAND, ANIM_STAND, -1}, // CROUCHED BURST // Lesh: AniDelay, speed=0 for control it - {"CROUCHED BURST SHOOT" , 0, 0, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1}, + {"CROUCHED BURST SHOOT" , 0, 0, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1}, // PRONE BURST // Lesh: AniDelay, speed=0 for control it - {"PRONE BURST SHOOT" , 0, 0, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, + {"PRONE BURST SHOOT" , 0, 0, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1}, //180 - {"NOT USED 1" , 20, 20, (FLOAT)0.9, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"NOT USED 1" , 20, 20, (FLOAT)0.9, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, // BIG GUY FLEX - {"BIG GUY FLEX" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"BIG GUY FLEX" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, // BIG GUY STRECH - {"BIG GUY STRECH" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"BIG GUY STRECH" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, // BIG GUY SOEDUST - {"BIG GUY SHOE DUST" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"BIG GUY SHOE DUST" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, // BIG GUY HEADTURN - {"BIG GUY HEAD TURN" , 0, 180, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"BIG GUY HEAD TURN" , 0, 180, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, // MINI GIRL STOCKING - {"MINI GIRL STOCKING" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"MINI GIRL STOCKING" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, //GIVE ITEM - {"GIVE ITEM" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK , ANIM_STAND, ANIM_STAND, -1}, + {"GIVE ITEM" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK , ANIM_STAND, ANIM_STAND, -1}, //CLIMB MOUNTIAIN - {"CLIMB MOUNTAIN" , 0, 50, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NOSHOW_MARKER | ANIM_MODERATE_EFFORT, ANIM_STAND, ANIM_CROUCH, -1}, + {"CLIMB MOUNTAIN" , 0, 50, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NOSHOW_MARKER | ANIM_MODERATE_EFFORT, ANIM_STAND, ANIM_CROUCH, -1}, - {"COW EATING" , 0, 200, (FLOAT)0.0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"COW EATING" , 0, 200, (FLOAT)0.0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, // COW HIT - {"COW HIT" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, + {"COW HIT" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, // COW DIE - {"COW DIE" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1}, + {"COW DIE" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1}, // COW DIE STOP - {"COW DIE STOP" , 0, 350, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT, ANIM_PRONE, ANIM_PRONE, -1}, + {"COW DIE STOP" , 0, 350, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT, ANIM_PRONE, ANIM_PRONE, -1}, // WATER HIT - {"WATER HIT" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, + {"WATER HIT" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, // WATER DIE - {"WATER DIE" , 0, 160, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1}, + {"WATER DIE" , 0, 160, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1}, // WATER DIE STOP - {"WATER DIE STOP" , 0, 340, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, + {"WATER DIE STOP" , 0, 340, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1}, - {"CROW WALK" , 0, 80, (FLOAT)1.6, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"CROW WALK" , 0, 80, (FLOAT)1.6, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1}, - {"CROW TAKEOFF" , 0, 80, (FLOAT)1.6, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"CROW TAKEOFF" , 0, 80, (FLOAT)1.6, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, - {"CROW LAND" , 0, 80, (FLOAT)1.6, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"CROW LAND" , 0, 80, (FLOAT)1.6, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, - {"CROW FLY" , 0, 20, (FLOAT)0.5, ANIM_SPECIALMOVE | ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"CROW FLY" , 0, 20, (FLOAT)0.5, ANIM_SPECIALMOVE | ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1}, - {"CROW EAT" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_MIN_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"CROW EAT" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_MIN_EFFORT, ANIM_STAND, ANIM_STAND, -1}, - {"HELIDROP" , 0, 60, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_CROUCH, -1}, + {"HELIDROP" , 0, 60, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_CROUCH, -1}, - {"FEM CLEAN" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"FEM CLEAN" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, - {"FEM KICKSN" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"FEM KICKSN" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, - {"FEM LOOK" , 0, 180, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"FEM LOOK" , 0, 180, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, - {"FEM WIPE" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"FEM WIPE" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, - {"REG SQUISH" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"REG SQUISH" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, - {"REG PULL" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"REG PULL" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, - {"REG SPIT" , 0, 130, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"REG SPIT" , 0, 130, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, - {"KID YOYO" , 0, 140, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"KID YOYO" , 0, 140, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, - {"KID ARMPIT" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, + {"KID ARMPIT" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1}, - {"ADULT MONSTER CLOSE ATTACK", 0 , 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, + {"ADULT MONSTER CLOSE ATTACK", 0 , 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1}, - "ADULT MONSTER SPIT ATTACK", 0 , 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "ADULT MONSTER SPIT ATTACK", 0 , 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, - "ADULT MONSTER BEGIN EATING", 0 , 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "ADULT MONSTER BEGIN EATING", 0 , 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, - "ADULT MONSTER EATING", 0 , 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "ADULT MONSTER EATING", 0 , 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1, - "ADULT MONSTER END EATING", 0 , 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "ADULT MONSTER END EATING", 0 , 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, //RUN - "BLOODCAT RUN" , 0, 50, (FLOAT)5.4, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_MODERATE_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "BLOODCAT RUN" , 0, 50, (FLOAT)5.4, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_MODERATE_EFFORT, ANIM_STAND, ANIM_STAND, -1, // - "BLOODCAT BEGIN READY" , 0, 70, (FLOAT)0, ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "BLOODCAT BEGIN READY" , 0, 70, (FLOAT)0, ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, - "BLOODCAT READY" , 0, 130, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "BLOODCAT READY" , 0, 130, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, - "BLOODCAT END READY" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "BLOODCAT END READY" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, // CAT HIT - "BLOODCAT HIT" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "BLOODCAT HIT" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, // CAT DIE - "BLOODCAT DIE" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1, + "BLOODCAT DIE" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1, // CAT DIE STOP - "BLOODCAT DIE STOP" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT, ANIM_PRONE, ANIM_PRONE, -1, + "BLOODCAT DIE STOP" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT, ANIM_PRONE, ANIM_PRONE, -1, - "BLOODCAT SWIPE" , 0 , 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_MIN_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "BLOODCAT SWIPE" , 0 , 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_MIN_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, - "NINJA GOTO BREATH" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, + "NINJA GOTO BREATH" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, - "NINJA BREATH" , 0, 0, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, + "NINJA BREATH" , 0, 0, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, - "NINJA LOWKICK" , 0, 50, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NORESTART | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "NINJA LOWKICK" , 0, 50, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NORESTART | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, - "NINJA PUNCH" , 0, 50, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NORESTART | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "NINJA PUNCH" , 0, 50, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NORESTART | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, - "NINJA SPIN KICK" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_MODERATE_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NORESTART | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "NINJA SPIN KICK" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_MODERATE_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NORESTART | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, //END OPEN DOOR - "END OPEN DOOR" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_MIN_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "END OPEN DOOR" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_MIN_EFFORT, ANIM_STAND, ANIM_STAND, -1, //END OPEN LOCKED DOOR - "END OPEN LOCKED DOOR" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_MIN_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "END OPEN LOCKED DOOR" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_MIN_EFFORT, ANIM_STAND, ANIM_STAND, -1, //KICK DOOR - "KICK DOOR" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "KICK DOOR" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, //KICK DOOR - "CLOSE DOOR" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_MIN_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "CLOSE DOOR" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_MIN_EFFORT, ANIM_STAND, ANIM_STAND, -1, // HIT STANDING RIFLE - "HIT STAND RIFLE" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTART | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "HIT STAND RIFLE" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTART | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, // DEEP WATER TREAD - "DEEP WATER TREAD" , 0, 200, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NOCHANGE_WEAPON | ANIM_MODERATE_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "DEEP WATER TREAD" , 0, 200, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NOCHANGE_WEAPON | ANIM_MODERATE_EFFORT, ANIM_STAND, ANIM_STAND, -1, // DEEP WATER SWIM - "DEEP WATER SWIM" , 0, 160, (FLOAT)1.3, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_NOCHANGE_WEAPON | ANIM_MODERATE_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "DEEP WATER SWIM" , 0, 160, (FLOAT)1.3, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_NOCHANGE_WEAPON | ANIM_MODERATE_EFFORT, ANIM_STAND, ANIM_STAND, -1, // DEEP WATER HIT - "DEEP WATER HIT" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "DEEP WATER HIT" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, // DEEP WATER DIE - "DEEP WATER DIE" , 0, 210, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1, + "DEEP WATER DIE" , 0, 210, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1, // DEEP WATER DIE STOPPING - "DEEP WATER DIE STOPPING" , 0, 340, (FLOAT)0, ANIM_STATIONARY | ANIM_NONINTERRUPT | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1, + "DEEP WATER DIE STOPPING" , 0, 340, (FLOAT)0, ANIM_STATIONARY | ANIM_NONINTERRUPT | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1, // DEEP WATER DIE STOP - "DEEP WATER DIE STOP" , 0, 340, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1, + "DEEP WATER DIE STOP" , 0, 340, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1, // WATER TRANSITION - "LOW TO DEEP WATER" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "LOW TO DEEP WATER" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, // WATER TRANSITION - "DEEP TO LOW WATER" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "DEEP TO LOW WATER" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, // GOTO SLEEP - "GOTO SLEEP" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_LOWER_WEAPON | ANIM_NONINTERRUPT| ANIM_NO_EFFORT, ANIM_CROUCH, ANIM_PRONE, -1, + "GOTO SLEEP" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_LOWER_WEAPON | ANIM_NONINTERRUPT| ANIM_NO_EFFORT, ANIM_CROUCH, ANIM_PRONE, -1, // SLEEP - "SLEEPING" , 0, 2000, (FLOAT)0, ANIM_STATIONARY | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT | ANIM_UPDATEMOVEMENTMODE, ANIM_PRONE, ANIM_PRONE, -1, + "SLEEPING" , 0, 2000, (FLOAT)0, ANIM_STATIONARY | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT | ANIM_UPDATEMOVEMENTMODE, ANIM_PRONE, ANIM_PRONE, -1, // WAKEUP - "WAKEUP" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_RAISE_WEAPON | ANIM_NO_EFFORT, ANIM_PRONE, ANIM_CROUCH, -1, + "WAKEUP" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_RAISE_WEAPON | ANIM_NO_EFFORT, ANIM_PRONE, ANIM_CROUCH, -1, // SHOOT_RIFLE_STAND LOW - "SHOOT (R) STAND LOW" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "SHOOT (R) STAND LOW" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, // SHOOT_RIFLE_STAND LOW // Lesh: AniDelay, speed=0 for control it - "BURST SHOOT (R) STAND LOW" , 0, 0, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "BURST SHOOT (R) STAND LOW" , 0, 0, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, //LARVAE Breathing - "LARVAE BREATH" , 0, 250, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, + "LARVAE BREATH" , 0, 250, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, // GENERIC HIT CROUCHED - "LARVAE HIT" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "LARVAE HIT" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, // FALL FORWARD FROM HIT STAND - "LARVAE DIE" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1, + "LARVAE DIE" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1, // FALL FORWARD FROM HIT STAND - "LARVAE DIE STOP" , 0, 350, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1, + "LARVAE DIE STOP" , 0, 350, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1, // FEMALE MONSTER BREATHING - "LARVAE WALKING" , 0 , 110, (FLOAT)0.5, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, + "LARVAE WALKING" , 0 , 110, (FLOAT)0.5, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, // GENERIC HIT CROUCHED - "INFANT HIT" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "INFANT HIT" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, // FALL FORWARD FROM HIT STAND - "INFANT DIE" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1, + "INFANT DIE" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1, // FALL FORWARD FROM HIT STAND - "INFANT DIE STOP" , 0, 350, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1, + "INFANT DIE STOP" , 0, 350, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1, - "INFANT MONSTER SPIT ATTACK", 0 , 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "INFANT MONSTER SPIT ATTACK", 0 , 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, - "INFANT MONSTER BEGIN EATING", 0 , 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, + "INFANT MONSTER BEGIN EATING", 0 , 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, - "INFANT MONSTER EATING", 0 , 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, + "INFANT MONSTER EATING", 0 , 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, - "INFANT MONSTER END EATING", 0 , 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, + "INFANT MONSTER END EATING", 0 , 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, - "ADULT MONSTER UP", 0 , 130, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, + "ADULT MONSTER UP", 0 , 130, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, - "ADULT MONSTER JUMP", 0 , 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, + "ADULT MONSTER JUMP", 0 , 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, // UNJAM STANDING - "UNJAM STANDING" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NOCHANGE_WEAPON | ANIM_MIN_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "UNJAM STANDING" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NOCHANGE_WEAPON | ANIM_MIN_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, // UNJAM CROUCH - "UNJAM CROUCH" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NOCHANGE_WEAPON | ANIM_MIN_EFFORT | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, + "UNJAM CROUCH" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NOCHANGE_WEAPON | ANIM_MIN_EFFORT | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, // UNJAM PRONE - "UNJAM PRONE" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NOCHANGE_WEAPON | ANIM_MIN_EFFORT | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1, + "UNJAM PRONE" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NOCHANGE_WEAPON | ANIM_MIN_EFFORT | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1, // UNJAM STAND DWEL - "UNJAM STAND DWEL" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NOCHANGE_WEAPON | ANIM_MIN_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "UNJAM STAND DWEL" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NOCHANGE_WEAPON | ANIM_MIN_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, // UNJAM STAND LOW - "UNJAM STAND LOW" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NOCHANGE_WEAPON | ANIM_MIN_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "UNJAM STAND LOW" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NOCHANGE_WEAPON | ANIM_MIN_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, // READY_RIFLE_CROUCH - "READY AIM (DW) CROUCH" , 0, 150, (FLOAT)0, ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, + "READY AIM (DW) CROUCH" , 0, 150, (FLOAT)0, ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, // AIM_RIFLE_CROUCH - "AIM (DW) CROUCH" , 0, 250, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FIREREADY | ANIM_FASTTURN | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, + "AIM (DW) CROUCH" , 0, 250, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FIREREADY | ANIM_FASTTURN | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, // SHOOT_RIFLE_CROUCH - "SHOOT (DW) CROUCH" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, + "SHOOT (DW) CROUCH" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, // END_RIFLE_STAND - "END DUAL CROUCH" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NOCHANGE_PENDINGCOUNT | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, + "END DUAL CROUCH" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NOCHANGE_PENDINGCOUNT | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, // UNJAM CROUCH DWEL - "UNJAM CROUCH DWEL" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NOCHANGE_WEAPON | ANIM_MIN_EFFORT | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, + "UNJAM CROUCH DWEL" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NOCHANGE_WEAPON | ANIM_MIN_EFFORT | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, //GET ADJACENT ITEM - "GET ADJACENT ITEM" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "GET ADJACENT ITEM" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1, //CUTTING FENCE - "CUTTING FENCE" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, + "CUTTING FENCE" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, - "CRIPPLE BEG" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "CRIPPLE BEG" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, // CRIPPLE HIT - "CRIPPLE HIT" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "CRIPPLE HIT" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, // CRIPPLE DIE - "CRIPPLE DIE" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1, + "CRIPPLE DIE" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1, // CRIPPLE DIE STOP - "CRIPPLE DIE STOP" , 0, 350, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1, + "CRIPPLE DIE STOP" , 0, 350, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1, // CRIPPLE FLYBACK DIE - "CRIPPLE FLYBACK DIE" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1, + "CRIPPLE FLYBACK DIE" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1, // CRIPPLE FLYBACK DIE STOP - "CRIPPLE FLYBACK DIE STOP" , 0, 350, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1, + "CRIPPLE FLYBACK DIE STOP" , 0, 350, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1, // CRIPPLE KICK - "CRIPPLE KICK" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_NOMOVE_MARKER | ANIM_MIN_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "CRIPPLE KICK" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_NOMOVE_MARKER | ANIM_MIN_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, // INJURED TRANSITION - "INJURED TRANSITION" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_NOMOVE_MARKER | ANIM_MIN_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, + "INJURED TRANSITION" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_NOMOVE_MARKER | ANIM_MIN_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, //THROW KNIFE - "THROW KNIFE" , 0, 50, (FLOAT)0, ANIM_STATIONARY | ANIM_NOMOVE_MARKER | ANIM_NONINTERRUPT | ANIM_MIN_EFFORT | ANIM_ATTACK , ANIM_STAND, ANIM_STAND, -1, + "THROW KNIFE" , 0, 50, (FLOAT)0, ANIM_STATIONARY | ANIM_NOMOVE_MARKER | ANIM_NONINTERRUPT | ANIM_MIN_EFFORT | ANIM_ATTACK , ANIM_STAND, ANIM_STAND, -1, //Breathing - "KNIFE BREATH" , 0, 150, (FLOAT)0, ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, + "KNIFE BREATH" , 0, 150, (FLOAT)0, ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, //Breathing - "KNIFE GOTO BREATH" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NONINTERRUPT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "KNIFE GOTO BREATH" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NONINTERRUPT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, //Breathing - "KNIFE END BREATH" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NONINTERRUPT, ANIM_STAND, ANIM_STAND, -1, + "KNIFE END BREATH" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NONINTERRUPT, ANIM_STAND, ANIM_STAND, -1, // ROBOT HIT - "ROBOT HIT" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "ROBOT HIT" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NONINTERRUPT | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, // ROBOT DIE - "ROBOT DIE" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1, + "ROBOT DIE" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1, // ROBOT DIE STOP - "ROBOT DIE STOP" , 0, 350, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1, + "ROBOT DIE STOP" , 0, 350, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1, //Catch Standing - "Catch Standing" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_LOWER_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "Catch Standing" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_LOWER_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, //Catch Crouched - "Catch Crouched" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_LOWER_WEAPON | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, + "Catch Crouched" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_LOWER_WEAPON | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, //PLANT BOMB - "PLANT BOMB" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "PLANT BOMB" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, //Use remote - "Use Remote" , 0, 80, (FLOAT)0, ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NONINTERRUPT, ANIM_STAND, ANIM_STAND, -1, + "Use Remote" , 0, 80, (FLOAT)0, ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NONINTERRUPT, ANIM_STAND, ANIM_STAND, -1, //COWER - "START Cower" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NONINTERRUPT | ANIM_IGNORE_AUTOSTANCE, ANIM_STAND, ANIM_CROUCH, -1, + "START Cower" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NONINTERRUPT | ANIM_IGNORE_AUTOSTANCE, ANIM_STAND, ANIM_CROUCH, -1, //COWER - "Cowering" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_IGNORE_AUTOSTANCE , ANIM_CROUCH, ANIM_CROUCH, -1, + "Cowering" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_IGNORE_AUTOSTANCE , ANIM_CROUCH, ANIM_CROUCH, -1, //END COWER - "End Cower" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_IGNORE_AUTOSTANCE, ANIM_CROUCH, ANIM_STAND, -1, + "End Cower" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_IGNORE_AUTOSTANCE, ANIM_CROUCH, ANIM_STAND, -1, //STEAL ITEM - "STEAL ITEM" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK , ANIM_STAND, ANIM_STAND, -1, + "STEAL ITEM" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK , ANIM_STAND, ANIM_STAND, -1, //LAUNCH ROCKET - "LAUNCH ROCKET" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_ATTACK , ANIM_STAND, ANIM_STAND, -1, + "LAUNCH ROCKET" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_ATTACK , ANIM_STAND, ANIM_STAND, -1, // CIV ALT DIE - "CIV ALT DIE" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1, + "CIV ALT DIE" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1, //SHOOT MORTAR - "SHOOT MORTAR" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK , ANIM_CROUCH, ANIM_CROUCH, -1, + "SHOOT MORTAR" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK , ANIM_CROUCH, ANIM_CROUCH, -1, //CROW DIE - "CROW_DIE" , 0, 130, (FLOAT)0, ANIM_STATIONARY | ANIM_NONINTERRUPT | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NOCHANGE_WEAPON | ANIM_LIGHT_EFFORT , ANIM_STAND, ANIM_STAND, -1, + "CROW_DIE" , 0, 130, (FLOAT)0, ANIM_STATIONARY | ANIM_NONINTERRUPT | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NOCHANGE_WEAPON | ANIM_LIGHT_EFFORT , ANIM_STAND, ANIM_STAND, -1, //SIDE STEPPING - "SIDE STEPPING" , 0, 50, (FLOAT)0.4, ANIM_MOVING | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_VARIABLE_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "SIDE STEPPING" , 0, 50, (FLOAT)0.4, ANIM_MOVING | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_VARIABLE_EFFORT, ANIM_STAND, ANIM_STAND, -1, //WALK BACKWARDS - "WALK BACKWARDS" , 0, 110, (FLOAT)1.4, ANIM_MOVING | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_VARIABLE_EFFORT | ANIM_TURNING, ANIM_STAND, ANIM_STAND, -1, + "WALK BACKWARDS" , 0, 110, (FLOAT)1.4, ANIM_MOVING | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_VARIABLE_EFFORT | ANIM_TURNING, ANIM_STAND, ANIM_STAND, -1, //OPEN STRUCT - "BEGIN OPEN STRUCT" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "BEGIN OPEN STRUCT" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1, //END STRUCT - "END OPEN STRUCT" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "END OPEN STRUCT" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1, //END OPEN LOCKED - "END OPEN LOCKED STRUCT" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "END OPEN LOCKED STRUCT" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1, // Punch LOw - "LOW PUNCH" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, + "LOW PUNCH" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, // SHOOT_PISTOL_STAND LOW - "SHOOT (P) STAND LOW" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "SHOOT (P) STAND LOW" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, //DECAPITATE - "DECAPITATE" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NONINTERRUPT | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, + "DECAPITATE" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NONINTERRUPT | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, - "BLOODCAT BITE" , 0 , 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_MIN_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "BLOODCAT BITE" , 0 , 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_MIN_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, - "BIGMERC S NECK" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "BIGMERC S NECK" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, //CROUCH TRANSITION - "BIGMERC CROUCH TRANS INTO" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NOMOVE_MARKER | ANIM_STANCECHANGEANIM | ANIM_RAISE_WEAPON | ANIM_MIN_EFFORT, ANIM_STAND, ANIM_CROUCH, -1, + "BIGMERC CROUCH TRANS INTO" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NOMOVE_MARKER | ANIM_STANCECHANGEANIM | ANIM_RAISE_WEAPON | ANIM_MIN_EFFORT, ANIM_STAND, ANIM_CROUCH, -1, //CROUCH TRANSITION - "BIGMERC CROUCH TRANS OUTOF" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NOMOVE_MARKER | ANIM_STANCECHANGEANIM | ANIM_RAISE_WEAPON | ANIM_MIN_EFFORT, ANIM_CROUCH, ANIM_STAND, -1, + "BIGMERC CROUCH TRANS OUTOF" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NOMOVE_MARKER | ANIM_STANCECHANGEANIM | ANIM_RAISE_WEAPON | ANIM_MIN_EFFORT, ANIM_CROUCH, ANIM_STAND, -1, //GOTO PATIENT - "GOTO PATIENT" , 0, 1000, (FLOAT)0, ANIM_STATIONARY | ANIM_FASTTURN | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT , ANIM_PRONE, ANIM_PRONE, -1, + "GOTO PATIENT" , 0, 1000, (FLOAT)0, ANIM_STATIONARY | ANIM_FASTTURN | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT , ANIM_PRONE, ANIM_PRONE, -1, //BEING PATIENT - "BEING PATIENT" , 0, 1000, (FLOAT)0, ANIM_STATIONARY | ANIM_FASTTURN | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT | ANIM_UPDATEMOVEMENTMODE , ANIM_PRONE, ANIM_PRONE, -1, + "BEING PATIENT" , 0, 1000, (FLOAT)0, ANIM_STATIONARY | ANIM_FASTTURN | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT | ANIM_UPDATEMOVEMENTMODE , ANIM_PRONE, ANIM_PRONE, -1, //GOTO DOCTOR - "GOTO DOCTOR" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, + "GOTO DOCTOR" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, //BEING DOCTOR - "BEING DOCTOR" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_UPDATEMOVEMENTMODE , ANIM_CROUCH, ANIM_CROUCH, -1, + "BEING DOCTOR" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_UPDATEMOVEMENTMODE , ANIM_CROUCH, ANIM_CROUCH, -1, //ENDING DOCTOR - "END DOCTOR" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_NO_EFFORT | ANIM_NOCHANGE_PENDINGCOUNT, ANIM_CROUCH, ANIM_CROUCH, -1, + "END DOCTOR" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_NO_EFFORT | ANIM_NOCHANGE_PENDINGCOUNT, ANIM_CROUCH, ANIM_CROUCH, -1, //GOTO REPAIRMAN - "GOTO REPAIRMAN" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT , ANIM_CROUCH, ANIM_CROUCH, -1, + "GOTO REPAIRMAN" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT , ANIM_CROUCH, ANIM_CROUCH, -1, //BEING REPAIRMAN - "BEING REPAIRMAN" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_UPDATEMOVEMENTMODE , ANIM_CROUCH, ANIM_CROUCH, -1, + "BEING REPAIRMAN" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_UPDATEMOVEMENTMODE , ANIM_CROUCH, ANIM_CROUCH, -1, //ENDING REPAIRMAN - "END REPAIRMAN" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_NO_EFFORT | ANIM_NOCHANGE_PENDINGCOUNT, ANIM_CROUCH, ANIM_CROUCH, -1, + "END REPAIRMAN" , 0, 90, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_NO_EFFORT | ANIM_NOCHANGE_PENDINGCOUNT, ANIM_CROUCH, ANIM_CROUCH, -1, //FALL INTO PIT - "FALL INTO PIT" , 0, 60, (FLOAT)0, ANIM_STATIONARY | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1, + "FALL INTO PIT" , 0, 60, (FLOAT)0, ANIM_STATIONARY | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1, // ROBOT WALK - "ROBOT WALKING" , 0 , 80, (FLOAT)1.5, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, + "ROBOT WALKING" , 0 , 80, (FLOAT)1.5, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, // ROBOT SHOOT - "ROBOT SHOOT" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "ROBOT SHOOT" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, // QUEEN HIT - "QUEEN HIT" , 0, 200, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "QUEEN HIT" , 0, 200, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITSTART | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, // QUEEN DIE - "QUEEN DIE" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1, + "QUEEN DIE" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_PRONE, -1, // QUEEN DIE STOP - "QUEEN DIE STOP" , 0, 350, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1, + "QUEEN DIE STOP" , 0, 350, (FLOAT)0, ANIM_STATIONARY | ANIM_HITSTOP | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_PRONE, ANIM_PRONE, -1, - "QUEEN INTO READY" , 0, 130, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "QUEEN INTO READY" , 0, 130, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, - "QUEEN READY" , 0, 130, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "QUEEN READY" , 0, 130, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, - "QUEEN END READY" , 0, 130, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "QUEEN END READY" , 0, 130, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, - "QUEEN CALL" , 0, 130, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "QUEEN CALL" , 0, 130, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, - "QUEEN MONSTER SPIT ATTACK", 0 , 130, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "QUEEN MONSTER SPIT ATTACK", 0 , 130, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, - "QUEEN MONSTER SWIPE ATTACK", 0 , 130, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "QUEEN MONSTER SWIPE ATTACK", 0 , 130, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, //RELOAD ROBOT - "RELOAD ROBOT" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, + "RELOAD ROBOT" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, //End Catch Standing - "Catch Standing" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NONINTERRUPT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "Catch Standing" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NONINTERRUPT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, //End Catch Crouched - "Catch Crouched" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NONINTERRUPT | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, + "Catch Crouched" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_FIREREADY | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NONINTERRUPT | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, - "RADIO" , 0, 130, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "RADIO" , 0, 130, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, - "CROUCH RADIO" , 0, 130, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, + "CROUCH RADIO" , 0, 130, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NORESTART | ANIM_NO_EFFORT | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, // TANK SHOOT - "TANK SHOOT" , 0, 200, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NOCHANGE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "TANK SHOOT" , 0, 200, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NOCHANGE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, // TANK SHOOT // Lesh: AniDelay, speed=0 for control it - "TANK BURST" , 0, 0, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NOCHANGE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "TANK BURST" , 0, 0, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NOCHANGE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, //Queen Slap - "QUEEN SLAP" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "QUEEN SLAP" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, //Slap hit - "SLAP HIT" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "SLAP HIT" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, //GET BLOOD - "GET BLOOD" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, + "GET BLOOD" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, //VEHICLE DIE - "VEHICLE DIE" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_NOCHANGE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "VEHICLE DIE" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_NOCHANGE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, //Queen Frustrated Slap - "QUEEN FRUSTRATED SLAP" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "QUEEN FRUSTRATED SLAP" , 0, 120, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, //SOLDIER BRUN - "FIRE FIRE" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_NOCHANGE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_IGNORE_AUTOSTANCE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "FIRE FIRE" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_NOCHANGE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_IGNORE_AUTOSTANCE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, //AI TRIGGER - "AI TRIGGER" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "AI TRIGGER" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1, // MONSTER MELT - "MONSTERMELT" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1, + "MONSTERMELT" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_HITFINISH | ANIM_NOMOVE_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1, - "MERC INJURED IDLE ANIM" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "MERC INJURED IDLE ANIM" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, // INJURED TRANSITION - "END INJURED WALK" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NOMOVE_MARKER | ANIM_MIN_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, + "END INJURED WALK" , 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NOMOVE_MARKER | ANIM_MIN_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, //PASS OBJECT - "PASS OBJECT" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK , ANIM_STAND, ANIM_STAND, -1, + "PASS OBJECT" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK , ANIM_STAND, ANIM_STAND, -1, //ADJACENT DROP OBJECT - "ADJACENT DROP OBJECT" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK , ANIM_STAND, ANIM_STAND, -1, + "ADJACENT DROP OBJECT" , 0, 110, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK , ANIM_STAND, ANIM_STAND, -1, // READY_RIFLE_PRONE - "READY AIM (DW) PRONE" , 0, 150, (FLOAT)0, ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_LIGHT_EFFORT, ANIM_PRONE, ANIM_PRONE, -1, + "READY AIM (DW) PRONE" , 0, 150, (FLOAT)0, ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_LIGHT_EFFORT, ANIM_PRONE, ANIM_PRONE, -1, // AIM_RIFLE_PRONE - "AIM (DW) PRONE" , 0, 250, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FIREREADY | ANIM_FASTTURN | ANIM_LIGHT_EFFORT, ANIM_PRONE, ANIM_PRONE, -1, + "AIM (DW) PRONE" , 0, 250, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FIREREADY | ANIM_FASTTURN | ANIM_LIGHT_EFFORT, ANIM_PRONE, ANIM_PRONE, -1, // SHOOT_RIFLE_PRONE - "SHOOT (DW) PRONE" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1, + "SHOOT (DW) PRONE" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_LIGHT_EFFORT | ANIM_FIRE | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1, // END_RIFLE_PRONE - "END DUAL PRONE" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NOCHANGE_PENDINGCOUNT | ANIM_LIGHT_EFFORT, ANIM_PRONE, ANIM_PRONE, -1, + "END DUAL PRONE" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NOCHANGE_PENDINGCOUNT | ANIM_LIGHT_EFFORT, ANIM_PRONE, ANIM_PRONE, -1, // UNJAM PRONE DWEL - "UNJAM PRONE DWEL" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NOCHANGE_WEAPON | ANIM_MIN_EFFORT | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1, + "UNJAM PRONE DWEL" , 0, 150, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NOCHANGE_WEAPON | ANIM_MIN_EFFORT | ANIM_ATTACK, ANIM_PRONE, ANIM_PRONE, -1, //PICK LOCK - "PICK LOCK" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "PICK LOCK" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, //OPEN DOOR CROUCHED - "OPEN DOOR CROUCHED" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, + "OPEN DOOR CROUCHED" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, //BEGIN OPENSTRUCT CROUCHED - "BEGIN OPEN STRUCT CROUCHED" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, + "BEGIN OPEN STRUCT CROUCHED" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, //CLOSE DOOR CROUCHED - "CLOSE DOOR CROUCHED" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, + "CLOSE DOOR CROUCHED" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, //OPEN STRUCT CROUCHED - "OPEN STRUCT CROUCHED" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, + "OPEN STRUCT CROUCHED" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, //END OPEN DOOR CROUCHED - "END OPEN DOOR CROUCHED" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, + "END OPEN DOOR CROUCHED" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, //END OPENSTRUCT CROUCHED - "END OPENSTRUCT CROUCHED" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, + "END OPENSTRUCT CROUCHED" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, //END OPEN LOCKED DOOR CROUCHED - "END OPNE LOCKED DOOR CR" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, + "END OPNE LOCKED DOOR CR" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, //END OPEN STRUCT LOCKED CR - "END OPEN STRUCT LOCKED CR" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, + "END OPEN STRUCT LOCKED CR" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, - "DRUNK IDLE" , 0, 170, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "DRUNK IDLE" , 0, 170, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_MERCIDLE | ANIM_NOCHANGE_WEAPON | ANIM_NO_EFFORT, ANIM_STAND, ANIM_STAND, -1, // CROWBAR - "CROWBAR" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NORESTART | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "CROWBAR" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NORESTART | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, // COWER HIT ANIMATION - "COWER HIT" , 0, 80, (FLOAT)1.6, ANIM_HITSTART | ANIM_HITFINISH | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_IGNORE_AUTOSTANCE | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, + "COWER HIT" , 0, 80, (FLOAT)1.6, ANIM_HITSTART | ANIM_HITFINISH | ANIM_NONINTERRUPT | ANIM_NOSHOW_MARKER | ANIM_NO_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_IGNORE_AUTOSTANCE | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, // BLOODCAT WALK BACKWARDS - "BLOODCAT WALKING BACKWARDS", 0 , 30, (FLOAT)1.2, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, + "BLOODCAT WALKING BACKWARDS", 0 , 30, (FLOAT)1.2, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, // CREATURE WALK BACKWARDS - "MONSTER WALKING BACKWARDS", 0 , 30, (FLOAT)2.5, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, + "MONSTER WALKING BACKWARDS", 0 , 30, (FLOAT)2.5, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, // KID SKIPPING - "KID SKIPPING", 0 , 70, (FLOAT)2.0, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, + "KID SKIPPING", 0 , 70, (FLOAT)2.0, ANIM_MOVING | ANIM_TURNING | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1, // STAND BURST // Lesh: AniDelay, speed=0 for control it - "STAND BURST SHOOT" , 0, 0, (FLOAT)0, ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_FIRE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "STAND BURST SHOOT" , 0, 0, (FLOAT)0, ANIM_NORESTART | ANIM_STATIONARY | ANIM_TURNING | ANIM_RAISE_WEAPON | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_FIRE | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, //Attach string - "Attach String" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, + "Attach String" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, //SWAT BACKWARDS - "SWAT BACKWARDS" , 0, 110, (FLOAT)1.4, ANIM_MOVING | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_TURNING, ANIM_CROUCH, ANIM_CROUCH, -1, + "SWAT BACKWARDS" , 0, 110, (FLOAT)1.4, ANIM_MOVING | ANIM_NORESTART | ANIM_LIGHT_EFFORT | ANIM_TURNING, ANIM_CROUCH, ANIM_CROUCH, -1, //JUMP OVER BLOCKING PERSON - "JUMP OVER" , 0, 110, (FLOAT)3.6, ANIM_SPECIALMOVE | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_MODERATE_EFFORT | ANIM_TURNING | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, + "JUMP OVER" , 0, 110, (FLOAT)3.6, ANIM_SPECIALMOVE | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_MODERATE_EFFORT | ANIM_TURNING | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1, //REFUEL VEHICLE - "REFUEL VEHICLE" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, + "REFUEL VEHICLE" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, //Robot camera not moving - "ROBOT CAMERA" , 0, 0, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_VARIABLE_EFFORT | ANIM_BREATH, ANIM_STAND, ANIM_STAND, -1, + "ROBOT CAMERA" , 0, 0, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_RAISE_WEAPON | ANIM_VARIABLE_EFFORT | ANIM_BREATH, ANIM_STAND, ANIM_STAND, -1, //CRIPPLE OPEN DOOR - "CRIPPLE OPEN DOOR" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "CRIPPLE OPEN DOOR" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LIGHT_EFFORT, ANIM_STAND, ANIM_STAND, -1, //CRIPPLE CLOSE DOOR - "CRIPPLE CLOSE DOOR" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_MIN_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "CRIPPLE CLOSE DOOR" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_MIN_EFFORT, ANIM_STAND, ANIM_STAND, -1, //CRIPPLE END OPEN DOOR - "END OPEN DOOR" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_MIN_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "END OPEN DOOR" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_MIN_EFFORT, ANIM_STAND, ANIM_STAND, -1, //CRIPPLE END OPEN LOCKED DOOR - "END OPEN LOCKED DOOR" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_MIN_EFFORT, ANIM_STAND, ANIM_STAND, -1, + "END OPEN LOCKED DOOR" , 0, 100, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_MIN_EFFORT, ANIM_STAND, ANIM_STAND, -1, //CROUCH PICK LOCK - "CROUCH PICK LOCK" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, + "CROUCH PICK LOCK" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, // crouch throwing - "THROW ITEM CROUCHED", 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_NOMOVE_MARKER | ANIM_NONINTERRUPT | ANIM_MIN_EFFORT | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, + "THROW ITEM CROUCHED", 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_NOMOVE_MARKER | ANIM_NONINTERRUPT | ANIM_MIN_EFFORT | ANIM_ATTACK, ANIM_CROUCH, ANIM_CROUCH, -1, // crouch throwing gubAnimSurfaceIndex[ REGMALE ][ THROW_ITEM_CROUCHED ] = RGMCRTHROW; @@ -1586,8 +1586,8 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ BIGMALE ][ STANDING_SHOOT_UNJAM ] = BGMSTANDAIM; gubAnimSurfaceIndex[ BIGMALE ][ CROUCH_SHOOT_UNJAM ] = BGMCROUCHAIM; gubAnimSurfaceIndex[ BIGMALE ][ PRONE_SHOOT_UNJAM ] = BGMPRONE; - gubAnimSurfaceIndex[ BIGMALE ][ STANDING_SHOOT_DWEL_UNJAM ] = BGMSTANDDWALAIM; - gubAnimSurfaceIndex[ BIGMALE ][ STANDING_SHOOT_LOW_UNJAM ] = BGMSHOOT_LOW; + gubAnimSurfaceIndex[ BIGMALE ][ STANDING_SHOOT_DWEL_UNJAM ] = BGMSTANDDWALAIM; + gubAnimSurfaceIndex[ BIGMALE ][ STANDING_SHOOT_LOW_UNJAM ] = BGMSHOOT_LOW; gubAnimSurfaceIndex[ BIGMALE ][ READY_DUAL_CROUCH ] = BGMCDBLSHOT; gubAnimSurfaceIndex[ BIGMALE ][ AIM_DUAL_CROUCH ] = BGMCDBLSHOT; gubAnimSurfaceIndex[ BIGMALE ][ SHOOT_DUAL_CROUCH ] = BGMCDBLSHOT; @@ -1646,8 +1646,8 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ BIGMALE ][ AIM_DUAL_PRONE ] = BGMDWPRONE; gubAnimSurfaceIndex[ BIGMALE ][ SHOOT_DUAL_PRONE ] = BGMDWPRONE; gubAnimSurfaceIndex[ BIGMALE ][ END_DUAL_PRONE ] = BGMDWPRONE; - gubAnimSurfaceIndex[ BIGMALE ][ PRONE_SHOOT_DWEL_UNJAM ] = BGMDWPRONE; - gubAnimSurfaceIndex[ BIGMALE ][ PICK_LOCK ] = BGMOPEN; + gubAnimSurfaceIndex[ BIGMALE ][ PRONE_SHOOT_DWEL_UNJAM ] = BGMDWPRONE; + gubAnimSurfaceIndex[ BIGMALE ][ PICK_LOCK ] = BGMOPEN; gubAnimSurfaceIndex[ BIGMALE ][ OPEN_DOOR_CROUCHED ] = BGMMEDIC; gubAnimSurfaceIndex[ BIGMALE ][ BEGIN_OPENSTRUCT_CROUCHED ] = BGMMEDIC; gubAnimSurfaceIndex[ BIGMALE ][ CLOSE_DOOR_CROUCHED ] = BGMMEDIC; @@ -1662,7 +1662,7 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ BIGMALE ][ SWAT_BACKWARDS ] = BGMSNEAKING; gubAnimSurfaceIndex[ BIGMALE ][ JUMP_OVER_BLOCKING_PERSON ] = BGMJUMPOVER; gubAnimSurfaceIndex[ BIGMALE ][ REFUEL_VEHICLE ] = BGMMEDIC; - gubAnimSurfaceIndex[ BIGMALE ][ LOCKPICK_CROUCHED ] = BGMMEDIC; + gubAnimSurfaceIndex[ BIGMALE ][ LOCKPICK_CROUCHED ] = BGMMEDIC; // crouch throwing gubAnimSurfaceIndex[ BIGMALE ][ THROW_ITEM_CROUCHED ] = BGMCRTHROW; @@ -1956,7 +1956,7 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ STOCKYMALE ][ STANDING_SHOOT_UNJAM ] = RGMSTANDAIM; gubAnimSurfaceIndex[ STOCKYMALE ][ CROUCH_SHOOT_UNJAM ] = RGMCROUCHAIM; gubAnimSurfaceIndex[ STOCKYMALE ][ PRONE_SHOOT_UNJAM ] = RGMPRONE; - gubAnimSurfaceIndex[ STOCKYMALE ][ STANDING_SHOOT_DWEL_UNJAM ] = RGMSTANDDWALAIM; + gubAnimSurfaceIndex[ STOCKYMALE ][ STANDING_SHOOT_DWEL_UNJAM ] = RGMSTANDDWALAIM; gubAnimSurfaceIndex[ STOCKYMALE ][ STANDING_SHOOT_LOW_UNJAM ] = RGMSHOOT_LOW; gubAnimSurfaceIndex[ STOCKYMALE ][ READY_DUAL_CROUCH ] = RGMCDBLSHOT; gubAnimSurfaceIndex[ STOCKYMALE ][ AIM_DUAL_CROUCH ] = RGMCDBLSHOT; @@ -2014,8 +2014,8 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ STOCKYMALE ][ AIM_DUAL_PRONE ] = RGMDWPRONE; gubAnimSurfaceIndex[ STOCKYMALE ][ SHOOT_DUAL_PRONE ] = RGMDWPRONE; gubAnimSurfaceIndex[ STOCKYMALE ][ END_DUAL_PRONE ] = RGMDWPRONE; - gubAnimSurfaceIndex[ STOCKYMALE ][ PRONE_SHOOT_DWEL_UNJAM ] = RGMDWPRONE; - gubAnimSurfaceIndex[ STOCKYMALE ][ PICK_LOCK ] = RGMOPEN; + gubAnimSurfaceIndex[ STOCKYMALE ][ PRONE_SHOOT_DWEL_UNJAM ] = RGMDWPRONE; + gubAnimSurfaceIndex[ STOCKYMALE ][ PICK_LOCK ] = RGMOPEN; gubAnimSurfaceIndex[ STOCKYMALE ][ OPEN_DOOR_CROUCHED ] = RGMMEDIC; gubAnimSurfaceIndex[ STOCKYMALE ][ BEGIN_OPENSTRUCT_CROUCHED ] = RGMMEDIC; gubAnimSurfaceIndex[ STOCKYMALE ][ CLOSE_DOOR_CROUCHED ] = RGMMEDIC; @@ -2030,7 +2030,7 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ STOCKYMALE ][ SWAT_BACKWARDS ] = RGMSNEAKING; gubAnimSurfaceIndex[ STOCKYMALE ][ JUMP_OVER_BLOCKING_PERSON ] = RGMJUMPOVER; gubAnimSurfaceIndex[ STOCKYMALE ][ REFUEL_VEHICLE ] = RGMMEDIC; - gubAnimSurfaceIndex[ STOCKYMALE ][ LOCKPICK_CROUCHED ] = RGMMEDIC; + gubAnimSurfaceIndex[ STOCKYMALE ][ LOCKPICK_CROUCHED ] = RGMMEDIC; // crouch throwing gubAnimSurfaceIndex[ STOCKYMALE ][ THROW_ITEM_CROUCHED ] = RGMCRTHROW; @@ -2307,10 +2307,10 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ REGFEMALE ][ WKAEUP_FROM_SLEEP ] = RGFSLEEP; gubAnimSurfaceIndex[ REGFEMALE ][ FIRE_LOW_STAND ] = RGFSHOOT_LOW; gubAnimSurfaceIndex[ REGFEMALE ][ FIRE_BURST_LOW_STAND ] = RGFSHOOT_LOW; - gubAnimSurfaceIndex[ REGFEMALE ][ STANDING_SHOOT_UNJAM ] = RGFSTANDAIM; + gubAnimSurfaceIndex[ REGFEMALE ][ STANDING_SHOOT_UNJAM ] = RGFSTANDAIM; gubAnimSurfaceIndex[ REGFEMALE ][ CROUCH_SHOOT_UNJAM ] = RGFCROUCHAIM; gubAnimSurfaceIndex[ REGFEMALE ][ PRONE_SHOOT_UNJAM ] = RGFPRONE; - gubAnimSurfaceIndex[ REGFEMALE ][ STANDING_SHOOT_DWEL_UNJAM ] = RGFSTANDDWALAIM; + gubAnimSurfaceIndex[ REGFEMALE ][ STANDING_SHOOT_DWEL_UNJAM ] = RGFSTANDDWALAIM; gubAnimSurfaceIndex[ REGFEMALE ][ STANDING_SHOOT_LOW_UNJAM ] = RGFSHOOT_LOW; gubAnimSurfaceIndex[ REGFEMALE ][ READY_DUAL_CROUCH ] = RGFCDBLSHOT; gubAnimSurfaceIndex[ REGFEMALE ][ AIM_DUAL_CROUCH ] = RGFCDBLSHOT; @@ -2370,7 +2370,7 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ REGFEMALE ][ SHOOT_DUAL_PRONE ] = RGFDWPRONE; gubAnimSurfaceIndex[ REGFEMALE ][ END_DUAL_PRONE ] = RGFDWPRONE; gubAnimSurfaceIndex[ REGFEMALE ][ PRONE_SHOOT_DWEL_UNJAM ] = RGFDWPRONE; - gubAnimSurfaceIndex[ REGFEMALE ][ PICK_LOCK ] = RGFOPEN; + gubAnimSurfaceIndex[ REGFEMALE ][ PICK_LOCK ] = RGFOPEN; gubAnimSurfaceIndex[ REGFEMALE ][ OPEN_DOOR_CROUCHED ] = RGFMEDIC; gubAnimSurfaceIndex[ REGFEMALE ][ BEGIN_OPENSTRUCT_CROUCHED ] = RGFMEDIC; gubAnimSurfaceIndex[ REGFEMALE ][ CLOSE_DOOR_CROUCHED ] = RGFMEDIC; @@ -2385,7 +2385,7 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ REGFEMALE ][ SWAT_BACKWARDS ] = RGFSNEAKING; gubAnimSurfaceIndex[ REGFEMALE ][ JUMP_OVER_BLOCKING_PERSON ] = RGFJUMPOVER; gubAnimSurfaceIndex[ REGFEMALE ][ REFUEL_VEHICLE ] = RGFMEDIC; - gubAnimSurfaceIndex[ REGFEMALE ][ LOCKPICK_CROUCHED ] = RGFMEDIC; + gubAnimSurfaceIndex[ REGFEMALE ][ LOCKPICK_CROUCHED ] = RGFMEDIC; // crouch throwing gubAnimSurfaceIndex[ REGFEMALE ][ THROW_ITEM_CROUCHED ] = RGFCRTHROW; @@ -2536,9 +2536,9 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ ADULTFEMALEMONSTER ][ ADULTMONSTER_HIT ] = AFMONSTERDIE; gubAnimSurfaceIndex[ ADULTFEMALEMONSTER ][ ADULTMONSTER_DYING ] = AFMONSTERDIE; gubAnimSurfaceIndex[ ADULTFEMALEMONSTER ][ ADULTMONSTER_DYING_STOP ] = AFMONSTERDIE; - gubAnimSurfaceIndex[ ADULTFEMALEMONSTER ][ MONSTER_CLOSE_ATTACK ] = AFMONSTERCLOSEATTACK; - gubAnimSurfaceIndex[ ADULTFEMALEMONSTER ][ MONSTER_SPIT_ATTACK ] = AFMONSTERSPITATTACK; - gubAnimSurfaceIndex[ ADULTFEMALEMONSTER ][ MONSTER_BEGIN_EATTING_FLESH ] = AFMONSTEREATING; + gubAnimSurfaceIndex[ ADULTFEMALEMONSTER ][ MONSTER_CLOSE_ATTACK ] = AFMONSTERCLOSEATTACK; + gubAnimSurfaceIndex[ ADULTFEMALEMONSTER ][ MONSTER_SPIT_ATTACK ] = AFMONSTERSPITATTACK; + gubAnimSurfaceIndex[ ADULTFEMALEMONSTER ][ MONSTER_BEGIN_EATTING_FLESH ] = AFMONSTEREATING; gubAnimSurfaceIndex[ ADULTFEMALEMONSTER ][ MONSTER_EATTING_FLESH ] = AFMONSTEREATING; gubAnimSurfaceIndex[ ADULTFEMALEMONSTER ][ MONSTER_END_EATTING_FLESH ] = AFMONSTEREATING; gubAnimSurfaceIndex[ ADULTFEMALEMONSTER ][ MONSTER_UP ] = AFMUP; @@ -2558,8 +2558,8 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ AM_MONSTER ][ ADULTMONSTER_HIT ] = AFMONSTERDIE; gubAnimSurfaceIndex[ AM_MONSTER ][ ADULTMONSTER_DYING ] = AFMONSTERDIE; gubAnimSurfaceIndex[ AM_MONSTER ][ ADULTMONSTER_DYING_STOP ] = AFMONSTERDIE; - gubAnimSurfaceIndex[ AM_MONSTER ][ MONSTER_CLOSE_ATTACK ] = AFMONSTERCLOSEATTACK; - gubAnimSurfaceIndex[ AM_MONSTER ][ MONSTER_SPIT_ATTACK ] = AFMONSTERSPITATTACK; + gubAnimSurfaceIndex[ AM_MONSTER ][ MONSTER_CLOSE_ATTACK ] = AFMONSTERCLOSEATTACK; + gubAnimSurfaceIndex[ AM_MONSTER ][ MONSTER_SPIT_ATTACK ] = AFMONSTERSPITATTACK; gubAnimSurfaceIndex[ AM_MONSTER ][ MONSTER_BEGIN_EATTING_FLESH ] = AFMONSTEREATING; gubAnimSurfaceIndex[ AM_MONSTER ][ MONSTER_EATTING_FLESH ] = AFMONSTEREATING; gubAnimSurfaceIndex[ AM_MONSTER ][ MONSTER_END_EATTING_FLESH ] = AFMONSTEREATING; @@ -2580,8 +2580,8 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ YAF_MONSTER ][ ADULTMONSTER_HIT ] = AFMONSTERDIE; gubAnimSurfaceIndex[ YAF_MONSTER ][ ADULTMONSTER_DYING ] = AFMONSTERDIE; gubAnimSurfaceIndex[ YAF_MONSTER ][ ADULTMONSTER_DYING_STOP ] = AFMONSTERDIE; - gubAnimSurfaceIndex[ YAF_MONSTER ][ MONSTER_CLOSE_ATTACK ] = AFMONSTERCLOSEATTACK; - gubAnimSurfaceIndex[ YAF_MONSTER ][ MONSTER_SPIT_ATTACK ] = AFMONSTERSPITATTACK; + gubAnimSurfaceIndex[ YAF_MONSTER ][ MONSTER_CLOSE_ATTACK ] = AFMONSTERCLOSEATTACK; + gubAnimSurfaceIndex[ YAF_MONSTER ][ MONSTER_SPIT_ATTACK ] = AFMONSTERSPITATTACK; gubAnimSurfaceIndex[ YAF_MONSTER ][ MONSTER_BEGIN_EATTING_FLESH ] = AFMONSTEREATING; gubAnimSurfaceIndex[ YAF_MONSTER ][ MONSTER_EATTING_FLESH ] = AFMONSTEREATING; gubAnimSurfaceIndex[ YAF_MONSTER ][ MONSTER_END_EATTING_FLESH ] = AFMONSTEREATING; @@ -2603,8 +2603,8 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ YAM_MONSTER ][ ADULTMONSTER_HIT ] = AFMONSTERDIE; gubAnimSurfaceIndex[ YAM_MONSTER ][ ADULTMONSTER_DYING ] = AFMONSTERDIE; gubAnimSurfaceIndex[ YAM_MONSTER ][ ADULTMONSTER_DYING_STOP ] = AFMONSTERDIE; - gubAnimSurfaceIndex[ YAM_MONSTER ][ MONSTER_CLOSE_ATTACK ] = AFMONSTERCLOSEATTACK; - gubAnimSurfaceIndex[ YAM_MONSTER ][ MONSTER_SPIT_ATTACK ] = AFMONSTERSPITATTACK; + gubAnimSurfaceIndex[ YAM_MONSTER ][ MONSTER_CLOSE_ATTACK ] = AFMONSTERCLOSEATTACK; + gubAnimSurfaceIndex[ YAM_MONSTER ][ MONSTER_SPIT_ATTACK ] = AFMONSTERSPITATTACK; gubAnimSurfaceIndex[ YAM_MONSTER ][ MONSTER_BEGIN_EATTING_FLESH ] = AFMONSTEREATING; gubAnimSurfaceIndex[ YAM_MONSTER ][ MONSTER_EATTING_FLESH ] = AFMONSTEREATING; gubAnimSurfaceIndex[ YAM_MONSTER ][ MONSTER_END_EATTING_FLESH ] = AFMONSTEREATING; @@ -2634,7 +2634,7 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ INFANT_MONSTER ][ INFANT_BEGIN_EATTING_FLESH ] = IEAT; gubAnimSurfaceIndex[ INFANT_MONSTER ][ INFANT_EATTING_FLESH ] = IEAT; gubAnimSurfaceIndex[ INFANT_MONSTER ][ INFANT_END_EATTING_FLESH ] = IEAT; - gubAnimSurfaceIndex[ INFANT_MONSTER ][ WALK_BACKWARDS ] = IWALK; + gubAnimSurfaceIndex[ INFANT_MONSTER ][ WALK_BACKWARDS ] = IWALK; gubAnimSurfaceCorpseID[ INFANT_MONSTER ][ INFANT_DIE ] = INFANTMONSTER_DEAD; @@ -2651,7 +2651,7 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ QUEENMONSTER ][ QUEEN_SPIT ] = QUEENMONSTERSPIT_SW; gubAnimSurfaceIndex[ QUEENMONSTER ][ QUEEN_SWIPE ] = QUEENMONSTERSWIPE; - gubAnimSurfaceCorpseID[ QUEENMONSTER ][ QUEEN_DIE ] = QUEEN_MONSTER_DEAD; + gubAnimSurfaceCorpseID[ QUEENMONSTER ][ QUEEN_DIE ] = QUEEN_MONSTER_DEAD; ////// @@ -2894,10 +2894,10 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ CRIPPLECIV ][ CRIPPLE_DIE_FLYBACK ] = CRIPCIVDIE2; gubAnimSurfaceIndex[ CRIPPLECIV ][ CRIPPLE_DIE_FLYBACK_STOP ] = CRIPCIVDIE2; gubAnimSurfaceIndex[ CRIPPLECIV ][ CRIPPLE_KICKOUT ] = CRIPCIVKICK; - gubAnimSurfaceIndex[ CRIPPLECIV ][ CRIPPLE_OPEN_DOOR ] = CRIPCIVBEG; - gubAnimSurfaceIndex[ CRIPPLECIV ][ CRIPPLE_CLOSE_DOOR ] = CRIPCIVBEG; - gubAnimSurfaceIndex[ CRIPPLECIV ][ CRIPPLE_END_OPEN_DOOR ] = CRIPCIVBEG; - gubAnimSurfaceIndex[ CRIPPLECIV ][ CRIPPLE_END_OPEN_LOCKED_DOOR ] = CRIPCIVBEG; + gubAnimSurfaceIndex[ CRIPPLECIV ][ CRIPPLE_OPEN_DOOR ] = CRIPCIVBEG; + gubAnimSurfaceIndex[ CRIPPLECIV ][ CRIPPLE_CLOSE_DOOR ] = CRIPCIVBEG; + gubAnimSurfaceIndex[ CRIPPLECIV ][ CRIPPLE_END_OPEN_DOOR ] = CRIPCIVBEG; + gubAnimSurfaceIndex[ CRIPPLECIV ][ CRIPPLE_END_OPEN_LOCKED_DOOR ] = CRIPCIVBEG; gubAnimSurfaceCorpseID[ CRIPPLECIV ][ CRIPPLE_DIE ] = SMERC_BCK; @@ -2963,14 +2963,14 @@ void InitAnimationSurfacesPerBodytype( ) gRandomAnimDefs[ CROW ][ 0 ].ubStartRoll = 0; gRandomAnimDefs[ CROW ][ 0 ].ubEndRoll = 50; gRandomAnimDefs[ CROW ][ 0 ].ubAnimHeight = ANIM_STAND; - strcpy( gRandomAnimDefs[ CROW ][ 0 ].zSoundFile, "SOUNDS\\CROW3.WAV" ); + strcpy( gRandomAnimDefs[ CROW ][ 0 ].zSoundFile, "SOUNDS\\CROW3.WAV" ); gRandomAnimDefs[ CROW ][ 1 ].ubHandRestriction = RANDOM_ANIM_IRRELEVENTINHAND; gRandomAnimDefs[ CROW ][ 1 ].sAnimID = RANDOM_ANIM_SOUND; gRandomAnimDefs[ CROW ][ 1 ].ubStartRoll = 51; gRandomAnimDefs[ CROW ][ 1 ].ubEndRoll = 70; gRandomAnimDefs[ CROW ][ 1 ].ubAnimHeight = ANIM_STAND; - strcpy( gRandomAnimDefs[ CROW ][ 1 ].zSoundFile, "SOUNDS\\CROW2.WAV" ); + strcpy( gRandomAnimDefs[ CROW ][ 1 ].zSoundFile, "SOUNDS\\CROW2.WAV" ); // BLOOD CAT gubAnimSurfaceIndex[ BLOODCAT ][ STANDING ] = CATBREATH; @@ -2998,7 +2998,7 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ ROBOTNOWEAPON ][ ROBOT_SHOOT ] = ROBOTNWSHOOT; gubAnimSurfaceIndex[ ROBOTNOWEAPON ][ ROBOT_BURST_SHOOT ] = ROBOTNWSHOOT; gubAnimSurfaceIndex[ ROBOTNOWEAPON ][ ROBOT_CAMERA_NOT_MOVING ] = ROBOTNWBREATH; - gubAnimSurfaceCorpseID[ ROBOTNOWEAPON ][ ROBOTNW_DIE ] = ROBOT_DEAD; + gubAnimSurfaceCorpseID[ ROBOTNOWEAPON ][ ROBOTNW_DIE ] = ROBOT_DEAD; @@ -3006,7 +3006,7 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ HUMVEE ][ STANDING ] = HUMVEE_BASIC; gubAnimSurfaceIndex[ HUMVEE ][ WALKING ] = HUMVEE_BASIC; gubAnimSurfaceIndex[ HUMVEE ][ VEHICLE_DIE ] = HUMVEE_DIE; - gubAnimSurfaceCorpseID[ HUMVEE ][ STANDING ] = HUMMER_DEAD; + gubAnimSurfaceCorpseID[ HUMVEE ][ STANDING ] = HUMMER_DEAD; // TANK gubAnimSurfaceIndex[ TANK_NW ][ STANDING ] = TANKNW_READY; @@ -3033,7 +3033,7 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ ICECREAMTRUCK ][ STANDING ] = ICECREAMTRUCK_BASIC; gubAnimSurfaceIndex[ ICECREAMTRUCK ][ WALKING ] = ICECREAMTRUCK_BASIC; gubAnimSurfaceIndex[ ICECREAMTRUCK ][ VEHICLE_DIE ] = HUMVEE_DIE; - gubAnimSurfaceCorpseID[ ICECREAMTRUCK ][ STANDING ] = ICECREAM_DEAD; + gubAnimSurfaceCorpseID[ ICECREAMTRUCK ][ STANDING ] = ICECREAM_DEAD; // JEEP gubAnimSurfaceIndex[ JEEP ][ STANDING ] = JEEP_BASIC; @@ -3063,7 +3063,7 @@ BOOLEAN LoadAnimationStateInstructions( ) FileClose( hFile ); // crouch throwing - memcpy(gusAnimInst[ THROW_ITEM_CROUCHED ],CrouchedThrowAnimationScript,sizeof(CrouchedThrowAnimationScript)); + memcpy(gusAnimInst[ THROW_ITEM_CROUCHED ],CrouchedThrowAnimationScript,sizeof(CrouchedThrowAnimationScript)); // crouch throwing return( TRUE ); @@ -3337,7 +3337,7 @@ BOOLEAN SetSoldierAnimationSurface( SOLDIERTYPE *pSoldier, UINT16 usAnimState ) usAnimSurface = LoadSoldierAnimationSurface( pSoldier, usAnimState ); // Add structure info! - if ( pSoldier->pLevelNode != NULL && !( pSoldier->uiStatusFlags & SOLDIER_PAUSEANIMOVE ) ) + if ( pSoldier->pLevelNode != NULL && !( pSoldier->flags.uiStatusFlags & SOLDIER_PAUSEANIMOVE ) ) { AddMercStructureInfoFromAnimSurface( pSoldier->sGridNo, pSoldier, usAnimSurface, usAnimState ); } @@ -3379,7 +3379,7 @@ UINT16 gusQueenMonsterSpitAnimPerDir[] = QUEENMONSTERSPIT_NE, //NORTH QUEENMONSTERSPIT_E, QUEENMONSTERSPIT_SE, // EAST - QUEENMONSTERSPIT_S, + QUEENMONSTERSPIT_S, QUEENMONSTERSPIT_SW, // SOUTH QUEENMONSTERSPIT_SW, QUEENMONSTERSPIT_SW, // WEST @@ -3492,15 +3492,14 @@ UINT16 DetermineSoldierAnimationSurface( SOLDIERTYPE *pSoldier, UINT16 usAnimSta // ADJUST ANIMATION SURFACE BASED ON TERRAIN // CHECK FOR WATER - if ( MercInWater( pSoldier ) ) + if ( pSoldier->MercInWater( ) ) { - - // ADJUST BASED ON ITEM IN HAND.... - usItem = pSoldier->inv[ HANDPOS ].usItem; - // Default it to the 1 ( ie: no rifle ) - if ( usItem != NOTHING ) + if ( pSoldier->inv[ HANDPOS ].exists() == true ) { + // ADJUST BASED ON ITEM IN HAND.... + usItem = pSoldier->inv[ HANDPOS ].usItem; + if ( ( Item[ usItem ].usItemClass == IC_GUN || Item[ usItem ].usItemClass == IC_LAUNCHER ) && !Item[usItem].rocketlauncher) { // if ( (Item[ usItem ].fFlags & ITEM_TWO_HANDED) ) @@ -3565,7 +3564,7 @@ UINT16 DetermineSoldierAnimationSurface( SOLDIERTYPE *pSoldier, UINT16 usAnimSta if ( Item[ pSoldier->inv[ SECONDHANDPOS ].usItem ].usItemClass == IC_GUN ) { usAnimSurface = gDoubleHandledSub.usAnimationSurfaces[ pSoldier->ubBodyType ]; - fAdjustedForItem = TRUE; + fAdjustedForItem = TRUE; } } @@ -3586,8 +3585,8 @@ UINT16 DetermineSoldierAnimationSurface( SOLDIERTYPE *pSoldier, UINT16 usAnimSta // Based on if we have adjusted for item or not... check for injured status... if ( fAdjustedForItem ) { - // If life below thresthold for being injured - if ( pSoldier->bLife < INJURED_CHANGE_THREASHOLD ) + // If life below thresthold for being injured + if ( pSoldier->stats.bLife < INJURED_CHANGE_THREASHOLD ) { // ADJUST FOR INJURED.... for ( cnt = 0; cnt < NUM_INJURED_SUBS; cnt++ ) @@ -3601,8 +3600,8 @@ UINT16 DetermineSoldierAnimationSurface( SOLDIERTYPE *pSoldier, UINT16 usAnimSta } else { - // If life below thresthold for being injured - if ( pSoldier->bLife < INJURED_CHANGE_THREASHOLD ) + // If life below thresthold for being injured + if ( pSoldier->stats.bLife < INJURED_CHANGE_THREASHOLD ) { // ADJUST FOR INJURED.... for ( cnt = 0; cnt < NUM_INJURED_SUBS; cnt++ ) @@ -3634,7 +3633,7 @@ UINT16 GetSoldierAnimationSurface( SOLDIERTYPE *pSoldier, UINT16 usAnimState ) // Ensure that it's loaded! if ( gAnimSurfaceDatabase[ usAnimSurface ].hVideoObject == NULL ) { - ScreenMsg( FONT_MCOLOR_RED, MSG_BETAVERSION, L"IAnimation Surface for Body %d, animation %S, surface %d not loaded.", pSoldier->ubBodyType, gAnimControl[ usAnimState ].zAnimStr, usAnimSurface ); + ScreenMsg( FONT_MCOLOR_RED, MSG_BETAVERSION, L"IAnimation Surface for Body %d, animation %S, surface %d not loaded.", pSoldier->ubBodyType, gAnimControl[ usAnimState ].zAnimStr, usAnimSurface ); AnimDebugMsg( String( "Surface Database: PROBLEMS!!!!!!" ) ); usAnimSurface = INVALID_ANIMATION_SURFACE; } diff --git a/Tactical/Animation Control.h b/Tactical/Animation Control.h index 3c63f3a2..9278ec89 100644 --- a/Tactical/Animation Control.h +++ b/Tactical/Animation Control.h @@ -56,19 +56,19 @@ #define ANIM_RAISE_WEAPON 0x00080000 #define ANIM_NOCHANGE_WEAPON 0x00100000 #define ANIM_NOCHANGE_PENDINGCOUNT 0x00200000 -// I'm commandeering the effort flags. I do not expect to see multiple efforts for the same tasks, so I'm turning them into a 2-bit -// level instead. So there :P +// I'm commandeering the effort flags. I do not expect to see multiple efforts for the same tasks, so I'm turning them into a 2-bit +// level instead. So there :P #define ANIM_NO_EFFORT 0x00000000 #define ANIM_MIN_EFFORT 0x00400000 #define ANIM_LIGHT_EFFORT 0x00800000 #define ANIM_MODERATE_EFFORT 0x00C00000 -// Return a number between 0 and 4 to indicate effort. 4 means variable +// Return a number between 0 and 4 to indicate effort. 4 means variable #define EFFORT(flags) (((flags) & ANIM_VARIABLE_EFFORT) ? 4 : ((flags) & 0x00C00000) >> 22) -// Now I have room for a new flag. And there's still room for one more! -#define ANIM_ATTACK 0x01000000 -#define ANIM_FREEFORUSE 0x02000000 +// Now I have room for a new flag. And there's still room for one more! +#define ANIM_ATTACK 0x01000000 +#define ANIM_FREEFORUSE 0x02000000 #define ANIM_RT_NONINTERRUPT 0x04000000 #define ANIM_VARIABLE_EFFORT 0x08000000 @@ -531,17 +531,17 @@ enum AnimationStates ATTACH_CAN_TO_STRING, SWAT_BACKWARDS, JUMP_OVER_BLOCKING_PERSON, - REFUEL_VEHICLE, - ROBOT_CAMERA_NOT_MOVING, - CRIPPLE_OPEN_DOOR, - CRIPPLE_CLOSE_DOOR, + REFUEL_VEHICLE, + ROBOT_CAMERA_NOT_MOVING, + CRIPPLE_OPEN_DOOR, + CRIPPLE_CLOSE_DOOR, CRIPPLE_END_OPEN_DOOR, CRIPPLE_END_OPEN_LOCKED_DOOR, - LOCKPICK_CROUCHED, + LOCKPICK_CROUCHED, - // crouch throwing - THROW_ITEM_CROUCHED, - // + // crouch throwing + THROW_ITEM_CROUCHED, + // NUMANIMATIONSTATES diff --git a/Tactical/Animation Data.cpp b/Tactical/Animation Data.cpp index d152cf50..425b74ce 100644 --- a/Tactical/Animation Data.cpp +++ b/Tactical/Animation Data.cpp @@ -9,7 +9,7 @@ #include "debug.h" #include "Animation Data.h" #include "Animation Control.h" - #include "Soldier Control.h" + #include "jascreens.h" #include "tiledef.h" #include "Sys Globals.h" @@ -20,6 +20,11 @@ #include "Fileman.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + #define EMPTY_SLOT -1 #define TO_INIT 0 @@ -36,9 +41,9 @@ INT8 gbAnimUsageHistory[ NUMANIMATIONSURFACETYPES ][ MAX_NUM_SOLDIERS ]; AnimationSurfaceType gAnimSurfaceDatabase[ NUMANIMATIONSURFACETYPES ] = { - RGMBASICWALKING, "ANIMS\\S_MERC\\S_R_WALK.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + RGMBASICWALKING, "ANIMS\\S_MERC\\S_R_WALK.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, RGMSTANDING, "ANIMS\\S_MERC\\S_R_STD.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, - RGMCROUCHING, "ANIMS\\S_MERC\\S_R_C.STI", C_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + RGMCROUCHING, "ANIMS\\S_MERC\\S_R_C.STI", C_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, RGMSNEAKING, "ANIMS\\S_MERC\\S_R_SWAT.STI", C_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, RGMRUNNING, "ANIMS\\S_MERC\\S_R_RUN.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, RGMPRONE, "ANIMS\\S_MERC\\S_R_PRN.STI", P_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, 0, @@ -53,7 +58,7 @@ AnimationSurfaceType gAnimSurfaceDatabase[ NUMANIMATIONSURFACETYPES ] = RGMFALL, "ANIMS\\S_MERC\\S_FALL.STI", S_STRUCT, 0, 4, TO_INIT, NULL, NULL, 0, -1, RGMFALLF, "ANIMS\\S_MERC\\S_FALLF.STI", S_STRUCT, 0, 4, TO_INIT, NULL, NULL, 0, -1, RGMHITCROUCH, "ANIMS\\S_MERC\\S_C_DIE.STI", C_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, - RGMHITPRONE, "ANIMS\\S_MERC\\S_P_DIE.STI", P_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + RGMHITPRONE, "ANIMS\\S_MERC\\S_P_DIE.STI", P_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, RGMHOPFENCE, "ANIMS\\S_MERC\\S_HOP.STI", NO_STRUCT, 0, 4, TO_INIT, NULL, NULL, 0, -1, RGMPUNCH, "ANIMS\\S_MERC\\S_PUNCH.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, RGMNOTHING_STD, "ANIMS\\S_MERC\\S_N_STD.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, @@ -130,7 +135,7 @@ AnimationSurfaceType gAnimSurfaceDatabase[ NUMANIMATIONSURFACETYPES ] = BGMWALKING, "ANIMS\\M_MERC\\M_R_WALK.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, BGMSTANDING, "ANIMS\\M_MERC\\M_R_STD.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, - BGMCROUCHING, "ANIMS\\M_MERC\\M_R_C.STI", C_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + BGMCROUCHING, "ANIMS\\M_MERC\\M_R_C.STI", C_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, BGMSNEAKING, "ANIMS\\M_MERC\\M_R_SWAT.STI", C_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, BGMRUNNING, "ANIMS\\M_MERC\\M_R_RUN2.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, BGMPRONE, "ANIMS\\M_MERC\\M_R_PRN.STI", P_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, 0, @@ -182,7 +187,7 @@ AnimationSurfaceType gAnimSurfaceDatabase[ NUMANIMATIONSURFACETYPES ] = BGMWATER_DIE, "ANIMS\\M_MERC\\MW_DIE.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, BGMWATER_N_AIM, "ANIMS\\M_MERC\\MW_N_SHT.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, BGMWATER_R_AIM, "ANIMS\\M_MERC\\MW_SR_AM.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, - BGMWATER_DBLSHT, "ANIMS\\M_MERC\\MW_DBL.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + BGMWATER_DBLSHT, "ANIMS\\M_MERC\\MW_DBL.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, BGMWATER_TRANS, "ANIMS\\M_MERC\\MW_FALL.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, BGMDEEPWATER_TRED, "ANIMS\\M_MERC\\MW_TRED.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, BGMDEEPWATER_SWIM, "ANIMS\\M_MERC\\MW_SWIM.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, @@ -224,7 +229,7 @@ AnimationSurfaceType gAnimSurfaceDatabase[ NUMANIMATIONSURFACETYPES ] = RGFWALKING, "ANIMS\\F_MERC\\F_R_WALK.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, RGFSTANDING, "ANIMS\\F_MERC\\F_BRETH2.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, - RGFCROUCHING, "ANIMS\\F_MERC\\F_R_C.STI", C_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + RGFCROUCHING, "ANIMS\\F_MERC\\F_R_C.STI", C_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, RGFSNEAKING, "ANIMS\\F_MERC\\F_R_SWAT.STI", C_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, RGFRUNNING, "ANIMS\\F_MERC\\F_R_RUN.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, RGFPRONE, "ANIMS\\F_MERC\\F_R_PRN.STI", P_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, 0, @@ -239,7 +244,7 @@ AnimationSurfaceType gAnimSurfaceDatabase[ NUMANIMATIONSURFACETYPES ] = RGFFALL, "ANIMS\\F_MERC\\F_FALL.STI", S_STRUCT, 0, 4, TO_INIT, NULL, NULL, 0, -1, RGFFALLF, "ANIMS\\F_MERC\\F_FALLF.STI", S_STRUCT, 0, 4, TO_INIT, NULL, NULL, 0, -1, RGFHITCROUCH, "ANIMS\\F_MERC\\F_C_DIE.STI", C_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, - RGFHITPRONE, "ANIMS\\F_MERC\\F_P_DIE.STI", P_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + RGFHITPRONE, "ANIMS\\F_MERC\\F_P_DIE.STI", P_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, RGFHOPFENCE, "ANIMS\\F_MERC\\F_HOP.STI", NO_STRUCT, 0, 4, TO_INIT, NULL, NULL, 0, -1, RGFPUNCH, "ANIMS\\F_MERC\\F_PUNCH.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, RGFNOTHING_STD, "ANIMS\\F_MERC\\N_BRETH2.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, @@ -309,7 +314,7 @@ AnimationSurfaceType gAnimSurfaceDatabase[ NUMANIMATIONSURFACETYPES ] = RGFCROWBAR, "ANIMS\\F_MERC\\F_CROBAR.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, RGFJUMPOVER, "ANIMS\\F_MERC\\F_N_RUN.STI", NO_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, - + AFMONSTERSTANDING, "ANIMS\\MONSTERS\\MN_BREAT.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, AFMONSTERWALKING, "ANIMS\\MONSTERS\\MN_WALK.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, AFMONSTERATTACK, "ANIMS\\MONSTERS\\MN_ATTAK.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, @@ -320,7 +325,7 @@ AnimationSurfaceType gAnimSurfaceDatabase[ NUMANIMATIONSURFACETYPES ] = AFMUP, "ANIMS\\MONSTERS\\MN_UP.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, AFMJUMP, "ANIMS\\MONSTERS\\MN_JUMP.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, AFMMELT, "ANIMS\\MONSTERS\\MN_MELT.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, - + LVBREATH, "ANIMS\\MONSTERS\\L_BREATH.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, LVDIE, "ANIMS\\MONSTERS\\L_DIE.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, @@ -443,13 +448,13 @@ AnimationSurfaceType gAnimSurfaceDatabase[ NUMANIMATIONSURFACETYPES ] = HUMVEE_DIE, "ANIMS\\VEHICLES\\HM_WREK.STI", S_STRUCT, 0, 2, TO_INIT, NULL, NULL, 0, -1, TANKNW_READY, "ANIMS\\VEHICLES\\TANK_ROT.STI", S_STRUCT, ANIM_DATA_FLAG_NOFRAMES, 32, TO_INIT, NULL, NULL, 0, -1, - TANKNW_SHOOT, "ANIMS\\VEHICLES\\TANK_SHT.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, - TANKNW_DIE, "ANIMS\\VEHICLES\\TK_WREK.STI", S_STRUCT, 0, 1, TO_INIT, NULL, NULL, 0, -1, + TANKNW_SHOOT, "ANIMS\\VEHICLES\\TANK_SHT.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + TANKNW_DIE, "ANIMS\\VEHICLES\\TK_WREK.STI", S_STRUCT, 0, 1, TO_INIT, NULL, NULL, 0, -1, TANKNE_READY, "ANIMS\\VEHICLES\\TNK2_ROT.STI", S_STRUCT, ANIM_DATA_FLAG_NOFRAMES, 32, TO_INIT, NULL, NULL, 0, -1, - TANKNE_SHOOT, "ANIMS\\VEHICLES\\TNK2_SHT.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, - TANKNE_DIE, "ANIMS\\VEHICLES\\TK2_WREK.STI", S_STRUCT, 0, 1, TO_INIT, NULL, NULL, 0, -1, - //Kaiden: Below, I have replaced HUMMER2.STI with + TANKNE_SHOOT, "ANIMS\\VEHICLES\\TNK2_SHT.STI", S_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + TANKNE_DIE, "ANIMS\\VEHICLES\\TK2_WREK.STI", S_STRUCT, 0, 1, TO_INIT, NULL, NULL, 0, -1, + //Kaiden: Below, I have replaced HUMMER2.STI with // ELDORADO.STI and JEEP.STI respectively, // This has not been tested for effect, however, // It should not result in anything worse than @@ -637,7 +642,7 @@ AnimationStructureType gAnimStructureDatabase[ TOTALBODYTYPES ][ NUM_STRUCT_IDS "ANIMS\\STRUCTDATA\\CR_PRONE.JSD", NULL, "ANIMS\\STRUCTDATA\\CR_PRONE.JSD", NULL, "ANIMS\\STRUCTDATA\\M_CROUCH.JSD", NULL, // default - + // CAT "ANIMS\\STRUCTDATA\\CT_BREATH.JSD", NULL, "ANIMS\\STRUCTDATA\\CT_BREATH.JSD", NULL, @@ -734,10 +739,10 @@ BOOLEAN InitAnimationSystem( ) pStructureFileRef = LoadStructureFile( sFilename ); if (pStructureFileRef == NULL) { - SET_ERROR( "Animation structure file load failed - %s", sFilename ); + SET_ERROR( "Animation structure file load failed - %s", sFilename ); } gAnimStructureDatabase[ cnt1 ][ cnt2 ].pStructureFileRef = pStructureFileRef; - } + } } } @@ -746,19 +751,19 @@ BOOLEAN InitAnimationSystem( ) BOOLEAN DeInitAnimationSystem( ) { - INT32 cnt1, cnt2; + INT32 cnt1, cnt2; - for ( cnt1 = 0; cnt1 < NUMANIMATIONSURFACETYPES; cnt1++ ) - { + for ( cnt1 = 0; cnt1 < NUMANIMATIONSURFACETYPES; cnt1++ ) + { if ( gAnimSurfaceDatabase[ cnt1 ].hVideoObject != NULL ) { DeleteVideoObject( gAnimSurfaceDatabase[ cnt1 ].hVideoObject ); gAnimSurfaceDatabase[ cnt1 ].hVideoObject = NULL; } - } + } // OK, Delete all animation structures..... - // ATE: OK, don't delete here.. we be deleted when the structure database is destoryed.... + // ATE: OK, don't delete here.. we be deleted when the structure database is destoryed.... for ( cnt1 = 0; cnt1 < TOTALBODYTYPES; cnt1++ ) { for ( cnt2 = 0; cnt2 < 3; cnt2++ ) @@ -771,9 +776,9 @@ BOOLEAN DeInitAnimationSystem( ) } } - DeleteAnimationProfiles( ); + DeleteAnimationProfiles( ); - return( TRUE ); + return( TRUE ); } @@ -786,7 +791,7 @@ STRUCTURE_FILE_REF *InternalGetAnimationStructureRef( UINT8 usSoldierID, UINT16 { return( NULL ); } - + bStructDataType = gAnimSurfaceDatabase[ usSurfaceIndex ].bStructDataType; if ( bStructDataType == NO_STRUCT ) @@ -797,12 +802,12 @@ STRUCTURE_FILE_REF *InternalGetAnimationStructureRef( UINT8 usSoldierID, UINT16 // ATE: Alright - we all hate exception coding but ness here... // return STANDING struct for these - which start standing but end prone // CJC August 14 2002: added standing burst hit to this list - if ( ( usAnimState == FALLFORWARD_FROMHIT_STAND || usAnimState == GENERIC_HIT_STAND || - usAnimState == FALLFORWARD_FROMHIT_CROUCH || usAnimState == STANDING_BURST_HIT ) && !fUseAbsolute ) + if ( ( usAnimState == FALLFORWARD_FROMHIT_STAND || usAnimState == GENERIC_HIT_STAND || + usAnimState == FALLFORWARD_FROMHIT_CROUCH || usAnimState == STANDING_BURST_HIT ) && !fUseAbsolute ) { return( gAnimStructureDatabase[ MercPtrs[ usSoldierID ]->ubBodyType ][ S_STRUCT ].pStructureFileRef ); } - + return( gAnimStructureDatabase[ MercPtrs[ usSoldierID ]->ubBodyType ][ bStructDataType ].pStructureFileRef ); } @@ -852,14 +857,14 @@ BOOLEAN LoadAnimationSurface( UINT16 usSoldierID, UINT16 usSurfaceIndex, UINT16 sprintf( gSystemDebugStr, "Cache Load" ); - // Create video object + // Create video object FilenameForBPP(gAnimSurfaceDatabase[ usSurfaceIndex ].Filename, sFilename); hImage = CreateImage(/*gAnimSurfaceDatabase[ usSurfaceIndex ].Filename*/sFilename, IMAGE_ALLDATA ); - if (hImage == NULL) - { - return( SET_ERROR( "Error: Could not load animation file %s", sFilename ) ); - } + if (hImage == NULL) + { + return( SET_ERROR( "Error: Could not load animation file %s", sFilename ) ); + } VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMHIMAGE; VObjectDesc.hImage = hImage; @@ -881,7 +886,7 @@ BOOLEAN LoadAnimationSurface( UINT16 usSoldierID, UINT16 usSurfaceIndex, UINT16 // Valid auxiliary data, so get # od frames from data pAuxData = ( AuxObjectData* ) hImage->pAppData; - gAnimSurfaceDatabase[ usSurfaceIndex ].uiNumFramesPerDir = pAuxData->ubNumberOfFrames; + gAnimSurfaceDatabase[ usSurfaceIndex ].uiNumFramesPerDir = pAuxData->ubNumberOfFrames; } else @@ -893,7 +898,7 @@ BOOLEAN LoadAnimationSurface( UINT16 usSoldierID, UINT16 usSurfaceIndex, UINT16 } // get structure data if any - pStructureFileRef = InternalGetAnimationStructureRef( usSoldierID, usSurfaceIndex, usAnimState, TRUE ); + pStructureFileRef = InternalGetAnimationStructureRef( (UINT8)usSoldierID, usSurfaceIndex, usAnimState, TRUE ); if ( pStructureFileRef != NULL ) { @@ -912,20 +917,20 @@ BOOLEAN LoadAnimationSurface( UINT16 usSoldierID, UINT16 usSurfaceIndex, UINT16 { DestroyImage( hImage ); DeleteVideoObject( hVObject ); - SET_ERROR( "Animation structure ZStrip creation error: %s", sFilename ); + SET_ERROR( "Animation structure ZStrip creation error: %s", sFilename ); return( FALSE ); } - + } - // the hImage is no longer needed - DestroyImage( hImage ); + // the hImage is no longer needed + DestroyImage( hImage ); // Set video object index gAnimSurfaceDatabase[ usSurfaceIndex ].hVideoObject = hVObject; // Determine if we have a problem with #frames + directions ( ie mismatch ) - if ( ( gAnimSurfaceDatabase[ usSurfaceIndex ].uiNumDirections * gAnimSurfaceDatabase[ usSurfaceIndex ].uiNumFramesPerDir ) != gAnimSurfaceDatabase[ usSurfaceIndex ].hVideoObject->usNumberOfObjects ) + if ( ( gAnimSurfaceDatabase[ usSurfaceIndex ].uiNumDirections * gAnimSurfaceDatabase[ usSurfaceIndex ].uiNumFramesPerDir ) != gAnimSurfaceDatabase[ usSurfaceIndex ].hVideoObject->usNumberOfObjects ) { AnimDebugMsg( String( "Surface Database: WARNING!!! Surface %d has #frames mismatch.", usSurfaceIndex ) ); } @@ -936,7 +941,7 @@ BOOLEAN LoadAnimationSurface( UINT16 usSoldierID, UINT16 usSurfaceIndex, UINT16 { AnimDebugMsg( String( "Surface Database: Incrementing Usage %d ( Soldier %d )", usSurfaceIndex, usSoldierID ) ); // Increment usage count - gAnimSurfaceDatabase[ usSurfaceIndex ].bUsageCount++; + gAnimSurfaceDatabase[ usSurfaceIndex ].bUsageCount++; // Set history for particular sodlier gbAnimUsageHistory[ usSurfaceIndex ][ usSoldierID ]++; @@ -960,7 +965,7 @@ BOOLEAN UnLoadAnimationSurface( UINT16 usSoldierID, UINT16 usSurfaceIndex ) { // Decrement usage count AnimDebugMsg( String( "Surface Database: Decrementing Usage %d ( Soldier %d )", usSurfaceIndex, usSoldierID ) ); - gAnimSurfaceDatabase[ usSurfaceIndex ].bUsageCount--; + gAnimSurfaceDatabase[ usSurfaceIndex ].bUsageCount--; // Set history for particular sodlier gbAnimUsageHistory[ usSurfaceIndex ][ usSoldierID ] = 0; @@ -980,15 +985,15 @@ BOOLEAN UnLoadAnimationSurface( UINT16 usSoldierID, UINT16 usSurfaceIndex ) gAnimSurfaceDatabase[ usSurfaceIndex ].bUsageCount = 0; } - + // Check if count has reached zero and delet if so if ( gAnimSurfaceDatabase[ usSurfaceIndex ].bUsageCount == 0 ) { - AnimDebugMsg( String( "Surface Database: Unloading Surface: %d", usSurfaceIndex ) ); + AnimDebugMsg( String( "Surface Database: Unloading Surface: %d", usSurfaceIndex ) ); - CHECKF( gAnimSurfaceDatabase[ usSurfaceIndex ].hVideoObject != NULL ) + CHECKF( gAnimSurfaceDatabase[ usSurfaceIndex ].hVideoObject != NULL ) DeleteVideoObject( gAnimSurfaceDatabase[ usSurfaceIndex ].hVideoObject ); gAnimSurfaceDatabase[ usSurfaceIndex ].hVideoObject = NULL; @@ -1028,7 +1033,7 @@ BOOLEAN LoadAnimationProfiles( ) // Writeout profile data! // if ( fread( &gubNumAnimProfiles, sizeof( gubNumAnimProfiles ), 1, pInput ) != 1 ) - if ( FileRead( pInput, &gubNumAnimProfiles, sizeof( gubNumAnimProfiles ), &uiBytesRead ) != 1 ) + if ( FileRead( pInput, &gubNumAnimProfiles, sizeof( gubNumAnimProfiles ), &uiBytesRead ) != 1 ) { return( FALSE ); } @@ -1123,13 +1128,13 @@ void DeleteAnimationProfiles( ) void ZeroAnimSurfaceCounts( ) { - INT32 cnt; + INT32 cnt; - for ( cnt = 0; cnt < NUMANIMATIONSURFACETYPES; cnt++ ) - { - gAnimSurfaceDatabase[ cnt ].bUsageCount = 0; - gAnimSurfaceDatabase[ cnt ].hVideoObject = NULL; - } + for ( cnt = 0; cnt < NUMANIMATIONSURFACETYPES; cnt++ ) + { + gAnimSurfaceDatabase[ cnt ].bUsageCount = 0; + gAnimSurfaceDatabase[ cnt ].hVideoObject = NULL; + } - memset( gbAnimUsageHistory, 0, sizeof( gbAnimUsageHistory ) ); + memset( gbAnimUsageHistory, 0, sizeof( gbAnimUsageHistory ) ); } diff --git a/Tactical/Animation Data.h b/Tactical/Animation Data.h index cfddf809..5cac37ce 100644 --- a/Tactical/Animation Data.h +++ b/Tactical/Animation Data.h @@ -28,7 +28,7 @@ // RGM = Regular Male // (RG) = Body desc ( Regular - RG, Short Stocky ( SS ), etc // (M) = Sex, Male, female -#define IS_MERC_BODY_TYPE( p ) ( ( p->ubBodyType <= REGFEMALE ) ? ( TRUE ) : ( FALSE ) ) +#define IS_MERC_BODY_TYPE( p ) ( ( p->ubBodyType <= REGFEMALE ) ? ( TRUE ) : ( FALSE ) ) #define IS_CIV_BODY_TYPE( p ) ( (p->ubBodyType >= FATCIV) && (p->ubBodyType <= CRIPPLECIV) ) #define NUMSOLDIERBODYTYPES 4 @@ -67,7 +67,7 @@ enum SoldierBodyTypes ICECREAMTRUCK, JEEP, - TOTALBODYTYPES + TOTALBODYTYPES } ; @@ -528,7 +528,7 @@ typedef enum // Struct for animation 'surface' information typedef struct { - UINT16 ubName; + UINT16 ubName; CHAR8 Filename[ 50 ]; CHAR8 bStructDataType; UINT8 ubFlags; @@ -557,8 +557,8 @@ extern AnimationStructureType gAnimStructureDatabase[ TOTALBODYTYPES ][ NUM_STRU // Functions BOOLEAN InitAnimationSystem( ); BOOLEAN DeInitAnimationSystem( ); -BOOLEAN LoadAnimationSurface( UINT16 usSoldierID, UINT16 usSurfaceIndex, UINT16 usAnimState ); -BOOLEAN UnLoadAnimationSurface( UINT16 usSoldierID, UINT16 usSurfaceIndex ); +BOOLEAN LoadAnimationSurface( UINT16 usSoldierID, UINT16 usSurfaceIndex, UINT16 usAnimState ); +BOOLEAN UnLoadAnimationSurface( UINT16 usSoldierID, UINT16 usSurfaceIndex ); void ClearAnimationSurfacesUsageHistory( UINT16 usSoldierID ); diff --git a/Tactical/Arms Dealer Init.cpp b/Tactical/Arms Dealer Init.cpp index 40078f19..dda7ebbb 100644 --- a/Tactical/Arms Dealer Init.cpp +++ b/Tactical/Arms Dealer Init.cpp @@ -18,13 +18,7 @@ #include "Scheduling.h" #endif - - -// To reduce memory fragmentation from frequent MemRealloc(), we allocate memory for more than one special slot each -// time we run out of space. Odds are that if we need one, we'll need another soon. -#define SPECIAL_ITEMS_ALLOCED_AT_ONCE 3 -// Once allocated, the special item slots remain allocated for the duration of the game, or until the dealer dies. -// This is a little bit wasteful, but saves an awful lot of hassles, and avoid unnecessary memory fragmentation +#include #define MIN_REPAIR_TIME_IN_MINUTES 15 // minutes #define MIN_REPAIR_COST 10 // dollars @@ -40,14 +34,14 @@ UINT8 gubLastSpecialItemAddedAtElement = 255; // THIS STRUCTURE HAS UNCHANGING INFO THAT DOESN'T GET SAVED/RESTORED/RESET -// TODO: externalize -ARMS_DEALER_INFO ArmsDealerInfo[ NUM_ARMS_DEALERS ] = +// TODO: externalize +ARMS_DEALER_INFO ArmsDealerInfo[ NUM_ARMS_DEALERS ] = { - //Buying Selling Merc ID# Type Initial Flags - //Price Price Of Cash + //Buying Selling Merc ID# Type Initial Flags + //Price Price Of Cash //Modifier Modifier Dealer -/* Tony */ { 0.75f, 1.25f, TONY, ARMS_DEALER_BUYS_SELLS, 15000, ARMS_DEALER_SOME_USED_ITEMS | ARMS_DEALER_GIVES_CHANGE }, +/* Tony */ { 0.75f, 1.25f, TONY, ARMS_DEALER_BUYS_SELLS, 15000, ARMS_DEALER_SOME_USED_ITEMS | ARMS_DEALER_GIVES_CHANGE }, /* Franz Hinkle */ { 1.0f, 1.5f, FRANZ, ARMS_DEALER_BUYS_SELLS, 5000, ARMS_DEALER_SOME_USED_ITEMS | ARMS_DEALER_GIVES_CHANGE }, /* Keith Hemps */ { 0.75f, 1.0f, KEITH, ARMS_DEALER_BUYS_SELLS, 1500, ARMS_DEALER_ONLY_USED_ITEMS | ARMS_DEALER_GIVES_CHANGE }, /* Jake Cameron */ { 0.8f, 1.1f, JAKE, ARMS_DEALER_BUYS_SELLS, 2500, ARMS_DEALER_ONLY_USED_ITEMS | ARMS_DEALER_GIVES_CHANGE }, @@ -56,12 +50,12 @@ ARMS_DEALER_INFO ArmsDealerInfo[ NUM_ARMS_DEALERS ] = /* Devin Connell*/ { 0.75f, 1.25f, DEVIN, ARMS_DEALER_SELLS_ONLY, 5000, ARMS_DEALER_GIVES_CHANGE }, /* Howard Filmore*/ { 1.0f, 1.0f, HOWARD, ARMS_DEALER_SELLS_ONLY, 3000, ARMS_DEALER_GIVES_CHANGE }, /* Sam Rozen */ { 1.0f, 1.0f, SAM, ARMS_DEALER_SELLS_ONLY, 3000, ARMS_DEALER_GIVES_CHANGE }, -/* Frank */ { 1.0f, 1.0f, FRANK, ARMS_DEALER_SELLS_ONLY, 500, ARMS_DEALER_ACCEPTS_GIFTS }, +/* Frank */ { 1.0f, 1.0f, FRANK, ARMS_DEALER_SELLS_ONLY, 500, ARMS_DEALER_ACCEPTS_GIFTS }, -/* Bar Bro 1 */ { 1.0f, 1.0f, HERVE, ARMS_DEALER_SELLS_ONLY, 250, ARMS_DEALER_ACCEPTS_GIFTS }, -/* Bar Bro 2 */ { 1.0f, 1.0f, PETER, ARMS_DEALER_SELLS_ONLY, 250, ARMS_DEALER_ACCEPTS_GIFTS }, -/* Bar Bro 3 */ { 1.0f, 1.0f, ALBERTO, ARMS_DEALER_SELLS_ONLY, 250, ARMS_DEALER_ACCEPTS_GIFTS }, -/* Bar Bro 4 */ { 1.0f, 1.0f, CARLO, ARMS_DEALER_SELLS_ONLY, 250, ARMS_DEALER_ACCEPTS_GIFTS }, +/* Bar Bro 1 */ { 1.0f, 1.0f, HERVE, ARMS_DEALER_SELLS_ONLY, 250, ARMS_DEALER_ACCEPTS_GIFTS }, +/* Bar Bro 2 */ { 1.0f, 1.0f, PETER, ARMS_DEALER_SELLS_ONLY, 250, ARMS_DEALER_ACCEPTS_GIFTS }, +/* Bar Bro 3 */ { 1.0f, 1.0f, ALBERTO, ARMS_DEALER_SELLS_ONLY, 250, ARMS_DEALER_ACCEPTS_GIFTS }, +/* Bar Bro 4 */ { 1.0f, 1.0f, CARLO, ARMS_DEALER_SELLS_ONLY, 250, ARMS_DEALER_ACCEPTS_GIFTS }, /* Micky O'Brien*/ { 1.0f, 1.4f, MICKY, ARMS_DEALER_BUYS_ONLY, 10000, ARMS_DEALER_HAS_NO_INVENTORY | ARMS_DEALER_GIVES_CHANGE }, @@ -69,27 +63,23 @@ ARMS_DEALER_INFO ArmsDealerInfo[ NUM_ARMS_DEALERS ] = //Speed Cost /* Arnie Brunzwell*/{ 0.1f, 0.8f, ARNIE, ARMS_DEALER_REPAIRS, 1500, ARMS_DEALER_HAS_NO_INVENTORY | ARMS_DEALER_GIVES_CHANGE }, /* Fredo */ { 0.6f, 0.6f, FREDO, ARMS_DEALER_REPAIRS, 1000, ARMS_DEALER_HAS_NO_INVENTORY | ARMS_DEALER_GIVES_CHANGE }, -/* Perko */ { 1.0f, 0.4f, PERKO, ARMS_DEALER_REPAIRS, 1000, ARMS_DEALER_HAS_NO_INVENTORY | ARMS_DEALER_GIVES_CHANGE }, +/* Perko */ { 1.0f, 0.4f, PERKO, ARMS_DEALER_REPAIRS, 1000, ARMS_DEALER_HAS_NO_INVENTORY | ARMS_DEALER_GIVES_CHANGE }, -/* Elgin */ { 1.0f, 1.0f, DRUGGIST, ARMS_DEALER_SELLS_ONLY, 500, ARMS_DEALER_ACCEPTS_GIFTS }, -/* Manny */ { 1.0f, 1.0f, MANNY, ARMS_DEALER_SELLS_ONLY, 500, ARMS_DEALER_ACCEPTS_GIFTS }, +/* Elgin */ { 1.0f, 1.0f, DRUGGIST, ARMS_DEALER_SELLS_ONLY, 500, ARMS_DEALER_ACCEPTS_GIFTS }, +/* Manny */ { 1.0f, 1.0f, MANNY, ARMS_DEALER_SELLS_ONLY, 500, ARMS_DEALER_ACCEPTS_GIFTS }, }; // THESE GET SAVED/RESTORED/RESET ARMS_DEALER_STATUS gArmsDealerStatus[ NUM_ARMS_DEALERS ]; -DEALER_ITEM_HEADER gArmsDealersInventory[ NUM_ARMS_DEALERS ][ MAXITEMS ]; +std::vector gArmsDealersInventory; - -void InitializeOneArmsDealer( UINT8 ubArmsDealer ); - -void AddAmmoToArmsDealerInventory( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubShotsLeft ); -void AddItemToArmsDealerInventory( UINT8 ubArmsDealer, UINT16 usItemIndex, SPECIAL_ITEM_INFO *pSpclItemInfo, UINT8 ubHowMany ); -void AddSpecialItemToArmsDealerInventoryAtElement( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubElement, SPECIAL_ITEM_INFO *pSpclItemInfo ); +void AddAmmoToArmsDealerInventory( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT16 ubShotsLeft ); +void AddItemToArmsDealerInventory( UINT8 ubArmsDealer, OBJECTTYPE& object ); void RemoveRandomItemFromArmsDealerInventory( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubHowMany ); @@ -101,40 +91,61 @@ void LimitArmsDealersInventory( UINT8 ubArmsDealer, UINT32 uDealerItemType, UIN void GuaranteeAtLeastOneItemOfType( UINT8 ubArmsDealer, UINT32 uiDealerItemType ); void GuaranteeAtLeastXItemsOfIndex( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubHowMany ); -BOOLEAN AllocMemsetSpecialItemArray( DEALER_ITEM_HEADER *pDealerItem, UINT8 ubElementsNeeded ); -BOOLEAN ResizeSpecialItemArray( DEALER_ITEM_HEADER *pDealerItem, UINT8 ubElementsNeeded ); -void FreeSpecialItemArray( DEALER_ITEM_HEADER *pDealerItem ); - void ArmsDealerGetsFreshStock( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubNumItems ); BOOLEAN ItemContainsLiquid( UINT16 usItemIndex ); UINT8 DetermineDealerItemCondition( UINT8 ubArmsDealer, UINT16 usItemIndex ); -BOOLEAN IsItemInfoSpecial( SPECIAL_ITEM_INFO *pSpclItemInfo, UINT16 usItemIndex ); - BOOLEAN DoesItemAppearInDealerInventoryList( UINT8 ubArmsDealer, UINT16 usItemIndex, BOOLEAN fPurchaseFromPlayer ); -BOOLEAN LoadIncompleteArmsDealersStatus( HWFILE hFile, BOOLEAN fIncludesElgin, BOOLEAN fIncludesManny ); - -//INT16 GetSpecialItemFromArmsDealerInventory( UINT8 ubArmsDealer, UINT16 usItemIndex, SPECIAL_ITEM_INFO *pSpclItemInfo ); - void GuaranteeMinimumAlcohol( UINT8 ubArmsDealer ); BOOLEAN ItemIsARocketRifle( INT16 sItemIndex ); BOOLEAN GetArmsDealerShopHours( UINT8 ubArmsDealer, UINT32 *puiOpeningTime, UINT32 *puiClosingTime ); +ARMS_DEALER_STATUS& ARMS_DEALER_STATUS::operator=(const OLD_ARMS_DEALER_STATUS_101& status) +{ + this->initialize(); + this->fOutOfBusiness = status.fOutOfBusiness; + this->fRepairDelayBeenUsed = status.fRepairDelayBeenUsed; + this->fUnusedKnowsPlayer = status.fUnusedKnowsPlayer; + this->ubSpecificDealerFlags = status.ubSpecificDealerFlags; + this->uiArmsDealersCash = status.uiArmsDealersCash; + this->uiTimePlayerLastInSKI = status.uiTimePlayerLastInSKI; + return *this; +} +void ARMS_DEALER_STATUS::initialize() +{ + memset(this, 0, sizeof(ARMS_DEALER_STATUS)); +} + +void DEALER_SPECIAL_ITEM::initialize() +{ + memset(this, 0, SIZEOF_DEALER_SPECIAL_ITEM_POD); + object.initialize(); +} + +bool DEALER_SPECIAL_ITEM::operator ==(const DEALER_SPECIAL_ITEM& compare) +{ + if (this->bItemCondition == compare.bItemCondition && + this->ubOwnerProfileId == compare.ubOwnerProfileId && + this->ubQtyOnOrder == compare.ubQtyOnOrder && + this->uiOrderArrivalTime == compare.uiOrderArrivalTime && + this->uiRepairDoneTime == compare.uiRepairDoneTime) { + + if (this->object == compare.object) { + return true; + } + } + return false; +} void InitAllArmsDealers() { UINT8 ubArmsDealer; - //Memset all dealers' status tables to zeroes - memset( gArmsDealerStatus, 0, sizeof( gArmsDealerStatus ) ); - - //Memset all dealers' inventory tables to zeroes - memset( gArmsDealersInventory, 0, sizeof( gArmsDealersInventory ) ); - + ShutDownArmsDealers(); //Initialize the initial status & inventory for each of the arms dealers for( ubArmsDealer = 0; ubArmsDealer < NUM_ARMS_DEALERS; ubArmsDealer++ ) { @@ -153,8 +164,7 @@ void InitializeOneArmsDealer( UINT8 ubArmsDealer ) memset( &( gArmsDealerStatus[ ubArmsDealer ] ), 0, sizeof( ARMS_DEALER_STATUS ) ); - memset( &( gArmsDealersInventory[ ubArmsDealer ] ), 0, sizeof( DEALER_ITEM_HEADER ) * MAXITEMS ); - + gArmsDealersInventory.resize(gArmsDealersInventory.size() + 1); //Reset the arms dealers cash on hand to the default initial value gArmsDealerStatus[ ubArmsDealer ].uiArmsDealersCash = ArmsDealerInfo[ ubArmsDealer ].iInitialCash; @@ -169,7 +179,7 @@ void InitializeOneArmsDealer( UINT8 ubArmsDealer ) //loop through all the item types for( usItemIndex = 1; usItemIndex < MAXITEMS; usItemIndex++ ) { - if ( Item[usItemIndex].usItemClass == 0 ) + if ( Item[usItemIndex].usItemClass == 0 ) break; //Can the item be sold by the arms dealer if( CanDealerTransactItem( ubArmsDealer, usItemIndex, FALSE ) ) @@ -189,23 +199,7 @@ void InitializeOneArmsDealer( UINT8 ubArmsDealer ) void ShutDownArmsDealers() { - UINT8 ubArmsDealer; - UINT16 usItemIndex; - - // loop through all the dealers - for( ubArmsDealer=0; ubArmsDealer 0 ) - { - FreeSpecialItemArray( &gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ] ); - } - } - } + gArmsDealersInventory.clear(); } @@ -214,8 +208,13 @@ BOOLEAN SaveArmsDealerInventoryToSaveGameFile( HWFILE hFile ) { UINT32 uiNumBytesWritten; UINT8 ubArmsDealer; - UINT16 usItemIndex; + //save the number of dealers to load + int dealers = NUM_ARMS_DEALERS; + if (!FileWrite( hFile, &dealers, sizeof( int ), &uiNumBytesWritten )) + { + return( FALSE ); + } //Save the arms dealers status if (!FileWrite( hFile, gArmsDealerStatus, sizeof( gArmsDealerStatus ), &uiNumBytesWritten )) @@ -223,27 +222,19 @@ BOOLEAN SaveArmsDealerInventoryToSaveGameFile( HWFILE hFile ) return( FALSE ); } - //save the dealers inventory item headers (all at once) - if (!FileWrite( hFile, gArmsDealersInventory, sizeof( gArmsDealersInventory ), &uiNumBytesWritten )) - { - return( FALSE ); - } - //loop through all the dealers inventories for( ubArmsDealer=0; ubArmsDealer 0 ) - { - if (!FileWrite( hFile, &gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[0], sizeof( DEALER_SPECIAL_ITEM ) * gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubElementsAlloced, &uiNumBytesWritten )) - { - return( FALSE ); - } + return( FALSE ); + } + //loop through this dealer's individual items + for (DealerItemList::iterator iter = gArmsDealersInventory[ubArmsDealer].begin(); + iter != gArmsDealersInventory[ubArmsDealer].end(); ++iter) { + if (! iter->Save(hFile) ) { + return FALSE; } } } @@ -251,68 +242,34 @@ BOOLEAN SaveArmsDealerInventoryToSaveGameFile( HWFILE hFile ) return( TRUE ); } - -BOOLEAN LoadArmsDealerInventoryFromSavedGameFile( HWFILE hFile, BOOLEAN fIncludesElgin, BOOLEAN fIncludesManny ) +void DEALER_SPECIAL_ITEM::ConvertFrom101(OLD_DEALER_ITEM_HEADER_101& header, OLD_DEALER_SPECIAL_ITEM_101& special, int ubArmsDealer, int usItemIndex) { - UINT32 uiNumBytesRead; - UINT8 ubArmsDealer; - UINT16 usItemIndex; - - - //Free all the dealers special inventory arrays - ShutDownArmsDealers(); - - // Elgin was added to the dealers list in Game Version #54, enlarging these 2 tables... - // Manny was added to the dealers list in Game Version #55, enlarging these 2 tables... - if ( fIncludesElgin && fIncludesManny ) - { - // info for all dealers is in the save file - - //Load the arms dealers status - if ( !FileRead( hFile, gArmsDealerStatus, sizeof( gArmsDealerStatus ), &uiNumBytesRead )) - { - return( FALSE ); - } - - //load the dealers inventory item headers (all at once) - if ( !FileRead( hFile, gArmsDealersInventory, sizeof( gArmsDealersInventory ), &uiNumBytesRead )) - { - return( FALSE ); - } - } - else - { - if ( !LoadIncompleteArmsDealersStatus( hFile, fIncludesElgin, fIncludesManny ) ) - { - return( FALSE ); - } + this->bItemCondition = special.oldInfo.bItemCondition; + if (this->bItemCondition == 0) { + return; } - //loop through all the dealers inventories - for( ubArmsDealer=0; ubArmsDealer 0 ) - { - //Allocate memory for the inventory - if ( !AllocMemsetSpecialItemArray( &gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ], gArmsDealersInventory[ubArmsDealer][usItemIndex].ubElementsAlloced )) - return(FALSE); + this->uiRepairDoneTime = special.uiRepairDoneTime; + this->ubOwnerProfileId = special.ubOwnerProfileId; - if (!FileRead( hFile, &gArmsDealersInventory[ubArmsDealer][usItemIndex].SpecialItem[0], sizeof( DEALER_SPECIAL_ITEM ) * gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubElementsAlloced, &uiNumBytesRead )) - { - return( FALSE ); - } - } - } + this->uiOrderArrivalTime = 0; + this->ubQtyOnOrder = 0; + + int condition = this->bItemCondition; + if (this->IsUnderRepair()) { + condition *= -1; } - return( TRUE ); -} + CreateObjectForDealer(usItemIndex, condition, 1, &(this->object)); + this->object[0]->data.ubImprintID = special.oldInfo.ubImprintID; + for (int x = 0; x < OLD_MAX_ATTACHMENTS_101; ++x) { + if (special.oldInfo.usAttachment[x] && special.oldInfo.bAttachmentStatus[x] ) { + CreateObjectForDealer(special.oldInfo.usAttachment[x], special.oldInfo.bAttachmentStatus[x], 1, &gTempObject); + this->object.AttachObject(0, &gTempObject, FALSE); + } + } + gArmsDealersInventory[ubArmsDealer].push_back(*this); +}; void DailyUpdateOfArmsDealersInventory() @@ -336,10 +293,9 @@ void SimulateArmsDealerCustomer() { UINT8 ubArmsDealer=0; UINT16 usItemIndex; - UINT8 ubItemsSold=0; - UINT8 ubElement; - SPECIAL_ITEM_INFO SpclItemInfo; + UINT8 ubItemsSold=0; + static int numPerfectItems[MAXITEMS]; //loop through all the arms dealers for( ubArmsDealer=0;ubArmsDealerItemIsInInventory() == true && iter->bItemCondition == 100) { + numPerfectItems[iter->object.usItem] += iter->object.ubNumberOfObjects; + } + } + //loop through all items of the same type for( usItemIndex = 1; usItemIndex < MAXITEMS; usItemIndex++ ) { - if ( Item[usItemIndex].usItemClass == 0 ) + if ( Item[usItemIndex].usItemClass == 0 ) break; //if there are some of these in stock - if( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems > 0) + if( numPerfectItems[usItemIndex] > 0) { // first, try to sell all the new (perfect) ones if ( usItemIndex == JAR_ELIXIR ) { // only allow selling of standard # of items so those converted from blood given by player will be available - ubItemsSold = HowManyItemsAreSold( ubArmsDealer, usItemIndex, (UINT8) __min( 3, gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubPerfectItems), FALSE); + ubItemsSold = HowManyItemsAreSold( ubArmsDealer, usItemIndex, (UINT8) __min( 3, numPerfectItems[usItemIndex]), FALSE); } else { - ubItemsSold = HowManyItemsAreSold( ubArmsDealer, usItemIndex, gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubPerfectItems, FALSE); + ubItemsSold = HowManyItemsAreSold( ubArmsDealer, usItemIndex, numPerfectItems[usItemIndex], FALSE); } if ( ubItemsSold > 0) { - // create item info describing a perfect item - SetSpecialItemInfoToDefaults( &SpclItemInfo ); - //Now remove that many NEW ones (condition 100) of that item - RemoveItemFromArmsDealerInventory( ubArmsDealer, usItemIndex, &SpclItemInfo, ubItemsSold); + RemoveItemFromArmsDealerInventory( ubArmsDealer, usItemIndex, ubItemsSold); } + } + } - // next, try to sell all the used ones, gotta do these one at a time so we can remove them by element - for ( ubElement = 0; ubElement < gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubElementsAlloced; ubElement++ ) - { - // don't worry about negative condition, repairmen can't come this far, they don't sell! - if ( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].fActive ) + for (DealerItemList::iterator iter = gArmsDealersInventory[ ubArmsDealer ].begin(); + iter != gArmsDealersInventory[ ubArmsDealer ].end(); ++iter) { + // next, try to sell all the used ones, gotta do these one at a time so we can remove them by element + // don't worry about negative condition, repairmen can't come this far, they don't sell! + if (iter->bItemCondition < 100 && iter->bItemCondition > 0) { + if ( iter->ItemIsInInventory() == true) { + // try selling just this one + if (HowManyItemsAreSold( ubArmsDealer, iter->object.usItem, 1, TRUE) > 0) { - // try selling just this one - if (HowManyItemsAreSold( ubArmsDealer, usItemIndex, 1, TRUE) > 0) - { - //Sold, now remove that particular USED one! - RemoveSpecialItemFromArmsDealerInventoryAtElement( ubArmsDealer, usItemIndex, ubElement ); + iter = gArmsDealersInventory[ ubArmsDealer ].erase(iter); + if (iter == gArmsDealersInventory[ ubArmsDealer ].end()) { + break; } } } @@ -404,7 +369,6 @@ void DailyCheckOnItemQuantities() UINT8 ubMaxSupply; UINT8 ubNumItems; UINT32 uiArrivalDay; - BOOLEAN fPrevElig; UINT8 ubReorderDays; @@ -421,34 +385,50 @@ void DailyCheckOnItemQuantities() if( ArmsDealerInfo[ ubArmsDealer ].uiFlags & ARMS_DEALER_HAS_NO_INVENTORY ) continue; + int numTotalItems[MAXITEMS] = { 0 }; + bool itemsAreOnOrder[MAXITEMS] = { false }; + for (DealerItemList::iterator iter = gArmsDealersInventory[ ubArmsDealer ].begin(); + iter != gArmsDealersInventory[ ubArmsDealer ].end(); ++iter) { + if (iter->object.exists() == true) { + if (iter->IsBeingOrdered() == false) { + numTotalItems[iter->object.usItem] += iter->object.ubNumberOfObjects; + } + else { + itemsAreOnOrder[iter->object.usItem] = true; + //and today is the day the items come in + if( iter->uiOrderArrivalTime >= GetWorldDay() ) + { + iter->ubQtyOnOrder = 0; + iter->uiOrderArrivalTime = 0; + } + } + } + } //loop through all items of the same type for( usItemIndex = 1; usItemIndex < MAXITEMS; usItemIndex++ ) { - if ( Item[usItemIndex].usItemClass == 0 ) + if ( Item[usItemIndex].usItemClass == 0 ) break; //if the dealer can sell the item type if( CanDealerTransactItem( ubArmsDealer, usItemIndex, FALSE ) ) { //if there are no items on order - if ( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubQtyOnOrder == 0 ) + if ( itemsAreOnOrder[ usItemIndex ] == false ) { ubMaxSupply = GetDealersMaxItemAmount( ubArmsDealer, usItemIndex ); //if the qty on hand is half the desired amount or fewer - if( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems <= (UINT32)( ubMaxSupply / 2 ) ) + if( numTotalItems[ usItemIndex ] <= (INT32)( ubMaxSupply / 2 ) ) { - // remember value of the "previously eligible" flag - fPrevElig = gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].fPreviouslyEligible; - //determine if the item can be restocked (assume new, use items aren't checked for until the stuff arrives) if (ItemTransactionOccurs( ubArmsDealer, usItemIndex, DEALER_BUYING, FALSE )) { // figure out how many items to reorder (items are reordered an entire batch at a time) - ubNumItems = HowManyItemsToReorder( ubMaxSupply, gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems ); + ubNumItems = HowManyItemsToReorder( ubMaxSupply, numTotalItems[ usItemIndex ] ); // if this is the first day the player is eligible to have access to this thing - if ( !fPrevElig ) + if ( gArmsDealerStatus[ubArmsDealer].fPreviouslyEligible[ usItemIndex ] == false ) { // eliminate the ordering delay and stock the items instantly! // This is just a way to reward the player right away for making progress without the reordering lag... @@ -468,49 +448,79 @@ void DailyCheckOnItemQuantities() //Determine when the inventory should arrive uiArrivalDay = GetWorldDay() + ubReorderDays; // consider changing this to minutes - // post new order - gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubQtyOnOrder = ubNumItems; - gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].uiOrderArrivalTime = uiArrivalDay; + OrderDealerItems(ubArmsDealer, usItemIndex, ubNumItems, uiArrivalDay); } } } } - else //items are on order - { - //and today is the day the items come in - if( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].uiOrderArrivalTime >= GetWorldDay() ) - { - ArmsDealerGetsFreshStock( ubArmsDealer, usItemIndex, gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubQtyOnOrder); - - //reset order - gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubQtyOnOrder = 0; - gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].uiOrderArrivalTime = 0; - } - } } } } } +void OrderDealerItems(int armsDealer, int usItem, int numItems, int arrivalDay) +{ + int perfectItems = 0; + for (int x = 0; x < numItems; ++x) { + int ubItemCondition = DetermineDealerItemCondition( armsDealer, usItem); + + // if the item is brand new + if ( ubItemCondition == 100) + { + perfectItems++; + } + else + { + // add a used item with that condition to his inventory + gArmsDealersInventory[ armsDealer ].push_back(DEALER_SPECIAL_ITEM()); + DEALER_SPECIAL_ITEM* pOrder = &(gArmsDealersInventory[ armsDealer ].back()); + + pOrder->ubQtyOnOrder = 1; + pOrder->uiOrderArrivalTime = arrivalDay; + pOrder->bItemCondition = ubItemCondition; + CreateObjectForDealer(usItem, ubItemCondition, 1, &(pOrder->object)); + } + } + + // now add all the perfect ones, in one shot + if ( perfectItems > 0) + { + gArmsDealersInventory[ armsDealer ].push_back(DEALER_SPECIAL_ITEM()); + DEALER_SPECIAL_ITEM* pOrder = &(gArmsDealersInventory[ armsDealer ].back()); + + pOrder->ubQtyOnOrder = perfectItems; + pOrder->uiOrderArrivalTime = arrivalDay; + /*CHRISL: I can't say for absolute, but I think this is where we are causing the "100rnd" bug. We're setting + a bItemConditon 100 regardless of what the item is. But if we're working with ammo, we don't want + bItemCondition to be 100 even if the item is "perfect" (i.e., a fully loaded mag). We need a condition + so we set this value to magSize when dealing with ammo*/ + if(Item[usItem].usItemClass == IC_AMMO) + pOrder->bItemCondition = Magazine[Item[usItem].ubClassIndex].ubMagSize; + else + pOrder->bItemCondition = 100; + CreateObjectForDealer(usItem, 100, perfectItems, &(pOrder->object)); + } +} + void ConvertCreatureBloodToElixir( void ) { - UINT8 ubBloodAvailable; + UINT8 ubBloodAvailable = 0; UINT8 ubAmountToConvert; - SPECIAL_ITEM_INFO SpclItemInfo; - ubBloodAvailable = gArmsDealersInventory[ ARMS_DEALER_GABBY ][ JAR_CREATURE_BLOOD ].ubTotalItems; + for (DealerItemList::iterator iter = gArmsDealersInventory[ ARMS_DEALER_GABBY ].begin(); + iter != gArmsDealersInventory[ ARMS_DEALER_GABBY ].end(); ++iter) { + if (iter->ItemIsInInventory() == true && iter->object.usItem == JAR_CREATURE_BLOOD) { + ubBloodAvailable += iter->object.ubNumberOfObjects; + } + } if ( ubBloodAvailable ) { // start converting blood into elixir! //ubAmountToConvert = (UINT8) __min( 5 + Random( 3 ), ubBloodAvailable ); ubAmountToConvert = ubBloodAvailable; - // create item info describing a perfect item - SetSpecialItemInfoToDefaults( &SpclItemInfo ); - - //Now remove that many NEW ones (condition 100) of that item - RemoveItemFromArmsDealerInventory( ARMS_DEALER_GABBY, JAR_CREATURE_BLOOD, &SpclItemInfo, ubAmountToConvert ); + RemoveItemFromArmsDealerInventory( ARMS_DEALER_GABBY, JAR_CREATURE_BLOOD, ubAmountToConvert ); ArmsDealerGetsFreshStock( ARMS_DEALER_GABBY, JAR_ELIXIR, ubAmountToConvert ); } @@ -555,137 +565,135 @@ BOOLEAN AdjustCertainDealersInventory( ) void LimitArmsDealersInventory( UINT8 ubArmsDealer, UINT32 uiDealerItemType, UINT8 ubMaxNumberOfItemType ) { - UINT16 usItemIndex=0; - UINT32 uiItemsToRemove=0; - SPECIAL_ITEM_INFO SpclItemInfo; - - UINT16 usAvailableItem[ MAXITEMS ] = { NOTHING }; - UINT8 ubNumberOfAvailableItem[ MAXITEMS ] = { 0 }; - UINT32 uiTotalNumberOfItems = 0, uiRandomChoice; - UINT32 uiNumAvailableItems = 0, uiIndex; - - // not permitted for repair dealers - would take extra code to avoid counting items under repair! - Assert( !DoesDealerDoRepairs( ubArmsDealer ) ); - if( gArmsDealerStatus[ ubArmsDealer ].fOutOfBusiness ) return; + //ADB, ya, a whole 1 line of extra code! + // not permitted for repair dealers - would take extra code to avoid counting items under repair! + //Assert( !DoesDealerDoRepairs( ubArmsDealer ) ); + int numTotalItems[MAXITEMS] = { 0 }; + for (DealerItemList::iterator iter = gArmsDealersInventory[ ubArmsDealer ].begin(); iter != gArmsDealersInventory[ ubArmsDealer ].end(); ++iter) { + if (iter->ItemIsInInventory() == true && iter->IsUnderRepair() == false) { + numTotalItems[iter->object.usItem] += iter->object.ubNumberOfObjects; + } + } + + UINT32 uiTotalNumberOfItems = 0, uiRandomChoice; + UINT32 uiIndex; + + UINT16 usItemIndex=0; + std::vector usAvailableItems; + std::vector ubNumberOfAvailableItem; //loop through all items of the same class and count the number in stock for( usItemIndex = 1; usItemIndex < MAXITEMS; usItemIndex++ ) { - if ( Item[usItemIndex].usItemClass == 0 ) + if ( Item[usItemIndex].usItemClass == 0 ) break; //if there is some items in stock - if( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems > 0) + if( numTotalItems[usItemIndex] > 0) { //if the item is of the same dealer item type if( uiDealerItemType & GetArmsDealerItemTypeFromItemNumber( usItemIndex ) ) { - usAvailableItem[ uiNumAvailableItems ] = usItemIndex; - + usAvailableItems.push_back(usItemIndex); //if the dealer item type is ammo if( uiDealerItemType == ARMS_DEALER_AMMO ) { // all ammo of same type counts as only one item - ubNumberOfAvailableItem[ uiNumAvailableItems ] = 1; + ubNumberOfAvailableItem.push_back(1); uiTotalNumberOfItems++; } else { // items being repaired don't count against the limit - ubNumberOfAvailableItem[ uiNumAvailableItems ] = gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems; - uiTotalNumberOfItems += ubNumberOfAvailableItem[ uiNumAvailableItems ]; + ubNumberOfAvailableItem.push_back(numTotalItems[usItemIndex]); + uiTotalNumberOfItems += ubNumberOfAvailableItem.back(); } - uiNumAvailableItems++; } } } //if there is more of the given type than we want - if( uiNumAvailableItems > ubMaxNumberOfItemType ) + INT32 uiItemsToRemove = usAvailableItems.size() - ubMaxNumberOfItemType; + + while (uiItemsToRemove > 0) { - uiItemsToRemove = uiNumAvailableItems - ubMaxNumberOfItemType; + uiRandomChoice = Random( uiTotalNumberOfItems ); - do + for ( uiIndex = 0; uiIndex < usAvailableItems.size(); uiIndex++ ) { - uiRandomChoice = Random( uiTotalNumberOfItems ); - - for ( uiIndex = 0; uiIndex < uiNumAvailableItems; uiIndex++ ) + if ( uiRandomChoice <= ubNumberOfAvailableItem[ uiIndex ] ) { - if ( uiRandomChoice <= ubNumberOfAvailableItem[ uiIndex ] ) + usItemIndex = usAvailableItems[ uiIndex ]; + if ( uiDealerItemType == ARMS_DEALER_AMMO ) { - usItemIndex = usAvailableItem[ uiIndex ]; - if ( uiDealerItemType == ARMS_DEALER_AMMO ) - { - // remove all of them, since each ammo item counts as only one "item" here - // create item info describing a perfect item - SetSpecialItemInfoToDefaults( &SpclItemInfo ); - // ammo will always be only condition 100, there's never any in special slots - RemoveItemFromArmsDealerInventory( ubArmsDealer, usItemIndex, &SpclItemInfo, gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems ); - } - else - { - // pick 1 random one, don't care about its condition - RemoveRandomItemFromArmsDealerInventory( ubArmsDealer, usItemIndex, 1 ); - } - // now remove entry from the array by replacing it with the last and decrementing - // the size of the array - usAvailableItem[ uiIndex ] = usAvailableItem[ uiNumAvailableItems - 1 ]; - ubNumberOfAvailableItem[ uiIndex ] = ubNumberOfAvailableItem[ uiNumAvailableItems - 1 ]; - uiNumAvailableItems--; - - // decrement count of # of items to remove - uiItemsToRemove--; - break; // and out of 'for' loop - + // remove all of them, since each ammo item counts as only one "item" here + // ammo will always be only condition 100, there's never any in special slots + RemoveItemFromArmsDealerInventory( ubArmsDealer, usItemIndex, ubNumberOfAvailableItem[uiIndex] ); } else { - // next item! - uiRandomChoice -= ubNumberOfAvailableItem[ uiIndex ]; + // pick 1 random one, don't care about its condition + RemoveRandomItemFromArmsDealerInventory( ubArmsDealer, usItemIndex, 1 ); } + // now remove entry from the array by replacing it with the last and decrementing + // the size of the array + usAvailableItems[ uiIndex ] = usAvailableItems.back(); + usAvailableItems.pop_back(); + ubNumberOfAvailableItem[ uiIndex ] = ubNumberOfAvailableItem.back(); + ubNumberOfAvailableItem.pop_back(); + + // decrement count of # of items to remove + uiItemsToRemove--; + break; // and out of 'for' loop + } - - /* - //loop through all items of the same type - for( usItemIndex = 1; usItemIndex < MAXITEMS; usItemIndex++ ) + else { - //if there are some non-repairing items in stock - if( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems ) + // next item! + uiRandomChoice -= ubNumberOfAvailableItem[ uiIndex ]; + } + } + + /* + //loop through all items of the same type + for( usItemIndex = 1; usItemIndex < MAXITEMS; usItemIndex++ ) + { + //if there are some non-repairing items in stock + if( gOldArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems ) + { + //if the item is of the same dealer item type + if( uiDealerItemType & GetArmsDealerItemTypeFromItemNumber( usItemIndex ) ) { - //if the item is of the same dealer item type - if( uiDealerItemType & GetArmsDealerItemTypeFromItemNumber( usItemIndex ) ) + // a random chance that the item will be removed + if( Random( 100 ) < 30 ) { - // a random chance that the item will be removed - if( Random( 100 ) < 30 ) + //remove the item + + //if the dealer item type is ammo + if( uiDealerItemType == ARMS_DEALER_AMMO ) { - //remove the item + // remove all of them, since each ammo item counts as only one "item" here - //if the dealer item type is ammo - if( uiDealerItemType == ARMS_DEALER_AMMO ) - { - // remove all of them, since each ammo item counts as only one "item" here - - // create item info describing a perfect item - SetSpecialItemInfoToDefaults( &SpclItemInfo ); - // ammo will always be only condition 100, there's never any in special slots - RemoveItemFromArmsDealerInventory( ubArmsDealer, usItemIndex, &SpclItemInfo, gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems ); - } - else - { - // pick 1 random one, don't care about its condition - RemoveRandomItemFromArmsDealerInventory( ubArmsDealer, usItemIndex, 1 ); - } - - uiItemsToRemove--; - if( uiItemsToRemove == 0) - break; + // create item info describing a perfect item + SetSpecialItemInfoToDefaults( &SpclItemInfo ); + // ammo will always be only condition 100, there's never any in special slots + RemoveItemFromArmsDealerInventory( ubArmsDealer, usItemIndex, gOldArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems ); } + else + { + // pick 1 random one, don't care about its condition + RemoveRandomItemFromArmsDealerInventory( ubArmsDealer, usItemIndex, 1 ); + } + + uiItemsToRemove--; + if( uiItemsToRemove == 0) + break; } } } - */ - } while (uiItemsToRemove > 0); + } + */ } } @@ -694,30 +702,35 @@ void GuaranteeAtLeastOneItemOfType( UINT8 ubArmsDealer, UINT32 uiDealerItemType { UINT16 usItemIndex; UINT8 ubChance; - BOOLEAN fFoundEligibleItemOfSameType = FALSE; - BOOLEAN fItemHasBeenAdded = FALSE; - BOOLEAN fFailedOnce = FALSE; - UINT16 usAvailableItem[ MAXITEMS ] = { NOTHING }; - UINT8 ubChanceForAvailableItem[ MAXITEMS ] = { 0 }; UINT32 uiTotalChances = 0; - UINT32 uiNumAvailableItems = 0, uiIndex, uiRandomChoice; - - // not permitted for repair dealers - would take extra code to avoid counting items under repair! - Assert( !DoesDealerDoRepairs( ubArmsDealer ) ); + UINT32 uiIndex, uiRandomChoice; if( gArmsDealerStatus[ ubArmsDealer ].fOutOfBusiness ) return; + //ADB, ya, a whole 1 line of extra code! + // not permitted for repair dealers - would take extra code to avoid counting items under repair! + //Assert( !DoesDealerDoRepairs( ubArmsDealer ) ); + int numTotalItems[MAXITEMS] = { 0 }; + for (DealerItemList::iterator iter = gArmsDealersInventory[ ubArmsDealer ].begin(); + iter != gArmsDealersInventory[ ubArmsDealer ].end(); ++iter) { + if (iter->ItemIsInInventory() == true && iter->IsUnderRepair() == false) { + numTotalItems[iter->object.usItem] += iter->object.ubNumberOfObjects; + } + } + + std::vector usAvailableItems; + std::vector ubChanceForAvailableItem; //loop through all items of the same type for( usItemIndex = 1; usItemIndex < MAXITEMS; usItemIndex++ ) { - if ( Item[usItemIndex].usItemClass == 0 ) + if ( Item[usItemIndex].usItemClass == 0 ) break; //if the item is of the same dealer item type if( uiDealerItemType & GetArmsDealerItemTypeFromItemNumber( usItemIndex ) ) { //if there are any of these in stock - if( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems > 0 ) + if( numTotalItems[usItemIndex] > 0 ) { //there is already at least 1 item of that type, return return; @@ -730,17 +743,16 @@ void GuaranteeAtLeastOneItemOfType( UINT8 ubArmsDealer, UINT32 uiDealerItemType ubChance = ChanceOfItemTransaction( ubArmsDealer, usItemIndex, DEALER_BUYING, FALSE ); if ( ubChance > 0 ) { - usAvailableItem[ uiNumAvailableItems ] = usItemIndex; - ubChanceForAvailableItem[ uiNumAvailableItems ] = ubChance; - uiNumAvailableItems++; - uiTotalChances += ubChance; + usAvailableItems.push_back(usItemIndex); + ubChanceForAvailableItem.push_back(ubChance); + uiTotalChances += ubChance; } } } } // if there aren't any such items, the following loop would never finish, so quit before trying it! - if (uiNumAvailableItems == 0) + if (usAvailableItems.empty() == true) { return; } @@ -751,11 +763,11 @@ void GuaranteeAtLeastOneItemOfType( UINT8 ubArmsDealer, UINT32 uiDealerItemType // randomize number within uiTotalChances and then loop forwards till we find that item uiRandomChoice = Random( uiTotalChances ); - for ( uiIndex = 0; uiIndex < uiNumAvailableItems; uiIndex++ ) + for ( uiIndex = 0; uiIndex < usAvailableItems.size(); uiIndex++ ) { if ( uiRandomChoice <= ubChanceForAvailableItem[ uiIndex ] ) { - ArmsDealerGetsFreshStock( ubArmsDealer, usAvailableItem[ uiIndex ], 1 ); + ArmsDealerGetsFreshStock( ubArmsDealer, usAvailableItems[ uiIndex ], 1 ); return; } else @@ -765,31 +777,42 @@ void GuaranteeAtLeastOneItemOfType( UINT8 ubArmsDealer, UINT32 uiDealerItemType } } + Assert(false); // internal logic failure! } void GuaranteeAtLeastXItemsOfIndex( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubHowMany ) { - // not permitted for repair dealers - would take extra code to avoid counting items under repair! - Assert( !DoesDealerDoRepairs( ubArmsDealer ) ); - if( gArmsDealerStatus[ ubArmsDealer ].fOutOfBusiness ) return; - //if there are any of these in stock - if( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems >= ubHowMany ) - { - // have what we need... - return; + //ADB, ya, a whole 1 line of extra code! + // not permitted for repair dealers - would take extra code to avoid counting items under repair! + //Assert( !DoesDealerDoRepairs( ubArmsDealer ) ); + int itemsIHave = 0; + for (DealerItemList::iterator iter = gArmsDealersInventory[ ubArmsDealer ].begin(); + iter != gArmsDealersInventory[ ubArmsDealer ].end(); ++iter) { + if (iter->ItemIsInInventory() == true + && iter->object.usItem == usItemIndex + && iter->IsUnderRepair() == false) { + itemsIHave += iter->object.ubNumberOfObjects; + //if there are any of these in stock + if( itemsIHave >= ubHowMany ) + { + // have what we need... + return; + } + } } + // if he can stock it (it appears in his inventory list) // RESTRICTION REMOVED: Jake must be able to guarantee GAS even though it's not in his list, it's presence is conditional // if( GetDealersMaxItemAmount( ubArmsDealer, usItemIndex ) > 0) { //add the item - ArmsDealerGetsFreshStock( ubArmsDealer, usItemIndex, (UINT8)( ubHowMany - gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems ) ); + ArmsDealerGetsFreshStock( ubArmsDealer, usItemIndex, (UINT8)( ubHowMany - itemsIHave ) ); } } @@ -804,7 +827,7 @@ UINT32 GetArmsDealerItemTypeFromItemNumber( UINT16 usItem ) break; case IC_GUN: - switch( Weapon[ Item[ usItem ].ubClassIndex ].ubWeaponClass ) + switch( Weapon[ Item[ usItem ].ubClassIndex ].ubWeaponClass ) { case HANDGUNCLASS: return( ARMS_DEALER_HANDGUNCLASS ); @@ -944,7 +967,7 @@ UINT32 GetArmsDealerItemTypeFromItemNumber( UINT16 usItem ) case IC_THROWN: return( 0 ); // return( ARMS_DEALER_THROWN ); - + break; case IC_KEY: return( 0 ); @@ -967,8 +990,12 @@ UINT32 GetArmsDealerItemTypeFromItemNumber( UINT16 usItem ) // case IC_APPLIABLE: break; + // CHRISL: Itendify new class for inventory system + case IC_LBEGEAR: + return( 0 ); + break; default: - AssertMsg( FALSE, String( "GetArmsDealerItemTypeFromItemNumber(), invalid class %d for item %d. DF 0.", Item[ usItem ].usItemClass, usItem ) ); + AssertMsg( FALSE, String( "GetArmsDealerItemTypeFromItemNumber(), invalid class %d for item %d. DF 0.", Item[ usItem ].usItemClass, usItem ) ); break; } return( 0 ); @@ -1028,36 +1055,10 @@ BOOLEAN DoesDealerDoRepairs( UINT8 ubArmsDealer ) } -/* -INT16 GetSpecialItemFromArmsDealerInventory( UINT8 ubArmsDealer, UINT16 usItemIndex, SPECIAL_ITEM_INFO *pSpclItemInfo ) -{ - UINT8 ubElement; - - // this function won't find perfect items! - Assert( IsItemInfoSpecial( pSpclItemInfo, usItemIndex ) ); - - for( ubElement = 0; ubElement < gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubElementsAlloced; ubElement++ ) - { - // if this is the one we're looking for - if( memcmp( &(gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].Info), pSpclItemInfo, sizeof( SPECIAL_ITEM_INFO ) ) == 0 ) - { - return( ubElement ); - } - } - - // not found! - return( -1 ); -} -*/ - - BOOLEAN RepairmanIsFixingItemsButNoneAreDoneYet( UINT8 ubProfileID ) { INT8 bArmsDealer; BOOLEAN fHaveOnlyUnRepairedItems=FALSE; - UINT8 ubElement; - UINT16 usItemIndex; - bArmsDealer = GetArmsDealerIDFromMercID( ubProfileID ); if( bArmsDealer == -1 ) @@ -1068,33 +1069,25 @@ BOOLEAN RepairmanIsFixingItemsButNoneAreDoneYet( UINT8 ubProfileID ) return( FALSE ); //loop through the dealers inventory and check if there are only unrepaired items - for( usItemIndex = 1; usItemIndex < MAXITEMS; usItemIndex++ ) - { - if ( Item[usItemIndex].usItemClass == 0 ) - break; - //if there is some items in stock - if( gArmsDealersInventory[ bArmsDealer ][ usItemIndex ].ubTotalItems ) + for (DealerItemList::iterator iter = gArmsDealersInventory[ bArmsDealer ].begin(); + iter != gArmsDealersInventory[ bArmsDealer ].end(); ++iter) { + if (iter->ItemIsInInventory() == false) { + continue; + } + if ( Item[iter->object.usItem].usItemClass == 0 ) + continue; + + if( iter->IsUnderRepair() == true ) { - //loop through the array of items - for( ubElement=0; ubElement< gArmsDealersInventory[ bArmsDealer ][ usItemIndex ].ubElementsAlloced; ubElement++ ) + //if the item has been repaired + if( iter->uiRepairDoneTime <= GetWorldTotalMin() ) { - if ( gArmsDealersInventory[ bArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].fActive ) - { - //if the items status is below 0, the item is being repaired - if( gArmsDealersInventory[ bArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].Info.bItemCondition < 0 ) - { - //if the item has been repaired - if( gArmsDealersInventory[ bArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].uiRepairDoneTime <= GetWorldTotalMin() ) - { - //A repair item is ready, therefore, return false - return( FALSE ); - } - else - { - fHaveOnlyUnRepairedItems = TRUE; - } - } - } + //A repair item is ready, therefore, return false + return( FALSE ); + } + else + { + fHaveOnlyUnRepairedItems = TRUE; } } } @@ -1102,27 +1095,6 @@ BOOLEAN RepairmanIsFixingItemsButNoneAreDoneYet( UINT8 ubProfileID ) return( fHaveOnlyUnRepairedItems ); } - -UINT32 GetTimeToFixItemBeingRepaired( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubElement ) -{ - //dealer must be a repair dealer - Assert( DoesDealerDoRepairs( ubArmsDealer ) ); - // element index must be valid - Assert( ubElement < gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubElementsAlloced ); - // that item must be active - Assert( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].fActive ); - // that item must be in repair - Assert( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].Info.bItemCondition < 0 ); - - //if the item has already been repaired - if( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].uiRepairDoneTime <= GetWorldTotalMin() ) - return( 0 ); - - //Return how many more minutes it will take to fix the item - return( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].uiRepairDoneTime - GetWorldTotalMin() ); -} - - BOOLEAN CanDealerTransactItem( UINT8 ubArmsDealer, UINT16 usItemIndex, BOOLEAN fPurchaseFromPlayer ) { switch ( ArmsDealerInfo[ ubArmsDealer ].ubTypeOfArmsDealer ) @@ -1169,7 +1141,7 @@ BOOLEAN CanDealerTransactItem( UINT8 ubArmsDealer, UINT16 usItemIndex, BOOLEAN f return( CanDealerRepairItem( ubArmsDealer, usItemIndex ) ); default: - AssertMsg( FALSE, String( "CanDealerTransactItem(), type of dealer %d. AM 0.", ArmsDealerInfo[ ubArmsDealer ].ubTypeOfArmsDealer ) ); + AssertMsg( FALSE, String( "CanDealerTransactItem(), type of dealer %d. AM 0.", ArmsDealerInfo[ ubArmsDealer ].ubTypeOfArmsDealer ) ); return(FALSE); } @@ -1185,7 +1157,7 @@ BOOLEAN CanDealerRepairItem( UINT8 ubArmsDealer, UINT16 usItemIndex ) // can't repair anything that's not repairable! // if ( !( uiFlags & ITEM_REPAIRABLE ) ) - if ( !( Item[ usItemIndex ].repairable ) ) + if ( !( Item[ usItemIndex ].repairable ) ) { return(FALSE); } @@ -1205,14 +1177,14 @@ BOOLEAN CanDealerRepairItem( UINT8 ubArmsDealer, UINT16 usItemIndex ) case ARMS_DEALER_FREDO: // repairs ONLY electronics // if ( uiFlags & ITEM_ELECTRONIC ) - if ( Item[ usItemIndex ].electronic ) + if ( Item[ usItemIndex ].electronic ) { return(TRUE); } break; default: - AssertMsg( FALSE, String( "CanDealerRepairItem(), Arms Dealer %d is not a recognized repairman!. AM 1.", ubArmsDealer ) ); + AssertMsg( FALSE, String( "CanDealerRepairItem(), Arms Dealer %d is not a recognized repairman!. AM 1.", ubArmsDealer ) ); } // can't repair this... @@ -1220,88 +1192,11 @@ BOOLEAN CanDealerRepairItem( UINT8 ubArmsDealer, UINT16 usItemIndex ) } -BOOLEAN AllocMemsetSpecialItemArray( DEALER_ITEM_HEADER *pDealerItem, UINT8 ubElementsNeeded ) -{ - Assert(pDealerItem); - Assert( ubElementsNeeded > 0); - - pDealerItem->SpecialItem = (DEALER_SPECIAL_ITEM *) MemAlloc( sizeof( DEALER_SPECIAL_ITEM ) * ubElementsNeeded ); - if( pDealerItem->SpecialItem == NULL ) - { - Assert( 0 ); - return(FALSE); - } - - // zero them out (they're inactive until an item is actually added) - memset( pDealerItem->SpecialItem, 0, sizeof( DEALER_SPECIAL_ITEM ) * ubElementsNeeded ); - - pDealerItem->ubElementsAlloced = ubElementsNeeded; - - return(TRUE); -} - - -BOOLEAN ResizeSpecialItemArray( DEALER_ITEM_HEADER *pDealerItem, UINT8 ubElementsNeeded ) -{ - Assert(pDealerItem); - // must already have a ptr allocated! - Assert(pDealerItem->SpecialItem); - - - if ( ubElementsNeeded == pDealerItem->ubElementsAlloced) - { - // shouldn't have been called, but what they hey, it's not exactly a problem - return(TRUE); - } - - // already allocated, but change its size - pDealerItem->SpecialItem = (DEALER_SPECIAL_ITEM *) MemRealloc( pDealerItem->SpecialItem, sizeof( DEALER_SPECIAL_ITEM ) * ubElementsNeeded ); - if( pDealerItem->SpecialItem == NULL ) - { - Assert( 0 ); - return(FALSE); - } - - // if adding more elements - if ( ubElementsNeeded > pDealerItem->ubElementsAlloced) - { - // zero them out (they're inactive until an item is actually added) - memset( &(pDealerItem->SpecialItem[pDealerItem->ubElementsAlloced]), 0, sizeof( DEALER_SPECIAL_ITEM ) * ( ubElementsNeeded - pDealerItem->ubElementsAlloced) ); - } - - pDealerItem->ubElementsAlloced = ubElementsNeeded; - - return(TRUE); -} - - -void FreeSpecialItemArray( DEALER_ITEM_HEADER *pDealerItem) -{ - Assert(pDealerItem); - // must already have a ptr allocated! - Assert(pDealerItem->SpecialItem); - - MemFree( pDealerItem->SpecialItem ); - pDealerItem->SpecialItem = NULL; - - pDealerItem->ubElementsAlloced = 0; - pDealerItem->ubTotalItems = pDealerItem->ubPerfectItems; - - // doesn't effect perfect items, orders or stray bullets! -} - - - void ArmsDealerGetsFreshStock( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubNumItems ) { UINT8 ubCnt; - UINT8 ubItemCondition; + UINT8 ubItemCondition = 0; UINT8 ubPerfectOnes = 0; - SPECIAL_ITEM_INFO SpclItemInfo; - - // create item info describing a perfect item - SetSpecialItemInfoToDefaults( &SpclItemInfo ); - // determine the condition of each one, counting up new ones, but adding damaged ones right away for ( ubCnt = 0; ubCnt < ubNumItems; ubCnt++ ) @@ -1316,16 +1211,16 @@ void ArmsDealerGetsFreshStock( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubN else { // add a used item with that condition to his inventory - SpclItemInfo.bItemCondition = (INT8) ubItemCondition; - AddItemToArmsDealerInventory( ubArmsDealer, usItemIndex, &SpclItemInfo, 1 ); + CreateObjectForDealer(usItemIndex, ubItemCondition, 1, &gTempObject); + AddObjectToArmsDealerInventory( ubArmsDealer, &gTempObject ); } } // now add all the perfect ones, in one shot if ( ubPerfectOnes > 0) { - SpclItemInfo.bItemCondition = 100; - AddItemToArmsDealerInventory( ubArmsDealer, usItemIndex, &SpclItemInfo, ubPerfectOnes ); + CreateObjectForDealer(usItemIndex, ubItemCondition, ubPerfectOnes, &gTempObject); + AddObjectToArmsDealerInventory( ubArmsDealer, &gTempObject ); } } @@ -1341,7 +1236,7 @@ UINT8 DetermineDealerItemCondition( UINT8 ubArmsDealer, UINT16 usItemIndex ) { // if he ONLY has used items, or 50% of the time if he carries both used & new items if ( ( ArmsDealerInfo[ ubArmsDealer ].uiFlags & ARMS_DEALER_ONLY_USED_ITEMS ) || - ( ( ArmsDealerInfo[ ubArmsDealer ].uiFlags & ARMS_DEALER_SOME_USED_ITEMS ) && ( Random( 100 ) < 50 ) ) ) + ( ( ArmsDealerInfo[ ubArmsDealer ].uiFlags & ARMS_DEALER_SOME_USED_ITEMS ) && ( Random( 100 ) < 50 ) ) ) { // make the item a used one ubCondition = (UINT8)(20 + Random( 60 )); @@ -1351,8 +1246,6 @@ UINT8 DetermineDealerItemCondition( UINT8 ubArmsDealer, UINT16 usItemIndex ) return( ubCondition); } - - BOOLEAN ItemContainsLiquid( UINT16 usItemIndex ) { if(Item[usItemIndex].containsliquid) @@ -1376,86 +1269,25 @@ BOOLEAN ItemContainsLiquid( UINT16 usItemIndex ) //return( FALSE ); } - -/* -UINT32 CountTotalItemsInArmsDealersInventory( UINT8 ubArmsDealer ) +bool ItemIsSpecial(DEALER_SPECIAL_ITEM& item) { - UINT32 uiNumOfItems=0; - UINT16 usItemIndex; - - //loop through all the items in this dealer's inventory - for( usItemIndex = 1; usItemIndex < MAXITEMS; usItemIndex++ ) - { - // This counts each pack of ammo or stacked item as one. See the "distinct" version of this for an alternate version - uiNumOfItems += gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems; - } - - return( uiNumOfItems ); -} -*/ - - -UINT32 CountDistinctItemsInArmsDealersInventory( UINT8 ubArmsDealer ) -{ - UINT32 uiNumOfItems=0; - UINT16 usItemIndex; - - - for( usItemIndex = 1; usItemIndex < MAXITEMS; usItemIndex++ ) - { - if ( Item[usItemIndex].usItemClass == 0 ) - break; - //if there are any items - if( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems > 0 ) - { - // if there are any items in perfect condition - if( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubPerfectItems > 0 ) - { - // if the items can be stacked - // NOTE: This test must match the one inside AddItemsToTempDealerInventory() exactly! - if ( DealerItemIsSafeToStack( usItemIndex ) ) - { - // regardless of how many there are, they count as 1 *distinct* item! They will all be together in one box... - uiNumOfItems++; - } - else - { - // non-stacking items must be stored in one / box , because each may have unique fields besides bStatus[] - // Example: guns all have ammo, ammo type, etc. We need these uniquely represented for pricing & manipulation - uiNumOfItems += gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubPerfectItems; - } - } - - // each *active* special item counts as one additional distinct item (each one occupied a separate shopkeeper box!) - // NOTE: This is including items being repaired!!! - uiNumOfItems += CountActiveSpecialItemsInArmsDealersInventory( ubArmsDealer, usItemIndex); + for (int x = 0; x < item.object.ubNumberOfObjects; ++x) { + if (item.object[x]->attachments.empty() == false) { + //items with attachments are special + return true; } } - - return( uiNumOfItems ); -} - - -UINT8 CountActiveSpecialItemsInArmsDealersInventory( UINT8 ubArmsDealer, UINT16 usItemIndex ) -{ - UINT8 ubActiveSpecialItems = 0; - UINT8 ubElement; - - - // next, try to sell all the used ones, gotta do these one at a time so we can remove them by element - for ( ubElement = 0; ubElement < gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubElementsAlloced; ubElement++ ) - { - // don't worry about negative condition, repairmen can't come this far, they don't sell! - if ( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].fActive ) - { - ubActiveSpecialItems++; - } + if (item.IsBeingOrdered() == true) { + //item being ordered + return true; } - - return( ubActiveSpecialItems ); + if (item.IsUnderRepair() == true) { + //items in for repairs are special + return true; + } + return false; } - UINT16 CountTotalItemsRepairDealerHasInForRepairs( UINT8 ubArmsDealer ) { UINT16 usItemIndex; @@ -1468,7 +1300,7 @@ UINT16 CountTotalItemsRepairDealerHasInForRepairs( UINT8 ubArmsDealer ) //loop through the dealers inventory and count the number of items in for repairs for( usItemIndex=0; usItemIndex < MAXITEMS; usItemIndex++ ) { - if ( Item[usItemIndex].usItemClass == 0 ) + if ( Item[usItemIndex].usItemClass == 0 ) break; usHowManyInForRepairs += CountSpecificItemsRepairDealerHasInForRepairs( ubArmsDealer, usItemIndex ); } @@ -1479,7 +1311,6 @@ UINT16 CountTotalItemsRepairDealerHasInForRepairs( UINT8 ubArmsDealer ) UINT8 CountSpecificItemsRepairDealerHasInForRepairs( UINT8 ubArmsDealer, UINT16 usItemIndex ) { - UINT8 ubElement; UINT8 ubHowManyInForRepairs = 0; //if the dealer is not a repair dealer, no need to count, return 0 @@ -1487,23 +1318,15 @@ UINT8 CountSpecificItemsRepairDealerHasInForRepairs( UINT8 ubArmsDealer, UINT16 return( 0 ); - //if there is some items in stock - if( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems ) - { - //loop through the array of items - for( ubElement = 0; ubElement < gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubElementsAlloced; ubElement++ ) - { - if( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].fActive) + for (DealerItemList::iterator iter = gArmsDealersInventory[ ubArmsDealer ].begin(); + iter != gArmsDealersInventory[ ubArmsDealer ].end(); ++iter) { + if (iter->object.exists() == true && iter->object.usItem == usItemIndex) { + if( iter->IsUnderRepair() == true ) { - //if the item's status is below 0, the item is being repaired - if( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].Info.bItemCondition < 0 ) - { - ubHowManyInForRepairs++; - } + ubHowManyInForRepairs++; } } } - return( ubHowManyInForRepairs ); } @@ -1511,102 +1334,117 @@ UINT8 CountSpecificItemsRepairDealerHasInForRepairs( UINT8 ubArmsDealer, UINT16 void AddObjectToArmsDealerInventory( UINT8 ubArmsDealer, OBJECTTYPE *pObject ) { - UINT8 ubCnt; - SPECIAL_ITEM_INFO SpclItemInfo; - - - SetSpecialItemInfoFromObject( &SpclItemInfo, pObject ); - // split up all the components of an objecttype and add them as seperate items into the dealer's inventory - switch ( Item [ pObject->usItem ].usItemClass ) + OBJECTTYPE seperateObject; + int total = 0; + int usItem = pObject->usItem; + while (pObject->exists() == true) { - case IC_GUN: - // add the gun (keeps the object's status and imprintID) - // if the gun was jammed, this will forget about the jam (i.e. dealer immediately unjams anything he buys) - AddItemToArmsDealerInventory( ubArmsDealer, pObject->usItem, &SpclItemInfo, 1 ); + pObject->MoveThisObjectTo(seperateObject, 1); + StackedObjectData* pData = seperateObject[0]; - // if any GunAmmoItem is specified - if( pObject->ItemData.Gun.usGunAmmoItem != NONE) - { - // if it's regular ammo - if( Item[ pObject->ItemData.Gun.usGunAmmoItem ].usItemClass == IC_AMMO ) - { - // and there are some remaining - if ( pObject->ItemData.Gun.ubGunShotsLeft > 0 ) - { - // add the bullets of its remaining ammo - AddAmmoToArmsDealerInventory( ubArmsDealer, pObject->ItemData.Gun.usGunAmmoItem, pObject->ItemData.Gun.ubGunShotsLeft ); - } - } - else // assume it's attached ammo (mortar shells, grenades) - { - // add the launchable item (can't be imprinted, or have attachments!) - SetSpecialItemInfoToDefaults( &SpclItemInfo ); - SpclItemInfo.bItemCondition = pObject->ItemData.Gun.bGunAmmoStatus; - - // if the gun it was in was jammed, get rid of the negative status now - if ( SpclItemInfo.bItemCondition < 0 ) - { - SpclItemInfo.bItemCondition *= -1; - } - - AddItemToArmsDealerInventory( ubArmsDealer, pObject->ItemData.Gun.usGunAmmoItem, &SpclItemInfo, 1 ); - } - } - break; - - case IC_AMMO: - // add the contents of each magazine (multiple mags may have vastly different #bullets left) - for ( ubCnt = 0; ubCnt < pObject->ubNumberOfObjects; ubCnt++ ) - { - AddAmmoToArmsDealerInventory( ubArmsDealer, pObject->usItem, pObject->ItemData.Ammo.ubShotsLeft[ ubCnt ] ); - } - break; - - default: - // add each object seperately (multiple objects may have vastly different statuses, keep any imprintID) - for ( ubCnt = 0; ubCnt < pObject->ubNumberOfObjects; ubCnt++ ) - { - SpclItemInfo.bItemCondition = pObject->ItemData.Generic.bStatus[ ubCnt ]; - AddItemToArmsDealerInventory( ubArmsDealer, pObject->usItem, &SpclItemInfo, 1 ); - } - break; - } - - - // loop through any detachable attachments and add them as seperate items - for( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++ ) - { - if( pObject->usAttachItem[ ubCnt ] != NONE ) - { -// ARM: Note: this is only used for selling, not repairs, so attachmentes are seperated when sold to a dealer + // loop through any detachable attachments and add them as seperate items + for (attachmentList::iterator iter = seperateObject[0]->attachments.begin(); iter != seperateObject[0]->attachments.end();) { + // ARM: Note: this is only used for selling, not repairs, so attachmentes are seperated when sold to a dealer // If the attachment is detachable -// if (! (Item[ pObject->usAttachItem[ubCnt] ].fFlags & ITEM_INSEPARABLE ) ) - if (! (Item[ pObject->usAttachItem[ubCnt] ].inseparable ) ) + if (! (Item[ iter->usItem ].inseparable ) ) { // add this particular attachment (they can't be imprinted, or themselves have attachments!) - SetSpecialItemInfoToDefaults( &SpclItemInfo ); - SpclItemInfo.bItemCondition = pObject->bAttachStatus[ ubCnt ]; - AddItemToArmsDealerInventory( ubArmsDealer, pObject->usAttachItem[ ubCnt ], &SpclItemInfo, 1 ); + AddObjectToArmsDealerInventory( ubArmsDealer, &(*iter) ); + iter = pData->attachments.erase(iter); + if (iter == pData->attachments.end()) { + break; + } } + else { + ++iter; + } + } + int usGunAmmoItem; + int ubGunShotsLeft; + int bItemCondition; + switch ( Item [ usItem ].usItemClass ) + { + case IC_GUN: + usGunAmmoItem = seperateObject[0]->data.gun.usGunAmmoItem; + ubGunShotsLeft = seperateObject[0]->data.gun.ubGunShotsLeft; + bItemCondition = seperateObject[0]->data.gun.bGunAmmoStatus; + + // if the gun was jammed, this will forget about the jam (i.e. dealer immediately unjams anything he buys) + //reset everything but bGunStatus + seperateObject[0]->data.gun.usGunAmmoItem = 0; + seperateObject[0]->data.gun.ubGunShotsLeft = 0; + seperateObject[0]->data.gun.bGunAmmoStatus = 0; + seperateObject[0]->data.gun.ubGunState = 0; + seperateObject[0]->data.gun.ubGunAmmoType = 0; + + // add the gun (keeps the object's status and imprintID) + AddItemToArmsDealerInventory( ubArmsDealer, seperateObject ); + + // if any GunAmmoItem is specified + if( usGunAmmoItem != NONE) + { + // if it's regular ammo + if( Item[ usGunAmmoItem ].usItemClass == IC_AMMO ) + { + // and there are some remaining + if ( ubGunShotsLeft > 0 ) + { + // add the bullets of its remaining ammo + AddAmmoToArmsDealerInventory( ubArmsDealer, usGunAmmoItem, ubGunShotsLeft ); + } + } + else // assume it's attached ammo (mortar shells, grenades) + { + // add the launchable item (can't be imprinted, or have attachments!) + + // if the gun it was in was jammed, get rid of the negative status now + if ( bItemCondition < 0 ) + { + bItemCondition *= -1; + } + CreateObjectForDealer(usGunAmmoItem, bItemCondition, 1, &seperateObject); + AddItemToArmsDealerInventory( ubArmsDealer, seperateObject ); + } + } + break; + + case IC_AMMO: + // add the contents of each magazine (multiple mags may have vastly different #bullets left) + total += seperateObject[0]->data.ubShotsLeft; + break; + + default: + // add each object seperately (multiple objects may have vastly different statuses, keep any imprintID) + if (seperateObject[0]->data.objectStatus == 100) { + total += 1; + } + else { + AddItemToArmsDealerInventory( ubArmsDealer, seperateObject ); + } } } - - // nuke the original object to prevent any possible item duplication - memset( pObject, 0, sizeof( OBJECTTYPE ) ); + switch ( Item [ usItem ].usItemClass ) + { + case IC_GUN: + break; + case IC_AMMO: + AddAmmoToArmsDealerInventory( ubArmsDealer, usItem, total ); + break; + default: + if (total) { + CreateObjectForDealer(usItem, 100, total, &seperateObject); + AddItemToArmsDealerInventory( ubArmsDealer, seperateObject ); + } + break; + } } -void AddAmmoToArmsDealerInventory( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubShotsLeft ) +void AddAmmoToArmsDealerInventory( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT16 ubShotsLeft ) { - UINT8 ubMagCapacity; - UINT8 *pubStrayAmmo; - SPECIAL_ITEM_INFO SpclItemInfo; - - - // Ammo only, please!!! if (Item [ usItemIndex ].usItemClass != IC_AMMO ) { @@ -1620,13 +1458,12 @@ void AddAmmoToArmsDealerInventory( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 } - ubMagCapacity = Magazine[ Item[ usItemIndex ].ubClassIndex ].ubMagSize; - + UINT16 ubMagCapacity = Magazine[ Item[ usItemIndex ].ubClassIndex ].ubMagSize; + int numFullMags = 0; if ( ubShotsLeft >= ubMagCapacity ) { - // add however many FULL magazines the #shot left represents - SetSpecialItemInfoToDefaults( &SpclItemInfo ); - AddItemToArmsDealerInventory( ubArmsDealer, usItemIndex, &SpclItemInfo, ( UINT8 ) ( ubShotsLeft / ubMagCapacity ) ); + // add however many FULL magazines the #shot left represents + numFullMags = ubShotsLeft / ubMagCapacity; ubShotsLeft %= ubMagCapacity; } @@ -1634,204 +1471,98 @@ void AddAmmoToArmsDealerInventory( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 if ( ubShotsLeft > 0 ) { // handle "stray" ammo - add it to the dealer's stray pile - pubStrayAmmo = &(gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubStrayAmmo); + + UINT16 *pubStrayAmmo = &(gArmsDealerStatus[ubArmsDealer].ubStrayAmmo[ usItemIndex ]); *pubStrayAmmo += ubShotsLeft; // if dealer has accumulated enough stray ammo to make another full magazine, convert it! if ( *pubStrayAmmo >= ubMagCapacity ) { - SetSpecialItemInfoToDefaults( &SpclItemInfo ); - AddItemToArmsDealerInventory( ubArmsDealer, usItemIndex, &SpclItemInfo, ( UINT8 ) ( *pubStrayAmmo / ubMagCapacity ) ); - *pubStrayAmmo = *pubStrayAmmo % ubMagCapacity; + numFullMags += *pubStrayAmmo / ubMagCapacity; + *pubStrayAmmo %= ubMagCapacity; } - // I know, I know, this is getting pretty anal... But what the hell, it was easy enough to do. ARM. + // I know, I know, this is getting pretty anal... But what the hell, it was easy enough to do. ARM. + } + if (numFullMags) { + CreateObjectForDealer(usItemIndex, 100, numFullMags, &gTempObject); + AddItemToArmsDealerInventory( ubArmsDealer, gTempObject ); } } //Use AddObjectToArmsDealerInventory() instead of this when converting a complex item in OBJECTTYPE format. -void AddItemToArmsDealerInventory( UINT8 ubArmsDealer, UINT16 usItemIndex, SPECIAL_ITEM_INFO *pSpclItemInfo, UINT8 ubHowMany ) +void AddItemToArmsDealerInventory( UINT8 ubArmsDealer, OBJECTTYPE& object ) { - UINT8 ubRoomLeft; - UINT8 ubElement; - UINT8 ubElementsToAdd; - BOOLEAN fFoundOne; - BOOLEAN fSuccess; + //we can only add items to a stack if the item has no attachments (not even default) + //and if it is either perfect or ammo (and same amount of ammo) + if (object[0]->attachments.empty() == true && + (object[0]->data.objectStatus == 100 || Item [ object.usItem ].usItemClass == IC_AMMO)) { + //first find existing items with same perfect status, if found add to that, else create new one + for (DealerItemList::iterator iter = gArmsDealersInventory[ubArmsDealer].begin(); + iter != gArmsDealersInventory[ubArmsDealer].end(); ++iter) { - Assert( ubHowMany > 0); + if (iter->ItemIsInInventory() == true && + iter->object.usItem == object.usItem && + iter->bItemCondition == object[0]->data.objectStatus) { + //won't find objects in for repair - ubRoomLeft = 255 - gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems; - - if ( ubHowMany > ubRoomLeft) - { - // not enough room to store that many, any extras vanish into thin air! - ubHowMany = ubRoomLeft; - } - - if ( ubHowMany == 0) - { - return; - } - - // decide whether this item is "special" or not - if ( IsItemInfoSpecial( pSpclItemInfo, usItemIndex ) ) - { - // Anything that's used/damaged or imprinted is store as a special item in the SpecialItem array, - // exactly one item per element. We (re)allocate memory dynamically as necessary to hold the additional items. - - do - { - // search for an already allocated, empty element in the special item array - fFoundOne = FALSE; - for ( ubElement = 0; ubElement < gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubElementsAlloced; ubElement++ ) - { - if ( !( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].fActive ) ) - { - //Great! Store it here, then. - AddSpecialItemToArmsDealerInventoryAtElement( ubArmsDealer, usItemIndex, ubElement, pSpclItemInfo ); - fFoundOne = TRUE; - break; - } - } - - // if we didn't find any inactive elements already allocated - if (!fFoundOne) - { - // then we're going to have to allocate some more space... - ubElementsToAdd = max( SPECIAL_ITEMS_ALLOCED_AT_ONCE, ubHowMany); - - // if there aren't any allocated at all right now - if ( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubElementsAlloced == 0 ) - { - // allocate new memory for the real buffer - fSuccess = AllocMemsetSpecialItemArray( &gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ], ubElementsToAdd ); - } - else - { - // we have some allocated, but they're all full and we need more. MemRealloc existing amount + # addition elements - fSuccess = ResizeSpecialItemArray( &gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ], (UINT8)( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubElementsAlloced + ubElementsToAdd ) ); - } - - if ( !fSuccess ) - { - return; - } - - // now add the special item at the first of the newly added elements (still stored in ubElement!) - AddSpecialItemToArmsDealerInventoryAtElement( ubArmsDealer, usItemIndex, ubElement, pSpclItemInfo ); - } - - // store the # of the element it was placed in globally so anyone who needs that can grab it there - gubLastSpecialItemAddedAtElement = ubElement; - - ubHowMany--; - } while ( ubHowMany > 0); - } - else // adding perfect item(s) - { - // then it's stored as a "perfect" item, simply add it to that counter! - gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubPerfectItems += ubHowMany; - // increase total items of this type - gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems += ubHowMany; - } -} - - -void AddSpecialItemToArmsDealerInventoryAtElement( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubElement, SPECIAL_ITEM_INFO *pSpclItemInfo ) -{ - Assert( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems < 255 ); - Assert( ubElement < gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubElementsAlloced ); - Assert( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].fActive == FALSE ); - Assert( IsItemInfoSpecial( pSpclItemInfo , usItemIndex) ); - - - //Store the special values in that element, and make it active - gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].fActive = TRUE; - - memcpy( &(gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].Info), pSpclItemInfo, sizeof( SPECIAL_ITEM_INFO ) ); - - // increase the total items - gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems++; -} - - -// WDS bug fix (07/24/2007) - Items with default attachments have to be handled specially - -BOOLEAN SpecialItemInfoIsIdentical (SPECIAL_ITEM_INFO& baseItem, SPECIAL_ITEM_INFO& actualItem, UINT16 usItemIndex) -{ - BOOLEAN firstAttachmentIsDefault = - ((actualItem.usAttachment[ 0 ] == Item [ usItemIndex ].defaultattachment) && - (actualItem.bAttachmentStatus[0] == 100)); - for (int idx=0; idx < MAX_ATTACHMENTS; ++idx) { - if ((idx != 0) || (!firstAttachmentIsDefault)) { - if (baseItem.usAttachment[idx] != actualItem.usAttachment[idx]) - return FALSE; - if (baseItem.bAttachmentStatus[idx] != actualItem.bAttachmentStatus[idx]) - return FALSE; - } - } - if (baseItem.bItemCondition != actualItem.bItemCondition) - return FALSE; - if (baseItem.ubImprintID != actualItem.ubImprintID) - return FALSE; - - return TRUE; -} - - - -// removes ubHowMany items of usItemIndex with the matching Info from dealer ubArmsDealer -void RemoveItemFromArmsDealerInventory( UINT8 ubArmsDealer, UINT16 usItemIndex, SPECIAL_ITEM_INFO *pSpclItemInfo, UINT8 ubHowMany ) -{ - DEALER_SPECIAL_ITEM *pSpecialItem; - UINT8 ubElement; - - Assert( ubHowMany <= gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems ); - - if ( ubHowMany == 0) - { - return; - } - - - // decide whether this item is "special" or not - if ( IsItemInfoSpecial( pSpclItemInfo, usItemIndex ) ) - { - // look through the elements, trying to find special items matching the specifications - for ( ubElement = 0; ubElement < gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubElementsAlloced; ubElement++ ) - { - pSpecialItem = &(gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ]); - - // if this element is in use - if ( pSpecialItem->fActive ) - { - // and its contents are exactly what we're looking for -// if( memcmp( &(gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].Info), pSpclItemInfo, sizeof( SPECIAL_ITEM_INFO ) ) == 0 ) - if( SpecialItemInfoIsIdentical( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].Info, *pSpclItemInfo, usItemIndex)) - { - // Got one! Remove it - RemoveSpecialItemFromArmsDealerInventoryAtElement( ubArmsDealer, usItemIndex, ubElement ); - - ubHowMany--; - if ( ubHowMany == 0) - { - break; + //make sure it's not something special, objects with default attachments aren't handled, but oh well + if (ItemIsSpecial(*iter) == false) { + iter->object.AddObjectsToStack(object); + if (object.exists() == false) { + return; } } } } - - // when we've searched all the special item elements, we'd better not have any more items to remove! - Assert( ubHowMany == 0); } - else // removing perfect item(s) + + if (object.exists() == true) { + gArmsDealersInventory[ubArmsDealer].push_back(DEALER_SPECIAL_ITEM()); + DEALER_SPECIAL_ITEM* pItem = &(gArmsDealersInventory[ubArmsDealer].back()); + pItem->object = object; + pItem->bItemCondition = object[0]->data.objectStatus; + } +} + +// removes ubHowMany items of usItemIndex with the matching Info from dealer ubArmsDealer +void RemoveItemFromArmsDealerInventory( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubHowMany, OBJECTTYPE *pObj ) +{ + BOOLEAN match = TRUE; + + if ( ubHowMany == 0) { - // then it's stored as a "perfect" item, simply subtract from tha counter! - Assert( ubHowMany <= gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubPerfectItems ); - gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubPerfectItems -= ubHowMany; - // decrease total items of this type - gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems -= ubHowMany; + return; + } + for (DealerItemList::iterator iter = gArmsDealersInventory[ ubArmsDealer ].begin(); iter != gArmsDealersInventory[ ubArmsDealer ].end(); iter++){ + if (iter->ItemIsInInventory() == true && iter->object.usItem == usItemIndex) { + if(pObj != 0) + { + for(unsigned int i = 0; i < ubHowMany; i++) + { + if((*pObj)[i]->operator == (*iter->object[i])) + match = TRUE; + else + match = FALSE; + } + } + if(match == TRUE) + { + if (ubHowMany >= iter->object.ubNumberOfObjects) { + ubHowMany -= iter->object.ubNumberOfObjects; + iter = gArmsDealersInventory[ ubArmsDealer ].erase(iter); + DealerItemList::iterator iterEnd = gArmsDealersInventory[ ubArmsDealer ].end(); + if (ubHowMany > 0 || iter == gArmsDealersInventory[ ubArmsDealer ].end()) { + return; + } + } + else { + iter->object.RemoveObjectsFromStack(ubHowMany); + return; + } + } + } } } @@ -1839,100 +1570,48 @@ void RemoveItemFromArmsDealerInventory( UINT8 ubArmsDealer, UINT16 usItemIndex, void RemoveRandomItemFromArmsDealerInventory( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubHowMany ) { - UINT8 ubWhichOne; - UINT8 ubSkippedAlready; - BOOLEAN fFoundIt; - UINT8 ubElement; - SPECIAL_ITEM_INFO SpclItemInfo; - - - // not permitted for repair dealers - would take extra code to subtract items under repair from ubTotalItems!!! - Assert( !DoesDealerDoRepairs( ubArmsDealer ) ); - // Can't remove any items in for repair, though! - Assert( ubHowMany <= gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems ); + //ADB, ya, a whole 1 line of extra code! + // not permitted for repair dealers - would take extra code to avoid counting items under repair! + //Assert( !DoesDealerDoRepairs( ubArmsDealer ) ); + std::vector foundObjects; while ( ubHowMany > 0) { - // pick a random one to get rid of - ubWhichOne = (UINT8)Random(gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems ); - - // if we picked one of the perfect ones... - if ( ubWhichOne < gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubPerfectItems ) - { - // create item info describing a perfect item - SetSpecialItemInfoToDefaults( &SpclItemInfo ); - // then that's easy, its condition is 100, so remove one of those - RemoveItemFromArmsDealerInventory( ubArmsDealer, usItemIndex, &SpclItemInfo, 1 ); - } - else - { - // Yikes! Gotta look through the special items. We already know it's not any of the perfect ones, subtract those - ubWhichOne -= gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubPerfectItems; - ubSkippedAlready = 0; - - fFoundIt = FALSE; - - for ( ubElement = 0; ubElement < gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubElementsAlloced; ubElement++ ) - { - // if this is an active special item, not in repair - if ( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].fActive ) // && -// ( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].Info.bItemCondition > 0 ) ) - { - // if we skipped the right amount of them - if ( ubSkippedAlready == ubWhichOne ) - { - // then this one is it! That's the one we're gonna remove - RemoveSpecialItemFromArmsDealerInventoryAtElement( ubArmsDealer, usItemIndex, ubElement ); - fFoundIt = TRUE; - break; - } - else - { - // keep looking... - ubSkippedAlready++; - } - } + int numItems = 0; + foundObjects.clear(); + for (DealerItemList::iterator iter = gArmsDealersInventory[ ubArmsDealer ].begin(); iter != gArmsDealersInventory[ ubArmsDealer ].end(); ++iter) { + if (iter->ItemIsInInventory() == true && iter->object.usItem == usItemIndex && iter->IsUnderRepair() == false) { + foundObjects.push_back(iter); + numItems += iter->object.ubNumberOfObjects; } - - // this HAS to work, or the data structure is corrupt! - Assert(fFoundIt); + } + if (numItems == 0) { + return; } + // pick a random one to get rid of + UINT8 ubWhichOne = (UINT8)Random(numItems); + std::vector::iterator iterToRemove = foundObjects.begin(); + for (int x = (*iterToRemove)->object.ubNumberOfObjects - 1; x < ubWhichOne;) { + x += (*iterToRemove)->object.ubNumberOfObjects; + if(x < ubWhichOne) + ++iterToRemove; + } + if ((*iterToRemove)->object.ubNumberOfObjects == 1) { + gArmsDealersInventory[ubArmsDealer].erase(*iterToRemove); + } + else { + //not totally random, but close enough + (*iterToRemove)->object.RemoveObjectsFromStack(1); + } ubHowMany--; } } - -void RemoveSpecialItemFromArmsDealerInventoryAtElement( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubElement ) -{ - Assert( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems > 0 ); - Assert( ubElement < gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubElementsAlloced ); - Assert( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].fActive == TRUE ); - - // wipe it out (turning off fActive) - memset( &( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ] ), 0, sizeof( DEALER_SPECIAL_ITEM ) ); - - // one fewer item remains... - gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems--; -} - - - BOOLEAN AddDeadArmsDealerItemsToWorld( UINT8 ubMercID ) { INT8 bArmsDealer; - SOLDIERTYPE *pSoldier; - UINT16 usItemIndex; - UINT8 ubElement; - UINT8 ubHowManyMaxAtATime; - UINT8 ubLeftToDrop; - UINT8 ubNowDropping; - OBJECTTYPE TempObject; - DEALER_SPECIAL_ITEM *pSpecialItem; - SPECIAL_ITEM_INFO SpclItemInfo; - - //Get Dealer ID from from merc Id bArmsDealer = GetArmsDealerIDFromMercID( ubMercID ); if( bArmsDealer == -1 ) @@ -1941,6 +1620,7 @@ BOOLEAN AddDeadArmsDealerItemsToWorld( UINT8 ubMercID ) return( FALSE ); } + SOLDIERTYPE *pSoldier; // mark the dealer as being out of business! gArmsDealerStatus[ bArmsDealer ].fOutOfBusiness = TRUE; @@ -1956,97 +1636,60 @@ BOOLEAN AddDeadArmsDealerItemsToWorld( UINT8 ubMercID ) return( FALSE ); } - //loop through all the items in the dealer's inventory, and drop them all where the dealer was set up. - - for( usItemIndex = 1; usItemIndex < MAXITEMS; usItemIndex++ ) - { - if ( Item[usItemIndex].usItemClass == 0 ) - break; - //if the dealer has any items of this type - if( gArmsDealersInventory[ bArmsDealer ][ usItemIndex ].ubTotalItems > 0) - { - // if he has any perfect items of this time - if ( gArmsDealersInventory[ bArmsDealer ][ usItemIndex ].ubPerfectItems > 0 ) - { - // drop all the perfect items first - - // drop stackable items like ammo in stacks of whatever will fit into a large pocket instead of one at a time - ubHowManyMaxAtATime = ItemSlotLimit( usItemIndex, BIGPOCK1POS ); - if ( ubHowManyMaxAtATime < 1 ) - { - ubHowManyMaxAtATime = 1; - } - - // create item info describing a perfect item - SetSpecialItemInfoToDefaults( &SpclItemInfo ); - - ubLeftToDrop = gArmsDealersInventory[ bArmsDealer ][ usItemIndex ].ubPerfectItems; - - // ATE: While it IS leagal here to use pSoldier->sInitialGridNo, cause of where this - // function is called, there are times when we're not guarenteed that sGridNo is good - while ( ubLeftToDrop > 0) - { - ubNowDropping = min( ubLeftToDrop, ubHowManyMaxAtATime ); - - MakeObjectOutOfDealerItems( usItemIndex, &SpclItemInfo, &TempObject, ubNowDropping ); - AddItemToPool( pSoldier->sInitialGridNo, &TempObject, INVISIBLE, 0, 0, 0 ); - - ubLeftToDrop -= ubNowDropping; - } - - // remove them all from his inventory - RemoveItemFromArmsDealerInventory( bArmsDealer, usItemIndex, &SpclItemInfo, gArmsDealersInventory[ bArmsDealer ][ usItemIndex ].ubPerfectItems ); - } - - // then drop all the special items - for ( ubElement = 0; ubElement < gArmsDealersInventory[ bArmsDealer ][ usItemIndex ].ubElementsAlloced; ubElement++ ) - { - pSpecialItem = &(gArmsDealersInventory[ bArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ]); - - if ( pSpecialItem->fActive ) - { - MakeObjectOutOfDealerItems(usItemIndex, &(pSpecialItem->Info), &TempObject, 1 ); - AddItemToPool( pSoldier->sInitialGridNo, &TempObject, INVISIBLE, 0, 0, 0 ); - RemoveItemFromArmsDealerInventory( bArmsDealer, usItemIndex, &(pSpecialItem->Info), 1 ); - } - } - - // release any memory allocated for special items, he won't need it now... - if( gArmsDealersInventory[ bArmsDealer ][ usItemIndex ].ubElementsAlloced > 0 ) - { - FreeSpecialItemArray( &gArmsDealersInventory[ bArmsDealer ][ usItemIndex ] ); - } + for (DealerItemList::iterator iter = gArmsDealersInventory[bArmsDealer].begin(); + iter != gArmsDealersInventory[bArmsDealer].end(); ++iter) { + if (iter->ItemIsInInventory() == true) { + AddItemToPool( pSoldier->sInitialGridNo, &(iter->object), INVISIBLE, 0, 0, 0 ); } } + gArmsDealersInventory[bArmsDealer].clear(); + + //if the dealer has money if( gArmsDealerStatus[ bArmsDealer ].uiArmsDealersCash > 0 ) { //Create the object - memset( &TempObject, 0, sizeof( OBJECTTYPE ) ); - if( !CreateMoney( gArmsDealerStatus[ bArmsDealer ].uiArmsDealersCash, &TempObject ) ) + if( !CreateMoney( gArmsDealerStatus[ bArmsDealer ].uiArmsDealersCash, &gTempObject ) ) { return( FALSE ); } //add the money item to the dealers feet - AddItemToPool( pSoldier->sInitialGridNo, &TempObject, INVISIBLE, 0, 0, 0 ); + AddItemToPool( pSoldier->sInitialGridNo, &gTempObject, INVISIBLE, 0, 0, 0 ); gArmsDealerStatus[ bArmsDealer ].uiArmsDealersCash = 0; } - - return( TRUE ); } - -void MakeObjectOutOfDealerItems( UINT16 usItemIndex, SPECIAL_ITEM_INFO *pSpclItemInfo, OBJECTTYPE *pObject, UINT8 ubHowMany ) +void CreateObjectForDealer( int usItem, int status, int numObjects, OBJECTTYPE *pObject ) { - INT8 bItemCondition; - UINT8 ubCnt; + //if the item condition is below 0, the item is in for repairs, so flip the sign + if( status < 0 ) + { + status *= -1; + } + CreateItems(usItem, status, numObjects, pObject); + MakeObjectOutOfDealerItems(NULL, pObject); + return; +} + +void MakeObjectOutOfDealerItems( DEALER_SPECIAL_ITEM *pSpclItemInfo, OBJECTTYPE *pObject ) +{ + INT16 bItemCondition; + if (pSpclItemInfo != NULL) { + bItemCondition = pSpclItemInfo->bItemCondition; + //we might be just calling this to setup the object the dealer has + if (pObject != &(pSpclItemInfo->object)) { + *pObject = pSpclItemInfo->object; + } + } + else { + bItemCondition = (*pObject)[0]->data.objectStatus; + } - bItemCondition = pSpclItemInfo->bItemCondition; //if the item condition is below 0, the item is in for repairs, so flip the sign if( bItemCondition < 0 ) @@ -2054,42 +1697,25 @@ void MakeObjectOutOfDealerItems( UINT16 usItemIndex, SPECIAL_ITEM_INFO *pSpclIte bItemCondition *= -1; } - memset( pObject, 0, sizeof( OBJECTTYPE ) ); + for (int subObject = 0; subObject < pObject->ubNumberOfObjects; ++subObject) { + (*pObject)[subObject]->data.objectStatus = bItemCondition; - //Create the item object - CreateItems( usItemIndex, bItemCondition, ubHowMany, pObject ); - - // set the ImprintID - pObject->ubImprintID = pSpclItemInfo->ubImprintID; - - // add any attachments we've been storing - for ( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++ ) - { - if ( pSpclItemInfo->usAttachment[ ubCnt ] != NONE ) + // if it's a gun + if (Item [ pObject->usItem ].usItemClass == IC_GUN ) { - // store what it is, and its condition - pObject->usAttachItem[ ubCnt ] = pSpclItemInfo->usAttachment[ ubCnt ]; - pObject->bAttachStatus[ ubCnt ] = pSpclItemInfo->bAttachmentStatus[ ubCnt ]; + // Empty out the bullets put in by CreateItem(). We now sell all guns empty of bullets. This is so that we don't + // have to keep track of #bullets in a gun throughout dealer inventory. Without this, players could "reload" guns + // they don't have ammo for by selling them to Tony & buying them right back fully loaded! One could repeat this + // ad nauseum (empty the gun between visits) as a (really expensive) way to get unlimited special ammo like rockets. + (*pObject)[subObject]->data.gun.ubGunShotsLeft = 0; } } - - // if it's a gun - if (Item [ pObject->usItem ].usItemClass == IC_GUN ) - { - // Empty out the bullets put in by CreateItem(). We now sell all guns empty of bullets. This is so that we don't - // have to keep track of #bullets in a gun throughout dealer inventory. Without this, players could "reload" guns - // they don't have ammo for by selling them to Tony & buying them right back fully loaded! One could repeat this - // ad nauseum (empty the gun between visits) as a (really expensive) way to get unlimited special ammo like rockets. - pObject->ItemData.Gun.ubGunShotsLeft = 0; - } } void GiveObjectToArmsDealerForRepair( UINT8 ubArmsDealer, OBJECTTYPE *pObject, UINT8 ubOwnerProfileId ) { -// UINT8 ubCnt; - SPECIAL_ITEM_INFO SpclItemInfo; Assert( DoesDealerDoRepairs( ubArmsDealer ) ); @@ -2102,78 +1728,64 @@ void GiveObjectToArmsDealerForRepair( UINT8 ubArmsDealer, OBJECTTYPE *pObject, U Assert( CanDealerRepairItem( ubArmsDealer, pObject->usItem ) ); // c) Actually damaged, or a rocket rifle (being reset) - Assert( ( pObject->ItemData.Generic.bStatus[ 0 ] < 100 ) || ItemIsARocketRifle( pObject->usItem ) ); + Assert( ( (*pObject)[0]->data.objectStatus < 100 ) || ItemIsARocketRifle( pObject->usItem ) ); /* ARM: Can now repair with removeable attachments still attached... // d) Already stripped of all *detachable* attachments - for( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++ ) - { - if ( pObject->usAttachItem[ ubCnt ] != NONE ) - { - // If the attachment is detachable - if (! (Item[ pObject->usAttachItem[ubCnt] ].fFlags & ITEM_INSEPARABLE ) ) - { - Assert( 0 ); - } - } - } */ // e) If a gun, stripped of any non-ammo-class GunAmmoItems, and bullets if (Item [ pObject->usItem ].usItemClass == IC_GUN ) { // if any GunAmmoItem is specified - if( pObject->ItemData.Gun.usGunAmmoItem != NONE) + if( (*pObject)[0]->data.gun.usGunAmmoItem != NONE) { // it better be regular ammo, and empty - Assert( Item[ pObject->ItemData.Gun.usGunAmmoItem ].usItemClass == IC_AMMO ); - Assert( pObject->ItemData.Gun.ubGunShotsLeft == 0 ); + Assert( Item[ (*pObject)[0]->data.gun.usGunAmmoItem ].usItemClass == IC_AMMO ); + Assert( (*pObject)[0]->data.gun.ubGunShotsLeft == 0 ); } } - - SetSpecialItemInfoFromObject( &SpclItemInfo, pObject ); - // ok, given all that, now everything is easy! // if the gun was jammed, this will forget about the jam (i.e. dealer immediately unjams anything he will be repairing) - GiveItemToArmsDealerforRepair( ubArmsDealer, pObject->usItem, &SpclItemInfo, ubOwnerProfileId ); + GiveItemToArmsDealerforRepair( ubArmsDealer, pObject, ubOwnerProfileId ); } //PLEASE: Use GiveObjectToArmsDealerForRepair() instead of this when repairing a item in OBJECTTYPE format. -void GiveItemToArmsDealerforRepair( UINT8 ubArmsDealer, UINT16 usItemIndex, SPECIAL_ITEM_INFO *pSpclItemInfo, UINT8 ubOwnerProfileId ) +void GiveItemToArmsDealerforRepair( UINT8 ubArmsDealer, OBJECTTYPE* pObject, UINT8 ubOwnerProfileId ) { UINT32 uiTimeWhenFreeToStartIt; UINT32 uiMinutesToFix; - UINT32 uiMinutesShopClosedBeforeItsDone; + UINT32 uiMinutesShopClosedBeforeItsDone; UINT32 uiDoneWhen; Assert( DoesDealerDoRepairs( ubArmsDealer ) ); - Assert( pSpclItemInfo->bItemCondition > 0 ); - Assert( ( pSpclItemInfo->bItemCondition < 100 ) || ItemIsARocketRifle( usItemIndex ) ); + Assert( (*pObject)[0]->data.objectStatus > 0 ); + Assert( ( (*pObject)[0]->data.objectStatus < 100 ) || ItemIsARocketRifle( pObject->usItem ) ); // figure out the earliest the repairman will be free to start repairing this item uiTimeWhenFreeToStartIt = WhenWillRepairmanBeAllDoneRepairing( ubArmsDealer ); //Determine how long it will take to fix - uiMinutesToFix = CalculateSpecialItemRepairTime( ubArmsDealer, usItemIndex, pSpclItemInfo ); + uiMinutesToFix = CalculateObjectItemRepairTime( ubArmsDealer, pObject ); uiMinutesShopClosedBeforeItsDone = CalculateOvernightRepairDelay( ubArmsDealer, uiTimeWhenFreeToStartIt, uiMinutesToFix ); // clock time when this will finally be ready uiDoneWhen = uiTimeWhenFreeToStartIt + uiMinutesToFix + uiMinutesShopClosedBeforeItsDone; + gArmsDealersInventory[ ubArmsDealer ].push_back(DEALER_SPECIAL_ITEM()); + DEALER_SPECIAL_ITEM* pItem = &gArmsDealersInventory[ ubArmsDealer ].back(); + pItem->object = *pObject; // Negate the status - pSpclItemInfo->bItemCondition *= -1; - - // give it to the dealer - AddItemToArmsDealerInventory( ubArmsDealer, usItemIndex, pSpclItemInfo, 1 ); + pItem->bItemCondition = (*pObject)[0]->data.objectStatus * -1; //Set the time at which item will be fixed - gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ gubLastSpecialItemAddedAtElement ].uiRepairDoneTime = uiDoneWhen; + pItem->uiRepairDoneTime = uiDoneWhen; //Remember the original owner of the item - gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ gubLastSpecialItemAddedAtElement ].ubOwnerProfileId = ubOwnerProfileId; + pItem->ubOwnerProfileId = ubOwnerProfileId; } @@ -2181,8 +1793,6 @@ void GiveItemToArmsDealerforRepair( UINT8 ubArmsDealer, UINT16 usItemIndex, SPEC UINT32 WhenWillRepairmanBeAllDoneRepairing( UINT8 ubArmsDealer ) { UINT32 uiWhenFree; - UINT16 usItemIndex; - UINT8 ubElement; Assert( DoesDealerDoRepairs( ubArmsDealer ) ); @@ -2190,77 +1800,39 @@ UINT32 WhenWillRepairmanBeAllDoneRepairing( UINT8 ubArmsDealer ) uiWhenFree = GetWorldTotalMin(); //loop through the dealers inventory - for( usItemIndex = 1; usItemIndex < MAXITEMS; usItemIndex++ ) - { - if ( Item[usItemIndex].usItemClass == 0 ) - break; - //if there is some items in stock - if( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubTotalItems > 0 ) + for (DealerItemList::iterator iter = gArmsDealersInventory[ubArmsDealer].begin(); + iter != gArmsDealersInventory[ubArmsDealer].end(); ++iter) { + if ( iter->ItemIsInInventory() == true ) { - for ( ubElement = 0; ubElement < gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubElementsAlloced; ubElement++ ) + if( iter->IsUnderRepair() == true ) { - if ( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].fActive ) + // if this item will be done later than the latest we've found so far + if ( iter->uiRepairDoneTime > uiWhenFree ) { - //if the item is in for repairs - if( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].Info.bItemCondition < 0 ) - { - // if this item will be done later than the latest we've found so far - if ( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].uiRepairDoneTime > uiWhenFree ) - { - // then we're busy til then! - uiWhenFree = gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].uiRepairDoneTime; - } - } + // then we're busy til then! + uiWhenFree = iter->uiRepairDoneTime; } } } } - return( uiWhenFree ); } - -UINT32 CalculateSpecialItemRepairTime( UINT8 ubArmsDealer, UINT16 usItemIndex, SPECIAL_ITEM_INFO *pSpclItemInfo ) -{ - UINT32 uiRepairTime; - UINT8 ubCnt; - - uiRepairTime = CalculateSimpleItemRepairTime( ubArmsDealer, usItemIndex, pSpclItemInfo->bItemCondition ); - - // add time to repair any attachments on it - for ( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++ ) - { - if ( pSpclItemInfo->usAttachment[ ubCnt ] != NONE ) - { - // if damaged and repairable - if ( ( pSpclItemInfo->bAttachmentStatus[ ubCnt ] < 100 ) && CanDealerRepairItem( ubArmsDealer, pSpclItemInfo->usAttachment[ ubCnt ] ) ) - { - uiRepairTime += CalculateSimpleItemRepairTime( ubArmsDealer, pSpclItemInfo->usAttachment[ ubCnt ], pSpclItemInfo->bAttachmentStatus[ ubCnt ] ); - } - } - } - - return( uiRepairTime ); -} - - UINT32 CalculateObjectItemRepairTime( UINT8 ubArmsDealer, OBJECTTYPE *pItemObject ) { - UINT32 uiRepairTime; - UINT8 ubCnt; + UINT32 uiRepairTime = 0; - uiRepairTime = CalculateSimpleItemRepairTime( ubArmsDealer, pItemObject->usItem, pItemObject->ItemData.Generic.bStatus[ 0 ] ); + for (int x = 0; x < pItemObject->ubNumberOfObjects; ++x) { + uiRepairTime += CalculateSimpleItemRepairTime( ubArmsDealer, pItemObject->usItem, (*pItemObject)[x]->data.objectStatus ); - // add time to repair any attachments on it - for ( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++ ) - { - if ( pItemObject->usAttachItem[ ubCnt ] != NONE ) - { + // add time to repair any attachments on it + for (attachmentList::iterator iter = (*pItemObject)[x]->attachments.begin(); iter != (*pItemObject)[x]->attachments.end(); ++iter) { // if damaged and repairable - if ( ( pItemObject->bAttachStatus[ ubCnt ] < 100 ) && CanDealerRepairItem( ubArmsDealer, pItemObject->usAttachItem[ ubCnt ] ) ) + if ( ( (*iter)[x]->data.objectStatus < 100 ) && CanDealerRepairItem( ubArmsDealer, iter->usItem ) ) { - uiRepairTime += CalculateSimpleItemRepairTime( ubArmsDealer, pItemObject->usAttachItem[ ubCnt ], pItemObject->bAttachStatus[ ubCnt ] ); + //uiRepairTime += CalculateSimpleItemRepairTime( ubArmsDealer, iter->usItem, (*iter)[x]->data.objectStatus ); + uiRepairTime += CalculateObjectItemRepairTime( ubArmsDealer, &(*iter) ); } } } @@ -2269,7 +1841,7 @@ UINT32 CalculateObjectItemRepairTime( UINT8 ubArmsDealer, OBJECTTYPE *pItemObjec } -UINT32 CalculateSimpleItemRepairTime( UINT8 ubArmsDealer, UINT16 usItemIndex, INT8 bItemCondition ) +UINT32 CalculateSimpleItemRepairTime( UINT8 ubArmsDealer, UINT16 usItemIndex, INT16 bItemCondition ) { UINT32 uiTimeToRepair = 0; UINT32 uiRepairCost = 0; @@ -2282,14 +1854,14 @@ UINT32 CalculateSimpleItemRepairTime( UINT8 ubArmsDealer, UINT16 usItemIndex, IN // Now adjust that for the repairman's individual repair speed. // For a repairman, his BUY modifier controls his REPAIR SPEED (1.0 means minutes to repair = price in $) // with a REPAIR SPEED of 1.0, typical gun price of $2000, and a REPAIR COST of 0.5 this works out to 16.6 hrs - // for a full 100% status repair... Not bad. + // for a full 100% status repair... Not bad. uiTimeToRepair = (UINT32)( uiRepairCost * ArmsDealerInfo[ ubArmsDealer ].dRepairSpeed ); // repairs on electronic items take twice as long if the guy doesn't have the skill // for dealers, this means anyone but Fredo the Electronics guy takes twice as long (but doesn't charge double) - // (Mind you, current he's the ONLY one who CAN repair Electronics at all! Oh well.) + // (Mind you, current he's the ONLY one who CAN repair Electronics at all! Oh well.) // if( ( Item[ usItemIndex ].fFlags & ITEM_ELECTRONIC ) && ( ubArmsDealer != ARMS_DEALER_FREDO ) ) - if( ( Item[ usItemIndex ].electronic ) && ( ubArmsDealer != ARMS_DEALER_FREDO ) ) + if( ( Item[ usItemIndex ].electronic ) && ( ubArmsDealer != ARMS_DEALER_FREDO ) ) { uiTimeToRepair *= 2; } @@ -2305,46 +1877,19 @@ UINT32 CalculateSimpleItemRepairTime( UINT8 ubArmsDealer, UINT16 usItemIndex, IN -UINT32 CalculateSpecialItemRepairCost( UINT8 ubArmsDealer, UINT16 usItemIndex, SPECIAL_ITEM_INFO *pSpclItemInfo ) -{ - UINT32 uiRepairCost; - UINT8 ubCnt; - - uiRepairCost = CalculateSimpleItemRepairCost( ubArmsDealer, usItemIndex, pSpclItemInfo->bItemCondition ); - - // add cost of repairing any attachments on it - for ( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++ ) - { - if ( pSpclItemInfo->usAttachment[ ubCnt ] != NONE ) - { - // if damaged and repairable - if ( ( pSpclItemInfo->bAttachmentStatus[ ubCnt ] < 100 ) && CanDealerRepairItem( ubArmsDealer, pSpclItemInfo->usAttachment[ ubCnt ] ) ) - { - uiRepairCost += CalculateSimpleItemRepairCost( ubArmsDealer, pSpclItemInfo->usAttachment[ ubCnt ], pSpclItemInfo->bAttachmentStatus[ ubCnt ] ); - } - } - } - - return( uiRepairCost ); -} - - UINT32 CalculateObjectItemRepairCost( UINT8 ubArmsDealer, OBJECTTYPE *pItemObject ) { - UINT32 uiRepairCost; - UINT8 ubCnt; + UINT32 uiRepairCost = 0; - uiRepairCost = CalculateSimpleItemRepairCost( ubArmsDealer, pItemObject->usItem, pItemObject->ItemData.Generic.bStatus[ 0 ] ); + for (int x = 0; x < pItemObject->ubNumberOfObjects; ++x) { + uiRepairCost = CalculateSimpleItemRepairCost( ubArmsDealer, pItemObject->usItem, (*pItemObject)[x]->data.objectStatus ); - // add cost of repairing any attachments on it - for ( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++ ) - { - if ( pItemObject->usAttachItem[ ubCnt ] != NONE ) - { + // add cost of repairing any attachments on it + for (attachmentList::iterator iter = (*pItemObject)[x]->attachments.begin(); iter != (*pItemObject)[x]->attachments.end(); ++iter) { // if damaged and repairable - if ( ( pItemObject->bAttachStatus[ ubCnt ] < 100 ) && CanDealerRepairItem( ubArmsDealer, pItemObject->usAttachItem[ ubCnt ] ) ) + if ( ( (*iter)[x]->data.objectStatus < 100 ) && CanDealerRepairItem( ubArmsDealer, iter->usItem ) ) { - uiRepairCost += CalculateSimpleItemRepairCost( ubArmsDealer, pItemObject->usAttachItem[ ubCnt ], pItemObject->bAttachStatus[ ubCnt ] ); + uiRepairCost += CalculateObjectItemRepairCost( ubArmsDealer, &(*iter)); } } } @@ -2353,7 +1898,7 @@ UINT32 CalculateObjectItemRepairCost( UINT8 ubArmsDealer, OBJECTTYPE *pItemObjec } -UINT32 CalculateSimpleItemRepairCost( UINT8 ubArmsDealer, UINT16 usItemIndex, INT8 bItemCondition ) +UINT32 CalculateSimpleItemRepairCost( UINT8 ubArmsDealer, UINT16 usItemIndex, INT16 bItemCondition ) { UINT32 uiItemCost = 0; UINT32 uiRepairCost = 0; @@ -2402,109 +1947,6 @@ UINT32 CalculateSimpleItemRepairCost( UINT8 ubArmsDealer, UINT16 usItemIndex, IN } - -void SetSpecialItemInfoToDefaults( SPECIAL_ITEM_INFO *pSpclItemInfo ) -{ - UINT8 ubCnt; - - memset( pSpclItemInfo, 0, sizeof( SPECIAL_ITEM_INFO ) ); - - pSpclItemInfo->bItemCondition = 100; - pSpclItemInfo->ubImprintID = NO_PROFILE; - - for ( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++ ) - { - pSpclItemInfo->usAttachment[ ubCnt ] = NONE; - pSpclItemInfo->bAttachmentStatus[ ubCnt ] = 0; - } -} - - -void SetSpecialItemInfoFromObject( SPECIAL_ITEM_INFO *pSpclItemInfo, OBJECTTYPE *pObject ) -{ - UINT8 ubCnt; - - - memset(pSpclItemInfo, 0, sizeof( SPECIAL_ITEM_INFO ) ); - - - if( Item[ pObject->usItem ].usItemClass == IC_AMMO ) - { - // ammo condition is always 100, don't use status, which holds the #bullets - pSpclItemInfo->bItemCondition = 100; - } - else - { - pSpclItemInfo->bItemCondition = pObject->ItemData.Generic.bStatus[ 0 ]; - } - - // only guns currently have imprintID properly initialized... - if ( Item[ pObject->usItem ].usItemClass == IC_GUN) - { - pSpclItemInfo->ubImprintID = pObject->ubImprintID; - } - else - { - // override garbage imprintIDs (generally 0) for non-guns - pSpclItemInfo->ubImprintID = NO_PROFILE; - } - - for ( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++ ) - { - if( pObject->usAttachItem[ ubCnt ] != NONE ) - { - // store what it is - pSpclItemInfo->usAttachment[ ubCnt ] = pObject->usAttachItem[ ubCnt ]; - pSpclItemInfo->bAttachmentStatus[ ubCnt ] = pObject->bAttachStatus[ ubCnt ]; - } - else - { - pSpclItemInfo->usAttachment[ ubCnt ] = NONE; - pSpclItemInfo->bAttachmentStatus[ ubCnt ] = 0; - } - } -} - - - -BOOLEAN IsItemInfoSpecial( SPECIAL_ITEM_INFO *pSpclItemInfo, UINT16 usItemIndex ) -{ - UINT8 ubCnt; - - // being damaged / in repairs makes an item special - if ( pSpclItemInfo->bItemCondition != 100 ) - { - return(TRUE); - } - - // being imprinted makes an item special - if (pSpclItemInfo->ubImprintID != NO_PROFILE) - { - return(TRUE); - } - - // having an attachment makes an item special - // ...unless it is a default attachment (WDS fix 07/24/2007) - BOOLEAN firstAttachmentIsDefault = - ((pSpclItemInfo->usAttachment[ 0 ] == Item [ usItemIndex ].defaultattachment) && - (pSpclItemInfo->bAttachmentStatus[0] == 100)); - - for ( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++ ) - { - if ((ubCnt != 0) || (!firstAttachmentIsDefault)) { - if ( (pSpclItemInfo->usAttachment[ ubCnt ] != NONE) ) - { - return(TRUE); - } - } - } - - // otherwise, it's just a "perfect" item, nothing special about it - return(FALSE); -} - - - BOOLEAN DoesItemAppearInDealerInventoryList( UINT8 ubArmsDealer, UINT16 usItemIndex, BOOLEAN fPurchaseFromPlayer ) { DEALER_POSSIBLE_INV *pDealerInv=NULL; @@ -2657,78 +2099,6 @@ UINT16 CalcValueOfItemToDealer( UINT8 ubArmsDealer, UINT16 usItemIndex, BOOLEAN } - -// this only exists to support saves made with game versions < 54 or 55! -BOOLEAN LoadIncompleteArmsDealersStatus( HWFILE hFile, BOOLEAN fIncludesElgin, BOOLEAN fIncludesManny ) -{ - UINT32 uiDealersSaved; - UINT32 uiNumBytesRead; - - Assert( !fIncludesElgin || !fIncludesManny ); - - if ( !fIncludesElgin ) - { - // read 2 fewer element without Elgin or Manny in there... - uiDealersSaved = NUM_ARMS_DEALERS - 2; - } - else - { - // read one fewer element without Elgin in there... - uiDealersSaved = NUM_ARMS_DEALERS - 1; - } - - - // read in all other dealer's status - if (!FileRead( hFile, gArmsDealerStatus, uiDealersSaved * sizeof( ARMS_DEALER_STATUS ), &uiNumBytesRead )) - { - return( FALSE ); - } - - // read in all other dealer's inventory - if (!FileRead( hFile, gArmsDealersInventory, uiDealersSaved * sizeof( DEALER_ITEM_HEADER ) * MAXITEMS, &uiNumBytesRead )) - { - return( FALSE ); - } - - if ( !fIncludesElgin ) - { - // initialize Elgin now... - InitializeOneArmsDealer( ARMS_DEALER_ELGIN ); - } - - if ( !fIncludesManny ) - { - // initialize Manny now... - InitializeOneArmsDealer( ARMS_DEALER_MANNY ); - } - - return(TRUE); -} - - - -BOOLEAN DealerItemIsSafeToStack( UINT16 usItemIndex ) -{ - // basically any item type with nothing unique about it besides its status can be stacked in dealer's inventory boxes... - // NOTE: This test is only applied to items already KNOWN to be perfect - special items are obviously not-stackable - - if ( Item[ usItemIndex ].usItemClass == IC_GUN ) - { - return( FALSE ); - } - -/* - if ( ItemSlotLimit( usItemIndex, BIGPOCK1POS ) > 1 ) - { - return( TRUE ); - } -*/ - - return( TRUE ); -} - - - void GuaranteeMinimumAlcohol( UINT8 ubArmsDealer ) { GuaranteeAtLeastXItemsOfIndex( ubArmsDealer, BEER, ( UINT8 ) ( GetDealersMaxItemAmount( ubArmsDealer, BEER ) / 3 ) ); @@ -2740,7 +2110,7 @@ void GuaranteeMinimumAlcohol( UINT8 ubArmsDealer ) BOOLEAN ItemIsARocketRifle( INT16 sItemIndex ) { - if ( Item[sItemIndex].fingerprintid ) + if ( Item[sItemIndex].fingerprintid ) { return( TRUE ); } @@ -2885,7 +2255,7 @@ UINT32 CalculateMinutesClosedBetween( UINT8 ubArmsDealer, UINT32 uiStartTime, UI { Assert( uiEndTime < uiStartTime ); - // recursive calls! Add two separate times: before midnight, and after midnight + // recursive calls! Add two separate times: before midnight, and after midnight uiMinutesClosed += CalculateMinutesClosedBetween( ubArmsDealer, uiStartTime, NUM_MIN_IN_DAY ); uiMinutesClosed += CalculateMinutesClosedBetween( ubArmsDealer, 0, uiEndTime ); } diff --git a/Tactical/Arms Dealer Init.h b/Tactical/Arms Dealer Init.h index 079d937b..038e71f7 100644 --- a/Tactical/Arms Dealer Init.h +++ b/Tactical/Arms Dealer Init.h @@ -39,6 +39,7 @@ enum NUM_ARMS_DEALERS, }; +#define NUM_ORIGINAL_ARMS_DEALERS 19 //the enums for the different kinds of arms dealers enum @@ -148,26 +149,49 @@ typedef struct // THIS STRUCTURE GETS SAVED/RESTORED/RESET -typedef struct +class OLD_ARMS_DEALER_STATUS_101 { +public: UINT32 uiArmsDealersCash; // How much money the arms dealer currently has - UINT8 ubSpecificDealerFlags; // Misc state flags for specific dealers - BOOLEAN fOutOfBusiness; // Set when a dealer has been killed, etc. + UINT8 ubSpecificDealerFlags; // Misc state flags for specific dealers + BOOLEAN fOutOfBusiness; // Set when a dealer has been killed, etc. BOOLEAN fRepairDelayBeenUsed; // Set when a repairman has missed his repair time estimate & given his excuse for it BOOLEAN fUnusedKnowsPlayer; // Set if the shopkeeper has met with the player before [UNUSED] - UINT32 uiTimePlayerLastInSKI; // game time (in total world minutes) when player last talked to this dealer in SKI + UINT32 uiTimePlayerLastInSKI; // game time (in total world minutes) when player last talked to this dealer in SKI UINT8 ubPadding[ 8 ]; -} ARMS_DEALER_STATUS; +}; - - -typedef struct +// THIS STRUCTURE GETS SAVED/RESTORED/RESET +class ARMS_DEALER_STATUS { - UINT16 usAttachment[MAX_ATTACHMENTS]; // item index of any attachments on the item +public: + ARMS_DEALER_STATUS() {initialize();}; + ARMS_DEALER_STATUS& operator=(const OLD_ARMS_DEALER_STATUS_101& status); + void initialize(); + BOOLEAN Save(HWFILE hFile); + BOOLEAN Load(HWFILE hFile); + + UINT32 uiArmsDealersCash; // How much money the arms dealer currently has + UINT8 ubSpecificDealerFlags; // Misc state flags for specific dealers + BOOLEAN fOutOfBusiness; // Set when a dealer has been killed, etc. + BOOLEAN fRepairDelayBeenUsed; // Set when a repairman has missed his repair time estimate & given his excuse for it + BOOLEAN fUnusedKnowsPlayer; // Set if the shopkeeper has met with the player before [UNUSED] + UINT32 uiTimePlayerLastInSKI; // game time (in total world minutes) when player last talked to this dealer in SKI + + UINT16 ubStrayAmmo[MAXITEMS]; // partially-depleted ammo mags are stored here as #bullets, and can be converted to full packs + BOOLEAN fPreviouslyEligible[MAXITEMS]; // whether or not dealer has been eligible to sell this item in days prior to today +}; + + + +class OLD_SPECIAL_ITEM_INFO_101 +{ +public: + UINT16 usAttachment[OLD_MAX_ATTACHMENTS_101]; // item index of any attachments on the item INT8 bItemCondition; // if 0, no item is stored // from 1 to 100 indicates an item with that status @@ -175,21 +199,21 @@ typedef struct UINT8 ubImprintID; // imprint ID for imprinted items (during repair!) - INT8 bAttachmentStatus[MAX_ATTACHMENTS]; // status of any attachments on the item + INT8 bAttachmentStatus[OLD_MAX_ATTACHMENTS_101]; // status of any attachments on the item UINT8 ubPadding[2]; // filler -} SPECIAL_ITEM_INFO; +}; - -typedef struct +class OLD_DEALER_SPECIAL_ITEM_101 { +public: // Individual "special" items are stored here as needed, *one* per slot // An item is special if it is used (status < 100), has been imprinted, or has a permanent attachment - SPECIAL_ITEM_INFO Info; + OLD_SPECIAL_ITEM_INFO_101 oldInfo; - UINT32 uiRepairDoneTime; // If the item is in for repairs, this holds the time when it will be repaired (in min) + UINT32 uiRepairDoneTime; // If the item is in for repairs, this holds the time when it will be repaired (in min) BOOLEAN fActive; // TRUE means an item is stored here (empty elements may not always be freed immediately) @@ -197,12 +221,11 @@ typedef struct UINT8 ubPadding[6]; // filler -} DEALER_SPECIAL_ITEM; +}; - - -typedef struct +class OLD_DEALER_ITEM_HEADER_101 { +public: // Non-special items are all the identical and are totaled inside ubPerfectItems. // Items being repaired are also stored here, with a negative condition. // NOTE: special item elements may remain allocated long after item has been removed, to reduce memory fragmentation!!! @@ -212,20 +235,60 @@ typedef struct UINT8 ubStrayAmmo; // partially-depleted ammo mags are stored here as #bullets, and can be converted to full packs UINT8 ubElementsAlloced; // number of DEALER_SPECIAL_ITEM array elements alloced for the special item array - DEALER_SPECIAL_ITEM *SpecialItem; // dynamic array of special items with this same item index + OLD_DEALER_SPECIAL_ITEM_101 *SpecialItem; // dynamic array of special items with this same item index - UINT32 uiOrderArrivalTime; // Day the items ordered will arrive on. It's UINT32 in case we change this to minutes. + UINT32 uiOrderArrivalTime; // Day the items ordered will arrive on. It's UINT32 in case we change this to minutes. UINT8 ubQtyOnOrder; // The number of items currently on order BOOLEAN fPreviouslyEligible; // whether or not dealer has been eligible to sell this item in days prior to today UINT8 ubPadding[2]; // filler -} DEALER_ITEM_HEADER; +}; +class DEALER_SPECIAL_ITEM +{ +public: + DEALER_SPECIAL_ITEM() {initialize();}; + void ConvertFrom101(OLD_DEALER_ITEM_HEADER_101& header, OLD_DEALER_SPECIAL_ITEM_101& special, int ubArmsDealer, int usItemIndex); + BOOLEAN Save(HWFILE hFile); + BOOLEAN Load(HWFILE hFile); + void initialize(); + bool operator == (const DEALER_SPECIAL_ITEM& compare); + + bool IsUnderRepair() {return bItemCondition < 0;}; + bool IsBeingOrdered() {return ubQtyOnOrder > 0;}; + bool ItemIsInInventory() {return (this->object.exists() == true && this->IsBeingOrdered() == false);}; + + //data from OLD_SPECIAL_ITEM_INFO_101 + //UINT8 ubImprintID; // imprint ID for imprinted items (during repair!) + INT16 bItemCondition; // if 0, no item is stored + // from 1 to 100 indicates an item with that status + // -1 to -100 means the item is in for repairs, flip sign for the actual status + + + //data from OLD_DEALER_SPECIAL_ITEM_101 + UINT32 uiRepairDoneTime; // If the item is in for repairs, this holds the time when it will be repaired (in min) + //BOOLEAN fActive; // TRUE means an item is stored here (empty elements may not always be freed immediately) + UINT8 ubOwnerProfileId; // stores which merc previously owned an item being repaired + + + //data from OLD_DEALER_ITEM_HEADER_101 + UINT32 uiOrderArrivalTime; // Day the items ordered will arrive on. It's UINT32 in case we change this to minutes. + UINT8 ubQtyOnOrder; // The number of items currently on order + + char endOfPod; + OBJECTTYPE object; +}; +#define SIZEOF_DEALER_SPECIAL_ITEM_POD offsetof(DEALER_SPECIAL_ITEM, endOfPod) + + +typedef std::list DealerItemList; +extern std::vector gArmsDealersInventory; +void OrderDealerItems(int armsDealer, int usItem, int numItems, int arrivalDay); + extern ARMS_DEALER_INFO ArmsDealerInfo[ NUM_ARMS_DEALERS ]; extern ARMS_DEALER_STATUS gArmsDealerStatus[ NUM_ARMS_DEALERS ]; -extern DEALER_ITEM_HEADER gArmsDealersInventory[ NUM_ARMS_DEALERS ][ MAXITEMS ]; @@ -234,27 +297,25 @@ extern DEALER_ITEM_HEADER gArmsDealersInventory[ NUM_ARMS_DEALERS ][ MAXITEMS ] void InitAllArmsDealers(); void ShutDownArmsDealers(); +void InitializeOneArmsDealer( UINT8 ubArmsDealer ); +bool ItemIsSpecial(DEALER_SPECIAL_ITEM& item); UINT32 GetArmsDealerItemTypeFromItemNumber( UINT16 usItem ); //Count every single item the dealer has in stock //UINT32 CountTotalItemsInArmsDealersInventory( UINT8 ubArmsDealer ); //Count only the # of "distinct" item types (for shopkeeper purposes) -UINT32 CountDistinctItemsInArmsDealersInventory( UINT8 ubArmsDealer ); -UINT8 CountActiveSpecialItemsInArmsDealersInventory( UINT8 ubArmsDealer, UINT16 usItemIndex ); UINT16 CountTotalItemsRepairDealerHasInForRepairs( UINT8 ubArmsDealer ); UINT8 CountSpecificItemsRepairDealerHasInForRepairs( UINT8 ubArmsDealer, UINT16 usItemIndex ); void AddObjectToArmsDealerInventory( UINT8 ubArmsDealer, OBJECTTYPE *pObject ); -void RemoveItemFromArmsDealerInventory( UINT8 ubArmsDealer, UINT16 usItemIndex, SPECIAL_ITEM_INFO *pSpclItemInfo, UINT8 ubHowMany ); -void RemoveSpecialItemFromArmsDealerInventoryAtElement( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubElement ); +void RemoveItemFromArmsDealerInventory( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubHowMany, OBJECTTYPE *pObj = NULL ); BOOLEAN IsMercADealer( UINT8 ubMercID ); INT8 GetArmsDealerIDFromMercID( UINT8 ubMercID ); BOOLEAN SaveArmsDealerInventoryToSaveGameFile( HWFILE hFile ); -BOOLEAN LoadArmsDealerInventoryFromSavedGameFile( HWFILE hFile, BOOLEAN fIncludesElgin, BOOLEAN fIncludesManny ); void DailyUpdateOfArmsDealersInventory(); @@ -270,28 +331,22 @@ BOOLEAN CanDealerRepairItem( UINT8 ubArmsDealer, UINT16 usItemIndex ); BOOLEAN AddDeadArmsDealerItemsToWorld( UINT8 ubMercID ); -void MakeObjectOutOfDealerItems( UINT16 usItemIndex, SPECIAL_ITEM_INFO *pSpclItemInfo, OBJECTTYPE *pObject, UINT8 ubHowMany ); +void MakeObjectOutOfDealerItems( DEALER_SPECIAL_ITEM *pSpclItemInfo, OBJECTTYPE *pObject ); +void CreateObjectForDealer( int usItem, int status, int numObjects, OBJECTTYPE *pObject ); void GiveObjectToArmsDealerForRepair( UINT8 ubArmsDealer, OBJECTTYPE *pObject, UINT8 ubOwnerProfileId ); -void GiveItemToArmsDealerforRepair( UINT8 ubArmsDealer, UINT16 usItemIndex, SPECIAL_ITEM_INFO *pSpclItemInfo, UINT8 ubOwnerProfileId ); +void GiveItemToArmsDealerforRepair( UINT8 ubArmsDealer, OBJECTTYPE* pObject, UINT8 ubOwnerProfileId ); UINT32 WhenWillRepairmanBeAllDoneRepairing( UINT8 ubArmsDealer ); -UINT32 CalculateSpecialItemRepairTime( UINT8 ubArmsDealer, UINT16 usItemIndex, SPECIAL_ITEM_INFO *pSpclItemInfo ); UINT32 CalculateObjectItemRepairTime( UINT8 ubArmsDealer, OBJECTTYPE *pItemObject ); -UINT32 CalculateSimpleItemRepairTime( UINT8 ubArmsDealer, UINT16 usItemIndex, INT8 bItemCondition ); +UINT32 CalculateSimpleItemRepairTime( UINT8 ubArmsDealer, UINT16 usItemIndex, INT16 bItemCondition ); -UINT32 CalculateSpecialItemRepairCost( UINT8 ubArmsDealer, UINT16 usItemIndex, SPECIAL_ITEM_INFO *pSpclItemInfo ); UINT32 CalculateObjectItemRepairCost( UINT8 ubArmsDealer, OBJECTTYPE *pItemObject ); -UINT32 CalculateSimpleItemRepairCost( UINT8 ubArmsDealer, UINT16 usItemIndex, INT8 bItemCondition ); +UINT32 CalculateSimpleItemRepairCost( UINT8 ubArmsDealer, UINT16 usItemIndex, INT16 bItemCondition ); -void SetSpecialItemInfoToDefaults( SPECIAL_ITEM_INFO *pSpclItemInfo ); -void SetSpecialItemInfoFromObject( SPECIAL_ITEM_INFO *pSpclItemInfo, OBJECTTYPE *pObject ); - UINT16 CalcValueOfItemToDealer( UINT8 ubArmsDealer, UINT16 usItemIndex, BOOLEAN fDealerSelling ); -BOOLEAN DealerItemIsSafeToStack( UINT16 usItemIndex ); - UINT32 CalculateOvernightRepairDelay( UINT8 ubArmsDealer, UINT32 uiTimeWhenFreeToStartIt, UINT32 uiMinutesToFix ); UINT32 CalculateMinutesClosedBetween( UINT8 ubArmsDealer, UINT32 uiStartTime, UINT32 uiEndTime ); diff --git a/Tactical/ArmsDealerInvInit.cpp b/Tactical/ArmsDealerInvInit.cpp index bb2fb16e..522c4b37 100644 --- a/Tactical/ArmsDealerInvInit.cpp +++ b/Tactical/ArmsDealerInvInit.cpp @@ -3,7 +3,7 @@ #else #include "Types.h" #include "ArmsDealerInvInit.h" - #include "Item Types.h" + //#include "Item Types.h" #include "Arms Dealer Init.h" #include "DEbug.h" #include "weapons.h" @@ -17,9 +17,15 @@ #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + extern INT8 gbSelectedArmsDealerID; +// CHRISL: Updated this to include IC_LBEGEAR class // This table controls the order items appear in inventory at BR's and dealers, and which kinds of items are sold used ITEM_SORT_ENTRY DealerItemSortInfo[ ] = { @@ -36,6 +42,7 @@ ITEM_SORT_ENTRY DealerItemSortInfo[ ] = { IC_BLADE, NOGUNCLASS, FALSE }, { IC_THROWING_KNIFE, NOGUNCLASS, FALSE }, { IC_PUNCH, NOGUNCLASS, FALSE }, + { IC_LBEGEAR, NOGUNCLASS, TRUE }, { IC_ARMOUR, NOGUNCLASS, TRUE }, { IC_FACE, NOGUNCLASS, TRUE }, { IC_MEDKIT, NOGUNCLASS, FALSE }, @@ -62,7 +69,7 @@ ITEM_SORT_ENTRY DealerItemSortInfo[ ] = // Tony ( Weapons only ) // -DEALER_POSSIBLE_INV gTonyInventory[MAXITEMS+1];// = +DEALER_POSSIBLE_INV gTonyInventory[MAXITEMS+1];// = //{ // //Rare guns/ammo that Tony will buy although he won't ever sell them // { ROCKET_RIFLE, 0 }, @@ -72,43 +79,43 @@ DEALER_POSSIBLE_INV gTonyInventory[MAXITEMS+1];// = // // // //Weapons -// { GLOCK_17, 1 }, /* Glock 17 */ -// { GLOCK_18, 1 }, /* Glock 18 */ -// { BERETTA_92F, 1 }, /* Beretta 92F */ -// { BERETTA_93R, 1 }, /* Beretta 93R */ -// { SW38, 1 }, /* .38 S&W Special */ -// { BARRACUDA, 1 }, /* .357 Barracuda */ -// { DESERTEAGLE, 1 }, /* .357 DesertEagle*/ -// { M1911, 1 }, /* .45 M1911 */ -// { MP5K, 1 }, /* H&K MP5K */ +// { GLOCK_17, 1 }, /* Glock 17 */ +// { GLOCK_18, 1 }, /* Glock 18 */ +// { BERETTA_92F, 1 }, /* Beretta 92F */ +// { BERETTA_93R, 1 }, /* Beretta 93R */ +// { SW38, 1 }, /* .38 S&W Special */ +// { BARRACUDA, 1 }, /* .357 Barracuda */ +// { DESERTEAGLE, 1 }, /* .357 DesertEagle*/ +// { M1911, 1 }, /* .45 M1911 */ +// { MP5K, 1 }, /* H&K MP5K */ // { MAC10, 1 }, /* .45 MAC-10 */ // -// { THOMPSON, 1 }, /* Thompson M1A1 */ -// { COMMANDO, 1 }, /* Colt Commando */ -// { MP53, 1 }, /* H&K MP53 */ -// { AKSU74, 1 }, /* AKSU-74 */ -// { TYPE85, 1 }, /* Type-85 */ -// { SKS, 1 }, /* SKS */ -// { DRAGUNOV, 1 }, /* Dragunov */ -// { M24, 1 }, /* M24 */ +// { THOMPSON, 1 }, /* Thompson M1A1 */ +// { COMMANDO, 1 }, /* Colt Commando */ +// { MP53, 1 }, /* H&K MP53 */ +// { AKSU74, 1 }, /* AKSU-74 */ +// { TYPE85, 1 }, /* Type-85 */ +// { SKS, 1 }, /* SKS */ +// { DRAGUNOV, 1 }, /* Dragunov */ +// { M24, 1 }, /* M24 */ // { AUG, 1 }, /* Steyr AUG */ // -// { G41, 1 }, /* H&K G41 */ -// { MINI14, 1 }, /* Ruger Mini-14 */ -// { C7, 1 }, /* C-7 */ -// { FAMAS, 1 }, /* FA-MAS */ -// { AK74, 1 }, /* AK-74 */ -// { AKM, 1 }, /* AKM */ -// { M14, 1 }, /* M-14 */ -// { G3A3, 1 }, /* H&K G3A3 */ +// { G41, 1 }, /* H&K G41 */ +// { MINI14, 1 }, /* Ruger Mini-14 */ +// { C7, 1 }, /* C-7 */ +// { FAMAS, 1 }, /* FA-MAS */ +// { AK74, 1 }, /* AK-74 */ +// { AKM, 1 }, /* AKM */ +// { M14, 1 }, /* M-14 */ +// { G3A3, 1 }, /* H&K G3A3 */ // { FNFAL, 1 }, /* FN-FAL */ // // { MINIMI, 1 }, // { RPK74, 1 }, // { HK21E, 1 }, // -// { M870, 1 }, /* Remington M870 */ -// { SPAS15, 1 }, /* SPAS-15 */ +// { M870, 1 }, /* Remington M870 */ +// { SPAS15, 1 }, /* SPAS-15 */ // // { GLAUNCHER, 1 }, /* grenade launcher*/ // { UNDER_GLAUNCHER, 1 }, /* underslung g.l. */ @@ -147,10 +154,10 @@ DEALER_POSSIBLE_INV gTonyInventory[MAXITEMS+1];// = // //Ammo // { CLIP9_15, 8 }, // { CLIP9_30, 6 }, -// { CLIP9_15_AP, 3 }, /* CLIP9_15_AP */ -// { CLIP9_30_AP, 3 }, /* CLIP9_30_AP */ -// { CLIP9_15_HP, 3 }, /* CLIP9_15_HP */ -// { CLIP9_30_HP, 3 }, /* CLIP9_30_HP */ +// { CLIP9_15_AP, 3 }, /* CLIP9_15_AP */ +// { CLIP9_30_AP, 3 }, /* CLIP9_30_AP */ +// { CLIP9_15_HP, 3 }, /* CLIP9_15_HP */ +// { CLIP9_30_HP, 3 }, /* CLIP9_30_HP */ // // { CLIP38_6, 10}, /* CLIP38_6 */ // { CLIP38_6_AP, 5 }, /* CLIP38_6_AP */ @@ -159,23 +166,23 @@ DEALER_POSSIBLE_INV gTonyInventory[MAXITEMS+1];// = // { CLIP45_7, 6 }, /* CLIP45_7 */ // 70 // // { CLIP45_30, 8 }, /* CLIP45_30 */ -// { CLIP45_7_AP, 3 }, /* CLIP45_7_AP */ -// { CLIP45_30_AP, 3 }, /* CLIP45_30_AP */ -// { CLIP45_7_HP, 3 }, /* CLIP45_7_HP */ -// { CLIP45_30_HP, 3 }, /* CLIP45_30_HP */ +// { CLIP45_7_AP, 3 }, /* CLIP45_7_AP */ +// { CLIP45_30_AP, 3 }, /* CLIP45_30_AP */ +// { CLIP45_7_HP, 3 }, /* CLIP45_7_HP */ +// { CLIP45_30_HP, 3 }, /* CLIP45_30_HP */ // -// { CLIP357_6, 6 }, /* CLIP357_6 */ -// { CLIP357_9, 5 }, /* CLIP357_9 */ -// { CLIP357_6_AP, 3 }, /* CLIP357_6_AP */ -// { CLIP357_9_AP, 3 }, /* CLIP357_9_AP */ -// { CLIP357_6_HP, 3 }, /* CLIP357_6_HP */ //80 -// { CLIP357_9_HP, 3 }, /* CLIP357_9_HP */ +// { CLIP357_6, 6 }, /* CLIP357_6 */ +// { CLIP357_9, 5 }, /* CLIP357_9 */ +// { CLIP357_6_AP, 3 }, /* CLIP357_6_AP */ +// { CLIP357_9_AP, 3 }, /* CLIP357_9_AP */ +// { CLIP357_6_HP, 3 }, /* CLIP357_6_HP */ //80 +// { CLIP357_9_HP, 3 }, /* CLIP357_9_HP */ // -// { CLIP545_30_AP, 6 }, /* CLIP545_30_AP */ -// { CLIP545_30_HP, 3 }, /* CLIP545_30_HP */ +// { CLIP545_30_AP, 6 }, /* CLIP545_30_AP */ +// { CLIP545_30_HP, 3 }, /* CLIP545_30_HP */ // -// { CLIP556_30_AP, 6 }, /* CLIP556_30_AP */ -// { CLIP556_30_HP, 3 }, /* CLIP556_30_HP */ +// { CLIP556_30_AP, 6 }, /* CLIP556_30_AP */ +// { CLIP556_30_HP, 3 }, /* CLIP556_30_HP */ // // { CLIP762W_10_AP, 6 }, /* CLIP762W_10_AP */ // { CLIP762W_30_AP, 5 }, /* CLIP762W_30_AP */ @@ -184,18 +191,18 @@ DEALER_POSSIBLE_INV gTonyInventory[MAXITEMS+1];// = // // { CLIP762N_5_AP, 8 }, /* CLIP762N_5_AP */ //90 // { CLIP762N_20_AP, 5 }, /* CLIP762N_20_AP */ -// { CLIP762N_5_HP, 3 }, /* CLIP762N_5_HP */ -// { CLIP762N_20_HP, 3 }, /* CLIP762N_20_HP */ +// { CLIP762N_5_HP, 3 }, /* CLIP762N_5_HP */ +// { CLIP762N_20_HP, 3 }, /* CLIP762N_20_HP */ // -// { CLIP47_50_SAP, 5 }, /* CLIP47_50_SAP */ +// { CLIP47_50_SAP, 5 }, /* CLIP47_50_SAP */ // -// { CLIP57_50_AP, 6 }, /* CLIP57_50_AP */ -// { CLIP57_50_HP, 3 }, /* CLIP57_50_HP */ +// { CLIP57_50_AP, 6 }, /* CLIP57_50_AP */ +// { CLIP57_50_HP, 3 }, /* CLIP57_50_HP */ // -// { CLIP12G_7, 9 }, /* CLIP12G_7 */ +// { CLIP12G_7, 9 }, /* CLIP12G_7 */ // { CLIP12G_7_BUCKSHOT, 9 }, /* CLIP12G_7_BUCKSHOT */ // -// { CLIPCAWS_10_SAP, 5 }, /* CLIPCAWS_10_SAP */ +// { CLIPCAWS_10_SAP, 5 }, /* CLIPCAWS_10_SAP */ // { CLIPCAWS_10_FLECH, 3 }, /* CLIPCAWS_10_FLECH */ //100 // // { CLIPROCKET_AP, 3 }, @@ -259,7 +266,7 @@ DEALER_POSSIBLE_INV gTonyInventory[MAXITEMS+1];// = // // Devin ( Explosives ) // -DEALER_POSSIBLE_INV gDevinInventory[MAXITEMS+1];// = +DEALER_POSSIBLE_INV gDevinInventory[MAXITEMS+1];// = //{ // { STUN_GRENADE, 3 }, // { TEARGAS_GRENADE, 3 }, @@ -314,7 +321,7 @@ DEALER_POSSIBLE_INV gDevinInventory[MAXITEMS+1];// = // // Franz (Expensive pawn shop ) // -DEALER_POSSIBLE_INV gFranzInventory[MAXITEMS+1];// = +DEALER_POSSIBLE_INV gFranzInventory[MAXITEMS+1];// = //{ // { NIGHTGOGGLES, 3 }, // @@ -351,7 +358,7 @@ DEALER_POSSIBLE_INV gFranzInventory[MAXITEMS+1];// = // // Keith ( Cheap Pawn Shop ) // -DEALER_POSSIBLE_INV gKeithInventory[MAXITEMS+1];// = +DEALER_POSSIBLE_INV gKeithInventory[MAXITEMS+1];// = //{ // { FIRSTAIDKIT, 5 }, // @@ -386,7 +393,7 @@ DEALER_POSSIBLE_INV gKeithInventory[MAXITEMS+1];// = // // Sam ( Hardware ) // -DEALER_POSSIBLE_INV gSamInventory[MAXITEMS+1];// = +DEALER_POSSIBLE_INV gSamInventory[MAXITEMS+1];// = //{ // { FIRSTAIDKIT, 3 }, // @@ -427,7 +434,7 @@ DEALER_POSSIBLE_INV gSamInventory[MAXITEMS+1];// = // // Jake ( Junk ) // -DEALER_POSSIBLE_INV gJakeInventory[MAXITEMS+1];// = +DEALER_POSSIBLE_INV gJakeInventory[MAXITEMS+1];// = //{ // { FIRSTAIDKIT, 4 }, // { MEDICKIT, 3 }, @@ -462,13 +469,13 @@ DEALER_POSSIBLE_INV gJakeInventory[MAXITEMS+1];// = // { XRAY_BULB, 1 }, // // // additional stuff possible in real game -// { GLOCK_17, 1 }, /* Glock 17 */ -// { GLOCK_18, 1 }, /* Glock 18 */ -// { BERETTA_92F, 1 }, /* Beretta 92F */ -// { BERETTA_93R, 1 }, /* Beretta 93R */ -// { BARRACUDA, 1 }, /* .357 Barracuda */ -// { DESERTEAGLE, 1 }, /* .357 DesertEagle*/ -// { M1911, 1 }, /* .45 M1911 */ +// { GLOCK_17, 1 }, /* Glock 17 */ +// { GLOCK_18, 1 }, /* Glock 18 */ +// { BERETTA_92F, 1 }, /* Beretta 92F */ +// { BERETTA_93R, 1 }, /* Beretta 93R */ +// { BARRACUDA, 1 }, /* .357 Barracuda */ +// { DESERTEAGLE, 1 }, /* .357 DesertEagle*/ +// { M1911, 1 }, /* .45 M1911 */ // // { DISCARDED_LAW, 1 }, // @@ -495,7 +502,7 @@ DEALER_POSSIBLE_INV gJakeInventory[MAXITEMS+1];// = // // Howard ( Pharmaceuticals ) // -DEALER_POSSIBLE_INV gHowardInventory[MAXITEMS+1];// = +DEALER_POSSIBLE_INV gHowardInventory[MAXITEMS+1];// = //{ // { FIRSTAIDKIT, 10}, // { MEDICKIT, 5 }, @@ -516,7 +523,7 @@ DEALER_POSSIBLE_INV gHowardInventory[MAXITEMS+1];// = // // Gabby ( Creature parts and Blood ) // -DEALER_POSSIBLE_INV gGabbyInventory[MAXITEMS+1];// = +DEALER_POSSIBLE_INV gGabbyInventory[MAXITEMS+1];// = //{ // { JAR, 12 }, // { JAR_ELIXIR, 3 }, @@ -537,11 +544,11 @@ DEALER_POSSIBLE_INV gGabbyInventory[MAXITEMS+1];// = // // Frank ( Alcohol ) // -DEALER_POSSIBLE_INV gFrankInventory[MAXITEMS+1];// = +DEALER_POSSIBLE_INV gFrankInventory[MAXITEMS+1];// = //{ -// { BEER, 12 }, -// { WINE, 6 }, -// { ALCOHOL, 9 }, +// { BEER, 12 }, +// { WINE, 6 }, +// { ALCOHOL, 9 }, // // { LAST_DEALER_ITEM, NO_DEALER_ITEM }, //Last One //}; @@ -550,11 +557,11 @@ DEALER_POSSIBLE_INV gFrankInventory[MAXITEMS+1];// = // // Elgin ( Alcohol ) // -DEALER_POSSIBLE_INV gElginInventory[MAXITEMS+1];// = +DEALER_POSSIBLE_INV gElginInventory[MAXITEMS+1];// = //{ -// { BEER, 12 }, -// { WINE, 6 }, -// { ALCOHOL, 9 }, +// { BEER, 12 }, +// { WINE, 6 }, +// { ALCOHOL, 9 }, // // { LAST_DEALER_ITEM, NO_DEALER_ITEM }, //Last One //}; @@ -563,11 +570,11 @@ DEALER_POSSIBLE_INV gElginInventory[MAXITEMS+1];// = // // Manny ( Alcohol ) // -DEALER_POSSIBLE_INV gMannyInventory[MAXITEMS+1];// = +DEALER_POSSIBLE_INV gMannyInventory[MAXITEMS+1];// = //{ -// { BEER, 12 }, -// { WINE, 6 }, -// { ALCOHOL, 9 }, +// { BEER, 12 }, +// { WINE, 6 }, +// { ALCOHOL, 9 }, // // { LAST_DEALER_ITEM, NO_DEALER_ITEM }, //Last One //}; @@ -576,11 +583,11 @@ DEALER_POSSIBLE_INV gMannyInventory[MAXITEMS+1];// = // // Herve Santos ( Alcohol ) // -DEALER_POSSIBLE_INV gHerveInventory[MAXITEMS+1];// = +DEALER_POSSIBLE_INV gHerveInventory[MAXITEMS+1];// = //{ -// { BEER, 12 }, -// { WINE, 6 }, -// { ALCOHOL, 9 }, +// { BEER, 12 }, +// { WINE, 6 }, +// { ALCOHOL, 9 }, // // { LAST_DEALER_ITEM, NO_DEALER_ITEM }, //Last One //}; @@ -589,11 +596,11 @@ DEALER_POSSIBLE_INV gHerveInventory[MAXITEMS+1];// = // // Peter Santos ( Alcohol ) // -DEALER_POSSIBLE_INV gPeterInventory[MAXITEMS+1];// = +DEALER_POSSIBLE_INV gPeterInventory[MAXITEMS+1];// = //{ -// { BEER, 12 }, -// { WINE, 6 }, -// { ALCOHOL, 9 }, +// { BEER, 12 }, +// { WINE, 6 }, +// { ALCOHOL, 9 }, // // { LAST_DEALER_ITEM, NO_DEALER_ITEM }, //Last One //}; @@ -602,11 +609,11 @@ DEALER_POSSIBLE_INV gPeterInventory[MAXITEMS+1];// = // // Alberto Santos ( Alcohol ) // -DEALER_POSSIBLE_INV gAlbertoInventory[MAXITEMS+1];// = +DEALER_POSSIBLE_INV gAlbertoInventory[MAXITEMS+1];// = //{ -// { BEER, 12 }, -// { WINE, 6 }, -// { ALCOHOL, 9 }, +// { BEER, 12 }, +// { WINE, 6 }, +// { ALCOHOL, 9 }, // // { LAST_DEALER_ITEM, NO_DEALER_ITEM }, //Last One //}; @@ -615,11 +622,11 @@ DEALER_POSSIBLE_INV gAlbertoInventory[MAXITEMS+1];// = // // Carlo Santos ( Alcohol ) // -DEALER_POSSIBLE_INV gCarloInventory[MAXITEMS+1];// = +DEALER_POSSIBLE_INV gCarloInventory[MAXITEMS+1];// = //{ -// { BEER, 12 }, -// { WINE, 6 }, -// { ALCOHOL, 9 }, +// { BEER, 12 }, +// { WINE, 6 }, +// { ALCOHOL, 9 }, // // { LAST_DEALER_ITEM, NO_DEALER_ITEM }, //Last One //}; @@ -629,7 +636,7 @@ DEALER_POSSIBLE_INV gCarloInventory[MAXITEMS+1];// = // Micky ( BUYS Animal / Creature parts ) // -DEALER_POSSIBLE_INV gMickyInventory[MAXITEMS+1];// = +DEALER_POSSIBLE_INV gMickyInventory[MAXITEMS+1];// = //{ // // ONLY BUYS THIS STUFF, DOESN'T SELL IT // { BLOODCAT_CLAWS, 0 }, @@ -647,7 +654,7 @@ DEALER_POSSIBLE_INV gMickyInventory[MAXITEMS+1];// = // // Arnie ( Weapons REPAIR ) // -DEALER_POSSIBLE_INV gArnieInventory[MAXITEMS+1];// = +DEALER_POSSIBLE_INV gArnieInventory[MAXITEMS+1];// = //{ // // NO INVENTORY // @@ -657,7 +664,7 @@ DEALER_POSSIBLE_INV gArnieInventory[MAXITEMS+1];// = // // Perko ( REPAIR) // -DEALER_POSSIBLE_INV gPerkoInventory[MAXITEMS+1];// = +DEALER_POSSIBLE_INV gPerkoInventory[MAXITEMS+1];// = //{ // // NO INVENTORY // @@ -667,7 +674,7 @@ DEALER_POSSIBLE_INV gPerkoInventory[MAXITEMS+1];// = // // Fredo ( Electronics REPAIR) // -DEALER_POSSIBLE_INV gFredoInventory[MAXITEMS+1];// = +DEALER_POSSIBLE_INV gFredoInventory[MAXITEMS+1];// = //{ // // NO INVENTORY // @@ -729,11 +736,11 @@ INT8 GetDealersMaxItemAmount( UINT8 ubDealerID, UINT16 usItemIndex ) case ARMS_DEALER_JAKE: return( GetMaxItemAmount( gJakeInventory, usItemIndex ) ); break; - + case ARMS_DEALER_FRANZ: return( GetMaxItemAmount( gFranzInventory, usItemIndex ) ); break; - + case ARMS_DEALER_HOWARD: return( GetMaxItemAmount( gHowardInventory, usItemIndex ) ); break; @@ -741,11 +748,11 @@ INT8 GetDealersMaxItemAmount( UINT8 ubDealerID, UINT16 usItemIndex ) case ARMS_DEALER_SAM: return( GetMaxItemAmount( gSamInventory, usItemIndex ) ); break; - + case ARMS_DEALER_FREDO: return( GetMaxItemAmount( gFredoInventory, usItemIndex ) ); break; - + case ARMS_DEALER_GABBY: return( GetMaxItemAmount( gGabbyInventory, usItemIndex ) ); break; @@ -836,11 +843,11 @@ DEALER_POSSIBLE_INV *GetPointerToDealersPossibleInventory( UINT8 ubArmsDealerID case ARMS_DEALER_JAKE: return( gJakeInventory ); break; - + case ARMS_DEALER_FRANZ: return( gFranzInventory ); break; - + case ARMS_DEALER_HOWARD: return( gHowardInventory ); break; @@ -848,11 +855,11 @@ DEALER_POSSIBLE_INV *GetPointerToDealersPossibleInventory( UINT8 ubArmsDealerID case ARMS_DEALER_SAM: return( gSamInventory ); break; - + case ARMS_DEALER_FREDO: return( gFredoInventory ); break; - + case ARMS_DEALER_GABBY: return( gGabbyInventory ); break; @@ -920,7 +927,7 @@ UINT8 GetCurrentSuitabilityForItem( INT8 bArmsDealer, UINT16 usItemIndex, BOOLEA // case JAR: // case JAR_ELIXIR: // case JAR_CREATURE_BLOOD: - if ( Item[usItemIndex].medical || Item[usItemIndex].canteen || Item[usItemIndex].medicalkit || Item[usItemIndex].locksmithkit || Item[usItemIndex].toolkit || Item[usItemIndex].crowbar || Item[usItemIndex].jar ) + if ( Item[usItemIndex].medical || Item[usItemIndex].canteen || Item[usItemIndex].medicalkit || Item[usItemIndex].locksmithkit || Item[usItemIndex].toolkit || Item[usItemIndex].crowbar || Item[usItemIndex].jar ) return(ITEM_SUITABILITY_ALWAYS); //} @@ -944,10 +951,10 @@ UINT8 GetCurrentSuitabilityForItem( INT8 bArmsDealer, UINT16 usItemIndex, BOOLEA //Madd: Bobby Ray's will sell higher coolness stuff if it's used, and may also have a better selection at the start of the game, depending on selection if ( bArmsDealer == -1 && gGameOptions.ubBobbyRay > BR_GOOD ) { - ubMaxCoolness += gGameOptions.ubBobbyRay - 1; + ubMaxCoolness += gGameOptions.ubBobbyRay - 1; if (fUsed ) { - ubMaxCoolness += 1; + ubMaxCoolness += 1; } } @@ -1128,7 +1135,7 @@ BOOLEAN ItemTransactionOccurs( INT8 bArmsDealer, UINT16 usItemIndex, BOOLEAN fDe } else { - gArmsDealersInventory[ bArmsDealer ][ usItemIndex ].fPreviouslyEligible = TRUE; + gArmsDealerStatus[ bArmsDealer ].fPreviouslyEligible[ usItemIndex ] = TRUE; } } @@ -1219,72 +1226,17 @@ int BobbyRayItemQsortCompare(const void *pArg1, const void *pArg2) UINT8 ubItem1Quality; UINT8 ubItem2Quality; - usItem1Index = ( ( STORE_INVENTORY * ) pArg1 ) -> usItemIndex; - usItem2Index = ( ( STORE_INVENTORY * ) pArg2 ) -> usItemIndex; + usItem1Index = ( ( STORE_INVENTORY * ) pArg1 )->usItemIndex; + usItem2Index = ( ( STORE_INVENTORY * ) pArg2 )->usItemIndex; - ubItem1Quality = ( ( STORE_INVENTORY * ) pArg1 ) -> ubItemQuality; - ubItem2Quality = ( ( STORE_INVENTORY * ) pArg2 ) -> ubItemQuality; + ubItem1Quality = ( ( STORE_INVENTORY * ) pArg1 )->ubItemQuality; + ubItem2Quality = ( ( STORE_INVENTORY * ) pArg2 )->ubItemQuality; return( CompareItemsForSorting( usItem1Index, usItem2Index, ubItem1Quality, ubItem2Quality ) ); } - -int ArmsDealerItemQsortCompare(const void *pArg1, const void *pArg2) -{ - UINT16 usItem1Index; - UINT16 usItem2Index; - UINT8 ubItem1Quality; - UINT8 ubItem2Quality; - - usItem1Index = ( ( INVENTORY_IN_SLOT * ) pArg1 ) -> sItemIndex; - usItem2Index = ( ( INVENTORY_IN_SLOT * ) pArg2 ) -> sItemIndex; - - ubItem1Quality = ( ( INVENTORY_IN_SLOT * ) pArg1 ) -> ItemObject.ItemData.Generic.bStatus[ 0 ]; - ubItem2Quality = ( ( INVENTORY_IN_SLOT * ) pArg2 ) -> ItemObject.ItemData.Generic.bStatus[ 0 ]; - - return( CompareItemsForSorting( usItem1Index, usItem2Index, ubItem1Quality, ubItem2Quality ) ); -} - - - -int RepairmanItemQsortCompare(const void *pArg1, const void *pArg2) -{ - INVENTORY_IN_SLOT* pInvSlot1; - INVENTORY_IN_SLOT* pInvSlot2; - UINT32 uiRepairTime1; - UINT32 uiRepairTime2; - - - pInvSlot1 = ( INVENTORY_IN_SLOT * ) pArg1; - pInvSlot2 = ( INVENTORY_IN_SLOT * ) pArg2; - - Assert( pInvSlot1->sSpecialItemElement != -1); - Assert( pInvSlot2->sSpecialItemElement != -1); - - uiRepairTime1 = gArmsDealersInventory[ gbSelectedArmsDealerID ][ pInvSlot1->sItemIndex ].SpecialItem[ pInvSlot1->sSpecialItemElement ].uiRepairDoneTime; - uiRepairTime2 = gArmsDealersInventory[ gbSelectedArmsDealerID ][ pInvSlot2->sItemIndex ].SpecialItem[ pInvSlot2->sSpecialItemElement ].uiRepairDoneTime; - - - // lower reapir time first - if ( uiRepairTime1 < uiRepairTime2 ) - { - return( -1 ); - } - else - if ( uiRepairTime1 > uiRepairTime2 ) - { - return( 1 ); - } - else - { - return( 0 ); - } -} - - - -int CompareItemsForSorting( UINT16 usItem1Index, UINT16 usItem2Index, UINT8 ubItem1Quality, UINT8 ubItem2Quality ) +int CompareItemsForSorting( UINT16 usItem1Index, UINT16 usItem2Index, UINT16 ubItem1Quality, UINT16 ubItem2Quality ) { UINT8 ubItem1Category; UINT8 ubItem2Category; @@ -1297,124 +1249,115 @@ int CompareItemsForSorting( UINT16 usItem1Index, UINT16 usItem2Index, UINT8 ubIt ubItem2Category = GetDealerItemCategoryNumber( usItem2Index ); // lower category first - if ( ubItem1Category < ubItem2Category ) - { - return( -1 ); - } - else - if ( ubItem1Category > ubItem2Category ) - { - return( 1 ); - } - else - { - // the same category - //if ( Item[ usItem1Index ].usItemClass == IC_AMMO && Item[ usItem2Index ].usItemClass == IC_AMMO ) - //{ - //UINT8 ubItem1Calibre; - //UINT8 ubItem2Calibre; - //UINT8 ubItem1MagSize; - //UINT8 ubItem2MagSize; + if ( ubItem1Category < ubItem2Category ) + { + return( -1 ); + } + else if ( ubItem1Category > ubItem2Category ) + { + return( 1 ); + } - // AMMO is sorted by caliber first - //ubItem1Calibre = Magazine[ Item[ usItem1Index ].ubClassIndex ].ubCalibre; - //ubItem2Calibre = Magazine[ Item[ usItem2Index ].ubClassIndex ].ubCalibre; - //if ( ubItem1Calibre > ubItem2Calibre ) - //{ - // return( -1 ); - //} - //else - //if ( ubItem1Calibre < ubItem2Calibre ) - //{ - // return( 1 ); - //} - //// the same caliber - compare size of magazine, then fall out of if statement - //ubItem1MagSize = Magazine[ Item[ usItem1Index ].ubClassIndex ].ubMagSize; - //ubItem2MagSize = Magazine[ Item[ usItem2Index ].ubClassIndex ].ubMagSize; - //if ( ubItem1MagSize > ubItem2MagSize ) - //{ - // return( -1 ); - //} - //else - //if ( ubItem1MagSize < ubItem2MagSize ) - //{ - // return( 1 ); - //} - //} - //else - //{ - // items other than ammo are compared on coolness first - //ubItem1Coolness = Item[ usItem1Index ].ubCoolness; - //ubItem2Coolness = Item[ usItem2Index ].ubCoolness; + // the same category + //if ( Item[ usItem1Index ].usItemClass == IC_AMMO && Item[ usItem2Index ].usItemClass == IC_AMMO ) + //{ + //UINT8 ubItem1Calibre; + //UINT8 ubItem2Calibre; + //UINT8 ubItem1MagSize; + //UINT8 ubItem2MagSize; - //// higher coolness first - //if ( ubItem1Coolness > ubItem2Coolness ) - //{ - // return( -1 ); - //} - //else - //if ( ubItem1Coolness < ubItem2Coolness ) - //{ - // return( 1 ); - //} - //} - - // the same coolness/caliber - compare base prices then - //usItem1Price = Item[ usItem1Index ].usPrice; - //usItem2Price = Item[ usItem2Index ].usPrice; - - //// higher price first - //if ( usItem1Price > usItem2Price ) + // AMMO is sorted by caliber first + //ubItem1Calibre = Magazine[ Item[ usItem1Index ].ubClassIndex ].ubCalibre; + //ubItem2Calibre = Magazine[ Item[ usItem2Index ].ubClassIndex ].ubCalibre; + //if ( ubItem1Calibre > ubItem2Calibre ) //{ // return( -1 ); //} //else - //if ( usItem1Price < usItem2Price ) + //if ( ubItem1Calibre < ubItem2Calibre ) //{ // return( 1 ); //} - //else + //// the same caliber - compare size of magazine, then fall out of if statement + //ubItem1MagSize = Magazine[ Item[ usItem1Index ].ubClassIndex ].ubMagSize; + //ubItem2MagSize = Magazine[ Item[ usItem2Index ].ubClassIndex ].ubMagSize; + //if ( ubItem1MagSize > ubItem2MagSize ) //{ - // the same price - compare item #s, then - - //// lower index first - //if ( usItem1Index < usItem2Index ) - //{ - // return( -1 ); - //} - //else - //if ( usItem1Index > usItem2Index ) - //{ - // return( 1 ); - //} - - //Madd: sort by name (for now at least): - if (_wcsicmp(Item[usItem1Index].szBRName,Item[usItem2Index].szBRName) < 0 ) - return -1; - else if (_wcsicmp(Item[usItem1Index].szBRName,Item[usItem2Index].szBRName) > 0 ) - return 1; - else - { - // same item type = compare item quality, then - - // higher quality first - if ( ubItem1Quality > ubItem2Quality ) - { - return( -1 ); - } - else - if ( ubItem1Quality < ubItem2Quality ) - { - return( 1 ); - } - else - { - // identical items! - return( 0 ); - } - } + // return( -1 ); //} - } + //else + //if ( ubItem1MagSize < ubItem2MagSize ) + //{ + // return( 1 ); + //} + //} + //else + //{ + // items other than ammo are compared on coolness first + //ubItem1Coolness = Item[ usItem1Index ].ubCoolness; + //ubItem2Coolness = Item[ usItem2Index ].ubCoolness; + + //// higher coolness first + //if ( ubItem1Coolness > ubItem2Coolness ) + //{ + // return( -1 ); + //} + //else + //if ( ubItem1Coolness < ubItem2Coolness ) + //{ + // return( 1 ); + //} + //} + + // the same coolness/caliber - compare base prices then + //usItem1Price = Item[ usItem1Index ].usPrice; + //usItem2Price = Item[ usItem2Index ].usPrice; + + //// higher price first + //if ( usItem1Price > usItem2Price ) + //{ + // return( -1 ); + //} + //else + //if ( usItem1Price < usItem2Price ) + //{ + // return( 1 ); + //} + //else + //{ + // the same price - compare item #s, then + + //// lower index first + //if ( usItem1Index < usItem2Index ) + //{ + // return( -1 ); + //} + //else + //if ( usItem1Index > usItem2Index ) + //{ + // return( 1 ); + //} + + //Madd: sort by name (for now at least): + if (_wcsicmp(Item[usItem1Index].szBRName,Item[usItem2Index].szBRName) < 0 ) + return -1; + else if (_wcsicmp(Item[usItem1Index].szBRName,Item[usItem2Index].szBRName) > 0 ) + return 1; + + + // same item type = compare item quality, then + // higher quality first + if ( ubItem1Quality > ubItem2Quality ) + { + return( -1 ); + } + else if ( ubItem1Quality < ubItem2Quality ) + { + return( 1 ); + } + //} + // identical items! + return( 0 ); } @@ -1428,7 +1371,7 @@ UINT8 GetDealerItemCategoryNumber( UINT16 usItemIndex ) uiItemClass = Item[ usItemIndex ].usItemClass; - if ( usItemIndex < MAXITEMS && IsWeapon(usItemIndex) ) + if ( usItemIndex < MAXITEMS && IsWeapon(usItemIndex) ) { ubWeaponClass = 0;// Madd: commented out so we can sort guns by name instead ... Weapon[ usItemIndex ].ubWeaponClass; } diff --git a/Tactical/ArmsDealerInvInit.h b/Tactical/ArmsDealerInvInit.h index 30f8c7e4..275f5cd0 100644 --- a/Tactical/ArmsDealerInvInit.h +++ b/Tactical/ArmsDealerInvInit.h @@ -48,9 +48,7 @@ UINT8 HowManyItemsAreSold( INT8 bArmsDealerID, UINT16 usItemIndex, UINT8 ubNumIn UINT8 HowManyItemsToReorder(UINT8 ubWanted, UINT8 ubStillHave); int BobbyRayItemQsortCompare(const void *pArg1, const void *pArg2); -int ArmsDealerItemQsortCompare(const void *pArg1, const void *pArg2); -int RepairmanItemQsortCompare(const void *pArg1, const void *pArg2); -int CompareItemsForSorting( UINT16 usItem1Index, UINT16 usItem2Index, UINT8 ubItem1Quality, UINT8 ubItem2Quality ); +int CompareItemsForSorting( UINT16 usItem1Index, UINT16 usItem2Index, UINT16 ubItem1Quality, UINT16 ubItem2Quality ); UINT8 GetDealerItemCategoryNumber( UINT16 usItemIndex ); BOOLEAN CanDealerItemBeSoldUsed( UINT16 usItemIndex ); diff --git a/Tactical/Auto Bandage.cpp b/Tactical/Auto Bandage.cpp index 34f00506..27deedf3 100644 --- a/Tactical/Auto Bandage.cpp +++ b/Tactical/Auto Bandage.cpp @@ -35,14 +35,14 @@ #define NUMBER_MERC_FACES_AUTOBANDAGE_BOX 4 -STR16 sAutoBandageString = NULL; -INT32 giBoxId = -1; +STR16 sAutoBandageString = NULL; +INT32 giBoxId = -1; UINT16 gusTextBoxWidth = 0; -UINT16 gusTextBoxHeight = 0; -BOOLEAN gfBeginningAutoBandage = FALSE; +UINT16 gusTextBoxHeight = 0; +BOOLEAN gfBeginningAutoBandage = FALSE; INT16 gsX = 0; INT16 gsY = 0; -UINT32 guiAutoBandageSeconds = 0; +UINT32 guiAutoBandageSeconds = 0; BOOLEAN fAutoBandageComplete = FALSE; BOOLEAN fEndAutoBandage = FALSE; @@ -107,7 +107,7 @@ void BeginAutoBandage( ) for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++ ) { // if the soldier isn't active or in sector, we have problems..leave - if ( !(pSoldier->bActive) || !(pSoldier->bInSector) || ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) || (pSoldier->bAssignment == VEHICLE ) ) + if ( !(pSoldier->bActive) || !(pSoldier->bInSector) || ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) || (pSoldier->bAssignment == VEHICLE ) ) { continue; } @@ -127,9 +127,9 @@ void BeginAutoBandage( ) if ( fFoundAGuy && fFoundAMedKit ) { break; - } + } } - + } if ( !fFoundAGuy ) @@ -145,7 +145,7 @@ void BeginAutoBandage( ) if ( ! CanAutoBandage( FALSE ) ) { DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ CANT_AUTOBANDAGE_PROMPT ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_OK, NULL, NULL ); - } + } else { // Confirm if we want to start or not.... @@ -182,18 +182,18 @@ void HandleAutoBandagePending( ) for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++,pSoldier++) { // Are we in sector? - if ( pSoldier->bActive ) + if ( pSoldier->bActive ) { - if ( pSoldier->sSectorX == gWorldSectorX && pSoldier->sSectorY == gWorldSectorY && pSoldier->bSectorZ == gbWorldSectorZ && !pSoldier->fBetweenSectors ) + if ( pSoldier->sSectorX == gWorldSectorX && pSoldier->sSectorY == gWorldSectorY && pSoldier->bSectorZ == gbWorldSectorZ && !pSoldier->flags.fBetweenSectors ) { - if ( pSoldier->ubPendingAction != NO_PENDING_ACTION ) + if ( pSoldier->aiData.ubPendingAction != NO_PENDING_ACTION ) { return; } } } } - + // Do was have any menus up? if ( AreWeInAUIMenu( ) ) { @@ -224,11 +224,11 @@ void ShouldBeginAutoBandage( ) return; } - // ATE: If not in endgame - if ( ( gTacticalStatus.uiFlags & IN_DEIDRANNA_ENDGAME ) ) - { - return; - } + // ATE: If not in endgame + if ( ( gTacticalStatus.uiFlags & IN_DEIDRANNA_ENDGAME ) ) + { + return; + } if ( CanAutoBandage( FALSE ) ) { @@ -240,21 +240,21 @@ void ShouldBeginAutoBandage( ) BOOLEAN HandleAutoBandage( ) { - InputAtom InputEvent; + InputAtom InputEvent; if ( gTacticalStatus.fAutoBandageMode ) { if ( gfBeginningAutoBandage ) { //Shadow area - ShadowVideoSurfaceRect( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + ShadowVideoSurfaceRect( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); InvalidateScreen( ); RefreshScreen( NULL ); } DisplayAutoBandageUpdatePanel( ); - //RenderMercPopUpBoxFromIndex( giBoxId, gsX, gsY, FRAME_BUFFER ); + //RenderMercPopUpBoxFromIndex( giBoxId, gsX, gsY, FRAME_BUFFER ); //InvalidateRegion( gsX, gsY, gsX + gusTextBoxWidth, gsY + gusTextBoxHeight ); @@ -291,7 +291,7 @@ BOOLEAN HandleAutoBandage( ) if( fEndAutoBandage ) { - AutoBandage( FALSE ); + AutoBandage( FALSE ); fEndAutoBandage = FALSE; } @@ -315,7 +315,7 @@ BOOLEAN CreateAutoBandageString( void ) cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++,pSoldier++) { - if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife >= OKLIFE && !(pSoldier->bCollapsed) && pSoldier->bMedical > 0 && FindObjClass( pSoldier, IC_MEDKIT ) != NO_SLOT) + if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE && !(pSoldier->bCollapsed) && pSoldier->stats.bMedical > 0 && FindObjClass( pSoldier, IC_MEDKIT ) != NO_SLOT) { ubDoctor[ubDoctors] = pSoldier->ubID; ubDoctors++; @@ -330,7 +330,7 @@ BOOLEAN CreateAutoBandageString( void ) } if (ubDoctors == 1) - { + { uiDoctorNameStringLength += wcslen( Message[STR_IS_APPLYING_FIRST_AID] ); } else @@ -338,20 +338,20 @@ BOOLEAN CreateAutoBandageString( void ) uiDoctorNameStringLength += wcslen( Message[STR_ARE_APPLYING_FIRST_AID] ); } - sAutoBandageString = (STR16) MemRealloc( sAutoBandageString, uiDoctorNameStringLength * sizeof( CHAR16 ) ); + sAutoBandageString = (STR16) MemRealloc( sAutoBandageString, uiDoctorNameStringLength * sizeof( CHAR16 ) ); if (!sAutoBandageString) { return( FALSE ); } - + if (ubDoctors == 1) - { + { swprintf( sAutoBandageString, Message[STR_IS_APPLYING_FIRST_AID], MercPtrs[ubDoctor[0]]->name ); } else { // make a temporary string to hold most of the doctors names joined by commas - sTemp = (STR16) MemAlloc( uiDoctorNameStringLength * sizeof( CHAR16 ) ); + sTemp = (STR16) MemAlloc( uiDoctorNameStringLength * sizeof( CHAR16 ) ); // sTemp = MemAlloc( 1000 ); if (!sTemp) { @@ -396,11 +396,11 @@ void AutoBandage( BOOLEAN fStart ) if ( fStart ) { - gTacticalStatus.fAutoBandageMode = TRUE; + gTacticalStatus.fAutoBandageMode = TRUE; gTacticalStatus.uiFlags |= OUR_MERCS_AUTO_MOVE; gfAutoBandageFailed = FALSE; - + // ste up the autobandage panel SetUpAutoBandageUpdatePanel( ); @@ -416,14 +416,14 @@ void AutoBandage( BOOLEAN fStart ) cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++,pSoldier++) { - if ( pSoldier->bActive ) + if ( pSoldier->bActive ) { pSoldier->bSlotItemTakenFrom = NO_SLOT; pSoldier->ubAutoBandagingMedic = NOBODY; } } - ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Begin auto bandage." ); + ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Begin auto bandage." ); if (CreateAutoBandageString()) { @@ -442,7 +442,7 @@ void AutoBandage( BOOLEAN fStart ) // build a mask MSYS_DefineRegion( &gAutoBandageRegion, 0,0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST - 1, - CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); gfBeginningAutoBandage = TRUE; @@ -450,7 +450,7 @@ void AutoBandage( BOOLEAN fStart ) else { gTacticalStatus.fAutoBandageMode = FALSE; - gTacticalStatus.uiFlags &= ( ~OUR_MERCS_AUTO_MOVE ); + gTacticalStatus.uiFlags &= ( ~OUR_MERCS_AUTO_MOVE ); // make sure anyone under AI control has their action cancelled cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; @@ -467,11 +467,11 @@ void AutoBandage( BOOLEAN fStart ) } // ATE: Make everyone stand up! - if ( pSoldier->bLife >= OKLIFE && !pSoldier->bCollapsed ) + if ( pSoldier->stats.bLife >= OKLIFE && !pSoldier->bCollapsed ) { if ( gAnimControl[ pSoldier->usAnimState ].ubHeight != ANIM_STAND ) { - ChangeSoldierStance( pSoldier, ANIM_STAND ); + pSoldier->ChangeSoldierStance( ANIM_STAND ); } } @@ -487,7 +487,7 @@ void AutoBandage( BOOLEAN fStart ) // If anyone is still doing aid animation, stop! if ( MercPtrs[ ubLoop ]->usAnimState == GIVING_AID ) { - SoldierGotoStationaryStance( MercPtrs[ ubLoop ] ); + MercPtrs[ ubLoop ]->SoldierGotoStationaryStance( ); } } @@ -507,8 +507,8 @@ void AutoBandage( BOOLEAN fStart ) // Delete popup! RemoveMercPopupBoxFromIndex( giBoxId ); giBoxId = -1; - ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"End auto bandage." ); - + ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"End auto bandage." ); + // build a mask MSYS_RemoveRegion( &gAutoBandageRegion ); @@ -538,7 +538,7 @@ void AutoBandage( BOOLEAN fStart ) void BeginAutoBandageCallBack( UINT8 bExitValue ) { - if( bExitValue == MSG_BOX_RETURN_YES ) + if( bExitValue == MSG_BOX_RETURN_YES ) { fRestoreBackgroundForMessageBox = TRUE; AutoBandage( TRUE ); @@ -548,15 +548,15 @@ void BeginAutoBandageCallBack( UINT8 bExitValue ) void SetUpAutoBandageUpdatePanel( void ) { - + INT32 iNumberDoctoring = 0; INT32 iNumberPatienting = 0; INT32 iNumberOnTeam = 0; INT32 iCounterA = 0; // reset the tables of merc ids - memset( iDoctorList, -1, sizeof( INT32 ) * MAX_CHARACTER_COUNT ); - memset( iPatientList, -1, sizeof( INT32 ) * MAX_CHARACTER_COUNT ); + memset( iDoctorList, -1, sizeof( INT32 ) * MAX_CHARACTER_COUNT ); + memset( iPatientList, -1, sizeof( INT32 ) * MAX_CHARACTER_COUNT ); // grab number of potential grunts on players team @@ -570,7 +570,7 @@ void SetUpAutoBandageUpdatePanel( void ) // add to list, up the count iDoctorList[ iNumberDoctoring ] = iCounterA; iNumberDoctoring++; - + } } @@ -589,7 +589,7 @@ void SetUpAutoBandageUpdatePanel( void ) if( ( iNumberDoctoring == 0 ) || ( iNumberPatienting == 0 ) ) { // reset the tables of merc ids - memset( iDoctorList, -1, sizeof( INT32 ) * MAX_CHARACTER_COUNT ); + memset( iDoctorList, -1, sizeof( INT32 ) * MAX_CHARACTER_COUNT ); memset( iPatientList, -1, sizeof( INT32 ) * MAX_CHARACTER_COUNT ); } @@ -619,7 +619,7 @@ void DisplayAutoBandageUpdatePanel( void ) // are even in autobandage mode? if( gTacticalStatus.fAutoBandageMode == FALSE ) { - // nope, + // nope, return; } @@ -643,7 +643,7 @@ void DisplayAutoBandageUpdatePanel( void ) } // build dimensions of box - + if( iNumberDoctors < NUMBER_MERC_FACES_AUTOBANDAGE_BOX ) { // nope, get the base amount @@ -654,8 +654,8 @@ void DisplayAutoBandageUpdatePanel( void ) iNumberDoctorsWide = NUMBER_MERC_FACES_AUTOBANDAGE_BOX; } - - + + // set the min number of mercs if( iNumberDoctorsWide < 3 ) { @@ -669,7 +669,7 @@ void DisplayAutoBandageUpdatePanel( void ) // the doctors iNumberDoctorsHigh = ( iNumberDoctors / ( NUMBER_MERC_FACES_AUTOBANDAGE_BOX ) + 1 ); - + if( iNumberDoctors % NUMBER_MERC_FACES_AUTOBANDAGE_BOX ) { // now the patients @@ -678,7 +678,7 @@ void DisplayAutoBandageUpdatePanel( void ) else { // now the patients - iNumberDoctorsHigh = ( iNumberDoctors / ( NUMBER_MERC_FACES_AUTOBANDAGE_BOX ) ); + iNumberDoctorsHigh = ( iNumberDoctors / ( NUMBER_MERC_FACES_AUTOBANDAGE_BOX ) ); } if( iNumberPatients < NUMBER_MERC_FACES_AUTOBANDAGE_BOX ) @@ -705,18 +705,18 @@ void DisplayAutoBandageUpdatePanel( void ) if( iNumberPatients % NUMBER_MERC_FACES_AUTOBANDAGE_BOX ) { // now the patients - iNumberPatientsHigh = ( iNumberPatients / ( NUMBER_MERC_FACES_AUTOBANDAGE_BOX ) + 1 ); + iNumberPatientsHigh = ( iNumberPatients / ( NUMBER_MERC_FACES_AUTOBANDAGE_BOX ) + 1 ); } else { // now the patients - iNumberPatientsHigh = ( iNumberPatients / ( NUMBER_MERC_FACES_AUTOBANDAGE_BOX ) ); + iNumberPatientsHigh = ( iNumberPatients / ( NUMBER_MERC_FACES_AUTOBANDAGE_BOX ) ); } - + // now the actual pixel dimensions - + iTotalPixelsHigh = ( iNumberPatientsHigh + iNumberDoctorsHigh ) * TACT_UPDATE_MERC_FACE_X_HEIGHT; // see which is wider, and set to this @@ -747,10 +747,10 @@ void DisplayAutoBandageUpdatePanel( void ) { sCurrentXPosition = sXPosition + ( iCounterB * TACT_UPDATE_MERC_FACE_X_WIDTH ); sCurrentYPosition = sYPosition + ( iCounterA * TACT_UPDATE_MERC_FACE_X_HEIGHT ); - + // slap down background piece BltVideoObject( FRAME_BUFFER , hBackGroundHandle, 15, sCurrentXPosition, sCurrentYPosition, VO_BLT_SRCTRANSPARENCY, NULL ); - + iIndex = iCounterA * iNumberDoctorsWide + iCounterB; @@ -759,17 +759,17 @@ void DisplayAutoBandageUpdatePanel( void ) sCurrentXPosition += TACT_UPDATE_MERC_FACE_X_OFFSET; sCurrentYPosition += TACT_UPDATE_MERC_FACE_Y_OFFSET; - + // there is a face RenderSoldierSmallFaceForAutoBandagePanel( iIndex, sCurrentXPosition, sCurrentYPosition ); - + // display the mercs name swprintf( sString, L"%s", ( Menptr[ iDoctorList[ iCounterA * iNumberDoctorsWide + iCounterB ] ] ).name ); - FindFontCenterCoordinates( ( INT16 )( sCurrentXPosition ), ( INT16 )( sCurrentYPosition ), ( TACT_UPDATE_MERC_FACE_X_WIDTH - 25 ), 0, sString, TINYFONT1, &sX, &sY ); + FindFontCenterCoordinates( ( INT16 )( sCurrentXPosition ), ( INT16 )( sCurrentYPosition ), ( TACT_UPDATE_MERC_FACE_X_WIDTH - 25 ), 0, sString, TINYFONT1, &sX, &sY ); SetFont( TINYFONT1 ); SetFontForeground( FONT_LTRED ); - SetFontBackground( FONT_BLACK ); - + SetFontBackground( FONT_BLACK ); + sY+= 35; sCurrentXPosition -= TACT_UPDATE_MERC_FACE_X_OFFSET; sCurrentYPosition -= TACT_UPDATE_MERC_FACE_Y_OFFSET; @@ -786,8 +786,8 @@ void DisplayAutoBandageUpdatePanel( void ) // slap down background piece BltVideoObject( FRAME_BUFFER , hBackGroundHandle, 16, sXPosition + ( iCounterB * TACT_UPDATE_MERC_FACE_X_WIDTH ), sCurrentYPosition + ( TACT_UPDATE_MERC_FACE_X_HEIGHT ), VO_BLT_SRCTRANSPARENCY, NULL ); BltVideoObject( FRAME_BUFFER , hBackGroundHandle, 16, sXPosition + ( iCounterB * TACT_UPDATE_MERC_FACE_X_WIDTH ), sYPosition - 9 , VO_BLT_SRCTRANSPARENCY, NULL ); - - + + } // bordering patient title @@ -797,20 +797,20 @@ void DisplayAutoBandageUpdatePanel( void ) SetFont( TINYFONT1 ); SetFontForeground( FONT_WHITE ); - SetFontBackground( FONT_BLACK ); + SetFontBackground( FONT_BLACK ); // iCurPixelY = sYPosition; iCurPixelY = sYPosition + ( ( iCounterA - 1 ) * TACT_UPDATE_MERC_FACE_X_HEIGHT ); - + swprintf( sString, L"%s", zMarksMapScreenText[ 13 ] ); - FindFontCenterCoordinates( ( INT16 )( sXPosition ), ( INT16 )( sCurrentYPosition ), ( INT16 )( iTotalPixelsWide ), 0, sString, TINYFONT1, &sX, &sY ); + FindFontCenterCoordinates( ( INT16 )( sXPosition ), ( INT16 )( sCurrentYPosition ), ( INT16 )( iTotalPixelsWide ), 0, sString, TINYFONT1, &sX, &sY ); // print medic mprintf( sX, sYPosition - 7 , sString ); - - //DisplayWrappedString( ( INT16 )( sXPosition ), ( INT16 )( sCurrentYPosition - 40 ), ( INT16 )( iTotalPixelsWide ), 0, TINYFONT1, FONT_WHITE, pUpdateMercStrings[ 0 ], FONT_BLACK, 0, 0 ); - + //DisplayWrappedString( ( INT16 )( sXPosition ), ( INT16 )( sCurrentYPosition - 40 ), ( INT16 )( iTotalPixelsWide ), 0, TINYFONT1, FONT_WHITE, pUpdateMercStrings[ 0 ], FONT_BLACK, 0, 0 ); + + sYPosition += 9; // now the patients @@ -821,8 +821,8 @@ void DisplayAutoBandageUpdatePanel( void ) sCurrentXPosition = sXPosition + ( iCounterB * TACT_UPDATE_MERC_FACE_X_WIDTH ); sCurrentYPosition = sYPosition + ( ( iCounterA + iNumberDoctorsHigh ) * TACT_UPDATE_MERC_FACE_X_HEIGHT ); - - + + // slap down background piece BltVideoObject( FRAME_BUFFER , hBackGroundHandle, 15, sCurrentXPosition, sCurrentYPosition , VO_BLT_SRCTRANSPARENCY, NULL ); @@ -834,25 +834,25 @@ void DisplayAutoBandageUpdatePanel( void ) sCurrentXPosition += TACT_UPDATE_MERC_FACE_X_OFFSET; sCurrentYPosition += TACT_UPDATE_MERC_FACE_Y_OFFSET; - + // there is a face RenderSoldierSmallFaceForAutoBandagePanel( iIndex + iNumberDoctors, sCurrentXPosition, sCurrentYPosition ); - + // display the mercs name swprintf( sString, L"%s", ( Menptr[ iPatientList[ iIndex ] ] ).name ); - FindFontCenterCoordinates( ( INT16 )( sCurrentXPosition ), ( INT16 )( sCurrentYPosition ), ( TACT_UPDATE_MERC_FACE_X_WIDTH - 25 ), 0, sString, TINYFONT1, &sX, &sY ); + FindFontCenterCoordinates( ( INT16 )( sCurrentXPosition ), ( INT16 )( sCurrentYPosition ), ( TACT_UPDATE_MERC_FACE_X_WIDTH - 25 ), 0, sString, TINYFONT1, &sX, &sY ); SetFont( TINYFONT1 ); SetFontForeground( FONT_LTRED ); - SetFontBackground( FONT_BLACK ); + SetFontBackground( FONT_BLACK ); sY+= 35; - + // print name mprintf( sX, sY , sString ); } - + } } - + // BORDER PIECES!!!! @@ -860,7 +860,7 @@ void DisplayAutoBandageUpdatePanel( void ) for( iCounterA = 0; iCounterA < iNumberPatientsHigh; iCounterA++ ) { BltVideoObject( FRAME_BUFFER , hBackGroundHandle, 3, sXPosition - 4, sYPosition + ( ( iCounterA + iNumberDoctorsHigh ) * TACT_UPDATE_MERC_FACE_X_HEIGHT ) , VO_BLT_SRCTRANSPARENCY,NULL ); - BltVideoObject( FRAME_BUFFER , hBackGroundHandle, 5, sXPosition + iTotalPixelsWide , sYPosition + ( ( iCounterA + iNumberDoctorsHigh ) * TACT_UPDATE_MERC_FACE_X_HEIGHT ), VO_BLT_SRCTRANSPARENCY,NULL ); + BltVideoObject( FRAME_BUFFER , hBackGroundHandle, 5, sXPosition + iTotalPixelsWide , sYPosition + ( ( iCounterA + iNumberDoctorsHigh ) * TACT_UPDATE_MERC_FACE_X_HEIGHT ), VO_BLT_SRCTRANSPARENCY,NULL ); } @@ -870,8 +870,8 @@ void DisplayAutoBandageUpdatePanel( void ) // pieces bordering doctor squares for( iCounterA = 0; iCounterA < iNumberDoctorsHigh; iCounterA++ ) { - BltVideoObject( FRAME_BUFFER , hBackGroundHandle, 3, sXPosition - 4, sYPosition + ( ( iCounterA ) * TACT_UPDATE_MERC_FACE_X_HEIGHT ) , VO_BLT_SRCTRANSPARENCY,NULL ); - BltVideoObject( FRAME_BUFFER , hBackGroundHandle, 5, sXPosition + iTotalPixelsWide , sYPosition + ( ( iCounterA ) * TACT_UPDATE_MERC_FACE_X_HEIGHT ), VO_BLT_SRCTRANSPARENCY,NULL ); + BltVideoObject( FRAME_BUFFER , hBackGroundHandle, 3, sXPosition - 4, sYPosition + ( ( iCounterA ) * TACT_UPDATE_MERC_FACE_X_HEIGHT ) , VO_BLT_SRCTRANSPARENCY,NULL ); + BltVideoObject( FRAME_BUFFER , hBackGroundHandle, 5, sXPosition + iTotalPixelsWide , sYPosition + ( ( iCounterA ) * TACT_UPDATE_MERC_FACE_X_HEIGHT ), VO_BLT_SRCTRANSPARENCY,NULL ); } // bordering doctor title @@ -894,7 +894,7 @@ void DisplayAutoBandageUpdatePanel( void ) // the bottom BltVideoObject( FRAME_BUFFER , hBackGroundHandle, 17, sXPosition - 4, sYPosition + iTotalPixelsHigh, VO_BLT_SRCTRANSPARENCY,NULL ); - BltVideoObject( FRAME_BUFFER , hBackGroundHandle, 18, sXPosition + iTotalPixelsWide - TACT_UPDATE_MERC_FACE_X_WIDTH, sYPosition + iTotalPixelsHigh, VO_BLT_SRCTRANSPARENCY,NULL ); + BltVideoObject( FRAME_BUFFER , hBackGroundHandle, 18, sXPosition + iTotalPixelsWide - TACT_UPDATE_MERC_FACE_X_WIDTH, sYPosition + iTotalPixelsHigh, VO_BLT_SRCTRANSPARENCY,NULL ); if( iNumberPatientsWide == 2 ) { @@ -909,23 +909,23 @@ void DisplayAutoBandageUpdatePanel( void ) SetFont( TINYFONT1 ); SetFontForeground( FONT_WHITE ); - SetFontBackground( FONT_BLACK ); + SetFontBackground( FONT_BLACK ); swprintf( sString, L"%s", zMarksMapScreenText[ 14 ]); - FindFontCenterCoordinates( ( INT16 )( sXPosition ), ( INT16 )( sCurrentYPosition ), ( INT16 )( iTotalPixelsWide ), 0, sString, TINYFONT1, &sX, &sY ); + FindFontCenterCoordinates( ( INT16 )( sXPosition ), ( INT16 )( sCurrentYPosition ), ( INT16 )( iTotalPixelsWide ), 0, sString, TINYFONT1, &sX, &sY ); // print patient mprintf( sX, iCurPixelY + ( TACT_UPDATE_MERC_FACE_X_HEIGHT ) + 2, sString ); - + MarkAButtonDirty( iEndAutoBandageButton[ 0 ] ); MarkAButtonDirty( iEndAutoBandageButton[ 1 ] ); - + DrawButton( iEndAutoBandageButton[ 0 ] ); DrawButton( iEndAutoBandageButton[ 1 ] ); - + iTotalPixelsHigh+= 35; // if autobandage is complete, set the fact by enabling the done button @@ -941,7 +941,7 @@ void DisplayAutoBandageUpdatePanel( void ) } // now make sure it goes to the screen - InvalidateRegion( sXPosition - 4, sYPosition - 18, ( INT16 )( sXPosition + iTotalPixelsWide + 4), ( INT16 )( sYPosition + iTotalPixelsHigh ) ); + InvalidateRegion( sXPosition - 4, sYPosition - 18, ( INT16 )( sXPosition + iTotalPixelsWide + 4), ( INT16 )( sYPosition + iTotalPixelsHigh ) ); return; } @@ -963,9 +963,9 @@ void CreateTerminateAutoBandageButton( INT16 sX, INT16 sY ) // grab the image iEndAutoBandageButtonImage[ 0 ] = LoadButtonImage( "INTERFACE\\group_confirm_tactical.sti" ,-1,7,-1,8,-1 ); - - // grab the button - iEndAutoBandageButton[ 0 ] = QuickCreateButton( iEndAutoBandageButtonImage[ 0 ], sX, sY, + + // grab the button + iEndAutoBandageButton[ 0 ] = QuickCreateButton( iEndAutoBandageButtonImage[ 0 ], sX, sY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)StopAutoBandageButtonCallback ); @@ -973,9 +973,9 @@ void CreateTerminateAutoBandageButton( INT16 sX, INT16 sY ) //the cancel button // grab the image iEndAutoBandageButtonImage[ 1 ] = LoadButtonImage( "INTERFACE\\group_confirm_tactical.sti" ,-1,7,-1,8,-1 ); - - // grab the button - iEndAutoBandageButton[ 1 ] = QuickCreateButton( iEndAutoBandageButtonImage[ 1 ], ( INT16 )( sX + 70 ) , sY, + + // grab the button + iEndAutoBandageButton[ 1 ] = QuickCreateButton( iEndAutoBandageButtonImage[ 1 ], ( INT16 )( sX + 70 ) , sY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)StopAutoBandageButtonCallback ); @@ -997,14 +997,14 @@ void StopAutoBandageButtonCallback(GUI_BUTTON *btn,INT32 reason) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - fEndAutoBandage = TRUE; + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fEndAutoBandage = TRUE; } } @@ -1022,7 +1022,7 @@ void DestroyTerminateAutoBandageButton( void ) // not around, don't destroy what ain't there return; } - + fAutoEndBandageButtonCreated = FALSE; // remove button @@ -1043,7 +1043,7 @@ BOOLEAN AddFacesToAutoBandageBox( void ) { INT32 iCounter = 0; INT32 iNumberOfDoctors = 0; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; // reset @@ -1070,7 +1070,7 @@ BOOLEAN AddFacesToAutoBandageBox( void ) // load the face AddVideoObject( &VObjectDesc, (UINT32 *)&giAutoBandagesSoldierFaces[ iCounter ] ); iNumberOfDoctors++; - + } } @@ -1152,13 +1152,13 @@ BOOLEAN RenderSoldierSmallFaceForAutoBandagePanel( INT32 iIndex, INT16 sCurrentX // fill the background for the info bars black ColorFillVideoSurfaceArea( FRAME_BUFFER, sCurrentXPosition+36, sCurrentYPosition+2, sCurrentXPosition+44, sCurrentYPosition+30, 0 ); - + // put down the background BltVideoObjectFromIndex( FRAME_BUFFER, giMercPanelImage, 0, sCurrentXPosition, sCurrentYPosition, VO_BLT_SRCTRANSPARENCY, NULL ); - + // grab the face BltVideoObject( FRAME_BUFFER , hHandle , 0, sCurrentXPosition+2, sCurrentYPosition+2, VO_BLT_SRCTRANSPARENCY, NULL ); - + for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ ) { @@ -1182,32 +1182,32 @@ BOOLEAN RenderSoldierSmallFaceForAutoBandagePanel( INT32 iIndex, INT16 sCurrentX } // is the merc alive? - if( !pSoldier->bLife ) + if( !pSoldier->stats.bLife ) return( FALSE ); //yellow one for bleeding - iStartY = sCurrentYPosition + 29 - 27*pSoldier->bLifeMax/100; + iStartY = sCurrentYPosition + 29 - 27*pSoldier->stats.bLifeMax/100; ColorFillVideoSurfaceArea( FRAME_BUFFER, sCurrentXPosition+36, iStartY, sCurrentXPosition+37, sCurrentYPosition+29, Get16BPPColor( FROMRGB( 107, 107, 57 ) ) ); ColorFillVideoSurfaceArea( FRAME_BUFFER, sCurrentXPosition+37, iStartY, sCurrentXPosition+38, sCurrentYPosition+29, Get16BPPColor( FROMRGB( 222, 181, 115 ) ) ); - + //pink one for bandaged. iStartY += 27*pSoldier->bBleeding/100; ColorFillVideoSurfaceArea( FRAME_BUFFER, sCurrentXPosition+36, iStartY, sCurrentXPosition+37, sCurrentYPosition+29, Get16BPPColor( FROMRGB( 156, 57, 57 ) ) ); ColorFillVideoSurfaceArea( FRAME_BUFFER, sCurrentXPosition+37, iStartY, sCurrentXPosition+38, sCurrentYPosition+29, Get16BPPColor( FROMRGB( 222, 132, 132 ) ) ); - + //red one for actual health - iStartY = sCurrentYPosition + 29 - 27*pSoldier->bLife/100; + iStartY = sCurrentYPosition + 29 - 27*pSoldier->stats.bLife/100; ColorFillVideoSurfaceArea( FRAME_BUFFER, sCurrentXPosition+36, iStartY, sCurrentXPosition+37, sCurrentYPosition+29, Get16BPPColor( FROMRGB( 107, 8, 8 ) ) ); ColorFillVideoSurfaceArea( FRAME_BUFFER, sCurrentXPosition+37, iStartY, sCurrentXPosition+38, sCurrentYPosition+29, Get16BPPColor( FROMRGB( 206, 0, 0 ) ) ); - + //BREATH BAR iStartY = sCurrentYPosition + 29 - 27*pSoldier->bBreathMax/100; ColorFillVideoSurfaceArea( FRAME_BUFFER, sCurrentXPosition+39, iStartY, sCurrentXPosition+40, sCurrentYPosition+29, Get16BPPColor( FROMRGB( 8, 8, 132 ) ) ); ColorFillVideoSurfaceArea( FRAME_BUFFER, sCurrentXPosition+40, iStartY, sCurrentXPosition+41, sCurrentYPosition+29, Get16BPPColor( FROMRGB( 8, 8, 107 ) ) ); - + //MORALE BAR - iStartY = sCurrentYPosition + 29 - 27*pSoldier->bMorale/100; + iStartY = sCurrentYPosition + 29 - 27*pSoldier->aiData.bMorale/100; ColorFillVideoSurfaceArea( FRAME_BUFFER, sCurrentXPosition+42, iStartY, sCurrentXPosition+43, sCurrentYPosition+29, Get16BPPColor( FROMRGB( 8, 156, 8 ) ) ); ColorFillVideoSurfaceArea( FRAME_BUFFER, sCurrentXPosition+43, iStartY, sCurrentXPosition+44, sCurrentYPosition+29, Get16BPPColor( FROMRGB( 8, 107, 8 ) ) ); diff --git a/Tactical/Boxing.cpp b/Tactical/Boxing.cpp index fae6f58e..c62eeced 100644 --- a/Tactical/Boxing.cpp +++ b/Tactical/Boxing.cpp @@ -56,18 +56,18 @@ void ExitBoxing( void ) if ( pSoldier != NULL ) { - if ( ( pSoldier->uiStatusFlags & SOLDIER_BOXER ) && InARoom( pSoldier->sGridNo, &ubRoom ) && ubRoom == BOXING_RING ) + if ( ( pSoldier->flags.uiStatusFlags & SOLDIER_BOXER ) && InARoom( pSoldier->sGridNo, &ubRoom ) && ubRoom == BOXING_RING ) { - if ( pSoldier->uiStatusFlags & SOLDIER_PC ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_PC ) { if ( ubPass == 0 ) // pass 0, only handle AI { continue; } // put guy under AI control temporarily - pSoldier->uiStatusFlags |= SOLDIER_PCUNDERAICONTROL; + pSoldier->flags.uiStatusFlags |= SOLDIER_PCUNDERAICONTROL; //SB: this flag don't allow merc leave the ring - pSoldier->uiStatusFlags &= ~SOLDIER_ENGAGEDINACTION; + pSoldier->flags.uiStatusFlags &= ~SOLDIER_ENGAGEDINACTION; } else { @@ -80,19 +80,19 @@ void ExitBoxing( void ) RecalculateOppCntsDueToBecomingNeutral( pSoldier ); } CancelAIAction( pSoldier, TRUE ); - pSoldier->bAlertStatus = STATUS_GREEN; - pSoldier->bUnderFire = 0; + pSoldier->aiData.bAlertStatus = STATUS_GREEN; + pSoldier->aiData.bUnderFire = 0; // if necessary, revive boxer so he can leave ring - if (pSoldier->bLife > 0 && (pSoldier->bLife < OKLIFE || pSoldier->bBreath < OKBREATH ) ) + if (pSoldier->stats.bLife > 0 && (pSoldier->stats.bLife < OKLIFE || pSoldier->bBreath < OKBREATH ) ) { - pSoldier->bLife = __max( OKLIFE * 2, pSoldier->bLife ); + pSoldier->stats.bLife = __max( OKLIFE * 2, pSoldier->stats.bLife ); if (pSoldier->bBreath < 100) { // deduct -ve BPs to grant some BPs back (properly) DeductPoints( pSoldier, 0, (INT16) - ( (100 - pSoldier->bBreath) * 100 ) ); } - BeginSoldierGetup( pSoldier ); + pSoldier->BeginSoldierGetup( ); } } } @@ -135,7 +135,7 @@ void BoxingPlayerDisqualified( SOLDIERTYPE * pOffender, INT8 bReason ) { if (bReason == BOXER_OUT_OF_RING || bReason == NON_BOXER_IN_RING) { - EVENT_StopMerc( pOffender, pOffender->sGridNo, pOffender->ubDirection ); + pOffender->EVENT_StopMerc( pOffender->sGridNo, pOffender->ubDirection ); } SetBoxingState( DISQUALIFIED ); TriggerNPCRecord( DARREN, 21 ); @@ -216,11 +216,11 @@ void CountPeopleInBoxingRingAndDoActions( void ) } ubTotalInRing++; - if ( pSoldier->uiStatusFlags & SOLDIER_PC ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_PC ) { ubPlayersInRing++; - if ( !pNonBoxingPlayer && !(pSoldier->uiStatusFlags & SOLDIER_BOXER) ) + if ( !pNonBoxingPlayer && !(pSoldier->flags.uiStatusFlags & SOLDIER_BOXER) ) { pNonBoxingPlayer = pSoldier; } @@ -267,10 +267,10 @@ void CountPeopleInBoxingRingAndDoActions( void ) // ladieees and gennleman, we have a fight! for ( uiLoop = 0; uiLoop < 2; uiLoop++ ) { - if ( ! ( pInRing[ uiLoop ]->uiStatusFlags & SOLDIER_BOXER ) ) + if ( ! ( pInRing[ uiLoop ]->flags.uiStatusFlags & SOLDIER_BOXER ) ) { // set as boxer! - pInRing[ uiLoop ]->uiStatusFlags |= SOLDIER_BOXER; + pInRing[ uiLoop ]->flags.uiStatusFlags |= SOLDIER_BOXER; } } // start match! @@ -317,7 +317,7 @@ BOOLEAN CheckOnBoxers( void ) { if ( FindObjClass( MercPtrs[ ubID ], IC_WEAPON ) == NO_SLOT && IS_MERC_BODY_TYPE( MercPtrs[ ubID ] ) ) - { + { // no weapon and not a civilian so this guy is a boxer gubBoxerID[ uiLoop ] = ubID; } @@ -359,29 +359,29 @@ BOOLEAN PickABoxer( void ) if ( gfBoxerFought[ uiLoop ] ) { // pathetic attempt to prevent multiple AI boxers - MercPtrs[ gubBoxerID[ uiLoop ] ]->uiStatusFlags &= ~SOLDIER_BOXER; + MercPtrs[ gubBoxerID[ uiLoop ] ]->flags.uiStatusFlags &= ~SOLDIER_BOXER; } - else + else { pBoxer = MercPtrs[ gubBoxerID[ uiLoop ] ]; // pick this boxer! - if ( pBoxer->bActive && pBoxer->bInSector && pBoxer->bLife >= OKLIFE ) + if ( pBoxer->bActive && pBoxer->bInSector && pBoxer->stats.bLife >= OKLIFE ) { - pBoxer->uiStatusFlags |= SOLDIER_BOXER; + pBoxer->flags.uiStatusFlags |= SOLDIER_BOXER; SetSoldierNonNeutral( pBoxer ); RecalculateOppCntsDueToNoLongerNeutral( pBoxer ); CancelAIAction( pBoxer, TRUE ); - RESETTIMECOUNTER( pBoxer->AICounter, 0 ); + RESETTIMECOUNTER( pBoxer->timeCounters.AICounter, 0 ); gfBoxerFought[ uiLoop ] = TRUE; // improve stats based on the # of rests these guys have had - pBoxer->bStrength = __min( 100, pBoxer->bStrength += gubBoxersRests * 5 ); - pBoxer->bDexterity = __min( 100, pBoxer->bDexterity + gubBoxersRests * 5 ); - pBoxer->bAgility = __min( 100, pBoxer->bAgility + gubBoxersRests * 5 ); - pBoxer->bLifeMax = __min( 100, pBoxer->bLifeMax + gubBoxersRests * 5 ); - // give the 3rd boxer martial arts + pBoxer->stats.bStrength = __min( 100, pBoxer->stats.bStrength += gubBoxersRests * 5 ); + pBoxer->stats.bDexterity = __min( 100, pBoxer->stats.bDexterity + gubBoxersRests * 5 ); + pBoxer->stats.bAgility = __min( 100, pBoxer->stats.bAgility + gubBoxersRests * 5 ); + pBoxer->stats.bLifeMax = __min( 100, pBoxer->stats.bLifeMax + gubBoxersRests * 5 ); + // give the 3rd boxer martial arts if ( (uiLoop == NUM_BOXERS - 1) && pBoxer->ubBodyType == REGMALE ) { - pBoxer->ubSkillTrait1 = MARTIALARTS; + pBoxer->stats.ubSkillTrait1 = MARTIALARTS; } return( TRUE ); } @@ -413,9 +413,9 @@ BOOLEAN BoxerAvailable( void ) return( FALSE ); } -// NOTE THIS IS NOW BROKEN BECAUSE NPC.C ASSUMES THAT BOXERSAVAILABLE < 3 IS A +// NOTE THIS IS NOW BROKEN BECAUSE NPC.C ASSUMES THAT BOXERSAVAILABLE < 3 IS A // SEQUEL FIGHT. Maybe we could check Kingpin's location instead! -UINT8 BoxersAvailable( void ) +UINT8 BoxersAvailable( void ) { UINT8 ubLoop; UINT8 ubCount = 0; @@ -440,7 +440,7 @@ BOOLEAN AnotherFightPossible( void ) UINT8 ubLoop; SOLDIERTYPE * pSoldier; UINT8 ubAvailable; - + ubAvailable = BoxersAvailable(); if ( ubAvailable == NUM_BOXERS || ubAvailable == 0 ) @@ -453,7 +453,7 @@ BOOLEAN AnotherFightPossible( void ) pSoldier = MercPtrs[ ubLoop ]; for ( ; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++,pSoldier++ ) { - if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife > (OKLIFE + 5) && !pSoldier->bCollapsed ) + if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > (OKLIFE + 5) && !pSoldier->bCollapsed ) { return( TRUE ); } @@ -472,19 +472,19 @@ void BoxingMovementCheck( SOLDIERTYPE * pSoldier ) // someone moving in/into the ring CountPeopleInBoxingRingAndDoActions(); } - else if ( ( gTacticalStatus.bBoxingState == BOXING ) && ( pSoldier->uiStatusFlags & SOLDIER_BOXER ) ) + else if ( ( gTacticalStatus.bBoxingState == BOXING ) && ( pSoldier->flags.uiStatusFlags & SOLDIER_BOXER ) ) { // boxer stepped out of the ring! BoxingPlayerDisqualified( pSoldier, BOXER_OUT_OF_RING ); // add the history record here. AddHistoryToPlayersLog( HISTORY_DISQUALIFIED_BOXING, pSoldier->ubProfile, GetWorldTotalMin(), gWorldSectorX, gWorldSectorY ); // make not a boxer any more - pSoldier->uiStatusFlags &= ~(SOLDIER_BOXER); - pSoldier->uiStatusFlags &= (~SOLDIER_PCUNDERAICONTROL); + pSoldier->flags.uiStatusFlags &= ~(SOLDIER_BOXER); + pSoldier->flags.uiStatusFlags &= (~SOLDIER_PCUNDERAICONTROL); } } -void SetBoxingState( INT8 bNewState ) +void SetBoxingState( INT8 bNewState ) { if ( gTacticalStatus.bBoxingState == NOT_BOXING ) { @@ -501,7 +501,7 @@ void SetBoxingState( INT8 bNewState ) { // unpause time UnPauseGame(); - + if ( BoxersAvailable() == NUM_BOXERS ) { // set one boxer to be set as boxed so that the game will allow another @@ -523,9 +523,9 @@ void ClearAllBoxerFlags( void ) for( uiSlot = 0; uiSlot < guiNumMercSlots; uiSlot++ ) { - if ( MercSlots[ uiSlot ] && MercSlots[ uiSlot ]->uiStatusFlags & SOLDIER_BOXER ) + if ( MercSlots[ uiSlot ] && MercSlots[ uiSlot ]->flags.uiStatusFlags & SOLDIER_BOXER ) { - MercSlots[ uiSlot ]->uiStatusFlags &= ~(SOLDIER_BOXER); + MercSlots[ uiSlot ]->flags.uiStatusFlags &= ~(SOLDIER_BOXER); } } -} \ No newline at end of file +} diff --git a/Tactical/Bullets.h b/Tactical/Bullets.h index 55185539..d8a7bbdc 100644 --- a/Tactical/Bullets.h +++ b/Tactical/Bullets.h @@ -7,15 +7,15 @@ #include "tile animation.h" -#define BULLET_FLAG_CREATURE_SPIT 0x0001 -#define BULLET_FLAG_KNIFE 0x0002 -#define BULLET_FLAG_MISSILE 0x0004 -#define BULLET_FLAG_SMALL_MISSILE 0x0008 -#define BULLET_STOPPED 0x0010 -#define BULLET_FLAG_TANK_CANNON 0x0020 -#define BULLET_FLAG_BUCKSHOT 0x0040 -#define BULLET_FLAG_FLAME 0x0080 -#define BULLET_FLAG_TRACER 0x0100 +#define BULLET_FLAG_CREATURE_SPIT 0x0001 +#define BULLET_FLAG_KNIFE 0x0002 +#define BULLET_FLAG_MISSILE 0x0004 +#define BULLET_FLAG_SMALL_MISSILE 0x0008 +#define BULLET_STOPPED 0x0010 +#define BULLET_FLAG_TANK_CANNON 0x0020 +#define BULLET_FLAG_BUCKSHOT 0x0040 +#define BULLET_FLAG_FLAME 0x0080 +#define BULLET_FLAG_TRACER 0x0100 typedef struct { @@ -59,17 +59,17 @@ typedef struct UINT16 usFlags; ANITILE *pAniTile; ANITILE *pShadowAniTile; - UINT8 ubItemStatus; + UINT16 ubItemStatus; UINT16 fromItem; INT32 flash; } BULLET; extern UINT32 guiNumBullets; -INT32 CreateBullet( UINT8 ubFirer, BOOLEAN fFake, UINT16 usFlags,UINT16 fromItem ); -void RemoveBullet( INT32 iBullet ); -void StopBullet( INT32 iBullet ); -void UpdateBullets( ); +INT32 CreateBullet( UINT8 ubFirer, BOOLEAN fFake, UINT16 usFlags,UINT16 fromItem ); +void RemoveBullet( INT32 iBullet ); +void StopBullet( INT32 iBullet ); +void UpdateBullets( ); BULLET *GetBulletPtr( INT32 iBullet ); void DeleteAllBullets( ); diff --git a/Tactical/Campaign.cpp b/Tactical/Campaign.cpp index 7f1103f8..e489742e 100644 --- a/Tactical/Campaign.cpp +++ b/Tactical/Campaign.cpp @@ -10,7 +10,7 @@ #include "debug.h" #include "MemMan.h" #include "Overhead Types.h" - #include "Soldier Control.h" + #include "random.h" #include "campaign.h" #include "dialogue control.h" @@ -40,6 +40,11 @@ #include "email.h" +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + extern UINT8 gbPlayerNum; @@ -77,7 +82,7 @@ void StatChange(SOLDIERTYPE *pSoldier, UINT8 ubStat, UINT16 usNumChances, UINT8 { if (pSoldier == NULL || pSoldier->bActive == FALSE) return; // THIS SHOULD NEVER HAPPEN - + Assert(pSoldier != NULL); Assert(pSoldier->bActive); @@ -90,7 +95,7 @@ void StatChange(SOLDIERTYPE *pSoldier, UINT8 ubStat, UINT16 usNumChances, UINT8 return; // ignore vehicles and robots - if( ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) || ( pSoldier->uiStatusFlags & SOLDIER_ROBOT ) ) + if( ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) || ( pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) ) return; if( pSoldier->bAssignment == ASSIGNMENT_POW ) @@ -100,7 +105,7 @@ void StatChange(SOLDIERTYPE *pSoldier, UINT8 ubStat, UINT16 usNumChances, UINT8 } // no points earned while somebody is unconscious (for assist XPs, and such) - if ( pSoldier->bLife < CONSCIOUSNESS ) + if ( pSoldier->stats.bLife < CONSCIOUSNESS ) return; @@ -390,7 +395,7 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh // all other stat changes count towards experience level changes (1 for 1 basis) pProfile->sExpLevelGain--; } - } + } } } } @@ -431,7 +436,7 @@ void ProfileUpdateStats( MERCPROFILESTRUCT *pProfile ) void ChangeStat( MERCPROFILESTRUCT *pProfile, SOLDIERTYPE *pSoldier, UINT8 ubStat, INT16 sPtsChanged ) { // this function changes the stat a given amount... - INT16 *psStatGainPtr = NULL; + INT16 *psStatGainPtr = NULL; INT8 *pbStatPtr = NULL; INT8 *pbSoldierStatPtr = NULL; INT8 *pbStatDeltaPtr = NULL; @@ -523,68 +528,68 @@ void ChangeStat( MERCPROFILESTRUCT *pProfile, SOLDIERTYPE *pSoldier, UINT8 ubSta switch( ubStat ) { case HEALTHAMT: - pbSoldierStatPtr = &( pSoldier->bLifeMax ); - puiStatTimerPtr = &( pSoldier->uiChangeHealthTime); + pbSoldierStatPtr = &( pSoldier->stats.bLifeMax ); + puiStatTimerPtr = &( pSoldier->timeChanges.uiChangeHealthTime); usIncreaseValue = HEALTH_INCREASE; break; case AGILAMT: - pbSoldierStatPtr = &( pSoldier->bAgility ); - puiStatTimerPtr = &( pSoldier->uiChangeAgilityTime); + pbSoldierStatPtr = &( pSoldier->stats.bAgility ); + puiStatTimerPtr = &( pSoldier->timeChanges.uiChangeAgilityTime); usIncreaseValue = AGIL_INCREASE; break; case DEXTAMT: - pbSoldierStatPtr = &( pSoldier->bDexterity ); - puiStatTimerPtr = &( pSoldier->uiChangeDexterityTime); + pbSoldierStatPtr = &( pSoldier->stats.bDexterity ); + puiStatTimerPtr = &( pSoldier->timeChanges.uiChangeDexterityTime); usIncreaseValue = DEX_INCREASE; break; case WISDOMAMT: - pbSoldierStatPtr = &( pSoldier->bWisdom ); - puiStatTimerPtr = &( pSoldier->uiChangeWisdomTime); + pbSoldierStatPtr = &( pSoldier->stats.bWisdom ); + puiStatTimerPtr = &( pSoldier->timeChanges.uiChangeWisdomTime); usIncreaseValue = WIS_INCREASE; break; case MEDICALAMT: - pbSoldierStatPtr = &( pSoldier->bMedical ); - puiStatTimerPtr = &( pSoldier->uiChangeMedicalTime); + pbSoldierStatPtr = &( pSoldier->stats.bMedical ); + puiStatTimerPtr = &( pSoldier->timeChanges.uiChangeMedicalTime); usIncreaseValue = MED_INCREASE; break; case EXPLODEAMT: - pbSoldierStatPtr = &( pSoldier->bExplosive ); - puiStatTimerPtr = &( pSoldier->uiChangeExplosivesTime); + pbSoldierStatPtr = &( pSoldier->stats.bExplosive ); + puiStatTimerPtr = &( pSoldier->timeChanges.uiChangeExplosivesTime); usIncreaseValue = EXP_INCREASE; break; case MECHANAMT: - pbSoldierStatPtr = &( pSoldier->bMechanical ); - puiStatTimerPtr = &( pSoldier->uiChangeMechanicalTime); + pbSoldierStatPtr = &( pSoldier->stats.bMechanical ); + puiStatTimerPtr = &( pSoldier->timeChanges.uiChangeMechanicalTime); usIncreaseValue = MECH_INCREASE; break; case MARKAMT: - pbSoldierStatPtr = &( pSoldier->bMarksmanship ); - puiStatTimerPtr = &( pSoldier->uiChangeMarksmanshipTime); + pbSoldierStatPtr = &( pSoldier->stats.bMarksmanship ); + puiStatTimerPtr = &( pSoldier->timeChanges.uiChangeMarksmanshipTime); usIncreaseValue = MRK_INCREASE; break; case EXPERAMT: - pbSoldierStatPtr = &(pSoldier->bExpLevel); - puiStatTimerPtr = &( pSoldier->uiChangeLevelTime ); + pbSoldierStatPtr = &(pSoldier->stats.bExpLevel); + puiStatTimerPtr = &( pSoldier->timeChanges.uiChangeLevelTime ); usIncreaseValue = LVL_INCREASE; break; case STRAMT: - pbSoldierStatPtr = &(pSoldier->bStrength); - puiStatTimerPtr = &( pSoldier->uiChangeStrengthTime); + pbSoldierStatPtr = &(pSoldier->stats.bStrength); + puiStatTimerPtr = &( pSoldier->timeChanges.uiChangeStrengthTime); usIncreaseValue = STRENGTH_INCREASE; break; case LDRAMT: - pbSoldierStatPtr = &( pSoldier->bLeadership); - puiStatTimerPtr = &( pSoldier->uiChangeLeadershipTime); + pbSoldierStatPtr = &( pSoldier->stats.bLeadership); + puiStatTimerPtr = &( pSoldier->timeChanges.uiChangeLeadershipTime); usIncreaseValue = LDR_INCREASE; break; } @@ -679,12 +684,12 @@ void ChangeStat( MERCPROFILESTRUCT *pProfile, SOLDIERTYPE *pSoldier, UINT8 ubSta if (pSoldier != NULL) { // adjust current health by the same amount as max health - pSoldier->bLife += sPtsChanged; + pSoldier->stats.bLife += sPtsChanged; // don't let this kill a guy or knock him out!!! - if (pSoldier->bLife < OKLIFE) + if (pSoldier->stats.bLife < OKLIFE) { - pSoldier->bLife = OKLIFE; + pSoldier->stats.bLife = OKLIFE; } } } @@ -700,7 +705,7 @@ void ChangeStat( MERCPROFILESTRUCT *pProfile, SOLDIERTYPE *pSoldier, UINT8 ubSta { case MERC_TYPE__AIM_MERC: // A.I.M. - pSoldier->fContractPriceHasIncreased = TRUE; + pSoldier->flags.fContractPriceHasIncreased = TRUE; fChangeSalary = TRUE; break; @@ -722,7 +727,7 @@ void ChangeStat( MERCPROFILESTRUCT *pProfile, SOLDIERTYPE *pSoldier, UINT8 ubSta // // DEF: 03/06/99 Now sets an event that will be processed later in the day -// ubEmailOffset = MERC_UP_LEVEL_BIFF + MERC_UP_LEVEL_LENGTH_BIFF * ( ubMercMercIdValue ); +// ubEmailOffset = MERC_UP_LEVEL_BIFF + MERC_UP_LEVEL_LENGTH_BIFF * ( ubMercMercIdValue ); // AddEmail( ubEmailOffset, MERC_UP_LEVEL_LENGTH_BIFF, SPECK_FROM_MERC, GetWorldTotalMin() ); AddStrategicEvent( EVENT_MERC_MERC_WENT_UP_LEVEL_EMAIL_DELAY, GetWorldTotalMin( ) + 60 + Random( 60 ), ubMercMercIdValue ); @@ -770,10 +775,9 @@ void ProcessUpdateStats( MERCPROFILESTRUCT *pProfile, SOLDIERTYPE *pSoldier ) { // this function will run through the soldier's profile and update their stats based on any accumulated gain pts. UINT8 ubStat = 0; - INT16 *psStatGainPtr = NULL; + INT16 *psStatGainPtr = NULL; INT8 *pbStatPtr = NULL; INT8 *pbSoldierStatPtr = NULL; - INT8 *pbStatDeltaPtr = NULL; INT8 bMinStatValue; INT8 bMaxStatValue; UINT16 usSubpointsPerPoint; @@ -796,11 +800,11 @@ void ProcessUpdateStats( MERCPROFILESTRUCT *pProfile, SOLDIERTYPE *pSoldier ) return; // ignore vehicles and robots - if( ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) || ( pSoldier->uiStatusFlags & SOLDIER_ROBOT ) ) + if( ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) || ( pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) ) return; // delay increases while merc is dying - if (pSoldier->bLife < OKLIFE) + if (pSoldier->stats.bLife < OKLIFE) return; // ignore POWs - shouldn't ever be getting this far @@ -909,47 +913,47 @@ void ProcessUpdateStats( MERCPROFILESTRUCT *pProfile, SOLDIERTYPE *pSoldier ) switch( ubStat ) { case HEALTHAMT: - pbSoldierStatPtr = &( pSoldier->bLifeMax ); + pbSoldierStatPtr = &( pSoldier->stats.bLifeMax ); break; case AGILAMT: - pbSoldierStatPtr = &( pSoldier->bAgility ); + pbSoldierStatPtr = &( pSoldier->stats.bAgility ); break; case DEXTAMT: - pbSoldierStatPtr = &( pSoldier->bDexterity ); + pbSoldierStatPtr = &( pSoldier->stats.bDexterity ); break; case WISDOMAMT: - pbSoldierStatPtr = &( pSoldier->bWisdom ); + pbSoldierStatPtr = &( pSoldier->stats.bWisdom ); break; case MEDICALAMT: - pbSoldierStatPtr = &( pSoldier->bMedical ); + pbSoldierStatPtr = &( pSoldier->stats.bMedical ); break; case EXPLODEAMT: - pbSoldierStatPtr = &( pSoldier->bExplosive ); + pbSoldierStatPtr = &( pSoldier->stats.bExplosive ); break; case MECHANAMT: - pbSoldierStatPtr = &( pSoldier->bMechanical ); + pbSoldierStatPtr = &( pSoldier->stats.bMechanical ); break; case MARKAMT: - pbSoldierStatPtr = &( pSoldier->bMarksmanship ); + pbSoldierStatPtr = &( pSoldier->stats.bMarksmanship ); break; case EXPERAMT: - pbSoldierStatPtr = &(pSoldier->bExpLevel); + pbSoldierStatPtr = &(pSoldier->stats.bExpLevel); break; case STRAMT: - pbSoldierStatPtr = &(pSoldier->bStrength); + pbSoldierStatPtr = &(pSoldier->stats.bStrength); break; case LDRAMT: - pbSoldierStatPtr = &( pSoldier->bLeadership); + pbSoldierStatPtr = &( pSoldier->stats.bLeadership); break; } } @@ -997,7 +1001,7 @@ void HandleAnyStatChangesAfterAttack( void ) // must check everyone on player's team, not just the shooter for ( cnt = 0, pSoldier = MercPtrs[ 0 ]; cnt <= gTacticalStatus.Team[ MercPtrs[ 0 ]->bTeam ].bLastID; cnt++,pSoldier++) { - if (pSoldier -> bActive) + if (pSoldier->bActive) { ProcessUpdateStats( &( gMercProfiles[ pSoldier->ubProfile ] ), pSoldier ); } @@ -1519,9 +1523,9 @@ void AwardExperienceBonusToActiveSquad( UINT8 ubExpBonusType ) for ( ubGuynum = gTacticalStatus.Team[ gbPlayerNum ].bFirstID, pSoldier = MercPtrs[ ubGuynum ]; ubGuynum <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubGuynum++, pSoldier++ ) - { - if ( pSoldier->bActive && pSoldier->bInSector && IsMercOnCurrentSquad( pSoldier ) && ( pSoldier->bLife >= CONSCIOUSNESS ) && - !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) ) + { + if ( pSoldier->bActive && pSoldier->bInSector && IsMercOnCurrentSquad( pSoldier ) && ( pSoldier->stats.bLife >= CONSCIOUSNESS ) && + !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) ) { StatChange( pSoldier, EXPERAMT, usXPs, FALSE ); } @@ -1557,7 +1561,7 @@ void BuildStatChangeString( STR16 wString, STR16 wName, BOOLEAN fIncrease, INT16 ubStringIndex += 2; } - swprintf( wString, L"%s %s %d %s %s", wName, sPreStatBuildString[ fIncrease ? 1 : 0 ], abs( sPtsChanged ), + swprintf( wString, L"%s %s %d %s %s", wName, sPreStatBuildString[ fIncrease ? 1 : 0 ], abs( sPtsChanged ), sPreStatBuildString[ ubStringIndex ], sStatGainStrings[ ubStat - FIRST_CHANGEABLE_STAT ] ); } @@ -1656,4 +1660,4 @@ void MERCMercWentUpALevelSendEmail( UINT8 ubMercMercIdValue ) } AddEmail( ubEmailOffset, iMsgLength, SPECK_FROM_MERC, GetWorldTotalMin(), -1); -} \ No newline at end of file +} diff --git a/Tactical/Campaign.h b/Tactical/Campaign.h index 3b163679..9e722f62 100644 --- a/Tactical/Campaign.h +++ b/Tactical/Campaign.h @@ -3,37 +3,37 @@ #include "Soldier Profile.h" -#define SALARYAMT 0 -#define HEALTHAMT 1 -#define AGILAMT 2 -#define DEXTAMT 3 -#define WISDOMAMT 4 -#define MEDICALAMT 5 -#define EXPLODEAMT 6 -#define MECHANAMT 7 -#define MARKAMT 8 -#define EXPERAMT 9 +#define SALARYAMT 0 +#define HEALTHAMT 1 +#define AGILAMT 2 +#define DEXTAMT 3 +#define WISDOMAMT 4 +#define MEDICALAMT 5 +#define EXPLODEAMT 6 +#define MECHANAMT 7 +#define MARKAMT 8 +#define EXPERAMT 9 #define STRAMT 10 #define LDRAMT 11 -#define ASSIGNAMT 12 -#define NAMEAMT 13 +#define ASSIGNAMT 12 +#define NAMEAMT 13 #define FIRST_CHANGEABLE_STAT HEALTHAMT #define LAST_CHANGEABLE_STAT LDRAMT #define CHANGEABLE_STAT_COUNT ( LDRAMT - HEALTHAMT + 1 ) #define MAX_STAT_VALUE 100 // for stats and skills -#define MAXEXPLEVEL 10 // maximum merc experience level +#define MAXEXPLEVEL 10 // maximum merc experience level #define SKILLS_SUBPOINTS_TO_IMPROVE 25 #define ATTRIBS_SUBPOINTS_TO_IMPROVE 50 -#define LEVEL_SUBPOINTS_TO_IMPROVE 350 // per current level! (Can't go over 6500, 10x must fit in USHORT!) +#define LEVEL_SUBPOINTS_TO_IMPROVE 350 // per current level! (Can't go over 6500, 10x must fit in USHORT!) -#define WORKIMPROVERATE 2 // increase to make working mercs improve more -#define TRAINIMPROVERATE 2 // increase to make training mercs improve more +#define WORKIMPROVERATE 2 // increase to make working mercs improve more +#define TRAINIMPROVERATE 2 // increase to make training mercs improve more #define SALARY_CHANGE_PER_LEVEL 1.25 // Mercs salary is multiplied by this -#define MAX_DAILY_SALARY 30000 // must fit into an INT16 (32k) +#define MAX_DAILY_SALARY 30000 // must fit into an INT16 (32k) #define MAX_LARGE_SALARY 500000 // no limit, really // training cap: you can't train any stat/skill beyond this value diff --git a/Tactical/Civ Quotes.cpp b/Tactical/Civ Quotes.cpp index 82ba597d..fe05e915 100644 --- a/Tactical/Civ Quotes.cpp +++ b/Tactical/Civ Quotes.cpp @@ -151,15 +151,15 @@ BOOLEAN GetCivQuoteText( UINT8 ubCivQuoteID, UINT8 ubEntryID, STR16 zQuote ) // Build filename.... if ( ubCivQuoteID == CIV_QUOTE_HINT ) { - if ( gbWorldSectorZ > 0 ) - { - //sprintf( zFileName, "NPCData\\miners.edt" ); - sprintf( zFileName,"NPCDATA\\CIV%02d.edt", CIV_QUOTE_MINERS_NOT_FOR_PLAYER ); - } - else - { - sprintf( zFileName, "NPCData\\%c%d.edt", 'A' + (gWorldSectorY - 1) , gWorldSectorX ); - } + if ( gbWorldSectorZ > 0 ) + { + //sprintf( zFileName, "NPCData\\miners.edt" ); + sprintf( zFileName,"NPCDATA\\CIV%02d.edt", CIV_QUOTE_MINERS_NOT_FOR_PLAYER ); + } + else + { + sprintf( zFileName, "NPCData\\%c%d.edt", 'A' + (gWorldSectorY - 1) , gWorldSectorX ); + } } else { @@ -171,7 +171,7 @@ BOOLEAN GetCivQuoteText( UINT8 ubCivQuoteID, UINT8 ubEntryID, STR16 zQuote ) // Get data... LoadEncryptedDataFromFile( zFileName, zQuote, ubEntryID * 320, 320 ); - if( zQuote[0] == 0 ) + if( zQuote[0] == 0 ) { return( FALSE ); } @@ -189,7 +189,7 @@ void SurrenderMessageBoxCallBack( UINT8 ubExitValue ) // CJC Dec 1 2002: fix multiple captures BeginCaptureSquence(); - // Do capture.... + // Do capture.... cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++) @@ -197,14 +197,14 @@ void SurrenderMessageBoxCallBack( UINT8 ubExitValue ) // Are we active and in sector..... if ( pTeamSoldier->bActive && pTeamSoldier->bInSector ) { - if ( pTeamSoldier->bLife != 0 ) + if ( pTeamSoldier->stats.bLife != 0 ) { EnemyCapturesPlayerSoldier( pTeamSoldier ); RemoveSoldierFromTacticalSector( pTeamSoldier, TRUE ); } } - } + } EndCaptureSequence( ); @@ -225,7 +225,7 @@ void ShutDownQuoteBox( BOOLEAN fForce ) { return; } - + // Check for min time.... if ( ( GetJA2Clock( ) - gCivQuoteData.uiTimeOfCreation ) > 300 || fForce ) { @@ -234,13 +234,13 @@ void ShutDownQuoteBox( BOOLEAN fForce ) // Remove mouse region... MSYS_RemoveRegion( &(gCivQuoteData.MouseRegion) ); - RemoveMercPopupBoxFromIndex( gCivQuoteData.iDialogueBox ); - gCivQuoteData.iDialogueBox = -1; + RemoveMercPopupBoxFromIndex( gCivQuoteData.iDialogueBox ); + gCivQuoteData.iDialogueBox = -1; gCivQuoteData.bActive = FALSE; // do we need to do anything at the end of the civ quote? - if ( gCivQuoteData.pCiv && gCivQuoteData.pCiv->bAction == AI_ACTION_OFFER_SURRENDER ) + if ( gCivQuoteData.pCiv && gCivQuoteData.pCiv->aiData.bAction == AI_ACTION_OFFER_SURRENDER ) { DoMessageBox( MSG_BOX_BASIC_STYLE, Message[ STR_SURRENDER ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, SurrenderMessageBoxCallBack, NULL ); } @@ -271,8 +271,8 @@ INT8 GetCivType( SOLDIERTYPE *pCiv ) // 1 ) check sector.... if ( gWorldSectorX == 10 && gWorldSectorY == 6 && gbWorldSectorZ == 0 ) { - // 2 ) the only female.... - if ( pCiv->ubCivilianGroup == 0 && pCiv->bTeam != gbPlayerNum && pCiv->ubBodyType == REGFEMALE ) + // 2 ) the only female.... + if ( pCiv->ubCivilianGroup == 0 && pCiv->bTeam != gbPlayerNum && pCiv->ubBodyType == REGFEMALE ) { // She's a ho! return( CIV_TYPE_MARRIED_PC ); @@ -333,7 +333,7 @@ void RenderCivQuoteBoxOverlay( VIDEO_OVERLAY *pBlitter ) { if ( gCivQuoteData.iVideoOverlay != -1 ) { - RenderMercPopUpBoxFromIndex( gCivQuoteData.iDialogueBox, pBlitter->sX, pBlitter->sY, pBlitter->uiDestBuff ); + RenderMercPopUpBoxFromIndex( gCivQuoteData.iDialogueBox, pBlitter->sX, pBlitter->sY, pBlitter->uiDestBuff ); InvalidateRegion( pBlitter->sX, pBlitter->sY, pBlitter->sX + gusCivQuoteBoxWidth, pBlitter->sY + gusCivQuoteBoxHeight ); } @@ -388,17 +388,17 @@ void BeginCivQuote( SOLDIERTYPE *pCiv, UINT8 ubCivQuoteID, UINT8 ubEntryID, INT1 if ( ubCivQuoteID == CIV_QUOTE_HINT ) { - MapScreenMessage( FONT_MCOLOR_WHITE, MSG_DIALOG, L"%s", gzCivQuote ); + MapScreenMessage( FONT_MCOLOR_WHITE, MSG_DIALOG, L"%s", gzCivQuote ); } // Create video oeverlay.... memset( &VideoOverlayDesc, 0, sizeof( VIDEO_OVERLAY_DESC ) ); - + // Prepare text box - SET_USE_WINFONTS( TRUE ); - SET_WINFONT( giSubTitleWinFont ); + SET_USE_WINFONTS( TRUE ); + SET_WINFONT( giSubTitleWinFont ); gCivQuoteData.iDialogueBox = PrepareMercPopupBox( gCivQuoteData.iDialogueBox , BASIC_MERC_POPUP_BACKGROUND, BASIC_MERC_POPUP_BORDER, gzCivQuote, DIALOGUE_DEFAULT_WIDTH, 0, 0, 0, &gusCivQuoteBoxWidth, &gusCivQuoteBoxHeight ); - SET_USE_WINFONTS( FALSE ); + SET_USE_WINFONTS( FALSE ); // OK, find center for box...... sX = sX - ( gusCivQuoteBoxWidth / 2 ); @@ -430,20 +430,20 @@ void BeginCivQuote( SOLDIERTYPE *pCiv, UINT8 ubCivQuoteID, UINT8 ubEntryID, INT1 } } - VideoOverlayDesc.sLeft = sX; - VideoOverlayDesc.sTop = sY; - VideoOverlayDesc.sRight = VideoOverlayDesc.sLeft + gusCivQuoteBoxWidth; - VideoOverlayDesc.sBottom = VideoOverlayDesc.sTop + gusCivQuoteBoxHeight; - VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; - VideoOverlayDesc.sY = VideoOverlayDesc.sTop; + VideoOverlayDesc.sLeft = sX; + VideoOverlayDesc.sTop = sY; + VideoOverlayDesc.sRight = VideoOverlayDesc.sLeft + gusCivQuoteBoxWidth; + VideoOverlayDesc.sBottom = VideoOverlayDesc.sTop + gusCivQuoteBoxHeight; + VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; + VideoOverlayDesc.sY = VideoOverlayDesc.sTop; VideoOverlayDesc.BltCallback = RenderCivQuoteBoxOverlay; - gCivQuoteData.iVideoOverlay = RegisterVideoOverlay( 0, &VideoOverlayDesc ); + gCivQuoteData.iVideoOverlay = RegisterVideoOverlay( 0, &VideoOverlayDesc ); //Define main region - MSYS_DefineRegion( &(gCivQuoteData.MouseRegion), VideoOverlayDesc.sLeft, VideoOverlayDesc.sTop, VideoOverlayDesc.sRight, VideoOverlayDesc.sBottom, MSYS_PRIORITY_HIGHEST, - CURSOR_NORMAL, MSYS_NO_CALLBACK, QuoteOverlayClickCallback ); + MSYS_DefineRegion( &(gCivQuoteData.MouseRegion), VideoOverlayDesc.sLeft, VideoOverlayDesc.sTop, VideoOverlayDesc.sRight, VideoOverlayDesc.sBottom, MSYS_PRIORITY_HIGHEST, + CURSOR_NORMAL, MSYS_NO_CALLBACK, QuoteOverlayClickCallback ); // Add region MSYS_AddRegion( &(gCivQuoteData.MouseRegion) ); @@ -453,7 +453,7 @@ void BeginCivQuote( SOLDIERTYPE *pCiv, UINT8 ubCivQuoteID, UINT8 ubEntryID, INT1 gCivQuoteData.uiTimeOfCreation = GetJA2Clock( ); gCivQuoteData.uiDelayTime = FindDelayForString( gzCivQuote ) + 500; - + gCivQuoteData.pCiv = pCiv; } @@ -465,8 +465,8 @@ UINT8 DetermineCivQuoteEntry( SOLDIERTYPE *pCiv, UINT8 *pubCivHintToUse, BOOLEAN BOOLEAN bCivLowLoyalty = FALSE; BOOLEAN bCivHighLoyalty = FALSE; INT8 bCivHint; - INT8 bMineId; - BOOLEAN bMiners = FALSE; + INT8 bMineId; + BOOLEAN bMiners = FALSE; (*pubCivHintToUse) = 0; @@ -477,17 +477,17 @@ UINT8 DetermineCivQuoteEntry( SOLDIERTYPE *pCiv, UINT8 *pubCivHintToUse, BOOLEAN // Determine what type of quote to say... // Are are we going to attack? - if ( pCiv->bAction == AI_ACTION_TOSS_PROJECTILE || pCiv->bAction == AI_ACTION_FIRE_GUN || - pCiv->bAction == AI_ACTION_FIRE_GUN || pCiv->bAction == AI_ACTION_KNIFE_MOVE ) + if ( pCiv->aiData.bAction == AI_ACTION_TOSS_PROJECTILE || pCiv->aiData.bAction == AI_ACTION_FIRE_GUN || + pCiv->aiData.bAction == AI_ACTION_FIRE_GUN || pCiv->aiData.bAction == AI_ACTION_KNIFE_MOVE ) { return( CIV_QUOTE_ENEMY_THREAT ); } - else if ( pCiv->bAction == AI_ACTION_OFFER_SURRENDER ) + else if ( pCiv->aiData.bAction == AI_ACTION_OFFER_SURRENDER ) { return( CIV_QUOTE_ENEMY_OFFER_SURRENDER ); } // Hurt? - else if ( pCiv->bLife < 30 ) + else if ( pCiv->stats.bLife < 30 ) { return( CIV_QUOTE_ENEMY_HURT ); } @@ -519,7 +519,7 @@ UINT8 DetermineCivQuoteEntry( SOLDIERTYPE *pCiv, UINT8 *pubCivHintToUse, BOOLEAN { // Are they friendly? //if ( gTacticalStatus.fCivGroupHostile[ HICKS_CIV_GROUP ] < CIV_GROUP_WILL_BECOME_HOSTILE ) - if ( pCiv->bNeutral ) + if ( pCiv->aiData.bNeutral ) { return( CIV_QUOTE_HICKS_FRIENDLY ); } @@ -534,7 +534,7 @@ UINT8 DetermineCivQuoteEntry( SOLDIERTYPE *pCiv, UINT8 *pubCivHintToUse, BOOLEAN { // Are they friendly? //if ( gTacticalStatus.fCivGroupHostile[ KINGPIN_CIV_GROUP ] < CIV_GROUP_WILL_BECOME_HOSTILE ) - if ( pCiv->bNeutral ) + if ( pCiv->aiData.bNeutral ) { return( CIV_QUOTE_GOONS_FRIENDLY ); } @@ -545,7 +545,7 @@ UINT8 DetermineCivQuoteEntry( SOLDIERTYPE *pCiv, UINT8 *pubCivHintToUse, BOOLEAN } // ATE: Cowering people take precedence.... - if ( ( pCiv->uiStatusFlags & SOLDIER_COWERING ) || ( pCiv->bTeam == CIV_TEAM && ( gTacticalStatus.uiFlags & INCOMBAT ) ) ) + if ( ( pCiv->flags.uiStatusFlags & SOLDIER_COWERING ) || ( pCiv->bTeam == CIV_TEAM && ( gTacticalStatus.uiFlags & INCOMBAT ) ) ) { if ( ubCivType == CIV_TYPE_ADULT ) { @@ -626,11 +626,11 @@ UINT8 DetermineCivQuoteEntry( SOLDIERTYPE *pCiv, UINT8 *pubCivHintToUse, BOOLEAN } } - // If we are in medunna, and queen is dead, use these... - if ( bTownId == MEDUNA && CheckFact( FACT_QUEEN_DEAD, 0 ) ) - { - return( CIV_QUOTE_DEIDRANNA_DEAD ); - } + // If we are in medunna, and queen is dead, use these... + if ( bTownId == MEDUNA && CheckFact( FACT_QUEEN_DEAD, 0 ) ) + { + return( CIV_QUOTE_DEIDRANNA_DEAD ); + } // if in a town if( ( bTownId != BLANK_SECTOR ) && ( gbWorldSectorZ == 0 ) && gfTownUsesLoyalty[ bTownId ] ) @@ -651,40 +651,40 @@ UINT8 DetermineCivQuoteEntry( SOLDIERTYPE *pCiv, UINT8 *pubCivHintToUse, BOOLEAN // ATE: OK, check if we should look for a civ hint.... - if ( fCanUseHints ) - { - bCivHint = ConsiderCivilianQuotes( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, FALSE ); - } - else - { - bCivHint = -1; - } + if ( fCanUseHints ) + { + bCivHint = ConsiderCivilianQuotes( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, FALSE ); + } + else + { + bCivHint = -1; + } // ATE: check miners...... if ( pCiv->ubSoldierClass == SOLDIER_CLASS_MINER ) { - bMiners = TRUE; + bMiners = TRUE; - // If not a civ hint available... - if ( bCivHint == -1 ) - { - // Check if they are under our control... + // If not a civ hint available... + if ( bCivHint == -1 ) + { + // Check if they are under our control... - // Should I go talk to miner? - // Not done yet. + // Should I go talk to miner? + // Not done yet. - // Are they working for us? - bMineId = GetIdOfMineForSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); + // Are they working for us? + bMineId = GetIdOfMineForSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); - if ( PlayerControlsMine( bMineId ) ) - { - return( CIV_QUOTE_MINERS_FOR_PLAYER ); - } - else - { - return( CIV_QUOTE_MINERS_NOT_FOR_PLAYER ); - } - } + if ( PlayerControlsMine( bMineId ) ) + { + return( CIV_QUOTE_MINERS_FOR_PLAYER ); + } + else + { + return( CIV_QUOTE_MINERS_NOT_FOR_PLAYER ); + } + } } @@ -778,8 +778,8 @@ void StartCivQuote( SOLDIERTYPE *pCiv ) if ( pCiv->bCurrentCivQuote == CIV_QUOTE_HINT ) { // Determine which quote to say..... - // CAN'T USE HINTS, since we just did one... - pCiv->bCurrentCivQuote = -1; + // CAN'T USE HINTS, since we just did one... + pCiv->bCurrentCivQuote = -1; pCiv->bCurrentCivQuoteDelta = 0; ubCivQuoteID = DetermineCivQuoteEntry( pCiv, &ubCivHintToUse, FALSE ); } @@ -800,7 +800,7 @@ void StartCivQuote( SOLDIERTYPE *pCiv ) pCiv->bCurrentCivQuoteDelta = 0; } - ubEntryID = pCiv->bCurrentCivQuote + pCiv->bCurrentCivQuoteDelta; + ubEntryID = pCiv->bCurrentCivQuote + pCiv->bCurrentCivQuoteDelta; } else { diff --git a/Tactical/Dialogue Control.cpp b/Tactical/Dialogue Control.cpp index 6a116558..340e7d2f 100644 --- a/Tactical/Dialogue Control.cpp +++ b/Tactical/Dialogue Control.cpp @@ -3,13 +3,13 @@ #include "PreBattle Interface.h" #else #include "sgp.h" - #include "soldier control.h" + //#include "soldier control.h" #include "Encrypted File.h" #include "faces.h" #include "wcheck.h" #include "gap.h" #include "overhead.h" - #include "sound control.h" + #include "Sound Control.h" #include "dialogue control.h" #include "Message.h" #include "render dirty.h" @@ -57,8 +57,13 @@ #include "qarray.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + #define DIALOGUESIZE 480 -#define QUOTE_MESSAGE_SIZE 520 +#define QUOTE_MESSAGE_SIZE 520 #define TALK_PANEL_FACE_X 6 #define TALK_PANEL_FACE_Y 9 @@ -75,6 +80,7 @@ #define TEXT_DELAY_MODIFIER 60 + typedef struct { UINT16 usQuoteNum; @@ -115,7 +121,7 @@ UINT32 uiExternalFaceProfileIds[ NUMBER_OF_EXTERNAL_NPC_FACES ]= 158, }; -UINT8 gubMercValidPrecedentQuoteID[ NUMBER_VALID_MERC_PRECEDENT_QUOTES ] = +UINT8 gubMercValidPrecedentQuoteID[ NUMBER_VALID_MERC_PRECEDENT_QUOTES ] = { 80, 81, 82, 83, 86, 87, 88, 95, 97, 99, 100, 101, 102 }; @@ -136,18 +142,18 @@ UINT8 gubNumStopTimeQuotes = 2; #define INITIAL_Q_SIZE 10 HQUEUE ghDialogueQ = NULL; FACETYPE *gpCurrentTalkingFace = NULL; -UINT8 gubCurrentTalkingID = NO_PROFILE; +UINT8 gubCurrentTalkingID = NO_PROFILE; INT8 gbUIHandlerID; INT32 giNPCReferenceCount = 0; INT32 giNPCSpecialReferenceCount = 0; -INT16 gsExternPanelXPosition = DEFAULT_EXTERN_PANEL_X_POS; -INT16 gsExternPanelYPosition = DEFAULT_EXTERN_PANEL_Y_POS; +INT16 gsExternPanelXPosition = DEFAULT_EXTERN_PANEL_X_POS; +INT16 gsExternPanelYPosition = DEFAULT_EXTERN_PANEL_Y_POS; BOOLEAN gfDialogueQueuePaused = FALSE; UINT16 gusSubtitleBoxWidth; -UINT16 gusSubtitleBoxHeight; +UINT16 gusSubtitleBoxHeight; INT32 giTextBoxOverlay = -1; BOOLEAN gfFacePanelActive = FALSE; UINT32 guiScreenIDUsedWhenUICreated; @@ -200,7 +206,7 @@ void HandleTacticalTextUI( INT32 iFaceIndex, SOLDIERTYPE *pSoldier, STR16 zQuote void HandleTacticalNPCTextUI( UINT8 ubCharacterNum, STR16 zQuoteStr ); void HandleTacticalSpeechUI( UINT8 ubCharacterNum, INT32 iFaceIndex ); -void DisplayTextForExternalNPC( UINT8 ubCharacterNum, STR16 zQuoteStr ); +void DisplayTextForExternalNPC( UINT8 ubCharacterNum, STR16 zQuoteStr ); void CreateTalkingUI( INT8 bUIHandlerID, INT32 iFaceIndex, UINT8 ubCharacterNum, SOLDIERTYPE *pSoldier, STR16 zQuoteStr ); @@ -216,7 +222,7 @@ extern BOOLEAN DoSkiMessageBox( UINT8 ubStyle, STR16 zString, UINT32 uiExitScre void UnPauseGameDuringNextQuote( void ) { fPausedTimeDuringQuote = FALSE; - + return; } @@ -224,7 +230,7 @@ void UnPauseGameDuringNextQuote( void ) void PauseTimeDuringNextQuote( void ) { fPausedTimeDuringQuote = TRUE; - + return; } @@ -247,7 +253,7 @@ BOOLEAN InitalizeDialogueControl() giNPCReferenceCount = 0; - + if ( ghDialogueQ == NULL ) { return( FALSE ); @@ -258,12 +264,12 @@ BOOLEAN InitalizeDialogueControl() } } -void ShutdownDialogueControl() +void ShutdownDialogueControl() { - if( ghDialogueQ != NULL ) + if( ghDialogueQ != NULL ) { // Empty - EmptyDialogueQueue( ); + EmptyDialogueQueue( ); // Delete DeleteQueue( ghDialogueQ ); @@ -284,12 +290,12 @@ void InitalizeStaticExternalNPCFaces( void ) { INT32 iCounter = 0; // go and grab all external NPC faces that are needed for the game who won't exist as soldiertypes - + if( fExternFacesLoaded == TRUE ) { return; } - + fExternFacesLoaded = TRUE; for( iCounter = 0; iCounter < NUMBER_OF_EXTERNAL_NPC_FACES; iCounter++ ) @@ -308,7 +314,7 @@ void ShutdownStaticExternalNPCFaces( void ) { return; } - + fExternFacesLoaded = FALSE; // remove all external npc faces @@ -322,16 +328,16 @@ void ShutdownStaticExternalNPCFaces( void ) void EmptyDialogueQueue( ) { // If we have anything left in the queue, remove! - if( ghDialogueQ != NULL ) + if( ghDialogueQ != NULL ) { /* -DEF: commented out because the Queue system ?? uses a contiguous memory block ??? for the queue - so you cant delete a single node. The DeleteQueue, below, will free the entire memory block +DEF: commented out because the Queue system ?? uses a contiguous memory block ??? for the queue + so you cant delete a single node. The DeleteQueue, below, will free the entire memory block numDialogueItems = QueueSize( ghDialogueQ ); for ( cnt = numDialogueItems-1; cnt >= 0; cnt-- ) - { + { if ( PeekQueue( ghDialogueQ, &QItem ) ) { MemFree( QItem ); @@ -348,15 +354,15 @@ DEF: commented out because the Queue system ?? uses a contiguous memory block ? } - gfWaitingForTriggerTimer = FALSE; + gfWaitingForTriggerTimer = FALSE; } BOOLEAN DialogueQueueIsEmpty( ) { INT32 numDialogueItems; - - if( ghDialogueQ != NULL ) + + if( ghDialogueQ != NULL ) { numDialogueItems = QueueSize( ghDialogueQ ); @@ -421,7 +427,7 @@ void HandleDialogueUIAdjustments( ) if ( pSoldier ) { if ( 0 ) - { + { // A change in plans here... // We now talk through the interface panel... if ( gpCurrentTalkingFace->iVideoOverlay != -1 ) @@ -462,12 +468,12 @@ void HandleDialogue( ) CHAR16 zText[ 512 ]; CHAR16 zMoney[128]; - // we don't want to just delay action of some events, we want to pause the whole queue, regardless of the event + // we don't want to just delay action of some events, we want to pause the whole queue, regardless of the event if( gfDialogueQueuePaused ) { return; } - + iQSize = QueueSize( ghDialogueQ ); @@ -513,7 +519,7 @@ void HandleDialogue( ) } } - gTacticalStatus.uiFlags &= ( ~IGNORE_ENGAGED_IN_CONV_UI_UNLOCK ); + gTacticalStatus.uiFlags &= ( ~IGNORE_ENGAGED_IN_CONV_UI_UNLOCK ); } @@ -523,7 +529,7 @@ void HandleDialogue( ) if ( !gfInTalkPanel ) { // ATE: NOT if we have a message box pending.... - if ( guiPendingScreen != MSG_BOX_SCREEN && guiCurrentScreen != MSG_BOX_SCREEN ) + if ( guiPendingScreen != MSG_BOX_SCREEN && guiCurrentScreen != MSG_BOX_SCREEN ) { // No, so we should lock the UI! guiPendingOverrideEvent = LU_BEGINUILOCK; @@ -542,11 +548,11 @@ void HandleDialogue( ) // CHANGE TO MAPSCREEN // CHANGE TO GAMESCREEN // CHANGE IN MERC STATUS TO BE IN A SQUAD - // CHANGE FROM TEAM TO INV INTERFACE + // CHANGE FROM TEAM TO INV INTERFACE // Where are we and where did this face once exist? if ( guiScreenIDUsedWhenUICreated == GAME_SCREEN && guiCurrentScreen == MAP_SCREEN ) - { + { // GO FROM GAMESCREEN TO MAPSCREEN // REMOVE OLD UI // Set face inactive! @@ -575,9 +581,9 @@ void HandleDialogue( ) SetAutoFaceInActive( gpCurrentTalkingFace->iID ); HandleTacticalSpeechUI( gubCurrentTalkingID, gpCurrentTalkingFace->iID ); - // ATE: Force mapscreen to set face active again..... - fReDrawFace = TRUE; - DrawFace( bSelectedInfoChar ); + // ATE: Force mapscreen to set face active again..... + fReDrawFace = TRUE; + DrawFace( bSelectedInfoChar ); gfFacePanelActive = FALSE; } @@ -597,17 +603,17 @@ void HandleDialogue( ) // If we are done, check special face flag for trigger NPC! if ( gpCurrentTalkingFace->uiFlags & FACE_PCTRIGGER_NPC ) { - // Decrement refrence count... - giNPCReferenceCount--; + // Decrement refrence count... + giNPCReferenceCount--; - TriggerNPCRecord( (UINT8)gpCurrentTalkingFace->uiUserData1, (UINT8)gpCurrentTalkingFace->uiUserData2 ); - //Reset flag! - gpCurrentTalkingFace->uiFlags &= (~FACE_PCTRIGGER_NPC ); + TriggerNPCRecord( (UINT8)gpCurrentTalkingFace->uiUserData1, (UINT8)gpCurrentTalkingFace->uiUserData2 ); + //Reset flag! + gpCurrentTalkingFace->uiFlags &= (~FACE_PCTRIGGER_NPC ); } if ( gpCurrentTalkingFace->uiFlags & FACE_MODAL ) { - gpCurrentTalkingFace->uiFlags &= (~FACE_MODAL ); + gpCurrentTalkingFace->uiFlags &= (~FACE_MODAL ); EndModalTactical( ); @@ -624,7 +630,7 @@ void HandleDialogue( ) } gpCurrentTalkingFace = NULL; - gubCurrentTalkingID = NO_PROFILE; + gubCurrentTalkingID = NO_PROFILE; gTacticalStatus.ubLastQuoteProfileNUm = NO_PROFILE; fDoneTalking = TRUE; } @@ -637,7 +643,7 @@ void HandleDialogue( ) // unlock pause state UnLockPauseState(); UnPauseGame(); - + } if ( iQSize == 0 ) @@ -670,8 +676,8 @@ void HandleDialogue( ) return; } - // ATE: Remove any civ quotes.... - // ShutDownQuoteBoxIfActive( TRUE ); + // ATE: Remove any civ quotes.... + // ShutDownQuoteBoxIfActive( TRUE ); // If here, pick current one from queue and play @@ -681,7 +687,7 @@ void HandleDialogue( ) // If we are in auto bandage, ignore any quotes! if ( gTacticalStatus.fAutoBandageMode ) { - if( QItem -> fPauseTime ) + if( QItem->fPauseTime ) { UnLockPauseState(); UnPauseGame(); @@ -712,10 +718,10 @@ void HandleDialogue( ) // ATE: OK: If a battle sound, and delay value was given, set time stamp // now... if ( QItem->uiSpecialEventFlag == DIALOGUE_SPECIAL_EVENT_DO_BATTLE_SND ) - { + { if ( QItem->uiSpecialEventData2 != 0 ) { - if ( ( GetJA2Clock( ) - QItem->iTimeStamp ) < QItem->uiSpecialEventData2 ) + if ( ( GetJA2Clock( ) - QItem->iTimeStamp ) < QItem->uiSpecialEventData2 ) { //Place back in! // Add to queue @@ -743,10 +749,10 @@ void HandleDialogue( ) if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) && ( QItem->uiSpecialEventFlag == 0 ) ) { - QItem-> fPauseTime = TRUE; + QItem->fPauseTime = TRUE; } - if( QItem-> fPauseTime ) + if( QItem->fPauseTime ) { if( GamePaused( ) == FALSE ) { @@ -762,10 +768,10 @@ void HandleDialogue( ) { if( pSoldier ) { - // wake grunt up to say - if( pSoldier->fMercAsleep ) + // wake grunt up to say + if( pSoldier->flags.fMercAsleep ) { - pSoldier->fMercAsleep = FALSE; + pSoldier->flags.fMercAsleep = FALSE; // refresh map screen fCharacterInfoPanelDirty = TRUE; @@ -778,17 +784,17 @@ void HandleDialogue( ) gTacticalStatus.ubLastQuoteSaid = (UINT8)QItem->usQuoteNum; gTacticalStatus.ubLastQuoteProfileNUm = (UINT8)QItem->ubCharacterNum; - + // Setup face pointer gpCurrentTalkingFace = &gFacesData[ QItem->iFaceIndex ]; - gubCurrentTalkingID = QItem->ubCharacterNum; + gubCurrentTalkingID = QItem->ubCharacterNum; ExecuteCharacterDialogue( QItem->ubCharacterNum, QItem->usQuoteNum, QItem->iFaceIndex, QItem->bUIHandlerID, QItem->fFromSoldier ); } else if( QItem->uiSpecialEventFlag & DIALOGUE_SPECIAL_EVENT_SKIP_A_FRAME ) { - + } else if( QItem->uiSpecialEventFlag & DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE ) { @@ -814,7 +820,7 @@ void HandleDialogue( ) } else if ( QItem->uiSpecialEventFlag & DIALOGUE_SPECIAL_EVENT_REMOVE_EPC ) { - gMercProfiles[ (UINT8) QItem->uiSpecialEventData ].ubMiscFlags &= ~PROFILE_MISC_FLAG_FORCENPCQUOTE; + gMercProfiles[ (UINT8) QItem->uiSpecialEventData ].ubMiscFlags &= ~PROFILE_MISC_FLAG_FORCENPCQUOTE; UnRecruitEPC( (UINT8) QItem->uiSpecialEventData ); ReBuildCharactersList(); } @@ -824,17 +830,17 @@ void HandleDialogue( ) } else if ( QItem->uiSpecialEventFlag & DIALOGUE_SPECIAL_EVENT_CONTRACT_NOGO_TO_RENEW ) { - HandleMercIsNotWillingToRenew( (UINT8)QItem->uiSpecialEventData ); + HandleMercIsNotWillingToRenew( (UINT8)QItem->uiSpecialEventData ); } else - { + { if ( QItem->uiSpecialEventFlag & DIALOGUE_SPECIAL_EVENT_USE_ALTERNATE_FILES ) { gfUseAlternateDialogueFile = TRUE; // Setup face pointer gpCurrentTalkingFace = &gFacesData[ QItem->iFaceIndex ]; - gubCurrentTalkingID = QItem->ubCharacterNum; + gubCurrentTalkingID = QItem->ubCharacterNum; ExecuteCharacterDialogue( QItem->ubCharacterNum, QItem->usQuoteNum, QItem->iFaceIndex, QItem->bUIHandlerID, QItem->fFromSoldier ); @@ -846,14 +852,14 @@ void HandleDialogue( ) { // Setup face pointer gpCurrentTalkingFace = &gFacesData[ QItem->iFaceIndex ]; - gubCurrentTalkingID = QItem->ubCharacterNum; + gubCurrentTalkingID = QItem->ubCharacterNum; ExecuteCharacterDialogue( QItem->ubCharacterNum, QItem->usQuoteNum, QItem->iFaceIndex, QItem->bUIHandlerID, QItem->fFromSoldier ); // Setup face with data! gpCurrentTalkingFace->uiFlags |= FACE_PCTRIGGER_NPC; - gpCurrentTalkingFace->uiUserData1 = QItem->uiSpecialEventData; - gpCurrentTalkingFace->uiUserData2 = QItem->uiSpecialEventData2; + gpCurrentTalkingFace->uiUserData1 = QItem->uiSpecialEventData; + gpCurrentTalkingFace->uiUserData2 = QItem->uiSpecialEventData2; } else if ( QItem->uiSpecialEventFlag & DIALOGUE_SPECIAL_EVENT_SHOW_CONTRACT_MENU ) @@ -864,7 +870,7 @@ void HandleDialogue( ) SetInfoChar( pSoldier->ubID ); fShowContractMenu = TRUE; - RebuildContractBoxForMerc( pSoldier ); + RebuildContractBoxForMerc( pSoldier ); bSelectedContractChar = bSelectedInfoChar; pProcessingSoldier = pSoldier; fProcessingAMerc = TRUE; @@ -877,7 +883,7 @@ void HandleDialogue( ) // Do battle snounds...... if ( pSoldier ) { - InternalDoMercBattleSound( pSoldier, (UINT8)QItem->uiSpecialEventData, 0 ); + pSoldier->InternalDoMercBattleSound( (UINT8)QItem->uiSpecialEventData, 0 ); } } @@ -887,10 +893,10 @@ void HandleDialogue( ) gTacticalStatus.fLockItemLocators = FALSE; // Slide to location! - SlideToLocation( 0, (UINT16)QItem->uiSpecialEventData ); + SlideToLocation( 0, (INT16)QItem->uiSpecialEventData ); gpCurrentTalkingFace = &gFacesData[ QItem->iFaceIndex ]; - gubCurrentTalkingID = QItem->ubCharacterNum; + gubCurrentTalkingID = QItem->ubCharacterNum; ExecuteCharacterDialogue( QItem->ubCharacterNum, QItem->usQuoteNum, QItem->iFaceIndex, QItem->bUIHandlerID, QItem->fFromSoldier ); @@ -935,14 +941,14 @@ void HandleDialogue( ) { // Setup face pointer gpCurrentTalkingFace = &gFacesData[ QItem->iFaceIndex ]; - gubCurrentTalkingID = QItem->ubCharacterNum; + gubCurrentTalkingID = QItem->ubCharacterNum; ExecuteCharacterDialogue( QItem->ubCharacterNum, QItem->usQuoteNum, QItem->iFaceIndex, QItem->bUIHandlerID, QItem->fFromSoldier ); // Setup face with data! gpCurrentTalkingFace->uiFlags |= FACE_TRIGGER_PREBATTLE_INT; - gpCurrentTalkingFace->uiUserData1 = QItem->uiSpecialEventData; - gpCurrentTalkingFace->uiUserData2 = QItem->uiSpecialEventData2; + gpCurrentTalkingFace->uiUserData1 = QItem->uiSpecialEventData; + gpCurrentTalkingFace->uiUserData2 = QItem->uiSpecialEventData2; } if ( QItem->uiSpecialEventFlag & DIALOGUE_SPECIAL_EVENT_SHOPKEEPER ) @@ -956,7 +962,7 @@ void HandleDialogue( ) InsertDollarSignInToString( zMoney ); } - switch( QItem->uiSpecialEventData ) + switch( QItem->uiSpecialEventData ) { case( 0 ): swprintf( zText, SkiMessageBoxText[ SKI_SHORT_FUNDS_TEXT ], zMoney ); @@ -967,14 +973,14 @@ void HandleDialogue( ) case( 1 ): //if the player is trading items swprintf( zText, SkiMessageBoxText[ SKI_QUESTION_TO_DEDUCT_MONEY_FROM_PLAYERS_ACCOUNT_TO_COVER_DIFFERENCE ], zMoney ); - + //ask them if we should deduct money out the players account to cover the difference DoSkiMessageBox( MSG_BOX_BASIC_STYLE, zText, SHOPKEEPER_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmToDeductMoneyFromPlayersAccountMessageBoxCallBack ); break; case( 2 ): swprintf( zText, SkiMessageBoxText[ SKI_QUESTION_TO_DEDUCT_MONEY_FROM_PLAYERS_ACCOUNT_TO_COVER_COST ], zMoney ); - + //ask them if we should deduct money out the players account to cover the difference DoSkiMessageBox( MSG_BOX_BASIC_STYLE, zText, SHOPKEEPER_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmToDeductMoneyFromPlayersAccountMessageBoxCallBack ); break; @@ -1004,7 +1010,7 @@ void HandleDialogue( ) } break; } - + } if( QItem->uiSpecialEventFlag & DIALOGUE_SPECIAL_EVENT_EXIT_MAP_SCREEN ) @@ -1042,7 +1048,7 @@ void HandleDialogue( ) { // Setup face pointer gpCurrentTalkingFace = &gFacesData[ QItem->iFaceIndex ]; - gubCurrentTalkingID = QItem->ubCharacterNum; + gubCurrentTalkingID = QItem->ubCharacterNum; // handle the monologue event HandleSkyRiderMonologueEvent( QItem->uiSpecialEventData, QItem->uiSpecialEventData2 ); @@ -1052,7 +1058,7 @@ void HandleDialogue( ) { // Setup face pointer gpCurrentTalkingFace = &gFacesData[ QItem->iFaceIndex ]; - gubCurrentTalkingID = QItem->ubCharacterNum; + gubCurrentTalkingID = QItem->ubCharacterNum; // set up the mine highlgith events SetUpAnimationOfMineSectors( QItem->uiSpecialEventData ); @@ -1077,7 +1083,7 @@ void HandleDialogue( ) { if ( QItem->bUIHandlerID == DIALOGUE_NPC_UI ) { - HandleNPCGotoGridNo( (UINT8)QItem->uiSpecialEventData, (UINT16)QItem->uiSpecialEventData2, (UINT8)QItem->uiSpecialEventData3 ); + HandleNPCGotoGridNo( (UINT8)QItem->uiSpecialEventData, (INT16)QItem->uiSpecialEventData2, (UINT8)QItem->uiSpecialEventData3 ); } } else if ( QItem->uiSpecialEventFlag & DIALOGUE_SPECIAL_EVENT_DO_ACTION ) @@ -1102,7 +1108,7 @@ void HandleDialogue( ) { // grab soldier ptr from profile ID pSoldier = FindSoldierByProfileID( ( UINT8 )( QItem->uiSpecialEventData ), FALSE ); - + // if soldier valid... if( pSoldier != NULL ) { @@ -1121,7 +1127,7 @@ void HandleDialogue( ) { // grab soldier ptr from profile ID pSoldier = FindSoldierByProfileID( QItem->ubCharacterNum, FALSE ); - + // if soldier valid... if( pSoldier != NULL ) { @@ -1133,7 +1139,7 @@ void HandleDialogue( ) { // grab soldier ptr from profile ID pSoldier = FindSoldierByProfileID( QItem->ubCharacterNum, FALSE ); - + // if soldier valid... if( pSoldier != NULL ) { @@ -1163,19 +1169,19 @@ void HandleDialogue( ) // wake merc up or put them back down? if( QItem->uiSpecialEventData == 1 ) { - pSoldier -> fMercAsleep = TRUE; + pSoldier->flags.fMercAsleep = TRUE; } else { - pSoldier -> fMercAsleep = FALSE; + pSoldier->flags.fMercAsleep = FALSE; } // refresh map screen fCharacterInfoPanelDirty = TRUE; fTeamPanelDirty = TRUE; } - } - + } + // grab soldier ptr from profile ID pSoldier = FindSoldierByProfileID( QItem->ubCharacterNum, FALSE ); @@ -1184,7 +1190,7 @@ void HandleDialogue( ) CheckForStopTimeQuotes( QItem->usQuoteNum ); } - if( QItem -> fPauseTime ) + if( QItem->fPauseTime ) { fWasPausedDuringDialogue = TRUE; } @@ -1203,10 +1209,10 @@ BOOLEAN DelayedTacticalCharacterDialogue( SOLDIERTYPE *pSoldier, UINT16 usQuoteN return( FALSE ); } - if (pSoldier->bLife < CONSCIOUSNESS ) - return( FALSE ); + if (pSoldier->stats.bLife < CONSCIOUSNESS ) + return( FALSE ); - if ( pSoldier->uiStatusFlags & SOLDIER_GASSED ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) return( FALSE ); if ( (AM_A_ROBOT( pSoldier )) ) @@ -1214,8 +1220,8 @@ BOOLEAN DelayedTacticalCharacterDialogue( SOLDIERTYPE *pSoldier, UINT16 usQuoteN return( FALSE ); } - if (pSoldier->bLife < OKLIFE && usQuoteNum != QUOTE_SERIOUSLY_WOUNDED ) - return( FALSE ); + if (pSoldier->stats.bLife < OKLIFE && usQuoteNum != QUOTE_SERIOUSLY_WOUNDED ) + return( FALSE ); if( pSoldier->bAssignment == ASSIGNMENT_POW ) { @@ -1235,12 +1241,12 @@ BOOLEAN TacticalCharacterDialogueWithSpecialEvent( SOLDIERTYPE *pSoldier, UINT16 if ( uiFlag != DIALOGUE_SPECIAL_EVENT_DO_BATTLE_SND && uiData1 != BATTLE_SOUND_DIE1 ) { - if (pSoldier->bLife < CONSCIOUSNESS ) - return( FALSE ); + if (pSoldier->stats.bLife < CONSCIOUSNESS ) + return( FALSE ); - if ( pSoldier->uiStatusFlags & SOLDIER_GASSED ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) return( FALSE ); - + } return( CharacterDialogueWithSpecialEvent( pSoldier->ubProfile, usQuoteNum, pSoldier->iFaceIndex, DIALOGUE_TACTICAL_UI, TRUE, FALSE, uiFlag, uiData1, uiData2 ) ); @@ -1255,10 +1261,10 @@ BOOLEAN TacticalCharacterDialogueWithSpecialEventEx( SOLDIERTYPE *pSoldier, UINT if ( uiFlag != DIALOGUE_SPECIAL_EVENT_DO_BATTLE_SND && uiData1 != BATTLE_SOUND_DIE1 ) { - if (pSoldier->bLife < CONSCIOUSNESS ) - return( FALSE ); + if (pSoldier->stats.bLife < CONSCIOUSNESS ) + return( FALSE ); - if ( pSoldier->uiStatusFlags & SOLDIER_GASSED ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) return( FALSE ); if ( (AM_A_ROBOT( pSoldier )) ) @@ -1266,8 +1272,8 @@ BOOLEAN TacticalCharacterDialogueWithSpecialEventEx( SOLDIERTYPE *pSoldier, UINT return( FALSE ); } - if (pSoldier->bLife < OKLIFE && usQuoteNum != QUOTE_SERIOUSLY_WOUNDED ) - return( FALSE ); + if (pSoldier->stats.bLife < OKLIFE && usQuoteNum != QUOTE_SERIOUSLY_WOUNDED ) + return( FALSE ); if( pSoldier->bAssignment == ASSIGNMENT_POW ) { @@ -1292,13 +1298,13 @@ BOOLEAN TacticalCharacterDialogue( SOLDIERTYPE *pSoldier, UINT16 usQuoteNum ) return( FALSE ); } - if (pSoldier->bLife < CONSCIOUSNESS ) - return( FALSE ); + if (pSoldier->stats.bLife < CONSCIOUSNESS ) + return( FALSE ); - if (pSoldier->bLife < OKLIFE && usQuoteNum != QUOTE_SERIOUSLY_WOUNDED ) - return( FALSE ); + if (pSoldier->stats.bLife < OKLIFE && usQuoteNum != QUOTE_SERIOUSLY_WOUNDED ) + return( FALSE ); - if ( pSoldier->uiStatusFlags & SOLDIER_GASSED ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) return( FALSE ); if ( (AM_A_ROBOT( pSoldier )) ) @@ -1313,16 +1319,16 @@ BOOLEAN TacticalCharacterDialogue( SOLDIERTYPE *pSoldier, UINT16 usQuoteNum ) // OK, let's check if this is the exact one we just played, if so, skip. if ( pSoldier->ubProfile == gTacticalStatus.ubLastQuoteProfileNUm && - usQuoteNum == gTacticalStatus.ubLastQuoteSaid ) - { + usQuoteNum == gTacticalStatus.ubLastQuoteSaid ) + { return( FALSE ); } // If we are a robot, play the controller's quote! - if ( pSoldier->uiStatusFlags & SOLDIER_ROBOT ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) { - if ( CanRobotBeControlled( pSoldier ) ) + if ( pSoldier->CanRobotBeControlled( ) ) { return( TacticalCharacterDialogue( MercPtrs[ pSoldier->ubRobotRemoteHolderID ], usQuoteNum ) ); } @@ -1358,7 +1364,7 @@ BOOLEAN TacticalCharacterDialogue( SOLDIERTYPE *pSoldier, UINT16 usQuoteNum ) // FACEINDEX // The face index is an index into an ACTIVE face. The face is considered to // be active, and if it's not, either that has to be handled by the UI handler -// ir nothing will show. What this function does is set the face to talking, +// ir nothing will show. What this function does is set the face to talking, // and the face sprite system should handle the rest. // bUIHandlerID // Because this could be used in any place, the UI handleID is used to differentiate @@ -1451,11 +1457,11 @@ BOOLEAN CharacterDialogue( UINT8 ubCharacterNum, UINT16 usQuoteNum, INT32 iFaceI QItem->iTimeStamp = GetJA2Clock( ); QItem->fFromSoldier = fFromSoldier; QItem->fDelayed = fDelayed; - + // check if pause already locked, if so, then don't mess with it if( gfLockPauseState == FALSE ) { - QItem->fPauseTime = fPausedTimeDuringQuote; + QItem->fPauseTime = fPausedTimeDuringQuote; } fPausedTimeDuringQuote = FALSE; @@ -1482,11 +1488,11 @@ BOOLEAN SpecialCharacterDialogueEvent( UINT32 uiSpecialEventFlag, UINT32 uiSpeci QItem->iFaceIndex = iFaceIndex; QItem->bUIHandlerID = bUIHandlerID; QItem->iTimeStamp = GetJA2Clock( ); - + // if paused state not already locked if( gfLockPauseState == FALSE ) { - QItem->fPauseTime = fPausedTimeDuringQuote; + QItem->fPauseTime = fPausedTimeDuringQuote; } fPausedTimeDuringQuote = FALSE; @@ -1494,7 +1500,7 @@ BOOLEAN SpecialCharacterDialogueEvent( UINT32 uiSpecialEventFlag, UINT32 uiSpeci // Add to queue ghDialogueQ = AddtoQueue( ghDialogueQ, &QItem ); - + return( TRUE ); } @@ -1514,11 +1520,11 @@ BOOLEAN SpecialCharacterDialogueEventWithExtraParam( UINT32 uiSpecialEventFlag, QItem->iFaceIndex = iFaceIndex; QItem->bUIHandlerID = bUIHandlerID; QItem->iTimeStamp = GetJA2Clock( ); - + // if paused state not already locked if( gfLockPauseState == FALSE ) { - QItem->fPauseTime = fPausedTimeDuringQuote; + QItem->fPauseTime = fPausedTimeDuringQuote; } fPausedTimeDuringQuote = FALSE; @@ -1542,14 +1548,14 @@ BOOLEAN ExecuteCharacterDialogue( UINT8 ubCharacterNum, UINT16 usQuoteNum, INT32 pSoldier = FindSoldierByProfileID( ubCharacterNum, TRUE ); if ( pSoldier != NULL ) - { + { // Check vital stats - if (pSoldier->bLife < CONSCIOUSNESS ) + if (pSoldier->stats.bLife < CONSCIOUSNESS ) { return( FALSE ); } - if ( pSoldier->uiStatusFlags & SOLDIER_GASSED ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) return( FALSE ); if ( (AM_A_ROBOT( pSoldier )) ) @@ -1557,7 +1563,7 @@ BOOLEAN ExecuteCharacterDialogue( UINT8 ubCharacterNum, UINT16 usQuoteNum, INT32 return( FALSE ); } - if (pSoldier->bLife < OKLIFE && usQuoteNum != QUOTE_SERIOUSLY_WOUNDED ) + if (pSoldier->stats.bLife < OKLIFE && usQuoteNum != QUOTE_SERIOUSLY_WOUNDED ) { return( FALSE ); } @@ -1568,7 +1574,7 @@ BOOLEAN ExecuteCharacterDialogue( UINT8 ubCharacterNum, UINT16 usQuoteNum, INT32 } // sleeping guys don't talk.. go to standby to talk - if( pSoldier->fMercAsleep == TRUE ) + if( pSoldier->flags.fMercAsleep == TRUE ) { // check if the soldier was compaining about lack of sleep and was alseep, if so, leave them alone if( ( usQuoteNum == QUOTE_NEED_SLEEP ) || ( usQuoteNum == QUOTE_OUT_OF_BREATH ) ) @@ -1584,17 +1590,17 @@ BOOLEAN ExecuteCharacterDialogue( UINT8 ubCharacterNum, UINT16 usQuoteNum, INT32 // now being used in a different way... /* - if ( ( (usQuoteNum == QUOTE_PERSONALITY_TRAIT && + if ( ( (usQuoteNum == QUOTE_PERSONALITY_TRAIT && (gMercProfiles[ubCharacterNum].bPersonalityTrait == FORGETFUL || - gMercProfiles[ubCharacterNum].bPersonalityTrait == CLAUSTROPHOBIC || - gMercProfiles[ubCharacterNum].bPersonalityTrait == NERVOUS || - gMercProfiles[ubCharacterNum].bPersonalityTrait == NONSWIMMER || - gMercProfiles[ubCharacterNum].bPersonalityTrait == FEAR_OF_INSECTS)) - //usQuoteNum == QUOTE_STARTING_TO_WHINE || + gMercProfiles[ubCharacterNum].bPersonalityTrait == CLAUSTROPHOBIC || + gMercProfiles[ubCharacterNum].bPersonalityTrait == NERVOUS || + gMercProfiles[ubCharacterNum].bPersonalityTrait == NONSWIMMER || + gMercProfiles[ubCharacterNum].bPersonalityTrait == FEAR_OF_INSECTS)) + //usQuoteNum == QUOTE_STARTING_TO_WHINE || #ifdef JA2BETAVERSION || usQuoteNum == QUOTE_WHINE_EQUIPMENT) && (guiCurrentScreen != QUEST_DEBUG_SCREEN) ) #else - ) ) + ) ) #endif { @@ -1608,12 +1614,12 @@ BOOLEAN ExecuteCharacterDialogue( UINT8 ubCharacterNum, UINT16 usQuoteNum, INT32 if ( gMercProfiles[ pTeamSoldier->ubProfile ].bMercOpinion[ ubCharacterNum ] < -2 && !( pTeamSoldier->usQuoteSaidFlags & SOLDIER_QUOTE_SAID_ANNOYING_MERC ) ) { // make a comment! - TacticalCharacterDialogue( pTeamSoldier, QUOTE_ANNOYING_PC ); + TacticalCharacterDialogue( pTeamSoldier, QUOTE_ANNOYING_PC ); pTeamSoldier->usQuoteSaidFlags |= SOLDIER_QUOTE_SAID_ANNOYING_MERC; break; } } - } + } } */ } @@ -1629,20 +1635,20 @@ BOOLEAN ExecuteCharacterDialogue( UINT8 ubCharacterNum, UINT16 usQuoteNum, INT32 // Check face index CHECKF( iFaceIndex != -1 ); - if ( !GetDialogue( ubCharacterNum, - usQuoteNum, DIALOGUESIZE, gzQuoteStr, &uiSoundID, zSoundString) ) - { - return( FALSE ); - } - + if ( !GetDialogue( ubCharacterNum, + usQuoteNum, DIALOGUESIZE, gzQuoteStr, &uiSoundID, zSoundString) ) + { + return( FALSE ); + } + if( bUIHandlerID == DIALOGUE_EXTERNAL_NPC_UI ) { // external NPC - SetFaceTalking( iFaceIndex , zSoundString, gzQuoteStr, RATE_11025, 30, 1, MIDDLEPAN ); + SetFaceTalking( iFaceIndex , zSoundString, gzQuoteStr, RATE_11025, 30, 1, MIDDLEPAN ); } else { - // start "talking" system (portrait animation and start wav sample) + // start "talking" system (portrait animation and start wav sample) SetFaceTalking( iFaceIndex, zSoundString, gzQuoteStr, RATE_11025, 30, 1, MIDDLEPAN ); } // pSoldier can be null here... ( if NOT from an alive soldier ) @@ -1661,7 +1667,7 @@ void CreateTalkingUI( INT8 bUIHandlerID, INT32 iFaceIndex, UINT8 ubCharacterNum, { // Show text, if on - if ( gGameSettings.fOptions[ TOPTION_SUBTITLES ] || !gFacesData[ iFaceIndex ].fValidSpeech ) + if ( gGameSettings.fOptions[ TOPTION_SUBTITLES ] || !gFacesData[ iFaceIndex ].fValidSpeech ) { switch( bUIHandlerID ) { @@ -1683,7 +1689,7 @@ void CreateTalkingUI( INT8 bUIHandlerID, INT32 iFaceIndex, UINT8 ubCharacterNum, DisplayTextForSpeckVideoPopUp( zQuoteStr ); break; case DIALOGUE_EXTERNAL_NPC_UI: - + DisplayTextForExternalNPC( ubCharacterNum, zQuoteStr ); break; @@ -1750,9 +1756,9 @@ CHAR8 *GetDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN } } else if ( ubCharacterNum >= FIRST_RPC && ubCharacterNum < GASTON && - ( !( gMercProfiles[ ubCharacterNum ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) - || ProfileCurrentlyTalkingInDialoguePanel( ubCharacterNum ) - || (gMercProfiles[ ubCharacterNum ].ubMiscFlags & PROFILE_MISC_FLAG_FORCENPCQUOTE) ) + ( !( gMercProfiles[ ubCharacterNum ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) + || ProfileCurrentlyTalkingInDialoguePanel( ubCharacterNum ) + || (gMercProfiles[ ubCharacterNum ].ubMiscFlags & PROFILE_MISC_FLAG_FORCENPCQUOTE) ) ) { ubFileNumID = ubCharacterNum; @@ -1831,8 +1837,8 @@ CHAR8 *GetDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN // Used to see if the dialog text file exists BOOLEAN DialogueDataFileExistsForProfile( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN fWavFile, STR8 *ppStr ) { - STR8 pFilename; - + STR8 pFilename; + pFilename = GetDialogueDataFilename( ubCharacterNum, usQuoteNum, fWavFile ); if ( ppStr ) @@ -1845,32 +1851,32 @@ BOOLEAN DialogueDataFileExistsForProfile( UINT8 ubCharacterNum, UINT16 usQuoteNu BOOLEAN GetDialogue( UINT8 ubCharacterNum, UINT16 usQuoteNum, UINT32 iDataSize, STR16 zDialogueText, UINT32 *puiSoundID, CHAR8 *zSoundString ) { - STR8 pFilename; + STR8 pFilename; - // first things first - grab the text (if player has SUBTITLE PREFERENCE ON) - //if ( gGameSettings.fOptions[ TOPTION_SUBTITLES ] ) - { + // first things first - grab the text (if player has SUBTITLE PREFERENCE ON) + //if ( gGameSettings.fOptions[ TOPTION_SUBTITLES ] ) + { if ( DialogueDataFileExistsForProfile( ubCharacterNum, 0, FALSE, &pFilename ) ) { LoadEncryptedDataFromFile( pFilename, zDialogueText, usQuoteNum * iDataSize, iDataSize ); - if(zDialogueText[0] == 0) - { + if(zDialogueText[0] == 0) + { swprintf( zDialogueText, L"I have no text in the EDT file ( %d ) %S", usQuoteNum, pFilename ); #ifndef JA2BETAVERSION - return( FALSE ); + return( FALSE ); #endif - } - } + } + } else { swprintf( zDialogueText, L"I have no text in the file ( %d ) %S", usQuoteNum , pFilename ); #ifndef JA2BETAVERSION - return( FALSE ); + return( FALSE ); #endif } - } + } // CHECK IF THE FILE EXISTS, IF NOT, USE DEFAULT! @@ -1879,31 +1885,31 @@ BOOLEAN GetDialogue( UINT8 ubCharacterNum, UINT16 usQuoteNum, UINT32 iDataSize, // Copy strcpy( zSoundString, pFilename ); - // Double check it exists.... + // Double check it exists.... //#ifndef JA2TESTVERSION /* - if ( !FileExists( pFilename ) ) - { + if ( !FileExists( pFilename ) ) + { CHAR8 sString[512]; sprintf( sString, "ERROR: Missing file for character # %d, quote # %d", ubCharacterNum, usQuoteNum ); - ShowCursor(TRUE); - ShowCursor(TRUE); - ShutdownWithErrorBox( sString ); - } + ShowCursor(TRUE); + ShowCursor(TRUE); + ShutdownWithErrorBox( sString ); + } */ //#endif - // get speech if applicable + // get speech if applicable if ( gGameSettings.fOptions[ TOPTION_SPEECH ] ) - { + { // Load it into memory! - *puiSoundID = SoundLoadSample( pFilename ); - - } + *puiSoundID = SoundLoadSample( pFilename ); + + } return(TRUE); } @@ -1927,13 +1933,13 @@ void HandleTacticalNPCTextUI( UINT8 ubCharacterNum, STR16 zQuoteStr ) #else swprintf( gTalkPanel.zQuoteStr, L"\"%s\"", zQuoteStr ); swprintf( zText, L"%s: \"%s\"", gMercProfiles[ ubCharacterNum ].zNickname, zQuoteStr ); - MapScreenMessage( FONT_MCOLOR_WHITE, MSG_DIALOG, L"%s", zText ); + MapScreenMessage( FONT_MCOLOR_WHITE, MSG_DIALOG, L"%s", zText ); #endif } // Handlers for tactical UI stuff -void DisplayTextForExternalNPC( UINT8 ubCharacterNum, STR16 zQuoteStr ) +void DisplayTextForExternalNPC( UINT8 ubCharacterNum, STR16 zQuoteStr ) { CHAR16 zText[ QUOTE_MESSAGE_SIZE ]; INT16 sLeft; @@ -1952,23 +1958,23 @@ void DisplayTextForExternalNPC( UINT8 ubCharacterNum, STR16 zQuoteStr ) #else swprintf( gTalkPanel.zQuoteStr, L"\"%s\"", zQuoteStr ); swprintf( zText, L"%s: \"%s\"", gMercProfiles[ ubCharacterNum ].zNickname, zQuoteStr ); - MapScreenMessage( FONT_MCOLOR_WHITE, MSG_DIALOG, L"%s", zText ); + MapScreenMessage( FONT_MCOLOR_WHITE, MSG_DIALOG, L"%s", zText ); #endif if ( guiCurrentScreen == MAP_SCREEN ) { - sLeft = ( gsExternPanelXPosition + 97 ); + sLeft = ( gsExternPanelXPosition + 97 ); gsTopPosition = gsExternPanelYPosition; } - else - { - sLeft = ( 110 ); - } + else + { + sLeft = ( 110 ); + } ExecuteTacticalTextBox( sLeft, gTalkPanel.zQuoteStr ); return; - + } @@ -1988,16 +1994,16 @@ void HandleTacticalTextUI( INT32 iFaceIndex, SOLDIERTYPE *pSoldier, STR16 zQuote sLeft = 110; - //previous version + //previous version //sLeft = 110; ExecuteTacticalTextBox( sLeft, zText ); #ifndef TAIWANESE swprintf( zText, L"%s: \"%s\"", gMercProfiles[ pSoldier->ubProfile ].zNickname, zQuoteStr ); - MapScreenMessage( FONT_MCOLOR_WHITE, MSG_DIALOG, L"%s", zText ); + MapScreenMessage( FONT_MCOLOR_WHITE, MSG_DIALOG, L"%s", zText ); #endif - + } @@ -2009,8 +2015,8 @@ void ExecuteTacticalTextBoxForLastQuote( INT16 sLeftPosition, STR16 pString ) guiDialogueLastQuoteTime = GetJA2Clock(); - guiDialogueLastQuoteDelay = ( ( uiDelay < FINAL_TALKING_DURATION ) ? FINAL_TALKING_DURATION : uiDelay ); - + guiDialogueLastQuoteDelay = ( ( uiDelay < FINAL_TALKING_DURATION ) ? FINAL_TALKING_DURATION : uiDelay ); + // now execute box ExecuteTacticalTextBox(sLeftPosition, pString ); } @@ -2020,36 +2026,36 @@ void ExecuteTacticalTextBox( INT16 sLeftPosition, STR16 pString ) VIDEO_OVERLAY_DESC VideoOverlayDesc; // check if mouse region created, if so, do not recreate - + if( fTextBoxMouseRegionCreated == TRUE ) { return; } memset( &VideoOverlayDesc, 0, sizeof( VIDEO_OVERLAY_DESC ) ); - + // Prepare text box - SET_USE_WINFONTS( TRUE ); - SET_WINFONT( giSubTitleWinFont ); + SET_USE_WINFONTS( TRUE ); + SET_WINFONT( giSubTitleWinFont ); iDialogueBox = PrepareMercPopupBox( iDialogueBox , BASIC_MERC_POPUP_BACKGROUND, BASIC_MERC_POPUP_BORDER, pString, DIALOGUE_DEFAULT_SUBTITLE_WIDTH, 0, 0, 0, &gusSubtitleBoxWidth, &gusSubtitleBoxHeight ); - SET_USE_WINFONTS( FALSE ); + SET_USE_WINFONTS( FALSE ); - VideoOverlayDesc.sLeft = sLeftPosition; - VideoOverlayDesc.sTop = gsTopPosition; - VideoOverlayDesc.sRight = VideoOverlayDesc.sLeft + gusSubtitleBoxWidth; - VideoOverlayDesc.sBottom = VideoOverlayDesc.sTop + gusSubtitleBoxHeight; - VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; - VideoOverlayDesc.sY = VideoOverlayDesc.sTop; + VideoOverlayDesc.sLeft = sLeftPosition; + VideoOverlayDesc.sTop = gsTopPosition; + VideoOverlayDesc.sRight = VideoOverlayDesc.sLeft + gusSubtitleBoxWidth; + VideoOverlayDesc.sBottom = VideoOverlayDesc.sTop + gusSubtitleBoxHeight; + VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; + VideoOverlayDesc.sY = VideoOverlayDesc.sTop; VideoOverlayDesc.BltCallback = RenderSubtitleBoxOverlay; - giTextBoxOverlay = RegisterVideoOverlay( 0, &VideoOverlayDesc ); + giTextBoxOverlay = RegisterVideoOverlay( 0, &VideoOverlayDesc ); gsTopPosition = 20; //Define main region - MSYS_DefineRegion( &gTextBoxMouseRegion, VideoOverlayDesc.sLeft, VideoOverlayDesc.sTop, VideoOverlayDesc.sRight, VideoOverlayDesc.sBottom, MSYS_PRIORITY_HIGHEST, - CURSOR_NORMAL, MSYS_NO_CALLBACK, TextOverlayClickCallback ); + MSYS_DefineRegion( &gTextBoxMouseRegion, VideoOverlayDesc.sLeft, VideoOverlayDesc.sTop, VideoOverlayDesc.sRight, VideoOverlayDesc.sBottom, MSYS_PRIORITY_HIGHEST, + CURSOR_NORMAL, MSYS_NO_CALLBACK, TextOverlayClickCallback ); // Add region MSYS_AddRegion(&(gTextBoxMouseRegion) ); @@ -2062,11 +2068,11 @@ void HandleExternNPCSpeechFace( INT32 iIndex ) INT32 iFaceIndex; VIDEO_OVERLAY_DESC VideoOverlayDesc; INT32 iFaceOverlay; - - + + // grab face index iFaceIndex = iIndex; - + // Enable it! SetAutoFaceActive( FACE_AUTO_DISPLAY_BUFFER, FACE_AUTO_RESTORE_BUFFER, iFaceIndex , 0, 0 ); @@ -2079,29 +2085,29 @@ void HandleExternNPCSpeechFace( INT32 iIndex ) if ( guiCurrentScreen != MAP_SCREEN ) { // Setup video overlay! - VideoOverlayDesc.sLeft = 10; - VideoOverlayDesc.sTop = 20; - VideoOverlayDesc.sRight = VideoOverlayDesc.sLeft + 99; - VideoOverlayDesc.sBottom = VideoOverlayDesc.sTop + 98; - VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; - VideoOverlayDesc.sY = VideoOverlayDesc.sTop; + VideoOverlayDesc.sLeft = 10; + VideoOverlayDesc.sTop = 20; + VideoOverlayDesc.sRight = VideoOverlayDesc.sLeft + 99; + VideoOverlayDesc.sBottom = VideoOverlayDesc.sTop + 98; + VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; + VideoOverlayDesc.sY = VideoOverlayDesc.sTop; VideoOverlayDesc.BltCallback = RenderFaceOverlay; } else { // Setup video overlay! - - VideoOverlayDesc.sLeft = gsExternPanelXPosition; - VideoOverlayDesc.sTop = gsExternPanelYPosition; - - VideoOverlayDesc.sRight = VideoOverlayDesc.sLeft + 99; - VideoOverlayDesc.sBottom = VideoOverlayDesc.sTop + 98; - VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; - VideoOverlayDesc.sY = VideoOverlayDesc.sTop; + + VideoOverlayDesc.sLeft = gsExternPanelXPosition; + VideoOverlayDesc.sTop = gsExternPanelYPosition; + + VideoOverlayDesc.sRight = VideoOverlayDesc.sLeft + 99; + VideoOverlayDesc.sBottom = VideoOverlayDesc.sTop + 98; + VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; + VideoOverlayDesc.sY = VideoOverlayDesc.sTop; VideoOverlayDesc.BltCallback = RenderFaceOverlay; } - iFaceOverlay = RegisterVideoOverlay( 0, &VideoOverlayDesc ); + iFaceOverlay = RegisterVideoOverlay( 0, &VideoOverlayDesc ); gpCurrentTalkingFace->iVideoOverlay = iFaceOverlay; RenderAutoFace( iFaceIndex ); @@ -2112,33 +2118,33 @@ void HandleExternNPCSpeechFace( INT32 iIndex ) fExternFaceBoxRegionCreated = TRUE; //Define main region - MSYS_DefineRegion( &gFacePopupMouseRegion, VideoOverlayDesc.sLeft, VideoOverlayDesc.sTop, VideoOverlayDesc.sRight, VideoOverlayDesc.sBottom, MSYS_PRIORITY_HIGHEST, - CURSOR_NORMAL, MSYS_NO_CALLBACK, FaceOverlayClickCallback ); + MSYS_DefineRegion( &gFacePopupMouseRegion, VideoOverlayDesc.sLeft, VideoOverlayDesc.sTop, VideoOverlayDesc.sRight, VideoOverlayDesc.sBottom, MSYS_PRIORITY_HIGHEST, + CURSOR_NORMAL, MSYS_NO_CALLBACK, FaceOverlayClickCallback ); // Add region MSYS_AddRegion(&(gFacePopupMouseRegion) ); } gfFacePanelActive = TRUE; - + return; } -void HandleTacticalSpeechUI( UINT8 ubCharacterNum, INT32 iFaceIndex ) +void HandleTacticalSpeechUI( UINT8 ubCharacterNum, INT32 iFaceIndex ) { VIDEO_OVERLAY_DESC VideoOverlayDesc; INT32 iFaceOverlay; SOLDIERTYPE *pSoldier; BOOLEAN fDoExternPanel = FALSE; - + memset( &VideoOverlayDesc, 0, sizeof( VIDEO_OVERLAY_DESC ) ); // Get soldier pointer, if there is one... // Try to find soldier... pSoldier = FindSoldierByProfileID( ubCharacterNum, FALSE ); - // PLEASE NOTE: pSoldier may legally be NULL (e.g. Skyrider) !!! + // PLEASE NOTE: pSoldier may legally be NULL (e.g. Skyrider) !!! if ( pSoldier == NULL ) { @@ -2148,7 +2154,7 @@ void HandleTacticalSpeechUI( UINT8 ubCharacterNum, INT32 iFaceIndex ) { // If we are not an active face! if ( guiCurrentScreen != MAP_SCREEN ) - { + { fDoExternPanel = TRUE; } } @@ -2170,15 +2176,15 @@ void HandleTacticalSpeechUI( UINT8 ubCharacterNum, INT32 iFaceIndex ) } // Setup video overlay! - VideoOverlayDesc.sLeft = 10; - VideoOverlayDesc.sTop = 20; - VideoOverlayDesc.sRight = VideoOverlayDesc.sLeft + 99; - VideoOverlayDesc.sBottom = VideoOverlayDesc.sTop + 98; - VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; - VideoOverlayDesc.sY = VideoOverlayDesc.sTop; + VideoOverlayDesc.sLeft = 10; + VideoOverlayDesc.sTop = 20; + VideoOverlayDesc.sRight = VideoOverlayDesc.sLeft + 99; + VideoOverlayDesc.sBottom = VideoOverlayDesc.sTop + 98; + VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; + VideoOverlayDesc.sY = VideoOverlayDesc.sTop; VideoOverlayDesc.BltCallback = RenderFaceOverlay; - iFaceOverlay = RegisterVideoOverlay( 0, &VideoOverlayDesc ); + iFaceOverlay = RegisterVideoOverlay( 0, &VideoOverlayDesc ); gpCurrentTalkingFace->iVideoOverlay = iFaceOverlay; RenderAutoFace( iFaceIndex ); @@ -2189,8 +2195,8 @@ void HandleTacticalSpeechUI( UINT8 ubCharacterNum, INT32 iFaceIndex ) fExternFaceBoxRegionCreated = TRUE; //Define main region - MSYS_DefineRegion( &gFacePopupMouseRegion, VideoOverlayDesc.sLeft, VideoOverlayDesc.sTop, VideoOverlayDesc.sRight, VideoOverlayDesc.sBottom, MSYS_PRIORITY_HIGHEST, - CURSOR_NORMAL, MSYS_NO_CALLBACK, FaceOverlayClickCallback ); + MSYS_DefineRegion( &gFacePopupMouseRegion, VideoOverlayDesc.sLeft, VideoOverlayDesc.sTop, VideoOverlayDesc.sRight, VideoOverlayDesc.sBottom, MSYS_PRIORITY_HIGHEST, + CURSOR_NORMAL, MSYS_NO_CALLBACK, FaceOverlayClickCallback ); // Add region MSYS_AddRegion(&(gFacePopupMouseRegion) ); } @@ -2264,14 +2270,14 @@ void HandleDialogueEnd( FACETYPE *pFace ) } - if ( gGameSettings.fOptions[ TOPTION_SUBTITLES ] || !pFace->fValidSpeech ) + if ( gGameSettings.fOptions[ TOPTION_SUBTITLES ] || !pFace->fValidSpeech ) { switch( gbUIHandlerID ) { case DIALOGUE_TACTICAL_UI: case DIALOGUE_EXTERNAL_NPC_UI: // Remove if created - // 0verhaul: Both of these events are more or less independent. Most often the gTextBoxOverlay fails to init. + // 0verhaul: Both of these events are more or less independent. Most often the gTextBoxOverlay fails to init. // Therefore I am removing the dependency on giTextBoxOverlay before it decides to destroy the popup box region. // This should prevent blockage of buttons and also clicks on the tactical map. if ( giTextBoxOverlay != -1 ) @@ -2283,7 +2289,7 @@ void HandleDialogueEnd( FACETYPE *pFace ) if ( fTextBoxMouseRegionCreated ) { RemoveMercPopupBoxFromIndex( iDialogueBox ); - + // reset box id iDialogueBox = -1; MSYS_RemoveRegion( &gTextBoxMouseRegion ); @@ -2294,13 +2300,13 @@ void HandleDialogueEnd( FACETYPE *pFace ) case DIALOGUE_NPC_UI: - + // Remove region if ( gTalkPanel.fTextRegionOn ) { MSYS_RemoveRegion(&(gTalkPanel.TextRegion) ); gTalkPanel.fTextRegionOn = FALSE; - + } // WANNE: This check is used, to prevent scrolling in small maps (e.g: Rebel Basement) in higher resolution (1024x768) [2007-05-14] @@ -2322,15 +2328,15 @@ void HandleDialogueEnd( FACETYPE *pFace ) case DIALOGUE_SPECK_CONTACT_PAGE_UI: break; - + } } - TurnOffSectorLocator(); + TurnOffSectorLocator(); - gsExternPanelXPosition = DEFAULT_EXTERN_PANEL_X_POS; - gsExternPanelYPosition = DEFAULT_EXTERN_PANEL_Y_POS; + gsExternPanelXPosition = DEFAULT_EXTERN_PANEL_X_POS; + gsExternPanelYPosition = DEFAULT_EXTERN_PANEL_Y_POS; } @@ -2339,7 +2345,7 @@ void HandleDialogueEnd( FACETYPE *pFace ) void RenderFaceOverlay( VIDEO_OVERLAY *pBlitter ) { UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; - UINT8 *pDestBuf, *pSrcBuf; + UINT8 *pDestBuf, *pSrcBuf; INT16 sFontX, sFontY; SOLDIERTYPE *pSoldier; CHAR16 zTownIDString[50]; @@ -2354,8 +2360,8 @@ void RenderFaceOverlay( VIDEO_OVERLAY *pBlitter ) { pSoldier = FindSoldierByProfileID( gpCurrentTalkingFace->ubCharacterNum, FALSE ); - - // a living soldier?..or external NPC?..choose panel based on this + + // a living soldier?..or external NPC?..choose panel based on this if( pSoldier ) { BltVideoObjectFromIndex( pBlitter->uiDestBuff, guiCOMPANEL, 0, pBlitter->sX, pBlitter->sY, VO_BLT_SRCTRANSPARENCY, NULL ); @@ -2372,14 +2378,14 @@ void RenderFaceOverlay( VIDEO_OVERLAY *pBlitter ) if ( pSoldier ) { - //reset the font dest buffer - SetFontDestBuffer( pBlitter->uiDestBuff, 0,0,SCREEN_WIDTH,SCREEN_HEIGHT, FALSE); + //reset the font dest buffer + SetFontDestBuffer( pBlitter->uiDestBuff, 0,0,SCREEN_WIDTH,SCREEN_HEIGHT, FALSE); VarFindFontCenterCoordinates( (INT16)( pBlitter->sX + 12 ), (INT16)( pBlitter->sY + 55 ), 73, 9, BLOCKFONT2, &sFontX, &sFontY, L"%s", pSoldier->name ); mprintf( sFontX, sFontY, L"%s", pSoldier->name ); - + // What sector are we in, ( and is it the same as ours? ) - if ( pSoldier->sSectorX != gWorldSectorX || pSoldier->sSectorY != gWorldSectorY || pSoldier->bSectorZ != gbWorldSectorZ || pSoldier->fBetweenSectors ) + if ( pSoldier->sSectorX != gWorldSectorX || pSoldier->sSectorY != gWorldSectorY || pSoldier->bSectorZ != gbWorldSectorZ || pSoldier->flags.fBetweenSectors ) { GetSectorIDString( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ, zTownIDString, FALSE ); @@ -2389,13 +2395,13 @@ void RenderFaceOverlay( VIDEO_OVERLAY *pBlitter ) mprintf( sFontX, sFontY, L"%s", zTownIDString ); } - //reset the font dest buffer - SetFontDestBuffer(FRAME_BUFFER, 0,0,SCREEN_WIDTH,SCREEN_HEIGHT, FALSE); + //reset the font dest buffer + SetFontDestBuffer(FRAME_BUFFER, 0,0,SCREEN_WIDTH,SCREEN_HEIGHT, FALSE); - // Display bars - DrawLifeUIBarEx( pSoldier, (INT16)( pBlitter->sX + 69 ), (INT16)( pBlitter->sY + 47 ), 3, 42, FALSE, pBlitter->uiDestBuff ); - DrawBreathUIBarEx( pSoldier, (INT16)( pBlitter->sX + 75 ), (INT16)( pBlitter->sY + 47 ), 3, 42, FALSE, pBlitter->uiDestBuff ); - DrawMoraleUIBarEx( pSoldier, (INT16)( pBlitter->sX + 81 ), (INT16)( pBlitter->sY + 47 ), 3, 42, FALSE, pBlitter->uiDestBuff ); + // Display bars + DrawLifeUIBarEx( pSoldier, (INT16)( pBlitter->sX + 69 ), (INT16)( pBlitter->sY + 47 ), 3, 42, FALSE, pBlitter->uiDestBuff ); + DrawBreathUIBarEx( pSoldier, (INT16)( pBlitter->sX + 75 ), (INT16)( pBlitter->sY + 47 ), 3, 42, FALSE, pBlitter->uiDestBuff ); + DrawMoraleUIBarEx( pSoldier, (INT16)( pBlitter->sX + 81 ), (INT16)( pBlitter->sY + 47 ), 3, 42, FALSE, pBlitter->uiDestBuff ); } else @@ -2412,10 +2418,10 @@ void RenderFaceOverlay( VIDEO_OVERLAY *pBlitter ) pDestBuf = LockVideoSurface( pBlitter->uiDestBuff, &uiDestPitchBYTES); pSrcBuf = LockVideoSurface( gpCurrentTalkingFace->uiAutoDisplayBuffer, &uiSrcPitchBYTES); - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - (INT16)( pBlitter->sX + 14 ), (INT16)( pBlitter->sY + 6 ), - 0 , 0, + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + (INT16)( pBlitter->sX + 14 ), (INT16)( pBlitter->sY + 6 ), + 0 , 0, gpCurrentTalkingFace->usFaceWidth, gpCurrentTalkingFace->usFaceHeight ); UnLockVideoSurface( pBlitter->uiDestBuff ); @@ -2430,7 +2436,7 @@ void RenderSubtitleBoxOverlay( VIDEO_OVERLAY *pBlitter ) { if ( giTextBoxOverlay != -1 ) { - RenderMercPopUpBoxFromIndex( iDialogueBox, pBlitter->sX, pBlitter->sY, pBlitter->uiDestBuff ); + RenderMercPopUpBoxFromIndex( iDialogueBox, pBlitter->sX, pBlitter->sY, pBlitter->uiDestBuff ); InvalidateRegion( pBlitter->sX, pBlitter->sY, pBlitter->sX + gusSubtitleBoxWidth, pBlitter->sY + gusSubtitleBoxHeight ); } @@ -2448,20 +2454,20 @@ void SayQuoteFromAnyBodyInSector( UINT16 usQuoteNum ) // Loop through all our guys and randomly say one from someone in our sector // set up soldier ptr as first element in mercptrs list - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) { // Add guy if he's a candidate... - if ( OK_INSECTOR_MERC( pTeamSoldier ) && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->fMercAsleep ) + if ( OK_INSECTOR_MERC( pTeamSoldier ) && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->flags.fMercAsleep ) { if ( gTacticalStatus.bNumFoughtInBattle[ ENEMY_TEAM ] == 0 ) { // quotes referring to Deidranna's men so we skip quote if there were no army guys fought if ( (usQuoteNum == QUOTE_SECTOR_SAFE) && (pTeamSoldier->ubProfile == IRA || pTeamSoldier->ubProfile == MIGUEL || pTeamSoldier->ubProfile == SHANK ) ) { - + continue; } if ( (usQuoteNum == QUOTE_ENEMY_PRESENCE ) && (pTeamSoldier->ubProfile == IRA || pTeamSoldier->ubProfile == DIMITRI || pTeamSoldier->ubProfile == DYNAMO || pTeamSoldier->ubProfile == SHANK ) ) @@ -2490,7 +2496,7 @@ void SayQuoteFromAnyBodyInSector( UINT16 usQuoteNum ) ubChosenMerc = (UINT8)cnt; break; } - } + } } @@ -2511,7 +2517,7 @@ void SayQuoteFromAnyBodyInThisSector( INT16 sSectorX, INT16 sSectorY, INT8 bSect // Loop through all our guys and randomly say one from someone in our sector // set up soldier ptr as first element in mercptrs list - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) @@ -2519,7 +2525,7 @@ void SayQuoteFromAnyBodyInThisSector( INT16 sSectorX, INT16 sSectorY, INT8 bSect if ( pTeamSoldier->bActive ) { // Add guy if he's a candidate... - if( pTeamSoldier->sSectorX == sSectorX && pTeamSoldier->sSectorY == sSectorY && pTeamSoldier -> bSectorZ == bSectorZ && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->fMercAsleep ) + if( pTeamSoldier->sSectorX == sSectorX && pTeamSoldier->sSectorY == sSectorY && pTeamSoldier->bSectorZ == bSectorZ && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->flags.fMercAsleep ) { ubMercsInSector[ ubNumMercs ] = (UINT8)cnt; ubNumMercs++; @@ -2544,7 +2550,7 @@ void SayQuoteFromAnyBodyInThisSector( INT16 sSectorX, INT16 sSectorY, INT8 bSect // ubChosenMerc = (UINT8)cnt; // break; // } - // } + // } //} @@ -2563,13 +2569,13 @@ void SayQuoteFromNearbyMercInSector( INT16 sGridNo, INT8 bDistance, UINT16 usQuo // Loop through all our guys and randomly say one from someone in our sector // set up soldier ptr as first element in mercptrs list - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) { // Add guy if he's a candidate... - if ( OK_INSECTOR_MERC( pTeamSoldier ) && PythSpacesAway( sGridNo, pTeamSoldier->sGridNo ) < bDistance && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->fMercAsleep && + if ( OK_INSECTOR_MERC( pTeamSoldier ) && PythSpacesAway( sGridNo, pTeamSoldier->sGridNo ) < bDistance && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->flags.fMercAsleep && SoldierTo3DLocationLineOfSightTest( pTeamSoldier, sGridNo, 0, 0, TRUE ) ) { if ( usQuoteNum == 66 && (INT8) Random( 100 ) > EffectiveWisdom( pTeamSoldier ) ) @@ -2607,13 +2613,13 @@ void SayQuote58FromNearbyMercInSector( INT16 sGridNo, INT8 bDistance, UINT16 usQ // Loop through all our guys and randomly say one from someone in our sector // set up soldier ptr as first element in mercptrs list - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) { // Add guy if he's a candidate... - if ( OK_INSECTOR_MERC( pTeamSoldier ) && PythSpacesAway( sGridNo, pTeamSoldier->sGridNo ) < bDistance && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->fMercAsleep && + if ( OK_INSECTOR_MERC( pTeamSoldier ) && PythSpacesAway( sGridNo, pTeamSoldier->sGridNo ) < bDistance && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->flags.fMercAsleep && SoldierTo3DLocationLineOfSightTest( pTeamSoldier, sGridNo, 0, 0, TRUE ) ) { // ATE: This is to check gedner for this quote... @@ -2653,7 +2659,7 @@ void TextOverlayClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP && fLButtonDown ) { - if( gpCurrentTalkingFace != NULL ) + if( gpCurrentTalkingFace != NULL ) { InternalShutupaYoFace( gpCurrentTalkingFace->iID, FALSE ); @@ -2683,7 +2689,7 @@ void FaceOverlayClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP && fLButtonDown ) { - if( gpCurrentTalkingFace != NULL ) + if( gpCurrentTalkingFace != NULL ) { InternalShutupaYoFace( gpCurrentTalkingFace->iID, FALSE ); } @@ -2705,7 +2711,7 @@ void ShutDownLastQuoteTacticalTextBox( void ) if ( fTextBoxMouseRegionCreated ) { MSYS_RemoveRegion( &gTextBoxMouseRegion ); - fTextBoxMouseRegionCreated = FALSE; + fTextBoxMouseRegionCreated = FALSE; } fDialogueBoxDueToLastMessage = FALSE; @@ -2840,7 +2846,7 @@ BOOLEAN IsQuoteInPrecedentArray( UINT32 uiQuoteID ) UINT8 ubCnt; //If the quote id is above or below the ones in the array - if( uiQuoteID < gubMercValidPrecedentQuoteID[ 0 ] || + if( uiQuoteID < gubMercValidPrecedentQuoteID[ 0 ] || uiQuoteID > gubMercValidPrecedentQuoteID[ NUMBER_VALID_MERC_PRECEDENT_QUOTES-1 ] ) { return( FALSE ); @@ -2879,7 +2885,7 @@ UINT8 GetQuoteBitNumberFromQuoteID( UINT32 uiQuoteID ) void HandleShutDownOfMapScreenWhileExternfaceIsTalking( void ) { - + if ( ( fExternFaceBoxRegionCreated ) && ( gpCurrentTalkingFace) ) { RemoveVideoOverlay( gpCurrentTalkingFace->iVideoOverlay ); @@ -2892,7 +2898,7 @@ void HandleShutDownOfMapScreenWhileExternfaceIsTalking( void ) void HandleImportantMercQuote( SOLDIERTYPE * pSoldier, UINT16 usQuoteNumber ) { // wake merc up for THIS quote - if( pSoldier->fMercAsleep ) + if( pSoldier->flags.fMercAsleep ) { TacticalCharacterDialogueWithSpecialEvent( pSoldier, usQuoteNumber, DIALOGUE_SPECIAL_EVENT_SLEEP, 0,0 ); TacticalCharacterDialogue( pSoldier, usQuoteNumber ); @@ -2922,6 +2928,6 @@ void UnPauseDialogueQueue( void ) void SetExternMapscreenSpeechPanelXY( INT16 sXPos, INT16 sYPos ) { - gsExternPanelXPosition = sXPos; - gsExternPanelYPosition = sYPos; + gsExternPanelXPosition = sXPos; + gsExternPanelYPosition = sYPos; } diff --git a/Tactical/Dialogue Control.h b/Tactical/Dialogue Control.h index 47150f69..f2eb88e0 100644 --- a/Tactical/Dialogue Control.h +++ b/Tactical/Dialogue Control.h @@ -158,15 +158,15 @@ enum DialogQuoteIDs } ; -#define DEFAULT_EXTERN_PANEL_X_POS 320 -#define DEFAULT_EXTERN_PANEL_Y_POS 40 +#define DEFAULT_EXTERN_PANEL_X_POS 320 +#define DEFAULT_EXTERN_PANEL_Y_POS 40 #define DIALOGUE_TACTICAL_UI 1 #define DIALOGUE_CONTACTPAGE_UI 2 #define DIALOGUE_NPC_UI 3 #define DIALOGUE_SPECK_CONTACT_PAGE_UI 4 -#define DIALOGUE_EXTERNAL_NPC_UI 5 +#define DIALOGUE_EXTERNAL_NPC_UI 5 #define DIALOGUE_SHOPKEEPER_UI 6 @@ -175,15 +175,15 @@ enum DialogQuoteIDs #define DIALOGUE_SPECIAL_EVENT_GOTO_GRIDNO 0x00000004 #define DIALOGUE_SPECIAL_EVENT_DO_ACTION 0x00000008 #define DIALOGUE_SPECIAL_EVENT_CLOSE_PANEL 0x00000010 -#define DIALOGUE_SPECIAL_EVENT_PCTRIGGERNPC 0x00000020 -#define DIALOGUE_SPECIAL_EVENT_BEGINPREBATTLEINTERFACE 0x00000040 +#define DIALOGUE_SPECIAL_EVENT_PCTRIGGERNPC 0x00000020 +#define DIALOGUE_SPECIAL_EVENT_BEGINPREBATTLEINTERFACE 0x00000040 #define DIALOGUE_SPECIAL_EVENT_SKYRIDERMAPSCREENEVENT 0x00000080 -#define DIALOGUE_SPECIAL_EVENT_SHOW_CONTRACT_MENU 0x00000100 +#define DIALOGUE_SPECIAL_EVENT_SHOW_CONTRACT_MENU 0x00000100 #define DIALOGUE_SPECIAL_EVENT_MINESECTOREVENT 0x00000200 -#define DIALOGUE_SPECIAL_EVENT_SHOW_UPDATE_MENU 0x00000400 +#define DIALOGUE_SPECIAL_EVENT_SHOW_UPDATE_MENU 0x00000400 #define DIALOGUE_SPECIAL_EVENT_ENABLE_AI 0x00000800 #define DIALOGUE_SPECIAL_EVENT_USE_ALTERNATE_FILES 0x00001000 -#define DIALOGUE_SPECIAL_EVENT_CONTINUE_TRAINING_MILITIA 0x00002000 +#define DIALOGUE_SPECIAL_EVENT_CONTINUE_TRAINING_MILITIA 0x00002000 #define DIALOGUE_SPECIAL_EVENT_CONTRACT_ENDING 0x00004000 #define DIALOGUE_SPECIAL_EVENT_MULTIPURPOSE 0x00008000 #define DIALOGUE_SPECIAL_EVENT_SLEEP 0x00010000 diff --git a/Tactical/DisplayCover.cpp b/Tactical/DisplayCover.cpp index 297b2e1f..9cf2ef1f 100644 --- a/Tactical/DisplayCover.cpp +++ b/Tactical/DisplayCover.cpp @@ -9,7 +9,7 @@ #include "builddefines.h" #include "Types.h" #include "Isometric Utils.h" -#include "Soldier Control.h" +//#include "Soldier Control.h" #include "Overhead.h" #include "displaycover.h" #include "Font Control.h" @@ -32,7 +32,12 @@ #include "Render Fun.h" #endif -//******* Local Defines ************************************************** + +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + +//******* Local Defines ************************************************** #define DC_MAX_COVER_RANGE 43 //31 @@ -44,7 +49,7 @@ typedef struct { INT16 sGridNo; - INT8 bCover; //% chance that the gridno is fully covered. ie 100 if safe, 0 is has no cover + INT8 bCover; //% chance that the gridno is fully covered. ie 100 if safe, 0 is has no cover // BOOLEAN fRoof; } BEST_COVER_STRUCT; @@ -59,7 +64,7 @@ typedef struct /* #define DC__PRONE (INT8)( 0x01 ) -#define DC__CROUCH (INT8)( 0x02 ) +#define DC__CROUCH (INT8)( 0x02 ) #define DC__STAND (INT8)( 0x04 ) */ enum @@ -70,7 +75,7 @@ enum DC__SEE_3_STANCE, }; -//****** Global Variables ***************************************** +//****** Global Variables ***************************************** BEST_COVER_STRUCT gCoverRadius[ DC_MAX_COVER_RANGE ][ DC_MAX_COVER_RANGE ]; @@ -82,7 +87,7 @@ INT8 gbLastStance=-1; VISIBLE_TO_SOLDIER_STRUCT gVisibleToSoldierStruct[ DC__SOLDIER_VISIBLE_RANGE ][ DC__SOLDIER_VISIBLE_RANGE ]; INT16 gsLastVisibleToSoldierGridNo=NOWHERE; -//******* Function Prototypes *************************************** +//******* Function Prototypes *************************************** INT8 CalcCoverForGridNoBasedOnTeamKnownEnemies( SOLDIERTYPE *pSoldier, INT16 sTargetGridno, INT8 bStance ); void CalculateCoverInRadiusAroundGridno( INT16 sTargetGridNo, INT8 bSearchRange ); @@ -99,15 +104,15 @@ BOOLEAN IsTheRoofVisible( INT16 sGridNo ); //ppp -//******* Functions ************************************************** +//******* Functions ************************************************** void DisplayCoverOfSelectedGridNo( ) { - UINT16 usGridNo; + INT16 sGridNo; INT8 bStance; - GetMouseMapPos( &usGridNo ); + GetMouseMapPos( &sGridNo ); //Only allowed in if there is someone selected if( gusSelectedSoldier == NOBODY ) @@ -116,13 +121,13 @@ void DisplayCoverOfSelectedGridNo( ) } //if the cursor is in a the tactical map - if( usGridNo != NOWHERE && usGridNo != 0 ) + if( sGridNo != NOWHERE && sGridNo != 0 ) { bStance = GetCurrentMercForDisplayCoverStance(); //if the gridno is different then the last one that was displayed - if( usGridNo != gsLastCoverGridNo || - gbLastStance != bStance || + if( sGridNo != gsLastCoverGridNo || + gbLastStance != bStance || MercPtrs[ gusSelectedSoldier ]->sGridNo != gsLastSoldierGridNo ) { //if the cover is currently being displayed @@ -151,11 +156,11 @@ void DisplayCoverOfSelectedGridNo( ) } gbLastStance = bStance; - gsLastCoverGridNo = usGridNo; + gsLastCoverGridNo = sGridNo; gsLastSoldierGridNo = MercPtrs[ gusSelectedSoldier ]->sGridNo; //Fill the array of gridno and cover values - CalculateCoverInRadiusAroundGridno( usGridNo, gGameSettings.ubSizeOfDisplayCover ); + CalculateCoverInRadiusAroundGridno( sGridNo, gGameSettings.ubSizeOfDisplayCover ); //Add the graphics to each gridno AddCoverTileToEachGridNo(); @@ -181,35 +186,35 @@ void AddCoverTileToEachGridNo() if( gCoverRadius[ uiCntX ][ uiCntY ].bCover != -1 ) { //if the tile provides 80-100% cover - if( gCoverRadius[ uiCntX ][ uiCntY ].bCover <= 100 && + if( gCoverRadius[ uiCntX ][ uiCntY ].bCover <= 100 && gCoverRadius[ uiCntX ][ uiCntY ].bCover > 80 ) { AddCoverObjectToWorld( gCoverRadius[ uiCntX ][ uiCntY ].sGridNo, SPECIALTILE_COVER_5, fRoof ); } //else if the tile provides 60-80% cover - else if( gCoverRadius[ uiCntX ][ uiCntY ].bCover <= 80 && + else if( gCoverRadius[ uiCntX ][ uiCntY ].bCover <= 80 && gCoverRadius[ uiCntX ][ uiCntY ].bCover > 60 ) { AddCoverObjectToWorld( gCoverRadius[ uiCntX ][ uiCntY ].sGridNo, SPECIALTILE_COVER_4, fRoof ); } //else if the tile provides 40-60% cover - else if( gCoverRadius[ uiCntX ][ uiCntY ].bCover <= 60 && + else if( gCoverRadius[ uiCntX ][ uiCntY ].bCover <= 60 && gCoverRadius[ uiCntX ][ uiCntY ].bCover > 40 ) { AddCoverObjectToWorld( gCoverRadius[ uiCntX ][ uiCntY ].sGridNo, SPECIALTILE_COVER_3, fRoof ); } //else if the tile provides 20-40% cover - else if( gCoverRadius[ uiCntX ][ uiCntY ].bCover <= 40 && + else if( gCoverRadius[ uiCntX ][ uiCntY ].bCover <= 40 && gCoverRadius[ uiCntX ][ uiCntY ].bCover > 20 ) { AddCoverObjectToWorld( gCoverRadius[ uiCntX ][ uiCntY ].sGridNo, SPECIALTILE_COVER_2, fRoof ); } //else if the tile provides 0-20% cover - else if( gCoverRadius[ uiCntX ][ uiCntY ].bCover <= 20 && + else if( gCoverRadius[ uiCntX ][ uiCntY ].bCover <= 20 && gCoverRadius[ uiCntX ][ uiCntY ].bCover >= 0 ) { AddCoverObjectToWorld( gCoverRadius[ uiCntX ][ uiCntY ].sGridNo, SPECIALTILE_COVER_1, fRoof ); @@ -247,35 +252,35 @@ void RemoveCoverOfSelectedGridNo() // fRoof = gCoverRadius[ uiCntX ][ uiCntY ].fRoof; //if the tile provides 80-100% cover - if( gCoverRadius[ uiCntX ][ uiCntY ].bCover <= 100 && + if( gCoverRadius[ uiCntX ][ uiCntY ].bCover <= 100 && gCoverRadius[ uiCntX ][ uiCntY ].bCover > 80 ) { RemoveCoverObjectFromWorld( gCoverRadius[ uiCntX ][ uiCntY ].sGridNo, SPECIALTILE_COVER_5, fRoof ); } //else if the tile provides 60-80% cover - else if( gCoverRadius[ uiCntX ][ uiCntY ].bCover <= 80 && + else if( gCoverRadius[ uiCntX ][ uiCntY ].bCover <= 80 && gCoverRadius[ uiCntX ][ uiCntY ].bCover > 60 ) { RemoveCoverObjectFromWorld( gCoverRadius[ uiCntX ][ uiCntY ].sGridNo, SPECIALTILE_COVER_4, fRoof ); } //else if the tile provides 40-60% cover - else if( gCoverRadius[ uiCntX ][ uiCntY ].bCover <= 60 && + else if( gCoverRadius[ uiCntX ][ uiCntY ].bCover <= 60 && gCoverRadius[ uiCntX ][ uiCntY ].bCover > 40 ) { RemoveCoverObjectFromWorld( gCoverRadius[ uiCntX ][ uiCntY ].sGridNo, SPECIALTILE_COVER_3, fRoof ); } //else if the tile provides 20-40% cover - else if( gCoverRadius[ uiCntX ][ uiCntY ].bCover <= 40 && + else if( gCoverRadius[ uiCntX ][ uiCntY ].bCover <= 40 && gCoverRadius[ uiCntX ][ uiCntY ].bCover > 20 ) { RemoveCoverObjectFromWorld( gCoverRadius[ uiCntX ][ uiCntY ].sGridNo, SPECIALTILE_COVER_2, fRoof ); } //else if the tile provides 0-20% cover - else if( gCoverRadius[ uiCntX ][ uiCntY ].bCover <= 20 && + else if( gCoverRadius[ uiCntX ][ uiCntY ].bCover <= 20 && gCoverRadius[ uiCntX ][ uiCntY ].bCover >= 0 ) { RemoveCoverObjectFromWorld( gCoverRadius[ uiCntX ][ uiCntY ].sGridNo, SPECIALTILE_COVER_1, fRoof ); @@ -292,8 +297,8 @@ void RemoveCoverOfSelectedGridNo() // Re-render the scene! SetRenderFlags( RENDER_FLAG_FULL ); - - gsLastCoverGridNo = NOWHERE; + + gsLastCoverGridNo = NOWHERE; gbLastStance = -1; gsLastSoldierGridNo = NOWHERE; } @@ -325,11 +330,11 @@ void CalculateCoverInRadiusAroundGridno( INT16 sTargetGridNo, INT8 bSearchRange bSearchRange = ( DC_MAX_COVER_RANGE / 2 ); // determine maximum horizontal limits - sMaxLeft = min( bSearchRange,( sTargetGridNo % MAXCOL )); + sMaxLeft = min( bSearchRange,( sTargetGridNo % MAXCOL )); sMaxRight = min( bSearchRange,MAXCOL - (( sTargetGridNo % MAXCOL ) + 1)); // determine maximum vertical limits - sMaxUp = min( bSearchRange,( sTargetGridNo / MAXROW )); + sMaxUp = min( bSearchRange,( sTargetGridNo / MAXROW )); sMaxDown = min( bSearchRange,MAXROW - (( sTargetGridNo / MAXROW ) + 1)); @@ -428,42 +433,42 @@ INT8 CalcCoverForGridNoBasedOnTeamKnownEnemies( SOLDIERTYPE *pSoldier, INT16 sTa UINT16 usMaxRange; UINT16 usRange; - //loop through all the enemies and determine the cover + //loop through all the enemies and determine the cover for (uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++) { pOpponent = MercSlots[ uiLoop ]; // if this merc is inactive, at base, on assignment, dead, unconscious - if (!pOpponent || pOpponent->bLife < OKLIFE) + if (!pOpponent || pOpponent->stats.bLife < OKLIFE) { - continue; // next merc + continue; // next merc } // if this man is neutral / on the same side, he's not an opponent if( CONSIDERED_NEUTRAL( pSoldier, pOpponent ) || (pSoldier->bSide == pOpponent->bSide)) { - continue; // next merc + continue; // next merc } - pbPersOL = pSoldier->bOppList + pOpponent->ubID; + pbPersOL = pSoldier->aiData.bOppList + pOpponent->ubID; pbPublOL = gbPublicOpplist[ OUR_TEAM ] + pOpponent->ubID; // if this opponent is unknown personally and publicly - if( *pbPersOL != SEEN_CURRENTLY && - *pbPersOL != SEEN_THIS_TURN && - *pbPublOL != SEEN_CURRENTLY && + if( *pbPersOL != SEEN_CURRENTLY && + *pbPersOL != SEEN_THIS_TURN && + *pbPublOL != SEEN_CURRENTLY && *pbPublOL != SEEN_THIS_TURN ) { - continue; // next merc + continue; // next merc } // if actual LOS check fails, then chance to hit is 0, ignore this guy - if( SoldierToVirtualSoldierLineOfSightTest( pOpponent, sTargetGridNo, pSoldier->bLevel, bStance, TRUE, CALC_FROM_WANTED_DIR ) == 0 ) + if( SoldierToVirtualSoldierLineOfSightTest( pOpponent, sTargetGridNo, pSoldier->pathing.bLevel, bStance, TRUE, CALC_FROM_WANTED_DIR ) == 0 ) { continue; } - iGetThrough = SoldierToLocationChanceToGetThrough( pOpponent, sTargetGridNo, pSoldier->bLevel, bStance, NOBODY ); + iGetThrough = SoldierToLocationChanceToGetThrough( pOpponent, sTargetGridNo, pSoldier->pathing.bLevel, bStance, NOBODY ); // iBulletGetThrough = CalcChanceToHitGun( pOpponent, sTargetGridNo, AP_MAX_AIM_ATTACK, AIM_SHOT_TORSO ); if( WeaponInHand( pOpponent ) ) @@ -523,7 +528,7 @@ void AddCoverObjectToWorld( INT16 sGridNo, UINT16 usGraphic, BOOLEAN fRoof ) } else { - AddObjectToHead( sGridNo, usGraphic ); + AddObjectToHead( sGridNo, usGraphic ); pNode = gpWorldLevelData[ sGridNo ].pObjectHead; } @@ -545,7 +550,7 @@ void RemoveCoverObjectFromWorld( INT16 sGridNo, UINT16 usGraphic, BOOLEAN fRoof } else { - RemoveObject( sGridNo, usGraphic ); + RemoveObject( sGridNo, usGraphic ); } } @@ -630,7 +635,7 @@ void DisplayRangeToTarget( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ) //AXP 30.03.2007: Fix CtH calculation for first shot after changing aim level (roof/ground) INT8 bTempTargetLevel = pSoldier->bTargetLevel; pSoldier->bTargetLevel = (INT8)gsInterfaceLevel; - uiHitChance = CalcChanceToHitGun( pSoldier, sTargetGridNo, (INT8)(pSoldier->bShownAimTime ), pSoldier->bAimShotLocation ); + uiHitChance = CalcChanceToHitGun( pSoldier, sTargetGridNo, (INT8)(pSoldier->aiData.bShownAimTime ), pSoldier->bAimShotLocation ); pSoldier->bTargetLevel = bTempTargetLevel; swprintf( zOutputString, zNewTacticalMessages[ TCTL_MSG__GUN_RANGE_AND_CTH ], Weapon[ pSoldier->inv[HANDPOS].usItem ].usRange / 10, uiHitChance ); @@ -641,8 +646,8 @@ void DisplayRangeToTarget( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ) //if the target is out of the mercs gun range or knife - if( !InRange( pSoldier, sTargetGridNo ) && - ( Item[ pSoldier->inv[HANDPOS].usItem ].usItemClass == IC_GUN || Item[ pSoldier->inv[HANDPOS].usItem ].usItemClass == IC_THROWING_KNIFE ) ) + if( !InRange( pSoldier, sTargetGridNo ) && + ( Item[ pSoldier->inv[HANDPOS].usItem ].usItemClass == IC_GUN || Item[ pSoldier->inv[HANDPOS].usItem ].usItemClass == IC_THROWING_KNIFE ) ) { // Display a warning saying so ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ OUT_OF_RANGE_STRING ] ); @@ -656,10 +661,10 @@ void DisplayRangeToTarget( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ) void DisplayGridNoVisibleToSoldierGrid( ) { - UINT16 usGridNo; + INT16 sGridNo; // INT8 bStance; - GetMouseMapPos( &usGridNo ); + GetMouseMapPos( &sGridNo ); //Only allowed in if there is someone selected if( gusSelectedSoldier == NOBODY ) @@ -668,10 +673,10 @@ void DisplayGridNoVisibleToSoldierGrid( ) } //if the cursor is in a the tactical map - if( usGridNo != NOWHERE && usGridNo != 0 ) + if( sGridNo != NOWHERE && sGridNo != 0 ) { //if the gridno is different then the last one that was displayed - if( usGridNo != gsLastVisibleToSoldierGridNo || MercPtrs[ gusSelectedSoldier ]->sGridNo != gsLastSoldierGridNo ) + if( sGridNo != gsLastVisibleToSoldierGridNo || MercPtrs[ gusSelectedSoldier ]->sGridNo != gsLastSoldierGridNo ) { //if the cover is currently being displayed if( gsLastVisibleToSoldierGridNo != NOWHERE || gsLastSoldierGridNo != NOWHERE ) @@ -695,12 +700,12 @@ void DisplayGridNoVisibleToSoldierGrid( ) //gJa25SaveStruct.uiDisplayLosCounter++; } - gsLastVisibleToSoldierGridNo = usGridNo; + gsLastVisibleToSoldierGridNo = sGridNo; gsLastSoldierGridNo = MercPtrs[ gusSelectedSoldier ]->sGridNo; //Fill the array of gridno and cover values - CalculateVisibleToSoldierAroundGridno( usGridNo, gGameSettings.ubSizeOfLOS ); + CalculateVisibleToSoldierAroundGridno( sGridNo, gGameSettings.ubSizeOfLOS ); //Add the graphics to each gridno AddVisibleToSoldierToEachGridNo(); @@ -728,11 +733,11 @@ void CalculateVisibleToSoldierAroundGridno( INT16 sTargetGridNo, INT8 bSearchRan // determine maximum horizontal limits - sMaxLeft = min( bSearchRange,( sTargetGridNo % MAXCOL )); + sMaxLeft = min( bSearchRange,( sTargetGridNo % MAXCOL )); sMaxRight = min( bSearchRange,MAXCOL - (( sTargetGridNo % MAXCOL ) + 1)); // determine maximum vertical limits - sMaxUp = min( bSearchRange,( sTargetGridNo / MAXROW )); + sMaxUp = min( bSearchRange,( sTargetGridNo / MAXROW )); sMaxDown = min( bSearchRange,MAXROW - (( sTargetGridNo / MAXROW ) + 1)); pSoldier = GetCurrentMercForDisplayCover(); @@ -750,7 +755,7 @@ void CalculateVisibleToSoldierAroundGridno( INT16 sTargetGridNo, INT8 bSearchRan fRoof = FALSE; //record the gridno - gVisibleToSoldierStruct[ sCounterX ][ sCounterY ].sGridNo = sGridNo; + gVisibleToSoldierStruct[ sCounterX ][ sCounterY ].sGridNo = sGridNo; //if the gridno is NOT on screen if( !GridNoOnScreen( sGridNo ) ) @@ -773,7 +778,7 @@ void CalculateVisibleToSoldierAroundGridno( INT16 sTargetGridNo, INT8 bSearchRan } } -/* +/* //if we are to display cover for the roofs, and there is a roof above us if( gsInterfaceLevel == I_ROOF_LEVEL && !FlatRoofAboveGridNo( sGridNo ) ) { @@ -829,7 +834,7 @@ void AddVisibleToSoldierToEachGridNo() fRoof = gVisibleToSoldierStruct[ uiCntX ][ uiCntY ].fRoof; sGridNo = gVisibleToSoldierStruct[ uiCntX ][ uiCntY ].sGridNo; - //if the soldier can easily see this gridno. Can see all 3 positions + //if the soldier can easily see this gridno. Can see all 3 positions if( bVisibleToSoldier == DC__SEE_3_STANCE ) { AddCoverObjectToWorld( sGridNo, SPECIALTILE_COVER_5, fRoof ); @@ -917,8 +922,8 @@ void RemoveVisibleGridNoAtSelectedGridNo() // Re-render the scene! SetRenderFlags( RENDER_FLAG_FULL ); - - gsLastVisibleToSoldierGridNo = NOWHERE; + + gsLastVisibleToSoldierGridNo = NOWHERE; gsLastSoldierGridNo = NOWHERE; } @@ -928,7 +933,7 @@ INT8 CalcIfSoldierCanSeeGridNo( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOL INT8 bRetVal=0; INT32 iLosForGridNo=0; UINT16 usSightLimit=0; - INT8 *pPersOL,*pbPublOL; + INT8 *pPersOL,*pbPublOL; UINT8 ubID; BOOLEAN bAware=FALSE; @@ -943,13 +948,13 @@ INT8 CalcIfSoldierCanSeeGridNo( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOL if( ubID != NOBODY ) { - pPersOL = &(pSoldier->bOppList[ubID]); + pPersOL = &(pSoldier->aiData.bOppList[ubID]); pbPublOL = &(gbPublicOpplist[pSoldier->bTeam][ubID]); - // if soldier is known about (SEEN or HEARD within last few turns) + // if soldier is known about (SEEN or HEARD within last few turns) if (*pPersOL || *pbPublOL) { - bAware = TRUE; + bAware = TRUE; } } diff --git a/Tactical/Drugs And Alcohol.cpp b/Tactical/Drugs And Alcohol.cpp index 254c216e..d9e6f78a 100644 --- a/Tactical/Drugs And Alcohol.cpp +++ b/Tactical/Drugs And Alcohol.cpp @@ -2,7 +2,7 @@ #include "Tactical All.h" #else #include "sgp.h" - #include "soldier control.h" + //#include "soldier control.h" #include "soldier profile.h" #include "drugs and alcohol.h" #include "items.h" @@ -15,6 +15,11 @@ #include "Interface.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + UINT8 ubDrugTravelRate[] = { 4, 2 }; UINT8 ubDrugWearoffRate[] = { 2, 2 }; UINT8 ubDrugEffect[] = { 15, 8 }; @@ -55,7 +60,7 @@ UINT8 GetDrugType( UINT16 usItem ) return( NO_DRUG ); } - + BOOLEAN ApplyDrugs( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject ) { UINT8 ubDrugType; @@ -89,11 +94,11 @@ BOOLEAN ApplyDrugs( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject ) { // Add effects - if ( ( pSoldier->bFutureDrugEffect[ ubDrugType ] + ubDrugEffect[ ubDrugType ] ) < 127 ) + if ( ( pSoldier->drugs.bFutureDrugEffect[ ubDrugType ] + ubDrugEffect[ ubDrugType ] ) < 127 ) { - pSoldier->bFutureDrugEffect[ ubDrugType ] += ubDrugEffect[ ubDrugType ]; + pSoldier->drugs.bFutureDrugEffect[ ubDrugType ] += ubDrugEffect[ ubDrugType ]; } - pSoldier->bDrugEffectRate[ ubDrugType ] = ubDrugTravelRate[ ubDrugType ]; + pSoldier->drugs.bDrugEffectRate[ ubDrugType ] = ubDrugTravelRate[ ubDrugType ]; // Increment times used during lifetime... // CAP! @@ -106,17 +111,17 @@ BOOLEAN ApplyDrugs( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject ) } // Reset once we sleep... - pSoldier->bTimesDrugUsedSinceSleep[ ubDrugType ]++; + pSoldier->drugs.bTimesDrugUsedSinceSleep[ ubDrugType ]++; // Increment side effects.. - if ( ( pSoldier->bDrugSideEffect[ ubDrugType ] + ubDrugSideEffect[ ubDrugType ] ) < 127 ) + if ( ( pSoldier->drugs.bDrugSideEffect[ ubDrugType ] + ubDrugSideEffect[ ubDrugType ] ) < 127 ) { - pSoldier->bDrugSideEffect[ ubDrugType ] += ( ubDrugSideEffect[ ubDrugType ] ); + pSoldier->drugs.bDrugSideEffect[ ubDrugType ] += ( ubDrugSideEffect[ ubDrugType ] ); } // Stop side effects until were done.... - pSoldier->bDrugSideEffectRate[ ubDrugType ] = 0; + pSoldier->drugs.bDrugSideEffectRate[ ubDrugType ] = 0; + - if ( ubDrugType == DRUG_TYPE_ALCOHOL ) { // ATE: use kit points... @@ -138,37 +143,37 @@ BOOLEAN ApplyDrugs( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject ) else { // Remove the object.... - DeleteObj( pObject ); + pObject->RemoveObjectsFromStack(1); // ATE: Make guy collapse from heart attack if too much stuff taken.... - if ( pSoldier->bDrugSideEffectRate[ ubDrugType ] > ( ubDrugSideEffect[ ubDrugType ] * 3 ) ) + if ( pSoldier->drugs.bDrugSideEffectRate[ ubDrugType ] > ( ubDrugSideEffect[ ubDrugType ] * 3 ) ) { // Keel over... DeductPoints( pSoldier, 0, 10000 ); // Permanently lower certain stats... - pSoldier->bWisdom -= 5; - pSoldier->bDexterity -= 5; - pSoldier->bStrength -= 5; + pSoldier->stats.bWisdom -= 5; + pSoldier->stats.bDexterity -= 5; + pSoldier->stats.bStrength -= 5; - if (pSoldier->bWisdom < 1) - pSoldier->bWisdom = 1; - if (pSoldier->bDexterity < 1) - pSoldier->bDexterity = 1; - if (pSoldier->bStrength < 1) - pSoldier->bStrength = 1; + if (pSoldier->stats.bWisdom < 1) + pSoldier->stats.bWisdom = 1; + if (pSoldier->stats.bDexterity < 1) + pSoldier->stats.bDexterity = 1; + if (pSoldier->stats.bStrength < 1) + pSoldier->stats.bStrength = 1; // export stat changes to profile - gMercProfiles[ pSoldier->ubProfile ].bWisdom = pSoldier->bWisdom; - gMercProfiles[ pSoldier->ubProfile ].bDexterity = pSoldier->bDexterity; - gMercProfiles[ pSoldier->ubProfile ].bStrength = pSoldier->bStrength; + gMercProfiles[ pSoldier->ubProfile ].bWisdom = pSoldier->stats.bWisdom; + gMercProfiles[ pSoldier->ubProfile ].bDexterity = pSoldier->stats.bDexterity; + gMercProfiles[ pSoldier->ubProfile ].bStrength = pSoldier->stats.bStrength; // make those stats RED for a while... - pSoldier->uiChangeWisdomTime = GetJA2Clock(); + pSoldier->timeChanges.uiChangeWisdomTime = GetJA2Clock(); pSoldier->usValueGoneUp &= ~( WIS_INCREASE ); - pSoldier->uiChangeDexterityTime = GetJA2Clock(); + pSoldier->timeChanges.uiChangeDexterityTime = GetJA2Clock(); pSoldier->usValueGoneUp &= ~( DEX_INCREASE ); - pSoldier->uiChangeStrengthTime = GetJA2Clock(); + pSoldier->timeChanges.uiChangeStrengthTime = GetJA2Clock(); pSoldier->usValueGoneUp &= ~( STRENGTH_INCREASE ); } } @@ -178,17 +183,17 @@ BOOLEAN ApplyDrugs( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject ) if ( ubDrugType == DRUG_TYPE_REGENERATION ) { // each use of a regen booster over 1, each day, reduces the effect - bRegenPointsGained = REGEN_POINTS_PER_BOOSTER * pObject->ItemData.Generic.bStatus[0] / 100; + bRegenPointsGained = REGEN_POINTS_PER_BOOSTER * (*pObject)[0]->data.objectStatus / 100; // are there fractional %s left over? - if ( ( pObject->ItemData.Generic.bStatus[0] % (100 / REGEN_POINTS_PER_BOOSTER ) ) != 0 ) + if ( ( (*pObject)[0]->data.objectStatus % (100 / REGEN_POINTS_PER_BOOSTER ) ) != 0 ) { // chance of an extra point - if ( PreRandom( 100 / REGEN_POINTS_PER_BOOSTER ) < (UINT32) ( pObject->ItemData.Generic.bStatus[0] % (100 / REGEN_POINTS_PER_BOOSTER ) ) ) + if ( PreRandom( 100 / REGEN_POINTS_PER_BOOSTER ) < (UINT32) ( (*pObject)[0]->data.objectStatus % (100 / REGEN_POINTS_PER_BOOSTER ) ) ) { bRegenPointsGained++; } } - + bRegenPointsGained -= pSoldier->bRegenBoostersUsedToday; if (bRegenPointsGained > 0) { @@ -199,7 +204,7 @@ BOOLEAN ApplyDrugs( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject ) } // remove object - DeleteObj( pObject ); + pObject->RemoveObjectsFromStack(1); } if ( ubDrugType == DRUG_TYPE_ALCOHOL ) @@ -208,12 +213,12 @@ BOOLEAN ApplyDrugs( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject ) } else { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_MERC_TOOK_DRUG ], pSoldier->name ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_MERC_TOOK_DRUG ], pSoldier->name ); } - // Dirty panel - fInterfacePanelDirty = DIRTYLEVEL2; - + // Dirty panel + fInterfacePanelDirty = DIRTYLEVEL2; + return( TRUE ); } @@ -226,40 +231,40 @@ void HandleEndTurnDrugAdjustments( SOLDIERTYPE *pSoldier ) for ( cnt = 0; cnt < NUM_COMPLEX_DRUGS; cnt++ ) { // If side effect aret is non-zero.... - if ( pSoldier->bDrugSideEffectRate[ cnt ] > 0 ) - { + if ( pSoldier->drugs.bDrugSideEffectRate[ cnt ] > 0 ) + { // Subtract some... - pSoldier->bDrugSideEffect[ cnt ] -= pSoldier->bDrugSideEffectRate[ cnt ]; + pSoldier->drugs.bDrugSideEffect[ cnt ] -= pSoldier->drugs.bDrugSideEffectRate[ cnt ]; // If we're done, we're done! - if ( pSoldier->bDrugSideEffect[ cnt ] <= 0 ) + if ( pSoldier->drugs.bDrugSideEffect[ cnt ] <= 0 ) { - pSoldier->bDrugSideEffect[ cnt ] = 0; + pSoldier->drugs.bDrugSideEffect[ cnt ] = 0; fInterfacePanelDirty = DIRTYLEVEL1; } } // IF drug rate is -ve, it's being worn off... - if ( pSoldier->bDrugEffectRate[ cnt ] < 0 ) + if ( pSoldier->drugs.bDrugEffectRate[ cnt ] < 0 ) { - pSoldier->bDrugEffect[ cnt ] -= ( -1 * pSoldier->bDrugEffectRate[ cnt ] ); - - // Have we run out? - if ( pSoldier->bDrugEffect[ cnt ] <= 0 ) - { - pSoldier->bDrugEffect[ cnt ] = 0; + pSoldier->drugs.bDrugEffect[ cnt ] -= ( -1 * pSoldier->drugs.bDrugEffectRate[ cnt ] ); - // Dirty panel - fInterfacePanelDirty = DIRTYLEVEL2; + // Have we run out? + if ( pSoldier->drugs.bDrugEffect[ cnt ] <= 0 ) + { + pSoldier->drugs.bDrugEffect[ cnt ] = 0; + + // Dirty panel + fInterfacePanelDirty = DIRTYLEVEL2; // Start the bad news! - pSoldier->bDrugSideEffectRate[ cnt ] = ubDrugSideEffectRate[ cnt ]; + pSoldier->drugs.bDrugSideEffectRate[ cnt ] = ubDrugSideEffectRate[ cnt ]; // The drug rate is 0 now too - pSoldier->bDrugEffectRate[ cnt ] = 0; + pSoldier->drugs.bDrugEffectRate[ cnt ] = 0; // Once for each 'level' of crash.... - iNumLoops = ( pSoldier->bDrugSideEffect[ cnt ] / ubDrugSideEffect[ cnt ] ) + 1; + iNumLoops = ( pSoldier->drugs.bDrugSideEffect[ cnt ] / ubDrugSideEffect[ cnt ] ) + 1; for ( cnt2 = 0; cnt2 < iNumLoops; cnt2++ ) { @@ -270,28 +275,28 @@ void HandleEndTurnDrugAdjustments( SOLDIERTYPE *pSoldier ) } else { - HandleMoraleEvent( pSoldier, MORALE_DRUGS_CRASH, pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ); + HandleMoraleEvent( pSoldier, MORALE_DRUGS_CRASH, pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ); } } } } // Add increase ineffect.... - if ( pSoldier->bDrugEffectRate[ cnt ] > 0 ) - { + if ( pSoldier->drugs.bDrugEffectRate[ cnt ] > 0 ) + { // Seap some in.... - pSoldier->bFutureDrugEffect[ cnt ] -= pSoldier->bDrugEffectRate[ cnt ]; - pSoldier->bDrugEffect[ cnt ] += pSoldier->bDrugEffectRate[ cnt ]; + pSoldier->drugs.bFutureDrugEffect[ cnt ] -= pSoldier->drugs.bDrugEffectRate[ cnt ]; + pSoldier->drugs.bDrugEffect[ cnt ] += pSoldier->drugs.bDrugEffectRate[ cnt ]; // Refresh morale w/ new drug value... RefreshSoldierMorale( pSoldier ); // Check if we need to stop 'adding' - if ( pSoldier->bFutureDrugEffect[ cnt ] <= 0 ) + if ( pSoldier->drugs.bFutureDrugEffect[ cnt ] <= 0 ) { - pSoldier->bFutureDrugEffect[ cnt ] = 0; + pSoldier->drugs.bFutureDrugEffect[ cnt ] = 0; // Change rate to -ve.. - pSoldier->bDrugEffectRate[ cnt ] = -ubDrugWearoffRate[ cnt ]; + pSoldier->drugs.bDrugEffectRate[ cnt ] = -ubDrugWearoffRate[ cnt ]; } } } @@ -301,16 +306,16 @@ void HandleEndTurnDrugAdjustments( SOLDIERTYPE *pSoldier ) // bBandaged = BANDAGED( pSoldier ); // increase life - pSoldier->bLife = __min( pSoldier->bLife + LIFE_GAIN_PER_REGEN_POINT, pSoldier->bLifeMax ); + pSoldier->stats.bLife = __min( pSoldier->stats.bLife + LIFE_GAIN_PER_REGEN_POINT, pSoldier->stats.bLifeMax ); - if ( pSoldier->bLife == pSoldier->bLifeMax ) + if ( pSoldier->stats.bLife == pSoldier->stats.bLifeMax ) { pSoldier->bBleeding = 0; } - else if ( pSoldier->bBleeding + pSoldier->bLife > pSoldier->bLifeMax ) + else if ( pSoldier->bBleeding + pSoldier->stats.bLife > pSoldier->stats.bLifeMax ) { // got to reduce amount of bleeding - pSoldier->bBleeding = (pSoldier->bLifeMax - pSoldier->bLife); + pSoldier->bBleeding = (pSoldier->stats.bLifeMax - pSoldier->stats.bLife); } // decrement counter @@ -318,40 +323,40 @@ void HandleEndTurnDrugAdjustments( SOLDIERTYPE *pSoldier ) } } -INT8 GetDrugEffect( SOLDIERTYPE *pSoldier, UINT8 ubDrugType ) +INT8 GetDrugEffect( SOLDIERTYPE *pSoldier, UINT8 ubDrugType ) { - return( pSoldier->bDrugEffect[ ubDrugType ] ); + return( pSoldier->drugs.bDrugEffect[ ubDrugType ] ); } INT8 GetDrugSideEffect( SOLDIERTYPE *pSoldier, UINT8 ubDrugType ) { // If we have a o-positive effect - if ( pSoldier->bDrugEffect[ ubDrugType ] > 0 ) + if ( pSoldier->drugs.bDrugEffect[ ubDrugType ] > 0 ) { return( 0 ); } else { - return( pSoldier->bDrugSideEffect[ ubDrugType ] ); + return( pSoldier->drugs.bDrugSideEffect[ ubDrugType ] ); } } void HandleAPEffectDueToDrugs( SOLDIERTYPE *pSoldier, UINT8 *pubPoints ) { - INT8 bDrunkLevel; - INT16 sPoints = (*pubPoints); + INT8 bDrunkLevel; + INT16 sPoints = (*pubPoints); // Are we in a side effect or good effect? - if ( pSoldier->bDrugEffect[ DRUG_TYPE_ADRENALINE ] ) + if ( pSoldier->drugs.bDrugEffect[ DRUG_TYPE_ADRENALINE ] ) { // Adjust! - sPoints += pSoldier->bDrugEffect[ DRUG_TYPE_ADRENALINE ]; + sPoints += pSoldier->drugs.bDrugEffect[ DRUG_TYPE_ADRENALINE ]; } - else if ( pSoldier->bDrugSideEffect[ DRUG_TYPE_ADRENALINE ] ) + else if ( pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_ADRENALINE ] ) { // Adjust! - sPoints -= pSoldier->bDrugSideEffect[ DRUG_TYPE_ADRENALINE ]; + sPoints -= pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_ADRENALINE ]; if ( sPoints < AP_MINIMUM ) { @@ -372,7 +377,7 @@ void HandleAPEffectDueToDrugs( SOLDIERTYPE *pSoldier, UINT8 *pubPoints ) } } - (*pubPoints) = (UINT8)sPoints; + (*pubPoints) = (UINT8)sPoints; } @@ -381,15 +386,15 @@ void HandleBPEffectDueToDrugs( SOLDIERTYPE *pSoldier, INT16 *psPointReduction ) INT8 bDrunkLevel; // Are we in a side effect or good effect? - if ( pSoldier->bDrugEffect[ DRUG_TYPE_ADRENALINE ] ) + if ( pSoldier->drugs.bDrugEffect[ DRUG_TYPE_ADRENALINE ] ) { // Adjust! - (*psPointReduction) -= ( pSoldier->bDrugEffect[ DRUG_TYPE_ADRENALINE ] * BP_RATIO_RED_PTS_TO_NORMAL ); + (*psPointReduction) -= ( pSoldier->drugs.bDrugEffect[ DRUG_TYPE_ADRENALINE ] * BP_RATIO_RED_PTS_TO_NORMAL ); } - else if ( pSoldier->bDrugSideEffect[ DRUG_TYPE_ADRENALINE ] ) + else if ( pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_ADRENALINE ] ) { // Adjust! - (*psPointReduction) += ( pSoldier->bDrugSideEffect[ DRUG_TYPE_ADRENALINE ] * BP_RATIO_RED_PTS_TO_NORMAL ); + (*psPointReduction) += ( pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_ADRENALINE ] * BP_RATIO_RED_PTS_TO_NORMAL ); } bDrunkLevel = GetDrunkLevel( pSoldier ); @@ -407,18 +412,18 @@ INT8 GetDrunkLevel( SOLDIERTYPE *pSoldier ) INT8 bNumDrinks; // If we have a -ve effect ... - if ( pSoldier->bDrugEffect[ DRUG_TYPE_ALCOHOL ] == 0 && pSoldier->bDrugSideEffect[ DRUG_TYPE_ALCOHOL ] == 0 ) + if ( pSoldier->drugs.bDrugEffect[ DRUG_TYPE_ALCOHOL ] == 0 && pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_ALCOHOL ] == 0 ) { return( SOBER ); } - if ( pSoldier->bDrugEffect[ DRUG_TYPE_ALCOHOL ] == 0 && pSoldier->bDrugSideEffect[ DRUG_TYPE_ALCOHOL ] != 0 ) + if ( pSoldier->drugs.bDrugEffect[ DRUG_TYPE_ALCOHOL ] == 0 && pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_ALCOHOL ] != 0 ) { return( HUNGOVER ); } // Calculate how many dinks we have had.... - bNumDrinks = ( pSoldier->bDrugEffect[ DRUG_TYPE_ALCOHOL ] / ubDrugEffect[ DRUG_TYPE_ALCOHOL ] ); + bNumDrinks = ( pSoldier->drugs.bDrugEffect[ DRUG_TYPE_ALCOHOL ] / ubDrugEffect[ DRUG_TYPE_ALCOHOL ] ); if ( bNumDrinks <= 3 ) { @@ -444,11 +449,11 @@ INT32 EffectStatForBeingDrunk( SOLDIERTYPE *pSoldier, INT32 iStat ) BOOLEAN MercUnderTheInfluence( SOLDIERTYPE *pSoldier ) { // Are we in a side effect or good effect? - if ( pSoldier->bDrugEffect[ DRUG_TYPE_ADRENALINE ] ) + if ( pSoldier->drugs.bDrugEffect[ DRUG_TYPE_ADRENALINE ] ) { return( TRUE ); } - else if ( pSoldier->bDrugSideEffect[ DRUG_TYPE_ADRENALINE ] ) + else if ( pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_ADRENALINE ] ) { return( TRUE ); } diff --git a/Tactical/Drugs And Alcohol.h b/Tactical/Drugs And Alcohol.h index 64182dd8..a8b5920f 100644 --- a/Tactical/Drugs And Alcohol.h +++ b/Tactical/Drugs And Alcohol.h @@ -4,7 +4,7 @@ #define DRUG_TYPE_ADRENALINE 0 #define DRUG_TYPE_ALCOHOL 1 -#define NO_DRUG 2 +#define NO_DRUG 2 #define NUM_COMPLEX_DRUGS 2 #define DRUG_TYPE_REGENERATION 3 diff --git a/Tactical/End Game.cpp b/Tactical/End Game.cpp index ff72550c..2a38d8da 100644 --- a/Tactical/End Game.cpp +++ b/Tactical/End Game.cpp @@ -3,7 +3,7 @@ #include "PreBattle Interface.h" #include "Intro.h" #else - #include "Soldier Control.h" + #include "Overhead.h" #include "Boxing.h" #include "Render Fun.h" @@ -44,11 +44,16 @@ #include "screenids.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + INT16 sStatueGridNos[] = { 13829, 13830, 13669, 13670 }; SOLDIERTYPE *gpKillerSoldier = NULL; -INT16 gsGridNo; -INT8 gbLevel; +INT16 gsGridNo; +INT8 gbLevel; // This function checks if our statue exists in the current sector at given gridno @@ -88,21 +93,21 @@ void ChangeO3SectorStatue( BOOLEAN fFromExplosion ) ApplyMapChangesToMapTempFile( TRUE ); // Remove it! // Get index for it... - GetTileIndexFromTypeSubIndex( EIGHTOSTRUCT, (INT8)( 5 ), &usTileIndex ); + GetTileIndexFromTypeSubIndex( EIGHTOSTRUCT, (INT8)( 5 ), &usTileIndex ); RemoveStruct( 13830, usTileIndex ); - + // Add new one... if ( fFromExplosion ) { // Use damaged peice - GetTileIndexFromTypeSubIndex( EIGHTOSTRUCT, (INT8)( 7 ), &usTileIndex ); + GetTileIndexFromTypeSubIndex( EIGHTOSTRUCT, (INT8)( 7 ), &usTileIndex ); } else { - GetTileIndexFromTypeSubIndex( EIGHTOSTRUCT, (INT8)( 8 ), &usTileIndex ); + GetTileIndexFromTypeSubIndex( EIGHTOSTRUCT, (INT8)( 8 ), &usTileIndex ); // Play sound... - PlayJA2Sample( OPEN_STATUE, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); + PlayJA2Sample( OPEN_STATUE, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); } AddStructToHead( 13830, usTileIndex ); @@ -111,7 +116,7 @@ void ChangeO3SectorStatue( BOOLEAN fFromExplosion ) ExitGrid.ubGotoSectorX = 3; ExitGrid.ubGotoSectorY = MAP_ROW_O; ExitGrid.ubGotoSectorZ = 1; - ExitGrid.usGridNo = 13037; + ExitGrid.sGridNo = 13037; AddExitGridToWorld( 13669, &ExitGrid ); gpWorldLevelData[ 13669 ].uiFlags |= MAPELEMENT_REVEALED; @@ -142,7 +147,7 @@ void BeginHandleDeidrannaDeath( SOLDIERTYPE *pKillerSoldier, INT16 sGridNo, INT8 { gpKillerSoldier = pKillerSoldier; gsGridNo = sGridNo; - gbLevel = bLevel; + gbLevel = bLevel; // Lock the UI..... gTacticalStatus.uiFlags |= ENGAGED_IN_CONV; @@ -159,7 +164,6 @@ void HandleDeidrannaDeath( SOLDIERTYPE *pKillerSoldier, INT16 sGridNo, INT8 bLev { SOLDIERTYPE *pTeamSoldier; INT32 cnt; - INT16 sDistVisible = FALSE; UINT8 ubKillerSoldierID = NOBODY; // Start victory music here... @@ -168,26 +172,26 @@ void HandleDeidrannaDeath( SOLDIERTYPE *pKillerSoldier, INT16 sGridNo, INT8 bLev if ( pKillerSoldier ) { - TacticalCharacterDialogue( pKillerSoldier, QUOTE_KILLING_DEIDRANNA ); + TacticalCharacterDialogue( pKillerSoldier, QUOTE_KILLING_DEIDRANNA ); ubKillerSoldierID = pKillerSoldier->ubID; } // STEP 1 ) START ALL QUOTES GOING! // OK - loop through all witnesses and see if they want to say something abou this... - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) { if ( cnt != ubKillerSoldierID ) { - if ( OK_INSECTOR_MERC( pTeamSoldier ) && !( pTeamSoldier->uiStatusFlags & SOLDIER_GASSED ) && !AM_AN_EPC( pTeamSoldier ) ) + if ( OK_INSECTOR_MERC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !AM_AN_EPC( pTeamSoldier ) ) { if ( QuoteExp_WitnessDeidrannaDeath[ pTeamSoldier->ubProfile ] ) { if ( SoldierTo3DLocationLineOfSightTest( pTeamSoldier, sGridNo, bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) { - TacticalCharacterDialogue( pTeamSoldier, QUOTE_KILLING_DEIDRANNA ); + TacticalCharacterDialogue( pTeamSoldier, QUOTE_KILLING_DEIDRANNA ); } } } @@ -231,11 +235,11 @@ void DoneFadeOutKilledQueen( void ) // For one, loop through our current squad and move them over cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) - { + { // Are we in this sector, On the current squad? - if ( pSoldier->bActive && pSoldier->bLife >= OKLIFE && pSoldier->bInSector && pSoldier->bAssignment == CurrentSquad( ) ) + if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && pSoldier->bInSector && pSoldier->bAssignment == CurrentSquad( ) ) { gfTacticalTraversal = TRUE; SetGroupSectorValue( 3, MAP_ROW_P, 0, pSoldier->ubGroupID ); @@ -249,23 +253,23 @@ void DoneFadeOutKilledQueen( void ) pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; pSoldier->usStrategicInsertionData = 5687; // Set direction to face.... - pSoldier->ubInsertionDirection = 100 + NORTHWEST; + pSoldier->ubInsertionDirection = 100 + NORTHWEST; } } // Kill all enemies in world..... cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; cnt++,pTeamSoldier++) - { + { // Are we active and in sector..... - if ( pTeamSoldier->bActive ) + if ( pTeamSoldier->bActive ) { // For sure for flag thet they are dead is not set // Check for any more badguys // ON THE STRAGETY LAYER KILL BAD GUYS! - if ( !pTeamSoldier->bNeutral && (pTeamSoldier->bSide != gbPlayerNum ) ) + if ( !pTeamSoldier->aiData.bNeutral && (pTeamSoldier->bSide != gbPlayerNum ) ) { ProcessQueenCmdImplicationsOfDeath( pTeamSoldier ); } @@ -284,9 +288,9 @@ void DoneFadeOutKilledQueen( void ) HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_QUEEN_BATTLE_WON, 3, MAP_ROW_P, 0 ); SetMusicMode( MUSIC_TACTICAL_VICTORY ); - + SetThisSectorAsPlayerControlled( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, TRUE ); - + // ATE: Force change of level set z to 1 gbWorldSectorZ = 1; @@ -298,8 +302,8 @@ void DoneFadeOutKilledQueen( void ) SectorInfo[ SEC_P3 ].ubTroopsInBattle = 0; SectorInfo[ SEC_P3 ].ubElitesInBattle = 0; - // ATE: GEt rid of elliot in P3... - gMercProfiles[ ELLIOT ].sSectorX = 1; + // ATE: GEt rid of elliot in P3... + gMercProfiles[ ELLIOT ].sSectorX = 1; ChangeNpcToDifferentSector( DEREK, 3, MAP_ROW_P, 0 ); ChangeNpcToDifferentSector( OLIVER, 3, MAP_ROW_P, 0 ); @@ -323,7 +327,7 @@ void HandleDoneLastKilledQueenQuote( ) { gFadeOutDoneCallback = DoneFadeOutKilledQueen; - FadeOutGameScreen( ); + FadeOutGameScreen( ); } @@ -333,18 +337,18 @@ void EndQueenDeathEndgameBeginEndCimenatic( ) SOLDIERTYPE *pSoldier; // Start end cimimatic.... - gTacticalStatus.uiFlags |= IN_ENDGAME_SEQUENCE; + gTacticalStatus.uiFlags |= IN_ENDGAME_SEQUENCE; // first thing is to loop through team and say end quote... cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) - { + { // Are we in this sector, On the current squad? - if ( pSoldier->bActive && pSoldier->bLife >= OKLIFE && !AM_AN_EPC( pSoldier ) ) + if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && !AM_AN_EPC( pSoldier ) ) { - TacticalCharacterDialogue( pSoldier, QUOTE_END_GAME_COMMENT ); + TacticalCharacterDialogue( pSoldier, QUOTE_END_GAME_COMMENT ); } } @@ -368,7 +372,7 @@ void DoneFadeOutEndCinematic( void ) { // DAVE PUT SMAKER STUFF HERE!!!!!!!!!!!! // :) - gTacticalStatus.uiFlags &= (~IN_ENDGAME_SEQUENCE); + gTacticalStatus.uiFlags &= (~IN_ENDGAME_SEQUENCE); // For now, just quit the freaken game... @@ -388,7 +392,7 @@ void HandleDoneLastEndGameQuote( ) gFadeOutDoneCallback = DoneFadeOutEndCinematic; - FadeOutGameScreen( ); + FadeOutGameScreen( ); } @@ -407,12 +411,12 @@ void BeginHandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT16 sGridNo, INT gpKillerSoldier = pKillerSoldier; gsGridNo = sGridNo; - gbLevel = bLevel; + gbLevel = bLevel; // Lock the UI..... - gTacticalStatus.uiFlags |= ENGAGED_IN_CONV; + gTacticalStatus.uiFlags |= ENGAGED_IN_CONV; // Increment refrence count... - giNPCReferenceCount = 1; + giNPCReferenceCount = 1; // gTacticalStatus.uiFlags |= IN_DEIDRANNA_ENDGAME; @@ -422,22 +426,22 @@ void BeginHandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT16 sGridNo, INT // Kill all enemies in creature team..... cnt = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; cnt++,pTeamSoldier++) - { + { // Are we active and ALIVE and in sector..... - if ( pTeamSoldier->bActive && pTeamSoldier->bLife > 0 ) + if ( pTeamSoldier->bActive && pTeamSoldier->stats.bLife > 0 ) { // For sure for flag thet they are dead is not set // Check for any more badguys // ON THE STRAGETY LAYER KILL BAD GUYS! - // HELLO! THESE ARE CREATURES! THEY CAN'T BE NEUTRAL! - //if ( !pTeamSoldier->bNeutral && (pTeamSoldier->bSide != gbPlayerNum ) ) + // HELLO! THESE ARE CREATURES! THEY CAN'T BE NEUTRAL! + //if ( !pTeamSoldier->aiData.bNeutral && (pTeamSoldier->bSide != gbPlayerNum ) ) { -// gTacticalStatus.ubAttackBusyCount++; +// gTacticalStatus.ubAttackBusyCount++; DebugAttackBusy( "Killing off a queen ally.\n"); - EVENT_SoldierGotHit( pTeamSoldier, 0, 10000, 0, pTeamSoldier->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pTeamSoldier->bAimShotLocation, 0, NOWHERE ); + pTeamSoldier->EVENT_SoldierGotHit( 0, 10000, 0, pTeamSoldier->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pTeamSoldier->bAimShotLocation, 0, NOWHERE ); } } } @@ -449,7 +453,6 @@ void HandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT16 sGridNo, INT8 bLe { SOLDIERTYPE *pTeamSoldier; INT32 cnt; - INT16 sDistVisible = FALSE; UINT8 ubKillerSoldierID = NOBODY; // Start victory music here... @@ -457,26 +460,26 @@ void HandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT16 sGridNo, INT8 bLe if ( pKillerSoldier ) { - TacticalCharacterDialogue( pKillerSoldier, QUOTE_KILLING_QUEEN ); + TacticalCharacterDialogue( pKillerSoldier, QUOTE_KILLING_QUEEN ); ubKillerSoldierID = pKillerSoldier->ubID; } // STEP 1 ) START ALL QUOTES GOING! // OK - loop through all witnesses and see if they want to say something abou this... - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) { if ( cnt != ubKillerSoldierID ) { - if ( OK_INSECTOR_MERC( pTeamSoldier ) && !( pTeamSoldier->uiStatusFlags & SOLDIER_GASSED ) && !AM_AN_EPC( pTeamSoldier ) ) + if ( OK_INSECTOR_MERC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !AM_AN_EPC( pTeamSoldier ) ) { if ( QuoteExp_WitnessQueenBugDeath[ pTeamSoldier->ubProfile ] ) { if ( SoldierTo3DLocationLineOfSightTest( pTeamSoldier, sGridNo, bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) { - TacticalCharacterDialogue( pTeamSoldier, QUOTE_KILLING_QUEEN ); + TacticalCharacterDialogue( pTeamSoldier, QUOTE_KILLING_QUEEN ); } } } @@ -485,16 +488,17 @@ void HandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT16 sGridNo, INT8 bLe // Set fact that she is dead! - if ( CheckFact( FACT_QUEEN_DEAD, 0 ) ) - { - EndQueenDeathEndgameBeginEndCimenatic( ); - } - else - { - // Unset flags... - gTacticalStatus.uiFlags &= (~ENGAGED_IN_CONV ); - // Increment refrence count... - giNPCReferenceCount = 0; - } + if ( CheckFact( FACT_QUEEN_DEAD, 0 ) ) + { + EndQueenDeathEndgameBeginEndCimenatic( ); + } + else + { + // Unset flags... + gTacticalStatus.uiFlags &= (~ENGAGED_IN_CONV ); + // Increment refrence count... + giNPCReferenceCount = 0; + } } + diff --git a/Tactical/Enemy Soldier Save.cpp b/Tactical/Enemy Soldier Save.cpp index 5d2b4d4c..56a85dd0 100644 --- a/Tactical/Enemy Soldier Save.cpp +++ b/Tactical/Enemy Soldier Save.cpp @@ -35,6 +35,13 @@ #include "Scheduling.h" #endif +#include "GameVersion.h" +//ADB When a savegame is loaded, the enemy and civ stuff needs to be loaded and updated, but this can only happen +//when the temp file is loaded which can happen much later, it cannot load convert and save when updating the savegame +//therefore store a flag to load and convert later +int gEnemyPreservedTempFileVersion[256]; +int gCivPreservedTempFileVersion[256]; + BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *pNode, GROUP *pGroup = NULL ); BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( UINT8 *pubNumElites, UINT8 *pubNumRegulars, UINT8 *pubNumAdmins, UINT8 *pubNumCreatures ); @@ -48,7 +55,7 @@ void RemoveEnemySoldierTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) { CHAR8 zMapName[ 128 ]; if( GetSectorFlagStatus( sSectorX, sSectorY, bSectorZ, SF_ENEMY_PRESERVED_TEMP_FILE_EXISTS ) ) - { + { //Delete any temp file that is here and toast the flag that say's one exists. ReSetSectorFlag( sSectorX, sSectorY, bSectorZ, SF_ENEMY_PRESERVED_TEMP_FILE_EXISTS ); @@ -68,7 +75,7 @@ void RemoveCivilianTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) //CHAR8 zTempName[ 128 ]; CHAR8 zMapName[ 128 ]; if( GetSectorFlagStatus( sSectorX, sSectorY, bSectorZ, SF_CIV_PRESERVED_TEMP_FILE_EXISTS ) ) - { + { //Delete any temp file that is here and toast the flag that say's one exists. ReSetSectorFlag( sSectorX, sSectorY, bSectorZ, SF_CIV_PRESERVED_TEMP_FILE_EXISTS ); //GetMapFileName( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, zTempName, FALSE ); @@ -81,7 +88,7 @@ void RemoveCivilianTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) } -//OLD SAVE METHOD: This is the old way of loading the enemies and civilians +//OLD SAVE METHOD: This is the old way of loading the enemies and civilians BOOLEAN LoadEnemySoldiersFromTempFile() { SOLDIERINITNODE *curr; @@ -92,7 +99,6 @@ BOOLEAN LoadEnemySoldiersFromTempFile() UINT32 uiTimeStamp; HWFILE hfile; INT16 sSectorX, sSectorY; - UINT16 usCheckSum, usFileCheckSum; CHAR8 zMapName[ 128 ]; #ifdef JA2TESTVERSION CHAR8 zReason[256]; @@ -101,10 +107,10 @@ BOOLEAN LoadEnemySoldiersFromTempFile() UINT8 ubSectorID; UINT8 ubNumElites = 0, ubNumTroops = 0, ubNumAdmins = 0, ubNumCreatures = 0; UINT8 ubStrategicElites, ubStrategicTroops, ubStrategicAdmins, ubStrategicCreatures; - + gfRestoringEnemySoldiersFromTempFile = TRUE; - //STEP ONE: Set up the temp file to read from. + //STEP ONE: Set up the temp file to read from. //Convert the current sector location into a file name // GetMapFileName( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, zTempName, FALSE ); @@ -121,41 +127,41 @@ BOOLEAN LoadEnemySoldiersFromTempFile() return FALSE; } - //STEP TWO: determine whether or not we should use this data. + //STEP TWO: determine whether or not we should use this data. //because it is the demo, it is automatically used. FileRead( hfile, &sSectorY, 2, &uiNumBytesRead ); if( uiNumBytesRead != 2 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- EOF while reading sSectorY. KM" ); + sprintf( zReason, "EnemySoldier -- EOF while reading sSectorY. KM" ); #endif goto FAIL_LOAD; } if( gWorldSectorY != sSectorY ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- sSectorY mismatch. KM" ); + sprintf( zReason, "EnemySoldier -- sSectorY mismatch. KM" ); #endif goto FAIL_LOAD; } - + LoadSoldierInitListLinks( hfile ); - - //STEP THREE: read the data + + //STEP THREE: read the data FileRead( hfile, &sSectorX, 2, &uiNumBytesRead ); if( uiNumBytesRead != 2 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- EOF while reading sSectorX. KM" ); + sprintf( zReason, "EnemySoldier -- EOF while reading sSectorX. KM" ); #endif goto FAIL_LOAD; } if( gWorldSectorX != sSectorX ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- sSectorX mismatch. KM" ); + sprintf( zReason, "EnemySoldier -- sSectorX mismatch. KM" ); #endif goto FAIL_LOAD; } @@ -164,7 +170,7 @@ BOOLEAN LoadEnemySoldiersFromTempFile() if( uiNumBytesRead != 4 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- EOF while reading slots. KM" ); + sprintf( zReason, "EnemySoldier -- EOF while reading slots. KM" ); #endif goto FAIL_LOAD; } @@ -173,7 +179,7 @@ BOOLEAN LoadEnemySoldiersFromTempFile() if( uiNumBytesRead != 4 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- EOF while reading uiTimeStamp. KM" ); + sprintf( zReason, "EnemySoldier -- EOF while reading uiTimeStamp. KM" ); #endif goto FAIL_LOAD; } @@ -182,29 +188,29 @@ BOOLEAN LoadEnemySoldiersFromTempFile() if( uiNumBytesRead != 1 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- EOF while reading bSectorZ. KM" ); + sprintf( zReason, "EnemySoldier -- EOF while reading bSectorZ. KM" ); #endif goto FAIL_LOAD; } if( GetWorldTotalMin() > uiTimeStamp + 300 ) - { //the file has aged. Use the regular method for adding soldiers. + { //the file has aged. Use the regular method for adding soldiers. FileClose( hfile ); RemoveEnemySoldierTempFile( sSectorX, sSectorY, bSectorZ ); gfRestoringEnemySoldiersFromTempFile = FALSE; return TRUE; } - + if( gbWorldSectorZ != bSectorZ ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- bSectorZ mismatch. KM" ); + sprintf( zReason, "EnemySoldier -- bSectorZ mismatch. KM" ); #endif goto FAIL_LOAD; } if( !slots ) - { //no need to restore the enemy's to the map. This means we are restoring a saved game. + { //no need to restore the enemy's to the map. This means we are restoring a saved game. gfRestoringEnemySoldiersFromTempFile = FALSE; FileClose( hfile ); return TRUE; @@ -212,12 +218,12 @@ BOOLEAN LoadEnemySoldiersFromTempFile() if( slots < 0 || slots >= 64 ) { //bad IO! #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- illegal slot value of %d. KM", slots ); + sprintf( zReason, "EnemySoldier -- illegal slot value of %d. KM", slots ); #endif goto FAIL_LOAD; } - //For all the enemy slots (enemy/creature), clear the fPriorityExistance flag. We will use these flags + //For all the enemy slots (enemy/creature), clear the fPriorityExistance flag. We will use these flags //to determine which slots have been modified as we load the data into the map pristine soldier init list. curr = gSoldierInitHead; while( curr ) @@ -240,13 +246,13 @@ BOOLEAN LoadEnemySoldiersFromTempFile() if( !pSector ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- Couldn't find underground sector info for (%d,%d,%d) KM", sSectorX, sSectorY, bSectorZ ); + sprintf( zReason, "EnemySoldier -- Couldn't find underground sector info for (%d,%d,%d) KM", sSectorX, sSectorY, bSectorZ ); #endif goto FAIL_LOAD; } - ubStrategicElites = pSector->ubNumElites; - ubStrategicTroops = pSector->ubNumTroops; - ubStrategicAdmins = pSector->ubNumAdmins; + ubStrategicElites = pSector->ubNumElites; + ubStrategicTroops = pSector->ubNumTroops; + ubStrategicAdmins = pSector->ubNumAdmins; ubStrategicCreatures = pSector->ubNumCreatures; } else @@ -259,20 +265,17 @@ BOOLEAN LoadEnemySoldiersFromTempFile() for( i = 0; i < slots; i++ ) { - // WDS - Clean up inventory handling - FileRead( hfile, &tempDetailedPlacement, SIZEOF_SOLDIERCREATE_STRUCT_POD, &uiNumBytesRead ); - if( uiNumBytesRead != SIZEOF_SOLDIERCREATE_STRUCT_POD) + if ( !tempDetailedPlacement.Load(hfile, gEnemyPreservedTempFileVersion[SECTOR( sSectorX,sSectorY)], true) ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- EOF while reading tempDetailedPlacment %d. KM", i ); + sprintf( zReason, "EnemySoldier -- EOF while reading tempDetailedPlacment %d. KM", i ); #endif goto FAIL_LOAD; } - tempDetailedPlacement.CopyOldInventoryToNew(); curr = gSoldierInitHead; while( curr ) - { + { if( !curr->pBasicPlacement->fPriorityExistance ) { if( !curr->pDetailedPlacement || curr->pDetailedPlacement && curr->pDetailedPlacement->ubProfile == NO_PROFILE ) @@ -282,12 +285,15 @@ BOOLEAN LoadEnemySoldiersFromTempFile() curr->pBasicPlacement->fPriorityExistance = TRUE; if( !curr->pDetailedPlacement ) { //need to upgrade the placement to detailed placement - curr->pDetailedPlacement = new SOLDIERCREATE_STRUCT; //(SOLDIERCREATE_STRUCT*)MemAlloc( SIZEOF_SOLDIERCREATE_STRUCT ); + curr->pBasicPlacement->fDetailedPlacement = TRUE; + curr->pDetailedPlacement = new SOLDIERCREATE_STRUCT(tempDetailedPlacement); //(SOLDIERCREATE_STRUCT*)MemAlloc( SIZEOF_SOLDIERCREATE_STRUCT ); } - //now replace the map pristine placement info with the temp map file version.. - //memcpy( curr->pDetailedPlacement, &tempDetailedPlacement, SIZEOF_SOLDIERCREATE_STRUCT ); - *curr->pDetailedPlacement = tempDetailedPlacement; - + else + { + //now replace the map pristine placement info with the temp map file version.. + *curr->pDetailedPlacement = tempDetailedPlacement; + } + curr->pBasicPlacement->fPriorityExistance = TRUE; curr->pBasicPlacement->ubDirection = curr->pDetailedPlacement->ubDirection; curr->pBasicPlacement->bOrders = curr->pDetailedPlacement->bOrders; @@ -297,53 +303,12 @@ BOOLEAN LoadEnemySoldiersFromTempFile() curr->pBasicPlacement->ubSoldierClass = curr->pDetailedPlacement->ubSoldierClass; curr->pBasicPlacement->ubCivilianGroup = curr->pDetailedPlacement->ubCivilianGroup; curr->pBasicPlacement->fHasKeys = curr->pDetailedPlacement->fHasKeys; - curr->pBasicPlacement->usStartingGridNo = curr->pDetailedPlacement->sInsertionGridNo; + curr->pBasicPlacement->sStartingGridNo = curr->pDetailedPlacement->sInsertionGridNo; curr->pBasicPlacement->bPatrolCnt = curr->pDetailedPlacement->bPatrolCnt; - memcpy( curr->pBasicPlacement->sPatrolGrid, curr->pDetailedPlacement->sPatrolGrid, + memcpy( curr->pBasicPlacement->sPatrolGrid, curr->pDetailedPlacement->sPatrolGrid, sizeof( INT16 ) * curr->pBasicPlacement->bPatrolCnt ); - FileRead( hfile, &usCheckSum, 2, &uiNumBytesRead ); - if( uiNumBytesRead != 2 ) - { - #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- EOF while reading usCheckSum %d. KM", i ); - #endif - goto FAIL_LOAD; - } - //verify the checksum equation (anti-hack) -- see save - usFileCheckSum = - curr->pDetailedPlacement->bLife * 7 + - curr->pDetailedPlacement->bLifeMax * 8 - - curr->pDetailedPlacement->bAgility * 2 + - curr->pDetailedPlacement->bDexterity * 1 + - curr->pDetailedPlacement->bExpLevel * 5 - - curr->pDetailedPlacement->bMarksmanship * 9 + - curr->pDetailedPlacement->bMedical * 10 + - curr->pDetailedPlacement->bMechanical * 3 + - curr->pDetailedPlacement->bExplosive * 4 + - curr->pDetailedPlacement->bLeadership * 5 + - curr->pDetailedPlacement->bStrength * 7 + - curr->pDetailedPlacement->bWisdom * 11 + - curr->pDetailedPlacement->bMorale * 7 + - curr->pDetailedPlacement->bAIMorale * 3 - - curr->pDetailedPlacement->bBodyType * 7 + - 4 * 6 + - curr->pDetailedPlacement->sSectorX * 7 - - curr->pDetailedPlacement->ubSoldierClass * 4 + - curr->pDetailedPlacement->bTeam * 7 + - curr->pDetailedPlacement->ubDirection * 5 + - curr->pDetailedPlacement->fOnRoof * 17 + - curr->pDetailedPlacement->sInsertionGridNo * 1 + - 3; - if( usCheckSum != usFileCheckSum ) - { //Hacker has modified the stats on the enemy placements. - #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- checksum for placement %d failed. KM", i ); - #endif - goto FAIL_LOAD; - } - if( curr->pBasicPlacement->bTeam == CIV_TEAM ) { AddPlacementToWorld( curr ); @@ -355,28 +320,28 @@ BOOLEAN LoadEnemySoldiersFromTempFile() switch( curr->pBasicPlacement->ubSoldierClass ) { case SOLDIER_CLASS_ELITE: - ubNumElites++; + ubNumElites++; if( ubNumElites < ubStrategicElites ) { AddPlacementToWorld( curr ); } break; - case SOLDIER_CLASS_ARMY: - ubNumTroops++; + case SOLDIER_CLASS_ARMY: + ubNumTroops++; if( ubNumTroops < ubStrategicTroops ) { AddPlacementToWorld( curr ); } break; - case SOLDIER_CLASS_ADMINISTRATOR: - ubNumAdmins++; + case SOLDIER_CLASS_ADMINISTRATOR: + ubNumAdmins++; if( ubNumAdmins < ubStrategicAdmins ) { AddPlacementToWorld( curr ); } break; - case SOLDIER_CLASS_CREATURE: - ubNumCreatures++; + case SOLDIER_CLASS_CREATURE: + ubNumCreatures++; if( ubNumCreatures < ubStrategicCreatures ) { AddPlacementToWorld( curr ); @@ -391,19 +356,19 @@ BOOLEAN LoadEnemySoldiersFromTempFile() curr = curr->next; } } - + FileRead( hfile, &ubSectorID, 1, &uiNumBytesRead ); if( uiNumBytesRead != 1 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- EOF while reading ubSectorID. KM" ); + sprintf( zReason, "EnemySoldier -- EOF while reading ubSectorID. KM" ); #endif goto FAIL_LOAD; } if( ubSectorID != SECTOR( sSectorX, sSectorY ) ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- ubSectorID mismatch. KM" ); + sprintf( zReason, "EnemySoldier -- ubSectorID mismatch. KM" ); #endif goto FAIL_LOAD; } @@ -418,7 +383,7 @@ BOOLEAN LoadEnemySoldiersFromTempFile() } if( ubStrategicCreatures > ubNumCreatures ) { - ubStrategicCreatures; //not sure if this wil ever happen. If so, needs to be handled. + ubStrategicCreatures; //not sure if this wil ever happen. If so, needs to be handled. } //successful @@ -426,8 +391,8 @@ BOOLEAN LoadEnemySoldiersFromTempFile() return TRUE; FAIL_LOAD: - //The temp file load failed either because of IO problems related to hacking/logic, or - //various checks failed for hacker validation. If we reach this point, the "error: exit game" + //The temp file load failed either because of IO problems related to hacking/logic, or + //various checks failed for hacker validation. If we reach this point, the "error: exit game" //dialog would appear in a non-testversion. FileClose( hfile ); #ifdef JA2TESTVERSION @@ -436,7 +401,8 @@ BOOLEAN LoadEnemySoldiersFromTempFile() return FALSE; } -//OLD SAVE METHOD: This is the older way of saving the civilian and the enemies placement into a temp file +#ifdef OBSOLETE_CODE +//OLD SAVE METHOD: This is the older way of saving the civilian and the enemies placement into a temp file BOOLEAN SaveEnemySoldiersToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubFirstIdTeam, UINT8 ubLastIdTeam, BOOLEAN fAppendToFile ) { SOLDIERINITNODE *curr; @@ -448,18 +414,17 @@ BOOLEAN SaveEnemySoldiersToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSecto UINT32 uiTimeStamp; HWFILE hfile; SCHEDULENODE *pSchedule; - UINT16 usCheckSum; CHAR8 zMapName[ 128 ]; UINT8 ubSectorID; - //STEP ONE: Prep the soldiers for saving... + //STEP ONE: Prep the soldiers for saving... //modify the map's soldier init list to reflect the changes to the member's still alive... for( i = gTacticalStatus.Team[ ubFirstIdTeam ].bFirstID; i <= gTacticalStatus.Team[ ubLastIdTeam ].bLastID; i++ ) { pSoldier = MercPtrs[ i ]; - if( pSoldier->bActive /*&& pSoldier->bInSector*/ && pSoldier->bLife ) + if( pSoldier->bActive /*&& pSoldier->bInSector*/ && pSoldier->stats.bLife ) { //soldier is valid, so find the matching soldier init list entry for modification. curr = gSoldierInitHead; while( curr && curr->pSoldier != pSoldier ) @@ -467,39 +432,16 @@ BOOLEAN SaveEnemySoldiersToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSecto curr = curr->next; } if( curr && curr->pSoldier == pSoldier && pSoldier->ubProfile == NO_PROFILE ) - { //found a match. + { //found a match. if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME) ) { if( !curr->pDetailedPlacement ) { //need to upgrade the placement to detailed placement curr->pBasicPlacement->fDetailedPlacement = TRUE; - // WDS - Clean up inventory handling curr->pDetailedPlacement = new SOLDIERCREATE_STRUCT; //(SOLDIERCREATE_STRUCT*)MemAlloc( SIZEOF_SOLDIERCREATE_STRUCT ); - //memset( curr->pDetailedPlacement, 0, SIZEOF_SOLDIERCREATE_STRUCT ); - curr->pDetailedPlacement->initialize(); } - - //Copy over the data of the soldier. - curr->pDetailedPlacement->ubProfile = NO_PROFILE; - curr->pDetailedPlacement->bLife = pSoldier->bLife; - curr->pDetailedPlacement->bLifeMax = pSoldier->bLifeMax; - curr->pDetailedPlacement->bAgility = pSoldier->bAgility; - curr->pDetailedPlacement->bDexterity = pSoldier->bDexterity; - curr->pDetailedPlacement->bExpLevel = pSoldier->bExpLevel; - curr->pDetailedPlacement->bMarksmanship = pSoldier->bMarksmanship; - curr->pDetailedPlacement->bMedical = pSoldier->bMedical; - curr->pDetailedPlacement->bMechanical = pSoldier->bMechanical; - curr->pDetailedPlacement->bExplosive = pSoldier->bExplosive; - curr->pDetailedPlacement->bLeadership = pSoldier->bLeadership; - curr->pDetailedPlacement->bStrength = pSoldier->bStrength; - curr->pDetailedPlacement->bWisdom = pSoldier->bWisdom; - curr->pDetailedPlacement->bAttitude = pSoldier->bAttitude; - curr->pDetailedPlacement->bOrders = pSoldier->bOrders; - curr->pDetailedPlacement->bMorale = pSoldier->bMorale; - curr->pDetailedPlacement->bAIMorale = pSoldier->bAIMorale; - curr->pDetailedPlacement->bBodyType = pSoldier->ubBodyType; - curr->pDetailedPlacement->ubCivilianGroup = pSoldier->ubCivilianGroup; + (*curr->pDetailedPlacement) = (*pSoldier); //If the soldier has a real schedule (not a default schedule), then store it. //All other cases should be 0. @@ -513,44 +455,18 @@ BOOLEAN SaveEnemySoldiersToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSecto } } - curr->pDetailedPlacement->fHasKeys = pSoldier->bHasKeys; - curr->pDetailedPlacement->sSectorX = pSoldier->sSectorX; - curr->pDetailedPlacement->sSectorY = pSoldier->sSectorY; - curr->pDetailedPlacement->bSectorZ = pSoldier->bSectorZ; - curr->pDetailedPlacement->ubSoldierClass = pSoldier->ubSoldierClass; - curr->pDetailedPlacement->bTeam = pSoldier->bTeam; - curr->pDetailedPlacement->ubDirection = pSoldier->ubDirection; - - //we don't want the player to think that all the enemies start in the exact position when we + //we don't want the player to think that all the enemies start in the exact position when we //left the map, so randomize the start locations either current position or original position. if( PreRandom( 2 ) ) { //use current position - curr->pDetailedPlacement->fOnRoof = pSoldier->bLevel; + curr->pDetailedPlacement->fOnRoof = pSoldier->pathing.bLevel; curr->pDetailedPlacement->sInsertionGridNo = pSoldier->sGridNo; } else { //use original position curr->pDetailedPlacement->fOnRoof = curr->pBasicPlacement->fOnRoof; - curr->pDetailedPlacement->sInsertionGridNo = curr->pBasicPlacement->usStartingGridNo; + curr->pDetailedPlacement->sInsertionGridNo = curr->pBasicPlacement->sStartingGridNo; } - - swprintf( curr->pDetailedPlacement->name, pSoldier->name ); - - //Copy patrol points - curr->pDetailedPlacement->bPatrolCnt = pSoldier->bPatrolCnt; - memcpy( curr->pDetailedPlacement->sPatrolGrid, pSoldier->usPatrolGrid, sizeof( INT16 ) * MAXPATROLGRIDS ); - - //copy colors for soldier based on the body type. - sprintf( curr->pDetailedPlacement->HeadPal, pSoldier->HeadPal ); - sprintf( curr->pDetailedPlacement->VestPal, pSoldier->VestPal ); - sprintf( curr->pDetailedPlacement->SkinPal, pSoldier->SkinPal ); - sprintf( curr->pDetailedPlacement->PantsPal, pSoldier->PantsPal ); - sprintf( curr->pDetailedPlacement->MiscPal, pSoldier->MiscPal ); - - //copy soldier's inventory - // WDS - Clean up inventory handling - //memcpy( curr->pDetailedPlacement->Inv, pSoldier->inv, sizeof( OBJECTTYPE ) * NUM_INV_SLOTS ); - curr->pDetailedPlacement->Inv = pSoldier->inv; } //DONE, now increment the counter, so we know how many there are. @@ -564,7 +480,7 @@ BOOLEAN SaveEnemySoldiersToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSecto return TRUE; } - //STEP TWO: Set up the temp file to write to. + //STEP TWO: Set up the temp file to write to. //Convert the current sector location into a file name // GetMapFileName( sSectorX, sSectorY, bSectorZ, zTempName, FALSE ); @@ -587,7 +503,7 @@ BOOLEAN SaveEnemySoldiersToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSecto if( fAppendToFile ) { //Open the file for writing, Create it if it doesnt exist - hfile = FileOpen( zMapName, FILE_ACCESS_READ | FILE_OPEN_ALWAYS, FALSE ); + hfile = FileOpen( zMapName, FILE_ACCESS_READ | FILE_OPEN_ALWAYS, FALSE ); if( hfile == 0 ) { //Error opening map modification file return FALSE; @@ -620,7 +536,7 @@ BOOLEAN SaveEnemySoldiersToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSecto { goto FAIL_SAVE; } - + FileSeek( hfile, 0, FILE_SEEK_FROM_END ); } else @@ -642,7 +558,7 @@ BOOLEAN SaveEnemySoldiersToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSecto goto FAIL_SAVE; } - //STEP THREE: Save the data + //STEP THREE: Save the data SaveSoldierInitListLinks( hfile ); FileWrite( hfile, &sSectorX, 2, &uiNumBytesWritten ); @@ -651,11 +567,11 @@ BOOLEAN SaveEnemySoldiersToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSecto goto FAIL_SAVE; } - //This check may appear confusing. It is intended to abort if the player is saving the game. It is only + //This check may appear confusing. It is intended to abort if the player is saving the game. It is only //supposed to preserve the links to the placement list, so when we finally do leave the level with enemies remaining, //we will need the links that are only added when the map is loaded, and are normally lost when restoring a save. if( gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) - { + { slots = 0; } @@ -671,7 +587,7 @@ BOOLEAN SaveEnemySoldiersToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSecto { goto FAIL_SAVE; } - + FileWrite( hfile, &bSectorZ, 1, &uiNumBytesWritten ); if( uiNumBytesWritten != 1 ) { @@ -681,7 +597,7 @@ BOOLEAN SaveEnemySoldiersToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSecto if( gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) { - //if we are saving the game, we don't need to preserve the soldier information, just + //if we are saving the game, we don't need to preserve the soldier information, just //preserve the links to the placement list. slots = 0; FileClose( hfile ); @@ -692,7 +608,7 @@ BOOLEAN SaveEnemySoldiersToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSecto for( i = gTacticalStatus.Team[ ubFirstIdTeam ].bFirstID; i <= gTacticalStatus.Team[ ubLastIdTeam ].bLastID; i++ ) { pSoldier = MercPtrs[ i ]; - if( pSoldier->bActive /*&& pSoldier->bInSector*/ && pSoldier->bLife ) + if( pSoldier->bActive /*&& pSoldier->bInSector*/ && pSoldier->stats.bLife ) { //soldier is valid, so find the matching soldier init list entry for modification. curr = gSoldierInitHead; while( curr && curr->pSoldier != pSoldier ) @@ -700,45 +616,11 @@ BOOLEAN SaveEnemySoldiersToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSecto curr = curr->next; } if( curr && curr->pSoldier == pSoldier && pSoldier->ubProfile == NO_PROFILE ) - { //found a match. - // WDS - Clean up inventory handling - curr->pDetailedPlacement->CopyNewInventoryToOld(); - FileWrite( hfile, curr->pDetailedPlacement, SIZEOF_SOLDIERCREATE_STRUCT_POD, &uiNumBytesWritten ); - if( uiNumBytesWritten != SIZEOF_SOLDIERCREATE_STRUCT_POD) + { //found a match. + if ( !curr->pDetailedPlacement->Save(hfile, FALSE) ) { goto FAIL_SAVE; } - //insert a checksum equation (anti-hack) - usCheckSum = - curr->pDetailedPlacement->bLife * 7 + - curr->pDetailedPlacement->bLifeMax * 8 - - curr->pDetailedPlacement->bAgility * 2 + - curr->pDetailedPlacement->bDexterity * 1 + - curr->pDetailedPlacement->bExpLevel * 5 - - curr->pDetailedPlacement->bMarksmanship * 9 + - curr->pDetailedPlacement->bMedical * 10 + - curr->pDetailedPlacement->bMechanical * 3 + - curr->pDetailedPlacement->bExplosive * 4 + - curr->pDetailedPlacement->bLeadership * 5 + - curr->pDetailedPlacement->bStrength * 7 + - curr->pDetailedPlacement->bWisdom * 11 + - curr->pDetailedPlacement->bMorale * 7 + - curr->pDetailedPlacement->bAIMorale * 3 - - curr->pDetailedPlacement->bBodyType * 7 + - 4 * 6 + - curr->pDetailedPlacement->sSectorX * 7 - - curr->pDetailedPlacement->ubSoldierClass * 4 + - curr->pDetailedPlacement->bTeam * 7 + - curr->pDetailedPlacement->ubDirection * 5 + - curr->pDetailedPlacement->fOnRoof * 17 + - curr->pDetailedPlacement->sInsertionGridNo * 1 + - 3; - FileWrite( hfile, &usCheckSum, 2, &uiNumBytesWritten ); - if( uiNumBytesWritten != 2 ) - { - goto FAIL_SAVE; - - } } } } @@ -762,7 +644,7 @@ BOOLEAN SaveEnemySoldiersToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSecto FileClose( hfile ); return FALSE; } - +#endif BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile() { @@ -774,7 +656,6 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile() UINT32 uiTimeStamp; HWFILE hfile; INT16 sSectorX, sSectorY; - UINT16 usCheckSum, usFileCheckSum; CHAR8 zMapName[ 128 ]; #ifdef JA2TESTVERSION CHAR8 zReason[256]; @@ -783,10 +664,10 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile() UINT8 ubSectorID; UINT8 ubNumElites = 0, ubNumTroops = 0, ubNumAdmins = 0, ubNumCreatures = 0; UINT8 ubStrategicElites, ubStrategicTroops, ubStrategicAdmins, ubStrategicCreatures; - + gfRestoringEnemySoldiersFromTempFile = TRUE; - //STEP ONE: Set up the temp file to read from. + //STEP ONE: Set up the temp file to read from. //Convert the current sector location into a file name // GetMapFileName( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, zTempName, FALSE ); @@ -806,7 +687,7 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile() if( !pSector ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- Couldn't find underground sector info for (%d,%d,%d) KM", gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); + sprintf( zReason, "EnemySoldier -- Couldn't find underground sector info for (%d,%d,%d) KM", gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); #endif goto FAIL_LOAD; @@ -823,7 +704,7 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile() ubNumAdmins = pSector->ubNumAdmins; ubNumCreatures = pSector->ubNumCreatures; } - + if( !( gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { // Get the number of enemies form the temp file @@ -849,42 +730,42 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile() return FALSE; } - //STEP TWO: determine whether or not we should use this data. + //STEP TWO: determine whether or not we should use this data. //because it is the demo, it is automatically used. FileRead( hfile, &sSectorY, 2, &uiNumBytesRead ); if( uiNumBytesRead != 2 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- EOF while reading sSectorY. KM" ); + sprintf( zReason, "EnemySoldier -- EOF while reading sSectorY. KM" ); #endif goto FAIL_LOAD; } if( gWorldSectorY != sSectorY ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- sSectorY mismatch. KM" ); + sprintf( zReason, "EnemySoldier -- sSectorY mismatch. KM" ); #endif goto FAIL_LOAD; } - + // LoadSoldierInitListLinks( hfile ); NewWayOfLoadingEnemySoldierInitListLinks( hfile ); - - //STEP THREE: read the data + + //STEP THREE: read the data FileRead( hfile, &sSectorX, 2, &uiNumBytesRead ); if( uiNumBytesRead != 2 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- EOF while reading sSectorX. KM" ); + sprintf( zReason, "EnemySoldier -- EOF while reading sSectorX. KM" ); #endif goto FAIL_LOAD; } if( gWorldSectorX != sSectorX ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- sSectorX mismatch. KM" ); + sprintf( zReason, "EnemySoldier -- sSectorX mismatch. KM" ); #endif goto FAIL_LOAD; } @@ -893,7 +774,7 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile() if( uiNumBytesRead != 4 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- EOF while reading slots. KM" ); + sprintf( zReason, "EnemySoldier -- EOF while reading slots. KM" ); #endif goto FAIL_LOAD; } @@ -902,7 +783,7 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile() if( uiNumBytesRead != 4 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- EOF while reading uiTimeStamp. KM" ); + sprintf( zReason, "EnemySoldier -- EOF while reading uiTimeStamp. KM" ); #endif goto FAIL_LOAD; } @@ -911,20 +792,20 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile() if( uiNumBytesRead != 1 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- EOF while reading bSectorZ. KM" ); + sprintf( zReason, "EnemySoldier -- EOF while reading bSectorZ. KM" ); #endif goto FAIL_LOAD; } if( gbWorldSectorZ != bSectorZ ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- bSectorZ mismatch. KM" ); + sprintf( zReason, "EnemySoldier -- bSectorZ mismatch. KM" ); #endif goto FAIL_LOAD; } if( GetWorldTotalMin() > uiTimeStamp + 300 ) - { //the file has aged. Use the regular method for adding soldiers. + { //the file has aged. Use the regular method for adding soldiers. FileClose( hfile ); RemoveEnemySoldierTempFile( sSectorX, sSectorY, bSectorZ ); gfRestoringEnemySoldiersFromTempFile = FALSE; @@ -932,7 +813,7 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile() } if( !slots ) - { //no need to restore the enemy's to the map. This means we are restoring a saved game. + { //no need to restore the enemy's to the map. This means we are restoring a saved game. gfRestoringEnemySoldiersFromTempFile = FALSE; FileClose( hfile ); return TRUE; @@ -942,12 +823,12 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile() if( slots < 0 || slots >= 64 ) { //bad IO! #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- illegal slot value of %d. KM", slots ); + sprintf( zReason, "EnemySoldier -- illegal slot value of %d. KM", slots ); #endif goto FAIL_LOAD; } - //For all the enemy slots (enemy/creature), clear the fPriorityExistance flag. We will use these flags + //For all the enemy slots (enemy/creature), clear the fPriorityExistance flag. We will use these flags //to determine which slots have been modified as we load the data into the map pristine soldier init list. curr = gSoldierInitHead; while( curr ) @@ -970,13 +851,13 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile() if( !pSector ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- Couldn't find underground sector info for (%d,%d,%d) KM", sSectorX, sSectorY, bSectorZ ); + sprintf( zReason, "EnemySoldier -- Couldn't find underground sector info for (%d,%d,%d) KM", sSectorX, sSectorY, bSectorZ ); #endif goto FAIL_LOAD; } - ubStrategicElites = pSector->ubNumElites; - ubStrategicTroops = pSector->ubNumTroops; - ubStrategicAdmins = pSector->ubNumAdmins; + ubStrategicElites = pSector->ubNumElites; + ubStrategicTroops = pSector->ubNumTroops; + ubStrategicAdmins = pSector->ubNumAdmins; ubStrategicCreatures = pSector->ubNumCreatures; } else @@ -989,19 +870,16 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile() for( i = 0; i < slots; i++ ) { - // WDS - Clean up inventory handling - FileRead( hfile, &tempDetailedPlacement, SIZEOF_SOLDIERCREATE_STRUCT_POD, &uiNumBytesRead ); - if( uiNumBytesRead != SIZEOF_SOLDIERCREATE_STRUCT_POD) + if ( !tempDetailedPlacement.Load(hfile, gEnemyPreservedTempFileVersion[SECTOR(sSectorX, sSectorY)], true) ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- EOF while reading tempDetailedPlacment %d. KM", i ); + sprintf( zReason, "EnemySoldier -- EOF while reading tempDetailedPlacment %d. KM", i ); #endif goto FAIL_LOAD; } - tempDetailedPlacement.CopyOldInventoryToNew(); curr = gSoldierInitHead; while( curr ) - { + { if( !curr->pBasicPlacement->fPriorityExistance ) { if( curr->pBasicPlacement->bTeam == tempDetailedPlacement.bTeam ) @@ -1009,12 +887,14 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile() curr->pBasicPlacement->fPriorityExistance = TRUE; if( !curr->pDetailedPlacement ) { //need to upgrade the placement to detailed placement - curr->pDetailedPlacement = new SOLDIERCREATE_STRUCT; //(SOLDIERCREATE_STRUCT*)MemAlloc( SIZEOF_SOLDIERCREATE_STRUCT ); + curr->pBasicPlacement->fDetailedPlacement = TRUE; + curr->pDetailedPlacement = new SOLDIERCREATE_STRUCT(tempDetailedPlacement); //(SOLDIERCREATE_STRUCT*)MemAlloc( SIZEOF_SOLDIERCREATE_STRUCT ); } - //now replace the map pristine placement info with the temp map file version.. - //memcpy( curr->pDetailedPlacement, &tempDetailedPlacement, SIZEOF_SOLDIERCREATE_STRUCT ); - *curr->pDetailedPlacement = tempDetailedPlacement; - + else + { + *curr->pDetailedPlacement = tempDetailedPlacement; + } + curr->pBasicPlacement->fPriorityExistance = TRUE; curr->pBasicPlacement->ubDirection = curr->pDetailedPlacement->ubDirection; curr->pBasicPlacement->bOrders = curr->pDetailedPlacement->bOrders; @@ -1024,80 +904,39 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile() curr->pBasicPlacement->ubSoldierClass = curr->pDetailedPlacement->ubSoldierClass; curr->pBasicPlacement->ubCivilianGroup = curr->pDetailedPlacement->ubCivilianGroup; curr->pBasicPlacement->fHasKeys = curr->pDetailedPlacement->fHasKeys; - curr->pBasicPlacement->usStartingGridNo = curr->pDetailedPlacement->sInsertionGridNo; + curr->pBasicPlacement->sStartingGridNo = curr->pDetailedPlacement->sInsertionGridNo; curr->pBasicPlacement->bPatrolCnt = curr->pDetailedPlacement->bPatrolCnt; - memcpy( curr->pBasicPlacement->sPatrolGrid, curr->pDetailedPlacement->sPatrolGrid, + memcpy( curr->pBasicPlacement->sPatrolGrid, curr->pDetailedPlacement->sPatrolGrid, sizeof( INT16 ) * curr->pBasicPlacement->bPatrolCnt ); - FileRead( hfile, &usCheckSum, 2, &uiNumBytesRead ); - if( uiNumBytesRead != 2 ) - { - #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- EOF while reading usCheckSum %d. KM", i ); - #endif - goto FAIL_LOAD; - } - //verify the checksum equation (anti-hack) -- see save - usFileCheckSum = - curr->pDetailedPlacement->bLife * 7 + - curr->pDetailedPlacement->bLifeMax * 8 - - curr->pDetailedPlacement->bAgility * 2 + - curr->pDetailedPlacement->bDexterity * 1 + - curr->pDetailedPlacement->bExpLevel * 5 - - curr->pDetailedPlacement->bMarksmanship * 9 + - curr->pDetailedPlacement->bMedical * 10 + - curr->pDetailedPlacement->bMechanical * 3 + - curr->pDetailedPlacement->bExplosive * 4 + - curr->pDetailedPlacement->bLeadership * 5 + - curr->pDetailedPlacement->bStrength * 7 + - curr->pDetailedPlacement->bWisdom * 11 + - curr->pDetailedPlacement->bMorale * 7 + - curr->pDetailedPlacement->bAIMorale * 3 - - curr->pDetailedPlacement->bBodyType * 7 + - 4 * 6 + - curr->pDetailedPlacement->sSectorX * 7 - - curr->pDetailedPlacement->ubSoldierClass * 4 + - curr->pDetailedPlacement->bTeam * 7 + - curr->pDetailedPlacement->ubDirection * 5 + - curr->pDetailedPlacement->fOnRoof * 17 + - curr->pDetailedPlacement->sInsertionGridNo * 1 + - 3; - if( usCheckSum != usFileCheckSum ) - { //Hacker has modified the stats on the enemy placements. - #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- checksum for placement %d failed. KM", i ); - #endif - goto FAIL_LOAD; - } - //Add preserved placements as long as they don't exceed the actual population. switch( curr->pBasicPlacement->ubSoldierClass ) { case SOLDIER_CLASS_ELITE: - ubNumElites++; + ubNumElites++; if( ubNumElites <= ubStrategicElites ) { //def: AddPlacementToWorld( curr ); } break; - case SOLDIER_CLASS_ARMY: - ubNumTroops++; + case SOLDIER_CLASS_ARMY: + ubNumTroops++; if( ubNumTroops <= ubStrategicTroops ) { //def: AddPlacementToWorld( curr ); } break; - case SOLDIER_CLASS_ADMINISTRATOR: - ubNumAdmins++; + case SOLDIER_CLASS_ADMINISTRATOR: + ubNumAdmins++; if( ubNumAdmins <= ubStrategicAdmins ) { //def: AddPlacementToWorld( curr ); } break; - case SOLDIER_CLASS_CREATURE: - ubNumCreatures++; + case SOLDIER_CLASS_CREATURE: + ubNumCreatures++; if( ubNumCreatures <= ubStrategicCreatures ) { //def: AddPlacementToWorld( curr ); @@ -1110,19 +949,19 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile() curr = curr->next; } } - + FileRead( hfile, &ubSectorID, 1, &uiNumBytesRead ); if( uiNumBytesRead != 1 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- EOF while reading ubSectorID. KM" ); + sprintf( zReason, "EnemySoldier -- EOF while reading ubSectorID. KM" ); #endif goto FAIL_LOAD; } if( ubSectorID != SECTOR( sSectorX, sSectorY ) ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- ubSectorID mismatch. KM" ); + sprintf( zReason, "EnemySoldier -- ubSectorID mismatch. KM" ); #endif goto FAIL_LOAD; } @@ -1137,7 +976,7 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile() } if( ubStrategicCreatures > ubNumCreatures ) { - ubStrategicCreatures; //not sure if this wil ever happen. If so, needs to be handled. + ubStrategicCreatures; //not sure if this wil ever happen. If so, needs to be handled. } @@ -1150,7 +989,7 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile() if( !pSector ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- Couldn't find underground sector info for (%d,%d,%d) KM", sSectorX, sSectorY, bSectorZ ); + sprintf( zReason, "EnemySoldier -- Couldn't find underground sector info for (%d,%d,%d) KM", sSectorX, sSectorY, bSectorZ ); #endif goto FAIL_LOAD; @@ -1182,8 +1021,8 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile() return TRUE; FAIL_LOAD: - //The temp file load failed either because of IO problems related to hacking/logic, or - //various checks failed for hacker validation. If we reach this point, the "error: exit game" + //The temp file load failed either because of IO problems related to hacking/logic, or + //various checks failed for hacker validation. If we reach this point, the "error: exit game" //dialog would appear in a non-testversion. FileClose( hfile ); #ifdef JA2TESTVERSION @@ -1206,7 +1045,6 @@ BOOLEAN NewWayOfLoadingCiviliansFromTempFile() UINT32 uiTimeSinceLastLoaded; HWFILE hfile; INT16 sSectorX, sSectorY; - UINT16 usCheckSum, usFileCheckSum; // CHAR8 zTempName[ 128 ]; CHAR8 zMapName[ 128 ]; #ifdef JA2TESTVERSION @@ -1214,13 +1052,12 @@ BOOLEAN NewWayOfLoadingCiviliansFromTempFile() #endif INT8 bSectorZ; UINT8 ubSectorID; - UINT8 ubNumElites = 0, ubNumTroops = 0, ubNumAdmins = 0, ubNumCreatures = 0; BOOLEAN fDeleted; // UINT8 ubStrategicElites, ubStrategicTroops, ubStrategicAdmins, ubStrategicCreatures; - + gfRestoringCiviliansFromTempFile = TRUE; - //STEP ONE: Set up the temp file to read from. + //STEP ONE: Set up the temp file to read from. //Convert the current sector location into a file name //GetMapFileName( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, zTempName, FALSE ); @@ -1236,42 +1073,42 @@ BOOLEAN NewWayOfLoadingCiviliansFromTempFile() return FALSE; } - //STEP TWO: determine whether or not we should use this data. + //STEP TWO: determine whether or not we should use this data. //because it is the demo, it is automatically used. FileRead( hfile, &sSectorY, 2, &uiNumBytesRead ); if( uiNumBytesRead != 2 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "Civilian -- EOF while reading sSectorY. KM" ); + sprintf( zReason, "Civilian -- EOF while reading sSectorY. KM" ); #endif goto FAIL_LOAD; } if( gWorldSectorY != sSectorY ) { #ifdef JA2TESTVERSION - sprintf( zReason, "Civilian -- sSectorY mismatch. KM" ); + sprintf( zReason, "Civilian -- sSectorY mismatch. KM" ); #endif goto FAIL_LOAD; } - + //LoadSoldierInitListLinks( hfile ); NewWayOfLoadingCivilianInitListLinks( hfile ); - //STEP THREE: read the data + //STEP THREE: read the data FileRead( hfile, &sSectorX, 2, &uiNumBytesRead ); if( uiNumBytesRead != 2 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "Civilian -- EOF while reading sSectorX. KM" ); + sprintf( zReason, "Civilian -- EOF while reading sSectorX. KM" ); #endif goto FAIL_LOAD; } if( gWorldSectorX != sSectorX ) { #ifdef JA2TESTVERSION - sprintf( zReason, "Civilian -- sSectorX mismatch. KM" ); + sprintf( zReason, "Civilian -- sSectorX mismatch. KM" ); #endif goto FAIL_LOAD; } @@ -1280,7 +1117,7 @@ BOOLEAN NewWayOfLoadingCiviliansFromTempFile() if( uiNumBytesRead != 4 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "Civilian -- EOF while reading slots. KM" ); + sprintf( zReason, "Civilian -- EOF while reading slots. KM" ); #endif goto FAIL_LOAD; } @@ -1289,32 +1126,32 @@ BOOLEAN NewWayOfLoadingCiviliansFromTempFile() if( uiNumBytesRead != 4 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "Civilian -- EOF while reading uiTimeStamp. KM" ); + sprintf( zReason, "Civilian -- EOF while reading uiTimeStamp. KM" ); #endif goto FAIL_LOAD; } - + uiTimeSinceLastLoaded = GetWorldTotalMin() - uiTimeStamp; FileRead( hfile, &bSectorZ, 1, &uiNumBytesRead ); if( uiNumBytesRead != 1 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "Civilian -- EOF while reading bSectorZ. KM" ); + sprintf( zReason, "Civilian -- EOF while reading bSectorZ. KM" ); #endif goto FAIL_LOAD; } if( gbWorldSectorZ != bSectorZ ) { #ifdef JA2TESTVERSION - sprintf( zReason, "Civilian -- bSectorZ mismatch. KM" ); + sprintf( zReason, "Civilian -- bSectorZ mismatch. KM" ); #endif goto FAIL_LOAD; } if( !slots ) { - //no need to restore the enemy's to the map. This means we are restoring a saved game. + //no need to restore the enemy's to the map. This means we are restoring a saved game. gfRestoringCiviliansFromTempFile = FALSE; FileClose( hfile ); return TRUE; @@ -1323,12 +1160,12 @@ BOOLEAN NewWayOfLoadingCiviliansFromTempFile() { //bad IO! #ifdef JA2TESTVERSION - sprintf( zReason, "Civilian -- illegal slot value of %d. KM", slots ); + sprintf( zReason, "Civilian -- illegal slot value of %d. KM", slots ); #endif goto FAIL_LOAD; } - //For all the enemy slots (enemy/creature), clear the fPriorityExistance flag. We will use these flags + //For all the enemy slots (enemy/creature), clear the fPriorityExistance flag. We will use these flags //to determine which slots have been modified as we load the data into the map pristine soldier init list. curr = gSoldierInitHead; while( curr ) @@ -1345,19 +1182,16 @@ BOOLEAN NewWayOfLoadingCiviliansFromTempFile() for( i = 0; i < slots; i++ ) { - // WDS - Clean up inventory handling - FileRead( hfile, &tempDetailedPlacement, SIZEOF_SOLDIERCREATE_STRUCT_POD, &uiNumBytesRead ); - if( uiNumBytesRead != SIZEOF_SOLDIERCREATE_STRUCT_POD) + if ( !tempDetailedPlacement.Load(hfile, gCivPreservedTempFileVersion[SECTOR(sSectorX, sSectorY)], true) ) { #ifdef JA2TESTVERSION - sprintf( zReason, "Civilian -- EOF while reading tempDetailedPlacment %d. KM", i ); + sprintf( zReason, "Civilian -- EOF while reading tempDetailedPlacment %d. KM", i ); #endif goto FAIL_LOAD; } - tempDetailedPlacement.CopyOldInventoryToNew(); curr = gSoldierInitHead; while( curr ) - { + { if( !curr->pBasicPlacement->fPriorityExistance ) { if( !curr->pDetailedPlacement || curr->pDetailedPlacement && curr->pDetailedPlacement->ubProfile == NO_PROFILE ) @@ -1372,9 +1206,8 @@ BOOLEAN NewWayOfLoadingCiviliansFromTempFile() curr->pDetailedPlacement = new SOLDIERCREATE_STRUCT; } //now replace the map pristine placement info with the temp map file version.. - //memcpy( curr->pDetailedPlacement, &tempDetailedPlacement, SIZEOF_SOLDIERCREATE_STRUCT ); *curr->pDetailedPlacement = tempDetailedPlacement; - + curr->pBasicPlacement->fPriorityExistance = TRUE; curr->pBasicPlacement->ubDirection = curr->pDetailedPlacement->ubDirection; curr->pBasicPlacement->bOrders = curr->pDetailedPlacement->bOrders; @@ -1384,54 +1217,13 @@ BOOLEAN NewWayOfLoadingCiviliansFromTempFile() curr->pBasicPlacement->ubSoldierClass = curr->pDetailedPlacement->ubSoldierClass; curr->pBasicPlacement->ubCivilianGroup = curr->pDetailedPlacement->ubCivilianGroup; curr->pBasicPlacement->fHasKeys = curr->pDetailedPlacement->fHasKeys; - curr->pBasicPlacement->usStartingGridNo = curr->pDetailedPlacement->sInsertionGridNo; + curr->pBasicPlacement->sStartingGridNo = curr->pDetailedPlacement->sInsertionGridNo; curr->pBasicPlacement->bPatrolCnt = curr->pDetailedPlacement->bPatrolCnt; - memcpy( curr->pBasicPlacement->sPatrolGrid, curr->pDetailedPlacement->sPatrolGrid, + memcpy( curr->pBasicPlacement->sPatrolGrid, curr->pDetailedPlacement->sPatrolGrid, sizeof( INT16 ) * curr->pBasicPlacement->bPatrolCnt ); - FileRead( hfile, &usCheckSum, 2, &uiNumBytesRead ); - if( uiNumBytesRead != 2 ) - { - #ifdef JA2TESTVERSION - sprintf( zReason, "Civilian -- EOF while reading usCheckSum %d. KM", i ); - #endif - goto FAIL_LOAD; - } - //verify the checksum equation (anti-hack) -- see save - usFileCheckSum = - curr->pDetailedPlacement->bLife * 7 + - curr->pDetailedPlacement->bLifeMax * 8 - - curr->pDetailedPlacement->bAgility * 2 + - curr->pDetailedPlacement->bDexterity * 1 + - curr->pDetailedPlacement->bExpLevel * 5 - - curr->pDetailedPlacement->bMarksmanship * 9 + - curr->pDetailedPlacement->bMedical * 10 + - curr->pDetailedPlacement->bMechanical * 3 + - curr->pDetailedPlacement->bExplosive * 4 + - curr->pDetailedPlacement->bLeadership * 5 + - curr->pDetailedPlacement->bStrength * 7 + - curr->pDetailedPlacement->bWisdom * 11 + - curr->pDetailedPlacement->bMorale * 7 + - curr->pDetailedPlacement->bAIMorale * 3 - - curr->pDetailedPlacement->bBodyType * 7 + - 4 * 6 + - curr->pDetailedPlacement->sSectorX * 7 - - curr->pDetailedPlacement->ubSoldierClass * 4 + - curr->pDetailedPlacement->bTeam * 7 + - curr->pDetailedPlacement->ubDirection * 5 + - curr->pDetailedPlacement->fOnRoof * 17 + - curr->pDetailedPlacement->sInsertionGridNo * 1 + - 3; - if( usCheckSum != usFileCheckSum ) - { - //Hacker has modified the stats on the enemy placements. - #ifdef JA2TESTVERSION - sprintf( zReason, "Civilian -- checksum for placement %d failed. KM", i ); - #endif - goto FAIL_LOAD; - } - + if( curr->pDetailedPlacement->bLife < curr->pDetailedPlacement->bLifeMax ) { //Add 4 life for every hour that passes. INT32 iNewLife; @@ -1457,7 +1249,7 @@ BOOLEAN NewWayOfLoadingCiviliansFromTempFile() curr = gSoldierInitHead; fDeleted = FALSE; while( curr ) - { + { if( !curr->pBasicPlacement->fPriorityExistance ) { if( !curr->pDetailedPlacement || curr->pDetailedPlacement && curr->pDetailedPlacement->ubProfile == NO_PROFILE ) @@ -1488,7 +1280,7 @@ BOOLEAN NewWayOfLoadingCiviliansFromTempFile() if( uiNumBytesRead != 1 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "Civilian -- EOF while reading ubSectorID. KM" ); + sprintf( zReason, "Civilian -- EOF while reading ubSectorID. KM" ); #endif goto FAIL_LOAD; } @@ -1497,7 +1289,7 @@ BOOLEAN NewWayOfLoadingCiviliansFromTempFile() if( ubSectorID != SECTOR( sSectorX, sSectorY ) ) { #ifdef JA2TESTVERSION - sprintf( zReason, "Civilian -- ubSectorID mismatch. KM" ); + sprintf( zReason, "Civilian -- ubSectorID mismatch. KM" ); #endif goto FAIL_LOAD; } @@ -1508,8 +1300,8 @@ BOOLEAN NewWayOfLoadingCiviliansFromTempFile() return TRUE; FAIL_LOAD: - //The temp file load failed either because of IO problems related to hacking/logic, or - //various checks failed for hacker validation. If we reach this point, the "error: exit game" + //The temp file load failed either because of IO problems related to hacking/logic, or + //various checks failed for hacker validation. If we reach this point, the "error: exit game" //dialog would appear in a non-testversion. FileClose( hfile ); #ifdef JA2TESTVERSION @@ -1519,8 +1311,8 @@ BOOLEAN NewWayOfLoadingCiviliansFromTempFile() } -//If we are saving a game and we are in the sector, we will need to preserve the links between the -//soldiers and the soldier init list. Otherwise, the temp file will be deleted. +//If we are saving a game and we are in the sector, we will need to preserve the links between the +//soldiers and the soldier init list. Otherwise, the temp file will be deleted. BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, BOOLEAN fEnemy, BOOLEAN fValidateOnly ) { SOLDIERINITNODE *curr; @@ -1533,7 +1325,6 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY // CHAR8 zTempName[ 128 ]; CHAR8 zMapName[ 128 ]; UINT8 ubSectorID; - UINT16 usCheckSum; UINT8 ubStartID=0; UINT8 ubEndID = 0; @@ -1556,7 +1347,7 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY - //STEP ONE: Prep the soldiers for saving... + //STEP ONE: Prep the soldiers for saving... //modify the map's soldier init list to reflect the changes to the members still alive... for( i = gTacticalStatus.Team[ ubStartID ].bFirstID; i <= gTacticalStatus.Team[ ubEndID ].bLastID; i++ ) @@ -1564,7 +1355,7 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY pSoldier = MercPtrs[ i ]; //make sure the person is active, alive, in the sector, and is not a profiled person - if( pSoldier->bActive /*&& pSoldier->bInSector*/ && pSoldier->bLife && pSoldier->ubProfile == NO_PROFILE ) + if( pSoldier->bActive /*&& pSoldier->bInSector*/ && pSoldier->stats.bLife && pSoldier->ubProfile == NO_PROFILE ) { //soldier is valid, so find the matching soldier init list entry for modification. curr = gSoldierInitHead; while( curr && curr->pSoldier != pSoldier ) @@ -1572,7 +1363,7 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY curr = curr->next; } if( curr && curr->pSoldier == pSoldier && pSoldier->ubProfile == NO_PROFILE ) - { //found a match. + { //found a match. if( !fValidateOnly ) { @@ -1581,71 +1372,22 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY if( !curr->pDetailedPlacement ) { //need to upgrade the placement to detailed placement curr->pBasicPlacement->fDetailedPlacement = TRUE; - // WDS - Clean up inventory handling - curr->pDetailedPlacement = new SOLDIERCREATE_STRUCT; - curr->pDetailedPlacement->initialize(); - //memset( curr->pDetailedPlacement, 0, SIZEOF_SOLDIERCREATE_STRUCT ); + curr->pDetailedPlacement = new SOLDIERCREATE_STRUCT; //(SOLDIERCREATE_STRUCT*)MemAlloc( SIZEOF_SOLDIERCREATE_STRUCT ); } + *curr->pDetailedPlacement = *pSoldier; - //Copy over the data of the soldier. - curr->pDetailedPlacement->ubProfile = NO_PROFILE; - curr->pDetailedPlacement->bLife = pSoldier->bLife; - curr->pDetailedPlacement->bLifeMax = pSoldier->bLifeMax; - curr->pDetailedPlacement->bAgility = pSoldier->bAgility; - curr->pDetailedPlacement->bDexterity = pSoldier->bDexterity; - curr->pDetailedPlacement->bExpLevel = pSoldier->bExpLevel; - curr->pDetailedPlacement->bMarksmanship = pSoldier->bMarksmanship; - curr->pDetailedPlacement->bMedical = pSoldier->bMedical; - curr->pDetailedPlacement->bMechanical = pSoldier->bMechanical; - curr->pDetailedPlacement->bExplosive = pSoldier->bExplosive; - curr->pDetailedPlacement->bLeadership = pSoldier->bLeadership; - curr->pDetailedPlacement->bStrength = pSoldier->bStrength; - curr->pDetailedPlacement->bWisdom = pSoldier->bWisdom; - curr->pDetailedPlacement->bAttitude = pSoldier->bAttitude; - curr->pDetailedPlacement->bOrders = pSoldier->bOrders; - curr->pDetailedPlacement->bMorale = pSoldier->bMorale; - curr->pDetailedPlacement->bAIMorale = pSoldier->bAIMorale; - curr->pDetailedPlacement->bBodyType = pSoldier->ubBodyType; - curr->pDetailedPlacement->ubCivilianGroup = pSoldier->ubCivilianGroup; - curr->pDetailedPlacement->ubScheduleID = pSoldier->ubScheduleID; - curr->pDetailedPlacement->fHasKeys = pSoldier->bHasKeys; - curr->pDetailedPlacement->sSectorX = pSoldier->sSectorX; - curr->pDetailedPlacement->sSectorY = pSoldier->sSectorY; - curr->pDetailedPlacement->bSectorZ = pSoldier->bSectorZ; - curr->pDetailedPlacement->ubSoldierClass = pSoldier->ubSoldierClass; - curr->pDetailedPlacement->bTeam = pSoldier->bTeam; - curr->pDetailedPlacement->ubDirection = pSoldier->ubDirection; - - //we don't want the player to think that all the enemies start in the exact position when we + //we don't want the player to think that all the enemies start in the exact position when we //left the map, so randomize the start locations either current position or original position. if( PreRandom( 2 ) ) - { //use current position - curr->pDetailedPlacement->fOnRoof = pSoldier->bLevel; - curr->pDetailedPlacement->sInsertionGridNo = pSoldier->sGridNo; + { + //use current position, which is already copied over } else - { //use original position - curr->pDetailedPlacement->fOnRoof = curr->pBasicPlacement->fOnRoof; - curr->pDetailedPlacement->sInsertionGridNo = curr->pBasicPlacement->usStartingGridNo; + { + //use original position + curr->pDetailedPlacement->fOnRoof = curr->pBasicPlacement->fOnRoof; + curr->pDetailedPlacement->sInsertionGridNo = curr->pBasicPlacement->sStartingGridNo; } - - swprintf( curr->pDetailedPlacement->name, pSoldier->name ); - - //Copy patrol points - curr->pDetailedPlacement->bPatrolCnt = pSoldier->bPatrolCnt; - memcpy( curr->pDetailedPlacement->sPatrolGrid, pSoldier->usPatrolGrid, sizeof( INT16 ) * MAXPATROLGRIDS ); - - //copy colors for soldier based on the body type. - sprintf( curr->pDetailedPlacement->HeadPal, pSoldier->HeadPal ); - sprintf( curr->pDetailedPlacement->VestPal, pSoldier->VestPal ); - sprintf( curr->pDetailedPlacement->SkinPal, pSoldier->SkinPal ); - sprintf( curr->pDetailedPlacement->PantsPal, pSoldier->PantsPal ); - sprintf( curr->pDetailedPlacement->MiscPal, pSoldier->MiscPal ); - - //copy soldier's inventory - // WDS - Clean up inventory handling - //memcpy( curr->pDetailedPlacement->Inv, pSoldier->inv, sizeof( OBJECTTYPE ) * NUM_INV_SLOTS ); - curr->pDetailedPlacement->Inv = pSoldier->inv; } } @@ -1677,7 +1419,7 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY return( TRUE ); } - //STEP TWO: Set up the temp file to write to. + //STEP TWO: Set up the temp file to write to. //Convert the current sector location into a file name //GetMapFileName( sSectorX, sSectorY, bSectorZ, zTempName, FALSE ); @@ -1708,7 +1450,7 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY goto FAIL_SAVE; } - //STEP THREE: Save the data + //STEP THREE: Save the data //this works for both civs and enemies SaveSoldierInitListLinks( hfile ); @@ -1719,11 +1461,11 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY goto FAIL_SAVE; } - //This check may appear confusing. It is intended to abort if the player is saving the game. It is only + //This check may appear confusing. It is intended to abort if the player is saving the game. It is only //supposed to preserve the links to the placement list, so when we finally do leave the level with enemies remaining, //we will need the links that are only added when the map is loaded, and are normally lost when restoring a save. if( gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) - { + { slots = 0; } @@ -1739,7 +1481,7 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY { goto FAIL_SAVE; } - + FileWrite( hfile, &bSectorZ, 1, &uiNumBytesWritten ); if( uiNumBytesWritten != 1 ) { @@ -1747,8 +1489,8 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY } if( gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) - { - //if we are saving the game, we don't need to preserve the soldier information, just + { + //if we are saving the game, we don't need to preserve the soldier information, just //preserve the links to the placement list. slots = 0; FileClose( hfile ); @@ -1768,8 +1510,8 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY { pSoldier = MercPtrs[ i ]; // CJC: note that bInSector is not required; the civ could be offmap! - if( pSoldier->bActive /*&& pSoldier->bInSector*/ && pSoldier->bLife ) - { + if( pSoldier->bActive /*&& pSoldier->bInSector*/ && pSoldier->stats.bLife ) + { //soldier is valid, so find the matching soldier init list entry for modification. curr = gSoldierInitHead; while( curr && curr->pSoldier != pSoldier ) @@ -1778,45 +1520,11 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY } if( curr && curr->pSoldier == pSoldier && pSoldier->ubProfile == NO_PROFILE ) { - //found a match. - // WDS - Clean up inventory handling - curr->pDetailedPlacement->CopyNewInventoryToOld(); - FileWrite( hfile, curr->pDetailedPlacement, SIZEOF_SOLDIERCREATE_STRUCT_POD, &uiNumBytesWritten ); - if( uiNumBytesWritten != SIZEOF_SOLDIERCREATE_STRUCT_POD ) + //found a match. + if ( !curr->pDetailedPlacement->Save(hfile, FALSE) ) { goto FAIL_SAVE; } - //insert a checksum equation (anti-hack) - usCheckSum = - curr->pDetailedPlacement->bLife * 7 + - curr->pDetailedPlacement->bLifeMax * 8 - - curr->pDetailedPlacement->bAgility * 2 + - curr->pDetailedPlacement->bDexterity * 1 + - curr->pDetailedPlacement->bExpLevel * 5 - - curr->pDetailedPlacement->bMarksmanship * 9 + - curr->pDetailedPlacement->bMedical * 10 + - curr->pDetailedPlacement->bMechanical * 3 + - curr->pDetailedPlacement->bExplosive * 4 + - curr->pDetailedPlacement->bLeadership * 5 + - curr->pDetailedPlacement->bStrength * 7 + - curr->pDetailedPlacement->bWisdom * 11 + - curr->pDetailedPlacement->bMorale * 7 + - curr->pDetailedPlacement->bAIMorale * 3 - - curr->pDetailedPlacement->bBodyType * 7 + - 4 * 6 + - curr->pDetailedPlacement->sSectorX * 7 - - curr->pDetailedPlacement->ubSoldierClass * 4 + - curr->pDetailedPlacement->bTeam * 7 + - curr->pDetailedPlacement->ubDirection * 5 + - curr->pDetailedPlacement->fOnRoof * 17 + - curr->pDetailedPlacement->sInsertionGridNo * 1 + - 3; - FileWrite( hfile, &usCheckSum, 2, &uiNumBytesWritten ); - if( uiNumBytesWritten != 2 ) - { - goto FAIL_SAVE; - - } } } } @@ -1833,10 +1541,12 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY if( fEnemy ) { SetSectorFlag( sSectorX, sSectorY, bSectorZ, SF_ENEMY_PRESERVED_TEMP_FILE_EXISTS ); + gEnemyPreservedTempFileVersion[SECTOR(sSectorX, sSectorY)] = SAVE_GAME_VERSION; } else { SetSectorFlag( sSectorX, sSectorY, bSectorZ, SF_CIV_PRESERVED_TEMP_FILE_EXISTS ); + gCivPreservedTempFileVersion[SECTOR(sSectorX, sSectorY)] = SAVE_GAME_VERSION; } return TRUE; @@ -1860,7 +1570,6 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( UINT32 uiTimeStamp; HWFILE hfile; INT16 sSectorX, sSectorY; - UINT16 usCheckSum; CHAR8 zMapName[ 128 ]; #ifdef JA2TESTVERSION CHAR8 zReason[256]; @@ -1869,8 +1578,8 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( UINT8 ubSectorID; // UINT8 ubNumElites = 0, ubNumTroops = 0, ubNumAdmins = 0, ubNumCreatures = 0; // UINT8 ubStrategicElites, ubStrategicTroops, ubStrategicAdmins, ubStrategicCreatures; - - + + //make sure the variables are initialized *pubNumElites = 0; @@ -1879,7 +1588,7 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( *pubNumCreatures = 0; - //STEP ONE: Set up the temp file to read from. + //STEP ONE: Set up the temp file to read from. //Convert the current sector location into a file name @@ -1897,42 +1606,42 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( return FALSE; } - //STEP TWO: determine whether or not we should use this data. + //STEP TWO: determine whether or not we should use this data. //because it is the demo, it is automatically used. FileRead( hfile, &sSectorY, 2, &uiNumBytesRead ); if( uiNumBytesRead != 2 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "Check EnemySoldier -- EOF while reading sSectorY. KM" ); + sprintf( zReason, "Check EnemySoldier -- EOF while reading sSectorY. KM" ); #endif goto FAIL_LOAD; } if( gWorldSectorY != sSectorY ) { #ifdef JA2TESTVERSION - sprintf( zReason, "Check EnemySoldier -- sSectorY mismatch. KM" ); + sprintf( zReason, "Check EnemySoldier -- sSectorY mismatch. KM" ); #endif goto FAIL_LOAD; } - + // LoadSoldierInitListLinks( hfile ); LookAtButDontProcessEnemySoldierInitListLinks( hfile ); - - //STEP THREE: read the data + + //STEP THREE: read the data FileRead( hfile, &sSectorX, 2, &uiNumBytesRead ); if( uiNumBytesRead != 2 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "Check EnemySoldier -- EOF while reading sSectorX. KM" ); + sprintf( zReason, "Check EnemySoldier -- EOF while reading sSectorX. KM" ); #endif goto FAIL_LOAD; } if( gWorldSectorX != sSectorX ) { #ifdef JA2TESTVERSION - sprintf( zReason, "Check EnemySoldier -- sSectorX mismatch. KM" ); + sprintf( zReason, "Check EnemySoldier -- sSectorX mismatch. KM" ); #endif goto FAIL_LOAD; } @@ -1941,7 +1650,7 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( if( uiNumBytesRead != 4 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "Check EnemySoldier -- EOF while reading slots. KM" ); + sprintf( zReason, "Check EnemySoldier -- EOF while reading slots. KM" ); #endif goto FAIL_LOAD; } @@ -1950,7 +1659,7 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( if( uiNumBytesRead != 4 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "Check EnemySoldier -- EOF while reading uiTimeStamp. KM" ); + sprintf( zReason, "Check EnemySoldier -- EOF while reading uiTimeStamp. KM" ); #endif goto FAIL_LOAD; } @@ -1960,7 +1669,7 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( if( uiNumBytesRead != 1 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "Check EnemySoldier -- EOF while reading bSectorZ. KM" ); + sprintf( zReason, "Check EnemySoldier -- EOF while reading bSectorZ. KM" ); #endif goto FAIL_LOAD; } @@ -1968,14 +1677,14 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( if( gbWorldSectorZ != bSectorZ ) { #ifdef JA2TESTVERSION - sprintf( zReason, "Check EnemySoldier -- bSectorZ mismatch. KM" ); + sprintf( zReason, "Check EnemySoldier -- bSectorZ mismatch. KM" ); #endif goto FAIL_LOAD; } if( !slots ) { - //no need to restore the enemy's to the map. This means we are restoring a saved game. + //no need to restore the enemy's to the map. This means we are restoring a saved game. FileClose( hfile ); return TRUE; } @@ -1984,7 +1693,7 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( if( slots < 0 || slots >= 64 ) { //bad IO! #ifdef JA2TESTVERSION - sprintf( zReason, "Check EnemySoldier -- illegal slot value of %d. KM", slots ); + sprintf( zReason, "Check EnemySoldier -- illegal slot value of %d. KM", slots ); #endif goto FAIL_LOAD; } @@ -1998,13 +1707,13 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( if( !pSector ) { #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- Couldn't find underground sector info for (%d,%d,%d) KM", sSectorX, sSectorY, bSectorZ ); + sprintf( zReason, "EnemySoldier -- Couldn't find underground sector info for (%d,%d,%d) KM", sSectorX, sSectorY, bSectorZ ); #endif goto FAIL_LOAD; } - ubStrategicElites = pSector->ubNumElites; - ubStrategicTroops = pSector->ubNumTroops; - ubStrategicAdmins = pSector->ubNumAdmins; + ubStrategicElites = pSector->ubNumElites; + ubStrategicTroops = pSector->ubNumTroops; + ubStrategicAdmins = pSector->ubNumAdmins; ubStrategicCreatures = pSector->ubNumCreatures; } else @@ -2018,16 +1727,13 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( for( i = 0; i < slots; i++ ) { - // WDS - Clean up inventory handling - FileRead( hfile, &tempDetailedPlacement, SIZEOF_SOLDIERCREATE_STRUCT_POD, &uiNumBytesRead ); - if( uiNumBytesRead != SIZEOF_SOLDIERCREATE_STRUCT_POD) + if ( !tempDetailedPlacement.Load(hfile, gEnemyPreservedTempFileVersion[SECTOR( sSectorX,sSectorY)], true) ) { #ifdef JA2TESTVERSION - sprintf( zReason, "Check EnemySoldier -- EOF while reading tempDetailedPlacment %d. KM", i ); + sprintf( zReason, "Check EnemySoldier -- EOF while reading tempDetailedPlacment %d. KM", i ); #endif goto FAIL_LOAD; } - tempDetailedPlacement.CopyOldInventoryToNew(); //increment the current type of soldier switch( tempDetailedPlacement.ubSoldierClass ) @@ -2035,43 +1741,31 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( case SOLDIER_CLASS_ELITE: (*pubNumElites)++; break; - case SOLDIER_CLASS_ARMY: + case SOLDIER_CLASS_ARMY: (*pubNumRegulars)++; break; - case SOLDIER_CLASS_ADMINISTRATOR: + case SOLDIER_CLASS_ADMINISTRATOR: (*pubNumAdmins)++; break; - case SOLDIER_CLASS_CREATURE: + case SOLDIER_CLASS_CREATURE: (*pubNumCreatures)++; break; } - - - FileRead( hfile, &usCheckSum, 2, &uiNumBytesRead ); - if( uiNumBytesRead != 2 ) - { - #ifdef JA2TESTVERSION - sprintf( zReason, "Check EnemySoldier -- EOF while reading usCheckSum %d. KM", i ); - #endif - goto FAIL_LOAD; - } /* while( curr ) - { + { if( !curr->pBasicPlacement->fPriorityExistance ) { if( curr->pBasicPlacement->bTeam == tempDetailedPlacement.bTeam ) { - // WDS - Clean up inventory handling curr->pBasicPlacement->fPriorityExistance = TRUE; if( !curr->pDetailedPlacement ) { //need to upgrade the placement to detailed placement - curr->pDetailedPlacement = new (MemAlloc( SIZEOF_SOLDIERCREATE_STRUCT )) SOLDIERCREATE_STRUCT; + curr->pDetailedPlacement = new SOLDIERCREATE_STRUCT; } //now replace the map pristine placement info with the temp map file version.. -// memcpy( curr->pDetailedPlacement, &tempDetailedPlacement, SIZEOF_SOLDIERCREATE_STRUCT ); *curr->pDetailedPlacement = tempDetailedPlacement; - + curr->pBasicPlacement->fPriorityExistance = TRUE; curr->pBasicPlacement->ubDirection = curr->pDetailedPlacement->ubDirection; curr->pBasicPlacement->bOrders = curr->pDetailedPlacement->bOrders; @@ -2081,79 +1775,39 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( curr->pBasicPlacement->ubSoldierClass = curr->pDetailedPlacement->ubSoldierClass; curr->pBasicPlacement->ubCivilianGroup = curr->pDetailedPlacement->ubCivilianGroup; curr->pBasicPlacement->fHasKeys = curr->pDetailedPlacement->fHasKeys; - curr->pBasicPlacement->usStartingGridNo = curr->pDetailedPlacement->sInsertionGridNo; + curr->pBasicPlacement->usStartingGridNo = curr->pDetailedPlacement->sInsertionGridNo; curr->pBasicPlacement->bPatrolCnt = curr->pDetailedPlacement->bPatrolCnt; - memcpy( curr->pBasicPlacement->sPatrolGrid, curr->pDetailedPlacement->sPatrolGrid, + memcpy( curr->pBasicPlacement->sPatrolGrid, curr->pDetailedPlacement->sPatrolGrid, sizeof( INT16 ) * curr->pBasicPlacement->bPatrolCnt ); - FileRead( hfile, &usCheckSum, 2, &uiNumBytesRead ); - if( uiNumBytesRead != 2 ) - { - #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- EOF while reading usCheckSum %d. KM", i ); - #endif - goto FAIL_LOAD; - } - //verify the checksum equation (anti-hack) -- see save - usFileCheckSum = - curr->pDetailedPlacement->bLife * 7 + - curr->pDetailedPlacement->bLifeMax * 8 - - curr->pDetailedPlacement->bAgility * 2 + - curr->pDetailedPlacement->bDexterity * 1 + - curr->pDetailedPlacement->bExpLevel * 5 - - curr->pDetailedPlacement->bMarksmanship * 9 + - curr->pDetailedPlacement->bMedical * 10 + - curr->pDetailedPlacement->bMechanical * 3 + - curr->pDetailedPlacement->bExplosive * 4 + - curr->pDetailedPlacement->bLeadership * 5 + - curr->pDetailedPlacement->bStrength * 7 + - curr->pDetailedPlacement->bWisdom * 11 + - curr->pDetailedPlacement->bMorale * 7 + - curr->pDetailedPlacement->bAIMorale * 3 - - curr->pDetailedPlacement->bBodyType * 7 + - 4 * 6 + - curr->pDetailedPlacement->sSectorX * 7 - - curr->pDetailedPlacement->ubSoldierClass * 4 + - curr->pDetailedPlacement->bTeam * 7 + - curr->pDetailedPlacement->ubDirection * 5 + - curr->pDetailedPlacement->fOnRoof * 17 + - curr->pDetailedPlacement->sInsertionGridNo * 1 + - 3; - if( usCheckSum != usFileCheckSum ) - { //Hacker has modified the stats on the enemy placements. - #ifdef JA2TESTVERSION - sprintf( zReason, "EnemySoldier -- checksum for placement %d failed. KM", i ); - #endif - goto FAIL_LOAD; - } //Add preserved placements as long as they don't exceed the actual population. switch( curr->pBasicPlacement->ubSoldierClass ) { case SOLDIER_CLASS_ELITE: - ubNumElites++; + ubNumElites++; if( ubNumElites <= ubStrategicElites ) { AddPlacementToWorld( curr ); } break; - case SOLDIER_CLASS_ARMY: - ubNumTroops++; + case SOLDIER_CLASS_ARMY: + ubNumTroops++; if( ubNumTroops <= ubStrategicTroops ) { AddPlacementToWorld( curr ); } break; - case SOLDIER_CLASS_ADMINISTRATOR: - ubNumAdmins++; + case SOLDIER_CLASS_ADMINISTRATOR: + ubNumAdmins++; if( ubNumAdmins <= ubStrategicAdmins ) { AddPlacementToWorld( curr ); } break; - case SOLDIER_CLASS_CREATURE: - ubNumCreatures++; + case SOLDIER_CLASS_CREATURE: + ubNumCreatures++; if( ubNumCreatures <= ubStrategicCreatures ) { AddPlacementToWorld( curr ); @@ -2167,12 +1821,12 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( } */ } - + FileRead( hfile, &ubSectorID, 1, &uiNumBytesRead ); if( uiNumBytesRead != 1 ) { #ifdef JA2TESTVERSION - sprintf( zReason, "Check EnemySoldier -- EOF while reading ubSectorID. KM" ); + sprintf( zReason, "Check EnemySoldier -- EOF while reading ubSectorID. KM" ); #endif goto FAIL_LOAD; } @@ -2180,7 +1834,7 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( if( ubSectorID != SECTOR( sSectorX, sSectorY ) ) { #ifdef JA2TESTVERSION - sprintf( zReason, "Check EnemySoldier -- ubSectorID mismatch. KM" ); + sprintf( zReason, "Check EnemySoldier -- ubSectorID mismatch. KM" ); #endif goto FAIL_LOAD; } @@ -2190,8 +1844,8 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( return TRUE; FAIL_LOAD: - //The temp file load failed either because of IO problems related to hacking/logic, or - //various checks failed for hacker validation. If we reach this point, the "error: exit game" + //The temp file load failed either because of IO problems related to hacking/logic, or + //various checks failed for hacker validation. If we reach this point, the "error: exit game" //dialog would appear in a non-testversion. FileClose( hfile ); #ifdef JA2TESTVERSION @@ -2202,3 +1856,4 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( + diff --git a/Tactical/Enemy Soldier Save.h b/Tactical/Enemy Soldier Save.h index c31b67d8..9d22adf6 100644 --- a/Tactical/Enemy Soldier Save.h +++ b/Tactical/Enemy Soldier Save.h @@ -6,14 +6,14 @@ //This funciton load both the enemies AND the civilians, now only used to load old saves BOOLEAN LoadEnemySoldiersFromTempFile(); -//The new way of loading in enemies from the temp file. ONLY the ENEMIES are stored in the e_* temp file +//The new way of loading in enemies from the temp file. ONLY the ENEMIES are stored in the e_* temp file BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile(); -//The new way of loading in CIVILIANS from the temp file. ONLY the CIVILIEANS are stored in the c_* temp file +//The new way of loading in CIVILIANS from the temp file. ONLY the CIVILIEANS are stored in the c_* temp file BOOLEAN NewWayOfLoadingCiviliansFromTempFile(); -BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, BOOLEAN fEnemy, BOOLEAN fValidateOnly ); +BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, BOOLEAN fEnemy, BOOLEAN fValidateOnly ); diff --git a/Tactical/EnemyItemDrops.cpp b/Tactical/EnemyItemDrops.cpp index 55b35e13..8ef5ba5b 100644 --- a/Tactical/EnemyItemDrops.cpp +++ b/Tactical/EnemyItemDrops.cpp @@ -2,7 +2,6 @@ #include "Tactical All.h" #else #include "Types.h" - #include "Item Types.h" #include "DEbug.h" #include "EnemyItemDrops.h" #endif diff --git a/Tactical/Faces.cpp b/Tactical/Faces.cpp index 90f49dd2..426bb9e3 100644 --- a/Tactical/Faces.cpp +++ b/Tactical/Faces.cpp @@ -20,7 +20,7 @@ #include "overhead.h" #include "gap.h" #include "Soldier Profile.h" - #include "sound control.h" + #include "Sound Control.h" #include "teamturns.h" #include "soldier macros.h" #include "dialogue control.h" @@ -31,7 +31,7 @@ #include "GameSettings.h" #include "squads.h" #include "interface.h" - #include "Quests.h" + #include "Quests.h" #include "animation control.h" #include "drugs and alcohol.h" #include "Interface Items.h" @@ -72,34 +72,34 @@ typedef struct RPC_SMALL_FACE_VALUES gRPCSmallFaceValues[ ] = { - 9, 8, 8, 24, // MIGUEL ( 57 ) - 8, 8, 7, 24, // CARLOS ( 58 ) + 9, 8, 8, 24, // MIGUEL ( 57 ) + 8, 8, 7, 24, // CARLOS ( 58 ) 10, 8, 8, 26, // IRA ( 59 ) - 7, 8, 7, 26, // DIMITRI ( 60 ) - 6, 7, 7, 23, // DEVIN ( 61 ) - 0, 0, 0, 0, // THE RAT ( 62 ) - 8, 7, 8, 23, // ( 63 ) - 8, 8, 8, 22, // SLAY ( 64 ) - 0, 0, 0, 0, // ( 65 ) - 9, 4, 7, 22, // DYNAMO ( 66 ) - 8, 8, 8, 25, // SHANK ( 67 ) - 4, 6, 5, 22, // IGGY ( 68 ) - 8, 9, 7, 25, // VINCE ( 69 ) - 4, 7, 5, 25, // CONRAD ( 70 ) - 9, 7, 8, 22, // CARL ( 71 ) - 9, 7, 9, 25, // MADDOG ( 72 ) - 0, 0, 0, 0, // ( 73 ) - 0, 0, 0, 0, // ( 74 ) - - 9, 3, 8, 23, // MARIA ( 88 ) + 7, 8, 7, 26, // DIMITRI ( 60 ) + 6, 7, 7, 23, // DEVIN ( 61 ) + 0, 0, 0, 0, // THE RAT ( 62 ) + 8, 7, 8, 23, // ( 63 ) + 8, 8, 8, 22, // SLAY ( 64 ) + 0, 0, 0, 0, // ( 65 ) + 9, 4, 7, 22, // DYNAMO ( 66 ) + 8, 8, 8, 25, // SHANK ( 67 ) + 4, 6, 5, 22, // IGGY ( 68 ) + 8, 9, 7, 25, // VINCE ( 69 ) + 4, 7, 5, 25, // CONRAD ( 70 ) + 9, 7, 8, 22, // CARL ( 71 ) + 9, 7, 9, 25, // MADDOG ( 72 ) + 0, 0, 0, 0, // ( 73 ) + 0, 0, 0, 0, // ( 74 ) + + 9, 3, 8, 23, // MARIA ( 88 ) + + 9, 3, 8, 25, // JOEY ( 90 ) - 9, 3, 8, 25, // JOEY ( 90 ) - 11, 7, 9, 24, // SKYRIDER ( 97 ) 9, 5, 7, 23, // Miner ( 106 ) - 6, 4, 6, 24, // JOHN ( 118 ) - 12,4, 10, 24, // ( 119 ) + 6, 4, 6, 24, // JOHN ( 118 ) + 12,4, 10, 24, // ( 119 ) 8, 6, 8, 23, // Miner ( 148 ) 6, 5, 6, 23, // Miner ( 156 ) 13, 7, 11, 24, // Miner ( 157 ) @@ -134,10 +134,10 @@ UINT8 gubRPCSmallFaceProfileNum[] = 118, 119, 148, // entry 24 - 156, + 156, 157, 158, - + }; UINT8 ubRPCNumSmallFaceValues = 28; @@ -148,7 +148,7 @@ extern INT16 gsCurInterfacePanel; extern UINT16 gusSMCurrentMerc; extern BOOLEAN gfRerenderInterfaceFromHelpText; extern BOOLEAN gfInItemPickupMenu; - + BOOLEAN FaceRestoreSavedBackgroundRect( INT32 iFaceIndex, INT16 sDestLeft, INT16 sDestTop, INT16 sSrcLeft, INT16 sSrcTop, INT16 sWidth, INT16 sHeight ); void SetupFinalTalkingDelay( FACETYPE *pFace ); @@ -190,7 +190,7 @@ INT32 InitSoldierFace( SOLDIERTYPE *pSoldier ) // Check if we have a face init already iFaceIndex = pSoldier->iFaceIndex; - + if ( iFaceIndex != -1 ) { return( iFaceIndex ); @@ -230,7 +230,7 @@ INT32 InitFace( UINT8 usMercProfileID, UINT8 ubSoldierID, UINT32 uiInitFlags ) INT32 InternalInitFace( UINT8 usMercProfileID, UINT8 ubSoldierID, UINT32 uiInitFlags, INT32 iFaceFileID, UINT32 uiBlinkFrequency, UINT32 uiExpressionFrequency ) { FACETYPE *pFace; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; UINT32 uiVideoObject; INT32 iFaceIndex; ETRLEObject ETRLEObject; @@ -264,36 +264,36 @@ INT32 InternalInitFace( UINT8 usMercProfileID, UINT8 ubSoldierID, UINT32 uiInitF sprintf( VObjectDesc.ImageFile, "FACES\\b%03d.sti", iFaceFileID ); } - // ATE: Check for profile - if elliot , use special face :) - if ( usMercProfileID == ELLIOT ) - { - if ( gMercProfiles[ ELLIOT ].bNPCData > 3 && gMercProfiles[ ELLIOT ].bNPCData < 7 ) - { - sprintf( VObjectDesc.ImageFile, "FACES\\b%02da.sti", iFaceFileID ); - } - else if ( gMercProfiles[ ELLIOT ].bNPCData > 6 && gMercProfiles[ ELLIOT ].bNPCData < 10 ) - { - sprintf( VObjectDesc.ImageFile, "FACES\\b%02db.sti", iFaceFileID ); - } - else if ( gMercProfiles[ ELLIOT ].bNPCData > 9 && gMercProfiles[ ELLIOT ].bNPCData < 13 ) - { - sprintf( VObjectDesc.ImageFile, "FACES\\b%02dc.sti", iFaceFileID ); - } - else if ( gMercProfiles[ ELLIOT ].bNPCData > 12 && gMercProfiles[ ELLIOT ].bNPCData < 16 ) - { - sprintf( VObjectDesc.ImageFile, "FACES\\b%02dd.sti", iFaceFileID ); - } - else if ( gMercProfiles[ ELLIOT ].bNPCData == 17 ) - { - sprintf( VObjectDesc.ImageFile, "FACES\\b%02de.sti", iFaceFileID ); - } - } + // ATE: Check for profile - if elliot , use special face :) + if ( usMercProfileID == ELLIOT ) + { + if ( gMercProfiles[ ELLIOT ].bNPCData > 3 && gMercProfiles[ ELLIOT ].bNPCData < 7 ) + { + sprintf( VObjectDesc.ImageFile, "FACES\\b%02da.sti", iFaceFileID ); + } + else if ( gMercProfiles[ ELLIOT ].bNPCData > 6 && gMercProfiles[ ELLIOT ].bNPCData < 10 ) + { + sprintf( VObjectDesc.ImageFile, "FACES\\b%02db.sti", iFaceFileID ); + } + else if ( gMercProfiles[ ELLIOT ].bNPCData > 9 && gMercProfiles[ ELLIOT ].bNPCData < 13 ) + { + sprintf( VObjectDesc.ImageFile, "FACES\\b%02dc.sti", iFaceFileID ); + } + else if ( gMercProfiles[ ELLIOT ].bNPCData > 12 && gMercProfiles[ ELLIOT ].bNPCData < 16 ) + { + sprintf( VObjectDesc.ImageFile, "FACES\\b%02dd.sti", iFaceFileID ); + } + else if ( gMercProfiles[ ELLIOT ].bNPCData == 17 ) + { + sprintf( VObjectDesc.ImageFile, "FACES\\b%02de.sti", iFaceFileID ); + } + } else if ( usMercProfileID == TEX ) - { - if( gMercProfiles[ TEX ].bSkillTrait2 == CAMOUFLAGED ) - { - sprintf( VObjectDesc.ImageFile, "FACES\\B167c.sti" ); - } + { + if( gMercProfiles[ TEX ].bSkillTrait2 == CAMOUFLAGED ) + { + sprintf( VObjectDesc.ImageFile, "FACES\\B167c.sti" ); + } } } @@ -341,7 +341,7 @@ INT32 InternalInitFace( UINT8 usMercProfileID, UINT8 ubSoldierID, UINT32 uiInitF pFace->fAllocated = TRUE; //Default to off! - pFace->fDisabled = TRUE; + pFace->fDisabled = TRUE; pFace->iVideoOverlay = -1; //pFace->uiEyeDelay = gMercProfiles[ usMercProfileID ].uiEyeDelay; //pFace->uiMouthDelay = gMercProfiles[ usMercProfileID ].uiMouthDelay; @@ -350,12 +350,12 @@ INT32 InternalInitFace( UINT8 usMercProfileID, UINT8 ubSoldierID, UINT32 uiInitF pFace->ubCharacterNum = usMercProfileID; - pFace->uiBlinkFrequency = uiBlinkFrequency; + pFace->uiBlinkFrequency = uiBlinkFrequency; pFace->uiExpressionFrequency = uiExpressionFrequency; pFace->sEyeFrame = 0; pFace->sMouthFrame = 0; - pFace->uiFlags = uiInitFlags; + pFace->uiFlags = uiInitFlags; // Set palette @@ -369,8 +369,8 @@ INT32 InternalInitFace( UINT8 usMercProfileID, UINT8 ubSoldierID, UINT32 uiInitF Pal[uiCount].peBlue=255; } - hVObject->pShades[ FLASH_PORTRAIT_NOSHADE ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 255, 255, 255, FALSE ); - hVObject->pShades[ FLASH_PORTRAIT_STARTSHADE ] = Create16BPPPaletteShaded( Pal, 255, 255, 255, FALSE ); + hVObject->pShades[ FLASH_PORTRAIT_NOSHADE ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 255, 255, 255, FALSE ); + hVObject->pShades[ FLASH_PORTRAIT_STARTSHADE ] = Create16BPPPaletteShaded( Pal, 255, 255, 255, FALSE ); hVObject->pShades[ FLASH_PORTRAIT_ENDSHADE ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 250, 25, 25, TRUE ); hVObject->pShades[ FLASH_PORTRAIT_DARKSHADE ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 100, 100, 100, TRUE ); hVObject->pShades[ FLASH_PORTRAIT_LITESHADE ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 100, 100, 100, FALSE ); @@ -450,7 +450,7 @@ void DeleteFace( INT32 iFaceIndex ) // Check for a valid slot! CHECKV( pFace->fAllocated != FALSE ); - pFace->fCanHandleInactiveNow = TRUE; + pFace->fCanHandleInactiveNow = TRUE; if ( !pFace->fDisabled ) { @@ -466,9 +466,9 @@ void DeleteFace( INT32 iFaceIndex ) HandleDialogueEnd( pFace ); } - // Delete vo + // Delete vo DeleteVideoObjectFromIndex( pFace->uiVideoObject ); - + // Set uncallocated pFace->fAllocated = FALSE; @@ -512,12 +512,12 @@ void GetFaceRelativeCoordinates( FACETYPE *pFace, UINT16 *pusEyesX, UINT16 *pusE // usMouthY = 55; //} - // Use some other values for x,y, base on if we are a RPC! + // Use some other values for x,y, base on if we are a RPC! if ( !( pFace->uiFlags & FACE_BIGFACE ) ||( pFace->uiFlags & FACE_FORCE_SMALL )) { if (usMercProfileID == TEX) { - // 3, 6, 3, 23, // Tex ( 64 ) + // 3, 6, 3, 23, // Tex ( 64 ) usEyesX = 3; usEyesY = 6; usMouthX = 3; @@ -525,7 +525,7 @@ void GetFaceRelativeCoordinates( FACETYPE *pFace, UINT16 *pusEyesX, UINT16 *pusE } else if (usMercProfileID == BIGGENS) { - // 5, 6, 5, 25, // Biggens ( 61 ) + // 5, 6, 5, 25, // Biggens ( 61 ) usEyesX = 5; usEyesY = 6; usMouthX = 5; @@ -574,7 +574,7 @@ void SetAutoFaceActive( UINT32 uiDisplayBuffer, UINT32 uiRestoreBuffer, INT32 iF GetFaceRelativeCoordinates( pFace, &usEyesX, &usEyesY, &usMouthX, &usMouthY ); - InternalSetAutoFaceActive( uiDisplayBuffer, uiRestoreBuffer, iFaceIndex , usFaceX, usFaceY, usEyesX, usEyesY, usMouthX, usMouthY ); + InternalSetAutoFaceActive( uiDisplayBuffer, uiRestoreBuffer, iFaceIndex , usFaceX, usFaceY, usEyesX, usEyesY, usMouthX, usMouthY ); } @@ -611,19 +611,19 @@ void InternalSetAutoFaceActive( UINT32 uiDisplayBuffer, UINT32 uiRestoreBuffer, { // BUILD A BUFFER GetCurrentVideoSettings( &usWidth, &usHeight, &ubBitDepth ); - // OK, ignore screen widths, height, only use BPP + // OK, ignore screen widths, height, only use BPP vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE; vs_desc.usWidth = pFace->usFaceWidth; vs_desc.usHeight = pFace->usFaceHeight; vs_desc.ubBitDepth = ubBitDepth; - pFace->fAutoRestoreBuffer = TRUE; + pFace->fAutoRestoreBuffer = TRUE; - CHECKV( AddVideoSurface( &vs_desc, &(pFace->uiAutoRestoreBuffer) ) ); + CHECKV( AddVideoSurface( &vs_desc, &(pFace->uiAutoRestoreBuffer) ) ); } else { - pFace->fAutoRestoreBuffer = FALSE; + pFace->fAutoRestoreBuffer = FALSE; pFace->uiAutoRestoreBuffer = uiRestoreBuffer; } @@ -631,19 +631,19 @@ void InternalSetAutoFaceActive( UINT32 uiDisplayBuffer, UINT32 uiRestoreBuffer, { // BUILD A BUFFER GetCurrentVideoSettings( &usWidth, &usHeight, &ubBitDepth ); - // OK, ignore screen widths, height, only use BPP + // OK, ignore screen widths, height, only use BPP vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE; vs_desc.usWidth = pFace->usFaceWidth; vs_desc.usHeight = pFace->usFaceHeight; vs_desc.ubBitDepth = ubBitDepth; - pFace->fAutoDisplayBuffer = TRUE; + pFace->fAutoDisplayBuffer = TRUE; - CHECKV( AddVideoSurface( &vs_desc, &(pFace->uiAutoDisplayBuffer) ) ); + CHECKV( AddVideoSurface( &vs_desc, &(pFace->uiAutoDisplayBuffer) ) ); } else { - pFace->fAutoDisplayBuffer = FALSE; + pFace->fAutoDisplayBuffer = FALSE; pFace->uiAutoDisplayBuffer = uiDisplayBuffer; } @@ -666,7 +666,7 @@ void InternalSetAutoFaceActive( UINT32 uiDisplayBuffer, UINT32 uiRestoreBuffer, pFace->usEyesOffsetY = usEyesY; pFace->usMouthOffsetY = usMouthY; pFace->usMouthOffsetX = usMouthX; - + if ( pFace->usEyesY == usFaceY || pFace->usMouthY == usFaceY ) { @@ -677,12 +677,12 @@ void InternalSetAutoFaceActive( UINT32 uiDisplayBuffer, UINT32 uiRestoreBuffer, pFace->uiLastBlink = GetJA2Clock(); pFace->uiLastExpression = GetJA2Clock(); pFace->uiEyelast = GetJA2Clock(); - pFace->fStartFrame = TRUE; + pFace->fStartFrame = TRUE; // Are we a soldier? if ( pFace->ubSoldierID != NOBODY ) { - pFace->bOldSoldierLife = MercPtrs[ pFace->ubSoldierID ]->bLife; + pFace->bOldSoldierLife = MercPtrs[ pFace->ubSoldierID ]->stats.bLife; } } @@ -721,7 +721,7 @@ void SetAutoFaceInActive(INT32 iFaceIndex ) if ( pFace->uiFlags & FACE_MAKEACTIVE_ONCE_DONE ) { - // + // if ( pFace->ubSoldierID != NOBODY ) { pSoldier = MercPtrs[ pFace->ubSoldierID ]; @@ -756,14 +756,14 @@ void SetAutoFaceInActive(INT32 iFaceIndex ) // Turn off some flags pFace->uiFlags &= ( ~FACE_INACTIVE_HANDLED_ELSEWHERE ); - + // Disable! pFace->fDisabled = TRUE; - + } -void SetAllAutoFacesInactive( ) +void SetAllAutoFacesInactive( ) { UINT32 uiCount; FACETYPE *pFace; @@ -794,9 +794,9 @@ void BlinkAutoFace( INT32 iFaceIndex ) // CHECK IF BUDDY IS DEAD, UNCONSCIOUS, ASLEEP, OR POW! if ( pFace->ubSoldierID != NOBODY ) { - if ( ( MercPtrs[ pFace->ubSoldierID ]->bLife < OKLIFE ) || - ( MercPtrs[ pFace->ubSoldierID ]->fMercAsleep == TRUE ) || - ( MercPtrs[ pFace->ubSoldierID ]->bAssignment == ASSIGNMENT_POW ) ) + if ( ( MercPtrs[ pFace->ubSoldierID ]->stats.bLife < OKLIFE ) || + ( MercPtrs[ pFace->ubSoldierID ]->flags.fMercAsleep == TRUE ) || + ( MercPtrs[ pFace->ubSoldierID ]->bAssignment == ASSIGNMENT_POW ) ) { return; } @@ -857,7 +857,7 @@ void BlinkAutoFace( INT32 iFaceIndex ) // Adjust NewEye( pFace ); - + sFrame = pFace->sEyeFrame; if ( sFrame >= 5 ) @@ -880,7 +880,7 @@ void BlinkAutoFace( INT32 iFaceIndex ) //RenderFace( uiDestBuffer , uiCount ); pFace->ubExpression = NO_EXPRESSION; // Update rects just for eyes - + if ( pFace->uiAutoRestoreBuffer == guiSAVEBUFFER ) { FaceRestoreSavedBackgroundRect( iFaceIndex, pFace->usEyesX, pFace->usEyesY, pFace->usEyesX, pFace->usEyesY, pFace->usEyesWidth, pFace->usEyesHeight ); @@ -911,66 +911,66 @@ void HandleFaceHilights( FACETYPE *pFace, UINT32 uiBuffer, INT16 sFaceX, INT16 s iFaceIndex = pFace->iID; - if ( !gFacesData[ iFaceIndex ].fDisabled ) - { + if ( !gFacesData[ iFaceIndex ].fDisabled ) + { if ( pFace->uiAutoDisplayBuffer == FRAME_BUFFER && guiCurrentScreen == GAME_SCREEN ) - { - // If we are highlighted, do this now! - if ( ( pFace->uiFlags & FACE_SHOW_WHITE_HILIGHT ) ) - { - // Lock buffer - pDestBuf = LockVideoSurface( uiBuffer, &uiDestPitchBYTES ); - SetClippingRegionAndImageWidth( uiDestPitchBYTES, sFaceX-2, sFaceY-1, sFaceX + pFace->usFaceWidth + 4, sFaceY + pFace->usFaceHeight + 4 ); + { + // If we are highlighted, do this now! + if ( ( pFace->uiFlags & FACE_SHOW_WHITE_HILIGHT ) ) + { + // Lock buffer + pDestBuf = LockVideoSurface( uiBuffer, &uiDestPitchBYTES ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, sFaceX-2, sFaceY-1, sFaceX + pFace->usFaceWidth + 4, sFaceY + pFace->usFaceHeight + 4 ); - usLineColor = Get16BPPColor( FROMRGB( 255, 255, 255 ) ); - RectangleDraw( TRUE, (sFaceX - 2 ), (sFaceY - 1),sFaceX + pFace->usFaceWidth + 1, sFaceY + pFace->usFaceHeight , usLineColor, pDestBuf ); + usLineColor = Get16BPPColor( FROMRGB( 255, 255, 255 ) ); + RectangleDraw( TRUE, (sFaceX - 2 ), (sFaceY - 1),sFaceX + pFace->usFaceWidth + 1, sFaceY + pFace->usFaceHeight , usLineColor, pDestBuf ); - SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); - UnLockVideoSurface( uiBuffer ); - } - else if ( ( pFace->uiFlags & FACE_SHOW_MOVING_HILIGHT ) ) - { - if ( pFace->ubSoldierID != NOBODY ) - { - if ( MercPtrs[ pFace->ubSoldierID ]->bLife >= OKLIFE ) - { - // Lock buffer - pDestBuf = LockVideoSurface( uiBuffer, &uiDestPitchBYTES ); - SetClippingRegionAndImageWidth( uiDestPitchBYTES, sFaceX-2, sFaceY-1, sFaceX + pFace->usFaceWidth + 4, sFaceY + pFace->usFaceHeight + 4 ); - - if ( MercPtrs[ pFace->ubSoldierID ]->bStealthMode ) - { - usLineColor = Get16BPPColor( FROMRGB( 158, 158, 12 ) ); - } - else - { - usLineColor = Get16BPPColor( FROMRGB( 8, 12, 118 ) ); - } - RectangleDraw( TRUE, (sFaceX - 2 ), (sFaceY - 1),sFaceX + pFace->usFaceWidth + 1, sFaceY + pFace->usFaceHeight , usLineColor, pDestBuf ); + UnLockVideoSurface( uiBuffer ); + } + else if ( ( pFace->uiFlags & FACE_SHOW_MOVING_HILIGHT ) ) + { + if ( pFace->ubSoldierID != NOBODY ) + { + if ( MercPtrs[ pFace->ubSoldierID ]->stats.bLife >= OKLIFE ) + { + // Lock buffer + pDestBuf = LockVideoSurface( uiBuffer, &uiDestPitchBYTES ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, sFaceX-2, sFaceY-1, sFaceX + pFace->usFaceWidth + 4, sFaceY + pFace->usFaceHeight + 4 ); - SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + if ( MercPtrs[ pFace->ubSoldierID ]->bStealthMode ) + { + usLineColor = Get16BPPColor( FROMRGB( 158, 158, 12 ) ); + } + else + { + usLineColor = Get16BPPColor( FROMRGB( 8, 12, 118 ) ); + } + RectangleDraw( TRUE, (sFaceX - 2 ), (sFaceY - 1),sFaceX + pFace->usFaceWidth + 1, sFaceY + pFace->usFaceHeight , usLineColor, pDestBuf ); - UnLockVideoSurface( uiBuffer ); - } - } - } - else - { - // ATE: Zero out any highlight boxzes.... - // Lock buffer - pDestBuf = LockVideoSurface( pFace->uiAutoDisplayBuffer, &uiDestPitchBYTES ); - SetClippingRegionAndImageWidth( uiDestPitchBYTES, pFace->usFaceX-2, pFace->usFaceY-1, pFace->usFaceX + pFace->usFaceWidth + 4, pFace->usFaceY + pFace->usFaceHeight + 4 ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); - usLineColor = Get16BPPColor( FROMRGB( 0, 0, 0 ) ); - RectangleDraw( TRUE, (pFace->usFaceX - 2 ), (pFace->usFaceY - 1), pFace->usFaceX + pFace->usFaceWidth + 1, pFace->usFaceY + pFace->usFaceHeight , usLineColor, pDestBuf ); + UnLockVideoSurface( uiBuffer ); + } + } + } + else + { + // ATE: Zero out any highlight boxzes.... + // Lock buffer + pDestBuf = LockVideoSurface( pFace->uiAutoDisplayBuffer, &uiDestPitchBYTES ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, pFace->usFaceX-2, pFace->usFaceY-1, pFace->usFaceX + pFace->usFaceWidth + 4, pFace->usFaceY + pFace->usFaceHeight + 4 ); - SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + usLineColor = Get16BPPColor( FROMRGB( 0, 0, 0 ) ); + RectangleDraw( TRUE, (pFace->usFaceX - 2 ), (pFace->usFaceY - 1), pFace->usFaceX + pFace->usFaceWidth + 1, pFace->usFaceY + pFace->usFaceHeight , usLineColor, pDestBuf ); - UnLockVideoSurface( pFace->uiAutoDisplayBuffer ); - } - } - } + SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + + UnLockVideoSurface( pFace->uiAutoDisplayBuffer ); + } + } + } if ( ( pFace->fCompatibleItems && !gFacesData[ iFaceIndex ].fDisabled ) ) @@ -984,7 +984,7 @@ void HandleFaceHilights( FACETYPE *pFace, UINT32 uiBuffer, INT16 sFaceX, INT16 s SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); - UnLockVideoSurface( uiBuffer ); + UnLockVideoSurface( uiBuffer ); } } @@ -995,7 +995,7 @@ void MouthAutoFace( INT32 iFaceIndex ) FACETYPE *pFace; INT16 sFrame; - if ( gFacesData[ iFaceIndex ].fAllocated ) + if ( gFacesData[ iFaceIndex ].fAllocated ) { pFace = &gFacesData[ iFaceIndex ]; @@ -1047,7 +1047,7 @@ void MouthAutoFace( INT32 iFaceIndex ) // Adjust NewMouth( pFace ); - + sFrame = pFace->sMouthFrame; if ( sFrame > 0 ) @@ -1085,7 +1085,7 @@ void MouthAutoFace( INT32 iFaceIndex ) } } - if ( !( pFace->uiFlags & FACE_INACTIVE_HANDLED_ELSEWHERE ) ) + if ( !( pFace->uiFlags & FACE_INACTIVE_HANDLED_ELSEWHERE ) ) { HandleFaceHilights( pFace, pFace->uiAutoDisplayBuffer, pFace->usFaceX, pFace->usFaceY ); } @@ -1097,7 +1097,7 @@ void HandleTalkingAutoFace( INT32 iFaceIndex ) { FACETYPE *pFace; - if ( gFacesData[ iFaceIndex ].fAllocated ) + if ( gFacesData[ iFaceIndex ].fAllocated ) { pFace = &gFacesData[ iFaceIndex ]; @@ -1131,9 +1131,9 @@ void HandleTalkingAutoFace( INT32 iFaceIndex ) { if ( ( GetJA2Clock() - pFace->uiTalkingTimer ) > pFace->uiTalkingDuration ) { - pFace->fTalking = FALSE; + pFace->fTalking = FALSE; pFace->fAnimatingTalking = FALSE; - + // Remove gap info AudioGapListDone( &(pFace->GapList) ); @@ -1169,7 +1169,7 @@ void SetFaceShade( SOLDIERTYPE *pSoldier, FACETYPE *pFace, BOOLEAN fExternBlit ) } } - if ( pSoldier->bLife < OKLIFE ) + if ( pSoldier->stats.bLife < OKLIFE ) { SetObjectHandleShade( pFace->uiVideoObject, FLASH_PORTRAIT_DARKSHADE ); } @@ -1177,7 +1177,7 @@ void SetFaceShade( SOLDIERTYPE *pSoldier, FACETYPE *pFace, BOOLEAN fExternBlit ) // ATE: Don't shade for damage if blitting extern face... if ( !fExternBlit ) { - if ( pSoldier->fFlashPortrait == FLASH_PORTRAIT_START ) + if ( pSoldier->flags.fFlashPortrait == FLASH_PORTRAIT_START ) { SetObjectHandleShade( pFace->uiVideoObject, pSoldier->bFlashPortraitFrame ); } @@ -1196,7 +1196,7 @@ void GetXYForIconPlacement( FACETYPE *pFace, UINT16 ubIndex, INT16 sFaceX, INT16 { INT16 sX, sY; UINT16 usWidth, usHeight; - ETRLEObject *pTrav; + ETRLEObject *pTrav; HVOBJECT hVObject; @@ -1217,7 +1217,7 @@ void GetXYForRightIconPlacement( FACETYPE *pFace, UINT16 ubIndex, INT16 sFaceX, { INT16 sX, sY; UINT16 usWidth, usHeight; - ETRLEObject *pTrav; + ETRLEObject *pTrav; HVOBJECT hVObject; @@ -1261,18 +1261,18 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE BOOLEAN fShowMaximum = FALSE; SOLDIERTYPE *pSoldier; INT16 sFontX, sFontY; - INT16 sX1, sY1, sY2, sX2; + INT16 sX1, sY1, sY2, sX2; UINT32 uiDestPitchBYTES; UINT8 *pDestBuf; UINT16 usLineColor; - INT8 bNumRightIcons = 0; + INT8 bNumRightIcons = 0; // If we are using an extern buffer... if ( fUseExternBuffer ) { uiRenderBuffer = uiBuffer; } - else + else { if ( fDisplayBuffer ) { @@ -1294,7 +1294,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE { pSoldier = MercPtrs[ pFace->ubSoldierID ]; - if ( ( MercPtrs[ pFace->ubSoldierID ]->bLife < CONSCIOUSNESS || MercPtrs[ pFace->ubSoldierID ]->fDeadPanel ) ) + if ( ( MercPtrs[ pFace->ubSoldierID ]->stats.bLife < CONSCIOUSNESS || MercPtrs[ pFace->ubSoldierID ]->flags.fDeadPanel ) ) { // Blit Closed eyes here! BltVideoObjectFromIndex( uiRenderBuffer, pFace->uiVideoObject, 1, usEyesX, usEyesY, VO_BLT_SRCTRANSPARENCY, NULL ); @@ -1303,16 +1303,16 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE BltVideoObjectFromIndex( uiRenderBuffer, guiHATCH, 0, sFaceX, sFaceY, VO_BLT_SRCTRANSPARENCY, NULL ); } - if( MercPtrs[ pFace->ubSoldierID ]->fMercAsleep == TRUE ) + if( MercPtrs[ pFace->ubSoldierID ]->flags.fMercAsleep == TRUE ) { // blit eyes closed BltVideoObjectFromIndex( uiRenderBuffer, pFace->uiVideoObject, 1, usEyesX, usEyesY, VO_BLT_SRCTRANSPARENCY, NULL ); } - if ( ( pSoldier->uiStatusFlags & SOLDIER_DEAD ) ) + if ( ( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) ) { // IF we are in the process of doing any deal/close animations, show face, not skill... - if ( !pSoldier->fClosePanel && !pSoldier->fDeadPanel && !pSoldier->fUIdeadMerc && !pSoldier->fUICloseMerc ) + if ( !pSoldier->flags.fClosePanel && !pSoldier->flags.fDeadPanel && !pSoldier->flags.fUIdeadMerc && !pSoldier->flags.fUICloseMerc ) { // Put close panel there BltVideoObjectFromIndex( uiRenderBuffer, guiDEAD, 5, sFaceX, sFaceY, VO_BLT_SRCTRANSPARENCY, NULL ); @@ -1322,11 +1322,11 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE } } - // ATE: If talking in popup, don't do the other things..... - if ( pFace->fTalking && gTacticalStatus.uiFlags & IN_ENDGAME_SEQUENCE ) - { - return; - } + // ATE: If talking in popup, don't do the other things..... + if ( pFace->fTalking && gTacticalStatus.uiFlags & IN_ENDGAME_SEQUENCE ) + { + return; + } // ATE: Only do this, because we can be talking during an interrupt.... if ( ( pFace->uiFlags & FACE_INACTIVE_HANDLED_ELSEWHERE ) && !fUseExternBuffer ) @@ -1338,21 +1338,21 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE HandleFaceHilights( pFace, uiRenderBuffer, sFaceX, sFaceY ); #ifdef JA2BETAVERSION - if ( pSoldier->bOppCnt != 0 ) + if ( pSoldier->aiData.bOppCnt != 0 ) #else - if ( pSoldier->bOppCnt > 0 ) + if ( pSoldier->aiData.bOppCnt > 0 ) #endif { SetFontDestBuffer( uiRenderBuffer, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); - swprintf( sString, L"%d", pSoldier->bOppCnt ); + swprintf( sString, L"%d", pSoldier->aiData.bOppCnt ); SetFont( TINYFONT1 ); SetFontForeground( FONT_DKRED ); SetFontBackground( FONT_NEARBLACK ); sX1 = (INT16)( sFaceX ); - sY1 = (INT16)( sFaceY ); + sY1 = (INT16)( sFaceY ); sX2 = sX1 + StringPixLength( sString, TINYFONT1 ) + 1; sY2 = sY1 + GetFontHeight( TINYFONT1 ) - 1; @@ -1367,11 +1367,11 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE usLineColor = Get16BPPColor( FROMRGB( 105, 8, 9 ) ); RectangleDraw( TRUE, sX1, sY1, sX2, sY2, usLineColor, pDestBuf ); - UnLockVideoSurface( uiRenderBuffer ); + UnLockVideoSurface( uiRenderBuffer ); } - if ( MercPtrs[ pFace->ubSoldierID ]->bInSector && ( ( ( gTacticalStatus.ubCurrentTeam != OUR_TEAM ) || !OK_INTERRUPT_MERC( MercPtrs[ pFace->ubSoldierID ] ) ) && !gfHiddenInterrupt ) || ( ( gfSMDisableForItems && !gfInItemPickupMenu ) && gusSMCurrentMerc == pFace->ubSoldierID && gsCurInterfacePanel == SM_PANEL ) ) + if ( MercPtrs[ pFace->ubSoldierID ]->bInSector && ( ( ( gTacticalStatus.ubCurrentTeam != OUR_TEAM ) || !OK_INTERRUPT_MERC( MercPtrs[ pFace->ubSoldierID ] ) ) && !gfHiddenInterrupt ) || ( ( gfSMDisableForItems && !gfInItemPickupMenu ) && gusSMCurrentMerc == pFace->ubSoldierID && gsCurInterfacePanel == SM_PANEL ) ) { // Blit hatch! BltVideoObjectFromIndex( uiRenderBuffer, guiHATCH, 0, sFaceX, sFaceY, VO_BLT_SRCTRANSPARENCY, NULL ); @@ -1380,7 +1380,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE if ( !pFace->fDisabled && !pFace->fInvalidAnim ) { // Render text above here if that's what was asked for - if ( pFace->fDisplayTextOver != FACE_NO_TEXT_OVER ) + if ( pFace->fDisplayTextOver != FACE_NO_TEXT_OVER ) { SetFont( TINYFONT1 ); SetFontBackground( FONT_MCOLOR_BLACK ); @@ -1392,12 +1392,12 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE if ( pFace->fDisplayTextOver == FACE_DRAW_TEXT_OVER ) { - gprintfinvalidate( sFontX, sFontY, pFace->zDisplayText ); + gprintfinvalidate( sFontX, sFontY, pFace->zDisplayText ); mprintf( sFontX, sFontY, pFace->zDisplayText ); } else if ( pFace->fDisplayTextOver == FACE_ERASE_TEXT_OVER ) { - gprintfRestore( sFontX, sFontY, pFace->zDisplayText ); + gprintfRestore( sFontX, sFontY, pFace->zDisplayText ); pFace->fDisplayTextOver = FACE_NO_TEXT_OVER; } @@ -1408,42 +1408,42 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE } - // Check if a robot and is not controlled.... - if ( MercPtrs[ pFace->ubSoldierID ]->uiStatusFlags & SOLDIER_ROBOT ) - { - if ( !CanRobotBeControlled( MercPtrs[ pFace->ubSoldierID ] ) ) - { - // Not controlled robot - sIconIndex = 5; - fDoIcon = TRUE; - } - } + // Check if a robot and is not controlled.... + if ( MercPtrs[ pFace->ubSoldierID ]->flags.uiStatusFlags & SOLDIER_ROBOT ) + { + if ( !MercPtrs[ pFace->ubSoldierID ]->CanRobotBeControlled( ) ) + { + // Not controlled robot + sIconIndex = 5; + fDoIcon = TRUE; + } + } - if ( ControllingRobot( MercPtrs[ pFace->ubSoldierID ] ) ) - { - // controlling robot + if ( MercPtrs[ pFace->ubSoldierID ]->ControllingRobot( ) ) + { + // controlling robot sIconIndex = 4; - fDoIcon = TRUE; - } + fDoIcon = TRUE; + } - // If blind... - if ( MercPtrs[ pFace->ubSoldierID ]->bBlindedCounter > 0 ) - { - DoRightIcon( uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 6 ); - bNumRightIcons++; - } + // If blind... + if ( MercPtrs[ pFace->ubSoldierID ]->bBlindedCounter > 0 ) + { + DoRightIcon( uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 6 ); + bNumRightIcons++; + } - if ( MercPtrs[ pFace->ubSoldierID ]->bDrugEffect[ DRUG_TYPE_ADRENALINE ] ) - { - DoRightIcon( uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 7 ); - bNumRightIcons++; - } + if ( MercPtrs[ pFace->ubSoldierID ]->drugs.bDrugEffect[ DRUG_TYPE_ADRENALINE ] ) + { + DoRightIcon( uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 7 ); + bNumRightIcons++; + } - if ( GetDrunkLevel( MercPtrs[ pFace->ubSoldierID ] ) != SOBER ) - { - DoRightIcon( uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 8 ); - bNumRightIcons++; - } + if ( GetDrunkLevel( MercPtrs[ pFace->ubSoldierID ] ) != SOBER ) + { + DoRightIcon( uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 8 ); + bNumRightIcons++; + } switch( pSoldier->bAssignment ) @@ -1451,23 +1451,23 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE case DOCTOR: sIconIndex = 1; - fDoIcon = TRUE; + fDoIcon = TRUE; sPtsAvailable = CalculateHealingPointsForDoctor( MercPtrs[ pFace->ubSoldierID ], &usMaximumPts, FALSE ); fShowNumber = TRUE; fShowMaximum = TRUE; // divide both amounts by 10 to make the displayed numbers a little more user-palatable (smaller) sPtsAvailable = ( sPtsAvailable + 5 ) / 10; - usMaximumPts = ( usMaximumPts + 5 ) / 10; + usMaximumPts = ( usMaximumPts + 5 ) / 10; break; case PATIENT: sIconIndex = 2; - fDoIcon = TRUE; + fDoIcon = TRUE; // show current health / maximum health - sPtsAvailable = MercPtrs[ pFace->ubSoldierID ]->bLife; - usMaximumPts = MercPtrs[ pFace->ubSoldierID ]->bLifeMax; + sPtsAvailable = MercPtrs[ pFace->ubSoldierID ]->stats.bLife; + usMaximumPts = MercPtrs[ pFace->ubSoldierID ]->stats.bLifeMax; fShowNumber = TRUE; fShowMaximum = TRUE; break; @@ -1477,7 +1477,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE case TRAIN_TEAMMATE: case TRAIN_BY_OTHER: sIconIndex = 3; - fDoIcon = TRUE; + fDoIcon = TRUE; fShowNumber = TRUE; fShowMaximum = TRUE; // there could be bonus pts for training at gun range @@ -1498,7 +1498,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE sPtsAvailable = GetTownTrainPtsForCharacter( MercPtrs[ pFace->ubSoldierID ], &usMaximumPts ); // divide both amounts by 10 to make the displayed numbers a little more user-palatable (smaller) sPtsAvailable = ( sPtsAvailable + 5 ) / 10; - usMaximumPts = ( usMaximumPts + 5 ) / 10; + usMaximumPts = ( usMaximumPts + 5 ) / 10; break; case( TRAIN_TEAMMATE ): sPtsAvailable = GetBonusTrainingPtsDueToInstructor( MercPtrs[ pFace->ubSoldierID ], NULL , MercPtrs[ pFace->ubSoldierID ]->bTrainStat, fAtGunRange, &usMaximumPts ); @@ -1509,7 +1509,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE case REPAIR: sIconIndex = 0; - fDoIcon = TRUE; + fDoIcon = TRUE; sPtsAvailable = CalculateRepairPointsForRepairman( MercPtrs[ pFace->ubSoldierID ], &usMaximumPts, FALSE ); fShowNumber = TRUE; fShowMaximum = TRUE; @@ -1517,9 +1517,9 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE // check if we are repairing a vehicle if ( Menptr[ pFace->ubSoldierID ].bVehicleUnderRepairID != -1 ) { - // reduce to a multiple of VEHICLE_REPAIR_POINTS_DIVISOR. This way skill too low will show up as 0 repair pts. + // reduce to a multiple of VEHICLE_REPAIR_POINTS_DIVISOR. This way skill too low will show up as 0 repair pts. sPtsAvailable -= ( sPtsAvailable % VEHICLE_REPAIR_POINTS_DIVISOR ); - usMaximumPts -= ( usMaximumPts % VEHICLE_REPAIR_POINTS_DIVISOR ); + usMaximumPts -= ( usMaximumPts % VEHICLE_REPAIR_POINTS_DIVISOR ); } break; @@ -1530,24 +1530,24 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE { // Doctor... sIconIndex = 1; - fDoIcon = TRUE; + fDoIcon = TRUE; } if ( MercPtrs[ pFace->ubSoldierID ]->ubServiceCount != 0 ) { // Patient sIconIndex = 2; - fDoIcon = TRUE; + fDoIcon = TRUE; } - + if ( fDoIcon ) { // Find X, y for placement GetXYForIconPlacement( pFace, sIconIndex, sFaceX, sFaceY, &sIconX, &sIconY ); BltVideoObjectFromIndex( uiRenderBuffer, guiPORTRAITICONS, sIconIndex, sIconX, sIconY, VO_BLT_SRCTRANSPARENCY, NULL ); - // ATE: Show numbers only in mapscreen + // ATE: Show numbers only in mapscreen if( fShowNumber ) { SetFontDestBuffer( uiRenderBuffer, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); @@ -1568,21 +1568,21 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE SetFontForeground( FONT_YELLOW ); SetFontBackground( FONT_BLACK ); - mprintf( sFaceX + pFace->usFaceWidth - usTextWidth, ( INT16 )( sFaceY + 3 ), sString ); + mprintf( sFaceX + pFace->usFaceWidth - usTextWidth, ( INT16 )( sFaceY + 3 ), sString ); SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); } } } - else - { + else + { if ( pFace->ubCharacterNum == FATHER || pFace->ubCharacterNum == MICKY ) - { - if ( gMercProfiles[ pFace->ubCharacterNum ].bNPCData >= 5 ) - { - DoRightIcon( uiRenderBuffer, pFace, sFaceX, sFaceY, 0, 8 ); - } - } - } + { + if ( gMercProfiles[ pFace->ubCharacterNum ].bNPCData >= 5 ) + { + DoRightIcon( uiRenderBuffer, pFace, sFaceX, sFaceY, 0, 8 ); + } + } + } } @@ -1665,7 +1665,7 @@ BOOLEAN ExternRenderFace( UINT32 uiBuffer, INT32 iFaceIndex, INT16 sX, INT16 sY // Set shade if ( pFace->ubSoldierID != NOBODY ) - { + { SetFaceShade( MercPtrs[ pFace->ubSoldierID ], pFace , TRUE ); } @@ -1692,7 +1692,7 @@ void NewEye( FACETYPE *pFace ) switch(pFace->sEyeFrame) { - case 0 : //pFace->sEyeFrame = (INT16)Random(2); // normal - can blink or frown + case 0 : //pFace->sEyeFrame = (INT16)Random(2); // normal - can blink or frown if ( pFace->ubExpression == ANGRY ) { pFace->ubEyeWait = 0; @@ -1704,28 +1704,28 @@ void NewEye( FACETYPE *pFace ) pFace->sEyeFrame = 4; } else - //if (pFace->sEyeFrame && Talk.talking && Talk.expression != DYING) - /// pFace->sEyeFrame = 3; - //else - pFace->sEyeFrame = 1; - break; - case 1 : // starting to blink - has to finish unless dying - //if (Talk.expression == DYING) - // pFace->sEyeFrame = 1; - //else - pFace->sEyeFrame = 2; - break; - case 2 : //pFace->sEyeFrame = (INT16)Random(2); // finishing blink - can go normal or frown - //if (pFace->sEyeFrame && Talk.talking) - // pFace->sEyeFrame = 3; - //else - // if (Talk.expression == ANGRY) - // pFace->sEyeFrame = 3; - // else - pFace->sEyeFrame = 0; - break; + //if (pFace->sEyeFrame && Talk.talking && Talk.expression != DYING) + /// pFace->sEyeFrame = 3; + //else + pFace->sEyeFrame = 1; + break; + case 1 : // starting to blink - has to finish unless dying + //if (Talk.expression == DYING) + // pFace->sEyeFrame = 1; + //else + pFace->sEyeFrame = 2; + break; + case 2 : //pFace->sEyeFrame = (INT16)Random(2); // finishing blink - can go normal or frown + //if (pFace->sEyeFrame && Talk.talking) + // pFace->sEyeFrame = 3; + //else + // if (Talk.expression == ANGRY) + // pFace->sEyeFrame = 3; + // else + pFace->sEyeFrame = 0; + break; - case 3 : //pFace->sEyeFrame = 4; break; // frown + case 3 : //pFace->sEyeFrame = 4; break; // frown pFace->ubEyeWait++; @@ -1735,7 +1735,7 @@ void NewEye( FACETYPE *pFace ) } break; - case 4 : + case 4 : pFace->ubEyeWait++; @@ -1745,23 +1745,23 @@ void NewEye( FACETYPE *pFace ) } break; - case 5 : pFace->sEyeFrame = 6; + case 5 : pFace->sEyeFrame = 6; pFace->sEyeFrame = 0; - break; - - case 6 : pFace->sEyeFrame = 7; break; - case 7 : pFace->sEyeFrame = (INT16)Random(2); // can stop frowning or continue - //if (pFace->sEyeFrame && Talk.expression != DYING) - // pFace->sEyeFrame = 8; - //else - // pFace->sEyeFrame = 0; - //break; - case 8 : pFace->sEyeFrame = 9; break; - case 9 : pFace->sEyeFrame = 10; break; - case 10: pFace->sEyeFrame = 11; break; - case 11: pFace->sEyeFrame = 12; break; - case 12: pFace->sEyeFrame = 0; break; + break; + + case 6 : pFace->sEyeFrame = 7; break; + case 7 : pFace->sEyeFrame = (INT16)Random(2); // can stop frowning or continue + //if (pFace->sEyeFrame && Talk.expression != DYING) + // pFace->sEyeFrame = 8; + //else + // pFace->sEyeFrame = 0; + //break; + case 8 : pFace->sEyeFrame = 9; break; + case 9 : pFace->sEyeFrame = 10; break; + case 10: pFace->sEyeFrame = 11; break; + case 11: pFace->sEyeFrame = 12; break; + case 12: pFace->sEyeFrame = 0; break; } } @@ -1772,37 +1772,37 @@ void NewMouth( FACETYPE *pFace ) UINT16 sOld = pFace->sMouthFrame; // if (audio_gap_active == 1) - // { - // Talk.mouth = 0; - // return; - // } + // { + // Talk.mouth = 0; + // return; + // } do { - //Talk.mouth = random(4); + //Talk.mouth = random(4); - pFace->sMouthFrame = (INT16)Random(6); + pFace->sMouthFrame = (INT16)Random(6); - if ( pFace->sMouthFrame > 3) + if ( pFace->sMouthFrame > 3) { - pFace->sMouthFrame = 0; + pFace->sMouthFrame = 0; } - switch( sOld) - { - case 0 : if ( pFace->sMouthFrame != 0 ) - OK = TRUE; - break; - case 1 : if ( pFace->sMouthFrame != 1 ) - OK = TRUE; - break; - case 2 : if ( pFace->sMouthFrame != 2 ) - OK = TRUE; - break; - case 3 : if ( pFace->sMouthFrame != 3 ) - OK = TRUE; - break; - } + switch( sOld) + { + case 0 : if ( pFace->sMouthFrame != 0 ) + OK = TRUE; + break; + case 1 : if ( pFace->sMouthFrame != 1 ) + OK = TRUE; + break; + case 2 : if ( pFace->sMouthFrame != 2 ) + OK = TRUE; + break; + case 3 : if ( pFace->sMouthFrame != 3 ) + OK = TRUE; + break; + } } while (!OK); @@ -1829,217 +1829,217 @@ void HandleAutoFaces( ) fHandleUIHatch = FALSE; // OK, NOW, check if our bLife status has changed, re-render if so! - if ( gFacesData[ uiCount ].fAllocated ) + if ( gFacesData[ uiCount ].fAllocated ) { pFace = &gFacesData[ uiCount ]; // Are we a soldier? if ( pFace->ubSoldierID != NOBODY ) { - // Get Life now - pSoldier = MercPtrs[ pFace->ubSoldierID ]; - bLife = pSoldier->bLife; - bInSector = pSoldier->bInSector; - bAPs = pSoldier->bActionPoints; + // Get Life now + pSoldier = MercPtrs[ pFace->ubSoldierID ]; + bLife = pSoldier->stats.bLife; + bInSector = pSoldier->bInSector; + bAPs = pSoldier->bActionPoints; - if ( pSoldier->ubID == gsSelectedGuy && gfUIHandleSelectionAboveGuy ) - { - pFace->uiFlags |= FACE_SHOW_WHITE_HILIGHT; - } - else - { - pFace->uiFlags &= ( ~FACE_SHOW_WHITE_HILIGHT ); - } + if ( pSoldier->ubID == gsSelectedGuy && gfUIHandleSelectionAboveGuy ) + { + pFace->uiFlags |= FACE_SHOW_WHITE_HILIGHT; + } + else + { + pFace->uiFlags &= ( ~FACE_SHOW_WHITE_HILIGHT ); + } - if ( pSoldier->sGridNo != pSoldier->sFinalDestination && pSoldier->sGridNo != NOWHERE ) - { - pFace->uiFlags |= FACE_SHOW_MOVING_HILIGHT; - } - else - { - pFace->uiFlags &= ( ~FACE_SHOW_MOVING_HILIGHT ); - } + if ( pSoldier->sGridNo != pSoldier->pathing.sFinalDestination && pSoldier->sGridNo != NOWHERE ) + { + pFace->uiFlags |= FACE_SHOW_MOVING_HILIGHT; + } + else + { + pFace->uiFlags &= ( ~FACE_SHOW_MOVING_HILIGHT ); + } - if ( pSoldier->bStealthMode != pFace->bOldStealthMode ) - { - fRerender = TRUE; - } + if ( pSoldier->bStealthMode != pFace->bOldStealthMode ) + { + fRerender = TRUE; + } - // Check if we have fallen below OKLIFE... - if ( bLife < OKLIFE && pFace->bOldSoldierLife >= OKLIFE ) - { - fRerender = TRUE; - } + // Check if we have fallen below OKLIFE... + if ( bLife < OKLIFE && pFace->bOldSoldierLife >= OKLIFE ) + { + fRerender = TRUE; + } - if ( bLife >= OKLIFE && pFace->bOldSoldierLife < OKLIFE ) - { - fRerender = TRUE; - } + if ( bLife >= OKLIFE && pFace->bOldSoldierLife < OKLIFE ) + { + fRerender = TRUE; + } - // Check if we have fallen below CONSCIOUSNESS - if ( bLife < CONSCIOUSNESS && pFace->bOldSoldierLife >= CONSCIOUSNESS ) - { - fRerender = TRUE; - } - - if ( bLife >= CONSCIOUSNESS && pFace->bOldSoldierLife < CONSCIOUSNESS ) - { - fRerender = TRUE; - } + // Check if we have fallen below CONSCIOUSNESS + if ( bLife < CONSCIOUSNESS && pFace->bOldSoldierLife >= CONSCIOUSNESS ) + { + fRerender = TRUE; + } - if ( pSoldier->bOppCnt != pFace->bOldOppCnt ) - { - fRerender = TRUE; - } + if ( bLife >= CONSCIOUSNESS && pFace->bOldSoldierLife < CONSCIOUSNESS ) + { + fRerender = TRUE; + } - // Check if assignment is idfferent.... - if ( pSoldier->bAssignment != pFace->bOldAssignment ) - { + if ( pSoldier->aiData.bOppCnt != pFace->bOldOppCnt ) + { + fRerender = TRUE; + } + + // Check if assignment is idfferent.... + if ( pSoldier->bAssignment != pFace->bOldAssignment ) + { pFace->bOldAssignment = pSoldier->bAssignment; fRerender = TRUE; - } + } - // Check if we have fallen below CONSCIOUSNESS - if ( bAPs == 0 && pFace->bOldActionPoints > 0 ) - { - fRerender = TRUE; - } - - if ( bAPs > 0 && pFace->bOldActionPoints == 0 ) - { - fRerender = TRUE; - } + // Check if we have fallen below CONSCIOUSNESS + if ( bAPs == 0 && pFace->bOldActionPoints > 0 ) + { + fRerender = TRUE; + } - if ( !( pFace->uiFlags & FACE_SHOW_WHITE_HILIGHT ) && pFace->fOldShowHighlight ) - { - fRerender = TRUE; - } + if ( bAPs > 0 && pFace->bOldActionPoints == 0 ) + { + fRerender = TRUE; + } - if ( ( pFace->uiFlags & FACE_SHOW_WHITE_HILIGHT ) && !( pFace->fOldShowHighlight ) ) - { - fRerender = TRUE; - } + if ( !( pFace->uiFlags & FACE_SHOW_WHITE_HILIGHT ) && pFace->fOldShowHighlight ) + { + fRerender = TRUE; + } - if ( !( pFace->uiFlags & FACE_SHOW_MOVING_HILIGHT ) && pFace->fOldShowMoveHilight ) - { - fRerender = TRUE; - } + if ( ( pFace->uiFlags & FACE_SHOW_WHITE_HILIGHT ) && !( pFace->fOldShowHighlight ) ) + { + fRerender = TRUE; + } - if ( ( pFace->uiFlags & FACE_SHOW_MOVING_HILIGHT ) && !( pFace->fOldShowMoveHilight ) ) - { - fRerender = TRUE; - } + if ( !( pFace->uiFlags & FACE_SHOW_MOVING_HILIGHT ) && pFace->fOldShowMoveHilight ) + { + fRerender = TRUE; + } - if ( pFace->ubOldServiceCount != pSoldier->ubServiceCount ) - { - fRerender = TRUE; - pFace->ubOldServiceCount = pSoldier->ubServiceCount; - } + if ( ( pFace->uiFlags & FACE_SHOW_MOVING_HILIGHT ) && !( pFace->fOldShowMoveHilight ) ) + { + fRerender = TRUE; + } - if ( pFace->fOldCompatibleItems != pFace->fCompatibleItems || gfInItemPickupMenu || gpItemPointer != NULL ) - { - fRerender = TRUE; - pFace->fOldCompatibleItems = pFace->fCompatibleItems; - } + if ( pFace->ubOldServiceCount != pSoldier->ubServiceCount ) + { + fRerender = TRUE; + pFace->ubOldServiceCount = pSoldier->ubServiceCount; + } + + if ( pFace->fOldCompatibleItems != pFace->fCompatibleItems || gfInItemPickupMenu || gpItemPointer != NULL ) + { + fRerender = TRUE; + pFace->fOldCompatibleItems = pFace->fCompatibleItems; + } - if ( pFace->ubOldServicePartner != pSoldier->ubServicePartner ) - { - fRerender = TRUE; - pFace->ubOldServicePartner = pSoldier->ubServicePartner; - } + if ( pFace->ubOldServicePartner != pSoldier->ubServicePartner ) + { + fRerender = TRUE; + pFace->ubOldServicePartner = pSoldier->ubServicePartner; + } - pFace->fOldHandleUIHatch = fHandleUIHatch; - pFace->bOldSoldierLife = bLife; - pFace->bOldActionPoints = bAPs; - pFace->bOldStealthMode = pSoldier->bStealthMode; - pFace->bOldOppCnt = pSoldier->bOppCnt; + pFace->fOldHandleUIHatch = fHandleUIHatch; + pFace->bOldSoldierLife = bLife; + pFace->bOldActionPoints = bAPs; + pFace->bOldStealthMode = pSoldier->bStealthMode; + pFace->bOldOppCnt = pSoldier->aiData.bOppCnt; - if ( pFace->uiFlags & FACE_SHOW_WHITE_HILIGHT ) - { + if ( pFace->uiFlags & FACE_SHOW_WHITE_HILIGHT ) + { pFace->fOldShowHighlight = TRUE; - } - else - { + } + else + { pFace->fOldShowHighlight = FALSE; - } + } - if ( pFace->uiFlags & FACE_SHOW_MOVING_HILIGHT ) - { - pFace->fOldShowMoveHilight = TRUE; - } - else - { - pFace->fOldShowMoveHilight = FALSE; - } + if ( pFace->uiFlags & FACE_SHOW_MOVING_HILIGHT ) + { + pFace->fOldShowMoveHilight = TRUE; + } + else + { + pFace->fOldShowMoveHilight = FALSE; + } - if ( pSoldier->fGettingHit && pSoldier->fFlashPortrait == FLASH_PORTRAIT_STOP ) + if ( pSoldier->flags.fGettingHit && pSoldier->flags.fFlashPortrait == FLASH_PORTRAIT_STOP ) { - pSoldier->fFlashPortrait = TRUE; + pSoldier->flags.fFlashPortrait = TRUE; pSoldier->bFlashPortraitFrame = FLASH_PORTRAIT_STARTSHADE; - RESETTIMECOUNTER( pSoldier->PortraitFlashCounter, FLASH_PORTRAIT_DELAY ); - fRerender = TRUE; + RESETTIMECOUNTER( pSoldier->timeCounters.PortraitFlashCounter, FLASH_PORTRAIT_DELAY ); + fRerender = TRUE; } - if ( pSoldier->fFlashPortrait == FLASH_PORTRAIT_START ) + if ( pSoldier->flags.fFlashPortrait == FLASH_PORTRAIT_START ) { // Loop through flash values - if ( TIMECOUNTERDONE( pSoldier->PortraitFlashCounter, FLASH_PORTRAIT_DELAY ) ) - { - RESETTIMECOUNTER( pSoldier->PortraitFlashCounter, FLASH_PORTRAIT_DELAY ); + if ( TIMECOUNTERDONE( pSoldier->timeCounters.PortraitFlashCounter, FLASH_PORTRAIT_DELAY ) ) + { + RESETTIMECOUNTER( pSoldier->timeCounters.PortraitFlashCounter, FLASH_PORTRAIT_DELAY ); pSoldier->bFlashPortraitFrame++; if ( pSoldier->bFlashPortraitFrame > FLASH_PORTRAIT_ENDSHADE ) { pSoldier->bFlashPortraitFrame = FLASH_PORTRAIT_ENDSHADE; - if ( pSoldier->fGettingHit ) + if ( pSoldier->flags.fGettingHit ) { - pSoldier->fFlashPortrait = FLASH_PORTRAIT_WAITING; + pSoldier->flags.fFlashPortrait = FLASH_PORTRAIT_WAITING; } else { // Render face again! - pSoldier->fFlashPortrait = FLASH_PORTRAIT_STOP; + pSoldier->flags.fFlashPortrait = FLASH_PORTRAIT_STOP; } - fRerender = TRUE; + fRerender = TRUE; } } } // CHECK IF WE WERE WAITING FOR GETTING HIT TO FINISH! - if ( !pSoldier->fGettingHit && pSoldier->fFlashPortrait == FLASH_PORTRAIT_WAITING ) + if ( !pSoldier->flags.fGettingHit && pSoldier->flags.fFlashPortrait == FLASH_PORTRAIT_WAITING ) { - pSoldier->fFlashPortrait = FALSE; - fRerender = TRUE; + pSoldier->flags.fFlashPortrait = FALSE; + fRerender = TRUE; } - if ( pSoldier->fFlashPortrait == FLASH_PORTRAIT_START ) + if ( pSoldier->flags.fFlashPortrait == FLASH_PORTRAIT_START ) { - fRerender = TRUE; + fRerender = TRUE; } - if( pFace->uiFlags & FACE_REDRAW_WHOLE_FACE_NEXT_FRAME ) - { - pFace->uiFlags &= ~FACE_REDRAW_WHOLE_FACE_NEXT_FRAME; + if( pFace->uiFlags & FACE_REDRAW_WHOLE_FACE_NEXT_FRAME ) + { + pFace->uiFlags &= ~FACE_REDRAW_WHOLE_FACE_NEXT_FRAME; - fRerender = TRUE; - } + fRerender = TRUE; + } - if ( fInterfacePanelDirty == DIRTYLEVEL2 && guiCurrentScreen == GAME_SCREEN ) - { - fRerender = TRUE; - } + if ( fInterfacePanelDirty == DIRTYLEVEL2 && guiCurrentScreen == GAME_SCREEN ) + { + fRerender = TRUE; + } - if ( fRerender ) - { + if ( fRerender ) + { RenderAutoFace( uiCount ); - } + } - if ( bLife < CONSCIOUSNESS ) - { - fHandleFace = FALSE; - } + if ( bLife < CONSCIOUSNESS ) + { + fHandleFace = FALSE; + } } if ( fHandleFace ) @@ -2052,7 +2052,7 @@ void HandleAutoFaces( ) } } - + } void HandleTalkingAutoFaces( ) @@ -2063,14 +2063,14 @@ void HandleTalkingAutoFaces( ) for ( uiCount = 0; uiCount < guiNumFaces; uiCount++ ) { // OK, NOW, check if our bLife status has changed, re-render if so! - if ( gFacesData[ uiCount ].fAllocated ) + if ( gFacesData[ uiCount ].fAllocated ) { pFace = &gFacesData[ uiCount ]; HandleTalkingAutoFace( uiCount ); } - } + } } @@ -2079,7 +2079,7 @@ BOOLEAN FaceRestoreSavedBackgroundRect( INT32 iFaceIndex, INT16 sDestLeft, INT16 { FACETYPE *pFace; UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; - UINT8 *pDestBuf, *pSrcBuf; + UINT8 *pDestBuf, *pSrcBuf; // Check face index CHECKF( iFaceIndex != -1 ); @@ -2095,10 +2095,10 @@ BOOLEAN FaceRestoreSavedBackgroundRect( INT32 iFaceIndex, INT16 sDestLeft, INT16 pDestBuf = LockVideoSurface(pFace->uiAutoDisplayBuffer, &uiDestPitchBYTES); pSrcBuf = LockVideoSurface( pFace->uiAutoRestoreBuffer, &uiSrcPitchBYTES); - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - sDestLeft , sDestTop, - sSrcLeft , sSrcTop, + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + sDestLeft , sDestTop, + sSrcLeft , sSrcTop, sWidth, sHeight); UnLockVideoSurface(pFace->uiAutoDisplayBuffer); @@ -2112,11 +2112,11 @@ BOOLEAN FaceRestoreSavedBackgroundRect( INT32 iFaceIndex, INT16 sDestLeft, INT16 return(TRUE); } -BOOLEAN SetFaceTalking( INT32 iFaceIndex, CHAR8 *zSoundFile, STR16 zTextString, +BOOLEAN SetFaceTalking( INT32 iFaceIndex, CHAR8 *zSoundFile, STR16 zTextString, UINT32 usRate, UINT32 ubVolume, UINT32 ubLoops, UINT32 uiPan ) { FACETYPE *pFace; - + pFace = &gFacesData[ iFaceIndex ]; // Set face to talking @@ -2124,10 +2124,10 @@ BOOLEAN SetFaceTalking( INT32 iFaceIndex, CHAR8 *zSoundFile, STR16 zTextString, pFace->fAnimatingTalking = TRUE; pFace->fFinishTalking = FALSE; - if ( !AreInMeanwhile( ) ) - { - TurnOnSectorLocator( pFace->ubCharacterNum ); - } + if ( !AreInMeanwhile( ) ) + { + TurnOnSectorLocator( pFace->ubCharacterNum ); + } // Play sample if( gGameSettings.fOptions[ TOPTION_SPEECH ] ) @@ -2138,7 +2138,7 @@ BOOLEAN SetFaceTalking( INT32 iFaceIndex, CHAR8 *zSoundFile, STR16 zTextString, if ( pFace->uiSoundID != SOUND_ERROR ) { pFace->fValidSpeech = TRUE; - + pFace->uiTalkingFromVeryBeginningTimer = GetJA2Clock( ); } else @@ -2158,7 +2158,7 @@ BOOLEAN SetFaceTalking( INT32 iFaceIndex, CHAR8 *zSoundFile, STR16 zTextString, BOOLEAN ExternSetFaceTalking( INT32 iFaceIndex, UINT32 uiSoundID ) { FACETYPE *pFace; - + pFace = &gFacesData[ iFaceIndex ]; // Set face to talki ng @@ -2180,7 +2180,7 @@ void InternalShutupaYoFace( INT32 iFaceIndex, BOOLEAN fForce ) // Check face index CHECKV( iFaceIndex != -1 ); - + pFace = &gFacesData[ iFaceIndex ]; if ( pFace->fTalking ) @@ -2211,7 +2211,7 @@ void InternalShutupaYoFace( INT32 iFaceIndex, BOOLEAN fForce ) } else { - FaceRestoreSavedBackgroundRect( iFaceIndex, pFace->usMouthX, pFace->usMouthY, pFace->usMouthOffsetX, pFace->usMouthOffsetY, pFace->usMouthWidth, pFace->usMouthHeight ); + FaceRestoreSavedBackgroundRect( iFaceIndex, pFace->usMouthX, pFace->usMouthY, pFace->usMouthOffsetX, pFace->usMouthOffsetY, pFace->usMouthWidth, pFace->usMouthHeight ); } } // OK, smart guy, make sure this guy has finished talking, @@ -2243,7 +2243,7 @@ void SetupFinalTalkingDelay( FACETYPE *pFace ) pFace->uiTalkingTimer = GetJA2Clock( ); - if ( gGameSettings.fOptions[ TOPTION_SUBTITLES ] ) + if ( gGameSettings.fOptions[ TOPTION_SUBTITLES ] ) { //pFace->uiTalkingDuration = FINAL_TALKING_DURATION; pFace->uiTalkingDuration = 300; diff --git a/Tactical/GAP.cpp b/Tactical/GAP.cpp index 58e50c51..77df8e32 100644 --- a/Tactical/GAP.cpp +++ b/Tactical/GAP.cpp @@ -20,24 +20,24 @@ static void AILCALLBACK timer_func( UINT32 user ) pGapList = (AudioGapList*)user; - pGapList->gap_monitor_timer += GAP_TIMER_INTERVAL; + pGapList->gap_monitor_timer += GAP_TIMER_INTERVAL; - if ( pGapList->audio_gap_active ) - { - if ( (pGapList->gap_monitor_timer / 1000) > pGapList->end[ pGapList->gap_monitor_current] ) - { - pGapList->audio_gap_active = 0; - pGapList->gap_monitor_current++; - } - } - else + if ( pGapList->audio_gap_active ) { - if ( pGapList->gap_monitor_current < pGapList->count ) + if ( (pGapList->gap_monitor_timer / 1000) > pGapList->end[ pGapList->gap_monitor_current] ) + { + pGapList->audio_gap_active = 0; + pGapList->gap_monitor_current++; + } + } + else + { + if ( pGapList->gap_monitor_current < pGapList->count ) + { + if ( ( pGapList->gap_monitor_timer / 1000) >= pGapList->start[ pGapList->gap_monitor_current ]) { - if ( ( pGapList->gap_monitor_timer / 1000) >= pGapList->start[ pGapList->gap_monitor_current ]) - { pGapList->audio_gap_active = 1; - } + } } } } @@ -49,7 +49,7 @@ void AudioGapListInit( CHAR8 *zSoundFile, AudioGapList *pGapList ) // This procedure will load in the appropriate .gap file, corresponding // to the .wav file in szSoundEffects indexed by uiSampleNum // The procedure will then allocate and load in the AUDIO_GAP information, - // while counting the number of elements loaded + // while counting the number of elements loaded // FILE *pFile; HWFILE pFile; @@ -80,7 +80,7 @@ void AudioGapListInit( CHAR8 *zSoundFile, AudioGapList *pGapList ) while(pDestFileName[counter] !='.') { - counter++; + counter++; } pDestFileName[counter+1]='g'; @@ -92,85 +92,85 @@ void AudioGapListInit( CHAR8 *zSoundFile, AudioGapList *pGapList ) if( pFile ) { counter=0; - // gap file exists - // now read in the AUDIO_GAPs - - //fread(&Start,sizeof(UINT32), 1, pFile); - FileRead( pFile, &Start,sizeof(UINT32), &uiNumBytesRead ); - + // gap file exists + // now read in the AUDIO_GAPs + + //fread(&Start,sizeof(UINT32), 1, pFile); + FileRead( pFile, &Start,sizeof(UINT32), &uiNumBytesRead ); + // while ( !feof(pFile) ) while ( !FileCheckEndOfFile( pFile ) ) { - // can read the first element, there exists a second + // can read the first element, there exists a second //fread(&End, sizeof(UINT32),1,pFile); - FileRead( pFile, &End, sizeof(UINT32), &uiNumBytesRead ); - - // allocate space for AUDIO_GAP - pCurrentGap = (AUDIO_GAP *)MemAlloc( sizeof(AUDIO_GAP) ); - if (pPreviousGap !=0) - pPreviousGap->pNext=pCurrentGap; - else + FileRead( pFile, &End, sizeof(UINT32), &uiNumBytesRead ); + + // allocate space for AUDIO_GAP + pCurrentGap = (AUDIO_GAP *)MemAlloc( sizeof(AUDIO_GAP) ); + if (pPreviousGap !=0) + pPreviousGap->pNext=pCurrentGap; + else { - // Start of list - pGapList->pCurrent=pCurrentGap; - pGapList->pHead=pCurrentGap; + // Start of list + pGapList->pCurrent=pCurrentGap; + pGapList->pHead=pCurrentGap; } - pGapList->size++; - pCurrentGap->pNext=0; - pCurrentGap->uiStart=Start; - pCurrentGap->uiEnd=End; - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Gap Start %d and Ends %d", Start, End) ); + pGapList->size++; + pCurrentGap->pNext=0; + pCurrentGap->uiStart=Start; + pCurrentGap->uiEnd=End; + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Gap Start %d and Ends %d", Start, End) ); + + // Increment pointer + pPreviousGap=pCurrentGap; - // Increment pointer - pPreviousGap=pCurrentGap; - // fread(&Start,sizeof(UINT32), 1, pFile); - FileRead( pFile, &Start, sizeof(UINT32), &uiNumBytesRead ); + FileRead( pFile, &Start, sizeof(UINT32), &uiNumBytesRead ); } - + pGapList->audio_gap_active=FALSE; pGapList->current_time=0; - - + + //fclose(pFile); - FileClose( pFile ); - } - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Gap List Started From File %s and has %d gaps", pDestFileName, pGapList->size) ); + FileClose( pFile ); + } + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Gap List Started From File %s and has %d gaps", pDestFileName, pGapList->size) ); } void AudioGapListDone( AudioGapList *pGapList ) { - // This procedure will go through the AudioGapList and free space/nullify pointers + // This procedure will go through the AudioGapList and free space/nullify pointers // for any allocated elements AUDIO_GAP *pCurrent, *pNext; - if (pGapList->pHead !=0) + if (pGapList->pHead !=0) { - - pCurrent=pGapList->pHead; - pNext=pCurrent->pNext; - // There are elements in the list - while(pNext !=0) + + pCurrent=pGapList->pHead; + pNext=pCurrent->pNext; + // There are elements in the list + while(pNext !=0) { - // kill pCurrent - MemFree(pCurrent); - pCurrent=pNext; - pNext=pNext->pNext; + // kill pCurrent + MemFree(pCurrent); + pCurrent=pNext; + pNext=pNext->pNext; } // now kill the last element MemFree(pCurrent); - pCurrent=0; - + pCurrent=0; + } pGapList->pHead=0; pGapList->pCurrent=0; pGapList->size = 0; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Audio Gap List Deleted") ); } - + void PollAudioGap( UINT32 uiSampleNum, AudioGapList *pGapList ) @@ -182,70 +182,70 @@ void PollAudioGap( UINT32 uiSampleNum, AudioGapList *pGapList ) // the uiStart of the next element is not greater than current time, set current to next and repeat // ...if next elements uiStart is larger than current_time, or no more elements.. // set flag FALSE - + UINT32 time; AUDIO_GAP *pCurrent; if(!pGapList) { - // no gap list, return - return; + // no gap list, return + return; } if (pGapList->size > 0) { - time=SoundGetPosition(uiSampleNum); -// DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Sound Sample Time is %d", time) ); + time=SoundGetPosition(uiSampleNum); +// DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Sound Sample Time is %d", time) ); } else { - pGapList->audio_gap_active=(FALSE); + pGapList->audio_gap_active=(FALSE); return; } - + // set current ot head of gap list for this sound - pCurrent = pGapList -> pHead; + pCurrent = pGapList->pHead; // check to see if we have fallen behind - if( ( time > pCurrent-> uiEnd ) ) + if( ( time > pCurrent->uiEnd ) ) { - // fallen behind - // catchup - while( time > pCurrent -> uiEnd ) - { - pCurrent = pCurrent -> pNext; - if( ! pCurrent ) - { - pGapList->audio_gap_active=(FALSE); - return; - } - } + // fallen behind + // catchup + while( time > pCurrent->uiEnd ) + { + pCurrent = pCurrent->pNext; + if( ! pCurrent ) + { + pGapList->audio_gap_active=(FALSE); + return; + } + } } - - + + // check to see if time is within the next AUDIO_GAPs start time - if ( ( time > pCurrent ->uiStart ) && ( time < pCurrent->uiEnd ) ) + if ( ( time > pCurrent->uiStart ) && ( time < pCurrent->uiEnd ) ) { - - if ((time >pCurrent->uiStart)&&(time < pCurrent->uiEnd)) - { - // we are within the time frame - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Gap Started at %d", time) ); - pGapList->audio_gap_active=(TRUE); - - } - else if ( (time > pCurrent->uiEnd)&&(pGapList->audio_gap_active == TRUE) ) - { - // reset if already set - pGapList->audio_gap_active=(FALSE); - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Gap Ended at %d", time) ); - } + + if ((time >pCurrent->uiStart)&&(time < pCurrent->uiEnd)) + { + // we are within the time frame + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Gap Started at %d", time) ); + pGapList->audio_gap_active=(TRUE); + } - else + else if ( (time > pCurrent->uiEnd)&&(pGapList->audio_gap_active == TRUE) ) + { + // reset if already set + pGapList->audio_gap_active=(FALSE); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Gap Ended at %d", time) ); + } + } + else { - pGapList->audio_gap_active=(FALSE); + pGapList->audio_gap_active=(FALSE); } } @@ -258,7 +258,7 @@ UINT32 PlayJA2GapSample( CHAR8 *zSoundFile, UINT32 usRate, UINT32 ubVolume, UINT memset(&spParms, 0xff, sizeof(SOUNDPARMS)); spParms.uiSpeed = usRate; - spParms.uiVolume = (UINT32) ( ( ubVolume / (FLOAT) HIGHVOLUME ) * GetSpeechVolume( ) ); + spParms.uiVolume = (UINT32) ( ( ubVolume / (FLOAT) HIGHVOLUME ) * GetSpeechVolume( ) ); spParms.uiLoop = ubLoops; spParms.uiPan = uiPan; spParms.uiPriority=GROUP_PLAYER; @@ -266,9 +266,10 @@ UINT32 PlayJA2GapSample( CHAR8 *zSoundFile, UINT32 usRate, UINT32 ubVolume, UINT // Setup Gap Detection, if it is not null if( pData != NULL ) AudioGapListInit( zSoundFile, pData ); - + return(SoundPlayStreamedFile( zSoundFile, &spParms)); } + diff --git a/Tactical/Handle Doors.cpp b/Tactical/Handle Doors.cpp index 4814a8ab..ba2be47c 100644 --- a/Tactical/Handle Doors.cpp +++ b/Tactical/Handle Doors.cpp @@ -18,8 +18,8 @@ #include "tile animation.h" #include "Interactive Tiles.h" #include "handle doors.h" - #include "sound control.h" - #include "interface.h" + #include "Sound Control.h" + #include "interface.h" #include "keys.h" #include "message.h" #include "text.h" @@ -52,7 +52,7 @@ void HandleDoorChangeFromGridNo( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN f if ( pStructure == NULL ) { #ifdef JA2TESTVERSION - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"ERROR: Told to handle door that does not exist at %d.", sGridNo ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"ERROR: Told to handle door that does not exist at %d.", sGridNo ); #endif return; } @@ -87,148 +87,148 @@ UINT16 GetAnimStateForInteraction( SOLDIERTYPE *pSoldier, BOOLEAN fDoor, UINT16 { case OPEN_DOOR: - if ( pSoldier->ubBodyType == CRIPPLECIV ) - { - return( CRIPPLE_OPEN_DOOR ); - } - else - { - if ( fDoor ) - { - if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND ) - { - return( OPEN_DOOR_CROUCHED ); - } - else - { - return( usAnimState ); - } - } - else - { - if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND ) - { - return( BEGIN_OPENSTRUCT_CROUCHED ); - } - else - { - return( BEGIN_OPENSTRUCT ); - } - } - } + if ( pSoldier->ubBodyType == CRIPPLECIV ) + { + return( CRIPPLE_OPEN_DOOR ); + } + else + { + if ( fDoor ) + { + if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND ) + { + return( OPEN_DOOR_CROUCHED ); + } + else + { + return( usAnimState ); + } + } + else + { + if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND ) + { + return( BEGIN_OPENSTRUCT_CROUCHED ); + } + else + { + return( BEGIN_OPENSTRUCT ); + } + } + } break; case CLOSE_DOOR: - if ( pSoldier->ubBodyType == CRIPPLECIV ) - { - return( CRIPPLE_CLOSE_DOOR ); - } - else - { - if ( fDoor ) - { - if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND ) - { - return( CLOSE_DOOR_CROUCHED ); - } - else - { - return( usAnimState ); - } - } - else - { - if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND ) - { - return( OPEN_STRUCT_CROUCHED ); - } - else - { - return( OPEN_STRUCT ); - } - } - } + if ( pSoldier->ubBodyType == CRIPPLECIV ) + { + return( CRIPPLE_CLOSE_DOOR ); + } + else + { + if ( fDoor ) + { + if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND ) + { + return( CLOSE_DOOR_CROUCHED ); + } + else + { + return( usAnimState ); + } + } + else + { + if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND ) + { + return( OPEN_STRUCT_CROUCHED ); + } + else + { + return( OPEN_STRUCT ); + } + } + } break; case END_OPEN_DOOR: - if ( pSoldier->ubBodyType == CRIPPLECIV ) - { - return( CRIPPLE_END_OPEN_DOOR ); - } - else - { - if ( fDoor ) - { - if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND ) - { - return( END_OPEN_DOOR_CROUCHED ); - } - else - { - return( usAnimState ); - } - } - else - { - if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND ) - { - return( END_OPENSTRUCT_CROUCHED ); - } - else - { - return( END_OPENSTRUCT ); - } - } - } + if ( pSoldier->ubBodyType == CRIPPLECIV ) + { + return( CRIPPLE_END_OPEN_DOOR ); + } + else + { + if ( fDoor ) + { + if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND ) + { + return( END_OPEN_DOOR_CROUCHED ); + } + else + { + return( usAnimState ); + } + } + else + { + if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND ) + { + return( END_OPENSTRUCT_CROUCHED ); + } + else + { + return( END_OPENSTRUCT ); + } + } + } break; case END_OPEN_LOCKED_DOOR: - if ( pSoldier->ubBodyType == CRIPPLECIV ) - { - return( CRIPPLE_END_OPEN_LOCKED_DOOR ); - } - else - { - if ( fDoor ) - { - if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND ) - { - return( END_OPEN_LOCKED_DOOR_CROUCHED ); - } - else - { - return( END_OPEN_LOCKED_DOOR ); - } - } - else - { - if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND ) - { - return( END_OPENSTRUCT_LOCKED_CROUCHED ); - } - else - { - return( END_OPENSTRUCT_LOCKED ); - } - } - } + if ( pSoldier->ubBodyType == CRIPPLECIV ) + { + return( CRIPPLE_END_OPEN_LOCKED_DOOR ); + } + else + { + if ( fDoor ) + { + if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND ) + { + return( END_OPEN_LOCKED_DOOR_CROUCHED ); + } + else + { + return( END_OPEN_LOCKED_DOOR ); + } + } + else + { + if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND ) + { + return( END_OPENSTRUCT_LOCKED_CROUCHED ); + } + else + { + return( END_OPENSTRUCT_LOCKED ); + } + } + } break; case PICK_LOCK: if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND ) { - return( LOCKPICK_CROUCHED ); - } - else - { - return( PICK_LOCK ); - } - break; + return( LOCKPICK_CROUCHED ); + } + else + { + return( PICK_LOCK ); + } + break; default: // should never happen! @@ -241,7 +241,7 @@ UINT16 GetAnimStateForInteraction( SOLDIERTYPE *pSoldier, BOOLEAN fDoor, UINT16 void InteractWithClosedDoor( SOLDIERTYPE *pSoldier, UINT8 ubHandleCode ) { - pSoldier->ubDoorHandleCode = ubHandleCode; + pSoldier->aiData.ubDoorHandleCode = ubHandleCode; switch( ubHandleCode ) { @@ -253,17 +253,17 @@ void InteractWithClosedDoor( SOLDIERTYPE *pSoldier, UINT8 ubHandleCode ) case HANDLE_DOOR_UNTRAP: case HANDLE_DOOR_CROWBAR: - ChangeSoldierState( pSoldier, GetAnimStateForInteraction( pSoldier, TRUE, OPEN_DOOR ), 0, FALSE ); + pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, TRUE, OPEN_DOOR ), 0, FALSE ); break; case HANDLE_DOOR_FORCE: - ChangeSoldierState( pSoldier, KICK_DOOR, 0 , FALSE ); + pSoldier->ChangeSoldierState( KICK_DOOR, 0 , FALSE ); break; case HANDLE_DOOR_LOCKPICK: - ChangeSoldierState( pSoldier, GetAnimStateForInteraction( pSoldier, TRUE, PICK_LOCK ), 0 , FALSE ); + pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, TRUE, PICK_LOCK ), 0 , FALSE ); break; } @@ -283,11 +283,11 @@ BOOLEAN DoTrapCheckOnStartingMenu( SOLDIERTYPE * pSoldier, DOOR * pDoor ) TacticalCharacterDialogue( pSoldier, QUOTE_BOOBYTRAP_ITEM ); UpdateDoorPerceivedValue( pDoor ); - return( TRUE ); + return( TRUE ); } } - return( FALSE ); + return( FALSE ); } void InteractWithOpenableStruct( SOLDIERTYPE *pSoldier, STRUCTURE *pStructure, UINT8 ubDirection, BOOLEAN fDoor ) @@ -296,7 +296,7 @@ void InteractWithOpenableStruct( SOLDIERTYPE *pSoldier, STRUCTURE *pStructure, U BOOLEAN fDoMenu = FALSE; DOOR * pDoor = NULL; DOOR_STATUS * pDoorStatus; - BOOLEAN fTrapsFound = FALSE; + BOOLEAN fTrapsFound = FALSE; pBaseStructure = FindBaseStructure( pStructure ); @@ -307,21 +307,21 @@ void InteractWithOpenableStruct( SOLDIERTYPE *pSoldier, STRUCTURE *pStructure, U if ( pDoorStatus && (pDoorStatus->ubFlags & DOOR_BUSY) ) { // Send this guy into stationary stance.... - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); if ( pSoldier->bTeam == gbPlayerNum ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ DOOR_IS_BUSY ] ); } - else - { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Trying to open door and door is busy: %d", pSoldier->ubID ) ); - } + else + { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Trying to open door and door is busy: %d", pSoldier->ubID ) ); + } return; } } - EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection ); + pSoldier->EVENT_SetSoldierDesiredDirection( ubDirection ); // Is the door opened? if ( pStructure->fFlags & STRUCTURE_OPEN ) @@ -329,27 +329,27 @@ void InteractWithOpenableStruct( SOLDIERTYPE *pSoldier, STRUCTURE *pStructure, U if ( pSoldier->ubID <= gTacticalStatus.Team[ gbPlayerNum ].bLastID && !( pStructure->fFlags & STRUCTURE_SWITCH ) ) { // Bring up menu to decide what to do.... - SoldierGotoStationaryStance( pSoldier ); + pSoldier->SoldierGotoStationaryStance( ); pDoor = FindDoorInfoAtGridNo( pBaseStructure->sGridNo ); if ( pDoor ) { if ( DoTrapCheckOnStartingMenu( pSoldier, pDoor ) ) - { - fTrapsFound = TRUE; - } + { + fTrapsFound = TRUE; + } } // Pull Up Menu - if ( !fTrapsFound ) - { - InitDoorOpenMenu( pSoldier, pStructure, ubDirection, TRUE ); - } + if ( !fTrapsFound ) + { + InitDoorOpenMenu( pSoldier, pStructure, ubDirection, TRUE ); + } } else { // Easily close door.... - ChangeSoldierState( pSoldier, GetAnimStateForInteraction( pSoldier, fDoor, CLOSE_DOOR ), 0, FALSE ); + pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, fDoor, CLOSE_DOOR ), 0, FALSE ); } } else @@ -361,31 +361,31 @@ void InteractWithOpenableStruct( SOLDIERTYPE *pSoldier, STRUCTURE *pStructure, U if ( pDoor != NULL ) { - // Assume true + // Assume true fDoMenu = TRUE; - // Check if it's locked..... - // If not locked, don't bring it up! - if ( !pDoor->fLocked ) - { - fDoMenu = FALSE; - } + // Check if it's locked..... + // If not locked, don't bring it up! + if ( !pDoor->fLocked ) + { + fDoMenu = FALSE; + } } } if ( fDoMenu ) { // Bring up menu to decide what to do.... - SoldierGotoStationaryStance( pSoldier ); + pSoldier->SoldierGotoStationaryStance( ); if ( DoTrapCheckOnStartingMenu( pSoldier, pDoor ) ) - { - fTrapsFound = TRUE; - } + { + fTrapsFound = TRUE; + } // Pull Up Menu - if ( !fTrapsFound ) - { + if ( !fTrapsFound ) + { // In autobandage mode, assuming no traps are found, try to automatically unlock the door. If we can't, then we can't if (gTacticalStatus.fAutoBandageMode) { @@ -393,18 +393,18 @@ void InteractWithOpenableStruct( SOLDIERTYPE *pSoldier, STRUCTURE *pStructure, U return; } - InitDoorOpenMenu( pSoldier, pStructure, ubDirection, FALSE ); - } - else - { - UnSetUIBusy( pSoldier->ubID ); - } + InitDoorOpenMenu( pSoldier, pStructure, ubDirection, FALSE ); } else { - pSoldier->ubDoorHandleCode = HANDLE_DOOR_OPEN; + UnSetUIBusy( pSoldier->ubID ); + } + } + else + { + pSoldier->aiData.ubDoorHandleCode = HANDLE_DOOR_OPEN; - ChangeSoldierState( pSoldier, GetAnimStateForInteraction( pSoldier, fDoor, OPEN_DOOR ), 0, FALSE ); + pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, fDoor, OPEN_DOOR ), 0, FALSE ); } } @@ -423,7 +423,7 @@ void ProcessImplicationsOfPCMessingWithDoor( SOLDIERTYPE * pSoldier ) for ( ubLoop = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; ubLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ubLoop++ ) { pGoon = MercPtrs[ ubLoop ]; - if ( pGoon->ubCivilianGroup == KINGPIN_CIV_GROUP && pGoon->bActive && pGoon->bInSector && pGoon->bLife >= OKLIFE && pGoon->bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY ) + if ( pGoon->ubCivilianGroup == KINGPIN_CIV_GROUP && pGoon->bActive && pGoon->bInSector && pGoon->stats.bLife >= OKLIFE && pGoon->aiData.bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY ) { MakeCivHostile( pGoon, 2 ); if ( ! (gTacticalStatus.uiFlags & INCOMBAT) ) @@ -437,10 +437,10 @@ void ProcessImplicationsOfPCMessingWithDoor( SOLDIERTYPE * pSoldier ) if ( gWorldSectorX == TIXA_SECTOR_X && gWorldSectorY == TIXA_SECTOR_Y ) { pGoon = FindSoldierByProfileID( WARDEN, FALSE ); - if ( pGoon && pGoon->bAlertStatus < STATUS_RED && PythSpacesAway( pSoldier->sGridNo, pGoon->sGridNo ) <= 5 ) + if ( pGoon && pGoon->aiData.bAlertStatus < STATUS_RED && PythSpacesAway( pSoldier->sGridNo, pGoon->sGridNo ) <= 5 ) { // alert her if she hasn't been alerted - pGoon->bAlertStatus = STATUS_RED; + pGoon->aiData.bAlertStatus = STATUS_RED; CheckForChangingOrders( pGoon ); CancelAIAction( pGoon, TRUE ); } @@ -456,8 +456,7 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p DOOR *pDoor; BOOLEAN fTrapFound = FALSE; BOOLEAN fDoAction = TRUE; - BOOLEAN fDoor = FALSE; - INT8 bItemIn = FALSE; + BOOLEAN fDoor = FALSE; // Are we a door? if (pStructure->fFlags & STRUCTURE_ANYDOOR) @@ -486,7 +485,7 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p pDoor = FindDoorInfoAtGridNo( sGridNo ); // Alrighty, first check for traps ( unless we are examining.... ) - if ( pSoldier->ubDoorHandleCode != HANDLE_DOOR_EXAMINE && pSoldier->ubDoorHandleCode != HANDLE_DOOR_UNTRAP && pSoldier->ubDoorHandleCode != HANDLE_DOOR_UNLOCK ) + if ( pSoldier->aiData.ubDoorHandleCode != HANDLE_DOOR_EXAMINE && pSoldier->aiData.ubDoorHandleCode != HANDLE_DOOR_UNTRAP && pSoldier->aiData.ubDoorHandleCode != HANDLE_DOOR_UNLOCK ) { if ( pDoor != NULL ) { @@ -500,8 +499,8 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p // Set AP costs to that of opening a door sAPCost = AP_OPEN_DOOR; sBPCost = BP_OPEN_DOOR; - - ChangeSoldierState( pSoldier, GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); + + pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); // Did we inadvertently set it off? if ( HasDoorTrapGoneOff( pSoldier, pDoor ) ) @@ -512,7 +511,7 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p if (DoorTrapTable[pDoor->ubTrapID].fFlags & DOOR_TRAP_STOPS_ACTION) { // trap stops person from opening door! - fDoAction = FALSE; + fDoAction = FALSE; } if (!( DoorTrapTable[pDoor->ubTrapID].fFlags & DOOR_TRAP_RECURRING ) ) { @@ -543,7 +542,7 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p } // Stop action this time.... - fDoAction = FALSE; + fDoAction = FALSE; // report! TacticalCharacterDialogue( pSoldier, QUOTE_BOOBYTRAP_ITEM ); @@ -555,7 +554,7 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p if (DoorTrapTable[pDoor->ubTrapID].fFlags & DOOR_TRAP_STOPS_ACTION) { // trap stops person from opening door! - fDoAction = FALSE; + fDoAction = FALSE; } if (!( DoorTrapTable[pDoor->ubTrapID].fFlags & DOOR_TRAP_RECURRING ) ) { @@ -574,7 +573,7 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p if ( fDoAction ) { // OK, switch based on how we are going to open door.... - switch( pSoldier->ubDoorHandleCode ) + switch( pSoldier->aiData.ubDoorHandleCode ) { case HANDLE_DOOR_OPEN: @@ -586,7 +585,7 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p sBPCost = BP_OPEN_DOOR; // Open if it's not locked.... - ChangeSoldierState( pSoldier, GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); + pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); fHandleDoor = TRUE; break; } @@ -595,13 +594,13 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p if ( pDoor->fLocked ) { // it's locked.... - ChangeSoldierState( pSoldier, GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_LOCKED_DOOR ), 0, FALSE ); + pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_LOCKED_DOOR ), 0, FALSE ); // Do we have a quote for locked stuff? // Now just show on message bar if ( !AM_AN_EPC( pSoldier ) ) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_LOCKED ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_LOCKED ); } else { @@ -610,14 +609,14 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p } else { - ChangeSoldierState( pSoldier, GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); + pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); fHandleDoor = TRUE; } UpdateDoorPerceivedValue( pDoor ); break; } break; - + case HANDLE_DOOR_FORCE: // Set costs for these @@ -627,7 +626,7 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p // OK, using force, if we have no lock, just open the door! if ( pDoor == NULL ) { - ChangeSoldierState( pSoldier, GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); + pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); fHandleDoor = TRUE; ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ DOOR_THERE_IS_NO_LOCK_STR ] ); @@ -638,7 +637,7 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p if ( AttemptToSmashDoor( pSoldier, pDoor ) ) { //ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ DOOR_LOCK_DESTROYED_STR ] ); - // DoMercBattleSound( pSoldier, BATTLE_SOUND_COOL1 ); + // pSoldier->DoMercBattleSound( BATTLE_SOUND_COOL1 ); fHandleDoor = TRUE; } else @@ -660,7 +659,7 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p // OK, using force, if we have no lock, just open the door! if ( pDoor == NULL ) { - ChangeSoldierState( pSoldier, GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); + pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); fHandleDoor = TRUE; ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ DOOR_THERE_IS_NO_LOCK_STR ] ); @@ -671,7 +670,7 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p if ( AttemptToCrowbarLock( pSoldier, pDoor ) ) { //ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ DOOR_LOCK_DESTROYED_STR ] ); - //DoMercBattleSound( pSoldier, BATTLE_SOUND_COOL1 ); + //pSoldier->DoMercBattleSound( BATTLE_SOUND_COOL1 ); fHandleDoor = TRUE; } else @@ -699,7 +698,7 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p // Attempt to force door if ( AttemptToBlowUpLock( pSoldier, pDoor ) ) { - //DoMercBattleSound( pSoldier, BATTLE_SOUND_COOL1 ); + //pSoldier->DoMercBattleSound( BATTLE_SOUND_COOL1 ); //ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ DOOR_LOCK_DESTROYED_STR ] ); fHandleDoor = TRUE; } @@ -727,7 +726,7 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p { if ( AttemptToPickLock( pSoldier, pDoor ) ) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_COOL1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_COOL1 ); //ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ DOOR_LOCK_HAS_BEEN_PICKED_STR ] ); fHandleDoor = TRUE; } @@ -748,7 +747,7 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p // Attempt to examine door // Whatever the result, end the open animation - ChangeSoldierState( pSoldier, GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); + pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); if ( pDoor == NULL ) { @@ -794,7 +793,7 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p { // Open if it's not locked.... //ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ DOOR_THERE_IS_NO_LOCK_STR ] ); - ChangeSoldierState( pSoldier, GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); + pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); break; } else @@ -805,16 +804,16 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p if ( AttemptToUnlockDoor( pSoldier, pDoor ) ) { //ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ DOOR_LOCK_HAS_BEEN_UNLOCKED_STR ] ); - //DoMercBattleSound( pSoldier, BATTLE_SOUND_COOL1 ); + //pSoldier->DoMercBattleSound( BATTLE_SOUND_COOL1 ); - ChangeSoldierState( pSoldier, GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); + pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); UpdateDoorPerceivedValue( pDoor ); fHandleDoor = TRUE; } else { - ChangeSoldierState( pSoldier, GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_LOCKED_DOOR ), 0, FALSE ); + pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_LOCKED_DOOR ), 0, FALSE ); // Do we have a quote for locked stuff? // Now just show on message bar //ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ DOOR_NOT_PROPER_KEY_STR ], pSoldier->name ); @@ -822,7 +821,7 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p // OK PLay damn battle sound if ( Random( 2 ) ) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); } } } @@ -840,7 +839,7 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p { // Open if it's not locked.... ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ DOOR_THERE_IS_NO_LOCK_STR ] ); - ChangeSoldierState( pSoldier, GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); + pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); break; } else @@ -856,14 +855,14 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p if ( AttemptToUntrapDoor( pSoldier, pDoor ) ) { //ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ DOOR_LOCK_HAS_BEEN_UNTRAPPED_STR ] ); - DoMercBattleSound( pSoldier, BATTLE_SOUND_COOL1 ); - ChangeSoldierState( pSoldier, GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_COOL1 ); + pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); UpdateDoorPerceivedValue( pDoor ); //fHandleDoor = TRUE; } else - { - ChangeSoldierState( pSoldier, GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_LOCKED_DOOR ), 0, FALSE ); + { + pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_LOCKED_DOOR ), 0, FALSE ); // Now just show on message bar HandleDoorTrap( pSoldier, pDoor ); @@ -897,7 +896,7 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p { // Open if it's not locked.... ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ DOOR_THERE_IS_NO_LOCK_STR ] ); - ChangeSoldierState( pSoldier, GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); + pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); break; } else @@ -908,12 +907,12 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p if ( AttemptToLockDoor( pSoldier, pDoor ) ) { ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ DOOR_LOCK_HAS_BEEN_LOCKED_STR ] ); - ChangeSoldierState( pSoldier, GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); + pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); UpdateDoorPerceivedValue( pDoor ); } else { - ChangeSoldierState( pSoldier, GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_LOCKED_DOOR ), 0, FALSE ); + pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_LOCKED_DOOR ), 0, FALSE ); // Do we have a quote for locked stuff? // Now just show on message bar ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ DOOR_NOT_PROPER_KEY_STR ], pSoldier->name ); @@ -933,7 +932,7 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p sBPCost = BP_OPEN_DOOR; // Open if it's not locked.... - ChangeSoldierState( pSoldier, GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); + pSoldier->ChangeSoldierState( GetAnimStateForInteraction( pSoldier, fDoor, END_OPEN_DOOR ), 0, FALSE ); fHandleDoor = TRUE; } } @@ -960,7 +959,7 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p } -BOOLEAN HandleDoorsOpenClose( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE * pStructure, BOOLEAN fNoAnimations ) +BOOLEAN HandleDoorsOpenClose( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE * pStructure, BOOLEAN fNoAnimations ) { LEVELNODE * pShadowNode; LEVELNODE * pNode; @@ -1016,7 +1015,7 @@ BOOLEAN HandleDoorsOpenClose( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE * SetRenderFlags(RENDER_FLAG_FULL); } } - } + } } @@ -1083,7 +1082,7 @@ BOOLEAN HandleDoorsOpenClose( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE * fDoAnimation = FALSE; } - if ( fDoAnimation ) + if ( fDoAnimation ) { // Update perceived value ModifyDoorStatus( sGridNo, DONTSETDOORSTATUS, TRUE ); @@ -1093,13 +1092,13 @@ BOOLEAN HandleDoorsOpenClose( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE * memset( &AniParams, 0, sizeof( ANITILE_PARAMS ) ); AniParams.sGridNo = sGridNo; AniParams.ubLevelID = ANI_STRUCT_LEVEL; - AniParams.usTileType = (UINT16)gTileDatabase[ pNode->usIndex ].fType; + AniParams.usTileType = (UINT16)gTileDatabase[ pNode->usIndex ].fType; AniParams.usTileIndex = pNode->usIndex; AniParams.sDelay = INTTILE_DOOR_OPENSPEED; AniParams.sStartFrame = pNode->sCurrentFrame; AniParams.uiFlags = ANITILE_DOOR | ANITILE_FORWARD | ANITILE_EXISTINGTILE; AniParams.pGivenLevelNode = pNode; - + CreateAnimationTile( &AniParams ); } else @@ -1107,7 +1106,7 @@ BOOLEAN HandleDoorsOpenClose( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE * memset( &AniParams, 0, sizeof( ANITILE_PARAMS ) ); AniParams.sGridNo = sGridNo; AniParams.ubLevelID = ANI_STRUCT_LEVEL; - AniParams.usTileType = (UINT16)gTileDatabase[ pNode->usIndex ].fType; + AniParams.usTileType = (UINT16)gTileDatabase[ pNode->usIndex ].fType; AniParams.usTileIndex = pNode->usIndex; AniParams.sDelay = INTTILE_DOOR_OPENSPEED; AniParams.sStartFrame = pNode->sCurrentFrame; @@ -1143,22 +1142,22 @@ BOOLEAN HandleDoorsOpenClose( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE * // change sound ID uiSoundID = GARAGE_DOOR_OPEN; } - else if ( pStructure->pDBStructureRef->pDBStructure->ubArmour == MATERIAL_CLOTH ) - { - // change sound ID - uiSoundID = CURTAINS_OPEN; - } - } - else if ( pStructure->pDBStructureRef->pDBStructure->ubArmour == MATERIAL_LIGHT_METAL || - pStructure->pDBStructureRef->pDBStructure->ubArmour == MATERIAL_THICKER_METAL || - pStructure->pDBStructureRef->pDBStructure->ubArmour == MATERIAL_HEAVY_METAL ) + else if ( pStructure->pDBStructureRef->pDBStructure->ubArmour == MATERIAL_CLOTH ) + { + // change sound ID + uiSoundID = CURTAINS_OPEN; + } + } + else if ( pStructure->pDBStructureRef->pDBStructure->ubArmour == MATERIAL_LIGHT_METAL || + pStructure->pDBStructureRef->pDBStructure->ubArmour == MATERIAL_THICKER_METAL || + pStructure->pDBStructureRef->pDBStructure->ubArmour == MATERIAL_HEAVY_METAL ) { // change sound ID uiSoundID = METAL_DOOR_OPEN; } // OK, We must know what sound to play, for now use same sound for all doors... - PlayJA2Sample( uiSoundID, RATE_11025, SoundVolume( MIDVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); + PlayJA2Sample( uiSoundID, RATE_11025, SoundVolume( MIDVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); } } @@ -1209,7 +1208,7 @@ BOOLEAN HandleDoorsOpenClose( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE * ModifyDoorStatus( sGridNo, DONTSETDOORSTATUS, FALSE ); memset( &AniParams, 0, sizeof( ANITILE_PARAMS ) ); - + // ATE; Default to normal door... uiSoundID = ( DRCLOSE_1 + Random( 2 ) ); @@ -1222,53 +1221,53 @@ BOOLEAN HandleDoorsOpenClose( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE * // change sound ID uiSoundID = GARAGE_DOOR_CLOSE; } - else if ( pStructure->pDBStructureRef->pDBStructure->ubArmour == MATERIAL_CLOTH ) - { - // change sound ID - uiSoundID = CURTAINS_CLOSE; - } - } - else if ( pStructure->pDBStructureRef->pDBStructure->ubArmour == MATERIAL_LIGHT_METAL || - pStructure->pDBStructureRef->pDBStructure->ubArmour == MATERIAL_THICKER_METAL || - pStructure->pDBStructureRef->pDBStructure->ubArmour == MATERIAL_HEAVY_METAL ) + else if ( pStructure->pDBStructureRef->pDBStructure->ubArmour == MATERIAL_CLOTH ) + { + // change sound ID + uiSoundID = CURTAINS_CLOSE; + } + } + else if ( pStructure->pDBStructureRef->pDBStructure->ubArmour == MATERIAL_LIGHT_METAL || + pStructure->pDBStructureRef->pDBStructure->ubArmour == MATERIAL_THICKER_METAL || + pStructure->pDBStructureRef->pDBStructure->ubArmour == MATERIAL_HEAVY_METAL ) { // change sound ID uiSoundID = METAL_DOOR_CLOSE; } - AniParams.uiKeyFrame1Code = ANI_KEYFRAME_DO_SOUND; - AniParams.uiUserData = uiSoundID; - AniParams.uiUserData3 = sGridNo; + AniParams.uiKeyFrame1Code = ANI_KEYFRAME_DO_SOUND; + AniParams.uiUserData = uiSoundID; + AniParams.uiUserData3 = sGridNo; if ( fOpenedGraphic ) { AniParams.sGridNo = sGridNo; AniParams.ubLevelID = ANI_STRUCT_LEVEL; - AniParams.usTileType = (UINT16)gTileDatabase[ pNode->usIndex ].fType; + AniParams.usTileType = (UINT16)gTileDatabase[ pNode->usIndex ].fType; AniParams.usTileIndex = pNode->usIndex; AniParams.sDelay = INTTILE_DOOR_OPENSPEED; AniParams.sStartFrame = pNode->sCurrentFrame; AniParams.uiFlags = ANITILE_DOOR | ANITILE_BACKWARD | ANITILE_EXISTINGTILE; AniParams.pGivenLevelNode = pNode; - AniParams.ubKeyFrame1 = pNode->sCurrentFrame - 2; - + AniParams.ubKeyFrame1 = pNode->sCurrentFrame - 2; + CreateAnimationTile( &AniParams ); } else - { + { AniParams.sGridNo = sGridNo; AniParams.ubLevelID = ANI_STRUCT_LEVEL; - AniParams.usTileType = (UINT16)gTileDatabase[ pNode->usIndex ].fType; + AniParams.usTileType = (UINT16)gTileDatabase[ pNode->usIndex ].fType; AniParams.usTileIndex = pNode->usIndex; AniParams.sDelay = INTTILE_DOOR_OPENSPEED; AniParams.sStartFrame = pNode->sCurrentFrame; AniParams.uiFlags = ANITILE_DOOR | ANITILE_FORWARD | ANITILE_EXISTINGTILE; AniParams.pGivenLevelNode = pNode; - - AniParams.ubKeyFrame1 = pNode->sCurrentFrame + 2; - + + AniParams.ubKeyFrame1 = pNode->sCurrentFrame + 2; + CreateAnimationTile( &AniParams ); } } @@ -1327,7 +1326,7 @@ void SetDoorString( INT16 sGridNo ) switch( pDoor->bPerceivedTrapped ) { case DOOR_PERCEIVED_TRAPPED: - + wcscpy( gzIntTileLocation2, TacticalStr[ DOOR_TRAPPED_MOUSE_DESCRIPTION ] ); gfUIIntTileLocation2 = TRUE; fTrapped = TRUE; @@ -1340,23 +1339,23 @@ void SetDoorString( INT16 sGridNo ) switch( pDoor->bPerceivedLocked ) { case DOOR_PERCEIVED_UNKNOWN: - + break; case DOOR_PERCEIVED_LOCKED: - + wcscpy( gzIntTileLocation2, TacticalStr[ DOOR_LOCKED_MOUSE_DESCRIPTION ] ); gfUIIntTileLocation2 = TRUE; break; case DOOR_PERCEIVED_UNLOCKED: - + wcscpy( gzIntTileLocation2, TacticalStr[ DOOR_UNLOCKED_MOUSE_DESCRIPTION ] ); gfUIIntTileLocation2 = TRUE; break; case DOOR_PERCEIVED_BROKEN: - + wcscpy( gzIntTileLocation2, TacticalStr[ DOOR_BROKEN_MOUSE_DESCRIPTION ] ); gfUIIntTileLocation2 = TRUE; break; @@ -1364,7 +1363,7 @@ void SetDoorString( INT16 sGridNo ) } } - } + } } // ATE: If here, we try to say, opened or closed... @@ -1457,4 +1456,4 @@ void SetDoorString( INT16 sGridNo ) #endif } -} \ No newline at end of file +} diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index b457f5bd..5df3e33d 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -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 @@ -110,7 +110,7 @@ BOOLEAN ItemPoolOKForPickup( SOLDIERTYPE * pSoldier, ITEM_POOL *pItemPool, INT8 SOLDIERTYPE * gpBoobyTrapSoldier; ITEM_POOL * gpBoobyTrapItemPool; INT16 gsBoobyTrapGridNo; -INT8 gbBoobyTrapLevel; +INT8 gbBoobyTrapLevel; BOOLEAN gfDisarmingBuriedBomb; extern BOOLEAN gfDontChargeAPsToPickup; INT8 gbTrapDifficulty; @@ -118,7 +118,7 @@ BOOLEAN gfJustFoundBoobyTrap = FALSE; void StartBombMessageBox( SOLDIERTYPE * pSoldier, INT16 sGridNo ); -BOOLEAN HandleCheckForBadChangeToGetThrough( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pTargetSoldier, INT16 sTargetGridNo , INT8 bLevel ) +BOOLEAN HandleCheckForBadChangeToGetThrough( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pTargetSoldier, INT16 sTargetGridNo , INT8 bLevel ) { BOOLEAN fBadChangeToGetThrough = FALSE; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleCheckForBadChangeToGetThrough")); @@ -133,14 +133,14 @@ BOOLEAN HandleCheckForBadChangeToGetThrough( SOLDIERTYPE *pSoldier, SOLDIERTYPE else { if ( SoldierToLocationChanceToGetThrough( pSoldier, sTargetGridNo, (INT8) bLevel, 0, NOBODY ) < OK_CHANCE_TO_GET_THROUGH ) - { + { fBadChangeToGetThrough = TRUE; } } if ( fBadChangeToGetThrough ) { - if ( gTacticalStatus.sCantGetThroughSoldierGridNo != pSoldier->sGridNo || gTacticalStatus.sCantGetThroughGridNo != sTargetGridNo || gTacticalStatus.ubCantGetThroughID != pSoldier->ubID ) + if ( gTacticalStatus.sCantGetThroughSoldierGridNo != pSoldier->sGridNo || gTacticalStatus.sCantGetThroughGridNo != sTargetGridNo || gTacticalStatus.ubCantGetThroughID != pSoldier->ubID ) { gTacticalStatus.fCantGetThrough = FALSE; } @@ -189,8 +189,8 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa INT16 sTargetGridNo; INT16 sAPCost; INT16 sActionGridNo; - UINT8 ubDirection; - INT16 sAdjustedGridNo; + UINT8 ubDirection = 0; + INT16 sAdjustedGridNo = 0; BOOLEAN fDropBomb = FALSE; BOOLEAN fAddingTurningCost = FALSE; BOOLEAN fAddingRaiseGunCost = FALSE; @@ -199,9 +199,9 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa // Remove any previous actions - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; - // here is where we would set a different value if the weapon mode is on + // here is where we would set a different value if the weapon mode is on // "attached weapon" pSoldier->usAttackingWeapon = usHandItem; @@ -219,7 +219,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa pIntNode = GetCurInteractiveTileGridNoAndStructure( &sInteractiveGridNo, &pStructure ); if ( pIntNode != NULL && pTargetSoldier == pSoldier ) - { + { // Truncate target soldier and update grid pTargetSoldier = NULL; sGridNo = sInteractiveGridNo; @@ -234,14 +234,14 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa gTacticalStatus.ubAttackBusyCount = 0; } - // if ( pTargetSoldier ) - // { - // pTargetSoldier->bBeingAttackedCount = 0; - // } +// if ( pTargetSoldier ) +// { +// pTargetSoldier->bBeingAttackedCount = 0; +// } // Check our soldier's life for unconscious! - if ( pSoldier->bLife < OKLIFE ) + if ( pSoldier->stats.bLife < OKLIFE ) { return( ITEM_HANDLE_UNCONSCIOUS ); } @@ -251,15 +251,15 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa return( ITEM_HANDLE_BROKEN ); } - if ( fFromUI && pSoldier->bTeam == gbPlayerNum && pTargetSoldier && (pTargetSoldier->bTeam == gbPlayerNum || pTargetSoldier->bNeutral) && pTargetSoldier->ubBodyType != CROW && Item[ usHandItem ].usItemClass != IC_MEDKIT ) + if ( fFromUI && pSoldier->bTeam == gbPlayerNum && pTargetSoldier && (pTargetSoldier->bTeam == gbPlayerNum || pTargetSoldier->aiData.bNeutral) && pTargetSoldier->ubBodyType != CROW && Item[ usHandItem ].usItemClass != IC_MEDKIT ) { - if ( pSoldier->ubProfile != NO_PROFILE ) + if ( pSoldier->ubProfile != NO_PROFILE ) { // nice mercs won't shoot other nice guys or neutral civilians - if ( (gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags3 & PROFILE_MISC_FLAG3_GOODGUY) && ( (pTargetSoldier->ubProfile == NO_PROFILE && pTargetSoldier->bNeutral) || gMercProfiles[ pTargetSoldier->ubProfile ].ubMiscFlags3 & PROFILE_MISC_FLAG3_GOODGUY) ) + if ( (gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags3 & PROFILE_MISC_FLAG3_GOODGUY) && ( (pTargetSoldier->ubProfile == NO_PROFILE && pTargetSoldier->aiData.bNeutral) || gMercProfiles[ pTargetSoldier->ubProfile ].ubMiscFlags3 & PROFILE_MISC_FLAG3_GOODGUY) ) { TacticalCharacterDialogue( pSoldier, QUOTE_REFUSING_ORDER ); - return( ITEM_HANDLE_REFUSAL ); + return( ITEM_HANDLE_REFUSAL ); } if ( pTargetSoldier->ubProfile != NO_PROFILE ) { @@ -267,12 +267,12 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa if ( WhichBuddy( pSoldier->ubProfile, pTargetSoldier->ubProfile ) != -1 ) { TacticalCharacterDialogue( pSoldier, QUOTE_REFUSING_ORDER ); - return( ITEM_HANDLE_REFUSAL ); + return( ITEM_HANDLE_REFUSAL ); } } // any recruited rebel will refuse to fire on another rebel or neutral nameless civ - if ( pSoldier->ubCivilianGroup == REBEL_CIV_GROUP && (pTargetSoldier->ubCivilianGroup == REBEL_CIV_GROUP || ( pTargetSoldier->bNeutral && pTargetSoldier->ubProfile == NO_PROFILE && pTargetSoldier->ubCivilianGroup == NON_CIV_GROUP && pTargetSoldier->ubBodyType != CROW ) ) ) + if ( pSoldier->ubCivilianGroup == REBEL_CIV_GROUP && (pTargetSoldier->ubCivilianGroup == REBEL_CIV_GROUP || ( pTargetSoldier->aiData.bNeutral && pTargetSoldier->ubProfile == NO_PROFILE && pTargetSoldier->ubCivilianGroup == NON_CIV_GROUP && pTargetSoldier->ubBodyType != CROW ) ) ) { TacticalCharacterDialogue( pSoldier, QUOTE_REFUSING_ORDER ); return( ITEM_HANDLE_REFUSAL ); @@ -284,9 +284,8 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa // Check HAND ITEM if ( Item[ usHandItem ].usItemClass == IC_GUN || Item[ usHandItem ].usItemClass == IC_THROWING_KNIFE ) { - // WEAPONS - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleItem: checking for fingerprintID, item id = %d,id required = %d, imprint id = %d, soldier id = %d",usHandItem,Item[usHandItem].fingerprintid,pSoldier->inv[ pSoldier->ubAttackingHand ].ubImprintID,pSoldier->ubProfile)); + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleItem: checking for fingerprintID, item id = %d,id required = %d, imprint id = %d, soldier id = %d",usHandItem,Item[usHandItem].fingerprintid,pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.ubImprintID,pSoldier->ubProfile)); if ( Item[usHandItem].fingerprintid ) { // check imprint ID @@ -294,17 +293,17 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa // imprinted value is profile for mercs & NPCs and NO_PROFILE + 1 for generic dudes if (pSoldier->ubProfile != NO_PROFILE) { - if ( pSoldier->inv[ pSoldier->ubAttackingHand ].ubImprintID != pSoldier->ubProfile ) + if ( pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.ubImprintID != pSoldier->ubProfile ) { - if ( pSoldier->inv[ pSoldier->ubAttackingHand ].ubImprintID == NO_PROFILE ) + if ( pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.ubImprintID == NO_PROFILE ) { // first shot using "virgin" gun... set imprint ID - pSoldier->inv[ pSoldier->ubAttackingHand ].ubImprintID = pSoldier->ubProfile; + pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.ubImprintID = pSoldier->ubProfile; // this could be an NPC (Krott) if (pSoldier->bTeam == gbPlayerNum) { - PlayJA2Sample( RG_ID_IMPRINTED, RATE_11025, HIGHVOLUME, 1, MIDDLE ); + PlayJA2Sample( RG_ID_IMPRINTED, RATE_11025, HIGHVOLUME, 1, MIDDLE ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"\"%s\"", TacticalStr[ GUN_GOT_FINGERPRINT ] ); @@ -316,11 +315,11 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa // access denied! if (pSoldier->bTeam == gbPlayerNum) { - PlayJA2Sample( RG_ID_INVALID, RATE_11025, HIGHVOLUME, 1, MIDDLE ); + PlayJA2Sample( RG_ID_INVALID, RATE_11025, HIGHVOLUME, 1, MIDDLE ); - //if (Random( 100 ) < (UINT32) pSoldier->bWisdom) + //if (Random( 100 ) < (UINT32) pSoldier->stats.bWisdom) //{ - // DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 ); + // pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); //} //else //{ @@ -334,11 +333,11 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa else { // guaranteed not to be controlled by the player, so no feedback required - if ( pSoldier->inv[ pSoldier->ubAttackingHand ].ubImprintID != (NO_PROFILE + 1) ) + if ( pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.ubImprintID != (NO_PROFILE + 1) ) { - if ( pSoldier->inv[ pSoldier->ubAttackingHand ].ubImprintID == NO_PROFILE ) + if ( pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.ubImprintID == NO_PROFILE ) { - pSoldier->inv[ pSoldier->ubAttackingHand ].ubImprintID = (NO_PROFILE + 1); + pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.ubImprintID = (NO_PROFILE + 1); } else { @@ -355,14 +354,14 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa if ( !EnoughAmmo( pSoldier, fFromUI, HANDPOS ) ) { //ATE: Reflect that we need to reset for bursting - pSoldier->fDoSpread = FALSE; + pSoldier->flags.fDoSpread = FALSE; return( ITEM_HANDLE_NOAMMO ); } // Check if we are reloading if ( (gTacticalStatus.uiFlags & REALTIME) || !(gTacticalStatus.uiFlags & INCOMBAT) ) { - if ( pSoldier->fReloading ) + if ( pSoldier->flags.fReloading ) { return( ITEM_HANDLE_RELOADING ); } @@ -371,7 +370,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa // Get gridno - either soldier's position or the gridno // ??? Why isn't the target's gridno the same as the gridno of the soldier on that grid? - // Real example: Soldier fires at 16701. It finds a soldier there. That soldier's sGridNo is 16547. So why + // Real example: Soldier fires at 16701. It finds a soldier there. That soldier's sGridNo is 16547. So why // isn't this soldier at grid 16547? if ( pTargetSoldier != NULL ) { @@ -386,7 +385,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa if ( fFromUI && (gTacticalStatus.uiFlags & TURNBASED ) && (gTacticalStatus.uiFlags & INCOMBAT) ) { // Don't do if no spread! - if ( !pSoldier->fDoSpread ) + if ( !pSoldier->flags.fDoSpread ) { if ( !HandleCheckForBadChangeToGetThrough( pSoldier, pTargetSoldier, sTargetGridNo , bLevel ) ) { @@ -401,7 +400,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa // Our guys NEED TRUE. We shoulkd at some time make sure the AI and // our guys are deducting/checking in the same manner to avoid // these differences. - sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, TRUE, pSoldier->bAimTime ); + sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, TRUE, pSoldier->aiData.bAimTime ); GetAPChargeForShootOrStabWRTGunRaises( pSoldier, sTargetGridNo, TRUE, &fAddingTurningCost, &fAddingRaiseGunCost ); @@ -411,7 +410,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa { if ( fAddingRaiseGunCost ) { - pSoldier->fDontChargeTurningAPs = TRUE; + pSoldier->flags.fDontChargeTurningAPs = TRUE; } } /*else @@ -419,7 +418,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa // If raising gun, don't charge turning! if ( fAddingTurningCost ) { - pSoldier->fDontChargeReadyAPs = TRUE; + pSoldier->flags.fDontChargeReadyAPs = TRUE; } }*/ @@ -432,7 +431,9 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa if ( (pSoldier->ubProfile != NO_PROFILE) && (gMercProfiles[ pSoldier->ubProfile ].bPersonalityTrait == PSYCHO) ) { // psychos might possibly switch to burst if they can - if ( !pSoldier->bDoBurst && IsGunBurstCapable( pSoldier, HANDPOS, FALSE ) ) + // Changed by ADB, rev 1513 + //if ( !pSoldier->bDoBurst && IsGunBurstCapable( pSoldier, HANDPOS, FALSE ) ) + if ( !pSoldier->bDoBurst && IsGunBurstCapable( &pSoldier->inv[HANDPOS], FALSE, pSoldier ) ) { // chance of firing burst if we have points... chance decreasing when ordered to do aimed shot @@ -445,14 +446,14 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa if ( EnoughPoints( pSoldier, sAPCost, 0, FALSE ) ) { // we have enough points to do this burst, roll the dice and see if we want to change - if ( Random( 3 + pSoldier->bAimTime ) == 0 ) + if ( Random( 3 + pSoldier->aiData.bAimTime ) == 0 ) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_LAUGH1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_LAUGH1 ); pSoldier->bDoBurst = TRUE; pSoldier->bWeaponMode = WM_BURST; pSoldier->bDoAutofire = 0; - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 26 ], pSoldier->name ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 26 ], pSoldier->name ); } } @@ -461,30 +462,30 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa if(pSoldier->bDoAutofire && ((gTacticalStatus.uiFlags & INCOMBAT) && (gTacticalStatus.uiFlags & TURNBASED))) //this is the code that introduces uncertainty into full-auto bursts { - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleItem: auto fire - setting dice sides, marksmanship = %d",pSoldier->bMarksmanship)); + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleItem: auto fire - setting dice sides, marksmanship = %d",pSoldier->stats.bMarksmanship)); //UINT32 diceSides = RAND_MAX; //Madd: tried to make this more marksmanship dependent than agility, a level 10 auto-weapons specialist with 100 in all stats was wasting wayyy too many APs on this fucker - //UINT32 diceSides = RAND_MAX / ( max(1,pSoldier->bMarksmanship) / 10) ; + //UINT32 diceSides = RAND_MAX / ( max(1,pSoldier->stats.bMarksmanship) / 10) ; - //Kaiden: Had to change the minimum value to 10 instead of 1, + //Kaiden: Had to change the minimum value to 10 instead of 1, //Rounding down resulted in division by zero and caused a crash. - UINT32 diceSides = RAND_MAX / ( max(10,pSoldier->bMarksmanship) / 10) ; + UINT32 diceSides = RAND_MAX / ( max(10,pSoldier->stats.bMarksmanship) / 10) ; - DOUBLE avgAPadded = max(((400.0f-2.0f*pSoldier->bAgility))*(63.0f-5.0f*(pSoldier->bExpLevel+2.0f*NUM_SKILL_TRAITS( pSoldier, AUTO_WEAPS )))/2700.0f,1); //Important! don't make this zero, the formulae don't like it. + DOUBLE avgAPadded = max(((400.0f-2.0f*pSoldier->stats.bAgility))*(63.0f-5.0f*(pSoldier->stats.bExpLevel+2.0f*NUM_SKILL_TRAITS( pSoldier, AUTO_WEAPS )))/2700.0f,1); //Important! don't make this zero, the formulae don't like it. UINT32 chanceToMisfire = (UINT32)(((DOUBLE)diceSides*(2.0f*avgAPadded+1.0f-sqrt(4.0f*avgAPadded+1.0f)))/(2.0f*avgAPadded)); //derive the chace to misfire from the desired average AP overspent, derived suing - UINT32 chanceToMisfireDry = (UINT32)(((DOUBLE)diceSides*(avgAPadded+1.0f-sqrt(2.0f*avgAPadded+1.0f)))/(avgAPadded)); //chance to misfire if weapon is dry. Designed to waste avgAPadded/2 APs + UINT32 chanceToMisfireDry = (UINT32)(((DOUBLE)diceSides*(avgAPadded+1.0f-sqrt(2.0f*avgAPadded+1.0f)))/(avgAPadded)); //chance to misfire if weapon is dry. Designed to waste avgAPadded/2 APs //soldiers get better at controlling bursts with levels, and reflex time (agility) UINT32 misfirePenaltyConst = (GetAutofireShotsPerFiveAPs(&pSoldier->inv[HANDPOS]))/5; UINT32 misfirePenaltyRand = ((GetAutofireShotsPerFiveAPs(&pSoldier->inv[HANDPOS]))%5)*20; //this is the remainder translated to a probability UINT32 misfirePenalty; UINT32 startAuto = pSoldier->bDoAutofire; - UINT32 startAPcost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, TRUE, 0 ); + //UINT32 startAPcost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, TRUE, 0 ); UINT32 roll; if((pSoldier->ubProfile != NO_PROFILE) && (gMercProfiles[ pSoldier->ubProfile ].bPersonalityTrait == PSYCHO) && Random(100) < 20) { chanceToMisfire = diceSides; - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 26 ], pSoldier->name ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 26 ], pSoldier->name ); } chanceToMisfire = __min(diceSides-1, chanceToMisfire); //cap the misfire chance, no-one has reflexes this bad @@ -499,14 +500,14 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa DebugMsg(TOPIC_JA2,DBG_LEVEL_3,"HandleItem: auto fire - Rolling dice"); roll = Random(diceSides); //roll = rand();//Random(diceSides); - //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Rolled %d vs %d", roll, ((pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft >= pSoldier->bDoAutofire)?chanceToMisfire:chanceToMisfireDry)); + //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Rolled %d vs %d", roll, ((pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.gun.ubGunShotsLeft >= pSoldier->bDoAutofire)?chanceToMisfire:chanceToMisfireDry)); misfirePenalty = misfirePenaltyConst + (Chance(misfirePenaltyRand)?1:0); //apply the base integral cost and the fractional cost (in the form of probablilite) pSoldier->bDoAutofire += misfirePenalty; sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, TRUE, 0 ); } - while(EnoughPoints( pSoldier, sAPCost, 0, FALSE ) && roll < ((pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire)?chanceToMisfire:chanceToMisfireDry)); + while(EnoughPoints( pSoldier, sAPCost, 0, FALSE ) && roll < ((pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.gun.ubGunShotsLeft >= pSoldier->bDoAutofire)?chanceToMisfire:chanceToMisfireDry)); //note that we could misfire more bullets than we have rounds //this represents the soldier running out of ammo and not noticing //the max that can be lost this way is 1AP @@ -514,17 +515,17 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa pSoldier->bDoAutofire -= misfirePenalty; sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, TRUE, 0 ); - if((__min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft) - startAuto) > 0 && pSoldier->bTeam == OUR_TEAM) + if((__min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.gun.ubGunShotsLeft) - startAuto) > 0 && pSoldier->bTeam == OUR_TEAM) { // More than 1 round - if (__min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft) - startAuto > 1) + if (__min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.gun.ubGunShotsLeft) - startAuto > 1) { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 62 ], pSoldier->name, __min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft) - startAuto ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 62 ], pSoldier->name, __min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.gun.ubGunShotsLeft) - startAuto ); } // 1 round else { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 63 ], pSoldier->name, __min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft) - startAuto ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 63 ], pSoldier->name, __min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.gun.ubGunShotsLeft) - startAuto ); } } @@ -536,8 +537,8 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa // Deduct points if our target is different! // if attacking a new target (or if the specific target is uncertain) - // DEF: Made into an event - // EVENT_FireSoldierWeapon( pSoldier, sTargetGridNo ); + // DEF: Made into an event + // pSoldier->EVENT_FireSoldierWeapon( sTargetGridNo ); if (fFromUI) { // set the target level; if the AI calls this it will have set the level already... @@ -549,11 +550,11 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa pSoldier->ubAttackingHand = HANDPOS; pSoldier->usAttackingWeapon = usHandItem; // If doing spread, set down the first gridno..... - if ( pSoldier->fDoSpread ) + if ( pSoldier->flags.fDoSpread ) { if ( pSoldier->sSpreadLocations[ 0 ] != 0 ) { - SendBeginFireWeaponEvent( pSoldier, pSoldier->sSpreadLocations[ 0 ] ); + SendBeginFireWeaponEvent( pSoldier, pSoldier->sSpreadLocations[ 0 ] ); } else { @@ -580,7 +581,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa // Get direction ubDirection = (UINT8)GetDirectionFromGridNo( sTargetGridNo, pSoldier ); - EVENT_SoldierBeginKnifeThrowAttack( pSoldier, sTargetGridNo, ubDirection ); + pSoldier->EVENT_SoldierBeginKnifeThrowAttack( sTargetGridNo, ubDirection ); } @@ -589,21 +590,21 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa // Descrease aim by two if in real time if ( (gTacticalStatus.uiFlags & REALTIME ) || !(gTacticalStatus.uiFlags & INCOMBAT) ) { - //pSoldier->bShownAimTime -= 2; - //if ( pSoldier->bShownAimTime < REFINE_AIM_1 ) + //pSoldier->aiData.bShownAimTime -= 2; + //if ( pSoldier->aiData.bShownAimTime < REFINE_AIM_1 ) //{ - // pSoldier->bShownAimTime = REFINE_AIM_1; + // pSoldier->aiData.bShownAimTime = REFINE_AIM_1; //} - //pSoldier->fPauseAim = TRUE; + //pSoldier->flags.fPauseAim = TRUE; } // If in turn based - refresh aim to first level if ( gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT) ) { - pSoldier->bShownAimTime = REFINE_AIM_1; + pSoldier->aiData.bShownAimTime = REFINE_AIM_1; // Locate to soldier if he's about to shoot! - if ( pSoldier->bTeam != gbPlayerNum ) + if ( pSoldier->bTeam != gbPlayerNum ) { ShowRadioLocator( pSoldier->ubID, SHOW_LOCATOR_NORMAL ); } @@ -627,12 +628,10 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa if ( Item[ usHandItem ].usItemClass == IC_PUNCH ) { //INT16 sCnt; - INT16 sSpot; + INT16 sSpot; UINT8 ubGuyThere; INT16 sGotLocation = NOWHERE; BOOLEAN fGotAdjacent = FALSE; - sAdjustedGridNo = NOWHERE; - ubDirection = 0xff; for ( INT8 sCnt = 0; sCnt < NUM_WORLD_DIRECTIONS; sCnt++ ) { @@ -645,7 +644,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa } // Check for who is there... - ubGuyThere = WhoIsThere2( sSpot, pSoldier->bLevel ); + ubGuyThere = WhoIsThere2( sSpot, pSoldier->pathing.bLevel ); if ( pTargetSoldier != NULL && ubGuyThere == pTargetSoldier->ubID ) { @@ -660,8 +659,8 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa if ( sGotLocation == NOWHERE ) { - // See if we can get there to punch - sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); + // See if we can get there to punch + sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); if ( sActionGridNo != -1 ) { // OK, we've got somebody... @@ -676,23 +675,23 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa { pSoldier->sTargetGridNo = sGridNo; - pSoldier->usActionData = sGridNo; + pSoldier->aiData.usActionData = sGridNo; // CHECK IF WE ARE AT THIS GRIDNO NOW if ( pSoldier->sGridNo != sGotLocation && fGotAdjacent ) { // SEND PENDING ACTION - pSoldier->ubPendingAction = MERC_PUNCH; - pSoldier->sPendingActionData2 = sAdjustedGridNo; - pSoldier->bPendingActionData3 = ubDirection; - pSoldier->ubPendingActionAnimCount = 0; + pSoldier->aiData.ubPendingAction = MERC_PUNCH; + pSoldier->aiData.sPendingActionData2 = sAdjustedGridNo; + pSoldier->aiData.bPendingActionData3 = ubDirection; + pSoldier->aiData.ubPendingActionAnimCount = 0; // WALK UP TO DEST FIRST - EVENT_InternalGetNewSoldierPath( pSoldier, sGotLocation, pSoldier->usUIMovementMode, FALSE, TRUE ); + pSoldier->EVENT_InternalGetNewSoldierPath( sGotLocation, pSoldier->usUIMovementMode, FALSE, TRUE ); } else - { - pSoldier->bAction = AI_ACTION_KNIFE_STAB; - EVENT_SoldierBeginPunchAttack( pSoldier, sAdjustedGridNo, ubDirection ); + { + pSoldier->aiData.bAction = AI_ACTION_KNIFE_STAB; + pSoldier->EVENT_SoldierBeginPunchAttack( sAdjustedGridNo, ubDirection ); } // OK, set UI @@ -710,26 +709,26 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa //USING THE MEDKIT if ( Item[ usHandItem ].usItemClass == IC_MEDKIT ) - { + { // ATE: AI CANNOT GO THROUGH HERE! - UINT16 usMapPos; + INT16 sMapPos; BOOLEAN fHadToUseCursorPos = FALSE; if (gTacticalStatus.fAutoBandageMode) { - usMapPos = sGridNo; + sMapPos = sGridNo; } else { - GetMouseMapPos( &usMapPos ); + GetMouseMapPos( &sMapPos ); } - // See if we can get there to stab - sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); + // See if we can get there to stab + sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); if ( sActionGridNo == -1 ) { // Try another location... - sActionGridNo = FindAdjacentGridEx( pSoldier, usMapPos, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, sMapPos, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); if ( sActionGridNo == -1 ) { @@ -755,32 +754,32 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa if ( pSoldier->sGridNo != sActionGridNo ) { // SEND PENDING ACTION - pSoldier->ubPendingAction = MERC_GIVEAID; + pSoldier->aiData.ubPendingAction = MERC_GIVEAID; if ( fHadToUseCursorPos ) { - pSoldier->sPendingActionData2 = usMapPos; + pSoldier->aiData.sPendingActionData2 = sMapPos; } else { if ( pTargetSoldier != NULL ) { - pSoldier->sPendingActionData2 = pTargetSoldier->sGridNo; + pSoldier->aiData.sPendingActionData2 = pTargetSoldier->sGridNo; } else { - pSoldier->sPendingActionData2 = sGridNo; + pSoldier->aiData.sPendingActionData2 = sGridNo; } } - pSoldier->bPendingActionData3 = ubDirection; - pSoldier->ubPendingActionAnimCount = 0; + pSoldier->aiData.bPendingActionData3 = ubDirection; + pSoldier->aiData.ubPendingActionAnimCount = 0; // WALK UP TO DEST FIRST - EVENT_InternalGetNewSoldierPath( pSoldier, sActionGridNo, pSoldier->usUIMovementMode, FALSE, TRUE ); + pSoldier->EVENT_InternalGetNewSoldierPath( sActionGridNo, pSoldier->usUIMovementMode, FALSE, TRUE ); } else { - EVENT_SoldierBeginFirstAid( pSoldier, sAdjustedGridNo, ubDirection ); + pSoldier->EVENT_SoldierBeginFirstAid( sAdjustedGridNo, ubDirection ); } if ( fFromUI ) @@ -798,8 +797,8 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa if ( Item[usHandItem].wirecutters && pTargetSoldier == NULL ) // Madd: quick fix to allow wirecutter/knives { - // See if we can get there to stab - sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); + // See if we can get there to stab + sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); if ( sActionGridNo != -1 ) { // Calculate AP costs... @@ -815,17 +814,17 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa if ( pSoldier->sGridNo != sActionGridNo ) { // SEND PENDING ACTION - pSoldier->ubPendingAction = MERC_CUTFFENCE; - pSoldier->sPendingActionData2 = sAdjustedGridNo; - pSoldier->bPendingActionData3 = ubDirection; - pSoldier->ubPendingActionAnimCount = 0; + pSoldier->aiData.ubPendingAction = MERC_CUTFFENCE; + pSoldier->aiData.sPendingActionData2 = sAdjustedGridNo; + pSoldier->aiData.bPendingActionData3 = ubDirection; + pSoldier->aiData.ubPendingActionAnimCount = 0; // WALK UP TO DEST FIRST - EVENT_InternalGetNewSoldierPath( pSoldier, sActionGridNo, pSoldier->usUIMovementMode , FALSE, TRUE ); + pSoldier->EVENT_InternalGetNewSoldierPath( sActionGridNo, pSoldier->usUIMovementMode , FALSE, TRUE ); } else { - EVENT_SoldierBeginCutFence( pSoldier, sAdjustedGridNo, ubDirection ); + pSoldier->EVENT_SoldierBeginCutFence( sAdjustedGridNo, ubDirection ); } @@ -871,8 +870,8 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa } } - // See if we can get there to stab - sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); + // See if we can get there to stab + sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); if ( sActionGridNo != -1 ) { @@ -886,23 +885,23 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa if ( pSoldier->sGridNo != sActionGridNo ) { // SEND PENDING ACTION - pSoldier->ubPendingAction = MERC_REPAIR; - pSoldier->sPendingActionData2 = sAdjustedGridNo; + pSoldier->aiData.ubPendingAction = MERC_REPAIR; + pSoldier->aiData.sPendingActionData2 = sAdjustedGridNo; if ( fVehicle ) { - pSoldier->sPendingActionData2 = sVehicleGridNo; + pSoldier->aiData.sPendingActionData2 = sVehicleGridNo; } - pSoldier->bPendingActionData3 = ubDirection; - pSoldier->ubPendingActionAnimCount = 0; + pSoldier->aiData.bPendingActionData3 = ubDirection; + pSoldier->aiData.ubPendingActionAnimCount = 0; // WALK UP TO DEST FIRST - EVENT_InternalGetNewSoldierPath( pSoldier, sActionGridNo, pSoldier->usUIMovementMode, FALSE, TRUE ); + pSoldier->EVENT_InternalGetNewSoldierPath( sActionGridNo, pSoldier->usUIMovementMode, FALSE, TRUE ); } else { - EVENT_SoldierBeginRepair( pSoldier, sAdjustedGridNo, ubDirection ); + pSoldier->EVENT_SoldierBeginRepair( sAdjustedGridNo, ubDirection ); } // OK, set UI @@ -948,8 +947,8 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa } } - // See if we can get there to stab - sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); + // See if we can get there to stab + sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); if ( sActionGridNo != -1 ) { @@ -963,19 +962,19 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa if ( pSoldier->sGridNo != sActionGridNo ) { // SEND PENDING ACTION - pSoldier->ubPendingAction = MERC_FUEL_VEHICLE; - pSoldier->sPendingActionData2 = sAdjustedGridNo; + pSoldier->aiData.ubPendingAction = MERC_FUEL_VEHICLE; + pSoldier->aiData.sPendingActionData2 = sAdjustedGridNo; - pSoldier->sPendingActionData2 = sVehicleGridNo; - pSoldier->bPendingActionData3 = ubDirection; - pSoldier->ubPendingActionAnimCount = 0; + pSoldier->aiData.sPendingActionData2 = sVehicleGridNo; + pSoldier->aiData.bPendingActionData3 = ubDirection; + pSoldier->aiData.ubPendingActionAnimCount = 0; // WALK UP TO DEST FIRST - EVENT_InternalGetNewSoldierPath( pSoldier, sActionGridNo, pSoldier->usUIMovementMode, FALSE, TRUE ); + pSoldier->EVENT_InternalGetNewSoldierPath( sActionGridNo, pSoldier->usUIMovementMode, FALSE, TRUE ); } else { - EVENT_SoldierBeginRefuel( pSoldier, sAdjustedGridNo, ubDirection ); + pSoldier->EVENT_SoldierBeginRefuel( sAdjustedGridNo, ubDirection ); } // OK, set UI @@ -1002,7 +1001,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa if ( Item[usHandItem].jar ) { - sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); if ( sActionGridNo != -1 ) { @@ -1016,17 +1015,17 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa if ( pSoldier->sGridNo != sActionGridNo ) { // SEND PENDING ACTION - pSoldier->ubPendingAction = MERC_TAKEBLOOD; - pSoldier->sPendingActionData2 = sAdjustedGridNo; - pSoldier->bPendingActionData3 = ubDirection; - pSoldier->ubPendingActionAnimCount = 0; + pSoldier->aiData.ubPendingAction = MERC_TAKEBLOOD; + pSoldier->aiData.sPendingActionData2 = sAdjustedGridNo; + pSoldier->aiData.bPendingActionData3 = ubDirection; + pSoldier->aiData.ubPendingActionAnimCount = 0; // WALK UP TO DEST FIRST - EVENT_InternalGetNewSoldierPath( pSoldier, sActionGridNo, pSoldier->usUIMovementMode, FALSE, TRUE ); + pSoldier->EVENT_InternalGetNewSoldierPath( sActionGridNo, pSoldier->usUIMovementMode, FALSE, TRUE ); } else { - EVENT_SoldierBeginTakeBlood( pSoldier, sAdjustedGridNo, ubDirection ); + pSoldier->EVENT_SoldierBeginTakeBlood( sAdjustedGridNo, ubDirection ); } // OK, set UI @@ -1061,7 +1060,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa // We should not have null here if we are given this flag... if ( pIntTile != NULL ) { - sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, FALSE, TRUE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, FALSE, TRUE ); if ( sActionGridNo != -1 ) { @@ -1075,17 +1074,17 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa if ( pSoldier->sGridNo != sActionGridNo ) { // SEND PENDING ACTION - pSoldier->ubPendingAction = MERC_ATTACH_CAN; - pSoldier->sPendingActionData2 = sGridNo; - pSoldier->bPendingActionData3 = ubDirection; - pSoldier->ubPendingActionAnimCount = 0; + pSoldier->aiData.ubPendingAction = MERC_ATTACH_CAN; + pSoldier->aiData.sPendingActionData2 = sGridNo; + pSoldier->aiData.bPendingActionData3 = ubDirection; + pSoldier->aiData.ubPendingActionAnimCount = 0; // WALK UP TO DEST FIRST - EVENT_InternalGetNewSoldierPath( pSoldier, sActionGridNo, pSoldier->usUIMovementMode, FALSE, TRUE ); + pSoldier->EVENT_InternalGetNewSoldierPath( sActionGridNo, pSoldier->usUIMovementMode, FALSE, TRUE ); } else { - EVENT_SoldierBeginTakeBlood( pSoldier, sGridNo, ubDirection ); + pSoldier->EVENT_SoldierBeginTakeBlood( sGridNo, ubDirection ); } // OK, set UI @@ -1120,11 +1119,11 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa sAPCost = AP_USE_REMOTE; if ( EnoughPoints( pSoldier, sAPCost, 0, fFromUI ) ) - { + { DeductPoints( pSoldier, sAPCost, 0 ); if ( Item[usHandItem].xray ) { - PlayJA2Sample( USE_X_RAY_MACHINE, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( USE_X_RAY_MACHINE, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); ActivateXRayDevice( pSoldier ); return( ITEM_HANDLE_OK ); @@ -1132,9 +1131,9 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa else // detonator { // Save gridno.... - pSoldier->sPendingActionData2 = sGridNo; + pSoldier->aiData.sPendingActionData2 = sGridNo; - EVENT_SoldierBeginUseDetonator( pSoldier ); + pSoldier->EVENT_SoldierBeginUseDetonator( ); if ( fFromUI ) { @@ -1162,7 +1161,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa if ( Item[ usHandItem ].ubCursor == INVALIDCURS ) { // Found detonator... - if ( IsDetonatorAttached( &(pSoldier->inv[ pSoldier->ubAttackingHand ] ) ) || IsRemoteDetonatorAttached( &(pSoldier->inv[ pSoldier->ubAttackingHand ] ) ) ) + if ( IsDetonatorAttached( &(pSoldier->inv[ pSoldier->ubAttackingHand ] ) ) || IsRemoteDetonatorAttached( &(pSoldier->inv[ pSoldier->ubAttackingHand ] ) ) ) { fDropBomb = TRUE; } @@ -1171,20 +1170,20 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa if ( fDropBomb ) { // Save gridno.... - pSoldier->sPendingActionData2 = sGridNo; + pSoldier->aiData.sPendingActionData2 = sGridNo; if ( pSoldier->sGridNo != sGridNo ) { // SEND PENDING ACTION - pSoldier->ubPendingAction = MERC_DROPBOMB; - pSoldier->ubPendingActionAnimCount = 0; + pSoldier->aiData.ubPendingAction = MERC_DROPBOMB; + pSoldier->aiData.ubPendingActionAnimCount = 0; // WALK UP TO DEST FIRST - EVENT_InternalGetNewSoldierPath( pSoldier, sGridNo, pSoldier->usUIMovementMode, FALSE, TRUE ); + pSoldier->EVENT_InternalGetNewSoldierPath( sGridNo, pSoldier->usUIMovementMode, FALSE, TRUE ); } else { - EVENT_SoldierBeginDropBomb( pSoldier ); + pSoldier->EVENT_SoldierBeginDropBomb( ); } // OK, set UI @@ -1201,45 +1200,45 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa //USING THE BLADE if ( Item[ usHandItem ].usItemClass == IC_BLADE ) { - // See if we can get there to stab + // See if we can get there to stab if ( pSoldier->ubBodyType == BLOODCAT ) { - sActionGridNo = FindNextToAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); + sActionGridNo = FindNextToAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); } else if ( CREATURE_OR_BLOODCAT( pSoldier ) && PythSpacesAway( pSoldier->sGridNo, sGridNo ) > 1 ) { - sActionGridNo = FindNextToAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); + sActionGridNo = FindNextToAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); if (sActionGridNo == -1) { - sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); } } else { - sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); } if ( sActionGridNo != -1 ) { - pSoldier->usActionData = sActionGridNo; + pSoldier->aiData.usActionData = sActionGridNo; // CHECK IF WE ARE AT THIS GRIDNO NOW if ( pSoldier->sGridNo != sActionGridNo ) { // SEND PENDING ACTION - pSoldier->ubPendingAction = MERC_KNIFEATTACK; - pSoldier->sPendingActionData2 = sAdjustedGridNo; - pSoldier->bPendingActionData3 = ubDirection; - pSoldier->ubPendingActionAnimCount = 0; + pSoldier->aiData.ubPendingAction = MERC_KNIFEATTACK; + pSoldier->aiData.sPendingActionData2 = sAdjustedGridNo; + pSoldier->aiData.bPendingActionData3 = ubDirection; + pSoldier->aiData.ubPendingActionAnimCount = 0; // WALK UP TO DEST FIRST - EVENT_InternalGetNewSoldierPath( pSoldier, sActionGridNo, pSoldier->usUIMovementMode, FALSE, TRUE ); + pSoldier->EVENT_InternalGetNewSoldierPath( sActionGridNo, pSoldier->usUIMovementMode, FALSE, TRUE ); } else { // for the benefit of the AI - pSoldier->bAction = AI_ACTION_KNIFE_STAB; - EVENT_SoldierBeginBladeAttack( pSoldier, sAdjustedGridNo, ubDirection ); + pSoldier->aiData.bAction = AI_ACTION_KNIFE_STAB; + pSoldier->EVENT_SoldierBeginBladeAttack( sAdjustedGridNo, ubDirection ); } // OK, set UI @@ -1262,24 +1261,24 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa if ( Item[ usHandItem ].usItemClass == IC_TENTACLES ) { - // See if we can get there to stab + // See if we can get there to stab //pSoldier->sTargetGridNo = sTargetGridNo; //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"); - sAPCost = CalcTotalAPsToAttack( pSoldier, sGridNo, FALSE, pSoldier->bAimTime ); + sAPCost = CalcTotalAPsToAttack( pSoldier, sGridNo, FALSE, pSoldier->aiData.bAimTime ); DeductPoints( pSoldier, sAPCost, 0 ); - EVENT_InitNewSoldierAnim( pSoldier, QUEEN_SWIPE, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( QUEEN_SWIPE, 0 , FALSE ); //FireWeapon( pSoldier, sTargetGridNo ); - pSoldier->bAction = AI_ACTION_KNIFE_STAB; + pSoldier->aiData.bAction = AI_ACTION_KNIFE_STAB; return( ITEM_HANDLE_OK ); } @@ -1308,14 +1307,14 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa ubDirection = (UINT8)GetDirectionFromGridNo( sTargetGridNo, pSoldier ); // Get new gridno! - sCheckGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc( ubDirection ) ); + sCheckGridNo = NewGridNo( (INT16)pSoldier->sGridNo, (UINT16)DirectionInc( ubDirection ) ); - if ( !OKFallDirection( pSoldier, sCheckGridNo, pSoldier->bLevel, ubDirection , pSoldier->usAnimState ) ) + if ( !OKFallDirection( pSoldier, sCheckGridNo, pSoldier->pathing.bLevel, ubDirection , pSoldier->usAnimState ) ) { return( ITEM_HANDLE_NOROOM ); } - pSoldier->fDontChargeAPsForStanceChange = TRUE; + pSoldier->flags.fDontChargeAPsForStanceChange = TRUE; } else if ( Item[usHandItem].grenadelauncher )//usHandItem == GLAUNCHER || usHandItem == UNDER_GLAUNCHER ) { @@ -1326,7 +1325,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa { if ( fAddingRaiseGunCost ) { - pSoldier->fDontChargeTurningAPs = TRUE; + pSoldier->flags.fDontChargeTurningAPs = TRUE; } } /*else @@ -1334,7 +1333,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa // If raising gun, don't charge turning! if ( fAddingTurningCost ) { - pSoldier->fDontChargeReadyAPs = TRUE; + pSoldier->flags.fDontChargeReadyAPs = TRUE; } }*/ } @@ -1344,7 +1343,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa { pSoldier->ubAttackingHand = HANDPOS; pSoldier->usAttackingWeapon = usHandItem; - pSoldier->bTargetLevel = bLevel; + pSoldier->bTargetLevel = bLevel; // Look at the cursor, if toss cursor... if ( Item[ usHandItem ].ubCursor == TOSSCURS ) @@ -1354,13 +1353,13 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa pSoldier->ubTargetID = WhoIsThere2( sTargetGridNo, pSoldier->bTargetLevel ); // Increment attack counter... - // gTacticalStatus.ubAttackBusyCount++; +// gTacticalStatus.ubAttackBusyCount++; DebugAttackBusy( "Weapon fire\n"); // ATE: Don't charge turning... - pSoldier->fDontChargeTurningAPs = TRUE; - pSoldier->fDontChargeAPsForStanceChange = TRUE; + pSoldier->flags.fDontChargeTurningAPs = TRUE; + pSoldier->flags.fDontChargeAPsForStanceChange = TRUE; FireWeapon( pSoldier, sTargetGridNo ); } @@ -1389,7 +1388,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa if ( Item[ usHandItem ].ubCursor == INVALIDCURS ) { // Found detonator... - if ( IsDetonatorAttached ( &(pSoldier->inv[ usHandItem ] ) ) || IsRemoteDetonatorAttached( &(pSoldier->inv[ usHandItem ] ) ) ) + if ( IsDetonatorAttached ( &(pSoldier->inv[ usHandItem ] ) ) || IsRemoteDetonatorAttached( &(pSoldier->inv[ usHandItem ] ) ) ) { StartBombMessageBox( pSoldier, sGridNo ); @@ -1423,32 +1422,32 @@ void HandleSoldierDropBomb( SOLDIERTYPE *pSoldier, INT16 sGridNo ) if ( iResult >= 0 ) { - // EXPLOSIVES GAIN (25): Place a bomb, or buried and armed a mine + // EXPLOSIVES GAIN (25): Place a bomb, or buried and armed a mine StatChange( pSoldier, EXPLODEAMT, 25, FALSE ); - pSoldier->inv[ HANDPOS ].bTrap = __min( 10, ( EffectiveExplosive( pSoldier ) / 20) + (EffectiveExpLevel( pSoldier ) / 3) ); - pSoldier->inv[ HANDPOS ].ItemData.Trigger.ubBombOwner = pSoldier->ubID + 2; + pSoldier->inv[ HANDPOS ][0]->data.bTrap = __min( 10, ( EffectiveExplosive( pSoldier ) / 20) + (EffectiveExpLevel( pSoldier ) / 3) ); + pSoldier->inv[ HANDPOS ][0]->data.misc.ubBombOwner = pSoldier->ubID + 2; - // we now know there is something nasty here + // we now know there is something nasty here gpWorldLevelData[ sGridNo ].uiFlags |= MAPELEMENT_PLAYER_MINE_PRESENT; - AddItemToPool( sGridNo, &(pSoldier->inv[ HANDPOS ] ), BURIED, pSoldier->bLevel, WORLD_ITEM_ARMED_BOMB, 0 ); - DeleteObj( &(pSoldier->inv[ HANDPOS ]) ); + if (pSoldier->inv[ HANDPOS ].MoveThisObjectTo(gTempObject, 1) == 0) { + AddItemToPool( sGridNo, &gTempObject, BURIED, pSoldier->pathing.bLevel, WORLD_ITEM_ARMED_BOMB, 0 ); + } } else { - // EXPLOSIVES GAIN (10): Failed to place a bomb, or bury and arm a mine + // EXPLOSIVES GAIN (10): Failed to place a bomb, or bury and arm a mine StatChange( pSoldier, EXPLODEAMT, 10, FROM_FAILURE ); - // oops! How badly did we screw up? + // oops! How badly did we screw up? if ( iResult < -20 ) { // OOPS! ... BOOM! - IgniteExplosion( NOBODY, pSoldier->sX, pSoldier->sY, (INT16) (gpWorldLevelData[pSoldier->sGridNo].sHeight), pSoldier->sGridNo, pSoldier->inv[ HANDPOS ].usItem, pSoldier->bLevel ); - DeleteObj( &(pSoldier->inv[ HANDPOS ]) ); + IgniteExplosion( NOBODY, pSoldier->sX, pSoldier->sY, (INT16) (gpWorldLevelData[pSoldier->sGridNo].sHeight), pSoldier->sGridNo, pSoldier->inv[ HANDPOS ].usItem, pSoldier->pathing.bLevel ); + pSoldier->inv[ HANDPOS ].MoveThisObjectTo(gTempObject, 1); } } - } } } @@ -1462,17 +1461,16 @@ void SoldierHandleDropItem( SOLDIERTYPE *pSoldier ) { // LOOK IN PANDING DATA FOR ITEM TO DROP, AND LOCATION if ( pSoldier->pTempObject != NULL ) - { + { if ( pSoldier->bVisible != -1 ) { - PlayJA2Sample( THROW_IMPACT_2, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( THROW_IMPACT_2, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } - AddItemToPool( pSoldier->sGridNo, pSoldier->pTempObject, 1, pSoldier->bLevel, 0 , -1 ); + AddItemToPool( pSoldier->sGridNo, pSoldier->pTempObject, 1, pSoldier->pathing.bLevel, 0 , -1 ); NotifySoldiersToLookforItems( ); - MemFree( pSoldier->pTempObject ); - pSoldier->pTempObject = NULL; + OBJECTTYPE::DeleteMe( &pSoldier->pTempObject ); } } @@ -1493,17 +1491,17 @@ void HandleSoldierThrowItem( SOLDIERTYPE *pSoldier, INT16 sGridNo ) // CHECK IF WE ARE NOT ON THE SAME GRIDNO if ( sGridNo == pSoldier->sGridNo ) { - PickDropItemAnimation( pSoldier ); + pSoldier->PickDropItemAnimation( ); } else { // CHANGE DIRECTION AT LEAST ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier ); - SoldierGotoStationaryStance( pSoldier ); + pSoldier->SoldierGotoStationaryStance( ); - EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection ); - pSoldier->fTurningUntilDone = TRUE; + pSoldier->EVENT_SetSoldierDesiredDirection( ubDirection ); + pSoldier->flags.fTurningUntilDone = TRUE; // Draw item depending on distance from buddy if ( GetRangeFromGridNoDiff( sGridNo, pSoldier->sGridNo ) < MIN_LOB_RANGE ) @@ -1513,56 +1511,54 @@ void HandleSoldierThrowItem( SOLDIERTYPE *pSoldier, INT16 sGridNo ) else { pSoldier->usPendingAnimation = THROW_ITEM; - } + } } break; // crouch throwing case ANIM_PRONE: - if ( sGridNo == pSoldier->sGridNo ) - { - // OK, JUST DROP ITEM! - if ( pSoldier->pTempObject != NULL ) + if ( sGridNo == pSoldier->sGridNo ) { - AddItemToPool( sGridNo, pSoldier->pTempObject, 1, pSoldier->bLevel, 0, -1 ); - NotifySoldiersToLookforItems( ); + // OK, JUST DROP ITEM! + if ( pSoldier->pTempObject != NULL ) + { + AddItemToPool( sGridNo, pSoldier->pTempObject, 1, pSoldier->pathing.bLevel, 0, -1 ); + NotifySoldiersToLookforItems( ); - MemFree( pSoldier->pTempObject ); - pSoldier->pTempObject = NULL; + OBJECTTYPE::DeleteMe( &pSoldier->pTempObject ); + } + break; } - break; - } - ChangeSoldierStance( pSoldier, ANIM_CROUCH ); + pSoldier->ChangeSoldierStance( ANIM_CROUCH ); - case ANIM_CROUCH: + case ANIM_CROUCH: // CHECK IF WE ARE NOT ON THE SAME GRIDNO if ( sGridNo == pSoldier->sGridNo ) { // OK, JUST DROP ITEM! if ( pSoldier->pTempObject != NULL ) { - AddItemToPool( sGridNo, pSoldier->pTempObject, 1, pSoldier->bLevel, 0, -1 ); + AddItemToPool( sGridNo, pSoldier->pTempObject, 1, pSoldier->pathing.bLevel, 0, -1 ); NotifySoldiersToLookforItems( ); - MemFree( pSoldier->pTempObject ); - pSoldier->pTempObject = NULL; + OBJECTTYPE::DeleteMe( &pSoldier->pTempObject ); } } else { - // CHANGE DIRECTION AT LEAST + // CHANGE DIRECTION AT LEAST ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier ); - SoldierGotoStationaryStance( pSoldier ); + pSoldier->SoldierGotoStationaryStance( ); - EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection ); - pSoldier->fTurningUntilDone = TRUE; + pSoldier->EVENT_SetSoldierDesiredDirection( ubDirection ); + pSoldier->flags.fTurningUntilDone = TRUE; - pSoldier->usPendingAnimation = THROW_ITEM_CROUCHED; + pSoldier->usPendingAnimation = THROW_ITEM_CROUCHED; } - break; - // + break; +// } } @@ -1574,44 +1570,42 @@ void SoldierGiveItem( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pTargetSoldier, OBJECT UINT8 ubDirection; // Remove any previous actions - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; - // See if we can get there to stab - sActionGridNo = FindAdjacentGridEx( pSoldier, pTargetSoldier->sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); + // See if we can get there to stab + sActionGridNo = FindAdjacentGridEx( pSoldier, pTargetSoldier->sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); if ( sActionGridNo != -1 ) { // SEND PENDING ACTION - pSoldier->ubPendingAction = MERC_GIVEITEM; + pSoldier->aiData.ubPendingAction = MERC_GIVEITEM; - pSoldier->bPendingActionData5 = bInvPos; + pSoldier->bPendingActionData5 = bInvPos; // Copy temp object - pSoldier->pTempObject = (OBJECTTYPE *)MemAlloc( sizeof( OBJECTTYPE ) ); - memcpy( pSoldier->pTempObject, pObject, sizeof( OBJECTTYPE ) ); + OBJECTTYPE::CopyToOrCreateAt(&pSoldier->pTempObject, pObject); - - pSoldier->sPendingActionData2 = pTargetSoldier->sGridNo; - pSoldier->bPendingActionData3 = ubDirection; - pSoldier->uiPendingActionData4 = pTargetSoldier->ubID; - pSoldier->ubPendingActionAnimCount = 0; + pSoldier->aiData.sPendingActionData2 = pTargetSoldier->sGridNo; + pSoldier->aiData.bPendingActionData3 = ubDirection; + pSoldier->aiData.uiPendingActionData4 = pTargetSoldier->ubID; + pSoldier->aiData.ubPendingActionAnimCount = 0; // Set soldier as engaged! - pSoldier->uiStatusFlags |= SOLDIER_ENGAGEDINACTION; + pSoldier->flags.uiStatusFlags |= SOLDIER_ENGAGEDINACTION; // CHECK IF WE ARE AT THIS GRIDNO NOW if ( pSoldier->sGridNo != sActionGridNo ) { // WALK UP TO DEST FIRST - EVENT_InternalGetNewSoldierPath( pSoldier, sActionGridNo, pSoldier->usUIMovementMode, FALSE, TRUE ); + pSoldier->EVENT_InternalGetNewSoldierPath( sActionGridNo, pSoldier->usUIMovementMode, FALSE, TRUE ); } else { - EVENT_SoldierBeginGiveItem( pSoldier ); + pSoldier->EVENT_SoldierBeginGiveItem( ); // CHANGE DIRECTION OF TARGET TO OPPOSIDE DIRECTION! - EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection ); + pSoldier->EVENT_SetSoldierDesiredDirection( ubDirection ); } // Set target as engaged! - pTargetSoldier->uiStatusFlags |= SOLDIER_ENGAGEDINACTION; + pTargetSoldier->flags.uiStatusFlags |= SOLDIER_ENGAGEDINACTION; return; } @@ -1623,14 +1617,8 @@ void SoldierGiveItem( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pTargetSoldier, OBJECT BOOLEAN SoldierDropItem( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj ) { - pSoldier->pTempObject = (OBJECTTYPE *)MemAlloc( sizeof( OBJECTTYPE ) ); - if (pSoldier->pTempObject == NULL) - { - // OUT OF MEMORY! YIKES! - return( FALSE ); - } - memcpy( pSoldier->pTempObject, pObj, sizeof( OBJECTTYPE ) ); - PickDropItemAnimation( pSoldier ); + OBJECTTYPE::CopyToOrCreateAt(&pSoldier->pTempObject, pObj); + pSoldier->PickDropItemAnimation( ); return( TRUE ); } @@ -1639,17 +1627,17 @@ void SoldierPickupItem( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGridNo, INT16 sActionGridNo; // Remove any previous actions - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; sActionGridNo = AdjustGridNoForItemPlacement( pSoldier, sGridNo ); // SET PENDING ACTIONS! - pSoldier->ubPendingAction = MERC_PICKUPITEM; - pSoldier->uiPendingActionData1 = iItemIndex; - pSoldier->sPendingActionData2 = sActionGridNo; - pSoldier->uiPendingActionData4 = sGridNo; - pSoldier->bPendingActionData3 = bZLevel; - pSoldier->ubPendingActionAnimCount = 0; + pSoldier->aiData.ubPendingAction = MERC_PICKUPITEM; + pSoldier->aiData.uiPendingActionData1 = iItemIndex; + pSoldier->aiData.sPendingActionData2 = sActionGridNo; + pSoldier->aiData.uiPendingActionData4 = sGridNo; + pSoldier->aiData.bPendingActionData3 = bZLevel; + pSoldier->aiData.ubPendingActionAnimCount = 0; // Deduct points! //sAPCost = GetAPsToPickupItem( pSoldier, sGridNo ); @@ -1661,23 +1649,23 @@ void SoldierPickupItem( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGridNo, { if ( pSoldier->bTeam == gbPlayerNum ) { - EVENT_InternalGetNewSoldierPath( pSoldier, sActionGridNo, pSoldier->usUIMovementMode, TRUE, TRUE ); + pSoldier->EVENT_InternalGetNewSoldierPath( sActionGridNo, pSoldier->usUIMovementMode, TRUE, TRUE ); // Say it only if we don;t have to go too far! - if ( pSoldier->usPathDataSize > 5 ) + if ( pSoldier->pathing.usPathDataSize > 5 ) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_OK1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_OK1 ); } } else { - EVENT_InternalGetNewSoldierPath( pSoldier, sActionGridNo, pSoldier->usUIMovementMode, FALSE, TRUE ); + pSoldier->EVENT_InternalGetNewSoldierPath( sActionGridNo, pSoldier->usUIMovementMode, FALSE, TRUE ); } - } + } else { // DO ANIMATION OF PICKUP NOW! - PickPickupAnimation( pSoldier, pSoldier->uiPendingActionData1, (INT16)( pSoldier->uiPendingActionData4 ), pSoldier->bPendingActionData3 ); + PickPickupAnimation( pSoldier, pSoldier->aiData.uiPendingActionData1, (INT16)( pSoldier->aiData.uiPendingActionData4 ), pSoldier->aiData.bPendingActionData3 ); } } @@ -1690,17 +1678,17 @@ void HandleAutoPlaceFail( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGridNo // Place it in buddy's hand! if ( gpItemPointer == NULL ) { - InternalBeginItemPointer( pSoldier, &(gWorldItems[ iItemIndex ].o ), NO_SLOT ); + InternalBeginItemPointer( pSoldier, &(gWorldItems[ iItemIndex ].object ), NO_SLOT ); } else { // Add back to world... - AddItemToPool( sGridNo, &(gWorldItems[ iItemIndex ].o ), 1 , pSoldier->bLevel, 0, -1 ); + AddItemToPool( sGridNo, &(gWorldItems[ iItemIndex ].object ), 1 , pSoldier->pathing.bLevel, 0, -1 ); // If we are a merc, say DAMN quote.... if ( pSoldier->bTeam == gbPlayerNum ) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); } } } @@ -1710,21 +1698,20 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr { ITEM_POOL * pItemPool; ITEM_POOL * pItemPoolToDelete = NULL; - OBJECTTYPE Object; INT32 cnt = 0; BOOLEAN fPickup; BOOLEAN fFailedAutoPlace = FALSE; INT32 iItemIndexToDelete; BOOLEAN fShouldSayCoolQuote = FALSE; BOOLEAN fDidSayCoolQuote = FALSE; - BOOLEAN fSaidBoobyTrapQuote = FALSE; + BOOLEAN fSaidBoobyTrapQuote = FALSE; // OK. CHECK IF WE ARE DOING ALL IN THIS POOL.... if ( iItemIndex == ITEM_PICKUP_ACTION_ALL || iItemIndex == ITEM_PICKUP_SELECTION ) { // DO all pickup! // LOOP THROUGH LIST TO FIND NODE WE WANT - GetItemPool( sGridNo, &pItemPool, pSoldier->bLevel ); + GetItemPool( sGridNo, &pItemPool, pSoldier->pathing.bLevel ); while( pItemPool ) { @@ -1734,7 +1721,11 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr if ( iItemIndex == ITEM_PICKUP_SELECTION ) { - if ( !pfSelectionList[ cnt ] ) + //CHRISL: This can pose a problem. If the next value in pfSelectionList didn't exist (which can happen if + // we've added an item to the world during this process), it'll pull whatever is in memory which is most + // likely a value larger then 0. + //if ( !pfSelectionList[ cnt ] ) + if(pfSelectionList[cnt] != 1) { fPickup = FALSE; } @@ -1748,31 +1739,31 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr { if ( ContinuePastBoobyTrap( pSoldier, sGridNo, bZLevel, pItemPool->iItemIndex, FALSE, &fSaidBoobyTrapQuote ) ) { - // Make copy of item - memcpy( &Object, &(gWorldItems[ pItemPool->iItemIndex ].o), sizeof( OBJECTTYPE ) ); - - if ( ItemIsCool( &Object ) ) + if ( ItemIsCool( &gWorldItems[ pItemPool->iItemIndex ].object ) ) { fShouldSayCoolQuote = TRUE; } - if (Object.usItem == SWITCH) + if (gWorldItems[ pItemPool->iItemIndex ].object.usItem == SWITCH) { // ask about activating the switch! - bTempFrequency = Object.ItemData.Trigger.BombTrigger.bFrequency; + bTempFrequency = gWorldItems[ pItemPool->iItemIndex ].object[0]->data.misc.bFrequency; gpTempSoldier = pSoldier; DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ ACTIVATE_SWITCH_PROMPT ] , GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, SwitchMessageBoxCallBack, NULL ); pItemPool = pItemPool->pNext; } else { - if ( !AutoPlaceObject( pSoldier, &Object, TRUE ) ) + // Make copy of item + gTempObject = gWorldItems[ pItemPool->iItemIndex ].object; + + if ( !AutoPlaceObject( pSoldier, &gTempObject, TRUE ) ) { // check to see if the object has been swapped with one in inventory - if ( Object.usItem != gWorldItems[ pItemPool->iItemIndex ].o.usItem || Object.ubNumberOfObjects != gWorldItems[ pItemPool->iItemIndex ].o.ubNumberOfObjects ) + if ( gTempObject.usItem != gWorldItems[ pItemPool->iItemIndex ].object.usItem || gTempObject.ubNumberOfObjects != gWorldItems[ pItemPool->iItemIndex ].object.ubNumberOfObjects ) { // copy back because item changed, and we must make sure the item pool reflects this. - memcpy( &(gWorldItems[ pItemPool->iItemIndex ].o), &Object, sizeof( OBJECTTYPE ) ); + gWorldItems[ pItemPool->iItemIndex ].object = gTempObject; } pItemPoolToDelete = pItemPool; @@ -1786,7 +1777,7 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr if( pSoldier->bTeam == OUR_TEAM ) { // check to see if object was owned by another - if( Object.fFlags & OBJECT_OWNED_BY_CIVILIAN ) + if( gTempObject.fFlags & OBJECT_OWNED_BY_CIVILIAN ) { // owned by a civilian if( HandleLoyaltyAdjustmentForRobbery( pSoldier ) == TRUE ) @@ -1795,7 +1786,7 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr } // reset who owns object - Object.fFlags &= ~( OBJECT_OWNED_BY_CIVILIAN ); + gTempObject.fFlags &= ~( OBJECT_OWNED_BY_CIVILIAN ); } } */ @@ -1803,7 +1794,7 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr //pItemPoolToDelete = pItemPool; iItemIndexToDelete = pItemPool->iItemIndex; pItemPool = pItemPool->pNext; - RemoveItemFromPool( sGridNo, iItemIndexToDelete, pSoldier->bLevel ); + RemoveItemFromPool( sGridNo, iItemIndexToDelete, pSoldier->pathing.bLevel ); } } else @@ -1828,31 +1819,27 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr { gfDontChargeAPsToPickup = TRUE; HandleAutoPlaceFail( pSoldier, pItemPoolToDelete->iItemIndex, sGridNo ); - RemoveItemFromPool( sGridNo, pItemPoolToDelete->iItemIndex, pSoldier->bLevel ); + RemoveItemFromPool( sGridNo, pItemPoolToDelete->iItemIndex, pSoldier->pathing.bLevel ); pItemPoolToDelete = NULL; } } else { // REMOVE ITEM FROM POOL - if ( ItemExistsAtLocation( sGridNo, iItemIndex, pSoldier->bLevel ) ) - { + if ( ItemExistsAtLocation( sGridNo, iItemIndex, pSoldier->pathing.bLevel ) ) + { if ( ContinuePastBoobyTrap( pSoldier, sGridNo, bZLevel, iItemIndex, FALSE, &fSaidBoobyTrapQuote ) ) { - - // Make copy of item - memcpy( &Object, &(gWorldItems[ iItemIndex ].o), sizeof( OBJECTTYPE ) ); - - if ( ItemIsCool( &Object ) ) + if ( ItemIsCool( &gWorldItems[ iItemIndex ].object ) ) { fShouldSayCoolQuote = TRUE; } - if (Object.usItem == SWITCH) + if (gWorldItems[ iItemIndex ].object.usItem == SWITCH) { // handle switch - bTempFrequency = Object.ItemData.Trigger.BombTrigger.bFrequency; + bTempFrequency = gWorldItems[ iItemIndex ].object[0]->data.misc.bFrequency; gpTempSoldier = pSoldier; DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ ACTIVATE_SWITCH_PROMPT ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, SwitchMessageBoxCallBack, NULL ); } @@ -1863,7 +1850,7 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr if( pSoldier->bTeam == OUR_TEAM ) { // check to see if object was owned by another - if( Object.fFlags & OBJECT_OWNED_BY_CIVILIAN ) + if( gTempObject.fFlags & OBJECT_OWNED_BY_CIVILIAN ) { // owned by a civilian if( HandleLoyaltyAdjustmentForRobbery( pSoldier ) == TRUE ) @@ -1872,14 +1859,15 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr } // reset who owns object - Object.fFlags &= ~( OBJECT_OWNED_BY_CIVILIAN ); + gTempObject.fFlags &= ~( OBJECT_OWNED_BY_CIVILIAN ); } } */ - RemoveItemFromPool( sGridNo, iItemIndex, pSoldier->bLevel ); + RemoveItemFromPool( sGridNo, iItemIndex, pSoldier->pathing.bLevel ); - if ( !AutoPlaceObject( pSoldier, &(gWorldItems[ iItemIndex ].o ), TRUE ) ) + if ( !AutoPlaceObject( pSoldier, &(gWorldItems[ iItemIndex ].object ), TRUE ) ) { + //ADB well we made an animation, should we still use up points? gfDontChargeAPsToPickup = TRUE; HandleAutoPlaceFail( pSoldier, iItemIndex, sGridNo ); } @@ -1913,14 +1901,14 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr // Aknowledge.... if( pSoldier->bTeam == OUR_TEAM && !fDidSayCoolQuote && !fSaidBoobyTrapQuote ) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_GOTIT ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_GOTIT ); } // OK partner......look for any hidden items! - if ( pSoldier->bTeam == gbPlayerNum && LookForHiddenItems( sGridNo, pSoldier->bLevel, TRUE, 0 ) ) + if ( pSoldier->bTeam == gbPlayerNum && LookForHiddenItems( sGridNo, pSoldier->pathing.bLevel, TRUE, 0 ) ) { - // WISDOM GAIN (5): Found a hidden object + // WISDOM GAIN (5): Found a hidden object StatChange( pSoldier, WISDOMAMT, 5, FALSE ); // We've found something! @@ -1939,7 +1927,7 @@ void HandleSoldierPickupItem( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr UINT16 usNum; // Draw menu if more than one item! - if ( GetItemPool( sGridNo, &pItemPool, pSoldier->bLevel ) ) + if ( GetItemPool( sGridNo, &pItemPool, pSoldier->pathing.bLevel ) ) { // OK, if an enemy, go directly ( skip menu ) if ( pSoldier->bTeam != gbPlayerNum ) @@ -1954,7 +1942,7 @@ void HandleSoldierPickupItem( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr // override the item index passed in with the one for the bomb in this // tile - iItemIndex = FindWorldItemForBombInGridNo( sGridNo, pSoldier->bLevel ); + iItemIndex = FindWorldItemForBombInGridNo( sGridNo, pSoldier->pathing.bLevel ); #ifdef JA2TESTVERSION if (iItemIndex == -1) { @@ -1964,12 +1952,12 @@ void HandleSoldierPickupItem( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr } #endif - gpBoobyTrapItemPool = GetItemPoolForIndex( sGridNo, iItemIndex, pSoldier->bLevel ); + gpBoobyTrapItemPool = GetItemPoolForIndex( sGridNo, iItemIndex, pSoldier->pathing.bLevel ); gpBoobyTrapSoldier = pSoldier; gsBoobyTrapGridNo = sGridNo; - gbBoobyTrapLevel = pSoldier->bLevel; + gbBoobyTrapLevel = pSoldier->pathing.bLevel; gfDisarmingBuriedBomb = TRUE; - gbTrapDifficulty = gWorldItems[ iItemIndex ].o.bTrap; + gbTrapDifficulty = gWorldItems[ iItemIndex ].object[0]->data.bTrap; DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ DISARM_TRAP_PROMPT ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, BoobyTrapMessageBoxCallBack, NULL ); } @@ -1979,9 +1967,9 @@ void HandleSoldierPickupItem( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr if ( pSoldier->bTeam == gbPlayerNum && DoesItemPoolContainAllHiddenItems( pItemPool ) ) { // He's touched them.... - if ( LookForHiddenItems( sGridNo, pSoldier->bLevel, TRUE, 0 ) ) + if ( LookForHiddenItems( sGridNo, pSoldier->pathing.bLevel, TRUE, 0 ) ) { - // WISDOM GAIN (5): Found a hidden object + // WISDOM GAIN (5): Found a hidden object StatChange( pSoldier, WISDOMAMT, 5, FALSE ); // We've found something! @@ -1990,7 +1978,7 @@ void HandleSoldierPickupItem( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr else { // Say NOTHING quote... - DoMercBattleSound( pSoldier, BATTLE_SOUND_NOTHING ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_NOTHING ); } } else @@ -1999,7 +1987,7 @@ void HandleSoldierPickupItem( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr if ( ( usNum = GetNumOkForDisplayItemsInPool( pItemPool, bZLevel ) ) == 1 ) { // Find first OK item.... - while( !ItemPoolOKForDisplay( pItemPool, bZLevel ) ) + while( !ItemPoolOKForDisplay( pItemPool, bZLevel ) ) { pItemPool = pItemPool->pNext; } @@ -2010,7 +1998,7 @@ void HandleSoldierPickupItem( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr if ( usNum != 0 ) { // Freeze guy! - pSoldier->fPauseAllAnimation = TRUE; + pSoldier->flags.fPauseAllAnimation = TRUE; InitializeItemPickupMenu( pSoldier, sGridNo, pItemPool, 0, 0, bZLevel ); @@ -2018,7 +2006,7 @@ void HandleSoldierPickupItem( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr } else { - DoMercBattleSound( pSoldier, BATTLE_SOUND_NOTHING ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_NOTHING ); } } } @@ -2028,7 +2016,7 @@ void HandleSoldierPickupItem( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr else { // Say NOTHING quote... - DoMercBattleSound( pSoldier, BATTLE_SOUND_NOTHING ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_NOTHING ); } } @@ -2044,13 +2032,13 @@ LEVELNODE *AddItemGraphicToWorld( INVTYPE *pItem, INT16 sGridNo, UINT8 ubLevel ) // OK, Do stuff differently base on level! if ( ubLevel == 0 ) { - pNode = AddStructToTail( sGridNo, usTileIndex ); + pNode = AddStructToTail( sGridNo, usTileIndex ); //SET FLAG FOR AN ITEM pNode->uiFlags |= LEVELNODE_ITEM; } else { - AddOnRoofToHead( sGridNo, usTileIndex ); + AddOnRoofToHead( sGridNo, usTileIndex ); //SET FLAG FOR AN ITEM pNode = gpWorldLevelData[ sGridNo ].pOnRoofHead; pNode->uiFlags |= LEVELNODE_ITEM; @@ -2075,11 +2063,11 @@ void RemoveItemGraphicFromWorld( INVTYPE *pItem, INT16 sGridNo, UINT8 ubLevel, L // Loop through and find pointer.... if ( ubLevel == 0 ) { - pNode = gpWorldLevelData[ sGridNo ].pStructHead; + pNode = gpWorldLevelData[ sGridNo ].pStructHead; } else { - pNode = gpWorldLevelData[ sGridNo ].pOnRoofHead; + pNode = gpWorldLevelData[ sGridNo ].pOnRoofHead; } while( pNode != NULL ) @@ -2114,30 +2102,28 @@ void RemoveItemGraphicFromWorld( INVTYPE *pItem, INT16 sGridNo, UINT8 ubLevel, L } // INVENTORY POOL STUFF -OBJECTTYPE* AddItemToPool( INT16 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel ) +OBJECTTYPE* AddItemToPool( INT16 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 soldierID ) { - return InternalAddItemToPool( &sGridNo, pObject, bVisible, ubLevel, usFlags, bRenderZHeightAboveLevel, NULL ); + return InternalAddItemToPool( &sGridNo, pObject, bVisible, ubLevel, usFlags, bRenderZHeightAboveLevel, soldierID, NULL ); } -OBJECTTYPE * AddItemToPoolAndGetIndex( INT16 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT32 * piItemIndex ) +OBJECTTYPE * AddItemToPoolAndGetIndex( INT16 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 soldierID, INT32 * piItemIndex ) { - return( InternalAddItemToPool( &sGridNo, pObject, bVisible, ubLevel, usFlags, bRenderZHeightAboveLevel, piItemIndex ) ); + return( InternalAddItemToPool( &sGridNo, pObject, bVisible, ubLevel, usFlags, bRenderZHeightAboveLevel, soldierID, piItemIndex ) ); } -OBJECTTYPE* InternalAddItemToPool( INT16 *psGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT32 * piItemIndex ) +OBJECTTYPE* InternalAddItemToPool( INT16 *psGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 soldierID, INT32 * piItemIndex ) { ITEM_POOL *pItemPool; ITEM_POOL *pItemPoolTemp; INT32 iWorldItem; STRUCTURE *pStructure, *pBase; INT16 sDesiredLevel; - INT16 sNewGridNo = *psGridNo; + INT16 sNewGridNo = *psGridNo; LEVELNODE *pNode; BOOLEAN fForceOnGround = FALSE; BOOLEAN fObjectInOpenable = FALSE; - INT8 bTerrainID; - - Assert( pObject->ubNumberOfObjects <= MAX_OBJECTS_PER_SLOT); + INT8 bTerrainID; // ATE: Check if the gridno is OK if ( (*psGridNo) == NOWHERE ) @@ -2162,7 +2148,7 @@ OBJECTTYPE* InternalAddItemToPool( INT16 *psGridNo, OBJECTTYPE *pObject, INT8 bV if ( TERRAIN_IS_WATER( bTerrainID) ) { // if ( Item[ pObject->usItem ].fFlags & ITEM_SINKS ) - if ( Item[ pObject->usItem ].sinks ) + if ( Item[ pObject->usItem ].sinks ) { return( NULL ); } @@ -2185,231 +2171,239 @@ OBJECTTYPE* InternalAddItemToPool( INT16 *psGridNo, OBJECTTYPE *pObject, INT8 bV bRenderZHeightAboveLevel = 0; } - // Check structure database - if ( gpWorldLevelData[ *psGridNo ].pStructureHead && (pObject->usItem != OWNERSHIP) && (pObject->usItem != ACTION_ITEM) ) + //CHRISL: We need to make sure that item stacks follow the OldInv stacking limits + // Copy the object we're working with the gTempObject so that we can use pObject later in this function + OBJECTTYPE poolObject = OBJECTTYPE(*pObject); + UINT8 ubSlotLimit = ItemSlotLimit(&poolObject, STACK_SIZE_LIMIT); + while(poolObject.ubNumberOfObjects>0) { - // Something is here, check obstruction in future - sDesiredLevel = ubLevel ? STRUCTURE_ON_ROOF : STRUCTURE_ON_GROUND; - pStructure = FindStructure( *psGridNo , STRUCTURE_BLOCKSMOVES ); - while( pStructure ) + poolObject.MoveThisObjectTo(*pObject,ubSlotLimit); + + // Check structure database + if ( gpWorldLevelData[ *psGridNo ].pStructureHead && (pObject->usItem != OWNERSHIP) && (pObject->usItem != ACTION_ITEM) ) { - if( !(pStructure->fFlags &( STRUCTURE_PERSON | STRUCTURE_CORPSE ) ) && pStructure->sCubeOffset == sDesiredLevel ) + // Something is here, check obstruction in future + sDesiredLevel = ubLevel ? STRUCTURE_ON_ROOF : STRUCTURE_ON_GROUND; + pStructure = FindStructure( *psGridNo , STRUCTURE_BLOCKSMOVES ); + while( pStructure ) { - // If we are going into a raised struct AND we have above level set to -1 - if ( StructureBottomLevel( pStructure ) != 1 && fForceOnGround ) + if( !(pStructure->fFlags &( STRUCTURE_PERSON | STRUCTURE_CORPSE ) ) && pStructure->sCubeOffset == sDesiredLevel ) { - break; - } - - // Adjust the item's gridno to the base of struct..... - pBase = FindBaseStructure( pStructure ); - - // Get LEVELNODE for struct and remove! - sNewGridNo = pBase->sGridNo; - - // Check for openable flag.... - if ( pStructure->fFlags & STRUCTURE_OPENABLE ) - { - // ATE: Set a flag here - we need to know later that we're in an openable... - fObjectInOpenable = TRUE; - - // Something of note is here.... - // SOME sort of structure is here.... set render flag to off - usFlags |= WORLD_ITEM_DONTRENDER; - - // Openable.. check if it's closed, if so, set visiblity... - if ( !( pStructure->fFlags & STRUCTURE_OPEN ) ) - { - // -2 means - don't reveal! - bVisible = -2; - } - - bRenderZHeightAboveLevel = CONVERT_INDEX_TO_PIXELS( StructureHeight( pStructure ) ); - break; - - } - // Else can we place an item on top? - else if ( pStructure->fFlags & ( STRUCTURE_GENERIC ) ) - { - UINT8 ubLevel0, ubLevel1, ubLevel2, ubLevel3; - // If we are going into a raised struct AND we have above level set to -1 if ( StructureBottomLevel( pStructure ) != 1 && fForceOnGround ) { break; } - // Find most dence area... - if ( StructureDensity( pStructure, &ubLevel0, &ubLevel1, &ubLevel2, &ubLevel3 ) ) + // Adjust the item's gridno to the base of struct..... + pBase = FindBaseStructure( pStructure ); + + // Get LEVELNODE for struct and remove! + sNewGridNo = pBase->sGridNo; + + // Check for openable flag.... + if ( pStructure->fFlags & STRUCTURE_OPENABLE ) { - if ( ubLevel3 == 0 && ubLevel2 == 0 && ubLevel1 == 0 && ubLevel0 == 0 ) + // ATE: Set a flag here - we need to know later that we're in an openable... + fObjectInOpenable = TRUE; + + // Something of note is here.... + // SOME sort of structure is here.... set render flag to off + usFlags |= WORLD_ITEM_DONTRENDER; + + // Openable.. check if it's closed, if so, set visiblity... + if ( !( pStructure->fFlags & STRUCTURE_OPEN ) ) { - bRenderZHeightAboveLevel = 0; - } - else if ( ubLevel3 >= ubLevel0 && ubLevel3 >= ubLevel2 && ubLevel3 >= ubLevel1 ) - { - bRenderZHeightAboveLevel = CONVERT_INDEX_TO_PIXELS( 4 ); - } - else if ( ubLevel2 >= ubLevel0 && ubLevel2 >= ubLevel1 && ubLevel2 >= ubLevel3 ) - { - bRenderZHeightAboveLevel = CONVERT_INDEX_TO_PIXELS( 3 ); + // -2 means - don't reveal! + bVisible = -2; } - else if ( ubLevel1 >= ubLevel0 && ubLevel1 >= ubLevel2 && ubLevel1 >= ubLevel3 ) + + bRenderZHeightAboveLevel = CONVERT_INDEX_TO_PIXELS( StructureHeight( pStructure ) ); + break; + + } + // Else can we place an item on top? + else if ( pStructure->fFlags & ( STRUCTURE_GENERIC ) ) + { + UINT8 ubLevel0, ubLevel1, ubLevel2, ubLevel3; + + // If we are going into a raised struct AND we have above level set to -1 + if ( StructureBottomLevel( pStructure ) != 1 && fForceOnGround ) { - bRenderZHeightAboveLevel = CONVERT_INDEX_TO_PIXELS( 2 ); + break; } - else if ( ubLevel0 >= ubLevel1 && ubLevel0 >= ubLevel2 && ubLevel0 >= ubLevel3 ) + + // Find most dence area... + if ( StructureDensity( pStructure, &ubLevel0, &ubLevel1, &ubLevel2, &ubLevel3 ) ) { - bRenderZHeightAboveLevel = CONVERT_INDEX_TO_PIXELS( 1 ); + if ( ubLevel3 == 0 && ubLevel2 == 0 && ubLevel1 == 0 && ubLevel0 == 0 ) + { + bRenderZHeightAboveLevel = 0; + } + else if ( ubLevel3 >= ubLevel0 && ubLevel3 >= ubLevel2 && ubLevel3 >= ubLevel1 ) + { + bRenderZHeightAboveLevel = CONVERT_INDEX_TO_PIXELS( 4 ); + } + else if ( ubLevel2 >= ubLevel0 && ubLevel2 >= ubLevel1 && ubLevel2 >= ubLevel3 ) + { + bRenderZHeightAboveLevel = CONVERT_INDEX_TO_PIXELS( 3 ); + } + else if ( ubLevel1 >= ubLevel0 && ubLevel1 >= ubLevel2 && ubLevel1 >= ubLevel3 ) + { + bRenderZHeightAboveLevel = CONVERT_INDEX_TO_PIXELS( 2 ); + } + else if ( ubLevel0 >= ubLevel1 && ubLevel0 >= ubLevel2 && ubLevel0 >= ubLevel3 ) + { + bRenderZHeightAboveLevel = CONVERT_INDEX_TO_PIXELS( 1 ); + } } + + // Set flag indicating it has an item on top! + pStructure->fFlags |= STRUCTURE_HASITEMONTOP; + break; } - // Set flag indicating it has an item on top! - pStructure->fFlags |= STRUCTURE_HASITEMONTOP; - break; } + pStructure = FindNextStructure( pStructure, STRUCTURE_BLOCKSMOVES ); } - - pStructure = FindNextStructure( pStructure, STRUCTURE_BLOCKSMOVES ); } - } - if (pObject->usItem == SWITCH && !fObjectInOpenable ) - { - if (bVisible != -2) + if (pObject->usItem == SWITCH && !fObjectInOpenable ) { - // switch items which are not hidden inside objects should be considered buried - bVisible = BURIED; - // and they are pressure-triggered unless there is a switch structure there - if (FindStructure( *psGridNo, STRUCTURE_SWITCH ) != NULL) + if (bVisible != -2) { - pObject->ItemData.Trigger.bDetonatorType = BOMB_SWITCH; + // switch items which are not hidden inside objects should be considered buried + bVisible = BURIED; + // and they are pressure-triggered unless there is a switch structure there + if (FindStructure( *psGridNo, STRUCTURE_SWITCH ) != NULL) + { + (*pObject)[0]->data.misc.bDetonatorType = BOMB_SWITCH; + } + else + { + (*pObject)[0]->data.misc.bDetonatorType = BOMB_PRESSURE; + } } else { - pObject->ItemData.Trigger.bDetonatorType = BOMB_PRESSURE; + // else they are manually controlled + (*pObject)[0]->data.misc.bDetonatorType = BOMB_SWITCH; } } + else if ( pObject->usItem == ACTION_ITEM ) + { + switch( (*pObject)[0]->data.misc.bActionValue ) + { + case ACTION_ITEM_SMALL_PIT: + case ACTION_ITEM_LARGE_PIT: + // mark as known about by civs and creatures + gpWorldLevelData[ sNewGridNo ].uiFlags |= MAPELEMENT_ENEMY_MINE_PRESENT; + break; + default: + break; + } + } + + if ( *psGridNo != sNewGridNo ) + { + *psGridNo = sNewGridNo; + } + + + //First add the item to the global list. This is so the game can keep track + //of where the items are, for file i/o, etc. + iWorldItem = AddItemToWorld( *psGridNo, pObject, ubLevel, usFlags, bRenderZHeightAboveLevel, bVisible, soldierID ); + + // Check for and existing pool on the object layer + if ( GetItemPool( *psGridNo, &pItemPool, ubLevel ) ) + { + + // Add to exitsing pool + // Add graphic + pNode = AddItemGraphicToWorld( &(Item[ pObject->usItem ] ), *psGridNo, ubLevel ); + + // Set pool head value in levelnode + pNode->pItemPool = pItemPool; + + // Add New Node + pItemPoolTemp = pItemPool; + // Create new pool + pItemPool = (ITEM_POOL *)MemAlloc( sizeof( ITEM_POOL ) ); + + // Set Next to NULL + pItemPool->pNext = NULL; + // Set Item index + pItemPool->iItemIndex = iWorldItem; + // Get a link back! + pItemPool->pLevelNode = pNode; + + if( pItemPoolTemp ) + { + // Get last item in list + while( pItemPoolTemp->pNext != NULL ) + pItemPoolTemp = pItemPoolTemp->pNext; + + // Set Next of previous + pItemPoolTemp->pNext = pItemPool; + } + // Set Previous of new one + pItemPool->pPrev = pItemPoolTemp; + + } else { - // else they are manually controlled - pObject->ItemData.Trigger.bDetonatorType = BOMB_SWITCH; + pNode = AddItemGraphicToWorld( &(Item[ pObject->usItem ] ), *psGridNo, ubLevel ); + + // Create new pool + pItemPool = (ITEM_POOL *)MemAlloc( sizeof( ITEM_POOL ) ); + + pNode->pItemPool = pItemPool; + + // Set prev to NULL + pItemPool->pPrev = NULL; + // Set next to NULL + pItemPool->pNext = NULL; + // Set Item index + pItemPool->iItemIndex = iWorldItem; + // Get a link back! + pItemPool->pLevelNode = pNode; + + // Set flag to indicate item pool presence + gpWorldLevelData[*psGridNo].uiFlags |= MAPELEMENT_ITEMPOOL_PRESENT; } - } - else if ( pObject->usItem == ACTION_ITEM ) - { - switch( pObject->ItemData.Trigger.bActionValue ) + + // Set visible! + pItemPool->bVisible = bVisible; + + // If bbisible is true, render makered world + if ( bVisible == 1 && GridNoOnScreen( (*psGridNo ) ) ) { - case ACTION_ITEM_SMALL_PIT: - case ACTION_ITEM_LARGE_PIT: - // mark as known about by civs and creatures - gpWorldLevelData[ sNewGridNo ].uiFlags |= MAPELEMENT_ENEMY_MINE_PRESENT; - break; - default: - break; + //gpWorldLevelData[*psGridNo].uiFlags|=MAPELEMENT_REDRAW; + //SetRenderFlags(RENDER_FLAG_MARKED); + SetRenderFlags(RENDER_FLAG_FULL); } - } - if ( *psGridNo != sNewGridNo ) - { - *psGridNo = sNewGridNo; - } + // Set flahs timer + pItemPool->bFlashColor = FALSE; + pItemPool->sGridNo = *psGridNo; + pItemPool->ubLevel = ubLevel; + pItemPool->usFlags = usFlags; + pItemPool->bVisible = bVisible; + pItemPool->bRenderZHeightAboveLevel = bRenderZHeightAboveLevel; - - //First add the item to the global list. This is so the game can keep track - //of where the items are, for file i/o, etc. - iWorldItem = AddItemToWorld( *psGridNo, pObject, ubLevel, usFlags, bRenderZHeightAboveLevel, bVisible ); - - // Check for and existing pool on the object layer - if ( GetItemPool( *psGridNo, &pItemPool, ubLevel ) ) - { - - // Add to exitsing pool - // Add graphic - pNode = AddItemGraphicToWorld( &(Item[ pObject->usItem ] ), *psGridNo, ubLevel ); - - // Set pool head value in levelnode - pNode->pItemPool = pItemPool; - - // Add New Node - pItemPoolTemp = pItemPool; - // Create new pool - pItemPool = (ITEM_POOL *)MemAlloc( sizeof( ITEM_POOL ) ); - - // Set Next to NULL - pItemPool->pNext = NULL; - // Set Item index - pItemPool->iItemIndex = iWorldItem; - // Get a link back! - pItemPool->pLevelNode = pNode; - - if( pItemPoolTemp ) + // ATE: Get head of pool again.... + if ( GetItemPool( *psGridNo, &pItemPool, ubLevel ) ) { - // Get last item in list - while( pItemPoolTemp->pNext != NULL ) - pItemPoolTemp = pItemPoolTemp->pNext; - - // Set Next of previous - pItemPoolTemp->pNext = pItemPool; + AdjustItemPoolVisibility( pItemPool ); } - // Set Previous of new one - pItemPool->pPrev = pItemPoolTemp; + if (piItemIndex) + { + *piItemIndex = iWorldItem; + } } - else - { - pNode = AddItemGraphicToWorld( &(Item[ pObject->usItem ] ), *psGridNo, ubLevel ); - - // Create new pool - pItemPool = (ITEM_POOL *)MemAlloc( sizeof( ITEM_POOL ) ); - - pNode->pItemPool = pItemPool; - - // Set prev to NULL - pItemPool->pPrev = NULL; - // Set next to NULL - pItemPool->pNext = NULL; - // Set Item index - pItemPool->iItemIndex = iWorldItem; - // Get a link back! - pItemPool->pLevelNode = pNode; - - // Set flag to indicate item pool presence - gpWorldLevelData[*psGridNo].uiFlags |= MAPELEMENT_ITEMPOOL_PRESENT; - } - - // Set visible! - pItemPool->bVisible = bVisible; - - // If bbisible is true, render makered world - if ( bVisible == 1 && GridNoOnScreen( (*psGridNo ) ) ) - { - //gpWorldLevelData[*psGridNo].uiFlags|=MAPELEMENT_REDRAW; - //SetRenderFlags(RENDER_FLAG_MARKED); - SetRenderFlags(RENDER_FLAG_FULL); - } - - // Set flahs timer - pItemPool->bFlashColor = FALSE; - pItemPool->sGridNo = *psGridNo; - pItemPool->ubLevel = ubLevel; - pItemPool->usFlags = usFlags; - pItemPool->bVisible = bVisible; - pItemPool->bRenderZHeightAboveLevel = bRenderZHeightAboveLevel; - - // ATE: Get head of pool again.... - if ( GetItemPool( *psGridNo, &pItemPool, ubLevel ) ) - { - AdjustItemPoolVisibility( pItemPool ); - } - - if (piItemIndex) - { - *piItemIndex = iWorldItem; - } - - return( &(gWorldItems[ iWorldItem ].o ) ); + return( &(gWorldItems[ iWorldItem ].object ) ); } @@ -2417,7 +2411,6 @@ BOOLEAN ItemExistsAtLocation( INT16 sGridNo, INT32 iItemIndex, UINT8 ubLevel ) { ITEM_POOL *pItemPool; ITEM_POOL *pItemPoolTemp; - BOOLEAN fItemFound = FALSE; // Check for an existing pool on the object layer if ( GetItemPool( sGridNo, &pItemPool, ubLevel ) ) @@ -2442,7 +2435,6 @@ BOOLEAN ItemTypeExistsAtLocation( INT16 sGridNo, UINT16 usItem, UINT8 ubLevel, I { ITEM_POOL *pItemPool; ITEM_POOL *pItemPoolTemp; - BOOLEAN fItemFound = FALSE; // Check for an existing pool on the object layer if ( GetItemPool( sGridNo, &pItemPool, ubLevel ) ) @@ -2451,7 +2443,7 @@ BOOLEAN ItemTypeExistsAtLocation( INT16 sGridNo, UINT16 usItem, UINT8 ubLevel, I pItemPoolTemp = pItemPool; while( pItemPoolTemp != NULL ) { - if ( gWorldItems[ pItemPoolTemp->iItemIndex ].o.usItem == usItem ) + if ( gWorldItems[ pItemPoolTemp->iItemIndex ].object.usItem == usItem ) { if ( piItemIndex ) { @@ -2471,7 +2463,6 @@ BOOLEAN MarblesExistAtLocation( INT16 sGridNo, UINT8 ubLevel, INT32 * piItemInde { ITEM_POOL *pItemPool; ITEM_POOL *pItemPoolTemp; - BOOLEAN fItemFound = FALSE; // Check for an existing pool on the object layer if ( GetItemPool( sGridNo, &pItemPool, ubLevel ) ) @@ -2480,7 +2471,7 @@ BOOLEAN MarblesExistAtLocation( INT16 sGridNo, UINT8 ubLevel, INT32 * piItemInde pItemPoolTemp = pItemPool; while( pItemPoolTemp != NULL ) { - if ( Item[gWorldItems[ pItemPoolTemp->iItemIndex ].o.usItem].marbles ) + if ( Item[gWorldItems[ pItemPoolTemp->iItemIndex ].object.usItem].marbles ) { if ( piItemIndex ) { @@ -2501,7 +2492,6 @@ INT32 GetItemOfClassTypeInPool( INT16 sGridNo, UINT32 uiItemClass, UINT8 ubLevel { ITEM_POOL *pItemPool; ITEM_POOL *pItemPoolTemp; - BOOLEAN fItemFound = FALSE; // Check for an existing pool on the object layer if ( GetItemPool( sGridNo, &pItemPool, ubLevel ) ) @@ -2510,7 +2500,7 @@ INT32 GetItemOfClassTypeInPool( INT16 sGridNo, UINT32 uiItemClass, UINT8 ubLevel pItemPoolTemp = pItemPool; while( pItemPoolTemp != NULL ) { - if ( Item[ gWorldItems[ pItemPoolTemp->iItemIndex ].o.usItem ].usItemClass & uiItemClass ) + if ( Item[ gWorldItems[ pItemPoolTemp->iItemIndex ].object.usItem ].usItemClass & uiItemClass ) { return( pItemPoolTemp->iItemIndex ); } @@ -2526,7 +2516,6 @@ ITEM_POOL * GetItemPoolForIndex( INT16 sGridNo, INT32 iItemIndex, UINT8 ubLevel { ITEM_POOL *pItemPool; ITEM_POOL *pItemPoolTemp; - BOOLEAN fItemFound = FALSE; // Check for an existing pool on the object layer if ( GetItemPool( sGridNo, &pItemPool, ubLevel ) ) @@ -2595,7 +2584,7 @@ BOOLEAN LookForHiddenItems( INT16 sGridNo, INT8 ubLevel, BOOLEAN fSetLocator, IN // LOOP THROUGH LIST TO FIND NODE WE WANT while( pItemPool != NULL ) { - if ( gWorldItems[ pItemPool->iItemIndex ].bVisible == HIDDEN_ITEM && gWorldItems[ pItemPool->iItemIndex ].o.usItem != OWNERSHIP ) + if ( gWorldItems[ pItemPool->iItemIndex ].bVisible == HIDDEN_ITEM && gWorldItems[ pItemPool->iItemIndex ].object.usItem != OWNERSHIP ) { fFound = TRUE; @@ -2649,42 +2638,6 @@ INT8 GetLargestZLevelOfItemPool( ITEM_POOL *pItemPool ) return( 0 ); } - - -BOOLEAN DoesItemPoolContainAllItemsOfHigherZLevel( ITEM_POOL *pItemPool ) -{ - // LOOP THROUGH LIST TO FIND NODE WE WANT - while( pItemPool != NULL ) - { - if ( pItemPool->bRenderZHeightAboveLevel == 0 ) - { - return( FALSE ); - } - - pItemPool = pItemPool->pNext; - } - - return( TRUE ); -} - - -BOOLEAN DoesItemPoolContainAllItemsOfZeroZLevel( ITEM_POOL *pItemPool ) -{ - // LOOP THROUGH LIST TO FIND NODE WE WANT - while( pItemPool != NULL ) - { - if ( pItemPool->bRenderZHeightAboveLevel != 0 ) - { - return( FALSE ); - } - - pItemPool = pItemPool->pNext; - } - - return( TRUE ); -} - - void RemoveItemPool( INT16 sGridNo, UINT8 ubLevel ) { ITEM_POOL *pItemPool; @@ -2738,7 +2691,7 @@ void LoopLevelNodeForShowThroughFlag( LEVELNODE *pNode, INT16 sGridNo, UINT8 ubL pNode->uiFlags |= LEVELNODE_SHOW_THROUGH; } - if( gGameSettings.fOptions[ TOPTION_GLOW_ITEMS ] ) + if( gGameSettings.fOptions[ TOPTION_GLOW_ITEMS ] ) { pNode->uiFlags |= LEVELNODE_DYNAMIC; } @@ -2755,7 +2708,7 @@ void HandleItemObscuredFlag( INT16 sGridNo, UINT8 ubLevel ) if ( ubLevel == 0 ) { pNode = gpWorldLevelData[ sGridNo ].pStructHead; - LoopLevelNodeForShowThroughFlag( pNode, sGridNo, ubLevel ); + LoopLevelNodeForShowThroughFlag( pNode, sGridNo, ubLevel ); } else { @@ -2780,7 +2733,7 @@ BOOLEAN SetItemPoolVisibilityOn( ITEM_POOL *pItemPool, INT8 bAllGreaterThan, BOO // Update each item... if ( bVisibleValue != VISIBLE ) { - if ( gWorldItems[ pItemPoolTemp->iItemIndex ].o.usItem == ACTION_ITEM ) + if ( gWorldItems[ pItemPoolTemp->iItemIndex ].object.usItem == ACTION_ITEM ) { // NEVER MAKE VISIBLE! pItemPoolTemp = pItemPoolTemp->pNext; @@ -2788,7 +2741,7 @@ BOOLEAN SetItemPoolVisibilityOn( ITEM_POOL *pItemPool, INT8 bAllGreaterThan, BOO } // If we have reached a visible value we should not modify, ignore... - if ( bVisibleValue >= bAllGreaterThan && gWorldItems[ pItemPoolTemp->iItemIndex ].o.usItem != OWNERSHIP ) + if ( bVisibleValue >= bAllGreaterThan && gWorldItems[ pItemPoolTemp->iItemIndex ].object.usItem != OWNERSHIP ) { // Update the world value gWorldItems[ pItemPoolTemp->iItemIndex ].bVisible = VISIBLE; @@ -2796,15 +2749,16 @@ BOOLEAN SetItemPoolVisibilityOn( ITEM_POOL *pItemPool, INT8 bAllGreaterThan, BOO fAtLeastModified = TRUE; } - /* - if ( gWorldItems[ pItemPoolTemp->iItemIndex ].o.usItem == ACTION_ITEM ) +#ifdef obsoleteCode + /* + if ( gWorldItems[ pItemPoolTemp->iItemIndex ].object.usItem == ACTION_ITEM ) { - pObj = &(gWorldItems[ pItemPoolTemp->iItemIndex ].o); - switch( pObj->bActionValue ) + pObj = &(gWorldItems[ pItemPoolTemp->iItemIndex ].object); + switch( (*pObj)[0]->data.misc.bActionValue ) { case ACTION_ITEM_SMALL_PIT: case ACTION_ITEM_LARGE_PIT: - if (pObj->bDetonatorType == 0) + if ((*pObj)[0]->data.misc.bDetonatorType == 0) { // randomly set to active or destroy the item! if (Random( 100 ) < 65) @@ -2829,6 +2783,7 @@ BOOLEAN SetItemPoolVisibilityOn( ITEM_POOL *pItemPool, INT8 bAllGreaterThan, BOO } } */ +#endif //obsoleteCode if (fDeleted) { @@ -2971,7 +2926,7 @@ BOOLEAN RemoveItemFromPool( INT16 sGridNo, INT32 iItemIndex, UINT8 ubLevel ) } // REMOVE GRAPHIC - RemoveItemGraphicFromWorld( &(Item[ gWorldItems[ iItemIndex ].o.usItem ] ), sGridNo, ubLevel, pItemPoolTemp->pLevelNode ); + RemoveItemGraphicFromWorld( &(Item[ gWorldItems[ iItemIndex ].object.usItem ] ), sGridNo, ubLevel, pItemPoolTemp->pLevelNode ); // IF WE ARE LOCATIONG STILL, KILL LOCATOR! if ( pItemPoolTemp->bFlashColor != 0 ) @@ -3070,25 +3025,25 @@ BOOLEAN MoveItemPools( INT16 sStartPos, INT16 sEndPos, INT8 bStartLevel, INT8 bE // While there is an existing pool while( GetItemPool( sStartPos, &pItemPool, bStartLevel ) ) { - memcpy( &TempWorldItem, &(gWorldItems[ pItemPool->iItemIndex ]), sizeof( WORLDITEM ) ); + TempWorldItem = gWorldItems[ pItemPool->iItemIndex ]; RemoveItemFromPool( sStartPos, pItemPool->iItemIndex, bStartLevel ); - //AddItemToPool( sEndPos, &(TempWorldItem.o), -1, TempWorldItem.ubLevel, TempWorldItem.usFlags, TempWorldItem.bRenderZHeightAboveLevel ); - AddItemToPool( sEndPos, &(TempWorldItem.o), -1, bEndLevel, TempWorldItem.usFlags, TempWorldItem.bRenderZHeightAboveLevel ); + //AddItemToPool( sEndPos, &(TempWorldItem.object), -1, TempWorldItem.ubLevel, TempWorldItem.usFlags, TempWorldItem.bRenderZHeightAboveLevel ); + AddItemToPool( sEndPos, &(TempWorldItem.object), -1, bEndLevel, TempWorldItem.usFlags, TempWorldItem.bRenderZHeightAboveLevel ); } return( TRUE ); } -BOOLEAN GetItemPool( UINT16 usMapPos, ITEM_POOL **ppItemPool, UINT8 ubLevel ) +BOOLEAN GetItemPool( INT16 sMapPos, ITEM_POOL **ppItemPool, UINT8 ubLevel ) { LEVELNODE *pObject; if ( ubLevel == 0 ) { - pObject = gpWorldLevelData[ usMapPos ].pStructHead; + pObject = gpWorldLevelData[ sMapPos ].pStructHead; } else { - pObject = gpWorldLevelData[ usMapPos ].pOnRoofHead; + pObject = gpWorldLevelData[ sMapPos ].pOnRoofHead; } (*ppItemPool) = NULL; @@ -3110,10 +3065,42 @@ BOOLEAN GetItemPool( UINT16 usMapPos, ITEM_POOL **ppItemPool, UINT8 ubLevel ) pObject = pObject->pNext; } - return( FALSE ); + return( FALSE ); } +BOOLEAN GetItemPoolFromGround( INT16 sMapPos, ITEM_POOL **ppItemPool ) +{ + //if we know the level, we can avoid an if, and this function is called alot + LEVELNODE *pObject = gpWorldLevelData[ sMapPos ].pStructHead; + //ADB: let's not make 51200 calls to FileWrite ok? +#ifdef JA2BETAVERSION + if ( pObject ) + { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("gpWorldLevelData, %d %d %d", pObject, sMapPos, (&gpWorldLevelData[25600-1]) + sizeof(MAP_ELEMENT) ) ); + } +#endif + // LOOP THORUGH OBJECT LAYER + while( pObject != NULL ) + { + if ( pObject->uiFlags & LEVELNODE_ITEM ) + { + (*ppItemPool) = pObject->pItemPool; + + //DEF added the check because pObject->pItemPool was NULL which was causing problems + if( *ppItemPool ) + return( TRUE ); + else + return( FALSE ); + } + + pObject = pObject->pNext; + } + + (*ppItemPool) = NULL; + + return( FALSE ); +} void NotifySoldiersToLookforItems( ) { @@ -3126,7 +3113,7 @@ void NotifySoldiersToLookforItems( ) if ( pSoldier != NULL ) { - pSoldier->uiStatusFlags |= SOLDIER_LOOKFOR_ITEMS; + pSoldier->flags.uiStatusFlags |= SOLDIER_LOOKFOR_ITEMS; } } @@ -3144,7 +3131,7 @@ void AllSoldiersLookforItems( BOOLEAN fShowLocators ) if ( pSoldier != NULL ) { - RevealRoofsAndItems(pSoldier, TRUE, fShowLocators, pSoldier->bLevel, FALSE ); + RevealRoofsAndItems(pSoldier, TRUE, fShowLocators, pSoldier->pathing.bLevel, FALSE ); } } @@ -3164,7 +3151,7 @@ INT16 GetNumOkForDisplayItemsInPool( ITEM_POOL *pItemPool, INT8 bZLevel ) cnt++; } - pItemPool = pItemPool->pNext; + pItemPool = pItemPool->pNext; } return( (UINT16) cnt ); @@ -3189,7 +3176,7 @@ BOOLEAN AnyItemsVisibleOnLevel( ITEM_POOL *pItemPool, INT8 bZLevel ) } } - pItemPool = pItemPool->pNext; + pItemPool = pItemPool->pNext; } @@ -3205,7 +3192,7 @@ BOOLEAN ItemPoolOKForDisplay( ITEM_POOL *pItemPool, INT8 bZLevel ) } // Setup some conditions! - if ( gWorldItems[ pItemPool->iItemIndex ].bVisible != VISIBLE ) + if ( gWorldItems[ pItemPool->iItemIndex ].bVisible != VISIBLE ) { return( FALSE ); } @@ -3229,7 +3216,7 @@ BOOLEAN ItemPoolOKForPickup( SOLDIERTYPE * pSoldier, ITEM_POOL *pItemPool, INT8 if ( pSoldier->bTeam == gbPlayerNum ) { // Setup some conditions! - if ( gWorldItems[ pItemPool->iItemIndex ].bVisible != VISIBLE ) + if ( gWorldItems[ pItemPool->iItemIndex ].bVisible != VISIBLE ) { return( FALSE ); } @@ -3255,8 +3242,7 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT16 sGridNo, UINT8 bCommand, I ITEM_POOL *pTempItemPool; CHAR16 pStr[ 100 ]; INT16 cnt = 0, sHeight = 0; - INT16 sLargeLineWidth = 0, sLineWidth; - BOOLEAN fRecalcNumListed = FALSE; + INT16 sLargeLineWidth = 0, sLineWidth; BOOLEAN fSelectionDone = FALSE; INT8 gbCurrentItemSel = 0; @@ -3309,7 +3295,7 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT16 sGridNo, UINT8 bCommand, I sHeight += GetFontHeight( SMALLFONT1 ) - 2; - pTempItemPool = pTempItemPool->pNext; + pTempItemPool = pTempItemPool->pNext; } @@ -3319,7 +3305,7 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT16 sGridNo, UINT8 bCommand, I // ATE: Put some conditions on this.... if ( ItemPoolOKForDisplay( pTempItemPool, bZLevel ) ) { - HandleAnyMercInSquadHasCompatibleStuff( (INT8)CurrentSquad( ), &(gWorldItems[ pTempItemPool->iItemIndex ].o ), FALSE ); + HandleAnyMercInSquadHasCompatibleStuff( (INT8)CurrentSquad( ), &(gWorldItems[ pTempItemPool->iItemIndex ].object ), FALSE ); } pTempItemPool = pTempItemPool->pNext; @@ -3340,17 +3326,17 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT16 sGridNo, UINT8 bCommand, I while( pTempItemPool != NULL ) { if ( ItemPoolOKForDisplay( pTempItemPool, bZLevel ) ) - { + { // GET ITEM - pItem = &Item[ gWorldItems[ pTempItemPool->iItemIndex ].o.usItem ]; + pItem = &Item[ gWorldItems[ pTempItemPool->iItemIndex ].object.usItem ]; // Set string - if ( gWorldItems[ pTempItemPool->iItemIndex ].o.ubNumberOfObjects > 1 ) + if ( gWorldItems[ pTempItemPool->iItemIndex ].object.ubNumberOfObjects > 1 ) { - swprintf( pStr, L"%s (%d)", ShortItemNames[ gWorldItems[ pTempItemPool->iItemIndex ].o.usItem ], gWorldItems[ pTempItemPool->iItemIndex ].o.ubNumberOfObjects ); + swprintf( pStr, L"%s (%d)", ShortItemNames[ gWorldItems[ pTempItemPool->iItemIndex ].object.usItem ], gWorldItems[ pTempItemPool->iItemIndex ].object.ubNumberOfObjects ); } else { - swprintf( pStr, L"%s", ShortItemNames[ gWorldItems[ pTempItemPool->iItemIndex ].o.usItem ] ); + swprintf( pStr, L"%s", ShortItemNames[ gWorldItems[ pTempItemPool->iItemIndex ].object.usItem ] ); } // Get Width @@ -3409,7 +3395,7 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT16 sGridNo, UINT8 bCommand, I // START DISPLAY LOOP cnt = bCurStart; - sY = sFontY; + sY = sFontY; // ADD PREV TO THIS LIST! if ( bCurStart >= NUM_ITEMS_LISTED ) @@ -3448,16 +3434,16 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT16 sGridNo, UINT8 bCommand, I if ( ItemPoolOKForDisplay( pItemPool, bZLevel ) ) { // GET ITEM - pItem = &Item[ gWorldItems[ pItemPool->iItemIndex ].o.usItem ]; + pItem = &Item[ gWorldItems[ pItemPool->iItemIndex ].object.usItem ]; // Set string - if ( gWorldItems[ pItemPool->iItemIndex ].o.ubNumberOfObjects > 1 ) + if ( gWorldItems[ pItemPool->iItemIndex ].object.ubNumberOfObjects > 1 ) { - swprintf( pStr, L"%s (%d)", ShortItemNames[ gWorldItems[ pItemPool->iItemIndex ].o.usItem ], gWorldItems[ pItemPool->iItemIndex ].o.ubNumberOfObjects ); + swprintf( pStr, L"%s (%d)", ShortItemNames[ gWorldItems[ pItemPool->iItemIndex ].object.usItem ], gWorldItems[ pItemPool->iItemIndex ].object.ubNumberOfObjects ); } else { - swprintf( pStr, L"%s", ShortItemNames[ gWorldItems[ pItemPool->iItemIndex ].o.usItem ] ); + swprintf( pStr, L"%s", ShortItemNames[ gWorldItems[ pItemPool->iItemIndex ].object.usItem ] ); } gprintfdirty( sFontX, sY, pStr ); @@ -3485,17 +3471,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 ); @@ -3504,11 +3490,11 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT16 sGridNo, UINT8 bCommand, I INT8 GetListMouseHotSpot( INT16 sLargestLineWidth, INT8 bNumItemsListed, INT16 sFontX, INT16 sFontY, INT8 bCurStart ) { - INT16 cnt = 0; - INT16 sTestX1, sTestX2, sTestY1, sTestY2; - INT16 sLineHeight; - INT8 gbCurrentItemSel = -1; - INT8 bListedItems; + INT16 cnt = 0; + INT16 sTestX1, sTestX2, sTestY1, sTestY2; + INT16 sLineHeight; + INT8 gbCurrentItemSel = -1; + INT8 bListedItems; sLineHeight = GetFontHeight( SMALLFONT1 ) - 2; @@ -3623,11 +3609,11 @@ INT32 AddFlashItemSlot( ITEM_POOL *pItemPool, ITEM_POOL_LOCATOR_HOOK Callback, U ubFlags |= ITEM_LOCATOR_LOCKED; - FlashItemSlots[ iFlashItemIndex ].pItemPool = pItemPool; + FlashItemSlots[ iFlashItemIndex ].pItemPool = pItemPool; FlashItemSlots[ iFlashItemIndex ].bRadioFrame = 0; FlashItemSlots[ iFlashItemIndex ].uiLastFrameUpdate = GetJA2Clock( ); - FlashItemSlots[ iFlashItemIndex ].Callback = Callback; + FlashItemSlots[ iFlashItemIndex ].Callback = Callback; FlashItemSlots[ iFlashItemIndex ].fAllocated = TRUE; FlashItemSlots[ iFlashItemIndex ].ubFlags = ubFlags; @@ -3679,7 +3665,7 @@ void HandleFlashingItems( ) for ( cnt = 0; cnt < guiNumFlashItemSlots; cnt++ ) { - pLocator = &( FlashItemSlots[ cnt ] ); + pLocator = &( FlashItemSlots[ cnt ] ); if ( pLocator->fAllocated ) { @@ -3743,7 +3729,7 @@ void HandleFlashingItems( ) if ( pItemPool->bFlashColor == 1 ) { //pObject->uiFlags &= (~LEVELNODE_DYNAMIC); - //pObject->uiFlags |= ( LEVELNODE_LASTDYNAMIC ); + //pObject->uiFlags |= ( LEVELNODE_LASTDYNAMIC ); } else { @@ -3783,7 +3769,7 @@ void RenderTopmostFlashingItems( ) for ( cnt = 0; cnt < guiNumFlashItemSlots; cnt++ ) { - pLocator = &( FlashItemSlots[ cnt ] ); + pLocator = &( FlashItemSlots[ cnt ] ); if ( pLocator->fAllocated ) { @@ -3827,13 +3813,13 @@ void RenderTopmostFlashingItems( ) sXPos -= 20; sYPos -= 20; - iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, sXPos, sYPos, (INT16)(sXPos +40 ), (INT16)(sYPos + 40 ) ); + iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, sXPos, sYPos, (INT16)(sXPos +40 ), (INT16)(sYPos + 40 ) ); if ( iBack != -1 ) { SetBackgroundRectFilled( iBack ); } - BltVideoObjectFromIndex( FRAME_BUFFER, guiRADIO, pLocator->bRadioFrame, sXPos, sYPos, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObjectFromIndex( FRAME_BUFFER, guiRADIO, pLocator->bRadioFrame, sXPos, sYPos, VO_BLT_SRCTRANSPARENCY, NULL ); DrawItemPoolList( pItemPool, pItemPool->sGridNo , ITEMLIST_DISPLAY, pItemPool->bRenderZHeightAboveLevel, sXPos, sYPos ); @@ -3862,15 +3848,15 @@ BOOLEAN VerifyGiveItem( SOLDIERTYPE *pSoldier, SOLDIERTYPE **ppTargetSoldier ) // Get items from pending data pObject = pSoldier->pTempObject; - sGridNo = pSoldier->sPendingActionData2; - ubDirection = pSoldier->bPendingActionData3; - ubTargetMercID = (UINT8)pSoldier->uiPendingActionData4; + sGridNo = pSoldier->aiData.sPendingActionData2; + ubDirection = pSoldier->aiData.bPendingActionData3; + ubTargetMercID = (UINT8)pSoldier->aiData.uiPendingActionData4; - usSoldierIndex = WhoIsThere2( sGridNo, pSoldier->bLevel ); + usSoldierIndex = WhoIsThere2( sGridNo, pSoldier->pathing.bLevel ); // See if our target is still available if ( usSoldierIndex != NOBODY ) - { + { // Check if it's the same merc! if ( usSoldierIndex != ubTargetMercID ) { @@ -3880,7 +3866,7 @@ BOOLEAN VerifyGiveItem( SOLDIERTYPE *pSoldier, SOLDIERTYPE **ppTargetSoldier ) // Get soldier GetSoldier( &pTSoldier, usSoldierIndex ); - // Look for item in hand.... + // Look for item in hand.... (*ppTargetSoldier) = pTSoldier; @@ -3890,21 +3876,20 @@ BOOLEAN VerifyGiveItem( SOLDIERTYPE *pSoldier, SOLDIERTYPE **ppTargetSoldier ) { if ( pSoldier->pTempObject != NULL ) { - AddItemToPool( pSoldier->sGridNo, pSoldier->pTempObject, 1, pSoldier->bLevel, 0 , -1 ); + AddItemToPool( pSoldier->sGridNo, pSoldier->pTempObject, 1, pSoldier->pathing.bLevel, 0 , -1 ); // Place it on the ground! - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ ITEM_HAS_BEEN_PLACED_ON_GROUND_STR ], ShortItemNames[ pSoldier->pTempObject->usItem ] ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ ITEM_HAS_BEEN_PLACED_ON_GROUND_STR ], ShortItemNames[ pSoldier->pTempObject->usItem ] ); // OK, disengage buddy - pSoldier->uiStatusFlags &= (~SOLDIER_ENGAGEDINACTION ); + pSoldier->flags.uiStatusFlags &= (~SOLDIER_ENGAGEDINACTION ); if ( ubTargetMercID != NOBODY ) { - MercPtrs[ ubTargetMercID ]->uiStatusFlags &= (~SOLDIER_ENGAGEDINACTION ); + MercPtrs[ ubTargetMercID ]->flags.uiStatusFlags &= (~SOLDIER_ENGAGEDINACTION ); } - MemFree( pSoldier->pTempObject ); - pSoldier->pTempObject = NULL; + OBJECTTYPE::DeleteMe( &pSoldier->pTempObject ); } } @@ -3917,7 +3902,6 @@ void SoldierGiveItemFromAnimation( SOLDIERTYPE *pSoldier ) { SOLDIERTYPE *pTSoldier; INT8 bInvPos; - OBJECTTYPE TempObject; UINT8 ubProfile; INT16 sGridNo; @@ -3929,13 +3913,11 @@ void SoldierGiveItemFromAnimation( SOLDIERTYPE *pSoldier ) // Get items from pending data // Get objectype and delete - memcpy( &TempObject, pSoldier->pTempObject, sizeof( OBJECTTYPE ) ); - MemFree( pSoldier->pTempObject ); - pSoldier->pTempObject = NULL; - + pSoldier->pTempObject->MoveThisObjectTo(gTempObject); + OBJECTTYPE::DeleteMe( &pSoldier->pTempObject ); bInvPos = pSoldier->bPendingActionData5; - usItemNum = TempObject.usItem; + usItemNum = gTempObject.usItem; // ATE: OK, check if we have an item in the cursor from // this soldier and from this inv slot, if so, delete!!!!!!! @@ -3943,7 +3925,7 @@ void SoldierGiveItemFromAnimation( SOLDIERTYPE *pSoldier ) { if ( pSoldier->ubID == gpItemPointerSoldier->ubID ) { - if ( bInvPos == gbItemPointerSrcSlot && usItemNum == gpItemPointer->usItem ) + if ( bInvPos == gbItemPointerSrcSlot && usItemNum == gpItemPointer->usItem ) { // Remove!!! EndItemPointer( ); @@ -3951,9 +3933,9 @@ void SoldierGiveItemFromAnimation( SOLDIERTYPE *pSoldier ) } } - sGridNo = pSoldier->sPendingActionData2; - ubDirection = pSoldier->bPendingActionData3; - ubTargetMercID = (UINT8)pSoldier->uiPendingActionData4; + sGridNo = pSoldier->aiData.sPendingActionData2; + ubDirection = pSoldier->aiData.bPendingActionData3; + ubTargetMercID = (UINT8)pSoldier->aiData.uiPendingActionData4; // ATE: Deduct APs! DeductPoints( pSoldier, AP_PICKUP_ITEM, 0 ); @@ -3967,12 +3949,12 @@ void SoldierGiveItemFromAnimation( SOLDIERTYPE *pSoldier ) { UnSetEngagedInConvFromPCAction( pSoldier ); - //if the dealer is Micky, + //if the dealer is Micky, /* if( pTSoldier->ubProfile == MICKY ) { //and the items are alcohol, dont enter the shopkeeper - if( GetArmsDealerItemTypeFromItemNumber( TempObject.usItem ) == ARMS_DEALER_ALCOHOL ) + if( GetArmsDealerItemTypeFromItemNumber( gTempObject.usItem ) == ARMS_DEALER_ALCOHOL ) return; } */ @@ -3984,34 +3966,27 @@ void SoldierGiveItemFromAnimation( SOLDIERTYPE *pSoldier ) } // now also check for buy/sell lines (Oct 13) /* - else if ( NPCWillingToAcceptItem( pTSoldier->ubProfile, pSoldier->ubProfile, &TempObject ) ) + else if ( NPCWillingToAcceptItem( pTSoldier->ubProfile, pSoldier->ubProfile, &gTempObject ) ) { TriggerNPCWithGivenApproach( pTSoldier->ubProfile, APPROACH_GIVINGITEM, TRUE ); return; }*/ - else if ( !NPCWillingToAcceptItem( pTSoldier->ubProfile, pSoldier->ubProfile, &TempObject ) ) + else if ( !NPCWillingToAcceptItem( pTSoldier->ubProfile, pSoldier->ubProfile, &gTempObject ) ) { //Enter the shopkeeper interface EnterShopKeeperInterfaceScreen( pTSoldier->ubProfile ); - // removed the if, because if the player picked up an item straight from the ground or money strait from the money + // removed the if, because if the player picked up an item straight from the ground or money strait from the money // interface, the item would NOT have a bInvPos, therefore it would not get added to the dealer, and would get deleted // if ( bInvPos != NO_SLOT ) { // MUST send in NO_SLOT, as the SKI wille expect it to exist in inv if not.... - AddItemToPlayersOfferAreaAfterShopKeeperOpen( &TempObject, NO_SLOT ); - - /* - Changed because if the player gave 1 item from a pile, the rest of the items in the piule would disappear - // OK, r emove the item, as the SKI will give it back once done - DeleteObj( &( pSoldier->inv[ bInvPos ] ) ); - */ - + AddItemToPlayersOfferAreaAfterShopKeeperOpen( &gTempObject ); if ( bInvPos != NO_SLOT ) { - RemoveObjFrom( &pSoldier->inv[ bInvPos ], TempObject.ubNumberOfObjects ); + pSoldier->inv[ bInvPos ].initialize(); } DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); @@ -4032,7 +4007,7 @@ void SoldierGiveItemFromAnimation( SOLDIERTYPE *pSoldier ) // Switch on target... // Are we a player dude.. ( target? ) if ( ubProfile < FIRST_RPC || RPC_RECRUITED( pTSoldier ) || ubProfile >= GASTON ) - { + { fToTargetPlayer = TRUE; } @@ -4043,7 +4018,7 @@ void SoldierGiveItemFromAnimation( SOLDIERTYPE *pSoldier ) DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); // We are a merc, add! - if ( !AutoPlaceObject( pTSoldier, &TempObject, TRUE ) ) + if ( !AutoPlaceObject( pTSoldier, &gTempObject, TRUE ) ) { // Erase! if ( bInvPos != NO_SLOT ) @@ -4052,15 +4027,15 @@ void SoldierGiveItemFromAnimation( SOLDIERTYPE *pSoldier ) DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); } - AddItemToPool( pSoldier->sGridNo, &TempObject, 1, pSoldier->bLevel, 0 , -1 ); + AddItemToPool( pSoldier->sGridNo, &gTempObject, 1, pSoldier->pathing.bLevel, 0 , -1 ); // We could not place it! // Drop it on the ground? - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ ITEM_HAS_BEEN_PLACED_ON_GROUND_STR ], ShortItemNames[ usItemNum ] ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ ITEM_HAS_BEEN_PLACED_ON_GROUND_STR ], ShortItemNames[ usItemNum ] ); // OK, disengage buddy - pSoldier->uiStatusFlags &= (~SOLDIER_ENGAGEDINACTION ); - pTSoldier->uiStatusFlags &= (~SOLDIER_ENGAGEDINACTION ); + pSoldier->flags.uiStatusFlags &= (~SOLDIER_ENGAGEDINACTION ); + pTSoldier->flags.uiStatusFlags &= (~SOLDIER_ENGAGEDINACTION ); } else { @@ -4078,7 +4053,7 @@ void SoldierGiveItemFromAnimation( SOLDIERTYPE *pSoldier ) // are we giving money to an NPC, to whom we owe money? if (pTSoldier->ubProfile != NO_PROFILE && gMercProfiles[pTSoldier->ubProfile].iBalance < 0) { - gMercProfiles[pTSoldier->ubProfile].iBalance += TempObject.ItemData.Money.uiMoneyAmount; + gMercProfiles[pTSoldier->ubProfile].iBalance += gTempObject[0]->data.money.uiMoneyAmount; if (gMercProfiles[pTSoldier->ubProfile].iBalance >= 0) { // don't let the player accumulate credit (?) @@ -4090,7 +4065,7 @@ void SoldierGiveItemFromAnimation( SOLDIERTYPE *pSoldier ) else { // report the payment - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ GUY_STILL_OWED_STR ], pTSoldier->name, -gMercProfiles[pTSoldier->ubProfile].iBalance ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ GUY_STILL_OWED_STR ], pTSoldier->name, -gMercProfiles[pTSoldier->ubProfile].iBalance ); } } } @@ -4101,18 +4076,18 @@ void SoldierGiveItemFromAnimation( SOLDIERTYPE *pSoldier ) // Erase! if ( bInvPos != NO_SLOT ) { - RemoveObjs( &(pSoldier->inv[ bInvPos ]), TempObject.ubNumberOfObjects ); + DeleteObj(&pSoldier->inv[ bInvPos ]); DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); } // Now intiate conv - InitiateConversation( pTSoldier, pSoldier, APPROACH_GIVINGITEM, (INT32)&TempObject ); + InitiateConversation( pTSoldier, pSoldier, APPROACH_GIVINGITEM, (INT32)&gTempObject ); } } // OK, disengage buddy - pSoldier->uiStatusFlags &= (~SOLDIER_ENGAGEDINACTION ); - pTSoldier->uiStatusFlags &= (~SOLDIER_ENGAGEDINACTION ); + pSoldier->flags.uiStatusFlags &= (~SOLDIER_ENGAGEDINACTION ); + pTSoldier->flags.uiStatusFlags &= (~SOLDIER_ENGAGEDINACTION ); } @@ -4135,7 +4110,7 @@ INT16 AdjustGridNoForItemPlacement( SOLDIERTYPE *pSoldier, INT16 sGridNo ) if( gpWorldLevelData[ sGridNo ].pStructureHead ) { // Something is here, check obstruction in future - sDesiredLevel = pSoldier->bLevel ? STRUCTURE_ON_ROOF : STRUCTURE_ON_GROUND; + sDesiredLevel = pSoldier->pathing.bLevel ? STRUCTURE_ON_ROOF : STRUCTURE_ON_GROUND; pStructure = FindStructure( (INT16)sGridNo, STRUCTURE_BLOCKSMOVES ); while( pStructure ) { @@ -4153,12 +4128,12 @@ INT16 AdjustGridNoForItemPlacement( SOLDIERTYPE *pSoldier, INT16 sGridNo ) } // ATE: IF a person is found, use adjacent gridno for it! - ubTargetID = WhoIsThere2( sGridNo, pSoldier->bLevel ); + ubTargetID = WhoIsThere2( sGridNo, pSoldier->pathing.bLevel ); if ( fStructFound || ( ubTargetID != NOBODY && ubTargetID != pSoldier->ubID ) ) { // GET ADJACENT GRIDNO - sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, FALSE, FALSE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, FALSE, FALSE ); if ( sActionGridNo == -1 ) { @@ -4188,11 +4163,11 @@ void StartBombMessageBox( SOLDIERTYPE * pSoldier, INT16 sGridNo ) { // check to make sure the appropriate sector is loaded } - SetOffBombsByFrequency( pSoldier->ubID, pSoldier->inv[HANDPOS].bFrequency ); + SetOffBombsByFrequency( pSoldier->ubID, pSoldier->inv[HANDPOS][0]->data.misc.bFrequency ); */ // PLay sound.... - PlayJA2Sample( USE_STATUE_REMOTE, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); + PlayJA2Sample( USE_STATUE_REMOTE, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); // Check what sector we are in.... @@ -4200,7 +4175,7 @@ void StartBombMessageBox( SOLDIERTYPE * pSoldier, INT16 sGridNo ) { if ( InARoom( pSoldier->sGridNo, &ubRoom ) && ubRoom == 4 ) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_OK1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_OK1 ); // Open statue ChangeO3SectorStatue( FALSE ); @@ -4208,15 +4183,15 @@ void StartBombMessageBox( SOLDIERTYPE * pSoldier, INT16 sGridNo ) } else { - DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); } } else { - DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); } } - else if ( IsDetonatorAttached ( &(pSoldier->inv[HANDPOS]) ) ) + else if ( IsDetonatorAttached ( &(pSoldier->inv[HANDPOS]) ) ) { DoMessageBox( MSG_BOX_BASIC_SMALL_BUTTONS, TacticalStr[ CHOOSE_TIMER_STR ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS, BombMessageBoxCallBack, NULL ); } @@ -4249,15 +4224,15 @@ void BombMessageBoxCallBack( UINT8 ubExitValue ) if ( iResult >= 0 ) { - // EXPLOSIVES GAIN (25): Place a bomb, or buried and armed a mine + // EXPLOSIVES GAIN (25): Place a bomb, or buried and armed a mine StatChange( gpTempSoldier, EXPLODEAMT, 25, FALSE ); } else { - // EXPLOSIVES GAIN (10): Failed to place a bomb, or bury and arm a mine + // EXPLOSIVES GAIN (10): Failed to place a bomb, or bury and arm a mine StatChange( gpTempSoldier, EXPLODEAMT, 10, FROM_FAILURE ); - // oops! How badly did we screw up? + // oops! How badly did we screw up? if ( iResult >= -20 ) { // messed up the setting @@ -4275,20 +4250,21 @@ void BombMessageBoxCallBack( UINT8 ubExitValue ) else { // OOPS! ... BOOM! - IgniteExplosion( NOBODY, gpTempSoldier->sX, gpTempSoldier->sY, (INT16) (gpWorldLevelData[gpTempSoldier->sGridNo].sHeight), gpTempSoldier->sGridNo, gpTempSoldier->inv[ HANDPOS ].usItem, gpTempSoldier->bLevel ); + IgniteExplosion( NOBODY, gpTempSoldier->sX, gpTempSoldier->sY, (INT16) (gpWorldLevelData[gpTempSoldier->sGridNo].sHeight), gpTempSoldier->sGridNo, gpTempSoldier->inv[ HANDPOS ].usItem, gpTempSoldier->pathing.bLevel ); return; } } if ( ArmBomb( &(gpTempSoldier->inv[HANDPOS]), ubExitValue ) ) { - gpTempSoldier->inv[ HANDPOS ].bTrap = __min( 10, ( EffectiveExplosive( gpTempSoldier ) / 20) + (EffectiveExpLevel( gpTempSoldier ) / 3) ); + gpTempSoldier->inv[ HANDPOS ][0]->data.bTrap = __min( 10, ( EffectiveExplosive( gpTempSoldier ) / 20) + (EffectiveExpLevel( gpTempSoldier ) / 3) ); // HACK IMMINENT! // value of 1 is stored in maps for SIDE of bomb owner... when we want to use IDs! // so we add 2 to all owner IDs passed through here and subtract 2 later - gpTempSoldier->inv[HANDPOS].ItemData.Trigger.ubBombOwner = gpTempSoldier->ubID + 2; - AddItemToPool( gsTempGridno, &(gpTempSoldier->inv[HANDPOS]), 1, gpTempSoldier->bLevel, WORLD_ITEM_ARMED_BOMB, 0 ); - DeleteObj( &(gpTempSoldier->inv[HANDPOS]) ); + if (gpTempSoldier->inv[HANDPOS].MoveThisObjectTo(gTempObject, 1) == 0) { + gTempObject[0]->data.misc.ubBombOwner = gpTempSoldier->ubID + 2; + AddItemToPool( gsTempGridno, &gTempObject, 1, gpTempSoldier->pathing.bLevel, WORLD_ITEM_ARMED_BOMB, 0 ); + } } } } @@ -4305,22 +4281,22 @@ BOOLEAN HandItemWorks( SOLDIERTYPE *pSoldier, INT8 bSlot ) // if the item can be damaged, than we must check that it's in good enough // shape to be usable, and doesn't break during use. - // Exception: land mines. You can bury them broken, they just won't blow! + // Exception: land mines. You can bury them broken, they just won't blow! // if ( (Item[ pObj->usItem ].fFlags & ITEM_DAMAGEABLE) && (pObj->usItem != MINE) && (Item[ pObj->usItem ].usItemClass != IC_MEDKIT) && pObj->usItem != GAS_CAN ) if ( (Item[ pObj->usItem ].damageable ) && (!Item[pObj->usItem].mine ) && (Item[ pObj->usItem ].usItemClass != IC_MEDKIT) && !Item[pObj->usItem].gascan ) { // if it's still usable, check whether it breaks - if ( pObj->ItemData.Generic.bStatus[0] >= USABLE) + if ( (*pObj)[0]->data.objectStatus >= USABLE) { // if a dice roll is greater than the item's status - if ( (Random(80) + 20) >= (UINT32) (pObj->ItemData.Generic.bStatus[0] + 50) ) + if ( (Random(80) + 20) >= (UINT32) ((*pObj)[0]->data.objectStatus + 50) ) { fItemJustBroke = TRUE; fItemWorks = FALSE; - // item breaks, and becomes unusable... so its status is reduced + // item breaks, and becomes unusable... so its status is reduced // to somewhere between 1 and the 1 less than USABLE - pObj->ItemData.Generic.bStatus[0] = (INT8) ( 1 + Random( USABLE - 1 ) ); + (*pObj)[0]->data.objectStatus = (INT8) ( 1 + Random( USABLE - 1 ) ); } } else // it's already unusable @@ -4343,8 +4319,8 @@ BOOLEAN HandItemWorks( SOLDIERTYPE *pSoldier, INT8 bSlot ) { // are we using two guns at once? if ( Item[ pSoldier->inv[SECONDHANDPOS].usItem ].usItemClass == IC_GUN && - pSoldier->inv[SECONDHANDPOS].ItemData.Gun.bGunStatus >= USABLE && - pSoldier->inv[SECONDHANDPOS].ItemData.Gun.ubGunShotsLeft > 0) + pSoldier->inv[SECONDHANDPOS][0]->data.gun.bGunStatus >= USABLE && + pSoldier->inv[SECONDHANDPOS][0]->data.gun.ubGunShotsLeft > 0) { // check the second gun for breakage, and if IT breaks, return false return( HandItemWorks( pSoldier, SECONDHANDPOS ) ); @@ -4360,7 +4336,7 @@ void SetOffBoobyTrapInMapScreen( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject ) UINT8 ubPtsDmg = 0; // check if trapped item is an explosive, if so then up the amount of dmg - if( ( pObject -> usItem == TNT )|| ( pObject -> usItem == RDX ) ) + if( ( pObject->usItem == TNT )|| ( pObject->usItem == RDX ) ) { // for explosive ubPtsDmg = 0; @@ -4372,10 +4348,10 @@ void SetOffBoobyTrapInMapScreen( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject ) } // injure the inventory character - SoldierTakeDamage( pSoldier, 0, ubPtsDmg, ubPtsDmg, TAKE_DAMAGE_EXPLOSION, NOBODY, NOWHERE, 0, TRUE ); + pSoldier->SoldierTakeDamage( 0, ubPtsDmg, ubPtsDmg, TAKE_DAMAGE_EXPLOSION, NOBODY, NOWHERE, 0, TRUE ); // play the sound - PlayJA2Sample( EXPLOSION_1, RATE_11025, BTNVOLUME, 1, MIDDLEPAN ); + PlayJA2Sample( EXPLOSION_1, RATE_11025, BTNVOLUME, 1, MIDDLEPAN ); } @@ -4399,36 +4375,36 @@ BOOLEAN ContinuePastBoobyTrap( SOLDIERTYPE * pSoldier, INT16 sGridNo, INT8 bLeve INT8 bTrapDifficulty, bTrapDetectLevel; OBJECTTYPE * pObj; - pObj = &(gWorldItems[ iItemIndex ].o); + pObj = &(gWorldItems[ iItemIndex ].object); (*pfSaidQuote) = FALSE; - if (pObj->bTrap > 0) + if ((*pObj)[0]->data.bTrap > 0) { if (pSoldier->bTeam == gbPlayerNum) { // does the player know about this item? - fBoobyTrapKnowledge = ((pObj->fFlags & OBJECT_KNOWN_TO_BE_TRAPPED) > 0); + fBoobyTrapKnowledge = (((*pObj).fFlags & OBJECT_KNOWN_TO_BE_TRAPPED) > 0); // blue flag stuff? if (!fBoobyTrapKnowledge) { - bTrapDifficulty = pObj->bTrap; + bTrapDifficulty = (*pObj)[0]->data.bTrap; bTrapDetectLevel = CalcTrapDetectLevel( pSoldier, FALSE ); if (bTrapDetectLevel >= bTrapDifficulty) { // spotted the trap! - pObj->fFlags |= OBJECT_KNOWN_TO_BE_TRAPPED; + (*pObj).fFlags |= OBJECT_KNOWN_TO_BE_TRAPPED; fBoobyTrapKnowledge = TRUE; // Make him warn us: // Set things up.. gpBoobyTrapSoldier = pSoldier; - gpBoobyTrapItemPool = GetItemPoolForIndex( sGridNo, iItemIndex, pSoldier->bLevel ); + gpBoobyTrapItemPool = GetItemPoolForIndex( sGridNo, iItemIndex, pSoldier->pathing.bLevel ); gsBoobyTrapGridNo = sGridNo; - gbBoobyTrapLevel = pSoldier->bLevel; + gbBoobyTrapLevel = pSoldier->pathing.bLevel; gfDisarmingBuriedBomb = FALSE; gbTrapDifficulty = bTrapDifficulty; @@ -4442,15 +4418,15 @@ BOOLEAN ContinuePastBoobyTrap( SOLDIERTYPE * pSoldier, INT16 sGridNo, INT8 bLeve } } - gpBoobyTrapItemPool = GetItemPoolForIndex( sGridNo, iItemIndex, pSoldier->bLevel ); + gpBoobyTrapItemPool = GetItemPoolForIndex( sGridNo, iItemIndex, pSoldier->pathing.bLevel ); if (fBoobyTrapKnowledge) { // have the computer ask us if we want to proceed gpBoobyTrapSoldier = pSoldier; gsBoobyTrapGridNo = sGridNo; - gbBoobyTrapLevel = pSoldier->bLevel; + gbBoobyTrapLevel = pSoldier->pathing.bLevel; gfDisarmingBuriedBomb = FALSE; - gbTrapDifficulty = pObj->bTrap; + gbTrapDifficulty = (*pObj)[0]->data.bTrap; if( fInStrategic ) { @@ -4483,11 +4459,11 @@ void BoobyTrapDialogueCallBack( void ) // now prompt the user... if( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) { - DoScreenIndependantMessageBox( TacticalStr[ DISARM_BOOBYTRAP_PROMPT ], ( UINT8 )MSG_BOX_FLAG_YESNO, BoobyTrapInMapScreenMessageBoxCallBack ); + DoScreenIndependantMessageBox( TacticalStr[ DISARM_BOOBYTRAP_PROMPT ], ( UINT8 )MSG_BOX_FLAG_YESNO, BoobyTrapInMapScreenMessageBoxCallBack ); } else { - DoScreenIndependantMessageBox( TacticalStr[ DISARM_BOOBYTRAP_PROMPT ], ( UINT8 )MSG_BOX_FLAG_YESNO, BoobyTrapMessageBoxCallBack ); + DoScreenIndependantMessageBox( TacticalStr[ DISARM_BOOBYTRAP_PROMPT ], ( UINT8 )MSG_BOX_FLAG_YESNO, BoobyTrapMessageBoxCallBack ); } } @@ -4496,9 +4472,9 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue ) if ( gfJustFoundBoobyTrap ) { // NOW award for finding boobytrap - // WISDOM GAIN: Detected a booby-trap + // WISDOM GAIN: Detected a booby-trap StatChange( gpBoobyTrapSoldier, WISDOMAMT, (UINT16) (3 * gbTrapDifficulty), FALSE ); - // EXPLOSIVES GAIN: Detected a booby-trap + // EXPLOSIVES GAIN: Detected a booby-trap StatChange( gpBoobyTrapSoldier, EXPLODEAMT, (UINT16) (3 * gbTrapDifficulty), FALSE ); gfJustFoundBoobyTrap = FALSE; } @@ -4506,21 +4482,18 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue ) if (ubExitValue == MSG_BOX_RETURN_YES) { INT32 iCheckResult; - OBJECTTYPE Object; - - - // get the item - memcpy( &Object, &(gWorldItems[ gpBoobyTrapItemPool->iItemIndex ].o), sizeof( OBJECTTYPE ) ); + // get the item + gTempObject = gWorldItems[ gpBoobyTrapItemPool->iItemIndex ].object; // Snap: make it easier to disarm our own traps. // If we succede - we get exp, but if we fail - we pay fair and square! - // NB owner grossness... bombs 'owned' by the enemy are stored with side value 1 in + // NB owner grossness... bombs 'owned' by the enemy are stored with side value 1 in // the map. So if we want to detect a bomb placed by the player, owner is > 1, and // owner - 2 gives the ID of the character who planted it - if ( Object.ItemData.Trigger.ubBombOwner > 1 && ( (INT32)Object.ItemData.Trigger.ubBombOwner - 2 >= gTacticalStatus.Team[ OUR_TEAM ].bFirstID && Object.ItemData.Trigger.ubBombOwner - 2 <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ) ) + if ( gTempObject[0]->data.misc.ubBombOwner > 1 && ( (INT32)gTempObject[0]->data.misc.ubBombOwner - 2 >= gTacticalStatus.Team[ OUR_TEAM ].bFirstID && gTempObject[0]->data.misc.ubBombOwner - 2 <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ) ) { - if ( Object.ItemData.Trigger.ubBombOwner - 2 == gpBoobyTrapSoldier->ubID ) + if ( gTempObject[0]->data.misc.ubBombOwner - 2 == gpBoobyTrapSoldier->ubID ) { // my own boobytrap! iCheckResult = SkillCheck( gpBoobyTrapSoldier, DISARM_TRAP_CHECK, 40 ); @@ -4539,9 +4512,9 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue ) if (iCheckResult >= 0) { - if ( Object.ItemData.Trigger.ubBombOwner > 1 && ( (INT32)Object.ItemData.Trigger.ubBombOwner - 2 >= gTacticalStatus.Team[ OUR_TEAM ].bFirstID && Object.ItemData.Trigger.ubBombOwner - 2 <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ) ) + if ( gTempObject[0]->data.misc.ubBombOwner > 1 && ( (INT32)gTempObject[0]->data.misc.ubBombOwner - 2 >= gTacticalStatus.Team[ OUR_TEAM ].bFirstID && gTempObject[0]->data.misc.ubBombOwner - 2 <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ) ) { - if ( Object.ItemData.Trigger.ubBombOwner - 2 == gpBoobyTrapSoldier->ubID ) + if ( gTempObject[0]->data.misc.ubBombOwner - 2 == gpBoobyTrapSoldier->ubID ) { // disarmed my own boobytrap! StatChange( gpBoobyTrapSoldier, EXPLODEAMT, (UINT16) (2 * gbTrapDifficulty), FALSE ); @@ -4559,24 +4532,24 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue ) } // have merc say this is good - DoMercBattleSound( gpBoobyTrapSoldier, BATTLE_SOUND_COOL1 ); + gpBoobyTrapSoldier->DoMercBattleSound( BATTLE_SOUND_COOL1 ); if (gfDisarmingBuriedBomb) - { - if (Object.usItem == SWITCH) + { + if (gTempObject.usItem == SWITCH) { // give the player a remote trigger instead - CreateItem( REMOTEBOMBTRIGGER, (INT8) (1 + Random( 9 )), &Object ); + CreateItem( REMOTEBOMBTRIGGER, (INT8) (1 + Random( 9 )), &gTempObject ); } - else if (Object.usItem == ACTION_ITEM && Object.ItemData.Trigger.bActionValue != ACTION_ITEM_BLOW_UP ) + else if (gTempObject.usItem == ACTION_ITEM && gTempObject[0]->data.misc.bActionValue != ACTION_ITEM_BLOW_UP ) { // give the player a detonator instead - CreateItem( DETONATOR, (INT8) (1 + Random( 9 )), &Object ); + CreateItem( DETONATOR, (INT8) (1 + Random( 9 )), &gTempObject ); } else { // switch action item to the real item type - CreateItem( Object.ItemData.Trigger.usBombItem, Object.ItemData.Trigger.bBombStatus, &Object ); + CreateItem( gTempObject[0]->data.misc.usBombItem, gTempObject[0]->data.misc.bBombStatus, &gTempObject ); } // remove any blue flag graphic @@ -4584,26 +4557,45 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue ) } else { - Object.bTrap = 0; - Object.fFlags &= ~( OBJECT_KNOWN_TO_BE_TRAPPED ); + gTempObject[0]->data.bTrap = 0; + gTempObject.fFlags &= ~( OBJECT_KNOWN_TO_BE_TRAPPED ); } // place it in the guy's inventory/cursor - if ( AutoPlaceObject( gpBoobyTrapSoldier, &Object, TRUE ) ) + if ( AutoPlaceObject( gpBoobyTrapSoldier, &gTempObject, TRUE ) ) { // remove it from the ground RemoveItemFromPool( gsBoobyTrapGridNo, gpBoobyTrapItemPool->iItemIndex, gbBoobyTrapLevel ); } else { - // make sure the item in the world is untrapped - gWorldItems[ gpBoobyTrapItemPool->iItemIndex ].o.bTrap = 0; - gWorldItems[ gpBoobyTrapItemPool->iItemIndex ].o.fFlags &= ~( OBJECT_KNOWN_TO_BE_TRAPPED ); + //CHRISL: because the above AutoPlaceObject may fail due to an item swap, we need a few more checks + // before we assume it's an actual failure. First, compare our tempObject with the pool item and + // see if they're the same object. If the above AutoPlaceObject is a complete fail, they should be + // the same. + if(gWorldItems[gpBoobyTrapItemPool->iItemIndex].object.operator == (gTempObject)) + { + // make sure the item in the world is untrapped + gWorldItems[ gpBoobyTrapItemPool->iItemIndex ].object[0]->data.bTrap = 0; + gWorldItems[ gpBoobyTrapItemPool->iItemIndex ].object.fFlags &= ~( OBJECT_KNOWN_TO_BE_TRAPPED ); - // ATE; If we failed to add to inventory, put failed one in our cursor... - gfDontChargeAPsToPickup = TRUE; - HandleAutoPlaceFail( gpBoobyTrapSoldier, gpBoobyTrapItemPool->iItemIndex, gsBoobyTrapGridNo ); - RemoveItemFromPool( gsBoobyTrapGridNo, gpBoobyTrapItemPool->iItemIndex, gbBoobyTrapLevel ); + // ATE; If we failed to add to inventory, put failed one in our cursor... + gfDontChargeAPsToPickup = TRUE; + HandleAutoPlaceFail( gpBoobyTrapSoldier, gpBoobyTrapItemPool->iItemIndex, gsBoobyTrapGridNo ); + RemoveItemFromPool( gsBoobyTrapGridNo, gpBoobyTrapItemPool->iItemIndex, gbBoobyTrapLevel ); + } + else + { + //We've done an item swap which caused the above AutoPlaceObject failure. Try to place autoplace + // the object again. If we fail, move the temp object to the cursor. + if(!(AutoPlaceObject(gpBoobyTrapSoldier, &gTempObject, TRUE))) + { + gpItemPointer = new OBJECTTYPE; + gTempObject.MoveThisObjectTo(*gpItemPointer,-1,gpBoobyTrapSoldier,NUM_INV_SLOTS,MAX_OBJECTS_PER_SLOT); + } + // remove it from the ground + RemoveItemFromPool( gsBoobyTrapGridNo, gpBoobyTrapItemPool->iItemIndex, gbBoobyTrapLevel ); + } } } else @@ -4611,7 +4603,7 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue ) // oops! trap goes off StatChange( gpBoobyTrapSoldier, EXPLODEAMT, (INT8) (3 * gbTrapDifficulty ), FROM_FAILURE ); - DoMercBattleSound( gpBoobyTrapSoldier, BATTLE_SOUND_CURSE1 ); + gpBoobyTrapSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); if (gfDisarmingBuriedBomb) { @@ -4639,9 +4631,9 @@ void BoobyTrapInMapScreenMessageBoxCallBack( UINT8 ubExitValue ) { // NOW award for finding boobytrap - // WISDOM GAIN: Detected a booby-trap + // WISDOM GAIN: Detected a booby-trap StatChange( gpBoobyTrapSoldier, WISDOMAMT, (UINT16) (3 * gbTrapDifficulty), FALSE ); - // EXPLOSIVES GAIN: Detected a booby-trap + // EXPLOSIVES GAIN: Detected a booby-trap StatChange( gpBoobyTrapSoldier, EXPLODEAMT, (UINT16) (3 * gbTrapDifficulty), FALSE ); gfJustFoundBoobyTrap = FALSE; } @@ -4649,8 +4641,6 @@ void BoobyTrapInMapScreenMessageBoxCallBack( UINT8 ubExitValue ) if (ubExitValue == MSG_BOX_RETURN_YES) { INT32 iCheckResult; - OBJECTTYPE Object; - iCheckResult = SkillCheck( gpBoobyTrapSoldier, DISARM_TRAP_CHECK, 0 ); if (iCheckResult >= 0) @@ -4660,41 +4650,41 @@ void BoobyTrapInMapScreenMessageBoxCallBack( UINT8 ubExitValue ) // have merc say this is good - DoMercBattleSound( gpBoobyTrapSoldier, BATTLE_SOUND_COOL1 ); + gpBoobyTrapSoldier->DoMercBattleSound( BATTLE_SOUND_COOL1 ); - // get the item - memcpy( &Object, gpItemPointer, sizeof( OBJECTTYPE ) ); + // get the item + gTempObject = *gpItemPointer; if (gfDisarmingBuriedBomb) - { - if (Object.usItem == SWITCH) + { + if (gTempObject.usItem == SWITCH) { // give the player a remote trigger instead - CreateItem( REMOTEBOMBTRIGGER, (INT8) (1 + Random( 9 )), &Object ); + CreateItem( REMOTEBOMBTRIGGER, (INT8) (1 + Random( 9 )), &gTempObject ); } - else if (Object.usItem == ACTION_ITEM && Object.ItemData.Trigger.bActionValue != ACTION_ITEM_BLOW_UP ) + else if (gTempObject.usItem == ACTION_ITEM && gTempObject[0]->data.misc.bActionValue != ACTION_ITEM_BLOW_UP ) { // give the player a detonator instead - CreateItem( DETONATOR, (INT8) (1 + Random( 9 )), &Object ); + CreateItem( DETONATOR, (INT8) (1 + Random( 9 )), &gTempObject ); } else { // switch action item to the real item type - CreateItem( Object.ItemData.Trigger.usBombItem, Object.ItemData.Trigger.bBombStatus, &Object ); + CreateItem( gTempObject[0]->data.misc.usBombItem, gTempObject[0]->data.misc.bBombStatus, &gTempObject ); } } else { - Object.bTrap = 0; - Object.fFlags &= ~( OBJECT_KNOWN_TO_BE_TRAPPED ); + gTempObject[0]->data.bTrap = 0; + gTempObject.fFlags &= ~( OBJECT_KNOWN_TO_BE_TRAPPED ); } MAPEndItemPointer( ); // place it in the guy's inventory/cursor - if ( !AutoPlaceObject( gpBoobyTrapSoldier, &Object, TRUE ) ) + if ( !AutoPlaceObject( gpBoobyTrapSoldier, &gTempObject, TRUE ) ) { - AutoPlaceObjectInInventoryStash( &Object ); + AutoPlaceObjectInInventoryStash( &gTempObject ); } HandleButtonStatesWhileMapInventoryActive( ); @@ -4704,7 +4694,7 @@ void BoobyTrapInMapScreenMessageBoxCallBack( UINT8 ubExitValue ) // oops! trap goes off StatChange( gpBoobyTrapSoldier, EXPLODEAMT, (INT8) (3 * gbTrapDifficulty ), FROM_FAILURE ); - DoMercBattleSound( gpBoobyTrapSoldier, BATTLE_SOUND_CURSE1 ); + gpBoobyTrapSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); if (gfDisarmingBuriedBomb) { @@ -4733,9 +4723,9 @@ void SwitchMessageBoxCallBack( UINT8 ubExitValue ) if ( ubExitValue == MSG_BOX_RETURN_YES ) { // Message that switch is activated... - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 60 ] ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 60 ] ); - SetOffBombsByFrequency( gpTempSoldier->ubID, bTempFrequency ); + SetOffBombsByFrequency( gpTempSoldier->ubID, bTempFrequency ); } } @@ -4754,7 +4744,7 @@ BOOLEAN NearbyGroundSeemsWrong( SOLDIERTYPE * pSoldier, INT16 sGridNo, BOOLEAN f ubDetectLevel = 0; - if ( FindMetalDetector( pSoldier ) != NO_SLOT ) + if ( FindMetalDetector( pSoldier ) != NO_SLOT ) { fMining = TRUE; } @@ -4802,7 +4792,7 @@ BOOLEAN NearbyGroundSeemsWrong( SOLDIERTYPE * pSoldier, INT16 sGridNo, BOOLEAN f sNextGridNo = NewGridNo( sGridNo, (INT16) DirectionInc( (UINT8) ubDirection ) ); // don't check directions that are impassable! - ubMovementCost = gubWorldMovementCosts[ sNextGridNo ][ ubDirection ][ pSoldier->bLevel ]; + ubMovementCost = gubWorldMovementCosts[ sNextGridNo ][ ubDirection ][ pSoldier->pathing.bLevel ]; if ( IS_TRAVELCOST_DOOR( ubMovementCost ) ) { ubMovementCost = DoorTravelCost( NULL, sNextGridNo, ubMovementCost, FALSE, NULL ); @@ -4814,7 +4804,7 @@ BOOLEAN NearbyGroundSeemsWrong( SOLDIERTYPE * pSoldier, INT16 sGridNo, BOOLEAN f } else { - // we should just be checking the gridno + // we should just be checking the gridno sNextGridNo = sGridNo; ubDirection = 8; // don't loop } @@ -4833,26 +4823,26 @@ BOOLEAN NearbyGroundSeemsWrong( SOLDIERTYPE * pSoldier, INT16 sGridNo, BOOLEAN f { if (gWorldBombs[uiWorldBombIndex].fExists && gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].sGridNo == sNextGridNo) { - pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o ); - if ( pObj->ItemData.Trigger.bDetonatorType == BOMB_PRESSURE && !(pObj->fFlags & OBJECT_KNOWN_TO_BE_TRAPPED) && (!(pObj->fFlags & OBJECT_DISABLED_BOMB)) ) + pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].object ); + if ( (*pObj)[0]->data.misc.bDetonatorType == BOMB_PRESSURE && !((*pObj).fFlags & OBJECT_KNOWN_TO_BE_TRAPPED) && (!((*pObj).fFlags & OBJECT_DISABLED_BOMB)) ) { - if ( fMining && pObj->bTrap <= 10 ) + if ( fMining && (*pObj)[0]->data.bTrap <= 10 ) { // add blue flag - AddBlueFlag( sNextGridNo, pSoldier->bLevel ); + AddBlueFlag( sNextGridNo, pSoldier->pathing.bLevel ); fFoundMetal = TRUE; break; } - else if (ubDetectLevel >= pObj->bTrap) + else if (ubDetectLevel >= (*pObj)[0]->data.bTrap) { - if (pSoldier->uiStatusFlags & SOLDIER_PC ) + if (pSoldier->flags.uiStatusFlags & SOLDIER_PC ) { // detected exposives buried nearby... - StatChange( pSoldier, EXPLODEAMT, (UINT16) (pObj->bTrap), FALSE ); - StatChange( pSoldier, WISDOMAMT, (UINT16) (pObj->bTrap), FALSE ); + StatChange( pSoldier, EXPLODEAMT, (UINT16) ((*pObj)[0]->data.bTrap), FALSE ); + StatChange( pSoldier, WISDOMAMT, (UINT16) ((*pObj)[0]->data.bTrap), FALSE ); // set item as known - pObj->fFlags |= OBJECT_KNOWN_TO_BE_TRAPPED; + (*pObj).fFlags |= OBJECT_KNOWN_TO_BE_TRAPPED; } *psProblemGridNo = sNextGridNo; @@ -4867,21 +4857,21 @@ BOOLEAN NearbyGroundSeemsWrong( SOLDIERTYPE * pSoldier, INT16 sGridNo, BOOLEAN f if (fMining) { // add blue flags where we find metallic objects hidden - GetItemPool( sNextGridNo, &pItemPool, pSoldier->bLevel ); + GetItemPool( sNextGridNo, &pItemPool, pSoldier->pathing.bLevel ); while( pItemPool ) { - if ( pItemPool->bVisible == BURIED || (pItemPool->bVisible != TRUE && gWorldItems[ pItemPool->iItemIndex ].o.bTrap > 0 ) ) + if ( pItemPool->bVisible == BURIED || (pItemPool->bVisible != TRUE && gWorldItems[ pItemPool->iItemIndex ].object.bTrap > 0 ) ) { - pObj = &( gWorldItems[ pItemPool->iItemIndex ].o ); - if ( pObj->usItem == ACTION_ITEM && pObj-> ) + pObj = &( gWorldItems[ pItemPool->iItemIndex ].object ); + if ( pObj->usItem == ACTION_ITEM && pObj->) { - switch( pObj->bActionValue ) + switch( (*pObj)[0]->data.misc.bActionValue ) { case ACTION_ITEM_BLOW_UP: case ACTION_ITEM_LOCAL_ALARM: case ACTION_ITEM_GLOBAL_ALARM: // add blue flag - AddBlueFlag( sNextGridNo, pSoldier->bLevel ); + AddBlueFlag( sNextGridNo, pSoldier->pathing.bLevel ); fFoundMetal = TRUE; break; default: @@ -4892,7 +4882,7 @@ BOOLEAN NearbyGroundSeemsWrong( SOLDIERTYPE * pSoldier, INT16 sGridNo, BOOLEAN f else if (Item[ pObj->usItem ].fFlags & ITEM_METAL) { // add blue flag - AddBlueFlag( sNextGridNo, pSoldier->bLevel ); + AddBlueFlag( sNextGridNo, pSoldier->pathing.bLevel ); fFoundMetal = TRUE; break; } @@ -5025,15 +5015,15 @@ void MakeNPCGrumpyForMinorOffense( SOLDIERTYPE * pSoldier, SOLDIERTYPE *pOffendi if ( pOffendingSoldier ) { - pSoldier->bNextAction = AI_ACTION_CHANGE_FACING; - pSoldier->usNextActionData = atan8( pSoldier->sX, pSoldier->sY, pOffendingSoldier->sX, pOffendingSoldier->sY ); + pSoldier->aiData.bNextAction = AI_ACTION_CHANGE_FACING; + pSoldier->aiData.usNextActionData = atan8( pSoldier->sX, pSoldier->sY, pOffendingSoldier->sX, pOffendingSoldier->sY ); } } void TestPotentialOwner( SOLDIERTYPE * pSoldier ) { - if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife >= OKLIFE ) + if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE ) { if ( SoldierToSoldierLineOfSightTest( pSoldier, gpTempSoldier, TRUE, CALC_FROM_ALL_DIRS ) ) { @@ -5051,24 +5041,24 @@ void CheckForPickedOwnership( void ) UINT8 ubLoop; // LOOP THROUGH LIST TO FIND NODE WE WANT - GetItemPool( gsTempGridno, &pItemPool, gpTempSoldier->bLevel ); + GetItemPool( gsTempGridno, &pItemPool, gpTempSoldier->pathing.bLevel ); while( pItemPool ) { - if ( gWorldItems[ pItemPool->iItemIndex ].o.usItem == OWNERSHIP ) + if ( gWorldItems[ pItemPool->iItemIndex ].object.usItem == OWNERSHIP ) { - if ( gWorldItems[ pItemPool->iItemIndex ].o.ItemData.Owner.ubOwnerProfile != NO_PROFILE ) + if ( gWorldItems[ pItemPool->iItemIndex ].object[0]->data.owner.ubOwnerProfile != NO_PROFILE ) { - ubProfile = gWorldItems[ pItemPool->iItemIndex ].o.ItemData.Owner.ubOwnerProfile; + ubProfile = (UINT8) gWorldItems[ pItemPool->iItemIndex ].object[0]->data.owner.ubOwnerProfile; pSoldier = FindSoldierByProfileID( ubProfile, FALSE ); if ( pSoldier ) { TestPotentialOwner( pSoldier ); } } - if ( gWorldItems[ pItemPool->iItemIndex ].o.ItemData.Owner.ubOwnerCivGroup != NON_CIV_GROUP ) + if ( gWorldItems[ pItemPool->iItemIndex ].object[0]->data.owner.ubOwnerCivGroup != NON_CIV_GROUP ) { - ubCivGroup = gWorldItems[ pItemPool->iItemIndex ].o.ItemData.Owner.ubOwnerCivGroup; + ubCivGroup = gWorldItems[ pItemPool->iItemIndex ].object[0]->data.owner.ubOwnerCivGroup; if ( ubCivGroup == HICKS_CIV_GROUP && CheckFact( FACT_HICKS_MARRIED_PLAYER_MERC, 0 ) ) { // skip because hicks appeased @@ -5119,7 +5109,7 @@ void HandleItemGlowFlag( INT16 sGridNo, UINT8 ubLevel, BOOLEAN fOn ) if ( ubLevel == 0 ) { pNode = gpWorldLevelData[ sGridNo ].pStructHead; - LoopLevelNodeForItemGlowFlag( pNode, sGridNo, ubLevel, fOn ); + LoopLevelNodeForItemGlowFlag( pNode, sGridNo, ubLevel, fOn ); } else { @@ -5155,23 +5145,23 @@ BOOLEAN ContinuePastBoobyTrapInMapScreen( OBJECTTYPE *pObject, SOLDIERTYPE *pSol BOOLEAN fBoobyTrapKnowledge; INT8 bTrapDifficulty, bTrapDetectLevel; - if (pObject->bTrap > 0) + if ((*pObject)[0]->data.bTrap > 0) { if (pSoldier->bTeam == gbPlayerNum) { // does the player know about this item? - fBoobyTrapKnowledge = ((pObject->fFlags & OBJECT_KNOWN_TO_BE_TRAPPED) > 0); + fBoobyTrapKnowledge = (((*pObject).fFlags & OBJECT_KNOWN_TO_BE_TRAPPED) > 0); // blue flag stuff? if (!fBoobyTrapKnowledge) { - bTrapDifficulty = pObject->bTrap; + bTrapDifficulty = (*pObject)[0]->data.bTrap; bTrapDetectLevel = CalcTrapDetectLevel( pSoldier, FALSE ); if (bTrapDetectLevel >= bTrapDifficulty) { // spotted the trap! - pObject->fFlags |= OBJECT_KNOWN_TO_BE_TRAPPED; + (*pObject).fFlags |= OBJECT_KNOWN_TO_BE_TRAPPED; fBoobyTrapKnowledge = TRUE; // Make him warn us: @@ -5189,8 +5179,8 @@ BOOLEAN ContinuePastBoobyTrapInMapScreen( OBJECTTYPE *pObject, SOLDIERTYPE *pSol { // have the computer ask us if we want to proceed gpBoobyTrapSoldier = pSoldier; - gbTrapDifficulty = pObject->bTrap; - DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ DISARM_BOOBYTRAP_PROMPT ], MAP_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, BoobyTrapInMapScreenMessageBoxCallBack, NULL ); + gbTrapDifficulty = (*pObject)[0]->data.bTrap; + DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ DISARM_BOOBYTRAP_PROMPT ], MAP_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, BoobyTrapInMapScreenMessageBoxCallBack, NULL ); } else { @@ -5225,15 +5215,15 @@ void RefreshItemPools( WORLDITEM * pItemList, INT32 iNumberOfItems ) { ClearAllItemPools( ); - RefreshWorldItemsIntoItemPools( pItemList, iNumberOfItems ); + RefreshWorldItemsIntoItemPools( pItemList, iNumberOfItems ); } INT16 FindNearestAvailableGridNoForItem( INT16 sSweetGridNo, INT8 ubRadius ) { - INT16 sTop, sBottom; - INT16 sLeft, sRight; - INT16 cnt1, cnt2, cnt3; + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2, cnt3; INT16 sGridNo; INT32 uiRange, uiLowestRange = 999999; INT16 sLowestGridNo=0; @@ -5242,11 +5232,10 @@ INT16 FindNearestAvailableGridNoForItem( INT16 sSweetGridNo, INT8 ubRadius ) SOLDIERTYPE soldier; UINT8 ubSaveNPCAPBudget; UINT8 ubSaveNPCDistLimit; - BOOLEAN fSetDirection = FALSE; cnt3 = 0; - //Save AI pathing vars. changing the distlimit restricts how + //Save AI pathing vars. changing the distlimit restricts how //far away the pathing will consider. ubSaveNPCAPBudget = gubNPCAPBudget; ubSaveNPCDistLimit = gubNPCDistLimit; @@ -5255,16 +5244,13 @@ 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 - //memset( &soldier, 0, SIZEOF_SOLDIERTYPE ); - soldier.initialize(); soldier.bTeam = 1; soldier.sGridNo = sSweetGridNo; sTop = ubRadius; sBottom = -ubRadius; - sLeft = - ubRadius; - sRight = ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; //clear the mapelements of potential residue MAPELEMENT_REACHABLE flags //in the square region. @@ -5280,11 +5266,11 @@ INT16 FindNearestAvailableGridNoForItem( INT16 sSweetGridNo, INT8 ubRadius ) } } - //Now, find out which of these gridnos are reachable + //Now, find out which of these gridnos are reachable //(use the fake soldier and the pathing settings) FindBestPath( &soldier, NOWHERE, 0, WALKING, COPYREACHABLE, 0 ); - uiLowestRange = 999999; + uiLowestRange = 999999; for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) { @@ -5297,7 +5283,7 @@ INT16 FindNearestAvailableGridNoForItem( INT16 sSweetGridNo, INT8 ubRadius ) gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE ) { // Go on sweet stop - if ( NewOKDestination( &soldier, sGridNo, TRUE, soldier.bLevel ) ) + if ( NewOKDestination( &soldier, sGridNo, TRUE, soldier.pathing.bLevel ) ) { uiRange = GetRangeInCellCoordsFromGridNoDiff( sSweetGridNo, sGridNo ); @@ -5330,10 +5316,10 @@ BOOLEAN CanPlayerUseRocketRifle( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay ) // imprinted value is profile for mercs & NPCs and NO_PROFILE + 1 for generic dudes if (pSoldier->ubProfile != NO_PROFILE) { - if ( pSoldier->inv[ pSoldier->ubAttackingHand ].ubImprintID != pSoldier->ubProfile ) + if ( pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.ubImprintID != pSoldier->ubProfile ) { // NOT a virgin gun... - if ( pSoldier->inv[ pSoldier->ubAttackingHand ].ubImprintID != NO_PROFILE ) + if ( pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.ubImprintID != NO_PROFILE ) { // access denied! if (pSoldier->bTeam == gbPlayerNum) @@ -5354,7 +5340,7 @@ BOOLEAN CanPlayerUseRocketRifle( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay ) } /** -* jackaians: pretty bad function. Create an artificial ItemPool, where +* jackaians: pretty bad function. Create an artificial ItemPool, where * iItemIndex is not the index in the world, but is used to store the index * of the opponent's slots. * if only one item, return in ubIndexRet the item's index @@ -5362,23 +5348,22 @@ BOOLEAN CanPlayerUseRocketRifle( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay ) UINT8 StealItems(SOLDIERTYPE* pSoldier,SOLDIERTYPE* pOpponent, UINT8* ubIndexRet) { UINT8 ubCount=0; - ITEM_POOL *pItemPool,*pTempItemPool,*pTempLastItemPool = NULL; - OBJECTTYPE *pObject; + ITEM_POOL *pItemPool,*pTempItemPool,*pTempLastItemPool = 0; + OBJECTTYPE *pObject; UINT8 i; BOOLEAN fStealItem = FALSE; //Create a temporary item pool, with index in Opponent's inventory as index pItemPool=NULL; - for(i=0 ; iinv.size(); i++) { fStealItem = FALSE; - // WDS - Clean up inventory handling pObject=&pOpponent->inv[i]; - if (pObject->usItem!=0) + if (pObject->exists() == true) { // Is the enemy collapsed - if ( pOpponent->bLife < OKLIFE || pOpponent->bCollapsed ) + if ( pOpponent->stats.bLife < OKLIFE || pOpponent->bCollapsed ) { // We can steal any of his items in the inventory fStealItem = TRUE; @@ -5386,22 +5371,54 @@ UINT8 StealItems(SOLDIERTYPE* pSoldier,SOLDIERTYPE* pOpponent, UINT8* ubIndexRet else { // Check, if we can steal the item + // CHRISL: Added new case definitions for new inventory pockets switch (i) { - case HANDPOS: - case SECONDHANDPOS: - case BIGPOCK1POS: - case BIGPOCK2POS: - case BIGPOCK3POS: - case BIGPOCK4POS: - case SMALLPOCK1POS: - case SMALLPOCK2POS: - case SMALLPOCK3POS: - case SMALLPOCK4POS: - case SMALLPOCK5POS: - case SMALLPOCK6POS: - case SMALLPOCK7POS: - case SMALLPOCK8POS: + case HANDPOS: + case SECONDHANDPOS: + case GUNSLINGPOCKPOS: + case KNIFEPOCKPOS: + case BIGPOCK1POS: + case BIGPOCK2POS: + case BIGPOCK3POS: + case BIGPOCK4POS: + case BIGPOCK5POS: + case BIGPOCK6POS: + case BIGPOCK7POS: + case MEDPOCK1POS: + case MEDPOCK2POS: + case MEDPOCK3POS: + case MEDPOCK4POS: + case SMALLPOCK1POS: + case SMALLPOCK2POS: + case SMALLPOCK3POS: + case SMALLPOCK4POS: + case SMALLPOCK5POS: + case SMALLPOCK6POS: + case SMALLPOCK7POS: + case SMALLPOCK8POS: + case SMALLPOCK9POS: + case SMALLPOCK10POS: + case SMALLPOCK11POS: + case SMALLPOCK12POS: + case SMALLPOCK13POS: + case SMALLPOCK14POS: + case SMALLPOCK15POS: + case SMALLPOCK16POS: + case SMALLPOCK17POS: + case SMALLPOCK18POS: + case SMALLPOCK19POS: + case SMALLPOCK20POS: + case SMALLPOCK21POS: + case SMALLPOCK22POS: + case SMALLPOCK23POS: + case SMALLPOCK24POS: + case SMALLPOCK25POS: + case SMALLPOCK26POS: + case SMALLPOCK27POS: + case SMALLPOCK28POS: + case SMALLPOCK29POS: + case SMALLPOCK30POS: fStealItem = TRUE; break; default: @@ -5434,7 +5451,7 @@ UINT8 StealItems(SOLDIERTYPE* pSoldier,SOLDIERTYPE* pOpponent, UINT8* ubIndexRet } if (ubCount == 0) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_NOTHING ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_NOTHING ); return( 0); } @@ -5447,11 +5464,11 @@ UINT8 StealItems(SOLDIERTYPE* pSoldier,SOLDIERTYPE* pOpponent, UINT8* ubIndexRet } // Freeze guy! - pSoldier->fPauseAllAnimation = TRUE; + pSoldier->flags.fPauseAllAnimation = TRUE; InitializeStealItemPickupMenu( pSoldier, pOpponent, pItemPool, ubCount); guiPendingOverrideEvent = G_GETTINGITEM; - HandleTacticalUI(); // 0verhaul: Added to keep this event from going out of style before it is acted on + HandleTacticalUI(); // 0verhaul: Added to keep this event from going out of style before it is acted on return( ubCount ); } @@ -5463,10 +5480,8 @@ UINT8 StealItems(SOLDIERTYPE* pSoldier,SOLDIERTYPE* pOpponent, UINT8* ubIndexRet void SoldierStealItemFromSoldier( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent,ITEM_POOL *pItemPool, INT32 iItemIndex, INT16 sGridNo, INT8 bZLevel, BOOLEAN *pfSelectionList ) { ITEM_POOL *pTempItemPool; - OBJECTTYPE Object; INT32 cnt = 0; BOOLEAN fPickup; - BOOLEAN fFailedAutoPlace = FALSE; BOOLEAN fShouldSayCoolQuote = FALSE; BOOLEAN fDidSayCoolQuote = FALSE; @@ -5489,17 +5504,15 @@ void SoldierStealItemFromSoldier( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, cnt++; if ( fPickup ) { - // WDS - Clean up inventory handling // Make copy of item - // memcpy( &Object, pOpponent->inv+pTempItemPool->iItemIndex, sizeof( OBJECTTYPE ) ); - Object = pOpponent->inv[pTempItemPool->iItemIndex]; - if ( ItemIsCool( &Object ) ) + gTempObject = pOpponent->inv[pTempItemPool->iItemIndex]; + if ( ItemIsCool( &gTempObject ) ) { fShouldSayCoolQuote = TRUE; } - if ( !AutoPlaceObject( pSoldier, &Object, TRUE ) ) + if ( !AutoPlaceObject( pSoldier, &gTempObject, TRUE ) ) { - AddItemToPool( pSoldier->sGridNo, &Object, 1, pSoldier->bLevel, 0, -1 ); + AddItemToPool( pSoldier->sGridNo, &gTempObject, 1, pSoldier->pathing.bLevel, 0, -1 ); } DeleteObj(&pOpponent->inv[pTempItemPool->iItemIndex]); } @@ -5527,7 +5540,7 @@ void SoldierStealItemFromSoldier( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, // Aknowledge.... if( pSoldier->bTeam == OUR_TEAM && !fDidSayCoolQuote ) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_GOTIT ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_GOTIT ); } gpTempSoldier = pSoldier; gsTempGridno = sGridNo; diff --git a/Tactical/Handle Items.h b/Tactical/Handle Items.h index 65bf5e03..48725607 100644 --- a/Tactical/Handle Items.h +++ b/Tactical/Handle Items.h @@ -28,14 +28,14 @@ #define ITEMLIST_HANDLE_SELECTION 5 // visibility defines -#define ANY_VISIBILITY_VALUE -10 +#define ANY_VISIBILITY_VALUE -10 #define HIDDEN_ITEM -4 #define BURIED -3 #define HIDDEN_IN_OBJECT -2 #define INVISIBLE -1 #define VISIBLE 1 -#define ITEM_LOCATOR_DELAY 0x01 +#define ITEM_LOCATOR_DELAY 0x01 #define ITEM_LOCATOR_LOCKED 0x02 @@ -46,8 +46,7 @@ typedef void ( *ITEM_POOL_LOCATOR_HOOK )( void ); -// WDS - Clean up inventory handling -struct WORLDITEM; +class WORLDITEM; struct LEVELNODE; typedef struct TAG_ITEM_POOL @@ -80,7 +79,6 @@ typedef struct } ITEM_POOL_LOCATOR; -// WDS - Clean up inventory handling class SOLDIERTYPE; INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHandItem, BOOLEAN fFromUI ); void SoldierPickupItem( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGridNo, INT8 bZLevel ); @@ -101,12 +99,13 @@ void AllSoldiersLookforItems( BOOLEAN RevealRoofsAndItems ); void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGridNo, INT8 bZLevel, BOOLEAN *pfSelectionList ); -OBJECTTYPE* AddItemToPool( INT16 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel ); -OBJECTTYPE* AddItemToPoolAndGetIndex( INT16 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT32 * piItemIndex ); -OBJECTTYPE* InternalAddItemToPool( INT16 *psGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT32 * piItemIndex ); +OBJECTTYPE* AddItemToPool( INT16 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 soldierID = -1 ); +OBJECTTYPE* AddItemToPoolAndGetIndex( INT16 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 soldierID, INT32 * piItemIndex ); +OBJECTTYPE* InternalAddItemToPool( INT16 *psGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 soldierID, INT32 * piItemIndex ); INT16 AdjustGridNoForItemPlacement( SOLDIERTYPE *pSoldier, INT16 sGridNo ); -BOOLEAN GetItemPool( UINT16 usMapPos, ITEM_POOL **ppItemPool, UINT8 ubLevel ); +BOOLEAN GetItemPool( INT16 sMapPos, ITEM_POOL **ppItemPool, UINT8 ubLevel ); +BOOLEAN GetItemPoolFromGround( INT16 sMapPos, ITEM_POOL **ppItemPool ); BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT16 sGridNo, UINT8 bCommand, INT8 bZLevel, INT16 sXPos, INT16 sYPos ); BOOLEAN RemoveItemFromPool( INT16 sGridNo, INT32 iItemIndex, UINT8 ubLevel ); BOOLEAN ItemExistsAtLocation( INT16 sGridNo, INT32 iItemIndex, UINT8 ubLevel ); @@ -134,9 +133,6 @@ BOOLEAN DoesItemPoolContainAllHiddenItems( ITEM_POOL *pItemPool ); void HandleSoldierDropBomb( SOLDIERTYPE *pSoldier, INT16 sGridNo ); void HandleSoldierUseRemote( SOLDIERTYPE *pSoldier, INT16 sGridNo ); -BOOLEAN DoesItemPoolContainAllItemsOfZeroZLevel( ITEM_POOL *pItemPool ); -BOOLEAN DoesItemPoolContainAllItemsOfHigherZLevel( ITEM_POOL *pItemPool ); - BOOLEAN ItemPoolOKForDisplay( ITEM_POOL *pItemPool, INT8 bZLevel ); INT16 GetNumOkForDisplayItemsInPool( ITEM_POOL *pItemPool, INT8 bZLevel ); @@ -154,7 +150,7 @@ void MineSpottedDialogueCallBack( void ); extern INT16 gsBoobyTrapGridNo; extern SOLDIERTYPE * gpBoobyTrapSoldier; void AddBlueFlag( INT16 sGridNo, INT8 bLevel ); -void RemoveBlueFlag( INT16 sGridNo, INT8 bLevel ); +void RemoveBlueFlag( INT16 sGridNo, INT8 bLevel ); // check if item is booby trapped BOOLEAN ContinuePastBoobyTrapInMapScreen( OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier ); diff --git a/Tactical/Handle UI Plan.cpp b/Tactical/Handle UI Plan.cpp index 5f49e424..9af0ad42 100644 --- a/Tactical/Handle UI Plan.cpp +++ b/Tactical/Handle UI Plan.cpp @@ -16,9 +16,9 @@ #endif UINT8 gubNumUIPlannedMoves = 0; -SOLDIERTYPE *gpUIPlannedSoldier = NULL; +SOLDIERTYPE *gpUIPlannedSoldier = NULL; SOLDIERTYPE *gpUIStartPlannedSoldier = NULL; -BOOLEAN gfInUIPlanMode = FALSE; +BOOLEAN gfInUIPlanMode = FALSE; void SelectPausedFireAnimation( SOLDIERTYPE *pSoldier ); @@ -29,16 +29,16 @@ BOOLEAN BeginUIPlan( SOLDIERTYPE *pSoldier ) gubNumUIPlannedMoves = 0; gpUIPlannedSoldier = pSoldier; gpUIStartPlannedSoldier = pSoldier; - gfInUIPlanMode = TRUE; + gfInUIPlanMode = TRUE; - gfPlotNewMovement = TRUE; + gfPlotNewMovement = TRUE; ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Entering Planning Mode" ); return( TRUE ); } -BOOLEAN AddUIPlan( UINT16 sGridNo, UINT8 ubPlanID ) +BOOLEAN AddUIPlan( INT16 sGridNo, UINT8 ubPlanID ) { SOLDIERTYPE *pPlanSoldier; INT16 sXPos, sYPos; @@ -49,7 +49,7 @@ BOOLEAN AddUIPlan( UINT16 sGridNo, UINT8 ubPlanID ) UINT8 ubNewIndex; // Depeding on stance and direction facing, add guy! - + // If we have a planned action here, ignore! @@ -63,16 +63,16 @@ BOOLEAN AddUIPlan( UINT16 sGridNo, UINT8 ubPlanID ) if ( ubPlanID == UIPLAN_ACTION_MOVETO ) { // Calculate cost to move here - sAPCost = PlotPath( gpUIPlannedSoldier, sGridNo, COPYROUTE, NO_PLOT, TEMPORARY, (UINT16) gpUIPlannedSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, gpUIPlannedSoldier->bActionPoints ); + sAPCost = PlotPath( gpUIPlannedSoldier, sGridNo, COPYROUTE, NO_PLOT, TEMPORARY, (UINT16) gpUIPlannedSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, gpUIPlannedSoldier->bActionPoints ); // Adjust for running if we are not already running - if ( gpUIPlannedSoldier->usUIMovementMode == RUNNING ) + if ( gpUIPlannedSoldier->usUIMovementMode == RUNNING ) { sAPCost += AP_START_RUN_COST; } if ( EnoughPoints( gpUIPlannedSoldier, sAPCost, 0, FALSE ) ) { - memset( &MercCreateStruct, 0, sizeof( MercCreateStruct ) ); + MercCreateStruct.initialize(); MercCreateStruct.bTeam = SOLDIER_CREATE_AUTO_TEAM; MercCreateStruct.ubProfile = NO_PROFILE; MercCreateStruct.fPlayerPlan = TRUE; @@ -81,7 +81,7 @@ BOOLEAN AddUIPlan( UINT16 sGridNo, UINT8 ubPlanID ) // Get Grid Corrdinates of mouse if ( TacticalCreateSoldier( &MercCreateStruct, &ubNewIndex ) ) - { + { // Get pointer to soldier GetSoldier( &pPlanSoldier, (UINT16)ubNewIndex ); @@ -92,17 +92,17 @@ BOOLEAN AddUIPlan( UINT16 sGridNo, UINT8 ubPlanID ) // Set ones we don't know about but do now back to old ( ie no new guys ) for (iLoop = 0; iLoop < MAX_NUM_SOLDIERS; iLoop++ ) { - if ( gpUIPlannedSoldier->bOppList[ iLoop ] < 0 ) + if ( gpUIPlannedSoldier->aiData.bOppList[ iLoop ] < 0 ) { - pPlanSoldier->bOppList[ iLoop ] = gpUIPlannedSoldier->bOppList[ iLoop ]; + pPlanSoldier->aiData.bOppList[ iLoop ] = gpUIPlannedSoldier->aiData.bOppList[ iLoop ]; } } // Get XY from Gridno ConvertGridNoToCenterCellXY( sGridNo, &sXPos, &sYPos ); - EVENT_SetSoldierPosition( pPlanSoldier, sXPos, sYPos ); - EVENT_SetSoldierDestination( pPlanSoldier, (UINT8) sGridNo ); // Hopefully this code is never used anymore because the second param is now direction, not grid + pPlanSoldier->EVENT_SetSoldierPosition( sXPos, sYPos ); + pPlanSoldier->EVENT_SetSoldierDestination( (UINT8) sGridNo ); // Hopefully this code is never used anymore because the second param is now direction, not grid pPlanSoldier->bVisible = 1; pPlanSoldier->usUIMovementMode = gpUIPlannedSoldier->usUIMovementMode; @@ -112,15 +112,15 @@ BOOLEAN AddUIPlan( UINT16 sGridNo, UINT8 ubPlanID ) pPlanSoldier->ubPlannedUIAPCost = (UINT8)pPlanSoldier->bActionPoints; // Get direction - bDirection = (INT8)gpUIPlannedSoldier->usPathingData[ gpUIPlannedSoldier->usPathDataSize - 1 ]; + bDirection = (INT8)gpUIPlannedSoldier->pathing.usPathingData[ gpUIPlannedSoldier->pathing.usPathDataSize - 1 ]; // Set direction pPlanSoldier->ubDirection = bDirection; - pPlanSoldier->bDesiredDirection = bDirection; + pPlanSoldier->pathing.bDesiredDirection = bDirection; // Set walking animation - ChangeSoldierState( pPlanSoldier, pPlanSoldier->usUIMovementMode, 0, FALSE ); - + pPlanSoldier->ChangeSoldierState( pPlanSoldier->usUIMovementMode, 0, FALSE ); + // Change selected soldier gusSelectedSoldier = (UINT16)pPlanSoldier->ubID; @@ -129,7 +129,7 @@ BOOLEAN AddUIPlan( UINT16 sGridNo, UINT8 ubPlanID ) gubNumUIPlannedMoves++; - gfPlotNewMovement = TRUE; + gfPlotNewMovement = TRUE; ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Adding Merc Move to Plan" ); @@ -142,7 +142,7 @@ BOOLEAN AddUIPlan( UINT16 sGridNo, UINT8 ubPlanID ) } else if ( ubPlanID == UIPLAN_ACTION_FIRE ) { - sAPCost = CalcTotalAPsToAttack( gpUIPlannedSoldier, sGridNo, TRUE, (INT8)(gpUIPlannedSoldier->bShownAimTime ) ); + sAPCost = CalcTotalAPsToAttack( gpUIPlannedSoldier, sGridNo, TRUE, (INT8)(gpUIPlannedSoldier->aiData.bShownAimTime ) ); // Get XY from Gridno ConvertGridNoToCenterCellXY( sGridNo, &sXPos, &sYPos ); @@ -154,7 +154,7 @@ BOOLEAN AddUIPlan( UINT16 sGridNo, UINT8 ubPlanID ) // CHECK IF WE ARE A PLANNED SOLDIER OR NOT< IF SO< CREATE! if ( gpUIPlannedSoldier->ubID < MAX_NUM_SOLDIERS ) { - memset( &MercCreateStruct, 0, sizeof( MercCreateStruct ) ); + MercCreateStruct.initialize(); MercCreateStruct.bTeam = SOLDIER_CREATE_AUTO_TEAM; MercCreateStruct.ubProfile = NO_PROFILE; MercCreateStruct.fPlayerPlan = TRUE; @@ -163,7 +163,7 @@ BOOLEAN AddUIPlan( UINT16 sGridNo, UINT8 ubPlanID ) // Get Grid Corrdinates of mouse if ( TacticalCreateSoldier( &MercCreateStruct, &ubNewIndex ) ) - { + { // Get pointer to soldier GetSoldier( &pPlanSoldier, (UINT16)ubNewIndex ); @@ -174,14 +174,14 @@ BOOLEAN AddUIPlan( UINT16 sGridNo, UINT8 ubPlanID ) // Set ones we don't know about but do now back to old ( ie no new guys ) for (iLoop = 0; iLoop < MAX_NUM_SOLDIERS; iLoop++ ) { - if ( gpUIPlannedSoldier->bOppList[ iLoop ] < 0 ) + if ( gpUIPlannedSoldier->aiData.bOppList[ iLoop ] < 0 ) { - pPlanSoldier->bOppList[ iLoop ] = gpUIPlannedSoldier->bOppList[ iLoop ]; + pPlanSoldier->aiData.bOppList[ iLoop ] = gpUIPlannedSoldier->aiData.bOppList[ iLoop ]; } } - EVENT_SetSoldierPosition( pPlanSoldier, gpUIPlannedSoldier->dXPos, gpUIPlannedSoldier->dYPos ); - EVENT_SetSoldierDestination( pPlanSoldier, (UINT8) gpUIPlannedSoldier->sGridNo ); + pPlanSoldier->EVENT_SetSoldierPosition( gpUIPlannedSoldier->dXPos, gpUIPlannedSoldier->dYPos ); + pPlanSoldier->EVENT_SetSoldierDestination( (UINT8) gpUIPlannedSoldier->sGridNo ); pPlanSoldier->bVisible = 1; pPlanSoldier->usUIMovementMode = gpUIPlannedSoldier->usUIMovementMode; @@ -191,15 +191,15 @@ BOOLEAN AddUIPlan( UINT16 sGridNo, UINT8 ubPlanID ) pPlanSoldier->ubPlannedUIAPCost = (UINT8)pPlanSoldier->bActionPoints; // Get direction - bDirection = (INT8)gpUIPlannedSoldier->usPathingData[ gpUIPlannedSoldier->usPathDataSize - 1 ]; + bDirection = (INT8)gpUIPlannedSoldier->pathing.usPathingData[ gpUIPlannedSoldier->pathing.usPathDataSize - 1 ]; // Set direction pPlanSoldier->ubDirection = bDirection; - pPlanSoldier->bDesiredDirection = bDirection; + pPlanSoldier->pathing.bDesiredDirection = bDirection; // Set walking animation - ChangeSoldierState( pPlanSoldier, pPlanSoldier->usUIMovementMode, 0, FALSE ); - + pPlanSoldier->ChangeSoldierState( pPlanSoldier->usUIMovementMode, 0, FALSE ); + // Change selected soldier gusSelectedSoldier = (UINT16)pPlanSoldier->ubID; @@ -217,11 +217,11 @@ BOOLEAN AddUIPlan( UINT16 sGridNo, UINT8 ubPlanID ) gpUIPlannedSoldier->ubPlannedUIAPCost = (UINT8)gpUIPlannedSoldier->bActionPoints; // Get direction from gridno - bDirection = (INT8)GetDirectionFromGridNo( sGridNo, gpUIPlannedSoldier ); + bDirection = GetDirectionFromGridNo( sGridNo, gpUIPlannedSoldier ); // Set direction gpUIPlannedSoldier->ubDirection = bDirection; - gpUIPlannedSoldier->bDesiredDirection = bDirection; + gpUIPlannedSoldier->pathing.bDesiredDirection = bDirection; // Set to shooting animation SelectPausedFireAnimation( gpUIPlannedSoldier ); @@ -241,7 +241,7 @@ BOOLEAN AddUIPlan( UINT16 sGridNo, UINT8 ubPlanID ) } -void EndUIPlan( ) +void EndUIPlan( ) { int cnt; SOLDIERTYPE *pSoldier; @@ -262,10 +262,10 @@ void EndUIPlan( ) } - gfInUIPlanMode = FALSE; - gusSelectedSoldier = gpUIStartPlannedSoldier->ubID; + gfInUIPlanMode = FALSE; + gusSelectedSoldier = gpUIStartPlannedSoldier->ubID; - gfPlotNewMovement = TRUE; + gfPlotNewMovement = TRUE; ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Leaving Planning Mode" ); @@ -287,20 +287,20 @@ void SelectPausedFireAnimation( SOLDIERTYPE *pSoldier ) if ( pSoldier->bDoBurst > 0 ) { - ChangeSoldierState( pSoldier, STANDING_BURST, 2 , FALSE ); + pSoldier->ChangeSoldierState( STANDING_BURST, 2 , FALSE ); } else { - ChangeSoldierState( pSoldier, SHOOT_RIFLE_STAND, 2 , FALSE ); + pSoldier->ChangeSoldierState( SHOOT_RIFLE_STAND, 2 , FALSE ); } break; case ANIM_PRONE: - ChangeSoldierState( pSoldier, SHOOT_RIFLE_PRONE, 2 , FALSE ); + pSoldier->ChangeSoldierState( SHOOT_RIFLE_PRONE, 2 , FALSE ); break; case ANIM_CROUCH: - ChangeSoldierState( pSoldier, SHOOT_RIFLE_CROUCH, 2 , FALSE ); + pSoldier->ChangeSoldierState( SHOOT_RIFLE_CROUCH, 2 , FALSE ); break; } diff --git a/Tactical/Handle UI Plan.h b/Tactical/Handle UI Plan.h index 9fd1fca0..b9f8ffdc 100644 --- a/Tactical/Handle UI Plan.h +++ b/Tactical/Handle UI Plan.h @@ -9,8 +9,8 @@ BOOLEAN BeginUIPlan( SOLDIERTYPE *pSoldier ); -BOOLEAN AddUIPlan( UINT16 sGridNo, UINT8 ubPlanID ); -void EndUIPlan( ); +BOOLEAN AddUIPlan( INT16 sGridNo, UINT8 ubPlanID ); +void EndUIPlan( ); BOOLEAN InUIPlanMode( ); diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index dda283bd..dbea4acc 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -21,7 +21,7 @@ #include "cursors.h" #include "Handle UI.h" #include "Isometric Utils.h" -#include "input.h" +#include "input.h" #include "overhead.h" #include "Sys Globals.h" #include "screenids.h" @@ -35,7 +35,7 @@ #include "weapons.h" #include "Sound Control.h" #include "renderworld.h" -#include "structure.h" +#include "structure.h" #include "interface panels.h" #include "weapons.h" #include "Handle items.h" @@ -99,31 +99,31 @@ extern UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndRead #define MAX_ON_DUTY_SOLDIERS 6 ///////////////////////////////////////////////////////////////////////////////////// -// UI SYSTEM DESCRIPTION +// UI SYSTEM DESCRIPTION // // The UI system here decouples event determination from event execution. IN other words, // first any user input is gathered and analysed for an event to happen. Once the event is determined, -// it is then executed. For example, if the left mouse button is used to select a guy, it does not -// execute the code to selected the guy, rather it sets a flag to a particular event, in this case -// the I_SELECT_MERC event is set. The code then executes this event after all input is analysed. In -// this way, more than one input method from the user will cause the came event to occur and hence no -// duplication of code. Also, events have cetain charactoristics. The select merc event is executed just -// once and then returns to the previous event. Most events are set to run continuously until new -// input changes to another event. Other events have a 'SNAP-BACK' feature which snap the mouse back to -// it's position before the event was executed. Another issue is UI modes. In order to filter out input -// depending on other flags, for example we do not want to cancel the confirm when a user moves to another -// tile unless we are in the 'confirm' mode. This could be done by flags ( and in effect it is ) where -// if staements are used, but here at input collection time, we can switch on our current mode to handle -// input differently based on the mode. Doing it this way also allows us to group certain commands togther -// like menu commands which are initialized and deleted in the same manner. +// it is then executed. For example, if the left mouse button is used to select a guy, it does not +// execute the code to selected the guy, rather it sets a flag to a particular event, in this case +// the I_SELECT_MERC event is set. The code then executes this event after all input is analysed. In +// this way, more than one input method from the user will cause the came event to occur and hence no +// duplication of code. Also, events have cetain charactoristics. The select merc event is executed just +// once and then returns to the previous event. Most events are set to run continuously until new +// input changes to another event. Other events have a 'SNAP-BACK' feature which snap the mouse back to +// it's position before the event was executed. Another issue is UI modes. In order to filter out input +// depending on other flags, for example we do not want to cancel the confirm when a user moves to another +// tile unless we are in the 'confirm' mode. This could be done by flags ( and in effect it is ) where +// if staements are used, but here at input collection time, we can switch on our current mode to handle +// input differently based on the mode. Doing it this way also allows us to group certain commands togther +// like menu commands which are initialized and deleted in the same manner. // // UI_EVENTS ///////////// // // UI_EVENTS have flags to itendtify themselves with special charactoristics, a UI_MODE catagory which -// signifies the UI mode this event will cause the system to move to. Also, a pointer to a handle function is -// used to actually handle the particular event. UI_EVENTS also have a couple of param variables and a number -// of boolean flags used during run-time to determine states of events. +// signifies the UI mode this event will cause the system to move to. Also, a pointer to a handle function is +// used to actually handle the particular event. UI_EVENTS also have a couple of param variables and a number +// of boolean flags used during run-time to determine states of events. // //////////////////////////////////////////////////////////////////////////////////////////////// @@ -229,8 +229,8 @@ INT16 gsTreeRevealYPos; // taken out of header to remove multiple symbol definitions (jonathanl) BOOLEAN gfUICtHBar; UINT8 gbCtH; -UINT8 gsTotalBulletCount; -UINT8 gsBulletCount; +UINT16 gsTotalBulletCount; +UINT16 gsBulletCount; BOOLEAN gTintBulletCounts; BOOLEAN gfUIAutofireBulletCount; BOOLEAN gfUIBodyHitLocation; @@ -244,8 +244,8 @@ BOOLEAN SoldierCanAffordNewStance( SOLDIERTYPE *pSoldier, UINT8 ubDesiredStance void SetMovementModeCursor( SOLDIERTYPE *pSoldier ); void SetConfirmMovementModeCursor( SOLDIERTYPE *pSoldier, BOOLEAN fFromMove ); void SetUIbasedOnStance( SOLDIERTYPE *pSoldier, INT8 bNewStance ); -INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiFlags ); -INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT16 usMapPos, BOOLEAN fUseOKCursor, BOOLEAN fItemsOnlyIfOnIntTiles ); +INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, INT16 sMapPos, UINT32 uiFlags ); +INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT16 sMapPos, BOOLEAN fUseOKCursor, BOOLEAN fItemsOnlyIfOnIntTiles ); extern BOOLEAN gfExitDebugScreen; extern INT8 gCurDebugPage; @@ -262,7 +262,7 @@ UINT16 gusUISelectiveTargetID; SOLDIERTYPE *gpRequesterMerc = NULL; SOLDIERTYPE *gpRequesterTargetMerc = NULL; -INT16 gsRequesterGridNo; +INT16 gsRequesterGridNo; INT16 gsOverItemsGridNo = NOWHERE; INT16 gsOverItemsLevel = 0; BOOLEAN gfUIInterfaceSetBusy = FALSE; @@ -273,7 +273,7 @@ LEVELNODE *gpInvTileThatCausedMoveConfirm = NULL; BOOLEAN gfResetUIMovementOptimization = FALSE; BOOLEAN gfResetUIItemCursorOptimization = FALSE; BOOLEAN gfBeginVehicleCursor = FALSE; -UINT16 gsOutOfRangeGridNo = NOWHERE; +INT16 gsOutOfRangeGridNo = NOWHERE; UINT8 gubOutOfRangeMerc = NOBODY; BOOLEAN gfOKForExchangeCursor = FALSE; UINT32 guiUIInterfaceSwapCursorsTime = 0; @@ -281,12 +281,12 @@ INT16 gsJumpOverGridNo = 0; UI_EVENT gEvents[ NUM_UI_EVENTS ] = -{ +{ 0, IDLE_MODE, UIHandleIDoNothing, FALSE, FALSE, 0, 0, 0, 0, - 0, IDLE_MODE, UIHandleExit, FALSE, FALSE, 0, 0, 0, 0, - UIEVENT_SINGLEEVENT, DONT_CHANGEMODE, UIHandleNewMerc, FALSE, FALSE, 0, 0, 0, 0, - UIEVENT_SINGLEEVENT, DONT_CHANGEMODE, UIHandleNewBadMerc, FALSE, FALSE, 0, 0, 0, 0, - UIEVENT_SINGLEEVENT, MOVE_MODE, UIHandleSelectMerc, FALSE, FALSE, 0, 0, 0, 0, + 0, IDLE_MODE, UIHandleExit, FALSE, FALSE, 0, 0, 0, 0, + UIEVENT_SINGLEEVENT, DONT_CHANGEMODE, UIHandleNewMerc, FALSE, FALSE, 0, 0, 0, 0, + UIEVENT_SINGLEEVENT, DONT_CHANGEMODE, UIHandleNewBadMerc, FALSE, FALSE, 0, 0, 0, 0, + UIEVENT_SINGLEEVENT, MOVE_MODE, UIHandleSelectMerc, FALSE, FALSE, 0, 0, 0, 0, UIEVENT_SINGLEEVENT, MOVE_MODE, UIHandleEnterEditMode, FALSE, FALSE, 0, 0, 0, 0, UIEVENT_SINGLEEVENT, MOVE_MODE, UIHandleEnterPalEditMode, FALSE, FALSE, 0, 0, 0, 0, UIEVENT_SINGLEEVENT, DONT_CHANGEMODE, UIHandleEndTurn, FALSE, FALSE, 0, 0, 0, 0, @@ -309,15 +309,15 @@ UI_EVENT gEvents[ NUM_UI_EVENTS ] = UIEVENT_SINGLEEVENT, MOVE_MODE, UIHandleIETEndTurn, FALSE, FALSE, 0, 0, 0, 0, - 0, MOVE_MODE, UIHandleMOnTerrain, FALSE, FALSE, 0, 0, 0, 0, + 0, MOVE_MODE, UIHandleMOnTerrain, FALSE, FALSE, 0, 0, 0, 0, UIEVENT_SINGLEEVENT, ACTION_MODE, UIHandleMChangeToAction, FALSE, FALSE, 0, 0, 0, 0, UIEVENT_SINGLEEVENT, HANDCURSOR_MODE, UIHandleMChangeToHandMode, FALSE, FALSE, 0, 0, 0, 0, UIEVENT_SINGLEEVENT, MOVE_MODE, UIHandleMCycleMovement, FALSE, FALSE, 0, 0, 0, 0, UIEVENT_SINGLEEVENT, CONFIRM_MOVE_MODE, UIHandleMCycleMoveAll, FALSE, FALSE, 0, 0, 0, 0, - UIEVENT_SNAPMOUSE, ADJUST_STANCE_MODE, UIHandleMAdjustStanceMode, FALSE, FALSE, 0, 0, 0, 0, - 0, POPUP_MODE, UIHandlePOPUPMSG, FALSE, FALSE, 0, 0, 0, 0, + UIEVENT_SNAPMOUSE, ADJUST_STANCE_MODE, UIHandleMAdjustStanceMode, FALSE, FALSE, 0, 0, 0, 0, + 0, POPUP_MODE, UIHandlePOPUPMSG, FALSE, FALSE, 0, 0, 0, 0, 0, ACTION_MODE, UIHandleAOnTerrain, FALSE, FALSE, 0, 0, 0, 0, - UIEVENT_SINGLEEVENT, MOVE_MODE, UIHandleAChangeToMove, FALSE, FALSE, 0, 0, 0, 0, + UIEVENT_SINGLEEVENT, MOVE_MODE, UIHandleAChangeToMove, FALSE, FALSE, 0, 0, 0, 0, UIEVENT_SINGLEEVENT, CONFIRM_ACTION_MODE, UIHandleAChangeToConfirmAction, FALSE, FALSE, 0, 0, 0, 0, UIEVENT_SINGLEEVENT, MOVE_MODE, UIHandleAEndAction, FALSE, FALSE, 0, 0, 0, 0, UIEVENT_SNAPMOUSE, MENU_MODE, UIHandleMovementMenu, FALSE, FALSE, 0, 0, 0, 0, @@ -392,7 +392,7 @@ BOOLEAN fIgnoreLeftUp = FALSE; BOOLEAN gUITargetReady = FALSE; BOOLEAN gUITargetShotWaiting = FALSE; -UINT16 gsUITargetShotGridNo = NOWHERE; +INT16 gsUITargetShotGridNo = NOWHERE; BOOLEAN gUIUseReverse = FALSE; SGPRect gRubberBandRect = { 0, 0, 0, 0 }; @@ -405,7 +405,7 @@ INT16 guiCreateGuyIndex = 0; INT16 guiCreateBadGuyIndex = 8; // FLAGS -// These flags are set for a single frame execution and then are reset for the next iteration. +// These flags are set for a single frame execution and then are reset for the next iteration. BOOLEAN gfUIDisplayActionPoints = FALSE; BOOLEAN gfUIDisplayActionPointsInvalid = FALSE; BOOLEAN gfUIDisplayActionPointsBlack = FALSE; @@ -419,7 +419,7 @@ BOOLEAN gfUIHandleSelectionAboveGuy = FALSE; BOOLEAN gfUIInDeadlock = FALSE; UINT8 gUIDeadlockedSoldier = NOBODY; BOOLEAN gfUIHandleShowMoveGrid = FALSE; -UINT16 gsUIHandleShowMoveGridLocation = NOWHERE ; +UINT16 gsUIHandleShowMoveGridLocation = NOWHERE ; BOOLEAN gfUIOverItemPool = FALSE; INT16 gfUIOverItemPoolGridNo = 0; INT16 gsCurrentActionPoints = 1; @@ -444,7 +444,7 @@ INT16 gsSelectedGuy = NOBODY; BOOLEAN gfUIDisplayDamage = FALSE; INT8 gbDamage = 0; -UINT16 gsDamageGridNo = 0; +INT16 gsDamageGridNo = 0; BOOLEAN gfUIRefreshArrows = FALSE; @@ -474,25 +474,25 @@ void PreventFromTheFreezingBug(SOLDIERTYPE* pSoldier) { gfUIInterfaceSetBusy = FALSE; UnSetUIBusy( pSoldier->ubID ); - // gTacticalStatus.ubAttackBusyCount = 0; // 0verhaul: I know commenting this may not be a good idea, but then neither is this kludgy routine. + // gTacticalStatus.ubAttackBusyCount = 0; // 0verhaul: I know commenting this may not be a good idea, but then neither is this kludgy routine. guiPendingOverrideEvent = LU_ENDUILOCK; UIHandleLUIEndLock( NULL ); } // MAIN TACTICAL UI HANDLER -UINT32 HandleTacticalUI( void ) +UINT32 HandleTacticalUI( void ) { - UINT32 ReturnVal = GAME_SCREEN; - UINT32 uiNewEvent; - UINT16 usMapPos; - LEVELNODE *pIntTile; - static LEVELNODE *pOldIntTile = NULL; + UINT32 ReturnVal = GAME_SCREEN; + UINT32 uiNewEvent; + INT16 sMapPos; + LEVELNODE *pIntTile; + static LEVELNODE *pOldIntTile = NULL; // RESET FLAGS gfUIDisplayActionPoints = FALSE; gfUIDisplayActionPointsInvalid = FALSE; - gfUIDisplayActionPointsBlack = FALSE; + gfUIDisplayActionPointsBlack = FALSE; gfUIDisplayActionPointsCenter = FALSE; gfUIDoNotHighlightSelMerc = FALSE; gfUIHandleSelection = NO_GUY_SELECTION; @@ -508,7 +508,7 @@ UINT32 HandleTacticalUI( void ) gfUIOverItemPool = FALSE; gfUIHandlePhysicsTrajectory = FALSE; gfUIMouseOnValidCatcher = FALSE; - gfIgnoreOnSelectedGuy = FALSE; + gfIgnoreOnSelectedGuy = FALSE; gTintBulletCounts = FALSE; gfUIAutofireBulletCount = FALSE; gfUICtHBar = FALSE; @@ -525,7 +525,7 @@ UINT32 HandleTacticalUI( void ) //UNLOCK UI UnSetUIBusy( (UINT8)gusSelectedSoldier ); - // Decrease global busy counter... + // Decrease global busy counter... gTacticalStatus.ubAttackBusyCount = 0; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Setting attack busy count to 0 due to ending AI lock" ) ); @@ -572,7 +572,7 @@ UINT32 HandleTacticalUI( void ) // FROM KEYBOARD POLLING GetPolledKeyboardInput( &uiNewEvent ); // FROM MOUSE CLICKS - GetRTMouseButtonInput( &uiNewEvent ); + GetRTMouseButtonInput( &uiNewEvent ); // FROM KEYBOARD GetKeyboardInput( &uiNewEvent ); @@ -584,7 +584,7 @@ UINT32 HandleTacticalUI( void ) // FROM KEYBOARD POLLING GetPolledKeyboardInput( &uiNewEvent ); // FROM MOUSE CLICKS - GetTBMouseButtonInput( &uiNewEvent ); + GetTBMouseButtonInput( &uiNewEvent ); // FROM KEYBOARD GetKeyboardInput( &uiNewEvent ); } @@ -609,16 +609,16 @@ UINT32 HandleTacticalUI( void ) gfUIFullTargetFound = FALSE; gfUISelectiveTargetFound = FALSE; - if ( GetMouseMapPos( &usMapPos ) ) + if ( GetMouseMapPos( &sMapPos ) ) { // Look for soldier full - if ( FindSoldier( usMapPos, &gusUIFullTargetID, &guiUIFullTargetFlags, ( FINDSOLDIERSAMELEVEL( gsInterfaceLevel ) ) ) ) + if ( FindSoldier( sMapPos, &gusUIFullTargetID, &guiUIFullTargetFlags, ( FINDSOLDIERSAMELEVEL( gsInterfaceLevel ) ) ) ) { gfUIFullTargetFound = TRUE; } // Look for soldier selective - if ( FindSoldier( usMapPos, &gusUISelectiveTargetID, &guiUISelectiveTargetFlags, FINDSOLDIERSELECTIVESAMELEVEL( gsInterfaceLevel ) ) ) + if ( FindSoldier( sMapPos, &gusUISelectiveTargetID, &guiUISelectiveTargetFlags, FINDSOLDIERSELECTIVESAMELEVEL( gsInterfaceLevel ) ) ) { gfUISelectiveTargetFound = TRUE; } @@ -666,7 +666,7 @@ UINT32 HandleTacticalUI( void ) // Check if UI mode has changed from previous event if ( gEvents[ uiNewEvent ].ChangeToUIMode != gCurrentUIMode && ( gEvents[ uiNewEvent ].ChangeToUIMode != DONT_CHANGEMODE ) ) - { + { gEvents[ uiNewEvent ].uiMenuPreviousMode = gCurrentUIMode; gOldUIMode = gCurrentUIMode; @@ -685,7 +685,7 @@ UINT32 HandleTacticalUI( void ) // Check if menu event is done and if so set to privious mode // This is needed to hook into the interface stuff which sets the fDoneMenu flag - if ( gEvents[ uiNewEvent ].fDoneMenu == TRUE ) + if ( gEvents[ uiNewEvent ].fDoneMenu == TRUE ) { if ( gCurrentUIMode == MENU_MODE || gCurrentUIMode == POPUP_MODE || gCurrentUIMode == LOOKCURSOR_MODE ) { @@ -698,7 +698,7 @@ UINT32 HandleTacticalUI( void ) { // ATE: OK - don't revert to single event if our mouse is not // in viewport - rather use m_on_t event - if ( ( gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA ) ) + if ( ( gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA ) ) { guiCurrentEvent = guiOldEvent; } @@ -922,23 +922,23 @@ void SetUIMouseCursor( ) if ( gfUIShowExitExitGrid ) { - UINT16 usMapPos; - UINT8 ubRoomNum; + INT16 sMapPos; + UINT8 ubRoomNum; gfUIDisplayActionPoints = FALSE; ErasePath( TRUE ); - if( GetMouseMapPos( &usMapPos) ) - { - if ( gusSelectedSoldier != NOBODY && MercPtrs[ gusSelectedSoldier ]->bLevel == 0 ) + if( GetMouseMapPos( &sMapPos) ) + { + if ( gusSelectedSoldier != NOBODY && MercPtrs[ gusSelectedSoldier ]->pathing.bLevel == 0 ) { // ATE: Is this place revealed? - if ( !InARoom( usMapPos, &ubRoomNum ) || ( InARoom( usMapPos, &ubRoomNum ) && gpWorldLevelData[ usMapPos ].uiFlags & MAPELEMENT_REVEALED ) ) + if ( !InARoom( sMapPos, &ubRoomNum ) || ( InARoom( sMapPos, &ubRoomNum ) && gpWorldLevelData[ sMapPos ].uiFlags & MAPELEMENT_REVEALED ) ) { - if ( sOldExitGridNo != usMapPos ) + if ( sOldExitGridNo != sMapPos ) { - fOkForExit = OKForSectorExit( (INT8)-1, usMapPos, &uiTraverseTimeInMinutes ); - sOldExitGridNo = usMapPos; + fOkForExit = OKForSectorExit( (INT8)-1, sMapPos, &uiTraverseTimeInMinutes ); + sOldExitGridNo = sMapPos; } if ( fOkForExit ) @@ -1040,16 +1040,16 @@ UINT32 UIHandleExit( UI_EVENT *pUIEvent ) UINT32 UIHandleNewMerc( UI_EVENT *pUIEvent ) { static UINT8 ubTemp = 3; - UINT16 usMapPos; - static INT32 iSoldierCount=0; + INT16 sMapPos; + static INT32 iSoldierCount=0; MERC_HIRE_STRUCT HireMercStruct; INT8 bReturnCode; SOLDIERTYPE *pSoldier; // Get Grid Corrdinates of mouse - if( GetMouseMapPos( &usMapPos) ) - { + if( GetMouseMapPos( &sMapPos) ) + { ubTemp+= 2; memset( &HireMercStruct, 0, sizeof(MERC_HIRE_STRUCT)); @@ -1061,7 +1061,7 @@ UINT32 UIHandleNewMerc( UI_EVENT *pUIEvent ) HireMercStruct.sSectorY = gWorldSectorY; HireMercStruct.bSectorZ = gbWorldSectorZ; HireMercStruct.ubInsertionCode = INSERTION_CODE_GRIDNO; - HireMercStruct.usInsertionData = usMapPos; + HireMercStruct.usInsertionData = sMapPos; HireMercStruct.fCopyProfileItemsOver = TRUE; HireMercStruct.iTotalContractLength = 7; @@ -1073,7 +1073,7 @@ UINT32 UIHandleNewMerc( UI_EVENT *pUIEvent ) if( bReturnCode == MERC_HIRE_FAILED ) { - ScreenMsg( FONT_ORANGE, MSG_BETAVERSION, L"Merc hire failed: Either already hired or dislikes you." ); + ScreenMsg( FONT_ORANGE, MSG_BETAVERSION, L"Merc hire failed: Either already hired or dislikes you." ); } else if( bReturnCode == MERC_HIRE_OVER_18_MERCS_HIRED ) { @@ -1095,14 +1095,14 @@ UINT32 UIHandleNewMerc( UI_EVENT *pUIEvent ) UINT32 UIHandleNewBadMerc( UI_EVENT *pUIEvent ) { SOLDIERTYPE *pSoldier; - UINT16 usMapPos; + INT16 sMapPos; UINT16 usRandom; //Get map postion and place the enemy there. - if( GetMouseMapPos( &usMapPos) ) - { + if( GetMouseMapPos( &sMapPos) ) + { // Are we an OK dest? - if ( !IsLocationSittable( usMapPos, 0 ) ) + if ( !IsLocationSittable( sMapPos, 0 ) ) { return( GAME_SCREEN ); } @@ -1143,7 +1143,7 @@ UINT32 UIHandleNewBadMerc( UI_EVENT *pUIEvent ) } pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; - pSoldier->usStrategicInsertionData = usMapPos; + pSoldier->usStrategicInsertionData = sMapPos; UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); AllTeamsLookForAll( NO_INTERRUPTS ); } @@ -1154,12 +1154,12 @@ UINT32 UIHandleNewBadMerc( UI_EVENT *pUIEvent ) UINT32 UIHandleEnterEditMode( UI_EVENT *pUIEvent ) { - return( EDIT_SCREEN ); + return( EDIT_SCREEN ); } UINT32 UIHandleEnterPalEditMode( UI_EVENT *pUIEvent ) { - return( PALEDIT_SCREEN ); + return( PALEDIT_SCREEN ); } @@ -1225,7 +1225,7 @@ UINT32 UIHandleTestHit( UI_EVENT *pUIEvent ) } else { - if ( Random(2) ) + if ( Random(2) ) { bDamage = 20; } @@ -1237,7 +1237,7 @@ UINT32 UIHandleTestHit( UI_EVENT *pUIEvent ) // gTacticalStatus.ubAttackBusyCount++; DebugAttackBusy( "Testing a hit.\n" ); - EVENT_SoldierGotHit( pSoldier, 1, bDamage, 10, pSoldier->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pSoldier->bAimShotLocation, 0, NOWHERE ); + pSoldier->EVENT_SoldierGotHit( 1, bDamage, 10, pSoldier->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pSoldier->bAimShotLocation, 0, NOWHERE ); // callahan update end - put everything as it was } return( GAME_SCREEN ); @@ -1317,13 +1317,12 @@ UINT32 UIHandleSelectMerc( UI_EVENT *pUIEvent ) UINT32 UIHandleMOnTerrain( UI_EVENT *pUIEvent ) { SOLDIERTYPE *pSoldier; - UINT16 usMapPos; + INT16 sMapPos; BOOLEAN fSetCursor = FALSE; UINT32 uiCursorFlags; LEVELNODE *pIntNode; EXITGRID ExitGrid; INT16 sIntTileGridNo; - BOOLEAN fContinue = TRUE; ITEM_POOL *pItemPool; static INT16 sGridNoForItemsOver; @@ -1331,7 +1330,7 @@ UINT32 UIHandleMOnTerrain( UI_EVENT *pUIEvent ) static UINT32 uiItemsOverTimer; static BOOLEAN fOverItems; - if( !GetMouseMapPos( &usMapPos) ) + if( !GetMouseMapPos( &sMapPos) ) { return( GAME_SCREEN ); } @@ -1345,7 +1344,7 @@ UINT32 UIHandleMOnTerrain( UI_EVENT *pUIEvent ) { if ( !UIHandleOnMerc( TRUE ) ) { - guiNewUICursor = FLOATING_X_UICURSOR; + guiNewUICursor = FLOATING_X_UICURSOR; return( GAME_SCREEN ); } } @@ -1355,20 +1354,20 @@ UINT32 UIHandleMOnTerrain( UI_EVENT *pUIEvent ) if ( !UIHandleOnMerc( TRUE ) ) { // Are we over items... - if ( GetItemPool( usMapPos, &pItemPool, (UINT8)gsInterfaceLevel ) && ITEMPOOL_VISIBLE( pItemPool ) ) + if ( GetItemPool( sMapPos, &pItemPool, (UINT8)gsInterfaceLevel ) && ITEMPOOL_VISIBLE( pItemPool ) ) { // Are we already in... if ( fOverItems ) { // Is this the same level & gridno... - if ( gsInterfaceLevel == (INT16)bLevelForItemsOver && usMapPos == sGridNoForItemsOver ) + if ( gsInterfaceLevel == (INT16)bLevelForItemsOver && sMapPos == sGridNoForItemsOver ) { // Check timer... if ( ( GetJA2Clock( ) - uiItemsOverTimer ) > 1500 ) { // Change to hand curso mode guiPendingOverrideEvent = M_CHANGE_TO_HANDMODE; - gsOverItemsGridNo = usMapPos; + gsOverItemsGridNo = sMapPos; gsOverItemsLevel = gsInterfaceLevel; fOverItems = FALSE; } @@ -1377,7 +1376,7 @@ UINT32 UIHandleMOnTerrain( UI_EVENT *pUIEvent ) { uiItemsOverTimer = GetJA2Clock( ); bLevelForItemsOver = (INT8)gsInterfaceLevel; - sGridNoForItemsOver = usMapPos; + sGridNoForItemsOver = sMapPos; } } else @@ -1386,7 +1385,7 @@ UINT32 UIHandleMOnTerrain( UI_EVENT *pUIEvent ) uiItemsOverTimer = GetJA2Clock( ); bLevelForItemsOver = (INT8)gsInterfaceLevel; - sGridNoForItemsOver = usMapPos; + sGridNoForItemsOver = sMapPos; } } else @@ -1397,24 +1396,18 @@ UINT32 UIHandleMOnTerrain( UI_EVENT *pUIEvent ) if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { - - if ( pSoldier->sGridNo == NOWHERE ) - { - int i = 0; - } - - if ( GetExitGrid( usMapPos, &ExitGrid ) && pSoldier->bLevel == 0 ) + if ( GetExitGrid( sMapPos, &ExitGrid ) && pSoldier->pathing.bLevel == 0 ) { gfUIShowExitExitGrid = TRUE; } // ATE: Draw invalidc cursor if heights different - if ( gpWorldLevelData[ usMapPos ].sHeight != gpWorldLevelData[ pSoldier->sGridNo ].sHeight ) + if ( gpWorldLevelData[ sMapPos ].sHeight != gpWorldLevelData[ pSoldier->sGridNo ].sHeight ) { // ERASE PATH ErasePath( TRUE ); - guiNewUICursor = FLOATING_X_UICURSOR; + guiNewUICursor = FLOATING_X_UICURSOR; return( GAME_SCREEN ); } @@ -1434,14 +1427,14 @@ UINT32 UIHandleMOnTerrain( UI_EVENT *pUIEvent ) // Check were we are // CHECK IF WE CAN MOVE HERE // THIS IS JUST A CRUDE TEST FOR NOW - if ( pSoldier->bLife < OKLIFE ) + if ( pSoldier->stats.bLife < OKLIFE ) { UINT8 ubID; // Show reg. cursor // GO INTO IDLE MODE // guiPendingOverrideEvent = I_CHANGE_TO_IDLE; - // gusSelectedSoldier = NOBODY; - ubID = FindNextActiveAndAliveMerc( pSoldier, FALSE, FALSE ); + // gusSelectedSoldier = NOBODY; + ubID = FindNextActiveAndAliveMerc( pSoldier, FALSE, FALSE ); if ( ubID != NOBODY ) { @@ -1454,23 +1447,23 @@ UINT32 UIHandleMOnTerrain( UI_EVENT *pUIEvent ) guiPendingOverrideEvent = I_ON_TERRAIN; } } - else if ( ( UIOKMoveDestination( pSoldier, usMapPos ) != 1 ) && pIntNode == NULL ) + else if ( ( UIOKMoveDestination( pSoldier, sMapPos ) != 1 ) && pIntNode == NULL ) { // ERASE PATH ErasePath( TRUE ); - guiNewUICursor = CANNOT_MOVE_UICURSOR; + guiNewUICursor = CANNOT_MOVE_UICURSOR; } else { - if ( !UIHandleInteractiveTilesAndItemsOnTerrain( pSoldier, usMapPos, FALSE, TRUE ) ) + if ( !UIHandleInteractiveTilesAndItemsOnTerrain( pSoldier, sMapPos, FALSE, TRUE ) ) { // Are we in combat? if ( (gTacticalStatus.uiFlags & INCOMBAT ) && ( gTacticalStatus.uiFlags & TURNBASED ) ) { // If so, draw path, etc - fSetCursor = HandleUIMovementCursor( pSoldier, uiCursorFlags, usMapPos, 0 ); + fSetCursor = HandleUIMovementCursor( pSoldier, uiCursorFlags, sMapPos, 0 ); } else { @@ -1478,7 +1471,7 @@ UINT32 UIHandleMOnTerrain( UI_EVENT *pUIEvent ) fSetCursor = TRUE; // If so, draw path, etc - fSetCursor = HandleUIMovementCursor( pSoldier, uiCursorFlags, usMapPos, 0 ); + fSetCursor = HandleUIMovementCursor( pSoldier, uiCursorFlags, sMapPos, 0 ); //ErasePath( TRUE ); } @@ -1524,7 +1517,7 @@ UINT32 UIHandleMovementMenu( UI_EVENT *pUIEvent ) // Get soldier - if ( !GetSoldier( &pSoldier, gusSelectedSoldier ) ) + if ( !GetSoldier( &pSoldier, gusSelectedSoldier ) ) { return( GAME_SCREEN ); } @@ -1574,11 +1567,11 @@ UINT32 UIHandleMovementMenu( UI_EVENT *pUIEvent ) if ( pSoldier->usUIMovementMode != WALKING && pSoldier->usUIMovementMode != RUNNING ) { UIHandleSoldierStanceChange( pSoldier->ubID, ANIM_STAND ); - pSoldier->fUIMovementFast = 1; + pSoldier->flags.fUIMovementFast = 1; } else { - pSoldier->fUIMovementFast = 1; + pSoldier->flags.fUIMovementFast = 1; pSoldier->usUIMovementMode = RUNNING; gfPlotNewMovement = TRUE; } @@ -1622,26 +1615,26 @@ UINT32 UIHandlePositionMenu( UI_EVENT *pUIEvent ) UINT32 UIHandleAOnTerrain( UI_EVENT *pUIEvent ) { - UINT16 usMapPos; + UINT16 sMapPos; SOLDIERTYPE *pSoldier; // INT16 sTargetXPos, sTargetYPos; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("UIHandleAOnTerrain")); - if( !GetMouseMapPos( &usMapPos) ) + if( !GetMouseMapPos( (INT16*)&sMapPos) ) { return( GAME_SCREEN ); } if ( gpItemPointer != NULL ) { - return( GAME_SCREEN ); + return( GAME_SCREEN ); } // Get soldier to determine range if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { // ATE: Add stuff here to display a system message if we are targeting smeothing and - // are out of range. + // are out of range. // Are we using a gun? if ( GetActionModeCursor( pSoldier ) == TARGETCURS ) { @@ -1649,7 +1642,7 @@ UINT32 UIHandleAOnTerrain( UI_EVENT *pUIEvent ) // Yep, she's a gun. // Are we in range? - if ( !InRange( pSoldier, usMapPos ) ) + if ( !InRange( pSoldier, sMapPos ) ) { // Are we over a guy? if ( gfUIFullTargetFound ) @@ -1660,18 +1653,18 @@ UINT32 UIHandleAOnTerrain( UI_EVENT *pUIEvent ) // Display ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ OUT_OF_RANGE_STRING ] ); - //PlayJA2Sample( TARGET_OUT_OF_RANGE, RATE_11025, MIDVOLUME, 1, MIDDLEPAN ); + //PlayJA2Sample( TARGET_OUT_OF_RANGE, RATE_11025, MIDVOLUME, 1, MIDDLEPAN ); // Set gsOutOfRangeGridNo = MercPtrs[ gusUIFullTargetID ]->sGridNo; - gubOutOfRangeMerc = (UINT8)gusSelectedSoldier; + gubOutOfRangeMerc = (UINT8)gusSelectedSoldier; } } } } - guiNewUICursor = GetProperItemCursor( (UINT8)gusSelectedSoldier, pSoldier->inv[ HANDPOS ].usItem, usMapPos, FALSE ); + guiNewUICursor = GetProperItemCursor( (UINT8)gusSelectedSoldier, pSoldier->inv[ HANDPOS ].usItem, sMapPos, FALSE ); // Show UI ON GUY UIHandleOnMerc( FALSE ); @@ -1679,8 +1672,8 @@ UINT32 UIHandleAOnTerrain( UI_EVENT *pUIEvent ) // If we are in realtime, and in a stationary animation, follow! if ( ( gTacticalStatus.uiFlags & REALTIME ) || !( gTacticalStatus.uiFlags & INCOMBAT ) ) { - if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_STATIONARY && pSoldier->ubPendingAction == NO_PENDING_ACTION ) - { + if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_STATIONARY && pSoldier->aiData.ubPendingAction == NO_PENDING_ACTION ) + { // Check if we have a shot waiting! if ( gUITargetShotWaiting ) { @@ -1688,13 +1681,13 @@ UINT32 UIHandleAOnTerrain( UI_EVENT *pUIEvent ) } if ( !gUITargetReady ) - { + { // Move to proper stance + direction! // Convert our grid-not into an XY - // ConvertGridNoToXY( usMapPos, &sTargetXPos, &sTargetYPos ); + // ConvertGridNoToXY( sMapPos, &sTargetXPos, &sTargetYPos ); // Ready weapon - // SoldierReadyWeapon( pSoldier, sTargetXPos, sTargetYPos, FALSE ); + // pSoldier->SoldierReadyWeapon(sTargetXPos, sTargetYPos, FALSE ); gUITargetReady = TRUE; } @@ -1749,18 +1742,18 @@ UINT32 UIHandleAChangeToMove( UI_EVENT *pUIEvent ) UINT32 UIHandleCWait( UI_EVENT *pUIEvent ) { - UINT16 usMapPos; + INT16 sMapPos; SOLDIERTYPE *pSoldier; BOOLEAN fSetCursor; UINT32 uiCursorFlags; LEVELNODE *pInvTile; - if( !GetMouseMapPos( &usMapPos) ) + if( !GetMouseMapPos( &sMapPos) ) { return( GAME_SCREEN ); } - if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) + if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { pInvTile = GetCurInteractiveTile( ); @@ -1776,10 +1769,10 @@ UINT32 UIHandleCWait( UI_EVENT *pUIEvent ) if ( pInvTile != NULL ) { - fSetCursor = HandleUIMovementCursor( pSoldier, uiCursorFlags, usMapPos, MOVEUI_TARGET_INTTILES ); + fSetCursor = HandleUIMovementCursor( pSoldier, uiCursorFlags, sMapPos, MOVEUI_TARGET_INTTILES ); //Set UI CURSOR - guiNewUICursor = GetInteractiveTileCursor( guiNewUICursor, TRUE ); + guiNewUICursor = GetInteractiveTileCursor( guiNewUICursor, TRUE ); // Make red tile under spot... if we've previously found one... if ( gfUIHandleShowMoveGrid ) @@ -1796,7 +1789,7 @@ UINT32 UIHandleCWait( UI_EVENT *pUIEvent ) // Determine if we can afford! if ( !EnoughPoints( pSoldier, gsCurrentActionPoints, 0, FALSE ) ) - { + { gfUIDisplayActionPointsInvalid = TRUE; } @@ -1805,8 +1798,8 @@ UINT32 UIHandleCWait( UI_EVENT *pUIEvent ) // If we are not in combat, draw path here! if ( (gTacticalStatus.uiFlags & REALTIME ) || !(gTacticalStatus.uiFlags & INCOMBAT ) ) { - //DrawUIMovementPath( pSoldier, usMapPos, 0 ); - fSetCursor = HandleUIMovementCursor( pSoldier, uiCursorFlags, usMapPos, 0 ); + //DrawUIMovementPath( pSoldier, sMapPos, 0 ); + fSetCursor = HandleUIMovementCursor( pSoldier, uiCursorFlags, sMapPos, 0 ); } } @@ -1819,7 +1812,7 @@ UINT32 UIHandleCWait( UI_EVENT *pUIEvent ) // SelectedMercCanAffordMove UINT32 UIHandleCMoveMerc( UI_EVENT *pUIEvent ) { - UINT16 usMapPos; + INT16 sMapPos; SOLDIERTYPE *pSoldier; INT16 sDestGridNo; INT16 sActionGridNo; @@ -1836,7 +1829,7 @@ UINT32 UIHandleCMoveMerc( UI_EVENT *pUIEvent ) fAllMove = gfUIAllMoveOn; gfUIAllMoveOn = FALSE; - if( !GetMouseMapPos( &usMapPos) ) + if( !GetMouseMapPos( &sMapPos) ) { return( GAME_SCREEN ); } @@ -1852,52 +1845,52 @@ UINT32 UIHandleCMoveMerc( UI_EVENT *pUIEvent ) // TODO: Only our squad! for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pSoldier++) { - if ( OK_CONTROLLABLE_MERC( pSoldier ) && pSoldier->bAssignment == CurrentSquad( ) && !pSoldier->fMercAsleep ) - { - // If we can't be controlled, returninvalid... - if ( pSoldier->uiStatusFlags & SOLDIER_ROBOT ) - { - if ( !CanRobotBeControlled( pSoldier ) ) - { - continue; - } - } + if ( OK_CONTROLLABLE_MERC( pSoldier ) && pSoldier->bAssignment == CurrentSquad( ) && !pSoldier->flags.fMercAsleep ) + { + // If we can't be controlled, returninvalid... + if ( pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) + { + if ( !pSoldier->CanRobotBeControlled( ) ) + { + continue; + } + } - AdjustNoAPToFinishMove( pSoldier, FALSE ); + pSoldier->AdjustNoAPToFinishMove( FALSE ); - fOldFastMove = pSoldier->fUIMovementFast; + fOldFastMove = pSoldier->flags.fUIMovementFast; if ( fAllMove == 2 ) { - pSoldier->fUIMovementFast = TRUE; + pSoldier->flags.fUIMovementFast = TRUE; pSoldier->usUIMovementMode = RUNNING; } else { - pSoldier->fUIMovementFast = FALSE; - pSoldier->usUIMovementMode = GetMoveStateBasedOnStance( pSoldier, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ); + pSoldier->flags.fUIMovementFast = FALSE; + pSoldier->usUIMovementMode = pSoldier->GetMoveStateBasedOnStance( gAnimControl[ pSoldier->usAnimState ].ubEndHeight ); } // Remove any previous actions - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; //if ( !( gTacticalStatus.uiFlags & INCOMBAT ) && ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_MOVING ) ) //{ - // pSoldier->sRTPendingMovementGridNo = usMapPos; - // pSoldier->usRTPendingMovementAnim = pSoldier->usUIMovementMode; + // pSoldier->sRTPendingMovementGridNo = sMapPos; + // pSoldier->usRTPendingMovementAnim = pSoldier->usUIMovementMode; //} - //else - if ( EVENT_InternalGetNewSoldierPath( pSoldier, usMapPos, pSoldier->usUIMovementMode, TRUE, FALSE ) ) + //else + if ( pSoldier->EVENT_InternalGetNewSoldierPath( sMapPos, pSoldier->usUIMovementMode, TRUE, FALSE ) ) { - InternalDoMercBattleSound( pSoldier, BATTLE_SOUND_OK1, BATTLE_SND_LOWER_VOLUME ); + pSoldier->InternalSoldierReadyWeapon( BATTLE_SOUND_OK1, BATTLE_SND_LOWER_VOLUME ); } else { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ NO_PATH_FOR_MERC ], pSoldier->name ); - } + } - pSoldier->fUIMovementFast = fOldFastMove; + pSoldier->flags.fUIMovementFast = fOldFastMove; } } @@ -1912,16 +1905,32 @@ UINT32 UIHandleCMoveMerc( UI_EVENT *pUIEvent ) else { // Get soldier - if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) + if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { + // CHRISL: This block should only run if we're running in the new inventory system + if((UsingNewInventorySystem() == true)) + { + // CHRISL: If we're in combat and zipper is active, don't allow movement + if((gTacticalStatus.uiFlags & INCOMBAT) && pSoldier->flags.ZipperFlag) + { + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_ZIPPER_NO_MOVE] ); + return( GAME_SCREEN ); + } + // CHRISL: If we're not in combat but the zipper is active and we're moving, deactivate the zipper + if(!(gTacticalStatus.uiFlags & INCOMBAT) && pSoldier->flags.ZipperFlag) + { + pSoldier->flags.ZipperFlag=FALSE; + RenderBackpackButtons(0); + } + } // FOR REALTIME - DO MOVEMENT BASED ON STANCE! if ( ( gTacticalStatus.uiFlags & REALTIME ) || !( gTacticalStatus.uiFlags & INCOMBAT ) ) { - pSoldier->usUIMovementMode = GetMoveStateBasedOnStance( pSoldier, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ); + pSoldier->usUIMovementMode = pSoldier->GetMoveStateBasedOnStance( gAnimControl[ pSoldier->usAnimState ].ubEndHeight ); } - sDestGridNo = usMapPos; + sDestGridNo = sMapPos; // Get structure info for in tile! @@ -1930,7 +1939,7 @@ UINT32 UIHandleCMoveMerc( UI_EVENT *pUIEvent ) // We should not have null here if we are given this flag... if ( pIntTile != NULL ) { - sActionGridNo = FindAdjacentGridEx( pSoldier, sIntTileGridNo, &ubDirection, NULL, FALSE, TRUE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, sIntTileGridNo, &ubDirection, NULL, FALSE, TRUE ); if ( sActionGridNo != -1 ) { SetUIBusy( pSoldier->ubID ); @@ -1962,10 +1971,10 @@ UINT32 UIHandleCMoveMerc( UI_EVENT *pUIEvent ) if ( !gTacticalStatus.fAtLeastOneGuyOnMultiSelect ) { - pSoldier->fUIMovementFast = FALSE; + pSoldier->flags.fUIMovementFast = FALSE; } - //StartLooseCursor( usMapPos, 0 ); + //StartLooseCursor( sMapPos, 0 ); } if ( gTacticalStatus.fAtLeastOneGuyOnMultiSelect && pIntTile == NULL ) @@ -1985,15 +1994,15 @@ UINT32 UIHandleCMoveMerc( UI_EVENT *pUIEvent ) } // Remove any previous actions - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; { - EVENT_InternalGetNewSoldierPath( pSoldier, sDestGridNo, pSoldier->usUIMovementMode , TRUE, pSoldier->fNoAPToFinishMove ); + pSoldier->EVENT_InternalGetNewSoldierPath( sDestGridNo, pSoldier->usUIMovementMode , TRUE, pSoldier->flags.fNoAPToFinishMove ); } - if ( pSoldier->usPathDataSize > 5 ) + if ( pSoldier->pathing.usPathDataSize > 5 ) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_OK1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_OK1 ); } // HANDLE ANY INTERACTIVE OBJECTS HERE! @@ -2040,7 +2049,7 @@ UINT32 UIHandleMCycleMovement( UI_EVENT *pUIEvent ) if ( pSoldier->ubBodyType == ROBOTNOWEAPON ) { - pSoldier->usUIMovementMode = WALKING; + pSoldier->usUIMovementMode = WALKING; gfPlotNewMovement = TRUE; return( GAME_SCREEN ); } @@ -2074,7 +2083,7 @@ UINT32 UIHandleMCycleMovement( UI_EVENT *pUIEvent ) } else if ( pSoldier->usUIMovementMode == CRAWLING ) { - pSoldier->fUIMovementFast = 1; + pSoldier->flags.fUIMovementFast = 1; pSoldier->usUIMovementMode = RUNNING; if ( IsValidMovementMode( pSoldier, RUNNING ) ) { @@ -2100,7 +2109,6 @@ UINT32 UIHandleCOnTerrain( UI_EVENT *pUIEvent ) UINT32 UIHandleMAdjustStanceMode( UI_EVENT *pUIEvent ) { SOLDIERTYPE *pSoldier; - BOOLEAN fCheck = FALSE; INT32 iPosDiff; static UINT16 gusAnchorMouseY; static UINT16 usOldMouseY; @@ -2125,15 +2133,15 @@ UINT32 UIHandleMAdjustStanceMode( UI_EVENT *pUIEvent ) uiOldShowUPDownArrows = guiShowUPDownArrows; gbAdjustStanceDiff = 0; - gbClimbID = 0; + gbClimbID = 0; gfIgnoreScrolling = TRUE; // Get soldier current height of animation - if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) + if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { // IF we are on a basic level...(temp) - if ( pSoldier->bLevel == 0 ) + if ( pSoldier->pathing.bLevel == 0 ) { if ( FindHeigherLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) ) { @@ -2142,7 +2150,7 @@ UINT32 UIHandleMAdjustStanceMode( UI_EVENT *pUIEvent ) } // IF we are higher... - if ( pSoldier->bLevel > 0 ) + if ( pSoldier->pathing.bLevel > 0 ) { if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) ) { @@ -2205,7 +2213,7 @@ UINT32 UIHandleMAdjustStanceMode( UI_EVENT *pUIEvent ) ubDownDepth = 0; } break; - } + } } @@ -2222,7 +2230,7 @@ UINT32 UIHandleMAdjustStanceMode( UI_EVENT *pUIEvent ) if ( gusAnchorMouseY > gusMouseYPos ) { // Get soldier - if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) + if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { if ( iPosDiff < GO_MOVE_ONE && ubUpHeight >= 1 ) { @@ -2230,20 +2238,20 @@ UINT32 UIHandleMAdjustStanceMode( UI_EVENT *pUIEvent ) //guiShowUPDownArrows = ARROWS_SHOW_UP_ABOVE_Y; guiShowUPDownArrows = ARROWS_SHOW_DOWN_BESIDE | ARROWS_SHOW_UP_BESIDE; gbAdjustStanceDiff = 0; - gbClimbID = 0; - } + gbClimbID = 0; + } else if ( iPosDiff > GO_MOVE_ONE && iPosDiff < GO_MOVE_TWO && ubUpHeight >= 1 ) { //guiShowUPDownArrows = ARROWS_SHOW_UP_ABOVE_G; if ( ubUpHeight == 1 && ubNearHeigherLevel ) { guiShowUPDownArrows = ARROWS_SHOW_UP_ABOVE_CLIMB; - gbClimbID = 1; + gbClimbID = 1; } else { guiShowUPDownArrows = ARROWS_SHOW_UP_ABOVE_Y; - gbClimbID = 0; + gbClimbID = 0; } gbAdjustStanceDiff = 1; } @@ -2252,12 +2260,12 @@ UINT32 UIHandleMAdjustStanceMode( UI_EVENT *pUIEvent ) if ( ubUpHeight == 2 && ubNearHeigherLevel ) { guiShowUPDownArrows = ARROWS_SHOW_UP_ABOVE_CLIMB; - gbClimbID = 1; + gbClimbID = 1; } else { guiShowUPDownArrows = ARROWS_SHOW_UP_ABOVE_YY; - gbClimbID = 0; + gbClimbID = 0; } gbAdjustStanceDiff = 2; } @@ -2266,7 +2274,7 @@ UINT32 UIHandleMAdjustStanceMode( UI_EVENT *pUIEvent ) if ( ubUpHeight == 3 && ubNearHeigherLevel ) { guiShowUPDownArrows = ARROWS_SHOW_UP_ABOVE_CLIMB; - gbClimbID = 1; + gbClimbID = 1; } } } @@ -2277,7 +2285,7 @@ UINT32 UIHandleMAdjustStanceMode( UI_EVENT *pUIEvent ) { // Get soldier - if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) + if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { if ( iPosDiff < GO_MOVE_ONE && ubDownDepth >= 1 ) { @@ -2285,21 +2293,21 @@ UINT32 UIHandleMAdjustStanceMode( UI_EVENT *pUIEvent ) //guiShowUPDownArrows = ARROWS_SHOW_DOWN_BELOW_Y; guiShowUPDownArrows = ARROWS_SHOW_DOWN_BESIDE | ARROWS_SHOW_UP_BESIDE; gbAdjustStanceDiff = 0; - gbClimbID = 0; + gbClimbID = 0; - } + } else if ( iPosDiff >= GO_MOVE_ONE && iPosDiff < GO_MOVE_TWO && ubDownDepth >= 1 ) { // guiShowUPDownArrows = ARROWS_SHOW_DOWN_BELOW_G; if ( ubDownDepth == 1 && ubNearLowerLevel ) { guiShowUPDownArrows = ARROWS_SHOW_DOWN_CLIMB; - gbClimbID = -1; + gbClimbID = -1; } else { guiShowUPDownArrows = ARROWS_SHOW_DOWN_BELOW_Y; - gbClimbID = 0; + gbClimbID = 0; } gbAdjustStanceDiff = -1; } @@ -2309,12 +2317,12 @@ UINT32 UIHandleMAdjustStanceMode( UI_EVENT *pUIEvent ) if ( ubDownDepth == 2 && ubNearLowerLevel ) { guiShowUPDownArrows = ARROWS_SHOW_DOWN_CLIMB; - gbClimbID = -1; + gbClimbID = -1; } else { guiShowUPDownArrows = ARROWS_SHOW_DOWN_BELOW_YY; - gbClimbID = 0; + gbClimbID = 0; } gbAdjustStanceDiff = -2; } @@ -2324,7 +2332,7 @@ UINT32 UIHandleMAdjustStanceMode( UI_EVENT *pUIEvent ) if ( ubDownDepth == 3 && ubNearLowerLevel ) { guiShowUPDownArrows = ARROWS_SHOW_DOWN_CLIMB; - gbClimbID = -1; + gbClimbID = -1; } } @@ -2358,16 +2366,16 @@ UINT32 UIHandleAChangeToConfirmAction( UI_EVENT *pUIEvent ) UINT32 UIHandleCAOnTerrain( UI_EVENT *pUIEvent ) { SOLDIERTYPE *pSoldier; - UINT16 usMapPos; + INT16 sMapPos; - if( !GetMouseMapPos( &usMapPos) ) + if( !GetMouseMapPos( &sMapPos) ) { return( GAME_SCREEN ); } if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { - guiNewUICursor = GetProperItemCursor( (UINT8)gusSelectedSoldier, pSoldier->inv[ HANDPOS ].usItem, usMapPos, TRUE ); + guiNewUICursor = GetProperItemCursor( (UINT8)gusSelectedSoldier, pSoldier->inv[ HANDPOS ].usItem, sMapPos, TRUE ); UIHandleOnMerc( FALSE ); @@ -2378,7 +2386,7 @@ UINT32 UIHandleCAOnTerrain( UI_EVENT *pUIEvent ) -void UIHandleMercAttack( SOLDIERTYPE *pSoldier , SOLDIERTYPE *pTargetSoldier, UINT16 usMapPos ) +void UIHandleMercAttack( SOLDIERTYPE *pSoldier , SOLDIERTYPE *pTargetSoldier, INT16 sMapPos ) { INT32 iHandleReturn; INT16 sTargetGridNo; @@ -2387,17 +2395,17 @@ void UIHandleMercAttack( SOLDIERTYPE *pSoldier , SOLDIERTYPE *pTargetSoldier, UI LEVELNODE *pIntNode; STRUCTURE *pStructure; INT16 sGridNo, sNewGridNo; - UINT8 ubItemCursor; + UINT8 ubItemCursor; // get cursor - ubItemCursor = GetActionModeCursor( pSoldier ); + ubItemCursor = GetActionModeCursor( pSoldier ); if ( !(gTacticalStatus.uiFlags & INCOMBAT) && pTargetSoldier && Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass & IC_WEAPON ) { if ( NPCFirstDraw( pSoldier, pTargetSoldier ) ) { // go into turnbased for that person - CancelAIAction( pTargetSoldier, TRUE ); + CancelAIAction( pTargetSoldier, TRUE ); AddToShouldBecomeHostileOrSayQuoteList( pTargetSoldier->ubID ); //MakeCivHostile( pTargetSoldier, 2 ); //TriggerNPCWithIHateYouQuote( pTargetSoldier->ubProfile ); @@ -2406,7 +2414,7 @@ void UIHandleMercAttack( SOLDIERTYPE *pSoldier , SOLDIERTYPE *pTargetSoldier, UI } // Set aim time to one in UI - pSoldier->bAimTime = (pSoldier->bShownAimTime ); + pSoldier->aiData.bAimTime = (pSoldier->aiData.bShownAimTime ); usItem = pSoldier->inv[ HANDPOS ].usItem; // ATE: Check if we are targeting an interactive tile, and adjust gridno accordingly... @@ -2415,12 +2423,12 @@ void UIHandleMercAttack( SOLDIERTYPE *pSoldier , SOLDIERTYPE *pTargetSoldier, UI if ( pTargetSoldier != NULL ) { sTargetGridNo = pTargetSoldier->sGridNo; - bTargetLevel = pTargetSoldier->bLevel; + bTargetLevel = pTargetSoldier->pathing.bLevel; } else { - sTargetGridNo = usMapPos; - bTargetLevel = (INT8)gsInterfaceLevel; + sTargetGridNo = sMapPos; + bTargetLevel = (INT8)gsInterfaceLevel; if ( pIntNode != NULL ) { @@ -2430,7 +2438,7 @@ void UIHandleMercAttack( SOLDIERTYPE *pSoldier , SOLDIERTYPE *pTargetSoldier, UI } // here, change gridno if we're targeting ourselves.... - if ( pIntNode != NULL ) + if ( pIntNode != NULL ) { // Are we in the same gridno? if ( sGridNo == pSoldier->sGridNo && ubItemCursor != AIDCURS ) @@ -2486,10 +2494,10 @@ void UIHandleMercAttack( SOLDIERTYPE *pSoldier , SOLDIERTYPE *pTargetSoldier, UI if ( ( gTacticalStatus.uiFlags & INCOMBAT ) ) { // Reset some flags for cont move... - pSoldier->sFinalDestination = pSoldier->sGridNo; + pSoldier->pathing.sFinalDestination = pSoldier->sGridNo; pSoldier->bGoodContPath = FALSE; - // guiPendingOverrideEvent = A_CHANGE_TO_MOVE; - } + // guiPendingOverrideEvent = A_CHANGE_TO_MOVE; + } if (pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO ) @@ -2520,7 +2528,7 @@ void UIHandleMercAttack( SOLDIERTYPE *pSoldier , SOLDIERTYPE *pTargetSoldier, UI if ( gTacticalStatus.uiFlags & TURNBASED && !( gTacticalStatus.uiFlags & INCOMBAT ) ) { HandleUICursorRTFeedback( pSoldier ); - } + } gfUIForceReExamineCursorData = TRUE; } @@ -2538,20 +2546,20 @@ void AttackRequesterCallback( UINT8 bExitValue ) UINT32 UIHandleCAMercShoot( UI_EVENT *pUIEvent ) { - UINT16 usMapPos; + INT16 sMapPos; SOLDIERTYPE *pSoldier, *pTSoldier = NULL; BOOLEAN fDidRequester = FALSE; if ( gusSelectedSoldier != NOBODY ) { - if( !GetMouseMapPos( &usMapPos) ) + if( !GetMouseMapPos( &sMapPos) ) { return( GAME_SCREEN ); } // Get soldier - if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) + if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { // Get target guy... if ( gfUIFullTargetFound ) @@ -2568,9 +2576,9 @@ UINT32 UIHandleCAMercShoot( UI_EVENT *pUIEvent ) { CHAR16 zStr[200]; - gpRequesterMerc = pSoldier; + gpRequesterMerc = pSoldier; gpRequesterTargetMerc = pTSoldier; - gsRequesterGridNo = usMapPos; + gsRequesterGridNo = sMapPos; fDidRequester = TRUE; @@ -2583,7 +2591,7 @@ UINT32 UIHandleCAMercShoot( UI_EVENT *pUIEvent ) if ( !fDidRequester ) { - UIHandleMercAttack( pSoldier, pTSoldier, usMapPos ); + UIHandleMercAttack( pSoldier, pTSoldier, sMapPos ); } } } @@ -2596,10 +2604,10 @@ UINT32 UIHandleAEndAction( UI_EVENT *pUIEvent ) { SOLDIERTYPE *pSoldier; INT16 sTargetXPos, sTargetYPos; - UINT16 usMapPos; + INT16 sMapPos; // Get gridno at this location - if( !GetMouseMapPos( &usMapPos) ) + if( !GetMouseMapPos( &sMapPos) ) { return( GAME_SCREEN ); } @@ -2613,10 +2621,10 @@ UINT32 UIHandleAEndAction( UI_EVENT *pUIEvent ) { // Move to proper stance + direction! // Convert our grid-not into an XY - ConvertGridNoToXY( usMapPos, &sTargetXPos, &sTargetYPos ); + ConvertGridNoToXY( sMapPos, &sTargetXPos, &sTargetYPos ); // UNReady weapon - SoldierReadyWeapon( pSoldier, sTargetXPos, sTargetYPos, TRUE ); + pSoldier->SoldierReadyWeapon( sTargetXPos, sTargetYPos, TRUE ); gUITargetReady = FALSE; } @@ -2642,10 +2650,10 @@ UINT32 UIHandleCAEndConfirmAction( UI_EVENT *pUIEvent ) UINT32 UIHandleIOnTerrain( UI_EVENT *pUIEvent ) { - UINT16 usMapPos; + INT16 sMapPos; // Get gridno at this location - if( !GetMouseMapPos( &usMapPos) ) + if( !GetMouseMapPos( &sMapPos) ) { return( GAME_SCREEN ); } @@ -2654,9 +2662,9 @@ UINT32 UIHandleIOnTerrain( UI_EVENT *pUIEvent ) if ( !UIHandleOnMerc( TRUE ) ) { // Check if dest is OK - //if ( !NewOKDestination( usMapPos, FALSE ) || IsRoofVisible( usMapPos ) ) + //if ( !NewOKDestination( sMapPos, FALSE ) || IsRoofVisible( sMapPos ) ) ////{ - // guiNewUICursor = CANNOT_MOVE_UICURSOR; + // guiNewUICursor = CANNOT_MOVE_UICURSOR; //} //else { @@ -2676,7 +2684,6 @@ UINT32 UIHandlePADJAdjustStance( UI_EVENT *pUIEvent ) { SOLDIERTYPE *pSoldier; UINT8 ubNewStance; - BOOLEAN fChangeStance = FALSE; guiShowUPDownArrows = ARROWS_HIDE_UP | ARROWS_HIDE_DOWN; @@ -2686,17 +2693,17 @@ UINT32 UIHandlePADJAdjustStance( UI_EVENT *pUIEvent ) if ( gusSelectedSoldier != NOBODY && gbAdjustStanceDiff != 0 ) { // Get soldier - if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) + if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { ubNewStance = GetAdjustedAnimHeight( gAnimControl[ pSoldier->usAnimState ].ubEndHeight, gbAdjustStanceDiff ); if ( gbClimbID == 1 ) { - BeginSoldierClimbUpRoof( pSoldier ); + pSoldier->BeginSoldierClimbUpRoof( ); } else if ( gbClimbID == -1 ) { - BeginSoldierClimbDownRoof( pSoldier ); + pSoldier->BeginSoldierClimbDownRoof( ); } else { @@ -2730,7 +2737,7 @@ UINT8 GetAdjustedAnimHeight( UINT8 ubAnimHeight, INT8 bChange ) } if ( bChange == 1 ) { - ubNewAnimHeight = 50; + ubNewAnimHeight = 50; } } else if ( ubAnimHeight == ANIM_CROUCH ) @@ -2752,7 +2759,7 @@ UINT8 GetAdjustedAnimHeight( UINT8 ubAnimHeight, INT8 bChange ) { if ( bChange == -1 ) { - ubNewAnimHeight = 55; + ubNewAnimHeight = 55; } if ( bChange == 1 ) { @@ -2770,9 +2777,9 @@ UINT8 GetAdjustedAnimHeight( UINT8 ubAnimHeight, INT8 bChange ) void HandleObjectHighlighting( ) { SOLDIERTYPE *pSoldier; - UINT16 usMapPos; + INT16 sMapPos; - if( !GetMouseMapPos( &usMapPos) ) + if( !GetMouseMapPos( &sMapPos) ) { return; } @@ -2784,7 +2791,7 @@ void HandleObjectHighlighting( ) GetSoldier( &pSoldier, gusUIFullTargetID ); // If an enemy, and in a given mode, highlight - if ( guiUIFullTargetFlags & ENEMY_MERC ) + if ( guiUIFullTargetFlags & ENEMY_MERC ) { switch( gCurrentUIMode ) { @@ -2824,12 +2831,12 @@ void AdjustSoldierCreationStartValues( ) guiCreateGuyIndex = (INT16)cnt; for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; pSoldier++, cnt++ ) - { + { if ( !pSoldier->bActive ) { guiCreateGuyIndex = (INT16)cnt; break; - } + } } cnt = gTacticalStatus.Team[ gbPlayerNum ].bLastID + 1; @@ -2841,7 +2848,7 @@ void AdjustSoldierCreationStartValues( ) { guiCreateBadGuyIndex = (INT16)cnt; break; - } + } } } @@ -2850,9 +2857,8 @@ BOOLEAN SelectedMercCanAffordAttack( ) { SOLDIERTYPE *pSoldier; SOLDIERTYPE *pTargetSoldier; - UINT16 usMapPos; + INT16 sMapPos; INT16 sTargetGridNo; - BOOLEAN fEnoughPoints = TRUE; INT16 sAPCost; UINT8 ubItemCursor; UINT16 usInHand; @@ -2860,19 +2866,19 @@ BOOLEAN SelectedMercCanAffordAttack( ) if ( gusSelectedSoldier != NOBODY ) { - if( !GetMouseMapPos( &usMapPos) ) + if( !GetMouseMapPos( &sMapPos) ) { return( GAME_SCREEN ); } // Get soldier - if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) + if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { // LOOK IN GUY'S HAND TO CHECK LOCATION usInHand = pSoldier->inv[HANDPOS].usItem; // Get cursor value - ubItemCursor = GetActionModeCursor( pSoldier ); + ubItemCursor = GetActionModeCursor( pSoldier ); if ( ubItemCursor == INVALIDCURS ) { @@ -2882,7 +2888,7 @@ BOOLEAN SelectedMercCanAffordAttack( ) if ( ubItemCursor == BOMBCURS ) { // Check as... - if ( EnoughPoints( pSoldier, GetTotalAPsToDropBomb( pSoldier, usMapPos ), 0, TRUE ) ) + if ( EnoughPoints( pSoldier, GetTotalAPsToDropBomb( pSoldier, sMapPos ), 0, TRUE ) ) { return( TRUE ); } @@ -2906,10 +2912,10 @@ BOOLEAN SelectedMercCanAffordAttack( ) } else { - sTargetGridNo = usMapPos; + sTargetGridNo = sMapPos; } - sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, TRUE, (INT8)(pSoldier->bShownAimTime ) ); + sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, TRUE, (INT8)(pSoldier->aiData.bShownAimTime ) ); if ( EnoughPoints( pSoldier, sAPCost, 0, TRUE ) ) { @@ -2918,7 +2924,7 @@ BOOLEAN SelectedMercCanAffordAttack( ) else { // Play curse.... - DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); } } } @@ -2929,18 +2935,17 @@ BOOLEAN SelectedMercCanAffordAttack( ) } -BOOLEAN SelectedMercCanAffordMove( ) +BOOLEAN SelectedMercCanAffordMove( ) { SOLDIERTYPE *pSoldier; UINT16 sAPCost = 0; - INT16 sBPCost = 0; - UINT16 usMapPos; + INT16 sMapPos; LEVELNODE *pIntTile; // Get soldier - if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) + if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { - if( !GetMouseMapPos( &usMapPos) ) + if( !GetMouseMapPos( &sMapPos) ) { return( GAME_SCREEN ); } @@ -2970,11 +2975,11 @@ BOOLEAN SelectedMercCanAffordMove( ) if ( EnoughPoints( pSoldier, sAPCost, 0 , TRUE ) ) { return( TRUE ); - } + } else { // OK, remember where we were trying to get to..... - pSoldier->sContPathLocation = usMapPos; + pSoldier->sContPathLocation = sMapPos; pSoldier->bGoodContPath = TRUE; } } @@ -2988,7 +2993,7 @@ void GetMercClimbDirection( UINT8 ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoU SOLDIERTYPE *pSoldier; *pfGoDown = FALSE; - *pfGoUp = FALSE; + *pfGoUp = FALSE; if ( !GetSoldier( &pSoldier, ubSoldierID ) ) { @@ -2996,7 +3001,7 @@ void GetMercClimbDirection( UINT8 ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoU } // Check if we are close / can climb - if ( pSoldier->bLevel == 0 ) + if ( pSoldier->pathing.bLevel == 0 ) { // See if we are not in a building! if ( FindHeigherLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) ) @@ -3006,7 +3011,7 @@ void GetMercClimbDirection( UINT8 ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoU } // IF we are higher... - if ( pSoldier->bLevel > 0 ) + if ( pSoldier->pathing.bLevel > 0 ) { if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) ) { @@ -3032,15 +3037,15 @@ UINT32 UIHandlePOPUPMSG( UI_EVENT *pUIEvent ) UINT32 UIHandleHCOnTerrain( UI_EVENT *pUIEvent ) { - UINT16 usMapPos; + INT16 sMapPos; SOLDIERTYPE *pSoldier; - if( !GetMouseMapPos( &usMapPos) ) + if( !GetMouseMapPos( &sMapPos) ) { return( GAME_SCREEN ); } - if ( !GetSoldier( &pSoldier, gusSelectedSoldier ) ) + if ( !GetSoldier( &pSoldier, gusSelectedSoldier ) ) { return( GAME_SCREEN ); } @@ -3052,7 +3057,7 @@ UINT32 UIHandleHCOnTerrain( UI_EVENT *pUIEvent ) } else { - if ( gsOverItemsGridNo != NOWHERE && ( usMapPos != gsOverItemsGridNo || gsInterfaceLevel != gsOverItemsLevel ) ) + if ( gsOverItemsGridNo != NOWHERE && ( sMapPos != gsOverItemsGridNo || gsInterfaceLevel != gsOverItemsLevel ) ) { gsOverItemsGridNo = NOWHERE; guiPendingOverrideEvent = A_CHANGE_TO_MOVE; @@ -3061,7 +3066,7 @@ UINT32 UIHandleHCOnTerrain( UI_EVENT *pUIEvent ) { guiNewUICursor = NORMALHANDCURSOR_UICURSOR; - UIHandleInteractiveTilesAndItemsOnTerrain( pSoldier, usMapPos, TRUE, FALSE ); + UIHandleInteractiveTilesAndItemsOnTerrain( pSoldier, sMapPos, TRUE, FALSE ); } } return( GAME_SCREEN ); @@ -3099,9 +3104,9 @@ UINT32 UIHandleOpenDoorMenu( UI_EVENT *pUIEvent ) return( GAME_SCREEN ); } -void ToggleHandCursorMode( UINT32 *puiNewEvent ) +void ToggleHandCursorMode( UINT32 *puiNewEvent ) { - // Toggle modes + // Toggle modes if ( gCurrentUIMode == HANDCURSOR_MODE ) { *puiNewEvent = A_CHANGE_TO_MOVE; @@ -3113,12 +3118,12 @@ void ToggleHandCursorMode( UINT32 *puiNewEvent ) } } -void ToggleTalkCursorMode( UINT32 *puiNewEvent ) +void ToggleTalkCursorMode( UINT32 *puiNewEvent ) { - // Toggle modes + // Toggle modes if ( gCurrentUIMode == TALKCURSOR_MODE ) { - *puiNewEvent = A_CHANGE_TO_MOVE; + *puiNewEvent = A_CHANGE_TO_MOVE; } else { @@ -3126,9 +3131,9 @@ void ToggleTalkCursorMode( UINT32 *puiNewEvent ) } } -void ToggleLookCursorMode( UINT32 *puiNewEvent ) +void ToggleLookCursorMode( UINT32 *puiNewEvent ) { - // Toggle modes + // Toggle modes if ( gCurrentUIMode == LOOKCURSOR_MODE ) { guiPendingOverrideEvent = A_CHANGE_TO_MOVE; @@ -3147,10 +3152,10 @@ BOOLEAN UIHandleOnMerc( BOOLEAN fMovementMode ) SOLDIERTYPE *pSoldier; UINT16 usSoldierIndex; UINT32 uiMercFlags; - UINT16 usMapPos; + INT16 sMapPos; BOOLEAN fFoundMerc = FALSE; - if( !GetMouseMapPos( &usMapPos) ) + if( !GetMouseMapPos( &sMapPos) ) { return( GAME_SCREEN ); } @@ -3200,11 +3205,11 @@ BOOLEAN UIHandleOnMerc( BOOLEAN fMovementMode ) gfUIHandleSelection = SELECTED_GUY_SELECTION; if ( gpItemPointer == NULL ) - { + { // Don't do this unless we want to // Check if buddy is stationary! - if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_STATIONARY || pSoldier->fNoAPToFinishMove ) + if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_STATIONARY || pSoldier->flags.fNoAPToFinishMove ) { guiShowUPDownArrows = ARROWS_SHOW_DOWN_BESIDE | ARROWS_SHOW_UP_BESIDE; } @@ -3240,7 +3245,7 @@ BOOLEAN UIHandleOnMerc( BOOLEAN fMovementMode ) guiNewUICursor = NO_UICURSOR; gsSelectedGridNo = pSoldier->sGridNo; - gsSelectedLevel = pSoldier->bLevel; + gsSelectedLevel = pSoldier->pathing.bLevel; } gsSelectedGuy = usSoldierIndex; @@ -3261,7 +3266,7 @@ BOOLEAN UIHandleOnMerc( BOOLEAN fMovementMode ) { // Check if this guy is on the enemy team.... - if ( !pSoldier->bNeutral && (pSoldier->bSide != gbPlayerNum ) ) + if ( !pSoldier->aiData.bNeutral && (pSoldier->bSide != gbPlayerNum ) ) { gUIActionModeChangeDueToMouseOver = TRUE; @@ -3279,7 +3284,7 @@ BOOLEAN UIHandleOnMerc( BOOLEAN fMovementMode ) // Show cursor with highlight gfUIHandleSelection = ENEMY_GUY_SELECTION; gsSelectedGridNo = pSoldier->sGridNo; - gsSelectedLevel = pSoldier->bLevel; + gsSelectedLevel = pSoldier->pathing.bLevel; } } @@ -3289,7 +3294,7 @@ BOOLEAN UIHandleOnMerc( BOOLEAN fMovementMode ) } else { - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { return( FALSE ); } @@ -3300,7 +3305,7 @@ BOOLEAN UIHandleOnMerc( BOOLEAN fMovementMode ) gfIgnoreOnSelectedGuy = FALSE; return( FALSE ); - } + } return( TRUE ); } @@ -3360,23 +3365,23 @@ void UIHandleSoldierStanceChange( UINT8 ubSoldierID, INT8 bNewStance ) } else { - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) + { + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ VEHICLES_NO_STANCE_CHANGE_STR ] ); + } + else if ( pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) + { + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ ROBOT_NO_STANCE_CHANGE_STR ] ); + } + else + { + if ( pSoldier->bCollapsed ) { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ VEHICLES_NO_STANCE_CHANGE_STR ] ); - } - else if ( pSoldier->uiStatusFlags & SOLDIER_ROBOT ) - { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ ROBOT_NO_STANCE_CHANGE_STR ] ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, pMessageStrings[ MSG_CANT_CHANGE_STANCE ], pSoldier->name ); } else { - if ( pSoldier->bCollapsed ) - { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, pMessageStrings[ MSG_CANT_CHANGE_STANCE ], pSoldier->name ); - } - else - { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ CANNOT_STANCE_CHANGE_STR ], pSoldier->name ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ CANNOT_STANCE_CHANGE_STR ], pSoldier->name ); } } } @@ -3386,16 +3391,16 @@ void UIHandleSoldierStanceChange( UINT8 ubSoldierID, INT8 bNewStance ) // IF turn-based - adjust stance now! if ( gTacticalStatus.uiFlags & TURNBASED && ( gTacticalStatus.uiFlags & INCOMBAT ) ) { - pSoldier->bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; + pSoldier->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; // Check if we have enough APS if ( SoldierCanAffordNewStance( pSoldier, bNewStance ) ) { // Adjust stance - //ChangeSoldierStance( pSoldier, bNewStance ); + //pSoldier->ChangeSoldierStance( bNewStance ); SendChangeSoldierStanceEvent( pSoldier, bNewStance ); - pSoldier->sFinalDestination = pSoldier->sGridNo; + pSoldier->pathing.sFinalDestination = pSoldier->sGridNo; pSoldier->bGoodContPath = FALSE; } @@ -3419,14 +3424,14 @@ void UIHandleSoldierStanceChange( UINT8 ubSoldierID, INT8 bNewStance ) // Pick moving animation based on stance // LOCK VARIBLE FOR NO UPDATE INDEX... - pSoldier->usUIMovementMode = GetMoveStateBasedOnStance( pSoldier, bNewStance ); + pSoldier->usUIMovementMode = pSoldier->GetMoveStateBasedOnStance( bNewStance ); pSoldier->ubDesiredHeight = NO_DESIRED_HEIGHT; #if 0 if ( pSoldier->usUIMovementMode == CRAWLING && gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_PRONE ) { pSoldier->usDontUpdateNewGridNoOnMoveAnimChange = LOCKED_NO_NEWGRIDNO; - pSoldier->bPathStored = FALSE; + pSoldier->pathing.bPathStored = FALSE; } else #endif @@ -3435,7 +3440,7 @@ void UIHandleSoldierStanceChange( UINT8 ubSoldierID, INT8 bNewStance ) } - ChangeSoldierState( pSoldier, pSoldier->usUIMovementMode, 0, FALSE ); + pSoldier->ChangeSoldierState( pSoldier->usUIMovementMode, 0, FALSE ); } } @@ -3446,9 +3451,9 @@ void UIHandleSoldierStanceChange( UINT8 ubSoldierID, INT8 bNewStance ) gfUIStanceDifferent = TRUE; // ATE: If we are being serviced...stop... - // InternalReceivingSoldierCancelServices( pSoldier, FALSE ); - InternalGivingSoldierCancelServices( pSoldier, FALSE ); - //gfPlotNewMovement = TRUE; + // pSoldier->InternalReceivingSoldierCancelServices(, FALSE ); + pSoldier->InternalGivingSoldierCancelServices( FALSE ); + //gfPlotNewMovement = TRUE; } @@ -3497,16 +3502,16 @@ UINT32 UIHandleILoadFifthLevel( UI_EVENT *pUIEvent ) void GetCursorMovementFlags( UINT32 *puiCursorFlags ) { - UINT16 usMapPos; + INT16 sMapPos; INT16 sXPos, sYPos; - static BOOLEAN fStationary = FALSE; - static UINT16 usOldMouseXPos = 32000; - static UINT16 usOldMouseYPos = 32000; - static UINT16 usOldMapPos = 32000; + static BOOLEAN fStationary = FALSE; + static UINT16 usOldMouseXPos = 32000; + static UINT16 usOldMouseYPos = 32000; + static UINT16 usOldMapPos = 32000; - static UINT32 uiSameFrameCursorFlags; - static UINT32 uiOldFrameNumber = 99999; + static UINT32 uiSameFrameCursorFlags; + static UINT32 uiOldFrameNumber = 99999; // Check if this is the same frame as before, return already calculated value if so! if ( uiOldFrameNumber == guiGameCycleCounter ) @@ -3515,8 +3520,8 @@ void GetCursorMovementFlags( UINT32 *puiCursorFlags ) return; } - GetMouseMapPos( &usMapPos ); - ConvertGridNoToXY( usMapPos, &sXPos, &sYPos ); + GetMouseMapPos( &sMapPos ); + ConvertGridNoToXY( sMapPos, &sXPos, &sYPos ); *puiCursorFlags = 0; @@ -3525,24 +3530,24 @@ void GetCursorMovementFlags( UINT32 *puiCursorFlags ) (*puiCursorFlags ) |= MOUSE_MOVING; // IF CURSOR WAS PREVIOUSLY STATIONARY, MAKE THE ADDITIONAL CHECK OF GRID POS CHANGE - if ( fStationary && usOldMapPos == usMapPos ) + if ( fStationary && usOldMapPos == sMapPos ) { - (*puiCursorFlags) |= MOUSE_MOVING_IN_TILE; + (*puiCursorFlags) |= MOUSE_MOVING_IN_TILE; } else { fStationary = FALSE; - (*puiCursorFlags) |= MOUSE_MOVING_NEW_TILE; + (*puiCursorFlags) |= MOUSE_MOVING_NEW_TILE; } } else { - (*puiCursorFlags) |= MOUSE_STATIONARY; + (*puiCursorFlags) |= MOUSE_STATIONARY; fStationary = TRUE; } - usOldMapPos = usMapPos; + usOldMapPos = sMapPos; usOldMouseXPos = gusMouseXPos; usOldMouseYPos = gusMouseYPos; @@ -3550,14 +3555,12 @@ void GetCursorMovementFlags( UINT32 *puiCursorFlags ) uiSameFrameCursorFlags = (*puiCursorFlags); } -BOOLEAN HandleUIMovementCursor( SOLDIERTYPE *pSoldier, UINT32 uiCursorFlags, UINT16 usMapPos, UINT32 uiFlags ) +BOOLEAN HandleUIMovementCursor( SOLDIERTYPE *pSoldier, UINT32 uiCursorFlags, INT16 sMapPos, UINT32 uiFlags ) { BOOLEAN fSetCursor = FALSE; - BOOLEAN fCalculated = FALSE; static UINT16 usTargetID = NOBODY; static BOOLEAN fTargetFound = FALSE; BOOLEAN fTargetFoundAndLookingForOne = FALSE; - BOOLEAN fIntTileFoundAndLookingForOne = FALSE; // Determine if we can afford! if ( !EnoughPoints( pSoldier, gsCurrentActionPoints, 0, FALSE ) ) @@ -3566,7 +3569,7 @@ BOOLEAN HandleUIMovementCursor( SOLDIERTYPE *pSoldier, UINT32 uiCursorFlags, UIN } // Check if we're stationary - if ( ( ( gTacticalStatus.uiFlags & REALTIME ) || !( gTacticalStatus.uiFlags & INCOMBAT ) ) || ( ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_STATIONARY ) || pSoldier->fNoAPToFinishMove ) || pSoldier->ubID >= MAX_NUM_SOLDIERS ) + if ( ( ( gTacticalStatus.uiFlags & REALTIME ) || !( gTacticalStatus.uiFlags & INCOMBAT ) ) || ( ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_STATIONARY ) || pSoldier->flags.fNoAPToFinishMove ) || pSoldier->ubID >= MAX_NUM_SOLDIERS ) { // If we are targeting a merc for some reason, don't go thorugh normal channels if we are on someone now if ( uiFlags == MOVEUI_TARGET_MERCS || uiFlags == MOVEUI_TARGET_MERCSFORAID ) @@ -3579,12 +3582,12 @@ BOOLEAN HandleUIMovementCursor( SOLDIERTYPE *pSoldier, UINT32 uiCursorFlags, UIN ErasePath( TRUE ); // Try and get a path right away - DrawUIMovementPath( pSoldier, usMapPos, uiFlags ); + DrawUIMovementPath( pSoldier, sMapPos, uiFlags ); } // Save for next time... fTargetFound = gfUIFullTargetFound; - usTargetID = gusUIFullTargetID; + usTargetID = gusUIFullTargetID; if ( fTargetFound ) { @@ -3593,9 +3596,9 @@ BOOLEAN HandleUIMovementCursor( SOLDIERTYPE *pSoldier, UINT32 uiCursorFlags, UIN } if ( uiFlags == MOVEUI_TARGET_ITEMS ) - { + { gfUIOverItemPool = TRUE; - gfUIOverItemPoolGridNo = usMapPos; + gfUIOverItemPoolGridNo = sMapPos; } else if ( uiFlags == MOVEUI_TARGET_MERCSFORAID ) { @@ -3610,7 +3613,7 @@ BOOLEAN HandleUIMovementCursor( SOLDIERTYPE *pSoldier, UINT32 uiCursorFlags, UIN fSetCursor = TRUE; // IF CURSOR WAS PREVIOUSLY STATIONARY, MAKE THE ADDITIONAL CHECK OF GRID POS CHANGE - if ( ( ( uiCursorFlags & MOUSE_MOVING_NEW_TILE ) && !fTargetFoundAndLookingForOne ) || gfUINewStateForIntTile ) + if ( ( ( uiCursorFlags & MOUSE_MOVING_NEW_TILE ) && !fTargetFoundAndLookingForOne ) || gfUINewStateForIntTile ) { // ERASE PATH ErasePath( TRUE ); @@ -3650,9 +3653,9 @@ BOOLEAN HandleUIMovementCursor( SOLDIERTYPE *pSoldier, UINT32 uiCursorFlags, UIN // Reset counter RESETCOUNTER( PATHFINDCOUNTER ); - if ( gfPlotNewMovement ) + if ( gfPlotNewMovement ) { - DrawUIMovementPath( pSoldier, usMapPos, uiFlags ); + DrawUIMovementPath( pSoldier, sMapPos, uiFlags ); gfPlotNewMovement = FALSE; } @@ -3690,7 +3693,7 @@ BOOLEAN HandleUIMovementCursor( SOLDIERTYPE *pSoldier, UINT32 uiCursorFlags, UIN gUIDisplayActionPointsOffX = 22; gUIDisplayActionPointsOffY = 15; } - else + else { switch ( pSoldier->usUIMovementMode ) { @@ -3723,8 +3726,8 @@ BOOLEAN HandleUIMovementCursor( SOLDIERTYPE *pSoldier, UINT32 uiCursorFlags, UIN if(pSoldier->bDoAutofire) //reset the autofire bullet count { - pSoldier->autofireLastStep = FALSE; - pSoldier->bDoAutofire = 1; + pSoldier->flags.autofireLastStep = FALSE; + pSoldier->bDoAutofire = 1; } return( fSetCursor ); @@ -3732,12 +3735,11 @@ BOOLEAN HandleUIMovementCursor( SOLDIERTYPE *pSoldier, UINT32 uiCursorFlags, UIN -INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiFlags ) +INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, INT16 sMapPos, UINT32 uiFlags ) { INT16 sAPCost, sBPCost; INT16 sActionGridNo; STRUCTURE *pStructure; - BOOLEAN fOnInterTile = FALSE; UINT8 ubDirection; // ITEM_POOL *pItemPool; INT16 sAdjustedGridNo = -1; @@ -3749,14 +3751,14 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiFlags if ( (gTacticalStatus.uiFlags & INCOMBAT ) && ( gTacticalStatus.uiFlags & TURNBASED ) || _KeyDown( SHIFT ) ) { - fPlot = PLOT; + fPlot = PLOT; } else { fPlot = NO_PLOT; } - sActionGridNo = usMapPos; + sActionGridNo = sMapPos; sAPCost = 0; ErasePath( FALSE ); @@ -3770,7 +3772,7 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiFlags // We should not have null here if we are given this flag... if ( pIntTile != NULL ) { - sActionGridNo = FindAdjacentGridEx( pSoldier, sIntTileGridNo, &ubDirection, NULL, FALSE, TRUE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, sIntTileGridNo, &ubDirection, NULL, FALSE, TRUE ); if ( sActionGridNo == -1 ) { sActionGridNo = sIntTileGridNo; @@ -3795,7 +3797,7 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiFlags } else if ( uiFlags == MOVEUI_TARGET_WIREFENCE ) { - sActionGridNo = FindAdjacentGridEx( pSoldier, usMapPos, &ubDirection, NULL, FALSE, TRUE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, sMapPos, &ubDirection, NULL, FALSE, TRUE ); if ( sActionGridNo == -1 ) { sAPCost = 0; @@ -3815,10 +3817,10 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiFlags } else if ( uiFlags == MOVEUI_TARGET_JAR ) { - sActionGridNo = FindAdjacentGridEx( pSoldier, usMapPos, &ubDirection, NULL, FALSE, TRUE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, sMapPos, &ubDirection, NULL, FALSE, TRUE ); if ( sActionGridNo == -1 ) { - sActionGridNo = usMapPos; + sActionGridNo = sMapPos; } sAPCost = GetAPsToUseJar( pSoldier, sActionGridNo ); @@ -3839,7 +3841,7 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiFlags // We should not have null here if we are given this flag... if ( pIntTile != NULL ) { - sActionGridNo = FindAdjacentGridEx( pSoldier, sIntTileGridNo, &ubDirection, NULL, FALSE, TRUE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, sIntTileGridNo, &ubDirection, NULL, FALSE, TRUE ); if ( sActionGridNo != -1 ) { sAPCost = AP_ATTACH_CAN; @@ -3861,7 +3863,7 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiFlags else if ( uiFlags == MOVEUI_TARGET_REPAIR ) { // For repair, check if we are over a vehicle, then get gridnot to edge of that vehicle! - if ( IsRepairableStructAtGridNo( usMapPos, &ubMercID ) == 2 ) + if ( IsRepairableStructAtGridNo( sMapPos, &ubMercID ) == 2 ) { INT16 sNewGridNo; UINT8 ubDirection; @@ -3870,14 +3872,14 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiFlags if ( sNewGridNo != NOWHERE ) { - usMapPos = sNewGridNo; + sMapPos = sNewGridNo; } } - sActionGridNo = FindAdjacentGridEx( pSoldier, usMapPos, &ubDirection, NULL, FALSE, TRUE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, sMapPos, &ubDirection, NULL, FALSE, TRUE ); if ( sActionGridNo == -1 ) { - sActionGridNo = usMapPos; + sActionGridNo = sMapPos; } sAPCost = GetAPsToBeginRepair( pSoldier ); @@ -3893,7 +3895,7 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiFlags else if ( uiFlags == MOVEUI_TARGET_REFUEL ) { // For repair, check if we are over a vehicle, then get gridnot to edge of that vehicle! - if ( IsRefuelableStructAtGridNo( usMapPos, &ubMercID ) == 2 ) + if ( IsRefuelableStructAtGridNo( sMapPos, &ubMercID ) == 2 ) { INT16 sNewGridNo; UINT8 ubDirection; @@ -3902,14 +3904,14 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiFlags if ( sNewGridNo != NOWHERE ) { - usMapPos = sNewGridNo; + sMapPos = sNewGridNo; } } - sActionGridNo = FindAdjacentGridEx( pSoldier, usMapPos, &ubDirection, NULL, FALSE, TRUE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, sMapPos, &ubDirection, NULL, FALSE, TRUE ); if ( sActionGridNo == -1 ) { - sActionGridNo = usMapPos; + sActionGridNo = sMapPos; } sAPCost = GetAPsToRefuelVehicle( pSoldier ); @@ -3931,7 +3933,7 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiFlags if ( gfUIFullTargetFound ) { INT32 cnt; - INT16 sSpot; + INT16 sSpot; UINT8 ubGuyThere; for ( cnt = 0; cnt < NUM_WORLD_DIRECTIONS; cnt++ ) @@ -3946,7 +3948,7 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiFlags // Check for who is there... - ubGuyThere = WhoIsThere2( sSpot, pSoldier->bLevel ); + ubGuyThere = WhoIsThere2( sSpot, pSoldier->pathing.bLevel ); if ( ubGuyThere == MercPtrs[ gusUIFullTargetID ]->ubID ) { @@ -3961,7 +3963,7 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiFlags if ( sGotLocation == NOWHERE ) { - sActionGridNo = FindAdjacentGridEx( pSoldier, MercPtrs[ gusUIFullTargetID ]->sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, MercPtrs[ gusUIFullTargetID ]->sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); if ( sActionGridNo == -1 ) { @@ -3976,7 +3978,7 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiFlags } else { - sAdjustedGridNo = usMapPos; + sAdjustedGridNo = sMapPos; sGotLocation = sActionGridNo; fGotAdjacent = TRUE; } @@ -4002,7 +4004,7 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiFlags // Check if we are on a target if ( gfUIFullTargetFound ) { - sActionGridNo = FindAdjacentGridEx( pSoldier, MercPtrs[ gusUIFullTargetID ]->sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, MercPtrs[ gusUIFullTargetID ]->sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); if ( sActionGridNo == -1 ) { sActionGridNo = sAdjustedGridNo; @@ -4025,21 +4027,21 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiFlags else if ( uiFlags == MOVEUI_TARGET_BOMB ) { sAPCost += GetAPsToDropBomb( pSoldier ); - sAPCost += UIPlotPath( pSoldier, usMapPos, NO_COPYROUTE, fPlot, TEMPORARY, (UINT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ); + sAPCost += UIPlotPath( pSoldier, sMapPos, NO_COPYROUTE, fPlot, TEMPORARY, (UINT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ); gfUIHandleShowMoveGrid = TRUE; - gsUIHandleShowMoveGridLocation = usMapPos; + gsUIHandleShowMoveGridLocation = sMapPos; } else if ( uiFlags == MOVEUI_TARGET_MERCSFORAID ) { if ( gfUIFullTargetFound ) { - sActionGridNo = FindAdjacentGridEx( pSoldier, MercPtrs[ gusUIFullTargetID ]->sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, MercPtrs[ gusUIFullTargetID ]->sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); // Try again at another gridno... if ( sActionGridNo == -1 ) { - sActionGridNo = FindAdjacentGridEx( pSoldier, usMapPos, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, sMapPos, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); if ( sActionGridNo == -1 ) { @@ -4057,7 +4059,7 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiFlags } else if ( uiFlags == MOVEUI_TARGET_ITEMS ) { - //if ( GetItemPool( usMapPos, &pItemPool, pSoldier->bLevel ) ) + //if ( GetItemPool( sMapPos, &pItemPool, pSoldier->pathing.bLevel ) ) { //if ( ITEMPOOL_VISIBLE( pItemPool ) ) { @@ -4112,9 +4114,9 @@ INT16 APsToTurnAround(SOLDIERTYPE *pSoldier, INT16 sAdjustedGridNo) UINT8 ubDirection = (UINT8)GetDirectionFromGridNo( sAdjustedGridNo, pSoldier ); // If new direction is not the same than the old direction - if ( pSoldier->bDesiredDirection != ubDirection) + if ( pSoldier->pathing.bDesiredDirection != ubDirection) { - if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ( ANIM_BREATH | ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_FIREREADY ) && !fInitalMove && !pSoldier->fDontChargeTurningAPs ) + if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ( ANIM_BREATH | ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_FIREREADY ) && !fInitalMove && !pSoldier->flags.fDontChargeTurningAPs ) { // Which position has the soldier? switch( gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) @@ -4142,9 +4144,9 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ) BOOLEAN fGuyHere = FALSE; SOLDIERTYPE *pTSoldier; UINT8 ubItemCursor; - UINT16 usMapPos; + INT16 sMapPos; - if ( !GetMouseMapPos( &usMapPos ) ) + if ( !GetMouseMapPos( &sMapPos ) ) { return( FALSE ); } @@ -4153,7 +4155,7 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ) usInHand = pSoldier->inv[HANDPOS].usItem; // Get cursor value - ubItemCursor = GetActionModeCursor( pSoldier ); + ubItemCursor = GetActionModeCursor( pSoldier ); if ( ubItemCursor == INVALIDCURS ) { @@ -4163,7 +4165,7 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ) if ( ubItemCursor == WIRECUTCURS ) { - if ( IsCuttableWireFenceAtGridNo( usMapPos ) && pSoldier->bLevel == 0 ) + if ( IsCuttableWireFenceAtGridNo( sMapPos ) && pSoldier->pathing.bLevel == 0 ) { return( TRUE ); } @@ -4177,10 +4179,10 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ) { if ( gfUIFullTargetFound ) { - usMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; + sMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; } - if ( IsRepairableStructAtGridNo( usMapPos, NULL ) && pSoldier->bLevel == 0 ) + if ( IsRepairableStructAtGridNo( sMapPos, NULL ) && pSoldier->pathing.bLevel == 0 ) { return( TRUE ); } @@ -4194,10 +4196,10 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ) { if ( gfUIFullTargetFound ) { - usMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; + sMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; } - if ( IsRefuelableStructAtGridNo( usMapPos, NULL ) && pSoldier->bLevel == 0 ) + if ( IsRefuelableStructAtGridNo( sMapPos, NULL ) && pSoldier->pathing.bLevel == 0 ) { return( TRUE ); } @@ -4209,25 +4211,25 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ) if ( ubItemCursor == BOMBCURS ) { - if ( usMapPos == pSoldier->sGridNo ) + if ( sMapPos == pSoldier->sGridNo ) { return( TRUE ); } - if ( !NewOKDestination( pSoldier, usMapPos, TRUE, pSoldier->bLevel ) ) + if ( !NewOKDestination( pSoldier, sMapPos, TRUE, pSoldier->pathing.bLevel ) ) { return( FALSE ); } } // SEE IF THERE IS SOMEBODY HERE - if ( gfUIFullTargetFound && ubItemCursor != KNIFECURS ) + if ( gfUIFullTargetFound && ubItemCursor != KNIFECURS ) { fGuyHere = TRUE; if ( guiUIFullTargetFlags & SELECTED_MERC && Item[ usInHand ].usItemClass != IC_MEDKIT ) { - return( FALSE ); + return( FALSE ); } } @@ -4236,7 +4238,7 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ) return( FALSE ); } - //if ( Item[ usInHand ].usItemClass == IC_BLADE && usInHand != THROWING_KNIFE ) + //if ( Item[ usInHand ].usItemClass == IC_BLADE && usInHand != THROWING_KNIFE ) //{ // if ( !fGuyHere ) // { @@ -4244,7 +4246,7 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ) // } //} - if ( Item[ usInHand ].usItemClass == IC_PUNCH ) + if ( Item[ usInHand ].usItemClass == IC_PUNCH ) { if ( !fGuyHere ) { @@ -4252,7 +4254,7 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ) } } - //if ( Item[ usInHand ].usItemClass == IC_BLADE ) + //if ( Item[ usInHand ].usItemClass == IC_BLADE ) //{ // if ( !fGuyHere ) // { @@ -4260,7 +4262,7 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ) // } //} - if ( Item[ usInHand ].usItemClass == IC_MEDKIT ) + if ( Item[ usInHand ].usItemClass == IC_MEDKIT ) { if ( !fGuyHere ) { @@ -4271,25 +4273,25 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ) pTSoldier = MercPtrs[ gusUIFullTargetID ]; // If we are a vehicle... - if ( ( pTSoldier->uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_ROBOT ) ) ) + if ( ( pTSoldier->flags.uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_ROBOT ) ) ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ CANNOT_DO_FIRST_AID_STR ], pTSoldier->name ); return( FALSE ); } - if ( pSoldier->bMedical == 0 ) + if ( pSoldier->stats.bMedical == 0 ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, pMessageStrings[ MSG_MERC_HAS_NO_MEDSKILL ], pSoldier->name ); return( FALSE ); } - if ( pTSoldier->bBleeding == 0 && pTSoldier->bLife != pTSoldier->bLifeMax ) - { + if ( pTSoldier->bBleeding == 0 && pTSoldier->stats.bLife != pTSoldier->stats.bLifeMax ) + { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, gzLateLocalizedString[ 19 ], pTSoldier->name ); return( FALSE ); } - if ( pTSoldier->bBleeding == 0 && pTSoldier->bLife >= OKLIFE ) + if ( pTSoldier->bBleeding == 0 && pTSoldier->stats.bLife >= OKLIFE ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ CANNOT_NO_NEED_FIRST_AID_STR ], pTSoldier->name ); return( FALSE ); @@ -4314,7 +4316,7 @@ BOOLEAN UIOkForItemPickup( SOLDIERTYPE *pSoldier, INT16 sGridNo ) } else { - if ( GetItemPool( sGridNo, &pItemPool, pSoldier->bLevel ) ) + if ( GetItemPool( sGridNo, &pItemPool, pSoldier->pathing.bLevel ) ) { //if ( !ITEMPOOL_VISIBLE( pItemPool ) ) { @@ -4341,27 +4343,50 @@ BOOLEAN SoldierCanAffordNewStance( SOLDIERTYPE *pSoldier, UINT8 ubDesiredStance // Now change to appropriate animation + // CHRISL: Modify function to include extra cost if wearing a backpack but only while running new inventory system switch( bCurrentHeight ) { case ANIM_STAND - ANIM_CROUCH: + if((UsingNewInventorySystem() == true)) + if(pSoldier->inv[BPACKPOCKPOS].exists() == true && !pSoldier->flags.ZipperFlag) + bAP = bBP = 1; + bAP += AP_CROUCH; + bBP += BP_CROUCH; + break; case ANIM_CROUCH - ANIM_STAND: - - bAP = AP_CROUCH; - bBP = BP_CROUCH; + if((UsingNewInventorySystem() == true)) + if(pSoldier->inv[BPACKPOCKPOS].exists() == true && !pSoldier->flags.ZipperFlag) + bAP = bBP = 2; + bAP += AP_CROUCH; + bBP += BP_CROUCH; break; - case ANIM_STAND - ANIM_PRONE: + if((UsingNewInventorySystem() == true)) + if(pSoldier->inv[BPACKPOCKPOS].exists() == true && !pSoldier->flags.ZipperFlag) + bAP = bBP = 2; + bAP += AP_CROUCH + AP_PRONE; + bBP += BP_CROUCH + BP_PRONE; + break; case ANIM_PRONE - ANIM_STAND: - - bAP = AP_CROUCH + AP_PRONE; - bBP = BP_CROUCH + BP_PRONE; + if((UsingNewInventorySystem() == true)) + if(pSoldier->inv[BPACKPOCKPOS].exists() == true && !pSoldier->flags.ZipperFlag) + bAP = bBP = 4; + bAP += AP_CROUCH + AP_PRONE; + bBP += BP_CROUCH + BP_PRONE; break; - case ANIM_CROUCH - ANIM_PRONE: + if((UsingNewInventorySystem() == true)) + if(pSoldier->inv[BPACKPOCKPOS].exists() == true && !pSoldier->flags.ZipperFlag) + bAP = bBP = 1; + bAP += AP_PRONE; + bBP += BP_PRONE; + break; case ANIM_PRONE - ANIM_CROUCH: - - bAP = AP_PRONE; - bBP = BP_PRONE; + if((UsingNewInventorySystem() == true)) + if(pSoldier->inv[BPACKPOCKPOS].exists() == true && !pSoldier->flags.ZipperFlag) + bAP = bBP = 2; + bAP += AP_PRONE; + bBP += BP_PRONE; break; } @@ -4432,7 +4457,7 @@ void SetMovementModeCursor( SOLDIERTYPE *pSoldier ) } else { - //if ( pSoldier->fUIMovementFast ) + //if ( pSoldier->flags.fUIMovementFast ) //{ // BeginDisplayTimedCursor( MOVE_RUN_REALTIME_UICURSOR, 300 ); //} @@ -4482,7 +4507,7 @@ void SetConfirmMovementModeCursor( SOLDIERTYPE *pSoldier, BOOLEAN fFromMove ) } else { - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { guiNewUICursor = CONFIRM_MOVE_VEHICLE_UICURSOR; } @@ -4526,7 +4551,7 @@ void SetConfirmMovementModeCursor( SOLDIERTYPE *pSoldier, BOOLEAN fFromMove ) } else { - if ( pSoldier->fUIMovementFast && pSoldier->usAnimState == RUNNING && fFromMove ) + if ( pSoldier->flags.fUIMovementFast && pSoldier->usAnimState == RUNNING && fFromMove ) { BeginDisplayTimedCursor( MOVE_RUN_REALTIME_UICURSOR, 300 ); } @@ -4547,10 +4572,10 @@ UINT32 UIHandleLCOnTerrain( UI_EVENT *pUIEvent ) INT16 sFacingDir, sXPos, sYPos; UINT16 usAnimState; - guiNewUICursor = LOOK_UICURSOR; + guiNewUICursor = LOOK_UICURSOR; // Get soldier - if ( !GetSoldier( &pSoldier, gusSelectedSoldier ) ) + if ( !GetSoldier( &pSoldier, gusSelectedSoldier ) ) { return( GAME_SCREEN ); } @@ -4562,7 +4587,7 @@ UINT32 UIHandleLCOnTerrain( UI_EVENT *pUIEvent ) // Get soldier - if ( !GetSoldier( &pSoldier, gusSelectedSoldier ) ) + if ( !GetSoldier( &pSoldier, gusSelectedSoldier ) ) { return( GAME_SCREEN ); } @@ -4602,11 +4627,11 @@ UINT32 UIHandleLCOnTerrain( UI_EVENT *pUIEvent ) // Determine if we can afford! if ( !EnoughPoints( pSoldier, gsCurrentActionPoints, 0, FALSE ) ) - { + { gfUIDisplayActionPointsInvalid = TRUE; } - //HandleSight( pSoldier, SIGHT_LOOK ); + //HandleSight( pSoldier, SIGHT_LOOK ); return( GAME_SCREEN ); @@ -4652,12 +4677,12 @@ BOOLEAN MakeSoldierTurn( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos ) } // ATE: make stationary if... - if ( pSoldier->fNoAPToFinishMove ) + if ( pSoldier->flags.fNoAPToFinishMove ) { - SoldierGotoStationaryStance( pSoldier ); + pSoldier->SoldierGotoStationaryStance( ); } - //DEF: made it an event + //DEF: made it an event SendSoldierSetDesiredDirectionEvent( pSoldier, sFacingDir ); pSoldier->bTurningFromUI = TRUE; @@ -4689,7 +4714,7 @@ BOOLEAN MakeSoldierTurn( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos ) } if( usAnimState != INVALID_ANIMATION ) - SoldierReadyWeapon( pSoldier, sXPos, sYPos, FALSE ); + pSoldier->SoldierReadyWeapon( sXPos, sYPos, FALSE ); pSoldier->bTurningFromUI = TRUE; guiOldEvent = LA_BEGINUIOURTURNLOCK; @@ -4708,10 +4733,7 @@ UINT32 UIHandleLCLook( UI_EVENT *pUIEvent ) { INT16 sXPos, sYPos; SOLDIERTYPE *pSoldier; - INT32 cnt; - SOLDIERTYPE *pFirstSoldier = NULL; - - + INT32 cnt; if ( !GetMouseXY( &sXPos, &sYPos ) ) { return( GAME_SCREEN ); @@ -4725,9 +4747,9 @@ UINT32 UIHandleLCLook( UI_EVENT *pUIEvent ) { if ( pSoldier->bActive && pSoldier->bInSector ) { - if ( pSoldier->uiStatusFlags & SOLDIER_MULTI_SELECTED ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) { - MakeSoldierTurn( pSoldier, sXPos, sYPos ); + MakeSoldierTurn( pSoldier, sXPos, sYPos ); } } } @@ -4735,7 +4757,7 @@ UINT32 UIHandleLCLook( UI_EVENT *pUIEvent ) else { // Get soldier - if ( !GetSoldier( &pSoldier, gusSelectedSoldier ) ) + if ( !GetSoldier( &pSoldier, gusSelectedSoldier ) ) { return( GAME_SCREEN ); } @@ -4756,17 +4778,17 @@ UINT32 UIHandleTOnTerrain( UI_EVENT *pUIEvent ) SOLDIERTYPE *pSoldier; UINT8 ubTargID; UINT32 uiRange; - UINT16 usMapPos; + INT16 sMapPos; BOOLEAN fValidTalkableGuy = FALSE; INT16 sTargetGridNo; // Get soldier - if ( !GetSoldier( &pSoldier, gusSelectedSoldier ) ) + if ( !GetSoldier( &pSoldier, gusSelectedSoldier ) ) { return( GAME_SCREEN ); } - if (!GetMouseMapPos( &usMapPos ) ) + if (!GetMouseMapPos( &sMapPos ) ) { return( GAME_SCREEN ); } @@ -4775,10 +4797,10 @@ UINT32 UIHandleTOnTerrain( UI_EVENT *pUIEvent ) { // Do new cursor! guiPendingOverrideEvent = M_ON_TERRAIN; - return( UIHandleMOnTerrain( pUIEvent ) ); + return( UIHandleMOnTerrain( pUIEvent ) ); } - sTargetGridNo = usMapPos; + sTargetGridNo = sMapPos; UIHandleOnMerc( FALSE ); @@ -4801,32 +4823,32 @@ UINT32 UIHandleTOnTerrain( UI_EVENT *pUIEvent ) { if ( fValidTalkableGuy ) { - guiNewUICursor = TALK_A_UICURSOR; + guiNewUICursor = TALK_A_UICURSOR; } else { - guiNewUICursor = TALK_NA_UICURSOR; + guiNewUICursor = TALK_NA_UICURSOR; } } else { if ( fValidTalkableGuy ) { - //guiNewUICursor = TALK_OUT_RANGE_A_UICURSOR; - guiNewUICursor = TALK_A_UICURSOR; + //guiNewUICursor = TALK_OUT_RANGE_A_UICURSOR; + guiNewUICursor = TALK_A_UICURSOR; } else { - guiNewUICursor = TALK_OUT_RANGE_NA_UICURSOR; + guiNewUICursor = TALK_OUT_RANGE_NA_UICURSOR; } } if ( fValidTalkableGuy ) { - if ( !SoldierTo3DLocationLineOfSightTest( pSoldier, sTargetGridNo, pSoldier->bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) + if ( !SoldierTo3DLocationLineOfSightTest( pSoldier, sTargetGridNo, pSoldier->pathing.bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) { //. ATE: Make range far, so we alternate cursors... - guiNewUICursor = TALK_OUT_RANGE_A_UICURSOR; + guiNewUICursor = TALK_OUT_RANGE_A_UICURSOR; } } @@ -4840,7 +4862,7 @@ UINT32 UIHandleTOnTerrain( UI_EVENT *pUIEvent ) // Determine if we can afford! if ( !EnoughPoints( pSoldier, gsCurrentActionPoints, 0, FALSE ) ) - { + { gfUIDisplayActionPointsInvalid = TRUE; } @@ -4914,7 +4936,7 @@ UINT32 UIHandleLUIEndLock( UI_EVENT *pUIEvent ) gfDisableRegionActive = FALSE; // Add region - MSYS_RemoveRegion( &gDisableRegion ); + MSYS_RemoveRegion( &gDisableRegion ); RefreshMouseRegions( ); //SetCurrentCursorFromDatabase( guiCurrentUICursor ); @@ -4950,7 +4972,7 @@ void CheckForDisabledRegionRemove( ) gfDisableRegionActive = FALSE; // Remove region - MSYS_RemoveRegion( &gDisableRegion ); + MSYS_RemoveRegion( &gDisableRegion ); UnLockPauseState(); UnPauseGame(); @@ -4964,7 +4986,7 @@ void CheckForDisabledRegionRemove( ) gfUIInterfaceSetBusy = FALSE; // Remove region - MSYS_RemoveRegion( &gUserTurnRegion ); + MSYS_RemoveRegion( &gUserTurnRegion ); UnLockPauseState(); UnPauseGame(); @@ -5035,7 +5057,7 @@ void EndMultiSoldierSelection( BOOLEAN fAcknowledge ) { if ( pSoldier->bActive && pSoldier->bInSector ) { - if ( pSoldier->uiStatusFlags & SOLDIER_MULTI_SELECTED ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) { gTacticalStatus.fAtLeastOneGuyOnMultiSelect = TRUE; @@ -5050,9 +5072,9 @@ void EndMultiSoldierSelection( BOOLEAN fAcknowledge ) } if( !gGameSettings.fOptions[ TOPTION_MUTE_CONFIRMATIONS ] && fAcknowledge ) - InternalDoMercBattleSound( pSoldier, BATTLE_SOUND_ATTN1, BATTLE_SND_LOWER_VOLUME ); + pSoldier->InternalSoldierReadyWeapon( BATTLE_SOUND_ATTN1, BATTLE_SND_LOWER_VOLUME ); - if ( pSoldier->fMercAsleep ) + if ( pSoldier->flags.fMercAsleep ) { PutMercInAwakeState( pSoldier ); } @@ -5071,15 +5093,12 @@ void EndMultiSoldierSelection( BOOLEAN fAcknowledge ) void StopRubberBandedMercFromMoving( ) { - SOLDIERTYPE * pSoldier; - INT32 cnt; - SOLDIERTYPE *pFirstSoldier = NULL; - - if ( !gTacticalStatus.fAtLeastOneGuyOnMultiSelect ) { return; } + SOLDIERTYPE * pSoldier; + INT32 cnt; // OK, loop through all guys who are 'multi-selected' and // check if our currently selected guy is amoung the @@ -5089,11 +5108,11 @@ void StopRubberBandedMercFromMoving( ) { if ( pSoldier->bActive && pSoldier->bInSector ) { - if ( pSoldier->uiStatusFlags & SOLDIER_MULTI_SELECTED ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) { - pSoldier->fDelayedMovement = FALSE; - pSoldier->sFinalDestination = pSoldier->sGridNo; - StopSoldier( pSoldier ); + pSoldier->flags.fDelayedMovement = FALSE; + pSoldier->pathing.sFinalDestination = pSoldier->sGridNo; + pSoldier->StopSoldier( ); } } } @@ -5133,11 +5152,11 @@ BOOLEAN HandleMultiSelectionMove( INT16 sDestGridNo ) { if ( pSoldier->bActive && pSoldier->bInSector ) { - if ( pSoldier->uiStatusFlags & SOLDIER_MULTI_SELECTED ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) { if ( pSoldier->ubID == gusSelectedSoldier ) { - fMoveFast = pSoldier->fUIMovementFast; + fMoveFast = pSoldier->flags.fUIMovementFast; break; } } @@ -5149,21 +5168,21 @@ BOOLEAN HandleMultiSelectionMove( INT16 sDestGridNo ) { if ( pSoldier->bActive && pSoldier->bInSector ) { - if ( pSoldier->uiStatusFlags & SOLDIER_MULTI_SELECTED ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) { - // If we can't be controlled, returninvalid... - if ( pSoldier->uiStatusFlags & SOLDIER_ROBOT ) - { - if ( !CanRobotBeControlled( pSoldier ) ) - { - continue; - } - } + // If we can't be controlled, returninvalid... + if ( pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) + { + if ( !pSoldier->CanRobotBeControlled( ) ) + { + continue; + } + } - pSoldier->fUIMovementFast = fMoveFast; - pSoldier->usUIMovementMode = GetMoveStateBasedOnStance( pSoldier, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ); + pSoldier->flags.fUIMovementFast = fMoveFast; + pSoldier->usUIMovementMode = pSoldier->GetMoveStateBasedOnStance( gAnimControl[ pSoldier->usAnimState ].ubEndHeight ); - pSoldier->fUIMovementFast = FALSE; + pSoldier->flags.fUIMovementFast = FALSE; if ( gUIUseReverse ) { @@ -5175,12 +5194,12 @@ BOOLEAN HandleMultiSelectionMove( INT16 sDestGridNo ) } // Remove any previous actions - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; - if ( EVENT_InternalGetNewSoldierPath( pSoldier, sDestGridNo, pSoldier->usUIMovementMode , TRUE, pSoldier->fNoAPToFinishMove ) ) + if ( pSoldier->EVENT_InternalGetNewSoldierPath( sDestGridNo, pSoldier->usUIMovementMode , TRUE, pSoldier->flags.fNoAPToFinishMove ) ) { - InternalDoMercBattleSound( pSoldier, BATTLE_SOUND_OK1, BATTLE_SND_LOWER_VOLUME ); + pSoldier->InternalSoldierReadyWeapon( BATTLE_SOUND_OK1, BATTLE_SND_LOWER_VOLUME ); } else { @@ -5210,9 +5229,9 @@ void ResetMultiSelection( ) { if ( pSoldier->bActive && pSoldier->bInSector ) { - if ( pSoldier->uiStatusFlags & SOLDIER_MULTI_SELECTED ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) { - pSoldier->uiStatusFlags &= (~SOLDIER_MULTI_SELECTED ); + pSoldier->flags.uiStatusFlags &= (~SOLDIER_MULTI_SELECTED ); } } } @@ -5229,7 +5248,7 @@ UINT32 UIHandleRubberBandOnTerrain( UI_EVENT *pUIEvent ) INT16 sScreenX, sScreenY; INT32 iTemp; SGPRect aRect; - BOOLEAN fAtLeastOne = FALSE; + BOOLEAN fAtLeastOne = FALSE; guiNewUICursor = NO_UICURSOR; //SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); @@ -5243,7 +5262,7 @@ UINT32 UIHandleRubberBandOnTerrain( UI_EVENT *pUIEvent ) if ( aRect.iRight < aRect.iLeft ) { iTemp = aRect.iLeft; - aRect.iLeft = aRect.iRight; + aRect.iLeft = aRect.iRight; aRect.iRight = iTemp; } @@ -5260,7 +5279,7 @@ UINT32 UIHandleRubberBandOnTerrain( UI_EVENT *pUIEvent ) for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++ ) { // Check if this guy is OK to control.... - if ( OK_CONTROLLABLE_MERC( pSoldier ) && !( pSoldier->uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) ) + if ( OK_CONTROLLABLE_MERC( pSoldier ) && !( pSoldier->flags.uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) ) { // Get screen pos of gridno...... GetGridNoScreenXY( pSoldier->sGridNo, &sScreenX, &sScreenY ); @@ -5289,11 +5308,11 @@ UINT32 UIHandleRubberBandOnTerrain( UI_EVENT *pUIEvent ) { // Check if this guy is OK to control.... - if ( OK_CONTROLLABLE_MERC( pSoldier ) && !( pSoldier->uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) ) + if ( OK_CONTROLLABLE_MERC( pSoldier ) && !( pSoldier->flags.uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) ) { if ( !_KeyDown( ALT ) ) { - pSoldier->uiStatusFlags &= (~SOLDIER_MULTI_SELECTED ); + pSoldier->flags.uiStatusFlags &= (~SOLDIER_MULTI_SELECTED ); } // Get screen pos of gridno...... @@ -5308,7 +5327,7 @@ UINT32 UIHandleRubberBandOnTerrain( UI_EVENT *pUIEvent ) if ( IsPointInScreenRect( sScreenX, sScreenY, &aRect ) ) { // Adjust this guy's flag... - pSoldier->uiStatusFlags |= SOLDIER_MULTI_SELECTED; + pSoldier->flags.uiStatusFlags |= SOLDIER_MULTI_SELECTED; } } } @@ -5321,20 +5340,20 @@ UINT32 UIHandleRubberBandOnTerrain( UI_EVENT *pUIEvent ) UINT32 UIHandleJumpOverOnTerrain( UI_EVENT *pUIEvent ) { SOLDIERTYPE *pSoldier; - UINT16 usMapPos; + INT16 sMapPos; // Here, first get map screen - if ( !GetSoldier( &pSoldier, gusSelectedSoldier ) ) + if ( !GetSoldier( &pSoldier, gusSelectedSoldier ) ) { return( GAME_SCREEN ); } - if (!GetMouseMapPos( &usMapPos ) ) + if (!GetMouseMapPos( &sMapPos ) ) { return( GAME_SCREEN ); } - if ( !IsValidJumpLocation( pSoldier, usMapPos, FALSE ) ) + if ( !IsValidJumpLocation( pSoldier, sMapPos, FALSE ) ) { guiPendingOverrideEvent = M_ON_TERRAIN; return( GAME_SCREEN ); @@ -5343,7 +5362,7 @@ UINT32 UIHandleJumpOverOnTerrain( UI_EVENT *pUIEvent ) // Display APs.... gsCurrentActionPoints = GetAPsToJumpOver( pSoldier ); - gfUIDisplayActionPoints = TRUE; + gfUIDisplayActionPoints = TRUE; gfUIDisplayActionPointsCenter = TRUE; guiNewUICursor = JUMP_OVER_UICURSOR; @@ -5355,21 +5374,21 @@ UINT32 UIHandleJumpOverOnTerrain( UI_EVENT *pUIEvent ) UINT32 UIHandleJumpOver( UI_EVENT *pUIEvent ) { SOLDIERTYPE *pSoldier; - UINT16 usMapPos; + INT16 sMapPos; UINT8 ubDirection; // Here, first get map screen - if ( !GetSoldier( &pSoldier, gusSelectedSoldier ) ) + if ( !GetSoldier( &pSoldier, gusSelectedSoldier ) ) { return( GAME_SCREEN ); } - if (!GetMouseMapPos( &usMapPos ) ) + if (!GetMouseMapPos( &sMapPos ) ) { return( GAME_SCREEN ); } - if ( !IsValidJumpLocation( pSoldier, usMapPos, FALSE ) ) + if ( !IsValidJumpLocation( pSoldier, sMapPos, FALSE ) ) { return( GAME_SCREEN ); } @@ -5378,17 +5397,17 @@ UINT32 UIHandleJumpOver( UI_EVENT *pUIEvent ) // OK, Start jumping! // Remove any previous actions - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; // Get direction to goto.... - ubDirection = GetDirectionFromGridNo( usMapPos, pSoldier ); + ubDirection = GetDirectionFromGridNo( sMapPos, pSoldier ); - pSoldier->fDontChargeTurningAPs = TRUE; - EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection); - pSoldier->fTurningUntilDone = TRUE; + pSoldier->flags.fDontChargeTurningAPs = TRUE; + pSoldier->EVENT_SetSoldierDesiredDirection(ubDirection); + pSoldier->flags.fTurningUntilDone = TRUE; // ATE: Reset flag to go back to prone... - //pSoldier->fTurningFromPronePosition = TURNING_FROM_PRONE_OFF; + //pSoldier->flags.fTurningFromPronePosition = TURNING_FROM_PRONE_OFF; pSoldier->usPendingAnimation = JUMP_OVER_BLOCKING_PERSON; @@ -5437,7 +5456,7 @@ UINT32 UIHandleLAEndLockOurTurn( UI_EVENT *pUIEvent ) gfUIInterfaceSetBusy = FALSE; // Add region - MSYS_RemoveRegion( &gUserTurnRegion ); + MSYS_RemoveRegion( &gUserTurnRegion ); RefreshMouseRegions( ); //SetCurrentCursorFromDatabase( guiCurrentUICursor ); @@ -5499,7 +5518,7 @@ BOOLEAN IsValidTalkableNPC( UINT8 ubSoldierID, BOOLEAN fGive , BOOLEAN fAllowMer } // CHECK IF DEAD - if( pSoldier->bLife == 0 ) + if( pSoldier->stats.bLife == 0 ) { return( FALSE ); } @@ -5509,7 +5528,7 @@ BOOLEAN IsValidTalkableNPC( UINT8 ubSoldierID, BOOLEAN fGive , BOOLEAN fAllowMer return( FALSE ); } - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { return( FALSE ); } @@ -5520,7 +5539,7 @@ BOOLEAN IsValidTalkableNPC( UINT8 ubSoldierID, BOOLEAN fGive , BOOLEAN fAllowMer { if ( pSoldier->bVisible == -1 && !(gTacticalStatus.uiFlags&SHOW_ALL_MERCS) ) { - return( FALSE ); + return( FALSE ); } } @@ -5530,13 +5549,13 @@ BOOLEAN IsValidTalkableNPC( UINT8 ubSoldierID, BOOLEAN fGive , BOOLEAN fAllowMer } // Check for EPC... - if ( pSoldier->ubProfile != NO_PROFILE && ( gCurrentUIMode == TALKCURSOR_MODE || fGive ) && AM_AN_EPC( pSoldier ) ) + if ( pSoldier->ubProfile != NO_PROFILE && ( gCurrentUIMode == TALKCURSOR_MODE || fGive ) && AM_AN_EPC( pSoldier ) ) { fValidGuy = TRUE; } // ATE: We can talk to our own teammates.... - if ( pSoldier->bTeam == gbPlayerNum && fAllowMercs ) + if ( pSoldier->bTeam == gbPlayerNum && fAllowMercs ) { fValidGuy = TRUE; } @@ -5547,7 +5566,7 @@ BOOLEAN IsValidTalkableNPC( UINT8 ubSoldierID, BOOLEAN fGive , BOOLEAN fAllowMer } // Alright, let's do something special here for robot... - if ( pSoldier->uiStatusFlags & SOLDIER_ROBOT ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) { if ( fValidGuy == TRUE && !fGive ) { @@ -5572,12 +5591,12 @@ BOOLEAN IsValidTalkableNPC( UINT8 ubSoldierID, BOOLEAN fGive , BOOLEAN fAllowMer } -BOOLEAN HandleTalkInit( ) +BOOLEAN HandleTalkInit( ) { - INT16 sAPCost; + INT16 sAPCost; SOLDIERTYPE *pSoldier, *pTSoldier; UINT32 uiRange; - UINT16 usMapPos; + INT16 sMapPos; INT16 sGoodGridNo; UINT8 ubNewDirection; UINT8 ubQuoteNum; @@ -5587,12 +5606,12 @@ BOOLEAN HandleTalkInit( ) UINT8 commandRange; //lal // Get soldier - if ( !GetSoldier( &pSoldier, gusSelectedSoldier ) ) + if ( !GetSoldier( &pSoldier, gusSelectedSoldier ) ) { return( FALSE ); } - if (!GetMouseMapPos( &usMapPos ) ) + if (!GetMouseMapPos( &sMapPos ) ) { return( FALSE ); } @@ -5607,10 +5626,10 @@ BOOLEAN HandleTalkInit( ) if ( pTSoldier->ubID != pSoldier->ubID ) { - if ( !(( pTSoldier->bTeam == MILITIA_TEAM ) && ( CheckIfRadioIsEquipped() )) ) //lal + if ( !(( pTSoldier->bTeam == MILITIA_TEAM ) && ( CheckIfRadioIsEquipped() )) ) //lal { // Check LOS! - if ( !SoldierTo3DLocationLineOfSightTest( pSoldier, pTSoldier->sGridNo, pTSoldier->bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) + if ( !SoldierTo3DLocationLineOfSightTest( pSoldier, pTSoldier->sGridNo, pTSoldier->pathing.bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) { if ( pTSoldier->ubProfile != NO_PROFILE ) { @@ -5633,7 +5652,7 @@ BOOLEAN HandleTalkInit( ) // If Q on, turn off..... if ( guiCurrentScreen == DEBUG_SCREEN ) - { + { gfExitDebugScreen = TRUE; } @@ -5705,7 +5724,7 @@ BOOLEAN HandleTalkInit( ) } // Check distance - uiRange = GetRangeFromGridNoDiff( pSoldier->sGridNo, usMapPos ); + uiRange = GetRangeFromGridNoDiff( pSoldier->sGridNo, sMapPos ); // Double check path if ( GetCivType( pTSoldier ) != CIV_TYPE_NA ) @@ -5730,14 +5749,14 @@ BOOLEAN HandleTalkInit( ) if ( ( uiRange > commandRange ) && ( !CheckIfRadioIsEquipped() ) ) //lal { - if( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) ) + if( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) ) { return( FALSE ); } else { // First get an adjacent gridno.... - sActionGridNo = FindAdjacentGridEx( pSoldier, pTSoldier->sGridNo, &ubDirection, NULL, FALSE, TRUE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, pTSoldier->sGridNo, &ubDirection, NULL, FALSE, TRUE ); if ( sActionGridNo == -1 ) { @@ -5757,7 +5776,7 @@ BOOLEAN HandleTalkInit( ) gfNPCCircularDistLimit = FALSE; // First calculate APs and validate... - sAPCost = AP_TALK; + sAPCost = AP_TALK; //sAPCost += UIPlotPath( pSoldier, sGoodGridNo, NO_COPYROUTE, FALSE, TEMPORARY, (UINT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ); // Check AP cost... @@ -5767,12 +5786,12 @@ BOOLEAN HandleTalkInit( ) } // Now walkup to talk.... - pSoldier->ubPendingAction = MERC_TALK; - pSoldier->uiPendingActionData1 = pTSoldier->ubID; - pSoldier->ubPendingActionAnimCount = 0; + pSoldier->aiData.ubPendingAction = MERC_TALK; + pSoldier->aiData.uiPendingActionData1 = pTSoldier->ubID; + pSoldier->aiData.ubPendingActionAnimCount = 0; // WALK UP TO DEST FIRST - EVENT_InternalGetNewSoldierPath( pSoldier, sGoodGridNo, pSoldier->usUIMovementMode , TRUE , pSoldier->fNoAPToFinishMove ); + pSoldier->EVENT_InternalGetNewSoldierPath( sGoodGridNo, pSoldier->usUIMovementMode , TRUE , pSoldier->flags.fNoAPToFinishMove ); return( FALSE ); } @@ -5788,7 +5807,7 @@ BOOLEAN HandleTalkInit( ) } // OK, startup! - PlayerSoldierStartTalking( pSoldier, pTSoldier->ubID, FALSE ); + pSoldier->PlayerSoldierStartTalking( pTSoldier->ubID, FALSE ); } if ( GetCivType( pTSoldier ) != CIV_TYPE_NA ) @@ -5842,14 +5861,14 @@ void UnSetUIBusy( UINT8 ubID ) void BeginDisplayTimedCursor( UINT32 uiCursorID, UINT32 uiDelay ) { gfDisplayTimerCursor = TRUE; - guiTimerCursorID = uiCursorID; - guiTimerLastUpdate = GetJA2Clock( ); - guiTimerCursorDelay = uiDelay; + guiTimerCursorID = uiCursorID; + guiTimerLastUpdate = GetJA2Clock( ); + guiTimerCursorDelay = uiDelay; } -INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT16 usMapPos, BOOLEAN fUseOKCursor, BOOLEAN fItemsOnlyIfOnIntTiles ) +INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT16 sMapPos, BOOLEAN fUseOKCursor, BOOLEAN fItemsOnlyIfOnIntTiles ) { ITEM_POOL *pItemPool; BOOLEAN fSetCursor; @@ -5862,7 +5881,7 @@ INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT16 usM BOOLEAN fContinue = TRUE; STRUCTURE *pStructure = NULL; BOOLEAN fPoolContainsHiddenItems = FALSE; - SOLDIERTYPE *pTSoldier; + SOLDIERTYPE *pTSoldier; if ( gfResetUIItemCursorOptimization ) @@ -5875,7 +5894,7 @@ INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT16 usM GetCursorMovementFlags( &uiCursorFlags ); // Default gridno to mouse pos - sActionGridNo = usMapPos; + sActionGridNo = sMapPos; // Look for being on a merc.... // Steal..... @@ -5883,7 +5902,7 @@ INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT16 usM gfBeginVehicleCursor = FALSE; - if ( gfUIFullTargetFound ) + if ( gfUIFullTargetFound ) { pTSoldier = MercPtrs[ gusUIFullTargetID ]; @@ -5895,7 +5914,7 @@ INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT16 usM if ( !OKUseVehicle( pTSoldier->ubProfile ) ) { // Set UI CURSOR.... - guiNewUICursor = CANNOT_MOVE_UICURSOR; + guiNewUICursor = CANNOT_MOVE_UICURSOR; gfBeginVehicleCursor = TRUE; return( 1 ); @@ -5905,7 +5924,7 @@ INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT16 usM if ( GetNumberInVehicle( pTSoldier->bVehicleID ) == 0 ) { // Set UI CURSOR.... - guiNewUICursor = ENTER_VEHICLE_UICURSOR; + guiNewUICursor = ENTER_VEHICLE_UICURSOR; gfBeginVehicleCursor = TRUE; return( 1 ); @@ -5915,7 +5934,7 @@ INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT16 usM else { // Set UI CURSOR.... - guiNewUICursor = ENTER_VEHICLE_UICURSOR; + guiNewUICursor = ENTER_VEHICLE_UICURSOR; return( 1 ); } } @@ -5933,21 +5952,21 @@ INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT16 usM //Set UI CURSOR if ( fUseOKCursor || ( ( gTacticalStatus.uiFlags & INCOMBAT ) && ( gTacticalStatus.uiFlags & TURNBASED ) ) ) { - guiNewUICursor = OKHANDCURSOR_UICURSOR; + guiNewUICursor = OKHANDCURSOR_UICURSOR; } else { - guiNewUICursor = NORMALHANDCURSOR_UICURSOR; + guiNewUICursor = NORMALHANDCURSOR_UICURSOR; } - fSetCursor = HandleUIMovementCursor( pSoldier, uiCursorFlags, sActionGridNo, MOVEUI_TARGET_STEAL ); + fSetCursor = HandleUIMovementCursor( pSoldier, uiCursorFlags, sActionGridNo, MOVEUI_TARGET_STEAL ); // Display action points gfUIDisplayActionPoints = TRUE; // Determine if we can afford! if ( !EnoughPoints( pSoldier, gsCurrentActionPoints, 0, FALSE ) ) - { + { gfUIDisplayActionPointsInvalid = TRUE; } @@ -5964,7 +5983,7 @@ INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT16 usM } // If we are over an interactive struct, adjust gridno to this.... - pIntTile = ConditionalGetCurInteractiveTileGridNoAndStructure( &sIntTileGridNo , &pStructure, FALSE ); + pIntTile = ConditionalGetCurInteractiveTileGridNoAndStructure( &sIntTileGridNo , &pStructure, FALSE ); gpInvTileThatCausedMoveConfirm = pIntTile; if ( pIntTile != NULL ) @@ -5973,10 +5992,10 @@ INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT16 usM } // Check if we are over an item pool - if ( GetItemPool( sActionGridNo, &pItemPool, pSoldier->bLevel ) ) + if ( GetItemPool( sActionGridNo, &pItemPool, pSoldier->pathing.bLevel ) ) { // If we want only on int tiles, and we have no int tiles.. ignore items! - if ( fItemsOnlyIfOnIntTiles && pIntTile == NULL ) + if ( fItemsOnlyIfOnIntTiles && pIntTile == NULL ) { } @@ -5989,11 +6008,11 @@ INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT16 usM { // We don't want switches messing around with items ever! } - else if ( ( pIntTile != NULL && ( pStructure->fFlags & ( STRUCTURE_ANYDOOR ) ) ) && ( sActionGridNo != usMapPos || fItemsOnlyIfOnIntTiles ) ) + else if ( ( pIntTile != NULL && ( pStructure->fFlags & ( STRUCTURE_ANYDOOR ) ) ) && ( sActionGridNo != sMapPos || fItemsOnlyIfOnIntTiles ) ) { // Next we look for if we are over a door and if the mouse position is != base door position, ignore items! } - else + else { fPoolContainsHiddenItems = DoesItemPoolContainAnyHiddenItems( pItemPool ); @@ -6018,14 +6037,14 @@ INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT16 usM //Set UI CURSOR if ( fUseOKCursor || ( ( gTacticalStatus.uiFlags & INCOMBAT ) && ( gTacticalStatus.uiFlags & TURNBASED ) ) ) { - guiNewUICursor = OKHANDCURSOR_UICURSOR; + guiNewUICursor = OKHANDCURSOR_UICURSOR; } else { - guiNewUICursor = NORMALHANDCURSOR_UICURSOR; + guiNewUICursor = NORMALHANDCURSOR_UICURSOR; } - fSetCursor = HandleUIMovementCursor( pSoldier, uiCursorFlags, sActionGridNo, MOVEUI_TARGET_ITEMS ); + fSetCursor = HandleUIMovementCursor( pSoldier, uiCursorFlags, sActionGridNo, MOVEUI_TARGET_ITEMS ); // Display action points gfUIDisplayActionPoints = TRUE; @@ -6037,7 +6056,7 @@ INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT16 usM // Determine if we can afford! if ( !EnoughPoints( pSoldier, gsCurrentActionPoints, 0, FALSE ) ) - { + { gfUIDisplayActionPointsInvalid = TRUE; } @@ -6058,10 +6077,10 @@ INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT16 usM gfPlotNewMovement = TRUE; } - HandleUIMovementCursor( pSoldier, uiCursorFlags, usMapPos, MOVEUI_TARGET_INTTILES ); + HandleUIMovementCursor( pSoldier, uiCursorFlags, sMapPos, MOVEUI_TARGET_INTTILES ); //Set UI CURSOR - guiNewUICursor = GetInteractiveTileCursor( guiNewUICursor, fUseOKCursor ); + guiNewUICursor = GetInteractiveTileCursor( guiNewUICursor, fUseOKCursor ); } else { @@ -6074,17 +6093,17 @@ INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT16 usM gfPlotNewMovement = TRUE; } - fSetCursor = HandleUIMovementCursor( pSoldier, uiCursorFlags, sActionGridNo, MOVEUI_TARGET_ITEMS ); + fSetCursor = HandleUIMovementCursor( pSoldier, uiCursorFlags, sActionGridNo, MOVEUI_TARGET_ITEMS ); // Display action points gfUIDisplayActionPoints = TRUE; // Determine if we can afford! if ( !EnoughPoints( pSoldier, gsCurrentActionPoints, 0, FALSE ) ) - { + { gfUIDisplayActionPointsInvalid = TRUE; } - } + } } } @@ -6124,7 +6143,7 @@ BOOLEAN SelectedGuyInBusyAnimation( ) { pSoldier = MercPtrs[ gusSelectedSoldier ]; - if ( pSoldier->usAnimState == LOB_ITEM || + if ( pSoldier->usAnimState == LOB_ITEM || pSoldier->usAnimState == THROW_ITEM || // crouch throwing pSoldier->usAnimState == THROW_ITEM_CROUCHED || @@ -6170,11 +6189,11 @@ void GotoHeigherStance( SOLDIERTYPE *pSoldier ) // Try to climb GetMercClimbDirection( pSoldier->ubID, &fNearLowerLevel, &fNearHeigherLevel ); - if ( fNearHeigherLevel ) - { - BeginSoldierClimbUpRoof( pSoldier ); - } - break; + if ( fNearHeigherLevel ) + { + pSoldier->BeginSoldierClimbUpRoof( ); + } + break; case ANIM_CROUCH: @@ -6213,11 +6232,11 @@ void GotoLowerStance( SOLDIERTYPE *pSoldier ) // Try to climb GetMercClimbDirection( pSoldier->ubID, &fNearLowerLevel, &fNearHeigherLevel ); - if ( fNearLowerLevel ) - { - BeginSoldierClimbDownRoof( pSoldier ); - } - break; + if ( fNearLowerLevel ) + { + pSoldier->BeginSoldierClimbDownRoof( ); + } + break; } } @@ -6273,7 +6292,6 @@ void SetInterfaceHeightLevel( ) BOOLEAN ValidQuickExchangePosition( ) { SOLDIERTYPE *pSoldier, *pOverSoldier; - INT16 sDistVisible = FALSE; BOOLEAN fOnValidGuy = FALSE; static BOOLEAN fOldOnValidGuy = FALSE; @@ -6283,22 +6301,23 @@ BOOLEAN ValidQuickExchangePosition( ) pOverSoldier = MercPtrs[ gusUIFullTargetID ]; //KM: Replaced this older if statement for the new one which allows exchanging with militia - //if ( ( pOverSoldier->bSide != gbPlayerNum ) && pOverSoldier->bNeutral ) - if ( ( pOverSoldier->bTeam != gbPlayerNum && pOverSoldier->bNeutral ) || (pOverSoldier->bTeam == MILITIA_TEAM && pOverSoldier->bSide == 0 ) ) + //if ( ( pOverSoldier->bSide != gbPlayerNum ) && pOverSoldier->aiData.bNeutral ) + if ( ( pOverSoldier->bTeam != gbPlayerNum && pOverSoldier->aiData.bNeutral ) || (pOverSoldier->bTeam == MILITIA_TEAM && pOverSoldier->bSide == 0 ) ) { // hehe - don't allow animals to exchange places - if ( !( pOverSoldier->uiStatusFlags & ( SOLDIER_ANIMAL ) ) ) + if ( !( pOverSoldier->flags.uiStatusFlags & ( SOLDIER_ANIMAL ) ) ) { // OK, we have a civ , now check if they are near selected guy..... if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { if ( PythSpacesAway( pSoldier->sGridNo, pOverSoldier->sGridNo ) == 1 ) { - if ( SoldierTo3DLocationLineOfSightTest( pSoldier, pOverSoldier->sGridNo, pOverSoldier->bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) + // Check if we have LOS to them.... + if ( SoldierTo3DLocationLineOfSightTest( pSoldier, pOverSoldier->sGridNo, pOverSoldier->pathing.bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) { // ATE: // Check that the path is good! - if ( FindBestPath( pSoldier, pOverSoldier->sGridNo, pSoldier->bLevel, pSoldier->usUIMovementMode, NO_COPYROUTE, PATH_IGNORE_PERSON_AT_DEST ) == 1 ) + if ( FindBestPath( pSoldier, pOverSoldier->sGridNo, pSoldier->pathing.bLevel, pSoldier->usUIMovementMode, NO_COPYROUTE, PATH_IGNORE_PERSON_AT_DEST ) == 1 ) { fOnValidGuy = TRUE; } @@ -6334,7 +6353,7 @@ BOOLEAN ValidQuickExchangePosition( ) // to jump over people. BOOLEAN IsValidJumpLocation( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fCheckForPath ) { - INT16 sFourGrids[4], sDistance=0, sSpot, sIntSpot; + INT16 sFourGrids[4], sSpot, sIntSpot; static const UINT8 sDirs[4] = { NORTH, EAST, SOUTH, WEST }; //INT32 cnt; UINT8 ubGuyThere; @@ -6354,12 +6373,12 @@ BOOLEAN IsValidJumpLocation( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fChec // MOVE OUT TWO DIRECTIONS sIntSpot = NewGridNo( sGridNo, DirectionInc( sDirs[ cnt ] ) ); - // ATE: Check our movement costs for going through walls! - ubMovementCost = gubWorldMovementCosts[ sIntSpot ][ sDirs[ cnt ] ][ pSoldier->bLevel ]; - if ( IS_TRAVELCOST_DOOR( ubMovementCost ) ) - { - ubMovementCost = DoorTravelCost( pSoldier, sIntSpot, ubMovementCost, (BOOLEAN) (pSoldier->bTeam == gbPlayerNum), &iDoorGridNo ); - } + // ATE: Check our movement costs for going through walls! + ubMovementCost = gubWorldMovementCosts[ sIntSpot ][ sDirs[ cnt ] ][ pSoldier->pathing.bLevel ]; + if ( IS_TRAVELCOST_DOOR( ubMovementCost ) ) + { + ubMovementCost = DoorTravelCost( pSoldier, sIntSpot, ubMovementCost, (BOOLEAN) (pSoldier->bTeam == gbPlayerNum), &iDoorGridNo ); + } // If we have hit an obstacle, STOP HERE if ( ubMovementCost >= TRAVELCOST_BLOCKED ) @@ -6373,7 +6392,7 @@ BOOLEAN IsValidJumpLocation( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fChec sFourGrids[cnt] = sSpot = NewGridNo( sIntSpot, DirectionInc( sDirs[ cnt ] ) ); // Is the soldier we're looking at here? - ubGuyThere = WhoIsThere2( sSpot, pSoldier->bLevel ); + ubGuyThere = WhoIsThere2( sSpot, pSoldier->pathing.bLevel ); // Alright folks, here we are! if ( ubGuyThere == pSoldier->ubID ) @@ -6382,12 +6401,12 @@ BOOLEAN IsValidJumpLocation( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fChec if ( NewOKDestination( pSoldier, sGridNo, TRUE, (INT8)gsInterfaceLevel ) ) { // If the soldier in the middle of doing stuff? - if ( !pSoldier->fTurningUntilDone ) + if ( !pSoldier->flags.fTurningUntilDone ) { // OK, NOW check if there is a guy in between us - // - // - ubGuyThere = WhoIsThere2( sIntSpot, pSoldier->bLevel ); + // + // + ubGuyThere = WhoIsThere2( sIntSpot, pSoldier->pathing.bLevel ); // Is there a guy and is he prone? if ( ubGuyThere != NOBODY && ubGuyThere != pSoldier->ubID && gAnimControl[ MercPtrs[ ubGuyThere ]->usAnimState ].ubHeight == ANIM_PRONE ) diff --git a/Tactical/Handle UI.h b/Tactical/Handle UI.h index e4605615..e05a97dd 100644 --- a/Tactical/Handle UI.h +++ b/Tactical/Handle UI.h @@ -203,19 +203,19 @@ extern UINT16 gsUIHandleShowMoveGridLocation; extern BOOLEAN gfUIDisplayDamage; extern INT8 gbDamage; -extern UINT16 gsDamageGridNo; +extern INT16 gsDamageGridNo; extern BOOLEAN gfFontPopupDo; extern BOOLEAN gUITargetReady; extern BOOLEAN gUITargetShotWaiting; -extern UINT16 gsUITargetShotGridNo; +extern INT16 gsUITargetShotGridNo; extern CHAR16 gzLocation[ 20 ]; extern BOOLEAN gfUIBodyHitLocation; -extern UINT8 gsBulletCount; -extern UINT8 gsTotalBulletCount; +extern UINT16 gsBulletCount; +extern UINT16 gsTotalBulletCount; extern BOOLEAN gTintBulletCounts; extern BOOLEAN gfUIAutofireBulletCount; @@ -280,7 +280,7 @@ void GetTBMousePositionInput( UINT32 *puiNewEvent ); void QueryTBLeftButton( UINT32 *puiNewEvent ); void QueryTBRightButton( UINT32 *puiNewEvent ); void HandleStanceChangeFromUIKeys( UINT8 ubAnimHeight ); -void HandleKeyInputOnEnemyTurn( ); +void HandleKeyInputOnEnemyTurn( ); void GetRTMouseButtonInput( UINT32 *puiNewEvent ); @@ -291,7 +291,7 @@ void QueryRTRightButton( UINT32 *puiNewEvent ); void AdjustSoldierCreationStartValues( ); BOOLEAN SelectedMercCanAffordAttack( ); -BOOLEAN SelectedMercCanAffordMove( ); +BOOLEAN SelectedMercCanAffordMove( ); void GetMercClimbDirection( UINT8 ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoUp ); void ToggleHandCursorMode( UINT32 *puiNewEvent ); @@ -301,7 +301,7 @@ void ToggleLookCursorMode( UINT32 *puiNewEvent ); void UIHandleSoldierStanceChange( UINT8 ubSoldierID, INT8 bNewStance ); void GetCursorMovementFlags( UINT32 *puiCursorFlags ); -BOOLEAN HandleUIMovementCursor( SOLDIERTYPE *pSoldier, UINT32 uiCursorFlags, UINT16 usMapPos, UINT32 uiFlags ); +BOOLEAN HandleUIMovementCursor( SOLDIERTYPE *pSoldier, UINT32 uiCursorFlags, INT16 sMapPos, UINT32 uiFlags ); BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ); BOOLEAN UIOkForItemPickup( SOLDIERTYPE *pSoldier, INT16 sGridNo ); @@ -309,7 +309,7 @@ BOOLEAN UIOkForItemPickup( SOLDIERTYPE *pSoldier, INT16 sGridNo ); BOOLEAN IsValidTalkableNPCFromMouse( UINT8 *pubSoldierID, BOOLEAN fGive, BOOLEAN fAllowMercs, BOOLEAN fCheckCollapsed ); BOOLEAN IsValidTalkableNPC( UINT8 ubSoldierID, BOOLEAN fGive, BOOLEAN fAllowMercs, BOOLEAN fCheckCollapsed ); -BOOLEAN HandleTalkInit( ); +BOOLEAN HandleTalkInit( ); BOOLEAN HandleCheckForExitArrowsInput( BOOLEAN fAdjustForConfirm ); @@ -320,8 +320,8 @@ UINT32 UIHandleLUIEndLock( UI_EVENT *pUIEvent ); void BeginDisplayTimedCursor( UINT32 uiCursorID, UINT32 uiDelay ); -void HandleHandCursorClick( UINT16 usMapPos, UINT32 *puiNewEvent ); -INT8 HandleMoveModeInteractiveClick( UINT16 usMapPos, UINT32 *puiNewEvent ); +void HandleHandCursorClick( INT16 sMapPos, UINT32 *puiNewEvent ); +INT8 HandleMoveModeInteractiveClick( INT16 sMapPos, UINT32 *puiNewEvent ); BOOLEAN HandleUIReloading( SOLDIERTYPE *pSoldier ); diff --git a/Tactical/Interface Control.cpp b/Tactical/Interface Control.cpp index 34359145..db2d06b5 100644 --- a/Tactical/Interface Control.cpp +++ b/Tactical/Interface Control.cpp @@ -3,8 +3,8 @@ #else #include #include - #include - #include "sgp.h" + #include + #include "sgp.h" #include "gameloop.h" #include "himage.h" #include "vobject.h" @@ -51,9 +51,9 @@ #include "civ quotes.h" #endif -/* I deleted here declaration of clock coords for tactical screen i will declare them - * in functions that Initialize coord for SMPanet and TEAMPanel - * any questions? joker +/* I deleted here declaration of clock coords for tactical screen i will declare them + * in functions that Initialize coord for SMPanet and TEAMPanel + * any questions? joker */ SGPRect gOldClippingRect, gOldDirtyClippingRect; @@ -67,7 +67,8 @@ BOOLEAN gfRerenderInterfaceFromHelpText = FALSE; MOUSE_REGION gLockPanelOverlayRegion; -extern void RenderTownIDString( ); +// CHRISL: Change function definition to allow passing of X,Y coords to control placement of TownID string +extern void RenderTownIDString( INT16 sX, INT16 sY ); extern BOOLEAN gfUIOverItemPool; extern INT16 gfUIOverItemPoolGridNo; extern BOOLEAN gfInMovementMenu; @@ -77,7 +78,7 @@ extern UINT32 guiUIMessageTimeDelay; BOOLEAN gfPausedTacticalRenderInterfaceFlags = FALSE; -BOOLEAN gfPausedTacticalRenderFlags = FALSE; +BOOLEAN gfPausedTacticalRenderFlags = FALSE; // which assignment menu can be shown? extern void DetermineWhichAssignmentMenusCanBeShown( void ); @@ -116,9 +117,9 @@ void RenderTacticalInterface( ) { HandleFlashingItems( ); - HandleMultiPurposeLocator( ); - - } + HandleMultiPurposeLocator( ); + + } // Handle degrading new items... DegradeNewlyAddedItems( ); @@ -137,7 +138,7 @@ void RenderTacticalInterface( ) // Handle faces if( !(guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) ) HandleAutoFaces( ); - + } @@ -154,7 +155,7 @@ void HandlePausedTacticalRender( void ) if ( gfPausedTacticalRenderInterfaceFlags ) { - fInterfacePanelDirty = gfPausedTacticalRenderInterfaceFlags; + fInterfacePanelDirty = gfPausedTacticalRenderInterfaceFlags; gfPausedTacticalRenderInterfaceFlags = FALSE; } @@ -184,15 +185,15 @@ void RenderTacticalInterfaceWhileScrolling( ) void SetUpInterface( ) { - SOLDIERTYPE *pSoldier; - LEVELNODE *pIntTile; + SOLDIERTYPE *pSoldier; + LEVELNODE *pIntTile; if ( ( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) { return; } - DrawUICursor( ); + DrawUICursor( ); SetupPhysicsTrajectoryUI( ); @@ -200,7 +201,7 @@ void SetUpInterface( ) if ( giUIMessageOverlay != -1 ) { if ( ( GetJA2Clock( ) - guiUIMessageTime ) > guiUIMessageTimeDelay ) - { + { EndUIMessage( ); } } @@ -231,7 +232,7 @@ void SetUpInterface( ) HandleInterfaceBackgrounds( ); - + if ( gfUIHandleSelection == NONSELECTED_GUY_SELECTION ) { if ( gsSelectedLevel > 0 ) @@ -255,7 +256,7 @@ void SetUpInterface( ) if ( gsSelectedLevel > 0 ) { //AddRoofToHead( gsSelectedGridNo, SELRING1 ); - AddRoofToHead( gsSelectedGridNo, FIRSTPOINTERS2 ); + AddRoofToHead( gsSelectedGridNo, FIRSTPOINTERS2 ); gpWorldLevelData[gsSelectedGridNo].pRoofHead->ubShadeLevel=DEFAULT_SHADE_LEVEL; gpWorldLevelData[gsSelectedGridNo].pRoofHead->ubNaturalShadeLevel=DEFAULT_SHADE_LEVEL; @@ -263,7 +264,7 @@ void SetUpInterface( ) else { //AddObjectToHead( gsSelectedGridNo, SELRING1 ); - AddObjectToHead( gsSelectedGridNo, FIRSTPOINTERS2 ); + AddObjectToHead( gsSelectedGridNo, FIRSTPOINTERS2 ); gpWorldLevelData[gsSelectedGridNo].pObjectHead->ubShadeLevel=DEFAULT_SHADE_LEVEL; gpWorldLevelData[gsSelectedGridNo].pObjectHead->ubNaturalShadeLevel=DEFAULT_SHADE_LEVEL; } @@ -353,7 +354,7 @@ void ResetInterface( ) DetermineWhichMilitiaControlMenusCanBeShown( ); //lal CreateDestroyMilitiaControlPopUpBoxes( ); - + HideUICursor( ); @@ -389,7 +390,7 @@ void ResetInterface( ) { fInterfacePanelDirty = FALSE; } - + // Reset int tile cursor stuff if ( gfUIShowCurIntTile ) @@ -404,7 +405,7 @@ void ResetInterface( ) if ( pNode->usIndex == gusUICurIntTileEffectIndex ) { pNode->ubShadeLevel = gsUICurIntTileOldShade; - pNode->uiFlags &= (~LEVELNODE_DYNAMIC); + pNode->uiFlags &= (~LEVELNODE_DYNAMIC); break; } @@ -419,7 +420,7 @@ void ResetInterface( ) extern BOOLEAN AnyItemsVisibleOnLevel( ITEM_POOL *pItemPool, INT8 bZLevel ); -UINT32 guiColors[ 12 ] = +UINT32 guiColors[ 12 ] = { FROMRGB( 198, 163, 0 ), FROMRGB( 185, 150, 0 ), @@ -437,13 +438,13 @@ UINT32 guiColors[ 12 ] = void RenderRubberBanding( ) { - UINT16 usLineColor; - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; - INT16 iLeft, iRight, iTop, iBottom; - INT32 iBack = -1; - static INT32 iFlashColor = 0; - static INT32 uiTimeOfLastUpdate = 0; + UINT16 usLineColor; + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; + INT16 iLeft, iRight, iTop, iBottom; + INT32 iBack = -1; + static INT32 iFlashColor = 0; + static INT32 uiTimeOfLastUpdate = 0; if ( !gRubberBandActive ) return; @@ -476,14 +477,14 @@ void RenderRubberBanding( ) usLineColor = Get16BPPColor( guiColors[ iFlashColor ] ); if ( ( iRight - iLeft ) > 0 ) - { + { LineDraw( TRUE, iLeft, iTop, iRight, iTop, usLineColor, pDestBuf ); - iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, iLeft, iTop, (INT16)( iRight + 1 ), (INT16)( iTop + 1 ) ); + iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, iLeft, iTop, (INT16)( iRight + 1 ), (INT16)( iTop + 1 ) ); } else if ( ( iRight - iLeft ) < 0 ) { LineDraw( TRUE, iLeft, iTop, iRight, iTop, usLineColor, pDestBuf ); - iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, iRight, iTop, (INT16)( iLeft + 1 ), (INT16)( iTop + 1 ) ); + iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, iRight, iTop, (INT16)( iLeft + 1 ), (INT16)( iTop + 1 ) ); } if ( iBack != -1 ) @@ -495,14 +496,14 @@ void RenderRubberBanding( ) iBack = -1; if ( ( iRight - iLeft ) > 0 ) - { + { LineDraw( TRUE, iLeft, iBottom, iRight, iBottom, usLineColor, pDestBuf ); - iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, iLeft, iBottom, (INT16)( iRight +1 ), (INT16)( iBottom + 1 ) ); + iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, iLeft, iBottom, (INT16)( iRight +1 ), (INT16)( iBottom + 1 ) ); } else if ( ( iRight - iLeft ) < 0 ) { LineDraw( TRUE, iLeft, iBottom, iRight, iBottom, usLineColor, pDestBuf ); - iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, iRight, iBottom, (INT16)( iLeft + 1 ), (INT16)( iBottom + 1 ) ); + iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, iRight, iBottom, (INT16)( iLeft + 1 ), (INT16)( iBottom + 1 ) ); } if ( iBack != -1 ) @@ -515,14 +516,14 @@ void RenderRubberBanding( ) iBack = -1; if ( ( iBottom - iTop ) > 0 ) - { + { LineDraw( TRUE, iLeft, iTop, iLeft, iBottom, usLineColor, pDestBuf ); - iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, iLeft, iTop, (INT16)( iLeft +1 ), iBottom ); + iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, iLeft, iTop, (INT16)( iLeft +1 ), iBottom ); } else if ( ( iBottom - iTop ) < 0 ) { LineDraw( TRUE, iLeft, iTop, iLeft, iBottom, usLineColor, pDestBuf ); - iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, iLeft, iBottom, (INT16)( iLeft + 1 ), iTop ); + iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, iLeft, iBottom, (INT16)( iLeft + 1 ), iTop ); } if ( iBack != -1 ) @@ -534,14 +535,14 @@ void RenderRubberBanding( ) iBack = -1; if ( ( iBottom - iTop ) > 0 ) - { + { LineDraw( TRUE, iRight, iTop, iRight, iBottom, usLineColor, pDestBuf ); - iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, iRight, iTop, (INT16)( iRight +1 ), iBottom ); + iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, iRight, iTop, (INT16)( iRight +1 ), iBottom ); } else if ( ( iBottom - iTop ) < 0 ) { LineDraw( TRUE, iRight, iTop, iRight, iBottom, usLineColor, pDestBuf ); - iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, iRight, iBottom, (INT16)( iRight + 1 ), iTop ); + iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, iRight, iBottom, (INT16)( iRight + 1 ), iTop ); } if ( iBack != -1 ) @@ -556,16 +557,16 @@ void RenderRubberBanding( ) void RenderTopmostTacticalInterface( ) { - SOLDIERTYPE *pSoldier; - UINT32 cnt; + SOLDIERTYPE *pSoldier; + UINT32 cnt; static UINT32 uiBogTarget = 0; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; INT16 sX, sY; INT16 sOffsetX, sOffsetY, sTempY_S, sTempX_S; - UINT16 usMapPos; + INT16 sMapPos; ITEM_POOL *pItemPool; - + if ( gfRerenderInterfaceFromHelpText == TRUE ) { fInterfacePanelDirty = DIRTYLEVEL2; @@ -602,14 +603,7 @@ void RenderTopmostTacticalInterface( ) if ( InItemStackPopup( ) ) { - if ( fInterfacePanelDirty == DIRTYLEVEL2 ) - { - RenderItemStackPopup( TRUE ); - } - else - { - RenderItemStackPopup( FALSE ); - } + RenderItemStackPopup( ( BOOLEAN )( fInterfacePanelDirty == DIRTYLEVEL2 ) ); } if( ( InKeyRingPopup() ) && ( !InItemDescriptionBox( ) ) ) @@ -644,7 +638,7 @@ void RenderTopmostTacticalInterface( ) } if ( GridNoOnScreen( (INT16)MAPROWCOLTOPOS( ( MercPtrs[ cnt ]->sPlannedTargetY/CELL_Y_SIZE), ( MercPtrs[ cnt ]->sPlannedTargetX / CELL_X_SIZE ) ) ) ) - { + { // GET SCREEN COORDINATES sOffsetX = (MercPtrs[ cnt ]->sPlannedTargetX - gsRenderCenterX); sOffsetY = (MercPtrs[ cnt ]->sPlannedTargetY - gsRenderCenterY); @@ -661,7 +655,7 @@ void RenderTopmostTacticalInterface( ) sX -= 10; sY -= 10; - BltVideoObjectFromIndex( FRAME_BUFFER, uiBogTarget, 0, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObjectFromIndex( FRAME_BUFFER, uiBogTarget, 0, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL ); InvalidateRegion( sX, sY, sX + 20, sY + 20 ); } } @@ -670,13 +664,13 @@ void RenderTopmostTacticalInterface( ) } - + if ( gfUIInDeadlock ) { SetFont( LARGEFONT1 ); SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( FONT_MCOLOR_WHITE ); - gprintfdirty( 0, 300, L"OPPONENT %d DEADLOCKED - 'Q' TO DEBUG, END OPP TURN", gUIDeadlockedSoldier ); + gprintfdirty( 0, 300, L"OPPONENT %d DEADLOCKED - 'Q' TO DEBUG, END OPP TURN", gUIDeadlockedSoldier ); mprintf( 0, 300, L"OPPONENT %d DEADLOCKED - 'Q' TO DEBUG, END OPP TURN", gUIDeadlockedSoldier ); } @@ -686,12 +680,12 @@ void RenderTopmostTacticalInterface( ) SYNCTIMECOUNTER( ); - // Setup system for video overlay ( text and blitting ) Sets clipping rects, etc + // Setup system for video overlay ( text and blitting ) Sets clipping rects, etc StartViewportOverlays( ); RenderTopmostFlashingItems( ); - RenderTopmostMultiPurposeLocator( ); + RenderTopmostMultiPurposeLocator( ); RenderAccumulatedBurstLocations( ); @@ -704,14 +698,14 @@ void RenderTopmostTacticalInterface( ) { if ( pSoldier->ubID == gsSelectedGuy && gfUIHandleSelectionAboveGuy ) { - + } else { DrawSelectedUIAboveGuy((UINT16)pSoldier->ubID); } - if ( pSoldier->fDisplayDamage ) + if ( pSoldier->flags.fDisplayDamage ) { // Display damage @@ -723,32 +717,32 @@ void RenderTopmostTacticalInterface( ) GetSoldierScreenPos( pSoldier, &sMercScreenX, &sMercScreenY ); GetSoldierAnimOffsets( pSoldier, &sOffsetX, &sOffsetY ); - if ( pSoldier->ubBodyType == QUEENMONSTER ) - { - sDamageX = sMercScreenX + pSoldier->sDamageX - pSoldier->sBoundingBoxOffsetX; - sDamageY = sMercScreenY + pSoldier->sDamageY - pSoldier->sBoundingBoxOffsetY; + if ( pSoldier->ubBodyType == QUEENMONSTER ) + { + sDamageX = sMercScreenX + pSoldier->sDamageX - pSoldier->sBoundingBoxOffsetX; + sDamageY = sMercScreenY + pSoldier->sDamageY - pSoldier->sBoundingBoxOffsetY; - sDamageX += 25; - sDamageY += 10; - } - else - { - sDamageX = pSoldier->sDamageX + (INT16)(sMercScreenX + ( 2 * 30 / 3 ) ); - sDamageY = pSoldier->sDamageY + (INT16)(sMercScreenY - 5 ); + sDamageX += 25; + sDamageY += 10; + } + else + { + sDamageX = pSoldier->sDamageX + (INT16)(sMercScreenX + ( 2 * 30 / 3 ) ); + sDamageY = pSoldier->sDamageY + (INT16)(sMercScreenY - 5 ); - sDamageX -= sOffsetX; - sDamageY -= sOffsetY; + sDamageX -= sOffsetX; + sDamageY -= sOffsetY; - if ( sDamageY < gsVIEWPORT_WINDOW_START_Y ) - { - sDamageY = ( sMercScreenY - sOffsetY ); - } - } - - SetFont( TINYFONT1 ); + if ( sDamageY < gsVIEWPORT_WINDOW_START_Y ) + { + sDamageY = ( sMercScreenY - sOffsetY ); + } + } + + SetFont( TINYFONT1 ); SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( FONT_MCOLOR_WHITE ); - + gprintfdirty( sDamageX, sDamageY, L"-%d", pSoldier->sDamage ); mprintf( sDamageX, sDamageY, L"-%d", pSoldier->sDamage ); } @@ -785,27 +779,27 @@ void RenderTopmostTacticalInterface( ) } // CHECK IF OUR CURSOR IS OVER AN INV POOL - if( GetMouseMapPos( &usMapPos) ) + if( GetMouseMapPos( &sMapPos) ) { if ( gfUIOverItemPool ) { if( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { // Check if we are over an item pool - if ( GetItemPool( gfUIOverItemPoolGridNo, &pItemPool, pSoldier->bLevel ) ) + if ( GetItemPool( gfUIOverItemPoolGridNo, &pItemPool, pSoldier->pathing.bLevel ) ) { STRUCTURE *pStructure = NULL; INT16 sIntTileGridNo; INT8 bZLevel = 0; - INT16 sActionGridNo = usMapPos; + INT16 sActionGridNo = sMapPos; // Get interactive tile... if ( ConditionalGetCurInteractiveTileGridNoAndStructure( &sIntTileGridNo , &pStructure, FALSE ) ) { sActionGridNo = sIntTileGridNo; } - - bZLevel = GetZLevelOfItemPoolGivenStructure( sActionGridNo, pSoldier->bLevel, pStructure ); + + bZLevel = GetZLevelOfItemPoolGivenStructure( sActionGridNo, pSoldier->pathing.bLevel, pStructure ); if ( AnyItemsVisibleOnLevel( pItemPool, bZLevel ) ) { @@ -816,46 +810,46 @@ void RenderTopmostTacticalInterface( ) } } - else - { - INT8 bCheckLevel; + else + { + INT8 bCheckLevel; - // ATE: Allow to see list if a different level.... - if ( pSoldier->bLevel == 0 ) - { - bCheckLevel = 1; - } - else - { - bCheckLevel = 0; - } + // ATE: Allow to see list if a different level.... + if ( pSoldier->pathing.bLevel == 0 ) + { + bCheckLevel = 1; + } + else + { + bCheckLevel = 0; + } - // Check if we are over an item pool - if ( GetItemPool( gfUIOverItemPoolGridNo, &pItemPool, bCheckLevel ) ) - { - STRUCTURE *pStructure = NULL; - INT16 sIntTileGridNo; - INT8 bZLevel = 0; - INT16 sActionGridNo = usMapPos; + // Check if we are over an item pool + if ( GetItemPool( gfUIOverItemPoolGridNo, &pItemPool, bCheckLevel ) ) + { + STRUCTURE *pStructure = NULL; + INT16 sIntTileGridNo; + INT8 bZLevel = 0; + INT16 sActionGridNo = sMapPos; - // Get interactive tile... - if ( ConditionalGetCurInteractiveTileGridNoAndStructure( &sIntTileGridNo , &pStructure, FALSE ) ) - { - sActionGridNo = sIntTileGridNo; - } - - bZLevel = GetZLevelOfItemPoolGivenStructure( sActionGridNo, bCheckLevel, pStructure ); + // Get interactive tile... + if ( ConditionalGetCurInteractiveTileGridNoAndStructure( &sIntTileGridNo , &pStructure, FALSE ) ) + { + sActionGridNo = sIntTileGridNo; + } - if ( AnyItemsVisibleOnLevel( pItemPool, bZLevel ) ) - { - DrawItemPoolList( pItemPool, gfUIOverItemPoolGridNo , ITEMLIST_DISPLAY, bZLevel, gusMouseXPos, gusMouseYPos ); + bZLevel = GetZLevelOfItemPoolGivenStructure( sActionGridNo, bCheckLevel, pStructure ); - // ATE: If over items, remove locator.... - RemoveFlashItemSlot( pItemPool ); + if ( AnyItemsVisibleOnLevel( pItemPool, bZLevel ) ) + { + DrawItemPoolList( pItemPool, gfUIOverItemPoolGridNo , ITEMLIST_DISPLAY, bZLevel, gusMouseXPos, gusMouseYPos ); - } - } - } + // ATE: If over items, remove locator.... + RemoveFlashItemSlot( pItemPool ); + + } + } + } } } } @@ -888,11 +882,11 @@ void RenderTopmostTacticalInterface( ) if( fRenderRadarScreen == TRUE ) { - // Render clock -/* Here we was rendering closk and position string now i moved it to functions - * that render SM or TEAM panel it will be usefull when RenderTownIDString will - * take position where render i will fix that - * any questions?? joker + // Render clock +/* Here we was rendering closk and position string now i moved it to functions + * that render SM or TEAM panel it will be usefull when RenderTownIDString will + * take position where render i will fix that + * any questions?? joker */ // RenderClock( CLOCK_X, CLOCK_Y ); // RenderTownIDString( ); @@ -919,8 +913,8 @@ void RenderTopmostTacticalInterface( ) // mark all pop ups as dirty MarkAllBoxesAsAltered( ); - - HandleShowingOfTacticalInterfaceFastHelpText( ); + + HandleShowingOfTacticalInterfaceFastHelpText( ); HandleShadingOfLinesForAssignmentMenus( ); DetermineBoxPositions( ); DisplayBoxes( FRAME_BUFFER ); @@ -930,14 +924,14 @@ void RenderTopmostTacticalInterface( ) void StartViewportOverlays( ) { - + // Set Clipping Rect to be the viewscreen // Save old one memcpy( &gOldClippingRect, &ClippingRect, sizeof( gOldClippingRect ) ); // Save old dirty clipping rect memcpy( &gOldDirtyClippingRect, &ClippingRect, sizeof( gOldDirtyClippingRect ) ); - + // Set bottom clipping value for blitter clipping rect ClippingRect.iLeft = INTERFACE_START_X; ClippingRect.iTop = gsVIEWPORT_WINDOW_START_Y; @@ -972,7 +966,7 @@ void LockTacticalInterface( ) if ( !(guiTacticalInterfaceFlags & INTERFACE_LOCKEDLEVEL1 ) ) { MSYS_DefineRegion( &gLockPanelOverlayRegion, 0, gsVIEWPORT_WINDOW_END_Y ,SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST, - CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); // Add region MSYS_AddRegion( &gLockPanelOverlayRegion); @@ -1005,7 +999,7 @@ void EraseInterfaceMenus( BOOLEAN fIgnoreUIUnLock ) // Remove item pointer if one active CancelItemPointer( ); - ShutDownQuoteBoxIfActive( ); + ShutDownQuoteBoxIfActive( ); PopDownMovementMenu( ); PopDownOpenDoorMenu( ); DeleteTalkingMenu( ); @@ -1036,7 +1030,7 @@ void ResetInterfaceAndUI( ) //ResetMultiSelection( ); - if ( giUIMessageOverlay != -1 ) + if ( giUIMessageOverlay != -1 ) { RemoveVideoOverlay( giUIMessageOverlay ); giUIMessageOverlay = -1; diff --git a/Tactical/Interface Cursors.cpp b/Tactical/Interface Cursors.cpp index 825f55cb..1d85f0a7 100644 --- a/Tactical/Interface Cursors.cpp +++ b/Tactical/Interface Cursors.cpp @@ -3,8 +3,8 @@ #else #include #include - #include - #include "sgp.h" + #include + #include "sgp.h" #include "mousesystem.h" #include "vsurface.h" #include "wcheck.h" @@ -31,10 +31,10 @@ #define LOOSE_CURSOR_DELAY 300 -static BOOLEAN gfLooseCursorOn = FALSE; -static INT16 gsLooseCursorGridNo = NOWHERE; -static UINT32 guiLooseCursorID = 0; -static UINT32 guiLooseCursorTimeOfLastUpdate = 0; +static BOOLEAN gfLooseCursorOn = FALSE; +static INT16 gsLooseCursorGridNo = NOWHERE; +static UINT32 guiLooseCursorID = 0; +static UINT32 guiLooseCursorTimeOfLastUpdate = 0; void HandleLooseCursorDraw( ); @@ -78,10 +78,10 @@ UICursor gUICursors[ NUM_UI_CURSORS ] = ACTION_NOCHANCE_BURST_UICURSOR, UICURSOR_FREEFLOWING, CURSOR_TARGETBURSTDKBLACK, 0, ACTION_FLASH_TOSS_UICURSOR, UICURSOR_FREEFLOWING, CURSOR_TARGET, 0, - ACTION_TOSS_UICURSOR, UICURSOR_FREEFLOWING, CURSOR_TARGET, 0, + ACTION_TOSS_UICURSOR, UICURSOR_FREEFLOWING, CURSOR_TARGET, 0, ACTION_RED_TOSS_UICURSOR, UICURSOR_FREEFLOWING, CURSOR_TARGETRED, 0, - ACTION_FLASH_SHOOT_UICURSOR, UICURSOR_FREEFLOWING, CURSOR_FLASH_TARGET, 0, + ACTION_FLASH_SHOOT_UICURSOR, UICURSOR_FREEFLOWING, CURSOR_FLASH_TARGET, 0, ACTION_FLASH_BURST_UICURSOR, UICURSOR_FREEFLOWING, CURSOR_FLASH_TARGETBURST, 0, ACTION_TARGETAIM1_UICURSOR, UICURSOR_FREEFLOWING, CURSOR_TARGETON1, 0, ACTION_TARGETAIM2_UICURSOR, UICURSOR_FREEFLOWING, CURSOR_TARGETON2, 0, @@ -209,11 +209,11 @@ UICursor gUICursors[ NUM_UI_CURSORS ] = EXCHANGE_PLACES_UICURSOR, UICURSOR_FREEFLOWING, CURSOR_EXCHANGE_PLACES, 0, JUMP_OVER_UICURSOR, UICURSOR_FREEFLOWING, CURSOR_JUMP_OVER, 0, - REFUEL_GREY_UICURSOR, UICURSOR_FREEFLOWING, CURSOR_FUEL, 0, - REFUEL_RED_UICURSOR, UICURSOR_FREEFLOWING, CURSOR_FUEL_RED, 0, + REFUEL_GREY_UICURSOR, UICURSOR_FREEFLOWING, CURSOR_FUEL, 0, + REFUEL_RED_UICURSOR, UICURSOR_FREEFLOWING, CURSOR_FUEL_RED, 0, + +}; -}; - UINT32 guiCurUICursor = NO_UICURSOR; UINT32 guiOldUICursor = NO_UICURSOR; @@ -236,7 +236,7 @@ BOOLEAN SetUICursor( UINT32 uiNewCursor ) BOOLEAN DrawUICursor( ) { - UINT16 usMapPos; + INT16 sMapPos; static BOOLEAN fHideCursor = FALSE; LEVELNODE *pNode; UINT16 usTileCursor; @@ -249,7 +249,7 @@ BOOLEAN DrawUICursor( ) // OK, WE OVERRIDE HERE CURSOR DRAWING FOR THINGS LIKE if ( gpItemPointer != NULL ) { - MSYS_ChangeRegionCursor( &gViewportRegion , VIDEO_NO_CURSOR ); + MSYS_ChangeRegionCursor( &gViewportRegion , VIDEO_NO_CURSOR ); // Check if we are in the viewport region... if ( gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA ) @@ -263,13 +263,13 @@ BOOLEAN DrawUICursor( ) return( TRUE ); } - if (GetMouseMapPos( &usMapPos) ) + if (GetMouseMapPos( &sMapPos) ) { - gusCurMousePos = usMapPos; + gusCurMousePos = sMapPos; if ( guiCurUICursor == NO_UICURSOR ) { - MSYS_ChangeRegionCursor( &gViewportRegion , VIDEO_NO_CURSOR ); + MSYS_ChangeRegionCursor( &gViewportRegion , VIDEO_NO_CURSOR ); return( TRUE ); } @@ -299,7 +299,7 @@ BOOLEAN DrawUICursor( ) if ( gUICursors[ guiCurUICursor ].uiFlags & UICURSOR_FREEFLOWING && !( gUICursors[ guiCurUICursor ].uiFlags & UICURSOR_DONTSHOW2NDLEVEL ) ) { - gfTargetDropPos = TRUE; + gfTargetDropPos = TRUE; gusTargetDropPos = gusCurMousePos; if ( gsInterfaceLevel == I_ROOF_LEVEL ) @@ -317,7 +317,7 @@ BOOLEAN DrawUICursor( ) } } - + if ( gUICursors[ guiCurUICursor ].uiFlags & UICURSOR_SHOWTILEAPDEPENDENT ) { // Add depending on AP status @@ -352,7 +352,7 @@ BOOLEAN DrawUICursor( ) } else { - pNode = AddTopmostToTail( gusCurMousePos, GetSnapCursorIndex( usTileCursor ) ); + pNode = AddTopmostToTail( gusCurMousePos, GetSnapCursorIndex( usTileCursor ) ); } pNode->ubShadeLevel=DEFAULT_SHADE_LEVEL; @@ -361,18 +361,18 @@ BOOLEAN DrawUICursor( ) if ( gsInterfaceLevel == I_ROOF_LEVEL ) { // Put one on the roof as well - AddOnRoofToHead( gusCurMousePos, GetSnapCursorIndex( usTileCursor ) ); + AddOnRoofToHead( gusCurMousePos, GetSnapCursorIndex( usTileCursor ) ); gpWorldLevelData[gusCurMousePos].pOnRoofHead->ubShadeLevel=DEFAULT_SHADE_LEVEL; gpWorldLevelData[gusCurMousePos].pOnRoofHead->ubNaturalShadeLevel=DEFAULT_SHADE_LEVEL; } } - + // If snapping - remove from main viewport if ( gUICursors[ guiCurUICursor ].uiFlags & UICURSOR_SNAPPING ) { // Hide mouse region cursor - MSYS_ChangeRegionCursor( &gViewportRegion , VIDEO_NO_CURSOR ); + MSYS_ChangeRegionCursor( &gViewportRegion , VIDEO_NO_CURSOR ); // Set Snapping Cursor DrawSnappingCursor( ); @@ -383,7 +383,7 @@ BOOLEAN DrawUICursor( ) { switch( guiCurUICursor ) { - case MOVE_VEHICLE_UICURSOR: + case MOVE_VEHICLE_UICURSOR: // Set position for APS gfUIDisplayActionPointsCenter = FALSE; @@ -423,13 +423,13 @@ BOOLEAN DrawUICursor( ) if ( !fHideCursor ) { - MSYS_ChangeRegionCursor( &gViewportRegion , gUICursors[ guiCurUICursor ].usFreeCursorName ); + MSYS_ChangeRegionCursor( &gViewportRegion , gUICursors[ guiCurUICursor ].usFreeCursorName ); } else { // Hide - MSYS_ChangeRegionCursor( &gViewportRegion , VIDEO_NO_CURSOR ); + MSYS_ChangeRegionCursor( &gViewportRegion , VIDEO_NO_CURSOR ); } } @@ -463,7 +463,7 @@ BOOLEAN HideUICursor( ) return( TRUE ); } - if ( gUICursors[ guiCurUICursor ].uiFlags & ( UICURSOR_SHOWTILE | UICURSOR_SHOWTILEAPDEPENDENT ) ) + if ( gUICursors[ guiCurUICursor ].uiFlags & ( UICURSOR_SHOWTILE | UICURSOR_SHOWTILEAPDEPENDENT ) ) { RemoveAllTopmostsOfTypeRange( gusCurMousePos, FIRSTPOINTERS, FIRSTPOINTERS ); RemoveAllOnRoofsOfTypeRange( gusCurMousePos, FIRSTPOINTERS, FIRSTPOINTERS ); @@ -499,14 +499,14 @@ BOOLEAN HideUICursor( ) // Nothing special here... } - return( TRUE ); + return( TRUE ); } void DrawSnappingCursor( ) { LEVELNODE *pNewUIElem; - SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pSoldier; static BOOLEAN fShowAP = TRUE; if ( gusSelectedSoldier != NOBODY ) @@ -523,7 +523,7 @@ void DrawSnappingCursor( ) case NORMAL_SNAPUICURSOR: - AddTopmostToHead( gusCurMousePos, FIRSTPOINTERS1 ); + AddTopmostToHead( gusCurMousePos, FIRSTPOINTERS1 ); gpWorldLevelData[gusCurMousePos].pTopmostHead->ubShadeLevel=DEFAULT_SHADE_LEVEL; gpWorldLevelData[gusCurMousePos].pTopmostHead->ubNaturalShadeLevel=DEFAULT_SHADE_LEVEL; break; @@ -623,7 +623,7 @@ void DrawSnappingCursor( ) } else { - AddTopmostToHead( gusCurMousePos, BADMARKER1 ); + AddTopmostToHead( gusCurMousePos, BADMARKER1 ); gpWorldLevelData[gusCurMousePos].pTopmostHead->ubShadeLevel=DEFAULT_SHADE_LEVEL; gpWorldLevelData[gusCurMousePos].pTopmostHead->ubNaturalShadeLevel=DEFAULT_SHADE_LEVEL; @@ -647,7 +647,7 @@ void DrawSnappingCursor( ) if ( COUNTERDONE( CURSORFLASH ) ) { RESETCOUNTER( CURSORFLASH ); - + fShowAP = !fShowAP; } } @@ -786,4 +786,4 @@ UINT16 GetSnapCursorIndex( UINT16 usAdditionalData ) { return( usAdditionalData ); } -} \ No newline at end of file +} diff --git a/Tactical/Interface Dialogue.cpp b/Tactical/Interface Dialogue.cpp index b0e8e2bd..b3af4add 100644 --- a/Tactical/Interface Dialogue.cpp +++ b/Tactical/Interface Dialogue.cpp @@ -6,7 +6,7 @@ #include "builddefines.h" #include #include "sgp.h" - #include "soldier control.h" + //#include "soldier control.h" #include "Encrypted File.h" #include "faces.h" #include "wcheck.h" @@ -26,7 +26,7 @@ #include "items.h" #include "text.h" #include "overhead.h" - #include "soldier control.h" + //#include "soldier control.h" #include "assignments.h" #include "strategic.h" #include "strategicmap.h" @@ -80,6 +80,11 @@ #include "Cheats.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + INT16 sBasementEnterGridNos[ ] = { 13362, 13363, 13364, 13365, 13525, 13524 }; INT16 sBasementExitGridNos[ ] = { 8047, 8207, 8208, 8048, 7888, 7728, 7727, 7567 }; @@ -107,19 +112,19 @@ void CarmenLeavesSectorCallback( void ); #define TALK_PANEL_NAME_Y 114 #define TALK_PANEL_NAME_WIDTH 92 #define TALK_PANEL_NAME_HEIGHT 15 -#define TALK_PANEL_REGION_STARTX 102 -#define TALK_PANEL_REGION_STARTY 14 -#define TALK_PANEL_REGION_SPACEY 16 -#define TALK_PANEL_REGION_HEIGHT 12 -#define TALK_PANEL_REGION_WIDTH 95 +#define TALK_PANEL_REGION_STARTX 102 +#define TALK_PANEL_REGION_STARTY 14 +#define TALK_PANEL_REGION_SPACEY 16 +#define TALK_PANEL_REGION_HEIGHT 12 +#define TALK_PANEL_REGION_WIDTH 95 -#define TALK_PANEL_MENUTEXT_STARTX 102 -#define TALK_PANEL_MENUTEXT_STARTY 16 -#define TALK_PANEL_MENUTEXT_SPACEY 16 -#define TALK_PANEL_MENUTEXT_HEIGHT 13 -#define TALK_PANEL_MENUTEXT_WIDTH 95 -#define TALK_PANEL_BUTTON_X 112 -#define TALK_PANEL_BUTTON_Y 114 +#define TALK_PANEL_MENUTEXT_STARTX 102 +#define TALK_PANEL_MENUTEXT_STARTY 16 +#define TALK_PANEL_MENUTEXT_SPACEY 16 +#define TALK_PANEL_MENUTEXT_HEIGHT 13 +#define TALK_PANEL_MENUTEXT_WIDTH 95 +#define TALK_PANEL_BUTTON_X 112 +#define TALK_PANEL_BUTTON_Y 114 #define TALK_PANEL_SHADOW_AREA_X 97 #define TALK_PANEL_SHADOW_AREA_Y 9 #define TALK_PANEL_SHADOW_AREA_WIDTH 107 @@ -161,7 +166,7 @@ extern void EndGameMessageBoxCallBack( UINT8 ubExitValue ); extern INT16 FindNearestOpenableNonDoor( INT16 sStartGridNo ); extern void RecalculateOppCntsDueToBecomingNeutral( SOLDIERTYPE * pSoldier ); -UINT8 ubTalkMenuApproachIDs[] = +UINT8 ubTalkMenuApproachIDs[] = { APPROACH_REPEAT, APPROACH_FRIENDLY, @@ -181,8 +186,8 @@ enum // GLOBAL NPC STRUCT NPC_DIALOGUE_TYPE gTalkPanel; BOOLEAN gfInTalkPanel = FALSE; -SOLDIERTYPE *gpSrcSoldier = NULL; -SOLDIERTYPE *gpDestSoldier = NULL; +SOLDIERTYPE *gpSrcSoldier = NULL; +SOLDIERTYPE *gpDestSoldier = NULL; UINT8 gubSrcSoldierProfile; UINT8 gubNiceNPCProfile = NO_PROFILE; UINT8 gubNastyNPCProfile = NO_PROFILE; @@ -231,7 +236,7 @@ BOOLEAN InitiateConversation( SOLDIERTYPE *pDestSoldier, SOLDIERTYPE *pSrcSoldie { // Wait..... gfConversationPending = TRUE; - + gpPendingDestSoldier = pDestSoldier; gpPendingSrcSoldier = pSrcSoldier; gbPendingApproach = bApproach; @@ -312,7 +317,7 @@ BOOLEAN InternalInitiateConversation( SOLDIERTYPE *pDestSoldier, SOLDIERTYPE *pS { SetCurrentSquad( gpSrcSoldier->bAssignment, FALSE ); - SelectSoldier( pSrcSoldier->ubID, FALSE, FALSE ); + SelectSoldier( pSrcSoldier->ubID, FALSE, FALSE ); } Converse( gTalkPanel.ubCharNum, gubSrcSoldierProfile, bApproach, uiApproachData ); @@ -371,7 +376,7 @@ BOOLEAN InternalInitTalkingMenu( UINT8 ubCharacterNum, INT16 sX, INT16 sY ) FACETYPE *pFace; UINT16 usWidth; UINT16 usHeight; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; INT16 sCenterYVal, sCenterXVal; CHAR8 ubString[48]; @@ -389,7 +394,7 @@ BOOLEAN InternalInitTalkingMenu( UINT8 ubCharacterNum, INT16 sX, INT16 sY ) gTalkPanel.fHandled = FALSE; gTalkPanel.fOnName = FALSE; - // Load Video Object! + // Load Video gTempObject! VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; sprintf( VObjectDesc.ImageFile, "INTERFACE\\talkbox1.sti" ); // Load @@ -399,10 +404,10 @@ BOOLEAN InternalInitTalkingMenu( UINT8 ubCharacterNum, INT16 sX, INT16 sY ) } // Get ETRLE Properties - GetVideoObjectETRLESubregionProperties( gTalkPanel.uiPanelVO, 0, &usWidth, &usHeight ); + GetVideoObjectETRLESubregionProperties( gTalkPanel.uiPanelVO, 0, &usWidth, &usHeight ); // Set values into structure - gTalkPanel.usWidth = usWidth; + gTalkPanel.usWidth = usWidth; gTalkPanel.usHeight = usHeight; // Check coords @@ -445,8 +450,8 @@ BOOLEAN InternalInitTalkingMenu( UINT8 ubCharacterNum, INT16 sX, INT16 sY ) } //Set values - gTalkPanel.sX = sX; - gTalkPanel.sY = sY; + gTalkPanel.sX = sX; + gTalkPanel.sY = sY; CalculatePopupTextOrientation( TALK_PANEL_CALC_SUBTITLE_WIDTH, TALK_PANEL_CALC_SUBTITLE_HEIGHT ); @@ -469,21 +474,21 @@ BOOLEAN InternalInitTalkingMenu( UINT8 ubCharacterNum, INT16 sX, INT16 sY ) //Define main region MSYS_DefineRegion( &(gTalkPanel.ScreenRegion), 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT , MSYS_PRIORITY_HIGHEST, - CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); // Add region MSYS_AddRegion(&(gTalkPanel.ScreenRegion) ); //Define main region MSYS_DefineRegion( &(gTalkPanel.BackRegion), (INT16)(gTalkPanel.sX), (INT16)(gTalkPanel.sY), (INT16)(gTalkPanel.sX + gTalkPanel.usWidth ),(INT16)( gTalkPanel.sY + gTalkPanel.usHeight ), MSYS_PRIORITY_HIGHEST, - CURSOR_NORMAL, MSYS_NO_CALLBACK, TalkPanelBaseRegionClickCallback ); + CURSOR_NORMAL, MSYS_NO_CALLBACK, TalkPanelBaseRegionClickCallback ); // Add region MSYS_AddRegion(&(gTalkPanel.BackRegion) ); //Define name region MSYS_DefineRegion( &(gTalkPanel.NameRegion), (INT16)(gTalkPanel.sX + TALK_PANEL_NAME_X ), (INT16)(gTalkPanel.sY + TALK_PANEL_NAME_Y), (INT16)(gTalkPanel.sX + TALK_PANEL_NAME_WIDTH + TALK_PANEL_NAME_X ),(INT16)( gTalkPanel.sY + TALK_PANEL_NAME_HEIGHT + TALK_PANEL_NAME_Y ), MSYS_PRIORITY_HIGHEST, - CURSOR_NORMAL, TalkPanelNameRegionMoveCallback, TalkPanelNameRegionClickCallback ); + CURSOR_NORMAL, TalkPanelNameRegionMoveCallback, TalkPanelNameRegionClickCallback ); // Add region MSYS_AddRegion(&(gTalkPanel.NameRegion) ); @@ -492,7 +497,7 @@ BOOLEAN InternalInitTalkingMenu( UINT8 ubCharacterNum, INT16 sX, INT16 sY ) { // Build a mouse region here that is over any others..... MSYS_DefineRegion( &(gTalkPanel.Regions[cnt]), (INT16)(sX), (INT16)(sY), (INT16)(sX + TALK_PANEL_REGION_WIDTH ),(INT16)( sY + TALK_PANEL_REGION_HEIGHT ), MSYS_PRIORITY_HIGHEST, - CURSOR_NORMAL, TalkPanelMoveCallback, TalkPanelClickCallback ); + CURSOR_NORMAL, TalkPanelMoveCallback, TalkPanelClickCallback ); // Add region MSYS_AddRegion( &(gTalkPanel.Regions[cnt])); MSYS_SetRegionUserData( &(gTalkPanel.Regions[cnt]), 0, cnt ); @@ -502,7 +507,7 @@ BOOLEAN InternalInitTalkingMenu( UINT8 ubCharacterNum, INT16 sX, INT16 sY ) // Build save buffer // Create a buffer for him to go! - // OK, ignore screen widths, height, only use BPP + // OK, ignore screen widths, height, only use BPP vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE; vs_desc.usWidth = pFace->usFaceWidth; vs_desc.usHeight = pFace->usFaceHeight; @@ -511,19 +516,19 @@ BOOLEAN InternalInitTalkingMenu( UINT8 ubCharacterNum, INT16 sX, INT16 sY ) // Set face to auto SetAutoFaceActive( gTalkPanel.uiSaveBuffer, FACE_AUTO_RESTORE_BUFFER, iFaceIndex , 0, 0 ); - gFacesData[ iFaceIndex ].uiFlags |= FACE_INACTIVE_HANDLED_ELSEWHERE; + gFacesData[ iFaceIndex ].uiFlags |= FACE_INACTIVE_HANDLED_ELSEWHERE; // Load buttons, create button sprintf( ubString, "INTERFACE\\talkbox2.sti" ); gTalkPanel.iButtonImages = LoadButtonImage( ubString, -1,3,-1,4,-1 ); - gTalkPanel.uiCancelButton = CreateIconAndTextButton( gTalkPanel.iButtonImages, zDialogActions[ DIALOG_DONE ], MILITARYFONT1, - 33, DEFAULT_SHADOW, - 33, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, - (INT16)(gTalkPanel.sX + TALK_PANEL_BUTTON_X), (INT16)(gTalkPanel.sY + TALK_PANEL_BUTTON_Y), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)DoneTalkingButtonClickCallback ); + gTalkPanel.uiCancelButton = CreateIconAndTextButton( gTalkPanel.iButtonImages, zDialogActions[ DIALOG_DONE ], MILITARYFONT1, + 33, DEFAULT_SHADOW, + 33, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + (INT16)(gTalkPanel.sX + TALK_PANEL_BUTTON_X), (INT16)(gTalkPanel.sY + TALK_PANEL_BUTTON_Y), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)DoneTalkingButtonClickCallback ); SpecifyButtonHilitedTextColors( gTalkPanel.uiCancelButton, FONT_MCOLOR_WHITE, DEFAULT_SHADOW ); @@ -537,7 +542,7 @@ BOOLEAN InternalInitTalkingMenu( UINT8 ubCharacterNum, INT16 sX, INT16 sY ) gfIgnoreScrolling = TRUE; - + // return OK.... return( TRUE ); @@ -550,7 +555,7 @@ void DoneTalkingButtonClickCallback(GUI_BUTTON *btn, INT32 reason ) { btn->uiFlags |= BUTTON_CLICKED_ON; } - else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); @@ -610,7 +615,7 @@ void DeleteTalkingMenu( ) UnloadButtonImage( gTalkPanel.iButtonImages ); // Set cursor back to normal mode... - guiPendingOverrideEvent = A_CHANGE_TO_MOVE; + guiPendingOverrideEvent = A_CHANGE_TO_MOVE; // WANNE: This check is used, to prevent scrolling in small maps (e.g: Rebel Basement) in higher resolution (1024x768) [2007-05-14] gfDialogControl = TRUE; @@ -622,7 +627,7 @@ void DeleteTalkingMenu( ) gfIgnoreScrolling = FALSE; // Set this guy up as NOT engaged in conversation - gpDestSoldier->uiStatusFlags &= (~SOLDIER_ENGAGEDINACTION); + gpDestSoldier->flags.uiStatusFlags &= (~SOLDIER_ENGAGEDINACTION); //NOT Engaged on conv... if ( !giNPCReferenceCount ) @@ -673,11 +678,11 @@ void DeleteTalkingMenu( ) } } - if ( iInterfaceDialogueBox != -1 ) - { - RemoveMercPopupBoxFromIndex( iInterfaceDialogueBox ); - iInterfaceDialogueBox = -1; - } + if ( iInterfaceDialogueBox != -1 ) + { + RemoveMercPopupBoxFromIndex( iInterfaceDialogueBox ); + iInterfaceDialogueBox = -1; + } // Save time for give item gTacticalStatus.uiTimeCounterForGiveItemSrc = GetJA2Clock( ); @@ -729,10 +734,10 @@ void RenderTalkingMenu( ) pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES); pSrcBuf = LockVideoSurface( gTalkPanel.uiSaveBuffer, &uiSrcPitchBYTES); - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - (INT16)(gTalkPanel.sX + TALK_PANEL_FACE_X), (INT16)(gTalkPanel.sY + TALK_PANEL_FACE_Y), - 0 , 0, + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + (INT16)(gTalkPanel.sX + TALK_PANEL_FACE_X), (INT16)(gTalkPanel.sY + TALK_PANEL_FACE_Y), + 0 , 0, pFace->usFaceWidth, pFace->usFaceHeight ); UnLockVideoSurface( FRAME_BUFFER ); @@ -743,7 +748,7 @@ void RenderTalkingMenu( ) // If guy is talking.... shadow area if ( pFace->fTalking || !DialogueQueueIsEmpty( ) ) { - ShadowVideoSurfaceRect( FRAME_BUFFER, (INT16)(gTalkPanel.sX + TALK_PANEL_SHADOW_AREA_X),(INT16)(gTalkPanel.sY + TALK_PANEL_SHADOW_AREA_Y), (INT16)(gTalkPanel.sX + TALK_PANEL_SHADOW_AREA_X + TALK_PANEL_SHADOW_AREA_WIDTH) , (INT16)(gTalkPanel.sY + TALK_PANEL_SHADOW_AREA_Y + TALK_PANEL_SHADOW_AREA_HEIGHT) ); + ShadowVideoSurfaceRect( FRAME_BUFFER, (INT16)(gTalkPanel.sX + TALK_PANEL_SHADOW_AREA_X),(INT16)(gTalkPanel.sY + TALK_PANEL_SHADOW_AREA_Y), (INT16)(gTalkPanel.sX + TALK_PANEL_SHADOW_AREA_X + TALK_PANEL_SHADOW_AREA_WIDTH) , (INT16)(gTalkPanel.sY + TALK_PANEL_SHADOW_AREA_Y + TALK_PANEL_SHADOW_AREA_HEIGHT) ); // Disable mouse regions.... for ( cnt = 0; cnt < 6; cnt++ ) @@ -773,17 +778,17 @@ void RenderTalkingMenu( ) if ( gTalkPanel.fSetupSubTitles ) { - if ( iInterfaceDialogueBox != -1 ) - { - // Remove any old ones.... - RemoveMercPopupBoxFromIndex( iInterfaceDialogueBox ); - iInterfaceDialogueBox = -1; - } + if ( iInterfaceDialogueBox != -1 ) + { + // Remove any old ones.... + RemoveMercPopupBoxFromIndex( iInterfaceDialogueBox ); + iInterfaceDialogueBox = -1; + } - SET_USE_WINFONTS( TRUE ); - SET_WINFONT( giSubTitleWinFont ); - iInterfaceDialogueBox = PrepareMercPopupBox( iInterfaceDialogueBox,BASIC_MERC_POPUP_BACKGROUND, BASIC_MERC_POPUP_BORDER, gTalkPanel.zQuoteStr, TALK_PANEL_DEFAULT_SUBTITLE_WIDTH, 0, 0, 0, &usTextBoxWidth, &usTextBoxHeight ); - SET_USE_WINFONTS( FALSE ); + SET_USE_WINFONTS( TRUE ); + SET_WINFONT( giSubTitleWinFont ); + iInterfaceDialogueBox = PrepareMercPopupBox( iInterfaceDialogueBox,BASIC_MERC_POPUP_BACKGROUND, BASIC_MERC_POPUP_BORDER, gTalkPanel.zQuoteStr, TALK_PANEL_DEFAULT_SUBTITLE_WIDTH, 0, 0, 0, &usTextBoxWidth, &usTextBoxHeight ); + SET_USE_WINFONTS( FALSE ); gTalkPanel.fSetupSubTitles = FALSE; @@ -799,7 +804,7 @@ void RenderTalkingMenu( ) } MSYS_DefineRegion( &(gTalkPanel.TextRegion), gTalkPanel.sPopupX, gTalkPanel.sPopupY, (INT16)( gTalkPanel.sPopupX + usTextBoxWidth ), (INT16)( gTalkPanel.sPopupY + usTextBoxHeight ), MSYS_PRIORITY_HIGHEST, - CURSOR_NORMAL, MSYS_NO_CALLBACK, TextRegionClickCallback ); + CURSOR_NORMAL, MSYS_NO_CALLBACK, TextRegionClickCallback ); // Add region MSYS_AddRegion(&(gTalkPanel.TextRegion) ); @@ -809,7 +814,7 @@ void RenderTalkingMenu( ) if ( gTalkPanel.fRenderSubTitlesNow ) { - RenderMercPopUpBoxFromIndex( iInterfaceDialogueBox, gTalkPanel.sPopupX, gTalkPanel.sPopupY, FRAME_BUFFER ); + RenderMercPopUpBoxFromIndex( iInterfaceDialogueBox, gTalkPanel.sPopupX, gTalkPanel.sPopupY, FRAME_BUFFER ); } } @@ -828,7 +833,7 @@ void RenderTalkingMenu( ) for ( cnt = 0; cnt < 6; cnt++ ) { - if ( gTalkPanel.bCurSelect == cnt ) + if ( gTalkPanel.bCurSelect == cnt ) { SetFontForeground( FONT_WHITE ); SetFontShadow( DEFAULT_SHADOW ); @@ -872,7 +877,7 @@ void RenderTalkingMenu( ) break; default: VarFindFontCenterCoordinates( sX, sY, TALK_PANEL_MENUTEXT_WIDTH, TALK_PANEL_MENUTEXT_HEIGHT, MILITARYFONT1, &sFontX, &sFontY, L"%s (%d)", zTalkMenuStrings[ cnt ], ubTalkMenuApproachIDs[ cnt ] ); - mprintf( sFontX, sFontY, L"%s (%d)", zTalkMenuStrings[ cnt ], CalcDesireToTalk( ubCharacterNum, gubSrcSoldierProfile, ubTalkMenuApproachIDs[ cnt ] ) ); + mprintf( sFontX, sFontY, L"%s (%d)", zTalkMenuStrings[ cnt ], CalcDesireToTalk( ubCharacterNum, gubSrcSoldierProfile, ubTalkMenuApproachIDs[ cnt ] ) ); break; } } @@ -990,12 +995,12 @@ void TalkPanelClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) gubNewPanelParam = (UINT8)gpSrcSoldier->ubID; // Wait! - gpDestSoldier->bNextAction = AI_ACTION_WAIT; - gpDestSoldier->usNextActionData = 10000; + gpDestSoldier->aiData.bNextAction = AI_ACTION_WAIT; + gpDestSoldier->aiData.usNextActionData = 10000; // UNless he's has a pending action, delete what he was doing! // Cancel anything he was doing - if ( gpDestSoldier->bAction != AI_ACTION_PENDING_ACTION ) + if ( gpDestSoldier->aiData.bAction != AI_ACTION_PENDING_ACTION ) { CancelAIAction( gpDestSoldier, TRUE ); } @@ -1100,7 +1105,7 @@ BOOLEAN HandleTalkingMenu( ) { return( HandleTalkingMenuEscape( gTalkPanel.fHandledCanDeleteVal, FALSE ) ); } - + return( FALSE ); } @@ -1112,7 +1117,7 @@ BOOLEAN TalkingMenuDialogue( UINT16 usQuoteNum ) gTalkPanel.fOnName = FALSE; //gTalkPanel.fHandled = FALSE; - CHECKF( CharacterDialogue( gTalkPanel.ubCharNum, usQuoteNum, gTalkPanel.iFaceIndex, DIALOGUE_NPC_UI, FALSE, FALSE ) != FALSE ); + CHECKF( CharacterDialogue( gTalkPanel.ubCharNum, usQuoteNum, gTalkPanel.iFaceIndex, DIALOGUE_NPC_UI, FALSE, FALSE ) != FALSE ); return( TRUE ); } @@ -1155,7 +1160,7 @@ BOOLEAN HandleTalkingMenuEscape( BOOLEAN fCanDelete , BOOLEAN fFromEscKey ) { fTalking = pFace->fTalking; } - + // Set to false gTalkPanel.fHandled = FALSE; @@ -1167,7 +1172,7 @@ BOOLEAN HandleTalkingMenuEscape( BOOLEAN fCanDelete , BOOLEAN fFromEscKey ) ShutupaYoFace( gTalkPanel.iFaceIndex ); } // Else if our queue is empty, delete menu - else + else { if ( DialogueQueueIsEmpty( ) && fCanDelete ) { @@ -1179,7 +1184,7 @@ BOOLEAN HandleTalkingMenuEscape( BOOLEAN fCanDelete , BOOLEAN fFromEscKey ) } } } - else + else { if ( DialogueQueueIsEmpty( ) && fCanDelete ) { @@ -1196,7 +1201,6 @@ BOOLEAN HandleTalkingMenuEscape( BOOLEAN fCanDelete , BOOLEAN fFromEscKey ) void HandleTalkingMenuBackspace( void ) { FACETYPE *pFace; - //BOOLEAN fTalking = FALSE; if ( !gfInTalkPanel ) { @@ -1216,7 +1220,7 @@ void HandleTalkingMenuBackspace( void ) { fTalking = pFace->fTalking; } - + // Set to false gTalkPanel.fHandled = FALSE; @@ -1241,7 +1245,7 @@ void CalculatePopupTextOrientation( INT16 sWidth, INT16 sHeight ) { fOKLeft = TRUE; } - + // Check bottom sY = gTalkPanel.sY + sHeight + gTalkPanel.usHeight; @@ -1314,13 +1318,13 @@ void CalculatePopupTextPosition( INT16 sWidth, INT16 sHeight ) // Set it here! gTalkPanel.sPopupX = gTalkPanel.sX - sWidth; // Center in height! - gTalkPanel.sPopupY = gTalkPanel.sY + ( gTalkPanel.usHeight / 2 ) - ( sHeight / 2 ); + gTalkPanel.sPopupY = gTalkPanel.sY + ( gTalkPanel.usHeight / 2 ) - ( sHeight / 2 ); break; case TALK_PANEL_POPUP_RIGHT: // Set it here! gTalkPanel.sPopupX = gTalkPanel.sX + gTalkPanel.usWidth + 1; // Center in height! - gTalkPanel.sPopupY = gTalkPanel.sY + ( gTalkPanel.usHeight / 2 ) - ( sHeight / 2 ); + gTalkPanel.sPopupY = gTalkPanel.sY + ( gTalkPanel.usHeight / 2 ) - ( sHeight / 2 ); break; case TALK_PANEL_POPUP_BOTTOM: @@ -1343,7 +1347,7 @@ void CalculatePopupTextPosition( INT16 sWidth, INT16 sHeight ) BOOLEAN TalkingMenuGiveItem( UINT8 ubNPC, OBJECTTYPE *pObject, INT8 bInvPos ) { - CHECKF( SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_GIVE_ITEM, (UINT32) ubNPC, (UINT32)pObject, (UINT32) bInvPos, gTalkPanel.iFaceIndex, DIALOGUE_NPC_UI ) != FALSE ); + CHECKF( SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_GIVE_ITEM, (UINT32) ubNPC, (UINT32)pObject, (UINT32) bInvPos, gTalkPanel.iFaceIndex, DIALOGUE_NPC_UI ) != FALSE ); return( TRUE ); } @@ -1357,9 +1361,9 @@ BOOLEAN NPCTriggerNPC( UINT8 ubTargetNPC, UINT8 ubTargetRecord, UINT8 ubTargetAp } -BOOLEAN NPCGotoGridNo( UINT8 ubTargetNPC, UINT16 usGridNo, UINT8 ubRecordNum ) +BOOLEAN NPCGotoGridNo( UINT8 ubTargetNPC, INT16 sGridNo, UINT8 ubRecordNum ) { - CHECKF( SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_GOTO_GRIDNO, ubTargetNPC, usGridNo, ubRecordNum, gTalkPanel.iFaceIndex, DIALOGUE_NPC_UI ) != FALSE ); + CHECKF( SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_GOTO_GRIDNO, ubTargetNPC, sGridNo, ubRecordNum, gTalkPanel.iFaceIndex, DIALOGUE_NPC_UI ) != FALSE ); return( TRUE ); } @@ -1367,14 +1371,14 @@ BOOLEAN NPCGotoGridNo( UINT8 ubTargetNPC, UINT16 usGridNo, UINT8 ubRecordNum ) BOOLEAN NPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum ) { - CHECKF( SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_DO_ACTION, ubTargetNPC, usActionCode, ubQuoteNum, gTalkPanel.iFaceIndex, DIALOGUE_NPC_UI ) != FALSE ); + CHECKF( SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_DO_ACTION, ubTargetNPC, usActionCode, ubQuoteNum, gTalkPanel.iFaceIndex, DIALOGUE_NPC_UI ) != FALSE ); return( TRUE ); } BOOLEAN NPCClosePanel( ) { - CHECKF( SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_CLOSE_PANEL, 0, 0, 0, 0, DIALOGUE_NPC_UI ) != FALSE ); + CHECKF( SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_CLOSE_PANEL, 0, 0, 0, 0, DIALOGUE_NPC_UI ) != FALSE ); return( TRUE ); } @@ -1391,7 +1395,7 @@ BOOLEAN SourceSoldierPointerIsValidAndReachableForGive( SOLDIERTYPE * pGiver ) { return( FALSE ); } - if ( gpSrcSoldier->bLife < OKLIFE || ( gpSrcSoldier->bBreath < OKBREATH && gpSrcSoldier->bCollapsed ) ) + if ( gpSrcSoldier->stats.bLife < OKLIFE || ( gpSrcSoldier->bBreath < OKBREATH && gpSrcSoldier->bCollapsed ) ) { return( FALSE ); } @@ -1402,7 +1406,7 @@ BOOLEAN SourceSoldierPointerIsValidAndReachableForGive( SOLDIERTYPE * pGiver ) } // pointer should always be valid anyhow - if( PythSpacesAway( pGiver->sGridNo, gpSrcSoldier->sGridNo ) > gpSrcSoldier->GetMaxDistanceVisible(pGiver->sGridNo, gpSrcSoldier->bLevel) ) + if( PythSpacesAway( pGiver->sGridNo, gpSrcSoldier->sGridNo ) > gpSrcSoldier->GetMaxDistanceVisible(pGiver->sGridNo, gpSrcSoldier->pathing.bLevel) ) { return FALSE; } @@ -1413,10 +1417,10 @@ BOOLEAN SourceSoldierPointerIsValidAndReachableForGive( SOLDIERTYPE * pGiver ) return( FALSE ); } - return( TRUE ); + return( TRUE ); } - + void HandleNPCItemGiven( UINT8 ubNPC, OBJECTTYPE *pObject, INT8 bInvPos ) { @@ -1445,7 +1449,7 @@ void HandleNPCItemGiven( UINT8 ubNPC, OBJECTTYPE *pObject, INT8 bInvPos ) DeleteTalkingMenu( ); // Give this to buddy! - SoldierGiveItem( gpDestSoldier, gpSrcSoldier, pObject, bInvPos ); + SoldierGiveItem( gpDestSoldier, gpSrcSoldier, pObject, bInvPos ); } } @@ -1472,8 +1476,8 @@ void HandleNPCTriggerNPC( UINT8 ubTargetNPC, UINT8 ubTargetRecord, BOOLEAN fShow { // make sure they are in the right alert status to receive orders (it's a bug that // this could be set for the player...) - pSoldier->bAlertStatus = STATUS_GREEN; - pSoldier->uiStatusFlags &= (~SOLDIER_ENGAGEDINACTION ); + pSoldier->aiData.bAlertStatus = STATUS_GREEN; + pSoldier->flags.uiStatusFlags &= (~SOLDIER_ENGAGEDINACTION ); } // OH BOY, CHECK IF THIS IS THE SAME PERSON WHO IS ON THE MENU @@ -1492,7 +1496,7 @@ void HandleNPCTriggerNPC( UINT8 ubTargetNPC, UINT8 ubTargetRecord, BOOLEAN fShow { // ALRIGHTY, NOW DO THIS! - // WAIT IN NON-INTERACTIVE MODE UNTIL TIMER IS DONE + // WAIT IN NON-INTERACTIVE MODE UNTIL TIMER IS DONE // SO WE CAN SEE NPC RADIO LOCATOR // THEN AFTER THIS IS DONE, DO THE STUFF // Setup timer! @@ -1539,7 +1543,7 @@ void HandleNPCTrigger( ) if ( gfInTalkPanel ) { - if ( pSoldier == gpDestSoldier ) + if ( pSoldier == gpDestSoldier ) { if ( gfShowDialogueMenu ) { @@ -1564,7 +1568,7 @@ void HandleNPCTrigger( ) if ( SourceSoldierPointerIsValidAndReachableForGive( pSoldier ) ) { InitiateConversation( pSoldier, gpSrcSoldier, gubTargetApproach, gubTargetRecord ); - return; + return; } else { @@ -1574,7 +1578,7 @@ void HandleNPCTrigger( ) ubPlayerID = WhoIsThere2( sPlayerGridNo, 0 ); if (ubPlayerID != NOBODY) { - InitiateConversation( pSoldier, MercPtrs[ ubPlayerID ], gubTargetApproach, gubTargetRecord ); + InitiateConversation( pSoldier, MercPtrs[ ubPlayerID ], gubTargetApproach, gubTargetRecord ); return; } } @@ -1613,9 +1617,9 @@ void HandleWaitTimerForNPCTrigger( ) -void HandleNPCGotoGridNo( UINT8 ubTargetNPC, UINT16 usGridNo, UINT8 ubQuoteNum ) +void HandleNPCGotoGridNo( UINT8 ubTargetNPC, INT16 sGridNo, UINT8 ubQuoteNum ) { - SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pSoldier; // OK, Move to gridNo! // Shotdown any panel we had up... @@ -1629,28 +1633,28 @@ void HandleNPCGotoGridNo( UINT8 ubTargetNPC, UINT16 usGridNo, UINT8 ubQuoteNum ) } // zap any delay in this soldier - ZEROTIMECOUNTER( pSoldier->AICounter ); - if (pSoldier->bNextAction == AI_ACTION_WAIT) + ZEROTIMECOUNTER( pSoldier->timeCounters.AICounter ); + if (pSoldier->aiData.bNextAction == AI_ACTION_WAIT) { - pSoldier->bNextAction = AI_ACTION_NONE; - pSoldier->usNextActionData = 0; + pSoldier->aiData.bNextAction = AI_ACTION_NONE; + pSoldier->aiData.usNextActionData = 0; } // if player controlled, set under AI control flag if (pSoldier->bTeam == gbPlayerNum) { - pSoldier->uiStatusFlags |= SOLDIER_PCUNDERAICONTROL; + pSoldier->flags.uiStatusFlags |= SOLDIER_PCUNDERAICONTROL; } // OK, set in motion! - pSoldier->bNextAction = AI_ACTION_WALK; + pSoldier->aiData.bNextAction = AI_ACTION_WALK; // Set dest! - pSoldier->usNextActionData = usGridNo; + pSoldier->aiData.usNextActionData = sGridNo; // UNless he's has a pending action, delete what he was doing! // Cancel anything he was doing - if ( pSoldier->bAction != AI_ACTION_PENDING_ACTION ) + if ( pSoldier->aiData.bAction != AI_ACTION_PENDING_ACTION ) { CancelAIAction( pSoldier, TRUE ); } @@ -1659,15 +1663,15 @@ void HandleNPCGotoGridNo( UINT8 ubTargetNPC, UINT16 usGridNo, UINT8 ubQuoteNum ) // Set flags to do stuff once there... pSoldier->ubQuoteRecord = ( ubQuoteNum + 1 ); pSoldier->ubQuoteActionID = ActionIDForMovementRecord( ubTargetNPC, ubQuoteNum ); - + // Set absolute dest - pSoldier->sAbsoluteFinalDestination = usGridNo; + pSoldier->sAbsoluteFinalDestination = sGridNo; // handle this guy's AI right away so that we can get him moving - pSoldier->fAIFlags |= AI_HANDLE_EVERY_FRAME; + pSoldier->aiData.fAIFlags |= AI_HANDLE_EVERY_FRAME; } -void HandleNPCClosePanel( ) +void HandleNPCClosePanel( ) { // Remove dialogue! DeleteTalkingMenu( ); @@ -1741,7 +1745,7 @@ void HandleFactForNPCUnescorted( UINT8 ubNPC ) case MARY: SetFactFalse( FACT_JOHN_AND_MARY_EPCS ); break; - case JOHN: + case JOHN: SetFactFalse( FACT_JOHN_AND_MARY_EPCS ); break; } @@ -1752,7 +1756,7 @@ void HandleFactForNPCUnescorted( UINT8 ubNPC ) void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum ) { INT32 cnt; - SOLDIERTYPE *pSoldier, *pSoldier2; + SOLDIERTYPE *pSoldier, *pSoldier2; INT8 bNumDone = 0; INT16 sGridNo = NOWHERE, sAdjustedGridNo; INT8 bItemIn; @@ -1777,7 +1781,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum // if not already facing in that direction, if (pSoldier->ubDirection != ubDesiredMercDir) { - EVENT_SetSoldierDesiredDirection( pSoldier, ubDesiredMercDir ); + pSoldier->EVENT_SetSoldierDesiredDirection( ubDesiredMercDir ); } } } @@ -1794,12 +1798,12 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum // OK, we want to goto the basement level! //DEF: First thing, Add the exit grid to the map temps file - + ExitGrid.ubGotoSectorX = 10; ExitGrid.ubGotoSectorY = 1; ExitGrid.ubGotoSectorZ = 1; - ExitGrid.usGridNo = 12722; - + ExitGrid.sGridNo = 12722; + ApplyMapChangesToMapTempFile( TRUE ); AddExitGridToWorld( 7887, &ExitGrid ); ApplyMapChangesToMapTempFile( FALSE ); @@ -1810,11 +1814,11 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum //ATE:Alrighty, instead of being a dufuss here, let's actually use the current // Squad here to search for... - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) - { + { // Are we in this sector, On the current squad? - if ( pSoldier->bActive && pSoldier->bLife >= OKLIFE && pSoldier->bInSector && pSoldier->bAssignment == CurrentSquad( ) ) + if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && pSoldier->bInSector && pSoldier->bAssignment == CurrentSquad( ) ) { gfTacticalTraversal = TRUE; SetGroupSectorValue( 10, 1, 1, pSoldier->ubGroupID ); @@ -1856,7 +1860,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum break; case NPC_ACTION_FATIMA_GIVE_LETTER: - + // Delete menu, give item to megual DeleteTalkingMenu( ); @@ -1877,9 +1881,9 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum INT8 bInvPos; // Look for item.... - bInvPos = FindObj( pSoldier, 227 ); + bInvPos = FindObj( pSoldier, LETTER ); - AssertMsg( bInvPos != NO_SLOT, "Interface Dialogue.C: Gift item does not exist in NPC." ); + AssertMsg( bInvPos != NO_SLOT, "Interface Dialogue.C: Gift item does not exist in NPC." ); SoldierGiveItem( pSoldier, pSoldier2, &(pSoldier->inv[ bInvPos ] ), bInvPos ); } @@ -1895,10 +1899,10 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum } pSoldier->ubQuoteRecord = ubQuoteNum; - pSoldier->ubQuoteActionID = QUOTE_ACTION_ID_TURNTOWARDSPLAYER; + pSoldier->ubQuoteActionID = QUOTE_ACTION_ID_TURNTOWARDSPLAYER; // handle AI for this person every frame until a player merc is near - pSoldier->fAIFlags |= AI_HANDLE_EVERY_FRAME; + pSoldier->aiData.fAIFlags |= AI_HANDLE_EVERY_FRAME; break; case NPC_ACTION_OPEN_CLOSEST_DOOR: @@ -1927,30 +1931,34 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum return; } - if (pSoldier->inv[HANDPOS].usItem != NOTHING) + if (pSoldier->inv[HANDPOS].exists() == true) { UINT16 usGun; INT8 bNewSlot, bOldSlot; - + usGun = pSoldier->inv[HANDPOS].usItem; - ReLoadSoldierAnimationDueToHandItemChange( pSoldier, pSoldier->inv[HANDPOS].usItem, NOTHING ); + pSoldier->ReLoadSoldierAnimationDueToHandItemChange( pSoldier->inv[HANDPOS].usItem, NOTHING ); AutoPlaceObject( pSoldier, &(pSoldier->inv[HANDPOS]), FALSE ); - + bNewSlot = FindObj( pSoldier, usGun ); if ( bNewSlot != NO_SLOT && gMercProfiles[ ubTargetNPC ].inv[ bNewSlot ] == NOTHING ) { - // find where the gun is stored in the profile data and + // find where the gun is stored in the profile data and // move it to the new location bOldSlot = FindObjectInSoldierProfile( ubTargetNPC, usGun ); - if ( bOldSlot != NO_SLOT ) + if ( bOldSlot != NO_SLOT ) { + // CHRISL: Need to rearrange status as well + gMercProfiles[ ubTargetNPC ].bInvStatus[ bNewSlot ] = gMercProfiles[ ubTargetNPC ].bInvStatus[ bOldSlot ]; + gMercProfiles[ ubTargetNPC ].bInvStatus[ bOldSlot ] = 0; + // rearrange profile... NB # of guns can only be 1 so this is easy gMercProfiles[ ubTargetNPC ].inv[ bOldSlot ] = NOTHING; gMercProfiles[ ubTargetNPC ].bInvNumber[ bOldSlot ] = 0; gMercProfiles[ ubTargetNPC ].inv[ bNewSlot ] = usGun; - gMercProfiles[ ubTargetNPC ].bInvNumber[ bNewSlot ] = 1; + gMercProfiles[ ubTargetNPC ].bInvNumber[ bNewSlot ] = 1; } } } @@ -1959,10 +1967,10 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum case NPC_ACTION_READY_GUN: // Get pointer for player pSoldier = FindSoldierByProfileID( ubTargetNPC, FALSE ); - if (pSoldier && pSoldier->inv[HANDPOS].usItem != NOTHING) + if (pSoldier && pSoldier->inv[HANDPOS].exists() == true) { sGridNo = pSoldier->sGridNo + DirectionInc( pSoldier->ubDirection ); - SoldierReadyWeapon( pSoldier, (INT16) (sGridNo % WORLD_COLS), (INT16) (sGridNo / WORLD_COLS), FALSE ); + pSoldier->SoldierReadyWeapon( (INT16) (sGridNo % WORLD_COLS), (INT16) (sGridNo / WORLD_COLS), FALSE ); } break; @@ -1970,7 +1978,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum pSoldier = FindSoldierByProfileID( ubTargetNPC, FALSE ); if (pSoldier) { - pSoldier->fUIMovementFast = TRUE; + pSoldier->flags.fUIMovementFast = TRUE; } break; @@ -1978,7 +1986,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum pSoldier = FindSoldierByProfileID( ubTargetNPC, FALSE ); if (pSoldier) { - pSoldier->fUIMovementFast = FALSE; + pSoldier->flags.fUIMovementFast = FALSE; } break; @@ -1993,7 +2001,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum pSoldier = FindSoldierByProfileID( ubTargetNPC, FALSE ); if (pSoldier) { - ReceivingSoldierCancelServices( pSoldier ); + pSoldier->ReceivingSoldierCancelServices( ); } break; @@ -2032,10 +2040,10 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum // Delete menu DeleteTalkingMenu( ); - if ( PlayerTeamFull( ) ) - { + if ( PlayerTeamFull( ) ) + { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ CANNOT_RECRUIT_TEAM_FULL ] ); - } + } else { RecruitRPC( ubTargetNPC ); @@ -2060,7 +2068,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum { //MakeCivHostile( pSoldier, 2 ); } - if (pSoldier->ubProfile != NO_PROFILE && pSoldier->bLife >= OKLIFE) + if (pSoldier->ubProfile != NO_PROFILE && pSoldier->stats.bLife >= OKLIFE) { // trigger quote! //TriggerNPCWithIHateYouQuote( pSoldier->ubProfile ); @@ -2091,11 +2099,11 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum // For one, loop through our current squad and move them over cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) - { + { // Are we in this sector, On the current squad? - if ( pSoldier->bActive && pSoldier->bLife >= OKLIFE && pSoldier->bInSector ) + if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && pSoldier->bInSector ) { gfTacticalTraversal = TRUE; SetGroupSectorValue( 10, 1, 0, pSoldier->ubGroupID ); @@ -2200,7 +2208,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum { return; } - if ( !pSoldier->bNeutral ) + if ( !pSoldier->aiData.bNeutral ) { DeleteTalkingMenu(); SetSoldierNeutral( pSoldier ); @@ -2210,7 +2218,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum { CheckForEndOfCombatMode( FALSE ); } - } + } break; case NPC_ACTION_THREATENINGLY_RAISE_GUN: @@ -2227,7 +2235,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum { SwapObjs( pSoldier, HANDPOS, bItemIn, TRUE ); sGridNo = pSoldier->sGridNo + DirectionInc( pSoldier->ubDirection ); - SoldierReadyWeapon( pSoldier, (INT16) (sGridNo % WORLD_COLS), (INT16) (sGridNo / WORLD_COLS), FALSE ); + pSoldier->SoldierReadyWeapon( (INT16) (sGridNo % WORLD_COLS), (INT16) (sGridNo / WORLD_COLS), FALSE ); } // fall through so that the person faces the nearest merc! case NPC_ACTION_TURN_TO_FACE_NEAREST_MERC: @@ -2242,7 +2250,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum // if not already facing in that direction, if (pSoldier->ubDirection != ubDesiredMercDir) { - EVENT_SetSoldierDesiredDirection( pSoldier, ubDesiredMercDir ); + pSoldier->EVENT_SetSoldierDesiredDirection( ubDesiredMercDir ); } } } @@ -2284,7 +2292,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum if (sAdjustedGridNo != -1) { NPCGotoGridNo( 114, sAdjustedGridNo, ubQuoteNum ); - } + } } } break; @@ -2297,7 +2305,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum break; case NPC_ACTION_ENABLE_CAMBRIA_DOCTOR_BONUS: - // add event in a + // add event in a iRandom = Random( 24 ); AddFutureDayStrategicEvent( EVENT_SET_BY_NPC_SYSTEM, ( GetWorldMinutesInDay() + ( ( 24 + iRandom ) * 60 ) ), NPC_SYSTEM_EVENT_ACTION_PARAM_BONUS + NPC_ACTION_ENABLE_CAMBRIA_DOCTOR_BONUS, 1 ); break; @@ -2363,22 +2371,20 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum // add a money item with $10000 to the tile in front of Kyle // and then have him pick it up { - OBJECTTYPE Object; INT16 sGridNo = 14952; INT32 iWorldItem; pSoldier = FindSoldierByProfileID( ubTargetNPC, FALSE ); if (pSoldier) { - CreateItem( MONEY, 1, &Object ); - Object.ItemData.Money.uiMoneyAmount = 10000; - AddItemToPoolAndGetIndex( sGridNo, &Object, -1, pSoldier->bLevel, 0, 0, &iWorldItem ); - + CreateMoney(10000, &gTempObject ); + AddItemToPoolAndGetIndex( sGridNo, &gTempObject, -1, pSoldier->pathing.bLevel, 0, 0, -1, &iWorldItem ); + // shouldn't have any current action but make sure everything // is clear... and set pending action so the guy won't move // until the pickup is completed CancelAIAction(pSoldier,FORCE); - pSoldier->bAction = AI_ACTION_PENDING_ACTION; + pSoldier->aiData.bAction = AI_ACTION_PENDING_ACTION; pSoldier->ubQuoteRecord = NPC_ACTION_KYLE_GETS_MONEY; SoldierPickupItem( pSoldier, iWorldItem, sGridNo, ITEM_IGNORE_Z_LEVEL ); @@ -2393,9 +2399,9 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum case NPC_ACTION_MARTHA_DIES: pSoldier = FindSoldierByProfileID( MARTHA, FALSE ); if (pSoldier) - { + { DeleteTalkingMenu(); - EVENT_SoldierGotHit( pSoldier, 1, 100, 10, pSoldier->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, AIM_SHOT_TORSO, 0, NOWHERE ); + pSoldier->EVENT_SoldierGotHit( 1, 100, 10, pSoldier->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, AIM_SHOT_TORSO, 0, NOWHERE ); } break; @@ -2466,7 +2472,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum // JA3Gold: unlock the doors instead of opening them { DOOR* pDoor; - + pDoor = FindDoorInfoAtGridNo( sGridNo ); if (pDoor) { @@ -2580,7 +2586,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum if ( pSoldier != NULL ) { - TacticalRemoveSoldier( pSoldier->ubID ); + TacticalRemoveSoldier( pSoldier->ubID ); } // Find queen and joe and remove from sector... @@ -2588,7 +2594,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum if ( pSoldier != NULL ) { - TacticalRemoveSoldier( pSoldier->ubID ); + TacticalRemoveSoldier( pSoldier->ubID ); } break; @@ -2600,7 +2606,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum if ( pSoldier != NULL ) { - TacticalRemoveSoldier( pSoldier->ubID ); + TacticalRemoveSoldier( pSoldier->ubID ); } // End meanwhile.... @@ -2627,7 +2633,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum StartDialogueMessageBox( ubTargetNPC, usActionCode ); break; case NPC_ACTION_HAVE_MARRIED_NPC_LEAVE_TEAM: - + // get the soldier pSoldier = FindSoldierByProfileID( gMercProfiles[ DARYL ].bNPCData, FALSE ); pSoldier2 = gpDestSoldier; @@ -2785,7 +2791,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum case MARY: UnRecruitEPC( JOHN ); break; - case JOHN: + case JOHN: UnRecruitEPC( MARY ); break; } @@ -2847,12 +2853,12 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum case NPC_ACTION_DECIDE_ACTIVE_TERRORISTS: { - // only (now) add all terrorist files to laptop + // only (now) add all terrorist files to laptop UINT8 ubLoop; // one terrorist will always be Elgin // determine how many more terrorists - 2 to 4 more - + ubLoop = 0; while ( gubTerrorists[ ubLoop ] != 0 ) { @@ -2901,7 +2907,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum // the next time we change sectors, quest 2 will be set to done IncrementTownLoyaltyEverywhere( LOYALTY_BONUS_TERRORISTS_DEALT_WITH ); - } + } // anyhow Carmen has given the player money so reset his balance to 0. gMercProfiles[ CARMEN ].uiMoney = 0; break; @@ -2935,8 +2941,8 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum } else if (!PTR_STANDING) { - pSoldier->bNextAction = AI_ACTION_CHANGE_STANCE; - pSoldier->usNextActionData = ANIM_STAND; + pSoldier->aiData.bNextAction = AI_ACTION_CHANGE_STANCE; + pSoldier->aiData.usNextActionData = ANIM_STAND; } } break; @@ -3001,7 +3007,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum case NPC_ACTION_SET_MATT_RECORD_13_USED: SetQuoteRecordAsUsed( ubTargetNPC, 13 ); break; - + case NPC_ACTION_TRIGGER_MATT: if ( CheckFact( FACT_DYNAMO_IN_J9, MATT ) ) { @@ -3036,7 +3042,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum TriggerNPCRecord( ubTargetNPC, 18 ); } break; - + case NPC_ACTION_MADLAB_ATTACHES_GOOD_CAMERA: SetFactFalse( FACT_MADLAB_HAS_GOOD_CAMERA ); pSoldier = FindSoldierByProfileID( MADLAB, FALSE ); @@ -3045,9 +3051,9 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum { // Give weapon to robot INT8 bSlot; - + bSlot = FindObjClass( pSoldier, IC_GUN ); - if ( bSlot != NO_SLOT ) + if ( bSlot != NO_SLOT ) { AutoPlaceObject( pSoldier2, &( pSoldier->inv[ bSlot ] ) , FALSE ); } @@ -3110,7 +3116,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum if (bMoneySlot != NO_SLOT && bEmptySlot != NO_SLOT) { CreateMoney( gMercProfiles[ ubTargetNPC ].iBalance * 2, &(pSoldier->inv[ bEmptySlot ] ) ); - pSoldier->inv[ bMoneySlot ].ItemData.Money.uiMoneyAmount -= gMercProfiles[ ubTargetNPC ].iBalance * 2; + pSoldier->inv[ bMoneySlot ][0]->data.money.uiMoneyAmount -= gMercProfiles[ ubTargetNPC ].iBalance * 2; if (bMoneySlot < bEmptySlot) { // move main stash to later in inventory! @@ -3136,7 +3142,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum if ( InARoom( pSoldier->sGridNo, &ubRoom ) && (ubRoom == 1 || ubRoom == 2 || ubRoom == 3 ) ) { // Kingpin is in the club - TriggerNPCRecord( DARREN, 31 ); + TriggerNPCRecord( DARREN, 31 ); break; } } @@ -3145,7 +3151,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum break; case NPC_ACTION_OPEN_CLOSEST_CABINET: - + // Delete menu DeleteTalkingMenu( ); @@ -3165,16 +3171,16 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum case NPC_ACTION_GET_ITEMS_FROM_CLOSEST_CABINET: pSoldier = FindSoldierByProfileID( ubTargetNPC, FALSE ); if (pSoldier) - { + { // shouldn't have any current action but make sure everything // is clear... and set pending action so the guy won't move // until the pickup is completed CancelAIAction(pSoldier,FORCE); - pSoldier->bAction = AI_ACTION_PENDING_ACTION; - + pSoldier->aiData.bAction = AI_ACTION_PENDING_ACTION; + // make sure the pickup starts dammit! - pSoldier->fInNonintAnim = FALSE; - pSoldier->fRTInNonintAnim = FALSE; + pSoldier->flags.fInNonintAnim = FALSE; + pSoldier->flags.fRTInNonintAnim = FALSE; if ( pSoldier->ubProfile == ARMAND ) { @@ -3187,14 +3193,14 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum SoldierPickupItem( pSoldier, ITEM_PICKUP_ACTION_ALL, sGridNo, ITEM_IGNORE_Z_LEVEL ); } - + break; case NPC_ACTION_SHOW_TIXA: SetTixaAsFound(); AddHistoryToPlayersLog( HISTORY_DISCOVERED_TIXA, 0, GetWorldTotalMin(), gWorldSectorX, gWorldSectorY ); break; case NPC_ACTION_SHOW_ORTA: - SetOrtaAsFound(); + SetOrtaAsFound(); AddHistoryToPlayersLog( HISTORY_DISCOVERED_ORTA, 0, GetWorldTotalMin(), gWorldSectorX, gWorldSectorY ); break; case NPC_ACTION_SLAP: @@ -3203,7 +3209,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum pSoldier = FindSoldierByProfileID( QUEEN, FALSE ); if (pSoldier) { - EVENT_InitNewSoldierAnim( pSoldier, QUEEN_SLAP, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( QUEEN_SLAP, 0 , FALSE ); } break; @@ -3249,37 +3255,37 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum // Use a different approach.... if ( usActionCode == NPC_ACTION_PUNCH_PC_SLOT_0 ) { - pSoldier->uiPendingActionData4 = APPROACH_DONE_PUNCH_0; + pSoldier->aiData.uiPendingActionData4 = APPROACH_DONE_PUNCH_0; } else if ( usActionCode == NPC_ACTION_PUNCH_PC_SLOT_1 ) { - pSoldier->uiPendingActionData4 = APPROACH_DONE_PUNCH_1; + pSoldier->aiData.uiPendingActionData4 = APPROACH_DONE_PUNCH_1; } else if ( usActionCode == NPC_ACTION_PUNCH_PC_SLOT_2 ) { - pSoldier->uiPendingActionData4 = APPROACH_DONE_PUNCH_2; + pSoldier->aiData.uiPendingActionData4 = APPROACH_DONE_PUNCH_2; } - if ( pTarget && pTarget->bActive && pTarget->bInSector && pTarget->bLife != 0 ) + if ( pTarget && pTarget->bActive && pTarget->bInSector && pTarget->stats.bLife != 0 ) { - pSoldier->bNextAction = AI_ACTION_KNIFE_MOVE; - pSoldier->usNextActionData = pTarget->sGridNo; - pSoldier->fAIFlags |= AI_HANDLE_EVERY_FRAME; + pSoldier->aiData.bNextAction = AI_ACTION_KNIFE_MOVE; + pSoldier->aiData.usNextActionData = pTarget->sGridNo; + pSoldier->aiData.fAIFlags |= AI_HANDLE_EVERY_FRAME; // UNless he's has a pending action, delete what he was doing! // Cancel anything he was doing - if ( pSoldier->bAction != AI_ACTION_PENDING_ACTION ) + if ( pSoldier->aiData.bAction != AI_ACTION_PENDING_ACTION ) { CancelAIAction( pSoldier, TRUE ); } //HandleItem( pSoldier, pTarget->sGridNo, 0, NOTHING, FALSE ); - pSoldier->uiStatusFlags |= SOLDIER_NPC_DOING_PUNCH; + pSoldier->flags.uiStatusFlags |= SOLDIER_NPC_DOING_PUNCH; } else { - TriggerNPCWithGivenApproach( pSoldier->ubProfile, (UINT8)pSoldier->uiPendingActionData4, FALSE ); + TriggerNPCWithGivenApproach( pSoldier->ubProfile, (UINT8)pSoldier->aiData.uiPendingActionData4, FALSE ); } } break; @@ -3295,12 +3301,12 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum SOLDIERTYPE *pTarget; pTarget = FindSoldierByProfileID( ELLIOT, FALSE ); - + if ( pTarget ) { // Set special flag.... - pTarget->uiStatusFlags |= SOLDIER_NPC_SHOOTING; - pSoldier->uiStatusFlags |= SOLDIER_NPC_SHOOTING; + pTarget->flags.uiStatusFlags |= SOLDIER_NPC_SHOOTING; + pSoldier->flags.uiStatusFlags |= SOLDIER_NPC_SHOOTING; pSoldier->bAimShotLocation = AIM_SHOT_HEAD; @@ -3308,26 +3314,26 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum CreateItem( (UINT16) (DESERTEAGLE), 100, &( pSoldier->inv[ HANDPOS ] ) ); // Make shoot - pSoldier->bNextAction = AI_ACTION_FIRE_GUN; - pSoldier->usNextActionData = pTarget->sGridNo; - pSoldier->fAIFlags |= AI_HANDLE_EVERY_FRAME; + pSoldier->aiData.bNextAction = AI_ACTION_FIRE_GUN; + pSoldier->aiData.usNextActionData = pTarget->sGridNo; + pSoldier->aiData.fAIFlags |= AI_HANDLE_EVERY_FRAME; // UNless he's has a pending action, delete what he was doing! // Cancel anything he was doing - if ( pSoldier->bAction != AI_ACTION_PENDING_ACTION ) + if ( pSoldier->aiData.bAction != AI_ACTION_PENDING_ACTION ) { CancelAIAction( pSoldier, TRUE ); } - // change elliot portrait... - gMercProfiles[ ELLIOT ].bNPCData = 17; + // change elliot portrait... + gMercProfiles[ ELLIOT ].bNPCData = 17; } } break; //Emmons: is this line of code part of something missing - //or no longer necessary? CJC - //if ( pSoldier->uiStatusFlags & SOLDIER_NPC_SHOOTING ) + //or no longer necessary? CJC + //if ( pSoldier->flags.uiStatusFlags & SOLDIER_NPC_SHOOTING ) case NPC_ACTION_PUNCH_FIRST_LIVING_PC: @@ -3353,19 +3359,19 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum pTarget = MercPtrs[ ubTargetID ]; } - pSoldier->uiPendingActionData4 = APPROACH_DONE_PUNCH_1; + pSoldier->aiData.uiPendingActionData4 = APPROACH_DONE_PUNCH_1; // If we are elliot, we can't do unconocious guys.... if ( pSoldier->ubProfile == ELLIOT ) { - if ( pTarget->bActive && pTarget->bInSector && pTarget->bLife >= OKLIFE ) + if ( pTarget->bActive && pTarget->bInSector && pTarget->stats.bLife >= OKLIFE ) { fGoodTarget = TRUE; } } else { - if ( pTarget->bActive && pTarget->bInSector && pTarget->bLife != 0 ) + if ( pTarget->bActive && pTarget->bInSector && pTarget->stats.bLife != 0 ) { fGoodTarget = TRUE; } @@ -3374,18 +3380,18 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum if ( fGoodTarget ) { - pSoldier->bNextAction = AI_ACTION_KNIFE_MOVE; - pSoldier->usNextActionData = pTarget->sGridNo; - pSoldier->fAIFlags |= AI_HANDLE_EVERY_FRAME; + pSoldier->aiData.bNextAction = AI_ACTION_KNIFE_MOVE; + pSoldier->aiData.usNextActionData = pTarget->sGridNo; + pSoldier->aiData.fAIFlags |= AI_HANDLE_EVERY_FRAME; // UNless he's has a pending action, delete what he was doing! // Cancel anything he was doing - if ( pSoldier->bAction != AI_ACTION_PENDING_ACTION ) + if ( pSoldier->aiData.bAction != AI_ACTION_PENDING_ACTION ) { CancelAIAction( pSoldier, TRUE ); } - pSoldier->uiStatusFlags |= SOLDIER_NPC_DOING_PUNCH; + pSoldier->flags.uiStatusFlags |= SOLDIER_NPC_DOING_PUNCH; break; } } @@ -3393,7 +3399,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum if ( cnt == 3 ) { // If here, nobody was found... - TriggerNPCWithGivenApproach( pSoldier->ubProfile, (UINT8)pSoldier->uiPendingActionData4, FALSE ); + TriggerNPCWithGivenApproach( pSoldier->ubProfile, (UINT8)pSoldier->aiData.uiPendingActionData4, FALSE ); } } break; @@ -3404,7 +3410,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum pSoldier = FindSoldierByProfileID( ubTargetNPC, FALSE ); if (pSoldier) { - EVENT_InitNewSoldierAnim( pSoldier, QUEEN_FRUSTRATED_SLAP, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( QUEEN_FRUSTRATED_SLAP, 0 , FALSE ); } break; case NPC_ACTION_START_TIMER_ON_KEITH_GOING_OUT_OF_BUSINESS: @@ -3565,8 +3571,8 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum TriggerNPCRecord( ubTargetNPC, 18 ); } } - } - } + } + } break; case NPC_ACTION_CHECK_DOCTORING_MONEY_GIVEN: break; @@ -3578,11 +3584,11 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum //HOSPITAL_PATIENT_DISTANCE cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) - { + { // Are we in this sector, On the current squad? - if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife > 0 && pSoldier->bLife < pSoldier->bLifeMax && pSoldier->bAssignment != ASSIGNMENT_HOSPITAL && PythSpacesAway( pSoldier->sGridNo, pSoldier2->sGridNo ) < HOSPITAL_PATIENT_DISTANCE ) + if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 && pSoldier->stats.bLife < pSoldier->stats.bLifeMax && pSoldier->bAssignment != ASSIGNMENT_HOSPITAL && PythSpacesAway( pSoldier->sGridNo, pSoldier2->sGridNo ) < HOSPITAL_PATIENT_DISTANCE ) { - SetSoldierAssignment( pSoldier, ASSIGNMENT_HOSPITAL, 0, 0, 0 ); + SetSoldierAssignment( pSoldier, ASSIGNMENT_HOSPITAL, 0, 0, 0 ); TriggerNPCRecord( pSoldier->ubProfile, 2 ); pSoldier->bHospitalPriceModifier = gbHospitalPriceModifier; // make sure this person doesn't have an absolute dest any more @@ -3596,7 +3602,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum break; case NPC_ACTION_START_DOCTORING: { - + // reset fact he is expecting money fromt the player SetFactFalse( FACT_VINCE_EXPECTING_MONEY ); @@ -3625,7 +3631,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum TriggerNPCRecord( ELLIOT, 3 ); } else - { + { TriggerNPCRecord( ELLIOT, 1 ); } break; @@ -3641,7 +3647,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum break; case NPC_ACTION_KROTT_ALIVE_LOYALTY_BOOST: -/* Delayed loyalty effects elimininated. Sep.12/98. ARM +/* Delayed loyalty effects elimininated. Sep.12/98. ARM AddFutureDayStrategicEvent( EVENT_SET_BY_NPC_SYSTEM, 480 + Random( 60 ), NPC_SYSTEM_EVENT_ACTION_PARAM_BONUS + NPC_ACTION_KROTT_ALIVE_LOYALTY_BOOST, 1 ); */ if ( gMercProfiles[ SERGEANT ].bMercStatus != MERC_IS_DEAD ) @@ -3689,7 +3695,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum pSoldier = FindSoldierByProfileID( STEVE, FALSE ); // Steve Willis, 80 if (pSoldier) { - if ( !pSoldier->bActive || !pSoldier->bInSector || !(pSoldier->bTeam == CIV_TEAM) || !(pSoldier->bNeutral) || (pSoldier->bLife < OKLIFE) ) + if ( !pSoldier->bActive || !pSoldier->bInSector || !(pSoldier->bTeam == CIV_TEAM) || !(pSoldier->aiData.bNeutral) || (pSoldier->stats.bLife < OKLIFE) ) { pSoldier = NULL; } @@ -3698,7 +3704,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum pSoldier2 = FindSoldierByProfileID( VINCE, FALSE ); // Vince, 69 if (pSoldier2) { - if ( !pSoldier2->bActive || !pSoldier2->bInSector || !(pSoldier2->bTeam == CIV_TEAM) || !(pSoldier2->bNeutral) || (pSoldier2->bLife < OKLIFE) ) + if ( !pSoldier2->bActive || !pSoldier2->bInSector || !(pSoldier2->bTeam == CIV_TEAM) || !(pSoldier2->aiData.bNeutral) || (pSoldier2->stats.bLife < OKLIFE) ) { pSoldier2 = NULL; } @@ -3713,12 +3719,12 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum if( ( pSoldier ) && ( pSoldier2 ) ) { if( pSoldier->sGridNo == 10343 ) - { + { pSoldier2 = NULL; } else if( pSoldier2->sGridNo == 10343 ) { - pSoldier = NULL; + pSoldier = NULL; } } @@ -3734,7 +3740,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum pSoldier2 = NULL; } } - + // only one pointer left... if ( pSoldier ) @@ -3745,7 +3751,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum { TriggerNPCRecord( ubTargetNPC, 13 ); } - + break; case NPC_ACTION_INVOKE_CONVERSATION_MODE: @@ -3770,7 +3776,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum } if ( pSoldier2 ) - { + { InitiateConversation( pSoldier, pSoldier2, NPC_INITIAL_QUOTE, 0 ); } } @@ -3844,7 +3850,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum break; case NPC_ACTION_TRIGGER_MARY_OR_JOHN_RECORD_9: pSoldier = FindSoldierByProfileID ( MARY, FALSE ); - if ( pSoldier && pSoldier->bLife >= OKLIFE ) + if ( pSoldier && pSoldier->stats.bLife >= OKLIFE ) { TriggerNPCRecord( MARY, 9 ); } @@ -3855,7 +3861,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum break; case NPC_ACTION_TRIGGER_MARY_OR_JOHN_RECORD_10: pSoldier = FindSoldierByProfileID ( MARY, FALSE ); - if ( pSoldier && pSoldier->bLife >= OKLIFE ) + if ( pSoldier && pSoldier->stats.bLife >= OKLIFE ) { TriggerNPCRecord( MARY, 10 ); } @@ -3870,7 +3876,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum if ( pSoldier && pSoldier->ubBodyType == CRIPPLECIV ) { DeleteTalkingMenu(); - EVENT_InitNewSoldierAnim( pSoldier, CRIPPLE_KICKOUT, 0, TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( CRIPPLE_KICKOUT, 0, TRUE ); } break; @@ -3879,7 +3885,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum if ( pSoldier && pSoldier->ubBodyType == CRIPPLECIV ) { DeleteTalkingMenu(); - EVENT_InitNewSoldierAnim( pSoldier, CRIPPLE_KICKOUT, 0, TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( CRIPPLE_KICKOUT, 0, TRUE ); } TriggerFriendWithHostileQuote( ubTargetNPC ); break; @@ -3896,9 +3902,9 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum case NPC_ACTION_CANCEL_WAYPOINTS: pSoldier = FindSoldierByProfileID ( ubTargetNPC, FALSE ); - if ( pSoldier ) + if ( pSoldier ) { - pSoldier->bOrders = ONGUARD; + pSoldier->aiData.bOrders = ONGUARD; } break; @@ -3934,9 +3940,9 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum gMercProfiles[ MANNY ].usStrategicInsertionData = 19904; gMercProfiles[ MANNY ].fUseProfileInsertionInfo = TRUE; pSoldier = FindSoldierByProfileID( MANNY, FALSE ); - if ( pSoldier ) + if ( pSoldier ) { - pSoldier->bOrders = STATIONARY; + pSoldier->aiData.bOrders = STATIONARY; } // close his panel too DeleteTalkingMenu(); @@ -3944,29 +3950,29 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum case NPC_ACTION_MAKE_BRENDA_STATIONARY: pSoldier = FindSoldierByProfileID( BRENDA, FALSE ); - if ( pSoldier ) + if ( pSoldier ) { gMercProfiles[ BRENDA ].ubMiscFlags3 |= PROFILE_MISC_FLAG3_PERMANENT_INSERTION_CODE; gMercProfiles[ BRENDA ].ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; gMercProfiles[ BRENDA ].usStrategicInsertionData = pSoldier->sGridNo; gMercProfiles[ BRENDA ].fUseProfileInsertionInfo = TRUE; - pSoldier->bOrders = STATIONARY; + pSoldier->aiData.bOrders = STATIONARY; } break; case NPC_ACTION_MAKE_MIGUEL_STATIONARY: pSoldier = FindSoldierByProfileID( MIGUEL, FALSE ); - if ( pSoldier ) + if ( pSoldier ) { gMercProfiles[ MIGUEL ].ubMiscFlags3 |= PROFILE_MISC_FLAG3_PERMANENT_INSERTION_CODE; gMercProfiles[ MIGUEL ].ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; gMercProfiles[ MIGUEL ].usStrategicInsertionData = pSoldier->sGridNo; gMercProfiles[ MIGUEL ].fUseProfileInsertionInfo = TRUE; - pSoldier->bOrders = STATIONARY; + pSoldier->aiData.bOrders = STATIONARY; } break; - + case NPC_ACTION_TRIGGER_DARREN_OR_KINGPIN_IMPRESSED: if ( BoxerAvailable() ) { @@ -3985,7 +3991,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum gMercProfiles[ RAT ].sSectorX = 9; gMercProfiles[ RAT ].sSectorY = MAP_ROW_G; gMercProfiles[ RAT ].bSectorZ = 0; - break; + break; case NPC_ACTION_ENDGAME_STATE_1: @@ -3993,7 +3999,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum if ( gubQuest[ 15 ] == QUESTINPROGRESS ) { // This is not the end, 'cause momma creature is still alive - TriggerNPCRecordImmediately( 136, 8 ); + TriggerNPCRecordImmediately( 136, 8 ); EndQueenDeathEndgame( ); } else @@ -4039,7 +4045,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum pSoldier->ubCivilianGroup = 0; break; - case NPC_ACTION_TIMER_FOR_VEHICLE: + case NPC_ACTION_TIMER_FOR_VEHICLE: AddFutureDayStrategicEvent( EVENT_SET_BY_NPC_SYSTEM, GetWorldMinutesInDay(), NPC_SYSTEM_EVENT_ACTION_PARAM_BONUS + NPC_ACTION_TIMER_FOR_VEHICLE, 1 ); break; @@ -4161,7 +4167,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum AddHistoryToPlayersLog( HISTORY_ASSASSIN, 0, GetWorldTotalMin(), gWorldSectorX, gWorldSectorY ); break; case NPC_ACTION_TRIGGER_HANS_BY_ROOM: - { + { if ( gpSrcSoldier ) { UINT8 ubRoom; @@ -4234,7 +4240,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum if ( pSoldier ) { pSoldier->sBreathRed = 10000; - pSoldier->bBreath = 100; + pSoldier->bBreath = 100; ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, gzLateLocalizedString[ 50 ] ); } break; @@ -4278,13 +4284,13 @@ UINT32 CalcPatientMedicalCost( SOLDIERTYPE * pSoldier ) { return( 0 ); } - - uiCost = 10 * ( pSoldier->bLifeMax - pSoldier->bLife ); - if ( pSoldier->bLife < OKLIFE ) + uiCost = 10 * ( pSoldier->stats.bLifeMax - pSoldier->stats.bLife ); + + if ( pSoldier->stats.bLife < OKLIFE ) { // charge additional $25 for every point below OKLIFE he is - uiCost += ( 25 * ( OKLIFE - pSoldier->bLife ) ); + uiCost += ( 25 * ( OKLIFE - pSoldier->stats.bLife ) ); } // also charge $2 for each point of bleeding that must be stopped @@ -4340,9 +4346,9 @@ UINT32 CalcMedicalCost( UINT8 ubId ) for ( cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++) { pSoldier = MercPtrs[ cnt ]; - if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife > 0 && pSoldier->bAssignment != ASSIGNMENT_HOSPITAL ) + if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 && pSoldier->bAssignment != ASSIGNMENT_HOSPITAL ) { - if ( pSoldier->bLife < pSoldier->bLifeMax ) + if ( pSoldier->stats.bLife < pSoldier->stats.bLifeMax ) { if (PythSpacesAway( sGridNo, pSoldier->sGridNo ) <= HOSPITAL_PATIENT_DISTANCE) { @@ -4365,7 +4371,7 @@ UINT32 CalcMedicalCost( UINT8 ubId ) BOOLEAN PlayerTeamHasTwoSpotsLeft( ) { UINT32 cnt, uiCount = 0; - SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pSoldier; for ( cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID, pSoldier = MercPtrs[ cnt ]; cnt <= (UINT32)( gTacticalStatus.Team[ gbPlayerNum ].bLastID - 2 ); cnt++, pSoldier++ ) { @@ -4496,7 +4502,7 @@ void DialogueMessageBoxCallBack( UINT8 ubExitValue ) pSoldier = FindSoldierByProfileID( MARY, FALSE ); if ( pSoldier && !PlayerTeamHasTwoSpotsLeft() ) { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ CANNOT_RECRUIT_TEAM_FULL ] ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ CANNOT_RECRUIT_TEAM_FULL ] ); break; } } @@ -4514,7 +4520,7 @@ void DialogueMessageBoxCallBack( UINT8 ubExitValue ) ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ NOW_BING_ESCORTED_STR ], gMercProfiles[ ubProfile ].zNickname, ( pSoldier->bAssignment + 1 ) ); // Change Squads.... - SetCurrentSquad( pSoldier ->bAssignment, FALSE ); + SetCurrentSquad( pSoldier->bAssignment, FALSE ); HandleStuffForNPCEscorted( ubProfile ); } @@ -4591,8 +4597,8 @@ void DialogueMessageBoxCallBack( UINT8 ubExitValue ) cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++ ) - { - if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife >= OKLIFE && pSoldier->bBreath >= OKBREATH ) + { + if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE && pSoldier->bBreath >= OKBREATH ) { if (!pLier || (EffectiveWisdom( pSoldier ) + EffectiveLeadership( pSoldier ) > EffectiveWisdom( pLier ) + EffectiveLeadership( pSoldier ) ) ) { @@ -4639,7 +4645,7 @@ void DialogueMessageBoxCallBack( UINT8 ubExitValue ) { TriggerNPCRecord( VINCE, 26 ); } - else if( CheckFact( FACT_ONE_WOUNDED_MERC_NEARBY, VINCE ) ) + else if( CheckFact( FACT_ONE_WOUNDED_MERC_NEARBY, VINCE ) ) { TriggerNPCRecord( VINCE, 25 ); } @@ -4678,7 +4684,7 @@ void DialogueMessageBoxCallBack( UINT8 ubExitValue ) { TriggerNPCRecord( STEVE, 26 ); } - else if( CheckFact( FACT_ONE_WOUNDED_MERC_NEARBY, STEVE ) ) + else if( CheckFact( FACT_ONE_WOUNDED_MERC_NEARBY, STEVE ) ) { TriggerNPCRecord( STEVE, 25 ); } @@ -4724,10 +4730,8 @@ void DialogueMessageBoxCallBack( UINT8 ubExitValue ) pSoldier = FindSoldierByProfileID( DARYL, FALSE ); if ( pSoldier ) { - OBJECTTYPE Key; - - CreateKeyObject( &Key, 1, 38 ); - AutoPlaceObject( pSoldier, &Key, FALSE ); + CreateKeyObject( &gTempObject, 1, 38 ); + AutoPlaceObject( pSoldier, &gTempObject, FALSE ); } TriggerNPCRecord( DARYL, 11 ); } @@ -4752,7 +4756,7 @@ void DoneFadeOutActionBasement( ) gpTacticalTraversalGroup = NULL; gpTacticalTraversalChosenSoldier = NULL; - // Remove crate + // Remove crate RemoveStructFromUnLoadedMapTempFile( 7887, SECONDOSTRUCT1, 10, 1, 0 ); // Add crate AddStructToUnLoadedMapTempFile( 8207, SECONDOSTRUCT1, 10, 1, 0 ); @@ -4780,12 +4784,12 @@ void DoneFadeInActionBasement( ) INT32 cnt; // Look for someone to talk to - // look for all mercs on the same team, + // look for all mercs on the same team, cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) - { + { // Are we in this sector, On the current squad? - if ( pSoldier->bActive && pSoldier->bLife >= OKLIFE && pSoldier->bInSector && pSoldier->bAssignment == CurrentSquad( ) ) + if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && pSoldier->bInSector && pSoldier->bAssignment == CurrentSquad( ) ) { break; } @@ -4868,8 +4872,8 @@ BOOLEAN NPCOpenThing( SOLDIERTYPE *pSoldier, BOOLEAN fDoor ) { return( FALSE ); } - - pStructure = FindStructure( sStructGridNo, STRUCTURE_OPENABLE ); + + pStructure = FindStructure( sStructGridNo, STRUCTURE_OPENABLE ); } if ( pStructure == NULL ) @@ -4887,12 +4891,12 @@ BOOLEAN NPCOpenThing( SOLDIERTYPE *pSoldier, BOOLEAN fDoor ) // anything that an NPC opens this way should become unlocked! pDoor = FindDoorInfoAtGridNo( sStructGridNo ); - if ( pDoor ) + if ( pDoor ) { pDoor->fLocked = FALSE; } - sActionGridNo = FindAdjacentGridEx( pSoldier, sStructGridNo, &ubDirection, NULL, FALSE, TRUE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, sStructGridNo, &ubDirection, NULL, FALSE, TRUE ); if ( sActionGridNo == -1 ) { return( FALSE ); @@ -4906,14 +4910,14 @@ BOOLEAN NPCOpenThing( SOLDIERTYPE *pSoldier, BOOLEAN fDoor ) // check if we are at this location if ( pSoldier->sGridNo == sGridNo ) { - InteractWithInteractiveObject( pSoldier, pStructure, ubDirection ); + InteractWithInteractiveObject( pSoldier, pStructure, ubDirection ); } else { - SendGetNewSoldierPathEvent( pSoldier, sGridNo, pSoldier->usUIMovementMode ); + SendGetNewSoldierPathEvent( pSoldier, sGridNo, pSoldier->usUIMovementMode ); } - pSoldier->bAction = AI_ACTION_PENDING_ACTION; + pSoldier->aiData.bAction = AI_ACTION_PENDING_ACTION; return( TRUE ); diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 7f4a7636..4d293eb4 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -5,8 +5,8 @@ #include "builddefines.h" #include #include - #include - #include "sgp.h" + #include + #include "sgp.h" #include "gameloop.h" #include "himage.h" #include "vobject.h" @@ -75,6 +75,11 @@ #include "Map Screen Interface Map.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + #define ITEMDESC_FONT BLOCKFONT2 #define ITEMDESC_FONTSHADOW1 MILITARY_SHADOW #define ITEMDESC_FONTSHADOW2 32 @@ -108,12 +113,23 @@ #define ITEM_STATS_WIDTH 26 #define ITEM_STATS_HEIGHT 8 -#define ITEMDESC_START_X 214 -#define ITEMDESC_START_Y 1 + INV_INTERFACE_START_Y -#define ITEMDESC_HEIGHT 133 -#define ITEMDESC_WIDTH 320 -#define MAP_ITEMDESC_HEIGHT 268 -#define MAP_ITEMDESC_WIDTH 272 +//LBE node stuff +// Changed some coord defines to INT16s so we can adjust their value based on game options +INT16 ITEMDESC_START_X; +INT16 ITEMDESC_START_Y; +INT16 ITEMDESC_HEIGHT; +INT16 ITEMDESC_WIDTH; +INT16 MAP_ITEMDESC_HEIGHT; +INT16 MAP_ITEMDESC_WIDTH; +extern int SM_ITEMDESC_START_X; +extern int SM_ITEMDESC_START_Y; + +//#define ITEMDESC_START_X 214 +//#define ITEMDESC_START_Y 1 + INV_INTERFACE_START_Y +//#define ITEMDESC_HEIGHT 133 +//#define ITEMDESC_WIDTH 320 +//#define MAP_ITEMDESC_HEIGHT 268 +//#define MAP_ITEMDESC_WIDTH 272 #define ITEMDESC_NAME_X (16 + gsInvDescX) #define ITEMDESC_NAME_Y (67 + gsInvDescY) #define ITEMDESC_CALIBER_X (162 + gsInvDescX) @@ -207,13 +223,18 @@ #define BAD_MAGAZINE 10 #define BAD_AP_COST 9 #define BAD_RELIABILITY -2 -#define BAD_REPAIR_EASE -2 -#define BAD_ACCURACY -1 +#define BAD_REPAIR_EASE -2 +#define BAD_ACCURACY -1 -#define KEYRING_X 487 -#define KEYRING_Y (105 + INV_INTERFACE_START_Y) -#define MAP_KEYRING_X 217 -#define MAP_KEYRING_Y 271 +// CHRISL: Adjust coords for layout changes needed for new inventory system +extern int KEYRING_X; +extern int KEYRING_Y; +extern int MAP_KEYRING_X; +extern int MAP_KEYRING_Y; +//#define KEYRING_X 487 +//#define KEYRING_Y (105 + INV_INTERFACE_START_Y) +//#define MAP_KEYRING_X 217 +//#define MAP_KEYRING_Y 271 #define KEYRING_WIDTH 30 #define KEYRING_HEIGHT 24 #define TACTICAL_INVENTORY_KEYRING_GRAPHIC_OFFSET_X 215 @@ -257,6 +278,7 @@ BOOLEAN gbItemPointerLocateGood = FALSE; // ITEM DESCRIPTION BOX STUFF UINT32 guiItemDescBox; +UINT32 guiItemDescBoxBackground; UINT32 guiMapItemDescBox; UINT32 guiItemGraphic; UINT32 guiMoneyGraphicsForDescBox; @@ -281,7 +303,7 @@ INT32 giItemDescAmmoButton; BOOLEAN gfItemAmmoDown = FALSE; SOLDIERTYPE *gpItemDescSoldier; BOOLEAN fItemDescDelete = FALSE; -MOUSE_REGION gItemDescAttachmentRegions[4]; +MOUSE_REGION gItemDescAttachmentRegions[MAX_ATTACHMENTS]; MOUSE_REGION gProsAndConsRegions[2]; void BtnMoneyButtonCallback(GUI_BUTTON *btn,INT32 reason); @@ -289,20 +311,19 @@ UINT32 guiMoneyButtonBtn[MAX_ATTACHMENTS]; INT32 guiMoneyButtonImage; INT32 guiMoneyDoneButtonImage; -UINT16 gusOriginalAttachItem[ MAX_ATTACHMENTS ]; -UINT8 gbOriginalAttachStatus[ MAX_ATTACHMENTS ]; +attachmentList gOriginalAttachments; SOLDIERTYPE * gpAttachSoldier; extern BOOLEAN gfSMDisableForItems; typedef struct -{ +{ UINT16 x; UINT16 y; } MoneyLoc; /* - * Yes i know thats a little bit compicated but remeber that we have now only tactical screen + * Yes i know thats a little bit compicated but remeber that we have now only tactical screen * a little bit dynamic and customizable. * gMoneyButtonLoc its a location of money button * we need to initialize it in run-time becouse we dona have constant initializer @@ -310,7 +331,7 @@ typedef struct */ MoneyLoc gMoneyButtonLoc;// = { (343 + INTERFACE_START_Y), ( 11 + INV_INTERFACE_START_Y ) }; MoneyLoc gMoneyButtonOffsets[] = { 0,0, 34,0, 0,32, 34,32, 8,22 }; -MoneyLoc gMapMoneyButtonLoc = { 174, 115 }; +MoneyLoc gMapMoneyButtonLoc = { 174, 115 }; // show the description extern BOOLEAN fShowDescriptionFlag; @@ -319,21 +340,23 @@ extern BOOLEAN fShowInventoryFlag; void ItemDescAttachmentsCallback( MOUSE_REGION * pRegion, INT32 iReason ); void ItemDescAmmoCallback(GUI_BUTTON *btn,INT32 reason); void DeletePool(ITEM_POOL *pItemPool); - + // number of keys on keyring, temp for now #define NUMBER_KEYS_ON_KEYRING 28 #define KEY_RING_ROW_WIDTH 7 #define MAP_KEY_RING_ROW_WIDTH 4 +#define INV_ITEM_ROW_WIDTH 7 +#define MAP_INV_ITEM_ROW_WIDTH 4 // ITEM STACK POPUP STUFF BOOLEAN gfInItemStackPopup = FALSE; UINT32 guiItemPopupBoxes; OBJECTTYPE *gpItemPopupObject; -INT16 gsItemPopupWidth; +INT16 gsItemPopupWidth; INT16 gsItemPopupHeight; INT16 gsItemPopupX; INT16 gsItemPopupY; -MOUSE_REGION gItemPopupRegions[8]; +MOUSE_REGION gItemPopupRegions[MAX_OBJECTS_PER_SLOT]; MOUSE_REGION gKeyRingRegions[ NUMBER_KEYS_ON_KEYRING ]; BOOLEAN gfInKeyRingPopup = FALSE; UINT8 gubNumItemPopups = 0; @@ -431,7 +454,7 @@ typedef struct typedef struct { INT32 iXPosition[NUM_INV_HELPTEXT_ENTRIES]; - INT32 iYPosition[NUM_INV_HELPTEXT_ENTRIES]; + INT32 iYPosition[NUM_INV_HELPTEXT_ENTRIES]; INT32 iWidth[NUM_INV_HELPTEXT_ENTRIES]; STR16 sString1[NUM_INV_HELPTEXT_ENTRIES]; STR16 sString2[NUM_INV_HELPTEXT_ENTRIES]; @@ -448,7 +471,7 @@ INV_DESC_STATS gWeaponStats[] = 202, 50, 32, 265, 50, 20, 234, 50, 0, - 290, 50, 0, + 290, 50, 0, }; @@ -456,33 +479,33 @@ INV_DESC_STATS gWeaponStats[] = INV_DESC_STATS gMoneyStats[] = { 202, 14, 78, - 212, 25, 78, - 202, 40, 78, - 212, 51, 78, + 212, 25, 78, + 202, 40, 78, + 212, 51, 78, }; // displayed AFTER the mass/weight/"Kg" line INV_DESC_STATS gMapMoneyStats[] = { - 51, 97, 45, - 61, 107, 75, - 51, 125, 45, - 61, 135, 70, + 51, 97, 45, + 61, 107, 75, + 51, 125, 45, + 61, 135, 70, }; INV_DESC_STATS gMapWeaponStats[] = { - 72 - 20, 20+80+8, 80, - 72 - 20, 20+80-2, 80, - 72 - 20, 20+80-2, 80, - 72+65 - 20, 40+80+4, 21, - 72 - 20, 40+80+4, 30, - 72 - 20, 53+80+2, 30, - 72+65 - 20, 53+80+2, 25, - 86, 53+80+2, 0, - 145, 53+80+2, 0, - + 72 - 20, 20+80+8, 80, + 72 - 20, 20+80-2, 80, + 72 - 20, 20+80-2, 80, + 72+65 - 20, 40+80+4, 21, + 72 - 20, 40+80+4, 30, + 72 - 20, 53+80+2, 30, + 72+65 - 20, 53+80+2, 25, + 86, 53+80+2, 0, + 145, 53+80+2, 0, + }; @@ -505,13 +528,13 @@ INV_ATTACHXY gMapItemDescAttachmentsXY[] = SGPRect gItemDescProsConsRects[] = {// NB the left value is calculated based on the width of the 'pros' and 'cons' labels 0, 111, 313, 118, - 0, 119, 313, 126 + 0, 119, 313, 126 }; SGPRect gMapItemDescProsConsRects[] = { 0, 231, 313, 238, - 0, 239, 313, 246, + 0, 239, 313, 246, }; @@ -527,28 +550,9 @@ INV_HELPTEXT gItemDescHelpText = BOOLEAN gfItemDescHelpTextOffset = FALSE; // ARRAY FOR INV PANEL INTERFACE ITEM POSITIONS (sX,sY get set via InitInvSlotInterface() ) -INV_REGIONS gSMInvData[] = -{ - FALSE, INV_BAR_DX, INV_BAR_DY, HEAD_INV_SLOT_WIDTH, HEAD_INV_SLOT_HEIGHT, 0, 0, // HELMETPOS - FALSE, INV_BAR_DX, INV_BAR_DY, VEST_INV_SLOT_WIDTH, VEST_INV_SLOT_HEIGHT, 0, 0, // VESTPOS - FALSE, INV_BAR_DX, INV_BAR_DY, LEGS_INV_SLOT_WIDTH, LEGS_INV_SLOT_HEIGHT, 0, 0, // LEGPOS, - FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0, // HEAD1POS - FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0, // HEAD2POS - TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0, // HANDPOS, - TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0, // SECONDHANDPOS - TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0, // BIGPOCK1 - TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0, // BIGPOCK2 - TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0, // BIGPOCK3 - TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0, // BIGPOCK4 - FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0, // SMALLPOCK1 - FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0, // SMALLPOCK2 - FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0, // SMALLPOCK3 - FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0, // SMALLPOCK4 - FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0, // SMALLPOCK5 - FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0, // SMALLPOCK6 - FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0, // SMALLPOCK7 - FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0 // SMALLPOCK8 -}; +/* CHRISL: Add new region definitions for the new inventory slots needed for the new inventory +system to work properly. */ +INV_REGIONS gSMInvData[NUM_INV_SLOTS]; typedef struct @@ -563,13 +567,13 @@ REMOVE_MONEY gRemoveMoney; MOUSE_REGION gSMInvRegion[ NUM_INV_SLOTS ]; MOUSE_REGION gKeyRingPanel; MOUSE_REGION gSMInvCamoRegion; -INT8 gbCompatibleAmmo[ NUM_INV_SLOTS ]; -INT8 gbInvalidPlacementSlot[ NUM_INV_SLOTS ]; +INT8 gbCompatibleAmmo[ NUM_INV_SLOTS ]; +INT8 gbInvalidPlacementSlot[ NUM_INV_SLOTS ]; UINT16 us16BPPItemCyclePlacedItemColors[ 20 ]; // Kaiden: Vehicle Inventory change - Increase this from 4-2 to 5-2 UINT32 guiBodyInvVO[ 5 ][ 2 ]; UINT32 guiGoldKeyVO; -INT8 gbCompatibleApplyItem = FALSE; +INT8 gbCompatibleApplyItem = FALSE; BOOLEAN AttemptToAddSubstring( STR16 zDest, STR16 zTemp, UINT32 * puiStringLength, UINT32 uiPixLimit ) { @@ -610,7 +614,7 @@ void GenerateProsString( STR16 zItemPros, OBJECTTYPE * pObject, UINT32 uiPixLimi ubWeight = Item[ usItem ].ubWeight; if (Item[ usItem ].usItemClass == IC_GUN) { - ubWeight = ubWeight + Item[ pObject->ItemData.Gun.usGunAmmoItem ].ubWeight; + ubWeight = ubWeight + Item[ (*pObject)[0]->data.gun.usGunAmmoItem ].ubWeight; } if (Weapon[usItem].bAccuracy >= EXCEPTIONAL_ACCURACY ) @@ -618,7 +622,7 @@ void GenerateProsString( STR16 zItemPros, OBJECTTYPE * pObject, UINT32 uiPixLimi zTemp = Message[STR_ACCURATE]; if ( ! AttemptToAddSubstring( zItemPros, zTemp, &uiStringLength, uiPixLimit ) ) { - return; + return; } } @@ -627,16 +631,19 @@ void GenerateProsString( STR16 zItemPros, OBJECTTYPE * pObject, UINT32 uiPixLimi zTemp = Message[STR_LIGHT]; if ( ! AttemptToAddSubstring( zItemPros, zTemp, &uiStringLength, uiPixLimit ) ) { - return; + return; } } + //CHRISL: Using "FitsInSmallPocket" in NewInv will result in every item appearing to be "small". We don't want that so + // so in this case, even in NewInv, we should look at the items ubPerPocket value. + //if (FitsInSmallPocket(pObject) == true) // fits in a small pocket if (Item[usItem].ubPerPocket >= 1) // fits in a small pocket { zTemp = Message[STR_SMALL]; if ( ! AttemptToAddSubstring( zItemPros, zTemp, &uiStringLength, uiPixLimit ) ) { - return; + return; } } @@ -645,7 +652,7 @@ void GenerateProsString( STR16 zItemPros, OBJECTTYPE * pObject, UINT32 uiPixLimi zTemp = Message[STR_LONG_RANGE]; if ( ! AttemptToAddSubstring( zItemPros, zTemp, &uiStringLength, uiPixLimit ) ) { - return; + return; } } @@ -654,7 +661,7 @@ void GenerateProsString( STR16 zItemPros, OBJECTTYPE * pObject, UINT32 uiPixLimi zTemp = Message[STR_HIGH_DAMAGE]; if ( ! AttemptToAddSubstring( zItemPros, zTemp, &uiStringLength, uiPixLimit ) ) { - return; + return; } } @@ -663,7 +670,7 @@ void GenerateProsString( STR16 zItemPros, OBJECTTYPE * pObject, UINT32 uiPixLimi zTemp = Message[STR_QUICK_FIRING]; if ( ! AttemptToAddSubstring( zItemPros, zTemp, &uiStringLength, uiPixLimit ) ) { - return; + return; } } @@ -672,7 +679,7 @@ void GenerateProsString( STR16 zItemPros, OBJECTTYPE * pObject, UINT32 uiPixLimi zTemp = Message[STR_FAST_BURST]; if ( ! AttemptToAddSubstring( zItemPros, zTemp, &uiStringLength, uiPixLimit ) ) { - return; + return; } } @@ -681,7 +688,7 @@ void GenerateProsString( STR16 zItemPros, OBJECTTYPE * pObject, UINT32 uiPixLimi zTemp = Message[STR_LARGE_AMMO_CAPACITY]; if ( ! AttemptToAddSubstring( zItemPros, zTemp, &uiStringLength, uiPixLimit ) ) { - return; + return; } } @@ -690,7 +697,7 @@ void GenerateProsString( STR16 zItemPros, OBJECTTYPE * pObject, UINT32 uiPixLimi zTemp = Message[STR_RELIABLE]; if ( ! AttemptToAddSubstring( zItemPros, zTemp, &uiStringLength, uiPixLimit ) ) { - return; + return; } } @@ -699,7 +706,7 @@ void GenerateProsString( STR16 zItemPros, OBJECTTYPE * pObject, UINT32 uiPixLimi zTemp = Message[STR_EASY_TO_REPAIR]; if ( ! AttemptToAddSubstring( zItemPros, zTemp, &uiStringLength, uiPixLimit ) ) { - return; + return; } } @@ -708,7 +715,7 @@ void GenerateProsString( STR16 zItemPros, OBJECTTYPE * pObject, UINT32 uiPixLimi zTemp = Message[STR_AUTOFIRE]; if ( ! AttemptToAddSubstring( zItemPros, zTemp, &uiStringLength, uiPixLimit ) ) { - return; + return; } } @@ -717,7 +724,7 @@ void GenerateProsString( STR16 zItemPros, OBJECTTYPE * pObject, UINT32 uiPixLimi // empty string, so display "None" if ( ! AttemptToAddSubstring( zItemPros, Message[ STR_NONE ], &uiStringLength, uiPixLimit ) ) { - return; + return; } } } @@ -736,7 +743,7 @@ void GenerateConsString( STR16 zItemCons, OBJECTTYPE * pObject, UINT32 uiPixLimi zTemp = Message[STR_INACCURATE]; if ( ! AttemptToAddSubstring( zItemCons, zTemp, &uiStringLength, uiPixLimit ) ) { - return; + return; } } @@ -745,7 +752,7 @@ void GenerateConsString( STR16 zItemCons, OBJECTTYPE * pObject, UINT32 uiPixLimi zTemp = Message[STR_NO_SEMI_AUTO]; if ( ! AttemptToAddSubstring( zItemCons, zTemp, &uiStringLength, uiPixLimit ) ) { - return; + return; } } @@ -753,7 +760,8 @@ void GenerateConsString( STR16 zItemCons, OBJECTTYPE * pObject, UINT32 uiPixLimi ubWeight = Item[ usItem ].ubWeight; if (Item[ usItem ].usItemClass == IC_GUN) { - ubWeight = ubWeight + Item[ pObject->ItemData.Gun.usGunAmmoItem ].ubWeight; + ubWeight = ubWeight + CalculateAmmoWeight((*pObject)[0]->data.gun.usGunAmmoItem, (*pObject)[0]->data.gun.ubGunShotsLeft); + //ubWeight = ubWeight + Item[ (*pObject)[0]->data.gun.usGunAmmoItem ].ubWeight; } if (ubWeight >= BAD_WEIGHT) @@ -761,7 +769,7 @@ void GenerateConsString( STR16 zItemCons, OBJECTTYPE * pObject, UINT32 uiPixLimi zTemp = Message[STR_HEAVY]; if ( ! AttemptToAddSubstring( zItemCons, zTemp, &uiStringLength, uiPixLimit ) ) { - return; + return; } } @@ -770,17 +778,17 @@ void GenerateConsString( STR16 zItemCons, OBJECTTYPE * pObject, UINT32 uiPixLimi zTemp = Message[STR_SHORT_RANGE]; if ( ! AttemptToAddSubstring( zItemCons, zTemp, &uiStringLength, uiPixLimit ) ) { - return; + return; } } - + if (GetDamage(pObject) <= BAD_DAMAGE) { zTemp = Message[STR_LOW_DAMAGE]; if ( ! AttemptToAddSubstring( zItemCons, zTemp, &uiStringLength, uiPixLimit ) ) { - return; + return; } } @@ -789,7 +797,7 @@ void GenerateConsString( STR16 zItemCons, OBJECTTYPE * pObject, UINT32 uiPixLimi zTemp = Message[STR_SLOW_FIRING]; if ( ! AttemptToAddSubstring( zItemCons, zTemp, &uiStringLength, uiPixLimit ) ) { - return; + return; } } @@ -798,7 +806,7 @@ void GenerateConsString( STR16 zItemCons, OBJECTTYPE * pObject, UINT32 uiPixLimi zTemp = Message[STR_NO_BURST]; if ( ! AttemptToAddSubstring( zItemCons, zTemp, &uiStringLength, uiPixLimit ) ) { - return; + return; } } @@ -807,7 +815,7 @@ void GenerateConsString( STR16 zItemCons, OBJECTTYPE * pObject, UINT32 uiPixLimi zTemp = Message[STR_NO_AUTOFIRE]; if ( ! AttemptToAddSubstring( zItemCons, zTemp, &uiStringLength, uiPixLimit ) ) { - return; + return; } } @@ -816,7 +824,7 @@ void GenerateConsString( STR16 zItemCons, OBJECTTYPE * pObject, UINT32 uiPixLimi zTemp = Message[STR_SMALL_AMMO_CAPACITY]; if ( ! AttemptToAddSubstring( zItemCons, zTemp, &uiStringLength, uiPixLimit ) ) { - return; + return; } } @@ -825,7 +833,7 @@ void GenerateConsString( STR16 zItemCons, OBJECTTYPE * pObject, UINT32 uiPixLimi zTemp = Message[STR_UNRELIABLE]; if ( ! AttemptToAddSubstring( zItemCons, zTemp, &uiStringLength, uiPixLimit ) ) { - return; + return; } } @@ -834,7 +842,7 @@ void GenerateConsString( STR16 zItemCons, OBJECTTYPE * pObject, UINT32 uiPixLimi zTemp = Message[STR_HARD_TO_REPAIR]; if ( ! AttemptToAddSubstring( zItemCons, zTemp, &uiStringLength, uiPixLimit ) ) { - return; + return; } } @@ -844,25 +852,222 @@ void GenerateConsString( STR16 zItemCons, OBJECTTYPE * pObject, UINT32 uiPixLimi // empty string, so display "None" if ( ! AttemptToAddSubstring( zItemCons, Message[ STR_NONE ], &uiStringLength, uiPixLimit ) ) { - return; + return; } } } +// CHRISL: New function to setup GSMInvData based on game options +void InitInvData(INV_REGIONS &InvData, BOOLEAN fBigPocket, INT16 sBarDx, INT16 sBarDy, INT16 sWidth, INT16 sHeight, INT16 sX, INT16 sY) +{ + InvData.fBigPocket = fBigPocket; + InvData.sBarDx = sBarDx; + InvData.sBarDy = sBarDy; + InvData.sHeight = sHeight; + InvData.sWidth = sWidth; + InvData.sX = sX; + InvData.sY = sY; +} +void InitInventoryOld() +{ + BODYPOSFINAL = GUNSLINGPOCKPOS;//RESET in initInventory + BIGPOCKFINAL = BIGPOCK5POS;//RESET in initInventory + MEDPOCKSTART = SMALLPOCK1POS;//RESET in initInventory + MEDPOCKFINAL = SMALLPOCK1POS;//RESET in initInventory + SMALLPOCKFINAL = SMALLPOCK9POS;//RESET in initInventory + + + InitInvData(gSMInvData[HELMETPOS], FALSE, INV_BAR_DX, INV_BAR_DY, HEAD_INV_SLOT_WIDTH, HEAD_INV_SLOT_HEIGHT, 0, 0); // HELMETPOS + InitInvData(gSMInvData[VESTPOS], FALSE, INV_BAR_DX, INV_BAR_DY, VEST_INV_SLOT_WIDTH, VEST_INV_SLOT_HEIGHT, 0, 0); // VESTPOS + InitInvData(gSMInvData[LEGPOS], FALSE, INV_BAR_DX, INV_BAR_DY, LEGS_INV_SLOT_WIDTH, LEGS_INV_SLOT_HEIGHT, 0, 0); // LEGPOS + InitInvData(gSMInvData[HEAD1POS], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // HEAD1POS + InitInvData(gSMInvData[HEAD2POS], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // HEAD2POS + InitInvData(gSMInvData[HANDPOS], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0); // HANDPOS + InitInvData(gSMInvData[SECONDHANDPOS], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0); // SECONDHANDPOS + InitInvData(gSMInvData[BIGPOCK1POS], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0); // BIGPOCK1 + InitInvData(gSMInvData[BIGPOCK2POS], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0); // BIGPOCK2 + InitInvData(gSMInvData[BIGPOCK3POS], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0); // BIGPOCK3 + InitInvData(gSMInvData[BIGPOCK4POS], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0); // BIGPOCK4 + InitInvData(gSMInvData[SMALLPOCK1POS], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK1 + InitInvData(gSMInvData[SMALLPOCK2POS], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK2 + InitInvData(gSMInvData[SMALLPOCK3POS], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK3 + InitInvData(gSMInvData[SMALLPOCK4POS], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK4 + InitInvData(gSMInvData[SMALLPOCK5POS], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK5 + InitInvData(gSMInvData[SMALLPOCK6POS], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK6 + InitInvData(gSMInvData[SMALLPOCK7POS], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK7 + InitInvData(gSMInvData[SMALLPOCK8POS], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK8 +} +void InitInventoryNew() +{ + BODYPOSFINAL = GUNSLINGPOCKPOS;//RESET in initInventory + BIGPOCKFINAL = MEDPOCK1POS;//RESET in initInventory + MEDPOCKSTART = MEDPOCK1POS;//RESET in initInventory + MEDPOCKFINAL = SMALLPOCK1POS;//RESET in initInventory + SMALLPOCKFINAL = NUM_INV_SLOTS;//RESET in initInventory + + if(iResolution == 0){ + InitInvData(gSMInvData[0], FALSE, INV_BAR_DX, INV_BAR_DY, HEAD_INV_SLOT_WIDTH, HEAD_INV_SLOT_HEIGHT, 0, 0); // HELMETPOS + InitInvData(gSMInvData[1], FALSE, INV_BAR_DX, INV_BAR_DY, VEST_INV_SLOT_WIDTH, VEST_INV_SLOT_HEIGHT, 0, 0); // VESTPOS + InitInvData(gSMInvData[2], FALSE, INV_BAR_DX, INV_BAR_DY, LEGS_INV_SLOT_WIDTH, LEGS_INV_SLOT_HEIGHT, 0, 0); // LEGPOS + InitInvData(gSMInvData[3], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // HEAD1POS + InitInvData(gSMInvData[4], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // HEAD2POS + InitInvData(gSMInvData[5], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0); // HANDPOS + InitInvData(gSMInvData[6], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0); // SECONDHANDPOS + InitInvData(gSMInvData[7], FALSE, INV_BAR_DX, INV_BAR_DY, 30, 20, 0, 0); // VESTPOCKPOS + InitInvData(gSMInvData[8], FALSE, INV_BAR_DX, INV_BAR_DY, 30, 20, 0, 0); // LTHIGHPOCKPOS + InitInvData(gSMInvData[9], FALSE, INV_BAR_DX, INV_BAR_DY, 30, 20, 0, 0); // RTHIGHPOCKPOS + InitInvData(gSMInvData[10], FALSE, INV_BAR_DX, INV_BAR_DY, 30, 20, 0, 0); // CPACKPOCKPOS + InitInvData(gSMInvData[11], FALSE, INV_BAR_DX, INV_BAR_DY, 30, 20, 0, 0); // BPACKPOCKPOS + InitInvData(gSMInvData[12], TRUE, INV_BAR_DX, INV_BAR_DY, 48, 20, 0, 0); // GUNSLINGPOCKPOS + InitInvData(gSMInvData[13], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // KNIFEPOCKPOS + InitInvData(gSMInvData[14], TRUE, INV_BAR_DX, INV_BAR_DY, 48, 20, 0, 0); // BIGPOCK1 + InitInvData(gSMInvData[15], TRUE, INV_BAR_DX, INV_BAR_DY, 48, 20, 0, 0); // BIGPOCK2 + InitInvData(gSMInvData[16], TRUE, INV_BAR_DX, INV_BAR_DY, 48, 20, 0, 0); // BIGPOCK3 + InitInvData(gSMInvData[17], TRUE, INV_BAR_DX, INV_BAR_DY, 48, 20, 0, 0); // BIGPOCK4 + InitInvData(gSMInvData[18], TRUE, INV_BAR_DX, INV_BAR_DY, 48, 20, 0, 0); // BIGPOCK5 + InitInvData(gSMInvData[19], TRUE, INV_BAR_DX, INV_BAR_DY, 48, 20, 0, 0); // BIGPOCK6 + InitInvData(gSMInvData[20], TRUE, INV_BAR_DX, INV_BAR_DY, 48, 20, 0, 0); // BIGPOCK7 + InitInvData(gSMInvData[21], FALSE, INV_BAR_DX, INV_BAR_DY, 30, 20, 0, 0); // MEDPOCK1 + InitInvData(gSMInvData[22], FALSE, INV_BAR_DX, INV_BAR_DY, 30, 20, 0, 0); // MEDPOCK2 + InitInvData(gSMInvData[23], FALSE, INV_BAR_DX, INV_BAR_DY, 30, 20, 0, 0); // MEDPOCK3 + InitInvData(gSMInvData[24], FALSE, INV_BAR_DX, INV_BAR_DY, 30, 20, 0, 0); // MEDPOCK4 + InitInvData(gSMInvData[25], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK1 + InitInvData(gSMInvData[26], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK2 + InitInvData(gSMInvData[27], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK3 + InitInvData(gSMInvData[28], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK4 + InitInvData(gSMInvData[29], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK5 + InitInvData(gSMInvData[30], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK6 + InitInvData(gSMInvData[31], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK7 + InitInvData(gSMInvData[32], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK8 + InitInvData(gSMInvData[33], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK9 + InitInvData(gSMInvData[34], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK10 + InitInvData(gSMInvData[35], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK11 + InitInvData(gSMInvData[36], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK12 + InitInvData(gSMInvData[37], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK13 + InitInvData(gSMInvData[38], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK14 + InitInvData(gSMInvData[39], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK15 + InitInvData(gSMInvData[40], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK16 + InitInvData(gSMInvData[41], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK17 + InitInvData(gSMInvData[42], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK18 + InitInvData(gSMInvData[43], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK19 + InitInvData(gSMInvData[44], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK20 + InitInvData(gSMInvData[45], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK21 + InitInvData(gSMInvData[46], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK22 + InitInvData(gSMInvData[47], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK23 + InitInvData(gSMInvData[48], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK24 + InitInvData(gSMInvData[49], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK25 + InitInvData(gSMInvData[50], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK26 + InitInvData(gSMInvData[51], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK27 + InitInvData(gSMInvData[52], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK28 + InitInvData(gSMInvData[52], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK29 + InitInvData(gSMInvData[54], FALSE, INV_BAR_DX, INV_BAR_DY, 17, 20, 0, 0); // SMALLPOCK30 + } + else{ + InitInvData(gSMInvData[0], FALSE, INV_BAR_DX, INV_BAR_DY, HEAD_INV_SLOT_WIDTH, HEAD_INV_SLOT_HEIGHT, 0, 0); // HELMETPOS + InitInvData(gSMInvData[1], FALSE, INV_BAR_DX, INV_BAR_DY, VEST_INV_SLOT_WIDTH, VEST_INV_SLOT_HEIGHT, 0, 0); // VESTPOS + InitInvData(gSMInvData[2], FALSE, INV_BAR_DX, INV_BAR_DY, LEGS_INV_SLOT_WIDTH, LEGS_INV_SLOT_HEIGHT, 0, 0); // LEGPOS + InitInvData(gSMInvData[3], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // HEAD1POS + InitInvData(gSMInvData[4], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // HEAD2POS + InitInvData(gSMInvData[5], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0); // HANDPOS + InitInvData(gSMInvData[6], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0); // SECONDHANDPOS + InitInvData(gSMInvData[7], FALSE, INV_BAR_DX, INV_BAR_DY, VEST_INV_SLOT_WIDTH, VEST_INV_SLOT_HEIGHT, 0, 0); // VESTPOCKPOS + InitInvData(gSMInvData[8], FALSE, INV_BAR_DX, INV_BAR_DY, VEST_INV_SLOT_WIDTH, VEST_INV_SLOT_HEIGHT, 0, 0); // LTHIGHPOCKPOS + InitInvData(gSMInvData[9], FALSE, INV_BAR_DX, INV_BAR_DY, VEST_INV_SLOT_WIDTH, VEST_INV_SLOT_HEIGHT, 0, 0); // RTHIGHPOCKPOS + InitInvData(gSMInvData[10], FALSE, INV_BAR_DX, INV_BAR_DY, VEST_INV_SLOT_WIDTH, VEST_INV_SLOT_HEIGHT, 0, 0); // CPACKPOCKPOS + InitInvData(gSMInvData[11], FALSE, INV_BAR_DX, INV_BAR_DY, VEST_INV_SLOT_WIDTH, VEST_INV_SLOT_HEIGHT, 0, 0); // BPACKPOCKPOS + InitInvData(gSMInvData[12], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0); // GUNSLINGPOCKPOS + InitInvData(gSMInvData[13], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // KNIFEPOCKPOS + InitInvData(gSMInvData[14], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0); // BIGPOCK1 + InitInvData(gSMInvData[15], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0); // BIGPOCK2 + InitInvData(gSMInvData[16], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0); // BIGPOCK3 + InitInvData(gSMInvData[17], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0); // BIGPOCK4 + InitInvData(gSMInvData[18], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0); // BIGPOCK5 + InitInvData(gSMInvData[19], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0); // BIGPOCK6 + InitInvData(gSMInvData[20], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, 0, 0); // BIGPOCK7 + InitInvData(gSMInvData[21], FALSE, INV_BAR_DX, INV_BAR_DY, VEST_INV_SLOT_WIDTH, VEST_INV_SLOT_HEIGHT, 0, 0); // MEDPOCK1 + InitInvData(gSMInvData[22], FALSE, INV_BAR_DX, INV_BAR_DY, VEST_INV_SLOT_WIDTH, VEST_INV_SLOT_HEIGHT, 0, 0); // MEDPOCK2 + InitInvData(gSMInvData[23], FALSE, INV_BAR_DX, INV_BAR_DY, VEST_INV_SLOT_WIDTH, VEST_INV_SLOT_HEIGHT, 0, 0); // MEDPOCK3 + InitInvData(gSMInvData[24], FALSE, INV_BAR_DX, INV_BAR_DY, VEST_INV_SLOT_WIDTH, VEST_INV_SLOT_HEIGHT, 0, 0); // MEDPOCK4 + InitInvData(gSMInvData[25], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK1 + InitInvData(gSMInvData[26], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK2 + InitInvData(gSMInvData[27], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK3 + InitInvData(gSMInvData[28], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK4 + InitInvData(gSMInvData[29], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK5 + InitInvData(gSMInvData[30], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK6 + InitInvData(gSMInvData[31], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK7 + InitInvData(gSMInvData[32], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK8 + InitInvData(gSMInvData[33], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK9 + InitInvData(gSMInvData[34], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK10 + InitInvData(gSMInvData[35], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK11 + InitInvData(gSMInvData[36], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK12 + InitInvData(gSMInvData[37], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK13 + InitInvData(gSMInvData[38], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK14 + InitInvData(gSMInvData[39], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK15 + InitInvData(gSMInvData[40], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK16 + InitInvData(gSMInvData[41], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK17 + InitInvData(gSMInvData[42], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK18 + InitInvData(gSMInvData[43], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK19 + InitInvData(gSMInvData[44], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK20 + InitInvData(gSMInvData[45], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK21 + InitInvData(gSMInvData[46], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK22 + InitInvData(gSMInvData[47], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK23 + InitInvData(gSMInvData[48], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK24 + InitInvData(gSMInvData[49], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK25 + InitInvData(gSMInvData[50], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK26 + InitInvData(gSMInvData[51], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK27 + InitInvData(gSMInvData[52], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK28 + InitInvData(gSMInvData[53], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK29 + InitInvData(gSMInvData[54], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); // SMALLPOCK30 + } +} +void InitInventoryVehicle(INV_REGION_DESC *pRegionDesc, MOUSE_CALLBACK INVMoveCallback, MOUSE_CALLBACK INVClickCallback, BOOLEAN fSetHighestPrioity) +{ + for(int cnt=INV_START_POS; cntsX, pCamoRegion->sY, (INT16)(pCamoRegion->sX + CAMO_REGION_WIDTH ), (INT16)(pCamoRegion->sY + CAMO_REGION_HEIGHT ), MSYS_PRIORITY_HIGH, - MSYS_NO_CURSOR, INVMoveCammoCallback, INVClickCammoCallback ); + MSYS_NO_CURSOR, INVMoveCammoCallback, INVClickCammoCallback ); // Add region MSYS_AddRegion( &gSMInvCamoRegion ); @@ -931,12 +1136,12 @@ VObjectDesc.ImageFile); gSMInvData[ cnt ].sY = pRegionDesc[ cnt ].sY; MSYS_DefineRegion( &gSMInvRegion[ cnt ], gSMInvData[ cnt ].sX, gSMInvData[ cnt ].sY, (INT16)(gSMInvData[ cnt ].sX + gSMInvData[ cnt ].sWidth), (INT16)(gSMInvData[ cnt ].sY + gSMInvData[ cnt ].sHeight), ( INT8 )( fSetHighestPrioity ? MSYS_PRIORITY_HIGHEST : MSYS_PRIORITY_HIGH ), - MSYS_NO_CURSOR, INVMoveCallback, INVClickCallback ); + MSYS_NO_CURSOR, INVMoveCallback, INVClickCallback ); // Add region MSYS_AddRegion( &gSMInvRegion[ cnt ] ); MSYS_SetRegionUserData( &gSMInvRegion[ cnt ], 0, cnt ); } - + memset( gbCompatibleAmmo, 0, sizeof( gbCompatibleAmmo ) ); return( TRUE ); @@ -945,7 +1150,7 @@ VObjectDesc.ImageFile); void InitKeyRingInterface( MOUSE_CALLBACK KeyRingClickCallback ) { MSYS_DefineRegion( &gKeyRingPanel, KEYRING_X, KEYRING_Y, KEYRING_X + KEYRING_WIDTH, KEYRING_Y + KEYRING_HEIGHT, MSYS_PRIORITY_HIGH, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, KeyRingClickCallback ); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, KeyRingClickCallback ); SetRegionFastHelpText( &(gKeyRingPanel), TacticalStr[ KEYRING_HELP_TEXT ] ); @@ -954,7 +1159,7 @@ void InitKeyRingInterface( MOUSE_CALLBACK KeyRingClickCallback ) void InitMapKeyRingInterface( MOUSE_CALLBACK KeyRingClickCallback ) { MSYS_DefineRegion( &gKeyRingPanel, MAP_KEYRING_X, MAP_KEYRING_Y, MAP_KEYRING_X + KEYRING_WIDTH, MAP_KEYRING_Y + KEYRING_HEIGHT, MSYS_PRIORITY_HIGH, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, KeyRingClickCallback ); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, KeyRingClickCallback ); SetRegionFastHelpText( &(gKeyRingPanel), TacticalStr[ KEYRING_HELP_TEXT ] ); } @@ -998,17 +1203,19 @@ void DisableInvRegions( BOOLEAN fDisable ) { MSYS_DisableRegion( &gSMInvCamoRegion ); - MSYS_DisableRegion( &gSM_SELMERCMoneyRegion ); + MSYS_DisableRegion( &gSM_SELMERCMoneyRegion ); EnableKeyRing( FALSE ); + RenderBackpackButtons(3); /* CHRISL: Needed for new inventory backpack buttons */ } else { MSYS_EnableRegion( &gSMInvCamoRegion ); - MSYS_EnableRegion( &gSM_SELMERCMoneyRegion ); + MSYS_EnableRegion( &gSM_SELMERCMoneyRegion ); EnableKeyRing( TRUE ); + RenderBackpackButtons(2); /* CHRISL: Needed for new inventory backpack buttons */ } - + } void ShutdownInvSlotInterface( ) @@ -1052,7 +1259,7 @@ void RenderInvBodyPanel( SOLDIERTYPE *pSoldier, INT16 sX, INT16 sY ) // Kaiden: Vehicle Inventory change - Added IF Test, Else function call was // the original statement - if ( (gGameExternalOptions.fVehicleInventory) && (pSoldier->uiStatusFlags & SOLDIER_VEHICLE) ) + if ( (gGameExternalOptions.fVehicleInventory) && (pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiBodyInvVO[4][0], 0, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL ); } @@ -1065,21 +1272,20 @@ void RenderInvBodyPanel( SOLDIERTYPE *pSoldier, INT16 sX, INT16 sY ) void HandleRenderInvSlots( SOLDIERTYPE *pSoldier, UINT8 fDirtyLevel ) { - INT32 cnt; - static CHAR16 pStr[ 512 ]; - + INT32 sX, sY; + static CHAR16 pStr[ 512 ]; if ( InItemDescriptionBox( ) || InItemStackPopup( ) || InKeyRingPopup( ) ) { } else { - for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ ) + for ( UINT32 cnt = 0; cnt < pSoldier->inv.size(); cnt++ ) { if ( fDirtyLevel == DIRTYLEVEL2 ) { # if defined( _DEBUG ) /* Sergeant_Kolja, to be removed later again */ - if( pSoldier->inv[ cnt ].ItemData.Gun.ubGunAmmoType >= MAXITEMS ) + if( pSoldier->inv[ cnt ][0]->data.gun.ubGunAmmoType >= MAXITEMS ) { DebugMsg(TOPIC_JA2, DBG_LEVEL_1, String("pObject (%S) corrupted! GetHelpTextForItem() can crash.", (pSoldier->inv[ cnt ].usIteminv[ cnt ].usItem].szItemName : L"???" )); ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"pObject (%s) corrupted! GetHelpTextForItem() can crash.", (pSoldier->inv[ cnt ].usIteminv[ cnt ].usItem].szItemName : L"???" ); @@ -1099,30 +1305,69 @@ void HandleRenderInvSlots( SOLDIERTYPE *pSoldier, UINT8 fDirtyLevel ) if ( KeyExistsInKeyRing( pSoldier, ANYKEY, NULL ) ) { // blit gold key here? + // CHRISL: adjust settings to use variables for coords if ( guiCurrentItemDescriptionScreen != MAP_SCREEN ) { - BltVideoObjectFromIndex( guiSAVEBUFFER, guiGoldKeyVO, 0, 496, KEYRING_Y + 1, VO_BLT_SRCTRANSPARENCY, NULL ); - RestoreExternBackgroundRect( 496, KEYRING_Y + 1, 29, 23 ); + sX=((UsingNewInventorySystem() == false))?496:221; + sY=((UsingNewInventorySystem() == false))?INV_INTERFACE_START_Y+106:INV_INTERFACE_START_Y+5; } else { - BltVideoObjectFromIndex( guiSAVEBUFFER, guiGoldKeyVO, 0, 217, 271, VO_BLT_SRCTRANSPARENCY, NULL ); - RestoreExternBackgroundRect( 217, 271, 29, 23 ); + sX=((UsingNewInventorySystem() == false))?217:188; + sY=((UsingNewInventorySystem() == false))?271:126; } + BltVideoObjectFromIndex( guiSAVEBUFFER, guiGoldKeyVO, 0, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL ); + RestoreExternBackgroundRect( sX, sY, 29, 23 ); } } } +// CHRISL: New function to determine whether to activate Combat and Backpack slots +BOOLEAN CheckActivationStatus(SOLDIERTYPE *pSoldier, INT16 cSlot, INT16 bSlot, INT16 sPocket) +{ + INT8 cLevel, bLevel; + + cLevel = LoadBearingEquipment[Item[pSoldier->inv[cSlot].usItem].ubClassIndex].lbeCombo; + bLevel = LoadBearingEquipment[Item[pSoldier->inv[bSlot].usItem].ubClassIndex].lbeCombo; + + if(sPocket==cSlot) + { + if(pSoldier->inv[bSlot].exists() == true) + { + if(bLevel == NOTHING) + { + return(TRUE); + } + } + } + if(sPocket==bSlot) + { + if(pSoldier->inv[cSlot].exists() == true) + { + if(cLevel == NOTHING) + { + return(TRUE); + } + } + } + return(FALSE); +} void INVRenderINVPanelItem( SOLDIERTYPE *pSoldier, INT16 sPocket, UINT8 fDirtyLevel ) { - INT16 sX, sY; + // CHRISL: Only run if we're looking at a legitimate pocket + if((UsingNewInventorySystem() == false) && !oldInv[sPocket]) + return; + if((pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && UsingNewInventorySystem() == true && !vehicleInv[sPocket]) + return; + INT16 sX, sY, newX, newY; INT16 sBarX, sBarY; OBJECTTYPE *pObject; BOOLEAN fOutline = FALSE; - INT16 sOutlineColor = 0; + INT16 sOutlineColor = 0, lbePocket = ITEM_NOT_FOUND; UINT8 fRenderDirtyLevel; BOOLEAN fHatchItOut = FALSE; + UINT32 iClass; //Assign the screen @@ -1133,6 +1378,73 @@ void INVRenderINVPanelItem( SOLDIERTYPE *pSoldier, INT16 sPocket, UINT8 fDirtyLe sX = gSMInvData[ sPocket ].sX; sY = gSMInvData[ sPocket ].sY; + if((UsingNewInventorySystem() == true) && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE)) + { + // If sPocket is not an equiped pocket, gather pocket information + if(icClass[sPocket] != ITEM_NOT_FOUND) + { + switch (icClass[sPocket]) + { + case THIGH_PACK: + case VEST_PACK: + case COMBAT_PACK: + case BACKPACK: + lbePocket = (pSoldier->inv[icLBE[sPocket]].exists() == false) ? LoadBearingEquipment[Item[icDefault[sPocket]].ubClassIndex].lbePocketIndex[icPocket[sPocket]] : LoadBearingEquipment[Item[pSoldier->inv[icLBE[sPocket]].usItem].ubClassIndex].lbePocketIndex[icPocket[sPocket]]; + iClass = Item[pSoldier->inv[sPocket].usItem].usItemClass; + if(icLBE[sPocket] == BPACKPOCKPOS && !(pSoldier->flags.ZipperFlag) && (gTacticalStatus.uiFlags & INCOMBAT)) + lbePocket = 0; + if (lbePocket == 0) // Deactivate Pocket + { + fHatchItOut = TRUE; + } + else if ( pObject->exists() == false ) // Nothing in sPocket. Display silouhette. + { + INVRenderSilhouette( guiSAVEBUFFER, lbePocket, 0, sX, sY, gSMInvData[ sPocket ].sWidth, gSMInvData[ sPocket ].sHeight); + } + break; + case LBE_POCKET: + if ( pObject->exists() == false ) + { + if ( sPocket == VESTPOCKPOS ) + lbePocket = 0; + else if ( sPocket == LTHIGHPOCKPOS ) + lbePocket = 1; + else if ( sPocket == RTHIGHPOCKPOS ) + lbePocket = 2; + else if ( sPocket == CPACKPOCKPOS ) + lbePocket = 3; + else if ( sPocket == BPACKPOCKPOS ) + lbePocket = 4; + if ( lbePocket != ITEM_NOT_FOUND ) + INVRenderSilhouette( guiSAVEBUFFER, ITEM_NOT_FOUND, lbePocket, sX, sY, gSMInvData[ sPocket ].sWidth, gSMInvData[ sPocket ].sHeight); + } + // Removed backpack/gunsling restrictions + if ( CheckActivationStatus(pSoldier, CPACKPOCKPOS, BPACKPOCKPOS, sPocket)/* || + (sPocket == BPACKPOCKPOS && pSoldier->inv[GUNSLINGPOCKPOS].exists() == true)*/) + { + fHatchItOut = TRUE; + } + break; + case OTHER_POCKET: + if ( pObject->exists() == false ) + { + if ( sPocket == GUNSLINGPOCKPOS ) // Gun Sling + lbePocket = 1; + else + lbePocket = 2; + INVRenderSilhouette( guiSAVEBUFFER, lbePocket, 0, sX, sY, gSMInvData[ sPocket ].sWidth, gSMInvData[ sPocket ].sHeight); + } + break; + default: + if ( pObject->exists() == false ) + { + // Display appropriate silouhette + } + break; + } + } + } + if ( fDirtyLevel == DIRTYLEVEL2 ) { // CHECK FOR COMPATIBILITY WITH MAGAZINES @@ -1178,22 +1490,26 @@ void INVRenderINVPanelItem( SOLDIERTYPE *pSoldier, INT16 sPocket, UINT8 fDirtyLe // if (sPocket == SECONDHANDPOS && Item[pSoldier->inv[HANDPOS].usItem].fFlags & ITEM_TWO_HANDED) if (sPocket == SECONDHANDPOS && Item[pSoldier->inv[HANDPOS].usItem].twohanded ) { -// if( guiCurrentScreen != MAP_SCREEN ) + // CHRISL: Change coords for STI that covers 2nd hand location when carrying a 2handed weapon if( guiCurrentItemDescriptionScreen != MAP_SCREEN ) { - BltVideoObjectFromIndex( guiSAVEBUFFER, guiSecItemHiddenVO, 0, 217, sY, VO_BLT_SRCTRANSPARENCY, NULL ); - RestoreExternBackgroundRect( 217, sY, 72, 28 ); + newX = ((UsingNewInventorySystem() == false)) ? 217 : 114; + newY = ((UsingNewInventorySystem() == false)) ? sY : (sY - 1); + BltVideoObjectFromIndex( guiSAVEBUFFER, guiSecItemHiddenVO, UsingNewInventorySystem(), newX, newY, VO_BLT_SRCTRANSPARENCY, NULL ); + RestoreExternBackgroundRect( newX, newY, 72, 28 ); } else { - BltVideoObjectFromIndex( guiSAVEBUFFER, guiMapInvSecondHandBlockout, 0, 14, 218, VO_BLT_SRCTRANSPARENCY, NULL ); - RestoreExternBackgroundRect( 14, 218, 102, 24 ); + newX = ((UsingNewInventorySystem() == false)) ? 14 : 6; + newY = ((UsingNewInventorySystem() == false)) ? 218 : 217; + BltVideoObjectFromIndex( guiSAVEBUFFER, guiMapInvSecondHandBlockout, UsingNewInventorySystem(), newX, newY, VO_BLT_SRCTRANSPARENCY, NULL ); + RestoreExternBackgroundRect( newX, newY, 102, 24 ); } } } // If we have a new item and we are in the right panel... - if ( pSoldier->bNewItemCount[ sPocket ] > 0 && gsCurInterfacePanel == SM_PANEL && fInterfacePanelDirty != DIRTYLEVEL2 ) + if ( pSoldier->inv.bNewItemCount[ sPocket ] > 0 && gsCurInterfacePanel == SM_PANEL && fInterfacePanelDirty != DIRTYLEVEL2 ) { fRenderDirtyLevel = DIRTYLEVEL0; //fRenderDirtyLevel = fDirtyLevel; @@ -1207,6 +1523,40 @@ void INVRenderINVPanelItem( SOLDIERTYPE *pSoldier, INT16 sPocket, UINT8 fDirtyLe //INVRenderItem( guiSAVEBUFFER, pObject, (INT16)(sX + gSMInvData[ sPocket ].sSubX), (INT16)(sY + gSMInvData[ sPocket ].sSubY), gSMInvData[ sPocket ].sWidth, gSMInvData[ sPocket ].sHeight, fDirtyLevel, &(gfSM_HandInvDispText[ sPocket ] ) ); INVRenderItem( guiSAVEBUFFER, pSoldier, pObject, sX, sY, gSMInvData[ sPocket ].sWidth, gSMInvData[ sPocket ].sHeight, fRenderDirtyLevel, NULL, 0, fOutline, sOutlineColor ); + // CHRISL: Display pocket capacity if we're holding something in the cursor + if (!gfSMDisableForItems && (UsingNewInventorySystem() == true) && gpItemPointer != NULL) + { + int itemSlotLimit = ItemSlotLimit(gpItemPointer, sPocket, pSoldier); + RenderPocketItemCapacity( itemSlotLimit, sPocket, pSoldier); + if(itemSlotLimit == 0 && !CanItemFitInPosition(pSoldier, gpItemPointer, (INT8)sPocket, FALSE)) { + fHatchItOut = TRUE; + } + } + + // CHRISL: Change whether we hatch a pocket to be dependant on the current item + if(gpItemPointer != NULL) + { + if(!gfSMDisableForItems && !CanItemFitInPosition(pSoldier, gpItemPointer, (INT8)sPocket, FALSE)){ + if(!ValidAttachment(gpItemPointer->usItem, pObject->usItem)){ + fHatchItOut = TRUE; + } + else{ + fHatchItOut = FALSE; + } + } + } + else if(pObject->exists() == true) + { + if(!gfSMDisableForItems && !CanItemFitInPosition(pSoldier, pObject, (INT8)sPocket, FALSE)) + fHatchItOut = TRUE; + } + // CHRISL: Don't hatch second hand position if we're holding a two handed item + if(sPocket == SECONDHANDPOS) + { + if(Item[pSoldier->inv[HANDPOS].usItem].twohanded) + fHatchItOut = FALSE; + } +#if 0 if ( gbInvalidPlacementSlot[ sPocket ] ) { if ( sPocket != SECONDHANDPOS ) @@ -1218,6 +1568,7 @@ void INVRenderINVPanelItem( SOLDIERTYPE *pSoldier, INT16 sPocket, UINT8 fDirtyLe } } } +#endif //if we are in the shop keeper interface if( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) @@ -1235,7 +1586,7 @@ void INVRenderINVPanelItem( SOLDIERTYPE *pSoldier, INT16 sPocket, UINT8 fDirtyLe } // if there's an item in there - if ( pObject->usItem != NOTHING ) + if ( pObject->exists() == true ) { // Add item status bar sBarX = sX - gSMInvData[ sPocket ].sBarDx; @@ -1299,15 +1650,15 @@ BOOLEAN CompatibleItemForApplyingOnMerc( OBJECTTYPE *pTestObject ) BOOLEAN SoldierContainsAnyCompatibleStuff( SOLDIERTYPE *pSoldier, OBJECTTYPE *pTestObject ) { - INT32 cnt; + UINT32 cnt; OBJECTTYPE *pObject; if( ( Item [ pTestObject->usItem ].usItemClass & IC_GUN ) ) { - for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ ) + for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ ) { pObject = &(pSoldier->inv[ cnt ]); - + if ( CompatibleAmmoForGun( pObject, pTestObject ) ) { return( TRUE ); @@ -1317,10 +1668,10 @@ BOOLEAN SoldierContainsAnyCompatibleStuff( SOLDIERTYPE *pSoldier, OBJECTTYPE *pT if( ( Item [ pTestObject->usItem ].usItemClass & IC_AMMO ) ) { - for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ ) + for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ ) { pObject = &(pSoldier->inv[ cnt ]); - + if ( CompatibleGunForAmmo( pObject, pTestObject ) ) { return( TRUE ); @@ -1337,7 +1688,7 @@ BOOLEAN SoldierContainsAnyCompatibleStuff( SOLDIERTYPE *pSoldier, OBJECTTYPE *pT void HandleAnyMercInSquadHasCompatibleStuff( UINT8 ubSquad, OBJECTTYPE *pObject, BOOLEAN fReset ) { INT32 iCounter = 0; - + if ( ubSquad == NUMBER_OF_SQUADS ) { return; @@ -1367,13 +1718,13 @@ void HandleAnyMercInSquadHasCompatibleStuff( UINT8 ubSquad, OBJECTTYPE *pObject, BOOLEAN HandleCompatibleAmmoUIForMapScreen( SOLDIERTYPE *pSoldier, INT32 bInvPos, BOOLEAN fOn, BOOLEAN fFromMerc ) { BOOLEAN fFound = FALSE; - INT32 cnt; + UINT32 cnt; OBJECTTYPE *pObject, *pTestObject ; BOOLEAN fFoundAttachment = FALSE; if( fFromMerc == FALSE ) { - pTestObject = &( pInventoryPoolList[ bInvPos ].o ); + pTestObject = &( pInventoryPoolList[ bInvPos ].object ); } else { @@ -1390,10 +1741,10 @@ BOOLEAN HandleCompatibleAmmoUIForMapScreen( SOLDIERTYPE *pSoldier, INT32 bInvPos // ATE: If pTest object is NULL, test only for existence of syringes, etc... if ( pTestObject == NULL ) { - for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ ) + for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ ) { pObject = &(pSoldier->inv[ cnt ]); - + if ( CompatibleItemForApplyingOnMerc( pObject ) ) { if ( fOn != gbCompatibleAmmo[ cnt ] ) @@ -1440,7 +1791,7 @@ BOOLEAN HandleCompatibleAmmoUIForMapScreen( SOLDIERTYPE *pSoldier, INT32 bInvPos if ( !(Item[ pTestObject->usItem ].hiddenaddon ) ) { // First test attachments, which almost any type of item can have.... - for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ ) + for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ ) { pObject = &(pSoldier->inv[ cnt ]); @@ -1452,8 +1803,8 @@ BOOLEAN HandleCompatibleAmmoUIForMapScreen( SOLDIERTYPE *pSoldier, INT32 bInvPos } if ( ValidAttachment( pObject->usItem, pTestObject->usItem ) || - ValidAttachment( pTestObject->usItem, pObject->usItem ) || - ValidLaunchable( pTestObject->usItem, pObject->usItem ) || + ValidAttachment( pTestObject->usItem, pObject->usItem ) || + ValidLaunchable( pTestObject->usItem, pObject->usItem ) || ValidLaunchable( pObject->usItem, pTestObject->usItem ) ) { fFoundAttachment = TRUE; @@ -1470,13 +1821,13 @@ BOOLEAN HandleCompatibleAmmoUIForMapScreen( SOLDIERTYPE *pSoldier, INT32 bInvPos } } - + if ( ( Item [ pTestObject->usItem ].usItemClass & IC_GUN ) ) { - for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ ) + for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ ) { pObject = &(pSoldier->inv[ cnt ]); - + if ( CompatibleAmmoForGun( pObject, pTestObject ) ) { if ( fOn != gbCompatibleAmmo[ cnt ] ) @@ -1492,10 +1843,10 @@ BOOLEAN HandleCompatibleAmmoUIForMapScreen( SOLDIERTYPE *pSoldier, INT32 bInvPos } else if( ( Item [ pTestObject->usItem ].usItemClass & IC_AMMO ) ) { - for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ ) + for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ ) { pObject = &(pSoldier->inv[ cnt ]); - + if ( CompatibleGunForAmmo( pObject, pTestObject ) ) { if ( fOn != gbCompatibleAmmo[ cnt ] ) @@ -1526,7 +1877,7 @@ BOOLEAN HandleCompatibleAmmoUIForMapInventory( SOLDIERTYPE *pSoldier, INT32 bInv if( fFromMerc == FALSE ) { - pTestObject = &( pInventoryPoolList[ iStartSlotNumber + bInvPos ].o); + pTestObject = &( pInventoryPoolList[ iStartSlotNumber + bInvPos ].object); } else { @@ -1543,7 +1894,7 @@ BOOLEAN HandleCompatibleAmmoUIForMapInventory( SOLDIERTYPE *pSoldier, INT32 bInv // First test attachments, which almost any type of item can have.... for ( cnt = 0; cnt < MAP_INVENTORY_POOL_SLOT_COUNT; cnt++ ) { - pObject = &( pInventoryPoolList[ iStartSlotNumber + cnt ].o ); + pObject = &( pInventoryPoolList[ iStartSlotNumber + cnt ].object ); // if ( Item[ pObject->usItem ].fFlags & ITEM_HIDDEN_ADDON ) if ( Item[ pObject->usItem ].hiddenaddon ) @@ -1553,8 +1904,8 @@ BOOLEAN HandleCompatibleAmmoUIForMapInventory( SOLDIERTYPE *pSoldier, INT32 bInv } if ( ValidAttachment( pObject->usItem, pTestObject->usItem ) || - ValidAttachment( pTestObject->usItem, pObject->usItem ) || - ValidLaunchable( pTestObject->usItem, pObject->usItem ) || + ValidAttachment( pTestObject->usItem, pObject->usItem ) || + ValidLaunchable( pTestObject->usItem, pObject->usItem ) || ValidLaunchable( pObject->usItem, pTestObject->usItem ) ) { fFoundAttachment = TRUE; @@ -1570,12 +1921,12 @@ BOOLEAN HandleCompatibleAmmoUIForMapInventory( SOLDIERTYPE *pSoldier, INT32 bInv } } - + if( ( Item [ pTestObject->usItem ].usItemClass & IC_GUN ) ) { for ( cnt = 0; cnt < MAP_INVENTORY_POOL_SLOT_COUNT; cnt++ ) { - pObject = &( pInventoryPoolList[ iStartSlotNumber + cnt ].o ); + pObject = &( pInventoryPoolList[ iStartSlotNumber + cnt ].object ); if ( CompatibleAmmoForGun( pObject, pTestObject ) ) { @@ -1594,8 +1945,8 @@ BOOLEAN HandleCompatibleAmmoUIForMapInventory( SOLDIERTYPE *pSoldier, INT32 bInv { for ( cnt = 0; cnt < MAP_INVENTORY_POOL_SLOT_COUNT; cnt++ ) { - pObject = &( pInventoryPoolList[ iStartSlotNumber + cnt ].o ); - + pObject = &( pInventoryPoolList[ iStartSlotNumber + cnt ].object ); + if ( CompatibleGunForAmmo( pObject, pTestObject ) ) { if ( fOn != fMapInventoryItemCompatable[ cnt ] ) @@ -1619,17 +1970,17 @@ BOOLEAN HandleCompatibleAmmoUIForMapInventory( SOLDIERTYPE *pSoldier, INT32 bInv BOOLEAN InternalHandleCompatibleAmmoUI( SOLDIERTYPE *pSoldier, OBJECTTYPE *pTestObject, BOOLEAN fOn ) { BOOLEAN fFound = FALSE; - INT32 cnt; + UINT32 cnt; OBJECTTYPE *pObject; BOOLEAN fFoundAttachment = FALSE; // ATE: If pTest object is NULL, test only for existence of syringes, etc... if ( pTestObject == NULL ) { - for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ ) + for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ ) { pObject = &(pSoldier->inv[ cnt ]); - + if ( CompatibleItemForApplyingOnMerc( pObject ) ) { if ( fOn != gbCompatibleAmmo[ cnt ] ) @@ -1673,7 +2024,7 @@ BOOLEAN InternalHandleCompatibleAmmoUI( SOLDIERTYPE *pSoldier, OBJECTTYPE *pTest } // First test attachments, which almost any type of item can have.... - for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ ) + for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ ) { pObject = &(pSoldier->inv[ cnt ]); @@ -1685,8 +2036,8 @@ BOOLEAN InternalHandleCompatibleAmmoUI( SOLDIERTYPE *pSoldier, OBJECTTYPE *pTest } if ( ValidAttachment( pObject->usItem, pTestObject->usItem ) || - ValidAttachment( pTestObject->usItem, pObject->usItem ) || - ValidLaunchable( pTestObject->usItem, pObject->usItem ) || + ValidAttachment( pTestObject->usItem, pObject->usItem ) || + ValidLaunchable( pTestObject->usItem, pObject->usItem ) || ValidLaunchable( pObject->usItem, pTestObject->usItem ) ) { fFoundAttachment = TRUE; @@ -1706,10 +2057,10 @@ BOOLEAN InternalHandleCompatibleAmmoUI( SOLDIERTYPE *pSoldier, OBJECTTYPE *pTest //{ if( ( Item [ pTestObject->usItem ].usItemClass & IC_GUN ) ) { - for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ ) + for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ ) { pObject = &(pSoldier->inv[ cnt ]); - + if ( CompatibleAmmoForGun( pObject, pTestObject ) ) { if ( fOn != gbCompatibleAmmo[ cnt ] ) @@ -1726,10 +2077,10 @@ BOOLEAN InternalHandleCompatibleAmmoUI( SOLDIERTYPE *pSoldier, OBJECTTYPE *pTest else if( ( Item [ pTestObject->usItem ].usItemClass & IC_AMMO ) ) { - for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ ) + for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ ) { pObject = &(pSoldier->inv[ cnt ]); - + if ( CompatibleGunForAmmo( pObject, pTestObject ) ) { if ( fOn != gbCompatibleAmmo[ cnt ] ) @@ -1864,7 +2215,7 @@ BOOLEAN HandleCompatibleAmmoUI( SOLDIERTYPE *pSoldier, INT8 bInvPos, BOOLEAN fOn { pTestObject = &(pSoldier->inv[ bInvPos ]); } - + } return( InternalHandleCompatibleAmmoUI( pSoldier, pTestObject, fOn ) ); @@ -1885,41 +2236,40 @@ void GetSlotInvHeightWidth( UINT8 ubPos, INT16 *psWidth, INT16 *psHeight ) void HandleNewlyAddedItems( SOLDIERTYPE *pSoldier, BOOLEAN *fDirtyLevel ) { - UINT32 cnt; - INT16 sX, sY; - OBJECTTYPE *pObject; - - // If item description up.... stop if ( gfInItemDescBox ) { return; } - for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ ) + UINT32 cnt; + INT16 sX, sY; + OBJECTTYPE *pObject; + + for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ ) { - if ( pSoldier->bNewItemCount[ cnt ] == -2 ) + if ( pSoldier->inv.bNewItemCount[ cnt ] == -2 ) { // Stop *fDirtyLevel = DIRTYLEVEL2; - pSoldier->bNewItemCount[ cnt ] = 0; + pSoldier->inv.bNewItemCount[ cnt ] = 0; } - if ( pSoldier->bNewItemCount[ cnt ] > 0 ) + if ( pSoldier->inv.bNewItemCount[ cnt ] > 0 ) { sX = gSMInvData[ cnt ].sX; sY = gSMInvData[ cnt ].sY; pObject = &(pSoldier->inv[ cnt ]); - - if ( pObject->usItem == NOTHING ) + + if ( pObject->exists() == false ) { gbNewItem[ cnt ] = 0; continue; } - INVRenderItem( guiSAVEBUFFER, pSoldier, pObject, sX, sY, gSMInvData[ cnt ].sWidth, gSMInvData[ cnt ].sHeight, DIRTYLEVEL2, NULL, 0, TRUE, us16BPPItemCyclePlacedItemColors[ pSoldier->bNewItemCycleCount[ cnt ] ] ); + INVRenderItem( guiSAVEBUFFER, pSoldier, pObject, sX, sY, gSMInvData[ cnt ].sWidth, gSMInvData[ cnt ].sHeight, DIRTYLEVEL2, NULL, 0, TRUE, us16BPPItemCyclePlacedItemColors[ pSoldier->inv.bNewItemCycleCount[ cnt ] ] ); } @@ -1928,14 +2278,12 @@ void HandleNewlyAddedItems( SOLDIERTYPE *pSoldier, BOOLEAN *fDirtyLevel ) void CheckForAnyNewlyAddedItems( SOLDIERTYPE *pSoldier ) { - UINT32 cnt; - // OK, l0ok for any new... - for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ ) + for ( UINT32 cnt = 0; cnt < pSoldier->inv.size(); cnt++ ) { - if ( pSoldier->bNewItemCount[ cnt ] == -1 ) + if ( pSoldier->inv.bNewItemCount[ cnt ] == -1 ) { - pSoldier->bNewItemCount[ cnt ] = NEW_ITEM_CYCLES - 1; + pSoldier->inv.bNewItemCount[ cnt ] = NEW_ITEM_CYCLES - 1; } } @@ -1961,27 +2309,27 @@ void DegradeNewlyAddedItems( ) { pSoldier = MercPtrs[ gTeamPanel[ cnt2 ].ubID ]; - for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ ) + for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ ) { - if ( pSoldier->bNewItemCount[ cnt ] > 0 ) + if ( pSoldier->inv.bNewItemCount[ cnt ] > 0 ) { // Decrement all the time! - pSoldier->bNewItemCycleCount[ cnt ]--; + pSoldier->inv.bNewItemCycleCount[ cnt ]--; - if ( pSoldier->bNewItemCycleCount[ cnt ] == 0 ) + if ( pSoldier->inv.bNewItemCycleCount[ cnt ] == 0 ) { // OK, cycle down.... - pSoldier->bNewItemCount[ cnt ]--; + pSoldier->inv.bNewItemCount[ cnt ]--; - if ( pSoldier->bNewItemCount[ cnt ] == 0 ) + if ( pSoldier->inv.bNewItemCount[ cnt ] == 0 ) { // Stop... - pSoldier->bNewItemCount[ cnt ] = -2; + pSoldier->inv.bNewItemCount[ cnt ] = -2; } else { // Reset! - pSoldier->bNewItemCycleCount[ cnt ] = NEW_ITEM_CYCLE_COUNT; + pSoldier->inv.bNewItemCycleCount[ cnt ] = NEW_ITEM_CYCLE_COUNT; continue; } } @@ -2004,22 +2352,119 @@ void InitItemInterface( ) } +// CHRISL: Function to display pocket inventory quantity based on object in cursor +void RenderPocketItemCapacity( UINT8 pCapacity, INT16 bPos, SOLDIERTYPE *pSoldier ) +{ + INT16 sX, sY; + static CHAR16 pStr[ 100 ]; -void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObject, INT16 sX, INT16 sY, INT16 sWidth, INT16 sHeight, UINT8 fDirtyLevel, UINT8 *pubHighlightCounter, UINT8 ubStatusIndex, BOOLEAN fOutline, INT16 sOutlineColor ) + // Can pocket hold the item in the cursor? + if(InItemDescriptionBox( )) + return; + if(!CanItemFitInPosition( pSoldier, gpItemPointer, (INT8)bPos, FALSE )) + { + // Further check to see if the cursor item is valid ammo or a valid attachment + if(!CompatibleAmmoForGun(gpItemPointer, &pSoldier->inv[bPos]) && !ValidAttachment(gpItemPointer->usItem, pSoldier->inv[bPos].usItem)) + { + return; + } + } + + // Setup display parameters + SetFont( ITEM_FONT ); + SetFontBackground( FONT_MCOLOR_BLACK ); + SetFontForeground( FONT_RED ); + if(CompatibleAmmoForGun(gpItemPointer, &pSoldier->inv[bPos]) || ValidLaunchable(gpItemPointer->usItem, pSoldier->inv[bPos].usItem)) + { + SetFontForeground( FONT_YELLOW ); + swprintf( pStr, L"L" ); + } + else if(pCapacity != 0 && CanItemFitInPosition(pSoldier, gpItemPointer, (INT8)bPos, FALSE)) + { + // Adjust capacity to account for current items + if(gpItemPointer->usItem == pSoldier->inv[bPos].usItem) + { + SetFontForeground( FONT_GREEN ); + pCapacity = pCapacity - pSoldier->inv[bPos].ubNumberOfObjects; + if(pCapacity > 0) + swprintf( pStr, L"+%d", pCapacity ); + else + swprintf( pStr, L"-" ); + } + else + swprintf( pStr, L"%d", pCapacity ); + } + else if(ValidAttachment(gpItemPointer->usItem, pSoldier->inv[bPos].usItem)) + { + SetFontForeground( FONT_YELLOW ); + swprintf( pStr, L"A" ); + } + sX = gSMInvData[ bPos ].sX + 1; + sY = gSMInvData[ bPos ].sY; + UINT32 uiWhichBuffer = ( guiCurrentItemDescriptionScreen == MAP_SCREEN ) ? guiSAVEBUFFER : guiRENDERBUFFER; + + // Display pocket capacity + if ( uiWhichBuffer == guiSAVEBUFFER ) + { + RestoreExternBackgroundRect( sX, sY, 15, 15 ); + } + mprintf( sX, sY, pStr ); + gprintfinvalidate( sX, sY, pStr ); + return; +} +// CHRISL: New function to render silhouettes +void INVRenderSilhouette( UINT32 uiBuffer, INT16 PocketIndex, INT16 SilIndex, INT16 sX, INT16 sY, INT16 sWidth, INT16 sHeight) +{ + ETRLEObject *pTrav; + HVOBJECT hVObject; + UINT32 usHeight, usWidth; + INT16 sCenX, sCenY; + + if(gfSMDisableForItems) + return; + SetFont( ITEM_FONT ); + GetVideoObject( &hVObject, guiSILHOUETTE ); + if ( PocketIndex != ITEM_NOT_FOUND ) + SilIndex = LBEPocketType[PocketIndex].pSilhouette; + + pTrav = &(hVObject->pETRLEObject[ SilIndex ] ); + + usHeight = (UINT32)pTrav->usHeight; + usWidth = (UINT32)pTrav->usWidth; + + // CENTER IN SLOT! + // CANCEL OFFSETS! + sCenX = sX + (INT16)( abs( sWidth - (double)usWidth ) / 2 ) - pTrav->sOffsetX; + sCenY = sY + (INT16)( abs( sHeight - (double)usHeight ) / 2 ) - pTrav->sOffsetY; + + BltVideoObjectOutlineFromIndex( uiBuffer, guiSILHOUETTE, SilIndex, sCenX, sCenY, 0 /*sOutlineColor*/, FALSE ); + + if ( uiBuffer == FRAME_BUFFER ) + { + InvalidateRegion( sX, sY, (INT16)(sX + sWidth), (INT16)(sY + sHeight ) ); + } + else + { + RestoreExternBackgroundRect( sX, sY, sWidth, sHeight ); + } +} + + +void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObject, INT16 sX, INT16 sY, INT16 sWidth, INT16 sHeight, UINT8 fDirtyLevel, UINT8 *pubHighlightCounter, UINT8 ubStatusIndex, BOOLEAN fOutline, INT16 sOutlineColor, UINT8 iter ) { UINT16 uiStringLength; INVTYPE *pItem; - ETRLEObject *pTrav; + ETRLEObject *pTrav; UINT32 usHeight, usWidth; INT16 sCenX, sCenY, sNewY, sNewX; HVOBJECT hVObject; BOOLEAN fLineSplit = FALSE; - INT16 sFontX2, sFontY2; - INT16 sFontX, sFontY; + INT16 sFontX2 = 0, sFontY2 = 0; + INT16 sFontX = 0, sFontY = 0; static CHAR16 pStr[ 100 ], pStr2[ 100 ]; - if ( pObject->usItem == NOTHING ) + if ( pObject->exists() == false ) { return; } @@ -2030,7 +2475,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec } else { - pItem = &Item[ pObject->usAttachItem[ ubStatusIndex - RENDER_ITEM_ATTACHMENT1 ] ]; + pItem = &Item[ (*pObject)[iter]->GetAttachmentAtIndex( ubStatusIndex - RENDER_ITEM_ATTACHMENT1 )->usItem ]; } if ( fDirtyLevel == DIRTYLEVEL2 ) @@ -2075,15 +2520,41 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( FONT_MCOLOR_DKGRAY ); +#if 1 + //CHRISL: Moved this condition to the start so that stacked guns will show number in stack + if ( ubStatusIndex != RENDER_ITEM_NOSTATUS ) + { + // Now display # of items + if ( pObject->ubNumberOfObjects > 1 ) + { + SetFontForeground( FONT_GRAY4 ); + sNewY = sY + sHeight - 10; + swprintf( pStr, L"%d", pObject->ubNumberOfObjects ); + + // Get length of string + uiStringLength=StringPixLength(pStr, ITEM_FONT ); + + sNewX = sX + sWidth - uiStringLength - 4; + + if ( uiBuffer == guiSAVEBUFFER ) + { + RestoreExternBackgroundRect( sNewX, sNewY, 15, 15 ); + } + mprintf( sNewX, sNewY, pStr ); + gprintfinvalidate( sNewX, sNewY, pStr ); + } + + } +#endif // FIRST DISPLAY FREE ROUNDS REMIANING if ( pItem->usItemClass == IC_GUN && !Item[pObject->usItem].rocketlauncher ) { sNewY = sY + sHeight - 10; sNewX = sX + 1; - SetFontForeground ( AmmoTypes[pObject->ItemData.Gun.ubGunAmmoType].fontColour ); - //switch (pObject->ubGunAmmoType) + SetFontForeground ( AmmoTypes[(*pObject)[iter]->data.gun.ubGunAmmoType].fontColour ); + //switch ((*pObject)[iter]->data.gun.ubGunAmmoType) //{ // case AMMO_AP: // case AMMO_SUPER_AP: @@ -2107,8 +2578,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec // break; //} - - swprintf( pStr, L"%d", pObject->ItemData.Gun.ubGunShotsLeft ); + swprintf( pStr, L"%d", (*pObject)[iter]->data.gun.ubGunShotsLeft ); if ( uiBuffer == guiSAVEBUFFER ) { RestoreExternBackgroundRect( sNewX, sNewY, 20, 15 ); @@ -2119,7 +2589,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec SetFontForeground( FONT_MCOLOR_DKGRAY ); // Display 'JAMMED' if we are jammed - if ( pObject->ItemData.Gun.bGunAmmoStatus < 0 ) + if ( (*pObject)[iter]->data.gun.bGunAmmoStatus < 0 ) { SetFontForeground( FONT_MCOLOR_RED ); @@ -2138,6 +2608,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec gprintfinvalidate( sNewX, sNewY, pStr ); } } +#if 0 else { if ( ubStatusIndex != RENDER_ITEM_NOSTATUS ) @@ -2165,8 +2636,8 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec } } - - if ( ItemHasAttachments( pObject ) ) +#endif + if ( ItemHasAttachments( pObject, pSoldier, iter ) ) { if ( !IsGrenadeLauncherAttached( pObject ) ) { @@ -2194,7 +2665,32 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec } - if ( pSoldier && pObject == &(pSoldier->inv[HANDPOS] ) && pSoldier->bWeaponMode != WM_NORMAL ) + if((UsingNewInventorySystem() == true)) + { + // CHRISL: Display astrisk when LBENODE active + if ( pObject->HasAnyActiveLBEs(pSoldier, iter) ) + { + SetFontForeground( FONT_BLUE ); + + sNewY = sY; + swprintf( pStr, L"*" ); + + // Get length of string + uiStringLength=StringPixLength(pStr, ITEM_FONT ); + + sNewX = sX + sWidth - uiStringLength - 4; + + if ( uiBuffer == guiSAVEBUFFER ) + { + RestoreExternBackgroundRect( sNewX, sNewY, 15, 15 ); + } + mprintf( sNewX, sNewY, pStr ); + gprintfinvalidate( sNewX, sNewY, pStr ); + + } + } + + if ( pSoldier && pObject == &(pSoldier->inv[HANDPOS] ) && pSoldier->bWeaponMode != WM_NORMAL && Item[pSoldier->inv[HANDPOS].usItem].usItemClass == IC_GUN ) { sNewY = sY + 13; // rather arbitrary if ( pSoldier->bWeaponMode == WM_BURST ) @@ -2236,9 +2732,6 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec gprintfinvalidate( sNewX, sNewY, pStr ); } - - - } } @@ -2257,7 +2750,10 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec } else { - swprintf( pStr, L"%s", ShortItemNames[ pObject->usAttachItem[ ubStatusIndex - RENDER_ITEM_ATTACHMENT1 ] ] ); + OBJECTTYPE* pAttachment = (*pObject)[iter]->GetAttachmentAtIndex(ubStatusIndex - RENDER_ITEM_ATTACHMENT1); + if (pAttachment) { + swprintf( pStr, L"%s", ShortItemNames[ pAttachment->usItem ] ); + } } fLineSplit = WrapString( pStr, pStr2, WORD_WRAP_INV_WIDTH, ITEM_FONT ); @@ -2266,10 +2762,6 @@ 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 ); @@ -2277,24 +2769,25 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec gprintfinvalidate( sFontX2, sFontY2, pStr2 ); } - if ( *pubHighlightCounter == 2 ) - { - mprintf( sFontX, sFontY, pStr ); + } - if ( fLineSplit ) - { - mprintf( sFontX2, sFontY2, pStr2 ); - } + if ( *pubHighlightCounter == 2 ) + { + mprintf( sFontX, sFontY, pStr ); + + if ( fLineSplit ) + { + mprintf( sFontX2, sFontY2, pStr2 ); } - else if ( *pubHighlightCounter == 1 ) - { - *pubHighlightCounter = 0; - gprintfRestore( sFontX, sFontY, pStr ); + } + else if ( *pubHighlightCounter == 1 ) + { + *pubHighlightCounter = 0; + gprintfRestore( sFontX, sFontY, pStr ); - if ( fLineSplit ) - { - gprintfRestore( sFontX2, sFontY2, pStr2 ); - } + if ( fLineSplit ) + { + gprintfRestore( sFontX2, sFontY2, pStr2 ); } } } @@ -2306,7 +2799,7 @@ BOOLEAN InItemDescriptionBox( ) return( gfInItemDescBox ); } -void CycleItemDescriptionItem( ) +void CycleItemDescriptionItem( INT16 sX, INT16 sY ) { INT16 usOldItem; @@ -2347,7 +2840,7 @@ void CycleItemDescriptionItem( ) CreateItem( (UINT16)usOldItem, 100, &( gpItemDescSoldier->inv[ HANDPOS ] ) ); - InternalInitItemDescriptionBox( &( gpItemDescSoldier->inv[ HANDPOS ] ), 214, (INT16)(INV_INTERFACE_START_Y + 1 ), gubItemDescStatusIndex, gpItemDescSoldier ); + InternalInitItemDescriptionBox( &( gpItemDescSoldier->inv[ HANDPOS ] ), sX, sY, gubItemDescStatusIndex, gpItemDescSoldier ); } BOOLEAN InitItemDescriptionBox( SOLDIERTYPE *pSoldier, UINT8 ubPosition, INT16 sX, INT16 sY, UINT8 ubStatusIndex ) @@ -2355,7 +2848,7 @@ BOOLEAN InitItemDescriptionBox( SOLDIERTYPE *pSoldier, UINT8 ubPosition, INT16 s OBJECTTYPE *pObject; //DEF: - //if we are in the shopkeeper screen, and we are to use the + //if we are in the shopkeeper screen, and we are to use the if( guiCurrentScreen == SHOPKEEPER_SCREEN && ubPosition == 255 ) { pObject = pShopKeeperItemDescObject; @@ -2367,7 +2860,7 @@ BOOLEAN InitItemDescriptionBox( SOLDIERTYPE *pSoldier, UINT8 ubPosition, INT16 s pObject = &(pSoldier->inv[ ubPosition ] ); } - return( InternalInitItemDescriptionBox( pObject, sX, sY, ubStatusIndex, pSoldier ) ); + return( InternalInitItemDescriptionBox( pObject, sX, sY, ubStatusIndex, pSoldier, ubPosition ) ); } BOOLEAN InitKeyItemDescriptionBox( SOLDIERTYPE *pSoldier, UINT8 ubPosition, INT16 sX, INT16 sY, UINT8 ubStatusIndex ) @@ -2380,8 +2873,8 @@ BOOLEAN InitKeyItemDescriptionBox( SOLDIERTYPE *pSoldier, UINT8 ubPosition, INT1 return( InternalInitItemDescriptionBox( pObject, sX, sY, ubStatusIndex, pSoldier ) ); } -BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, UINT8 ubStatusIndex, SOLDIERTYPE *pSoldier ) -{ +BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, UINT8 ubStatusIndex, SOLDIERTYPE *pSoldier, UINT8 ubPosition ) +{ VOBJECT_DESC VObjectDesc; CHAR8 ubString[48]; INT32 cnt; @@ -2390,8 +2883,29 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, INT16 sForeColour; INT16 sProsConsIndent; + // CHRISL: Set some initial coords + ITEMDESC_START_X = ((UsingNewInventorySystem() == true && iResolution != 0)) ? 259 : 214; //115:214 + ITEMDESC_START_Y = ((UsingNewInventorySystem() == true && iResolution != 0)) ? (1 + INV_INTERFACE_START_Y) : (1 + INV_INTERFACE_START_Y); + ITEMDESC_HEIGHT = ((UsingNewInventorySystem() == true && iResolution != 0)) ? 195 : 133; //195:133 + ITEMDESC_WIDTH = 320; + if(UsingNewInventorySystem() == true) + { + if(iResolution == 0) + ITEMDESC_WIDTH = 526; + else if(iResolution == 1) + ITEMDESC_WIDTH = 686; + else if(iResolution == 2) + ITEMDESC_WIDTH = 910; + } + //ITEMDESC_WIDTH = ((UsingNewInventorySystem() == true && iResolution != 0)) ? 320 : 320; //678:320 + MAP_ITEMDESC_HEIGHT = ((UsingNewInventorySystem() == true && iResolution != 0)) ? 490 : 268; + MAP_ITEMDESC_WIDTH = ((UsingNewInventorySystem() == true && iResolution != 0)) ? 272 : 272; + + //CHRISL: We only want this condition to be true when looking at MONEY. Not IC_MONEY since we can't actually split + // things like gold nuggets or wallets. // ADB: Make sure the current object isn't money if there's something in hand - if (Item[ pObject->usItem].usItemClass & IC_MONEY && gpItemPointer != NULL && gpItemPointer->usItem != 0) { + //if (Item[ pObject->usItem].usItemClass & IC_MONEY && gpItemPointer != NULL && gpItemPointer->usItem != 0) { + if(pObject->usItem == MONEY && gpItemPointer != NULL && gpItemPointer->usItem != 0 && gpItemPointer->usItem != MONEY) { //ADB oops, money splits and puts a new item on the cursor, which would replace what's already on the cursor! // ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Unable to split money due to having an item on your cursor." ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_UNABLETOSPLITMONEY] ); @@ -2403,8 +2917,16 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, guiCurrentItemDescriptionScreen = guiCurrentScreen; // Set X, Y - gsInvDescX = sX; - gsInvDescY = sY; + if(sX == 0 && sY == 0) + { + gsInvDescX = ITEMDESC_START_X; //sX; + gsInvDescY = ITEMDESC_START_Y; //sY; + } + else + { + gsInvDescX = sX; + gsInvDescY = sY; + } gpItemDescObject = pObject; gubItemDescStatusIndex = ubStatusIndex; @@ -2414,47 +2936,52 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, // Build a mouse region here that is over any others..... if (guiCurrentItemDescriptionScreen == MAP_SCREEN ) { - + //return( FALSE ); - MSYS_DefineRegion( &gInvDesc, (UINT16)gsInvDescX, (UINT16)gsInvDescY ,(UINT16)(gsInvDescX + MAP_ITEMDESC_WIDTH), (UINT16)(gsInvDescY + MAP_ITEMDESC_HEIGHT), MSYS_PRIORITY_HIGHEST - 2, - CURSOR_NORMAL, MSYS_NO_CALLBACK, ItemDescCallback ); + MSYS_DefineRegion( &gInvDesc, (UINT16)gsInvDescX, (UINT16)gsInvDescY ,(UINT16)(gsInvDescX + MAP_ITEMDESC_WIDTH), (UINT16)(gsInvDescY + MAP_ITEMDESC_HEIGHT), MSYS_PRIORITY_HIGHEST - 2, + CURSOR_NORMAL, MSYS_NO_CALLBACK, ItemDescCallback ); MSYS_AddRegion( &gInvDesc); giMapInvDescButtonImage= LoadButtonImage( "INTERFACE\\itemdescdonebutton.sti" ,-1,0,-1,1,-1 ); - + // create button giMapInvDescButton= QuickCreateButton( giMapInvDescButtonImage, (UINT16)( gsInvDescX + 204 ), (UINT16)( gsInvDescY + 107 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, ( GUI_CALLBACK )BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)ItemDescDoneButtonCallback ); - + fShowDescriptionFlag = TRUE; } + else if(guiCurrentItemDescriptionScreen == SHOPKEEPER_SCREEN) + { + MSYS_DefineRegion( &gInvDesc, (UINT16)gsInvDescX, (UINT16)gsInvDescY ,(UINT16)(gsInvDescX + ITEMDESC_WIDTH), (UINT16)(gsInvDescY + ITEMDESC_HEIGHT), MSYS_PRIORITY_HIGHEST, + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, ItemDescCallback ); + MSYS_AddRegion( &gInvDesc); + } else { - MSYS_DefineRegion( &gInvDesc, (UINT16)gsInvDescX, (UINT16)gsInvDescY ,(UINT16)(gsInvDescX + ITEMDESC_WIDTH), (UINT16)(gsInvDescY + ITEMDESC_HEIGHT), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, ItemDescCallback ); - MSYS_AddRegion( &gInvDesc); - - + MSYS_DefineRegion( &gInvDesc, (UINT16)SM_ITEMDESC_START_X, (UINT16)SM_ITEMDESC_START_Y ,(UINT16)(SM_ITEMDESC_START_X + ITEMDESC_WIDTH), (UINT16)(SM_ITEMDESC_START_Y + ITEMDESC_HEIGHT), MSYS_PRIORITY_HIGHEST, + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, ItemDescCallback ); + MSYS_AddRegion( &gInvDesc); } - // Add region + + // Add region if ( (Item[ pObject->usItem ].usItemClass & IC_GUN) && !Item[pObject->usItem].rocketlauncher ) { // Add button // if( guiCurrentScreen != MAP_SCREEN ) //if( guiCurrentItemDescriptionScreen != MAP_SCREEN ) if ( GetMagSize(gpItemDescObject) <= 99 ) - swprintf( pStr, L"%d/%d", gpItemDescObject->ItemData.Gun.ubGunShotsLeft, GetMagSize(gpItemDescObject)); + swprintf( pStr, L"%d/%d", (*gpItemDescObject)[ubStatusIndex]->data.gun.ubGunShotsLeft, GetMagSize(gpItemDescObject)); else - swprintf( pStr, L"%d", gpItemDescObject->ItemData.Gun.ubGunShotsLeft ); + swprintf( pStr, L"%d", (*gpItemDescObject)[ubStatusIndex]->data.gun.ubGunShotsLeft ); FilenameForBPP("INTERFACE\\infobox.sti", ubString); sForeColour = ITEMDESC_AMMO_FORE; - giItemDescAmmoButtonImages = LoadButtonImage(ubString,AmmoTypes[pObject->ItemData.Gun.ubGunAmmoType].grayed,AmmoTypes[pObject->ItemData.Gun.ubGunAmmoType].offNormal,-1,AmmoTypes[pObject->ItemData.Gun.ubGunAmmoType].onNormal,-1 ); + giItemDescAmmoButtonImages = LoadButtonImage(ubString,AmmoTypes[(*pObject)[ubStatusIndex]->data.gun.ubGunAmmoType].grayed,AmmoTypes[(*pObject)[ubStatusIndex]->data.gun.ubGunAmmoType].offNormal,-1,AmmoTypes[(*pObject)[ubStatusIndex]->data.gun.ubGunAmmoType].onNormal,-1 ); - //switch( pObject->ubGunAmmoType ) + //switch( (*pObject)[ubStatusIndex]->data.gun.ubGunAmmoType ) //{ // case AMMO_AP: // case AMMO_SUPER_AP: @@ -2463,7 +2990,7 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, // break; // case AMMO_HP: // //sForeColour = ITEMDESC_FONTHPFORE; - // + // // giItemDescAmmoButtonImages = LoadButtonImage(ubString,12,9,-1,11,-1 ); // break; // default: @@ -2472,14 +2999,14 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, // break; //} - + if( guiCurrentItemDescriptionScreen == MAP_SCREEN ) { // in mapscreen, move over a bit - giItemDescAmmoButton = CreateIconAndTextButton( giItemDescAmmoButtonImages, pStr, TINYFONT1, + giItemDescAmmoButton = CreateIconAndTextButton( giItemDescAmmoButtonImages, pStr, TINYFONT1, sForeColour, FONT_MCOLOR_BLACK, sForeColour, FONT_MCOLOR_BLACK, - TEXT_CJUSTIFIED, + TEXT_CJUSTIFIED, (INT16)(ITEMDESC_AMMO_X + 18), (INT16)(ITEMDESC_AMMO_Y - 5), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ItemDescAmmoCallback ); @@ -2488,14 +3015,14 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, { // not in mapscreen - giItemDescAmmoButton = CreateIconAndTextButton( giItemDescAmmoButtonImages, pStr, TINYFONT1, + giItemDescAmmoButton = CreateIconAndTextButton( giItemDescAmmoButtonImages, pStr, TINYFONT1, sForeColour, FONT_MCOLOR_BLACK, sForeColour, FONT_MCOLOR_BLACK, - TEXT_CJUSTIFIED, + TEXT_CJUSTIFIED, (INT16)(ITEMDESC_AMMO_X), (INT16)(ITEMDESC_AMMO_Y), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ItemDescAmmoCallback ); - //if we are being called from the + //if we are being called from the } //if we are being init from the shop keeper screen and this is a dealer item we are getting info from if( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE && pShopKeeperItemDescObject != NULL ) @@ -2506,13 +3033,16 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, DisableButton( giItemDescAmmoButton ); SetButtonFastHelpText( giItemDescAmmoButton, L"\0" ); } - else + else{ SetButtonFastHelpText( giItemDescAmmoButton, Message[ STR_EJECT_AMMO ] ); - + //CHRISL: Include the ubStatusIndex in the region information so we know which object in a stack we're looking at + MSYS_SetBtnUserData( giItemDescAmmoButton, 1, ubStatusIndex ); + } + FindFontCenterCoordinates( (INT16)ITEMDESC_AMMO_TEXT_X, (INT16)ITEMDESC_AMMO_TEXT_Y, ITEMDESC_AMMO_TEXT_WIDTH, GetFontHeight( TINYFONT1 ), pStr, TINYFONT1, &usX, &usY); - + SpecifyButtonTextOffsets( giItemDescAmmoButton, (UINT8) usX, (UINT8) usY, TRUE ); - + gfItemAmmoDown = FALSE; } @@ -2524,13 +3054,13 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, sProsConsIndent = __max( StringPixLength( gzProsLabel, ITEMDESC_FONT ), StringPixLength( gzConsLabel, ITEMDESC_FONT ) ) + 10; for ( cnt = 0; cnt < 2; cnt++ ) { - // Add region for pros/cons help text - MSYS_DefineRegion( &gProsAndConsRegions[ cnt ], - (INT16)(ITEMDESC_PROS_START_X + sProsConsIndent), - (INT16)(gsInvDescY + gMapItemDescProsConsRects[ cnt ].iTop), - (INT16)(gsInvDescX + gMapItemDescProsConsRects[ cnt ].iRight), - (INT16)(gsInvDescY + gMapItemDescProsConsRects[ cnt ].iBottom), - MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, ItemDescCallback ); + // Add region for pros/cons help text + MSYS_DefineRegion( &gProsAndConsRegions[ cnt ], + (INT16)(ITEMDESC_PROS_START_X + sProsConsIndent), + (INT16)(gsInvDescY + gMapItemDescProsConsRects[ cnt ].iTop), + (INT16)(gsInvDescX + gMapItemDescProsConsRects[ cnt ].iRight), + (INT16)(gsInvDescY + gMapItemDescProsConsRects[ cnt ].iBottom), + MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, ItemDescCallback ); MSYS_AddRegion( &gProsAndConsRegions[cnt]); @@ -2561,13 +3091,13 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, sProsConsIndent = __max( StringPixLength( gzProsLabel, ITEMDESC_FONT ), StringPixLength( gzConsLabel, ITEMDESC_FONT ) ) + 10; for ( cnt = 0; cnt < 2; cnt++ ) { - // Add region for pros/cons help text - MSYS_DefineRegion( &gProsAndConsRegions[ cnt ], - (INT16)(ITEMDESC_PROS_START_X + sProsConsIndent), - (INT16)(gsInvDescY + gItemDescProsConsRects[ cnt ].iTop), - (INT16)(gsInvDescX + gItemDescProsConsRects[ cnt ].iRight), - (INT16)(gsInvDescY + gItemDescProsConsRects[ cnt ].iBottom), - MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, ItemDescCallback ); + // Add region for pros/cons help text + MSYS_DefineRegion( &gProsAndConsRegions[ cnt ], + (INT16)(ITEMDESC_PROS_START_X + sProsConsIndent), + (INT16)(gsInvDescY + gItemDescProsConsRects[ cnt ].iTop), + (INT16)(gsInvDescX + gItemDescProsConsRects[ cnt ].iRight), + (INT16)(gsInvDescY + gItemDescProsConsRects[ cnt ].iBottom), + MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, ItemDescCallback ); MSYS_AddRegion( &gProsAndConsRegions[cnt]); @@ -2599,6 +3129,14 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, strcpy( VObjectDesc.ImageFile, "INTERFACE\\infobox_interface.sti" ); CHECKF( AddVideoObject( &VObjectDesc, &guiItemDescBox) ); + if(ubPosition != 255 && UsingNewInventorySystem() == true) + { + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + strcpy( VObjectDesc.ImageFile, "INTERFACE\\infobox_background.sti" ); + CHECKF( AddVideoObject( &VObjectDesc, &guiItemDescBoxBackground) ); + } + else + guiItemDescBoxBackground = 0; VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; strcpy( VObjectDesc.ImageFile, "INTERFACE\\iteminfoc.STI" ); @@ -2616,17 +3154,21 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, // if (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) if( guiCurrentItemDescriptionScreen == MAP_SCREEN ) MSYS_DefineRegion( &gItemDescAttachmentRegions[cnt], (INT16)(gsInvDescX + gMapItemDescAttachmentsXY[cnt].sX), (INT16)(gsInvDescY + gMapItemDescAttachmentsXY[cnt].sY), (INT16)(gsInvDescX + gMapItemDescAttachmentsXY[cnt].sX + gMapItemDescAttachmentsXY[cnt].sWidth), (INT16)(gsInvDescY + gMapItemDescAttachmentsXY[cnt].sY + gMapItemDescAttachmentsXY[cnt].sHeight), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, ItemDescAttachmentsCallback ); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, ItemDescAttachmentsCallback ); else MSYS_DefineRegion( &gItemDescAttachmentRegions[cnt], (INT16)(gsInvDescX + gItemDescAttachmentsXY[cnt].sX), (INT16)(gsInvDescY + gItemDescAttachmentsXY[cnt].sY), (INT16)(gsInvDescX + gItemDescAttachmentsXY[cnt].sX + gItemDescAttachmentsXY[cnt].sBarDx + gItemDescAttachmentsXY[cnt].sWidth), (INT16)(gsInvDescY + gItemDescAttachmentsXY[cnt].sY + gItemDescAttachmentsXY[cnt].sHeight), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, ItemDescAttachmentsCallback ); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, ItemDescAttachmentsCallback ); // Add region MSYS_AddRegion( &gItemDescAttachmentRegions[cnt]); MSYS_SetRegionUserData( &gItemDescAttachmentRegions[cnt], 0, cnt ); - if ( gpItemDescObject->usAttachItem[ cnt ] != NOTHING ) - { - SetRegionFastHelpText( &(gItemDescAttachmentRegions[ cnt ]), ItemNames[ gpItemDescObject->usAttachItem[ cnt ] ] ); + //CHRISL: Include the ubStatusIndex in the region information so we know which object in a stack we're looking at + MSYS_SetRegionUserData( &gItemDescAttachmentRegions[cnt], 1, ubStatusIndex ); + + // CHRISL: Instead of looking at object 0, let's look at the object we actually right clicked on using ubStatusIndex + OBJECTTYPE* pAttachment = (*pObject)[ubStatusIndex]->GetAttachmentAtIndex(cnt); + if (pAttachment) { + SetRegionFastHelpText( &(gItemDescAttachmentRegions[ cnt ]), ItemNames[ pAttachment->usItem ] ); SetRegionHelpEndCallback( &(gItemDescAttachmentRegions[ cnt ]), HelpTextDoneCallback ); } else @@ -2639,8 +3181,8 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, else { memset( &gRemoveMoney, 0, sizeof( REMOVE_MONEY ) ); - gRemoveMoney.uiTotalAmount = gpItemDescObject->ItemData.Money.uiMoneyAmount; - gRemoveMoney.uiMoneyRemaining = gpItemDescObject->ItemData.Money.uiMoneyAmount; + gRemoveMoney.uiTotalAmount = (*gpItemDescObject)[0]->data.money.uiMoneyAmount; + gRemoveMoney.uiMoneyRemaining = (*gpItemDescObject)[0]->data.money.uiMoneyAmount; gRemoveMoney.uiMoneyRemoving = 0; // Load graphic @@ -2655,10 +3197,10 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, guiMoneyButtonImage = LoadButtonImage("INTERFACE\\Info_bil.sti", -1,1,-1,2,-1 ); for(cnt=0; cntusAttachItem[ cnt ]; - gbOriginalAttachStatus[ cnt ] = pObject->bAttachStatus[ cnt ]; - } - + gOriginalAttachments = (*pObject)[ubStatusIndex]->attachments; if ( (gpItemPointer != NULL) && (gfItemDescHelpTextOffset == FALSE) && (CheckFact( FACT_ATTACHED_ITEM_BEFORE, 0 ) == FALSE) ) { @@ -2748,19 +3286,19 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, // if ( !(Item[ pObject->usItem ].fFlags & ITEM_HIDDEN_ADDON) && ( ValidAttachment( gpItemPointer->usItem, pObject->usItem ) || ValidLaunchable( gpItemPointer->usItem, pObject->usItem ) || ValidMerge( gpItemPointer->usItem, pObject->usItem ) ) ) if ( !(Item[ pObject->usItem ].hiddenaddon ) && ( ValidAttachment( gpItemPointer->usItem, pObject->usItem ) || ValidLaunchable( gpItemPointer->usItem, pObject->usItem ) || ValidMerge( gpItemPointer->usItem, pObject->usItem ) ) ) { - SetUpFastHelpListRegions( - gItemDescHelpText.iXPosition, - gItemDescHelpText.iYPosition, - gItemDescHelpText.iWidth, + SetUpFastHelpListRegions( + gItemDescHelpText.iXPosition, + gItemDescHelpText.iYPosition, + gItemDescHelpText.iWidth, gItemDescHelpText.sString1, - NUM_INV_HELPTEXT_ENTRIES ); + NUM_INV_HELPTEXT_ENTRIES ); } else { - SetUpFastHelpListRegions( - gItemDescHelpText.iXPosition, - gItemDescHelpText.iYPosition, - gItemDescHelpText.iWidth, + SetUpFastHelpListRegions( + gItemDescHelpText.iXPosition, + gItemDescHelpText.iYPosition, + gItemDescHelpText.iWidth, gItemDescHelpText.sString2, NUM_INV_HELPTEXT_ENTRIES ); } @@ -2828,6 +3366,7 @@ void ItemDescAmmoCallback(GUI_BUTTON *btn,INT32 reason) { static BOOLEAN fRightDown = FALSE; CHAR16 pStr[10]; + UINT32 ubStatusIndex = MSYS_GetBtnUserData( btn, 1 ); /* region gets disabled in SKI for shopkeeper boxes. It now works normally for merc's inventory boxes! //if we are currently in the shopkeeper interface, return; @@ -2850,8 +3389,8 @@ void ItemDescAmmoCallback(GUI_BUTTON *btn,INT32 reason) gfItemAmmoDown = FALSE; if( guiCurrentItemDescriptionScreen == MAP_SCREEN ) - { - if ( gpItemPointer == NULL && EmptyWeaponMagazine( gpItemDescObject, &gItemPointer ) ) + { + if ( gpItemPointer == NULL && EmptyWeaponMagazine( gpItemDescObject, &gItemPointer, ubStatusIndex ) ) { // OK, END the description box //fItemDescDelete = TRUE; @@ -2866,7 +3405,7 @@ void ItemDescAmmoCallback(GUI_BUTTON *btn,INT32 reason) guiExternVo = GetInterfaceGraphicForItem( &(Item[ gpItemPointer->usItem ]) ); gusExternVoSubIndex = Item[ gpItemPointer->usItem ].ubGraphicNum; - MSYS_ChangeRegionCursor( &gMPanelRegion , EXTERN_CURSOR ); + MSYS_ChangeRegionCursor( &gMPanelRegion , EXTERN_CURSOR ); MSYS_SetCurrentCursor( EXTERN_CURSOR ); fMapInventoryItem=TRUE; fTeamPanelDirty=TRUE; @@ -2875,7 +3414,7 @@ void ItemDescAmmoCallback(GUI_BUTTON *btn,INT32 reason) else { // Set pointer to item - if ( gpItemPointer == NULL && EmptyWeaponMagazine( gpItemDescObject, &gItemPointer ) ) + if ( gpItemPointer == NULL && EmptyWeaponMagazine( gpItemDescObject, &gItemPointer, ubStatusIndex ) ) { gpItemPointer = &gItemPointer; gpItemPointerSoldier = gpItemDescSoldier; @@ -2905,32 +3444,33 @@ void ItemDescAmmoCallback(GUI_BUTTON *btn,INT32 reason) } -void DoAttachment( void ) +//CHRISL: We need to know which item in the stack we're working with. +void DoAttachment( UINT8 subObject ) { - if ( AttachObject( gpItemDescSoldier, gpItemDescObject, gpItemPointer ) ) + if ( gpItemDescObject->AttachObject( gpItemDescSoldier, gpItemPointer, TRUE, subObject ) ) { - if (gpItemPointer->usItem == NOTHING) + if (gpItemPointer->exists() == false) { // attachment attached, merge item consumed, etc - if ( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) - { - MAPEndItemPointer( ); - } - else - { + if ( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) + { + MAPEndItemPointer( ); + } + else + { // End Item pickup gpItemPointer = NULL; EnableSMPanelButtons( TRUE , TRUE ); - MSYS_ChangeRegionCursor( &gSMPanelRegion , CURSOR_NORMAL ); + MSYS_ChangeRegionCursor( &gSMPanelRegion , CURSOR_NORMAL ); SetCurrentCursorFromDatabase( CURSOR_NORMAL ); //if we are currently in the shopkeeper interface if( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) { //Clear out the moving cursor - memset( &gMoveingItem, 0, sizeof( INVENTORY_IN_SLOT ) ); + gMoveingItem.initialize(); //change the curosr back to the normal one SetSkiCursor( CURSOR_NORMAL ); @@ -2938,7 +3478,7 @@ void DoAttachment( void ) } } - if ( gpItemDescObject->usItem == NOTHING ) + if ( gpItemDescObject->exists() == false ) { // close desc panel panel DeleteItemDescriptionBox(); @@ -2946,7 +3486,7 @@ void DoAttachment( void ) //Dirty interface fInterfacePanelDirty = DIRTYLEVEL2; - ReloadItemDesc( ); + ReloadItemDesc( ); } // re-evaluate repairs @@ -2957,14 +3497,14 @@ void PermanantAttachmentMessageBoxCallBack( UINT8 ubExitValue ) { if ( ubExitValue == MSG_BOX_RETURN_YES ) { - DoAttachment(); + DoAttachment(0); } // else do nothing } void ItemDescAttachmentsCallback( MOUSE_REGION * pRegion, INT32 iReason ) { - UINT32 uiItemPos; + UINT32 uiItemPos, ubStatusIndex; static BOOLEAN fRightDown = FALSE; if ( gfItemDescObjectIsAttachment ) @@ -2974,6 +3514,8 @@ void ItemDescAttachmentsCallback( MOUSE_REGION * pRegion, INT32 iReason ) } uiItemPos = MSYS_GetRegionUserData( pRegion, 0 ); + ubStatusIndex = MSYS_GetRegionUserData( pRegion, 1 ); + OBJECTTYPE* pAttachment = (*gpItemDescObject)[ubStatusIndex]->GetAttachmentAtIndex(uiItemPos); if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) { @@ -2997,29 +3539,28 @@ void ItemDescAttachmentsCallback( MOUSE_REGION * pRegion, INT32 iReason ) return; } - DoAttachment(); + DoAttachment((UINT8)ubStatusIndex); } } else { - // ATE: Make sure we have enough AP's to drop it if we pick it up! - if ( EnoughPoints( gpItemDescSoldier, ( AttachmentAPCost( gpItemDescObject->usAttachItem[uiItemPos], gpItemDescObject->usItem ) + AP_PICKUP_ITEM ), 0, TRUE ) ) + // ATE: Make sure we have enough AP's to drop it if we pick it up! + if ( pAttachment && EnoughPoints( gpItemDescSoldier, ( AttachmentAPCost( pAttachment->usItem, gpItemDescObject->usItem ) + AP_PICKUP_ITEM ), 0, TRUE ) ) { // Get attachment if there is one // The follwing function will handle if no attachment is here - if ( RemoveAttachment( gpItemDescObject, (UINT8)uiItemPos, &gItemPointer ) ) + if ( gpItemDescObject->RemoveAttachment( pAttachment, &gItemPointer, ubStatusIndex ) ) { gpItemPointer = &gItemPointer; gpItemPointerSoldier = gpItemDescSoldier; - // if( guiCurrentScreen == MAP_SCREEN ) if( guiCurrentItemDescriptionScreen == MAP_SCREEN ) { // Set mouse guiExternVo = GetInterfaceGraphicForItem( &(Item[ gpItemPointer->usItem ]) ); gusExternVoSubIndex = Item[ gpItemPointer->usItem ].ubGraphicNum; - MSYS_ChangeRegionCursor( &gMPanelRegion , EXTERN_CURSOR ); + MSYS_ChangeRegionCursor( &gMPanelRegion , EXTERN_CURSOR ); MSYS_SetCurrentCursor( EXTERN_CURSOR ); fMapInventoryItem=TRUE; fTeamPanelDirty=TRUE; @@ -3049,12 +3590,12 @@ void ItemDescAttachmentsCallback( MOUSE_REGION * pRegion, INT32 iReason ) } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP && fRightDown ) { - static OBJECTTYPE Object2; - fRightDown = FALSE; - if ( gpItemDescObject->usAttachItem[ uiItemPos ] != NOTHING ) + if ( pAttachment ) { + static OBJECTTYPE Object2; + BOOLEAN fShopkeeperItem = FALSE; // remember if this is a shopkeeper's item we're viewing ( pShopKeeperItemDescObject will get nuked on deletion ) @@ -3065,16 +3606,14 @@ void ItemDescAttachmentsCallback( MOUSE_REGION * pRegion, INT32 iReason ) DeleteItemDescriptionBox( ); - if ( CreateItem( gpItemDescObject->usAttachItem[ uiItemPos ], gpItemDescObject->bAttachStatus[ uiItemPos ], &Object2 ) ) - { - gfItemDescObjectIsAttachment = TRUE; - InternalInitItemDescriptionBox( &Object2, gsInvDescX, gsInvDescY, 0, gpItemDescSoldier ); + Object2 = *pAttachment; + gfItemDescObjectIsAttachment = TRUE; + InternalInitItemDescriptionBox( &Object2, gsInvDescX, gsInvDescY, 0, gpItemDescSoldier ); - if ( fShopkeeperItem ) - { - pShopKeeperItemDescObject = &Object2; - StartSKIDescriptionBox( ); - } + if ( fShopkeeperItem ) + { + pShopKeeperItemDescObject = &Object2; + StartSKIDescriptionBox( ); } } } @@ -3096,8 +3635,16 @@ void RenderItemDescriptionBox( ) UINT8 ubAttackAPs; BOOLEAN fHatchOutAttachments = gfItemDescObjectIsAttachment; // if examining attachment, always hatch out attachment slots INT16 sProsConsIndent; + INT8 showBox=0; - if( ( guiCurrentItemDescriptionScreen == MAP_SCREEN ) &&(gfInItemDescBox ) ) + int status = 0; + int shotsLeft = 0; + if (gpItemDescObject && gubItemDescStatusIndex < gpItemDescObject->ubNumberOfObjects) { + status = (*gpItemDescObject)[ gubItemDescStatusIndex ]->data.objectStatus; + shotsLeft = (*gpItemDescObject)[ gubItemDescStatusIndex ]->data.ubShotsLeft; + } + + if( ( guiCurrentItemDescriptionScreen == MAP_SCREEN ) &&(gfInItemDescBox ) ) { // TAKE A LOOK AT THE VIDEO OBJECT SIZE ( ONE OF TWO SIZES ) AND CENTER! GetVideoObject( &hVObject, guiItemGraphic ); @@ -3110,7 +3657,17 @@ void RenderItemDescriptionBox( ) sCenX = MAP_ITEMDESC_ITEM_X + (INT16)( abs( ITEMDESC_ITEM_WIDTH - (double)usWidth ) / 2 ) - pTrav->sOffsetX; sCenY = MAP_ITEMDESC_ITEM_Y + (INT16)( abs( ITEMDESC_ITEM_HEIGHT - (double)usHeight ) / 2 )- pTrav->sOffsetY; - BltVideoObjectFromIndex( guiSAVEBUFFER, guiMapItemDescBox, 0, gsInvDescX, gsInvDescY, VO_BLT_SRCTRANSPARENCY, NULL ); + // CHRISL: Determine if we're looking at an LBENODE and display alternate box graphic + if((UsingNewInventorySystem() == true) && iResolution != 0) + { + if(gpItemDescObject->IsActiveLBE(gubItemDescStatusIndex)) + showBox = gpItemDescObject->GetLBEPointer(gubItemDescStatusIndex)->lbeClass + 1; + else if(Item[gpItemDescObject->usItem].usItemClass == IC_LBEGEAR) + showBox = LoadBearingEquipment[Item[gpItemDescObject->usItem].ubClassIndex].lbeClass + 1; + else + showBox = 1; + } + BltVideoObjectFromIndex( guiSAVEBUFFER, guiMapItemDescBox, showBox, gsInvDescX, gsInvDescY, VO_BLT_SRCTRANSPARENCY, NULL ); //Display the money 'seperating' border if ( gpItemDescObject->usItem == MONEY ) @@ -3124,63 +3681,50 @@ void RenderItemDescriptionBox( ) if(gGameSettings.fOptions[ TOPTION_SHOW_ITEM_SHADOW ]) BltVideoObjectOutlineShadowFromIndex( guiSAVEBUFFER, guiItemGraphic, 0, sCenX - 2, sCenY + 2 ); BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemGraphic, 0, sCenX, sCenY, VO_BLT_SRCTRANSPARENCY, NULL ); - + // Display ststus DrawItemUIBarEx( gpItemDescObject, gubItemDescStatusIndex, (INT16)MAP_ITEMDESC_ITEM_STATUS_X, (INT16)MAP_ITEMDESC_ITEM_STATUS_Y, ITEMDESC_ITEM_STATUS_WIDTH, ITEMDESC_ITEM_STATUS_HEIGHT_MAP, Get16BPPColor( DESC_STATUS_BAR ), Get16BPPColor( DESC_STATUS_BAR_SHADOW ), TRUE, guiSAVEBUFFER ); + // CHRISL: This block will display hatching for inactive LBE pockets + // Display LBENODE attached items + if(UsingNewInventorySystem() == true && Item[gpItemDescObject->usItem].usItemClass == IC_LBEGEAR) + { + RenderLBENODEItems( gpItemDescObject, gubItemDescStatusIndex ); + } + if (gpItemPointer) { // if ( ( Item[ gpItemPointer->usItem ].fFlags & ITEM_HIDDEN_ADDON ) || if ( ( Item[ gpItemPointer->usItem ].hiddenaddon ) || - ( !ValidItemAttachment( gpItemDescObject, gpItemPointer->usItem, FALSE ) && + ( !ValidItemAttachment( gpItemDescObject, gpItemPointer->usItem, FALSE ) && !ValidMerge( gpItemPointer->usItem, gpItemDescObject->usItem ) && !ValidLaunchable( gpItemPointer->usItem, gpItemDescObject->usItem ) ) ) { // hatch out the attachment panels fHatchOutAttachments = TRUE; } } - + // Display attachments - for ( cnt = 0; cnt < MAX_ATTACHMENTS; cnt++ ) + cnt = 0; + for (attachmentList::iterator iter = (*gpItemDescObject)[gubItemDescStatusIndex]->attachments.begin(); + iter != (*gpItemDescObject)[gubItemDescStatusIndex]->attachments.end(); ++iter, ++cnt) { + + sCenX = (INT16)( gsInvDescX + gMapItemDescAttachmentsXY[cnt].sX + 5 ); + sCenY = (INT16)( gsInvDescY + gMapItemDescAttachmentsXY[cnt].sY - 1 ); + INVRenderItem( guiSAVEBUFFER, NULL, gpItemDescObject, sCenX, sCenY, gMapItemDescAttachmentsXY[cnt].sWidth, gMapItemDescAttachmentsXY[cnt].sHeight, DIRTYLEVEL2, NULL, (UINT8)(RENDER_ITEM_ATTACHMENT1 + cnt), FALSE, 0, gubItemDescStatusIndex ); + sCenX = sCenX - gItemDescAttachmentsXY[cnt].sBarDx; + sCenY = sCenY + gItemDescAttachmentsXY[cnt].sBarDy; + DrawItemUIBarEx( gpItemDescObject, (UINT8)(DRAW_ITEM_STATUS_ATTACHMENT1 + cnt), sCenX, sCenY, ITEM_BAR_WIDTH, ITEM_BAR_HEIGHT, Get16BPPColor( STATUS_BAR ), Get16BPPColor( STATUS_BAR_SHADOW ), TRUE , guiSAVEBUFFER, gubItemDescStatusIndex ); + //this code was the same inside both branches of the if below! + } + for (cnt = 0; cnt < MAX_ATTACHMENTS; ++cnt) { - if ( gpItemDescObject->usAttachItem[ cnt ] != NOTHING ) - { - -// if (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) - if( guiCurrentItemDescriptionScreen == MAP_SCREEN ) - { - sCenX = (INT16)( gsInvDescX + gMapItemDescAttachmentsXY[cnt].sX + 5 ); - sCenY = (INT16)( gsInvDescY + gMapItemDescAttachmentsXY[cnt].sY - 1 ); - - INVRenderItem( guiSAVEBUFFER, NULL, gpItemDescObject, sCenX, sCenY, gMapItemDescAttachmentsXY[cnt].sWidth, gMapItemDescAttachmentsXY[cnt].sHeight, DIRTYLEVEL2, NULL, (UINT8)(RENDER_ITEM_ATTACHMENT1 + cnt), FALSE, 0 ); - - sCenX = sCenX - gMapItemDescAttachmentsXY[cnt].sBarDx; - sCenY = sCenY + gMapItemDescAttachmentsXY[cnt].sBarDy; - DrawItemUIBarEx( gpItemDescObject, (UINT8)(DRAW_ITEM_STATUS_ATTACHMENT1 + cnt), sCenX, sCenY, ITEM_BAR_WIDTH, ITEM_BAR_HEIGHT, Get16BPPColor( STATUS_BAR ), Get16BPPColor( STATUS_BAR_SHADOW ), TRUE , guiSAVEBUFFER ); - - } - else - { - sCenX = (INT16)( gsInvDescX + gMapItemDescAttachmentsXY[cnt].sX + 5 ); - sCenY = (INT16)( gsInvDescY + gMapItemDescAttachmentsXY[cnt].sY - 1 ); - - INVRenderItem( guiSAVEBUFFER, NULL, gpItemDescObject, sCenX, sCenY, gMapItemDescAttachmentsXY[cnt].sWidth, gMapItemDescAttachmentsXY[cnt].sHeight, DIRTYLEVEL2, NULL, (UINT8)(RENDER_ITEM_ATTACHMENT1 + cnt), FALSE, 0 ); - - sCenX = sCenX - gItemDescAttachmentsXY[cnt].sBarDx; - sCenY = sCenY + gItemDescAttachmentsXY[cnt].sBarDy; - DrawItemUIBarEx( gpItemDescObject, (UINT8)(DRAW_ITEM_STATUS_ATTACHMENT1 + cnt), sCenX, sCenY, ITEM_BAR_WIDTH, ITEM_BAR_HEIGHT, Get16BPPColor( STATUS_BAR ), Get16BPPColor( STATUS_BAR_SHADOW ), TRUE , guiSAVEBUFFER ); - - - } - } - if (fHatchOutAttachments ) { DrawHatchOnInventory( guiSAVEBUFFER, (INT16) (gsInvDescX + gMapItemDescAttachmentsXY[ cnt ].sX), (INT16) (gsInvDescY + gMapItemDescAttachmentsXY[ cnt ].sY - 2), (INT16)(gMapItemDescAttachmentsXY[ cnt ].sWidth + gMapItemDescAttachmentsXY[ cnt ].sBarDx), (INT16) (gMapItemDescAttachmentsXY[ cnt ].sHeight + 2) ); } - } if ( Item[ gpItemDescObject->usItem ].usItemClass & IC_GUN || Item[ gpItemDescObject->usItem ].usItemClass & IC_LAUNCHER ) @@ -3208,6 +3752,13 @@ void RenderItemDescriptionBox( ) RestoreExternBackgroundRect( gsInvDescX, gsInvDescY, MAP_ITEMDESC_WIDTH, MAP_ITEMDESC_HEIGHT ); + // CHRISL: This block will display misc information for items stored in LBE Pockets + // Display LBENODE attached items + if(UsingNewInventorySystem() == true && Item[gpItemDescObject->usItem].usItemClass == IC_LBEGEAR) + { + RenderLBENODEItems( gpItemDescObject, gubItemDescStatusIndex ); + } + // Render font desc SetFont( ITEMDESC_FONT ); SetFontBackground( FONT_MCOLOR_BLACK ); @@ -3215,7 +3766,7 @@ void RenderItemDescriptionBox( ) SetFontShadow( ITEMDESC_FONTSHADOW3 ); // Render name - #ifdef JA2TESTVERSION + #ifdef JA2TESTVERSION mprintf( MAP_ITEMDESC_NAME_X, MAP_ITEMDESC_NAME_Y, L"%s (%d)", gzItemName, gpItemDescObject->usItem ); #else mprintf( MAP_ITEMDESC_NAME_X, MAP_ITEMDESC_NAME_Y, L"%s", gzItemName ); @@ -3225,13 +3776,13 @@ void RenderItemDescriptionBox( ) SetFontShadow( ITEMDESC_FONTSHADOW2 ); DisplayWrappedString( (INT16)MAP_ITEMDESC_DESC_START_X, (INT16)MAP_ITEMDESC_DESC_START_Y, MAP_ITEMDESC_DESC_WIDTH, 2, ITEMDESC_FONT, FONT_BLACK, gzItemDesc, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); - + if ( ITEM_PROS_AND_CONS( gpItemDescObject->usItem ) ) { - if ( (Item[gpItemDescObject->usItem].fingerprintid ) && gpItemDescObject->ubImprintID < NO_PROFILE ) + if ( (Item[gpItemDescObject->usItem].fingerprintid ) && (*gpItemDescObject)[gubItemDescStatusIndex]->data.ubImprintID < NO_PROFILE ) { // add name noting imprint - swprintf( pStr, L"%s %s (%s)", AmmoCaliber[ Weapon[ gpItemDescObject->usItem ].ubCalibre ], WeaponType[ Weapon[ gpItemDescObject->usItem ].ubWeaponType ], gMercProfiles[ gpItemDescObject->ubImprintID ].zNickname ); + swprintf( pStr, L"%s %s (%s)", AmmoCaliber[ Weapon[ gpItemDescObject->usItem ].ubCalibre ], WeaponType[ Weapon[ gpItemDescObject->usItem ].ubWeaponType ], gMercProfiles[ (*gpItemDescObject)[gubItemDescStatusIndex]->data.ubImprintID ].zNickname ); } else { @@ -3246,7 +3797,7 @@ void RenderItemDescriptionBox( ) mprintf( (INT16)MAP_ITEMDESC_PROS_START_X, (INT16)MAP_ITEMDESC_PROS_START_Y, gzProsLabel ); sProsConsIndent = __max( StringPixLength( gzProsLabel, ITEMDESC_FONT ), StringPixLength( gzConsLabel, ITEMDESC_FONT ) ) + 10; - + GenerateProsString( gzItemPros, gpItemDescObject, MAP_ITEMDESC_DESC_WIDTH - sProsConsIndent - StringPixLength( DOTDOTDOT, ITEMDESC_FONT ) ); if (gzItemPros[0] != 0) { @@ -3286,51 +3837,29 @@ void RenderItemDescriptionBox( ) uiRightLength=35; - //Pulmu: Changed weight calculation of single item in stack - if( Item[gpItemDescObject->usItem].usItemClass == IC_AMMO && gpItemDescObject->ubNumberOfObjects > 1 && gubItemDescStatusIndex < gpItemDescObject->ubNumberOfObjects) - { - //Get weight of one item in stack. - UINT8 ubShotsLeftFirst = gpItemDescObject->ItemData.Ammo.ubShotsLeft[0]; - UINT8 ubNumberOfObjects = gpItemDescObject->ubNumberOfObjects; - gpItemDescObject->ubNumberOfObjects = 1; - gpItemDescObject->ItemData.Ammo.ubShotsLeft[0] = gpItemDescObject->ItemData.Ammo.ubShotsLeft[gubItemDescStatusIndex]; - fWeight = (float)(CalculateObjectWeight( gpItemDescObject )) / 10; - gpItemDescObject->ItemData.Ammo.ubShotsLeft[0] = ubShotsLeftFirst; - gpItemDescObject->ubNumberOfObjects = ubNumberOfObjects; - } - //Item does not exist - else if( gubItemDescStatusIndex >= gpItemDescObject->ubNumberOfObjects ) - { - fWeight = (float)0.0; - } - else - { - fWeight = (float)(CalculateObjectWeight( gpItemDescObject )) / 10; - } + // Calculate total weight of item and attachments + fWeight = gpItemDescObject->GetWeightOfObjectInStack(gubItemDescStatusIndex) / 10.0f; if ( !gGameSettings.fOptions[ TOPTION_USE_METRIC_SYSTEM ] ) // metric units not enabled { fWeight = fWeight * 2.2f; } - // Add weight of attachments here ! - if ( fWeight < 0.1 && gubItemDescStatusIndex < gpItemDescObject->ubNumberOfObjects ) { - fWeight = (float)0.1; + fWeight = 0.1f; } - //Pulmu end // Render, stat name if ( Item[ gpItemDescObject->usItem ].usItemClass & IC_WEAPON ) - { + { SetFont( BLOCKFONT2 ); SetFontForeground( 6 ); SetFontShadow( DEFAULT_SHADOW ); - + //LABELS swprintf( sTempString, gWeaponStatsDesc[ 0 ], GetWeightUnitString() ); - mprintf( gMapWeaponStats[ 0 ].sX + gsInvDescX, gMapWeaponStats[ 0 ].sY + gsInvDescY, L"%s", sTempString ); + mprintf( gMapWeaponStats[ 0 ].sX + gsInvDescX, gMapWeaponStats[ 0 ].sY + gsInvDescY, L"%s", sTempString ); //mprintf( gMapWeaponStats[ 2 ].sX + gsInvDescX, gMapWeaponStats[ 2 ].sY + gsInvDescY, L"%s", gMapWeaponStats[ 2 ].zDesc ); if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN | IC_LAUNCHER ) ) { @@ -3358,7 +3887,7 @@ void RenderItemDescriptionBox( ) SetFontForeground( 5 ); //Status // This is gross, but to get the % to work out right... - swprintf( pStr, L"%2d%%", gpItemDescObject->ItemData.Generic.bStatus[ gubItemDescStatusIndex ] ); + swprintf( pStr, L"%2d%%", status); FindFontRightCoordinates( (INT16)(gMapWeaponStats[ 1 ].sX + gsInvDescX + gMapWeaponStats[ 1 ].sValDx + 6), (INT16)(gMapWeaponStats[ 1 ].sY + gsInvDescY ), ITEM_STATS_WIDTH ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY); wcscat( pStr, L"%%" ); mprintf( usX, usY, pStr ); @@ -3423,7 +3952,7 @@ void RenderItemDescriptionBox( ) else { SetFontForeground( 5 ); - } + } //Ap's if ( !Weapon[gpItemDescObject->usItem].NoSemiAuto ) @@ -3530,7 +4059,7 @@ void RenderItemDescriptionBox( ) { SetFontForeground( FONT_FCOLOR_WHITE ); SetFontShadow( DEFAULT_SHADOW ); - swprintf( pStr, L"%ld", gpItemDescObject->ItemData.Money.uiMoneyAmount ); + swprintf( pStr, L"%ld", (*gpItemDescObject)[gubItemDescStatusIndex]->data.money.uiMoneyAmount ); InsertCommasForDollarFigure( pStr ); InsertDollarSignInToString( pStr ); uiStringLength=StringPixLength(pStr, ITEMDESC_FONT ); @@ -3563,7 +4092,7 @@ void RenderItemDescriptionBox( ) if ( Item[ gpItemDescObject->usItem ].usItemClass & IC_AMMO ) { // Ammo - swprintf( pStr, L"%d/%d", gpItemDescObject->ItemData.Ammo.ubShotsLeft[gubItemDescStatusIndex], Magazine[ Item[ gpItemDescObject->usItem ].ubClassIndex ].ubMagSize ); //Pulmu: Correct # of rounds for stacked ammo. + swprintf( pStr, L"%d/%d", shotsLeft, Magazine[ Item[ gpItemDescObject->usItem ].ubClassIndex ].ubMagSize ); //Pulmu: Correct # of rounds for stacked ammo. uiStringLength=StringPixLength(pStr, ITEMDESC_FONT ); // sStrX = gMapWeaponStats[ 0 ].sX + gsInvDescX + gMapWeaponStats[ 0 ].sValDx + ( uiRightLength - uiStringLength ); FindFontRightCoordinates( (INT16)(gMapWeaponStats[ 2 ].sX + gsInvDescX + gMapWeaponStats[ 2 ].sValDx+6), (INT16)(gMapWeaponStats[ 2 ].sY + gsInvDescY ), ITEM_STATS_WIDTH ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &sStrX, &usY); @@ -3572,7 +4101,7 @@ void RenderItemDescriptionBox( ) else { //Status - swprintf( pStr, L"%2d%%", gpItemDescObject->ItemData.Generic.bStatus[ gubItemDescStatusIndex ] ); + swprintf( pStr, L"%2d%%", status); uiStringLength=StringPixLength(pStr, ITEMDESC_FONT ); // sStrX = gMapWeaponStats[ 1 ].sX + gsInvDescX + gMapWeaponStats[ 1 ].sValDx + ( uiRightLength - uiStringLength ); FindFontRightCoordinates( (INT16)(gMapWeaponStats[ 1 ].sX + gsInvDescX + gMapWeaponStats[ 1 ].sValDx + 6), (INT16)(gMapWeaponStats[ 1 ].sY + gsInvDescY ), ITEM_STATS_WIDTH ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &sStrX, &usY); @@ -3597,20 +4126,20 @@ void RenderItemDescriptionBox( ) swprintf( pStr, L"%s", sKeyDescriptionStrings[ 1 ] ); mprintf( gMapWeaponStats[ 4 ].sX + gsInvDescX, gMapWeaponStats[ 4 ].sY + gsInvDescY + GetFontHeight( BLOCKFONT ) + 2 , pStr ); - + SetFontForeground( 5 ); - GetShortSectorString( ( INT16 ) SECTORX( KeyTable[ gpItemDescObject->ItemData.Key.ubKeyID ].usSectorFound ), ( INT16 ) SECTORY( KeyTable[ gpItemDescObject->ItemData.Key.ubKeyID ].usSectorFound ), sTempString ); + GetShortSectorString( ( INT16 ) SECTORX( KeyTable[ (*gpItemDescObject)[gubItemDescStatusIndex]->data.key.ubKeyID ].usSectorFound ), ( INT16 ) SECTORY( KeyTable[ (*gpItemDescObject)[gubItemDescStatusIndex]->data.key.ubKeyID ].usSectorFound ), sTempString ); swprintf( pStr, L"%s", sTempString ); FindFontRightCoordinates( (INT16)(gMapWeaponStats[ 4 ].sX + gsInvDescX ), (INT16)(gMapWeaponStats[ 4 ].sY + gsInvDescY ), 110 ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY); mprintf( usX, usY, pStr ); - swprintf( pStr, L"%d", KeyTable[ gpItemDescObject->ItemData.Key.ubKeyID ].usDateFound ); + swprintf( pStr, L"%d", KeyTable[ (*gpItemDescObject)[gubItemDescStatusIndex]->data.key.ubKeyID ].usDateFound ); FindFontRightCoordinates( (INT16)(gMapWeaponStats[ 4 ].sX + gsInvDescX ), (INT16)(gMapWeaponStats[ 4 ].sY + gsInvDescY + GetFontHeight( BLOCKFONT ) + 2 ), 110 ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY); mprintf( usX, usY, pStr ); } } - + SetFontShadow( DEFAULT_SHADOW ); } else if ( gfInItemDescBox ) @@ -3626,7 +4155,24 @@ void RenderItemDescriptionBox( ) sCenX = ITEMDESC_ITEM_X + (INT16)( abs( ITEMDESC_ITEM_WIDTH - (double)usWidth ) / 2 ) - pTrav->sOffsetX; sCenY = ITEMDESC_ITEM_Y + (INT16)( abs( ITEMDESC_ITEM_HEIGHT - (double)usHeight ) / 2 ) - pTrav->sOffsetY; - BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemDescBox, 0, gsInvDescX, gsInvDescY, VO_BLT_SRCTRANSPARENCY, NULL ); + // CHRISL: Determine if we're looking at an LBENODE and display alternate box graphic + RenderBackpackButtons(1); /* CHRISL: Needed for new inventory backpack buttons */ + if((UsingNewInventorySystem() == true) && iResolution != 0) + { + if(gpItemDescObject->IsActiveLBE(gubItemDescStatusIndex)) + showBox = gpItemDescObject->GetLBEPointer(gubItemDescStatusIndex)->lbeClass; + else if(Item[gpItemDescObject->usItem].usItemClass == IC_LBEGEAR) + showBox = LoadBearingEquipment[Item[gpItemDescObject->usItem].ubClassIndex].lbeClass; + if(guiItemDescBoxBackground != 0) + BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemDescBoxBackground, iResolution, SM_ITEMDESC_START_X, SM_ITEMDESC_START_Y, VO_BLT_SRCTRANSPARENCY, NULL ); + } + // CHRISL: Setup default coords if we haven't initialized them yet + if(gsInvDescX == NONE && gsInvDescY == NONE) + { + gsInvDescX = 115; + gsInvDescY = (INT16)(INV_INTERFACE_START_Y + 1 ); + } + BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemDescBox, showBox, gsInvDescX, gsInvDescY, VO_BLT_SRCTRANSPARENCY, NULL ); if ( gpItemDescObject->usItem == MONEY ) { @@ -3642,12 +4188,19 @@ void RenderItemDescriptionBox( ) // Display status DrawItemUIBarEx( gpItemDescObject, gubItemDescStatusIndex, (INT16)ITEMDESC_ITEM_STATUS_X, (INT16)ITEMDESC_ITEM_STATUS_Y, ITEMDESC_ITEM_STATUS_WIDTH, ITEMDESC_ITEM_STATUS_HEIGHT, Get16BPPColor( DESC_STATUS_BAR ), Get16BPPColor( DESC_STATUS_BAR_SHADOW ), TRUE, guiSAVEBUFFER ); + // CHRISL: This block will display hatching for inactive LBE pockets + // Display LBENODE attached items + if(UsingNewInventorySystem() == true && Item[gpItemDescObject->usItem].usItemClass == IC_LBEGEAR) + { + RenderLBENODEItems( gpItemDescObject, gubItemDescStatusIndex ); + } + if (gpItemPointer) { // if ( ( Item[ gpItemPointer->usItem ].fFlags & ITEM_HIDDEN_ADDON ) || if ( ( Item[ gpItemPointer->usItem ].hiddenaddon ) || - ( !ValidItemAttachment( gpItemDescObject, gpItemPointer->usItem, FALSE ) && + ( !ValidItemAttachment( gpItemDescObject, gpItemPointer->usItem, FALSE ) && !ValidMerge( gpItemPointer->usItem, gpItemDescObject->usItem ) && !ValidLaunchable( gpItemPointer->usItem, gpItemDescObject->usItem ) ) ) { // hatch out the attachment panels @@ -3656,27 +4209,30 @@ void RenderItemDescriptionBox( ) } // Display attachments - for ( cnt = 0; cnt < MAX_ATTACHMENTS; cnt++ ) + cnt = 0; + for (attachmentList::iterator iter = (*gpItemDescObject)[gubItemDescStatusIndex]->attachments.begin(); + iter != (*gpItemDescObject)[gubItemDescStatusIndex]->attachments.end(); ++iter, ++cnt) { + sCenX = (INT16)( gsInvDescX + gItemDescAttachmentsXY[cnt].sX + 5 ); + sCenY = (INT16)( gsInvDescY + gItemDescAttachmentsXY[cnt].sY - 1 ); + + INVRenderItem( guiSAVEBUFFER, NULL, gpItemDescObject, sCenX, sCenY, gItemDescAttachmentsXY[cnt].sWidth, gItemDescAttachmentsXY[cnt].sHeight, DIRTYLEVEL2, NULL, (UINT8)(RENDER_ITEM_ATTACHMENT1 + cnt), FALSE, 0, gubItemDescStatusIndex ); + + sCenX = sCenX - gItemDescAttachmentsXY[cnt].sBarDx; + sCenY = sCenY + gItemDescAttachmentsXY[cnt].sBarDy; + DrawItemUIBarEx( gpItemDescObject, (UINT8)(DRAW_ITEM_STATUS_ATTACHMENT1 + cnt), sCenX, sCenY, ITEM_BAR_WIDTH, ITEM_BAR_HEIGHT, Get16BPPColor( STATUS_BAR ), Get16BPPColor( STATUS_BAR_SHADOW ), TRUE , guiSAVEBUFFER, gubItemDescStatusIndex ); + + SetRegionFastHelpText( &(gItemDescAttachmentRegions[ cnt ]), ItemNames[ iter->usItem ] ); + SetRegionHelpEndCallback( &(gItemDescAttachmentRegions[ cnt ]), HelpTextDoneCallback ); + } + for (; cnt < MAX_ATTACHMENTS; ++cnt) { - if ( gpItemDescObject->usAttachItem[ cnt ] != NOTHING ) - { - sCenX = (INT16)( gsInvDescX + gItemDescAttachmentsXY[cnt].sX + 5 ); - sCenY = (INT16)( gsInvDescY + gItemDescAttachmentsXY[cnt].sY - 1 ); - - INVRenderItem( guiSAVEBUFFER, NULL, gpItemDescObject, sCenX, sCenY, gItemDescAttachmentsXY[cnt].sWidth, gItemDescAttachmentsXY[cnt].sHeight, DIRTYLEVEL2, NULL, (UINT8)(RENDER_ITEM_ATTACHMENT1 + cnt), FALSE, 0 ); - - sCenX = sCenX - gItemDescAttachmentsXY[cnt].sBarDx; - sCenY = sCenY + gItemDescAttachmentsXY[cnt].sBarDy; - DrawItemUIBarEx( gpItemDescObject, (UINT8)(DRAW_ITEM_STATUS_ATTACHMENT1 + cnt), sCenX, sCenY, ITEM_BAR_WIDTH, ITEM_BAR_HEIGHT, Get16BPPColor( STATUS_BAR ), Get16BPPColor( STATUS_BAR_SHADOW ), TRUE , guiSAVEBUFFER ); - - SetRegionFastHelpText( &(gItemDescAttachmentRegions[ cnt ]), ItemNames[ gpItemDescObject->usAttachItem[ cnt ] ] ); - SetRegionHelpEndCallback( &(gItemDescAttachmentRegions[ cnt ]), HelpTextDoneCallback ); - } - else - { - SetRegionFastHelpText( &(gItemDescAttachmentRegions[ cnt ]), Message[ STR_ATTACHMENTS ] ); - SetRegionHelpEndCallback( &(gItemDescAttachmentRegions[ cnt ]), HelpTextDoneCallback ); - } + //for the attachments that don't exist + SetRegionFastHelpText( &(gItemDescAttachmentRegions[ cnt ]), Message[ STR_ATTACHMENTS ] ); + SetRegionHelpEndCallback( &(gItemDescAttachmentRegions[ cnt ]), HelpTextDoneCallback ); + } + for (cnt = 0; cnt < MAX_ATTACHMENTS; ++cnt) + { + //now for all attachment slots regardless if (fHatchOutAttachments) { //UINT32 uiWhichBuffer = ( guiCurrentItemDescriptionScreen == MAP_SCREEN ) ? guiSAVEBUFFER : guiRENDERBUFFER; @@ -3694,20 +4250,30 @@ void RenderItemDescriptionBox( ) { for ( cnt = 0; cnt < __min(GetShotsPerBurst(gpItemDescObject),12); cnt++ ) { - BltVideoObjectFromIndex( guiSAVEBUFFER, guiBullet, 0, BULLET_BURST_X + cnt * (BULLET_WIDTH/2 + 1), BULLET_BURST_Y, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObjectFromIndex( guiSAVEBUFFER, guiBullet, 0, BULLET_BURST_X + cnt * (BULLET_WIDTH/2 + 1), BULLET_BURST_Y, VO_BLT_SRCTRANSPARENCY, NULL ); } } else if ( GetAutofireShotsPerFiveAPs(gpItemDescObject) > 0 ) { for ( cnt = 0; cnt < 10; cnt++ ) { - BltVideoObjectFromIndex( guiSAVEBUFFER, guiBullet, 0, BULLET_BURST_X + cnt * (BULLET_WIDTH/2 + 1), BULLET_BURST_Y, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObjectFromIndex( guiSAVEBUFFER, guiBullet, 0, BULLET_BURST_X + cnt * (BULLET_WIDTH/2 + 1), BULLET_BURST_Y, VO_BLT_SRCTRANSPARENCY, NULL ); } } } - RestoreExternBackgroundRect( gsInvDescX, gsInvDescY, ITEMDESC_WIDTH, ITEMDESC_HEIGHT ); + if(guiCurrentItemDescriptionScreen == SHOPKEEPER_SCREEN) + RestoreExternBackgroundRect( gsInvDescX, gsInvDescY, 320, 135 ); + else + RestoreExternBackgroundRect( SM_ITEMDESC_START_X, SM_ITEMDESC_START_Y, ITEMDESC_WIDTH, ITEMDESC_HEIGHT ); + + // CHRISL: This block will display misc information for items stored in LBE Pockets + // Display LBENODE attached items + if(UsingNewInventorySystem() == true && Item[gpItemDescObject->usItem].usItemClass == IC_LBEGEAR) + { + RenderLBENODEItems( gpItemDescObject, gubItemDescStatusIndex ); + } // Render font desc SetFont( ITEMDESC_FONT ); @@ -3717,7 +4283,7 @@ void RenderItemDescriptionBox( ) // Render name // SET CLIPPING RECT FOR FONTS - #ifdef JA2TESTVERSION + #ifdef JA2TESTVERSION mprintf( ITEMDESC_NAME_X, ITEMDESC_NAME_Y, L"%s (%d)", gzItemName, gpItemDescObject->usItem ); #else mprintf( ITEMDESC_NAME_X, ITEMDESC_NAME_Y, L"%s", gzItemName ); @@ -3727,15 +4293,15 @@ void RenderItemDescriptionBox( ) SetFontForeground( FONT_BLACK ); SetFontShadow( ITEMDESC_FONTSHADOW2 ); - + DisplayWrappedString( (INT16)ITEMDESC_DESC_START_X, (INT16)ITEMDESC_DESC_START_Y, ITEMDESC_DESC_WIDTH, 2, ITEMDESC_FONT, FONT_BLACK, gzItemDesc, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); if ( ITEM_PROS_AND_CONS( gpItemDescObject->usItem ) ) { - if ( ( Item[gpItemDescObject->usItem].fingerprintid ) && gpItemDescObject->ubImprintID < NO_PROFILE ) + if ( ( Item[gpItemDescObject->usItem].fingerprintid ) && (*gpItemDescObject)[gubItemDescStatusIndex]->data.ubImprintID < NO_PROFILE ) { // add name noting imprint - swprintf( pStr, L"%s %s (%s)", AmmoCaliber[ Weapon[ gpItemDescObject->usItem ].ubCalibre ], WeaponType[ Weapon[ gpItemDescObject->usItem ].ubWeaponType ], gMercProfiles[ gpItemDescObject->ubImprintID ].zNickname ); + swprintf( pStr, L"%s %s (%s)", AmmoCaliber[ Weapon[ gpItemDescObject->usItem ].ubCalibre ], WeaponType[ Weapon[ gpItemDescObject->usItem ].ubWeaponType ], gMercProfiles[ (*gpItemDescObject)[gubItemDescStatusIndex]->data.ubImprintID ].zNickname ); } else { @@ -3780,40 +4346,18 @@ void RenderItemDescriptionBox( ) uiRightLength=35; // Calculate total weight of item and attachments - //Pulmu: Changed weight calculation of single item in stack. - if( Item[gpItemDescObject->usItem].usItemClass == IC_AMMO && gpItemDescObject->ubNumberOfObjects > 1 && gubItemDescStatusIndex < gpItemDescObject->ubNumberOfObjects) - { - //Get weight of one ammo clip in stack. - UINT8 ubShotsLeftFirst = gpItemDescObject->ItemData.Ammo.ubShotsLeft[0]; - UINT8 ubNumberOfObjects = gpItemDescObject->ubNumberOfObjects; - gpItemDescObject->ubNumberOfObjects = 1; - gpItemDescObject->ItemData.Ammo.ubShotsLeft[0] = gpItemDescObject->ItemData.Ammo.ubShotsLeft[gubItemDescStatusIndex]; - fWeight = (float)(CalculateObjectWeight( gpItemDescObject )) / 10; - gpItemDescObject->ItemData.Ammo.ubShotsLeft[0] = ubShotsLeftFirst; - gpItemDescObject->ubNumberOfObjects = ubNumberOfObjects; - } - //Item does not exist - else if( gubItemDescStatusIndex >= gpItemDescObject->ubNumberOfObjects ) - { - fWeight = (float)0.0; - } - else - { - fWeight = (float)(CalculateObjectWeight( gpItemDescObject )) / 10; - } - + fWeight = gpItemDescObject->GetWeightOfObjectInStack(gubItemDescStatusIndex) / 10.0f; - if ( !gGameSettings.fOptions[ TOPTION_USE_METRIC_SYSTEM ] ) + if ( !gGameSettings.fOptions[ TOPTION_USE_METRIC_SYSTEM ] ) // metric units not enabled { fWeight = fWeight * 2.2f; } if ( fWeight < 0.1 && gubItemDescStatusIndex < gpItemDescObject->ubNumberOfObjects ) { - fWeight = (float)0.1; + fWeight = 0.1f; } - //Pulmu end - + // Render, stat name if ( Item[ gpItemDescObject->usItem ].usItemClass & IC_WEAPON ) { @@ -3821,7 +4365,7 @@ void RenderItemDescriptionBox( ) SetFont( BLOCKFONT2 ); SetFontForeground( 6 ); SetFontShadow( DEFAULT_SHADOW ); - + //LABELS swprintf( sTempString, gWeaponStatsDesc[ 0 ], GetWeightUnitString() ); mprintf( gWeaponStats[ 0 ].sX + gsInvDescX, gWeaponStats[ 0 ].sY + gsInvDescY, sTempString ); @@ -3859,7 +4403,7 @@ void RenderItemDescriptionBox( ) } //Status - swprintf( pStr, L"%2d%%", gpItemDescObject->ItemData.Gun.bGunStatus ); + swprintf( pStr, L"%2d%%", (*gpItemDescObject)[gubItemDescStatusIndex]->data.gun.bGunStatus ); FindFontRightCoordinates( (INT16)(gWeaponStats[ 1 ].sX + gsInvDescX + gWeaponStats[ 1 ].sValDx), (INT16)(gWeaponStats[ 1 ].sY + gsInvDescY ), ITEM_STATS_WIDTH ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY); wcscat( pStr, L"%%" ); mprintf( usX, usY, pStr ); @@ -3977,7 +4521,7 @@ void RenderItemDescriptionBox( ) mprintf( gMoneyStats[ 2 ].sX + gsInvDescX, gMoneyStats[ 2 ].sY + gsInvDescY, L"%s", gMoneyStatsDesc[ 2 ] ); } - // Total Amount + // Total Amount SetFontForeground( FONT_WHITE ); swprintf( pStr, L"%d", gRemoveMoney.uiTotalAmount ); InsertCommasForDollarFigure( pStr ); @@ -3986,7 +4530,7 @@ void RenderItemDescriptionBox( ) mprintf( usX, usY, pStr ); SetFontForeground( 6 ); - + // if the player is taking money from their account if( gfAddingMoneyToMercFromPlayersAccount ) { @@ -4027,7 +4571,7 @@ void RenderItemDescriptionBox( ) { SetFontForeground( FONT_FCOLOR_WHITE ); SetFontShadow( DEFAULT_SHADOW ); - swprintf( pStr, L"%ld", gpItemDescObject->ItemData.Money.uiMoneyAmount ); + swprintf( pStr, L"%ld", (*gpItemDescObject)[gubItemDescStatusIndex]->data.money.uiMoneyAmount ); InsertCommasForDollarFigure( pStr ); InsertDollarSignInToString( pStr ); @@ -4063,14 +4607,14 @@ void RenderItemDescriptionBox( ) { // Ammo - print amount //Status - swprintf( pStr, L"%d/%d", gpItemDescObject->ItemData.Ammo.ubShotsLeft[gubItemDescStatusIndex], Magazine[ Item[ gpItemDescObject->usItem ].ubClassIndex ].ubMagSize ); //Pulmu: Correct # of rounds for stacked ammo + swprintf( pStr, L"%d/%d", shotsLeft, Magazine[ Item[ gpItemDescObject->usItem ].ubClassIndex ].ubMagSize ); //Pulmu: Correct # of rounds for stacked ammo FindFontRightCoordinates( (INT16)(gWeaponStats[ 2 ].sX + gsInvDescX + gWeaponStats[ 2 ].sValDx), (INT16)(gWeaponStats[ 2 ].sY + gsInvDescY ), ITEM_STATS_WIDTH ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY); mprintf( usX, usY, pStr ); } else { //Status - swprintf( pStr, L"%2d%%", gpItemDescObject->ItemData.Generic.bStatus[ gubItemDescStatusIndex ] ); + swprintf( pStr, L"%2d%%", status ); FindFontRightCoordinates( (INT16)(gWeaponStats[ 1 ].sX + gsInvDescX + gWeaponStats[ 1 ].sValDx), (INT16)(gWeaponStats[ 1 ].sY + gsInvDescY ), ITEM_STATS_WIDTH ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY); wcscat( pStr, L"%%" ); mprintf( usX, usY, pStr ); @@ -4086,33 +4630,236 @@ void RenderItemDescriptionBox( ) swprintf( pStr, L"%s", sKeyDescriptionStrings[ 1 ] ); mprintf( gWeaponStats[ 4 ].sX + gsInvDescX, gWeaponStats[ 4 ].sY + gsInvDescY + GetFontHeight( BLOCKFONT ) + 2 , pStr ); - + SetFontForeground( 5 ); - GetShortSectorString( ( INT16 ) SECTORX( KeyTable[ gpItemDescObject->ItemData.Key.ubKeyID ].usSectorFound ), ( INT16 ) SECTORY( KeyTable[ gpItemDescObject->ItemData.Key.ubKeyID ].usSectorFound ), sTempString ); + GetShortSectorString( ( INT16 ) SECTORX( KeyTable[ (*gpItemDescObject)[gubItemDescStatusIndex]->data.key.ubKeyID ].usSectorFound ), ( INT16 ) SECTORY( KeyTable[ (*gpItemDescObject)[gubItemDescStatusIndex]->data.key.ubKeyID ].usSectorFound ), sTempString ); swprintf( pStr, L"%s", sTempString ); FindFontRightCoordinates( (INT16)(gWeaponStats[ 4 ].sX + gsInvDescX ), (INT16)(gWeaponStats[ 4 ].sY + gsInvDescY ), 110 ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY); mprintf( usX, usY, pStr ); - swprintf( pStr, L"%d", KeyTable[ gpItemDescObject->ItemData.Key.ubKeyID ].usDateFound ); + swprintf( pStr, L"%d", KeyTable[ (*gpItemDescObject)[gubItemDescStatusIndex]->data.key.ubKeyID ].usDateFound ); FindFontRightCoordinates( (INT16)(gWeaponStats[ 4 ].sX + gsInvDescX ), (INT16)(gWeaponStats[ 4 ].sY + gsInvDescY + GetFontHeight( BLOCKFONT ) + 2 ), 110 ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY); mprintf( usX, usY, pStr ); } - - - + + + //Weight swprintf( pStr, L"%1.1f", fWeight ); FindFontRightCoordinates( (INT16)(gWeaponStats[ 0 ].sX + gsInvDescX + gWeaponStats[ 0 ].sValDx), (INT16)(gWeaponStats[ 0 ].sY + gsInvDescY ), ITEM_STATS_WIDTH ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY); mprintf( usX, usY, pStr ); } - + SetFontShadow( DEFAULT_SHADOW ); } } +// CHRISL: New function to display items stored in an LBENODE +void RenderLBENODEItems( OBJECTTYPE *pObj, int subObject ) +{ + extern int PLAYER_INFO_X; + extern int PLAYER_INFO_Y; + INV_REGIONS LBEInvPocketXY[12]; + SOLDIERTYPE *pSoldier; + OBJECTTYPE *pObject; + INT16 sX, sY; + INT16 sBarX, sBarY; + INT16 lbePocket = ITEM_NOT_FOUND; + UINT32 lClass; + bool activeNode = pObj->IsActiveLBE(subObject); + bool wornItem = false; + + // Start by verifying that this item is an LBENODE + if(Item[pObj->usItem].usItemClass != IC_LBEGEAR || iResolution == 0) + return; + + // Set selected merc + if(guiCurrentItemDescriptionScreen == MAP_SCREEN) + GetSoldier( &pSoldier, gCharactersList[bSelectedInfoChar].usSolID ); + else + pSoldier = gpSMCurrentMerc; + + // Is the object we're looking at currently worn + for(unsigned int x = VESTPOCKPOS; x <= BPACKPOCKPOS; x++) + { + if(pObj == &pSoldier->inv[x]) + { + wornItem = true; + break; + } + } + + LBENODE* pLBE = NULL; + if(activeNode == true) + { + pLBE = pObj->GetLBEPointer(subObject); + lClass = pLBE->lbeClass; + } + else { + lClass = LoadBearingEquipment[Item[pObj->usItem].ubClassIndex].lbeClass; + } + + std::vector pocketKey; + // Setup pocket coords + switch (lClass) + { + case THIGH_PACK: + if(pObj->IsActiveLBE(subObject) == false && pObj == &pSoldier->inv[RTHIGHPOCKPOS]) + GetLBESlots(RTHIGHPOCKPOS, pocketKey); + else + GetLBESlots(LTHIGHPOCKPOS, pocketKey); + if(guiCurrentItemDescriptionScreen == MAP_SCREEN){ + InitInvData(LBEInvPocketXY[0], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 101, PLAYER_INFO_Y + 287); + InitInvData(LBEInvPocketXY[1], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 137, PLAYER_INFO_Y + 287); + InitInvData(LBEInvPocketXY[2], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 101, PLAYER_INFO_Y + 311); + InitInvData(LBEInvPocketXY[3], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 137, PLAYER_INFO_Y + 311); + InitInvData(LBEInvPocketXY[4], FALSE, INV_BAR_DX, INV_BAR_DY, VEST_INV_SLOT_WIDTH, VEST_INV_SLOT_HEIGHT, PLAYER_INFO_X + 112, PLAYER_INFO_Y + 335); + } + else{ + InitInvData(LBEInvPocketXY[0], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 586, INV_INTERFACE_START_Y + 10); + InitInvData(LBEInvPocketXY[1], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 622, INV_INTERFACE_START_Y + 10); + InitInvData(LBEInvPocketXY[2], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 586, INV_INTERFACE_START_Y + 34); + InitInvData(LBEInvPocketXY[3], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 622, INV_INTERFACE_START_Y + 34); + InitInvData(LBEInvPocketXY[4], FALSE, INV_BAR_DX, INV_BAR_DY, VEST_INV_SLOT_WIDTH, VEST_INV_SLOT_HEIGHT, INTERFACE_START_X + 597, INV_INTERFACE_START_Y + 58); + } + InitInvData(LBEInvPocketXY[5], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); + InitInvData(LBEInvPocketXY[6], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); + InitInvData(LBEInvPocketXY[7], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); + InitInvData(LBEInvPocketXY[8], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); + InitInvData(LBEInvPocketXY[9], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); + InitInvData(LBEInvPocketXY[10], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); + InitInvData(LBEInvPocketXY[11], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); + break; + case VEST_PACK: + GetLBESlots(VESTPOCKPOS, pocketKey); + if(guiCurrentItemDescriptionScreen == MAP_SCREEN){ + InitInvData(LBEInvPocketXY[0], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 22, PLAYER_INFO_Y + 299); + InitInvData(LBEInvPocketXY[1], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 58, PLAYER_INFO_Y + 299); + InitInvData(LBEInvPocketXY[2], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 94, PLAYER_INFO_Y + 299); + InitInvData(LBEInvPocketXY[3], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 130, PLAYER_INFO_Y + 299); + InitInvData(LBEInvPocketXY[4], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 166, PLAYER_INFO_Y + 299); + InitInvData(LBEInvPocketXY[5], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 22, PLAYER_INFO_Y + 323); + InitInvData(LBEInvPocketXY[6], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 58, PLAYER_INFO_Y + 323); + InitInvData(LBEInvPocketXY[7], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 94, PLAYER_INFO_Y + 323); + InitInvData(LBEInvPocketXY[8], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 130, PLAYER_INFO_Y + 323); + InitInvData(LBEInvPocketXY[9], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 166, PLAYER_INFO_Y + 323); + InitInvData(LBEInvPocketXY[10], FALSE, INV_BAR_DX, INV_BAR_DY, VEST_INV_SLOT_WIDTH, VEST_INV_SLOT_HEIGHT, PLAYER_INFO_X + 202, PLAYER_INFO_Y + 299); + InitInvData(LBEInvPocketXY[11], FALSE, INV_BAR_DX, INV_BAR_DY, VEST_INV_SLOT_WIDTH, VEST_INV_SLOT_HEIGHT, PLAYER_INFO_X + 202, PLAYER_INFO_Y + 323); + } + else{ + InitInvData(LBEInvPocketXY[0], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 269, INV_INTERFACE_START_Y + 139); + InitInvData(LBEInvPocketXY[1], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 305, INV_INTERFACE_START_Y + 139); + InitInvData(LBEInvPocketXY[2], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 341, INV_INTERFACE_START_Y + 139); + InitInvData(LBEInvPocketXY[3], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 377, INV_INTERFACE_START_Y + 139); + InitInvData(LBEInvPocketXY[4], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 413, INV_INTERFACE_START_Y + 139); + InitInvData(LBEInvPocketXY[5], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 269, INV_INTERFACE_START_Y + 163); + InitInvData(LBEInvPocketXY[6], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 305, INV_INTERFACE_START_Y + 163); + InitInvData(LBEInvPocketXY[7], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 341, INV_INTERFACE_START_Y + 163); + InitInvData(LBEInvPocketXY[8], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 377, INV_INTERFACE_START_Y + 163); + InitInvData(LBEInvPocketXY[9], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 413, INV_INTERFACE_START_Y + 163); + InitInvData(LBEInvPocketXY[10], FALSE, INV_BAR_DX, INV_BAR_DY, VEST_INV_SLOT_WIDTH, VEST_INV_SLOT_HEIGHT, INTERFACE_START_X + 449, INV_INTERFACE_START_Y + 139); + InitInvData(LBEInvPocketXY[11], FALSE, INV_BAR_DX, INV_BAR_DY, VEST_INV_SLOT_WIDTH, VEST_INV_SLOT_HEIGHT, INTERFACE_START_X + 449, INV_INTERFACE_START_Y + 163); + } + break; + case COMBAT_PACK: + GetLBESlots(CPACKPOCKPOS, pocketKey); + if(guiCurrentItemDescriptionScreen == MAP_SCREEN){ + InitInvData(LBEInvPocketXY[0], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 101, PLAYER_INFO_Y + 287); + InitInvData(LBEInvPocketXY[1], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 137, PLAYER_INFO_Y + 287); + InitInvData(LBEInvPocketXY[2], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 101, PLAYER_INFO_Y + 311); + InitInvData(LBEInvPocketXY[3], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 137, PLAYER_INFO_Y + 311); + InitInvData(LBEInvPocketXY[4], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, PLAYER_INFO_X + 104, PLAYER_INFO_Y + 335); + InitInvData(LBEInvPocketXY[5], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, PLAYER_INFO_X + 104, PLAYER_INFO_Y + 359); + InitInvData(LBEInvPocketXY[6], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, PLAYER_INFO_X + 104, PLAYER_INFO_Y + 383); + } + else{ + InitInvData(LBEInvPocketXY[0], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 585, INV_INTERFACE_START_Y + 10); + InitInvData(LBEInvPocketXY[1], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 621, INV_INTERFACE_START_Y + 10); + InitInvData(LBEInvPocketXY[2], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 585, INV_INTERFACE_START_Y + 34); + InitInvData(LBEInvPocketXY[3], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 621, INV_INTERFACE_START_Y + 34); + InitInvData(LBEInvPocketXY[4], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, INTERFACE_START_X + 657, INV_INTERFACE_START_Y + 10); + InitInvData(LBEInvPocketXY[5], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, INTERFACE_START_X + 657, INV_INTERFACE_START_Y + 34); + InitInvData(LBEInvPocketXY[6], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, INTERFACE_START_X + 657, INV_INTERFACE_START_Y + 58); + } + InitInvData(LBEInvPocketXY[7], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); + InitInvData(LBEInvPocketXY[8], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); + InitInvData(LBEInvPocketXY[9], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); + InitInvData(LBEInvPocketXY[10], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); + InitInvData(LBEInvPocketXY[11], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, 0, 0); + break; + case BACKPACK: + GetLBESlots(BPACKPOCKPOS, pocketKey); + if(guiCurrentItemDescriptionScreen == MAP_SCREEN){ + InitInvData(LBEInvPocketXY[0], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 68, PLAYER_INFO_Y + 275); + InitInvData(LBEInvPocketXY[1], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 68, PLAYER_INFO_Y + 299); + InitInvData(LBEInvPocketXY[2], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 68, PLAYER_INFO_Y + 323); + InitInvData(LBEInvPocketXY[3], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 68, PLAYER_INFO_Y + 347); + InitInvData(LBEInvPocketXY[4], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 104, PLAYER_INFO_Y + 275); + InitInvData(LBEInvPocketXY[5], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 104, PLAYER_INFO_Y + 299); + InitInvData(LBEInvPocketXY[6], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 104, PLAYER_INFO_Y + 323); + InitInvData(LBEInvPocketXY[7], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, PLAYER_INFO_X + 104, PLAYER_INFO_Y + 347); + InitInvData(LBEInvPocketXY[8], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, PLAYER_INFO_X + 140, PLAYER_INFO_Y + 275); + InitInvData(LBEInvPocketXY[9], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, PLAYER_INFO_X + 140, PLAYER_INFO_Y + 299); + InitInvData(LBEInvPocketXY[10], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, PLAYER_INFO_X + 140, PLAYER_INFO_Y + 323); + InitInvData(LBEInvPocketXY[11], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, PLAYER_INFO_X + 140, PLAYER_INFO_Y + 347); + } + else{ + InitInvData(LBEInvPocketXY[0], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 585, INV_INTERFACE_START_Y + 10); + InitInvData(LBEInvPocketXY[1], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 585, INV_INTERFACE_START_Y + 34); + InitInvData(LBEInvPocketXY[2], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 585, INV_INTERFACE_START_Y + 58); + InitInvData(LBEInvPocketXY[3], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 585, INV_INTERFACE_START_Y + 82); + InitInvData(LBEInvPocketXY[4], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 621, INV_INTERFACE_START_Y + 10); + InitInvData(LBEInvPocketXY[5], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 621, INV_INTERFACE_START_Y + 34); + InitInvData(LBEInvPocketXY[6], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 621, INV_INTERFACE_START_Y + 58); + InitInvData(LBEInvPocketXY[7], FALSE, INV_BAR_DX, INV_BAR_DY, SM_INV_SLOT_WIDTH, SM_INV_SLOT_HEIGHT, INTERFACE_START_X + 621, INV_INTERFACE_START_Y + 82); + InitInvData(LBEInvPocketXY[8], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, INTERFACE_START_X + 657, INV_INTERFACE_START_Y + 10); + InitInvData(LBEInvPocketXY[9], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, INTERFACE_START_X + 657, INV_INTERFACE_START_Y + 34); + InitInvData(LBEInvPocketXY[10], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, INTERFACE_START_X + 657, INV_INTERFACE_START_Y + 58); + InitInvData(LBEInvPocketXY[11], TRUE, INV_BAR_DX, INV_BAR_DY, BIG_INV_SLOT_WIDTH, BIG_INV_SLOT_HEIGHT, INTERFACE_START_X + 657, INV_INTERFACE_START_Y + 82); + } + break; + default: + break; + } + // Display contents of LBENODE + for(unsigned int cnt=0; cntusItem].ubClassIndex].lbePocketIndex[icPocket[pocketKey[cnt]]]; + pObject = NULL; + if(wornItem == true) + { + if(pSoldier->inv[pocketKey[cnt]].exists() == true) + pObject = &(pSoldier->inv[pocketKey[cnt]]); + } + else if(activeNode == true) + { + if(pLBE->inv[cnt].exists() == true) + pObject = &pLBE->inv[cnt]; + } + if(lbePocket == 0){ // Deactivate Pocket + DrawHatchOnInventory( guiSAVEBUFFER, sX, sY, (UINT16)(LBEInvPocketXY[cnt].sWidth-1), (UINT16)(LBEInvPocketXY[cnt].sHeight-1), 0 ); + } + else if(pObject == NULL){ // Nothing in sPocket. Display silouhette. + INVRenderSilhouette( guiSAVEBUFFER, lbePocket, 0, sX, sY, LBEInvPocketXY[cnt].sWidth, LBEInvPocketXY[cnt].sHeight); + } + else if(pObject != NULL){ + INVRenderItem( guiSAVEBUFFER, pSoldier, pObject, sX, sY, LBEInvPocketXY[cnt].sWidth, LBEInvPocketXY[cnt].sHeight, 2, NULL, 0, 0, 0 ); + sBarX = sX - LBEInvPocketXY[cnt].sBarDx; + sBarY = sY + LBEInvPocketXY[cnt].sBarDy; + DrawItemUIBarEx( pObject, 0, sBarX, sBarY, ITEM_BAR_WIDTH, ITEM_BAR_HEIGHT, Get16BPPColor( STATUS_BAR ), Get16BPPColor( STATUS_BAR_SHADOW ), TRUE , guiSAVEBUFFER); + } +// if (gpItemPointer != NULL) +// RenderPocketItemCapacity( ItemSlotLimit(gpItemPointer, pocketKey[cnt], pSoldier), pocketKey[cnt], pSoldier); + //CHRISL: Remove this line for now. Though we do need something to better show that pockets on this screen are read-only + //ShadowVideoSurfaceRect(guiSAVEBUFFER,sX,sY,(gSMInvData[ pocketKey[cnt] ].sWidth+sX),(gSMInvData[ pocketKey[cnt] ].sHeight+sY)); + } +} + void HandleItemDescriptionBox( BOOLEAN *pfDirty ) { if ( fItemDescDelete ) @@ -4127,9 +4874,7 @@ void HandleItemDescriptionBox( BOOLEAN *pfDirty ) void DeleteItemDescriptionBox( ) { - INT32 cnt, cnt2; - BOOLEAN fFound, fAllFound; - UINT8 ubAPCost = 0; + INT32 cnt; if( gfInItemDescBox == FALSE ) { @@ -4149,66 +4894,45 @@ void DeleteItemDescriptionBox( ) { if (gpAttachSoldier) { - // check for change in attachments, starting with removed attachments - fAllFound = TRUE; - for ( cnt = 0; cnt < MAX_ATTACHMENTS; cnt++ ) - { - if ( gusOriginalAttachItem[ cnt ] != NOTHING ) - { - fFound = FALSE; - for ( cnt2 = 0; cnt2 < MAX_ATTACHMENTS; cnt2++ ) - { - if ( (gusOriginalAttachItem[ cnt ] == gpItemDescObject->usAttachItem[ cnt2 ]) && (gpItemDescObject->bAttachStatus[ cnt2 ] == gbOriginalAttachStatus[ cnt ]) ) - { - fFound = TRUE; - } - } - if (!fFound) - { - // charge APs - ubAPCost = AttachmentAPCost(gusOriginalAttachItem[ cnt ],gpItemDescObject->usItem); - fAllFound = FALSE; + UINT8 ubAPCost = 0; + + // check for change in attachments + unsigned int originalSize = gOriginalAttachments.size(); + unsigned int newSize = (*gpItemDescObject)[0]->attachments.size(); + + if (newSize != originalSize) { + attachmentList::iterator originalIter; + attachmentList::iterator newIter; + //an attachment was changed, find the change + for (originalIter = gOriginalAttachments.begin(), newIter = (*gpItemDescObject)[0]->attachments.begin(); + originalIter != gOriginalAttachments.end() && newIter != (*gpItemDescObject)[0]->attachments.end(); + ++originalIter, ++newIter) { + if (*originalIter == *newIter) { + continue; + } + else { break; } } - } - - if (fAllFound) - { - // nothing was removed; search for attachment added - for ( cnt = 0; cnt < MAX_ATTACHMENTS; cnt++ ) - { - if ( gpItemDescObject->usAttachItem[ cnt ] != NOTHING ) + if (newSize < originalSize) { + //an attachment was removed, charge APs + ubAPCost = AttachmentAPCost(originalIter->usItem,gpItemDescObject->usItem); + } + else { + //an attachment was added charge APs + //lalien: changed to charge AP's for reloading a GL/RL + if ( Item[ gpItemDescObject->usItem ].usItemClass == IC_LAUNCHER || Item[gpItemDescObject->usItem].cannon ) { - fFound = FALSE; - for ( cnt2 = 0; cnt2 < MAX_ATTACHMENTS; cnt2++ ) - { - if ( (gpItemDescObject->usAttachItem[ cnt ] == gusOriginalAttachItem[ cnt2 ]) && (gbOriginalAttachStatus[ cnt2 ] == gpItemDescObject->bAttachStatus[ cnt ]) ) - { - fFound = TRUE; - } - } - if (!fFound) - { - // charge APs - //lalien: changed to charge AP's for reloading a GL/RL - if ( Item[ gpItemDescObject->usItem ].usItemClass == IC_LAUNCHER || Item[gpItemDescObject->usItem].cannon ) - { - ubAPCost = GetAPsToReload( gpItemDescObject ); - } - else - { - ubAPCost = AttachmentAPCost(gpItemDescObject->usAttachItem[ cnt ],gpItemDescObject->usItem); - } - - fAllFound = FALSE; - break; - } + ubAPCost = GetAPsToReload( gpItemDescObject ); + } + else + { + ubAPCost = AttachmentAPCost(newIter->usItem,gpItemDescObject->usItem); } } } - if (!fAllFound) + if (ubAPCost) { DeductPoints( gpAttachSoldier, ubAPCost, 0 ); } @@ -4217,7 +4941,10 @@ void DeleteItemDescriptionBox( ) //Remove DeleteVideoObjectFromIndex( guiItemDescBox ); + if(UsingNewInventorySystem() == true && guiItemDescBoxBackground != 0) + DeleteVideoObjectFromIndex( guiItemDescBoxBackground ); DeleteVideoObjectFromIndex( guiMapItemDescBox ); + RenderBackpackButtons(0); /* CHRISL: Needed for new inventory backpack buttons */ DeleteVideoObjectFromIndex( guiBullet ); // Delete item graphic DeleteVideoObjectFromIndex( guiItemGraphic ); @@ -4233,8 +4960,8 @@ void DeleteItemDescriptionBox( ) // Remove region MSYS_RemoveRegion( &gInvDesc); - - + + if( gpItemDescObject->usItem != MONEY ) { for ( cnt = 0; cnt < MAX_ATTACHMENTS; cnt++ ) @@ -4291,7 +5018,7 @@ void DeleteItemDescriptionBox( ) if( gRemoveMoney.uiMoneyRemaining == 0 && !gfAddingMoneyToMercFromPlayersAccount ) { //get rid of the money in the slot - memset( gpItemDescObject, 0, sizeof( OBJECTTYPE ) ); + gpItemDescObject->initialize(); gpItemDescObject = NULL; } } @@ -4300,6 +5027,7 @@ void DeleteItemDescriptionBox( ) gfAddingMoneyToMercFromPlayersAccount = FALSE; gfItemDescObjectIsAttachment = FALSE; + gpItemDescObject = NULL; } @@ -4314,7 +5042,7 @@ void InternalBeginItemPointer( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject, INT8 } // Copy into cursor... - memcpy( &gItemPointer, pObject, sizeof( OBJECTTYPE ) ); + gItemPointer = *pObject; // Dirty interface fInterfacePanelDirty = DIRTYLEVEL2; @@ -4335,24 +5063,29 @@ void InternalBeginItemPointer( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject, INT8 void BeginItemPointer( SOLDIERTYPE *pSoldier, UINT8 ubHandPos ) { - BOOLEAN fOk; - OBJECTTYPE pObject; - - memset( &pObject, 0, sizeof( OBJECTTYPE ) ); - + int numToMove = 0; if (_KeyDown( SHIFT )) { // Remove all from soldier's slot - fOk = RemoveObjectFromSlot( pSoldier, ubHandPos, &pObject ); + numToMove = ALL_OBJECTS; } else { - GetObjFrom( &(pSoldier->inv[ubHandPos]), 0, &pObject ); - fOk = (pObject.ubNumberOfObjects == 1); + numToMove = 1; } - if (fOk) + pSoldier->inv[ubHandPos].MoveThisObjectTo(gTempObject, numToMove, pSoldier, ubHandPos); + + if ( gTempObject.exists() == false ) { - InternalBeginItemPointer( pSoldier, &pObject, ubHandPos ); + //oops, the move failed. It might have failed because the object was force placed + //to a slot where the ItemSizeLimit is 0, try again + //this method won't work with LBEs in LBE pockets + pSoldier->inv[ubHandPos].MoveThisObjectTo(gTempObject, numToMove); + } + + if ( gTempObject.exists() == true ) + { + InternalBeginItemPointer( pSoldier, &gTempObject, ubHandPos ); } } @@ -4378,7 +5111,7 @@ void BeginKeyRingItemPointer( SOLDIERTYPE *pSoldier, UINT8 ubKeyRingPosition ) fOk = (gItemPointer.ubNumberOfObjects == 1); } - + if (fOk) { // ATE: Look if we are a BLOODIED KNIFE, and change if so, making guy scream... @@ -4390,12 +5123,12 @@ void BeginKeyRingItemPointer( SOLDIERTYPE *pSoldier, UINT8 ubKeyRingPosition ) gbItemPointerSrcSlot = ubKeyRingPosition; if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) - { + { guiExternVo = GetInterfaceGraphicForItem( &(Item[ gpItemPointer->usItem ]) ); gusExternVoSubIndex = Item[ gpItemPointer->usItem ].ubGraphicNum; fMapInventoryItem=TRUE; - MSYS_ChangeRegionCursor( &gMPanelRegion , EXTERN_CURSOR ); + MSYS_ChangeRegionCursor( &gMPanelRegion , EXTERN_CURSOR ); MSYS_SetCurrentCursor( EXTERN_CURSOR ); } } @@ -4404,7 +5137,7 @@ void BeginKeyRingItemPointer( SOLDIERTYPE *pSoldier, UINT8 ubKeyRingPosition ) //Debug mesg } - + gfItemPointerDifferentThanDefault = FALSE; } @@ -4415,12 +5148,12 @@ void EndItemPointer( ) { gpItemPointer = NULL; gbItemPointerSrcSlot = NO_SLOT; - MSYS_ChangeRegionCursor( &gSMPanelRegion , CURSOR_NORMAL ); + MSYS_ChangeRegionCursor( &gSMPanelRegion , CURSOR_NORMAL ); MSYS_SetCurrentCursor( CURSOR_NORMAL ); if( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) { - memset( &gMoveingItem, 0, sizeof( INVENTORY_IN_SLOT ) ); + gMoveingItem.initialize(); SetSkiCursor( CURSOR_NORMAL ); } else @@ -4444,7 +5177,7 @@ void DrawItemFreeCursor( ) guiExternVo = GetInterfaceGraphicForItem( &(Item[ gpItemPointer->usItem ]) ); gusExternVoSubIndex = Item[ gpItemPointer->usItem ].ubGraphicNum; - MSYS_ChangeRegionCursor( &gSMPanelRegion , EXTERN_CURSOR ); + MSYS_ChangeRegionCursor( &gSMPanelRegion , EXTERN_CURSOR ); MSYS_SetCurrentCursor( EXTERN_CURSOR ); } @@ -4464,7 +5197,7 @@ BOOLEAN SoldierCanSeeCatchComing( SOLDIERTYPE *pSoldier, INT16 sSrcGridNo ) bTargetDirection = (INT8)GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, sSrcGridNo ); // Look 3 directions Clockwise from what we are facing.... - bDirection = pSoldier->ubDirection; + bDirection = pSoldier->bDirection; for ( cnt = 0; cnt < 3; cnt++ ) { @@ -4477,7 +5210,7 @@ BOOLEAN SoldierCanSeeCatchComing( SOLDIERTYPE *pSoldier, INT16 sSrcGridNo ) } // Look 3 directions CounterClockwise from what we are facing.... - bDirection = pSoldier->ubDirection; + bDirection = pSoldier->bDirection; for ( cnt = 0; cnt < 3; cnt++ ) { @@ -4497,7 +5230,7 @@ BOOLEAN SoldierCanSeeCatchComing( SOLDIERTYPE *pSoldier, INT16 sSrcGridNo ) void DrawItemTileCursor( ) { - UINT16 usMapPos; + INT16 sMapPos; UINT16 usIndex; UINT8 ubSoldierID; INT16 sAPCost; @@ -4513,17 +5246,17 @@ void DrawItemTileCursor( ) static UINT16 usOldMousePos = 0; INT16 sEndZ = 0; INT16 sDist; - INT8 bLevel; + INT8 bLevel; - if (GetMouseMapPos( &usMapPos) ) + if (GetMouseMapPos( &sMapPos) ) { if ( gfUIFullTargetFound ) { // Force mouse position to guy... - usMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; + sMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; } - gusCurMousePos = usMapPos; + gusCurMousePos = sMapPos; if( gusCurMousePos != usOldMousePos ) { @@ -4585,8 +5318,8 @@ void DrawItemTileCursor( ) } if ( !fGiveItem ) - { - if ( UIHandleOnMerc( FALSE ) && usMapPos != gpItemPointerSoldier->sGridNo ) + { + if ( UIHandleOnMerc( FALSE ) && sMapPos != gpItemPointerSoldier->sGridNo ) { // We are on a guy.. check if they can catch or not.... if ( gfUIFullTargetFound ) @@ -4596,7 +5329,7 @@ void DrawItemTileCursor( ) // Are they on our team? // ATE: Can't be an EPC - if ( pSoldier->bTeam == gbPlayerNum && !AM_AN_EPC( pSoldier ) && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( pSoldier->bTeam == gbPlayerNum && !AM_AN_EPC( pSoldier ) && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { if ( sDist <= PASSING_ITEM_DISTANCE_OKLIFE ) { @@ -4648,7 +5381,7 @@ void DrawItemTileCursor( ) gubUIValidCatcherID = (UINT8)gusUIFullTargetID; // If this is a robot, change to say 'reload' - if ( MercPtrs[ gusUIFullTargetID ]->uiStatusFlags & SOLDIER_ROBOT ) + if ( MercPtrs[ gusUIFullTargetID ]->flags.uiStatusFlags & SOLDIER_ROBOT ) { gfUIMouseOnValidCatcher = 3; } @@ -4661,14 +5394,14 @@ void DrawItemTileCursor( ) { sActionGridNo = gusCurMousePos; } - + // Display location... gsUIHandleShowMoveGridLocation = sActionGridNo; gfUIHandleShowMoveGrid = TRUE; // Get AP cost - if ( MercPtrs[ gusUIFullTargetID ]->uiStatusFlags & SOLDIER_ROBOT ) + if ( MercPtrs[ gusUIFullTargetID ]->flags.uiStatusFlags & SOLDIER_ROBOT ) { sAPCost = GetAPsToReloadRobot( gpItemPointerSoldier, MercPtrs[ gusUIFullTargetID ] ); } @@ -4679,7 +5412,7 @@ void DrawItemTileCursor( ) gsCurrentActionPoints = sAPCost; } - + // Set value if ( gTacticalStatus.uiFlags & INCOMBAT ) { @@ -4688,7 +5421,7 @@ void DrawItemTileCursor( ) gUIDisplayActionPointsOffY = 15; } } - } + } if ( fGiveItem ) @@ -4701,14 +5434,14 @@ void DrawItemTileCursor( ) if ( sDist <= 1 && gfUIMouseOnValidCatcher == 0 ) { // OK, we want to drop..... - + // Write the word 'drop' on cursor... wcscpy( gzIntTileLocation, pMessageStrings[ MSG_DROP ] ); - gfUIIntTileLocation = TRUE; + gfUIIntTileLocation = TRUE; } else { - if ( usMapPos == gpItemPointerSoldier->sGridNo ) + if ( sMapPos == gpItemPointerSoldier->sGridNo ) { EndPhysicsTrajectoryUI( ); } @@ -4723,19 +5456,19 @@ void DrawItemTileCursor( ) if ( gfUIMouseOnValidCatcher == 0 ) { wcscpy( gzIntTileLocation, pMessageStrings[ MSG_THROW ] ); - gfUIIntTileLocation = TRUE; + gfUIIntTileLocation = TRUE; } gfUIHandlePhysicsTrajectory = TRUE; - if ( fRecalc && usMapPos != gpItemPointerSoldier->sGridNo ) + if ( fRecalc && sMapPos != gpItemPointerSoldier->sGridNo ) { if ( gfUIMouseOnValidCatcher ) { switch( gAnimControl[ MercPtrs[ gubUIValidCatcherID ]->usAnimState ].ubHeight ) { case ANIM_STAND: - + sEndZ = 150; break; @@ -4750,14 +5483,14 @@ void DrawItemTileCursor( ) break; } - if ( MercPtrs[ gubUIValidCatcherID ]->bLevel > 0 ) + if ( MercPtrs[ gubUIValidCatcherID ]->pathing.bLevel > 0 ) { sEndZ = 0; } } // Calculate chance to throw here..... - if ( !CalculateLaunchItemChanceToGetThrough( gpItemPointerSoldier, gpItemPointer, usMapPos, (INT8)gsInterfaceLevel, (INT16)( ( gsInterfaceLevel * 256 ) + sEndZ ), &sFinalGridNo, FALSE, &bLevel, TRUE ) ) + if ( !CalculateLaunchItemChanceToGetThrough( gpItemPointerSoldier, gpItemPointer, sMapPos, (INT8)gsInterfaceLevel, (INT16)( ( gsInterfaceLevel * 256 ) + sEndZ ), &sFinalGridNo, FALSE, &bLevel, TRUE ) ) { gfBadThrowItemCTGH = TRUE; } @@ -4778,7 +5511,7 @@ void DrawItemTileCursor( ) } //Erase any cursor in viewport - //MSYS_ChangeRegionCursor( &gViewportRegion , VIDEO_NO_CURSOR ); + //MSYS_ChangeRegionCursor( &gViewportRegion , VIDEO_NO_CURSOR ); // Get tile graphic fro item usIndex = GetTileGraphicForItem( &(Item[ gpItemPointer->usItem ]) ); @@ -4793,7 +5526,7 @@ void DrawItemTileCursor( ) } - MSYS_ChangeRegionCursor( &gViewportRegion , (UINT16)uiCursorId ); + MSYS_ChangeRegionCursor( &gViewportRegion , (UINT16)uiCursorId ); } } @@ -4813,23 +5546,9 @@ BOOLEAN IsValidAmmoToReloadRobot( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject ) } -BOOLEAN HandleItemPointerClick( UINT16 usMapPos ) +BOOLEAN HandleItemPointerClick( INT16 sMapPos ) { // Determine what to do - UINT8 ubDirection; - UINT8 ubSoldierID; - UINT16 usItem; - INT16 sAPCost; - SOLDIERTYPE *pSoldier=NULL; - UINT8 ubThrowActionCode=0; - UINT32 uiThrowActionData=0; - INT16 sEndZ = 0; - BOOLEAN fGiveItem = FALSE; - OBJECTTYPE TempObject; - INT16 sGridNo; - INT16 sDist; - - if ( SelectedGuyInBusyAnimation( ) ) { return( FALSE ); @@ -4842,7 +5561,7 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos ) } // Don't allow if our soldier is a # of things... - if ( AM_AN_EPC( gpItemPointerSoldier ) || gpItemPointerSoldier->bLife < OKLIFE || MercInDeepWater( gpItemPointerSoldier) ) + if ( AM_AN_EPC( gpItemPointerSoldier ) || gpItemPointerSoldier->stats.bLife < OKLIFE || gpItemPointerSoldier->MercInDeepWater( ) ) { return( FALSE ); } @@ -4855,10 +5574,22 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos ) } + UINT8 ubDirection; + UINT8 ubSoldierID; + UINT16 usItem; + INT16 sAPCost; + SOLDIERTYPE *pSoldier=NULL; + UINT8 ubThrowActionCode=0; + UINT32 uiThrowActionData=0; + INT16 sEndZ = 0; + BOOLEAN fGiveItem = FALSE; + INT16 sGridNo; + INT16 sDist; + if ( gfUIFullTargetFound ) { // Force mouse position to guy... - usMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; + sMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; if ( gAnimControl[ MercPtrs[ gusUIFullTargetID ]->usAnimState ].uiFlags & ANIM_MOVING ) { @@ -4907,8 +5638,8 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos ) { usItem = gpItemPointer->usItem; - // If the target is a robot, - if ( MercPtrs[ ubSoldierID ]->uiStatusFlags & SOLDIER_ROBOT ) + // If the target is a robot, + if ( MercPtrs[ ubSoldierID ]->flags.uiStatusFlags & SOLDIER_ROBOT ) { // Charge APs to reload robot! sAPCost = GetAPsToReloadRobot( gpItemPointerSoldier, MercPtrs[ ubSoldierID ] ); @@ -4916,12 +5647,12 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos ) else { // Calculate action point costs! - sAPCost = GetAPsToGiveItem( gpItemPointerSoldier, usMapPos ); + sAPCost = GetAPsToGiveItem( gpItemPointerSoldier, sMapPos ); } // Place it back in our hands! - memcpy( &TempObject, gpItemPointer, sizeof( OBJECTTYPE ) ); + gTempObject = *gpItemPointer; if ( gbItemPointerSrcSlot != NO_SLOT ) { @@ -4947,45 +5678,44 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos ) if ( EnoughPoints( gpItemPointerSoldier, sAPCost, 0, TRUE ) ) { // If we are a robot, check if this is proper item to reload! - if ( MercPtrs[ ubSoldierID ]->uiStatusFlags & SOLDIER_ROBOT ) + if ( MercPtrs[ ubSoldierID ]->flags.uiStatusFlags & SOLDIER_ROBOT ) { // Check if we can reload robot.... - if ( IsValidAmmoToReloadRobot( MercPtrs[ ubSoldierID ], &TempObject ) ) + if ( IsValidAmmoToReloadRobot( MercPtrs[ ubSoldierID ], &gTempObject ) ) { INT16 sActionGridNo; UINT8 ubDirection; INT16 sAdjustedGridNo; - + // Walk up to him and reload! - // See if we can get there to stab + // See if we can get there to stab sActionGridNo = FindAdjacentGridEx( gpItemPointerSoldier, MercPtrs[ ubSoldierID ]->sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); if ( sActionGridNo != -1 && gbItemPointerSrcSlot != NO_SLOT ) { // Make a temp object for ammo... - gpItemPointerSoldier->pTempObject = (OBJECTTYPE *) MemAlloc( sizeof( OBJECTTYPE ) ); - memcpy( gpItemPointerSoldier->pTempObject, &TempObject, sizeof( OBJECTTYPE ) ); - + OBJECTTYPE::CopyToOrCreateAt( &gpItemPointerSoldier->pTempObject, &gTempObject); + // Remove from soldier's inv... - RemoveObjs( &( gpItemPointerSoldier->inv[ gbItemPointerSrcSlot ] ), 1 ); - - gpItemPointerSoldier->sPendingActionData2 = sAdjustedGridNo; - gpItemPointerSoldier->uiPendingActionData1 = gbItemPointerSrcSlot; - gpItemPointerSoldier->bPendingActionData3 = ubDirection; - gpItemPointerSoldier->ubPendingActionAnimCount = 0; + gpItemPointerSoldier->inv[ gbItemPointerSrcSlot ].RemoveObjectsFromStack(1); + + gpItemPointerSoldier->aiData.sPendingActionData2 = sAdjustedGridNo; + gpItemPointerSoldier->aiData.uiPendingActionData1 = gbItemPointerSrcSlot; + gpItemPointerSoldier->aiData.bPendingActionData3 = ubDirection; + gpItemPointerSoldier->aiData.ubPendingActionAnimCount = 0; // CHECK IF WE ARE AT THIS GRIDNO NOW if ( gpItemPointerSoldier->sGridNo != sActionGridNo ) { // SEND PENDING ACTION - gpItemPointerSoldier->ubPendingAction = MERC_RELOADROBOT; + gpItemPointerSoldier->aiData.ubPendingAction = MERC_RELOADROBOT; // WALK UP TO DEST FIRST - EVENT_InternalGetNewSoldierPath( gpItemPointerSoldier, sActionGridNo, gpItemPointerSoldier->usUIMovementMode, FALSE, FALSE ); + gpItemPointerSoldier->EVENT_InternalGetNewSoldierPath( sActionGridNo, gpItemPointerSoldier->usUIMovementMode, FALSE, FALSE ); } else { - EVENT_SoldierBeginReloadRobot( gpItemPointerSoldier, sAdjustedGridNo, ubDirection, gbItemPointerSrcSlot ); + gpItemPointerSoldier->EVENT_SoldierBeginReloadRobot( sAdjustedGridNo, ubDirection, gbItemPointerSrcSlot ); } // OK, set UI @@ -4995,14 +5725,14 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos ) } gfDontChargeAPsToPickup = FALSE; - EndItemPointer( ); + EndItemPointer( ); } else { //if (gbItemPointerSrcSlot != NO_SLOT ) { // Give guy this item..... - SoldierGiveItem( gpItemPointerSoldier, MercPtrs[ ubSoldierID ], &TempObject, gbItemPointerSrcSlot ); + SoldierGiveItem( gpItemPointerSoldier, MercPtrs[ ubSoldierID ], &gTempObject, gbItemPointerSrcSlot ); gfDontChargeAPsToPickup = FALSE; EndItemPointer( ); @@ -5028,7 +5758,7 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos ) { // Check some things here.... // 1 ) are we at the exact gridno that we stand on? - if ( usMapPos == gpItemPointerSoldier->sGridNo ) + if ( sMapPos == gpItemPointerSoldier->sGridNo ) { // Drop if ( !gfDontChargeAPsToPickup ) @@ -5044,7 +5774,7 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos ) // Try to drop in an adjacent area.... // 1 ) is this not a good OK destination // this will sound strange, but this is OK...... - if ( !NewOKDestination( gpItemPointerSoldier, usMapPos, FALSE, gpItemPointerSoldier->bLevel ) || FindBestPath( gpItemPointerSoldier, usMapPos, gpItemPointerSoldier->bLevel, WALKING, NO_COPYROUTE, 0 ) == 1 ) + if ( !NewOKDestination( gpItemPointerSoldier, sMapPos, FALSE, gpItemPointerSoldier->pathing.bLevel ) || FindBestPath( gpItemPointerSoldier, sMapPos, gpItemPointerSoldier->pathing.bLevel, WALKING, NO_COPYROUTE, 0 ) == 1 ) { // Drop if ( !gfDontChargeAPsToPickup ) @@ -5062,23 +5792,22 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos ) { case ANIM_STAND: - gpItemPointerSoldier->pTempObject = (OBJECTTYPE *) MemAlloc( sizeof( OBJECTTYPE ) ); + OBJECTTYPE::CopyToOrCreateAt( &gpItemPointerSoldier->pTempObject, gpItemPointer); if (gpItemPointerSoldier->pTempObject != NULL) { - memcpy( gpItemPointerSoldier->pTempObject, gpItemPointer, sizeof( OBJECTTYPE ) ); - gpItemPointerSoldier->sPendingActionData2 = usMapPos; + gpItemPointerSoldier->aiData.sPendingActionData2 = sMapPos; - // Turn towards.....gridno - EVENT_SetSoldierDesiredDirection( gpItemPointerSoldier, (INT8)GetDirectionFromGridNo( usMapPos, gpItemPointerSoldier ) ); + // Turn towards.....gridno + gpItemPointerSoldier->EVENT_SetSoldierDesiredDirection( (INT8)GetDirectionFromGridNo( sMapPos, gpItemPointerSoldier ) ); - EVENT_InitNewSoldierAnim( gpItemPointerSoldier, DROP_ADJACENT_OBJECT, 0 , FALSE ); + gpItemPointerSoldier->EVENT_InitNewSoldierAnim( DROP_ADJACENT_OBJECT, 0 , FALSE ); } break; - + case ANIM_CROUCH: case ANIM_PRONE: - AddItemToPool( usMapPos, gpItemPointer, 1, gpItemPointerSoldier->bLevel, 0 , -1 ); + AddItemToPool( sMapPos, gpItemPointer, 1, gpItemPointerSoldier->pathing.bLevel, 0 , -1 ); NotifySoldiersToLookforItems( ); break; } @@ -5098,13 +5827,13 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos ) } else { - sGridNo = usMapPos; + sGridNo = sMapPos; // Kaiden: Vehicle Inventory change - Commented the following If test: - //if ( sDist <= PASSING_ITEM_DISTANCE_OKLIFE && gfUIFullTargetFound && MercPtrs[ gusUIFullTargetID ]->bTeam == gbPlayerNum && !AM_AN_EPC( MercPtrs[ gusUIFullTargetID ] ) && !( MercPtrs[ gusUIFullTargetID ]->uiStatusFlags & SOLDIER_VEHICLE ) ) - + //if ( sDist <= PASSING_ITEM_DISTANCE_OKLIFE && gfUIFullTargetFound && MercPtrs[ gusUIFullTargetID ]->bTeam == gbPlayerNum && !AM_AN_EPC( MercPtrs[ gusUIFullTargetID ] ) && !( MercPtrs[ gusUIFullTargetID ]->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) + // And added this one instead: - if ( ( sDist <= PASSING_ITEM_DISTANCE_OKLIFE && gfUIFullTargetFound && MercPtrs[ gusUIFullTargetID ]->bTeam == gbPlayerNum && !AM_AN_EPC( MercPtrs[ gusUIFullTargetID ] ) ) && !( (!gGameExternalOptions.fVehicleInventory) && (MercPtrs[ gusUIFullTargetID ]->uiStatusFlags & SOLDIER_VEHICLE) ) ) + if ( ( sDist <= PASSING_ITEM_DISTANCE_OKLIFE && gfUIFullTargetFound && MercPtrs[ gusUIFullTargetID ]->bTeam == gbPlayerNum && !AM_AN_EPC( MercPtrs[ gusUIFullTargetID ] ) ) && !( (!gGameExternalOptions.fVehicleInventory) && (MercPtrs[ gusUIFullTargetID ]->flags.uiStatusFlags & SOLDIER_VEHICLE) ) ) { // OK, do the transfer... { @@ -5122,7 +5851,7 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos ) } // Check LOS.... - if ( !SoldierTo3DLocationLineOfSightTest( pSoldier, gpItemPointerSoldier->sGridNo, gpItemPointerSoldier->bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) + if ( !SoldierTo3DLocationLineOfSightTest( pSoldier, gpItemPointerSoldier->sGridNo, gpItemPointerSoldier->pathing.bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) { return( FALSE ); } @@ -5136,10 +5865,10 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos ) // try to auto place object.... if ( AutoPlaceObject( pSoldier, gpItemPointer, TRUE ) ) { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_ITEM_PASSED_TO_MERC ], ShortItemNames[ usItem ], pSoldier->name ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_ITEM_PASSED_TO_MERC ], ShortItemNames[ usItem ], pSoldier->name ); // Check if it's the same now! - if ( gpItemPointer->ubNumberOfObjects == 0 ) + if ( gpItemPointer->exists() == false ) { EndItemPointer( ); } @@ -5152,14 +5881,14 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos ) ubFacingDirection = (UINT8)GetDirectionFromGridNo( gpItemPointerSoldier->sGridNo, pSoldier ); // Stop merc first.... - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); // WANNE: Also turn merc if he is crouched and he passes an item - if ( !MercInWater( pSoldier ) ) + if ( !pSoldier->MercInWater( ) ) { // Turn to face, then do animation.... - EVENT_SetSoldierDesiredDirection( pSoldier, ubFacingDirection ); - pSoldier->fTurningUntilDone = TRUE; + pSoldier->EVENT_SetSoldierDesiredDirection( ubFacingDirection ); + pSoldier->flags.fTurningUntilDone = TRUE; if (gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_STAND) { @@ -5168,10 +5897,10 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos ) } // WANNE: Also turn merc if he is crouched and he received the passed item - if ( !MercInWater( gpItemPointerSoldier ) ) + if ( !gpItemPointerSoldier->MercInWater( ) ) { - EVENT_SetSoldierDesiredDirection( gpItemPointerSoldier, gOppositeDirection[ ubFacingDirection ] ); - gpItemPointerSoldier->fTurningUntilDone = TRUE; + gpItemPointerSoldier->EVENT_SetSoldierDesiredDirection( gOppositeDirection[ ubFacingDirection ] ); + gpItemPointerSoldier->flags.fTurningUntilDone = TRUE; if (gAnimControl[ gpItemPointerSoldier->usAnimState ].ubEndHeight == ANIM_STAND) { @@ -5179,12 +5908,12 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos ) } } } - + return( TRUE ); } else { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_NO_ROOM_TO_PASS_ITEM ], ShortItemNames[ usItem ], pSoldier->name ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_NO_ROOM_TO_PASS_ITEM ], ShortItemNames[ usItem ], pSoldier->name ); return( FALSE ); } } @@ -5201,8 +5930,8 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos ) // Deduct points //DeductPoints( gpItemPointerSoldier, AP_TOSS_ITEM, 0 ); - gpItemPointerSoldier->fDontChargeTurningAPs = TRUE; - // Will be dome later.... + gpItemPointerSoldier->flags.fDontChargeTurningAPs = TRUE; + // Will be dome later.... ubThrowActionCode = NO_THROW_ACTION; @@ -5213,12 +5942,12 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos ) pSoldier = MercPtrs[ gusUIFullTargetID ]; // Kaiden: Vehicle Inventory change - Commented the following If Test: - //if ( pSoldier->bTeam == gbPlayerNum && pSoldier->bLife >= OKLIFE && !AM_AN_EPC( pSoldier ) && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) - + //if ( pSoldier->bTeam == gbPlayerNum && pSoldier->stats.bLife >= OKLIFE && !AM_AN_EPC( pSoldier ) && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) + // And replaced it with this one: - if ( ( pSoldier->bTeam == gbPlayerNum && pSoldier->bLife >= OKLIFE && !AM_AN_EPC( pSoldier ) ) && !( ( !gGameExternalOptions.fVehicleInventory ) && ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) ) + if ( ( pSoldier->bTeam == gbPlayerNum && pSoldier->stats.bLife >= OKLIFE && !AM_AN_EPC( pSoldier ) ) && !( ( !gGameExternalOptions.fVehicleInventory ) && ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) ) { - // OK, on our team, + // OK, on our team, // How's our direction? if ( SoldierCanSeeCatchComing( pSoldier, gpItemPointerSoldier->sGridNo ) ) @@ -5232,7 +5961,7 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos ) switch( gAnimControl[ pSoldier->usAnimState ].ubHeight ) { case ANIM_STAND: - + sEndZ = 150; break; @@ -5247,41 +5976,41 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos ) break; } - if ( pSoldier->bLevel > 0 ) + if ( pSoldier->pathing.bLevel > 0 ) { sEndZ = 0; } - + // Get direction ubDirection = (UINT8)GetDirectionFromGridNo( gpItemPointerSoldier->sGridNo, pSoldier ); // ATE: Goto stationary... - SoldierGotoStationaryStance( pSoldier ); + pSoldier->SoldierGotoStationaryStance( ); // Set direction to turn... - EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection ); + pSoldier->EVENT_SetSoldierDesiredDirection( ubDirection ); - } + } } } - + // CHANGE DIRECTION AT LEAST ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, gpItemPointerSoldier ); - EVENT_SetSoldierDesiredDirection( gpItemPointerSoldier, ubDirection ); - gpItemPointerSoldier->fTurningUntilDone = TRUE; + gpItemPointerSoldier->EVENT_SetSoldierDesiredDirection( ubDirection ); + gpItemPointerSoldier->flags.fTurningUntilDone = TRUE; // Increment attacker count... // gTacticalStatus.ubAttackBusyCount++; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Incremtning ABC: Throw item to %d", gTacticalStatus.ubAttackBusyCount) ); DebugAttackBusy( "Incrementing ABC: Throw item\n" ); - + // Given our gridno, throw grenate! - CalculateLaunchItemParamsForThrow( gpItemPointerSoldier, sGridNo, gpItemPointerSoldier->bLevel, (INT16)( ( gsInterfaceLevel * 256 ) + sEndZ ), gpItemPointer, 0, ubThrowActionCode, uiThrowActionData ); + CalculateLaunchItemParamsForThrow( gpItemPointerSoldier, sGridNo, gpItemPointerSoldier->pathing.bLevel, (INT16)( ( gsInterfaceLevel * 256 ) + sEndZ ), gpItemPointer, 0, ubThrowActionCode, uiThrowActionData ); // OK, goto throw animation - HandleSoldierThrowItem( gpItemPointerSoldier, usMapPos ); + HandleSoldierThrowItem( gpItemPointerSoldier, sMapPos ); } } @@ -5292,17 +6021,17 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos ) return( TRUE ); } -BOOLEAN ItemCursorInLobRange( UINT16 usMapPos ) +BOOLEAN ItemCursorInLobRange( INT16 sMapPos ) { // Draw item depending on distance from buddy - if ( GetRangeFromGridNoDiff( usMapPos, gpItemPointerSoldier->sGridNo ) > MIN_LOB_RANGE ) + if ( GetRangeFromGridNoDiff( sMapPos, gpItemPointerSoldier->sGridNo ) > MIN_LOB_RANGE ) { return( FALSE ); } else { return( TRUE ); - } + } } @@ -5320,108 +6049,142 @@ BOOLEAN InKeyRingPopup( ) } BOOLEAN InitItemStackPopup( SOLDIERTYPE *pSoldier, UINT8 ubPosition, INT16 sInvX, INT16 sInvY, INT16 sInvWidth, INT16 sInvHeight ) -{ +{ VOBJECT_DESC VObjectDesc; - INT16 sX, sY, sCenX, sCenY; - SGPRect aRect; - UINT8 ubLimit; - ETRLEObject *pTrav; - HVOBJECT hVObject; - INT32 cnt; - UINT16 usPopupWidth; - INT16 sItemSlotWidth, sItemSlotHeight; + SGPRect aRect; + ETRLEObject *pTrav; + HVOBJECT hVObject; + INT32 cnt; + UINT16 usPopupWidth, usPopupHeight; + INT16 sOffSetY = 0, sOffSetX = 0; + INT16 sItemWidth = 0; + static CHAR16 pStr[ 512 ]; + RenderBackpackButtons(1); /* CHRISL: Needed for new inventory backpack buttons */ + if( guiCurrentScreen == MAP_SCREEN ) + { + sItemWidth = MAP_INV_ITEM_ROW_WIDTH; + sOffSetY = 120; + } + else + { + sItemWidth = INV_ITEM_ROW_WIDTH; + } + // Set some globals gsItemPopupInvX = sInvX; gsItemPopupInvY = sInvY; - gsItemPopupInvWidth = sInvWidth; - gsItemPopupInvHeight = sInvHeight; - + gsItemPopupInvWidth = sInvWidth; + gsItemPopupInvHeight = sInvHeight; gpItemPopupSoldier = pSoldier; - // Determine # of items gpItemPopupObject = &(pSoldier->inv[ ubPosition ] ); - ubLimit = ItemSlotLimit( gpItemPopupObject->usItem, ubPosition ); + // CHRISL: + gubNumItemPopups = ItemSlotLimit( gpItemPopupObject, ubPosition, pSoldier ); // Return false if #objects not >1 - if ( ubLimit <1 ) + if ( gubNumItemPopups <1 ) { return( FALSE ); } - if( guiCurrentItemDescriptionScreen == MAP_SCREEN ) - { - if ( ubLimit > 6 ) - { - ubLimit = 6; - } - } - // Load graphics VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; strcpy( VObjectDesc.ImageFile, "INTERFACE\\extra_inventory.STI" ); CHECKF( AddVideoObject( &VObjectDesc, &guiItemPopupBoxes) ); + if(UsingNewInventorySystem() == true) + { + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + strcpy( VObjectDesc.ImageFile, "INTERFACE\\infobox_background.sti" ); + CHECKF( AddVideoObject( &VObjectDesc, &guiItemDescBoxBackground) ); + } + else + guiItemDescBoxBackground = 0; + // Get size GetVideoObject( &hVObject, guiItemPopupBoxes ); pTrav = &(hVObject->pETRLEObject[ 0 ] ); usPopupWidth = pTrav->usWidth; + usPopupHeight = pTrav->usHeight; + + //CHRISL: resize usPopupWidth based on popup stack location + if(UsingNewInventorySystem() == true) + { + if((ubPosition >=BIGPOCKSTART && ubPosition < BIGPOCKFINAL) || (gGameExternalOptions.fVehicleInventory && (pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE))) + { + usPopupWidth = 75; + if(guiCurrentScreen != MAP_SCREEN) + sItemWidth -= 2; + else if(guiCurrentScreen == MAP_SCREEN) + sItemWidth -= 1; + } + else if(ubPosition >=MEDPOCKSTART && ubPosition < MEDPOCKFINAL) + { + usPopupWidth = 58; + if(guiCurrentScreen != MAP_SCREEN) + sItemWidth -= 1; + } + } // Determine position, height and width of mouse region, area - GetSlotInvXY( ubPosition, &sX, &sY ); - GetSlotInvHeightWidth( ubPosition, &sItemSlotWidth, &sItemSlotHeight ); + //GetSlotInvXY( ubPosition, &sX, &sY ); + //GetSlotInvHeightWidth( ubPosition, &sItemSlotWidth, &sItemSlotHeight ); // Get Width, Height - gsItemPopupWidth = ubLimit * usPopupWidth; + gsItemPopupWidth = gubNumItemPopups * usPopupWidth; gsItemPopupHeight = pTrav->usHeight; - gubNumItemPopups = ubLimit; - // Calculate X,Y, first center - sCenX = sX - ( ( gsItemPopupWidth / 2 ) + ( sItemSlotWidth / 2 ) ); - sCenY = sY; - - // Limit it to window for item desc - if ( sCenX < gsItemPopupInvX ) - { - sCenX = gsItemPopupInvX; - } - if ( ( sCenX + gsItemPopupWidth ) > ( gsItemPopupInvX + gsItemPopupInvWidth ) ) - { - sCenX = gsItemPopupInvX; - } - - // Cap it at 0.... - if ( sCenX < 0 ) - { - sCenX = 0; - } - - // Set - gsItemPopupX = sCenX; - gsItemPopupY = sCenY; + gsItemPopupX = gsItemPopupInvX; + gsItemPopupY = gsItemPopupInvY; for ( cnt = 0; cnt < gubNumItemPopups; cnt++ ) { +// (INT16)( gsItemPopupInvX + ( cnt % gsItemPopupInvWidth * usPopupWidth ) + sOffSetX ), // top left +// (INT16)( sInvY + sOffSetY +( cnt / gsItemPopupInvWidth * usPopupHeight ) ), // top right +// (INT16)( gsItemPopupInvX + ( ( cnt % gsItemPopupInvWidth ) + 1 ) * usPopupWidth + sOffSetX ), // bottom left +// (INT16)( sInvY + ( (cnt / gsItemPopupInvWidth + 1) * usPopupHeight ) + sOffSetY ), // bottom right +// sX = (INT16)(gsItemPopupX + ( cnt % sItemWidth * usWidth )); +// sY = (INT16)(gsItemPopupY + sOffSetY + ( cnt / sItemWidth * usHeight )); // Build a mouse region here that is over any others..... - MSYS_DefineRegion( &gItemPopupRegions[cnt], (INT16)(sCenX + ( cnt * usPopupWidth ) ), sCenY , (INT16)(sCenX + ( (cnt+1) * usPopupWidth ) ),(INT16)( sCenY + gsItemPopupHeight ), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, ItemPopupRegionCallback ); + MSYS_DefineRegion( &gItemPopupRegions[cnt], + (INT16)( gsItemPopupInvX + ( cnt % sItemWidth * usPopupWidth ) + sOffSetX ), // top left + (INT16)( sInvY + sOffSetY +( cnt / sItemWidth * usPopupHeight ) ), // top right + (INT16)( gsItemPopupInvX + ( ( cnt % sItemWidth ) + 1 ) * usPopupWidth + sOffSetX ), // bottom left + (INT16)( sInvY + ( (cnt / sItemWidth + 1) * usPopupHeight ) + sOffSetY ), // bottom right + MSYS_PRIORITY_HIGHEST, + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, ItemPopupRegionCallback ); // Add region MSYS_AddRegion( &gItemPopupRegions[cnt]); MSYS_SetRegionUserData( &gItemPopupRegions[cnt], 0, cnt ); + //CHRISL: Include the pockets capacity as UserData 1 + int cap = ItemSlotLimit( &pSoldier->inv[ubPosition], ubPosition, pSoldier ); + MSYS_SetRegionUserData( &gItemPopupRegions[cnt], 1, cap ); + //CHRISL: Let's also include the ubID for this merc as UserData so we can find the merc again if needed + MSYS_SetRegionUserData( &gItemPopupRegions[cnt], 2, pSoldier->ubID); + //CHRISL: Also include the pocket we're looking at so we can display the right graphic + MSYS_SetRegionUserData( &gItemPopupRegions[cnt], 3, ubPosition); //OK, for each item, set dirty text if applicable! - SetRegionFastHelpText( &(gItemPopupRegions[ cnt ]), ItemNames[ pSoldier->inv[ ubPosition ].usItem ] ); + //CHRISL: + if(cnt < pSoldier->inv[ubPosition].ubNumberOfObjects && pSoldier->inv[ubPosition].exists() == true){ + GetHelpTextForItem( pStr, &( pSoldier->inv[ ubPosition ] ), pSoldier, cnt ); + SetRegionFastHelpText( &(gItemPopupRegions[ cnt ]), pStr ); + } + else{ + SetRegionFastHelpText( &(gItemPopupRegions[ cnt ]), ItemNames[ pSoldier->inv[ ubPosition ].usItem ] ); + } SetRegionHelpEndCallback( &(gItemPopupRegions[ cnt ]), HelpTextDoneCallback ); gfItemPopupRegionCallbackEndFix = FALSE; } // Build a mouse region here that is over any others..... - MSYS_DefineRegion( &gItemPopupRegion, gsItemPopupInvX, gsItemPopupInvY ,(INT16)(gsItemPopupInvX + gsItemPopupInvWidth), (INT16)(gsItemPopupInvY + gsItemPopupInvHeight), MSYS_PRIORITY_HIGH, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, ItemPopupFullRegionCallback ); + MSYS_DefineRegion( &gItemPopupRegion, sInvX, sInvY ,(INT16)(sInvX + sInvWidth), (INT16)(sInvY + sInvHeight), MSYS_PRIORITY_HIGH, + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, ItemPopupFullRegionCallback ); // Add region MSYS_AddRegion( &gItemPopupRegion); @@ -5435,14 +6198,14 @@ BOOLEAN InitItemStackPopup( SOLDIERTYPE *pSoldier, UINT8 ubPosition, INT16 sInvX //guiTacticalInterfaceFlags |= INTERFACE_NORENDERBUTTONS; - gfInItemStackPopup = TRUE; - // if ( !(guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) if( guiCurrentItemDescriptionScreen != MAP_SCREEN ) { - EnableSMPanelButtons( FALSE, FALSE ); + EnableSMPanelButtons( FALSE, FALSE ); } + gfInItemStackPopup = TRUE; + //Reserict mouse cursor to panel aRect.iTop = sInvY; aRect.iLeft = sInvX; @@ -5458,7 +6221,7 @@ void EndItemStackPopupWithItemInHand( ) { if ( gpItemPointer != NULL ) { - DeleteItemStackPopup( ); + DeleteItemStackPopup( ); } } @@ -5469,6 +6232,19 @@ void RenderItemStackPopup( BOOLEAN fFullRender ) HVOBJECT hVObject; UINT32 cnt; INT16 sX, sY, sNewX, sNewY; + INT16 sItemWidth = 0, sOffSetY = 0, sWidth = 29; + UINT8 ubPosition, image = 0, sID; + + // CHRISL: Setup witdh and offset to layer inventory boxes if necessary + if( guiCurrentScreen == MAP_SCREEN ) + { + sItemWidth = MAP_INV_ITEM_ROW_WIDTH; + sOffSetY = 120; + } + else + { + sItemWidth = INV_ITEM_ROW_WIDTH; + } if ( gfInItemStackPopup ) { @@ -5479,32 +6255,66 @@ void RenderItemStackPopup( BOOLEAN fFullRender ) // Shadow Area if ( fFullRender ) { - ShadowVideoSurfaceRect( FRAME_BUFFER, gsItemPopupInvX, gsItemPopupInvY, gsItemPopupInvX + gsItemPopupInvWidth , gsItemPopupInvY + gsItemPopupInvHeight ); + if(UsingNewInventorySystem() == false || guiCurrentScreen == MAP_SCREEN) + ShadowVideoSurfaceRect( FRAME_BUFFER, gsItemPopupInvX, gsItemPopupInvY, gsItemPopupInvX + gsItemPopupInvWidth , gsItemPopupInvY + gsItemPopupInvHeight ); + else if(UsingNewInventorySystem() == true && iResolution != 0 && guiItemDescBoxBackground != 0 && guiCurrentScreen != MAP_SCREEN) + BltVideoObjectFromIndex( FRAME_BUFFER, guiItemDescBoxBackground, iResolution, SM_ITEMDESC_START_X, SM_ITEMDESC_START_Y, VO_BLT_SRCTRANSPARENCY, NULL ); } } + //CHRISL: Get ubPosition from mouse region + sID = MSYS_GetRegionUserData(&gItemPopupRegions[0], 2); + ubPosition = MSYS_GetRegionUserData(&gItemPopupRegions[0], 3); // TAKE A LOOK AT THE VIDEO OBJECT SIZE ( ONE OF TWO SIZES ) AND CENTER! GetVideoObject( &hVObject, guiItemPopupBoxes ); pTrav = &(hVObject->pETRLEObject[ 0 ] ); usHeight = (UINT32)pTrav->usHeight; usWidth = (UINT32)pTrav->usWidth; - + //CHRISL: resize usPopupWidth based on popup stack location + if(UsingNewInventorySystem() == true) + { + if((ubPosition >=BIGPOCKSTART && ubPosition < BIGPOCKFINAL) || (gGameExternalOptions.fVehicleInventory && (MercPtrs[sID]->flags.uiStatusFlags & SOLDIER_VEHICLE))) + { + if(guiCurrentScreen != MAP_SCREEN) + sItemWidth -= 2; + else if(guiCurrentScreen == MAP_SCREEN) + sItemWidth -= 1; + usWidth = 75; + sWidth = 60; + image = 2; + } + else if(ubPosition >=MEDPOCKSTART && ubPosition < MEDPOCKFINAL) + { + if(guiCurrentScreen != MAP_SCREEN) + sItemWidth -= 1; + usWidth = 58; + sWidth = 43; + image = 1; + } + } + for ( cnt = 0; cnt < gubNumItemPopups; cnt++ ) { - BltVideoObjectFromIndex( FRAME_BUFFER, guiItemPopupBoxes, 0, gsItemPopupX + ( cnt * usWidth ), gsItemPopupY, VO_BLT_SRCTRANSPARENCY, NULL ); + // CHRISL: Layer item boxes if we have too many to display in a single row + //BltVideoObjectFromIndex( FRAME_BUFFER, guiItemPopupBoxes, 0, gsItemPopupX + ( cnt * usWidth ), gsItemPopupY, VO_BLT_SRCTRANSPARENCY, NULL ); + sX = (INT16)(gsItemPopupX + ( cnt % sItemWidth * usWidth )); + sY = (INT16)(gsItemPopupY + sOffSetY + ( cnt / sItemWidth * usHeight )); + BltVideoObjectFromIndex( FRAME_BUFFER, guiItemPopupBoxes, image, (INT16)sX, ( INT16 )sY, VO_BLT_SRCTRANSPARENCY, NULL ); if ( cnt < gpItemPopupObject->ubNumberOfObjects ) { - sX = (INT16)(gsItemPopupX + ( cnt * usWidth ) + 11); - sY = (INT16)( gsItemPopupY + 3 ); + // CHRISL: Coord updates to work with mutliple rows + //sX = (INT16)(gsItemPopupX + ( cnt * usWidth ) + 11); + //sY = (INT16)( gsItemPopupY + 3 ); - INVRenderItem( FRAME_BUFFER, NULL, gpItemPopupObject, sX, sY, 29, 23, DIRTYLEVEL2, NULL, (UINT8)RENDER_ITEM_NOSTATUS, FALSE, 0 ); + INVRenderItem( FRAME_BUFFER, NULL, gpItemPopupObject, sX+11, sY+3, sWidth, 23, DIRTYLEVEL2, NULL, (UINT8)RENDER_ITEM_NOSTATUS, FALSE, 0, cnt ); + // CHRISL: Coord updates to work with mutliple rows // Do status bar here... sNewX = (INT16)( gsItemPopupX + ( cnt * usWidth ) + 7 ); sNewY = gsItemPopupY + INV_BAR_DY + 3; - DrawItemUIBarEx( gpItemPopupObject, (UINT8)cnt, sNewX, sNewY, ITEM_BAR_WIDTH, ITEM_BAR_HEIGHT, Get16BPPColor( STATUS_BAR ), Get16BPPColor( STATUS_BAR_SHADOW ), TRUE , FRAME_BUFFER ); + DrawItemUIBarEx( gpItemPopupObject, (UINT8)cnt, sX+7, sY+INV_BAR_DY+3, ITEM_BAR_WIDTH, ITEM_BAR_HEIGHT, Get16BPPColor( STATUS_BAR ), Get16BPPColor( STATUS_BAR_SHADOW ), TRUE , FRAME_BUFFER, cnt ); } } @@ -5529,7 +6339,7 @@ void DeleteItemStackPopup( ) MSYS_RemoveRegion( &gItemPopupRegion); - + gfInItemStackPopup = FALSE; for ( cnt = 0; cnt < gubNumItemPopups; cnt++ ) @@ -5545,26 +6355,26 @@ void DeleteItemStackPopup( ) // if ( !(guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) if( guiCurrentItemDescriptionScreen != MAP_SCREEN ) { - EnableSMPanelButtons( TRUE, FALSE ); + EnableSMPanelButtons( TRUE, FALSE ); } FreeMouseCursor( ); - + } BOOLEAN InitKeyRingPopup( SOLDIERTYPE *pSoldier, INT16 sInvX, INT16 sInvY, INT16 sInvWidth, INT16 sInvHeight ) -{ +{ VOBJECT_DESC VObjectDesc; SGPRect aRect; - ETRLEObject *pTrav; + ETRLEObject *pTrav; HVOBJECT hVObject; - INT32 cnt; + INT32 cnt; UINT16 usPopupWidth, usPopupHeight; - //UINT8 ubSlotSimilarToKeySlot = 10; - INT16 sKeyRingItemWidth = 0; - INT16 sOffSetY = 0, sOffSetX = 0; + INT16 sOffSetY = 0, sOffSetX = 0; + INT16 sKeyRingItemWidth = 0; + RenderBackpackButtons(1); /* CHRISL: Needed for new inventory backpack buttons */ if( guiCurrentScreen == MAP_SCREEN ) { gsKeyRingPopupInvX = 0; @@ -5581,9 +6391,8 @@ BOOLEAN InitKeyRingPopup( SOLDIERTYPE *pSoldier, INT16 sInvX, INT16 sInvY, INT16 } gsKeyRingPopupInvY = sInvY; - gsKeyRingPopupInvWidth = sInvWidth; - gsKeyRingPopupInvHeight = sInvHeight; - + gsKeyRingPopupInvWidth = sInvWidth; + gsKeyRingPopupInvHeight = sInvHeight; gpItemPopupSoldier = pSoldier; @@ -5592,6 +6401,15 @@ BOOLEAN InitKeyRingPopup( SOLDIERTYPE *pSoldier, INT16 sInvX, INT16 sInvY, INT16 strcpy( VObjectDesc.ImageFile, "INTERFACE\\extra_inventory.STI" ); CHECKF( AddVideoObject( &VObjectDesc, &guiItemPopupBoxes) ); + if(UsingNewInventorySystem() == true) + { + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + strcpy( VObjectDesc.ImageFile, "INTERFACE\\infobox_background.sti" ); + CHECKF( AddVideoObject( &VObjectDesc, &guiItemDescBoxBackground) ); + } + else + guiItemDescBoxBackground = 0; + // Get size GetVideoObject( &hVObject, guiItemPopupBoxes ); pTrav = &(hVObject->pETRLEObject[ 0 ] ); @@ -5604,13 +6422,13 @@ BOOLEAN InitKeyRingPopup( SOLDIERTYPE *pSoldier, INT16 sInvX, INT16 sInvY, INT16 for ( cnt = 0; cnt < NUMBER_KEYS_ON_KEYRING; cnt++ ) { // Build a mouse region here that is over any others..... - MSYS_DefineRegion( &gKeyRingRegions[cnt], + MSYS_DefineRegion( &gKeyRingRegions[cnt], (INT16)( gsKeyRingPopupInvX + ( cnt % sKeyRingItemWidth * usPopupWidth ) + sOffSetX ), // top left (INT16)( sInvY + sOffSetY +( cnt / sKeyRingItemWidth * usPopupHeight ) ), // top right (INT16)( gsKeyRingPopupInvX + ( ( cnt % sKeyRingItemWidth ) + 1 ) * usPopupWidth + sOffSetX ), // bottom left (INT16)( sInvY + ( (cnt / sKeyRingItemWidth + 1) * usPopupHeight ) + sOffSetY ), // bottom right MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, KeyRingSlotInvClickCallback ); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, KeyRingSlotInvClickCallback ); // Add region MSYS_AddRegion( &gKeyRingRegions[cnt]); MSYS_SetRegionUserData( &gKeyRingRegions[cnt], 0, cnt ); @@ -5620,8 +6438,8 @@ BOOLEAN InitKeyRingPopup( SOLDIERTYPE *pSoldier, INT16 sInvX, INT16 sInvY, INT16 // Build a mouse region here that is over any others..... MSYS_DefineRegion( &gItemPopupRegion, sInvX, sInvY ,(INT16)(sInvX + sInvWidth), (INT16)(sInvY + sInvHeight), MSYS_PRIORITY_HIGH, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, ItemPopupFullRegionCallback ); - + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, ItemPopupFullRegionCallback ); + // Add region MSYS_AddRegion( &gItemPopupRegion); @@ -5638,7 +6456,7 @@ BOOLEAN InitKeyRingPopup( SOLDIERTYPE *pSoldier, INT16 sInvX, INT16 sInvY, INT16 // if ( !(guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) if( guiCurrentItemDescriptionScreen != MAP_SCREEN ) { - EnableSMPanelButtons( FALSE , FALSE ); + EnableSMPanelButtons( FALSE , FALSE ); } gfInKeyRingPopup = TRUE; @@ -5661,7 +6479,6 @@ void RenderKeyRingPopup( BOOLEAN fFullRender ) UINT32 usHeight, usWidth; HVOBJECT hVObject; UINT32 cnt; - OBJECTTYPE pObject; INT16 sKeyRingItemWidth = 0; INT16 sOffSetY = 0, sOffSetX = 0; @@ -5684,15 +6501,16 @@ void RenderKeyRingPopup( BOOLEAN fFullRender ) // Shadow Area if ( fFullRender ) { - ShadowVideoSurfaceRect( FRAME_BUFFER, 0, gsKeyRingPopupInvY, gsKeyRingPopupInvX + gsKeyRingPopupInvWidth , gsKeyRingPopupInvY + gsKeyRingPopupInvHeight ); + if(UsingNewInventorySystem() == false || guiCurrentScreen == MAP_SCREEN) + ShadowVideoSurfaceRect( FRAME_BUFFER, 0, gsKeyRingPopupInvY, gsKeyRingPopupInvX + gsKeyRingPopupInvWidth , gsKeyRingPopupInvY + gsKeyRingPopupInvHeight ); + else if(UsingNewInventorySystem() == true && iResolution != 0 && guiItemDescBoxBackground != 0 && guiCurrentScreen != MAP_SCREEN) + BltVideoObjectFromIndex( FRAME_BUFFER, guiItemDescBoxBackground, iResolution, SM_ITEMDESC_START_X, SM_ITEMDESC_START_Y, VO_BLT_SRCTRANSPARENCY, NULL ); } } - memset( &pObject, 0, sizeof( OBJECTTYPE ) ); - - pObject.usItem = KEY_1; - pObject.ItemData.Generic.bStatus[ 0 ] = 100; + gTempObject.usItem = KEY_1; + gTempObject[0]->data.objectStatus = 100; // TAKE A LOOK AT THE VIDEO OBJECT SIZE ( ONE OF TWO SIZES ) AND CENTER! GetVideoObject( &hVObject, guiItemPopupBoxes ); @@ -5709,7 +6527,7 @@ void RenderKeyRingPopup( BOOLEAN fFullRender ) // Set some globals sKeyRingItemWidth = KEY_RING_ROW_WIDTH; } - + for ( cnt = 0; cnt < NUMBER_KEYS_ON_KEYRING; cnt++ ) { BltVideoObjectFromIndex( FRAME_BUFFER, guiItemPopupBoxes, 0, (INT16)(gsKeyRingPopupInvX + ( cnt % sKeyRingItemWidth * usWidth ) + sOffSetX ), ( INT16 )( gsKeyRingPopupInvY + sOffSetY + ( cnt / sKeyRingItemWidth * usHeight ) ), VO_BLT_SRCTRANSPARENCY, NULL ); @@ -5717,17 +6535,17 @@ void RenderKeyRingPopup( BOOLEAN fFullRender ) // will want to draw key here.. if there is one if( ( gpItemPopupSoldier->pKeyRing[ cnt ].ubKeyID != INVALID_KEY_NUMBER ) && ( gpItemPopupSoldier->pKeyRing[ cnt ].ubNumber > 0 ) ) { - pObject.ubNumberOfObjects = gpItemPopupSoldier->pKeyRing[ cnt ].ubNumber; + gTempObject.ubNumberOfObjects = gpItemPopupSoldier->pKeyRing[ cnt ].ubNumber; // show 100% status for each - DrawItemUIBarEx( &pObject, 0, (INT16)( gsKeyRingPopupInvX + sOffSetX + ( cnt % sKeyRingItemWidth * usWidth ) + 7 ), ( INT16 )( gsKeyRingPopupInvY + sOffSetY + ( cnt / sKeyRingItemWidth * usHeight ) + 24 ) + DrawItemUIBarEx( &gTempObject, 0, (INT16)( gsKeyRingPopupInvX + sOffSetX + ( cnt % sKeyRingItemWidth * usWidth ) + 7 ), ( INT16 )( gsKeyRingPopupInvY + sOffSetY + ( cnt / sKeyRingItemWidth * usHeight ) + 24 ) , ITEM_BAR_WIDTH, ITEM_BAR_HEIGHT, Get16BPPColor( STATUS_BAR ), Get16BPPColor( STATUS_BAR_SHADOW ), TRUE , FRAME_BUFFER ); - + // set item type - pObject.usItem = FIRST_KEY + LockTable[ gpItemPopupSoldier->pKeyRing[ cnt].ubKeyID ].usKeyItem; + gTempObject.usItem = FIRST_KEY + LockTable[ gpItemPopupSoldier->pKeyRing[ cnt].ubKeyID ].usKeyItem; // render the item - INVRenderItem( FRAME_BUFFER, NULL, &pObject, (INT16)(gsKeyRingPopupInvX + sOffSetX +( cnt % sKeyRingItemWidth * usWidth ) + 8), ( INT16 )( gsKeyRingPopupInvY + sOffSetY + ( cnt / sKeyRingItemWidth * usHeight ) ), + INVRenderItem( FRAME_BUFFER, NULL, &gTempObject, (INT16)(gsKeyRingPopupInvX + sOffSetX +( cnt % sKeyRingItemWidth * usWidth ) + 8), ( INT16 )( gsKeyRingPopupInvY + sOffSetY + ( cnt / sKeyRingItemWidth * usHeight ) ), ( UINT16 )( usWidth - 8 ), ( UINT16 )( usHeight - 2 ) , DIRTYLEVEL2, NULL, 0, 0, 0 ); } @@ -5748,7 +6566,7 @@ void DeleteKeyRingPopup( ) if( gfInKeyRingPopup == FALSE ) { - // done, + // done, return; } @@ -5757,7 +6575,7 @@ void DeleteKeyRingPopup( ) MSYS_RemoveRegion( &gItemPopupRegion); - + gfInKeyRingPopup = FALSE; for ( cnt = 0; cnt < NUMBER_KEYS_ON_KEYRING; cnt++ ) @@ -5773,7 +6591,7 @@ void DeleteKeyRingPopup( ) // if ( !(guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) if( guiCurrentItemDescriptionScreen != MAP_SCREEN ) { - EnableSMPanelButtons( TRUE, FALSE ); + EnableSMPanelButtons( TRUE, FALSE ); } FreeMouseCursor( ); @@ -5815,15 +6633,15 @@ UINT16 GetTileGraphicForItem( INVTYPE *pItem ) } else if ( pItem->ubGraphicType == 1 ) { - GetTileIndexFromTypeSubIndex( P1ITEMS, (INT16)(pItem->ubGraphicNum+1), &usIndex ); + GetTileIndexFromTypeSubIndex( P1ITEMS, (INT16)(pItem->ubGraphicNum+1), &usIndex ); } else if ( pItem->ubGraphicType == 2 ) { - GetTileIndexFromTypeSubIndex( P2ITEMS, (INT16)(pItem->ubGraphicNum+1), &usIndex ); + GetTileIndexFromTypeSubIndex( P2ITEMS, (INT16)(pItem->ubGraphicNum+1), &usIndex ); } else { - GetTileIndexFromTypeSubIndex( P3ITEMS, (INT16)(pItem->ubGraphicNum+1), &usIndex ); + GetTileIndexFromTypeSubIndex( P3ITEMS, (INT16)(pItem->ubGraphicNum+1), &usIndex ); } if ( pItem->ubClassIndex >= M900 ) @@ -5896,7 +6714,7 @@ BOOLEAN LoadTileGraphicForItem( INVTYPE *pItem, UINT32 *puiVo ) VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; sprintf( VObjectDesc.ImageFile, "BIGITEMS\\%s", zName ); CHECKF( AddVideoObject( &VObjectDesc, &uiVo) ); - + *puiVo = uiVo; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("LoadTileGraphicForItem: done")); @@ -5910,7 +6728,7 @@ void ItemDescMoveCallback( MOUSE_REGION * pRegion, INT32 iReason ) void ItemDescCallback( MOUSE_REGION * pRegion, INT32 iReason ) { - static BOOLEAN fRightDown = FALSE, fLeftDown = FALSE; + static BOOLEAN fRightDown = FALSE, fLeftDown = FALSE; if (iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN) { @@ -5950,10 +6768,10 @@ void ItemDescCallback( MOUSE_REGION * pRegion, INT32 iReason ) void ItemDescDoneButtonCallback( GUI_BUTTON *btn, INT32 reason ) { - + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { @@ -5965,14 +6783,14 @@ void ItemDescDoneButtonCallback( GUI_BUTTON *btn, INT32 reason ) { RemoveMoney(); } - + DeleteItemDescriptionBox( ); } - } + } if(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN ) { - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) { @@ -5981,15 +6799,19 @@ void ItemDescDoneButtonCallback( GUI_BUTTON *btn, INT32 reason ) btn->uiFlags&=~(BUTTON_CLICKED_ON); DeleteItemDescriptionBox( ); } - } + } } void ItemPopupRegionCallback( MOUSE_REGION * pRegion, INT32 iReason ) { UINT32 uiItemPos; + UINT32 iItemCap; + UINT32 ubID; uiItemPos = MSYS_GetRegionUserData( pRegion, 0 ); + iItemCap = MSYS_GetRegionUserData( pRegion, 1 ); + ubID = MSYS_GetRegionUserData( pRegion, 2 ); // TO ALLOW ME TO DELETE REGIONS IN CALLBACKS! if ( gfItemPopupRegionCallbackEndFix ) @@ -5999,32 +6821,54 @@ void ItemPopupRegionCallback( MOUSE_REGION * pRegion, INT32 iReason ) if (iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN) { - + //If something in our hand, see if it's ammo and if we are trying to reload a gun + if ( gpItemPointer != NULL ) + { + //CHRISL: Since we can now stack guns, let's make it so we can reload guns in a stack + if(CompatibleAmmoForGun(gpItemPointer, gpItemPopupObject) || ValidLaunchable(gpItemPointer->usItem, gpItemPopupObject->usItem)) + { + switch (Item[gpItemPopupObject->usItem].usItemClass) + { + case IC_GUN: + if (Item[gpItemPointer->usItem].usItemClass == IC_AMMO) { + if (Weapon[gpItemPopupObject->usItem].ubCalibre == Magazine[Item[gpItemPointer->usItem].ubClassIndex].ubCalibre) { + ReloadGun( MercPtrs[ubID], gpItemPopupObject, gpItemPointer, uiItemPos ); + } + } + break; + case IC_LAUNCHER: + if ( ValidLaunchable( gpItemPointer->usItem, gpItemPopupObject->usItem ) ) { + ReloadGun( MercPtrs[ubID], gpItemPopupObject, gpItemPointer, uiItemPos ); + } + break; + } + } + } //If one in our hand, place it if ( gpItemPointer != NULL ) { - if ( !PlaceObjectAtObjectIndex( gpItemPointer, gpItemPopupObject, (UINT8)uiItemPos ) ) + if ( !PlaceObjectAtObjectIndex( gpItemPointer, gpItemPopupObject, (UINT8)uiItemPos, iItemCap ) ) + { + if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) { - if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) - { - MAPEndItemPointer( ); - } - else - { - gpItemPointer = NULL; - MSYS_ChangeRegionCursor( &gSMPanelRegion , CURSOR_NORMAL ); - SetCurrentCursorFromDatabase( CURSOR_NORMAL ); - - if( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) - { - memset( &gMoveingItem, 0, sizeof( INVENTORY_IN_SLOT ) ); - SetSkiCursor( CURSOR_NORMAL ); - } - } - - // re-evaluate repairs - gfReEvaluateEveryonesNothingToDo = TRUE; + MAPEndItemPointer( ); } + else + { + gpItemPointer = NULL; + MSYS_ChangeRegionCursor( &gSMPanelRegion , CURSOR_NORMAL ); + SetCurrentCursorFromDatabase( CURSOR_NORMAL ); + + if( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) + { + gMoveingItem.initialize(); + SetSkiCursor( CURSOR_NORMAL ); + } + } + + // re-evaluate repairs + gfReEvaluateEveryonesNothingToDo = TRUE; + } //Dirty interface //fInterfacePanelDirty = DIRTYLEVEL2; @@ -6036,18 +6880,18 @@ void ItemPopupRegionCallback( MOUSE_REGION * pRegion, INT32 iReason ) { // Here, grab an item and put in cursor to swap //RemoveObjFrom( OBJECTTYPE * pObj, UINT8 ubRemoveIndex ) - GetObjFrom( gpItemPopupObject, (UINT8)uiItemPos, &gItemPointer ); + gpItemPopupObject->RemoveObjectAtIndex( uiItemPos, &gItemPointer ); - if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) - { - // pick it up - InternalMAPBeginItemPointer( gpItemPopupSoldier ); - } - else - { - gpItemPointer = &gItemPointer; - gpItemPointerSoldier = gpItemPopupSoldier; - } + if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) + { + // pick it up + InternalMAPBeginItemPointer( gpItemPopupSoldier ); + } + else + { + gpItemPointer = &gItemPointer; + gpItemPointerSoldier = gpItemPopupSoldier; + } //if we are in the shop keeper interface if( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) @@ -6056,7 +6900,7 @@ void ItemPopupRegionCallback( MOUSE_REGION * pRegion, INT32 iReason ) BeginSkiItemPointer( PLAYERS_INVENTORY, -1, ( BOOLEAN )!gfKeyState[ CTRL ] ); // if we've just removed the last one there - if ( gpItemPopupObject->ubNumberOfObjects == 0 ) + if ( gpItemPopupObject->exists() == false ) { // we must immediately get out of item stack popup, because the item has been deleted (memset to 0), and // errors like a right bringing up an item description for item 0 could happen then. ARM. @@ -6098,8 +6942,6 @@ void ItemPopupRegionCallback( MOUSE_REGION * pRegion, INT32 iReason ) InternalInitItemDescriptionBox( gpItemPopupObject, (INT16) ITEMDESC_START_X, (INT16) ITEMDESC_START_Y, (UINT8)uiItemPos, gpItemPopupSoldier ); } } - - } } @@ -6115,7 +6957,7 @@ void ItemPopupFullRegionCallback( MOUSE_REGION * pRegion, INT32 iReason ) { // End stack popup and retain pointer EndItemStackPopupWithItemInHand( ); - } + } else if( InKeyRingPopup() ) { // end pop up with key in hand @@ -6141,8 +6983,12 @@ void ItemPopupFullRegionCallback( MOUSE_REGION * pRegion, INT32 iReason ) #define NUM_PICKUP_SLOTS 6 -typedef struct +#define SIZEOF_ITEM_PICKUP_MENU_STRUCT_POD offsetof(ITEM_PICKUP_MENU_STRUCT, endOfPod) +class ITEM_PICKUP_MENU_STRUCT { +public: + ITEM_PICKUP_MENU_STRUCT() {initialize();}; + void initialize() {memset(this, 0, SIZEOF_ITEM_PICKUP_MENU_STRUCT_POD); CompAmmoObject.initialize();}; ITEM_POOL *pItemPool; INT16 sX; INT16 sY; @@ -6179,10 +7025,10 @@ typedef struct MOUSE_REGION BackRegion; BOOLEAN *pfSelectedArray; BOOLEAN fAtLeastOneSelected; - OBJECTTYPE CompAmmoObject; BOOLEAN fAllSelected; - -} ITEM_PICKUP_MENU_STRUCT; + char endOfPod; + OBJECTTYPE CompAmmoObject; +}; #define ITEMPICK_UP_X 55 #define ITEMPICK_UP_Y 5 @@ -6198,15 +7044,15 @@ typedef struct #define ITEMPICK_START_X_OFFSET 10 #define ITEMPICK_START_Y_OFFSET 20 -#define ITEMPICK_GRAPHIC_X 10 -#define ITEMPICK_GRAPHIC_Y 12 -#define ITEMPICK_GRAPHIC_YSPACE 26 +#define ITEMPICK_GRAPHIC_X 10 +#define ITEMPICK_GRAPHIC_Y 12 +#define ITEMPICK_GRAPHIC_YSPACE 26 -#define ITEMPICK_TEXT_X 56 -#define ITEMPICK_TEXT_Y 22 +#define ITEMPICK_TEXT_X 56 +#define ITEMPICK_TEXT_Y 22 #define ITEMPICK_TEXT_YSPACE 26 -#define ITEMPICK_TEXT_WIDTH 109 -#define ITEMPICK_TEXT_HEIGHT 17 +#define ITEMPICK_TEXT_WIDTH 109 +#define ITEMPICK_TEXT_HEIGHT 17 @@ -6243,7 +7089,7 @@ BOOLEAN InitializeItemPickupMenu( SOLDIERTYPE *pSoldier, INT16 sGridNo, ITEM_POO gfStealing=FALSE; gpOpponent=NULL; - + // Erase other menus.... EraseInterfaceMenus( TRUE ); @@ -6251,7 +7097,7 @@ BOOLEAN InitializeItemPickupMenu( SOLDIERTYPE *pSoldier, INT16 sGridNo, ITEM_POO LocateSoldier( pSoldier->ubID, FALSE ); // memset values - memset( &gItemPickupMenu, 0, sizeof( gItemPickupMenu ) ); + gItemPickupMenu.initialize(); //Set item pool value gItemPickupMenu.pItemPool = pItemPool; @@ -6281,7 +7127,7 @@ BOOLEAN InitializeItemPickupMenu( SOLDIERTYPE *pSoldier, INT16 sGridNo, ITEM_POO cnt++; } - pTempItemPool = pTempItemPool->pNext; + pTempItemPool = pTempItemPool->pNext; } gItemPickupMenu.ubTotalItems = (UINT8)cnt; @@ -6317,8 +7163,8 @@ BOOLEAN InitializeItemPickupMenu( SOLDIERTYPE *pSoldier, INT16 sGridNo, ITEM_POO } else { - sX = sScreenX; - sY = sScreenY; + sX = sScreenX; + sY = sScreenY; } // CHECK FOR LEFT/RIGHT @@ -6376,14 +7222,14 @@ BOOLEAN InitializeItemPickupMenu( SOLDIERTYPE *pSoldier, INT16 sGridNo, ITEM_POO // Build a mouse region here that is over any others..... MSYS_DefineRegion( &(gItemPickupMenu.BackRegion ), (INT16)( SCREEN_WIDTH - 108 ), (INT16)( SCREEN_HEIGHT - 133 ), (INT16)( SCREEN_WIDTH ),(INT16)( SCREEN_HEIGHT ), MSYS_PRIORITY_HIGHEST, - CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); // Add region MSYS_AddRegion( &(gItemPickupMenu.BackRegion ) ); // Build a mouse region here that is over any others..... MSYS_DefineRegion( &(gItemPickupMenu.BackRegions ), (INT16)(gItemPickupMenu.sX ), (INT16)(gItemPickupMenu.sY), (INT16)(gItemPickupMenu.sX + gItemPickupMenu.sWidth ),(INT16)( gItemPickupMenu.sY + gItemPickupMenu.sHeight ), MSYS_PRIORITY_HIGHEST, - CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); // Add region MSYS_AddRegion( &(gItemPickupMenu.BackRegions ) ); @@ -6436,7 +7282,7 @@ BOOLEAN InitializeItemPickupMenu( SOLDIERTYPE *pSoldier, INT16 sGridNo, ITEM_POO { // Build a mouse region here that is over any others..... MSYS_DefineRegion( &(gItemPickupMenu.Regions[cnt]), (INT16)(sCenX ), (INT16)(sCenY + 1), (INT16)(sCenX + gItemPickupMenu.sWidth ),(INT16)( sCenY + ITEMPICK_GRAPHIC_YSPACE ), MSYS_PRIORITY_HIGHEST, - CURSOR_NORMAL, ItemPickMenuMouseMoveCallback, ItemPickMenuMouseClickCallback ); + CURSOR_NORMAL, ItemPickMenuMouseMoveCallback, ItemPickMenuMouseClickCallback ); // Add region MSYS_AddRegion( &(gItemPickupMenu.Regions[cnt]) ); MSYS_SetRegionUserData( &(gItemPickupMenu.Regions[cnt]), 0, cnt ); @@ -6524,7 +7370,7 @@ void SetupPickupPage( INT8 bPage ) { while( !ItemPoolOKForDisplay( pTempItemPool, gItemPickupMenu.bZLevel ) ) { - pTempItemPool = pTempItemPool->pNext; + pTempItemPool = pTempItemPool->pNext; } } @@ -6532,11 +7378,10 @@ void SetupPickupPage( INT8 bPage ) { gItemPickupMenu.ItemPoolSlots[ cnt - iStart ] = pTempItemPool; - // WDS - Clean up inventory handling pObject = (gfStealing)? &gpOpponent->inv[pTempItemPool->iItemIndex] - :&(gWorldItems[ pTempItemPool->iItemIndex ].o ); + :&(gWorldItems[ pTempItemPool->iItemIndex ].object ); - sValue = pObject->ItemData.Generic.bStatus[ 0 ]; + sValue = (*pObject)[0]->data.objectStatus; // Adjust for ammo, other thingys.. if( Item[ pObject->usItem ].usItemClass & IC_AMMO || Item[ pObject->usItem ].usItemClass & IC_KEY ) @@ -6553,11 +7398,11 @@ void SetupPickupPage( INT8 bPage ) cnt++; - pTempItemPool = pTempItemPool->pNext; + pTempItemPool = pTempItemPool->pNext; } gItemPickupMenu.bScrollPage = bPage; - gItemPickupMenu.ubScrollAnchor = (UINT8)iStart; + gItemPickupMenu.ubScrollAnchor = (UINT8)iStart; if ( gItemPickupMenu.bNumSlotsPerPage == NUM_PICKUP_SLOTS && gItemPickupMenu.ubTotalItems > NUM_PICKUP_SLOTS ) { @@ -6608,7 +7453,7 @@ void CalculateItemPickupMenuDimensions( ) } // Add hieght of object - GetVideoObjectETRLESubregionProperties( gItemPickupMenu.uiPanelVo, usSubRegion, &usWidth, &usHeight ); + GetVideoObjectETRLESubregionProperties( gItemPickupMenu.uiPanelVo, usSubRegion, &usWidth, &usHeight ); sY += usHeight; @@ -6616,7 +7461,7 @@ void CalculateItemPickupMenuDimensions( ) gItemPickupMenu.sButtomPanelStartY = sY; // Do end - GetVideoObjectETRLESubregionProperties( gItemPickupMenu.uiPanelVo, 2, &usWidth, &usHeight ); + GetVideoObjectETRLESubregionProperties( gItemPickupMenu.uiPanelVo, 2, &usWidth, &usHeight ); sY += usHeight; @@ -6676,10 +7521,10 @@ void RenderItemPickupMenu( ) usSubRegion = 1; } - BltVideoObjectFromIndex( FRAME_BUFFER, gItemPickupMenu.uiPanelVo, usSubRegion, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObjectFromIndex( FRAME_BUFFER, gItemPickupMenu.uiPanelVo, usSubRegion, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL ); // Add hieght of object - GetVideoObjectETRLESubregionProperties( gItemPickupMenu.uiPanelVo, usSubRegion, &usWidth, &usHeight ); + GetVideoObjectETRLESubregionProperties( gItemPickupMenu.uiPanelVo, usSubRegion, &usWidth, &usHeight ); sY += usHeight; @@ -6688,11 +7533,11 @@ void RenderItemPickupMenu( ) // Do end if ( gItemPickupMenu.bNumSlotsPerPage == NUM_PICKUP_SLOTS && gItemPickupMenu.ubTotalItems > NUM_PICKUP_SLOTS ) { - BltVideoObjectFromIndex( FRAME_BUFFER, gItemPickupMenu.uiPanelVo, 2, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObjectFromIndex( FRAME_BUFFER, gItemPickupMenu.uiPanelVo, 2, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL ); } else { - BltVideoObjectFromIndex( FRAME_BUFFER, gItemPickupMenu.uiPanelVo, 3, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObjectFromIndex( FRAME_BUFFER, gItemPickupMenu.uiPanelVo, 3, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL ); } // Render items.... @@ -6710,13 +7555,12 @@ void RenderItemPickupMenu( ) if ( gItemPickupMenu.ItemPoolSlots[ cnt ] != NULL ) { // Get item to render - // WDS - Clean up inventory handling pObject = (gfStealing)? &gpOpponent->inv[gItemPickupMenu.ItemPoolSlots[ cnt ]->iItemIndex] - :&(gWorldItems[ gItemPickupMenu.ItemPoolSlots[ cnt ]->iItemIndex ].o ); + :&(gWorldItems[ gItemPickupMenu.ItemPoolSlots[ cnt ]->iItemIndex ].object ); pItem = &( Item[ pObject->usItem ] ); usItemTileIndex = GetTileGraphicForItem( pItem ); - + // Render sX = ITEMPICK_GRAPHIC_X + gItemPickupMenu.sX; @@ -6778,6 +7622,27 @@ void RenderItemPickupMenu( ) //gprintfinvalidate( sNewX, sNewY, pStr ); } + if((UsingNewInventorySystem() == true)) + { + // CHRISL: Show astrisk for active LBENODE + if ( pObject->IsActiveLBE(0)) + { + SetFontForeground( FONT_BLUE ); + SetFontShadow( DEFAULT_SHADOW ); + + sNewY = sCenY + 2; + swprintf( pStr, L"*" ); + + // Get length of string + uiStringLength=StringPixLength( pStr, ITEM_FONT ); + + sNewX = sCenX + 43 - uiStringLength - 4; + + mprintf_buffer( pDestBuf, uiDestPitchBYTES, ITEMDESC_FONT, sNewX, sNewY, pStr ); + //gprintfinvalidate( sNewX, sNewY, pStr ); + } + } + if ( gItemPickupMenu.bCurSelect == ( cnt + gItemPickupMenu.ubScrollAnchor ) ) { //SetFontForeground( ITEMDESC_FONTSHADOW2 ); @@ -6808,7 +7673,7 @@ void RenderItemPickupMenu( ) if ( Item[ pObject->usItem ].usItemClass == IC_MONEY ) { CHAR16 pStr2[20]; - swprintf( pStr2, L"%ld", pObject->ItemData.Money.uiMoneyAmount ); + swprintf( pStr2, L"%ld", (*pObject)[0]->data.money.uiMoneyAmount ); InsertCommasForDollarFigure( pStr2 ); InsertDollarSignInToString( pStr2 ); @@ -6854,7 +7719,7 @@ void RemoveItemPickupMenu( ) PauseTime( FALSE ); // Unfreese guy! - gItemPickupMenu.pSoldier->fPauseAllAnimation = FALSE; + gItemPickupMenu.pSoldier->flags.fPauseAllAnimation = FALSE; // Remove graphics! DeleteVideoObjectFromIndex( gItemPickupMenu.uiPanelVo ); @@ -6897,7 +7762,7 @@ void RemoveItemPickupMenu( ) // Set cursor back to normal mode... - guiPendingOverrideEvent = A_CHANGE_TO_MOVE; + guiPendingOverrideEvent = A_CHANGE_TO_MOVE; // Rerender world SetRenderFlags( RENDER_FLAG_FULL ); @@ -6913,7 +7778,7 @@ void RemoveItemPickupMenu( ) // Turn off Ignore scrolling gfIgnoreScrolling = FALSE; - DisableTacticalTeamPanelButtons( FALSE ); + DisableTacticalTeamPanelButtons( FALSE ); gubSelectSMPanelToMerc = gpSMCurrentMerc->ubID; } @@ -6935,7 +7800,7 @@ void ItemPickupScrollUp( GUI_BUTTON *btn, INT32 reason ) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); } - + } @@ -7000,7 +7865,6 @@ void ItemPickupAll( GUI_BUTTON *btn, INT32 reason ) void ItemPickupOK( GUI_BUTTON *btn, INT32 reason ) { - INT32 cnt = 0; UINT16 usLastItem; if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) @@ -7019,8 +7883,8 @@ void ItemPickupOK( GUI_BUTTON *btn, INT32 reason ) usLastItem=gpOpponent->inv[HANDPOS].usItem; SoldierStealItemFromSoldier( gItemPickupMenu.pSoldier,gpOpponent,gItemPickupMenu.pItemPool, ITEM_PICKUP_SELECTION, gItemPickupMenu.sGridNo, gItemPickupMenu.bZLevel, gItemPickupMenu.pfSelectedArray ); DeletePool(gItemPickupMenu.pItemPool); - if ((gpOpponent->inv[HANDPOS].usItem == NOTHING ) && (usLastItem!=NOTHING)) - ReLoadSoldierAnimationDueToHandItemChange( gpOpponent, usLastItem, NOTHING ); + if ((gpOpponent->inv[HANDPOS].exists() == false ) && (usLastItem!=NOTHING)) + gpOpponent->ReLoadSoldierAnimationDueToHandItemChange( usLastItem, NOTHING ); // PreventFromTheFreezingBug(gItemPickupMenu.pSoldier); } @@ -7038,7 +7902,6 @@ void ItemPickupOK( GUI_BUTTON *btn, INT32 reason ) void ItemPickupCancel( GUI_BUTTON *btn, INT32 reason ) { - INT32 cnt = 0; if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { @@ -7093,23 +7956,27 @@ void ItemPickMenuMouseMoveCallback( MOUSE_REGION * pRegion, INT32 iReason ) pTempItemPool = gItemPickupMenu.ItemPoolSlots[ gItemPickupMenu.bCurSelect - gItemPickupMenu.ubScrollAnchor ]; // Nonomori: Fix crash caused by stealing ammo in a sector with no items loaded. - // memcpy( &(gItemPickupMenu.CompAmmoObject), &( gWorldItems[ pTempItemPool->iItemIndex ].o ), sizeof( OBJECTTYPE ) ); - OBJECTTYPE * pCompAmmoObject = (OBJECTTYPE *) MemAlloc( sizeof( OBJECTTYPE ) ); + // gItemPickupMenu.CompAmmoObject = gWorldItems[ pTempItemPool->iItemIndex ].object; if ( gWorldItems && gWorldItems[ pTempItemPool->iItemIndex ].fExists ) - pCompAmmoObject = &( gWorldItems[ pTempItemPool->iItemIndex ].o ); + { + gItemPickupMenu.CompAmmoObject = gWorldItems[ pTempItemPool->iItemIndex ].object ; + } else - CreateItem( pTempItemPool->iItemIndex, 100, pCompAmmoObject); - memcpy( &(gItemPickupMenu.CompAmmoObject), pCompAmmoObject, sizeof( OBJECTTYPE ) ); + { + OBJECTTYPE pCompAmmoObject; + CreateItem( pTempItemPool->iItemIndex, 100, &pCompAmmoObject); + gItemPickupMenu.CompAmmoObject = pCompAmmoObject; + } // Turn off first... HandleAnyMercInSquadHasCompatibleStuff( (INT8) CurrentSquad( ), NULL, TRUE ); InternalHandleCompatibleAmmoUI( gpSMCurrentMerc, &( gItemPickupMenu.CompAmmoObject ), TRUE ); // Nonomori: Fix crash caused by stealing ammo in a sector with no items loaded. - // HandleAnyMercInSquadHasCompatibleStuff( (INT8)CurrentSquad( ), &(gWorldItems[ pTempItemPool->iItemIndex ].o ), FALSE ); + // HandleAnyMercInSquadHasCompatibleStuff( (INT8)CurrentSquad( ), &(gWorldItems[ pTempItemPool->iItemIndex ].object ), FALSE ); HandleAnyMercInSquadHasCompatibleStuff( (INT8)CurrentSquad( ), pCompAmmoObject, FALSE ); */ - + SetItemPickupMenuDirty( DIRTYLEVEL2 ); @@ -7338,45 +8205,55 @@ void BtnMoneyButtonCallback(GUI_BUTTON *btn,INT32 reason) InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} void RemoveMoney() { if( gRemoveMoney.uiMoneyRemoving != 0 ) { + //CHRISL: If what we have in the cursor is more money, just add to what we have in the cursor. + if (gpItemPointer != NULL && gpItemPointer->exists() == true && gpItemPointer->usItem != MONEY) { + //ADB oops, let's not overwrite what's on the cursor! + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Unable to split money due to having an item on your cursor." ); + + //after this returns it will call DeleteItemDescriptionBox which will totally destroy the remaining money + //if the uiMoneyRemaining is 0, so reset it, because we aren't moving anything! + gRemoveMoney.uiMoneyRemaining = gRemoveMoney.uiTotalAmount; + gRemoveMoney.uiMoneyRemoving = 0; + + return; + } //if we are in the shop keeper interface if( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) { INVENTORY_IN_SLOT InvSlot; - memset( &InvSlot, 0, sizeof(INVENTORY_IN_SLOT) ); - InvSlot.fActive = TRUE; InvSlot.sItemIndex = MONEY; InvSlot.bSlotIdInOtherLocation = -1; - //Remove the money from the money in the pocket - gpItemDescObject->ItemData.Money.uiMoneyAmount = gRemoveMoney.uiMoneyRemaining; - - //Create an item to get the money that is being removed - CreateItem( MONEY, 0, &InvSlot.ItemObject ); + //Create an item to get the money that is being removed + CreateMoney(gRemoveMoney.uiMoneyRemoving, &InvSlot.ItemObject ); //Set the amount thast is being removed - InvSlot.ItemObject.ItemData.Money.uiMoneyAmount = gRemoveMoney.uiMoneyRemoving; InvSlot.ubIdOfMercWhoOwnsTheItem = gpItemDescSoldier->ubProfile; //if we are removing money from the players account if( gfAddingMoneyToMercFromPlayersAccount ) { - gpItemDescObject->ItemData.Money.uiMoneyAmount = gRemoveMoney.uiMoneyRemoving; + (*gpItemDescObject)[0]->data.money.uiMoneyAmount = gRemoveMoney.uiMoneyRemoving; //take the money from the player - AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, gpSMCurrentMerc->ubProfile, GetWorldTotalMin() , -(INT32)( gpItemDescObject->ItemData.Money.uiMoneyAmount ) ); + AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, gpSMCurrentMerc->ubProfile, GetWorldTotalMin() , -(INT32)( gRemoveMoney.uiMoneyRemoving ) ); + } + else { + //Remove the money from the money in the pocket + (*gpItemDescObject)[0]->data.money.uiMoneyAmount = gRemoveMoney.uiMoneyRemaining; } - memcpy( &gMoveingItem, &InvSlot, sizeof( INVENTORY_IN_SLOT ) ); + gMoveingItem = InvSlot; - memcpy( &gItemPointer, &InvSlot.ItemObject, sizeof( OBJECTTYPE ) ); + gItemPointer = InvSlot.ItemObject; gpItemPointer = &gItemPointer; gpItemPointerSoldier = gpSMCurrentMerc; @@ -7388,8 +8265,17 @@ void RemoveMoney() } else { - CreateMoney( gRemoveMoney.uiMoneyRemoving, &gItemPointer ); - gpItemPointer = &gItemPointer; + if(gpItemPointer->exists() == true) + { + CreateMoney( gRemoveMoney.uiMoneyRemoving, &gTempObject ); + gItemPointer.AddObjectsToStack(gTempObject, -1, 0, NUM_INV_SLOTS, MAX_OBJECTS_PER_SLOT); + gpItemPointer = &gItemPointer; + } + else + { + CreateMoney( gRemoveMoney.uiMoneyRemoving, &gItemPointer ); + gpItemPointer = &gItemPointer; + } //Asign the soldier to be the currently selected soldier gpItemPointerSoldier = gpItemDescSoldier; @@ -7397,13 +8283,13 @@ void RemoveMoney() //if we are removing money from the players account if( gfAddingMoneyToMercFromPlayersAccount ) { - gpItemDescObject->ItemData.Money.uiMoneyAmount = gRemoveMoney.uiMoneyRemoving; + (*gpItemDescObject)[0]->data.money.uiMoneyAmount = gRemoveMoney.uiMoneyRemoving; //take the money from the player - AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, gpSMCurrentMerc->ubProfile, GetWorldTotalMin() , -(INT32)( gpItemDescObject->ItemData.Money.uiMoneyAmount ) ); + AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, gpSMCurrentMerc->ubProfile, GetWorldTotalMin() , -(INT32)(gRemoveMoney.uiMoneyRemoving) ); } else - gpItemDescObject->ItemData.Money.uiMoneyAmount = gRemoveMoney.uiMoneyRemaining; + (*gpItemDescObject)[0]->data.money.uiMoneyAmount = gRemoveMoney.uiMoneyRemaining; @@ -7413,7 +8299,7 @@ void RemoveMoney() guiExternVo = GetInterfaceGraphicForItem( &(Item[ gpItemPointer->usItem ]) ); gusExternVoSubIndex = Item[ gpItemPointer->usItem ].ubGraphicNum; - MSYS_ChangeRegionCursor( &gMPanelRegion , EXTERN_CURSOR ); + MSYS_ChangeRegionCursor( &gMPanelRegion , EXTERN_CURSOR ); MSYS_SetCurrentCursor( EXTERN_CURSOR ); fMapInventoryItem=TRUE; fTeamPanelDirty=TRUE; @@ -7427,24 +8313,17 @@ void RemoveMoney() } -BOOLEAN AttemptToApplyCamo( SOLDIERTYPE *pSoldier, UINT16 usItemIndex ) +void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier, int subObject ) { - return( FALSE ); -} - - - - -void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier ) -{ - CHAR16 pStr[ 250 ]; + CHAR16 pStr[ 250 ]; UINT16 usItem = pObject->usItem; - INT32 cnt = 0; INT32 iNumAttachments = 0; + INT16 sValue; + FLOAT fWeight; if( pSoldier != NULL ) { - if ( pSoldier->uiStatusFlags & SOLDIER_DEAD ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) { swprintf( pStr, L"" ); swprintf( pzStr, L"%s", pStr ); @@ -7457,8 +8336,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier Remove when fixed! */ # if defined( _DEBUG ) - if ( (pObject->ItemData.Gun.ubGunAmmoType >= MAXITEMS) - ) + if ( ((*pObject)[0]->data.gun.ubGunAmmoType >= MAXITEMS) ) { DebugMsg(TOPIC_JA2, DBG_LEVEL_1, String( "corrupted pObject (%S) found in GetHelpTextForItem()", (usItemexists() == true ) { // Retrieve the status of the items - // Find the minimum status value - not just the first one - INT16 sValue = pObject->ItemData.Generic.bStatus[ 0 ]; + //CHRISL: If looking at an item in stack popup, show just that item + //CHRISL: Also, determine weight differently if we're looking at a single item in a stack + if(subObject == -1){ + // Find the minimum status value - not just the first one + sValue = (*pObject)[0]->data.objectStatus; - for(INT16 i = 1; i < pObject->ubNumberOfObjects; i++) - { - if(pObject->ItemData.Generic.bStatus[ i ] < sValue) - { - sValue = pObject->ItemData.Generic.bStatus[ i ]; + for(INT16 i = 1; i < pObject->ubNumberOfObjects; i++){ + if((*pObject)[ i ]->data.objectStatus < sValue) + { + sValue = (*pObject)[ i ]->data.objectStatus; + } } + //get item weight + fWeight = (float)(CalculateObjectWeight( pObject )) / 10; + subObject = 0; + } + else { + sValue = (*pObject)[subObject]->data.objectStatus; + fWeight = (float)(pObject->GetWeightOfObjectInStack(subObject)) / 10; } - - //get item weight - FLOAT fWeight = (float)(CalculateObjectWeight( pObject )) / 10; if ( !gGameSettings.fOptions[ TOPTION_USE_METRIC_SYSTEM ] ) // metric units not enabled { @@ -7495,16 +8379,12 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight = 0.1f; } - - if ( Item[usItem].usItemClass != IC_AMMO || !gGameExternalOptions.fAmmoDynamicWeight ) //Madd: quick fix to display total stack weight - fWeight *= pObject->ubNumberOfObjects; - switch( Item[ usItem ].usItemClass ) { case MONEY: //Money - { - swprintf( pStr, L"%ld", pObject->ItemData.Money.uiMoneyAmount ); + { + swprintf( pStr, L"%ld", (*pObject)[subObject]->data.money.uiMoneyAmount ); InsertCommasForDollarFigure( pStr ); InsertDollarSignInToString( pStr ); } @@ -7513,9 +8393,9 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier case IC_MONEY: // alternate money like silver or gold //if ( Item[ usItem ].usItemClass == IC_MONEY ) - { + { CHAR16 pStr2[20]; - swprintf( pStr2, L"%ld", pObject->ItemData.Money.uiMoneyAmount ); + swprintf( pStr2, L"%ld", (*pObject)[subObject]->data.money.uiMoneyAmount ); InsertCommasForDollarFigure( pStr2 ); InsertDollarSignInToString( pStr2 ); @@ -7560,17 +8440,17 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier } //Info for weapons - swprintf( pStr, L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s %s\n%s %1.1f %s", - ItemNames[ usItem ], - AmmoCaliber[ Weapon[ usItem ].ubCalibre ], - sValue, + swprintf( pStr, L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s %s\n%s %1.1f %s", + ItemNames[ usItem ], + AmmoCaliber[ Weapon[ usItem ].ubCalibre ], + sValue, gWeaponStatsDesc[ 9 ], //Accuracy String Weapon[ usItem ].bAccuracy, gWeaponStatsDesc[ 11 ], //Damage String - GetDamage(pObject), + GetDamage(pObject), gWeaponStatsDesc[ 10 ], //Range String gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject )/10 : GunRange( pObject ), //Modified Range - gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? Weapon[ usItem ].usRange/10 : Weapon[ usItem ].usRange, //Gun Range + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? Weapon[ usItem ].usRange/10 : Weapon[ usItem ].usRange, //Gun Range gWeaponStatsDesc[ 5 ], //AP String apStr, //AP's gWeaponStatsDesc[ 12 ], //Weight String @@ -7610,16 +8490,16 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier } //Info for weapons - swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s %s\n%s %1.1f %s", - ItemNames[ usItem ], - sValue, + swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s %s\n%s %1.1f %s", + ItemNames[ usItem ], + sValue, gWeaponStatsDesc[ 9 ], //Accuracy String Weapon[ usItem ].bAccuracy, gWeaponStatsDesc[ 11 ], //Damage String - GetDamage(pObject), + GetDamage(pObject), gWeaponStatsDesc[ 10 ], //Range String gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject )/10 : GunRange( pObject ), //Modified Range - gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? Weapon[ usItem ].usRange/10 : Weapon[ usItem ].usRange, //Gun Range + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? Weapon[ usItem ].usRange/10 : Weapon[ usItem ].usRange, //Gun Range gWeaponStatsDesc[ 5 ], //AP String apStr, //AP's gWeaponStatsDesc[ 12 ], //Weight String @@ -7633,9 +8513,9 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier case IC_THROWING_KNIFE: case IC_PUNCH: { - swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s", - ItemNames[ usItem ], - sValue, + swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s", + ItemNames[ usItem ], + sValue, gWeaponStatsDesc[ 11 ], //Damage String GetDamage(pObject), //Melee damage gWeaponStatsDesc[ 5 ], //AP String @@ -7649,22 +8529,22 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier case IC_AMMO: { - // The next is for ammunition which gets the measurement 'rnds' - swprintf( pStr, L"%s [%d rnds]\n%s %1.1f %s", + // The next is for ammunition which gets the measurement 'rnds' + swprintf( pStr, L"%s [%d rnds]\n%s %1.1f %s", ItemNames[ usItem ], //Item long name - pObject->ItemData.Ammo.ubShotsLeft[0], //Shots left + (*pObject)[subObject]->data.ubShotsLeft, //Shots left gWeaponStatsDesc[ 12 ], //Weight String fWeight, //Weight GetWeightUnitString() //Weight units ); //Lal: do not delete, commented out for next version - //swprintf( pStr, L"%s %s %s %d [%d rnds]\n%s %1.1f %s", + //swprintf( pStr, L"%s %s %s %d [%d rnds]\n%s %1.1f %s", // AmmoCaliber[ Magazine[ Item[usItem].ubClassIndex ].ubCalibre ], //Ammo calibre // AmmoTypes[Magazine[ Item[usItem].ubClassIndex ].ubAmmoType].ammoName, //Ammo type // MagNames[Magazine[ Item[usItem].ubClassIndex ].ubMagType], //Magazine type // Magazine[ Item[usItem].ubClassIndex ].ubMagSize, //Magazine capacity - // pObject->ubShotsLeft[0], //Shots left + // (*pObject)[0]->data.ubShotsLeft, //Shots left // gWeaponStatsDesc[ 12 ], //Weight String // fWeight, //Weight // GetWeightUnitString() //Weight units @@ -7674,16 +8554,16 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier case IC_GRENADE: case IC_BOMB: - // explosives + // explosives { UINT16 explDamage = (UINT16)( Explosive[Item[ usItem ].ubClassIndex].ubDamage + ( (double) Explosive[Item[ usItem ].ubClassIndex].ubDamage / 100) * gGameExternalOptions.ubExplosivesDamageMultiplier ); UINT16 explStunDamage = (UINT16)( Explosive[Item[ usItem ].ubClassIndex].ubStunDamage + ( (double) Explosive[Item[ usItem ].ubClassIndex].ubStunDamage / 100) * gGameExternalOptions.ubExplosivesDamageMultiplier ); - swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s", - ItemNames[ usItem ], - sValue, + swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s", + ItemNames[ usItem ], + sValue, gWeaponStatsDesc[ 11 ], //Damage String - explDamage, + explDamage, gWeaponStatsDesc[ 13 ], //Stun Damage String explStunDamage, //Stun Damage gWeaponStatsDesc[ 12 ], //Weight String @@ -7717,7 +8597,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier break; } - swprintf( pStr, L"%s [%d%%]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s", + swprintf( pStr, L"%s [%d%%]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s", ItemNames[ usItem ], //Item long name sValue, //Item condition pInvPanelTitleStrings[ 4 ], //Protection string @@ -7741,7 +8621,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier default: { // The final, and typical case, is that of an item with a percent status - swprintf( pStr, L"%s [%d%%]\n%s %1.1f %s", + swprintf( pStr, L"%s [%d%%]\n%s %1.1f %s", ItemNames[ usItem ], //Item long name sValue, //Item condition gWeaponStatsDesc[ 12 ], //Weight String @@ -7754,32 +8634,28 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier // Fingerprint ID (Soldier Name) - if ( ( Item[pObject->usItem].fingerprintid ) && pObject->ubImprintID < NO_PROFILE ) + if ( ( Item[pObject->usItem].fingerprintid ) && (*pObject)[subObject]->data.ubImprintID < NO_PROFILE ) { CHAR16 pStr2[20]; - swprintf( pStr2, L" [%s]", gMercProfiles[ pObject->ubImprintID ].zNickname ); + swprintf( pStr2, L" [%s]", gMercProfiles[ (*pObject)[subObject]->data.ubImprintID ].zNickname ); wcscat( pStr, pStr2 ); } // Add attachment string.... - for ( cnt = 0; cnt < MAX_ATTACHMENTS; cnt++ ) - { - if ( pObject->usAttachItem[ cnt ] != NOTHING ) - { - iNumAttachments++; + for (attachmentList::iterator iter = (*pObject)[subObject]->attachments.begin(); iter != (*pObject)[subObject]->attachments.end(); ++iter) { + iNumAttachments++; - if ( iNumAttachments == 1 ) - { - wcscat( pStr, L"\n[" ); - } - else - { - wcscat( pStr, L", " ); - } - - wcscat( pStr, ItemNames[ pObject->usAttachItem[ cnt ] ] ); + if ( iNumAttachments == 1 ) + { + wcscat( pStr, L"\n[" ); } + else + { + wcscat( pStr, L", " ); + } + + wcscat( pStr, ItemNames[ iter->usItem ] ); } if ( iNumAttachments > 0 ) @@ -7790,7 +8666,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier } else { - swprintf( pStr, L"" ); + swprintf( pStr, L"" ); } // Copy over... @@ -7802,26 +8678,6 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier -UINT8 GetPrefferedItemSlotGraphicNum( UINT16 usItem ) -{ - // Check for small item... - if ( Item[usItem].ubPerPocket >= 1 ) - { - // Small - return( 2 ); - } - - // Now it could be large or armour, check class... - if ( Item[ usItem ].usItemClass == IC_ARMOUR ) - { - return( 1 ); - } - - // OK, it's a big one... - return( 0 ); -} - - void CancelItemPointer( ) { // ATE: If we have an item pointer end it! @@ -7832,58 +8688,43 @@ void CancelItemPointer( ) // Place it back in our hands! PlaceObject( gpItemPointerSoldier, gbItemPointerSrcSlot, gpItemPointer ); - // ATE: This could potnetially swap! - // Make sure # of items is 0, if not, auto place somewhere else... - if ( gpItemPointer->ubNumberOfObjects > 0 ) - { + // ATE: This could potnetially swap! + // Make sure # of items is 0, if not, auto place somewhere else... + if ( gpItemPointer->exists() == true ) + { if ( !AutoPlaceObject( gpItemPointerSoldier, gpItemPointer, FALSE ) ) - { - // Alright, place of the friggen ground! - AddItemToPool( gpItemPointerSoldier->sGridNo, gpItemPointer, 1, gpItemPointerSoldier->bLevel, 0 , -1 ); - NotifySoldiersToLookforItems( ); - } - } + { + // Alright, place of the friggen ground! + AddItemToPool( gpItemPointerSoldier->sGridNo, gpItemPointer, 1, gpItemPointerSoldier->pathing.bLevel, 0 , -1 ); + NotifySoldiersToLookforItems( ); + } + } } else { // We drop it here..... - AddItemToPool( gpItemPointerSoldier->sGridNo, gpItemPointer, 1, gpItemPointerSoldier->bLevel, 0 , -1 ); + AddItemToPool( gpItemPointerSoldier->sGridNo, gpItemPointer, 1, gpItemPointerSoldier->pathing.bLevel, 0 , -1 ); NotifySoldiersToLookforItems( ); } EndItemPointer( ); } -} - - -typedef struct -{ - OBJECTTYPE ItemPointerInfo; - UINT8 ubSoldierID; - UINT8 ubInvSlot; - BOOLEAN fCursorActive; - INT8 bPadding[5]; - -} ITEM_CURSOR_SAVE_INFO; +} BOOLEAN LoadItemCursorFromSavedGame( HWFILE hFile ) { - UINT32 uiLoadSize=0; - UINT32 uiNumBytesRead=0; ITEM_CURSOR_SAVE_INFO SaveStruct; // Load structure - uiLoadSize = sizeof( ITEM_CURSOR_SAVE_INFO ); - FileRead( hFile, &SaveStruct, uiLoadSize, &uiNumBytesRead ); - if( uiNumBytesRead != uiLoadSize ) + if ( !SaveStruct.Load(hFile) ) { return( FALSE ); } // Now set things up..... // Copy object - memcpy( &gItemPointer, &(SaveStruct.ItemPointerInfo), sizeof( OBJECTTYPE ) ); - + gItemPointer = (SaveStruct.ItemPointerInfo); + // Copy soldier ID if ( SaveStruct.ubSoldierID == NOBODY ) { @@ -7913,14 +8754,10 @@ BOOLEAN LoadItemCursorFromSavedGame( HWFILE hFile ) BOOLEAN SaveItemCursorToSavedGame( HWFILE hFile ) { - UINT32 uiSaveSize=0; - UINT32 uiNumBytesWritten=0; - ITEM_CURSOR_SAVE_INFO SaveStruct; // Setup structure; - memset( &SaveStruct, 0, sizeof( ITEM_CURSOR_SAVE_INFO ) ); - memcpy( &(SaveStruct.ItemPointerInfo), &gItemPointer, sizeof( OBJECTTYPE ) ); + SaveStruct.ItemPointerInfo = gItemPointer; // Soldier if ( gpItemPointerSoldier != NULL ) @@ -7946,9 +8783,7 @@ BOOLEAN SaveItemCursorToSavedGame( HWFILE hFile ) } // save locations of watched points - uiSaveSize = sizeof( ITEM_CURSOR_SAVE_INFO ); - FileWrite( hFile, &SaveStruct, uiSaveSize, &uiNumBytesWritten ); - if( uiNumBytesWritten != uiSaveSize ) + if( !SaveStruct.Save(hFile) ) { return( FALSE ); } @@ -7990,20 +8825,19 @@ BOOLEAN InitializeStealItemPickupMenu( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOppo VOBJECT_DESC VObjectDesc; CHAR8 ubString[48]; INT16 sCenX, sCenY, sX, sY, sCenterYVal; - INT8 bZLevel =pOpponent->bLevel; + INT8 bZLevel =pOpponent->pathing.bLevel; INT16 sGridNo =pOpponent->sGridNo; INT32 cnt; gpOpponent =pOpponent; gfStealing =TRUE; - + // Erase other menus.... EraseInterfaceMenus( TRUE ); // Make sure menu is located if not on screen LocateSoldier( pOpponent->ubID, FALSE ); - // memset values - memset( &gItemPickupMenu, 0, sizeof( gItemPickupMenu ) ); + gItemPickupMenu.initialize(); //Set item pool value gItemPickupMenu.pItemPool = pItemPool; @@ -8056,8 +8890,8 @@ BOOLEAN InitializeStealItemPickupMenu( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOppo } else { - sX = 0; - sY = 0; + sX = 0; + sY = 0; } // CHECK FOR LEFT/RIGHT @@ -8115,7 +8949,7 @@ BOOLEAN InitializeStealItemPickupMenu( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOppo // Build a mouse region here that is over any others..... MSYS_DefineRegion( &(gItemPickupMenu.BackRegion ), (INT16)( iScreenWidthOffset + 532 ), (INT16)( iScreenHeightOffset + 367 ), (INT16)( SCREEN_WIDTH ),(INT16)( SCREEN_HEIGHT ), MSYS_PRIORITY_HIGHEST, - CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); // Add region MSYS_AddRegion( &(gItemPickupMenu.BackRegion ) ); @@ -8123,7 +8957,7 @@ BOOLEAN InitializeStealItemPickupMenu( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOppo // Build a mouse region here that is over any others..... MSYS_DefineRegion( &(gItemPickupMenu.BackRegions ), (INT16)(gItemPickupMenu.sX ), (INT16)(gItemPickupMenu.sY), (INT16)(gItemPickupMenu.sX + gItemPickupMenu.sWidth ),(INT16)( gItemPickupMenu.sY + gItemPickupMenu.sHeight ), MSYS_PRIORITY_HIGHEST, - CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); // Add region MSYS_AddRegion( &(gItemPickupMenu.BackRegions ) ); @@ -8176,7 +9010,7 @@ BOOLEAN InitializeStealItemPickupMenu( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOppo { // Build a mouse region here that is over any others..... MSYS_DefineRegion( &(gItemPickupMenu.Regions[cnt]), (INT16)(sCenX ), (INT16)(sCenY + 1), (INT16)(sCenX + gItemPickupMenu.sWidth ),(INT16)( sCenY + ITEMPICK_GRAPHIC_YSPACE ), MSYS_PRIORITY_HIGHEST, - CURSOR_NORMAL, ItemPickMenuMouseMoveCallback, ItemPickMenuMouseClickCallback ); + CURSOR_NORMAL, ItemPickMenuMouseMoveCallback, ItemPickMenuMouseClickCallback ); // Add region MSYS_AddRegion( &(gItemPickupMenu.Regions[cnt]) ); MSYS_SetRegionUserData( &(gItemPickupMenu.Regions[cnt]), 0, cnt ); diff --git a/Tactical/Interface Items.h b/Tactical/Interface Items.h index bd1f7e5b..5fbab870 100644 --- a/Tactical/Interface Items.h +++ b/Tactical/Interface Items.h @@ -38,6 +38,39 @@ typedef struct } INV_REGION_DESC; +class OLD_ITEM_CURSOR_SAVE_INFO_101 +{ +public: + OLD_OBJECTTYPE_101 ItemPointerInfo; + UINT8 ubSoldierID; + UINT8 ubInvSlot; + BOOLEAN fCursorActive; + INT8 bPadding[5]; + +}; + + +class ITEM_CURSOR_SAVE_INFO +{ +public: + ITEM_CURSOR_SAVE_INFO& operator=(OLD_ITEM_CURSOR_SAVE_INFO_101& src) + { + this->fCursorActive = src.fCursorActive; + this->ItemPointerInfo = src.ItemPointerInfo; + this->ubInvSlot = src.ubInvSlot; + this->ubSoldierID = src.ubSoldierID; + return *this; + } + //could use a little tidying up + BOOLEAN Save(HWFILE hFile); + BOOLEAN Load(HWFILE hFile); + + UINT8 ubSoldierID; + UINT8 ubInvSlot; + BOOLEAN fCursorActive; + OBJECTTYPE ItemPointerInfo; +}; + // Itempickup stuff BOOLEAN InitializeItemPickupMenu( SOLDIERTYPE *pSoldier, INT16 sGridNo, ITEM_POOL *pItemPool, INT16 sScreenX, INT16 sScreenY, INT8 bZLevel ); void RenderItemPickupMenu( ); @@ -70,22 +103,35 @@ BOOLEAN HandleCompatibleAmmoUI( SOLDIERTYPE *pSoldier, INT8 bInvPos, BOOLEAN fOn // uiBuffer - The Dest Video Surface - can only be FRAME_BUFFER or guiSAVEBUFFER // pSoldier - used for determining whether burst mode needs display // pObject - Usually taken from pSoldier->inv[HANDPOS] -// sX, sY, Width, Height, - Will Center it in the Width -// fDirtyLevel if == DIRTYLEVEL2 will render everything +// sX, sY, Width, Height, - Will Center it in the Width +// fDirtyLevel if == DIRTYLEVEL2 will render everything // if == DIRTYLEVEL1 will render bullets and status only // // pubHighlightCounter - if not null, and == 2 - will display name above item // - if == 1 will only dirty the name space and then set counter to 0 -// Last parameter used mainly for when mouse is over item +// Last parameter used mainly for when mouse is over item + +void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObject, INT16 sX, INT16 sY, INT16 sWidth, INT16 sHeight, UINT8 fDirtyLevel, UINT8 *pubHighlightCounter, UINT8 ubStatusIndex, BOOLEAN fOutline, INT16 sOutlineColor, UINT8 iter = 0 ); +// CHRISL: Add a new function that will be used to render a pocket silhouette +void INVRenderSilhouette( UINT32 uiBugger, INT16 PocketIndex, INT16 SilIndex, INT16 sX, INT16 sY, INT16 sWideth, INT16 sHeight); +// CHRISL: New function to handle display of inventory quantities based on item current in cursor +void RenderPocketItemCapacity( UINT8 pCapacity, INT16 bPos, SOLDIERTYPE *pSoldier ); +// CHRISL: New function to display items stored in an LBENODE +void RenderLBENODEItems( OBJECTTYPE *pObj, int subObject ); +// CHRISL: New function to setup GSMInvData based on game options +void InitInvData(INV_REGIONS &InvData, BOOLEAN fBigPocket, INT16 sBarDx, INT16 sBarDy, INT16 sWidth, INT16 sHeight, INT16 sX, INT16 sY); +void InitInventoryOld(); +void InitInventoryNew(); +void InitInventoryVehicle(INV_REGION_DESC *pRegionDesc, MOUSE_CALLBACK INVMoveCallback, MOUSE_CALLBACK INVClickCallback, BOOLEAN fSetHighestPrioity); +void InitInventorySoldier(INV_REGION_DESC *pRegionDesc, MOUSE_CALLBACK INVMoveCallback, MOUSE_CALLBACK INVClickCallback, BOOLEAN fSetHighestPrioity); -void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObject, INT16 sX, INT16 sY, INT16 sWidth, INT16 sHeight, UINT8 fDirtyLevel, UINT8 *pubHighlightCounter, UINT8 ubStatusIndex, BOOLEAN fOutline, INT16 sOutlineColor ); extern BOOLEAN gfInItemDescBox; BOOLEAN InItemDescriptionBox( ); BOOLEAN InitItemDescriptionBox( SOLDIERTYPE *pSoldier, UINT8 ubPosition, INT16 sX, INT16 sY, UINT8 ubStatusIndex ); -BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, UINT8 ubStatusIndex, SOLDIERTYPE *pSoldier ); +BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, UINT8 ubStatusIndex, SOLDIERTYPE *pSoldier, UINT8 ubPosition = NUM_INV_SLOTS ); BOOLEAN InitKeyItemDescriptionBox( SOLDIERTYPE *pSoldier, UINT8 ubPosition, INT16 sX, INT16 sY, UINT8 ubStatusIndex ); void RenderItemDescriptionBox( ); void HandleItemDescriptionBox( BOOLEAN *pfDirty ); @@ -128,17 +174,13 @@ void DrawItemFreeCursor( ); void DrawItemTileCursor( ); void HideItemTileCursor( ); void InitItemInterface( ); -BOOLEAN ItemCursorInLobRange( UINT16 usMapPos ); -BOOLEAN HandleItemPointerClick( UINT16 usMapPos ); +BOOLEAN ItemCursorInLobRange( INT16 sMapPos ); +BOOLEAN HandleItemPointerClick( INT16 sMapPos ); UINT32 GetInterfaceGraphicForItem( INVTYPE *pItem ); UINT16 GetTileGraphicForItem( INVTYPE *pItem ); BOOLEAN LoadTileGraphicForItem( INVTYPE *pItem, UINT32 *puiVo ); -void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier ); - -BOOLEAN AttemptToApplyCamo( SOLDIERTYPE *pSoldier, UINT16 usItemIndex ); - -UINT8 GetPrefferedItemSlotGraphicNum( UINT16 usItem ); +void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier, int subObject = -1 ); void CancelItemPointer( ); @@ -149,11 +191,11 @@ void EnableKeyRing( BOOLEAN fEnable ); // handle compatable items for merc and map inventory BOOLEAN HandleCompatibleAmmoUIForMapScreen( SOLDIERTYPE *pSoldier, INT32 bInvPos, BOOLEAN fOn, BOOLEAN fFromMerc ); -BOOLEAN HandleCompatibleAmmoUIForMapInventory( SOLDIERTYPE *pSoldier, INT32 bInvPos, INT32 iStartSlotNumber, BOOLEAN fOn, BOOLEAN fFromMerc ); +BOOLEAN HandleCompatibleAmmoUIForMapInventory( SOLDIERTYPE *pSoldier, INT32 bInvPos, INT32 iStartSlotNumber, BOOLEAN fOn, BOOLEAN fFromMerc ); void ResetCompatibleItemArray( ); -void CycleItemDescriptionItem( ); +void CycleItemDescriptionItem( INT16 sX, INT16 sY ); BOOLEAN InitializeStealItemPickupMenu( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, ITEM_POOL *pItemPool, UINT8 ubCount); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index 0780c1e4..46d2111f 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -4,8 +4,8 @@ #include "builddefines.h" #include #include - #include - #include "sgp.h" + #include + #include "sgp.h" #include "gameloop.h" #include "himage.h" #include "vobject.h" @@ -34,7 +34,7 @@ #include "weapons.h" #include "lighting.h" #include "faces.h" - #include "mapscreen.h" + #include "mapscreen.h" #include "message.h" #include "text.h" #include "Interface Items.h" @@ -74,45 +74,53 @@ #include "Boxing.h" #endif -/* +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + +/* * * SINGLE MERC BAR COORDS * * - * My opinion about this bars and GUI - * i would be very happy if we had c++ classes then we could made somethis like modules - * and peoples could very easly make their ow panels, button, labels and other - * i have got some ideas but it will tak some time to implement then. - * it will be hard and time consuming but maby i will show ya all direction how i would - * do it and peoples will continue that path :) joker + * My opinion about this bars and GUI + * i would be very happy if we had c++ classes then we could made somethis like modules + * and peoples could very easly make their ow panels, button, labels and other + * i have got some ideas but it will tak some time to implement then. + * it will be hard and time consuming but maby i will show ya all direction how i would + * do it and peoples will continue that path :) joker */ /* Ok so this array values had a constant initializer INV_INTERFACE_START_Y wich was constant - * we need do load SCREEN_WIDTH _HEIGHT from file to make JA more customizable so if we - * will make SCREEN_xxx viariable then xxx_INTERFACE_xxx will be also variable. - * When we declare static array like here (below) we need constant initializer but we need dynamic - * array so i declare only array and i will initielize it in run-time. - * any questions? - * joker + * we need do load SCREEN_WIDTH _HEIGHT from file to make JA more customizable so if we + * will make SCREEN_xxx viariable then xxx_INTERFACE_xxx will be also variable. + * When we declare static array like here (below) we need constant initializer but we need dynamic + * array so i declare only array and i will initielize it in run-time. + * any questions? + * joker */ -INV_REGION_DESC gSMInvPocketXY[19]; // ARRAY FOR INV PANEL INTERFACE ITEM POSITIONS +// CHRISL: Change key value to use dynamically generated NUM_INV_SLOTS instead of static setting +INV_REGION_DESC gSMInvPocketXY[NUM_INV_SLOTS]; // ARRAY FOR INV PANEL INTERFACE ITEM POSITIONS INV_REGION_DESC gSMCamoXY; // X, Y Location of cammo region -/* So this coords buttons, bars etc. also ware declered here as constant and we also need them - * more customizable in future so i just declare them and i will initialize them later - * any questions? joker +/* So this coords buttons, bars etc. also ware declered here as constant and we also need them + * more customizable in future so i just declare them and i will initialize them later + * any questions? joker */ int SM_ITEMDESC_START_X; int SM_ITEMDESC_START_Y; int SM_ITEMDESC_HEIGHT; int SM_ITEMDESC_WIDTH; +extern INT16 ITEMDESC_START_X; +extern INT16 ITEMDESC_START_Y; int SM_SELMERC_AP_X; int SM_SELMERC_AP_Y; int SM_SELMERC_AP_HEIGHT; int SM_SELMERC_AP_WIDTH; - + int SM_SELMERC_HEALTH_X; int SM_SELMERC_HEALTH_Y; int SM_SELMERC_HEALTH_WIDTH; @@ -184,6 +192,13 @@ int SM_DONE_X; int SM_DONE_Y; int SM_MAPSCREEN_X; int SM_MAPSCREEN_Y; +// CHRISL: backpack buttons +int SM_DROPPACK_X; +int SM_DROPPACK_Y; +int SM_ZIPPER_X; +int SM_ZIPPER_Y; +extern int INV_BDROP_X; +extern int INV_BDROP_Y; int SM_POSITIONB_X; int SM_POSITIONB_Y; @@ -241,22 +256,22 @@ int MONEY_Y; int MONEY_WIDTH; int MONEY_HEIGHT; -/* +/* * * TEAM BAR COORDS - * + * */ /* - * Now we have only 6 mercs in team but maby we will make it CUSTOMIZABLE hehe i like that word - * why we declare array with 12 items? coz we got 2 valuse x and y maby we can work it out - * and change INT16 to INV_REGION_DESC for ex. + * Now we have only 6 mercs in team but maby we will make it CUSTOMIZABLE hehe i like that word + * why we declare array with 12 items? coz we got 2 valuse x and y maby we can work it out + * and change INT16 to INV_REGION_DESC for ex. */ INT16 sTEAMAPPanelXY[12]; INT16 sTEAMFacesXY[12]; INT16 sTEAMNamesXY[12]; INT16 sTEAMFaceHighlXY[12]; -INT16 sTEAMLifeXY[12]; +INT16 sTEAMLifeXY[12]; INT16 sTEAMBreathXY[12]; INT16 sTEAMMoraleXY[12]; INT16 sTEAMApXY[12]; @@ -302,20 +317,34 @@ int INDICATOR_BOX_HEIGHT; MOUSE_REGION gSMPanelRegion; INT8 gbNewItem[ NUM_INV_SLOTS ]; TEAM_PANEL_SLOTS_TYPE gTeamPanel[ NUM_TEAM_SLOTS ]; -/* +/* * * VARIOUS PANELS COORDS * - * now its only clock and location name we will also make them ??? - * yes yes yes MORE CUSTOMIZABLE :P for moders - * i will work with radar screen to allow moving it. or maby someone else will do it - * any questions? joker + * now its only clock and location name we will also make them ??? + * yes yes yes MORE CUSTOMIZABLE :P for moders + * i will work with radar screen to allow moving it. or maby someone else will do it + * any questions? joker */ int INTERFACE_CLOCK_X; int INTERFACE_CLOCK_Y; int LOCATION_NAME_X; int LOCATION_NAME_Y; +/* CHRISL: Added new "TM" variables to allow team and inventory screens to place the clock and location name +independantly of each other */ +int INTERFACE_CLOCK_TM_X; +int INTERFACE_CLOCK_TM_Y; +int LOCATION_NAME_TM_X; +int LOCATION_NAME_TM_Y; + +// CHRISL: Keyring coords moved from Interface Items.cpp +int KEYRING_X; +int KEYRING_Y; +extern UINT32 guiCurrentItemDescriptionScreen; + +extern UINT32 guiCurrentItemDescriptionScreen; + typedef enum { @@ -334,6 +363,7 @@ typedef enum STANCE_IMAGES, DONE_IMAGES, MAPSCREEN_IMAGES, + BACKPACK_IMAGES, NUM_SM_BUTTON_IMAGES }; @@ -352,6 +382,12 @@ INT32 iTEAMPanelImages [ NUM_TEAM_BUTTON_IMAGES ]; INT32 giSMStealthImages = -1; INT32 giSMStealthButton = -1; +// CHRISL: Backpack buttons +INT32 giSMDropPackImages = -1; +INT32 giSMDropPackButton = -1; +INT32 giSMZipperImages = -1; +INT32 giSMZipperButton = -1; + BOOLEAN gfSwitchPanel = FALSE; UINT8 gbNewPanel = SM_PANEL; UINT8 gubNewPanelParam = 0; @@ -381,9 +417,8 @@ extern BOOLEAN gfInItemPickupMenu; extern void HandleAnyMercInSquadHasCompatibleStuff( UINT8 ubSquad, OBJECTTYPE *pObject, BOOLEAN fReset ); extern void SetNewItem( SOLDIERTYPE *pSoldier, UINT8 ubInvPos, BOOLEAN fNewItem ); -extern void CleanUpStack( OBJECTTYPE * pObj, OBJECTTYPE * pCursorObj ); -extern BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, UINT8 ubStatusIndex, SOLDIERTYPE *pSoldier ); -extern BOOLEAN InternalHandleCompatibleAmmoUI( SOLDIERTYPE *pSoldier, OBJECTTYPE *pTestObject, BOOLEAN fOn ); +extern BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, UINT8 ubStatusIndex, SOLDIERTYPE *pSoldier, UINT8 ubPosition ); +extern BOOLEAN InternalHandleCompatibleAmmoUI( SOLDIERTYPE *pSoldier, OBJECTTYPE *pTestObject, BOOLEAN fOn ); BOOLEAN IsMouseInRegion( MOUSE_REGION *pRegion ); void HandleMouseOverSoldierFaceForContMove( SOLDIERTYPE *pSoldier, BOOLEAN fOn ); @@ -435,7 +470,8 @@ void HelpTextDoneCallback( void ); INT8 gbSMCurStanceObj; UINT16 gusSMCurrentMerc = 0; SOLDIERTYPE *gpSMCurrentMerc = NULL; -extern INT8 gbCompatibleApplyItem; +// CHRISL: +extern INT8 gbCompatibleApplyItem; extern SOLDIERTYPE *gpItemPopupSoldier; INT8 gbStanceButPos[2][3][3] = @@ -446,10 +482,23 @@ INT8 gbStanceButPos[2][3][3] = 22, 20, 21, // STEALTH MODE 13, 11, 12, - 7, 5, 6, + 7, 5, 6, 19, 17, 18 }; +//CHRISL: New arrays to deal with backpack button positions +INT8 gbDropPackButPos[2][2] = +{ + 2, 3, + 3, 2 +}; +INT8 gbZipperButPos[2][2] = +{ + 0, 1, + 1, 0 +}; + + // Mouse button and region callbacks //void BtnPositionCallback( GUI_BUTTON *btn, INT32 reason ); @@ -475,6 +524,11 @@ void BtnMuteCallback(GUI_BUTTON *btn,INT32 reason); void BtnSMDoneCallback(GUI_BUTTON *btn,INT32 reason); void BtnMapScreenCallback(GUI_BUTTON *btn,INT32 reason); +// CHRISL: New callback functions for backpack buttons +void BtnDropPackCallback(GUI_BUTTON *btn,INT32 reason); +void BtnZipperCallback(GUI_BUTTON *btn,INT32 reason); +BOOLEAN ChangeZipperStatus(SOLDIERTYPE *pSoldier, BOOLEAN newStatus); + void BtnPrevMercCallback(GUI_BUTTON *btn,INT32 reason); void BtnNextMercCallback(GUI_BUTTON *btn,INT32 reason); void BtnOptionsCallback(GUI_BUTTON *btn,INT32 reason); @@ -515,7 +569,7 @@ INT8 GetUIApsToDisplay( SOLDIERTYPE *pSoldier ) { SOLDIERTYPE *pVehicle; - if ( pSoldier->uiStatusFlags & SOLDIER_DRIVER ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_DRIVER ) { pVehicle = GetSoldierStructureForVehicle( pSoldier->iVehicleId ); @@ -543,6 +597,9 @@ void CheckForDisabledForGiveItem( ) SOLDIERTYPE *pSoldier; UINT8 ubSrcSoldier; + // CHRISL: If Merc hasn't been set, default to first merc + if(gpSMCurrentMerc==NULL) + gpSMCurrentMerc = MercPtrs[ 0 ]; Assert( gpSMCurrentMerc != NULL); if ( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) @@ -555,18 +612,18 @@ void CheckForDisabledForGiveItem( ) gfSMDisableForItems = TRUE; // ATE: Is the current merc unconscious..... - if ( gpSMCurrentMerc->bLife < OKLIFE && gpItemPointer != NULL ) + if ( gpSMCurrentMerc->stats.bLife < OKLIFE && gpItemPointer != NULL ) { // Go through each merc and see if there is one closeby.... cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) - { - if ( pSoldier->bActive && pSoldier->bLife >= OKLIFE && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) && pSoldier->bInSector && IsMercOnCurrentSquad( pSoldier ) ) + { + if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) && pSoldier->bInSector && IsMercOnCurrentSquad( pSoldier ) ) { sDist = PythSpacesAway( gpSMCurrentMerc->sGridNo, pSoldier->sGridNo ); // Check LOS.... - if ( SoldierTo3DLocationLineOfSightTest( pSoldier, gpSMCurrentMerc->sGridNo, gpSMCurrentMerc->bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) + if ( SoldierTo3DLocationLineOfSightTest( pSoldier, gpSMCurrentMerc->sGridNo, gpSMCurrentMerc->pathing.bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) { if ( sDist <= PASSING_ITEM_DISTANCE_NOTOKLIFE ) { @@ -592,7 +649,7 @@ void CheckForDisabledForGiveItem( ) if ( gusSMCurrentMerc != ubSrcSoldier ) { sDestGridNo = MercPtrs[ gusSMCurrentMerc ]->sGridNo; - bDestLevel = MercPtrs[ gusSMCurrentMerc ]->bLevel; + bDestLevel = MercPtrs[ gusSMCurrentMerc ]->pathing.bLevel; // Get distance.... sDist = PythSpacesAway( MercPtrs[ ubSrcSoldier ]->sGridNo, sDestGridNo ); @@ -601,7 +658,7 @@ void CheckForDisabledForGiveItem( ) if ( SoldierTo3DLocationLineOfSightTest( MercPtrs[ ubSrcSoldier ], sDestGridNo, bDestLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) { // UNCONSCIOUS GUYS ONLY 1 tile AWAY - if ( MercPtrs[ gusSMCurrentMerc ]->bLife < CONSCIOUSNESS ) + if ( MercPtrs[ gusSMCurrentMerc ]->stats.bLife < CONSCIOUSNESS ) { if ( sDist <= PASSING_ITEM_DISTANCE_NOTOKLIFE ) { @@ -670,7 +727,7 @@ void SetSMPanelCurrentMerc( UINT8 ubNewID ) } else { - if ( ( gpItemPointer != NULL || guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE || gpSMCurrentMerc->bLife < OKLIFE ) ) + if ( ( gpItemPointer != NULL || guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE || gpSMCurrentMerc->stats.bLife < OKLIFE ) ) { CheckForDisabledForGiveItem( ); } @@ -760,7 +817,7 @@ void UpdateSMPanel( ) // Disable if we cannot do this! if ( !IsValidStance( gpSMCurrentMerc, ANIM_CROUCH ) ) { - DisableButton( iSMPanelButtons[ STANCEDOWN_BUTTON ] ); + DisableButton( iSMPanelButtons[ STANCEDOWN_BUTTON ] ); } break; @@ -778,11 +835,11 @@ void UpdateSMPanel( ) // Disable if we cannot do this! if ( !IsValidStance( gpSMCurrentMerc, ANIM_PRONE ) ) { - DisableButton( iSMPanelButtons[ STANCEDOWN_BUTTON ] ); + DisableButton( iSMPanelButtons[ STANCEDOWN_BUTTON ] ); } break; } - + // Stance button done wether we're disabled or not... if ( gfUIStanceDifferent ) { @@ -797,11 +854,12 @@ void UpdateSMPanel( ) } // Make new - giSMStealthImages = UseLoadedButtonImage( iSMPanelImages[ STANCE_IMAGES ] ,gbStanceButPos[ gpSMCurrentMerc->bStealthMode ][gbSMCurStanceObj][0] ,gbStanceButPos[ gpSMCurrentMerc->bStealthMode ][gbSMCurStanceObj][1],-1,gbStanceButPos[ gpSMCurrentMerc->bStealthMode ][gbSMCurStanceObj][2],-1 ); + giSMStealthImages = UseLoadedButtonImage( iSMPanelImages[ STANCE_IMAGES ] ,gbStanceButPos[ gpSMCurrentMerc->bStealthMode ][gbSMCurStanceObj][0] ,gbStanceButPos[ gpSMCurrentMerc->bStealthMode ][gbSMCurStanceObj][1],-1,gbStanceButPos[ gpSMCurrentMerc->bStealthMode ][gbSMCurStanceObj][2],-1 ); giSMStealthButton = QuickCreateButton( giSMStealthImages, SM_STEALTHMODE_X, SM_STEALTHMODE_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH - 1, DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)BtnStealthModeCallback ); + RenderBackpackButtons(0); /* CHRISL: Needed for new inventory backpack buttons */ SetButtonFastHelpText( giSMStealthButton, TacticalStr[ TOGGLE_STEALTH_MODE_POPUPTEXT ] ); @@ -813,6 +871,7 @@ void UpdateSMPanel( ) { DisableButton( giSMStealthButton ); } + RenderBackpackButtons(3); /* CHRISL: Needed for new inventory backpack buttons */ } } @@ -825,12 +884,12 @@ void UpdateSMPanel( ) CheckForReEvaluateDisabledINVPanelButtons( ); // Check for any newly added items we need..... - if ( gpSMCurrentMerc->fCheckForNewlyAddedItems ) + if ( gpSMCurrentMerc->flags.fCheckForNewlyAddedItems ) { // Startup any newly added items.... CheckForAnyNewlyAddedItems( gpSMCurrentMerc ); - gpSMCurrentMerc->fCheckForNewlyAddedItems = FALSE; + gpSMCurrentMerc->flags.fCheckForNewlyAddedItems = FALSE; } @@ -861,7 +920,7 @@ void UpdateSMPanel( ) // Toggle MUTE button... - if ( gpSMCurrentMerc->uiStatusFlags & SOLDIER_MUTE ) + if ( gpSMCurrentMerc->flags.uiStatusFlags & SOLDIER_MUTE ) { if ( !ButtonList[ iSMPanelButtons[ MUTE_BUTTON ] ]->ubToggleButtonActivated ) { @@ -877,7 +936,7 @@ void UpdateSMPanel( ) } - DisableButton( iSMPanelButtons[ CLIMB_BUTTON ] ); + DisableButton( iSMPanelButtons[ CLIMB_BUTTON ] ); GetMercClimbDirection( gpSMCurrentMerc->ubID, &fNearLowerLevel, &fNearHeigherLevel ); @@ -887,7 +946,7 @@ void UpdateSMPanel( ) { if ( EnoughPoints( gpSMCurrentMerc, GetAPsToClimbRoof( gpSMCurrentMerc, TRUE ), 0, FALSE ) ) { - EnableButton( iSMPanelButtons[ CLIMB_BUTTON ] ); + EnableButton( iSMPanelButtons[ CLIMB_BUTTON ] ); } } @@ -895,14 +954,14 @@ void UpdateSMPanel( ) { if ( EnoughPoints( gpSMCurrentMerc, GetAPsToClimbRoof( gpSMCurrentMerc, FALSE ), 0, FALSE ) ) { - EnableButton( iSMPanelButtons[ CLIMB_BUTTON ] ); + EnableButton( iSMPanelButtons[ CLIMB_BUTTON ] ); } } } - + if ( FindFenceJumpDirection( gpSMCurrentMerc, gpSMCurrentMerc->sGridNo, gpSMCurrentMerc->ubDirection, &bDirection ) ) { - EnableButton( iSMPanelButtons[ CLIMB_BUTTON ] ); + EnableButton( iSMPanelButtons[ CLIMB_BUTTON ] ); } if ( (gTacticalStatus.ubCurrentTeam != gbPlayerNum) || (gTacticalStatus.uiFlags & REALTIME ) || !(gTacticalStatus.uiFlags & INCOMBAT ) ) @@ -976,10 +1035,10 @@ void UpdateSMPanel( ) } // If not selected ( or dead ), disable/gray some buttons - if ( gusSelectedSoldier != gpSMCurrentMerc->ubID || ( gpSMCurrentMerc->bLife < OKLIFE ) || (gTacticalStatus.ubCurrentTeam != gbPlayerNum) || gfSMDisableForItems ) + if ( gusSelectedSoldier != gpSMCurrentMerc->ubID || ( gpSMCurrentMerc->stats.bLife < OKLIFE ) || (gTacticalStatus.ubCurrentTeam != gbPlayerNum) || gfSMDisableForItems ) { - DisableButton( iSMPanelButtons[ CLIMB_BUTTON ] ); - DisableButton( iSMPanelButtons[ BURSTMODE_BUTTON ] ); + DisableButton( iSMPanelButtons[ CLIMB_BUTTON ] ); + DisableButton( iSMPanelButtons[ BURSTMODE_BUTTON ] ); DisableButton( iSMPanelButtons[ STANCEUP_BUTTON ] ); DisableButton( iSMPanelButtons[ STANCEDOWN_BUTTON ] ); DisableButton( iSMPanelButtons[ LOOK_BUTTON ] ); @@ -989,17 +1048,20 @@ void UpdateSMPanel( ) { DisableButton( giSMStealthButton ); } + RenderBackpackButtons(3); /* CHRISL: Needed for new inventory backpack buttons */ } else { // Enable some buttons! - if ( ((IsGunAutofireCapable( gpSMCurrentMerc, HANDPOS ) || IsGunBurstCapable( gpSMCurrentMerc, HANDPOS , FALSE )) && !Weapon[gpSMCurrentMerc->inv[HANDPOS].usItem].NoSemiAuto ) || IsGrenadeLauncherAttached ( &(gpSMCurrentMerc->inv[HANDPOS]) ) ) + // Changed by ADB, rev 1513 + //if ( ((IsGunAutofireCapable( gpSMCurrentMerc, HANDPOS ) || IsGunBurstCapable( gpSMCurrentMerc, HANDPOS , FALSE )) && !Weapon[gpSMCurrentMerc->inv[HANDPOS].usItem].NoSemiAuto ) || IsGrenadeLauncherAttached ( &(gpSMCurrentMerc->inv[HANDPOS]) ) ) + if ( ((IsGunAutofireCapable( &gpSMCurrentMerc->inv[HANDPOS] ) || IsGunBurstCapable( &gpSMCurrentMerc->inv[HANDPOS], FALSE, gpSMCurrentMerc )) && !Weapon[gpSMCurrentMerc->inv[HANDPOS].usItem].NoSemiAuto ) || IsGrenadeLauncherAttached ( &(gpSMCurrentMerc->inv[HANDPOS]) ) ) { - EnableButton( iSMPanelButtons[ BURSTMODE_BUTTON ] ); + EnableButton( iSMPanelButtons[ BURSTMODE_BUTTON ] ); } else { - DisableButton( iSMPanelButtons[ BURSTMODE_BUTTON ] ); + DisableButton( iSMPanelButtons[ BURSTMODE_BUTTON ] ); } EnableButton( iSMPanelButtons[ LOOK_BUTTON ] ); EnableButton( iSMPanelButtons[ UPDOWN_BUTTON ] ); @@ -1009,6 +1071,8 @@ void UpdateSMPanel( ) { EnableButton( giSMStealthButton ); } + if(!gfInItemDescBox) + RenderBackpackButtons(2); /* CHRISL: Needed for new inventory backpack buttons */ } // CJC Dec 4 2002: or if item pickup menu is up @@ -1023,19 +1087,18 @@ void UpdateSMPanel( ) } -extern BOOLEAN CanItemFitInPosition( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj, INT8 bPos, BOOLEAN fDoingPlacement ); -extern INT8 gbInvalidPlacementSlot[ NUM_INV_SLOTS ]; +extern INT8 gbInvalidPlacementSlot[ NUM_INV_SLOTS ]; void ReevaluateItemHatches( SOLDIERTYPE *pSoldier, BOOLEAN fAllValid ) { - INT32 cnt; + UINT32 cnt; // if there's an item in the cursor and we're not supposed to just make them all valid if ( ( gpItemPointer != NULL ) && !fAllValid ) { - // check all inventory positions and mark the ones where cursor item won't fit as invalid - for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ ) + // check all inventory positions and mark the ones where cursor item won't fit as invalid + for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ ) { gbInvalidPlacementSlot[ cnt ] = !CanItemFitInPosition( pSoldier, gpItemPointer, (INT8)cnt, FALSE ); @@ -1068,6 +1131,99 @@ void ReevaluateItemHatches( SOLDIERTYPE *pSoldier, BOOLEAN fAllValid ) fInterfacePanelDirty = DIRTYLEVEL2; } +//CHRISL: Function to handle backpack button rendering +void RenderBackpackButtons(int bpAction) +{ + // Only run function if we're using new inventory system + if((UsingNewInventorySystem() == false)) + return; + // Only run this if we're not on the strategic screen + if(guiCurrentItemDescriptionScreen == MAP_SCREEN) + return; + // Only run if the Tactical Inventory Panel is open + if(gsCurInterfacePanel != SM_PANEL) + return; + // If Merc hasn't been set, default to first merc + if(gpSMCurrentMerc==NULL) + gpSMCurrentMerc = MercPtrs[ 0 ]; + Assert(gpSMCurrentMerc!=NULL); + // Deal with buttons depending on which screen is currently active + switch (bpAction) + { + case 0: + // Activate buttons + if(giSMZipperButton != -1) + RemoveButton( giSMZipperButton ); + if(giSMZipperImages != -1) + UnloadButtonImage( giSMZipperImages ); + if(giSMDropPackButton != -1) + RemoveButton( giSMDropPackButton ); + if(giSMDropPackImages != -1) + UnloadButtonImage( giSMDropPackImages ); + gpSMCurrentMerc->flags.DropPackFlag = FALSE; + if(gpSMCurrentMerc->inv[BPACKPOCKPOS].exists() == FALSE) + { + for(unsigned int wi = 0; wi < guiNumWorldItems; wi++) + { + if(gWorldItems[wi].soldierID == gpSMCurrentMerc->ubID && gWorldItems[wi].object.exists() == true) + { + gpSMCurrentMerc->flags.DropPackFlag = TRUE; + break; + } + } + } + giSMZipperImages = UseLoadedButtonImage( iSMPanelImages[ BACKPACK_IMAGES ] ,-1 ,gbZipperButPos[ gpSMCurrentMerc->flags.ZipperFlag ][0],-1,gbZipperButPos[ gpSMCurrentMerc->flags.ZipperFlag ][1],-1 ); + giSMDropPackImages = UseLoadedButtonImage( iSMPanelImages[ BACKPACK_IMAGES ] ,-1 ,gbDropPackButPos[ gpSMCurrentMerc->flags.DropPackFlag ][0],-1,gbDropPackButPos[ gpSMCurrentMerc->flags.DropPackFlag ][1],-1 ); + //giSMDropPackImages = UseLoadedButtonImage( iSMPanelImages[ BACKPACK_IMAGES ] ,gbDropPackButPos[ gpSMCurrentMerc->flags.DropPackFlag ][0] ,gbDropPackButPos[ gpSMCurrentMerc->flags.DropPackFlag ][0],-1,gbDropPackButPos[ gpSMCurrentMerc->flags.DropPackFlag ][1],-1 ); + + giSMZipperButton = QuickCreateButton( giSMZipperImages, SM_ZIPPER_X, SM_ZIPPER_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGH - 1, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)BtnZipperCallback ); + giSMDropPackButton = QuickCreateButton( giSMDropPackImages, SM_DROPPACK_X, SM_DROPPACK_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGH - 1, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)BtnDropPackCallback ); + //SetButtonFastHelpText( giSMZipperButton, TacticalStr[ ] ); + //SetButtonFastHelpText( giSMDropPackButton, TacticalStr[ ] ); + break; + case 1: + // Deactivate buttons + if(giSMZipperButton != -1) + RemoveButton( giSMZipperButton ); + if(giSMDropPackButton != -1) + RemoveButton( giSMDropPackButton ); + giSMDropPackImages = -1; + giSMDropPackButton = -1; + giSMZipperImages = -1; + giSMZipperButton = -1; + break; + case 2: + // Enable buttons + if(giSMDropPackButton == -1 || giSMZipperButton == -1) + { + RenderBackpackButtons(1); + RenderBackpackButtons(0); + } + if(giSMDropPackButton != -1) + EnableButton( giSMDropPackButton ); + if(giSMZipperButton != -1) + EnableButton( giSMZipperButton ); + break; + case 3: + // Disable buttons + if(giSMDropPackButton != -1) + DisableButton( giSMDropPackButton ); + if(giSMZipperButton != -1) + DisableButton( giSMZipperButton ); + break; + case 4: + if(giSMZipperImages != -1) + UnloadButtonImage( giSMZipperImages ); + if(giSMDropPackImages != -1) + UnloadButtonImage( giSMDropPackImages ); + break; + } +} + void EnableSMPanelButtons( BOOLEAN fEnable , BOOLEAN fFromItemPickup ) { @@ -1129,8 +1285,8 @@ void EnableSMPanelButtons( BOOLEAN fEnable , BOOLEAN fFromItemPickup ) // only enable the following if NOT in shopkeeper's interface if ( !(guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) ) { - EnableButton( iSMPanelButtons[ CLIMB_BUTTON ] ); - EnableButton( iSMPanelButtons[ BURSTMODE_BUTTON ] ); + EnableButton( iSMPanelButtons[ CLIMB_BUTTON ] ); + EnableButton( iSMPanelButtons[ BURSTMODE_BUTTON ] ); EnableButton( iSMPanelButtons[ STANCEUP_BUTTON ] ); EnableButton( iSMPanelButtons[ STANCEDOWN_BUTTON ] ); EnableButton( iSMPanelButtons[ LOOK_BUTTON ] ); @@ -1140,6 +1296,7 @@ void EnableSMPanelButtons( BOOLEAN fEnable , BOOLEAN fFromItemPickup ) { EnableButton( giSMStealthButton ); } + RenderBackpackButtons(2); /* CHRISL: Needed for new inventory backpack buttons */ if ( gfDisableTacticalPanelButtons ) { @@ -1160,7 +1317,7 @@ void EnableSMPanelButtons( BOOLEAN fEnable , BOOLEAN fFromItemPickup ) gfSMDisableForItems = FALSE; - DisableInvRegions( gfSMDisableForItems ); + DisableInvRegions( gfSMDisableForItems ); } if ( !fFromItemPickup ) @@ -1171,8 +1328,8 @@ void EnableSMPanelButtons( BOOLEAN fEnable , BOOLEAN fFromItemPickup ) } else { - DisableButton( iSMPanelButtons[ CLIMB_BUTTON ] ); - DisableButton( iSMPanelButtons[ BURSTMODE_BUTTON ] ); + DisableButton( iSMPanelButtons[ CLIMB_BUTTON ] ); + DisableButton( iSMPanelButtons[ BURSTMODE_BUTTON ] ); DisableButton( iSMPanelButtons[ STANCEUP_BUTTON ] ); DisableButton( iSMPanelButtons[ STANCEDOWN_BUTTON ] ); DisableButton( iSMPanelButtons[ LOOK_BUTTON ] ); @@ -1182,6 +1339,7 @@ void EnableSMPanelButtons( BOOLEAN fEnable , BOOLEAN fFromItemPickup ) { DisableButton( giSMStealthButton ); } + RenderBackpackButtons(3); /* CHRISL: Needed for new inventory backpack buttons */ if ( !fFromItemPickup ) { @@ -1208,38 +1366,61 @@ UINT16 GetSMPanelCurrentMerc( ) } -BOOLEAN InitializeSMPanelCoords( ) +// CHRISL: New functions to define initial settings for New Inventory system +void InitNewInventorySystem( ) +{ + INTERFACE_WIDTH = 640; + INTERFACE_HEIGHT = 120; + INV_INTERFACE_HEIGHT = 200; + INTERFACE_START_X = 0; + INTERFACE_START_Y = ( SCREEN_HEIGHT - INTERFACE_HEIGHT ); + INV_INTERFACE_START_Y = ( SCREEN_HEIGHT - INV_INTERFACE_HEIGHT ); +} + +// CHRISL: New functions to define initial settings for Old Inventory system +void InitOldInventorySystem( ) +{ + INTERFACE_WIDTH = 640; + INTERFACE_HEIGHT = 120; + INV_INTERFACE_HEIGHT = 140; + INTERFACE_START_X = 0; + INTERFACE_START_Y = ( SCREEN_HEIGHT - INTERFACE_HEIGHT ); + INV_INTERFACE_START_Y = ( SCREEN_HEIGHT - INV_INTERFACE_HEIGHT ); +} + +// CHRISL: These functions will setup inventory panel coords based on game options +BOOLEAN InitializeSMPanelCoordsOld() { // int i; // unused (jonathanl) - /* - * now i use standard positions and i add to them starting coords of panel but - * we can add here function that will read coord in panel from file - * that will be phase2 of making GUI more customizable - * any questions? joker - */ + /* + * now i use standard positions and i add to them starting coords of panel but + * we can add here function that will read coord in panel from file + * that will be phase2 of making GUI more customizable + * any questions? joker + */ // Inventory slots - gSMInvPocketXY[0].sX = INTERFACE_START_X + 344; gSMInvPocketXY[0].sY = INV_INTERFACE_START_Y + 7; // HELMETPOS - gSMInvPocketXY[1].sX = INTERFACE_START_X + 344; gSMInvPocketXY[1].sY = INV_INTERFACE_START_Y + 36; // VESTPOS - gSMInvPocketXY[2].sX = INTERFACE_START_X + 344; gSMInvPocketXY[2].sY = INV_INTERFACE_START_Y + 96; // LEGPOS, - gSMInvPocketXY[3].sX = INTERFACE_START_X + 226; gSMInvPocketXY[3].sY = INV_INTERFACE_START_Y + 7; // HEAD1POS - gSMInvPocketXY[4].sX = INTERFACE_START_X + 226; gSMInvPocketXY[4].sY = INV_INTERFACE_START_Y + 31; // HEAD2POS - gSMInvPocketXY[5].sX = INTERFACE_START_X + 226; gSMInvPocketXY[5].sY = INV_INTERFACE_START_Y + 84; // HANDPOS, - gSMInvPocketXY[6].sX = INTERFACE_START_X + 226; gSMInvPocketXY[6].sY = INV_INTERFACE_START_Y + 108; // SECONDHANDPOS - gSMInvPocketXY[7].sX = INTERFACE_START_X + 468; gSMInvPocketXY[7].sY = INV_INTERFACE_START_Y + 6; // BIGPOCK1 - gSMInvPocketXY[8].sX = INTERFACE_START_X + 468; gSMInvPocketXY[8].sY = INV_INTERFACE_START_Y + 30; // BIGPOCK2 - gSMInvPocketXY[9].sX = INTERFACE_START_X + 468; gSMInvPocketXY[9].sY = INV_INTERFACE_START_Y + 54; // BIGPOCK3 - gSMInvPocketXY[10].sX = INTERFACE_START_X + 468; gSMInvPocketXY[10].sY = INV_INTERFACE_START_Y + 78; // BIGPOCK4 - gSMInvPocketXY[11].sX = INTERFACE_START_X + 396; gSMInvPocketXY[11].sY = INV_INTERFACE_START_Y + 6; // SMALLPOCK1 - gSMInvPocketXY[12].sX = INTERFACE_START_X + 396; gSMInvPocketXY[12].sY = INV_INTERFACE_START_Y + 30; // SMALLPOCK2 - gSMInvPocketXY[13].sX = INTERFACE_START_X + 396; gSMInvPocketXY[13].sY = INV_INTERFACE_START_Y + 54; // SMALLPOCK3 - gSMInvPocketXY[14].sX = INTERFACE_START_X + 396; gSMInvPocketXY[14].sY = INV_INTERFACE_START_Y + 78; // SMALLPOCK4 - gSMInvPocketXY[15].sX = INTERFACE_START_X + 432; gSMInvPocketXY[15].sY = INV_INTERFACE_START_Y + 6; // SMALLPOCK5 - gSMInvPocketXY[16].sX = INTERFACE_START_X + 432; gSMInvPocketXY[16].sY = INV_INTERFACE_START_Y + 30; // SMALLPOCK6 - gSMInvPocketXY[17].sX = INTERFACE_START_X + 432; gSMInvPocketXY[17].sY = INV_INTERFACE_START_Y + 54; // SMALLPOCK7 - gSMInvPocketXY[18].sX = INTERFACE_START_X + 432; gSMInvPocketXY[18].sY = INV_INTERFACE_START_Y + 78; // SMALLPOCK8 + gSMInvPocketXY[HELMETPOS].sX = INTERFACE_START_X + 344; gSMInvPocketXY[HELMETPOS].sY = INV_INTERFACE_START_Y + 7; // HELMETPOS + gSMInvPocketXY[VESTPOS].sX = INTERFACE_START_X + 344; gSMInvPocketXY[VESTPOS].sY = INV_INTERFACE_START_Y + 36; // VESTPOS + gSMInvPocketXY[LEGPOS].sX = INTERFACE_START_X + 344; gSMInvPocketXY[LEGPOS].sY = INV_INTERFACE_START_Y + 96; // LEGPOS, + gSMInvPocketXY[HEAD1POS].sX = INTERFACE_START_X + 226; gSMInvPocketXY[HEAD1POS].sY = INV_INTERFACE_START_Y + 7; // HEAD1POS + gSMInvPocketXY[HEAD2POS].sX = INTERFACE_START_X + 226; gSMInvPocketXY[HEAD2POS].sY = INV_INTERFACE_START_Y + 31; // HEAD2POS + gSMInvPocketXY[HANDPOS].sX = INTERFACE_START_X + 226; gSMInvPocketXY[HANDPOS].sY = INV_INTERFACE_START_Y + 84; // HANDPOS, + gSMInvPocketXY[SECONDHANDPOS].sX = INTERFACE_START_X + 226; gSMInvPocketXY[SECONDHANDPOS].sY = INV_INTERFACE_START_Y + 108; // SECONDHANDPOS + gSMInvPocketXY[BIGPOCK1POS].sX = INTERFACE_START_X + 468; gSMInvPocketXY[BIGPOCK1POS].sY = INV_INTERFACE_START_Y + 6; // BIGPOCK1 + gSMInvPocketXY[BIGPOCK2POS].sX = INTERFACE_START_X + 468; gSMInvPocketXY[BIGPOCK2POS].sY = INV_INTERFACE_START_Y + 30; // BIGPOCK2 + gSMInvPocketXY[BIGPOCK3POS].sX = INTERFACE_START_X + 468; gSMInvPocketXY[BIGPOCK3POS].sY = INV_INTERFACE_START_Y + 54; // BIGPOCK3 + gSMInvPocketXY[BIGPOCK4POS].sX = INTERFACE_START_X + 468; gSMInvPocketXY[BIGPOCK4POS].sY = INV_INTERFACE_START_Y + 78; // BIGPOCK4 + gSMInvPocketXY[SMALLPOCK1POS].sX = INTERFACE_START_X + 396; gSMInvPocketXY[SMALLPOCK1POS].sY = INV_INTERFACE_START_Y + 6; // SMALLPOCK1 + gSMInvPocketXY[SMALLPOCK2POS].sX = INTERFACE_START_X + 396; gSMInvPocketXY[SMALLPOCK2POS].sY = INV_INTERFACE_START_Y + 30; // SMALLPOCK2 + gSMInvPocketXY[SMALLPOCK3POS].sX = INTERFACE_START_X + 396; gSMInvPocketXY[SMALLPOCK3POS].sY = INV_INTERFACE_START_Y + 54; // SMALLPOCK3 + gSMInvPocketXY[SMALLPOCK4POS].sX = INTERFACE_START_X + 396; gSMInvPocketXY[SMALLPOCK4POS].sY = INV_INTERFACE_START_Y + 78; // SMALLPOCK4 + gSMInvPocketXY[SMALLPOCK5POS].sX = INTERFACE_START_X + 432; gSMInvPocketXY[SMALLPOCK5POS].sY = INV_INTERFACE_START_Y + 6; // SMALLPOCK5 + gSMInvPocketXY[SMALLPOCK6POS].sX = INTERFACE_START_X + 432; gSMInvPocketXY[SMALLPOCK6POS].sY = INV_INTERFACE_START_Y + 30; // SMALLPOCK6 + gSMInvPocketXY[SMALLPOCK7POS].sX = INTERFACE_START_X + 432; gSMInvPocketXY[SMALLPOCK7POS].sY = INV_INTERFACE_START_Y + 54; // SMALLPOCK7 + gSMInvPocketXY[SMALLPOCK8POS].sX = INTERFACE_START_X + 432; gSMInvPocketXY[SMALLPOCK8POS].sY = INV_INTERFACE_START_Y + 78; // SMALLPOCK8 SM_ITEMDESC_START_X = ( 214 + INTERFACE_START_X ); - SM_ITEMDESC_START_Y = ( 1 + INV_INTERFACE_START_Y ); + SM_ITEMDESC_START_Y = ( 1 + INV_INTERFACE_START_Y ); SM_ITEMDESC_HEIGHT = 128; SM_ITEMDESC_WIDTH = 358; @@ -1247,7 +1428,7 @@ BOOLEAN InitializeSMPanelCoords( ) SM_SELMERC_AP_Y = ( 53 + INV_INTERFACE_START_Y ); SM_SELMERC_AP_HEIGHT = 12; SM_SELMERC_AP_WIDTH = 11; - + SM_SELMERC_HEALTH_X = ( 69 + INTERFACE_START_X ); SM_SELMERC_HEALTH_Y = ( 47 + INV_INTERFACE_START_Y ); SM_SELMERC_HEALTH_WIDTH = 3; @@ -1316,9 +1497,9 @@ BOOLEAN InitializeSMPanelCoords( ) SM_STEALTHMODE_X = ( 187 + INTERFACE_START_X ); SM_STEALTHMODE_Y = ( 73 + INV_INTERFACE_START_Y ); - SM_DONE_X = (SCREEN_WIDTH - 97);//( 543 + INTERFACE_START_X ); + SM_DONE_X = (SCREEN_WIDTH - 97);//( 543 + INTERFACE_START_X ); SM_DONE_Y = ( 4 + INV_INTERFACE_START_Y ); - SM_MAPSCREEN_X = (SCREEN_WIDTH - 51);//( 589 + INTERFACE_START_X ); + SM_MAPSCREEN_X = (SCREEN_WIDTH - 51);//( 589 + INTERFACE_START_X ); SM_MAPSCREEN_Y = ( 4 + INV_INTERFACE_START_Y ); SM_POSITIONB_X = ( 106 + INTERFACE_START_X ); @@ -1376,32 +1557,410 @@ BOOLEAN InitializeSMPanelCoords( ) MONEY_Y = ( 105 + INV_INTERFACE_START_Y ); MONEY_WIDTH = 30; MONEY_HEIGHT = 22; + + // ow ye font color they can also be customizable :P + STATS_TITLE_FONT_COLOR = 6; + STATS_TEXT_FONT_COLOR = 5; + + // ow and te clock and location i will put it here + INTERFACE_CLOCK_X = (SCREEN_WIDTH - 86); //( 554 + INTERFACE_START_X ); + INTERFACE_CLOCK_Y = ( 119 + INV_INTERFACE_START_Y ); + LOCATION_NAME_X = (SCREEN_WIDTH - 92); //( 548 + INTERFACE_START_X ); + LOCATION_NAME_Y = ( 65 + INTERFACE_START_Y ); + + // Keyring + KEYRING_X = 487; + KEYRING_Y = (105 + INV_INTERFACE_START_Y); + + // so we got everything "dynamic" now we just return TRUE + return ( TRUE ); +} +BOOLEAN InitializeSMPanelCoordsNew() +{ + // int i; // unused (jonathanl) + /* + * now i use standard positions and i add to them starting coords of panel but + * we can add here function that will read coord in panel from file + * that will be phase2 of making GUI more customizable + * any questions? joker + */ + /* CHRISL: Inventory slot information was completly altered to allow for new inventory pockets and + to allow the new inventory interface to function properly. Also altered many of the interface coords + so that the new interface would line up correctly.*/ + // Inventory slots + if(iResolution == 0){ + gSMInvPocketXY[0].sX = INTERFACE_START_X + 239; gSMInvPocketXY[0].sY = INV_INTERFACE_START_Y + 68; // HELMETPOS + gSMInvPocketXY[1].sX = INTERFACE_START_X + 239; gSMInvPocketXY[1].sY = INV_INTERFACE_START_Y + 96; // VESTPOS + gSMInvPocketXY[2].sX = INTERFACE_START_X + 239; gSMInvPocketXY[2].sY = INV_INTERFACE_START_Y + 157; // LEGPOS + gSMInvPocketXY[3].sX = INTERFACE_START_X + 124; gSMInvPocketXY[3].sY = INV_INTERFACE_START_Y + 68; // HEAD1POS + gSMInvPocketXY[4].sX = INTERFACE_START_X + 124; gSMInvPocketXY[4].sY = INV_INTERFACE_START_Y + 92; // HEAD2POS + gSMInvPocketXY[5].sX = INTERFACE_START_X + 124; gSMInvPocketXY[5].sY = INV_INTERFACE_START_Y + 146; // HANDPOS + gSMInvPocketXY[6].sX = INTERFACE_START_X + 124; gSMInvPocketXY[6].sY = INV_INTERFACE_START_Y + 170; // SECONDHANDPOS + gSMInvPocketXY[7].sX = INTERFACE_START_X + 274; gSMInvPocketXY[7].sY = INV_INTERFACE_START_Y + 13; // VESTPOCK + gSMInvPocketXY[8].sX = INTERFACE_START_X + 292; gSMInvPocketXY[8].sY = INV_INTERFACE_START_Y + 79; // LTHIGHPOCK + gSMInvPocketXY[9].sX = INTERFACE_START_X + 340; gSMInvPocketXY[9].sY = INV_INTERFACE_START_Y + 79; // RTHIGHPOCK + gSMInvPocketXY[10].sX = INTERFACE_START_X + 443; gSMInvPocketXY[10].sY = INV_INTERFACE_START_Y + 79; // CPACKPOCK + gSMInvPocketXY[11].sX = INTERFACE_START_X + 486; gSMInvPocketXY[11].sY = INV_INTERFACE_START_Y + 13; // BPACKPOCK + gSMInvPocketXY[12].sX = INTERFACE_START_X + 383; gSMInvPocketXY[12].sY = INV_INTERFACE_START_Y + 79; // GUNSLINGPOCKPOS + gSMInvPocketXY[13].sX = INTERFACE_START_X + 499; gSMInvPocketXY[13].sY = INV_INTERFACE_START_Y + 79; // KNIFEPOCKPOS + gSMInvPocketXY[14].sX = INTERFACE_START_X + 433; gSMInvPocketXY[14].sY = INV_INTERFACE_START_Y + 116; // BIGPOCK1 + gSMInvPocketXY[15].sX = INTERFACE_START_X + 433; gSMInvPocketXY[15].sY = INV_INTERFACE_START_Y + 140; // BIGPOCK2 + gSMInvPocketXY[16].sX = INTERFACE_START_X + 433; gSMInvPocketXY[16].sY = INV_INTERFACE_START_Y + 164; // BIGPOCK3 + gSMInvPocketXY[17].sX = INTERFACE_START_X + 582; gSMInvPocketXY[17].sY = INV_INTERFACE_START_Y + 10; // BIGPOCK4 + gSMInvPocketXY[18].sX = INTERFACE_START_X + 582; gSMInvPocketXY[18].sY = INV_INTERFACE_START_Y + 34; // BIGPOCK5 + gSMInvPocketXY[19].sX = INTERFACE_START_X + 582; gSMInvPocketXY[19].sY = INV_INTERFACE_START_Y + 58; // BIGPOCK6 + gSMInvPocketXY[20].sX = INTERFACE_START_X + 582; gSMInvPocketXY[20].sY = INV_INTERFACE_START_Y + 82; // BIGPOCK7 + gSMInvPocketXY[21].sX = INTERFACE_START_X + 439; gSMInvPocketXY[21].sY = INV_INTERFACE_START_Y + 10; // MEDPOCK1 + gSMInvPocketXY[22].sX = INTERFACE_START_X + 439; gSMInvPocketXY[22].sY = INV_INTERFACE_START_Y + 34; // MEDPOCK2 + gSMInvPocketXY[23].sX = INTERFACE_START_X + 295; gSMInvPocketXY[23].sY = INV_INTERFACE_START_Y + 164; // MEDPOCK3 + gSMInvPocketXY[24].sX = INTERFACE_START_X + 343; gSMInvPocketXY[24].sY = INV_INTERFACE_START_Y + 164; // MEDPOCK4 + gSMInvPocketXY[25].sX = INTERFACE_START_X + 324; gSMInvPocketXY[25].sY = INV_INTERFACE_START_Y + 10; // SMALLPOCK1 + gSMInvPocketXY[26].sX = INTERFACE_START_X + 347; gSMInvPocketXY[26].sY = INV_INTERFACE_START_Y + 10; // SMALLPOCK2 + gSMInvPocketXY[27].sX = INTERFACE_START_X + 370; gSMInvPocketXY[27].sY = INV_INTERFACE_START_Y + 10; // SMALLPOCK3 + gSMInvPocketXY[28].sX = INTERFACE_START_X + 393; gSMInvPocketXY[28].sY = INV_INTERFACE_START_Y + 10; // SMALLPOCK4 + gSMInvPocketXY[29].sX = INTERFACE_START_X + 416; gSMInvPocketXY[29].sY = INV_INTERFACE_START_Y + 10; // SMALLPOCK5 + gSMInvPocketXY[30].sX = INTERFACE_START_X + 324; gSMInvPocketXY[30].sY = INV_INTERFACE_START_Y + 34; // SMALLPOCK6 + gSMInvPocketXY[31].sX = INTERFACE_START_X + 347; gSMInvPocketXY[31].sY = INV_INTERFACE_START_Y + 34; // SMALLPOCK7 + gSMInvPocketXY[32].sX = INTERFACE_START_X + 370; gSMInvPocketXY[32].sY = INV_INTERFACE_START_Y + 34; // SMALLPOCK8 + gSMInvPocketXY[33].sX = INTERFACE_START_X + 393; gSMInvPocketXY[33].sY = INV_INTERFACE_START_Y + 34; // SMALLPOCK9 + gSMInvPocketXY[34].sX = INTERFACE_START_X + 416; gSMInvPocketXY[34].sY = INV_INTERFACE_START_Y + 34; // SMALLPOCK10 + gSMInvPocketXY[35].sX = INTERFACE_START_X + 291; gSMInvPocketXY[35].sY = INV_INTERFACE_START_Y + 116; // SMALLPOCK11 + gSMInvPocketXY[36].sX = INTERFACE_START_X + 314; gSMInvPocketXY[36].sY = INV_INTERFACE_START_Y + 116; // SMALLPOCK12 + gSMInvPocketXY[37].sX = INTERFACE_START_X + 291; gSMInvPocketXY[37].sY = INV_INTERFACE_START_Y + 140; // SMALLPOCK13 + gSMInvPocketXY[38].sX = INTERFACE_START_X + 314; gSMInvPocketXY[38].sY = INV_INTERFACE_START_Y + 140; // SMALLPOCK14 + gSMInvPocketXY[39].sX = INTERFACE_START_X + 339; gSMInvPocketXY[39].sY = INV_INTERFACE_START_Y + 116; // SMALLPOCK15 + gSMInvPocketXY[40].sX = INTERFACE_START_X + 362; gSMInvPocketXY[40].sY = INV_INTERFACE_START_Y + 116; // SMALLPOCK16 + gSMInvPocketXY[41].sX = INTERFACE_START_X + 339; gSMInvPocketXY[41].sY = INV_INTERFACE_START_Y + 140; // SMALLPOCK17 + gSMInvPocketXY[42].sX = INTERFACE_START_X + 362; gSMInvPocketXY[42].sY = INV_INTERFACE_START_Y + 140; // SMALLPOCK18 + gSMInvPocketXY[43].sX = INTERFACE_START_X + 387; gSMInvPocketXY[43].sY = INV_INTERFACE_START_Y + 116; // SMALLPOCK19 + gSMInvPocketXY[44].sX = INTERFACE_START_X + 410; gSMInvPocketXY[44].sY = INV_INTERFACE_START_Y + 116; // SMALLPOCK20 + gSMInvPocketXY[45].sX = INTERFACE_START_X + 387; gSMInvPocketXY[45].sY = INV_INTERFACE_START_Y + 140; // SMALLPOCK21 + gSMInvPocketXY[46].sX = INTERFACE_START_X + 410; gSMInvPocketXY[46].sY = INV_INTERFACE_START_Y + 140; // SMALLPOCK22 + gSMInvPocketXY[47].sX = INTERFACE_START_X + 536; gSMInvPocketXY[47].sY = INV_INTERFACE_START_Y + 10; // SMALLPOCK23 + gSMInvPocketXY[48].sX = INTERFACE_START_X + 536; gSMInvPocketXY[48].sY = INV_INTERFACE_START_Y + 34; // SMALLPOCK24 + gSMInvPocketXY[49].sX = INTERFACE_START_X + 536; gSMInvPocketXY[49].sY = INV_INTERFACE_START_Y + 58; // SMALLPOCK25 + gSMInvPocketXY[50].sX = INTERFACE_START_X + 536; gSMInvPocketXY[50].sY = INV_INTERFACE_START_Y + 82; // SMALLPOCK26 + gSMInvPocketXY[51].sX = INTERFACE_START_X + 559; gSMInvPocketXY[51].sY = INV_INTERFACE_START_Y + 10; // SMALLPOCK27 + gSMInvPocketXY[52].sX = INTERFACE_START_X + 559; gSMInvPocketXY[52].sY = INV_INTERFACE_START_Y + 34; // SMALLPOCK28 + gSMInvPocketXY[53].sX = INTERFACE_START_X + 559; gSMInvPocketXY[53].sY = INV_INTERFACE_START_Y + 58; // SMALLPOCK29 + gSMInvPocketXY[54].sX = INTERFACE_START_X + 559; gSMInvPocketXY[54].sY = INV_INTERFACE_START_Y + 82; // SMALLPOCK30 + } + else if(iResolution == 1){ + gSMInvPocketXY[0].sX = INTERFACE_START_X + 258; gSMInvPocketXY[0].sY = INV_INTERFACE_START_Y + 68; // HELMETPOS + gSMInvPocketXY[1].sX = INTERFACE_START_X + 258; gSMInvPocketXY[1].sY = INV_INTERFACE_START_Y + 96; // VESTPOS + gSMInvPocketXY[2].sX = INTERFACE_START_X + 258; gSMInvPocketXY[2].sY = INV_INTERFACE_START_Y + 157; // LEGPOS + gSMInvPocketXY[3].sX = INTERFACE_START_X + 124; gSMInvPocketXY[3].sY = INV_INTERFACE_START_Y + 68; // HEAD1POS + gSMInvPocketXY[4].sX = INTERFACE_START_X + 124; gSMInvPocketXY[4].sY = INV_INTERFACE_START_Y + 92; // HEAD2POS + gSMInvPocketXY[5].sX = INTERFACE_START_X + 124; gSMInvPocketXY[5].sY = INV_INTERFACE_START_Y + 146; // HANDPOS + gSMInvPocketXY[6].sX = INTERFACE_START_X + 124; gSMInvPocketXY[6].sY = INV_INTERFACE_START_Y + 170; // SECONDHANDPOS + gSMInvPocketXY[7].sX = INTERFACE_START_X + 284; gSMInvPocketXY[7].sY = INV_INTERFACE_START_Y + 13; // VESTPOCK + gSMInvPocketXY[8].sX = INTERFACE_START_X + 323; gSMInvPocketXY[8].sY = INV_INTERFACE_START_Y + 79; // LTHIGHPOCK + gSMInvPocketXY[9].sX = INTERFACE_START_X + 439; gSMInvPocketXY[9].sY = INV_INTERFACE_START_Y + 79; // RTHIGHPOCK + gSMInvPocketXY[10].sX = INTERFACE_START_X + 586; gSMInvPocketXY[10].sY = INV_INTERFACE_START_Y + 79; // CPACKPOCK + gSMInvPocketXY[11].sX = INTERFACE_START_X + 594; gSMInvPocketXY[11].sY = INV_INTERFACE_START_Y + 13; // BPACKPOCK + gSMInvPocketXY[12].sX = INTERFACE_START_X + 505; gSMInvPocketXY[12].sY = INV_INTERFACE_START_Y + 79; // GUNSLINGPOCKPOS + gSMInvPocketXY[13].sX = INTERFACE_START_X + 388; gSMInvPocketXY[13].sY = INV_INTERFACE_START_Y + 79; // KNIFEPOCKPOS + gSMInvPocketXY[14].sX = INTERFACE_START_X + 566; gSMInvPocketXY[14].sY = INV_INTERFACE_START_Y + 116; // BIGPOCK1 + gSMInvPocketXY[15].sX = INTERFACE_START_X + 566; gSMInvPocketXY[15].sY = INV_INTERFACE_START_Y + 140; // BIGPOCK2 + gSMInvPocketXY[16].sX = INTERFACE_START_X + 566; gSMInvPocketXY[16].sY = INV_INTERFACE_START_Y + 164; // BIGPOCK3 + gSMInvPocketXY[17].sX = INTERFACE_START_X + 729; gSMInvPocketXY[17].sY = INV_INTERFACE_START_Y + 10; // BIGPOCK4 + gSMInvPocketXY[18].sX = INTERFACE_START_X + 729; gSMInvPocketXY[18].sY = INV_INTERFACE_START_Y + 34; // BIGPOCK5 + gSMInvPocketXY[19].sX = INTERFACE_START_X + 729; gSMInvPocketXY[19].sY = INV_INTERFACE_START_Y + 58; // BIGPOCK6 + gSMInvPocketXY[20].sX = INTERFACE_START_X + 729; gSMInvPocketXY[20].sY = INV_INTERFACE_START_Y + 82; // BIGPOCK7 + gSMInvPocketXY[21].sX = INTERFACE_START_X + 527; gSMInvPocketXY[21].sY = INV_INTERFACE_START_Y + 10; // MEDPOCK1 + gSMInvPocketXY[22].sX = INTERFACE_START_X + 527; gSMInvPocketXY[22].sY = INV_INTERFACE_START_Y + 34; // MEDPOCK2 + gSMInvPocketXY[23].sX = INTERFACE_START_X + 333; gSMInvPocketXY[23].sY = INV_INTERFACE_START_Y + 164; // MEDPOCK3 + gSMInvPocketXY[24].sX = INTERFACE_START_X + 419; gSMInvPocketXY[24].sY = INV_INTERFACE_START_Y + 164; // MEDPOCK4 + gSMInvPocketXY[25].sX = INTERFACE_START_X + 347; gSMInvPocketXY[25].sY = INV_INTERFACE_START_Y + 10; // SMALLPOCK1 + gSMInvPocketXY[26].sX = INTERFACE_START_X + 383; gSMInvPocketXY[26].sY = INV_INTERFACE_START_Y + 10; // SMALLPOCK2 + gSMInvPocketXY[27].sX = INTERFACE_START_X + 419; gSMInvPocketXY[27].sY = INV_INTERFACE_START_Y + 10; // SMALLPOCK3 + gSMInvPocketXY[28].sX = INTERFACE_START_X + 455; gSMInvPocketXY[28].sY = INV_INTERFACE_START_Y + 10; // SMALLPOCK4 + gSMInvPocketXY[29].sX = INTERFACE_START_X + 491; gSMInvPocketXY[29].sY = INV_INTERFACE_START_Y + 10; // SMALLPOCK5 + gSMInvPocketXY[30].sX = INTERFACE_START_X + 347; gSMInvPocketXY[30].sY = INV_INTERFACE_START_Y + 34; // SMALLPOCK6 + gSMInvPocketXY[31].sX = INTERFACE_START_X + 383; gSMInvPocketXY[31].sY = INV_INTERFACE_START_Y + 34; // SMALLPOCK7 + gSMInvPocketXY[32].sX = INTERFACE_START_X + 419; gSMInvPocketXY[32].sY = INV_INTERFACE_START_Y + 34; // SMALLPOCK8 + gSMInvPocketXY[33].sX = INTERFACE_START_X + 455; gSMInvPocketXY[33].sY = INV_INTERFACE_START_Y + 34; // SMALLPOCK9 + gSMInvPocketXY[34].sX = INTERFACE_START_X + 491; gSMInvPocketXY[34].sY = INV_INTERFACE_START_Y + 34; // SMALLPOCK10 + gSMInvPocketXY[35].sX = INTERFACE_START_X + 322; gSMInvPocketXY[35].sY = INV_INTERFACE_START_Y + 116; // SMALLPOCK11 + gSMInvPocketXY[36].sX = INTERFACE_START_X + 358; gSMInvPocketXY[36].sY = INV_INTERFACE_START_Y + 116; // SMALLPOCK12 + gSMInvPocketXY[37].sX = INTERFACE_START_X + 322; gSMInvPocketXY[37].sY = INV_INTERFACE_START_Y + 140; // SMALLPOCK13 + gSMInvPocketXY[38].sX = INTERFACE_START_X + 358; gSMInvPocketXY[38].sY = INV_INTERFACE_START_Y + 140; // SMALLPOCK14 + gSMInvPocketXY[39].sX = INTERFACE_START_X + 408; gSMInvPocketXY[39].sY = INV_INTERFACE_START_Y + 116; // SMALLPOCK15 + gSMInvPocketXY[40].sX = INTERFACE_START_X + 444; gSMInvPocketXY[40].sY = INV_INTERFACE_START_Y + 116; // SMALLPOCK16 + gSMInvPocketXY[41].sX = INTERFACE_START_X + 408; gSMInvPocketXY[41].sY = INV_INTERFACE_START_Y + 140; // SMALLPOCK17 + gSMInvPocketXY[42].sX = INTERFACE_START_X + 444; gSMInvPocketXY[42].sY = INV_INTERFACE_START_Y + 140; // SMALLPOCK18 + gSMInvPocketXY[43].sX = INTERFACE_START_X + 494; gSMInvPocketXY[43].sY = INV_INTERFACE_START_Y + 116; // SMALLPOCK19 + gSMInvPocketXY[44].sX = INTERFACE_START_X + 530; gSMInvPocketXY[44].sY = INV_INTERFACE_START_Y + 116; // SMALLPOCK20 + gSMInvPocketXY[45].sX = INTERFACE_START_X + 494; gSMInvPocketXY[45].sY = INV_INTERFACE_START_Y + 140; // SMALLPOCK21 + gSMInvPocketXY[46].sX = INTERFACE_START_X + 530; gSMInvPocketXY[46].sY = INV_INTERFACE_START_Y + 140; // SMALLPOCK22 + gSMInvPocketXY[47].sX = INTERFACE_START_X + 657; gSMInvPocketXY[47].sY = INV_INTERFACE_START_Y + 10; // SMALLPOCK23 + gSMInvPocketXY[48].sX = INTERFACE_START_X + 657; gSMInvPocketXY[48].sY = INV_INTERFACE_START_Y + 34; // SMALLPOCK24 + gSMInvPocketXY[49].sX = INTERFACE_START_X + 657; gSMInvPocketXY[49].sY = INV_INTERFACE_START_Y + 58; // SMALLPOCK25 + gSMInvPocketXY[50].sX = INTERFACE_START_X + 657; gSMInvPocketXY[50].sY = INV_INTERFACE_START_Y + 82; // SMALLPOCK26 + gSMInvPocketXY[51].sX = INTERFACE_START_X + 693; gSMInvPocketXY[51].sY = INV_INTERFACE_START_Y + 10; // SMALLPOCK27 + gSMInvPocketXY[52].sX = INTERFACE_START_X + 693; gSMInvPocketXY[52].sY = INV_INTERFACE_START_Y + 34; // SMALLPOCK28 + gSMInvPocketXY[53].sX = INTERFACE_START_X + 693; gSMInvPocketXY[53].sY = INV_INTERFACE_START_Y + 58; // SMALLPOCK29 + gSMInvPocketXY[54].sX = INTERFACE_START_X + 693; gSMInvPocketXY[54].sY = INV_INTERFACE_START_Y + 82; // SMALLPOCK30 + } + else if(iResolution == 2){ + //1024x768 resolution + gSMInvPocketXY[0].sX = INTERFACE_START_X + 258; gSMInvPocketXY[0].sY = INV_INTERFACE_START_Y + 68; // HELMETPOS + gSMInvPocketXY[1].sX = INTERFACE_START_X + 258; gSMInvPocketXY[1].sY = INV_INTERFACE_START_Y + 96; // VESTPOS + gSMInvPocketXY[2].sX = INTERFACE_START_X + 258; gSMInvPocketXY[2].sY = INV_INTERFACE_START_Y + 157; // LEGPOS + gSMInvPocketXY[3].sX = INTERFACE_START_X + 124; gSMInvPocketXY[3].sY = INV_INTERFACE_START_Y + 68; // HEAD1POS + gSMInvPocketXY[4].sX = INTERFACE_START_X + 124; gSMInvPocketXY[4].sY = INV_INTERFACE_START_Y + 92; // HEAD2POS + gSMInvPocketXY[5].sX = INTERFACE_START_X + 124; gSMInvPocketXY[5].sY = INV_INTERFACE_START_Y + 146; // HANDPOS + gSMInvPocketXY[6].sX = INTERFACE_START_X + 124; gSMInvPocketXY[6].sY = INV_INTERFACE_START_Y + 170; // SECONDHANDPOS + gSMInvPocketXY[7].sX = INTERFACE_START_X + 284; gSMInvPocketXY[7].sY = INV_INTERFACE_START_Y + 13; // VESTPOCK + gSMInvPocketXY[8].sX = INTERFACE_START_X + 358; gSMInvPocketXY[8].sY = INV_INTERFACE_START_Y + 79; // LTHIGHPOCK + gSMInvPocketXY[9].sX = INTERFACE_START_X + 516; gSMInvPocketXY[9].sY = INV_INTERFACE_START_Y + 79; // RTHIGHPOCK + gSMInvPocketXY[10].sX = INTERFACE_START_X + 594; gSMInvPocketXY[10].sY = INV_INTERFACE_START_Y + 128; // CPACKPOCK + gSMInvPocketXY[11].sX = INTERFACE_START_X + 594; gSMInvPocketXY[11].sY = INV_INTERFACE_START_Y + 13; // BPACKPOCK + gSMInvPocketXY[12].sX = INTERFACE_START_X + 429; gSMInvPocketXY[12].sY = INV_INTERFACE_START_Y + 79; // GUNSLINGPOCKPOS + gSMInvPocketXY[13].sX = INTERFACE_START_X + 594; gSMInvPocketXY[13].sY = INV_INTERFACE_START_Y + 79; // KNIFEPOCKPOS + gSMInvPocketXY[14].sX = INTERFACE_START_X + 729; gSMInvPocketXY[14].sY = INV_INTERFACE_START_Y + 116; // BIGPOCK1 + gSMInvPocketXY[15].sX = INTERFACE_START_X + 729; gSMInvPocketXY[15].sY = INV_INTERFACE_START_Y + 140; // BIGPOCK2 + gSMInvPocketXY[16].sX = INTERFACE_START_X + 729; gSMInvPocketXY[16].sY = INV_INTERFACE_START_Y + 164; // BIGPOCK3 + gSMInvPocketXY[17].sX = INTERFACE_START_X + 729; gSMInvPocketXY[17].sY = INV_INTERFACE_START_Y + 10; // BIGPOCK4 + gSMInvPocketXY[18].sX = INTERFACE_START_X + 729; gSMInvPocketXY[18].sY = INV_INTERFACE_START_Y + 34; // BIGPOCK5 + gSMInvPocketXY[19].sX = INTERFACE_START_X + 729; gSMInvPocketXY[19].sY = INV_INTERFACE_START_Y + 58; // BIGPOCK6 + gSMInvPocketXY[20].sX = INTERFACE_START_X + 729; gSMInvPocketXY[20].sY = INV_INTERFACE_START_Y + 82; // BIGPOCK7 + gSMInvPocketXY[21].sX = INTERFACE_START_X + 527; gSMInvPocketXY[21].sY = INV_INTERFACE_START_Y + 10; // MEDPOCK1 + gSMInvPocketXY[22].sX = INTERFACE_START_X + 527; gSMInvPocketXY[22].sY = INV_INTERFACE_START_Y + 34; // MEDPOCK2 + gSMInvPocketXY[23].sX = INTERFACE_START_X + 358; gSMInvPocketXY[23].sY = INV_INTERFACE_START_Y + 164; // MEDPOCK3 + gSMInvPocketXY[24].sX = INTERFACE_START_X + 516; gSMInvPocketXY[24].sY = INV_INTERFACE_START_Y + 164; // MEDPOCK4 + gSMInvPocketXY[25].sX = INTERFACE_START_X + 347; gSMInvPocketXY[25].sY = INV_INTERFACE_START_Y + 10; // SMALLPOCK1 + gSMInvPocketXY[26].sX = INTERFACE_START_X + 383; gSMInvPocketXY[26].sY = INV_INTERFACE_START_Y + 10; // SMALLPOCK2 + gSMInvPocketXY[27].sX = INTERFACE_START_X + 419; gSMInvPocketXY[27].sY = INV_INTERFACE_START_Y + 10; // SMALLPOCK3 + gSMInvPocketXY[28].sX = INTERFACE_START_X + 455; gSMInvPocketXY[28].sY = INV_INTERFACE_START_Y + 10; // SMALLPOCK4 + gSMInvPocketXY[29].sX = INTERFACE_START_X + 491; gSMInvPocketXY[29].sY = INV_INTERFACE_START_Y + 10; // SMALLPOCK5 + gSMInvPocketXY[30].sX = INTERFACE_START_X + 347; gSMInvPocketXY[30].sY = INV_INTERFACE_START_Y + 34; // SMALLPOCK6 + gSMInvPocketXY[31].sX = INTERFACE_START_X + 383; gSMInvPocketXY[31].sY = INV_INTERFACE_START_Y + 34; // SMALLPOCK7 + gSMInvPocketXY[32].sX = INTERFACE_START_X + 419; gSMInvPocketXY[32].sY = INV_INTERFACE_START_Y + 34; // SMALLPOCK8 + gSMInvPocketXY[33].sX = INTERFACE_START_X + 455; gSMInvPocketXY[33].sY = INV_INTERFACE_START_Y + 34; // SMALLPOCK9 + gSMInvPocketXY[34].sX = INTERFACE_START_X + 491; gSMInvPocketXY[34].sY = INV_INTERFACE_START_Y + 34; // SMALLPOCK10 + gSMInvPocketXY[35].sX = INTERFACE_START_X + 347; gSMInvPocketXY[35].sY = INV_INTERFACE_START_Y + 116; // SMALLPOCK11 + gSMInvPocketXY[36].sX = INTERFACE_START_X + 383; gSMInvPocketXY[36].sY = INV_INTERFACE_START_Y + 116; // SMALLPOCK12 + gSMInvPocketXY[37].sX = INTERFACE_START_X + 347; gSMInvPocketXY[37].sY = INV_INTERFACE_START_Y + 140; // SMALLPOCK13 + gSMInvPocketXY[38].sX = INTERFACE_START_X + 383; gSMInvPocketXY[38].sY = INV_INTERFACE_START_Y + 140; // SMALLPOCK14 + gSMInvPocketXY[39].sX = INTERFACE_START_X + 505; gSMInvPocketXY[39].sY = INV_INTERFACE_START_Y + 116; // SMALLPOCK15 + gSMInvPocketXY[40].sX = INTERFACE_START_X + 541; gSMInvPocketXY[40].sY = INV_INTERFACE_START_Y + 116; // SMALLPOCK16 + gSMInvPocketXY[41].sX = INTERFACE_START_X + 505; gSMInvPocketXY[41].sY = INV_INTERFACE_START_Y + 140; // SMALLPOCK17 + gSMInvPocketXY[42].sX = INTERFACE_START_X + 541; gSMInvPocketXY[42].sY = INV_INTERFACE_START_Y + 140; // SMALLPOCK18 + gSMInvPocketXY[43].sX = INTERFACE_START_X + 657; gSMInvPocketXY[43].sY = INV_INTERFACE_START_Y + 116; // SMALLPOCK19 + gSMInvPocketXY[44].sX = INTERFACE_START_X + 693; gSMInvPocketXY[44].sY = INV_INTERFACE_START_Y + 116; // SMALLPOCK20 + gSMInvPocketXY[45].sX = INTERFACE_START_X + 657; gSMInvPocketXY[45].sY = INV_INTERFACE_START_Y + 140; // SMALLPOCK21 + gSMInvPocketXY[46].sX = INTERFACE_START_X + 693; gSMInvPocketXY[46].sY = INV_INTERFACE_START_Y + 140; // SMALLPOCK22 + gSMInvPocketXY[47].sX = INTERFACE_START_X + 657; gSMInvPocketXY[47].sY = INV_INTERFACE_START_Y + 10; // SMALLPOCK23 + gSMInvPocketXY[48].sX = INTERFACE_START_X + 657; gSMInvPocketXY[48].sY = INV_INTERFACE_START_Y + 34; // SMALLPOCK24 + gSMInvPocketXY[49].sX = INTERFACE_START_X + 657; gSMInvPocketXY[49].sY = INV_INTERFACE_START_Y + 58; // SMALLPOCK25 + gSMInvPocketXY[50].sX = INTERFACE_START_X + 657; gSMInvPocketXY[50].sY = INV_INTERFACE_START_Y + 82; // SMALLPOCK26 + gSMInvPocketXY[51].sX = INTERFACE_START_X + 693; gSMInvPocketXY[51].sY = INV_INTERFACE_START_Y + 10; // SMALLPOCK27 + gSMInvPocketXY[52].sX = INTERFACE_START_X + 693; gSMInvPocketXY[52].sY = INV_INTERFACE_START_Y + 34; // SMALLPOCK28 + gSMInvPocketXY[53].sX = INTERFACE_START_X + 693; gSMInvPocketXY[53].sY = INV_INTERFACE_START_Y + 58; // SMALLPOCK29 + gSMInvPocketXY[54].sX = INTERFACE_START_X + 693; gSMInvPocketXY[54].sY = INV_INTERFACE_START_Y + 82; // SMALLPOCK30 + } + + SM_ITEMDESC_START_X = ( 114 + INTERFACE_START_X ); //115 + SM_ITEMDESC_START_Y = ( 1 + INV_INTERFACE_START_Y ); + SM_ITEMDESC_HEIGHT = 128; + SM_ITEMDESC_WIDTH = 358; + + SM_SELMERC_AP_X = ( 71 + INTERFACE_START_X ); + SM_SELMERC_AP_Y = ( 53 + INV_INTERFACE_START_Y ); + SM_SELMERC_AP_HEIGHT = 12; + SM_SELMERC_AP_WIDTH = 11; + + SM_SELMERC_HEALTH_X = ( 70 + INTERFACE_START_X ); + SM_SELMERC_HEALTH_Y = ( 48 + INV_INTERFACE_START_Y ); + SM_SELMERC_HEALTH_WIDTH = 3; + SM_SELMERC_HEALTH_HEIGHT = 42; + + SM_SELMERC_BREATH_X = ( 76 + INTERFACE_START_X ); + SM_SELMERC_BREATH_Y = ( 48 + INV_INTERFACE_START_Y ); + SM_SELMERC_BREATH_WIDTH = 3; + SM_SELMERC_BREATH_HEIGHT = 42; + + SM_SELMERC_MORALE_X = ( 82 + INTERFACE_START_X ); + SM_SELMERC_MORALE_Y = ( 48 + INV_INTERFACE_START_Y ); + SM_SELMERC_MORALE_WIDTH = 3; + SM_SELMERC_MORALE_HEIGHT = 42; + + SM_SELMERC_BARS_TIP_X = ( SM_SELMERC_HEALTH_X - SM_SELMERC_HEALTH_WIDTH ); + SM_SELMERC_BARS_TIP_Y = ( SM_SELMERC_HEALTH_Y - SM_SELMERC_HEALTH_HEIGHT ); + SM_SELMERC_BARS_TIP_WIDTH = ((SM_SELMERC_BREATH_WIDTH + 4) *3); + SM_SELMERC_BARS_TIP_HEIGHT= ( SM_SELMERC_HEALTH_HEIGHT ); + + SM_SELMERCNAME_X = ( 12 + INTERFACE_START_X ); + SM_SELMERCNAME_Y = ( 55 + INV_INTERFACE_START_Y ); + SM_SELMERCNAME_WIDTH = 53; + SM_SELMERCNAME_HEIGHT = 11; + + SM_SELMERC_FACE_X = ( 14 + INTERFACE_START_X ); + SM_SELMERC_FACE_Y = ( 5 + INV_INTERFACE_START_Y ); + SM_SELMERC_FACE_HEIGHT = 42; + SM_SELMERC_FACE_WIDTH = 48; + + SM_SELMERC_PLATE_X = ( 5 + INTERFACE_START_X ); + SM_SELMERC_PLATE_Y = ( 2 + INV_INTERFACE_START_Y ); + SM_SELMERC_PLATE_HEIGHT = 65; + SM_SELMERC_PLATE_WIDTH = 83; + + if(iResolution == 0){ + SM_BODYINV_X = ( 141 + INTERFACE_START_X ); + SM_BODYINV_Y = ( 68 + INV_INTERFACE_START_Y ); + } + else{ + SM_BODYINV_X = ( 151 + INTERFACE_START_X ); + SM_BODYINV_Y = ( 68 + INV_INTERFACE_START_Y ); + } + + // Cammo + gSMCamoXY.sX = SM_BODYINV_X; gSMCamoXY.sY = SM_BODYINV_Y; + + SM_UPDOWNB_X = ( 8 + INTERFACE_START_X ); + SM_UPDOWNB_Y = ( 70 + INV_INTERFACE_START_Y ); + SM_HANDCURSORB_X = ( 33 + INTERFACE_START_X ); + SM_HANDCURSORB_Y = ( 70 + INV_INTERFACE_START_Y ); + SM_CLIMBB_X = ( 58 + INTERFACE_START_X ); + SM_CLIMBB_Y = ( 70 + INV_INTERFACE_START_Y ); + SM_MUTEB_X = ( 8 + INTERFACE_START_X ); + SM_MUTEB_Y = ( 98 + INV_INTERFACE_START_Y ); + SM_LOOKB_X = ( 33 + INTERFACE_START_X ); + SM_LOOKB_Y = ( 98 + INV_INTERFACE_START_Y ); + SM_TALKB_X = ( 58 + INTERFACE_START_X ); + SM_TALKB_Y = ( 98 + INV_INTERFACE_START_Y ); + SM_STANCEUPB_X = ( 88 + INTERFACE_START_X ); + SM_STANCEUPB_Y = ( 70 + INV_INTERFACE_START_Y ); + SM_STEALTHMODE_X = ( 88 + INTERFACE_START_X ); + SM_STEALTHMODE_Y = ( 98 + INV_INTERFACE_START_Y ); + SM_STANCEDOWNB_X = ( 88 + INTERFACE_START_X ); + SM_STANCEDOWNB_Y = ( 126 + INV_INTERFACE_START_Y ); + SM_BURSTMODEB_X = ( 88 + INTERFACE_START_X ); + SM_BURSTMODEB_Y = ( 167 + INV_INTERFACE_START_Y ); + SM_PREVMERCB_X = ( 10 + INTERFACE_START_X ); + SM_PREVMERCB_Y = ( 130 + INV_INTERFACE_START_Y ); + SM_NEXTMERCB_X = ( 52 + INTERFACE_START_X ); + SM_NEXTMERCB_Y = ( 130 + INV_INTERFACE_START_Y ); + SM_OPTIONSB_X = ( 10 + INTERFACE_START_X ); + SM_OPTIONSB_Y = ( 165 + INV_INTERFACE_START_Y ); + // CHRISL: Backpack buttons + if(iResolution == 0){ + SM_DROPPACK_X = ( 504 + INTERFACE_START_X ); + SM_DROPPACK_Y = ( 39 + INV_INTERFACE_START_Y ); + SM_ZIPPER_X = ( 482 + INTERFACE_START_X ); + SM_ZIPPER_Y = ( 39 + INV_INTERFACE_START_Y ); + } + else{ + SM_DROPPACK_X = ( 612 + INTERFACE_START_X ); + SM_DROPPACK_Y = ( 39 + INV_INTERFACE_START_Y ); + SM_ZIPPER_X = ( 590 + INTERFACE_START_X ); + SM_ZIPPER_Y = ( 39 + INV_INTERFACE_START_Y ); + } + + // WANNE 2 + SM_DONE_X = (SCREEN_WIDTH - 152); + SM_DONE_Y = ( 118 + INV_INTERFACE_START_Y ); + SM_MAPSCREEN_X = (SCREEN_WIDTH - 152); + SM_MAPSCREEN_Y = ( 140 + INV_INTERFACE_START_Y ); + + SM_POSITIONB_X = ( 106 + INTERFACE_START_X ); + SM_POSITIONB_Y = ( 34 + INV_INTERFACE_START_Y ); + SM_POSITIONB_WIDTH = 19; + SM_POSITIONB_HEIGHT = 24; + + SM_PERCENT_WIDTH = 20; + SM_PERCENT_HEIGHT = 10; + + if(iResolution == 0){ + SM_ARMOR_X = ( 245 + INTERFACE_START_X ); + SM_ARMOR_Y = ( 141 + INV_INTERFACE_START_Y ); + SM_ARMOR_LABEL_X = ( 260 + INTERFACE_START_X ); + SM_ARMOR_LABEL_Y = ( 131 + INV_INTERFACE_START_Y ); + SM_ARMOR_PERCENT_X = ( 265 + INTERFACE_START_X ); + SM_ARMOR_PERCENT_Y = ( 141 + INV_INTERFACE_START_Y ); + } + else{ + SM_ARMOR_X = ( 264 + INTERFACE_START_X ); + SM_ARMOR_Y = ( 141 + INV_INTERFACE_START_Y ); + SM_ARMOR_LABEL_X = ( 279 + INTERFACE_START_X ); + SM_ARMOR_LABEL_Y = ( 131 + INV_INTERFACE_START_Y ); + SM_ARMOR_PERCENT_X = ( 284 + INTERFACE_START_X ); + SM_ARMOR_PERCENT_Y = ( 141 + INV_INTERFACE_START_Y ); + } + + SM_WEIGHT_LABEL_X = ( 220 + INTERFACE_START_X ); + SM_WEIGHT_LABEL_Y = ( 34 + INV_INTERFACE_START_Y ); + SM_WEIGHT_PERCENT_X = ( 239 + INTERFACE_START_X ); + SM_WEIGHT_PERCENT_Y = ( 34 + INV_INTERFACE_START_Y ); + SM_WEIGHT_X = ( 218 + INTERFACE_START_X ); + SM_WEIGHT_Y = ( 33 + INV_INTERFACE_START_Y ); + + SM_CAMMO_LABEL_X = ( 220 + INTERFACE_START_X ); + SM_CAMMO_LABEL_Y = ( 50 + INV_INTERFACE_START_Y ); + SM_CAMMO_PERCENT_X = ( 239 + INTERFACE_START_X ); + SM_CAMMO_PERCENT_Y = ( 49 + INV_INTERFACE_START_Y ); + SM_CAMMO_X = ( 218 + INTERFACE_START_X ); + SM_CAMMO_Y = ( 49 + INV_INTERFACE_START_Y ); + + SM_STATS_WIDTH = 30; + SM_STATS_HEIGHT = 8 ; + SM_AGI_X = ( 101 + INTERFACE_START_X ); + SM_AGI_Y = ( 7 + INV_INTERFACE_START_Y ); + SM_DEX_X = ( 101 + INTERFACE_START_X ); + SM_DEX_Y = ( 17 + INV_INTERFACE_START_Y ); + SM_STR_X = ( 101 + INTERFACE_START_X ); + SM_STR_Y = ( 27 + INV_INTERFACE_START_Y ); + SM_CHAR_X = ( 101 + INTERFACE_START_X ); + SM_CHAR_Y = ( 37 + INV_INTERFACE_START_Y ); + SM_WIS_X = ( 101 + INTERFACE_START_X ); + SM_WIS_Y = ( 47 + INV_INTERFACE_START_Y ); + SM_EXPLVL_X = ( 150 + INTERFACE_START_X ); + SM_EXPLVL_Y = ( 7 + INV_INTERFACE_START_Y ); + SM_MRKM_X = ( 150 + INTERFACE_START_X ); + SM_MRKM_Y = ( 17 + INV_INTERFACE_START_Y ); + SM_EXPL_X = ( 150 + INTERFACE_START_X ); + SM_EXPL_Y = ( 27 + INV_INTERFACE_START_Y ); + SM_MECH_X = ( 150 + INTERFACE_START_X ); + SM_MECH_Y = ( 37 + INV_INTERFACE_START_Y ); + SM_MED_X = ( 150 + INTERFACE_START_X ); + SM_MED_Y = ( 47 + INV_INTERFACE_START_Y ); + + MONEY_X = ( 185 + INTERFACE_START_X ); + MONEY_Y = ( 5 + INV_INTERFACE_START_Y ); + MONEY_WIDTH = 30; + MONEY_HEIGHT = 22; // ow ye font color they can also be customizable :P STATS_TITLE_FONT_COLOR = 6; STATS_TEXT_FONT_COLOR = 5; // ow and te clock and location i will put it here - INTERFACE_CLOCK_X = (SCREEN_WIDTH - 86); //( 554 + INTERFACE_START_X ); - INTERFACE_CLOCK_Y = ( 119 + INV_INTERFACE_START_Y ); - LOCATION_NAME_X = (SCREEN_WIDTH - 92); //( 548 + INTERFACE_START_X ); - LOCATION_NAME_Y = ( 65 + INTERFACE_START_Y ); + INTERFACE_CLOCK_X = (SCREEN_WIDTH - 86); + INTERFACE_CLOCK_Y = ( 116 + INV_INTERFACE_START_Y ); + LOCATION_NAME_X = (SCREEN_WIDTH - 92); + LOCATION_NAME_Y = ( 87 + INTERFACE_START_Y ); + + //Keyring + KEYRING_X = 209; + KEYRING_Y = (4 + INV_INTERFACE_START_Y); // so we got everything "dynamic" now we just return TRUE return ( TRUE ); } -BOOLEAN InitializeSMPanel( ) -{ - VOBJECT_DESC VObjectDesc; - /* OK i need to initialize coords here - * Isnt it cool - * any questions? joker +BOOLEAN InitializeSMPanel( ) +{ + VOBJECT_DESC VObjectDesc; + + /* OK i need to initialize coords here + * Isnt it cool + * any questions? joker */ // InitializeSMPanelCoords( ); fDisplayOverheadMap = TRUE; - + // failing the CHECKF after this will cause you to lose your mouse VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; @@ -1437,7 +1996,7 @@ BOOLEAN InitializeSMPanel( ) FilenameForBPP("INTERFACE\\Bars.sti", VObjectDesc.ImageFile); CHECKF( AddVideoObject( &VObjectDesc, &guiBrownBackgroundForTeamPanel ) ); - + // Clear inv display stuff memset( gfSM_HandInvDispText, 0, sizeof( gfSM_HandInvDispText ) ); @@ -1453,13 +2012,13 @@ BOOLEAN InitializeSMPanel( ) // Set viewports // Define region for panel MSYS_DefineRegion( &gSMPanelRegion, 0, INV_INTERFACE_START_Y ,SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_NORMAL, - CURSOR_NORMAL, MSYS_NO_CALLBACK, InvPanelButtonClickCallback ); + CURSOR_NORMAL, MSYS_NO_CALLBACK, InvPanelButtonClickCallback ); // Add region MSYS_AddRegion( &gSMPanelRegion); //DEfine region for selected guy panel MSYS_DefineRegion( &gSM_SELMERCPanelRegion, SM_SELMERC_FACE_X, SM_SELMERC_FACE_Y, SM_SELMERC_FACE_X + SM_SELMERC_FACE_WIDTH, SM_SELMERC_FACE_Y + SM_SELMERC_FACE_HEIGHT, MSYS_PRIORITY_NORMAL, - MSYS_NO_CURSOR, SelectedMercButtonMoveCallback, SelectedMercButtonCallback ); + MSYS_NO_CURSOR, SelectedMercButtonMoveCallback, SelectedMercButtonCallback ); // Add region MSYS_AddRegion( &gSM_SELMERCPanelRegion ); @@ -1467,14 +2026,14 @@ BOOLEAN InitializeSMPanel( ) //DEfine region for selected guy panel MSYS_DefineRegion( &gSM_SELMERCEnemyIndicatorRegion, SM_SELMERC_FACE_X + 1, SM_SELMERC_FACE_Y + 1, SM_SELMERC_FACE_X + INDICATOR_BOX_WIDTH, SM_SELMERC_FACE_Y + INDICATOR_BOX_HEIGHT, MSYS_PRIORITY_NORMAL, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectedMercEnemyIndicatorCallback ); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectedMercEnemyIndicatorCallback ); // Add region MSYS_AddRegion( &gSM_SELMERCEnemyIndicatorRegion ); //DEfine region for money button MSYS_DefineRegion( &gSM_SELMERCMoneyRegion, MONEY_X, MONEY_Y, MONEY_X + MONEY_WIDTH, MONEY_Y + MONEY_HEIGHT, MSYS_PRIORITY_HIGH, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SMInvMoneyButtonCallback ); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SMInvMoneyButtonCallback ); // Add region MSYS_AddRegion( &gSM_SELMERCMoneyRegion ); @@ -1491,11 +2050,17 @@ BOOLEAN InitializeSMPanel( ) //DEfine region for selected guy panel // THIS IS A REGION OF BAR TIPS - MSYS_DefineRegion( &gSM_SELMERCBarsRegion, SM_SELMERC_BARS_TIP_X, SM_SELMERC_BARS_TIP_Y, + MSYS_DefineRegion( &gSM_SELMERCBarsRegion, SM_SELMERC_BARS_TIP_X, SM_SELMERC_BARS_TIP_Y, SM_SELMERC_BARS_TIP_X + SM_SELMERC_BARS_TIP_WIDTH, SM_SELMERC_BARS_TIP_Y + SM_SELMERC_BARS_TIP_HEIGHT, MSYS_PRIORITY_NORMAL, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectedMercButtonCallback ); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectedMercButtonCallback ); MSYS_AddRegion( &gSM_SELMERCBarsRegion ); + + // CHRISL: Setup default coords + if((UsingNewInventorySystem() == true)) + InitInventoryNew(); + else + InitInventoryOld(); InitInvSlotInterface( gSMInvPocketXY, &gSMCamoXY, SMInvMoveCallback, SMInvClickCallback, SMInvMoveCammoCallback, SMInvClickCamoCallback, FALSE ); @@ -1523,45 +2088,50 @@ BOOLEAN CreateSMPanelButtons( ) { CHAR8 ubString[48]; - giSMStealthImages = -1; - giSMStealthButton = -1; + // CHRISL: Reset backpack buttons as well + giSMStealthImages = giSMZipperImages = giSMDropPackImages = -1; + giSMStealthButton = giSMZipperButton = giSMDropPackButton = -1; gfUIStanceDifferent = TRUE; gfAllDisabled = FALSE; FilenameForBPP("INTERFACE\\inventory_buttons.sti", ubString); // Load button Graphics - iSMPanelImages[ STANCEUP_IMAGES ] = LoadButtonImage(ubString,-1,0,-1,10,-1 ); + iSMPanelImages[ STANCEUP_IMAGES ] = LoadButtonImage(ubString,-1,0,-1,10,-1 ); - iSMPanelImages[ UPDOWN_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ] ,-1,9,-1,19,-1 ); - iSMPanelImages[ CLIMB_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ] ,-1,3,-1,13,-1 ); - iSMPanelImages[ STANCEDOWN_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ] ,-1,8,-1,18,-1 ); - iSMPanelImages[ HANDCURSOR_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ] ,-1,1,-1,11,-1 ); - iSMPanelImages[ PREVMERC_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ] ,-1,20,-1,22,-1 ); - iSMPanelImages[ NEXTMERC_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ] ,-1,21,-1,23,-1 ); - //iSMPanelImages[ BURSTMODE_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ] ,-1,7,-1,17,-1 ); - iSMPanelImages[ LOOK_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ] ,-1,2,-1,12,-1 ); - iSMPanelImages[ TALK_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ] ,-1,6,-1,16,-1 ); - iSMPanelImages[ MUTE_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ] ,-1,5,-1,15,-1 ); - iSMPanelImages[ OPTIONS_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ] ,-1,24,-1,25,-1 ); + iSMPanelImages[ UPDOWN_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ] ,-1,9,-1,19,-1 ); + iSMPanelImages[ CLIMB_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ] ,-1,3,-1,13,-1 ); + iSMPanelImages[ STANCEDOWN_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ] ,-1,8,-1,18,-1 ); + iSMPanelImages[ HANDCURSOR_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ] ,-1,1,-1,11,-1 ); + iSMPanelImages[ PREVMERC_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ] ,-1,20,-1,22,-1 ); + iSMPanelImages[ NEXTMERC_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ] ,-1,21,-1,23,-1 ); + //iSMPanelImages[ BURSTMODE_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ] ,-1,7,-1,17,-1 ); + iSMPanelImages[ LOOK_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ] ,-1,2,-1,12,-1 ); + iSMPanelImages[ TALK_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ] ,-1,6,-1,16,-1 ); + iSMPanelImages[ MUTE_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ] ,-1,5,-1,15,-1 ); + iSMPanelImages[ OPTIONS_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ] ,-1,24,-1,25,-1 ); + + iBurstButtonImages[ WM_NORMAL ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ], -1, 7, -1, -1, -1 ); + iBurstButtonImages[ WM_BURST ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ], -1, 17, -1, -1, -1 ); + iBurstButtonImages[ WM_AUTOFIRE ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ], -1, 17, -1, -1, -1 ); + iBurstButtonImages[ WM_ATTACHED_GL ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ], -1, 26, -1, -1, -1 ); + iBurstButtonImages[ WM_ATTACHED_GL_BURST ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ], -1, 17, -1, -1, -1 ); + iBurstButtonImages[ WM_ATTACHED_GL_AUTO ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ], -1, 17, -1, -1, -1 ); - iBurstButtonImages[ WM_NORMAL ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ], -1, 7, -1, -1, -1 ); - iBurstButtonImages[ WM_BURST ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ], -1, 17, -1, -1, -1 ); - iBurstButtonImages[ WM_AUTOFIRE ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ], -1, 17, -1, -1, -1 ); - iBurstButtonImages[ WM_ATTACHED_GL ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ], -1, 26, -1, -1, -1 ); - iBurstButtonImages[ WM_ATTACHED_GL_BURST ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ], -1, 17, -1, -1, -1 ); - iBurstButtonImages[ WM_ATTACHED_GL_AUTO ] = UseLoadedButtonImage( iSMPanelImages[ STANCEUP_IMAGES ], -1, 17, -1, -1, -1 ); - FilenameForBPP("INTERFACE\\invadd-ons.sti", ubString); // Load button Graphics - iSMPanelImages[ STANCE_IMAGES ] = LoadButtonImage(ubString,0,0,-1,2,-1 ); + iSMPanelImages[ STANCE_IMAGES ] = LoadButtonImage(ubString,0,0,-1,2,-1 ); FilenameForBPP("INTERFACE\\inventory_buttons_2.sti", ubString); // Load button Graphics - iSMPanelImages[ DONE_IMAGES ] = LoadButtonImage(ubString,-1,1,-1,3,-1 ); - iSMPanelImages[ MAPSCREEN_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ DONE_IMAGES ] ,-1,0,-1,2,-1 ); + iSMPanelImages[ DONE_IMAGES ] = LoadButtonImage(ubString,-1,1,-1,3,-1 ); + iSMPanelImages[ MAPSCREEN_IMAGES ] = UseLoadedButtonImage( iSMPanelImages[ DONE_IMAGES ] ,-1,0,-1,2,-1 ); + // CHRISL: Needed for new inventory backpack buttons + FilenameForBPP("INTERFACE\\backpack_buttons.sti", ubString); + iSMPanelImages[ BACKPACK_IMAGES ] = LoadButtonImage(ubString,0,0,-1,2,-1 ); + // Create buttons // SET BUTTONS TO -1 @@ -1574,11 +2144,11 @@ CHAR8 ubString[48]; SetBtnHelpEndCallback( iSMPanelButtons[ SM_MAP_SCREEN_BUTTON ], HelpTextDoneCallback ); iSMPanelButtons[ SM_DONE_BUTTON ] = CreateIconAndTextButton( iSMPanelImages[ DONE_IMAGES ], L"", FONT12ARIAL, - FONT_MCOLOR_WHITE, DEFAULT_SHADOW , - FONT_MCOLOR_WHITE, DEFAULT_SHADOW , - TEXT_CJUSTIFIED, - SM_DONE_X, SM_DONE_Y, BUTTON_TOGGLE ,MSYS_PRIORITY_HIGH-1, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)BtnSMDoneCallback ); + FONT_MCOLOR_WHITE, DEFAULT_SHADOW , + FONT_MCOLOR_WHITE, DEFAULT_SHADOW , + TEXT_CJUSTIFIED, + SM_DONE_X, SM_DONE_Y, BUTTON_TOGGLE ,MSYS_PRIORITY_HIGH-1, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)BtnSMDoneCallback ); SetButtonFastHelpText( iSMPanelButtons[ SM_DONE_BUTTON ], TacticalStr[ END_TURN_POPUPTEXT ] ); SetBtnHelpEndCallback( iSMPanelButtons[ SM_DONE_BUTTON ], HelpTextDoneCallback ); @@ -1732,7 +2302,7 @@ CHAR8 ubString[48]; return( TRUE ); } -void RemoveSMPanelButtons( ) +void RemoveSMPanelButtons( ) { UINT32 cnt; @@ -1746,7 +2316,10 @@ void RemoveSMPanelButtons( ) for ( cnt = 0; cnt < NUM_SM_BUTTON_IMAGES; cnt++ ) { - UnloadButtonImage( iSMPanelImages[ cnt ] ); + if(iSMPanelImages[ cnt ] != -1) + { + UnloadButtonImage( iSMPanelImages[ cnt ] ); + } } if ( giSMStealthButton != -1 ) @@ -1754,10 +2327,13 @@ void RemoveSMPanelButtons( ) RemoveButton( giSMStealthButton ); } + RenderBackpackButtons(1); /* CHRISL: Needed for new inventory backpack buttons */ + if ( giSMStealthImages != -1 ) { UnloadButtonImage( giSMStealthImages ); } + RenderBackpackButtons(4); /* CHRISL: Needed for new inventory backpack buttons */ UnloadButtonImage( iBurstButtonImages[ WM_NORMAL ] ); UnloadButtonImage( iBurstButtonImages[ WM_BURST ] ); @@ -1798,7 +2374,7 @@ BOOLEAN ShutdownSMPanel( ) // shutdown keyring interface ShutdownKeyRingInterface( ); - + MSYS_RemoveRegion( &gSMPanelRegion ); MSYS_RemoveRegion( &gSM_SELMERCPanelRegion ); MSYS_RemoveRegion( &gSM_SELMERCBarsRegion ); @@ -1812,6 +2388,9 @@ BOOLEAN ShutdownSMPanel( ) RemoveSMPanelButtons( ); + //CHRISL: Following line is to make sure that team panel buttons activate + DisableTacticalTeamPanelButtons( FALSE ); + return( TRUE ); } @@ -1821,7 +2400,7 @@ void RenderSMPanel( BOOLEAN *pfDirty ) INT16 sFontX, sFontY; INT16 usX, usY; CHAR16 sString[9]; - UINT32 cnt = 0xff000000; // Give a value that ought to crash it if this is really undefined for the robot + UINT32 cnt; static CHAR16 pStr[ 200 ], pMoraleStr[ 20 ]; if ( gubSelectSMPanelToMerc != NOBODY ) @@ -1838,7 +2417,7 @@ void RenderSMPanel( BOOLEAN *pfDirty ) } if ( gfCheckForMouseOverItem ) - { + { if ( ( GetJA2Clock( ) - guiMouseOverItemTime ) > 100 ) { if ( HandleCompatibleAmmoUI( gpSMCurrentMerc, (INT8)gbCheckForMouseOverItemPos, TRUE ) ) @@ -1866,7 +2445,8 @@ void RenderSMPanel( BOOLEAN *pfDirty ) if ( InItemDescriptionBox( ) ) { - BltVideoObjectFromIndex( guiSAVEBUFFER, guiSMPanel, 0, INTERFACE_START_X, INV_INTERFACE_START_Y, VO_BLT_SRCTRANSPARENCY, NULL ); + // CHRISL: Changed 3rd parameter so we can display graphic based on inventory system used + BltVideoObjectFromIndex( guiSAVEBUFFER, guiSMPanel, UsingNewInventorySystem(), INTERFACE_START_X, INV_INTERFACE_START_Y, VO_BLT_SRCTRANSPARENCY, NULL ); RenderSoldierFace( gpSMCurrentMerc, SM_SELMERC_FACE_X, SM_SELMERC_FACE_Y, TRUE ); @@ -1878,7 +2458,7 @@ void RenderSMPanel( BOOLEAN *pfDirty ) } else { - if ( gusSelectedSoldier == gpSMCurrentMerc->ubID && gTacticalStatus.ubCurrentTeam == OUR_TEAM && OK_INTERRUPT_MERC( gpSMCurrentMerc ) ) + if ( gusSelectedSoldier == gpSMCurrentMerc->ubID && gTacticalStatus.ubCurrentTeam == OUR_TEAM && OK_INTERRUPT_MERC( gpSMCurrentMerc ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiSMObjects, 0, SM_SELMERC_PLATE_X, SM_SELMERC_PLATE_Y, VO_BLT_SRCTRANSPARENCY, NULL ); RestoreExternBackgroundRect( SM_SELMERC_PLATE_X, SM_SELMERC_PLATE_Y, SM_SELMERC_PLATE_WIDTH , SM_SELMERC_PLATE_HEIGHT ); @@ -1889,10 +2469,10 @@ void RenderSMPanel( BOOLEAN *pfDirty ) } else { + // CHRISL: Changed 3rd parameter so we can display graphic based on inventory system used + BltVideoObjectFromIndex( guiSAVEBUFFER, guiSMPanel, UsingNewInventorySystem(), INTERFACE_START_X, INV_INTERFACE_START_Y, VO_BLT_SRCTRANSPARENCY, NULL ); - BltVideoObjectFromIndex( guiSAVEBUFFER, guiSMPanel, 0, INTERFACE_START_X, INV_INTERFACE_START_Y, VO_BLT_SRCTRANSPARENCY, NULL ); - - RenderInvBodyPanel( gpSMCurrentMerc, SM_BODYINV_X, SM_BODYINV_Y ); + RenderInvBodyPanel( gpSMCurrentMerc, SM_BODYINV_X, SM_BODYINV_Y ); // CHECK FOR PANEL STUFF / DEATHS / CLOSURES CheckForFacePanelStartAnims( gpSMCurrentMerc, SM_SELMERC_FACE_X, SM_SELMERC_FACE_Y ); @@ -1906,7 +2486,7 @@ void RenderSMPanel( BOOLEAN *pfDirty ) } else { - if ( gusSelectedSoldier == gpSMCurrentMerc->ubID && gTacticalStatus.ubCurrentTeam == OUR_TEAM && OK_INTERRUPT_MERC( gpSMCurrentMerc ) ) + if ( gusSelectedSoldier == gpSMCurrentMerc->ubID && gTacticalStatus.ubCurrentTeam == OUR_TEAM && OK_INTERRUPT_MERC( gpSMCurrentMerc ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiSMObjects, 0, SM_SELMERC_PLATE_X, SM_SELMERC_PLATE_Y, VO_BLT_SRCTRANSPARENCY, NULL ); RestoreExternBackgroundRect( SM_SELMERC_PLATE_X, SM_SELMERC_PLATE_Y, SM_SELMERC_PLATE_WIDTH , SM_SELMERC_PLATE_HEIGHT ); @@ -1936,7 +2516,7 @@ void RenderSMPanel( BOOLEAN *pfDirty ) SetFontForeground( STATS_TITLE_FONT_COLOR ); for( cnt = 0; cnt < 5; cnt++ ) { - mprintf( INTERFACE_START_X + 92, ( INT16 )( INV_INTERFACE_START_Y + 7 + cnt * 10 ), pShortAttributeStrings[ cnt ] ); + mprintf( INTERFACE_START_X + 92, ( INT16 )( INV_INTERFACE_START_Y + 7 + cnt * 10 ), pShortAttributeStrings[ cnt ] ); mprintf( INTERFACE_START_X + 137, ( INT16 )( INV_INTERFACE_START_Y + 7 + cnt * 10 ), pShortAttributeStrings[ cnt + 5 ] ); } @@ -1945,71 +2525,71 @@ void RenderSMPanel( BOOLEAN *pfDirty ) mprintf( SM_WEIGHT_LABEL_X - StringPixLength( pInvPanelTitleStrings[1], BLOCKFONT2 ), SM_WEIGHT_LABEL_Y, pInvPanelTitleStrings[ 1 ] ); mprintf( SM_WEIGHT_PERCENT_X, SM_WEIGHT_PERCENT_Y, L"%%" ); - + mprintf( SM_CAMMO_LABEL_X - StringPixLength( pInvPanelTitleStrings[2], BLOCKFONT2 ), SM_CAMMO_LABEL_Y, pInvPanelTitleStrings[ 2 ] ); mprintf( SM_CAMMO_PERCENT_X, SM_CAMMO_PERCENT_Y, L"%%" ); - UpdateStatColor( gpSMCurrentMerc-> uiChangeAgilityTime, ( BOOLEAN ) ( gpSMCurrentMerc->usValueGoneUp & AGIL_INCREASE? TRUE: FALSE ) ); + UpdateStatColor( gpSMCurrentMerc->timeChanges.uiChangeAgilityTime, ( BOOLEAN ) ( gpSMCurrentMerc->usValueGoneUp & AGIL_INCREASE? TRUE: FALSE ) ); - swprintf( sString, L"%2d", gpSMCurrentMerc->bAgility ); + swprintf( sString, L"%2d", gpSMCurrentMerc->stats.bAgility ); FindFontRightCoordinates(SM_AGI_X, SM_AGI_Y ,SM_STATS_WIDTH ,SM_STATS_HEIGHT ,sString, BLOCKFONT2, &usX, &usY); - mprintf( usX, usY , sString ); + mprintf( usX, usY , sString ); - UpdateStatColor( gpSMCurrentMerc-> uiChangeDexterityTime,( BOOLEAN ) ( gpSMCurrentMerc->usValueGoneUp & DEX_INCREASE? TRUE: FALSE ) ); + UpdateStatColor( gpSMCurrentMerc->timeChanges.uiChangeDexterityTime,( BOOLEAN ) ( gpSMCurrentMerc->usValueGoneUp & DEX_INCREASE? TRUE: FALSE ) ); - swprintf( sString, L"%2d", gpSMCurrentMerc->bDexterity ); + swprintf( sString, L"%2d", gpSMCurrentMerc->stats.bDexterity ); FindFontRightCoordinates(SM_DEX_X, SM_DEX_Y ,SM_STATS_WIDTH ,SM_STATS_HEIGHT ,sString, BLOCKFONT2, &usX, &usY); - mprintf( usX, usY , sString ); + mprintf( usX, usY , sString ); - UpdateStatColor( gpSMCurrentMerc-> uiChangeStrengthTime, ( BOOLEAN )( gpSMCurrentMerc->usValueGoneUp & STRENGTH_INCREASE?TRUE: FALSE ) ); + UpdateStatColor( gpSMCurrentMerc->timeChanges.uiChangeStrengthTime, ( BOOLEAN )( gpSMCurrentMerc->usValueGoneUp & STRENGTH_INCREASE?TRUE: FALSE ) ); - swprintf( sString, L"%2d", gpSMCurrentMerc->bStrength ); + swprintf( sString, L"%2d", gpSMCurrentMerc->stats.bStrength ); FindFontRightCoordinates(SM_STR_X, SM_STR_Y ,SM_STATS_WIDTH ,SM_STATS_HEIGHT ,sString, BLOCKFONT2, &usX, &usY); - mprintf( usX, usY , sString ); + mprintf( usX, usY , sString ); - UpdateStatColor( gpSMCurrentMerc-> uiChangeLeadershipTime, ( BOOLEAN )( gpSMCurrentMerc->usValueGoneUp & LDR_INCREASE? TRUE: FALSE ) ); + UpdateStatColor( gpSMCurrentMerc->timeChanges.uiChangeLeadershipTime, ( BOOLEAN )( gpSMCurrentMerc->usValueGoneUp & LDR_INCREASE? TRUE: FALSE ) ); - swprintf( sString, L"%2d", gpSMCurrentMerc->bLeadership ); + swprintf( sString, L"%2d", gpSMCurrentMerc->stats.bLeadership ); FindFontRightCoordinates(SM_CHAR_X, SM_CHAR_Y ,SM_STATS_WIDTH ,SM_STATS_HEIGHT ,sString, BLOCKFONT2, &usX, &usY); - mprintf( usX, usY , sString ); + mprintf( usX, usY , sString ); - UpdateStatColor( gpSMCurrentMerc-> uiChangeWisdomTime,( BOOLEAN ) ( gpSMCurrentMerc->usValueGoneUp & WIS_INCREASE? TRUE: FALSE ) ); + UpdateStatColor( gpSMCurrentMerc->timeChanges.uiChangeWisdomTime,( BOOLEAN ) ( gpSMCurrentMerc->usValueGoneUp & WIS_INCREASE? TRUE: FALSE ) ); - swprintf( sString, L"%2d", gpSMCurrentMerc->bWisdom ); + swprintf( sString, L"%2d", gpSMCurrentMerc->stats.bWisdom ); FindFontRightCoordinates(SM_WIS_X, SM_WIS_Y ,SM_STATS_WIDTH ,SM_STATS_HEIGHT ,sString, BLOCKFONT2, &usX, &usY); - mprintf( usX, usY , sString ); + mprintf( usX, usY , sString ); - UpdateStatColor( gpSMCurrentMerc-> uiChangeLevelTime, ( BOOLEAN ) ( gpSMCurrentMerc->usValueGoneUp & LVL_INCREASE? TRUE: FALSE ) ); + UpdateStatColor( gpSMCurrentMerc->timeChanges.uiChangeLevelTime, ( BOOLEAN ) ( gpSMCurrentMerc->usValueGoneUp & LVL_INCREASE? TRUE: FALSE ) ); - swprintf( sString, L"%2d", gpSMCurrentMerc->bExpLevel ); + swprintf( sString, L"%2d", gpSMCurrentMerc->stats.bExpLevel ); FindFontRightCoordinates(SM_EXPLVL_X, SM_EXPLVL_Y ,SM_STATS_WIDTH ,SM_STATS_HEIGHT ,sString, BLOCKFONT2, &usX, &usY); - mprintf( usX, usY , sString ); + mprintf( usX, usY , sString ); - UpdateStatColor( gpSMCurrentMerc-> uiChangeMarksmanshipTime, ( BOOLEAN ) ( gpSMCurrentMerc->usValueGoneUp & MRK_INCREASE? TRUE: FALSE ) ); + UpdateStatColor( gpSMCurrentMerc->timeChanges.uiChangeMarksmanshipTime, ( BOOLEAN ) ( gpSMCurrentMerc->usValueGoneUp & MRK_INCREASE? TRUE: FALSE ) ); - swprintf( sString, L"%2d", gpSMCurrentMerc->bMarksmanship ); + swprintf( sString, L"%2d", gpSMCurrentMerc->stats.bMarksmanship ); FindFontRightCoordinates(SM_MRKM_X, SM_MRKM_Y ,SM_STATS_WIDTH ,SM_STATS_HEIGHT ,sString, BLOCKFONT2, &usX, &usY); - mprintf( usX, usY , sString ); + mprintf( usX, usY , sString ); - UpdateStatColor( gpSMCurrentMerc-> uiChangeExplosivesTime, ( BOOLEAN ) ( gpSMCurrentMerc->usValueGoneUp & EXP_INCREASE? TRUE: FALSE ) ); + UpdateStatColor( gpSMCurrentMerc->timeChanges.uiChangeExplosivesTime, ( BOOLEAN ) ( gpSMCurrentMerc->usValueGoneUp & EXP_INCREASE? TRUE: FALSE ) ); - swprintf( sString, L"%2d", gpSMCurrentMerc->bExplosive ); + swprintf( sString, L"%2d", gpSMCurrentMerc->stats.bExplosive ); FindFontRightCoordinates(SM_EXPL_X, SM_EXPL_Y ,SM_STATS_WIDTH ,SM_STATS_HEIGHT ,sString, BLOCKFONT2, &usX, &usY); - mprintf( usX, usY , sString ); + mprintf( usX, usY , sString ); - UpdateStatColor( gpSMCurrentMerc-> uiChangeMechanicalTime, ( BOOLEAN ) ( gpSMCurrentMerc->usValueGoneUp & MECH_INCREASE ? TRUE: FALSE ) ); + UpdateStatColor( gpSMCurrentMerc->timeChanges.uiChangeMechanicalTime, ( BOOLEAN ) ( gpSMCurrentMerc->usValueGoneUp & MECH_INCREASE ? TRUE: FALSE ) ); - swprintf( sString, L"%2d", gpSMCurrentMerc->bMechanical ); + swprintf( sString, L"%2d", gpSMCurrentMerc->stats.bMechanical ); FindFontRightCoordinates(SM_MECH_X, SM_MECH_Y ,SM_STATS_WIDTH ,SM_STATS_HEIGHT ,sString, BLOCKFONT2, &usX, &usY); - mprintf( usX, usY , sString ); + mprintf( usX, usY , sString ); - UpdateStatColor( gpSMCurrentMerc-> uiChangeMedicalTime, ( BOOLEAN ) ( gpSMCurrentMerc->usValueGoneUp & MED_INCREASE? TRUE: FALSE ) ); + UpdateStatColor( gpSMCurrentMerc->timeChanges.uiChangeMedicalTime, ( BOOLEAN ) ( gpSMCurrentMerc->usValueGoneUp & MED_INCREASE? TRUE: FALSE ) ); - swprintf( sString, L"%2d", gpSMCurrentMerc->bMedical ); + swprintf( sString, L"%2d", gpSMCurrentMerc->stats.bMedical ); FindFontRightCoordinates(SM_MED_X, SM_MED_Y ,SM_STATS_WIDTH ,SM_STATS_HEIGHT ,sString, BLOCKFONT2, &usX, &usY); - mprintf( usX, usY , sString ); + mprintf( usX, usY , sString ); - if ( gpSMCurrentMerc->bLife >= OKLIFE ) + if ( gpSMCurrentMerc->stats.bLife >= OKLIFE ) { SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( STATS_TEXT_FONT_COLOR ); @@ -2023,19 +2603,19 @@ void RenderSMPanel( BOOLEAN *pfDirty ) // Display armour value! swprintf( sString, L"%3d", ArmourPercent( gpSMCurrentMerc ) ); FindFontRightCoordinates(SM_ARMOR_X, SM_ARMOR_Y ,SM_PERCENT_WIDTH ,SM_PERCENT_HEIGHT ,sString, BLOCKFONT2, &usX, &usY); - mprintf( usX, usY , sString ); + mprintf( usX, usY , sString ); // Display wieght value! swprintf( sString, L"%3d", CalculateCarriedWeight( gpSMCurrentMerc ) ); FindFontRightCoordinates(SM_WEIGHT_X, SM_WEIGHT_Y ,SM_PERCENT_WIDTH ,SM_PERCENT_HEIGHT ,sString, BLOCKFONT2, &usX, &usY); - mprintf( usX, usY , sString ); + mprintf( usX, usY , sString ); ApplyEquipmentBonuses(gpSMCurrentMerc); // Display cammo value! swprintf( sString, L"%3d", max(0, min( (gpSMCurrentMerc->bCamo + gpSMCurrentMerc->wornCamo+gpSMCurrentMerc->urbanCamo+gpSMCurrentMerc->wornUrbanCamo+gpSMCurrentMerc->desertCamo+gpSMCurrentMerc->wornDesertCamo+gpSMCurrentMerc->snowCamo+gpSMCurrentMerc->wornSnowCamo),100 )) ); FindFontRightCoordinates(SM_CAMMO_X, SM_CAMMO_Y ,SM_PERCENT_WIDTH ,SM_PERCENT_HEIGHT ,sString, BLOCKFONT2, &usX, &usY); - mprintf( usX, usY , sString ); + mprintf( usX, usY , sString ); // reset to frame buffer! @@ -2054,7 +2634,7 @@ void RenderSMPanel( BOOLEAN *pfDirty ) if ( gpSMCurrentMerc->bStealthMode ) { SetFontBackground( FONT_MCOLOR_BLACK ); - SetFontForeground( FONT_MCOLOR_LTYELLOW ); + SetFontForeground( FONT_MCOLOR_LTYELLOW ); } else { @@ -2071,24 +2651,24 @@ void RenderSMPanel( BOOLEAN *pfDirty ) if ( *pfDirty != DIRTYLEVEL0 ) { // UPdate stats! - if ( gpSMCurrentMerc->bLife != 0 ) + if ( gpSMCurrentMerc->stats.bLife != 0 ) { - if ( gpSMCurrentMerc->uiStatusFlags & SOLDIER_VEHICLE ) - { - swprintf( pStr, TacticalStr[ VEHICLE_VITAL_STATS_POPUPTEXT ], gpSMCurrentMerc->bLife, gpSMCurrentMerc->bLifeMax, gpSMCurrentMerc->bBreath, gpSMCurrentMerc->bBreathMax ); - SetRegionFastHelpText( &(gSM_SELMERCBarsRegion), pStr ); - } - else if ( gpSMCurrentMerc->uiStatusFlags & SOLDIER_ROBOT ) - { - swprintf( pStr, gzLateLocalizedString[ 16 ], gpSMCurrentMerc->bLife, gpSMCurrentMerc->bLifeMax ); - SetRegionFastHelpText( &(gTEAM_BarsRegions[ cnt ]), pStr ); - } - else - { - GetMoraleString( gpSMCurrentMerc, pMoraleStr ); - swprintf( pStr, TacticalStr[ MERC_VITAL_STATS_POPUPTEXT ], gpSMCurrentMerc->bLife, gpSMCurrentMerc->bLifeMax, gpSMCurrentMerc->bBreath, gpSMCurrentMerc->bBreathMax, pMoraleStr ); - SetRegionFastHelpText( &(gSM_SELMERCBarsRegion), pStr ); - } + if ( gpSMCurrentMerc->flags.uiStatusFlags & SOLDIER_VEHICLE ) + { + swprintf( pStr, TacticalStr[ VEHICLE_VITAL_STATS_POPUPTEXT ], gpSMCurrentMerc->stats.bLife, gpSMCurrentMerc->stats.bLifeMax, gpSMCurrentMerc->bBreath, gpSMCurrentMerc->bBreathMax ); + SetRegionFastHelpText( &(gSM_SELMERCBarsRegion), pStr ); + } + else if ( gpSMCurrentMerc->flags.uiStatusFlags & SOLDIER_ROBOT ) + { + swprintf( pStr, gzLateLocalizedString[ 16 ], gpSMCurrentMerc->stats.bLife, gpSMCurrentMerc->stats.bLifeMax ); + SetRegionFastHelpText( &(gTEAM_BarsRegions[ cnt ]), pStr ); + } + else + { + GetMoraleString( gpSMCurrentMerc, pMoraleStr ); + swprintf( pStr, TacticalStr[ MERC_VITAL_STATS_POPUPTEXT ], gpSMCurrentMerc->stats.bLife, gpSMCurrentMerc->stats.bLifeMax, gpSMCurrentMerc->bBreath, gpSMCurrentMerc->bBreathMax, pMoraleStr ); + SetRegionFastHelpText( &(gSM_SELMERCBarsRegion), pStr ); + } } else { @@ -2100,13 +2680,13 @@ void RenderSMPanel( BOOLEAN *pfDirty ) SetRegionHelpEndCallback( &gSM_SELMERCBarsRegion, SkiHelpTextDoneCallBack ); // display AP - if ( !( gpSMCurrentMerc->uiStatusFlags & SOLDIER_DEAD ) ) + if ( !( gpSMCurrentMerc->flags.uiStatusFlags & SOLDIER_DEAD ) ) { - if ( gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT ) && gpSMCurrentMerc->bLife >= OKLIFE ) + if ( gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT ) && gpSMCurrentMerc->stats.bLife >= OKLIFE ) { SetFont( TINYFONT1 ); - //if ( gpSMCurrentMerc->sLastTarget != NOWHERE && !EnoughPoints( gpSMCurrentMerc, MinAPsToAttack( gpSMCurrentMerc, gpSMCurrentMerc->sLastTarget, FALSE ), 0, FALSE ) || GetUIApsToDisplay( gpSMCurrentMerc ) < 0 ) - if ( !EnoughPoints( gpSMCurrentMerc, MinAPsToAttack( gpSMCurrentMerc, gpSMCurrentMerc->sLastTarget, FALSE ), 0, FALSE ) || GetUIApsToDisplay( gpSMCurrentMerc ) < 0 ) + //if ( gpSMCurrentMerc->sLastTarget != NOWHERE && !EnoughPoints( gpSMCurrentMerc, MinAPsToAttack( gpSMCurrentMerc, gpSMCurrentMerc->sLastTarget, FALSE ), 0, FALSE ) || GetUIApsToDisplay( gpSMCurrentMerc ) < 0 ) + if ( !EnoughPoints( gpSMCurrentMerc, MinAPsToAttack( gpSMCurrentMerc, gpSMCurrentMerc->sLastTarget, FALSE ), 0, FALSE ) || GetUIApsToDisplay( gpSMCurrentMerc ) < 0 ) { SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( FONT_MCOLOR_DKRED ); @@ -2121,7 +2701,7 @@ void RenderSMPanel( BOOLEAN *pfDirty ) else if ( gpSMCurrentMerc->bStealthMode ) { SetFontBackground( FONT_MCOLOR_BLACK ); - SetFontForeground( FONT_MCOLOR_LTYELLOW ); + SetFontForeground( FONT_MCOLOR_LTYELLOW ); } else { @@ -2138,24 +2718,25 @@ void RenderSMPanel( BOOLEAN *pfDirty ) // Display bars DrawLifeUIBarEx( gpSMCurrentMerc, SM_SELMERC_HEALTH_X, SM_SELMERC_HEALTH_Y, SM_SELMERC_HEALTH_WIDTH, SM_SELMERC_HEALTH_HEIGHT, TRUE , FRAME_BUFFER ); - if ( !(gpSMCurrentMerc->uiStatusFlags & SOLDIER_ROBOT ) ) - { - DrawBreathUIBarEx( gpSMCurrentMerc, SM_SELMERC_BREATH_X, SM_SELMERC_BREATH_Y, SM_SELMERC_HEALTH_WIDTH, SM_SELMERC_HEALTH_HEIGHT, TRUE, FRAME_BUFFER ); - DrawMoraleUIBarEx( gpSMCurrentMerc, SM_SELMERC_MORALE_X, SM_SELMERC_MORALE_Y, SM_SELMERC_MORALE_WIDTH, SM_SELMERC_MORALE_HEIGHT, TRUE, FRAME_BUFFER ); - } + if ( !(gpSMCurrentMerc->flags.uiStatusFlags & SOLDIER_ROBOT ) ) + { + DrawBreathUIBarEx( gpSMCurrentMerc, SM_SELMERC_BREATH_X, SM_SELMERC_BREATH_Y, SM_SELMERC_HEALTH_WIDTH, SM_SELMERC_HEALTH_HEIGHT, TRUE, FRAME_BUFFER ); + DrawMoraleUIBarEx( gpSMCurrentMerc, SM_SELMERC_MORALE_X, SM_SELMERC_MORALE_Y, SM_SELMERC_MORALE_WIDTH, SM_SELMERC_MORALE_HEIGHT, TRUE, FRAME_BUFFER ); + } } } -/* I added this - * any questions? joker +/* I added this + * any questions? joker */ if( fRenderRadarScreen == TRUE ) { // Render clock RenderClock( INTERFACE_CLOCK_X, INTERFACE_CLOCK_Y ); CreateMouseRegionForPauseOfClock( INTERFACE_CLOCK_X, INTERFACE_CLOCK_Y ); - RenderTownIDString( ); + // CHRISL: Change function call to include X,Y coordinates. + RenderTownIDString( LOCATION_NAME_X, LOCATION_NAME_Y ); } else { @@ -2164,7 +2745,7 @@ void RenderSMPanel( BOOLEAN *pfDirty ) UpdateSMPanel( ); - + //HandlePanelFaceAnimations( gpSMCurrentMerc ); HandleSoldierFaceFlash( gpSMCurrentMerc, SM_SELMERC_FACE_X, SM_SELMERC_FACE_Y ); @@ -2174,12 +2755,15 @@ void RenderSMPanel( BOOLEAN *pfDirty ) if ( gfSMDisableForItems && (*pfDirty) != DIRTYLEVEL0 ) { - UINT8 *pDestBuf; + UINT8 *pDestBuf; UINT32 uiDestPitchBYTES; SGPRect ClipRect; - ClipRect.iLeft = 87; - ClipRect.iRight = 536; + // CHRISL: Change hatching area based on inventory system + ClipRect.iLeft = ((UsingNewInventorySystem() == true)) ? 0 : 87; + ClipRect.iRight = ((UsingNewInventorySystem() == true)) ? SCREEN_WIDTH : 536; + //ClipRect.iLeft = 87; + //ClipRect.iRight = 536; ClipRect.iTop = INV_INTERFACE_START_Y; ClipRect.iBottom = SCREEN_HEIGHT; pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); @@ -2191,9 +2775,9 @@ void RenderSMPanel( BOOLEAN *pfDirty ) void UpdateStatColor( UINT32 uiTimer, BOOLEAN fIncrease ) { - if ( gpSMCurrentMerc->bLife >= OKLIFE ) + if ( gpSMCurrentMerc->stats.bLife >= OKLIFE ) { - if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + uiTimer) && ( uiTimer != 0 ) ) + if( ( GetJA2Clock() < CHANGE_STAT_RECENTLY_DURATION + uiTimer) && ( uiTimer != 0 ) ) { if( fIncrease ) { @@ -2230,7 +2814,7 @@ void SMInvMoveCallback( MOUSE_REGION * pRegion, INT32 iReason ) return; } - if ( gpSMCurrentMerc->inv[ uiHandPos ].usItem == NOTHING ) + if ( gpSMCurrentMerc->inv[ uiHandPos ].exists() == false ) return; if (iReason == MSYS_CALLBACK_REASON_MOVE) @@ -2255,7 +2839,7 @@ void SMInvMoveCallback( MOUSE_REGION * pRegion, INT32 iReason ) gfCheckForMouseOverItem = FALSE; fInterfacePanelDirty = DIRTYLEVEL2; } - } + } } void InvPanelButtonClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) @@ -2293,15 +2877,15 @@ void SMInvMoveCammoCallback( MOUSE_REGION * pRegion, INT32 iReason ) //gfSM_HandInvDispText[ uiHandPos ] = 1; HandleCompatibleAmmoUI( gpSMCurrentMerc, (INT8)NO_SLOT, FALSE ); gfCheckForMouseOverItem = FALSE; - } + } } void SMInvClickCamoCallback( MOUSE_REGION * pRegion, INT32 iReason ) { //UINT16 usNewItemIndex; - UINT8 ubSrcID, ubDestID; - BOOLEAN fGoodAPs; + UINT8 ubSrcID, ubDestID; + BOOLEAN fGoodAPs; if (iReason & MSYS_CALLBACK_REASON_INIT) { @@ -2316,13 +2900,13 @@ void SMInvClickCamoCallback( MOUSE_REGION * pRegion, INT32 iReason ) if ( gpItemPointer != NULL ) { // ATE: OK, get source, dest guy if different... check for and then charge appropriate APs - ubSrcID = gpSMCurrentMerc->ubID; + ubSrcID = gpSMCurrentMerc->ubID; ubDestID = gpItemPointerSoldier->ubID; //if ( ubSrcID == ubDestID ) { // We are doing this ourselve, continue - if ( gpSMCurrentMerc->bLife >= CONSCIOUSNESS ) + if ( gpSMCurrentMerc->stats.bLife >= CONSCIOUSNESS ) { //usNewItemIndex = gpItemPointer->usItem; @@ -2331,60 +2915,60 @@ void SMInvClickCamoCallback( MOUSE_REGION * pRegion, INT32 iReason ) { if ( fGoodAPs ) { - // Dirty - fInterfacePanelDirty = DIRTYLEVEL2; - - // Check if it's the same now! - if ( gpItemPointer->ubNumberOfObjects == 0 ) - { - gbCompatibleApplyItem = FALSE; - EndItemPointer( ); - } - - // Say OK acknowledge.... - DoMercBattleSound( gpSMCurrentMerc, BATTLE_SOUND_COOL1 ); - } - } - else if ( ApplyCanteen( gpSMCurrentMerc, gpItemPointer, &fGoodAPs ) ) - { - // Dirty - if ( fGoodAPs ) - { - fInterfacePanelDirty = DIRTYLEVEL2; - - // Check if it's the same now! - if ( gpItemPointer->ubNumberOfObjects == 0 ) - { - gbCompatibleApplyItem = FALSE; - EndItemPointer( ); - } - } - } - else if ( ApplyElixir( gpSMCurrentMerc, gpItemPointer, &fGoodAPs ) ) - { - if ( fGoodAPs ) - { - // Dirty - fInterfacePanelDirty = DIRTYLEVEL2; - - // Check if it's the same now! - if ( gpItemPointer->ubNumberOfObjects == 0 ) - { - gbCompatibleApplyItem = FALSE; - EndItemPointer( ); - } - - // Say OK acknowledge.... - DoMercBattleSound( gpSMCurrentMerc, BATTLE_SOUND_COOL1 ); - } - } - else if ( ApplyDrugs( gpSMCurrentMerc, gpItemPointer ) ) - { - // Dirty + // Dirty fInterfacePanelDirty = DIRTYLEVEL2; // Check if it's the same now! - if ( gpItemPointer->ubNumberOfObjects == 0 ) + if ( gpItemPointer->exists() == false ) + { + gbCompatibleApplyItem = FALSE; + EndItemPointer( ); + } + + // Say OK acknowledge.... + gpSMCurrentMerc->DoMercBattleSound( BATTLE_SOUND_COOL1 ); + } + } + else if ( ApplyCanteen( gpSMCurrentMerc, gpItemPointer, &fGoodAPs ) ) + { + // Dirty + if ( fGoodAPs ) + { + fInterfacePanelDirty = DIRTYLEVEL2; + + // Check if it's the same now! + if ( gpItemPointer->exists() == false ) + { + gbCompatibleApplyItem = FALSE; + EndItemPointer( ); + } + } + } + else if ( ApplyElixir( gpSMCurrentMerc, gpItemPointer, &fGoodAPs ) ) + { + if ( fGoodAPs ) + { + // Dirty + fInterfacePanelDirty = DIRTYLEVEL2; + + // Check if it's the same now! + if ( gpItemPointer->exists() == false ) + { + gbCompatibleApplyItem = FALSE; + EndItemPointer( ); + } + + // Say OK acknowledge.... + gpSMCurrentMerc->DoMercBattleSound( BATTLE_SOUND_COOL1 ); + } + } + else if ( ApplyDrugs( gpSMCurrentMerc, gpItemPointer ) ) + { + // Dirty + fInterfacePanelDirty = DIRTYLEVEL2; + + // Check if it's the same now! + if ( gpItemPointer->exists() == false ) { gbCompatibleApplyItem = FALSE; EndItemPointer( ); @@ -2402,7 +2986,7 @@ void SMInvClickCamoCallback( MOUSE_REGION * pRegion, INT32 iReason ) // Say OK acknowledge.... - DoMercBattleSound( gpSMCurrentMerc, BATTLE_SOUND_COOL1 ); + gpSMCurrentMerc->DoMercBattleSound( BATTLE_SOUND_COOL1 ); } else @@ -2411,7 +2995,7 @@ void SMInvClickCamoCallback( MOUSE_REGION * pRegion, INT32 iReason ) ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ CANNOT_DO_INV_STUFF_STR ] ); } } - } + } } } else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_DWN) @@ -2440,15 +3024,15 @@ BOOLEAN HandleNailsVestFetish( SOLDIERTYPE *pSoldier, UINT32 uiHandPos, UINT16 u { // Do we have nothing or the leather vest or kevlar leather vest? if ( Item[usReplaceItem].leatherjacket || - usReplaceItem == COMPOUND18 || - usReplaceItem == JAR_QUEEN_CREATURE_BLOOD ) + usReplaceItem == COMPOUND18 || + usReplaceItem == JAR_QUEEN_CREATURE_BLOOD ) { // This is good.... fRefuse = FALSE; } else { - fRefuse = TRUE; + fRefuse = TRUE; } } @@ -2469,43 +3053,43 @@ BOOLEAN UIHandleItemPlacement( UINT8 ubHandPos, UINT16 usOldItemIndex, UINT16 us if ( _KeyDown(CTRL) ) { CleanUpStack( &( gpSMCurrentMerc->inv[ ubHandPos ] ), gpItemPointer ); - if ( gpItemPointer->ubNumberOfObjects == 0 ) + if ( gpItemPointer->exists() == false ) { EndItemPointer( ); } return( TRUE ); } - // Try to place here + // Try to place here if ( PlaceObject( gpSMCurrentMerc, ubHandPos, gpItemPointer ) ) { if ( fDeductPoints ) { // Deduct points - if ( gpItemPointerSoldier->bLife >= CONSCIOUSNESS ) + if ( gpItemPointerSoldier->stats.bLife >= CONSCIOUSNESS ) { - DeductPoints( gpItemPointerSoldier, 2, 0 ); + DeductPoints( gpItemPointerSoldier, 2, 0 ); } - if ( gpSMCurrentMerc->bLife >= CONSCIOUSNESS ) + if ( gpSMCurrentMerc->stats.bLife >= CONSCIOUSNESS ) { - DeductPoints( gpSMCurrentMerc, 2, 0 ); + DeductPoints( gpSMCurrentMerc, 2, 0 ); } } HandleTacticalEffectsOfEquipmentChange( gpSMCurrentMerc, ubHandPos, usOldItemIndex, usNewItemIndex ); - // Dirty + // Dirty fInterfacePanelDirty = DIRTYLEVEL2; // Check if cursor is empty now - if ( gpItemPointer->ubNumberOfObjects == 0 ) + if ( gpItemPointer->exists() == false ) { EndItemPointer( ); } if ( gpItemPointerSoldier != gpSMCurrentMerc ) { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_ITEM_PASSED_TO_MERC ], ShortItemNames[ usNewItemIndex ], gpSMCurrentMerc->name ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_ITEM_PASSED_TO_MERC ], ShortItemNames[ usNewItemIndex ], gpSMCurrentMerc->name ); } // UPDATE ITEM POINTER..... @@ -2517,7 +3101,7 @@ BOOLEAN UIHandleItemPlacement( UINT8 ubHandPos, UINT16 usOldItemIndex, UINT16 us } // Set cursor back to normal mode... - guiPendingOverrideEvent = A_CHANGE_TO_MOVE; + guiPendingOverrideEvent = A_CHANGE_TO_MOVE; return( TRUE ); @@ -2526,7 +3110,7 @@ BOOLEAN UIHandleItemPlacement( UINT8 ubHandPos, UINT16 usOldItemIndex, UINT16 us { return( FALSE ); } - + } void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) @@ -2570,6 +3154,10 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) // fLeftDown = TRUE; //} //else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP && fLeftDown ) + // CHRISL: Are we in combat, wearing a backpack with the zipper closed? Don't allow access to backpack items + if((UsingNewInventorySystem() == true)) + if(icLBE[uiHandPos] == BPACKPOCKPOS && (!(gpSMCurrentMerc->flags.ZipperFlag) || (gpSMCurrentMerc->flags.ZipperFlag && gAnimControl[gpSMCurrentMerc->usAnimState].ubEndHeight == ANIM_STAND)) && (gTacticalStatus.uiFlags & INCOMBAT) && (iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN )) + iReason = MSYS_CALLBACK_REASON_NONE; if (iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { fLeftDown = FALSE; @@ -2579,7 +3167,7 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) { // Return if empty - if ( gpSMCurrentMerc->inv[ uiHandPos ].usItem == NOTHING ) + if ( gpSMCurrentMerc->inv[ uiHandPos ].exists() == false ) return; if ( gpSMCurrentMerc->ubID != gusSelectedSoldier ) @@ -2599,8 +3187,31 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) return; } + if((UsingNewInventorySystem() == true)) + { + /*if we pick up a backpack without reactivating the drop pack button, and we have a + dropkey, reactivate the button*/ + if(uiHandPos == BPACKPOCKPOS) + { + // Deal with the zipper before we do anything + if(gpSMCurrentMerc->flags.ZipperFlag) + if(!ChangeZipperStatus(gpSMCurrentMerc, FALSE)) + return; + // Do we still have a linked backpack? If so, reset droppackflag + for(unsigned int wi = 0; wi < guiNumWorldItems; wi++) + { + if(gWorldItems[wi].soldierID == gpSMCurrentMerc->ubID && gWorldItems[wi].object.exists() == true) + { + gpSMCurrentMerc->flags.DropPackFlag = TRUE; + break; + } + } + RenderBackpackButtons(0); /* CHRISL: Needed for new inventory backpack buttons */ + } + } + // Turn off new item glow! - gpSMCurrentMerc->bNewItemCount[ uiHandPos ] = 0; + gpSMCurrentMerc->inv.bNewItemCount[ uiHandPos ] = 0; usOldItemIndex = gpSMCurrentMerc->inv[ uiHandPos ].usItem; @@ -2625,21 +3236,21 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) BOOLEAN fDeductPoints = FALSE; // ATE: OK, get source, dest guy if different... check for and then charge appropriate APs - ubSrcID = gpSMCurrentMerc->ubID; + ubSrcID = gpSMCurrentMerc->ubID; ubDestID = gpItemPointerSoldier->ubID; if ( ubSrcID == ubDestID ) { // We are doing this ourselve, continue fOKToGo = TRUE; - } + } else { // These guys are different.... fDeductPoints = TRUE; // First check points for src guy - if ( gpItemPointerSoldier->bLife >= CONSCIOUSNESS ) + if ( gpItemPointerSoldier->stats.bLife >= CONSCIOUSNESS ) { if ( EnoughPoints( gpItemPointerSoldier, 3, 0, TRUE ) ) { @@ -2654,7 +3265,7 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) // Should we go on? if ( fOKToGo ) { - if ( gpSMCurrentMerc->bLife >= CONSCIOUSNESS ) + if ( gpSMCurrentMerc->stats.bLife >= CONSCIOUSNESS ) { if ( EnoughPoints( gpSMCurrentMerc, 3, 0, TRUE ) ) { @@ -2687,7 +3298,7 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) // it's an attempt to attach; bring up the inventory panel if ( !InItemDescriptionBox( ) ) { - InitItemDescriptionBox( gpSMCurrentMerc, (UINT8)uiHandPos, SM_ITEMDESC_START_X, SM_ITEMDESC_START_Y, 0 ); + InitItemDescriptionBox( gpSMCurrentMerc, (UINT8)uiHandPos, ITEMDESC_START_X, ITEMDESC_START_Y, 0 ); } return; } @@ -2701,7 +3312,7 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) if( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) { - //the only way to merge items is to pick them up. In SKI when you pick up an item, the cursor is + //the only way to merge items is to pick them up. In SKI when you pick up an item, the cursor is //locked in a region, free it up. FreeMouseCursor(); @@ -2715,6 +3326,28 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) } + /* CHRISL: For New Inventory system. Are we swapping LBE Items? We'll need to move any + items in the associated IC group pockets into a new LBENODE. We'll have to check + whether we already have an LBENODE for this type of LBE item and, if so, remove + the items from it, place them in the LBE Items current sector, and delete the existing + LBENODE. Then we need to know if the LBE Item in the cursor is an LBENODE + or just a normal OBJECTTYPE. If it's an LBENODE, we need to move it's items into + the appropriate pockets for the soldier and then delete the LBENODE.*/ + if((UsingNewInventorySystem() == true)) + { + //If we put a new pack in the backpack pocket, turn off the droppack button + if(uiHandPos == BPACKPOCKPOS && CanItemFitInPosition(gpSMCurrentMerc, gpItemPointer, uiHandPos, FALSE)) + { + // First, deal with the zipper + if(gpSMCurrentMerc->flags.ZipperFlag) + if(!ChangeZipperStatus(gpSMCurrentMerc, FALSE)) + return; + if(gpSMCurrentMerc->flags.DropPackFlag) + gpSMCurrentMerc->flags.DropPackFlag = FALSE; + RenderBackpackButtons(0); /* CHRISL: Needed for new inventory backpack buttons */ + } + } + // remember the item type currently in the item pointer usItemPrevInItemPointer = gpItemPointer->usItem; @@ -2727,7 +3360,8 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) // try to place the item in the cursor into this inventory slot if ( UIHandleItemPlacement( (UINT8) uiHandPos, usOldItemIndex, usNewItemIndex, fDeductPoints ) ) { - // it worked! if we're in the SKI... + RenderBackpackButtons(0); /* CHRISL: Needed for new inventory backpack buttons */ + // it worked! if we're in the SKI... if( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) { SetNewItem( gpSMCurrentMerc, ( UINT8 ) uiHandPos, fNewItem ); @@ -2736,7 +3370,7 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) if( gpItemPointer == NULL ) { // clean up - memset( &gMoveingItem, 0, sizeof( INVENTORY_IN_SLOT ) ); + gMoveingItem.initialize(); SetSkiCursor( CURSOR_NORMAL ); } else @@ -2762,30 +3396,30 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) } /* - // Try to place here + // Try to place here if ( PlaceObject( gpSMCurrentMerc, (UINT8)uiHandPos, gpItemPointer ) ) { - + if ( fDeductPoints ) { // Deduct points - if ( gpItemPointerSoldier->bLife >= CONSCIOUSNESS ) + if ( gpItemPointerSoldier->stats.bLife >= CONSCIOUSNESS ) { - DeductPoints( gpItemPointerSoldier, 2, 0 ); + DeductPoints( gpItemPointerSoldier, 2, 0 ); } - if ( gpSMCurrentMerc->bLife >= CONSCIOUSNESS ) + if ( gpSMCurrentMerc->stats.bLife >= CONSCIOUSNESS ) { - DeductPoints( gpSMCurrentMerc, 2, 0 ); + DeductPoints( gpSMCurrentMerc, 2, 0 ); } } HandleTacticalEffectsOfEquipmentChange( gpSMCurrentMerc, uiHandPos, usOldItemIndex, usNewItemIndex ); - // Dirty + // Dirty fInterfacePanelDirty = DIRTYLEVEL2; // Check if it's the same now! - if ( gpItemPointer->ubNumberOfObjects == 0 ) + if ( gpItemPointer->exists() == false ) { EndItemPointer( ); } @@ -2809,7 +3443,7 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) fRightDown = FALSE; // Return if empty - if ( gpSMCurrentMerc->inv[ uiHandPos ].usItem == NOTHING ) + if ( gpSMCurrentMerc->inv[ uiHandPos ].exists() == false ) return; // CJC: OK, get source, dest guy if different, don't allow panels to be brought up @@ -2821,17 +3455,27 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) */ // Turn off new item glow! - gpSMCurrentMerc->bNewItemCount[ uiHandPos ] = 0; + gpSMCurrentMerc->inv.bNewItemCount[ uiHandPos ] = 0; // Some global stuff here - for esc, etc // Check for # of slots in item - if( ( gpSMCurrentMerc->inv[ uiHandPos ].ubNumberOfObjects > 1 && ItemSlotLimit( gpSMCurrentMerc->inv[ uiHandPos ].usItem, (UINT8)uiHandPos ) > 0 ) && ( guiCurrentScreen != MAP_SCREEN ) ) + // CHRISL: Use new ItemSlotLimit function if we're using the new inventory system + UINT8 isLimit = ItemSlotLimit( &gpSMCurrentMerc->inv[ uiHandPos ], uiHandPos, gpSMCurrentMerc ); + if( ( gpSMCurrentMerc->inv[ uiHandPos ].ubNumberOfObjects > 1 && isLimit > 0 ) && ( guiCurrentScreen != MAP_SCREEN ) ) { - if ( !InItemStackPopup( ) ) + if ( !InItemStackPopup( ) ) { + //CHRISL: Set popup width based on pocket size + INT16 invWidth; + if(uiHandPos >= (UINT32)BIGPOCKSTART && uiHandPos < (UINT32)BIGPOCKFINAL) + invWidth = 531; + else if(uiHandPos >= (UINT32)MEDPOCKSTART && uiHandPos < (UINT32)MEDPOCKFINAL) + invWidth = 412; + else + invWidth = 314; //InitItemStackPopup( gpSMCurrentMerc, (UINT8)uiHandPos, SM_ITEMDESC_START_X, SM_ITEMDESC_START_Y, SM_ITEMDESC_WIDTH, SM_ITEMDESC_HEIGHT ); - InitItemStackPopup( gpSMCurrentMerc, (UINT8)uiHandPos, 216, INV_INTERFACE_START_Y, 314, ( SCREEN_HEIGHT - INV_INTERFACE_START_Y ) ); + InitItemStackPopup( gpSMCurrentMerc, (UINT8)uiHandPos, 216, INV_INTERFACE_START_Y, invWidth, ( SCREEN_HEIGHT - INV_INTERFACE_START_Y ) ); } } @@ -2839,7 +3483,7 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) { if ( !InItemDescriptionBox( ) ) { - InitItemDescriptionBox( gpSMCurrentMerc, (UINT8)uiHandPos, SM_ITEMDESC_START_X, SM_ITEMDESC_START_Y, 0 ); + InitItemDescriptionBox( gpSMCurrentMerc, (UINT8)uiHandPos, ITEMDESC_START_X, ITEMDESC_START_Y, 0 ); } } } @@ -2850,17 +3494,182 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) } } +// CHRISL: Function to adjust zipper backpack button status +BOOLEAN ChangeZipperStatus(SOLDIERTYPE *pSoldier, BOOLEAN newStatus) +{ + INT16 sAPCost; + INT32 iBPCost = 0; + INT8 bNewStance; + + //Set AP cost based on what we're doing + sAPCost = (newStatus) ? 7 : 6; + //Are we currently in combat? + if(gTacticalStatus.uiFlags & INCOMBAT) + { + // If we have fewer base points then the default cost to unzip a pack, use all remaining points instead + if(pSoldier->bInitialActionPoints < sAPCost) + sAPCost = pSoldier->bInitialActionPoints; + if(EnoughPoints(pSoldier, sAPCost, iBPCost, TRUE)) + DeductPoints(pSoldier, sAPCost, iBPCost); + else + return FALSE; + } + + //Opening a pack? + if(newStatus) + { + // Are we standing? + bNewStance = gAnimControl[ pSoldier->usAnimState ].ubEndHeight; + if(bNewStance == ANIM_STAND) + { + bNewStance = ANIM_CROUCH; + UIHandleSoldierStanceChange( pSoldier->ubID, bNewStance ); + } + pSoldier->flags.ZipperFlag = newStatus; + gfUIStanceDifferent = TRUE; + } + // Closing a pack? + else + { + pSoldier->flags.ZipperFlag = newStatus; + gfUIStanceDifferent = TRUE; + } + fCharacterInfoPanelDirty = TRUE; + fInterfacePanelDirty = DIRTYLEVEL2; + + return TRUE; +} + +// CHRISL: Function to adjust droppack packpack button status +BOOLEAN ChangeDropPackStatus(SOLDIERTYPE *pSoldier, BOOLEAN newStatus) +{ + INT16 sAPCost = 3; + INT32 iBPCost = 0; + INT32 worldKey=1; + + // Are we dropping a pack that has the zipper open? + if(newStatus && pSoldier->flags.ZipperFlag) + { + sAPCost = 0; + if(!ChangeZipperStatus(pSoldier, FALSE)) + return FALSE; + } + + // Are we currently in combat? + if(gTacticalStatus.uiFlags & INCOMBAT) + { + // If we're standing over the backpack that we're trying to pick up, reset the ap cost to 0 + if(!newStatus) { + for(unsigned int wi = 0; wi < guiNumWorldItems; wi++) + { + if(gWorldItems[wi].soldierID == pSoldier->ubID && gWorldItems[wi].object.exists() == true) + { + for (unsigned int x = 0; x < gWorldItems[wi].object.ubNumberOfObjects; ++x) { + // Failsafe in case our LBEArray data ever goes missing. + if(x >= LBEArray.size()){ + break; + } + if(gWorldItems[wi].object.IsActiveLBE(x)) { + if(gWorldItems[wi].object.GetLBEPointer(x)->lbeIndex != NONE) { + if(gWorldItems[wi].sGridNo == pSoldier->sGridNo) + { + sAPCost = 0; + break; + } + // If not, we can't pick up the item + else + { + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_CAN_NOT_PICKUP] ); + return FALSE; + } + } + } + } + break; + } + } + } + // Do we have enough APs to complete this action? + if(EnoughPoints(pSoldier, sAPCost, iBPCost, TRUE)) + DeductPoints(pSoldier, sAPCost, iBPCost); + else + return FALSE; + } + + // Dropping a pack? + if(newStatus) + { + // We need to clear any existing WorldItems that are linked with this soldier + for(unsigned int wi = 0; wi < guiNumWorldItems; wi++) + { + if(gWorldItems[wi].soldierID == pSoldier->ubID) + { + gWorldItems[wi].soldierID = -1; + } + } + MoveItemToLBEItem( pSoldier, BPACKPOCKPOS ); + AddItemToPoolAndGetIndex(pSoldier->sGridNo, &pSoldier->inv[BPACKPOCKPOS], 1, pSoldier->pathing.bLevel, 0 , -1, pSoldier->ubID, &worldKey ); + // Item successfully added to world + if(worldKey != ITEM_NOT_FOUND) + { + NotifySoldiersToLookforItems( ); + DeleteObj(&pSoldier->inv[BPACKPOCKPOS]); + pSoldier->flags.DropPackFlag = newStatus; + gfUIStanceDifferent = TRUE; + } + } + // Picking up a pack? + else + { + for(unsigned int wi = 0; wi < guiNumWorldItems; wi++) + { + if(gWorldItems[wi].soldierID == pSoldier->ubID && gWorldItems[wi].object.exists() == true && LoadBearingEquipment[Item[gWorldItems[wi].object.usItem].ubClassIndex].lbeClass == BACKPACK) + { + for (int x = 0; x < gWorldItems[wi].object.ubNumberOfObjects; ++x) { + // Is the item we dropped in this sector and does it have an active LBENODE flag? + //if(gWorldItems[wi].object.IsActiveLBE(x)) { + // Is the LBENODE we're trying to pick up actually in use? + //if(gWorldItems[wi].object.GetLBEPointer(x)->lbeIndex != NONE) + { + // Try to pickup the LBENODE + if(AutoPlaceObject(pSoldier, &(gWorldItems[wi].object ), TRUE )) + { + RemoveItemFromPool(gWorldItems[wi].sGridNo, wi, gWorldItems[wi].ubLevel); + pSoldier->flags.DropPackFlag = newStatus; + gfUIStanceDifferent = TRUE; + return TRUE; + } + else + { + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_NO_DROP] ); + return TRUE; + } + } + //} + } + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_NO_PACK] ); + break; + } + } + //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_NO_PACK] ); + } + + return TRUE; +} + void MergeMessageBoxCallBack( UINT8 ubExitValue ) { if ( ubExitValue == MSG_BOX_RETURN_YES ) { - AttachObject( gpItemPointerSoldier, &( gpSMCurrentMerc->inv[ gubHandPos ] ), gpItemPointer ); + //ADB see what happens here + DebugBreakpoint(); + gpSMCurrentMerc->inv[ gubHandPos ].AttachObject( gpItemPointerSoldier, gpItemPointer ); // re-evaluate repairs gfReEvaluateEveryonesNothingToDo = TRUE; - if (gpItemPointer->usItem == NOTHING) + if (gpItemPointer->exists() == false) { // merge item consumed EndItemPointer(); @@ -2883,35 +3692,35 @@ void HandleMouseOverSoldierFaceForContMove( SOLDIERTYPE *pSoldier, BOOLEAN fOn ) return; } - if ( fOn && CheckForMercContMove( pSoldier ) ) + if ( fOn ) { // Check if we are waiting to continue move... - //if ( CheckForMercContMove( pSoldier ) ) - //{ - // Display 'cont' on face.... - // Get face - pFace = &gFacesData[ pSoldier->iFaceIndex ]; - - pFace->fDisplayTextOver = FACE_DRAW_TEXT_OVER; - wcscpy( pFace->zDisplayText, TacticalStr[ CONTINUE_OVER_FACE_STR ] ); - - sGridNo = pSoldier->sFinalDestination; - - if ( pSoldier->bGoodContPath ) + if ( CheckForMercContMove( pSoldier ) ) { - sGridNo = pSoldier->sContPathLocation; - } + // Display 'cont' on face.... + // Get face + pFace = &gFacesData[ pSoldier->iFaceIndex ]; - // While our mouse is here, draw a path! - PlotPath( pSoldier, sGridNo, NO_COPYROUTE, PLOT, TEMPORARY, (UINT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ); - //} + pFace->fDisplayTextOver = FACE_DRAW_TEXT_OVER; + wcscpy( pFace->zDisplayText, TacticalStr[ CONTINUE_OVER_FACE_STR ] ); + + sGridNo = pSoldier->pathing.sFinalDestination; + + if ( pSoldier->bGoodContPath ) + { + sGridNo = pSoldier->sContPathLocation; + } + + // While our mouse is here, draw a path! + PlotPath( pSoldier, sGridNo, NO_COPYROUTE, PLOT, TEMPORARY, (UINT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ); + } } else { // Remove 'cont' on face.... // Get face pFace = &gFacesData[ pSoldier->iFaceIndex ]; - + pFace->fDisplayTextOver = FACE_ERASE_TEXT_OVER; // Erase path! @@ -2964,7 +3773,7 @@ void SelectedMercButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ) // ATE: Don't if this guy can't.... if ( !gfSMDisableForItems ) { - if ( gpSMCurrentMerc->uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) + if ( gpSMCurrentMerc->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) { pVehicle = GetSoldierStructureForVehicle( gpSMCurrentMerc->iVehicleId ); @@ -2978,14 +3787,16 @@ void SelectedMercButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ) ContinueMercMovement( gpSMCurrentMerc ); ErasePath( TRUE ); } - else + else { HandleLocateSelectMerc( gpSMCurrentMerc->ubID, 0 ); } } } } - else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_DWN) + //CHRISL: Change this to UP so that we don't inadvertantly switch to action mode when closing Inv panel + //else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_DWN) + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { // ATE: Cannot get out by right clicking... //if ( gpItemPointer == NULL ) @@ -2997,7 +3808,7 @@ void SelectedMercButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ) { DeleteItemDescriptionBox( ); } - + gfSwitchPanel = TRUE; gbNewPanel = TEAM_PANEL; } @@ -3026,12 +3837,12 @@ void SelectedMercEnemyIndicatorCallback( MOUSE_REGION * pRegion, INT32 iReason ) // ATE: Don't if this guy can't.... if ( !gfSMDisableForItems ) { - if ( gpSMCurrentMerc->uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) + if ( gpSMCurrentMerc->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) { } else { - if ( gpSMCurrentMerc->bOppCnt > 0 ) + if ( gpSMCurrentMerc->aiData.bOppCnt > 0 ) { CycleVisibleEnemies( gpSMCurrentMerc ); } @@ -3084,6 +3895,95 @@ void BtnStanceUpCallback(GUI_BUTTON *btn,INT32 reason) } +// CHRISL: Callback functions for backpack buttons +void BtnDropPackCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + //CHRISL: Added "SHIFT-LMB" option to drop packs for all members of current squad + if ( _KeyDown( SHIFT ) ) + { + INT8 bAssignment = gpSMCurrentMerc->bAssignment; + for(int x=0; x<18; x++) + { + /* Is DropPackFlag currently false and is there something in the backpack pocket? If so, we haven't + dropped a pack yet and apparently want to*/ + if(MercPtrs[x]->bAssignment == bAssignment && MercPtrs[x]->inv[BPACKPOCKPOS].exists() == true && !MercPtrs[x]->flags.DropPackFlag) + { + ChangeDropPackStatus(MercPtrs[x], TRUE); + } + /* Is DropPackFlag currently true, is nothing in the backpack pocket and have we dropped a pack? If so, we + must want to retreive a backpack we previously dropped.*/ + else if(MercPtrs[x]->bAssignment == bAssignment && MercPtrs[x]->inv[BPACKPOCKPOS].exists() == false && MercPtrs[x]->flags.DropPackFlag) + { + ChangeDropPackStatus(MercPtrs[x], FALSE); + } + } + } + else + { + /* Is DropPackFlag currently false and is there something in the backpack pocket? If so, we haven't + dropped a pack yet and apparently want to*/ + if(gpSMCurrentMerc->inv[BPACKPOCKPOS].exists() == true && !gpSMCurrentMerc->flags.DropPackFlag) + { + ChangeDropPackStatus(gpSMCurrentMerc, TRUE); + } + /* Is DropPackFlag currently true, is nothing in the backpack pocket and have we dropped a pack? If so, we + must want to retreive a backpack we previously dropped.*/ + else if(gpSMCurrentMerc->inv[BPACKPOCKPOS].exists() == false && gpSMCurrentMerc->flags.DropPackFlag) + { + ChangeDropPackStatus(gpSMCurrentMerc, FALSE); + } + } + } + else if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + } +} + +void BtnZipperCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + //Are we in combat, do we have a backpack on and is the pack closed? Open it + if((gTacticalStatus.uiFlags & INCOMBAT) && gpSMCurrentMerc->inv[BPACKPOCKPOS].exists() == true && !gpSMCurrentMerc->flags.ZipperFlag) + { + ChangeZipperStatus(gpSMCurrentMerc, TRUE); + } + //Is the pack open? + else if(gpSMCurrentMerc->flags.ZipperFlag) + { + ChangeZipperStatus(gpSMCurrentMerc, FALSE); + } + //Are we not in combat? + else if(!(gTacticalStatus.uiFlags & INCOMBAT)) + { + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_ZIPPER_COMBAT] ); + } + } + else if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + } +} + void BtnUpdownCallback(GUI_BUTTON *btn,INT32 reason) { if (!(btn->uiFlags & BUTTON_ENABLED)) @@ -3111,7 +4011,7 @@ void BtnUpdownCallback(GUI_BUTTON *btn,INT32 reason) } } - + void BtnClimbCallback(GUI_BUTTON *btn,INT32 reason) { BOOLEAN fNearHeigherLevel; @@ -3133,16 +4033,16 @@ void BtnClimbCallback(GUI_BUTTON *btn,INT32 reason) if ( fNearLowerLevel ) { - BeginSoldierClimbDownRoof( gpSMCurrentMerc ); + gpSMCurrentMerc->BeginSoldierClimbDownRoof( ); } if ( fNearHeigherLevel ) { - BeginSoldierClimbUpRoof( gpSMCurrentMerc ); + gpSMCurrentMerc->BeginSoldierClimbUpRoof( ); } if ( FindFenceJumpDirection( gpSMCurrentMerc, gpSMCurrentMerc->sGridNo, gpSMCurrentMerc->ubDirection, &bDirection ) ) { - BeginSoldierClimbFence( gpSMCurrentMerc ); + gpSMCurrentMerc->BeginSoldierClimbFence( ); } } @@ -3150,7 +4050,7 @@ void BtnClimbCallback(GUI_BUTTON *btn,INT32 reason) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); } - + } void BtnStanceDownCallback(GUI_BUTTON *btn,INT32 reason) @@ -3186,7 +4086,7 @@ void BtnStanceDownCallback(GUI_BUTTON *btn,INT32 reason) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); } - + } void BtnStealthModeCallback(GUI_BUTTON *btn,INT32 reason) @@ -3246,15 +4146,15 @@ void BtnMuteCallback(GUI_BUTTON *btn,INT32 reason) if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { - if ( gpSMCurrentMerc->uiStatusFlags & SOLDIER_MUTE ) + if ( gpSMCurrentMerc->flags.uiStatusFlags & SOLDIER_MUTE ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ MUTE_OFF_STR ], gpSMCurrentMerc->name ); - gpSMCurrentMerc->uiStatusFlags &= ( ~SOLDIER_MUTE ); + gpSMCurrentMerc->flags.uiStatusFlags &= ( ~SOLDIER_MUTE ); } else { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ MUTE_ON_STR ], gpSMCurrentMerc->name ); - gpSMCurrentMerc->uiStatusFlags |= ( SOLDIER_MUTE ); + gpSMCurrentMerc->flags.uiStatusFlags |= ( SOLDIER_MUTE ); } } @@ -3306,13 +4206,13 @@ void BtnPrevMercCallback(GUI_BUTTON *btn,INT32 reason) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); } - + } void BtnNextMercCallback(GUI_BUTTON *btn,INT32 reason) { INT16 sID; - + if (!(btn->uiFlags & BUTTON_ENABLED)) return; @@ -3355,7 +4255,7 @@ void BtnNextMercCallback(GUI_BUTTON *btn,INT32 reason) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); } - + } @@ -3380,7 +4280,7 @@ void BtnOptionsCallback(GUI_BUTTON *btn,INT32 reason) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); } - + } void BtnSMDoneCallback(GUI_BUTTON *btn,INT32 reason) @@ -3403,7 +4303,7 @@ void BtnSMDoneCallback(GUI_BUTTON *btn,INT32 reason) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); } - + } @@ -3428,7 +4328,7 @@ void BtnMapScreenCallback(GUI_BUTTON *btn,INT32 reason) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); } - + } /* @@ -3461,7 +4361,7 @@ void BtnBurstModeCallback(GUI_BUTTON *btn,INT32 reason) // btn->uiFlags |= BUTTON_DIRTY; } - + } void BtnLookCallback(GUI_BUTTON *btn,INT32 reason) @@ -3476,13 +4376,13 @@ void BtnLookCallback(GUI_BUTTON *btn,INT32 reason) btn->uiFlags &= (~BUTTON_CLICKED_ON ); ToggleLookCursorMode( NULL ); - + } else if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); } - + } void BtnPositionShowCallback(GUI_BUTTON *btn,INT32 reason) @@ -3526,10 +4426,10 @@ BOOLEAN InitializeTEAMPanelCoords( ) TM_BARS_REGION_HEIGHT = 47; TM_BARS_REGION_WIDTH = 26; - INDICATOR_BOX_WIDTH = 12; + INDICATOR_BOX_WIDTH = 12; INDICATOR_BOX_HEIGHT = 10; - sTEAMAPPanelXY[0] = ( 69 + INTERFACE_START_X ); sTEAMAPPanelXY[1] = ( 6 + INTERFACE_START_Y ); + sTEAMAPPanelXY[0] = ( 69 + INTERFACE_START_X ); sTEAMAPPanelXY[1] = ( 6 + INTERFACE_START_Y ); sTEAMAPPanelXY[2] = ( 151 + INTERFACE_START_X ); sTEAMAPPanelXY[3] = ( 6 + INTERFACE_START_Y ); sTEAMAPPanelXY[4] = ( 234 + INTERFACE_START_X ); sTEAMAPPanelXY[5] = ( 6 + INTERFACE_START_Y ); sTEAMAPPanelXY[6] = ( 317 + INTERFACE_START_X ); sTEAMAPPanelXY[7] = ( 6 + INTERFACE_START_Y ); @@ -3583,14 +4483,14 @@ BOOLEAN InitializeTEAMPanelCoords( ) sTEAMApXY[4] = ( 233 + INTERFACE_START_X ); sTEAMApXY[5] = ( 52 + INTERFACE_START_Y ); sTEAMApXY[6] = ( 317 + INTERFACE_START_X ); sTEAMApXY[7] = ( 52 + INTERFACE_START_Y ); sTEAMApXY[8] = ( 400 + INTERFACE_START_X ); sTEAMApXY[9] = ( 52 + INTERFACE_START_Y ); - sTEAMApXY[10] = ( 483 + INTERFACE_START_X );sTEAMApXY[11] = ( 52 + INTERFACE_START_Y ); + sTEAMApXY[10] = ( 483 + INTERFACE_START_X );sTEAMApXY[11] = ( 52 + INTERFACE_START_Y ); sTEAMBarsXY[0] = ( 61 + INTERFACE_START_X ); sTEAMBarsXY[1] = ( 3 + INTERFACE_START_Y ); sTEAMBarsXY[2] = ( 145 + INTERFACE_START_X ); sTEAMBarsXY[3] = ( 3 + INTERFACE_START_Y ); sTEAMBarsXY[4] = ( 228 + INTERFACE_START_X ); sTEAMBarsXY[5] = ( 3 + INTERFACE_START_Y ); sTEAMBarsXY[6] = ( 311 + INTERFACE_START_X ); sTEAMBarsXY[7] = ( 3 + INTERFACE_START_Y ); sTEAMBarsXY[8] = ( 394 + INTERFACE_START_X ); sTEAMBarsXY[9] = ( 3 + INTERFACE_START_Y ); - sTEAMBarsXY[10] = ( 477 + INTERFACE_START_X ); sTEAMBarsXY[11] = ( 3 + INTERFACE_START_Y ); + sTEAMBarsXY[10] = ( 477 + INTERFACE_START_X ); sTEAMBarsXY[11] = ( 3 + INTERFACE_START_Y ); sTEAMHandInvXY[0] = ( TM_INV_HAND1STARTX + ( 0 * TM_INV_HAND_SEP )); sTEAMHandInvXY[1] = TM_INV_HAND1STARTY; sTEAMHandInvXY[2] = ( TM_INV_HAND1STARTX + ( 1 * TM_INV_HAND_SEP )); sTEAMHandInvXY[3] = TM_INV_HAND1STARTY; @@ -3600,22 +4500,30 @@ BOOLEAN InitializeTEAMPanelCoords( ) sTEAMHandInvXY[10] = ( TM_INV_HAND1STARTX + ( 5 * TM_INV_HAND_SEP )); sTEAMHandInvXY[11] = TM_INV_HAND1STARTY; // ufff to much copy&paste :D + // CHRISL: New definitions for the team panel clock and location coordinates + INTERFACE_CLOCK_TM_X = ( SCREEN_WIDTH - 86 ); + INTERFACE_CLOCK_TM_Y = ( 98 + INTERFACE_START_Y ); + LOCATION_NAME_TM_X = ( SCREEN_WIDTH - 92 ); + LOCATION_NAME_TM_Y = ( 65 + INTERFACE_START_Y ); + return ( TRUE ); } // TEAM PANEL!!!!!!!!!!!!!! -BOOLEAN InitializeTEAMPanel( ) +BOOLEAN InitializeTEAMPanel( ) { VSURFACE_DESC vs_desc; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; UINT32 cnt, posIndex; static BOOLEAN fFirstTime = TRUE; + /* CHRISL: Add something here to reset the cursor to a pointer so we don't inadvertantly activate + context sensitive cursor when closing the inventory panel*/ fDisplayOverheadMap = TRUE; -/* OK i need to initialize coords here - * Isnt it cool - * any questions? joker - * i moved it +/* OK i need to initialize coords here + * Isnt it cool + * any questions? joker + * i moved it */ // InitializeTEAMPanelCoords( ); // INit viewport region @@ -3623,7 +4531,7 @@ BOOLEAN InitializeTEAMPanel( ) // Define region for viewport MSYS_DefineRegion( &gViewportRegion, 0, 0 ,gsVIEWPORT_END_X, gsVIEWPORT_WINDOW_END_Y, MSYS_PRIORITY_NORMAL, VIDEO_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); MSYS_AddRegion( &gViewportRegion ); - + // Load interface panels vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; @@ -3662,21 +4570,21 @@ BOOLEAN InitializeTEAMPanel( ) // Set viewports // Define region for panel MSYS_DefineRegion( &gTEAM_PanelRegion, 0, gsVIEWPORT_END_Y ,SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_NORMAL, - CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); // Add region MSYS_AddRegion( &gTEAM_PanelRegion); - for ( posIndex = 0, cnt = 0; cnt < 6; cnt++, posIndex +=2 ) + for ( posIndex = 0, cnt = 0; cnt < NUM_TEAM_SLOTS; cnt++, posIndex +=2 ) { MSYS_DefineRegion( &gTEAM_FaceRegions[ cnt ], sTEAMFacesXY[ posIndex ], sTEAMFacesXY[ posIndex + 1 ] ,(INT16)(sTEAMFacesXY[ posIndex ] + TM_FACE_WIDTH ), (INT16)(sTEAMFacesXY[ posIndex + 1 ] + TM_FACE_HEIGHT), MSYS_PRIORITY_NORMAL, - MSYS_NO_CURSOR, MercFacePanelMoveCallback, MercFacePanelCallback ); + MSYS_NO_CURSOR, MercFacePanelMoveCallback, MercFacePanelCallback ); // Add region MSYS_AddRegion( &gTEAM_FaceRegions[ cnt ] ); MSYS_SetRegionUserData( &gTEAM_FaceRegions[ cnt ], 0, cnt ); MSYS_DefineRegion( &gTEAM_EnemyIndicator[ cnt ], (INT16)(sTEAMFacesXY[ posIndex ] + 1), (INT16)(sTEAMFacesXY[ posIndex + 1 ] + 1 ) ,(INT16)(sTEAMFacesXY[ posIndex ] + INDICATOR_BOX_WIDTH ), (INT16)(sTEAMFacesXY[ posIndex + 1 ] + INDICATOR_BOX_HEIGHT), MSYS_PRIORITY_NORMAL, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, EnemyIndicatorClickCallback ); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, EnemyIndicatorClickCallback ); // Add region MSYS_AddRegion( &gTEAM_EnemyIndicator[ cnt ] ); MSYS_SetRegionUserData( &gTEAM_EnemyIndicator[ cnt ], 0, cnt ); @@ -3693,20 +4601,20 @@ BOOLEAN InitializeTEAMPanel( ) MSYS_DefineRegion( &gTEAM_BarsRegions[ cnt ], sTEAMBarsXY[ posIndex ], sTEAMBarsXY[ posIndex + 1 ] ,(INT16)(sTEAMBarsXY[ posIndex ] + TM_BARS_REGION_WIDTH ), (INT16)(sTEAMBarsXY[ posIndex + 1 ] + TM_BARS_REGION_HEIGHT ), MSYS_PRIORITY_NORMAL, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MercFacePanelCallback ); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MercFacePanelCallback ); // Add region MSYS_AddRegion( &gTEAM_BarsRegions[ cnt ] ); MSYS_SetRegionUserData( &gTEAM_BarsRegions[ cnt ], 0, cnt ); MSYS_DefineRegion( &gTEAM_LeftBarsRegions[ cnt ], (INT16)(sTEAMFacesXY[ posIndex ] - 8 ), sTEAMFacesXY[ posIndex + 1 ] ,(INT16)(sTEAMFacesXY[ posIndex ] ), (INT16)(sTEAMFacesXY[ posIndex + 1 ] + TM_BARS_REGION_HEIGHT ), MSYS_PRIORITY_NORMAL, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MercFacePanelCallback ); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MercFacePanelCallback ); // Add region MSYS_AddRegion( &gTEAM_LeftBarsRegions[ cnt ] ); MSYS_SetRegionUserData( &gTEAM_LeftBarsRegions[ cnt ], 0, cnt ); MSYS_DefineRegion( &gTEAM_FirstHandInv[ cnt ], sTEAMHandInvXY[ posIndex ], sTEAMHandInvXY[ posIndex + 1 ], (INT16)(sTEAMHandInvXY[ posIndex ] + TM_INV_WIDTH ) ,(INT16)(sTEAMHandInvXY[ posIndex + 1 ] + TM_INV_HEIGHT ), MSYS_PRIORITY_NORMAL, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, TMClickFirstHandInvCallback ); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, TMClickFirstHandInvCallback ); // Add region MSYS_AddRegion( &gTEAM_FirstHandInv[ cnt ] ); @@ -3716,19 +4624,19 @@ BOOLEAN InitializeTEAMPanel( ) MSYS_DefineRegion( &gTEAM_SecondHandInv[ cnt ], sTEAMHandInvXY[ posIndex ], (INT16)( sTEAMHandInvXY[ posIndex + 1 ] + 24 ), (INT16)(sTEAMHandInvXY[ posIndex ] + TM_INV_WIDTH) ,(INT16)(sTEAMHandInvXY[ posIndex + 1 ] + TM_INV_HEIGHT + 24 ), MSYS_PRIORITY_NORMAL, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, TMClickSecondHandInvCallback ); + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, TMClickSecondHandInvCallback ); // Add region MSYS_AddRegion( &gTEAM_SecondHandInv[ cnt ] ); // Add user data MSYS_SetRegionUserData( &gTEAM_SecondHandInv[ cnt ], 0, cnt ); - + } //DEfine region for selected guy panel //MSYS_DefineRegion( &gSM_SELMERCPanalRegion, SM_SELMERC_FACE_X, SM_SELMERC_FACE_Y, SM_SELMERC_FACE_X + SM_SELMERC_FACE_WIDTH, SM_SELMERC_FACE_Y + SM_SELMERC_FACE_HEIGHT, MSYS_PRIORITY_NORMAL, - // CURSOR_NORMAL, MSYS_NO_CALLBACK, SelectedMercButtonCallback ); + // CURSOR_NORMAL, MSYS_NO_CALLBACK, SelectedMercButtonCallback ); // Add region //MSYS_AddRegion( &gSM_SELMERCPanalRegion ); @@ -3774,8 +4682,8 @@ BOOLEAN ShutdownTEAMPanel( ) // turn off the display of the squad list if( fRenderRadarScreen == FALSE ) { - // start rendering radar region again, - fRenderRadarScreen = TRUE; + // start rendering radar region again, + fRenderRadarScreen = TRUE; // remove squad panel CreateDestroyMouseRegionsForSquadList( ); @@ -3793,15 +4701,15 @@ void RenderTEAMPanel( BOOLEAN fDirty ) if ( fDirty == DIRTYLEVEL2 ) { - MarkAButtonDirty( iTEAMPanelButtons[ TEAM_DONE_BUTTON ] ); - MarkAButtonDirty( iTEAMPanelButtons[ TEAM_MAP_SCREEN_BUTTON ] ); - MarkAButtonDirty( iTEAMPanelButtons[ CHANGE_SQUAD_BUTTON ] ); + MarkAButtonDirty( iTEAMPanelButtons[ TEAM_DONE_BUTTON ] ); + MarkAButtonDirty( iTEAMPanelButtons[ TEAM_MAP_SCREEN_BUTTON ] ); + MarkAButtonDirty( iTEAMPanelButtons[ CHANGE_SQUAD_BUTTON ] ); // Blit video surface BltVideoObjectFromIndex( guiSAVEBUFFER, guiTEAMPanel, 0, INTERFACE_START_X, INTERFACE_START_Y, VO_BLT_SRCTRANSPARENCY, NULL ); RestoreExternBackgroundRect( INTERFACE_START_X, INTERFACE_START_Y, SCREEN_WIDTH - INTERFACE_START_X , INTERFACE_HEIGHT ); - + // LOOP THROUGH ALL MERCS ON TEAM PANEL for ( cnt = 0, posIndex = 0; cnt < NUM_TEAM_SLOTS; cnt++, posIndex+= 2 ) { @@ -3809,7 +4717,7 @@ void RenderTEAMPanel( BOOLEAN fDirty ) if ( !gTeamPanel[ cnt ].fOccupied ) { //BLIT CLOSE PANEL - BltVideoObjectFromIndex( guiSAVEBUFFER, guiCLOSE, 5, sTEAMFacesXY[ posIndex ], sTEAMFacesXY[ posIndex + 1 ], VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObjectFromIndex( guiSAVEBUFFER, guiCLOSE, 5, sTEAMFacesXY[ posIndex ], sTEAMFacesXY[ posIndex + 1 ], VO_BLT_SRCTRANSPARENCY, NULL ); RestoreExternBackgroundRect( sTEAMFacesXY[ posIndex ], sTEAMFacesXY[ posIndex + 1 ], TM_FACE_WIDTH, TM_FACE_HEIGHT ); // BLIT AP CLOSE PANEL @@ -3821,7 +4729,7 @@ void RenderTEAMPanel( BOOLEAN fDirty ) { // Hatch out... BltVideoObjectFromIndex( guiSAVEBUFFER, guiTEAMObjects, 1, sTEAMFaceHighlXY[ posIndex ], sTEAMFaceHighlXY[ posIndex + 1 ], VO_BLT_SRCTRANSPARENCY, NULL ); - RestoreExternBackgroundRect( sTEAMFaceHighlXY[ posIndex ], sTEAMFaceHighlXY[ posIndex + 1 ], TM_FACEHIGHTL_WIDTH, TM_FACEHIGHTL_HEIGHT ); + RestoreExternBackgroundRect( sTEAMFaceHighlXY[ posIndex ], sTEAMFaceHighlXY[ posIndex + 1 ], TM_FACEHIGHTL_WIDTH, TM_FACEHIGHTL_HEIGHT ); } } @@ -3829,7 +4737,7 @@ void RenderTEAMPanel( BOOLEAN fDirty ) { pSoldier = MercPtrs[ gTeamPanel[ cnt ].ubID ]; - if ( pSoldier->uiStatusFlags & ( SOLDIER_DRIVER ) ) + if ( pSoldier->flags.uiStatusFlags & ( SOLDIER_DRIVER ) ) { // Get soldier pointer for vehicle..... SOLDIERTYPE *pVehicle; @@ -3837,8 +4745,8 @@ void RenderTEAMPanel( BOOLEAN fDirty ) pVehicle = GetSoldierStructureForVehicle( pSoldier->iVehicleId ); //OK, for each item, set dirty text if applicable! - swprintf( pStr, TacticalStr[ DRIVER_POPUPTEXT ], pVehicle->bLife, pVehicle->bLifeMax, pVehicle->bBreath, pVehicle->bBreathMax ); - SetRegionFastHelpText( &(gTEAM_FirstHandInv[ cnt ]), pStr ); + swprintf( pStr, TacticalStr[ DRIVER_POPUPTEXT ], pVehicle->stats.bLife, pVehicle->stats.bLifeMax, pVehicle->bBreath, pVehicle->bBreathMax ); + SetRegionFastHelpText( &(gTEAM_FirstHandInv[ cnt ]), pStr ); } // Add text for first hand popup else @@ -3850,14 +4758,14 @@ void RenderTEAMPanel( BOOLEAN fDirty ) } // Add text for seonc hand popup - if ( pSoldier->uiStatusFlags & ( SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) + if ( pSoldier->flags.uiStatusFlags & ( SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) { //OK, for each item, set dirty text if applicable! - SetRegionFastHelpText( &(gTEAM_SecondHandInv[ cnt ]), TacticalStr[ EXIT_VEHICLE_POPUPTEXT ] ); + SetRegionFastHelpText( &(gTEAM_SecondHandInv[ cnt ]), TacticalStr[ EXIT_VEHICLE_POPUPTEXT ] ); } else { - GetHelpTextForItem( pStr, &( pSoldier->inv[ SECONDHANDPOS ] ), pSoldier ); + GetHelpTextForItem( pStr, &( pSoldier->inv[ SECONDHANDPOS ] ), pSoldier ); //OK, for each item, set dirty text if applicable! SetRegionFastHelpText( &(gTEAM_SecondHandInv[ cnt ]), pStr ); @@ -3870,7 +4778,7 @@ void RenderTEAMPanel( BOOLEAN fDirty ) //if(gbPixelDepth==16) //{ BltVideoObjectFromIndex( guiSAVEBUFFER, guiTEAMObjects, 0, sTEAMFaceHighlXY[ posIndex ], sTEAMFaceHighlXY[ posIndex + 1 ], VO_BLT_SRCTRANSPARENCY, NULL ); - RestoreExternBackgroundRect( sTEAMFaceHighlXY[ posIndex ], sTEAMFaceHighlXY[ posIndex + 1 ], TM_FACEHIGHTL_WIDTH, TM_FACEHIGHTL_HEIGHT ); + RestoreExternBackgroundRect( sTEAMFaceHighlXY[ posIndex ], sTEAMFaceHighlXY[ posIndex + 1 ], TM_FACEHIGHTL_WIDTH, TM_FACEHIGHTL_HEIGHT ); // Render faceplate //BltVideoObjectFromIndex( guiSAVEBUFFER, guiTEAMObjects, 1, sTEAMFacesXY[ posIndex ] + TM_FACEPLATE_OFFSET_X, sTEAMFacesXY[ posIndex + 1 ] + TM_FACEPLATE_OFFSET_Y, VO_BLT_SRCTRANSPARENCY, NULL ); @@ -3880,10 +4788,10 @@ void RenderTEAMPanel( BOOLEAN fDirty ) else if ( gTacticalStatus.ubCurrentTeam != OUR_TEAM || !OK_INTERRUPT_MERC( pSoldier ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiTEAMObjects, 1, sTEAMFaceHighlXY[ posIndex ], sTEAMFaceHighlXY[ posIndex + 1 ], VO_BLT_SRCTRANSPARENCY, NULL ); - RestoreExternBackgroundRect( sTEAMFaceHighlXY[ posIndex ], sTEAMFaceHighlXY[ posIndex + 1 ], TM_FACEHIGHTL_WIDTH, TM_FACEHIGHTL_HEIGHT ); + RestoreExternBackgroundRect( sTEAMFaceHighlXY[ posIndex ], sTEAMFaceHighlXY[ posIndex + 1 ], TM_FACEHIGHTL_WIDTH, TM_FACEHIGHTL_HEIGHT ); // Render non-selection //BltVideoObjectFromIndex( guiSAVEBUFFER, guiTEAMObjects, 4, sTEAMFaceHighlXY[ posIndex ], sTEAMFaceHighlXY[ posIndex + 1 ], VO_BLT_SRCTRANSPARENCY, NULL ); - //RestoreExternBackgroundRect( sTEAMFaceHighlXY[ posIndex ], sTEAMFaceHighlXY[ posIndex + 1 ], TM_FACEHIGHTL_WIDTH, TM_FACEHIGHTL_HEIGHT ); + //RestoreExternBackgroundRect( sTEAMFaceHighlXY[ posIndex ], sTEAMFaceHighlXY[ posIndex + 1 ], TM_FACEHIGHTL_WIDTH, TM_FACEHIGHTL_HEIGHT ); // Render faceplate //BltVideoObjectFromIndex( guiSAVEBUFFER, guiTEAMObjects, 1, sTEAMFacesXY[ posIndex ] + TM_FACEPLATE_OFFSET_X, sTEAMFacesXY[ posIndex + 1 ] + TM_FACEPLATE_OFFSET_Y, VO_BLT_SRCTRANSPARENCY, NULL ); @@ -3904,7 +4812,7 @@ void RenderTEAMPanel( BOOLEAN fDirty ) if ( pSoldier->bStealthMode ) { SetFontBackground( FONT_MCOLOR_BLACK ); - SetFontForeground( FONT_MCOLOR_LTYELLOW ); + SetFontForeground( FONT_MCOLOR_LTYELLOW ); } else { @@ -3934,7 +4842,7 @@ void RenderTEAMPanel( BOOLEAN fDirty ) pSoldier = MercPtrs[ gTeamPanel[ cnt ].ubID ]; // Update animations.... - if ( pSoldier->fClosePanel || pSoldier->fClosePanelToDie ) + if ( pSoldier->flags.fClosePanel || pSoldier->flags.fClosePanelToDie ) { pSoldier->sPanelFaceX = gFacesData[ pSoldier->iFaceIndex ].usFaceX; pSoldier->sPanelFaceY = gFacesData[ pSoldier->iFaceIndex ].usFaceY; @@ -3944,44 +4852,44 @@ void RenderTEAMPanel( BOOLEAN fDirty ) if ( fDirty != DIRTYLEVEL0 ) { // UPdate stats! - if ( fDirty == DIRTYLEVEL2 ) - { - if ( pSoldier->bLife != 0 ) - { - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) - { - swprintf( pStr, TacticalStr[ VEHICLE_VITAL_STATS_POPUPTEXT ], pSoldier->bLife, pSoldier->bLifeMax, pSoldier->bBreath, pSoldier->bBreathMax ); - SetRegionFastHelpText( &(gTEAM_BarsRegions[ cnt ]), pStr ); - } - else if ( pSoldier->uiStatusFlags & SOLDIER_ROBOT ) - { - swprintf( pStr, gzLateLocalizedString[ 16 ], pSoldier->bLife, pSoldier->bLifeMax ); - SetRegionFastHelpText( &(gTEAM_BarsRegions[ cnt ]), pStr ); - } - else - { - GetMoraleString( pSoldier, pMoraleStr ); - swprintf( pStr, TacticalStr[ MERC_VITAL_STATS_POPUPTEXT ], pSoldier->bLife, pSoldier->bLifeMax, pSoldier->bBreath, pSoldier->bBreathMax, pMoraleStr ); - SetRegionFastHelpText( &(gTEAM_BarsRegions[ cnt ]), pStr ); - } - } - else - { - SetRegionFastHelpText( &(gTEAM_BarsRegions[ cnt ]), L"" ); - } - } + if ( fDirty == DIRTYLEVEL2 ) + { + if ( pSoldier->stats.bLife != 0 ) + { + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) + { + swprintf( pStr, TacticalStr[ VEHICLE_VITAL_STATS_POPUPTEXT ], pSoldier->stats.bLife, pSoldier->stats.bLifeMax, pSoldier->bBreath, pSoldier->bBreathMax ); + SetRegionFastHelpText( &(gTEAM_BarsRegions[ cnt ]), pStr ); + } + else if ( pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) + { + swprintf( pStr, gzLateLocalizedString[ 16 ], pSoldier->stats.bLife, pSoldier->stats.bLifeMax ); + SetRegionFastHelpText( &(gTEAM_BarsRegions[ cnt ]), pStr ); + } + else + { + GetMoraleString( pSoldier, pMoraleStr ); + swprintf( pStr, TacticalStr[ MERC_VITAL_STATS_POPUPTEXT ], pSoldier->stats.bLife, pSoldier->stats.bLifeMax, pSoldier->bBreath, pSoldier->bBreathMax, pMoraleStr ); + SetRegionFastHelpText( &(gTEAM_BarsRegions[ cnt ]), pStr ); + } + } + else + { + SetRegionFastHelpText( &(gTEAM_BarsRegions[ cnt ]), L"" ); + } + } - if ( !( pSoldier->uiStatusFlags & SOLDIER_DEAD ) ) + if ( !( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) ) { DrawLifeUIBarEx( pSoldier, sTEAMLifeXY[ posIndex ], sTEAMLifeXY[ posIndex + 1 ], TM_LIFEBAR_WIDTH, TM_LIFEBAR_HEIGHT, TRUE, FRAME_BUFFER ); - if ( !( pSoldier->uiStatusFlags & SOLDIER_ROBOT ) ) - { - DrawBreathUIBarEx( pSoldier, sTEAMBreathXY[ posIndex ], sTEAMBreathXY[ posIndex + 1 ], TM_LIFEBAR_WIDTH, TM_LIFEBAR_HEIGHT, TRUE, FRAME_BUFFER ); - DrawMoraleUIBarEx( pSoldier, sTEAMMoraleXY[ posIndex ], sTEAMMoraleXY[ posIndex + 1 ], TM_LIFEBAR_WIDTH, TM_LIFEBAR_HEIGHT, TRUE, FRAME_BUFFER ); - } + if ( !( pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) ) + { + DrawBreathUIBarEx( pSoldier, sTEAMBreathXY[ posIndex ], sTEAMBreathXY[ posIndex + 1 ], TM_LIFEBAR_WIDTH, TM_LIFEBAR_HEIGHT, TRUE, FRAME_BUFFER ); + DrawMoraleUIBarEx( pSoldier, sTEAMMoraleXY[ posIndex ], sTEAMMoraleXY[ posIndex + 1 ], TM_LIFEBAR_WIDTH, TM_LIFEBAR_HEIGHT, TRUE, FRAME_BUFFER ); + } - if ( gTacticalStatus.uiFlags & TURNBASED && pSoldier->bLife >= OKLIFE ) + if ( gTacticalStatus.uiFlags & TURNBASED && pSoldier->stats.bLife >= OKLIFE ) { // Render APs SetFont( TINYFONT1 ); @@ -4002,7 +4910,7 @@ void RenderTEAMPanel( BOOLEAN fDirty ) else if ( pSoldier->bStealthMode ) { SetFontBackground( FONT_MCOLOR_BLACK ); - SetFontForeground( FONT_MCOLOR_LTYELLOW ); + SetFontForeground( FONT_MCOLOR_LTYELLOW ); } else { @@ -4023,7 +4931,7 @@ void RenderTEAMPanel( BOOLEAN fDirty ) { //Erase! //DrawUIBar( pSoldier->bBreath, sTEAMBreathXY[ posIndex ], sTEAMBreathXY[ posIndex + 1 ], TM_LIFEBAR_WIDTH, TM_LIFEBAR_HEIGHT, DRAW_ERASE_BAR ); - //DrawUIBar( pSoldier->bLife, sTEAMLifeXY[ posIndex ], sTEAMLifeXY[ posIndex + 1 ], TM_LIFEBAR_WIDTH, TM_LIFEBAR_HEIGHT, DRAW_ERASE_BAR ); + //DrawUIBar( pSoldier->stats.bLife, sTEAMLifeXY[ posIndex ], sTEAMLifeXY[ posIndex + 1 ], TM_LIFEBAR_WIDTH, TM_LIFEBAR_HEIGHT, DRAW_ERASE_BAR ); // Erase APs RestoreExternBackgroundRect( sTEAMApXY[ posIndex ], sTEAMApXY[ posIndex + 1 ], TM_AP_WIDTH, TM_AP_HEIGHT ); @@ -4044,15 +4952,16 @@ void RenderTEAMPanel( BOOLEAN fDirty ) } } - + UpdateTEAMPanel( ); - + if( fRenderRadarScreen == TRUE ) { // Render clock - RenderClock( INTERFACE_CLOCK_X, INTERFACE_CLOCK_Y ); - CreateMouseRegionForPauseOfClock( INTERFACE_CLOCK_X, INTERFACE_CLOCK_Y ); - RenderTownIDString( ); + // CHRISL: Change coords to base off of right side of screen and use new paramters in RenderTownIDString + RenderClock( INTERFACE_CLOCK_TM_X, INTERFACE_CLOCK_TM_Y ); + CreateMouseRegionForPauseOfClock( INTERFACE_CLOCK_TM_X, INTERFACE_CLOCK_TM_Y ); + RenderTownIDString( LOCATION_NAME_TM_X, LOCATION_NAME_TM_Y); } else { @@ -4067,10 +4976,10 @@ CHAR8 ubString[48]; FilenameForBPP("INTERFACE\\bottom_bar_buttons.sti", ubString); // Load button Graphics - iTEAMPanelImages[ ENDTURN_IMAGES ] = LoadButtonImage(ubString,-1,0,-1, 3,-1 ); - iTEAMPanelImages[ ROSTERMODE_IMAGES ] = UseLoadedButtonImage( iTEAMPanelImages[ ENDTURN_IMAGES ] ,-1, 1,-1, 4,-1 ); - iTEAMPanelImages[ DISK_IMAGES ] = UseLoadedButtonImage( iTEAMPanelImages[ ENDTURN_IMAGES ] ,-1, 2,-1, 5, -1 ); - + iTEAMPanelImages[ ENDTURN_IMAGES ] = LoadButtonImage(ubString,-1,0,-1, 3,-1 ); + iTEAMPanelImages[ ROSTERMODE_IMAGES ] = UseLoadedButtonImage( iTEAMPanelImages[ ENDTURN_IMAGES ] ,-1, 1,-1, 4,-1 ); + iTEAMPanelImages[ DISK_IMAGES ] = UseLoadedButtonImage( iTEAMPanelImages[ ENDTURN_IMAGES ] ,-1, 2,-1, 5, -1 ); + // Create buttons iTEAMPanelButtons[ TEAM_DONE_BUTTON ] = QuickCreateButton( iTEAMPanelImages[ ENDTURN_IMAGES ], TM_ENDTURN_X, TM_ENDTURN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH - 1, @@ -4107,7 +5016,7 @@ CHAR8 ubString[48]; return( TRUE ); } -void RemoveTEAMPanelButtons( ) +void RemoveTEAMPanelButtons( ) { UINT32 cnt; @@ -4141,7 +5050,7 @@ void BtnEndTurnCallback(GUI_BUTTON *btn,INT32 reason) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); } - + } void BtnRostermodeCallback(GUI_BUTTON *btn,INT32 reason) @@ -4161,7 +5070,7 @@ void BtnRostermodeCallback(GUI_BUTTON *btn,INT32 reason) } } - + } @@ -4184,7 +5093,7 @@ void BtnSquadCallback(GUI_BUTTON *btn,INT32 reason) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); } - + } void SetTEAMPanelCurrentMerc( UINT8 ubNewID ) @@ -4234,7 +5143,7 @@ void UpdateTEAMPanel( ) MSYS_DisableRegion( &gTEAM_FirstHandInv[ cnt ] ); - MSYS_DisableRegion( &gTEAM_SecondHandInv[ cnt ] ); + MSYS_DisableRegion( &gTEAM_SecondHandInv[ cnt ] ); } //disable the radar map region @@ -4255,7 +5164,7 @@ void UpdateTEAMPanel( ) MSYS_EnableRegion( &gTEAM_FirstHandInv[ cnt ] ); - MSYS_EnableRegion( &gTEAM_SecondHandInv[ cnt ] ); + MSYS_EnableRegion( &gTEAM_SecondHandInv[ cnt ] ); } //Enable the radar map region @@ -4279,12 +5188,12 @@ void HandleMouseOverTeamFaceForContMove( BOOLEAN fOn ) // Display 'cont' on face.... // Get face pFace = &gFacesData[ gpSMCurrentMerc->iFaceIndex ]; - + pFace->fDisplayTextOver = FACE_DRAW_TEXT_OVER; wcscpy( pFace->zDisplayText, TacticalStr[ CONTINUE_OVER_FACE_STR ] ); // While our mouse is here, draw a path! - PlotPath( gpSMCurrentMerc, gpSMCurrentMerc->sFinalDestination, NO_COPYROUTE, PLOT, TEMPORARY, (UINT16)gpSMCurrentMerc->usUIMovementMode, NOT_STEALTH, FORWARD, gpSMCurrentMerc->bActionPoints ); + PlotPath( gpSMCurrentMerc, gpSMCurrentMerc->pathing.sFinalDestination, NO_COPYROUTE, PLOT, TEMPORARY, (UINT16)gpSMCurrentMerc->usUIMovementMode, NOT_STEALTH, FORWARD, gpSMCurrentMerc->bActionPoints ); } } else @@ -4292,7 +5201,7 @@ void HandleMouseOverTeamFaceForContMove( BOOLEAN fOn ) // Remove 'cont' on face.... // Get face pFace = &gFacesData[ gpSMCurrentMerc->iFaceIndex ]; - + pFace->fDisplayTextOver = FACE_ERASE_TEXT_OVER; // Erase path! @@ -4380,7 +5289,7 @@ void EnemyIndicatorClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) if (iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN) { - if ( MercPtrs[ ubSoldierID ]->uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) + if ( MercPtrs[ ubSoldierID ]->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) { } else @@ -4389,7 +5298,7 @@ void EnemyIndicatorClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) pSoldier = MercPtrs[ ubSoldierID ]; - if ( pSoldier->bOppCnt > 0 ) + if ( pSoldier->aiData.bOppCnt > 0 ) { // Cycle.... CycleVisibleEnemies( pSoldier ); } @@ -4449,7 +5358,7 @@ void MercFacePanelCallback( MOUSE_REGION * pRegion, INT32 iReason ) { if ( !gfInItemPickupMenu && gpItemPointer == NULL ) { - if ( MercPtrs[ ubSoldierID ]->uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) + if ( MercPtrs[ ubSoldierID ]->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) { pVehicle = GetSoldierStructureForVehicle( MercPtrs[ ubSoldierID ]->iVehicleId ); @@ -4478,12 +5387,12 @@ void MercFacePanelCallback( MOUSE_REGION * pRegion, INT32 iReason ) } } } - else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_DWN) + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { if ( !InOverheadMap( ) ) { // Only if guy is not dead! - if ( !( MercPtrs[ ubSoldierID ]->uiStatusFlags & SOLDIER_DEAD ) && !AM_AN_EPC( MercPtrs[ ubSoldierID ] ) && !( MercPtrs[ ubSoldierID ]->uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) ) + if ( !( MercPtrs[ ubSoldierID ]->flags.uiStatusFlags & SOLDIER_DEAD ) && !AM_AN_EPC( MercPtrs[ ubSoldierID ] ) && !( MercPtrs[ ubSoldierID ]->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) ) { gfSwitchPanel = TRUE; gbNewPanel = SM_PANEL; @@ -4496,7 +5405,7 @@ void MercFacePanelCallback( MOUSE_REGION * pRegion, INT32 iReason ) extern void InternalSelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fForceReselect, BOOLEAN fFromUI ); -void HandleLocateSelectMerc( UINT8 ubID, INT8 bFlag ) +void HandleLocateSelectMerc( UINT8 ubID, INT8 bFlag ) { BOOLEAN fSelect = FALSE; @@ -4513,7 +5422,7 @@ void HandleLocateSelectMerc( UINT8 ubID, INT8 bFlag ) // ATE: No matter what we do... if below OKLIFE, just locate.... - if ( MercPtrs[ ubID ]->bLife < OKLIFE ) + if ( MercPtrs[ ubID ]->stats.bLife < OKLIFE ) { LocateSoldier( ubID, SETLOCATOR ); return; @@ -4525,7 +5434,7 @@ void HandleLocateSelectMerc( UINT8 ubID, INT8 bFlag ) { // Select merc InternalSelectSoldier( ubID, TRUE, FALSE, TRUE); - MercPtrs[ ubID ]->fFlashLocator = FALSE; + MercPtrs[ ubID ]->flags.fFlashLocator = FALSE; ResetMultiSelection( ); } else @@ -4536,7 +5445,7 @@ void HandleLocateSelectMerc( UINT8 ubID, INT8 bFlag ) } else { - if ( MercPtrs[ ubID ]->fFlashLocator == FALSE ) + if ( MercPtrs[ ubID ]->flags.fFlashLocator == FALSE ) { if ( gGameSettings.fOptions[ TOPTION_OLD_SELECTION_METHOD ] ) { @@ -4563,7 +5472,7 @@ void HandleLocateSelectMerc( UINT8 ubID, INT8 bFlag ) } } } - else + else { if ( gGameSettings.fOptions[ TOPTION_OLD_SELECTION_METHOD ] ) { @@ -4600,7 +5509,7 @@ void HandleLocateSelectMerc( UINT8 ubID, INT8 bFlag ) if ( fSelect ) { // Select merc, only if alive! - if ( !( MercPtrs[ ubID ]->uiStatusFlags & SOLDIER_DEAD ) ) + if ( !( MercPtrs[ ubID ]->flags.uiStatusFlags & SOLDIER_DEAD ) ) { InternalSelectSoldier( ubID, TRUE, FALSE, TRUE ); } @@ -4618,17 +5527,17 @@ void HandleLocateSelectMerc( UINT8 ubID, INT8 bFlag ) void ShowRadioLocator( UINT8 ubID, UINT8 ubLocatorSpeed ) { - RESETTIMECOUNTER( MercPtrs[ ubID ]->FlashSelCounter, FLASH_SELECTOR_DELAY ); + RESETTIMECOUNTER( MercPtrs[ ubID ]->timeCounters.FlashSelCounter, FLASH_SELECTOR_DELAY ); //LocateSoldier( ubID, FALSE ); // IC - this is already being done outside of this function :) - MercPtrs[ ubID ]->fFlashLocator = TRUE; + MercPtrs[ ubID ]->flags.fFlashLocator = TRUE; //gbPanelSelectedGuy = ubID; IC - had to move this outside to make this function versatile MercPtrs[ ubID ]->sLocatorFrame = 0; if ( ubLocatorSpeed == SHOW_LOCATOR_NORMAL ) { // If we are an AI guy, and we have the baton, make lower... - // ( MercPtrs[ ubID ]->uiStatusFlags & SOLDIER_UNDERAICONTROL && MercPtrs[ ubID ]->bTeam != gbPlayerNum ) + // ( MercPtrs[ ubID ]->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL && MercPtrs[ ubID ]->bTeam != gbPlayerNum ) // //ercPtrs[ ubID ]->ubNumLocateCycles = 3; // @@ -4645,8 +5554,8 @@ void ShowRadioLocator( UINT8 ubID, UINT8 ubLocatorSpeed ) void EndRadioLocator( UINT8 ubID ) { - MercPtrs[ ubID ]->fFlashLocator = FALSE; - MercPtrs[ ubID ]->fShowLocator = FALSE; + MercPtrs[ ubID ]->flags.fFlashLocator = FALSE; + MercPtrs[ ubID ]->flags.fShowLocator = FALSE; } @@ -4660,7 +5569,7 @@ void CheckForFacePanelStartAnims( SOLDIERTYPE *pSoldier, INT16 sPanelX, INT16 sP } - if ( pSoldier->fUIdeadMerc ) + if ( pSoldier->flags.fUIdeadMerc ) { // pSoldier->sPanelFaceX = sPanelX; // pSoldier->sPanelFaceY = sPanelY; @@ -4675,19 +5584,19 @@ void FinishAnySkullPanelAnimations( ) SOLDIERTYPE *pTeamSoldier; INT32 cnt2; - cnt2 = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + cnt2 = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list for ( pTeamSoldier = MercPtrs[ cnt2 ]; cnt2 <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt2++,pTeamSoldier++ ) { - if ( pTeamSoldier->bActive && pTeamSoldier->bLife == 0 ) + if ( pTeamSoldier->bActive && pTeamSoldier->stats.bLife == 0 ) { - if ( pTeamSoldier->fUIdeadMerc || pTeamSoldier->fClosePanelToDie ) + if ( pTeamSoldier->flags.fUIdeadMerc || pTeamSoldier->flags.fClosePanelToDie ) { HandlePlayerTeamMemberDeathAfterSkullAnimation( pTeamSoldier ); - - pTeamSoldier->fUIdeadMerc = FALSE; - pTeamSoldier->fClosePanelToDie = FALSE; + + pTeamSoldier->flags.fUIdeadMerc = FALSE; + pTeamSoldier->flags.fClosePanelToDie = FALSE; } } } @@ -4707,50 +5616,50 @@ void HandlePanelFaceAnimations( SOLDIERTYPE *pSoldier ) return; } - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // Don't do this for a vehice. return; } // If this is the first time we are active, open panel! - if ( pSoldier->fUInewMerc ) + if ( pSoldier->flags.fUInewMerc ) { - pSoldier->fUInewMerc = FALSE; + pSoldier->flags.fUInewMerc = FALSE; } - if ( pSoldier->fUICloseMerc ) + if ( pSoldier->flags.fUICloseMerc ) { - pSoldier->fUICloseMerc = FALSE; + pSoldier->flags.fUICloseMerc = FALSE; } - if ( pSoldier->fUIdeadMerc ) + if ( pSoldier->flags.fUIdeadMerc ) { pSoldier->sPanelFaceX = gFacesData[ pSoldier->iFaceIndex ].usFaceX; pSoldier->sPanelFaceY = gFacesData[ pSoldier->iFaceIndex ].usFaceY; - pSoldier->fUIdeadMerc = FALSE; - pSoldier->fClosePanel = TRUE; - pSoldier->fClosePanelToDie = TRUE; + pSoldier->flags.fUIdeadMerc = FALSE; + pSoldier->flags.fClosePanel = TRUE; + pSoldier->flags.fClosePanelToDie = TRUE; pSoldier->ubClosePanelFrame = 0; pSoldier->ubDeadPanelFrame = 0; - RESETTIMECOUNTER( pSoldier->PanelAnimateCounter, 160 ); + RESETTIMECOUNTER( pSoldier->timeCounters.PanelAnimateCounter, 160 ); } - if ( pSoldier->fClosePanel ) + if ( pSoldier->flags.fClosePanel ) { - if ( TIMECOUNTERDONE( pSoldier->PanelAnimateCounter, 160 ) ) - { + if ( TIMECOUNTERDONE( pSoldier->timeCounters.PanelAnimateCounter, 160 ) ) + { pSoldier->ubClosePanelFrame++; if ( pSoldier->ubClosePanelFrame > 5 ) { - pSoldier->fClosePanel = FALSE; + pSoldier->flags.fClosePanel = FALSE; pSoldier->ubClosePanelFrame = 5; - if ( pSoldier->fClosePanelToDie ) + if ( pSoldier->flags.fClosePanelToDie ) { - pSoldier->fDeadPanel = TRUE; + pSoldier->flags.fDeadPanel = TRUE; //PlayJA2Sample( (UINT8)HEADCR_1, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); } else @@ -4761,29 +5670,29 @@ void HandlePanelFaceAnimations( SOLDIERTYPE *pSoldier ) } } } - RESETTIMECOUNTER( pSoldier->PanelAnimateCounter, 160 ); - } + RESETTIMECOUNTER( pSoldier->timeCounters.PanelAnimateCounter, 160 ); + } } - if ( pSoldier->fClosePanel ) + if ( pSoldier->flags.fClosePanel ) { - // Render panel! - //if(gbPixelDepth==16) - //{ + // Render panel! + //if(gbPixelDepth==16) + //{ if ( !gFacesData[ pSoldier->iFaceIndex ].fDisabled ) { - RestoreExternBackgroundRect( pSoldier->sPanelFaceX, pSoldier->sPanelFaceY, TM_FACE_WIDTH, TM_FACE_HEIGHT ); - BltVideoObjectFromIndex( FRAME_BUFFER, guiCLOSE, pSoldier->ubClosePanelFrame, pSoldier->sPanelFaceX, pSoldier->sPanelFaceY, VO_BLT_SRCTRANSPARENCY, NULL ); - InvalidateRegion( pSoldier->sPanelFaceX, pSoldier->sPanelFaceY, pSoldier->sPanelFaceX + TM_FACE_WIDTH, pSoldier->sPanelFaceY + TM_FACE_HEIGHT ); + RestoreExternBackgroundRect( pSoldier->sPanelFaceX, pSoldier->sPanelFaceY, TM_FACE_WIDTH, TM_FACE_HEIGHT ); + BltVideoObjectFromIndex( FRAME_BUFFER, guiCLOSE, pSoldier->ubClosePanelFrame, pSoldier->sPanelFaceX, pSoldier->sPanelFaceY, VO_BLT_SRCTRANSPARENCY, NULL ); + InvalidateRegion( pSoldier->sPanelFaceX, pSoldier->sPanelFaceY, pSoldier->sPanelFaceX + TM_FACE_WIDTH, pSoldier->sPanelFaceY + TM_FACE_HEIGHT ); } - //} + //} } - if ( pSoldier->fDeadPanel ) + if ( pSoldier->flags.fDeadPanel ) { - if ( TIMECOUNTERDONE( pSoldier->PanelAnimateCounter, 160 ) ) - { + if ( TIMECOUNTERDONE( pSoldier->timeCounters.PanelAnimateCounter, 160 ) ) + { pSoldier->ubDeadPanelFrame++; if ( pSoldier->ubDeadPanelFrame == 4 ) @@ -4796,9 +5705,9 @@ void HandlePanelFaceAnimations( SOLDIERTYPE *pSoldier ) if ( pSoldier->ubDeadPanelFrame > 5 ) { - pSoldier->fDeadPanel = FALSE; + pSoldier->flags.fDeadPanel = FALSE; pSoldier->ubDeadPanelFrame = 5; - pSoldier->fClosePanelToDie = FALSE; + pSoldier->flags.fClosePanelToDie = FALSE; // Finish! if ( !gFacesData[ pSoldier->iFaceIndex ].fDisabled ) @@ -4813,37 +5722,37 @@ void HandlePanelFaceAnimations( SOLDIERTYPE *pSoldier ) HandlePlayerTeamMemberDeathAfterSkullAnimation( pSoldier ); } - RESETTIMECOUNTER( pSoldier->PanelAnimateCounter, 160 ); - } + RESETTIMECOUNTER( pSoldier->timeCounters.PanelAnimateCounter, 160 ); + } } - if ( pSoldier->fDeadPanel ) + if ( pSoldier->flags.fDeadPanel ) { - // Render panel! - //if(gbPixelDepth==16) - //{ + // Render panel! + //if(gbPixelDepth==16) + //{ if ( !gFacesData[ pSoldier->iFaceIndex ].fDisabled ) { - BltVideoObjectFromIndex( FRAME_BUFFER, guiDEAD, pSoldier->ubDeadPanelFrame, pSoldier->sPanelFaceX, pSoldier->sPanelFaceY, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObjectFromIndex( FRAME_BUFFER, guiDEAD, pSoldier->ubDeadPanelFrame, pSoldier->sPanelFaceX, pSoldier->sPanelFaceY, VO_BLT_SRCTRANSPARENCY, NULL ); - // Blit hatch! - BltVideoObjectFromIndex( guiSAVEBUFFER, guiHATCH, 0, pSoldier->sPanelFaceX, pSoldier->sPanelFaceY, VO_BLT_SRCTRANSPARENCY, NULL ); + // Blit hatch! + BltVideoObjectFromIndex( guiSAVEBUFFER, guiHATCH, 0, pSoldier->sPanelFaceX, pSoldier->sPanelFaceY, VO_BLT_SRCTRANSPARENCY, NULL ); - InvalidateRegion( pSoldier->sPanelFaceX, pSoldier->sPanelFaceY, pSoldier->sPanelFaceX + TM_FACE_WIDTH, pSoldier->sPanelFaceY + TM_FACE_HEIGHT ); + InvalidateRegion( pSoldier->sPanelFaceX, pSoldier->sPanelFaceY, pSoldier->sPanelFaceX + TM_FACE_WIDTH, pSoldier->sPanelFaceY + TM_FACE_HEIGHT ); } - //} + //} } - if ( pSoldier->fOpenPanel ) + if ( pSoldier->flags.fOpenPanel ) { - if ( TIMECOUNTERDONE( pSoldier->PanelAnimateCounter, 160 ) ) - { + if ( TIMECOUNTERDONE( pSoldier->timeCounters.PanelAnimateCounter, 160 ) ) + { pSoldier->bOpenPanelFrame--; if ( pSoldier->bOpenPanelFrame < 0 ) { - pSoldier->fOpenPanel = FALSE; + pSoldier->flags.fOpenPanel = FALSE; pSoldier->bOpenPanelFrame = 0; if ( !gFacesData[ pSoldier->iFaceIndex ].fDisabled ) @@ -4851,24 +5760,24 @@ void HandlePanelFaceAnimations( SOLDIERTYPE *pSoldier ) RestoreExternBackgroundRect( pSoldier->sPanelFaceX, pSoldier->sPanelFaceY, TM_FACE_WIDTH, TM_FACE_HEIGHT ); } } - RESETTIMECOUNTER( pSoldier->PanelAnimateCounter, 160 ); - } + RESETTIMECOUNTER( pSoldier->timeCounters.PanelAnimateCounter, 160 ); + } } - if ( pSoldier->fOpenPanel ) + if ( pSoldier->flags.fOpenPanel ) { - // Render panel! - //if(gbPixelDepth==16) - //{ + // Render panel! + //if(gbPixelDepth==16) + //{ if ( !gFacesData[ pSoldier->iFaceIndex ].fDisabled ) { RestoreExternBackgroundRect( pSoldier->sPanelFaceX, pSoldier->sPanelFaceY, TM_FACE_WIDTH, TM_FACE_HEIGHT ); BltVideoObjectFromIndex( FRAME_BUFFER, guiCLOSE, pSoldier->bOpenPanelFrame, pSoldier->sPanelFaceX, pSoldier->sPanelFaceY, VO_BLT_SRCTRANSPARENCY, NULL ); - //InvalidateRegion( sTEAMFacesXY[ ubOpenPanelID ], sTEAMFacesXY[ ubOpenPanelID + 1 ], sTEAMFacesXY[ ubOpenPanelID ] + TM_FACE_WIDTH, sTEAMFacesXY[ ubOpenPanelID + 1 ] + TM_FACE_HEIGHT ); + //InvalidateRegion( sTEAMFacesXY[ ubOpenPanelID ], sTEAMFacesXY[ ubOpenPanelID + 1 ], sTEAMFacesXY[ ubOpenPanelID ] + TM_FACE_WIDTH, sTEAMFacesXY[ ubOpenPanelID + 1 ] + TM_FACE_HEIGHT ); } - //} + //} } - + } @@ -4882,9 +5791,9 @@ void HandleSoldierFaceFlash( SOLDIERTYPE *pSoldier, INT16 sFaceX, INT16 sFaceY ) void RenderSoldierTeamInv( SOLDIERTYPE *pSoldier, INT16 sX, INT16 sY, UINT8 ubPanelNum, BOOLEAN fDirty ) { - if ( pSoldier->bActive && !(pSoldier->uiStatusFlags & SOLDIER_DEAD ) ) + if ( pSoldier->bActive && !(pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) ) { - if ( pSoldier->uiStatusFlags & SOLDIER_DRIVER ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_DRIVER ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiVEHINV, 0, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL ); RestoreExternBackgroundRect( sX, sY, (INT16)( TM_INV_WIDTH ) , (INT16)( TM_INV_HEIGHT ) ); @@ -4895,7 +5804,7 @@ void RenderSoldierTeamInv( SOLDIERTYPE *pSoldier, INT16 sX, INT16 sY, UINT8 ubPa INVRenderItem( guiSAVEBUFFER, pSoldier, &(pSoldier->inv[ HANDPOS ]), sX, sY, TM_INV_WIDTH, TM_INV_HEIGHT, fDirty, &(gfTEAM_HandInvDispText[ ubPanelNum ][ HANDPOS ] ), 0 , FALSE, 0); } - if ( pSoldier->uiStatusFlags & ( SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) + if ( pSoldier->flags.uiStatusFlags & ( SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiVEHINV, 1, sX, (INT16)(sY + TM_INV_HAND_SEPY), VO_BLT_SRCTRANSPARENCY, NULL ); RestoreExternBackgroundRect( sX, (INT16)(sY + TM_INV_HAND_SEPY), (INT16)(TM_INV_WIDTH ) , (INT16)( TM_INV_HEIGHT ) ); @@ -4933,7 +5842,7 @@ void TMFirstHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) // Now use soldier ID values ubSoldierID = gTeamPanel[ ubID ].ubID; - + if ( !MercPtrs[ ubSoldierID ]->bActive ) { @@ -4970,7 +5879,7 @@ void TMClickFirstHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) if ( ubID == NOBODY ) return; - + // Now use soldier ID values ubSoldierID = gTeamPanel[ ubID ].ubID; @@ -4990,7 +5899,7 @@ void TMClickFirstHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) usOldHandItem = MercPtrs[ ubSoldierID ]->inv[HANDPOS].usItem; //SwapOutHandItem( MercPtrs[ ubSoldierID ] ); SwapHandItems( MercPtrs[ ubSoldierID ] ); - ReLoadSoldierAnimationDueToHandItemChange( MercPtrs[ ubSoldierID ], usOldHandItem, MercPtrs[ ubSoldierID ]->inv[HANDPOS].usItem ); + MercPtrs[ ubSoldierID ]->ReLoadSoldierAnimationDueToHandItemChange( usOldHandItem, MercPtrs[ ubSoldierID ]->inv[HANDPOS].usItem ); fInterfacePanelDirty = DIRTYLEVEL2; } } @@ -5006,7 +5915,7 @@ void TMClickSecondHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) if ( ubID == NOBODY ) return; - + // Now use soldier ID values ubSoldierID = gTeamPanel[ ubID ].ubID; @@ -5015,7 +5924,7 @@ void TMClickSecondHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) if (iReason == MSYS_CALLBACK_REASON_LBUTTON_UP ) { - if ( MercPtrs[ ubSoldierID ]->uiStatusFlags & ( SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) + if ( MercPtrs[ ubSoldierID ]->flags.uiStatusFlags & ( SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) { ExitVehicle( MercPtrs[ ubSoldierID ] ); } @@ -5023,7 +5932,7 @@ void TMClickSecondHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) if (iReason == MSYS_CALLBACK_REASON_RBUTTON_UP ) { - if ( MercPtrs[ ubSoldierID ]->uiStatusFlags & ( SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) + if ( MercPtrs[ ubSoldierID ]->flags.uiStatusFlags & ( SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) { } else @@ -5032,7 +5941,7 @@ void TMClickSecondHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) { usOldHandItem = MercPtrs[ ubSoldierID ]->inv[HANDPOS].usItem; SwapHandItems( MercPtrs[ ubSoldierID ] ); - ReLoadSoldierAnimationDueToHandItemChange( MercPtrs[ ubSoldierID ], usOldHandItem, MercPtrs[ ubSoldierID ]->inv[HANDPOS].usItem ); + MercPtrs[ ubSoldierID ]->ReLoadSoldierAnimationDueToHandItemChange( usOldHandItem, MercPtrs[ ubSoldierID ]->inv[HANDPOS].usItem ); fInterfacePanelDirty = DIRTYLEVEL2; } } @@ -5100,10 +6009,10 @@ BOOLEAN RemovePlayerFromTeamSlotGivenMercID( UINT8 ubMercID ) void AddPlayerToInterfaceTeamSlot( UINT8 ubID ) { - INT32 cnt; + INT32 cnt; // If we are a vehicle don't ever add..... - if ( MercPtrs[ ubID ]->uiStatusFlags & SOLDIER_VEHICLE ) + if ( MercPtrs[ ubID ]->flags.uiStatusFlags & SOLDIER_VEHICLE ) { return; } @@ -5125,7 +6034,7 @@ void AddPlayerToInterfaceTeamSlot( UINT8 ubID ) fInterfacePanelDirty = DIRTYLEVEL2; // Set ID to do open anim - MercPtrs[ ubID ]->fUInewMerc = TRUE; + MercPtrs[ ubID ]->flags.fUInewMerc = TRUE; break; } @@ -5169,7 +6078,7 @@ BOOLEAN GetPlayerIDFromInterfaceTeamSlot( UINT8 ubPanelSlot, UINT8 *pubID ) void RemoveAllPlayersFromSlot( ) { int cnt; - + for ( cnt = 0; cnt < NUM_TEAM_SLOTS; cnt++ ) { RemovePlayerFromInterfaceTeamSlot( (UINT8)cnt ); @@ -5186,11 +6095,11 @@ BOOLEAN RemovePlayerFromInterfaceTeamSlot( UINT8 ubPanelSlot ) if ( gTeamPanel[ ubPanelSlot ].fOccupied ) { - if ( !( MercPtrs[ gTeamPanel[ ubPanelSlot ].ubID ]->uiStatusFlags & SOLDIER_DEAD ) ) - { - // Set Id to close - MercPtrs[ gTeamPanel[ ubPanelSlot ].ubID ]->fUICloseMerc = TRUE; - } + if ( !( MercPtrs[ gTeamPanel[ ubPanelSlot ].ubID ]->flags.uiStatusFlags & SOLDIER_DEAD ) ) + { + // Set Id to close + MercPtrs[ gTeamPanel[ ubPanelSlot ].ubID ]->flags.fUICloseMerc = TRUE; + } // Set face to inactive... SetAutoFaceInActive( MercPtrs[ gTeamPanel[ ubPanelSlot ].ubID ]->iFaceIndex ); @@ -5214,7 +6123,9 @@ BOOLEAN RemovePlayerFromInterfaceTeamSlot( UINT8 ubPanelSlot ) } -void RenderTownIDString( ) +/* CHRISL: Adjust function to allow X,Y coordinates to be passed so that we can render the TownID string +seperately between the team and inventory windows. */ +void RenderTownIDString( INT16 sX, INT16 sY ) { CHAR16 zTownIDString[80]; INT16 sFontX, sFontY; @@ -5226,7 +6137,7 @@ void RenderTownIDString( ) GetSectorIDString( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, zTownIDString, TRUE ); ReduceStringLength( zTownIDString, 80, COMPFONT ); - VarFindFontCenterCoordinates( LOCATION_NAME_X , LOCATION_NAME_Y, 80, 16, COMPFONT, &sFontX, &sFontY, zTownIDString ); + VarFindFontCenterCoordinates( sX , sY, 80, 16, COMPFONT, &sFontX, &sFontY, zTownIDString ); mprintf( sFontX, sFontY, L"%s", zTownIDString ); } @@ -5234,21 +6145,21 @@ void RenderTownIDString( ) void CheckForAndAddMercToTeamPanel( SOLDIERTYPE *pSoldier ) { - if ( pSoldier->bActive ) + if ( pSoldier->bActive ) { // Add to interface if the are ours if ( pSoldier->bTeam == gbPlayerNum ) { // Are we in the loaded sector? - if ( pSoldier->sSectorX == gWorldSectorX && pSoldier->sSectorY == gWorldSectorY && pSoldier->bSectorZ == gbWorldSectorZ && !pSoldier->fBetweenSectors && pSoldier->bInSector ) + if ( pSoldier->sSectorX == gWorldSectorX && pSoldier->sSectorY == gWorldSectorY && pSoldier->bSectorZ == gbWorldSectorZ && !pSoldier->flags.fBetweenSectors && pSoldier->bInSector ) { // IF on duty.... - if( ( pSoldier->bAssignment == CurrentSquad( ) )|| ( SoldierIsDeadAndWasOnSquad( pSoldier, ( INT8 )( CurrentSquad( ) ) ) ) ) + if( ( pSoldier->bAssignment == CurrentSquad( ) )|| ( SoldierIsDeadAndWasOnSquad( pSoldier, ( INT8 )( CurrentSquad( ) ) ) ) ) { if( pSoldier->bAssignment == ASSIGNMENT_DEAD ) { - pSoldier->fUICloseMerc = FALSE; + pSoldier->flags.fUICloseMerc = FALSE; } // ATE: ALrighty, if we have the insertion code of helicopter..... don't add just yet! /// ( will add in heli code ) @@ -5258,17 +6169,17 @@ void CheckForAndAddMercToTeamPanel( SOLDIERTYPE *pSoldier ) } // ARE WE A VEHICLE..... - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { AddPassangersToTeamPanel( pSoldier->bVehicleID ); } - } + } } else { // Make sure we are NOT in this world! // Set gridno to one that's not visib;l - RemoveSoldierFromGridNo( pSoldier ); + pSoldier->RemoveSoldierFromGridNo( ); // Remove slot from tactical RemoveMercSlot( pSoldier ); @@ -5278,6 +6189,30 @@ void CheckForAndAddMercToTeamPanel( SOLDIERTYPE *pSoldier ) } } +void CleanUpStack( OBJECTTYPE * pObj, OBJECTTYPE * pCursorObj ) +{ + INT16 bMaxPoints; + + if ( !(Item[ pObj->usItem ].usItemClass & IC_AMMO || Item[ pObj->usItem ].usItemClass & IC_KIT || Item[ pObj->usItem ].usItemClass & IC_MEDKIT || Item[pObj->usItem].canteen || Item[pObj->usItem].gascan || Item[pObj->usItem].alcohol ) ) + { + return; + } + + if ( Item[ pObj->usItem ].usItemClass & IC_AMMO ) + { + bMaxPoints = Magazine[ Item[ pObj->usItem ].ubClassIndex ].ubMagSize; + } + else + { + bMaxPoints = 100; + } + + if ( pCursorObj && pCursorObj->usItem == pObj->usItem ) + { + DistributeStatus(pCursorObj, pObj, bMaxPoints); + } + DistributeStatus(pObj, pObj, bMaxPoints); +} UINT8 FindNextMercInTeamPanel( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ) { @@ -5310,7 +6245,7 @@ UINT8 FindNextMercInTeamPanel( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife if ( fGoodForLessOKLife ) { - if ( pTeamSoldier->bLife > 0 && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bTeam == gbPlayerNum && pTeamSoldier->bAssignment < ON_DUTY && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) + if ( pTeamSoldier->stats.bLife > 0 && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bTeam == gbPlayerNum && pTeamSoldier->bAssignment < ON_DUTY && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) { return( (UINT8)gTeamPanel[ cnt ].ubID ); } @@ -5327,7 +6262,7 @@ UINT8 FindNextMercInTeamPanel( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife if ( ( gusSelectedSoldier != NOBODY ) && ( gGameSettings.fOptions[ TOPTION_SPACE_SELECTS_NEXT_SQUAD ] ) ) - { + { // only allow if nothing in hand and if in SM panel, the Change Squad button must be enabled if ( ( ( gsCurInterfacePanel != TEAM_PANEL ) || ( ButtonList[ iTEAMPanelButtons[ CHANGE_SQUAD_BUTTON ] ]->uiFlags & BUTTON_ENABLED ) ) ) { @@ -5366,7 +6301,7 @@ UINT8 FindNextMercInTeamPanel( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife if ( fGoodForLessOKLife ) { - if ( pTeamSoldier->bLife > 0 && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bTeam == gbPlayerNum && pTeamSoldier->bAssignment < ON_DUTY && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) + if ( pTeamSoldier->stats.bLife > 0 && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bTeam == gbPlayerNum && pTeamSoldier->bAssignment < ON_DUTY && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) { return( (UINT8)gTeamPanel[ cnt ].ubID ); } @@ -5432,7 +6367,7 @@ void BeginKeyPanelFromKeyShortcut( ) if( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) return; - InitKeyRingPopup( pSoldier, 0, sStartYPosition, sWidth, sHeight ); + InitKeyRingPopup( pSoldier, 0, sStartYPosition, sWidth, sHeight ); } @@ -5454,8 +6389,8 @@ void KeyRingItemPanelButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ) return; } - - + + pSoldier = &( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ] ); sStartYPosition = MAP_START_KEYRING_Y; @@ -5495,7 +6430,7 @@ void KeyRingItemPanelButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ) InvalidateRegion( 0, 107, 261, 359 ); } - InitKeyRingPopup( pSoldier, 0, sStartYPosition, sWidth, sHeight ); + InitKeyRingPopup( pSoldier, 0, sStartYPosition, sWidth, sHeight ); } } @@ -5510,7 +6445,7 @@ void KeyRingSlotInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) uiKeyRing = MSYS_GetRegionUserData( pRegion, 0 ); - + if (iReason & MSYS_CALLBACK_REASON_INIT) { return; @@ -5533,22 +6468,20 @@ void KeyRingSlotInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) if( gMoveingItem.sItemIndex == 0 ) { //Delete the contents of the item cursor - memset( &gMoveingItem, 0, sizeof( INVENTORY_IN_SLOT ) ); + gMoveingItem.initialize(); } else { - memset( &InvSlot, 0, sizeof( INVENTORY_IN_SLOT ) ); - // Return if empty - //if ( gpSMCurrentMerc->inv[ uiHandPos ].usItem == NOTHING ) + //if ( gpSMCurrentMerc->inv[ uiHandPos ].exists() == false ) // return; // Fill out the inv slot for the item //InvSlot.sItemIndex = gpSMCurrentMerc->inv[ uiHandPos ].usItem; // InvSlot.ubNumberOfItems = gpSMCurrentMerc->inv[ uiHandPos ].ubNumberOfObjects; -// InvSlot.ubItemQuality = gpSMCurrentMerc->inv[ uiHandPos ].bGunStatus; - //memcpy( &InvSlot.ItemObject, &gpSMCurrentMerc->inv[ uiHandPos ], sizeof( OBJECTTYPE ) ); +// InvSlot.ubItemQuality = gpSMCurrentMerc->inv[ uiHandPos ].gun.bGunStatus; + //InvSlot.ItemObject = gpSMCurrentMerc->inv[ uiHandPos ]; //InvSlot.ubLocationOfObject = PLAYERS_INVENTORY; //InvSlot.ubIdOfMercWhoOwnsTheItem = gpSMCurrentMerc->ubProfile; @@ -5557,7 +6490,7 @@ void KeyRingSlotInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) //Add the item to the Players Offer Area //AddItemToPlayersOfferArea( gpSMCurrentMerc->ubProfile, &InvSlot, (UINT8)uiHandPos ); - // Dirty + // Dirty fInterfacePanelDirty = DIRTYLEVEL2; } return; @@ -5582,7 +6515,7 @@ void KeyRingSlotInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) } } - usOldItemIndex = ( UINT16 )uiKeyRing ; + usOldItemIndex = ( UINT16 )uiKeyRing ; BeginKeyRingItemPointer( gpItemPopupSoldier, (UINT8)usOldItemIndex ); //BeginItemPointer( gpSMCurrentMerc, (UINT8)uiHandPos ); @@ -5594,13 +6527,13 @@ void KeyRingSlotInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) BOOLEAN fOKToGo = FALSE; BOOLEAN fDeductPoints = FALSE; - if( ( gpItemPointer ->usItem < FIRST_KEY ) || ( gpItemPointer ->usItem > KEY_32 ) ) + if( ( gpItemPointer->usItem < FIRST_KEY ) || ( gpItemPointer->usItem > KEY_32 ) ) { return; } // ATE: OK, get source, dest guy if different... check for and then charge appropriate APs - ubSrcID = ( UINT8 )gCharactersList[ bSelectedInfoChar ].usSolID; + ubSrcID = ( UINT8 )gCharactersList[ bSelectedInfoChar ].usSolID; if ( gpItemPointerSoldier ) { ubDestID = gpItemPointerSoldier->ubID; @@ -5614,14 +6547,14 @@ void KeyRingSlotInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) { // We are doing this ourselve, continue fOKToGo = TRUE; - } + } else { // These guys are different.... fDeductPoints = TRUE; // First check points for src guy - if ( gpItemPointerSoldier->bLife >= CONSCIOUSNESS ) + if ( gpItemPointerSoldier->stats.bLife >= CONSCIOUSNESS ) { if ( EnoughPoints( gpItemPointerSoldier, 2, 0, TRUE ) ) { @@ -5636,7 +6569,7 @@ void KeyRingSlotInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) // Should we go on? if ( fOKToGo ) { - if ( gpSMCurrentMerc->bLife >= CONSCIOUSNESS ) + if ( gpSMCurrentMerc->stats.bLife >= CONSCIOUSNESS ) { if ( EnoughPoints( gpSMCurrentMerc, 2, 0, TRUE ) ) { @@ -5655,32 +6588,32 @@ void KeyRingSlotInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) //usOldItemIndex = gpSMCurrentMerc->inv[ uiHandPos ].usItem; //usNewItemIndex = gpItemPointer->usItem; - if ( gpItemPopupSoldier->pKeyRing[ uiKeyRing ].ubKeyID == INVALID_KEY_NUMBER || gpItemPopupSoldier->pKeyRing[ uiKeyRing ].ubKeyID == gpItemPointer->ItemData.Key.ubKeyID) + if ( gpItemPopupSoldier->pKeyRing[ uiKeyRing ].ubKeyID == INVALID_KEY_NUMBER || gpItemPopupSoldier->pKeyRing[ uiKeyRing ].ubKeyID == (*gpItemPointer)[0]->data.key.ubKeyID) { // Try to place here if ( ( iNumberOfKeysTaken = AddKeysToSlot( gpItemPopupSoldier, ( INT8 )uiKeyRing, gpItemPointer ) ) ) { - + if ( fDeductPoints ) { // Deduct points - if ( gpItemPointerSoldier->bLife >= CONSCIOUSNESS ) + if ( gpItemPointerSoldier->stats.bLife >= CONSCIOUSNESS ) { - DeductPoints( gpItemPointerSoldier, 2, 0 ); + DeductPoints( gpItemPointerSoldier, 2, 0 ); } - if ( gpItemPopupSoldier->bLife >= CONSCIOUSNESS ) + if ( gpItemPopupSoldier->stats.bLife >= CONSCIOUSNESS ) { - DeductPoints( gpItemPopupSoldier, 2, 0 ); + DeductPoints( gpItemPopupSoldier, 2, 0 ); } } - - // Dirty + + // Dirty fInterfacePanelDirty = DIRTYLEVEL2; gpItemPointer->ubNumberOfObjects -= ( UINT8 )iNumberOfKeysTaken; // Check if it's the same now! - if ( gpItemPointer->ubNumberOfObjects == 0 ) + if ( gpItemPointer->exists() == false ) { if ( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) { @@ -5707,17 +6640,17 @@ void KeyRingSlotInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) if ( fDeductPoints ) { // Deduct points - if ( gpItemPointerSoldier && gpItemPointerSoldier->bLife >= CONSCIOUSNESS ) + if ( gpItemPointerSoldier && gpItemPointerSoldier->stats.bLife >= CONSCIOUSNESS ) { - DeductPoints( gpItemPointerSoldier, 2, 0 ); + DeductPoints( gpItemPointerSoldier, 2, 0 ); } - if ( gpSMCurrentMerc->bLife >= CONSCIOUSNESS ) + if ( gpSMCurrentMerc->stats.bLife >= CONSCIOUSNESS ) { - DeductPoints( gpSMCurrentMerc, 2, 0 ); + DeductPoints( gpSMCurrentMerc, 2, 0 ); } } - - // Dirty + + // Dirty fInterfacePanelDirty = DIRTYLEVEL2; } @@ -5747,12 +6680,12 @@ void KeyRingSlotInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) { if ( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) { - //InitKeyItemDescriptionBox( gpItemPopupSoldier, (UINT8)uiKeyRing, MAP_ITEMDESC_START_X, MAP_ITEMDESC_START_Y, 0 ); - } - else - { - InitKeyItemDescriptionBox( gpItemPopupSoldier, (UINT8)uiKeyRing, SM_ITEMDESC_START_X, SM_ITEMDESC_START_Y, 0 ); - } + //InitKeyItemDescriptionBox( gpItemPopupSoldier, (UINT8)uiKeyRing, MAP_ITEMDESC_START_X, MAP_ITEMDESC_START_Y, 0 ); + } + else + { + InitKeyItemDescriptionBox( gpItemPopupSoldier, (UINT8)uiKeyRing, SM_ITEMDESC_START_X, SM_ITEMDESC_START_Y, 0 ); + } } } else if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) @@ -5797,7 +6730,7 @@ void DisableSMPpanelButtonsWhenInShopKeeperInterface( BOOLEAN fDontDrawButtons ) DisableButton( iSMPanelButtons[ MUTE_BUTTON ] ); DisableButton( giSMStealthButton ); - + RenderBackpackButtons(3); /* CHRISL: Needed for new inventory backpack buttons */ @@ -5817,6 +6750,13 @@ void DisableSMPpanelButtonsWhenInShopKeeperInterface( BOOLEAN fDontDrawButtons ) ButtonList[ iSMPanelButtons[ MUTE_BUTTON ] ]->uiFlags &= ~BUTTON_DIRTY; ButtonList[ giSMStealthButton ]->uiFlags &= ~BUTTON_DIRTY; + // CHRISL: Backpack buttons for new inventory system + if((UsingNewInventorySystem() == true)) + { + ButtonList[ giSMZipperButton ]->uiFlags &= ~BUTTON_DIRTY; + ButtonList[ giSMDropPackButton ]->uiFlags &= ~BUTTON_DIRTY; + } + //Make sure the options button is disabled ButtonList[ iSMPanelButtons[ OPTIONS_BUTTON ] ]->uiFlags &= ~BUTTON_ENABLED; @@ -5835,6 +6775,12 @@ void DisableSMPpanelButtonsWhenInShopKeeperInterface( BOOLEAN fDontDrawButtons ) ButtonList[ iSMPanelButtons[ MUTE_BUTTON ] ]->uiFlags |= BUTTON_FORCE_UNDIRTY; ButtonList[ giSMStealthButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY; + // CHRISL: Backpack buttons for new inventory system + if((UsingNewInventorySystem() == true)) + { + ButtonList[ giSMZipperButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY; + ButtonList[ giSMDropPackButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY; + } } } @@ -5870,7 +6816,7 @@ void EnableButtonsForInItemBox( BOOLEAN fEnable ) EnableButton( iSMPanelButtons[ SM_MAP_SCREEN_BUTTON ] ); } } -} +} void SMInvMoneyButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ) @@ -5885,7 +6831,7 @@ void SMInvMoneyButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ) if( gfSMDisableForItems ) return; - //if the player has an item in his hand, + //if the player has an item in his hand, if( gpItemPointer != NULL ) { //and the item is money @@ -5894,11 +6840,11 @@ void SMInvMoneyButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ) CHAR16 zText[512]; CHAR16 zMoney[64]; - // Make sure we go back to movement mode... - guiPendingOverrideEvent = A_CHANGE_TO_MOVE; - HandleTacticalUI( ); + // Make sure we go back to movement mode... + guiPendingOverrideEvent = A_CHANGE_TO_MOVE; + HandleTacticalUI( ); - swprintf( zMoney, L"%d", gpItemPointer->ItemData.Money.uiMoneyAmount ); + swprintf( zMoney, L"%d", (*gpItemPointer)[0]->data.money.uiMoneyAmount ); InsertCommasForDollarFigure( zMoney ); InsertDollarSignInToString( zMoney ); @@ -5933,7 +6879,7 @@ void SMInvMoneyButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ) // else CreateMoney( LaptopSaveInfo.iCurrentBalance, &gItemPointer ); - InternalInitItemDescriptionBox( &gItemPointer, SM_ITEMDESC_START_X, SM_ITEMDESC_START_Y, 0, gpSMCurrentMerc ); + InternalInitItemDescriptionBox( &gItemPointer, ITEMDESC_START_X, ITEMDESC_START_Y, 0, gpSMCurrentMerc ); } } } @@ -5943,7 +6889,7 @@ void ConfirmationToDepositMoneyToPlayersAccount( UINT8 ubExitValue ) if ( ubExitValue == MSG_BOX_RETURN_YES ) { //add the money to the players account - AddTransactionToPlayersBook( MERC_DEPOSITED_MONEY_TO_PLAYER_ACCOUNT, gpSMCurrentMerc->ubProfile, GetWorldTotalMin(), gpItemPointer->ItemData.Money.uiMoneyAmount ); + AddTransactionToPlayersBook( MERC_DEPOSITED_MONEY_TO_PLAYER_ACCOUNT, gpSMCurrentMerc->ubProfile, GetWorldTotalMin(), (*gpItemPointer)[0]->data.money.uiMoneyAmount ); // dirty shopkeeper gubSkiDirtyLevel = SKI_DIRTY_LEVEL2; @@ -5993,7 +6939,7 @@ void GoToMapScreenFromTactical( void ) if ( gTacticalStatus.bBoxingState != NOT_BOXING ) { // pop up dialogue asking whether the player wants to abandon the fight - DoMessageBox( MSG_BOX_BASIC_STYLE, Message[ STR_ABANDON_FIGHT ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, AbandonBoxingCallback, NULL ); + DoMessageBox( MSG_BOX_BASIC_STYLE, Message[ STR_ABANDON_FIGHT ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, AbandonBoxingCallback, NULL ); return; } // ok, proceed! @@ -6001,7 +6947,8 @@ void GoToMapScreenFromTactical( void ) } -void HandleTacticalEffectsOfEquipmentChange( SOLDIERTYPE *pSoldier, UINT32 uiInvPos, UINT16 usOldItem, UINT16 usNewItem ) +// Moved to Weapons.cpp by ADB, rev 1513 +/*void HandleTacticalEffectsOfEquipmentChange( SOLDIERTYPE *pSoldier, UINT32 uiInvPos, UINT16 usOldItem, UINT16 usNewItem ) { // if in attached weapon mode and don't have weapon with GL attached in hand, reset weapon mode if ( (pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO )&& !IsGrenadeLauncherAttached( &(pSoldier->inv[ HANDPOS ]) ) ) @@ -6027,15 +6974,15 @@ void HandleTacticalEffectsOfEquipmentChange( SOLDIERTYPE *pSoldier, UINT32 uiInv if ( uiInvPos == HANDPOS || uiInvPos == SECONDHANDPOS ) { // check if we need to change animation! - ReLoadSoldierAnimationDueToHandItemChange( pSoldier, usOldItem, usNewItem ); + pSoldier->ReLoadSoldierAnimationDueToHandItemChange( usOldItem, usNewItem ); } // if this is head gear if ( uiInvPos == HEAD1POS || uiInvPos == HEAD2POS ) { - // Could be because of GOGGLES change... Re-create light... - DeleteSoldierLight( pSoldier ); - PositionSoldierLight( pSoldier ); + // Could be because of GOGGLES change... Re-create light... + pSoldier->DeleteSoldierLight( ); + pSoldier->PositionSoldierLight( ); } } else @@ -6057,4 +7004,9 @@ void HandleTacticalEffectsOfEquipmentChange( SOLDIERTYPE *pSoldier, UINT32 uiInv } } } -} +}*/ + + + + + diff --git a/Tactical/Interface Panels.h b/Tactical/Interface Panels.h index 8e5f4dd0..4605cf15 100644 --- a/Tactical/Interface Panels.h +++ b/Tactical/Interface Panels.h @@ -43,8 +43,8 @@ typedef enum #define SHOW_LOCATOR_FAST 2 BOOLEAN CreateSMPanelButtons( ); -void RemoveSMPanelButtons( ); -BOOLEAN InitializeSMPanel( ); +void RemoveSMPanelButtons( ); +BOOLEAN InitializeSMPanel( ); BOOLEAN ShutdownSMPanel( ); void RenderSMPanel( BOOLEAN *pfDirty ); void EnableSMPanelButtons( BOOLEAN fEnable, BOOLEAN fFromItemPickup ); @@ -56,11 +56,14 @@ void EnableSMPanelButtons( BOOLEAN fEnable, BOOLEAN fFromItemPickup ); * and when we will read all values we return TRUE if not we will retunf FALSE * any questions? joker */ -BOOLEAN InitializeSMPanelCoords( ); +//BOOLEAN InitializeSMPanelCoords( ); +BOOLEAN InitializeSMPanelCoordsNew(); +BOOLEAN InitializeSMPanelCoordsOld(); + BOOLEAN CreateTEAMPanelButtons( ); -void RemoveTEAMPanelButtons( ); -BOOLEAN InitializeTEAMPanel( ); +void RemoveTEAMPanelButtons( ); +BOOLEAN InitializeTEAMPanel( ); BOOLEAN ShutdownTEAMPanel( ); void RenderTEAMPanel( BOOLEAN fDirty ); void UpdateTEAMPanel( ); @@ -72,7 +75,7 @@ BOOLEAN InitializeTEAMPanelCoords( ); void SetSMPanelCurrentMerc( UINT8 ubNewID ); void SetTEAMPanelCurrentMerc( UINT8 ubNewID ); -UINT16 GetSMPanelCurrentMerc( ); +UINT16 GetSMPanelCurrentMerc( ); void UpdateSMPanel( ); BOOLEAN InitTEAMSlots( ); @@ -83,10 +86,16 @@ void RemoveAllPlayersFromSlot( ); BOOLEAN PlayerExistsInSlot( UINT8 ubID ); BOOLEAN RemovePlayerFromTeamSlotGivenMercID( UINT8 ubMercID ); void CheckForAndAddMercToTeamPanel( SOLDIERTYPE *pSoldier ); +void CleanUpStack( OBJECTTYPE * pObj, OBJECTTYPE * pCursorObj ); void DisableTacticalTeamPanelButtons( BOOLEAN fDisable ); -void RenderTownIDString( ); +// CHRISL: Add X,Y coords as parameters so we can control the placement of TownID string on the team and inventory panels seperately +void RenderTownIDString( INT16 sX, INT16 sY ); void KeyRingSlotInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ); +// CHRISL: New functions to handle initialization of inventory systems +void InitNewInventorySystem( ); +void InitOldInventorySystem( ); + // ATE TO BE MOVED TO INTERFACE_ITEMS.C @@ -124,15 +133,21 @@ void CheckForReEvaluateDisabledINVPanelButtons( ); void CheckForDisabledForGiveItem( ); void ReevaluateItemHatches( SOLDIERTYPE *pSoldier, BOOLEAN fEnable ); +//CHRISL: New function to deal with rendering backpack buttons +void RenderBackpackButtons(int bpAction); void HandlePanelFaceAnimations( SOLDIERTYPE *pSoldier ); void GoToMapScreenFromTactical( void ); -void HandleTacticalEffectsOfEquipmentChange( SOLDIERTYPE *pSoldier, UINT32 uiInvPos, UINT16 usOldItem, UINT16 usNewItem ); +// Moved to weapons.h by ADB, rev 1513 +//void HandleTacticalEffectsOfEquipmentChange( SOLDIERTYPE *pSoldier, UINT32 uiInvPos, UINT16 usOldItem, UINT16 usNewItem ); void FinishAnySkullPanelAnimations( ); UINT8 FindNextMercInTeamPanel( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ); +// CHRISL: New callback functions for backpack buttons +BOOLEAN ChangeDropPackStatus(SOLDIERTYPE *pSoldier, BOOLEAN newStatus); + #endif \ No newline at end of file diff --git a/Tactical/Interface Utils.cpp b/Tactical/Interface Utils.cpp index c6cdaec4..16c9447d 100644 --- a/Tactical/Interface Utils.cpp +++ b/Tactical/Interface Utils.cpp @@ -4,7 +4,7 @@ #include "builddefines.h" #include #include - #include "sgp.h" + #include "sgp.h" #include "himage.h" #include "vobject.h" #include "interface utils.h" @@ -21,17 +21,17 @@ #include "WCheck.h" #include "Vehicles.h" #endif - + #define LIFE_BAR_SHADOW FROMRGB( 108, 12, 12 ) #define LIFE_BAR FROMRGB( 200, 0, 0 ) #define BANDAGE_BAR_SHADOW FROMRGB( 156, 60, 60 ) #define BANDAGE_BAR FROMRGB( 222, 132, 132 ) #define BLEEDING_BAR_SHADOW FROMRGB( 128, 128, 60 ) -#define BLEEDING_BAR FROMRGB( 240, 240, 20 ) +#define BLEEDING_BAR FROMRGB( 240, 240, 20 ) #define CURR_BREATH_BAR_SHADOW FROMRGB( 8, 12, 118 ) // the MAX max breatth, always at 100% #define CURR_BREATH_BAR FROMRGB( 8, 12, 160 ) -#define CURR_MAX_BREATH FROMRGB( 0, 0, 0 ) // the current max breath, black -#define CURR_MAX_BREATH_SHADOW FROMRGB( 0, 0, 0 ) +#define CURR_MAX_BREATH FROMRGB( 0, 0, 0 ) // the current max breath, black +#define CURR_MAX_BREATH_SHADOW FROMRGB( 0, 0, 0 ) #define MORALE_BAR_SHADOW FROMRGB( 8, 112, 12 ) #define MORALE_BAR FROMRGB( 8, 180, 12 ) #define BREATH_BAR_SHADOW FROMRGB( 60, 108, 108 ) // the lt blue current breath @@ -73,7 +73,7 @@ STR pbCarPortraitFileNames[ ]={ BOOLEAN LoadCarPortraitValues( void ) { INT32 iCounter = 0; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; if( giCarPortraits[ 0 ] != -1 ) { @@ -110,13 +110,13 @@ void UnLoadCarPortraits( void ) void DrawLifeUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 sWidth, INT16 sHeight, BOOLEAN fErase, UINT32 uiBuffer ) { - FLOAT dStart, dEnd, dPercentage; - //UINT16 usLineColor; + FLOAT dStart, dEnd, dPercentage; + //UINT16 usLineColor; - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; - UINT16 usLineColor; - INT8 bBandage; + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; + UINT16 usLineColor; + INT8 bBandage; // Erase what was there if( fErase ) @@ -124,34 +124,34 @@ void DrawLifeUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 sWi RestoreExternBackgroundRect( sXPos, (INT16)(sYPos - sHeight), sWidth, (INT16)(sHeight + 1 ) ); } - if( pSoldier->bLife == 0 ) + if( pSoldier->stats.bLife == 0 ) { // are they dead? return; } - pDestBuf = LockVideoSurface( uiBuffer, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( uiBuffer, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); // FIRST DO MAX LIFE - dPercentage = (FLOAT)pSoldier->bLife / (FLOAT)100; + dPercentage = (FLOAT)pSoldier->stats.bLife / (FLOAT)100; dEnd = dPercentage * sHeight; dStart = sYPos; usLineColor = Get16BPPColor( LIFE_BAR_SHADOW ); - RectangleDraw( TRUE, sXPos, (INT32)dStart, sXPos, (INT32)( dStart - dEnd ) , usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos, (INT32)dStart, sXPos, (INT32)( dStart - dEnd ) , usLineColor, pDestBuf ); usLineColor = Get16BPPColor( LIFE_BAR ); - RectangleDraw( TRUE, sXPos+ 1, (INT32)dStart, sXPos + 1, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos+ 1, (INT32)dStart, sXPos + 1, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); usLineColor = Get16BPPColor( LIFE_BAR_SHADOW ); - RectangleDraw( TRUE, sXPos+ 2, (INT32)dStart, sXPos + 2, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos+ 2, (INT32)dStart, sXPos + 2, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); // NOW DO BANDAGE // Calculate bandage - bBandage = pSoldier->bLifeMax - pSoldier->bLife - pSoldier->bBleeding; + bBandage = pSoldier->stats.bLifeMax - pSoldier->stats.bLife - pSoldier->bBleeding; if ( bBandage ) { @@ -160,13 +160,13 @@ void DrawLifeUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 sWi dEnd = ( dPercentage * sHeight ); usLineColor = Get16BPPColor( BANDAGE_BAR_SHADOW ); - RectangleDraw( TRUE, sXPos, (INT32)dStart, sXPos, (INT32)( dStart - dEnd ) , usLineColor, pDestBuf ); - + RectangleDraw( TRUE, sXPos, (INT32)dStart, sXPos, (INT32)( dStart - dEnd ) , usLineColor, pDestBuf ); + usLineColor = Get16BPPColor( BANDAGE_BAR ); - RectangleDraw( TRUE, sXPos+ 1, (INT32)dStart, sXPos + 1, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos+ 1, (INT32)dStart, sXPos + 1, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); usLineColor = Get16BPPColor( BANDAGE_BAR_SHADOW ); - RectangleDraw( TRUE, sXPos+ 2, (INT32)dStart, sXPos + 2, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos+ 2, (INT32)dStart, sXPos + 2, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); } // NOW DO BLEEDING @@ -177,15 +177,15 @@ void DrawLifeUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 sWi dEnd = ( dPercentage * sHeight ); usLineColor = Get16BPPColor( BLEEDING_BAR_SHADOW ); - RectangleDraw( TRUE, sXPos, (INT32)dStart, sXPos, (INT32)( dStart - dEnd ) , usLineColor, pDestBuf ); - + RectangleDraw( TRUE, sXPos, (INT32)dStart, sXPos, (INT32)( dStart - dEnd ) , usLineColor, pDestBuf ); + usLineColor = Get16BPPColor( BLEEDING_BAR ); - RectangleDraw( TRUE, sXPos+ 1, (INT32)dStart, sXPos + 1, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos+ 1, (INT32)dStart, sXPos + 1, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); usLineColor = Get16BPPColor( BLEEDING_BAR_SHADOW ); - RectangleDraw( TRUE, sXPos+ 2, (INT32)dStart, sXPos + 2, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos+ 2, (INT32)dStart, sXPos + 2, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); } - + UnLockVideoSurface( uiBuffer ); } @@ -193,12 +193,12 @@ void DrawLifeUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 sWi void DrawBreathUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 sWidth, INT16 sHeight, BOOLEAN fErase, UINT32 uiBuffer ) { - FLOAT dStart, dEnd, dPercentage; - //UINT16 usLineColor; + FLOAT dStart, dEnd, dPercentage; + //UINT16 usLineColor; - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; - UINT16 usLineColor; + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; + UINT16 usLineColor; HVOBJECT hHandle; // Erase what was there @@ -207,15 +207,15 @@ void DrawBreathUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 s RestoreExternBackgroundRect( sXPos, (INT16)(sYPos - sHeight), sWidth, (INT16)(sHeight + 1 ) ); } - if( pSoldier->bLife == 0 ) + if( pSoldier->stats.bLife == 0 ) { // are they dead? return; } - - // DO MAX MAX BREATH + + // DO MAX MAX BREATH dPercentage = 1.; dEnd = dPercentage * sHeight; dStart = sYPos; @@ -229,24 +229,24 @@ void DrawBreathUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 s if( gusSelectedSoldier == pSoldier->ubID && gTacticalStatus.ubCurrentTeam == OUR_TEAM && OK_INTERRUPT_MERC( pSoldier ) ) { // gold, the second entry in the .sti - BltVideoObject( uiBuffer , hHandle, 1, sXPos, ( INT16 )( sYPos - sHeight ), VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( uiBuffer , hHandle, 1, sXPos, ( INT16 )( sYPos - sHeight ), VO_BLT_SRCTRANSPARENCY, NULL ); } else { // brown, first entry - BltVideoObject( uiBuffer , hHandle, 0, sXPos, ( INT16 )( sYPos - sHeight ), VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( uiBuffer , hHandle, 0, sXPos, ( INT16 )( sYPos - sHeight ), VO_BLT_SRCTRANSPARENCY, NULL ); } } else { // brown, first entry - BltVideoObject( uiBuffer , hHandle, 0, sXPos, ( INT16 )( sYPos - sHeight ), VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( uiBuffer , hHandle, 0, sXPos, ( INT16 )( sYPos - sHeight ), VO_BLT_SRCTRANSPARENCY, NULL ); } - pDestBuf = LockVideoSurface( uiBuffer, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( uiBuffer, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); if( pSoldier->bBreathMax <= 97 ) @@ -257,15 +257,15 @@ void DrawBreathUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 s // the old background colors for breath max diff usLineColor = Get16BPPColor( BREATH_BAR_SHAD_BACK ); - RectangleDraw( TRUE, sXPos, (INT32)dStart, sXPos, (INT32)( dStart - dEnd ) , usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos, (INT32)dStart, sXPos, (INT32)( dStart - dEnd ) , usLineColor, pDestBuf ); usLineColor = Get16BPPColor( BREATH_BAR_SHAD_BACK ); - RectangleDraw( TRUE, sXPos+ 1, (INT32)dStart, sXPos + 1, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos+ 1, (INT32)dStart, sXPos + 1, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); usLineColor = Get16BPPColor( BREATH_BAR_SHAD_BACK ); - RectangleDraw( TRUE, sXPos+ 2, (INT32)dStart, sXPos + 2, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos+ 2, (INT32)dStart, sXPos + 2, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); } - + @@ -274,13 +274,13 @@ void DrawBreathUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 s dStart = sYPos; usLineColor = Get16BPPColor( CURR_MAX_BREATH_SHADOW ); - RectangleDraw( TRUE, sXPos, (INT32)dStart, sXPos, (INT32)( dStart - dEnd ) , usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos, (INT32)dStart, sXPos, (INT32)( dStart - dEnd ) , usLineColor, pDestBuf ); usLineColor = Get16BPPColor( CURR_MAX_BREATH ); - RectangleDraw( TRUE, sXPos+ 1, (INT32)dStart, sXPos + 1, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos+ 1, (INT32)dStart, sXPos + 1, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); usLineColor = Get16BPPColor( CURR_MAX_BREATH_SHADOW ); - RectangleDraw( TRUE, sXPos+ 2, (INT32)dStart, sXPos + 2, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos+ 2, (INT32)dStart, sXPos + 2, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); // NOW DO BREATH @@ -289,27 +289,27 @@ void DrawBreathUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 s dStart = sYPos; usLineColor = Get16BPPColor( CURR_BREATH_BAR_SHADOW ); - RectangleDraw( TRUE, sXPos, (INT32)dStart, sXPos, (INT32)( dStart - dEnd ) , usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos, (INT32)dStart, sXPos, (INT32)( dStart - dEnd ) , usLineColor, pDestBuf ); usLineColor = Get16BPPColor( CURR_BREATH_BAR ); - RectangleDraw( TRUE, sXPos+ 1, (INT32)dStart, sXPos + 1, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos+ 1, (INT32)dStart, sXPos + 1, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); usLineColor = Get16BPPColor( CURR_BREATH_BAR_SHADOW ); - RectangleDraw( TRUE, sXPos+ 2, (INT32)dStart, sXPos + 2, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos+ 2, (INT32)dStart, sXPos + 2, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); + - UnLockVideoSurface( uiBuffer ); } void DrawMoraleUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 sWidth, INT16 sHeight, BOOLEAN fErase, UINT32 uiBuffer ) { - FLOAT dStart, dEnd, dPercentage; - //UINT16 usLineColor; + FLOAT dStart, dEnd, dPercentage; + //UINT16 usLineColor; - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; - UINT16 usLineColor; + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; + UINT16 usLineColor; // Erase what was there if ( fErase ) @@ -317,66 +317,75 @@ void DrawMoraleUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 s RestoreExternBackgroundRect( sXPos, (INT16)(sYPos - sHeight), sWidth, (INT16)(sHeight + 1 ) ); } - if( pSoldier->bLife == 0 ) + if( pSoldier->stats.bLife == 0 ) { // are they dead? return; } - pDestBuf = LockVideoSurface( uiBuffer, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( uiBuffer, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); // FIRST DO BREATH - dPercentage = (FLOAT)pSoldier->bMorale / (FLOAT)100; + dPercentage = (FLOAT)pSoldier->aiData.bMorale / (FLOAT)100; dEnd = dPercentage * sHeight; dStart = sYPos; usLineColor = Get16BPPColor( MORALE_BAR_SHADOW ); - RectangleDraw( TRUE, sXPos, (INT32)dStart, sXPos, (INT32)( dStart - dEnd ) , usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos, (INT32)dStart, sXPos, (INT32)( dStart - dEnd ) , usLineColor, pDestBuf ); usLineColor = Get16BPPColor( MORALE_BAR ); - RectangleDraw( TRUE, sXPos+ 1, (INT32)dStart, sXPos + 1, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos+ 1, (INT32)dStart, sXPos + 1, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); usLineColor = Get16BPPColor( MORALE_BAR_SHADOW ); - RectangleDraw( TRUE, sXPos+ 2, (INT32)dStart, sXPos + 2, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos+ 2, (INT32)dStart, sXPos + 2, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); + - UnLockVideoSurface( uiBuffer ); } -void DrawItemUIBarEx( OBJECTTYPE *pObject, UINT8 ubStatus, INT16 sXPos, INT16 sYPos, INT16 sWidth, INT16 sHeight, INT16 sColor1, INT16 sColor2, BOOLEAN fErase, UINT32 uiBuffer ) +void DrawItemUIBarEx( OBJECTTYPE *pObject, UINT8 ubStatus, INT16 sXPos, INT16 sYPos, INT16 sWidth, INT16 sHeight, INT16 sColor1, INT16 sColor2, BOOLEAN fErase, UINT32 uiBuffer, UINT8 iter ) { - FLOAT dStart, dEnd, dPercentage; - //UINT16 usLineColor; + FLOAT dStart, dEnd, dPercentage; + //UINT16 usLineColor; + + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; + UINT16 usLineColor; + INT16 sValue; - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; - UINT16 usLineColor; - INT16 sValue; - if ( ubStatus >= DRAW_ITEM_STATUS_ATTACHMENT1 ) { - sValue = pObject->bAttachStatus[ ubStatus - DRAW_ITEM_STATUS_ATTACHMENT1 ]; + sValue = 0; + OBJECTTYPE* pAttachment = (*pObject)[iter]->GetAttachmentAtIndex( ubStatus - DRAW_ITEM_STATUS_ATTACHMENT1 ); + if (pAttachment) { + sValue = (*pAttachment)[iter]->data.objectStatus; + } } else { - sValue = pObject->ItemData.Generic.bStatus[ ubStatus ]; + if (ubStatus < pObject->ubNumberOfObjects) { + sValue = (*pObject)[ ubStatus ]->data.objectStatus; + } + else { + sValue = 0; + } } // Adjust for ammo, other thingys.. if( Item[ pObject->usItem ].usItemClass & IC_AMMO ) { - + sValue = sValue * 100 / Magazine[ Item[ pObject->usItem ].ubClassIndex ].ubMagSize; if ( sValue < 0 ) { - sValue = pObject->ItemData.Ammo.ubShotsLeft[0] * 100 / Magazine[ Item[ pObject->usItem ].ubClassIndex ].ubMagSize; - DebugMsg ( TOPIC_JA2, DBG_LEVEL_3, String("Ammo status: shots left %d * 100 / Mag Size %d = value %d",pObject->ubShotsLeft[0],Magazine[ Item[ pObject->usItem ].ubClassIndex ].ubMagSize,sValue )); + sValue = (*pObject)[iter]->data.ubShotsLeft * 100 / Magazine[ Item[ pObject->usItem ].ubClassIndex ].ubMagSize; + DebugMsg ( TOPIC_JA2, DBG_LEVEL_3, String("Ammo status: shots left %d * 100 / Mag Size %d = value %d",(*pObject)[iter]->data.ubShotsLeft,Magazine[ Item[ pObject->usItem ].ubClassIndex ].ubMagSize,sValue )); } if ( sValue > 100 ) { @@ -390,11 +399,11 @@ void DrawItemUIBarEx( OBJECTTYPE *pObject, UINT8 ubStatus, INT16 sXPos, INT16 sY sValue =100; } - // ATE: Subtract 1 to exagerate bad status - if ( sValue < 100 && sValue > 1 ) - { - sValue--; - } + // ATE: Subtract 1 to exagerate bad status + if ( sValue < 100 && sValue > 1 ) + { + sValue--; + } // Erase what was there if ( fErase ) @@ -402,7 +411,7 @@ void DrawItemUIBarEx( OBJECTTYPE *pObject, UINT8 ubStatus, INT16 sXPos, INT16 sY //RestoreExternBackgroundRect( sXPos, (INT16)(sYPos - sHeight), sWidth, (INT16)(sHeight + 1 ) ); } - pDestBuf = LockVideoSurface( uiBuffer, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( uiBuffer, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); @@ -413,12 +422,12 @@ void DrawItemUIBarEx( OBJECTTYPE *pObject, UINT8 ubStatus, INT16 sXPos, INT16 sY //usLineColor = Get16BPPColor( STATUS_BAR ); usLineColor = sColor1; - RectangleDraw( TRUE, sXPos, (INT32)dStart, sXPos, (INT32)( dStart - dEnd ) , usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos, (INT32)dStart, sXPos, (INT32)( dStart - dEnd ) , usLineColor, pDestBuf ); usLineColor = sColor2; - RectangleDraw( TRUE, sXPos+ 1, (INT32)dStart, sXPos + 1, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos+ 1, (INT32)dStart, sXPos + 1, (INT32)( dStart - dEnd ), usLineColor, pDestBuf ); + - UnLockVideoSurface( uiBuffer ); if ( uiBuffer == guiSAVEBUFFER ) @@ -435,14 +444,13 @@ void DrawItemUIBarEx( OBJECTTYPE *pObject, UINT8 ubStatus, INT16 sXPos, INT16 sY void RenderSoldierFace( SOLDIERTYPE *pSoldier, INT16 sFaceX, INT16 sFaceY, BOOLEAN fAutoFace ) { BOOLEAN fDoFace = FALSE; - INT32 iFaceIndex = -1; UINT8 ubVehicleType = 0; if ( pSoldier->bActive ) { - if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // get the type of vehicle ubVehicleType = pVehicleList[ pSoldier->bVehicleID ].ubVehicleType; @@ -461,7 +469,7 @@ void RenderSoldierFace( SOLDIERTYPE *pSoldier, INT16 sFaceX, INT16 sFaceY, BOOLE { // Render as an extern face... fAutoFace = FALSE; - } + } else { SetAutoFaceActiveFromSoldier( FRAME_BUFFER, guiSAVEBUFFER, pSoldier->ubID , sFaceX, sFaceY ); diff --git a/Tactical/Interface Utils.h b/Tactical/Interface Utils.h index 992bedfd..f4946b2b 100644 --- a/Tactical/Interface Utils.h +++ b/Tactical/Interface Utils.h @@ -12,7 +12,7 @@ void DrawMoraleUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 s void DrawBreathUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 sWidth, INT16 sHeight, BOOLEAN fErase, UINT32 uiBuffer ); void DrawLifeUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 sWidth, INT16 sHeight, BOOLEAN fErase, UINT32 uiBuffer ); -void DrawItemUIBarEx( OBJECTTYPE *pObject, UINT8 ubStatus, INT16 sXPos, INT16 sYPos, INT16 sWidth, INT16 sHeight, INT16 sColor1, INT16 sColor2, BOOLEAN fErase, UINT32 uiBuffer ); +void DrawItemUIBarEx( OBJECTTYPE *pObject, UINT8 ubStatus, INT16 sXPos, INT16 sYPos, INT16 sWidth, INT16 sHeight, INT16 sColor1, INT16 sColor2, BOOLEAN fErase, UINT32 uiBuffer, UINT8 iter = 0 ); void RenderSoldierFace( SOLDIERTYPE *pSoldier, INT16 sFaceX, INT16 sFaceY, BOOLEAN fAutoFace ); diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index 6c1416aa..c5c5eab9 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -4,8 +4,8 @@ #include "builddefines.h" #include #include - #include - #include "sgp.h" + #include + #include "sgp.h" #include "gameloop.h" #include "himage.h" #include "vobject.h" @@ -38,7 +38,7 @@ #include "Handle UI Plan.h" #include "interface control.h" #include "interface items.h" - #include "soldier profile.h" + #include "soldier profile.h" #include "MercTextBox.h" #include "soldier functions.h" #include "cursor control.h" @@ -88,9 +88,9 @@ INT32 giMenuAnchorX, giMenuAnchorY; #define PROG_BAR_START_X 5 #define PROG_BAR_START_Y 2 -BOOLEAN gfProgBarActive = FALSE; -UINT8 gubProgNumEnemies = 0; -UINT8 gubProgCurEnemy = 0; +BOOLEAN gfProgBarActive = FALSE; +UINT8 gubProgNumEnemies = 0; +UINT8 gubProgCurEnemy = 0; UINT32 guiPORTRAITICONS; @@ -102,7 +102,7 @@ typedef struct INT8 bCurrentMessage; UINT32 uiTimeOfLastUpdate; UINT32 uiTimeSinceLastBeep; - INT8 bAnimate; + INT8 bAnimate; INT8 bYPos; BOOLEAN fCreated; INT16 sWorldRenderX; @@ -122,7 +122,7 @@ extern UINT16 GetAnimStateForInteraction( SOLDIERTYPE *pSoldier, BOOLEAN fDoor, MOUSE_REGION gMenuOverlayRegion; -MOUSE_REGION gBottomPanalRegion; +MOUSE_REGION gBottomPanalRegion; UINT16 gusOldSelectedSoldier = NOBODY; @@ -168,7 +168,7 @@ typedef enum AIDACTIONC_IMAGES, PUNCHACTIONC_IMAGES, BOMBACTIONC_IMAGES, - + OPEN_DOOR_IMAGES, EXAMINE_DOOR_IMAGES, LOCKPICK_DOOR_IMAGES, @@ -225,6 +225,7 @@ UINT32 guiP1ITEMS; UINT32 guiP2ITEMS; UINT32 guiP3ITEMS; UINT32 guiBUTTONBORDER; +UINT32 guiSILHOUETTE; UINT32 guiRADIO; UINT32 guiRADIO2; UINT32 guiCOMPANEL; @@ -253,9 +254,9 @@ void DrawBarsInUIBox( SOLDIERTYPE *pSoldier , INT16 sXPos, INT16 sYPos, INT16 sW void PopupDoorOpenMenu( BOOLEAN fClosingDoor ); -BOOLEAN fFirstTimeInGameScreen = TRUE; -BOOLEAN fInterfacePanelDirty = DIRTYLEVEL2; -INT16 gsInterfaceLevel = I_GROUND_LEVEL; +BOOLEAN fFirstTimeInGameScreen = TRUE; +BOOLEAN fInterfacePanelDirty = DIRTYLEVEL2; +INT16 gsInterfaceLevel = I_GROUND_LEVEL; INT16 gsCurrentSoldierGridNo = 0; INT16 gsCurInterfacePanel = TEAM_PANEL; @@ -271,61 +272,57 @@ UINT32 CalcUIMessageDuration( STR16 wString ); -BOOLEAN InitializeTacticalInterface( ) +BOOLEAN InitializeTacticalInterface( ) { VSURFACE_DESC vs_desc; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; - INTERFACE_WIDTH = 640; - INTERFACE_HEIGHT = 120; - INV_INTERFACE_HEIGHT = 140; - - // centering panel disabled becouse keyring squad change and radar - // are not finished (no time) sorry - /* - if ( SCREEN_WIDTH > INTERFACE_WIDTH) - INTERFACE_START_X = (SCREEN_WIDTH - INTERFACE_WIDTH) / 2; + // CHRISL: Setup default interface coords based on inventory system in use + if((UsingNewInventorySystem() == true)) + { + InitNewInventorySystem(); + InitializeSMPanelCoordsNew(); + } else - */ - INTERFACE_START_X = 0; - INTERFACE_START_Y = ( SCREEN_HEIGHT - INTERFACE_HEIGHT ); - INV_INTERFACE_START_Y = ( SCREEN_HEIGHT - INV_INTERFACE_HEIGHT ); + { + InitOldInventorySystem(); + InitializeSMPanelCoordsOld(); + } -/* OK i need to initialize coords here - * Isnt it cool - * any questions? joker +/* OK i need to initialize coords here + * Isnt it cool + * any questions? joker */ InitializeViewPort( ); InitializeTEAMPanelCoords( ); - InitializeSMPanelCoords( ); // Load button Interfaces - iIconImages[ WALK_IMAGES ] = LoadButtonImage("INTERFACE\\newicons3.sti", -1,3,4,5,-1 ); - iIconImages[ SNEAK_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 6, 7, 8, -1 ); - iIconImages[ RUN_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 0, 1, 2, -1 ); - iIconImages[ CRAWL_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 9, 10, 11, -1 ); - iIconImages[ LOOK_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 12, 13, 14, -1 ); - iIconImages[ TALK_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 21, 22, 23, -1 ); - iIconImages[ HAND_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 18, 19, 20, -1 ); - iIconImages[ CANCEL_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 15, 16, 17, -1 ); + iIconImages[ WALK_IMAGES ] = LoadButtonImage("INTERFACE\\newicons3.sti", -1,3,4,5,-1 ); + iIconImages[ SNEAK_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 6, 7, 8, -1 ); + iIconImages[ RUN_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 0, 1, 2, -1 ); + iIconImages[ CRAWL_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 9, 10, 11, -1 ); + iIconImages[ LOOK_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 12, 13, 14, -1 ); + iIconImages[ TALK_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 21, 22, 23, -1 ); + iIconImages[ HAND_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 18, 19, 20, -1 ); + iIconImages[ CANCEL_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 15, 16, 17, -1 ); - iIconImages[ TARGETACTIONC_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 24, 25, 26, -1 ); - iIconImages[ KNIFEACTIONC_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 27, 28, 29, -1 ); - iIconImages[ AIDACTIONC_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 30, 31, 32, -1 ); - iIconImages[ PUNCHACTIONC_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 33, 34, 35, -1 ); - iIconImages[ BOMBACTIONC_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 36, 37, 38, -1 ); - iIconImages[ TOOLKITACTIONC_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 39, 40, 41, -1 ); - iIconImages[ WIRECUTACTIONC_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 42, 43, 44, -1 ); + iIconImages[ TARGETACTIONC_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 24, 25, 26, -1 ); + iIconImages[ KNIFEACTIONC_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 27, 28, 29, -1 ); + iIconImages[ AIDACTIONC_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 30, 31, 32, -1 ); + iIconImages[ PUNCHACTIONC_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 33, 34, 35, -1 ); + iIconImages[ BOMBACTIONC_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 36, 37, 38, -1 ); + iIconImages[ TOOLKITACTIONC_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 39, 40, 41, -1 ); + iIconImages[ WIRECUTACTIONC_IMAGES ] = UseLoadedButtonImage(iIconImages[ WALK_IMAGES ], -1, 42, 43, 44, -1 ); iIconImages[ OPEN_DOOR_IMAGES ] = LoadButtonImage("INTERFACE\\door_op2.sti", -1,9,10,11,-1 ); - iIconImages[ EXAMINE_DOOR_IMAGES ] = UseLoadedButtonImage(iIconImages[ OPEN_DOOR_IMAGES ], -1, 12, 13, 14, -1 ); - iIconImages[ LOCKPICK_DOOR_IMAGES ] = UseLoadedButtonImage(iIconImages[ OPEN_DOOR_IMAGES ], -1, 21, 22, 23, -1 ); - iIconImages[ BOOT_DOOR_IMAGES ] = UseLoadedButtonImage(iIconImages[ OPEN_DOOR_IMAGES ], -1, 25, 26, 27, -1 ); - iIconImages[ CROWBAR_DOOR_IMAGES ] = UseLoadedButtonImage(iIconImages[ OPEN_DOOR_IMAGES ], -1, 0, 1, 2, -1 ); - iIconImages[ USE_KEY_IMAGES ] = UseLoadedButtonImage(iIconImages[ OPEN_DOOR_IMAGES ], -1, 3, 4, 5, -1 ); - iIconImages[ USE_KEYRING_IMAGES ] = UseLoadedButtonImage(iIconImages[ OPEN_DOOR_IMAGES ], -1, 6, 7, 8, -1 ); - iIconImages[ EXPLOSIVE_DOOR_IMAGES ] = UseLoadedButtonImage(iIconImages[ OPEN_DOOR_IMAGES ], -1, 15, 16, 17, -1 ); - + iIconImages[ EXAMINE_DOOR_IMAGES ] = UseLoadedButtonImage(iIconImages[ OPEN_DOOR_IMAGES ], -1, 12, 13, 14, -1 ); + iIconImages[ LOCKPICK_DOOR_IMAGES ] = UseLoadedButtonImage(iIconImages[ OPEN_DOOR_IMAGES ], -1, 21, 22, 23, -1 ); + iIconImages[ BOOT_DOOR_IMAGES ] = UseLoadedButtonImage(iIconImages[ OPEN_DOOR_IMAGES ], -1, 25, 26, 27, -1 ); + iIconImages[ CROWBAR_DOOR_IMAGES ] = UseLoadedButtonImage(iIconImages[ OPEN_DOOR_IMAGES ], -1, 0, 1, 2, -1 ); + iIconImages[ USE_KEY_IMAGES ] = UseLoadedButtonImage(iIconImages[ OPEN_DOOR_IMAGES ], -1, 3, 4, 5, -1 ); + iIconImages[ USE_KEYRING_IMAGES ] = UseLoadedButtonImage(iIconImages[ OPEN_DOOR_IMAGES ], -1, 6, 7, 8, -1 ); + iIconImages[ EXPLOSIVE_DOOR_IMAGES ] = UseLoadedButtonImage(iIconImages[ OPEN_DOOR_IMAGES ], -1, 15, 16, 17, -1 ); + // Load interface panels vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; @@ -387,6 +384,13 @@ BOOLEAN InitializeTacticalInterface( ) if( !AddVideoObject( &VObjectDesc, &guiP3ITEMS ) ) AssertMsg(0, "Missing INTERFACE\\mdp3items.sti" ); + // CHRISL: + // LOAD INTERFACE POCKET SILHOUETTES + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\Silhouettes.sti", VObjectDesc.ImageFile); + if( !AddVideoObject( &VObjectDesc, &guiSILHOUETTE ) ) + AssertMsg(0, "Missing INTERFACE\\Silhouettes.sti" ); + // LOAD INTERFACE BUTTON BORDER VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; FilenameForBPP("INTERFACE\\button_frame.sti", VObjectDesc.ImageFile); @@ -451,12 +455,12 @@ BOOLEAN InitializeTacticalInterface( ) if( !AddVideoObject( &VObjectDesc, &guiITEMPOINTERHATCHES ) ) AssertMsg(0, "Missing INTERFACE\\itemgrid.sti" ); - + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; FilenameForBPP("INTERFACE\\communicationpopup_2.sti", VObjectDesc.ImageFile); if( !AddVideoObject( &VObjectDesc, &guiCOMPANELB ) ) AssertMsg(0, "Missing INTERFACE\\communicationpopup_2.sti" ); - + // Alocate message surfaces vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE; @@ -464,7 +468,7 @@ BOOLEAN InitializeTacticalInterface( ) vs_desc.usHeight = 20; vs_desc.ubBitDepth = 16; CHECKF( AddVideoSurface( &vs_desc, &(gTopMessage.uiSurface) ) ); - + InitItemInterface( ); @@ -496,7 +500,7 @@ BOOLEAN InitializeCurrentPanel( ) { case SM_PANEL: // Set new viewport - gsVIEWPORT_WINDOW_END_Y = INV_INTERFACE_START_Y; + gsVIEWPORT_WINDOW_END_Y = INV_INTERFACE_START_Y; // Render full SetRenderFlags(RENDER_FLAG_FULL); @@ -514,7 +518,7 @@ BOOLEAN InitializeCurrentPanel( ) // RefreshMouseRegions( ); gfPanelAllocated = TRUE; - return( fOK ); + return( fOK ); } void ShutdownCurrentPanel( ) @@ -607,7 +611,7 @@ void SetCurrentInterfacePanel( UINT8 ubNewPanel ) void ToggleTacticalPanels( ) { gfSwitchPanel = TRUE; - gubNewPanelParam = (UINT8)gusSelectedSoldier; + gubNewPanelParam = (UINT8)gusSelectedSoldier; if ( gsCurInterfacePanel == SM_PANEL ) { @@ -707,7 +711,7 @@ void PopupMovementMenu( UI_EVENT *pUIEvent ) // Create mouse region over all area to facilitate clicking to end MSYS_DefineRegion( &gMenuOverlayRegion, 0, 0 ,SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST-1, - CURSOR_NORMAL, MSYS_NO_CALLBACK, MovementMenuBackregionCallback ); + CURSOR_NORMAL, MSYS_NO_CALLBACK, MovementMenuBackregionCallback ); // Add region MSYS_AddRegion( &gMenuOverlayRegion); @@ -747,14 +751,14 @@ void PopupMovementMenu( UI_EVENT *pUIEvent ) //SetButtonSavedRect( iActionIcons[ RUN_ICON ] ); ButtonList[ iActionIcons[ RUN_ICON ] ]->UserData[0] = (UINT32)pUIEvent; - if ( MercInWater( pSoldier ) || ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) || ( pSoldier->uiStatusFlags & SOLDIER_ROBOT ) ) + if ( pSoldier->MercInWater( ) || ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) || ( pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) ) { DisableButton( iActionIcons[ RUN_ICON ] ); } - iActionIcons[ WALK_ICON ] = QuickCreateButton( iIconImages[ WALK_IMAGES ], (INT16)(iMenuAnchorX + 40 ), (INT16)(iMenuAnchorY ), + iActionIcons[ WALK_ICON ] = QuickCreateButton( iIconImages[ WALK_IMAGES ], (INT16)(iMenuAnchorX + 40 ), (INT16)(iMenuAnchorY ), BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)BtnMovementCallback ); + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)BtnMovementCallback ); if ( iActionIcons[ WALK_ICON ] == -1 ) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Cannot create Interface button" ); @@ -762,7 +766,7 @@ void PopupMovementMenu( UI_EVENT *pUIEvent ) } //SetButtonSavedRect( iActionIcons[ WALK_ICON ] ); - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { SetButtonFastHelpText( iActionIcons[ WALK_ICON ], TacticalStr[ DRIVE_POPUPTEXT ] ); } @@ -773,9 +777,9 @@ void PopupMovementMenu( UI_EVENT *pUIEvent ) ButtonList[ iActionIcons[ WALK_ICON ] ]->UserData[0] = (UINT32)pUIEvent; - if ( pSoldier->uiStatusFlags & SOLDIER_ROBOT ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) { - if ( !CanRobotBeControlled( pSoldier ) ) + if ( !pSoldier->CanRobotBeControlled( ) ) { DisableButton( iActionIcons[ WALK_ICON ] ); } @@ -797,7 +801,7 @@ void PopupMovementMenu( UI_EVENT *pUIEvent ) // Check if this is a valid stance, diable if not! if ( !IsValidStance( pSoldier, ANIM_CROUCH ) ) { - DisableButton( iActionIcons[ SNEAK_ICON ] ); + DisableButton( iActionIcons[ SNEAK_ICON ] ); } iActionIcons[ CRAWL_ICON ] = QuickCreateButton( iIconImages[ CRAWL_IMAGES ], (INT16)(iMenuAnchorX + 40 ), (INT16)(iMenuAnchorY + 40 ), @@ -815,7 +819,7 @@ void PopupMovementMenu( UI_EVENT *pUIEvent ) // Check if this is a valid stance, diable if not! if ( !IsValidStance( pSoldier, ANIM_PRONE ) ) { - DisableButton( iActionIcons[ CRAWL_ICON ] ); + DisableButton( iActionIcons[ CRAWL_ICON ] ); } @@ -831,20 +835,20 @@ void PopupMovementMenu( UI_EVENT *pUIEvent ) //SetButtonSavedRect( iActionIcons[ LOOK_ICON ] ); ButtonList[ iActionIcons[ LOOK_ICON ] ]->UserData[0] = (UINT32)pUIEvent; - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { - DisableButton( iActionIcons[ LOOK_ICON ] ); + DisableButton( iActionIcons[ LOOK_ICON ] ); } - if ( pSoldier->uiStatusFlags & SOLDIER_ROBOT ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) { - if ( !CanRobotBeControlled( pSoldier ) ) + if ( !pSoldier->CanRobotBeControlled( ) ) { DisableButton( iActionIcons[ LOOK_ICON ] ); } } - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // Until we get mounted weapons... uiActionImages = CANCEL_IMAGES; @@ -914,7 +918,7 @@ void PopupMovementMenu( UI_EVENT *pUIEvent ) fDisableAction = TRUE; } - iActionIcons[ ACTIONC_ICON ] = QuickCreateButton( iIconImages[ uiActionImages ], (INT16)(iMenuAnchorX ), (INT16)(iMenuAnchorY + 20 ), + iActionIcons[ ACTIONC_ICON ] = QuickCreateButton( iIconImages[ uiActionImages ], (INT16)(iMenuAnchorX ), (INT16)(iMenuAnchorY + 20 ), BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)BtnMovementCallback ); if ( iActionIcons[ ACTIONC_ICON ] == -1 ) @@ -928,11 +932,11 @@ void PopupMovementMenu( UI_EVENT *pUIEvent ) if ( fDisableAction ) { - DisableButton( iActionIcons[ ACTIONC_ICON ] ); + DisableButton( iActionIcons[ ACTIONC_ICON ] ); } - iActionIcons[ TALK_ICON ] = QuickCreateButton( iIconImages[ TALK_IMAGES ], (INT16)(iMenuAnchorX ), (INT16)(iMenuAnchorY + 40 ), + iActionIcons[ TALK_ICON ] = QuickCreateButton( iIconImages[ TALK_IMAGES ], (INT16)(iMenuAnchorX ), (INT16)(iMenuAnchorY + 40 ), BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)BtnMovementCallback ); if ( iActionIcons[ TALK_ICON ] == -1 ) @@ -944,13 +948,13 @@ void PopupMovementMenu( UI_EVENT *pUIEvent ) SetButtonFastHelpText( iActionIcons[ TALK_ICON ], pTacticalPopupButtonStrings[ TALK_ICON ] ); ButtonList[ iActionIcons[ TALK_ICON ] ]->UserData[0] = (UINT32)pUIEvent; - if ( AM_AN_EPC( pSoldier ) || ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( AM_AN_EPC( pSoldier ) || ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { - DisableButton( iActionIcons[ TALK_ICON ] ); + DisableButton( iActionIcons[ TALK_ICON ] ); } - iActionIcons[ HAND_ICON ] = QuickCreateButton( iIconImages[ HAND_IMAGES ], (INT16)(iMenuAnchorX + 20 ), (INT16)(iMenuAnchorY + 40 ), + iActionIcons[ HAND_ICON ] = QuickCreateButton( iIconImages[ HAND_IMAGES ], (INT16)(iMenuAnchorX + 20 ), (INT16)(iMenuAnchorY + 40 ), BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)BtnMovementCallback ); if ( iActionIcons[ HAND_ICON ] == -1 ) @@ -962,12 +966,12 @@ void PopupMovementMenu( UI_EVENT *pUIEvent ) SetButtonFastHelpText( iActionIcons[ HAND_ICON ], pTacticalPopupButtonStrings[ HAND_ICON ] ); ButtonList[ iActionIcons[ HAND_ICON ] ]->UserData[0] = (UINT32)pUIEvent; - if ( AM_AN_EPC( pSoldier ) || ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( AM_AN_EPC( pSoldier ) || ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { - DisableButton( iActionIcons[ HAND_ICON ] ); + DisableButton( iActionIcons[ HAND_ICON ] ); } - iActionIcons[ CANCEL_ICON ] = QuickCreateButton( iIconImages[ CANCEL_IMAGES ], (INT16)(iMenuAnchorX + 20 ), (INT16)(iMenuAnchorY + 20 ), + iActionIcons[ CANCEL_ICON ] = QuickCreateButton( iIconImages[ CANCEL_IMAGES ], (INT16)(iMenuAnchorX + 20 ), (INT16)(iMenuAnchorY + 20 ), BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)BtnMovementCallback ); if ( iActionIcons[ CANCEL_ICON ] == -1 ) @@ -992,15 +996,15 @@ void PopDownMovementMenu( ) { if ( gfInMovementMenu ) { - RemoveButton( iActionIcons[ WALK_ICON ] ); - RemoveButton( iActionIcons[ SNEAK_ICON ] ); - RemoveButton( iActionIcons[ RUN_ICON ] ); - RemoveButton( iActionIcons[ CRAWL_ICON ] ); - RemoveButton( iActionIcons[ LOOK_ICON ] ); - RemoveButton( iActionIcons[ ACTIONC_ICON ] ); - RemoveButton( iActionIcons[ TALK_ICON ] ); - RemoveButton( iActionIcons[ HAND_ICON ] ); - RemoveButton( iActionIcons[ CANCEL_ICON ] ); + RemoveButton( iActionIcons[ WALK_ICON ] ); + RemoveButton( iActionIcons[ SNEAK_ICON ] ); + RemoveButton( iActionIcons[ RUN_ICON ] ); + RemoveButton( iActionIcons[ CRAWL_ICON ] ); + RemoveButton( iActionIcons[ LOOK_ICON ] ); + RemoveButton( iActionIcons[ ACTIONC_ICON ] ); + RemoveButton( iActionIcons[ TALK_ICON ] ); + RemoveButton( iActionIcons[ HAND_ICON ] ); + RemoveButton( iActionIcons[ CANCEL_ICON ] ); // Turn off Ignore scrolling gfIgnoreScrolling = FALSE; @@ -1024,17 +1028,17 @@ void RenderMovementMenu( ) if ( gfInMovementMenu ) { BltVideoObjectFromIndex( FRAME_BUFFER, guiBUTTONBORDER, 0, giMenuAnchorX, giMenuAnchorY, VO_BLT_SRCTRANSPARENCY, NULL ); - + // Mark buttons dirty! - MarkAButtonDirty( iActionIcons[ WALK_ICON ] ); - MarkAButtonDirty( iActionIcons[ SNEAK_ICON ] ); - MarkAButtonDirty( iActionIcons[ RUN_ICON ] ); - MarkAButtonDirty( iActionIcons[ CRAWL_ICON ] ); - MarkAButtonDirty( iActionIcons[ LOOK_ICON ] ); - MarkAButtonDirty( iActionIcons[ ACTIONC_ICON ] ); - MarkAButtonDirty( iActionIcons[ TALK_ICON ] ); - MarkAButtonDirty( iActionIcons[ HAND_ICON ] ); - MarkAButtonDirty( iActionIcons[ CANCEL_ICON ] ); + MarkAButtonDirty( iActionIcons[ WALK_ICON ] ); + MarkAButtonDirty( iActionIcons[ SNEAK_ICON ] ); + MarkAButtonDirty( iActionIcons[ RUN_ICON ] ); + MarkAButtonDirty( iActionIcons[ CRAWL_ICON ] ); + MarkAButtonDirty( iActionIcons[ LOOK_ICON ] ); + MarkAButtonDirty( iActionIcons[ ACTIONC_ICON ] ); + MarkAButtonDirty( iActionIcons[ TALK_ICON ] ); + MarkAButtonDirty( iActionIcons[ HAND_ICON ] ); + MarkAButtonDirty( iActionIcons[ CANCEL_ICON ] ); InvalidateRegion( giMenuAnchorX, giMenuAnchorY, giMenuAnchorX + BUTTON_PANEL_WIDTH, giMenuAnchorY + BUTTON_PANEL_HEIGHT ); @@ -1045,7 +1049,7 @@ void CancelMovementMenu( ) { // Signal end of event PopDownMovementMenu( ); - guiPendingOverrideEvent = A_CHANGE_TO_MOVE; + guiPendingOverrideEvent = A_CHANGE_TO_MOVE; } void BtnMovementCallback(GUI_BUTTON *btn,INT32 reason) @@ -1061,39 +1065,39 @@ void BtnMovementCallback(GUI_BUTTON *btn,INT32 reason) pUIEvent = (UI_EVENT*)( btn->UserData[0] ); - if ( uiBtnID == iActionIcons[ WALK_ICON ] ) + if ( uiBtnID == iActionIcons[ WALK_ICON ] ) { pUIEvent->uiParams[0] = MOVEMENT_MENU_WALK; } - else if ( uiBtnID == iActionIcons[ RUN_ICON ] ) + else if ( uiBtnID == iActionIcons[ RUN_ICON ] ) { pUIEvent->uiParams[0] = MOVEMENT_MENU_RUN; } - else if ( uiBtnID == iActionIcons[ SNEAK_ICON ] ) + else if ( uiBtnID == iActionIcons[ SNEAK_ICON ] ) { pUIEvent->uiParams[0] = MOVEMENT_MENU_SWAT; } - else if ( uiBtnID == iActionIcons[ CRAWL_ICON ] ) + else if ( uiBtnID == iActionIcons[ CRAWL_ICON ] ) { pUIEvent->uiParams[0] = MOVEMENT_MENU_PRONE; } - else if ( uiBtnID == iActionIcons[ LOOK_ICON ] ) + else if ( uiBtnID == iActionIcons[ LOOK_ICON ] ) { pUIEvent->uiParams[2] = MOVEMENT_MENU_LOOK; } - else if ( uiBtnID == iActionIcons[ ACTIONC_ICON ] ) + else if ( uiBtnID == iActionIcons[ ACTIONC_ICON ] ) { pUIEvent->uiParams[2] = MOVEMENT_MENU_ACTIONC; } - else if ( uiBtnID == iActionIcons[ TALK_ICON ] ) + else if ( uiBtnID == iActionIcons[ TALK_ICON ] ) { pUIEvent->uiParams[2] = MOVEMENT_MENU_TALK; } - else if ( uiBtnID == iActionIcons[ HAND_ICON ] ) + else if ( uiBtnID == iActionIcons[ HAND_ICON ] ) { pUIEvent->uiParams[2] = MOVEMENT_MENU_HAND; } - else if ( uiBtnID == iActionIcons[ CANCEL_ICON ] ) + else if ( uiBtnID == iActionIcons[ CANCEL_ICON ] ) { // Signal end of event EndMenuEvent( U_MOVEMENT_MENU ); @@ -1115,7 +1119,7 @@ void BtnMovementCallback(GUI_BUTTON *btn,INT32 reason) void HandleUpDownArrowBackgrounds( ) { - static UINT32 uiOldShowUpDownArrows = ARROWS_HIDE_UP | ARROWS_HIDE_DOWN; + static UINT32 uiOldShowUpDownArrows = ARROWS_HIDE_UP | ARROWS_HIDE_DOWN; // Check for change in mode if ( guiShowUPDownArrows != uiOldShowUpDownArrows || gfUIRefreshArrows ) @@ -1133,7 +1137,7 @@ void HandleUpDownArrowBackgrounds( ) void RenderArrows( ) { - TILE_ELEMENT TileElem; + TILE_ELEMENT TileElem; if ( guiShowUPDownArrows & ARROWS_HIDE_UP && guiShowUPDownArrows & ARROWS_HIDE_DOWN ) { @@ -1142,111 +1146,111 @@ void RenderArrows( ) if ( guiShowUPDownArrows & ARROWS_SHOW_UP_BESIDE ) { - TileElem = gTileDatabase[ SECONDPOINTERS3 ]; - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); + TileElem = gTileDatabase[ SECONDPOINTERS3 ]; + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); } if ( guiShowUPDownArrows & ARROWS_SHOW_UP_ABOVE_G ) { - TileElem = gTileDatabase[ SECONDPOINTERS1 ]; - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); + TileElem = gTileDatabase[ SECONDPOINTERS1 ]; + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); } if ( guiShowUPDownArrows & ARROWS_SHOW_UP_ABOVE_Y ) { - TileElem = gTileDatabase[ SECONDPOINTERS3 ]; - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); + TileElem = gTileDatabase[ SECONDPOINTERS3 ]; + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); } if ( guiShowUPDownArrows & ARROWS_SHOW_UP_ABOVE_YG ) { - TileElem = gTileDatabase[ SECONDPOINTERS3 ]; - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); - TileElem = gTileDatabase[ SECONDPOINTERS1 ]; - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY + 20, VO_BLT_SRCTRANSPARENCY, NULL ); + TileElem = gTileDatabase[ SECONDPOINTERS3 ]; + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); + TileElem = gTileDatabase[ SECONDPOINTERS1 ]; + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY + 20, VO_BLT_SRCTRANSPARENCY, NULL ); } if ( guiShowUPDownArrows & ARROWS_SHOW_UP_ABOVE_GG ) { - TileElem = gTileDatabase[ SECONDPOINTERS1 ]; - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY + 20, VO_BLT_SRCTRANSPARENCY, NULL ); + TileElem = gTileDatabase[ SECONDPOINTERS1 ]; + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY + 20, VO_BLT_SRCTRANSPARENCY, NULL ); } if ( guiShowUPDownArrows & ARROWS_SHOW_UP_ABOVE_YY ) { - TileElem = gTileDatabase[ SECONDPOINTERS3 ]; - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY + 20, VO_BLT_SRCTRANSPARENCY, NULL ); + TileElem = gTileDatabase[ SECONDPOINTERS3 ]; + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY + 20, VO_BLT_SRCTRANSPARENCY, NULL ); } if ( guiShowUPDownArrows & ARROWS_SHOW_UP_ABOVE_CLIMB ) { - TileElem = gTileDatabase[ SECONDPOINTERS8 ]; - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); + TileElem = gTileDatabase[ SECONDPOINTERS8 ]; + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); } if ( guiShowUPDownArrows & ARROWS_SHOW_UP_ABOVE_CLIMB2 ) { - TileElem = gTileDatabase[ SECONDPOINTERS3 ]; - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY + 20, VO_BLT_SRCTRANSPARENCY, NULL ); - TileElem = gTileDatabase[ SECONDPOINTERS8 ]; - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); + TileElem = gTileDatabase[ SECONDPOINTERS3 ]; + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY + 20, VO_BLT_SRCTRANSPARENCY, NULL ); + TileElem = gTileDatabase[ SECONDPOINTERS8 ]; + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); } if ( guiShowUPDownArrows & ARROWS_SHOW_UP_ABOVE_CLIMB3 ) { - TileElem = gTileDatabase[ SECONDPOINTERS3 ]; - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); - TileElem = gTileDatabase[ SECONDPOINTERS8 ]; - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY + 20, VO_BLT_SRCTRANSPARENCY, NULL ); - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY + 40, VO_BLT_SRCTRANSPARENCY, NULL ); + TileElem = gTileDatabase[ SECONDPOINTERS3 ]; + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); + TileElem = gTileDatabase[ SECONDPOINTERS8 ]; + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY + 20, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsUpArrowX, gsUpArrowY + 40, VO_BLT_SRCTRANSPARENCY, NULL ); } if ( guiShowUPDownArrows & ARROWS_SHOW_DOWN_BESIDE ) { - TileElem = gTileDatabase[ SECONDPOINTERS4 ]; - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsDownArrowX, gsDownArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); + TileElem = gTileDatabase[ SECONDPOINTERS4 ]; + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsDownArrowX, gsDownArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); } if ( guiShowUPDownArrows & ARROWS_SHOW_DOWN_BELOW_G ) { - TileElem = gTileDatabase[ SECONDPOINTERS2 ]; - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsDownArrowX, gsDownArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); + TileElem = gTileDatabase[ SECONDPOINTERS2 ]; + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsDownArrowX, gsDownArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); } if ( guiShowUPDownArrows & ARROWS_SHOW_DOWN_BELOW_Y ) { - TileElem = gTileDatabase[ SECONDPOINTERS4 ]; - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsDownArrowX, gsDownArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); + TileElem = gTileDatabase[ SECONDPOINTERS4 ]; + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsDownArrowX, gsDownArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); } if ( guiShowUPDownArrows & ARROWS_SHOW_DOWN_CLIMB ) { - TileElem = gTileDatabase[ SECONDPOINTERS7 ]; - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsDownArrowX, gsDownArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); + TileElem = gTileDatabase[ SECONDPOINTERS7 ]; + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsDownArrowX, gsDownArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); } if ( guiShowUPDownArrows & ARROWS_SHOW_DOWN_BELOW_YG ) { - TileElem = gTileDatabase[ SECONDPOINTERS2 ]; - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsDownArrowX, gsDownArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); - TileElem = gTileDatabase[ SECONDPOINTERS4 ]; - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsDownArrowX, gsDownArrowY + 20, VO_BLT_SRCTRANSPARENCY, NULL ); + TileElem = gTileDatabase[ SECONDPOINTERS2 ]; + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsDownArrowX, gsDownArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); + TileElem = gTileDatabase[ SECONDPOINTERS4 ]; + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsDownArrowX, gsDownArrowY + 20, VO_BLT_SRCTRANSPARENCY, NULL ); } if ( guiShowUPDownArrows & ARROWS_SHOW_DOWN_BELOW_GG ) { - TileElem = gTileDatabase[ SECONDPOINTERS2 ]; - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsDownArrowX, gsDownArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsDownArrowX, gsDownArrowY + 20, VO_BLT_SRCTRANSPARENCY, NULL ); + TileElem = gTileDatabase[ SECONDPOINTERS2 ]; + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsDownArrowX, gsDownArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsDownArrowX, gsDownArrowY + 20, VO_BLT_SRCTRANSPARENCY, NULL ); } if ( guiShowUPDownArrows & ARROWS_SHOW_DOWN_BELOW_YY ) { - TileElem = gTileDatabase[ SECONDPOINTERS4 ]; - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsDownArrowX, gsDownArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsDownArrowX, gsDownArrowY + 20, VO_BLT_SRCTRANSPARENCY, NULL ); + TileElem = gTileDatabase[ SECONDPOINTERS4 ]; + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsDownArrowX, gsDownArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, gsDownArrowX, gsDownArrowY + 20, VO_BLT_SRCTRANSPARENCY, NULL ); } @@ -1267,7 +1271,7 @@ void EraseRenderArrows( ) { if ( giDownArrowRect != -1 ) { - FreeBackgroundRect( giDownArrowRect ); + FreeBackgroundRect( giDownArrowRect ); } } giDownArrowRect = 0; @@ -1275,9 +1279,9 @@ void EraseRenderArrows( ) void GetArrowsBackground( ) { - SOLDIERTYPE *pSoldier; - INT16 sMercScreenX, sMercScreenY; - UINT16 sArrowHeight = ARROWS_HEIGHT, sArrowWidth = ARROWS_WIDTH; + SOLDIERTYPE *pSoldier; + INT16 sMercScreenX, sMercScreenY; + UINT16 sArrowHeight = ARROWS_HEIGHT, sArrowWidth = ARROWS_WIDTH; if ( guiShowUPDownArrows & ARROWS_HIDE_UP && guiShowUPDownArrows & ARROWS_HIDE_DOWN ) { @@ -1297,7 +1301,7 @@ void GetArrowsBackground( ) // Setup blt rect gsUpArrowX = sMercScreenX + ARROWS_X_OFFSET; gsUpArrowY = sMercScreenY + UPARROW_Y_OFFSET; - } + } if ( guiShowUPDownArrows & ARROWS_SHOW_UP_ABOVE_G || guiShowUPDownArrows & ARROWS_SHOW_UP_ABOVE_Y ) { @@ -1369,7 +1373,7 @@ void GetArrowsBackground( ) if ( gsInterfaceLevel == I_ROOF_LEVEL ) { // gsDownArrowY -= ROOF_LEVEL_HEIGHT; - // gsUpArrowY -= ROOF_LEVEL_HEIGHT; + // gsUpArrowY -= ROOF_LEVEL_HEIGHT; } //Erase prevois ones... @@ -1385,10 +1389,9 @@ void GetArrowsBackground( ) void GetSoldierAboveGuyPositions( SOLDIERTYPE *pSoldier, INT16 *psX, INT16 *psY, BOOLEAN fRadio ) { INT16 sMercScreenX, sMercScreenY; - INT16 sOffsetX, sOffsetY, sAddXOffset = 0; + INT16 sOffsetX, sOffsetY; UINT8 ubAnimUseHeight; INT16 sStanceOffset = 0; - INT16 sBarBodyTypeYOffset = 55; INT16 sTextBodyTypeYOffset = 62; // Find XY, dims, offsets @@ -1401,7 +1404,7 @@ void GetSoldierAboveGuyPositions( SOLDIERTYPE *pSoldier, INT16 *psX, INT16 *psY, // Adjust based on stance if ( ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_NOMOVE_MARKER) ) - { + { ubAnimUseHeight = gAnimControl[ pSoldier->usAnimState ].ubHeight; } else @@ -1440,11 +1443,11 @@ void GetSoldierAboveGuyPositions( SOLDIERTYPE *pSoldier, INT16 *psX, INT16 *psY, //sStanceOffset -= gpWorldLevelData[ pSoldier->sGridNo ].sHeight; // Adjust based on level - if ( pSoldier->bLevel == 1 && gsInterfaceLevel == 0 ) + if ( pSoldier->pathing.bLevel == 1 && gsInterfaceLevel == 0 ) { //sStanceOffset -= ROOF_LEVEL_HEIGHT; } - if ( pSoldier->bLevel == 0 && gsInterfaceLevel == 1 ) + if ( pSoldier->pathing.bLevel == 0 && gsInterfaceLevel == 1 ) { //sStanceOffset += ROOF_LEVEL_HEIGHT; } @@ -1466,7 +1469,7 @@ void GetSoldierAboveGuyPositions( SOLDIERTYPE *pSoldier, INT16 *psX, INT16 *psY, // If not a radio position, adjust if we are getting hit, to be lower! // If we are getting hit, lower them! - if ( pSoldier->fDisplayDamage || *psY < gsVIEWPORT_WINDOW_START_Y ) + if ( pSoldier->flags.fDisplayDamage || *psY < gsVIEWPORT_WINDOW_START_Y ) { *psX = sMercScreenX - ( 80 / 2 ) - pSoldier->sLocatorOffX; *psY = sMercScreenY; @@ -1495,8 +1498,8 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) CHAR16 *pStr; CHAR16 NameStr[ 50 ]; UINT16 usGraphicToUse = THIRDPOINTERS1; - BOOLEAN fRaiseName = FALSE; - BOOLEAN fDoName = TRUE; + BOOLEAN fRaiseName = FALSE; + BOOLEAN fDoName = TRUE; GetSoldier( &pSoldier, usSoldierID ); @@ -1510,21 +1513,21 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) return; } - if ( pSoldier->fFlashLocator ) + if ( pSoldier->flags.fFlashLocator ) { if ( pSoldier->bVisible == -1 ) { - pSoldier->fFlashLocator = FALSE; + pSoldier->flags.fFlashLocator = FALSE; } else { - if ( TIMECOUNTERDONE( pSoldier->BlinkSelCounter, 80 ) ) + if ( TIMECOUNTERDONE( pSoldier->timeCounters.BlinkSelCounter, 80 ) ) { - RESETTIMECOUNTER( pSoldier->BlinkSelCounter, 80 ); + RESETTIMECOUNTER( pSoldier->timeCounters.BlinkSelCounter, 80 ); - // pSoldier->fShowLocator = !pSoldier->fShowLocator; + // pSoldier->flags.fShowLocator = !pSoldier->flags.fShowLocator; - pSoldier->fShowLocator = TRUE; + pSoldier->flags.fShowLocator = TRUE; // Update frame pSoldier->sLocatorFrame++; @@ -1532,30 +1535,30 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) if ( pSoldier->sLocatorFrame == 5 ) { // Update time we do this - pSoldier->fFlashLocator++; + pSoldier->flags.fFlashLocator++; pSoldier->sLocatorFrame = 0; } } - //if ( TIMECOUNTERDONE( pSoldier->FlashSelCounter, 5000 ) ) + //if ( TIMECOUNTERDONE( pSoldier->timeCounters.FlashSelCounter, 5000 ) ) //{ - // RESETTIMECOUNTER( pSoldier->FlashSelCounter, 5000 ); + // RESETTIMECOUNTER( pSoldier->timeCounters.FlashSelCounter, 5000 ); - // pSoldier->fFlashLocator = FALSE; - // pSoldier->fShowLocator = FALSE; + // pSoldier->flags.fFlashLocator = FALSE; + // pSoldier->flags.fShowLocator = FALSE; //} - if ( pSoldier->fFlashLocator == pSoldier->ubNumLocateCycles ) + if ( pSoldier->flags.fFlashLocator == pSoldier->ubNumLocateCycles ) { - pSoldier->fFlashLocator = FALSE; - pSoldier->fShowLocator = FALSE; + pSoldier->flags.fFlashLocator = FALSE; + pSoldier->flags.fShowLocator = FALSE; } - //if ( pSoldier->fShowLocator ) + //if ( pSoldier->flags.fShowLocator ) { // Render the beastie GetSoldierAboveGuyPositions( pSoldier, &sXPos, &sYPos, TRUE ); - + // Adjust for bars! sXPos += 25; sYPos += 25; @@ -1565,38 +1568,38 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) // Add bars - //iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, sXPos, sYPos, (INT16)(sXPos + 55 ), (INT16)(sYPos + 80 ) ); - iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, sXPos, sYPos, (INT16)(sXPos +40 ), (INT16)(sYPos + 40 ) ); + //iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, sXPos, sYPos, (INT16)(sXPos + 55 ), (INT16)(sYPos + 80 ) ); + iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, sXPos, sYPos, (INT16)(sXPos +40 ), (INT16)(sYPos + 40 ) ); if ( iBack != -1 ) { SetBackgroundRectFilled( iBack ); } - if ( ( !pSoldier->bNeutral && ( pSoldier->bSide != gbPlayerNum ) ) ) + if ( ( !pSoldier->aiData.bNeutral && ( pSoldier->bSide != gbPlayerNum ) ) ) { - BltVideoObjectFromIndex( FRAME_BUFFER, guiRADIO2, pSoldier->sLocatorFrame, sXPos, sYPos, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObjectFromIndex( FRAME_BUFFER, guiRADIO2, pSoldier->sLocatorFrame, sXPos, sYPos, VO_BLT_SRCTRANSPARENCY, NULL ); } else { - BltVideoObjectFromIndex( FRAME_BUFFER, guiRADIO, pSoldier->sLocatorFrame, sXPos, sYPos, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObjectFromIndex( FRAME_BUFFER, guiRADIO, pSoldier->sLocatorFrame, sXPos, sYPos, VO_BLT_SRCTRANSPARENCY, NULL ); - //BltVideoObjectFromIndex( FRAME_BUFFER, guiRADIO, 0, sXPos, sYPos, VO_BLT_SRCTRANSPARENCY, NULL ); + //BltVideoObjectFromIndex( FRAME_BUFFER, guiRADIO, 0, sXPos, sYPos, VO_BLT_SRCTRANSPARENCY, NULL ); } - } + } } //return; } - if ( !pSoldier->fShowLocator ) + if ( !pSoldier->flags.fShowLocator ) { // RETURN IF MERC IS NOT SELECTED if ( gfUIHandleSelectionAboveGuy && pSoldier->ubID == gsSelectedGuy && pSoldier->ubID != gusSelectedSoldier && !gfIgnoreOnSelectedGuy ) { - + } else if ( pSoldier->ubID == gusSelectedSoldier && !gRubberBandActive ) { @@ -1607,7 +1610,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) //{ //} - else if ( pSoldier->uiStatusFlags & SOLDIER_MULTI_SELECTED ) + else if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) { } @@ -1632,7 +1635,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) } // Donot show if we are dead - if ( ( pSoldier->uiStatusFlags & SOLDIER_DEAD ) ) + if ( ( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) ) { return; } @@ -1646,7 +1649,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( FONT_MCOLOR_WHITE ); - if ( pSoldier->ubProfile != NO_PROFILE || ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( pSoldier->ubProfile != NO_PROFILE || ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { if ( gfUIMouseOnValidCatcher == 1 && pSoldier->ubID == gubUIValidCatcherID ) { @@ -1654,7 +1657,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) FindFontCenterCoordinates( sXPos, (INT16)(sYPos ), (INT16)(80 ), 1, NameStr, TINYFONT1, &sX, &sY ); gprintfdirty( sX, sY, NameStr ); mprintf( sX, sY, NameStr ); - fRaiseName = TRUE; + fRaiseName = TRUE; } else if ( gfUIMouseOnValidCatcher == 3 && pSoldier->ubID == gubUIValidCatcherID ) { @@ -1662,7 +1665,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) FindFontCenterCoordinates( sXPos, (INT16)(sYPos ), (INT16)(80 ), 1, NameStr, TINYFONT1, &sX, &sY ); gprintfdirty( sX, sY, NameStr ); mprintf( sX, sY, NameStr ); - fRaiseName = TRUE; + fRaiseName = TRUE; } else if ( gfUIMouseOnValidCatcher == 4 && pSoldier->ubID == gubUIValidCatcherID ) { @@ -1670,7 +1673,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) FindFontCenterCoordinates( sXPos, (INT16)(sYPos ), (INT16)(80 ), 1, NameStr, TINYFONT1, &sX, &sY ); gprintfdirty( sX, sY, NameStr ); mprintf( sX, sY, NameStr ); - fRaiseName = TRUE; + fRaiseName = TRUE; } else if ( pSoldier->bAssignment >= ON_DUTY ) { @@ -1681,7 +1684,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) mprintf( sX, sY, NameStr ); fRaiseName = TRUE; } - else if ( pSoldier->bTeam == gbPlayerNum && pSoldier->bAssignment < ON_DUTY && pSoldier->bAssignment != CurrentSquad() && !( pSoldier->uiStatusFlags & SOLDIER_MULTI_SELECTED ) ) + else if ( pSoldier->bTeam == gbPlayerNum && pSoldier->bAssignment < ON_DUTY && pSoldier->bAssignment != CurrentSquad() && !( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) ) { swprintf( NameStr, gzLateLocalizedString[ 34 ], ( pSoldier->bAssignment + 1 ) ); FindFontCenterCoordinates( sXPos, (INT16)(sYPos ), (INT16)(80 ), 1, NameStr, TINYFONT1, &sX, &sY ); @@ -1692,7 +1695,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) // If not in a squad.... - if ( ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { if ( GetNumberInVehicle( pSoldier->bVehicleID ) == 0 ) { @@ -1701,31 +1704,31 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) } else { - if ( pSoldier->bAssignment >= ON_DUTY ) - { + if ( pSoldier->bAssignment >= ON_DUTY ) + { SetFontForeground( FONT_YELLOW ); } } if ( fDoName ) { - if ( fRaiseName ) - { - swprintf( NameStr, L"%s", pSoldier->name ); - FindFontCenterCoordinates( sXPos, (INT16)( sYPos - 10 ), (INT16)(80 ), 1, NameStr, TINYFONT1, &sX, &sY ); - gprintfdirty( sX, sY, NameStr ); - mprintf( sX, sY, NameStr ); - } - else - { - swprintf( NameStr, L"%s", pSoldier->name ); - FindFontCenterCoordinates( sXPos, sYPos, (INT16)(80 ), 1, NameStr, TINYFONT1, &sX, &sY ); - gprintfdirty( sX, sY, NameStr ); - mprintf( sX, sY, NameStr ); - } + if ( fRaiseName ) + { + swprintf( NameStr, L"%s", pSoldier->name ); + FindFontCenterCoordinates( sXPos, (INT16)( sYPos - 10 ), (INT16)(80 ), 1, NameStr, TINYFONT1, &sX, &sY ); + gprintfdirty( sX, sY, NameStr ); + mprintf( sX, sY, NameStr ); + } + else + { + swprintf( NameStr, L"%s", pSoldier->name ); + FindFontCenterCoordinates( sXPos, sYPos, (INT16)(80 ), 1, NameStr, TINYFONT1, &sX, &sY ); + gprintfdirty( sX, sY, NameStr ); + mprintf( sX, sY, NameStr ); + } } - if ( pSoldier->ubProfile < FIRST_RPC || pSoldier->ubProfile >= GASTON || RPC_RECRUITED( pSoldier ) || AM_AN_EPC( pSoldier ) || ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( pSoldier->ubProfile < FIRST_RPC || pSoldier->ubProfile >= GASTON || RPC_RECRUITED( pSoldier ) || AM_AN_EPC( pSoldier ) || ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { // Adjust for bars! @@ -1741,28 +1744,28 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) } // Add bars - iBack = RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, sXPos, sYPos, (INT16)(sXPos + 34 ), (INT16)(sYPos + 11 ) ); + iBack = RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, sXPos, sYPos, (INT16)(sXPos + 34 ), (INT16)(sYPos + 11 ) ); if ( iBack != -1 ) { SetBackgroundRectFilled( iBack ); } - TileElem = gTileDatabase[ usGraphicToUse ]; - BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, sXPos, sYPos, VO_BLT_SRCTRANSPARENCY, NULL ); + TileElem = gTileDatabase[ usGraphicToUse ]; + BltVideoObject( FRAME_BUFFER, TileElem.hTileSurface, TileElem.usRegionIndex, sXPos, sYPos, VO_BLT_SRCTRANSPARENCY, NULL ); // Draw life, breath // Only do this when we are a vehicle but on our team if ( pSoldier->ubID == gusSelectedSoldier ) - { - DrawBarsInUIBox( pSoldier, (INT16)(sXPos + 1), (INT16)(sYPos + 2), 16, 1 ); + { + DrawBarsInUIBox( pSoldier, (INT16)(sXPos + 1), (INT16)(sYPos + 2), 16, 1 ); } else { - DrawBarsInUIBox( pSoldier, (INT16)(sXPos ), (INT16)(sYPos ), 16, 1 ); + DrawBarsInUIBox( pSoldier, (INT16)(sXPos ), (INT16)(sYPos ), 16, 1 ); } } - else // ( pSoldier->ubProfile < FIRST_RPC || pSoldier->ubProfile >= GASTON || - { // RPC_RECRUITED( pSoldier ) || AM_AN_EPC( pSoldier ) || ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + else // ( pSoldier->ubProfile < FIRST_RPC || pSoldier->ubProfile >= GASTON || + { // RPC_RECRUITED( pSoldier ) || AM_AN_EPC( pSoldier ) || ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) if ( gfUIMouseOnValidCatcher == 2 && pSoldier->ubID == gubUIValidCatcherID ) { SetFont( TINYFONT1 ); @@ -1783,7 +1786,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) pStr = GetSoldierHealthString( pSoldier ); - + FindFontCenterCoordinates( sXPos, (INT16)( sYPos + 10 ), (INT16)(80 ), 1, pStr, TINYFONT1, &sX, &sY ); gprintfdirty( sX, sY, pStr ); @@ -1791,9 +1794,9 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) } } } - else //pSoldier->ubProfile != NO_PROFILE || ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + else //pSoldier->ubProfile != NO_PROFILE || ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { - if ( pSoldier->bLevel != 0 ) + if ( pSoldier->pathing.bLevel != 0 ) { // Display name SetFont( TINYFONT1 ); @@ -1811,7 +1814,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) //jones extern void SoldierTooltip(SOLDIERTYPE*); if ( gGameExternalOptions.gfAllowSoldierToolTips ) - SoldierTooltip(pSoldier); + SoldierTooltip(pSoldier); SetFont( TINYFONT1 ); SetFontBackground( FONT_MCOLOR_BLACK ); @@ -1830,7 +1833,7 @@ void RenderOverlayMessage( VIDEO_OVERLAY *pBlitter ) // Override it! OverrideMercPopupBox( &gpOverrideMercBox ); - RenderMercPopupBox( pBlitter->sX, pBlitter->sY, pBlitter->uiDestBuff ); + RenderMercPopupBox( pBlitter->sX, pBlitter->sY, pBlitter->uiDestBuff ); // Set it back! ResetOverrideMercPopupBox( ); @@ -1846,7 +1849,7 @@ void BeginOverlayMessage( UINT32 uiFont, STR16 pFontString, ... ) CHAR16 SlideString[512]; - va_start(argptr, pFontString); // Set up variable argument pointer + va_start(argptr, pFontString); // Set up variable argument pointer vswprintf(SlideString, pFontString, argptr); // process gprintf string (get output str) va_end(argptr); @@ -1861,21 +1864,21 @@ void BeginOverlayMessage( UINT32 uiFont, STR16 pFontString, ... ) // Set it back! ResetOverrideMercPopupBox( ); - if ( giPopupSlideMessageOverlay == -1 ) + if ( giPopupSlideMessageOverlay == -1 ) { // WDS - bug fix: VideoOverlayDesc must be initialized! - 07/16/2007 memset( &VideoOverlayDesc, 0, sizeof( VIDEO_OVERLAY_DESC ) ); - // Set Overlay - VideoOverlayDesc.sLeft = ( SCREEN_WIDTH - gusOverlayPopupBoxWidth ) / 2; - VideoOverlayDesc.sTop = 100; - VideoOverlayDesc.sRight = VideoOverlayDesc.sLeft + gusOverlayPopupBoxWidth; - VideoOverlayDesc.sBottom = VideoOverlayDesc.sTop + gusOverlayPopupBoxHeight; - VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; - VideoOverlayDesc.sY = VideoOverlayDesc.sTop; + // Set Overlay + VideoOverlayDesc.sLeft = ( SCREEN_WIDTH - gusOverlayPopupBoxWidth ) / 2; + VideoOverlayDesc.sTop = 100; + VideoOverlayDesc.sRight = VideoOverlayDesc.sLeft + gusOverlayPopupBoxWidth; + VideoOverlayDesc.sBottom = VideoOverlayDesc.sTop + gusOverlayPopupBoxHeight; + VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; + VideoOverlayDesc.sY = VideoOverlayDesc.sTop; VideoOverlayDesc.BltCallback = RenderOverlayMessage; - giPopupSlideMessageOverlay = RegisterVideoOverlay( 0, &VideoOverlayDesc ); + giPopupSlideMessageOverlay = RegisterVideoOverlay( 0, &VideoOverlayDesc ); } } @@ -1883,7 +1886,7 @@ void BeginOverlayMessage( UINT32 uiFont, STR16 pFontString, ... ) void EndOverlayMessage( ) { if ( giPopupSlideMessageOverlay != -1 ) - { + { // DebugMsg( TOPIC_JA2, DBG_LEVEL_0, String( "Removing Overlay message") ); @@ -1897,92 +1900,92 @@ void EndOverlayMessage( ) void DrawBarsInUIBox( SOLDIERTYPE *pSoldier , INT16 sXPos, INT16 sYPos, INT16 sWidth, INT16 sHeight ) { - FLOAT dWidth, dPercentage; - //UINT16 usLineColor; + FLOAT dWidth, dPercentage; + //UINT16 usLineColor; - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; - UINT16 usLineColor; - INT8 bBandage; + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; + UINT16 usLineColor; + INT8 bBandage; // Draw breath points // Draw new size - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); - + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + // region rysowania barow nad najemnikiem SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, gsVIEWPORT_WINDOW_START_Y, SCREEN_WIDTH, ( gsVIEWPORT_WINDOW_END_Y - gsVIEWPORT_WINDOW_START_Y ) ); // get amt bandaged - bBandage = pSoldier->bLifeMax - pSoldier->bLife - pSoldier->bBleeding; + bBandage = pSoldier->stats.bLifeMax - pSoldier->stats.bLife - pSoldier->bBleeding; + - // NOW DO BLEEDING if ( pSoldier->bBleeding ) { - dPercentage = (FLOAT)( pSoldier->bBleeding + pSoldier->bLife + bBandage )/ (FLOAT)100; + dPercentage = (FLOAT)( pSoldier->bBleeding + pSoldier->stats.bLife + bBandage )/ (FLOAT)100; dWidth = dPercentage * sWidth; if(gbPixelDepth==16) { - usLineColor = Get16BPPColor( FROMRGB( 240, 240, 20 ) ); - RectangleDraw( TRUE, sXPos + 3, sYPos + 1, (INT32)( sXPos + dWidth + 3 ), sYPos + 1, usLineColor, pDestBuf ); + usLineColor = Get16BPPColor( FROMRGB( 240, 240, 20 ) ); + RectangleDraw( TRUE, sXPos + 3, sYPos + 1, (INT32)( sXPos + dWidth + 3 ), sYPos + 1, usLineColor, pDestBuf ); } else if(gbPixelDepth==8) { // DB Need to change this to a color from the 8-bit standard palette usLineColor = COLOR_RED; - RectangleDraw8( TRUE, sXPos + 3, sYPos + 1, (INT32)( sXPos + dWidth + 3 ), sYPos + 1, usLineColor, pDestBuf ); + RectangleDraw8( TRUE, sXPos + 3, sYPos + 1, (INT32)( sXPos + dWidth + 3 ), sYPos + 1, usLineColor, pDestBuf ); } } - + if( bBandage ) { - dPercentage = (FLOAT)( pSoldier->bLife + bBandage ) / (FLOAT)100; + dPercentage = (FLOAT)( pSoldier->stats.bLife + bBandage ) / (FLOAT)100; dWidth = dPercentage * sWidth; if(gbPixelDepth==16) { usLineColor = Get16BPPColor( FROMRGB( 222, 132, 132 ) ); - RectangleDraw( TRUE, sXPos + 3, sYPos + 1, (INT32)( sXPos + dWidth + 3 ), sYPos + 1, usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos + 3, sYPos + 1, (INT32)( sXPos + dWidth + 3 ), sYPos + 1, usLineColor, pDestBuf ); } else if(gbPixelDepth==8) { // DB Need to change this to a color from the 8-bit standard palette usLineColor = COLOR_RED; - RectangleDraw8( TRUE, sXPos + 3, sYPos + 1, (INT32)( sXPos + dWidth + 3 ), sYPos + 1, usLineColor, pDestBuf ); + RectangleDraw8( TRUE, sXPos + 3, sYPos + 1, (INT32)( sXPos + dWidth + 3 ), sYPos + 1, usLineColor, pDestBuf ); } } - dPercentage = (FLOAT)pSoldier->bLife / (FLOAT)100; + dPercentage = (FLOAT)pSoldier->stats.bLife / (FLOAT)100; dWidth = dPercentage * sWidth; if(gbPixelDepth==16) { usLineColor = Get16BPPColor( FROMRGB( 200, 0, 0 ) ); - RectangleDraw( TRUE, sXPos + 3, sYPos + 1, (INT32)( sXPos + dWidth + 3 ), sYPos + 1, usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos + 3, sYPos + 1, (INT32)( sXPos + dWidth + 3 ), sYPos + 1, usLineColor, pDestBuf ); } else if(gbPixelDepth==8) { // DB Need to change this to a color from the 8-bit standard palette usLineColor = COLOR_RED; - RectangleDraw8( TRUE, sXPos + 3, sYPos + 1, (INT32)( sXPos + dWidth + 3 ), sYPos + 1, usLineColor, pDestBuf ); + RectangleDraw8( TRUE, sXPos + 3, sYPos + 1, (INT32)( sXPos + dWidth + 3 ), sYPos + 1, usLineColor, pDestBuf ); } - + dPercentage = (FLOAT)( pSoldier->bBreathMax ) / (FLOAT)100; dWidth = dPercentage * sWidth; if(gbPixelDepth==16) { usLineColor = Get16BPPColor( FROMRGB( 20, 20, 150 ) ); - RectangleDraw( TRUE, sXPos + 3, sYPos + 4, (INT32)( sXPos + dWidth + 3 ), sYPos + 4, usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos + 3, sYPos + 4, (INT32)( sXPos + dWidth + 3 ), sYPos + 4, usLineColor, pDestBuf ); } else if(gbPixelDepth==8) { // DB Need to change this to a color from the 8-bit standard palette usLineColor = COLOR_BLUE; - RectangleDraw8( TRUE, sXPos + 3, sYPos + 4, (INT32)( sXPos + dWidth + 3 ), sYPos + 4, usLineColor, pDestBuf ); + RectangleDraw8( TRUE, sXPos + 3, sYPos + 4, (INT32)( sXPos + dWidth + 3 ), sYPos + 4, usLineColor, pDestBuf ); } dPercentage = (FLOAT)( pSoldier->bBreath ) / (FLOAT)100; @@ -1990,29 +1993,29 @@ void DrawBarsInUIBox( SOLDIERTYPE *pSoldier , INT16 sXPos, INT16 sYPos, INT16 sW if(gbPixelDepth==16) { usLineColor = Get16BPPColor( FROMRGB( 100, 100, 220 ) ); - RectangleDraw( TRUE, sXPos + 3, sYPos + 4, (INT32)( sXPos + dWidth + 3 ), sYPos + 4, usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos + 3, sYPos + 4, (INT32)( sXPos + dWidth + 3 ), sYPos + 4, usLineColor, pDestBuf ); } else if(gbPixelDepth==8) { // DB Need to change this to a color from the 8-bit standard palette usLineColor = COLOR_BLUE; - RectangleDraw8( TRUE, sXPos + 3, sYPos + 4, (INT32)( sXPos + dWidth + 3 ), sYPos + 4, usLineColor, pDestBuf ); + RectangleDraw8( TRUE, sXPos + 3, sYPos + 4, (INT32)( sXPos + dWidth + 3 ), sYPos + 4, usLineColor, pDestBuf ); } /* // morale - dPercentage = (FLOAT)pSoldier->bMorale / (FLOAT)100; + dPercentage = (FLOAT)pSoldier->aiData.bMorale / (FLOAT)100; dWidth = dPercentage * sWidth; if(gbPixelDepth==16) { usLineColor = Get16BPPColor( FROMRGB( 0, 250, 0 ) ); - RectangleDraw( TRUE, sXPos + 1, sYPos + 7, (INT32)( sXPos + dWidth + 1 ), sYPos + 7, usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXPos + 1, sYPos + 7, (INT32)( sXPos + dWidth + 1 ), sYPos + 7, usLineColor, pDestBuf ); } else if(gbPixelDepth==8) { // DB Need to change this to a color from the 8-bit standard palette usLineColor = COLOR_GREEN; - RectangleDraw8( TRUE, sXPos + 1, sYPos + 7, (INT32)( sXPos + dWidth + 1 ), sYPos + 7, usLineColor, pDestBuf ); + RectangleDraw8( TRUE, sXPos + 1, sYPos + 7, (INT32)( sXPos + dWidth + 1 ), sYPos + 7, usLineColor, pDestBuf ); } */ @@ -2078,11 +2081,11 @@ void ClearInterface( ) // Erase Interface cursors HideUICursor( ); - MSYS_ChangeRegionCursor( &gViewportRegion , VIDEO_NO_CURSOR ); + MSYS_ChangeRegionCursor( &gViewportRegion , VIDEO_NO_CURSOR ); // Hide lock UI cursors... - MSYS_ChangeRegionCursor( &gDisableRegion , VIDEO_NO_CURSOR ); - MSYS_ChangeRegionCursor( &gUserTurnRegion , VIDEO_NO_CURSOR ); + MSYS_ChangeRegionCursor( &gDisableRegion , VIDEO_NO_CURSOR ); + MSYS_ChangeRegionCursor( &gUserTurnRegion , VIDEO_NO_CURSOR ); // Remove special thing for south arrow... if ( gsGlobalCursorYOffset == ( SCREEN_HEIGHT - gsVIEWPORT_WINDOW_END_Y ) ) @@ -2101,15 +2104,15 @@ void RestoreInterface( ) gfUIRefreshArrows = TRUE; // SHow lock UI cursors... - MSYS_ChangeRegionCursor( &gDisableRegion , CURSOR_WAIT ); - MSYS_ChangeRegionCursor( &gUserTurnRegion , CURSOR_WAIT ); + MSYS_ChangeRegionCursor( &gDisableRegion , CURSOR_WAIT ); + MSYS_ChangeRegionCursor( &gUserTurnRegion , CURSOR_WAIT ); } void BlitPopupText( VIDEO_OVERLAY *pBlitter ) { - UINT8 *pDestBuf; + UINT8 *pDestBuf; UINT32 uiDestPitchBYTES; BltVideoSurface( pBlitter->uiDestBuff, guiINTEXT, 0, pBlitter->pBackground->sLeft, pBlitter->pBackground->sTop, VS_BLT_FAST | VS_BLT_USECOLORKEY, NULL ); @@ -2216,11 +2219,11 @@ BOOLEAN InitDoorOpenMenu( SOLDIERTYPE *pSoldier, STRUCTURE *pStructure, UINT8 ub gOpenDoorMenu.fMenuHandled = FALSE; - guiPendingOverrideEvent = OP_OPENDOORMENU; + guiPendingOverrideEvent = OP_OPENDOORMENU; HandleTacticalUI( ); PopupDoorOpenMenu( fClosingDoor ); - + return( TRUE ); } @@ -2240,7 +2243,7 @@ void PopupDoorOpenMenu( BOOLEAN fClosingDoor ) // Create mouse region over all area to facilitate clicking to end MSYS_DefineRegion( &gMenuOverlayRegion, 0, 0 ,SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST-1, - CURSOR_NORMAL, MSYS_NO_CALLBACK, DoorMenuBackregionCallback ); + CURSOR_NORMAL, MSYS_NO_CALLBACK, DoorMenuBackregionCallback ); // Add region MSYS_AddRegion( &gMenuOverlayRegion); @@ -2264,7 +2267,7 @@ void PopupDoorOpenMenu( BOOLEAN fClosingDoor ) } SetButtonFastHelpText( iActionIcons[ USE_KEYRING_ICON ], zDisp ); - if ( !EnoughPoints( gOpenDoorMenu.pSoldier, AP_UNLOCK_DOOR, BP_UNLOCK_DOOR, FALSE ) || fClosingDoor || AM_AN_EPC( gOpenDoorMenu.pSoldier ) ) + if ( !EnoughPoints( gOpenDoorMenu.pSoldier, AP_UNLOCK_DOOR, BP_UNLOCK_DOOR, FALSE ) || fClosingDoor || AM_AN_EPC( gOpenDoorMenu.pSoldier ) ) { DisableButton( iActionIcons[ USE_KEYRING_ICON ] ); } @@ -2276,9 +2279,9 @@ void PopupDoorOpenMenu( BOOLEAN fClosingDoor ) } - iActionIcons[ USE_CROWBAR_ICON ] = QuickCreateButton( iIconImages[ CROWBAR_DOOR_IMAGES ], (INT16)(iMenuAnchorX + 40 ), (INT16)(iMenuAnchorY ), + iActionIcons[ USE_CROWBAR_ICON ] = QuickCreateButton( iIconImages[ CROWBAR_DOOR_IMAGES ], (INT16)(iMenuAnchorX + 40 ), (INT16)(iMenuAnchorY ), BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)BtnDoorMenuCallback ); + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)BtnDoorMenuCallback ); if ( iActionIcons[ USE_CROWBAR_ICON ] == -1 ) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Cannot create Interface button" ); @@ -2296,12 +2299,12 @@ void PopupDoorOpenMenu( BOOLEAN fClosingDoor ) SetButtonFastHelpText( iActionIcons[ USE_CROWBAR_ICON ], zDisp ); // Greyout if no crowbar found... - if ( FindUsableCrowbar ( gOpenDoorMenu.pSoldier ) == NO_SLOT || fClosingDoor ) + if ( FindUsableCrowbar ( gOpenDoorMenu.pSoldier ) == NO_SLOT || fClosingDoor ) { DisableButton( iActionIcons[ USE_CROWBAR_ICON ] ); } - if ( !EnoughPoints( gOpenDoorMenu.pSoldier, AP_USE_CROWBAR, BP_USE_CROWBAR, FALSE ) ) + if ( !EnoughPoints( gOpenDoorMenu.pSoldier, AP_USE_CROWBAR, BP_USE_CROWBAR, FALSE ) ) { DisableButton( iActionIcons[ USE_CROWBAR_ICON ] ); } @@ -2325,7 +2328,7 @@ void PopupDoorOpenMenu( BOOLEAN fClosingDoor ) } SetButtonFastHelpText( iActionIcons[ LOCKPICK_DOOR_ICON ], zDisp ); - if ( !EnoughPoints( gOpenDoorMenu.pSoldier, AP_PICKLOCK, BP_PICKLOCK, FALSE ) || fClosingDoor || AM_AN_EPC( gOpenDoorMenu.pSoldier ) ) + if ( !EnoughPoints( gOpenDoorMenu.pSoldier, AP_PICKLOCK, BP_PICKLOCK, FALSE ) || fClosingDoor || AM_AN_EPC( gOpenDoorMenu.pSoldier ) ) { DisableButton( iActionIcons[ LOCKPICK_DOOR_ICON ] ); } @@ -2357,7 +2360,7 @@ void PopupDoorOpenMenu( BOOLEAN fClosingDoor ) } SetButtonFastHelpText( iActionIcons[ EXPLOSIVE_DOOR_ICON ], zDisp ); - if ( !EnoughPoints( gOpenDoorMenu.pSoldier, AP_EXPLODE_DOOR, BP_EXPLODE_DOOR, FALSE ) || fClosingDoor || AM_AN_EPC( gOpenDoorMenu.pSoldier ) ) + if ( !EnoughPoints( gOpenDoorMenu.pSoldier, AP_EXPLODE_DOOR, BP_EXPLODE_DOOR, FALSE ) || fClosingDoor || AM_AN_EPC( gOpenDoorMenu.pSoldier ) ) { DisableButton( iActionIcons[ EXPLOSIVE_DOOR_ICON ] ); } @@ -2403,14 +2406,14 @@ void PopupDoorOpenMenu( BOOLEAN fClosingDoor ) } SetButtonFastHelpText( iActionIcons[ OPEN_DOOR_ICON ], zDisp ); - if ( !EnoughPoints( gOpenDoorMenu.pSoldier, AP_OPEN_DOOR, BP_OPEN_DOOR, FALSE ) ) + if ( !EnoughPoints( gOpenDoorMenu.pSoldier, AP_OPEN_DOOR, BP_OPEN_DOOR, FALSE ) ) { DisableButton( iActionIcons[ OPEN_DOOR_ICON ] ); } // Create button based on what is in our hands at the moment! - iActionIcons[ EXAMINE_DOOR_ICON ] = QuickCreateButton( iIconImages[ EXAMINE_DOOR_IMAGES ], (INT16)(iMenuAnchorX ), (INT16)(iMenuAnchorY + 20 ), + iActionIcons[ EXAMINE_DOOR_ICON ] = QuickCreateButton( iIconImages[ EXAMINE_DOOR_IMAGES ], (INT16)(iMenuAnchorX ), (INT16)(iMenuAnchorY + 20 ), BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)BtnDoorMenuCallback ); if ( iActionIcons[ EXAMINE_DOOR_ICON ] == -1 ) @@ -2429,12 +2432,12 @@ void PopupDoorOpenMenu( BOOLEAN fClosingDoor ) } SetButtonFastHelpText( iActionIcons[ EXAMINE_DOOR_ICON ], zDisp ); - if ( !EnoughPoints( gOpenDoorMenu.pSoldier, AP_EXAMINE_DOOR, BP_EXAMINE_DOOR, FALSE ) || fClosingDoor || AM_AN_EPC( gOpenDoorMenu.pSoldier ) ) + if ( !EnoughPoints( gOpenDoorMenu.pSoldier, AP_EXAMINE_DOOR, BP_EXAMINE_DOOR, FALSE ) || fClosingDoor || AM_AN_EPC( gOpenDoorMenu.pSoldier ) ) { DisableButton( iActionIcons[ EXAMINE_DOOR_ICON ] ); } - iActionIcons[ BOOT_DOOR_ICON ] = QuickCreateButton( iIconImages[ BOOT_DOOR_IMAGES ], (INT16)(iMenuAnchorX ), (INT16)(iMenuAnchorY + 40 ), + iActionIcons[ BOOT_DOOR_ICON ] = QuickCreateButton( iIconImages[ BOOT_DOOR_IMAGES ], (INT16)(iMenuAnchorX ), (INT16)(iMenuAnchorY + 40 ), BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)BtnDoorMenuCallback ); if ( iActionIcons[ BOOT_DOOR_ICON ] == -1 ) @@ -2453,13 +2456,13 @@ void PopupDoorOpenMenu( BOOLEAN fClosingDoor ) } SetButtonFastHelpText( iActionIcons[ BOOT_DOOR_ICON ], zDisp ); - if ( !EnoughPoints( gOpenDoorMenu.pSoldier, AP_BOOT_DOOR, BP_BOOT_DOOR, FALSE ) || fClosingDoor || AM_AN_EPC( gOpenDoorMenu.pSoldier ) ) + if ( !EnoughPoints( gOpenDoorMenu.pSoldier, AP_BOOT_DOOR, BP_BOOT_DOOR, FALSE ) || fClosingDoor || AM_AN_EPC( gOpenDoorMenu.pSoldier ) ) { DisableButton( iActionIcons[ BOOT_DOOR_ICON ] ); } - iActionIcons[ UNTRAP_DOOR_ICON ] = QuickCreateButton( iIconImages[ UNTRAP_DOOR_ICON ], (INT16)(iMenuAnchorX + 20 ), (INT16)(iMenuAnchorY + 40 ), + iActionIcons[ UNTRAP_DOOR_ICON ] = QuickCreateButton( iIconImages[ UNTRAP_DOOR_ICON ], (INT16)(iMenuAnchorX + 20 ), (INT16)(iMenuAnchorY + 40 ), BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)BtnDoorMenuCallback ); if ( iActionIcons[ UNTRAP_DOOR_ICON ] == -1 ) @@ -2478,12 +2481,12 @@ void PopupDoorOpenMenu( BOOLEAN fClosingDoor ) } SetButtonFastHelpText( iActionIcons[ UNTRAP_DOOR_ICON ], zDisp ); - if ( !EnoughPoints( gOpenDoorMenu.pSoldier, AP_UNTRAP_DOOR, BP_UNTRAP_DOOR, FALSE ) || fClosingDoor || AM_AN_EPC( gOpenDoorMenu.pSoldier ) ) + if ( !EnoughPoints( gOpenDoorMenu.pSoldier, AP_UNTRAP_DOOR, BP_UNTRAP_DOOR, FALSE ) || fClosingDoor || AM_AN_EPC( gOpenDoorMenu.pSoldier ) ) { DisableButton( iActionIcons[ UNTRAP_DOOR_ICON ] ); } - iActionIcons[ CANCEL_ICON ] = QuickCreateButton( iIconImages[ CANCEL_IMAGES ], (INT16)(iMenuAnchorX + 20 ), (INT16)(iMenuAnchorY + 20 ), + iActionIcons[ CANCEL_ICON ] = QuickCreateButton( iIconImages[ CANCEL_IMAGES ], (INT16)(iMenuAnchorX + 20 ), (INT16)(iMenuAnchorY + 20 ), BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)BtnDoorMenuCallback ); if ( iActionIcons[ CANCEL_ICON ] == -1 ) @@ -2511,15 +2514,15 @@ void PopDownOpenDoorMenu( ) // UnPause timers as well.... PauseTime( FALSE ); - RemoveButton( iActionIcons[ USE_KEYRING_ICON ] ); - RemoveButton( iActionIcons[ USE_CROWBAR_ICON ] ); - RemoveButton( iActionIcons[ LOCKPICK_DOOR_ICON ] ); - RemoveButton( iActionIcons[ EXPLOSIVE_DOOR_ICON ] ); - RemoveButton( iActionIcons[ OPEN_DOOR_ICON ] ); - RemoveButton( iActionIcons[ EXAMINE_DOOR_ICON ] ); - RemoveButton( iActionIcons[ BOOT_DOOR_ICON ] ); - RemoveButton( iActionIcons[ UNTRAP_DOOR_ICON ] ); - RemoveButton( iActionIcons[ CANCEL_ICON ] ); + RemoveButton( iActionIcons[ USE_KEYRING_ICON ] ); + RemoveButton( iActionIcons[ USE_CROWBAR_ICON ] ); + RemoveButton( iActionIcons[ LOCKPICK_DOOR_ICON ] ); + RemoveButton( iActionIcons[ EXPLOSIVE_DOOR_ICON ] ); + RemoveButton( iActionIcons[ OPEN_DOOR_ICON ] ); + RemoveButton( iActionIcons[ EXAMINE_DOOR_ICON ] ); + RemoveButton( iActionIcons[ BOOT_DOOR_ICON ] ); + RemoveButton( iActionIcons[ UNTRAP_DOOR_ICON ] ); + RemoveButton( iActionIcons[ CANCEL_ICON ] ); // Turn off Ignore scrolling gfIgnoreScrolling = FALSE; @@ -2543,23 +2546,23 @@ void RenderOpenDoorMenu( ) if ( gfInOpenDoorMenu ) { BltVideoObjectFromIndex( FRAME_BUFFER, guiBUTTONBORDER, 0, gOpenDoorMenu.sX, gOpenDoorMenu.sY, VO_BLT_SRCTRANSPARENCY, NULL ); - + // Mark buttons dirty! - MarkAButtonDirty( iActionIcons[ USE_KEYRING_ICON ] ); - MarkAButtonDirty( iActionIcons[ USE_CROWBAR_ICON ] ); - MarkAButtonDirty( iActionIcons[ LOCKPICK_DOOR_ICON ] ); - MarkAButtonDirty( iActionIcons[ EXPLOSIVE_DOOR_ICON ] ); - MarkAButtonDirty( iActionIcons[ OPEN_DOOR_ICON ] ); - MarkAButtonDirty( iActionIcons[ EXAMINE_DOOR_ICON ] ); - MarkAButtonDirty( iActionIcons[ BOOT_DOOR_ICON ] ); - MarkAButtonDirty( iActionIcons[ UNTRAP_DOOR_ICON ] ); - MarkAButtonDirty( iActionIcons[ CANCEL_ICON ] ); + MarkAButtonDirty( iActionIcons[ USE_KEYRING_ICON ] ); + MarkAButtonDirty( iActionIcons[ USE_CROWBAR_ICON ] ); + MarkAButtonDirty( iActionIcons[ LOCKPICK_DOOR_ICON ] ); + MarkAButtonDirty( iActionIcons[ EXPLOSIVE_DOOR_ICON ] ); + MarkAButtonDirty( iActionIcons[ OPEN_DOOR_ICON ] ); + MarkAButtonDirty( iActionIcons[ EXAMINE_DOOR_ICON ] ); + MarkAButtonDirty( iActionIcons[ BOOT_DOOR_ICON ] ); + MarkAButtonDirty( iActionIcons[ UNTRAP_DOOR_ICON ] ); + MarkAButtonDirty( iActionIcons[ CANCEL_ICON ] ); RenderButtons( ); // if game is paused, then render paused game text RenderPausedGameBox( ); - + InvalidateRegion( gOpenDoorMenu.sX, gOpenDoorMenu.sY, gOpenDoorMenu.sX + BUTTON_PANEL_WIDTH, gOpenDoorMenu.sY + BUTTON_PANEL_HEIGHT ); } @@ -2595,14 +2598,14 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) { // Open door normally... // Check APs - if ( EnoughPoints( gOpenDoorMenu.pSoldier, AP_OPEN_DOOR, BP_OPEN_DOOR, FALSE ) ) + if ( EnoughPoints( gOpenDoorMenu.pSoldier, AP_OPEN_DOOR, BP_OPEN_DOOR, FALSE ) ) { // Set UI SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID ); if ( gOpenDoorMenu.fClosingDoor ) { - ChangeSoldierState( gOpenDoorMenu.pSoldier, GetAnimStateForInteraction( gOpenDoorMenu.pSoldier, TRUE, CLOSE_DOOR ), 0 , FALSE ); + gOpenDoorMenu.pSoldier->ChangeSoldierState( GetAnimStateForInteraction( gOpenDoorMenu.pSoldier, TRUE, CLOSE_DOOR ), 0 , FALSE ); } else { @@ -2619,7 +2622,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) if ( uiBtnID == iActionIcons[ BOOT_DOOR_ICON ] ) { // Boot door - if ( EnoughPoints( gOpenDoorMenu.pSoldier, AP_BOOT_DOOR, BP_BOOT_DOOR, FALSE ) ) + if ( EnoughPoints( gOpenDoorMenu.pSoldier, AP_BOOT_DOOR, BP_BOOT_DOOR, FALSE ) ) { // Set UI SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID ); @@ -2636,7 +2639,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) if ( uiBtnID == iActionIcons[ USE_KEYRING_ICON ] ) { // Unlock door - if ( EnoughPoints( gOpenDoorMenu.pSoldier, AP_UNLOCK_DOOR, BP_UNLOCK_DOOR, FALSE ) ) + if ( EnoughPoints( gOpenDoorMenu.pSoldier, AP_UNLOCK_DOOR, BP_UNLOCK_DOOR, FALSE ) ) { // Set UI SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID ); @@ -2653,7 +2656,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) if ( uiBtnID == iActionIcons[ LOCKPICK_DOOR_ICON ] ) { // Lockpick - if ( EnoughPoints( gOpenDoorMenu.pSoldier, AP_PICKLOCK, BP_PICKLOCK, FALSE ) ) + if ( EnoughPoints( gOpenDoorMenu.pSoldier, AP_PICKLOCK, BP_PICKLOCK, FALSE ) ) { // Set UI SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID ); @@ -2670,7 +2673,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) if ( uiBtnID == iActionIcons[ EXAMINE_DOOR_ICON ] ) { // Lockpick - if ( EnoughPoints( gOpenDoorMenu.pSoldier, AP_EXAMINE_DOOR, BP_EXAMINE_DOOR, FALSE ) ) + if ( EnoughPoints( gOpenDoorMenu.pSoldier, AP_EXAMINE_DOOR, BP_EXAMINE_DOOR, FALSE ) ) { // Set UI SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID ); @@ -2687,7 +2690,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) if ( uiBtnID == iActionIcons[ EXPLOSIVE_DOOR_ICON ] ) { // Explode - if ( EnoughPoints( gOpenDoorMenu.pSoldier, AP_EXPLODE_DOOR, BP_EXPLODE_DOOR, FALSE ) ) + if ( EnoughPoints( gOpenDoorMenu.pSoldier, AP_EXPLODE_DOOR, BP_EXPLODE_DOOR, FALSE ) ) { // Set UI SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID ); @@ -2704,7 +2707,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) if ( uiBtnID == iActionIcons[ UNTRAP_DOOR_ICON ] ) { // Explode - if ( EnoughPoints( gOpenDoorMenu.pSoldier, AP_UNTRAP_DOOR, BP_UNTRAP_DOOR, FALSE ) ) + if ( EnoughPoints( gOpenDoorMenu.pSoldier, AP_UNTRAP_DOOR, BP_UNTRAP_DOOR, FALSE ) ) { // Set UI SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID ); @@ -2721,7 +2724,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) if ( uiBtnID == iActionIcons[ USE_CROWBAR_ICON ] ) { // Explode - if ( EnoughPoints( gOpenDoorMenu.pSoldier, AP_USE_CROWBAR, BP_USE_CROWBAR, FALSE ) ) + if ( EnoughPoints( gOpenDoorMenu.pSoldier, AP_USE_CROWBAR, BP_USE_CROWBAR, FALSE ) ) { // Set UI SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID ); @@ -2758,7 +2761,7 @@ void RenderUIMessage( VIDEO_OVERLAY *pBlitter ) // Shade area first... ShadowVideoSurfaceRect( pBlitter->uiDestBuff, pBlitter->sX, pBlitter->sY, pBlitter->sX + gusUIMessageWidth - 2, pBlitter->sY + gusUIMessageHeight - 2 ); - RenderMercPopUpBoxFromIndex( iUIMessageBox, pBlitter->sX, pBlitter->sY, pBlitter->uiDestBuff ); + RenderMercPopUpBoxFromIndex( iUIMessageBox, pBlitter->sX, pBlitter->sY, pBlitter->uiDestBuff ); InvalidateRegion( pBlitter->sX, pBlitter->sY, pBlitter->sX + gusUIMessageWidth, pBlitter->sY + gusUIMessageHeight ); } @@ -2771,7 +2774,7 @@ void InternalBeginUIMessage( BOOLEAN fUseSkullIcon, STR16 pFontString, ... ) CHAR16 MsgString[512]; - va_start(argptr, pFontString); // Set up variable argument pointer + va_start(argptr, pFontString); // Set up variable argument pointer vswprintf(MsgString, pFontString, argptr); // process gprintf string (get output str) va_end(argptr); @@ -2781,7 +2784,7 @@ void InternalBeginUIMessage( BOOLEAN fUseSkullIcon, STR16 pFontString, ... ) // Override it! OverrideMercPopupBox( &gpUIMessageOverrideMercBox ); - //SetPrepareMercPopupFlags( MERC_POPUP_PREPARE_FLAGS_TRANS_BACK | MERC_POPUP_PREPARE_FLAGS_MARGINS ); + //SetPrepareMercPopupFlags( MERC_POPUP_PREPARE_FLAGS_TRANS_BACK | MERC_POPUP_PREPARE_FLAGS_MARGINS ); if ( fUseSkullIcon ) { @@ -2798,27 +2801,27 @@ void InternalBeginUIMessage( BOOLEAN fUseSkullIcon, STR16 pFontString, ... ) // Set it back! ResetOverrideMercPopupBox( ); - if ( giUIMessageOverlay != -1 ) + if ( giUIMessageOverlay != -1 ) { RemoveVideoOverlay( giUIMessageOverlay ); giUIMessageOverlay = -1; } - if ( giUIMessageOverlay == -1 ) + if ( giUIMessageOverlay == -1 ) { memset( &VideoOverlayDesc, 0, sizeof( VideoOverlayDesc ) ); // Set Overlay - VideoOverlayDesc.sLeft = ( SCREEN_WIDTH - gusUIMessageWidth ) / 2; - VideoOverlayDesc.sTop = 150; - VideoOverlayDesc.sRight = VideoOverlayDesc.sLeft + gusUIMessageWidth; - VideoOverlayDesc.sBottom = VideoOverlayDesc.sTop + gusUIMessageHeight; - VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; - VideoOverlayDesc.sY = VideoOverlayDesc.sTop; + VideoOverlayDesc.sLeft = ( SCREEN_WIDTH - gusUIMessageWidth ) / 2; + VideoOverlayDesc.sTop = 150; + VideoOverlayDesc.sRight = VideoOverlayDesc.sLeft + gusUIMessageWidth; + VideoOverlayDesc.sBottom = VideoOverlayDesc.sTop + gusUIMessageHeight; + VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; + VideoOverlayDesc.sY = VideoOverlayDesc.sTop; VideoOverlayDesc.BltCallback = RenderUIMessage; - giUIMessageOverlay = RegisterVideoOverlay( 0, &VideoOverlayDesc ); + giUIMessageOverlay = RegisterVideoOverlay( 0, &VideoOverlayDesc ); } gfUseSkullIconMessage = fUseSkullIcon; @@ -2829,7 +2832,7 @@ void BeginUIMessage( STR16 pFontString, ... ) va_list argptr; CHAR16 MsgString[512]; - va_start(argptr, pFontString); // Set up variable argument pointer + va_start(argptr, pFontString); // Set up variable argument pointer vswprintf(MsgString, pFontString, argptr); // process gprintf string (get output str) va_end(argptr); @@ -2845,7 +2848,7 @@ void BeginMapUIMessage( UINT8 ubPosition, STR16 pFontString, ... ) memset( &VideoOverlayDesc, 0, sizeof( VideoOverlayDesc ) ); - va_start(argptr, pFontString); // Set up variable argument pointer + va_start(argptr, pFontString); // Set up variable argument pointer vswprintf(MsgString, pFontString, argptr); // process gprintf string (get output str) va_end(argptr); @@ -2863,15 +2866,14 @@ void BeginMapUIMessage( UINT8 ubPosition, STR16 pFontString, ... ) // Set it back! ResetOverrideMercPopupBox( ); - if ( giUIMessageOverlay == -1 ) + if ( giUIMessageOverlay == -1 ) { // WDS - bug fix: VideoOverlayDesc must be initialized! - 07/16/2007 memset( &VideoOverlayDesc, 0, sizeof( VIDEO_OVERLAY_DESC ) ); - // Set Overlay - VideoOverlayDesc.sLeft = 20 + MAP_VIEW_START_X + ( MAP_VIEW_WIDTH - gusUIMessageWidth ) / 2; + VideoOverlayDesc.sLeft = 20 + MAP_VIEW_START_X + ( MAP_VIEW_WIDTH - gusUIMessageWidth ) / 2; - VideoOverlayDesc.sTop = MAP_VIEW_START_Y + ( MAP_VIEW_HEIGHT - gusUIMessageHeight ) / 2; + VideoOverlayDesc.sTop = MAP_VIEW_START_Y + ( MAP_VIEW_HEIGHT - gusUIMessageHeight ) / 2; if( ubPosition == MSG_MAP_UI_POSITION_UPPER ) { @@ -2882,13 +2884,13 @@ void BeginMapUIMessage( UINT8 ubPosition, STR16 pFontString, ... ) VideoOverlayDesc.sTop += 100; } - VideoOverlayDesc.sRight = VideoOverlayDesc.sLeft + gusUIMessageWidth; - VideoOverlayDesc.sBottom = VideoOverlayDesc.sTop + gusUIMessageHeight; - VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; - VideoOverlayDesc.sY = VideoOverlayDesc.sTop; + VideoOverlayDesc.sRight = VideoOverlayDesc.sLeft + gusUIMessageWidth; + VideoOverlayDesc.sBottom = VideoOverlayDesc.sTop + gusUIMessageHeight; + VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; + VideoOverlayDesc.sY = VideoOverlayDesc.sTop; VideoOverlayDesc.BltCallback = RenderUIMessage; - giUIMessageOverlay = RegisterVideoOverlay( 0, &VideoOverlayDesc ); + giUIMessageOverlay = RegisterVideoOverlay( 0, &VideoOverlayDesc ); } } @@ -2898,7 +2900,7 @@ void EndUIMessage( ) UINT32 uiClock = GetJA2Clock(); if ( giUIMessageOverlay != -1 ) - { + { if ( gfUseSkullIconMessage ) { if ( ( uiClock - guiUIMessageTime ) < 300 ) @@ -2911,12 +2913,12 @@ void EndUIMessage( ) RemoveVideoOverlay( giUIMessageOverlay ); - // Remove popup as well.... - if ( iUIMessageBox != -1 ) - { - RemoveMercPopupBoxFromIndex( iUIMessageBox ); - iUIMessageBox = -1; - } + // Remove popup as well.... + if ( iUIMessageBox != -1 ) + { + RemoveMercPopupBoxFromIndex( iUIMessageBox ); + iUIMessageBox = -1; + } giUIMessageOverlay = -1; @@ -2939,15 +2941,15 @@ BOOLEAN AddTopMessage( UINT8 ubType, STR16 pzString ) UINT32 cnt; BOOLEAN fFound = FALSE; - // Set time of last update + // Set time of last update gTopMessage.uiTimeOfLastUpdate = GetJA2Clock( ); // Set flag to animate down... //gTopMessage.bAnimate = -1; - //gTopMessage.bYPos = 2; + //gTopMessage.bYPos = 2; gTopMessage.bAnimate = 0; - gTopMessage.bYPos = 20; + gTopMessage.bYPos = 20; gTopMessage.fCreated = TRUE; fFound = TRUE; @@ -2973,8 +2975,8 @@ BOOLEAN AddTopMessage( UINT8 ubType, STR16 pzString ) void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString ) { - UINT32 uiBAR, uiPLAYERBAR, uiINTBAR; - VOBJECT_DESC VObjectDesc; + UINT32 uiBAR, uiPLAYERBAR = 0, uiINTBAR = 0; + VOBJECT_DESC VObjectDesc; INT16 sX, sY; INT32 cnt2; INT16 sBarX = 0; @@ -2989,7 +2991,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) { @@ -2999,11 +3001,6 @@ 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" ); @@ -3014,44 +3011,40 @@ 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); + FilenameForBPP("INTERFACE\\timebaryellow.sti", VObjectDesc.ImageFile); + if( !AddVideoObject( &VObjectDesc, &uiINTBAR ) ) + AssertMsg(0, "Missing INTERFACE\\timebaryellow.sti" ); } 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 ); @@ -3070,7 +3063,7 @@ void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString ) SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( FONT_MCOLOR_WHITE ); uiBarToUseInUpDate = uiBAR; - fDoLimitBar = TRUE; + fDoLimitBar = TRUE; break; case PLAYER_INTERRUPT_MESSAGE: @@ -3110,7 +3103,7 @@ void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString ) INT16 usNumStepsPerEnemy; if ( gfProgBarActive ) - { + { //usNumStepsPerEnemy = ( PROG_BAR_LENGTH / gubProgNumEnemies ); // Alrighty, do some fun stuff! @@ -3120,7 +3113,7 @@ void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString ) BltVideoObjectFromIndex( uiSurface, uiBAR, 3, sBarX, PROG_BAR_START_Y, VO_BLT_SRCTRANSPARENCY, NULL ); // Determine Length - // iLength = (gubProgCurEnemy ) * usNumStepsPerEnemy; + // iLength = (gubProgCurEnemy ) * usNumStepsPerEnemy; cnt1 = 0; cnt2 = 0; @@ -3130,7 +3123,7 @@ void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString ) sBarX++; // Check sBarX, ( just as a precaution ) - if ( sBarX > SCREEN_WIDTH ) + if ( sBarX > SCREEN_WIDTH ) { break; } @@ -3163,9 +3156,9 @@ void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString ) } if ( fDoLimitBar ) - { + { dNumStepsPerEnemy = (FLOAT)( (FLOAT)iProgBarLength / (FLOAT)gTacticalStatus.usTactialTurnLimitMax ); - + //dNumStepsPerEnemy = (FLOAT)( (FLOAT)PROG_BAR_LENGTH / (FLOAT)gTacticalStatus.usTactialTurnLimitMax ); // Alrighty, do some fun stuff! @@ -3175,7 +3168,7 @@ void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString ) BltVideoObjectFromIndex( uiSurface, uiBarToUseInUpDate, 1, sBarX, PROG_BAR_START_Y, VO_BLT_SRCTRANSPARENCY, NULL ); // Determine Length - dLength = ( gTacticalStatus.usTactialTurnLimitCounter ) * dNumStepsPerEnemy; + dLength = ( gTacticalStatus.usTactialTurnLimitCounter ) * dNumStepsPerEnemy; dCurSize = 0; cnt2 = 0; @@ -3205,9 +3198,9 @@ void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString ) if ( gTacticalStatus.usTactialTurnLimitCounter == gTacticalStatus.usTactialTurnLimitMax ) { sBarX++; - BltVideoObjectFromIndex( uiSurface, uiBarToUseInUpDate, (INT16)( 2 + cnt2 ), sBarX, PROG_BAR_START_Y, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObjectFromIndex( uiSurface, uiBarToUseInUpDate, (INT16)( 2 + cnt2 ), sBarX, PROG_BAR_START_Y, VO_BLT_SRCTRANSPARENCY, NULL ); sBarX++; - BltVideoObjectFromIndex( uiSurface, uiBarToUseInUpDate, (INT16)( 12 ), sBarX, PROG_BAR_START_Y, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObjectFromIndex( uiSurface, uiBarToUseInUpDate, (INT16)( 12 ), sBarX, PROG_BAR_START_Y, VO_BLT_SRCTRANSPARENCY, NULL ); } } @@ -3223,7 +3216,7 @@ void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString ) // Draw text.... FindFontCenterCoordinates( SCREEN_WIDTH/2, 7, 1, 1, psString, TINYFONT1, &sX, &sY ); mprintf( sX, sY, psString ); - + // Change back... SetFontDestBuffer( FRAME_BUFFER , 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); @@ -3249,8 +3242,8 @@ void CheckForAndHandleEndPlayerTimeLimit( ) { if ( gTacticalStatus.ubTopMessageType == PLAYER_TURN_MESSAGE || gTacticalStatus.ubTopMessageType == PLAYER_INTERRUPT_MESSAGE ) { - if ( gTacticalStatus.usTactialTurnLimitCounter == ( gTacticalStatus.usTactialTurnLimitMax - 1 ) ) - { + if ( gTacticalStatus.usTactialTurnLimitCounter == ( gTacticalStatus.usTactialTurnLimitMax - 1 ) ) + { // ATE: increase this so that we don't go into here again... gTacticalStatus.usTactialTurnLimitCounter++; @@ -3260,7 +3253,7 @@ void CheckForAndHandleEndPlayerTimeLimit( ) // End turn... UIHandleEndTurn( NULL ); - } + } } } } @@ -3287,10 +3280,10 @@ void HandleTopMessages( ) AddTopMessage( gTacticalStatus.ubTopMessageType, gTacticalStatus.zTopMessageString ); } - if ( gTacticalStatus.ubTopMessageType == COMPUTER_TURN_MESSAGE || - gTacticalStatus.ubTopMessageType == COMPUTER_INTERRUPT_MESSAGE || - gTacticalStatus.ubTopMessageType == MILITIA_INTERRUPT_MESSAGE || - gTacticalStatus.ubTopMessageType == AIR_RAID_TURN_MESSAGE ) + if ( gTacticalStatus.ubTopMessageType == COMPUTER_TURN_MESSAGE || + gTacticalStatus.ubTopMessageType == COMPUTER_INTERRUPT_MESSAGE || + gTacticalStatus.ubTopMessageType == MILITIA_INTERRUPT_MESSAGE || + gTacticalStatus.ubTopMessageType == AIR_RAID_TURN_MESSAGE ) { // OK, update timer..... if ( TIMECOUNTERDONE( giTimerTeamTurnUpdate, PLAYER_TEAM_TIMER_SEC_PER_TICKS ) ) @@ -3304,7 +3297,7 @@ void HandleTopMessages( ) } // Check if we have reach limit... - if ( gTacticalStatus.usTactialTurnLimitCounter >= ( ( gubProgCurEnemy ) * PLAYER_TEAM_TIMER_TICKS_PER_ENEMY ) ) + if ( gTacticalStatus.usTactialTurnLimitCounter >= ( ( gubProgCurEnemy ) * PLAYER_TEAM_TIMER_TICKS_PER_ENEMY ) ) { gTacticalStatus.usTactialTurnLimitCounter = ( ( gubProgCurEnemy ) * PLAYER_TEAM_TIMER_TICKS_PER_ENEMY ); } @@ -3316,11 +3309,11 @@ void HandleTopMessages( ) { if ( gTacticalStatus.ubTopMessageType == PLAYER_TURN_MESSAGE || gTacticalStatus.ubTopMessageType == PLAYER_INTERRUPT_MESSAGE ) { - if ( !gfUserTurnRegionActive && !AreWeInAUIMenu() ) - { + if ( !gfUserTurnRegionActive && !AreWeInAUIMenu() ) + { // Check Grace period... if ( ( GetJA2Clock( ) - gTacticalStatus.uiTactialTurnLimitClock ) > PLAYER_TEAM_TIMER_GRACE_PERIOD ) - { + { gTacticalStatus.uiTactialTurnLimitClock = 0; if ( TIMECOUNTERDONE( giTimerTeamTurnUpdate, PLAYER_TEAM_TIMER_SEC_PER_TICKS ) ) @@ -3363,8 +3356,8 @@ void HandleTopMessages( ) } } } - } - } + } + } } // Set redner viewport value @@ -3374,7 +3367,7 @@ void HandleTopMessages( ) if ( gTopMessage.sWorldRenderX != gsRenderCenterX || gTopMessage.sWorldRenderY != gsRenderCenterY ) { gfTopMessageDirty = TRUE; - } + } if ( gfTopMessageDirty ) { @@ -3383,23 +3376,23 @@ void HandleTopMessages( ) // Redner! BltFx.SrcRect.iLeft = 0; - BltFx.SrcRect.iTop = 20 - gTopMessage.bYPos; + BltFx.SrcRect.iTop = 20 - gTopMessage.bYPos; BltFx.SrcRect.iRight = SCREEN_WIDTH ; BltFx.SrcRect.iBottom = 20; - BltVideoSurface( FRAME_BUFFER, gTopMessage.uiSurface, 0, - 0, 0, - VS_BLT_SRCSUBRECT, &BltFx ); + BltVideoSurface( FRAME_BUFFER, gTopMessage.uiSurface, 0, + 0, 0, + VS_BLT_SRCSUBRECT, &BltFx ); // Save to save buffer.... BltFx.SrcRect.iLeft = 0; - BltFx.SrcRect.iTop = 0; + BltFx.SrcRect.iTop = 0; BltFx.SrcRect.iRight = SCREEN_WIDTH; BltFx.SrcRect.iBottom = 20; - BltVideoSurface( guiSAVEBUFFER, FRAME_BUFFER, 0, - 0, 0, - VS_BLT_SRCSUBRECT, &BltFx ); + BltVideoSurface( guiSAVEBUFFER, FRAME_BUFFER, 0, + 0, 0, + VS_BLT_SRCSUBRECT, &BltFx ); InvalidateRegion( 0, 0, SCREEN_WIDTH, 20 ); @@ -3410,7 +3403,7 @@ void HandleTopMessages( ) else { // Set redner viewport value - gsVIEWPORT_WINDOW_START_Y = 0; + gsVIEWPORT_WINDOW_START_Y = 0; } } @@ -3426,7 +3419,7 @@ void EndTopMessage( ) // Are we the last? //if ( gTopMessage.bCurrentMessage == 1 ) { - // We are.... + // We are.... // Re-render our strip and then copy to the save buffer... gsVIEWPORT_WINDOW_START_Y = 0; gTacticalStatus.fInTopMessage = FALSE; @@ -3437,23 +3430,23 @@ void EndTopMessage( ) // Copy into save buffer... //BltFx.SrcRect.iLeft = 0; - //BltFx.SrcRect.iTop = 0; + //BltFx.SrcRect.iTop = 0; //BltFx.SrcRect.iRight = 640; //BltFx.SrcRect.iBottom = 20; - //BltVideoSurface( guiSAVEBUFFER, FRAME_BUFFER, 0, - // 0, 0, - // VS_BLT_SRCSUBRECT, &BltFx ); + //BltVideoSurface( guiSAVEBUFFER, FRAME_BUFFER, 0, + // 0, 0, + // VS_BLT_SRCSUBRECT, &BltFx ); } //else //{ // Render to save buffer - // CreateTopMessage( guiSAVEBUFFER, gTopMessageTypes[ 0 ], gzTopMessageStrings[ 0 ] ); + // CreateTopMessage( guiSAVEBUFFER, gTopMessageTypes[ 0 ], gzTopMessageStrings[ 0 ] ); //} // Animate up... //gTopMessage.bAnimate = 1; - // Set time of last update + // Set time of last update //gTopMessage.uiTimeOfLastUpdate = GetJA2Clock( ) + 150; // Handle first frame now... @@ -3545,7 +3538,7 @@ void InitPlayerUIBar( BOOLEAN fInterrupt ) } else { - //EndTopMessage(); + //EndTopMessage(); AddTopMessage( PLAYER_TURN_MESSAGE, TeamTurnString[0] ); } return; @@ -3559,13 +3552,13 @@ void InitPlayerUIBar( BOOLEAN fInterrupt ) // IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED! cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++) - { + { // Are we active and in sector..... if ( pTeamSoldier->bActive && pTeamSoldier->bInSector ) { - if ( pTeamSoldier->bLife < OKLIFE ) + if ( pTeamSoldier->stats.bLife < OKLIFE ) { bNumNotOK++; } @@ -3582,7 +3575,7 @@ void InitPlayerUIBar( BOOLEAN fInterrupt ) { if ( gTacticalStatus.usTactialTurnLimitCounter > PLAYER_TEAM_TIMER_INTTERUPT_GRACE ) { - gTacticalStatus.usTactialTurnLimitCounter -= PLAYER_TEAM_TIMER_INTTERUPT_GRACE; + gTacticalStatus.usTactialTurnLimitCounter -= PLAYER_TEAM_TIMER_INTTERUPT_GRACE; } } @@ -3625,7 +3618,7 @@ void DoorMenuBackregionCallback( MOUSE_REGION * pRegion, INT32 iReason ) STR16 GetSoldierHealthString( SOLDIERTYPE *pSoldier ) { INT32 cnt, cntStart; - if( pSoldier->bLife == pSoldier->bLifeMax ) + if( pSoldier->stats.bLife == pSoldier->stats.bLifeMax ) { cntStart = 4; } @@ -3636,7 +3629,7 @@ STR16 GetSoldierHealthString( SOLDIERTYPE *pSoldier ) //Show health on others......... for ( cnt = cntStart; cnt < 6; cnt ++ ) { - if ( pSoldier->bLife < bHealthStrRanges[ cnt ] ) + if ( pSoldier->stats.bLife < bHealthStrRanges[ cnt ] ) { break; } @@ -3669,7 +3662,7 @@ typedef struct static BOOLEAN gfInAimCubeUI = FALSE; static AIMCUBE_UI_DATA gCubeUIData; -#define GET_CUBES_HEIGHT_FROM_UIHEIGHT( h ) ( 32 + ( h * 64 ) ) +#define GET_CUBES_HEIGHT_FROM_UIHEIGHT( h ) ( 32 + ( h * 64 ) ) @@ -3725,7 +3718,7 @@ BOOLEAN AimCubeUIClick( ) if ( gCubeUIData.fActiveHeightBar && gCubeUIData.bHeight != 0 ) { gCubeUIData.fShowPower = TRUE; - gCubeUIData.fActiveHeightBar = FALSE; + gCubeUIData.fActiveHeightBar = FALSE; gCubeUIData.fActivePowerBar = TRUE; return( FALSE ); @@ -3749,7 +3742,7 @@ void BeginAimCubeUI( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 ubLevel, UINT8 b gCubeUIData.fShowPower = FALSE; gCubeUIData.fActivePowerBar = FALSE; gCubeUIData.fActiveHeightBar = TRUE; - gCubeUIData.fAtEndHeight = FALSE; + gCubeUIData.fAtEndHeight = FALSE; gCubeUIData.dDegrees = (float)PI/4; @@ -3844,7 +3837,7 @@ void ResetAimCubeAI( ) void RenderAimCubeUI( ) { - INT16 sScreenX, sScreenY; + INT16 sScreenX = 0, sScreenY = 0; INT32 cnt; INT16 sBarHeight; INT32 iBack; @@ -3852,14 +3845,15 @@ 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 ) ); + iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, sScreenX, (INT16)(sScreenY - 70 ), (INT16)(sScreenX + 40 ), (INT16)(sScreenY + 50 ) ); if ( iBack != -1 ) { SetBackgroundRectFilled( iBack ); @@ -3888,7 +3882,7 @@ void RenderAimCubeUI( ) sBarHeight -= 3; BltVideoObjectFromIndex( FRAME_BUFFER, guiAIMCUBES, bGraphicNum, sScreenX, ( sScreenY + sBarHeight ), VO_BLT_SRCTRANSPARENCY, NULL ); sBarHeight -= 3; - BltVideoObjectFromIndex( FRAME_BUFFER, guiAIMCUBES, bGraphicNum, sScreenX, ( sScreenY + sBarHeight ), VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObjectFromIndex( FRAME_BUFFER, guiAIMCUBES, bGraphicNum, sScreenX, ( sScreenY + sBarHeight ), VO_BLT_SRCTRANSPARENCY, NULL ); } } @@ -3912,8 +3906,8 @@ void GetLaunchItemParamsFromUI( ) static BOOLEAN gfDisplayPhysicsUI = FALSE; -static INT16 gsPhysicsImpactPointGridNo; -static INT8 gbPhysicsImpactPointLevel; +static INT16 gsPhysicsImpactPointGridNo; +static INT8 gbPhysicsImpactPointLevel; static BOOLEAN gfBadPhysicsCTGT = FALSE; void BeginPhysicsTrajectoryUI( INT16 sGridNo, INT8 bLevel, BOOLEAN fBadCTGT ) @@ -3978,7 +3972,7 @@ void ResetPhysicsTrajectoryUI( ) void DirtyTopMessage( ) { - gTopMessage.fCreated = FALSE; + gTopMessage.fCreated = FALSE; } @@ -3990,38 +3984,38 @@ UINT32 CalcUIMessageDuration( STR16 wString ) } -BOOLEAN gfMultipurposeLocatorOn = FALSE; -UINT32 guiMultiPurposeLocatorLastUpdate; -INT8 gbMultiPurposeLocatorFrame; -INT16 gsMultiPurposeLocatorGridNo; -INT8 gbMultiPurposeLocatorLevel; -INT8 gbMultiPurposeLocatorCycles; +BOOLEAN gfMultipurposeLocatorOn = FALSE; +UINT32 guiMultiPurposeLocatorLastUpdate; +INT8 gbMultiPurposeLocatorFrame; +INT16 gsMultiPurposeLocatorGridNo; +INT8 gbMultiPurposeLocatorLevel; +INT8 gbMultiPurposeLocatorCycles; void BeginMultiPurposeLocator( INT16 sGridNo, INT8 bLevel, BOOLEAN fSlideTo ) { - guiMultiPurposeLocatorLastUpdate = 0; - gbMultiPurposeLocatorCycles = 0; - gbMultiPurposeLocatorFrame = 0; - gfMultipurposeLocatorOn = TRUE; + guiMultiPurposeLocatorLastUpdate = 0; + gbMultiPurposeLocatorCycles = 0; + gbMultiPurposeLocatorFrame = 0; + gfMultipurposeLocatorOn = TRUE; - gsMultiPurposeLocatorGridNo = sGridNo; - gbMultiPurposeLocatorLevel = bLevel; + gsMultiPurposeLocatorGridNo = sGridNo; + gbMultiPurposeLocatorLevel = bLevel; - if ( fSlideTo ) - { - // FIRST CHECK IF WE ARE ON SCREEN - if ( GridNoOnScreen( sGridNo ) ) - { - return; - } + if ( fSlideTo ) + { + // FIRST CHECK IF WE ARE ON SCREEN + if ( GridNoOnScreen( sGridNo ) ) + { + return; + } - // sGridNo here for DG compatibility - gTacticalStatus.sSlideTarget = sGridNo; - gTacticalStatus.sSlideReason = NOBODY; + // sGridNo here for DG compatibility + gTacticalStatus.sSlideTarget = sGridNo; + gTacticalStatus.sSlideReason = NOBODY; - // Plot new path! - gfPlotNewMovement = TRUE; - } + // Plot new path! + gfPlotNewMovement = TRUE; + } } @@ -4029,14 +4023,14 @@ void HandleMultiPurposeLocator( ) { UINT32 uiClock; - if ( !gfMultipurposeLocatorOn ) - { - return; - } + if ( !gfMultipurposeLocatorOn ) + { + return; + } // Update radio locator uiClock = GetJA2Clock( ); - + // Update frame values! if ( ( uiClock - guiMultiPurposeLocatorLastUpdate ) > 80 ) { @@ -4048,13 +4042,13 @@ void HandleMultiPurposeLocator( ) if ( gbMultiPurposeLocatorFrame == 5 ) { gbMultiPurposeLocatorFrame = 0; - gbMultiPurposeLocatorCycles++; + gbMultiPurposeLocatorCycles++; } - if ( gbMultiPurposeLocatorCycles == 8 ) - { - gfMultipurposeLocatorOn = FALSE; - } + if ( gbMultiPurposeLocatorCycles == 8 ) + { + gfMultipurposeLocatorOn = FALSE; + } } } @@ -4067,10 +4061,10 @@ void RenderTopmostMultiPurposeLocator( ) INT16 sX, sY, sXPos, sYPos; INT32 iBack; - if ( !gfMultipurposeLocatorOn ) - { - return; - } + if ( !gfMultipurposeLocatorOn ) + { + return; + } ConvertGridNoToCenterCellXY( gsMultiPurposeLocatorGridNo, &sX, &sY ); @@ -4086,7 +4080,7 @@ void RenderTopmostMultiPurposeLocator( ) // Adjust for offset position on screen sXPos -= gsRenderWorldOffsetX; sYPos -= gsRenderWorldOffsetY; - + // Adjust for render height sYPos += gsRenderHeight; @@ -4100,12 +4094,12 @@ void RenderTopmostMultiPurposeLocator( ) sXPos -= 20; sYPos -= 20; - iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, sXPos, sYPos, (INT16)(sXPos +40 ), (INT16)(sYPos + 40 ) ); + iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, sXPos, sYPos, (INT16)(sXPos +40 ), (INT16)(sYPos + 40 ) ); if ( iBack != -1 ) { SetBackgroundRectFilled( iBack ); } - BltVideoObjectFromIndex( FRAME_BUFFER, guiRADIO, gbMultiPurposeLocatorFrame, sXPos, sYPos, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObjectFromIndex( FRAME_BUFFER, guiRADIO, gbMultiPurposeLocatorFrame, sXPos, sYPos, VO_BLT_SRCTRANSPARENCY, NULL ); } diff --git a/Tactical/Interface.h b/Tactical/Interface.h index 7c70992c..3ea5724e 100644 --- a/Tactical/Interface.h +++ b/Tactical/Interface.h @@ -84,6 +84,7 @@ extern UINT32 guiGUNSM; extern UINT32 guiP1ITEMS; extern UINT32 guiP2ITEMS; extern UINT32 guiP3ITEMS; +extern UINT32 guiSILHOUETTE; extern UINT32 guiCOMPANEL; extern UINT32 guiCOMPANELB; extern UINT32 guiRADIO; @@ -94,7 +95,7 @@ extern UINT32 guiITEMPOINTERHATCHES; extern MOUSE_REGION gViewportRegion; extern MOUSE_REGION gRadarRegion; -extern MOUSE_REGION gBottomPanalRegion; +extern MOUSE_REGION gBottomPanalRegion; #define MOVEMENT_MENU_LOOK 1 #define MOVEMENT_MENU_ACTIONC 2 diff --git a/Tactical/Inventory Choosing.cpp b/Tactical/Inventory Choosing.cpp index b2fa35c4..e1196f0e 100644 --- a/Tactical/Inventory Choosing.cpp +++ b/Tactical/Inventory Choosing.cpp @@ -88,6 +88,9 @@ void EquipTank( SOLDIERCREATE_STRUCT *pp ); void ChooseKitsForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bKitClass ); void ChooseMiscGearForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bMiscClass ); void ChooseBombsForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bBombClass ); +// Headrock: Added function definition for LBE chooser +void ChooseLBEsForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bLBEClass ); + UINT16 PickARandomItem(UINT8 typeIndex); UINT16 PickARandomItem(UINT8 typeIndex, UINT8 maxCoolness); UINT16 PickARandomItem(UINT8 typeIndex, UINT8 maxCoolness, BOOLEAN getMatchingCoolness); @@ -131,7 +134,7 @@ void InitArmyGunTypes(void) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"InitArmyGunTypes mark weapons as not dropped"); // set all flags that track whether this weapon type has been dropped before to FALSE - for (ubWeapon = 0; ubWeapon < MAXITEMS; ubWeapon++) + for (ubWeapon = 0; ubWeapon < MAXITEMS; ubWeapon++) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("InitArmyGunTypes marking weapons %d", ubWeapon)); gStrategicStatus.fWeaponDroppedAlready[ubWeapon] = FALSE; @@ -176,7 +179,7 @@ void MarkAllWeaponsOfSameGunClassAsDropped( UINT16 usWeapon ) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"MarkAllWeaponsOfSameGunClassAsDropped"); - + // mark that item itself as dropped, whether or not it's part of a gun class gStrategicStatus.fWeaponDroppedAlready[ usWeapon ] = TRUE; @@ -197,7 +200,7 @@ void MarkAllWeaponsOfSameGunClassAsDropped( UINT16 usWeapon ) -//Chooses equipment based on the relative equipment level (0-4) with best being 4. It allocates a range +//Chooses equipment based on the relative equipment level (0-4) with best being 4. It allocates a range //of equipment to choose from. //NOTE: I'm just winging it for the decisions on which items that different groups can have. Basically, // there are variations, so a guy at a certain level may get a better gun and worse armour or vice versa. @@ -222,12 +225,14 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8 INT8 bKitClass = 0; INT8 bMiscClass = 0; INT8 bBombClass = 0; + // Headrock: Added Zeroed LBE integer + INT8 bLBEClass = 0; //special weapons BOOLEAN fMortar = FALSE; BOOLEAN fGrenadeLauncher = FALSE; BOOLEAN fLAW = FALSE; BOOLEAN fRPG = FALSE; - INT32 i; + UINT32 i; INT8 bEquipmentModifier; UINT8 ubMaxSpecialWeaponRoll; @@ -289,8 +294,10 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8 bRating = (INT8)max( MIN_EQUIPMENT_CLASS, min( MAX_EQUIPMENT_CLASS, bRating ) ); bWeaponClass = bRating; + //Headrocktest, remove for release + bLBEClass = bRating; - //Note: in some cases the class of armour and/or helmet won't be high enough to make + //Note: in some cases the class of armour and/or helmet won't be high enough to make // the lowest level. bVestClass = bRating; bHelmetClass = bRating; @@ -307,6 +314,8 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8 bKitClass = bRating; bMiscClass = bRating; + // Headrock: Low Level LBEs possible on Administrators: + bLBEClass = bRating; } if( bRating >= GREAT_ADMINISTRATOR_EQUIPMENT_RATING ) @@ -337,6 +346,9 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8 bVestClass = bRating; bHelmetClass = bRating; bGrenadeClass = bRating; + // Headrock: Added LBE set to Coolness Rating + bLBEClass = bRating; + if( ( bRating >= GOOD_ARMY_EQUIPMENT_RATING ) && ( Random( 100 ) < 33 ) ) { @@ -373,6 +385,10 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8 if( Random( 2 ) ) bKnifeClass = bRating; + // Headrock: Chance for soldier to carry better LBE + if( Chance( 50 ) ) + bLBEClass++; + if( ( bRating > MIN_EQUIPMENT_CLASS ) && bRating < MAX_EQUIPMENT_CLASS ) { switch( Random( 7 ) ) @@ -454,6 +470,9 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8 bKitClass = bRating; bMiscClass = bRating; + // Headrock: Elite LBEs + bLBEClass = bRating; + if ( Chance( 25 ) ) { bBombClass = bRating; @@ -473,15 +492,17 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8 if( ( bRating > MIN_EQUIPMENT_CLASS ) && bRating < MAX_EQUIPMENT_CLASS ) { - switch( Random( 11 ) ) + UINT32 uiRange = ((UsingNewInventorySystem() == false)) ? Random(11) : Random(12); + switch( uiRange ) { case 4: bWeaponClass++, bVestClass--; break; case 5: bWeaponClass--, bVestClass--; break; case 6: bVestClass++, bHelmetClass--; break; - case 7: bGrenades += 2; break; - case 8: bHelmetClass++; break; - case 9: bVestClass++; break; - case 10: bWeaponClass++; break; + case 7: bGrenades += 2; break; + case 8: bHelmetClass++; break; + case 9: bVestClass++; break; + case 10: bWeaponClass++; break; + case 11: bLBEClass++; break; } } @@ -528,15 +549,16 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8 break; } - for ( i = 0; i < NUM_INV_SLOTS; i++ ) + for ( i = 0; i < pp->Inv.size(); i++ ) { //clear items, but only if they have write status. if( !(pp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE) ) { - memset( &(pp->Inv[ i ]), 0, sizeof( OBJECTTYPE ) ); + DeleteObj(&pp->Inv[ i ]); + //ADB this is ok, delete only inits it pp->Inv[ i ].fFlags |= OBJECT_UNDROPPABLE; } else - { //check to see what kind of item is here. If we find a gun, for example, it'll make the + { //check to see what kind of item is here. If we find a gun, for example, it'll make the //bWeaponClass negative to signify that a gun has already been specified, and later //code will use that to determine that and to pick ammo for it. pItem = &pp->Inv[ i ]; @@ -553,7 +575,7 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8 { fLAW = FALSE; } - pItem->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; + (*pItem)[0]->data.gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; break; case IC_AMMO: bAmmoClips = 0; @@ -563,7 +585,7 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8 bKnifeClass = 0; break; case IC_LAUNCHER: - pItem->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; + (*pItem)[0]->data.gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; fGrenadeLauncher = FALSE; if (fMortar || fRPG) { @@ -594,6 +616,10 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8 case IC_BOMB: bBombClass = 0; break; + // Headrock: Added failsafe for LBEs + case IC_LBEGEAR: + bLBEClass = 0; + break; } } } @@ -609,6 +635,8 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8 //Now actually choose the equipment! ChooseWeaponForSoldierCreateStruct( pp, bWeaponClass, bAmmoClips, bAttachClass, fAttachment ); + // Headrock: This is where the program calls LBE choosing + ChooseLBEsForSoldierCreateStruct( pp, bLBEClass ); ChooseSpecialWeaponsForSoldierCreateStruct( pp, bKnifeClass, fGrenadeLauncher, fLAW, fMortar, fRPG ); ChooseGrenadesForSoldierCreateStruct( pp, bGrenades, bGrenadeClass, fGrenadeLauncher ); ChooseArmourForSoldierCreateStruct( pp, bHelmetClass, bVestClass, bLeggingClass ); @@ -616,6 +644,9 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8 ChooseKitsForSoldierCreateStruct( pp, bKitClass ); ChooseMiscGearForSoldierCreateStruct( pp, bMiscClass ); ChooseBombsForSoldierCreateStruct( pp, bBombClass ); + //ADB why is this here twice? + // Headrock: This is where the program calls LBE choosing + ChooseLBEsForSoldierCreateStruct( pp, bLBEClass ); ChooseLocationSpecificGearForSoldierCreateStruct( pp ); RandomlyChooseWhichItemsAreDroppable( pp, bSoldierClass ); @@ -623,18 +654,16 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8 } -//When using the class values, they should all range from 0-11, 0 meaning that there will be no +//When using the class values, they should all range from 0-11, 0 meaning that there will be no //selection for that particular type of item, and 1-11 means to choose an item if possible. 1 is //the worst class of item, while 11 is the best. -void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponClass, +void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponClass, INT8 bAmmoClips, INT8 bAttachClass, BOOLEAN fAttachment ) { //INVTYPE *pItem; - OBJECTTYPE Object; UINT16 i; //UINT16 usRandom; - UINT16 usNumMatches = 0; UINT16 usGunIndex = 0; UINT16 usAmmoIndex = 0; UINT16 usAttachIndex = 0; @@ -648,14 +677,14 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC // Choose weapon: // WEAPONS are very important, and are therefore handled differently using special pre-generated tables. // It was requested that enemies use only a small subset of guns with a lot duplication of the same gun type. - + // if gun was pre-selected (rcvd negative weapon class) and needs ammo if( bWeaponClass < 0 && bAmmoClips ) - { //Linda has added a specific gun to the merc's inventory, but no ammo. So, we + { //Linda has added a specific gun to the merc's inventory, but no ammo. So, we //will choose ammunition that works with the gun. - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( i = 0; i < pp->Inv.size(); i++ ) { - if( Item[ pp->Inv[ i ].usItem ].usItemClass == IC_GUN ) + if( Item[ pp->Inv[ i ].usItem ].usItemClass == IC_GUN && pp->Inv[ i ].exists() == true) { usGunIndex = pp->Inv[ i ].usItem; ubChanceStandardAmmo = 100 - (bWeaponClass * -9); // weapon class is negative! @@ -664,12 +693,12 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC if ( usAmmoIndex <= 0 ) usAmmoIndex = DefaultMagazine(usGunIndex); - pp->Inv[ i ].ItemData.Gun.ubGunAmmoType = Magazine[Item[usAmmoIndex].ubClassIndex].ubAmmoType; - pp->Inv[ i ].ItemData.Gun.usGunAmmoItem = usAmmoIndex; + pp->Inv[ i ][0]->data.gun.ubGunAmmoType = Magazine[Item[usAmmoIndex].ubClassIndex].ubAmmoType; + pp->Inv[ i ][0]->data.gun.usGunAmmoItem = usAmmoIndex; if ( Item[usGunIndex].fingerprintid ) { - pp->Inv[ i ].ubImprintID = (NO_PROFILE + 1); + pp->Inv[ i ][0]->data.ubImprintID = (NO_PROFILE + 1); } break; @@ -677,9 +706,9 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC } if( bAmmoClips && usAmmoIndex ) { - CreateItems( usAmmoIndex, 100, bAmmoClips, &Object ); - Object.fFlags |= OBJECT_UNDROPPABLE; - PlaceObjectInSoldierCreateStruct( pp, &Object ); + CreateItems( usAmmoIndex, 100, bAmmoClips, &gTempObject ); + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); } return; @@ -720,12 +749,12 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC usAttachIndex = 0; else { - //check for incompatibilities + //check for incompatibilities for(i = 0;i 0 && Random(2) ) { usAttachIndex2 = PickARandomAttachment(ATTACHMENTS,usGunIndex,bAttachClass,FALSE); - + //check for incompatibilities with 1st attachment for(i = 0;iusItemClass == IC_MISC && pItem->ubCoolness <= bAttachClass && ) - // { + // { // if( usRandom ) // usRandom--; // else // { // usAttachIndex = i; // break; - // } + // } // } // } - // } + // } //} +#endif //obsoleteCode } //Now, we have chosen all of the correct items. Now, we will assign them into the slots. //Because we are dealing with enemies, automatically give them full ammo in their weapon. - if( !(pp->Inv[ HANDPOS ].fFlags & OBJECT_NO_OVERWRITE) ) + switch( pp->ubSoldierClass ) { - switch( pp->ubSoldierClass ) - { - case SOLDIER_CLASS_ADMINISTRATOR: - case SOLDIER_CLASS_ARMY: - case SOLDIER_CLASS_GREEN_MILITIA: - case SOLDIER_CLASS_REG_MILITIA: - //Admins/Troops: 60-75% + 1% every 4% progress - bStatus = (INT8)(60 + Random( 16 )); - bStatus += (INT8)(HighestPlayerProgressPercentage() / 4); - bStatus = (INT8)min( 100, bStatus ); - break; - case SOLDIER_CLASS_ELITE: - case SOLDIER_CLASS_ELITE_MILITIA: - //85-90% + 1% every 10% progress - bStatus = (INT8)(85 + Random( 6 )); - bStatus += (INT8)(HighestPlayerProgressPercentage() / 10); - bStatus = (INT8)min( 100, bStatus ); - break; - default: - bStatus = (INT8)(50 + Random( 51 ) ); - break; - } - // don't allow it to be lower than marksmanship, we don't want it to affect their chances of hitting - bStatus = (INT8)max( pp->bMarksmanship, bStatus ); - - - CreateItem( usGunIndex, bStatus, &(pp->Inv[ HANDPOS ]) ); - pp->Inv[ HANDPOS ].fFlags |= OBJECT_UNDROPPABLE; - - // Rocket Rifles must come pre-imprinted, in case carrier gets killed without getting a shot off - if ( Item[usGunIndex].fingerprintid ) - { - pp->Inv[ HANDPOS ].ubImprintID = (NO_PROFILE + 1); - } + case SOLDIER_CLASS_ADMINISTRATOR: + case SOLDIER_CLASS_ARMY: + case SOLDIER_CLASS_GREEN_MILITIA: + case SOLDIER_CLASS_REG_MILITIA: + //Admins/Troops: 60-75% + 1% every 4% progress + bStatus = (INT8)(60 + Random( 16 )); + bStatus += (INT8)(HighestPlayerProgressPercentage() / 4); + bStatus = (INT8)min( 100, bStatus ); + break; + case SOLDIER_CLASS_ELITE: + case SOLDIER_CLASS_ELITE_MILITIA: + //85-90% + 1% every 10% progress + bStatus = (INT8)(85 + Random( 6 )); + bStatus += (INT8)(HighestPlayerProgressPercentage() / 10); + bStatus = (INT8)min( 100, bStatus ); + break; + default: + bStatus = (INT8)(50 + Random( 51 ) ); + break; } - else + // don't allow it to be lower than marksmanship, we don't want it to affect their chances of hitting + bStatus = (INT8)max( pp->bMarksmanship, bStatus ); + + + CreateItem( usGunIndex, bStatus, &(pp->Inv[ HANDPOS ]) ); + pp->Inv[ HANDPOS ].fFlags |= OBJECT_UNDROPPABLE; + + // Rocket Rifles must come pre-imprinted, in case carrier gets killed without getting a shot off + if ( Item[usGunIndex].fingerprintid ) + { + pp->Inv[ HANDPOS ][0]->data.ubImprintID = (NO_PROFILE + 1); + } + + if( (pp->Inv[ HANDPOS ].fFlags & OBJECT_NO_OVERWRITE) ) { //slot locked, so don't add any attachments to it! usAttachIndex = 0; } @@ -886,28 +915,28 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC if( usScopeIndex > 0 && ValidItemAttachment(&(pp->Inv[ HANDPOS ]),usScopeIndex,TRUE,FALSE) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ChooseWeaponForSoldierCreateStruct: Create Scope %d",usScopeIndex)); - CreateItem( usScopeIndex, 100, &Object ); - Object.fFlags |= OBJECT_UNDROPPABLE; - AttachObject( NULL, &(pp->Inv[ HANDPOS ]), &Object ); + CreateItem( usScopeIndex, 100, &gTempObject ); + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + pp->Inv[ HANDPOS ].AttachObject( NULL, &gTempObject ); } if( usAttachIndex > 0 && ValidItemAttachment(&(pp->Inv[ HANDPOS ]),usAttachIndex,TRUE,FALSE)) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ChooseWeaponForSoldierCreateStruct: Create Attachment %d",usAttachIndex)); - CreateItem( usAttachIndex, 100, &Object ); - Object.fFlags |= OBJECT_UNDROPPABLE; - AttachObject( NULL, &(pp->Inv[ HANDPOS ]), &Object ); + CreateItem( usAttachIndex, 100, &gTempObject ); + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + pp->Inv[ HANDPOS ].AttachObject( NULL, &gTempObject ); } if( usAttachIndex2 > 0 && ValidItemAttachment(&(pp->Inv[ HANDPOS ]),usAttachIndex2,TRUE,FALSE)) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ChooseWeaponForSoldierCreateStruct: Create 2nd Attachment %d",usAttachIndex2)); - CreateItem( usAttachIndex2, 100, &Object ); - Object.fFlags |= OBJECT_UNDROPPABLE; - AttachObject( NULL, &(pp->Inv[ HANDPOS ]), &Object ); + CreateItem( usAttachIndex2, 100, &gTempObject ); + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + pp->Inv[ HANDPOS ].AttachObject( NULL, &gTempObject ); } DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ChooseWeaponForSoldierCreateStruct: Set bullets")); //set bullets = to magsize including any attachments (c-mag adapters, etc) - pp->Inv[ HANDPOS ].ItemData.Gun.ubGunShotsLeft = GetMagSize(&pp->Inv[ HANDPOS ]); + pp->Inv[ HANDPOS ][0]->data.gun.ubGunShotsLeft = GetMagSize(&pp->Inv[ HANDPOS ]); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ChooseWeaponForSoldierCreateStruct: choose ammo")); if( bAmmoClips ) @@ -937,8 +966,8 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC if ( usAmmoIndex <= 0 ) usAmmoIndex = DefaultMagazine(usGunIndex); - pp->Inv[ HANDPOS ].ItemData.Gun.ubGunAmmoType = Magazine[Item[usAmmoIndex].ubClassIndex].ubAmmoType; - pp->Inv[ HANDPOS ].ItemData.Gun.usGunAmmoItem = usAmmoIndex; + pp->Inv[ HANDPOS ][0]->data.gun.ubGunAmmoType = Magazine[Item[usAmmoIndex].ubClassIndex].ubAmmoType; + pp->Inv[ HANDPOS ][0]->data.gun.usGunAmmoItem = usAmmoIndex; } //Ammo @@ -946,14 +975,14 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC if( bAmmoClips && usAmmoIndex ) { //Madd: ensure a minimum # of bullets to make sure enemies don't run out and run away - while ( ( bAmmoClips * Weapon[usGunIndex].ubMagSize - Weapon[usGunIndex].ubMagSize) < 20 ) // each soldier should have at least 20 bullets, ie: 2 9mm 15rd clips, 3 7rd shotgun shells, 4 6rd speedloaders, etc. + while ( ( bAmmoClips * Weapon[usGunIndex].ubMagSize - Weapon[usGunIndex].ubMagSize) < 20 ) // each soldier should have at least 20 bullets, ie: 2 9mm 15rd clips, 3 7rd shotgun shells, 4 6rd speedloaders, etc. { bAmmoClips++; } - CreateItems( usAmmoIndex, 100, bAmmoClips, &Object ); - Object.fFlags |= OBJECT_UNDROPPABLE; - PlaceObjectInSoldierCreateStruct( pp, &Object ); + CreateItems( usAmmoIndex, 100, bAmmoClips, &gTempObject ); + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); } DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ChooseWeaponForSoldierCreateStruct: done")); @@ -961,19 +990,11 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC void ChooseGrenadesForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bGrenades, INT8 bGrenadeClass, BOOLEAN fGrenadeLauncher ) { - OBJECTTYPE Object; INT16 sNumPoints; UINT16 usItem; UINT8 ubBaseQuality; UINT8 ubQualityVariation; //numbers of each type the player will get! - UINT8 ubNumStun = 0; - UINT8 ubNumTear = 0; - UINT8 ubNumMustard = 0; - UINT8 ubNumMini = 0; - UINT8 ubNumReg = 0; - UINT8 ubNumSmoke = 0; - UINT8 ubNumFlare = 0; UINT8 count = 0; DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"ChooseGrenadesForSoldierCreateStruct"); @@ -998,9 +1019,9 @@ void ChooseGrenadesForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bGrena usItem = PickARandomLaunchable ( itemMortar ); if ( usItem > 0 ) { - CreateItems( usItem, (INT8) (80 + Random(21)), bGrenades, &Object ); - Object.fFlags |= OBJECT_UNDROPPABLE; - PlaceObjectInSoldierCreateStruct( pp, &Object ); + CreateItems( usItem, (INT8) (80 + Random(21)), bGrenades, &gTempObject ); + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); } } @@ -1022,9 +1043,9 @@ void ChooseGrenadesForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bGrena { for ( int i = 0; i < bGrenades; i++ ) { - CreateItem( usItem, (INT8) (70 + Random(31)), &Object ); - Object.fFlags |= OBJECT_UNDROPPABLE; - PlaceObjectInSoldierCreateStruct( pp, &Object ); + CreateItem( usItem, (INT8) (70 + Random(31)), &gTempObject ); + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); } } @@ -1052,9 +1073,9 @@ void ChooseGrenadesForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bGrena usItem = PickARandomLaunchable ( itemGrenadeLauncher ); if ( usItem > 0 && count > 0 ) { - CreateItems( usItem, (INT8)(ubBaseQuality + Random( ubQualityVariation )), count, &Object ); - Object.fFlags |= OBJECT_UNDROPPABLE; - PlaceObjectInSoldierCreateStruct( pp, &Object ); + CreateItems( usItem, (INT8)(ubBaseQuality + Random( ubQualityVariation )), count, &gTempObject ); + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); } bGrenades -= count; } @@ -1074,15 +1095,15 @@ void ChooseGrenadesForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bGrena usItem = PickARandomItem ( GRENADE , bGrenadeClass, FALSE ); if ( usItem > 0 && count > 0 ) { - CreateItems( usItem, (INT8)(ubBaseQuality + Random( ubQualityVariation )), count, &Object ); - Object.fFlags |= OBJECT_UNDROPPABLE; - PlaceObjectInSoldierCreateStruct( pp, &Object ); + CreateItems( usItem, (INT8)(ubBaseQuality + Random( ubQualityVariation )), count, &gTempObject ); + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); } bGrenades -= count; } return; - +#ifdef obsoleteCode ////now, purchase the grenades. //while( sNumPoints > 0 ) //{ @@ -1104,7 +1125,7 @@ void ChooseGrenadesForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bGrena // } // // if grenade launcher, pick regular instead // case 1: ubNumReg++; sNumPoints -= 9; break; - // case 2: if ( !fGrenadeLauncher ) + // case 2: if ( !fGrenadeLauncher ) // { // ubNumMini++; sNumPoints -= 7; break; // } @@ -1114,7 +1135,7 @@ void ChooseGrenadesForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bGrena // case 5: ubNumSmoke++; sNumPoints -= 4; break; // case 6: if (!fGrenadeLauncher ) // { - // ubNumFlare++; sNumPoints -= 3; + // ubNumFlare++; sNumPoints -= 3; // } // break; // } @@ -1212,9 +1233,9 @@ void ChooseGrenadesForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bGrena // { // usItem = SMOKE_GRENADE; // } - // CreateItems( usItem, (INT8)(ubBaseQuality + Random( ubQualityVariation )), ubNumSmoke, &Object ); - // Object.fFlags |= OBJECT_UNDROPPABLE; - // PlaceObjectInSoldierCreateStruct( pp, &Object ); + // CreateItems( usItem, (INT8)(ubBaseQuality + Random( ubQualityVariation )), ubNumSmoke, &gTempObject ); + // gTempObject.fFlags |= OBJECT_UNDROPPABLE; + // PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); //} //if( ubNumTear ) //{ @@ -1226,9 +1247,9 @@ void ChooseGrenadesForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bGrena // { // usItem = TEARGAS_GRENADE; // } - // CreateItems( usItem, (INT8)(ubBaseQuality + Random( ubQualityVariation )), ubNumTear, &Object ); - // Object.fFlags |= OBJECT_UNDROPPABLE; - // PlaceObjectInSoldierCreateStruct( pp, &Object ); + // CreateItems( usItem, (INT8)(ubBaseQuality + Random( ubQualityVariation )), ubNumTear, &gTempObject ); + // gTempObject.fFlags |= OBJECT_UNDROPPABLE; + // PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); //} //if( ubNumStun ) //{ @@ -1240,9 +1261,9 @@ void ChooseGrenadesForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bGrena // { // usItem = STUN_GRENADE; // } - // CreateItems( usItem, (INT8)(ubBaseQuality + Random( ubQualityVariation )), ubNumStun, &Object ); - // Object.fFlags |= OBJECT_UNDROPPABLE; - // PlaceObjectInSoldierCreateStruct( pp, &Object ); + // CreateItems( usItem, (INT8)(ubBaseQuality + Random( ubQualityVariation )), ubNumStun, &gTempObject ); + // gTempObject.fFlags |= OBJECT_UNDROPPABLE; + // PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); //} //if( ubNumReg ) //{ @@ -1254,30 +1275,30 @@ void ChooseGrenadesForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bGrena // { // usItem = HAND_GRENADE; // } - // CreateItems( usItem, (INT8)(ubBaseQuality + Random( ubQualityVariation )), ubNumReg, &Object ); - // Object.fFlags |= OBJECT_UNDROPPABLE; - // PlaceObjectInSoldierCreateStruct( pp, &Object ); + // CreateItems( usItem, (INT8)(ubBaseQuality + Random( ubQualityVariation )), ubNumReg, &gTempObject ); + // gTempObject.fFlags |= OBJECT_UNDROPPABLE; + // PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); //} //if( ubNumMini ) //{ - // CreateItems( MINI_GRENADE, (INT8)(ubBaseQuality + Random( ubQualityVariation )), ubNumMini, &Object ); - // Object.fFlags |= OBJECT_UNDROPPABLE; - // PlaceObjectInSoldierCreateStruct( pp, &Object ); + // CreateItems( MINI_GRENADE, (INT8)(ubBaseQuality + Random( ubQualityVariation )), ubNumMini, &gTempObject ); + // gTempObject.fFlags |= OBJECT_UNDROPPABLE; + // PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); //} //if( ubNumMustard ) //{ - // CreateItems( MUSTARD_GRENADE, (INT8)(ubBaseQuality + Random( ubQualityVariation )), ubNumMustard, &Object ); - // Object.fFlags |= OBJECT_UNDROPPABLE; - // PlaceObjectInSoldierCreateStruct( pp, &Object ); + // CreateItems( MUSTARD_GRENADE, (INT8)(ubBaseQuality + Random( ubQualityVariation )), ubNumMustard, &gTempObject ); + // gTempObject.fFlags |= OBJECT_UNDROPPABLE; + // PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); //} //if( ubNumFlare ) //{ - // CreateItems( BREAK_LIGHT, (INT8)(ubBaseQuality + Random( ubQualityVariation )), ubNumFlare, &Object ); - // Object.fFlags |= OBJECT_UNDROPPABLE; - // PlaceObjectInSoldierCreateStruct( pp, &Object ); + // CreateItems( BREAK_LIGHT, (INT8)(ubBaseQuality + Random( ubQualityVariation )), ubNumFlare, &gTempObject ); + // gTempObject.fFlags |= OBJECT_UNDROPPABLE; + // PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); //} - +#endif //obsoleteCode } void ChooseArmourForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bHelmetClass, INT8 bVestClass, INT8 bLeggingsClass ) @@ -1289,7 +1310,6 @@ void ChooseArmourForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bHelmetC UINT16 usItem = 0; //UINT16 usNumMatches; // INT8 bOrigVestClass = bVestClass; - OBJECTTYPE Object; //Madd: added minimum protection of 10 for armours to be used by enemies @@ -1308,14 +1328,15 @@ void ChooseArmourForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bHelmetC UINT16 usAttachment = PickARandomAttachment(ARMOURATTACHMENT,usItem, bHelmetClass, FALSE); if ( usAttachment > 0 ) { - CreateItem( usAttachment, (INT8)(70+Random(31)), &Object ); - Object.fFlags |= OBJECT_UNDROPPABLE; - AttachObject( NULL, &(pp->Inv[ HELMETPOS ]), &Object ); + CreateItem( usAttachment, (INT8)(70+Random(31)), &gTempObject ); + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + pp->Inv[ HELMETPOS ].AttachObject( NULL, &gTempObject ); } } } +#ifdef obsoleteCode //usNumMatches = 0; //while( bHelmetClass && !usNumMatches ) //{ //First step is to count the number of helmets in the helmet class range. If we @@ -1362,6 +1383,7 @@ void ChooseArmourForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bHelmetC // } // } //} +#endif //obsoleteCode } //Choose vest @@ -1379,14 +1401,15 @@ void ChooseArmourForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bHelmetC UINT16 usAttachment = PickARandomAttachment(ARMOURATTACHMENT,usItem, bVestClass, FALSE); if ( usAttachment > 0 ) { - CreateItem( usAttachment, (INT8)(70+Random(31)), &Object ); - Object.fFlags |= OBJECT_UNDROPPABLE; - AttachObject( NULL, &(pp->Inv[ VESTPOS ]), &Object ); + CreateItem( usAttachment, (INT8)(70+Random(31)), &gTempObject ); + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + pp->Inv[ VESTPOS ].AttachObject( NULL, &gTempObject ); } } } +#ifdef obsoleteCode //usNumMatches = 0; //while( bVestClass && !usNumMatches ) //{ //First step is to count the number of armours in the armour class range. If we @@ -1443,9 +1466,9 @@ void ChooseArmourForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bHelmetC // UINT16 usAttachment = PickARandomItem(ARMOURATTACHMENT, bOrigVestClass); // if ( usAttachment > 0 && ValidAttachment(usAttachment, i ) ) // { - // CreateItem( usAttachment, (INT8)(70+Random(31)), &Object ); - // Object.fFlags |= OBJECT_UNDROPPABLE; - // AttachObject( NULL, &(pp->Inv[ VESTPOS ]), &Object ); + // CreateItem( usAttachment, (INT8)(70+Random(31)), &gTempObject ); + // gTempObject.fFlags |= OBJECT_UNDROPPABLE; + // AttachObject( NULL, &(pp->Inv[ VESTPOS ]), &gTempObject ); // } // } // } @@ -1455,6 +1478,7 @@ void ChooseArmourForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bHelmetC // } // } //} +#endif //obsoleteCode } //Choose Leggings if( bLeggingsClass ) @@ -1471,15 +1495,16 @@ void ChooseArmourForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bHelmetC UINT16 usAttachment = PickARandomAttachment(ARMOURATTACHMENT,usItem, bLeggingsClass, FALSE); if ( usAttachment > 0 ) { - CreateItem( usAttachment, (INT8)(70+Random(31)), &Object ); - Object.fFlags |= OBJECT_UNDROPPABLE; - AttachObject( NULL, &(pp->Inv[ LEGPOS ]), &Object ); + CreateItem( usAttachment, (INT8)(70+Random(31)), &gTempObject ); + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + pp->Inv[ LEGPOS ].AttachObject( NULL, &gTempObject ); } } } +#ifdef obsoleteCode //usNumMatches = 0; //while( bLeggingsClass && !usNumMatches ) //{ //First step is to count the number of Armours in the Armour class range. If we @@ -1526,6 +1551,7 @@ void ChooseArmourForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bHelmetC // } // } //} +#endif //obsoleteCode } } @@ -1535,15 +1561,14 @@ void ChooseSpecialWeaponsForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 //UINT16 i; //INVTYPE *pItem; //UINT16 usRandom; - UINT16 usNumMatches = 0; UINT16 usKnifeIndex = 0; - OBJECTTYPE Object; itemGrenadeLauncher = 0; itemLAW = 0; itemRPG = 0; itemMortar=0; +#ifdef obsoleteCode //Choose knife //while( bKnifeClass && !usNumMatches ) //{ //First step is to count the number of weapons in the weapon class range. If we @@ -1581,6 +1606,7 @@ void ChooseSpecialWeaponsForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 // } // } //} +#endif //obsoleteCode if ( bKnifeClass ) { @@ -1588,22 +1614,22 @@ void ChooseSpecialWeaponsForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 if( usKnifeIndex > 0 ) { - CreateItem( usKnifeIndex, (INT8)(70 + Random( 31 )), &Object ); - Object.fFlags |= OBJECT_UNDROPPABLE; - PlaceObjectInSoldierCreateStruct( pp, &Object ); + CreateItem( usKnifeIndex, (INT8)(70 + Random( 31 )), &gTempObject ); + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); } } ////test code -// CreateItem( 347, (INT8)(50 + Random( 51 )), &Object ); -// PlaceObjectInSoldierCreateStruct( pp, &Object ); +// CreateItem( 347, (INT8)(50 + Random( 51 )), &gTempObject ); +// PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); // -// CreateItem( 298, (INT8)(50 + Random( 51 )), &Object ); -// PlaceObjectInSoldierCreateStruct( pp, &Object ); +// CreateItem( 298, (INT8)(50 + Random( 51 )), &gTempObject ); +// PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); // -// CreateItem( 298, (INT8)(50 + Random( 51 )), &Object ); -// PlaceObjectInSoldierCreateStruct( pp, &Object ); +// CreateItem( 298, (INT8)(50 + Random( 51 )), &gTempObject ); +// PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); if ( IsGrenadeLauncherAttached(&pp->Inv[HANDPOS]) ) //Madd: if there's a grenade launcher attached to the gun, then use that instead of giving him another one { @@ -1615,9 +1641,9 @@ void ChooseSpecialWeaponsForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 // give grenade launcher if ( itemGrenadeLauncher > 0 ) { - CreateItem( itemGrenadeLauncher, (INT8)(50 + Random( 51 )), &Object ); - Object.fFlags |= OBJECT_UNDROPPABLE; - PlaceObjectInSoldierCreateStruct( pp, &Object ); + CreateItem( itemGrenadeLauncher, (INT8)(50 + Random( 51 )), &gTempObject ); + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); } } @@ -1627,9 +1653,9 @@ void ChooseSpecialWeaponsForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 itemLAW = PickARandomItem (SINGLESHOTROCKETLAUNCHER); if ( itemLAW > 0 ) { - CreateItem( itemLAW, (INT8)(50 + Random( 51 )), &Object ); - Object.fFlags |= OBJECT_UNDROPPABLE; - PlaceObjectInSoldierCreateStruct( pp, &Object ); + CreateItem( itemLAW, (INT8)(50 + Random( 51 )), &gTempObject ); + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); } } if (fRPG) @@ -1638,9 +1664,9 @@ void ChooseSpecialWeaponsForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 itemRPG = PickARandomItem (ROCKETLAUNCHER); if ( itemRPG > 0 ) { - CreateItem( itemRPG, (INT8)(50 + Random( 51 )), &Object ); - Object.fFlags |= OBJECT_UNDROPPABLE; - PlaceObjectInSoldierCreateStruct( pp, &Object ); + CreateItem( itemRPG, (INT8)(50 + Random( 51 )), &gTempObject ); + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); } } @@ -1653,9 +1679,9 @@ void ChooseSpecialWeaponsForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 itemMortar = PickARandomItem (MORTARLAUNCHER); if ( itemMortar > 0 ) { - CreateItem( itemMortar, (INT8)(50 + Random( 51 )), &Object ); - Object.fFlags |= OBJECT_UNDROPPABLE; - PlaceObjectInSoldierCreateStruct( pp, &Object ); + CreateItem( itemMortar, (INT8)(50 + Random( 51 )), &gTempObject ); + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); } } @@ -1677,9 +1703,10 @@ void ChooseFaceGearForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp ) //Look for any face item in the big pocket positions (the only place they can be added in the editor) //If any are found, then don't assign any - for( i = BIGPOCK1POS; i < BIGPOCK4POS; i++ ) + // CHRISL: Change static inventory pocket definition to dynamic + for( i = BIGPOCKSTART; i < BIGPOCKFINAL; i++ ) { - if( Item[ pp->Inv[ i ].usItem ].usItemClass == IC_FACE ) + if( Item[ pp->Inv[ i ].usItem ].usItemClass == IC_FACE ) { return; } @@ -1784,11 +1811,11 @@ void ChooseKitsForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bKitClass //INVTYPE *pItem; //UINT16 usRandom; //UINT16 usNumMatches = 0; - OBJECTTYPE Object; UINT16 usKitItem = 0; //Madd: specify kit items in xml instead +#ifdef obsoleteCode // we want these mostly to be first aid and medical kits, and for those kit class doesn't matter, they're always useful //if ( Chance( 50 ) ) //{ @@ -1837,14 +1864,15 @@ void ChooseKitsForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bKitClass // } // } //} +#endif //obsoleteCode // if we still want more medical and first aid kits, we can just add extras of those item #s to the array - usKitItem = PickARandomItem( KIT , bKitClass, FALSE ); + usKitItem = PickARandomItem( KIT , bKitClass, FALSE ); if ( usKitItem > 0 ) { - CreateItem( usKitItem, (INT8)(80 + Random( 21 )), &Object ); - Object.fFlags |= OBJECT_UNDROPPABLE; - PlaceObjectInSoldierCreateStruct( pp, &Object ); + CreateItem( usKitItem, (INT8)(80 + Random( 21 )), &gTempObject ); + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); } } @@ -1855,14 +1883,13 @@ void ChooseMiscGearForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bMiscC //UINT16 i; //INVTYPE *pItem; UINT16 usRandom; - UINT16 usItem = 0; - OBJECTTYPE Object; //Madd: let's do this a couple times, so we can have > 1 misc item per soldier usRandom = Random(3); if ( usRandom ) { + UINT16 usItem = 0; for ( UINT16 i=0;i 0 ) { - CreateItem( usItem, (INT8)(80 + Random( 21 )), &Object ); - Object.fFlags |= OBJECT_UNDROPPABLE; - PlaceObjectInSoldierCreateStruct( pp, &Object ); + CreateItem( usItem, (INT8)(80 + Random( 21 )), &gTempObject ); + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); } // Madd: externalized again +#ifdef obsoleteCode //// count how many are eligible //for( i = 0; i < MAXITEMS; i++ ) //{ @@ -1997,22 +2026,43 @@ void ChooseBombsForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bBombClas // usRandom--; // else // { - // CreateItem( i, (INT8)(80 + Random( 21 )), &Object ); - // Object.fFlags |= OBJECT_UNDROPPABLE; - // PlaceObjectInSoldierCreateStruct( pp, &Object ); + // CreateItem( i, (INT8)(80 + Random( 21 )), &gTempObject ); + // gTempObject.fFlags |= OBJECT_UNDROPPABLE; + // PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); // break; // } // } // } //} +#endif //obsoleteCode } +// Headrock: Added a function to randomly create LBEs +void ChooseLBEsForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bLBEClass ) +{ + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"ChooseLBEsForSoldierCreateStruct"); + //UINT16 i; + //INVTYPE *pItem; + //UINT16 usRandom; + UINT16 usItem = 0; + + // CHRISL: If we're using the old inventory system, just return + if((UsingNewInventorySystem() == false)) + return; + + usItem = PickARandomItem( LBE , bLBEClass, FALSE ); + if ( usItem > 0 ) + { + CreateItem( usItem, (INT8)(80 + Random( 21 )), &gTempObject ); + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); + } +} void ChooseLocationSpecificGearForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"ChooseLocationSpecificGearForSoldierCreateStruct"); - OBJECTTYPE Object; UINT16 usItem = 0; // If this is Tixa and the player doesn't control Tixa then give all enemies gas masks, // but somewhere on their person, not in their face positions @@ -2021,8 +2071,8 @@ void ChooseLocationSpecificGearForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp usItem = PickARandomItem(GASMASKS); if ( usItem > 0 ) { - CreateItem( usItem, (INT8) (95+Random(6)), &Object ); - PlaceObjectInSoldierCreateStruct( pp, &Object ); + CreateItem( usItem, (INT8) (95+Random(6)), &gTempObject ); + PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); } } } @@ -2032,38 +2082,29 @@ void ChooseLocationSpecificGearForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp BOOLEAN PlaceObjectInSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, OBJECTTYPE *pObject ) { INT8 i; - if( !Item[ pObject->usItem ].ubPerPocket ) - { //ubPerPocket == 0 will only fit in large pockets. - pObject->ubNumberOfObjects = 1; - for( i = BIGPOCK1POS; i <= BIGPOCK4POS; i++ ) - { - if( !(pp->Inv[ i ].usItem) && !(pp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE) ) - { - memcpy( &(pp->Inv[ i ]), pObject, sizeof( OBJECTTYPE ) ); - return TRUE; - } - } - return FALSE; - } - else - { - pObject->ubNumberOfObjects = (UINT8)min( Item[ pObject->usItem ].ubPerPocket, pObject->ubNumberOfObjects ); + + if( FitsInSmallPocket(pObject) == true ) { + // CHRISL: Change static inventory pocket definition to dynamic //try to get it into a small pocket first - for( i = SMALLPOCK1POS; i <= SMALLPOCK8POS; i++ ) + for( i = SMALLPOCKSTART; i < SMALLPOCKFINAL; i++ ) { - if( !(pp->Inv[ i ].usItem) && !(pp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE) ) + if( pp->Inv[ i ].exists() == false && !(pp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE) ) { - memcpy( &(pp->Inv[ i ]), pObject, sizeof( OBJECTTYPE ) ); + pp->Inv[ i ] = *pObject; return TRUE; } } - for( i = BIGPOCK1POS; i <= BIGPOCK4POS; i++ ) - { //no space free in small pockets, so put it into a large pocket. - if( !(pp->Inv[ i ].usItem) && !(pp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE) ) - { - memcpy( &(pp->Inv[ i ]), pObject, sizeof( OBJECTTYPE ) ); - return TRUE; - } + } + + //NPCs skip medium pockets + + // CHRISL: Change static inventory pocket definition to dynamic + for( i = BIGPOCKSTART; i < BIGPOCKFINAL; i++ ) + { //no space free in small pockets, so put it into a large pocket. + if( pp->Inv[ i ].exists() == false && !(pp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE) ) + { + pp->Inv[ i ] = *pObject; + return TRUE; } } return FALSE; @@ -2071,7 +2112,7 @@ BOOLEAN PlaceObjectInSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, OBJECTTYPE * void RandomlyChooseWhichItemsAreDroppable( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass ) { - INT32 i; + UINT32 i; INT32 j; // UINT16 usRandomNum; UINT32 uiItemClass; @@ -2093,38 +2134,39 @@ void RandomlyChooseWhichItemsAreDroppable( SOLDIERCREATE_STRUCT *pp, INT8 bSoldi //Madd if ( gGameSettings.fOptions[TOPTION_DROP_ALL] ) { - ENEMYAMMODROPRATE = 100; - ENEMYGRENADEDROPRATE = 100; - ENEMYEQUIPDROPRATE = 100; // WANNE: Changed from 50 to 100, because DROP ALL should mean DROP ALL! - MILITIAAMMODROPRATE = 100; - MILITIAGRENADEDROPRATE = 100; - MILITIAEQUIPDROPRATE = 100; // WANNE: Changed from 50 to 100, because DROP ALL should mean DROP ALL! + ENEMYAMMODROPRATE = 100; + ENEMYGRENADEDROPRATE = 100; + ENEMYEQUIPDROPRATE = 100; // WANNE: Changed from 50 to 100, because DROP ALL should mean DROP ALL! + MILITIAAMMODROPRATE = 100; + MILITIAGRENADEDROPRATE = 100; + MILITIAEQUIPDROPRATE = 100; // WANNE: Changed from 50 to 100, because DROP ALL should mean DROP ALL! } else { // Default random drop if (gGameExternalOptions.ubEnemiesItemDrop == 0) { - ENEMYAMMODROPRATE = 50; + ENEMYAMMODROPRATE = 50; ENEMYGRENADEDROPRATE = 25; ENEMYEQUIPDROPRATE = 15; - MILITIAAMMODROPRATE = 5; - MILITIAGRENADEDROPRATE = 3; - MILITIAEQUIPDROPRATE = 2; + MILITIAAMMODROPRATE = 5; + MILITIAGRENADEDROPRATE = 3; + MILITIAEQUIPDROPRATE = 2; } // Get drop rate from XML-Files else { // Reset, because it is not used anymore - ENEMYAMMODROPRATE = -1; + ENEMYAMMODROPRATE = -1; ENEMYGRENADEDROPRATE = -1; ENEMYEQUIPDROPRATE = -1; - MILITIAAMMODROPRATE = -1; - MILITIAGRENADEDROPRATE = -1; - MILITIAEQUIPDROPRATE = -1; + MILITIAAMMODROPRATE = -1; + MILITIAGRENADEDROPRATE = -1; + MILITIAEQUIPDROPRATE = -1; } } +#ifdef obsoleteCode /* //40% of soldiers will have droppable items. usRandomNum = (UINT16)Random( 1000 ); @@ -2133,8 +2175,8 @@ else //so now the number is 0-399. This is kind of like a D&D die roll where //various numbers drop different items, or even more than one item. At this //point, we don't care if the enemy has anything in the slot that is made droppable. - //Any items containing the OBJECT_NO_OVERWRITE slot is rejected for droppable - //consideration. + //Any items containing the OBJECT_NO_OVERWRITE slot is rejected for droppable + //consideration. if( usRandomNum < 32 ) //3.2% of dead bodies present the possibility of several items (0-5 items : avg 3). { //31 is the magic number that allows all 5 item classes to be dropped! @@ -2169,7 +2211,7 @@ else case 2: fGrenades = TRUE; break; case 3: fAmmo = TRUE; break; case 4: fArmour = TRUE; break; - case 5: fMisc = TRUE; break; + case 5: fMisc = TRUE; break; case 6: fAmmo = TRUE; fMisc = TRUE; break; case 7: fGrenades = TRUE; fAmmo = TRUE; break; } @@ -2177,6 +2219,7 @@ else fKnife = (Random(3)) ? FALSE : TRUE; */ +#endif //obsoleteCode if ( SOLDIER_CLASS_MILITIA( bSoldierClass ) ) @@ -2195,11 +2238,11 @@ else } // only enemy soldiers use auto-drop system! - // don't use the auto-drop system in auto-resolve: player won't see what's being used & enemies will often win & keep'em + // don't use the auto-drop system in auto-resolve: player won't see what's being used & enemies will often win & keep'em if ( SOLDIER_CLASS_ENEMY( bSoldierClass ) && !IsAutoResolveActive() ) { // SPECIAL handling for weapons: we'll always drop a weapon type that has never been dropped before - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( i = 0; i < pp->Inv.size(); i++ ) { usItem = pp->Inv[ i ].usItem; //TODO: someday maybe pp->Inv[i].fFlags &= ~ITEM_REPAIRABLE; @@ -2211,11 +2254,11 @@ else if ( Item[ pp->Inv[ i ].usItem ].usItemClass == IC_FACE ) { if( Random(100) < ubOtherDropRate ) // way too many gas masks, nvg and extended ears getting dropped! - pp->Inv[ i ].fFlags &= ~OBJECT_UNDROPPABLE; + pp->Inv[ i ].fFlags &= ~OBJECT_UNDROPPABLE; } else */ - + pp->Inv[ i ].fFlags &= ~OBJECT_UNDROPPABLE; } else @@ -2224,7 +2267,7 @@ else if (gGameExternalOptions.ubEnemiesItemDrop == 0) { // if it's a weapon (monster parts included - they won't drop due to checks elsewhere!) - if ((usItem > NONE) && (usItem < MAXITEMS )) // Madd -- this should be ok set to maxitems instead of max_Weapons + if ((usItem > NONE) && (usItem < MAXITEMS )) // Madd -- this should be ok set to maxitems instead of max_Weapons { // and we're allowed to change its flags if(! (pp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE )) @@ -2285,7 +2328,7 @@ else if( fAmmo ) { // now drops ALL ammo found, not just the first slot - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( i = 0; i < pp->Inv.size(); i++ ) { uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass; if( uiItemClass == IC_AMMO ) @@ -2303,7 +2346,7 @@ else if( fWeapon ) { ubNumMatches = 0; - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( i = 0; i < pp->Inv.size(); i++ ) { uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass; if( uiItemClass == IC_GUN || uiItemClass == IC_LAUNCHER ) @@ -2316,7 +2359,7 @@ else } if ( ubNumMatches > 0 ) { - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( i = 0; i < pp->Inv.size(); i++ ) { uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass; if( uiItemClass == IC_GUN || uiItemClass == IC_LAUNCHER ) @@ -2336,7 +2379,7 @@ else if( fArmour ) { ubNumMatches = 0; - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( i = 0; i < pp->Inv.size(); i++ ) { uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass; if( uiItemClass == IC_ARMOUR ) @@ -2349,7 +2392,7 @@ else } if ( ubNumMatches > 0 ) { - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( i = 0; i < pp->Inv.size(); i++ ) { uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass; if( uiItemClass == IC_ARMOUR ) @@ -2368,7 +2411,7 @@ else if( fKnife) { - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( i = 0; i < pp->Inv.size(); i++ ) { // drops FIRST knife found uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass; @@ -2389,7 +2432,7 @@ else if( fGrenades ) { ubNumMatches = 0; - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( i = 0; i < pp->Inv.size(); i++ ) { uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass; if( uiItemClass == IC_GRENADE ) @@ -2402,7 +2445,7 @@ else } if ( ubNumMatches > 0 ) { - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( i = 0; i < pp->Inv.size(); i++ ) { uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass; if( uiItemClass == IC_GRENADE ) @@ -2422,7 +2465,7 @@ else if( fKit ) { ubNumMatches = 0; - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( i = 0; i < pp->Inv.size(); i++ ) { uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass; if( uiItemClass == IC_MEDKIT || uiItemClass == IC_KIT ) @@ -2435,7 +2478,7 @@ else } if ( ubNumMatches > 0 ) { - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( i = 0; i < pp->Inv.size(); i++ ) { uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass; if( uiItemClass == IC_MEDKIT || uiItemClass == IC_KIT ) @@ -2455,7 +2498,7 @@ else if( fFace ) { ubNumMatches = 0; - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( i = 0; i < pp->Inv.size(); i++ ) { uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass; if( uiItemClass == IC_FACE ) @@ -2468,7 +2511,7 @@ else } if ( ubNumMatches > 0 ) { - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( i = 0; i < pp->Inv.size(); i++ ) { uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass; if( uiItemClass == IC_FACE ) @@ -2488,7 +2531,7 @@ else if( fMisc ) { ubNumMatches = 0; - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( i = 0; i < pp->Inv.size(); i++ ) { uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass; if( uiItemClass == IC_MISC ) @@ -2501,7 +2544,7 @@ else } if ( ubNumMatches > 0 ) { - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( i = 0; i < pp->Inv.size(); i++ ) { uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass; if( uiItemClass == IC_MISC ) @@ -2522,13 +2565,13 @@ else else if (gGameExternalOptions.ubEnemiesItemDrop == 1) { // Loop through the enemy inter - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( i = 0; i < pp->Inv.size(); i++ ) { uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass; // We are allowed to change the object and it is not the first (nothing) object //if(! (pp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE ) && pp->Inv[ i ].usItem != 0) - if( pp->Inv[ i ].usItem != 0) + if( pp->Inv[ i ].exists() == true) { // Weapon if( uiItemClass == IC_GUN) @@ -2536,7 +2579,7 @@ else // Find matching weaponType in the XML for (j = 0; j < MAX_DROP_ITEMS; j++) { - // We have no more weapon items -> exit from loop + // We have no more weapon items->exit from loop if (j > 0 && gEnemyWeaponDrops[j].uiIndex == 0) break; @@ -2577,7 +2620,7 @@ else // Find matching ammo in the XML for (j = 0; j < MAX_DROP_ITEMS; j++) { - // We have no more ammo items -> exit from loop + // We have no more ammo items->exit from loop if (j > 0 && gEnemyAmmoDrops[j].uiIndex == 0) break; @@ -2617,7 +2660,7 @@ else // Find matching explosive in the XML for (j = 0; j < MAX_DROP_ITEMS; j++) { - // We have no more explosive items -> exit from loop + // We have no more explosive items->exit from loop if (j > 0 && gEnemyExplosiveDrops[j].uiIndex == 0) break; @@ -2648,7 +2691,7 @@ else } } - + break; } } @@ -2659,7 +2702,7 @@ else // Find matching armour in the XML for (j = 0; j < MAX_DROP_ITEMS; j++) { - // We have no more armour items -> exit from loop + // We have no more armour items->exit from loop if (j > 0 && gEnemyArmourDrops[j].uiIndex == 0) break; @@ -2696,15 +2739,15 @@ else } // Misc else if (uiItemClass == IC_BLADE || uiItemClass == IC_MEDKIT || uiItemClass == IC_KIT || - uiItemClass == IC_THROWING_KNIFE || uiItemClass == IC_LAUNCHER || - uiItemClass == IC_APPLIABLE || uiItemClass == IC_FACE || uiItemClass == IC_TENTACLES || - uiItemClass == IC_THROWN || uiItemClass == IC_PUNCH || uiItemClass == IC_KEY || + uiItemClass == IC_THROWING_KNIFE || uiItemClass == IC_LAUNCHER || + uiItemClass == IC_APPLIABLE || uiItemClass == IC_FACE || uiItemClass == IC_TENTACLES || + uiItemClass == IC_THROWN || uiItemClass == IC_PUNCH || uiItemClass == IC_KEY || uiItemClass == IC_MISC || uiItemClass == IC_MONEY) { // Find matching armour in the XML for (j = 0; j < MAX_DROP_ITEMS; j++) { - // We have no more armour items -> exit from loop + // We have no more armour items->exit from loop if (j > 0 && gEnemyMiscDrops[j].uiIndex == 0) break; @@ -2759,7 +2802,7 @@ void AssignCreatureInventory( SOLDIERTYPE *pSoldier ) CreateItem( CREATURE_OLD_FEMALE_CLAWS, 100, &(pSoldier->inv[HANDPOS]) ); CreateItem( CREATURE_OLD_FEMALE_HIDE, 100, &(pSoldier->inv[HELMETPOS]) ); CreateItem( CREATURE_OLD_FEMALE_HIDE, 100, &(pSoldier->inv[VESTPOS]) ); - CreateItem( CREATURE_OLD_FEMALE_HIDE, 100, &(pSoldier->inv[LEGPOS]) ); + CreateItem( CREATURE_OLD_FEMALE_HIDE, 100, &(pSoldier->inv[LEGPOS]) ); uiChanceToDrop = 30; break; case AM_MONSTER: @@ -2767,7 +2810,7 @@ void AssignCreatureInventory( SOLDIERTYPE *pSoldier ) CreateItem( CREATURE_OLD_MALE_SPIT, 100, &(pSoldier->inv[SECONDHANDPOS]) ); CreateItem( CREATURE_OLD_MALE_HIDE, 100, &(pSoldier->inv[HELMETPOS]) ); CreateItem( CREATURE_OLD_MALE_HIDE, 100, &(pSoldier->inv[VESTPOS]) ); - CreateItem( CREATURE_OLD_MALE_HIDE, 100, &(pSoldier->inv[LEGPOS]) ); + CreateItem( CREATURE_OLD_MALE_HIDE, 100, &(pSoldier->inv[LEGPOS]) ); uiChanceToDrop = 30; fMaleCreature = TRUE; break; @@ -2775,7 +2818,7 @@ void AssignCreatureInventory( SOLDIERTYPE *pSoldier ) CreateItem( CREATURE_YOUNG_FEMALE_CLAWS, 100, &(pSoldier->inv[HANDPOS]) ); CreateItem( CREATURE_YOUNG_FEMALE_HIDE, 100, &(pSoldier->inv[HELMETPOS]) ); CreateItem( CREATURE_YOUNG_FEMALE_HIDE, 100, &(pSoldier->inv[VESTPOS]) ); - CreateItem( CREATURE_YOUNG_FEMALE_HIDE, 100, &(pSoldier->inv[LEGPOS]) ); + CreateItem( CREATURE_YOUNG_FEMALE_HIDE, 100, &(pSoldier->inv[LEGPOS]) ); uiChanceToDrop = 15; break; case YAM_MONSTER: @@ -2783,7 +2826,7 @@ void AssignCreatureInventory( SOLDIERTYPE *pSoldier ) CreateItem( CREATURE_YOUNG_MALE_SPIT, 100, &(pSoldier->inv[SECONDHANDPOS]) ); CreateItem( CREATURE_YOUNG_MALE_HIDE, 100, &(pSoldier->inv[HELMETPOS]) ); CreateItem( CREATURE_YOUNG_MALE_HIDE, 100, &(pSoldier->inv[VESTPOS]) ); - CreateItem( CREATURE_YOUNG_MALE_HIDE, 100, &(pSoldier->inv[LEGPOS]) ); + CreateItem( CREATURE_YOUNG_MALE_HIDE, 100, &(pSoldier->inv[LEGPOS]) ); uiChanceToDrop = 15; fMaleCreature = TRUE; break; @@ -2799,7 +2842,7 @@ void AssignCreatureInventory( SOLDIERTYPE *pSoldier ) break; case QUEENMONSTER: CreateItem( CREATURE_QUEEN_SPIT, 100, &(pSoldier->inv[HANDPOS]) ); - CreateItem( CREATURE_QUEEN_TENTACLES, 100, &(pSoldier->inv[SECONDHANDPOS]) ); + CreateItem( CREATURE_QUEEN_TENTACLES, 100, &(pSoldier->inv[SECONDHANDPOS]) ); CreateItem( CREATURE_QUEEN_HIDE, 100, &(pSoldier->inv[HELMETPOS]) ); CreateItem( CREATURE_QUEEN_HIDE, 100, &(pSoldier->inv[VESTPOS]) ); CreateItem( CREATURE_QUEEN_HIDE, 100, &(pSoldier->inv[LEGPOS]) ); @@ -2844,12 +2887,11 @@ void AssignCreatureInventory( SOLDIERTYPE *pSoldier ) void ReplaceExtendedGuns( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass ) { - UINT32 uiLoop, uiLoop2, uiAttachDestIndex; + UINT32 uiLoop, uiLoop2; INT8 bWeaponClass; - OBJECTTYPE OldObj; UINT16 usItem, usNewGun, usAmmo, usNewAmmo; - for ( uiLoop = 0; uiLoop < NUM_INV_SLOTS; uiLoop++ ) + for ( uiLoop = 0; uiLoop < pp->Inv.size(); uiLoop++ ) { usItem = pp->Inv[ uiLoop ].usItem; @@ -2868,30 +2910,24 @@ void ReplaceExtendedGuns( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass ) if ( usNewGun != NOTHING ) { - // have to replace! but first (ugh) must store backup (b/c of attachments) - CopyObj( &(pp->Inv[ uiLoop ]), &OldObj ); - CreateItem( usNewGun, OldObj.ItemData.Gun.bGunStatus, &(pp->Inv[ uiLoop ]) ); - pp->Inv[ uiLoop ].fFlags = OldObj.fFlags; + //We are creating a new gun, but the new gun needs the old gun's attachments + OBJECTTYPE* pObj = &(pp->Inv[ uiLoop ]); + CreateItem( usNewGun, (*pObj)[0]->data.gun.bGunStatus, &gTempObject ); + gTempObject.fFlags = (*pObj).fFlags; - // copy any valid attachments; for others, just drop them... - if ( ItemHasAttachments( &OldObj ) ) - { - // we're going to copy into the first attachment position first :-) - uiAttachDestIndex = 0; - // loop! - for ( uiLoop2 = 0; uiLoop2 < MAX_ATTACHMENTS; uiLoop2++ ) - { - if ( ( OldObj.usAttachItem[ uiLoop2 ] != NOTHING ) && ValidAttachment( OldObj.usAttachItem[ uiLoop2 ], usNewGun ) ) - { - pp->Inv[ uiLoop ].usAttachItem[ uiAttachDestIndex ] = OldObj.usAttachItem[ uiLoop2 ]; - pp->Inv[ uiLoop ].bAttachStatus[ uiAttachDestIndex ] = OldObj.bAttachStatus[ uiLoop2 ]; - uiAttachDestIndex++; - } - } + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + gTempObject.AttachObject(0, &(*iter)); } + //for any old attachments that don't fit on the new gun, place or drop them + RemoveProhibitedAttachments(0, &gTempObject, usNewGun); + + //copy it over + *pObj = gTempObject; + + // must search through inventory and replace ammo accordingly - for ( uiLoop2 = 0; uiLoop2 < NUM_INV_SLOTS; uiLoop2++ ) + for ( uiLoop2 = 0; uiLoop2 < pp->Inv.size(); uiLoop2++ ) { usAmmo = pp->Inv[ uiLoop2 ].usItem; if ( (Item[ usAmmo ].usItemClass & IC_AMMO) ) @@ -2906,7 +2942,6 @@ void ReplaceExtendedGuns( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass ) } } } - } } @@ -2949,11 +2984,11 @@ UINT16 SelectStandardArmyGun( UINT8 uiGunLevel ) //Check to avoid an endless loop looking for "normal" guns if (usGunIndex == -1) { - //Madd: there better be something from the original JA2 guns here somewhere (biggunlist=0)! + //Madd: there better be something from the original JA2 guns here somewhere (biggunlist=0)! int numTries = 0; //Try 5 more times... while (numTries < 5 && usGunIndex == -1) - { + { uiChoice = Random(pGunChoiceTable[ uiGunLevel ].ubChoices); usGunIndex = pGunChoiceTable[ uiGunLevel ].bItemNo[ uiChoice ]; @@ -2968,8 +3003,8 @@ UINT16 SelectStandardArmyGun( UINT8 uiGunLevel ) for (int i=0;iInv[ HANDPOS ].fFlags |= OBJECT_UNDROPPABLE; // machine gun - CreateItems( MINIMI, ( INT8 )( 80 + Random( 21 ) ), 1, &Object ); - Object.fFlags |= OBJECT_UNDROPPABLE; - PlaceObjectInSoldierCreateStruct( pp, &Object ); + CreateItems( MINIMI, ( INT8 )( 80 + Random( 21 ) ), 1, &gTempObject ); + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); // tanks don't deplete shells or ammo... - CreateItems( TANK_SHELL, 100, 1, &Object ); - Object.fFlags |= OBJECT_UNDROPPABLE; - PlaceObjectInSoldierCreateStruct( pp, &Object ); + CreateItems( TANK_SHELL, 100, 1, &gTempObject ); + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + PlaceObjectInSoldierCreateStruct( pp, &gTempObject ); // armour equal to spectra all over (for vs explosives) CreateItem( SPECTRA_VEST, 100, &(pp->Inv[ VESTPOS ]) ); @@ -3059,9 +3092,9 @@ UINT16 PickARandomItem(UINT8 typeIndex, UINT8 maxCoolness, BOOLEAN getMatchingCo // a chance for nothing! uiChoice = Random(gArmyItemChoices[ typeIndex ].ubChoices + (int) ( gArmyItemChoices[ typeIndex ].ubChoices / 3 )); - + if ( uiChoice >= gArmyItemChoices[ typeIndex ].ubChoices ) - { + { if ( !getMatchingCoolness ) return 0; else @@ -3098,7 +3131,7 @@ UINT16 PickARandomItem(UINT8 typeIndex, UINT8 maxCoolness, BOOLEAN getMatchingCo //Madd: quickfix: don't use NVGs during the day, and no sungoggles at night either //if ( usItem >= 0 && Item[usItem].ubCoolness <= maxCoolness && ItemIsLegal(usItem) && (( DayTime() && Item[usItem].nightvisionrangebonus == 0 ) || ( NightTime() && Item[usItem].dayvisionrangebonus == 0 ))) - + if (pickItem == TRUE) { // pick a default item in case we don't find anything with a matching coolness, but pick the coolest item we can find diff --git a/Tactical/Inventory Choosing.h b/Tactical/Inventory Choosing.h index 29b07daa..35053114 100644 --- a/Tactical/Inventory Choosing.h +++ b/Tactical/Inventory Choosing.h @@ -54,20 +54,20 @@ enum // Selects at the start of the game the set of guns the Queen's army will use during this game void InitArmyGunTypes(void); -//Chooses equipment based on the equipment level (1-11) with best being 11. It allocates a range +//Chooses equipment based on the equipment level (1-11) with best being 11. It allocates a range //of equipment to choose from. void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8 bEquipmentRating); void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponClass, - INT8 bAmmoClips, INT8 bAttachClass, BOOLEAN fAttachment ); + INT8 bAmmoClips, INT8 bAttachClass, BOOLEAN fAttachment ); void ChooseGrenadesForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bGrenades, INT8 bGrenadeClass, BOOLEAN fGrenadeLauncher ); void ChooseArmourForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bHelmetClass, - INT8 bArmourClass, INT8 bLeggingsClass ); + INT8 bArmourClass, INT8 bLeggingsClass ); void ChooseSpecialWeaponsForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bKnifeClass, - BOOLEAN fGrenadeLauncher, BOOLEAN fLAW, BOOLEAN fMortar, BOOLEAN fRPG ); + BOOLEAN fGrenadeLauncher, BOOLEAN fLAW, BOOLEAN fMortar, BOOLEAN fRPG ); void ChooseFaceGearForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp ); @@ -88,6 +88,7 @@ void ResetMortarsOnTeamCount( void ); extern ARMY_GUN_CHOICE_TYPE gExtendedArmyGunChoices[ARMY_GUN_LEVELS]; +// Headrock: Added LBE enumeration enum { HELMET = 0, @@ -110,6 +111,7 @@ enum ATTACHMENTS, KNIVES, ENEMYAMMOTYPES, + LBE, MAX_ITEM_TYPES }; diff --git a/Tactical/Item Types.cpp b/Tactical/Item Types.cpp new file mode 100644 index 00000000..d5b51a5a --- /dev/null +++ b/Tactical/Item Types.cpp @@ -0,0 +1,1188 @@ + +#include "Item Types.h" +#include "Debug.h" +#include "Items.h" +#include "GameSettings.h" +#include "screenids.h" + + +int BODYPOSFINAL = GUNSLINGPOCKPOS;//RESET in initInventory +int BIGPOCKFINAL = MEDPOCK1POS;//RESET in initInventory +int MEDPOCKSTART = MEDPOCK1POS;//RESET in initInventory +int MEDPOCKFINAL = SMALLPOCK1POS;//RESET in initInventory +int SMALLPOCKFINAL = NUM_INV_SLOTS;//RESET in initInventory + + +OBJECTTYPE gTempObject; +OBJECTTYPE gStackTempObject; +std::list LBEArray; +int gLastLBEUniqueID = 0; + +extern UINT32 guiCurrentItemDescriptionScreen; +extern BOOLEAN fShowMapInventoryPool; +extern BOOLEAN AutoPlaceObjectInInventoryStash( OBJECTTYPE *pItemPtr, INT16 sGridNo ); + +bool IsSlotAnLBESlot(int slot) +{ + switch(slot) { + case VESTPOCKPOS: + case LTHIGHPOCKPOS: + case RTHIGHPOCKPOS: + case CPACKPOCKPOS: + case BPACKPOCKPOS: + return true; + } + return false; +} + +bool IsSlotASmallPocket(int slot) +{ + if (slot >= SMALLPOCKSTART && slot < SMALLPOCKFINAL) { + return true; + } + return false; +} + +void CreateLBE (OBJECTTYPE* pObj, UINT8 ubID, int numSubPockets) +{ + int uniqueID; + LBENODE* pLBE = NULL; + if (pObj->IsActiveLBE(0) == true) { + uniqueID = (*pObj)[0]->data.lbe.uniqueID; + for (std::list::iterator iter = LBEArray.begin(); iter != LBEArray.end(); ++iter) { + if (iter->uniqueID == uniqueID) { + pLBE = &(*iter); + break; + } + } + Assert(pLBE); + } + else { + //CHRISL: I don't understand why we do this instead of using the old GetFreeLBEPackIndex function to + // generate a uniqueID only when one is needed. + uniqueID = gLastLBEUniqueID++; + LBEArray.push_back(LBENODE()); + pLBE = &LBEArray.back(); + pLBE->uniqueID = uniqueID; + } + pLBE->ubID = ubID; + pLBE->lbeIndex = Item[pObj->usItem].ubClassIndex; + pLBE->lbeClass = LoadBearingEquipment[Item[pObj->usItem].ubClassIndex].lbeClass; + pLBE->inv.clear(); + pLBE->inv.resize(numSubPockets); + (*pObj)[0]->data.lbe.bLBE = -1; + (*pObj)[0]->data.lbe.uniqueID = uniqueID; +} + +bool DestroyLBEIfEmpty(OBJECTTYPE* pObj) +{ + if (pObj->IsActiveLBE(0) == true) { + LBENODE* pLBE = pObj->GetLBEPointer(0); + if (pLBE) { + for (unsigned int x = 0; x < pLBE->inv.size(); ++x) { + if (pLBE->inv[x].exists() == true) { + return false; + } + } + for (std::list::iterator iter = LBEArray.begin(); iter != LBEArray.end(); ++iter) { + if (iter->uniqueID == pLBE->uniqueID) { + LBEArray.erase(iter); + break; + } + } + (*pObj)[0]->data.lbe.uniqueID = 0; + (*pObj)[0]->data.lbe.bLBE = 0; + return true; + } + } + return false; +} + +void DestroyLBE(OBJECTTYPE* pObj) +{ + if(pObj->IsActiveLBE(0) == true) + { + LBENODE* pLBE = pObj->GetLBEPointer(0); + if(pLBE) + { + for(unsigned int x = 0; x < pLBE->inv.size(); x++) + { + if(pLBE->inv[x].exists() == true) + { + pLBE->inv[x].initialize(); + } + } + for (std::list::iterator iter = LBEArray.begin(); iter != LBEArray.end(); ++iter) { + if (iter->uniqueID == pLBE->uniqueID) { + LBEArray.erase(iter); + break; + } + } + (*pObj)[0]->data.lbe.uniqueID = 0; + (*pObj)[0]->data.lbe.bLBE = 0; + return; + } + } + return; +} + +void MoveItemsInSlotsToLBE( SOLDIERTYPE *pSoldier, std::vector& LBESlots, LBENODE* pLBE, OBJECTTYPE* pObj) +{ + for(unsigned int i=0; iinv[LBESlots[i]].exists() == false) // No item in this pocket + continue; + + // Found an item in a default pocket so get it's ItemSize + UINT16 dSize = CalculateItemSize(&pSoldier->inv[LBESlots[i]]); + for(unsigned int j=0; jinv.size(); j++) // Search through LBE and see if item fits anywhere + { + if(pLBE->inv[j].exists() == true) // Item already stored in LBENODE pocket + continue; + // No item in this LBENODE pocket, is pocket active? + if(LoadBearingEquipment[Item[pObj->usItem].ubClassIndex].lbePocketIndex[j] == NONE) // Pocket is inactive + continue; + // Pocket is active, can default item fit in this pocket? + if(LBEPocketType[LoadBearingEquipment[Item[pObj->usItem].ubClassIndex].lbePocketIndex[j]].ItemCapacityPerSize[dSize] == NONE) // Pocket can't hold this item size + continue; + UINT16 dCap = LBEPocketType[LoadBearingEquipment[Item[pObj->usItem].ubClassIndex].lbePocketIndex[j]].ItemCapacityPerSize[dSize]; + // Default item will fit in this pocket. Setup the LBENODE if necessary + + //ADB the object is already in the LBE, we are just moving it from soldier inv to LBE inv + pSoldier->inv[LBESlots[i]].MoveThisObjectTo(pLBE->inv[j], ALL_OBJECTS, NULL, STACK_SIZE_LIMIT, dCap); + if (pSoldier->inv[LBESlots[i]].exists() == false) { + break; + } + else { + //move didn't work, maybe it was a stack? + dSize = CalculateItemSize(&pSoldier->inv[LBESlots[i]]); + } + } + } + return; +} + +// CHRISL: New function to move items from default pockets to usable pockets +BOOLEAN MoveItemsToActivePockets( SOLDIERTYPE *pSoldier, std::vector& LBESlots, UINT32 uiHandPos, OBJECTTYPE *pObj ) +{ + BOOLEAN flag=FALSE; + + if(pObj->IsActiveLBE(0) == false) { + CreateLBE(pObj, pSoldier->ubID, LBESlots.size()); + } + + LBENODE* pLBE = pObj->GetLBEPointer(0); + MoveItemsInSlotsToLBE(pSoldier, LBESlots, pLBE, pObj); + DestroyLBEIfEmpty(pObj); + + // We've put everything into the LBENODE that we could, now search other pockets for openings + for(unsigned int x=0; xinv[LBESlots[x]].exists() == false) + continue; + for(int i=INV_START_POS; iinv[i].exists() == false) // No item in this pocket. Place the item. + { + if((i == CPACKPOCKPOS && uiHandPos == BPACKPOCKPOS) || (i == BPACKPOCKPOS && uiHandPos == CPACKPOCKPOS)) + { + UINT8 newPack = LoadBearingEquipment[Item[pObj->usItem].ubClassIndex].lbeCombo; + UINT8 chkPack = LoadBearingEquipment[Item[pSoldier->inv[i].usItem].ubClassIndex].lbeCombo; + if(newPack == 0 || newPack != chkPack) + continue; + } + if(CanItemFitInPosition(pSoldier, &(pSoldier->inv[LBESlots[x]]), i, FALSE)) + { + pSoldier->inv[LBESlots[x]].MoveThisObjectTo(pSoldier->inv[i], ALL_OBJECTS, pSoldier, i); + break; + } + } + else if(pSoldier->inv[i].usItem == pSoldier->inv[LBESlots[x]].usItem) // Item is identical so maybe it can stack + { + pSoldier->inv[i].AddObjectsToStack(pSoldier->inv[LBESlots[x]], ALL_OBJECTS, pSoldier, i); + break; + } + } + } + + + // now drop everything that wouldn't fit anywhere else + for(unsigned int i=0; iinv[LBESlots[i]].exists() == false) // No item in pocket + continue; + if(guiCurrentItemDescriptionScreen == MAP_SCREEN && fShowMapInventoryPool) + { + AutoPlaceObjectInInventoryStash(&pSoldier->inv[LBESlots[i]], pSoldier->sGridNo); + } + else + { + AddItemToPool( pSoldier->sGridNo, &pSoldier->inv[LBESlots[i]], 1, pSoldier->pathing.bLevel, 0 , -1 ); + NotifySoldiersToLookforItems( ); + } + DeleteObj(&pSoldier->inv[LBESlots[i]]); + } + + return(TRUE); +} + +void GetLBESlots(UINT32 LBEType, std::vector& LBESlots) +{ + switch (LBEType) + { + case VESTPOCKPOS: + LBESlots.push_back(SMALLPOCK1POS); + LBESlots.push_back(SMALLPOCK2POS); + LBESlots.push_back(SMALLPOCK3POS); + LBESlots.push_back(SMALLPOCK4POS); + LBESlots.push_back(SMALLPOCK5POS); + LBESlots.push_back(SMALLPOCK6POS); + LBESlots.push_back(SMALLPOCK7POS); + LBESlots.push_back(SMALLPOCK8POS); + LBESlots.push_back(SMALLPOCK9POS); + LBESlots.push_back(SMALLPOCK10POS); + LBESlots.push_back(MEDPOCK1POS); + LBESlots.push_back(MEDPOCK2POS); + break; + case LTHIGHPOCKPOS: + LBESlots.push_back(SMALLPOCK11POS); + LBESlots.push_back(SMALLPOCK12POS); + LBESlots.push_back(SMALLPOCK13POS); + LBESlots.push_back(SMALLPOCK14POS); + LBESlots.push_back(MEDPOCK3POS); + break; + case RTHIGHPOCKPOS: + LBESlots.push_back(SMALLPOCK15POS); + LBESlots.push_back(SMALLPOCK16POS); + LBESlots.push_back(SMALLPOCK17POS); + LBESlots.push_back(SMALLPOCK18POS); + LBESlots.push_back(MEDPOCK4POS); + break; + case CPACKPOCKPOS: + LBESlots.push_back(SMALLPOCK19POS); + LBESlots.push_back(SMALLPOCK20POS); + LBESlots.push_back(SMALLPOCK21POS); + LBESlots.push_back(SMALLPOCK22POS); + LBESlots.push_back(BIGPOCK1POS); + LBESlots.push_back(BIGPOCK2POS); + LBESlots.push_back(BIGPOCK3POS); + break; + case BPACKPOCKPOS: + LBESlots.push_back(SMALLPOCK23POS); + LBESlots.push_back(SMALLPOCK24POS); + LBESlots.push_back(SMALLPOCK25POS); + LBESlots.push_back(SMALLPOCK26POS); + LBESlots.push_back(SMALLPOCK27POS); + LBESlots.push_back(SMALLPOCK28POS); + LBESlots.push_back(SMALLPOCK29POS); + LBESlots.push_back(SMALLPOCK30POS); + LBESlots.push_back(BIGPOCK4POS); + LBESlots.push_back(BIGPOCK5POS); + LBESlots.push_back(BIGPOCK6POS); + LBESlots.push_back(BIGPOCK7POS); + break; + default: + //CHRISL: Technically, this should never occur but we don't want the program to crash. + Assert(0); + //DebugBreak(); + } + return; +} + + +// CHRISL: New function to handle moving soldier items to lbe items +BOOLEAN MoveItemToLBEItem( SOLDIERTYPE *pSoldier, UINT32 uiHandPos ) +{ + std::vector LBESlots; + // Determine which LBE item we're removing so we can associate the correct pockets with it. + GetLBESlots(uiHandPos, LBESlots); + + CreateLBE(&(pSoldier->inv[uiHandPos]), pSoldier->ubID, LBESlots.size()); + LBENODE* pLBE = pSoldier->inv[uiHandPos].GetLBEPointer(0); + for(unsigned int i=0; iinv[LBESlots[i]].exists() == true) + { + //ADB the object is already in the LBE, we are just moving it from soldier inv to LBE inv + pSoldier->inv[LBESlots[i]].MoveThisObjectTo(pLBE->inv[i], -1, pSoldier, LBESlots[i]); + } + } + + if (DestroyLBEIfEmpty(&pSoldier->inv[uiHandPos]) == true) { + return(FALSE); + } + + return (TRUE); +} + +// CHRISL: New function to handle moving lbe items to soldier items +BOOLEAN MoveItemFromLBEItem( SOLDIERTYPE *pSoldier, UINT32 uiHandPos, OBJECTTYPE *pObj ) +{ + std::vector LBESlots; + + // Determine which LBE item we're adding so we can associate the correct pockets with it. + GetLBESlots(uiHandPos, LBESlots); + + if(pSoldier->inv[uiHandPos].exists() == false) + MoveItemsToActivePockets(pSoldier, LBESlots, uiHandPos, pObj); + if(pObj->IsActiveLBE(0) == false) { + return (FALSE); + } + + LBENODE* pLBE = pObj->GetLBEPointer(0); + for(unsigned int i=0; iinv[i].exists() == true) + { + pLBE->inv[i].MoveThisObjectTo(pSoldier->inv[LBESlots[i]], ALL_OBJECTS, pSoldier, LBESlots[i]); + //check to make sure item was moved. If not, try placing item in an active pocket + if(pLBE->inv[i].exists() == true) + { + if(!AutoPlaceObject(pSoldier, &pLBE->inv[i], FALSE) && pSoldier->inv[LBESlots[i]].exists() == false) + { + //still can't place the item? Force move to the pocket associated with the LBE if empty + pSoldier->inv[LBESlots[i]].ForceAddObjectsToStack(pLBE->inv[i]); + } + } + } + } + if (DestroyLBEIfEmpty(pObj) == false) { + //we should have copied all the items from the LBE to the soldier + //which means the LBE should be empty and destroyed. However, if it's not empty, we need to force place + //some items so that we can empty the LBE without losing anything. + for(unsigned int i = 0; i < LBESlots.size(); i++) + { + if(pLBE->inv[i].exists() == true) + { + for(unsigned int j = BIGPOCKSTART; j < pSoldier->inv.size(); j++) + { + if(pSoldier->inv[j].exists() == false) + { + pSoldier->inv[j].ForceAddObjectsToStack(pLBE->inv[i]); + break; + } + } + } + //Now, check one last time and if we still have an object, drop it to the ground + if(pLBE->inv[i].exists() == true) + { + AddItemToPool(pSoldier->sGridNo, &pLBE->inv[i], 1, pSoldier->pathing.bLevel, 0, -1); + //at this point, if we still haven't removed the item, the only thing left to do is delete it. + pLBE->inv[i].initialize(); + } + } + DestroyLBE(pObj); + } + + return (TRUE); +} + +LBETYPE::LBETYPE(){ + memset(this, 0, SIZEOF_LBETYPE); + lbePocketIndex.clear(); + lbePocketIndex.resize(MAX_ITEMS_IN_LBE); +} +LBETYPE::LBETYPE(const LBETYPE& src) { + memcpy(this, &src, SIZEOF_LBETYPE); + lbePocketIndex = src.lbePocketIndex; +} +LBETYPE& LBETYPE::operator=(const LBETYPE& src){ + if (this != &src) { + memcpy(this, &src, SIZEOF_LBETYPE); + lbePocketIndex = src.lbePocketIndex; + } + return *this; +} +LBETYPE::~LBETYPE(){ +} +POCKETTYPE::POCKETTYPE(){ + memset(this, 0, SIZEOF_POCKETTYPE); + ItemCapacityPerSize.resize(35); +} +POCKETTYPE::POCKETTYPE(const POCKETTYPE& src){ + memcpy(this, &src, SIZEOF_POCKETTYPE); + ItemCapacityPerSize.resize(35); + ItemCapacityPerSize = src.ItemCapacityPerSize; +} +POCKETTYPE& POCKETTYPE::operator=(const POCKETTYPE& src){ + if (this != &src) { + memcpy(this, &src, SIZEOF_POCKETTYPE); + ItemCapacityPerSize = src.ItemCapacityPerSize; + } + return *this; +} +POCKETTYPE::~POCKETTYPE(){ +} + +bool OBJECTTYPE::IsActiveLBE(unsigned int index) +{ + if (exists() == true && Item[this->usItem].usItemClass == IC_LBEGEAR) { + return ((*this)[index]->data.lbe.bLBE == -1); + } + return false; +} + +bool OBJECTTYPE::HasAnyActiveLBEs(SOLDIERTYPE * pSoldier, UINT8 iter) +{ + if (exists() == true) { + if(pSoldier != NULL){ + for (int x = 0; x < ubNumberOfObjects; ++x) { + if ((*this)[x]->data.lbe.bLBE == -1) { + return true; + } + } + } + else{ + if((*this)[iter]->data.lbe.bLBE == -1){ + return true; + } + } + } + return false; +} + +LBENODE* OBJECTTYPE::GetLBEPointer(unsigned int index) +{ + if (LBEArray.empty() == false) { + int uniqueID = (*this)[index]->data.lbe.uniqueID; + for (std::list::iterator iter = LBEArray.begin(); iter != LBEArray.end(); ++iter) { + if (iter->uniqueID == uniqueID) { + return &(*iter); + } + } + } + return NULL; +} + +bool OBJECTTYPE::exists() +{ + if(this == NULL) + return(FALSE); + return (ubNumberOfObjects > 0 && usItem != NOTHING); +} + +void OBJECTTYPE::SpliceData(OBJECTTYPE& sourceObject, unsigned int numToSplice, StackedObjects::iterator beginIter) +{ + if (numToSplice == 0) { + return; + } + //remember that sometimes objectStack is 1 while ubNumberOfObjects is 0 + if (ubNumberOfObjects == 0) { + objectStack.clear(); + } + StackedObjects::iterator stopIter = beginIter; + for (unsigned int x = 0; x < numToSplice; ++x) { + ++stopIter; + } + objectStack.splice(objectStack.end(), sourceObject.objectStack, beginIter, stopIter); + + ubNumberOfObjects += numToSplice; + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //ubWeight = CalculateObjectWeight(this); + + if (sourceObject.objectStack.empty() == true) { + //init it so it is not empty, even though it no longer exists + sourceObject.initialize(); + } + else { + sourceObject.ubNumberOfObjects -= numToSplice; + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //sourceObject.ubWeight = CalculateObjectWeight(&sourceObject); + } +} + +int OBJECTTYPE::AddObjectsToStack(int howMany, int objectStatus) +{ + //This function is never called from a soldier, so get the max size + int numToAdd = max(0, ItemSlotLimit( this, STACK_SIZE_LIMIT ) - ubNumberOfObjects); + + //if howMany is ALL_OBJECTS the stack will become full + if (howMany != ALL_OBJECTS) { + numToAdd = min(numToAdd, howMany); + } + + if (numToAdd) { + CreateItems(usItem, objectStatus, numToAdd, &gStackTempObject); + this->AddObjectsToStack(gStackTempObject); + } + + //returns how many were NOT added + return howMany - numToAdd; +} + +bool OBJECTTYPE::CanStack(OBJECTTYPE& sourceObject, int& numToStack) +{ + //stacking control, restrict certain things here + if (numToStack > 0) { + if (exists() == true) { + if (Item[usItem].usItemClass == IC_MONEY) { + //money doesn't stack, it merges + // average out the status values using a weighted average... + int thisStatus = (*this)[0]->data.money.bMoneyStatus * (*this)[0]->data.money.uiMoneyAmount; + int sourceStatus = sourceObject[0]->data.money.bMoneyStatus * sourceObject[0]->data.money.uiMoneyAmount; + int average = (*this)[0]->data.money.uiMoneyAmount + sourceObject[0]->data.money.uiMoneyAmount; + + (*this)[0]->data.objectStatus = ( (thisStatus + sourceStatus) / average); + (*this)[0]->data.money.uiMoneyAmount += sourceObject[0]->data.money.uiMoneyAmount; + //CHRISL: We need to delete sourceObject at this point since we've just merged the two items + sourceObject.initialize(); + return false; + } + + //keys can stack if the same key + if (Item[usItem].usItemClass == IC_KEY) { + if ((*this)[0]->data.key.ubKeyID != sourceObject[0]->data.key.ubKeyID) { + return false; + } + } + + //for convenience sake, do not allow mixed flags to stack! + //currently flags are stored on a per-stack basis - the problem with them + //being on a per-object-in-stack basis is a check on the flags only ever checks the top object in the stack + //continue on because you might find something else with the same flags + //ADB added the following as of revision 1548 + //disallow stacking for objects with dissimilar UNDROPPABLE flags + //objects can stack if they are both droppable or both undroppable, but not one droppable and the other not + //they can also stack regardless of the other flags that are set, like OBJECT_NO_OVERWRITE + //in the old code objects with OBJECT_NO_OVERWRITE not only are dropped, but also can stack with others without the same flag + //I don't care to find out if this is a bug or not, I'm just going to mimic the original code. + /*CHRISL: This is just stupid. OBJECT_UNDROPPABLE is only a valid flag for NPCs so a player should never get an item + with this flag set. For some reason, however, player items can come with this flag set. But this flag doesn't effect + players in any way, so lets just clear the flag when we find it.*/ + //if ((sourceObject.fFlags & OBJECT_UNDROPPABLE) != (this->fFlags & OBJECT_UNDROPPABLE)) { + // DebugBreakpoint(); + // numToStack = 0; + //} + if(sourceObject.fFlags & OBJECT_UNDROPPABLE) + sourceObject.fFlags &= ~OBJECT_UNDROPPABLE; + if(this->fFlags & OBJECT_UNDROPPABLE) + this->fFlags &= ~OBJECT_UNDROPPABLE; + + //nor allow trapped items to stack + if (sourceObject[0]->data.bTrap > 0 + || (*this)[0]->data.bTrap > 0) { + return false; + } + //TODO other specials if there are any + } + } + return true; +} + +int OBJECTTYPE::ForceAddObjectsToStack(OBJECTTYPE& sourceObject, int howMany) +{ + if (exists() == false) { + //we are adding to an empty object, it can happen + Assert(sourceObject.exists() == true); + usItem = sourceObject.usItem; + this->fFlags = sourceObject.fFlags; + } + Assert(sourceObject.usItem == usItem); + + int numToAdd = sourceObject.ubNumberOfObjects; + //if howMany is ALL_OBJECTS the stack will become full if sourceObject has enough + if (howMany != ALL_OBJECTS) { + numToAdd = min(numToAdd, howMany); + } + + //this recalcs weight too! + SpliceData(sourceObject, numToAdd, sourceObject.objectStack.begin()); + + //returns how many were NOT added + if (howMany != ALL_OBJECTS) { + return howMany - numToAdd; + } + else { + //ALL_OBJECTS means move all, if all were moved the new size should be 0 + return sourceObject.ubNumberOfObjects; + } +} + +int OBJECTTYPE::AddObjectsToStack(OBJECTTYPE& sourceObject, int howMany, SOLDIERTYPE* pSoldier, int slot, int cap, bool allowLBETransfer) +{ + int freeObjectsInStack; + + //can't add too much, can't take too many + if(cap > 0){ + freeObjectsInStack = max(0, (cap - ubNumberOfObjects)); + } + else{ + //freeObjectsInStack = max(0, (ItemSlotLimit( this, slot, pSoldier ) - ubNumberOfObjects)); + freeObjectsInStack = max(0, (ItemSlotLimit( &sourceObject, slot, pSoldier ) - ubNumberOfObjects)); + } + int numToAdd = min (freeObjectsInStack, sourceObject.ubNumberOfObjects); + //if howMany is ALL_OBJECTS the stack will become full if sourceObject has enough + if (howMany != ALL_OBJECTS) { + numToAdd = min(numToAdd, howMany); + } + + if(numToAdd == 0){ + return 0; + } + if (this->CanStack(sourceObject, numToAdd) == false) { + return 0; + } + + //CHRISL: Moved to here so that we verify that the object can be created before starting the creation + if (exists() == false) { + //we are adding to an empty object, it can happen + Assert(sourceObject.exists() == true); + usItem = sourceObject.usItem; + this->fFlags = sourceObject.fFlags; + } + Assert(sourceObject.usItem == usItem); + + //this recalcs weight too! + SpliceData(sourceObject, numToAdd, sourceObject.objectStack.begin()); + + if (numToAdd && UsingNewInventorySystem() == true && pSoldier != NULL) { + //CHRISL: For New Inventory system. Are we handling an LBE item FROM a soldier? + if(IsSlotAnLBESlot(slot) == true && allowLBETransfer == true) + { + //we know this must be an LBE because of the slot and ubNumberOfObjects + //since we are putting this LBE into an LBE slot in a soldier + //we need to move the items inside the LBE into the soldier's inventory + MoveItemFromLBEItem( pSoldier, slot, this ); + } + } + + //returns how many were NOT added + if (howMany != ALL_OBJECTS) { + return howMany - numToAdd; + } + else { + //ALL_OBJECTS means move all, if all were moved the new size should be 0 + return sourceObject.ubNumberOfObjects; + } +} + +int OBJECTTYPE::MoveThisObjectTo(OBJECTTYPE& destObject, int numToMove, SOLDIERTYPE* pSoldier, int slot, int cap) +{ + //ADB yes I said I normally remove functions like this, but this is different + //this exists to make reading easier and to be more descriptive. + return (PrivateRemoveObjectsFromStack(numToMove, &destObject, pSoldier, slot, cap)); +} + +int OBJECTTYPE::RemoveObjectsFromStack(int howMany) +{ + return (PrivateRemoveObjectsFromStack(howMany, NULL, NULL, STACK_SIZE_LIMIT)); +} + +int OBJECTTYPE::PrivateRemoveObjectsFromStack(int howMany, OBJECTTYPE* destObject, SOLDIERTYPE* pSoldier, int slot, int cap) +{ + //ADB this function only needs to know soldier and slot + //if there is a dest object we are putting the removed objects into + //in this case it is acting as a move and has probably been called by MoveThisObjectTo + //otherwise it is acting as a delete and has probably been called by RemoveObjectsFromStack + if (howMany == ALL_OBJECTS) { + howMany = ubNumberOfObjects; + } + + int numToRemove = min(ubNumberOfObjects, howMany); + + bool allowLBETransfer = false; + if (numToRemove && UsingNewInventorySystem() == true && pSoldier != NULL) { + //CHRISL: For New Inventory system. Are we handling an LBE item FROM a soldier? + if(IsSlotAnLBESlot(slot) == true) { + //we know this must be an LBE because of the slot and ubNumberOfObjects + //but are we taking the LBE out of the pocket or putting it in? + + if (pSoldier->inv[slot].exists() == true) { + //the object exists and it is an LBE, so we must be taking it out of the pocket + //since we are moving this LBE, it needs to have the items in its pockets moved + //from the soldier's inv to the LBE's inv + MoveItemToLBEItem( pSoldier, slot ); + } + else { + //we must be putting it into the pocket, so allow the LBE to + //transfer its contents into the soldier + //but first make room by putting anything in the soldier's default LBE pockets into other pockets + std::vector LBESlots; + GetLBESlots(slot, LBESlots); + MoveItemsToActivePockets(pSoldier, LBESlots, slot, this); + allowLBETransfer = true; + } + } + } + + if (destObject) { + //destObject should be empty especially if numToRemove is 0 + //CHRISL: since destObject should be empty, let's just force it to be empty by initializing it. + //if (destObject->exists() == true) { + destObject->initialize(); + //} + if (numToRemove > 0) { + //this handles the removal too + return destObject->AddObjectsToStack(*this, numToRemove, pSoldier, slot, cap, allowLBETransfer); + } + } + else if (numToRemove > 0) { + for (int x = 0; x < numToRemove; ++x) { + objectStack.pop_front(); + } + if (objectStack.empty() == true) { + //init it so it is not empty, even though it no longer exists + initialize(); + } + else { + ubNumberOfObjects -= numToRemove; + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //ubWeight = CalculateObjectWeight(this); + } + } + + //returns how many were NOT removed + return howMany - numToRemove; +} + +bool OBJECTTYPE::RemoveObjectAtIndex(unsigned int index, OBJECTTYPE* destObject) +{ + //Note, this function does NOT care what the stack size of destObject will be + //because destObject will never be an object in a soldier's inventory! + if (index >= ubNumberOfObjects || exists() == false) { + return false; + } + + if (ubNumberOfObjects == 1) { + if (destObject) { + *destObject = *this; + } + this->initialize(); + return true; + } + + if (destObject) { + //destObject should be empty especially if it fails!! + destObject->initialize(); + } + + StackedObjects::iterator spliceIter = objectStack.begin(); + for (unsigned int x = 0; x < index; ++x) { + ++spliceIter; + } + + if (destObject) { + destObject->usItem = usItem; + destObject->fFlags = fFlags; + //handles weight calc and ubNumber too + destObject->SpliceData((*this), 1, spliceIter); + } + else { + objectStack.erase(spliceIter); + if (objectStack.empty()) { + this->initialize(); + } + else { + ubNumberOfObjects -= 1; + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //ubWeight = CalculateObjectWeight(this); + } + } + + return true; +} + +StackedObjectData* OBJECTTYPE::operator [](const unsigned int index) +{ + StackedObjects::iterator iter = objectStack.begin(); + if(index >= objectStack.size()){ + return &(*iter); + } + Assert(index < objectStack.size()); + for (unsigned int x = 0; x < index; ++x) { + ++iter; + } + return &(*iter); +} + + +//you may have noticed code like this: +//pSoldier->pTempObject = (OBJECTTYPE *)MemAlloc( sizeof( OBJECTTYPE ) ); +//memcpy( pSoldier->pTempObject, pObject, sizeof( OBJECTTYPE ) ); +//That's setting yourself up for a memleak if pSoldier->pTempObject isn't null! + +//Whenever you see code like that, write this in it's place: +//OBJECTTYPE::CopyToOrCreateAt(&pSoldier->pTempObject, pObject); + +//OR write OBJECTTYPE::DeleteMe(&pSoldier->pTempObject) if there is no memcpy +void OBJECTTYPE::CopyToOrCreateAt(OBJECTTYPE** ppTarget, OBJECTTYPE* pSource) +{ + //this is necessary because memcpy is no longer good enough for OBJECTTYPE + if (*ppTarget == NULL) { + *ppTarget = new OBJECTTYPE(*pSource); + } + else { + //ADB leaving this in for a while, not sure if the code ever even reaches here and this will tell me + DebugBreakpoint(); + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("Found mem leak, but it was corrected.")); + **ppTarget = *pSource; + } + return; +} + +//OR write OBJECTTYPE::DeleteMe(&pSoldier->pTempObject) if there is no memcpy +void OBJECTTYPE::DeleteMe(OBJECTTYPE** ppObject) +{ + if (*ppObject != NULL) { + delete *ppObject; + *ppObject = NULL; + } + return; +} + +StackedObjectData::StackedObjectData() +{ + initialize(); +} + +StackedObjectData::~StackedObjectData() +{ + attachments.clear(); +} + +OBJECTTYPE* StackedObjectData::GetAttachmentAtIndex(UINT8 index) +{ + attachmentList::iterator iter = attachments.begin(); + for (int x = 0; x < index && iter != attachments.end(); ++x) { + ++iter; + } + + if (iter != attachments.end()) { + return &(*iter); + } + return 0; +} + +bool StackedObjectData::operator==(StackedObjectData& compare) +{ + BOOLEAN pass = FALSE; + if(this->data.objectStatus == compare.data.objectStatus){ + if(this->data.gun.bGunAmmoStatus == compare.data.gun.bGunAmmoStatus){ + if(this->data.gun.bGunStatus == compare.data.gun.bGunStatus){ + if(this->data.gun.ubGunAmmoType == compare.data.gun.ubGunAmmoType){ + if(this->data.gun.ubGunShotsLeft == compare.data.gun.ubGunShotsLeft){ + if(this->data.gun.ubGunState == compare.data.gun.ubGunState){ + if(this->data.gun.usGunAmmoItem == compare.data.gun.usGunAmmoItem){ + pass = TRUE; + } + } + } + } + } + } + } + return(pass && this->attachments == compare.attachments); + //return (this->data == compare.data + // && this->attachments == compare.attachments); +} + +bool StackedObjectData::operator==(const StackedObjectData& compare)const +{ + BOOLEAN pass = FALSE; + if(this->data.objectStatus == compare.data.objectStatus){ + if(this->data.gun.bGunAmmoStatus == compare.data.gun.bGunAmmoStatus){ + if(this->data.gun.bGunStatus == compare.data.gun.bGunStatus){ + if(this->data.gun.ubGunAmmoType == compare.data.gun.ubGunAmmoType){ + if(this->data.gun.ubGunShotsLeft == compare.data.gun.ubGunShotsLeft){ + if(this->data.gun.ubGunState == compare.data.gun.ubGunState){ + if(this->data.gun.usGunAmmoItem == compare.data.gun.usGunAmmoItem){ + pass = TRUE; + } + } + } + } + } + } + } + return(pass && this->attachments == compare.attachments); + //return (this->data == compare.data + // && this->attachments == compare.attachments); +} + +bool ObjectData::operator==(ObjectData& compare) +{ + return (memcmp(this, &compare, sizeof(ObjectData)) == 0); +} + +bool ObjectData::operator==(const ObjectData& compare)const +{ + return (memcmp(this, &compare, sizeof(ObjectData)) == 0); +} + +ObjectData::ObjectData(const ObjectData& src) +{ + if ((void*)this != (void*)&src) { + //first get rid of any LBE this might have + DeleteLBE(); + + //copy over the data + this->bTrap = src.bTrap; + this->fUsed = src.fUsed; + this->ubImprintID = src.ubImprintID; + //copy over the union + this->gun = src.gun; + + //duplicate the LBE data + DuplicateLBE(); + } +} + +ObjectData& ObjectData::operator =(const ObjectData& src) +{ + if ((void*)this != (void*)&src) { + //first get rid of any LBE this might have + DeleteLBE(); + + //copy over the data + this->bTrap = src.bTrap; + this->fUsed = src.fUsed; + this->ubImprintID = src.ubImprintID; + //copy over the union + this->gun = src.gun; + + //duplicate the LBE data + DuplicateLBE(); + } + return *this; +} + +ObjectData::~ObjectData() +{ + DeleteLBE(); +} + +void ObjectData::DeleteLBE() +{ + /*CHRISL: We still need to resolve the incrementing uniqueID issue, but ADB has a valid concern for + leaving this code in place. We just need to update things so that the uniqueID only increments when we + actually have to create a new LBENODE. */ + return; + if (LBEArray.empty() == false) { + if (this->lbe.bLBE == -1) { + int uniqueID = this->lbe.uniqueID; + for (std::list::iterator iter = LBEArray.begin(); iter != LBEArray.end(); ++iter) { + if (iter->uniqueID == uniqueID) { + LBEArray.erase(iter); + break; + } + } + } + } +} + +void ObjectData::DuplicateLBE() +{ + /*CHRISL: We still need to resolve the incrementing uniqueID issue, but ADB has a valid concern for + leaving this code in place. We just need to update things so that the uniqueID only increments when we + actually have to create a new LBENODE. */ + return; + if (this->lbe.bLBE == -1) { + LBENODE* pLBE = NULL; + int uniqueID = this->lbe.uniqueID; + for (std::list::iterator iter = LBEArray.begin(); iter != LBEArray.end(); ++iter) { + if (iter->uniqueID == uniqueID) { + pLBE = &(*iter); + break; + } + } + uniqueID = gLastLBEUniqueID++; + LBEArray.push_back(LBENODE()); + LBENODE* pInserted = &LBEArray.back(); + *pInserted = *pLBE; + pInserted->uniqueID = uniqueID; + this->lbe.uniqueID = uniqueID; + } +} + +// Constructor +OBJECTTYPE::OBJECTTYPE() +{ + initialize(); +} +void OBJECTTYPE::initialize() +{ + + memset(this, 0, SIZEOF_OBJECTTYPE_POD); + + //this is an easy way to init it and get rid of attachments + objectStack.clear(); + //ubNumberOfObjects should be 0 so any loop checking it will not work + //however objectStack should always have at least one, because there are so + //many uses of (*pObj)[0]->data.objectStatus and such + objectStack.resize(1); +} + +bool OBJECTTYPE::operator==(const OBJECTTYPE& compare)const +{ + if ( memcmp(this, &compare, SIZEOF_OBJECTTYPE_POD) == 0) { + if (this->objectStack == compare.objectStack) { + return true; + } + } + return false; +} + +bool OBJECTTYPE::operator==(OBJECTTYPE& compare) +{ + if ( memcmp(this, &compare, SIZEOF_OBJECTTYPE_POD) == 0) { + if (this->objectStack == compare.objectStack) { + return true; + } + if((*this)[0]->operator == (*compare.operator[](0))) + return true; + } + return false; +} + +//Copy Ctor +OBJECTTYPE::OBJECTTYPE(const OBJECTTYPE& src) +{ + if ((void*)this != (void*)&src) { + this->usItem = src.usItem; + this->ubNumberOfObjects = src.ubNumberOfObjects; + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //this->ubWeight = src.ubWeight; + this->fFlags = src.fFlags; + this->ubMission = src.ubMission; + this->objectStack = src.objectStack; + } +} + +// Assignment operator +OBJECTTYPE& OBJECTTYPE::operator=(const OBJECTTYPE& src) +{ + if ((void*)this != (void*)&src) { + this->usItem = src.usItem; + this->ubNumberOfObjects = src.ubNumberOfObjects; + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //this->ubWeight = src.ubWeight; + this->fFlags = src.fFlags; + this->ubMission = src.ubMission; + this->objectStack = src.objectStack; + } + return *this; +} + + +// Conversion operator +OBJECTTYPE& OBJECTTYPE::operator=(const OLD_OBJECTTYPE_101& src) +{ + if ((void*)this != (void*)&src) { + //makes changes to size easier as we don't have to init new arrays with 0 by hand + this->initialize(); + + this->usItem = src.usItem; + this->ubNumberOfObjects = src.ubNumberOfObjects; + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //this->ubWeight = src.ubWeight; + this->fFlags = src.fFlags; + + this->ubMission = src.ubMission; + + //in some cases we need to reference the objectStatus or something, even though the item is totally empty + //therefore, keep ubNumberOfObjects at 0 but resize objectStack to at least 1 + this->objectStack.resize(max(ubNumberOfObjects, 1)); + if (ubNumberOfObjects == 0) { + this->usItem = NONE; + } + + //and now the big change, the union + //copy the old data, making sure not to write over, since the old size is actually 9 bytes + if (ubNumberOfObjects == 1) { + //CHRISL: Instead of a memcpy, copy values individually so we can account for the larger union size + //memcpy(&((*this)[0]->data.gun), &src.ugYucky, __min(SIZEOF_OLD_OBJECTTYPE_101_UNION,sizeof(ObjectData))); + //Start by setting status as this is the same for every structure in the union + (*this)[0]->data.gun.bGunStatus = src.ugYucky.bGunStatus; + //Next, clear the rest of the union so we are working with a clean setup. I'm clearing gun simply because it's + // the largest structure and should therefore clear all values. There may be a better way to do this. + (*this)[0]->data.gun.ubGunAmmoType = 0; + (*this)[0]->data.gun.ubGunShotsLeft = 0; + (*this)[0]->data.gun.usGunAmmoItem = 0; + (*this)[0]->data.gun.bGunAmmoStatus = 0; + (*this)[0]->data.gun.ubGunState = 0; + //Lastly, convert values from the old format to the new based on the type of object + switch(Item[src.usItem].usItemClass) + { + case IC_MONEY: + (*this)[0]->data.money.uiMoneyAmount = src.ugYucky.uiMoneyAmount; + break; + case IC_KEY: + (*this)[0]->data.key.ubKeyID = src.ugYucky.ubKeyID; + break; + case IC_GRENADE: + case IC_BOMB: + (*this)[0]->data.misc.bDetonatorType = src.ugYucky.bDetonatorType; + (*this)[0]->data.misc.usBombItem = src.ugYucky.usBombItem; + (*this)[0]->data.misc.bDelay = src.ugYucky.bDelay; // includes bFrequency + (*this)[0]->data.misc.ubBombOwner = src.ugYucky.ubBombOwner; + (*this)[0]->data.misc.bActionValue = src.ugYucky.bActionValue; + (*this)[0]->data.misc.ubTolerance = src.ugYucky.ubTolerance; // includes ubLocationID + break; + default: + //This should cover all other possibilities since only Money, Key and "Bomb/Misc" have layouts that don't + // exactly line up with gun + (*this)[0]->data.gun.ubGunAmmoType = src.ugYucky.ubGunAmmoType; + (*this)[0]->data.gun.ubGunShotsLeft = src.ugYucky.ubGunShotsLeft; + (*this)[0]->data.gun.usGunAmmoItem = src.ugYucky.usGunAmmoItem; + (*this)[0]->data.gun.bGunAmmoStatus = src.ugYucky.bGunAmmoStatus; + (*this)[0]->data.gun.ubGunState = src.ugYucky.ubGunState; + break; + } + + (*this)[0]->data.bTrap = src.bTrap; // 1-10 exp_lvl to detect + (*this)[0]->data.ubImprintID = src.ubImprintID; // ID of merc that item is imprinted on + (*this)[0]->data.fUsed = src.fUsed; // flags for whether the item is used or not + + //it's unlikely max will get less over the versions, but still, check the min + for (int x = 0; x < OLD_MAX_ATTACHMENTS_101; ++x) + { + if (src.usAttachItem[x] != NOTHING) { + CreateItem(src.usAttachItem[x], src.bAttachStatus[x], &gTempObject); + (*this)[0]->attachments.push_back(gTempObject); + } + } + } + else { + //we are loading a stack of objects, the union must either be + //bStatus[OLD_MAX_OBJECTS_PER_SLOT_101] or + //ubShotsLeft[OLD_MAX_OBJECTS_PER_SLOT_101] + //and we know it has no attachments + + Version101::OLD_OBJECTTYPE_101_UNION ugYucky; + memcpy(&ugYucky, &src.ugYucky, __min(SIZEOF_OLD_OBJECTTYPE_101_UNION,sizeof(ObjectData))); + + for (int x = 0; x < max(ubNumberOfObjects, 1); ++x) { + (*this)[x]->data.objectStatus = ugYucky.bStatus[x]; + (*this)[x]->data.bTrap = src.bTrap; // 1-10 exp_lvl to detect + (*this)[x]->data.ubImprintID = src.ubImprintID; // ID of merc that item is imprinted on + (*this)[x]->data.fUsed = src.fUsed; // flags for whether the item is used or not + } + } + + //just a precaution + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //this->ubWeight = CalculateObjectWeight(this); + } + return *this; +} + + +OBJECTTYPE::~OBJECTTYPE() +{ + objectStack.clear(); +} diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index 96a17556..1bf8e9e2 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -2,6 +2,116 @@ #define ITEM_TYPES_H #include "types.h" +#include +#include + +//if the number of slots are ever changed, the loading / saving checksum should use this value to make conversion easier +#define NUM_ORIGINAL_INV_SLOTS 19 + + +// I don't care if this isn't intuitive! The hand positions go right +// before the big pockets so we can loop through them that way. --CJC +#define NO_SLOT -1 + +// NOTE NOTE NOTE! Leave this alone until it is no longer needed. It must match the +// original definition so old files can be read. +namespace OldInventory { + enum { + HELMETPOS = 0, + VESTPOS, + LEGPOS, + HEAD1POS, + HEAD2POS, + HANDPOS, + SECONDHANDPOS, + BIGPOCK1POS, + BIGPOCK2POS, + BIGPOCK3POS, + BIGPOCK4POS, + SMALLPOCK1POS, + SMALLPOCK2POS, + SMALLPOCK3POS, + SMALLPOCK4POS, + SMALLPOCK5POS, + SMALLPOCK6POS, + SMALLPOCK7POS, + SMALLPOCK8POS, // = 18, so 19 pockets needed + + NUM_INV_SLOTS = NUM_ORIGINAL_INV_SLOTS + }; +}; + +/* CHRISL: Added listings for each of the new inventory pockets. Also split the enum so we could include +endpoint markers for each type (big, med, sml) of pocket. */ +typedef enum INVENTORY_SLOT{ + HELMETPOS = 0, + VESTPOS, + LEGPOS, + HEAD1POS, + HEAD2POS, + HANDPOS, + SECONDHANDPOS, + VESTPOCKPOS, + LTHIGHPOCKPOS, + RTHIGHPOCKPOS, + CPACKPOCKPOS, + BPACKPOCKPOS, + GUNSLINGPOCKPOS, + KNIFEPOCKPOS, + BIGPOCK1POS, + BIGPOCK2POS, + BIGPOCK3POS, + BIGPOCK4POS, + BIGPOCK5POS, + BIGPOCK6POS, + BIGPOCK7POS, + MEDPOCK1POS, + MEDPOCK2POS, + MEDPOCK3POS, + MEDPOCK4POS, + SMALLPOCK1POS, + SMALLPOCK2POS, + SMALLPOCK3POS, + SMALLPOCK4POS, + SMALLPOCK5POS, + SMALLPOCK6POS, + SMALLPOCK7POS, + SMALLPOCK8POS, + SMALLPOCK9POS, + SMALLPOCK10POS, + SMALLPOCK11POS, + SMALLPOCK12POS, + SMALLPOCK13POS, + SMALLPOCK14POS, + SMALLPOCK15POS, + SMALLPOCK16POS, + SMALLPOCK17POS, + SMALLPOCK18POS, + SMALLPOCK19POS, + SMALLPOCK20POS, + SMALLPOCK21POS, + SMALLPOCK22POS, + SMALLPOCK23POS, + SMALLPOCK24POS, + SMALLPOCK25POS, + SMALLPOCK26POS, + SMALLPOCK27POS, + SMALLPOCK28POS, + SMALLPOCK29POS, + SMALLPOCK30POS, + NUM_INV_SLOTS, +}; + +#define INV_START_POS 0 +#define BODYPOSSTART HELMETPOS +extern int BODYPOSFINAL ;//= GUNSLINGPOCKPOS;//RESET in initInventory +#define BIGPOCKSTART BIGPOCK1POS +extern int BIGPOCKFINAL ;//= MEDPOCK1POS;//RESET in initInventory +extern int MEDPOCKSTART ;//= MEDPOCK1POS;//RESET in initInventory +extern int MEDPOCKFINAL ;//= SMALLPOCK1POS;//RESET in initInventory +#define SMALLPOCKSTART SMALLPOCK1POS +extern int SMALLPOCKFINAL ;//= NUM_INV_SLOTS;//RESET in initInventory +#define STACK_SIZE_LIMIT NUM_INV_SLOTS #define INVALIDCURS 0 #define QUESTCURS 1 @@ -41,7 +151,7 @@ #define USABLE 10 // minimum work% of items to still be usable -#define MAX_OBJECTS_PER_SLOT 8 +#define MAX_OBJECTS_PER_SLOT 255 #define MAX_ATTACHMENTS 4 #define MAX_MONEY_PER_SLOT 20000 @@ -68,12 +178,59 @@ typedef enum #define OBJECT_NO_OVERWRITE 0x80 #define GS_CARTRIDGE_IN_CHAMBER 0x01 +#define GS_WEAPON_BEING_RELOADED 0x02 -typedef struct +//forward declaration +class OBJECTTYPE; +class SOLDIERTYPE; + +#define MAX_ITEMS_IN_LBE 12 + +//CHRISL: +class LBENODE { - UINT16 usItem; - UINT8 ubNumberOfObjects; - union +public: + LBENODE() { initialize();}; + void initialize() {inv.clear();}; + BOOLEAN Load( HWFILE hFile ); + BOOLEAN Load( INT8** hBuffer, float dMajorMapVersion, UINT8 ubMinorMapVersion ); + BOOLEAN Save( HWFILE hFile, bool fSavingMap ); + + UINT32 lbeClass; + UINT16 lbeIndex; + UINT8 ubID; + BOOLEAN ZipperFlag; + int uniqueID; + UINT32 uiNodeChecksum; + char endOfPOD; + //compiler complains about too big an array since OBJECTTYPE's size is unknown at this time, because of forward declaration + //OBJECTTYPE inv[ITEMS_IN_LBE]; + std::vector inv; +}; +#define SIZEOF_LBENODE_POD (offsetof(LBENODE, endOfPOD)) +void CreateLBE(OBJECTTYPE* pObj, UINT8 ubID, int numSubPockets); +bool DestroyLBEIfEmpty(OBJECTTYPE* pObj); +void DestroyLBE(OBJECTTYPE* pObj); +void GetLBESlots(UINT32 LBEType, std::vector& LBESlots); +void MoveItemsInSlotsToLBE( SOLDIERTYPE *pSoldier, std::vector& LBESlots, LBENODE* pLBE, OBJECTTYPE* pObj); + +// CHRISL: +BOOLEAN MoveItemsToActivePockets( SOLDIERTYPE *pSoldier, std::vector& LBESlots, UINT32 uiHandPos, OBJECTTYPE *pObj ); +BOOLEAN MoveItemToLBEItem( SOLDIERTYPE *pSoldier, UINT32 uiHandPos ); +BOOLEAN MoveItemFromLBEItem( SOLDIERTYPE *pSoldier, UINT32 uiHandPos, OBJECTTYPE *pObj ); +bool IsSlotAnLBESlot(int slot); +bool IsSlotASmallPocket(int slot); + +extern std::list LBEArray; + +//do not alter or saves will break, create new defines if the size changes +#define OLD_MAX_ATTACHMENTS_101 4 +#define OLD_MAX_OBJECTS_PER_SLOT_101 8 + +namespace Version101 +{ + //union was originally unnamed + union OLD_OBJECTTYPE_101_UNION { struct { @@ -83,68 +240,80 @@ typedef struct UINT16 usGunAmmoItem; // the item # for the item table INT8 bGunAmmoStatus; // only for "attached ammo" - grenades, mortar shells UINT8 ubGunState; // SB manual recharge - UINT8 ubGunUnused[MAX_OBJECTS_PER_SLOT - 6]; - } Gun; + //warning, this unused space is the wrong size, 7 bytes above, 2 in the array, but it's been saved like that + UINT8 ubGunUnused[OLD_MAX_OBJECTS_PER_SLOT_101 - 6]; + }; struct { - UINT8 ubShotsLeft[MAX_OBJECTS_PER_SLOT]; - } Ammo; + UINT8 ubShotsLeft[OLD_MAX_OBJECTS_PER_SLOT_101]; + }; struct { - INT8 bStatus[MAX_OBJECTS_PER_SLOT]; - } Generic; + INT8 bStatus[OLD_MAX_OBJECTS_PER_SLOT_101]; + }; struct { INT8 bMoneyStatus; - UINT32 uiMoneyAmount; - UINT8 ubMoneyUnused[MAX_OBJECTS_PER_SLOT - 5]; - } Money; + UINT32 uiMoneyAmount; + UINT8 ubMoneyUnused[OLD_MAX_OBJECTS_PER_SLOT_101 - 5]; + }; struct { // this is used by placed bombs, switches, and the action item INT8 bBombStatus; // % status INT8 bDetonatorType; // timed, remote, or pressure-activated - UINT16 usBombItem; // the usItem of the bomb. + UINT16 usBombItem; // the usItem of the bomb. union { - //struct - //{ + struct + { INT8 bDelay; // >=0 values used only - //}; - //struct - //{ + }; + struct + { INT8 bFrequency; // >=0 values used only - //}; - } BombTrigger; - UINT8 ubBombOwner; // side which placed the bomb + }; + }; + UINT8 ubBombOwner; // side which placed the bomb UINT8 bActionValue;// this is used by the ACTION_ITEM fake item union { - //struct - //{ + struct + { UINT8 ubTolerance; // tolerance value for panic triggers - //}; - //struct - //{ + }; + struct + { UINT8 ubLocationID; // location value for remote non-bomb (special!) triggers - //}; - } Area; - } Trigger; + }; + }; + }; struct { INT8 bKeyStatus[ 6 ]; UINT8 ubKeyID; UINT8 ubKeyUnused[1]; - } Key; + }; struct { UINT8 ubOwnerProfile; UINT8 ubOwnerCivGroup; UINT8 ubOwnershipUnused[6]; - } Owner; - } ItemData; + }; + }; +}; +#define SIZEOF_OLD_OBJECTTYPE_101_UNION (sizeof(Version101::OLD_OBJECTTYPE_101_UNION)) + +class OLD_OBJECTTYPE_101 +{ +public: + UINT16 usItem; + UINT8 ubNumberOfObjects; + + Version101::OLD_OBJECTTYPE_101_UNION ugYucky; + // attached objects - UINT16 usAttachItem[MAX_ATTACHMENTS]; - INT8 bAttachStatus[MAX_ATTACHMENTS]; + UINT16 usAttachItem[OLD_MAX_ATTACHMENTS_101]; + INT8 bAttachStatus[OLD_MAX_ATTACHMENTS_101]; INT8 fFlags; UINT8 ubMission; @@ -152,34 +321,186 @@ typedef struct UINT8 ubImprintID; // ID of merc that item is imprinted on UINT8 ubWeight; UINT8 fUsed; // flags for whether the item is used or not -} OBJECTTYPE; +}; -/* -typedef struct +namespace ObjectDataStructs { + struct OBJECT_GUN + { + INT16 bGunStatus; // status % of gun + UINT8 ubGunAmmoType; // ammo type, as per weapons.h + UINT16 ubGunShotsLeft; // duh, amount of ammo left + UINT16 usGunAmmoItem; // the item # for the item table + INT16 bGunAmmoStatus; // only for "attached ammo" - grenades, mortar shells + UINT8 ubGunState; // SB manual recharge + }; + struct OBJECT_MONEY + { + INT16 bMoneyStatus; + UINT32 uiMoneyAmount; + }; + struct OBJECT_BOMBS_AND_OTHER + { // this is used by placed bombs, switches, and the action item + INT16 bBombStatus; // % status + INT8 bDetonatorType; // timed, remote, or pressure-activated + UINT16 usBombItem; // the usItem of the bomb. + union + { + INT8 bDelay; // >=0 values used only + INT8 bFrequency; // >=0 values used only + }; + UINT8 ubBombOwner; // side which placed the bomb + UINT8 bActionValue; // this is used by the ACTION_ITEM fake item + union + { + UINT8 ubTolerance; // tolerance value for panic triggers + UINT8 ubLocationID; // location value for remote non-bomb (special!) triggers + }; + }; + struct OBJECT_KEY + { + INT16 bKeyStatus; + UINT8 ubKeyID; + }; + struct OBJECT_OWNER + { + UINT16 ubOwnerProfile; + UINT8 ubOwnerCivGroup; + }; + struct OBJECT_LBE + { + INT16 bLBEStatus; + INT8 bLBE; // Marks item as LBENODE + int uniqueID; // how the LBENODE is accessed + }; +}; + +class ObjectData { - UINT8 ubCursor; - INT8 bSoundType; - UINT8 ubGraphicNum; - INT8 bMaxLoad; - - UINT8 ubPerPocket; - UINT8 ubCanDamage; - UINT8 ubWaterDamage; - UINT8 ubCanRepair; - - UINT8 ubSeeMeter; - UINT8 ubRange; - UINT8 ubMetal; - UINT8 ubSinkable; - - UINT16 ubPrice; - UINT8 ubMission; - UINT8 ubCoolness; -} INVTYPE; - -*/ +public: + //needs a default ctor that inits stuff so that an objectStack can be init with 1 empty ObjectData + ObjectData() {initialize();}; + ~ObjectData(); + // Copy Constructor + ObjectData(const ObjectData&); + // Assignment operator + ObjectData& operator=(const ObjectData&); + void initialize() {memset(this, 0, sizeof(ObjectData));}; + void DeleteLBE(); + void DuplicateLBE(); + bool operator==(ObjectData& compare); + bool operator==(const ObjectData& compare)const; + + + union { + INT16 objectStatus;//holds the same value as bStatus[0] + UINT16 ubShotsLeft;//holds the same value as ubShotsLeft[0] + ObjectDataStructs::OBJECT_GUN gun; + ObjectDataStructs::OBJECT_MONEY money; + ObjectDataStructs::OBJECT_BOMBS_AND_OTHER misc; + ObjectDataStructs::OBJECT_KEY key; + ObjectDataStructs::OBJECT_OWNER owner; + ObjectDataStructs::OBJECT_LBE lbe; + }; + INT8 bTrap; // 1-10 exp_lvl to detect + UINT8 fUsed; // flags for whether the item is used or not + UINT8 ubImprintID; // ID of merc that item is imprinted on +}; + + +typedef std::list attachmentList; +class StackedObjectData { +public: + StackedObjectData(); + ~StackedObjectData(); + void initialize() {attachments.clear(); data.initialize();}; + OBJECTTYPE* GetAttachmentAtIndex(UINT8 index); + bool operator==(StackedObjectData& compare); + bool operator==(const StackedObjectData& compare)const; + + BOOLEAN Load( HWFILE hFile ); + BOOLEAN Load( INT8** hBuffer, float dMajorMapVersion, UINT8 ubMinorMapVersion ); + BOOLEAN Save( HWFILE hFile, bool fSavingMap ); + + attachmentList attachments; + ObjectData data; +}; +typedef std::list StackedObjects; + + +#define ALL_OBJECTS -1 +class OBJECTTYPE +{ +public: + // Constructor + OBJECTTYPE(); + // Conversion operator + OBJECTTYPE& operator=(const OLD_OBJECTTYPE_101&); + // Copy Constructor + OBJECTTYPE(const OBJECTTYPE&); + // Assignment operator + OBJECTTYPE& operator=(const OBJECTTYPE&); + // Destructor + ~OBJECTTYPE(); + + StackedObjectData* operator[](const unsigned int index); + + // Initialize the soldier. + // Use this instead of the old method of calling memset. + // Note that the constructor does this automatically. + void initialize(); + + bool operator==(OBJECTTYPE& compare); + bool operator==(const OBJECTTYPE& compare)const; + bool exists(); + bool IsActiveLBE(unsigned int index); + bool HasAnyActiveLBEs(SOLDIERTYPE * pSoldier = NULL, UINT8 iter = 0); + LBENODE* GetLBEPointer(unsigned int index); + + + UINT16 GetWeightOfObjectInStack(unsigned int index = 0); + int AddObjectsToStack(int howMany, int objectStatus = 100); + int AddObjectsToStack(OBJECTTYPE& sourceObject, int howManyWanted = ALL_OBJECTS, SOLDIERTYPE* pSoldier = NULL, int slot = STACK_SIZE_LIMIT, int cap = 0, bool allowLBETransfer = true); + int ForceAddObjectsToStack(OBJECTTYPE& sourceObject, int howManyWanted = ALL_OBJECTS); + int MoveThisObjectTo(OBJECTTYPE& destObject, int numToMove = ALL_OBJECTS, SOLDIERTYPE* pSoldier = NULL, int slot = STACK_SIZE_LIMIT, int cap = 0); + int RemoveObjectsFromStack(int howMany); + bool RemoveObjectAtIndex(unsigned int index, OBJECTTYPE* destObject = NULL); +private://these are only helpers for the above functions + int PrivateRemoveObjectsFromStack(int howMany, OBJECTTYPE* destObject = NULL, SOLDIERTYPE* pSoldier = NULL, int slot = STACK_SIZE_LIMIT, int cap = 0); + void SpliceData(OBJECTTYPE& sourceObject, unsigned int numToSplice, StackedObjects::iterator beginIter); + bool CanStack(OBJECTTYPE& sourceObject, int& numToStack); +public: + + BOOLEAN AttachObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttachment, BOOLEAN playSound = TRUE, UINT8 subObject = 0); + BOOLEAN RemoveAttachment( OBJECTTYPE* pAttachment, OBJECTTYPE * pNewObj = NULL, UINT8 subObject = 0); + + + //see comments in .cpp + static void DeleteMe(OBJECTTYPE** ppObject); + static void CopyToOrCreateAt(OBJECTTYPE** ppTarget, OBJECTTYPE* pSource); + + BOOLEAN Load( HWFILE hFile ); + BOOLEAN Load( INT8** hBuffer, float dMajorMapVersion, UINT8 ubMinorMapVersion ); + BOOLEAN Save( HWFILE hFile, bool fSavingMap ); + + //POD + UINT16 usItem; + UINT8 ubNumberOfObjects; + UINT8 ubMission; //EDIT THIS OUT WHEN THERE ARE NO ASSERTS! + + //ADB ubWeight has been removed because it is always recalculated at every object change but only used in 1 place!!! + //much better to recalculate it only where it is used once!!! + //UINT16 ubWeight; //used to be UINT8 + UINT8 fFlags;//used to be INT8, but that makes anything with OBJECT_NO_OVERWRITE negative + + char endOfPOD; +#define SIZEOF_OBJECTTYPE_POD (offsetof(OBJECTTYPE, endOfPOD)) + + StackedObjects objectStack; +}; + +extern OBJECTTYPE gTempObject; // SUBTYPES #define IC_NONE 0x00000001 @@ -204,6 +525,7 @@ typedef struct #define IC_FACE 0x00008000 #define IC_KEY 0x00010000 +#define IC_LBEGEAR 0x00020000 // Added for LBE items as part of the new inventory system #define IC_MISC 0x10000000 #define IC_MONEY 0x20000000 @@ -213,7 +535,7 @@ typedef struct #define IC_EXPLOSV ( IC_GRENADE | IC_BOMB ) #define IC_BOBBY_GUN ( IC_GUN | IC_LAUNCHER ) -#define IC_BOBBY_MISC ( IC_GRENADE | IC_BOMB | IC_MISC | IC_MEDKIT | IC_KIT | IC_BLADE | IC_THROWING_KNIFE | IC_PUNCH | IC_FACE ) +#define IC_BOBBY_MISC ( IC_GRENADE | IC_BOMB | IC_MISC | IC_MEDKIT | IC_KIT | IC_BLADE | IC_THROWING_KNIFE | IC_PUNCH | IC_FACE | IC_LBEGEAR ) // replaces candamage @@ -270,6 +592,7 @@ typedef struct UINT16 ubGraphicNum; UINT8 ubWeight; //2 units per kilogram; roughly 1 unit per pound UINT8 ubPerPocket; + UINT8 ItemSize; UINT16 usPrice; UINT8 ubCoolness; INT8 bReliability; @@ -312,6 +635,7 @@ typedef struct BOOLEAN gasmask; BOOLEAN lockbomb; BOOLEAN flare; + BOOLEAN ammocrate; INT16 percentnoisereduction; INT16 bipod; INT16 tohitbonus; @@ -341,6 +665,7 @@ typedef struct INT16 dayvisionrangebonus; INT16 cavevisionrangebonus; INT16 brightlightvisionrangebonus; + INT16 itemsizebonus; BOOLEAN leatherjacket; BOOLEAN batteries; BOOLEAN needsbatteries; @@ -390,10 +715,63 @@ typedef struct INT16 snowCamobonus; BOOLEAN scifi; // item only available in scifi mode + BOOLEAN newinv; // item only available in new inventory mode UINT16 defaultattachment; } INVTYPE; +// CHRISL: Added new structures to handle LBE gear and the two new XML files that will be needed to deal +// with the IC pockets and the new inventory system. +class LBETYPE{ +public: + LBETYPE(); + LBETYPE(const LBETYPE&); + LBETYPE& operator=(const LBETYPE&); + ~LBETYPE(); + UINT16 lbeIndex; + UINT32 lbeClass; + UINT8 lbeCombo; + UINT8 lbeFilledSize; + char POD; + std::vector lbePocketIndex; +}; +#define SIZEOF_LBETYPE offsetof( LBETYPE, POD ) +extern std::vector LoadBearingEquipment; +typedef enum eLBE_CLASS // Designation of lbeClass +{ + THIGH_PACK=1, + VEST_PACK, + COMBAT_PACK, + BACKPACK, + LBE_POCKET, + OTHER_POCKET +}; + + +class POCKETTYPE{ +public: + POCKETTYPE(); + POCKETTYPE(const POCKETTYPE&); + POCKETTYPE& operator=(const POCKETTYPE&); + ~POCKETTYPE(); + UINT16 pIndex; + CHAR8 pName[80]; + UINT8 pSilhouette; + UINT16 pType; + UINT32 pRestriction; + char POD; + std::vector ItemCapacityPerSize; +}; +#define SIZEOF_POCKETTYPE offsetof( POCKETTYPE, POD ) +extern std::vector LBEPocketType; +typedef enum ePOCKET_TYPE +{ + NO_POCKET_TYPE = 0, + GUNSLING_POCKET_TYPE = 1, + KNIFE_POCKET_TYPE = 2, + VEHICLE_POCKET_TYPE = 3, +}; + #define FIRST_WEAPON 1 #define FIRST_AMMO 71 #define FIRST_EXPLOSIVE 131 @@ -797,9 +1175,45 @@ typedef enum UNUSED_47, UNUSED_48, // 350 + //CHRISL: Default NIV items + DEFAULT_THIGH = 428, + DEFAULT_VEST = 434, + DEFAULT_CPACK = 442, + DEFAULT_BPACK = 448, + MAXITEMS = 5001 } ITEMDEFINE; +/* CHRISL: Arrays to track ic group information. These allow us to determine which LBE slots control which pockets and +what LBE class the pockets are.*/ +// { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54} +// Determines which LBE Slot controls each pocket +const INT8 icLBE[NUM_INV_SLOTS] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,10,10,11,11,11,11, 7, 7, 8, 9, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9,10,10,10,10,11,11,11,11,11,11,11,11}; + +// Determines the class (and default definition) of the controlling pocket +const INT8 icClass[NUM_INV_SLOTS] = {-1,-1,-1,-1,-1,-1,-1, 5, 5, 5, 5, 5, 6, 6, 3, 3, 3, 4, 4, 4, 4, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4}; + +// Determines the pocket number to look at in LBETYPE +const INT8 icPocket[NUM_INV_SLOTS] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 4, 5, 6, 8, 9,10,11,10,11, 4, 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 6, 7}; + +// Determines which pockets are used in the old inventory system. +const INT8 oldInv[NUM_INV_SLOTS] = { 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + +// Determines which pockets to use for vehicles in the new inventory system. +const INT8 vehicleInv[NUM_INV_SLOTS]= { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}; + +// Determines the default pocket +const INT16 icDefault[NUM_INV_SLOTS] = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + DEFAULT_CPACK, DEFAULT_CPACK, DEFAULT_CPACK, + DEFAULT_BPACK, DEFAULT_BPACK, DEFAULT_BPACK, DEFAULT_BPACK, + DEFAULT_VEST, DEFAULT_VEST, + DEFAULT_THIGH, DEFAULT_THIGH, + DEFAULT_VEST, DEFAULT_VEST, DEFAULT_VEST, DEFAULT_VEST, DEFAULT_VEST, DEFAULT_VEST, DEFAULT_VEST, DEFAULT_VEST, DEFAULT_VEST, DEFAULT_VEST, + DEFAULT_THIGH, DEFAULT_THIGH, DEFAULT_THIGH, DEFAULT_THIGH, DEFAULT_THIGH, DEFAULT_THIGH, DEFAULT_THIGH, DEFAULT_THIGH, + DEFAULT_CPACK, DEFAULT_CPACK, DEFAULT_CPACK, DEFAULT_CPACK, + DEFAULT_BPACK, DEFAULT_BPACK, DEFAULT_BPACK, DEFAULT_BPACK, DEFAULT_BPACK, DEFAULT_BPACK, DEFAULT_BPACK, DEFAULT_BPACK}; + #define FIRST_HELMET STEEL_HELMET #define LAST_HELMET SPECTRA_HELMET_Y @@ -886,7 +1300,7 @@ enum IMP_MARTIALARTS, IMP_NIGHTOPS, IMP_STEALTHY, - IMP_ROOFTOPS, + IMP_PROF_SNIPER, IMP_LOCKPICKING, IMP_ELECTRONICS, IMP_THROWING, @@ -903,4 +1317,4 @@ enum extern IMP_ITEM_CHOICE_TYPE gIMPItemChoices[MAX_IMP_ITEM_TYPES]; -#endif \ No newline at end of file +#endif diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 2b091048..8a8e5db9 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -50,14 +50,21 @@ #include "Smell.h" #include "lighting.h" #include "utilities.h" + #include "english.h" #endif -#define ANY_MAGSIZE 255 +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + +#define ANY_MAGSIZE 65535 -void RemoveObjs( OBJECTTYPE * pObj, UINT8 ubNumberToRemove ); void SetNewItem( SOLDIERTYPE *pSoldier, UINT8 ubInvPos, BOOLEAN fNewItem ); extern SOLDIERTYPE *gpItemDescSoldier; +extern BOOLEAN fShowMapInventoryPool; +extern BOOLEAN AutoPlaceObjectInInventoryStash( OBJECTTYPE *pItemPtr, INT16 sGridNo ); // weight units are 100g each @@ -67,7 +74,7 @@ extern SOLDIERTYPE *gpItemDescSoldier; INVTYPE Item[MAXITEMS]; //= //{ -//// CLASS SOUND GRPH GRA- PER +//// CLASS SOUND GRPH GRA- PER ////CLASS INDEX CURSOR TYPE TYPE PHIC WT PCKT PRICE COOL DESCRIPTION REL REPAIR FLAGS ////--------- ----- ------- ------- ---- -- -- ---- ----- ---- ----------- --- ------ ----- //{ IC_PUNCH, 0, PUNCHCURS, 0, 0, 0, 0, 0, 0, 0, /* nothing! */ 0, 0, ITEM_NOT_BUYABLE , 0, "Nothing"}, @@ -286,7 +293,7 @@ INVTYPE Item[MAXITEMS]; //= //{ IC_ARMOUR, 17, INVALIDCURS, COND, 2, 15, 15, 0, 250, 0, /* Kevlar helm w X */ 0, -1, IF_STANDARD_ARMOUR | ITEM_NOT_BUYABLE }, //{ IC_ARMOUR, 18, INVALIDCURS, COND, 2, 8, 13, 0, 300, 0, /* Kevlar helm w Y */ 0, +1, IF_STANDARD_ARMOUR | ITEM_NOT_BUYABLE }, //{ IC_ARMOUR, 19, INVALIDCURS, COND, 1, 62, 14, 0, 450, 7, /* Spectra helmet */ 0, -2, IF_STANDARD_ARMOUR}, -// +// //{ IC_ARMOUR, 20, INVALIDCURS, COND, 2, 14, 15, 0, 550, 0, /* Spectra helm w X*/ 0, -3, IF_STANDARD_ARMOUR | ITEM_NOT_BUYABLE }, //{ IC_ARMOUR, 21, INVALIDCURS, COND, 2, 7, 13, 0, 650, 0, /* Spectra helm w Y*/ 0, -1, IF_STANDARD_ARMOUR | ITEM_NOT_BUYABLE }, //{ IC_ARMOUR, 22, INVALIDCURS, COND, 1, 81, 12, 2, 250, 5, /* Ceramic plates */ 0, -4, (IF_STANDARD_ARMOUR | ITEM_ATTACHMENT) & (~ITEM_REPAIRABLE) }, @@ -981,7 +988,7 @@ UINT16 Attachment[MAXATTACHMENTS][3];// = // {CERAMIC_PLATES, KEVLAR2_VEST}, // {CERAMIC_PLATES, KEVLAR2_VEST_18}, // {CERAMIC_PLATES, KEVLAR2_VEST_Y}, -// +// // {SPRING, ALUMINUM_ROD}, // {QUICK_GLUE, STEEL_ROD}, // {DUCT_TAPE, STEEL_ROD}, @@ -1123,10 +1130,10 @@ UINT16 Merge[MAXITEMS+1][6];// = ComboMergeInfoStruct AttachmentComboMerge[MAXITEMS+1];// = //{ -// // base item attach 1 attach 2 result +// // base item attach 1 attach 2 result // {ALUMINUM_ROD, {SPRING, NOTHING}, SPRING_AND_BOLT_UPGRADE }, // {STEEL_ROD, {QUICK_GLUE, DUCT_TAPE}, GUN_BARREL_EXTENDER }, -// {FUMBLE_PAK, {XRAY_BULB, CHEWING_GUM}, FLASH_DEVICE }, +// {FUMBLE_PAK, {XRAY_BULB, CHEWING_GUM}, FLASH_DEVICE }, // {LAME_BOY, {COPPER_WIRE, NOTHING}, DISPLAY_UNIT }, // {GOLDWATCH, {COPPER_WIRE, NOTHING}, DETONATOR}, // {NOTHING, {NOTHING, NOTHING}, NOTHING }, @@ -1183,6 +1190,34 @@ UINT16 ReplacementAmmo[][2] = { 0, 0 } }; +// CHRISL: Structure Definitions for new inventory system items. +std::vector LoadBearingEquipment; +//LBETYPE LoadBearingEquipment[MAXITEMS+1]; +//LBETYPE LoadBearingEquipment[] = +//{ +// // Index Class Pocket Types--------------------------------- +// { 0, /*Blank Entry*/ 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, +// { 1, /*Default Thigh Pack*/ 0, {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, +// { 2, /*Default Vest Pack*/ 1, {1, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0} }, +// { 3, /*Default Combat Pack*/ 2, {1, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0} }, +// { 4, /*Default Back Pack*/ 3, {1, 1, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0} }, +// { 5, /*6P Backpack*/ 3, {1, 1, 1, 1, 0, 0, 0, 0, 3, 3, 0, 0} }, +// { 6, /*6P Combat Pack*/ 2, {1, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0} } +//}; + +std::vector LBEPocketType; +//TODO make the indices of this a define, because I do not know what is a large pocket (I guess 3) + +//POCKETTYPE LBEPocketType[MAXITEMS+1]; //= +//{ +// { /* Blank Entry */ 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, +// { /* Small General Pocket */ 1, 0, 0, {4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, +// { /* Med General Pocket */ 2, 0, 0, {7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, +// { /* Lg General Pocket */ 3, 0, 0, {10,9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, +// { /* Gun Sling */ 4, 0, 1, {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, +// { /* Knife Pocket */ 5, 0, 1, {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} } +//}; + BOOLEAN ItemIsLegal( UINT16 usItemIndex ) { //if the user has selected the reduced gun list @@ -1207,16 +1242,27 @@ BOOLEAN ItemIsLegal( UINT16 usItemIndex ) return FALSE; } + // CHRISL: Restrict system specific items + if( (UsingNewInventorySystem() == true) ) + { + if(Item[usItemIndex].ItemSize == 99) + return FALSE; + } + else + { + if(Item[usItemIndex].usItemClass == IC_LBEGEAR || Item[usItemIndex].newinv) + return FALSE; + } return(TRUE); -} +} // also used for ammo BOOLEAN ExtendedGunListGun( UINT16 usGun ) { // return( (Item[ usGun ].fFlags & ITEM_BIGGUNLIST) != 0 ); return( (Item[ usGun ].biggunlist ) != 0 ); -} +} UINT16 StandardGunListReplacement( UINT16 usGun ) { @@ -1270,29 +1316,29 @@ UINT16 StandardGunListAmmoReplacement( UINT16 usAmmo ) BOOLEAN WeaponInHand( SOLDIERTYPE * pSoldier ) { - if ( Item[pSoldier->inv[HANDPOS].usItem].usItemClass & (IC_WEAPON | IC_THROWN) ) + if ( Item[pSoldier->inv[HANDPOS].usItem].usItemClass & (IC_WEAPON | IC_THROWN) && pSoldier->inv[HANDPOS].exists() == true) { if (Item[pSoldier->inv[HANDPOS].usItem].fingerprintid ) { - if (pSoldier->inv[HANDPOS].ubImprintID != NO_PROFILE) + if (pSoldier->inv[HANDPOS][0]->data.ubImprintID != NO_PROFILE) { if (pSoldier->ubProfile != NO_PROFILE && pSoldier->ubProfile != MADLAB ) { - if (pSoldier->inv[HANDPOS].ubImprintID != pSoldier->ubProfile) + if (pSoldier->inv[HANDPOS][0]->data.ubImprintID != pSoldier->ubProfile) { return( FALSE ); } } else { - if (pSoldier->inv[HANDPOS].ubImprintID != (NO_PROFILE + 1) ) + if (pSoldier->inv[HANDPOS][0]->data.ubImprintID != (NO_PROFILE + 1) ) { return( FALSE ); } } } } - if (pSoldier->inv[HANDPOS].ItemData.Gun.bGunStatus >= USABLE) + if (pSoldier->inv[HANDPOS][0]->data.gun.bGunStatus >= USABLE) { return( TRUE ); } @@ -1301,28 +1347,108 @@ BOOLEAN WeaponInHand( SOLDIERTYPE * pSoldier ) return( FALSE ); } -UINT8 ItemSlotLimit( UINT16 usItem, INT8 bSlot ) +bool FitsInSmallPocket(OBJECTTYPE* pObj) { - UINT8 ubSlotLimit; - - if ( bSlot < BIGPOCK1POS ) - { - return( 1 ); + if (UsingNewInventorySystem() == true) { + return true; } - else - { - ubSlotLimit = Item[usItem].ubPerPocket; - if (bSlot >= SMALLPOCK1POS && ubSlotLimit > 1) + return Item[pObj->usItem].ubPerPocket != 0; +} + +// CHRISL: New definition for this function so that we can look at soldiers LBE pockets. +UINT8 ItemSlotLimit( OBJECTTYPE * pObject, INT16 bSlot, SOLDIERTYPE *pSoldier, BOOLEAN cntAttach ) +{ + UINT8 ubSlotLimit; + UINT8 pIndex; + UINT16 usItem, iSize; + UINT16 sSize = 0; + + //doesn't matter what inventory method we are using + usItem = pObject->usItem; + if (usItem == MONEY) { + //need to have money "stackable" in all slots to trick it into merging + return 2; + } + + //doesn't matter what inventory method we are using, "body" slots always have a capacity of 1 + if(bSlot < BODYPOSFINAL) + return 1; + + ubSlotLimit = Item[usItem].ubPerPocket; + if ( ubSlotLimit > MAX_OBJECTS_PER_SLOT ) { + ubSlotLimit = MAX_OBJECTS_PER_SLOT; + } + if (bSlot == STACK_SIZE_LIMIT) { + //if it is stack size limit we want it to be a big slot or a vehicle slot + if (UsingNewInventorySystem() == false) + return (max(1, ubSlotLimit)); + else + return (max(1, LBEPocketType[VEHICLE_POCKET_TYPE].ItemCapacityPerSize[__min(34,Item[pObject->usItem].ItemSize)])); + } + + if (UsingNewInventorySystem() == false) { + if (ubSlotLimit == 0 && bSlot < BIGPOCKFINAL) { + return 1; + } + if (bSlot >= BIGPOCKFINAL && ubSlotLimit > 1) { ubSlotLimit /= 2; } return( ubSlotLimit ); } + + + //UsingNewInventorySystem == true + if (pSoldier != NULL && (pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE)) { + pIndex = VEHICLE_POCKET_TYPE; + } + // IC Group Slots + else if (bSlot == GUNSLINGPOCKPOS) { + pIndex = GUNSLING_POCKET_TYPE; + } + else if (bSlot == KNIFEPOCKPOS) { + pIndex = KNIFE_POCKET_TYPE; + } + else { + Assert(icLBE[bSlot] != -1 && icDefault[bSlot] != -1 && icPocket[bSlot] != -1); + //find the class of the LBE, then find what size the pocket of the slot in the LBE is + if (pSoldier == NULL || pSoldier->inv[icLBE[bSlot]].exists() == false) { + pIndex = LoadBearingEquipment[Item[icDefault[bSlot]].ubClassIndex].lbePocketIndex[icPocket[bSlot]]; + } + else { + pIndex = LoadBearingEquipment[Item[pSoldier->inv[icLBE[bSlot]].usItem].ubClassIndex].lbePocketIndex[icPocket[bSlot]]; + } + } + + //We need to actually check the size of the largest stored item as well as the size of the current item + if(cntAttach == TRUE) + { + iSize = CalculateItemSize(pObject); + if(pSoldier != NULL && pSoldier->inv[bSlot].usItem == pObject->usItem) + { + sSize = CalculateItemSize(&pSoldier->inv[bSlot]); + if(LBEPocketType[pIndex].ItemCapacityPerSize[sSize] < LBEPocketType[pIndex].ItemCapacityPerSize[iSize]) + iSize = sSize; + } + } + else + iSize = Item[pObject->usItem].ItemSize; + ubSlotLimit = LBEPocketType[pIndex].ItemCapacityPerSize[iSize]; + + //this could be changed, we know guns are physically able to stack + //if ( iSize < 10 && ubSlotLimit > 1) + // ubSlotLimit = 1; + + if(LBEPocketType[pIndex].pRestriction != 0 && LBEPocketType[pIndex].pRestriction != Item[usItem].usItemClass) { + return 0; + } + + return( ubSlotLimit ); } UINT32 MoneySlotLimit( INT8 bSlot ) { - if ( bSlot >= SMALLPOCK1POS ) + if ( bSlot >= BIGPOCKFINAL ) /* CHRISL */ { return( MAX_MONEY_PER_SLOT / 2 ); } @@ -1332,28 +1458,79 @@ UINT32 MoneySlotLimit( INT8 bSlot ) } } - -INT8 FindObj( SOLDIERTYPE * pSoldier, UINT16 usItem ) +INT8 FindBestWeaponIfCurrentIsOutOfRange(SOLDIERTYPE * pSoldier, INT8 bCurrentWeaponIndex, UINT16 bWantedRange) { - INT8 bLoop; - - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) + //assuming current weapon is in the handpos + if (GunRange(&pSoldier->inv[bCurrentWeaponIndex]) >= bWantedRange) { - if (pSoldier->inv[bLoop].usItem == usItem) + //our current weapon is good enough + return( bCurrentWeaponIndex ); + } + + UINT16 range; + UINT16 bestRange = 0; + INT8 bestWeaponThatMeetsRange = 0; + INT8 secondBestWeapon = 0; + //search for weapons that meet the range, then sort by damage. + //if there are no weapons that meet the range, then use the longest range we can find + for (INT8 bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++) + { + //if this is a weapon + if (Item[pSoldier->inv[bLoop].usItem].usItemClass & (IC_WEAPON | IC_THROWN) && pSoldier->inv[bLoop].exists() == true) { - return( bLoop ); + range = GunRange(&pSoldier->inv[bLoop]); + if (range >= bWantedRange) + { + if (bestWeaponThatMeetsRange == 0) + { + bestWeaponThatMeetsRange = bLoop; + } + else if (GetDamage(&pSoldier->inv[bLoop]) > GetDamage(&pSoldier->inv[bestWeaponThatMeetsRange])) + { + //does this weapon have more damage? + bestWeaponThatMeetsRange = bLoop; + } + } + else if (range > bestRange) + { + //weapon does not meet range, but it could be better anyways + bestRange = range; + secondBestWeapon = bLoop; + } + else if (range == bestRange) + { + //weapon ties with secondBestWeapon's range + if (secondBestWeapon == 0) + { + //this if can happen if range of bLoop is 0! + secondBestWeapon = bLoop; + } + else if (GetDamage(&pSoldier->inv[bLoop]) > GetDamage(&pSoldier->inv[secondBestWeapon])) + { + secondBestWeapon = bLoop; + } + } } } - return( NO_SLOT ); + + if (bestWeaponThatMeetsRange) + { + return bestWeaponThatMeetsRange; + } + else if (secondBestWeapon) + { + return secondBestWeapon; + } + return( bCurrentWeaponIndex ); } INT8 FindMetalDetector( SOLDIERTYPE * pSoldier ) { INT8 bLoop; - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) + for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++) { - if (Item[pSoldier->inv[bLoop].usItem].metaldetector ) + if (Item[pSoldier->inv[bLoop].usItem].metaldetector && pSoldier->inv[bLoop].exists() == true) { return( bLoop ); } @@ -1365,9 +1542,9 @@ INT8 FindLockBomb( SOLDIERTYPE * pSoldier ) { INT8 bLoop; - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) + for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++) { - if (Item[pSoldier->inv[bLoop].usItem].lockbomb ) + if (Item[pSoldier->inv[bLoop].usItem].lockbomb && pSoldier->inv[bLoop].exists() == true) { return( bLoop ); } @@ -1379,9 +1556,11 @@ INT8 FindUsableObj( SOLDIERTYPE * pSoldier, UINT16 usItem ) { INT8 bLoop; - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) + for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++) { - if ( pSoldier->inv[bLoop].usItem == usItem && pSoldier->inv[bLoop].ItemData.Generic.bStatus[0] >= USABLE ) + if ( pSoldier->inv[bLoop].usItem == usItem + && pSoldier->inv[bLoop].exists() == true + && pSoldier->inv[bLoop][0]->data.objectStatus >= USABLE ) { return( bLoop ); } @@ -1394,13 +1573,13 @@ INT8 FindObjExcludingSlot( SOLDIERTYPE * pSoldier, UINT16 usItem, INT8 bExcludeS { INT8 bLoop; - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) + for (bLoop = 0; bLoop < (INT8)pSoldier->inv.size(); bLoop++) { if (bLoop == bExcludeSlot) { continue; } - if (pSoldier->inv[bLoop].usItem == usItem) + if (pSoldier->inv[bLoop].usItem == usItem && pSoldier->inv[bLoop].exists() == true) { return( bLoop ); } @@ -1408,28 +1587,14 @@ INT8 FindObjExcludingSlot( SOLDIERTYPE * pSoldier, UINT16 usItem, INT8 bExcludeS return( NO_SLOT ); } -INT8 FindExactObj( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj ) -{ - INT8 bLoop; - - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) - { - if ( (pObj == &(pSoldier->inv[bLoop])) && (memcmp( &(pSoldier->inv[bLoop]), pObj, sizeof( OBJECTTYPE ) ) == 0) ) - { - return( bLoop ); - } - } - return( NO_SLOT ); -} - - -INT8 FindObjWithin( SOLDIERTYPE * pSoldier, UINT16 usItem, INT8 bLower, INT8 bUpper ) +INT8 FindObj( SOLDIERTYPE * pSoldier, UINT16 usItem, INT8 bLower, INT8 bUpper ) { INT8 bLoop; - for (bLoop = bLower; bLoop <= bUpper; bLoop++) + for (bLoop = bLower; bLoop < bUpper; bLoop++) { - if (pSoldier->inv[bLoop].usItem == usItem) + //CHRISL: If we check exists() then we can't search for an empty pocket with this function, which is done. + if (pSoldier->inv[bLoop].usItem == usItem/* && pSoldier->inv[bLoop].exists() == true*/) { return( bLoop ); } @@ -1450,10 +1615,10 @@ INT8 FindObjInObjRange( SOLDIERTYPE * pSoldier, UINT16 usItem1, UINT16 usItem2 ) usItem1 = usTemp; } - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) + for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++) { usTemp = pSoldier->inv[bLoop].usItem; - if ( usTemp >= usItem1 && usTemp <= usItem2 ) + if ( usTemp >= usItem1 && usTemp <= usItem2 && pSoldier->inv[bLoop].exists() == true) { return( bLoop ); } @@ -1467,23 +1632,9 @@ INT8 FindObjClass( SOLDIERTYPE * pSoldier, UINT32 usItemClass ) { INT8 bLoop; - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) + for (bLoop = 0; bLoop < (INT8)pSoldier->inv.size(); bLoop++) { - if (Item[pSoldier->inv[bLoop].usItem].usItemClass & usItemClass) - { - return( bLoop ); - } - } - return( NO_SLOT ); -} - -INT8 FindObjClassAfterSlot( SOLDIERTYPE * pSoldier, INT8 bStartAfter, UINT32 usItemClass ) -{ - INT8 bLoop; - - for (bLoop = bStartAfter + 1; bLoop < NUM_INV_SLOTS; bLoop++) - { - if (Item[pSoldier->inv[bLoop].usItem].usItemClass == usItemClass) + if (Item[pSoldier->inv[bLoop].usItem].usItemClass & usItemClass && pSoldier->inv[bLoop].exists() == true) { return( bLoop ); } @@ -1503,15 +1654,17 @@ INT8 FindAIUsableObjClass( SOLDIERTYPE * pSoldier, UINT32 usItemClass ) // Do not consider tank cannons or rocket launchers to be "guns" - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) + for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++) { - if ( (Item[pSoldier->inv[bLoop].usItem].usItemClass & usItemClass) && !(pSoldier->inv[bLoop].fFlags & OBJECT_AI_UNUSABLE) && (pSoldier->inv[bLoop].ItemData.Generic.bStatus[0] >= USABLE ) ) - { - if ( usItemClass == IC_GUN && EXPLOSIVE_GUN( pSoldier->inv[bLoop].usItem ) ) + if (pSoldier->inv[bLoop].exists() == true) { + if ( (Item[pSoldier->inv[bLoop].usItem].usItemClass & usItemClass) && !(pSoldier->inv[bLoop].fFlags & OBJECT_AI_UNUSABLE) && (pSoldier->inv[bLoop][0]->data.objectStatus >= USABLE ) ) { - continue; + if ( usItemClass == IC_GUN && EXPLOSIVE_GUN( pSoldier->inv[bLoop].usItem ) ) + { + continue; + } + return( bLoop ); } - return( bLoop ); } } return( NO_SLOT ); @@ -1524,15 +1677,17 @@ INT8 FindAIUsableObjClassWithin( SOLDIERTYPE * pSoldier, UINT32 usItemClass, IN // This is for the AI only so: // Do not consider tank cannons or rocket launchers to be "guns" - for (bLoop = bLower; bLoop <= bUpper; bLoop++) + for (bLoop = bLower; bLoop < bUpper; bLoop++) { - if ( (Item[pSoldier->inv[bLoop].usItem].usItemClass & usItemClass) && !(pSoldier->inv[bLoop].fFlags & OBJECT_AI_UNUSABLE) && (pSoldier->inv[bLoop].ItemData.Generic.bStatus[0] >= USABLE ) ) - { - if ( usItemClass == IC_GUN && EXPLOSIVE_GUN( pSoldier->inv[bLoop].usItem ) ) + if (pSoldier->inv[bLoop].exists() == true) { + if ( (Item[pSoldier->inv[bLoop].usItem].usItemClass & usItemClass) && !(pSoldier->inv[bLoop].fFlags & OBJECT_AI_UNUSABLE) && (pSoldier->inv[bLoop][0]->data.objectStatus >= USABLE ) ) { - continue; + if ( usItemClass == IC_GUN && EXPLOSIVE_GUN( pSoldier->inv[bLoop].usItem ) ) + { + continue; + } + return( bLoop ); } - return( bLoop ); } } return( NO_SLOT ); @@ -1542,11 +1697,15 @@ INT8 FindEmptySlotWithin( SOLDIERTYPE * pSoldier, INT8 bLower, INT8 bUpper ) { INT8 bLoop; - for (bLoop = bLower; bLoop <= bUpper; bLoop++) + for (bLoop = bLower; bLoop < bUpper; bLoop++) { - if (pSoldier->inv[bLoop].usItem == 0) + // CHRISL: Only look at valid pockets + if((UsingNewInventorySystem() == false) && !oldInv[bLoop]) + continue; + if((pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && !vehicleInv[bLoop]) + continue; + if (pSoldier->inv[bLoop].exists() == false) { -// if (bLoop == SECONDHANDPOS && Item[pSoldier->inv[HANDPOS].usItem].fFlags & ITEM_TWO_HANDED) if (bLoop == SECONDHANDPOS && Item[pSoldier->inv[HANDPOS].usItem].twohanded ) { continue; @@ -1562,10 +1721,10 @@ INT8 FindEmptySlotWithin( SOLDIERTYPE * pSoldier, INT8 bLower, INT8 bUpper ) BOOLEAN GLGrenadeInSlot(SOLDIERTYPE *pSoldier, INT8 bSlot ) { - if (Item[pSoldier->inv[bSlot].usItem].glgrenade) - return TRUE; - else - return FALSE; + if (pSoldier->inv[bSlot].exists() == true) { + if (Item[pSoldier->inv[bSlot].usItem].glgrenade) + return TRUE; + } //switch (pSoldier->inv[bSlot].usItem) //{ // case GL_HE_GRENADE: @@ -1576,6 +1735,7 @@ BOOLEAN GLGrenadeInSlot(SOLDIERTYPE *pSoldier, INT8 bSlot ) // default: // return(FALSE); //} + return FALSE; } // for grenade launchers @@ -1583,7 +1743,7 @@ INT8 FindGLGrenade( SOLDIERTYPE * pSoldier ) { INT8 bLoop; - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) + for (bLoop = 0; bLoop < (INT8)pSoldier->inv.size(); bLoop++) { if (GLGrenadeInSlot( pSoldier, bLoop )) { @@ -1602,7 +1762,7 @@ INT8 FindThrowableGrenade( SOLDIERTYPE * pSoldier ) // this is AI only so we can put in some customization for night if (GetTimeOfDayAmbientLightLevel() == NORMAL_LIGHTLEVEL_NIGHT) { - if (pSoldier->bLife > (pSoldier->bLifeMax / 2)) + if (pSoldier->stats.bLife > (pSoldier->stats.bLifeMax / 2)) { fCheckForFlares = TRUE; } @@ -1610,64 +1770,68 @@ INT8 FindThrowableGrenade( SOLDIERTYPE * pSoldier ) if (fCheckForFlares) { // Do a priority check for flares first - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) + for (bLoop = 0; bLoop < (INT8)pSoldier->inv.size(); bLoop++) { - if ( Item[pSoldier->inv[ bLoop ].usItem].flare ) + if (pSoldier->inv[bLoop].exists() == true) { + if ( Item[pSoldier->inv[ bLoop ].usItem].flare ) + { + return( bLoop ); + } + } + } + } + + for (bLoop = 0; bLoop < (INT8)pSoldier->inv.size(); bLoop++) + { + if (pSoldier->inv[bLoop].exists() == true) { + if ( (Item[ pSoldier->inv[ bLoop ].usItem ].usItemClass & IC_GRENADE) && // Try this check instead, to avoid tossing RPG rounds !GLGrenadeInSlot( pSoldier, bLoop ) && + GetLauncherFromLaunchable( pSoldier->inv[ bLoop ].usItem) == NOTHING ) { return( bLoop ); } } } - - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) - { - if ( (Item[ pSoldier->inv[ bLoop ].usItem ].usItemClass & IC_GRENADE) && // Try this check instead, to avoid tossing RPG rounds !GLGrenadeInSlot( pSoldier, bLoop ) && - GetLauncherFromLaunchable( pSoldier->inv[ bLoop ].usItem) == NOTHING ) - { - return( bLoop ); - } - } return( NO_SLOT ); } -INT8 FindAttachment( OBJECTTYPE * pObj, UINT16 usItem ) +OBJECTTYPE* FindAttachment( OBJECTTYPE * pObj, UINT16 usItem, UINT8 subObject ) { - INT8 bLoop; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - if (pObj->usAttachItem[bLoop] == usItem) - { - return( bLoop ); + if (pObj->exists() == true) { + for (attachmentList::iterator iter = (*pObj)[subObject]->attachments.begin(); iter != (*pObj)[subObject]->attachments.end(); ++iter) { + if (iter->usItem == usItem) + { + return &(*iter); + } } } - return( ITEM_NOT_FOUND ); + return( 0 ); } -INT8 FindAttachmentByClass( OBJECTTYPE * pObj, UINT32 uiItemClass ) +OBJECTTYPE* FindAttachmentByClass( OBJECTTYPE * pObj, UINT32 uiItemClass, UINT8 subObject ) { - INT8 bLoop; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - if (Item[ pObj->usAttachItem[bLoop] ].usItemClass == uiItemClass) - { - return( bLoop ); + if (pObj->exists() == true) { + for (attachmentList::iterator iter = (*pObj)[subObject]->attachments.begin(); iter != (*pObj)[subObject]->attachments.end(); ++iter) { + if (Item[iter->usItem].usItemClass == uiItemClass) + { + return &(*iter); + } } } - return( ITEM_NOT_FOUND ); + return( 0 ); } INT8 FindLaunchable( SOLDIERTYPE * pSoldier, UINT16 usWeapon ) { INT8 bLoop; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("FindLaunchable: weapon=%d",usWeapon)); - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) + for (bLoop = 0; bLoop < (INT8)pSoldier->inv.size(); bLoop++) { - if ( ValidLaunchable( pSoldier->inv[ bLoop ].usItem , usWeapon ) ) - { - DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("FindLaunchable: returning slot %d",bLoop)); - return( bLoop ); + if (pSoldier->inv[bLoop].exists() == true) { + if ( ValidLaunchable( pSoldier->inv[ bLoop ].usItem , usWeapon ) ) + { + DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("FindLaunchable: returning slot %d",bLoop)); + return( bLoop ); + } } } @@ -1679,12 +1843,14 @@ INT8 FindNonSmokeLaunchable( SOLDIERTYPE * pSoldier, UINT16 usWeapon ) { INT8 bLoop; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("FindNonSmokeLaunchable: weapon=%d",usWeapon)); - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) + for (bLoop = 0; bLoop < (INT8)pSoldier->inv.size(); bLoop++) { - if ( ValidLaunchable( pSoldier->inv[ bLoop ].usItem , usWeapon ) && Explosive[Item[pSoldier->inv[ bLoop ].usItem].ubClassIndex].ubType != EXPLOSV_SMOKE ) - { - DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("FindNonSmokeLaunchable: returning slot %d",bLoop)); - return( bLoop ); + if (pSoldier->inv[bLoop].exists() == true) { + if ( ValidLaunchable( pSoldier->inv[ bLoop ].usItem , usWeapon ) && Explosive[Item[pSoldier->inv[ bLoop ].usItem].ubClassIndex].ubType != EXPLOSV_SMOKE ) + { + DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("FindNonSmokeLaunchable: returning slot %d",bLoop)); + return( bLoop ); + } } } @@ -1692,51 +1858,54 @@ INT8 FindNonSmokeLaunchable( SOLDIERTYPE * pSoldier, UINT16 usWeapon ) return( FindLaunchable(pSoldier,usWeapon) ); } -INT8 FindLaunchableAttachment( OBJECTTYPE * pObj, UINT16 usWeapon ) +OBJECTTYPE* FindLaunchableAttachment( OBJECTTYPE * pObj, UINT16 usWeapon ) { - INT8 bLoop; - - DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("FindLaunchableAttachment: weapon=%d",usWeapon)); - for ( bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++ ) - { - if ( pObj->usAttachItem[ bLoop ] != NOTHING && ValidLaunchable( pObj->usAttachItem[ bLoop ], usWeapon ) ) - { - DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("FindLaunchableAttachment: returning slot %d",bLoop)); - return( bLoop ); + if (pObj->exists() == true) { + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if (ValidLaunchable( iter->usItem, usWeapon)) + { + return &(*iter); + } } } - DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("FindLaunchableAttachment: item not found")); - return( ITEM_NOT_FOUND ); + return( 0 ); } -INT8 FindNonSmokeLaunchableAttachment( OBJECTTYPE * pObj, UINT16 usWeapon ) +OBJECTTYPE* FindNonSmokeLaunchableAttachment( OBJECTTYPE * pObj, UINT16 usWeapon ) { - INT8 bLoop; - DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("FindNonSmokeLaunchableAttachment: weapon=%d",usWeapon)); - for ( bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++ ) - { - if ( pObj->usAttachItem[ bLoop ] != NOTHING && ValidLaunchable( pObj->usAttachItem[ bLoop ], usWeapon ) && Explosive[Item[pObj->usAttachItem[ bLoop ]].ubClassIndex].ubType != EXPLOSV_SMOKE ) - { - DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("FindNonSmokeLaunchableAttachment: returning slot %d",bLoop)); - return( bLoop ); + if (pObj->exists() == true) { + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if (ValidLaunchable( iter->usItem, usWeapon) && Explosive[Item[iter->usItem].ubClassIndex].ubType != EXPLOSV_SMOKE) + { + return &(*iter); + } } } - DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("FindNonSmokeLaunchableAttachment: item not found")); return( FindLaunchableAttachment(pObj,usWeapon) ); } //Simple check to see if the item has any attachments -BOOLEAN ItemHasAttachments( OBJECTTYPE * pObj ) +BOOLEAN ItemHasAttachments( OBJECTTYPE * pObj, SOLDIERTYPE * pSoldier, UINT8 iter ) { - if ((pObj->usAttachItem[0] == NOTHING) && (pObj->usAttachItem[1] == NOTHING) && (pObj->usAttachItem[2] == NOTHING) && (pObj->usAttachItem[3] == NOTHING)) - { - return( FALSE ); + if (pObj->exists() == true) { + if(pSoldier != NULL){ + for (iter = 0; iter != pObj->objectStack.size(); ++iter) { + if((*pObj)[iter]->attachments.empty() == false){ + return TRUE; + } + } + } + else{ + if((*pObj)[iter]->attachments.empty() == false){ + return TRUE; + } + } } - return( TRUE ); + return FALSE; } // Determine if it is possible to add this attachment to the CLASS of this item @@ -1764,7 +1933,7 @@ BOOLEAN ValidAttachmentClass( UINT16 usAttachment, UINT16 usItem ) break; } } - return( FALSE ); + return( FALSE ); } INT8 GetAttachmentInfoIndex( UINT16 usItem ) @@ -1788,10 +1957,12 @@ INT8 GetAttachmentInfoIndex( UINT16 usItem ) } //Determine if it is possible to add this attachment to the item. -BOOLEAN internalValidAttachment( UINT16 usAttachment, UINT16 usItem, UINT8 * pubAPCost ) +BOOLEAN ValidAttachment( UINT16 usAttachment, UINT16 usItem, UINT8 * pubAPCost ) { INT32 iLoop = 0; - *pubAPCost = (UINT8)AP_RELOAD_GUN; //default value + if (pubAPCost) { + *pubAPCost = (UINT8)AP_RELOAD_GUN; //default value + } // look for the section of the array pertaining to this attachment... while( 1 ) @@ -1812,7 +1983,9 @@ BOOLEAN internalValidAttachment( UINT16 usAttachment, UINT16 usItem, UINT8 * pub { if (Attachment[iLoop][1] == usItem) { - *pubAPCost = (UINT8)Attachment[iLoop][2]; //Madd: get ap cost of attaching items :) + if (pubAPCost) { + *pubAPCost = (UINT8)Attachment[iLoop][2]; //Madd: get ap cost of attaching items :) + } break; } iLoop++; @@ -1825,18 +1998,11 @@ BOOLEAN internalValidAttachment( UINT16 usAttachment, UINT16 usItem, UINT8 * pub return( TRUE ); } -//Determine if it is possible to add this attachment to the item. -BOOLEAN ValidAttachment( UINT16 usAttachment, UINT16 usItem ) -{ - UINT8 ubAPCost; - - return internalValidAttachment( usAttachment, usItem, &ubAPCost); -} UINT8 AttachmentAPCost( UINT16 usAttachment, UINT16 usItem ) { UINT8 ubAPCost; - internalValidAttachment( usAttachment, usItem, &ubAPCost); + ValidAttachment( usAttachment, usItem, &ubAPCost); return ubAPCost; } @@ -1844,15 +2010,14 @@ UINT8 AttachmentAPCost( UINT16 usAttachment, UINT16 usItem ) //Determine if this item can receive this attachment. This is different, in that it may //be possible to have this attachment on this item, but may already have an attachment on //it which doesn't work simultaneously with the new attachment (like a silencer and duckbill). -BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAttemptingAttachment ) -{ - return ValidItemAttachment ( pObj, usAttachment, fAttemptingAttachment, TRUE ); -} -BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAttemptingAttachment, BOOLEAN fDisplayMessage ) +BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAttemptingAttachment, BOOLEAN fDisplayMessage, UINT8 subObject ) { BOOLEAN fSameItem = FALSE, fSimilarItems = FALSE; UINT16 usSimilarItem = NOTHING; + if (pObj->exists() == false) { + return FALSE; + } if ( !ValidAttachment( usAttachment, pObj->usItem ) ) { // check for an underslung grenade launcher attached to the gun @@ -1882,7 +2047,7 @@ BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAt { // well, maybe the player thought he could CHAR16 zTemp[ 100 ]; - + swprintf( zTemp, Message[ STR_CANT_ATTACH ], ItemNames[ usAttachment ], ItemNames[ pObj->usItem ] ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, zTemp ); } @@ -1893,7 +2058,7 @@ BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAt // special conditions go here // can't have two of the same attachment on an item /* - if (FindAttachment( pObj, usAttachment ) != ITEM_NOT_FOUND) + if (FindAttachment( pObj, usAttachment ) != 0) { fSameItem = TRUE; } @@ -1903,8 +2068,8 @@ BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAt { if ( IncompatibleAttachments[i][0] == NONE ) break; - - if ( IncompatibleAttachments[i][0] == usAttachment && FindAttachment (pObj,IncompatibleAttachments[i][1]) != ITEM_NOT_FOUND ) + + if ( IncompatibleAttachments[i][0] == usAttachment && FindAttachment (pObj,IncompatibleAttachments[i][1],subObject) != 0 ) { fSimilarItems = TRUE; usSimilarItem = IncompatibleAttachments[i][1]; @@ -1917,14 +2082,14 @@ BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAt //switch( usAttachment ) //{ // case BIPOD: - // if ( FindAttachment( pObj, UNDER_GLAUNCHER) != ITEM_NOT_FOUND ) + // if ( FindAttachment( pObj, UNDER_GLAUNCHER) != 0 ) // { // fSimilarItems = TRUE; // usSimilarItem = UNDER_GLAUNCHER; // } // break; // case UNDER_GLAUNCHER: - // if ( FindAttachment( pObj, BIPOD ) != ITEM_NOT_FOUND ) + // if ( FindAttachment( pObj, BIPOD ) != 0 ) // { // fSimilarItems = TRUE; // usSimilarItem = BIPOD; @@ -1932,65 +2097,65 @@ BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAt // break; ///* // case LASERSCOPE: - // if (FindAttachment( pObj, SNIPERSCOPE ) != ITEM_NOT_FOUND) + // if (FindAttachment( pObj, SNIPERSCOPE ) != 0) // { // return( FALSE ); // } // break; // case SNIPERSCOPE: - // if (FindAttachment( pObj, LASERSCOPE ) != ITEM_NOT_FOUND) + // if (FindAttachment( pObj, LASERSCOPE ) != 0) // { // return( FALSE ); // } // break; // */ // case DETONATOR: - // if( FindAttachment( pObj, REMDETONATOR ) != ITEM_NOT_FOUND ) + // if( FindAttachment( pObj, REMDETONATOR ) != 0 ) // { // fSameItem = TRUE; // } // break; // case REMDETONATOR: - // if( FindAttachment( pObj, DETONATOR ) != ITEM_NOT_FOUND ) + // if( FindAttachment( pObj, DETONATOR ) != 0 ) // { // fSameItem = TRUE; // } // break; // case SNIPERSCOPE: - // if( FindAttachment( pObj, REFLEX_SCOPED ) != ITEM_NOT_FOUND ) + // if( FindAttachment( pObj, REFLEX_SCOPED ) != 0 ) // { // fSimilarItems = TRUE; // usSimilarItem = REFLEX_SCOPED; // } // break; // case REFLEX_SCOPED: - // if( FindAttachment( pObj, SNIPERSCOPE ) != ITEM_NOT_FOUND ) + // if( FindAttachment( pObj, SNIPERSCOPE ) != 0 ) // { // fSimilarItems = TRUE; // usSimilarItem = SNIPERSCOPE; // } - // if( FindAttachment( pObj, REFLEX_UNSCOPED ) != ITEM_NOT_FOUND ) + // if( FindAttachment( pObj, REFLEX_UNSCOPED ) != 0 ) // { // fSimilarItems = TRUE; // usSimilarItem = REFLEX_UNSCOPED; // } // break; // case REFLEX_UNSCOPED: - // if( FindAttachment( pObj, REFLEX_SCOPED ) != ITEM_NOT_FOUND ) + // if( FindAttachment( pObj, REFLEX_SCOPED ) != 0 ) // { // fSimilarItems = TRUE; // usSimilarItem = REFLEX_SCOPED; // } // break; // case SILENCER: - // if( FindAttachment( pObj, FLASH_SUPPRESSOR ) != ITEM_NOT_FOUND ) + // if( FindAttachment( pObj, FLASH_SUPPRESSOR ) != 0 ) // { // fSimilarItems = TRUE; // usSimilarItem = FLASH_SUPPRESSOR; // } // break; // case FLASH_SUPPRESSOR: - // if( FindAttachment( pObj, SILENCER ) != ITEM_NOT_FOUND ) + // if( FindAttachment( pObj, SILENCER ) != 0 ) // { // fSimilarItems = TRUE; // usSimilarItem = SILENCER; @@ -1998,13 +2163,13 @@ BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAt // break; //} - if (fAttemptingAttachment) + if (fAttemptingAttachment) { if (fSameItem) { if (fDisplayMessage) ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, Message[ STR_ATTACHMENT_ALREADY ] ); return( FALSE ); - } + } else if (fSimilarItems) { if (fDisplayMessage) ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, Message[ STR_CANT_USE_TWO_ITEMS ], ItemNames[ usSimilarItem ], ItemNames[ usAttachment ] ); @@ -2120,12 +2285,15 @@ BOOLEAN ValidLaunchable( UINT16 usLaunchable, UINT16 usItem ) BOOLEAN ValidItemLaunchable( OBJECTTYPE * pObj, UINT16 usAttachment ) { + if (pObj->exists() == false) { + return FALSE; + } if ( !ValidLaunchable( usAttachment, pObj->usItem ) ) { return( FALSE ); } // if we can find another of the same class as the attachment, it's not possible - if ( FindAttachmentByClass( pObj, Item[ usAttachment ].usItemClass ) != NO_SLOT ) + if ( FindAttachmentByClass( pObj, Item[ usAttachment ].usItemClass ) != 0 ) { return( FALSE ); } @@ -2136,8 +2304,6 @@ BOOLEAN ValidItemLaunchable( OBJECTTYPE * pObj, UINT16 usAttachment ) UINT16 GetLauncherFromLaunchable( UINT16 usLaunchable ) { INT32 iLoop = 0; - //UINT16 usItem = NOTHING; - // look for the section of the array pertaining to this launchable item... while( 1 ) { @@ -2164,7 +2330,8 @@ BOOLEAN EvaluateValidMerge( UINT16 usMerge, UINT16 usItem, UINT16 * pusResult, U // "usItem" is the item being merged "onto" (e.g. kevlar vest) INT32 iLoop = 0; - if (usMerge == usItem && Item[ usItem ].usItemClass == IC_AMMO) + //CHRISL: Update this so we can also merge IC_MONEY like wallets and nuggets. + if (usMerge == usItem && (Item[ usItem ].usItemClass == IC_AMMO || Item[ usItem ].usItemClass == IC_MONEY)) { *pusResult = usItem; *pubType = COMBINE_POINTS; @@ -2212,102 +2379,291 @@ BOOLEAN ValidMerge( UINT16 usMerge, UINT16 usItem ) return( EvaluateValidMerge( usMerge, usItem, &usIgnoreResult, &usIgnoreResult2, &ubIgnoreType, &ubIgnoreAPCost ) ); } -UINT8 CalculateObjectWeight( OBJECTTYPE *pObject ) +int GetPocketSizeByDimensions(int sizeX, int sizeY) { - INT32 cnt; - UINT16 usWeight; - INVTYPE * pItem; - - pItem = &(Item[ pObject->usItem ]); - - // Start with base weight - usWeight = pItem->ubWeight; - - if ( pItem->ubPerPocket < 2 && pItem->usItemClass != IC_AMMO ) + static const UINT8 cisPocketSize[6][4] = { + 11, 12, 13, 14, + 15, 16, 17, 18, + 19, 20, 21, 22, + 23, 24, 25, 26, + 27, 28, 29, 30, + 31, 32, 33, 34 + }; + return cisPocketSize[sizeX][sizeY]; +} - // account for any attachments - for ( cnt = 0; cnt < MAX_ATTACHMENTS; cnt++ ) +void GetPocketDimensionsBySize(int pocketSize, int& sizeX, int& sizeY) +{ + static const UINT8 cisPocketSize[6][4] = + { + 11, 12, 13, 14, + 15, 16, 17, 18, + 19, 20, 21, 22, + 23, 24, 25, 26, + 27, 28, 29, 30, + 31, 32, 33, 34 + }; + + for(sizeX=0; sizeX<6; sizeX++) + { + for(sizeY=0; sizeY<4; sizeY++) { - if (pObject->usAttachItem[cnt] != NOTHING ) + if(pocketSize == cisPocketSize[sizeX][sizeY]) { - usWeight += Item[ pObject->usAttachItem[cnt] ].ubWeight; + return; + } + } + } +} + + +// CHRISL: New function to dynamically modify ItemSize based on attachments, stack size, etc +UINT16 CalculateItemSize( OBJECTTYPE *pObject ) +{ + UINT16 iSize; + UINT16 currentSize = 0; + UINT32 cisIndex; + + // Determine default ItemSize based on item and attachments + cisIndex = pObject->usItem; + iSize = Item[cisIndex].ItemSize; + if(iSize>34) + iSize = 34; + + //for each object in the stack, hopefully there is only 1 + for (int numStacked = 0; numStacked < pObject->ubNumberOfObjects; ++numStacked) { + //some weapon attachments can adjust the ItemSize of a weapon + if(iSize<10) { + for (attachmentList::iterator iter = (*pObject)[numStacked]->attachments.begin(); iter != (*pObject)[numStacked]->attachments.end(); ++iter) { + if (iter->exists() == true) { + iSize += Item[iter->usItem].itemsizebonus; + // CHRISL: This is to catch things if we try and reduce ItemSize when we're already at 0 + if(iSize > 34 || iSize < 0) + iSize = 0; + if(iSize > 9) + iSize = 9; + } } } - // add in weight of ammo - if (Item[ pObject->usItem ].usItemClass == IC_GUN && pObject->ItemData.Gun.ubGunShotsLeft > 0) - { - if( 0==pObject->ItemData.Gun.usGunAmmoItem ) /* Sergeant_Kolja: 2007-06-11, Fix for Creature Spit. This has no Ammo, so the old code calculated accidentally -1.6 resulting in 0xFFFF */ - { - DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "'no ammo weight' FIX for Creatures\r\n" ); - } - else if( gGameExternalOptions.fAmmoDynamicWeight == TRUE ) + // LBENODE has it's ItemSize adjusted based on what it's storing + if(pObject->IsActiveLBE(numStacked) == true) { + LBENODE* pLBE = pObject->GetLBEPointer(numStacked); + if(pLBE) { - //Pulmu: - //Temporary calculation for minWeight - UINT32 uiMinWeight = (UINT32)((Item[ pObject->ItemData.Gun.usGunAmmoItem].ubWeight / 5.0) + 0.5); - if( uiMinWeight < 1 || uiMinWeight > Item[ pObject->ItemData.Gun.usGunAmmoItem].ubWeight) + //start by determining the equivalent number of "small" pockets that this LBENODE has access to. This + // is based on the pType value in Pockets.xml with 1=Small, 2=Medium and 3=Large + UINT16 totalPocketValue = 0; + FLOAT percentOfItemUsed = 0; + UINT16 pIndex, testSize, maxSize; + UINT8 pocketCapacity, numberOfSizeIncrements; + FLOAT currentPocketPercent, currentPocketPartOfTotal; + for(unsigned int x = 0; x < pLBE->inv.size(); x++) { - uiMinWeight = 1; + if(LoadBearingEquipment[Item[pObject->usItem].ubClassIndex].lbePocketIndex[x] != 0) + { + pIndex = LoadBearingEquipment[Item[pObject->usItem].ubClassIndex].lbePocketIndex[x]; + totalPocketValue += LBEPocketType[pIndex].pType; + } } + //Now, look through each active pocket + for(unsigned int x = 0; x < pLBE->inv.size(); x++) + { + if(pLBE->inv[x].exists() == true) + { + pIndex = LoadBearingEquipment[Item[pObject->usItem].ubClassIndex].lbePocketIndex[x]; + testSize = CalculateItemSize(&pLBE->inv[x]); + pocketCapacity = LBEPocketType[pIndex].ItemCapacityPerSize[testSize]; + currentPocketPercent = (FLOAT)pLBE->inv[x].ubNumberOfObjects / (FLOAT)pocketCapacity; + currentPocketPartOfTotal = (FLOAT)LBEPocketType[pIndex].pType / (FLOAT)totalPocketValue; + percentOfItemUsed += currentPocketPartOfTotal * currentPocketPercent; + } + } + maxSize = max(iSize, LoadBearingEquipment[Item[pObject->usItem].ubClassIndex].lbeFilledSize); + //Now, determine the increments between initial ItemSize and Filled Size, and adjust iSize by percentOfItemUsed + if(percentOfItemUsed != 0) + { + numberOfSizeIncrements = LoadBearingEquipment[Item[pObject->usItem].ubClassIndex].lbeFilledSize - Item[pObject->usItem].ItemSize; + testSize = (UINT16)((numberOfSizeIncrements * percentOfItemUsed) + .5); + currentSize = __max(iSize + testSize, currentSize); + currentSize = __min(currentSize, maxSize); + } +#if 0 +//old method + UINT16 newSize, testSize, maxSize; + UINT8 cnt=0; + newSize = 0; + maxSize = max(iSize, LoadBearingEquipment[Item[pObject->usItem].ubClassIndex].lbeFilledSize); + // Look for the ItemSize of the largest item in this LBENODE + for(unsigned int x = 0; x < pLBE->inv.size(); ++x) + { + if(pLBE->inv[x].exists() == true) + { + testSize = CalculateItemSize(&(pLBE->inv[x])); + //Now that we have the size of one item, we want to factor in the number of items since two + // items take up more space then one. + testSize = testSize + pLBE->inv[x].ubNumberOfObjects - 1; + testSize = min(testSize,34); + //We also need to increase the size of guns so they'll fit with the rest of our calculations. + if(testSize < 5) + testSize += 10; + if(testSize < 10) + testSize += 18; + //Finally, we want to factor in multiple pockets. We'll do this by counting the number of filled + // pockets, then add this count total to our newSize when everything is finished. + cnt++; + newSize = max(testSize, newSize); + } + } + //Add the total number of filled pockets to our NewSize to account for multiple pockets being used + newSize += cnt; + newSize = min(newSize,34); + // If largest item is smaller then LBE, don't change ItemSize + if(newSize > 0 && newSize < iSize) { + iSize = iSize; + } + // if largest item is larget then LBE but smaller then max size, partially increase ItemSize + else if(newSize >= iSize && newSize < maxSize) { + iSize = newSize; + } + // if largest item is larger then max size, reset ItemSize to max size + else if(newSize >= maxSize) { + iSize = maxSize; + } +#endif + } + } + } + //Finally, set the new iSize value + iSize = __max(iSize, currentSize); - if( uiMinWeight == Item[ pObject->ItemData.Gun.usGunAmmoItem].ubWeight ) + return(iSize); +} + +UINT16 CalculateAmmoWeight( UINT16 usGunAmmoItem, UINT16 ubShotsLeft ) +{ + if( 0 == usGunAmmoItem ) /* Sergeant_Kolja: 2007-06-11, Fix for Creature Spit. This has no Ammo, so the old code calculated accidentally -1.6 resulting in 0xFFFF */ + { + DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "'no ammo weight' FIX for Creatures\r\n" ); + return 0; + } + + //Temporary calculation for minWeight. 0.2*ubWeight rounded correctly + UINT32 uiMinWeight = (UINT32)((Item[usGunAmmoItem].ubWeight / 5.0) + 0.5); + if( uiMinWeight < 1 || uiMinWeight > Item[usGunAmmoItem].ubWeight) + { + uiMinWeight = 1; + } + + double weight = 0.0; + + if(ubShotsLeft > 0) + { + if( uiMinWeight == Item[usGunAmmoItem].ubWeight ) + { + weight += (double)uiMinWeight; + } + else + { + weight += (double)uiMinWeight + (( (double)ubShotsLeft / (double)Magazine[ Item[usGunAmmoItem].ubClassIndex ].ubMagSize) * ( (double)Item[usGunAmmoItem].ubWeight - (double)uiMinWeight )); + } + } + weight += 0.5; //Pulmu:To round correctly + return (UINT16)weight; + //Pulmu end +} + +/*CHRISL: Change to a 16bit integer for a max weight of 6553.5kg. Also changed to account for +new inventory system. */ +UINT16 CalculateObjectWeight( OBJECTTYPE *pObject ) +{ + if (pObject->exists() == false || pObject->ubNumberOfObjects == 0) { + return 0; + } + + UINT16 weight = 0; + INVTYPE * pItem; + pItem = &(Item[ pObject->usItem ]); + //ADB it is much easier and faster to calculate ammo in a lump rather than accumulate a stack's weight + if ( pItem->usItemClass == IC_AMMO)//Pulmu: added weight allowance for ammo not being full + { + if ( gGameExternalOptions.fAmmoDynamicWeight == TRUE ) { + for( int cnt = 0; cnt < pObject->ubNumberOfObjects; cnt++ ) + { + weight += CalculateAmmoWeight(pObject->usItem, (*pObject)[cnt]->data.ubShotsLeft); + } + } + else { + // Start with base weight + weight = pItem->ubWeight; + //multiply by the number of objects, can be 0 + weight *= pObject->ubNumberOfObjects; + } + } + else { + for (int x = 0; x < pObject->ubNumberOfObjects; ++x) { + weight += pObject->GetWeightOfObjectInStack(x); + } + } + + return( weight ); +} + +UINT16 OBJECTTYPE::GetWeightOfObjectInStack(unsigned int index) +{ + //Item does not exist + if( index >= ubNumberOfObjects ) + { + return 0; + } + + INVTYPE * pItem = &(Item[ usItem ]); + + // Start with base weight + UINT16 weight = pItem->ubWeight; + if ( pItem->usItemClass != IC_AMMO ) + { + // Are we looking at an LBENODE item? New inventory only. + if(pItem->usItemClass == IC_LBEGEAR && IsActiveLBE(index) && (UsingNewInventorySystem() == true)) + { + LBENODE* pLBE = GetLBEPointer(index); + if (pLBE) { + for ( unsigned int subObjects = 0; subObjects < pLBE->inv.size(); subObjects++) { - usWeight += uiMinWeight; - } - else - { - // WANNE: Added Pulmu's weight fix - double weight = (double)uiMinWeight + (( (double)pObject->ItemData.Gun.ubGunShotsLeft / Magazine[Item[pObject->ItemData.Gun.usGunAmmoItem].ubClassIndex].ubMagSize ) * ( (double)Item[ pObject->ItemData.Gun.usGunAmmoItem].ubWeight - (double)uiMinWeight )) + 0.5; //Pulmu: Account for number of rounds left. - usWeight += (UINT16)weight; + if (pLBE->inv[subObjects].exists() == true) + { + weight += CalculateObjectWeight(&(pLBE->inv[subObjects])); + } } } + //do not search for attachments to an LBE + return weight; + } + + // account for any attachments + for (attachmentList::iterator iter = (*this)[index]->attachments.begin(); iter != (*this)[index]->attachments.end(); ++iter) { + weight += CalculateObjectWeight(&(*iter)); + } + + // add in weight of ammo + if (Item[ usItem ].usItemClass == IC_GUN && (*this)[index]->data.gun.ubGunShotsLeft > 0) + { + if( gGameExternalOptions.fAmmoDynamicWeight == TRUE ) + { + weight += CalculateAmmoWeight((*this)[index]->data.gun.usGunAmmoItem, (*this)[index]->data.gun.ubGunShotsLeft); + } else { - usWeight += Item[ pObject->ItemData.Gun.usGunAmmoItem ].ubWeight; + weight += Item[ (*this)[index]->data.gun.usGunAmmoItem ].ubWeight; } } } else if ( pItem->usItemClass == IC_AMMO && gGameExternalOptions.fAmmoDynamicWeight == TRUE )//Pulmu: added weight allowance for ammo not being full { - usWeight = 0; - //Temporary calculation for minWeight. 0.2*ubWeight rounded correctly - UINT32 uiMinWeight = (UINT32)((Item[pObject->usItem].ubWeight / 5.0) + 0.5); - if( uiMinWeight < 1 || uiMinWeight > Item[pObject->usItem].ubWeight) - { - uiMinWeight = 1; - } - - double weight = 0.0; - - for( cnt = 0; cnt < pObject->ubNumberOfObjects; cnt++ ) - { - if(pObject->ItemData.Ammo.ubShotsLeft[cnt] > 0) - { - if( uiMinWeight == Item[pObject->usItem].ubWeight ) - { - weight += (double)uiMinWeight; - } - else - { - weight += (double)uiMinWeight + (( (double)pObject->ItemData.Ammo.ubShotsLeft[cnt] / (double)Magazine[ Item[ pObject->usItem].ubClassIndex ].ubMagSize) * ( (double)Item[pObject->usItem].ubWeight - (double)uiMinWeight )); - } - } - } - weight += 0.5; //Pulmu:To round correctly - usWeight = (UINT16)weight; - //Pulmu end + weight = CalculateAmmoWeight(usItem, (*this)[index]->data.ubShotsLeft); } - - - // make sure it really fits into that UINT8, in case we ever add anything real heavy with attachments/ammo - Assert(usWeight <= 255); - - if ( usWeight > 255 ) - usWeight = 255; //Madd: limit to 255 to prevent negative weights, at least until we can change the OBJECTTYPE structure - - return( (UINT8) usWeight ); + return weight; } UINT32 CalculateCarriedWeight( SOLDIERTYPE * pSoldier ) @@ -2315,26 +2671,19 @@ UINT32 CalculateCarriedWeight( SOLDIERTYPE * pSoldier ) UINT32 uiTotalWeight = 0; UINT32 uiPercent; UINT8 ubLoop; - UINT16 usWeight; UINT8 ubStrengthForCarrying; //Pulmu: Changes for dynamic ammo weight - for( ubLoop = 0; ubLoop < NUM_INV_SLOTS; ubLoop++) + for( ubLoop = 0; ubLoop < pSoldier->inv.size(); ubLoop++) { - usWeight = pSoldier->inv[ubLoop].ubWeight; - if (Item[ pSoldier->inv[ubLoop].usItem ].ubPerPocket > 1 && (Item[ pSoldier->inv[ubLoop].usItem].usItemClass != IC_AMMO || gGameExternalOptions.fAmmoDynamicWeight == FALSE)) - { - // account for # of items - usWeight *= pSoldier->inv[ubLoop].ubNumberOfObjects; - } - uiTotalWeight += usWeight; - + //ADB the weight of the object is already counting stacked objects, attachments, et al + uiTotalWeight += CalculateObjectWeight(&pSoldier->inv[ubLoop]); } // for now, assume soldiers can carry 1/2 their strength in KGs without penalty. - // instead of multiplying by 100 for percent, and then dividing by 10 to account + // instead of multiplying by 100 for percent, and then dividing by 10 to account // for weight units being in 10ths of kilos, not kilos... we just start with 10 instead of 100! ubStrengthForCarrying = EffectiveStrength( pSoldier ); - if ( ubStrengthForCarrying > 80 ) + if ( ubStrengthForCarrying > 80 ) { ubStrengthForCarrying += (ubStrengthForCarrying - 80); } @@ -2345,44 +2694,21 @@ UINT32 CalculateCarriedWeight( SOLDIERTYPE * pSoldier ) void DeleteObj(OBJECTTYPE * pObj ) { - memset( pObj, 0, sizeof(OBJECTTYPE) ); -} - -void CopyObj( OBJECTTYPE * pSourceObj, OBJECTTYPE * pTargetObj ) -{ - memcpy( pTargetObj, pSourceObj, sizeof( OBJECTTYPE ) ); + pObj->initialize(); } void SwapObjs( OBJECTTYPE * pObj1, OBJECTTYPE * pObj2 ) { - OBJECTTYPE Temp; - - memcpy( &Temp, pObj1, sizeof( OBJECTTYPE ) ); - memcpy( pObj1, pObj2, sizeof( OBJECTTYPE ) ); - memcpy( pObj2, &Temp, sizeof( OBJECTTYPE ) ); -/* - //if we are in the shop keeper interface, switch the items - if( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) - { - memset( &gMoveingItem, 0, sizeof( INVENTORY_IN_SLOT ) ); - gMoveingItem.fActive = TRUE; - gMoveingItem.sItemIndex = pObj1->usItem; - - gMoveingItem.ubLocationOfObject = PLAYERS_INVENTORY; - gMoveingItem.ubIdOfMercWhoOwnsTheItem = gpItemPointerSoldier->ubProfile; - - //Get the item from the slot. - memcpy( &gMoveingItem.ItemObject, &pObj1, sizeof( OBJECTTYPE ) ); - - } -*/ + //cannot use gTempObject + OBJECTTYPE Temp (*pObj1 ); + *pObj1 = *pObj2; + *pObj2 = Temp; } //ADB these 2 functions were created because the code calls SwapObjs all over the place //but never handles the effects of that swap! void SwapObjs(SOLDIERTYPE* pSoldier, int leftSlot, int rightSlot, BOOLEAN fPermanent) { - PERFORMANCE_MARKER SwapObjs(&pSoldier->inv[ leftSlot ], &pSoldier->inv[ rightSlot ]); if (fPermanent) @@ -2395,7 +2721,6 @@ void SwapObjs(SOLDIERTYPE* pSoldier, int leftSlot, int rightSlot, BOOLEAN fPerma void SwapObjs(SOLDIERTYPE* pSoldier, int slot, OBJECTTYPE* pObject, BOOLEAN fPermanent) { - PERFORMANCE_MARKER SwapObjs(&pSoldier->inv[ slot ], pObject); if (fPermanent) @@ -2404,210 +2729,72 @@ void SwapObjs(SOLDIERTYPE* pSoldier, int slot, OBJECTTYPE* pObject, BOOLEAN fPer } } -void RemoveObjFrom( OBJECTTYPE * pObj, UINT8 ubRemoveIndex ) +void DamageObj( OBJECTTYPE * pObj, INT8 bAmount, UINT8 subObject ) { - // remove 1 object from an OBJECTTYPE, starting at index bRemoveIndex - UINT8 ubLoop; - - if (pObj->ubNumberOfObjects < ubRemoveIndex) + //usually called from AttachObject, where the attachment is known to be a single item, + //and the attachment is only being attached to the top of the stack + if (bAmount >= (*pObj)[subObject]->data.objectStatus) { - // invalid index! - return; - } - else if (pObj->ubNumberOfObjects == 1) - { - // delete! - DeleteObj( pObj ); - } - else - { - // shift down all the values that should be down - for (ubLoop = ubRemoveIndex + 1; ubLoop < pObj->ubNumberOfObjects; ubLoop++) - { - pObj->ItemData.Generic.bStatus[ubLoop - 1] = pObj->ItemData.Generic.bStatus[ubLoop]; - } - // and set the upper value to 0 - pObj->ItemData.Generic.bStatus[pObj->ubNumberOfObjects - 1] = 0; - // make the number of objects recorded match the array - pObj->ubNumberOfObjects--; - } -} - -void RemoveObjs( OBJECTTYPE * pObj, UINT8 ubNumberToRemove ) -{ - // remove a certain number of objects from an OBJECTTYPE, starting at index 0 - UINT8 ubLoop; - - if (ubNumberToRemove == 0) - { - return; - } - if (ubNumberToRemove >= pObj->ubNumberOfObjects) - { - // delete! - DeleteObj( pObj ); + (*pObj)[subObject]->data.objectStatus = 1; } else { - for (ubLoop = 0; ubLoop < ubNumberToRemove; ubLoop++) - { - RemoveObjFrom( pObj, 0 ); - } - pObj->ubWeight = CalculateObjectWeight( pObj ); + (*pObj)[subObject]->data.objectStatus -= bAmount; } } -void GetObjFrom( OBJECTTYPE * pObj, UINT8 ubGetIndex, OBJECTTYPE * pDest ) +void DistributeStatus(OBJECTTYPE* pSourceObject, OBJECTTYPE* pTargetObject, INT16 bMaxPoints) { - if (!pDest || ubGetIndex >= pObj->ubNumberOfObjects) + INT16 bPointsToMove; + for ( int bLoop = pSourceObject->ubNumberOfObjects - 1; bLoop >= 0; bLoop-- ) { - return; - } - if (pObj->ubNumberOfObjects == 1) - { - memcpy( pDest, pObj, sizeof( OBJECTTYPE ) ); - DeleteObj( pObj ); - } - else - { - pDest->usItem = pObj->usItem; - pDest->ItemData.Generic.bStatus[0] = pObj->ItemData.Generic.bStatus[ubGetIndex]; - pDest->ubNumberOfObjects = 1; - pDest->ubWeight = CalculateObjectWeight( pDest ); - RemoveObjFrom( pObj, ubGetIndex ); - pObj->ubWeight = CalculateObjectWeight( pObj ); - } -} - -void SwapWithinObj( OBJECTTYPE * pObj, UINT8 ubIndex1, UINT8 ubIndex2 ) -{ - INT8 bTemp; - - if (pObj->ubNumberOfObjects >= ubIndex1 || pObj->ubNumberOfObjects >= ubIndex1) - { - return; - } - - bTemp = pObj->ItemData.Generic.bStatus[ubIndex1]; - pObj->ItemData.Generic.bStatus[ubIndex1] = pObj->ItemData.Generic.bStatus[ubIndex2]; - pObj->ItemData.Generic.bStatus[ubIndex2] = bTemp; -} - -void DamageObj( OBJECTTYPE * pObj, INT8 bAmount ) -{ - if (bAmount >= pObj->ItemData.Generic.bStatus[0]) - { - pObj->ItemData.Generic.bStatus[0] = 1; - } - else - { - pObj->ItemData.Generic.bStatus[0] -= bAmount; - } -} - -void StackObjs( OBJECTTYPE * pSourceObj, OBJECTTYPE * pTargetObj, UINT8 ubNumberToCopy ) -{ - UINT8 ubLoop; - - // copy over N status values - for (ubLoop = 0; ubLoop < ubNumberToCopy; ubLoop++) - { - pTargetObj->ItemData.Generic.bStatus[ubLoop + pTargetObj->ubNumberOfObjects] = pSourceObj->ItemData.Generic.bStatus[ubLoop ]; - } - - // now in the source object, move the rest down N places - for (ubLoop = ubNumberToCopy; ubLoop < pSourceObj->ubNumberOfObjects; ubLoop++) - { - pSourceObj->ItemData.Generic.bStatus[ubLoop - ubNumberToCopy] = pSourceObj->ItemData.Generic.bStatus[ubLoop]; - } - - pTargetObj->ubNumberOfObjects += ubNumberToCopy; - RemoveObjs( pSourceObj, ubNumberToCopy ); - pSourceObj->ubWeight = CalculateObjectWeight( pSourceObj ); - pTargetObj->ubWeight = CalculateObjectWeight( pTargetObj ); -} - -void CleanUpStack( OBJECTTYPE * pObj, OBJECTTYPE * pCursorObj ) -{ - INT8 bLoop, bLoop2; - INT8 bMaxPoints, bPointsToMove; - - if ( !(Item[ pObj->usItem ].usItemClass & IC_AMMO || Item[ pObj->usItem ].usItemClass & IC_KIT || Item[ pObj->usItem ].usItemClass & IC_MEDKIT || Item[pObj->usItem].canteen ) ) - { - return; - } - - if ( Item[ pObj->usItem ].usItemClass & IC_AMMO ) - { - bMaxPoints = Magazine[ Item[ pObj->usItem ].ubClassIndex ].ubMagSize; - } - else - { - bMaxPoints = 100; - } - - if ( pCursorObj && pCursorObj->usItem == pObj->usItem ) - { - for ( bLoop = (INT8) pCursorObj->ubNumberOfObjects - 1; bLoop >= 0; bLoop-- ) - { - if ( pCursorObj->ItemData.Generic.bStatus[ bLoop ] > 0 ) - { - // take the points here and distribute over the lower #d items - for ( bLoop2 = pObj->ubNumberOfObjects - 1; bLoop2 >= 0; bLoop2-- ) - { - if ( pObj->ItemData.Generic.bStatus[ bLoop2 ] < bMaxPoints ) - { - bPointsToMove = bMaxPoints - pObj->ItemData.Generic.bStatus[ bLoop2 ]; - bPointsToMove = __min( bPointsToMove, pCursorObj->ItemData.Generic.bStatus[ bLoop ] ); - - pObj->ItemData.Generic.bStatus[ bLoop2 ] += bPointsToMove; - - pCursorObj->ItemData.Generic.bStatus[ bLoop ] -= bPointsToMove; - if ( pCursorObj->ItemData.Generic.bStatus[ bLoop ] == 0 ) - { - // done! - pCursorObj->ubNumberOfObjects--; - break; - } - } - } - } - } - } - - for ( bLoop = (INT8) pObj->ubNumberOfObjects - 1; bLoop >= 0; bLoop-- ) - { - if ( pObj->ItemData.Generic.bStatus[ bLoop ] > 0 ) + StackedObjectData* pSource = (*pSourceObject)[ bLoop ]; + if ( pSource->data.objectStatus > 0 ) { // take the points here and distribute over the lower #d items - for ( bLoop2 = bLoop - 1; bLoop2 >= 0; bLoop2-- ) + int bLoop2; + if (pSourceObject == pTargetObject) { + //we are averaging out the same object + bLoop2 = bLoop - 1; + } + else { + //we are moving from the cursor object to this one + bLoop2 = pTargetObject->ubNumberOfObjects - 1; + } + + //for (; bLoop2 >= 0; bLoop2-- ) + for(int i = 0; i<=bLoop2; i++) { - if ( pObj->ItemData.Generic.bStatus[ bLoop2 ] < bMaxPoints ) + StackedObjectData* pDest = (*pTargetObject)[ i ]; + if ( pDest->data.objectStatus < bMaxPoints ) { - bPointsToMove = bMaxPoints - pObj->ItemData.Generic.bStatus[ bLoop2 ]; - bPointsToMove = __min( bPointsToMove, pObj->ItemData.Generic.bStatus[ bLoop ] ); + bPointsToMove = bMaxPoints - pDest->data.objectStatus; + bPointsToMove = __min( bPointsToMove, pSource->data.objectStatus ); - pObj->ItemData.Generic.bStatus[ bLoop2 ] += bPointsToMove; + pDest->data.objectStatus += bPointsToMove; + pSource->data.objectStatus -= bPointsToMove; - pObj->ItemData.Generic.bStatus[ bLoop ] -= bPointsToMove; - if ( pObj->ItemData.Generic.bStatus[ bLoop ] == 0 ) + if ( pSource->data.objectStatus == 0 ) { + StackedObjects::iterator iter = pSourceObject->objectStack.begin(); + for (int x = 0; x < bLoop; ++x) { + ++iter; + } + pSourceObject->objectStack.erase(iter); + pSourceObject->ubNumberOfObjects--; + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //pSourceObject->ubWeight = CalculateObjectWeight(pSourceObject); // done! - pObj->ubNumberOfObjects--; break; } } } } } - } - -BOOLEAN PlaceObjectAtObjectIndex( OBJECTTYPE * pSourceObj, OBJECTTYPE * pTargetObj, UINT8 ubIndex ) +BOOLEAN PlaceObjectAtObjectIndex( OBJECTTYPE * pSourceObj, OBJECTTYPE * pTargetObj, UINT8 ubIndex, UINT32 ubCap ) { - INT8 bTemp; - if (pSourceObj->usItem != pTargetObj->usItem) { return( TRUE ); @@ -2615,16 +2802,28 @@ BOOLEAN PlaceObjectAtObjectIndex( OBJECTTYPE * pSourceObj, OBJECTTYPE * pTargetO if (ubIndex < pTargetObj->ubNumberOfObjects) { // swap - bTemp = pSourceObj->ItemData.Generic.bStatus[0]; - pSourceObj->ItemData.Generic.bStatus[0] = pTargetObj->ItemData.Generic.bStatus[ubIndex]; - pTargetObj->ItemData.Generic.bStatus[ubIndex] = bTemp; + //std::swap?? + StackedObjectData data = *((*pSourceObj)[0]); + + *((*pSourceObj)[0]) = *((*pTargetObj)[ubIndex]); + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //pSourceObj->ubWeight = CalculateObjectWeight(pSourceObj); + + *((*pTargetObj)[ubIndex]) = data; + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //pTargetObj->ubWeight = CalculateObjectWeight(pTargetObj); return( TRUE ); } else { // add to end - StackObjs( pSourceObj, pTargetObj, 1 ); - return( FALSE ); + pTargetObj->AddObjectsToStack( *pSourceObj, 1, NULL, NUM_INV_SLOTS, ubCap ); + if (pSourceObj->exists() == true) { + return( TRUE ); + } + else { + return FALSE; + } } } @@ -2634,48 +2833,51 @@ BOOLEAN PlaceObjectAtObjectIndex( OBJECTTYPE * pSourceObj, OBJECTTYPE * pTargetO #define RELOAD_TOPOFF 3 #define RELOAD_AUTOPLACE_OLD 4 -BOOLEAN ReloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo ) +BOOLEAN ReloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo, UINT32 subObject ) { - OBJECTTYPE OldAmmo; - UINT8 ubBulletsToMove; + UINT16 ubBulletsToMove; INT8 bAPs; UINT16 usReloadSound; BOOLEAN fSameAmmoType; BOOLEAN fSameMagazineSize; BOOLEAN fReloadingWithStack; BOOLEAN fEmptyGun; + BOOLEAN fEnoughAPs; INT8 bReloadType; UINT16 usNewAmmoItem; + UINT16 usLargestMag; + UINT32 ammoObject = subObject; bAPs = 0; if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) ) { - bAPs = GetAPsToReloadGunWithAmmo( pGun, pAmmo ); + //CHRISL: Alter this so we treat clip fed weapons differently from weapons that load with loose rounds + bAPs = GetAPsToReloadGunWithAmmo( pSoldier, pGun, pAmmo ); if ( !EnoughPoints( pSoldier, bAPs, 0,TRUE ) ) { return( FALSE ); } - } if ( Item[ pGun->usItem ].usItemClass == IC_LAUNCHER || Item[pGun->usItem].cannon ) { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("ReloadGun: Loading launcher - new ammo type = %d, weight = %d", pAmmo->usItem,pAmmo->ubWeight ) ); - pGun->ItemData.Gun.usGunAmmoItem = pAmmo->usItem; - if ( AttachObject( pSoldier, pGun, pAmmo ) == FALSE ) + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("ReloadGun: Loading launcher - new ammo type = %d, weight = %d", pAmmo->usItem, CalculateObjectWeight(pAmmo) ) ); + (*pGun)[subObject]->data.gun.usGunAmmoItem = pAmmo->usItem; + if ( pGun->AttachObject( pSoldier, pAmmo ) == FALSE ) { - pGun->ItemData.Gun.usGunAmmoItem = NONE; + (*pGun)[subObject]->data.gun.usGunAmmoItem = NONE; // abort return( FALSE ); } } else { - fEmptyGun = (pGun->ItemData.Gun.ubGunShotsLeft == 0); + fEmptyGun = ((*pGun)[subObject]->data.gun.ubGunShotsLeft == 0); fReloadingWithStack = (pAmmo->ubNumberOfObjects > 1); - fSameAmmoType = ( pGun->ItemData.Gun.ubGunAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType ); + fSameAmmoType = ( (*pGun)[subObject]->data.gun.ubGunAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType ); fSameMagazineSize = ( Magazine[ Item[ pAmmo->usItem ].ubClassIndex ].ubMagSize == GetMagSize( pGun)); + fEnoughAPs = EnoughPoints( pSoldier, GetAPsToReloadGunWithAmmo( pSoldier, pGun, pAmmo, FALSE ), 0,FALSE ); if (fEmptyGun) { @@ -2684,11 +2886,8 @@ BOOLEAN ReloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo else { // record old ammo - memset( &OldAmmo, 0, sizeof( OBJECTTYPE )); - OldAmmo.usItem = pGun->ItemData.Gun.usGunAmmoItem; - OldAmmo.ubNumberOfObjects = 1; - OldAmmo.ItemData.Ammo.ubShotsLeft[0] = pGun->ItemData.Gun.ubGunShotsLeft; - + CreateAmmo((*pGun)[subObject]->data.gun.usGunAmmoItem, &gTempObject, (*pGun)[subObject]->data.gun.ubGunShotsLeft); + if (fSameMagazineSize) { if (fSameAmmoType) @@ -2727,6 +2926,24 @@ BOOLEAN ReloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo } } + //CHRISL: If reloading with a stack, we probably want the item with the most ammo still in it + if (fReloadingWithStack) + { + usLargestMag = (*pAmmo)[ammoObject]->data.ubShotsLeft; + for(int i = 0; iubNumberOfObjects; i++) + { + if((*pAmmo)[i]->data.ubShotsLeft == Magazine[Item[pAmmo->usItem].ubClassIndex].ubMagSize) + { + ammoObject = i; + break; + } + else if((*pAmmo)[i]->data.ubShotsLeft > usLargestMag) + { + ammoObject = i; + } + } + } + if (fSameMagazineSize) { // record new ammo item for gun @@ -2734,11 +2951,11 @@ BOOLEAN ReloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo if (bReloadType == RELOAD_TOPOFF) { - ubBulletsToMove = __min( pAmmo->ItemData.Ammo.ubShotsLeft[0], GetMagSize(pGun) - pGun->ItemData.Gun.ubGunShotsLeft ); + ubBulletsToMove = __min( (*pAmmo)[ammoObject]->data.ubShotsLeft, GetMagSize(pGun) - (*pGun)[subObject]->data.gun.ubGunShotsLeft ); } else { - ubBulletsToMove = pAmmo->ItemData.Ammo.ubShotsLeft[0]; + ubBulletsToMove = (*pAmmo)[ammoObject]->data.ubShotsLeft; } } @@ -2749,11 +2966,11 @@ BOOLEAN ReloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo usNewAmmoItem = FindReplacementMagazine(Weapon[pGun->usItem].ubCalibre ,GetMagSize(pGun),Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType); if (bReloadType == RELOAD_TOPOFF) { - ubBulletsToMove = __min( pAmmo->ItemData.Ammo.ubShotsLeft[0], GetMagSize(pGun) - pGun->ItemData.Gun.ubGunShotsLeft ); + ubBulletsToMove = __min( (*pAmmo)[ammoObject]->data.ubShotsLeft, GetMagSize(pGun) - (*pGun)[subObject]->data.gun.ubGunShotsLeft ); } else { - ubBulletsToMove = __min( pAmmo->ItemData.Ammo.ubShotsLeft[0], GetMagSize(pGun) ); + ubBulletsToMove = __min( (*pAmmo)[ammoObject]->data.ubShotsLeft, GetMagSize(pGun) ); } } else // mag is smaller than weapon mag @@ -2763,84 +2980,121 @@ BOOLEAN ReloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo usNewAmmoItem = FindReplacementMagazine(Weapon[pGun->usItem].ubCalibre ,GetMagSize(pGun),Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType); if (bReloadType == RELOAD_TOPOFF) { - ubBulletsToMove = __min( pAmmo->ItemData.Ammo.ubShotsLeft[0], GetMagSize(pGun) - pGun->ItemData.Gun.ubGunShotsLeft ); + ubBulletsToMove = __min( (*pAmmo)[ammoObject]->data.ubShotsLeft, GetMagSize(pGun) - (*pGun)[subObject]->data.gun.ubGunShotsLeft ); } else { - ubBulletsToMove = __min( pAmmo->ItemData.Ammo.ubShotsLeft[0], GetMagSize(pGun)); + ubBulletsToMove = __min( (*pAmmo)[ammoObject]->data.ubShotsLeft, GetMagSize(pGun)); } } + //CHRIS: This should reset the number of bullest moved to what we can actually afford when loading loose rounds + if(Weapon[pGun->usItem].swapClips == 0 && (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT)) + { + if(fEnoughAPs) + { + bAPs = GetAPsToReloadGunWithAmmo( pSoldier, pGun, pAmmo, FALSE ); + } + else + { + //how many can we reload? remember, bAPs assumes 1 round at this stage + bAPs = GetAPsToReloadGunWithAmmo( pSoldier, pGun, pAmmo, 2 ); + for(int i = 0; iItemData.Gun.ubGunShotsLeft = ubBulletsToMove; - pGun->ItemData.Gun.ubGunAmmoType = Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType; - pGun->ItemData.Gun.usGunAmmoItem = usNewAmmoItem; + (*pGun)[subObject]->data.gun.ubGunShotsLeft = ubBulletsToMove; + (*pGun)[subObject]->data.gun.ubGunAmmoType = Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType; + (*pGun)[subObject]->data.gun.usGunAmmoItem = usNewAmmoItem; break; case RELOAD_SWAP: - pGun->ItemData.Gun.ubGunShotsLeft = ubBulletsToMove; - pGun->ItemData.Gun.ubGunAmmoType = Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType; - pGun->ItemData.Gun.usGunAmmoItem = usNewAmmoItem; + (*pGun)[subObject]->data.gun.ubGunShotsLeft = ubBulletsToMove; + (*pGun)[subObject]->data.gun.ubGunAmmoType = Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType; + (*pGun)[subObject]->data.gun.usGunAmmoItem = usNewAmmoItem; if (fReloadingWithStack) { // add to end of stack - StackObjs( &OldAmmo, pAmmo, 1 ); + pAmmo->AddObjectsToStack( gTempObject, 1 ); } else { // Copying the old ammo to the cursor in turnbased could screw up for the player // (suppose his inventory is full!) - if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) && !EnoughPoints( pSoldier, (INT8) (bAPs + AP_PICKUP_ITEM), 0, FALSE ) ) + //ADB copying the old ammo to the cursor at any time will screw it up if the cursor ammo is a stack! + if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) && !EnoughPoints( pSoldier, (INT8) (bAPs + AP_PICKUP_ITEM), 0, FALSE ) + || pAmmo->ubNumberOfObjects > 1) { // try autoplace - if ( !AutoPlaceObject( pSoldier, &OldAmmo, FALSE ) ) + if ( !AutoPlaceObject( pSoldier, &gTempObject, FALSE ) ) { // put it on the ground - AddItemToPool( pSoldier->sGridNo, &OldAmmo, 1, pSoldier->bLevel, 0 , -1 ); + AddItemToPool( pSoldier->sGridNo, &gTempObject, 1, pSoldier->pathing.bLevel, 0 , -1 ); } // delete the object now in the cursor - DeleteObj( pAmmo ); + pAmmo->RemoveObjectsFromStack(1); } else { // copy the old ammo to the cursor - memcpy( pAmmo, &OldAmmo, sizeof( OBJECTTYPE ) ); + *pAmmo = gTempObject; } } break; case RELOAD_AUTOPLACE_OLD: - if ( !AutoPlaceObject( pSoldier, &OldAmmo, TRUE ) ) + if ( !AutoPlaceObject( pSoldier, &gTempObject, TRUE ) ) { // error msg! return( FALSE ); } // place first ammo in gun - pGun->ItemData.Gun.ubGunShotsLeft = ubBulletsToMove; - pGun->ItemData.Gun.ubGunAmmoType = Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType; - pGun->ItemData.Gun.usGunAmmoItem = usNewAmmoItem; + (*pGun)[subObject]->data.gun.ubGunShotsLeft = ubBulletsToMove; + (*pGun)[subObject]->data.gun.ubGunAmmoType = Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType; + (*pGun)[subObject]->data.gun.usGunAmmoItem = usNewAmmoItem; break; case RELOAD_TOPOFF: // ADD that many bullets to gun - pGun->ItemData.Gun.ubGunShotsLeft += ubBulletsToMove; + (*pGun)[subObject]->data.gun.ubGunShotsLeft += ubBulletsToMove; break; } + // CHRISL: If we don't completely reload a SwapClips==0 weapon, set the "reload" flag + if(Weapon[pGun->usItem].swapClips == 0 && GetMagSize(pGun) != (*pGun)[0]->data.gun.ubGunShotsLeft) + { + (*pGun)[subObject]->data.gun.ubGunState |= GS_WEAPON_BEING_RELOADED; + (*pGun)[subObject]->data.gun.ubGunState &= ~GS_CARTRIDGE_IN_CHAMBER; + } + else + { + (*pGun)[subObject]->data.gun.ubGunState &= ~GS_WEAPON_BEING_RELOADED; + (*pGun)[subObject]->data.gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; + } + if ( ! ( bReloadType == RELOAD_SWAP && !fReloadingWithStack ) ) { // remove # of bullets, delete 1 object if necessary - pAmmo->ItemData.Ammo.ubShotsLeft[0] -= ubBulletsToMove; - if (pAmmo->ItemData.Ammo.ubShotsLeft[0] == 0) + (*pAmmo)[ammoObject]->data.ubShotsLeft -= ubBulletsToMove; + if ((*pAmmo)[ammoObject]->data.ubShotsLeft == 0) { - RemoveObjs( pAmmo, 1 ); + pAmmo->RemoveObjectAtIndex(ammoObject); + //pAmmo->RemoveObjectsFromStack(1); } } @@ -2855,7 +3109,7 @@ BOOLEAN ReloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo if ( usReloadSound != 0 && !IsAutoResolveActive() ) { - PlayJA2Sample( usReloadSound, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); + PlayJA2Sample( usReloadSound, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); } } @@ -2866,66 +3120,48 @@ BOOLEAN ReloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo } DeductPoints( pSoldier, bAPs, 0 ); - pGun->ubWeight = CalculateObjectWeight( pGun ); + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //pGun->ubWeight = CalculateObjectWeight( pGun ); - if ( pGun->ItemData.Gun.bGunAmmoStatus >= 0 ) + if ( (*pGun)[subObject]->data.gun.bGunAmmoStatus >= 0 ) { // make sure gun ammo status is 100, if gun isn't jammed - pGun->ItemData.Gun.bGunAmmoStatus = 100; + (*pGun)[subObject]->data.gun.bGunAmmoStatus = 100; } - pGun->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; // Madd: reloading should automatically put cartridge in chamber + //CHRISL: Move this towards the top so that we can leave this flag off if we're in the middle of reloading + //(*pGun)[subObject]->data.gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; // Madd: reloading should automatically put cartridge in chamber return( TRUE ); } -BOOLEAN UnloadGun( SOLDIERTYPE *pSoldier, OBJECTTYPE *pGun) -{ - OBJECTTYPE newObj; - CreateItem(pGun->ItemData.Gun.usGunAmmoItem, 100, &newObj); - newObj.ItemData.Ammo.ubShotsLeft[0] = pGun->ItemData.Gun.ubGunShotsLeft; - pGun->ItemData.Gun.ubGunShotsLeft = 0; - pGun->ItemData.Gun.usGunAmmoItem = NONE; - if ( !AutoPlaceObject( pSoldier, &newObj, FALSE ) ) - { // put it on the ground - AddItemToPool( pSoldier->sGridNo, &newObj, 1, pSoldier->bLevel, 0 , -1 ); - } - return TRUE; -} - -BOOLEAN EmptyWeaponMagazine( OBJECTTYPE * pWeapon, OBJECTTYPE *pAmmo ) +BOOLEAN EmptyWeaponMagazine( OBJECTTYPE * pWeapon, OBJECTTYPE *pAmmo, UINT32 subObject ) { UINT16 usReloadSound; CHECKF( pAmmo != NULL ); - if ( pWeapon->ItemData.Gun.ubGunShotsLeft > 0 ) + if ( (*pWeapon)[subObject]->data.gun.ubGunShotsLeft > 0 ) { - // start by erasing ammo item, just in case... - DeleteObj( pAmmo ); + CreateAmmo((*pWeapon)[subObject]->data.gun.usGunAmmoItem, pAmmo, (*pWeapon)[subObject]->data.gun.ubGunShotsLeft); - // 0verhaul: The gun ammo type is supposed to be part of the magazine description. - // Besides, it is only useful for guns. For ammo this variable is just one of the ammo stack counts. - //pAmmo->ItemData.Gun.ubGunAmmoType = pWeapon->ItemData.Gun.ubGunAmmoType ; - pAmmo->ItemData.Ammo.ubShotsLeft[0] = pWeapon->ItemData.Gun.ubGunShotsLeft; - pAmmo->usItem = pWeapon->ItemData.Gun.usGunAmmoItem; - pAmmo->ubNumberOfObjects = 1; - - pWeapon->ItemData.Gun.ubGunShotsLeft = 0; - pWeapon->ItemData.Gun.ubGunAmmoType = 0; - //pWeapon->ItemData.Gun.usGunAmmoItem = 0; // leaving the ammo item the same for auto-reloading purposes + (*pWeapon)[subObject]->data.gun.ubGunShotsLeft = 0; + (*pWeapon)[subObject]->data.gun.ubGunAmmoType = 0; + //(*pWeapon)[subObject]->data.gun.usGunAmmoItem = 0; // leaving the ammo item the same for auto-reloading purposes // Play some effects! usReloadSound = Weapon[ pWeapon->usItem ].sReloadSound; if ( usReloadSound != 0 ) { - PlayJA2Sample( usReloadSound, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); + PlayJA2Sample( usReloadSound, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); } - pWeapon->ubWeight = CalculateObjectWeight( pWeapon ); + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //pWeapon->ubWeight = CalculateObjectWeight( pWeapon ); // Pulmu bugfix: - pAmmo->ubWeight = CalculateObjectWeight( pAmmo ); + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //pAmmo->ubWeight = CalculateObjectWeight( pAmmo ); // Pulmu end: return( TRUE ); } @@ -2935,72 +3171,60 @@ BOOLEAN EmptyWeaponMagazine( OBJECTTYPE * pWeapon, OBJECTTYPE *pAmmo ) } } -/* -BOOLEAN ReloadLauncher( OBJECTTYPE * pLauncher, OBJECTTYPE * pAmmo ) -{ - BOOLEAN fOldAmmo; - OBJECTTYPE OldAmmo; - - if (pLauncher->ItemData.Gun.ubGunShotsLeft == 0) - { - fOldAmmo = FALSE; - } - else - { - if (pAmmo->ubNumberOfObjects > 1) - { - // can't do the swap out to the cursor - return( FALSE ); - } - // otherwise temporarily store the launcher's old ammo - memset( &OldAmmo, 0, sizeof( OBJECTTYPE )); - fOldAmmo = TRUE; - OldAmmo.usItem = pLauncher->ItemData.Gun.usGunAmmoItem; - OldAmmo.ubNumberOfObjects = 1; - OldAmmo.bStatus[0] = pLauncher->ItemData.Gun.bGunAmmoStatus; - } - - // put the new ammo in the gun - pLauncher->ItemData.Gun.usGunAmmoItem = pAmmo->usItem; - pLauncher->ItemData.Gun.ubGunShotsLeft = 1; - pLauncher->ItemData.Gun.ubGunAmmoType = AMMO_GRENADE; - pLauncher->ItemData.Gun.bGunAmmoStatus = pAmmo->ItemData.Generic.bStatus[0]; - - - if (fOldAmmo) - { - // copy the old ammo back to the item in the cursor - memcpy( pAmmo, &OldAmmo, sizeof( OBJECTTYPE ) ); - } - else - { - // reduce the number of objects in the cursor by 1 - RemoveObjs( pAmmo, 1 ); - } - return( TRUE ); -} -*/ - -INT8 FindAmmo( SOLDIERTYPE * pSoldier, UINT8 ubCalibre, UINT8 ubMagSize, INT8 bExcludeSlot ) +INT8 FindAmmo( SOLDIERTYPE * pSoldier, UINT8 ubCalibre, UINT16 ubMagSize, INT8 bExcludeSlot ) { INT8 bLoop; + INT8 capLoop = 0; + UINT16 curCap = 0, stackCap = 0; + BOOLEAN found = FALSE; INVTYPE * pItem; - for (bLoop = HANDPOS; bLoop < NUM_INV_SLOTS; bLoop++) + //CHRISL: Update this to search for the largest appropriate mag if ubMagSize = ANY_MAGSIZE + + for (bLoop = HANDPOS; bLoop < (INT8)pSoldier->inv.size(); bLoop++) { - if (bLoop == bExcludeSlot) - { - continue; - } - pItem = &(Item[pSoldier->inv[bLoop].usItem]); - if (pItem->usItemClass == IC_AMMO) - { - if (Magazine[pItem->ubClassIndex].ubCalibre == ubCalibre && (Magazine[pItem->ubClassIndex].ubMagSize == ubMagSize || ubMagSize == ANY_MAGSIZE)) + if (pSoldier->inv[bLoop].exists() == true) { + if (bLoop == bExcludeSlot) { - return( bLoop ); + continue; + } + pItem = &(Item[pSoldier->inv[bLoop].usItem]); + if (pItem->usItemClass == IC_AMMO) + { + if (Magazine[pItem->ubClassIndex].ubCalibre == ubCalibre) + { + if(ubMagSize != ANY_MAGSIZE && Magazine[pItem->ubClassIndex].ubMagSize == ubMagSize) + { + found = TRUE; + // looking for specific size. return if found + // Find fullest mag + for(int i = 0; iinv[bLoop].ubNumberOfObjects; i++) + { + stackCap = __max(stackCap, pSoldier->inv[bLoop][i]->data.ubShotsLeft); + } + if(stackCap > curCap) + { + curCap = stackCap; + capLoop = bLoop; + } + //return( bLoop ); + } + else if(ubMagSize == ANY_MAGSIZE) + { + found = TRUE; + // looking for any mag size. find the largest + if(Magazine[pItem->ubClassIndex].ubMagSize > curCap) + { + curCap = Magazine[pItem->ubClassIndex].ubMagSize; + capLoop = bLoop; + } + } + } } } } + if(found == TRUE) + return( capLoop ); return( NO_SLOT ); } @@ -3017,19 +3241,19 @@ INT8 FindAmmoToReload( SOLDIERTYPE * pSoldier, INT8 bWeaponIn, INT8 bExcludeSlot pObj = &(pSoldier->inv[bWeaponIn]); // manual recharge - if (pObj->ItemData.Gun.ubGunShotsLeft && !(pObj->ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) ) + if ((*pObj)[0]->data.gun.ubGunShotsLeft && !((*pObj)[0]->data.gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) ) return bWeaponIn; // if ( Item[pObj->usItem].usItemClass == IC_GUN && !Item[pObj->usItem].cannon ) { // look for same ammo as before - bSlot = FindObjExcludingSlot( pSoldier, pObj->ItemData.Gun.usGunAmmoItem, bExcludeSlot ); - if (bSlot != NO_SLOT) - { + //bSlot = FindObjExcludingSlot( pSoldier, (*pObj)[0]->data.gun.usGunAmmoItem, bExcludeSlot ); + //if (bSlot != NO_SLOT) + //{ // reload using this ammo! - return( bSlot ); - } + // return( bSlot ); + //} // look for any ammo that matches which is of the same calibre and magazine size bSlot = FindAmmo( pSoldier, Weapon[pObj->usItem].ubCalibre, GetMagSize(pObj), bExcludeSlot ); if (bSlot != NO_SLOT) @@ -3086,21 +3310,22 @@ BOOLEAN AutoReload( SOLDIERTYPE * pSoldier ) pObj = &(pSoldier->inv[HANDPOS]); // manual recharge - if (pObj->ItemData.Gun.ubGunShotsLeft && !(pObj->ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) ) + if ((*pObj)[0]->data.gun.ubGunShotsLeft && !((*pObj)[0]->data.gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) ) { - pObj->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; + (*pObj)[0]->data.gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; + (*pObj)[0]->data.gun.ubGunState &= ~GS_WEAPON_BEING_RELOADED; DeductPoints(pSoldier, Weapon[Item[(pObj)->usItem].ubClassIndex].APsToReloadManually, 0); PlayJA2Sample( Weapon[ Item[pObj->usItem].ubClassIndex ].ManualReloadSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); - if ( IsValidSecondHandShot( pSoldier ) ) + if ( pSoldier->IsValidSecondHandShot( ) ) { pObj2 = &(pSoldier->inv[SECONDHANDPOS]); - if (pObj2->ItemData.Gun.ubGunShotsLeft && !(pObj2->ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) ) - { - pObj2->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; + if ((*pObj2)[0]->data.gun.ubGunShotsLeft && !((*pObj2)[0]->data.gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) ) + { + (*pObj2)[0]->data.gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; PlayJA2Sample( Weapon[ Item[pObj2->usItem].ubClassIndex ].ManualReloadSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } } @@ -3109,13 +3334,13 @@ BOOLEAN AutoReload( SOLDIERTYPE * pSoldier ) } else { - if ( IsValidSecondHandShot( pSoldier ) ) + if ( pSoldier->IsValidSecondHandShot( ) ) { pObj2 = &(pSoldier->inv[SECONDHANDPOS]); - if (pObj2->ItemData.Gun.ubGunShotsLeft && !(pObj2->ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) ) + if ((*pObj2)[0]->data.gun.ubGunShotsLeft && !((*pObj2)[0]->data.gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) ) { - pObj2->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; + (*pObj2)[0]->data.gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; DeductPoints(pSoldier, Weapon[Item[(pObj2)->usItem].ubClassIndex].APsToReloadManually, 0); @@ -3136,21 +3361,21 @@ BOOLEAN AutoReload( SOLDIERTYPE * pSoldier ) fRet = ReloadGun( pSoldier, pObj, &(pSoldier->inv[bSlot]) ); // if we are valid for two-pistol shooting (reloading) and we have enough APs still // then do a reload of both guns! - if ( (fRet == TRUE) && IsValidSecondHandShotForReloadingPurposes( pSoldier ) ) + if ( (fRet == TRUE) && pSoldier->IsValidSecondHandShotForReloadingPurposes( ) ) { pObj = &(pSoldier->inv[SECONDHANDPOS]); bSlot = FindAmmoToReload( pSoldier, SECONDHANDPOS, NO_SLOT ); if (bSlot != NO_SLOT) { // ce would reload using this ammo! - bAPCost = GetAPsToReloadGunWithAmmo( pObj, &(pSoldier->inv[bSlot] ) ); + bAPCost = GetAPsToReloadGunWithAmmo( pSoldier, pObj, &(pSoldier->inv[bSlot] ) ); if ( EnoughPoints( pSoldier, (INT16) bAPCost, 0, FALSE ) ) { // reload the 2nd gun too fRet = ReloadGun( pSoldier, pObj, &(pSoldier->inv[bSlot]) ); } else - { + { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[ STR_RELOAD_ONLY_ONE_GUN ], pSoldier->name ); } } @@ -3165,53 +3390,53 @@ BOOLEAN AutoReload( SOLDIERTYPE * pSoldier ) return( FALSE ); } -INT8 GetAttachmentComboMerge( OBJECTTYPE * pObj ) +INT8 GetAttachmentComboMerge( OBJECTTYPE * pObj, UINT8 subObject ) { INT8 bIndex = 0; - INT8 bAttachLoop, bAttachPos = -1; + INT8 bAttachLoop; /* check the whole Array of possible Attachements, while there are still entries ... */ - while( AttachmentComboMerge[ bIndex ].usItem != NOTHING ) + while( AttachmentComboMerge[ bIndex ].usItem != NOTHING ) { - /* if we found our current Object as "basic hand" item, then + /* if we found our current Object as "basic hand" item, then * we have found at least ONE entry of our item (may be there are more) */ - if ( pObj->usItem == AttachmentComboMerge[ bIndex ].usItem ) + OBJECTTYPE* pAttachment = 0; + if ( pObj->usItem == AttachmentComboMerge[ bIndex ].usItem ) { - // search for all the appropriate attachments - /* every ComboMerge must have at least one attachments Field */ + // search for all the appropriate attachments + /* every ComboMerge must have at least one attachments Field */ for ( bAttachLoop = 0; bAttachLoop < 2; bAttachLoop++ ) { /* if the none of both Fields contains anything, do not merge */ - if ( AttachmentComboMerge[ bIndex ].usAttachment[ bAttachLoop ] == NOTHING ) + if ( AttachmentComboMerge[ bIndex ].usAttachment[ bAttachLoop ] == NOTHING ) { continue; } - bAttachPos = FindAttachment( pObj, AttachmentComboMerge[ bIndex ].usAttachment[ bAttachLoop ] ); - /* 2007-05-27, Sgt_Kolja: - * do not return, but break the inner loop moved away, otherwise - * we can only have ONE attachmentCombo per basic item. F.I. if we want - * to make a Dart gun from Dart pistol by adding (a buttstock and) wheter a - * steel tube /or/ a Gun Barrel Extender, the old code wouldn't work for - * the Gun Barel Extender, since it would never been tested. - */ - if ( bAttachPos == -1 ) + /* 2007-05-27, Sgt_Kolja: + * do not return, but break the inner loop moved away, otherwise + * we can only have ONE attachmentCombo per basic item. F.I. if we want + * to make a Dart gun from Dart pistol by adding (a buttstock and) wheter a + * steel tube /or/ a Gun Barrel Extender, the old code wouldn't work for + * the Gun Barel Extender, since it would never been tested. + */ + pAttachment = FindAttachment( pObj, AttachmentComboMerge[ bIndex ].usAttachment[ bAttachLoop ], subObject ); + if ( pAttachment == 0 ) { - // didn't find something required - //return( -1 ); - break; + // didn't find something required + break; } } - // found everything required? - /* 2007-05-27, Sgt_Kolja: Not-found-condition moved from above, otherwise we can only have ONE attachmentCombo per basic item */ - if ( bAttachPos != -1 ) - { - return( bIndex ); - } - } /* end-if-this-is-our-item */ + // found everything required? + /* 2007-05-27, Sgt_Kolja: Not-found-condition moved from above, otherwise we can only have ONE attachmentCombo per basic item */ + if ( pAttachment ) + { + return( bIndex ); + } + } /* end-if-this-is-our-item */ - /* try next Attachment Order */ + /* try next Attachment Order */ bIndex++; } @@ -3222,7 +3447,7 @@ INT8 GetAttachmentComboMerge( OBJECTTYPE * pObj ) void PerformAttachmentComboMerge( OBJECTTYPE * pObj, INT8 bAttachmentComboMerge ) { - INT8 bAttachLoop, bAttachPos; + INT8 bAttachLoop; UINT32 uiStatusTotal = 0; INT8 bNumStatusContributors = 0; @@ -3238,233 +3463,241 @@ void PerformAttachmentComboMerge( OBJECTTYPE * pObj, INT8 bAttachmentComboMerge continue; } - bAttachPos = FindAttachment( pObj, AttachmentComboMerge[ bAttachmentComboMerge ].usAttachment[ bAttachLoop ] ); - AssertMsg( bAttachPos != -1, String( "Attachment combo merge couldn't find a necessary attachment" ) ); - - uiStatusTotal += pObj->bAttachStatus[ bAttachPos ]; + OBJECTTYPE* pAttachment = FindAttachment( pObj, AttachmentComboMerge[ bAttachmentComboMerge ].usAttachment[ bAttachLoop ] ); + AssertMsg( pAttachment != 0, String( "Attachment combo merge couldn't find a necessary attachment" ) ); + + uiStatusTotal += (*pAttachment)[0]->data.objectStatus; bNumStatusContributors++; - pObj->usAttachItem[ bAttachPos ] = NOTHING; - pObj->bAttachStatus[ bAttachPos ] = 0; + pObj->RemoveAttachment(pAttachment); } - uiStatusTotal += pObj->ItemData.Generic.bStatus[ 0 ]; + uiStatusTotal += (*pObj)[0]->data.objectStatus; bNumStatusContributors++; pObj->usItem = AttachmentComboMerge[ bAttachmentComboMerge ].usResult; - pObj->ItemData.Generic.bStatus[ 0 ] = (INT8) (uiStatusTotal / bNumStatusContributors ); + (*pObj)[0]->data.objectStatus = (INT8) (uiStatusTotal / bNumStatusContributors ); } - -BOOLEAN AttachObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pTargetObj, OBJECTTYPE * pAttachment ) +BOOLEAN OBJECTTYPE::AttachObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttachment, BOOLEAN playSound, UINT8 subObject ) { - return AttachObject( pSoldier, pTargetObj, pAttachment, TRUE ); -} + //CHRISL: This makes it impossible to add attachments to objects in a stack. Let's remove this and make this possible. + //if ( this->ubNumberOfObjects > 1 ) + //{ + // return( FALSE ); + //} + if (pAttachment->exists() == false) { + return FALSE; + } + if ((*this)[subObject]->attachments.size() >= MAX_ATTACHMENTS) { + return FALSE; + } + static OBJECTTYPE attachmentObject; -BOOLEAN AttachObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pTargetObj, OBJECTTYPE * pAttachment, BOOLEAN playSound ) -{ - INT8 bAttachPos, bSecondAttachPos;//, bAbility, bSuccess; - UINT16 usResult, usResult2; + UINT16 usResult, usResult2, ubLimit; INT8 bLoop; - UINT8 ubType, ubLimit, ubAPCost; + UINT8 ubType, ubAPCost; INT32 iCheckResult; INT8 bAttachInfoIndex = -1, bAttachComboMerge; BOOLEAN fValidLaunchable = FALSE; - //BOOLEAN IsAGLorRL = FALSE; + bool canOnlyAttach1 = false; - if ( pTargetObj->ubNumberOfObjects > 1 ) + //if this is an attachment or ammo for a launchable item + fValidLaunchable = ValidLaunchable( pAttachment->usItem, this->usItem ); + //CHRISL: If we don't want to play the sound, it's a good bet we don't want to display any messages either + if ( fValidLaunchable || ValidItemAttachment( this, pAttachment->usItem, TRUE, playSound, subObject ) ) { - return( FALSE ); - } + //if there is already an attachment of the same type, we want to try swapping / replacing it + OBJECTTYPE* pAttachmentPosition = 0; - fValidLaunchable = ValidLaunchable( pAttachment->usItem, pTargetObj->usItem ); - - if ( fValidLaunchable || ValidItemAttachment( pTargetObj, pAttachment->usItem, TRUE ) ) - { - OBJECTTYPE TempObj = {0}; - - // find an attachment position... + // find an attachment position... // second half of this 'if' is for attaching GL grenades to a gun w/attached GL - if ( fValidLaunchable || (Item[pAttachment->usItem].glgrenade && FindAttachmentByClass(pTargetObj, IC_LAUNCHER) != NO_SLOT ) ) + if ( fValidLaunchable || (Item[pAttachment->usItem].glgrenade && FindAttachmentByClass(this, IC_LAUNCHER, subObject) != 0 ) ) { + canOnlyAttach1 = true; // try replacing if possible - bAttachPos = FindAttachmentByClass( pTargetObj, Item[ pAttachment->usItem ].usItemClass ); - if ( bAttachPos != NO_SLOT ) - { - // we can only do a swap if there is only 1 grenade being attached - if ( pAttachment->ubNumberOfObjects > 1 ) - { - return( FALSE ); - } - } - else - { - bAttachPos = FindAttachment( pTargetObj, NOTHING ); - } + pAttachmentPosition = FindAttachmentByClass( this, Item[ pAttachment->usItem ].usItemClass, subObject ); } else { // try replacing if possible - bAttachPos = FindAttachment( pTargetObj, pAttachment->usItem ); - if ( bAttachPos == NO_SLOT ) + pAttachmentPosition = FindAttachment( this, pAttachment->usItem, subObject ); + } + + if ( pSoldier ) + { + //did the soldier damage it? + bAttachInfoIndex = GetAttachmentInfoIndex( pAttachment->usItem ); + // in-game (not behind the scenes) attachment + if ( bAttachInfoIndex != -1 && AttachmentInfo[ bAttachInfoIndex ].bAttachmentSkillCheck != NO_CHECK ) { - bAttachPos = FindAttachment( pTargetObj, NOTHING ); + iCheckResult = SkillCheck( pSoldier, AttachmentInfo[ bAttachInfoIndex ].bAttachmentSkillCheck, AttachmentInfo[ bAttachInfoIndex ].bAttachmentSkillCheckMod ); + if (iCheckResult < 0) + { + // the attach failure damages both items + DamageObj( this, (INT8) -iCheckResult, subObject ); + DamageObj( pAttachment, (INT8) -iCheckResult, subObject ); + + // there should be a quote here! + pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); + if ( gfInItemDescBox ) + { + DeleteItemDescriptionBox(); + } + return( FALSE ); + } + } + + if ( ValidItemAttachment( this, pAttachment->usItem, TRUE, TRUE, subObject ) && playSound ) // not launchable + { + // attachment sounds + if ( Item[ this->usItem ].usItemClass & IC_WEAPON ) + { + PlayJA2Sample( ATTACH_TO_GUN, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + } + else if ( Item[ this->usItem ].usItemClass & IC_ARMOUR ) + { + PlayJA2Sample( ATTACH_CERAMIC_PLATES, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + } + else if ( Item[ this->usItem ].usItemClass & IC_BOMB ) + { + PlayJA2Sample( ATTACH_DETONATOR, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + } } } + if (pAttachmentPosition) { + if (canOnlyAttach1 == true) { + if(pAttachment->ubNumberOfObjects > 1) + { + //We don't want to inadvertantly load two rounds during a swap so don't allow a swap if we're holding a stack + return(FALSE); + } + //we have requested to swap the attachment on the cursor with the current attachment + SwapObjs(pAttachmentPosition,pAttachment); + return(TRUE); + } + } + + //ADB moved after skill check! //lalien: added to make a GL/RL work when reloaded manually // the AP costs for reloading GL/RL will be taken from weapons.xml ( wrong place!!! the AP's are deducted in DeleteItemDescriptionBox() ) - if (bAttachPos != ITEM_NOT_FOUND) - { - if ( Item[ pTargetObj->usItem ].usItemClass == IC_LAUNCHER || Item[pTargetObj->usItem].cannon ) + //if (pAttachmentPosition) { + if(pAttachmentPosition || (pAttachmentPosition == NULL && (*this)[subObject]->attachments.size() < MAX_ATTACHMENTS)){ + //we know we are replacing this attachment + if ( Item[ this->usItem ].usItemClass == IC_LAUNCHER || Item[this->usItem].cannon ) { - //if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) ) - //{ - // INT8 bAPs = GetAPsToReloadGunWithAmmo( pTargetObj, pAttachment ); - // - // if ( !EnoughPoints( pSoldier, bAPs, 0,TRUE ) ) - // { - // return( FALSE ); - // } - // else - // { - // DeductPoints( pSoldier, bAPs, 0 ); - // IsAGLorRL = TRUE; - // } - //} - if ( fValidLaunchable ) { - pTargetObj->ItemData.Gun.usGunAmmoItem = pAttachment->usItem; + (*this)[subObject]->data.gun.usGunAmmoItem = pAttachment->usItem; + //we have reloaded a launchable, so the ammo is gone from the original object + } + } + } + + //unfortunately must come before possible attachment swap + if (Item[pAttachment->usItem].grenadelauncher ) + { + // transfer any attachments from the grenade launcher to the gun + (*this)[subObject]->attachments.splice((*this)[subObject]->attachments.begin(), (*pAttachment)[0]->attachments, + (*pAttachment)[0]->attachments.begin(), (*pAttachment)[0]->attachments.end()); + } + + if (pAttachmentPosition) { + //we are swapping the attachments, and we know we do NOT need to worry about attachment stack size + //CHRISL: Actually, we do need to worry about attachment stack size since we might have a stack in our cursor. + // Rather then doing a simple swap, try moving the existing attachment to our cursor stack, then attach one item + // from the cursor stack. + + pAttachment->AddObjectsToStack(*pAttachmentPosition,-1,pSoldier,NUM_INV_SLOTS,MAX_OBJECTS_PER_SLOT); + pAttachment->MoveThisObjectTo(attachmentObject,1,pSoldier,NUM_INV_SLOTS,1); + *pAttachmentPosition = attachmentObject; + //backup the original attachment + //attachmentObject = *pAttachmentPosition; + + //place the new one + //*pAttachmentPosition = *pAttachment; + + //whatever pAttachment pointed to is now the original attachment + //*pAttachment = attachmentObject; + } + else { + //it's a new attachment + if (canOnlyAttach1 == true) { + //we only placed one of the stack, pAttachment could have any number of objects + if (pAttachment->MoveThisObjectTo(attachmentObject,1,pSoldier,NUM_INV_SLOTS,1) == 0) { + (*this)[subObject]->attachments.push_back(attachmentObject); + } + } + else { + //pAttachment could have any number of objects, they have all been moved over + //CHRISL: This doesn't work. What if we have a stack of objects in the cursor? We don't want the whole + // stack to be attached + //(*this)[subObject]->attachments.push_back(*pAttachment); + //DeleteObj(pAttachment); + if (pAttachment->MoveThisObjectTo(attachmentObject,1,pSoldier,NUM_INV_SLOTS,1) == 0) { + (*this)[subObject]->attachments.push_back(attachmentObject); } } } - if (bAttachPos == ITEM_NOT_FOUND) + // Check for attachment merge combos here + //CHRISL: Only do this if we're looking at a single item. Don't try a combo merge when dealing with a stack + bAttachComboMerge = GetAttachmentComboMerge( this, subObject ); + if ( bAttachComboMerge != -1 ) { - return( FALSE ); - } - else - { - if ( pSoldier ) + if(this->ubNumberOfObjects == 1) { - bAttachInfoIndex = GetAttachmentInfoIndex( pAttachment->usItem ); - // in-game (not behind the scenes) attachment - if ( bAttachInfoIndex != -1 && AttachmentInfo[ bAttachInfoIndex ].bAttachmentSkillCheck != NO_CHECK ) - { - iCheckResult = SkillCheck( pSoldier, AttachmentInfo[ bAttachInfoIndex ].bAttachmentSkillCheck, AttachmentInfo[ bAttachInfoIndex ].bAttachmentSkillCheckMod ); - if (iCheckResult < 0) - { - // the attach failure damages both items - DamageObj( pTargetObj, (INT8) -iCheckResult ); - DamageObj( pAttachment, (INT8) -iCheckResult ); - // there should be a quote here! - DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 ); - if ( gfInItemDescBox ) - { - DeleteItemDescriptionBox(); - } - return( FALSE ); - } - } - - if ( ValidItemAttachment( pTargetObj, pAttachment->usItem, TRUE ) && playSound ) // not launchable - { - // attachment sounds - if ( Item[ pTargetObj->usItem ].usItemClass & IC_WEAPON ) - { - PlayJA2Sample( ATTACH_TO_GUN, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); - } - else if ( Item[ pTargetObj->usItem ].usItemClass & IC_ARMOUR ) - { - PlayJA2Sample( ATTACH_CERAMIC_PLATES, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); - } - else if ( Item[ pTargetObj->usItem ].usItemClass & IC_BOMB ) - { - PlayJA2Sample( ATTACH_DETONATOR, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); - } - } - } - - if ( pTargetObj->usAttachItem[ bAttachPos ] != NOTHING ) - { - CreateItem( pTargetObj->usAttachItem[bAttachPos], pTargetObj->bAttachStatus[bAttachPos], &TempObj ); - } - - pTargetObj->usAttachItem[bAttachPos] = pAttachment->usItem; - pTargetObj->bAttachStatus[bAttachPos] = pAttachment->ItemData.Generic.bStatus[0]; - - if (Item[pAttachment->usItem].grenadelauncher ) - { - // transfer any attachment (max 1) from the grenade launcher to the gun - if (pAttachment->usAttachItem[0] != NOTHING) - { - bSecondAttachPos = FindAttachment( pTargetObj, NOTHING ); - if (bSecondAttachPos == ITEM_NOT_FOUND) - { - // not enough room for all attachments - cancel!! - pTargetObj->usAttachItem[bAttachPos] = NOTHING; - pTargetObj->bAttachStatus[bAttachPos] = 0; - return( FALSE ); - } - else - { - pTargetObj->usAttachItem[bSecondAttachPos] = pAttachment->usAttachItem[0]; - pTargetObj->bAttachStatus[bSecondAttachPos] = pAttachment->bAttachStatus[0]; - pAttachment->usAttachItem[0] = NOTHING; - pAttachment->bAttachStatus[0] = 0; - } - } - } - - if ( TempObj.usItem != NOTHING ) - { - // overwrite/swap! - CopyObj( &TempObj, pAttachment ); - } - else - { - RemoveObjs( pAttachment, 1 ); - } - - // Check for attachment merge combos here - bAttachComboMerge = GetAttachmentComboMerge( pTargetObj ); - if ( bAttachComboMerge != -1 ) - { - PerformAttachmentComboMerge( pTargetObj, bAttachComboMerge ); + PerformAttachmentComboMerge( this, bAttachComboMerge ); if ( bAttachInfoIndex != -1 && AttachmentInfo[ bAttachInfoIndex ].bAttachmentSkillCheckMod < 20 ) { StatChange( pSoldier, MECHANAMT, (INT8) ( 20 - AttachmentInfo[ bAttachInfoIndex ].bAttachmentSkillCheckMod ), FALSE ); StatChange( pSoldier, WISDOMAMT, (INT8) ( 20 - AttachmentInfo[ bAttachInfoIndex ].bAttachmentSkillCheckMod ), FALSE ); } } - - pTargetObj->ubWeight = CalculateObjectWeight( pTargetObj ); - - if ( pSoldier != NULL ) - ApplyEquipmentBonuses(pSoldier); - - return( TRUE ); + //CHRISL: If we're looking at a stack, we need to unattach the object we just attached + else if(this->RemoveAttachment(&attachmentObject, pAttachmentPosition, subObject)) + { + pAttachment->AddObjectsToStack(attachmentObject, -1, pSoldier, NUM_INV_SLOTS, MAX_OBJECTS_PER_SLOT); + } } + + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //this->ubWeight = CalculateObjectWeight( this ); + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //pAttachment->ubWeight = CalculateObjectWeight(pAttachment); + + if ( pSoldier != NULL ) + ApplyEquipmentBonuses(pSoldier); + + return( TRUE ); } // check for merges - else if (EvaluateValidMerge( pAttachment->usItem, pTargetObj->usItem, &usResult, &usResult2, &ubType, &ubAPCost )) + else if (EvaluateValidMerge( pAttachment->usItem, this->usItem, &usResult, &usResult2, &ubType, &ubAPCost )) { + //CHRISL: We don't want to do any merges if we're looking at a stack of items, with the exception of combines. + if ( this->ubNumberOfObjects > 1 && ubType != COMBINE_POINTS ) + { + return( FALSE ); + } if ( ubType != COMBINE_POINTS ) { - if ( !EnoughPoints( pSoldier, ubAPCost, 0, TRUE ) ) + if ( pSoldier ) { - return( FALSE ); - } + if ( !EnoughPoints( pSoldier, ubAPCost, 0, TRUE ) ) + { + return( FALSE ); + } - //lalien: don't charge AP's for reloading a GL/RL ( wrong place!!! the AP's are deducted in DeleteItemDescriptionBox() ) - //if ( IsAGLorRL == FALSE ) - //{ - DeductPoints( pSoldier, ubAPCost, 0 ); - //} + //lalien: don't charge AP's for reloading a GL/RL ( wrong place!!! the AP's are deducted in DeleteItemDescriptionBox() ) + //if ( IsAGLorRL == FALSE ) + //{ + DeductPoints( pSoldier, ubAPCost, 0 ); + //} + } } switch( ubType ) @@ -3476,17 +3709,17 @@ BOOLEAN AttachObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pTargetObj, OBJECTTYP { if ( ubType == USE_ITEM_HARD ) { - // requires a skill check, and gives experience + // requires a skill check, and gives experience iCheckResult = SkillCheck( pSoldier, ATTACHING_SPECIAL_ITEM_CHECK, -30 ); if (iCheckResult < 0) { // could have a chance of detonation // for now, damage both objects - DamageObj( pTargetObj, (INT8) -iCheckResult ); + DamageObj( this, (INT8) -iCheckResult ); DamageObj( pAttachment, (INT8) -iCheckResult ); - DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); return( FALSE ); - } + } StatChange( pSoldier, MECHANAMT, 25, FALSE ); StatChange( pSoldier, WISDOMAMT, 5, FALSE ); } @@ -3495,42 +3728,23 @@ BOOLEAN AttachObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pTargetObj, OBJECTTYP //Madd: note that use_item cannot produce two different items!!! so it doesn't use usResult2 //Madd: unload guns after merge if ammo caliber or mag size don't match - if ( Item[pTargetObj->usItem].usItemClass == IC_GUN && pTargetObj->ItemData.Gun.usGunAmmoItem != NONE && pTargetObj->ItemData.Gun.ubGunShotsLeft > 0 ) + if ( Item[this->usItem].usItemClass == IC_GUN && (*this)[0]->data.gun.usGunAmmoItem != NONE && (*this)[0]->data.gun.ubGunShotsLeft > 0 ) { - if ( Item[usResult].usItemClass != IC_GUN || Weapon[Item[usResult].ubClassIndex].ubCalibre != Weapon[Item[pTargetObj->usItem].ubClassIndex].ubCalibre || pTargetObj->ItemData.Gun.ubGunShotsLeft > Weapon[Item[usResult].ubClassIndex].ubMagSize ) + if ( Item[usResult].usItemClass != IC_GUN || Weapon[Item[usResult].ubClassIndex].ubCalibre != Weapon[Item[this->usItem].ubClassIndex].ubCalibre || (*this)[0]->data.gun.ubGunShotsLeft > Weapon[Item[usResult].ubClassIndex].ubMagSize ) { // item types/calibers/magazines don't match, spit out old ammo - UnloadGun( pSoldier, pTargetObj); + EjectAmmoAndPlace(pSoldier, this); } } - //Madd: remove any prohibited attachments - for (bAttachPos = 0; bAttachPos < MAX_ATTACHMENTS; bAttachPos++) - { - if (pTargetObj->usAttachItem[ bAttachPos ] != NOTHING && !ValidAttachment(pTargetObj->usAttachItem[ bAttachPos ],usResult) && !ValidLaunchable(pTargetObj->usAttachItem[ bAttachPos ],usResult) ) - { - if ( !Item[pTargetObj->usAttachItem[ bAttachPos ]].inseparable ) - {//remove it - OBJECTTYPE newObj; - RemoveAttachment(pTargetObj,bAttachPos,&newObj); - if ( !AutoPlaceObject( pSoldier, &newObj, FALSE ) ) - { // put it on the ground - AddItemToPool( pSoldier->sGridNo, &newObj, 1, pSoldier->bLevel, 0 , -1 ); - } - } - else - {//destroy it - pTargetObj->usAttachItem[bAttachPos] = NOTHING; - pTargetObj->bAttachStatus[bAttachPos] = 0; - } - } - } + RemoveProhibitedAttachments(pSoldier, this, usResult); - pTargetObj->usItem = usResult; + this->usItem = usResult; //AutoPlaceObject( pAttachment ); - pTargetObj->ubWeight = CalculateObjectWeight( pTargetObj ); + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //this->ubWeight = CalculateObjectWeight( this ); if (pSoldier->bTeam == gbPlayerNum) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_COOL1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_COOL1 ); } ApplyEquipmentBonuses(pSoldier); return TRUE; @@ -3539,75 +3753,86 @@ BOOLEAN AttachObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pTargetObj, OBJECTTYP return FALSE; case COMBINE_POINTS: // transfer points... - if ( Item[ pTargetObj->usItem ].usItemClass == IC_AMMO ) + UINT32 combinedAmount; + UINT32 attachmentAmount; + //CHRISL: Treat differently if we're combining money items (other then MONEY) + if(Item[this->usItem].usItemClass != IC_MONEY) { - ubLimit = Magazine[ Item[ pTargetObj->usItem ].ubClassIndex ].ubMagSize; + if ( Item[ this->usItem ].usItemClass == IC_AMMO ) + { + ubLimit = Magazine[ Item[ this->usItem ].ubClassIndex ].ubMagSize; + } + else + { + ubLimit = 100; + } + + // count down through # of attaching items and add to status of item in position 0 + for (bLoop = 0; bLoop < pAttachment->ubNumberOfObjects; ) + { + //ADB need to watch for overflow here (thus UINT32), and need to cast to UINT8 before adding + combinedAmount = (UINT16)(*this)[subObject]->data.objectStatus + (UINT16)(*pAttachment)[0]->data.objectStatus; + if (combinedAmount <= ubLimit) + { + // consume this one totally and continue + (*this)[subObject]->data.objectStatus = combinedAmount; + pAttachment->RemoveObjectsFromStack(1); + } + else + { + // add part of this one and then we're done + attachmentAmount = (UINT16)(*pAttachment)[0]->data.objectStatus; + attachmentAmount -= (ubLimit - (UINT16)(*this)[subObject]->data.objectStatus); + (*pAttachment)[0]->data.objectStatus = attachmentAmount; + if ((*pAttachment)[0]->data.ubShotsLeft == 0) { + pAttachment->RemoveObjectsFromStack(1); + } + (*this)[subObject]->data.ubShotsLeft = ubLimit; + break; + } + } } else { - ubLimit = 100; - } - - // count down through # of attaching items and add to status of item in position 0 - for (bLoop = pAttachment->ubNumberOfObjects - 1; bLoop >= 0; bLoop--) - { - if ( Item[ pTargetObj->usItem ].usItemClass == IC_AMMO ) + ubLimit = MAX_MONEY_PER_SLOT; + combinedAmount = (*this)[subObject]->data.money.uiMoneyAmount + (*pAttachment)[0]->data.money.uiMoneyAmount; + if (combinedAmount <= ubLimit) { - // Cast to a bigger int to prevent overflow - UINT32 uiTotal = pTargetObj->ItemData.Ammo.ubShotsLeft[0] + pAttachment->ItemData.Ammo.ubShotsLeft[bLoop]; - if ( uiTotal <= ubLimit) - { - // consume this one totally and continue - pTargetObj->ItemData.Ammo.ubShotsLeft[0] = (UINT8) uiTotal; - RemoveObjFrom( pAttachment, bLoop ); - // reset loop limit - bLoop = pAttachment->ubNumberOfObjects; // add 1 to counteract the -1 from the loop - } - else - { - // add part of this one and then we're done - pAttachment->ItemData.Ammo.ubShotsLeft[bLoop] = (UINT8) (uiTotal - ubLimit); - pTargetObj->ItemData.Ammo.ubShotsLeft[0] = ubLimit; - break; - } - } + (*this)[subObject]->data.money.uiMoneyAmount = combinedAmount; + pAttachment->RemoveObjectsFromStack(1); + } else { - // Cast to a bigger int to prevent overflow - INT32 iTotal = pTargetObj->ItemData.Generic.bStatus[0] + pAttachment->ItemData.Generic.bStatus[bLoop]; - if ( iTotal <= ubLimit) + attachmentAmount = (*pAttachment)[0]->data.money.uiMoneyAmount; + attachmentAmount -= (ubLimit - (*this)[subObject]->data.money.uiMoneyAmount); + (*pAttachment)[0]->data.money.uiMoneyAmount = attachmentAmount; + if((*pAttachment)[0]->data.money.uiMoneyAmount == 0) { - // consume this one totally and continue - pTargetObj->ItemData.Generic.bStatus[0] = (INT8) iTotal; - RemoveObjFrom( pAttachment, bLoop ); - // reset loop limit - bLoop = pAttachment->ubNumberOfObjects; // add 1 to counteract the -1 from the loop - } - else - { - // add part of this one and then we're done - pAttachment->ItemData.Generic.bStatus[bLoop] = (INT8) (iTotal - ubLimit); - pTargetObj->ItemData.Generic.bStatus[0] = (INT8) ubLimit; - break; + pAttachment->RemoveObjectsFromStack(1); } + (*this)[subObject]->data.money.uiMoneyAmount = ubLimit; + break; } } break; case DESTRUCTION: // the merge destroyed both items! - DeleteObj( pTargetObj ); - DeleteObj( pAttachment ); - DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 ); + this->RemoveObjectsFromStack(1); + pAttachment->RemoveObjectsFromStack(1); + if ( pSoldier ) + { + pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); + } break; case ELECTRONIC_MERGE: - if ( pSoldier ) + if ( pSoldier ) { iCheckResult = SkillCheck( pSoldier, ATTACHING_SPECIAL_ELECTRONIC_ITEM_CHECK, -30 ); if ( iCheckResult < 0 ) { - DamageObj( pTargetObj, (INT8) -iCheckResult ); + DamageObj( this, (INT8) -iCheckResult ); DamageObj( pAttachment, (INT8) -iCheckResult ); - DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); return( FALSE ); } // grant experience! @@ -3618,17 +3843,17 @@ BOOLEAN AttachObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pTargetObj, OBJECTTYP { if (pSoldier) { - // requires a skill check, and gives experience + // requires a skill check, and gives experience iCheckResult = SkillCheck( pSoldier, ATTACHING_DETONATOR_CHECK, -30 ); if (iCheckResult < 0) { // could have a chance of detonation // for now, damage both objects - DamageObj( pTargetObj, (INT8) -iCheckResult ); + DamageObj( this, (INT8) -iCheckResult ); DamageObj( pAttachment, (INT8) -iCheckResult ); - DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); return( FALSE ); - } + } StatChange( pSoldier, EXPLODEAMT, 25, FALSE ); StatChange( pSoldier, WISDOMAMT, 5, FALSE ); } @@ -3636,97 +3861,57 @@ BOOLEAN AttachObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pTargetObj, OBJECTTYP // fall through default: // the merge will combine the two items - //Madd: usResult2 only works for standard merges -> item1 + item2 = item3 + item4 + //Madd: usResult2 only works for standard merges->item1 + item2 = item3 + item4 //Madd: unload guns after merge if ammo caliber or mag size don't match - if ( Item[pTargetObj->usItem].usItemClass == IC_GUN && pTargetObj->ItemData.Gun.usGunAmmoItem != NONE && pTargetObj->ItemData.Gun.ubGunShotsLeft > 0 ) + if ( Item[this->usItem].usItemClass == IC_GUN && (*this)[subObject]->data.gun.usGunAmmoItem != NONE && (*this)[subObject]->data.gun.ubGunShotsLeft > 0 ) { - if ( Item[usResult].usItemClass != IC_GUN || Weapon[Item[usResult].ubClassIndex].ubCalibre != Weapon[Item[pTargetObj->usItem].ubClassIndex].ubCalibre || pTargetObj->ItemData.Gun.ubGunShotsLeft > Weapon[Item[usResult].ubClassIndex].ubMagSize ) + if ( Item[usResult].usItemClass != IC_GUN || Weapon[Item[usResult].ubClassIndex].ubCalibre != Weapon[Item[this->usItem].ubClassIndex].ubCalibre || (*this)[subObject]->data.gun.ubGunShotsLeft > Weapon[Item[usResult].ubClassIndex].ubMagSize ) { // item types/calibers/magazines don't match, spit out old ammo - UnloadGun( pSoldier, pTargetObj); + EjectAmmoAndPlace(pSoldier, this); } } - //Madd: remove any prohibited attachments - for (bAttachPos = 0; bAttachPos < MAX_ATTACHMENTS; bAttachPos++) - { - if (pTargetObj->usAttachItem[ bAttachPos ] != NOTHING && !ValidAttachment(pTargetObj->usAttachItem[ bAttachPos ],usResult) && !ValidLaunchable(pTargetObj->usAttachItem[ bAttachPos ],usResult) ) - { - if ( !Item[pTargetObj->usAttachItem[ bAttachPos ]].inseparable ) - {//remove it - OBJECTTYPE newObj; - RemoveAttachment(pTargetObj,bAttachPos,&newObj); - if ( !AutoPlaceObject( pSoldier, &newObj, FALSE ) ) - { // put it on the ground - AddItemToPool( pSoldier->sGridNo, &newObj, 1, pSoldier->bLevel, 0 , -1 ); - } - } - else - {//destroy it - pTargetObj->usAttachItem[bAttachPos] = NOTHING; - pTargetObj->bAttachStatus[bAttachPos] = 0; - } - } - } + RemoveProhibitedAttachments(pSoldier, this, usResult); - pTargetObj->usItem = usResult; + this->usItem = usResult; if ( ubType != TREAT_ARMOUR ) { - pTargetObj->ItemData.Generic.bStatus[0] = (pTargetObj->ItemData.Generic.bStatus[0] + pAttachment->ItemData.Generic.bStatus[0]) / 2; + (*this)[subObject]->data.objectStatus = ((*this)[subObject]->data.objectStatus + (*pAttachment)[0]->data.objectStatus) / 2; } - pTargetObj->ubWeight = CalculateObjectWeight( pTargetObj ); + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //this->ubWeight = CalculateObjectWeight( this ); if ( usResult2 != NOTHING ) { //Madd: usResult2 is what the original attachment/source item turns into //Madd: unload guns after merge if ammo caliber or mag size don't match - if ( Item[pAttachment->usItem].usItemClass == IC_GUN && pAttachment->ItemData.Gun.usGunAmmoItem != NONE && pAttachment->ItemData.Gun.ubGunShotsLeft > 0 ) + if ( Item[pAttachment->usItem].usItemClass == IC_GUN && (*pAttachment)[0]->data.gun.usGunAmmoItem != NONE && (*pAttachment)[0]->data.gun.ubGunShotsLeft > 0 ) { - if ( Item[usResult2].usItemClass != IC_GUN || Weapon[Item[usResult2].ubClassIndex].ubCalibre != Weapon[Item[pAttachment->usItem].ubClassIndex].ubCalibre || pAttachment->ItemData.Gun.ubGunShotsLeft > Weapon[Item[usResult2].ubClassIndex].ubMagSize ) + if ( Item[usResult2].usItemClass != IC_GUN || Weapon[Item[usResult2].ubClassIndex].ubCalibre != Weapon[Item[pAttachment->usItem].ubClassIndex].ubCalibre || (*pAttachment)[0]->data.gun.ubGunShotsLeft > Weapon[Item[usResult2].ubClassIndex].ubMagSize ) { // item types/calibers/magazines don't match, spit out old ammo - UnloadGun( pSoldier, pAttachment); + EjectAmmoAndPlace(pSoldier, pAttachment); } } - //Madd: remove any prohibited attachments - for (bAttachPos = 0; bAttachPos < MAX_ATTACHMENTS; bAttachPos++) - { - if (pAttachment->usAttachItem[ bAttachPos ] != NOTHING && !ValidAttachment(pAttachment->usAttachItem[ bAttachPos ],usResult2) && !ValidLaunchable(pAttachment->usAttachItem[ bAttachPos ],usResult2) ) - { - if ( !Item[pAttachment->usAttachItem[ bAttachPos ]].inseparable ) - {//remove it - OBJECTTYPE newObj; - RemoveAttachment(pAttachment,bAttachPos,&newObj); - if ( !AutoPlaceObject( pSoldier, &newObj, FALSE ) ) - { // put it on the ground - AddItemToPool( pSoldier->sGridNo, &newObj, 1, pSoldier->bLevel, 0 , -1 ); - } - } - else - {//destroy it - pAttachment->usAttachItem[bAttachPos] = NOTHING; - pAttachment->bAttachStatus[bAttachPos] = 0; - } - } - } - - + RemoveProhibitedAttachments(pSoldier, pAttachment, usResult2); pAttachment->usItem = usResult2; if ( ubType != TREAT_ARMOUR ) { - pAttachment->ItemData.Generic.bStatus[0] = (pAttachment->ItemData.Generic.bStatus[0] + pTargetObj->ItemData.Generic.bStatus[0]) / 2; + (*pAttachment)[0]->data.objectStatus = ((*pAttachment)[0]->data.objectStatus + (*this)[subObject]->data.objectStatus) / 2; } - pAttachment->ubWeight = CalculateObjectWeight( pAttachment ); + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //pAttachment->ubWeight = CalculateObjectWeight( pAttachment ); } - else - DeleteObj( pAttachment ); + else + pAttachment->RemoveObjectsFromStack(1); if (pSoldier && pSoldier->bTeam == gbPlayerNum) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_COOL1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_COOL1 ); } break; } @@ -3737,36 +3922,102 @@ BOOLEAN AttachObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pTargetObj, OBJECTTYP return( FALSE ); } +void RemoveProhibitedAttachments(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, UINT16 usItem) +{ + //Madd: remove any prohibited attachments + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if (!ValidAttachment(iter->usItem, usItem) && !ValidLaunchable(iter->usItem, usItem) ) + { + if ( !Item[iter->usItem].inseparable ) + { + if (pSoldier) { + if ( !AutoPlaceObject( pSoldier, &(*iter), FALSE ) ) + { // put it on the ground + AddItemToPool( pSoldier->sGridNo, &(*iter), 1, pSoldier->pathing.bLevel, 0 , -1 ); + } + } + } + pObj->RemoveAttachment(&(*iter)); + iter = (*pObj)[0]->attachments.begin(); + } + } + return; +} + +void EjectAmmoAndPlace(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj) +{ + CreateAmmo((*pObj)[0]->data.gun.usGunAmmoItem, &gTempObject, (*pObj)[0]->data.gun.ubGunShotsLeft); + (*pObj)[0]->data.gun.ubGunShotsLeft = 0; + (*pObj)[0]->data.gun.usGunAmmoItem = NONE; + if ( pSoldier ) + { + if ( !AutoPlaceObject( pSoldier, &gTempObject, FALSE ) ) + { // put it on the ground + AddItemToPool( pSoldier->sGridNo, &gTempObject, 1, pSoldier->pathing.bLevel, 0 , -1 ); + } + } + return; +} + +/* CHRISL: This function is edited to handle the new inventory system when we have an item in our cursor. +Not only do we have to hatch out pockets that the item won't fit in, we also have to hatch out pockets that +our current LBE gear haven't activated. We'll also need to display the number of items of the type currently +held in the cursor that each active pocket can hold.*/ +extern BOOLEAN CompatibleAmmoForGun( OBJECTTYPE *pTryObject, OBJECTTYPE *pTestObject ); +BOOLEAN CanItemFitInVehicle( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj, INT8 bPos, BOOLEAN fDoingPlacement ) +{ + if((UsingNewInventorySystem() == false) || !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE)) + return(FALSE); + if(!vehicleInv[bPos]) + return(FALSE); + + UINT8 ubSlotLimit; + ubSlotLimit = ItemSlotLimit( pObj, bPos, pSoldier ); + + if ( ubSlotLimit == 0 ) + return ( CompatibleAmmoForGun(pObj, &pSoldier->inv[bPos]) ); + + return( TRUE ); +} + BOOLEAN CanItemFitInPosition( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj, INT8 bPos, BOOLEAN fDoingPlacement ) { - UINT8 ubSlotLimit; - INT8 bNewPos; + UINT8 ubSlotLimit, lbePocket=1; + INT8 bNewPos=ITEM_NOT_FOUND; + UINT32 pRestrict=0; + + // CHRISL: Only check valid pockets + if((UsingNewInventorySystem() == false) && !oldInv[bPos]) + return(FALSE); + if((pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && UsingNewInventorySystem() == true) + return(CanItemFitInVehicle(pSoldier, pObj, bPos, fDoingPlacement)); + + ubSlotLimit = ItemSlotLimit( pObj, bPos, pSoldier ); switch( bPos ) { case SECONDHANDPOS: -// if (Item[pSoldier->inv[HANDPOS].usItem].fFlags & ITEM_TWO_HANDED) if (Item[pSoldier->inv[HANDPOS].usItem].twohanded ) { return( FALSE ); } break; case HANDPOS: -// if (Item[ pObj->usItem ].fFlags & ITEM_TWO_HANDED) if (Item[ pObj->usItem ].twohanded ) { - if (pSoldier->inv[HANDPOS].usItem != NOTHING && pSoldier->inv[SECONDHANDPOS].usItem != NOTHING) + if (pSoldier->inv[HANDPOS].exists() == true && pSoldier->inv[SECONDHANDPOS].exists() == true) { - // two items in hands; try moving the second one so we can swap - if (Item[pSoldier->inv[SECONDHANDPOS].usItem].ubPerPocket == 0) + // two items in hands; try moving the second one so we can swap + if (FitsInSmallPocket(&pSoldier->inv[SECONDHANDPOS]) == true) { - bNewPos = FindEmptySlotWithin( pSoldier, BIGPOCK1POS, BIGPOCK4POS ); + bNewPos = FindEmptySlotWithin( pSoldier, BIGPOCKSTART, NUM_INV_SLOTS ); } else { - bNewPos = FindEmptySlotWithin( pSoldier, BIGPOCK1POS, SMALLPOCK8POS ); + bNewPos = FindEmptySlotWithin( pSoldier, BIGPOCKSTART, MEDPOCKFINAL ); } + if (bNewPos == NO_SLOT) { // nowhere to put second item @@ -3775,9 +4026,8 @@ BOOLEAN CanItemFitInPosition( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj, INT8 bPos if ( fDoingPlacement ) { - // otherwise move it. - CopyObj( &(pSoldier->inv[SECONDHANDPOS]), &(pSoldier->inv[bNewPos]) ); - DeleteObj( &(pSoldier->inv[SECONDHANDPOS]) ); + // otherwise move it, forget about bNewPos! + PlaceInAnyPocket(pSoldier, &pSoldier->inv[SECONDHANDPOS], FALSE); } } } @@ -3795,19 +4045,19 @@ BOOLEAN CanItemFitInPosition( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj, INT8 bPos if (Armour[Item[pObj->usItem].ubClassIndex].ubArmourClass != ARMOURCLASS_VEST) { return( FALSE ); - } + } break; case HELMETPOS: if (Armour[Item[pObj->usItem].ubClassIndex].ubArmourClass != ARMOURCLASS_HELMET) { return( FALSE ); - } + } break; case LEGPOS: if (Armour[Item[pObj->usItem].ubClassIndex].ubArmourClass != ARMOURCLASS_LEGGINGS) { return( FALSE ); - } + } break; default: break; @@ -3819,44 +4069,236 @@ BOOLEAN CanItemFitInPosition( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj, INT8 bPos { return( FALSE ); } + break; + case VESTPOCKPOS: + if (Item[pObj->usItem].usItemClass != IC_LBEGEAR || LoadBearingEquipment[Item[pObj->usItem].ubClassIndex].lbeClass != VEST_PACK) + { + return( FALSE ); + } + break; + case LTHIGHPOCKPOS: + case RTHIGHPOCKPOS: + if (Item[pObj->usItem].usItemClass != IC_LBEGEAR || LoadBearingEquipment[Item[pObj->usItem].ubClassIndex].lbeClass != THIGH_PACK) + { + return( FALSE ); + } + break; + case CPACKPOCKPOS: + if (Item[pObj->usItem].usItemClass != IC_LBEGEAR || LoadBearingEquipment[Item[pObj->usItem].ubClassIndex].lbeClass != COMBAT_PACK) + { + return( FALSE ); + } + if(pSoldier->inv[BPACKPOCKPOS].exists() == true) + { + if(LoadBearingEquipment[Item[pSoldier->inv[BPACKPOCKPOS].usItem].ubClassIndex].lbeCombo != LoadBearingEquipment[Item[pObj->usItem].ubClassIndex].lbeCombo || + LoadBearingEquipment[Item[pSoldier->inv[BPACKPOCKPOS].usItem].ubClassIndex].lbeCombo == 0) + { + return( FALSE ); + } + } + break; + case BPACKPOCKPOS: + if (Item[pObj->usItem].usItemClass != IC_LBEGEAR || LoadBearingEquipment[Item[pObj->usItem].ubClassIndex].lbeClass != BACKPACK) + { + return( FALSE ); + } + // Removed backpack/gunsling restrictions + //if(pSoldier->inv[GUNSLINGPOCKPOS].exists() == true) + // return( FALSE ); + if(pSoldier->inv[CPACKPOCKPOS].exists() == true) + { + if(LoadBearingEquipment[Item[pSoldier->inv[CPACKPOCKPOS].usItem].ubClassIndex].lbeCombo != LoadBearingEquipment[Item[pObj->usItem].ubClassIndex].lbeCombo || + LoadBearingEquipment[Item[pSoldier->inv[CPACKPOCKPOS].usItem].ubClassIndex].lbeCombo == 0) + { + return( FALSE ); + } + } + break; + case GUNSLINGPOCKPOS: // Gun Sling + //if (Item[pObj->usItem].usItemClass != IC_GUN && Item[pObj->usItem].usItemClass != IC_BLADE && Item[pObj->usItem].usItemClass != IC_LAUNCHER) + if(pObj->usItem == MONEY) + return( FALSE ); + if(Item[pObj->usItem].usItemClass == IC_AMMO || Item[pObj->usItem].usItemClass == IC_GRENADE) + return(CompatibleAmmoForGun(pObj, &pSoldier->inv[GUNSLINGPOCKPOS]) || ValidAttachment(pObj->usItem, pSoldier->inv[GUNSLINGPOCKPOS].usItem) || ValidLaunchable(pObj->usItem, pSoldier->inv[GUNSLINGPOCKPOS].usItem)); + //recalc slot limit to exclude ItemSize attachment modifiers + ubSlotLimit = ItemSlotLimit( pObj, bPos, pSoldier, FALSE ); + // Removed backpack/gunsling restrictions + //if(pSoldier->inv[BPACKPOCKPOS].exists() == true) + // return(CompatibleAmmoForGun(pObj, &pSoldier->inv[GUNSLINGPOCKPOS])); + break; + case KNIFEPOCKPOS: // Knife sheath + if(pObj->usItem == MONEY) + return( FALSE ); + if (Item[pObj->usItem].usItemClass != IC_BLADE && Item[pObj->usItem].usItemClass != IC_THROWING_KNIFE ) + return(CompatibleAmmoForGun(pObj, &pSoldier->inv[KNIFEPOCKPOS]) || ValidAttachment(pObj->usItem, pSoldier->inv[KNIFEPOCKPOS].usItem) || ValidLaunchable(pObj->usItem, pSoldier->inv[KNIFEPOCKPOS].usItem)); + break; + // IC Pockets + case BIGPOCK1POS: + case BIGPOCK2POS: + case BIGPOCK3POS: + case BIGPOCK4POS: + case BIGPOCK5POS: + case BIGPOCK6POS: + case BIGPOCK7POS: + case MEDPOCK1POS: + case MEDPOCK2POS: + case MEDPOCK3POS: + case MEDPOCK4POS: + case SMALLPOCK2POS: + case SMALLPOCK3POS: + case SMALLPOCK4POS: + case SMALLPOCK5POS: + case SMALLPOCK6POS: + case SMALLPOCK7POS: + case SMALLPOCK8POS: + case SMALLPOCK9POS: + case SMALLPOCK10POS: + case SMALLPOCK11POS: + case SMALLPOCK12POS: + case SMALLPOCK13POS: + case SMALLPOCK14POS: + case SMALLPOCK15POS: + case SMALLPOCK16POS: + case SMALLPOCK17POS: + case SMALLPOCK18POS: + case SMALLPOCK19POS: + case SMALLPOCK20POS: + case SMALLPOCK21POS: + case SMALLPOCK22POS: + case SMALLPOCK23POS: + case SMALLPOCK24POS: + case SMALLPOCK25POS: + case SMALLPOCK26POS: + case SMALLPOCK27POS: + case SMALLPOCK28POS: + case SMALLPOCK29POS: + case SMALLPOCK30POS: + if((UsingNewInventorySystem() == true)) + { + if(icLBE[bPos] == BPACKPOCKPOS && (!(pSoldier->flags.ZipperFlag) || (pSoldier->flags.ZipperFlag && gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_STAND)) && (gTacticalStatus.uiFlags & INCOMBAT)) + return( FALSE ); + lbePocket = (pSoldier->inv[icLBE[bPos]].exists() == false) ? LoadBearingEquipment[Item[icDefault[bPos]].ubClassIndex].lbePocketIndex[icPocket[bPos]] : LoadBearingEquipment[Item[pSoldier->inv[icLBE[bPos]].usItem].ubClassIndex].lbePocketIndex[icPocket[bPos]]; + pRestrict = LBEPocketType[lbePocket].pRestriction; + if(pRestrict != 0) + if(pRestrict != Item[pObj->usItem].usItemClass) + lbePocket = 0; + } + break; default: break; } - ubSlotLimit = ItemSlotLimit( pObj->usItem, bPos ); - if (ubSlotLimit == 0 && bPos >= SMALLPOCK1POS ) + if((UsingNewInventorySystem() == false)) { - // doesn't fit! - return( FALSE ); + if (ubSlotLimit == 0 && bPos >= SMALLPOCKSTART ) + { + // doesn't fit! + return( FALSE ); + } + } + else + { + // CHRISL: lbePocket==0 means pocket disabled. ubSlotLimit==0 means pocket can't hold item + if ( lbePocket == 0 || ubSlotLimit == 0 ) + return ( CompatibleAmmoForGun(pObj, &pSoldier->inv[bPos]) || ValidAttachment(pObj->usItem, pSoldier->inv[bPos].usItem) || ValidLaunchable(pObj->usItem, pSoldier->inv[bPos].usItem) ); + + // CHRISL: Adjust parameters to include the new inventory system + if (ubSlotLimit == 0 && bPos >= BIGPOCKFINAL ) + return( CompatibleAmmoForGun(pObj, &pSoldier->inv[bPos]) || ValidAttachment(pObj->usItem, pSoldier->inv[bPos].usItem) || ValidLaunchable(pObj->usItem, pSoldier->inv[bPos].usItem) ); } return( TRUE ); } - -BOOLEAN DropObjIfThereIsRoom( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj ) +//CHRISL: Wrote this function to try and clean up possible problems relating to the 16bit change for ammo capacity +void CleanUpItemStats( OBJECTTYPE * pObj ) { - // try autoplacing item in bSlot elsewhere, then do a placement - BOOLEAN fAutoPlacedOld; + UINT16 magSize; - fAutoPlacedOld = AutoPlaceObject( pSoldier, &(pSoldier->inv[bPos]), FALSE ); - if ( fAutoPlacedOld ) + if(Item[pObj->usItem].usItemClass == IC_GUN) { - return( PlaceObject( pSoldier, bPos, pObj ) ); + magSize = GetMagSize(pObj); + if((*pObj)[0]->data.gun.ubGunShotsLeft > magSize) + { + (*pObj)[0]->data.gun.ubGunShotsLeft = magSize; + } + return; } - else + if(Item[pObj->usItem].usItemClass == IC_AMMO) { - return( FALSE ); + magSize = Magazine[Item[pObj->usItem].ubClassIndex].ubMagSize; + if((*pObj)[0]->data.ubShotsLeft > magSize) + { + (*pObj)[0]->data.ubShotsLeft = magSize; + } + return; } } +BOOLEAN FreeUpSlotIfPossibleThenPlaceObject( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj ) +{ + //this gets called if something doesn't fit in bPos, which can happen if something is there + //or if it simply doesn't fit, if it doesn't fit return false to prevent recursion + + // try autoplacing item in bSlot elsewhere, excluding the slot it came from, then do a placement + if ( pSoldier->inv[bPos].exists() == true && AutoPlaceObject( pSoldier, &(pSoldier->inv[bPos]), FALSE , bPos) ) + { + //the old object has been placed somewhere, it's safe to place this one + return( PlaceObject( pSoldier, bPos, pObj ) ); + } + return( FALSE ); +} + +// CHRISL: Use to find best pocket to store item in. Could probably be merged with FitsInSmallPocket +INT32 PickPocket(SOLDIERTYPE *pSoldier, UINT8 ppStart, UINT8 ppStop, UINT16 usItem, UINT8 iNumber, UINT8 * cap, int bExcludeSlot) +{ + UINT16 pIndex=0; + INT32 pocket=0; + UINT8 capacity=254; + + for(UINT32 uiPos=ppStart; uiPosinv[icLBE[uiPos]].exists() == false){ + pIndex=LoadBearingEquipment[Item[icDefault[uiPos]].ubClassIndex].lbePocketIndex[icPocket[uiPos]]; + } + else { + pIndex=LoadBearingEquipment[Item[pSoldier->inv[icLBE[uiPos]].usItem].ubClassIndex].lbePocketIndex[icPocket[uiPos]]; + } + // Here's were we get complicated. We should look for the smallest pocket all items can fit in + if(LBEPocketType[pIndex].ItemCapacityPerSize[Item[usItem].ItemSize] >= iNumber && + LBEPocketType[pIndex].ItemCapacityPerSize[Item[usItem].ItemSize] < capacity && + pSoldier->inv[uiPos].exists() == false && uiPos != bExcludeSlot) { + if((LBEPocketType[pIndex].pRestriction != 0 && LBEPocketType[pIndex].pRestriction == Item[usItem].usItemClass) || + LBEPocketType[pIndex].pRestriction == 0) { + capacity = LBEPocketType[pIndex].ItemCapacityPerSize[Item[usItem].ItemSize]; + pocket = uiPos; + } + } + } + if(pocket!=0){ + *cap=capacity; + return pocket; + } + else{ + *cap=254; + return -1; + } +} + +BOOLEAN PlaceObject( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj, BOOLEAN fNewItem ) +{ + if (PlaceObject(pSoldier, bPos, pObj) == TRUE) { + SetNewItem(pSoldier, bPos, fNewItem); + return TRUE; + } + return FALSE; +} BOOLEAN PlaceObject( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj ) { // returns object to have in hand after placement... same as original in the // case of error - UINT8 ubSlotLimit, ubNumberToDrop, ubLoop; + UINT8 ubSlotLimit; OBJECTTYPE * pInSlot; BOOLEAN fObjectWasRobotRemote = FALSE; @@ -3865,6 +4307,9 @@ BOOLEAN PlaceObject( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj ) fObjectWasRobotRemote = TRUE; } + //CHRISL: Failsafe to try and clean up ammo capacity problems + CleanUpItemStats(pObj); + if ( !CanItemFitInPosition( pSoldier, pObj, bPos, TRUE ) ) { return( FALSE ); @@ -3895,16 +4340,16 @@ BOOLEAN PlaceObject( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj ) } } - if ( Item[ pObj->usItem ].usItemClass == IC_KEY && pSoldier->uiStatusFlags & SOLDIER_PC ) + if ( Item[ pObj->usItem ].usItemClass == IC_KEY && pSoldier->flags.uiStatusFlags & SOLDIER_PC ) { - if ( KeyTable[ pObj->ItemData.Key.ubKeyID ].usDateFound == 0 ) + if ( KeyTable[ (*pObj)[0]->data.key.ubKeyID ].usDateFound == 0 ) { - KeyTable[ pObj->ItemData.Key.ubKeyID ].usDateFound = (UINT16) GetWorldDay(); - KeyTable[ pObj->ItemData.Key.ubKeyID ].usSectorFound = SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ); + KeyTable[ (*pObj)[0]->data.key.ubKeyID ].usDateFound = (UINT16) GetWorldDay(); + KeyTable[ (*pObj)[0]->data.key.ubKeyID ].usSectorFound = SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ); } } - // Lesh: bugfix - replacing weapon in auto with another weapon w/o auto-mode + // Lesh: bugfix - replacing weapon in auto with another weapon w/o auto-mode if (bPos == HANDPOS && Item[ pObj->usItem ].usItemClass == IC_GUN) { //Madd: added code for nosemiauto tag @@ -3923,280 +4368,579 @@ BOOLEAN PlaceObject( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj ) } // Lesh: end - ubSlotLimit = ItemSlotLimit( pObj->usItem, bPos ); pInSlot = &(pSoldier->inv[bPos]); - if (pInSlot->ubNumberOfObjects == 0) + //we are placing an object, how we handle this depends on what is in the slot already + if (pInSlot->exists() == false) { - // placement in an empty slot - ubNumberToDrop = pObj->ubNumberOfObjects; - - if (ubNumberToDrop > __max( ubSlotLimit, 1 ) ) - { - // drop as many as possible into pocket - ubNumberToDrop = __max( ubSlotLimit, 1 ); - } - - // could be wrong type of object for slot... need to check... - // but assuming it isn't - memcpy( pInSlot, pObj, sizeof( OBJECTTYPE ) ); -/* - //if we are in the shopkeeper interface - if( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) - { - memset( &gMoveingItem, 0, sizeof( INVENTORY_IN_SLOT ) ); - SetSkiCursor( CURSOR_NORMAL ); - } -*/ - - if (ubNumberToDrop != pObj->ubNumberOfObjects) - { - // in the InSlot copy, zero out all the objects we didn't drop - for (ubLoop = ubNumberToDrop; ubLoop < pObj->ubNumberOfObjects; ubLoop++) - { - pInSlot->ItemData.Generic.bStatus[ubLoop] = 0; - } - } - pInSlot->ubNumberOfObjects = ubNumberToDrop; - - // remove a like number of objects from pObj - RemoveObjs( pObj, ubNumberToDrop ); - if (pObj->ubNumberOfObjects == 0) + //if the object in the slot does not exist it is easy + pObj->MoveThisObjectTo(*pInSlot, ALL_OBJECTS, pSoldier, bPos); + if (pObj->exists() == false) { // dropped everything -// if (bPos == HANDPOS && Item[pInSlot->usItem].fFlags & ITEM_TWO_HANDED) if (bPos == HANDPOS && Item[pInSlot->usItem].twohanded ) { // We just performed a successful drop of a two-handed object into the // main hand - if (pSoldier->inv[SECONDHANDPOS].usItem != 0) + if (pSoldier->inv[SECONDHANDPOS].exists() == true) { // swap what WAS in the second hand into the cursor - SwapObjs( pSoldier, SECONDHANDPOS, pObj, TRUE); + pSoldier->inv[SECONDHANDPOS].MoveThisObjectTo(*pObj); } } } - } else { - // replacement/reloading/merging/stacking - // keys have an additional check for key ID being the same - if ( (pObj->usItem == pInSlot->usItem) && - ( Item[ pObj->usItem ].usItemClass != IC_KEY || pObj->ItemData.Key.ubKeyID == pInSlot->ItemData.Key.ubKeyID ) ) + // replacement/reloading/merging/stacking + //try to reload first + switch (Item[pInSlot->usItem].usItemClass) { - if (Item[ pObj->usItem ].usItemClass == IC_MONEY) - { - - UINT32 uiMoneyMax = MoneySlotLimit( bPos ); - - // always allow money to be combined! - // IGNORE STATUS! - - if (pInSlot->ItemData.Money.uiMoneyAmount + pObj->ItemData.Money.uiMoneyAmount > uiMoneyMax) + case IC_GUN: + if (Item[pObj->usItem].usItemClass == IC_AMMO) { - // remove X dollars - pObj->ItemData.Money.uiMoneyAmount -= (uiMoneyMax - pInSlot->ItemData.Money.uiMoneyAmount); - // set in slot to maximum - pInSlot->ItemData.Money.uiMoneyAmount = uiMoneyMax; - } - else - { - pInSlot->ItemData.Money.uiMoneyAmount += pObj->ItemData.Money.uiMoneyAmount; - DeleteObj( pObj ); -/* - if( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) + if (Weapon[pInSlot->usItem].ubCalibre == Magazine[Item[pObj->usItem].ubClassIndex].ubCalibre) { - memset( &gMoveingItem, 0, sizeof( INVENTORY_IN_SLOT ) ); - SetSkiCursor( CURSOR_NORMAL ); - } -*/ - } - } - else if ( ubSlotLimit == 1 || (ubSlotLimit == 0 && bPos >= HANDPOS && bPos <= BIGPOCK4POS ) ) - { - if (pObj->ubNumberOfObjects <= 1) - { - // swapping - SwapObjs( pSoldier, bPos, pObj, TRUE); - } - else - { - return( DropObjIfThereIsRoom( pSoldier, bPos, pObj ) ); - } - } - else if (ubSlotLimit == 0) // trying to drop into a small pocket - { - return( DropObjIfThereIsRoom( pSoldier, bPos, pObj ) ); - } - else - { - // stacking - ubNumberToDrop = ubSlotLimit - pInSlot->ubNumberOfObjects; - if (ubNumberToDrop > pObj->ubNumberOfObjects) - { - ubNumberToDrop = pObj->ubNumberOfObjects; - } - StackObjs( pObj, pInSlot, ubNumberToDrop ); - } - } - else - { - // replacement, unless reloading... - switch (Item[pInSlot->usItem].usItemClass) - { - case IC_GUN: - if (Item[pObj->usItem].usItemClass == IC_AMMO) - { - if (Weapon[pInSlot->usItem].ubCalibre == Magazine[Item[pObj->usItem].ubClassIndex].ubCalibre) + //CHRISL: Work differently with ammo crates but only when not in combat + if(Item[pObj->usItem].ammocrate == TRUE) { - // reload... - return( ReloadGun( pSoldier, pInSlot, pObj ) ); + if(!(gTacticalStatus.uiFlags & INCOMBAT)) + { + INT16 magSize, ubShotsLeft; + OBJECTTYPE tempClip; + OBJECTTYPE tempStack; + bool clipCreated; + UINT32 newItem = 0; + INT32 pocket=-1; + UINT8 capacity=0; + UINT8 bLoop; + //find the ammo item we want to try and create + for(int loop = 0; loop < MAXITEMS; loop++) + { + if(Item[loop].usItemClass == IC_AMMO) + { + if(Magazine[Item[loop].ubClassIndex].ubCalibre == Weapon[pInSlot->usItem].ubCalibre && Magazine[Item[loop].ubClassIndex].ubAmmoType == Magazine[Item[pObj->usItem].ubClassIndex].ubAmmoType && Magazine[Item[loop].ubClassIndex].ubMagSize == GetMagSize(pInSlot)) + newItem = loop; + } + } + //Create a stack of up to 5 "newItem" clips + tempStack.initialize(); + clipCreated = false; + ubShotsLeft = (*pObj)[0]->data.ubShotsLeft; + for(UINT8 clip = 0; clip < 5; clip++) + { + magSize = GetMagSize(pInSlot); + if(ubShotsLeft < magSize) + magSize = ubShotsLeft; + if(CreateAmmo(newItem, &tempClip, magSize)) + { + tempStack.AddObjectsToStack(tempClip, -1, pSoldier, NUM_INV_SLOTS, MAX_OBJECTS_PER_SLOT); + ubShotsLeft -= magSize; + clipCreated = true; + if(ubShotsLeft < 1) + break; + } + } + //Try to place the stack somewhere on the active merc + if(clipCreated == true) + { + clipCreated = false; + bLoop = tempStack.ubNumberOfObjects; + while(tempStack.ubNumberOfObjects > 0) + { + pocket = PickPocket(pSoldier, BIGPOCKSTART, SMALLPOCKFINAL, tempStack.usItem, bLoop, &capacity, -1); + if(pocket != -1) + { + pSoldier->inv[pocket].AddObjectsToStack(tempStack, bLoop, pSoldier, pocket); + } + else + { + bLoop--; + } + if(bLoop < 1) + break; + } + if(tempStack.ubNumberOfObjects < 1) + clipCreated = true; + else + { + //Try to place stack on ground + if(guiCurrentScreen == MAP_SCREEN && fShowMapInventoryPool == TRUE) + { + if(AutoPlaceObjectInInventoryStash(&tempStack, pSoldier->sGridNo)) + clipCreated = true; + } + else + { + if(AddItemToPool(pSoldier->sGridNo, &tempStack, 1, pSoldier->pathing.bLevel, WORLD_ITEM_REACHABLE, -1)) + { + NotifySoldiersToLookforItems( ); + clipCreated = true; + } + } + } + } + if(clipCreated == true) + { + (*pObj)[0]->data.ubShotsLeft = ubShotsLeft; + } + if((*pObj)[0]->data.ubShotsLeft < 1) + pObj->RemoveObjectsFromStack(1); + return( TRUE ); + } + else + { + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMapInventoryErrorString[6] ); + return( FALSE ); + } } else - { - // invalid ammo - break; - //return( FALSE ); - } - } - break; - case IC_LAUNCHER: - { - if ( ValidLaunchable( pObj->usItem, pInSlot->usItem ) ) - { - // reload... - return( ReloadGun( pSoldier, pInSlot, pObj ) ); + return( ReloadGun( pSoldier, pInSlot, pObj ) ); } } break; + case IC_LAUNCHER: + if ( ValidLaunchable( pObj->usItem, pInSlot->usItem ) ) { + return( ReloadGun( pSoldier, pInSlot, pObj ) ); + } + break; } + //if we didn't reload, then we know we are stacking or swapping! -// if ( (Item[pObj->usItem].fFlags & ITEM_TWO_HANDED) && (bPos == HANDPOS) ) - if ( (Item[pObj->usItem].twohanded ) && (bPos == HANDPOS) ) + if (IsSlotASmallPocket(bPos) == true && FitsInSmallPocket(pObj) == false) { + //there is nothing we can do, just return + return FALSE; + } + + // CHRISL: When holding ammo and clicking on an appropriate ammo crate, add ammo to crate + if(Item[pInSlot->usItem].ammocrate == TRUE && Item[pObj->usItem].usItemClass == IC_AMMO) + { + if(Magazine[Item[pInSlot->usItem].ubClassIndex].ubCalibre == Magazine[Item[pObj->usItem].ubClassIndex].ubCalibre && + Magazine[Item[pInSlot->usItem].ubClassIndex].ubAmmoType == Magazine[Item[pObj->usItem].ubClassIndex].ubAmmoType) { - if (pSoldier->inv[SECONDHANDPOS].usItem != 0) + UINT16 magSpace = Magazine[Item[pInSlot->usItem].ubClassIndex].ubMagSize-(*pInSlot)[0]->data.ubShotsLeft; + while(pObj->ubNumberOfObjects > 0) { - // both pockets have something in them, so we can't swap + if(magSpace >= (*pObj)[0]->data.ubShotsLeft) + { + magSpace -= (*pObj)[0]->data.ubShotsLeft; + (*pInSlot)[0]->data.ubShotsLeft += (*pObj)[0]->data.ubShotsLeft; + pObj->RemoveObjectsFromStack(1); + } + else + { + (*pObj)[0]->data.ubShotsLeft -= magSpace; + (*pInSlot)[0]->data.ubShotsLeft += magSpace; + break; + } + } + if(pObj->ubNumberOfObjects > 0) return( FALSE ); - } else - { - SwapObjs( pSoldier, bPos, pObj, TRUE ); - } + return( TRUE ); } - else if (pObj->ubNumberOfObjects <= __max( ubSlotLimit, 1 ) ) - { - // swapping - SwapObjs( pSoldier, bPos, pObj, TRUE ); - } - else - { - return( DropObjIfThereIsRoom( pSoldier, bPos, pObj ) ); + } + + // CHRISL: + ubSlotLimit = ItemSlotLimit( pObj, bPos, pSoldier ); + if (ubSlotLimit == 0) + { + //we have tried to stack but the stack is full, or we have tried to swap but the slot is wrong + return( FreeUpSlotIfPossibleThenPlaceObject( pSoldier, bPos, pObj ) ); } + + if ( pObj->usItem == pInSlot->usItem && ubSlotLimit > 1 && IsSlotAnLBESlot(bPos) == false ) + { + //we have tried to stack, but remember we can't stack 2 LBEs into 1 LBE slot, they get swapped instead + pInSlot->AddObjectsToStack( *pObj, ALL_OBJECTS, pSoldier, bPos ); + } + + else if ( (Item[pObj->usItem].twohanded ) && (bPos == HANDPOS) ) + { + if (pSoldier->inv[SECONDHANDPOS].exists() == true) { + // both pockets have something in them, so we can't swap + return( FALSE ); + } + else { + //we swapped a 2 handed object into the main hand + SwapObjs( pObj, pInSlot ); + } + } + + else if (IsSlotAnLBESlot(bPos) == true && Item[pObj->usItem].usItemClass == IC_LBEGEAR) + { + /*CHRISL: If we're trying to swap LBE items between IC pockets, we have to be careful that items are moved + into active pockets or that an LBENODE is properly created.*/ + if(pObj->HasAnyActiveLBEs(pSoldier) == false && !(_KeyDown(SHIFT))){ + std::vector LBESlots; + GetLBESlots(bPos, LBESlots); + MoveItemsToActivePockets(pSoldier, LBESlots, bPos, pObj); + } + pInSlot->MoveThisObjectTo(gTempObject, -1, pSoldier, bPos); + pObj->MoveThisObjectTo(*pInSlot, -1, pSoldier, bPos); + gTempObject.MoveThisObjectTo(*pObj, -1); + } + + else if (ubSlotLimit < pObj->ubNumberOfObjects) + { + //not enough room, so we free up some space + return( FreeUpSlotIfPossibleThenPlaceObject( pSoldier, bPos, pObj ) ); + } + + else + { + //item fits here, swapping + SwapObjs( pObj, pInSlot ); } } // ATE: Put this in to see if we should update the robot, if we were given a controller... if ( pSoldier->bTeam == gbPlayerNum && fObjectWasRobotRemote ) { - UpdateRobotControllerGivenController( pSoldier ); + pSoldier->UpdateRobotControllerGivenController( ); } - + ApplyEquipmentBonuses(pSoldier); //Pulmu bugfix - pInSlot->ubWeight = CalculateObjectWeight(pInSlot); + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //pInSlot->ubWeight = CalculateObjectWeight(pInSlot); //Pulmu end return( TRUE ); } -BOOLEAN InternalAutoPlaceObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN fNewItem, INT8 bExcludeSlot ) +bool TryToStackInSlot(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, int bSlot) +{ + // CHRISL: Use new ItemSlotLimit function if we're using the new inventory system + if (pSoldier->inv[bSlot].usItem == pObj->usItem && pSoldier->inv[bSlot].exists() == true) + { + if (pSoldier->inv[bSlot].ubNumberOfObjects < ItemSlotLimit( pObj, bSlot, pSoldier ) ) + { + // NEW: If in SKI, don't auto-PLACE anything into a stackable slot that's currently hatched out! Such slots + // will disappear in their entirety if sold/moved, causing anything added through here to vanish also! + if( !( ( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) && ShouldSoldierDisplayHatchOnItem( pSoldier->ubProfile, bSlot ) ) ) + { + pSoldier->inv[bSlot].AddObjectsToStack(*pObj, -1, pSoldier, bSlot); + if (pObj->exists() == false) { + return true; + } + } + } + } + return false; +} + +bool TryToPlaceInSlot(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, bool fNewItem, int& bSlot, int endSlot) +{ + //bSlot = FindEmptySlotWithin( pSoldier, bSlot, endSlot ); + //CHRISL: If something already exists, we want to fail since we can't place an object in this slot + if (CanItemFitInPosition(pSoldier, pObj, bSlot, false) == false || pSoldier->inv[bSlot].exists() == true) { + //bSlot = endSlot; + return false; + } + + if (bSlot == ITEM_NOT_FOUND) { + bSlot = endSlot; + return false; + } + + if (bSlot == SECONDHANDPOS) { + if (pSoldier->inv[HANDPOS].exists() == true) { + return false; + } + } + + PlaceObject( pSoldier, bSlot, pObj, fNewItem ); + if (pObj->exists() == false) { + return( true ); + } + return false; +} + +bool PlaceInAnySlot(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, bool fNewItem, int bExcludeSlot) +{ + //first, try to STACK the item + //try to STACK in any slot + for(int bSlot = BODYPOSSTART; bSlot < BIGPOCKSTART; bSlot++) { + if (bSlot != bExcludeSlot && TryToStackInSlot(pSoldier, pObj, bSlot) == true) { + return true; + } + } + + if (FitsInSmallPocket(pObj) == true) { + //try to STACK in small pockets + for(int bSlot = SMALLPOCKSTART; bSlot < SMALLPOCKFINAL; bSlot++) { + if (bSlot != bExcludeSlot && TryToStackInSlot(pSoldier, pObj, bSlot) == true) { + return true; + } + } + } + + //try to STACK in big pockets, and possibly medium pockets + int bigPocketEnd = (UsingNewInventorySystem() == true) ? MEDPOCKFINAL : BIGPOCKFINAL; + for(int bSlot = BIGPOCKSTART; bSlot < bigPocketEnd; bSlot++) { + if (bSlot != bExcludeSlot && TryToStackInSlot(pSoldier, pObj, bSlot) == true) { + return true; + } + } + + //now try to PLACE + //try to PLACE in any body slot + for(int bSlot = BODYPOSSTART; bSlot < BIGPOCKSTART; bSlot++) { + if (bSlot != bExcludeSlot && TryToPlaceInSlot(pSoldier, pObj, fNewItem, bSlot, BODYPOSFINAL) == true) { + return true; + } + } + + if(UsingNewInventorySystem() == true) + { + //CHRISL: Rather then a simple slot search, use PickPocket to find the most appropriate pocket to use + INT32 sPocket=-1, mPocket=-1, lPocket=-1; + UINT8 sCapacity=0; + UINT8 mCapacity=0; + UINT8 lCapacity=0; + UINT8 capacity=0; + int bSlot; + //Start with active big pockets + sPocket=PickPocket(pSoldier, SMALLPOCKSTART, SMALLPOCKFINAL, pObj->usItem, pObj->ubNumberOfObjects, &sCapacity, bExcludeSlot); + //Next search active medium pockets + mPocket=PickPocket(pSoldier, MEDPOCKSTART, MEDPOCKFINAL, pObj->usItem, pObj->ubNumberOfObjects, &mCapacity, bExcludeSlot); + //Lastly search active small pockets + lPocket=PickPocket(pSoldier, BIGPOCKSTART, BIGPOCKFINAL, pObj->usItem, pObj->ubNumberOfObjects, &lCapacity, bExcludeSlot); + //Finally, compare the three pockets we've found and return the pocket that is most logical to use + capacity = min(sCapacity, mCapacity); + capacity = min(lCapacity, capacity); + if(capacity == 254) { //no pocket found + return false; + } + else if(capacity == sCapacity) { + bSlot = sPocket; + } + else if(capacity == mCapacity) { + bSlot = mPocket; + } + else if(capacity == lCapacity) { + bSlot = lPocket; + } + if(TryToPlaceInSlot(pSoldier, pObj, fNewItem, bSlot, NUM_INV_SLOTS) == true) + return true; + } + else + { + if (FitsInSmallPocket(pObj) == true) { + //try to PLACE in small pockets + for(int bSlot = SMALLPOCKSTART; bSlot < SMALLPOCKFINAL; bSlot++) { + if (bSlot != bExcludeSlot && TryToPlaceInSlot(pSoldier, pObj, fNewItem, bSlot, NUM_INV_SLOTS) == true) { + return true; + } + } + } + + //try to PLACE in big pockets, and possibly medium pockets + for(int bSlot = BIGPOCKSTART; bSlot < bigPocketEnd; bSlot++) { + if (bSlot != bExcludeSlot && TryToPlaceInSlot(pSoldier, pObj, fNewItem, bSlot, bigPocketEnd) == true) { + return true; + } + } + } + + return false; +} + +bool PlaceInAnyPocket(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, bool fNewItem, int bExcludeSlot) +{ + //first, try to STACK the item + if (FitsInSmallPocket(pObj) == true) { + //try to STACK in small pockets + for(int bSlot = SMALLPOCKSTART; bSlot < SMALLPOCKFINAL; bSlot++) { + if (bSlot != bExcludeSlot && TryToStackInSlot(pSoldier, pObj, bSlot) == true) { + return true; + } + } + } + + //try to STACK in big pockets, and possibly medium pockets + int bigPocketEnd = (UsingNewInventorySystem() == true) ? MEDPOCKFINAL : BIGPOCKFINAL; + for(int bSlot = BIGPOCKSTART; bSlot < bigPocketEnd; bSlot++) { + if (bSlot != bExcludeSlot && TryToStackInSlot(pSoldier, pObj, bSlot) == true) { + return true; + } + } + + + if (FitsInSmallPocket(pObj) == true) { + //try to PLACE in small pockets + for(int bSlot = SMALLPOCKSTART; bSlot < SMALLPOCKFINAL; bSlot++) { + if (bSlot != bExcludeSlot && TryToPlaceInSlot(pSoldier, pObj, fNewItem, bSlot, NUM_INV_SLOTS) == true) { + return true; + } + } + } + //try to PLACE in big pockets, and possibly medium pockets + for(int bSlot = BIGPOCKSTART; bSlot < bigPocketEnd; bSlot++) { + if (bSlot != bExcludeSlot && TryToPlaceInSlot(pSoldier, pObj, fNewItem, bSlot, bigPocketEnd) == true) { + return true; + } + } + return false; +} + +bool PlaceInAnyBigOrMediumPocket(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, bool fNewItem, int bExcludeSlot) +{ + //a special note, although some items do not fit in small pockets, and under the old system are restricted to big pockets, + //under the new system they are intended to fit in medium pockets, if the item size and the pocket agree + //An example would be a SMG fitting in a gun holster, which is medium. + int bigPocketEnd = (UsingNewInventorySystem() == true) ? MEDPOCKFINAL : BIGPOCKFINAL; + //first, try to STACK the item + for(int bSlot = BIGPOCKSTART; bSlot < bigPocketEnd; bSlot++) { + if (bSlot != bExcludeSlot && TryToStackInSlot(pSoldier, pObj, bSlot) == true) { + return true; + } + } + + //now try to PLACE + for(int bSlot = BIGPOCKSTART; bSlot < bigPocketEnd; bSlot++) { + if (bSlot != bExcludeSlot && TryToPlaceInSlot(pSoldier, pObj, fNewItem, bSlot, bigPocketEnd) == true) { + return true; + } + } + return false; +} + +bool PlaceInAnySmallPocket(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, bool fNewItem, int bExcludeSlot) +{ + if (FitsInSmallPocket(pObj) == false) { + return false; + } + + //first, try to STACK the item + for(int bSlot = SMALLPOCKSTART; bSlot < SMALLPOCKFINAL; bSlot++) { + if (bSlot != bExcludeSlot && TryToStackInSlot(pSoldier, pObj, bSlot) == true) { + return true; + } + } + + //try to PLACE in small pockets + for(int bSlot = SMALLPOCKSTART; bSlot < SMALLPOCKFINAL; bSlot++) { + if (bSlot != bExcludeSlot && TryToPlaceInSlot(pSoldier, pObj, fNewItem, bSlot, NUM_INV_SLOTS) == true) { + return true; + } + } + return false; +} + + +// CHRISL: Function needed for LBENODE +BOOLEAN AutoPlaceObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN fNewItem, INT8 bExcludeSlot ) { - INT8 bSlot; INVTYPE * pItem; - UINT8 ubPerSlot; + UINT8 packCombo, backCombo; // statuses of extra objects would be 0 if the # exceeds the maximum - Assert( pObj->ubNumberOfObjects <= MAX_OBJECTS_PER_SLOT); + //Assert( pObj->ubNumberOfObjects <= MAX_OBJECTS_PER_SLOT); //Pulmu bugfix - pObj->ubWeight = CalculateObjectWeight( pObj); + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //pObj->ubWeight = CalculateObjectWeight( pObj); pItem = &(Item[pObj->usItem]); - ubPerSlot = pItem->ubPerPocket; + int lbeClass; // Overrides to the standard system: put guns in hand, armour on body (if slot empty) switch (pItem->usItemClass) { case IC_GUN: + case IC_THROWING_KNIFE: case IC_BLADE: case IC_LAUNCHER: case IC_BOMB: case IC_GRENADE: -// if (!(pItem->fFlags & ITEM_TWO_HANDED)) - if (!(pItem->twohanded)) + if (pSoldier->inv[HANDPOS].exists() == false) { - if (pSoldier->inv[HANDPOS].usItem == NONE) + // put the one-handed weapon in the guy's hand... + PlaceObject( pSoldier, HANDPOS, pObj, fNewItem ); + if ( pObj->exists() == false ) { - // put the one-handed weapon in the guy's hand... - PlaceObject( pSoldier, HANDPOS, pObj ); - SetNewItem( pSoldier, HANDPOS, fNewItem ); - if ( pObj->ubNumberOfObjects == 0 ) - { - return( TRUE ); - } + return( TRUE ); } -// else if ( !(Item[pSoldier->inv[HANDPOS].usItem].fFlags & ITEM_TWO_HANDED) && pSoldier->inv[SECONDHANDPOS].usItem == NONE) - else if ( !(Item[pSoldier->inv[HANDPOS].usItem].twohanded ) && pSoldier->inv[SECONDHANDPOS].usItem == NONE) + } + else if ( !(Item[pSoldier->inv[HANDPOS].usItem].twohanded ) && pSoldier->inv[SECONDHANDPOS].exists() == false) + { + // put the one-handed weapon in the guy's 2nd hand... + PlaceObject( pSoldier, SECONDHANDPOS, pObj, fNewItem ); + if ( pObj->exists() == false ) { - // put the one-handed weapon in the guy's 2nd hand... - PlaceObject( pSoldier, SECONDHANDPOS, pObj ); - SetNewItem( pSoldier, SECONDHANDPOS, fNewItem ); - if ( pObj->ubNumberOfObjects == 0 ) - { - return( TRUE ); - } + return( TRUE ); } } // two-handed objects are best handled in the main loop for large objects, - // which checks the hands first anyhow + // which checks the hands first anyhow + //CHRISL: New switch. Place items into Gunsling or Knife pocket is using NewInv, item is appropriate, and we + // didn't manage to place in hands. + if(UsingNewInventorySystem() == true) + { + switch (pItem->usItemClass) + { + case IC_GUN: + if(pSoldier->inv[GUNSLINGPOCKPOS].exists() == false) // Long Gun use Gun Sling + { + PlaceObject( pSoldier, GUNSLINGPOCKPOS, pObj, fNewItem ); + if (pObj->exists() == false) + return( TRUE ); + } + break; + case IC_THROWING_KNIFE: + case IC_BLADE: + if(pSoldier->inv[KNIFEPOCKPOS].exists() == false) // Knife + { + PlaceObject( pSoldier, KNIFEPOCKPOS, pObj, fNewItem ); + if (pObj->exists() == false) + return( TRUE ); + } + break; + } + } break; - case IC_ARMOUR: switch (Armour[Item[pObj->usItem].ubClassIndex].ubArmourClass) { case ARMOURCLASS_VEST: - if (pSoldier->inv[VESTPOS].usItem == NONE) + if (pSoldier->inv[VESTPOS].exists() == false) { // put on the armour! - PlaceObject( pSoldier, VESTPOS, pObj ); - SetNewItem( pSoldier, VESTPOS, fNewItem ); - if ( pObj->ubNumberOfObjects == 0 ) + PlaceObject( pSoldier, VESTPOS, pObj, fNewItem ); + if ( pObj->exists() == false ) { return( TRUE ); } } break; case ARMOURCLASS_LEGGINGS: - if (pSoldier->inv[LEGPOS].usItem == NONE) + /* CHRISL: If we're wearing leg protectors and pick up leggings, we want to leggings to override. + This is only an issue during merc hiring when leggings will often be placed after leg protectors. + However, this isn't as big an issue at this point because of the redesigns in the profile item sorting + functions.*/ + if(Item[pSoldier->inv[LEGPOS].usItem].attachment) + { + SwapObjs(pSoldier, LEGPOS, pObj, TRUE); + pSoldier->inv[LEGPOS].AttachObject(pSoldier, pObj, FALSE); + } + if (pSoldier->inv[LEGPOS].exists() == false) { // put on the armour! - PlaceObject( pSoldier, LEGPOS, pObj ); - SetNewItem( pSoldier, LEGPOS, fNewItem ); - if ( pObj->ubNumberOfObjects == 0 ) - { - return( TRUE ); - } + PlaceObject( pSoldier, LEGPOS, pObj, fNewItem ); + } + if ( pObj->exists() == false ) + { + return( TRUE ); } break; case ARMOURCLASS_HELMET: - if (pSoldier->inv[HELMETPOS].usItem == NONE) + if (pSoldier->inv[HELMETPOS].exists() == false) { // put on the armour! - PlaceObject( pSoldier, HELMETPOS, pObj ); - SetNewItem( pSoldier, HELMETPOS, fNewItem ); - if ( pObj->ubNumberOfObjects == 0 ) + PlaceObject( pSoldier, HELMETPOS, pObj, fNewItem ); + if ( pObj->exists() == false ) { return( TRUE ); } @@ -4208,169 +4952,100 @@ BOOLEAN InternalAutoPlaceObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOL // otherwise stuff it in a slot somewhere break; case IC_FACE: - if ( (pSoldier->inv[HEAD1POS].usItem == NOTHING) && CompatibleFaceItem( pObj->usItem, pSoldier->inv[HEAD2POS].usItem ) ) + if ( (pSoldier->inv[HEAD1POS].exists() == false) && CompatibleFaceItem( pObj->usItem, pSoldier->inv[HEAD2POS].usItem ) ) { - PlaceObject( pSoldier, HEAD1POS, pObj ); - SetNewItem( pSoldier, HEAD1POS, fNewItem ); - if ( pObj->ubNumberOfObjects == 0 ) + PlaceObject( pSoldier, HEAD1POS, pObj, fNewItem ); + if ( pObj->exists() == false ) { return( TRUE ); } } - else if ( (pSoldier->inv[HEAD2POS].usItem == NOTHING) && CompatibleFaceItem( pObj->usItem, pSoldier->inv[HEAD1POS].usItem ) ) + else if ( (pSoldier->inv[HEAD2POS].exists() == false) && CompatibleFaceItem( pObj->usItem, pSoldier->inv[HEAD1POS].usItem ) ) { - PlaceObject( pSoldier, HEAD2POS, pObj ); - SetNewItem( pSoldier, HEAD2POS, fNewItem ); - if ( pObj->ubNumberOfObjects == 0 ) + PlaceObject( pSoldier, HEAD2POS, pObj, fNewItem ); + if ( pObj->exists() == false ) { return( TRUE ); } } break; + // CHRISL: + case IC_LBEGEAR: + if(UsingNewInventorySystem() == false) { + break; + } + lbeClass = LoadBearingEquipment[pItem->ubClassIndex].lbeClass; + if(lbeClass == THIGH_PACK) // Thigh pack + { + if (pSoldier->inv[LTHIGHPOCKPOS].exists() == false) { + PlaceObject( pSoldier, LTHIGHPOCKPOS, pObj, fNewItem ); + if(pObj->exists() == false) + return( TRUE ); + } + if (pSoldier->inv[RTHIGHPOCKPOS].exists() == false) { + PlaceObject( pSoldier, RTHIGHPOCKPOS, pObj, fNewItem ); + if(pObj->exists() == false) + return( TRUE ); + } + } + else if(pSoldier->inv[VESTPOCKPOS].exists() == false && lbeClass == VEST_PACK) // Vest pack + { + PlaceObject( pSoldier, VESTPOCKPOS, pObj, fNewItem ); + if(pObj->exists() == false) + return( TRUE ); + } + else if(pSoldier->inv[CPACKPOCKPOS].exists() == false && lbeClass == COMBAT_PACK) // Combat pack + { + packCombo = LoadBearingEquipment[pItem->ubClassIndex].lbeCombo; + backCombo = LoadBearingEquipment[Item[pSoldier->inv[BPACKPOCKPOS].usItem].ubClassIndex].lbeCombo; + if((pSoldier->inv[BPACKPOCKPOS].exists() == true && packCombo != 0 && backCombo == packCombo) || pSoldier->inv[BPACKPOCKPOS].exists() == false) + { + PlaceObject( pSoldier, CPACKPOCKPOS, pObj, fNewItem ); + if(pObj->exists() == false) + return( TRUE ); + } + } + else if(pSoldier->inv[BPACKPOCKPOS].exists() == false && lbeClass == BACKPACK) // Backpack + { + //CHRISL: We're no longer restricting backpacks and gunslings from being used together + //if(pSoldier->inv[GUNSLINGPOCKPOS].exists() == false) + //{ + packCombo = LoadBearingEquipment[Item[pSoldier->inv[CPACKPOCKPOS].usItem].ubClassIndex].lbeCombo; + backCombo = LoadBearingEquipment[pItem->ubClassIndex].lbeCombo; + if((pSoldier->inv[CPACKPOCKPOS].exists() == true && backCombo != 0 && backCombo == packCombo) || pSoldier->inv[CPACKPOCKPOS].exists() == false) + { + PlaceObject( pSoldier, BPACKPOCKPOS, pObj, fNewItem ); + pSoldier->flags.DropPackFlag = FALSE; + pSoldier->flags.ZipperFlag = FALSE; + RenderBackpackButtons(0); /* CHRISL: Needed for new inventory backpack buttons */ + if(pObj->exists() == false) + return( TRUE ); + } + //} + } + break; default: break; } - if (ubPerSlot == 0) - { - // Large object; look for an empty hand/large pocket and dump it in there - // FindObjWithin with 0 will search for empty slots! - // Madd - //bSlot = HANDPOS; - //while (1) - for( bSlot = HANDPOS; bSlot <= BIGPOCK4POS; bSlot++) - { - bSlot = FindEmptySlotWithin( pSoldier, bSlot, BIGPOCK4POS ); - if (bSlot == ITEM_NOT_FOUND) - { - return( FALSE ); - } - if (bSlot == SECONDHANDPOS) - { - if (pSoldier->inv[HANDPOS].usItem != NONE) - { -// bSlot++; - continue; - } - } - // this might fail if we're trying to place in HANDPOS, - // and SECONDHANDPOS is full - PlaceObject( pSoldier, bSlot, pObj ); - SetNewItem( pSoldier, bSlot, fNewItem ); - if (pObj->ubNumberOfObjects == 0) - { - return( TRUE ); - } -// bSlot++; - } - } - else - { - // Small items; don't allow stack/dumping for keys right now as that - // would require a bunch of functions for finding the same object by two values... - if ( ubPerSlot > 1 || Item[ pObj->usItem ].usItemClass == IC_KEY || Item[ pObj->usItem ].usItemClass == IC_MONEY ) - { - // First, look for slots with the same object, and dump into them. - bSlot = HANDPOS; - while (1) - { - bSlot = FindObjWithin( pSoldier, pObj->usItem, bSlot, SMALLPOCK8POS ); - if (bSlot == ITEM_NOT_FOUND) - { - break; - } - if ( bSlot != bExcludeSlot ) - { - if ( ( (Item[ pObj->usItem ].usItemClass == IC_MONEY) && pSoldier->inv[ bSlot ].ItemData.Money.uiMoneyAmount < MoneySlotLimit( bSlot ) ) || (Item[ pObj->usItem ].usItemClass != IC_MONEY && pSoldier->inv[bSlot].ubNumberOfObjects < ItemSlotLimit( pObj->usItem, bSlot ) ) ) - { - // NEW: If in SKI, don't auto-place anything into a stackable slot that's currently hatched out! Such slots - // will disappear in their entirety if sold/moved, causing anything added through here to vanish also! - if( !( ( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) && ShouldSoldierDisplayHatchOnItem( pSoldier->ubProfile, bSlot ) ) ) - { - PlaceObject( pSoldier, bSlot, pObj ); - SetNewItem( pSoldier, bSlot, fNewItem ); - if (pObj->ubNumberOfObjects == 0) - { - return( TRUE ); - } - } - } - } - bSlot++; - } - } - // Search for empty slots to dump into, starting with small pockets - bSlot = SMALLPOCK1POS; - while( 1 ) - { - bSlot = FindEmptySlotWithin( pSoldier, bSlot, SMALLPOCK8POS ); - if (bSlot == ITEM_NOT_FOUND) - { - break; - } - PlaceObject( pSoldier, bSlot, pObj ); - SetNewItem( pSoldier, bSlot, fNewItem ); - if (pObj->ubNumberOfObjects == 0) - { - return( TRUE ); - } - bSlot++; - } - // now check hands/large pockets - bSlot = HANDPOS; - while (1) - { - bSlot = FindEmptySlotWithin( pSoldier, bSlot, BIGPOCK4POS ); - if (bSlot == ITEM_NOT_FOUND) - { - break; - } - PlaceObject( pSoldier, bSlot, pObj ); - SetNewItem( pSoldier, bSlot, fNewItem ); - if (pObj->ubNumberOfObjects == 0) - { - return( TRUE ); - } - bSlot++; - } + if (PlaceInAnySlot(pSoldier, pObj, (fNewItem == TRUE), bExcludeSlot) == true) { + return TRUE; } return( FALSE ); } -BOOLEAN AutoPlaceObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN fNewItem ) -{ - return( InternalAutoPlaceObject( pSoldier, pObj, fNewItem, NO_SLOT ) ); -} - -BOOLEAN RemoveObjectFromSlot( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj ) -{ - CHECKF( pObj ); - if (pSoldier->inv[bPos].ubNumberOfObjects == 0) - { - return( FALSE ); - } - else - { - memcpy( pObj, &(pSoldier->inv[bPos]), sizeof( OBJECTTYPE ) ); - DeleteObj( &(pSoldier->inv[bPos]) ); - return( TRUE ); - } -} - BOOLEAN RemoveKeyFromSlot( SOLDIERTYPE * pSoldier, INT8 bKeyRingPosition, OBJECTTYPE * pObj ) { UINT8 ubItem = 0; CHECKF( pObj ); - + if( ( pSoldier->pKeyRing[ bKeyRingPosition ].ubNumber == 0 ) || ( pSoldier->pKeyRing[ bKeyRingPosition ].ubKeyID == INVALID_KEY_NUMBER ) ) { return( FALSE ); } else { - //memcpy( pObj, &(pSoldier->inv[bPos]), sizeof( OBJECTTYPE ) ); - // create an object ubItem = pSoldier->pKeyRing[ bKeyRingPosition ].ubKeyID; @@ -4380,7 +5055,7 @@ BOOLEAN RemoveKeyFromSlot( SOLDIERTYPE * pSoldier, INT8 bKeyRingPosition, OBJECT } else { - + pSoldier->pKeyRing[ bKeyRingPosition ].ubNumber = 0; pSoldier->pKeyRing[ bKeyRingPosition ].ubKeyID = INVALID_KEY_NUMBER; } @@ -4397,7 +5072,7 @@ BOOLEAN RemoveKeysFromSlot( SOLDIERTYPE * pSoldier, INT8 bKeyRingPosition, UINT8 UINT8 ubItems = 0; CHECKF( pObj ); - + if( ( pSoldier->pKeyRing[ bKeyRingPosition ].ubNumber == 0 ) || ( pSoldier->pKeyRing[ bKeyRingPosition ].ubKeyID == INVALID_KEY_NUMBER ) ) { @@ -4405,14 +5080,14 @@ BOOLEAN RemoveKeysFromSlot( SOLDIERTYPE * pSoldier, INT8 bKeyRingPosition, UINT8 } else { - //memcpy( pObj, &(pSoldier->inv[bPos]), sizeof( OBJECTTYPE ) ); - + //*pObj = pSoldier->inv[bPos]; + if( pSoldier->pKeyRing[ bKeyRingPosition ].ubNumber < ubNumberOfKeys ) { ubNumberOfKeys = pSoldier->pKeyRing[ bKeyRingPosition ].ubNumber; } - + ubItems = pSoldier->pKeyRing[ bKeyRingPosition ].ubKeyID; if( pSoldier->pKeyRing[ bKeyRingPosition ].ubNumber - ubNumberOfKeys > 0 ) { @@ -4434,38 +5109,38 @@ UINT8 AddKeysToSlot( SOLDIERTYPE * pSoldier, INT8 bKeyRingPosition, OBJECTTYPE * { UINT8 ubNumberNotAdded = 0; - if ( pSoldier->uiStatusFlags & SOLDIER_PC ) // redundant but what the hey + if ( pSoldier->flags.uiStatusFlags & SOLDIER_PC ) // redundant but what the hey { - if ( KeyTable[ pObj->ItemData.Key.ubKeyID ].usDateFound == 0 ) + if ( KeyTable[ (*pObj)[0]->data.key.ubKeyID ].usDateFound == 0 ) { - KeyTable[ pObj->ItemData.Key.ubKeyID ].usDateFound = (UINT16) GetWorldDay(); - KeyTable[ pObj->ItemData.Key.ubKeyID ].usSectorFound = SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ); + KeyTable[ (*pObj)[0]->data.key.ubKeyID ].usDateFound = (UINT16) GetWorldDay(); + KeyTable[ (*pObj)[0]->data.key.ubKeyID ].usSectorFound = SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ); } } // check if we are going to far - if ( ( pSoldier->pKeyRing[ bKeyRingPosition ].ubNumber + pObj->ubNumberOfObjects ) > Item[ pObj->usItem ].ubPerPocket ) + if ( ( pSoldier->pKeyRing[ bKeyRingPosition ].ubNumber + pObj->ubNumberOfObjects ) > ItemSlotLimit(pObj, STACK_SIZE_LIMIT) ) { // only take what we can - ubNumberNotAdded = pObj->ubNumberOfObjects - ( Item[ pObj->usItem ].ubPerPocket - pSoldier->pKeyRing[ bKeyRingPosition ].ubNumber ); - + ubNumberNotAdded = pObj->ubNumberOfObjects - ( ItemSlotLimit(pObj, STACK_SIZE_LIMIT) - pSoldier->pKeyRing[ bKeyRingPosition ].ubNumber ); + // set to max - pSoldier->pKeyRing[ bKeyRingPosition ].ubNumber = Item[ pObj->usItem ].ubPerPocket; - + pSoldier->pKeyRing[ bKeyRingPosition ].ubNumber = ItemSlotLimit(pObj, STACK_SIZE_LIMIT); + if( pSoldier->pKeyRing[ bKeyRingPosition ].ubNumber == 0 ) { - pSoldier->pKeyRing[ bKeyRingPosition ].ubKeyID = pObj->ItemData.Key.ubKeyID; + pSoldier->pKeyRing[ bKeyRingPosition ].ubKeyID = (*pObj)[0]->data.key.ubKeyID; } // return number used return( pObj->ubNumberOfObjects - ubNumberNotAdded ); } - else + else { - // check + // check if( pSoldier->pKeyRing[ bKeyRingPosition ].ubNumber == 0 ) { - pSoldier->pKeyRing[ bKeyRingPosition ].ubKeyID = pObj->ItemData.Key.ubKeyID; + pSoldier->pKeyRing[ bKeyRingPosition ].ubKeyID = (*pObj)[0]->data.key.ubKeyID; } pSoldier->pKeyRing[ bKeyRingPosition ].ubNumber += pObj->ubNumberOfObjects; @@ -4477,17 +5152,14 @@ UINT8 AddKeysToSlot( SOLDIERTYPE * pSoldier, INT8 bKeyRingPosition, OBJECTTYPE * UINT8 SwapKeysToSlot( SOLDIERTYPE * pSoldier, INT8 bKeyRingPosition, OBJECTTYPE * pObj ) { // swap keys in keyring slot and keys in pocket - UINT8 ubNumberNotAdded = 0; - OBJECTTYPE TempObj; - // create temp object to hold keys currently in key ring slot - CreateKeyObject( &TempObj, pSoldier->pKeyRing[ bKeyRingPosition ].ubNumber, pSoldier->pKeyRing[ bKeyRingPosition ].ubKeyID ); + CreateKeyObject( &gTempObject, pSoldier->pKeyRing[ bKeyRingPosition ].ubNumber, pSoldier->pKeyRing[ bKeyRingPosition ].ubKeyID ); pSoldier->pKeyRing[ bKeyRingPosition ].ubNumber = pObj->ubNumberOfObjects; - pSoldier->pKeyRing[ bKeyRingPosition ].ubKeyID = pObj->ItemData.Key.ubKeyID; - + pSoldier->pKeyRing[ bKeyRingPosition ].ubKeyID = (*pObj)[0]->data.key.ubKeyID; + // swap params? - CopyObj( &TempObj, pObj ); + *pObj = gTempObject; return( 1 ); } @@ -4497,10 +5169,11 @@ BOOLEAN CreateKeyObject( OBJECTTYPE * pObj , UINT8 ubNumberOfKeys, UINT8 ubKeyID { BOOLEAN fRet; + pObj->initialize(); fRet = CreateItems( (UINT16) (FIRST_KEY + LockTable[ ubKeyID ].usKeyItem), 100, ubNumberOfKeys, pObj ); if (fRet) { - pObj->ItemData.Key.ubKeyID = ubKeyID; + (*pObj)[0]->data.key.ubKeyID = ubKeyID; } //fRet = CreateItems( (UINT16)(ubKeyIdValue + FIRST_KEY) , 100, ubNumberOfKeys, pObj ) //return( ); @@ -4511,7 +5184,7 @@ BOOLEAN CreateKeyObject( OBJECTTYPE * pObj , UINT8 ubNumberOfKeys, UINT8 ubKeyID BOOLEAN AllocateObject( OBJECTTYPE **pObj ) { // create a key object - *pObj = (OBJECTTYPE *) MemAlloc( sizeof( OBJECTTYPE ) ); + *pObj = new OBJECTTYPE; Assert( pObj ); return( TRUE ); @@ -4525,7 +5198,7 @@ BOOLEAN DeleteKeyObject( OBJECTTYPE * pObj ) } // free up space - MemFree( pObj ); + delete( pObj ); return( TRUE ); } @@ -4537,7 +5210,7 @@ UINT16 TotalPoints( OBJECTTYPE * pObj ) for (ubLoop = 0; ubLoop < pObj->ubNumberOfObjects; ubLoop++) { - usPoints += pObj->ItemData.Generic.bStatus[ubLoop]; + usPoints += (*pObj)[ubLoop]->data.objectStatus; } return( usPoints ); } @@ -4551,28 +5224,28 @@ UINT16 UseKitPoints( OBJECTTYPE * pObj, UINT16 usPoints, SOLDIERTYPE *pSoldier ) for (bLoop = pObj->ubNumberOfObjects - 1; bLoop >= 0; bLoop--) { - if (Item[pObj->usItem].percentstatusdrainreduction > 0 && ((usPoints * (100 - Item[pObj->usItem].percentstatusdrainreduction))/100) < pObj->ItemData.Generic.bStatus[bLoop] ) + if (Item[pObj->usItem].percentstatusdrainreduction > 0 && ((usPoints * (100 - Item[pObj->usItem].percentstatusdrainreduction))/100) < (*pObj)[bLoop]->data.objectStatus ) { - pObj->ItemData.Generic.bStatus[bLoop] -= (INT8) ((usPoints * (100 - Item[pObj->usItem].percentstatusdrainreduction ) )/100); + (*pObj)[bLoop]->data.objectStatus -= (INT8) ((usPoints * (100 - Item[pObj->usItem].percentstatusdrainreduction ) )/100); return( usOriginalPoints ); } - else if (usPoints < (UINT16) pObj->ItemData.Generic.bStatus[bLoop]) + else if (usPoints < (UINT16) (*pObj)[bLoop]->data.objectStatus) { - pObj->ItemData.Generic.bStatus[bLoop] -= (INT8) usPoints; + (*pObj)[bLoop]->data.objectStatus -= (INT8) usPoints; return( usOriginalPoints ); } else { // consume this kit totally - usPoints -= pObj->ItemData.Generic.bStatus[bLoop]; - pObj->ItemData.Generic.bStatus[bLoop] = 0; + usPoints -= (*pObj)[bLoop]->data.objectStatus; + (*pObj)[bLoop]->data.objectStatus = 0; pObj->ubNumberOfObjects--; } } // check if pocket/hand emptied..update inventory, then update panel - if( pObj->ubNumberOfObjects == 0 ) + if( pObj->exists() == false ) { // Delete object DeleteObj( pObj ); @@ -4608,7 +5281,7 @@ UINT16 MagazineClassIndexToItemType(UINT16 usMagIndex) // this function will have to be rewritten to scan the item table for an item // with item class ammo, which has class index usMagIndex DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "MagazineClassIndexToItemType" ) ); - for (usLoop = FIRST_AMMO; usLoop < MAXITEMS; usLoop++) + for (usLoop = FIRST_AMMO; usLoop < MAXITEMS; usLoop++) { if ( Item[usLoop].usItemClass == 0 ) { @@ -4657,11 +5330,11 @@ UINT16 DefaultMagazine( UINT16 usItem ) return( 0 ); } -UINT16 FindReplacementMagazine( UINT8 ubCalibre, UINT8 ubMagSize, UINT8 ubAmmoType ) +UINT16 FindReplacementMagazine( UINT8 ubCalibre, UINT16 ubMagSize, UINT8 ubAmmoType ) { UINT16 usLoop; UINT16 usDefault; - + usLoop = 0; usDefault = NOTHING; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("FindReplacementMagazine: calibre = %d, Mag size = %d, ammo type = %d",ubCalibre,ubMagSize,ubAmmoType)); @@ -4681,7 +5354,7 @@ UINT16 FindReplacementMagazine( UINT8 ubCalibre, UINT8 ubMagSize, UINT8 ubAmmoTy // store this one to use if all else fails usDefault = MagazineClassIndexToItemType( usLoop ); } - + } usLoop++; @@ -4881,7 +5554,7 @@ UINT16 RandomMagazine( OBJECTTYPE * pGun, UINT8 ubPercentStandard, UINT8 maxCool } } -BOOLEAN CreateGun( UINT16 usItem, INT8 bStatus, OBJECTTYPE * pObj ) +BOOLEAN CreateGun( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj ) { UINT16 usAmmo; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CreateGun: usItem = %d",usItem)); @@ -4893,37 +5566,39 @@ BOOLEAN CreateGun( UINT16 usItem, INT8 bStatus, OBJECTTYPE * pObj ) return( FALSE ); } - memset( pObj, 0, sizeof( OBJECTTYPE ) ); + pObj->initialize(); pObj->usItem = usItem; pObj->ubNumberOfObjects = 1; - pObj->ItemData.Gun.bGunStatus = bStatus; - pObj->ubImprintID = NO_PROFILE; - pObj->ubWeight = CalculateObjectWeight( pObj ); + //pObj->objectStack.resize(1);//not necessary due to init, here for code commenting + StackedObjectData* pStackedObject = (*pObj)[0]; + pStackedObject->data.gun.bGunStatus = bStatus; + pStackedObject->data.ubImprintID = NO_PROFILE; if (Weapon[ usItem ].ubWeaponClass == MONSTERCLASS) { - pObj->ItemData.Gun.ubGunShotsLeft = GetMagSize(pObj); - pObj->ItemData.Gun.ubGunAmmoType = AMMO_MONSTER; - pObj->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; // 0verhaul: Monsters don't have to reload! + pStackedObject->data.gun.ubGunShotsLeft = GetMagSize(pObj); + pStackedObject->data.gun.ubGunAmmoType = AMMO_MONSTER; + pStackedObject->data.gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; // 0verhaul: Monsters don't have to reload! } else if ( EXPLOSIVE_GUN( usItem ) ) { - if ( Item[usItem].singleshotrocketlauncher ) + if ( Item[usItem].singleshotrocketlauncher ) { - pObj->ItemData.Gun.ubGunShotsLeft = 1; + pStackedObject->data.gun.ubGunShotsLeft = 1; } else { // cannon - pObj->ItemData.Gun.ubGunShotsLeft = 0; + pStackedObject->data.gun.ubGunShotsLeft = 0; } - pObj->ItemData.Gun.bGunAmmoStatus = 100; - pObj->ItemData.Gun.ubGunAmmoType = 0; + pStackedObject->data.gun.bGunAmmoStatus = 100; + pStackedObject->data.gun.ubGunAmmoType = 0; } else { usAmmo = DefaultMagazine( usItem ); - Assert( usAmmo != 0 ); + //CHRISL: Why do we have an assert here when the very next condition says to return a FALSE if usAmmo is 0? + //Assert( usAmmo != 0 ); if (usAmmo == 0) { // item's calibre & mag size not found in magazine list! @@ -4931,50 +5606,52 @@ BOOLEAN CreateGun( UINT16 usItem, INT8 bStatus, OBJECTTYPE * pObj ) } else { - pObj->ItemData.Gun.usGunAmmoItem = usAmmo; - pObj->ItemData.Gun.ubGunAmmoType = Magazine[ Item[ usAmmo ].ubClassIndex].ubAmmoType; - pObj->ItemData.Gun.bGunAmmoStatus = 100; - pObj->ItemData.Gun.ubGunShotsLeft = Magazine[ Item[ usAmmo ].ubClassIndex ].ubMagSize; - pObj->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; // Madd: new guns should have cartridge in chamber - /* - if (usItem == CAWS) - { - pObj->usAttachItem[0] = DUCKBILL; - pObj->bAttachStatus[0] = 100; - } - */ + pStackedObject->data.gun.usGunAmmoItem = usAmmo; + pStackedObject->data.gun.ubGunAmmoType = Magazine[ Item[ usAmmo ].ubClassIndex].ubAmmoType; + pStackedObject->data.gun.bGunAmmoStatus = 100; + pStackedObject->data.gun.ubGunShotsLeft = Magazine[ Item[ usAmmo ].ubClassIndex ].ubMagSize; + pStackedObject->data.gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; // Madd: new guns should have cartridge in chamber } } + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //pObj->ubWeight = CalculateObjectWeight( pObj ); DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CreateGun: Done")); // succesful return( TRUE ); } -BOOLEAN CreateMagazine( UINT16 usItem, OBJECTTYPE * pObj ) +BOOLEAN CreateAmmo( UINT16 usItem, OBJECTTYPE * pObj, INT16 ubShotsLeft ) { if (pObj == NULL) { return( FALSE ); } - memset( pObj, 0, sizeof( OBJECTTYPE ) ); + pObj->initialize(); pObj->usItem = usItem; pObj->ubNumberOfObjects = 1; - pObj->ItemData.Ammo.ubShotsLeft[0] = Magazine[ Item[usItem].ubClassIndex ].ubMagSize; - pObj->ubWeight = CalculateObjectWeight( pObj ); - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CreateMagazine: done")); + //pObj->objectStack.resize(1);//not necessary due to init, here for code commenting + if (ubShotsLeft < 0) { + (*pObj)[0]->data.ubShotsLeft = Magazine[ Item[usItem].ubClassIndex ].ubMagSize; + } + else { + (*pObj)[0]->data.ubShotsLeft = (UINT8)ubShotsLeft; + } + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //pObj->ubWeight = CalculateObjectWeight( pObj ); + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CreateAmmo: done")); return( TRUE ); } -BOOLEAN CreateItem( UINT16 usItem, INT8 bStatus, OBJECTTYPE * pObj ) +BOOLEAN CreateItem( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CreateItem: usItem = %d",usItem)); BOOLEAN fRet; - memset( pObj, 0, sizeof( OBJECTTYPE ) ); if (usItem >= MAXITEMS) { + DebugBreakpoint(); return( FALSE ); } if (Item[ usItem ].usItemClass == IC_GUN) @@ -4983,24 +5660,27 @@ BOOLEAN CreateItem( UINT16 usItem, INT8 bStatus, OBJECTTYPE * pObj ) } else if (Item[ usItem ].usItemClass == IC_AMMO) { - fRet = CreateMagazine( usItem, pObj ); + fRet = CreateAmmo( usItem, pObj ); } else { + pObj->initialize(); pObj->usItem = usItem; pObj->ubNumberOfObjects = 1; + //pObj->objectStack.resize(1);//not necessary due to init, here for code commenting if (usItem == MONEY || Item[usItem].usItemClass == IC_MONEY ) { // special case... always set status to 100 when creating // and use status value to determine amount! - pObj->ItemData.Generic.bStatus[0] = 100; - pObj->ItemData.Money.uiMoneyAmount = bStatus * 50; + (*pObj)[0]->data.objectStatus = 100; + (*pObj)[0]->data.money.uiMoneyAmount = bStatus * 50; } else { - pObj->ItemData.Generic.bStatus[0] = bStatus; + (*pObj)[0]->data.objectStatus = bStatus; } - pObj->ubWeight = CalculateObjectWeight( pObj ); + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //pObj->ubWeight = CalculateObjectWeight( pObj ); fRet = TRUE; } if (fRet) @@ -5008,13 +5688,14 @@ BOOLEAN CreateItem( UINT16 usItem, INT8 bStatus, OBJECTTYPE * pObj ) // if (Item[ usItem ].fFlags & ITEM_DEFAULT_UNDROPPABLE) if (Item[ usItem ].defaultundroppable ) { - pObj->fFlags |= OBJECT_UNDROPPABLE; + (*pObj).fFlags |= OBJECT_UNDROPPABLE; } if (Item [ usItem ].defaultattachment > 0 ) { - OBJECTTYPE Temp; - CreateItem(Item [ usItem ].defaultattachment,100,&Temp); - AttachObject(NULL,pObj,&Temp); + //cannot use gTempObject + static OBJECTTYPE defaultAttachment; + CreateItem(Item [ usItem ].defaultattachment,100,&defaultAttachment); + pObj->AttachObject(NULL,&defaultAttachment); } } @@ -5026,26 +5707,18 @@ BOOLEAN CreateItem( UINT16 usItem, INT8 bStatus, OBJECTTYPE * pObj ) BOOLEAN CreateItems( UINT16 usItem, INT8 bStatus, UINT8 ubNumber, OBJECTTYPE * pObj ) { BOOLEAN fOk; - UINT8 ubLoop; - - // ARM: to avoid whacking memory once Assertions are removed... Items will be lost in this situation! - if ( ubNumber > MAX_OBJECTS_PER_SLOT ) - { - ubNumber = MAX_OBJECTS_PER_SLOT; - } - fOk = CreateItem( usItem, bStatus, pObj ); if (fOk) { - for (ubLoop = 1; ubLoop < ubNumber; ubLoop++) - { - // we reference status[0] here because the status value might actually be a - // # of rounds of ammo, in which case the value won't be the bStatus value - // passed in. - pObj->ItemData.Generic.bStatus[ubLoop] = pObj->ItemData.Generic.bStatus[0]; + if (ubNumber > 1) { + //no need to recalc weight if just 1, CreateItem did that. + for (int x = 1; x < ubNumber; ++x) { + pObj->objectStack.push_back(pObj->objectStack.front()); + } + pObj->ubNumberOfObjects = ubNumber; + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //pObj->ubWeight = CalculateObjectWeight(pObj); } - pObj->ubNumberOfObjects = ubNumber; - pObj->ubWeight *= ubNumber; return( TRUE ); } return( FALSE ); @@ -5053,12 +5726,12 @@ BOOLEAN CreateItems( UINT16 usItem, INT8 bStatus, UINT8 ubNumber, OBJECTTYPE * p BOOLEAN CreateMoney( UINT32 uiMoney, OBJECTTYPE * pObj ) { - BOOLEAN fOk; + BOOLEAN fOk; fOk = CreateItem( MONEY, 100, pObj ); if (fOk) { - pObj->ItemData.Money.uiMoneyAmount = uiMoney; + (*pObj)[0]->data.money.uiMoneyAmount = uiMoney; } return( fOk ); } @@ -5072,7 +5745,7 @@ BOOLEAN ArmBomb( OBJECTTYPE * pObj, INT8 bSetting ) if (pObj->usItem == ACTION_ITEM) { - switch( pObj->ItemData.Trigger.bActionValue ) + switch( (*pObj)[0]->data.misc.bActionValue ) { case ACTION_ITEM_SMALL_PIT: case ACTION_ITEM_LARGE_PIT: @@ -5118,133 +5791,91 @@ BOOLEAN ArmBomb( OBJECTTYPE * pObj, INT8 bSetting ) if (fRemote) { - pObj->ItemData.Trigger.bDetonatorType = BOMB_REMOTE; - pObj->ItemData.Trigger.BombTrigger.bFrequency = bSetting; + (*pObj)[0]->data.misc.bDetonatorType = BOMB_REMOTE; + (*pObj)[0]->data.misc.bFrequency = bSetting; } else if (fPressure) { - pObj->ItemData.Trigger.bDetonatorType = BOMB_PRESSURE; - pObj->ItemData.Trigger.BombTrigger.bFrequency = 0; + (*pObj)[0]->data.misc.bDetonatorType = BOMB_PRESSURE; + (*pObj)[0]->data.misc.bFrequency = 0; } else if (fTimed) { - pObj->ItemData.Trigger.bDetonatorType = BOMB_TIMED; + (*pObj)[0]->data.misc.bDetonatorType = BOMB_TIMED; // In realtime the player could choose to put down a bomb right before a turn expires, SO // add 1 to the setting in RT - pObj->ItemData.Trigger.BombTrigger.bDelay = bSetting; + (*pObj)[0]->data.misc.bDelay = bSetting; if ( !(gTacticalStatus.uiFlags & TURNBASED && gTacticalStatus.uiFlags & INCOMBAT) ) { - pObj->ItemData.Trigger.BombTrigger.bDelay++; + (*pObj)[0]->data.misc.bDelay++; } } else if (fSwitch) { - pObj->ItemData.Trigger.bDetonatorType = BOMB_SWITCH; - pObj->ItemData.Trigger.BombTrigger.bFrequency = bSetting; + (*pObj)[0]->data.misc.bDetonatorType = BOMB_SWITCH; + (*pObj)[0]->data.misc.bFrequency = bSetting; } else { return( FALSE ); } - pObj->fFlags |= OBJECT_ARMED_BOMB; - pObj->ItemData.Trigger.usBombItem = pObj->usItem; + (*pObj).fFlags |= OBJECT_ARMED_BOMB; + (*pObj)[0]->data.misc.usBombItem = pObj->usItem; return( TRUE ); } -void RenumberAttachments( OBJECTTYPE * pObj ) +BOOLEAN OBJECTTYPE::RemoveAttachment( OBJECTTYPE* pAttachment, OBJECTTYPE * pNewObj, UINT8 subObject ) { - // loop through attachment positions and make sure we don't have any empty - // attachment slots before filled ones - INT8 bAttachPos; - INT8 bFirstSpace; - BOOLEAN fDone = FALSE; + BOOLEAN objDeleted = FALSE; - while (!fDone) + if ( pAttachment == 0 ) { - bFirstSpace = -1; - for (bAttachPos = 0; bAttachPos < MAX_ATTACHMENTS; bAttachPos++) - { - if (pObj->usAttachItem[ bAttachPos ] == NOTHING) + return( FALSE ); + } + + if ( Item[ pAttachment->usItem ].inseparable ) + { + return( FALSE ); + } + + //CHRISL: I know this FOR loop is basically redundant to what the remove() function already does, but + // this setup includes a failsafe. Now we'll only copy the attachment to our cursor (pNewObj) if + // iter and pAttachment are the same. This should stop attachment duplication though it doesn't resolve + // the initial cause of the attachment duplication issue. + for (std::list::iterator iter = (*this)[subObject]->attachments.begin(); + iter != (*this)[subObject]->attachments.end(); ++iter){ + if(*iter == *pAttachment) { - if (bFirstSpace == -1) + if(pNewObj != NULL) { - bFirstSpace = bAttachPos; + *pNewObj = *pAttachment; } + iter = (*this)[subObject]->attachments.erase(iter); + objDeleted = TRUE; + break; } - else - { - if (bFirstSpace != -1) - { - // move the attachment! - pObj->usAttachItem[ bFirstSpace ] = pObj->usAttachItem[ bAttachPos ]; - pObj->bAttachStatus[ bFirstSpace ] = pObj->bAttachStatus[ bAttachPos ]; - pObj->usAttachItem[ bAttachPos ] = NOTHING; - pObj->bAttachStatus[ bAttachPos ] = 0; - // restart loop at beginning, or quit if we reached the end of the - // attachments - break; - } - } - } - if (bAttachPos == MAX_ATTACHMENTS) - { - // done!! - fDone = TRUE; - } } - -} - -BOOLEAN RemoveAttachment( OBJECTTYPE * pObj, INT8 bAttachPos, OBJECTTYPE * pNewObj ) -{ - INT8 bGrenade; - - CHECKF( pObj ); - - if (bAttachPos < 0 || bAttachPos >= MAX_ATTACHMENTS) - { + if(!objDeleted) return( FALSE ); - } - if (pObj->usAttachItem[bAttachPos] == NOTHING ) - { - return( FALSE ); - } -// if ( Item[ pObj->usAttachItem[bAttachPos] ].fFlags & ITEM_INSEPARABLE ) - if ( Item[ pObj->usAttachItem[bAttachPos] ].inseparable ) - { - return( FALSE ); - } - - // if pNewObj is passed in NULL, then we just delete the attachment - if (pNewObj != NULL) - { - CreateItem( pObj->usAttachItem[bAttachPos], pObj->bAttachStatus[bAttachPos], pNewObj ); - } - - pObj->usAttachItem[bAttachPos] = NOTHING; - pObj->bAttachStatus[bAttachPos] = 0; - if (pNewObj && Item[pNewObj->usItem].grenadelauncher )//UNDER_GLAUNCHER) { - // look for any grenade; if it exists, we must make it an + // look for any grenade; if it exists, we must make it an // attachment of the grenade launcher - bGrenade = FindAttachmentByClass( pObj, IC_GRENADE ); - if (bGrenade != ITEM_NOT_FOUND) + OBJECTTYPE* pGrenade = FindAttachmentByClass( this, IC_GRENADE ); + if (pGrenade) { - pNewObj->usAttachItem[0] = pObj->usAttachItem[bGrenade]; - pNewObj->bAttachStatus[0] = pObj->bAttachStatus[bGrenade]; - pObj->usAttachItem[bGrenade] = NOTHING; - pObj->bAttachStatus[bGrenade] = 0; - pNewObj->ubWeight = CalculateObjectWeight( pNewObj ); + (*pNewObj)[subObject]->attachments.push_back(*pGrenade); + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //pNewObj->ubWeight = CalculateObjectWeight( pNewObj ); + this->RemoveAttachment(pGrenade); } } - RenumberAttachments( pObj ); - - pObj->ubWeight = CalculateObjectWeight( pObj ); + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //this->ubWeight = CalculateObjectWeight( this ); return( TRUE ); } @@ -5252,41 +5883,43 @@ void SetNewItem( SOLDIERTYPE *pSoldier, UINT8 ubInvPos, BOOLEAN fNewItem ) { if( fNewItem ) { - pSoldier->bNewItemCount[ ubInvPos ] = -1; - pSoldier->bNewItemCycleCount[ ubInvPos ] = NEW_ITEM_CYCLE_COUNT; - pSoldier->fCheckForNewlyAddedItems = TRUE; + pSoldier->inv.bNewItemCount[ ubInvPos ] = -1; + pSoldier->inv.bNewItemCycleCount[ ubInvPos ] = NEW_ITEM_CYCLE_COUNT; + pSoldier->flags.fCheckForNewlyAddedItems = TRUE; } } BOOLEAN PlaceObjectInSoldierProfile( UINT8 ubProfile, OBJECTTYPE *pObject ) { - INT8 bLoop, bLoop2; + INT8 bLoop; SOLDIERTYPE *pSoldier; UINT16 usItem; - INT8 bStatus; + INT16 bStatus; BOOLEAN fReturnVal = FALSE; usItem = pObject->usItem; - bStatus = pObject->ItemData.Generic.bStatus[0]; + Assert(pObject->ubNumberOfObjects == 1); + bStatus = (*pObject)[0]->data.objectStatus; pSoldier = FindSoldierByProfileID( ubProfile, FALSE ); if ( Item[ usItem ].usItemClass == IC_MONEY && gMercProfiles[ ubProfile ].uiMoney > 0 ) { - gMercProfiles[ ubProfile ].uiMoney += pObject->ItemData.Money.uiMoneyAmount; + gMercProfiles[ ubProfile ].uiMoney += (*pObject)[0]->data.money.uiMoneyAmount; SetMoneyInSoldierProfile( ubProfile, gMercProfiles[ ubProfile ].uiMoney ); return( TRUE ); } - for (bLoop = BIGPOCK1POS; bLoop < SMALLPOCK8POS; bLoop++) + // CHRISL: + for (bLoop = BIGPOCKSTART; bLoop < NUM_INV_SLOTS; bLoop++) { - if ( gMercProfiles[ ubProfile ].bInvNumber[ bLoop ] == 0 && (pSoldier == NULL || pSoldier->inv[ bLoop ].usItem == NOTHING ) ) + if ( gMercProfiles[ ubProfile ].bInvNumber[ bLoop ] == 0 && (pSoldier == NULL || pSoldier->inv[ bLoop ].exists() == false ) ) { // CJC: Deal with money by putting money into # stored in profile if ( Item[ usItem ].usItemClass == IC_MONEY ) { - gMercProfiles[ ubProfile ].uiMoney += pObject->ItemData.Money.uiMoneyAmount; + gMercProfiles[ ubProfile ].uiMoney += (*pObject)[0]->data.money.uiMoneyAmount; // change any gold/silver to money usItem = MONEY; } @@ -5294,7 +5927,7 @@ BOOLEAN PlaceObjectInSoldierProfile( UINT8 ubProfile, OBJECTTYPE *pObject ) { gMercProfiles[ ubProfile ].inv[ bLoop ] = usItem; gMercProfiles[ ubProfile ].bInvStatus[ bLoop ] = bStatus; - gMercProfiles[ ubProfile ].bInvNumber[ bLoop ] = pObject->ubNumberOfObjects; + gMercProfiles[ ubProfile ].bInvNumber[ bLoop ] = pObject->ubNumberOfObjects; } fReturnVal = TRUE; @@ -5321,15 +5954,12 @@ BOOLEAN PlaceObjectInSoldierProfile( UINT8 ubProfile, OBJECTTYPE *pObject ) if ( pSoldier->ubProfile == MADLAB ) { // remove attachments and drop them - OBJECTTYPE Attachment; - - for ( bLoop2 = MAX_ATTACHMENTS - 1; bLoop2 >= 0; bLoop2-- ) - { - // remove also checks for existence attachment - if ( RemoveAttachment( pObject, bLoop2, &Attachment ) == TRUE ) - { - // drop it in Madlab's tile - AddItemToPool( pSoldier->sGridNo, &Attachment, 1, 0, 0, 0 ); + for (attachmentList::iterator iter = (*pObject)[0]->attachments.begin(); iter != (*pObject)[0]->attachments.end();) { + // drop it in Madlab's tile + AddItemToPool( pSoldier->sGridNo, &(*iter), 1, 0, 0, 0 ); + pObject->RemoveAttachment(&(*iter)); + if ((*pObject)[0]->attachments.empty() == true) { + break; } } } @@ -5344,7 +5974,6 @@ BOOLEAN PlaceObjectInSoldierProfile( UINT8 ubProfile, OBJECTTYPE *pObject ) BOOLEAN RemoveObjectFromSoldierProfile( UINT8 ubProfile, UINT16 usItem ) { - INT8 bLoop; SOLDIERTYPE *pSoldier; BOOLEAN fReturnVal = FALSE; @@ -5352,14 +5981,14 @@ BOOLEAN RemoveObjectFromSoldierProfile( UINT8 ubProfile, UINT16 usItem ) { return( TRUE ); } - - for (bLoop = 0; bLoop < 19; bLoop++) + MERCPROFILESTRUCT* pProfile = &gMercProfiles[ ubProfile ]; + for (unsigned int bLoop = 0; bLoop < pProfile->inv.size(); bLoop++) { - if ( gMercProfiles[ ubProfile ].inv[ bLoop ] == usItem ) + if ( pProfile->inv[ bLoop ] == usItem ) { - gMercProfiles[ ubProfile ].inv[ bLoop ] = NOTHING; - gMercProfiles[ ubProfile ].bInvStatus[ bLoop ] = 0; - gMercProfiles[ ubProfile ].bInvNumber[ bLoop ] = 0; + pProfile->inv[ bLoop ] = NOTHING; + pProfile->bInvStatus[ bLoop ] = 0; + pProfile->bInvNumber[ bLoop ] = 0; fReturnVal = TRUE; break; @@ -5382,12 +6011,9 @@ BOOLEAN RemoveObjectFromSoldierProfile( UINT8 ubProfile, UINT16 usItem ) void SetMoneyInSoldierProfile( UINT8 ubProfile, UINT32 uiMoney ) { - //INT8 bSlot; - OBJECTTYPE Object; - //SOLDIERTYPE * pSoldier; BOOLEAN fRet; - // remove all money from soldier + // remove all money from soldier do { fRet = RemoveObjectFromSoldierProfile( ubProfile, MONEY ); @@ -5399,20 +6025,20 @@ void SetMoneyInSoldierProfile( UINT8 ubProfile, UINT32 uiMoney ) if (uiMoney > 0) { // now add the amount specified - CreateMoney( uiMoney, &Object ); - PlaceObjectInSoldierProfile( ubProfile, &Object ); + CreateMoney( uiMoney, &gTempObject ); + PlaceObjectInSoldierProfile( ubProfile, &gTempObject ); } } INT8 FindObjectInSoldierProfile( UINT8 ubProfile, UINT16 usItem ) { - INT8 bLoop; - for (bLoop = 0; bLoop < 19; bLoop++) + MERCPROFILESTRUCT* pProfile = &gMercProfiles[ ubProfile ]; + for (unsigned int bLoop = 0; bLoop < pProfile->inv.size(); bLoop++) { - if ( gMercProfiles[ ubProfile ].bInvNumber[ bLoop ] > 0 ) + if ( pProfile->bInvNumber[ bLoop ] > 0 ) { - if ( gMercProfiles[ ubProfile ].inv[ bLoop ] == usItem ) + if ( pProfile->inv[ bLoop ] == usItem ) { return( bLoop ); } @@ -5437,9 +6063,8 @@ void RemoveInvObject( SOLDIERTYPE *pSoldier, UINT16 usItem ) bInvPos = FindObj( pSoldier, usItem ); if (bInvPos != NO_SLOT) { - // Erase! - memset( &(pSoldier->inv[ bInvPos ]), 0, sizeof( OBJECTTYPE ) ); + DeleteObj(&pSoldier->inv[ bInvPos ]); //Dirty! DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); @@ -5474,16 +6099,16 @@ INT8 CheckItemForDamage( UINT16 usItem, INT32 iMaxDamage ) return( bDamage ); } -BOOLEAN CheckForChainReaction( UINT16 usItem, INT8 bStatus, INT8 bDamage, BOOLEAN fOnGround ) +BOOLEAN CheckForChainReaction( UINT16 usItem, INT16 bStatus, INT16 bDamage, BOOLEAN fOnGround ) { INT32 iChance; iChance = Explosive[Item[usItem].ubClassIndex].ubVolatility; if (iChance > 0) { - + // Scale the base chance by the damage caused to the item - // (bigger the shock, bigger chance) and the condition of + // (bigger the shock, bigger chance) and the condition of // the item after being hit! if (fOnGround) { @@ -5503,17 +6128,17 @@ BOOLEAN CheckForChainReaction( UINT16 usItem, INT8 bStatus, INT8 bDamage, BOOLEA BOOLEAN DamageItem( OBJECTTYPE * pObject, INT32 iDamage, BOOLEAN fOnGround ) { INT8 bLoop; - INT8 bDamage; + INT16 bDamage; -// if ( (Item[pObject->usItem].fFlags & ITEM_DAMAGEABLE || Item[ pObject->usItem ].usItemClass == IC_AMMO) && pObject->ubNumberOfObjects > 0) - if ( (Item[pObject->usItem].damageable || Item[ pObject->usItem ].usItemClass == IC_AMMO) && pObject->ubNumberOfObjects > 0) + if ( (Item[pObject->usItem].damageable || Item[ pObject->usItem ].usItemClass == IC_AMMO) && pObject->exists() == true) { for (bLoop = 0; bLoop < pObject->ubNumberOfObjects; bLoop++) { + bool removed = false; // if the status of the item is negative then it's trapped/jammed; // leave it alone - if (pObject->usItem != NOTHING && pObject->ItemData.Generic.bStatus[bLoop] > 0) + if (pObject->exists() == true && (*pObject)[bLoop]->data.objectStatus > 0) { bDamage = CheckItemForDamage( pObject->usItem, iDamage ); switch( pObject->usItem ) @@ -5525,7 +6150,7 @@ BOOLEAN DamageItem( OBJECTTYPE * pObject, INT32 iDamage, BOOLEAN fOnGround ) if ( PreRandom( bDamage ) > 5 ) { // smash! - bDamage = pObject->ItemData.Generic.bStatus[ bLoop ]; + bDamage = (*pObject)[bLoop]->data.objectStatus; } break; default: @@ -5536,49 +6161,51 @@ BOOLEAN DamageItem( OBJECTTYPE * pObject, INT32 iDamage, BOOLEAN fOnGround ) if ( PreRandom( 100 ) < (UINT32) bDamage ) { // destroy clip completely - pObject->ItemData.Generic.bStatus[ bLoop ] = 1; + (*pObject)[bLoop]->data.objectStatus = 1; } } else { - pObject->ItemData.Generic.bStatus[bLoop] -= bDamage; - if (pObject->ItemData.Generic.bStatus[bLoop] < 1) + (*pObject)[bLoop]->data.objectStatus -= bDamage; + if ((*pObject)[bLoop]->data.objectStatus < 1) { - pObject->ItemData.Generic.bStatus[bLoop] = 1; + (*pObject)[bLoop]->data.objectStatus = 1; } } // I don't think we increase viewrange based on items any more // FUN STUFF! Check for explosives going off as a result! if (Item[pObject->usItem].usItemClass & IC_EXPLOSV) { - if (CheckForChainReaction( pObject->usItem, pObject->ItemData.Generic.bStatus[bLoop], bDamage, fOnGround )) + if (CheckForChainReaction( pObject->usItem, (*pObject)[bLoop]->data.objectStatus, bDamage, fOnGround )) { return( TRUE ); } } // remove item from index AFTER checking explosions because need item data for explosion! - if ( pObject->ItemData.Generic.bStatus[bLoop] == 1 ) + if ( (*pObject)[bLoop]->data.objectStatus == 1 ) { if ( pObject->ubNumberOfObjects > 1 ) { - RemoveObjFrom( pObject, bLoop ); + removed = true; + pObject->RemoveObjectAtIndex( bLoop ); // since an item was just removed, the items above the current were all shifted down one; // to process them properly, we have to back up 1 in the counter - bLoop = bLoop - 1; + --bLoop; } } } - } - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - if (pObject->usAttachItem[bLoop] != NOTHING && pObject->bAttachStatus[bLoop] > 0) - { - pObject->bAttachStatus[bLoop] -= CheckItemForDamage( pObject->usAttachItem[bLoop], iDamage ); - if (pObject->bAttachStatus[bLoop] < 1) - { - pObject->bAttachStatus[bLoop] = 1; + if (removed == false) { + for (attachmentList::iterator iter = (*pObject)[bLoop]->attachments.begin(); iter != (*pObject)[bLoop]->attachments.end();) { + DamageItem(&(*iter), iDamage, fOnGround); + //could have removed the object at iter + if (iter->exists() == true) { + ++iter; + } + else { + iter = (*pObject)[bLoop]->attachments.erase(iter); + } } } } @@ -5598,8 +6225,11 @@ void CheckEquipmentForDamage( SOLDIERTYPE *pSoldier, INT32 iDamage ) return; } - for (bSlot = 0; bSlot < NUM_INV_SLOTS; bSlot++) + for (bSlot = 0; bSlot < (INT8) pSoldier->inv.size(); bSlot++) { + if (pSoldier->inv[bSlot].exists() == false) { + continue; + } ubNumberOfObjects = pSoldier->inv[bSlot].ubNumberOfObjects; fBlowsUp = DamageItem( &(pSoldier->inv[bSlot]), iDamage, FALSE ); if (fBlowsUp) @@ -5607,13 +6237,14 @@ void CheckEquipmentForDamage( SOLDIERTYPE *pSoldier, INT32 iDamage ) // blow it up! if ( gTacticalStatus.ubAttackBusyCount ) { - IgniteExplosion( pSoldier->ubAttackerID, CenterX( pSoldier->sGridNo ), CenterY( pSoldier->sGridNo ), 0, pSoldier->sGridNo, pSoldier->inv[ bSlot ].usItem, pSoldier->bLevel ); + IgniteExplosion( pSoldier->ubAttackerID, CenterX( pSoldier->sGridNo ), CenterY( pSoldier->sGridNo ), 0, pSoldier->sGridNo, pSoldier->inv[ bSlot ].usItem, pSoldier->pathing.bLevel ); } else { - IgniteExplosion( pSoldier->ubID, CenterX( pSoldier->sGridNo ), CenterY( pSoldier->sGridNo ), 0, pSoldier->sGridNo, pSoldier->inv[ bSlot ].usItem, pSoldier->bLevel ); + IgniteExplosion( pSoldier->ubID, CenterX( pSoldier->sGridNo ), CenterY( pSoldier->sGridNo ), 0, pSoldier->sGridNo, pSoldier->inv[ bSlot ].usItem, pSoldier->pathing.bLevel ); } + //ADB when something in a stack blows up the whole stack goes, so no need to worry about number of items // Remove item! DeleteObj( &(pSoldier->inv[ bSlot ]) ); @@ -5633,8 +6264,11 @@ void CheckEquipmentForFragileItemDamage( SOLDIERTYPE *pSoldier, INT32 iDamage ) UINT8 ubNumberOfObjects; BOOLEAN fPlayedGlassBreak = FALSE; - for (bSlot = 0; bSlot < NUM_INV_SLOTS; bSlot++) + for (bSlot = 0; bSlot < (INT8) pSoldier->inv.size(); bSlot++) { + if (pSoldier->inv[bSlot].exists() == false) { + continue; + } switch( pSoldier->inv[bSlot].usItem ) { case JAR_CREATURE_BLOOD: @@ -5671,7 +6305,7 @@ BOOLEAN DamageItemOnGround( OBJECTTYPE * pObject, INT16 sGridNo, INT8 bLevel, IN // Remove item! return( TRUE ); } - else if ( (pObject->ubNumberOfObjects < 2) && (pObject->ItemData.Generic.bStatus[0] < USABLE) ) + else if ( pObject->exists() == true && (pObject->ubNumberOfObjects < 2) && ((*pObject)[0]->data.objectStatus < USABLE) ) { return( TRUE ); } @@ -5685,7 +6319,7 @@ BOOLEAN DamageItemOnGround( OBJECTTYPE * pObject, INT16 sGridNo, INT8 bLevel, IN INT8 IsMedicalKitItem( OBJECTTYPE *pObject ) { // check item id against current medical kits - if ( Item[pObject->usItem].medicalkit ) + if ( Item[pObject->usItem].medicalkit && pObject->exists() == true) return 1; //switch( pObject->usItem ) @@ -5704,7 +6338,7 @@ void SwapHandItems( SOLDIERTYPE * pSoldier ) BOOLEAN fOk; CHECKV( pSoldier ); - if (pSoldier->inv[HANDPOS].usItem == NOTHING || pSoldier->inv[SECONDHANDPOS].usItem == NOTHING) + if (pSoldier->inv[HANDPOS].exists() == false || pSoldier->inv[SECONDHANDPOS].exists() == false) { // whatever is in the second hand can be swapped to the main hand! SwapObjs( pSoldier, HANDPOS, SECONDHANDPOS, TRUE ); @@ -5715,7 +6349,7 @@ void SwapHandItems( SOLDIERTYPE * pSoldier ) if (TwoHandedItem( pSoldier->inv[SECONDHANDPOS].usItem ) ) { // must move the item in the main hand elsewhere in the inventory - fOk = InternalAutoPlaceObject( pSoldier, &(pSoldier->inv[HANDPOS]), FALSE, HANDPOS ); + fOk = AutoPlaceObject( pSoldier, &(pSoldier->inv[HANDPOS]), FALSE, HANDPOS ); if (!fOk) { return; @@ -5734,9 +6368,9 @@ void SwapOutHandItem( SOLDIERTYPE * pSoldier ) CHECKV( pSoldier ); // puts away the item in the main hand - if (pSoldier->inv[HANDPOS].usItem != NOTHING ) + if (pSoldier->inv[HANDPOS].exists() == true ) { - if (pSoldier->inv[SECONDHANDPOS].usItem == NOTHING) + if (pSoldier->inv[SECONDHANDPOS].exists() == false) { // just swap the hand item to the second hand SwapObjs( pSoldier, HANDPOS, SECONDHANDPOS, TRUE ); @@ -5753,7 +6387,7 @@ void SwapOutHandItem( SOLDIERTYPE * pSoldier ) } // otherwise there's no room for the item anywhere! } - } + } } void WaterDamage( SOLDIERTYPE *pSoldier ) @@ -5762,10 +6396,13 @@ void WaterDamage( SOLDIERTYPE *pSoldier ) INT8 bLoop, bDamage, bDieSize; UINT32 uiRoll; - if ( MercInDeepWater( pSoldier) ) + if ( pSoldier->MercInDeepWater( ) ) { - for ( bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++ ) + for ( bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++ ) { + if (pSoldier->inv[bLoop].exists() == false) { + continue; + } // if there's an item here that can get water damaged... // if (pSoldier->inv[ bLoop ].usItem && Item[pSoldier->inv[ bLoop ].usItem].fFlags & ITEM_WATER_DAMAGES) if (pSoldier->inv[ bLoop ].usItem && Item[pSoldier->inv[ bLoop ].usItem].waterdamages ) @@ -5780,10 +6417,10 @@ void WaterDamage( SOLDIERTYPE *pSoldier ) bDamage = (INT8) (10 - uiRoll); // but don't let anything drop lower than 1% - pSoldier->inv[bLoop].ItemData.Generic.bStatus[0] -= bDamage; - if (pSoldier->inv[bLoop].ItemData.Generic.bStatus[0] < 1) + pSoldier->inv[bLoop][0]->data.objectStatus -= bDamage; + if (pSoldier->inv[bLoop][0]->data.objectStatus < 1) { - pSoldier->inv[bLoop].ItemData.Generic.bStatus[0] = 1; + pSoldier->inv[bLoop][0]->data.objectStatus = 1; } } } @@ -5794,7 +6431,7 @@ void WaterDamage( SOLDIERTYPE *pSoldier ) { // reduce camouflage by 2% per tile of deep water // and 1% for medium water - if ( MercInDeepWater( pSoldier) ) + if ( pSoldier->MercInDeepWater( ) ) pSoldier->bCamo = __max( 0, pSoldier->bCamo - 2 ); else pSoldier->bCamo = __max( 0, pSoldier->bCamo - 1 ); @@ -5807,7 +6444,7 @@ void WaterDamage( SOLDIERTYPE *pSoldier ) { // reduce camouflage by 2% per tile of deep water // and 1% for medium water - if ( MercInDeepWater( pSoldier) ) + if ( pSoldier->MercInDeepWater( ) ) pSoldier->urbanCamo = __max( 0, pSoldier->urbanCamo - 2 ); else pSoldier->urbanCamo = __max( 0, pSoldier->urbanCamo - 1 ); @@ -5820,7 +6457,7 @@ void WaterDamage( SOLDIERTYPE *pSoldier ) { // reduce camouflage by 2% per tile of deep water // and 1% for medium water - if ( MercInDeepWater( pSoldier) ) + if ( pSoldier->MercInDeepWater( ) ) pSoldier->desertCamo = __max( 0, pSoldier->desertCamo - 2 ); else pSoldier->desertCamo = __max( 0, pSoldier->desertCamo - 1 ); @@ -5833,7 +6470,7 @@ void WaterDamage( SOLDIERTYPE *pSoldier ) { // reduce camouflage by 2% per tile of deep water // and 1% for medium water - if ( MercInDeepWater( pSoldier) ) + if ( pSoldier->MercInDeepWater( ) ) pSoldier->snowCamo = __max( 0, pSoldier->snowCamo - 2 ); else pSoldier->snowCamo = __max( 0, pSoldier->snowCamo - 1 ); @@ -5846,8 +6483,8 @@ void WaterDamage( SOLDIERTYPE *pSoldier ) { // Reload palettes.... if ( pSoldier->bInSector ) - { - CreateSoldierPalettes( pSoldier ); + { + pSoldier->CreateSoldierPalettes( ); } ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[STR_CAMMO_WASHED_OFF], pSoldier->name ); } @@ -5857,9 +6494,9 @@ void WaterDamage( SOLDIERTYPE *pSoldier ) - if ( pSoldier->bTeam == gbPlayerNum && pSoldier->bMonsterSmell > 0 ) + if ( pSoldier->bTeam == gbPlayerNum && pSoldier->aiData.bMonsterSmell > 0 ) { - if ( MercInDeepWater( pSoldier) ) + if ( pSoldier->MercInDeepWater( ) ) { bDieSize = 10; } @@ -5869,8 +6506,8 @@ void WaterDamage( SOLDIERTYPE *pSoldier ) } if ( Random( bDieSize ) == 0 ) { - pSoldier->bMonsterSmell--; - } + pSoldier->aiData.bMonsterSmell--; + } } DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); @@ -5881,9 +6518,9 @@ BOOLEAN ApplyCammo( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN *pfGoodAP INT8 bPointsToUse; UINT16 usTotalKitPoints; - (*pfGoodAPs) = TRUE; + (*pfGoodAPs) = TRUE; - if (!Item[pObj->usItem].camouflagekit ) + if (!Item[pObj->usItem].camouflagekit || pObj->exists() == false) { return( FALSE ); } @@ -5897,12 +6534,12 @@ BOOLEAN ApplyCammo( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN *pfGoodAP usTotalKitPoints = TotalPoints( pObj ); if (usTotalKitPoints == 0) { - // HUH??? + // HUH??? return( FALSE ); } //get total camo bonus for kit -- note that camo kits now require the camobonus tag to be set - int itemCamo = Item[pObj->usItem].camobonus + Item[pObj->usItem].urbanCamobonus + Item[pObj->usItem].desertCamobonus + Item[pObj->usItem].snowCamobonus; + //int itemCamo = Item[pObj->usItem].camobonus + Item[pObj->usItem].urbanCamobonus + Item[pObj->usItem].desertCamobonus + Item[pObj->usItem].snowCamobonus; int totalCamo = pSoldier->bCamo + pSoldier->wornCamo + pSoldier->urbanCamo+pSoldier->wornUrbanCamo+pSoldier->desertCamo+pSoldier->wornDesertCamo+pSoldier->snowCamo+pSoldier->wornSnowCamo; if ((totalCamo) >= 100) @@ -5926,15 +6563,15 @@ BOOLEAN ApplyCammo( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN *pfGoodAP pSoldier->urbanCamo = __min( 100, pSoldier->urbanCamo + urban ); pSoldier->desertCamo = __min( 100, pSoldier->desertCamo + desert ); pSoldier->snowCamo = __min( 100, pSoldier->snowCamo + snow ); - + UseKitPoints( pObj, bPointsToUse, pSoldier ); DeductPoints( pSoldier, AP_CAMOFLAGE, 0 ); // Reload palettes.... if ( pSoldier->bInSector ) - { - CreateSoldierPalettes( pSoldier ); + { + pSoldier->CreateSoldierPalettes( ); } return( TRUE ); @@ -5945,9 +6582,9 @@ BOOLEAN ApplyCanteen( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN *pfGood INT16 sPointsToUse; UINT16 usTotalKitPoints; - (*pfGoodAPs) = TRUE; + (*pfGoodAPs) = TRUE; - if (!Item[pObj->usItem].canteen ) + if (!Item[pObj->usItem].canteen || pObj->exists() == false) { return( FALSE ); } @@ -5955,7 +6592,7 @@ BOOLEAN ApplyCanteen( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN *pfGood usTotalKitPoints = TotalPoints( pObj ); if (usTotalKitPoints == 0) { - // HUH??? + // HUH??? return( FALSE ); } @@ -5994,9 +6631,9 @@ BOOLEAN ApplyElixir( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN *pfGoodA INT16 sPointsToUse; UINT16 usTotalKitPoints; - (*pfGoodAPs) = TRUE; + (*pfGoodAPs) = TRUE; - if (pObj->usItem != JAR_ELIXIR ) + if (pObj->usItem != JAR_ELIXIR || pObj->exists() == false) { return( FALSE ); } @@ -6004,7 +6641,7 @@ BOOLEAN ApplyElixir( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN *pfGoodA usTotalKitPoints = TotalPoints( pObj ); if (usTotalKitPoints == 0) { - // HUH??? + // HUH??? return( FALSE ); } @@ -6016,12 +6653,12 @@ BOOLEAN ApplyElixir( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN *pfGoodA DeductPoints( pSoldier, AP_CAMOFLAGE, 0 ); - sPointsToUse = ( MAX_HUMAN_CREATURE_SMELL - pSoldier->bMonsterSmell ) * 2; + sPointsToUse = ( MAX_HUMAN_CREATURE_SMELL - pSoldier->aiData.bMonsterSmell ) * 2; sPointsToUse = __min( sPointsToUse, usTotalKitPoints ); UseKitPoints( pObj, sPointsToUse, pSoldier ); - pSoldier->bMonsterSmell += sPointsToUse / 2; + pSoldier->aiData.bMonsterSmell += sPointsToUse / 2; return( TRUE ); } @@ -6038,7 +6675,10 @@ UINT8 ConvertObjectTypeMoneyValueToProfileMoneyValue( UINT32 uiMoneyAmount ) BOOLEAN ItemIsCool( OBJECTTYPE * pObj ) { - if (pObj->ItemData.Generic.bStatus[0] < 60) + if (pObj->exists() == false) { + return FALSE; + } + if ((*pObj)[0]->data.objectStatus < 60) { return( FALSE ); } @@ -6064,28 +6704,29 @@ void ActivateXRayDevice( SOLDIERTYPE * pSoldier ) { SOLDIERTYPE * pSoldier2; UINT32 uiSlot; - INT8 bBatteries; - if ( Item[pSoldier->inv[ HANDPOS ].usItem].needsbatteries ) + if ( Item[pSoldier->inv[ HANDPOS ].usItem].needsbatteries && pSoldier->inv[ HANDPOS ].exists() == true) { // check for batteries - bBatteries = FindAttachedBatteries( &(pSoldier->inv[HANDPOS]) ); - if ( bBatteries == NO_SLOT ) + OBJECTTYPE* pBatteries = FindAttachedBatteries( &(pSoldier->inv[HANDPOS]) ); + if ( pBatteries == 0 ) { // doesn't work without batteries! return; } // use up 8-12 percent of batteries - if ( Item[pSoldier->inv[ HANDPOS ].usAttachItem[bBatteries]].percentstatusdrainreduction > 0 ) - pSoldier->inv[ HANDPOS ].bAttachStatus[ bBatteries ] -= (INT8)( (8 + Random( 5 )) * (100 - Item[pSoldier->inv[ HANDPOS ].usAttachItem[bBatteries]].percentstatusdrainreduction)/100 ); + if ( Item[pBatteries->usItem].percentstatusdrainreduction > 0 ) + (*pBatteries)[0]->data.objectStatus -= (INT8)( (8 + Random( 5 )) * (100 - Item[(*pBatteries)[0]->data.objectStatus].percentstatusdrainreduction)/100 ); else - pSoldier->inv[ HANDPOS ].bAttachStatus[ bBatteries ] -= (INT8)( (8 + Random( 5 )) ); - if ( pSoldier->inv[ HANDPOS ].bAttachStatus[ bBatteries ] <= 0 ) + (*pBatteries)[0]->data.objectStatus -= (INT8)( (8 + Random( 5 )) ); + if ( (*pBatteries)[0]->data.objectStatus <= 0 ) { // destroy batteries - pSoldier->inv[ HANDPOS ].usAttachItem[ bBatteries ] = NOTHING; - pSoldier->inv[ HANDPOS ].bAttachStatus[ bBatteries ] = 0; + pBatteries->RemoveObjectsFromStack(1); + if (pBatteries->exists() == false) { + pSoldier->inv[HANDPOS].RemoveAttachment(pBatteries); + } } } // first, scan through all mercs and turn off xrayed flag for anyone @@ -6095,10 +6736,10 @@ void ActivateXRayDevice( SOLDIERTYPE * pSoldier ) pSoldier2 = MercSlots[ uiSlot ]; if ( pSoldier2 ) { - if ( (pSoldier2->ubMiscSoldierFlags & SOLDIER_MISC_XRAYED) && (pSoldier2->ubXRayedBy == pSoldier->ubID) ) + if ( (pSoldier2->ubMiscSoldierFlags & SOLDIER_MISC_XRAYED) && (pSoldier2->aiData.ubXRayedBy == pSoldier->ubID) ) { pSoldier2->ubMiscSoldierFlags &= (~SOLDIER_MISC_XRAYED); - pSoldier2->ubXRayedBy = NOBODY; + pSoldier2->aiData.ubXRayedBy = NOBODY; } } } @@ -6111,7 +6752,7 @@ void ActivateXRayDevice( SOLDIERTYPE * pSoldier ) if ( pSoldier2->bTeam != pSoldier->bTeam && PythSpacesAway( pSoldier->sGridNo, pSoldier2->sGridNo ) < XRAY_RANGE ) { pSoldier2->ubMiscSoldierFlags |= SOLDIER_MISC_XRAYED; - pSoldier2->ubXRayedBy = pSoldier->ubID; + pSoldier2->aiData.ubXRayedBy = pSoldier->ubID; } } } @@ -6135,10 +6776,10 @@ void TurnOffXRayEffects( SOLDIERTYPE * pSoldier ) pSoldier2 = MercSlots[ uiSlot ]; if ( pSoldier2 ) { - if ( (pSoldier2->ubMiscSoldierFlags & SOLDIER_MISC_XRAYED) && (pSoldier2->ubXRayedBy == pSoldier->ubID) ) + if ( (pSoldier2->ubMiscSoldierFlags & SOLDIER_MISC_XRAYED) && (pSoldier2->aiData.ubXRayedBy == pSoldier->ubID) ) { pSoldier2->ubMiscSoldierFlags &= (~SOLDIER_MISC_XRAYED); - pSoldier2->ubXRayedBy = NOBODY; + pSoldier2->aiData.ubXRayedBy = NOBODY; } } } @@ -6169,7 +6810,7 @@ void DumpItemsList( void ) for( usItem = 0; usItem < MAXITEMS; usItem++ ) { pItem= &( Item[ usItem ] ); - + if (pItem->ubCoolness > 0 ) { fprintf(FDump, "%28ls %2d $%4d\n", ItemNames[ usItem ], pItem->ubCoolness, pItem->usPrice ); @@ -6187,7 +6828,7 @@ void DumpItemsList( void ) const INT8 STANDARD_STATUS_CUTOFF = 85; // Scale bonus with item status -INT16 BonusReduce( INT16 bonus, INT8 status, INT8 statusCutoff = STANDARD_STATUS_CUTOFF ) +INT16 BonusReduce( INT16 bonus, INT16 status, INT8 statusCutoff = STANDARD_STATUS_CUTOFF ) { if ( bonus > 0 && status < statusCutoff && statusCutoff > 0 && statusCutoff <= 100 ) return ( ( status * 100 ) / statusCutoff * bonus ) / 100; @@ -6196,7 +6837,7 @@ INT16 BonusReduce( INT16 bonus, INT8 status, INT8 statusCutoff = STANDARD_STATUS } // Scale bonus with item status. Status < 50% creates a penalty! -INT16 BonusReduceMore( INT16 bonus, INT8 status, INT8 statusCutoff = 100 ) +INT16 BonusReduceMore( INT16 bonus, INT16 status, INT8 statusCutoff = 100 ) { if ( bonus > 0 && status < statusCutoff && statusCutoff > 0 && statusCutoff <= 100 ) return ( ( ( status * 100 ) / statusCutoff - 50 ) * bonus ) / 50; @@ -6205,7 +6846,7 @@ INT16 BonusReduceMore( INT16 bonus, INT8 status, INT8 statusCutoff = 100 ) } // Some items either work or they don't... -INT16 BonusOnOff( INT16 bonus, INT8 status ) +INT16 BonusOnOff( INT16 bonus, INT16 status ) { if ( bonus > 0 ) return (status >= 50) ? bonus : 0; @@ -6215,15 +6856,16 @@ INT16 BonusOnOff( INT16 bonus, INT8 status ) // Snap: a fast aimbonus check for AI -BOOLEAN IsScoped( const OBJECTTYPE * pObj ) +BOOLEAN IsScoped( OBJECTTYPE * pObj ) { - if ( Item[pObj->usItem].aimbonus > 0 || Item[pObj->ItemData.Gun.usGunAmmoItem].aimbonus > 0 ) - return TRUE; - - for (int i = 0; i < MAX_ATTACHMENTS; i++) - { - if ( Item[pObj->usAttachItem[i]].aimbonus > 0 ) + if (pObj->exists() == true) { + if ( Item[pObj->usItem].aimbonus > 0 || Item[(*pObj)[0]->data.gun.usGunAmmoItem].aimbonus > 0 ) return TRUE; + + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if ( Item[iter->usItem].aimbonus > 0 ) + return TRUE; + } } return FALSE; @@ -6240,84 +6882,89 @@ INT16 GetItemAimBonus( const INVTYPE* pItem, INT32 iRange, UINT8 ubAimTime ) ubAimTime = 1; return ( pItem->aimbonus * ubAimTime * ( iRange - pItem->minrangeforaimbonus ) ) / 100; -} +} INT16 GetAimBonus( OBJECTTYPE * pObj, INT32 iRange, UINT8 ubAimTime ) { - INT16 bns; + INT16 bonus = 0; - bns = BonusReduceMore( GetItemAimBonus( &Item[pObj->usItem], iRange, ubAimTime ), pObj->ItemData.Generic.bStatus[0] ); - bns += GetItemAimBonus( &Item[pObj->ItemData.Gun.usGunAmmoItem], iRange, ubAimTime ); + if (pObj->exists() == true) { + bonus = BonusReduceMore( GetItemAimBonus( &Item[pObj->usItem], iRange, ubAimTime ), (*pObj)[0]->data.objectStatus ); + bonus += GetItemAimBonus( &Item[(*pObj)[0]->data.gun.usGunAmmoItem], iRange, ubAimTime ); - for (int i = 0; i < MAX_ATTACHMENTS; i++) - { - bns += BonusReduceMore( GetItemAimBonus( &Item[pObj->usAttachItem[i]], iRange, ubAimTime ), - pObj->bAttachStatus[i] ); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += BonusReduceMore( GetItemAimBonus( &Item[iter->usItem], iRange, ubAimTime ), (*iter)[0]->data.objectStatus ); + } } - return( bns ); + return( bonus ); } // Madd: check equipment for aim bonus (penalties) INT16 GetGearAimBonus( SOLDIERTYPE * pSoldier, INT32 iRange, UINT8 ubAimTime ) { - INT16 bns=0; + INT16 bonus=0; - for (int j = HELMETPOS; j <= HEAD2POS; j++) + for (int j = HELMETPOS; j <= HEAD2POS; j++) { - bns += GetItemAimBonus( &Item[pSoldier->inv[j].usItem], iRange, ubAimTime ); - for ( int i = 0; i < MAX_ATTACHMENTS; i++) - { - bns += GetItemAimBonus(&Item[pSoldier->inv[j].usAttachItem[i]],iRange,ubAimTime); + OBJECTTYPE* pObj = &pSoldier->inv[j]; + if (pObj->exists() == true) { + bonus += GetItemAimBonus( &Item[pSoldier->inv[j].usItem], iRange, ubAimTime ); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += GetItemAimBonus(&Item[iter->usItem],iRange,ubAimTime); + } } } - return( bns ); + return( bonus ); } // Madd: check equipment for to hit bonus (penalties) INT16 GetGearToHitBonus( SOLDIERTYPE * pSoldier ) { - INT16 bns=0; + INT16 bonus=0; - for (int j = HELMETPOS; j <= HEAD2POS; j++) + for (int j = HELMETPOS; j <= HEAD2POS; j++) { - bns += Item[pSoldier->inv[j].usItem].tohitbonus; - for ( int i = 0; i < MAX_ATTACHMENTS; i++) - { - bns += Item[pSoldier->inv[j].usAttachItem[i]].tohitbonus; + OBJECTTYPE* pObj = &pSoldier->inv[j]; + if (pObj->exists() == true) { + bonus += Item[pSoldier->inv[j].usItem].tohitbonus; + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += Item[iter->usItem].tohitbonus; + } } } - return( bns ); + return( bonus ); } // Madd: check equipment for AP bonus (penalties) INT16 GetGearAPBonus( SOLDIERTYPE * pSoldier ) { - INT16 bns=0; + INT16 bonus=0; - for (int j = HELMETPOS; j <= HEAD2POS; j++) + for (int j = HELMETPOS; j <= HEAD2POS; j++) { - bns += Item[pSoldier->inv[j].usItem].APBonus; - for ( int i = 0; i < MAX_ATTACHMENTS; i++) - { - bns += Item[pSoldier->inv[j].usAttachItem[i]].APBonus; + if (pSoldier->inv[j].exists() == true) { + bonus += Item[pSoldier->inv[j].usItem].APBonus; + OBJECTTYPE* pObj = &pSoldier->inv[j]; + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += Item[iter->usItem].APBonus; + } } } - return( bns ); + return( bonus ); } UINT32 FindRangeBonusAttachment( OBJECTTYPE * pObj ) { - INT8 bLoop; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - if (Item[pObj->usAttachItem[bLoop]].rangebonus > 0 ) - { - return( Item[pObj->usAttachItem[bLoop]].uiIndex ); + if (pObj->exists() == true) { + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if (Item[iter->usItem].rangebonus > 0 ) + { + return( Item[iter->usItem].uiIndex ); + } } } return( NONE ); @@ -6325,21 +6972,19 @@ UINT32 FindRangeBonusAttachment( OBJECTTYPE * pObj ) INT16 GetRangeBonus( OBJECTTYPE * pObj ) { - INT8 bLoop; - INT16 bns=0; + INT16 bonus = 0; + if (pObj->exists() == true) { + bonus = BonusReduce( Item[pObj->usItem].rangebonus, (*pObj)[0]->data.objectStatus ); - bns = BonusReduce( Item[pObj->usItem].rangebonus, pObj->ItemData.Generic.bStatus[0] ); - - if ( pObj->ItemData.Gun.ubGunShotsLeft > 0 ) - bns += Item[pObj->ItemData.Gun.usGunAmmoItem].rangebonus; + if ( (*pObj)[0]->data.gun.ubGunShotsLeft > 0 ) + bonus += Item[(*pObj)[0]->data.gun.usGunAmmoItem].rangebonus; - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - if ( !Item[pObj->usAttachItem[bLoop]].duckbill || ( Item[pObj->usAttachItem[bLoop]].duckbill && pObj->ItemData.Gun.ubGunAmmoType == AMMO_BUCKSHOT )) - bns += BonusReduce( Item[pObj->usAttachItem[bLoop]].rangebonus, pObj->bAttachStatus[bLoop] ); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if ( !Item[iter->usItem].duckbill || ( Item[iter->usItem].duckbill && (*pObj)[0]->data.gun.ubGunAmmoType == AMMO_BUCKSHOT )) + bonus += BonusReduce( Item[iter->usItem].rangebonus, (*iter)[0]->data.objectStatus ); + } } - - return( bns ); + return( bonus ); } @@ -6362,295 +7007,290 @@ INT16 LaserBonus( const INVTYPE * pItem, INT32 iRange, UINT8 bLightLevel ) // Beyond bestlaserrange laser bonus drops linearly to 0 INT16 bonus = ( pItem->tohitbonus * (iMaxLaserRange - iRange) ) / ( iMaxLaserRange - pItem->bestlaserrange ); - + return (bonus > 0 ? bonus : 0); } } INT16 GetToHitBonus( OBJECTTYPE * pObj, INT32 iRange, UINT8 bLightLevel, BOOLEAN fProneStance ) { - INT16 bns=0; + INT16 bonus=0; // Snap: bipod is effective only in the prone stance - if ( fProneStance ) - bns += Item[pObj->usItem].bipod; - - bns += BonusReduceMore( LaserBonus( &Item[pObj->usItem], iRange, bLightLevel), pObj->ItemData.Generic.bStatus[0] ); - bns += Item[pObj->ItemData.Gun.usGunAmmoItem].tohitbonus; - - for (int i = 0; i < MAX_ATTACHMENTS; i++) - { + if (pObj->exists() == true) { if ( fProneStance ) - bns += Item[pObj->usAttachItem[i]].bipod; + bonus += Item[pObj->usItem].bipod; - bns += BonusReduceMore( LaserBonus( &Item[pObj->usAttachItem[i]], iRange, bLightLevel), pObj->bAttachStatus[i] ); + bonus += BonusReduceMore( LaserBonus( &Item[pObj->usItem], iRange, bLightLevel), (*pObj)[0]->data.objectStatus ); + bonus += Item[(*pObj)[0]->data.gun.usGunAmmoItem].tohitbonus; + + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if ( fProneStance ) + bonus += Item[iter->usItem].bipod; + + bonus += BonusReduceMore( LaserBonus( &Item[iter->usItem], iRange, bLightLevel), (*iter)[0]->data.objectStatus ); + } } // Snap (TODO): add special treatment of laser scopes - return( bns ); + return( bonus ); } INT16 GetBurstToHitBonus( OBJECTTYPE * pObj, BOOLEAN fProneStance ) { - INT16 bns=0; + INT16 bonus=0; // Snap: bipod is effective only in the prone stance - if ( fProneStance ) - bns += Item[pObj->usItem].bipod; - - bns += BonusReduceMore( Item[pObj->usItem].bursttohitbonus, pObj->ItemData.Generic.bStatus[0] ); - bns += Item[pObj->ItemData.Gun.usGunAmmoItem].bursttohitbonus ; - - for (int i = 0; i < MAX_ATTACHMENTS; i++) - { + if (pObj->exists() == true) { if ( fProneStance ) - bns += Item[pObj->usAttachItem[i]].bipod; + bonus += Item[pObj->usItem].bipod; - bns += BonusReduceMore( Item[pObj->usAttachItem[i]].bursttohitbonus, pObj->bAttachStatus[i] ); + bonus += BonusReduceMore( Item[pObj->usItem].bursttohitbonus, (*pObj)[0]->data.objectStatus ); + bonus += Item[(*pObj)[0]->data.gun.usGunAmmoItem].bursttohitbonus ; + + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if ( fProneStance ) + bonus += Item[iter->usItem].bipod; + + bonus += BonusReduceMore( Item[iter->usItem].bursttohitbonus, (*iter)[0]->data.objectStatus ); + } } - return( bns ); + return( bonus ); } INT16 GetDamageBonus( OBJECTTYPE * pObj ) { - INT8 bLoop; - INT16 bns=0; + INT16 bonus = 0; + if (pObj->exists() == true) { + bonus = BonusReduce( Item[pObj->usItem].damagebonus, (*pObj)[0]->data.objectStatus ); - bns = BonusReduce( Item[pObj->usItem].damagebonus, pObj->ItemData.Generic.bStatus[0] ); - - if ( pObj->ItemData.Gun.ubGunShotsLeft > 0 ) - bns += Item[pObj->ItemData.Gun.usGunAmmoItem].damagebonus ; + if ( (*pObj)[0]->data.gun.ubGunShotsLeft > 0 ) + bonus += Item[(*pObj)[0]->data.gun.usGunAmmoItem].damagebonus ; - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - bns += BonusReduce( Item[pObj->usAttachItem[bLoop]].damagebonus, - pObj->bAttachStatus[bLoop] ); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += BonusReduce( Item[iter->usItem].damagebonus, (*iter)[0]->data.objectStatus ); + } } - return( bns ); + return( bonus ); } INT16 GetMeleeDamageBonus( OBJECTTYPE * pObj ) { - INT8 bLoop; - INT16 bns=0; + INT16 bonus = 0; + if (pObj->exists() == true) { + bonus = BonusReduce( Item[pObj->usItem].meleedamagebonus, (*pObj)[0]->data.objectStatus); + bonus += Item[(*pObj)[0]->data.gun.usGunAmmoItem].meleedamagebonus ; - bns = BonusReduce( Item[pObj->usItem].meleedamagebonus, pObj->ItemData.Generic.bStatus[0]); - bns += Item[pObj->ItemData.Gun.usGunAmmoItem].meleedamagebonus ; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - bns += BonusReduce( Item[pObj->usAttachItem[bLoop]].meleedamagebonus, - pObj->bAttachStatus[bLoop] ); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += BonusReduce( Item[iter->usItem].meleedamagebonus, (*iter)[0]->data.objectStatus ); + } } - return( bns ); + return( bonus ); } INT16 GetPercentAPReduction( OBJECTTYPE * pObj ) { - INT8 bLoop; - INT16 bns=0; + INT16 bonus = 0; + if (pObj->exists() == true) { + bonus = BonusReduceMore( Item[pObj->usItem].percentapreduction, (*pObj)[0]->data.objectStatus ); + bonus += Item[(*pObj)[0]->data.gun.usGunAmmoItem].percentapreduction; - bns = BonusReduceMore( Item[pObj->usItem].percentapreduction, pObj->ItemData.Generic.bStatus[0] ); - bns += Item[pObj->ItemData.Gun.usGunAmmoItem].percentapreduction; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - bns += BonusReduceMore( Item[pObj->usAttachItem[bLoop]].percentapreduction, - pObj->bAttachStatus[bLoop] ); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += BonusReduceMore( Item[iter->usItem].percentapreduction, + (*iter)[0]->data.objectStatus ); + } } - return( bns ); + return( bonus ); } INT16 GetMagSizeBonus( OBJECTTYPE * pObj ) { - INT8 bLoop; - INT16 bns=0; + INT16 bonus = 0; + if (pObj->exists() == true) { + bonus = BonusOnOff( Item[pObj->usItem].magsizebonus, (*pObj)[0]->data.objectStatus ); - bns = BonusOnOff( Item[pObj->usItem].magsizebonus, pObj->ItemData.Generic.bStatus[0] ); -// bns = bns + Item[pObj->ItemData.Gun.usGunAmmoItem].magsizebonus ; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - bns += BonusOnOff( Item[pObj->usAttachItem[bLoop]].magsizebonus, pObj->bAttachStatus[bLoop] ); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += BonusOnOff( Item[iter->usItem].magsizebonus, (*iter)[0]->data.objectStatus ); + } } - return( bns ); + return( bonus ); } INT16 GetBurstSizeBonus( OBJECTTYPE * pObj ) { - INT8 bLoop; - INT16 bns=0; + INT16 bonus = 0; + if (pObj->exists() == true) { + bonus = BonusOnOff( Item[pObj->usItem].burstsizebonus, (*pObj)[0]->data.objectStatus ); + bonus += Item[(*pObj)[0]->data.gun.usGunAmmoItem].burstsizebonus ; - bns = BonusOnOff( Item[pObj->usItem].burstsizebonus, pObj->ItemData.Generic.bStatus[0] ); - bns += Item[pObj->ItemData.Gun.usGunAmmoItem].burstsizebonus ; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - bns += BonusOnOff( Item[pObj->usAttachItem[bLoop]].burstsizebonus, pObj->bAttachStatus[bLoop] ); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += BonusOnOff( Item[iter->usItem].burstsizebonus, (*iter)[0]->data.objectStatus ); + } } - return( bns ); + return( bonus ); } INT16 GetRateOfFireBonus( OBJECTTYPE * pObj ) { - INT8 bLoop; - INT16 bns=0; + INT16 bonus=0; - if( (MAXITEMS <= pObj->usItem) || (MAXITEMS <= pObj->ItemData.Gun.usGunAmmoItem) ) - { - DebugMsg(TOPIC_JA2, DBG_LEVEL_1, String("GetRateOfFireBonus would crash: pObj->usItem=%d or pObj->ItemData.Gun.usGunAmmoItem=%d ist higher than max %d", pObj->usItem, pObj->ItemData.Gun.usGunAmmoItem, MAXITEMS )); - ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"GetRateOfFireBonus would crash: pObj->usItem=%d or pObj->ItemData.Gun.usGunAmmoItem=%d ist higher than max %d", pObj->usItem, pObj->ItemData.Gun.usGunAmmoItem, MAXITEMS ); - AssertMsg( 0, "GetRateOfFireBonus would crash" ); - return 0; /* cannot calculate Bonus, this only happens sometimes in FULLSCREEN */ - } + if (pObj->exists() == true) { + if( (MAXITEMS <= pObj->usItem) || (MAXITEMS <= (*pObj)[0]->data.gun.usGunAmmoItem) ) + { + DebugMsg(TOPIC_JA2, DBG_LEVEL_1, String("GetRateOfFireBonus would crash: pObj->usItem=%d or (*pObj)[0]->data.gun.usGunAmmoItem=%d ist higher than max %d", pObj->usItem, (*pObj)[0]->data.gun.usGunAmmoItem, MAXITEMS )); + ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"GetRateOfFireBonus would crash: pObj->usItem=%d or (*pObj)[0]->data.gun.usGunAmmoItem=%d ist higher than max %d", pObj->usItem, (*pObj)[0]->data.gun.usGunAmmoItem, MAXITEMS ); + AssertMsg( 0, "GetRateOfFireBonus would crash" ); + return 0; /* cannot calculate Bonus, this only happens sometimes in FULLSCREEN */ + } - bns = BonusReduceMore( Item[pObj->usItem].rateoffirebonus, pObj->ItemData.Generic.bStatus[0] ); - bns += Item[pObj->ItemData.Gun.usGunAmmoItem].rateoffirebonus ; + bonus = BonusReduceMore( Item[pObj->usItem].rateoffirebonus, (*pObj)[0]->data.objectStatus ); + bonus += Item[(*pObj)[0]->data.gun.usGunAmmoItem].rateoffirebonus ; - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - bns += BonusReduceMore( Item[pObj->usAttachItem[bLoop]].rateoffirebonus, pObj->bAttachStatus[bLoop] ); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += BonusReduceMore( Item[iter->usItem].rateoffirebonus, (*iter)[0]->data.objectStatus ); + } } - return( bns ); + return( bonus ); } INT16 GetAutoToHitBonus( OBJECTTYPE * pObj, BOOLEAN fProneStance ) { - INT16 bns=0; + INT16 bonus=0; // Snap: bipod is effective only in the prone stance - if ( fProneStance ) - bns += Item[pObj->usItem].bipod; - - - bns += BonusReduceMore( Item[pObj->usItem].autofiretohitbonus, pObj->ItemData.Generic.bStatus[0] ); - - bns += Item[pObj->ItemData.Gun.usGunAmmoItem].autofiretohitbonus ; - - for (int i = 0; i < MAX_ATTACHMENTS; i++) - { + if (pObj->exists() == true) { if ( fProneStance ) - bns += Item[pObj->usAttachItem[i]].bipod; + bonus += Item[pObj->usItem].bipod; - bns += BonusReduceMore( Item[pObj->usAttachItem[i]].autofiretohitbonus, pObj->bAttachStatus[i] ); + bonus += BonusReduceMore( Item[pObj->usItem].autofiretohitbonus, (*pObj)[0]->data.objectStatus ); + + bonus += Item[(*pObj)[0]->data.gun.usGunAmmoItem].autofiretohitbonus ; + + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if ( fProneStance ) + bonus += Item[iter->usItem].bipod; + + bonus += BonusReduceMore( Item[iter->usItem].autofiretohitbonus, (*iter)[0]->data.objectStatus ); + } } - return( bns ); + return( bonus ); } INT16 GetPercentReadyTimeAPReduction( OBJECTTYPE * pObj ) { - INT8 bLoop; - INT16 bns=0; + INT16 bonus = 0; + if (pObj->exists() == true) { + bonus = BonusReduceMore( Item[pObj->usItem].percentreadytimeapreduction, (*pObj)[0]->data.objectStatus ); + bonus += Item[(*pObj)[0]->data.gun.usGunAmmoItem].percentreadytimeapreduction; - bns = BonusReduceMore( Item[pObj->usItem].percentreadytimeapreduction, pObj->ItemData.Generic.bStatus[0] ); - bns += Item[pObj->ItemData.Gun.usGunAmmoItem].percentreadytimeapreduction; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - bns += BonusReduceMore( Item[pObj->usAttachItem[bLoop]].percentreadytimeapreduction, pObj->bAttachStatus[bLoop] ); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += BonusReduceMore( Item[iter->usItem].percentreadytimeapreduction, (*iter)[0]->data.objectStatus ); + } } - return( bns ); + return( bonus ); } INT16 GetPercentAutofireAPReduction( OBJECTTYPE * pObj ) { - INT8 bLoop; - INT16 bns=0; + INT16 bonus = 0; + if (pObj->exists() == true) { + bonus = BonusReduceMore( Item[pObj->usItem].percentautofireapreduction, (*pObj)[0]->data.objectStatus ); + bonus += Item[(*pObj)[0]->data.gun.usGunAmmoItem].percentautofireapreduction; - bns = BonusReduceMore( Item[pObj->usItem].percentautofireapreduction, pObj->ItemData.Generic.bStatus[0] ); - bns += Item[pObj->ItemData.Gun.usGunAmmoItem].percentautofireapreduction; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - bns += BonusReduceMore( Item[pObj->usAttachItem[bLoop]].percentautofireapreduction, pObj->bAttachStatus[bLoop] ); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += BonusReduceMore( Item[iter->usItem].percentautofireapreduction, (*iter)[0]->data.objectStatus ); + } } - return( bns ); + return( bonus ); } INT16 GetPercentReloadTimeAPReduction( OBJECTTYPE * pObj ) { - INT8 bLoop; - INT16 bns=0; + INT16 bonus = 0; + if (pObj->exists() == true) { + BonusReduceMore( Item[pObj->usItem].percentreloadtimeapreduction, (*pObj)[0]->data.objectStatus ); + bonus += Item[(*pObj)[0]->data.gun.usGunAmmoItem].percentreloadtimeapreduction; - bns = BonusReduceMore( Item[pObj->usItem].percentreloadtimeapreduction, pObj->ItemData.Generic.bStatus[0] ); - bns += Item[pObj->ItemData.Gun.usGunAmmoItem].percentreloadtimeapreduction; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - bns += BonusReduceMore( Item[pObj->usAttachItem[bLoop]].percentreloadtimeapreduction, pObj->bAttachStatus[bLoop] ); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += BonusReduceMore( Item[iter->usItem].percentreloadtimeapreduction, (*iter)[0]->data.objectStatus ); + } } - return( bns ); + return( bonus ); } INT16 GetPercentBurstFireAPReduction( OBJECTTYPE * pObj ) { - INT8 bLoop; - INT16 bns=0; + INT16 bonus = 0; + if (pObj->exists() == true) { + BonusReduceMore( Item[pObj->usItem].percentburstfireapreduction, (*pObj)[0]->data.objectStatus ); + bonus += Item[(*pObj)[0]->data.gun.usGunAmmoItem].percentburstfireapreduction; - bns = BonusReduceMore( Item[pObj->usItem].percentburstfireapreduction, pObj->ItemData.Generic.bStatus[0] ); - bns += Item[pObj->ItemData.Gun.usGunAmmoItem].percentburstfireapreduction; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - bns += BonusReduceMore( Item[pObj->usAttachItem[bLoop]].percentburstfireapreduction, pObj->bAttachStatus[bLoop] ); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += BonusReduceMore( Item[iter->usItem].percentburstfireapreduction, (*iter)[0]->data.objectStatus ); + } } - return( bns ); + return( bonus ); } INT16 GetVisionRangeBonus( SOLDIERTYPE * pSoldier ) { - INT16 bns=0; + INT16 bonus=0; OBJECTTYPE *pObj; UINT16 usItem; INVTYPE *pItem; - for (int i = HELMETPOS; i < BIGPOCK1POS; i++) + //ADB and AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;) + bool usingGunScope = WeaponReady(pSoldier); + // CHRISL: + for (int i = BODYPOSSTART; i < BODYPOSFINAL; i++) { // Okay, it's time for some optimization here too pObj = &( pSoldier->inv[i]); - usItem = pObj->usItem; - pItem = &(Item[usItem]); + if (pObj->exists() == true) { + usItem = pObj->usItem; + pItem = &(Item[usItem]); - // Snap (TODO): binoculars and such should not be active by default - if ( (i == HANDPOS || i == SECONDHANDPOS) && (pItem->usItemClass & IC_ARMOUR || pItem->usItemClass & IC_FACE )) - { - continue; - } + // Snap (TODO): binoculars and such should not be active by default + if ( (i == HANDPOS || i == SECONDHANDPOS) && (pItem->usItemClass & IC_ARMOUR || pItem->usItemClass & IC_FACE )) + { + continue; + } - if (!IsWeapon(usItem) || (IsWeapon(usItem) && WeaponReady(pSoldier) ) ) - { - bns += BonusReduceMore( pItem->visionrangebonus, pObj->ItemData.Generic.bStatus[0] ); + if (!IsWeapon(usItem) || (IsWeapon(usItem) && usingGunScope == true) ) + { + bonus += BonusReduceMore( pItem->visionrangebonus, (*pObj)[0]->data.objectStatus ); + } } } // Snap: check only attachments on a readied weapon! // 0verhaul: Moved this bug fix into WeaponReady so that all CTH modifier functions may benefit from this fix //AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;) - if ( WeaponReady(pSoldier) ) + if ( usingGunScope == true ) { pObj = &( pSoldier->inv[HANDPOS]); - - for (int i=0; i < MAX_ATTACHMENTS; i++) - { - bns += BonusReduceMore( Item[pObj->usAttachItem[i]].visionrangebonus, pObj->bAttachStatus[i] ); + if (pObj->exists() == true) { + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += BonusReduceMore( Item[iter->usItem].visionrangebonus, (*iter)[0]->data.objectStatus ); + } } } - return( bns ); + return( bonus ); } // Snap: Scale night vision bonus with light level @@ -6665,291 +7305,323 @@ INT16 NightBonusScale( INT16 bonus, UINT8 bLightLevel ) NORMAL_LIGHTLEVEL_NIGHT - NORMAL_LIGHTLEVEL_DAY ); } else return 0; -} +} INT16 GetNightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel ) { - INT16 bns=0; + INT16 bonus=0; OBJECTTYPE *pObj; UINT16 usItem; INVTYPE *pItem; - for (int i = HELMETPOS; i < BIGPOCK1POS; i++) + //ADB and AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;) + bool usingGunScope = WeaponReady(pSoldier); + // CHRISL: + for (int i = BODYPOSSTART; i < BODYPOSFINAL; i++) { // More optimization pObj = &( pSoldier->inv[i]); - usItem = pObj->usItem; - pItem = &(Item[usItem]); + if (pObj->exists() == true) { + usItem = pObj->usItem; + pItem = &(Item[usItem]); - // Snap (TODO): binoculars and such should not be active by default - if ( (i == HANDPOS || i == SECONDHANDPOS) && (pItem->usItemClass & IC_ARMOUR || pItem->usItemClass & IC_FACE )) - { - continue; - } + // Snap (TODO): binoculars and such should not be active by default + if ( (i == HANDPOS || i == SECONDHANDPOS) && (pItem->usItemClass & IC_ARMOUR || pItem->usItemClass & IC_FACE )) + { + continue; + } - if (!IsWeapon(usItem) || (IsWeapon(usItem) && WeaponReady(pSoldier) ) ) - { - bns += BonusReduceMore( - NightBonusScale( pItem->nightvisionrangebonus, bLightLevel ), - pObj->ItemData.Generic.bStatus[0] ); + if (!IsWeapon(usItem) || (IsWeapon(usItem) && usingGunScope == true ) ) + { + bonus += BonusReduceMore( + NightBonusScale( pItem->nightvisionrangebonus, bLightLevel ), + (*pObj)[0]->data.objectStatus ); + } } } // Snap: check only attachments on a raised weapon! - if ( WeaponReady(pSoldier) ) + if ( usingGunScope == true ) { pObj = &( pSoldier->inv[HANDPOS]); - - for (int i=0; i < MAX_ATTACHMENTS; i++) - { - bns += BonusReduceMore( - NightBonusScale( Item[pObj->usAttachItem[i]].nightvisionrangebonus, bLightLevel ), - pObj->bAttachStatus[i] ); + if (pObj->exists() == true) { + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += BonusReduceMore( + NightBonusScale( Item[iter->usItem].nightvisionrangebonus, bLightLevel ), + (*iter)[0]->data.objectStatus ); + } } } - return( bns ); + return( bonus ); } INT16 GetCaveVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel ) { - INT16 bns=0; + INT16 bonus=0; OBJECTTYPE *pObj; UINT16 usItem; INVTYPE *pItem; - for (int i = 0; i < BIGPOCK1POS; i++) + //ADB and AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;) + bool usingGunScope = WeaponReady(pSoldier); + // CHRISL: + for (int i = BODYPOSSTART; i < BODYPOSFINAL; i++) { // More optimization pObj = &( pSoldier->inv[i]); - usItem = pObj->usItem; - pItem = &(Item[usItem]); + if (pObj->exists() == true) { + usItem = pObj->usItem; + pItem = &(Item[usItem]); - // Snap (TODO): binoculars and such should not be active by default - if ( (i == HANDPOS || i == SECONDHANDPOS) && - (pItem->usItemClass & IC_ARMOUR || pItem->usItemClass & IC_FACE )) - { - continue; - } + // Snap (TODO): binoculars and such should not be active by default + if ( (i == HANDPOS || i == SECONDHANDPOS) && + (pItem->usItemClass & IC_ARMOUR || pItem->usItemClass & IC_FACE )) + { + continue; + } - if (!IsWeapon(usItem) || (IsWeapon(usItem) && WeaponReady(pSoldier) ) ) - { - bns += BonusReduceMore( - NightBonusScale( pItem->cavevisionrangebonus, bLightLevel ), - pObj->ItemData.Generic.bStatus[0] ); + if (!IsWeapon(usItem) || (IsWeapon(usItem) && usingGunScope == true ) ) + { + bonus += BonusReduceMore( + NightBonusScale( pItem->cavevisionrangebonus, bLightLevel ), + (*pObj)[0]->data.objectStatus ); + } } } // Snap: check only attachments on a raised weapon! - if ( WeaponReady(pSoldier) ) + if ( usingGunScope == true ) { pObj = &( pSoldier->inv[HANDPOS]); - - for (int i=0; i < MAX_ATTACHMENTS; i++) - { - bns += BonusReduceMore( - NightBonusScale( Item[pObj->usAttachItem[i]].cavevisionrangebonus, bLightLevel ), - pObj->bAttachStatus[i] ); + if (pObj->exists() == true) { + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += BonusReduceMore( + NightBonusScale( Item[iter->usItem].cavevisionrangebonus, bLightLevel ), + (*iter)[0]->data.objectStatus ); + } } } - return( bns ); + return( bonus ); } INT16 GetDayVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel ) { - INT16 bns=0; + INT16 bonus=0; OBJECTTYPE *pObj; UINT16 usItem; INVTYPE *pItem; // Snap: Scale the bonus with the light level - for (int i = 0; i < BIGPOCK1POS; i++) + //ADB and AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;) + bool usingGunScope = WeaponReady(pSoldier); + // CHRISL: + for (int i = BODYPOSSTART; i < BODYPOSFINAL; i++) { // More optimization pObj = &( pSoldier->inv[i]); - usItem = pObj->usItem; - pItem = &(Item[usItem]); + if (pObj->exists() == true) { + usItem = pObj->usItem; + pItem = &(Item[usItem]); - // Snap (TODO): binoculars and such should not be active by default - if ( (i == HANDPOS || i == SECONDHANDPOS) && - (pItem->usItemClass & IC_ARMOUR || pItem->usItemClass & IC_FACE )) - { - continue; - } + // Snap (TODO): binoculars and such should not be active by default + if ( (i == HANDPOS || i == SECONDHANDPOS) && + (pItem->usItemClass & IC_ARMOUR || pItem->usItemClass & IC_FACE )) + { + continue; + } - if (!IsWeapon(usItem) || (IsWeapon(usItem) && WeaponReady(pSoldier) ) ) - { - bns += BonusReduceMore( idiv( pItem->dayvisionrangebonus - * (NORMAL_LIGHTLEVEL_NIGHT - bLightLevel), NORMAL_LIGHTLEVEL_NIGHT ), - pObj->ItemData.Generic.bStatus[0] ); + if (!IsWeapon(usItem) || (IsWeapon(usItem) && usingGunScope == true ) ) + { + bonus += BonusReduceMore( idiv( pItem->dayvisionrangebonus + * (NORMAL_LIGHTLEVEL_NIGHT - bLightLevel), NORMAL_LIGHTLEVEL_NIGHT ), + (*pObj)[0]->data.objectStatus ); + } } } // Snap: check only attachments on a raised weapon! - if ( WeaponReady(pSoldier) ) + if ( usingGunScope == true ) { pObj = &( pSoldier->inv[HANDPOS]); - - for (int i=0; i < MAX_ATTACHMENTS; i++) - { - bns += BonusReduceMore( idiv( Item[pObj->usAttachItem[i]].dayvisionrangebonus - * (NORMAL_LIGHTLEVEL_NIGHT - bLightLevel), NORMAL_LIGHTLEVEL_NIGHT ), - pObj->bAttachStatus[i] ); + if (pObj->exists() == true) { + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += BonusReduceMore( idiv( Item[iter->usItem].dayvisionrangebonus + * (NORMAL_LIGHTLEVEL_NIGHT - bLightLevel), NORMAL_LIGHTLEVEL_NIGHT ), + (*iter)[0]->data.objectStatus ); + } } } - return( bns ); + return( bonus ); } INT16 GetBrightLightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel ) { - INT16 bns=0; + INT16 bonus=0; OBJECTTYPE *pObj; UINT16 usItem; INVTYPE *pItem; // Snap: Scale the bonus with the light level - for (int i = 0; i < BIGPOCK1POS; i++) + //ADB and AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;) + bool usingGunScope = WeaponReady(pSoldier); + // CHRISL: + for (int i = BODYPOSSTART; i < BODYPOSFINAL; i++) { // More optimization pObj = &( pSoldier->inv[i]); - usItem = pObj->usItem; - pItem = &(Item[usItem]); + if (pObj->exists() == true) { + usItem = pObj->usItem; + pItem = &(Item[usItem]); - // Snap (TODO): binoculars and such should not be active by default - if ( (i == HANDPOS || i == SECONDHANDPOS) && - (pItem->usItemClass & IC_ARMOUR || pItem->usItemClass & IC_FACE )) - { - continue; - } + // Snap (TODO): binoculars and such should not be active by default + if ( (i == HANDPOS || i == SECONDHANDPOS) && + (pItem->usItemClass & IC_ARMOUR || pItem->usItemClass & IC_FACE )) + { + continue; + } - if (!IsWeapon(usItem) || (IsWeapon(usItem) && WeaponReady(pSoldier) ) ) - { - bns += BonusReduceMore( idiv( pItem->brightlightvisionrangebonus - * (NORMAL_LIGHTLEVEL_DAY - bLightLevel), NORMAL_LIGHTLEVEL_DAY ), - pObj->ItemData.Generic.bStatus[0] ); + if (!IsWeapon(usItem) || (IsWeapon(usItem) && usingGunScope == true ) ) + { + bonus += BonusReduceMore( idiv( pItem->brightlightvisionrangebonus + * (NORMAL_LIGHTLEVEL_DAY - bLightLevel), NORMAL_LIGHTLEVEL_DAY ), + (*pObj)[0]->data.objectStatus ); + } } } // Snap: check only attachments on a raised weapon! - if ( WeaponReady(pSoldier) ) + if ( usingGunScope == true ) { pObj = &( pSoldier->inv[HANDPOS]); - - for (int i=0; i < MAX_ATTACHMENTS; i++) - { - bns += BonusReduceMore( idiv( Item[pObj->usAttachItem[i]].brightlightvisionrangebonus - * (NORMAL_LIGHTLEVEL_DAY - bLightLevel), NORMAL_LIGHTLEVEL_DAY ), - pObj->bAttachStatus[i] ); + if (pObj->exists() == true) { + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += BonusReduceMore( idiv( Item[iter->usItem].brightlightvisionrangebonus + * (NORMAL_LIGHTLEVEL_DAY - bLightLevel), NORMAL_LIGHTLEVEL_DAY ), + (*iter)[0]->data.objectStatus ); + } } } - return( bns ); + return( bonus ); } INT16 GetTotalVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel ) { - INT16 bns = GetVisionRangeBonus(pSoldier); + INT16 bonus = GetVisionRangeBonus(pSoldier); - if ( bLightLevel > NORMAL_LIGHTLEVEL_DAY ) + if ( bLightLevel > NORMAL_LIGHTLEVEL_DAY ) { - if ( pSoldier->bLevel == 0 ) + if ( pSoldier->pathing.bLevel == 0 ) { - bns += GetNightVisionRangeBonus(pSoldier, bLightLevel); + bonus += GetNightVisionRangeBonus(pSoldier, bLightLevel); } - else + else { - bns += GetCaveVisionRangeBonus(pSoldier, bLightLevel); + bonus += GetCaveVisionRangeBonus(pSoldier, bLightLevel); } } - if ( bLightLevel < NORMAL_LIGHTLEVEL_NIGHT ) + if ( bLightLevel < NORMAL_LIGHTLEVEL_NIGHT ) { - bns += GetDayVisionRangeBonus(pSoldier, bLightLevel); + bonus += GetDayVisionRangeBonus(pSoldier, bLightLevel); } - if ( bLightLevel < NORMAL_LIGHTLEVEL_DAY ) + if ( bLightLevel < NORMAL_LIGHTLEVEL_DAY ) { - bns += GetBrightLightVisionRangeBonus(pSoldier, bLightLevel); + bonus += GetBrightLightVisionRangeBonus(pSoldier, bLightLevel); } - return bns; + return bonus; } UINT8 GetPercentTunnelVision( SOLDIERTYPE * pSoldier ) { - UINT8 bns = 0; + UINT8 bonus = 0; UINT16 usItem; INVTYPE *pItem; - for (int i = HELMETPOS; i < BIGPOCK1POS; i++) + //ADB and AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;) + bool usingGunScope = WeaponReady(pSoldier); + // CHRISL: + for (int i = BODYPOSSTART; i < BODYPOSFINAL; i++) { // Okay, it's time for some optimization here - usItem = pSoldier->inv[i].usItem; - pItem = &(Item[usItem]); + if (pSoldier->inv[i].exists() == true) { + usItem = pSoldier->inv[i].usItem; + pItem = &(Item[usItem]); - if ( (i == HANDPOS || i == SECONDHANDPOS) && (pItem->usItemClass & IC_ARMOUR || pItem->usItemClass & IC_FACE )) - { - continue; - } + if ( (i == HANDPOS || i == SECONDHANDPOS) && (pItem->usItemClass & IC_ARMOUR || pItem->usItemClass & IC_FACE )) + { + continue; + } - if ( !IsWeapon(usItem) ) - { - bns = __max( bns, pItem->percenttunnelvision ); + if ( !IsWeapon(usItem) ) + { + bonus = __max( bonus, pItem->percenttunnelvision ); + } } } // Snap: check only attachments on a raised weapon! - if ( WeaponReady(pSoldier) ) + if ( usingGunScope == true ) { - OBJECTTYPE *pInv = &(pSoldier->inv[HANDPOS]); - usItem = pInv->usItem; - pItem = &(Item[usItem]); + OBJECTTYPE *pObj = &(pSoldier->inv[HANDPOS]); + if (pObj->exists() == true) { + usItem = pObj->usItem; + pItem = &(Item[usItem]); - if ( IsWeapon(usItem) ) //if not a weapon, then it was added already above - bns += Item[usItem].percenttunnelvision; + if ( IsWeapon(usItem) ) //if not a weapon, then it was added already above + bonus += Item[usItem].percenttunnelvision; - for (int i=0; i < MAX_ATTACHMENTS; i++) - { - bns += Item[pInv->usAttachItem[i]].percenttunnelvision; + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += Item[iter->usItem].percenttunnelvision; + } } } if ( PTR_OURTEAM ) // Madd: adjust tunnel vision by difficulty level - return( bns ); + return( bonus ); else - return bns / gGameOptions.ubDifficultyLevel; + return bonus / gGameOptions.ubDifficultyLevel; } BOOLEAN HasThermalOptics( SOLDIERTYPE * pSoldier ) { - for (int i = 0; i < BIGPOCK1POS; i++) + //ADB and AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;) + bool usingGunScope = WeaponReady(pSoldier); + for (int i = BODYPOSSTART; i < BODYPOSFINAL; i++) { - if ( (i == HANDPOS || i == SECONDHANDPOS) && - (Item[pSoldier->inv[i].usItem].usItemClass & IC_ARMOUR || Item[pSoldier->inv[i].usItem].usItemClass & IC_FACE )) - { - continue; - } + if (pSoldier->inv[i].exists() == true) { + if ( (i == HANDPOS || i == SECONDHANDPOS) && + (Item[pSoldier->inv[i].usItem].usItemClass & IC_ARMOUR || Item[pSoldier->inv[i].usItem].usItemClass & IC_FACE )) + { + continue; + } - if (!IsWeapon(pSoldier->inv[i].usItem) || (IsWeapon(pSoldier->inv[i].usItem) && WeaponReady(pSoldier) ) ) - { - if (Item[pSoldier->inv[i].usItem].thermaloptics) - return TRUE; + if (!IsWeapon(pSoldier->inv[i].usItem) || (IsWeapon(pSoldier->inv[i].usItem) && usingGunScope == true) ) + { + if (Item[pSoldier->inv[i].usItem].thermaloptics) + return TRUE; + } } } // Snap: check only attachments on a raised weapon! - if ( WeaponReady(pSoldier) ) + if ( usingGunScope == true ) { - for (int i=0; i < MAX_ATTACHMENTS; i++) - { - if ( Item[pSoldier->inv[HANDPOS].usAttachItem[i]].thermaloptics ) - return TRUE; + OBJECTTYPE* pObj = &pSoldier->inv[HANDPOS]; + if (pObj->exists() == true) { + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if ( Item[iter->usItem].thermaloptics ) + return TRUE; + } } } @@ -6959,17 +7631,19 @@ BOOLEAN HasThermalOptics( SOLDIERTYPE * pSoldier ) INT8 FindHearingAid( SOLDIERTYPE * pSoldier ) { - for (INT8 i = 0; i < BIGPOCK1POS; i++) + for (INT8 i = BODYPOSSTART; i < BODYPOSFINAL; i++) { - if ( (i == HANDPOS || i == SECONDHANDPOS) && - (Item[pSoldier->inv[i].usItem].usItemClass & IC_ARMOUR || Item[pSoldier->inv[i].usItem].usItemClass & IC_FACE )) - { - continue; - } + if (pSoldier->inv[i].exists() == true) { + if ( (i == HANDPOS || i == SECONDHANDPOS) && + (Item[pSoldier->inv[i].usItem].usItemClass & IC_ARMOUR || Item[pSoldier->inv[i].usItem].usItemClass & IC_FACE )) + { + continue; + } - if ( Item[pSoldier->inv[i].usItem].hearingrangebonus > 0 ) - { - return( i ); + if ( Item[pSoldier->inv[i].usItem].hearingrangebonus > 0 ) + { + return( i ); + } } } return( NO_SLOT ); @@ -6977,39 +7651,35 @@ INT8 FindHearingAid( SOLDIERTYPE * pSoldier ) INT16 GetHearingRangeBonus( SOLDIERTYPE * pSoldier ) { - INT16 bns = 0; + INT16 bonus = 0; - for (int i = 0; i < BIGPOCK1POS; i++) + for (int i = BODYPOSSTART; i < BODYPOSFINAL; i++) { - if ( (i == HANDPOS || i == SECONDHANDPOS) && - (Item[pSoldier->inv[i].usItem].usItemClass & IC_ARMOUR || Item[pSoldier->inv[i].usItem].usItemClass & IC_FACE )) - { - continue; - } + if (pSoldier->inv[i].exists() == true) { + if ( (i == HANDPOS || i == SECONDHANDPOS) && + (Item[pSoldier->inv[i].usItem].usItemClass & IC_ARMOUR || Item[pSoldier->inv[i].usItem].usItemClass & IC_FACE )) + { + continue; + } - bns += BonusReduceMore( Item[pSoldier->inv[i].usItem].hearingrangebonus, pSoldier->inv[i].ItemData.Generic.bStatus[0] ); - /*for (UINT8 i=0;iinv[bLoop].usAttachItem[i] != NONE && Item[pSoldier->inv[bLoop].usAttachItem[i]].hearingrangebonus > 0 ) - bns = bns + Item[pSoldier->inv[bLoop].usAttachItem[i]].hearingrangebonus ; - }*/ + bonus += BonusReduceMore( Item[pSoldier->inv[i].usItem].hearingrangebonus, pSoldier->inv[i][0]->data.objectStatus ); + } } - return( bns ); + return( bonus ); } BOOLEAN IsDuckbill( OBJECTTYPE * pObj ) { - INT8 bLoop; + if (pObj->exists() == true) { + if (Item[pObj->usItem].duckbill || Item[(*pObj)[0]->data.gun.usGunAmmoItem].duckbill ) + return TRUE; - if (Item[pObj->usItem].duckbill || Item[pObj->ItemData.Gun.usGunAmmoItem].duckbill ) - return TRUE; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - if (Item[pObj->usAttachItem[bLoop]].duckbill ) - { - return( TRUE ); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if (Item[iter->usItem].duckbill ) + { + return( TRUE ); + } } } return( FALSE ); @@ -7018,12 +7688,14 @@ BOOLEAN IsDuckbill( OBJECTTYPE * pObj ) UINT16 GetPercentNoiseVolume( OBJECTTYPE * pObj ) { - UINT16 mod = 100 - BonusReduce( Item[pObj->usItem].percentnoisereduction, pObj->ItemData.Generic.bStatus[0] ); - mod = mod * ( 100 - Item[pObj->ItemData.Gun.usGunAmmoItem].percentnoisereduction ) / 100; + UINT16 mod = 0; + if (pObj->exists() == true) { + mod = 100 - BonusReduce( Item[pObj->usItem].percentnoisereduction, (*pObj)[0]->data.objectStatus ); + mod = mod * ( 100 - Item[(*pObj)[0]->data.gun.usGunAmmoItem].percentnoisereduction ) / 100; - for (int i = 0; i < MAX_ATTACHMENTS; i++) - { - mod = mod * ( 100 - BonusReduce( Item[pObj->usAttachItem[i]].percentnoisereduction, pObj->bAttachStatus[i] ) ) / 100; + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + mod = mod * ( 100 - BonusReduce( Item[iter->usItem].percentnoisereduction, (*iter)[0]->data.objectStatus ) ) / 100; + } } return (mod > 0) ? mod : 0; @@ -7036,9 +7708,11 @@ INT8 FindGasMask( SOLDIERTYPE * pSoldier ) for (bLoop = 0; bLoop < HANDPOS; bLoop++) { - if ( Item[pSoldier->inv[bLoop].usItem].gasmask ) - { - return( bLoop ); + if (pSoldier->inv[bLoop].exists() == true) { + if ( Item[pSoldier->inv[bLoop].usItem].gasmask ) + { + return( bLoop ); + } } } return( NO_SLOT ); @@ -7047,16 +7721,15 @@ INT8 FindGasMask( SOLDIERTYPE * pSoldier ) BOOLEAN IsDetonatorAttached( OBJECTTYPE * pObj ) { - INT8 bLoop; + if (pObj->exists() == true) { + //if (Item[pObj->usItem].detonator) + // return TRUE; - //if (Item[pObj->usItem].detonator) - // return TRUE; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - if (Item[pObj->usAttachItem[bLoop]].detonator ) - { - return( TRUE ); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if (Item[iter->usItem].detonator ) + { + return( TRUE ); + } } } return( FALSE ); @@ -7064,16 +7737,15 @@ BOOLEAN IsDetonatorAttached( OBJECTTYPE * pObj ) BOOLEAN IsRemoteDetonatorAttached( OBJECTTYPE * pObj ) { - INT8 bLoop; + if (pObj->exists() == true) { + //if (Item[pObj->usItem].remotedetonator) + // return TRUE; - //if (Item[pObj->usItem].remotedetonator) - // return TRUE; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - if (Item[pObj->usAttachItem[bLoop]].remotedetonator ) - { - return( TRUE ); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if (Item[iter->usItem].remotedetonator ) + { + return( TRUE ); + } } } return( FALSE ); @@ -7081,23 +7753,22 @@ BOOLEAN IsRemoteDetonatorAttached( OBJECTTYPE * pObj ) BOOLEAN IsFlashSuppressor( OBJECTTYPE * pObj, SOLDIERTYPE * pSoldier ) { - INT8 bLoop; + if (pObj->exists() == true) { + //Madd: tracers automatically negate any muzzle flash suppression due to inherent lighting effects + if (Item[pObj->usItem].usItemClass == IC_GUN && AmmoTypes[(*pObj)[0]->data.gun.ubGunAmmoType].tracerEffect && pSoldier->bDoBurst ) + return FALSE; - //Madd: tracers automatically negate any muzzle flash suppression due to inherent lighting effects - if (Item[pObj->usItem].usItemClass == IC_GUN && AmmoTypes[pObj->ItemData.Gun.ubGunAmmoType].tracerEffect && pSoldier->bDoBurst ) - return FALSE; + if (Item[pObj->usItem].hidemuzzleflash ) + return TRUE; - if (Item[pObj->usItem].hidemuzzleflash ) - return TRUE; + if ( Item[(*pObj)[0]->data.gun.usGunAmmoItem].hidemuzzleflash ) + return TRUE; - if ( Item[pObj->ItemData.Gun.usGunAmmoItem].hidemuzzleflash ) - return TRUE; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - if (Item[pObj->usAttachItem[bLoop]].hidemuzzleflash ) - { - return( TRUE ); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if (Item[iter->usItem].hidemuzzleflash ) + { + return( TRUE ); + } } } return( FALSE ); @@ -7105,16 +7776,16 @@ BOOLEAN IsFlashSuppressor( OBJECTTYPE * pObj, SOLDIERTYPE * pSoldier ) INT16 GetFlashSuppressorStatus( OBJECTTYPE * pObj ) { - INT8 bLoop; INT16 p=100; - if (Item[pObj->usItem].hidemuzzleflash ) - p=pObj->ItemData.Generic.bStatus[0]; + if (pObj->exists() == true) { + if (Item[pObj->usItem].hidemuzzleflash ) + p=(*pObj)[0]->data.objectStatus; - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - if (Item[pObj->usAttachItem[bLoop]].hidemuzzleflash ) - { - p =p+ pObj->bAttachStatus[bLoop]; + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if (Item[iter->usItem].hidemuzzleflash ) + { + p =p+ (*iter)[0]->data.objectStatus; + } } } p = min(p,100); @@ -7123,199 +7794,192 @@ INT16 GetFlashSuppressorStatus( OBJECTTYPE * pObj ) BOOLEAN IsGrenadeLauncherAttached( OBJECTTYPE * pObj ) { - INT8 bLoop; - - if (Item[pObj->usItem].grenadelauncher ) - return TRUE; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - if (Item[pObj->usAttachItem[bLoop]].grenadelauncher ) - { + if (pObj->exists() == true) { + if (Item[pObj->usItem].grenadelauncher ) return TRUE; + + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if (Item[iter->usItem].grenadelauncher ) + { + return TRUE; + } } } return FALSE; } -INT8 FindAttachment_GrenadeLauncher( OBJECTTYPE * pObj ) +OBJECTTYPE* FindAttachment_GrenadeLauncher( OBJECTTYPE * pObj ) { - INT8 bLoop; + if (pObj->exists() == true) { + if (Item[pObj->usItem].grenadelauncher ) + return pObj; - if (Item[pObj->usItem].grenadelauncher ) - return 0; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - if (Item[pObj->usAttachItem[bLoop]].grenadelauncher ) - { - return( bLoop ); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if (Item[iter->usItem].grenadelauncher ) + { + return( &(*iter) ); + } } } - return( ITEM_NOT_FOUND ); + return( 0 ); } -INT8 GetGrenadeLauncherStatus( OBJECTTYPE * pObj ) +INT16 GetGrenadeLauncherStatus( OBJECTTYPE * pObj ) { - INT8 bLoop; + if (pObj->exists() == true) { + if (Item[pObj->usItem].grenadelauncher ) + return (*pObj)[0]->data.objectStatus; - if (Item[pObj->usItem].grenadelauncher ) - return pObj->ItemData.Generic.bStatus[0]; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - if (Item[pObj->usAttachItem[bLoop]].grenadelauncher ) - { - return( pObj->bAttachStatus[bLoop] ); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if (Item[iter->usItem].grenadelauncher ) + { + return( (*iter)[0]->data.objectStatus ); + } } } return( ITEM_NOT_FOUND ); } UINT16 GetAttachedGrenadeLauncher( OBJECTTYPE * pObj ) { - UINT16 bLoop; + if (pObj->exists() == true) { + if (Item[pObj->usItem].grenadelauncher ) + return pObj->usItem; - if (Item[pObj->usItem].grenadelauncher ) - return pObj->usItem; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - if (Item[pObj->usAttachItem[bLoop]].grenadelauncher ) - { - return( (UINT16) Item[pObj->usAttachItem[bLoop]].uiIndex ); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if (Item[iter->usItem].grenadelauncher ) + { + return( (UINT16) Item[iter->usItem].uiIndex ); + } } } return( NONE ); } -INT8 FindFirstArmourAttachment( OBJECTTYPE * pObj ) -{ - INT8 bLoop; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - if (Item[pObj->usAttachItem[bLoop]].usItemClass == IC_ARMOUR && pObj->bAttachStatus[bLoop] > 0 ) - { - return( bLoop ); - } - } - return( ITEM_NOT_FOUND ); -} - - INT16 GetAttachedArmourBonus( OBJECTTYPE * pObj ) { - INT8 bLoop; - INT16 bns=0; + INT16 bonus=0; - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - bns += BonusReduce( Armour[Item[pObj->usAttachItem[bLoop]].ubClassIndex].ubProtection, - pObj->bAttachStatus[bLoop] ); + if (pObj->exists() == true) { + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += BonusReduce( Armour[Item[iter->usItem].ubClassIndex].ubProtection, + (*iter)[0]->data.objectStatus ); + } } - return( bns ); + return( bonus ); } INT16 GetBulletSpeedBonus( OBJECTTYPE * pObj ) { - INT8 bLoop; - INT16 bns=0; + INT16 bonus = 0; + if (pObj->exists() == true) { + bonus = Item[pObj->usItem].bulletspeedbonus ; + bonus += Item[(*pObj)[0]->data.gun.usGunAmmoItem].bulletspeedbonus ; - bns = Item[pObj->usItem].bulletspeedbonus ; - bns = bns + Item[pObj->ItemData.Gun.usGunAmmoItem].bulletspeedbonus ; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - bns = bns +Item[pObj->usAttachItem[bLoop]].bulletspeedbonus ; + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus = bonus +Item[iter->usItem].bulletspeedbonus ; + } } - return( bns ); + return( bonus ); } - BOOLEAN EXPLOSIVE_GUN ( UINT16 x) { - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EXPLOSIVE_GUN x = %d",x)); + //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EXPLOSIVE_GUN x = %d",x)); if ( Item[x].rocketlauncher || Item[x].cannon ) return TRUE; else return FALSE; } + INT8 FindRocketLauncherOrCannon( SOLDIERTYPE * pSoldier ) { INT8 bLoop; - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) + for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++) { - if (Item[pSoldier->inv[bLoop].usItem].rocketlauncher || Item[pSoldier->inv[bLoop].usItem].cannon ) - { - return( bLoop ); + if (pSoldier->inv[bLoop].exists() == true) { + if (Item[pSoldier->inv[bLoop].usItem].rocketlauncher || Item[pSoldier->inv[bLoop].usItem].cannon ) + { + return( bLoop ); + } } } return( NO_SLOT ); } + INT8 FindRocketLauncher( SOLDIERTYPE * pSoldier ) { INT8 bLoop; - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) + for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++) { - if (Item[pSoldier->inv[bLoop].usItem].rocketlauncher ) - { - return( bLoop ); + if (pSoldier->inv[bLoop].exists() == true) { + if (Item[pSoldier->inv[bLoop].usItem].rocketlauncher ) + { + return( bLoop ); + } } } return( NO_SLOT ); } + INT8 FindCannon( SOLDIERTYPE * pSoldier ) { INT8 bLoop; - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) + for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++) { - if ( Item[pSoldier->inv[bLoop].usItem].cannon ) - { - return( bLoop ); + if (pSoldier->inv[bLoop].exists() == true) { + if ( Item[pSoldier->inv[bLoop].usItem].cannon ) + { + return( bLoop ); + } } } return( NO_SLOT ); } + INT8 FindUsableCrowbar( SOLDIERTYPE * pSoldier ) { INT8 bLoop; - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) + for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++) { - if ( Item[pSoldier->inv[bLoop].usItem].crowbar && pSoldier->inv[bLoop].ItemData.Generic.bStatus[0] >= USABLE ) - { - return( bLoop ); + if (pSoldier->inv[bLoop].exists() == true) { + if ( Item[pSoldier->inv[bLoop].usItem].crowbar && pSoldier->inv[bLoop][0]->data.objectStatus >= USABLE ) + { + return( bLoop ); + } } } return( NO_SLOT ); } -INT8 FindAttachedBatteries( OBJECTTYPE * pObj ) -{ - INT8 bLoop; - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - if (Item[pObj->usAttachItem[bLoop]].batteries ) - { - return( bLoop ); +OBJECTTYPE* FindAttachedBatteries( OBJECTTYPE * pObj ) +{ + if (pObj->exists() == true) { + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if (Item[iter->usItem].batteries ) + { + return( &(*iter) ); + } } } - return( ITEM_NOT_FOUND ); + return( 0 ); } INT8 FindToolkit( SOLDIERTYPE * pSoldier ) { INT8 bLoop; - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) + for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++) { - if (Item[pSoldier->inv[bLoop].usItem].toolkit ) - { - return( bLoop ); + if (pSoldier->inv[bLoop].exists() == true) { + if (Item[pSoldier->inv[bLoop].usItem].toolkit ) + { + return( bLoop ); + } } } return( NO_SLOT ); @@ -7324,11 +7988,13 @@ INT8 FindMedKit( SOLDIERTYPE * pSoldier ) { INT8 bLoop; - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) + for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++) { - if (Item[pSoldier->inv[bLoop].usItem].medicalkit ) - { - return( bLoop ); + if (pSoldier->inv[bLoop].exists() == true) { + if (Item[pSoldier->inv[bLoop].usItem].medicalkit ) + { + return( bLoop ); + } } } return( NO_SLOT ); @@ -7337,11 +8003,13 @@ INT8 FindFirstAidKit( SOLDIERTYPE * pSoldier ) { INT8 bLoop; - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) + for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++) { - if (Item[pSoldier->inv[bLoop].usItem].firstaidkit ) - { - return( bLoop ); + if (pSoldier->inv[bLoop].exists() == true) { + if (Item[pSoldier->inv[bLoop].usItem].firstaidkit ) + { + return( bLoop ); + } } } return( NO_SLOT ); @@ -7350,11 +8018,13 @@ INT8 FindCamoKit( SOLDIERTYPE * pSoldier ) { INT8 bLoop; - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) + for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++) { - if (Item[pSoldier->inv[bLoop].usItem].camouflagekit ) - { - return( bLoop ); + if (pSoldier->inv[bLoop].exists() == true) { + if (Item[pSoldier->inv[bLoop].usItem].camouflagekit ) + { + return( bLoop ); + } } } return( NO_SLOT ); @@ -7363,11 +8033,13 @@ INT8 FindLocksmithKit( SOLDIERTYPE * pSoldier ) { INT8 bLoop; - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) + for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++) { - if (Item[pSoldier->inv[bLoop].usItem].locksmithkit ) - { - return( bLoop ); + if (pSoldier->inv[bLoop].exists() == true) { + if (Item[pSoldier->inv[bLoop].usItem].locksmithkit ) + { + return( bLoop ); + } } } return( NO_SLOT ); @@ -7376,11 +8048,13 @@ INT8 FindWalkman( SOLDIERTYPE * pSoldier ) { INT8 bLoop; - for (bLoop = 0; bLoop < BIGPOCK1POS; bLoop++) + for (bLoop = BODYPOSSTART; bLoop < BODYPOSFINAL; bLoop++) { - if (Item[pSoldier->inv[bLoop].usItem].walkman ) - { - return( bLoop ); + if (pSoldier->inv[bLoop].exists() == true) { + if (Item[pSoldier->inv[bLoop].usItem].walkman ) + { + return( bLoop ); + } } } return( NO_SLOT ); @@ -7389,11 +8063,13 @@ INT8 FindTrigger( SOLDIERTYPE * pSoldier ) { INT8 bLoop; - for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++) + for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++) { - if (Item[pSoldier->inv[bLoop].usItem].remotetrigger ) - { - return( bLoop ); + if (pSoldier->inv[bLoop].exists() == true) { + if (Item[pSoldier->inv[bLoop].usItem].remotetrigger ) + { + return( bLoop ); + } } } return( NO_SLOT ); @@ -7402,11 +8078,13 @@ INT8 FindRemoteControl( SOLDIERTYPE * pSoldier ) { INT8 bLoop; - for (bLoop = 0; bLoop < BIGPOCK1POS; bLoop++) + for (bLoop = BODYPOSSTART; bLoop < BODYPOSFINAL; bLoop++) { - if (Item[pSoldier->inv[bLoop].usItem].robotremotecontrol ) - { - return( bLoop ); + if (pSoldier->inv[bLoop].exists() == true) { + if (Item[pSoldier->inv[bLoop].usItem].robotremotecontrol ) + { + return( bLoop ); + } } } return( NO_SLOT ); @@ -7423,7 +8101,7 @@ UINT16 LowestLaunchableCoolness(UINT16 launcherIndex) break; if( ValidLaunchable( i, launcherIndex ) && ItemIsLegal(i) && Item[i].ubCoolness <= lowestCoolness ) - { + { lowestCoolness = Item[i].ubCoolness; } } @@ -7432,7 +8110,6 @@ UINT16 LowestLaunchableCoolness(UINT16 launcherIndex) UINT16 PickARandomLaunchable(UINT16 itemIndex) { - INT32 iLoop = 0; UINT16 usNumMatches = 0; UINT16 usRandom = 0; UINT16 i = 0; @@ -7445,7 +8122,7 @@ UINT16 PickARandomLaunchable(UINT16 itemIndex) { if ( Item[i].usItemClass == 0 ) break; - //Madd: quickfix: make it not choose best grenades right away. + //Madd: quickfix: make it not choose best grenades right away. if( ValidLaunchable( i, itemIndex ) && ItemIsLegal(i) && Item[i].ubCoolness <= max(HighestPlayerProgressPercentage()/10,lowestCoolness) ) usNumMatches++; } @@ -7459,13 +8136,13 @@ UINT16 PickARandomLaunchable(UINT16 itemIndex) break; if( ValidLaunchable( i, itemIndex ) && ItemIsLegal(i) && Item[i].ubCoolness <= max(HighestPlayerProgressPercentage()/10,lowestCoolness) ) - { + { if( usRandom ) usRandom--; else { return i; - } + } } } } @@ -7474,59 +8151,55 @@ UINT16 PickARandomLaunchable(UINT16 itemIndex) } INT16 GetCamoBonus( OBJECTTYPE * pObj ) { - INT8 bLoop; - INT16 bns=0; + INT16 bonus = 0; + if ( pObj->exists() == true ) { + bonus = (Item[pObj->usItem].camobonus);// * (WEAPON_STATUS_MOD((*pObj)[0]->data.objectStatus) / 100)) ; - bns = (INT16) (Item[pObj->usItem].camobonus);// * (WEAPON_STATUS_MOD(pObj->ItemData.Generic.bStatus[0]) / 100)) ; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - if (!Item[pObj->usAttachItem[bLoop]].camouflagekit) - bns += (INT16) (Item[pObj->usAttachItem[bLoop]].camobonus);// * (WEAPON_STATUS_MOD(pObj->bAttachStatus[bLoop]) / 100)); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if (!Item[iter->usItem].camouflagekit) + bonus += (INT16) (Item[iter->usItem].camobonus);// * (WEAPON_STATUS_MOD((*iter)[0]->data.objectStatus) / 100)); + } } - return( bns ); + return( bonus ); } INT16 GetUrbanCamoBonus( OBJECTTYPE * pObj ) { - INT8 bLoop; - INT16 bns=0; + INT16 bonus = 0; + if ( pObj->exists() == true ) { + bonus = (Item[pObj->usItem].urbanCamobonus);// * (WEAPON_STATUS_MOD((*pObj)[0]->data.objectStatus) / 100)) ; - bns = (INT16) (Item[pObj->usItem].urbanCamobonus);// * (WEAPON_STATUS_MOD(pObj->ItemData.Generic.bStatus[0]) / 100)) ; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - if (!Item[pObj->usAttachItem[bLoop]].camouflagekit) - bns += (INT16) (Item[pObj->usAttachItem[bLoop]].urbanCamobonus);// * (WEAPON_STATUS_MOD(pObj->bAttachStatus[bLoop]) / 100)); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if (!Item[iter->usItem].camouflagekit) + bonus += (INT16) (Item[iter->usItem].urbanCamobonus);// * (WEAPON_STATUS_MOD((*iter)[0]->data.objectStatus) / 100)); + } } - return( bns ); + return( bonus ); } INT16 GetDesertCamoBonus( OBJECTTYPE * pObj ) { - INT8 bLoop; - INT16 bns=0; + INT16 bonus = 0; + if ( pObj->exists() == true ) { + bonus = (Item[pObj->usItem].desertCamobonus);// * (WEAPON_STATUS_MOD((*pObj)[0]->data.objectStatus) / 100)) ; - bns = (INT16) (Item[pObj->usItem].desertCamobonus);// * (WEAPON_STATUS_MOD(pObj->ItemData.Generic.bStatus[0]) / 100)) ; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - if (!Item[pObj->usAttachItem[bLoop]].camouflagekit) - bns += (INT16) (Item[pObj->usAttachItem[bLoop]].desertCamobonus);// * (WEAPON_STATUS_MOD(pObj->bAttachStatus[bLoop]) / 100)); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if (!Item[iter->usItem].camouflagekit) + bonus += (INT16) (Item[iter->usItem].desertCamobonus);// * (WEAPON_STATUS_MOD((*iter)[0]->data.objectStatus) / 100)); + } } - return( bns ); + return( bonus ); } INT16 GetSnowCamoBonus( OBJECTTYPE * pObj ) { - INT8 bLoop; - INT16 bns=0; + INT16 bonus = 0; + if ( pObj->exists() == true ) { + bonus = (Item[pObj->usItem].snowCamobonus);// * (WEAPON_STATUS_MOD((*pObj)[0]->data.objectStatus) / 100)) ; - bns = (INT16) (Item[pObj->usItem].snowCamobonus);// * (WEAPON_STATUS_MOD(pObj->ItemData.Generic.bStatus[0]) / 100)) ; - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - if (!Item[pObj->usAttachItem[bLoop]].camouflagekit) - bns += (INT16) (Item[pObj->usAttachItem[bLoop]].snowCamobonus);// * (WEAPON_STATUS_MOD(pObj->bAttachStatus[bLoop]) / 100)); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if (!Item[iter->usItem].camouflagekit) + bonus += (INT16) (Item[iter->usItem].snowCamobonus);// * (WEAPON_STATUS_MOD((*iter)[0]->data.objectStatus) / 100)); + } } - return( bns ); + return( bonus ); } INT16 GetWornCamo( SOLDIERTYPE * pSoldier ) { @@ -7535,8 +8208,25 @@ INT16 GetWornCamo( SOLDIERTYPE * pSoldier ) for (bLoop = HELMETPOS; bLoop <= LEGPOS; bLoop++) { - if ( pSoldier->inv[bLoop].usItem > NONE ) + if ( pSoldier->inv[bLoop].exists() == true ) + { ttl += GetCamoBonus(&pSoldier->inv[bLoop]); + } + } + + // CHRISL: Add additional loop for LBE items while using new inventory system + if((UsingNewInventorySystem() == true)) + { + for (bLoop = VESTPOCKPOS; bLoop <= BPACKPOCKPOS; bLoop++) + { + if ( pSoldier->inv[bLoop].exists() == true ) + ttl += GetCamoBonus(&pSoldier->inv[bLoop]); + //CHRISL: to prevent camo overlap, don't count armor vest camo if we're weaing an LBE vest that grants a bonus + if(bLoop == VESTPOCKPOS && pSoldier->inv[VESTPOS].exists() == true && Item[pSoldier->inv[bLoop].usItem].camobonus > 0) + { + ttl -= Item[pSoldier->inv[VESTPOS].usItem].camobonus; + } + } } return __min( ttl, 100 ); @@ -7548,10 +8238,20 @@ INT16 GetWornUrbanCamo( SOLDIERTYPE * pSoldier ) for (bLoop = HELMETPOS; bLoop <= LEGPOS; bLoop++) { - if ( pSoldier->inv[bLoop].usItem > NONE ) + if ( pSoldier->inv[bLoop].exists() == true ) ttl += GetUrbanCamoBonus(&pSoldier->inv[bLoop]); } + // CHRISL: Add additional loop for LBE items while using new inventory system + if((UsingNewInventorySystem() == true)) + { + for (bLoop = VESTPOCKPOS; bLoop <= BPACKPOCKPOS; bLoop++) + { + if ( pSoldier->inv[bLoop].exists() == true ) + ttl += GetUrbanCamoBonus(&pSoldier->inv[bLoop]); + } + } + return __min( ttl, 100 ); } INT16 GetWornDesertCamo( SOLDIERTYPE * pSoldier ) @@ -7561,10 +8261,19 @@ INT16 GetWornDesertCamo( SOLDIERTYPE * pSoldier ) for (bLoop = HELMETPOS; bLoop <= LEGPOS; bLoop++) { - if ( pSoldier->inv[bLoop].usItem > NONE ) + if ( pSoldier->inv[bLoop].exists() == true ) ttl += GetDesertCamoBonus(&pSoldier->inv[bLoop]); } + // CHRISL: Add additional loop for LBE items while using new inventory system + if((UsingNewInventorySystem() == true)) + { + for (bLoop = VESTPOCKPOS; bLoop <= BPACKPOCKPOS; bLoop++) + { + if ( pSoldier->inv[bLoop].exists() == true ) + ttl += GetDesertCamoBonus(&pSoldier->inv[bLoop]); + } + } return __min( ttl, 100 ); } INT16 GetWornSnowCamo( SOLDIERTYPE * pSoldier ) @@ -7574,10 +8283,19 @@ INT16 GetWornSnowCamo( SOLDIERTYPE * pSoldier ) for (bLoop = HELMETPOS; bLoop <= LEGPOS; bLoop++) { - if ( pSoldier->inv[bLoop].usItem > NONE ) + if ( pSoldier->inv[bLoop].exists() == true ) ttl += GetSnowCamoBonus(&pSoldier->inv[bLoop]); } + // CHRISL: Add additional loop for LBE items while using new inventory system + if((UsingNewInventorySystem() == true)) + { + for (bLoop = VESTPOCKPOS; bLoop <= BPACKPOCKPOS; bLoop++) + { + if ( pSoldier->inv[bLoop].exists() == true ) + ttl += GetSnowCamoBonus(&pSoldier->inv[bLoop]); + } + } return __min( ttl, 100 ); } @@ -7606,25 +8324,27 @@ void ApplyEquipmentBonuses(SOLDIERTYPE * pSoldier) pSoldier->wornSnowCamo = (INT8)newSnowCamo; if ( (newCamo > oldCamo || newUrbanCamo > oldUrbanCamo || newDesertCamo > oldDesertCamo || newSnowCamo > oldSnowCamo )&& pSoldier->bTeam == OUR_TEAM ) - { - DoMercBattleSound( pSoldier, BATTLE_SOUND_COOL1 ); - + { + //CHRISL: This sound interferes with some RPC hiring in NewInv because of the camo bonus some LBE Vests give + if(UsingNewInventorySystem() == false) + pSoldier->DoMercBattleSound( BATTLE_SOUND_COOL1 ); + // WANNE: Only call the method if oldCame != newCamo if ( pSoldier->bInSector) - CreateSoldierPalettes( pSoldier ); + pSoldier->CreateSoldierPalettes( ); } else if ( (newCamo < oldCamo || newUrbanCamo < oldUrbanCamo || newDesertCamo < oldDesertCamo || newSnowCamo < oldSnowCamo )&& pSoldier->bTeam == OUR_TEAM ) { // WANNE: Only call the method if oldCame != newCamo if ( pSoldier->bInSector) - CreateSoldierPalettes( pSoldier ); + pSoldier->CreateSoldierPalettes( ); } // WANNE: Madd, I commented this, because this leads to IRAs INVISIBLE BUG! // We should only call the CreateSoldierPalettes if oldCamo != newCamo. See above! //Madd: do this regardless of camo. This will need to be called to do custom part colours and new overlays anyway. //if ( pSoldier->bInSector) - // CreateSoldierPalettes( pSoldier ); - + // pSoldier->CreateSoldierPalettes( ); + fInterfacePanelDirty = DIRTYLEVEL2; } @@ -7639,62 +8359,72 @@ UINT16 GetFirstExplosiveOfType(UINT16 expType) return 0; } -INT8 FindSunGoggles( SOLDIERTYPE * pSoldier, INT16 bonusToBeat ) +OBJECTTYPE* FindSunGogglesInInv( SOLDIERTYPE * pSoldier ) { INT8 bLoop; - - for (bLoop = HANDPOS; bLoop <= SMALLPOCK8POS; bLoop++) + INT16 bonusToBeat = 0; + OBJECTTYPE* pGoggles = 0; + // CHRISL: + for (bLoop = HANDPOS; bLoop < NUM_INV_SLOTS; bLoop++) { - if (Item[pSoldier->inv[bLoop].usItem].brightlightvisionrangebonus > bonusToBeat && Item[pSoldier->inv[bLoop].usItem].usItemClass == IC_FACE ) - { - return( bLoop ); + if ( pSoldier->inv[bLoop].exists() == true ) { + if (Item[pSoldier->inv[bLoop].usItem].brightlightvisionrangebonus > bonusToBeat && Item[pSoldier->inv[bLoop].usItem].usItemClass == IC_FACE ) + { + pGoggles = &(pSoldier->inv[bLoop]); + bonusToBeat = Item[pSoldier->inv[bLoop].usItem].brightlightvisionrangebonus; + } } } - return( ITEM_NOT_FOUND ); + return( pGoggles ); } -INT8 FindNightGoggles( SOLDIERTYPE * pSoldier, INT16 bonusToBeat ) +OBJECTTYPE* FindNightGogglesInInv( SOLDIERTYPE * pSoldier ) { INT8 bLoop; - - for (bLoop = HANDPOS; bLoop <= SMALLPOCK8POS; bLoop++) + INT16 bonusToBeat = 0; + OBJECTTYPE* pGoggles = 0; + // CHRISL: + for (bLoop = HANDPOS; bLoop < NUM_INV_SLOTS; bLoop++) { - if (Item[pSoldier->inv[bLoop].usItem].nightvisionrangebonus > bonusToBeat && Item[pSoldier->inv[bLoop].usItem].usItemClass == IC_FACE ) - { - return( bLoop ); + if ( pSoldier->inv[bLoop].exists() == true ) { + if (Item[pSoldier->inv[bLoop].usItem].nightvisionrangebonus > bonusToBeat && Item[pSoldier->inv[bLoop].usItem].usItemClass == IC_FACE ) + { + pGoggles = &(pSoldier->inv[bLoop]); + bonusToBeat = Item[pSoldier->inv[bLoop].usItem].nightvisionrangebonus; + } } } - return( ITEM_NOT_FOUND ); + return( pGoggles ); } INT16 GetMinRangeForAimBonus( OBJECTTYPE * pObj ) { - INT16 bns; + INT16 bonus = 0; - bns = Item[pObj->usItem].minrangeforaimbonus; - //bns += Item[pObj->ItemData.Gun.usGunAmmoItem].minrangeforaimbonus; + if ( pObj->exists() == true ) { + bonus = Item[pObj->usItem].minrangeforaimbonus; + //bonus += Item[(*pObj)[0]->data.gun.usGunAmmoItem].minrangeforaimbonus; - for (int i = 0; i < MAX_ATTACHMENTS; i++) - { - bns += Item[pObj->usAttachItem[i]].minrangeforaimbonus; + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += Item[iter->usItem].minrangeforaimbonus; + } } - return( bns ); + return( bonus ); } UINT8 AllowedAimingLevels(SOLDIERTYPE * pSoldier) { UINT8 aimLevels = 4; float iScopeBonus = 0; - OBJECTTYPE obj = pSoldier->inv[pSoldier->ubAttackingHand]; BOOLEAN allowed = TRUE; - - if ( gGameSettings.fOptions[TOPTION_AIM_LEVEL_RESTRICTION] && Weapon[obj.usItem].ubWeaponType != GUN_RIFLE && Weapon[obj.usItem].ubWeaponType != GUN_SN_RIFLE ) + + if ( gGameSettings.fOptions[TOPTION_AIM_LEVEL_RESTRICTION] && Weapon[pSoldier->inv[pSoldier->ubAttackingHand].usItem].ubWeaponType != GUN_RIFLE && Weapon[pSoldier->inv[pSoldier->ubAttackingHand].usItem].ubWeaponType != GUN_SN_RIFLE ) allowed = FALSE; - if ( allowed && IsScoped( &obj ) ) + if ( allowed && IsScoped( &pSoldier->inv[pSoldier->ubAttackingHand] ) ) { - iScopeBonus = ( (float)gGameExternalOptions.ubStraightSightRange * GetMinRangeForAimBonus(&obj) / 100 ); + iScopeBonus = ( (float)gGameExternalOptions.ubStraightSightRange * GetMinRangeForAimBonus(&pSoldier->inv[pSoldier->ubAttackingHand]) / 100 ); if ( iScopeBonus >= ( (float)gGameExternalOptions.ubStraightSightRange * 0.3) ) // >= 30% of sight range (~4 tiles by default) { @@ -7702,7 +8432,7 @@ UINT8 AllowedAimingLevels(SOLDIERTYPE * pSoldier) } if ( iScopeBonus >= ( (float)gGameExternalOptions.ubStraightSightRange * 0.6) ) // >= 60% of sight range (~9 tiles by default) - { + { aimLevels += 2; } } @@ -7710,18 +8440,17 @@ UINT8 AllowedAimingLevels(SOLDIERTYPE * pSoldier) return aimLevels; } //Madd: added -INT16 GetStealthBonus( OBJECTTYPE * pObj ) +INT16 GetStealthBonus( OBJECTTYPE * pObj ) { - INT8 bLoop; - INT16 bns=0; + INT16 bonus = 0; + if ( pObj->exists() == true ) { + bonus = BonusReduce(Item[pObj->usItem].stealthbonus,(*pObj)[0]->data.objectStatus); - bns = (INT16) BonusReduce(Item[pObj->usItem].stealthbonus,pObj->ItemData.Generic.bStatus[0]); - - for (bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - bns += (INT16) BonusReduce(Item[pObj->usAttachItem[bLoop]].stealthbonus,pObj->bAttachStatus[bLoop]); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + bonus += (INT16) BonusReduce(Item[iter->usItem].stealthbonus,(*iter)[0]->data.objectStatus); + } } - return( bns ); + return( bonus ); } INT16 GetWornStealth( SOLDIERTYPE * pSoldier ) { @@ -7734,7 +8463,7 @@ INT16 GetWornStealth( SOLDIERTYPE * pSoldier ) for (bLoop = HELMETPOS; bLoop <= LEGPOS; bLoop++) { - if ( pSoldier->inv[bLoop].usItem > NONE ) + if ( pSoldier->inv[bLoop].exists() == true ) ttl += GetStealthBonus(&pSoldier->inv[bLoop]); } diff --git a/Tactical/Items.h b/Tactical/Items.h index 668834c0..ba355e76 100644 --- a/Tactical/Items.h +++ b/Tactical/Items.h @@ -1,9 +1,13 @@ #ifndef ITEMS_H #define ITEMS_H -#include "Item Types.h" #include "Soldier Control.h" #include "Overhead Types.h" + +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + // Snap: Moved here from opplist.cpp // These defined are no longer used to calculate item bonuses, // but for lack of anything better, they are still used in other places @@ -12,59 +16,54 @@ extern UINT8 SlotToPocket[7]; -// WDS - Clean up inventory handling -class SOLDIERTYPE; extern BOOLEAN WeaponInHand( SOLDIERTYPE * pSoldier ); -extern INT8 FindObj( SOLDIERTYPE * pSoldier, UINT16 usItem ); -INT8 FindAmmo( SOLDIERTYPE * pSoldier, UINT8 ubCalibre, UINT8 ubMagSize, INT8 bExcludeSlot ); +INT8 FindAmmo( SOLDIERTYPE * pSoldier, UINT8 ubCalibre, UINT16 ubMagSize, INT8 bExcludeSlot ); -extern INT8 FindAttachment( OBJECTTYPE * pObj, UINT16 usItem ); +INT8 FindBestWeaponIfCurrentIsOutOfRange(SOLDIERTYPE * pSoldier, INT8 bCurrentWeaponIndex, UINT16 bWantedRange); + +OBJECTTYPE* FindAttachment( OBJECTTYPE * pObj, UINT16 usItem, UINT8 subObject = 0 ); extern INT8 FindObjClass( SOLDIERTYPE * pSoldier, UINT32 usItemClass ); -extern INT8 FindObjClassAfterSlot( SOLDIERTYPE * pSoldier, INT8 bStart, UINT32 usItemClass ); extern INT8 FindAIUsableObjClass( SOLDIERTYPE * pSoldier, UINT32 usItemClass ); extern INT8 FindAIUsableObjClassWithin( SOLDIERTYPE * pSoldier, UINT32 usItemClass, INT8 bLower, INT8 bUpper ); extern INT8 FindEmptySlotWithin( SOLDIERTYPE * pSoldier, INT8 bLower, INT8 bUpper ); -extern INT8 FindExactObj( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj ); extern INT8 FindObjInObjRange( SOLDIERTYPE * pSoldier, UINT16 usItem1, UINT16 usItem2 ); extern INT8 FindLaunchable( SOLDIERTYPE * pSoldier, UINT16 usWeapon ); extern INT8 FindGLGrenade( SOLDIERTYPE * pSoldier ); extern INT8 FindThrowableGrenade( SOLDIERTYPE * pSoldier ); extern INT8 FindUsableObj( SOLDIERTYPE * pSoldier, UINT16 usItem ); -extern void DeleteObj(OBJECTTYPE * pObj ); -extern void CopyObj( OBJECTTYPE * pSourceObj, OBJECTTYPE * pTargetObj ); -extern void SwapObjs( OBJECTTYPE * pObj1, OBJECTTYPE * pObj2 ); -extern void SwapObjs(SOLDIERTYPE* pSoldier, int leftSlot, int rightSlot, BOOLEAN fPermanent); -extern void SwapObjs(SOLDIERTYPE* pSoldier, int slot, OBJECTTYPE* pObject, BOOLEAN fPermanent); +void DeleteObj(OBJECTTYPE * pObj ); +void SwapObjs( OBJECTTYPE * pObj1, OBJECTTYPE * pObj2 ); +void SwapObjs(SOLDIERTYPE* pSoldier, int leftSlot, int rightSlot, BOOLEAN fPermanent); +void SwapObjs(SOLDIERTYPE* pSoldier, int slot, OBJECTTYPE* pObject, BOOLEAN fPermanent); +void CleanUpItemStats( OBJECTTYPE * pObj ); -extern void SwapWithinObj( OBJECTTYPE * pObj, UINT8 ubIndex1, UINT8 ubIndex2 ); -extern void RemoveObjFrom( OBJECTTYPE * pObj, UINT8 ubRemoveIndex ); //Returns true if swapped, false if added to end of stack -extern BOOLEAN PlaceObjectAtObjectIndex( OBJECTTYPE * pSourceObj, OBJECTTYPE * pTargetObj, UINT8 ubIndex ); -extern void GetObjFrom( OBJECTTYPE * pObj, UINT8 ubGetIndex, OBJECTTYPE * pDest ); +extern BOOLEAN PlaceObjectAtObjectIndex( OBJECTTYPE * pSourceObj, OBJECTTYPE * pTargetObj, UINT8 ubIndex, UINT32 ubCap ); -extern BOOLEAN AttachObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pTargetObj, OBJECTTYPE * pAttachment, BOOLEAN playSound ); -extern BOOLEAN AttachObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pTargetObj, OBJECTTYPE * pAttachment ); -extern BOOLEAN RemoveAttachment( OBJECTTYPE * pObj, INT8 bAttachPos, OBJECTTYPE * pNewObj ); +UINT16 CalculateAmmoWeight( UINT16 usGunAmmoItem, UINT16 ubShotsLeft ); +UINT16 CalculateObjectWeight( OBJECTTYPE *pObject ); +UINT32 CalculateCarriedWeight( SOLDIERTYPE * pSoldier ); +// CHRISL: +UINT16 CalculateItemSize( OBJECTTYPE *pObject ); -extern UINT8 CalculateObjectWeight( OBJECTTYPE *pObject ); -extern UINT32 CalculateCarriedWeight( SOLDIERTYPE * pSoldier ); extern UINT16 TotalPoints( OBJECTTYPE * pObj ); extern UINT16 UseKitPoints( OBJECTTYPE * pObj, UINT16 usPoints, SOLDIERTYPE *pSoldier ); -extern BOOLEAN EmptyWeaponMagazine( OBJECTTYPE * pWeapon, OBJECTTYPE *pAmmo ); -extern BOOLEAN CreateItem( UINT16 usItem, INT8 bStatus, OBJECTTYPE * pObj ); -extern BOOLEAN CreateItems( UINT16 usItem, INT8 bStatus, UINT8 ubNumber, OBJECTTYPE * pObj ); -extern BOOLEAN CreateMoney( UINT32 uiMoney, OBJECTTYPE * pObj ); +extern BOOLEAN EmptyWeaponMagazine( OBJECTTYPE * pWeapon, OBJECTTYPE *pAmmo, UINT32 subObject = 0 ); +BOOLEAN CreateItem( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj ); +BOOLEAN CreateAmmo( UINT16 usItem, OBJECTTYPE * pObj, INT16 ubShotsLeft = -1); +BOOLEAN CreateItems( UINT16 usItem, INT8 bStatus, UINT8 ubNumber, OBJECTTYPE * pObj ); +BOOLEAN CreateMoney( UINT32 uiMoney, OBJECTTYPE * pObj ); extern UINT16 DefaultMagazine( UINT16 usItem ); UINT16 RandomMagazine( UINT16 usItem, UINT8 ubPercentStandard, UINT8 maxCoolness ); UINT16 RandomMagazine( OBJECTTYPE * pGun, UINT8 ubPercentStandard, UINT8 maxCoolness ); -extern BOOLEAN ReloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo ); -extern BOOLEAN UnloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun); +extern BOOLEAN ReloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo, UINT32 subObject = 0 ); -UINT8 ItemSlotLimit( UINT16 usItem, INT8 bSlot ); +// CHRISL: Add new inventory version of ItemSlotLimit function +UINT8 ItemSlotLimit( OBJECTTYPE * pObject, INT16 bSlot, SOLDIERTYPE *pSoldier = NULL, BOOLEAN cntAttach = TRUE); // Function to put an item in a soldier profile // It's very primitive, just finds an empty place! @@ -85,10 +84,27 @@ BOOLEAN ArmBomb( OBJECTTYPE * pObj, INT8 bSetting ); BOOLEAN PlaceObject( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj ); // Send fNewItem to true to set off new item glow in inv panel -BOOLEAN AutoPlaceObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN fNewItem ); -BOOLEAN RemoveObjectFromSlot( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj ); +BOOLEAN AutoPlaceObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN fNewItem, INT8 bExcludeSlot = NO_SLOT ); + +//ADB +bool FitsInSmallPocket(OBJECTTYPE* pObj); + +bool PlaceInAnySlot(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, bool fNewItem, int bExcludeSlot = NO_SLOT); +bool PlaceInAnyPocket(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, bool fNewItem, int bExcludeSlot = NO_SLOT); +bool PlaceInAnySmallPocket(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, bool fNewItem, int bExcludeSlot = NO_SLOT); +bool PlaceInAnyBigOrMediumPocket(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, bool fNewItem, int bExcludeSlot = NO_SLOT); +bool TryToStackInSlot(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, int bSlot); +bool TryToPlaceInSlot(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, bool fNewItem, int& startSlot, int endSlot); + void RemoveInvObject( SOLDIERTYPE *pSoldier, UINT16 usItem ); +void RemoveProhibitedAttachments(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, UINT16 usItem); +void EjectAmmoAndPlace(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj); + +BOOLEAN CanItemFitInVehicle( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj, INT8 bPos, BOOLEAN fDoingPlacement ); +BOOLEAN CanItemFitInPosition( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj, INT8 bPos, BOOLEAN fDoingPlacement ); + +void DistributeStatus(OBJECTTYPE* pSourceObject, OBJECTTYPE* pTargetObject, INT16 bMaxPoints); UINT8 SwapKeysToSlot( SOLDIERTYPE * pSoldier, INT8 bKeyRingPosition, OBJECTTYPE * pObj ); @@ -108,19 +124,18 @@ UINT8 AddKeysToSlot( SOLDIERTYPE * pSoldier, INT8 bKeyRingPosition, OBJECTTYPE * -//Kris: December 9, 1997 +//Kris: December 9, 1997 //I need a bunch of validation functions for ammo, attachments, etc., so I'll be adding them here. -//Chris, maybe you might find these useful, or add your own. I don't really know what I'm doing yet, +//Chris, maybe you might find these useful, or add your own. I don't really know what I'm doing yet, //so feel free to correct me... //Simple check to see if the item has any attachments -BOOLEAN ItemHasAttachments( OBJECTTYPE *pItem ); +BOOLEAN ItemHasAttachments( OBJECTTYPE *pItem, SOLDIERTYPE * pSoldier = NULL, UINT8 iter = 0 ); -//Determine if this item can receive this attachment. This is different, in that it may +//Determine if this item can receive this attachment. This is different, in that it may //be possible to have this attachment on this item, but may already have an attachment on //it which doesn't work simultaneously with the new attachment (like a silencer and duckbill). -BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAttemptingAttachment ); -BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAttemptingAttachment, BOOLEAN fDisplayMessage ); +BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAttemptingAttachment, BOOLEAN fDisplayMessage = TRUE, UINT8 subObject = 0); // Determines if it is possible to merge an item with any item whose class // is the same as the indicated item @@ -134,7 +149,7 @@ BOOLEAN TwoHandedItem( UINT16 usItem ); //Existing functions without header def's, added them here, just incase I'll need to call //them from the editor. -BOOLEAN ValidAttachment( UINT16 usAttachment, UINT16 usItem ); +BOOLEAN ValidAttachment( UINT16 usAttachment, UINT16 usItem, UINT8* ubAPCost = NULL); UINT8 AttachmentAPCost( UINT16 usAttachment, UINT16 usItem ); BOOLEAN ValidLaunchable( UINT16 usLaunchable, UINT16 usItem ); @@ -153,24 +168,22 @@ INT8 FindAmmoToReload( SOLDIERTYPE * pSoldier, INT8 bWeaponIn, INT8 bExcludeSlot void SwapOutHandItem( SOLDIERTYPE * pSoldier ); void SwapHandItems( SOLDIERTYPE * pSoldier ); -INT8 FindAttachmentByClass( OBJECTTYPE * pObj, UINT32 uiItemClass ); -void RemoveObjs( OBJECTTYPE * pObj, UINT8 ubNumberToRemove ); - +OBJECTTYPE* FindAttachmentByClass( OBJECTTYPE * pObj, UINT32 uiItemClass, UINT8 subObject = 0 ); void WaterDamage( SOLDIERTYPE *pSoldier ); -INT8 FindObjWithin( SOLDIERTYPE * pSoldier, UINT16 usItem, INT8 bLower, INT8 bUpper ); +INT8 FindObj( SOLDIERTYPE * pSoldier, UINT16 usItem, INT8 bLower = 0, INT8 bUpper = NUM_INV_SLOTS ); BOOLEAN ApplyCammo( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN *pfGoodAPs ); UINT32 ConvertProfileMoneyValueToObjectTypeMoneyValue( UINT8 ubStatus ); UINT8 ConvertObjectTypeMoneyValueToProfileMoneyValue( UINT32 uiMoneyAmount ); -BOOLEAN CheckForChainReaction( UINT16 usItem, INT8 bStatus, INT8 bDamage, BOOLEAN fOnGround ); +BOOLEAN CheckForChainReaction( UINT16 usItem, INT16 bStatus, INT16 bDamage, BOOLEAN fOnGround ); BOOLEAN ItemIsLegal( UINT16 usItemIndex ); BOOLEAN ExtendedGunListGun( UINT16 usGun ); UINT16 StandardGunListReplacement( UINT16 usGun ); -UINT16 FindReplacementMagazine( UINT8 ubCalibre, UINT8 ubMagSize, UINT8 ubAmmoType); +UINT16 FindReplacementMagazine( UINT8 ubCalibre, UINT16 ubMagSize, UINT8 ubAmmoType); UINT16 FindReplacementMagazineIfNecessary( UINT16 usOldGun, UINT16 usOldAmmo, UINT16 usNewGun ); BOOLEAN DamageItemOnGround( OBJECTTYPE * pObject, INT16 sGridNo, INT8 bLevel, INT32 iDamage, UINT8 ubOwner ); @@ -191,15 +204,15 @@ void CheckEquipmentForFragileItemDamage( SOLDIERTYPE *pSoldier, INT32 iDamage ); extern void ActivateXRayDevice( SOLDIERTYPE * pSoldier ); extern void TurnOffXRayEffects( SOLDIERTYPE * pSoldier ); -extern INT8 FindLaunchableAttachment( OBJECTTYPE * pObj, UINT16 usWeapon ); +OBJECTTYPE* FindLaunchableAttachment( OBJECTTYPE * pObj, UINT16 usWeapon ); -void DamageObj( OBJECTTYPE * pObj, INT8 bAmount ); +void DamageObj( OBJECTTYPE * pObj, INT8 bAmount, UINT8 subObject = 0 ); UINT16 MagazineClassIndexToItemType(UINT16 usMagIndex); // Item property-related stuff added by Madd Mugsy -BOOLEAN IsScoped( const OBJECTTYPE * pObj ); +BOOLEAN IsScoped( OBJECTTYPE * pObj ); INT16 GetAimBonus( OBJECTTYPE * pObj, INT32 iRange, UINT8 ubAimTime ); INT16 GetMinAimBonusRange( OBJECTTYPE * pObj ); INT16 GetToHitBonus( OBJECTTYPE * pObj, INT32 iRange, UINT8 bLightLevel, BOOLEAN fProneStance = FALSE ); @@ -215,7 +228,7 @@ INT16 GetPercentAutofireAPReduction( OBJECTTYPE * pObj ); INT16 GetPercentBurstFireAPReduction( OBJECTTYPE * pObj ); INT16 GetPercentReadyTimeAPReduction( OBJECTTYPE * pObj ); INT16 GetPercentReloadTimeAPReduction( OBJECTTYPE * pObj ); -INT16 GetAutoToHitBonus( OBJECTTYPE * pObj, BOOLEAN fProneStance = FALSE ); +INT16 GetAutoToHitBonus( OBJECTTYPE * pObj, BOOLEAN fProneStance = FALSE ); INT16 GetRateOfFireBonus( OBJECTTYPE * pObj ); INT16 GetBurstSizeBonus( OBJECTTYPE * pObj ); BOOLEAN HasFastBurst( OBJECTTYPE * pObj ); @@ -242,14 +255,14 @@ INT8 FindHearingAid( SOLDIERTYPE * pSoldier ); INT16 GetHearingRangeBonus( SOLDIERTYPE * pSoldier ); INT8 IsGrenadeLauncher( OBJECTTYPE * pObj ); -INT8 GetGrenadeLauncherStatus( OBJECTTYPE * pObj ); +INT16 GetGrenadeLauncherStatus( OBJECTTYPE * pObj ); BOOLEAN IsGrenadeLauncherAttached( OBJECTTYPE * pObj ); -INT8 FindAttachment_GrenadeLauncher( OBJECTTYPE * pObj ); +OBJECTTYPE* FindAttachment_GrenadeLauncher( OBJECTTYPE * pObj ); UINT16 GetAttachedGrenadeLauncher( OBJECTTYPE * pObj ); INT8 FindRocketLauncher( SOLDIERTYPE * pSoldier ); INT8 FindRocketLauncherOrCannon( SOLDIERTYPE * pSoldier ); INT8 FindNonSmokeLaunchable( SOLDIERTYPE * pSoldier, UINT16 usWeapon ); -INT8 FindNonSmokeLaunchableAttachment( OBJECTTYPE * pObj, UINT16 usWeapon ); +OBJECTTYPE* FindNonSmokeLaunchableAttachment( OBJECTTYPE * pObj, UINT16 usWeapon ); UINT16 PickARandomLaunchable(UINT16 itemIndex); BOOLEAN IsFlashSuppressor( OBJECTTYPE * pObj, SOLDIERTYPE * pSoldier ); @@ -262,7 +275,6 @@ BOOLEAN IsDuckbill( OBJECTTYPE * pObj ); // Noise volume is then calculated as volume * GetPercentNoiseVolume / 100 UINT16 GetPercentNoiseVolume( OBJECTTYPE * pObj ); -INT8 FindFirstArmourAttachment( OBJECTTYPE * pObj ); INT16 GetAttachedArmourBonus( OBJECTTYPE * pObj ); INT16 GetBulletSpeedBonus( OBJECTTYPE * pObj ); INT8 FindGasMask( SOLDIERTYPE * pSoldier ); @@ -273,7 +285,7 @@ INT8 FindUsableCrowbar( SOLDIERTYPE * pSoldier ); INT8 FindToolkit( SOLDIERTYPE * pSoldier ); BOOLEAN IsDetonatorAttached( OBJECTTYPE * pObj ); BOOLEAN IsRemoteDetonatorAttached( OBJECTTYPE * pObj ); -INT8 FindAttachedBatteries( OBJECTTYPE * pObj ); +OBJECTTYPE* FindAttachedBatteries( OBJECTTYPE * pObj ); INT8 FindMedKit( SOLDIERTYPE * pSoldier ); INT8 FindFirstAidKit( SOLDIERTYPE * pSoldier ); INT8 FindLocksmithKit( SOLDIERTYPE * pSoldier ); @@ -294,8 +306,8 @@ INT16 GetGearAPBonus( SOLDIERTYPE * pSoldier ); UINT16 GetFirstExplosiveOfType(UINT16 expType); -INT8 FindSunGoggles( SOLDIERTYPE * pSoldier, INT16 bonusToBeat ); -INT8 FindNightGoggles( SOLDIERTYPE * pSoldier, INT16 bonusToBeat ); +OBJECTTYPE* FindSunGogglesInInv( SOLDIERTYPE * pSoldier ); +OBJECTTYPE* FindNightGogglesInInv( SOLDIERTYPE * pSoldier ); INT16 GetMinRangeForAimBonus( OBJECTTYPE * pObj ); UINT8 AllowedAimingLevels(SOLDIERTYPE * pSoldier); @@ -311,3 +323,4 @@ INT16 GetSnowCamoBonus( OBJECTTYPE * pObj ); #endif + diff --git a/Tactical/Keys.cpp b/Tactical/Keys.cpp index 6e9cce60..ac6081e9 100644 --- a/Tactical/Keys.cpp +++ b/Tactical/Keys.cpp @@ -6,7 +6,7 @@ #include #include "types.h" - #include "Soldier Control.h" + #include "Keys.h" #include "debug.h" #include "Smoothing Utils.h" @@ -33,7 +33,7 @@ #include "random.h" #include "worlddef.h" #include "campaign.h" - #include "sound control.h" + #include "Sound Control.h" #include "Interface.h" #include "Game Clock.h" #include "handle doors.h" @@ -55,7 +55,7 @@ BOOLEAN InternalSetDoorPerceivedOpenStatus( DOOR_STATUS *pDoorStatus, BOOLEAN fP KEY KeyTable[NUM_KEYS] = { // Item # Flags Sector, Date Found - // + // {KEY_1, 0, 0, 0}, {KEY_2, 0, 0, 0}, {KEY_3, 0, 0, 0}, @@ -72,9 +72,9 @@ KEY KeyTable[NUM_KEYS] = //Current number of doors in world. UINT8 gubNumDoors = 0; -//Current max number of doors. This is only used by the editor. When adding doors to the +//Current max number of doors. This is only used by the editor. When adding doors to the //world, we may run out of space in the DoorTable, so we will allocate a new array with extra slots, -//then copy everything over again. gubMaxDoors holds the arrays actual number of slots, even though +//then copy everything over again. gubMaxDoors holds the arrays actual number of slots, even though //the current number (gubNumDoors) will be <= to it. UINT8 gubMaxDoors = 0; @@ -113,8 +113,8 @@ DOORTRAP DoorTrapTable[NUM_DOOR_TRAPS] = -//Dynamic array of Doors. For general game purposes, the doors that are locked and/or trapped -//are permanently saved within the map, and are loaded and allocated when the map is loaded. Because +//Dynamic array of Doors. For general game purposes, the doors that are locked and/or trapped +//are permanently saved within the map, and are loaded and allocated when the map is loaded. Because //the editor allows more doors to be added, or removed, the actual size of the DoorTable may change. DOOR * DoorTable = NULL; @@ -195,11 +195,11 @@ BOOLEAN KeyExistsInInventory( SOLDIERTYPE *pSoldier, UINT8 ubKeyID ) { UINT8 ubLoop; - for (ubLoop = 0; ubLoop < NUM_INV_SLOTS; ubLoop++) + for (ubLoop = 0; ubLoop < pSoldier->inv.size(); ubLoop++) { if (Item[pSoldier->inv[ubLoop].usItem].usItemClass == IC_KEY) { - if ( (pSoldier->inv[ubLoop].ItemData.Key.ubKeyID == ubKeyID) || (ubKeyID == ANYKEY) ) + if ( (pSoldier->inv[ubLoop][0]->data.key.ubKeyID == ubKeyID) || (ubKeyID == ANYKEY) ) { // there's the key we want! return( TRUE ); @@ -237,7 +237,7 @@ BOOLEAN DoUnlockDoor( DOOR * pDoor, UINT8 ubKeyID ) if ( (pDoor->fLocked) && ValidKey( pDoor, ubKeyID )) { // Play lockpicking - PlayJA2Sample( ( (UINT8)UNLOCK_DOOR_1 ), RATE_11025, SoundVolume( MIDVOLUME, pDoor->sGridNo ), 1, SoundDir( pDoor->sGridNo ) ); + PlayJA2Sample( ( (UINT8)UNLOCK_DOOR_1 ), RATE_11025, SoundVolume( MIDVOLUME, pDoor->sGridNo ), 1, SoundDir( pDoor->sGridNo ) ); pDoor->fLocked = FALSE; return( TRUE ); @@ -271,8 +271,8 @@ BOOLEAN AttemptToUnlockDoor( SOLDIERTYPE * pSoldier, DOOR * pDoor ) } // drat, couldn't find the key - PlayJA2Sample( KEY_FAILURE, RATE_11025, MIDVOLUME, 1, MIDDLEPAN ); - + PlayJA2Sample( KEY_FAILURE, RATE_11025, MIDVOLUME, 1, MIDDLEPAN ); + return( FALSE ); } @@ -315,7 +315,7 @@ BOOLEAN AttemptToCrowbarLock( SOLDIERTYPE * pSoldier, DOOR * pDoor ) } // generate a noise for thumping on the door - MakeNoise( pSoldier->ubID, pSoldier->sGridNo, pSoldier->bLevel, gpWorldLevelData[pSoldier->sGridNo].ubTerrainID, CROWBAR_DOOR_VOLUME, NOISE_DOOR_SMASHING ); + MakeNoise( pSoldier->ubID, pSoldier->sGridNo, pSoldier->pathing.bLevel, gpWorldLevelData[pSoldier->sGridNo].ubTerrainID, CROWBAR_DOOR_VOLUME, NOISE_DOOR_SMASHING ); if ( !pDoor->fLocked ) { @@ -326,7 +326,7 @@ BOOLEAN AttemptToCrowbarLock( SOLDIERTYPE * pSoldier, DOOR * pDoor ) // award experience points? // Play lock busted sound - PlayJA2Sample( ( (UINT8)BREAK_LOCK ), RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( ( (UINT8)BREAK_LOCK ), RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); return( TRUE ); } @@ -357,14 +357,14 @@ BOOLEAN AttemptToCrowbarLock( SOLDIERTYPE * pSoldier, DOOR * pDoor ) if (iResult > 0) { - // STR GAIN (20) - Pried open a lock - StatChange( pSoldier, STRAMT, 20, FALSE ); + // STR GAIN (20) - Pried open a lock + StatChange( pSoldier, STRAMT, 20, FALSE ); // succeeded! door can never be locked again, so remove from door list... RemoveDoorInfoFromTable( pDoor->sGridNo ); // Play lock busted sound - PlayJA2Sample( ( (UINT8)BREAK_LOCK ), RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( ( (UINT8)BREAK_LOCK ), RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); return( TRUE ); } @@ -372,7 +372,7 @@ BOOLEAN AttemptToCrowbarLock( SOLDIERTYPE * pSoldier, DOOR * pDoor ) { if (iResult > -10) { - ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ LOCK_HAS_BEEN_HIT ] ); + ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ LOCK_HAS_BEEN_HIT ] ); // STR GAIN - Damaged a lock by prying StatChange( pSoldier, STRAMT, 5, FALSE ); @@ -399,7 +399,7 @@ BOOLEAN AttemptToSmashDoor( SOLDIERTYPE * pSoldier, DOOR * pDoor ) LOCK * pLock; // generate a noise for thumping on the door - MakeNoise( pSoldier->ubID, pSoldier->sGridNo, pSoldier->bLevel, gpWorldLevelData[pSoldier->sGridNo].ubTerrainID, SMASHING_DOOR_VOLUME, NOISE_DOOR_SMASHING ); + MakeNoise( pSoldier->ubID, pSoldier->sGridNo, pSoldier->pathing.bLevel, gpWorldLevelData[pSoldier->sGridNo].ubTerrainID, SMASHING_DOOR_VOLUME, NOISE_DOOR_SMASHING ); if ( !pDoor->fLocked ) { @@ -410,7 +410,7 @@ BOOLEAN AttemptToSmashDoor( SOLDIERTYPE * pSoldier, DOOR * pDoor ) // award experience points? // Play lock busted sound - PlayJA2Sample( ( (UINT8)BREAK_LOCK ), RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( ( (UINT8)BREAK_LOCK ), RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); return( TRUE ); } @@ -436,15 +436,15 @@ BOOLEAN AttemptToSmashDoor( SOLDIERTYPE * pSoldier, DOOR * pDoor ) } if (iResult > 0) { - // STR GAIN (20) - Pried open a lock - StatChange( pSoldier, STRAMT, 20, FALSE ); + // STR GAIN (20) - Pried open a lock + StatChange( pSoldier, STRAMT, 20, FALSE ); // succeeded! door can never be locked again, so remove from door list... RemoveDoorInfoFromTable( pDoor->sGridNo ); // award experience points? // Play lock busted sound - PlayJA2Sample( ( (UINT8)BREAK_LOCK ), RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( ( (UINT8)BREAK_LOCK ), RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); return( TRUE ); } @@ -452,7 +452,7 @@ BOOLEAN AttemptToSmashDoor( SOLDIERTYPE * pSoldier, DOOR * pDoor ) { if (iResult > -10) { - ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ LOCK_HAS_BEEN_HIT ] ); + ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ LOCK_HAS_BEEN_HIT ] ); // STR GAIN - Damaged a lock by prying StatChange( pSoldier, STRAMT, 5, FALSE ); @@ -495,9 +495,9 @@ BOOLEAN AttemptToPickLock( SOLDIERTYPE * pSoldier, DOOR * pDoor ) // Play lockpicking // ATE: Moved to animation - //PlayJA2Sample( ( (UINT8)PICKING_LOCK ), RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + //PlayJA2Sample( ( (UINT8)PICKING_LOCK ), RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); - // See if we measure up to the task. + // See if we measure up to the task. // The difficulty is negated here to make it a skill adjustment if ( pLock->ubPickDifficulty == OPENING_NOT_POSSIBLE ) { @@ -511,17 +511,17 @@ BOOLEAN AttemptToPickLock( SOLDIERTYPE * pSoldier, DOOR * pDoor ) } if (iResult > 0) { - // MECHANICAL GAIN: Picked open a lock - StatChange( pSoldier, MECHANAMT, ( UINT16 ) ( pLock->ubPickDifficulty / 5 ), FALSE ); + // MECHANICAL GAIN: Picked open a lock + StatChange( pSoldier, MECHANAMT, ( UINT16 ) ( pLock->ubPickDifficulty / 5 ), FALSE ); - // DEXTERITY GAIN: Picked open a lock - StatChange( pSoldier, DEXTAMT, ( UINT16 ) ( pLock->ubPickDifficulty / 10 ), FALSE ); + // DEXTERITY GAIN: Picked open a lock + StatChange( pSoldier, DEXTAMT, ( UINT16 ) ( pLock->ubPickDifficulty / 10 ), FALSE ); - // WISDOM GAIN: Picked open a lock (Snap) + // WISDOM GAIN: Picked open a lock (Snap) if ( bReason == ELECTRONIC_LOCKPICKING_CHECK ) - StatChange( pSoldier, WISDOMAMT, ( UINT16 ) ( pLock->ubPickDifficulty / 10 ), FALSE ); + StatChange( pSoldier, WISDOMAMT, ( UINT16 ) ( pLock->ubPickDifficulty / 10 ), FALSE ); else - StatChange( pSoldier, WISDOMAMT, ( UINT16 ) ( pLock->ubPickDifficulty / 15 ), FALSE ); + StatChange( pSoldier, WISDOMAMT, ( UINT16 ) ( pLock->ubPickDifficulty / 15 ), FALSE ); @@ -542,8 +542,8 @@ BOOLEAN AttemptToUntrapDoor( SOLDIERTYPE * pSoldier, DOOR * pDoor ) { INT32 iResult; - // See if we measure up to the task. - if ( pDoor->ubTrapID == EXPLOSION ) + // See if we measure up to the task. + if ( pDoor->ubTrapID == EXPLOSION ) { iResult = SkillCheck( pSoldier, DISARM_TRAP_CHECK, (INT8) (pDoor->ubTrapLevel * 7) ); } @@ -620,7 +620,7 @@ BOOLEAN HasDoorTrapGoneOff( SOLDIERTYPE * pSoldier, DOOR * pDoor ) void HandleDoorTrap( SOLDIERTYPE * pSoldier, DOOR * pDoor ) { - if ( !( DoorTrapTable[ pDoor->ubTrapID ].fFlags & DOOR_TRAP_SILENT ) ) + if ( !( DoorTrapTable[ pDoor->ubTrapID ].fFlags & DOOR_TRAP_SILENT ) ) { switch( pDoor->ubTrapID ) { @@ -643,7 +643,7 @@ void HandleDoorTrap( SOLDIERTYPE * pSoldier, DOOR * pDoor ) // cause damage as a regular hand grenade IgniteExplosion( NOBODY, CenterX( pSoldier->sGridNo ), (INT16)CenterY( pSoldier->sGridNo ), 25, pSoldier->sGridNo, HAND_GRENADE, 0 ); break; - + case SIREN: // play siren sound effect but otherwise treat as silent alarm, calling // available enemies to this location @@ -664,30 +664,30 @@ void HandleDoorTrap( SOLDIERTYPE * pSoldier, DOOR * pDoor ) // insert electrical sound effect here PlayJA2Sample( DOOR_ELECTRICITY, RATE_11025, SoundVolume( MIDVOLUME, pDoor->sGridNo ), 1, SoundDir( pDoor->sGridNo ) ); - // Set attacker's ID - pSoldier->ubAttackerID = pSoldier->ubID; - // Increment being attacked count - // pSoldier->bBeingAttackedCount++; - // gTacticalStatus.ubAttackBusyCount++; - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("!!!!!!! Trap gone off %d", gTacticalStatus.ubAttackBusyCount) ); - DebugAttackBusy( "!!!!!!! Trap gone off\n" ); + // Set attacker's ID + pSoldier->ubAttackerID = pSoldier->ubID; + // Increment being attacked count + // pSoldier->bBeingAttackedCount++; + // gTacticalStatus.ubAttackBusyCount++; + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("!!!!!!! Trap gone off %d", gTacticalStatus.ubAttackBusyCount) ); + DebugAttackBusy( "!!!!!!! Trap gone off\n" ); - SoldierTakeDamage( pSoldier, 0, (UINT16) (10 + PreRandom( 10 )), (UINT16) ((3 + PreRandom( 3 ) * 1000)), TAKE_DAMAGE_ELECTRICITY, NOBODY, pDoor->sGridNo, 0, TRUE ); + pSoldier->SoldierTakeDamage( 0, (UINT16) (10 + PreRandom( 10 )), (UINT16) ((3 + PreRandom( 3 ) * 1000)), TAKE_DAMAGE_ELECTRICITY, NOBODY, pDoor->sGridNo, 0, TRUE ); break; case SUPER_ELECTRIC: // insert electrical sound effect here - PlayJA2Sample( DOOR_ELECTRICITY, RATE_11025, SoundVolume( MIDVOLUME, pDoor->sGridNo ), 1, SoundDir( pDoor->sGridNo ) ); + PlayJA2Sample( DOOR_ELECTRICITY, RATE_11025, SoundVolume( MIDVOLUME, pDoor->sGridNo ), 1, SoundDir( pDoor->sGridNo ) ); - // Set attacker's ID - pSoldier->ubAttackerID = pSoldier->ubID; - // Increment being attacked count - // pSoldier->bBeingAttackedCount++; - // gTacticalStatus.ubAttackBusyCount++; - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("!!!!!!! Trap gone off %d", gTacticalStatus.ubAttackBusyCount) ); - DebugAttackBusy( "!!!!!!! Trap gone off\n" ); + // Set attacker's ID + pSoldier->ubAttackerID = pSoldier->ubID; + // Increment being attacked count + // pSoldier->bBeingAttackedCount++; + // gTacticalStatus.ubAttackBusyCount++; + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("!!!!!!! Trap gone off %d", gTacticalStatus.ubAttackBusyCount) ); + DebugAttackBusy( "!!!!!!! Trap gone off\n" ); - SoldierTakeDamage( pSoldier, 0, (UINT16) (20 + PreRandom( 20 )), (UINT16) ((6 + PreRandom( 6 ) * 1000)), TAKE_DAMAGE_ELECTRICITY, NOBODY, pDoor->sGridNo, 0, TRUE ); + pSoldier->SoldierTakeDamage( 0, (UINT16) (20 + PreRandom( 20 )), (UINT16) ((6 + PreRandom( 6 ) * 1000)), TAKE_DAMAGE_ELECTRICITY, NOBODY, pDoor->sGridNo, 0, TRUE ); break; @@ -742,13 +742,13 @@ BOOLEAN AttemptToBlowUpLock( SOLDIERTYPE * pSoldier, DOOR * pDoor ) CreateAnimationTile( &AniParams ); - PlayJA2Sample( SMALL_EXPLODE_1 , RATE_11025, SoundVolume( (INT8)HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); + PlayJA2Sample( SMALL_EXPLODE_1 , RATE_11025, SoundVolume( (INT8)HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); // Remove the explosive..... bSlot = FindLockBomb( pSoldier ); if (bSlot != NO_SLOT) { - RemoveObjs( &(pSoldier->inv[ bSlot ]), 1 ); + pSoldier->inv[ bSlot ].RemoveObjectsFromStack(1); DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); } } @@ -769,7 +769,7 @@ BOOLEAN AttemptToBlowUpLock( SOLDIERTYPE * pSoldier, DOOR * pDoor ) bSlot = FindLockBomb( pSoldier ); if (bSlot != NO_SLOT) { - RemoveObjs( &(pSoldier->inv[ bSlot ]), 1 ); + pSoldier->inv[ bSlot ].RemoveObjectsFromStack(1); DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); } @@ -779,7 +779,7 @@ BOOLEAN AttemptToBlowUpLock( SOLDIERTYPE * pSoldier, DOOR * pDoor ) return( FALSE ); } -//File I/O for loading the door information from the map. This automatically allocates +//File I/O for loading the door information from the map. This automatically allocates //the exact number of slots when loading. void LoadDoorTableFromMap( INT8 **hBuffer ) { @@ -801,8 +801,8 @@ void LoadDoorTableFromMap( INT8 **hBuffer ) } } -//Saves the existing door information to the map. Before it actually saves, it'll verify that the -//door still exists. Otherwise, it'll ignore it. It is possible in the editor to delete doors in +//Saves the existing door information to the map. Before it actually saves, it'll verify that the +//door still exists. Otherwise, it'll ignore it. It is possible in the editor to delete doors in //many different ways, so I opted to put it in the saving routine. void SaveDoorTableToMap( HWFILE fp ) { @@ -820,7 +820,7 @@ void SaveDoorTableToMap( HWFILE fp ) FileWrite( fp, DoorTable, sizeof( DOOR )*gubNumDoors, &uiBytesWritten ); } -//The editor adds locks to the world. If the gridno already exists, then the currently existing door +//The editor adds locks to the world. If the gridno already exists, then the currently existing door //information is overwritten. void AddDoorInfoToTable( DOOR *pDoor ) { @@ -859,28 +859,28 @@ void AddDoorInfoToTable( DOOR *pDoor ) } //When the editor removes a door from the world, this function looks for and removes accompanying door -//information. If the entry is not the last entry, the last entry is move to it's current slot, to keep +//information. If the entry is not the last entry, the last entry is move to it's current slot, to keep //everything contiguous. void RemoveDoorInfoFromTable( INT32 iMapIndex ) { INT32 i; - INT32 iNumDoorsToCopy; + INT32 iNumDoorsToCopy; for( i = 0; i < gubNumDoors; i++ ) { if( DoorTable[ i ].sGridNo == iMapIndex ) { - iNumDoorsToCopy = gubNumDoors - i - 1; - if( iNumDoorsToCopy ) - { - memmove( &DoorTable[ i ], &DoorTable[ i+1 ], sizeof( DOOR ) * iNumDoorsToCopy ); - } + iNumDoorsToCopy = gubNumDoors - i - 1; + if( iNumDoorsToCopy ) + { + memmove( &DoorTable[ i ], &DoorTable[ i+1 ], sizeof( DOOR ) * iNumDoorsToCopy ); + } gubNumDoors--; return; } } } -//This is the link to see if a door exists at a gridno. +//This is the link to see if a door exists at a gridno. DOOR* FindDoorInfoAtGridNo( INT32 iMapIndex ) { INT32 i; @@ -892,7 +892,7 @@ DOOR* FindDoorInfoAtGridNo( INT32 iMapIndex ) return NULL; } -//Upon world deallocation, the door table needs to be deallocated. Remember, this function +//Upon world deallocation, the door table needs to be deallocated. Remember, this function //resets the values, so make sure you do this before you change gubNumDoors or gubMaxDoors. void TrashDoorTable() { @@ -909,7 +909,7 @@ void UpdateDoorPerceivedValue( DOOR *pDoor ) { pDoor->bPerceivedLocked = DOOR_PERCEIVED_LOCKED; } - else if ( !pDoor->fLocked ) + else if ( !pDoor->fLocked ) { pDoor->bPerceivedLocked = DOOR_PERCEIVED_UNLOCKED; } @@ -929,7 +929,7 @@ void UpdateDoorPerceivedValue( DOOR *pDoor ) -BOOLEAN SaveDoorTableToDoorTableTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) +BOOLEAN SaveDoorTableToDoorTableTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) { UINT32 uiNumBytesWritten; UINT32 uiSizeToSave=0; @@ -960,7 +960,7 @@ BOOLEAN SaveDoorTableToDoorTableTempFile( INT16 sSectorX, INT16 sSectorY, INT8 } - + //Open the file for writing, Create it if it doesnt exist hFile = FileOpen( zMapName, FILE_ACCESS_WRITE | FILE_OPEN_ALWAYS, FALSE ); if( hFile == 0 ) @@ -991,8 +991,8 @@ BOOLEAN SaveDoorTableToDoorTableTempFile( INT16 sSectorX, INT16 sSectorY, INT8 } } - - //Set the sector flag indicating that there is a Door table temp file present + + //Set the sector flag indicating that there is a Door table temp file present SetSectorFlag( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, SF_DOOR_TABLE_TEMP_FILES_EXISTS ); FileClose( hFile ); @@ -1103,7 +1103,7 @@ BOOLEAN ModifyDoorStatus( INT16 sGridNo, BOOLEAN fOpen, BOOLEAN fPerceivedOpen ) #endif return( FALSE ); } - + //if there is an array if( gpDoorStatus ) { @@ -1178,14 +1178,14 @@ BOOLEAN ModifyDoorStatus( INT16 sGridNo, BOOLEAN fOpen, BOOLEAN fPerceivedOpen ) if ( fPerceivedOpen != DONTSETDOORSTATUS ) { if( fOpen ) - gpDoorStatus[ gubNumDoorStatus-1 ].ubFlags |= DOOR_PERCEIVED_OPEN; + gpDoorStatus[ gubNumDoorStatus-1 ].ubFlags |= DOOR_PERCEIVED_OPEN; } else { - gpDoorStatus[ gubNumDoorStatus-1 ].ubFlags |= DOOR_PERCEIVED_NOTSET; + gpDoorStatus[ gubNumDoorStatus-1 ].ubFlags |= DOOR_PERCEIVED_NOTSET; } - // flag the tile as containing a door status + // flag the tile as containing a door status gpWorldLevelData[ pBaseStructure->sGridNo ].ubExtFlags[0] |= MAPELEMENT_EXT_DOOR_STATUS_PRESENT; return( TRUE ); @@ -1295,11 +1295,11 @@ DOOR_STATUS *GetDoorStatus( INT16 sGridNo ) BOOLEAN AllMercsLookForDoor( INT16 sGridNo, BOOLEAN fUpdateValue ) { - INT32 cnt, cnt2; - INT8 bDirs[ 8 ] = { NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST }; - SOLDIERTYPE *pSoldier; - DOOR_STATUS *pDoorStatus; - INT16 usNewGridNo; + INT32 cnt, cnt2; + INT8 bDirs[ 8 ] = { NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST }; + SOLDIERTYPE *pSoldier; + DOOR_STATUS *pDoorStatus; + INT16 sNewGridNo; // Get door pDoorStatus = GetDoorStatus( sGridNo ); @@ -1312,11 +1312,11 @@ BOOLEAN AllMercsLookForDoor( INT16 sGridNo, BOOLEAN fUpdateValue ) // IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED! cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++ ) - { + { // ATE: Ok, lets check for some basic things here! - if ( pSoldier->bLife >= OKLIFE && pSoldier->sGridNo != NOWHERE && pSoldier->bActive && pSoldier->bInSector ) + if ( pSoldier->stats.bLife >= OKLIFE && pSoldier->sGridNo != NOWHERE && pSoldier->bActive && pSoldier->bInSector ) { // and we can trace a line of sight to his x,y coordinates? // (taking into account we are definitely aware of this guy now) @@ -1333,10 +1333,10 @@ BOOLEAN AllMercsLookForDoor( INT16 sGridNo, BOOLEAN fUpdateValue ) // Now try other adjacent gridnos... for ( cnt2 = 0; cnt2 < 8; cnt2++ ) { - usNewGridNo = NewGridNo( sGridNo, DirectionInc( bDirs[ cnt2 ] ) ); + sNewGridNo = NewGridNo( sGridNo, DirectionInc( bDirs[ cnt2 ] ) ); // and we can trace a line of sight to his x,y coordinates? // (taking into account we are definitely aware of this guy now) - if ( SoldierTo3DLocationLineOfSightTest( pSoldier, usNewGridNo, 0, 0, TRUE, CALC_FROM_ALL_DIRS ) ) + if ( SoldierTo3DLocationLineOfSightTest( pSoldier, sNewGridNo, 0, 0, TRUE, CALC_FROM_ALL_DIRS ) ) { // Update status... if ( fUpdateValue ) @@ -1355,11 +1355,11 @@ BOOLEAN AllMercsLookForDoor( INT16 sGridNo, BOOLEAN fUpdateValue ) BOOLEAN MercLooksForDoors( SOLDIERTYPE *pSoldier, BOOLEAN fUpdateValue ) { - INT32 cnt, cnt2; - INT16 sGridNo; - DOOR_STATUS *pDoorStatus; - INT8 bDirs[ 8 ] = { NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST }; - INT16 usNewGridNo; + INT32 cnt, cnt2; + INT16 sGridNo; + DOOR_STATUS *pDoorStatus; + INT8 bDirs[ 8 ] = { NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST }; + INT16 sNewGridNo; @@ -1392,10 +1392,10 @@ BOOLEAN MercLooksForDoors( SOLDIERTYPE *pSoldier, BOOLEAN fUpdateValue ) // Now try other adjacent gridnos... for ( cnt2 = 0; cnt2 < 8; cnt2++ ) { - usNewGridNo = NewGridNo( sGridNo, DirectionInc( bDirs[ cnt2 ] ) ); + sNewGridNo = NewGridNo( sGridNo, DirectionInc( bDirs[ cnt2 ] ) ); // and we can trace a line of sight to his x,y coordinates? // (taking into account we are definitely aware of this guy now) - if ( SoldierTo3DLocationLineOfSightTest( pSoldier, usNewGridNo, 0, 0, TRUE, CALC_FROM_ALL_DIRS ) ) + if ( SoldierTo3DLocationLineOfSightTest( pSoldier, sNewGridNo, 0, 0, TRUE, CALC_FROM_ALL_DIRS ) ) { // Update status... if ( fUpdateValue ) @@ -1418,7 +1418,7 @@ void SyncronizeDoorStatusToStructureData( DOOR_STATUS *pDoorStatus ) { STRUCTURE *pStructure, *pBaseStructure; LEVELNODE * pNode; - INT16 sBaseGridNo = NOWHERE; + INT16 sBaseGridNo = NOWHERE; // First look for a door structure here... pStructure = FindStructure( pDoorStatus->sGridNo, STRUCTURE_ANYDOOR ); @@ -1426,7 +1426,7 @@ void SyncronizeDoorStatusToStructureData( DOOR_STATUS *pDoorStatus ) if (pStructure) { pBaseStructure = FindBaseStructure( pStructure ); - sBaseGridNo = pBaseStructure->sGridNo; + sBaseGridNo = pBaseStructure->sGridNo; } else { @@ -1453,7 +1453,7 @@ void SyncronizeDoorStatusToStructureData( DOOR_STATUS *pDoorStatus ) // ATE: OK let me explain something here: // One of the purposes of this function is to MAKE sure the door status MATCHES // the struct data value - if not - change ( REGARDLESS of perceived being used or not... ) - // + // // Check for opened... if ( pDoorStatus->ubFlags & DOOR_OPEN ) { @@ -1461,25 +1461,25 @@ void SyncronizeDoorStatusToStructureData( DOOR_STATUS *pDoorStatus ) if ( !( pStructure->fFlags & STRUCTURE_OPEN ) ) { // Swap! - SwapStructureForPartner( sBaseGridNo, pBaseStructure ); + SwapStructureForPartner( sBaseGridNo, pBaseStructure ); RecompileLocalMovementCosts( sBaseGridNo ); } } else - { + { if ( ( pStructure->fFlags & STRUCTURE_OPEN ) ) { // Swap! - SwapStructureForPartner( sBaseGridNo, pBaseStructure ); + SwapStructureForPartner( sBaseGridNo, pBaseStructure ); RecompileLocalMovementCosts( sBaseGridNo ); } } -} +} void UpdateDoorGraphicsFromStatus( BOOLEAN fUsePerceivedStatus, BOOLEAN fDirty ) { - INT32 cnt; - DOOR_STATUS *pDoorStatus; + INT32 cnt; + DOOR_STATUS *pDoorStatus; for ( cnt = 0; cnt < gubNumDoorStatus; cnt++ ) { @@ -1498,9 +1498,9 @@ void InternalUpdateDoorGraphicFromStatus( DOOR_STATUS *pDoorStatus, BOOLEAN fUse INT32 cnt; BOOLEAN fOpenedGraphic = FALSE; LEVELNODE * pNode; - BOOLEAN fWantToBeOpen = FALSE; - BOOLEAN fDifferent = FALSE; - INT16 sBaseGridNo = NOWHERE; + BOOLEAN fWantToBeOpen = FALSE; + BOOLEAN fDifferent = FALSE; + INT16 sBaseGridNo = NOWHERE; // OK, look at perceived status and adjust graphic @@ -1510,7 +1510,7 @@ void InternalUpdateDoorGraphicFromStatus( DOOR_STATUS *pDoorStatus, BOOLEAN fUse if (pStructure) { pBaseStructure = FindBaseStructure( pStructure ); - sBaseGridNo = pBaseStructure->sGridNo; + sBaseGridNo = pBaseStructure->sGridNo; } else { @@ -1566,7 +1566,7 @@ void InternalUpdateDoorGraphicFromStatus( DOOR_STATUS *pDoorStatus, BOOLEAN fUse // OK, we either have an opened graphic, in which case we want to switch to the closed, or a closed // in which case we want to switch to opened... - // adjust o' graphic + // adjust object' graphic // OK, we now need to test these things against the true structure data @@ -1575,7 +1575,7 @@ void InternalUpdateDoorGraphicFromStatus( DOOR_STATUS *pDoorStatus, BOOLEAN fUse { BOOLEAN fFound = FALSE; // Adjust graphic.... - + // Loop through and and find opened graphic for the closed one.... cnt = 0; while( gOpenDoorList[ cnt ] != -1 ) @@ -1588,7 +1588,7 @@ void InternalUpdateDoorGraphicFromStatus( DOOR_STATUS *pDoorStatus, BOOLEAN fUse } cnt++; }; - + // OK, now use opened graphic. if ( fFound ) { @@ -1603,13 +1603,13 @@ void InternalUpdateDoorGraphicFromStatus( DOOR_STATUS *pDoorStatus, BOOLEAN fUse return; } - + // If we want to be closed but structure is closed if ( !fWantToBeOpen && !( pStructure->fFlags & STRUCTURE_OPEN ) ) { BOOLEAN fFound = FALSE; // Adjust graphic.... - + // Loop through and and find closed graphic for the opend one.... cnt = 0; while( gClosedDoorList[ cnt ] != -1 ) @@ -1622,7 +1622,7 @@ void InternalUpdateDoorGraphicFromStatus( DOOR_STATUS *pDoorStatus, BOOLEAN fUse } cnt++; }; - + // OK, now use opened graphic. if ( fFound ) { @@ -1666,7 +1666,7 @@ void InternalUpdateDoorGraphicFromStatus( DOOR_STATUS *pDoorStatus, BOOLEAN fUse if ( fDifferent ) { SwapStructureForPartner( sBaseGridNo, pBaseStructure ); - + RecompileLocalMovementCosts( sBaseGridNo ); if ( fDirty ) @@ -1687,7 +1687,7 @@ BOOLEAN InternalIsPerceivedDifferentThanReality( DOOR_STATUS *pDoorStatus ) // Compare flags.... if ( ( pDoorStatus->ubFlags & DOOR_OPEN && pDoorStatus->ubFlags & DOOR_PERCEIVED_OPEN ) || - ( !( pDoorStatus->ubFlags & DOOR_OPEN ) && !( pDoorStatus->ubFlags & DOOR_PERCEIVED_OPEN ) ) ) + ( !( pDoorStatus->ubFlags & DOOR_OPEN ) && !( pDoorStatus->ubFlags & DOOR_PERCEIVED_OPEN ) ) ) { return( FALSE ); } @@ -1711,7 +1711,7 @@ void InternalUpdateDoorsPerceivedValue( DOOR_STATUS *pDoorStatus ) BOOLEAN UpdateDoorStatusPerceivedValue( INT16 sGridNo ) { DOOR_STATUS *pDoorStatus = NULL; - + pDoorStatus = GetDoorStatus( sGridNo ); CHECKF( pDoorStatus != NULL ); @@ -1724,7 +1724,7 @@ BOOLEAN UpdateDoorStatusPerceivedValue( INT16 sGridNo ) BOOLEAN IsDoorPerceivedOpen( INT16 sGridNo ) { DOOR_STATUS * pDoorStatus; - + pDoorStatus = GetDoorStatus( sGridNo ); if (pDoorStatus && pDoorStatus->ubFlags & DOOR_PERCEIVED_OPEN) @@ -1762,7 +1762,7 @@ BOOLEAN InternalSetDoorPerceivedOpenStatus( DOOR_STATUS *pDoorStatus, BOOLEAN fP BOOLEAN SetDoorPerceivedOpenStatus( INT16 sGridNo, BOOLEAN fPerceivedOpen ) { DOOR_STATUS *pDoorStatus = NULL; - + pDoorStatus = GetDoorStatus( sGridNo ); CHECKF( pDoorStatus != NULL ); @@ -1778,7 +1778,7 @@ BOOLEAN SetDoorOpenStatus( INT16 sGridNo, BOOLEAN fOpen ) pDoorStatus = GetDoorStatus( sGridNo ); - if ( pDoorStatus ) + if ( pDoorStatus ) { if( fOpen ) { @@ -1922,7 +1922,7 @@ BOOLEAN LoadDoorStatusArrayFromDoorStatusTempFile() // the graphics will be updated later in the loading process. - // set flags in map for containing a door status + // set flags in map for containing a door status for (ubLoop = 0; ubLoop < gubNumDoorStatus; ubLoop++) { gpWorldLevelData[ gpDoorStatus[ ubLoop ].sGridNo ].ubExtFlags[0] |= MAPELEMENT_EXT_DOOR_STATUS_PRESENT; @@ -1968,11 +1968,11 @@ BOOLEAN LoadKeyTableFromSaveedGameFile( HWFILE hFile ) void ExamineDoorsOnEnteringSector( ) { - INT32 cnt; - DOOR_STATUS *pDoorStatus; - SOLDIERTYPE *pSoldier; - BOOLEAN fOK = FALSE; - INT8 bTownId; + INT32 cnt; + DOOR_STATUS *pDoorStatus; + SOLDIERTYPE *pSoldier; + BOOLEAN fOK = FALSE; + INT8 bTownId; // OK, only do this if conditions are met.... // If this is any omerta tow, don't do it... @@ -1992,9 +1992,9 @@ void ExamineDoorsOnEnteringSector( ) // there is at least one human being in that sector. // check for civ cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; - // look for all mercs on the same team, - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ LAST_TEAM ].bLastID; cnt++ ,pSoldier++ ) - { + // look for all mercs on the same team, + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ LAST_TEAM ].bLastID; cnt++ ,pSoldier++ ) + { if ( pSoldier->bActive ) { if ( pSoldier->bInSector ) @@ -2024,12 +2024,12 @@ void ExamineDoorsOnEnteringSector( ) void HandleDoorsChangeWhenEnteringSectorCurrentlyLoaded( ) { - INT32 cnt; - DOOR_STATUS *pDoorStatus; - SOLDIERTYPE *pSoldier; - BOOLEAN fOK = FALSE; - INT32 iNumNewMercs = 0; - INT8 bTownId; + INT32 cnt; + DOOR_STATUS *pDoorStatus; + SOLDIERTYPE *pSoldier; + BOOLEAN fOK = FALSE; + INT32 iNumNewMercs = 0; + INT8 bTownId; // OK, only do this if conditions are met.... @@ -2051,9 +2051,9 @@ void HandleDoorsChangeWhenEnteringSectorCurrentlyLoaded( ) return; } - // look for all mercs on the same team, - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ LAST_TEAM ].bLastID; cnt++ ,pSoldier++ ) - { + // look for all mercs on the same team, + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ LAST_TEAM ].bLastID; cnt++ ,pSoldier++ ) + { if ( pSoldier->bActive && pSoldier->bInSector ) { fOK = TRUE; @@ -2063,8 +2063,8 @@ void HandleDoorsChangeWhenEnteringSectorCurrentlyLoaded( ) // Loop through our team now.... cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++ ,pSoldier++ ) - { + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++ ,pSoldier++ ) + { if ( pSoldier->bActive && pSoldier->bInSector && gbMercIsNewInThisSector[ cnt ] ) { iNumNewMercs++; @@ -2093,7 +2093,7 @@ void HandleDoorsChangeWhenEnteringSectorCurrentlyLoaded( ) HandleDoorChangeFromGridNo( NULL, pDoorStatus->sGridNo, TRUE ); gfSetPerceivedDoorState = FALSE; - + AllMercsLookForDoor( pDoorStatus->sGridNo, TRUE ); InternalUpdateDoorGraphicFromStatus( pDoorStatus, TRUE, TRUE ); @@ -2106,44 +2106,42 @@ void HandleDoorsChangeWhenEnteringSectorCurrentlyLoaded( ) void DropKeysInKeyRing( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, INT8 bVisible, BOOLEAN fAddToDropList, INT32 iDropListSlot, BOOLEAN fUseUnLoaded ) { - UINT8 ubLoop; - UINT8 ubItem; - OBJECTTYPE Object; - if (!(pSoldier->pKeyRing)) { // no key ring! return; } + UINT8 ubLoop; + UINT8 ubItem; for (ubLoop = 0; ubLoop < NUM_KEYS; ubLoop++) { - ubItem = pSoldier->pKeyRing[ ubLoop ].ubKeyID; + ubItem = pSoldier->pKeyRing[ ubLoop ].ubKeyID; - if ( pSoldier->pKeyRing[ubLoop].ubNumber > 0 ) - { - CreateKeyObject( &Object, pSoldier->pKeyRing[ubLoop].ubNumber, ubItem ); + if ( pSoldier->pKeyRing[ubLoop].ubNumber > 0 ) + { + CreateKeyObject( &gTempObject, pSoldier->pKeyRing[ubLoop].ubNumber, ubItem ); - // Zero out entry - pSoldier->pKeyRing[ ubLoop ].ubNumber = 0; - pSoldier->pKeyRing[ ubLoop ].ubKeyID = INVALID_KEY_NUMBER; + // Zero out entry + pSoldier->pKeyRing[ ubLoop ].ubNumber = 0; + pSoldier->pKeyRing[ ubLoop ].ubKeyID = INVALID_KEY_NUMBER; - if ( fAddToDropList ) - { - AddItemToLeaveIndex( &Object, iDropListSlot ); - } - else - { - if( pSoldier->sSectorX != gWorldSectorX || pSoldier->sSectorY != gWorldSectorY || pSoldier->bSectorZ != gbWorldSectorZ || fUseUnLoaded ) - { - // Set flag for item... - AddItemsToUnLoadedSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ , sGridNo, 1, &Object , bLevel, WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO | WORLD_ITEM_REACHABLE, 0, bVisible, FALSE ); - } - else - { - // Add to pool - AddItemToPool( sGridNo, &Object, bVisible, bLevel, 0, 0 ); - } - } - } + if ( fAddToDropList ) + { + AddItemToLeaveIndex( &gTempObject, iDropListSlot ); + } + else + { + if( pSoldier->sSectorX != gWorldSectorX || pSoldier->sSectorY != gWorldSectorY || pSoldier->bSectorZ != gbWorldSectorZ || fUseUnLoaded ) + { + // Set flag for item... + AddItemsToUnLoadedSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ , sGridNo, 1, &gTempObject , bLevel, WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO | WORLD_ITEM_REACHABLE, 0, bVisible, FALSE ); + } + else + { + // Add to pool + AddItemToPool( sGridNo, &gTempObject, bVisible, bLevel, 0, 0 ); + } + } + } } } diff --git a/Tactical/Keys.h b/Tactical/Keys.h index 25f5b6b4..201bb5f9 100644 --- a/Tactical/Keys.h +++ b/Tactical/Keys.h @@ -4,6 +4,11 @@ #include "types.h" #include "FileMan.h" +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + typedef struct { UINT16 usItem; // index in item table for key @@ -90,7 +95,7 @@ typedef enum typedef struct { - UINT8 fFlags; // stops action? recurring trap? + UINT8 fFlags; // stops action? recurring trap? } DOORTRAP; @@ -102,7 +107,7 @@ typedef struct #define DOOR_HAS_TIN_CAN 0x10 -#define DONTSETDOORSTATUS 2 +#define DONTSETDOORSTATUS 2 typedef struct { @@ -140,34 +145,34 @@ extern STR16 sKeyDescriptionStrings[]; * Door utils add by Kris Morness * **********************************/ -//Dynamic array of Doors. For general game purposes, the doors that are locked and/or trapped -//are permanently saved within the map, and are loaded and allocated when the map is loaded. Because +//Dynamic array of Doors. For general game purposes, the doors that are locked and/or trapped +//are permanently saved within the map, and are loaded and allocated when the map is loaded. Because //the editor allows more doors to be added, or removed, the actual size of the DoorTable may change. extern DOOR *DoorTable; //Current number of doors in world. extern UINT8 gubNumDoors; -//Current max number of doors. This is only used by the editor. When adding doors to the +//Current max number of doors. This is only used by the editor. When adding doors to the //world, we may run out of space in the DoorTable, so we will allocate a new array with extra slots, -//then copy everything over again. gubMaxDoors holds the arrays actual number of slots, even though +//then copy everything over again. gubMaxDoors holds the arrays actual number of slots, even though //the current number (gubNumDoors) will be <= to it. extern UINT8 gubMaxDoors; -//File I/O for loading the door information from the map. This automatically allocates +//File I/O for loading the door information from the map. This automatically allocates //the exact number of slots when loading. extern void LoadDoorTableFromMap( INT8 **hBuffer ); -//Saves the existing door information to the map. Before it actually saves, it'll verify that the -//door still exists. Otherwise, it'll ignore it. It is possible in the editor to delete doors in +//Saves the existing door information to the map. Before it actually saves, it'll verify that the +//door still exists. Otherwise, it'll ignore it. It is possible in the editor to delete doors in //many different ways, so I opted to put it in the saving routine. extern void SaveDoorTableToMap( HWFILE fp ); -//The editor adds locks to the world. If the gridno already exists, then the currently existing door +//The editor adds locks to the world. If the gridno already exists, then the currently existing door //information is overwritten. extern void AddDoorInfoToTable( DOOR *pDoor ); //When the editor removes a door from the world, this function looks for and removes accompanying door -//information. If the entry is not the last entry, the last entry is move to it's current slot, to keep +//information. If the entry is not the last entry, the last entry is move to it's current slot, to keep //everything contiguous. extern void RemoveDoorInfoFromTable( INT32 iMapIndex ); -//This is the link to see if a door exists at a gridno. +//This is the link to see if a door exists at a gridno. DOOR * FindDoorInfoAtGridNo( INT32 iMapIndex ); //Upon world deallocation, the door table needs to be deallocated. extern void TrashDoorTable(); @@ -188,15 +193,15 @@ void UpdateDoorPerceivedValue( DOOR *pDoor ); //Saves the Door Table array to the temp file -BOOLEAN SaveDoorTableToDoorTableTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ); +BOOLEAN SaveDoorTableToDoorTableTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ); //Load the door table from the temp file BOOLEAN LoadDoorTableFromDoorTableTempFile( ); -// Adds a door to the Door status array. As the user comes across the door, they are added. -// if the door already exists, nothing happens +// Adds a door to the Door status array. As the user comes across the door, they are added. +// if the door already exists, nothing happens // fOpen is True if the door is to be initially open, false if it is closed // fInitiallyPercieveOpen is true if the door is to be initially open, else false BOOLEAN ModifyDoorStatus( INT16 sGridNo, BOOLEAN fOpen, BOOLEAN fInitiallyPercieveOpen ); diff --git a/Tactical/LOS.cpp b/Tactical/LOS.cpp index 5c264d19..6472ad6e 100644 --- a/Tactical/LOS.cpp +++ b/Tactical/LOS.cpp @@ -12,13 +12,12 @@ #include "los.h" #include "animation control.h" #include "Random.h" -#include "soldier control.h" +//#include "soldier control.h" #include "Event Pump.h" #include "overhead.h" #include "weapons.h" #include "opplist.h" -#include "soldier control.h" #include "bullets.h" #include "phys math.h" @@ -40,8 +39,14 @@ #include "Smell.h" #include "Text.h" #include "Quests.h" +#include "items.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + #define STEPS_FOR_BULLET_MOVE_TRAILS 10 #define STEPS_FOR_BULLET_MOVE_SMALL_TRAILS 5 #define STEPS_FOR_BULLET_MOVE_FIRE_TRAILS 5 @@ -49,10 +54,6 @@ #define ALWAYS_CONSIDER_HIT (STRUCTURE_WALLSTUFF | STRUCTURE_CAVEWALL | STRUCTURE_FENCE) -UINT16 gusLOSStartGridNo = 0; -UINT16 gusLOSEndGridNo = 0; -UINT16 gusLOSStartSoldier = NOBODY; -UINT16 gusLOSEndSoldier = NOBODY; extern UINT32 guiSoldierFlags; extern INT16 DirIncrementer[8]; @@ -64,6 +65,14 @@ static FIXEDPT gqStandardWindowTopHeight = INT32_TO_FIXEDPT( WINDOW_TOP_HEIGHT_U #define FIXEDPT_MULTIPLY( a, b ) ( (a / 256) * (b / 256) ) + + +//ADB When a merc calcs CTGT for a thrown item he uses a GLOCK temp item +//but we don't want to recreate it every single time CTGT is called, so init the GLOCK in InitializeJA2() +OBJECTTYPE GLOCK_17_ForUseWithLOS; + + + UINT32 FPMult32(UINT32 uiA, UINT32 uiB) { UINT32 uiResult; @@ -99,12 +108,12 @@ static DOUBLE ddShotgunSpread[3][BUCKSHOT_SHOTS][2] = { { // spread of about 2 degrees in all directions - // Horiz, Vert - { 0.0, 0.0 }, - { -0.012, 0.0 }, - { +0.012, 0.0 }, - { 0.0, -0.012}, - { 0.0, +0.012}, + // Horiz, Vert + { 0.0, 0.0 }, + { -0.012, 0.0 }, + { +0.012, 0.0 }, + { 0.0, -0.012}, + { 0.0, +0.012}, { -0.008, -0.008}, { -0.008, +0.008}, { +0.008, -0.008}, @@ -112,30 +121,30 @@ static DOUBLE ddShotgunSpread[3][BUCKSHOT_SHOTS][2] = }, { // duckbill flattens the spread and makes it wider horizontally (5 degrees) - // Horiz, Vert - { 0.0, 0.0 }, - { -0.008, 0.0 }, - { +0.008, 0.0 }, - { -0.016, 0.0 }, - { +0.016, 0.0 }, - { -0.024, 0.0 }, - { +0.024, 0.0 }, - { -0.032, 0.0 }, - { +0.032, 0.0 }, + // Horiz, Vert + { 0.0, 0.0 }, + { -0.008, 0.0 }, + { +0.008, 0.0 }, + { -0.016, 0.0 }, + { +0.016, 0.0 }, + { -0.024, 0.0 }, + { +0.024, 0.0 }, + { -0.032, 0.0 }, + { +0.032, 0.0 }, }, { // flamethrower more spread out - // Horiz, Vert - { 0.0, 0.0 }, - { -0.120, 0.0 }, - { +0.120, 0.0 }, - { 0.0, -0.120}, - { 0.0, +0.120}, + // Horiz, Vert + { 0.0, 0.0 }, + { -0.120, 0.0 }, + { +0.120, 0.0 }, + { 0.0, -0.120}, + { 0.0, +0.120}, { -0.080, -0.080}, { -0.080, +0.080}, { +0.080, -0.080}, { +0.080, +0.080} - }, + }, }; @@ -214,7 +223,7 @@ static UINT32 guiStructureHitChance[ MAX_DIST_FOR_LESS_THAN_MAX_CHANCE_TO_HIT_ST STRUCTURE * gpLocalStructure[MAX_LOCAL_STRUCTURES]; UINT32 guiLocalStructureCTH[MAX_LOCAL_STRUCTURES]; -UINT8 gubLocalStructureNumTimesHit[MAX_LOCAL_STRUCTURES]; +UINT8 gubLocalStructureNumTimesHit[MAX_LOCAL_STRUCTURES]; BOOLEAN CalculateLOSNormal( STRUCTURE *pStructure, INT8 bLOSX, INT8 bLOSY, INT8 bLOSZ, FLOAT dDeltaX, FLOAT dDeltaY, FLOAT dDeltaZ, FLOAT *pdNormalX, FLOAT *pdNormalY, FLOAT *pdNormalZ ); @@ -264,6 +273,7 @@ FLOAT Distance2D( FLOAT dDeltaX, FLOAT dDeltaY ) #if defined( JA2BETAVERSION ) && defined( DEBUGLOS ) void DebugLOS( STR szOutput ) { + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,szOutput); FILE * DebugFile; if ((DebugFile = fopen( "losdebug.txt", "a+t" )) != NULL) @@ -278,7 +288,7 @@ void DebugLOS( STR szOutput ) #define DebugLOS( a ) #endif -enum +enum { LOC_OTHER, LOC_0_4, @@ -295,7 +305,7 @@ BOOLEAN ResolveHitOnWall( STRUCTURE * pStructure, INT32 iGridNo, INT8 bLOSIndexX BOOLEAN fTopLeft, fTopRight; INT8 bLocation = LOC_OTHER; - switch ( bLOSIndexX ) + switch ( bLOSIndexX ) { case 0: if ( bLOSIndexY == 4 ) @@ -346,7 +356,7 @@ BOOLEAN ResolveHitOnWall( STRUCTURE * pStructure, INT32 iGridNo, INT8 bLOSIndexX if ( fNorthSouth ) { - // Check N-S at west corner: 4,4 4,3 0,4 + // Check N-S at west corner: 4,4 4,3 0,4 if ( bLocation == LOC_4_3 || bLocation == LOC_4_4 ) { // if wall orientation is top-right, then check S of this location @@ -367,7 +377,7 @@ BOOLEAN ResolveHitOnWall( STRUCTURE * pStructure, INT32 iGridNo, INT8 bLOSIndexX else if ( bLocation == LOC_0_4 ) { if ( fTopLeft ) - { + { if ( !WallOrClosedDoorExistsOfTopLeftOrientation( (INT16) (iGridNo + DirectionInc( WEST )) ) && !WallOrClosedDoorExistsOfTopRightOrientation( (INT16) (iGridNo + DirectionInc( SOUTHWEST ) ) ) && !OpenLeftOrientedDoorWithDoorOnLeftOfEdgeExists( (INT16) (iGridNo + DirectionInc( WEST )) ) ) @@ -378,11 +388,11 @@ BOOLEAN ResolveHitOnWall( STRUCTURE * pStructure, INT32 iGridNo, INT8 bLOSIndexX } - // Check N-S at east corner: 4,4 3,4 4,0 + // Check N-S at east corner: 4,4 3,4 4,0 if ( bLocation == LOC_4_4 || bLocation == LOC_3_4 ) { if ( fTopLeft ) - { + { if ( !WallOrClosedDoorExistsOfTopLeftOrientation( (INT16) (iGridNo + DirectionInc( EAST )) ) && !WallOrClosedDoorExistsOfTopRightOrientation( (INT16) (iGridNo) ) && !OpenLeftOrientedDoorWithDoorOnLeftOfEdgeExists( (INT16) (iGridNo + DirectionInc( EAST )) ) ) @@ -415,7 +425,7 @@ BOOLEAN ResolveHitOnWall( STRUCTURE * pStructure, INT32 iGridNo, INT8 bLOSIndexX if ( fEastWest ) { - // Check E-W at north corner: 4,4 4,0 0,4 + // Check E-W at north corner: 4,4 4,0 0,4 if ( bLocation == LOC_4_4 ) { if ( pStructure->ubWallOrientation == NO_ORIENTATION) @@ -424,14 +434,14 @@ BOOLEAN ResolveHitOnWall( STRUCTURE * pStructure, INT32 iGridNo, INT8 bLOSIndexX return( FALSE ); } } - else if ( bLocation == LOC_4_0 ) + else if ( bLocation == LOC_4_0 ) { // maybe looking E-W at (screenwise) north corner of building // if wall orientation is top-right, then check N of this location // if no wall of same orientation there, let bullet through if ( fTopRight ) { - if (!WallOrClosedDoorExistsOfTopRightOrientation( (INT16) (iGridNo + DirectionInc( NORTH )) ) && + if (!WallOrClosedDoorExistsOfTopRightOrientation( (INT16) (iGridNo + DirectionInc( NORTH )) ) && !WallOrClosedDoorExistsOfTopLeftOrientation( (INT16) (iGridNo + DirectionInc( NORTH )) ) ) { return( FALSE ); @@ -450,10 +460,10 @@ BOOLEAN ResolveHitOnWall( STRUCTURE * pStructure, INT32 iGridNo, INT8 bLOSIndexX } // if wall orientation is top-left, then check W of this location - // if no wall of same orientation there, let bullet through + // if no wall of same orientation there, let bullet through if ( fTopLeft ) { - if (!WallOrClosedDoorExistsOfTopLeftOrientation( (INT16) (iGridNo + DirectionInc( WEST )) ) && + if (!WallOrClosedDoorExistsOfTopLeftOrientation( (INT16) (iGridNo + DirectionInc( WEST )) ) && !WallOrClosedDoorExistsOfTopRightOrientation( (INT16) (iGridNo + DirectionInc( WEST )) ) ) { return( FALSE ); @@ -462,14 +472,14 @@ BOOLEAN ResolveHitOnWall( STRUCTURE * pStructure, INT32 iGridNo, INT8 bLOSIndexX } - // Check E-W at south corner: 4,4 3,4 4,3 + // Check E-W at south corner: 4,4 3,4 4,3 if ( bLocation == LOC_3_4 || bLocation == LOC_4_4 || bLocation == LOC_4_3 ) { if ( (bLocation == LOC_3_4 && fTopLeft) || (bLocation == LOC_4_3 && fTopRight) || (bLocation == LOC_4_4) ) { if ( !WallOrClosedDoorExistsOfTopLeftOrientation( (INT16) (iGridNo + DirectionInc( EAST ) ) ) && - !WallOrClosedDoorExistsOfTopRightOrientation( (INT16) (iGridNo + DirectionInc( SOUTH ) ) ) && - !OpenLeftOrientedDoorWithDoorOnLeftOfEdgeExists( (INT16) (iGridNo + DirectionInc( EAST ) ) ) && + !WallOrClosedDoorExistsOfTopRightOrientation( (INT16) (iGridNo + DirectionInc( SOUTH ) ) ) && + !OpenLeftOrientedDoorWithDoorOnLeftOfEdgeExists( (INT16) (iGridNo + DirectionInc( EAST ) ) ) && !OpenRightOrientedDoorWithDoorOnRightOfEdgeExists( (INT16) (iGridNo + DirectionInc( SOUTH ) ) ) ) { @@ -487,7 +497,7 @@ BOOLEAN ResolveHitOnWall( STRUCTURE * pStructure, INT32 iGridNo, INT8 bLOSIndexX // currently handled: - // E-W at north corner: (4,4), (0,4), (4,0) + // E-W at north corner: (4,4), (0,4), (4,0) // N-S at east corner: (4,4) // N-S at west corner: (4,4) @@ -516,10 +526,10 @@ BOOLEAN ResolveHitOnWall( STRUCTURE * pStructure, INT32 iGridNo, INT8 bLOSIndexX } // if wall orientation is top-left, then check W of this location - // if no wall of same orientation there, let bullet through + // if no wall of same orientation there, let bullet through if ( pStructure->ubWallOrientation == INSIDE_TOP_LEFT || pStructure->ubWallOrientation == OUTSIDE_TOP_LEFT ) { - if (!WallOrClosedDoorExistsOfTopLeftOrientation( (INT16) (iGridNo + DirectionInc( WEST )) ) && + if (!WallOrClosedDoorExistsOfTopLeftOrientation( (INT16) (iGridNo + DirectionInc( WEST )) ) && !WallOrClosedDoorExistsOfTopRightOrientation( (INT16) (iGridNo + DirectionInc( WEST )) ) ) { fResolveHit = FALSE; @@ -533,7 +543,7 @@ BOOLEAN ResolveHitOnWall( STRUCTURE * pStructure, INT32 iGridNo, INT8 bLOSIndexX // if wall orientation is top-left, then check W of this location // if no wall of same orientation there, let bullet through if ( pStructure->ubWallOrientation == INSIDE_TOP_LEFT || pStructure->ubWallOrientation == OUTSIDE_TOP_LEFT ) - { + { if ( !WallOrClosedDoorExistsOfTopLeftOrientation( (INT16) (iGridNo + DirectionInc( WEST )) ) && !WallOrClosedDoorExistsOfTopRightOrientation( (INT16) (iGridNo + DirectionInc( SOUTHWEST ) ) ) && !OpenLeftOrientedDoorWithDoorOnLeftOfEdgeExists( (INT16) (iGridNo + DirectionInc( WEST )) ) ) @@ -557,7 +567,7 @@ BOOLEAN ResolveHitOnWall( STRUCTURE * pStructure, INT32 iGridNo, INT8 bLOSIndexX // if no wall of same orientation there, let bullet through if ( pStructure->ubWallOrientation == INSIDE_TOP_RIGHT || pStructure->ubWallOrientation == OUTSIDE_TOP_RIGHT ) { - if (!WallOrClosedDoorExistsOfTopRightOrientation( (INT16) (iGridNo + DirectionInc( NORTH )) ) && + if (!WallOrClosedDoorExistsOfTopRightOrientation( (INT16) (iGridNo + DirectionInc( NORTH )) ) && !WallOrClosedDoorExistsOfTopLeftOrientation( (INT16) (iGridNo + DirectionInc( NORTH )) ) ) { fResolveHit = FALSE; @@ -585,7 +595,7 @@ BOOLEAN ResolveHitOnWall( STRUCTURE * pStructure, INT32 iGridNo, INT8 bLOSIndexX // if wall orientation is top-left, then check E of this location // if no wall of same orientation there, let bullet through if ( pStructure->ubWallOrientation == INSIDE_TOP_LEFT || pStructure->ubWallOrientation == OUTSIDE_TOP_LEFT ) - { + { if ( !WallOrClosedDoorExistsOfTopLeftOrientation( (INT16) (iGridNo + DirectionInc( EAST )) ) && !WallOrClosedDoorExistsOfTopRightOrientation( (INT16) (iGridNo) ) && !OpenLeftOrientedDoorWithDoorOnLeftOfEdgeExists( (INT16) (iGridNo + DirectionInc( EAST )) ) ) @@ -617,7 +627,7 @@ BOOLEAN ResolveHitOnWall( STRUCTURE * pStructure, INT32 iGridNo, INT8 bLOSIndexX } */ - return( TRUE ); + return( TRUE ); } @@ -798,7 +808,7 @@ INT32 LineOfSightTest( FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, fCheckForRoof = FALSE; - // figure out starting and ending cubes + // figure out starting and ending cubes iGridNo = GETWORLDINDEXFROMWORLDCOORDS( (INT32)dStartY, (INT32)dStartX ); qCurrZ = FloatToFixed( dStartZ ); qLandHeight = INT32_TO_FIXEDPT( CONVERT_PIXELS_TO_HEIGHTUNITS( gpWorldLevelData[ iGridNo ].sHeight ) ); @@ -815,7 +825,7 @@ INT32 LineOfSightTest( FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, qWallHeight = gqStandardWallHeight + qLandHeight; if ( qCurrZ < qWallHeight ) { - // possibly going up through a roof on this level + // possibly going up through a roof on this level qCurrZ = FloatToFixed( dEndZ ); if ( qCurrZ > qWallHeight ) @@ -851,7 +861,7 @@ INT32 LineOfSightTest( FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, if ( qCurrZ < qWallHeight ) { - // possibly going down through a roof on this level + // possibly going down through a roof on this level qCurrZ = FloatToFixed( dStartZ ); if ( qCurrZ > qWallHeight ) @@ -873,7 +883,7 @@ INT32 LineOfSightTest( FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, // apply increments for first move - // first move will be 1 step + // first move will be 1 step // plus a fractional part equal to half of the difference between the delta and // the increment times the distance @@ -970,7 +980,7 @@ INT32 LineOfSightTest( FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, if (qIncrY > 0) { - qDistToTravelY = INT32_TO_FIXEDPT( CELL_Y_SIZE ) - (qCurrY % INT32_TO_FIXEDPT( CELL_Y_SIZE )); + qDistToTravelY = INT32_TO_FIXEDPT( CELL_Y_SIZE ) - (qCurrY % INT32_TO_FIXEDPT( CELL_Y_SIZE )); iStepsToTravelY = qDistToTravelY / qIncrY; } else if (qIncrY < 0) @@ -1005,7 +1015,7 @@ INT32 LineOfSightTest( FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, if (qIncrY > 0) { - qDistToTravelY = INT32_TO_FIXEDPT( CELL_Y_SIZE ) - (qCurrY % INT32_TO_FIXEDPT( CELL_Y_SIZE )); + qDistToTravelY = INT32_TO_FIXEDPT( CELL_Y_SIZE ) - (qCurrY % INT32_TO_FIXEDPT( CELL_Y_SIZE )); iStepsToTravelY = qDistToTravelY / qIncrY; } else if (qIncrY < 0) @@ -1058,7 +1068,7 @@ INT32 LineOfSightTest( FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, if (iCurrCubesAboveLevelZ < STRUCTURE_ON_ROOF_MAX) { - if (iCurrCubesAboveLevelZ < STRUCTURE_ON_GROUND_MAX) + if (iCurrCubesAboveLevelZ < STRUCTURE_ON_GROUND_MAX) { // check objects on the ground sDesiredLevel = STRUCTURE_ON_GROUND; @@ -1090,14 +1100,14 @@ INT32 LineOfSightTest( FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, // looking up, so reduce for the target stance-height according to iEndCubesZ if ( iDistance >= (3 - iEndCubesAboveLevelZ) * CELL_X_SIZE ) { - fOpaque = FALSE; + fOpaque = FALSE; } } else { if ( iDistance >= (3 - iStartCubesAboveLevelZ) * CELL_X_SIZE ) { - fOpaque = FALSE; + fOpaque = FALSE; } } @@ -1126,7 +1136,7 @@ INT32 LineOfSightTest( FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, } else if ((pStructure->fFlags & STRUCTURE_WALLNWINDOW))// && (pStructure->fFlags & STRUCTURE_OPEN)) { - // open/closed window, smell not stopped + // open/closed window, smell not stopped } else { @@ -1139,10 +1149,10 @@ INT32 LineOfSightTest( FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, else { fResolveHit = TRUE; - } + } if (fResolveHit) { - // CJC, May 30: smell reduced by obstacles but not stopped + // CJC, May 30: smell reduced by obstacles but not stopped // if obstacle within 10 tiles iAdjSightLimit -= SMELL_REDUCTION_FOR_NEARBY_OBSTACLE; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("LineOfSightTest: hit a wall, thermal = %d, sight limit = %d, distance = %d",fSmell,iAdjSightLimit,iDistance)); @@ -1176,7 +1186,7 @@ INT32 LineOfSightTest( FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, { // don't count trees close to the person if (iLoop > CLOSE_TO_FIRER) - { + { if (iLoop > 100) { // at longer range increase the value of tree cover @@ -1259,7 +1269,7 @@ INT32 LineOfSightTest( FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, { fResolveHit = TRUE; } - } + } if (fResolveHit) { // hit the obstacle! @@ -1277,7 +1287,7 @@ INT32 LineOfSightTest( FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, } } pStructure = pStructure->pNext; - } + } } // got past all structures; go to next location within // tile, horizontally or vertically @@ -1303,12 +1313,12 @@ INT32 LineOfSightTest( FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, qCurrZ += qIncrZ; } - iLoop++; + iLoop++; bLOSIndexX = FIXEDPT_TO_LOS_INDEX( qCurrX ); bLOSIndexY = FIXEDPT_TO_LOS_INDEX( qCurrY ); iCurrCubesZ = CONVERT_HEIGHTUNITS_TO_INDEX( FIXEDPT_TO_INT32( qCurrZ ) ); // shouldn't need to check whether we are not at maximum range because - // that will be caught below and this loop shouldn't go for more than a + // that will be caught below and this loop shouldn't go for more than a // couple of iterations. } while( (bLOSIndexX == bOldLOSIndexX) && (bLOSIndexY == bOldLOSIndexY) && (iCurrCubesZ == iOldCubesZ)); @@ -1367,8 +1377,8 @@ INT32 LineOfSightTest( FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, // this somewhat complicated formula does the following: // it starts with the distance to the target // it adds the difference between the original and adjusted sight limit, = the amount of cover - // it then scales the value based on the difference between the original sight limit and the - // very maximum possible in best lighting conditions + // it then scales the value based on the difference between the original sight limit and the + // very maximum possible in best lighting conditions //return( (iDistance + (iSightLimit - iAdjSightLimit)) * (MaxDistanceVisible() * CELL_X_SIZE) / iSightLimit ); //in the original code, iSightLimit could vary depending exactly on what I can see @@ -1393,7 +1403,6 @@ INT32 LineOfSightTest( FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, return distanceWithCover; } - //I know that my sight could be over the average distance, but I am not going to clamp it //because I do not think the actual value matters, and if it does, //then using the real value is closer to the original intent @@ -1410,12 +1419,12 @@ BOOLEAN CalculateSoldierZPos( SOLDIERTYPE * pSoldier, UINT8 ubPosType, FLOAT * p // Crow always as prone... ubHeight = ANIM_PRONE; } - else if ( MercInDeepWater( pSoldier) ) + else if ( pSoldier->MercInDeepWater( ) ) { // treat as prone ubHeight = ANIM_PRONE; } - else if ( MercInShallowWater(pSoldier) ) + else if ( pSoldier->MercInShallowWater( ) ) { // treat as crouched ubHeight = ANIM_CROUCH; @@ -1424,7 +1433,7 @@ BOOLEAN CalculateSoldierZPos( SOLDIERTYPE * pSoldier, UINT8 ubPosType, FLOAT * p { if ( CREATURE_OR_BLOODCAT( pSoldier ) || pSoldier->ubBodyType == COW ) { - // this if statement is to avoid the 'creature weak spot' target + // this if statement is to avoid the 'creature weak spot' target // spot for creatures if ( ubPosType == HEAD_TARGET_POS || ubPosType == LEGS_TARGET_POS ) { @@ -1571,7 +1580,7 @@ BOOLEAN CalculateSoldierZPos( SOLDIERTYPE * pSoldier, UINT8 ubPosType, FLOAT * p *pdZPos = (*pdZPos * 4) / 3; } - if (pSoldier->bLevel > 0) + if (pSoldier->pathing.bLevel > 0) { // on a roof *pdZPos += WALL_HEIGHT_UNITS; } @@ -1618,11 +1627,11 @@ INT32 SoldierToSoldierLineOfSightTest( SOLDIERTYPE * pStartSoldier, SOLDIERTYPE } - if (pStartSoldier->uiStatusFlags & SOLDIER_MONSTER) + if (pStartSoldier->flags.uiStatusFlags & SOLDIER_MONSTER) { // monsters use smell instead of sight! dEndZPos = STANDING_LOS_POS; // should avoid low rocks etc - if (pEndSoldier->bLevel > 0) + if (pEndSoldier->pathing.bLevel > 0) { // on a roof dEndZPos += WALL_HEIGHT_UNITS; } @@ -1631,7 +1640,7 @@ INT32 SoldierToSoldierLineOfSightTest( SOLDIERTYPE * pStartSoldier, SOLDIERTYPE } else { - switch( ubAimLocation ) + switch( ubAimLocation ) { case AIM_SHOT_HEAD: ubPosType = HEAD_TARGET_POS; @@ -1703,21 +1712,21 @@ INT32 SoldierToSoldierLineOfSightTest( SOLDIERTYPE * pStartSoldier, SOLDIERTYPE switch( pEndSoldier->bOverTerrainType ) { case LOW_GRASS: - case HIGH_GRASS: // jungle camo bonus + case HIGH_GRASS: // jungle camo bonus iTileSightLimit -= iTileSightLimit * (jungle * bEffectiveCamo / 3 / totalCamo) / 100; break; case FLAT_FLOOR: // flat floor = indoors case PAVED_ROAD: // urban camo bonus iTileSightLimit -= iTileSightLimit * (urban * bEffectiveCamo / 3 / totalCamo) / 100; break; - case DIRT_ROAD: // desert camo bonus + case DIRT_ROAD: // desert camo bonus case TRAIN_TRACKS: iTileSightLimit -= iTileSightLimit * (desert * bEffectiveCamo / 3 / totalCamo) / 100; break; - //case ??? : // snow camo bonus + //case ??? : // snow camo bonus // iTileSightLimit -= iTileSightLimit * (snow * bEffectiveCamo / 3 / totalCamo) / 100; // break; - case FLAT_GROUND: + case FLAT_GROUND: //in this case both desert and jungle can work: iTileSightLimit -= iTileSightLimit * (jungle * bEffectiveCamo / 3 / totalCamo) / 100; iTileSightLimit -= iTileSightLimit * (desert * bEffectiveCamo / 3 / totalCamo) / 100; @@ -1760,10 +1769,10 @@ INT32 SoldierToSoldierLineOfSightTest( SOLDIERTYPE * pStartSoldier, SOLDIERTYPE } if (iTileSightLimit == CALC_FROM_ALL_DIRS || iTileSightLimit == CALC_FROM_WANTED_DIR) { - iTileSightLimit = pStartSoldier->GetMaxDistanceVisible( pEndSoldier->sGridNo, pEndSoldier->bLevel, iTileSightLimit ); + iTileSightLimit = pStartSoldier->GetMaxDistanceVisible( pEndSoldier->sGridNo, pEndSoldier->pathing.bLevel, iTileSightLimit ); } else if (iTileSightLimit == NO_DISTANCE_LIMIT) { - iTileSightLimit = 255 + pStartSoldier->GetMaxDistanceVisible( pEndSoldier->sGridNo, pEndSoldier->bLevel, CALC_FROM_ALL_DIRS ); + iTileSightLimit = 255 + pStartSoldier->GetMaxDistanceVisible( pEndSoldier->sGridNo, pEndSoldier->pathing.bLevel, CALC_FROM_ALL_DIRS ); } return( LineOfSightTest( (FLOAT) CenterX( pStartSoldier->sGridNo ), (FLOAT) CenterY( pStartSoldier->sGridNo ), dStartZPos, (FLOAT) CenterX( pEndSoldier->sGridNo ), (FLOAT) CenterY( pEndSoldier->sGridNo ), dEndZPos, iTileSightLimit, ubTreeReduction, bAware, bEffectiveCamo + bEffectiveStealth, fSmell, NULL, adjustForSight ) ); @@ -1778,7 +1787,7 @@ INT16 SoldierToLocationWindowTest( SOLDIERTYPE * pStartSoldier, INT16 sEndGridNo CHECKF( pStartSoldier ); dStartZPos = FixedToFloat( ((gqStandardWindowTopHeight + gqStandardWindowBottomHeight) / 2) ); - if (pStartSoldier->bLevel > 0) + if (pStartSoldier->pathing.bLevel > 0) { // on a roof dStartZPos += WALL_HEIGHT_UNITS; } @@ -1792,7 +1801,7 @@ INT16 SoldierToLocationWindowTest( SOLDIERTYPE * pStartSoldier, INT16 sEndGridNo //ADB changed from 255 to 511 to handle new LOS test // We don't want to consider distance limits here so pass in tile sight limit of 255( + 256) // and consider trees as little as possible - iRet = LineOfSightTest( (FLOAT) CenterX( pStartSoldier->sGridNo ), (FLOAT) CenterY( pStartSoldier->sGridNo ), dStartZPos, (FLOAT) sXPos, (FLOAT) sYPos, dEndZPos, 511, 0, TRUE, 0, FALSE, &sWindowGridNo ); + iRet = LineOfSightTest( (FLOAT) CenterX( pStartSoldier->sGridNo ), (FLOAT) CenterY( pStartSoldier->sGridNo ), dStartZPos, (FLOAT) sXPos, (FLOAT) sYPos, dEndZPos, 511, 0, TRUE, 0, FALSE, &sWindowGridNo ); return( sWindowGridNo ); } @@ -1956,11 +1965,10 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend BOOLEAN fStopped = TRUE; INT8 bSlot; INT8 bHeadSlot = NO_SLOT; - OBJECTTYPE Object; SOLDIERTYPE * pTarget; - INT16 sNewGridNo; - BOOLEAN fCanSpewBlood = FALSE; - INT8 bSpewBloodLevel; + INT16 sNewGridNo; + BOOLEAN fCanSpewBlood = FALSE; + INT8 bSpewBloodLevel; // structure IDs for mercs match their merc IDs pTarget = MercPtrs[ pStructure->usStructureID ]; @@ -1970,14 +1978,15 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend // Place knife on guy.... // See if they have room ( and make sure it's not in hand pos? - bSlot = FindEmptySlotWithin( pTarget, BIGPOCK1POS, SMALLPOCK8POS ); + // CHRISL: + bSlot = FindEmptySlotWithin( pTarget, BIGPOCKSTART, NUM_INV_SLOTS ); if (bSlot == NO_SLOT) { // Add item - CreateItem( pBullet->fromItem, (INT8) pBullet->ubItemStatus, &Object ); + CreateItem( pBullet->fromItem, (INT8) pBullet->ubItemStatus, &gTempObject ); - AddItemToPool( pTarget->sGridNo, &Object, -1 , pTarget->bLevel, 0, 0 ); + AddItemToPool( pTarget->sGridNo, &gTempObject, -1 , pTarget->pathing.bLevel, 0, 0 ); // Make team look for items NotifySoldiersToLookforItems( ); @@ -1986,7 +1995,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend { if ( Item[pBullet->fromItem].bloodieditem > 0 ) CreateItem( Item[pBullet->fromItem].bloodieditem, (INT8) pBullet->ubItemStatus, &(pTarget->inv[bSlot]) ); - else + else CreateItem( pBullet->fromItem, (INT8) pBullet->ubItemStatus, &(pTarget->inv[bSlot]) ); } @@ -1994,7 +2003,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend } else { - ubAmmoType = pFirer->inv[pFirer->ubAttackingHand].ItemData.Gun.ubGunAmmoType; + ubAmmoType = pFirer->inv[pFirer->ubAttackingHand][0]->data.gun.ubGunAmmoType; } // at least partly compensate for "near miss" increases for this guy, after all, the bullet @@ -2003,7 +2012,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend // when the bullet got near him //pTarget->ubSuppressionPoints--; - if ( pTarget->uiStatusFlags & SOLDIER_VEHICLE || (pTarget->ubBodyType == COW || pTarget->ubBodyType == CROW || pTarget->ubBodyType == BLOODCAT) ) + if ( pTarget->flags.uiStatusFlags & SOLDIER_VEHICLE || (pTarget->ubBodyType == COW || pTarget->ubBodyType == CROW || pTarget->ubBodyType == BLOODCAT) ) { //ubHitLocation = pStructure->ubVehicleHitLocation; ubHitLocation = AIM_SHOT_TORSO; @@ -2012,7 +2021,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend { // Determine where the person was hit... - if ( CREATURE_OR_BLOODCAT( pTarget ) ) + if ( CREATURE_OR_BLOODCAT( pTarget ) ) { ubHitLocation = AIM_SHOT_TORSO; @@ -2043,7 +2052,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend if (ubHitLocation == AIM_SHOT_RANDOM) // i.e. if not set yet { - if (MercInDeepWater( pTarget) ) + if (pTarget->MercInDeepWater( ) ) { // automatic head hit! ubHitLocation = AIM_SHOT_HEAD; @@ -2054,7 +2063,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend { case ANIM_STAND: // Fall through to crouch if in shallow or medium water - if ( !MercInShallowWater( pTarget) ) + if ( !pTarget->MercInShallowWater( ) ) { dZPosRelToMerc = FixedToFloat( pBullet->qCurrZ ) - CONVERT_PIXELS_TO_HEIGHTUNITS( gpWorldLevelData[pBullet->sGridNo].sHeight ); if ( dZPosRelToMerc > HEIGHT_UNITS ) @@ -2103,7 +2112,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend } } - if ( ( AmmoTypes[ubAmmoType].monsterSpit ) && (ubHitLocation == AIM_SHOT_HEAD) && ( ! (pTarget->uiStatusFlags & SOLDIER_MONSTER) ) ) + if ( ( AmmoTypes[ubAmmoType].monsterSpit ) && (ubHitLocation == AIM_SHOT_HEAD) && ( ! (pTarget->flags.uiStatusFlags & SOLDIER_MONSTER) ) ) { UINT8 ubOppositeDirection; @@ -2114,13 +2123,13 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend { // lucky bastard was facing away! } - // else if ( ( (pTarget->inv[HEAD1POS].usItem == NIGHTGOGGLES) || (pTarget->inv[HEAD1POS].usItem == SUNGOGGLES) || (pTarget->inv[HEAD1POS].usItem == GASMASK) ) && ( PreRandom( 100 ) < (UINT32) (pTarget->inv[HEAD1POS].bStatus[ 0 ]) ) ) - else if ( ( (pTarget->inv[HEAD1POS].usItem != NONE) ) && ( PreRandom( 100 ) < (UINT32) (pTarget->inv[HEAD1POS].ItemData.Generic.bStatus[ 0 ]) ) ) + // else if ( ( (pTarget->inv[HEAD1POS].usItem == NIGHTGOGGLES) || (pTarget->inv[HEAD1POS].usItem == SUNGOGGLES) || (pTarget->inv[HEAD1POS].usItem == GASMASK) ) && ( PreRandom( 100 ) < (UINT32) (pTarget->inv[HEAD1POS][0]->data.objectStatus) ) ) + else if ( ( (pTarget->inv[HEAD1POS].exists() == true) ) && ( PreRandom( 100 ) < (UINT32) (pTarget->inv[HEAD1POS][0]->data.objectStatus) ) ) { // lucky bastard was wearing protective stuff bHeadSlot = HEAD1POS; } - else if ( ( (pTarget->inv[HEAD2POS].usItem != NONE) ) && ( PreRandom( 100 ) < (UINT32) (pTarget->inv[HEAD2POS].ItemData.Generic.bStatus[ 0 ]) ) ) + else if ( ( (pTarget->inv[HEAD2POS].exists() == true) ) && ( PreRandom( 100 ) < (UINT32) (pTarget->inv[HEAD2POS][0]->data.objectStatus) ) ) { // lucky bastard was wearing protective stuff bHeadSlot = HEAD2POS; @@ -2137,7 +2146,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend // Determine damage, checking guy's armour, etc sRange = (INT16)GetRangeInCellCoordsFromGridNoDiff( pFirer->sGridNo, pTarget->sGridNo ); - if ( gTacticalStatus.uiFlags & GODMODE && !(pFirer->uiStatusFlags & SOLDIER_PC)) + if ( gTacticalStatus.uiFlags & GODMODE && !(pFirer->flags.uiStatusFlags & SOLDIER_PC)) { // in god mode, and firer is computer controlled iImpact = 0; @@ -2145,7 +2154,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend } else if (fIntended) { - if (pFirer->bOppList[pTarget->ubID] == SEEN_CURRENTLY) + if (pFirer->aiData.bOppList[pTarget->ubID] == SEEN_CURRENTLY) { sHitBy = pBullet->sHitBy; } @@ -2156,7 +2165,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend } // hit the intended target which was in our LOS // reduce due to range - iImpact = pBullet->iImpact; //BulletImpactReducedByRange( pBullet->iImpact, pBullet->iLoop, pBullet->iRange ); + iImpact = pBullet->iImpact; //BulletImpactReducedByRange( pBullet->iImpact, pBullet->iLoop, pBullet->iRange ); iImpact -= pBullet->iImpactReduction; if (iImpact < 0) { @@ -2171,7 +2180,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend } // intentionally shot - pTarget->fIntendedTarget = TRUE; + pTarget->flags.fIntendedTarget = TRUE; if ( (pBullet->usFlags & BULLET_FLAG_BUCKSHOT) && ( pTarget->ubID == pFirer->ubTargetID ) ) { @@ -2182,7 +2191,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend { // if an accidental target was hit, don't give a bonus for good aim! sHitBy = 0; - iImpact = pBullet->iImpact; + iImpact = pBullet->iImpact; //iImpact = BulletImpactReducedByRange( pBullet->iImpact, pBullet->iLoop, pBullet->iRange ); iImpact -= pBullet->iImpactReduction; if (iImpact < 0) @@ -2193,17 +2202,17 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend iDamage = BulletImpact( pFirer, pTarget, ubHitLocation, iImpact, sHitBy, &ubSpecial ); // accidentally shot - pTarget->fIntendedTarget = FALSE; + pTarget->flags.fIntendedTarget = FALSE; } if ( AmmoTypes[ubAmmoType].monsterSpit ) { if (bHeadSlot != NO_SLOT) { - pTarget->inv[ bHeadSlot ].ItemData.Generic.bStatus[ 0 ] -= (INT8) ( (iImpact / 2) + Random( (iImpact / 2) ) ); - if ( pTarget->inv[ bHeadSlot ].ItemData.Generic.bStatus[ 0 ] <= USABLE ) + pTarget->inv[ bHeadSlot ][0]->data.objectStatus -= (INT8) ( (iImpact / 2) + Random( (iImpact / 2) ) ); + if ( pTarget->inv[ bHeadSlot ][0]->data.objectStatus <= USABLE ) { - if ( pTarget->inv[ bHeadSlot ].ItemData.Generic.bStatus[ 0 ] <= 0 ) + if ( pTarget->inv[ bHeadSlot ][0]->data.objectStatus <= 0 ) { DeleteObj( &(pTarget->inv[ bHeadSlot ]) ); DirtyMercPanelInterface( pTarget, DIRTYLEVEL2 ); @@ -2216,13 +2225,13 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend { // bullet to the head may damage any head item bHeadSlot = HEAD1POS + (INT8) Random( 2 ); - if ( pTarget->inv[ bHeadSlot ].usItem != NOTHING ) + if ( pTarget->inv[ bHeadSlot ].exists() == true ) { - pTarget->inv[ bHeadSlot ].ItemData.Generic.bStatus[ 0 ] -= (INT8) ( Random( iImpact / 2 ) ); - if ( pTarget->inv[ bHeadSlot ].ItemData.Generic.bStatus[ 0 ] < 0 ) + pTarget->inv[ bHeadSlot ][0]->data.objectStatus -= (INT8) ( Random( iImpact / 2 ) ); + if ( pTarget->inv[ bHeadSlot ][0]->data.objectStatus < 0 ) { // just break it... - pTarget->inv[ bHeadSlot ].ItemData.Generic.bStatus[ 0 ] = 1; + pTarget->inv[ bHeadSlot ][0]->data.objectStatus = 1; } } } @@ -2234,7 +2243,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend } // check to see if someone was accidentally hit when no target was specified by the player - if ( pFirer->bTeam == gbPlayerNum && pFirer->ubTargetID == NOBODY && pTarget->bNeutral ) + if ( pFirer->bTeam == gbPlayerNum && pFirer->ubTargetID == NOBODY && pTarget->aiData.bNeutral ) { if ( pTarget->ubCivilianGroup == KINGPIN_CIV_GROUP || pTarget->ubCivilianGroup == HICKS_CIV_GROUP ) { @@ -2250,7 +2259,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend } - // Send event for getting hit + // Send event for getting hit memset( &(SWeaponHit), 0, sizeof( SWeaponHit ) ); SWeaponHit.usSoldierID = pTarget->ubID; SWeaponHit.uiUniqueId = pTarget->uiUniqueSoldierIdValue; @@ -2276,7 +2285,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend SWeaponHit.ubSpecial = ubSpecial; // now check to see if the bullet goes THROUGH this person! (not vehicles) - if ( !(pTarget->uiStatusFlags & SOLDIER_VEHICLE) && (AmmoTypes[ubAmmoType].canGoThrough) && !EXPLOSIVE_GUN( pFirer->usAttackingWeapon ) ) + if ( !(pTarget->flags.uiStatusFlags & SOLDIER_VEHICLE) && (AmmoTypes[ubAmmoType].canGoThrough) && !EXPLOSIVE_GUN( pFirer->usAttackingWeapon ) ) { // if we do more damage than expected, then the bullet will be more likely // to be lodged in the body @@ -2315,7 +2324,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend gTacticalStatus.fSomeoneHit = TRUE; } - // handle hit! Handle damage before deleting the bullet though + // handle hit! Handle damage before deleting the bullet though WeaponHit( SWeaponHit.usSoldierID, SWeaponHit.usWeaponIndex, SWeaponHit.sDamage, SWeaponHit.sBreathLoss, SWeaponHit.usDirection, SWeaponHit.sXPos, SWeaponHit.sYPos, SWeaponHit.sZPos, SWeaponHit.sRange, SWeaponHit.ubAttackerID, SWeaponHit.fHit, SWeaponHit.ubSpecial, SWeaponHit.ubLocation ); if (fStopped) @@ -2327,13 +2336,13 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend // ATE: I'm in enemy territory again, evil CC's world :) // This looks like the place I should add code to spew blood on the ground // The algorithm I'm going to use is given the current gridno of bullet, - // get a new gridno based on direction it was moving. Check to see if we're not + // get a new gridno based on direction it was moving. Check to see if we're not // going through walls, etc by testing for a path, unless on the roof, in which case it would always // be legal, but the bLevel May change... sNewGridNo = NewGridNo( (INT16)pBullet->sGridNo, DirectionInc( gOppositeDirection[ SWeaponHit.usDirection ] ) ); - bSpewBloodLevel = MercPtrs[ SWeaponHit.usSoldierID ]->bLevel; - fCanSpewBlood = TRUE; + bSpewBloodLevel = MercPtrs[ SWeaponHit.usSoldierID ]->pathing.bLevel; + fCanSpewBlood = TRUE; // If on anything other than bLevel of 0, we can pretty much freely spew blood if ( bSpewBloodLevel == 0 ) @@ -2423,8 +2432,8 @@ UINT32 ChanceOfBulletHittingStructure( INT32 iDistance, INT32 iDistanceToTarget, } } -INT32 StructureResistanceIncreasedByRange( INT32 iImpactReduction, INT32 iGunRange, INT32 iDistance ) -{ +INT32 StructureResistanceIncreasedByRange( INT32 iImpactReduction, INT32 iGunRange, INT32 iDistance ) +{ return( iImpactReduction * ( 100 + PERCENT_BULLET_SLOWED_BY_RANGE * (iDistance - iGunRange) / iGunRange ) / 100 ); /* if ( iDistance > iGunRange ) @@ -2461,7 +2470,7 @@ INT32 HandleBulletStructureInteraction( BULLET * pBullet, STRUCTURE * pStructure //else if ( pBullet->usFlags & BULLET_FLAG_SMALL_MISSILE ) //{ // stops if using HE ammo - else if ( AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].highExplosive && !AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].antiTank ) + else if ( AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ][0]->data.gun.ubGunAmmoType].highExplosive && !AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ][0]->data.gun.ubGunAmmoType].antiTank ) { *pfHit = TRUE; return( 0 ); @@ -2477,7 +2486,7 @@ INT32 HandleBulletStructureInteraction( BULLET * pBullet, STRUCTURE * pStructure pDoor = FindDoorInfoAtGridNo( pBullet->sGridNo ); // Does it have a lock? - INT16 lockBustingPower = AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].lockBustingPower; + INT16 lockBustingPower = AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ][0]->data.gun.ubGunAmmoType].lockBustingPower; // WANNE: bugfix: No door returned, so the game crashes! if (pDoor) @@ -2528,22 +2537,22 @@ INT32 HandleBulletStructureInteraction( BULLET * pBullet, STRUCTURE * pStructure // okay, this seems pretty weird, so here's the comment to explain it: // iImpactReduction is the reduction in impact due to the structure // pBullet->iImpactReduction is the accumulated reduction in impact - // for all bullets encountered thus far + // for all bullets encountered thus far // iCurrImpact is the original impact value of the bullet reduced due to - // range. To avoid problems involving multiple multiplication - // ( (1 - X) * (1 - Y) != (1 - X - Y) ! ), this is calculated from - // scratch at each collision with an obstacle - // reduction due to range is 25% per "max range" + // range. To avoid problems involving multiple multiplication + // ( (1 - X) * (1 - Y) != (1 - X - Y) ! ), this is calculated from + // scratch at each collision with an obstacle + // reduction due to range is 25% per "max range" if (PreRandom( 100 ) < pStructure->pDBStructureRef->pDBStructure->ubDensity) { - iCurrImpact = pBullet->iImpact; + iCurrImpact = pBullet->iImpact; //iCurrImpact = BulletImpactReducedByRange( pBullet->iImpact, pBullet->iLoop, pBullet->iRange ); iImpactReduction = gubMaterialArmour[ pStructure->pDBStructureRef->pDBStructure->ubArmour ]; iImpactReduction = StructureResistanceIncreasedByRange( iImpactReduction, pBullet->iRange, pBullet->iLoop ); - iImpactReduction = (INT32) (iImpactReduction * AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].structureImpactReductionMultiplier / max(1,AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].structureImpactReductionDivisor)); + iImpactReduction = (INT32) (iImpactReduction * AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ][0]->data.gun.ubGunAmmoType].structureImpactReductionMultiplier / max(1,AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ][0]->data.gun.ubGunAmmoType].structureImpactReductionDivisor)); - //switch (pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType) + //switch (pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ][0]->data.gun.ubGunAmmoType) //{ // case AMMO_HP: // iImpactReduction = AMMO_STRUCTURE_ADJUSTMENT_HP( iImpactReduction ); @@ -2595,7 +2604,7 @@ INT32 CTGTHandleBulletStructureInteraction( BULLET * pBullet, STRUCTURE * pStruc //else if ( pBullet->usFlags & BULLET_FLAG_SMALL_MISSILE ) //{ // stops if using HE ammo - else if ( AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].highExplosive && !AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].antiTank ) + else if ( AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ][0]->data.gun.ubGunAmmoType].highExplosive && !AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ][0]->data.gun.ubGunAmmoType].antiTank ) { return( pBullet->iImpact ); } @@ -2610,21 +2619,21 @@ INT32 CTGTHandleBulletStructureInteraction( BULLET * pBullet, STRUCTURE * pStruc // okay, this seems pretty weird, so here's the comment to explain it: // iImpactReduction is the reduction in impact due to the structure // pBullet->iImpactReduction is the accumulated reduction in impact - // for all bullets encountered thus far + // for all bullets encountered thus far // iCurrImpact is the original impact value of the bullet reduced due to - // range. To avoid problems involving multiple multiplication - // ( (1 - X) * (1 - Y) != (1 - X - Y) ! ), this is calculated from - // scratch at each collision with an obstacle - // reduction due to range is 25% per "max range" + // range. To avoid problems involving multiple multiplication + // ( (1 - X) * (1 - Y) != (1 - X - Y) ! ), this is calculated from + // scratch at each collision with an obstacle + // reduction due to range is 25% per "max range" //iCurrImpact = BulletImpactReducedByRange( pBullet->iImpact, pBullet->iLoop, pBullet->iRange ); iCurrImpact = pBullet->iImpact; // multiply impact reduction by 100 to retain fractions for a bit... iImpactReduction = gubMaterialArmour[ pStructure->pDBStructureRef->pDBStructure->ubArmour ] * pStructure->pDBStructureRef->pDBStructure->ubDensity / 100; iImpactReduction = StructureResistanceIncreasedByRange( iImpactReduction, pBullet->iRange, pBullet->iLoop ); - iImpactReduction = (INT32)(iImpactReduction * AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].structureImpactReductionMultiplier / max(1,AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].structureImpactReductionDivisor)); + iImpactReduction = (INT32)(iImpactReduction * AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ][0]->data.gun.ubGunAmmoType].structureImpactReductionMultiplier / max(1,AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ][0]->data.gun.ubGunAmmoType].structureImpactReductionDivisor)); - //switch (pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType) + //switch (pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ][0]->data.gun.ubGunAmmoType) //{ // case AMMO_HP: // iImpactReduction = AMMO_STRUCTURE_ADJUSTMENT_HP( iImpactReduction ); @@ -2644,8 +2653,6 @@ INT32 CTGTHandleBulletStructureInteraction( BULLET * pBullet, STRUCTURE * pStruc UINT8 CalcChanceToGetThrough( BULLET * pBullet ) { - //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CalcChanceToGetThrough")); - FIXEDPT qLandHeight; INT32 iCurrAboveLevelZ; INT32 iCurrCubesAboveLevelZ; @@ -2721,12 +2728,12 @@ UINT8 CalcChanceToGetThrough( BULLET * pBullet ) if (iCurrAboveLevelZ < 0) { // ground is in the way! - //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CalcChanceToGetThrough done ground is in the way")); + DebugLOS(String("CalcChanceToGetThrough done ground in way #1")); return( 0 ); } iCurrCubesAboveLevelZ = CONVERT_HEIGHTUNITS_TO_INDEX( iCurrAboveLevelZ ); - //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CalcChanceToGetThrough: while pStructure")); + DebugLOS(String("CalcChanceToGetThrough: while pStructure")); while( pStructure ) { if (pStructure->fFlags & ALWAYS_CONSIDER_HIT) @@ -2752,7 +2759,7 @@ UINT8 CalcChanceToGetThrough( BULLET * pBullet ) else { guiLocalStructureCTH[iNumLocalStructures] = 100; - } + } } else { @@ -2777,7 +2784,7 @@ UINT8 CalcChanceToGetThrough( BULLET * pBullet ) if ( (qLastZ > qWallHeight && pBullet->qCurrZ <= qWallHeight) || (qLastZ < qWallHeight && pBullet->qCurrZ >= qWallHeight)) { // hit a roof - //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("ChanceChanceToGetThrough done hit a roof" )); + DebugLOS(String("ChanceChanceToGetThrough done hit roof #1" )); return( 0 ); } @@ -2856,7 +2863,7 @@ UINT8 CalcChanceToGetThrough( BULLET * pBullet ) iOldTileX = pBullet->iCurrTileX; iOldTileY = pBullet->iCurrTileY; - //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CalcChanceToGetThrough: checking for location within the tile")); + DebugLOS(String("CalcChanceToGetThrough: checking for location within the tile")); do { // check a particular location within the tile @@ -2866,7 +2873,7 @@ UINT8 CalcChanceToGetThrough( BULLET * pBullet ) if (iCurrAboveLevelZ < 0) { // ground is in the way! - //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("ChanceOfBulletHittingStructure done ground in way")); + DebugLOS(String("ChanceOfBulletHittingStructure done ground in way #2")); return( 0 ); } @@ -2899,7 +2906,7 @@ UINT8 CalcChanceToGetThrough( BULLET * pBullet ) if (pBullet->qIncrY > 0) { - qDistToTravelY = INT32_TO_FIXEDPT( CELL_Y_SIZE ) - (pBullet->qCurrY % INT32_TO_FIXEDPT( CELL_Y_SIZE )); + qDistToTravelY = INT32_TO_FIXEDPT( CELL_Y_SIZE ) - (pBullet->qCurrY % INT32_TO_FIXEDPT( CELL_Y_SIZE )); iStepsToTravelY = qDistToTravelY / pBullet->qIncrY; } else if (pBullet->qIncrY < 0) @@ -2925,7 +2932,7 @@ UINT8 CalcChanceToGetThrough( BULLET * pBullet ) if (pBullet->qCurrZ < qLandHeight && pBullet->iLoop < pBullet->iDistanceLimit) { // ground is in the way! - //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("ChanceChanceToGetThrough done ground in way" )); + DebugLOS(String("ChanceChanceToGetThrough done ground in way #3" )); return( 0 ); } @@ -2936,10 +2943,10 @@ UINT8 CalcChanceToGetThrough( BULLET * pBullet ) pBullet->bLOSIndexX = FIXEDPT_TO_LOS_INDEX( pBullet->qCurrX ); pBullet->bLOSIndexY = FIXEDPT_TO_LOS_INDEX( pBullet->qCurrY ); - DebugLOS( String( " CTGT at %ld %ld after traversing empty tile", pBullet->bLOSIndexX, pBullet->bLOSIndexY ) ); + DebugLOS( String( " CTGT at %ld %ld after traversing empty tile", pBullet->bLOSIndexX, pBullet->bLOSIndexY ) ); } - else + else { // there are structures in this tile @@ -2948,7 +2955,7 @@ UINT8 CalcChanceToGetThrough( BULLET * pBullet ) // figure out the LOS cube level of the current point if (iCurrCubesAboveLevelZ < STRUCTURE_ON_ROOF_MAX) { - if (iCurrCubesAboveLevelZ < STRUCTURE_ON_GROUND_MAX) + if (iCurrCubesAboveLevelZ < STRUCTURE_ON_GROUND_MAX) { // check objects on the ground sDesiredLevel = STRUCTURE_ON_GROUND; @@ -2973,7 +2980,7 @@ UINT8 CalcChanceToGetThrough( BULLET * pBullet ) if (fIntended) { // gotcha! ... return chance to get through iChanceToGetThrough = iChanceToGetThrough * (pBullet->iImpact - pBullet->iImpactReduction) / pBullet->iImpact; - //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("ChanceChanceToGetThrough done " )); + DebugLOS(String("ChanceChanceToGetThrough done, hit intended, returning %d", iChanceToGetThrough )); return( (UINT8) iChanceToGetThrough ); } else @@ -2982,12 +2989,12 @@ UINT8 CalcChanceToGetThrough( BULLET * pBullet ) } } else if (pStructure->fFlags & STRUCTURE_WALLNWINDOW && pBullet->qCurrZ >= qWindowBottomHeight && pBullet->qCurrZ <= qWindowTopHeight) - { + { fResolveHit = ResolveHitOnWall( pStructure, iGridNo, pBullet->bLOSIndexX, pBullet->bLOSIndexY, pBullet->ddHorizAngle ); if (fResolveHit) { - // the bullet would keep on going! unless we're considering a knife... + // the bullet would keep on going! unless we're considering a knife... if (pBullet->usFlags & BULLET_FLAG_KNIFE) { gubLocalStructureNumTimesHit[iStructureLoop]++; @@ -3004,7 +3011,7 @@ UINT8 CalcChanceToGetThrough( BULLET * pBullet ) else { fResolveHit = TRUE; - } + } if (fResolveHit) { gubLocalStructureNumTimesHit[iStructureLoop]++; @@ -3029,12 +3036,12 @@ UINT8 CalcChanceToGetThrough( BULLET * pBullet ) qLastZ = pBullet->qCurrZ; pBullet->qCurrZ += pBullet->qIncrZ; if ( (qLastZ > qWallHeight && pBullet->qCurrZ < qWallHeight) || (qLastZ < qWallHeight && pBullet->qCurrZ > qWallHeight)) - { - // hit roof! + { + // hit roof! //pBullet->iImpactReduction += CTGTHandleBulletStructureInteraction( pBullet, pRoofStructure ); //if (pBullet->iImpactReduction >= pBullet->iImpact) { - //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("ChanceChanceToGetThrough done hit roof" )); + DebugLOS(String("ChanceChanceToGetThrough done hit roof #2" )); return( 0 ); } @@ -3051,7 +3058,7 @@ UINT8 CalcChanceToGetThrough( BULLET * pBullet ) } while( (pBullet->bLOSIndexX == bOldLOSIndexX) && (pBullet->bLOSIndexY == bOldLOSIndexY) && (pBullet->iCurrCubesZ == iOldCubesZ)); - DebugLOS( String( " CTGT at %ld %ld %ld after moving in nonempty tile from %ld %ld %ld", pBullet->bLOSIndexX, pBullet->bLOSIndexY, pBullet->iCurrCubesZ, bOldLOSIndexX, bOldLOSIndexY, iOldCubesZ ) ); + DebugLOS( String( " CTGT at %ld %ld %ld after moving in nonempty tile from %ld %ld %ld", pBullet->bLOSIndexX, pBullet->bLOSIndexY, pBullet->iCurrCubesZ, bOldLOSIndexX, bOldLOSIndexY, iOldCubesZ ) ); pBullet->iCurrTileX = FIXEDPT_TO_INT32( pBullet->qCurrX ) / CELL_X_SIZE; pBullet->iCurrTileY = FIXEDPT_TO_INT32( pBullet->qCurrY ) / CELL_Y_SIZE; } @@ -3059,18 +3066,18 @@ UINT8 CalcChanceToGetThrough( BULLET * pBullet ) if ( pBullet->iCurrTileX < 0 || pBullet->iCurrTileX >= WORLD_COLS || pBullet->iCurrTileY < 0 || pBullet->iCurrTileY >= WORLD_ROWS ) { - //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CalcChanceToGetThrough done invalid position")); + DebugLOS(String("CalcChanceToGetThrough done invalid position")); return( 0 ); } - //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CalcChanceToGetThrough check for bullet drop")); + DebugLOS(String("CalcChanceToGetThrough check for bullet drop")); pBullet->sGridNo = MAPROWCOLTOPOS( pBullet->iCurrTileY , pBullet->iCurrTileX ); if (pBullet->iLoop > pBullet->iRange * 2) { // beyond max effective range, bullet starts to drop! - // since we're doing an increment based on distance, not time, the + // since we're doing an increment based on distance, not time, the // decrement is scaled down depending on how fast the bullet is (effective range) if ( pBullet->iRange <= 0 ) { @@ -3082,7 +3089,7 @@ UINT8 CalcChanceToGetThrough( BULLET * pBullet ) } // end of the tile... - //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CalcChanceToGetThrough end of tile")); + DebugLOS(String("CalcChanceToGetThrough end of tile")); if (iNumLocalStructures > 0) { for ( iStructureLoop = 0; iStructureLoop < iNumLocalStructures; iStructureLoop++) @@ -3101,7 +3108,7 @@ UINT8 CalcChanceToGetThrough( BULLET * pBullet ) } if (pBullet->iImpactReduction >= pBullet->iImpact) { - //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CalcChanceToGetThrough done impact reduced")); + DebugLOS(String("CalcChanceToGetThrough done impact reduced")); return( 0 ); } } @@ -3110,7 +3117,8 @@ UINT8 CalcChanceToGetThrough( BULLET * pBullet ) // fractional amount of distance remaining which is unchecked // but we shouldn't(?) need to check it because the target is there! - //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CalcChanceToGetThrough simple calc, %d * (%d - %d) / %d")); + DebugLOS(String("CalcChanceToGetThrough simple calc, %d * (%d - %d) / %d", + iChanceToGetThrough, pBullet->iImpact, pBullet->iImpactReduction, (max(pBullet->iImpact,1)))); // try simple chance to get through, ignoring range effects iChanceToGetThrough = iChanceToGetThrough * (pBullet->iImpact - pBullet->iImpactReduction) / (max(pBullet->iImpact,1)); @@ -3118,7 +3126,7 @@ UINT8 CalcChanceToGetThrough( BULLET * pBullet ) { iChanceToGetThrough = 0; } - //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CalcChanceToGetThrough done")); + DebugLOS(String("CalcChanceToGetThrough done, returning %d", iChanceToGetThrough)); return( (UINT8) iChanceToGetThrough ); } @@ -3140,7 +3148,7 @@ UINT8 SoldierToSoldierChanceToGetThrough( SOLDIERTYPE * pStartSoldier, SOLDIERTY return( FALSE ); } - // set startsoldier's target ID ... need an ID stored in case this + // set startsoldier's target ID ... need an ID stored in case this // is the AI calculating cover to a location where he might not be any more pStartSoldier->ubCTGTTargetID = pEndSoldier->ubID; return( ChanceToGetThrough( pStartSoldier, (FLOAT) CenterX( pEndSoldier->sGridNo ), (FLOAT) CenterY( pEndSoldier->sGridNo ), dEndZPos ) ); @@ -3159,7 +3167,7 @@ UINT8 SoldierToSoldierBodyPartChanceToGetThrough( SOLDIERTYPE * pStartSoldier, S } CHECKF( pStartSoldier ); CHECKF( pEndSoldier ); - switch( ubAimLocation ) + switch( ubAimLocation ) { case AIM_SHOT_HEAD: ubPosType = HEAD_TARGET_POS; @@ -3181,7 +3189,7 @@ UINT8 SoldierToSoldierBodyPartChanceToGetThrough( SOLDIERTYPE * pStartSoldier, S return( FALSE ); } - // set startsoldier's target ID ... need an ID stored in case this + // set startsoldier's target ID ... need an ID stored in case this // is the AI calculating cover to a location where he might not be any more pStartSoldier->ubCTGTTargetID = pEndSoldier->ubID; return( ChanceToGetThrough( pStartSoldier, (FLOAT) CenterX( pEndSoldier->sGridNo ), (FLOAT) CenterY( pEndSoldier->sGridNo ), dEndZPos ) ); @@ -3217,8 +3225,8 @@ UINT8 SoldierToLocationChanceToGetThrough( SOLDIERTYPE * pStartSoldier, INT16 sG { bStructHeight = GetStructureTargetHeight( sGridNo, (BOOLEAN) (bLevel == 1) ); if (bStructHeight > 0) - { - // fire at the centre of the cube of the tallest structure + { + // fire at the centre of the cube of the tallest structure dEndZPos = ((FLOAT) (bStructHeight + bLevel * PROFILE_Z_SIZE) - 0.5f) * HEIGHT_UNITS_PER_INDEX; } else @@ -3233,7 +3241,7 @@ UINT8 SoldierToLocationChanceToGetThrough( SOLDIERTYPE * pStartSoldier, INT16 sG sXPos = sXPos * CELL_X_SIZE + (CELL_X_SIZE / 2); sYPos = sYPos * CELL_Y_SIZE + (CELL_Y_SIZE / 2); - // set startsoldier's target ID ... need an ID stored in case this + // set startsoldier's target ID ... need an ID stored in case this // is the AI calculating cover to a location where he might not be any more pStartSoldier->ubCTGTTargetID = ubTargetID; return( ChanceToGetThrough( pStartSoldier, (FLOAT) sXPos, (FLOAT) sYPos, dEndZPos ) ); @@ -3262,7 +3270,7 @@ UINT8 AISoldierToSoldierChanceToGetThrough( SOLDIERTYPE * pStartSoldier, SOLDIER usTrueState = pStartSoldier->usAnimState; pStartSoldier->usAnimState = STANDING; - // set startsoldier's target ID ... need an ID stored in case this + // set startsoldier's target ID ... need an ID stored in case this // is the AI calculating cover to a location where he might not be any more pStartSoldier->ubCTGTTargetID = NOBODY; @@ -3304,8 +3312,8 @@ UINT8 AISoldierToLocationChanceToGetThrough( SOLDIERTYPE * pStartSoldier, INT16 { bStructHeight = GetStructureTargetHeight( sGridNo, (BOOLEAN) (bLevel == 1) ); if (bStructHeight > 0) - { - // fire at the centre of the cube of the tallest structure + { + // fire at the centre of the cube of the tallest structure dEndZPos = ((FLOAT) (bStructHeight + bLevel * PROFILE_Z_SIZE) - 0.5f) * HEIGHT_UNITS_PER_INDEX; } else @@ -3320,7 +3328,7 @@ UINT8 AISoldierToLocationChanceToGetThrough( SOLDIERTYPE * pStartSoldier, INT16 sXPos = sXPos * CELL_X_SIZE + (CELL_X_SIZE / 2); sYPos = sYPos * CELL_Y_SIZE + (CELL_Y_SIZE / 2); - // set startsoldier's target ID ... need an ID stored in case this + // set startsoldier's target ID ... need an ID stored in case this // is the AI calculating cover to a location where he might not be any more pStartSoldier->ubCTGTTargetID = NOBODY; @@ -3383,7 +3391,7 @@ void CalculateFiringIncrements( DOUBLE ddHorizAngle, DOUBLE ddVerticAngle, DOUBL // Want to make sure that not too many misses actually hit the target after all // to miss a target at 1 tile is about 30 degrees off, at 5 tiles, 6 degrees off - // at 15 tiles, 2 degrees off. Thus 30 degrees divided by the # of tiles distance. + // at 15 tiles, 2 degrees off. Thus 30 degrees divided by the # of tiles distance. ddMinimumMiss = MIN_AIMING_SCREWUP / (dd2DDistance / CELL_X_SIZE ); if (ddMinimumMiss > ddMaximumMiss) @@ -3503,7 +3511,7 @@ dDeltaZ = dEndZ - dStartZ; d2DDistance = Distance2D( dDeltaX, dDeltaY ); -ddOrigHorizAngle = atan2( dDeltaY, dDeltaX ); +ddOrigHorizAngle = atan2( dDeltaY, dDeltaX ); } */ @@ -3570,7 +3578,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA d2DDistance = (FLOAT) ( iDistance); } - ddOrigHorizAngle = atan2( dDeltaY, dDeltaX ); + ddOrigHorizAngle = atan2( dDeltaY, dDeltaX ); ddOrigVerticAngle = atan2( dDeltaZ, (d2DDistance * 2.56f) ); ddAdjustedHorizAngle = ddOrigHorizAngle; ddAdjustedVerticAngle = ddOrigVerticAngle; @@ -3587,7 +3595,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA { usBulletFlags |= BULLET_FLAG_KNIFE; } - else if ( Item[usHandItem].rocketlauncher ) + else if ( Item[usHandItem].rocketlauncher ) { usBulletFlags |= BULLET_FLAG_MISSILE; } @@ -3604,7 +3612,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA usBulletFlags |= BULLET_FLAG_FLAME; ubSpreadIndex = 2; } - else if ( AmmoTypes[ pFirer->inv[pFirer->ubAttackingHand].ItemData.Gun.ubGunAmmoType ].tracerEffect && (pFirer->bDoBurst || gGameSettings.fOptions[ TOPTION_TRACERS_FOR_SINGLE_FIRE ]) ) + else if ( AmmoTypes[ pFirer->inv[pFirer->ubAttackingHand][0]->data.gun.ubGunAmmoType ].tracerEffect && (pFirer->bDoBurst || gGameSettings.fOptions[ TOPTION_TRACERS_FOR_SINGLE_FIRE ]) ) { //usBulletFlags |= BULLET_FLAG_TRACER; fTracer = TRUE; @@ -3618,7 +3626,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA // shotgun pellets fire 9 bullets doing 1/4 damage each if (!fFake) { - ubShots = AmmoTypes[pFirer->inv[pFirer->ubAttackingHand].ItemData.Gun.ubGunAmmoType].numberOfBullets; + ubShots = AmmoTypes[pFirer->inv[pFirer->ubAttackingHand][0]->data.gun.ubGunAmmoType].numberOfBullets; // but you can't really aim the damn things very well! if (sHitBy > 0) { @@ -3636,7 +3644,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA } // ubImpact = AMMO_DAMAGE_ADJUSTMENT_BUCKSHOT( ubImpact ); - ubImpact = (UINT8) (ubImpact * AmmoTypes[pFirer->inv[pFirer->ubAttackingHand].ItemData.Gun.ubGunAmmoType].multipleBulletDamageMultiplier / max(1,AmmoTypes[pFirer->inv[pFirer->ubAttackingHand].ItemData.Gun.ubGunAmmoType].multipleBulletDamageDivisor) ); + ubImpact = (UINT8) (ubImpact * AmmoTypes[pFirer->inv[pFirer->ubAttackingHand][0]->data.gun.ubGunAmmoType].multipleBulletDamageMultiplier / max(1,AmmoTypes[pFirer->inv[pFirer->ubAttackingHand][0]->data.gun.ubGunAmmoType].multipleBulletDamageDivisor) ); } } @@ -3677,7 +3685,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA } if ( ubLoop == 0 ) - { + { ddHorizAngle = ddOrigHorizAngle; ddVerticAngle = ddOrigVerticAngle; @@ -3723,7 +3731,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA if ( pBullet->usFlags & BULLET_FLAG_KNIFE ) { - pBullet->ubItemStatus = pFirer->inv[pFirer->ubAttackingHand].ItemData.Generic.bStatus[0]; + pBullet->ubItemStatus = pFirer->inv[pFirer->ubAttackingHand][0]->data.objectStatus; } // apply increments for first move @@ -3783,7 +3791,7 @@ INT8 ChanceToGetThrough( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOAT d // if shotgun, shotgun would have to be in main hand if ( pFirer->inv[ HANDPOS ].usItem == pFirer->usAttackingWeapon ) { - if ( AmmoTypes[pFirer->inv[ HANDPOS ].ItemData.Gun.ubGunAmmoType].numberOfBullets > 1 ) + if ( AmmoTypes[pFirer->inv[ HANDPOS ][0]->data.gun.ubGunAmmoType].numberOfBullets > 1 ) { fBuckShot = TRUE; } @@ -3794,7 +3802,20 @@ INT8 ChanceToGetThrough( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOAT d else { // fake it - return( FireBulletGivenTarget( pFirer, dEndX, dEndY, dEndZ, GLOCK_17, 0, FALSE, TRUE )); + + //store the current item then replace it with a Glock 17 + OBJECTTYPE oldItemInHand (pFirer->inv[ HANDPOS ]); + UINT16 oldAttackingWeapon = pFirer->usAttackingWeapon; + + //GLOCK_17_ForUseWithLOS is init in InitializeJA2() + pFirer->inv[ HANDPOS ] = GLOCK_17_ForUseWithLOS; + pFirer->usAttackingWeapon = GLOCK_17; + + INT8 retVal = FireBulletGivenTarget( pFirer, dEndX, dEndY, dEndZ, GLOCK_17, 0, FALSE, TRUE ); + + pFirer->inv[ HANDPOS ] = oldItemInHand; + pFirer->usAttackingWeapon = oldAttackingWeapon; + return retVal; } } @@ -3872,7 +3893,7 @@ void MoveBullet( INT32 iBullet ) if (!GridNoOnVisibleWorldTile( (INT16) iGridNo ) || (pBullet->iCurrCubesZ > PROFILE_Z_SIZE * 2 && FIXEDPT_TO_INT32( pBullet->qIncrZ ) > 0 ) ) { // bullet outside of world! - // NB remove bullet only flags a bullet for deletion; we still have access to the + // NB remove bullet only flags a bullet for deletion; we still have access to the // information in the structure RemoveBullet( pBullet->iBullet ); BulletMissed( pBullet, pBullet->pFirer ); @@ -3890,7 +3911,7 @@ void MoveBullet( INT32 iBullet ) // figure out the LOS cube level of the current point iCurrCubesAboveLevelZ = CONVERT_HEIGHTUNITS_TO_INDEX( FIXEDPT_TO_INT32( pBullet->qCurrZ - qLandHeight) ); // figure out the level - if (iCurrCubesAboveLevelZ < STRUCTURE_ON_GROUND_MAX) + if (iCurrCubesAboveLevelZ < STRUCTURE_ON_GROUND_MAX) { // check objects on the ground sDesiredLevel = 0; @@ -3984,7 +4005,7 @@ void MoveBullet( INT32 iBullet ) gpLocalStructure[iNumLocalStructures] = pStructure; gubLocalStructureNumTimesHit[iNumLocalStructures] = 0; iNumLocalStructures++; - } + } } else if (pStructure->fFlags & STRUCTURE_ROOF) { @@ -4001,7 +4022,7 @@ void MoveBullet( INT32 iBullet ) { // hit a roof StopBullet( pBullet->iBullet ); - BulletHitStructure( pBullet, 0, 0, pBullet->pFirer, pBullet->qCurrX, pBullet->qCurrY, pBullet->qCurrZ, TRUE ); + BulletHitStructure( pBullet, 0, 0, pBullet->pFirer, pBullet->qCurrX, pBullet->qCurrY, pBullet->qCurrZ, TRUE ); return; } @@ -4024,10 +4045,10 @@ void MoveBullet( INT32 iBullet ) gpLocalStructure[iNumLocalStructures] = pStructure; iNumLocalStructures++; } - else if ( pBullet->pFirer->uiStatusFlags & SOLDIER_MONSTER ) + else if ( pBullet->pFirer->flags.uiStatusFlags & SOLDIER_MONSTER ) { // monsters firing will always accidentally hit people but never accidentally hit each other. - if ( !(MercPtrs[ pStructure->usStructureID ]->uiStatusFlags & SOLDIER_MONSTER) ) + if ( !(MercPtrs[ pStructure->usStructureID ]->flags.uiStatusFlags & SOLDIER_MONSTER) ) { gpLocalStructure[iNumLocalStructures] = pStructure; iNumLocalStructures++; @@ -4037,7 +4058,7 @@ void MoveBullet( INT32 iBullet ) gAnimControl[ MercPtrs[pStructure->usStructureID]->usAnimState ].ubEndHeight == ANIM_STAND && ( (pBullet->fAimed && pBullet->iLoop > MIN_DIST_FOR_HIT_FRIENDS) || (!pBullet->fAimed && pBullet->iLoop > MIN_DIST_FOR_HIT_FRIENDS_UNAIMED) || - PreRandom( 100 ) < MIN_CHANCE_TO_ACCIDENTALLY_HIT_SOMEONE + PreRandom( 100 ) < MIN_CHANCE_TO_ACCIDENTALLY_HIT_SOMEONE ) ) { @@ -4047,9 +4068,9 @@ void MoveBullet( INT32 iBullet ) } // this might be a close call - if ( MercPtrs[ pStructure->usStructureID ]->bTeam == gbPlayerNum && pBullet->pFirer->bTeam != gbPlayerNum && sDesiredLevel == MercPtrs[ pStructure->usStructureID ]->bLevel ) + if ( MercPtrs[ pStructure->usStructureID ]->bTeam == gbPlayerNum && pBullet->pFirer->bTeam != gbPlayerNum && sDesiredLevel == MercPtrs[ pStructure->usStructureID ]->pathing.bLevel ) { - MercPtrs[ pStructure->usStructureID ]->fCloseCall = TRUE; + MercPtrs[ pStructure->usStructureID ]->flags.fCloseCall = TRUE; } if ( IS_MERC_BODY_TYPE( MercPtrs[pStructure->usStructureID] ) ) @@ -4084,7 +4105,7 @@ void MoveBullet( INT32 iBullet ) break; } } - } + } } } @@ -4106,7 +4127,7 @@ void MoveBullet( INT32 iBullet ) { if (pBullet->iLoop > CLOSE_TO_FIRER || ( fIntended ) ) { - // calculate chance of hitting structure + // calculate chance of hitting structure if (PreRandom( 100 ) < uiChanceOfHit) { // could hit it @@ -4130,7 +4151,7 @@ void MoveBullet( INT32 iBullet ) if (iCurrCubesAboveLevelZ < STRUCTURE_ON_ROOF_MAX) { /* - if (iCurrCubesAboveLevelZ < STRUCTURE_ON_GROUND_MAX) + if (iCurrCubesAboveLevelZ < STRUCTURE_ON_GROUND_MAX) { // check objects on the ground sDesiredLevel = 0; @@ -4184,7 +4205,7 @@ void MoveBullet( INT32 iBullet ) // this could be a close call if ( pTarget->bTeam == gbPlayerNum && pBullet->pFirer->bTeam != gbPlayerNum ) { - pTarget->fCloseCall = TRUE; + pTarget->flags.fCloseCall = TRUE; } */ @@ -4209,7 +4230,7 @@ void MoveBullet( INT32 iBullet ) { // ground is in the way! StopBullet( pBullet->iBullet ); - BulletHitStructure( pBullet, INVALID_STRUCTURE_ID, 0, pBullet->pFirer, pBullet->qCurrX, pBullet->qCurrY, pBullet->qCurrZ, TRUE ); + BulletHitStructure( pBullet, INVALID_STRUCTURE_ID, 0, pBullet->pFirer, pBullet->qCurrX, pBullet->qCurrY, pBullet->qCurrZ, TRUE ); return; } // check for the existence of structures @@ -4240,7 +4261,7 @@ void MoveBullet( INT32 iBullet ) if (pBullet->qIncrY > 0) { - qDistToTravelY = INT32_TO_FIXEDPT( CELL_Y_SIZE ) - (pBullet->qCurrY % INT32_TO_FIXEDPT( CELL_Y_SIZE )); + qDistToTravelY = INT32_TO_FIXEDPT( CELL_Y_SIZE ) - (pBullet->qCurrY % INT32_TO_FIXEDPT( CELL_Y_SIZE )); iStepsToTravelY = qDistToTravelY / pBullet->qIncrY; } else if (pBullet->qIncrY < 0) @@ -4271,7 +4292,7 @@ void MoveBullet( INT32 iBullet ) return; } - if (( pBullet->usFlags & ( BULLET_FLAG_MISSILE | BULLET_FLAG_SMALL_MISSILE | BULLET_FLAG_TANK_CANNON | BULLET_FLAG_FLAME | BULLET_FLAG_CREATURE_SPIT /*| BULLET_FLAG_TRACER*/ ) ) || fTracer == TRUE) + if (( pBullet->usFlags & ( BULLET_FLAG_MISSILE | BULLET_FLAG_SMALL_MISSILE | BULLET_FLAG_TANK_CANNON | BULLET_FLAG_FLAME | BULLET_FLAG_CREATURE_SPIT /*| BULLET_FLAG_TRACER*/ ) ) || fTracer == TRUE) { INT8 bStepsPerMove = STEPS_FOR_BULLET_MOVE_TRAILS; @@ -4318,7 +4339,7 @@ void MoveBullet( INT32 iBullet ) pBullet->bLOSIndexX = FIXEDPT_TO_LOS_INDEX( pBullet->qCurrX ); pBullet->bLOSIndexY = FIXEDPT_TO_LOS_INDEX( pBullet->qCurrY ); } - else + else { // there are structures in this tile iCurrCubesAboveLevelZ = CONVERT_HEIGHTUNITS_TO_INDEX( iCurrAboveLevelZ ); @@ -4326,7 +4347,7 @@ void MoveBullet( INT32 iBullet ) if (iCurrCubesAboveLevelZ < STRUCTURE_ON_ROOF_MAX) { - if (iCurrCubesAboveLevelZ < STRUCTURE_ON_GROUND_MAX) + if (iCurrCubesAboveLevelZ < STRUCTURE_ON_GROUND_MAX) { // check objects on the ground sDesiredLevel = STRUCTURE_ON_GROUND; @@ -4361,7 +4382,7 @@ void MoveBullet( INT32 iBullet ) } } else if (pStructure->fFlags & STRUCTURE_WALLNWINDOW && pBullet->qCurrZ >= qWindowBottomHeight && pBullet->qCurrZ <= qWindowTopHeight) - { + { fResolveHit = ResolveHitOnWall( pStructure, iGridNo, pBullet->bLOSIndexX, pBullet->bLOSIndexY, pBullet->ddHorizAngle ); if (fResolveHit) @@ -4376,7 +4397,7 @@ void MoveBullet( INT32 iBullet ) { // check angle of knife and place on ground appropriately OBJECTTYPE Object; - INT32 iKnifeGridNo; + INT32 iKnifeGridNo; CreateItem( pBullet->fromItem, (INT8) pBullet->ubItemStatus, &Object ); @@ -4464,7 +4485,7 @@ void MoveBullet( INT32 iBullet ) } } else if ( pBullet->iLoop > CLOSE_TO_FIRER || (pStructure->fFlags & ALWAYS_CONSIDER_HIT) || (pBullet->iLoop > CLOSE_TO_FIRER) || (fIntended) ) - { + { if (pStructure->fFlags & STRUCTURE_WALLSTUFF) { // possibly shooting at corner in which case we should let it pass @@ -4473,7 +4494,7 @@ void MoveBullet( INT32 iBullet ) else { fResolveHit = TRUE; - } + } if (fResolveHit) { @@ -4511,8 +4532,8 @@ void MoveBullet( INT32 iBullet ) } } } - } - } + } + } } // got past everything; go to next LOS location within // tile, horizontally or vertically @@ -4535,7 +4556,7 @@ void MoveBullet( INT32 iBullet ) if ( 1 /*HandleBulletStructureInteraction( pBullet, pRoofStructure, &fHitStructure ) <= 0 */) { StopBullet( pBullet->iBullet ); - BulletHitStructure( pBullet, 0, 0, pBullet->pFirer, pBullet->qCurrX, pBullet->qCurrY, pBullet->qCurrZ, TRUE ); + BulletHitStructure( pBullet, 0, 0, pBullet->pFirer, pBullet->qCurrX, pBullet->qCurrY, pBullet->qCurrZ, TRUE ); return; } /* @@ -4598,7 +4619,7 @@ void MoveBullet( INT32 iBullet ) if ( (pBullet->iLoop > pBullet->iRange * 2) ) { // beyond max effective range, bullet starts to drop! - // since we're doing an increment based on distance, not time, the + // since we're doing an increment based on distance, not time, the // decrement is scaled down depending on how fast the bullet is (effective range) pBullet->qIncrZ -= INT32_TO_FIXEDPT( 100 ) / (pBullet->iRange * 2); } @@ -4608,10 +4629,10 @@ void MoveBullet( INT32 iBullet ) } // check to see if bullet is close to target - if ( pBullet->pFirer->ubTargetID != NOBODY && !(pBullet->pFirer->uiStatusFlags & SOLDIER_ATTACK_NOTICED) && PythSpacesAway( (INT16) pBullet->sGridNo, (INT16) pBullet->sTargetGridNo ) <= 3 ) + if ( pBullet->pFirer->ubTargetID != NOBODY && !(pBullet->pFirer->flags.uiStatusFlags & SOLDIER_ATTACK_NOTICED) && PythSpacesAway( (INT16) pBullet->sGridNo, (INT16) pBullet->sTargetGridNo ) <= 3 ) { - pBullet->pFirer->uiStatusFlags |= SOLDIER_ATTACK_NOTICED; - } + pBullet->pFirer->flags.uiStatusFlags |= SOLDIER_ATTACK_NOTICED; + } } while( uiTileInc < pBullet->ubTilesPerUpdate ); // unless the distance is integral, after the loop there will be a // fractional amount of distance remaining which is unchecked @@ -4633,8 +4654,6 @@ INT32 CheckForCollision( FLOAT dX, FLOAT dY, FLOAT dZ, FLOAT dDeltaX, FLOAT dDel MAP_ELEMENT * pMapElement; STRUCTURE * pStructure, *pTempStructure; - BOOLEAN fRoofPresent = FALSE; - SOLDIERTYPE * pTarget; FLOAT dTargetX; FLOAT dTargetY; @@ -4642,10 +4661,6 @@ INT32 CheckForCollision( FLOAT dX, FLOAT dY, FLOAT dZ, FLOAT dDeltaX, FLOAT dDel FLOAT dTargetZMax; BOOLEAN fIntended; - UINT32 uiTileInc = 0; - - //INT8 iImpactReduction; - INT16 sX, sY, sZ; FLOAT dOldZUnits, dZUnits; @@ -4676,7 +4691,7 @@ INT32 CheckForCollision( FLOAT dX, FLOAT dY, FLOAT dZ, FLOAT dDeltaX, FLOAT dDel // Calculate old height and new hieght in pixels dOldZUnits = (dZ - dDeltaZ ); - dZUnits = dZ; + dZUnits = dZ; //if (pBullet->fCheckForRoof) //{ @@ -4698,7 +4713,7 @@ INT32 CheckForCollision( FLOAT dX, FLOAT dY, FLOAT dZ, FLOAT dDeltaX, FLOAT dDel dTargetY = pTarget->dYPos; dTargetZMin = 0.0f; CalculateSoldierZPos( pTarget, HEIGHT, &dTargetZMax ); - if (pTarget->bLevel > 0) + if (pTarget->pathing.bLevel > 0) { // on roof dTargetZMin += WALL_HEIGHT_UNITS; @@ -4723,7 +4738,7 @@ INT32 CheckForCollision( FLOAT dX, FLOAT dY, FLOAT dZ, FLOAT dDeltaX, FLOAT dDel iCurrAboveLevelZ = (INT32) dZ - iLandHeight; if (iCurrAboveLevelZ < 0) { - // ground is in the way! + // ground is in the way! if ( TERRAIN_IS_WATER( pMapElement->ubTerrainID) ) { return ( COLLISION_WATER ); @@ -4763,7 +4778,7 @@ INT32 CheckForCollision( FLOAT dX, FLOAT dY, FLOAT dZ, FLOAT dDeltaX, FLOAT dDel // check for ground collision if ( dZ < iLandHeight) { - // ground is in the way! + // ground is in the way! if ( TERRAIN_IS_WATER( pMapElement->ubTerrainID) ) { return ( COLLISION_WATER ); @@ -4776,11 +4791,11 @@ INT32 CheckForCollision( FLOAT dX, FLOAT dY, FLOAT dZ, FLOAT dDeltaX, FLOAT dDel if ( gfCaves || gfBasement ) { - if ( dOldZUnits > HEIGHT_UNITS && dZUnits < HEIGHT_UNITS ) + if ( dOldZUnits > HEIGHT_UNITS && dZUnits < HEIGHT_UNITS ) { return( COLLISION_ROOF ); } - if ( dOldZUnits < HEIGHT_UNITS && dZUnits > HEIGHT_UNITS ) + if ( dOldZUnits < HEIGHT_UNITS && dZUnits > HEIGHT_UNITS ) { return( COLLISION_INTERIOR_ROOF ); } @@ -4798,7 +4813,7 @@ INT32 CheckForCollision( FLOAT dX, FLOAT dY, FLOAT dZ, FLOAT dDeltaX, FLOAT dDel //} } - else + else { // there are structures in this tile iCurrCubesAboveLevelZ = CONVERT_HEIGHTUNITS_TO_INDEX( iCurrAboveLevelZ ); @@ -4811,7 +4826,7 @@ INT32 CheckForCollision( FLOAT dX, FLOAT dY, FLOAT dZ, FLOAT dDeltaX, FLOAT dDel if (iCurrCubesAboveLevelZ < STRUCTURE_ON_ROOF_MAX) { - if (iCurrCubesAboveLevelZ < STRUCTURE_ON_GROUND_MAX) + if (iCurrCubesAboveLevelZ < STRUCTURE_ON_GROUND_MAX) { // check objects on the ground sDesiredLevel = STRUCTURE_ON_GROUND; @@ -4829,11 +4844,11 @@ INT32 CheckForCollision( FLOAT dX, FLOAT dY, FLOAT dZ, FLOAT dDeltaX, FLOAT dDel if (pStructure->fFlags & STRUCTURE_ROOF || gfCaves || gfBasement ) { - if ( dOldZUnits > HEIGHT_UNITS && dZUnits < HEIGHT_UNITS ) + if ( dOldZUnits > HEIGHT_UNITS && dZUnits < HEIGHT_UNITS ) { return( COLLISION_ROOF ); } - if ( dOldZUnits < HEIGHT_UNITS && dZUnits > HEIGHT_UNITS ) + if ( dOldZUnits < HEIGHT_UNITS && dZUnits > HEIGHT_UNITS ) { return( COLLISION_INTERIOR_ROOF ); } @@ -4847,7 +4862,7 @@ INT32 CheckForCollision( FLOAT dX, FLOAT dY, FLOAT dZ, FLOAT dDeltaX, FLOAT dDel *pusStructureID = pStructure->usStructureID; if (pStructure->fFlags & STRUCTURE_WALLNWINDOW && dZ >= WINDOW_BOTTOM_HEIGHT_UNITS && dZ <= WINDOW_TOP_HEIGHT_UNITS) - { + { if (pStructure->ubWallOrientation == INSIDE_TOP_RIGHT || pStructure->ubWallOrientation == OUTSIDE_TOP_RIGHT) { @@ -4874,7 +4889,7 @@ INT32 CheckForCollision( FLOAT dX, FLOAT dY, FLOAT dZ, FLOAT dDeltaX, FLOAT dDel } if (pStructure->fFlags & STRUCTURE_WALLSTUFF ) - { + { //if ( !CalculateLOSNormal( pStructure, bLOSIndexX, bLOSIndexY, (INT8)iCurrCubesAboveLevelZ, dDeltaX, dDeltaY, dDeltaZ, pdNormalX, pdNormalY, pdNormalZ ) ) //{ // return( COLLISION_NONE ); @@ -4920,15 +4935,15 @@ INT32 CheckForCollision( FLOAT dX, FLOAT dY, FLOAT dZ, FLOAT dDeltaX, FLOAT dDel { if ( iCurrCubesAboveLevelZ < PROFILE_Z_SIZE-1 ) { - if ( !((*(pStructure->pShape))[bLOSIndexX][bLOSIndexY] & AtHeight[ iCurrCubesAboveLevelZ + 1 ]) ) + if ( !((*(pStructure->pShape))[bLOSIndexX][bLOSIndexY] & AtHeight[ iCurrCubesAboveLevelZ + 1 ]) ) { if ( ( pStructure->fFlags & STRUCTURE_ROOF ) ) { - return( COLLISION_ROOF ); + return( COLLISION_ROOF ); } else { - return( COLLISION_STRUCTURE_Z ); + return( COLLISION_STRUCTURE_Z ); } } } @@ -4946,7 +4961,7 @@ INT32 CheckForCollision( FLOAT dX, FLOAT dY, FLOAT dZ, FLOAT dDeltaX, FLOAT dDel { if ( !((*(pTempStructure->pShape))[bLOSIndexX][bLOSIndexY] & AtHeight[ 0 ]) ) { - return( COLLISION_STRUCTURE_Z ); + return( COLLISION_STRUCTURE_Z ); } } @@ -4957,10 +4972,10 @@ INT32 CheckForCollision( FLOAT dX, FLOAT dY, FLOAT dZ, FLOAT dDeltaX, FLOAT dDel else { // We are very high! - return( COLLISION_STRUCTURE_Z ); + return( COLLISION_STRUCTURE_Z ); } } - } + } // Check armour rating..... // ATE; not if small vegitation.... @@ -4975,7 +4990,7 @@ INT32 CheckForCollision( FLOAT dX, FLOAT dY, FLOAT dZ, FLOAT dDeltaX, FLOAT dDel } } pStructure = pStructure->pNext; - } + } } @@ -4990,7 +5005,7 @@ INT32 CheckForCollision( FLOAT dX, FLOAT dY, FLOAT dZ, FLOAT dDeltaX, FLOAT dDel // } // } - } + } return( COLLISION_NONE ); } @@ -5061,7 +5076,7 @@ BOOLEAN CalculateLOSNormal( STRUCTURE *pStructure, INT8 bLOSX, INT8 bLOSY, INT8 { fParimeter = TRUE; break; - } + } } tX = (bX + 1); @@ -5076,7 +5091,7 @@ BOOLEAN CalculateLOSNormal( STRUCTURE *pStructure, INT8 bLOSX, INT8 bLOSY, INT8 { fParimeter = TRUE; break; - } + } } tX = bX; @@ -5091,7 +5106,7 @@ BOOLEAN CalculateLOSNormal( STRUCTURE *pStructure, INT8 bLOSX, INT8 bLOSY, INT8 { fParimeter = TRUE; break; - } + } } tX = bX; @@ -5105,13 +5120,13 @@ BOOLEAN CalculateLOSNormal( STRUCTURE *pStructure, INT8 bLOSX, INT8 bLOSY, INT8 { fParimeter = TRUE; break; - } + } } } while( FALSE ); // OK, now add angles, but not the center! - if ( cntx == 1 && cnty == 1 ) + if ( cntx == 1 && cnty == 1 ) { } @@ -5293,7 +5308,7 @@ BOOLEAN CalculateLOSNormal( STRUCTURE *pStructure, INT8 bLOSX, INT8 bLOSY, INT8 if (((*(pStructure->pShape))[bX][bY] & AtHeight[ bLOSZ ]) > 0) { // OK, now add angles, but not the center! - if ( cntx == 1 && cnty == 1 ) + if ( cntx == 1 && cnty == 1 ) { } @@ -5307,7 +5322,7 @@ BOOLEAN CalculateLOSNormal( STRUCTURE *pStructure, INT8 bLOSX, INT8 bLOSY, INT8 } // Average angle - if ( bNumSums > 0) + if ( bNumSums > 0) { sAngleAv = sAngleSum / bNumSums; diff --git a/Tactical/LOS.h b/Tactical/LOS.h index 535616bf..49104731 100644 --- a/Tactical/LOS.h +++ b/Tactical/LOS.h @@ -97,7 +97,7 @@ BOOLEAN CalculateSoldierZPos( SOLDIERTYPE * pSoldier, UINT8 ubPosType, FLOAT * p // 191 is 6' (structures of height 3) // 127 is 4' (structures of height 2) -// 63 is 2' (structures of height 1) +// 63 is 2' (structures of height 1) #define STANDING_HEIGHT 191.0f diff --git a/Tactical/Map Information.cpp b/Tactical/Map Information.cpp index 45c9dec5..60156a88 100644 --- a/Tactical/Map Information.cpp +++ b/Tactical/Map Information.cpp @@ -25,13 +25,8 @@ #include "Animated ProgressBar.h" #endif -//Don't mess with this value, unless you want to force update all maps in the game! -// Lesh: fix the sad situation with the different major map versions -//#ifdef RUSSIAN - //#define MAJOR_MAP_VERSION 6.00 -//#else - #define MAJOR_MAP_VERSION 5.00 -//#endif +//CHRISL: MAJOR_MAP_VERSION information moved to worlddef.h by ADB. We're using these values elsewhere and need them +// in the header file FLOAT gdMajorMapVersion = MAJOR_MAP_VERSION; @@ -39,48 +34,55 @@ BOOLEAN gfWorldLoaded; MAPCREATE_STRUCT gMapInformation; -//Current minor map version updater. -#define MINOR_MAP_VERSION 25 +//CHRISL: MINOR_MAP_VERSION information moved to worlddef.h by ADB. We're using these values elsewhere and need them +// in the header file + UINT8 gubMinorMapVersion = MINOR_MAP_VERSION; /* MINOR_MAP_VERSION Log -- Created by Kris Morness, November 14, 1997 Version 0 -- Kris -- obsolete November 14, 1997 The newly created soldier information had a couple bugs regarding initialization - Bug 1) Soldier placements without detailed slots weren't initialized. - Bug 2) The attitude variable was accidentally being generated like attributes + Bug 1) Soldier placements without detailed slots weren't initialized. + Bug 2) The attitude variable was accidentally being generated like attributes which usually put it completely out of range. Version 1 -- Kris -- obsolete January 7, 1998 - Bug 3) New changes to the wall decals, made the currently existing ones in the world + Bug 3) New changes to the wall decals, made the currently existing ones in the world unpredictable, and are automatically removed, so new ones can be used. Version 2 -- Kris -- obsolete February 3, 1998 - Bug 4) Enemy mercs now have a color code assignment which defaults to army. + Bug 4) Enemy mercs now have a color code assignment which defaults to army. Version 3 -- Kris -- obsolete February 9, 1998 - Bug 5) Move entry points down if they are too high. + Bug 5) Move entry points down if they are too high. Version 4 -- Kris -- obsolete February 25, 1998 - Bug 6) Change all doors to FIRSTDOOR + Bug 6) Change all doors to FIRSTDOOR Version 5 -- Kris -- obsolete March 4, 1998 - Bug 7) Remove all exit grids (the format has changed) + Bug 7) Remove all exit grids (the format has changed) Version 6 -- Kris -- obsolete March 9, 1998 - Bug 8) Change droppable status of merc items so that they are all undroppable. + Bug 8) Change droppable status of merc items so that they are all undroppable. Version 7 -- Kris -- obsolete April 14, 1998 - Bug 9) Priority placements have been dropped in favor of splitting it into two categories. - The first is Detailed placements, and the second is priority existance. So, all + Bug 9) Priority placements have been dropped in favor of splitting it into two categories. + The first is Detailed placements, and the second is priority existance. So, all current detailed placements will also have priority existance. Version 8 -- Kris -- obsolete April 16, 1998 - MAJOR CONFLICT RESULTING IN A MAJOR VERSION UPDATE 2.00! - Bug 10) Padding on detailed placements is uninitialized. Clear all data starting at + MAJOR CONFLICT RESULTING IN A MAJOR VERSION UPDATE 2.00! + Bug 10) Padding on detailed placements is uninitialized. Clear all data starting at fKillSlotIfOwnerDies. Version 9 -- Kris -- obsolete April 26, 1998 This version requires no auto updating, but external code has adjusted the size of the mapedgepoint - arraysize from UINT8 to UINT16. See Map Edgepoints.c. - Bug 11) Convert all wheelchaired placement bodytypes to cows. Result of change in the animation database. + arraysize from UINT8 to UINT16. See Map Edgepoints.c. + Bug 11) Convert all wheelchaired placement bodytypes to cows. Result of change in the animation database. Version 11 -- Kris -- obsolete May 2, 1998 - Added new center entry point. Need to initialize the original padding to -1. + Added new center entry point. Need to initialize the original padding to -1. + + Version 6.27 ADB July 22 07 + Changing the format of OBJECTTYPE means the maps should be loaded, converted, and saved + if one wants to take advantage of the new format + Converting to the new format is not necessary to load a map and run the game. + **Note** this conversion hasn't happened yet */ -//EntryPoints can't be placed on the top two gridnos in a map. So all we do in this case -//is return the closest gridno. Returns TRUE if the mapindex changes. +//EntryPoints can't be placed on the top two gridnos in a map. So all we do in this case +//is return the closest gridno. Returns TRUE if the mapindex changes. BOOLEAN ValidateEntryPointGridNo( INT16 *sGridNo ) { INT16 sXMapPos, sYMapPos; @@ -135,9 +137,9 @@ void LoadMapInformation( INT8 **hBuffer ) InitRenderParams( gMapInformation.ubRestrictedScrollID ); } -//This will automatically update obsolete map versions to the new ones. This will even -//work in the game itself, but would require conversion to happen every time. This is completely -//transparent to the rest of the game, but in the editor, obsolete versions will be updated upon +//This will automatically update obsolete map versions to the new ones. This will even +//work in the game itself, but would require conversion to happen every time. This is completely +//transparent to the rest of the game, but in the editor, obsolete versions will be updated upon //loading and won't be permanently updated until the map is saved, regardless of changes. void UpdateOldVersionMap() { @@ -154,10 +156,10 @@ void UpdateOldVersionMap() curr = gSoldierInitHead; while( curr ) { - //Bug #01) Nodes without detailed slots weren't initialized. + //Bug #01) Nodes without detailed slots weren't initialized. if( !curr->pBasicPlacement->fDetailedPlacement ) curr->pDetailedPlacement = NULL; - //Bug #02) The attitude variable was accidentally being generated like attributes + //Bug #02) The attitude variable was accidentally being generated like attributes // which put it completely out of range. if( curr->pBasicPlacement->bAttitude > 7 ) curr->pBasicPlacement->bAttitude = (INT8)Random(8); @@ -167,9 +169,9 @@ void UpdateOldVersionMap() } //VERSION 1 -- obsolete January 7, 1998 if( gMapInformation.ubMapVersion == 1 ) - { + { gMapInformation.ubMapVersion++; - //Bug #03) Removing all wall decals from map, because of new changes to the slots + //Bug #03) Removing all wall decals from map, because of new changes to the slots // as well as certain decals found commonly in illegal places. for( i = 0; i < WORLD_MAX; i++ ) { @@ -184,7 +186,7 @@ void UpdateOldVersionMap() curr = gSoldierInitHead; while( curr ) { - //Bug #04) Assign enemy mercs default army color code if applicable + //Bug #04) Assign enemy mercs default army color code if applicable if( curr->pBasicPlacement->bTeam == ENEMY_TEAM && !curr->pBasicPlacement->ubSoldierClass ) { if( !curr->pDetailedPlacement ) @@ -204,7 +206,7 @@ void UpdateOldVersionMap() if( gMapInformation.ubMapVersion == 3 ) { gMapInformation.ubMapVersion++; - //Bug #05) Move entry points down if necessary. + //Bug #05) Move entry points down if necessary. ValidateEntryPointGridNo( &gMapInformation.sNorthGridNo ); ValidateEntryPointGridNo( &gMapInformation.sEastGridNo ); ValidateEntryPointGridNo( &gMapInformation.sSouthGridNo ); @@ -214,15 +216,15 @@ void UpdateOldVersionMap() if( gMapInformation.ubMapVersion == 4 ) { gMapInformation.ubMapVersion++; - //6) Change all doors to FIRSTDOOR + //6) Change all doors to FIRSTDOOR for( i = 0; i < WORLD_MAX; i++ ) { - //NOTE: Here are the index values for the various doors + //NOTE: Here are the index values for the various doors //DOOR OPEN CLOSED - //FIRST 916 912 - //SECOND 936 932 - //THIRD 956 952 - //FOURTH 976 972 + //FIRST 916 912 + //SECOND 936 932 + //THIRD 956 952 + //FOURTH 976 972 pStruct = gpWorldLevelData[ i ].pStructHead; while( pStruct ) { @@ -233,7 +235,7 @@ void UpdateOldVersionMap() break; } else if( pStruct->usIndex == 936 || pStruct->usIndex == 956 || pStruct->usIndex == 976 ) - { + { ReplaceStructIndex( i, pStruct->usIndex, 916 ); break; } @@ -278,22 +280,22 @@ void UpdateOldVersionMap() if( gMapInformation.ubMapVersion == 5 ) { gMapInformation.ubMapVersion++; - //Bug 7) Remove all exit grids (the format has changed) + //Bug 7) Remove all exit grids (the format has changed) for( i = 0; i < WORLD_MAX; i++ ) RemoveExitGridFromWorld( i ); } //VERSION 6 -- obsolete March 9, 1998 if( gMapInformation.ubMapVersion == 6 ) - { //Bug 8) Change droppable status of merc items so that they are all undroppable. + { //Bug 8) Change droppable status of merc items so that they are all undroppable. gMapInformation.ubMapVersion++; curr = gSoldierInitHead; while( curr ) { - //Bug #04) Assign enemy mercs default army color code if applicable + //Bug #04) Assign enemy mercs default army color code if applicable if( curr->pDetailedPlacement ) { - for( i = 0; i < NUM_INV_SLOTS; i++ ) - { //make all items undroppable, even if it is empty. This will allow for + for( i = 0; i < curr->pDetailedPlacement->Inv.size(); i++ ) + { //make all items undroppable, even if it is empty. This will allow for //random item generation, while empty, droppable slots are locked as empty //during random item generation. curr->pDetailedPlacement->Inv[ i ].fFlags |= OBJECT_UNDROPPABLE; @@ -306,8 +308,8 @@ void UpdateOldVersionMap() if( gMapInformation.ubMapVersion == 7 ) { gMapInformation.ubMapVersion++; - //Bug 9) Priority placements have been dropped in favor of splitting it into two categories. - // The first is Detailed placements, and the second is priority existance. So, all + //Bug 9) Priority placements have been dropped in favor of splitting it into two categories. + // The first is Detailed placements, and the second is priority existance. So, all // current detailed placements will also have priority existance. curr = gSoldierInitHead; while( curr ) @@ -356,7 +358,7 @@ void UpdateOldVersionMap() { RemoveObject( i, pStruct->usIndex ); } - } + } } if( gMapInformation.ubMapVersion <= 7 ) @@ -364,7 +366,7 @@ void UpdateOldVersionMap() if( gfEditMode ) { #ifdef JA2TESTVERSION - ScreenMsg( FONT_MCOLOR_RED, MSG_ERROR, L"Currently loaded map is corrupt! Allowing the map to load anyway!" ); + ScreenMsg( FONT_MCOLOR_RED, MSG_ERROR, L"Currently loaded map is corrupt! Allowing the map to load anyway!" ); #endif } else @@ -383,14 +385,14 @@ void UpdateOldVersionMap() if( gMapInformation.ubMapVersion == 8 ) { gMapInformation.ubMapVersion++; - //Bug 10) Padding on detailed placements is uninitialized. Clear all data starting at + //Bug 10) Padding on detailed placements is uninitialized. Clear all data starting at // fKillSlotIfOwnerDies. curr = gSoldierInitHead; while( curr ) { if( curr->pDetailedPlacement ) { - //The size 120 was hand calculated. The remaining padding was 118 bytes + //The size 120 was hand calculated. The remaining padding was 118 bytes //and there were two one byte fields cleared, fKillSlotIfOwnerDies and ubScheduleID memset( &curr->pDetailedPlacement->fKillSlotIfOwnerDies, 0, 120 ); } @@ -404,7 +406,7 @@ void UpdateOldVersionMap() curr = gSoldierInitHead; while( curr ) { - //Bug 11) Convert all wheelchaired placement bodytypes to cows. Result of change in the animation database. + //Bug 11) Convert all wheelchaired placement bodytypes to cows. Result of change in the animation database. if( curr->pDetailedPlacement && curr->pDetailedPlacement->bBodyType == CRIPPLECIV ) { curr->pDetailedPlacement->bBodyType = COW; @@ -423,21 +425,21 @@ void UpdateOldVersionMap() INT32 i, cnt; OBJECTTYPE *pItem; gMapInformation.ubMapVersion++; - //Bug 10) Padding on detailed placements is uninitialized. Clear all data starting at + //Bug 10) Padding on detailed placements is uninitialized. Clear all data starting at // fKillSlotIfOwnerDies. curr = gSoldierInitHead; while( curr ) { if( curr->pDetailedPlacement ) { - for ( i = 0; i < NUM_INV_SLOTS; i++ ) + for ( i = 0; i < curr->pDetailedPlacement->Inv.size(); i++ ) { pItem = &curr->pDetailedPlacement->Inv[ i ]; if( Item[ pItem->usItem ].usItemClass & IC_AMMO ) { for( cnt = 0; cnt < pItem->ubNumberOfObjects; cnt++ ) { - pItem->ubShotsLeft[ cnt ] = Magazine[ Item[ pItem->usItem ].ubClassIndex ].ubMagSize; + pItem->shots.ubShotsLeft[ cnt ] = Magazine[ Item[ pItem->usItem ].ubClassIndex ].ubMagSize; } } } @@ -454,14 +456,14 @@ void UpdateOldVersionMap() } } if( gMapInformation.ubMapVersion < 15 ) - { //Do nothing. The object layer was expanded from 1 byte to 2 bytes, effecting the - //size of the maps. This was due to the fact that the ROADPIECES tileset contains + { //Do nothing. The object layer was expanded from 1 byte to 2 bytes, effecting the + //size of the maps. This was due to the fact that the ROADPIECES tileset contains //over 300 pieces, hence requiring a size increase of the tileset subindex for this //layer only. } #endif //end of MAJOR VERSION 3.0 obsolete code if( gMapInformation.ubMapVersion < 15 ) - { + { AssertMsg( 0, "Map is less than minimum supported version." ); } if( gMapInformation.ubMapVersion < 16 ) @@ -481,9 +483,9 @@ void UpdateOldVersionMap() gMapInformation.ubMapVersion = 18; for ( i = 0; i < guiNumWorldItems; i++ ) { - if ( gWorldItems[ i ].o.usItem == JAR_ELIXIR ) + if ( gWorldItems[ i ].object.usItem == JAR_ELIXIR ) { - gWorldItems[ i ].o.usItem = CROWBAR; + gWorldItems[ i ].object.usItem = CROWBAR; } } } @@ -507,7 +509,7 @@ void UpdateOldVersionMap() { SOLDIERINITNODE *curr; //override any item slots being locked if there is no item in that slot. - //Laymen terms: If any items slots are locked to be empty, make them empty but available + //Laymen terms: If any items slots are locked to be empty, make them empty but available //for random item generation. gMapInformation.ubMapVersion = 21; curr = gSoldierInitHead; @@ -515,8 +517,7 @@ void UpdateOldVersionMap() { if( curr->pDetailedPlacement ) { - INT32 i; - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( UINT32 i = 0; i < curr->pDetailedPlacement->Inv.size(); i++ ) { if( !curr->pDetailedPlacement->Inv[ i ].usItem ) { @@ -541,7 +542,7 @@ void UpdateOldVersionMap() { //Allow map edgepoints to be regenerated as new system has been reenabled. SOLDIERINITNODE *curr; gMapInformation.ubMapVersion = 23; - if( giCurrentTilesetID == 1 ) //cave/mine tileset only + if( giCurrentTilesetID == 1 ) //cave/mine tileset only { //convert all civilians to miners which use uniforms and more masculine body types. curr = gSoldierInitHead; while( curr ) @@ -556,7 +557,7 @@ void UpdateOldVersionMap() } } if( gMapInformation.ubMapVersion < 25 ) - { + { gMapInformation.ubMapVersion = 25; if( gfCaves ) { @@ -565,30 +566,29 @@ void UpdateOldVersionMap() } } -void AutoCalculateItemNoOverwriteStatus() +void AutoCalculateItemNoOverwriteStatus() { SOLDIERINITNODE *curr; - INT32 i; OBJECTTYPE *pItem; - //Recalculate the "no overwrite" status flag on all items. There are two different cases: - //1) If detailed placement has item, the item "no overwrite" flag is set - //2) If detailed placement doesn't have item, but item is set to drop (forced empty slot), the "no overwrite" flag is set. + //Recalculate the "no overwrite" status flag on all items. There are two different cases: + //1) If detailed placement has item, the item "no overwrite" flag is set + //2) If detailed placement doesn't have item, but item is set to drop (forced empty slot), the "no overwrite" flag is set. curr = gSoldierInitHead; while( curr ) { if( curr->pDetailedPlacement ) { - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( UINT32 i = 0; i < curr->pDetailedPlacement->Inv.size(); i++ ) { pItem = &curr->pDetailedPlacement->Inv[ i ]; - if( pItem->usItem != NONE ) + if( pItem->exists() == true ) { //case 1 (see above) - pItem->fFlags |= OBJECT_NO_OVERWRITE; + (*pItem).fFlags |= OBJECT_NO_OVERWRITE; } - else if( !(pItem->fFlags & OBJECT_UNDROPPABLE) ) + else if( !((*pItem).fFlags & OBJECT_UNDROPPABLE) ) { //case 2 (see above) - pItem->fFlags |= OBJECT_NO_OVERWRITE; + (*pItem).fFlags |= OBJECT_NO_OVERWRITE; } } } diff --git a/Tactical/Map Information.h b/Tactical/Map Information.h index 6802d39f..3c210d93 100644 --- a/Tactical/Map Information.h +++ b/Tactical/Map Information.h @@ -15,12 +15,12 @@ enum //for use with MAPCREATE_STRUCT.ubEditorSmoothingType typedef struct { - //These are the mandatory entry points for a map. If any of the values are -1, then that means that + //These are the mandatory entry points for a map. If any of the values are -1, then that means that //the point has been specifically not used and that the map is not traversable to or from an adjacent - //sector in that direction. The >0 value points must be validated before saving the map. This is + //sector in that direction. The >0 value points must be validated before saving the map. This is //done by simply checking if those points are sittable by mercs, and that you can plot a path from - //these points to each other. These values can only be set by the editor : mapinfo tab - INT16 sNorthGridNo; + //these points to each other. These values can only be set by the editor : mapinfo tab + INT16 sNorthGridNo; INT16 sEastGridNo; INT16 sSouthGridNo; INT16 sWestGridNo; @@ -29,7 +29,7 @@ typedef struct UINT8 ubNumIndividuals; UINT8 ubMapVersion; UINT8 ubRestrictedScrollID; - UINT8 ubEditorSmoothingType; //normal, basement, or caves + UINT8 ubEditorSmoothingType; //normal, basement, or caves INT16 sCenterGridNo; INT16 sIsolatedGridNo; INT8 bPadding[83]; //I'm sure lots of map info will be added diff --git a/Tactical/Merc Entering.cpp b/Tactical/Merc Entering.cpp index d8634410..eb05c43f 100644 --- a/Tactical/Merc Entering.cpp +++ b/Tactical/Merc Entering.cpp @@ -7,10 +7,10 @@ #include "wcheck.h" #include "stdlib.h" #include "debug.h" - #include "soldier control.h" + //#include "soldier control.h" #include "weapons.h" #include "handle items.h" - #include "worlddef.h" + #include "worlddef.h" #include "worldman.h" #include "rotting corpses.h" #include "tile cache.h" @@ -22,7 +22,7 @@ #include "renderworld.h" #include "tile animation.h" #include "merc entering.h" - #include "sound control.h" + #include "Sound Control.h" #include "strategic.h" #include "strategicmap.h" #include "Handle UI.h" @@ -40,6 +40,11 @@ #include "Music Control.h" #endif + +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + #define MAX_MERC_IN_HELI 20 #define MAX_HELI_SCRIPT 30 #define ME_SCRIPT_DELAY 100 @@ -156,7 +161,7 @@ UINT8 ubHeliScripts[ NUM_HELI_STATES ][ MAX_HELI_SCRIPT ] = HELI_MOVEY, HELI_MOVEY, HELI_GOTO_BEGINDROP, - + // HELI_BEGIN_DROP HELI_MOVE_DOWN, HELI_MOVE_DOWN, @@ -230,7 +235,7 @@ UINT8 ubHeliScripts[ NUM_HELI_STATES ][ MAX_HELI_SCRIPT ] = HELI_MOVESMALL_DOWN, HELI_MOVESMALL_DOWN, HELI_GOTO_DROP, - + // HELI END DROP HELI_MOVE_UP, HELI_MOVE_UP, @@ -464,10 +469,10 @@ void HandleHeliDrop( ) if ( _KeyDown( ESC ) ) { - // Loop through all mercs not yet placed + // Loop through all mercs not yet placed for ( cnt = gbCurDrop; cnt < gbNumHeliSeatsOccupied; cnt++ ) { - // Add merc to sector + // Add merc to sector MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH; UpdateMercInSector( MercPtrs[ gusHeliSeats[ cnt ] ], 9, 1, 0 ); @@ -481,7 +486,7 @@ void HandleHeliDrop( ) // Remove heli DeleteAniTile( gpHeli ); - RebuildCurrentSquad( ); + RebuildCurrentSquad( ); // Remove sound if( uiSoundSample!=NO_SAMPLE ) @@ -500,7 +505,7 @@ void HandleHeliDrop( ) SelectSoldier( gusHeliSeats[ 0 ], FALSE, TRUE ); //guiCurrentEvent = LU_ENDUILOCK; - //gCurrentUIMode = LOCKUI_MODE; + //gCurrentUIMode = LOCKUI_MODE; guiPendingOverrideEvent = LU_ENDUILOCK; //UIHandleLUIEndLock( NULL ); @@ -512,8 +517,8 @@ void HandleHeliDrop( ) gfIgnoreScrolling = TRUE; uiClock = GetJA2Clock( ); - - if ( ( uiClock - guiHeliLastUpdate ) > ME_SCRIPT_DELAY ) + + if ( ( uiClock - guiHeliLastUpdate ) > ME_SCRIPT_DELAY ) { guiHeliLastUpdate = uiClock; @@ -553,7 +558,7 @@ void HandleHeliDrop( ) UnLockPauseState(); UnPauseGame(); - RebuildCurrentSquad( ); + RebuildCurrentSquad( ); HandleFirstHeliDropOfGame( ); } @@ -568,7 +573,7 @@ void HandleHeliDrop( ) UnLockPauseState(); UnPauseGame(); - RebuildCurrentSquad( ); + RebuildCurrentSquad( ); HandleFirstHeliDropOfGame( ); } @@ -578,7 +583,7 @@ void HandleHeliDrop( ) { return; } - + ubScriptCode = ubHeliScripts[ gubHeliState ][ gsHeliScript ]; // Switch on mode... @@ -600,7 +605,7 @@ void HandleHeliDrop( ) { //sWorldX = CenterX( gsGridNoSweetSpot ); //sWorldY = CenterY( gsGridNoSweetSpot ); - EVENT_InitNewSoldierAnim( MercPtrs[ gusHeliSeats[ gbCurDrop ] ], HELIDROP, 0 , FALSE ); + MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->EVENT_InitNewSoldierAnim( HELIDROP, 0 , FALSE ); // Change insertion code MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH; @@ -612,7 +617,7 @@ void HandleHeliDrop( ) if ( gfFirstGuyDown ) { gfFirstGuyDown = FALSE; - SetCurrentSquad( MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->bAssignment, TRUE ); + SetCurrentSquad( MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->bAssignment, TRUE ); } ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, TacticalStr[ MERC_HAS_ARRIVED_STR ], MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->name ); @@ -632,7 +637,7 @@ void HandleHeliDrop( ) if ( gbExitCount == 1 ) { - // Goto leave + // Goto leave gsHeliScript = -1; gubHeliState = HELI_ENDDROP; @@ -743,7 +748,7 @@ void HandleHeliDrop( ) gdHeliZPos = 0; gsHeliScript = 0; gbExitCount = 0; - gubHeliState = HELI_APPROACH; + gubHeliState = HELI_APPROACH; gbHeliRound++; // Ahh, but still delete the heli! @@ -808,15 +813,16 @@ void HandleFirstHeliDropOfGame( ) SayQuoteFromAnyBodyInSector( QUOTE_ENEMY_PRESENCE ); // Start music - SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); + SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); gfFirstHeliRun = FALSE; - + } // Send message to turn on ai again.... - CharacterDialogueWithSpecialEvent( 0, 0, 0 , DIALOGUE_TACTICAL_UI , FALSE , FALSE , DIALOGUE_SPECIAL_EVENT_ENABLE_AI ,0, 0 ); + CharacterDialogueWithSpecialEvent( 0, 0, 0 , DIALOGUE_TACTICAL_UI , FALSE , FALSE , DIALOGUE_SPECIAL_EVENT_ENABLE_AI ,0, 0 ); } + diff --git a/Tactical/Merc Hiring.cpp b/Tactical/Merc Hiring.cpp index 71a2f16e..c5628fda 100644 --- a/Tactical/Merc Hiring.cpp +++ b/Tactical/Merc Hiring.cpp @@ -13,13 +13,13 @@ #include "worldman.h" #include "renderworld.h" #include "Assignments.h" - #include "Soldier Control.h" + #include "Animation Control.h" #include "Animation Data.h" #include "Isometric Utils.h" #include "Event Pump.h" #include "Timer Control.h" - #include "Render Fun.h" + #include "Render Fun.h" #include "Render Dirty.h" #include "mousesystem.h" #include "interface.h" @@ -60,6 +60,11 @@ #include "GameSettings.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + #define MIN_FLIGHT_PREP_TIME 6 #ifdef JA2TESTVERSION @@ -83,7 +88,6 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) { SOLDIERTYPE *pSoldier; UINT8 iNewIndex; - UINT8 ubCount=0; UINT8 ubCurrentSoldier = pHireMerc->ubProfileID; MERCPROFILESTRUCT *pMerc; SOLDIERCREATE_STRUCT MercCreateStruct; @@ -111,8 +115,7 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) } // BUILD STRUCTURES - // MercCreateStruct has been C++'d - //memset( &MercCreateStruct, 0, sizeof( MercCreateStruct ) ); + MercCreateStruct.initialize(); MercCreateStruct.ubProfile = ubCurrentSoldier; MercCreateStruct.fPlayerMerc = TRUE; MercCreateStruct.sSectorX = pHireMerc->sSectorX; @@ -123,7 +126,7 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) if ( !TacticalCreateSoldier( &MercCreateStruct, &iNewIndex ) ) { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "TacticalCreateSoldier in HireMerc(): Failed to Add Merc"); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "TacticalCreateSoldier in HireMerc(): Failed to Add Merc"); return( MERC_HIRE_FAILED ); } @@ -133,15 +136,16 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) if ( iNewIndex == 0 ) { // OK, give this item to our merc! - OBJECTTYPE Object; - // make an objecttype - memset( &Object, 0, sizeof( OBJECTTYPE ) ); - Object.usItem = LETTER; - Object.ubNumberOfObjects = 1; - Object.ItemData.Generic.bStatus[0] = 100; - // Give it - fReturn = AutoPlaceObject( MercPtrs[iNewIndex], &Object, FALSE ); + CreateItem(LETTER, 100, &gTempObject); + // Give it + fReturn = AutoPlaceObject( MercPtrs[iNewIndex], &gTempObject, FALSE ); + // CHRISL: This condition should resolve the issue of the letter not being issued to the first merc + if(!fReturn && (UsingNewInventorySystem() == true)) + { + (MercPtrs[iNewIndex]->inv[NUM_INV_SLOTS-1]) = gTempObject; + fReturn=TRUE; + } Assert( fReturn ); } @@ -161,7 +165,7 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) pSoldier->ubStrategicInsertionCode = pHireMerc->ubInsertionCode; pSoldier->usStrategicInsertionData = pHireMerc->usInsertionData; // ATE: Copy over value for using alnding zone to soldier type - pSoldier->fUseLandingZoneForArrival = pHireMerc->fUseLandingZoneForArrival; + pSoldier->flags.fUseLandingZoneForArrival = pHireMerc->fUseLandingZoneForArrival; // Set assignment @@ -211,9 +215,9 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) //if we are trying to hire a merc that should arrive later, put the merc in the queue - if( pHireMerc->uiTimeTillMercArrives != 0 ) + if( pHireMerc->uiTimeTillMercArrives != 0 ) { - AddStrategicEvent( EVENT_DELAYED_HIRING_OF_MERC, pHireMerc->uiTimeTillMercArrives, pSoldier->ubID ); + AddStrategicEvent( EVENT_DELAYED_HIRING_OF_MERC, pHireMerc->uiTimeTillMercArrives, pSoldier->ubID ); //specify that the merc is hired but hasnt arrived yet pMerc->bMercStatus = MERC_HIRED_BUT_NOT_ARRIVED_YET; @@ -231,27 +235,27 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) { //pSoldier->iTotalContractCharge = gMercProfiles[ pSoldier->ubProfile ].sSalary; pSoldier->bTypeOfLastContract = CONTRACT_EXTEND_1_DAY; - pSoldier->iTimeCanSignElsewhere = GetWorldTotalMin(); + pSoldier->iTimeCanSignElsewhere = GetWorldTotalMin(); } else if( pHireMerc->iTotalContractLength == 7 ) { //pSoldier->iTotalContractCharge = gMercProfiles[ pSoldier->ubProfile ].uiWeeklySalary; pSoldier->bTypeOfLastContract = CONTRACT_EXTEND_1_WEEK; - pSoldier->iTimeCanSignElsewhere = GetWorldTotalMin(); + pSoldier->iTimeCanSignElsewhere = GetWorldTotalMin(); } else if( pHireMerc->iTotalContractLength == 14 ) { //pSoldier->iTotalContractCharge = gMercProfiles[ pSoldier->ubProfile ].uiBiWeeklySalary; pSoldier->bTypeOfLastContract = CONTRACT_EXTEND_2_WEEK; - // These luck fellows need to stay the whole duration! - pSoldier->iTimeCanSignElsewhere = pSoldier->iEndofContractTime; + // These luck fellows need to stay the whole duration! + pSoldier->iTimeCanSignElsewhere = pSoldier->iEndofContractTime; } - // remember the medical deposit we PAID. The one in his profile can increase when he levels! + // remember the medical deposit we PAID. The one in his profile can increase when he levels! pSoldier->usMedicalDeposit = gMercProfiles[ pSoldier->ubProfile ].sMedicalDepositAmount; } //if the merc is from M.E.R.C. - else if( ( ubCurrentSoldier >= BIFF && ubCurrentSoldier <= BUBBA ) || ubCurrentSoldier >= GASTON ) + else if( ( ubCurrentSoldier >= BIFF && ubCurrentSoldier <= BUBBA ) || ubCurrentSoldier >= GASTON ) { pSoldier->ubWhatKindOfMercAmI = MERC_TYPE__MERC; //pSoldier->iTotalContractCharge = -1; @@ -264,7 +268,7 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) AddHistoryToPlayersLog(HISTORY_HIRED_MERC_FROM_MERC, ubCurrentSoldier, GetWorldTotalMin(), -1, -1 ); } //If the merc is from IMP, (ie a player character) - else if( ( ubCurrentSoldier >= 51 ) && ( ubCurrentSoldier < 57 ) ) + else if( ( ubCurrentSoldier >= 51 ) && ( ubCurrentSoldier < 57 ) ) { pSoldier->ubWhatKindOfMercAmI = MERC_TYPE__PLAYER_CHARACTER; //pSoldier->iTotalContractCharge = -1; @@ -291,7 +295,7 @@ void MercArrivesCallback( UINT8 ubSoldierID ) UINT32 uiTimeOfPost; if( !DidGameJustStart() && gsMercArriveSectorX == 9 && gsMercArriveSectorY == 1 ) - { //Mercs arriving in A9. This sector has been deemed as the always safe sector. + { //Mercs arriving in A9. This sector has been deemed as the always safe sector. //Seeing we don't support entry into a hostile sector (except for the beginning), //we will nuke any enemies in this sector first. if( gWorldSectorX != 9 || gWorldSectorY != 1 || gbWorldSectorZ ) @@ -314,7 +318,7 @@ void MercArrivesCallback( UINT8 ubSoldierID ) AddCharacterToAnySquad( pSoldier ); // ATE: Make sure we use global..... - if ( pSoldier->fUseLandingZoneForArrival ) + if ( pSoldier->flags.fUseLandingZoneForArrival ) { pSoldier->sSectorX = gsMercArriveSectorX; pSoldier->sSectorY = gsMercArriveSectorY; @@ -325,7 +329,7 @@ void MercArrivesCallback( UINT8 ubSoldierID ) if ( gWorldSectorX == pSoldier->sSectorX && gWorldSectorY == pSoldier->sSectorY && pSoldier->bSectorZ == gbWorldSectorZ ) { // OK, If this sector is currently loaded, and guy does not have CHOPPER insertion code.... - // ( which means we are at beginning of game if so ) + // ( which means we are at beginning of game if so ) // Setup chopper.... if ( pSoldier->ubStrategicInsertionCode != INSERTION_CODE_CHOPPER && pSoldier->sSectorX == 9 && pSoldier->sSectorY == 1 ) { @@ -334,7 +338,7 @@ void MercArrivesCallback( UINT8 ubSoldierID ) // OK, If we are in mapscreen, get out... if ( guiCurrentScreen == MAP_SCREEN ) { - // ATE: Make sure the current one is selected! + // ATE: Make sure the current one is selected! ChangeSelectedMapSector( gWorldSectorX, gWorldSectorY, 0 ); RequestTriggerExitFromMapscreen( MAP_EXIT_TO_TACTICAL ); @@ -377,7 +381,7 @@ void MercArrivesCallback( UINT8 ubSoldierID ) // remember when excatly he ARRIVED in Arulco, in case he gets fired early pSoldier->uiTimeOfLastContractUpdate = GetWorldTotalMin(); - //set when the merc's contract is finished + //set when the merc's contract is finished pSoldier->iEndofContractTime = GetMidnightOfFutureDayInMinutes( pSoldier->iTotalContractLength ) + ( GetHourWhenContractDone( pSoldier ) * 60 ); // Do initial check for bad items @@ -387,7 +391,7 @@ void MercArrivesCallback( UINT8 ubSoldierID ) if ( SoldierHasWorseEquipmentThanUsedTo( pSoldier ) ) { // Randomly anytime between 9:00, and 10:00 - uiTimeOfPost = 540 + Random( 660 ); + uiTimeOfPost = 540 + Random( 660 ); if ( GetWorldMinutesInDay() < uiTimeOfPost ) { @@ -413,9 +417,9 @@ void MercArrivesCallback( UINT8 ubSoldierID ) BOOLEAN IsMercHireable( UINT8 ubMercID ) { //If the merc has an .EDT file, is not away on assignment, and isnt already hired (but not arrived yet), he is not DEAD and he isnt returning home - if( ( gMercProfiles[ ubMercID ].bMercStatus == MERC_HAS_NO_TEXT_FILE ) || - ( gMercProfiles[ ubMercID ].bMercStatus > 0 ) || - ( gMercProfiles[ ubMercID ].bMercStatus == MERC_HIRED_BUT_NOT_ARRIVED_YET ) || + if( ( gMercProfiles[ ubMercID ].bMercStatus == MERC_HAS_NO_TEXT_FILE ) || + ( gMercProfiles[ ubMercID ].bMercStatus > 0 ) || + ( gMercProfiles[ ubMercID ].bMercStatus == MERC_HIRED_BUT_NOT_ARRIVED_YET ) || ( gMercProfiles[ ubMercID ].bMercStatus == MERC_IS_DEAD ) || ( gMercProfiles[ ubMercID ].uiDayBecomesAvailable > 0 ) || ( gMercProfiles[ ubMercID ].bMercStatus == MERC_WORKING_ELSEWHERE ) || @@ -436,7 +440,7 @@ BOOLEAN IsMercDead( UINT8 ubMercID ) BOOLEAN IsTheSoldierAliveAndConcious( SOLDIERTYPE *pSoldier ) { - if( pSoldier->bLife >= CONSCIOUSNESS ) + if( pSoldier->stats.bLife >= CONSCIOUSNESS ) return(TRUE); else return(FALSE); @@ -453,10 +457,10 @@ UINT8 NumberOfMercsOnPlayerTeam() cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) - { + for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) + { //if the is active, and is not a vehicle - if( pSoldier->bActive && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if( pSoldier->bActive && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { ubCount++; } @@ -470,7 +474,7 @@ void HandleMercArrivesQuotes( SOLDIERTYPE *pSoldier ) { INT8 cnt, bHated, bLastTeamID; SOLDIERTYPE *pTeamSoldier; - + // If we are approaching with helicopter, don't say any ( yet ) if ( pSoldier->ubStrategicInsertionCode != INSERTION_CODE_CHOPPER ) { @@ -527,7 +531,7 @@ void SetFlagToForceHireMerc( BOOLEAN fForceHire ) UINT32 GetMercArrivalTimeOfDay( ) { UINT32 uiCurrHour; - UINT32 uiMinHour; + UINT32 uiMinHour; // Pick a time... @@ -539,7 +543,7 @@ UINT32 GetMercArrivalTimeOfDay( ) // OK, first check if we need to advance a whole day's time... // See if we have missed the last flight for the day... - if ( ( uiCurrHour ) > 13 ) // ( > 1:00 pm - too bad ) + if ( ( uiCurrHour ) > 13 ) // ( > 1:00 pm - too bad ) { // 7:30 flight.... return( GetMidnightOfFutureDayInMinutes( 1 ) + MERC_ARRIVE_TIME_SLOT_1 ); @@ -569,19 +573,19 @@ void UpdateAnyInTransitMercsWithGlobalArrivalSector( ) cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - // look for all mercs on the same team, - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) - { + // look for all mercs on the same team, + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) + { if ( pSoldier->bActive ) - { - if ( pSoldier->bAssignment == IN_TRANSIT ) + { + if ( pSoldier->bAssignment == IN_TRANSIT ) { - if ( pSoldier->fUseLandingZoneForArrival ) + if ( pSoldier->flags.fUseLandingZoneForArrival ) { pSoldier->sSectorX = gsMercArriveSectorX; pSoldier->sSectorY = gsMercArriveSectorY; pSoldier->bSectorZ = 0; - } + } } } } @@ -594,7 +598,7 @@ INT16 StrategicPythSpacesAway(INT16 sOrigin, INT16 sDest) sRows = abs((sOrigin / MAP_WORLD_X) - (sDest / MAP_WORLD_X)); sCols = abs((sOrigin % MAP_WORLD_X) - (sDest % MAP_WORLD_X)); - + // apply Pythagoras's theorem for right-handed triangle: // dist^2 = rows^2 + cols^2, so use the square root to get the distance sResult = (INT16)sqrt((double)(sRows * sRows) + (sCols * sCols)); @@ -609,13 +613,13 @@ INT16 StrategicPythSpacesAway(INT16 sOrigin, INT16 sDest) // if so, search around for nearest non-occupied sector. void CheckForValidArrivalSector( ) { - INT16 sTop, sBottom; - INT16 sLeft, sRight; - INT16 cnt1, cnt2, sGoodX, sGoodY; - UINT8 ubRadius = 4; - INT32 leftmost; - INT16 sSectorGridNo, sSectorGridNo2; - INT32 uiRange, uiLowestRange = 999999; + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2, sGoodX, sGoodY; + UINT8 ubRadius = 4; + INT32 leftmost; + INT16 sSectorGridNo, sSectorGridNo2; + INT32 uiRange, uiLowestRange = 999999; BOOLEAN fFound = FALSE; CHAR16 sString[ 1024 ]; CHAR16 zShortTownIDString1[ 50 ]; @@ -635,8 +639,8 @@ void CheckForValidArrivalSector( ) // If here - we need to do a search! sTop = ubRadius; sBottom = -ubRadius; - sLeft = - ubRadius; - sRight = ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) { @@ -676,7 +680,7 @@ void CheckForValidArrivalSector( ) // swprintf( sString, L"Arrival of new recruits is being rerouted to sector %s, as scheduled drop-off point of sector %s is enemy occupied.", zShortTownIDString2, zShortTownIDString1 ); swprintf( sString, New113Message[MSG113_ARRIVINGREROUTED], zShortTownIDString2, zShortTownIDString1 ); - DoScreenIndependantMessageBox( sString, MSG_BOX_FLAG_OK, NULL ); + DoScreenIndependantMessageBox( sString, MSG_BOX_FLAG_OK, NULL ); } } diff --git a/Tactical/Merc Hiring.h b/Tactical/Merc Hiring.h index 032eaa11..f27deefa 100644 --- a/Tactical/Merc Hiring.h +++ b/Tactical/Merc Hiring.h @@ -18,7 +18,7 @@ // ATE: This define has been moved to be a function so that // we pick the most appropriate time of day to use... -//#define MERC_ARRIVAL_TIME_OF_DAY (7 * 60 + 30) // 7:30 am +//#define MERC_ARRIVAL_TIME_OF_DAY (7 * 60 + 30) // 7:30 am typedef struct diff --git a/Tactical/Militia Control.cpp b/Tactical/Militia Control.cpp index 4c650085..6e1edef6 100644 --- a/Tactical/Militia Control.cpp +++ b/Tactical/Militia Control.cpp @@ -2,7 +2,7 @@ #include "Tactical All.h" #include "PreBattle Interface.h" #else - #include "Soldier Control.h" + #include "Militia Control.h" #include "Town Militia.h" #include "Soldier Init List.h" @@ -34,6 +34,11 @@ #include "MilitiaSquads.h" +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + BOOLEAN gfStrategicMilitiaChangesMade = FALSE; BOOLEAN fFirstClickInMilitiaControlScreenMask = FALSE; @@ -120,11 +125,9 @@ extern BOOLEAN SoldierCanAffordNewStance( SOLDIERTYPE *pSoldier, UINT8 ubDesired void ResetMilitia() { - BOOLEAN fBattleInProgress = FALSE; UINT8 ubNumGreen = 0; UINT8 ubNumReg = 0; UINT8 ubNumVet = 0; - //UINT32 cnt; // if ( gWorldSectorX !=0 && gWorldSectorY != 0 && NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) ) // fBattleInProgress = TRUE; @@ -132,7 +135,7 @@ void ResetMilitia() // 0verhaul: Instead of relying on the "changes made" flag, which isn't even saved in a saved game and therefore not // reliable, we'll just do this the hard way, by taking inventory. // gfStrategicMilitiaChangesMade = FALSE; -// for (cnt = gTacticalStatus.Team[MILITIA_TEAM].bFirstID; cnt <= gTacticalStatus.Team[MILITIA_TEAM].bLastID; cnt++) +// for (UINT32 cnt = gTacticalStatus.Team[MILITIA_TEAM].bFirstID; cnt <= gTacticalStatus.Team[MILITIA_TEAM].bLastID; cnt++) // { // if (!MercPtrs[cnt]->bActive) // { @@ -224,7 +227,8 @@ void PrepareMilitiaForTactical( BOOLEAN fPrepareAll) for (int i=0; ibActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE); + //CHRISL: What's this assert for? + //Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE); } pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ]; @@ -280,7 +284,8 @@ void PrepareMilitiaForTactical( BOOLEAN fPrepareAll) for (int i=0; ibActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE); + //CHRISL: What's this assert for? + //Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE); } } @@ -300,7 +305,7 @@ void HandleMilitiaPromotions( void ) for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++, pTeamSoldier++) { - if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bLife > 0 ) + if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->stats.bLife > 0 ) { if ( pTeamSoldier->ubMilitiaKills > 0 ) { @@ -404,8 +409,6 @@ void MilitiaControlMenuMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason ) void DetermineWhichMilitiaControlMenusCanBeShown( void ) { BOOLEAN fCharacterNoLongerValid = FALSE; - SOLDIERTYPE *pSoldier = NULL; - if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) { if( fShowMapScreenMovementList == TRUE ) @@ -579,7 +582,6 @@ void CreateDestroyMouseRegionsForMilitiaControlMenu( void ) INT32 iFontHeight = 0; INT32 iBoxXPosition = 0; INT32 iBoxYPosition = 0; - SOLDIERTYPE *pSoldier = NULL; SGPPoint pPosition; INT32 iBoxWidth = 0; SGPRect pDimensions; @@ -1019,7 +1021,7 @@ void HandleShadingOfLinesForMilitiaControlMenu( void ) if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { // Check LOS! - if ( SoldierTo3DLocationLineOfSightTest( pSoldier, pTMilitiaSoldier->sGridNo, pTMilitiaSoldier->bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) + if ( SoldierTo3DLocationLineOfSightTest( pSoldier, pTMilitiaSoldier->sGridNo, pTMilitiaSoldier->pathing.bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) { UnShadeStringInBox( ghMilitiaControlBox, MILCON_MENU_ATTACK ); UnShadeStringInBox( ghMilitiaControlBox, MILCON_MENU_HOLD ); @@ -1213,12 +1215,12 @@ BOOLEAN CheckIfRadioIsEquipped( void ) //// stand up! //pSoldier->bAction = AI_ACTION_CHANGE_STANCE; -//pSoldier->usActionData = ANIM_STAND; +//pSoldier->aiData.usActionData = ANIM_STAND; // // //pSoldier->bAction = pSoldier->bNextAction; -//pSoldier->usActionData = pSoldier->usNextActionData; +//pSoldier->aiData.usActionData = pSoldier->usNextActionData; //pSoldier->bTargetLevel = pSoldier->bNextTargetLevel; //pSoldier->bNextAction = AI_ACTION_NONE; //pSoldier->usNextActionData = 0; @@ -1270,18 +1272,18 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) { case( MILCON_MENU_ATTACK ): { - if ( (pTMilitiaSoldier->bActive) && (pTMilitiaSoldier->bInSector) && (pTMilitiaSoldier->bLife >= OKLIFE) ) + if ( (pTMilitiaSoldier->bActive) && (pTMilitiaSoldier->bInSector) && (pTMilitiaSoldier->stats.bLife >= OKLIFE) ) { // Attack !!! - pTMilitiaSoldier->bOrders = SEEKENEMY; - pTMilitiaSoldier->bAttitude = AGGRESSIVE; + pTMilitiaSoldier->aiData.bOrders = SEEKENEMY; + pTMilitiaSoldier->aiData.bAttitude = AGGRESSIVE; pTMilitiaSoldier->usUIMovementMode = RUNNING; if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { //ubVolume = CalcScreamVolume( pSoldier, 10 ); - MakeNoise( pSoldier->ubID, pSoldier->sGridNo, pSoldier->bLevel, pSoldier->bOverTerrainType, ubVolume, NOISE_SCREAM); + MakeNoise( pSoldier->ubID, pSoldier->sGridNo, pSoldier->pathing.bLevel, pSoldier->bOverTerrainType, ubVolume, NOISE_SCREAM); } } @@ -1303,11 +1305,11 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) case( MILCON_MENU_HOLD ): { - if ( (pTMilitiaSoldier->bActive) && (pTMilitiaSoldier->bInSector) && (pTMilitiaSoldier->bLife >= OKLIFE) ) + if ( (pTMilitiaSoldier->bActive) && (pTMilitiaSoldier->bInSector) && (pTMilitiaSoldier->stats.bLife >= OKLIFE) ) { //Hold Position !!! //ScreenMsg( FONT_WHITE, MSG_INTERFACE, L"Hold Position" ); - pTMilitiaSoldier->bOrders = STATIONARY; + pTMilitiaSoldier->aiData.bOrders = STATIONARY; //pTMilitiaSoldier->bAttitude = DEFENSIVE; } @@ -1329,27 +1331,27 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) case( MILCON_MENU_RETREAT ): { - if ( (pTMilitiaSoldier->bActive) && (pTMilitiaSoldier->bInSector) && (pTMilitiaSoldier->bLife >= OKLIFE) ) + if ( (pTMilitiaSoldier->bActive) && (pTMilitiaSoldier->bInSector) && (pTMilitiaSoldier->stats.bLife >= OKLIFE) ) { INT16 sActionGridNo; - pTMilitiaSoldier->bOrders = FARPATROL; - pTMilitiaSoldier->bAttitude = DEFENSIVE; + pTMilitiaSoldier->aiData.bOrders = FARPATROL; + pTMilitiaSoldier->aiData.bAttitude = DEFENSIVE; pTMilitiaSoldier->usUIMovementMode = RUNNING; // set up next action to run away sActionGridNo = FindSpotMaxDistFromOpponents( pTMilitiaSoldier ); - pTMilitiaSoldier->usNextActionData = sActionGridNo; + pTMilitiaSoldier->aiData.usNextActionData = sActionGridNo; - if ( pTMilitiaSoldier->usNextActionData != NOWHERE ) + if ( pTMilitiaSoldier->aiData.usNextActionData != NOWHERE ) { - pTMilitiaSoldier->bNextAction = AI_ACTION_RUN_AWAY; - pTMilitiaSoldier->usActionData = ANIM_STAND; + pTMilitiaSoldier->aiData.bNextAction = AI_ACTION_RUN_AWAY; + pTMilitiaSoldier->aiData.usActionData = ANIM_STAND; // SEND PENDING ACTION - pTMilitiaSoldier->sPendingActionData2 = sActionGridNo; - pTMilitiaSoldier->ubPendingActionAnimCount = 0; + pTMilitiaSoldier->aiData.sPendingActionData2 = sActionGridNo; + pTMilitiaSoldier->aiData.ubPendingActionAnimCount = 0; } if ( pTMilitiaSoldier->sGridNo != sActionGridNo ) @@ -1376,7 +1378,7 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) case( MILCON_MENU_COMETOME ): { - if ( (pTMilitiaSoldier->bActive) && (pTMilitiaSoldier->bInSector) && (pTMilitiaSoldier->bLife >= OKLIFE) ) + if ( (pTMilitiaSoldier->bActive) && (pTMilitiaSoldier->bInSector) && (pTMilitiaSoldier->stats.bLife >= OKLIFE) ) { INT16 sActionGridNo, sGridNo, sAdjustedGridNo; UINT8 ubDirection; @@ -1392,9 +1394,9 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) { // SEND PENDING ACTION //pTMilitiaSoldier->ubPendingAction = MERC_STEAL; - pTMilitiaSoldier->sPendingActionData2 = pSoldier->sGridNo; + pTMilitiaSoldier->aiData.sPendingActionData2 = pSoldier->sGridNo; //pTMilitiaSoldier->bPendingActionData3 = ubDirection; - pTMilitiaSoldier->ubPendingActionAnimCount = 0; + pTMilitiaSoldier->aiData.ubPendingActionAnimCount = 0; pTMilitiaSoldier->usUIMovementMode = RUNNING; // CHECK IF WE ARE AT THIS GRIDNO NOW @@ -1425,7 +1427,7 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) case( MILCON_MENU_GETDOWN ): { - if ( (pTMilitiaSoldier->bActive) && (pTMilitiaSoldier->bInSector) && (pTMilitiaSoldier->bLife >= OKLIFE) ) + if ( (pTMilitiaSoldier->bActive) && (pTMilitiaSoldier->bInSector) && (pTMilitiaSoldier->stats.bLife >= OKLIFE) ) { //if ( SoldierCanAffordNewStance( pTeamSoldier, ANIM_PRONE ) ) { @@ -1453,18 +1455,18 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) case( MILCON_MENU_TAKE_COVER ): { - if ( (pTMilitiaSoldier->bActive) && (pTMilitiaSoldier->bInSector) && (pTMilitiaSoldier->bLife >= OKLIFE) ) + if ( (pTMilitiaSoldier->bActive) && (pTMilitiaSoldier->bInSector) && (pTMilitiaSoldier->stats.bLife >= OKLIFE) ) { INT16 sActionGridNo; INT32 iDummy; - sActionGridNo = FindBestNearbyCover(pTMilitiaSoldier,pTMilitiaSoldier->bAIMorale,&iDummy); + sActionGridNo = FindBestNearbyCover(pTMilitiaSoldier,pTMilitiaSoldier->aiData.bAIMorale,&iDummy); if ( sActionGridNo != NOWHERE ) { // SEND PENDING ACTION - pTMilitiaSoldier->sPendingActionData2 = sActionGridNo; - pTMilitiaSoldier->ubPendingActionAnimCount = 0; + pTMilitiaSoldier->aiData.sPendingActionData2 = sActionGridNo; + pTMilitiaSoldier->aiData.ubPendingActionAnimCount = 0; pTMilitiaSoldier->usUIMovementMode = RUNNING; // CHECK IF WE ARE AT THIS GRIDNO NOW @@ -1501,10 +1503,10 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++, pTeamSoldier++) { - if ( (pTeamSoldier->bActive) && (pTeamSoldier->bInSector) && (pTeamSoldier->bLife >= OKLIFE) ) + if ( (pTeamSoldier->bActive) && (pTeamSoldier->bInSector) && (pTeamSoldier->stats.bLife >= OKLIFE) ) { - pTeamSoldier->bOrders = SEEKENEMY; - pTeamSoldier->bAttitude = AGGRESSIVE; + pTeamSoldier->aiData.bOrders = SEEKENEMY; + pTeamSoldier->aiData.bAttitude = AGGRESSIVE; pTeamSoldier->usUIMovementMode = RUNNING; } } @@ -1534,10 +1536,10 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++, pTeamSoldier++) { - if ( (pTeamSoldier->bActive) && (pTeamSoldier->bInSector) && (pTeamSoldier->bLife >= OKLIFE) ) + if ( (pTeamSoldier->bActive) && (pTeamSoldier->bInSector) && (pTeamSoldier->stats.bLife >= OKLIFE) ) { - pTeamSoldier->bOrders = STATIONARY; - pTeamSoldier->bAttitude = DEFENSIVE; + pTeamSoldier->aiData.bOrders = STATIONARY; + pTeamSoldier->aiData.bAttitude = DEFENSIVE; } } @@ -1567,10 +1569,10 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++, pTeamSoldier++) { - if ( (pTeamSoldier->bActive) && (pTeamSoldier->bInSector) && (pTeamSoldier->bLife >= OKLIFE) ) + if ( (pTeamSoldier->bActive) && (pTeamSoldier->bInSector) && (pTeamSoldier->stats.bLife >= OKLIFE) ) { - pTeamSoldier->bOrders = FARPATROL; - pTeamSoldier->bAttitude = DEFENSIVE; + pTeamSoldier->aiData.bOrders = FARPATROL; + pTeamSoldier->aiData.bAttitude = DEFENSIVE; pTeamSoldier->usUIMovementMode = RUNNING; //// set up next action to run away @@ -1585,16 +1587,16 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) // set up next action to run away sActionGridNo = FindSpotMaxDistFromOpponents( pTeamSoldier ); - pTeamSoldier->usNextActionData = sActionGridNo; + pTeamSoldier->aiData.usNextActionData = sActionGridNo; - if ( pTeamSoldier->usNextActionData != NOWHERE ) + if ( pTeamSoldier->aiData.usNextActionData != NOWHERE ) { - pTeamSoldier->bNextAction = AI_ACTION_RUN_AWAY; - pTeamSoldier->usActionData = ANIM_STAND; + pTeamSoldier->aiData.bNextAction = AI_ACTION_RUN_AWAY; + pTeamSoldier->aiData.usActionData = ANIM_STAND; // SEND PENDING ACTION - pTeamSoldier->sPendingActionData2 = sActionGridNo; - pTeamSoldier->ubPendingActionAnimCount = 0; + pTeamSoldier->aiData.sPendingActionData2 = sActionGridNo; + pTeamSoldier->aiData.ubPendingActionAnimCount = 0; } if ( pTeamSoldier->sGridNo != sActionGridNo ) @@ -1630,7 +1632,7 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++, pTeamSoldier++) { - if ( (pTeamSoldier->bActive) && (pTeamSoldier->bInSector) && (pTeamSoldier->bLife >= OKLIFE) ) + if ( (pTeamSoldier->bActive) && (pTeamSoldier->bInSector) && (pTeamSoldier->stats.bLife >= OKLIFE) ) { if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { @@ -1642,9 +1644,9 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) if ( sActionGridNo != -1 ) { // SEND PENDING ACTION - pTeamSoldier->sPendingActionData2 = pSoldier->sGridNo; + pTeamSoldier->aiData.sPendingActionData2 = pSoldier->sGridNo; //pTeamSoldier->bPendingActionData3 = ubDirection; - pTeamSoldier->ubPendingActionAnimCount = 0; + pTeamSoldier->aiData.ubPendingActionAnimCount = 0; pTeamSoldier->usUIMovementMode = RUNNING; // CHECK IF WE ARE AT THIS GRIDNO NOW @@ -1685,7 +1687,7 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++, pTeamSoldier++) { - if ( (pTeamSoldier->bActive) && (pTeamSoldier->bInSector) && (pTeamSoldier->bLife >= OKLIFE) ) + if ( (pTeamSoldier->bActive) && (pTeamSoldier->bInSector) && (pTeamSoldier->stats.bLife >= OKLIFE) ) { // See if we can get there @@ -1693,9 +1695,9 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) if ( sActionGridNo != -1 ) { // SEND PENDING ACTION - pTeamSoldier->sPendingActionData2 = sActionGridNo; + pTeamSoldier->aiData.sPendingActionData2 = sActionGridNo; //pTeamSoldier->bPendingActionData3 = ubDirection; - pTeamSoldier->ubPendingActionAnimCount = 0; + pTeamSoldier->aiData.ubPendingActionAnimCount = 0; pTeamSoldier->usUIMovementMode = RUNNING; // CHECK IF WE ARE AT THIS GRIDNO NOW @@ -1736,7 +1738,7 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++, pTeamSoldier++) { - if ( (pTeamSoldier->bActive) && (pTeamSoldier->bInSector) && (pTeamSoldier->bLife >= OKLIFE) ) + if ( (pTeamSoldier->bActive) && (pTeamSoldier->bInSector) && (pTeamSoldier->stats.bLife >= OKLIFE) ) { //if ( SoldierCanAffordNewStance( pTeamSoldier, ANIM_PRONE ) ) { @@ -1774,7 +1776,7 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) //for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++, pTeamSoldier++) //{ - // if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bLife > 0 ) + // if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->stats.bLife > 0 ) // { // pTeamSoldier->usActionData = FindBestNearbyCover(pTeamSoldier,pTeamSoldier->bAIMorale,&iDummy); // @@ -1798,17 +1800,17 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++, pTeamSoldier++) { - if ( (pTeamSoldier->bActive) && (pTeamSoldier->bInSector) && (pTeamSoldier->bLife >= OKLIFE) ) + if ( (pTeamSoldier->bActive) && (pTeamSoldier->bInSector) && (pTeamSoldier->stats.bLife >= OKLIFE) ) { // See if we can get there - sActionGridNo = FindBestNearbyCover(pTeamSoldier,pTeamSoldier->bAIMorale,&iDummy); + sActionGridNo = FindBestNearbyCover(pTeamSoldier,pTeamSoldier->aiData.bAIMorale,&iDummy); if ( sActionGridNo != NOWHERE ) { // SEND PENDING ACTION - pTeamSoldier->sPendingActionData2 = sActionGridNo; + pTeamSoldier->aiData.sPendingActionData2 = sActionGridNo; //pTeamSoldier->bPendingActionData3 = ubDirection; - pTeamSoldier->ubPendingActionAnimCount = 0; + pTeamSoldier->aiData.ubPendingActionAnimCount = 0; pTeamSoldier->usUIMovementMode = RUNNING; // CHECK IF WE ARE AT THIS GRIDNO NOW @@ -1848,7 +1850,7 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) // for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++, pTeamSoldier++) // { - // if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bLife > 0 ) + // if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->stats.bLife > 0 ) // { // //CREATURE_IMMOBILE = 2 @@ -2254,7 +2256,7 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) // // for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++, pTeamSoldier++) // { -// if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bLife > 0 ) +// if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->stats.bLife > 0 ) // { // // if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) @@ -2270,7 +2272,7 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) // //pTMilitiaSoldier->ubPendingAction = MERC_STEAL; // pTeamSoldier->sPendingActionData2 = pSoldier->sGridNo; // pTeamSoldier->bPendingActionData3 = ubDirection; -// pTeamSoldier->ubPendingActionAnimCount = 0; +// pTeamSoldier->aiData.ubPendingActionAnimCount = 0; // // // CHECK IF WE ARE AT THIS GRIDNO NOW // if ( pTeamSoldier->sGridNo != sActionGridNo ) diff --git a/Tactical/Morale.cpp b/Tactical/Morale.cpp index 6824d046..ada0dd7b 100644 --- a/Tactical/Morale.cpp +++ b/Tactical/Morale.cpp @@ -33,7 +33,7 @@ // macros -#define SOLDIER_IN_SECTOR( pSoldier, sX, sY, bZ ) ( !pSoldier->fBetweenSectors && ( pSoldier->sSectorX == sX ) && ( pSoldier->sSectorY == sY ) && ( pSoldier->bSectorZ == bZ ) ) +#define SOLDIER_IN_SECTOR( pSoldier, sX, sY, bZ ) ( !pSoldier->flags.fBetweenSectors && ( pSoldier->sSectorX == sX ) && ( pSoldier->sSectorY == sY ) && ( pSoldier->bSectorZ == bZ ) ) @@ -41,7 +41,7 @@ MoraleEvent gbMoraleEvent[NUM_MORALE_EVENTS] = { // TACTICAL = Short Term Effect, STRATEGIC = Long Term Effect { TACTICAL_MORALE_EVENT, +4}, // MORALE_KILLED_ENEMY - { TACTICAL_MORALE_EVENT, -5}, // MORALE_SQUADMATE_DIED, // in same sector (not really squad)... IN ADDITION to strategic loss of morale + { TACTICAL_MORALE_EVENT, -5}, // MORALE_SQUADMATE_DIED, // in same sector (not really squad)... IN ADDITION to strategic loss of morale { TACTICAL_MORALE_EVENT, -1}, // MORALE_SUPPRESSED, // up to 4 times per turn { TACTICAL_MORALE_EVENT, -2}, // MORALE_AIRSTRIKE, { TACTICAL_MORALE_EVENT, +2}, // MORALE_DID_LOTS_OF_DAMAGE, @@ -57,24 +57,24 @@ MoraleEvent gbMoraleEvent[NUM_MORALE_EVENTS] = { STRATEGIC_MORALE_EVENT, -8}, // MORALE_MINE_LOST, { STRATEGIC_MORALE_EVENT, +3}, // MORALE_SAM_SITE_LIBERATED, { STRATEGIC_MORALE_EVENT, -3}, // MORALE_SAM_SITE_LOST, - { STRATEGIC_MORALE_EVENT, -15}, // MORALE_BUDDY_DIED, + { STRATEGIC_MORALE_EVENT, -15}, // MORALE_BUDDY_DIED, { STRATEGIC_MORALE_EVENT, +5}, // MORALE_HATED_DIED, { STRATEGIC_MORALE_EVENT, -5}, // MORALE_TEAMMATE_DIED, // not in same sector { STRATEGIC_MORALE_EVENT, +5}, // MORALE_LOW_DEATHRATE, { STRATEGIC_MORALE_EVENT, -5}, // MORALE_HIGH_DEATHRATE, { STRATEGIC_MORALE_EVENT, +2}, // MORALE_GREAT_MORALE, { STRATEGIC_MORALE_EVENT, -2}, // MORALE_POOR_MORALE, - { TACTICAL_MORALE_EVENT, -10}, // MORALE_DRUGS_CRASH - { TACTICAL_MORALE_EVENT, -10}, // MORALE_ALCOHOL_CRASH - { STRATEGIC_MORALE_EVENT, +15}, // MORALE_MONSTER_QUEEN_KILLED - { STRATEGIC_MORALE_EVENT, +25}, // MORALE_DEIDRANNA_KILLED + { TACTICAL_MORALE_EVENT, -10}, // MORALE_DRUGS_CRASH + { TACTICAL_MORALE_EVENT, -10}, // MORALE_ALCOHOL_CRASH + { STRATEGIC_MORALE_EVENT, +15}, // MORALE_MONSTER_QUEEN_KILLED + { STRATEGIC_MORALE_EVENT, +25}, // MORALE_DEIDRANNA_KILLED { TACTICAL_MORALE_EVENT, -1}, // MORALE_CLAUSTROPHOBE_UNDERGROUND, { TACTICAL_MORALE_EVENT, -5}, // MORALE_INSECT_PHOBIC_SEES_CREATURE, { TACTICAL_MORALE_EVENT, -1}, // MORALE_NERVOUS_ALONE, - { STRATEGIC_MORALE_EVENT, -5}, // MORALE_MERC_CAPTURED, + { STRATEGIC_MORALE_EVENT, -5}, // MORALE_MERC_CAPTURED, { STRATEGIC_MORALE_EVENT, -5}, // MORALE_MERC_MARRIED, { STRATEGIC_MORALE_EVENT, +8}, // MORALE_QUEEN_BATTLE_WON, - { STRATEGIC_MORALE_EVENT, +5}, // MORALE_SEX, + { STRATEGIC_MORALE_EVENT, +5}, // MORALE_SEX, }; BOOLEAN gfSomeoneSaidMoraleQuote = FALSE; @@ -82,23 +82,23 @@ BOOLEAN gfSomeoneSaidMoraleQuote = FALSE; INT8 GetMoraleModifier( SOLDIERTYPE * pSoldier ) { - if (pSoldier->uiStatusFlags & SOLDIER_PC) + if (pSoldier->flags.uiStatusFlags & SOLDIER_PC) { - if (pSoldier->bMorale > 50) + if (pSoldier->aiData.bMorale > 50) { // give +1 at 55, +3 at 65, up to +5 at 95 and above - return( (pSoldier->bMorale - 45) / 10 ); + return( (pSoldier->aiData.bMorale - 45) / 10 ); } else { // give penalties down to -20 at 0 (-2 at 45, -4 by 40...) - return( (pSoldier->bMorale - 50) * 2 / 5 ); + return( (pSoldier->aiData.bMorale - 50) * 2 / 5 ); } } else { // use AI morale - switch( pSoldier->bAIMorale ) + switch( pSoldier->aiData.bAIMorale ) { case MORALE_HOPELESS: return( -15 ); @@ -118,16 +118,16 @@ INT8 GetMoraleModifier( SOLDIERTYPE * pSoldier ) void DecayTacticalMorale( SOLDIERTYPE * pSoldier ) { // decay the tactical morale modifier - if (pSoldier->bTacticalMoraleMod != 0) + if (pSoldier->aiData.bTacticalMoraleMod != 0) { // decay the modifier! - if (pSoldier->bTacticalMoraleMod > 0) + if (pSoldier->aiData.bTacticalMoraleMod > 0) { - pSoldier->bTacticalMoraleMod = __max( 0, pSoldier->bTacticalMoraleMod - (8 - pSoldier->bTacticalMoraleMod / 10) ); + pSoldier->aiData.bTacticalMoraleMod = __max( 0, pSoldier->aiData.bTacticalMoraleMod - (8 - pSoldier->aiData.bTacticalMoraleMod / 10) ); } else { - pSoldier->bTacticalMoraleMod = __min( 0, pSoldier->bTacticalMoraleMod + (6 + pSoldier->bTacticalMoraleMod / 10) ); + pSoldier->aiData.bTacticalMoraleMod = __min( 0, pSoldier->aiData.bTacticalMoraleMod + (6 + pSoldier->aiData.bTacticalMoraleMod / 10) ); } } } @@ -135,13 +135,13 @@ void DecayTacticalMorale( SOLDIERTYPE * pSoldier ) void DecayStrategicMorale( SOLDIERTYPE * pSoldier ) { // decay the modifier! - if (pSoldier->bStrategicMoraleMod > 0) + if (pSoldier->aiData.bStrategicMoraleMod > 0) { - pSoldier->bStrategicMoraleMod = __max( 0, pSoldier->bStrategicMoraleMod - (8 - pSoldier->bStrategicMoraleMod / 10) ); + pSoldier->aiData.bStrategicMoraleMod = __max( 0, pSoldier->aiData.bStrategicMoraleMod - (8 - pSoldier->aiData.bStrategicMoraleMod / 10) ); } else { - pSoldier->bStrategicMoraleMod = __min( 0, pSoldier->bStrategicMoraleMod + (6 + pSoldier->bStrategicMoraleMod / 10) ); + pSoldier->aiData.bStrategicMoraleMod = __min( 0, pSoldier->aiData.bStrategicMoraleMod + (6 + pSoldier->aiData.bStrategicMoraleMod / 10) ); } } @@ -153,15 +153,15 @@ void DecayTacticalMoraleModifiers( void ) ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; for ( pSoldier = MercPtrs[ ubLoop ]; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++, pSoldier++ ) - { + { //if the merc is active, in Arulco // CJC: decay modifiers while asleep! or POW! - if ( pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && + if ( pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && !(pSoldier->bAssignment == IN_TRANSIT || pSoldier->bAssignment == ASSIGNMENT_DEAD ) ) { // only let morale mod decay if it is positive while merc is a POW - if ( pSoldier->bAssignment == ASSIGNMENT_POW && pSoldier->bTacticalMoraleMod < 0 ) + if ( pSoldier->bAssignment == ASSIGNMENT_POW && pSoldier->aiData.bTacticalMoraleMod < 0 ) { continue; } @@ -170,9 +170,9 @@ void DecayTacticalMoraleModifiers( void ) { case CLAUSTROPHOBIC: if ( pSoldier->bSectorZ > 0 ) - { + { // underground, no recovery... in fact, if tact morale is high, decay - if ( pSoldier->bTacticalMoraleMod > PHOBIC_LIMIT ) + if ( pSoldier->aiData.bTacticalMoraleMod > PHOBIC_LIMIT ) { HandleMoraleEvent( pSoldier, MORALE_CLAUSTROPHOBE_UNDERGROUND, pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ); } @@ -180,7 +180,7 @@ void DecayTacticalMoraleModifiers( void ) } break; case NERVOUS: - if ( pSoldier->bMorale < 50 ) + if ( pSoldier->aiData.bMorale < 50 ) { if (pSoldier->ubGroupID != 0 && PlayerIDGroupInMotion( pSoldier->ubGroupID )) { @@ -204,7 +204,7 @@ void DecayTacticalMoraleModifiers( void ) fHandleNervous = FALSE; } } - else + else { // look for anyone else in same sector fHandleNervous = TRUE; @@ -216,12 +216,12 @@ void DecayTacticalMoraleModifiers( void ) fHandleNervous = FALSE; break; } - } + } } if ( fHandleNervous ) { - if ( pSoldier->bTacticalMoraleMod == PHOBIC_LIMIT ) + if ( pSoldier->aiData.bTacticalMoraleMod == PHOBIC_LIMIT ) { // don't change morale continue; @@ -252,15 +252,15 @@ void DecayStrategicMoraleModifiers( void ) ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; for ( pSoldier = MercPtrs[ ubLoop ]; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++, pSoldier++ ) - { + { //if the merc is active, in Arulco // CJC: decay modifiers while asleep! or POW! - if ( pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && + if ( pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && !(pSoldier->bAssignment == IN_TRANSIT || pSoldier->bAssignment == ASSIGNMENT_DEAD ) ) { // only let morale mod decay if it is positive while merc is a POW - if ( pSoldier->bAssignment == ASSIGNMENT_POW && pSoldier->bStrategicMoraleMod < 0 ) + if ( pSoldier->bAssignment == ASSIGNMENT_POW && pSoldier->aiData.bStrategicMoraleMod < 0 ) { continue; } @@ -277,25 +277,25 @@ void RefreshSoldierMorale( SOLDIERTYPE * pSoldier ) { INT32 iActualMorale; - if ( pSoldier->fMercAsleep ) + if ( pSoldier->flags.fMercAsleep ) { // delay this till later! return; } // CJC, April 19, 1999: added up to 20% morale boost according to progress - iActualMorale = DEFAULT_MORALE + (INT32) pSoldier->bTeamMoraleMod + (INT32) pSoldier->bTacticalMoraleMod + (INT32) pSoldier->bStrategicMoraleMod + (INT32) (CurrentPlayerProgressPercentage() / 5); + iActualMorale = DEFAULT_MORALE + (INT32) pSoldier->aiData.bTeamMoraleMod + (INT32) pSoldier->aiData.bTacticalMoraleMod + (INT32) pSoldier->aiData.bStrategicMoraleMod + (INT32) (CurrentPlayerProgressPercentage() / 5); // ATE: Modify morale based on drugs.... - iActualMorale += ( ( pSoldier->bDrugEffect[ DRUG_TYPE_ADRENALINE ] * DRUG_EFFECT_MORALE_MOD ) / 100 ); - iActualMorale += ( ( pSoldier->bDrugEffect[ DRUG_TYPE_ALCOHOL ] * ALCOHOL_EFFECT_MORALE_MOD ) / 100 ); + iActualMorale += ( ( pSoldier->drugs.bDrugEffect[ DRUG_TYPE_ADRENALINE ] * DRUG_EFFECT_MORALE_MOD ) / 100 ); + iActualMorale += ( ( pSoldier->drugs.bDrugEffect[ DRUG_TYPE_ALCOHOL ] * ALCOHOL_EFFECT_MORALE_MOD ) / 100 ); iActualMorale = __min( 100, iActualMorale ); iActualMorale = __max( 0, iActualMorale ); - pSoldier->bMorale = (INT8) iActualMorale; + pSoldier->aiData.bMorale = (INT8) iActualMorale; // update mapscreen as needed - fCharacterInfoPanelDirty = TRUE; + fCharacterInfoPanelDirty = TRUE; } @@ -304,15 +304,15 @@ void UpdateSoldierMorale( SOLDIERTYPE * pSoldier, UINT8 ubType, INT8 bMoraleMod MERCPROFILESTRUCT * pProfile; INT32 iMoraleModTotal; - if ( !pSoldier->bActive || ( pSoldier->bLife < CONSCIOUSNESS ) || - ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) || AM_A_ROBOT( pSoldier ) || AM_AN_EPC( pSoldier ) ) + if ( !pSoldier->bActive || ( pSoldier->stats.bLife < CONSCIOUSNESS ) || + ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) || AM_A_ROBOT( pSoldier ) || AM_AN_EPC( pSoldier ) ) { return; } if ( ( pSoldier->bAssignment == ASSIGNMENT_DEAD ) || - ( pSoldier->bAssignment == ASSIGNMENT_POW ) || - ( pSoldier->bAssignment == IN_TRANSIT ) ) + ( pSoldier->bAssignment == ASSIGNMENT_POW ) || + ( pSoldier->bAssignment == IN_TRANSIT ) ) { return; } @@ -360,11 +360,11 @@ void UpdateSoldierMorale( SOLDIERTYPE * pSoldier, UINT8 ubType, INT8 bMoraleMod default: break; } - if (pSoldier->bLevel == 1) + if (pSoldier->pathing.bLevel == 1) { bMoraleMod--; } - else if (pSoldier->bLevel > 5) + else if (pSoldier->pathing.bLevel > 5) { bMoraleMod++; } @@ -377,10 +377,10 @@ void UpdateSoldierMorale( SOLDIERTYPE * pSoldier, UINT8 ubType, INT8 bMoraleMod // apply change! if (ubType == TACTICAL_MORALE_EVENT) { - iMoraleModTotal = (INT32) pSoldier->bTacticalMoraleMod + (INT32) bMoraleMod; + iMoraleModTotal = (INT32) pSoldier->aiData.bTacticalMoraleMod + (INT32) bMoraleMod; iMoraleModTotal = __min( iMoraleModTotal, MORALE_MOD_MAX ); iMoraleModTotal = __max( iMoraleModTotal, -MORALE_MOD_MAX ); - pSoldier->bTacticalMoraleMod = (INT8) iMoraleModTotal; + pSoldier->aiData.bTacticalMoraleMod = (INT8) iMoraleModTotal; } else if ( gTacticalStatus.fEnemyInSector && !pSoldier->bInSector ) // delayed strategic { @@ -390,21 +390,21 @@ void UpdateSoldierMorale( SOLDIERTYPE * pSoldier, UINT8 ubType, INT8 bMoraleMod pSoldier->bDelayedStrategicMoraleMod = (INT8) iMoraleModTotal; } else // strategic - { - iMoraleModTotal = (INT32) pSoldier->bStrategicMoraleMod + (INT32) bMoraleMod; + { + iMoraleModTotal = (INT32) pSoldier->aiData.bStrategicMoraleMod + (INT32) bMoraleMod; iMoraleModTotal = __min( iMoraleModTotal, MORALE_MOD_MAX ); iMoraleModTotal = __max( iMoraleModTotal, -MORALE_MOD_MAX ); - pSoldier->bStrategicMoraleMod = (INT8) iMoraleModTotal; + pSoldier->aiData.bStrategicMoraleMod = (INT8) iMoraleModTotal; } RefreshSoldierMorale( pSoldier ); - if ( !pSoldier->fMercAsleep ) + if ( !pSoldier->flags.fMercAsleep ) { if ( !gfSomeoneSaidMoraleQuote ) { // Check if we're below a certain value and warn - if ( pSoldier->bMorale < 35 ) + if ( pSoldier->aiData.bMorale < 35 ) { // Have we said this quote yet? if ( !( pSoldier->usQuoteSaidFlags & SOLDIER_QUOTE_SAID_LOW_MORAL ) ) @@ -412,7 +412,7 @@ void UpdateSoldierMorale( SOLDIERTYPE * pSoldier, UINT8 ubType, INT8 bMoraleMod gfSomeoneSaidMoraleQuote = TRUE; // ATE: Amde it a DELAYED QUOTE - will be delayed by the dialogue Q until it's our turn... - DelayedTacticalCharacterDialogue( pSoldier, QUOTE_STARTING_TO_WHINE ); + DelayedTacticalCharacterDialogue( pSoldier, QUOTE_STARTING_TO_WHINE ); pSoldier->usQuoteSaidFlags |= SOLDIER_QUOTE_SAID_LOW_MORAL; } } @@ -420,7 +420,7 @@ void UpdateSoldierMorale( SOLDIERTYPE * pSoldier, UINT8 ubType, INT8 bMoraleMod } // Reset flag! - if ( pSoldier->bMorale > 65 ) + if ( pSoldier->aiData.bMorale > 65 ) { pSoldier->usQuoteSaidFlags &= (~SOLDIER_QUOTE_SAID_LOW_MORAL ); } @@ -476,7 +476,7 @@ void HandleMoraleEvent( SOLDIERTYPE *pSoldier, INT8 bMoraleEvent, INT16 sMapX, I // needs specific soldier! Assert( pSoldier ); // affects the soldier only, should be ignored if tactical morale mod is -20 or less - if ( pSoldier->bTacticalMoraleMod > PHOBIC_LIMIT ) + if ( pSoldier->aiData.bTacticalMoraleMod > PHOBIC_LIMIT ) { HandleMoraleEventForSoldier( pSoldier, bMoraleEvent ); } @@ -510,7 +510,7 @@ void HandleMoraleEvent( SOLDIERTYPE *pSoldier, INT8 bMoraleEvent, INT16 sMapX, I // CJC: adding to SOLDIER_IN_SECTOR check special stuff because the old sector values might // be appropriate (because in transit going out of that sector!) - if ( SOLDIER_IN_SECTOR( pTeamSoldier, sMapX, sMapY, bMapZ ) || ( pTeamSoldier->fBetweenSectors && ((pTeamSoldier->ubPrevSectorID % 16) + 1) == sMapX && ((pTeamSoldier->ubPrevSectorID / 16) + 1) == sMapY && ( pTeamSoldier->bSectorZ == bMapZ ) ) ) + if ( SOLDIER_IN_SECTOR( pTeamSoldier, sMapX, sMapY, bMapZ ) || ( pTeamSoldier->flags.fBetweenSectors && ((pTeamSoldier->ubPrevSectorID % 16) + 1) == sMapX && ((pTeamSoldier->ubPrevSectorID / 16) + 1) == sMapY && ( pTeamSoldier->bSectorZ == bMapZ ) ) ) { switch ( gMercProfiles[ pTeamSoldier->ubProfile ].bAttitude ) { @@ -595,7 +595,7 @@ void HandleMoraleEvent( SOLDIERTYPE *pSoldier, INT8 bMoraleEvent, INT16 sMapX, I for ( pTeamSoldier = MercPtrs[ ubLoop ]; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++, pTeamSoldier++ ) { if ( pTeamSoldier->bActive && pTeamSoldier->ubProfile != NO_PROFILE) - { + { pProfile = &(gMercProfiles[ pTeamSoldier->ubProfile ]); if (HATED_MERC( pProfile, pSoldier->ubProfile )) @@ -607,7 +607,7 @@ void HandleMoraleEvent( SOLDIERTYPE *pSoldier, INT8 bMoraleEvent, INT16 sMapX, I { if ( SOLDIER_IN_SECTOR( pTeamSoldier, sMapX, sMapY, bMapZ ) ) { - // mate died in my sector! tactical morale mod + // mate died in my sector! tactical morale mod HandleMoraleEventForSoldier( pTeamSoldier, MORALE_SQUADMATE_DIED ); } @@ -616,7 +616,7 @@ void HandleMoraleEvent( SOLDIERTYPE *pSoldier, INT8 bMoraleEvent, INT16 sMapX, I if (BUDDY_MERC( pProfile, pSoldier->ubProfile )) { - // oh no! buddy died! + // oh no! buddy died! HandleMoraleEventForSoldier( pTeamSoldier, MORALE_BUDDY_DIED ); } } @@ -627,7 +627,7 @@ void HandleMoraleEvent( SOLDIERTYPE *pSoldier, INT8 bMoraleEvent, INT16 sMapX, I case MORALE_MERC_MARRIED: // female mercs get unhappy based on how sexist they are (=hate men) // gentlemen males get unhappy too - + ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; for ( pTeamSoldier = MercPtrs[ ubLoop ]; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++, pTeamSoldier++ ) { @@ -666,14 +666,14 @@ void HandleMoraleEvent( SOLDIERTYPE *pSoldier, INT8 bMoraleEvent, INT16 sMapX, I break; } } - + } - } + } break; default: // debug message - ScreenMsg( MSG_FONT_RED, MSG_BETAVERSION, L"Invalid morale event type = %d. AM/CC-1", bMoraleEvent ); + ScreenMsg( MSG_FONT_RED, MSG_BETAVERSION, L"Invalid morale event type = %d. AM/CC-1", bMoraleEvent ); break; } @@ -708,11 +708,11 @@ void HandleMoraleEvent( SOLDIERTYPE *pSoldier, INT8 bMoraleEvent, INT16 sMapX, I break; case MORALE_TEAMMATE_DIED: // impact depends on that dude's level of experience - ModifyPlayerReputation((UINT8) (pSoldier->bExpLevel * REPUTATION_SOLDIER_DIED)); + ModifyPlayerReputation((UINT8) (pSoldier->stats.bExpLevel * REPUTATION_SOLDIER_DIED)); break; case MORALE_MERC_CAPTURED: // impact depends on that dude's level of experience - ModifyPlayerReputation((UINT8) (pSoldier->bExpLevel * REPUTATION_SOLDIER_CAPTURED)); + ModifyPlayerReputation((UINT8) (pSoldier->stats.bExpLevel * REPUTATION_SOLDIER_CAPTURED)); break; case MORALE_KILLED_CIVILIAN: ModifyPlayerReputation(REPUTATION_KILLED_CIVILIAN); @@ -753,12 +753,12 @@ void HourlyMoraleUpdate( void ) bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; // loop through all mercs to calculate their morale - for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; bMercID++,pSoldier++) - { + for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; bMercID++,pSoldier++) + { //if the merc is active, in Arulco, and conscious, not POW - if ( pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && + if ( pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && !(pSoldier->bAssignment == IN_TRANSIT || - pSoldier->fMercAsleep == TRUE || + pSoldier->flags.fMercAsleep == TRUE || pSoldier->bAssignment == ASSIGNMENT_DEAD || pSoldier->bAssignment == ASSIGNMENT_POW) ) { @@ -791,9 +791,9 @@ void HourlyMoraleUpdate( void ) // skip past ourselves and all inactive mercs if (bOtherID != bMercID && pOtherSoldier->bActive && pOtherSoldier->ubProfile != NO_PROFILE && !(pOtherSoldier->bAssignment == IN_TRANSIT || - pOtherSoldier->fMercAsleep == TRUE || - pOtherSoldier->bAssignment == ASSIGNMENT_DEAD || - pOtherSoldier->bAssignment == ASSIGNMENT_POW)) + pOtherSoldier->flags.fMercAsleep == TRUE || + pOtherSoldier->bAssignment == ASSIGNMENT_DEAD || + pOtherSoldier->bAssignment == ASSIGNMENT_POW)) { if (fSameGroupOnly) { @@ -807,12 +807,12 @@ void HourlyMoraleUpdate( void ) { // check to see if the location is the same if (pOtherSoldier->sSectorX != pSoldier->sSectorX || - pOtherSoldier->sSectorY != pSoldier->sSectorY || + pOtherSoldier->sSectorY != pSoldier->sSectorY || pOtherSoldier->bSectorZ != pSoldier->bSectorZ) { continue; } - + // if the OTHER soldier is in motion then we don't do anything! if (pOtherSoldier->ubGroupID != 0 && PlayerIDGroupInMotion( pOtherSoldier->ubGroupID )) { @@ -830,10 +830,10 @@ void HourlyMoraleUpdate( void ) fFoundHated = TRUE; break; } - else + else { // scale according to how close to we are to snapping - //KM : Divide by 0 error found. Wrapped into an if statement. + //KM : Divide by 0 error found. Wrapped into an if statement. if( pProfile->bHatedTime[ bHated ] ) { bOpinion = ((INT32) bOpinion) * (pProfile->bHatedTime[ bHated ] - pProfile->bHatedCount[ bHated ]) / pProfile->bHatedTime[ bHated ]; @@ -841,11 +841,11 @@ void HourlyMoraleUpdate( void ) if ( pProfile->bHatedCount[ bHated ] <= pProfile->bHatedTime[ bHated ] / 2 ) { - // Augh, we're teamed with someone we hate! We HATE this!! Ignore everyone else! + // Augh, we're teamed with someone we hate! We HATE this!! Ignore everyone else! fFoundHated = TRUE; break; } - // otherwise just mix this opinion in with everyone else... + // otherwise just mix this opinion in with everyone else... } } iTotalOpinions += bOpinion; @@ -886,7 +886,7 @@ void HourlyMoraleUpdate( void ) // shift morale from team by ~10% // this should range between -75 and +75 - bTeamMoraleModDiff = bActualTeamOpinion - pSoldier->bTeamMoraleMod; + bTeamMoraleModDiff = bActualTeamOpinion - pSoldier->aiData.bTeamMoraleMod; if (bTeamMoraleModDiff > 0) { bTeamMoraleModChange = 1 + bTeamMoraleModDiff / 10; @@ -899,18 +899,18 @@ void HourlyMoraleUpdate( void ) { bTeamMoraleModChange = 0; } - pSoldier->bTeamMoraleMod += bTeamMoraleModChange; - pSoldier->bTeamMoraleMod = __min( pSoldier->bTeamMoraleMod, MORALE_MOD_MAX ); - pSoldier->bTeamMoraleMod = __max( pSoldier->bTeamMoraleMod, -MORALE_MOD_MAX ); - + pSoldier->aiData.bTeamMoraleMod += bTeamMoraleModChange; + pSoldier->aiData.bTeamMoraleMod = __min( pSoldier->aiData.bTeamMoraleMod, MORALE_MOD_MAX ); + pSoldier->aiData.bTeamMoraleMod = __max( pSoldier->aiData.bTeamMoraleMod, -MORALE_MOD_MAX ); + // New, December 3rd, 1998, by CJC -- // If delayed strategic modifier exists then incorporate it in strategic mod if ( pSoldier->bDelayedStrategicMoraleMod ) { - pSoldier->bStrategicMoraleMod += pSoldier->bDelayedStrategicMoraleMod; + pSoldier->aiData.bStrategicMoraleMod += pSoldier->bDelayedStrategicMoraleMod; pSoldier->bDelayedStrategicMoraleMod = 0; - pSoldier->bStrategicMoraleMod = __min( pSoldier->bStrategicMoraleMod, MORALE_MOD_MAX ); - pSoldier->bStrategicMoraleMod = __max( pSoldier->bStrategicMoraleMod, -MORALE_MOD_MAX ); + pSoldier->aiData.bStrategicMoraleMod = __min( pSoldier->aiData.bStrategicMoraleMod, MORALE_MOD_MAX ); + pSoldier->aiData.bStrategicMoraleMod = __max( pSoldier->aiData.bStrategicMoraleMod, -MORALE_MOD_MAX ); } // refresh the morale value for the soldier based on the recalculated team modifier @@ -939,7 +939,7 @@ void DailyMoraleUpdate(SOLDIERTYPE *pSoldier) // CJC: made per hour now /* // decay the merc's strategic morale modifier - if (pSoldier->bStrategicMoraleMod != 0) + if (pSoldier->aiData.bStrategicMoraleMod != 0) { // decay the modifier! DecayStrategicMorale( pSoldier ); @@ -962,10 +962,10 @@ void DailyMoraleUpdate(SOLDIERTYPE *pSoldier) // too low, morale sinks further (merc's in a funk and things aren't getting better) HandleMoraleEvent( pSoldier, MORALE_POOR_MORALE, pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ); } - else if ( pSoldier->bMorale >= 75 ) + else if ( pSoldier->aiData.bMorale >= 75 ) { // very high morale, merc is cheerleading others HandleMoraleEvent( pSoldier, MORALE_GREAT_MORALE, pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ); } -} \ No newline at end of file +} diff --git a/Tactical/Overhead Types.h b/Tactical/Overhead Types.h index c460d46b..608dd80c 100644 --- a/Tactical/Overhead Types.h +++ b/Tactical/Overhead Types.h @@ -23,7 +23,7 @@ #define MIN_AMB_LEVEL_FOR_MERC_LIGHTS 9 -#define MAXTEAMS 6 +#define MAXTEAMS 6 #define MAXMERCS MAX_NUM_SOLDIERS //TACTICAL OVERHEAD STUFF @@ -37,7 +37,7 @@ // TACTICAL ENGINE STATUS FLAGS #define REALTIME 0x000000002 #define TURNBASED 0x000000004 -#define IN_ENDGAME_SEQUENCE 0x000000008 +#define IN_ENDGAME_SEQUENCE 0x000000008 #define SHOW_ALL_ITEMS 0x000000010 #define SHOW_AP_LEFT 0x000000020 #define SHOW_ALL_MERCS 0x000000040 @@ -48,7 +48,7 @@ #define NPC_TEAM_DEAD 0x000000800 #define DISALLOW_SIGHT 0x000001000 #define CHECK_SIGHT_AT_END_OF_ATTACK 0x000002000 -#define IN_CREATURE_LAIR 0x000004000 +#define IN_CREATURE_LAIR 0x000004000 #define HIDE_TREES 0x000008000 #define NOHIDE_REDUNDENCY 0x000010000 #define DEBUGCLIFFS 0x000020000 @@ -73,7 +73,7 @@ #define CONSCIOUSNESS 10 // VIEWRANGE DEFINES -#define NORMAL_VIEW_RANGE 13 +#define NORMAL_VIEW_RANGE 13 #define MIN_RANGE_FOR_BLOWNAWAY 40 // MODIFIERS FOR AP COST FOR MOVEMENT @@ -82,6 +82,12 @@ #define SWATCOST 0 #define CRAWLCOST 1 +// CHRISL: AP Cost Movement modifiers when wearing a backpack +#define RUNDIVISORBPACK 1.5 +#define WALKCOSTBPACK 0 +#define SWATCOSTBPACK 1 +#define CRAWLCOSTBPACK 2 + // defines // ###################################################### #define MAX_PATH_LIST_SIZE 30 @@ -94,26 +100,26 @@ #define FLASH_SELECTOR_DELAY 4000 #define BLINK_SELECTOR_DELAY 250 -#define PTR_OURTEAM (pSoldier->bTeam == gbPlayerNum) +#define PTR_OURTEAM (pSoldier->bTeam == gbPlayerNum) #define DONTLOOK 0 #define LOOK 1 -#define NOLOCATE 0 -#define LOCATE 1 +#define NOLOCATE 0 +#define LOCATE 1 #define DONTSETLOCATOR 0 #define SETLOCATOR 1 #define SETANDREMOVEPREVIOUSLOCATOR 2 #define SETLOCATORFAST 3 -#define NOCENTERING 0 +#define NOCENTERING 0 -#define NOUPDATE 0 -#define UPDATE 1 +#define NOUPDATE 0 +#define UPDATE 1 // ORDERS @@ -179,15 +185,15 @@ enum #define FIRE_WEAPON_BLINDED_AND_DEAFENED 11 -#define NO_INTERRUPTS 0 -#define ALLOW_INTERRUPTS 1 +#define NO_INTERRUPTS 0 +#define ALLOW_INTERRUPTS 1 -#define SIGHT_LOOK 0x1 -//#define SIGHT_SEND 0x2 // no longer needed using LOCAL OPPLISTs -#define SIGHT_RADIO 0x4 +#define SIGHT_LOOK 0x1 +//#define SIGHT_SEND 0x2 // no longer needed using LOCAL OPPLISTs +#define SIGHT_RADIO 0x4 #define SIGHT_INTERRUPT 0x8 -#define SIGHT_ALL 0xF +#define SIGHT_ALL 0xF // CHANGE THIS VALUE TO AFFECT TOTAL SIGHT RANGE @@ -204,27 +210,27 @@ enum #define BEHIND_RATIO 0 // looking distance defines -//#define BEHIND (INT8)( BEHIND_RATIO * STRAIGHT_RANGE ) -//#define SBEHIND (INT8)( SBEHIND_RATIO * STRAIGHT_RANGE ) -//#define SIDE (INT8)( SIDE_RATIO * STRAIGHT_RANGE ) -//#define ANGLE (INT8)( ANGLE_RATIO * STRAIGHT_RANGE ) -//#define STRAIGHT (INT8)( STRAIGHT_RATIO * STRAIGHT_RANGE ) +//#define BEHIND (INT8)( BEHIND_RATIO * STRAIGHT_RANGE ) +//#define SBEHIND (INT8)( SBEHIND_RATIO * STRAIGHT_RANGE ) +//#define SIDE (INT8)( SIDE_RATIO * STRAIGHT_RANGE ) +//#define ANGLE (INT8)( ANGLE_RATIO * STRAIGHT_RANGE ) +//#define STRAIGHT (INT8)( STRAIGHT_RATIO * STRAIGHT_RANGE ) // opplist value constants -#define HEARD_3_TURNS_AGO -4 -#define HEARD_2_TURNS_AGO -3 -#define HEARD_LAST_TURN -2 -#define HEARD_THIS_TURN -1 -#define NOT_HEARD_OR_SEEN 0 -#define SEEN_CURRENTLY 1 -#define SEEN_THIS_TURN 2 -#define SEEN_LAST_TURN 3 -#define SEEN_2_TURNS_AGO 4 -#define SEEN_3_TURNS_AGO 5 +#define HEARD_3_TURNS_AGO -4 +#define HEARD_2_TURNS_AGO -3 +#define HEARD_LAST_TURN -2 +#define HEARD_THIS_TURN -1 +#define NOT_HEARD_OR_SEEN 0 +#define SEEN_CURRENTLY 1 +#define SEEN_THIS_TURN 2 +#define SEEN_LAST_TURN 3 +#define SEEN_2_TURNS_AGO 4 +#define SEEN_3_TURNS_AGO 5 -#define OLDEST_SEEN_VALUE SEEN_3_TURNS_AGO -#define OLDEST_HEARD_VALUE HEARD_3_TURNS_AGO +#define OLDEST_SEEN_VALUE SEEN_3_TURNS_AGO +#define OLDEST_HEARD_VALUE HEARD_3_TURNS_AGO #define UNDER_FIRE 2 #define UNDER_FIRE_LAST_TURN 1 @@ -319,9 +325,9 @@ enum BoxingStates LOST_ROUND } ; -//NOTE: The editor uses these enumerations, so please update the text as well if you modify or -// add new groups. Try to abbreviate the team name as much as possible. The text is in -// EditorMercs.c +//NOTE: The editor uses these enumerations, so please update the text as well if you modify or +// add new groups. Try to abbreviate the team name as much as possible. The text is in +// EditorMercs.c #ifdef JA2EDITOR extern CHAR16 gszCivGroupNames[ NUM_CIV_GROUPS ][ 20 ]; #endif @@ -353,6 +359,6 @@ typedef struct // This will set an animation ID #define SET_PALETTEREP_ID( a, b ) ( strcpy( a, b ) ) // strcmp returns 0 if true! -#define COMPARE_PALETTEREP_ID( a, b ) ( strcmp( a, b ) ? FALSE : TRUE ) +#define COMPARE_PALETTEREP_ID( a, b ) ( strcmp( a, b ) ? FALSE : TRUE ) #endif diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index c45e28bc..d5bc4bcc 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -14,13 +14,13 @@ #include "worldman.h" #include "renderworld.h" #include "Assignments.h" -#include "Soldier Control.h" +//#include "Soldier Control.h" #include "Animation Control.h" #include "Animation Data.h" #include "Isometric Utils.h" #include "Event Pump.h" #include "Timer Control.h" -#include "Render Fun.h" +#include "Render Fun.h" #include "Render Dirty.h" #include "mousesystem.h" #include "interface.h" @@ -53,14 +53,14 @@ #include "Soldier macros.h" #include "EditorMercs.h" #include "soldier tile.h" -#ifdef NETWORKED +#ifdef NETWORKED #include "Networking.h" #include "NetworkEvent.h" #endif #include "structure wrap.h" #include "tile animation.h" #include "Strategic Merc Handler.h" -#include "strategic turns.h" +#include "strategic turns.h" #include "Squads.h" #include "Morale.h" #include "Campaign.h" @@ -114,11 +114,15 @@ #include "Lua Interpreter.h" #endif + +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + extern void HandleBestSightingPositionInRealtime(); extern UINT8 gubAICounter; - #define RT_DELAY_BETWEEN_AI_HANDLING 50 #define RT_AI_TIMESLICE 10 @@ -147,7 +151,7 @@ extern void HandleSystemNewAISituation( SOLDIERTYPE *pSoldier, BOOLEAN fResetABC extern BOOLEAN NPCInRoom( UINT8 ubProfileID, UINT8 ubRoomID ); -extern INT8 gbInvalidPlacementSlot[ NUM_INV_SLOTS ]; +extern INT8 gbInvalidPlacementSlot[ NUM_INV_SLOTS ]; void ResetAllMercSpeeds( ); @@ -174,21 +178,21 @@ extern void PlayStealthySoldierFootstepSound( SOLDIERTYPE *pSoldier ); extern BOOLEAN gfSurrendered; // GLOBALS -#define START_DEMO_SCENE 3 -#define NUM_RANDOM_SCENES 4 +#define START_DEMO_SCENE 3 +#define NUM_RANDOM_SCENES 4 CHAR8 gDebugStr[128]; #ifdef NETWORKED -extern BYTE gfAmIHost; -extern BOOLEAN gfAmINetworked; +extern BYTE gfAmIHost; +extern BOOLEAN gfAmINetworked; #endif #define NEW_FADE_DELAY 60 // ATE: GLOBALS FOR E3 -UINT8 gubCurrentScene = 0; -CHAR8 gzLevelFilenames[ ][ 50 ] = +UINT8 gubCurrentScene = 0; +CHAR8 gzLevelFilenames[ ][ 50 ] = { "A9.dat", "ScotTBMines.dat", @@ -201,7 +205,7 @@ CHAR8 gzLevelFilenames[ ][ 50 ] = }; -INT8 ubLevelMoveLink[ 10 ] = +INT8 ubLevelMoveLink[ 10 ] = { 1, 2, @@ -217,25 +221,25 @@ INT8 ubLevelMoveLink[ 10 ] = // Soldier List used for all soldier overhead interaction -SOLDIERTYPE Menptr[ TOTAL_SOLDIERS ]; -SOLDIERTYPE *MercPtrs[ TOTAL_SOLDIERS ]; +SOLDIERTYPE Menptr[ TOTAL_SOLDIERS ]; +SOLDIERTYPE *MercPtrs[ TOTAL_SOLDIERS ]; -SOLDIERTYPE *MercSlots[ TOTAL_SOLDIERS ]; -UINT32 guiNumMercSlots = 0; +SOLDIERTYPE *MercSlots[ TOTAL_SOLDIERS ]; +UINT32 guiNumMercSlots = 0; -SOLDIERTYPE *AwaySlots[ TOTAL_SOLDIERS ]; -UINT32 guiNumAwaySlots = 0; +SOLDIERTYPE *AwaySlots[ TOTAL_SOLDIERS ]; +UINT32 guiNumAwaySlots = 0; // DEF: changed to have client wait for gPlayerNum assigned from host -UINT8 gbPlayerNum = 0; +UINT8 gbPlayerNum = 0; // Global for current selected soldier UINT16 gusSelectedSoldier = NOBODY; -INT8 gbShowEnemies = FALSE; +INT8 gbShowEnemies = FALSE; -BOOLEAN gfMovingAnimation = FALSE; +BOOLEAN gfMovingAnimation = FALSE; -CHAR8 gzAlertStr[][ 30 ] = +CHAR8 gzAlertStr[][ 30 ] = { "GREEN", "YELLOW", @@ -243,7 +247,7 @@ CHAR8 gzAlertStr[][ 30 ] = "BLACK" }; -CHAR8 gzActionStr[][ 30 ] = +CHAR8 gzActionStr[][ 30 ] = { "NONE", @@ -307,7 +311,7 @@ CHAR8 gzActionStr[][ 30 ] = "RAISE GUN", }; -CHAR8 gzDirectionStr[][ 30 ] = +CHAR8 gzDirectionStr[][ 30 ] = { "NORTHEAST", "EAST", @@ -320,17 +324,17 @@ CHAR8 gzDirectionStr[][ 30 ] = }; // TEMP VALUES FOR TEAM DEAFULT POSITIONS -UINT8 bDefaultTeamRanges[ MAXTEAMS ][ 2 ] = +UINT8 bDefaultTeamRanges[ MAXTEAMS ][ 2 ] = { - 0, 19, //20 US - 20, 51, //32 ENEMY - 52, 83, //32 CREATURE - 84, 115, //32 REBELS ( OUR GUYS ) - 116, MAX_NUM_SOLDIERS - 1, //32 CIVILIANS - MAX_NUM_SOLDIERS, TOTAL_SOLDIERS - 1 // PLANNING SOLDIERS + 0, 19, //20 US + 20, 51, //32 ENEMY + 52, 83, //32 CREATURE + 84, 115, //32 REBELS ( OUR GUYS ) + 116, MAX_NUM_SOLDIERS - 1, //32 CIVILIANS + MAX_NUM_SOLDIERS, TOTAL_SOLDIERS - 1 // PLANNING SOLDIERS }; -COLORVAL bDefaultTeamColors[ MAXTEAMS ] = +COLORVAL bDefaultTeamColors[ MAXTEAMS ] = { FROMRGB( 255, 255, 0 ), FROMRGB( 255, 0, 0 ), @@ -349,7 +353,7 @@ UINT8 NumCapableEnemyInSector( ); BOOLEAN KillIncompacitatedEnemyInSector( ); BOOLEAN CheckForLosingEndOfBattle( ); -void EndBattleWithUnconsciousGuysCallback( UINT8 bExitValue ); +void EndBattleWithUnconsciousGuysCallback( UINT8 bExitValue ); UINT8 NumEnemyInSectorNotDeadOrDying( ); UINT8 NumBloodcatsInSectorNotDeadOrDying( ); @@ -398,9 +402,9 @@ void RecountMercSlots(void) } -INT32 AddMercSlot( SOLDIERTYPE *pSoldier ) +INT32 AddMercSlot( SOLDIERTYPE *pSoldier ) { - INT32 iMercIndex; + INT32 iMercIndex; if( ( iMercIndex = GetFreeMercSlot() )==(-1) ) return(-1); @@ -468,9 +472,9 @@ void RecountAwaySlots(void) } -INT32 AddAwaySlot( SOLDIERTYPE *pSoldier ) +INT32 AddAwaySlot( SOLDIERTYPE *pSoldier ) { - INT32 iAwayIndex; + INT32 iAwayIndex; if( ( iAwayIndex = GetFreeAwaySlot() )==(-1) ) return(-1); @@ -511,13 +515,13 @@ INT32 MoveSoldierFromMercToAwaySlot( SOLDIERTYPE * pSoldier ) return( -1 ); } - if ( !(pSoldier->uiStatusFlags & SOLDIER_OFF_MAP) ) + if ( !(pSoldier->flags.uiStatusFlags & SOLDIER_OFF_MAP) ) { RemoveManFromTeam( pSoldier->bTeam ); } pSoldier->bInSector = FALSE; - pSoldier->uiStatusFlags |= SOLDIER_OFF_MAP; + pSoldier->flags.uiStatusFlags |= SOLDIER_OFF_MAP; return( AddAwaySlot( pSoldier ) ); } @@ -535,7 +539,7 @@ INT32 MoveSoldierFromAwayToMercSlot( SOLDIERTYPE * pSoldier ) AddManToTeam( pSoldier->bTeam ); pSoldier->bInSector = TRUE; - pSoldier->uiStatusFlags &= (~SOLDIER_OFF_MAP); + pSoldier->flags.uiStatusFlags &= (~SOLDIER_OFF_MAP); return( AddMercSlot( pSoldier ) ); } @@ -551,7 +555,7 @@ BOOLEAN InitTacticalEngine( ) InitializeBaseDirtyRectQueue( ); // Init Interface stuff - InitializeTacticalInterface( ); + InitializeTacticalInterface( ); // Init system objects InitializeGameVideoObjects( ); @@ -578,7 +582,7 @@ BOOLEAN InitTacticalEngine( ) // Init Overhead if ( !InitOverhead( ) ) - { + { return( FALSE ); } @@ -609,8 +613,8 @@ BOOLEAN InitOverhead( ) UINT32 cnt; UINT8 cnt2; - memset( MercSlots, 0, sizeof( MercSlots ) ); - memset( AwaySlots, 0, sizeof( AwaySlots ) ); + //memset( MercSlots, 0, sizeof( MercSlots ) ); + //memset( AwaySlots, 0, sizeof( AwaySlots ) ); // Set pointers list for( cnt = 0; cnt < TOTAL_SOLDIERS; cnt++ ) @@ -626,7 +630,7 @@ BOOLEAN InitOverhead( ) { // For now, set hard-coded values gTacticalStatus.Team[ cnt ].bFirstID = bDefaultTeamRanges[ cnt ][0]; - gTacticalStatus.Team[ cnt ].bLastID = bDefaultTeamRanges[ cnt ][1]; + gTacticalStatus.Team[ cnt ].bLastID = bDefaultTeamRanges[ cnt ][1]; gTacticalStatus.Team[ cnt ].RadarColor = bDefaultTeamColors[ cnt ]; if ( cnt == gbPlayerNum || cnt == PLAYER_PLAN ) @@ -636,7 +640,7 @@ BOOLEAN InitOverhead( ) } else { - if (cnt == MILITIA_TEAM ) + if (cnt == MILITIA_TEAM ) { // militia guys on our side! gTacticalStatus.Team[ cnt ].bSide = 0; @@ -649,7 +653,7 @@ BOOLEAN InitOverhead( ) } else { - // hostile (enemies, or civilians; civs are potentially hostile but neutral) + // hostile (enemies, or civilians; civs are potentially hostile but neutral) gTacticalStatus.Team[ cnt ].bSide = 1; } gTacticalStatus.Team[ cnt ].bHuman = FALSE; @@ -667,27 +671,27 @@ BOOLEAN InitOverhead( ) } // Zero out merc slots! - for ( cnt = 0; cnt < TOTAL_SOLDIERS; cnt++ ) + for ( cnt = 0; cnt < TOTAL_SOLDIERS; cnt++ ) { MercSlots[ cnt ] = NULL; } // Set other tactical flags - gTacticalStatus.uiFlags = TURNBASED | TRANSLUCENCY_TYPE; + gTacticalStatus.uiFlags = TURNBASED | TRANSLUCENCY_TYPE; gTacticalStatus.sSlideTarget = NOWHERE; gTacticalStatus.uiTimeOfLastInput = GetJA2Clock(); gTacticalStatus.uiTimeSinceDemoOn = GetJA2Clock(); gTacticalStatus.uiCountdownToRestart = GetJA2Clock(); - gTacticalStatus.fGoingToEnterDemo = FALSE; - gTacticalStatus.fNOTDOLASTDEMO = FALSE; - gTacticalStatus.fDidGameJustStart = TRUE; + gTacticalStatus.fGoingToEnterDemo = FALSE; + gTacticalStatus.fNOTDOLASTDEMO = FALSE; + gTacticalStatus.fDidGameJustStart = TRUE; gTacticalStatus.ubLastRequesterTargetID = NO_PROFILE; for ( cnt = 0; cnt < NUM_PANIC_TRIGGERS; cnt++ ) { gTacticalStatus.sPanicTriggerGridNo[ cnt ] = NOWHERE; } - /* for ( cnt = 0; cnt < NUM_TOPTIONS; cnt++ ) + /* for ( cnt = 0; cnt < NUM_TOPTIONS; cnt++ ) { gGameSettings.fOptions[ cnt ] = 1; } @@ -695,7 +699,7 @@ BOOLEAN InitOverhead( ) gGameSettings.fOptions[ TOPTION_RTCONFIRM ] = 0; gGameSettings.fOptions[ TOPTION_HIDE_BULLETS ] = 0; */ - gTacticalStatus.bRealtimeSpeed = MAX_REALTIME_SPEED_VAL / 2; + gTacticalStatus.bRealtimeSpeed = MAX_REALTIME_SPEED_VAL / 2; gfInAirRaid = FALSE; gpCustomizableTimerCallback = NULL; @@ -727,7 +731,7 @@ BOOLEAN ShutdownOverhead( ) { if ( MercPtrs[ cnt ]->bActive ) { - DeleteSoldier( MercPtrs[ cnt ] ); + MercPtrs[ cnt ]->DeleteSoldier( ); } } } @@ -780,7 +784,7 @@ BOOLEAN NextAIToHandle( UINT32 uiCurrAISlot ) for ( ; cnt < guiNumMercSlots; cnt++ ) { - if ( MercSlots[ cnt ] && ( (MercSlots[ cnt ]->bTeam != gbPlayerNum) || (MercSlots[ cnt ]->uiStatusFlags & SOLDIER_PCUNDERAICONTROL) ) ) + if ( MercSlots[ cnt ] && ( (MercSlots[ cnt ]->bTeam != gbPlayerNum) || (MercSlots[ cnt ]->flags.uiStatusFlags & SOLDIER_PCUNDERAICONTROL) ) ) { // aha! found an AI guy! guiAISlotToHandle = cnt; @@ -790,7 +794,7 @@ BOOLEAN NextAIToHandle( UINT32 uiCurrAISlot ) // set so that even if there are no off-screen mercs to handle, we will loop back to // the start of the array - guiAISlotToHandle = HANDLE_OFF_MAP_MERC; + guiAISlotToHandle = HANDLE_OFF_MAP_MERC; // didn't find an AI guy to handle after the last one handled and the # of slots // it's time to check for an off-map merc... maybe @@ -845,12 +849,12 @@ void UnPauseAI( void ) FLOAT gdRadiansForAngle[ ] = { - (FLOAT)PI, + (FLOAT)PI, (FLOAT)( 3 * PI / 4 ), (FLOAT)( PI / 2 ), (FLOAT)( ( PI ) / 4 ), - (FLOAT)0, + (FLOAT)0, (FLOAT)( ( -PI ) / 4 ), (FLOAT)( -PI / 2 ), (FLOAT)( -3 * PI / 4 ), @@ -861,23 +865,23 @@ FLOAT gdRadiansForAngle[ ] = BOOLEAN ExecuteOverhead( ) { - UINT32 cnt; - SOLDIERTYPE *pSoldier; - INT16 sAPCost; - INT16 sBPCost; - FLOAT dXPos , dYPos; - FLOAT dAngle; - BOOLEAN fKeepMoving; - INT8 bShadeLevel; - BOOLEAN fNoAPsForPendingAction; - INT16 sGridNo; - STRUCTURE *pStructure; + UINT32 cnt; + SOLDIERTYPE *pSoldier; + INT16 sAPCost; + INT16 sBPCost; + FLOAT dXPos , dYPos; + FLOAT dAngle; + BOOLEAN fKeepMoving; + INT8 bShadeLevel; + BOOLEAN fNoAPsForPendingAction; + INT16 sGridNo; + STRUCTURE *pStructure; BOOLEAN fHandleAI = FALSE; // Diagnostic Stuff - static INT32 iTimerTest = 0; - static INT32 iTimerVal = 0; + static INT32 iTimerTest = 0; + static INT32 iTimerVal = 0; gfMovingAnimation = FALSE; @@ -886,7 +890,7 @@ BOOLEAN ExecuteOverhead( ) { if(pSoldier->bActive) { - if(pSoldier->uiStatusFlags&SOLDIER_GREEN_RAY) + if(pSoldier->flags.uiStatusFlags&SOLDIER_GREEN_RAY) LightShowRays((INT16)(pSoldier->dXPos/CELL_X_SIZE), (INT16)(pSoldier->dYPos/CELL_Y_SIZE), FALSE); } } @@ -946,33 +950,33 @@ BOOLEAN ExecuteOverhead( ) HandlePanelFaceAnimations( pSoldier ); // Handle damage counters - if ( pSoldier->fDisplayDamage ) + if ( pSoldier->flags.fDisplayDamage ) { - if ( TIMECOUNTERDONE( pSoldier->DamageCounter, DAMAGE_DISPLAY_DELAY ) ) + if ( TIMECOUNTERDONE( pSoldier->timeCounters.DamageCounter, DAMAGE_DISPLAY_DELAY ) ) { pSoldier->bDisplayDamageCount++; pSoldier->sDamageX+=1; pSoldier->sDamageY-=1; - RESETTIMECOUNTER( pSoldier->DamageCounter, DAMAGE_DISPLAY_DELAY ); + RESETTIMECOUNTER( pSoldier->timeCounters.DamageCounter, DAMAGE_DISPLAY_DELAY ); } if ( pSoldier->bDisplayDamageCount >= 8 ) { pSoldier->bDisplayDamageCount = 0; pSoldier->sDamage = 0; - pSoldier->fDisplayDamage = FALSE; + pSoldier->flags.fDisplayDamage = FALSE; } } // Handle reload counters - if ( pSoldier->fReloading ) + if ( pSoldier->flags.fReloading ) { - if ( TIMECOUNTERDONE( pSoldier->ReloadCounter, pSoldier->sReloadDelay ) ) + if ( TIMECOUNTERDONE( pSoldier->timeCounters.ReloadCounter, pSoldier->sReloadDelay ) ) { - pSoldier->fReloading = FALSE; - pSoldier->fPauseAim = FALSE; + pSoldier->flags.fReloading = FALSE; + pSoldier->flags.fPauseAim = FALSE; /* DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - realtime reloading") ); FreeUpAttacker( pSoldier->ubID ); @@ -981,21 +985,21 @@ BOOLEAN ExecuteOverhead( ) } // Checkout fading - if ( pSoldier->fBeginFade ) + if ( pSoldier->flags.fBeginFade ) { - if ( TIMECOUNTERDONE( pSoldier->FadeCounter, NEW_FADE_DELAY ) ) + if ( TIMECOUNTERDONE( pSoldier->timeCounters.FadeCounter, NEW_FADE_DELAY ) ) { - RESETTIMECOUNTER( pSoldier->FadeCounter, NEW_FADE_DELAY ); + RESETTIMECOUNTER( pSoldier->timeCounters.FadeCounter, NEW_FADE_DELAY ); // Fade out.... - if ( pSoldier->fBeginFade == 1 ) + if ( pSoldier->flags.fBeginFade == 1 ) { bShadeLevel = (pSoldier->ubFadeLevel&0x0f); bShadeLevel=__min(bShadeLevel+1, SHADE_MIN); if ( bShadeLevel >= ( SHADE_MIN - 3 ) ) { - pSoldier->fBeginFade = FALSE; + pSoldier->flags.fBeginFade = FALSE; pSoldier->bVisible = -1; // Set levelnode shade level.... @@ -1011,7 +1015,7 @@ BOOLEAN ExecuteOverhead( ) bShadeLevel|=(pSoldier->ubFadeLevel&0x30); pSoldier->ubFadeLevel = bShadeLevel; } - else if ( pSoldier->fBeginFade == 2 ) + else if ( pSoldier->flags.fBeginFade == 2 ) { bShadeLevel = (pSoldier->ubFadeLevel&0x0f); //ubShadeLevel =__max(ubShadeLevel-1, gpWorldLevelData[ pSoldier->sGridNo ].pLandHead->ubShadeLevel ); @@ -1027,7 +1031,7 @@ BOOLEAN ExecuteOverhead( ) { bShadeLevel = (gpWorldLevelData[ pSoldier->sGridNo ].pLandHead->ubShadeLevel ); - pSoldier->fBeginFade = FALSE; + pSoldier->flags.fBeginFade = FALSE; //pSoldier->bVisible = -1; //pSoldier->ubFadeLevel = gpWorldLevelData[ pSoldier->sGridNo ].pLandHead->ubShadeLevel; @@ -1048,7 +1052,7 @@ BOOLEAN ExecuteOverhead( ) } // Check if we have a new visiblity and shade accordingly down - if ( pSoldier->bLastRenderVisibleValue != pSoldier->bVisible ) + if ( pSoldier->bLastRenderVisibleValue != pSoldier->bVisible ) { HandleCrowShadowVisibility( pSoldier ); @@ -1063,7 +1067,7 @@ BOOLEAN ExecuteOverhead( ) { int i = 0; } - pSoldier->fBeginFade = TRUE; + pSoldier->flags.fBeginFade = TRUE; pSoldier->sLocationOfFadeStart = pSoldier->sGridNo; // OK, re-evaluate guy's roof marker @@ -1076,7 +1080,7 @@ BOOLEAN ExecuteOverhead( ) if ( pSoldier->bVisible != -1 && pSoldier->bLastRenderVisibleValue == -1 && pSoldier->bTeam != gbPlayerNum ) { pSoldier->ubFadeLevel = ( SHADE_MIN - 3 ); - pSoldier->fBeginFade = 2; + pSoldier->flags.fBeginFade = 2; pSoldier->sLocationOfFadeStart = pSoldier->sGridNo; // OK, re-evaluate guy's roof marker @@ -1088,21 +1092,21 @@ BOOLEAN ExecuteOverhead( ) // Handle stationary polling... - if ( ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_STATIONARY ) || pSoldier->fNoAPToFinishMove ) + if ( ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_STATIONARY ) || pSoldier->flags.fNoAPToFinishMove ) { // Are are stationary.... // Were we once moving...? - if ( pSoldier->fSoldierWasMoving && pSoldier->bVisible > -1 ) + if ( pSoldier->flags.fSoldierWasMoving && pSoldier->bVisible > -1 ) { - pSoldier->fSoldierWasMoving = FALSE; + pSoldier->flags.fSoldierWasMoving = FALSE; HandlePlacingRoofMarker( pSoldier, pSoldier->sGridNo, TRUE, FALSE ); if ( !gGameSettings.fOptions[ TOPTION_MERC_ALWAYS_LIGHT_UP ] ) { - DeleteSoldierLight( pSoldier ); + pSoldier->DeleteSoldierLight( ); - SetCheckSoldierLightFlag( pSoldier ); + pSoldier->SetCheckSoldierLightFlag( ); } } } @@ -1110,9 +1114,9 @@ BOOLEAN ExecuteOverhead( ) { // We are moving.... // Were we once stationary? - if ( !pSoldier->fSoldierWasMoving ) + if ( !pSoldier->flags.fSoldierWasMoving ) { - pSoldier->fSoldierWasMoving = TRUE; + pSoldier->flags.fSoldierWasMoving = TRUE; HandlePlacingRoofMarker( pSoldier, pSoldier->sGridNo, FALSE, FALSE ); } @@ -1121,7 +1125,7 @@ BOOLEAN ExecuteOverhead( ) // Handle animation update counters // ATE: Added additional check here for special value of anispeed that pauses all updates #ifndef BOUNDS_CHECKER - if ( TIMECOUNTERDONE( pSoldier->UpdateCounter, pSoldier->sAniDelay ) && pSoldier->sAniDelay != 10000 ) + if ( TIMECOUNTERDONE( pSoldier->timeCounters.UpdateCounter, pSoldier->sAniDelay ) && pSoldier->sAniDelay != 10000 ) #endif { @@ -1129,37 +1133,37 @@ BOOLEAN ExecuteOverhead( ) // DEF: // Check for TIMING delay here only if in Realtime if( gTacticalStatus.uiFlags & REALTIME) - if ( pSoldier->fIsSoldierMoving ) + if ( pSoldier->flags.fIsSoldierMoving ) CheckForSlowSoldier( pSoldier ); #endif // Check if we need to look for items - if ( pSoldier->uiStatusFlags & SOLDIER_LOOKFOR_ITEMS ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_LOOKFOR_ITEMS ) { - RevealRoofsAndItems(pSoldier, TRUE, FALSE, pSoldier->bLevel, FALSE ); - pSoldier->uiStatusFlags &= (~SOLDIER_LOOKFOR_ITEMS); + RevealRoofsAndItems(pSoldier, TRUE, FALSE, pSoldier->pathing.bLevel, FALSE ); + pSoldier->flags.uiStatusFlags &= (~SOLDIER_LOOKFOR_ITEMS); } // Check if we need to reposition light.... - if ( pSoldier->uiStatusFlags & SOLDIER_RECHECKLIGHT ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_RECHECKLIGHT ) { - PositionSoldierLight( pSoldier ); - pSoldier->uiStatusFlags &= (~SOLDIER_RECHECKLIGHT); + pSoldier->PositionSoldierLight( ); + pSoldier->flags.uiStatusFlags &= (~SOLDIER_RECHECKLIGHT); } - RESETTIMECOUNTER( pSoldier->UpdateCounter, pSoldier->sAniDelay ); + RESETTIMECOUNTER( pSoldier->timeCounters.UpdateCounter, pSoldier->sAniDelay ); fNoAPsForPendingAction = FALSE; #ifdef NETWORKED // Get the path update, if there is 1 - if (pSoldier->fSoldierUpdatedFromNetwork) + if (pSoldier->flags.fSoldierUpdatedFromNetwork) UpdateSoldierFromNetwork(pSoldier); #endif // Check if we are moving and we deduct points and we have no points - if ( !( ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ( ANIM_MOVING | ANIM_SPECIALMOVE ) ) && pSoldier->fNoAPToFinishMove ) && !pSoldier->fPauseAllAnimation ) + if ( !( ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ( ANIM_MOVING | ANIM_SPECIALMOVE ) ) && pSoldier->flags.fNoAPToFinishMove ) && !pSoldier->flags.fPauseAllAnimation ) { if ( !AdjustToNextAnimationFrame( pSoldier ) ) { @@ -1174,26 +1178,26 @@ BOOLEAN ExecuteOverhead( ) // Update world data with new position, etc // Determine gameworld cells corrds of guy - if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ( ANIM_MOVING | ANIM_SPECIALMOVE ) && !( pSoldier->uiStatusFlags & SOLDIER_PAUSEANIMOVE ) ) + if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ( ANIM_MOVING | ANIM_SPECIALMOVE ) && !( pSoldier->flags.uiStatusFlags & SOLDIER_PAUSEANIMOVE ) ) { fKeepMoving = TRUE; - pSoldier->fPausedMove = FALSE; + pSoldier->flags.fPausedMove = FALSE; // CHECK TO SEE IF WE'RE ON A MIDDLE TILE - if ( pSoldier->fPastXDest && pSoldier->fPastYDest ) + if ( pSoldier->flags.fPastXDest && pSoldier->flags.fPastYDest ) { - pSoldier->fPastXDest = pSoldier->fPastYDest = FALSE; + pSoldier->flags.fPastXDest = pSoldier->flags.fPastYDest = FALSE; // assign X/Y values back to make sure we are at the center of the tile // (to prevent mercs from going through corners of tiles and producing // structure data complaints) - //pSoldier->dXPos = pSoldier->sDestXPos; - //pSoldier->dYPos = pSoldier->sDestYPos; + //pSoldier->dXPos = pSoldier->pathing.sDestXPos; + //pSoldier->dYPos = pSoldier->pathing.sDestYPos; HandleBloodForNewGridNo( pSoldier ); - if ( ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_SPECIALMOVE ) && pSoldier->sGridNo != pSoldier->sFinalDestination ) + if ( ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_SPECIALMOVE ) && pSoldier->sGridNo != pSoldier->pathing.sFinalDestination ) { } @@ -1209,10 +1213,10 @@ BOOLEAN ExecuteOverhead( ) } // Are we at our final destination? - if ( pSoldier->sFinalDestination == pSoldier->sGridNo ) - { + if ( pSoldier->pathing.sFinalDestination == pSoldier->sGridNo ) + { // Cancel path.... - pSoldier->usPathIndex = pSoldier->usPathDataSize = 0; + pSoldier->pathing.usPathIndex = pSoldier->pathing.usPathDataSize = 0; // Cancel reverse pSoldier->bReverse = FALSE; @@ -1230,15 +1234,15 @@ BOOLEAN ExecuteOverhead( ) } // If we are a robot, play stop sound... - if ( pSoldier->uiStatusFlags & SOLDIER_ROBOT ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) { - PlaySoldierJA2Sample( pSoldier->ubID, ROBOT_STOP, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, ROBOT_STOP, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); } // Update to middle if we're on destination - dXPos = pSoldier->sDestXPos; - dYPos = pSoldier->sDestYPos; - EVENT_SetSoldierPosition( pSoldier, dXPos, dYPos ); + dXPos = pSoldier->pathing.sDestXPos; + dYPos = pSoldier->pathing.sDestYPos; + pSoldier->EVENT_SetSoldierPosition( dXPos, dYPos ); #ifdef NETWORKED // DEF: Test Code StopSoldierMovementTime(pSoldier); @@ -1250,19 +1254,19 @@ BOOLEAN ExecuteOverhead( ) // CHECK IF WE HAVE A PENDING ANIMATION if ( pSoldier->usPendingAnimation != NO_PENDING_ANIMATION ) { - ChangeSoldierState( pSoldier, pSoldier->usPendingAnimation, 0 , FALSE ); + pSoldier->ChangeSoldierState( pSoldier->usPendingAnimation, 0 , FALSE ); pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; if ( pSoldier->ubPendingDirection != NO_PENDING_DIRECTION ) { - EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubPendingDirection ); + pSoldier->EVENT_SetSoldierDesiredDirection( pSoldier->ubPendingDirection ); pSoldier->ubPendingDirection = NO_PENDING_DIRECTION; } } // CHECK IF WE HAVE A PENDING ACTION - if ( pSoldier->ubWaitActionToDo ) + if ( pSoldier->ubWaitActionToDo ) { if ( pSoldier->ubWaitActionToDo == 2 ) { @@ -1271,8 +1275,8 @@ BOOLEAN ExecuteOverhead( ) if ( gubWaitingForAllMercsToExitCode == WAIT_FOR_MERCS_TO_WALKOFF_SCREEN ) { // ATE wanted this line here... - pSoldier->usPathIndex--; - AdjustSoldierPathToGoOffEdge( pSoldier, pSoldier->sGridNo, (UINT8)pSoldier->uiPendingActionData1 ); + pSoldier->pathing.usPathIndex--; + AdjustSoldierPathToGoOffEdge( pSoldier, pSoldier->sGridNo, (UINT8)pSoldier->aiData.uiPendingActionData1 ); continue; } } @@ -1282,7 +1286,7 @@ BOOLEAN ExecuteOverhead( ) gbNumMercsUntilWaitingOver--; - SoldierGotoStationaryStance( pSoldier ); + pSoldier->SoldierGotoStationaryStance( ); // If we are at an exit-grid, make disappear..... if ( gubWaitingForAllMercsToExitCode == WAIT_FOR_MERCS_TO_WALK_TO_GRIDNO ) @@ -1291,15 +1295,15 @@ BOOLEAN ExecuteOverhead( ) RemoveSoldierFromTacticalSector( pSoldier, TRUE ); } } - } - else if ( pSoldier->ubPendingAction != NO_PENDING_ACTION ) + } + else if ( pSoldier->aiData.ubPendingAction != NO_PENDING_ACTION ) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("We are inside the IF PENDING Animation with soldier #%d", pSoldier->ubID) ); - if ( pSoldier->ubPendingAction == MERC_OPENDOOR || pSoldier->ubPendingAction == MERC_OPENSTRUCT ) + if ( pSoldier->aiData.ubPendingAction == MERC_OPENDOOR || pSoldier->aiData.ubPendingAction == MERC_OPENSTRUCT ) { - sGridNo = pSoldier->sPendingActionData2; - //usStructureID = (UINT16)pSoldier->uiPendingActionData1; + sGridNo = pSoldier->aiData.sPendingActionData2; + //usStructureID = (UINT16)pSoldier->aiData.uiPendingActionData1; //pStructure = FindStructureByID( sGridNo, usStructureID ); // LOOK FOR STRUCT OPENABLE @@ -1317,8 +1321,8 @@ BOOLEAN ExecuteOverhead( ) CalcInteractiveObjectAPs( sGridNo, pStructure, &sAPCost, &sBPCost ); if ( EnoughPoints( pSoldier, sAPCost, sBPCost , TRUE ) ) - { - InteractWithInteractiveObject( pSoldier, pStructure, pSoldier->bPendingActionData3 ); + { + InteractWithInteractiveObject( pSoldier, pStructure, pSoldier->aiData.bPendingActionData3 ); } else { @@ -1326,9 +1330,9 @@ BOOLEAN ExecuteOverhead( ) } } } - if ( pSoldier->ubPendingAction == MERC_PICKUPITEM ) + if ( pSoldier->aiData.ubPendingAction == MERC_PICKUPITEM ) { - sGridNo = pSoldier->sPendingActionData2; + sGridNo = pSoldier->aiData.sPendingActionData2; if ( sGridNo == pSoldier->sGridNo ) { @@ -1337,114 +1341,114 @@ BOOLEAN ExecuteOverhead( ) { // If the two gridnos are not the same, check to see if we can // now go into it - if ( sGridNo != (INT16)pSoldier->uiPendingActionData4 ) + if ( sGridNo != (INT16)pSoldier->aiData.uiPendingActionData4 ) { - if ( NewOKDestination( pSoldier, (INT16)pSoldier->uiPendingActionData4, TRUE, pSoldier->bLevel ) ) + if ( NewOKDestination( pSoldier, (INT16)pSoldier->aiData.uiPendingActionData4, TRUE, pSoldier->pathing.bLevel ) ) { // GOTO NEW TILE! - SoldierPickupItem( pSoldier, pSoldier->uiPendingActionData1, (INT16)pSoldier->uiPendingActionData4, pSoldier->bPendingActionData3 ); + SoldierPickupItem( pSoldier, pSoldier->aiData.uiPendingActionData1, (INT16)pSoldier->aiData.uiPendingActionData4, pSoldier->aiData.bPendingActionData3 ); continue; } } } // OK MORON, DOUBLE CHECK THAT THE ITEM EXISTS HERE... - if ( pSoldier->uiPendingActionData1 != ITEM_PICKUP_ACTION_ALL ) + if ( pSoldier->aiData.uiPendingActionData1 != ITEM_PICKUP_ACTION_ALL ) { - //if ( ItemExistsAtLocation( (INT16)( pSoldier->uiPendingActionData4 ), pSoldier->uiPendingActionData1, pSoldier->bLevel ) ) + //if ( ItemExistsAtLocation( (INT16)( pSoldier->aiData.uiPendingActionData4 ), pSoldier->aiData.uiPendingActionData1, pSoldier->pathing.bLevel ) ) { - PickPickupAnimation( pSoldier, pSoldier->uiPendingActionData1, (INT16)( pSoldier->uiPendingActionData4 ), pSoldier->bPendingActionData3 ); + PickPickupAnimation( pSoldier, pSoldier->aiData.uiPendingActionData1, (INT16)( pSoldier->aiData.uiPendingActionData4 ), pSoldier->aiData.bPendingActionData3 ); } } else { - PickPickupAnimation( pSoldier, pSoldier->uiPendingActionData1, (INT16)( pSoldier->uiPendingActionData4 ), pSoldier->bPendingActionData3 ); + PickPickupAnimation( pSoldier, pSoldier->aiData.uiPendingActionData1, (INT16)( pSoldier->aiData.uiPendingActionData4 ), pSoldier->aiData.bPendingActionData3 ); } } else { - SoldierGotoStationaryStance( pSoldier ); + pSoldier->SoldierGotoStationaryStance( ); } } - else if ( pSoldier->ubPendingAction == MERC_PUNCH ) + else if ( pSoldier->aiData.ubPendingAction == MERC_PUNCH ) { // for the benefit of the AI - pSoldier->bAction = AI_ACTION_KNIFE_STAB; + pSoldier->aiData.bAction = AI_ACTION_KNIFE_STAB; - EVENT_SoldierBeginPunchAttack( pSoldier, pSoldier->sPendingActionData2, pSoldier->bPendingActionData3 ); - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->EVENT_SoldierBeginPunchAttack( pSoldier->aiData.sPendingActionData2, pSoldier->aiData.bPendingActionData3 ); + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; } - else if ( pSoldier->ubPendingAction == MERC_TALK ) + else if ( pSoldier->aiData.ubPendingAction == MERC_TALK ) { - PlayerSoldierStartTalking( pSoldier, (UINT8)pSoldier->uiPendingActionData1, TRUE ); - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->PlayerSoldierStartTalking( (UINT8)pSoldier->aiData.uiPendingActionData1, TRUE ); + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; } - else if ( pSoldier->ubPendingAction == MERC_DROPBOMB ) + else if ( pSoldier->aiData.ubPendingAction == MERC_DROPBOMB ) { - EVENT_SoldierBeginDropBomb( pSoldier ); - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->EVENT_SoldierBeginDropBomb( ); + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; } - else if ( pSoldier->ubPendingAction == MERC_STEAL ) + else if ( pSoldier->aiData.ubPendingAction == MERC_STEAL ) { - //pSoldier->bDesiredDirection = pSoldier->bPendingActionData3; - EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bPendingActionData3 ); + //pSoldier->pathing.bDesiredDirection = pSoldier->aiData.bPendingActionData3; + pSoldier->EVENT_SetSoldierDesiredDirection( pSoldier->aiData.bPendingActionData3 ); - EVENT_InitNewSoldierAnim( pSoldier, STEAL_ITEM, 0 , FALSE ); - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->EVENT_InitNewSoldierAnim( STEAL_ITEM, 0 , FALSE ); + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; } - else if ( pSoldier->ubPendingAction == MERC_KNIFEATTACK) + else if ( pSoldier->aiData.ubPendingAction == MERC_KNIFEATTACK) { // for the benefit of the AI - pSoldier->bAction = AI_ACTION_KNIFE_STAB; + pSoldier->aiData.bAction = AI_ACTION_KNIFE_STAB; - EVENT_SoldierBeginBladeAttack( pSoldier, pSoldier->sPendingActionData2, pSoldier->bPendingActionData3 ); - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->EVENT_SoldierBeginBladeAttack( pSoldier->aiData.sPendingActionData2, pSoldier->aiData.bPendingActionData3 ); + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; } - else if ( pSoldier->ubPendingAction == MERC_GIVEAID ) + else if ( pSoldier->aiData.ubPendingAction == MERC_GIVEAID ) { - EVENT_SoldierBeginFirstAid( pSoldier, pSoldier->sPendingActionData2, pSoldier->bPendingActionData3 ); - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->EVENT_SoldierBeginFirstAid( pSoldier->aiData.sPendingActionData2, pSoldier->aiData.bPendingActionData3 ); + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; } - else if ( pSoldier->ubPendingAction == MERC_REPAIR ) + else if ( pSoldier->aiData.ubPendingAction == MERC_REPAIR ) { - EVENT_SoldierBeginRepair( pSoldier, pSoldier->sPendingActionData2, pSoldier->bPendingActionData3 ); - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->EVENT_SoldierBeginRepair( pSoldier->aiData.sPendingActionData2, pSoldier->aiData.bPendingActionData3 ); + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; } - else if ( pSoldier->ubPendingAction == MERC_FUEL_VEHICLE ) + else if ( pSoldier->aiData.ubPendingAction == MERC_FUEL_VEHICLE ) { - EVENT_SoldierBeginRefuel( pSoldier, pSoldier->sPendingActionData2, pSoldier->bPendingActionData3 ); - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->EVENT_SoldierBeginRefuel( pSoldier->aiData.sPendingActionData2, pSoldier->aiData.bPendingActionData3 ); + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; } - else if ( pSoldier->ubPendingAction == MERC_RELOADROBOT ) + else if ( pSoldier->aiData.ubPendingAction == MERC_RELOADROBOT ) { - EVENT_SoldierBeginReloadRobot( pSoldier, pSoldier->sPendingActionData2, pSoldier->bPendingActionData3, (INT8)pSoldier->uiPendingActionData1 ); - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->EVENT_SoldierBeginReloadRobot( pSoldier->aiData.sPendingActionData2, pSoldier->aiData.bPendingActionData3, (INT8)pSoldier->aiData.uiPendingActionData1 ); + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; } - else if ( pSoldier->ubPendingAction == MERC_TAKEBLOOD ) + else if ( pSoldier->aiData.ubPendingAction == MERC_TAKEBLOOD ) { - EVENT_SoldierBeginTakeBlood( pSoldier, pSoldier->sPendingActionData2, pSoldier->bPendingActionData3 ); - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->EVENT_SoldierBeginTakeBlood( pSoldier->aiData.sPendingActionData2, pSoldier->aiData.bPendingActionData3 ); + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; } - else if ( pSoldier->ubPendingAction == MERC_ATTACH_CAN ) + else if ( pSoldier->aiData.ubPendingAction == MERC_ATTACH_CAN ) { - EVENT_SoldierBeginAttachCan( pSoldier, pSoldier->sPendingActionData2, pSoldier->bPendingActionData3 ); - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->EVENT_SoldierBeginAttachCan( pSoldier->aiData.sPendingActionData2, pSoldier->aiData.bPendingActionData3 ); + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; } - else if ( pSoldier->ubPendingAction == MERC_ENTER_VEHICLE ) + else if ( pSoldier->aiData.ubPendingAction == MERC_ENTER_VEHICLE ) { - EVENT_SoldierEnterVehicle( pSoldier, pSoldier->sPendingActionData2, pSoldier->bPendingActionData3 ); - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->EVENT_SoldierEnterVehicle( pSoldier->aiData.sPendingActionData2, pSoldier->aiData.bPendingActionData3 ); + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; continue; } - else if ( pSoldier->ubPendingAction == MERC_CUTFFENCE ) + else if ( pSoldier->aiData.ubPendingAction == MERC_CUTFFENCE ) { - EVENT_SoldierBeginCutFence( pSoldier, pSoldier->sPendingActionData2, pSoldier->bPendingActionData3 ); - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->EVENT_SoldierBeginCutFence( pSoldier->aiData.sPendingActionData2, pSoldier->aiData.bPendingActionData3 ); + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; } - else if ( pSoldier->ubPendingAction == MERC_GIVEITEM ) + else if ( pSoldier->aiData.ubPendingAction == MERC_GIVEITEM ) { - EVENT_SoldierBeginGiveItem( pSoldier ); - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->EVENT_SoldierBeginGiveItem( ); + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; } if ( fNoAPsForPendingAction ) @@ -1461,106 +1465,106 @@ BOOLEAN ExecuteOverhead( ) { // OK, ADJUST TO STANDING, WE ARE DONE // DO NOTHING IF WE ARE UNCONSCIOUS - if ( pSoldier->bLife >= OKLIFE ) + if ( pSoldier->stats.bLife >= OKLIFE ) { if ( pSoldier->ubBodyType == CROW ) { // If we are flying, don't stop! if ( pSoldier->sHeightAdjustment == 0 ) { - SoldierGotoStationaryStance( pSoldier ); + pSoldier->SoldierGotoStationaryStance( ); } } else { UnSetUIBusy( pSoldier->ubID ); - SoldierGotoStationaryStance( pSoldier ); + pSoldier->SoldierGotoStationaryStance( ); } } } // RESET MOVE FAST FLAG - if ( (pSoldier->ubProfile == NO_PROFILE) ) + if ( (pSoldier->ubProfile == NO_PROFILE) ) { - pSoldier->fUIMovementFast = FALSE; + pSoldier->flags.fUIMovementFast = FALSE; } // if AI moving and waiting to process something at end of // move, have them handled the very next frame if (pSoldier->ubQuoteActionID == QUOTE_ACTION_ID_CHECKFORDEST) { - pSoldier->fAIFlags |= AI_HANDLE_EVERY_FRAME; + pSoldier->aiData.fAIFlags |= AI_HANDLE_EVERY_FRAME; } fKeepMoving = FALSE; } - else if ( !pSoldier->fNoAPToFinishMove ) + else if ( !pSoldier->flags.fNoAPToFinishMove ) { // Increment path.... - pSoldier->usPathIndex++; + pSoldier->pathing.usPathIndex++; - if ( pSoldier->usPathIndex > pSoldier->usPathDataSize ) + if ( pSoldier->pathing.usPathIndex > pSoldier->pathing.usPathDataSize ) { - pSoldier->usPathIndex = pSoldier->usPathDataSize; + pSoldier->pathing.usPathIndex = pSoldier->pathing.usPathDataSize; } // Are we at the end? - if ( pSoldier->usPathIndex == pSoldier->usPathDataSize ) + if ( pSoldier->pathing.usPathIndex == pSoldier->pathing.usPathDataSize ) { // ATE: Pop up warning.... - if ( pSoldier->usPathDataSize != MAX_PATH_LIST_SIZE ) + if ( pSoldier->pathing.usPathDataSize != MAX_PATH_LIST_SIZE ) { #ifdef JA2BETAVERSION - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Path for %s ( %d ) did not make merc get to dest (%d spaces away).", pSoldier->name, pSoldier->ubID, PythSpacesAway( pSoldier->sFinalDestination, pSoldier->sGridNo) ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Path for %s ( %d ) did not make merc get to dest (%d spaces away).", pSoldier->name, pSoldier->ubID, PythSpacesAway( pSoldier->pathing.sFinalDestination, pSoldier->sGridNo) ); #endif } // In case this is an AI person with the path-stored flag set, // turn it OFF since we have exhausted our stored path - pSoldier->bPathStored = FALSE; + pSoldier->pathing.bPathStored = FALSE; if (pSoldier->sAbsoluteFinalDestination != NOWHERE) { // We have not made it to our dest... but it's better to let the AI handle this itself, // on the very next fram - pSoldier->fAIFlags |= AI_HANDLE_EVERY_FRAME; + pSoldier->aiData.fAIFlags |= AI_HANDLE_EVERY_FRAME; } else { // ATE: Added this to fcalilitate the fact // that our final dest may now have people on it.... - // 0verhaul: But what if this is turn-based? The soldier may be waiting forever for + // 0verhaul: But what if this is turn-based? The soldier may be waiting forever for // the other one to leave the position, but since it's turn-based he never will. // Is that an issue here? - // Yes, I think it is. I found a situation where the soldier's path led through another - // soldier. The other soldier wasn't even at the destination but his path invariably - // led through that soldier. Since this was set up to allow that, he ended up deadlocked + // Yes, I think it is. I found a situation where the soldier's path led through another + // soldier. The other soldier wasn't even at the destination but his path invariably + // led through that soldier. Since this was set up to allow that, he ended up deadlocked // in "take cover" mode waiting for the soldier right next to him to leave. // So in turn-based mode, we will just allow the soldier to re-think his next move. if ( gTacticalStatus.uiFlags & TURNBASED && gTacticalStatus.uiFlags & INCOMBAT) { ActionDone( pSoldier); - SoldierGotoStationaryStance( pSoldier ); + pSoldier->SoldierGotoStationaryStance( ); continue; } else { - if ( FindBestPath( pSoldier, pSoldier->sFinalDestination, pSoldier->bLevel, pSoldier->usUIMovementMode, NO_COPYROUTE, PATH_THROUGH_PEOPLE ) != 0 ) + if ( FindBestPath( pSoldier, pSoldier->pathing.sFinalDestination, pSoldier->pathing.bLevel, pSoldier->usUIMovementMode, NO_COPYROUTE, PATH_THROUGH_PEOPLE ) != 0 ) { INT16 sNewGridNo; - sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( (UINT8)guiPathingData[ 0 ] ) ); + sNewGridNo = NewGridNo( (INT16)pSoldier->sGridNo, DirectionInc( (UINT8)guiPathingData[ 0 ] ) ); SetDelayedTileWaiting( pSoldier, sNewGridNo, 1 ); } // We have not made it to our dest... set flag that we are waiting.... - if ( !EVENT_InternalGetNewSoldierPath( pSoldier, pSoldier->sFinalDestination, pSoldier->usUIMovementMode, 2, FALSE ) ) + if ( !pSoldier->EVENT_InternalGetNewSoldierPath( pSoldier->pathing.sFinalDestination, pSoldier->usUIMovementMode, 2, FALSE ) ) { // ATE: To do here.... we could not get path, so we have to stop - // 0verhaul: May also need to clear the action type so that the soldier will know + // 0verhaul: May also need to clear the action type so that the soldier will know // to re-think another move instead of waiting for nothing to finish happening. - SoldierGotoStationaryStance( pSoldier ); + pSoldier->SoldierGotoStationaryStance( ); continue; } } @@ -1581,7 +1585,7 @@ BOOLEAN ExecuteOverhead( ) { // Change desired direction // Just change direction - EVENT_InternalSetSoldierDestination( pSoldier, (UINT8) pSoldier->usPathingData[ pSoldier->usPathIndex ], FALSE, pSoldier->usAnimState ); + pSoldier->EVENT_InternalSetSoldierDestination( (UINT8) pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathIndex ], FALSE, pSoldier->usAnimState ); } if ( gTacticalStatus.bBoxingState != NOT_BOXING && (gTacticalStatus.bBoxingState == BOXING_WAITING_FOR_PLAYER || gTacticalStatus.bBoxingState == PRE_BOXING || gTacticalStatus.bBoxingState == BOXING) ) @@ -1592,17 +1596,17 @@ BOOLEAN ExecuteOverhead( ) } } - if ( ( pSoldier->uiStatusFlags & SOLDIER_PAUSEANIMOVE ) ) + if ( ( pSoldier->flags.uiStatusFlags & SOLDIER_PAUSEANIMOVE ) ) { fKeepMoving = FALSE; } - // DO WALKING - if ( !pSoldier->fPausedMove && fKeepMoving ) + // DO WALKING + if ( !pSoldier->flags.fPausedMove && fKeepMoving ) { // Determine deltas - // dDeltaX = pSoldier->sDestXPos - pSoldier->dXPos; - //dDeltaY = pSoldier->sDestYPos - pSoldier->dYPos; + // dDeltaX = pSoldier->pathing.sDestXPos - pSoldier->dXPos; + //dDeltaY = pSoldier->pathing.sDestYPos - pSoldier->dYPos; // Determine angle // dAngle = (FLOAT)atan2( dDeltaX, dDeltaY ); @@ -1613,12 +1617,12 @@ BOOLEAN ExecuteOverhead( ) // For walking, base it on body type! if ( pSoldier->usAnimState == WALKING ) { - MoveMerc( pSoldier, gubAnimWalkSpeeds[ pSoldier->ubBodyType ].dMovementChange, dAngle, TRUE ); + pSoldier->MoveMerc( gubAnimWalkSpeeds[ pSoldier->ubBodyType ].dMovementChange, dAngle, TRUE ); } else { - MoveMerc( pSoldier, gAnimControl[ pSoldier->usAnimState ].dMovementChange, dAngle, TRUE ); + pSoldier->MoveMerc( gAnimControl[ pSoldier->usAnimState ].dMovementChange, dAngle, TRUE ); } } @@ -1627,21 +1631,21 @@ BOOLEAN ExecuteOverhead( ) // Check for direction change if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_TURNING ) { - TurnSoldier( pSoldier ); + pSoldier->TurnSoldier( ); } } #ifdef NETWORKED - if(!pSoldier->fNoAPToFinishMove ) + if(!pSoldier->flags.fNoAPToFinishMove ) pSoldier->usLastUpdateTime = GetJA2Clock(); - if (pSoldier->fSoldierUpdatedFromNetwork) + if (pSoldier->flags.fSoldierUpdatedFromNetwork) UpdateSoldierFromNetwork(pSoldier); #endif } - if ( !gfPauseAllAI && - ( ((gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT)) || (fHandleAI && guiAISlotToHandle == cnt) || (pSoldier->fAIFlags & AI_HANDLE_EVERY_FRAME) || gTacticalStatus.fAutoBandageMode ) ) + if ( !gfPauseAllAI && + ( ((gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT)) || (fHandleAI && guiAISlotToHandle == cnt) || (pSoldier->aiData.fAIFlags & AI_HANDLE_EVERY_FRAME) || gTacticalStatus.fAutoBandageMode ) ) { HandleSoldierAI( pSoldier ); if ( !((gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT)) ) @@ -1674,7 +1678,7 @@ BOOLEAN ExecuteOverhead( ) { // the ONLY thing to do with away soldiers is process their schedule if they have one // and there is an action for them to do (like go on-sector) - if (pSoldier->fAIFlags & AI_CHECK_SCHEDULE) + if (pSoldier->aiData.fAIFlags & AI_CHECK_SCHEDULE) { HandleSoldierAI( pSoldier ); } @@ -1696,7 +1700,7 @@ BOOLEAN ExecuteOverhead( ) // Check if we have gone past our time... if ( ( GetJA2Clock( ) - guiWaitingForAllMercsToExitTimer ) > 2500 ) { - // OK, set num waiting to 0 + // OK, set num waiting to 0 #ifdef JA2BETAVERSION ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_DEBUG, L"Waiting too long for Mercs to exit...forcing entry." ); #endif @@ -1778,12 +1782,12 @@ void HaltGuyFromNewGridNoBecauseOfNoAPs( SOLDIERTYPE *pSoldier ) HaltMoveForSoldierOutOfPoints( pSoldier ); pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; pSoldier->ubPendingDirection = NO_PENDING_DIRECTION; - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; UnMarkMovementReserved( pSoldier ); // Display message if our merc... - if ( pSoldier->bTeam == gbPlayerNum && ( gTacticalStatus.uiFlags & INCOMBAT ) ) + if ( pSoldier->bTeam == gbPlayerNum && ( gTacticalStatus.uiFlags & INCOMBAT ) ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ GUY_HAS_RUN_OUT_OF_APS_STR ], pSoldier->name ); } @@ -1813,7 +1817,7 @@ void HandleLocateToGuyAsHeWalks( SOLDIERTYPE *pSoldier ) if ( pSoldier->bVisible != -1 ) { // ATE: If we are visible, and have not already removed roofs, goforit - if ( pSoldier->bLevel > 0 ) + if ( pSoldier->pathing.bLevel > 0 ) { if ( !( gTacticalStatus.uiFlags & SHOW_ALL_ROOFS ) ) { @@ -1830,9 +1834,9 @@ void HandleLocateToGuyAsHeWalks( SOLDIERTYPE *pSoldier ) BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLEAN fInitialMove, UINT16 usAnimState ) { - INT16 sAPCost; - INT16 sBPCost; - UINT16 usNewGridNo, sOverFenceGridNo, sMineGridNo; + INT16 sAPCost; + INT16 sBPCost; + INT16 sNewGridNo, sOverFenceGridNo, sMineGridNo; if (gTacticalStatus.uiFlags & INCOMBAT && fInitialMove ) { @@ -1876,38 +1880,49 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE } - usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( (UINT8)pSoldier->usPathingData[ pSoldier->usPathIndex ] ) ); + sNewGridNo = NewGridNo( (INT16)pSoldier->sGridNo, DirectionInc( (UINT8)pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathIndex ] ) ); // OK, check if this is a fence cost.... - if ( gubWorldMovementCosts[ usNewGridNo ][ (UINT8)pSoldier->usPathingData[ pSoldier->usPathIndex ] ][ pSoldier->bLevel ] == TRAVELCOST_FENCE ) + if ( gubWorldMovementCosts[ sNewGridNo ][ (UINT8)pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathIndex ] ][ pSoldier->pathing.bLevel ] == TRAVELCOST_FENCE ) { // We have been told to jump fence.... // Do we have APs? - sAPCost = AP_JUMPFENCE; - sBPCost = BP_JUMPFENCE; + // CHRISL: Added penalty for jumping a fence while wearing a backpack + // Do we have APs? + if((UsingNewInventorySystem() == true) && pSoldier->inv[BPACKPOCKPOS].exists() == true) + { + sAPCost = AP_JUMPFENCEBPACK; + sBPCost = BP_JUMPFENCEBPACK; + } + else + { + sAPCost = AP_JUMPFENCE; + sBPCost = BP_JUMPFENCE; + } - if ( EnoughPoints( pSoldier, sAPCost, sBPCost, FALSE ) ) + + if ( EnoughPoints( pSoldier, sAPCost, sBPCost, FALSE ) ) { // ATE: Check for tile being clear.... - sOverFenceGridNo = NewGridNo( usNewGridNo, DirectionInc( (UINT8)pSoldier->usPathingData[ pSoldier->usPathIndex + 1 ] ) ); + sOverFenceGridNo = NewGridNo( sNewGridNo, DirectionInc( (UINT8)pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathIndex + 1 ] ) ); - if ( HandleNextTile( pSoldier, (INT8)pSoldier->usPathingData[ pSoldier->usPathIndex + 1 ], sOverFenceGridNo, pSoldier->sFinalDestination ) ) + if ( HandleNextTile( pSoldier, (INT8)pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathIndex + 1 ], sOverFenceGridNo, pSoldier->pathing.sFinalDestination ) ) { // We do, adjust path data.... - pSoldier->usPathIndex++; - // We go two, because we really want to start moving towards the NEXT gridno, + pSoldier->pathing.usPathIndex++; + // We go two, because we really want to start moving towards the NEXT gridno, // if we have any... // LOCK PENDING ACTION COUNTER - pSoldier->uiStatusFlags |= SOLDIER_LOCKPENDINGACTIONCOUNTER; + pSoldier->flags.uiStatusFlags |= SOLDIER_LOCKPENDINGACTIONCOUNTER; - SoldierGotoStationaryStance( pSoldier ); + pSoldier->SoldierGotoStationaryStance( ); // OK, jump! - BeginSoldierClimbFence( pSoldier ); + pSoldier->BeginSoldierClimbFence( ); - pSoldier->fContinueMoveAfterStanceChange = 2; + pSoldier->flags.fContinueMoveAfterStanceChange = 2; } } @@ -1917,9 +1932,9 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE (*pfKeepMoving ) = FALSE; } - return( FALSE ); + return( FALSE ); } - else if ( InternalDoorTravelCost( pSoldier, usNewGridNo, gubWorldMovementCosts[ usNewGridNo ][ (UINT8)pSoldier->usPathingData[ pSoldier->usPathIndex ] ][ pSoldier->bLevel ], (BOOLEAN) (pSoldier->bTeam == gbPlayerNum), NULL, TRUE ) == TRAVELCOST_DOOR ) + else if ( InternalDoorTravelCost( pSoldier, sNewGridNo, gubWorldMovementCosts[ sNewGridNo ][ (UINT8)pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathIndex ] ][ pSoldier->pathing.bLevel ], (BOOLEAN) (pSoldier->bTeam == gbPlayerNum), NULL, TRUE ) == TRAVELCOST_DOOR ) { STRUCTURE * pStructure; INT8 bDirection; @@ -1932,12 +1947,12 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE // No need to check for right key ( since the path checks for that? ) // Just for now play the $&&% animation - bDirection = (UINT8)pSoldier->usPathingData[ pSoldier->usPathIndex ]; + bDirection = (UINT8)pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathIndex ]; // OK, based on the direction, get door gridno if ( bDirection == NORTH || bDirection == WEST ) { - sDoorGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( (UINT8)pSoldier->usPathingData[ pSoldier->usPathIndex ] ) ); + sDoorGridNo = NewGridNo( (INT16)pSoldier->sGridNo, DirectionInc( (UINT8)pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathIndex ] ) ); } else if ( bDirection == SOUTH || bDirection == EAST ) { @@ -1946,7 +1961,7 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE else { #ifdef JA2TESTVERSION - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"ERROR: Invalid Direction to approach door. (Soldier loc: %d, dir: %d).", pSoldier->sGridNo, bDirection ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"ERROR: Invalid Direction to approach door. (Soldier loc: %d, dir: %d).", pSoldier->sGridNo, bDirection ); #endif DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("HandleGotoNewGridNo() Failed: Open door - invalid approach direction") ); @@ -1962,7 +1977,7 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE if ( pStructure == NULL ) { #ifdef JA2TESTVERSION - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"ERROR: Told to open door that does not exist at %d.", sDoorGridNo ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"ERROR: Told to open door that does not exist at %d.", sDoorGridNo ); #endif DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("HandleGotoNewGridNo() Failed: Door does not exist") ); HaltGuyFromNewGridNoBecauseOfNoAPs( pSoldier ); @@ -1976,7 +1991,7 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE InteractWithInteractiveObject( pSoldier, pStructure, bDirection ); // One needs to walk after.... - if ( (pSoldier->bTeam != gbPlayerNum) || (gTacticalStatus.fAutoBandageMode) || ( pSoldier->uiStatusFlags & SOLDIER_PCUNDERAICONTROL ) ) + if ( (pSoldier->bTeam != gbPlayerNum) || (gTacticalStatus.fAutoBandageMode) || ( pSoldier->flags.uiStatusFlags & SOLDIER_PCUNDERAICONTROL ) ) { pSoldier->bEndDoorOpenCode = 1; pSoldier->sEndDoorOpenCodeData = sDoorGridNo; @@ -1987,16 +2002,16 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE // Find out how much it takes to move here! - sAPCost = ActionPointCost( pSoldier, usNewGridNo, (INT8)pSoldier->usPathingData[ pSoldier->usPathIndex ], usAnimState ); - sBPCost = TerrainBreathPoints( pSoldier, usNewGridNo, (INT8)pSoldier->usPathingData[ pSoldier->usPathIndex ], usAnimState ); + sAPCost = ActionPointCost( pSoldier, sNewGridNo, (INT8)pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathIndex ], usAnimState ); + sBPCost = TerrainBreathPoints( pSoldier, sNewGridNo, (INT8)pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathIndex ], usAnimState ); // CHECK IF THIS TILE IS A GOOD ONE! - if ( !HandleNextTile( pSoldier, (INT8)pSoldier->usPathingData[ pSoldier->usPathIndex ], usNewGridNo, pSoldier->sFinalDestination ) ) + if ( !HandleNextTile( pSoldier, (INT8)pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathIndex ], sNewGridNo, pSoldier->pathing.sFinalDestination ) ) { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "HandleGotoNewGridNo() Failed: Tile %d Was blocked", usNewGridNo ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "HandleGotoNewGridNo() Failed: Tile %d Was blocked", sNewGridNo ) ); // ATE: If our own guy and an initial move.. display message - //if ( fInitialMove && pSoldier->bTeam == gbPlayerNum ) + //if ( fInitialMove && pSoldier->bTeam == gbPlayerNum ) //{ // ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ NO_PATH_FOR_MERC ], pSoldier->name ); //} @@ -2008,9 +2023,9 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE // just check the tile we're going to walk into - if ( NearbyGroundSeemsWrong( pSoldier, usNewGridNo, FALSE, (INT16 *) &sMineGridNo ) ) + if ( NearbyGroundSeemsWrong( pSoldier, sNewGridNo, FALSE, (INT16 *) &sMineGridNo ) ) { - if ( pSoldier->uiStatusFlags & SOLDIER_PC ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_PC ) { // NearbyGroundSeemsWrong returns true with gridno NOWHERE if // we find something by metal detector... we should definitely stop @@ -2020,22 +2035,22 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE if ( !( gTacticalStatus.uiFlags & INCOMBAT ) ) { INT32 cnt2; - SOLDIERTYPE *pSoldier2; + SOLDIERTYPE *pSoldier2; cnt2 = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pSoldier2 = MercPtrs[ cnt2 ]; cnt2 >= gTacticalStatus.Team[ gbPlayerNum ].bFirstID; cnt2-- ,pSoldier2-- ) - { + { if ( pSoldier2->bActive ) { - EVENT_StopMerc( pSoldier2, pSoldier2->sGridNo, pSoldier2->ubDirection ); + pSoldier2->EVENT_StopMerc( pSoldier2->sGridNo, pSoldier2->ubDirection ); } } } else { - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); } (*pfKeepMoving) = FALSE; @@ -2055,7 +2070,7 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE if (sMineGridNo != NOWHERE) { - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); (*pfKeepMoving) = FALSE; if (pSoldier->bSide != 0) @@ -2077,13 +2092,13 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE // ATE: Check if we have sighted anyone, if so, don't do anything else... // IN other words, we have stopped from sighting... - if ( pSoldier->fNoAPToFinishMove && !fInitialMove ) + if ( pSoldier->flags.fNoAPToFinishMove && !fInitialMove ) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("HandleGotoNewGridNo() Failed: No APs to finish move set") ); pSoldier->bEndDoorOpenCode = FALSE; (*pfKeepMoving ) = FALSE; } - else if ( pSoldier->usPathIndex == pSoldier->usPathDataSize && pSoldier->usPathDataSize == 0 ) + else if ( pSoldier->pathing.usPathIndex == pSoldier->pathing.usPathDataSize && pSoldier->pathing.usPathDataSize == 0 ) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("HandleGotoNewGridNo() Failed: No Path") ); pSoldier->bEndDoorOpenCode = FALSE; @@ -2092,30 +2107,30 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE //else if ( gTacticalStatus.fEnemySightingOnTheirTurn ) //{ // Hault guy! - // AdjustNoAPToFinishMove( pSoldier, TRUE ); + // pSoldier->AdjustNoAPToFinishMove( TRUE ); // (*pfKeepMoving ) = FALSE; //} - else if ( EnoughPoints( pSoldier, sAPCost, 0, FALSE ) ) + else if ( EnoughPoints( pSoldier, sAPCost, 0, FALSE ) ) { BOOLEAN fDontContinue = FALSE; - if ( pSoldier->usPathIndex > 0 ) + if ( pSoldier->pathing.usPathIndex > 0 ) { // check for running into gas // note: this will have to use the minimum types of structures for tear/creature gas // since there isn't a way to retrieve the smoke effect structure - if ( (gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->bLevel] & ANY_SMOKE_EFFECT && PreRandom( 4 ) == 0 ) || gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->bLevel] & MAPELEMENT_EXT_BURNABLEGAS ) + if ( (gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->pathing.bLevel] & ANY_SMOKE_EFFECT && PreRandom( 4 ) == 0 ) || gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_BURNABLEGAS ) { EXPLOSIVETYPE * pExplosive = NULL; INT8 bPosOfMask; bPosOfMask = FindGasMask (pSoldier); - //if ( pSoldier->inv[ HEAD1POS ].usItem == GASMASK && pSoldier->inv[ HEAD1POS ].bStatus[0] >= GASMASK_MIN_STATUS ) + //if ( pSoldier->inv[ HEAD1POS ].usItem == GASMASK && pSoldier->inv[ HEAD1POS ][0]->data.objectStatus >= GASMASK_MIN_STATUS ) //{ // bPosOfMask = HEAD1POS; //} - //else if ( pSoldier->inv[ HEAD2POS ].usItem == GASMASK && pSoldier->inv[ HEAD2POS ].bStatus[0] >= GASMASK_MIN_STATUS ) + //else if ( pSoldier->inv[ HEAD2POS ].usItem == GASMASK && pSoldier->inv[ HEAD2POS ][0]->data.objectStatus >= GASMASK_MIN_STATUS ) //{ // bPosOfMask = HEAD2POS; //} @@ -2126,14 +2141,14 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE // TODO: Madd: This next section is pretty lame because it can't figure out which explosive was used to actually cause a gas effect // so for now, the first explosive to use a gas effect decides the health and breath damage for all of the gasses of that type - // (this was hard coded before by the developers - i guess they figured they didn't need to look for the actual explosion item, + // (this was hard coded before by the developers - i guess they figured they didn't need to look for the actual explosion item, // since they only had one of each gas item?!?) // anyway, it means that we can only have one set of health/breath damage values for each gas type, until someone has time // to dig into this further and actually make it find the original item that caused the gas if ( !AM_A_ROBOT( pSoldier ) ) { - if ( gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->bLevel] & MAPELEMENT_EXT_SMOKE ) + if ( gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_SMOKE ) { if ( bPosOfMask == NO_SLOT ) { @@ -2142,18 +2157,18 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE } //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Overhead pExplosive: %d", pExplosive->ubType ); - if ( gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->bLevel] & MAPELEMENT_EXT_TEARGAS ) + if ( gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_TEARGAS ) { - if ( !(pSoldier->fHitByGasFlags & HIT_BY_TEARGAS) && bPosOfMask == NO_SLOT ) + if ( !(pSoldier->flags.fHitByGasFlags & HIT_BY_TEARGAS) && bPosOfMask == NO_SLOT ) { pExplosive = &( Explosive[ Item[ GetFirstExplosiveOfType(EXPLOSV_TEARGAS) ].ubClassIndex ]); } } //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Overhead pExplosive: %d", pExplosive->ubType ); - if ( gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->bLevel] & MAPELEMENT_EXT_MUSTARDGAS ) + if ( gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_MUSTARDGAS ) { - if ( !(pSoldier->fHitByGasFlags & HIT_BY_MUSTARDGAS) && bPosOfMask == NO_SLOT ) + if ( !(pSoldier->flags.fHitByGasFlags & HIT_BY_MUSTARDGAS) && bPosOfMask == NO_SLOT ) { pExplosive = &(Explosive[ Item[ GetFirstExplosiveOfType(EXPLOSV_MUSTGAS) ].ubClassIndex ]); } @@ -2161,34 +2176,34 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE } //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Overhead pExplosive: %d", pExplosive->ubType ); - if ( gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->bLevel] & MAPELEMENT_EXT_CREATUREGAS ) + if ( gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_CREATUREGAS ) { - if ( !(pSoldier->fHitByGasFlags & HIT_BY_CREATUREGAS) ) // gas mask doesn't help vs creaturegas + if ( !(pSoldier->flags.fHitByGasFlags & HIT_BY_CREATUREGAS) ) // gas mask doesn't help vs creaturegas { pExplosive = &(Explosive[ Item[ GetFirstExplosiveOfType(EXPLOSV_CREATUREGAS) ].ubClassIndex ]); } } //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Overhead pExplosive: %d", pExplosive->ubType ); - if ( gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->bLevel] & MAPELEMENT_EXT_BURNABLEGAS ) + if ( gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_BURNABLEGAS ) { - if ( !(pSoldier->fHitByGasFlags & HIT_BY_BURNABLEGAS) ) + if ( !(pSoldier->flags.fHitByGasFlags & HIT_BY_BURNABLEGAS) ) { pExplosive = &(Explosive[ Item[ GetFirstExplosiveOfType(EXPLOSV_BURNABLEGAS) ].ubClassIndex ]); } } - //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Overhead pSoldier->fHitByGasFlags: %d", pSoldier->fHitByGasFlags ); - //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Overhead pExplosive: %d", pExplosive->ubType ); + //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Overhead pSoldier->flags.fHitByGasFlags: %d", pSoldier->flags.fHitByGasFlags ); + //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Overhead pExplosive: %d", pExplosive->ubType ); - if ( !(gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->bLevel] & MAPELEMENT_EXT_SMOKE )) + if ( !(gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_SMOKE )) { if ( pExplosive ) { - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); fDontContinue = TRUE; - DishOutGasDamage( pSoldier, pExplosive, TRUE, FALSE, + DishOutGasDamage( pSoldier, pExplosive, TRUE, FALSE, (INT16) (pExplosive->ubDamage + (UINT8)PreRandom( pExplosive->ubDamage ) ), (INT16) (100 * ( pExplosive->ubStunDamage + (INT16)PreRandom( ( pExplosive->ubStunDamage / 2 ) ) ) ), NOBODY ); } @@ -2198,18 +2213,18 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE if ( !fDontContinue ) { - if ( (pSoldier->bOverTerrainType == FLAT_FLOOR || pSoldier->bOverTerrainType == PAVED_ROAD) && pSoldier->bLevel == 0 ) + if ( (pSoldier->bOverTerrainType == FLAT_FLOOR || pSoldier->bOverTerrainType == PAVED_ROAD) && pSoldier->pathing.bLevel == 0 ) { - INT32 iMarblesIndex; + INT32 iMarblesIndex; if ( MarblesExistAtLocation( pSoldier->sGridNo, 0, &iMarblesIndex ) ) { // Slip on marbles! - DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); if ( pSoldier->bTeam == gbPlayerNum ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, Message[ STR_SLIPPED_MARBLES ], pSoldier->name ); - } + } RemoveItemFromPool( pSoldier->sGridNo, iMarblesIndex, 0 ); SoldierCollapse( pSoldier ); if (pSoldier->bActionPoints > 0) @@ -2220,11 +2235,11 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE } } - if ( (pSoldier->bBlindedCounter > 0) && (pSoldier->usAnimState == RUNNING) && (Random( 5 ) == 0) && - OKFallDirection( pSoldier, (INT16) (pSoldier->sGridNo + DirectionInc( pSoldier->ubDirection ) ), pSoldier->bLevel, pSoldier->ubDirection, pSoldier->usAnimState ) ) + if ( (pSoldier->bBlindedCounter > 0) && (pSoldier->usAnimState == RUNNING) && (Random( 5 ) == 0) && + OKFallDirection( pSoldier, (INT16) (pSoldier->sGridNo + DirectionInc( pSoldier->ubDirection ) ), pSoldier->pathing.bLevel, pSoldier->ubDirection, pSoldier->usAnimState ) ) { // 20% chance of falling over! - DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 37 ], pSoldier->name ); SoldierCollapse( pSoldier ); if (pSoldier->bActionPoints > 0) @@ -2233,11 +2248,11 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE } return( FALSE ); } - else if ( ( GetDrunkLevel( pSoldier ) == DRUNK ) && (Random( 5 ) == 0) && - OKFallDirection( pSoldier, (INT16) (pSoldier->sGridNo + DirectionInc( pSoldier->ubDirection ) ), pSoldier->bLevel, pSoldier->ubDirection, pSoldier->usAnimState ) ) + else if ( ( GetDrunkLevel( pSoldier ) == DRUNK ) && (Random( 5 ) == 0) && + OKFallDirection( pSoldier, (INT16) (pSoldier->sGridNo + DirectionInc( pSoldier->ubDirection ) ), pSoldier->pathing.bLevel, pSoldier->ubDirection, pSoldier->usAnimState ) ) { // 20% chance of falling over! - DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 37 ], pSoldier->name ); SoldierCollapse( pSoldier ); if (pSoldier->bActionPoints > 0) @@ -2256,12 +2271,12 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE pSoldier->ubNumTilesMovesSinceLastForget++; } - if ( pSoldier->usPathIndex > 2 && (Random( 100 ) == 0) && pSoldier->ubNumTilesMovesSinceLastForget > 200 ) + if ( pSoldier->pathing.usPathIndex > 2 && (Random( 100 ) == 0) && pSoldier->ubNumTilesMovesSinceLastForget > 200 ) { pSoldier->ubNumTilesMovesSinceLastForget = 0; TacticalCharacterDialogue( pSoldier, QUOTE_PERSONALITY_TRAIT ); - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); if (pSoldier->bActionPoints > 0) { pSoldier->bActionPoints -= (INT8) (Random( pSoldier->bActionPoints ) + 1); @@ -2269,17 +2284,17 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE fDontContinue = TRUE; - UnSetUIBusy( pSoldier->ubID ); + UnSetUIBusy( pSoldier->ubID ); } } } - } + } if ( !fDontContinue ) { // Don't apply the first deduction in points... - if ( usAnimState == CRAWLING && pSoldier->bTurningFromPronePosition > TURNING_FROM_PRONE_ON ) + if ( usAnimState == CRAWLING && pSoldier->flags.bTurningFromPronePosition > TURNING_FROM_PRONE_ON ) { } else @@ -2289,9 +2304,9 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE } // OK, let's check for monsters.... - if (pSoldier->uiStatusFlags & SOLDIER_MONSTER) + if (pSoldier->flags.uiStatusFlags & SOLDIER_MONSTER) { - if ( !ValidCreatureTurn( pSoldier, ( INT8 ) ( pSoldier->usPathingData[ pSoldier->usPathIndex ] ) ) ) + if ( !ValidCreatureTurn( pSoldier, ( INT8 ) ( pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathIndex ] ) ) ) { if ( !pSoldier->bReverse ) { @@ -2299,11 +2314,11 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE if ( pSoldier->ubBodyType == INFANT_MONSTER ) { - ChangeSoldierState( pSoldier, WALK_BACKWARDS, 1, TRUE ); + pSoldier->ChangeSoldierState( WALK_BACKWARDS, 1, TRUE ); } else { - ChangeSoldierState( pSoldier, MONSTER_WALK_BACKWARDS, 1, TRUE ); + pSoldier->ChangeSoldierState( MONSTER_WALK_BACKWARDS, 1, TRUE ); } } } @@ -2316,12 +2331,12 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE // OK, let's check for monsters.... if (pSoldier->ubBodyType == BLOODCAT ) { - if ( !ValidCreatureTurn( pSoldier, ( INT8 ) ( pSoldier->usPathingData[ pSoldier->usPathIndex ] ) ) ) + if ( !ValidCreatureTurn( pSoldier, ( INT8 ) ( pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathIndex ] ) ) ) { if ( !pSoldier->bReverse ) { pSoldier->bReverse = TRUE; - ChangeSoldierState( pSoldier, BLOODCAT_WALK_BACKWARDS, 1, TRUE ); + pSoldier->ChangeSoldierState( BLOODCAT_WALK_BACKWARDS, 1, TRUE ); } } else @@ -2331,11 +2346,11 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE } // Change desired direction - EVENT_InternalSetSoldierDestination( pSoldier, (UINT8) pSoldier->usPathingData[ pSoldier->usPathIndex ], fInitialMove, usAnimState ); + pSoldier->EVENT_InternalSetSoldierDestination( (UINT8) pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathIndex ], fInitialMove, usAnimState ); // CONTINUE // IT'S SAVE TO GO AGAIN, REFRESH flag - AdjustNoAPToFinishMove( pSoldier, FALSE ); + pSoldier->AdjustNoAPToFinishMove( FALSE ); } } else @@ -2379,7 +2394,7 @@ void HandleMaryArrival( SOLDIERTYPE * pSoldier ) // Mary has arrived SetFactTrue( FACT_MARY_OR_JOHN_ARRIVED ); - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); TriggerNPCRecord( MARY, 13 ); } @@ -2423,12 +2438,12 @@ void HandleJohnArrival( SOLDIERTYPE * pSoldier ) SetFactTrue( FACT_MARY_OR_JOHN_ARRIVED ); - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); // if Mary is alive/dead if ( pSoldier2 ) { - EVENT_StopMerc( pSoldier2, pSoldier2->sGridNo, pSoldier2->ubDirection ); + pSoldier2->EVENT_StopMerc( pSoldier2->sGridNo, pSoldier2->ubDirection ); TriggerNPCRecord( JOHN, 13 ); } else @@ -2442,20 +2457,20 @@ void HandleJohnArrival( SOLDIERTYPE * pSoldier ) BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving ) { INT16 sMineGridNo; - UINT8 ubVolume; + UINT8 ubVolume; // ATE; Handle bad guys, as they fade, to cancel it if // too long... // ONLY if fading IN! - if ( pSoldier->fBeginFade == 1 ) + if ( pSoldier->flags.fBeginFade == 1 ) { if ( pSoldier->sLocationOfFadeStart != pSoldier->sGridNo ) { // Turn off - pSoldier->fBeginFade = FALSE; + pSoldier->flags.fBeginFade = FALSE; - if ( pSoldier->bLevel > 0 && gpWorldLevelData[pSoldier->sGridNo].pRoofHead != NULL ) + if ( pSoldier->pathing.bLevel > 0 && gpWorldLevelData[pSoldier->sGridNo].pRoofHead != NULL ) { pSoldier->ubFadeLevel = gpWorldLevelData[ pSoldier->sGridNo ].pRoofHead->ubShadeLevel; } @@ -2515,22 +2530,22 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving ) } // Check if they are out of breath - if ( CheckForBreathCollapse( pSoldier ) ) + if ( pSoldier->CheckForBreathCollapse( ) ) { (*pfKeepMoving ) = TRUE; return( FALSE ); } // see if a mine gets set off... - if (SetOffBombsInGridNo( pSoldier->ubID, pSoldier->sGridNo, FALSE, pSoldier->bLevel ) ) + if (SetOffBombsInGridNo( pSoldier->ubID, pSoldier->sGridNo, FALSE, pSoldier->pathing.bLevel ) ) { (*pfKeepMoving) = FALSE; - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); return( FALSE ); } - // Set "interrupt occurred" flag to false so that we will know whether *this + // Set "interrupt occurred" flag to false so that we will know whether *this // particular call* to HandleSight caused an interrupt gTacticalStatus.fInterruptOccurred = FALSE; @@ -2539,8 +2554,8 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving ) ubVolume = MovementNoise( pSoldier ); if (ubVolume > 0) { - MakeNoise( pSoldier->ubID, pSoldier->sGridNo, pSoldier->bLevel, pSoldier->bOverTerrainType, ubVolume, NOISE_MOVEMENT ); - if ( (pSoldier->uiStatusFlags & SOLDIER_PC) && (pSoldier->bStealthMode) ) + MakeNoise( pSoldier->ubID, pSoldier->sGridNo, pSoldier->pathing.bLevel, pSoldier->bOverTerrainType, ubVolume, NOISE_MOVEMENT ); + if ( (pSoldier->flags.uiStatusFlags & SOLDIER_PC) && (pSoldier->bStealthMode) ) { PlayStealthySoldierFootstepSound( pSoldier ); } @@ -2559,16 +2574,16 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving ) if (gTacticalStatus.fInterruptOccurred) { // Unset no APs value - AdjustNoAPToFinishMove( pSoldier, TRUE ); + pSoldier->AdjustNoAPToFinishMove( TRUE ); (*pfKeepMoving ) = FALSE; pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; pSoldier->ubPendingDirection = NO_PENDING_DIRECTION; // ATE: Cancel only if our final destination - if ( pSoldier->sGridNo == pSoldier->sFinalDestination ) + if ( pSoldier->sGridNo == pSoldier->pathing.sFinalDestination ) { - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; } // this flag is set only to halt the currently moving guy; reset it now @@ -2579,30 +2594,30 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving ) { if ( gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID == pSoldier->ubID ) { - pSoldier->fPauseAllAnimation = FALSE; + pSoldier->flags.fPauseAllAnimation = FALSE; gTacticalStatus.fEnemySightingOnTheirTurn = FALSE; } } } - else if ( pSoldier->fNoAPToFinishMove ) + else if ( pSoldier->flags.fNoAPToFinishMove ) { (*pfKeepMoving ) = FALSE; } - else if ( pSoldier->usPathIndex == pSoldier->usPathDataSize && pSoldier->usPathDataSize == 0 ) + else if ( pSoldier->pathing.usPathIndex == pSoldier->pathing.usPathDataSize && pSoldier->pathing.usPathDataSize == 0 ) { (*pfKeepMoving ) = FALSE; } else if ( gTacticalStatus.fEnemySightingOnTheirTurn ) { // Hault guy! - AdjustNoAPToFinishMove( pSoldier, TRUE ); + pSoldier->AdjustNoAPToFinishMove( TRUE ); (*pfKeepMoving ) = FALSE; } // OK, check for other stuff like mines... if (NearbyGroundSeemsWrong( pSoldier, pSoldier->sGridNo, TRUE, &sMineGridNo )) { - if (pSoldier->uiStatusFlags & SOLDIER_PC) + if (pSoldier->flags.uiStatusFlags & SOLDIER_PC) { // NearbyGroundSeemsWrong returns true with gridno NOWHERE if // we find something by metal detector... we should definitely stop @@ -2612,22 +2627,22 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving ) if ( !( gTacticalStatus.uiFlags & INCOMBAT ) ) { INT32 cnt2; - SOLDIERTYPE *pSoldier2; + SOLDIERTYPE *pSoldier2; cnt2 = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pSoldier2 = MercPtrs[ cnt2 ]; cnt2 >= gTacticalStatus.Team[ gbPlayerNum ].bFirstID; cnt2-- ,pSoldier2-- ) - { + { if ( pSoldier2->bActive ) { - EVENT_StopMerc( pSoldier2, pSoldier2->sGridNo, pSoldier2->ubDirection ); + pSoldier2->EVENT_StopMerc( pSoldier2->sGridNo, pSoldier2->ubDirection ); } } } else { - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); } (*pfKeepMoving) = FALSE; @@ -2647,7 +2662,7 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving ) if (sMineGridNo != NOWHERE) { - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); (*pfKeepMoving) = FALSE; gpWorldLevelData[ sMineGridNo ].uiFlags |= MAPELEMENT_ENEMY_MINE_PRESENT; @@ -2674,7 +2689,7 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving ) if (PythSpacesAway( pSoldier->sGridNo, 8842 ) < 11) { // Skyrider has arrived! - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); SetFactTrue( FACT_SKYRIDER_CLOSE_TO_CHOPPER ); TriggerNPCRecord( SKYRIDER, 15 ); SetUpHelicopterForPlayer( 13, MAP_ROW_B ); @@ -2704,7 +2719,7 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving ) // if Joey walks near Martha then trigger Martha record 7 if ( CheckFact( FACT_JOEY_NEAR_MARTHA, 0 ) ) { - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); TriggerNPCRecord( JOEY, 9 ); } } @@ -2724,9 +2739,9 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving ) } } - else if ( pSoldier->bTeam == CIV_TEAM && pSoldier->ubProfile != NO_PROFILE && pSoldier->bNeutral ) + else if ( pSoldier->bTeam == CIV_TEAM && pSoldier->ubProfile != NO_PROFILE && pSoldier->aiData.bNeutral ) { - switch( pSoldier->ubProfile ) + switch( pSoldier->ubProfile ) { case JIM: case JACK: @@ -2761,18 +2776,18 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving ) void SelectNextAvailSoldier( SOLDIERTYPE *pSoldier ) { - INT32 cnt; - SOLDIERTYPE *pTeamSoldier; - BOOLEAN fSoldierFound = FALSE; + INT32 cnt; + SOLDIERTYPE *pTeamSoldier; + BOOLEAN fSoldierFound = FALSE; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("SelectNextAvailSoldier")); // IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED! cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) - { - if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) ) + { + if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) ) { fSoldierFound = TRUE; break; @@ -2799,7 +2814,7 @@ void SelectNextAvailSoldier( SOLDIERTYPE *pSoldier ) void InternalSelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fForceReselect, BOOLEAN fFromUI ) { - SOLDIERTYPE *pSoldier, *pOldSoldier; + SOLDIERTYPE *pSoldier, *pOldSoldier; // ARM: can't call SelectSoldier() in mapscreen, that will initialize interface panels!!! // ATE: Adjusted conditions a bit ( sometimes were not getting selected ) @@ -2861,11 +2876,11 @@ void InternalSelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fF { // Get guy pOldSoldier = MercPtrs[ gusSelectedSoldier ]; - pOldSoldier->fShowLocator = FALSE; - pOldSoldier->fFlashLocator = FALSE; + pOldSoldier->flags.fShowLocator = FALSE; + pOldSoldier->flags.fFlashLocator = FALSE; // DB This used to say pSoldier... I fixed it - if ( pOldSoldier->bLevel == 0 ) + if ( pOldSoldier->pathing.bLevel == 0 ) { //ConcealWalls((INT16)(pSoldier->dXPos/CELL_X_SIZE), (INT16)(pSoldier->dYPos/CELL_Y_SIZE), REVEAL_WALLS_RADIUS); // ApplyTranslucencyToWalls((INT16)(pOldSoldier->dXPos/CELL_X_SIZE), (INT16)(pOldSoldier->dYPos/CELL_Y_SIZE)); @@ -2873,10 +2888,10 @@ void InternalSelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fF } //DeleteSoldierLight( pOldSoldier ); - if(pOldSoldier->uiStatusFlags&SOLDIER_GREEN_RAY) + if(pOldSoldier->flags.uiStatusFlags&SOLDIER_GREEN_RAY) { LightHideRays((INT16)(pOldSoldier->dXPos/CELL_X_SIZE), (INT16)(pOldSoldier->dYPos/CELL_Y_SIZE)); - pOldSoldier->uiStatusFlags &= (~SOLDIER_GREEN_RAY); + pOldSoldier->flags.uiStatusFlags &= (~SOLDIER_GREEN_RAY); } UpdateForContOverPortrait( pOldSoldier, FALSE ); @@ -2887,14 +2902,14 @@ void InternalSelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fF // find which squad this guy is, then set selected squad to this guy SetCurrentSquad( pSoldier -> bAssignment, FALSE ); - if ( pSoldier->bLevel == 0 ) + if ( pSoldier->pathing.bLevel == 0 ) { //RevealWalls((INT16)(pSoldier->dXPos/CELL_X_SIZE), (INT16)(pSoldier->dYPos/CELL_Y_SIZE), REVEAL_WALLS_RADIUS); // CalcTranslucentWalls((INT16)(pSoldier->dXPos/CELL_X_SIZE), (INT16)(pSoldier->dYPos/CELL_Y_SIZE)); //LightTranslucentTrees((INT16)(pSoldier->dXPos/CELL_X_SIZE), (INT16)(pSoldier->dYPos/CELL_Y_SIZE)); } - //SetCheckSoldierLightFlag( pSoldier ); + //pSoldier->SetCheckSoldierLightFlag( ); // Set interface to reflect new selection! SetCurrentTacticalPanelCurrentMerc( (UINT8)usSoldierID ); @@ -2903,7 +2918,7 @@ void InternalSelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fF if ( fAcknowledge ) { if( !gGameSettings.fOptions[ TOPTION_MUTE_CONFIRMATIONS ] ) - DoMercBattleSound( pSoldier, BATTLE_SOUND_ATTN1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_ATTN1 ); } // Change UI mode to reflact that we are selected @@ -2913,9 +2928,9 @@ void InternalSelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fF guiPendingOverrideEvent = M_ON_TERRAIN; } - ChangeInterfaceLevel( pSoldier->bLevel ); + ChangeInterfaceLevel( pSoldier->pathing.bLevel ); - if( pSoldier->fMercAsleep ) + if( pSoldier->flags.fMercAsleep ) { PutMercInAwakeState( pSoldier ); } @@ -2950,10 +2965,10 @@ void SelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fForceRese } -BOOLEAN ResetAllAnimationCache( ) +BOOLEAN ResetAllAnimationCache( ) { - UINT32 cnt; - SOLDIERTYPE *pSoldier; + UINT32 cnt; + SOLDIERTYPE *pSoldier; // Loop through all mercs and make go for ( pSoldier = Menptr, cnt = 0; cnt < TOTAL_SOLDIERS; pSoldier++, cnt++ ) @@ -3013,7 +3028,7 @@ void LocateSoldier( UINT16 usID, BOOLEAN fSetLocator) } -void InternalLocateGridNo( UINT16 sGridNo, BOOLEAN fForce ) +void InternalLocateGridNo( INT16 sGridNo, BOOLEAN fForce ) { INT16 sNewCenterWorldX, sNewCenterWorldY; @@ -3028,7 +3043,7 @@ void InternalLocateGridNo( UINT16 sGridNo, BOOLEAN fForce ) SetRenderCenter( sNewCenterWorldX, sNewCenterWorldY ); } -void LocateGridNo( UINT16 sGridNo ) +void LocateGridNo( INT16 sGridNo ) { InternalLocateGridNo( sGridNo, FALSE ); } @@ -3052,7 +3067,7 @@ void SlideTo(INT16 sGridno, UINT16 usSoldierID , UINT16 usReasonID, BOOLEAN fSet if ( MercPtrs[ cnt ]->bActive && MercPtrs[ cnt ]->bInSector ) { // Remove all existing locators... - MercPtrs[ cnt ]->fFlashLocator = FALSE; + MercPtrs[ cnt ]->flags.fFlashLocator = FALSE; } } } @@ -3100,15 +3115,15 @@ void SlideToLocation( UINT16 usReasonID, INT16 sDestGridNo ) void RebuildAllSoldierShadeTables( ) { - UINT32 cnt; - SOLDIERTYPE *pSoldier; + UINT32 cnt; + SOLDIERTYPE *pSoldier; // Loop through all mercs and make go for ( pSoldier = Menptr, cnt = 0; cnt < TOTAL_SOLDIERS; pSoldier++, cnt++ ) { if ( pSoldier->bActive ) { - CreateSoldierPalettes( pSoldier ); + pSoldier->CreateSoldierPalettes( ); } } @@ -3116,24 +3131,24 @@ void RebuildAllSoldierShadeTables( ) void HandlePlayerTeamMemberDeath( SOLDIERTYPE *pSoldier ) { - INT32 cnt; - INT32 iNewSelectedSoldier = -1; - SOLDIERTYPE *pTeamSoldier; - BOOLEAN fMissionFailed = TRUE; + INT32 cnt; + INT32 iNewSelectedSoldier = -1; + SOLDIERTYPE *pTeamSoldier; + BOOLEAN fMissionFailed = TRUE; INT8 bBuddyIndex; VerifyPublicOpplistDueToDeath( pSoldier ); - ReceivingSoldierCancelServices( pSoldier ); + pSoldier->ReceivingSoldierCancelServices( ); // IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED! cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) - { - if ( pTeamSoldier->bLife >= OKLIFE && pTeamSoldier->bActive && pTeamSoldier->bInSector ) + { + if ( pTeamSoldier->stats.bLife >= OKLIFE && pTeamSoldier->bActive && pTeamSoldier->bInSector ) { iNewSelectedSoldier = cnt; fMissionFailed = FALSE; @@ -3155,8 +3170,8 @@ void HandlePlayerTeamMemberDeath( SOLDIERTYPE *pSoldier ) // see if this was the friend of a living merc cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) - { - if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bLife >= OKLIFE ) + { + if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->stats.bLife >= OKLIFE ) { bBuddyIndex = WhichBuddy( pTeamSoldier->ubProfile, pSoldier->ubProfile ); switch( bBuddyIndex ) @@ -3184,7 +3199,7 @@ void HandlePlayerTeamMemberDeath( SOLDIERTYPE *pSoldier ) { case SLAY: pTeamSoldier = FindSoldierByProfileID( CARMEN, FALSE ); - if (pTeamSoldier && pTeamSoldier->bAttitude == ATTACKSLAYONLY && ClosestPC( pTeamSoldier, NULL ) != NOWHERE ) + if (pTeamSoldier && pTeamSoldier->aiData.bAttitude == ATTACKSLAYONLY && ClosestPC( pTeamSoldier, NULL ) != NOWHERE ) { // Carmen now becomes friendly again TriggerNPCRecord( CARMEN, 29 ); @@ -3233,7 +3248,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) SOLDIERTYPE *pKiller = NULL; BOOLEAN bVisible; - pSoldierOld->uiStatusFlags |= SOLDIER_DEAD; + pSoldierOld->flags.uiStatusFlags |= SOLDIER_DEAD; bVisible = pSoldierOld->bVisible; VerifyPublicOpplistDueToDeath( pSoldierOld ); @@ -3242,10 +3257,10 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) { // mark as dead! gMercProfiles[ pSoldierOld->ubProfile ].bMercStatus = MERC_IS_DEAD; - // + // gMercProfiles[ pSoldierOld->ubProfile ].bLife = 0; - if ( !(pSoldierOld->uiStatusFlags & SOLDIER_VEHICLE) && !TANK( pSoldierOld) ) + if ( !(pSoldierOld->flags.uiStatusFlags & SOLDIER_VEHICLE) && !TANK( pSoldierOld) ) { if ( pSoldierOld->ubAttackerID != NOBODY ) { @@ -3278,7 +3293,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) SetFactTrue( FACT_BRENDA_DEAD ); { pOther = FindSoldierByProfileID( HANS, FALSE ); - if (pOther && pOther->bLife >= OKLIFE && pOther->bNeutral && (SpacesAway( pSoldierOld->sGridNo, pOther->sGridNo ) <= 12) ) + if (pOther && pOther->stats.bLife >= OKLIFE && pOther->aiData.bNeutral && (SpacesAway( pSoldierOld->sGridNo, pOther->sGridNo ) <= 12) ) { TriggerNPCRecord( HANS, 10 ); @@ -3308,11 +3323,11 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) if ( pSoldierOld->ubProfile == DRUGGIST ) { pOther = FindSoldierByProfileID( MANNY, 0 ); - if (pOther && pOther->bActive && pOther->bInSector && pOther->bLife >= OKLIFE ) + if (pOther && pOther->bActive && pOther->bInSector && pOther->stats.bLife >= OKLIFE ) { // try to make sure he isn't cowering etc - pOther->sNoiseGridno = NOWHERE; - pOther->bAlertStatus = STATUS_GREEN; + pOther->aiData.sNoiseGridno = NOWHERE; + pOther->aiData.bAlertStatus = STATUS_GREEN; TriggerNPCRecord( MANNY, 10 ); } } @@ -3327,9 +3342,9 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) break; case ELDIN: - // the security guard... Results in an extra loyalty penalty for Balime (in addition to civilian murder) + // the security guard... Results in an extra loyalty penalty for Balime (in addition to civilian murder) - /* Delayed loyalty effects elimininated. Sep.12/98. ARM + /* Delayed loyalty effects elimininated. Sep.12/98. ARM // create the event value, for town BALIME uiLoyaltyValue = BuildLoyaltyEventValue( BALIME, LOYALTY_PENALTY_ELDIN_KILLED, FALSE ); // post the event, 30 minute delay @@ -3340,12 +3355,12 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) case JOEY: // check to see if Martha can see this pOther = FindSoldierByProfileID( MARTHA, FALSE ); - if ( pOther && (PythSpacesAway( pOther->sGridNo, pSoldierOld->sGridNo ) < 10 || SoldierToSoldierLineOfSightTest( pOther, pSoldierOld, TRUE ) != 0 ) ) + if ( pOther && (PythSpacesAway( pOther->sGridNo, pSoldierOld->sGridNo ) < 10 || SoldierToSoldierLineOfSightTest( pOther, pSoldierOld, TRUE ) != 0 ) ) { // Martha has a heart attack and croaks TriggerNPCRecord( MARTHA, 17 ); - /* Delayed loyalty effects elimininated. Sep.12/98. ARM + /* Delayed loyalty effects elimininated. Sep.12/98. ARM // create the event value, for town CAMBRIA uiLoyaltyValue = BuildLoyaltyEventValue( CAMBRIA, LOYALTY_PENALTY_MARTHA_HEART_ATTACK, FALSE ); // post the event, 30 minute delay @@ -3353,7 +3368,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) */ DecrementTownLoyalty( CAMBRIA, LOYALTY_PENALTY_MARTHA_HEART_ATTACK ); } - else // Martha doesn't see it. She lives, but Joey is found a day or so later anyways + else // Martha doesn't see it. She lives, but Joey is found a day or so later anyways { /* // create the event value, for town CAMBRIA @@ -3407,7 +3422,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) pKiller = MercPtrs[ pSoldierOld->ubAttackerID ]; } - BeginHandleDeidrannaDeath( pKiller, pSoldierOld->sGridNo, pSoldierOld->bLevel ); + BeginHandleDeidrannaDeath( pKiller, pSoldierOld->sGridNo, pSoldierOld->pathing.bLevel ); } // crows/cows are on the civilian team, but none of the following applies to them @@ -3417,7 +3432,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) if ( pSoldierOld->ubAttackerID != NOBODY ) { // handle death of civilian..and if it was intentional - HandleMurderOfCivilian( pSoldierOld, pSoldierOld->fIntendedTarget ); + HandleMurderOfCivilian( pSoldierOld, pSoldierOld->flags.fIntendedTarget ); } } } @@ -3439,7 +3454,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) if ( pSoldierOld->ubAttackerID != NOBODY ) { // also treat this as murder - but player will never be blamed for militia death he didn't cause - HandleMurderOfCivilian( pSoldierOld, pSoldierOld->fIntendedTarget ); + HandleMurderOfCivilian( pSoldierOld, pSoldierOld->flags.fIntendedTarget ); } HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_NATIVE_KILLED, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); @@ -3454,7 +3469,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) { pKiller = MercPtrs[ pSoldierOld->ubAttackerID ]; - BeginHandleQueenBitchDeath( pKiller, pSoldierOld->sGridNo, pSoldierOld->bLevel ); + BeginHandleQueenBitchDeath( pKiller, pSoldierOld->sGridNo, pSoldierOld->pathing.bLevel ); } } @@ -3481,12 +3496,12 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) if ( pSoldierOld->ubProfile == QUEEN ) { - HandleMoraleEvent( NULL, MORALE_DEIDRANNA_KILLED, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); + HandleMoraleEvent( NULL, MORALE_DEIDRANNA_KILLED, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); MaximizeLoyaltyForDeidrannaKilled( ); } else if ( pSoldierOld->ubBodyType == QUEENMONSTER ) { - HandleMoraleEvent( NULL, MORALE_MONSTER_QUEEN_KILLED, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); + HandleMoraleEvent( NULL, MORALE_MONSTER_QUEEN_KILLED, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); IncrementTownLoyaltyEverywhere( LOYALTY_BONUS_KILL_QUEEN_MONSTER ); // Grant experience gain..... @@ -3504,8 +3519,8 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) // if it was a kill by a player's merc if (pSoldierOld->ubAttackerID != NOBODY && MercPtrs[ pSoldierOld->ubAttackerID ]->bTeam == gbPlayerNum ) { - // EXPERIENCE CLASS GAIN: Earned a kill - StatChange( MercPtrs[ pSoldierOld->ubAttackerID ], EXPERAMT, (UINT16)( 10 * pSoldierOld->bExpLevel ), FALSE ); + // EXPERIENCE CLASS GAIN: Earned a kill + StatChange( MercPtrs[ pSoldierOld->ubAttackerID ], EXPERAMT, (UINT16)( 10 * pSoldierOld->stats.bExpLevel ), FALSE ); } // JA2 Gold: if previous and current attackers are the same, the next-to-previous attacker gets the assist @@ -3521,8 +3536,8 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) // if it was assisted by a player's merc if (ubAssister != NOBODY && MercPtrs[ ubAssister ]->bTeam == gbPlayerNum ) { - // EXPERIENCE CLASS GAIN: Earned an assist - StatChange( MercPtrs[ ubAssister ], EXPERAMT, (UINT16)( 5 * pSoldierOld->bExpLevel ), FALSE ); + // EXPERIENCE CLASS GAIN: Earned an assist + StatChange( MercPtrs[ ubAssister ], EXPERAMT, (UINT16)( 5 * pSoldierOld->stats.bExpLevel ), FALSE ); } } @@ -3544,13 +3559,13 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) UINT8 LastActiveTeamMember( UINT8 ubTeam ) { INT32 cnt; - SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pSoldier; cnt = gTacticalStatus.Team[ ubTeam ].bLastID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pSoldier = MercPtrs[ cnt ]; cnt >= gTacticalStatus.Team[ ubTeam ].bFirstID; cnt-- ,pSoldier--) - { + { if ( pSoldier->bActive ) { return( (INT8)cnt ); @@ -3563,7 +3578,7 @@ UINT8 LastActiveTeamMember( UINT8 ubTeam ) void CheckForPotentialAddToBattleIncrement( SOLDIERTYPE *pSoldier ) { // Check if we are a threat! - if ( !pSoldier->bNeutral && (pSoldier->bSide != gbPlayerNum ) ) + if ( !pSoldier->aiData.bNeutral && (pSoldier->bSide != gbPlayerNum ) ) { //if ( FindObjClass( pSoldier, IC_WEAPON ) != NO_SLOT ) // We need to exclude cases where a kid is not neutral anymore, but is defenceless! @@ -3577,7 +3592,7 @@ void CheckForPotentialAddToBattleIncrement( SOLDIERTYPE *pSoldier ) case HICKS_CIV_GROUP: if ( FindObjClass( pSoldier, IC_WEAPON ) != NO_SLOT ) { - gTacticalStatus.bNumFoughtInBattle[ pSoldier->bTeam ]++; + gTacticalStatus.bNumFoughtInBattle[ pSoldier->bTeam ]++; } break; default: @@ -3596,7 +3611,7 @@ void CheckForPotentialAddToBattleIncrement( SOLDIERTYPE *pSoldier ) // internal function for turning neutral to FALSE void SetSoldierNonNeutral( SOLDIERTYPE * pSoldier ) { - pSoldier->bNeutral = FALSE; + pSoldier->aiData.bNeutral = FALSE; if ( gTacticalStatus.bBoxingState == NOT_BOXING ) { @@ -3608,7 +3623,7 @@ void SetSoldierNonNeutral( SOLDIERTYPE * pSoldier ) // internal function for turning neutral to TRUE void SetSoldierNeutral( SOLDIERTYPE * pSoldier ) { - pSoldier->bNeutral = TRUE; + pSoldier->aiData.bNeutral = TRUE; if ( gTacticalStatus.bBoxingState == NOT_BOXING ) { @@ -3624,7 +3639,7 @@ void MakeCivHostile( SOLDIERTYPE *pSoldier, INT8 bNewSide ) { if ( pSoldier->ubBodyType == COW ) { - return; + return; } // override passed-in value; default is hostile to player, allied to army @@ -3661,7 +3676,7 @@ void MakeCivHostile( SOLDIERTYPE *pSoldier, INT8 bNewSide ) break; } - if ( !pSoldier->bNeutral && bNewSide == pSoldier->bSide ) + if ( !pSoldier->aiData.bNeutral && bNewSide == pSoldier->bSide ) { // already hostile! return; @@ -3681,24 +3696,24 @@ void MakeCivHostile( SOLDIERTYPE *pSoldier, INT8 bNewSide ) // if Maria is in the sector and escorted, set fact that the escape has // been noticed if ( gubQuest[ QUEST_RESCUE_MARIA ] == QUESTINPROGRESS && gTacticalStatus.bBoxingState == NOT_BOXING ) - { + { SOLDIERTYPE * pMaria = FindSoldierByProfileID( MARIA, FALSE ); if ( pMaria && pMaria->bActive && pMaria->bInSector ) { SetFactTrue( FACT_MARIA_ESCAPE_NOTICED ); } - } + } } if (pSoldier->ubProfile == BILLY) { // change orders - pSoldier->bOrders = FARPATROL; + pSoldier->aiData.bOrders = FARPATROL; } if (bNewSide != -1) { pSoldier->bSide = bNewSide; } - if ( pSoldier->bNeutral ) + if ( pSoldier->aiData.bNeutral ) { SetSoldierNonNeutral( pSoldier ); RecalculateOppCntsDueToNoLongerNeutral( pSoldier ); @@ -3727,22 +3742,22 @@ UINT8 CivilianGroupMembersChangeSidesWithinProximity( SOLDIERTYPE * pAttacked ) cnt = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; cnt++ ,pSoldier++ ) { - if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife && pSoldier->bNeutral ) + if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife && pSoldier->aiData.bNeutral ) { if ( pSoldier->ubCivilianGroup == pAttacked->ubCivilianGroup && pSoldier->ubBodyType != COW ) { // if in LOS of this guy's attacker - if ( (pAttacked->ubAttackerID != NOBODY && pSoldier->bOppList[pAttacked->ubAttackerID] == SEEN_CURRENTLY) - || ( PythSpacesAway( pSoldier->sGridNo, pAttacked->sGridNo ) < pAttacked->GetMaxDistanceVisible(pSoldier->sGridNo, pSoldier->bLevel) ) - || ( pAttacked->ubAttackerID != NOBODY && PythSpacesAway( pSoldier->sGridNo, MercPtrs[ pAttacked->ubAttackerID ]->sGridNo ) < pAttacked->GetMaxDistanceVisible(MercPtrs[ pAttacked->ubAttackerID ]->sGridNo, MercPtrs[ pAttacked->ubAttackerID ]->bLevel) ) ) + if ( (pAttacked->ubAttackerID != NOBODY && pSoldier->aiData.bOppList[pAttacked->ubAttackerID] == SEEN_CURRENTLY) + || ( PythSpacesAway( pSoldier->sGridNo, pAttacked->sGridNo ) < pAttacked->GetMaxDistanceVisible(pSoldier->sGridNo, pSoldier->pathing.bLevel) ) + || ( pAttacked->ubAttackerID != NOBODY && PythSpacesAway( pSoldier->sGridNo, MercPtrs[ pAttacked->ubAttackerID ]->sGridNo ) < pAttacked->GetMaxDistanceVisible(MercPtrs[ pAttacked->ubAttackerID ]->sGridNo, MercPtrs[ pAttacked->ubAttackerID ]->pathing.bLevel) ) ) { MakeCivHostile( pSoldier, 2 ); - if ( pSoldier->bOppCnt > 0 ) + if ( pSoldier->aiData.bOppCnt > 0 ) { AddToShouldBecomeHostileOrSayQuoteList( pSoldier->ubID ); } - if ( pSoldier->ubProfile != NO_PROFILE && pSoldier->bOppCnt > 0 && ( ubFirstProfile == NO_PROFILE || Random( 2 ) ) ) + if ( pSoldier->ubProfile != NO_PROFILE && pSoldier->aiData.bOppCnt > 0 && ( ubFirstProfile == NO_PROFILE || Random( 2 ) ) ) { ubFirstProfile = pSoldier->ubProfile; } @@ -3773,7 +3788,7 @@ SOLDIERTYPE * CivilianGroupMemberChangesSides( SOLDIERTYPE * pAttacked ) cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++ ,pSoldier++) { - if (pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife) + if (pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife) { if (pSoldier->ubCivilianGroup == pAttacked->ubCivilianGroup) { @@ -3833,7 +3848,6 @@ void CivilianGroupChangesSides( UINT8 ubCivilianGroup ) // change civ group side due to external event (wall blowing up) INT32 cnt; SOLDIERTYPE * pSoldier; - UINT8 ubFirstProfile = NO_PROFILE; gTacticalStatus.fCivGroupHostile[ ubCivilianGroup ] = CIV_GROUP_HOSTILE; @@ -3841,17 +3855,17 @@ void CivilianGroupChangesSides( UINT8 ubCivilianGroup ) cnt = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; cnt++ ,pSoldier++) { - if (pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife && pSoldier->bNeutral) + if (pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife && pSoldier->aiData.bNeutral) { if ( pSoldier->ubCivilianGroup == ubCivilianGroup && pSoldier->ubBodyType != COW ) - { + { MakeCivHostile( pSoldier, 2 ); - if ( pSoldier->bOppCnt > 0 ) + if ( pSoldier->aiData.bOppCnt > 0 ) { AddToShouldBecomeHostileOrSayQuoteList( pSoldier->ubID ); } /* - if ( (pSoldier->ubProfile != NO_PROFILE) && (pSoldier->bOppCnt > 0) && ( ubFirstProfile == NO_PROFILE || Random( 2 ) ) ) + if ( (pSoldier->ubProfile != NO_PROFILE) && (pSoldier->aiData.bOppCnt > 0) && ( ubFirstProfile == NO_PROFILE || Random( 2 ) ) ) { ubFirstProfile = pSoldier->ubProfile; } @@ -3877,7 +3891,7 @@ void HickCowAttacked( SOLDIERTYPE * pNastyGuy, SOLDIERTYPE * pTarget ) cnt = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; cnt++ ,pSoldier++) { - if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife && pSoldier->bNeutral && pSoldier->ubCivilianGroup == HICKS_CIV_GROUP ) + if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife && pSoldier->aiData.bNeutral && pSoldier->ubCivilianGroup == HICKS_CIV_GROUP ) { if ( SoldierToSoldierLineOfSightTest( pSoldier, pNastyGuy, TRUE ) ) { @@ -3904,7 +3918,7 @@ void MilitiaChangesSides( void ) cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++ ,pSoldier++) { - if (pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife) + if (pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife) { if ( (gWorldSectorX ==0 && gWorldSectorY == 0) || !NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) ) MakeCivHostile( pSoldier, 2 ); @@ -3933,14 +3947,14 @@ gTacticalStatus.fCivGroupHostile[ ubLoop ] = CIV_GROUP_HOSTILE; INT8 NumActiveAndConsciousTeamMembers( UINT8 ubTeam ) { INT32 cnt; - SOLDIERTYPE *pSoldier; - UINT8 ubCount = 0; + SOLDIERTYPE *pSoldier; + UINT8 ubCount = 0; cnt = gTacticalStatus.Team[ ubTeam ].bFirstID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ ubTeam ].bLastID; cnt++,pSoldier++) - { + { if ( OK_CONTROLLABLE_MERC( pSoldier) ) { ubCount++; @@ -3953,16 +3967,16 @@ INT8 NumActiveAndConsciousTeamMembers( UINT8 ubTeam ) UINT8 FindNextActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ) { - UINT8 bLastTeamID; + UINT8 bLastTeamID; INT32 cnt; - SOLDIERTYPE *pTeamSoldier; + SOLDIERTYPE *pTeamSoldier; cnt = pSoldier->ubID + 1; bLastTeamID = gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pTeamSoldier++) - { + { if ( fOnlyRegularMercs ) { if ( pTeamSoldier->bActive && ( AM_AN_EPC( pTeamSoldier ) || AM_A_ROBOT( pTeamSoldier ) ) ) @@ -3973,7 +3987,7 @@ UINT8 FindNextActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKL if ( fGoodForLessOKLife ) { - if ( pTeamSoldier->bLife > 0 && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bTeam == gbPlayerNum && pTeamSoldier->bAssignment < ON_DUTY && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) + if ( pTeamSoldier->stats.bLife > 0 && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bTeam == gbPlayerNum && pTeamSoldier->bAssignment < ON_DUTY && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) { return( (UINT8)cnt ); } @@ -3993,7 +4007,7 @@ UINT8 FindNextActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKL bLastTeamID = pSoldier->ubID; for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pTeamSoldier++) - { + { if ( fOnlyRegularMercs ) { if ( pTeamSoldier->bActive && ( AM_AN_EPC( pTeamSoldier ) || AM_A_ROBOT( pTeamSoldier ) ) ) @@ -4004,7 +4018,7 @@ UINT8 FindNextActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKL if ( fGoodForLessOKLife ) { - if ( pTeamSoldier->bLife > 0 && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bTeam == gbPlayerNum && pTeamSoldier->bAssignment < ON_DUTY && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) + if ( pTeamSoldier->stats.bLife > 0 && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bTeam == gbPlayerNum && pTeamSoldier->bAssignment < ON_DUTY && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) { return( (UINT8)cnt ); } @@ -4029,11 +4043,11 @@ SOLDIERTYPE *FindNextActiveSquad( SOLDIERTYPE *pSoldier ) INT32 cnt, cnt2; - for( cnt = pSoldier->bAssignment + 1 ; cnt < NUMBER_OF_SQUADS; cnt++ ) + for( cnt = pSoldier->bAssignment + 1 ; cnt < NUMBER_OF_SQUADS; cnt++ ) { for( cnt2 =0; cnt2 < NUMBER_OF_SOLDIERS_PER_SQUAD; cnt2++ ) { - if ( Squad[ cnt ][ cnt2 ] != NULL && Squad[ cnt ][ cnt2 ]->bInSector && OK_INTERRUPT_MERC( Squad[ cnt ][ cnt2 ] ) && OK_CONTROLLABLE_MERC( Squad[ cnt ][ cnt2 ] ) && !(Squad[ cnt ][ cnt2 ]->uiStatusFlags & SOLDIER_VEHICLE) ) + if ( Squad[ cnt ][ cnt2 ] != NULL && Squad[ cnt ][ cnt2 ]->bInSector && OK_INTERRUPT_MERC( Squad[ cnt ][ cnt2 ] ) && OK_CONTROLLABLE_MERC( Squad[ cnt ][ cnt2 ] ) && !(Squad[ cnt ][ cnt2 ]->flags.uiStatusFlags & SOLDIER_VEHICLE) ) { return( Squad[ cnt ][ cnt2 ] ); } @@ -4046,7 +4060,7 @@ SOLDIERTYPE *FindNextActiveSquad( SOLDIERTYPE *pSoldier ) { for( cnt2 =0; cnt2 < NUMBER_OF_SOLDIERS_PER_SQUAD; cnt2++ ) { - if ( Squad[ cnt ][ cnt2 ] != NULL && Squad[ cnt ][ cnt2 ]->bInSector && OK_INTERRUPT_MERC( Squad[ cnt ][ cnt2 ] ) && OK_CONTROLLABLE_MERC( Squad[ cnt ][ cnt2 ] ) && !(Squad[ cnt ][ cnt2 ]->uiStatusFlags & SOLDIER_VEHICLE) ) + if ( Squad[ cnt ][ cnt2 ] != NULL && Squad[ cnt ][ cnt2 ]->bInSector && OK_INTERRUPT_MERC( Squad[ cnt ][ cnt2 ] ) && OK_CONTROLLABLE_MERC( Squad[ cnt ][ cnt2 ] ) && !(Squad[ cnt ][ cnt2 ]->flags.uiStatusFlags & SOLDIER_VEHICLE) ) { return( Squad[ cnt ][ cnt2 ] ); } @@ -4059,11 +4073,11 @@ SOLDIERTYPE *FindNextActiveSquad( SOLDIERTYPE *pSoldier ) } -UINT8 FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ) +UINT8 FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ) { - UINT8 bLastTeamID; + UINT8 bLastTeamID; INT32 cnt; - SOLDIERTYPE *pTeamSoldier; + SOLDIERTYPE *pTeamSoldier; // loop back @@ -4071,7 +4085,7 @@ UINT8 FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKL cnt = pSoldier->ubID - 1; for ( pTeamSoldier = MercPtrs[ cnt ]; cnt >= bLastTeamID; cnt--,pTeamSoldier-- ) - { + { if ( fOnlyRegularMercs ) { if ( AM_AN_EPC( pTeamSoldier ) || AM_A_ROBOT( pTeamSoldier ) ) @@ -4083,7 +4097,7 @@ UINT8 FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKL if ( fGoodForLessOKLife ) { // Check for bLife > 0 - if ( pTeamSoldier->bLife > 0 && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bTeam == gbPlayerNum && pTeamSoldier->bAssignment < ON_DUTY && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) + if ( pTeamSoldier->stats.bLife > 0 && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bTeam == gbPlayerNum && pTeamSoldier->bAssignment < ON_DUTY && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) { return( (UINT8)cnt ); } @@ -4100,9 +4114,9 @@ UINT8 FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKL bLastTeamID = pSoldier->ubID; cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pTeamSoldier = MercPtrs[ cnt ]; cnt >= bLastTeamID; cnt--,pTeamSoldier-- ) - { + { if ( fOnlyRegularMercs ) { if ( AM_AN_EPC( pTeamSoldier ) || AM_A_ROBOT( pTeamSoldier ) ) @@ -4113,7 +4127,7 @@ UINT8 FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKL if ( fGoodForLessOKLife ) { - if ( pTeamSoldier->bLife > 0 && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bTeam == gbPlayerNum && pTeamSoldier->bAssignment < ON_DUTY && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) + if ( pTeamSoldier->stats.bLife > 0 && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bTeam == gbPlayerNum && pTeamSoldier->bAssignment < ON_DUTY && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) { return( (UINT8)cnt ); } @@ -4136,18 +4150,18 @@ UINT8 FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKL BOOLEAN CheckForPlayerTeamInMissionExit( ) { INT32 cnt; - SOLDIERTYPE *pSoldier; - UINT8 bGuysIn = 0; + SOLDIERTYPE *pSoldier; + UINT8 bGuysIn = 0; // End the turn of player charactors cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) - { - if ( pSoldier->bActive && pSoldier->bLife >= OKLIFE ) + { + if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE ) { - if ( pSoldier->fInMissionExitNode ) + if ( pSoldier->flags.fInMissionExitNode ) { bGuysIn++; } @@ -4181,7 +4195,7 @@ void EndTacticalDemo( ) UINT32 EnterTacticalDemoMode() { UINT8 ubNewScene = gubCurrentScene; - UINT8 ubNumScenes = NUM_RANDOM_SCENES; + UINT8 ubNumScenes = NUM_RANDOM_SCENES; gTacticalStatus.uiTimeOfLastInput = GetJA2Clock(); @@ -4223,7 +4237,7 @@ UINT32 EnterTacticalDemoMode() } -CHAR8 *GetSceneFilename( ) +CHAR8 *GetSceneFilename( ) { return( gzLevelFilenames[ gubCurrentScene ] ); } @@ -4235,7 +4249,7 @@ INT16 NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT16 sGridNo, BOOLEAN fPeop { UINT8 bPerson; STRUCTURE * pStructure; - INT16 sDesiredLevel; + INT16 sDesiredLevel; BOOLEAN fOKCheckStruct; if ( !GridNoOnVisibleWorldTile( sGridNo ) ) @@ -4252,17 +4266,17 @@ INT16 NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT16 sGridNo, BOOLEAN fPeop if ( pCurrSoldier->bTeam == gbPlayerNum ) { if ( ( Menptr[ bPerson ].bVisible >= 0) || ( gTacticalStatus.uiFlags & SHOW_ALL_MERCS ) ) - return( FALSE ); // if someone there it's NOT OK + return( FALSE ); // if someone there it's NOT OK } else { - return( FALSE ); // if someone there it's NOT OK + return( FALSE ); // if someone there it's NOT OK } } } // Check structure database - if ( (pCurrSoldier->uiStatusFlags & SOLDIER_MULTITILE) && !(gfEstimatePath) ) + if ( (pCurrSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE) && !(gfEstimatePath) ) { UINT16 usAnimSurface; STRUCTURE_FILE_REF * pStructureFileRef; @@ -4334,7 +4348,7 @@ INT16 NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT16 sGridNo, BOOLEAN fPeop fOKCheckStruct = TRUE; // Check if this is a multi-tile - if ( ( pStructure->fFlags & STRUCTURE_MOBILE ) && ( pCurrSoldier->uiStatusFlags & SOLDIER_MULTITILE ) ) + if ( ( pStructure->fFlags & STRUCTURE_MOBILE ) && ( pCurrSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE ) ) { // Check IDs with soldier's ID if ( pCurrSoldier->pLevelNode != NULL && pCurrSoldier->pLevelNode->pStructureData != NULL && pCurrSoldier->pLevelNode->pStructureData->usStructureID == pStructure->usStructureID ) @@ -4364,7 +4378,7 @@ INT16 NewOKDestinationAndDirection( SOLDIERTYPE * pCurrSoldier, INT16 sGridNo, I { UINT8 bPerson; STRUCTURE * pStructure; - INT16 sDesiredLevel; + INT16 sDesiredLevel; BOOLEAN fOKCheckStruct; if (fPeopleToo && ( bPerson = WhoIsThere2( sGridNo, bLevel ) ) != NOBODY ) @@ -4376,17 +4390,17 @@ INT16 NewOKDestinationAndDirection( SOLDIERTYPE * pCurrSoldier, INT16 sGridNo, I if ( pCurrSoldier->bTeam == gbPlayerNum ) { if ( ( Menptr[ bPerson ].bVisible >= 0) || ( gTacticalStatus.uiFlags & SHOW_ALL_MERCS ) ) - return( FALSE ); // if someone there it's NOT OK + return( FALSE ); // if someone there it's NOT OK } else { - return( FALSE ); // if someone there it's NOT OK + return( FALSE ); // if someone there it's NOT OK } } } // Check structure database - if ( ( pCurrSoldier->uiStatusFlags & SOLDIER_MULTITILE ) && !(gfEstimatePath) ) + if ( ( pCurrSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE ) && !(gfEstimatePath) ) { UINT16 usAnimSurface; STRUCTURE_FILE_REF * pStructureFileRef; @@ -4414,7 +4428,7 @@ INT16 NewOKDestinationAndDirection( SOLDIERTYPE * pCurrSoldier, INT16 sGridNo, I usStructureID = pCurrSoldier->pLevelNode->pStructureData->usStructureID; } - fOk = InternalOkayToAddStructureToWorld( sGridNo, pCurrSoldier->bLevel, &(pStructureFileRef->pDBStructureRef[ gOneCDirection[ bLoop ] ]), usStructureID, (BOOLEAN)!fPeopleToo ); + fOk = InternalOkayToAddStructureToWorld( sGridNo, pCurrSoldier->pathing.bLevel, &(pStructureFileRef->pDBStructureRef[ gOneCDirection[ bLoop ] ]), usStructureID, (BOOLEAN)!fPeopleToo ); if (fOk) { return( TRUE ); @@ -4456,7 +4470,7 @@ INT16 NewOKDestinationAndDirection( SOLDIERTYPE * pCurrSoldier, INT16 sGridNo, I fOKCheckStruct = TRUE; // Check if this is a multi-tile - if ( ( pStructure->fFlags & STRUCTURE_MOBILE ) && ( pCurrSoldier->uiStatusFlags & SOLDIER_MULTITILE ) ) + if ( ( pStructure->fFlags & STRUCTURE_MOBILE ) && ( pCurrSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE ) ) { // Check IDs with soldier's ID if ( pCurrSoldier->pLevelNode != NULL && pCurrSoldier->pLevelNode->pStructureData != NULL && pCurrSoldier->pLevelNode->pStructureData->usStructureID == pStructure->usStructureID ) @@ -4504,11 +4518,11 @@ BOOLEAN FlatRoofAboveGridNo( INT32 iMapIndex ) //Kris: -//ASSUMPTION: This function assumes that we are checking on behalf of a single tiled merc. This function -// should not be used for checking on behalf of multi-tiled "things". -//I wrote this function for editor use. I don't personally care about multi-tiled stuff. All I want -//to know is whether or not I can put a merc here. In most cases, I won't be dealing with multi-tiled -//mercs, and the rarity doesn't justify the needs. I just wrote this to be quick and dirty, and I don't +//ASSUMPTION: This function assumes that we are checking on behalf of a single tiled merc. This function +// should not be used for checking on behalf of multi-tiled "things". +//I wrote this function for editor use. I don't personally care about multi-tiled stuff. All I want +//to know is whether or not I can put a merc here. In most cases, I won't be dealing with multi-tiled +//mercs, and the rarity doesn't justify the needs. I just wrote this to be quick and dirty, and I don't //expect it to perform perfectly in all situations. BOOLEAN IsLocationSittable( INT32 iMapIndex, BOOLEAN fOnRoof ) { @@ -4570,7 +4584,7 @@ BOOLEAN TeamMemberNear(INT8 bTeam, INT16 sGridNo, INT32 iRange) for (bLoop=gTacticalStatus.Team[bTeam].bFirstID, pSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[bTeam].bLastID; bLoop++, pSoldier++) { - if (pSoldier->bActive && pSoldier->bInSector && (pSoldier->bLife >= OKLIFE) && !( pSoldier->uiStatusFlags & SOLDIER_GASSED ) ) + if (pSoldier->bActive && pSoldier->bInSector && (pSoldier->stats.bLife >= OKLIFE) && !( pSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) ) { if (PythSpacesAway(pSoldier->sGridNo,sGridNo) <= iRange) { @@ -4596,12 +4610,12 @@ INT16 FindAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pubDirect //INT32 cnt; INT16 sClosest=NOWHERE, sSpot, sOkTest; INT16 sCloseGridNo=NOWHERE; - UINT32 uiMercFlags; - UINT16 usSoldierIndex; - UINT8 ubDir; - STRUCTURE *pDoor; - //STRUCTURE *pWall; - UINT8 ubWallOrientation; + UINT32 uiMercFlags; + UINT16 usSoldierIndex; + UINT8 ubDir; + STRUCTURE *pDoor; + //STRUCTURE *pWall; + UINT8 ubWallOrientation; BOOLEAN fCheckGivenGridNo = TRUE; UINT8 ubTestDirection; EXITGRID ExitGrid; @@ -4646,7 +4660,7 @@ INT16 FindAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pubDirect if (pubDirection) { (*pubDirection) = (UINT8)GetDirectionFromGridNo( sSpot, pSoldier ); - } + } } if ( ubWallOrientation == OUTSIDE_TOP_RIGHT || ubWallOrientation == INSIDE_TOP_RIGHT ) @@ -4677,7 +4691,7 @@ INT16 FindAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pubDirect if ( fForceToPerson ) { - if ( FindSoldier( sGridNo, &usSoldierIndex, &uiMercFlags, FIND_SOLDIER_GRIDNO ) ) + if ( FindSoldier( sGridNo, &usSoldierIndex, &uiMercFlags, FIND_SOLDIER_GRIDNO ) ) { sGridNo = MercPtrs[ usSoldierIndex ]->sGridNo; if ( psAdjustedGridNo != NULL ) @@ -4690,11 +4704,11 @@ INT16 FindAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pubDirect (*pubDirection) = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier ); } } - } - } + } + } - if ( ( sOkTest = NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->bLevel ) ) > 0) // no problem going there! nobody on it! + if ( ( sOkTest = NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) ) > 0) // no problem going there! nobody on it! { // OK, if we are looking to goto a switch, ignore this.... if ( pDoor ) @@ -4716,17 +4730,17 @@ INT16 FindAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pubDirect if ( fCheckGivenGridNo ) { - sDistance = PlotPath( pSoldier, sGridNo, NO_COPYROUTE, NO_PLOT, TEMPORARY, (INT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ); + sDistance = PlotPath( pSoldier, sGridNo, NO_COPYROUTE, NO_PLOT, TEMPORARY, (INT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ); if ( sDistance > 0 ) - { + { - if ( sDistance < sClosest ) - { - sClosest = sDistance; - sCloseGridNo = sGridNo; - } - } + if ( sDistance < sClosest ) + { + sClosest = sDistance; + sCloseGridNo = sGridNo; + } + } } } @@ -4746,7 +4760,7 @@ INT16 FindAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pubDirect if( fDoor ) { - if ( gubWorldMovementCosts[ sSpot ][ ubTestDirection ][ pSoldier->bLevel ] >= TRAVELCOST_BLOCKED ) + if ( gubWorldMovementCosts[ sSpot ][ ubTestDirection ][ pSoldier->pathing.bLevel ] >= TRAVELCOST_BLOCKED ) { // obstacle or wall there! continue; @@ -4755,11 +4769,11 @@ INT16 FindAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pubDirect else { // this function returns original MP cost if not a door cost - if ( DoorTravelCost( pSoldier, sSpot, gubWorldMovementCosts[ sSpot ][ ubTestDirection ][ pSoldier->bLevel ], FALSE, NULL ) >= TRAVELCOST_BLOCKED ) - { - // obstacle or wall there! - continue; - } + if ( DoorTravelCost( pSoldier, sSpot, gubWorldMovementCosts[ sSpot ][ ubTestDirection ][ pSoldier->pathing.bLevel ], FALSE, NULL ) >= TRAVELCOST_BLOCKED ) + { + // obstacle or wall there! + continue; + } } // Eliminate some directions if we are looking at doors! @@ -4768,18 +4782,18 @@ INT16 FindAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pubDirect // Get orinetation ubWallOrientation = pDoor->ubWallOrientation; - // Refuse the south and north and west directions if our orientation is top-right + // Refuse the south and north and west directions if our orientation is top-right if ( ubWallOrientation == OUTSIDE_TOP_RIGHT || ubWallOrientation == INSIDE_TOP_RIGHT ) { if ( sDirs[ cnt ] == NORTH || sDirs[ cnt ] == WEST || sDirs[ cnt ] == SOUTH ) - continue; + continue; } // Refuse the north and west and east directions if our orientation is top-right if ( ubWallOrientation == OUTSIDE_TOP_LEFT || ubWallOrientation == INSIDE_TOP_LEFT ) { if ( sDirs[ cnt ] == NORTH || sDirs[ cnt ] == WEST || sDirs[ cnt ] == EAST ) - continue; + continue; } } @@ -4791,26 +4805,26 @@ INT16 FindAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pubDirect // OK, at least get direction to face...... // Defaults to soldier's facing dir unless we change it! //if ( pDoor != NULL ) - { - // Use direction to the door! - if (pubDirection) + { + // Use direction to the door! + if (pubDirection) { (*pubDirection) = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier ); } - } - return( sSpot ); + } + return( sSpot ); } // don't store path, just measure it - ubDir = (UINT8)GetDirectionToGridNoFromGridNo( sSpot, sGridNo ); + ubDir = (UINT8)GetDirectionToGridNoFromGridNo( sSpot, sGridNo ); - if ( ( NewOKDestinationAndDirection( pSoldier, sSpot, ubDir, TRUE, pSoldier->bLevel ) > 0 ) && - ( ( sDistance = PlotPath( pSoldier, sSpot, NO_COPYROUTE, NO_PLOT, TEMPORARY, (INT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ) ) > 0 ) ) + if ( ( NewOKDestinationAndDirection( pSoldier, sSpot, ubDir, TRUE, pSoldier->pathing.bLevel ) > 0 ) && + ( ( sDistance = PlotPath( pSoldier, sSpot, NO_COPYROUTE, NO_PLOT, TEMPORARY, (INT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ) ) > 0 ) ) { if ( sDistance < sClosest ) { - sClosest = sDistance; - sCloseGridNo = (INT16)sSpot; + sClosest = sDistance; + sCloseGridNo = (INT16)sSpot; } } } @@ -4884,11 +4898,11 @@ INT16 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pub //INT32 cnt; INT16 sClosest=WORLD_MAX, sSpot, sSpot2, sOkTest; INT16 sCloseGridNo=NOWHERE; - UINT32 uiMercFlags; - UINT16 usSoldierIndex; - UINT8 ubDir; - STRUCTURE *pDoor; - UINT8 ubWallOrientation; + UINT32 uiMercFlags; + UINT16 usSoldierIndex; + UINT8 ubDir; + STRUCTURE *pDoor; + UINT8 ubWallOrientation; BOOLEAN fCheckGivenGridNo = TRUE; UINT8 ubTestDirection; UINT8 ubWhoIsThere; @@ -4918,18 +4932,18 @@ INT16 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pub if ( fForceToPerson ) { - if ( FindSoldier( sGridNo, &usSoldierIndex, &uiMercFlags, FIND_SOLDIER_GRIDNO ) ) + if ( FindSoldier( sGridNo, &usSoldierIndex, &uiMercFlags, FIND_SOLDIER_GRIDNO ) ) { sGridNo = MercPtrs[ usSoldierIndex ]->sGridNo; if ( psAdjustedGridNo != NULL ) { *psAdjustedGridNo = sGridNo; } - } - } + } + } - if ( ( sOkTest = NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->bLevel ) ) > 0) // no problem going there! nobody on it! + if ( ( sOkTest = NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) ) > 0) // no problem going there! nobody on it! { // OK, if we are looking to goto a switch, ignore this.... if ( pDoor ) @@ -4943,17 +4957,17 @@ INT16 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pub if ( fCheckGivenGridNo ) { - sDistance = PlotPath( pSoldier, sGridNo, NO_COPYROUTE, NO_PLOT, TEMPORARY, (INT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ); + sDistance = PlotPath( pSoldier, sGridNo, NO_COPYROUTE, NO_PLOT, TEMPORARY, (INT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ); if ( sDistance > 0 ) - { + { - if ( sDistance < sClosest ) - { - sClosest = sDistance; - sCloseGridNo = (INT16)sGridNo; - } - } + if ( sDistance < sClosest ) + { + sClosest = sDistance; + sCloseGridNo = (INT16)sGridNo; + } + } } } @@ -4970,13 +4984,13 @@ INT16 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pub ubTestDirection = gOppositeDirection[ ubTestDirection ]; } - if ( gubWorldMovementCosts[ sSpot ][ ubTestDirection ][ pSoldier->bLevel ] >= TRAVELCOST_BLOCKED ) + if ( gubWorldMovementCosts[ sSpot ][ ubTestDirection ][ pSoldier->pathing.bLevel ] >= TRAVELCOST_BLOCKED ) { // obstacle or wall there! continue; } - ubWhoIsThere = WhoIsThere2( sSpot, pSoldier->bLevel ); + ubWhoIsThere = WhoIsThere2( sSpot, pSoldier->pathing.bLevel ); if ( ubWhoIsThere != NOBODY && ubWhoIsThere != pSoldier->ubID ) { // skip this direction b/c it's blocked by another merc! @@ -4989,31 +5003,31 @@ INT16 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pub // Get orinetation ubWallOrientation = pDoor->ubWallOrientation; - // Refuse the south and north and west directions if our orientation is top-right + // Refuse the south and north and west directions if our orientation is top-right if ( ubWallOrientation == OUTSIDE_TOP_RIGHT || ubWallOrientation == INSIDE_TOP_RIGHT ) { if ( sDirs[ cnt ] == NORTH || sDirs[ cnt ] == WEST || sDirs[ cnt ] == SOUTH ) - continue; + continue; } // Refuse the north and west and east directions if our orientation is top-right if ( ubWallOrientation == OUTSIDE_TOP_LEFT || ubWallOrientation == INSIDE_TOP_LEFT ) { if ( sDirs[ cnt ] == NORTH || sDirs[ cnt ] == WEST || sDirs[ cnt ] == EAST ) - continue; + continue; } } // first tile is okay, how about the second? sSpot2 = NewGridNo( sSpot, DirectionInc( sDirs[ cnt ] ) ); - if ( gubWorldMovementCosts[ sSpot2 ][ sDirs[cnt] ][ pSoldier->bLevel ] >= TRAVELCOST_BLOCKED || - DoorTravelCost( pSoldier, sSpot2, gubWorldMovementCosts[ sSpot2 ][ sDirs[cnt] ][ pSoldier->bLevel ], (BOOLEAN) (pSoldier->bTeam == gbPlayerNum), NULL ) == TRAVELCOST_DOOR ) // closed door blocks! + if ( gubWorldMovementCosts[ sSpot2 ][ sDirs[cnt] ][ pSoldier->pathing.bLevel ] >= TRAVELCOST_BLOCKED || + DoorTravelCost( pSoldier, sSpot2, gubWorldMovementCosts[ sSpot2 ][ sDirs[cnt] ][ pSoldier->pathing.bLevel ], (BOOLEAN) (pSoldier->bTeam == gbPlayerNum), NULL ) == TRAVELCOST_DOOR ) // closed door blocks! { // obstacle or wall there! continue; } - ubWhoIsThere = WhoIsThere2( sSpot2, pSoldier->bLevel ); + ubWhoIsThere = WhoIsThere2( sSpot2, pSoldier->pathing.bLevel ); if ( ubWhoIsThere != NOBODY && ubWhoIsThere != pSoldier->ubID ) { // skip this direction b/c it's blocked by another merc! @@ -5026,23 +5040,23 @@ INT16 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pub if ( sSpot == pSoldier->sGridNo ) { if (pubDirection) - { - (*pubDirection) = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier ); - } + { + (*pubDirection) = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier ); + } //*pubDirection = pSoldier->ubDirection; return( sSpot ); } - ubDir = (UINT8)GetDirectionToGridNoFromGridNo( sSpot, sGridNo ); + ubDir = (UINT8)GetDirectionToGridNoFromGridNo( sSpot, sGridNo ); // don't store path, just measure it - if ( ( NewOKDestinationAndDirection( pSoldier, sSpot, ubDir, TRUE , pSoldier->bLevel ) > 0 ) && - ( ( sDistance = PlotPath( pSoldier, sSpot, NO_COPYROUTE, NO_PLOT, TEMPORARY, (INT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ) ) > 0 ) ) + if ( ( NewOKDestinationAndDirection( pSoldier, sSpot, ubDir, TRUE , pSoldier->pathing.bLevel ) > 0 ) && + ( ( sDistance = PlotPath( pSoldier, sSpot, NO_COPYROUTE, NO_PLOT, TEMPORARY, (INT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ) ) > 0 ) ) { if ( sDistance < sClosest ) { sClosest = sDistance; - sCloseGridNo = (INT16)sSpot; + sCloseGridNo = (INT16)sSpot; } } } @@ -5137,22 +5151,21 @@ INT16 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pub INT16 FindAdjacentPunchTarget( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTargetSoldier, INT16 * psAdjustedTargetGridNo, UINT8 * pubDirection ) { - //INT16 cnt; - INT16 sSpot; + INT16 sSpot; UINT8 ubGuyThere; for ( INT8 cnt = 0; cnt < NUM_WORLD_DIRECTIONS; cnt++ ) { sSpot = NewGridNo( pSoldier->sGridNo, DirectionInc( cnt ) ); - if ( DoorTravelCost( pSoldier, sSpot, gubWorldMovementCosts[ sSpot ][ cnt ][ pSoldier->bLevel ], FALSE, NULL ) >= TRAVELCOST_BLOCKED ) + if ( DoorTravelCost( pSoldier, sSpot, gubWorldMovementCosts[ sSpot ][ cnt ][ pSoldier->pathing.bLevel ], FALSE, NULL ) >= TRAVELCOST_BLOCKED ) { // blocked! continue; } // Check for who is there... - ubGuyThere = WhoIsThere2( sSpot, pSoldier->bLevel ); + ubGuyThere = WhoIsThere2( sSpot, pSoldier->pathing.bLevel ); if ( pTargetSoldier != NULL && ubGuyThere == pTargetSoldier->ubID ) { @@ -5168,12 +5181,12 @@ INT16 FindAdjacentPunchTarget( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTargetSold } -BOOLEAN UIOKMoveDestination( SOLDIERTYPE *pSoldier, UINT16 usMapPos ) +BOOLEAN UIOKMoveDestination( SOLDIERTYPE *pSoldier, INT16 sMapPos ) { BOOLEAN fVisible; // Check if a hidden tile exists but is not revealed - if ( DoesGridnoContainHiddenStruct( usMapPos, &fVisible ) ) + if ( DoesGridnoContainHiddenStruct( sMapPos, &fVisible ) ) { if ( !fVisible ) { @@ -5183,15 +5196,15 @@ BOOLEAN UIOKMoveDestination( SOLDIERTYPE *pSoldier, UINT16 usMapPos ) } - if ( !NewOKDestination( pSoldier, usMapPos, FALSE, (INT8) gsInterfaceLevel ) ) + if ( !NewOKDestination( pSoldier, sMapPos, FALSE, (INT8) gsInterfaceLevel ) ) { return( FALSE ); } // ATE: If we are a robot, see if we are being validly controlled... - if ( pSoldier->uiStatusFlags & SOLDIER_ROBOT ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) { - if ( ! CanRobotBeControlled( pSoldier ) ) + if ( ! pSoldier->CanRobotBeControlled( ) ) { // Display message that robot cannot be controlled.... return( 2 ); @@ -5199,7 +5212,7 @@ BOOLEAN UIOKMoveDestination( SOLDIERTYPE *pSoldier, UINT16 usMapPos ) } // ATE: Experiment.. take out - //else if ( IsRoofVisible( usMapPos ) && gsInterfaceLevel == 0 ) + //else if ( IsRoofVisible( sMapPos ) && gsInterfaceLevel == 0 ) //{ // return( FALSE ); //} @@ -5211,21 +5224,21 @@ BOOLEAN UIOKMoveDestination( SOLDIERTYPE *pSoldier, UINT16 usMapPos ) void HandleTeamServices( UINT8 ubTeamNum ) { - INT32 cnt; - SOLDIERTYPE *pTeamSoldier, *pTargetSoldier; - UINT32 uiPointsUsed; - UINT16 usSoldierIndex, usInHand; - UINT16 usKitPts; + INT32 cnt; + SOLDIERTYPE *pTeamSoldier, *pTargetSoldier; + UINT32 uiPointsUsed; + UINT16 usSoldierIndex, usInHand; + UINT16 usKitPts; INT8 bSlot; BOOLEAN fDone; // IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED! cnt = gTacticalStatus.Team[ ubTeamNum ].bFirstID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ ubTeamNum ].bLastID; cnt++,pTeamSoldier++) - { - if ( pTeamSoldier->bLife >= OKLIFE && pTeamSoldier->bActive && pTeamSoldier->bInSector ) + { + if ( pTeamSoldier->stats.bLife >= OKLIFE && pTeamSoldier->bActive && pTeamSoldier->bInSector ) { fDone = FALSE; // Check for different events! @@ -5236,7 +5249,7 @@ void HandleTeamServices( UINT8 ubTeamNum ) usInHand = pTeamSoldier->inv[ HANDPOS ].usItem; // Get victim pointer - usSoldierIndex = WhoIsThere2( pTeamSoldier->sTargetGridNo, pTeamSoldier->bLevel ); + usSoldierIndex = WhoIsThere2( pTeamSoldier->sTargetGridNo, pTeamSoldier->pathing.bLevel ); if ( usSoldierIndex != NOBODY ) { pTargetSoldier = MercPtrs[ usSoldierIndex ]; @@ -5245,15 +5258,15 @@ void HandleTeamServices( UINT8 ubTeamNum ) { usKitPts = TotalPoints( &(pTeamSoldier->inv[ HANDPOS ] ) ); - uiPointsUsed = SoldierDressWound( pTeamSoldier, pTargetSoldier, usKitPts, usKitPts ); + uiPointsUsed = pTeamSoldier->SoldierDressWound( pTargetSoldier, usKitPts, usKitPts ); // Determine if they are all banagded - if ( !pTargetSoldier->bBleeding && pTargetSoldier->bLife >= OKLIFE ) + if ( !pTargetSoldier->bBleeding && pTargetSoldier->stats.bLife >= OKLIFE ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ MERC_IS_ALL_BANDAGED_STR ], pTargetSoldier->name ); // Cancel all services for this guy! - ReceivingSoldierCancelServices( pTargetSoldier ); + pTargetSoldier->ReceivingSoldierCancelServices( ); fDone = TRUE; } @@ -5263,7 +5276,7 @@ void HandleTeamServices( UINT8 ubTeamNum ) usKitPts = TotalPoints( &(pTeamSoldier->inv[ HANDPOS ] ) ); // WHETHER OR NOT recipient is all bandaged, check if we've used them up! - if ( usKitPts <= 0) // no more bandages + if ( usKitPts <= 0) // no more bandages { if ( fDone ) { @@ -5285,11 +5298,11 @@ void HandleTeamServices( UINT8 ubTeamNum ) else { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ MERC_IS_OUT_OF_BANDAGES_STR ], pTeamSoldier->name ); - GivingSoldierCancelServices( pTeamSoldier ); + pTeamSoldier->GivingSoldierCancelServices( ); if ( !gTacticalStatus.fAutoBandageMode ) { - DoMercBattleSound( pTeamSoldier, (INT8)( BATTLE_SOUND_CURSE1 ) ); + pTeamSoldier->DoMercBattleSound( (INT8)( BATTLE_SOUND_CURSE1 ) ); } } @@ -5304,14 +5317,14 @@ void HandleTeamServices( UINT8 ubTeamNum ) void HandlePlayerServices( SOLDIERTYPE *pTeamSoldier ) { - SOLDIERTYPE *pTargetSoldier; - UINT32 uiPointsUsed; - UINT16 usSoldierIndex, usInHand; - UINT16 usKitPts; + SOLDIERTYPE *pTargetSoldier; + UINT32 uiPointsUsed; + UINT16 usSoldierIndex, usInHand; + UINT16 usKitPts; INT8 bSlot; BOOLEAN fDone = FALSE; - if ( pTeamSoldier->bLife >= OKLIFE && pTeamSoldier->bActive ) + if ( pTeamSoldier->stats.bLife >= OKLIFE && pTeamSoldier->bActive ) { // Check for different events! // FOR DOING AID @@ -5321,7 +5334,7 @@ void HandlePlayerServices( SOLDIERTYPE *pTeamSoldier ) usInHand = pTeamSoldier->inv[ HANDPOS ].usItem; // Get victim pointer - usSoldierIndex = WhoIsThere2( pTeamSoldier->sTargetGridNo, pTeamSoldier->bLevel ); + usSoldierIndex = WhoIsThere2( pTeamSoldier->sTargetGridNo, pTeamSoldier->pathing.bLevel ); if ( usSoldierIndex != NOBODY ) { @@ -5331,15 +5344,15 @@ void HandlePlayerServices( SOLDIERTYPE *pTeamSoldier ) { usKitPts = TotalPoints( &(pTeamSoldier->inv[ HANDPOS ] ) ); - uiPointsUsed = SoldierDressWound( pTeamSoldier, pTargetSoldier, usKitPts, usKitPts ); + uiPointsUsed = pTeamSoldier->SoldierDressWound( pTargetSoldier, usKitPts, usKitPts ); // Determine if they are all banagded - if ( !pTargetSoldier->bBleeding && pTargetSoldier->bLife >= OKLIFE ) + if ( !pTargetSoldier->bBleeding && pTargetSoldier->stats.bLife >= OKLIFE ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ MERC_IS_ALL_BANDAGED_STR ], pTargetSoldier->name ); // Cancel all services for this guy! - ReceivingSoldierCancelServices( pTargetSoldier ); + pTargetSoldier->ReceivingSoldierCancelServices( ); fDone = TRUE; } @@ -5349,7 +5362,7 @@ void HandlePlayerServices( SOLDIERTYPE *pTeamSoldier ) usKitPts = TotalPoints( &(pTeamSoldier->inv[ HANDPOS ] ) ); // WHETHER OR NOT recipient is all bandaged, check if we've used them up! - if ( usKitPts <= 0) // no more bandages + if ( usKitPts <= 0) // no more bandages { if ( fDone ) { @@ -5372,11 +5385,11 @@ void HandlePlayerServices( SOLDIERTYPE *pTeamSoldier ) else { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ MERC_IS_OUT_OF_BANDAGES_STR ], pTeamSoldier->name ); - GivingSoldierCancelServices( pTeamSoldier ); + pTeamSoldier->GivingSoldierCancelServices( ); if ( !gTacticalStatus.fAutoBandageMode ) { - DoMercBattleSound( pTeamSoldier, (INT8)( BATTLE_SOUND_CURSE1 ) ); + pTeamSoldier->DoMercBattleSound( (INT8)( BATTLE_SOUND_CURSE1 ) ); } } } @@ -5389,8 +5402,8 @@ void HandlePlayerServices( SOLDIERTYPE *pTeamSoldier ) void CommonEnterCombatModeCode( ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CommonEnterCombatMode"); - UINT32 cnt; - SOLDIERTYPE *pSoldier; + UINT32 cnt; + SOLDIERTYPE *pSoldier; gTacticalStatus.uiFlags |= INCOMBAT; @@ -5400,8 +5413,8 @@ void CommonEnterCombatModeCode( ) memset( &(gTacticalStatus.bNumFoughtInBattle), 0, MAXTEAMS ); gTacticalStatus.ubLastBattleSectorX = (UINT8) gWorldSectorX; gTacticalStatus.ubLastBattleSectorY = (UINT8) gWorldSectorY; - gTacticalStatus.fLastBattleWon = FALSE; - gTacticalStatus.fItemsSeenOnAttack = FALSE; + gTacticalStatus.fLastBattleWon = FALSE; + gTacticalStatus.fItemsSeenOnAttack = FALSE; // ATE: If we have an item pointer end it! @@ -5423,33 +5436,33 @@ void CommonEnterCombatModeCode( ) pSoldier->usQuoteSaidFlags &= (~SOLDIER_QUOTE_SAID_MULTIPLE_CREATURES); // Hault! - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); // END AI actions CancelAIAction( pSoldier, TRUE ); // turn off AI controlled flag - pSoldier->uiStatusFlags &= ~SOLDIER_UNDERAICONTROL; + pSoldier->flags.uiStatusFlags &= ~SOLDIER_UNDERAICONTROL; // Check if this guy is an enemy.... CheckForPotentialAddToBattleIncrement( pSoldier ); // If guy is sleeping, wake him up! - if ( pSoldier->fMercAsleep == TRUE ) + if ( pSoldier->flags.fMercAsleep == TRUE ) { - ChangeSoldierState( pSoldier, WKAEUP_FROM_SLEEP, 1, TRUE ); + pSoldier->ChangeSoldierState( WKAEUP_FROM_SLEEP, 1, TRUE ); } // ATE: Refresh APs - CalcNewActionPoints( pSoldier ); - // Either I just noticed this, or it just hasn't been a problem before. But + pSoldier->CalcNewActionPoints( ); + // Either I just noticed this, or it just hasn't been a problem before. But // if the last battle left a soldier at 0 points, he will not gain full points with - // carryover for this battle. So we'll hit it again. - CalcNewActionPoints( pSoldier ); + // carryover for this battle. So we'll hit it again. + pSoldier->CalcNewActionPoints( ); if ( pSoldier->ubProfile != NO_PROFILE ) { - if ( pSoldier->bTeam == CIV_TEAM && pSoldier->bNeutral ) + if ( pSoldier->bTeam == CIV_TEAM && pSoldier->aiData.bNeutral ) { // only set precombat gridno if unset if ( gMercProfiles[ pSoldier->ubProfile ].sPreCombatGridNo == 0 || gMercProfiles[ pSoldier->ubProfile ].sPreCombatGridNo == NOWHERE ) @@ -5535,14 +5548,14 @@ void EnterCombatMode( UINT8 ubStartingTeam ) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("EnterCombatMode continuing... start player turn, selected soldier = %d",gusSelectedSoldier)); // OK, make sure we have a selected guy // Madd: this was causing a weird crash becuase gusSelectedSoldier was 156 (out of the array bounds) for some reason - //if ( MercPtrs[ gusSelectedSoldier ]->bOppCnt == 0 ) - if ( gusSelectedSoldier != NOBODY && MercPtrs[ gusSelectedSoldier ]->bOppCnt == 0 ) + //if ( MercPtrs[ gusSelectedSoldier ]->aiData.bOppCnt == 0 ) + if ( gusSelectedSoldier != NOBODY && MercPtrs[ gusSelectedSoldier ]->aiData.bOppCnt == 0 ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"EnterCombatMode continuing... nobody selected"); // OK, look through and find one.... for ( cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID, pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pTeamSoldier++ ) { - if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bOppCnt > 0 ) + if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->aiData.bOppCnt > 0 ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"EnterCombatMode continuing... select soldier"); SelectSoldier( pTeamSoldier->ubID, FALSE, TRUE ); @@ -5568,8 +5581,8 @@ void EnterCombatMode( UINT8 ubStartingTeam ) void ExitCombatMode( ) { - UINT32 cnt; - SOLDIERTYPE *pSoldier; + UINT32 cnt; + SOLDIERTYPE *pSoldier; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Exiting combat mode" ); @@ -5592,25 +5605,25 @@ void ExitCombatMode( ) if ( pSoldier->bInSector ) { // Reset some flags - if ( pSoldier->fNoAPToFinishMove && pSoldier->bLife >= OKLIFE ) + if ( pSoldier->flags.fNoAPToFinishMove && pSoldier->stats.bLife >= OKLIFE ) { - AdjustNoAPToFinishMove( pSoldier, FALSE ); - SoldierGotoStationaryStance( pSoldier ); + pSoldier->AdjustNoAPToFinishMove( FALSE ); + pSoldier->SoldierGotoStationaryStance( ); } //Cancel pending events pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; pSoldier->ubPendingDirection = NO_PENDING_DIRECTION; - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; // Reset moved flag - pSoldier->bMoved = FALSE; + pSoldier->aiData.bMoved = FALSE; // Set final destination - pSoldier->sFinalDestination = pSoldier->sGridNo; + pSoldier->pathing.sFinalDestination = pSoldier->sGridNo; // remove AI controlled flag - pSoldier->uiStatusFlags &= ~SOLDIER_UNDERAICONTROL; + pSoldier->flags.uiStatusFlags &= ~SOLDIER_UNDERAICONTROL; } } } @@ -5635,7 +5648,7 @@ void ExitCombatMode( ) DirtyMercPanelInterface( MercPtrs[ 0 ], DIRTYLEVEL2 ); // ATE: If we are IN_CONV - DONT'T DO THIS! - if ( !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) ) + if ( !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) ) { HandleStrategicTurnImplicationsOfExitingCombatMode(); } @@ -5704,14 +5717,14 @@ BOOLEAN SoldierHasSeenEnemiesLastFewTurns( SOLDIERTYPE *pTeamSoldier ) // check this team for possible enemies cnt2 = gTacticalStatus.Team[ cnt ].bFirstID; for ( pSoldier = MercPtrs[ cnt2 ]; cnt2 <= gTacticalStatus.Team[ cnt ].bLastID; cnt2++, pSoldier++ ) - { - if ( pSoldier->bActive && pSoldier->bInSector && ( pSoldier->bTeam == gbPlayerNum || pSoldier->bLife >= OKLIFE ) ) + { + if ( pSoldier->bActive && pSoldier->bInSector && ( pSoldier->bTeam == gbPlayerNum || pSoldier->stats.bLife >= OKLIFE ) ) { if ( !CONSIDERED_NEUTRAL( pTeamSoldier, pSoldier ) && ( pTeamSoldier->bSide != pSoldier->bSide ) ) { // Have we not seen this guy..... - if ( ( pTeamSoldier->bOppList[ cnt2 ] >= SEEN_CURRENTLY ) && - ( pTeamSoldier->bOppList[ cnt2 ] <= SEEN_THIS_TURN ) ) + if ( ( pTeamSoldier->aiData.bOppList[ cnt2 ] >= SEEN_CURRENTLY ) && + ( pTeamSoldier->aiData.bOppList[ cnt2 ] <= SEEN_THIS_TURN ) ) { gTacticalStatus.bConsNumTurnsNotSeen = 0; return( TRUE ); @@ -5735,9 +5748,9 @@ BOOLEAN WeSeeNoOne( void ) pSoldier = MercSlots[ uiLoop ]; if ( pSoldier != NULL ) { - if ( pSoldier->bTeam == gbPlayerNum ) + if ( pSoldier->bTeam == gbPlayerNum ) { - if ( pSoldier->bOppCnt > 0 ) + if ( pSoldier->aiData.bOppCnt > 0 ) { return( FALSE ); } @@ -5758,7 +5771,7 @@ BOOLEAN NobodyAlerted( void ) pSoldier = MercSlots[ uiLoop ]; if ( pSoldier != NULL ) { - if ( ( pSoldier->bTeam != gbPlayerNum ) && ( ! pSoldier->bNeutral ) && (pSoldier->bLife >= OKLIFE) && (pSoldier->bAlertStatus >= STATUS_RED) ) + if ( ( pSoldier->bTeam != gbPlayerNum ) && ( ! pSoldier->aiData.bNeutral ) && (pSoldier->stats.bLife >= OKLIFE) && (pSoldier->aiData.bAlertStatus >= STATUS_RED) ) { return( FALSE ); } @@ -5779,11 +5792,11 @@ BOOLEAN WeSawSomeoneThisTurn( void ) pSoldier = MercSlots[ uiLoop ]; if ( pSoldier != NULL ) { - if ( pSoldier->bTeam == gbPlayerNum ) + if ( pSoldier->bTeam == gbPlayerNum ) { for ( uiLoop2 = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; uiLoop2 < TOTAL_SOLDIERS; uiLoop2++ ) { - if ( pSoldier->bOppList[ uiLoop2 ] == SEEN_THIS_TURN ) + if ( pSoldier->aiData.bOppList[ uiLoop2 ] == SEEN_THIS_TURN ) { return( TRUE ); } @@ -5806,13 +5819,13 @@ void SayBattleSoundFromAnyBodyInSector( INT32 iBattleSnd ) // Loop through all our guys and randomly say one from someone in our sector // set up soldier ptr as first element in mercptrs list - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) { // Add guy if he's a candidate... - if ( OK_INSECTOR_MERC( pTeamSoldier ) && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->fMercAsleep ) + if ( OK_INSECTOR_MERC( pTeamSoldier ) && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->flags.fMercAsleep ) { ubMercsInSector[ ubNumMercs ] = (UINT8)cnt; ubNumMercs++; @@ -5824,7 +5837,7 @@ void SayBattleSoundFromAnyBodyInSector( INT32 iBattleSnd ) { ubChosenMerc = (UINT8)Random( ubNumMercs ); - DoMercBattleSound( MercPtrs[ ubChosenMerc ],(UINT8)iBattleSnd ); + MercPtrs[ ubChosenMerc ]->DoMercBattleSound( (UINT8)iBattleSnd ); } } @@ -5873,7 +5886,7 @@ BOOLEAN CheckForEndOfCombatMode( BOOLEAN fIncrementTurnsNotSeen ) for ( cnt = 0; cnt < guiNumMercSlots; cnt++ ) { pTeamSoldier = MercSlots[ cnt ]; - if ( pTeamSoldier && pTeamSoldier->bLife >= OKLIFE && !pTeamSoldier->bNeutral ) + if ( pTeamSoldier && pTeamSoldier->stats.bLife >= OKLIFE && !pTeamSoldier->aiData.bNeutral ) { if ( SoldierHasSeenEnemiesLastFewTurns( pTeamSoldier ) ) { @@ -5885,7 +5898,7 @@ BOOLEAN CheckForEndOfCombatMode( BOOLEAN fIncrementTurnsNotSeen ) break; } } - } + } } if ( fSomeoneSawSomeoneRecently ) @@ -6008,7 +6021,7 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) return( FALSE ); } - // We can only check for end of battle if in combat mode or there are enemies + // We can only check for end of battle if in combat mode or there are enemies // present (they might bleed to death or run off the map!) if ( ! ( gTacticalStatus.uiFlags & INCOMBAT ) ) { @@ -6042,11 +6055,11 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) fBattleLost = TRUE; } - //NEW (Nov 24, 98) by Kris + //NEW (Nov 24, 98) by Kris if( !gbWorldSectorZ && fBattleWon ) - { //Check to see if more enemy soldiers exist in the strategic layer - //It is possible to have more than 20 enemies in a sector. By failing here, - //it gives the engine a chance to add these soldiers as reinforcements. This + { //Check to see if more enemy soldiers exist in the strategic layer + //It is possible to have more than 20 enemies in a sector. By failing here, + //it gives the engine a chance to add these soldiers as reinforcements. This //is naturally handled. AddPossiblePendingEnemiesToBattle(); if( gfPendingEnemies ) @@ -6067,7 +6080,7 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) if ( fBattleLost ) { - // CJC: End AI's turn here.... first... so that UnSetUIBusy will succeed if militia win + // CJC: End AI's turn here.... first... so that UnSetUIBusy will succeed if militia win // battle for us EndAllAITurns( ); @@ -6126,7 +6139,7 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) // OK, KILL any enemies that are incompacitated if ( KillIncompacitatedEnemyInSector( ) ) { - return( FALSE ); + return( FALSE ); } } @@ -6140,13 +6153,13 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) // Set enemy presence to false gTacticalStatus.fEnemyInSector = FALSE; - // CJC: End AI's turn here.... first... so that UnSetUIBusy will succeed if militia win + // CJC: End AI's turn here.... first... so that UnSetUIBusy will succeed if militia win // battle for us EndAllAITurns( ); UnSetUIBusy( (UINT8)gusSelectedSoldier ); - // ATE: + // ATE: // If we ended battle in any team other than the player's // we need to end the UI lock using this method.... guiPendingOverrideEvent = LU_ENDUILOCK; @@ -6177,7 +6190,7 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) gMercProfiles[pTeamSoldier->ubProfile].usBattlesFought++; // If this guy is OKLIFE & not standing, make stand.... - if ( pTeamSoldier->bLife >= OKLIFE && !pTeamSoldier->bCollapsed ) + if ( pTeamSoldier->stats.bLife >= OKLIFE && !pTeamSoldier->bCollapsed ) { if ( pTeamSoldier->bAssignment < ON_DUTY ) { @@ -6193,7 +6206,7 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) if ( gAnimControl[ pTeamSoldier->usAnimState ].ubHeight != ANIM_STAND ) { - ChangeSoldierStance( pTeamSoldier, ANIM_STAND ); + pTeamSoldier->ChangeSoldierStance( ANIM_STAND ); } else { @@ -6202,7 +6215,7 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) if ( usAnimState != INVALID_ANIMATION ) { - EVENT_InitNewSoldierAnim( pTeamSoldier, usAnimState, 0, FALSE ); + pTeamSoldier->EVENT_InitNewSoldierAnim( usAnimState, 0, FALSE ); } } } @@ -6216,28 +6229,28 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_BATTLE_WON, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); // Change music modes - if ( gfLastMercTalkedAboutKillingID == NOBODY || ( gfLastMercTalkedAboutKillingID != NOBODY && !( MercPtrs[ gfLastMercTalkedAboutKillingID ]->uiStatusFlags & SOLDIER_MONSTER ) ) ) + if ( gfLastMercTalkedAboutKillingID == NOBODY || ( gfLastMercTalkedAboutKillingID != NOBODY && !( MercPtrs[ gfLastMercTalkedAboutKillingID ]->flags.uiStatusFlags & SOLDIER_MONSTER ) ) ) { SetMusicMode( MUSIC_TACTICAL_VICTORY ); ShouldBeginAutoBandage( ); } - else if ( gfLastMercTalkedAboutKillingID != NOBODY && ( MercPtrs[ gfLastMercTalkedAboutKillingID ]->uiStatusFlags & SOLDIER_MONSTER ) ) + else if ( gfLastMercTalkedAboutKillingID != NOBODY && ( MercPtrs[ gfLastMercTalkedAboutKillingID ]->flags.uiStatusFlags & SOLDIER_MONSTER ) ) { - ShouldBeginAutoBandage( ); + ShouldBeginAutoBandage( ); } // Say battle end quote.... if (fAnEnemyRetreated) - { + { SayQuoteFromAnyBodyInSector( QUOTE_ENEMY_RETREATED ); } else { // OK, If we have just finished a battle with creatures........ play killed creature quote... - // - if ( gfLastMercTalkedAboutKillingID != NOBODY && ( MercPtrs[ gfLastMercTalkedAboutKillingID ]->uiStatusFlags & SOLDIER_MONSTER ) ) + // + if ( gfLastMercTalkedAboutKillingID != NOBODY && ( MercPtrs[ gfLastMercTalkedAboutKillingID ]->flags.uiStatusFlags & SOLDIER_MONSTER ) ) { } @@ -6269,14 +6282,14 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) { if ( pTeamSoldier->bActive && pTeamSoldier->bInSector ) { - pTeamSoldier->bAlertStatus = STATUS_GREEN; + pTeamSoldier->aiData.bAlertStatus = STATUS_GREEN; CheckForChangingOrders( pTeamSoldier ); - pTeamSoldier->sNoiseGridno = NOWHERE; - pTeamSoldier->ubNoiseVolume = 0; - pTeamSoldier->bNewSituation = FALSE; - pTeamSoldier->bOrders = STATIONARY; - if ( pTeamSoldier->bLife < OKLIFE ) - pTeamSoldier->bLife = OKLIFE; + pTeamSoldier->aiData.sNoiseGridno = NOWHERE; + pTeamSoldier->aiData.ubNoiseVolume = 0; + pTeamSoldier->aiData.bNewSituation = FALSE; + pTeamSoldier->aiData.bOrders = STATIONARY; + if ( pTeamSoldier->stats.bLife < OKLIFE ) + pTeamSoldier->stats.bLife = OKLIFE; pTeamSoldier->bBleeding = 0; // let's think, the autobandage was done for the militia too } @@ -6289,10 +6302,10 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) { if ( pTeamSoldier->bActive && pTeamSoldier->bInSector ) { - pTeamSoldier->bAlertStatus = STATUS_GREEN; - pTeamSoldier->sNoiseGridno = NOWHERE; - pTeamSoldier->ubNoiseVolume = 0; - pTeamSoldier->bNewSituation = FALSE; + pTeamSoldier->aiData.bAlertStatus = STATUS_GREEN; + pTeamSoldier->aiData.sNoiseGridno = NOWHERE; + pTeamSoldier->aiData.ubNoiseVolume = 0; + pTeamSoldier->aiData.bNewSituation = FALSE; CheckForChangingOrders( pTeamSoldier ); } } @@ -6342,7 +6355,7 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) void CycleThroughKnownEnemies( ) { // static to indicate last position we were at: - SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pSoldier; static BOOLEAN fFirstTime = TRUE; static UINT16 usStartToLook; UINT32 cnt; @@ -6359,7 +6372,7 @@ void CycleThroughKnownEnemies( ) for ( cnt = gTacticalStatus.Team[ gbPlayerNum ].bLastID, pSoldier = MercPtrs[ cnt ]; cnt < TOTAL_SOLDIERS; cnt++, pSoldier++ ) { // try to find first active, OK enemy - if ( pSoldier->bActive && pSoldier->bInSector && !pSoldier->bNeutral && (pSoldier->bSide != gbPlayerNum) && (pSoldier->bLife > 0) ) + if ( pSoldier->bActive && pSoldier->bInSector && !pSoldier->aiData.bNeutral && (pSoldier->bSide != gbPlayerNum) && (pSoldier->stats.bLife > 0) ) { if ( pSoldier->bVisible != -1 ) { @@ -6404,7 +6417,7 @@ void CycleThroughKnownEnemies( ) void CycleVisibleEnemies( SOLDIERTYPE *pSrcSoldier ) { // static to indicate last position we were at: - SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pSoldier; UINT16 usStartToLook; UINT32 cnt; @@ -6413,9 +6426,9 @@ void CycleVisibleEnemies( SOLDIERTYPE *pSrcSoldier ) for ( cnt = gTacticalStatus.Team[ gbPlayerNum ].bLastID, pSoldier = MercPtrs[ cnt ]; cnt < TOTAL_SOLDIERS; cnt++, pSoldier++ ) { // try to find first active, OK enemy - if ( pSoldier->bActive && pSoldier->bInSector && !pSoldier->bNeutral && (pSoldier->bSide != gbPlayerNum) && (pSoldier->bLife > 0) ) + if ( pSoldier->bActive && pSoldier->bInSector && !pSoldier->aiData.bNeutral && (pSoldier->bSide != gbPlayerNum) && (pSoldier->stats.bLife > 0) ) { - if ( pSrcSoldier->bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY ) + if ( pSrcSoldier->aiData.bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY ) { // If we are > ok start, this is the one! if ( cnt > pSrcSoldier->ubLastEnemyCycledID ) @@ -6425,7 +6438,7 @@ void CycleVisibleEnemies( SOLDIERTYPE *pSrcSoldier ) //ATE: Change to Slide To... SlideTo( 0, pSoldier->ubID, 0, SETANDREMOVEPREVIOUSLOCATOR ); - ChangeInterfaceLevel( pSoldier->bLevel ); + ChangeInterfaceLevel( pSoldier->pathing.bLevel ); return; } } @@ -6440,9 +6453,9 @@ void CycleVisibleEnemies( SOLDIERTYPE *pSrcSoldier ) for ( cnt = gTacticalStatus.Team[ gbPlayerNum ].bLastID, pSoldier = MercPtrs[ cnt ]; cnt < TOTAL_SOLDIERS; cnt++, pSoldier++ ) { // try to find first active, OK enemy - if ( pSoldier->bActive && pSoldier->bInSector && !pSoldier->bNeutral && (pSoldier->bSide != gbPlayerNum) && (pSoldier->bLife > 0) ) + if ( pSoldier->bActive && pSoldier->bInSector && !pSoldier->aiData.bNeutral && (pSoldier->bSide != gbPlayerNum) && (pSoldier->stats.bLife > 0) ) { - if ( pSrcSoldier->bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY ) + if ( pSrcSoldier->aiData.bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY ) { // If we are > ok start, this is the one! @@ -6453,7 +6466,7 @@ void CycleVisibleEnemies( SOLDIERTYPE *pSrcSoldier ) //ATE: Change to Slide To... SlideTo( 0, pSoldier->ubID, 0, SETANDREMOVEPREVIOUSLOCATOR ); - ChangeInterfaceLevel( pSoldier->bLevel ); + ChangeInterfaceLevel( pSoldier->pathing.bLevel ); return; } } @@ -6467,12 +6480,12 @@ void CycleVisibleEnemies( SOLDIERTYPE *pSrcSoldier ) INT8 CountNonVehiclesOnPlayerTeam( void ) { UINT32 cnt; - SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pSoldier; INT8 bNumber = 0; for ( cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID, pSoldier = MercPtrs[ cnt ]; cnt <= (UINT32)( gTacticalStatus.Team[ gbPlayerNum ].bLastID ); cnt++, pSoldier++ ) { - if ( pSoldier->bActive && !(pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( pSoldier->bActive && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { bNumber++; } @@ -6504,10 +6517,10 @@ UINT8 NumPCsInSector( void ) // Loop through all mercs and make go for ( cnt = 0; cnt < guiNumMercSlots; cnt++ ) { - if ( MercSlots[ cnt ] ) + if ( MercSlots[ cnt ] ) { pTeamSoldier = MercSlots[ cnt ]; - if ( pTeamSoldier->bTeam == gbPlayerNum && pTeamSoldier->bLife > 0 ) + if ( pTeamSoldier->bTeam == gbPlayerNum && pTeamSoldier->stats.bLife > 0 ) { ubNumPlayers++; } @@ -6529,10 +6542,10 @@ UINT8 NumEnemyInSector( ) // Loop through all mercs and make go for ( pTeamSoldier = Menptr, cnt = 0; cnt < TOTAL_SOLDIERS; pTeamSoldier++, cnt++ ) { - if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bLife > 0 ) + if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->stats.bLife > 0 ) { // Checkf for any more bacguys - if ( !pTeamSoldier->bNeutral && (pTeamSoldier->bSide != 0 ) ) + if ( !pTeamSoldier->aiData.bNeutral && (pTeamSoldier->bSide != 0 ) ) { ubNumEnemies++; } @@ -6553,10 +6566,10 @@ UINT8 NumEnemyInSectorExceptCreatures() // Loop through all mercs and make go for ( pTeamSoldier = Menptr, cnt = 0; cnt < TOTAL_SOLDIERS; pTeamSoldier++, cnt++ ) { - if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bLife > 0 && pTeamSoldier->bTeam != CREATURE_TEAM ) + if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->stats.bLife > 0 && pTeamSoldier->bTeam != CREATURE_TEAM ) { // Checkf for any more bacguys - if ( !pTeamSoldier->bNeutral && (pTeamSoldier->bSide != 0 ) ) + if ( !pTeamSoldier->aiData.bNeutral && (pTeamSoldier->bSide != 0 ) ) { ubNumEnemies++; } @@ -6582,15 +6595,15 @@ UINT8 NumEnemyInSectorNotDeadOrDying( ) if ( pTeamSoldier->bActive && pTeamSoldier->bInSector ) { // For sure for flag thet they are dead is not set - if ( !( pTeamSoldier->uiStatusFlags & SOLDIER_DEAD ) ) + if ( !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) ) { // Also, we want to pick up unconcious guys as NOT being capable, // but we want to make sure we don't get those ones that are in the // process of dying - if ( pTeamSoldier->bLife >= OKLIFE ) + if ( pTeamSoldier->stats.bLife >= OKLIFE ) { // Check for any more badguys - if ( !pTeamSoldier->bNeutral && (pTeamSoldier->bSide != 0 ) ) + if ( !pTeamSoldier->aiData.bNeutral && (pTeamSoldier->bSide != 0 ) ) { ubNumEnemies++; } @@ -6619,15 +6632,15 @@ UINT8 NumBloodcatsInSectorNotDeadOrDying( ) if ( pTeamSoldier->ubBodyType == BLOODCAT ) { // For sure for flag thet they are dead is not set - if ( !( pTeamSoldier->uiStatusFlags & SOLDIER_DEAD ) ) + if ( !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) ) { // Also, we want to pick up unconcious guys as NOT being capable, // but we want to make sure we don't get those ones that are in the // process of dying - if ( pTeamSoldier->bLife >= OKLIFE ) + if ( pTeamSoldier->stats.bLife >= OKLIFE ) { // Check for any more badguys - if ( !pTeamSoldier->bNeutral && (pTeamSoldier->bSide != 0 ) ) + if ( !pTeamSoldier->aiData.bNeutral && (pTeamSoldier->bSide != 0 ) ) { ubNumEnemies++; } @@ -6656,19 +6669,19 @@ UINT8 NumCapableEnemyInSector( ) if ( pTeamSoldier->bActive && pTeamSoldier->bInSector ) { // For sure for flag thet they are dead is not set - if ( !( pTeamSoldier->uiStatusFlags & SOLDIER_DEAD ) ) + if ( !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) ) { // Also, we want to pick up unconcious guys as NOT being capable, // but we want to make sure we don't get those ones that are in the // process of dying - if ( pTeamSoldier->bLife < OKLIFE && pTeamSoldier->bLife != 0 ) + if ( pTeamSoldier->stats.bLife < OKLIFE && pTeamSoldier->stats.bLife != 0 ) { } else { // Check for any more badguys - if ( !pTeamSoldier->bNeutral && (pTeamSoldier->bSide != 0 ) ) + if ( !pTeamSoldier->aiData.bNeutral && (pTeamSoldier->bSide != 0 ) ) { ubNumEnemies++; } @@ -6686,12 +6699,11 @@ BOOLEAN CheckForLosingEndOfBattle( ) { SOLDIERTYPE *pTeamSoldier; INT32 cnt = 0; - UINT8 ubNumEnemies = 0; INT8 bNumDead = 0, bNumNotOK = 0, bNumInBattle = 0, bNumNotOKRealMercs = 0; BOOLEAN fMadeCorpse; BOOLEAN fDoCapture = FALSE; - BOOLEAN fOnlyEPCsLeft = TRUE; - BOOLEAN fMilitiaInSector = FALSE; + BOOLEAN fOnlyEPCsLeft = TRUE; + BOOLEAN fMilitiaInSector = FALSE; // ATE: Check for MILITIA - we won't lose if we have some..... @@ -6700,7 +6712,7 @@ BOOLEAN CheckForLosingEndOfBattle( ) { if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bSide == gbPlayerNum ) { - if ( pTeamSoldier->bLife >= OKLIFE ) + if ( pTeamSoldier->stats.bLife >= OKLIFE ) { // We have at least one poor guy who will still fight.... // we have not lost ( yet )! @@ -6713,19 +6725,19 @@ BOOLEAN CheckForLosingEndOfBattle( ) // IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED! cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++) - { + { // Are we active and in sector..... - if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && !( pTeamSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { bNumInBattle++; - if ( pTeamSoldier->bLife == 0 ) + if ( pTeamSoldier->stats.bLife == 0 ) { bNumDead++; } - else if ( pTeamSoldier->bLife < OKLIFE ) + else if ( pTeamSoldier->stats.bLife < OKLIFE ) { bNumNotOK++; @@ -6803,13 +6815,13 @@ BOOLEAN CheckForLosingEndOfBattle( ) // Are we active and in sector..... if ( pTeamSoldier->bActive && pTeamSoldier->bInSector ) { - if ( pTeamSoldier->bLife != 0 && pTeamSoldier->bLife < OKLIFE || AM_AN_EPC( pTeamSoldier ) || AM_A_ROBOT( pTeamSoldier ) ) + if ( pTeamSoldier->stats.bLife != 0 && pTeamSoldier->stats.bLife < OKLIFE || AM_AN_EPC( pTeamSoldier ) || AM_A_ROBOT( pTeamSoldier ) ) { // Captured EPCs or ROBOTS will be kiiled in capture routine.... if ( !fDoCapture ) { // Kill! - pTeamSoldier->bLife = 0; + pTeamSoldier->stats.bLife = 0; HandleSoldierDeath( pTeamSoldier, &fMadeCorpse ); @@ -6820,7 +6832,7 @@ BOOLEAN CheckForLosingEndOfBattle( ) } // ATE: if we are told to do capture.... - if ( pTeamSoldier->bLife != 0 && fDoCapture ) + if ( pTeamSoldier->stats.bLife != 0 && fDoCapture ) { EnemyCapturesPlayerSoldier( pTeamSoldier ); @@ -6854,20 +6866,19 @@ BOOLEAN KillIncompacitatedEnemyInSector( ) { SOLDIERTYPE *pTeamSoldier; INT32 cnt = 0; - UINT8 ubNumEnemies = 0; BOOLEAN fReturnVal = FALSE; // Check if the battle is won! // Loop through all mercs and make go for ( pTeamSoldier = Menptr, cnt = 0; cnt < TOTAL_SOLDIERS; pTeamSoldier++, cnt++ ) { - if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bLife < OKLIFE && !( pTeamSoldier->uiStatusFlags & SOLDIER_DEAD ) ) + if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->stats.bLife < OKLIFE && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) ) { // Checkf for any more bacguys - if ( !pTeamSoldier->bNeutral && (pTeamSoldier->bSide != gbPlayerNum ) ) + if ( !pTeamSoldier->aiData.bNeutral && (pTeamSoldier->bSide != gbPlayerNum ) ) { // KIll...... - SoldierTakeDamage( pTeamSoldier, ANIM_CROUCH, pTeamSoldier->bLife, 100, TAKE_DAMAGE_BLOODLOSS, NOBODY, NOWHERE, 0, TRUE ); + pTeamSoldier->SoldierTakeDamage( ANIM_CROUCH, pTeamSoldier->stats.bLife, 100, TAKE_DAMAGE_BLOODLOSS, NOBODY, NOWHERE, 0, TRUE ); fReturnVal = TRUE; } } @@ -6888,7 +6899,7 @@ BOOLEAN AttackOnGroupWitnessed( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTarget ) pGroupMember = MercSlots[ uiSlot ]; if (pGroupMember && (pGroupMember->ubCivilianGroup == pTarget->ubCivilianGroup) && pGroupMember != pTarget) { - if (pGroupMember->bOppList[pSoldier->ubID] == SEEN_CURRENTLY || pGroupMember->bOppList[pTarget->ubID] == SEEN_CURRENTLY) + if (pGroupMember->aiData.bOppList[pSoldier->ubID] == SEEN_CURRENTLY || pGroupMember->aiData.bOppList[pTarget->ubID] == SEEN_CURRENTLY) { return( TRUE ); } @@ -6907,16 +6918,16 @@ INT8 CalcSuppressionTolerance( SOLDIERTYPE * pSoldier ) INT8 bTolerance; // Calculate basic tolerance value - bTolerance = pSoldier->bExpLevel * 2; - if (pSoldier->uiStatusFlags & SOLDIER_PC) + bTolerance = pSoldier->stats.bExpLevel * 2; + if (pSoldier->flags.uiStatusFlags & SOLDIER_PC) { // give +1 for every 10% morale from 50, for a maximum bonus/penalty of 5. - bTolerance += ( pSoldier->bMorale - 50 ) / 10; + bTolerance += ( pSoldier->aiData.bMorale - 50 ) / 10; } else { - // give +2 for every morale category from normal, for a max change of 4 - bTolerance += ( pSoldier->bAIMorale - MORALE_NORMAL ) * 2; + // give +2 for every morale category from normal, for a max change of 4 + bTolerance += ( pSoldier->aiData.bAIMorale - MORALE_NORMAL ) * 2; } if ( pSoldier->ubProfile != NO_PROFILE ) @@ -6925,7 +6936,7 @@ INT8 CalcSuppressionTolerance( SOLDIERTYPE * pSoldier ) switch ( gMercProfiles[ pSoldier->ubProfile ].bAttitude ) { case ATT_AGGRESSIVE: - bTolerance += 2; + bTolerance += 2; break; case ATT_COWARD: bTolerance += -2; @@ -6937,14 +6948,14 @@ INT8 CalcSuppressionTolerance( SOLDIERTYPE * pSoldier ) else { // generic NPC/civvie; change tolerance based on attitude - switch ( pSoldier->bAttitude ) + switch ( pSoldier->aiData.bAttitude ) { case BRAVESOLO: case BRAVEAID: - bTolerance += 2; + bTolerance += 2; break; case AGGRESSIVE: - bTolerance += 1; + bTolerance += 1; break; case DEFENSIVE: bTolerance += -1; @@ -6976,9 +6987,9 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleSuppressionFire: loop = %d, numslots = %d ",uiLoop, guiNumMercSlots)); pSoldier = MercSlots[uiLoop]; - if (pSoldier && IS_MERC_BODY_TYPE( pSoldier) && pSoldier->bLife >= OKLIFE && pSoldier->ubSuppressionPoints > 0) + if (pSoldier && IS_MERC_BODY_TYPE( pSoldier) && pSoldier->stats.bLife >= OKLIFE && pSoldier->ubSuppressionPoints > 0) { - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleSuppressionFire: soldier id = %d, life = %d, suppression points = %d",pSoldier->ubID,pSoldier->bLife, pSoldier->ubSuppressionPoints)); + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleSuppressionFire: soldier id = %d, life = %d, suppression points = %d",pSoldier->ubID,pSoldier->stats.bLife, pSoldier->ubSuppressionPoints)); DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleSuppressionFire: calc suppression tolerance")); bTolerance = CalcSuppressionTolerance( pSoldier ); @@ -7059,7 +7070,7 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker ) } break; default: // standing! - if ( MercInWater( pSoldier )) + if ( pSoldier->MercInWater()) { // can't change stance here! break; @@ -7101,7 +7112,7 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker ) pSoldier->ubAPsLostToSuppression = ubTotalPointsLost; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleSuppressionFire: check for quote")); - if ( (pSoldier->uiStatusFlags & SOLDIER_PC) && (pSoldier->ubSuppressionPoints > 8) && (pSoldier->ubID == ubTargetedMerc) ) + if ( (pSoldier->flags.uiStatusFlags & SOLDIER_PC) && (pSoldier->ubSuppressionPoints > 8) && (pSoldier->ubID == ubTargetedMerc) ) { if ( !(pSoldier->usQuoteSaidFlags & SOLDIER_QUOTE_SAID_BEING_PUMMELED ) ) { @@ -7134,13 +7145,13 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker ) } // AI people will have to have their actions cancelled - if (!(pSoldier->uiStatusFlags & SOLDIER_PC)) + if (!(pSoldier->flags.uiStatusFlags & SOLDIER_PC)) { CancelAIAction( pSoldier, TRUE ); #if 0 - pSoldier->bAction = AI_ACTION_CHANGE_STANCE; - pSoldier->usActionData = ubNewStance; - pSoldier->bActionInProgress = TRUE; + pSoldier->aiData.bAction = AI_ACTION_CHANGE_STANCE; + pSoldier->aiData.usActionData = ubNewStance; + pSoldier->aiData.bActionInProgress = TRUE; #endif } @@ -7148,16 +7159,16 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker ) // ATE: Cancel any PENDING ANIMATIONS... pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; // ATE: Turn off non-interrupt flag ( this NEEDS to be done! ) - pSoldier->fInNonintAnim = FALSE; - pSoldier->fRTInNonintAnim = FALSE; + pSoldier->flags.fInNonintAnim = FALSE; + pSoldier->flags.fRTInNonintAnim = FALSE; gTacticalStatus.ubAttackBusyCount++; DebugAttackBusy( String( "Attack busy %d due to suppression fire on %d\n", gTacticalStatus.ubAttackBusyCount, pSoldier->ubID )); DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleSuppressionFire: change stance")); - ChangeSoldierStance( pSoldier, ubNewStance ); + pSoldier->ChangeSoldierStance( ubNewStance ); - pSoldier->fChangingStanceDueToSuppression = TRUE; - pSoldier->fDontChargeAPsForStanceChange = TRUE; + pSoldier->flags.fChangingStanceDueToSuppression = TRUE; + pSoldier->flags.fDontChargeAPsForStanceChange = TRUE; } } // end of examining one soldier @@ -7172,10 +7183,10 @@ BOOLEAN ProcessImplicationsOfPCAttack( SOLDIERTYPE * pSoldier, SOLDIERTYPE ** pp BOOLEAN fEnterCombat = TRUE; SOLDIERTYPE * pTarget = *ppTarget; - if ( pTarget->fAIFlags & AI_ASLEEP ) + if ( pTarget->aiData.fAIFlags & AI_ASLEEP ) { // waaaaaaaaaaaaake up! - pTarget->fAIFlags &= (~AI_ASLEEP); + pTarget->aiData.fAIFlags &= (~AI_ASLEEP); } if (pTarget->ubProfile == PABLO && CheckFact( FACT_PLAYER_FOUND_ITEMS_MISSING, 0 ) ) @@ -7186,10 +7197,10 @@ BOOLEAN ProcessImplicationsOfPCAttack( SOLDIERTYPE * pSoldier, SOLDIERTYPE ** pp if ( gTacticalStatus.bBoxingState == BOXING ) { // should have a check for "in boxing ring", no? - if ( ( pSoldier->usAttackingWeapon != NOTHING && !Item[pSoldier->usAttackingWeapon].brassknuckles ) || !( pSoldier->uiStatusFlags & SOLDIER_BOXER ) ) + if ( ( pSoldier->usAttackingWeapon != NOTHING && !Item[pSoldier->usAttackingWeapon].brassknuckles ) || !( pSoldier->flags.uiStatusFlags & SOLDIER_BOXER ) ) { // someone's cheating! - if ( (Item[ pSoldier->usAttackingWeapon ].usItemClass == IC_BLADE || Item[ pSoldier->usAttackingWeapon ].usItemClass == IC_PUNCH) && (pTarget->uiStatusFlags & SOLDIER_BOXER) ) + if ( (Item[ pSoldier->usAttackingWeapon ].usItemClass == IC_BLADE || Item[ pSoldier->usAttackingWeapon ].usItemClass == IC_PUNCH) && (pTarget->flags.uiStatusFlags & SOLDIER_BOXER) ) { // knife or brass knuckles disqualify the player! BoxingPlayerDisqualified( pSoldier, BAD_ATTACK ); @@ -7200,7 +7211,7 @@ BOOLEAN ProcessImplicationsOfPCAttack( SOLDIERTYPE * pSoldier, SOLDIERTYPE ** pp //gTacticalStatus.bBoxingState = NOT_BOXING; SetBoxingState( NOT_BOXING ); // if we are attacking a boxer we should set them to neutral (temporarily) so that the rest of the civgroup code works... - if ( (pTarget->bTeam == CIV_TEAM) && (pTarget->uiStatusFlags & SOLDIER_BOXER) ) + if ( (pTarget->bTeam == CIV_TEAM) && (pTarget->flags.uiStatusFlags & SOLDIER_BOXER) ) { SetSoldierNeutral( pTarget ); } @@ -7215,21 +7226,21 @@ BOOLEAN ProcessImplicationsOfPCAttack( SOLDIERTYPE * pSoldier, SOLDIERTYPE ** pp MilitiaChangesSides(); } // JA2 Gold: fix Slay - else if ( (pTarget->bTeam == CIV_TEAM && pTarget->bNeutral) && pTarget->ubProfile == SLAY && pTarget->bLife >= OKLIFE && CheckFact( 155, 0 ) == FALSE ) + else if ( (pTarget->bTeam == CIV_TEAM && pTarget->aiData.bNeutral) && pTarget->ubProfile == SLAY && pTarget->stats.bLife >= OKLIFE && CheckFact( 155, 0 ) == FALSE ) { TriggerNPCRecord( SLAY, 1 ); } - else if ( (pTarget->bTeam == CIV_TEAM) && (pTarget->ubCivilianGroup == 0) && (pTarget->bNeutral) && !( pTarget->uiStatusFlags & SOLDIER_VEHICLE ) ) + else if ( (pTarget->bTeam == CIV_TEAM) && (pTarget->ubCivilianGroup == 0) && (pTarget->aiData.bNeutral) && !( pTarget->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { if ( pTarget->ubBodyType == COW && gWorldSectorX == 10 && gWorldSectorY == MAP_ROW_F ) { // hicks could get mad!!! HickCowAttacked( pSoldier, pTarget ); } - else if (pTarget->ubProfile == PABLO && pTarget->bLife >= OKLIFE && CheckFact( FACT_PABLO_PUNISHED_BY_PLAYER, 0 ) && !CheckFact( 38, 0 ) ) + else if (pTarget->ubProfile == PABLO && pTarget->stats.bLife >= OKLIFE && CheckFact( FACT_PABLO_PUNISHED_BY_PLAYER, 0 ) && !CheckFact( 38, 0 ) ) { TriggerNPCRecord( PABLO, 3 ); - // Nailed Pablo. So reset the fact that he stole from the last shipment since he's supposed to be returning + // Nailed Pablo. So reset the fact that he stole from the last shipment since he's supposed to be returning // the goods now. SetFactFalse( FACT_PABLOS_STOLE_FROM_LATEST_SHIPMENT); SetFactFalse( FACT_PLAYER_FOUND_ITEMS_MISSING); @@ -7256,14 +7267,14 @@ BOOLEAN ProcessImplicationsOfPCAttack( SOLDIERTYPE * pSoldier, SOLDIERTYPE ** pp if (pSoldier->ubProfile != SLAY) // attacked by someone other than Slay { // change attitude - pTarget->bAttitude = AGGRESSIVE; + pTarget->aiData.bAttitude = AGGRESSIVE; } } - if ( pTarget->ubCivilianGroup && ( (pTarget->bTeam == gbPlayerNum) || pTarget->bNeutral ) ) + if ( pTarget->ubCivilianGroup && ( (pTarget->bTeam == gbPlayerNum) || pTarget->aiData.bNeutral ) ) { #ifdef JA2TESTVERSION - if (pTarget->uiStatusFlags & SOLDIER_PC) + if (pTarget->flags.uiStatusFlags & SOLDIER_PC) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"%s is changing teams", pTarget->name ); } @@ -7273,7 +7284,7 @@ BOOLEAN ProcessImplicationsOfPCAttack( SOLDIERTYPE * pSoldier, SOLDIERTYPE ** pp CivilianGroupMemberChangesSides( pTarget ); - if (pTarget->ubProfile != NO_PROFILE && pTarget->bLife >= OKLIFE && pTarget->bVisible == TRUE) + if (pTarget->ubProfile != NO_PROFILE && pTarget->stats.bLife >= OKLIFE && pTarget->bVisible == TRUE) { // trigger quote! PauseAITemporarily(); @@ -7281,7 +7292,7 @@ BOOLEAN ProcessImplicationsOfPCAttack( SOLDIERTYPE * pSoldier, SOLDIERTYPE ** pp //TriggerNPCWithIHateYouQuote( pTarget->ubProfile ); } } - else if ( pTarget->ubCivilianGroup != NON_CIV_GROUP && !( pTarget->uiStatusFlags & SOLDIER_BOXER ) ) + else if ( pTarget->ubCivilianGroup != NON_CIV_GROUP && !( pTarget->flags.uiStatusFlags & SOLDIER_BOXER ) ) { // Firing at a civ in a civ group who isn't hostile... if anyone in that civ group can see this // going on they should become hostile. @@ -7290,15 +7301,15 @@ BOOLEAN ProcessImplicationsOfPCAttack( SOLDIERTYPE * pSoldier, SOLDIERTYPE ** pp else if ( pTarget->bTeam == gbPlayerNum && !(gTacticalStatus.uiFlags & INCOMBAT) ) { // firing at one of our own guys who is not a rebel etc - if ( pTarget->bLife >= OKLIFE && !(pTarget->bCollapsed) && !AM_A_ROBOT( pTarget ) && (bReason == REASON_NORMAL_ATTACK ) ) + if ( pTarget->stats.bLife >= OKLIFE && !(pTarget->bCollapsed) && !AM_A_ROBOT( pTarget ) && (bReason == REASON_NORMAL_ATTACK ) ) { // OK, sturn towards the prick // Change to fire ready animation ConvertGridNoToXY( pSoldier->sGridNo, &sTargetXPos, &sTargetYPos ); - pTarget->fDontChargeReadyAPs = TRUE; + pTarget->flags.fDontChargeReadyAPs = TRUE; // Ready weapon - SoldierReadyWeapon( pTarget, sTargetXPos, sTargetYPos, FALSE ); + pTarget->SoldierReadyWeapon( sTargetXPos, sTargetYPos, FALSE ); // ATE: Depending on personality, fire back..... @@ -7308,14 +7319,16 @@ BOOLEAN ProcessImplicationsOfPCAttack( SOLDIERTYPE * pSoldier, SOLDIERTYPE ** pp // Toggle burst capable... if ( !pTarget->bDoBurst ) { - if ( IsGunBurstCapable( pTarget, HANDPOS , FALSE ) ) + // Changed by ADB, 1513 + //if ( IsGunBurstCapable( pTarget, HANDPOS , FALSE ) ) + if ( IsGunBurstCapable( &pTarget->inv[HANDPOS], FALSE, pTarget ) ) { ChangeWeaponMode( pTarget ); } } // Fire back! - HandleItem( pTarget, pSoldier->sGridNo, pSoldier->bLevel, pTarget->inv[ HANDPOS ].usItem, FALSE ); + HandleItem( pTarget, pSoldier->sGridNo, pSoldier->pathing.bLevel, pTarget->inv[ HANDPOS ].usItem, FALSE ); } @@ -7348,7 +7361,7 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) UINT8 ubID; #if 0 -// 0verhaul: None of this is necessary anymore with the new attack busy system +// 0verhaul: None of this is necessary anymore with the new attack busy system if (ubID == NOBODY) { pSoldier = NULL; @@ -7411,8 +7424,8 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) return( NULL ); } - // I'm going to go out on limb here and decide that from this point on we really care about the current soldier who - // started this chain of events. So we'll grab that one instead of relying on the correct one passed in. + // I'm going to go out on limb here and decide that from this point on we really care about the current soldier who + // started this chain of events. So we'll grab that one instead of relying on the correct one passed in. // This should help with collapses and other 'attacks' with // no attackers that happened due to actions from other soldiers or turns, shots against dead bodies, etc. @@ -7429,16 +7442,16 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) cnt++) { if (MercPtrs[ cnt ] && - MercPtrs[ cnt ]->uiStatusFlags & SOLDIER_UNDERAICONTROL) + MercPtrs[ cnt ]->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL) { pSoldier = MercPtrs[ cnt ]; break; } } } - // If we still haven't figured out who last acted, it could be that the team number changed during the attack. Unfortunately this - // can happen during a switch from real-time. For now we will assume the last actor was a PC, but a real "Who started this?" pointer - // would work quite well. If only I could close all the holes that the UI opens so that one routine could handle everything. + // If we still haven't figured out who last acted, it could be that the team number changed during the attack. Unfortunately this + // can happen during a switch from real-time. For now we will assume the last actor was a PC, but a real "Who started this?" pointer + // would work quite well. If only I could close all the holes that the UI opens so that one routine could handle everything. if (!pSoldier) { pSoldier = MercPtrs[ gusSelectedSoldier ]; @@ -7488,7 +7501,7 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) } #if 0 -// 0verhaul: This is moved to the end loop where everybody's state is reset for the next action +// 0verhaul: This is moved to the end loop where everybody's state is reset for the next action if (pTarget) { // reset # of shotgun pellets hit by @@ -7503,7 +7516,7 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) pSoldier->ubAttackingHand = HANDPOS; // if there is a valid target, and our attack was noticed - if ( pTarget && (pSoldier->uiStatusFlags & SOLDIER_ATTACK_NOTICED) ) + if ( pTarget && (pSoldier->flags.uiStatusFlags & SOLDIER_ATTACK_NOTICED) ) { // stuff that only applies to when we attack if ( pTarget->ubBodyType != CROW ) @@ -7520,7 +7533,7 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) // global - // ATE: If we are an animal, etc, don't change to hostile... + // ATE: If we are an animal, etc, don't change to hostile... // ( and don't go into combat ) if ( pTarget->ubBodyType == CROW ) { @@ -7538,9 +7551,9 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) { if ( pTeamSoldier->ubBodyType == CROW ) { - if ( pTeamSoldier->bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY ) + if ( pTeamSoldier->aiData.bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY ) { - //ZEROTIMECOUNTER( pTeamSoldier->AICounter ); + //ZEROTIMECOUNTER( pTeamSoldier->timeCounters.AICounter ); //MakeCivHostile( pTeamSoldier, 2 ); @@ -7558,7 +7571,7 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) if ( gTacticalStatus.bBoxingState == BOXING ) { - if ( pTarget && pTarget->bLife <= 0 ) + if ( pTarget && pTarget->stats.bLife <= 0 ) { // someone has won! EndBoxingMatch( pTarget ); @@ -7569,12 +7582,12 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) // if soldier and target were not both players and target was not under fire before... if ( ( pSoldier->bTeam != gbPlayerNum || pTarget->bTeam != gbPlayerNum ) ) { - if (pTarget->bOppList[ pSoldier->ubID ] != SEEN_CURRENTLY ) + if (pTarget->aiData.bOppList[ pSoldier->ubID ] != SEEN_CURRENTLY ) { NoticeUnseenAttacker( pSoldier, pTarget, 0 ); } // "under fire" lasts for 2 turns - pTarget->bUnderFire = 2; + pTarget->aiData.bUnderFire = 2; } } @@ -7585,7 +7598,7 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, ">>Invalid target attacked!" ); } - else if ( ! (pSoldier->uiStatusFlags & SOLDIER_ATTACK_NOTICED) ) + else if ( ! (pSoldier->flags.uiStatusFlags & SOLDIER_ATTACK_NOTICED) ) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, ">>Attack not noticed" ); } @@ -7596,14 +7609,14 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) fEnterCombat = FALSE; } - if ( pSoldier->fSayAmmoQuotePending ) + if ( pSoldier->flags.fSayAmmoQuotePending ) { - pSoldier->fSayAmmoQuotePending = FALSE; + pSoldier->flags.fSayAmmoQuotePending = FALSE; TacticalCharacterDialogue( pSoldier, QUOTE_OUT_OF_AMMO ); } - if (pSoldier->uiStatusFlags & SOLDIER_PC) - { + if (pSoldier->flags.uiStatusFlags & SOLDIER_PC) + { UnSetUIBusy( ubID ); } else @@ -7629,11 +7642,11 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) // If we are in a meanwhile... don't enter combat here... if ( !AreInMeanwhile( ) ) { - EnterCombatMode( pSoldier->bTeam ); + EnterCombatMode( pSoldier->bTeam ); } } - pSoldier->uiStatusFlags &= (~SOLDIER_ATTACK_NOTICED); + pSoldier->flags.uiStatusFlags &= (~SOLDIER_ATTACK_NOTICED); } if ( gTacticalStatus.fKilledEnemyOnAttack ) @@ -7647,21 +7660,21 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) HandleAnyStatChangesAfterAttack( ); - if ( gTacticalStatus.fItemsSeenOnAttack && gTacticalStatus.ubCurrentTeam == gbPlayerNum ) + if ( gTacticalStatus.fItemsSeenOnAttack && gTacticalStatus.ubCurrentTeam == gbPlayerNum ) { gTacticalStatus.fItemsSeenOnAttack = FALSE; // Display quote! if ( !AM_AN_EPC( MercPtrs[ gTacticalStatus.ubItemsSeenOnAttackSoldier ] ) ) { - TacticalCharacterDialogueWithSpecialEvent( MercPtrs[ gTacticalStatus.ubItemsSeenOnAttackSoldier ], (UINT16)( QUOTE_SPOTTED_SOMETHING_ONE + Random( 2 ) ), DIALOGUE_SPECIAL_EVENT_SIGNAL_ITEM_LOCATOR_START, gTacticalStatus.usItemsSeenOnAttackGridNo, 0 ); + TacticalCharacterDialogueWithSpecialEvent( MercPtrs[ gTacticalStatus.ubItemsSeenOnAttackSoldier ], (UINT16)( QUOTE_SPOTTED_SOMETHING_ONE + Random( 2 ) ), DIALOGUE_SPECIAL_EVENT_SIGNAL_ITEM_LOCATOR_START, gTacticalStatus.sItemsSeenOnAttackGridNo, 0 ); } else { // Turn off item lock for locators... gTacticalStatus.fLockItemLocators = FALSE; // Slide to location! - SlideToLocation( 0, gTacticalStatus.usItemsSeenOnAttackGridNo ); + SlideToLocation( 0, gTacticalStatus.sItemsSeenOnAttackGridNo ); } } @@ -7678,9 +7691,9 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) { if ( pSightSoldier->bActive && pSightSoldier->bInSector ) { - RevealRoofsAndItems( pSightSoldier, TRUE, FALSE, pSightSoldier->bLevel, FALSE ); + RevealRoofsAndItems( pSightSoldier, TRUE, FALSE, pSightSoldier->pathing.bLevel, FALSE ); } - } + } gTacticalStatus.uiFlags &= ~CHECK_SIGHT_AT_END_OF_ATTACK; } @@ -7725,11 +7738,11 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) if ( pSoldier ) { pSoldier->bNumPelletsHitBy = 0; - if ( !( pSoldier->uiStatusFlags & SOLDIER_TURNINGFROMHIT ) ) + if ( !( pSoldier->flags.uiStatusFlags & SOLDIER_TURNINGFROMHIT ) ) { // 0verhaul: This is an ugly hack. I don't like it, but until I figure out a better solution // for turning from a hit, it's the only way to not stop a soldier in mid-turn. - pSoldier->fGettingHit = FALSE; + pSoldier->flags.fGettingHit = FALSE; } if (pSoldier->ubAttackerID != NOBODY ) @@ -7742,7 +7755,7 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) pSoldier->ubPreviousAttackerID = pSoldier->ubAttackerID; // Why not keep the attacker ID for a dead queen monster? - if ( pSoldier->bLife != 0 && pSoldier->ubBodyType != QUEENMONSTER ) + if ( pSoldier->stats.bLife != 0 && pSoldier->ubBodyType != QUEENMONSTER ) { pSoldier->ubAttackerID = NOBODY; } @@ -7758,7 +7771,7 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) SOLDIERTYPE * ReduceAttackBusyCount( ) { #if 0 - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("ReduceAttackBusyCount") ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("ReduceAttackBusyCount") ); if ( ubID == NOBODY ) { return( InternalReduceAttackBusyCount( ubID, fCalledByAttacker, NOBODY ) ); @@ -7768,30 +7781,30 @@ SOLDIERTYPE * ReduceAttackBusyCount( ) return( InternalReduceAttackBusyCount( ubID, fCalledByAttacker, MercPtrs[ ubID ]->ubTargetID ) ); } #endif -// 0verhaul: This is now a simple subroutine. +// 0verhaul: This is now a simple subroutine. return InternalReduceAttackBusyCount( ); } SOLDIERTYPE * FreeUpAttacker( ) { // Okay, so the objective here is not to simply decrease the ABC, but to twiddle it and see what - // falls out. So there's an increase followed immediately by a decrease. + // falls out. So there's an increase followed immediately by a decrease. // If the ABC is 0 at this point, such as an aborted action might give, this will finalize the // action and allow the soldier to try something else. - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("FreeUpAttacker") ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("FreeUpAttacker") ); DebugAttackBusy( "Freeing up attacker\n"); gTacticalStatus.ubAttackBusyCount++; return( ReduceAttackBusyCount( ) ); } #if 0 -// 0verhaul: These routines are declared obsolete. Call ReduceAttackBusyCount instead. +// 0verhaul: These routines are declared obsolete. Call ReduceAttackBusyCount instead. SOLDIERTYPE * FreeUpAttackerGivenTarget( UINT8 ubID, UINT8 ubTargetID ) { // Strange as this may seem, this function returns a pointer to // the *target* in case the target has changed sides as a result // of being attacked - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("FreeUpAttackerGivenTarget") ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("FreeUpAttackerGivenTarget") ); return( InternalReduceAttackBusyCount( ubID, TRUE, ubTargetID ) ); } @@ -7800,7 +7813,7 @@ SOLDIERTYPE * ReduceAttackBusyGivenTarget( UINT8 ubID, UINT8 ubTargetID ) // Strange as this may seem, this function returns a pointer to // the *target* in case the target has changed sides as a result // of being attacked - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("ReduceAttackBusyGivenTarget") ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("ReduceAttackBusyGivenTarget") ); return( InternalReduceAttackBusyCount( ubID, FALSE, ubTargetID ) ); } #endif @@ -7857,7 +7870,7 @@ void ResetAllMercSpeeds( ) } -void SetActionToDoOnceMercsGetToLocation( UINT8 ubActionCode, INT8 bNumMercsWaiting, UINT32 uiData1, UINT32 uiData2, UINT32 uiData3 ) +void SetActionToDoOnceMercsGetToLocation( UINT8 ubActionCode, INT8 bNumMercsWaiting, UINT32 uiData1, UINT32 uiData2, UINT32 uiData3 ) { gubWaitingForAllMercsToExitCode = ubActionCode; gbNumMercsUntilWaitingOver = bNumMercsWaiting; @@ -7911,7 +7924,7 @@ void CencelAllActionsForTimeCompression( void ) if ( pSoldier->bInSector ) { // Hault! - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); // END AI actions CancelAIAction( pSoldier, TRUE ); @@ -7969,7 +7982,7 @@ void RemoveSoldierFromTacticalSector( SOLDIERTYPE *pSoldier, BOOLEAN fAdjustSele InitSoldierOppList( pSoldier ); // Remove! - RemoveSoldierFromGridNo( pSoldier ); + pSoldier->RemoveSoldierFromGridNo( ); RemoveMercSlot( pSoldier ); @@ -7980,9 +7993,9 @@ void RemoveSoldierFromTacticalSector( SOLDIERTYPE *pSoldier, BOOLEAN fAdjustSele { if ( guiCurrentScreen == GAME_SCREEN ) { - if ( gusSelectedSoldier == pSoldier->ubID ) + if ( gusSelectedSoldier == pSoldier->ubID ) { - ubID = FindNextActiveAndAliveMerc( pSoldier, FALSE, FALSE ); + ubID = FindNextActiveAndAliveMerc( pSoldier, FALSE, FALSE ); if ( ubID != NOBODY && ubID != gusSelectedSoldier ) { @@ -8063,13 +8076,13 @@ void InitializeTacticalStatusAtBattleStart( void ) gTacticalStatus.ubTheChosenOne = NOBODY; - ClearIntList(); + ClearIntList(); // make sure none of our guys have leftover shock values etc for ( cnt = gTacticalStatus.Team[ 0 ].bFirstID; cnt <= gTacticalStatus.Team[ 0 ].bLastID; cnt++ ) { pSoldier = MercPtrs[ cnt ]; - pSoldier->bShock = 0; + pSoldier->aiData.bShock = 0; pSoldier->bTilesMoved = 0; } @@ -8159,9 +8172,9 @@ void DoPOWPathChecks( void ) } // free! free! // put them on any available squad - pSoldier->bNeutral = FALSE; + pSoldier->aiData.bNeutral = FALSE; AddCharacterToAnySquad( pSoldier ); - DoMercBattleSound( pSoldier, BATTLE_SOUND_COOL1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_COOL1 ); } } } @@ -8180,7 +8193,7 @@ BOOLEAN HostileCiviliansPresent( void ) { pSoldier = MercPtrs[ iLoop ]; - if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife > 0 && !pSoldier->bNeutral ) + if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 && !pSoldier->aiData.bNeutral ) { return( TRUE ); } @@ -8203,7 +8216,7 @@ BOOLEAN HostileCiviliansWithGunsPresent( void ) { pSoldier = MercPtrs[ iLoop ]; - if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife > 0 && !pSoldier->bNeutral ) + if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 && !pSoldier->aiData.bNeutral ) { if ( FindAIUsableObjClass( pSoldier, IC_WEAPON ) == -1 ) { @@ -8230,10 +8243,10 @@ BOOLEAN HostileBloodcatsPresent( void ) { pSoldier = MercPtrs[ iLoop ]; - //KM : Aug 11, 1999 -- Patch fix: Removed the check for bNeutral. Bloodcats automatically become hostile - // on site. Because the check used to be there, it was possible to get into a 2nd battle elsewhere - // which is BAD BAD BAD! - if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife > 0 && pSoldier->ubBodyType == BLOODCAT ) + //KM : Aug 11, 1999 -- Patch fix: Removed the check for bNeutral. Bloodcats automatically become hostile + // on site. Because the check used to be there, it was possible to get into a 2nd battle elsewhere + // which is BAD BAD BAD! + if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 && pSoldier->ubBodyType == BLOODCAT ) { return( TRUE ); } @@ -8267,13 +8280,13 @@ void HandleCreatureTenseQuote( ) gTacticalStatus.uiCreatureTenseQuoteLastUpdate = uiTime; // set up soldier ptr as first element in mercptrs list - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) { // Add guy if he's a candidate... - if ( OK_INSECTOR_MERC( pTeamSoldier ) && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->fMercAsleep ) + if ( OK_INSECTOR_MERC( pTeamSoldier ) && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->flags.fMercAsleep ) { ubMercsInSector[ ubNumMercs ] = (UINT8)cnt; ubNumMercs++; @@ -8300,9 +8313,9 @@ void HandleCreatureTenseQuote( ) void DoCreatureTensionQuote( SOLDIERTYPE *pSoldier ) { - INT32 iRandomQuote; + INT32 iRandomQuote; BOOLEAN fCanDoQuote = TRUE; - INT32 iQuoteToUse; + INT32 iQuoteToUse; // Check for playing smell quote.... iRandomQuote = Random( 3 ); @@ -8356,7 +8369,7 @@ void DoCreatureTensionQuote( SOLDIERTYPE *pSoldier ) } if ( fCanDoQuote ) - { + { TacticalCharacterDialogue( pSoldier, (INT16)iQuoteToUse ); } } diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index a36c3afa..75a01e4b 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -3,13 +3,12 @@ #include #include -//#include "container.h" #include "Soldier Control.h" #include "overhead types.h" #include "soldier find.h" #define ADD_SOLDIER_NO_PROFILE_ID 200 -#define MAX_REALTIME_SPEED_VAL 10 +#define MAX_REALTIME_SPEED_VAL 10 /* enum @@ -45,7 +44,7 @@ typedef struct { UINT8 bFirstID; UINT8 bLastID; - COLORVAL RadarColor; + COLORVAL RadarColor; INT8 bSide; INT8 bMenInSector; UINT8 ubLastMercToRadio; @@ -143,7 +142,7 @@ typedef struct BOOLEAN ubItemsSeenOnAttackSoldier; BOOLEAN fBeenInCombatOnce; BOOLEAN fSaidCreatureSmellQuote; - UINT16 usItemsSeenOnAttackGridNo; + INT16 sItemsSeenOnAttackGridNo; BOOLEAN fLockItemLocators; UINT8 ubLastQuoteSaid; UINT8 ubLastQuoteProfileNUm; @@ -174,14 +173,14 @@ typedef struct INT8 bGuideDescriptionSectorX; INT8 bGuideDescriptionSectorY; INT8 fEnemyFlags; - BOOLEAN fAutoBandagePending; - BOOLEAN fHasEnteredCombatModeSinceEntering; - BOOLEAN fDontAddNewCrows; - UINT8 ubMorePadding; - UINT16 sCreatureTenseQuoteDelay; - UINT32 uiCreatureTenseQuoteLastUpdate; + BOOLEAN fAutoBandagePending; + BOOLEAN fHasEnteredCombatModeSinceEntering; + BOOLEAN fDontAddNewCrows; + UINT8 ubMorePadding; + UINT16 sCreatureTenseQuoteDelay; + UINT32 uiCreatureTenseQuoteLastUpdate; - // PADDING GONE!!!!! + // PADDING GONE!!!!! } TacticalStatusType; @@ -198,7 +197,7 @@ extern CHAR8 gzDirectionStr[][ 30 ]; // TEMP FOR E3 extern UINT8 gubCurrentScene; -extern CHAR8 *GetSceneFilename( ); +extern CHAR8 *GetSceneFilename( ); extern INT8 ubLevelMoveLink[ 10 ]; // Soldier List used for all soldier overhead interaction @@ -233,7 +232,7 @@ extern BOOLEAN FlatRoofAboveGridNo( INT32 iMapIndex ); BOOLEAN ExecuteOverhead( ); -BOOLEAN ResetAllAnimationCache( ); +BOOLEAN ResetAllAnimationCache( ); void EndTurn( ); void EndTurn( UINT8 ubNextTeam ); @@ -241,12 +240,12 @@ void EndTurn( UINT8 ubNextTeam ); void StartPlayerTeamTurn( BOOLEAN fDoBattleSnd, BOOLEAN fEnteringCombatMode ); void EndTacticalDemo( ); -void SelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fForceReselect ); +void SelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fForceReselect ); //Kaiden: Function declaration from UB to reveal all items after combat. void RevealAllDroppedEnemyItems(); -void LocateGridNo( UINT16 sGridNo ); +void LocateGridNo( INT16 sGridNo ); void LocateSoldier( UINT16 usID, BOOLEAN fSetLocator); void BeginTeamTurn( UINT8 ubTeam ); @@ -268,7 +267,7 @@ void StopMercAnimation( BOOLEAN fStop ); UINT32 EnterTacticalDemoMode(); -BOOLEAN UIOKMoveDestination( SOLDIERTYPE *pSoldier, UINT16 usMapPos ); +BOOLEAN UIOKMoveDestination( SOLDIERTYPE *pSoldier, INT16 sMapPos ); INT16 FindAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pubDirection, INT16 *psAdjustedGridNo, BOOLEAN fForceToPerson, BOOLEAN fDoor ); INT16 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pubDirection, INT16 *psAdjustedGridNo, BOOLEAN fForceToPerson, BOOLEAN fDoor ); @@ -285,7 +284,7 @@ BOOLEAN IsValidTargetMerc( UINT8 ubSoldierID ); INT32 GetFreeMercSlot(void); void RecountMercSlots(void); INT32 AddMercSlot( SOLDIERTYPE *pSoldier ); -BOOLEAN RemoveMercSlot( SOLDIERTYPE *pSoldier ); +BOOLEAN RemoveMercSlot( SOLDIERTYPE *pSoldier ); INT32 AddAwaySlot( SOLDIERTYPE *pSoldier ); BOOLEAN RemoveAwaySlot( SOLDIERTYPE *pSoldier ); @@ -308,7 +307,7 @@ SOLDIERTYPE * FreeUpAttacker( ); BOOLEAN PlayerTeamFull( ); -void SetActionToDoOnceMercsGetToLocation( UINT8 ubActionCode, INT8 bNumMercsWaiting, UINT32 uiData1, UINT32 uiData2, UINT32 uiData3 ); +void SetActionToDoOnceMercsGetToLocation( UINT8 ubActionCode, INT8 bNumMercsWaiting, UINT32 uiData1, UINT32 uiData2, UINT32 uiData3 ); void ResetAllMercSpeeds( ); diff --git a/Tactical/PATHAI.H b/Tactical/PATHAI.H index 11dbdea2..c5ffd967 100644 --- a/Tactical/PATHAI.H +++ b/Tactical/PATHAI.H @@ -1,7 +1,7 @@ /* - Filename : pathai.h - Author : Ray E. Bornert II - Date : 1992-MAR-15 + Filename : pathai.h + Author : Ray E. Bornert II + Date : 1992-MAR-15 Copyright (C) 1993 HixoxiH Software */ @@ -222,7 +222,7 @@ extern BOOLEAN gfPathAroundObstacles; extern UINT8 gubGlobalPathFlags; // Ian's terrain values for travelling speed/pathing purposes -// Fixed by CJC March 4, 1998. Please do not change these unless familiar +// Fixed by CJC March 4, 1998. Please do not change these unless familiar // with how this will affect the path code! #define TRAVELCOST_NONE 0 @@ -290,7 +290,7 @@ extern UINT8 gubGlobalPathFlags; #define NO_COPYROUTE 0 #define COPYROUTE 1 -#define COPYREACHABLE 2 +#define COPYREACHABLE 2 #define COPYREACHABLE_AND_APS 3 #define FINDCLIMBPOINTS 4 diff --git a/Tactical/PATHAI.cpp b/Tactical/PATHAI.cpp index 55cfaab9..bb8a2f40 100644 --- a/Tactical/PATHAI.cpp +++ b/Tactical/PATHAI.cpp @@ -1,49 +1,52 @@ /* -Filename : pathai.c -Author : Ray E. Bornert II -Date : 1992-MAR-15 + Filename : pathai.c + Author : Ray E. Bornert II + Date : 1992-MAR-15 -Skip list additions -Author : Chris Camfield -Date : 1997-NOV + Skip list additions + Author : Chris Camfield + Date : 1997-NOV */ #ifdef PRECOMPILEDHEADERS -#include "Tactical All.h" + #include "Tactical All.h" #else -#include -#include -#include "wcheck.h" -#include "stdlib.h" -#include "debug.h" -#include "MemMan.h" -#include "Overhead Types.h" -#include "Soldier Control.h" -#include "Animation Cache.h" -#include "Animation Data.h" -#include "Animation Control.h" -#include "container.h" -#include "interface.h" -#include + #include + #include + #include "wcheck.h" + #include "stdlib.h" + #include "debug.h" + #include "MemMan.h" + #include "Overhead Types.h" -#include "input.h" -#include "english.h" -#include "worlddef.h" -#include "worldman.h" -#include "renderworld.h" -#include "pathai.h" -#include "PathAIDebug.h" -#include "Points.h" -#include "ai.h" -#include "Random.h" -#include "message.h" -#include "structure wrap.h" -#include "keys.h" -#include "gamesettings.h" -#include "Buildings.h" + #include "Animation Cache.h" + #include "Animation Data.h" + #include "Animation Control.h" + #include "container.h" + #include "interface.h" + #include + + #include "input.h" + #include "english.h" + #include "worlddef.h" + #include "worldman.h" + #include "renderworld.h" + #include "pathai.h" + #include "PathAIDebug.h" + #include "Points.h" + #include "ai.h" + #include "Random.h" + #include "message.h" + #include "structure wrap.h" + #include "keys.h" + #include "gamesettings.h" + #include "Buildings.h" #endif #include "PathAIDebug.h" +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; #ifdef USE_ASTAR_PATHS #include "BinaryHeap.hpp" @@ -56,7 +59,7 @@ Date : 1997-NOV extern UINT16 gubAnimSurfaceIndex[ TOTALBODYTYPES ][ NUMANIMATIONSTATES ]; //extern UINT8 gubDiagCost[20]; -// skiplist has extra level of pointers every 4 elements, so a level 5is optimized for +// skiplist has extra level of pointers every 4 elements, so a level 5is optimized for // 4 to the power of 5 elements, or 2 to the power of 10, 1024 //#define PATHAI_VISIBLE_DEBUG @@ -64,11 +67,11 @@ extern UINT16 gubAnimSurfaceIndex[ TOTALBODYTYPES ][ NUMANIMATIONSTATES ]; //#define PATHAI_SKIPLIST_DEBUG #ifdef PATHAI_VISIBLE_DEBUG -#include "video.h" + #include "video.h" -extern INT16 gsCoverValue[WORLD_MAX]; -BOOLEAN gfDisplayCoverValues = TRUE; -BOOLEAN gfDrawPathPoints = TRUE; + extern INT16 gsCoverValue[WORLD_MAX]; + BOOLEAN gfDisplayCoverValues = TRUE; + BOOLEAN gfDrawPathPoints = TRUE; #endif BOOLEAN gfPlotPathToExitGrid = FALSE; @@ -79,14 +82,14 @@ UINT8 gubBuildingInfoToSet; // ABSOLUTE maximums //#ifdef JA2EDITOR -#define ABSMAX_SKIPLIST_LEVEL 5 -#define ABSMAX_TRAIL_TREE (16384) -#define ABSMAX_PATHQ (512) + #define ABSMAX_SKIPLIST_LEVEL 5 + #define ABSMAX_TRAIL_TREE (16384) + #define ABSMAX_PATHQ (512) /* #else -#define ABSMAX_SKIPLIST_LEVEL 5 -#define ABSMAX_TRAIL_TREE (4096) -#define ABSMAX_PATHQ (512) + #define ABSMAX_SKIPLIST_LEVEL 5 + #define ABSMAX_TRAIL_TREE (4096) + #define ABSMAX_PATHQ (512) #endif */ @@ -110,10 +113,10 @@ extern BOOLEAN gfGeneratingMapEdgepoints; struct path_s { INT32 iLocation; //4 - struct path_s * pNext[ABSMAX_SKIPLIST_LEVEL]; //4 * MAX_SKIPLIST_LEVEL (5) = 20 + struct path_s * pNext[ABSMAX_SKIPLIST_LEVEL]; //4 * MAX_SKIPLIST_LEVEL (5) = 20 INT16 sPathNdx; //2 - TRAILCELLTYPE usCostSoFar; //2 - TRAILCELLTYPE usCostToGo; //2 + TRAILCELLTYPE usCostSoFar; //2 + TRAILCELLTYPE usCostToGo; //2 TRAILCELLTYPE usTotalCost; //2 INT8 bLevel; //1 UINT8 ubTotalAPCost; //1 @@ -139,7 +142,7 @@ enum #define EASYWATERCOST TRAVELCOST_FLAT / 2 #define ISWATER(t) (((t)==TRAVELCOST_KNEEDEEP) || ((t)==TRAVELCOST_DEEPWATER)) #define NOPASS (TRAVELCOST_BLOCKED) -//#define VEINCOST TRAVELCOST_FLAT //actual cost for bridges and doors and such +//#define VEINCOST TRAVELCOST_FLAT //actual cost for bridges and doors and such //#define ISVEIN(v) ((v==TRAVELCOST_VEINMID) || (v==TRAVELCOST_VEINEND)) static path_t * pathQ; @@ -150,7 +153,7 @@ static INT32 iClosedListSize; static INT8 bSkipListLevel; static INT32 iSkipListLevelLimit[8] = {0, 4, 16, 64, 256, 1024, 4192, 16384 }; -#define ESTIMATE0 ((dx>dy) ? (dx) : (dy)) +#define ESTIMATE0 ((dx>dy) ? (dx) : (dy)) #define ESTIMATE1 ((dxpNext[0] = pClosedHead;\ -pNew->pNext[1] = pClosedHead->pNext[1];\ -pClosedHead->pNext[1]->pNext[0] = pNew;\ -pClosedHead->pNext[1] = pNew;\ -pNew->iLocation = -1;\ -iClosedListSize++;\ + pNew->pNext[0] = pClosedHead;\ + pNew->pNext[1] = pClosedHead->pNext[1];\ + pClosedHead->pNext[1]->pNext[0] = pNew;\ + pClosedHead->pNext[1] = pNew;\ + pNew->iLocation = -1;\ + iClosedListSize++;\ } #define ClosedListGet( pNew )\ {\ -if (queRequestspNext, 0, sizeof( path_t *) * ABSMAX_SKIPLIST_LEVEL );\ -pNew->bLevel = RandomSkipListLevel();\ -}\ -else if (iClosedListSize > 0)\ -{\ -pNew = pClosedHead->pNext[0];\ -pNew->pNext[1]->pNext[0] = pNew->pNext[0];\ -pNew->pNext[0]->pNext[1] = pNew->pNext[1];\ -iClosedListSize--;\ -queRequests++;\ -memset( pNew->pNext, 0, sizeof( path_t *) * ABSMAX_SKIPLIST_LEVEL );\ -pNew->bLevel = RandomSkipListLevel();\ -}\ -else\ -{\ -pNew = NULL;\ -}\ + if (queRequestspNext, 0, sizeof( path_t *) * ABSMAX_SKIPLIST_LEVEL );\ + pNew->pathing.bLevel = RandomSkipListLevel();\ + }\ + else if (iClosedListSize > 0)\ + {\ + pNew = pClosedHead->pNext[0];\ + pNew->pNext[1]->pNext[0] = pNew->pNext[0];\ + pNew->pNext[0]->pNext[1] = pNew->pNext[1];\ + iClosedListSize--;\ + queRequests++;\ + memset( pNew->pNext, 0, sizeof( path_t *) * ABSMAX_SKIPLIST_LEVEL );\ + pNew->pathing.bLevel = RandomSkipListLevel();\ + }\ + else\ + {\ + pNew = NULL;\ + }\ } */ @@ -248,60 +251,60 @@ pNew = NULL;\ #define ClosedListGet( pNew )\ {\ if (queRequestsbLevel = RandomSkipListLevel();\ -}\ + {\ + pNew = pathQ + (queRequests);\ + queRequests++;\ + pNew->pathing.bLevel = RandomSkipListLevel();\ + }\ else if (iClosedListSize > 0)\ -{\ - pNew = pClosedHead->pNext[0];\ - pClosedHead->pNext[0] = pNew->pNext[0];\ - iClosedListSize--;\ - queRequests++;\ - memset( pNew->pNext, 0, sizeof( path_t *) * ABSMAX_SKIPLIST_LEVEL );\ - pNew->bLevel = RandomSkipListLevel();\ -}\ + {\ + pNew = pClosedHead->pNext[0];\ + pClosedHead->pNext[0] = pNew->pNext[0];\ + iClosedListSize--;\ + queRequests++;\ + memset( pNew->pNext, 0, sizeof( path_t *) * ABSMAX_SKIPLIST_LEVEL );\ + pNew->pathing.bLevel = RandomSkipListLevel();\ + }\ else\ -{\ - pNew = NULL;\ -}\ + {\ + pNew = NULL;\ + }\ } /* #define ClosedListAdd( pNew ) \ {\ -pNew->pNext[0] = pClosedHead;\ -pNew->pNext[1] = pClosedHead->pNext[1];\ -pClosedHead->pNext[1]->pNext[0] = pNew;\ -pClosedHead->pNext[1] = pNew;\ -pNew->iLocation = -1;\ -iClosedListSize++;\ + pNew->pNext[0] = pClosedHead;\ + pNew->pNext[1] = pClosedHead->pNext[1];\ + pClosedHead->pNext[1]->pNext[0] = pNew;\ + pClosedHead->pNext[1] = pNew;\ + pNew->iLocation = -1;\ + iClosedListSize++;\ } #define ClosedListGet( pNew )\ {\ -if (queRequestspNext, 0, sizeof( path_t *) * ABSMAX_SKIPLIST_LEVEL );\ -pNew->bLevel = RandomSkipListLevel();\ -}\ -else if (iClosedListSize > 0)\ -{\ -pNew = pClosedHead->pNext[0];\ -pNew->pNext[1]->pNext[0] = pNew->pNext[0];\ -pNew->pNext[0]->pNext[1] = pNew->pNext[1];\ -iClosedListSize--;\ -queRequests++;\ -memset( pNew->pNext, 0, sizeof( path_t *) * ABSMAX_SKIPLIST_LEVEL );\ -pNew->bLevel = RandomSkipListLevel();\ -}\ -else\ -{\ -pNew = NULL;\ -}\ + if (queRequestspNext, 0, sizeof( path_t *) * ABSMAX_SKIPLIST_LEVEL );\ + pNew->pathing.bLevel = RandomSkipListLevel();\ + }\ + else if (iClosedListSize > 0)\ + {\ + pNew = pClosedHead->pNext[0];\ + pNew->pNext[1]->pNext[0] = pNew->pNext[0];\ + pNew->pNext[0]->pNext[1] = pNew->pNext[1];\ + iClosedListSize--;\ + queRequests++;\ + memset( pNew->pNext, 0, sizeof( path_t *) * ABSMAX_SKIPLIST_LEVEL );\ + pNew->pathing.bLevel = RandomSkipListLevel();\ + }\ + else\ + {\ + pNew = NULL;\ + }\ } */ @@ -309,9 +312,9 @@ pNew = NULL;\ {\ pDel = pQueueHead->pNext[0];\ for (iLoop = 0; iLoop < __min( bSkipListLevel, pDel->bLevel ); iLoop++)\ -{\ - pQueueHead->pNext[iLoop] = pDel->pNext[iLoop];\ -}\ + {\ + pQueueHead->pNext[iLoop] = pDel->pNext[iLoop];\ + }\ iSkipListSize--;\ ClosedListAdd( pDel );\ } @@ -322,49 +325,49 @@ pNew = NULL;\ uiCost = TOTALCOST( pNew );\ memset( pUpdate, 0, MAX_SKIPLIST_LEVEL * sizeof( path_t *) );\ for (iCurrLevel = bSkipListLevel - 1; iCurrLevel >= 0; iCurrLevel--)\ -{\ - pNext = pCurr->pNext[iCurrLevel];\ - while (pNext)\ -{\ - if ( uiCost > TOTALCOST( pNext ) || (uiCost == TOTALCOST( pNext ) && FARTHER( pNew, pNext ) ) )\ -{\ - pCurr = pNext;\ - pNext = pCurr->pNext[iCurrLevel];\ -}\ + {\ + pNext = pCurr->pNext[iCurrLevel];\ + while (pNext)\ + {\ + if ( uiCost > TOTALCOST( pNext ) || (uiCost == TOTALCOST( pNext ) && FARTHER( pNew, pNext ) ) )\ + {\ + pCurr = pNext;\ + pNext = pCurr->pNext[iCurrLevel];\ + }\ else\ -{\ - break;\ -}\ -}\ - pUpdate[iCurrLevel] = pCurr;\ -}\ + {\ + break;\ + }\ + }\ + pUpdate[iCurrLevel] = pCurr;\ + }\ pCurr = pCurr->pNext[0];\ - for (iCurrLevel = 0; iCurrLevel < pNew->bLevel; iCurrLevel++)\ -{\ - if (!(pUpdate[iCurrLevel]))\ -{\ - break;\ -}\ - pNew->pNext[iCurrLevel] = pUpdate[iCurrLevel]->pNext[iCurrLevel];\ - pUpdate[iCurrLevel]->pNext[iCurrLevel] = pNew;\ -}\ + for (iCurrLevel = 0; iCurrLevel < pNew->pathing.bLevel; iCurrLevel++)\ + {\ + if (!(pUpdate[iCurrLevel]))\ + {\ + break;\ + }\ + pNew->pNext[iCurrLevel] = pUpdate[iCurrLevel]->pNext[iCurrLevel];\ + pUpdate[iCurrLevel]->pNext[iCurrLevel] = pNew;\ + }\ iSkipListSize++;\ if (iSkipListSize > iSkipListLevelLimit[bSkipListLevel])\ -{\ - pCurr = pQueueHead;\ - pNext = pQueueHead->pNext[bSkipListLevel - 1];\ - while( pNext )\ -{\ - if (pNext->bLevel > bSkipListLevel)\ -{\ - pCurr->pNext[bSkipListLevel] = pNext;\ - pCurr = pNext;\ -}\ - pNext = pNext->pNext[bSkipListLevel - 1];\ -}\ - pCurr->pNext[bSkipListLevel] = pNext;\ - bSkipListLevel++;\ -}\ + {\ + pCurr = pQueueHead;\ + pNext = pQueueHead->pNext[bSkipListLevel - 1];\ + while( pNext )\ + {\ + if (pNext->pathing.bLevel > bSkipListLevel)\ + {\ + pCurr->pNext[bSkipListLevel] = pNext;\ + pCurr = pNext;\ + }\ + pNext = pNext->pNext[bSkipListLevel - 1];\ + }\ + pCurr->pNext[bSkipListLevel] = pNext;\ + bSkipListLevel++;\ + }\ } #define REMQUEHEADNODE() SkipListRemoveHead(); @@ -372,19 +375,19 @@ pNew = NULL;\ #define DELQUENODE(ndx) SkipListRemoveHead() #define REMAININGCOST(ptr) \ - ( \ +( \ (dy = abs(iDestY-iLocY)), \ (dx = abs(iDestX-iLocX)), \ ESTIMATE \ - ) +) /* #define REMAININGCOST(ptr) \ ( \ -(locY = (ptr)->iLocation/MAPWIDTH), \ -(locX = (ptr)->iLocation%MAPWIDTH), \ -(dy = abs(iDestY-locY)), \ -(dx = abs(iDestX-locX)), \ -ESTIMATE \ + (locY = (ptr)->iLocation/MAPWIDTH), \ + (locX = (ptr)->iLocation%MAPWIDTH), \ + (dy = abs(iDestY-locY)), \ + (dx = abs(iDestX-locX)), \ + ESTIMATE \ ) */ @@ -419,14 +422,14 @@ static UINT32 guiEndPlotGridNo; static INT16 dirDelta[8]= { - -MAPWIDTH, //N - 1-MAPWIDTH, //NE - 1, //E - 1+MAPWIDTH, //SE - MAPWIDTH, //S - MAPWIDTH-1, //SW - -1, //W - -MAPWIDTH-1 //NW + -MAPWIDTH, //N + 1-MAPWIDTH, //NE + 1, //E + 1+MAPWIDTH, //SE + MAPWIDTH, //S + MAPWIDTH-1, //SW + -1, //W + -MAPWIDTH-1 //NW }; #define LOOPING_CLOCKWISE 0 @@ -463,7 +466,7 @@ AStarPathfinder* AStarPathfinder::pThis = &AStarThis; AStarPathfinder& AStarPathfinder::GetInstance() { - //if (pThis) + //if (pThis) //{ // return *pThis; //} @@ -500,7 +503,7 @@ void AStarPathfinder::ResetAStarList() }//end ResetAStarList void AStarPathfinder::SetLoopState(const INT16 node, - int const loopState) + int const loopState) { if ( loopState == LOOPING_REVERSE ) { @@ -549,11 +552,11 @@ INT16 AStarPathfinder::SpacesAway(const INT16 node1, } int AStarPathfinder::GetPath(SOLDIERTYPE *s , - INT16 dest, - INT8 ubLevel, - INT16 usMovementMode, - INT8 bCopy, - UINT8 fFlags ) + INT16 dest, + INT8 ubLevel, + INT16 usMovementMode, + INT8 bCopy, + UINT8 fFlags ) { //copy over private data that makes code more readable this->pSoldier = s; @@ -582,7 +585,7 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s , #endif return( 0 ); } - else if (pSoldier->bLevel != onRooftop) + else if (pSoldier->pathing.bLevel != onRooftop) { DebugMsg( TOPIC_JA2, DBG_LEVEL_0, String( "ASTAR: path failed, different level" ) ); // pathing to a different level... bzzzt! @@ -608,7 +611,7 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s , fGoingThroughDoor = FALSE; fTurnBased = ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) ); - fPathingForPlayer = ( (pSoldier->bTeam == gbPlayerNum) && (!gTacticalStatus.fAutoBandageMode) && !(pSoldier->uiStatusFlags & SOLDIER_PCUNDERAICONTROL) ); + fPathingForPlayer = ( (pSoldier->bTeam == gbPlayerNum) && (!gTacticalStatus.fAutoBandageMode) && !(pSoldier->flags.uiStatusFlags & SOLDIER_PCUNDERAICONTROL) ); fNonFenceJumper = !( IS_MERC_BODY_TYPE( pSoldier ) ); fNonSwimmer = !( IS_MERC_BODY_TYPE( pSoldier ) ); fPathAroundPeople = ( (fFlags & PATH_THROUGH_PEOPLE) == 0 ); @@ -676,24 +679,24 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s , guiTotalPathChecks++; #endif -#ifdef VEHICLE +#ifdef VEHICLE - fMultiTile = ((pSoldier->uiStatusFlags & SOLDIER_MULTITILE) != 0); - if ( fMultiTile == false) + fMultiTile = ((pSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE) != 0); + if ( fMultiTile == false) { fContinuousTurnNeeded = FALSE; } - else + else { // Get animation surface... // Chris_C... change this to use parameter..... UINT16 usAnimSurface = DetermineSoldierAnimationSurface( pSoldier, movementMode ); // Get structure ref... pStructureFileRef = GetAnimationStructureRef( pSoldier->ubID, usAnimSurface, movementMode ); - - if ( pStructureFileRef ) + + if ( pStructureFileRef ) { - fContinuousTurnNeeded = ( ( pSoldier->uiStatusFlags & (SOLDIER_MONSTER | SOLDIER_ANIMAL | SOLDIER_VEHICLE) ) != 0 ); + fContinuousTurnNeeded = ( ( pSoldier->flags.uiStatusFlags & (SOLDIER_MONSTER | SOLDIER_ANIMAL | SOLDIER_VEHICLE) ) != 0 ); /* //bool fVehicle = ( (pSoldier->uiStatusFlags & SOLDIER_VEHICLE) != 0 ); @@ -706,20 +709,20 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s , fTurnSlow = TRUE; } */ - if ( gfEstimatePath ) + if ( gfEstimatePath ) { bOKToAddStructID = IGNORE_PEOPLE_STRUCTURE_ID; } - else if ( pSoldier->pLevelNode != NULL && pSoldier->pLevelNode->pStructureData != NULL ) + else if ( pSoldier->pLevelNode != NULL && pSoldier->pLevelNode->pStructureData != NULL ) { bOKToAddStructID = pSoldier->pLevelNode->pStructureData->usStructureID; } - else + else { bOKToAddStructID = INVALID_STRUCTURE_ID; } } - else + else { // turn off multitile pathing fMultiTile = FALSE; @@ -728,24 +731,24 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s , } #endif - if (fContinuousTurnNeeded == false) + if (fContinuousTurnNeeded == false) { bLoopState = LOOPING_CLOCKWISE; } // if origin and dest is water, then user wants to stay in water! // so, check and set waterToWater flag accordingly - if (dest == NOWHERE) + if (dest == NOWHERE) { bWaterToWater = false; } - else + else { if (ISWATER(gubWorldMovementCosts[StartNode][0][onRooftop]) && ISWATER(gubWorldMovementCosts[DestNode][0][onRooftop])) { bWaterToWater = true; } - else + else { bWaterToWater = false; } @@ -767,7 +770,7 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s , } #if defined( PATHAI_VISIBLE_DEBUG ) - if (gfDisplayCoverValues && gfDrawPathPoints) + if (gfDisplayCoverValues && gfDrawPathPoints) { SetRenderFlags( RENDER_FLAG_FULL ); // The RenderCoverDebugInfo call is now made by RenderWorld. So don't try to call it here @@ -805,8 +808,8 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s , // data and copy into soldier's database if (bCopy == COPYROUTE) { - pSoldier->usPathDataSize = (UINT16) sizePath; - pSoldier->usPathIndex = 0; + pSoldier->pathing.usPathDataSize = (UINT16) sizePath; + pSoldier->pathing.usPathIndex = 0; while (sizePath > 0) { int numSteps = GetNumSteps(parent); @@ -814,13 +817,13 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s , { sizePath--; numSteps--; - pSoldier->usPathingData[sizePath] = GetDirection(parent); + pSoldier->pathing.usPathingData[sizePath] = GetDirection(parent); } parent = GetAStarParent( parent); } // Since the sizePath began as the total path size, it should be 0 when we finish copying it Assert( sizePath == 0); - sizePath = pSoldier->usPathDataSize; + sizePath = pSoldier->pathing.usPathDataSize; } else if (bCopy == NO_COPYROUTE) { @@ -842,7 +845,7 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s , } #if defined( PATHAI_VISIBLE_DEBUG ) - if (gfDisplayCoverValues && gfDrawPathPoints) + if (gfDisplayCoverValues && gfDrawPathPoints) { SetRenderFlags( RENDER_FLAG_FULL ); #if 0 @@ -859,9 +862,9 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s , guiSuccessfulPathChecks++; #endif - //TEMP: This is returning zero when I am generating edgepoints, so I am force returning 1 until - // this is fixed? - if( gfGeneratingMapEdgepoints ) + //TEMP: This is returning zero when I am generating edgepoints, so I am force returning 1 until + // this is fixed? + if( gfGeneratingMapEdgepoints ) { return 1; } @@ -910,7 +913,7 @@ INT16 AStarPathfinder::AStar() //this adds to the heap nodes that might be on a path ExecuteAStarLogic(); - if (OpenHeap.size() == 0) + if (OpenHeap.size() == 0) { return -222;//error code meaning no path at all! } @@ -926,15 +929,15 @@ INT16 AStarPathfinder::AStar() void AStarPathfinder::IncrementLoop() { startingLoop = false; - if ( fContinuousTurnNeeded && direction == gOppositeDirection[ startDir ] ) + if ( fContinuousTurnNeeded && direction == gOppositeDirection[ startDir ] ) { fCheckedBehind = TRUE; } - if (bLoopState == LOOPING_CLOCKWISE) + if (bLoopState == LOOPING_CLOCKWISE) {// backwards direction = gOneCCDirection[ direction ]; } - else + else { direction = gOneCDirection[ direction ]; } @@ -950,7 +953,7 @@ void AStarPathfinder::InitLoop() bool AStarPathfinder::ContinueLoop() { - if (direction == endDir && startingLoop == false) + if (direction == endDir && startingLoop == false) { return false; } @@ -965,9 +968,9 @@ void AStarPathfinder::ExecuteAStarLogic() //ClosedList.push_back(ParentNode); #if defined( PATHAI_VISIBLE_DEBUG ) - if (gfDisplayCoverValues && gfDrawPathPoints) + if (gfDisplayCoverValues && gfDrawPathPoints) { - if (gsCoverValue[ ParentNode ] > 0) + if (gsCoverValue[ ParentNode ] > 0) { gsCoverValue[ ParentNode ] *= -1; } @@ -990,18 +993,18 @@ void AStarPathfinder::ExecuteAStarLogic() } } - if (fContinuousTurnNeeded) + if (fContinuousTurnNeeded) { INT16 parent = GetAStarParent(ParentNode); if (parent == -1) { lastDir = pSoldier->ubDirection; } - else if ( GetLoopState(parent) == false ) + else if ( GetLoopState(parent) == false ) { lastDir = GetDirection(parent); } - else + else { lastDir = gOppositeDirection[ GetDirection(parent) ]; } @@ -1010,7 +1013,7 @@ void AStarPathfinder::ExecuteAStarLogic() bLoopState = LOOPING_CLOCKWISE; fCheckedBehind = FALSE; } - else + else { //startDir and endDir are init to 0, and not reinit after a loop in the original code } @@ -1034,11 +1037,11 @@ void AStarPathfinder::ExecuteAStarLogic() #ifdef VEHICLE //has side effects, including setting loop counters int retVal = VehicleObstacleCheck(); - if (retVal == 1) + if (retVal == 1) { continue; } - else if (retVal == 2) + else if (retVal == 2) { return; } @@ -1067,11 +1070,11 @@ void AStarPathfinder::ExecuteAStarLogic() continue; } - if (gubWorldMovementCosts[CurrentNode][direction][pSoldier->bLevel] == TRAVELCOST_FENCE) + if (gubWorldMovementCosts[CurrentNode][direction][pSoldier->pathing.bLevel] == TRAVELCOST_FENCE) { SetAStarStatus(CurrentNode, AStar_Closed); CurrentNode = CurrentNode + dirDelta[direction]; - if (!NewOKDestination( pSoldier, CurrentNode, fPathAroundPeople, pSoldier->bLevel)) + if (!NewOKDestination( pSoldier, CurrentNode, fPathAroundPeople, pSoldier->pathing.bLevel)) { continue; } @@ -1110,7 +1113,7 @@ void AStarPathfinder::ExecuteAStarLogic() INT16 AStarG = baseGCost + movementG; //if the node is more costly in this path than in another open path, continue if (GetAStarStatus(CurrentNode) == AStar_Open - && AStarG >= GetAStarG(CurrentNode)) + && AStarG >= GetAStarG(CurrentNode)) { continue; } @@ -1124,12 +1127,12 @@ void AStarPathfinder::ExecuteAStarLogic() #ifdef ASTAR_USING_EXTRACOVER //check if we will run out of AP while entering this node or before //if we run out, the merc will stop at the parent node for a turn and be vulnerable - if (mercsMaxAPs && APCost > mercsMaxAPs) + if (mercsMaxAPs && APCost > mercsMaxAPs) { extraGCoverCost = GetExtraGCover(ParentNode); //if the parent did not have the cost cached, then calc it - if (extraGCoverCost == -1) + if (extraGCoverCost == -1) { //use the stance and cover to see how much we really want to stop at the parent node //as opposed to an equal path with different cover @@ -1140,7 +1143,7 @@ void AStarPathfinder::ExecuteAStarLogic() //cache the cost to stay at the parent node SetExtraGCover(ParentNode, extraGCoverCost); } - else + else { //the parent node is too long, all other nodes from start node //will be too long too, and have the extra cost already added @@ -1172,11 +1175,11 @@ void AStarPathfinder::ExecuteAStarLogic() #endif //insert this node onto the heap - if (GetAStarStatus(CurrentNode) == AStar_Init) + if (GetAStarStatus(CurrentNode) == AStar_Init) { OpenHeap.insertElement(CurrentNode, AStarF); } - else + else { OpenHeap.editElement(CurrentNode, AStarF); } @@ -1232,16 +1235,16 @@ int AStarPathfinder::TerrainCostToAStarG(int const terrainCost) { int movementG; // NOTE: on September 24, 1997, Chris went back to a diagonal bias system - if (IsDiagonal(direction) == true) + if (IsDiagonal(direction) == true) { movementG = terrainCost * 14; } - else + else { movementG = terrainCost * 10; } - if ( bLoopState == LOOPING_REVERSE) + if ( bLoopState == LOOPING_REVERSE) { // penalize moving backwards to encourage turning sooner movementG += 500; @@ -1253,14 +1256,14 @@ INT16 AStarPathfinder::CalcAP(int const terrainCost, UINT8 const direction) { // NEW Apr 21 by Ian: abort if cost exceeds budget INT16 movementAPCost; - switch(terrainCost) + switch(terrainCost) { case TRAVELCOST_NONE: movementAPCost = 0; break; case TRAVELCOST_DIRTROAD: case TRAVELCOST_FLAT: movementAPCost = AP_MOVEMENT_FLAT; break; - //case TRAVELCOST_BUMPY: + //case TRAVELCOST_BUMPY: case TRAVELCOST_GRASS: movementAPCost = AP_MOVEMENT_GRASS; break; case TRAVELCOST_THICK: movementAPCost = AP_MOVEMENT_BUSH; break; @@ -1281,14 +1284,14 @@ INT16 AStarPathfinder::CalcAP(int const terrainCost, UINT8 const direction) case TRAVELCOST_FENCE: movementAPCost = AP_JUMPFENCE; break; - case TRAVELCOST_OBSTACLE: + case TRAVELCOST_OBSTACLE: default: return -1; // Cost too much to be considered! } // don't make the mistake of adding directly to // ubCurAPCost, that must be preserved for remaining dirs! - if (IsDiagonal(direction)) + if (IsDiagonal(direction)) { movementAPCost = (movementAPCost * 14) / 10; } @@ -1296,16 +1299,16 @@ INT16 AStarPathfinder::CalcAP(int const terrainCost, UINT8 const direction) int movementModeToUseForAPs = movementMode; // ATE: if water, force to be walking always! - if ( terrainCost == TRAVELCOST_SHORE || terrainCost == TRAVELCOST_KNEEDEEP || terrainCost == TRAVELCOST_DEEPWATER ) + if ( terrainCost == TRAVELCOST_SHORE || terrainCost == TRAVELCOST_KNEEDEEP || terrainCost == TRAVELCOST_DEEPWATER ) { movementModeToUseForAPs = WALKING; } // adjust AP cost for movement mode - switch( movementModeToUseForAPs ) + switch( movementModeToUseForAPs ) { - case RUNNING: - case ADULTMONSTER_WALKING: + case RUNNING: + case ADULTMONSTER_WALKING: // save on casting movementAPCost = (INT16) (movementAPCost * 100 / ( (UINT8) (RUNDIVISOR * 100))); //movementAPCost = (INT16)(DOUBLE)( (sTileCost / RUNDIVISOR) ); break; @@ -1322,41 +1325,41 @@ INT16 AStarPathfinder::CalcAP(int const terrainCost, UINT8 const direction) break; } - if (terrainCost == TRAVELCOST_FENCE) + if (terrainCost == TRAVELCOST_FENCE) { - switch( movementModeToUseForAPs ) + switch( movementModeToUseForAPs ) { - case RUNNING: + case RUNNING: case WALKING : // Here pessimistically assume the path will continue after hopping the fence movementAPCost += AP_CROUCH; break; - case SWATTING: + case SWATTING: // Add cost to stand once there BEFORE jumping.... movementAPCost += AP_CROUCH; break; - case CRAWLING: + case CRAWLING: // Can't do it here..... return -1; } } - else if (terrainCost == TRAVELCOST_NOT_STANDING) + else if (terrainCost == TRAVELCOST_NOT_STANDING) { - switch(movementModeToUseForAPs) + switch(movementModeToUseForAPs) { - case RUNNING: + case RUNNING: case WALKING : // charge crouch APs for ducking head! movementAPCost += AP_CROUCH; break; - default: + default: break; } } - else if (fGoingThroughDoor) + else if (fGoingThroughDoor) { // Uh, there IS a cost to close the door too! // Then if the door has to be unlocked to open there's the cost of locking and unlocking. @@ -1369,7 +1372,7 @@ INT16 AStarPathfinder::CalcAP(int const terrainCost, UINT8 const direction) int AStarPathfinder::CalcG(int* pPrevCost) { //how much is admission to the next tile - if ( gfPathAroundObstacles == false) + if ( gfPathAroundObstacles == false) { return TRAVELCOST_FLAT; } @@ -1379,15 +1382,15 @@ int AStarPathfinder::CalcG(int* pPrevCost) *pPrevCost = nextCost; //if we are holding down shift and finding a direct path, count non obstacles as flat terrain - if (gfPlotDirectPath && nextCost < NOPASS && nextCost != 0) + if (gfPlotDirectPath && nextCost < NOPASS && nextCost != 0) { return TRAVELCOST_FLAT; } //performance: if nextCost is low then do not do many many if == checks - if ( nextCost >= TRAVELCOST_FENCE ) + if ( nextCost >= TRAVELCOST_FENCE ) { - //ATE: Check for differences from reality + //ATE: Check for differences from reality // Is next cost an obstcale if ( nextCost == TRAVELCOST_HIDDENOBSTACLE ) { @@ -1398,7 +1401,7 @@ int AStarPathfinder::CalcG(int* pPrevCost) if( DoesGridnoContainHiddenStruct( CurrentNode, &fHiddenStructVisible ) ) { // Are we not visible, if so use terrain costs! - if ( !fHiddenStructVisible ) + if ( !fHiddenStructVisible ) { // Set cost of terrain! nextCost = gTileTypeMovementCost[ gpWorldLevelData[ CurrentNode ].ubTerrainID ]; @@ -1406,27 +1409,27 @@ int AStarPathfinder::CalcG(int* pPrevCost) } } } - else if ( nextCost == TRAVELCOST_NOT_STANDING ) + else if ( nextCost == TRAVELCOST_NOT_STANDING ) { // for path plotting purposes, use the terrain value nextCost = gTileTypeMovementCost[ gpWorldLevelData[ CurrentNode ].ubTerrainID ]; } - else if ( nextCost == TRAVELCOST_EXITGRID ) + else if ( nextCost == TRAVELCOST_EXITGRID ) { - if (gfPlotPathToExitGrid) + if (gfPlotPathToExitGrid) { // replace with terrain cost so that we can plot path, otherwise is obstacle nextCost = gTileTypeMovementCost[ gpWorldLevelData[ CurrentNode ].ubTerrainID ]; } } - else if ( nextCost == TRAVELCOST_FENCE && fNonFenceJumper ) + else if ( nextCost == TRAVELCOST_FENCE && fNonFenceJumper ) { return -1; } - else if ( IS_TRAVELCOST_DOOR( nextCost ) ) + else if ( IS_TRAVELCOST_DOOR( nextCost ) ) { // don't let anyone path diagonally through doors! - if (IsDiagonal(direction) == true) + if (IsDiagonal(direction) == true) { return -1; } @@ -1434,7 +1437,7 @@ int AStarPathfinder::CalcG(int* pPrevCost) INT16 iDoorGridNo = CurrentNode; bool fDoorIsObstacleIfClosed = FALSE; bool fDoorIsOpen = false; - switch( nextCost ) + switch( nextCost ) { case TRAVELCOST_DOOR_CLOSED_HERE: fDoorIsObstacleIfClosed = TRUE; @@ -1497,29 +1500,29 @@ int AStarPathfinder::CalcG(int* pPrevCost) break; } - if ( fPathingForPlayer && gpWorldLevelData[ iDoorGridNo ].ubExtFlags[0] & MAPELEMENT_EXT_DOOR_STATUS_PRESENT ) + if ( fPathingForPlayer && gpWorldLevelData[ iDoorGridNo ].ubExtFlags[0] & MAPELEMENT_EXT_DOOR_STATUS_PRESENT ) { // check door status DOOR_STATUS* pDoorStatus = GetDoorStatus( iDoorGridNo ); - if (pDoorStatus) + if (pDoorStatus) { fDoorIsOpen = (pDoorStatus->ubFlags & DOOR_PERCEIVED_OPEN) != 0; } - else + else { // door destroyed? nextCost = gTileTypeMovementCost[ gpWorldLevelData[ CurrentNode ].ubTerrainID ]; } } - else + else { // check door structure STRUCTURE* pDoorStructure = FindStructure( iDoorGridNo, STRUCTURE_ANYDOOR ); - if (pDoorStructure) + if (pDoorStructure) { fDoorIsOpen = (pDoorStructure->fFlags & STRUCTURE_OPEN) != 0; } - else + else { // door destroyed? nextCost = gTileTypeMovementCost[ gpWorldLevelData[ CurrentNode ].ubTerrainID ]; @@ -1527,51 +1530,51 @@ int AStarPathfinder::CalcG(int* pPrevCost) } // now determine movement cost... if it hasn't been changed already - if ( IS_TRAVELCOST_DOOR( nextCost ) ) + if ( IS_TRAVELCOST_DOOR( nextCost ) ) { - if (fDoorIsOpen) + if (fDoorIsOpen) { - if (fDoorIsObstacleIfClosed) + if (fDoorIsObstacleIfClosed) { nextCost = gTileTypeMovementCost[ gpWorldLevelData[ CurrentNode ].ubTerrainID ]; } - else + else { nextCost = TRAVELCOST_OBSTACLE; } } - else + else { - if (fDoorIsObstacleIfClosed) + if (fDoorIsObstacleIfClosed) { // door is closed and this should be an obstacle, EXCEPT if we are calculating // a path for an enemy or NPC with keys - if ( fPathingForPlayer || ( pSoldier && (pSoldier->uiStatusFlags & (SOLDIER_MONSTER | SOLDIER_ANIMAL) ) ) ) + if ( fPathingForPlayer || ( pSoldier && (pSoldier->flags.uiStatusFlags & (SOLDIER_MONSTER | SOLDIER_ANIMAL) ) ) ) { nextCost = TRAVELCOST_OBSTACLE; } - else + else { // have to check if door is locked and NPC does not have keys! // This function has an inaccurate name. It is actually checking if the door has LOCK info. DOOR* pDoor = FindDoorInfoAtGridNo( iDoorGridNo ); - if (pDoor) + if (pDoor) { - if (!pDoor->fLocked || pSoldier->bHasKeys) + if (!pDoor->fLocked || pSoldier->flags.bHasKeys) { // add to AP cost - //if (maxAPBudget) + //if (maxAPBudget) { fGoingThroughDoor = TRUE; } nextCost = gTileTypeMovementCost[ gpWorldLevelData[ CurrentNode ].ubTerrainID ]; } - else + else { nextCost = TRAVELCOST_OBSTACLE; } } - else + else { // The door is closed, so we still have to open it fGoingThroughDoor = TRUE; @@ -1579,7 +1582,7 @@ int AStarPathfinder::CalcG(int* pPrevCost) } } } - else + else { nextCost = gTileTypeMovementCost[ gpWorldLevelData[ CurrentNode ].ubTerrainID ]; } @@ -1612,7 +1615,7 @@ int AStarPathfinder::CalcG(int* pPrevCost) int AStarPathfinder::CalcH() { - if ( fCopyReachable ) + if ( fCopyReachable ) { //if this is a reachability test, turn AStar into breadth first Dijkstra return 0; // Technically speaking, 0 makes it Dijkstra best-first search @@ -1643,7 +1646,7 @@ int AStarPathfinder::CalcH() { return this->travelcostDiag * y + this->travelcostOrth * (x-y); } - else + else { return this->travelcostDiag * x + this->travelcostOrth * (y-x); } @@ -1719,12 +1722,12 @@ int AStarPathfinder::CalcGCover(int const NodeIndex, // if this merc is inactive, at base, on assignment, dead, unconscious if (!pOpponent || pOpponent->bLife < OKLIFE) { - continue; // next merc + continue; // next merc } // if this man is neutral / on the same side, he's not an opponent if ( CONSIDERED_NEUTRAL( pSoldier, pOpponent ) || (pSoldier->bSide == pOpponent->bSide)) { - continue; // next merc + continue; // next merc } pbPersOL = pSoldier->bOppList + pOpponent->ubID; @@ -1733,12 +1736,12 @@ int AStarPathfinder::CalcGCover(int const NodeIndex, // if this opponent is unknown personally and publicly if ((*pbPersOL == NOT_HEARD_OR_SEEN) && (*pbPublOL == NOT_HEARD_OR_SEEN)) { - continue; // next merc + continue; // next merc } // Special stuff for Carmen the bounty hunter if (pSoldier->bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != 64) { - continue; // next opponent + continue; // next opponent } // if personal knowledge is more up to date or at least equal @@ -1764,7 +1767,7 @@ int AStarPathfinder::CalcGCover(int const NodeIndex, // if this opponent is believed to be too far away to really be a threat if (iThreatRange > MAX_THREAT_RANGE) { - continue; // check next opponent + continue; // check next opponent } Threats.push_back(THREATTYPE()); @@ -1773,7 +1776,7 @@ int AStarPathfinder::CalcGCover(int const NodeIndex, // if the opponent is no threat at all for some reason if (Threats[uiThreatCnt].iValue == -999) { - continue; // check next opponent + continue; // check next opponent } Threats[uiThreatCnt].pOpponent = pOpponent; @@ -1839,15 +1842,15 @@ int AStarPathfinder::CalcCoverValue(INT16 sMyGridNo, INT32 iMyThreat, INT32 iMyA pHim = myThreatspOpponent; sHisGridNo = myThreatssGridNo; - // THE FOLLOWING STUFF IS *VEERRRY SCAARRRY*, BUT SHOULD WORK. IF YOU REALLY + // THE FOLLOWING STUFF IS *VEERRRY SCAARRRY*, BUT SHOULD WORK. IF YOU REALLY // HATE IT, THEN CHANGE ChanceToGetThrough() TO WORK FROM A GRIDNO TO GRIDNO // this is theoretical, and I'm not actually at sMyGridNo right now - sMyRealGridNo = pMe->sGridNo; // remember where I REALLY am + sMyRealGridNo = pMe->sGridNo; // remember where I REALLY am dMyX = pMe->dXPos; dMyY = pMe->dYPos; - pMe->sGridNo = sMyGridNo; // but pretend I'm standing at sMyGridNo + pMe->sGridNo = sMyGridNo; // but pretend I'm standing at sMyGridNo ConvertGridNoToCenterCellXY( sMyGridNo, &sTempX, &sTempY ); pMe->dXPos = (FLOAT) sTempX; pMe->dYPos = (FLOAT) sTempY; @@ -1855,11 +1858,11 @@ int AStarPathfinder::CalcCoverValue(INT16 sMyGridNo, INT32 iMyThreat, INT32 iMyA // if this is theoretical, and he's not actually at hisGrid right now if (pHim->sGridNo != sHisGridNo) { - sHisRealGridNo = pHim->sGridNo; // remember where he REALLY is + sHisRealGridNo = pHim->sGridNo; // remember where he REALLY is dHisX = pHim->dXPos; dHisY = pHim->dYPos; - pHim->sGridNo = sHisGridNo; // but pretend he's standing at sHisGridNo + pHim->sGridNo = sHisGridNo; // but pretend he's standing at sHisGridNo ConvertGridNoToCenterCellXY( sHisGridNo, &sTempX, &sTempY ); pHim->dXPos = (FLOAT) sTempX; pHim->dYPos = (FLOAT) sTempY; @@ -1886,7 +1889,7 @@ int AStarPathfinder::CalcCoverValue(INT16 sMyGridNo, INT32 iMyThreat, INT32 iMyA // because calculating worst case is about to play with it in a big way! if (sHisRealGridNo == NOWHERE) { - sHisRealGridNo = pHim->sGridNo; // remember where he REALLY is + sHisRealGridNo = pHim->sGridNo; // remember where he REALLY is dHisX = pHim->dXPos; dHisY = pHim->dYPos; } @@ -1933,21 +1936,21 @@ int AStarPathfinder::CalcCoverValue(INT16 sMyGridNo, INT32 iMyThreat, INT32 iMyA } // UNDO ANY TEMPORARY "DAMAGE" DONE ABOVE - pMe->sGridNo = sMyRealGridNo; // put me back where I belong! - pMe->dXPos = dMyX; // also change the 'x' - pMe->dYPos = dMyY; // and the 'y' + pMe->sGridNo = sMyRealGridNo; // put me back where I belong! + pMe->dXPos = dMyX; // also change the 'x' + pMe->dYPos = dMyY; // and the 'y' if (sHisRealGridNo != NOWHERE) { - pHim->sGridNo = sHisRealGridNo; // put HIM back where HE belongs! - pHim->dXPos = dHisX; // also change the 'x' - pHim->dYPos = dHisY; // and the 'y' + pHim->sGridNo = sHisRealGridNo; // put HIM back where HE belongs! + pHim->dXPos = dHisX; // also change the 'x' + pHim->dYPos = dHisY; // and the 'y' } // these value should be < 1 million each float HisPosValue = (float) (bHisCTGT * myThreatsiValue * myThreatsiAPs); - float MyPosValue = (float) (bMyCTGT * iMyThreat * iMyAPsLeft); + float MyPosValue = (float) (bMyCTGT * iMyThreat * iMyAPsLeft); // try to account for who outnumbers who: the side with the advantage thus // (hopefully) values offense more, while those in trouble will play defense @@ -1964,20 +1967,20 @@ int AStarPathfinder::CalcCoverValue(INT16 sMyGridNo, INT32 iMyThreat, INT32 iMyA // if my positional value is worth something at all here if (MyPosValue > 0.0) - { - // if I CAN'T crouch when I get there, that makes it significantly less - // appealing a spot (how much depends on range), so that's a penalty to me + { + // if I CAN'T crouch when I get there, that makes it significantly less + // appealing a spot (how much depends on range), so that's a penalty to me //ADB and if I'm not already crouching - if (iMyAPsLeft < AP_CROUCH && movementMode != SWATTING) - // subtract another 1 % penalty for NOT being able to crouch per tile - // the farther away we are, the bigger a difference crouching will make! - MyPosValue -= ((MyPosValue * (AIM_PENALTY_TARGET_CROUCHED + (iRange / CELL_X_SIZE))) / 100); - } + if (iMyAPsLeft < AP_CROUCH && movementMode != SWATTING) + // subtract another 1 % penalty for NOT being able to crouch per tile + // the farther away we are, the bigger a difference crouching will make! + MyPosValue -= ((MyPosValue * (AIM_PENALTY_TARGET_CROUCHED + (iRange / CELL_X_SIZE))) / 100); + } // the farther apart we are, the less important the cover differences are // the less certain his position, the less important cover differences are float ReductionFactor = float (((MAX_THREAT_RANGE - iRange) * myThreatsiCertainty) / - (MAX_THREAT_RANGE * myThreatsiCertainty)); + (MAX_THREAT_RANGE * myThreatsiCertainty)); int iCoverValue = (int) (((HisPosValue - MyPosValue) / HisPosValue) * ReductionFactor); @@ -1985,21 +1988,21 @@ int AStarPathfinder::CalcCoverValue(INT16 sMyGridNo, INT32 iMyThreat, INT32 iMyA } #endif //#ifdef ASTAR_USING_EXTRACOVER -#ifdef VEHICLE +#ifdef VEHICLE void AStarPathfinder::InitVehicle() { - fMultiTile = ((pSoldier->uiStatusFlags & SOLDIER_MULTITILE) != 0); - if (fMultiTile) + fMultiTile = ((pSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE) != 0); + if (fMultiTile) { // Get animation surface... // Chris_C... change this to use parameter..... UINT16 usAnimSurface = DetermineSoldierAnimationSurface( pSoldier, movementMode ); // Get structure ref... pStructureFileRef = GetAnimationStructureRef( pSoldier->ubID, usAnimSurface, movementMode ); - - if ( pStructureFileRef ) + + if ( pStructureFileRef ) { - fContinuousTurnNeeded = ( ( pSoldier->uiStatusFlags & (SOLDIER_MONSTER | SOLDIER_ANIMAL | SOLDIER_VEHICLE) ) != 0 ); + fContinuousTurnNeeded = ( ( pSoldier->flags.uiStatusFlags & (SOLDIER_MONSTER | SOLDIER_ANIMAL | SOLDIER_VEHICLE) ) != 0 ); /* //bool fVehicle = ( (pSoldier->uiStatusFlags & SOLDIER_VEHICLE) != 0 ); @@ -2012,28 +2015,28 @@ void AStarPathfinder::InitVehicle() fTurnSlow = TRUE; } */ - if ( gfEstimatePath ) + if ( gfEstimatePath ) { bOKToAddStructID = IGNORE_PEOPLE_STRUCTURE_ID; } - else if ( pSoldier->pLevelNode != NULL && pSoldier->pLevelNode->pStructureData != NULL ) + else if ( pSoldier->pLevelNode != NULL && pSoldier->pLevelNode->pStructureData != NULL ) { bOKToAddStructID = pSoldier->pLevelNode->pStructureData->usStructureID; } - else + else { bOKToAddStructID = INVALID_STRUCTURE_ID; } } - else + else { // turn off multitile pathing fMultiTile = FALSE; fContinuousTurnNeeded = FALSE; } } - else + else { fContinuousTurnNeeded = FALSE; } @@ -2058,7 +2061,7 @@ int AStarPathfinder::VehicleObstacleCheck() */ int iStructIndex; - if ( bLoopState == LOOPING_REVERSE ) + if ( bLoopState == LOOPING_REVERSE ) { iStructIndex = gOppositeDirection[ gOneCDirection[ direction ] ]; } @@ -2066,17 +2069,17 @@ int AStarPathfinder::VehicleObstacleCheck() iStructIndex = gOneCDirection[ direction ]; } - if (fMultiTile) + if (fMultiTile) { - if ( fContinuousTurnNeeded ) + if ( fContinuousTurnNeeded ) { - if ( direction != lastDir ) + if ( direction != lastDir ) { if ( !OkayToAddStructureToWorld( CurrentNode, onRooftop, &(pStructureFileRef->pDBStructureRef[ iStructIndex ]), bOKToAddStructID ) ) { // we have to abort this loop and possibly reset the loop conditions to // search in the other direction (if we haven't already done the other dir) - if (bLoopState == LOOPING_CLOCKWISE) + if (bLoopState == LOOPING_CLOCKWISE) { startDir = lastDir; endDir = direction; @@ -2087,7 +2090,7 @@ int AStarPathfinder::VehicleObstacleCheck() return 1; //goto NEXTDIR; } - else if ( bLoopState == LOOPING_COUNTERCLOCKWISE && !fCheckedBehind ) + else if ( bLoopState == LOOPING_COUNTERCLOCKWISE && !fCheckedBehind ) { // check rear dir bLoopState = LOOPING_REVERSE; @@ -2101,7 +2104,7 @@ int AStarPathfinder::VehicleObstacleCheck() return 1; //goto NEXTDIR; } - else + else { // done //goto ENDOFLOOP; @@ -2137,7 +2140,7 @@ int AStarPathfinder::VehicleObstacleCheck() bool AStarPathfinder::WantToTraverse() { - // 0verhaul: Cannot change direction over a fence! + // 0verhaul: Cannot change direction over a fence! // Decided on a different way to handle this //if (GetPrevCost(ParentNode) == TRAVELCOST_FENCE && GetDirection(ParentNode) != direction) //{ @@ -2153,19 +2156,19 @@ bool AStarPathfinder::WantToTraverse() //checks distance, mines, cliffs if (gubNPCDistLimitSq) { - if ( gfNPCCircularDistLimit ) + if ( gfNPCCircularDistLimit ) { if (PythSpacesAway( StartNode, CurrentNode) > gubNPCDistLimitSq) { return false; } } - else + else { - if (SpacesAway( StartNode, CurrentNode) > gubNPCDistLimit) + if (SpacesAway( StartNode, CurrentNode) > gubNPCDistLimit) { return false; - } + } } } @@ -2182,7 +2185,7 @@ bool AStarPathfinder::WantToTraverse() { // For our team, skip a location with a known mines unless it is the end of our // path; for others on our side, skip such locations completely; - if (pSoldier->bTeam != gbPlayerNum || CurrentNode != DestNode) + if (pSoldier->bTeam != gbPlayerNum || CurrentNode != DestNode) { if (gpWorldLevelData[CurrentNode].uiFlags & MAPELEMENT_PLAYER_MINE_PRESENT) { @@ -2190,7 +2193,7 @@ bool AStarPathfinder::WantToTraverse() } } } - else + else { // For the enemy, always skip known mines if (gpWorldLevelData[CurrentNode].uiFlags & MAPELEMENT_ENEMY_MINE_PRESENT) @@ -2215,16 +2218,16 @@ bool AStarPathfinder::IsSomeoneInTheWay() { // if contemplated tile is NOT final dest and someone there, disqualify route // when doing a reachable test, ignore all locations with people in them - if (fPathAroundPeople && ( (CurrentNode != DestNode) || fCopyReachable) ) + if (fPathAroundPeople && ( (CurrentNode != DestNode) || fCopyReachable) ) { - // ATE: ONLY cancel if they are moving..... - UINT8 ubMerc = WhoIsThere2( (UINT16) CurrentNode, pSoldier->bLevel); - if ( ubMerc < NOBODY && ubMerc != pSoldier->ubID ) + // ATE: ONLY cancel if they are moving..... + UINT8 ubMerc = WhoIsThere2( (UINT16) CurrentNode, pSoldier->pathing.bLevel); + if ( ubMerc < NOBODY && ubMerc != pSoldier->ubID ) { // Check for movement.... //if ( fTurnBased || ( (Menptr[ ubMerc ].sFinalDestination == Menptr[ ubMerc ].sGridNo) || (Menptr[ ubMerc ].fDelayedMovement) ) ) //{ - return true; + return true; //} // else //{ @@ -2298,7 +2301,7 @@ void RestorePathAIToDefaults( void ) } /////////////////////////////////////////////////////////////////////// -// FINDBESTPATH / +// FINDBESTPATH / //////////////////////////////////////////////////////////////////////// INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMovementMode, INT8 bCopy, UINT8 fFlags ) { @@ -2336,17 +2339,17 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo INT32 iWaterToWater; UINT8 ubCurAPCost,ubAPCost; UINT8 ubNewAPCost=0; -#ifdef VEHICLE - //BOOLEAN fTurnSlow = FALSE; - //BOOLEAN fReverse = FALSE; // stuff for vehicles turning - BOOLEAN fMultiTile, fVehicle; - //INT32 iLastDir, iPrevToLastDir; - //INT8 bVehicleCheckDir; - //UINT16 adjLoc; - STRUCTURE_FILE_REF * pStructureFileRef=NULL; - UINT16 usAnimSurface; - //INT32 iCnt2, iCnt3; -#endif + #ifdef VEHICLE + //BOOLEAN fTurnSlow = FALSE; + //BOOLEAN fReverse = FALSE; // stuff for vehicles turning + BOOLEAN fMultiTile, fVehicle; + //INT32 iLastDir, iPrevToLastDir; + //INT8 bVehicleCheckDir; + //UINT16 adjLoc; + STRUCTURE_FILE_REF * pStructureFileRef=NULL; + UINT16 usAnimSurface; + //INT32 iCnt2, iCnt3; + #endif INT32 iLastDir = 0; @@ -2383,7 +2386,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo BOOLEAN fGoingThroughDoor = FALSE; // for one tile BOOLEAN fContinuousTurnNeeded; BOOLEAN fCloseGoodEnough; - UINT16 usMovementModeToUseForAPs; + UINT16 usMovementModeToUseForAPs; INT16 sClosePathLimit = 0; #ifdef PATHAI_SKIPLIST_DEBUG @@ -2400,19 +2403,19 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo if (iOrigination < 0 || iOrigination > WORLD_MAX) { -#ifdef JA2BETAVERSION - ScreenMsg( FONT_MCOLOR_RED, MSG_TESTVERSION, L"ERROR! Trying to calculate path from off-world gridno %d to %d", iOrigination, sDestination ); -#endif + #ifdef JA2BETAVERSION + ScreenMsg( FONT_MCOLOR_RED, MSG_TESTVERSION, L"ERROR! Trying to calculate path from off-world gridno %d to %d", iOrigination, sDestination ); + #endif return( 0 ); } else if (!GridNoOnVisibleWorldTile( (INT16) iOrigination ) ) { -#ifdef JA2BETAVERSION - ScreenMsg( FONT_MCOLOR_RED, MSG_TESTVERSION, L"ERROR! Trying to calculate path from non-visible gridno %d to %d", iOrigination, sDestination ); -#endif + #ifdef JA2BETAVERSION + ScreenMsg( FONT_MCOLOR_RED, MSG_TESTVERSION, L"ERROR! Trying to calculate path from non-visible gridno %d to %d", iOrigination, sDestination ); + #endif return( 0 ); } - else if (s->bLevel != ubLevel) + else if (s->pathing.bLevel != ubLevel) { // pathing to a different level... bzzzt! return( 0 ); @@ -2420,12 +2423,12 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo if ( gubGlobalPathFlags ) { - fFlags |= gubGlobalPathFlags; + fFlags |= gubGlobalPathFlags; } fTurnBased = ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) ); - fPathingForPlayer = ( (s->bTeam == gbPlayerNum) && (!gTacticalStatus.fAutoBandageMode) && !(s->uiStatusFlags & SOLDIER_PCUNDERAICONTROL) ); + fPathingForPlayer = ( (s->bTeam == gbPlayerNum) && (!gTacticalStatus.fAutoBandageMode) && !(s->flags.uiStatusFlags & SOLDIER_PCUNDERAICONTROL) ); fNonFenceJumper = !( IS_MERC_BODY_TYPE( s ) ); fNonSwimmer = !( IS_MERC_BODY_TYPE( s ) ); if ( fNonSwimmer ) @@ -2439,7 +2442,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo fCloseGoodEnough = ( (fFlags & PATH_CLOSE_GOOD_ENOUGH) != 0); if ( fCloseGoodEnough ) { - sClosePathLimit = __min( PythSpacesAway( (INT16)s->sGridNo, sDestination ) - 1, PATH_CLOSE_RADIUS ); + sClosePathLimit = __min( PythSpacesAway( (INT16)s->sGridNo, sDestination ) - 1, PATH_CLOSE_RADIUS ); if ( sClosePathLimit <= 0 ) { return( 0 ); @@ -2486,9 +2489,9 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo /* if (gubNPCDistLimit == 0) { - return( FALSE ); - } - */ + return( FALSE ); + } + */ } else { @@ -2525,9 +2528,9 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo guiTotalPathChecks++; #endif -#ifdef VEHICLE +#ifdef VEHICLE - fMultiTile = ((s->uiStatusFlags & SOLDIER_MULTITILE) != 0); + fMultiTile = ((s->flags.uiStatusFlags & SOLDIER_MULTITILE) != 0); if (fMultiTile) { // Get animation surface... @@ -2538,20 +2541,20 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo if ( pStructureFileRef ) { - fVehicle = ( (s->uiStatusFlags & SOLDIER_VEHICLE) != 0 ); + fVehicle = ( (s->flags.uiStatusFlags & SOLDIER_VEHICLE) != 0 ); - fContinuousTurnNeeded = ( ( s->uiStatusFlags & (SOLDIER_MONSTER | SOLDIER_ANIMAL | SOLDIER_VEHICLE) ) != 0 ); + fContinuousTurnNeeded = ( ( s->flags.uiStatusFlags & (SOLDIER_MONSTER | SOLDIER_ANIMAL | SOLDIER_VEHICLE) ) != 0 ); /* if (fVehicle && s->bReverse) { - fReverse = TRUE; + fReverse = TRUE; } */ /* if (fVehicle || s->ubBodyType == COW || s->ubBodyType == BLOODCAT) // or a vehicle { - fTurnSlow = TRUE; + fTurnSlow = TRUE; } */ if ( gfEstimatePath ) @@ -2629,9 +2632,9 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo else { if (ISWATER(gubWorldMovementCosts[iOrigination][0][ubLevel]) && ISWATER(gubWorldMovementCosts[iDestination][0][ubLevel])) - iWaterToWater = 1; + iWaterToWater = 1; else - iWaterToWater = 0; + iWaterToWater = 0; } //setup Q and first path record @@ -2680,7 +2683,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo sCurPathNdx = pCurrPtr->sPathNdx; // remember the cost used to get here... - prevCost = gubWorldMovementCosts[ trailTree[ sCurPathNdx ].sGridNo ][ trailTree[ sCurPathNdx ].stepDir ][ ubLevel ]; + prevCost = gubWorldMovementCosts[ trailTree[ sCurPathNdx ].sGridNo ][ trailTree[ sCurPathNdx ].stepDir ][ ubLevel ]; #if defined( PATHAI_VISIBLE_DEBUG ) if (gfDisplayCoverValues && gfDrawPathPoints) @@ -2696,24 +2699,24 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo /* if (fTurnSlow) { - if (pCurrPtr->pNext[0] == 0) - { - if (fReverse) - { - iLastDir = gOppositeDirection[s->ubDirection]; - } - else - { - iLastDir = s->ubDirection; - } - // start prev-to-last dir at same as current (could cause a problem) - iPrevToLastDir = iLastDir; - } - else - { - iPrevToLastDir = trailTree[trailTree[pCurrPtr->sPathNdx].nextLink].dirDelta; - iLastDir = trailTree[pCurrPtr->sPathNdx].dirDelta; - } + if (pCurrPtr->pNext[0] == 0) + { + if (fReverse) + { + iLastDir = gOppositeDirection[s->ubDirection]; + } + else + { + iLastDir = s->ubDirection; + } + // start prev-to-last dir at same as current (could cause a problem) + iPrevToLastDir = iLastDir; + } + else + { + iPrevToLastDir = trailTree[trailTree[pCurrPtr->sPathNdx].nextLink].dirDelta; + iLastDir = trailTree[pCurrPtr->sPathNdx].dirDelta; + } } */ @@ -2739,7 +2742,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo //DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "PATHAI %d", curLoc ) ); - // 0verhaul: Cannot change direction over a fence! + // 0verhaul: Cannot change direction over a fence! if (prevCost == TRAVELCOST_FENCE) { iLoopStart = trailTree[pCurrPtr->sPathNdx].stepDir; @@ -2782,20 +2785,20 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo /* if (fTurnSlow) { - if (iLastDir == iPrevToLastDir) - { - if ( iCnt != iLastDir && iCnt != gOneCDirection[ iLastDir ] && iCnt != gOneCCDirection[ iLastDir ]) - { - goto NEXTDIR; - } - } - else - { - if ( iCnt != iLastDir ) - { - goto NEXTDIR; - } - } + if (iLastDir == iPrevToLastDir) + { + if ( iCnt != iLastDir && iCnt != gOneCDirection[ iLastDir ] && iCnt != gOneCCDirection[ iLastDir ]) + { + goto NEXTDIR; + } + } + else + { + if ( iCnt != iLastDir ) + { + goto NEXTDIR; + } + } } */ @@ -2810,7 +2813,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo if (fMultiTile) { - if ( fContinuousTurnNeeded ) + if ( fContinuousTurnNeeded ) { if ( iCnt != iLastDir ) { @@ -2852,7 +2855,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo } else if ( pStructureFileRef ) { - // check to make sure it's okay for us to turn to the new direction in our current tile + // check to make sure it's okay for us to turn to the new direction in our current tile if (!OkayToAddStructureToWorld( (INT16) curLoc, ubLevel, &(pStructureFileRef->pDBStructureRef[ iStructIndex ]), usOKToAddStructID ) ) { goto NEXTDIR; @@ -2894,7 +2897,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo if (SpacesAway( (INT16) iOrigination, (INT16) newLoc) > gubNPCDistLimit) { goto NEXTDIR; - } + } } } @@ -2934,14 +2937,14 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo { nextCost = gubWorldMovementCosts[ newLoc ][ iCnt ][ ubLevel ]; - //ATE: Check for differences from reality + //ATE: Check for differences from reality // Is next cost an obstcale if ( nextCost == TRAVELCOST_HIDDENOBSTACLE ) { if ( fPathingForPlayer ) { // Is this obstcale a hidden tile that has not been revealed yet? - if( DoesGridnoContainHiddenStruct( (UINT16)newLoc, &fHiddenStructVisible ) ) + if( DoesGridnoContainHiddenStruct( (INT16)newLoc, &fHiddenStructVisible ) ) { // Are we not visible, if so use terrain costs! if ( !fHiddenStructVisible ) @@ -2980,80 +2983,80 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo switch( nextCost ) { - case TRAVELCOST_DOOR_CLOSED_HERE: - fDoorIsObstacleIfClosed = TRUE; - iDoorGridNo = newLoc; - break; - case TRAVELCOST_DOOR_CLOSED_N: - fDoorIsObstacleIfClosed = TRUE; - iDoorGridNo = newLoc + dirDelta[ NORTH ]; - break; - case TRAVELCOST_DOOR_CLOSED_W: - fDoorIsObstacleIfClosed = TRUE; - iDoorGridNo = newLoc + dirDelta[ WEST ]; - break; - case TRAVELCOST_DOOR_OPEN_HERE: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = newLoc; - break; - case TRAVELCOST_DOOR_OPEN_N: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = newLoc + dirDelta[ NORTH ]; - break; - case TRAVELCOST_DOOR_OPEN_NE: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = newLoc + dirDelta[ NORTHEAST ]; - break; - case TRAVELCOST_DOOR_OPEN_E: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = newLoc + dirDelta[ EAST ]; - break; - case TRAVELCOST_DOOR_OPEN_SE: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = newLoc + dirDelta[ SOUTHEAST ]; - break; - case TRAVELCOST_DOOR_OPEN_S: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = newLoc + dirDelta[ SOUTH ]; - break; - case TRAVELCOST_DOOR_OPEN_SW: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = newLoc + dirDelta[ SOUTHWEST ]; - break; - case TRAVELCOST_DOOR_OPEN_W: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = newLoc + dirDelta[ WEST ]; - break; - case TRAVELCOST_DOOR_OPEN_NW: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = newLoc + dirDelta[ NORTHWEST ]; - break; - case TRAVELCOST_DOOR_OPEN_N_N: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = newLoc + dirDelta[ NORTH ] + dirDelta[ NORTH ]; - break; - case TRAVELCOST_DOOR_OPEN_NW_N: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = newLoc + dirDelta[ NORTHWEST ] + dirDelta[ NORTH ]; - break; - case TRAVELCOST_DOOR_OPEN_NE_N: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = newLoc + dirDelta[ NORTHEAST ] + dirDelta[ NORTH ]; - break; - case TRAVELCOST_DOOR_OPEN_W_W: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = newLoc + dirDelta[ WEST ] + dirDelta[ WEST ]; - break; - case TRAVELCOST_DOOR_OPEN_SW_W: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = newLoc + dirDelta[ SOUTHWEST ] + dirDelta[ WEST ]; - break; - case TRAVELCOST_DOOR_OPEN_NW_W: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = newLoc + dirDelta[ NORTHWEST ] + dirDelta[ WEST ]; - break; - default: - break; + case TRAVELCOST_DOOR_CLOSED_HERE: + fDoorIsObstacleIfClosed = TRUE; + iDoorGridNo = newLoc; + break; + case TRAVELCOST_DOOR_CLOSED_N: + fDoorIsObstacleIfClosed = TRUE; + iDoorGridNo = newLoc + dirDelta[ NORTH ]; + break; + case TRAVELCOST_DOOR_CLOSED_W: + fDoorIsObstacleIfClosed = TRUE; + iDoorGridNo = newLoc + dirDelta[ WEST ]; + break; + case TRAVELCOST_DOOR_OPEN_HERE: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = newLoc; + break; + case TRAVELCOST_DOOR_OPEN_N: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = newLoc + dirDelta[ NORTH ]; + break; + case TRAVELCOST_DOOR_OPEN_NE: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = newLoc + dirDelta[ NORTHEAST ]; + break; + case TRAVELCOST_DOOR_OPEN_E: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = newLoc + dirDelta[ EAST ]; + break; + case TRAVELCOST_DOOR_OPEN_SE: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = newLoc + dirDelta[ SOUTHEAST ]; + break; + case TRAVELCOST_DOOR_OPEN_S: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = newLoc + dirDelta[ SOUTH ]; + break; + case TRAVELCOST_DOOR_OPEN_SW: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = newLoc + dirDelta[ SOUTHWEST ]; + break; + case TRAVELCOST_DOOR_OPEN_W: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = newLoc + dirDelta[ WEST ]; + break; + case TRAVELCOST_DOOR_OPEN_NW: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = newLoc + dirDelta[ NORTHWEST ]; + break; + case TRAVELCOST_DOOR_OPEN_N_N: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = newLoc + dirDelta[ NORTH ] + dirDelta[ NORTH ]; + break; + case TRAVELCOST_DOOR_OPEN_NW_N: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = newLoc + dirDelta[ NORTHWEST ] + dirDelta[ NORTH ]; + break; + case TRAVELCOST_DOOR_OPEN_NE_N: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = newLoc + dirDelta[ NORTHEAST ] + dirDelta[ NORTH ]; + break; + case TRAVELCOST_DOOR_OPEN_W_W: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = newLoc + dirDelta[ WEST ] + dirDelta[ WEST ]; + break; + case TRAVELCOST_DOOR_OPEN_SW_W: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = newLoc + dirDelta[ SOUTHWEST ] + dirDelta[ WEST ]; + break; + case TRAVELCOST_DOOR_OPEN_NW_W: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = newLoc + dirDelta[ NORTHWEST ] + dirDelta[ WEST ]; + break; + default: + break; } if ( fPathingForPlayer && gpWorldLevelData[ iDoorGridNo ].ubExtFlags[0] & MAPELEMENT_EXT_DOOR_STATUS_PRESENT ) @@ -3103,10 +3106,10 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo else { if (fDoorIsObstacleIfClosed) - { + { // door is closed and this should be an obstacle, EXCEPT if we are calculating // a path for an enemy or NPC with keys - if ( fPathingForPlayer || ( s && (s->uiStatusFlags & SOLDIER_MONSTER || s->uiStatusFlags & SOLDIER_ANIMAL) ) ) + if ( fPathingForPlayer || ( s && (s->flags.uiStatusFlags & SOLDIER_MONSTER || s->flags.uiStatusFlags & SOLDIER_ANIMAL) ) ) { nextCost = TRAVELCOST_OBSTACLE; } @@ -3116,7 +3119,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo pDoor = FindDoorInfoAtGridNo( iDoorGridNo ); if (pDoor) { - if (!pDoor->fLocked || s->bHasKeys) + if (!pDoor->fLocked || s->flags.bHasKeys) { // add to AP cost if (gubNPCAPBudget) @@ -3152,12 +3155,12 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo // Apr. '96 - moved up be ahead of AP_Budget stuff if ( ( nextCost >= NOPASS) ) // || ( nextCost == TRAVELCOST_DOOR ) ) - goto NEXTDIR; + goto NEXTDIR; } else { - nextCost = TRAVELCOST_FLAT; + nextCost = TRAVELCOST_FLAT; } if ( newLoc > GRIDSIZE ) @@ -3171,16 +3174,16 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo if (fPathAroundPeople && ( (newLoc != iDestination) || fCopyReachable) ) { // ATE: ONLY cancel if they are moving..... - ubMerc = WhoIsThere2( (UINT16) newLoc, s->bLevel); + ubMerc = WhoIsThere2( (INT16) newLoc, s->pathing.bLevel); if ( ubMerc < TOTAL_SOLDIERS && ubMerc != s->ubID ) - { + { // Check for movement.... //if ( fTurnBased || ( (Menptr[ ubMerc ].sFinalDestination == Menptr[ ubMerc ].sGridNo) || (Menptr[ ubMerc ].fDelayedMovement) ) ) //{ - goto NEXTDIR; + goto NEXTDIR; //} - // else + // else //{ // nextCost += 50; //} @@ -3204,25 +3207,25 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo } /* - // vehicles aren't moving any more.... + // vehicles aren't moving any more.... if (fVehicle) { - // transmogrify pathing costs for vehicles! - switch(nextCost) - { - case TRAVELCOST_THICK : nextCost = TRAVELCOST_GRASS; - break; - case TRAVELCOST_SHORE : - case TRAVELCOST_KNEEDEEP: - case TRAVELCOST_DEEPWATER: - // case TRAVELCOST_VEINEND : - // case TRAVELCOST_VEINMID : - //case TRAVELCOST_DOOR : - case TRAVELCOST_FENCE : nextCost = TRAVELCOST_OBSTACLE; - break; + // transmogrify pathing costs for vehicles! + switch(nextCost) + { + case TRAVELCOST_THICK : nextCost = TRAVELCOST_GRASS; + break; + case TRAVELCOST_SHORE : + case TRAVELCOST_KNEEDEEP: + case TRAVELCOST_DEEPWATER: +// case TRAVELCOST_VEINEND : +// case TRAVELCOST_VEINMID : + //case TRAVELCOST_DOOR : + case TRAVELCOST_FENCE : nextCost = TRAVELCOST_OBSTACLE; + break; - default : break; - } + default : break; + } } */ } @@ -3233,26 +3236,26 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo { switch(nextCost) { - case TRAVELCOST_NONE : ubAPCost = 0; - break; + case TRAVELCOST_NONE : ubAPCost = 0; + break; - case TRAVELCOST_DIRTROAD: - case TRAVELCOST_FLAT : ubAPCost = AP_MOVEMENT_FLAT; - break; - //case TRAVELCOST_BUMPY : - case TRAVELCOST_GRASS : ubAPCost = AP_MOVEMENT_GRASS; - break; - case TRAVELCOST_THICK : ubAPCost = AP_MOVEMENT_BUSH; - break; - case TRAVELCOST_DEBRIS : ubAPCost = AP_MOVEMENT_RUBBLE; - break; - case TRAVELCOST_SHORE : ubAPCost = AP_MOVEMENT_SHORE; // wading shallow water - break; - case TRAVELCOST_KNEEDEEP: ubAPCost = AP_MOVEMENT_LAKE; // wading waist/chest deep - very slow - break; + case TRAVELCOST_DIRTROAD: + case TRAVELCOST_FLAT : ubAPCost = AP_MOVEMENT_FLAT; + break; + //case TRAVELCOST_BUMPY : + case TRAVELCOST_GRASS : ubAPCost = AP_MOVEMENT_GRASS; + break; + case TRAVELCOST_THICK : ubAPCost = AP_MOVEMENT_BUSH; + break; + case TRAVELCOST_DEBRIS : ubAPCost = AP_MOVEMENT_RUBBLE; + break; + case TRAVELCOST_SHORE : ubAPCost = AP_MOVEMENT_SHORE; // wading shallow water + break; + case TRAVELCOST_KNEEDEEP: ubAPCost = AP_MOVEMENT_LAKE; // wading waist/chest deep - very slow + break; - case TRAVELCOST_DEEPWATER:ubAPCost = AP_MOVEMENT_OCEAN; // can swim, so it's faster than wading - break; + case TRAVELCOST_DEEPWATER:ubAPCost = AP_MOVEMENT_OCEAN; // can swim, so it's faster than wading + break; //case TRAVELCOST_VEINEND : //case TRAVELCOST_VEINMID : ubAPCost = AP_MOVEMENT_FLAT; // break; @@ -3260,54 +3263,58 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo //case TRAVELCOST_DOOR : ubAPCost = AP_MOVEMENT_FLAT; // break; - case TRAVELCOST_FENCE : ubAPCost = AP_JUMPFENCE; + case TRAVELCOST_FENCE : + if((UsingNewInventorySystem() == true) && s->inv[BPACKPOCKPOS].exists() == true) + ubAPCost = AP_JUMPFENCEBPACK; + else + ubAPCost = AP_JUMPFENCE; + +/* + if ( sSwitchValue == TRAVELCOST_FENCE ) + { + sPoints += sTileCost; - /* - if ( sSwitchValue == TRAVELCOST_FENCE ) - { - sPoints += sTileCost; - - // If we are changeing stance ( either before or after getting there.... - // We need to reflect that... - switch(usMovementMode) - { - case RUNNING: + // If we are changeing stance ( either before or after getting there.... + // We need to reflect that... + switch(usMovementMode) + { + case RUNNING: case WALKING : - // Add here cost to go from crouch to stand AFTER fence hop.... - // Since it's AFTER.. make sure we will be moving after jump... - if ( ( iCnt + 2 ) < iLastGrid ) - { - sPoints += AP_CROUCH; - } - break; + // Add here cost to go from crouch to stand AFTER fence hop.... + // Since it's AFTER.. make sure we will be moving after jump... + if ( ( iCnt + 2 ) < iLastGrid ) + { + sPoints += AP_CROUCH; + } + break; - case SWATTING: + case SWATTING: - // Add cost to stand once there BEFORE.... - sPoints += AP_CROUCH; - break; + // Add cost to stand once there BEFORE.... + sPoints += AP_CROUCH; + break; - case CRAWLING: + case CRAWLING: - // Can't do it here..... - break; + // Can't do it here..... + break; - } - } + } + } - */ +*/ - break; + break; - case TRAVELCOST_OBSTACLE: - default : goto NEXTDIR; // Cost too much to be considered! - break; + case TRAVELCOST_OBSTACLE: + default : goto NEXTDIR; // Cost too much to be considered! + break; } - // don't make the mistake of adding directly to - // ubCurAPCost, that must be preserved for remaining dirs! + // don't make the mistake of adding directly to + // ubCurAPCost, that must be preserved for remaining dirs! if (iCnt & 1) { //ubAPCost++; @@ -3315,69 +3322,82 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo ubAPCost = (ubAPCost * 14) / 10; } - usMovementModeToUseForAPs = usMovementMode; + usMovementModeToUseForAPs = usMovementMode; - // ATE: if water, force to be walking always! - if ( nextCost == TRAVELCOST_SHORE || nextCost == TRAVELCOST_KNEEDEEP || nextCost == TRAVELCOST_DEEPWATER ) - { - usMovementModeToUseForAPs = WALKING; - } + // ATE: if water, force to be walking always! + if ( nextCost == TRAVELCOST_SHORE || nextCost == TRAVELCOST_KNEEDEEP || nextCost == TRAVELCOST_DEEPWATER ) + { + usMovementModeToUseForAPs = WALKING; + } // adjust AP cost for movement mode + // CHRISL: Adjusted system to use different move costs while wearing a backpack switch( usMovementModeToUseForAPs ) { - case RUNNING: - case ADULTMONSTER_WALKING: - // save on casting - ubAPCost = (UINT8)(ubAPCost * 10 / ( (UINT8) (RUNDIVISOR * 10))); - //ubAPCost = (INT16)(DOUBLE)( (sTileCost / RUNDIVISOR) ); break; - break; - case WALKING: - case ROBOT_WALK: - ubAPCost = (ubAPCost + WALKCOST); - break; - case SWATTING: - ubAPCost = (ubAPCost + SWATCOST); - break; - case CRAWLING: - ubAPCost = (ubAPCost + CRAWLCOST); - break; + case RUNNING: + case ADULTMONSTER_WALKING: + // save on casting + if((UsingNewInventorySystem() == true) && s->inv[BPACKPOCKPOS].exists() == true) + ubAPCost = ubAPCost * 10 / ( (UINT8) (RUNDIVISORBPACK * 10)); + else + ubAPCost = (UINT8)(ubAPCost * 10 / ( (UINT8) (RUNDIVISOR * 10))); + //ubAPCost = (INT16)(DOUBLE)( (sTileCost / RUNDIVISOR) ); break; + break; + case WALKING: + case ROBOT_WALK: + if((UsingNewInventorySystem() == true) && s->inv[BPACKPOCKPOS].exists() == true) + ubAPCost = (ubAPCost + WALKCOSTBPACK); + else + ubAPCost = (ubAPCost + WALKCOST); + break; + case SWATTING: + if((UsingNewInventorySystem() == true) && s->inv[BPACKPOCKPOS].exists() == true) + ubAPCost = (ubAPCost + SWATCOSTBPACK); + else + ubAPCost = (ubAPCost + SWATCOST); + break; + case CRAWLING: + if((UsingNewInventorySystem() == true) && s->inv[BPACKPOCKPOS].exists() == true) + ubAPCost = (ubAPCost + CRAWLCOSTBPACK); + else + ubAPCost = (ubAPCost + CRAWLCOST); + break; } if (nextCost == TRAVELCOST_FENCE) { switch( usMovementModeToUseForAPs ) { - case RUNNING: - case WALKING : - // Here pessimistically assume the path will continue after hopping the fence - ubAPCost += AP_CROUCH; - break; + case RUNNING: + case WALKING : + // Here pessimistically assume the path will continue after hopping the fence + ubAPCost += AP_CROUCH; + break; - case SWATTING: + case SWATTING: - // Add cost to stand once there BEFORE jumping.... - ubAPCost += AP_CROUCH; - break; + // Add cost to stand once there BEFORE jumping.... + ubAPCost += AP_CROUCH; + break; - case CRAWLING: + case CRAWLING: - // Can't do it here..... - goto NEXTDIR; + // Can't do it here..... + goto NEXTDIR; } } else if (nextCost == TRAVELCOST_NOT_STANDING) { switch(usMovementModeToUseForAPs) { - case RUNNING: - case WALKING : - // charge crouch APs for ducking head! - ubAPCost += AP_CROUCH; - break; + case RUNNING: + case WALKING : + // charge crouch APs for ducking head! + ubAPCost += AP_CROUCH; + break; - default: - break; + default: + break; } } else if (fGoingThroughDoor) @@ -3387,42 +3407,42 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo } - ubNewAPCost = ubCurAPCost + ubAPCost; + ubNewAPCost = ubCurAPCost + ubAPCost; - if (ubNewAPCost > gubNPCAPBudget) - goto NEXTDIR; + if (ubNewAPCost > gubNPCAPBudget) + goto NEXTDIR; } //ATE: Uncommented out for doors, if we are at a door but not dest, continue! - // if ( nextCost == TRAVELCOST_DOOR ) //&& newLoc != iDestination) - // goto NEXTDIR; - /* + // if ( nextCost == TRAVELCOST_DOOR ) //&& newLoc != iDestination) + // goto NEXTDIR; +/* // FOLLOWING SECTION COMMENTED OUT ON MARCH 7/97 BY IC if (nextCost == SECRETCOST && !s->human) - goto NEXTDIR; + goto NEXTDIR; if (prevCost==VEINMIDCOST) - if (!ISVEIN(nextCost)) - goto NEXTDIR; + if (!ISVEIN(nextCost)) + goto NEXTDIR; //veining check if (nextCost==VEINMIDCOST) - if (!ISVEIN(prevCost)) - goto NEXTDIR; + if (!ISVEIN(prevCost)) + goto NEXTDIR; if (nextCost==VEINMIDCOST) //if (ISVEIN(nextCost)) - nextCost=VEINCOST; + nextCost=VEINCOST; else if (nextCost==VEINENDCOST) - if (Grid[newLoc].land < LAKE1) - nextCost = VEINCOST; - else - nextCost = OCEANCOST+(10*PATHFACTOR); + if (Grid[newLoc].land < LAKE1) + nextCost = VEINCOST; + else + nextCost = OCEANCOST+(10*PATHFACTOR); - */ + */ if ( fCloseGoodEnough ) { @@ -3436,11 +3456,11 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo } //make the destination look very attractive if (newLoc == iDestination) - nextCost = 0; + nextCost = 0; else //if (_KeyDown(CTRL_DOWN) && nextCost < TRAVELCOST_VEINEND) if (gfPlotDirectPath && nextCost < NOPASS) - nextCost = TRAVELCOST_FLAT; + nextCost = TRAVELCOST_FLAT; @@ -3457,7 +3477,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo nextCost = EASYWATERCOST; } - // NOTE: on September 24, 1997, Chris went back to a diagonal bias system +// NOTE: on September 24, 1997, Chris went back to a diagonal bias system if (iCnt & 1) { // moving on a diagonal @@ -3474,52 +3494,52 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo newTotCost = curCost + nextCost; - /* - // no diagonal bias - straightforward costing regardless of direction +/* +// no diagonal bias - straightforward costing regardless of direction newTotCost = curCost + nextCost; - // NOTE: ON JAN 6TH, 1995, IAN COMMENTED OUT THE DIAGONAL BIAS AND - // UNCOMMENTED THE "NO DIAGONAL BIAS" - //diagonal bias - this makes diagonal moves cost more +// NOTE: ON JAN 6TH, 1995, IAN COMMENTED OUT THE DIAGONAL BIAS AND +// UNCOMMENTED THE "NO DIAGONAL BIAS" +//diagonal bias - this makes diagonal moves cost more - if (iCnt & 1) + if (iCnt & 1) // diagonal move costs 70 percent - //newTotCost += (nextCost/PATHFACTOR); - newTotCost += 1; - // newTotCost = curCost + ((prevCost+nextCost)*7)/10; - // else // non-diagonal costs only 50% - // newTotCost = curCost + (prevCost+nextCost)/2; - */ + //newTotCost += (nextCost/PATHFACTOR); + newTotCost += 1; +// newTotCost = curCost + ((prevCost+nextCost)*7)/10; +// else // non-diagonal costs only 50% +// newTotCost = curCost + (prevCost+nextCost)/2; +*/ // have we found a path to the current location that // costs less than the best so far to the same location? if (trailCostUsed[newLoc] != gubGlobalPathCount || newTotCost < trailCost[newLoc]) { -#if defined( PATHAI_VISIBLE_DEBUG ) + #if defined( PATHAI_VISIBLE_DEBUG ) - if (gfDisplayCoverValues && gfDrawPathPoints) - { - if (gsCoverValue[newLoc] == 0x7F7F) + if (gfDisplayCoverValues && gfDrawPathPoints) { - gsCoverValue[newLoc] = usCounter++; + if (gsCoverValue[newLoc] == 0x7F7F) + { + gsCoverValue[newLoc] = usCounter++; + } + /* + else if (gsCoverValue[newLoc] >= 0) + { + gsCoverValue[newLoc]++; + } + else + { + gsCoverValue[newLoc]--; + } + */ } - /* - else if (gsCoverValue[newLoc] >= 0) - { - gsCoverValue[newLoc]++; - } - else - { - gsCoverValue[newLoc]--; - } - */ - } -#endif + #endif - //NEWQUENODE; + //NEWQUENODE; { if (queRequests= iMaxTrailTree) { -#ifdef COUNT_PATHS - guiFailedPathChecks++; -#endif + #ifdef COUNT_PATHS + guiFailedPathChecks++; + #endif gubNPCAPBudget = 0; gubNPCDistLimit = 0; return(0); @@ -3597,8 +3617,8 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo if (gubNPCAPBudget) { - //save the AP cost so far along this path - pNewPtr->ubTotalAPCost = ubNewAPCost; + //save the AP cost so far along this path + pNewPtr->ubTotalAPCost = ubNewAPCost; // update the AP costs in the AI array of path costs if necessary... if (fCopyPathCosts) { @@ -3667,71 +3687,71 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo } #ifdef PATHAI_SKIPLIST_DEBUG - // print out contents of queue - { - INT32 iLoop; - INT8 bTemp; - - zTempString[0] = '\0'; - pCurr = pQueueHead; - iLoop = 0; - while( pCurr ) + // print out contents of queue { - sprintf( zTS, "\t%ld", pCurr->sPathNdx ); - if (pCurr == pNewPtr) + INT32 iLoop; + INT8 bTemp; + + zTempString[0] = '\0'; + pCurr = pQueueHead; + iLoop = 0; + while( pCurr ) { - strcat( zTS, "*" ); + sprintf( zTS, "\t%ld", pCurr->sPathNdx ); + if (pCurr == pNewPtr) + { + strcat( zTS, "*" ); + } + strcat( zTempString, zTS ); + pCurr = pCurr->pNext[0]; + iLoop++; + if (iLoop > 50) + { + break; + } } - strcat( zTempString, zTS ); - pCurr = pCurr->pNext[0]; - iLoop++; - if (iLoop > 50) - { - break; - } - } - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, zTempString ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, zTempString ); - zTempString[0] = '\0'; - pCurr = pQueueHead; - iLoop = 0; - while( pCurr ) - { - sprintf( zTS, "\t%d", pCurr->bLevel ); - strcat( zTempString, zTS ); - pCurr = pCurr->pNext[0]; - iLoop++; - if (iLoop > 50) + zTempString[0] = '\0'; + pCurr = pQueueHead; + iLoop = 0; + while( pCurr ) { - break; + sprintf( zTS, "\t%d", pCurr->pathing.bLevel ); + strcat( zTempString, zTS ); + pCurr = pCurr->pNext[0]; + iLoop++; + if (iLoop > 50) + { + break; + } } - } - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, zTempString ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, zTempString ); - zTempString[0] = '\0'; - bTemp = pQueueHead->bLevel; - pCurr = pQueueHead; - iLoop = 0; - while( pCurr ) - { - bTemp = pQueueHead->bLevel; - while ( pCurr->pNext[ bTemp - 1 ] == NULL ) + zTempString[0] = '\0'; + bTemp = pQueueHead->pathing.bLevel; + pCurr = pQueueHead; + iLoop = 0; + while( pCurr ) { - bTemp--; - } - sprintf( zTS, "\t%d", bTemp ); - strcat( zTempString, zTS ); - pCurr = pCurr->pNext[0]; - iLoop++; - if (iLoop > 50) - { - break; + bTemp = pQueueHead->pathing.bLevel; + while ( pCurr->pNext[ bTemp - 1 ] == NULL ) + { + bTemp--; + } + sprintf( zTS, "\t%d", bTemp ); + strcat( zTempString, zTS ); + pCurr = pCurr->pNext[0]; + iLoop++; + if (iLoop > 50) + { + break; + } } + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, zTempString ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "------" ); } - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, zTempString ); - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "------" ); - } #endif } @@ -3759,20 +3779,20 @@ ENDOFLOOP: while (pathQNotEmpty && pathNotYetFound); -#if defined( PATHAI_VISIBLE_DEBUG ) - if (gfDisplayCoverValues && gfDrawPathPoints) - { - SetRenderFlags( RENDER_FLAG_FULL ); - if ( guiCurrentScreen == GAME_SCREEN ) + #if defined( PATHAI_VISIBLE_DEBUG ) + if (gfDisplayCoverValues && gfDrawPathPoints) { - RenderWorld(); - RenderCoverDebug( ); - InvalidateScreen( ); - EndFrameBufferRender(); - RefreshScreen( NULL ); + SetRenderFlags( RENDER_FLAG_FULL ); + if ( guiCurrentScreen == GAME_SCREEN ) + { + RenderWorld(); + RenderCoverDebug( ); + InvalidateScreen( ); + EndFrameBufferRender(); + RefreshScreen( NULL ); + } } - } -#endif + #endif // work finished. Did we find a path? @@ -3796,57 +3816,57 @@ ENDOFLOOP: // data and copy into soldier's database if (bCopy == COPYROUTE) { - z=_z; + z=_z; for (iCnt=0; z && (iCnt < MAX_PATH_LIST_SIZE); iCnt++) - { - s->usPathingData[iCnt] = (INT16) trailTree[z].stepDir; + { + s->pathing.usPathingData[iCnt] = (INT16) trailTree[z].stepDir; - z = trailTree[z].nextLink; - } + z = trailTree[z].nextLink; + } - s->usPathIndex = 0; - s->usPathDataSize = (UINT16) iCnt; + s->pathing.usPathIndex = 0; + s->pathing.usPathDataSize = (UINT16) iCnt; } else if (bCopy == NO_COPYROUTE) { - z=_z; + z=_z; for (iCnt=0; z != 0; iCnt++) - { - guiPathingData[ iCnt ] = trailTree[z].stepDir; - - z = trailTree[z].nextLink; - } - - giPathDataSize = (UINT16) iCnt; - - } - -#if defined( PATHAI_VISIBLE_DEBUG ) - if (gfDisplayCoverValues && gfDrawPathPoints) { - SetRenderFlags( RENDER_FLAG_FULL ); - RenderWorld(); - RenderCoverDebug( ); - InvalidateScreen( ); - EndFrameBufferRender(); - RefreshScreen( NULL ); + guiPathingData[ iCnt ] = trailTree[z].stepDir; + + z = trailTree[z].nextLink; } -#endif + + giPathDataSize = (UINT16) iCnt; + + } + + #if defined( PATHAI_VISIBLE_DEBUG ) + if (gfDisplayCoverValues && gfDrawPathPoints) + { + SetRenderFlags( RENDER_FLAG_FULL ); + RenderWorld(); + RenderCoverDebug( ); + InvalidateScreen( ); + EndFrameBufferRender(); + RefreshScreen( NULL ); + } + #endif // return path length : serves as a "successful" flag and a path length counter -#ifdef COUNT_PATHS - guiSuccessfulPathChecks++; -#endif + #ifdef COUNT_PATHS + guiSuccessfulPathChecks++; + #endif gubNPCAPBudget = 0; gubNPCDistLimit = 0; - //TEMP: This is returning zero when I am generating edgepoints, so I am force returning 1 until - // this is fixed? + //TEMP: This is returning zero when I am generating edgepoints, so I am force returning 1 until + // this is fixed? if( gfGeneratingMapEdgepoints ) { return TRUE; @@ -3857,17 +3877,17 @@ ENDOFLOOP: return(iCnt); } -#ifdef COUNT_PATHS - if (fCopyReachable) - { - // actually this is a success - guiSuccessfulPathChecks++; - } - else - { - guiUnsuccessfulPathChecks++; - } -#endif + #ifdef COUNT_PATHS + if (fCopyReachable) + { + // actually this is a success + guiSuccessfulPathChecks++; + } + else + { + guiUnsuccessfulPathChecks++; + } + #endif // failed miserably, report... gubNPCAPBudget = 0; @@ -3890,7 +3910,7 @@ void GlobalReachableTest( INT16 sStartGridNo ) //memset( &s, 0, SIZEOF_SOLDIERTYPE ); s.initialize(); s.sGridNo = sStartGridNo; - s.bLevel = 0; + s.pathing.bLevel = 0; s.bTeam = 1; //reset the flag for gridno's @@ -3918,11 +3938,11 @@ void LocalReachableTest( INT16 sStartGridNo, INT8 bRadius ) //if we are moving on the gorund level if( gsInterfaceLevel == I_ROOF_LEVEL ) { - s.bLevel = 1; + s.pathing.bLevel = 1; } else { - s.bLevel = 0; + s.pathing.bLevel = 0; } s.bTeam = OUR_TEAM; @@ -3943,7 +3963,7 @@ void LocalReachableTest( INT16 sStartGridNo, INT8 bRadius ) // set the dist limit gubNPCDistLimit = bRadius; // make the function call - FindBestPath( &s, NOWHERE, s.bLevel, WALKING, COPYREACHABLE, PATH_THROUGH_PEOPLE ); + FindBestPath( &s, NOWHERE, s.pathing.bLevel, WALKING, COPYREACHABLE, PATH_THROUGH_PEOPLE ); // reset dist limit gubNPCDistLimit = 0; } @@ -3957,7 +3977,7 @@ void GlobalItemsReachableTest( INT16 sStartGridNo1, INT16 sStartGridNo2 ) //memset( &s, 0, SIZEOF_SOLDIERTYPE ); s.initialize(); s.sGridNo = sStartGridNo1; - s.bLevel = 0; + s.pathing.bLevel = 0; s.bTeam = 1; //reset the flag for gridno's @@ -3985,7 +4005,7 @@ void RoofReachableTest( INT16 sStartGridNo, UINT8 ubBuildingID ) //memset( &s, 0, SIZEOF_SOLDIERTYPE ); s.initialize(); s.sGridNo = sStartGridNo; - s.bLevel = 1; + s.pathing.bLevel = 1; s.bTeam = 1; // clearing flags @@ -4011,14 +4031,14 @@ void ErasePath(char bEraseOldOne) { INT16 iCnt; - // NOTE: This routine must be called BEFORE anything happens that changes - // a merc's gridno, else the.... + // NOTE: This routine must be called BEFORE anything happens that changes + // a merc's gridno, else the.... - //EraseAPCursor(); + //EraseAPCursor(); if ( gfUIHandleShowMoveGrid ) { - gfUIHandleShowMoveGrid = FALSE; + gfUIHandleShowMoveGrid = FALSE; RemoveTopmost( gsUIHandleShowMoveGridLocation, FIRSTPOINTERS4 ); RemoveTopmost( gsUIHandleShowMoveGridLocation, FIRSTPOINTERS9 ); @@ -4031,15 +4051,15 @@ void ErasePath(char bEraseOldOne) if (!gusPathShown) { - //OldPath = FALSE; - return; + //OldPath = FALSE; + return; } - //if (OldPath > 0 && !eraseOldOne) - // return; + //if (OldPath > 0 && !eraseOldOne) + // return; - //OldPath = FALSE; + //OldPath = FALSE; @@ -4057,12 +4077,12 @@ void ErasePath(char bEraseOldOne) //RemoveAllObjectsOfTypeRange( guiPlottedPath[iCnt], FIRSTPOINTERS, FIRSTPOINTERS ); } - //for (cnt=0; cnt < GRIDSIZE; cnt++) - // Grid[cnt].fstep = 0; - //RemoveAllStructsOfTypeRange( gusEndPlotGridNo, GOODRING, GOODRING ); + //for (cnt=0; cnt < GRIDSIZE; cnt++) + // Grid[cnt].fstep = 0; + //RemoveAllStructsOfTypeRange( gusEndPlotGridNo, GOODRING, GOODRING ); - giPlotCnt = 0; - memset(guiPlottedPath,0,256*sizeof(UINT32)); + giPlotCnt = 0; + memset(guiPlottedPath,0,256*sizeof(UINT32)); } @@ -4086,16 +4106,16 @@ INT16 PlotPath( SOLDIERTYPE *pSold, INT16 sDestGridno, INT8 bCopyRoute, INT8 bPl UINT16 usTileNum; LEVELNODE *pNode; UINT16 usMovementModeToUseForAPs; - BOOLEAN bIgnoreNextCost = FALSE; - INT16 sTestGridno; + BOOLEAN bIgnoreNextCost = FALSE; + INT16 sTestGridno; if ( bPlot && gusPathShown ) { ErasePath(FALSE); } - gusAPtsToMove = 0; - sTempGrid = (INT16) pSold->sGridNo; + gusAPtsToMove = 0; + sTempGrid = (INT16) pSold->sGridNo; sFootOrderIndex = 0; @@ -4104,23 +4124,23 @@ INT16 PlotPath( SOLDIERTYPE *pSold, INT16 sDestGridno, INT8 bCopyRoute, INT8 bPl // distance limit to reduce the cost of plotting a path to a location we can't reach // For now, use known hight adjustment - if ( gfRecalculatingExistingPathCost || FindBestPath( pSold, sDestGridno, pSold->bLevel, usMovementMode, bCopyRoute, 0 ) ) + if ( gfRecalculatingExistingPathCost || FindBestPath( pSold, sDestGridno, pSold->pathing.bLevel, usMovementMode, bCopyRoute, 0 ) ) { - // if soldier would be STARTING to run then he pays a penalty since it takes time to + // if soldier would be STARTING to run then he pays a penalty since it takes time to // run full speed if (pSold->usAnimState != RUNNING) - { + { // for estimation purposes, always pay penalty sPointsRun = AP_START_RUN_COST; } - // Add to points, those needed to start from different stance! + // Add to points, those needed to start from different stance! sPoints = sPoints + MinAPsToStartMovement( pSold, usMovementMode ); - // We should reduce points for starting to run if first tile is a fence... + // We should reduce points for starting to run if first tile is a fence... sTestGridno = NewGridNo(pSold->sGridNo, DirectionInc( (UINT8)guiPathingData[0])); - if ( gubWorldMovementCosts[ sTestGridno ][ guiPathingData[0] ][ pSold->bLevel] == TRAVELCOST_FENCE ) + if ( gubWorldMovementCosts[ sTestGridno ][ guiPathingData[0] ][ pSold->pathing.bLevel] == TRAVELCOST_FENCE ) { if ( usMovementMode == RUNNING && pSold->usAnimState != RUNNING ) { @@ -4129,24 +4149,24 @@ INT16 PlotPath( SOLDIERTYPE *pSold, INT16 sDestGridno, INT8 bCopyRoute, INT8 bPl } // FIRST, add up "startup" additional costs - such as intermediate animations, etc. - /* removing warning C4060 (jonathanl) +/* removing warning C4060 (jonathanl) switch(pSold->usAnimState) { - //case START_AID : - //case GIVING_AID : sAnimCost = AP_STOP_FIRST_AID; - // break; - //case TWISTOMACH : - //case COLLAPSED : sAnimCost = AP_GET_UP; - // break; - //case TWISTBACK : - //case UNCONSCIOUS : sAnimCost = (AP_ROLL_OVER+AP_GET_UP); - // break; + //case START_AID : + //case GIVING_AID : sAnimCost = AP_STOP_FIRST_AID; + // break; + //case TWISTOMACH : + //case COLLAPSED : sAnimCost = AP_GET_UP; + // break; + //case TWISTBACK : + //case UNCONSCIOUS : sAnimCost = (AP_ROLL_OVER+AP_GET_UP); + // break; - // case CROUCHING : if (usMovementMode == WALKING || usMovementMode == RUNNING) - // sAnimCost = AP_CROUCH; - // break; - } - */ + // case CROUCHING : if (usMovementMode == WALKING || usMovementMode == RUNNING) + // sAnimCost = AP_CROUCH; + // break; + } +*/ sPoints = sPoints + sAnimCost; gusAPtsToMove = gusAPtsToMove + sAnimCost; @@ -4155,7 +4175,7 @@ INT16 PlotPath( SOLDIERTYPE *pSold, INT16 sDestGridno, INT8 bCopyRoute, INT8 bPl - if (bStayOn) + if (bStayOn) { iLastGrid = giPathDataSize+1; } @@ -4166,22 +4186,22 @@ INT16 PlotPath( SOLDIERTYPE *pSold, INT16 sDestGridno, INT8 bCopyRoute, INT8 bPl for ( iCnt=0; iCnt < iLastGrid; iCnt++ ) - { + { sExtraCostStand = 0; sExtraCostSwat = 0; sExtraCostCrawl = 0; // what is the next gridno in the path? - sOldGrid = sTempGrid; + sOldGrid = sTempGrid; sTempGrid = NewGridNo(sTempGrid, DirectionInc( (UINT8)guiPathingData[iCnt])); // Get switch value... - sSwitchValue = gubWorldMovementCosts[ sTempGrid ][ (INT8)guiPathingData[iCnt] ][ pSold->bLevel]; + sSwitchValue = gubWorldMovementCosts[ sTempGrid ][ (INT8)guiPathingData[iCnt] ][ pSold->pathing.bLevel]; // get the tile cost for that tile based on WALKING - sTileCost = TerrainActionPoints( pSold, sTempGrid, (INT8)guiPathingData[iCnt], pSold->bLevel ); + sTileCost = TerrainActionPoints( pSold, sTempGrid, (INT8)guiPathingData[iCnt], pSold->pathing.bLevel ); - usMovementModeToUseForAPs = usMovementMode; + usMovementModeToUseForAPs = usMovementMode; // ATE - MAKE MOVEMENT ALWAYS WALK IF IN WATER if ( TERRAIN_IS_WATER( gpWorldLevelData[ sTempGrid ].ubTerrainID) ) @@ -4189,24 +4209,24 @@ INT16 PlotPath( SOLDIERTYPE *pSold, INT16 sDestGridno, INT8 bCopyRoute, INT8 bPl usMovementModeToUseForAPs = WALKING; } - if ( bIgnoreNextCost ) + if ( bIgnoreNextCost ) + { + bIgnoreNextCost = FALSE; + } + else + { + // ATE: If we have a 'special cost, like jump fence... + if ( sSwitchValue == TRAVELCOST_FENCE ) { - bIgnoreNextCost = FALSE; - } - else - { - // ATE: If we have a 'special cost, like jump fence... - if ( sSwitchValue == TRAVELCOST_FENCE ) + sPoints = sPoints + sTileCost; + + bIgnoreNextCost = TRUE; + + // If we are changeing stance ( either before or after getting there.... + // We need to reflect that... + switch( usMovementModeToUseForAPs ) { - sPoints = sPoints + sTileCost; - - bIgnoreNextCost = TRUE; - - // If we are changeing stance ( either before or after getting there.... - // We need to reflect that... - switch( usMovementModeToUseForAPs ) - { - case RUNNING: + case RUNNING: case WALKING : // Add here cost to go from crouch to stand AFTER fence hop.... @@ -4215,60 +4235,86 @@ INT16 PlotPath( SOLDIERTYPE *pSold, INT16 sDestGridno, INT8 bCopyRoute, INT8 bPl { sExtraCostStand += AP_CROUCH; - // ATE: if running, charge extra point to srart again - if ( usMovementModeToUseForAPs== RUNNING ) - { - sExtraCostStand++; - } + // ATE: if running, charge extra point to srart again + if ( usMovementModeToUseForAPs== RUNNING ) + { + sExtraCostStand++; + } - sPoints = sPoints + sExtraCostStand; + sPoints = sPoints + sExtraCostStand; } break; - case SWATTING: + case SWATTING: // Add cost to stand once there BEFORE.... sExtraCostSwat += AP_CROUCH; sPoints = sPoints + sExtraCostSwat; break; - case CRAWLING: + case CRAWLING: // Can't do it here..... break; - } } - else if (sTileCost > 0) - { - // else, movement is adjusted based on mode... + } + else if (sTileCost > 0) + { + // else, movement is adjusted based on mode... - if (sSwitchValue == TRAVELCOST_NOT_STANDING) + if (sSwitchValue == TRAVELCOST_NOT_STANDING) + { + switch( usMovementModeToUseForAPs ) { - switch( usMovementModeToUseForAPs ) - { - case RUNNING: + case RUNNING: case WALKING : // charge crouch APs for ducking head! sExtraCostStand += AP_CROUCH; break; - default: + default: break; - } } + } - // so, then we must modify it for other movement styles and accumulate - switch( usMovementModeToUseForAPs ) - { - case RUNNING: sPoints += (INT16)(DOUBLE)( (sTileCost / RUNDIVISOR) ) + sExtraCostStand; break; - case WALKING : sPoints += (sTileCost + WALKCOST) + sExtraCostStand; break; - case SWATTING: sPoints += (sTileCost + SWATCOST) + sExtraCostSwat; break; - case CRAWLING: sPoints += (sTileCost + CRAWLCOST) + sExtraCostCrawl; break; - default : sPoints = sPoints + sTileCost; break; - } - } - } + // so, then we must modify it for other movement styles and accumulate + // CHRISL: Force display path to calculate AP cost differently if we're wearing a backpack + switch( usMovementModeToUseForAPs ) + { + case RUNNING: + if((UsingNewInventorySystem() == true) && pSold->inv[BPACKPOCKPOS].exists() == true) + sPoints += (INT16)(DOUBLE)( (sTileCost / RUNDIVISORBPACK) ) + sExtraCostStand; + else + sPoints += (INT16)(DOUBLE)( (sTileCost / RUNDIVISOR) ) + sExtraCostStand; + break; + case WALKING : + if((UsingNewInventorySystem() == true) && pSold->inv[BPACKPOCKPOS].exists() == true) + sPoints += (sTileCost + WALKCOSTBPACK) + sExtraCostStand; + else + sPoints += (sTileCost + WALKCOST) + sExtraCostStand; + break; + case SWATTING: + if((UsingNewInventorySystem() == true) && pSold->inv[BPACKPOCKPOS].exists() == true) + sPoints += (sTileCost + SWATCOSTBPACK) + sExtraCostSwat; + else + sPoints += (sTileCost + SWATCOST) + sExtraCostSwat; + break; + case CRAWLING: + if((UsingNewInventorySystem() == true) && pSold->inv[BPACKPOCKPOS].exists() == true) + sPoints += (sTileCost + CRAWLCOSTBPACK) + sExtraCostCrawl; + else + sPoints += (sTileCost + CRAWLCOST) + sExtraCostCrawl; + break; + default : + if((UsingNewInventorySystem() == true) && pSold->inv[BPACKPOCKPOS].exists() == true) + sPoints = sPoints + sTileCost; + else + sPoints = sPoints + sTileCost; + break; + } + } + } // THIS NEXT SECTION ONLY NEEDS TO HAPPEN FOR CURSOR UI FEEDBACK, NOT ACTUAL COSTING @@ -4276,17 +4322,30 @@ INT16 PlotPath( SOLDIERTYPE *pSold, INT16 sDestGridno, INT8 bCopyRoute, INT8 bPl { // ATE; TODO: Put stuff in here to allow for fact of costs other than movement ( jump fence, open door ) + // CHRISL: Adjusted system to use different move costs while wearing a backpack // store WALK cost - sPointsWalk += (sTileCost + WALKCOST) + sExtraCostStand; - + if((UsingNewInventorySystem() == true) && pSold->inv[BPACKPOCKPOS].exists() == true) + sPointsWalk += (sTileCost + WALKCOSTBPACK) + sExtraCostStand; + else + sPointsWalk += (sTileCost + WALKCOST) + sExtraCostStand; + // now get cost as if CRAWLING - sPointsCrawl += (sTileCost + CRAWLCOST) + sExtraCostCrawl; + if((UsingNewInventorySystem() == true) && pSold->inv[BPACKPOCKPOS].exists() == true) + sPointsCrawl += (sTileCost + CRAWLCOSTBPACK) + sExtraCostCrawl; + else + sPointsCrawl += (sTileCost + CRAWLCOST) + sExtraCostCrawl; // now get cost as if SWATTING - sPointsSwat += (sTileCost + SWATCOST) + sExtraCostSwat; + if((UsingNewInventorySystem() == true) && pSold->inv[BPACKPOCKPOS].exists() == true) + sPointsSwat += (sTileCost + SWATCOSTBPACK) + sExtraCostSwat; + else + sPointsSwat += (sTileCost + SWATCOST) + sExtraCostSwat; // now get cost as if RUNNING - sPointsRun += (INT16)(DOUBLE)( (sTileCost / RUNDIVISOR) ) + sExtraCostStand; + if((UsingNewInventorySystem() == true) && pSold->inv[BPACKPOCKPOS].exists() == true) + sPointsRun += (INT16)(DOUBLE)( (sTileCost / RUNDIVISORBPACK) ) + sExtraCostStand; + else + sPointsRun += (INT16)(DOUBLE)( (sTileCost / RUNDIVISOR) ) + sExtraCostStand; } if ( iCnt == 0 && bPlot ) @@ -4314,8 +4373,8 @@ INT16 PlotPath( SOLDIERTYPE *pSold, INT16 sDestGridno, INT8 bCopyRoute, INT8 bPl } // Are we a vehicle? - if ( pSold->uiStatusFlags & SOLDIER_VEHICLE ) - { + if ( pSold->flags.uiStatusFlags & SOLDIER_VEHICLE ) + { // did we exceed WALK cost? if ( sPointsSwat > sAPBudget) { @@ -4371,17 +4430,17 @@ INT16 PlotPath( SOLDIERTYPE *pSold, INT16 sDestGridno, INT8 bCopyRoute, INT8 bPl /* if ( sPoints <= sAPBudget) { - // find out which color we're using + // find out which color we're using usTileIndex += sFootOrder[sFootOrderIndex]; } else { - // use red footprints ( offset by 16 ) + // use red footprints ( offset by 16 ) usTileIndex += REDSTEPSTART; } */ - if ( pSold->bLevel == 0 ) + if ( pSold->pathing.bLevel == 0 ) { pNode = AddObjectToTail(sTempGrid, usTileIndex ); pNode->ubShadeLevel=DEFAULT_SHADE_LEVEL; @@ -4402,7 +4461,7 @@ INT16 PlotPath( SOLDIERTYPE *pSold, INT16 sDestGridno, INT8 bCopyRoute, INT8 bPl usTileNum = (UINT16) guiPathingData[iCnt + 1] + 2; if (usTileNum > 8) { - usTileNum = 1; + usTileNum = 1; } @@ -4425,7 +4484,7 @@ INT16 PlotPath( SOLDIERTYPE *pSold, INT16 sDestGridno, INT8 bCopyRoute, INT8 bPl - if ( pSold->bLevel == 0 ) + if ( pSold->pathing.bLevel == 0 ) { pNode = AddObjectToTail(sTempGrid, usTileIndex ); pNode->ubShadeLevel=DEFAULT_SHADE_LEVEL; @@ -4447,20 +4506,20 @@ INT16 PlotPath( SOLDIERTYPE *pSold, INT16 sDestGridno, INT8 bCopyRoute, INT8 bPl gusPathShown = TRUE; } - } // end of found a path + } // end of found a path - // reset distance limit - gubNPCDistLimit = 0; + // reset distance limit + gubNPCDistLimit = 0; - return(sPoints); + return(sPoints); } INT16 UIPlotPath( SOLDIERTYPE *pSold, INT16 sDestGridno, INT8 bCopyRoute, INT8 bPlot, INT8 bStayOn, UINT16 usMovementMode, INT8 bStealth, INT8 bReverse , INT16 sAPBudget) { - // This function is specifically for UI calls to the pathing routine, to + // This function is specifically for UI calls to the pathing routine, to // check whether the shift key is pressed, etc. - INT16 sRet; + INT16 sRet; if ( _KeyDown( SHIFT ) ) { @@ -4468,8 +4527,8 @@ INT16 UIPlotPath( SOLDIERTYPE *pSold, INT16 sDestGridno, INT8 bCopyRoute, INT8 b } // If we are on the same level as the interface level, continue, else return - if ( pSold->bLevel != gsInterfaceLevel ) - { + if ( pSold->pathing.bLevel != gsInterfaceLevel ) + { return( 0 ); } @@ -4486,15 +4545,15 @@ INT16 UIPlotPath( SOLDIERTYPE *pSold, INT16 sDestGridno, INT8 bCopyRoute, INT8 b INT16 RecalculatePathCost( SOLDIERTYPE *pSoldier, UINT16 usMovementMode ) { // AI function for a soldier already with a path; this will return the cost of that path using the given movement mode - INT16 sRet; + INT16 sRet; - if ( !pSoldier->bPathStored || pSoldier->usPathDataSize == 0 ) + if ( !pSoldier->pathing.bPathStored || pSoldier->pathing.usPathDataSize == 0 ) { return( 0 ); } gfRecalculatingExistingPathCost = TRUE; - sRet = PlotPath( pSoldier, pSoldier->sFinalDestination, NO_COPYROUTE, FALSE, FALSE, usMovementMode, FALSE, FALSE, 0 ); + sRet = PlotPath( pSoldier, pSoldier->pathing.sFinalDestination, NO_COPYROUTE, FALSE, FALSE, usMovementMode, FALSE, FALSE, 0 ); gfRecalculatingExistingPathCost = FALSE; return( sRet ); } @@ -4534,86 +4593,86 @@ UINT8 InternalDoorTravelCost( SOLDIERTYPE * pSoldier, INT32 iGridNo, UINT8 ubMov switch( ubMovementCost ) { - case TRAVELCOST_DOOR_CLOSED_HERE: - fDoorIsObstacleIfClosed = TRUE; - iDoorGridNo = iGridNo; - ubReplacementCost = TRAVELCOST_DOOR; - break; - case TRAVELCOST_DOOR_CLOSED_N: - fDoorIsObstacleIfClosed = TRUE; - iDoorGridNo = iGridNo + dirDelta[ NORTH ]; - ubReplacementCost = TRAVELCOST_DOOR; - break; - case TRAVELCOST_DOOR_CLOSED_W: - fDoorIsObstacleIfClosed = TRUE; - iDoorGridNo = iGridNo + dirDelta[ WEST ]; - ubReplacementCost = TRAVELCOST_DOOR; - break; - case TRAVELCOST_DOOR_OPEN_HERE: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = iGridNo; - break; - case TRAVELCOST_DOOR_OPEN_N: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = iGridNo + dirDelta[ NORTH ]; - break; - case TRAVELCOST_DOOR_OPEN_NE: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = iGridNo + dirDelta[ NORTHEAST ]; - break; - case TRAVELCOST_DOOR_OPEN_E: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = iGridNo + dirDelta[ EAST ]; - break; - case TRAVELCOST_DOOR_OPEN_SE: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = iGridNo + dirDelta[ SOUTHEAST ]; - break; - case TRAVELCOST_DOOR_OPEN_S: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = iGridNo + dirDelta[ SOUTH ]; - break; - case TRAVELCOST_DOOR_OPEN_SW: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = iGridNo + dirDelta[ SOUTHWEST ]; - break; - case TRAVELCOST_DOOR_OPEN_W: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = iGridNo + dirDelta[ WEST ]; - break; - case TRAVELCOST_DOOR_OPEN_NW: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = iGridNo + dirDelta[ NORTHWEST ]; - break; - case TRAVELCOST_DOOR_OPEN_N_N: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = iGridNo + dirDelta[ NORTH ] + dirDelta[ NORTH ]; - break; - case TRAVELCOST_DOOR_OPEN_NW_N: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = iGridNo + dirDelta[ NORTHWEST ] + dirDelta[ NORTH ]; - break; - case TRAVELCOST_DOOR_OPEN_NE_N: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = iGridNo + dirDelta[ NORTHEAST ] + dirDelta[ NORTH ]; - break; - case TRAVELCOST_DOOR_OPEN_W_W: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = iGridNo + dirDelta[ WEST ] + dirDelta[ WEST ]; - break; - case TRAVELCOST_DOOR_OPEN_SW_W: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = iGridNo + dirDelta[ SOUTHWEST ] + dirDelta[ WEST ]; - break; - case TRAVELCOST_DOOR_OPEN_NW_W: - fDoorIsObstacleIfClosed = FALSE; - iDoorGridNo = iGridNo + dirDelta[ NORTHWEST ] + dirDelta[ WEST ]; - break; - default: - break; + case TRAVELCOST_DOOR_CLOSED_HERE: + fDoorIsObstacleIfClosed = TRUE; + iDoorGridNo = iGridNo; + ubReplacementCost = TRAVELCOST_DOOR; + break; + case TRAVELCOST_DOOR_CLOSED_N: + fDoorIsObstacleIfClosed = TRUE; + iDoorGridNo = iGridNo + dirDelta[ NORTH ]; + ubReplacementCost = TRAVELCOST_DOOR; + break; + case TRAVELCOST_DOOR_CLOSED_W: + fDoorIsObstacleIfClosed = TRUE; + iDoorGridNo = iGridNo + dirDelta[ WEST ]; + ubReplacementCost = TRAVELCOST_DOOR; + break; + case TRAVELCOST_DOOR_OPEN_HERE: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = iGridNo; + break; + case TRAVELCOST_DOOR_OPEN_N: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = iGridNo + dirDelta[ NORTH ]; + break; + case TRAVELCOST_DOOR_OPEN_NE: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = iGridNo + dirDelta[ NORTHEAST ]; + break; + case TRAVELCOST_DOOR_OPEN_E: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = iGridNo + dirDelta[ EAST ]; + break; + case TRAVELCOST_DOOR_OPEN_SE: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = iGridNo + dirDelta[ SOUTHEAST ]; + break; + case TRAVELCOST_DOOR_OPEN_S: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = iGridNo + dirDelta[ SOUTH ]; + break; + case TRAVELCOST_DOOR_OPEN_SW: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = iGridNo + dirDelta[ SOUTHWEST ]; + break; + case TRAVELCOST_DOOR_OPEN_W: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = iGridNo + dirDelta[ WEST ]; + break; + case TRAVELCOST_DOOR_OPEN_NW: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = iGridNo + dirDelta[ NORTHWEST ]; + break; + case TRAVELCOST_DOOR_OPEN_N_N: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = iGridNo + dirDelta[ NORTH ] + dirDelta[ NORTH ]; + break; + case TRAVELCOST_DOOR_OPEN_NW_N: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = iGridNo + dirDelta[ NORTHWEST ] + dirDelta[ NORTH ]; + break; + case TRAVELCOST_DOOR_OPEN_NE_N: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = iGridNo + dirDelta[ NORTHEAST ] + dirDelta[ NORTH ]; + break; + case TRAVELCOST_DOOR_OPEN_W_W: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = iGridNo + dirDelta[ WEST ] + dirDelta[ WEST ]; + break; + case TRAVELCOST_DOOR_OPEN_SW_W: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = iGridNo + dirDelta[ SOUTHWEST ] + dirDelta[ WEST ]; + break; + case TRAVELCOST_DOOR_OPEN_NW_W: + fDoorIsObstacleIfClosed = FALSE; + iDoorGridNo = iGridNo + dirDelta[ NORTHWEST ] + dirDelta[ WEST ]; + break; + default: + break; } - if ( pSoldier && (pSoldier->uiStatusFlags & SOLDIER_MONSTER || pSoldier->uiStatusFlags & SOLDIER_ANIMAL) ) + if ( pSoldier && (pSoldier->flags.uiStatusFlags & SOLDIER_MONSTER || pSoldier->flags.uiStatusFlags & SOLDIER_ANIMAL) ) { // can't open doors! ubReplacementCost = TRAVELCOST_OBSTACLE; @@ -4637,7 +4696,7 @@ UINT8 InternalDoorTravelCost( SOLDIERTYPE * pSoldier, INT32 iGridNo, UINT8 ubMov { // abort! return( ubMovementCost ); - } + } } else { @@ -4668,22 +4727,22 @@ UINT8 InternalDoorTravelCost( SOLDIERTYPE * pSoldier, INT32 iGridNo, UINT8 ubMov else { if (fDoorIsObstacleIfClosed) - { + { // door is closed and this should be an obstacle, EXCEPT if we are calculating // a path for an enemy or NPC with keys // creatures and animals can't open doors! - if ( fReturnPerceivedValue || ( pSoldier && (pSoldier->uiStatusFlags & SOLDIER_MONSTER || pSoldier->uiStatusFlags & SOLDIER_ANIMAL ) ) ) + if ( fReturnPerceivedValue || ( pSoldier && (pSoldier->flags.uiStatusFlags & SOLDIER_MONSTER || pSoldier->flags.uiStatusFlags & SOLDIER_ANIMAL ) ) ) { ubMovementCost = ubReplacementCost; } else - { + { // have to check if door is locked and NPC does not have keys! pDoor = FindDoorInfoAtGridNo( iDoorGridNo ); if ( pDoor ) { - if ( ( !pDoor->fLocked || (pSoldier && pSoldier->bHasKeys) ) && !fReturnDoorCost ) + if ( ( !pDoor->fLocked || (pSoldier && pSoldier->flags.bHasKeys) ) && !fReturnDoorCost ) { ubMovementCost = gTileTypeMovementCost[ gpWorldLevelData[ iGridNo ].ubTerrainID ]; } diff --git a/Tactical/Points.cpp b/Tactical/Points.cpp index ab8f5b98..5f273d8c 100644 --- a/Tactical/Points.cpp +++ b/Tactical/Points.cpp @@ -1,36 +1,36 @@ #ifdef PRECOMPILEDHEADERS -#include "Tactical All.h" + #include "Tactical All.h" #else -#include "sgp.h" -#include "worlddef.h" -#include "points.h" -#include "overhead.h" -#include "Font control.h" -#include "interface.h" -#include "Isometric utils.h" -#include "pathai.h" -#include "interface.h" -#include "message.h" -#include "Animation Control.h" -#include "Weapons.h" + #include "sgp.h" + #include "worlddef.h" + #include "points.h" + #include "overhead.h" + #include "Font control.h" + #include "interface.h" + #include "Isometric utils.h" + #include "pathai.h" + #include "interface.h" + #include "message.h" + #include "Animation Control.h" + #include "Weapons.h" -#include "structure wrap.h" -#include "dialogue control.h" -#include "items.h" -#include "rt time defines.h" -#include "ai.h" -#include "handle ui.h" -#include "text.h" -#include "SkillCheck.h" -#include "wcheck.h" -#include "Soldier Profile.h" -#include "Soldier macros.h" -#include "Random.h" -#include "Campaign.h" -#include "drugs and alcohol.h" -#include "GameSettings.h" -#include "worldman.h" -#include "math.h" + #include "structure wrap.h" + #include "dialogue control.h" + #include "items.h" + #include "rt time defines.h" + #include "ai.h" + #include "handle ui.h" + #include "text.h" + #include "SkillCheck.h" + #include "wcheck.h" + #include "Soldier Profile.h" + #include "Soldier macros.h" + #include "Random.h" + #include "Campaign.h" + #include "drugs and alcohol.h" + #include "GameSettings.h" + #include "worldman.h" + #include "math.h" #include "Map Information.h" #include "Interface Items.h" #endif @@ -46,19 +46,19 @@ INT16 GetBreathPerAP( SOLDIERTYPE *pSoldier, UINT16 usAnimState ); INT16 TerrainActionPoints( SOLDIERTYPE *pSoldier, INT16 sGridno, INT8 bDir, INT8 bLevel ) { - INT16 sAPCost = 0; - INT16 sSwitchValue; - BOOLEAN fHiddenStructVisible; // Used for hidden struct visiblity + INT16 sAPCost = 0; + INT16 sSwitchValue; + BOOLEAN fHiddenStructVisible; // Used for hidden struct visiblity - if ( pSoldier->bStealthMode ) - sAPCost += AP_STEALTH_MODIFIER; + if ( pSoldier->bStealthMode ) + sAPCost += AP_STEALTH_MODIFIER; - if ( pSoldier->bReverse || gUIUseReverse ) - sAPCost += AP_REVERSE_MODIFIER; + if ( pSoldier->bReverse || gUIUseReverse ) + sAPCost += AP_REVERSE_MODIFIER; - //if (GridCost[gridno] == NPCMINECOST) - // switchValue = BackupGridCost[gridno]; - //else + //if (GridCost[gridno] == NPCMINECOST) + // switchValue = BackupGridCost[gridno]; + //else sSwitchValue = gubWorldMovementCosts[sGridno][bDir][ bLevel ]; @@ -66,13 +66,13 @@ INT16 TerrainActionPoints( SOLDIERTYPE *pSoldier, INT16 sGridno, INT8 bDir, INT8 if ( pSoldier->bTeam == gbPlayerNum ) { // Is this obstcale a hidden tile that has not been revealed yet? - if( DoesGridnoContainHiddenStruct( (UINT16)sGridno, &fHiddenStructVisible ) ) + if( DoesGridnoContainHiddenStruct( (INT16)sGridno, &fHiddenStructVisible ) ) { // Are we not visible, if so use terrain costs! if ( !fHiddenStructVisible ) { // Set cost of terrain! - sSwitchValue = gTileTypeMovementCost[ gpWorldLevelData[ sGridno ].ubTerrainID ]; + sSwitchValue = gTileTypeMovementCost[ gpWorldLevelData[ sGridno ].ubTerrainID ]; } } } @@ -95,11 +95,17 @@ INT16 TerrainActionPoints( SOLDIERTYPE *pSoldier, INT16 sGridno, INT8 bDir, INT8 sSwitchValue = gTileTypeMovementCost[ gpWorldLevelData[ sGridno ].ubTerrainID ]; } - if (sSwitchValue >= TRAVELCOST_BLOCKED && sSwitchValue != TRAVELCOST_DOOR) + if (sSwitchValue >= TRAVELCOST_BLOCKED && sSwitchValue != TRAVELCOST_DOOR ) { return(-1); // Cost too much to be considered! } + //CHRISL: We can't jump a fence while wearing a backpack, to consider fences as impassible + if(sSwitchValue == TRAVELCOST_FENCE && UsingNewInventorySystem() == true && pSoldier->inv[BPACKPOCKPOS].exists() == true) + { + return(-1); + } + switch( sSwitchValue ) { case TRAVELCOST_DIRTROAD : @@ -150,15 +156,18 @@ INT16 TerrainActionPoints( SOLDIERTYPE *pSoldier, INT16 sGridno, INT8 bDir, INT8 { return -1; } - - return( AP_JUMPFENCE ); + // CHRISL: + if((UsingNewInventorySystem() == true) && pSoldier->inv[BPACKPOCKPOS].exists() == true) + return( AP_JUMPFENCEBPACK ); + else + return( AP_JUMPFENCE ); case TRAVELCOST_NONE : return( 0 ); - default: + default: DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Calc AP: Unrecongnized MP type %d in %d, direction %d", sSwitchValue, sGridno, bDir ) ); - break; + break; } @@ -212,37 +221,37 @@ INT16 BreathPointAdjustmentForCarriedWeight( SOLDIERTYPE * pSoldier ) INT16 TerrainBreathPoints(SOLDIERTYPE * pSoldier, INT16 sGridno,INT8 bDir, UINT16 usMovementMode) { - INT32 iPoints=0; - UINT8 ubMovementCost; + INT32 iPoints=0; + UINT8 ubMovementCost; ubMovementCost = gubWorldMovementCosts[sGridno][bDir][0]; - switch( ubMovementCost ) - { - case TRAVELCOST_DIRTROAD : + switch( ubMovementCost ) + { + case TRAVELCOST_DIRTROAD : case TRAVELCOST_FLAT : iPoints = BP_MOVEMENT_FLAT; break; - //case TRAVELCOST_BUMPY : + //case TRAVELCOST_BUMPY : case TRAVELCOST_GRASS : iPoints = BP_MOVEMENT_GRASS; break; case TRAVELCOST_THICK : iPoints = BP_MOVEMENT_BUSH; break; case TRAVELCOST_DEBRIS : iPoints = BP_MOVEMENT_RUBBLE; break; case TRAVELCOST_SHORE : iPoints = BP_MOVEMENT_SHORE; break; // wading shallow water case TRAVELCOST_KNEEDEEP : iPoints = BP_MOVEMENT_LAKE; break; // wading waist/chest deep - very slow case TRAVELCOST_DEEPWATER : iPoints = BP_MOVEMENT_OCEAN; break; // can swim, so it's faster than wading - // case TRAVELCOST_VEINEND : - // case TRAVELCOST_VEINMID : iPoints = BP_MOVEMENT_FLAT; break; +// case TRAVELCOST_VEINEND : +// case TRAVELCOST_VEINMID : iPoints = BP_MOVEMENT_FLAT; break; default: if ( IS_TRAVELCOST_DOOR( ubMovementCost ) ) { iPoints = BP_MOVEMENT_FLAT; break; } - /* - #ifdef TESTVERSION - NumMessage("ERROR: TerrainBreathPoints: Unrecognized grid cost = ", - GridCost[gridno]); - #endif - */ - return(0); +/* +#ifdef TESTVERSION + NumMessage("ERROR: TerrainBreathPoints: Unrecognized grid cost = ", + GridCost[gridno]); +#endif +*/ + return(0); } iPoints = iPoints * BreathPointAdjustmentForCarriedWeight( pSoldier ) / 100; @@ -250,39 +259,39 @@ INT16 TerrainBreathPoints(SOLDIERTYPE * pSoldier, INT16 sGridno,INT8 bDir, UINT1 // ATE - MAKE MOVEMENT ALWAYS WALK IF IN WATER if ( TERRAIN_IS_WATER( gpWorldLevelData[ sGridno ].ubTerrainID) ) { - usMovementMode = WALKING; + usMovementMode = WALKING; } // so, then we must modify it for other movement styles and accumulate switch(usMovementMode) { - case RUNNING: - case ADULTMONSTER_WALKING: - case BLOODCAT_RUN: + case RUNNING: + case ADULTMONSTER_WALKING: + case BLOODCAT_RUN: - iPoints *= BP_RUN_ENERGYCOSTFACTOR; break; + iPoints *= BP_RUN_ENERGYCOSTFACTOR; break; - case SIDE_STEP: - case WALK_BACKWARDS: - case BLOODCAT_WALK_BACKWARDS: - case MONSTER_WALK_BACKWARDS: - case WALKING : iPoints *= BP_WALK_ENERGYCOSTFACTOR; break; + case SIDE_STEP: + case WALK_BACKWARDS: + case BLOODCAT_WALK_BACKWARDS: + case MONSTER_WALK_BACKWARDS: + case WALKING : iPoints *= BP_WALK_ENERGYCOSTFACTOR; break; - case START_SWAT: - case SWATTING: - case SWAT_BACKWARDS: - iPoints *= BP_SWAT_ENERGYCOSTFACTOR; break; - case CRAWLING: iPoints *= BP_CRAWL_ENERGYCOSTFACTOR; break; + case START_SWAT: + case SWATTING: + case SWAT_BACKWARDS: + iPoints *= BP_SWAT_ENERGYCOSTFACTOR; break; + case CRAWLING: iPoints *= BP_CRAWL_ENERGYCOSTFACTOR; break; } // ATE: Adjust these by realtime movement - if (!(gTacticalStatus.uiFlags & TURNBASED) || !(gTacticalStatus.uiFlags & INCOMBAT ) ) - { + if (!(gTacticalStatus.uiFlags & TURNBASED) || !(gTacticalStatus.uiFlags & INCOMBAT ) ) + { // ATE: ADJUST FOR RT - MAKE BREATH GO A LITTLE FASTER! iPoints = (INT32)( iPoints * TB_BREATH_DEDUCT_MODIFIER ); - } + } return( (INT16) iPoints); @@ -296,56 +305,79 @@ INT16 ActionPointCost( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bDir, UINT16 u sPoints = 0; // get the tile cost for that tile based on WALKING - sTileCost = TerrainActionPoints( pSoldier, sGridNo, bDir, pSoldier->bLevel ); + sTileCost = TerrainActionPoints( pSoldier, sGridNo, bDir, pSoldier->pathing.bLevel ); if (sTileCost == -1) { return 100; } // Get switch value... - sSwitchValue = gubWorldMovementCosts[ sGridNo ][ bDir ][ pSoldier->bLevel ]; + sSwitchValue = gubWorldMovementCosts[ sGridNo ][ bDir ][ pSoldier->pathing.bLevel ]; // Tile cost should not be reduced based on movement mode... if ( sSwitchValue == TRAVELCOST_FENCE ) { - return( sTileCost ); + return( sTileCost ); } // ATE - MAKE MOVEMENT ALWAYS WALK IF IN WATER if ( TERRAIN_IS_WATER( gpWorldLevelData[ sGridNo ].ubTerrainID) ) { - usMovementMode = WALKING; + usMovementMode = WALKING; } // so, then we must modify it for other movement styles and accumulate + // CHRISL: Adjusted system to use different move costs while wearing a backpack if (sTileCost > 0) { switch(usMovementMode) { - case RUNNING: - case ADULTMONSTER_WALKING: - case BLOODCAT_RUN: - sPoints = (INT16)(DOUBLE)( (sTileCost / RUNDIVISOR) ); break; + case RUNNING: + case ADULTMONSTER_WALKING: + case BLOODCAT_RUN: + // CHRISL + if((UsingNewInventorySystem() == true) && pSoldier->inv[BPACKPOCKPOS].exists() == true) + sPoints = (INT16)(DOUBLE)( (sTileCost / RUNDIVISORBPACK) ); + else + sPoints = (INT16)(DOUBLE)( (sTileCost / RUNDIVISOR) ); + break; - case CROW_FLY: - case SIDE_STEP: - case WALK_BACKWARDS: - case ROBOT_WALK: - case BLOODCAT_WALK_BACKWARDS: - case MONSTER_WALK_BACKWARDS: - case LARVAE_WALK: - case WALKING : sPoints = (sTileCost + WALKCOST); break; + case CROW_FLY: + case SIDE_STEP: + case WALK_BACKWARDS: + case ROBOT_WALK: + case BLOODCAT_WALK_BACKWARDS: + case MONSTER_WALK_BACKWARDS: + case LARVAE_WALK: + case WALKING : + // CHRISL + if((UsingNewInventorySystem() == true) && pSoldier->inv[BPACKPOCKPOS].exists() == true) + sPoints = (sTileCost + WALKCOSTBPACK); + else + sPoints = (sTileCost + WALKCOST); + break; - case START_SWAT: - case SWAT_BACKWARDS: - case SWATTING: sPoints = (sTileCost + SWATCOST); break; - case CRAWLING: sPoints = (sTileCost + CRAWLCOST); break; + case START_SWAT: + case SWAT_BACKWARDS: + // CHRISL + case SWATTING: + if((UsingNewInventorySystem() == true) && pSoldier->inv[BPACKPOCKPOS].exists() == true) + sPoints = (sTileCost + SWATCOSTBPACK); + else + sPoints = (sTileCost + SWATCOST); + break; + case CRAWLING: + if((UsingNewInventorySystem() == true) && pSoldier->inv[BPACKPOCKPOS].exists() == true) + sPoints = (sTileCost + CRAWLCOSTBPACK); + else + sPoints = (sTileCost + CRAWLCOST); + break; - default: + default: - // Invalid movement mode - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Invalid movement mode %d used in ActionPointCost", usMovementMode ) ); - sPoints = 1; + // Invalid movement mode + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Invalid movement mode %d used in ActionPointCost", usMovementMode ) ); + sPoints = 1; } } @@ -353,22 +385,22 @@ INT16 ActionPointCost( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bDir, UINT16 u { switch(usMovementMode) { - case RUNNING: - case WALKING : + case RUNNING: + case WALKING : case LARVAE_WALK: - case SIDE_STEP: - case WALK_BACKWARDS: - // charge crouch APs for ducking head! - sPoints += AP_CROUCH; - break; + case SIDE_STEP: + case WALK_BACKWARDS: + // charge crouch APs for ducking head! + sPoints += AP_CROUCH; + break; - default: - break; + default: + break; } } return( sPoints ); -} +} INT16 EstimateActionPointCost( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bDir, UINT16 usMovementMode, INT8 bPathIndex, INT8 bPathLength ) { @@ -378,95 +410,118 @@ INT16 EstimateActionPointCost( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bDir, sPoints = 0; // get the tile cost for that tile based on WALKING - sTileCost = TerrainActionPoints( pSoldier, sGridNo, bDir, pSoldier->bLevel ); + sTileCost = TerrainActionPoints( pSoldier, sGridNo, bDir, pSoldier->pathing.bLevel ); if (sTileCost == -1) { return 100; } // so, then we must modify it for other movement styles and accumulate + // CHRISL: Adjusted system to use different move costs while wearing a backpack if (sTileCost > 0) { switch(usMovementMode) { - case RUNNING: - case ADULTMONSTER_WALKING: - case BLOODCAT_RUN: - sPoints = (INT16)(DOUBLE)( (sTileCost / RUNDIVISOR) ); break; + case RUNNING: + case ADULTMONSTER_WALKING: + case BLOODCAT_RUN: + // CHRISL + if((UsingNewInventorySystem() == true) && pSoldier->inv[BPACKPOCKPOS].exists() == true) + sPoints = (INT16)(DOUBLE)( (sTileCost / RUNDIVISORBPACK) ); + else + sPoints = (INT16)(DOUBLE)( (sTileCost / RUNDIVISOR) ); + break; - case CROW_FLY: - case SIDE_STEP: - case ROBOT_WALK: - case WALK_BACKWARDS: - case BLOODCAT_WALK_BACKWARDS: - case MONSTER_WALK_BACKWARDS: - case LARVAE_WALK: - case WALKING : sPoints = (sTileCost + WALKCOST); break; + case CROW_FLY: + case SIDE_STEP: + case ROBOT_WALK: + case WALK_BACKWARDS: + case BLOODCAT_WALK_BACKWARDS: + case MONSTER_WALK_BACKWARDS: + case LARVAE_WALK: + // CHRISL + case WALKING : + if((UsingNewInventorySystem() == true) && pSoldier->inv[BPACKPOCKPOS].exists() == true) + sPoints = (sTileCost + WALKCOSTBPACK); + else + sPoints = (sTileCost + WALKCOST); + break; - case START_SWAT: - case SWAT_BACKWARDS: - case SWATTING: sPoints = (sTileCost + SWATCOST); break; - case CRAWLING: sPoints = (sTileCost + CRAWLCOST); break; + case START_SWAT: + case SWAT_BACKWARDS: + // CHRISL + case SWATTING: + if((UsingNewInventorySystem() == true) && pSoldier->inv[BPACKPOCKPOS].exists() == true) + sPoints = (sTileCost + SWATCOSTBPACK); + else + sPoints = (sTileCost + SWATCOST); + break; + case CRAWLING: + if((UsingNewInventorySystem() == true) && pSoldier->inv[BPACKPOCKPOS].exists() == true) + sPoints = (sTileCost + CRAWLCOSTBPACK); + else + sPoints = (sTileCost + CRAWLCOST); + break; - default: + default: - // Invalid movement mode - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Invalid movement mode %d used in ActionPointCost", usMovementMode ) ); - sPoints = 1; + // Invalid movement mode + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Invalid movement mode %d used in ActionPointCost", usMovementMode ) ); + sPoints = 1; } } // Get switch value... - sSwitchValue = gubWorldMovementCosts[ sGridNo ][ bDir ][ pSoldier->bLevel ]; + sSwitchValue = gubWorldMovementCosts[ sGridNo ][ bDir ][ pSoldier->pathing.bLevel ]; - // ATE: If we have a 'special cost, like jump fence... + // ATE: If we have a 'special cost, like jump fence... if ( sSwitchValue == TRAVELCOST_FENCE ) { // If we are changeing stance ( either before or after getting there.... // We need to reflect that... switch(usMovementMode) { - case SIDE_STEP: - case WALK_BACKWARDS: - case RUNNING: - case WALKING : + case SIDE_STEP: + case WALK_BACKWARDS: + case RUNNING: + case WALKING : - // Add here cost to go from crouch to stand AFTER fence hop.... - // Since it's AFTER.. make sure we will be moving after jump... - if ( ( bPathIndex + 2 ) < bPathLength ) - { + // Add here cost to go from crouch to stand AFTER fence hop.... + // Since it's AFTER.. make sure we will be moving after jump... + if ( ( bPathIndex + 2 ) < bPathLength ) + { + sPoints += AP_CROUCH; + } + break; + + case SWATTING: + case START_SWAT: + case SWAT_BACKWARDS: + + // Add cost to stand once there BEFORE.... sPoints += AP_CROUCH; - } - break; + break; - case SWATTING: - case START_SWAT: - case SWAT_BACKWARDS: + case CRAWLING: - // Add cost to stand once there BEFORE.... - sPoints += AP_CROUCH; - break; - - case CRAWLING: - - // Can't do it here..... - break; + // Can't do it here..... + break; } } else if (sSwitchValue == TRAVELCOST_NOT_STANDING) { switch(usMovementMode) { - case RUNNING: - case WALKING : - case SIDE_STEP: - case WALK_BACKWARDS: - // charge crouch APs for ducking head! - sPoints += AP_CROUCH; - break; + case RUNNING: + case WALKING : + case SIDE_STEP: + case WALK_BACKWARDS: + // charge crouch APs for ducking head! + sPoints += AP_CROUCH; + break; - default: - break; + default: + break; } } @@ -480,7 +535,7 @@ BOOLEAN EnoughPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost, BOOLE INT16 sNewAP = 0; // If this guy is on a special move... don't care about APS, OR BPSs! - if ( pSoldier->ubWaitActionToDo ) + if ( pSoldier->ubWaitActionToDo ) { return( TRUE ); } @@ -497,12 +552,12 @@ BOOLEAN EnoughPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost, BOOLE sAPCost = 0; } -#ifdef NETWORKED - if( !IsTheSolderUnderMyControl( pSoldier->ubID) ) + #ifdef NETWORKED + if( !IsTheSolderUnderMyControl( pSoldier->ubID) ) { return( TRUE ); } -#endif + #endif // Get New points sNewAP = pSoldier->bActionPoints - sAPCost; @@ -524,7 +579,7 @@ BOOLEAN EnoughPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost, BOOLE void DeductPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost,BOOLEAN fProactive ) { - INT16 sNewAP = 0, sNewBP = 0; + INT16 sNewAP = 0; INT8 bNewBreath; @@ -540,7 +595,7 @@ void DeductPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost,BOOLEAN f // If this is the first time with no action points, set UI flag if ( sNewAP <= 0 && pSoldier->bActionPoints > 0 ) { - pSoldier->fUIFirstTimeNOAP = TRUE; + pSoldier->flags.fUIFirstTimeNOAP = TRUE; fInterfacePanelDirty = TRUE; } @@ -552,7 +607,7 @@ void DeductPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost,BOOLEAN f pSoldier->bActionPoints = (INT8)sNewAP; - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Deduct Points (%d at %d) %d %d", pSoldier->ubID, pSoldier->sGridNo, sAPCost, iBPCost ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Deduct Points (%d at %d) %d %d", pSoldier->ubID, pSoldier->sGridNo, sAPCost, iBPCost ) ); if ( AM_A_ROBOT( pSoldier ) ) { @@ -560,7 +615,7 @@ void DeductPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost,BOOLEAN f iBPCost = 0; } - // is there a BREATH deduction/transaction to be made? (REMEMBER: could be a GAIN!) + // is there a BREATH deduction/transaction to be made? (REMEMBER: could be a GAIN!) // NB: iBPCost > 0 - breath loss, iBPCost < 0 - breath gain if (iBPCost) { @@ -591,7 +646,7 @@ void DeductPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost,BOOLEAN f // Snap: moved this up, because it had no effect below // Take off 1 AP per 5 (negative) breath... pSoldier->bActionPoints -= ( pSoldier->sBreathRed + iBPCost - BREATH_RED_MAX ) - / ( 5 * BP_RATIO_RED_PTS_TO_NORMAL ); + / ( 5 * BP_RATIO_RED_PTS_TO_NORMAL ); if ( pSoldier->bActionPoints < 0 ) { pSoldier->bActionPoints = 0; @@ -606,7 +661,7 @@ void DeductPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost,BOOLEAN f // Get new breath bNewBreath = ( pSoldier->bBreathMax * BP_RATIO_RED_PTS_TO_NORMAL - pSoldier->sBreathRed ) - / BP_RATIO_RED_PTS_TO_NORMAL; + / BP_RATIO_RED_PTS_TO_NORMAL; // Snap: This should never happen... if ( bNewBreath > pSoldier->bBreathMax ) @@ -631,49 +686,49 @@ void DeductPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost,BOOLEAN f INT32 AdjustBreathPts(SOLDIERTYPE *pSold, INT32 iBPCost) { - INT16 sBreathFactor = 100; - UINT8 ubBandaged; + INT16 sBreathFactor = 100; + UINT8 ubBandaged; - //NumMessage("BEFORE adjustments, BREATH PTS = ",breathPts); + //NumMessage("BEFORE adjustments, BREATH PTS = ",breathPts); - // in real time, there IS no AP cost, (only breath cost) - /* - if (!(gTacticalStatus.uiFlags & TURNBASED) || !(gTacticalStatus.uiFlags & INCOMBAT ) ) - { + // in real time, there IS no AP cost, (only breath cost) + /* + if (!(gTacticalStatus.uiFlags & TURNBASED) || !(gTacticalStatus.uiFlags & INCOMBAT ) ) + { // ATE: ADJUST FOR RT - MAKE BREATH GO A LITTLE FASTER! iBPCost *= TB_BREATH_DEDUCT_MODIFIER; - } - */ + } + */ - // adjust breath factor for current breath deficiency - sBreathFactor += (100 - pSold->bBreath); + // adjust breath factor for current breath deficiency + sBreathFactor += (100 - pSold->bBreath); - // adjust breath factor for current life deficiency (but add 1/2 bandaging) - ubBandaged = pSold->bLifeMax - pSold->bLife - pSold->bBleeding; - //sBreathFactor += (pSold->bLifeMax - (pSold->bLife + (ubBandaged / 2))); - sBreathFactor += 100 * (pSold->bLifeMax - (pSold->bLife + (ubBandaged / 2))) / pSold->bLifeMax; + // adjust breath factor for current life deficiency (but add 1/2 bandaging) + ubBandaged = pSold->stats.bLifeMax - pSold->stats.bLife - pSold->bBleeding; + //sBreathFactor += (pSold->stats.bLifeMax - (pSold->stats.bLife + (ubBandaged / 2))); + sBreathFactor += 100 * (pSold->stats.bLifeMax - (pSold->stats.bLife + (ubBandaged / 2))) / pSold->stats.bLifeMax; - if ( pSold->bStrength > 80 ) - { - // give % reduction to breath costs for high strength mercs - sBreathFactor -= (pSold->bStrength - 80) / 2; - } + if ( pSold->stats.bStrength > 80 ) + { + // give % reduction to breath costs for high strength mercs + sBreathFactor -= (pSold->stats.bStrength - 80) / 2; + } - /* THIS IS OLD JAGGED ALLIANCE STUFF (left for possible future reference) +/* THIS IS OLD JAGGED ALLIANCE STUFF (left for possible future reference) - // apply penalty due to high temperature, heat, and hot Metaviran sun - // if INDOORS, in DEEP WATER, or possessing HEAT TOLERANCE trait - if ((ptr->terrtype == FLOORTYPE) || (ptr->terr >= OCEAN21) || - (ptr->trait == HEAT_TOLERANT)) + // apply penalty due to high temperature, heat, and hot Metaviran sun + // if INDOORS, in DEEP WATER, or possessing HEAT TOLERANCE trait + if ((ptr->terrtype == FLOORTYPE) || (ptr->terr >= OCEAN21) || + (ptr->trait == HEAT_TOLERANT)) breathFactor += (Status.heatFactor / 5); // 20% of normal heat penalty - else + else breathFactor += Status.heatFactor; // not used to this! - */ +*/ - // if a non-swimmer type is thrashing around in deep water + // if a non-swimmer type is thrashing around in deep water if ( (pSold->ubProfile != NO_PROFILE ) && (gMercProfiles[ pSold->ubProfile ].bPersonalityTrait == NONSWIMMER) ) { if ( pSold->usAnimState == DEEP_WATER_TRED || pSold->usAnimState == DEEP_WATER_SWIM) @@ -682,19 +737,19 @@ INT32 AdjustBreathPts(SOLDIERTYPE *pSold, INT32 iBPCost) } } - if ( sBreathFactor == 0 ) - { + if ( sBreathFactor == 0 ) + { iBPCost = 0; - } - else if (iBPCost > 0) // breath DECREASE - // increase breath COST by breathFactor - iBPCost = ((iBPCost * sBreathFactor) / 100); - else // breath INCREASE - // decrease breath GAIN by breathFactor - iBPCost = ((iBPCost * 100) / sBreathFactor); + } + else if (iBPCost > 0) // breath DECREASE + // increase breath COST by breathFactor + iBPCost = ((iBPCost * sBreathFactor) / 100); + else // breath INCREASE + // decrease breath GAIN by breathFactor + iBPCost = ((iBPCost * 100) / sBreathFactor); - return(iBPCost); + return(iBPCost); } @@ -702,19 +757,17 @@ INT32 AdjustBreathPts(SOLDIERTYPE *pSold, INT32 iBPCost) void UnusedAPsToBreath(SOLDIERTYPE *pSold) { INT16 sUnusedAPs, sBreathPerAP = 0, sBreathChange, sRTBreathMod; - BOOLEAN fAnimTypeFound = FALSE; - // Note to Andrew (or whomever else it may concern): // This function deals with BETWEEN TURN breath/energy gains. The basic concept is: - // + // // - look at LAST (current) animation of merc to see what he's now doing // - look at how many AP remain unspent (indicating duration of time doing that anim) // - // figure out how much breath/energy (if any) he should recover. Obviously if a merc + // figure out how much breath/energy (if any) he should recover. Obviously if a merc // is STANDING BREATHING and hasn't spent any AP then it means he *stood around* for - // the entire duration of one turn (which, instead of spending energy, REGAINS energy) + // the entire duration of one turn (which, instead of spending energy, REGAINS energy) // COMMENTED OUT FOR NOW SINCE MOST OF THE ANIMATION DEFINES DO NOT MATCH @@ -722,7 +775,7 @@ void UnusedAPsToBreath(SOLDIERTYPE *pSold) // If we are not in turn-based combat... - if ( pSold->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSold->flags.uiStatusFlags & SOLDIER_VEHICLE ) { return; } @@ -798,7 +851,7 @@ void UnusedAPsToBreath(SOLDIERTYPE *pSold) { // can't gain any breath when we've just been gassed, OR // if standing in tear gas without a gas mask on - if ( pSold->uiStatusFlags & SOLDIER_GASSED ) + if ( pSold->flags.uiStatusFlags & SOLDIER_GASSED ) { return; // can't breathe here, so get no breath back! } @@ -811,24 +864,24 @@ void UnusedAPsToBreath(SOLDIERTYPE *pSold) { switch( gGameOptions.ubDifficultyLevel ) { - case DIF_LEVEL_EASY: - sBreathChange = ((AP_MAXIMUM + gGameExternalOptions.iEasyAPBonus)- sUnusedAPs) * sBreathPerAP; - break; + case DIF_LEVEL_EASY: + sBreathChange = ((AP_MAXIMUM + gGameExternalOptions.iEasyAPBonus)- sUnusedAPs) * sBreathPerAP; + break; - case DIF_LEVEL_MEDIUM: - sBreathChange = ((AP_MAXIMUM + gGameExternalOptions.iExperiencedAPBonus)-sUnusedAPs) * sBreathPerAP; - break; + case DIF_LEVEL_MEDIUM: + sBreathChange = ((AP_MAXIMUM + gGameExternalOptions.iExperiencedAPBonus)-sUnusedAPs) * sBreathPerAP; + break; - case DIF_LEVEL_HARD: - sBreathChange = ((AP_MAXIMUM + gGameExternalOptions.iExpertAPBonus)- sUnusedAPs) * sBreathPerAP; - break; + case DIF_LEVEL_HARD: + sBreathChange = ((AP_MAXIMUM + gGameExternalOptions.iExpertAPBonus)- sUnusedAPs) * sBreathPerAP; + break; - case DIF_LEVEL_INSANE: - sBreathChange = ((AP_MAXIMUM + gGameExternalOptions.iInsaneAPBonus)- sUnusedAPs) * sBreathPerAP; - break; + case DIF_LEVEL_INSANE: + sBreathChange = ((AP_MAXIMUM + gGameExternalOptions.iInsaneAPBonus)- sUnusedAPs) * sBreathPerAP; + break; - default: - sBreathChange = (AP_MAXIMUM - sUnusedAPs) * sBreathPerAP; + default: + sBreathChange = (AP_MAXIMUM - sUnusedAPs) * sBreathPerAP; } } else @@ -865,19 +918,19 @@ INT16 GetBreathPerAP( SOLDIERTYPE *pSoldier, UINT16 usAnimState ) sBreathPerAP = BP_PER_AP_MIN_EFFORT; // OK, check if we are in water and are waling/standing - if ( MercInWater( pSoldier ) ) + if ( pSoldier->MercInWater( ) ) { switch( usAnimState ) { - case STANDING: + case STANDING: - sBreathPerAP = BP_PER_AP_LT_EFFORT; - break; + sBreathPerAP = BP_PER_AP_LT_EFFORT; + break; - case WALKING: + case WALKING: - sBreathPerAP = BP_PER_AP_MOD_EFFORT; - break; + sBreathPerAP = BP_PER_AP_MOD_EFFORT; + break; } } else @@ -885,15 +938,15 @@ INT16 GetBreathPerAP( SOLDIERTYPE *pSoldier, UINT16 usAnimState ) switch( usAnimState ) { - case STANDING: + case STANDING: - sBreathPerAP = BP_PER_AP_NO_EFFORT; - break; + sBreathPerAP = BP_PER_AP_NO_EFFORT; + break; - case WALKING: + case WALKING: - sBreathPerAP = BP_PER_AP_LT_EFFORT; - break; + sBreathPerAP = BP_PER_AP_LT_EFFORT; + break; } } fAnimTypeFound = TRUE; @@ -925,12 +978,12 @@ INT16 GetBreathPerAP( SOLDIERTYPE *pSoldier, UINT16 usAnimState ) //rain // Reduce breath gain on 25%/rain intensity - // Lalien: only for soldiers that are in loaded sector, + // Lalien: only for soldiers that are in loaded sector, if ( gfWorldLoaded && pSoldier->bInSector) { - if( sBreathPerAP < 0 && ( pSoldier->bLevel || !FindStructure( pSoldier->sGridNo, STRUCTURE_ROOF ) ) && pSoldier->bBreath > 1) + if( sBreathPerAP < 0 && ( pSoldier->pathing.bLevel || !FindStructure( pSoldier->sGridNo, STRUCTURE_ROOF ) ) && pSoldier->bBreath > 1) { - sBreathPerAP -= (INT16)( sBreathPerAP * gbCurrentRainIntensity * gGameExternalOptions.ubBreathGainReductionPerRainIntensity / 100 ); + sBreathPerAP -= (INT16)( sBreathPerAP * gbCurrentRainIntensity * gGameExternalOptions.ubBreathGainReductionPerRainIntensity / 100 ); } } //end rain @@ -945,16 +998,16 @@ UINT8 CalcAPsToBurst( INT8 bBaseActionPoints, OBJECTTYPE * pObj ) // base APs is what you'd get from CalcActionPoints(); // NB round UP, so 21-25 APs pay full - aps = ( Weapon[ pObj->usItem ].bBurstAP * bBaseActionPoints + (AP_MAXIMUM - 1) ) / AP_MAXIMUM; + aps = ( Weapon[ pObj->usItem ].bBurstAP * bBaseActionPoints + (AP_MAXIMUM - 1) ) / AP_MAXIMUM; /*if ( GetPercentBurstFireAPReduction(pObj)>0 ) { - aps = (aps * 100) / (100 + GetBurstFireAPReductionStatus(pObj) / (100/GetPercentBurstFireAPReduction(pObj))); + aps = (aps * 100) / (100 + GetBurstFireAPReductionStatus(pObj) / (100/GetPercentBurstFireAPReduction(pObj))); } if ( GetPercentAPReduction(pObj)>0 ) { - aps = (aps * 100) / (100 + GetAPReductionStatus(pObj) / (100/GetPercentAPReduction(pObj))); + aps = (aps * 100) / (100 + GetAPReductionStatus(pObj) / (100/GetPercentAPReduction(pObj))); }*/ DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CalcAPsToBurst: before bonus aps = %d, std bonus = %d, burst bonus = %d", aps,GetPercentAPReduction(pObj),GetPercentBurstFireAPReduction(pObj))); @@ -977,20 +1030,20 @@ UINT8 CalcAPsToBurst( INT8 bBaseActionPoints, OBJECTTYPE * pObj ) UINT8 CalcAPsToAutofire( INT8 bBaseActionPoints, OBJECTTYPE * pObj, UINT8 bDoAutofire ) { - // INT8 bAttachPos; +// INT8 bAttachPos; INT32 aps=AP_MAXIMUM + 1; if ( GetAutofireShotsPerFiveAPs (pObj) ) { // Snap: Do this just like in CalcAPsToBurst - const INT32 autofireaps = - aps = ( ( 5 * bDoAutofire * bBaseActionPoints ) / GetAutofireShotsPerFiveAPs(pObj) + (AP_MAXIMUM - 1) ) / AP_MAXIMUM; + const INT32 autofireaps = + aps = ( ( 5 * bDoAutofire * bBaseActionPoints ) / GetAutofireShotsPerFiveAPs(pObj) + (AP_MAXIMUM - 1) ) / AP_MAXIMUM; //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CalcAPsToAutofire: base aps = %d, # shots = %d",aps,pSoldier->bDoAutofire )); //check for spring and bolt //bAttachPos = FindAttachment( &(pSoldier->inv[HANDPOS]), SPRING_AND_BOLT_UPGRADE ); //if ( bAttachPos != -1 ) - //{ + //{ // aps = (aps * 100) / (100 + pSoldier->inv[HANDPOS].bAttachStatus[ bAttachPos ] / 5); // DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CalcAPsToAutofire: found rod and spring, aps = %d, # shots = %d",aps,pSoldier->bDoAutofire )); //} @@ -1021,13 +1074,13 @@ UINT8 CalcAPsToAutofire( INT8 bBaseActionPoints, OBJECTTYPE * pObj, UINT8 bDoAut DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CalcAPsToAutoFire: return aps = %d", aps)); return (UINT8) aps; -} +} UINT8 CalcTotalAPsToAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTurningCost, INT8 bAimTime ) { UINT16 sAPCost = 0; - UINT16 usItemNum; + UINT16 usItemNum; INT16 sActionGridNo; UINT8 ubDirection; INT16 sAdjustedGridNo; @@ -1037,16 +1090,16 @@ UINT8 CalcTotalAPsToAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTur usItemNum = pSoldier->inv[HANDPOS].usItem; uiItemClass = Item[ usItemNum ].usItemClass; - if ( uiItemClass == IC_GUN || uiItemClass == IC_LAUNCHER || uiItemClass == IC_TENTACLES || uiItemClass == IC_THROWING_KNIFE ) + if ( uiItemClass == IC_GUN || uiItemClass == IC_LAUNCHER || uiItemClass == IC_TENTACLES || uiItemClass == IC_THROWING_KNIFE ) { sAPCost = MinAPsToAttack( pSoldier, sGridNo, ubAddTurningCost ); if ( pSoldier->bDoBurst ) { if(pSoldier->bDoAutofire && GetAutofireShotsPerFiveAPs(&pSoldier->inv[HANDPOS]) > 0 ) - sAPCost += CalcAPsToAutofire( CalcActionPoints( pSoldier ), &(pSoldier->inv[HANDPOS]), pSoldier->bDoAutofire ); + sAPCost += CalcAPsToAutofire( pSoldier->CalcActionPoints( ), &(pSoldier->inv[HANDPOS]), pSoldier->bDoAutofire ); else - sAPCost += CalcAPsToBurst( CalcActionPoints( pSoldier ), &(pSoldier->inv[HANDPOS]) ); + sAPCost += CalcAPsToBurst( pSoldier->CalcActionPoints( ), &(pSoldier->inv[HANDPOS]) ); } else { @@ -1055,7 +1108,7 @@ UINT8 CalcTotalAPsToAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTur } //ATE: HERE, need to calculate APs! - if ( uiItemClass & IC_EXPLOSV ) + if ( uiItemClass & IC_EXPLOSV ) { sAPCost = MinAPsToAttack( pSoldier, sGridNo, ubAddTurningCost ); @@ -1078,13 +1131,13 @@ UINT8 CalcTotalAPsToAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTur else { //INT32 cnt; - //INT16 sSpot; + //INT16 sSpot; UINT8 ubGuyThere; INT16 sGotLocation = NOWHERE; BOOLEAN fGotAdjacent = FALSE; SOLDIERTYPE *pTarget; - ubGuyThere = WhoIsThere2( sGridNo, pSoldier->bLevel ); + ubGuyThere = WhoIsThere2( sGridNo, pSoldier->pathing.bLevel ); if ( ubGuyThere != NOBODY ) { @@ -1107,7 +1160,7 @@ UINT8 CalcTotalAPsToAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTur if ( sGotLocation == NOWHERE && pSoldier->ubBodyType != BLOODCAT ) { - sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); if ( sActionGridNo == -1 ) { @@ -1220,8 +1273,8 @@ INT8 CalcAimSkill( SOLDIERTYPE * pSoldier, UINT16 usWeapon ) bAimSkill = EffectiveMarksmanship( pSoldier ); } else - // for now use this for all other weapons - //if ( Item[ usInHand ].usItemClass == IC_BLADE ) + // for now use this for all other weapons + //if ( Item[ usInHand ].usItemClass == IC_BLADE ) { // KNIVES: modify aiming cost by avg of attacker's DEXTERITY & AGILITY bAimSkill = ( EffectiveDexterity( pSoldier ) + EffectiveAgility( pSoldier ) ) / 2; @@ -1233,22 +1286,23 @@ INT8 CalcAimSkill( SOLDIERTYPE * pSoldier, UINT16 usWeapon ) UINT8 BaseAPsToShootOrStab( INT8 bAPs, INT8 bAimSkill, OBJECTTYPE * pObj ) { INT32 Top, Bottom, rof; - // INT8 bAttachPos; +// INT8 bAttachPos; // Calculate default top & bottom of the magic "aiming" formula! // get this man's maximum possible action points (ignoring carryovers) // the 2 times is here only to allow rounding off using integer math later - //Top = 2 * bAPs;//CalcActionPoints( pSoldier ); + //Top = 2 * bAPs;//pSoldier->CalcActionPoints( ); // Shots per turn rating is for max. aimSkill(100), drops down to 1/2 at = 0 // DIVIDE BY 4 AT THE END HERE BECAUSE THE SHOTS PER TURN IS NOW QUADRUPLED! // NB need to define shots per turn for ALL Weapons then. - // 0verhaul: Do not calculate rate of fire bonus for stackable items (knives) + // 0verhaul: Do not calculate rate of fire bonus for stackable items (knives) // Their info is an array of item status, not weapon info, and they don't repeat // fire anyway. rof = Weapon[ pObj->usItem ].ubShotsPer4Turns; - if (Item[ pObj->usItem ].ubPerPocket <= 1) + //CHRISL: Resolves a problem with stackable weapons not using attachments like Reflex sight. Found by Mugsy + //if (ItemSlotLimit(pObj, STACK_SIZE_LIMIT) == 1)//NOT STACKABLE! { rof += GetRateOfFireBonus(pObj); } @@ -1256,20 +1310,21 @@ UINT8 BaseAPsToShootOrStab( INT8 bAPs, INT8 bAimSkill, OBJECTTYPE * pObj ) //Bottom = ( ( 50 + (bAimSkill / 2) ) * rof ) / 4; // add minimum aiming time to the overall minimum AP_cost - // This here ROUNDS UP fractions of 0.5 or higher using integer math - // This works because 'top' is 2x what it really should be throughout + // This here ROUNDS UP fractions of 0.5 or higher using integer math + // This works because 'top' is 2x what it really should be throughout //return( ( ( ( 100 * Top ) / Bottom ) + 1) / 2); // Snap: Refactored the formula to reduce the number of integer divisions Top = 8 * bAPs; - if (Item[ pObj->usItem ].ubPerPocket <= 1) + //CHRISL: Resolves a problem with stackable weapons not using attachments like Reflex sight. Found by Mugsy + //if (ItemSlotLimit(pObj, STACK_SIZE_LIMIT) == 1) { Top *= ( 100 - GetPercentAPReduction(pObj) ); } - else - { - Top *= 100; - } + //else + //{ + // Top *= 100; + //} Bottom = ( 100 + bAimSkill ) * rof; // (this will round to the nearest integer) return ( Top + Bottom / 2 ) / Bottom; @@ -1291,7 +1346,7 @@ void GetAPChargeForShootOrStabWRTGunRaises( SOLDIERTYPE *pSoldier, INT16 sGridNo // Given a gridno here, check if we are on a guy - if so - get his gridno if ( FindSoldier( sGridNo, &usTargID, &uiMercFlags, FIND_SOLDIER_GRIDNO ) ) { - sGridNo = MercPtrs[ usTargID ]->sGridNo; + sGridNo = MercPtrs[ usTargID ]->sGridNo; } ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier ); @@ -1299,7 +1354,7 @@ void GetAPChargeForShootOrStabWRTGunRaises( SOLDIERTYPE *pSoldier, INT16 sGridNo // Is it the same as he's facing? if ( ubDirection != pSoldier->ubDirection ) { - fAddingTurningCost = TRUE; + fAddingTurningCost = TRUE; } } } @@ -1307,8 +1362,8 @@ void GetAPChargeForShootOrStabWRTGunRaises( SOLDIERTYPE *pSoldier, INT16 sGridNo { if (ubAddTurningCost) { - // Assume we need to add cost! - fAddingTurningCost = TRUE; + // Assume we need to add cost! + fAddingTurningCost = TRUE; } } @@ -1320,13 +1375,13 @@ void GetAPChargeForShootOrStabWRTGunRaises( SOLDIERTYPE *pSoldier, INT16 sGridNo { // Do we need to ready weapon? if ( !( gAnimControl[ pSoldier->usAnimState ].uiFlags &( ANIM_FIREREADY | ANIM_FIRE ) ) ) - { + { fAddingRaiseGunCost = TRUE; } } (*pfChargeTurning) = fAddingTurningCost; - (*pfChargeRaise ) = fAddingRaiseGunCost; + (*pfChargeRaise ) = fAddingRaiseGunCost; } UINT8 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTurningCost, UINT8 ubForceRaiseGunCost) @@ -1384,7 +1439,7 @@ UINT8 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTurni if (fAddingRaiseGunCost ) { usRaiseGunCost = GetAPsToReadyWeapon( pSoldier, pSoldier->usAnimState ); - pSoldier->fDontChargeReadyAPs = FALSE; + pSoldier->flags.fDontChargeReadyAPs = FALSE; } @@ -1397,7 +1452,7 @@ UINT8 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTurni // Given a gridno here, check if we are on a guy - if so - get his gridno if ( FindSoldier( sGridNo, &usTargID, &uiMercFlags, FIND_SOLDIER_GRIDNO ) ) { - sGridNo = MercPtrs[ usTargID ]->sGridNo; + sGridNo = MercPtrs[ usTargID ]->sGridNo; } } @@ -1409,7 +1464,7 @@ UINT8 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTurni // Snap: reversed DIGICRAB's change. // bFullAPs are BASE APs, which do not include APs caried over from the previous turn. - bFullAPs = CalcActionPoints( pSoldier ); + bFullAPs = pSoldier->CalcActionPoints( ); // aim skill is the same whether we are using 1 or 2 guns bAimSkill = CalcAimSkill( pSoldier, usItem ); @@ -1417,7 +1472,7 @@ UINT8 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTurni if ( pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO ) { INT16 glItem; - OBJECTTYPE GrenadeLauncher; + OBJECTTYPE GrenadeLauncher; // look for an attached grenade launcher glItem = GetAttachedGrenadeLauncher( &(pSoldier->inv[ HANDPOS ])); @@ -1433,19 +1488,19 @@ UINT8 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTurni CreateItem( UNDER_GLAUNCHER, 100, &GrenadeLauncher ); } - bAPCost += BaseAPsToShootOrStab( bFullAPs, bAimSkill, &GrenadeLauncher ); + bAPCost += BaseAPsToShootOrStab( bFullAPs, bAimSkill, &GrenadeLauncher ); } - else if ( IsValidSecondHandShot( pSoldier ) ) + else if ( pSoldier->IsValidSecondHandShot( ) ) { - // charge the maximum of the two - bAPCost += __max( + // charge the maximum of the two + bAPCost += __max( BaseAPsToShootOrStab( bFullAPs, bAimSkill, &(pSoldier->inv[HANDPOS]) ), BaseAPsToShootOrStab( bFullAPs, bAimSkill, &(pSoldier->inv[SECONDHANDPOS]) ) ); } else { - bAPCost += BaseAPsToShootOrStab( bFullAPs, bAimSkill, &(pSoldier->inv[HANDPOS]) ); + bAPCost += BaseAPsToShootOrStab( bFullAPs, bAimSkill, &(pSoldier->inv[HANDPOS]) ); } // the minimum AP cost of ANY shot can NEVER be more than merc's maximum APs! @@ -1458,7 +1513,7 @@ UINT8 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTurni if ( Item[pSoldier->inv[HANDPOS].usItem].rocketlauncher ) { - bAPCost += GetAPsToChangeStance( pSoldier, ANIM_STAND ); + bAPCost += GetAPsToChangeStance( pSoldier, ANIM_STAND ); } @@ -1472,7 +1527,7 @@ UINT8 MinAPsToPunch(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTurningCost UINT16 usTargID; UINT8 ubDirection; - // bAimSkill = ( pSoldier->bDexterity + pSoldier->bAgility) / 2; + // bAimSkill = ( pSoldier->stats.bDexterity + pSoldier->stats.bAgility) / 2; if ( sGridNo != NOWHERE ) { usTargID = WhoIsThere2( sGridNo, pSoldier->bTargetLevel ); @@ -1533,27 +1588,27 @@ INT8 MinPtsToMove(SOLDIERTYPE *pSoldier) return( (INT8)sLowest); } - for (cnt=0; cnt < 8; cnt++) + for (cnt=0; cnt <= 8; cnt++) { sGridno = NewGridNo(pSoldier->sGridNo,DirectionInc(cnt)); if (sGridno != pSoldier->sGridNo) - { + { if ( (sCost=ActionPointCost( pSoldier, sGridno, cnt , pSoldier->usUIMovementMode ) ) < sLowest ) { - sLowest = sCost; + sLowest = sCost; } } - } + } return( (INT8)sLowest); } -INT8 PtsToMoveDirection(SOLDIERTYPE *pSoldier, INT8 bDirection ) +INT8 PtsToMoveDirection(SOLDIERTYPE *pSoldier, INT8 bDirection ) { INT16 sGridno,sCost; INT8 bOverTerrainType; UINT16 usMoveModeToUse; - sGridno = NewGridNo( pSoldier->sGridNo, DirectionInc(bDirection ) ); + sGridno = NewGridNo( pSoldier->sGridNo, DirectionInc( bDirection ) ); usMoveModeToUse = pSoldier->usUIMovementMode; @@ -1567,12 +1622,12 @@ INT8 PtsToMoveDirection(SOLDIERTYPE *pSoldier, INT8 bDirection ) sCost = ActionPointCost( pSoldier, sGridno, bDirection , usMoveModeToUse ); - if ( gubWorldMovementCosts[ sGridno ][ bDirection ][ pSoldier->bLevel ] != TRAVELCOST_FENCE ) + if ( gubWorldMovementCosts[ sGridno ][ bDirection ][ pSoldier->pathing.bLevel ] != TRAVELCOST_FENCE ) { - if ( usMoveModeToUse == RUNNING && pSoldier->usAnimState != RUNNING ) - { - sCost += AP_START_RUN_COST; - } + if ( usMoveModeToUse == RUNNING && pSoldier->usAnimState != RUNNING ) + { + sCost += AP_START_RUN_COST; + } } return( (INT8)sCost ); @@ -1584,39 +1639,39 @@ INT8 MinAPsToStartMovement( SOLDIERTYPE * pSoldier, UINT16 usMovementMode ) switch( usMovementMode ) { - case RUNNING: - case WALKING: - if (gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_PRONE) - { - bAPs += AP_CROUCH + AP_PRONE; - } - else if (gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_CROUCH) - { - bAPs += AP_CROUCH; - } - break; - case SWATTING: - if (gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_PRONE) - { - bAPs += AP_PRONE; - } - else if (gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_STAND) - { - bAPs += AP_CROUCH; - } - break; - case CRAWLING: - if (gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_STAND) - { - bAPs += AP_CROUCH + AP_PRONE; - } - else if (gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_CROUCH) - { - bAPs += AP_CROUCH; - } - break; - default: - break; + case RUNNING: + case WALKING: + if (gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_PRONE) + { + bAPs += AP_CROUCH + AP_PRONE; + } + else if (gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_CROUCH) + { + bAPs += AP_CROUCH; + } + break; + case SWATTING: + if (gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_PRONE) + { + bAPs += AP_PRONE; + } + else if (gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_STAND) + { + bAPs += AP_CROUCH; + } + break; + case CRAWLING: + if (gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_STAND) + { + bAPs += AP_CROUCH + AP_PRONE; + } + else if (gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_CROUCH) + { + bAPs += AP_CROUCH; + } + break; + default: + break; } if (usMovementMode == RUNNING && pSoldier->usAnimState != RUNNING ) @@ -1628,22 +1683,20 @@ INT8 MinAPsToStartMovement( SOLDIERTYPE * pSoldier, UINT16 usMovementMode ) BOOLEAN EnoughAmmo( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay, INT8 bInvPos ) { - if ( pSoldier->inv[ bInvPos ].usItem != NOTHING ) + if ( pSoldier->inv[ bInvPos ].exists() == true ) { if ( pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO ) { UINT16 glItem = GetAttachedGrenadeLauncher( &(pSoldier->inv[bInvPos])); - INT8 bAttachSlot = FindLaunchableAttachment( &(pSoldier->inv[bInvPos]), glItem); - if ( bAttachSlot != ITEM_NOT_FOUND ) - { + OBJECTTYPE* pAttachment = FindLaunchableAttachment( &(pSoldier->inv[bInvPos]), glItem); + if ( pAttachment ) return TRUE; - } else return FALSE; } else { - if ( Item[pSoldier->inv[ bInvPos ].usItem].singleshotrocketlauncher ) + if ( Item[pSoldier->inv[ bInvPos ].usItem].singleshotrocketlauncher ) { // hack... they turn empty afterwards anyways return( TRUE ); @@ -1651,16 +1704,16 @@ BOOLEAN EnoughAmmo( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay, INT8 bInvPos ) if (Item[ pSoldier->inv[ bInvPos ].usItem ].usItemClass == IC_LAUNCHER || Item[pSoldier->inv[ bInvPos ].usItem].cannon ) { - if ( FindAttachmentByClass( &(pSoldier->inv[ bInvPos ]), IC_GRENADE ) != ITEM_NOT_FOUND ) + if ( FindAttachmentByClass( &(pSoldier->inv[ bInvPos ]), IC_GRENADE ) != 0 ) { return( TRUE ); - } + } // ATE: Did an else if here... - if ( FindAttachmentByClass( &(pSoldier->inv[ bInvPos ]), IC_BOMB ) != ITEM_NOT_FOUND ) + if ( FindAttachmentByClass( &(pSoldier->inv[ bInvPos ]), IC_BOMB ) != 0 ) { return( TRUE ); - } + } if ( fDisplay ) { @@ -1671,7 +1724,7 @@ BOOLEAN EnoughAmmo( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay, INT8 bInvPos ) } else if (Item[ pSoldier->inv[ bInvPos ].usItem ].usItemClass == IC_GUN) { - if ( pSoldier->inv[ bInvPos ].ItemData.Gun.ubGunShotsLeft == 0 ) + if ( pSoldier->inv[ bInvPos ][0]->data.gun.ubGunShotsLeft == 0 ) { if ( fDisplay ) { @@ -1683,7 +1736,7 @@ BOOLEAN EnoughAmmo( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay, INT8 bInvPos ) // manual recharge if( pSoldier->bTeam == OUR_TEAM ) { - if ( !( pSoldier->inv[ bInvPos ].ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER ) ) + if ( !( pSoldier->inv[ bInvPos ][0]->data.gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER ) ) { return( FALSE ); } @@ -1712,7 +1765,7 @@ void DeductAmmo( SOLDIERTYPE *pSoldier, INT8 bInvPos ) } pObj = &(pSoldier->inv[ bInvPos ]); - if ( pObj->usItem != NOTHING ) + if ( pObj->exists() == true ) { if ( Item[pObj->usItem].cannon ) { @@ -1722,13 +1775,14 @@ void DeductAmmo( SOLDIERTYPE *pSoldier, INT8 bInvPos ) if ( pSoldier->usAttackingWeapon == pObj->usItem) { // OK, let's see, don't overrun... - if ( pObj->ItemData.Gun.ubGunShotsLeft != 0 ) + if ( (*pObj)[0]->data.gun.ubGunShotsLeft != 0 ) { - pObj->ItemData.Gun.ubGunShotsLeft--; + (*pObj)[0]->data.gun.ubGunShotsLeft--; //Pulmu: Update weight after firing gun to account for bullets fired - if( gGameExternalOptions.fAmmoDynamicWeight == TRUE && pObj->ItemData.Gun.ubGunShotsLeft > 0) + if( gGameExternalOptions.fAmmoDynamicWeight == TRUE) { - pSoldier->inv[HANDPOS].ubWeight = CalculateObjectWeight( &(pSoldier->inv[HANDPOS])); + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //pSoldier->inv[HANDPOS].ubWeight = CalculateObjectWeight( &(pSoldier->inv[HANDPOS])); } } } @@ -1739,42 +1793,40 @@ void DeductAmmo( SOLDIERTYPE *pSoldier, INT8 bInvPos ) } else if ( Item[ pObj->usItem ].usItemClass == IC_LAUNCHER || Item[pObj->usItem].cannon || pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO ) { - INT8 bAttachPos; - - bAttachPos = FindAttachmentByClass( pObj, IC_GRENADE ); - if (bAttachPos == ITEM_NOT_FOUND ) + OBJECTTYPE* pAttachment = FindAttachmentByClass( pObj, IC_GRENADE ); + if ( pAttachment == 0 ) { - bAttachPos = FindAttachmentByClass( pObj, IC_BOMB ); + pAttachment = FindAttachmentByClass( pObj, IC_BOMB ); } - if (bAttachPos != ITEM_NOT_FOUND) + if (pAttachment) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DeductAmmo: deducting for GL: found attachment, about to decide whether to remove it")); if ( Item[ pObj->usItem ].usItemClass == IC_LAUNCHER && GetMagSize(pObj) > 1 ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DeductAmmo: deducting for milkor")); - pObj->bAttachStatus[bAttachPos] = pObj->bAttachStatus[bAttachPos] - (INT8) ceil((double)( 100 / GetMagSize(pObj) )) ; + (*pAttachment)[0]->data.objectStatus -= (INT8) ceil((double)( 100 / GetMagSize(pObj) )) ; - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DeductAmmo: deducting for milkor: resulting status: %d, remove? = %d",pObj->bAttachStatus[bAttachPos],(pObj->bAttachStatus[bAttachPos] <= (INT8) ( 100 / Weapon[GetAttachedGrenadeLauncher(pObj)].ubMagSize )))); - if ( pObj->bAttachStatus[bAttachPos] <= (INT8) ceil((double)( 100 / GetMagSize(pObj) ) )) + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DeductAmmo: deducting for milkor: resulting status: %d, remove? = %d",(*pAttachment)[0]->data.objectStatus,((*pAttachment)[0]->data.objectStatus <= (INT8) ( 100 / Weapon[GetAttachedGrenadeLauncher(pObj)].ubMagSize )))); + if ( (*pAttachment)[0]->data.objectStatus <= (INT8) ceil((double)( 100 / GetMagSize(pObj) ) )) { - RemoveAttachment( pObj, bAttachPos, NULL ); + pObj->RemoveAttachment( pAttachment); } } else if ( (pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO ) && Weapon[GetAttachedGrenadeLauncher(pObj)].ubMagSize > 1 ) { - pObj->bAttachStatus[bAttachPos] = pObj->bAttachStatus[bAttachPos] - (INT8) ceil((double)( 100 / Weapon[GetAttachedGrenadeLauncher(pObj)].ubMagSize )) ; + (*pAttachment)[0]->data.objectStatus -= (INT8) ceil((double)( 100 / Weapon[GetAttachedGrenadeLauncher(pObj)].ubMagSize )) ; - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DeductAmmo: deducting for OICW GL: resulting status: %d, remove? = %d",pObj->bAttachStatus[bAttachPos],(pObj->bAttachStatus[bAttachPos] <= (INT8) ( 100 / Weapon[GetAttachedGrenadeLauncher(pObj)].ubMagSize )))); - if ( pObj->bAttachStatus[bAttachPos] <= (INT8) ceil((double)( 100 / Weapon[GetAttachedGrenadeLauncher(pObj)].ubMagSize ) )) + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DeductAmmo: deducting for OICW GL: resulting status: %d, remove? = %d",(*pAttachment)[0]->data.objectStatus,((*pAttachment)[0]->data.objectStatus <= (INT8) ( 100 / Weapon[GetAttachedGrenadeLauncher(pObj)].ubMagSize )))); + if ( (*pAttachment)[0]->data.objectStatus <= (INT8) ceil((double)( 100 / Weapon[GetAttachedGrenadeLauncher(pObj)].ubMagSize ) )) { - RemoveAttachment( pObj, bAttachPos, NULL ); + pObj->RemoveAttachment( pAttachment); } } else { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DeductAmmo: deducting for GL: removing attachment")); - RemoveAttachment( pObj, bAttachPos, NULL ); + pObj->RemoveAttachment( pAttachment); } } } @@ -1786,21 +1838,21 @@ void DeductAmmo( SOLDIERTYPE *pSoldier, INT8 bInvPos ) } -UINT16 GetAPsToPickupItem( SOLDIERTYPE *pSoldier, UINT16 usMapPos ) +UINT16 GetAPsToPickupItem( SOLDIERTYPE *pSoldier, INT16 sMapPos ) { ITEM_POOL *pItemPool; UINT16 sAPCost = 0; INT16 sActionGridNo; // Check if we are over an item pool - if ( GetItemPool( usMapPos, &pItemPool, pSoldier->bLevel ) ) + if ( GetItemPool( sMapPos, &pItemPool, pSoldier->pathing.bLevel ) ) { // If we are in the same tile, just return pickup cost - sActionGridNo = AdjustGridNoForItemPlacement( pSoldier, usMapPos ); + sActionGridNo = AdjustGridNoForItemPlacement( pSoldier, sMapPos ); if ( pSoldier->sGridNo != sActionGridNo ) { - sAPCost = PlotPath( pSoldier, sActionGridNo, NO_COPYROUTE, NO_PLOT, TEMPORARY, (UINT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ); + sAPCost = PlotPath( pSoldier, sActionGridNo, NO_COPYROUTE, NO_PLOT, TEMPORARY, (INT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ); // If point cost is zero, return 0 if ( sAPCost != 0 ) @@ -1811,7 +1863,7 @@ UINT16 GetAPsToPickupItem( SOLDIERTYPE *pSoldier, UINT16 usMapPos ) } else { - sAPCost += AP_PICKUP_ITEM; + sAPCost += AP_PICKUP_ITEM; } } @@ -1819,14 +1871,14 @@ UINT16 GetAPsToPickupItem( SOLDIERTYPE *pSoldier, UINT16 usMapPos ) } -UINT16 GetAPsToGiveItem( SOLDIERTYPE *pSoldier, UINT16 usMapPos ) +UINT16 GetAPsToGiveItem( SOLDIERTYPE *pSoldier, INT16 sMapPos ) { UINT16 sAPCost = 0; - sAPCost = PlotPath( pSoldier, usMapPos, NO_COPYROUTE, NO_PLOT, TEMPORARY, (UINT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ); + sAPCost = PlotPath( pSoldier, sMapPos, NO_COPYROUTE, NO_PLOT, TEMPORARY, (UINT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ); // If point cost is zero, return 0 - if ( sAPCost != 0 || pSoldier->sGridNo == usMapPos ) + if ( sAPCost != 0 || pSoldier->sGridNo == sMapPos ) { // ADD APS TO PICKUP sAPCost += AP_GIVE_ITEM; @@ -1836,7 +1888,7 @@ UINT16 GetAPsToGiveItem( SOLDIERTYPE *pSoldier, UINT16 usMapPos ) } -INT8 GetAPsToReloadGunWithAmmo( OBJECTTYPE * pGun, OBJECTTYPE * pAmmo ) +INT8 GetAPsToReloadGunWithAmmo( SOLDIERTYPE *pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo, BOOLEAN usAllAPs ) { if (Item[ pGun->usItem ].usItemClass == IC_LAUNCHER) { @@ -1844,17 +1896,39 @@ INT8 GetAPsToReloadGunWithAmmo( OBJECTTYPE * pGun, OBJECTTYPE * pAmmo ) //return( AP_RELOAD_GUN ); return GetAPsToReload(pGun); } - if ( GetMagSize(pGun) == Magazine[Item[pAmmo->usItem].ubClassIndex].ubMagSize ) + if(Weapon[pGun->usItem].swapClips == 1 && GetMagSize(pGun) == Magazine[Item[pAmmo->usItem].ubClassIndex].ubMagSize) { // normal situation - // return( AP_RELOAD_GUN ); return GetAPsToReload(pGun) ; } + else if(Weapon[pGun->usItem].swapClips == 1) + { + // wrong size ammo item + return (INT8)(GetAPsToReload(pGun) * gGameExternalOptions.ubWrongMagMult); + } else { - // trying to reload with wrong size of magazine - return (GetAPsToReload(pGun) * 2); - // return( AP_RELOAD_GUN + AP_RELOAD_GUN ); + // individually loaded guns + int reload = 0; + int rounds = __min((GetMagSize(pGun)-(*pGun)[0]->data.gun.ubGunShotsLeft), Magazine[Item[pAmmo->usItem].ubClassIndex].ubMagSize); + if(!((*pGun)[0]->data.gun.ubGunState & GS_WEAPON_BEING_RELOADED)) + reload = GetAPsToReload(pGun); + if(reload > 10) + reload = 4; + if(usAllAPs == 1) + { + for(int i = 1; i <= rounds; i++) + { + if(EnoughPoints(pSoldier,(reload + (i * gGameExternalOptions.ubAPCostPerRound)),0,FALSE) == FALSE) + { + rounds = i-1; + break; + } + } + } + else if (usAllAPs == 2) + rounds = 1; + return (reload + (rounds * gGameExternalOptions.ubAPCostPerRound)); } } @@ -1867,23 +1941,23 @@ INT8 GetAPsToAutoReload( SOLDIERTYPE * pSoldier ) CHECKF( pSoldier ); pObj = &(pSoldier->inv[HANDPOS]); - // manual recharge - if (pObj->ItemData.Gun.ubGunShotsLeft && !(pObj->ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) ) +// manual recharge + if ((*pObj)[0]->data.gun.ubGunShotsLeft && !((*pObj)[0]->data.gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) ) { return Weapon[Item[(pObj)->usItem].ubClassIndex].APsToReloadManually; } - // +// - if (Item[pObj->usItem].usItemClass == IC_GUN || Item[pObj->usItem].usItemClass == IC_LAUNCHER) + if (Item[pObj->usItem].usItemClass == IC_GUN || Item[pObj->usItem].usItemClass == IC_LAUNCHER) { bSlot = FindAmmoToReload( pSoldier, HANDPOS, NO_SLOT ); if (bSlot != NO_SLOT) { // we would reload using this ammo! - bAPCost += GetAPsToReloadGunWithAmmo( pObj, &(pSoldier->inv[bSlot] ) ); + bAPCost += GetAPsToReloadGunWithAmmo( pSoldier, pObj, &(pSoldier->inv[bSlot] ) ); } - if ( IsValidSecondHandShotForReloadingPurposes( pSoldier ) ) + if ( pSoldier->IsValidSecondHandShotForReloadingPurposes( ) ) { pObj = &(pSoldier->inv[SECONDHANDPOS]); bExcludeSlot = NO_SLOT; @@ -1912,7 +1986,7 @@ INT8 GetAPsToAutoReload( SOLDIERTYPE * pSoldier ) if (bSlot2 != NO_SLOT) { // we would reload using this ammo! - bAPCost2 = GetAPsToReloadGunWithAmmo( pObj, &(pSoldier->inv[bSlot2] ) ); + bAPCost2 = GetAPsToReloadGunWithAmmo( pSoldier, pObj, &(pSoldier->inv[bSlot2] ) ); if ( EnoughPoints( pSoldier, (INT16) (bAPCost + bAPCost2), 0, FALSE ) ) { // we can afford to reload both guns; otherwise display just for 1 gun @@ -1930,9 +2004,9 @@ INT8 GetAPsToAutoReload( SOLDIERTYPE * pSoldier ) UINT16 GetAPsToReloadRobot( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pRobot ) { UINT16 sAPCost = 0; - INT16 sActionGridNo; - UINT8 ubDirection; - INT16 sAdjustedGridNo; + INT16 sActionGridNo; + UINT8 ubDirection; + INT16 sAdjustedGridNo; sActionGridNo = FindAdjacentGridEx( pSoldier, pRobot->sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); @@ -2038,25 +2112,25 @@ UINT16 GetAPsToLook( SOLDIERTYPE *pSoldier ) switch( gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) { // Now change to appropriate animation - case ANIM_STAND: - return( AP_LOOK_STANDING ); - break; + case ANIM_STAND: + return( AP_LOOK_STANDING ); + break; - case ANIM_CROUCH: - return( AP_LOOK_CROUCHED ); - break; + case ANIM_CROUCH: + return( AP_LOOK_CROUCHED ); + break; - case ANIM_PRONE: - // AP_PRONE is the AP cost to go to or from the prone stance. To turn while prone, your merc has to get up to - // crouched, turn, and then go back down. Hence you go up (AP_PRONE), turn (AP_LOOK_PRONE) and down (AP_PRONE). - return( AP_LOOK_PRONE + AP_PRONE + AP_PRONE ); - break; + case ANIM_PRONE: + // AP_PRONE is the AP cost to go to or from the prone stance. To turn while prone, your merc has to get up to + // crouched, turn, and then go back down. Hence you go up (AP_PRONE), turn (AP_LOOK_PRONE) and down (AP_PRONE). + return( AP_LOOK_PRONE + AP_PRONE + AP_PRONE ); + break; // no other values should be possible - default: - Assert( FALSE ); - return(0); - break; + default: + Assert( FALSE ); + return(0); + break; } } @@ -2076,16 +2150,16 @@ BOOLEAN CheckForMercContMove( SOLDIERTYPE *pSoldier ) return( FALSE ); } - if( pSoldier->bLife >= OKLIFE ) + if( pSoldier->stats.bLife >= OKLIFE ) { - if( pSoldier->sGridNo != pSoldier->sFinalDestination || pSoldier->bGoodContPath ) + if( pSoldier->sGridNo != pSoldier->pathing.sFinalDestination || pSoldier->bGoodContPath ) { // OK< check if we are the selected guy! if ( pSoldier->ubID == gusSelectedSoldier ) { if (SoldierOnScreen( pSoldier->ubID ) ) { - sGridNo = pSoldier->sFinalDestination; + sGridNo = pSoldier->pathing.sFinalDestination; if ( pSoldier->bGoodContPath ) { @@ -2095,14 +2169,14 @@ BOOLEAN CheckForMercContMove( SOLDIERTYPE *pSoldier ) // Do a check if we can afford move here! // get a path to dest... - if ( FindBestPath( pSoldier, sGridNo, pSoldier->bLevel, pSoldier->usUIMovementMode, NO_COPYROUTE, 0 ) ) + if ( FindBestPath( pSoldier, sGridNo, pSoldier->pathing.bLevel, pSoldier->usUIMovementMode, NO_COPYROUTE, 0 ) ) { sAPCost = PtsToMoveDirection( pSoldier, (UINT8)guiPathingData[ 0 ] ); if ( EnoughPoints( pSoldier, sAPCost, 0 , FALSE ) ) { return( TRUE ); - } + } } else { @@ -2126,9 +2200,9 @@ INT16 GetAPsToReadyWeapon( SOLDIERTYPE *pSoldier, UINT16 usAnimState ) // ATE: What was I thinking, hooking into animations like this.... //if ( usAnimState == READY_DUAL_STAND || usAnimState == READY_DUAL_CROUCH ) //{ - //return( AP_READY_DUAL ); + //return( AP_READY_DUAL ); //} - if ( IsValidSecondHandShot( pSoldier ) ) + if ( pSoldier->IsValidSecondHandShot( ) ) { //Madd: return the greater of the two weapons + 1: UINT8 rt1, rt2; @@ -2150,9 +2224,14 @@ INT16 GetAPsToReadyWeapon( SOLDIERTYPE *pSoldier, UINT16 usAnimState ) // CHECK FOR RIFLE if ( Item[ usItem ].usItemClass == IC_GUN ) { - return ( Weapon[ usItem ].ubReadyTime - * ( 100 - GetPercentReadyTimeAPReduction(&pSoldier->inv[ HANDPOS ]) ) ) / 100; - + //ADB if 0, which it normally is, avoid the function call and division + if (Weapon[ usItem ].ubReadyTime == 0) { + return 0; + } + else { + return ( Weapon[ usItem ].ubReadyTime + * ( 100 - GetPercentReadyTimeAPReduction(&pSoldier->inv[ HANDPOS ]) ) ) / 100; + } } } @@ -2191,19 +2270,19 @@ INT16 GetBPsToClimbRoof( SOLDIERTYPE *pSoldier, BOOLEAN fClimbDown ) INT8 GetAPsToCutFence( SOLDIERTYPE *pSoldier ) { // OK, it's normally just cost, but add some if different stance... - return( GetAPsToChangeStance( pSoldier, ANIM_CROUCH ) + AP_USEWIRECUTTERS ); + return( GetAPsToChangeStance( pSoldier, ANIM_CROUCH ) + AP_USEWIRECUTTERS ); } INT8 GetAPsToBeginFirstAid( SOLDIERTYPE *pSoldier ) { // OK, it's normally just cost, but add some if different stance... - return( GetAPsToChangeStance( pSoldier, ANIM_CROUCH ) + AP_START_FIRST_AID ); + return( GetAPsToChangeStance( pSoldier, ANIM_CROUCH ) + AP_START_FIRST_AID ); } INT8 GetAPsToBeginRepair( SOLDIERTYPE *pSoldier ) { // OK, it's normally just cost, but add some if different stance... - return( GetAPsToChangeStance( pSoldier, ANIM_CROUCH ) + AP_START_REPAIR ); + return( GetAPsToChangeStance( pSoldier, ANIM_CROUCH ) + AP_START_REPAIR ); } INT8 GetAPsToRefuelVehicle( SOLDIERTYPE *pSoldier ) @@ -2213,9 +2292,9 @@ INT8 GetAPsToRefuelVehicle( SOLDIERTYPE *pSoldier ) } -#define TOSSES_PER_10TURNS 18 // max # of grenades tossable in 10 turns -#define AP_MIN_AIM_ATTACK 0 // minimum permitted extra aiming -#define AP_MAX_AIM_ATTACK 4 // maximum permitted extra aiming +#define TOSSES_PER_10TURNS 18 // max # of grenades tossable in 10 turns +#define AP_MIN_AIM_ATTACK 0 // minimum permitted extra aiming +#define AP_MAX_AIM_ATTACK 4 // maximum permitted extra aiming INT16 MinAPsToThrow( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTurningCost ) @@ -2264,7 +2343,7 @@ INT16 MinAPsToThrow( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTurningCos // Is it the same as he's facing? if ( ubDirection != pSoldier->ubDirection ) { - //Lalien: disabled it again + //Lalien: disabled it again //AXP 25.03.2007: Reenabled look cost //iAPCost += GetAPsToLook( pSoldier ); } @@ -2289,7 +2368,7 @@ INT16 MinAPsToThrow( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTurningCos // Calculate default top & bottom of the magic "aiming" formula) // get this man's maximum possible action points (ignoring carryovers) - iFullAPs = CalcActionPoints( pSoldier ); + iFullAPs = pSoldier->CalcActionPoints( ); // the 2 times is here only to around rounding off using integer math later iTop = 2 * iFullAPs; @@ -2299,12 +2378,12 @@ INT16 MinAPsToThrow( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTurningCos // tosses per turn is for max dexterity, drops down to 1/2 at dexterity = 0 // bottom = (TOSSES_PER_10TURNS * (50 + (ptr->dexterity / 2)) / 10); //else - iBottom = ( TOSSES_PER_10TURNS * (50 + ( pSoldier->bDexterity / 2 ) ) / 10 ); + iBottom = ( TOSSES_PER_10TURNS * (50 + ( pSoldier->stats.bDexterity / 2 ) ) / 10 ); // add minimum aiming time to the overall minimum AP_cost - // This here ROUNDS UP fractions of 0.5 or higher using integer math - // This works because 'top' is 2x what it really should be throughout + // This here ROUNDS UP fractions of 0.5 or higher using integer math + // This works because 'top' is 2x what it really should be throughout iAPCost += ( ( ( 100 * iTop ) / iBottom) + 1) / 2; @@ -2336,7 +2415,7 @@ UINT16 GetTotalAPsToDropBomb( SOLDIERTYPE *pSoldier, INT16 sGridNo ) sAPs += AP_DROP_BOMB; } - return( sAPs ); + return( sAPs ); } @@ -2347,13 +2426,13 @@ UINT16 GetAPsToUseRemote( SOLDIERTYPE *pSoldier ) } -INT8 GetAPsToStealItem( SOLDIERTYPE *pSoldier, INT16 usMapPos ) +INT8 GetAPsToStealItem( SOLDIERTYPE *pSoldier, INT16 sMapPos ) { UINT16 sAPCost = 0; - if (usMapPos != -1) + if (sMapPos != -1) { - sAPCost = PlotPath( pSoldier, usMapPos, NO_COPYROUTE, NO_PLOT, TEMPORARY, (UINT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ); + sAPCost = PlotPath( pSoldier, sMapPos, NO_COPYROUTE, NO_PLOT, TEMPORARY, (UINT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ); } // ADD APS TO PICKUP @@ -2375,11 +2454,11 @@ INT8 GetBPsToStealItem( SOLDIERTYPE *pSoldier ) } -INT8 GetAPsToUseJar( SOLDIERTYPE *pSoldier, INT16 usMapPos ) +INT8 GetAPsToUseJar( SOLDIERTYPE *pSoldier, INT16 sMapPos ) { UINT16 sAPCost = 0; - sAPCost = PlotPath( pSoldier, usMapPos, NO_COPYROUTE, NO_PLOT, TEMPORARY, (UINT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ); + sAPCost = PlotPath( pSoldier, sMapPos, NO_COPYROUTE, NO_PLOT, TEMPORARY, (UINT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ); // If point cost is zero, return 0 if ( sAPCost != 0 ) @@ -2392,11 +2471,11 @@ INT8 GetAPsToUseJar( SOLDIERTYPE *pSoldier, INT16 usMapPos ) } -INT8 GetAPsToUseCan( SOLDIERTYPE *pSoldier, INT16 usMapPos ) +INT8 GetAPsToUseCan( SOLDIERTYPE *pSoldier, INT16 sMapPos ) { UINT16 sAPCost = 0; - sAPCost = PlotPath( pSoldier, usMapPos, NO_COPYROUTE, NO_PLOT, TEMPORARY, (UINT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ); + sAPCost = PlotPath( pSoldier, sMapPos, NO_COPYROUTE, NO_PLOT, TEMPORARY, (UINT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ); // If point cost is zero, return 0 if ( sAPCost != 0 ) @@ -2412,5 +2491,5 @@ INT8 GetAPsToUseCan( SOLDIERTYPE *pSoldier, INT16 usMapPos ) INT8 GetAPsToJumpOver( SOLDIERTYPE *pSoldier ) { - return( GetAPsToChangeStance( pSoldier, ANIM_STAND ) + AP_JUMP_OVER ); + return( GetAPsToChangeStance( pSoldier, ANIM_STAND ) + AP_JUMP_OVER ); } diff --git a/Tactical/Points.h b/Tactical/Points.h index 2985c542..a655f660 100644 --- a/Tactical/Points.h +++ b/Tactical/Points.h @@ -1,16 +1,16 @@ #ifndef __POINTS_H_ #define __POINTS_H_ -#define AP_MINIMUM 10 // no merc can have less for his turn -#define AP_MAXIMUM 25 // no merc can have more for his turn -#define AP_MONSTER_MAXIMUM 40 // no monster can have more for his turn -#define AP_VEHICLE_MAXIMUM 50 // no merc can have more for his turn -#define AP_INCREASE 10 // optional across-the-board AP boost -#define MAX_AP_CARRIED 5 // APs carried from turn-to-turn +#define AP_MINIMUM 10 // no merc can have less for his turn +#define AP_MAXIMUM 25 // no merc can have more for his turn +#define AP_MONSTER_MAXIMUM 40 // no monster can have more for his turn +#define AP_VEHICLE_MAXIMUM 50 // no merc can have more for his turn +#define AP_INCREASE 10 // optional across-the-board AP boost +#define MAX_AP_CARRIED 5 // APs carried from turn-to-turn // monster AP bonuses, expressed in 10ths (12 = 120% normal) -#define AP_YOUNG_MONST_FACTOR 15 -#define AP_ADULT_MONST_FACTOR 12 +#define AP_YOUNG_MONST_FACTOR 15 +#define AP_ADULT_MONST_FACTOR 12 #define AP_MONST_FRENZY_FACTOR 13 // AP penalty for a phobia situation (again, in 10ths) @@ -20,8 +20,8 @@ #define AP_EXCHANGE_PLACES 5 // Action Point values -#define AP_REVERSE_MODIFIER 1 -#define AP_STEALTH_MODIFIER 2 +#define AP_REVERSE_MODIFIER 1 +#define AP_STEALTH_MODIFIER 2 #define AP_STEAL_ITEM 14 // APs to steal item.... @@ -29,78 +29,78 @@ #define AP_TALK 6 -#define AP_MOVEMENT_FLAT 3 // div by 2 for run, +2, for crawl, -1 for swat -#define AP_MOVEMENT_GRASS 4 -#define AP_MOVEMENT_BUSH 5 -#define AP_MOVEMENT_RUBBLE 6 -#define AP_MOVEMENT_SHORE 7 // shallow wade +#define AP_MOVEMENT_FLAT 3 // div by 2 for run, +2, for crawl, -1 for swat +#define AP_MOVEMENT_GRASS 4 +#define AP_MOVEMENT_BUSH 5 +#define AP_MOVEMENT_RUBBLE 6 +#define AP_MOVEMENT_SHORE 7 // shallow wade -#define AP_MOVEMENT_LAKE 9 // deep wade -> slowest -#define AP_MOVEMENT_OCEAN 8 // swimming is faster than deep wade +#define AP_MOVEMENT_LAKE 9 // deep wade->slowest +#define AP_MOVEMENT_OCEAN 8 // swimming is faster than deep wade -#define AP_CHANGE_FACING 1 // turning to face any other direction -#define AP_CHANGE_TARGET 1 // aiming at a new target +#define AP_CHANGE_FACING 1 // turning to face any other direction +#define AP_CHANGE_TARGET 1 // aiming at a new target #define AP_CATCH_ITEM 5 // turn to catch item #define AP_TOSS_ITEM 8 // toss item from inv -#define AP_REFUEL_VEHICLE 10 +#define AP_REFUEL_VEHICLE 10 /* -#define AP_MOVE_ITEM_FREE 0 // same place, pocket->pocket -#define AP_MOVE_ITEM_FAST 2 // hand, holster, ground only -#define AP_MOVE_ITEM_AVG 4 // everything else! -#define AP_MOVE_ITEM_SLOW 6 // vests, protective gear +#define AP_MOVE_ITEM_FREE 0 // same place, pocket->pocket +#define AP_MOVE_ITEM_FAST 2 // hand, holster, ground only +#define AP_MOVE_ITEM_AVG 4 // everything else! +#define AP_MOVE_ITEM_SLOW 6 // vests, protective gear */ -#define AP_MOVE_ITEM_FAST 4 // hand, holster, ground only -#define AP_MOVE_ITEM_SLOW 6 // vests, protective gear +#define AP_MOVE_ITEM_FAST 4 // hand, holster, ground only +#define AP_MOVE_ITEM_SLOW 6 // vests, protective gear -#define AP_RADIO 5 -#define AP_CROUCH 2 -#define AP_PRONE 2 +#define AP_RADIO 5 +#define AP_CROUCH 2 +#define AP_PRONE 2 #define AP_LOOK_STANDING 1 #define AP_LOOK_CROUCHED 2 #define AP_LOOK_PRONE 2 -#define AP_READY_KNIFE 0 -#define AP_READY_PISTOL 1 -#define AP_READY_RIFLE 2 -#define AP_READY_SAW 0 +#define AP_READY_KNIFE 0 +#define AP_READY_PISTOL 1 +#define AP_READY_RIFLE 2 +#define AP_READY_SAW 0 // JA2Gold: reduced dual AP cost from 3 to 1 -//#define AP_READY_DUAL 3 -#define AP_READY_DUAL 1 +//#define AP_READY_DUAL 3 +#define AP_READY_DUAL 1 -#define AP_MIN_AIM_ATTACK 0 // minimum permitted extra aiming -#define AP_MAX_AIM_ATTACK 4 // maximum permitted extra aiming +#define AP_MIN_AIM_ATTACK 0 // minimum permitted extra aiming +#define AP_MAX_AIM_ATTACK 4 // maximum permitted extra aiming #define AP_BURST 5 #define AP_DROP_BOMB 3 -#define AP_RELOAD_GUN 5 // loading new clip/magazine +#define AP_RELOAD_GUN 5 // loading new clip/magazine -#define AP_START_FIRST_AID 5 // get the stuff out of medic kit -#define AP_PER_HP_FIRST_AID 1 // for each point healed -#define AP_STOP_FIRST_AID 3 // put everything away again +#define AP_START_FIRST_AID 5 // get the stuff out of medic kit +#define AP_PER_HP_FIRST_AID 1 // for each point healed +#define AP_STOP_FIRST_AID 3 // put everything away again -#define AP_START_REPAIR 5 // get the stuff out of repair kit +#define AP_START_REPAIR 5 // get the stuff out of repair kit -#define AP_GET_HIT 2 // struck by bullet, knife, explosion -#define AP_GET_WOUNDED_DIVISOR 4 // 1 AP lost for every 'divisor' dmg -#define AP_FALL_DOWN 4 // falling down (explosion, exhaustion) -#define AP_GET_THROWN 2 // get thrown back (by explosion) +#define AP_GET_HIT 2 // struck by bullet, knife, explosion +#define AP_GET_WOUNDED_DIVISOR 4 // 1 AP lost for every 'divisor' dmg +#define AP_FALL_DOWN 4 // falling down (explosion, exhaustion) +#define AP_GET_THROWN 2 // get thrown back (by explosion) -#define AP_GET_UP 5 // getting up again -#define AP_ROLL_OVER 2 // flipping from back to stomach +#define AP_GET_UP 5 // getting up again +#define AP_ROLL_OVER 2 // flipping from back to stomach -#define AP_OPEN_DOOR 3 // whether successful, or not (locked) -#define AP_PICKLOCK 10 // should really be several turns -#define AP_EXAMINE_DOOR 5 // time to examine door -#define AP_BOOT_DOOR 8 // time to boot door -#define AP_USE_CROWBAR 10 // time to crowbar door -#define AP_UNLOCK_DOOR 6 // time to unlock door -#define AP_LOCK_DOOR 6 // time to lock door +#define AP_OPEN_DOOR 3 // whether successful, or not (locked) +#define AP_PICKLOCK 10 // should really be several turns +#define AP_EXAMINE_DOOR 5 // time to examine door +#define AP_BOOT_DOOR 8 // time to boot door +#define AP_USE_CROWBAR 10 // time to crowbar door +#define AP_UNLOCK_DOOR 6 // time to unlock door +#define AP_LOCK_DOOR 6 // time to lock door #define AP_EXPLODE_DOOR 10 // time to set explode charge on door #define AP_UNTRAP_DOOR 10 // time to untrap door @@ -109,37 +109,38 @@ #define AP_CLIMBROOF 10 // APs to climb roof #define AP_CLIMBOFFROOF 6 // APs to climb off roof #define AP_JUMPFENCE 6 // time to jump over a fence +#define AP_JUMPFENCEBPACK 10 // time to jump over a fence -#define AP_OPEN_SAFE 8 // time to use combination +#define AP_OPEN_SAFE 8 // time to use combination #define AP_USE_REMOTE 2 -#define AP_PULL_TRIGGER 2 // operate nearby panic trigger +#define AP_PULL_TRIGGER 2 // operate nearby panic trigger -#define AP_FORCE_LID_OPEN 10 -#define AP_SEARCH_CONTAINER 5 // boxes, crates, safe, etc. +#define AP_FORCE_LID_OPEN 10 +#define AP_SEARCH_CONTAINER 5 // boxes, crates, safe, etc. -#define AP_READ_NOTE 10 // reading a note's contents in inv. +#define AP_READ_NOTE 10 // reading a note's contents in inv. -#define AP_SNAKE_BATTLE 10 // when first attacked -#define AP_KILL_SNAKE 7 // when snake battle's been won +#define AP_SNAKE_BATTLE 10 // when first attacked +#define AP_KILL_SNAKE 7 // when snake battle's been won -#define AP_USE_SURV_CAM 5 +#define AP_USE_SURV_CAM 5 #define AP_PICKUP_ITEM 3 #define AP_GIVE_ITEM 1 -#define AP_BURY_MINE 10 -#define AP_DISARM_MINE 10 +#define AP_BURY_MINE 10 +#define AP_DISARM_MINE 10 -#define AP_DRINK 5 -#define AP_CAMOFLAGE 10 +#define AP_DRINK 5 +#define AP_CAMOFLAGE 10 -#define AP_TAKE_PHOTOGRAPH 5 -#define AP_MERGE 8 +#define AP_TAKE_PHOTOGRAPH 5 +#define AP_MERGE 8 -#define AP_OTHER_COST 99 +#define AP_OTHER_COST 99 #define AP_START_RUN_COST 1 @@ -151,84 +152,85 @@ #define BP_RATIO_RED_PTS_TO_NORMAL 100 -#define BP_RUN_ENERGYCOSTFACTOR 3 // Richard thinks running is 3rd most strenous over time... tough, Mark didn't. CJC increased it again +#define BP_RUN_ENERGYCOSTFACTOR 3 // Richard thinks running is 3rd most strenous over time... tough, Mark didn't. CJC increased it again #define BP_WALK_ENERGYCOSTFACTOR 1 // walking subtracts flat terrain breath value #define BP_SWAT_ENERGYCOSTFACTOR 2 // Richard thinks swatmove is 2nd most strenous over time... tough, Mark didn't #define BP_CRAWL_ENERGYCOSTFACTOR 4 // Richard thinks crawling is the MOST strenuous over time -#define BP_RADIO 0 // no breath cost -#define BP_USE_DETONATOR 0 // no breath cost +#define BP_RADIO 0 // no breath cost +#define BP_USE_DETONATOR 0 // no breath cost -#define BP_REVERSE_MODIFIER 0 // no change, a bit more challenging -#define BP_STEALTH_MODIFIER -20 // slow & cautious, not too strenuous -#define BP_MINING_MODIFIER -30 // pretty relaxing, overall +#define BP_REVERSE_MODIFIER 0 // no change, a bit more challenging +#define BP_STEALTH_MODIFIER -20 // slow & cautious, not too strenuous +#define BP_MINING_MODIFIER -30 // pretty relaxing, overall // end-of-turn Breath Point gain/usage rates -#define BP_PER_AP_NO_EFFORT -200 // gain breath! -#define BP_PER_AP_MIN_EFFORT -100 // gain breath! -#define BP_PER_AP_LT_EFFORT -50 // gain breath! -#define BP_PER_AP_MOD_EFFORT 25 -#define BP_PER_AP_HVY_EFFORT 50 -#define BP_PER_AP_MAX_EFFORT 100 +#define BP_PER_AP_NO_EFFORT -200 // gain breath! +#define BP_PER_AP_MIN_EFFORT -100 // gain breath! +#define BP_PER_AP_LT_EFFORT -50 // gain breath! +#define BP_PER_AP_MOD_EFFORT 25 +#define BP_PER_AP_HVY_EFFORT 50 +#define BP_PER_AP_MAX_EFFORT 100 // Breath Point values -#define BP_MOVEMENT_FLAT 5 -#define BP_MOVEMENT_GRASS 10 -#define BP_MOVEMENT_BUSH 20 -#define BP_MOVEMENT_RUBBLE 35 -#define BP_MOVEMENT_SHORE 50 // shallow wade -#define BP_MOVEMENT_LAKE 75 // deep wade -#define BP_MOVEMENT_OCEAN 100 // swimming +#define BP_MOVEMENT_FLAT 5 +#define BP_MOVEMENT_GRASS 10 +#define BP_MOVEMENT_BUSH 20 +#define BP_MOVEMENT_RUBBLE 35 +#define BP_MOVEMENT_SHORE 50 // shallow wade +#define BP_MOVEMENT_LAKE 75 // deep wade +#define BP_MOVEMENT_OCEAN 100 // swimming -#define BP_CHANGE_FACING 10 // turning to face another direction +#define BP_CHANGE_FACING 10 // turning to face another direction -#define BP_CROUCH 10 -#define BP_PRONE 10 +#define BP_CROUCH 10 +#define BP_PRONE 10 #define BP_CLIMBROOF 500 // BPs to climb roof #define BP_CLIMBOFFROOF 250 // BPs to climb off roof #define BP_JUMPFENCE 200 // BPs to jump fence +#define BP_JUMPFENCEBPACK 500 // BPs to jump fence /* -#define BP_MOVE_ITEM_FREE 0 // same place, pocket->pocket -#define BP_MOVE_ITEM_FAST 0 // hand, holster, ground only -#define BP_MOVE_ITEM_AVG 0 // everything else! -#define BP_MOVE_ITEM_SLOW 20 // vests, protective gear +#define BP_MOVE_ITEM_FREE 0 // same place, pocket->pocket +#define BP_MOVE_ITEM_FAST 0 // hand, holster, ground only +#define BP_MOVE_ITEM_AVG 0 // everything else! +#define BP_MOVE_ITEM_SLOW 20 // vests, protective gear */ -#define BP_MOVE_ITEM_FAST 0 // hand, holster, ground only -#define BP_MOVE_ITEM_SLOW 20 // vests, protective gear +#define BP_MOVE_ITEM_FAST 0 // hand, holster, ground only +#define BP_MOVE_ITEM_SLOW 20 // vests, protective gear -#define BP_READY_KNIFE 0 // raise/lower knife -#define BP_READY_PISTOL 10 // raise/lower pistol -#define BP_READY_RIFLE 20 // raise/lower rifle -#define BP_READY_SAW 0 // raise/lower saw +#define BP_READY_KNIFE 0 // raise/lower knife +#define BP_READY_PISTOL 10 // raise/lower pistol +#define BP_READY_RIFLE 20 // raise/lower rifle +#define BP_READY_SAW 0 // raise/lower saw -#define BP_STEAL_ITEM 50 // BPs steal item +#define BP_STEAL_ITEM 50 // BPs steal item -#define BP_PER_AP_AIMING 5 // breath cost while aiming -#define BP_RELOAD_GUN 20 // loading new clip/magazine +#define BP_PER_AP_AIMING 5 // breath cost while aiming +#define BP_RELOAD_GUN 20 // loading new clip/magazine -#define BP_THROW_ITEM 50 // throw grenades, fire-bombs, etc. +#define BP_THROW_ITEM 50 // throw grenades, fire-bombs, etc. -#define BP_START_FIRST_AID 0 // get the stuff out of medic kit -#define BP_PER_HP_FIRST_AID -25 // gain breath for each point healed -#define BP_STOP_FIRST_AID 0 // put everything away again +#define BP_START_FIRST_AID 0 // get the stuff out of medic kit +#define BP_PER_HP_FIRST_AID -25 // gain breath for each point healed +#define BP_STOP_FIRST_AID 0 // put everything away again -#define BP_GET_HIT 200 // struck by bullet, knife, explosion -#define BP_GET_WOUNDED 50 // per pt of GUNFIRE/EXPLOSION impact -#define BP_FALL_DOWN 250 // falling down (explosion, exhaustion) -#define BP_GET_UP 50 // getting up again -#define BP_ROLL_OVER 20 // flipping from back to stomach +#define BP_GET_HIT 200 // struck by bullet, knife, explosion +#define BP_GET_WOUNDED 50 // per pt of GUNFIRE/EXPLOSION impact +#define BP_FALL_DOWN 250 // falling down (explosion, exhaustion) +#define BP_GET_UP 50 // getting up again +#define BP_ROLL_OVER 20 // flipping from back to stomach -#define BP_OPEN_DOOR 30 // whether successful, or not (locked) -#define BP_PICKLOCK -250 // gain breath, not very tiring... -#define BP_EXAMINE_DOOR -250 // gain breath, not very tiring... -#define BP_BOOT_DOOR 200 // BP to boot door -#define BP_USE_CROWBAR 350 // BP to crowbar door -#define BP_UNLOCK_DOOR 50 // BP to unlock door +#define BP_OPEN_DOOR 30 // whether successful, or not (locked) +#define BP_PICKLOCK -250 // gain breath, not very tiring... +#define BP_EXAMINE_DOOR -250 // gain breath, not very tiring... +#define BP_BOOT_DOOR 200 // BP to boot door +#define BP_USE_CROWBAR 350 // BP to crowbar door +#define BP_UNLOCK_DOOR 50 // BP to unlock door #define BP_EXPLODE_DOOR -250 // BP to set explode charge on door #define BP_UNTRAP_DOOR 150 // BP to untrap #define BP_LOCK_DOOR 50 // BP to untrap @@ -236,30 +238,30 @@ #define BP_USEWIRECUTTERS 200 // BP to use wirecutters -#define BP_PULL_TRIGGER 0 // for operating panic triggers +#define BP_PULL_TRIGGER 0 // for operating panic triggers -#define BP_FORCE_LID_OPEN 50 // per point of strength required -#define BP_SEARCH_CONTAINER 0 // get some breath back (was -50) +#define BP_FORCE_LID_OPEN 50 // per point of strength required +#define BP_SEARCH_CONTAINER 0 // get some breath back (was -50) -#define BP_OPEN_SAFE -50 -#define BP_READ_NOTE -250 // reading a note's contents in inv. +#define BP_OPEN_SAFE -50 +#define BP_READ_NOTE -250 // reading a note's contents in inv. -#define BP_SNAKE_BATTLE 500 // when first attacked -#define BP_KILL_SNAKE 350 // when snake battle's been won +#define BP_SNAKE_BATTLE 500 // when first attacked +#define BP_KILL_SNAKE 350 // when snake battle's been won -#define BP_USE_SURV_CAM -100 +#define BP_USE_SURV_CAM -100 -#define BP_BURY_MINE 250 // involves digging & filling again -#define BP_DISARM_MINE 0 // 1/2 digging, 1/2 light effort +#define BP_BURY_MINE 250 // involves digging & filling again +#define BP_DISARM_MINE 0 // 1/2 digging, 1/2 light effort -#define BP_FIRE_HANDGUN 25 // preatty easy, little recoil -#define BP_FIRE_RIFLE 50 // heavier, nasty recoil -#define BP_FIRE_SHOTGUN 100 // quite tiring, must be pumped up +#define BP_FIRE_HANDGUN 25 // preatty easy, little recoil +#define BP_FIRE_RIFLE 50 // heavier, nasty recoil +#define BP_FIRE_SHOTGUN 100 // quite tiring, must be pumped up -#define BP_STAB_KNIFE 200 +#define BP_STAB_KNIFE 200 -#define BP_TAKE_PHOTOGRAPH 0 -#define BP_MERGE 50 +#define BP_TAKE_PHOTOGRAPH 0 +#define BP_MERGE 50 #define BP_FALLFROMROOF 1000 @@ -273,9 +275,9 @@ UINT8 BaseAPsToShootOrStab( INT8 bAPs, INT8 bAimSkill, OBJECTTYPE * pObj ); INT16 TerrainActionPoints( SOLDIERTYPE *pSoldier, INT16 sGridno, INT8 bDir, INT8 bLevel ); -INT16 ActionPointCost( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bDir, UINT16 usMovementMode ); +INT16 ActionPointCost( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bDir, UINT16 usMovementMode ); INT16 EstimateActionPointCost( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bDir, UINT16 usMovementMode, INT8 bPathIndex, INT8 bPathLength ); -BOOLEAN SelectedMercCanAffordMove( ); +BOOLEAN SelectedMercCanAffordMove( ); BOOLEAN EnoughPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost, BOOLEAN fDisplayMsg ); void DeductPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost, BOOLEAN fProactive = TRUE ); @@ -283,15 +285,15 @@ INT32 AdjustBreathPts(SOLDIERTYPE *pSold, INT32 iBPCost); void UnusedAPsToBreath(SOLDIERTYPE *pSold); INT16 TerrainBreathPoints(SOLDIERTYPE * pSoldier, INT16 sGridno,INT8 bDir, UINT16 usMovementMode); UINT8 MinAPsToAttack(SOLDIERTYPE *pSoldier, INT16 sGridno, UINT8 ubAddTurningCost, UINT8 ubForceRaiseGunCost = 0); -INT8 MinPtsToMove(SOLDIERTYPE *pSoldier); +INT8 MinPtsToMove(SOLDIERTYPE *pSoldier); INT8 MinAPsToStartMovement( SOLDIERTYPE * pSoldier, UINT16 usMovementMode ); -INT8 PtsToMoveDirection(SOLDIERTYPE *pSoldier, INT8 bDirection ); +INT8 PtsToMoveDirection(SOLDIERTYPE *pSoldier, INT8 bDirection ); UINT8 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT16 sGridno, UINT8 ubAddTurningCost, UINT8 ubForceRaiseGunCost = 0 ); BOOLEAN EnoughAmmo( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay, INT8 bInvPos ); void DeductAmmo( SOLDIERTYPE *pSoldier, INT8 bInvPos ); -UINT16 GetAPsToPickupItem( SOLDIERTYPE *pSoldier, UINT16 usMapPos ); +UINT16 GetAPsToPickupItem( SOLDIERTYPE *pSoldier, INT16 sMapPos ); UINT8 MinAPsToPunch(SOLDIERTYPE *pSoldier, INT16 sGridno, UINT8 ubAddTurningCost ); UINT8 CalcTotalAPsToAttack( SOLDIERTYPE *pSoldier, INT16 sGridno, UINT8 ubAddTurningCost, INT8 bAimTime ); UINT8 CalcAPsToBurst( INT8 bBaseActionPoints, OBJECTTYPE * pObj ); @@ -300,7 +302,7 @@ UINT16 GetAPsToChangeStance( SOLDIERTYPE *pSoldier, INT8 bDesiredHeight ); UINT16 GetBPsToChangeStance( SOLDIERTYPE *pSoldier, INT8 bDesiredHeight ); UINT16 GetAPsToLook( SOLDIERTYPE *pSoldier ); -UINT16 GetAPsToGiveItem( SOLDIERTYPE *pSoldier, UINT16 usMapPos ); +UINT16 GetAPsToGiveItem( SOLDIERTYPE *pSoldier, INT16 sMapPos ); BOOLEAN CheckForMercContMove( SOLDIERTYPE *pSoldier ); @@ -323,11 +325,11 @@ UINT16 GetAPsToDropBomb( SOLDIERTYPE *pSoldier ); UINT16 GetTotalAPsToDropBomb( SOLDIERTYPE *pSoldier, INT16 sGridNo ); UINT16 GetAPsToUseRemote( SOLDIERTYPE *pSoldier ); -INT8 GetAPsToStealItem( SOLDIERTYPE *pSoldier, INT16 usMapPos ); +INT8 GetAPsToStealItem( SOLDIERTYPE *pSoldier, INT16 sMapPos ); INT8 GetBPsToStealItem( SOLDIERTYPE *pSoldier ); -INT8 GetAPsToUseJar( SOLDIERTYPE *pSoldier, INT16 usMapPos ); -INT8 GetAPsToUseCan( SOLDIERTYPE *pSoldier, INT16 usMapPos ); +INT8 GetAPsToUseJar( SOLDIERTYPE *pSoldier, INT16 sMapPos ); +INT8 GetAPsToUseCan( SOLDIERTYPE *pSoldier, INT16 sMapPos ); INT8 GetBPsTouseJar( SOLDIERTYPE *pSoldier ); INT8 GetAPsToJumpOver( SOLDIERTYPE *pSoldier ); @@ -335,7 +337,7 @@ INT8 GetAPsToJumpOver( SOLDIERTYPE *pSoldier ); void GetAPChargeForShootOrStabWRTGunRaises( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTurningCost, BOOLEAN *pfChargeTurning, BOOLEAN *pfChargeRaise ); UINT16 GetAPsToReloadRobot( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pRobot ); -INT8 GetAPsToReloadGunWithAmmo( OBJECTTYPE * pGun, OBJECTTYPE * pAmmo ); +INT8 GetAPsToReloadGunWithAmmo( SOLDIERTYPE *pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo, BOOLEAN usAllAPs = TRUE ); INT8 GetAPsToAutoReload( SOLDIERTYPE * pSoldier ); diff --git a/Tactical/QARRAY.cpp b/Tactical/QARRAY.cpp index 53647399..dd97234f 100644 --- a/Tactical/QARRAY.cpp +++ b/Tactical/QARRAY.cpp @@ -8,11 +8,11 @@ BOOLEAN QuoteExp_HeadShotOnly[NUM_PROFILES] = { // this is for quote 33 (0=generic grossout, 1=headshot specific) -/* 0 Barry */ 1, -/* 1 Blood */ 1, +/* 0 Barry */ 1, +/* 1 Blood */ 1, /* 2 Lynx */ 1, -/* 3 Grizzly */ 1, -/* 4 Vicki */ 1, +/* 3 Grizzly */ 1, +/* 4 Vicki */ 1, /* 5 Trevor */ 0, /* 6 Grunty */ 1, /* 7 Ivan */ 0, @@ -67,23 +67,23 @@ BOOLEAN QuoteExp_HeadShotOnly[NUM_PROFILES] = /* 56 PGLady3 */ 0, /* 57 Miguel */ 0, // these RPC's don't have quotes written yet -/* 58 Carlos */ 0, // so this data is temporary. -/* 59 Ira */ 0, -/* 60 Dimitri */ 0, -/* 61 Devin */ 0, -/* 62 Rat */ 0, -/* 63 Madlab */ 0, -/* 64 Slay */ 0, -/* 65 Nanchuk */ 0, -/* 66 Dynamo */ 0, -/* 67 Prisoner*/ 0, -/* 68 Iggy */ 0, -/* 69 Doctor */ 0, -/* 70 MTI */ 0, -/* 71 RPC71 */ 0, -/* 72 Junkson */ 0, -/* 73 RPC73 */ 0, -/* 74 RPC74 */ 0, +/* 58 Carlos */ 0, // so this data is temporary. +/* 59 Ira */ 0, +/* 60 Dimitri */ 0, +/* 61 Devin */ 0, +/* 62 Rat */ 0, +/* 63 Madlab */ 0, +/* 64 Slay */ 0, +/* 65 Nanchuk */ 0, +/* 66 Dynamo */ 0, +/* 67 Prisoner*/ 0, +/* 68 Iggy */ 0, +/* 69 Doctor */ 0, +/* 70 MTI */ 0, +/* 71 RPC71 */ 0, +/* 72 Junkson */ 0, +/* 73 RPC73 */ 0, +/* 74 RPC74 */ 0, 0, //75 0, 0, @@ -185,11 +185,11 @@ BOOLEAN QuoteExp_HeadShotOnly[NUM_PROFILES] = BOOLEAN QuoteExp_TeamSpecific[NUM_PROFILES] = { // this is for quote 41 (0=refers to anyone, 1=team specific) -/* 0 Barry */ 1, -/* 1 Blood */ 1, +/* 0 Barry */ 1, +/* 1 Blood */ 1, /* 2 Lynx */ 1, -/* 3 Grizzly */ 1, -/* 4 Vicki */ 1, +/* 3 Grizzly */ 1, +/* 4 Vicki */ 1, /* 5 Trevor */ 1, /* 6 Grunty */ 1, /* 7 Ivan */ 0, @@ -244,23 +244,23 @@ BOOLEAN QuoteExp_TeamSpecific[NUM_PROFILES] = /* 56 PGLady3 */ 1, /* 57 Miguel */ 0, // these RPC's don't have quotes written yet -/* 58 Carlos */ 0, // so this data is temporary. -/* 59 Ira */ 0, -/* 60 Dimitri */ 0, -/* 61 Devin */ 0, -/* 62 Rat */ 0, -/* 63 Madlab */ 0, -/* 64 Slay */ 0, -/* 65 Nanchuk */ 0, -/* 66 Dynamo */ 0, -/* 67 Prisoner*/ 0, -/* 68 Iggy */ 0, -/* 69 Doctor */ 0, -/* 70 MTI */ 0, -/* 71 RPC71 */ 0, -/* 72 Junkson */ 0, -/* 73 RPC73 */ 0, -/* 74 RPC74 */ 0, +/* 58 Carlos */ 0, // so this data is temporary. +/* 59 Ira */ 0, +/* 60 Dimitri */ 0, +/* 61 Devin */ 0, +/* 62 Rat */ 0, +/* 63 Madlab */ 0, +/* 64 Slay */ 0, +/* 65 Nanchuk */ 0, +/* 66 Dynamo */ 0, +/* 67 Prisoner*/ 0, +/* 68 Iggy */ 0, +/* 69 Doctor */ 0, +/* 70 MTI */ 0, +/* 71 RPC71 */ 0, +/* 72 Junkson */ 0, +/* 73 RPC73 */ 0, +/* 74 RPC74 */ 0, 0, //75 0, 0, @@ -363,82 +363,82 @@ BOOLEAN QuoteExp_TeamSpecific[NUM_PROFILES] = BOOLEAN QuoteExp_GenderCode[NUM_PROFILES] = { // this is for quote 58 (0=male, 1=female, 2=either) -/* 0 Barry */ 0, -/* 1 Blood */ 2, -/* 2 Lynx */ 0, -/* 3 Grizzly */ 2, -/* 4 Vicki */ 2, -/* 5 Trevor */ 2, -/* 6 Grunty */ 2, -/* 7 Ivan */ 2, -/* 8 Steroid */ 0, -/* 9 Igor */ 2, -/* 10 Shadow */ 0, -/* 11 Red */ 1, -/* 12 Reaper */ 0, -/* 13 Fidel */ 2, -/* 14 Fox */ 0, -/* 15 Sidney */ 0, +/* 0 Barry */ 0, +/* 1 Blood */ 2, +/* 2 Lynx */ 0, +/* 3 Grizzly */ 2, +/* 4 Vicki */ 2, +/* 5 Trevor */ 2, +/* 6 Grunty */ 2, +/* 7 Ivan */ 2, +/* 8 Steroid */ 0, +/* 9 Igor */ 2, +/* 10 Shadow */ 0, +/* 11 Red */ 1, +/* 12 Reaper */ 0, +/* 13 Fidel */ 2, +/* 14 Fox */ 0, +/* 15 Sidney */ 0, /* 16 Gus */ 1, -/* 17 Buns */ 2, -/* 18 Ice */ 0, -/* 19 Spider */ 1, -/* 20 Cliff */ 0, -/* 21 Bull */ 2, -/* 22 Hitman */ 2, -/* 23 Buzz */ 0, -/* 24 Raider */ 2, -/* 25 Raven */ 2, -/* 26 Static */ 2, -/* 27 Len */ 2, -/* 28 Danny */ 0, -/* 29 Magic */ 2, -/* 30 Stephan */ 0, -/* 31 Scully */ 2, -/* 32 Malice */ 2, -/* 33 Dr. Q */ 0, -/* 34 Nails */ 2, -/* 35 Thor */ 2, -/* 36 Scope */ 2, -/* 37 Wolf */ 2, -/* 38 MD */ 2, -/* 39 Meltdown*/ 2, -/* 40 Biff */ 2, -/* 41 Haywire */ 0, -/* 42 Gasket */ 2, -/* 43 Razor */ 0, -/* 44 Flo */ 2, -/* 45 Gumpy */ 0, -/* 46 Larryok */ 1, -/* 47 Larryold*/ 2, -/* 48 Cougar */ 2, -/* 49 Numb */ 0, -/* 50 Bubba */ 1, -/* 51 PGmale1 */ 0, -/* 52 PGmale2 */ 2, -/* 53 PGmale3 */ 2, -/* 54 PGLady1 */ 0, -/* 55 PGLady2 */ 1, -/* 56 PGLady3 */ 2, +/* 17 Buns */ 2, +/* 18 Ice */ 0, +/* 19 Spider */ 1, +/* 20 Cliff */ 0, +/* 21 Bull */ 2, +/* 22 Hitman */ 2, +/* 23 Buzz */ 0, +/* 24 Raider */ 2, +/* 25 Raven */ 2, +/* 26 Static */ 2, +/* 27 Len */ 2, +/* 28 Danny */ 0, +/* 29 Magic */ 2, +/* 30 Stephan */ 0, +/* 31 Scully */ 2, +/* 32 Malice */ 2, +/* 33 Dr. Q */ 0, +/* 34 Nails */ 2, +/* 35 Thor */ 2, +/* 36 Scope */ 2, +/* 37 Wolf */ 2, +/* 38 MD */ 2, +/* 39 Meltdown*/ 2, +/* 40 Biff */ 2, +/* 41 Haywire */ 0, +/* 42 Gasket */ 2, +/* 43 Razor */ 0, +/* 44 Flo */ 2, +/* 45 Gumpy */ 0, +/* 46 Larryok */ 1, +/* 47 Larryold*/ 2, +/* 48 Cougar */ 2, +/* 49 Numb */ 0, +/* 50 Bubba */ 1, +/* 51 PGmale1 */ 0, +/* 52 PGmale2 */ 2, +/* 53 PGmale3 */ 2, +/* 54 PGLady1 */ 0, +/* 55 PGLady2 */ 1, +/* 56 PGLady3 */ 2, /* 57 Miguel */ 0, // these RPC's don't have quotes written yet -/* 58 Carlos */ 0, // so this data is temporary. -/* 59 Ira */ 0, -/* 60 Dimitri */ 0, -/* 61 Devin */ 0, -/* 62 Rat */ 0, -/* 63 Madlab */ 0, -/* 64 Slay */ 0, -/* 65 Nanchuk */ 0, -/* 66 Dynamo */ 0, -/* 67 Prisoner*/ 0, -/* 68 Iggy */ 0, -/* 69 Doctor */ 0, -/* 70 MTI */ 0, -/* 71 RPC71 */ 0, -/* 72 Junkson */ 0, -/* 73 RPC73 */ 0, -/* 74 RPC74 */ 0, +/* 58 Carlos */ 0, // so this data is temporary. +/* 59 Ira */ 0, +/* 60 Dimitri */ 0, +/* 61 Devin */ 0, +/* 62 Rat */ 0, +/* 63 Madlab */ 0, +/* 64 Slay */ 0, +/* 65 Nanchuk */ 0, +/* 66 Dynamo */ 0, +/* 67 Prisoner*/ 0, +/* 68 Iggy */ 0, +/* 69 Doctor */ 0, +/* 70 MTI */ 0, +/* 71 RPC71 */ 0, +/* 72 Junkson */ 0, +/* 73 RPC73 */ 0, +/* 74 RPC74 */ 0, 0, //75 0, 0, @@ -542,81 +542,81 @@ BOOLEAN QuoteExp_GotGunOrUsedGun[NUM_PROFILES] = { // this is to indicate whether they have quote 61 or 62 /* 0 Barry */ 62, -/* 1 Blood */ 62, -/* 2 Lynx */ 62, -/* 3 Grizzly */ 62, -/* 4 Vicki */ 61, -/* 5 Trevor */ 61, -/* 6 Grunty */ 61, -/* 7 Ivan */ 61, -/* 8 Steroid */ 61, -/* 9 Igor */ 62, -/* 10 Shadow */ 62, -/* 11 Red */ 61, -/* 12 Reaper */ 61, -/* 13 Fidel */ 62, -/* 14 Fox */ 61, -/* 15 Sidney */ 62, -/* 16 Gus */ 62, -/* 17 Buns */ 62, -/* 18 Ice */ 62, -/* 19 Spider */ 61, -/* 20 Cliff */ 62, -/* 21 Bull */ 62, -/* 22 Hitman */ 61, -/* 23 Buzz */ 62, -/* 24 Raider */ 62, -/* 25 Raven */ 62, -/* 26 Static */ 62, -/* 27 Len */ 62, -/* 28 Danny */ 61, -/* 29 Magic */ 62, -/* 30 Stephan */ 62, -/* 31 Scully */ 62, -/* 32 Malice */ 62, -/* 33 Dr. Q */ 62, -/* 34 Nails */ 62, -/* 35 Thor */ 61, -/* 36 Scope */ 61, -/* 37 Wolf */ 62, -/* 38 MD */ 61, -/* 39 Meltdown*/ 62, -/* 40 Biff */ 61, -/* 41 Haywire */ 62, -/* 42 Gasket */ 61, -/* 43 Razor */ 61, -/* 44 Flo */ 62, -/* 45 Gumpy */ 62, -/* 46 Larryok */ 61, -/* 47 Larryold*/ 61, -/* 48 Cougar */ 62, -/* 49 Numb */ 61, -/* 50 Bubba */ 62, -/* 51 PGmale1 */ 62, -/* 52 PGmale2 */ 62, -/* 53 PGmale3 */ 61, -/* 54 PGLady1 */ 61, -/* 55 PGLady2 */ 61, -/* 56 PGLady3 */ 62, +/* 1 Blood */ 62, +/* 2 Lynx */ 62, +/* 3 Grizzly */ 62, +/* 4 Vicki */ 61, +/* 5 Trevor */ 61, +/* 6 Grunty */ 61, +/* 7 Ivan */ 61, +/* 8 Steroid */ 61, +/* 9 Igor */ 62, +/* 10 Shadow */ 62, +/* 11 Red */ 61, +/* 12 Reaper */ 61, +/* 13 Fidel */ 62, +/* 14 Fox */ 61, +/* 15 Sidney */ 62, +/* 16 Gus */ 62, +/* 17 Buns */ 62, +/* 18 Ice */ 62, +/* 19 Spider */ 61, +/* 20 Cliff */ 62, +/* 21 Bull */ 62, +/* 22 Hitman */ 61, +/* 23 Buzz */ 62, +/* 24 Raider */ 62, +/* 25 Raven */ 62, +/* 26 Static */ 62, +/* 27 Len */ 62, +/* 28 Danny */ 61, +/* 29 Magic */ 62, +/* 30 Stephan */ 62, +/* 31 Scully */ 62, +/* 32 Malice */ 62, +/* 33 Dr. Q */ 62, +/* 34 Nails */ 62, +/* 35 Thor */ 61, +/* 36 Scope */ 61, +/* 37 Wolf */ 62, +/* 38 MD */ 61, +/* 39 Meltdown*/ 62, +/* 40 Biff */ 61, +/* 41 Haywire */ 62, +/* 42 Gasket */ 61, +/* 43 Razor */ 61, +/* 44 Flo */ 62, +/* 45 Gumpy */ 62, +/* 46 Larryok */ 61, +/* 47 Larryold*/ 61, +/* 48 Cougar */ 62, +/* 49 Numb */ 61, +/* 50 Bubba */ 62, +/* 51 PGmale1 */ 62, +/* 52 PGmale2 */ 62, +/* 53 PGmale3 */ 61, +/* 54 PGLady1 */ 61, +/* 55 PGLady2 */ 61, +/* 56 PGLady3 */ 62, -/* 57 Miguel */ 62, -/* 58 Carlos */ 61, -/* 59 Ira */ 62, -/* 60 Dimitri */ 61, -/* 61 Devin */ 0 , -/* 62 Rat */ 0 , -/* 63 Madlab */ 0 , -/* 64 Slay */ 0 , -/* 65 Nanchuk */ 0 , -/* 66 Dynamo */ 62, -/* 67 Shank */ 61, -/* 68 Iggy */ 0 , -/* 69 Doctor */ 0 , -/* 70 MTI */ 0 , -/* 71 RPC71 */ 0 , -/* 72 Junkson */ 0 , -/* 73 RPC73 */ 0 , -/* 74 RPC74 */ 0, +/* 57 Miguel */ 62, +/* 58 Carlos */ 61, +/* 59 Ira */ 62, +/* 60 Dimitri */ 61, +/* 61 Devin */ 0 , +/* 62 Rat */ 0 , +/* 63 Madlab */ 0 , +/* 64 Slay */ 0 , +/* 65 Nanchuk */ 0 , +/* 66 Dynamo */ 62, +/* 67 Shank */ 61, +/* 68 Iggy */ 0 , +/* 69 Doctor */ 0 , +/* 70 MTI */ 0 , +/* 71 RPC71 */ 0 , +/* 72 Junkson */ 0 , +/* 73 RPC73 */ 0 , +/* 74 RPC74 */ 0, 0, //75 0, 0, @@ -720,81 +720,81 @@ BOOLEAN QuoteExp_PassingDislike[NUM_PROFILES] = { // this is to indicate what kind of quote 45 (if any) mercs have /* 0 Barry */ 2, -/* 1 Blood */ 4, -/* 2 Lynx */ 2, -/* 3 Grizzly */ 5, -/* 4 Vicki */ 2, -/* 5 Trevor */ 4, -/* 6 Grunty */ 2, -/* 7 Ivan */ 0, -/* 8 Steroid */ 4, -/* 9 Igor */ 0, -/* 10 Shadow */ 4, -/* 11 Red */ 4, -/* 12 Reaper */ 0, -/* 13 Fidel */ 4, -/* 14 Fox */ 3, -/* 15 Sidney */ 4, -/* 16 Gus */ 4, -/* 17 Buns */ 3, -/* 18 Ice */ 4, -/* 19 Spider */ 2, -/* 20 Cliff */ 5, -/* 21 Bull */ 0, -/* 22 Hitman */ 0, -/* 23 Buzz */ 6, -/* 24 Raider */ 0, -/* 25 Raven */ 0, -/* 26 Static */ 4, -/* 27 Len */ 2, -/* 28 Danny */ 2, -/* 29 Magic */ 4, -/* 30 Stephan */ 4, -/* 31 Scully */ 1, -/* 32 Malice */ 4, -/* 33 Dr. Q */ 0, -/* 34 Nails */ 1, -/* 35 Thor */ 0, -/* 36 Scope */ 4, -/* 37 Wolf */ 0, -/* 38 MD */ 0, -/* 39 Meltdown*/ 2, -/* 40 Biff */ 0, -/* 41 Haywire */ 5, -/* 42 Gasket */ 4, -/* 43 Razor */ 4, -/* 44 Flo */ 0, -/* 45 Gumpy */ 0, -/* 46 Larryok */ 0, -/* 47 Larryold*/ 0, -/* 48 Cougar */ 0, -/* 49 Numb */ 4, -/* 50 Bubba */ 4, -/* 51 PGmale1 */ 0, -/* 52 PGmale2 */ 0, -/* 53 PGmale3 */ 0, -/* 54 PGLady1 */ 0, -/* 55 PGLady2 */ 0, -/* 56 PGLady3 */ 0, +/* 1 Blood */ 4, +/* 2 Lynx */ 2, +/* 3 Grizzly */ 5, +/* 4 Vicki */ 2, +/* 5 Trevor */ 4, +/* 6 Grunty */ 2, +/* 7 Ivan */ 0, +/* 8 Steroid */ 4, +/* 9 Igor */ 0, +/* 10 Shadow */ 4, +/* 11 Red */ 4, +/* 12 Reaper */ 0, +/* 13 Fidel */ 4, +/* 14 Fox */ 3, +/* 15 Sidney */ 4, +/* 16 Gus */ 4, +/* 17 Buns */ 3, +/* 18 Ice */ 4, +/* 19 Spider */ 2, +/* 20 Cliff */ 5, +/* 21 Bull */ 0, +/* 22 Hitman */ 0, +/* 23 Buzz */ 6, +/* 24 Raider */ 0, +/* 25 Raven */ 0, +/* 26 Static */ 4, +/* 27 Len */ 2, +/* 28 Danny */ 2, +/* 29 Magic */ 4, +/* 30 Stephan */ 4, +/* 31 Scully */ 1, +/* 32 Malice */ 4, +/* 33 Dr. Q */ 0, +/* 34 Nails */ 1, +/* 35 Thor */ 0, +/* 36 Scope */ 4, +/* 37 Wolf */ 0, +/* 38 MD */ 0, +/* 39 Meltdown*/ 2, +/* 40 Biff */ 0, +/* 41 Haywire */ 5, +/* 42 Gasket */ 4, +/* 43 Razor */ 4, +/* 44 Flo */ 0, +/* 45 Gumpy */ 0, +/* 46 Larryok */ 0, +/* 47 Larryold*/ 0, +/* 48 Cougar */ 0, +/* 49 Numb */ 4, +/* 50 Bubba */ 4, +/* 51 PGmale1 */ 0, +/* 52 PGmale2 */ 0, +/* 53 PGmale3 */ 0, +/* 54 PGLady1 */ 0, +/* 55 PGLady2 */ 0, +/* 56 PGLady3 */ 0, -/* 57 Miguel */ 4, -/* 58 Carlos */ 2, -/* 59 Ira */ 4, -/* 60 Dimitri */ 0, -/* 61 Devin */ 0, -/* 62 RPC62 */ 0, -/* 63 Madlab */ 0, -/* 64 Slay */ 0, -/* 65 RPC65 */ 0, -/* 66 Dynamo */ 4, -/* 67 Shank */ 0, -/* 68 Iggy */ 0, -/* 69 Steve */ 0, -/* 70 MTI */ 0, -/* 71 RPC71 */ 0, -/* 72 Maddog */ 0, -/* 73 RPC73 */ 0, -/* 74 RPC74 */ 0, +/* 57 Miguel */ 4, +/* 58 Carlos */ 2, +/* 59 Ira */ 4, +/* 60 Dimitri */ 0, +/* 61 Devin */ 0, +/* 62 RPC62 */ 0, +/* 63 Madlab */ 0, +/* 64 Slay */ 0, +/* 65 RPC65 */ 0, +/* 66 Dynamo */ 4, +/* 67 Shank */ 0, +/* 68 Iggy */ 0, +/* 69 Steve */ 0, +/* 70 MTI */ 0, +/* 71 RPC71 */ 0, +/* 72 Maddog */ 0, +/* 73 RPC73 */ 0, +/* 74 RPC74 */ 0, 0, //75 0, 0, @@ -901,79 +901,79 @@ BOOLEAN QuoteExp_WitnessDeidrannaDeath[NUM_PROFILES] = // 1 means it can be used if they have LOS to // her at time of her death. /* 0 Barry */ 0, -/* 1 Blood */ 0, -/* 2 Lynx */ 0, -/* 3 Grizzly */ 1, -/* 4 Vicki */ 1, -/* 5 Trevor */ 1, -/* 6 Grunty */ 0, -/* 7 Ivan */ 0, -/* 8 Steroid */ 0, -/* 9 Igor */ 1, -/* 10 Shadow */ 1, -/* 11 Red */ 0, -/* 12 Reaper */ 1, -/* 13 Fidel */ 0, -/* 14 Fox */ 1, -/* 15 Sidney */ 1, -/* 16 Gus */ 1, -/* 17 Buns */ 1, -/* 18 Ice */ 1, -/* 19 Spider */ 1, -/* 20 Cliff */ 0, -/* 21 Bull */ 0, -/* 22 Hitman */ 1, -/* 23 Buzz */ 0, -/* 24 Raider */ 1, -/* 25 Raven */ 0, -/* 26 Static */ 1, -/* 27 Len */ 1, -/* 28 Danny */ 1, -/* 29 Magic */ 1, -/* 30 Stephan */ 1, -/* 31 Scully */ 1, -/* 32 Malice */ 1, -/* 33 Dr. Q */ 1, -/* 34 Nails */ 1, -/* 35 Thor */ 1, -/* 36 Scope */ 1, -/* 37 Wolf */ 0, -/* 38 MD */ 0, -/* 39 Meltdown*/ 1, -/* 40 Biff */ 1, -/* 41 Haywire */ 1, -/* 42 Gasket */ 1, -/* 43 Razor */ 1, -/* 44 Flo */ 0, -/* 45 Gumpy */ 1, -/* 46 Larryok */ 0, -/* 47 Larryold*/ 1, -/* 48 Cougar */ 1, -/* 49 Numb */ 0, -/* 50 Bubba */ 1, -/* 51 PGmale1 */ 1, -/* 52 PGmale2 */ 1, -/* 53 PGmale3 */ 1, -/* 54 PGLady1 */ 1, -/* 55 PGLady2 */ 0, -/* 56 PGLady3 */ 0, +/* 1 Blood */ 0, +/* 2 Lynx */ 0, +/* 3 Grizzly */ 1, +/* 4 Vicki */ 1, +/* 5 Trevor */ 1, +/* 6 Grunty */ 0, +/* 7 Ivan */ 0, +/* 8 Steroid */ 0, +/* 9 Igor */ 1, +/* 10 Shadow */ 1, +/* 11 Red */ 0, +/* 12 Reaper */ 1, +/* 13 Fidel */ 0, +/* 14 Fox */ 1, +/* 15 Sidney */ 1, +/* 16 Gus */ 1, +/* 17 Buns */ 1, +/* 18 Ice */ 1, +/* 19 Spider */ 1, +/* 20 Cliff */ 0, +/* 21 Bull */ 0, +/* 22 Hitman */ 1, +/* 23 Buzz */ 0, +/* 24 Raider */ 1, +/* 25 Raven */ 0, +/* 26 Static */ 1, +/* 27 Len */ 1, +/* 28 Danny */ 1, +/* 29 Magic */ 1, +/* 30 Stephan */ 1, +/* 31 Scully */ 1, +/* 32 Malice */ 1, +/* 33 Dr. Q */ 1, +/* 34 Nails */ 1, +/* 35 Thor */ 1, +/* 36 Scope */ 1, +/* 37 Wolf */ 0, +/* 38 MD */ 0, +/* 39 Meltdown*/ 1, +/* 40 Biff */ 1, +/* 41 Haywire */ 1, +/* 42 Gasket */ 1, +/* 43 Razor */ 1, +/* 44 Flo */ 0, +/* 45 Gumpy */ 1, +/* 46 Larryok */ 0, +/* 47 Larryold*/ 1, +/* 48 Cougar */ 1, +/* 49 Numb */ 0, +/* 50 Bubba */ 1, +/* 51 PGmale1 */ 1, +/* 52 PGmale2 */ 1, +/* 53 PGmale3 */ 1, +/* 54 PGLady1 */ 1, +/* 55 PGLady2 */ 0, +/* 56 PGLady3 */ 0, -/* 57 Miguel */ 1, -/* 58 Carlos */ 1, -/* 59 Ira */ 1, -/* 60 Dimitri */ 0, -/* 61 Devin */ 0, -/* 62 RPC62 */ 0, -/* 63 Madlab */ 0, -/* 64 Slay */ 0, -/* 65 RPC65 */ 0, -/* 66 Dynamo */ 0, -/* 67 Shank */ 0, -/* 68 Iggy */ 0, -/* 69 Vince */ 1, -/* 70 Conrad */ 1, -/* 71 unused */ 0, -/* 72 Maddog */ 0, +/* 57 Miguel */ 1, +/* 58 Carlos */ 1, +/* 59 Ira */ 1, +/* 60 Dimitri */ 0, +/* 61 Devin */ 0, +/* 62 RPC62 */ 0, +/* 63 Madlab */ 0, +/* 64 Slay */ 0, +/* 65 RPC65 */ 0, +/* 66 Dynamo */ 0, +/* 67 Shank */ 0, +/* 68 Iggy */ 0, +/* 69 Vince */ 1, +/* 70 Conrad */ 1, +/* 71 unused */ 0, +/* 72 Maddog */ 0, 0, 0, 0, //75 @@ -1083,79 +1083,79 @@ BOOLEAN QuoteExp_WitnessQueenBugDeath[NUM_PROFILES] = // 1 means it can be used if they have LOS to // her at time of her death. /* 0 Barry */ 0, -/* 1 Blood */ 1, -/* 2 Lynx */ 1, -/* 3 Grizzly */ 1, -/* 4 Vicki */ 1, -/* 5 Trevor */ 1, -/* 6 Grunty */ 0, -/* 7 Ivan */ 1, -/* 8 Steroid */ 0, -/* 9 Igor */ 1, -/* 10 Shadow */ 1, -/* 11 Red */ 0, -/* 12 Reaper */ 1, -/* 13 Fidel */ 0, -/* 14 Fox */ 1, -/* 15 Sidney */ 1, -/* 16 Gus */ 1, -/* 17 Buns */ 1, -/* 18 Ice */ 1, -/* 19 Spider */ 1, -/* 20 Cliff */ 1, -/* 21 Bull */ 1, -/* 22 Hitman */ 1, -/* 23 Buzz */ 1, -/* 24 Raider */ 1, -/* 25 Raven */ 1, -/* 26 Static */ 1, -/* 27 Len */ 1, -/* 28 Danny */ 1, -/* 29 Magic */ 1, -/* 30 Stephan */ 1, -/* 31 Scully */ 1, -/* 32 Malice */ 1, -/* 33 Dr. Q */ 0, -/* 34 Nails */ 1, -/* 35 Thor */ 1, -/* 36 Scope */ 1, -/* 37 Wolf */ 1, -/* 38 MD */ 0, -/* 39 Meltdown*/ 1, -/* 40 Biff */ 0, -/* 41 Haywire */ 1, -/* 42 Gasket */ 0, -/* 43 Razor */ 1, -/* 44 Flo */ 1, -/* 45 Gumpy */ 0, -/* 46 Larryok */ 1, -/* 47 Larryold*/ 0, -/* 48 Cougar */ 1, -/* 49 Numb */ 0, -/* 50 Bubba */ 0, -/* 51 PGmale1 */ 0, -/* 52 PGmale2 */ 0, -/* 53 PGmale3 */ 1, -/* 54 PGLady1 */ 1, -/* 55 PGLady2 */ 1, -/* 56 PGLady3 */ 0, +/* 1 Blood */ 1, +/* 2 Lynx */ 1, +/* 3 Grizzly */ 1, +/* 4 Vicki */ 1, +/* 5 Trevor */ 1, +/* 6 Grunty */ 0, +/* 7 Ivan */ 1, +/* 8 Steroid */ 0, +/* 9 Igor */ 1, +/* 10 Shadow */ 1, +/* 11 Red */ 0, +/* 12 Reaper */ 1, +/* 13 Fidel */ 0, +/* 14 Fox */ 1, +/* 15 Sidney */ 1, +/* 16 Gus */ 1, +/* 17 Buns */ 1, +/* 18 Ice */ 1, +/* 19 Spider */ 1, +/* 20 Cliff */ 1, +/* 21 Bull */ 1, +/* 22 Hitman */ 1, +/* 23 Buzz */ 1, +/* 24 Raider */ 1, +/* 25 Raven */ 1, +/* 26 Static */ 1, +/* 27 Len */ 1, +/* 28 Danny */ 1, +/* 29 Magic */ 1, +/* 30 Stephan */ 1, +/* 31 Scully */ 1, +/* 32 Malice */ 1, +/* 33 Dr. Q */ 0, +/* 34 Nails */ 1, +/* 35 Thor */ 1, +/* 36 Scope */ 1, +/* 37 Wolf */ 1, +/* 38 MD */ 0, +/* 39 Meltdown*/ 1, +/* 40 Biff */ 0, +/* 41 Haywire */ 1, +/* 42 Gasket */ 0, +/* 43 Razor */ 1, +/* 44 Flo */ 1, +/* 45 Gumpy */ 0, +/* 46 Larryok */ 1, +/* 47 Larryold*/ 0, +/* 48 Cougar */ 1, +/* 49 Numb */ 0, +/* 50 Bubba */ 0, +/* 51 PGmale1 */ 0, +/* 52 PGmale2 */ 0, +/* 53 PGmale3 */ 1, +/* 54 PGLady1 */ 1, +/* 55 PGLady2 */ 1, +/* 56 PGLady3 */ 0, -/* 57 Miguel */ 1, -/* 58 Carlos */ 1, -/* 59 Ira */ 1, -/* 60 Dimitri */ 0, -/* 61 Devin */ 1, -/* 62 RPC62 */ 0, -/* 63 Madlab */ 0, -/* 64 Slay */ 1, -/* 65 RPC65 */ 0, -/* 66 Dynamo */ 0, -/* 67 Shank */ 0, -/* 68 Iggy */ 0, -/* 69 Vince */ 1, -/* 70 Conrad */ 1, -/* 71 unused */ 0, -/* 72 Maddog */ 1, +/* 57 Miguel */ 1, +/* 58 Carlos */ 1, +/* 59 Ira */ 1, +/* 60 Dimitri */ 0, +/* 61 Devin */ 1, +/* 62 RPC62 */ 0, +/* 63 Madlab */ 0, +/* 64 Slay */ 1, +/* 65 RPC65 */ 0, +/* 66 Dynamo */ 0, +/* 67 Shank */ 0, +/* 68 Iggy */ 0, +/* 69 Vince */ 1, +/* 70 Conrad */ 1, +/* 71 unused */ 0, +/* 72 Maddog */ 1, 0, 0, 0, //75 diff --git a/Tactical/Rain.cpp b/Tactical/Rain.cpp index 366b8375..9798c070 100644 --- a/Tactical/Rain.cpp +++ b/Tactical/Rain.cpp @@ -2,14 +2,14 @@ #include "Tactical All.h" #else #include "types.h" - #include "soldier control.h" + //#include "soldier control.h" #include "overhead.h" #include "animation control.h" #include "points.h" #include "opplist.h" #include "timer.h" #include "event pump.h" - #include "Sound Control.h" +// #include "Sound Control.h" #include "interface.h" #include "Isometric Utils.h" #include "Font Control.H" @@ -56,6 +56,11 @@ #include "Rain.h" +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + // Shop Keeper Interface #define SKI_X_OFFSET (((SCREEN_WIDTH - 536) / 2)) #define SKI_Y_OFFSET ((((SCREEN_HEIGHT - 140) - 340) / 2)) @@ -67,7 +72,7 @@ #define RAIN_UPDATE_RATE 60 #define PERCENT_OF_DROPS_GOING_TO_THE_EDGE_OF_SCREEN 0.25f -#define DROP_ANGLE_CHANGE_RATE 1.0f +#define DROP_ANGLE_CHANGE_RATE 1.0f #define MIN_DROP_LENGTH 2.0f #define ADD_DROP_LENGTH_IF_STORM 2.0f @@ -82,12 +87,12 @@ UINT32 guiMaxRainDrops = 79; -#define RESOLUTION_FACTOR_ON_MAXIMUM_DROPS ((FLOAT) ( SCREEN_WIDTH * SCREEN_HEIGHT ) / ((FLOAT) 640 * 480 ) ) -#define BASE_MAXIMUM_DROPS guiMaxRainDrops * RESOLUTION_FACTOR_ON_MAXIMUM_DROPS +#define RESOLUTION_FACTOR_ON_MAXIMUM_DROPS ((FLOAT) ( SCREEN_WIDTH * SCREEN_HEIGHT ) / ((FLOAT) 640 * 480 ) ) +#define BASE_MAXIMUM_DROPS guiMaxRainDrops * RESOLUTION_FACTOR_ON_MAXIMUM_DROPS #define DEGREE(a) ( 3.14159 / 180 * a ) -typedef struct +typedef struct { BOOLEAN fAlive; @@ -95,7 +100,7 @@ typedef struct FLOAT fpY; FLOAT fpIncrX; FLOAT fpIncrY; - + FLOAT fpEndRelX; FLOAT fpEndRelY; @@ -130,7 +135,7 @@ FLOAT fpMinDropSpeed = 0; extern UINT32 guiCurrentScreen; //extern BOOLEAN gfAllowRain; -extern INT16 gsVIEWPORT_WINDOW_END_Y; +extern INT16 gsVIEWPORT_WINDOW_END_Y; extern INT16 gsVIEWPORT_WINDOW_START_Y; #define VIDEO_OVERLAYS 100 @@ -169,7 +174,7 @@ void InitializeRainVideoObject( ) UINT16 usWidth; UINT16 usHeight; UINT8 ubBitDepth; - + // Create render buffer GetCurrentVideoSettings( &usWidth, &usHeight, &ubBitDepth ); vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE; @@ -218,7 +223,7 @@ void KillOutOfRegionRainDrops() TRainDrop *pCurr = &pRainDrops[ uiIndex ]; if( ( pCurr->fpX < gRainRegion.left || pCurr->fpX >= gRainRegion.right || - pCurr->fpY < gRainRegion.top || pCurr->fpY >= gRainRegion.bottom ) && + pCurr->fpY < gRainRegion.top || pCurr->fpY >= gRainRegion.bottom ) && ( pCurr->fpX + pCurr->fpEndRelX < gRainRegion.left || pCurr->fpX + pCurr->fpEndRelX >= gRainRegion.right || pCurr->fpY + pCurr->fpEndRelY < gRainRegion.top || pCurr->fpY + pCurr->fpEndRelY >= gRainRegion.bottom ) ) { @@ -254,7 +259,7 @@ void CreateRainDrops() if( pCurr->fAlive )continue; - uiIndRand = (((UINT32)pCurr) / sizeof(TRainDrop) ) % 20; + uiIndRand = (((UINT32)pCurr) / sizeof(TRainDrop) ) % 20; fpDropLength = fpCurrDropLength + ( (((UINT32)pCurr) / sizeof(TRainDrop) ) % 7 ) * DROP_LENGTH_RAND / 6; fpDropSpeed = fpCurrDropSpeed + ( ( ((UINT32)pCurr) / sizeof(TRainDrop) + 43 ) % 13 ) * DROP_SPEED_RAND / 12; @@ -271,7 +276,7 @@ void CreateRainDrops() if( uiIndex < guiCurrMaxAmountOfRainDrops * PERCENT_OF_DROPS_GOING_TO_THE_EDGE_OF_SCREEN ) { - if( !fpCos ) + if( !fpCos ) fpNumDropsToXBorder = 0; else { @@ -365,7 +370,7 @@ void UpdateRainDrops() }else{ pCurr->fpEndRelX += pCurr->fpIncrX; pCurr->fpEndRelY += pCurr->fpIncrY; - + if( ( pCurr->fpEndRelX > 0 && pCurr->fpIncrX > 0 ) || ( pCurr->fpEndRelX < 0 && pCurr->fpIncrX < 0 ) || ( pCurr->fpEndRelY > 0 && pCurr->fpIncrY > 0 ) || @@ -409,8 +414,8 @@ void RenderRainOnSurface() TRainDrop *pCurr = &pRainDrops[ uiIndex ]; if( !pCurr->fAlive )continue; - - LineDraw( TRUE, (int)pCurr->fpX, (int)pCurr->fpY, (int)pCurr->fpX + (int)pCurr->fpEndRelX, (int)(pCurr->fpY + pCurr->fpEndRelY), sDropsColor, pDestBuf ); + + LineDraw( TRUE, (int)pCurr->fpX, (int)pCurr->fpY, (int)pCurr->fpX + (int)pCurr->fpEndRelX, (int)(pCurr->fpY + pCurr->fpEndRelY), sDropsColor, pDestBuf ); } UnLockVideoSurface( guiRainRenderSurface ); @@ -433,7 +438,7 @@ void GenerateRainMaximums() } fpCurrDropAngleOfFalling = fpMinDropAngleOfFalling + Random( (UINT32)(fpMaxDropAngleOfFalling - fpMinDropAngleOfFalling) ); - + fpMinDropLength = MIN_DROP_LENGTH + ADD_DROP_LENGTH_IF_STORM * ( gbCurrentRainIntensity - 1 ); fpMaxDropLength = fpMinDropLength + DROP_LENGTH_RANGE; @@ -504,9 +509,9 @@ void RainClipVideoOverlay() pCurr = gVideoOverlays[ uiIndex ].pBackground; if( pCurr->sLeft < gRainRegion.right || - pCurr->sTop < gRainRegion.bottom || - pCurr->sRight >= gRainRegion.left || - pCurr->sBottom >= gRainRegion.top ) + pCurr->sTop < gRainRegion.bottom || + pCurr->sRight >= gRainRegion.left || + pCurr->sBottom >= gRainRegion.top ) ColorFillVideoSurfaceArea( guiRainRenderSurface, pCurr->sLeft, pCurr->sTop, pCurr->sRight, pCurr->sBottom, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); } } @@ -556,7 +561,7 @@ void RenderRain() guiCurrAmountOfDeadRainDrops = guiCurrMaxAmountOfRainDrops; - + CreateRainDrops(); RandomizeRainDropsPosition(); } diff --git a/Tactical/Real Time Input.cpp b/Tactical/Real Time Input.cpp index 4ed3dff8..404ddd6c 100644 --- a/Tactical/Real Time Input.cpp +++ b/Tactical/Real Time Input.cpp @@ -9,7 +9,7 @@ #include "math.h" #include "jascreens.h" #include "pathai.h" -#include "Soldier Control.h" +//#include "Soldier Control.h" #include "Animation Control.h" #include "Animation Data.h" #include "Event Pump.h" @@ -17,7 +17,7 @@ #include "cursors.h" #include "Handle UI.h" #include "Isometric Utils.h" -#include "input.h" +#include "input.h" #include "overhead.h" #include "Sys Globals.h" #include "screenids.h" @@ -67,11 +67,16 @@ #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + extern UIKEYBOARD_HOOK gUIKeyboardHook; extern BOOLEAN fRightButtonDown; extern BOOLEAN fLeftButtonDown; extern BOOLEAN fIgnoreLeftUp; -extern UINT32 guiCurrentEvent; +extern UINT32 guiCurrentEvent; extern UINT32 guiCurrentUICursor; extern void DetermineWhichAssignmentMenusCanBeShown( void ); extern void DetermineWhichMilitiaControlMenusCanBeShown( void ); @@ -82,9 +87,9 @@ extern UINT32 guiUITargetSoldierId; extern BOOLEAN gfUIShowExitSouth; -BOOLEAN gfStartLookingForRubberBanding = FALSE; -UINT16 gusRubberBandX = 0; -UINT16 gusRubberBandY = 0; +BOOLEAN gfStartLookingForRubberBanding = FALSE; +UINT16 gusRubberBandX = 0; +UINT16 gusRubberBandY = 0; BOOLEAN gfBeginBurstSpreadTracking = FALSE; @@ -107,18 +112,17 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) SOLDIERTYPE *pSoldier; UINT32 uiMercFlags; static UINT32 uiSingleClickTime; - UINT16 usMapPos; - BOOLEAN fDone = FALSE; + INT16 sMapPos; static BOOLEAN fDoubleClickIntercepted = FALSE; static BOOLEAN fValidDoubleClickPossible = FALSE; - static BOOLEAN fCanCheckForSpeechAdvance = FALSE; + static BOOLEAN fCanCheckForSpeechAdvance = FALSE; static INT16 sMoveClickGridNo = 0; // LEFT MOUSE BUTTON if ( gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA ) { - if (!GetMouseMapPos( &usMapPos ) && !gfUIShowExitSouth ) + if (!GetMouseMapPos( &sMapPos ) && !gfUIShowExitSouth ) { return; } @@ -162,7 +166,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) { if ( pSoldier->bDoBurst ) { - pSoldier->sStartGridNo = usMapPos; + pSoldier->sStartGridNo = sMapPos; ResetBurstLocations( ); *puiNewEvent = A_CHANGE_TO_CONFIM_ACTION; } @@ -170,7 +174,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) { gfRTClickLeftHoldIntercepted = TRUE; - if ( UIMouseOnValidAttackLocation( pSoldier ) ) + if ( UIMouseOnValidAttackLocation( pSoldier ) ) { // OK< going into confirm will call a function that will automatically move // us to shoot in most vases ( grenades need a confirm mode regardless ) @@ -191,7 +195,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) if ( !HandleCheckForExitArrowsInput( FALSE ) && gpItemPointer == NULL ) { - if ( gfUIFullTargetFound && ( guiUIFullTargetFlags & OWNED_MERC ) ) + if ( gfUIFullTargetFound && ( guiUIFullTargetFlags & OWNED_MERC ) ) { // Reset , if this guy is selected merc, reset any multi selections... if ( gusUIFullTargetID == gusSelectedSoldier ) @@ -203,7 +207,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) { INT8 bReturnCode; - bReturnCode = HandleMoveModeInteractiveClick( usMapPos, puiNewEvent ); + bReturnCode = HandleMoveModeInteractiveClick( sMapPos, puiNewEvent ); if ( bReturnCode == -1 ) { @@ -230,13 +234,13 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) if ( gusSelectedSoldier != NOBODY ) { - if ( ( fResult = UIOKMoveDestination( MercPtrs[ gusSelectedSoldier ], usMapPos ) ) == 1 ) + if ( ( fResult = UIOKMoveDestination( MercPtrs[ gusSelectedSoldier ], sMapPos ) ) == 1 ) { if ( gsCurrentActionPoints != 0 ) { // We're on terrain in which we can walk, walk // If we're on terrain, - if ( !gGameSettings.fOptions[ TOPTION_RTCONFIRM ] ) + if ( !gGameSettings.fOptions[ TOPTION_RTCONFIRM ] ) { *puiNewEvent = C_WAIT_FOR_CONFIRM; gfPlotNewMovement = TRUE; @@ -279,25 +283,25 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) case CONFIRM_MOVE_MODE: // First check if we clicked on a guy, if so, make selected if it's ours - if( FindSoldierFromMouse( &usSoldierIndex, &uiMercFlags ) ) + if( FindSoldierFromMouse( &usSoldierIndex, &uiMercFlags ) ) { // Select guy - if ( (uiMercFlags & SELECTED_MERC) && !( uiMercFlags & UNCONSCIOUS_MERC ) && !( MercPtrs[ usSoldierIndex ]->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( (uiMercFlags & SELECTED_MERC) && !( uiMercFlags & UNCONSCIOUS_MERC ) && !( MercPtrs[ usSoldierIndex ]->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { *puiNewEvent = M_CHANGE_TO_ADJPOS_MODE; } } else { - //if ( COUNTERDONE( RUBBER_BAND_START_DELAY ) ) + //if ( COUNTERDONE( RUBBER_BAND_START_DELAY ) ) { // OK, change to rubber banding mode.. // Have we started this yet? if ( !gfStartLookingForRubberBanding && !gRubberBandActive ) { - gfStartLookingForRubberBanding = TRUE; - gusRubberBandX = gusMouseXPos; - gusRubberBandY = gusMouseYPos; + gfStartLookingForRubberBanding = TRUE; + gusRubberBandX = gusMouseXPos; + gusRubberBandY = gusMouseYPos; } else { @@ -319,7 +323,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) gRubberBandActive = TRUE; // ATE: If we have stopped scrolling..... - if ( gfScrollInertia != FALSE ) + if ( gfScrollInertia != FALSE ) { SetRenderFlags( RENDER_FLAG_FULL | RENDER_FLAG_CHECKZ ); @@ -337,7 +341,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) } } } - } + } break; } } @@ -345,7 +349,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) } else { - if ( fLeftButtonDown ) + if ( fLeftButtonDown ) { if ( !fIgnoreLeftUp ) { @@ -368,10 +372,10 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) //if ( gAnimControl[ MercPtrs[ gusSelectedSoldier ]->usAnimState ].uiFlags & ANIM_STATIONARY ) //if ( MercPtrs[ gusSelectedSoldier ]->usAnimState == WALKING ) { - MercPtrs[ gusSelectedSoldier ]->fUIMovementFast = TRUE; + MercPtrs[ gusSelectedSoldier ]->flags.fUIMovementFast = TRUE; *puiNewEvent = C_MOVE_MERC; } - } + } } } @@ -396,7 +400,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) // CHECK IF WE CLICKED-HELD if ( COUNTERDONE( LMOUSECLICK_DELAY_COUNTER ) && gpItemPointer != NULL ) - { + { // LEFT CLICK-HOLD EVENT // Switch on UI mode switch( gCurrentUIMode ) @@ -408,13 +412,13 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) { if ( pSoldier->bDoBurst ) { - pSoldier->sEndGridNo = usMapPos; + pSoldier->sEndGridNo = sMapPos; gfBeginBurstSpreadTracking = FALSE; if ( pSoldier->sEndGridNo != pSoldier->sStartGridNo ) { - pSoldier->fDoSpread = TRUE; + pSoldier->flags.fDoSpread = TRUE; PickBurstLocations( pSoldier ); @@ -422,7 +426,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) } else { - pSoldier->fDoSpread = FALSE; + pSoldier->flags.fDoSpread = FALSE; } gfRTClickLeftHoldIntercepted = TRUE; } @@ -447,7 +451,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) { if ( gpItemPointer != NULL ) { - if ( HandleItemPointerClick( usMapPos ) ) + if ( HandleItemPointerClick( sMapPos ) ) { // getout of mode EndItemPointer( ); @@ -478,7 +482,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) case IDLE_MODE: // First check if we clicked on a guy, if so, make selected if it's ours - if( FindSoldierFromMouse( &usSoldierIndex, &uiMercFlags ) ) + if( FindSoldierFromMouse( &usSoldierIndex, &uiMercFlags ) ) { // Select guy if ( uiMercFlags & OWNED_MERC ) @@ -491,7 +495,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) case HANDCURSOR_MODE: - HandleHandCursorClick( usMapPos, puiNewEvent ); + HandleHandCursorClick( sMapPos, puiNewEvent ); break; case ACTION_MODE: @@ -499,7 +503,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) //*puiNewEvent = A_CHANGE_TO_CONFIM_ACTION; //if( GetSoldier( &pSoldier, gusSelectedSoldier ) ) //{ - // pSoldier->sStartGridNo = usMapPos; + // pSoldier->sStartGridNo = sMapPos; // ResetBurstLocations( ); //} *puiNewEvent = CA_MERC_SHOOT; @@ -512,11 +516,11 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) if ( MercPtrs[ gusSelectedSoldier ]->usAnimState != RUNNING ) { *puiNewEvent = C_MOVE_MERC; - } + } else { - MercPtrs[ gusSelectedSoldier ]->fUIMovementFast = 2; - *puiNewEvent = C_MOVE_MERC; + MercPtrs[ gusSelectedSoldier ]->flags.fUIMovementFast = 2; + *puiNewEvent = C_MOVE_MERC; } } @@ -536,10 +540,10 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) // if ( gusSelectedSoldier != NOBODY ) // { // if ( !( gAnimControl[ MercPtrs[ gusSelectedSoldier ]->usAnimState ].uiFlags & ANIM_STATIONARY ) ) - // { + // { - //gUITargetShotWaiting = TRUE; - //gsUITargetShotGridNo = usMapPos; + //gUITargetShotWaiting = TRUE; + //gsUITargetShotGridNo = sMapPos; // } // else // { @@ -555,14 +559,14 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) if ( !HandleCheckForExitArrowsInput( FALSE ) && gpItemPointer == NULL ) { // First check if we clicked on a guy, if so, make selected if it's ours - if ( gfUIFullTargetFound && ( guiUIFullTargetFlags & OWNED_MERC ) ) + if ( gfUIFullTargetFound && ( guiUIFullTargetFlags & OWNED_MERC ) ) { if ( !( guiUIFullTargetFlags & UNCONSCIOUS_MERC ) ) { // Select guy if( GetSoldier( &pSoldier, gusUIFullTargetID ) && gpItemPointer == NULL ) - { - if( pSoldier->bAssignment >= ON_DUTY && !(pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + { + if( pSoldier->bAssignment >= ON_DUTY && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { PopupAssignmentMenuInTactical( pSoldier ); } @@ -575,21 +579,21 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) } else { - if ( pSoldier->uiStatusFlags & SOLDIER_MULTI_SELECTED ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) { - pSoldier->uiStatusFlags &= (~SOLDIER_MULTI_SELECTED ); + pSoldier->flags.uiStatusFlags &= (~SOLDIER_MULTI_SELECTED ); } else { - pSoldier->uiStatusFlags |= (SOLDIER_MULTI_SELECTED ); + pSoldier->flags.uiStatusFlags |= (SOLDIER_MULTI_SELECTED ); // Say Confimation... if( !gGameSettings.fOptions[ TOPTION_MUTE_CONFIRMATIONS ] ) - DoMercBattleSound( pSoldier, BATTLE_SOUND_ATTN1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_ATTN1 ); // OK, if we have a selected guy.. make him part too.... if ( gusSelectedSoldier != NOBODY ) { - MercPtrs[ gusSelectedSoldier ]->uiStatusFlags |= (SOLDIER_MULTI_SELECTED ); + MercPtrs[ gusSelectedSoldier ]->flags.uiStatusFlags |= (SOLDIER_MULTI_SELECTED ); } } @@ -609,22 +613,22 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) } else { - if ( pSoldier->uiStatusFlags & SOLDIER_MULTI_SELECTED ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) { - pSoldier->uiStatusFlags &= (~SOLDIER_MULTI_SELECTED ); + pSoldier->flags.uiStatusFlags &= (~SOLDIER_MULTI_SELECTED ); } else { - pSoldier->uiStatusFlags |= (SOLDIER_MULTI_SELECTED ); + pSoldier->flags.uiStatusFlags |= (SOLDIER_MULTI_SELECTED ); // Say Confimation... if( !gGameSettings.fOptions[ TOPTION_MUTE_CONFIRMATIONS ] ) - DoMercBattleSound( pSoldier, BATTLE_SOUND_ATTN1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_ATTN1 ); } // OK, if we have a selected guy.. make him part too.... if ( gusSelectedSoldier != NOBODY ) { - MercPtrs[ gusSelectedSoldier ]->uiStatusFlags |= (SOLDIER_MULTI_SELECTED ); + MercPtrs[ gusSelectedSoldier ]->flags.uiStatusFlags |= (SOLDIER_MULTI_SELECTED ); } gfIgnoreOnSelectedGuy = TRUE; @@ -639,7 +643,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) { INT8 bReturnCode; - bReturnCode = HandleMoveModeInteractiveClick( usMapPos, puiNewEvent ); + bReturnCode = HandleMoveModeInteractiveClick( sMapPos, puiNewEvent ); if ( bReturnCode == -1 ) { @@ -663,12 +667,12 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) if ( pSoldier->usAnimState != RUNNING ) { *puiNewEvent = C_MOVE_MERC; - } - else + } + else { if ( GetCurInteractiveTileGridNo( &sIntTileGridNo ) != NULL ) { - pSoldier->fUIMovementFast = TRUE; + pSoldier->flags.fUIMovementFast = TRUE; *puiNewEvent = C_MOVE_MERC; } } @@ -681,7 +685,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) if( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { // First check if we clicked on a guy, if so, make selected if it's ours - if( FindSoldierFromMouse( &usSoldierIndex, &uiMercFlags ) && ( uiMercFlags & OWNED_MERC ) ) + if( FindSoldierFromMouse( &usSoldierIndex, &uiMercFlags ) && ( uiMercFlags & OWNED_MERC ) ) { // Select guy *puiNewEvent = I_SELECT_MERC; @@ -689,7 +693,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) } else { - //if ( FindBestPath( pSoldier, usMapPos, pSoldier->bLevel, pSoldier->usUIMovementMode, NO_COPYROUTE, 0 ) == 0 ) + //if ( FindBestPath( pSoldier, sMapPos, pSoldier->pathing.bLevel, pSoldier->usUIMovementMode, NO_COPYROUTE, 0 ) == 0 ) if ( gsCurrentActionPoints == 0 && !gfUIAllMoveOn && !gTacticalStatus.fAtLeastOneGuyOnMultiSelect ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ NO_PATH ] ); @@ -701,7 +705,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) if ( gusSelectedSoldier != NOBODY ) { - if ( ( fResult = UIOKMoveDestination( MercPtrs[ gusSelectedSoldier ], usMapPos ) ) == 1 ) + if ( ( fResult = UIOKMoveDestination( MercPtrs[ gusSelectedSoldier ], sMapPos ) ) == 1 ) { if ( gfUIAllMoveOn ) { @@ -719,12 +723,12 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pTeamSoldier++ ) { // Default turn off - pTeamSoldier->uiStatusFlags &= (~SOLDIER_MULTI_SELECTED ); + pTeamSoldier->flags.uiStatusFlags &= (~SOLDIER_MULTI_SELECTED ); // If controllable if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == MercPtrs[ gusSelectedSoldier ]->bAssignment ) { - pTeamSoldier->uiStatusFlags |= SOLDIER_MULTI_SELECTED; + pTeamSoldier->flags.uiStatusFlags |= SOLDIER_MULTI_SELECTED; } } EndMultiSoldierSelection( FALSE ); @@ -740,7 +744,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) { // We're on terrain in which we can walk, walk // If we're on terrain, - if ( gGameSettings.fOptions[ TOPTION_RTCONFIRM ] ) + if ( gGameSettings.fOptions[ TOPTION_RTCONFIRM ] ) { *puiNewEvent = C_WAIT_FOR_CONFIRM; gfPlotNewMovement = TRUE; @@ -752,7 +756,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) } } } - else + else { if ( fResult == 2 ) { @@ -760,20 +764,20 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) } else { - //if ( usMapPos != sMoveClickGridNo || pSoldier->uiStatusFlags & SOLDIER_ROBOT ) + //if ( sMapPos != sMoveClickGridNo || pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) //{ - // sMoveClickGridNo = usMapPos; + // sMoveClickGridNo = sMapPos; //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ CANT_MOVE_THERE_STR ] ); - // *puiNewEvent = M_CHANGE_TO_HANDMODE; - // gsOverItemsGridNo = usMapPos; + // *puiNewEvent = M_CHANGE_TO_HANDMODE; + // gsOverItemsGridNo = sMapPos; // gsOverItemsLevel = gsInterfaceLevel; // } // else // { // sMoveClickGridNo = 0; - // *puiNewEvent = M_CHANGE_TO_HANDMODE; + // *puiNewEvent = M_CHANGE_TO_HANDMODE; // } } //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, L"Invalid move destination." ); @@ -801,7 +805,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) fDone = FALSE; if( GetSoldier( &pSoldier, gusUIFullTargetID ) && gpItemPointer == NULL ) { - if( ( guiUIFullTargetFlags & OWNED_MERC ) && ( guiUIFullTargetFlags & VISIBLE_MERC ) && !( guiUIFullTargetFlags & DEAD_MERC ) &&( pSoldier->bAssignment >= ON_DUTY )&&!( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if( ( guiUIFullTargetFlags & OWNED_MERC ) && ( guiUIFullTargetFlags & VISIBLE_MERC ) && !( guiUIFullTargetFlags & DEAD_MERC ) &&( pSoldier->bAssignment >= ON_DUTY )&&!( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { fShowAssignmentMenu = TRUE; gfRTClickLeftHoldIntercepted = TRUE; @@ -892,7 +896,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) // Reset flag fLeftButtonDown = FALSE; - fIgnoreLeftUp = FALSE; + fIgnoreLeftUp = FALSE; gfRTClickLeftHoldIntercepted = FALSE; fDoubleClickIntercepted = FALSE; fCanCheckForSpeechAdvance = FALSE; @@ -919,7 +923,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) { if( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { - pSoldier->fDoSpread = FALSE; + pSoldier->flags.fDoSpread = FALSE; } gfBeginBurstSpreadTracking = FALSE; } @@ -935,11 +939,11 @@ void QueryRTRightButton( UINT32 *puiNewEvent ) static BOOLEAN fValidDoubleClickPossible = FALSE; SOLDIERTYPE *pSoldier; - UINT16 usMapPos; + INT16 sMapPos; if ( gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA ) { - if (!GetMouseMapPos( &usMapPos ) ) + if (!GetMouseMapPos( &sMapPos ) ) { return; } @@ -956,7 +960,7 @@ void QueryRTRightButton( UINT32 *puiNewEvent ) // CHECK COMBINATIONS if ( fLeftButtonDown ) { - //fIgnoreLeftUp = TRUE; + //fIgnoreLeftUp = TRUE; gfRTHaveClickedRightWhileLeftDown = TRUE; if ( gpItemPointer == NULL ) @@ -967,8 +971,8 @@ void QueryRTRightButton( UINT32 *puiNewEvent ) { switch( gCurrentUIMode ) { - case CONFIRM_MOVE_MODE: - case MOVE_MODE: + case CONFIRM_MOVE_MODE: + case MOVE_MODE: if ( !gfUIAllMoveOn ) { @@ -978,7 +982,7 @@ void QueryRTRightButton( UINT32 *puiNewEvent ) if ( gfUICanBeginAllMoveCycle ) { // ATE: Here, check if we can do this.... - if ( !UIOKMoveDestination( MercPtrs[ gusSelectedSoldier ], usMapPos ) ) + if ( !UIOKMoveDestination( MercPtrs[ gusSelectedSoldier ], sMapPos ) ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ CANT_MOVE_THERE_STR ] ); gfRTClickLeftHoldIntercepted = TRUE; @@ -988,7 +992,7 @@ void QueryRTRightButton( UINT32 *puiNewEvent ) // ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ NO_PATH ] ); // gfRTClickLeftHoldIntercepted = TRUE; //} - else + else { *puiNewEvent = M_CYCLE_MOVE_ALL; } @@ -1002,7 +1006,7 @@ void QueryRTRightButton( UINT32 *puiNewEvent ) { gfBeginBurstSpreadTracking = FALSE; gfRTClickLeftHoldIntercepted = TRUE; - MercPtrs[ gusSelectedSoldier ]->fDoSpread = FALSE; + MercPtrs[ gusSelectedSoldier ]->flags.fDoSpread = FALSE; fClickHoldIntercepted = TRUE; *puiNewEvent = A_END_ACTION; gCurrentUIMode = MOVE_MODE; @@ -1030,7 +1034,7 @@ void QueryRTRightButton( UINT32 *puiNewEvent ) if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { - if ( ( guiUIFullTargetFlags & OWNED_MERC ) && ( guiUIFullTargetFlags & VISIBLE_MERC ) && !( guiUIFullTargetFlags & DEAD_MERC )&&!( pSoldier ? pSoldier->uiStatusFlags & SOLDIER_VEHICLE : 0 ) ) + if ( ( guiUIFullTargetFlags & OWNED_MERC ) && ( guiUIFullTargetFlags & VISIBLE_MERC ) && !( guiUIFullTargetFlags & DEAD_MERC )&&!( pSoldier ? pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE : 0 ) ) { //if( pSoldier->bAssignment >= ON_DUTY ) { @@ -1045,7 +1049,7 @@ void QueryRTRightButton( UINT32 *puiNewEvent ) CreateDestroyAssignmentPopUpBoxes( ); DetermineWhichAssignmentMenusCanBeShown( ); - fShowMilitiaControlMenu = FALSE; + fShowMilitiaControlMenu = FALSE; CreateDestroyMilitiaControlPopUpBoxes( ); DetermineWhichMilitiaControlMenusCanBeShown( ); } @@ -1093,11 +1097,11 @@ void QueryRTRightButton( UINT32 *puiNewEvent ) // ATE: if ( gusSelectedSoldier != NOBODY ) { - //fIgnoreLeftUp = TRUE; + //fIgnoreLeftUp = TRUE; switch( gCurrentUIMode ) { - case CONFIRM_MOVE_MODE: - case MOVE_MODE: + case CONFIRM_MOVE_MODE: + case MOVE_MODE: if ( gfUIAllMoveOn ) { @@ -1130,11 +1134,11 @@ void QueryRTRightButton( UINT32 *puiNewEvent ) // ATE: if ( gusSelectedSoldier != NOBODY ) { - //fIgnoreLeftUp = TRUE; + //fIgnoreLeftUp = TRUE; switch( gCurrentUIMode ) { - case CONFIRM_MOVE_MODE: - case MOVE_MODE: + case CONFIRM_MOVE_MODE: + case MOVE_MODE: if ( gfUIAllMoveOn ) { @@ -1163,8 +1167,8 @@ void QueryRTRightButton( UINT32 *puiNewEvent ) break; - case CONFIRM_MOVE_MODE: - case MOVE_MODE: + case CONFIRM_MOVE_MODE: + case MOVE_MODE: case TALKCURSOR_MODE: { @@ -1185,7 +1189,7 @@ void QueryRTRightButton( UINT32 *puiNewEvent ) if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { - HandleRightClickAdjustCursor( pSoldier, usMapPos ); + HandleRightClickAdjustCursor( pSoldier, sMapPos ); } fClickIntercepted = TRUE; break; @@ -1217,7 +1221,7 @@ void QueryRTRightButton( UINT32 *puiNewEvent ) { gfItemPointerDifferentThanDefault = !gfItemPointerDifferentThanDefault; } - } + } } } } @@ -1240,21 +1244,21 @@ void QueryRTRightButton( UINT32 *puiNewEvent ) } -extern BOOLEAN ConfirmActionCancel( UINT16 usMapPos, UINT16 usOldMapPos ); +extern BOOLEAN ConfirmActionCancel( INT16 sMapPos, UINT16 usOldMapPos ); extern BOOLEAN gUIActionModeChangeDueToMouseOver; void GetRTMousePositionInput( UINT32 *puiNewEvent ) { - UINT16 usMapPos; + INT16 sMapPos; static UINT16 usOldMapPos = 0; static UINT32 uiMoveTargetSoldierId = NOBODY; - SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pSoldier; static BOOLEAN fOnValidGuy = FALSE; - if (!GetMouseMapPos( &usMapPos ) ) + if (!GetMouseMapPos( &sMapPos ) ) { return; } @@ -1290,7 +1294,7 @@ void GetRTMousePositionInput( UINT32 *puiNewEvent ) case JUMPOVER_MODE: // ATE: Make sure! - if ( gsJumpOverGridNo != usMapPos ) + if ( gsJumpOverGridNo != sMapPos ) { *puiNewEvent = A_CHANGE_TO_MOVE; } @@ -1372,7 +1376,7 @@ void GetRTMousePositionInput( UINT32 *puiNewEvent ) case MOVE_MODE: - if ( usMapPos != usOldMapPos ) + if ( sMapPos != usOldMapPos ) { // Set off ALL move.... gfUIAllMoveOn = FALSE; @@ -1390,16 +1394,16 @@ void GetRTMousePositionInput( UINT32 *puiNewEvent ) usItem = pSoldier->inv[HANDPOS].usItem; // get cursor for item - ubItemCursor = GetActionModeCursor( pSoldier ); + ubItemCursor = GetActionModeCursor( pSoldier ); - // - if ( IsValidJumpLocation( pSoldier, usMapPos, TRUE ) ) + // + if ( IsValidJumpLocation( pSoldier, sMapPos, TRUE ) ) { *puiNewEvent = JP_ON_TERRAIN; - gsJumpOverGridNo = usMapPos; + gsJumpOverGridNo = sMapPos; return; } - else + else { if( gfUIFullTargetFound ) { @@ -1443,7 +1447,7 @@ void GetRTMousePositionInput( UINT32 *puiNewEvent ) fOnValidGuy = FALSE; - if ( gfUIFullTargetFound ) + if ( gfUIFullTargetFound ) //if ( gfUIFullTargetFound ) { if ( IsValidTargetMerc( (UINT8)gusUIFullTargetID ) ) @@ -1463,7 +1467,7 @@ void GetRTMousePositionInput( UINT32 *puiNewEvent ) } } } - } + } else { if ( gUIActionModeChangeDueToMouseOver ) @@ -1477,7 +1481,7 @@ void GetRTMousePositionInput( UINT32 *puiNewEvent ) case CONFIRM_MOVE_MODE: - if ( usMapPos != usOldMapPos ) + if ( sMapPos != usOldMapPos ) { // Switch event out of confirm mode // Set off ALL move.... @@ -1494,19 +1498,19 @@ void GetRTMousePositionInput( UINT32 *puiNewEvent ) { if ( pSoldier->bDoBurst ) { - pSoldier->sEndGridNo = usMapPos; + pSoldier->sEndGridNo = sMapPos; if ( pSoldier->sEndGridNo != pSoldier->sStartGridNo && fLeftButtonDown ) { - pSoldier->fDoSpread = TRUE; + pSoldier->flags.fDoSpread = TRUE; gfBeginBurstSpreadTracking = TRUE; } - if ( pSoldier->fDoSpread ) + if ( pSoldier->flags.fDoSpread ) { // Accumulate gridno - AccumulateBurstLocation( usMapPos ); + AccumulateBurstLocation( sMapPos ); *puiNewEvent = CA_ON_TERRAIN; break; @@ -1520,7 +1524,7 @@ void GetRTMousePositionInput( UINT32 *puiNewEvent ) if ( guiUITargetSoldierId != gusUIFullTargetID ) { // Switch event out of confirm mode - *puiNewEvent = CA_END_CONFIRM_ACTION; + *puiNewEvent = CA_END_CONFIRM_ACTION; } else { @@ -1529,10 +1533,10 @@ void GetRTMousePositionInput( UINT32 *puiNewEvent ) } else { - if ( ConfirmActionCancel( usMapPos, usOldMapPos ) ) + if ( ConfirmActionCancel( sMapPos, usOldMapPos ) ) { // Switch event out of confirm mode - *puiNewEvent = CA_END_CONFIRM_ACTION; + *puiNewEvent = CA_END_CONFIRM_ACTION; } else @@ -1549,14 +1553,15 @@ void GetRTMousePositionInput( UINT32 *puiNewEvent ) // if( GetSoldier( &pSoldier, gusSelectedSoldier ) ) // { // Change refine value back to 1 - /// pSoldier->bShownAimTime = REFINE_AIM_1; + /// pSoldier->aiData.bShownAimTime = REFINE_AIM_1; // } //} - usOldMapPos = usMapPos; + usOldMapPos = sMapPos; } } + diff --git a/Tactical/Rotting Corpses.cpp b/Tactical/Rotting Corpses.cpp index 61a2dd13..ffec3e56 100644 --- a/Tactical/Rotting Corpses.cpp +++ b/Tactical/Rotting Corpses.cpp @@ -7,10 +7,10 @@ #include "wcheck.h" #include "stdlib.h" #include "debug.h" - #include "soldier control.h" + //#include "soldier control.h" #include "weapons.h" #include "handle items.h" - #include "worlddef.h" + #include "worlddef.h" #include "worldman.h" #include "rotting corpses.h" #include "tile cache.h" @@ -26,7 +26,7 @@ #include "opplist.h" #include "structure.h" #include "message.h" - #include "sound control.h" + #include "Sound Control.h" #include "pathai.h" #include "Random.h" #include "dialogue control.h" @@ -45,14 +45,19 @@ #include "Interface.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + #define CORPSE_WARNING_MAX 5 #define CORPSE_WARNING_DIST 5 #define CORPSE_INDEX_OFFSET 10000 //#define DELAY_UNTIL_ROTTING ( 1 * NUM_SEC_IN_DAY ) -#define DELAY_UNTIL_ROTTING ( 1 * NUM_SEC_IN_DAY / 60 ) -#define DELAY_UNTIL_DONE_ROTTING ( 3 * NUM_SEC_IN_DAY / 60 ) +#define DELAY_UNTIL_ROTTING ( 1 * NUM_SEC_IN_DAY / 60 ) +#define DELAY_UNTIL_DONE_ROTTING ( 3 * NUM_SEC_IN_DAY / 60 ) #define MAX_NUM_CROWS 6 @@ -120,12 +125,12 @@ CHAR8 zCorpseFilenames[ NUM_CORPSES ][70] = "ANIMS\\CORPSES\\P_DECOMP2.STI", "ANIMS\\CORPSES\\TK_WREK.STI", "ANIMS\\CORPSES\\TK2_WREK.STI", - "ANIMS\\CORPSES\\HM_WREK.STI", - "ANIMS\\CORPSES\\IC_WREK.STI", - "ANIMS\\CORPSES\\QN_DEAD.STI", - "ANIMS\\CORPSES\\J_DEAD.STI", - "ANIMS\\CORPSES\\S_BURNT.STI", - "ANIMS\\CORPSES\\S_EXPLD.STI", + "ANIMS\\CORPSES\\HM_WREK.STI", + "ANIMS\\CORPSES\\IC_WREK.STI", + "ANIMS\\CORPSES\\QN_DEAD.STI", + "ANIMS\\CORPSES\\J_DEAD.STI", + "ANIMS\\CORPSES\\S_BURNT.STI", + "ANIMS\\CORPSES\\S_EXPLD.STI", }; @@ -185,12 +190,12 @@ CHAR8 zNoBloodCorpseFilenames[ NUM_CORPSES ][70] = "ANIMS\\CORPSES\\TK_WREK.STI", "ANIMS\\CORPSES\\TK2_WREK.STI", - "ANIMS\\CORPSES\\HM_WREK.STI", - "ANIMS\\CORPSES\\IC_WREK.STI", - "ANIMS\\CORPSES\\QN_DEAD.STI", - "ANIMS\\CORPSES\\J_DEAD.STI", - "ANIMS\\CORPSES\\S_BURNT.STI", - "ANIMS\\CORPSES\\S_EXPLD.STI", + "ANIMS\\CORPSES\\HM_WREK.STI", + "ANIMS\\CORPSES\\IC_WREK.STI", + "ANIMS\\CORPSES\\QN_DEAD.STI", + "ANIMS\\CORPSES\\J_DEAD.STI", + "ANIMS\\CORPSES\\S_BURNT.STI", + "ANIMS\\CORPSES\\S_EXPLD.STI", }; UINT8 gb4DirectionsFrom8[8] = @@ -268,23 +273,23 @@ BOOLEAN gbCorpseValidForDecapitation[ NUM_CORPSES ] = 0, 0, 0, - 0, - 0, - 1, + 0, + 0, + 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, }; -INT8 gDecapitatedCorpse[ NUM_CORPSES ] = +INT8 gDecapitatedCorpse[ NUM_CORPSES ] = { 0, SMERC_JFK, @@ -330,21 +335,21 @@ INT8 gDecapitatedCorpse[ NUM_CORPSES ] = 0, 0, 0, - 0, - 0, - 0, - 0, - 0, - 0, + 0, + 0, + 0, + 0, + 0, + 0, 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, }; @@ -401,22 +406,22 @@ UINT16 GetCorpseStructIndex( ROTTING_CORPSE_DEFINITION *pCorpseDef, BOOLEAN fFor switch( pCorpseDef->ubType ) { - case QUEEN_MONSTER_DEAD: - case BURNT_DEAD: - case EXPLODE_DEAD: + case QUEEN_MONSTER_DEAD: + case BURNT_DEAD: + case EXPLODE_DEAD: - bDirection = 0; - break; + bDirection = 0; + break; - case ICECREAM_DEAD: - case HUMMER_DEAD: + case ICECREAM_DEAD: + case HUMMER_DEAD: // OK , these have 2 directions.... bDirection = gb2DirectionsFrom8[ pCorpseDef->ubDirection ]; - if ( fForImage ) - { - bDirection = gOneCDirection[ bDirection ]; - } + if ( fForImage ) + { + bDirection = gOneCDirection[ bDirection ]; + } break; case SMERC_FALL: @@ -429,21 +434,21 @@ UINT16 GetCorpseStructIndex( ROTTING_CORPSE_DEFINITION *pCorpseDef, BOOLEAN fFor // OK , these have 4 directions.... bDirection = gb4DirectionsFrom8[ pCorpseDef->ubDirection ]; -// if ( fForImage ) -// { -// bDirection = gOneCDirection[ bDirection ]; -// } +// if ( fForImage ) +// { +// bDirection = gOneCDirection[ bDirection ]; +// } break; default: - - // Uses 8 - bDirection = pCorpseDef->ubDirection; - if ( fForImage ) - { - bDirection = gOneCDirection[ bDirection ]; - } + // Uses 8 + bDirection = pCorpseDef->ubDirection; + + if ( fForImage ) + { + bDirection = gOneCDirection[ bDirection ]; + } break; } @@ -459,22 +464,22 @@ INT32 AddRottingCorpse( ROTTING_CORPSE_DEFINITION *pCorpseDef ) UINT8 ubLevelID; STRUCTURE_FILE_REF * pStructureFileRef = NULL; CHAR8 zFilename[150]; - DB_STRUCTURE_REF *pDBStructureRef; + DB_STRUCTURE_REF *pDBStructureRef; UINT8 ubLoop; INT16 sTileGridNo; DB_STRUCTURE_TILE ** ppTile; - UINT16 usStructIndex; + UINT16 usStructIndex; UINT32 uiDirectionUseFlag; - if ( pCorpseDef->sGridNo == NOWHERE ) - { - return( -1 ); - } + if ( pCorpseDef->sGridNo == NOWHERE ) + { + return( -1 ); + } - if ( pCorpseDef->ubType == NO_CORPSE ) - { - return( -1 ); - } + if ( pCorpseDef->ubType == NO_CORPSE ) + { + return( -1 ); + } if( ( iIndex = GetFreeRottingCorpse() )==(-1) ) return(-1); @@ -505,20 +510,20 @@ INT32 AddRottingCorpse( ROTTING_CORPSE_DEFINITION *pCorpseDef ) // OK, AS WE ADD, CHECK FOR TOD AND DECAY APPROPRIATELY if ( ( ( GetWorldTotalMin( ) - pCorpse->def.uiTimeOfDeath ) > DELAY_UNTIL_ROTTING ) && ( pCorpse->def.ubType < ROTTING_STAGE2 ) ) { - if ( pCorpse->def.ubType <= FMERC_FALLF ) - { - // Rott! - pCorpse->def.ubType = ROTTING_STAGE2; - } + if ( pCorpse->def.ubType <= FMERC_FALLF ) + { + // Rott! + pCorpse->def.ubType = ROTTING_STAGE2; + } } - // If time of death is a few days, now, don't add at all! + // If time of death is a few days, now, don't add at all! if ( ( ( GetWorldTotalMin( ) - pCorpse->def.uiTimeOfDeath ) > DELAY_UNTIL_DONE_ROTTING ) ) - { + { - return( -1 ); - } - } + return( -1 ); + } + } // Check if on roof or not... if ( pCorpse->def.bLevel == 0 ) @@ -542,7 +547,7 @@ INT32 AddRottingCorpse( ROTTING_CORPSE_DEFINITION *pCorpseDef ) AniParams.sY = CenterY( pCorpse->def.sGridNo ); AniParams.sZ = (INT16)pCorpse->def.sHeightAdjustment; AniParams.uiUserData3 = pCorpse->def.ubDirection; - + if ( !gGameSettings.fOptions[ TOPTION_BLOOD_N_GORE ] ) { @@ -555,14 +560,14 @@ INT32 AddRottingCorpse( ROTTING_CORPSE_DEFINITION *pCorpseDef ) pCorpse->pAniTile = CreateAnimationTile( &AniParams ); - if ( pCorpse->pAniTile == NULL ) - { - pCorpse->fActivated = FALSE; - return( -1 ); - } + if ( pCorpse->pAniTile == NULL ) + { + pCorpse->fActivated = FALSE; + return( -1 ); + } // Set flag and index values - pCorpse->pAniTile->pLevelNode->uiFlags |= ( LEVELNODE_ROTTINGCORPSE ); + pCorpse->pAniTile->pLevelNode->uiFlags |= ( LEVELNODE_ROTTINGCORPSE ); pCorpse->pAniTile->pLevelNode->ubShadeLevel = gpWorldLevelData[ pCorpse->def.sGridNo ].pLandHead->ubShadeLevel; pCorpse->pAniTile->pLevelNode->ubSumLights = gpWorldLevelData[ pCorpse->def.sGridNo ].pLandHead->ubSumLights; @@ -588,7 +593,7 @@ INT32 AddRottingCorpse( ROTTING_CORPSE_DEFINITION *pCorpseDef ) if ( pCorpse->iCachedTileID == -1 ) { DeleteAniTile( pCorpse->pAniTile ); - pCorpse->fActivated = FALSE; + pCorpse->fActivated = FALSE; return( -1 ); } @@ -596,14 +601,14 @@ INT32 AddRottingCorpse( ROTTING_CORPSE_DEFINITION *pCorpseDef ) if ( !CreateCorpsePalette( pCorpse ) ) { DeleteAniTile( pCorpse->pAniTile ); - pCorpse->fActivated = FALSE; + pCorpse->fActivated = FALSE; return( -1 ); } SetRenderFlags(RENDER_FLAG_FULL); if ( pCorpse->def.usFlags & ROTTING_CORPSE_VEHICLE ) - { + { pCorpse->pAniTile->uiFlags |= ( ANITILE_FORWARD | ANITILE_LOOPING ); // Turn off pause... @@ -706,37 +711,37 @@ BOOLEAN CreateCorpsePalette( ROTTING_CORPSE *pCorpse ) bBodyTypePalette = GetBodyTypePaletteSubstitutionCode( NULL, pCorpse->def.ubBodyType, zColFilename ); // If this corpse has cammo, - if ( pCorpse->def.ubType == ROTTING_STAGE2 ) - { + if ( pCorpse->def.ubType == ROTTING_STAGE2 ) + { bBodyTypePalette = 0; - } - else if ( pCorpse->def.usFlags & ROTTING_CORPSE_USE_CAMO_PALETTE ) + } + else if ( pCorpse->def.usFlags & ROTTING_CORPSE_USE_CAMO_PALETTE ) { strcpy( zColFilename, "ANIMS\\camo.COL" ); bBodyTypePalette = 1; } - else if ( pCorpse->def.usFlags & ROTTING_CORPSE_USE_URBAN_CAMO_PALETTE ) + else if ( pCorpse->def.usFlags & ROTTING_CORPSE_USE_URBAN_CAMO_PALETTE ) { strcpy( zColFilename, "ANIMS\\urban.col" ); bBodyTypePalette = 1; } - else if ( pCorpse->def.usFlags & ROTTING_CORPSE_USE_DESERT_CAMO_PALETTE ) + else if ( pCorpse->def.usFlags & ROTTING_CORPSE_USE_DESERT_CAMO_PALETTE ) { strcpy( zColFilename, "ANIMS\\desert.col" ); bBodyTypePalette = 1; } - else if ( pCorpse->def.usFlags & ROTTING_CORPSE_USE_SNOW_CAMO_PALETTE ) + else if ( pCorpse->def.usFlags & ROTTING_CORPSE_USE_SNOW_CAMO_PALETTE ) { strcpy( zColFilename, "ANIMS\\snow.col" ); bBodyTypePalette = 1; } - else if ( pCorpse->def.usFlags & ROTTING_CORPSE_USE_STEALTH_PALETTE ) + else if ( pCorpse->def.usFlags & ROTTING_CORPSE_USE_STEALTH_PALETTE ) { strcpy( zColFilename, "ANIMS\\stealth.col" ); bBodyTypePalette = 1; } - if ( bBodyTypePalette == -1 ) + if ( bBodyTypePalette == -1 ) { // Use palette from HVOBJECT, then use substitution for pants, etc memcpy( pCorpse->p8BPPPalette, gpTileCache[ pCorpse->iCachedTileID ].pImagery->vo->pPaletteEntry, sizeof( pCorpse->p8BPPPalette ) * 256 ); @@ -778,28 +783,25 @@ BOOLEAN CreateCorpsePalette( ROTTING_CORPSE *pCorpse ) BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLEAN fCheckForLOS ) { - ROTTING_CORPSE_DEFINITION Corpse; - UINT8 ubType; - INT32 cnt; - UINT16 usItemFlags = 0; //WORLD_ITEM_DONTRENDER; - INT32 iCorpseID; - INT8 bVisible = -1; - OBJECTTYPE *pObj; - UINT8 ubNumGoo; - INT16 sNewGridNo; - OBJECTTYPE ItemObject; - - if ( pSoldier->sGridNo == NOWHERE ) { return( FALSE ); } - // ATE: Change to fix crash when item in hand - if ( gpItemPointer != NULL && gpItemPointerSoldier == pSoldier ) - { - CancelItemPointer( ); - } + ROTTING_CORPSE_DEFINITION Corpse; + UINT8 ubType; + UINT32 cnt; + UINT16 usItemFlags = 0; //WORLD_ITEM_DONTRENDER; + INT32 iCorpseID; + INT8 bVisible = -1; + OBJECTTYPE *pObj; + UINT8 ubNumGoo; + INT16 sNewGridNo; + // ATE: Change to fix crash when item in hand + if ( gpItemPointer != NULL && gpItemPointerSoldier == pSoldier ) + { + CancelItemPointer( ); + } // Setup some values! memset( &Corpse, 0, sizeof( Corpse ) ); @@ -807,7 +809,7 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE Corpse.sGridNo = pSoldier->sGridNo; Corpse.dXPos = pSoldier->dXPos; Corpse.dYPos = pSoldier->dYPos; - Corpse.bLevel = pSoldier->bLevel; + Corpse.bLevel = pSoldier->pathing.bLevel; Corpse.ubProfile = pSoldier->ubProfile; if ( Corpse.bLevel > 0 ) @@ -818,7 +820,7 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE SET_PALETTEREP_ID ( Corpse.HeadPal, pSoldier->HeadPal ); SET_PALETTEREP_ID ( Corpse.VestPal, pSoldier->VestPal ); SET_PALETTEREP_ID ( Corpse.SkinPal, pSoldier->SkinPal ); - SET_PALETTEREP_ID ( Corpse.PantsPal, pSoldier->PantsPal ); + SET_PALETTEREP_ID ( Corpse.PantsPal, pSoldier->PantsPal ); int urban = pSoldier->urbanCamo + pSoldier->wornUrbanCamo; int jungle = pSoldier->bCamo + pSoldier->wornCamo; @@ -843,32 +845,32 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE Corpse.usFlags |= ROTTING_CORPSE_USE_SNOW_CAMO_PALETTE; } - + // Determine corpse type! ubType = (UINT8)gubAnimSurfaceCorpseID[ pSoldier->ubBodyType][ pSoldier->usAnimState ]; Corpse.ubDirection = pSoldier->ubDirection; // If we are a vehicle.... only use 1 direction.... - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { Corpse.usFlags |= ROTTING_CORPSE_VEHICLE; - if ( pSoldier->ubBodyType != ICECREAMTRUCK && pSoldier->ubBodyType != HUMVEE ) - { - Corpse.ubDirection = 7; - } - else - { - Corpse.ubDirection = gb2DirectionsFrom8[ Corpse.ubDirection ]; - } + if ( pSoldier->ubBodyType != ICECREAMTRUCK && pSoldier->ubBodyType != HUMVEE ) + { + Corpse.ubDirection = 7; + } + else + { + Corpse.ubDirection = gb2DirectionsFrom8[ Corpse.ubDirection ]; + } + } + + if ( ubType == QUEEN_MONSTER_DEAD || ubType == BURNT_DEAD || ubType == EXPLODE_DEAD ) + { + Corpse.ubDirection = 7; } - if ( ubType == QUEEN_MONSTER_DEAD || ubType == BURNT_DEAD || ubType == EXPLODE_DEAD ) - { - Corpse.ubDirection = 7; - } - // ATE: If bDirection, get opposite // if ( ubType == SMERC_FALLF || ubType == MMERC_FALLF || ubType == FMERC_FALLF ) @@ -893,43 +895,43 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE bVisible = 1; } - // Not for a robot... - if ( AM_A_ROBOT( pSoldier ) ) - { + // Not for a robot... + if ( AM_A_ROBOT( pSoldier ) ) + { - } - else if ( ubType == QUEEN_MONSTER_DEAD ) - { - gTacticalStatus.fLockItemLocators = FALSE; + } + else if ( ubType == QUEEN_MONSTER_DEAD ) + { + gTacticalStatus.fLockItemLocators = FALSE; - ubNumGoo = 6 - ( gGameOptions.ubDifficultyLevel - DIF_LEVEL_EASY ); + ubNumGoo = 6 - ( gGameOptions.ubDifficultyLevel - DIF_LEVEL_EASY ); - sNewGridNo = pSoldier->sGridNo + ( WORLD_COLS * 2 ); + sNewGridNo = pSoldier->sGridNo + ( WORLD_COLS * 2 ); - for ( cnt = 0; cnt < ubNumGoo; cnt++ ) - { - CreateItem( JAR_QUEEN_CREATURE_BLOOD, 100, &ItemObject ); + for ( cnt = 0; cnt < ubNumGoo; cnt++ ) + { + CreateItem( JAR_QUEEN_CREATURE_BLOOD, 100, &gTempObject ); - AddItemToPool( sNewGridNo, &ItemObject, bVisible , pSoldier->bLevel, usItemFlags, -1 ); - } - } - else - { - // OK, Place what objects this guy was carrying on the ground! - for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ ) - { - pObj = &( pSoldier->inv[ cnt ] ); + AddItemToPool( sNewGridNo, &gTempObject, bVisible , pSoldier->pathing.bLevel, usItemFlags, -1 ); + } + } + else + { + // OK, Place what objects this guy was carrying on the ground! + for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ ) + { + pObj = &( pSoldier->inv[ cnt ] ); - if ( pObj->usItem != NOTHING ) - { - // Check if it's supposed to be dropped - if ( !( pObj->fFlags & OBJECT_UNDROPPABLE ) || pSoldier->bTeam == gbPlayerNum ) - { - // and make sure that it really is a droppable item type -// if ( !(Item[ pObj->usItem ].fFlags & ITEM_DEFAULT_UNDROPPABLE) ) - if ( !(Item[ pObj->usItem ].defaultundroppable ) ) - { - ReduceAmmoDroppedByNonPlayerSoldiers( pSoldier, cnt ); + if ( pObj->exists() == true ) + { + // Check if it's supposed to be dropped + if ( !( (*pObj).fFlags & OBJECT_UNDROPPABLE ) || pSoldier->bTeam == gbPlayerNum ) + { + // and make sure that it really is a droppable item type +// if ( !(Item[ pObj->usItem ].fFlags & ITEM_DEFAULT_UNDROPPABLE) ) + if ( !(Item[ pObj->usItem ].defaultundroppable ) ) + { + ReduceAmmoDroppedByNonPlayerSoldiers( pSoldier, cnt ); //if this soldier was an enemy // Kaiden: Added from UB's reveal all items after combat feature! if( pSoldier->bTeam == ENEMY_TEAM ) @@ -939,18 +941,18 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE if ( Item[pObj->usItem].damageable && Item[pObj->usItem].usItemClass != IC_THROWING_KNIFE ) // Madd: drop crappier items from enemies on higher difficulty levels - note the quick fix for throwing knives { - pObj->ItemData.Generic.bStatus[0] -= (gGameOptions.ubDifficultyLevel - 1) * Random(20); - pObj->ItemData.Generic.bStatus[0] = min(max(pObj->ItemData.Generic.bStatus[0],1),100); // never below 1% or above 100% + (*pObj)[0]->data.objectStatus -= (gGameOptions.ubDifficultyLevel - 1) * Random(20); + (*pObj)[0]->data.objectStatus = min(max((*pObj)[0]->data.objectStatus,1),100); // never below 1% or above 100% } } - AddItemToPool( pSoldier->sGridNo, pObj, bVisible , pSoldier->bLevel, usItemFlags, -1 ); - } - } - } - } + AddItemToPool( pSoldier->sGridNo, pObj, bVisible , pSoldier->pathing.bLevel, usItemFlags, -1 ); + } + } + } + } - DropKeysInKeyRing( pSoldier, pSoldier->sGridNo, pSoldier->bLevel, bVisible, FALSE, 0, FALSE ); + DropKeysInKeyRing( pSoldier, pSoldier->sGridNo, pSoldier->pathing.bLevel, bVisible, FALSE, 0, FALSE ); } // Make team look for items @@ -980,9 +982,9 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE } else { - RemoveSoldierFromGridNo( pSoldier ); + pSoldier->RemoveSoldierFromGridNo( ); } - + if ( ubType == NO_CORPSE ) { return( TRUE ); @@ -1068,10 +1070,7 @@ void AddCrowToCorpse( ROTTING_CORPSE *pCorpse ) return; } - // WDS - Clean up inventory handling // Put him flying over corpse pisition -// memset( &MercCreateStruct, 0, sizeof( MercCreateStruct ) ); - MercCreateStruct.initialize(); MercCreateStruct.ubProfile = NO_PROFILE; MercCreateStruct.sSectorX = gWorldSectorX; MercCreateStruct.sSectorY = gWorldSectorY; @@ -1086,30 +1085,30 @@ void AddCrowToCorpse( ROTTING_CORPSE *pCorpse ) { pSoldier = MercPtrs[ iNewIndex ]; - sGridNo = FindRandomGridNoFromSweetSpot( pSoldier, pCorpse->def.sGridNo, 2, &ubDirection ); - + sGridNo = FindRandomGridNoFromSweetSpot( pSoldier, pCorpse->def.sGridNo, 2, &ubDirection ); + if ( sGridNo != NOWHERE ) { pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; - pSoldier->usStrategicInsertionData = sGridNo; + pSoldier->usStrategicInsertionData = sGridNo; pSoldier->sInsertionGridNo = sGridNo; pSoldier->sDesiredHeight = 0; - // Add to sector - AddSoldierToSector( iNewIndex ); + // Add to sector + AddSoldierToSector( iNewIndex ); - // Change to fly animation - //sGridNo = FindRandomGridNoFromSweetSpot( pSoldier, pCorpse->def.sGridNo, 5, &ubDirection ); - //pSoldier->usUIMovementMode = CROW_FLY; - //EVENT_GetNewSoldierPath( pSoldier, sGridNo, pSoldier->usUIMovementMode ); + // Change to fly animation + //sGridNo = FindRandomGridNoFromSweetSpot( pSoldier, pCorpse->def.sGridNo, 5, &ubDirection ); + //pSoldier->usUIMovementMode = CROW_FLY; + //pSoldier->EVENT_GetNewSoldierPath( sGridNo, pSoldier->usUIMovementMode ); - // Setup action data to point back to corpse.... - pSoldier->uiPendingActionData1 = pCorpse->iID; - pSoldier->sPendingActionData2 = pCorpse->def.sGridNo; + // Setup action data to point back to corpse.... + pSoldier->aiData.uiPendingActionData1 = pCorpse->iID; + pSoldier->aiData.sPendingActionData2 = pCorpse->def.sGridNo; - pCorpse->def.bNumServicingCrows++; - } + pCorpse->def.bNumServicingCrows++; + } } @@ -1120,10 +1119,10 @@ void HandleCrowLeave( SOLDIERTYPE *pSoldier ) ROTTING_CORPSE *pCorpse; // Check if this crow is still referencing the same corpse... - pCorpse = &(gRottingCorpse[ pSoldier->uiPendingActionData1 ] ); - + pCorpse = &(gRottingCorpse[ pSoldier->aiData.uiPendingActionData1 ] ); + // Double check grindo... - if ( pSoldier->sPendingActionData2 == pCorpse->def.sGridNo ) + if ( pSoldier->aiData.sPendingActionData2 == pCorpse->def.sGridNo ) { // We have a match // Adjust crow servicing count... @@ -1146,9 +1145,9 @@ void HandleCrowFlyAway( SOLDIERTYPE *pSoldier ) pSoldier->sDesiredHeight = 100; // Change to fly animation - sGridNo = FindRandomGridNoFromSweetSpot( pSoldier, pSoldier->sGridNo, 5, &ubDirection ); + sGridNo = FindRandomGridNoFromSweetSpot( pSoldier, pSoldier->sGridNo, 5, &ubDirection ); pSoldier->usUIMovementMode = CROW_FLY; - SendGetNewSoldierPathEvent( pSoldier, sGridNo, pSoldier->usUIMovementMode ); + SendGetNewSoldierPathEvent( pSoldier, sGridNo, pSoldier->usUIMovementMode ); } @@ -1156,7 +1155,7 @@ void HandleRottingCorpses( ) { ROTTING_CORPSE *pCorpse; INT8 bNumCrows = 0; - UINT32 uiChosenCorpseID; + UINT32 uiChosenCorpseID; // Don't allow crows here if flags not set @@ -1171,10 +1170,10 @@ void HandleRottingCorpses( ) return; } - if ( gbWorldSectorZ > 0 ) - { - return; - } + if ( gbWorldSectorZ > 0 ) + { + return; + } // ATE: Check for multiple crows..... // Couint how many we have now... @@ -1184,7 +1183,7 @@ void HandleRottingCorpses( ) for (bLoop=gTacticalStatus.Team[ CIV_TEAM ].bFirstID, pSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; bLoop++, pSoldier++) { - if (pSoldier->bActive && pSoldier->bInSector && (pSoldier->bLife >= OKLIFE) && !( pSoldier->uiStatusFlags & SOLDIER_GASSED ) ) + if (pSoldier->bActive && pSoldier->bInSector && (pSoldier->stats.bLife >= OKLIFE) && !( pSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) ) { if ( pSoldier->ubBodyType == CROW ) { @@ -1194,20 +1193,20 @@ void HandleRottingCorpses( ) } } - // Once population gets down to 0, we can add more again.... - if ( bNumCrows == 0 ) - { - gTacticalStatus.fDontAddNewCrows = FALSE; - } + // Once population gets down to 0, we can add more again.... + if ( bNumCrows == 0 ) + { + gTacticalStatus.fDontAddNewCrows = FALSE; + } - if ( gTacticalStatus.fDontAddNewCrows ) - { - return; - } + if ( gTacticalStatus.fDontAddNewCrows ) + { + return; + } if ( bNumCrows >= gTacticalStatus.ubNumCrowsPossible ) { - gTacticalStatus.fDontAddNewCrows = TRUE; + gTacticalStatus.fDontAddNewCrows = TRUE; return; } @@ -1217,29 +1216,29 @@ void HandleRottingCorpses( ) return; } - // Pick one to attact a crow... + // Pick one to attact a crow... { - uiChosenCorpseID = Random( giNumRottingCorpse ); + uiChosenCorpseID = Random( giNumRottingCorpse ); pCorpse = &(gRottingCorpse[ uiChosenCorpseID ] ); - if ( pCorpse->fActivated ) - { - if ( !( pCorpse->def.usFlags & ROTTING_CORPSE_VEHICLE ) ) - { - if ( pCorpse->def.ubType == ROTTING_STAGE2 ) - { - if ( GridNoOnScreen( pCorpse->def.sGridNo ) ) - { - return; - } + if ( pCorpse->fActivated ) + { + if ( !( pCorpse->def.usFlags & ROTTING_CORPSE_VEHICLE ) ) + { + if ( pCorpse->def.ubType == ROTTING_STAGE2 ) + { + if ( GridNoOnScreen( pCorpse->def.sGridNo ) ) + { + return; + } AddCrowToCorpse( pCorpse ); AddCrowToCorpse( pCorpse ); - } - } - } - } + } + } + } + } } void MakeCorpseVisible( SOLDIERTYPE *pSoldier, ROTTING_CORPSE *pCorpse ) @@ -1251,9 +1250,9 @@ void MakeCorpseVisible( SOLDIERTYPE *pSoldier, ROTTING_CORPSE *pCorpse ) void AllMercsOnTeamLookForCorpse( ROTTING_CORPSE *pCorpse, INT8 bTeam ) { - INT32 cnt; - SOLDIERTYPE *pSoldier; - INT16 sGridNo; + INT32 cnt; + SOLDIERTYPE *pSoldier; + INT16 sGridNo; // If this cump is already visible, return if ( pCorpse->def.bVisible == 1 ) @@ -1271,11 +1270,11 @@ void AllMercsOnTeamLookForCorpse( ROTTING_CORPSE *pCorpse, INT8 bTeam ) sGridNo = pCorpse->def.sGridNo; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ bTeam ].bLastID; cnt++,pSoldier++ ) - { + { // ATE: Ok, lets check for some basic things here! - if ( pSoldier->bLife >= OKLIFE && pSoldier->sGridNo != NOWHERE && pSoldier->bActive && pSoldier->bInSector ) + if ( pSoldier->stats.bLife >= OKLIFE && pSoldier->sGridNo != NOWHERE && pSoldier->bActive && pSoldier->bInSector ) { // and we can trace a line of sight to his x,y coordinates? // (taking into account we are definitely aware of this guy now) @@ -1291,10 +1290,6 @@ void AllMercsOnTeamLookForCorpse( ROTTING_CORPSE *pCorpse, INT8 bTeam ) void MercLooksForCorpses( SOLDIERTYPE *pSoldier ) { - INT32 cnt; - INT16 sGridNo; - ROTTING_CORPSE *pCorpse; - // Should we say disgust quote? if ( ( pSoldier->usQuoteSaidFlags & SOLDIER_QUOTE_SAID_ROTTINGCORPSE ) ) { @@ -1319,6 +1314,10 @@ void MercLooksForCorpses( SOLDIERTYPE *pSoldier ) // Every so often... do a corpse quote... if ( Random( 400 ) <= 2 ) { + INT32 cnt; + INT16 sGridNo; + ROTTING_CORPSE *pCorpse; + // Loop through all corpses.... for ( cnt = 0; cnt < giNumRottingCorpse; cnt++ ) { @@ -1337,7 +1336,7 @@ void MercLooksForCorpses( SOLDIERTYPE *pSoldier ) // (taking into account we are definitely aware of this guy now) if ( SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, pCorpse->def.bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) { - TacticalCharacterDialogue( pSoldier, QUOTE_HEADSHOT ); + TacticalCharacterDialogue( pSoldier, QUOTE_HEADSHOT ); pSoldier->usQuoteSaidFlags |= SOLDIER_QUOTE_SAID_ROTTINGCORPSE; @@ -1356,8 +1355,8 @@ void MercLooksForCorpses( SOLDIERTYPE *pSoldier ) void RebuildAllCorpseShadeTables( ) { - INT32 cnt; - ROTTING_CORPSE *pCorpse; + INT32 cnt; + ROTTING_CORPSE *pCorpse; // Loop through all corpses.... for ( cnt = 0; cnt < giNumRottingCorpse; cnt++ ) @@ -1410,20 +1409,20 @@ BOOLEAN CreateCorpseShadedPalette( ROTTING_CORPSE *pCorpse, UINT32 uiBase, SGPPa pCorpse->pShades[uiBase] = Create16BPPPaletteShaded( pShadePal, gusShadeLevels[0][0], gusShadeLevels[0][1], - gusShadeLevels[0][2], TRUE); - + gusShadeLevels[0][2], TRUE); + for(uiCount=1; uiCount < 16; uiCount++) { pCorpse->pShades[uiBase+uiCount]=Create16BPPPaletteShaded( pShadePal, gusShadeLevels[uiCount][0], gusShadeLevels[uiCount][1], - gusShadeLevels[uiCount][2], FALSE); + gusShadeLevels[uiCount][2], FALSE); } return(TRUE); } -ROTTING_CORPSE *FindCorpseBasedOnStructure( INT16 sGridNo, STRUCTURE *pStructure ) +ROTTING_CORPSE *FindCorpseBasedOnStructure( INT16 sGridNo, STRUCTURE *pStructure ) { LEVELNODE *pLevelNode; ROTTING_CORPSE *pCorpse = NULL; @@ -1437,7 +1436,7 @@ ROTTING_CORPSE *FindCorpseBasedOnStructure( INT16 sGridNo, STRUCTURE *pStructur } pLevelNode = pLevelNode->pNext; } - + if ( pLevelNode != NULL ) { // Get our corpse.... @@ -1454,9 +1453,9 @@ void CorpseHit( INT16 sGridNo, UINT16 usStructureID ) STRUCTURE *pStructure, *pBaseStructure; ROTTING_CORPSE *pCorpse = NULL; INT16 sBaseGridNo; - + pStructure = FindStructureByID( sGridNo, usStructureID ); - + // Get base.... pBaseStructure = FindBaseStructure( pStructure ); @@ -1493,7 +1492,7 @@ void CorpseHit( INT16 sGridNo, UINT16 usStructureID ) } // PLay a sound.... - PlayJA2Sample( (UINT32)( BULLET_IMPACT_2 ), RATE_11025, SoundVolume( MIDVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); + PlayJA2Sample( (UINT32)( BULLET_IMPACT_2 ), RATE_11025, SoundVolume( MIDVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); #endif } @@ -1505,9 +1504,9 @@ void VaporizeCorpse( INT16 sGridNo, UINT16 usStructureID ) ROTTING_CORPSE *pCorpse = NULL; INT16 sBaseGridNo; ANITILE_PARAMS AniParams; - + pStructure = FindStructureByID( sGridNo, usStructureID ); - + // Get base.... pBaseStructure = FindBaseStructure( pStructure ); @@ -1526,7 +1525,7 @@ void VaporizeCorpse( INT16 sGridNo, UINT16 usStructureID ) } if ( pCorpse->def.usFlags & ROTTING_CORPSE_VEHICLE ) - { + { return; } @@ -1542,14 +1541,14 @@ void VaporizeCorpse( INT16 sGridNo, UINT16 usStructureID ) AniParams.sX = CenterX( sBaseGridNo ); AniParams.sY = CenterY( sBaseGridNo ); AniParams.sZ = (INT16)pCorpse->def.sHeightAdjustment; - + strcpy( AniParams.zCachedFile, "TILECACHE\\GEN_BLOW.STI" ); CreateAnimationTile( &AniParams ); // Remove.... RemoveCorpse( pCorpse->iID ); SetRenderFlags( RENDER_FLAG_FULL ); - + if ( pCorpse->def.bLevel == 0 ) { // Set some blood...... @@ -1558,16 +1557,16 @@ void VaporizeCorpse( INT16 sGridNo, UINT16 usStructureID ) } // PLay a sound.... - PlayJA2Sample( (UINT32)( BODY_EXPLODE_1 ), RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); - + PlayJA2Sample( (UINT32)( BODY_EXPLODE_1 ), RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); + } INT16 FindNearestAvailableGridNoForCorpse( ROTTING_CORPSE_DEFINITION *pDef, INT8 ubRadius ) { - INT16 sSweetGridNo; - INT16 sTop, sBottom; - INT16 sLeft, sRight; - INT16 cnt1, cnt2, cnt3; + INT16 sSweetGridNo; + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2, cnt3; INT16 sGridNo; INT32 uiRange, uiLowestRange = 999999; INT16 sLowestGridNo=0; @@ -1579,7 +1578,7 @@ INT16 FindNearestAvailableGridNoForCorpse( ROTTING_CORPSE_DEFINITION *pDef, INT8 STRUCTURE_FILE_REF * pStructureFileRef = NULL; CHAR8 zFilename[150]; UINT8 ubBestDirection=0; - BOOLEAN fSetDirection = FALSE; + BOOLEAN fSetDirection = FALSE; cnt3 = 0; @@ -1592,25 +1591,22 @@ INT16 FindNearestAvailableGridNoForCorpse( ROTTING_CORPSE_DEFINITION *pDef, INT8 sSweetGridNo = pDef->sGridNo; - //Save AI pathing vars. changing the distlimit restricts how + //Save AI pathing vars. changing the distlimit restricts how //far away the pathing will consider. ubSaveNPCAPBudget = gubNPCAPBudget; ubSaveNPCDistLimit = gubNPCDistLimit; gubNPCAPBudget = 0; gubNPCDistLimit = ubRadius; - // WDS - Clean up inventory handling //create dummy soldier, and use the pathing to determine which nearby slots are //reachable. - //memset( &soldier, 0, SIZEOF_SOLDIERTYPE ); - soldier.initialize(); soldier.bTeam = 1; soldier.sGridNo = sSweetGridNo; sTop = ubRadius; sBottom = -ubRadius; - sLeft = - ubRadius; - sRight = ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; //clear the mapelements of potential residue MAPELEMENT_REACHABLE flags //in the square region. @@ -1626,11 +1622,11 @@ INT16 FindNearestAvailableGridNoForCorpse( ROTTING_CORPSE_DEFINITION *pDef, INT8 } } - //Now, find out which of these gridnos are reachable + //Now, find out which of these gridnos are reachable //(use the fake soldier and the pathing settings) FindBestPath( &soldier, NOWHERE, 0, WALKING, COPYREACHABLE, 0 ); - - uiLowestRange = 999999; + + uiLowestRange = 999999; for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) { @@ -1643,10 +1639,10 @@ INT16 FindNearestAvailableGridNoForCorpse( ROTTING_CORPSE_DEFINITION *pDef, INT8 gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE ) { // Go on sweet stop - if ( NewOKDestination( &soldier, sGridNo, TRUE, soldier.bLevel ) ) + if ( NewOKDestination( &soldier, sGridNo, TRUE, soldier.pathing.bLevel ) ) { BOOLEAN fDirectionFound = FALSE; - BOOLEAN fCanSetDirection = FALSE; + BOOLEAN fCanSetDirection = FALSE; // Check each struct in each direction if ( pStructureFileRef == NULL ) @@ -1675,7 +1671,7 @@ INT16 FindNearestAvailableGridNoForCorpse( ROTTING_CORPSE_DEFINITION *pDef, INT8 if ( fCanSetDirection ) { ubBestDirection = (UINT8)cnt3; - fSetDirection = TRUE; + fSetDirection = TRUE; } sLowestGridNo = sGridNo; uiLowestRange = uiRange; @@ -1704,10 +1700,10 @@ INT16 FindNearestAvailableGridNoForCorpse( ROTTING_CORPSE_DEFINITION *pDef, INT8 BOOLEAN IsValidDecapitationCorpse( ROTTING_CORPSE *pCorpse ) { - if ( pCorpse->def.fHeadTaken ) - { - return( FALSE ); - } + if ( pCorpse->def.fHeadTaken ) + { + return( FALSE ); + } return( gbCorpseValidForDecapitation[ pCorpse->def.ubType ] ); } @@ -1738,9 +1734,8 @@ ROTTING_CORPSE *GetCorpseAtGridNo( INT16 sGridNo, INT8 bLevel ) } -void DecapitateCorpse( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel ) +void DecapitateCorpse( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel ) { - OBJECTTYPE Object; ROTTING_CORPSE *pCorpse; ROTTING_CORPSE_DEFINITION CorpseDef; UINT16 usHeadIndex = HEAD_1; @@ -1762,7 +1757,7 @@ void DecapitateCorpse( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel ) // Add new one... CorpseDef.ubType = gDecapitatedCorpse[ CorpseDef.ubType ]; - pCorpse->def.fHeadTaken = TRUE; + pCorpse->def.fHeadTaken = TRUE; if ( CorpseDef.ubType != 0 ) { @@ -1803,13 +1798,13 @@ void DecapitateCorpse( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel ) } - CreateItem( usHeadIndex, 100, &Object ); - AddItemToPool( sGridNo, &Object, INVISIBLE, 0, 0, 0 ); + CreateItem( usHeadIndex, 100, &gTempObject ); + AddItemToPool( sGridNo, &gTempObject, INVISIBLE, 0, 0, 0 ); // All teams lok for this... NotifySoldiersToLookforItems( ); } - + } @@ -1817,10 +1812,10 @@ void GetBloodFromCorpse( SOLDIERTYPE *pSoldier ) { ROTTING_CORPSE *pCorpse; INT8 bObjSlot; - OBJECTTYPE Object = {}; + //OBJECTTYPE Object = {}; // OK, get corpse - pCorpse = &( gRottingCorpse[ pSoldier->uiPendingActionData4 ] ); + pCorpse = &( gRottingCorpse[ pSoldier->aiData.uiPendingActionData4 ] ); bObjSlot = FindObj( pSoldier, JAR ); @@ -1831,23 +1826,23 @@ void GetBloodFromCorpse( SOLDIERTYPE *pSoldier ) case INFANTMONSTER_DEAD: // Can get creature blood.... - CreateItem( JAR_CREATURE_BLOOD, 100, &Object ); + CreateItem( JAR_CREATURE_BLOOD, 100, &gTempObject ); break; - case QUEEN_MONSTER_DEAD: - CreateItem( JAR_QUEEN_CREATURE_BLOOD, 100, &Object ); + case QUEEN_MONSTER_DEAD: + CreateItem( JAR_QUEEN_CREATURE_BLOOD, 100, &gTempObject ); break; default: - CreateItem( JAR_HUMAN_BLOOD, 100, &Object ); + CreateItem( JAR_HUMAN_BLOOD, 100, &gTempObject ); break; } if ( bObjSlot != NO_SLOT ) { - SwapObjs( pSoldier, bObjSlot, &Object, TRUE ); + SwapObjs( pSoldier, bObjSlot, &gTempObject, TRUE ); } } @@ -1855,23 +1850,23 @@ void GetBloodFromCorpse( SOLDIERTYPE *pSoldier ) void ReduceAmmoDroppedByNonPlayerSoldiers( SOLDIERTYPE *pSoldier, INT32 iInvSlot ) { - OBJECTTYPE *pObj; - Assert( pSoldier ); - Assert( ( iInvSlot >= 0 ) && ( iInvSlot < NUM_INV_SLOTS ) ); + Assert( ( iInvSlot >= 0 ) && ( iInvSlot < (INT32)pSoldier->inv.size() ) ); - pObj = &( pSoldier->inv[ iInvSlot ] ); // if not a player soldier if ( pSoldier->bTeam != gbPlayerNum ) { + OBJECTTYPE *pObj = &( pSoldier->inv[ iInvSlot ] ); + // if it's ammo if ( Item[ pObj->usItem ].usItemClass == IC_AMMO ) { //don't drop all the clips, just a random # of them between 1 and how many there are pObj->ubNumberOfObjects = ( UINT8 ) ( 1 + Random( pObj->ubNumberOfObjects ) ); // recalculate the weight - pObj->ubWeight = CalculateObjectWeight( pObj ); + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //pObj->ubWeight = CalculateObjectWeight( pObj ); } } } @@ -1880,69 +1875,69 @@ void ReduceAmmoDroppedByNonPlayerSoldiers( SOLDIERTYPE *pSoldier, INT32 iInvSlot void LookForAndMayCommentOnSeeingCorpse( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubLevel ) { ROTTING_CORPSE *pCorpse; - INT8 bToleranceThreshold = 0; - INT32 cnt; - SOLDIERTYPE *pTeamSoldier; + INT8 bToleranceThreshold = 0; + INT32 cnt; + SOLDIERTYPE *pTeamSoldier; - if ( QuoteExp_HeadShotOnly[ pSoldier->ubProfile ] == 1 ) - { - return; - } + if ( QuoteExp_HeadShotOnly[ pSoldier->ubProfile ] == 1 ) + { + return; + } - pCorpse = GetCorpseAtGridNo( sGridNo, ubLevel ); + pCorpse = GetCorpseAtGridNo( sGridNo, ubLevel ); - if ( pCorpse == NULL ) - { - return; - } + if ( pCorpse == NULL ) + { + return; + } if ( pCorpse->def.ubType != ROTTING_STAGE2 ) - { - return; - } + { + return; + } - // If servicing qrows, tolerance is now 1 - if ( pCorpse->def.bNumServicingCrows > 0 ) - { - bToleranceThreshold++; - } + // If servicing qrows, tolerance is now 1 + if ( pCorpse->def.bNumServicingCrows > 0 ) + { + bToleranceThreshold++; + } - // Check tolerance - if ( pSoldier->bCorpseQuoteTolerance <= bToleranceThreshold ) - { - // Say quote... - TacticalCharacterDialogue( pSoldier, QUOTE_HEADSHOT ); + // Check tolerance + if ( pSoldier->bCorpseQuoteTolerance <= bToleranceThreshold ) + { + // Say quote... + TacticalCharacterDialogue( pSoldier, QUOTE_HEADSHOT ); - BeginMultiPurposeLocator( sGridNo, ubLevel, FALSE ); + BeginMultiPurposeLocator( sGridNo, ubLevel, FALSE ); - // Reset values.... - pSoldier->bCorpseQuoteTolerance = (INT8)( Random(3) + 1 ); + // Reset values.... + pSoldier->bCorpseQuoteTolerance = (INT8)( Random(3) + 1 ); - // 50% chance of adding 1 to other mercs.... - if ( Random( 2 ) == 1 ) - { - // IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED! - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + // 50% chance of adding 1 to other mercs.... + if ( Random( 2 ) == 1 ) + { + // IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED! + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - // look for all mercs on the same team, - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) - { - // ATE: Ok, lets check for some basic things here! - if ( pTeamSoldier->bLife >= OKLIFE && pTeamSoldier->sGridNo != NOWHERE && pTeamSoldier->bActive && pTeamSoldier->bInSector ) - { - pTeamSoldier->bCorpseQuoteTolerance++; - } - } - } - } + // look for all mercs on the same team, + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) + { + // ATE: Ok, lets check for some basic things here! + if ( pTeamSoldier->stats.bLife >= OKLIFE && pTeamSoldier->sGridNo != NOWHERE && pTeamSoldier->bActive && pTeamSoldier->bInSector ) + { + pTeamSoldier->bCorpseQuoteTolerance++; + } + } + } + } } INT16 GetGridNoOfCorpseGivenProfileID( UINT8 ubProfileID ) { - INT32 cnt; - ROTTING_CORPSE *pCorpse; + INT32 cnt; + ROTTING_CORPSE *pCorpse; // Loop through all corpses.... for ( cnt = 0; cnt < giNumRottingCorpse; cnt++ ) @@ -1951,14 +1946,14 @@ INT16 GetGridNoOfCorpseGivenProfileID( UINT8 ubProfileID ) if ( pCorpse->fActivated ) { - if ( pCorpse->def.ubProfile == ubProfileID ) - { - return( pCorpse->def.sGridNo ); - } - } - } + if ( pCorpse->def.ubProfile == ubProfileID ) + { + return( pCorpse->def.sGridNo ); + } + } + } - return( NOWHERE ); + return( NOWHERE ); } void DecayRottingCorpseAIWarnings( void ) @@ -1975,7 +1970,7 @@ void DecayRottingCorpseAIWarnings( void ) pCorpse->def.ubAIWarningValue--; } } - + } UINT8 GetNearestRottingCorpseAIWarning( INT16 sGridNo ) diff --git a/Tactical/Rotting Corpses.h b/Tactical/Rotting Corpses.h index 7747325f..1fb67afc 100644 --- a/Tactical/Rotting Corpses.h +++ b/Tactical/Rotting Corpses.h @@ -35,7 +35,7 @@ enum RottingCorpseDefines FMERC_FALL, FMERC_FALLF, - // CIVS + // CIVS M_DEAD1, K_DEAD1, H_DEAD1, @@ -62,12 +62,12 @@ enum RottingCorpseDefines TANK2_DEAD, HUMMER_DEAD, ICECREAM_DEAD, - QUEEN_MONSTER_DEAD, - ROBOT_DEAD, - BURNT_DEAD, - EXPLODE_DEAD, + QUEEN_MONSTER_DEAD, + ROBOT_DEAD, + BURNT_DEAD, + EXPLODE_DEAD, - NUM_CORPSES, + NUM_CORPSES, } ; @@ -109,8 +109,8 @@ typedef struct INT8 bVisible; INT8 bNumServicingCrows; UINT8 ubProfile; - BOOLEAN fHeadTaken; - UINT8 ubAIWarningValue; + BOOLEAN fHeadTaken; + UINT8 ubAIWarningValue; UINT8 ubFiller[ 12 ]; @@ -176,7 +176,7 @@ extern UINT8 gb4DirectionsFrom8[8]; ROTTING_CORPSE *GetCorpseAtGridNo( INT16 sGridNo , INT8 bLevel ); BOOLEAN IsValidDecapitationCorpse( ROTTING_CORPSE *pCorpse ); -void DecapitateCorpse( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel ); +void DecapitateCorpse( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel ); void GetBloodFromCorpse( SOLDIERTYPE *pSoldier ); diff --git a/Tactical/ShopKeeper Interface.cpp b/Tactical/ShopKeeper Interface.cpp index 8fedb68a..323a4fa7 100644 --- a/Tactical/ShopKeeper Interface.cpp +++ b/Tactical/ShopKeeper Interface.cpp @@ -56,6 +56,7 @@ #endif #include "BuildDefines.h" +#include // temp struct skirgbcolor @@ -143,16 +144,16 @@ SKIRGBCOLOR SkiGlowColorsA[]={ #define SKI_TOTAL_COST_X (SCREEN_X_OFFSET + 9) #define SKI_TOTAL_COST_Y (SCREEN_Y_OFFSET + 162)//159 #define SKI_TOTAL_COST_WIDTH 73 - + #define SKI_TOTAL_VALUE_X SKI_TOTAL_COST_X #define SKI_TOTAL_VALUE_Y (SCREEN_Y_OFFSET + 291)//268 #define SKI_TOTAL_VALUE_WIDTH SKI_TOTAL_COST_WIDTH - + #define SKI_PLAYERS_CURRENT_BALANCE_X SKI_TOTAL_COST_X #define SKI_PLAYERS_CURRENT_BALANCE_Y (SCREEN_Y_OFFSET + 235) #define SKI_PLAYERS_CURRENT_BALANCE_WIDTH SKI_TOTAL_COST_WIDTH #define SKI_PLAYERS_CURRENT_BALANCE_OFFSET_TO_VALUE SCREEN_Y_OFFSET + 265 - + #define SKI_PAGE_X (SCREEN_X_OFFSET + 112) #define SKI_PAGE_Y (SCREEN_Y_OFFSET + 70) #define SKI_PAGE_WIDTH 45 @@ -161,7 +162,7 @@ SKIRGBCOLOR SkiGlowColorsA[]={ //Number of Inventory slots #define SKI_NUM_ARMS_DEALERS_INV_SLOTS 15 -#define SKI_NUM_ARMS_DEALERS_INV_ROWS 3 +#define SKI_NUM_ARMS_DEALERS_INV_ROWS 3 #define SKI_NUM_ARMS_DEALERS_INV_COLS 5 //Inventory Slots size and offsets @@ -259,12 +260,12 @@ SKIRGBCOLOR SkiGlowColorsA[]={ #define SKI_MERCS_MONEY_Y SKI_ATM_PANEL_Y + 11 -#define SKI_MODE_TEXT_X SKI_TRANSFER_STRING_X +#define SKI_MODE_TEXT_X SKI_TRANSFER_STRING_X #define SKI_MODE_TEXT_Y SKI_ATM_PANEL_Y + 27 #define SKI_MODE_TEXT_WIDTH SKI_TRANSFER_STRING_WIDTH -#define SKI_MAX_AMOUNT_OF_ITEMS_DEALER_CAN_REPAIR_AT_A_TIME 4 +#define SKI_MAX_AMOUNT_OF_ITEMS_DEALER_CAN_REPAIR_AT_A_TIME 4 #define SKI_DEALERS_RANDOM_QUOTE_DELAY 15000 #define SKI_DEALERS_RANDOM_QUOTE_DELAY_INCREASE_RATE 5000 @@ -272,8 +273,6 @@ SKIRGBCOLOR SkiGlowColorsA[]={ #define DELAY_FOR_SHOPKEEPER_IDLE_QUOTE 20000 #define CHANCE_FOR_SHOPKEEPER_IDLE_QUOTE 40 -#define MAX_SUBOBJECTS_PER_OBJECT max( MAX_OBJECTS_PER_SLOT, ( 2 + MAX_ATTACHMENTS ) ) // (2nd part is main item, ammo/payload, and 4 attachments) - #define REALLY_BADLY_DAMAGED_THRESHOLD 30 #define REPAIR_DELAY_IN_HOURS 6 @@ -306,7 +305,7 @@ INT32 giSKIMessageBox=-1; INT8 gbSelectedArmsDealerID = -1; //Contains the enum value for the currently selected arms dealer -//the quote that is in progress, in certain circumstances, we don't want queuing of related but different quotes +//the quote that is in progress, in certain circumstances, we don't want queuing of related but different quotes INT32 giShopKeepDialogueEventinProgress = - 1; //OBJECTTYPE gpSkiItemPointer; @@ -319,7 +318,6 @@ BOOLEAN gfDoEvaluationAfterOpening = FALSE; typedef struct { - UINT32 uiNumDistinctInventoryItems; UINT8 ubCurrentPage; UINT8 ubNumberOfPages; @@ -333,12 +331,12 @@ SELECTED_ARMS_DEALERS_STATS gSelectArmsDealerInfo; //This pointer is used to store the inventory the arms dealer has for sale -INVENTORY_IN_SLOT *gpTempDealersInventory=NULL; +std::vector gpTempDealersInventory; INVENTORY_IN_SLOT ArmsDealerOfferArea[ SKI_NUM_TRADING_INV_SLOTS ]; INVENTORY_IN_SLOT PlayersOfferArea[ SKI_NUM_TRADING_INV_SLOTS ]; -OBJECTTYPE gSubObject[ MAX_SUBOBJECTS_PER_OBJECT ]; +std::vector subObjects; BOOLEAN gfHavePurchasedItemsFromTony = FALSE; @@ -396,7 +394,7 @@ extern SOLDIERTYPE *gpItemDescSoldier; extern MOUSE_REGION gItemDescAttachmentRegions[MAX_ATTACHMENTS]; extern MOUSE_REGION gInvDesc; extern BOOLEAN gfSMDisableForItems; -extern OBJECTTYPE *gpItemDescObject; +extern OBJECTTYPE *gpItemDescObject; extern void HandleShortCutExitState( void ); extern UINT8 gubSelectSMPanelToMerc; extern INT32 giItemDescAmmoButton; @@ -440,13 +438,14 @@ UINT32 guiLastTimeDealerSaidNormalEvaluationQuote = 0; BOOLEAN gfSkiDisplayDropItemToGroundText = FALSE; -typedef struct +class ITEM_TO_ADD_AFTER_SKI_OPEN { +public: + ITEM_TO_ADD_AFTER_SKI_OPEN() {initialize();}; + void initialize() {fActive = FALSE; ItemObject.initialize();}; BOOLEAN fActive; - OBJECTTYPE ItemObject; - INT8 bPreviousInvPos; - -} ITEM_TO_ADD_AFTER_SKI_OPEN; + OBJECTTYPE ItemObject; +}; ITEM_TO_ADD_AFTER_SKI_OPEN gItemToAdd; @@ -550,14 +549,13 @@ void InitializeShopKeeper( BOOLEAN fResetPage ); void CalculateFirstItemIndexOnPage( ); void DisplayArmsDealerCurrentInventoryPage( ); BOOLEAN DetermineArmsDealersSellingInventory( ); -void StoreObjectsInNextFreeDealerInvSlot( UINT16 usItemIndex, SPECIAL_ITEM_INFO *pSpclItemInfo, INT16 sSpecialItemElement, UINT8 ubHowMany, UINT8 ubOwner ); -void AddItemsToTempDealerInventory(UINT16 usItemIndex, SPECIAL_ITEM_INFO *pSpclItemInfo, INT16 sSpecialItemElement, UINT8 ubHowMany, UINT8 ubOwner ); -BOOLEAN RepairIsDone(UINT16 usItemIndex, UINT8 ubElement); +void StoreObjectsInNextFreeDealerInvSlot( DEALER_SPECIAL_ITEM* pSpecial, std::vector& pInventory, UINT8 ubOwner ); +BOOLEAN RepairIsDone(DEALER_SPECIAL_ITEM* pSpecial); UINT32 DisplayInvSlot( UINT8 ubSlotNum, UINT16 usItemIndex, UINT16 usPosX, UINT16 usPosY, OBJECTTYPE *ItemObject, BOOLEAN fHatchedOut, UINT8 ubItemArea ); void DisplayArmsDealerOfferArea(); -INT8 AddItemToArmsDealerOfferArea( INVENTORY_IN_SLOT* pInvSlot, INT8 bSlotIdInOtherLocation ); -BOOLEAN RemoveItemFromArmsDealerOfferArea( INT8 bSlotId, BOOLEAN fKeepItem ); +INT8 AddItemToArmsDealerOfferArea( INVENTORY_IN_SLOT* pInvSlot, INT16 bSlotIdInOtherLocation ); +BOOLEAN RemoveItemFromArmsDealerOfferArea( INT16 bSlotId, BOOLEAN fKeepItem ); void SetSkiRegionHelpText( INVENTORY_IN_SLOT *pInv, MOUSE_REGION* pRegion, UINT8 ubScreenArea ); void SetSkiFaceRegionHelpText( INVENTORY_IN_SLOT *pInv, MOUSE_REGION* pRegion, UINT8 ubScreenArea ); void RestoreTacticalBackGround(); @@ -630,12 +628,12 @@ void ShopkeeperAddItemToPool( INT16 sGridNo, OBJECTTYPE *pObject, INT8 bVisibl void IfMercOwnedCopyItemToMercInv( INVENTORY_IN_SLOT *pInv ); void IfMercOwnedRemoveItemFromMercInv( INVENTORY_IN_SLOT *pInv ); -void IfMercOwnedRemoveItemFromMercInv2( UINT8 ubOwnerProfileId, INT8 bOwnerSlotId ); +void IfMercOwnedRemoveItemFromMercInv2( UINT8 ubOwnerProfileId, INT16 bOwnerSlotId ); void SplitComplexObjectIntoSubObjects( OBJECTTYPE *pComplexObject ); -void CountSubObjectsInObject( OBJECTTYPE *pComplexObject, UINT8 *pubTotalSubObjects, UINT8 *pubRepairableSubObjects, UINT8 *pubNonRepairableSubObjects ); -BOOLEAN AddObjectForEvaluation(OBJECTTYPE *pObject, UINT8 ubOwnerProfileId, INT8 bOwnerSlotId, BOOLEAN fFirstOne ); -BOOLEAN OfferObjectToDealer( OBJECTTYPE *pComplexObject, UINT8 ubOwnerProfileId, INT8 bOwnerSlotId ); +void CountSubObjectsInObject( OBJECTTYPE *pComplexObject, UINT8 *pubRepairableSubObjects, UINT8 *pubNonRepairableSubObjects ); +BOOLEAN AddObjectForEvaluation(OBJECTTYPE *pObject, UINT8 ubOwnerProfileId, INT16 bOwnerSlotId, BOOLEAN fFirstOne ); +BOOLEAN OfferObjectToDealer( OBJECTTYPE *pComplexObject, UINT8 ubOwnerProfileId, INT16 bOwnerSlotId ); BOOLEAN SKITryToReturnInvToOwnerOrCurrentMerc( INVENTORY_IN_SLOT *pInv ); BOOLEAN SKITryToAddInvToMercsInventory( INVENTORY_IN_SLOT *pInv, SOLDIERTYPE *pSoldier ); @@ -644,7 +642,7 @@ void ExitSKIRequested(); void EvaluateItemAddedToPlayersOfferArea( INT8 bSlotID, BOOLEAN fFirstOne ); void ResetAllQuoteSaidFlags(); -INVENTORY_IN_SLOT *GetPtrToOfferSlotWhereThisItemIs( UINT8 ubProfileID, INT8 bInvPocket ); +INVENTORY_IN_SLOT *GetPtrToOfferSlotWhereThisItemIs( UINT8 ubProfileID, INT16 bInvPocket ); void DealWithItemsStillOnTheTable(); void ReturnItemToPlayerSomehow( INVENTORY_IN_SLOT *pInvSlot, SOLDIERTYPE *pDropSoldier ); @@ -661,7 +659,7 @@ UINT32 EvaluateInvSlot( INVENTORY_IN_SLOT *pInvSlot ); void BuildItemHelpTextString( CHAR16 sString[], INVENTORY_IN_SLOT *pInv, UINT8 ubScreenArea ); void BuildRepairTimeString( CHAR16 sString[], UINT32 uiTimeInMinutesToFixItem ); -void BuildDoneWhenTimeString( CHAR16 sString[], UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubElement ); +void BuildDoneWhenTimeString( CHAR16 sString[], UINT8 ubArmsDealer, INVENTORY_IN_SLOT* pObject ); void DisableAllDealersInventorySlots( void ); void EnableAllDealersInventorySlots( void ); @@ -679,6 +677,35 @@ BOOLEAN gfTestDisplayDealerCash = FALSE; void DisplayAllDealersCash(); #endif; + +void INVENTORY_IN_SLOT::initialize() +{ + ItemObject.initialize(); + fActive = 0; + sItemIndex = 0; + uiFlags = 0; + ubLocationOfObject = 0; + bSlotIdInOtherLocation = 0; + ubIdOfMercWhoOwnsTheItem = 0; + uiItemPrice = 0; + uiRepairDoneTime = 0; +} + +INVENTORY_IN_SLOT& INVENTORY_IN_SLOT::operator=(OLD_INVENTORY_IN_SLOT_101& src) +{ + this->ItemObject = src.oldItemObject; + this->fActive = src.fActive; + this->sItemIndex = src.sItemIndex; + this->uiFlags = src.uiFlags; + this->ubLocationOfObject = src.ubLocationOfObject; + this->bSlotIdInOtherLocation = src.bSlotIdInOtherLocation; + this->ubIdOfMercWhoOwnsTheItem = src.ubIdOfMercWhoOwnsTheItem; + this->uiItemPrice = src.uiItemPrice; + this->uiRepairDoneTime = 0; + return *this; +} + + //ppp @@ -734,13 +761,13 @@ UINT32 ShopKeeperScreenHandle() // Check for any newly added items... - if ( gpSMCurrentMerc->fCheckForNewlyAddedItems ) + if ( gpSMCurrentMerc->flags.fCheckForNewlyAddedItems ) { // Startup any newly added items.... CheckForAnyNewlyAddedItems( gpSMCurrentMerc ); - gpSMCurrentMerc->fCheckForNewlyAddedItems = FALSE; + gpSMCurrentMerc->flags.fCheckForNewlyAddedItems = FALSE; } - + HandleShopKeeperInterface(); @@ -760,10 +787,10 @@ UINT32 ShopKeeperScreenHandle() gubSkiDirtyLevel = SKI_DIRTY_LEVEL0; } - // render buttons marked dirty + // render buttons marked dirty //ATM: DisableSMPpanelButtonsWhenInShopKeeperInterface( FALSE ); - RenderButtons( ); + RenderButtons( ); // render help SaveBackgroundRects( ); @@ -808,8 +835,8 @@ UINT32 ShopKeeperScreenShutdown() // -// -// +// +// @@ -822,6 +849,7 @@ BOOLEAN EnterShopKeeperInterface() CHAR8 zTemp[32]; VSURFACE_DESC vs_desc; + //ADB if we are here, we must be able to talk with an extended ear (CheckIfRadioIsEquipped()) //but if we are physically too far away, we don't have extended arms! @@ -831,7 +859,7 @@ BOOLEAN EnterShopKeeperInterface() { //so now we know we are too far away to trade, so instead of just quitting, //either post a message or run to the guy like HandleTalkInit does - if( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) ) + if( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, L"Unable to interact with shopkeeper during combat" ); return( FALSE ); @@ -867,12 +895,12 @@ BOOLEAN EnterShopKeeperInterface() gfNPCCircularDistLimit = FALSE; // Now walkup to talk.... - pSoldier->ubPendingAction = MERC_TALK; - pSoldier->uiPendingActionData1 = pShopkeeper->ubID; - pSoldier->ubPendingActionAnimCount = 0; + pSoldier->aiData.ubPendingAction = MERC_TALK; + pSoldier->aiData.uiPendingActionData1 = pShopkeeper->ubID; + pSoldier->aiData.ubPendingActionAnimCount = 0; // WALK UP TO DEST FIRST - EVENT_InternalGetNewSoldierPath( pSoldier, sGoodGridNo, pSoldier->usUIMovementMode , TRUE , pSoldier->fNoAPToFinishMove ); + pSoldier->EVENT_InternalGetNewSoldierPath(sGoodGridNo, pSoldier->usUIMovementMode , TRUE , pSoldier->flags.fNoAPToFinishMove ); return( FALSE ); } @@ -909,7 +937,7 @@ BOOLEAN EnterShopKeeperInterface() } //Check to make sure the inventory is null ( should always be null if we are just coming in to the SKI ) - Assert( gpTempDealersInventory == NULL ); + Assert( gpTempDealersInventory.empty() == true ); //Reinitialize the team panel to be the SM panel SetCurrentInterfacePanel( SM_PANEL ); @@ -941,7 +969,7 @@ BOOLEAN EnterShopKeeperInterface() } - + /* ATM: // load the Main trade screen backgroiund image @@ -958,7 +986,7 @@ ATM: pSoldier = MercPtrs[ ubCnt ]; if( pSoldier->bActive && ( pSoldier->ubProfile != NO_PROFILE ) && - !(pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) ) + !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) ) { // remember whose face is in this slot gubArrayOfEmployedMercs[ gubNumberMercsInArray ] = pSoldier->ubProfile; @@ -1009,20 +1037,20 @@ ATM: /* //Evaluate: //Evaluate button - guiSKI_EvaluateButton = CreateIconAndTextButton( guiSKI_EvaluateButtonImage, SKI_Text[SKI_TEXT_EVALUATE], SKI_BUTTON_FONT, - SKI_BUTTON_COLOR, DEFAULT_SHADOW, - SKI_BUTTON_COLOR, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, + guiSKI_EvaluateButton = CreateIconAndTextButton( guiSKI_EvaluateButtonImage, SKI_Text[SKI_TEXT_EVALUATE], SKI_BUTTON_FONT, + SKI_BUTTON_COLOR, DEFAULT_SHADOW, + SKI_BUTTON_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, SKI_EVALUATE_BUTTON_X, SKI_EVALUATE_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnSKI_EvaluateButtonCallback); SpecifyDisabledButtonStyle( guiSKI_EvaluateButton, DISABLED_STYLE_HATCHED ); */ //Transaction button - guiSKI_TransactionButton = CreateIconAndTextButton( guiSKI_TransactionButtonImage, SKI_Text[SKI_TEXT_TRANSACTION], SKI_BUTTON_FONT, - SKI_BUTTON_COLOR, DEFAULT_SHADOW, - SKI_BUTTON_COLOR, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, + guiSKI_TransactionButton = CreateIconAndTextButton( guiSKI_TransactionButtonImage, SKI_Text[SKI_TEXT_TRANSACTION], SKI_BUTTON_FONT, + SKI_BUTTON_COLOR, DEFAULT_SHADOW, + SKI_BUTTON_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, SKI_TRANSACTION_BUTTON_X, SKI_TRANSACTION_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnSKI_TransactionButtonCallback); SpecifyDisabledButtonStyle( guiSKI_TransactionButton, DISABLED_STYLE_HATCHED ); @@ -1035,10 +1063,10 @@ ATM: //Done button - guiSKI_DoneButton = CreateIconAndTextButton( guiSKI_DoneButtonImage, SKI_Text[SKI_TEXT_DONE], SKI_BUTTON_FONT, - SKI_BUTTON_COLOR, DEFAULT_SHADOW, - SKI_BUTTON_COLOR, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, + guiSKI_DoneButton = CreateIconAndTextButton( guiSKI_DoneButtonImage, SKI_Text[SKI_TEXT_DONE], SKI_BUTTON_FONT, + SKI_BUTTON_COLOR, DEFAULT_SHADOW, + SKI_BUTTON_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, SKI_DONE_BUTTON_X, SKI_DONE_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+10, DEFAULT_MOVE_CALLBACK, BtnSKI_DoneButtonCallback); SpecifyDisabledButtonStyle( guiSKI_DoneButton, DISABLED_STYLE_HATCHED ); @@ -1047,7 +1075,7 @@ ATM: //Blanket the entire screen MSYS_DefineRegion( &gSKI_EntireScreenMouseRegions, 0, 0, (SCREEN_WIDTH - 1), (SCREEN_HEIGHT - INV_INTERFACE_HEIGHT), MSYS_PRIORITY_HIGH-2, - CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK); + CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK); MSYS_AddRegion( &gSKI_EntireScreenMouseRegions ); @@ -1057,7 +1085,7 @@ ATM: //ATM: //Blanket the tactical buttons where the ATM will go MSYS_DefineRegion( &gShopKeeperCoverTacticalButtonMouseRegion, SKI_ATM_PANEL_X, SKI_ATM_PANEL_Y, (UINT16)(SKI_ATM_PANEL_X+SKI_ATM_PANEL_WIDTH), (UINT16)(SKI_ATM_PANEL_Y+SKI_ATM_PANEL_HEIGHT), MSYS_PRIORITY_HIGH-1, - CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK); + CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK); MSYS_AddRegion( &gSKI_EntireScreenMouseRegions ); */ @@ -1085,9 +1113,11 @@ ATM: //ATM: // CreateSkiAtmButtons(); - memset( ArmsDealerOfferArea, 0, sizeof( INVENTORY_IN_SLOT ) * SKI_NUM_TRADING_INV_SLOTS ); - memset( PlayersOfferArea, 0, sizeof( INVENTORY_IN_SLOT ) * SKI_NUM_TRADING_INV_SLOTS ); - + for (int x = 0; x < SKI_NUM_TRADING_INV_SLOTS; ++x) + { + ArmsDealerOfferArea[x].initialize(); + PlayersOfferArea[x].initialize(); + } if( ArmsDealerInfo[ gbSelectedArmsDealerID ].ubTypeOfArmsDealer == ARMS_DEALER_REPAIRS ) { @@ -1098,13 +1128,13 @@ ATM: //Setup the currently selected arms dealer InitializeShopKeeper( TRUE ); - + //Set the flag indicating that we are in the shop keeper interface guiTacticalInterfaceFlags |= INTERFACE_SHOPKEEP_INTERFACE; - memset( &gMoveingItem, 0, sizeof( INVENTORY_IN_SLOT ) ); + gMoveingItem.initialize(); memset( &gfCommonQuoteUsedThisSession, FALSE, sizeof( gfCommonQuoteUsedThisSession ) ); @@ -1134,28 +1164,19 @@ ATM: if( gItemToAdd.fActive ) { - BOOLEAN fAddedOK = FALSE; - INT8 bSlotNum = gItemToAdd.bPreviousInvPos; - + bool fAddedOK = false; //if this is NOT a repair dealer or he is is but there is enough space in the player's offer area // (you can't be out of space if it isn't a repairman, only they can fill it up with repaired items!) if( ( ArmsDealerInfo[ gbSelectedArmsDealerID ].ubTypeOfArmsDealer != ARMS_DEALER_REPAIRS ) || ( CountNumberOfItemsInThePlayersOfferArea( ) < SKI_NUM_ARMS_DEALERS_INV_SLOTS ) ) { - // if we're supposed to store the original pocket #, but that pocket still holds more of these - if ( ( bSlotNum != -1 ) && ( gpSMCurrentMerc->inv[ bSlotNum ].ubNumberOfObjects > 0 ) ) + if ( OfferObjectToDealer( &(gItemToAdd.ItemObject), gpSMCurrentMerc->ubProfile, NO_SLOT ) ) { - // then we can't store the pocket #, because our system can't return stacked objects - bSlotNum = -1; - } - - if ( OfferObjectToDealer( &(gItemToAdd.ItemObject), gpSMCurrentMerc->ubProfile, bSlotNum ) ) - { - fAddedOK = TRUE; + fAddedOK = true; } } - if ( fAddedOK ) + if ( fAddedOK == true ) { // evaluate it gfDoEvaluationAfterOpening = TRUE; @@ -1163,12 +1184,12 @@ ATM: else { //add the item back to the current PC into the slot it came from - CopyObj( &gItemToAdd.ItemObject, &Menptr[ gpSMCurrentMerc->ubID ].inv[ gItemToAdd.bPreviousInvPos ] ); + //ADB screw slot, slot is (used to be, before it was deleted) only ever, so autoplace it + AutoPlaceObject(&Menptr[ gpSMCurrentMerc->ubID ], &gItemToAdd.ItemObject, FALSE); } //Clear the contents of the structure - memset( &gItemToAdd, 0, sizeof( ITEM_TO_ADD_AFTER_SKI_OPEN ) ); - gItemToAdd.fActive = FALSE; + gItemToAdd.initialize(); } // Dirty the bottom panel @@ -1183,8 +1204,8 @@ ATM: //Region to allow the user to drop items to the ground MSYS_DefineRegion( &gArmsDealersDropItemToGroundMouseRegions, SKI_DROP_ITEM_TO_GROUND_START_X, SKI_DROP_ITEM_TO_GROUND_START_Y, SCREEN_WIDTH - 1, SCREEN_HEIGHT - INV_INTERFACE_HEIGHT, MSYS_PRIORITY_HIGH, - CURSOR_NORMAL, SelectArmsDealersDropItemToGroundMovementRegionCallBack, SelectArmsDealersDropItemToGroundRegionCallBack ); -// CURSOR_NORMAL, MSYS_NO_CALLBACK, SelectArmsDealersDropItemToGroundRegionCallBack ); + CURSOR_NORMAL, SelectArmsDealersDropItemToGroundMovementRegionCallBack, SelectArmsDealersDropItemToGroundRegionCallBack ); +// CURSOR_NORMAL, MSYS_NO_CALLBACK, SelectArmsDealersDropItemToGroundRegionCallBack ); MSYS_AddRegion( &gArmsDealersDropItemToGroundMouseRegions ); gfSkiDisplayDropItemToGroundText = FALSE; @@ -1300,11 +1321,7 @@ BOOLEAN ExitShopKeeperInterface() DestroySkiInventorySlotMouseRegions( ); //if there is a temp inventory array, destroy it - if( gpTempDealersInventory ) - { - MemFree( gpTempDealersInventory ); - gpTempDealersInventory = NULL; - } + gpTempDealersInventory.clear(); //Set the flag indicating that we are NOT in the shop keeper interface guiTacticalInterfaceFlags &= ~INTERFACE_SHOPKEEP_INTERFACE; @@ -1364,19 +1381,12 @@ void HandleShopKeeperInterface() if ( InItemStackPopup( ) ) { - if ( fInterfacePanelDirty == DIRTYLEVEL2 ) - { - RenderItemStackPopup( TRUE ); - } - else - { - RenderItemStackPopup( FALSE ); - } + RenderItemStackPopup( ( BOOLEAN )( fInterfacePanelDirty == DIRTYLEVEL2 ) ); } // handle check if enough on the table HandleCheckIfEnoughOnTheTable( ); - + // Render view window fInterfacePanelDirty = DIRTYLEVEL2; RenderRadarScreen( ); @@ -1387,7 +1397,8 @@ void HandleShopKeeperInterface() } RenderClock( CLOCK_X, CLOCK_Y ); - RenderTownIDString( ); + // CHRISL: Added X,Y parameters to allow control of TownID string placement. + RenderTownIDString( CLOCK_X, (CLOCK_Y - 29) ); //ATM: // RenderSkiAtmPanel(); @@ -1410,7 +1421,7 @@ void HandleShopKeeperInterface() BOOLEAN fFirstOne = TRUE; gfDoEvaluationAfterOpening = FALSE; - + for( iCounter = 0; iCounter < SKI_NUM_TRADING_INV_SLOTS; iCounter++ ) { if( PlayersOfferArea[ iCounter ].fActive ) @@ -1471,13 +1482,13 @@ BOOLEAN RenderShopKeeperInterface() GetVideoObject(&hPixHandle, guiMainTradeScreenImage ); BltVideoObject(FRAME_BUFFER, hPixHandle, 0,SKI_MAIN_BACKGROUND_X, SKI_MAIN_BACKGROUND_Y, VO_BLT_SRCTRANSPARENCY,NULL); - //Display the Title - DrawTextToScreen( SKI_Text[ SKI_TEXT_MERCHADISE_IN_STOCK ], SKI_MAIN_TITLE_X, SKI_MAIN_TITLE_Y, SKI_MAIN_TITLE_WIDTH, SKI_TITLE_FONT, SKI_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + //Display the Title + DrawTextToScreen( SKI_Text[ SKI_TEXT_MERCHADISE_IN_STOCK ], SKI_MAIN_TITLE_X, SKI_MAIN_TITLE_Y, SKI_MAIN_TITLE_WIDTH, SKI_TITLE_FONT, SKI_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); //if the dealer repairs if( ArmsDealerInfo[ gbSelectedArmsDealerID ].ubTypeOfArmsDealer == ARMS_DEALER_REPAIRS ) { - //Display the Repair cost text + //Display the Repair cost text DisplayWrappedString( SKI_TOTAL_COST_X, SKI_TOTAL_COST_Y, SKI_TOTAL_COST_WIDTH, 2, SKI_LABEL_FONT, SKI_TITLE_COLOR, SKI_Text[ SKI_TEXT_REPAIR_COST ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); } else @@ -1533,7 +1544,8 @@ BOOLEAN RenderShopKeeperInterface() //Render the clock and the town name RenderClock( CLOCK_X, CLOCK_Y ); - RenderTownIDString( ); + // CHRISL: Added X,Y parameters to allow control of TownID string placement. + RenderTownIDString( CLOCK_X, (CLOCK_Y - 29) ); // RenderTacticalInterface( ); // RenderSMPanel( &fDirty ); @@ -1553,7 +1565,7 @@ void RestoreTacticalBackGround() GetVideoSurface( &hDestVSurface, guiRENDERBUFFER ); GetVideoSurface( &hSrcVSurface, guiCornerWhereTacticalIsStillSeenImage ); - + // Top SrcRect.iLeft = SKI_TACTICAL_BACKGROUND_START_X; //0; SrcRect.iTop = SKI_TACTICAL_BACKGROUND_START_Y; //0; @@ -1574,7 +1586,7 @@ void GetShopKeeperInterfaceUserInput() POINT MousePos; GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! + ScreenToClient(ghWindow, &MousePos); // In window coords! while( DequeueEvent( &Event ) ) { @@ -1728,7 +1740,7 @@ void BtnSKI_InvPageDownButtonCallback(GUI_BUTTON *btn,INT32 reason) InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} /* //Evaluate: @@ -1788,7 +1800,7 @@ void BtnSKI_DoneButtonCallback(GUI_BUTTON *btn,INT32 reason) } InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); -} +} void CreateSkiInventorySlotMouseRegions( ) { @@ -1806,7 +1818,7 @@ void CreateSkiInventorySlotMouseRegions( ) for(x=0; x= gSelectArmsDealerInfo.uiNumDistinctInventoryItems ) + if( ubSelectedInvSlot >= gpTempDealersInventory.size() ) return; //if there are any items still there - if( gpTempDealersInventory[ ubSelectedInvSlot ].ItemObject.ubNumberOfObjects > 0 ) + if( gpTempDealersInventory[ ubSelectedInvSlot ].ItemObject.exists() == true ) { //If the item type has not already been placed if( !( gpTempDealersInventory[ ubSelectedInvSlot ].uiFlags & ARMS_INV_ITEM_SELECTED ) ) @@ -1979,11 +1991,11 @@ void SelectDealersInventoryRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason //if the shift key is being pressed, remove them all if( gfKeyState[ SHIFT ] ) { - gpTempDealersInventory[ ubSelectedInvSlot ].ItemObject.ubNumberOfObjects = 0; + DeleteObj(&gpTempDealersInventory[ ubSelectedInvSlot ].ItemObject); } else { - gpTempDealersInventory[ ubSelectedInvSlot ].ItemObject.ubNumberOfObjects --; + gpTempDealersInventory[ ubSelectedInvSlot ].ItemObject.RemoveObjectsFromStack(1); } gubSkiDirtyLevel = SKI_DIRTY_LEVEL2; @@ -2004,11 +2016,9 @@ void SelectDealersInventoryRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ubNumToMove = 1; } - //Reduce the number in dealer's inventory - gpTempDealersInventory[ ubSelectedInvSlot ].ItemObject.ubNumberOfObjects -= ubNumToMove; - //Increase the number in dealer's offer area - ArmsDealerOfferArea[ gpTempDealersInventory[ ubSelectedInvSlot ].bSlotIdInOtherLocation ].ItemObject.ubNumberOfObjects += ubNumToMove; - + //Reduce the number in dealer's inventory and Increase the number in dealer's offer area + ArmsDealerOfferArea[ gpTempDealersInventory[ ubSelectedInvSlot ].bSlotIdInOtherLocation ].ItemObject.ForceAddObjectsToStack( + gpTempDealersInventory[ ubSelectedInvSlot ].ItemObject, ubNumToMove); gubSkiDirtyLevel = SKI_DIRTY_LEVEL2; } } @@ -2018,13 +2028,16 @@ void SelectDealersInventoryRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason { UINT8 ubSelectedInvSlot = (UINT8)MSYS_GetRegionUserData( pRegion, 0 ); - if( gpTempDealersInventory == NULL ) + if( gpTempDealersInventory.empty() == true ) return; ubSelectedInvSlot += gSelectArmsDealerInfo.ubFirstItemIndexOnPage; //if the selected slot is above any inventory we have, return - if( ubSelectedInvSlot >= gSelectArmsDealerInfo.uiNumDistinctInventoryItems ) + if( ubSelectedInvSlot >= gpTempDealersInventory.size() ) + return; + + if(gpTempDealersInventory[ ubSelectedInvSlot ].ItemObject.exists() == false) return; //DEF: @@ -2038,23 +2051,20 @@ void SelectDealersInventoryRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason DeleteItemDescriptionBox( ); } - - -/* //if the item has been seleceted if( gpTempDealersInventory[ ubSelectedInvSlot ].uiFlags & ARMS_INV_ITEM_SELECTED ) { //Check to see it there is more then 1 item in the location - if( ArmsDealerOfferArea[ gpTempDealersInventory[ ubSelectedInvSlot ].bSlotIdInOtherLocation ].ItemObject.ubNumberOfObjects > 0 ) + if( ArmsDealerOfferArea[ gpTempDealersInventory[ ubSelectedInvSlot ].bSlotIdInOtherLocation ].ItemObject.exists() == true ) { - //Increase the number in the dealer inventory - gpTempDealersInventory[ ubSelectedInvSlot ].ItemObject.ubNumberOfObjects ++; - //Decrease the number in the dealer offer area - ArmsDealerOfferArea[ gpTempDealersInventory[ ubSelectedInvSlot ].bSlotIdInOtherLocation ].ItemObject.ubNumberOfObjects--; + ArmsDealerOfferArea[ gpTempDealersInventory[ ubSelectedInvSlot ].bSlotIdInOtherLocation ].ItemObject.MoveThisObjectTo(gTempObject, 1); + + //Increase the number in the dealer inventory + gpTempDealersInventory[ ubSelectedInvSlot ].ItemObject.AddObjectsToStack(gTempObject); //if there is nothing left in the arms dealer offer area - if( ArmsDealerOfferArea[ gpTempDealersInventory[ ubSelectedInvSlot ].bSlotIdInOtherLocation ].ItemObject.ubNumberOfObjects == 0 ) + if( ArmsDealerOfferArea[ gpTempDealersInventory[ ubSelectedInvSlot ].bSlotIdInOtherLocation ].ItemObject.exists() == false ) { RemoveItemFromArmsDealerOfferArea( gpTempDealersInventory[ ubSelectedInvSlot ].bSlotIdInOtherLocation, FALSE ); } @@ -2063,8 +2073,7 @@ void SelectDealersInventoryRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason gubSkiDirtyLevel = SKI_DIRTY_LEVEL2; } } -*/ - } + } } @@ -2074,10 +2083,10 @@ void SelectDealersInventoryMovementRegionCallBack(MOUSE_REGION * pRegion, INT32 UINT8 ubSelectedInvSlot = (UINT8)MSYS_GetRegionUserData( pRegion, 0 ); ubSelectedInvSlot += gSelectArmsDealerInfo.ubFirstItemIndexOnPage; - if( gpTempDealersInventory == NULL ) + if( gpTempDealersInventory.empty() == true ) return; - if( ubSelectedInvSlot >= gSelectArmsDealerInfo.uiNumDistinctInventoryItems ) + if( ubSelectedInvSlot >= gpTempDealersInventory.size() ) return; if (iReason & MSYS_CALLBACK_REASON_INIT) @@ -2235,9 +2244,9 @@ void SelectDealersOfferSlotsRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason IfMercOwnedCopyItemToMercInv( &gMoveingItem ); - memcpy( &TempSlot, &ArmsDealerOfferArea[ ubSelectedInvSlot ], sizeof( INVENTORY_IN_SLOT ) ); - memcpy( &ArmsDealerOfferArea[ ubSelectedInvSlot ], &gMoveingItem, sizeof( INVENTORY_IN_SLOT ) ); - memcpy( &gMoveingItem, &TempSlot, sizeof( INVENTORY_IN_SLOT ) ); + TempSlot = ArmsDealerOfferArea[ ubSelectedInvSlot ]; + ArmsDealerOfferArea[ ubSelectedInvSlot ] = gMoveingItem; + gMoveingItem = TempSlot; IfMercOwnedRemoveItemFromMercInv( &gMoveingItem ); @@ -2258,8 +2267,7 @@ void SelectDealersOfferSlotsRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason else // multiple items there, SHIFT isn't being pressed { // remove only one at a time - ArmsDealerOfferArea[ ubSelectedInvSlot ].ItemObject.ubNumberOfObjects--; - gpTempDealersInventory[ ArmsDealerOfferArea[ ubSelectedInvSlot ].bSlotIdInOtherLocation ].ItemObject.ubNumberOfObjects++; + gpTempDealersInventory[ ArmsDealerOfferArea[ ubSelectedInvSlot ].bSlotIdInOtherLocation ].ItemObject.ForceAddObjectsToStack(ArmsDealerOfferArea[ ubSelectedInvSlot ].ItemObject, 1); } gubSkiDirtyLevel = SKI_DIRTY_LEVEL2; @@ -2331,9 +2339,9 @@ void SelectPlayersOfferSlotsRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason IfMercOwnedCopyItemToMercInv( &gMoveingItem ); - memcpy( &TempSlot, &PlayersOfferArea[ ubSelectedInvSlot ], sizeof( INVENTORY_IN_SLOT ) ); - memcpy( &PlayersOfferArea[ ubSelectedInvSlot ], &gMoveingItem, sizeof( INVENTORY_IN_SLOT ) ); - memcpy( &gMoveingItem, &TempSlot, sizeof( INVENTORY_IN_SLOT ) ); + TempSlot = PlayersOfferArea[ ubSelectedInvSlot ]; + PlayersOfferArea[ ubSelectedInvSlot ] = gMoveingItem; + gMoveingItem = TempSlot; IfMercOwnedRemoveItemFromMercInv( &gMoveingItem ); @@ -2346,8 +2354,8 @@ void SelectPlayersOfferSlotsRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason { //Since money is always evaluated PlayersOfferArea[ ubSelectedInvSlot ].uiFlags |= ARMS_INV_PLAYERS_ITEM_HAS_VALUE; - PlayersOfferArea[ ubSelectedInvSlot ].uiItemPrice = PlayersOfferArea[ ubSelectedInvSlot ].ItemObject.ItemData.Money.bMoneyStatus; - } + PlayersOfferArea[ ubSelectedInvSlot ].uiItemPrice = PlayersOfferArea[ ubSelectedInvSlot ].ItemObject[0]->data.money.uiMoneyAmount; + } } else // slot is empty { @@ -2407,7 +2415,7 @@ void SelectSkiInventoryMovementAreaRegionCallBack(MOUSE_REGION * pRegion, INT32 else if( iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { - } + } } @@ -2431,39 +2439,30 @@ void EnterShopKeeperInterfaceScreen( UINT8 ubArmsDealer ) void InitializeShopKeeper( BOOLEAN fResetPage ) -{ +{ // update time player last dealt with him gArmsDealerStatus[ gbSelectedArmsDealerID ].uiTimePlayerLastInSKI = GetWorldTotalMin(); + gpTempDealersInventory.clear(); + //Get the number of distinct items in the inventory - gSelectArmsDealerInfo.uiNumDistinctInventoryItems = CountDistinctItemsInArmsDealersInventory( gbSelectedArmsDealerID ); + //Create the shopkeeper's temp inventory + DetermineArmsDealersSellingInventory( ); - // If there are any items in the dealer's inventory - if( gSelectArmsDealerInfo.uiNumDistinctInventoryItems > 0 ) - { - //Create the shopkeeper's temp inventory - DetermineArmsDealersSellingInventory( ); - -/* No longer necessary. ARM - //Some of the number might have changed in DetermineArmsDealersSellingInventory(), recalc the values - gSelectArmsDealerInfo.uiNumDistinctInventoryItems = CountDistinctItemsInArmsDealersInventory( gbSelectedArmsDealerID ); -*/ - } - - gSelectArmsDealerInfo.ubNumberOfPages = (UINT8)( gSelectArmsDealerInfo.uiNumDistinctInventoryItems / SKI_NUM_ARMS_DEALERS_INV_SLOTS ); - if( gSelectArmsDealerInfo.uiNumDistinctInventoryItems % 15 != 0 ) + gSelectArmsDealerInfo.ubNumberOfPages = (UINT8)( gpTempDealersInventory.size() / SKI_NUM_ARMS_DEALERS_INV_SLOTS ); + if( gpTempDealersInventory.size() % 15 != 0 ) gSelectArmsDealerInfo.ubNumberOfPages += 1; //Should we reset the current inventory page being displayed - if( gSelectArmsDealerInfo.uiNumDistinctInventoryItems == 0 ) + if( gpTempDealersInventory.empty() == true ) gSelectArmsDealerInfo.ubCurrentPage = 0; else { if( fResetPage ) { - if( gSelectArmsDealerInfo.uiNumDistinctInventoryItems == 0 ) + if( gpTempDealersInventory.empty() == true ) gSelectArmsDealerInfo.ubCurrentPage = 0; else gSelectArmsDealerInfo.ubCurrentPage = 1; @@ -2475,13 +2474,13 @@ void InitializeShopKeeper( BOOLEAN fResetPage ) gSelectArmsDealerInfo.ubCurrentPage = 1; } - else if( gSelectArmsDealerInfo.uiNumDistinctInventoryItems != 0 ) + else if( gpTempDealersInventory.empty() == false ) gSelectArmsDealerInfo.ubCurrentPage = 1; } //if there is no inventory - if( gSelectArmsDealerInfo.uiNumDistinctInventoryItems == 0 ) + if( gpTempDealersInventory.empty() == true ) { gSelectArmsDealerInfo.ubCurrentPage = 0; gSelectArmsDealerInfo.ubNumberOfPages = 0; @@ -2525,7 +2524,7 @@ void DisplayArmsDealerCurrentInventoryPage( ) usPosY = SKI_ARMS_DEALERS_INV_START_Y; //if there is any inventory - if( gpTempDealersInventory != NULL ) + if( gpTempDealersInventory.empty() == false ) { if( gubSkiDirtyLevel != SKI_DIRTY_LEVEL0 ) { @@ -2539,16 +2538,16 @@ void DisplayArmsDealerCurrentInventoryPage( ) RestoreExternBackgroundRect( SKI_ARMS_DEALERS_INV_START_X, SKI_ARMS_DEALERS_INV_START_Y, 370, 107 ); //Display the current inventory page - DrawTextToScreen( SKI_Text[ SKI_TEXT_PAGE ], SKI_PAGE_X, (UINT16)(SKI_PAGE_Y+3), SKI_PAGE_WIDTH, SKI_LABEL_FONT, SKI_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DrawTextToScreen( SKI_Text[ SKI_TEXT_PAGE ], SKI_PAGE_X, (UINT16)(SKI_PAGE_Y+3), SKI_PAGE_WIDTH, SKI_LABEL_FONT, SKI_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); //Display the Current Page number uiFontHeight = GetFontHeight( SKI_LABEL_FONT ); swprintf( zTemp, L"%d/%d", gSelectArmsDealerInfo.ubCurrentPage, gSelectArmsDealerInfo.ubNumberOfPages ); - DrawTextToScreen( zTemp, SKI_PAGE_X, (UINT16)(SKI_PAGE_Y+uiFontHeight+6), SKI_PAGE_WIDTH, SKI_LABEL_FONT, SKI_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DrawTextToScreen( zTemp, SKI_PAGE_X, (UINT16)(SKI_PAGE_Y+uiFontHeight+6), SKI_PAGE_WIDTH, SKI_LABEL_FONT, SKI_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); } //Display all the items for the current page - for( usCnt=gSelectArmsDealerInfo.ubFirstItemIndexOnPage; ( ( usCntusHeight; usWidth = (UINT32)pTrav->usWidth; - sCenX = usPosX + 7 + (INT16)( abs( (long) (SKI_INV_WIDTH - 3 - usWidth) ) / 2 ) - pTrav->sOffsetX; + sCenX = usPosX + 7 + (INT16)( abs( (long)(SKI_INV_WIDTH - 3 - usWidth) ) / 2 ) - pTrav->sOffsetX; sCenY = usPosY + (INT16)( abs( (long) (SKI_INV_HEIGHT - usHeight) ) / 2 ) - pTrav->sOffsetY; @@ -2710,7 +2708,7 @@ UINT32 DisplayInvSlot( UINT8 ubSlotNum, UINT16 usItemIndex, UINT16 usPosX, UINT1 //if the item belongs to a merc if( PlayersOfferArea[ ubSlotNum ].ubIdOfMercWhoOwnsTheItem != NO_PROFILE ) { - //Display the face of the merc + //Display the face of the merc fDisplayMercFace = TRUE; ubMercID = PlayersOfferArea[ ubSlotNum ].ubIdOfMercWhoOwnsTheItem; } @@ -2725,7 +2723,7 @@ UINT32 DisplayInvSlot( UINT8 ubSlotNum, UINT16 usItemIndex, UINT16 usPosX, UINT1 { if( ArmsDealerInfo[ gbSelectedArmsDealerID ].ubTypeOfArmsDealer != ARMS_DEALER_REPAIRS ) { - if( fHatchedOut && pItemObject->ubNumberOfObjects == 0 ) + if( fHatchedOut && pItemObject->exists() == false ) { uiItemCost = 0; } @@ -2737,23 +2735,17 @@ UINT32 DisplayInvSlot( UINT8 ubSlotNum, UINT16 usItemIndex, UINT16 usPosX, UINT1 } else // UNDER REPAIR { - UINT8 ubElement; - UINT32 uiTimeInMinutesToFixItem=0; - //display the length of time needed to repair the item uiItemCost = 0; //Get the length of time needed to fix the item - Assert( gpTempDealersInventory[ ubSlotNum ].sSpecialItemElement != -1); - ubElement = (UINT8) gpTempDealersInventory[ ubSlotNum ].sSpecialItemElement; - - BuildDoneWhenTimeString( zTemp, gbSelectedArmsDealerID, usItemIndex, ubElement ); + BuildDoneWhenTimeString( zTemp, gbSelectedArmsDealerID, &(gpTempDealersInventory[ ubSlotNum ]) ); DrawTextToScreen( zTemp, (UINT16)(usPosX+SKI_INV_PRICE_OFFSET_X), (UINT16)(usPosY+SKI_INV_PRICE_OFFSET_Y), SKI_INV_SLOT_WIDTH, SKI_ITEM_DESC_FONT, SKI_ITEM_PRICE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); //if the item belongs to a merc if( gpTempDealersInventory[ ubSlotNum ].ubIdOfMercWhoOwnsTheItem != NO_PROFILE ) { - //Display the face of the merc + //Display the face of the merc fDisplayMercFace = TRUE; ubMercID = gpTempDealersInventory[ ubSlotNum ].ubIdOfMercWhoOwnsTheItem; } @@ -2780,19 +2772,17 @@ UINT32 DisplayInvSlot( UINT8 ubSlotNum, UINT16 usItemIndex, UINT16 usPosX, UINT1 swprintf( zTemp, L"%d", uiItemCost ); InsertCommasForDollarFigure( zTemp ); InsertDollarSignInToString( zTemp ); - DrawTextToScreen( zTemp, (UINT16)(usPosX+SKI_INV_PRICE_OFFSET_X), (UINT16)(usPosY+SKI_INV_PRICE_OFFSET_Y), SKI_INV_SLOT_WIDTH, SKI_ITEM_DESC_FONT, SKI_ITEM_PRICE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DrawTextToScreen( zTemp, (UINT16)(usPosX+SKI_INV_PRICE_OFFSET_X), (UINT16)(usPosY+SKI_INV_PRICE_OFFSET_Y), SKI_INV_SLOT_WIDTH, SKI_ITEM_DESC_FONT, SKI_ITEM_PRICE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); } //if the there is more then 1 or if the item is stackable and some of it has been bought and only 1 remains -// if( pItemObject->ubNumberOfObjects > 1 || Item[ usItemIndex ].usItemClass == IC_AMMO ) -// if( pItemObject->ubNumberOfObjects > 1 || Item[ usItemIndex ].ubPerPocket > 1 ) if( ( pItemObject->ubNumberOfObjects > 1 ) || - ( ( pItemObject->ubNumberOfObjects == 1 ) && DealerItemIsSafeToStack( usItemIndex ) && + ( ( pItemObject->ubNumberOfObjects == 1 ) && ( ubItemArea == ARMS_DEALER_INVENTORY ) && ( gpTempDealersInventory[ ubSlotNum ].uiFlags & ARMS_INV_ITEM_SELECTED ) ) ) { swprintf( zTemp, L"x%d", pItemObject->ubNumberOfObjects ); - DrawTextToScreen( zTemp, (UINT16)(usPosX+SKI_ITEM_NUMBER_TEXT_OFFSET_X), (UINT16)(usPosY+SKI_ITEM_NUMBER_TEXT_OFFSET_Y), SKI_ITEM_NUMBER_TEXT_WIDTH, SKIT_NUMBER_FONT, SKI_ITEM_PRICE_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); + DrawTextToScreen( zTemp, (UINT16)(usPosX+SKI_ITEM_NUMBER_TEXT_OFFSET_X), (UINT16)(usPosY+SKI_ITEM_NUMBER_TEXT_OFFSET_Y), SKI_ITEM_NUMBER_TEXT_WIDTH, SKIT_NUMBER_FONT, SKI_ITEM_PRICE_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); } //if we are to display the face @@ -2814,21 +2804,29 @@ UINT32 DisplayInvSlot( UINT8 ubSlotNum, UINT16 usItemIndex, UINT16 usPosX, UINT1 { //Display the '*' in the bottom right corner of the square swprintf( zTemp, L"*" ); - DrawTextToScreen( zTemp, (UINT16)(usPosX+SKI_ATTACHMENT_SYMBOL_X_OFFSET), (UINT16)(usPosY+SKI_ATTACHMENT_SYMBOL_Y_OFFSET), 0, TINYFONT1, FONT_GREEN, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( zTemp, (UINT16)(usPosX+SKI_ATTACHMENT_SYMBOL_X_OFFSET), (UINT16)(usPosY+SKI_ATTACHMENT_SYMBOL_Y_OFFSET), 0, TINYFONT1, FONT_GREEN, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + } + + // CHRISL: if item is LBENODE + else if( (UsingNewInventorySystem() == true) && pItemObject->HasAnyActiveLBEs() == true) + { + //Display the '*' in the bottom right corner of the square + swprintf( zTemp, L"*" ); + DrawTextToScreen( zTemp, (UINT16)(usPosX+SKI_ATTACHMENT_SYMBOL_X_OFFSET), (UINT16)(usPosY+SKI_ATTACHMENT_SYMBOL_Y_OFFSET), 0, TINYFONT1, FONT_BLUE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); } // Display 'JAMMED' if it's jammed - if ( pItemObject->ItemData.Gun.bGunAmmoStatus < 0 ) + if ( (*pItemObject)[0]->data.gun.bGunAmmoStatus < 0 ) { swprintf( zTemp, TacticalStr[ JAMMED_ITEM_STR ] ); VarFindFontCenterCoordinates( usPosX, usPosY, SKI_INV_SLOT_WIDTH, SKI_INV_HEIGHT, TINYFONT1, &sCenX, &sCenY, zTemp ); - DrawTextToScreen( zTemp, sCenX, sCenY, SKI_INV_SLOT_WIDTH, TINYFONT1, FONT_RED, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( zTemp, sCenX, sCenY, SKI_INV_SLOT_WIDTH, TINYFONT1, FONT_RED, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); } else if ( fPrintRepaired ) { swprintf( zTemp, SKI_Text[ SKI_TEXT_REPAIRED ] ); VarFindFontCenterCoordinates( usPosX, usPosY, SKI_INV_SLOT_WIDTH, SKI_INV_HEIGHT, TINYFONT1, &sCenX, &sCenY, zTemp ); - DrawTextToScreen( zTemp, sCenX, sCenY, SKI_INV_SLOT_WIDTH, TINYFONT1, FONT_RED, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( zTemp, sCenX, sCenY, SKI_INV_SLOT_WIDTH, TINYFONT1, FONT_RED, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); } if( fHatchedOut ) @@ -2845,251 +2843,196 @@ UINT32 DisplayInvSlot( UINT8 ubSlotNum, UINT16 usItemIndex, UINT16 usPosX, UINT1 BOOLEAN DetermineArmsDealersSellingInventory( ) { - UINT16 usItemIndex; - UINT8 ubElement; - DEALER_SPECIAL_ITEM *pSpecialItem; - BOOLEAN fAddSpecialItem; - SPECIAL_ITEM_INFO SpclItemInfo; - - - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("DEF: DetermineArmsDealer") ); - - //if there is an old inventory, delete it - if( gpTempDealersInventory ) - { - MemFree( gpTempDealersInventory ); - gpTempDealersInventory = NULL; - } + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("DEF: DetermineArmsDealersSellingInventory") ); //allocate memory to hold the inventory in memory - gpTempDealersInventory = (INVENTORY_IN_SLOT *) MemAlloc( sizeof( INVENTORY_IN_SLOT ) * gSelectArmsDealerInfo.uiNumDistinctInventoryItems ); - if( gpTempDealersInventory == NULL ) - { - Assert( 0 ); - return(FALSE); - } - memset( gpTempDealersInventory, 0, sizeof( INVENTORY_IN_SLOT ) * gSelectArmsDealerInfo.uiNumDistinctInventoryItems ); - - + gpTempDealersInventory.clear(); guiNextFreeInvSlot = 0; //loop through the dealer's permanent inventory items, adding them all to the temp inventory list - for( usItemIndex=1; usItemIndex 0) + if ( iter->ItemIsInInventory() == false) { + ++iter; + continue; + } + + bool increment = true; + if (ItemIsSpecial(*iter) == false) { + StoreObjectsInNextFreeDealerInvSlot( &(*iter), gpTempDealersInventory, gbSelectedArmsDealerID ); + } + else { - // if there are any items in perfect condition - if( gArmsDealersInventory[ gbSelectedArmsDealerID ][ usItemIndex ].ubPerfectItems > 0 ) + //if the object has attachments, or is damaged, or otherwise special, then it is not stacked + bool fAddSpecialItem = true; + bool underRepair = false; + bool repaired = false; + + if( iter->IsUnderRepair() == true ) { - // create just ONE dealer inventory box for them all. - // create item info describing a perfect item - SetSpecialItemInfoToDefaults( &SpclItemInfo ); - // no special element index - it's "perfect" - AddItemsToTempDealerInventory(usItemIndex, &SpclItemInfo, -1, gArmsDealersInventory[ gbSelectedArmsDealerID ][ usItemIndex ].ubPerfectItems, NO_PROFILE ); + underRepair = true; + //if the repairs are done + if( iter->uiRepairDoneTime <= GetWorldTotalMin() ) + { + if (RepairIsDone( &(*iter) )) + { + //ADB moved from RepairIsDone so iterator remains ok + // Remove the repaired item from the dealer's permanent inventory list + iter = gArmsDealersInventory[ gbSelectedArmsDealerID ].erase(iter); + if (iter == gArmsDealersInventory[ gbSelectedArmsDealerID ].end()) { + break; + } + increment = false; + + // don't add it here, it was put in the player's area + fAddSpecialItem = false; + } + else + { + repaired = true; + } + } } - // add all active special items - for( ubElement=0; ubElement< gArmsDealersInventory[ gbSelectedArmsDealerID ][ usItemIndex ].ubElementsAlloced; ubElement++ ) + if ( fAddSpecialItem == true ) { - pSpecialItem = &(gArmsDealersInventory[ gbSelectedArmsDealerID ][ usItemIndex ].SpecialItem[ ubElement ]); - - if ( pSpecialItem->fActive ) + UINT8 ubOwner; + if ( ArmsDealerInfo[ gbSelectedArmsDealerID ].ubTypeOfArmsDealer != ARMS_DEALER_REPAIRS ) { - fAddSpecialItem = TRUE; + // no merc is the owner + ubOwner = NO_PROFILE; + } + else + { + // retain owner so we can display this + ubOwner = iter->ubOwnerProfileId; + } - //if the item is in for repairs - if( pSpecialItem->Info.bItemCondition < 0 ) - { - //if the repairs are done - if( pSpecialItem->uiRepairDoneTime <= GetWorldTotalMin() ) - { - if (RepairIsDone( usItemIndex, ubElement )) - { - // don't add it here, it was put in the player's area - fAddSpecialItem = FALSE; - } - else - { - gpTempDealersInventory[ guiNextFreeInvSlot ].uiFlags |= ARMS_INV_ITEM_REPAIRED; - } - } - else - { - gpTempDealersInventory[ guiNextFreeInvSlot ].uiFlags |= ARMS_INV_ITEM_NOT_REPAIRED_YET; - } + StoreObjectsInNextFreeDealerInvSlot( &(*iter), gpTempDealersInventory, ubOwner ); + if (underRepair == true) { + if (repaired == true) { + gpTempDealersInventory.back().uiFlags |= ARMS_INV_ITEM_REPAIRED; } - - if ( fAddSpecialItem ) - { - UINT8 ubOwner; - - if ( ArmsDealerInfo[ gbSelectedArmsDealerID ].ubTypeOfArmsDealer != ARMS_DEALER_REPAIRS ) - { - // no merc is the owner - ubOwner = NO_PROFILE; - } - else - { - // retain owner so we can display this - ubOwner = pSpecialItem->ubOwnerProfileId; - } - - AddItemsToTempDealerInventory( usItemIndex, &(pSpecialItem->Info), ubElement, 1, ubOwner ); + else { + gpTempDealersInventory.back().uiFlags |= ARMS_INV_ITEM_NOT_REPAIRED_YET; } } } } + if (increment == true) { + ++iter; + } } - // if more than one item is in inventory - if ( guiNextFreeInvSlot > 1 ) + // repairmen sort differently from merchants + // sort this list by object category, and by ascending price within each category + if ( ArmsDealerInfo[ gbSelectedArmsDealerID ].ubTypeOfArmsDealer == ARMS_DEALER_REPAIRS ) { - // repairmen sort differently from merchants - if ( ArmsDealerInfo[ gbSelectedArmsDealerID ].ubTypeOfArmsDealer == ARMS_DEALER_REPAIRS ) - { - // sort this list by object category, and by ascending price within each category - qsort( (void*)gpTempDealersInventory, (size_t)guiNextFreeInvSlot, sizeof( INVENTORY_IN_SLOT ), RepairmanItemQsortCompare ); - } - else - { - // sort this list by object category, and by ascending price within each category - qsort( (void*)gpTempDealersInventory, (size_t)guiNextFreeInvSlot, sizeof( INVENTORY_IN_SLOT ), ArmsDealerItemQsortCompare ); - } + std::sort(gpTempDealersInventory.begin(), gpTempDealersInventory.end(), RepairmanItemQsortCompare);//RepairmanItemQsortCompare + } + else + { + std::sort(gpTempDealersInventory.begin(), gpTempDealersInventory.end(), ArmsDealerItemQsortCompare);//ArmsDealerItemQsortCompare } - return( TRUE ); } - -void AddItemsToTempDealerInventory(UINT16 usItemIndex, SPECIAL_ITEM_INFO *pSpclItemInfo, INT16 sSpecialItemElement, UINT8 ubHowMany, UINT8 ubOwner ) +bool ArmsDealerItemQsortCompare(INVENTORY_IN_SLOT& pInvSlot1, INVENTORY_IN_SLOT& pInvSlot2) { - UINT8 ubCnt; - - - Assert( ubHowMany > 0 ); - Assert( pSpclItemInfo != NULL ); - - - // if there's just one of them - if ( ubHowMany == 1 ) - { - // it gets its own box, obviously - StoreObjectsInNextFreeDealerInvSlot( usItemIndex, pSpclItemInfo, sSpecialItemElement, 1, ubOwner ); - } - else // more than one - { - // if the items can be stacked - // NOTE: This test must match the one inside CountDistinctItemsInArmsDealersInventory() exactly! - if ( DealerItemIsSafeToStack( usItemIndex ) ) - { - // then we can store them all together in the same box safely, even if there's more than MAX_OBJECTS_PER_SLOT - StoreObjectsInNextFreeDealerInvSlot( usItemIndex, pSpclItemInfo, sSpecialItemElement, ubHowMany, ubOwner ); - } - else - { - // non-stacking items must be stored in one / box , because each may have unique fields besides bStatus[] - // Example: guns all have ammo, ammo type, etc. We need these uniquely represented for pricing & manipulation - for ( ubCnt = 0; ubCnt < ubHowMany; ubCnt++ ) - { - StoreObjectsInNextFreeDealerInvSlot( usItemIndex, pSpclItemInfo, sSpecialItemElement, 1, ubOwner ); - } - } + int retVal = ( CompareItemsForSorting( pInvSlot1.sItemIndex, pInvSlot2.sItemIndex, + pInvSlot1.ItemObject[0]->data.objectStatus, pInvSlot2.ItemObject[0]->data.objectStatus ) ); + if (retVal == -1) { + return true; } + return false; } -void StoreObjectsInNextFreeDealerInvSlot( UINT16 usItemIndex, SPECIAL_ITEM_INFO *pSpclItemInfo, INT16 sSpecialItemElement, UINT8 ubHowMany, UINT8 ubOwner ) +bool RepairmanItemQsortCompare(INVENTORY_IN_SLOT& pInvSlot1, INVENTORY_IN_SLOT& pInvSlot2) { - INVENTORY_IN_SLOT *pDealerInvSlot; + // lower repair time first + if ( pInvSlot1.uiRepairDoneTime < pInvSlot2.uiRepairDoneTime ) + { + return true; + } + return false; +} - // make sure we have the room (memory allocated for it) - Assert( guiNextFreeInvSlot < gSelectArmsDealerInfo.uiNumDistinctInventoryItems ); - - pDealerInvSlot = &(gpTempDealersInventory[ guiNextFreeInvSlot ]); - guiNextFreeInvSlot++; +void StoreObjectsInNextFreeDealerInvSlot( DEALER_SPECIAL_ITEM *pSpclItemInfo, std::vector& pInventory, UINT8 ubOwner ) +{ + pInventory.push_back(INVENTORY_IN_SLOT()); + INVENTORY_IN_SLOT* pDealerInvSlot = &(pInventory.back()); pDealerInvSlot->fActive = TRUE; - pDealerInvSlot->sItemIndex = usItemIndex; - pDealerInvSlot->sSpecialItemElement = sSpecialItemElement; + pDealerInvSlot->sItemIndex = pSpclItemInfo->object.usItem; + pDealerInvSlot->uiRepairDoneTime = pSpclItemInfo->uiRepairDoneTime; pDealerInvSlot->ubIdOfMercWhoOwnsTheItem = ubOwner; pDealerInvSlot->bSlotIdInOtherLocation = -1; // Create the item object ( with no more than MAX_OBJECTS_PER_SLOT ) // can't use the real #, because CreateItems() will blindly set the bStatus for however many we tell it, beyond 8 - MakeObjectOutOfDealerItems( usItemIndex, pSpclItemInfo, &(pDealerInvSlot->ItemObject), ( UINT8 ) min( ubHowMany, MAX_OBJECTS_PER_SLOT ) ); + MakeObjectOutOfDealerItems( pSpclItemInfo, &(pDealerInvSlot->ItemObject) ); + //ADB no longer necessary + /* if ( ubHowMany > MAX_OBJECTS_PER_SLOT ) { // HACK: Override ItemObject->ubNumberOfObjects (1-8) with the REAL # of items in this box. // Note that this makes it an illegal OBJECTTYPE, since there ubHowMany can easily be more than MAX_OBJECTS_PER_SLOT, - // so there's no room to store the status of all of them one. But we only so this for perfect items, so + // so there's no room to store the status of all of them one. But we only so this for perfect items, so // we don't care, it works & saves us a lot hassles here. Just be careful using the damn things!!! You can't just // pass them off the most functions in Items.C(), use ShopkeeperAutoPlaceObject() and ShopkeeperAddItemToPool() instead. pDealerInvSlot->ItemObject.ubNumberOfObjects = ubHowMany; } + */ } -BOOLEAN RepairIsDone(UINT16 usItemIndex, UINT8 ubElement) +BOOLEAN RepairIsDone(DEALER_SPECIAL_ITEM* pSpecial) { - INVENTORY_IN_SLOT RepairItem; - INT8 bSlotNum; - UINT8 ubCnt; - // make a new shopkeeper invslot item out of it - memset( &RepairItem, 0, sizeof( INVENTORY_IN_SLOT ) ); + INVENTORY_IN_SLOT RepairItem; RepairItem.fActive = TRUE; - RepairItem.sItemIndex = usItemIndex; + RepairItem.sItemIndex = pSpecial->object.usItem; // set the owner of the item. Slot is always -1 of course. - RepairItem.ubIdOfMercWhoOwnsTheItem = gArmsDealersInventory[ gbSelectedArmsDealerID ][ usItemIndex ].SpecialItem[ ubElement ].ubOwnerProfileId; + RepairItem.ubIdOfMercWhoOwnsTheItem = pSpecial->ubOwnerProfileId; RepairItem.bSlotIdInOtherLocation = -1; // Create the item object - MakeObjectOutOfDealerItems( usItemIndex, &( gArmsDealersInventory[ gbSelectedArmsDealerID ][ usItemIndex ].SpecialItem[ ubElement ].Info ), &RepairItem.ItemObject, 1 ); + MakeObjectOutOfDealerItems( pSpecial, &RepairItem.ItemObject ); if ( CanDealerRepairItem( gbSelectedArmsDealerID, RepairItem.ItemObject.usItem ) ) { // make its condition 100% - RepairItem.ItemObject.ItemData.Generic.bStatus[ 0 ] = 100; + RepairItem.ItemObject[0]->data.objectStatus = 100; } // max condition of all permanent attachments on it - for ( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++ ) - { - if ( RepairItem.ItemObject.usAttachItem[ ubCnt ] != NONE ) + for (attachmentList::iterator iter = RepairItem.ItemObject[0]->attachments.begin(); iter != RepairItem.ItemObject[0]->attachments.end(); ++iter) { + if ( CanDealerRepairItem( gbSelectedArmsDealerID, iter->usItem ) ) { -/* ARM: Can now repair with removeable attachments still attached... - // If the attachment is a permanent one - if ( Item[ RepairItem.ItemObject.usAttachItem[ ubCnt ] ].fFlags & ITEM_INSEPARABLE ) -*/ - if ( CanDealerRepairItem( gbSelectedArmsDealerID, RepairItem.ItemObject.usAttachItem[ ubCnt ] ) ) - { - // fix it up - RepairItem.ItemObject.bAttachStatus[ ubCnt ] = 100; - } + // fix it up + (*iter)[0]->data.objectStatus = 100; } } // if the item is imprinted (by anyone, even player's mercs), and it's Fredo repairing it - if ( /*( gArmsDealersInventory[ gbSelectedArmsDealerID ][ usItemIndex ].SpecialItem[ ubElement ].Info.ubImprintID == (NO_PROFILE + 1) ) && */ - ( gbSelectedArmsDealerID == ARMS_DEALER_FREDO ) ) + if ( ( gbSelectedArmsDealerID == ARMS_DEALER_FREDO ) ) { // then reset the imprinting! - RepairItem.ItemObject.ubImprintID = NO_PROFILE; + RepairItem.ItemObject[0]->data.ubImprintID = NO_PROFILE; } //try to add the item to the players offer area + INT8 bSlotNum; bSlotNum = AddItemToPlayersOfferArea( RepairItem.ubIdOfMercWhoOwnsTheItem, &RepairItem, -1 ); // if there wasn't room for it if( bSlotNum == -1 ) @@ -3099,19 +3042,12 @@ BOOLEAN RepairIsDone(UINT16 usItemIndex, UINT8 ubElement) } PlayersOfferArea[ bSlotNum ].uiFlags |= ARMS_INV_ITEM_REPAIRED; - - // Remove the repaired item from the dealer's permanent inventory list - RemoveSpecialItemFromArmsDealerInventoryAtElement( gbSelectedArmsDealerID, usItemIndex, ubElement ); - - // one less slot is needed. Don't bother ReMemAllocating, though - gSelectArmsDealerInfo.uiNumDistinctInventoryItems--; - // there was room to add it to player's area return(TRUE); } -void DrawHatchOnInventory( UINT32 uiSurface, UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT16 usHeight ) +void DrawHatchOnInventory( UINT32 uiSurface, UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT16 usHeight, UINT16 usColor ) { UINT8 *pDestBuf; UINT32 uiDestPitchBYTES; @@ -3127,13 +3063,19 @@ void DrawHatchOnInventory( UINT32 uiSurface, UINT16 usPosX, UINT16 usPosY, UINT1 1,0,1,0,1,0,1,0, 0,1,0,1,0,1,0,1 }; - ClipRect.iLeft = usPosX; - ClipRect.iRight = usPosX + usWidth; + // CHRISL: + ClipRect.iLeft = usPosX-1; + ClipRect.iRight = usPosX + usWidth-1; ClipRect.iTop = usPosY; ClipRect.iBottom = usPosY + usHeight; pDestBuf = LockVideoSurface( uiSurface, &uiDestPitchBYTES ); - Blt16BPPBufferPixelateRect( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect, Pattern ); + if(usColor == 0){ + Blt16BPPBufferPixelateRect( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect, Pattern ); + } + else{ + Blt16BPPBufferPixelateRectWithColor( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect, Pattern, usColor ); + } UnLockVideoSurface( uiSurface ); } @@ -3143,124 +3085,68 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly, UINT8 ubCnt; UINT32 uiUnitPrice = 0; UINT32 uiTotalPrice = 0; - UINT8 ubItemsToCount = 0; - UINT8 ubItemsNotCounted = 0; UINT32 uiDiscountValue; // UINT32 uiDifFrom10 = 0; - // add up value of the main item(s), exact procedure depends on its item class - switch ( Item [ usItemID ].usItemClass ) - { - case IC_GUN: - // add value of the gun - uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) * - ItemConditionModifier(usItemID, pItemObject->ItemData.Gun.bGunStatus) * - dModifier ); - - // if any ammo is loaded - if( pItemObject->ItemData.Gun.usGunAmmoItem != NONE) - { - // if it's regular ammo - if( Item[ pItemObject->ItemData.Gun.usGunAmmoItem ].usItemClass == IC_AMMO ) - { - // add value of its remaining ammo - uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, pItemObject->ItemData.Gun.usGunAmmoItem, fDealerSelling ) * - ItemConditionModifier(pItemObject->ItemData.Gun.usGunAmmoItem, pItemObject->ItemData.Gun.ubGunShotsLeft) * - dModifier ); - } - else // assume it's attached ammo (mortar shells, grenades) - { - // add its value (uses normal status 0-100) - uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, pItemObject->ItemData.Gun.usGunAmmoItem, fDealerSelling ) * - ItemConditionModifier(pItemObject->ItemData.Gun.usGunAmmoItem, pItemObject->ItemData.Gun.bGunAmmoStatus) * - dModifier ); - } - } - - // if multiple guns are stacked, we've only counted the first one - ubItemsNotCounted = pItemObject->ubNumberOfObjects - 1; - break; - - case IC_AMMO: - //Madd: quick fix for negative prices at Tony's - // this must handle overloaded objects from dealer boxes! - if ( pItemObject->ubNumberOfObjects <= MAX_OBJECTS_PER_SLOT ) - { - // legal amount, count them all normally (statuses could be different) - ubItemsToCount = pItemObject->ubNumberOfObjects; - ubItemsNotCounted = 0; - // in this situation, uiUnitPrice will actually be the sum of the values of ALL the multiple objects - } - else - { - // overloaded amount, count just the first, the others must all be identical - ubItemsToCount = 1; - ubItemsNotCounted = pItemObject->ubNumberOfObjects - 1; - } - - // add the value of each magazine (multiple mags may have vastly different #bullets left) - for (ubCnt = 0; ubCnt < ubItemsToCount; ubCnt++ ) - { - // for bullets, ItemConditionModifier will convert the #ShotsLeft into a percentage - uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) * - ItemConditionModifier(usItemID, pItemObject->ItemData.Ammo.ubShotsLeft[ubCnt]) * - dModifier ); - - if ( fUnitPriceOnly ) - { - // want price for only one of them. All statuses must be the same in order to use this flag! - break; - } - } - break; - default: - // this must handle overloaded objects from dealer boxes! - if ( pItemObject->ubNumberOfObjects <= MAX_OBJECTS_PER_SLOT ) - { - // legal amount, count them all normally (statuses could be different) - ubItemsToCount = pItemObject->ubNumberOfObjects; - ubItemsNotCounted = 0; - // in this situation, uiUnitPrice will actually be the sum of the values of ALL the multiple objects - } - else - { - // overloaded amount, count just the first, the others must all be identical - ubItemsToCount = 1; - ubItemsNotCounted = pItemObject->ubNumberOfObjects - 1; - } - - // add the value of each magazine (multiple mags may have vastly different #bullets left) - for (ubCnt = 0; ubCnt < ubItemsToCount; ubCnt++ ) - { - // for bullets, ItemConditionModifier will convert the #ShotsLeft into a percentage - uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) * - ItemConditionModifier(usItemID, pItemObject->ItemData.Generic.bStatus[ ubCnt ]) * - dModifier ); - - if ( fUnitPriceOnly ) - { - // want price for only one of them. All statuses must be the same in order to use this flag! - break; - } - } - break; - } - - - // loop through any attachments and add in their price - for( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++) - { - if( pItemObject->usAttachItem[ ubCnt ] != NONE ) + for (ubCnt = 0; ubCnt < pItemObject->ubNumberOfObjects; ubCnt++ ) { + // add up value of the main item(s), exact procedure depends on its item class + switch ( Item [ usItemID ].usItemClass ) { + case IC_GUN: + // add value of the gun + uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) * + ItemConditionModifier(usItemID, (*pItemObject)[ubCnt]->data.gun.bGunStatus) * + dModifier ); + + // if any ammo is loaded + if( (*pItemObject)[ubCnt]->data.gun.usGunAmmoItem != NONE) + { + // if it's regular ammo + if( Item[ (*pItemObject)[ubCnt]->data.gun.usGunAmmoItem ].usItemClass == IC_AMMO ) + { + // add value of its remaining ammo + uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, (*pItemObject)[ubCnt]->data.gun.usGunAmmoItem, fDealerSelling ) * + ItemConditionModifier((*pItemObject)[ubCnt]->data.gun.usGunAmmoItem, (*pItemObject)[ubCnt]->data.gun.ubGunShotsLeft) * + dModifier ); + } + else // assume it's attached ammo (mortar shells, grenades) + { + // add its value (uses normal status 0-100) + uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, (*pItemObject)[ubCnt]->data.gun.usGunAmmoItem, fDealerSelling ) * + ItemConditionModifier((*pItemObject)[ubCnt]->data.gun.usGunAmmoItem, (*pItemObject)[ubCnt]->data.gun.bGunAmmoStatus) * + dModifier ); + } + } + break; + + case IC_AMMO: + // add the value of each magazine (multiple mags may have vastly different #bullets left) + // for bullets, ItemConditionModifier will convert the #ShotsLeft into a percentage + uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) * + ItemConditionModifier(usItemID, (*pItemObject)[ubCnt]->data.ubShotsLeft) * + dModifier ); + + break; + default: + // add the value of each magazine (multiple mags may have vastly different #bullets left) + // for bullets, ItemConditionModifier will convert the #ShotsLeft into a percentage + uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) * + ItemConditionModifier(usItemID, (*pItemObject)[ ubCnt ]->data.objectStatus) * + dModifier ); + + break; + } + // loop through any attachments and add in their price + for (attachmentList::iterator iter = (*pItemObject)[ubCnt]->attachments.begin(); iter != (*pItemObject)[ubCnt]->attachments.end(); ++iter) { // add value of this particular attachment - uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, pItemObject->usAttachItem[ ubCnt ], fDealerSelling ) * - ItemConditionModifier(pItemObject->usAttachItem[ ubCnt ], pItemObject->bAttachStatus[ ubCnt ]) * - dModifier ); + uiUnitPrice += CalcShopKeeperItemPrice( fDealerSelling, fUnitPriceOnly, iter->usItem, dModifier, &(*iter)) ; } } + + // if Flo is doing the dealin' and wheelin' if ( gpSMCurrentMerc->ubProfile == FLO ) { @@ -3305,14 +3191,6 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly, // we're always count the first one uiTotalPrice = uiUnitPrice; - - // if NOT pricing just one - if ( !fUnitPriceOnly ) - { - // add value of all that weren't already counted - uiTotalPrice += ( ubItemsNotCounted * uiUnitPrice ); - } - return( uiTotalPrice ); } @@ -3321,7 +3199,7 @@ FLOAT ItemConditionModifier(UINT16 usItemIndex, INT16 bStatus) { FLOAT dConditionModifier = 1.0f; - //if the item is ammo, the condition modifier is based on how many shots are left + //if the item is ammo, the condition modifier is based on how many shots are left if( Item[ usItemIndex ].usItemClass == IC_AMMO ) { // # bullets left / max magazine capacity @@ -3345,7 +3223,7 @@ FLOAT ItemConditionModifier(UINT16 usItemIndex, INT16 bStatus) } else { - // an UNREPAIRABLE item is worth precisely its condition percentage + // an UNREPAIRABLE item is worth precisely its condition percentage dConditionModifier = bStatus / (FLOAT)100; } } @@ -3393,7 +3271,7 @@ void DisplayArmsDealerOfferArea() fDisplayHatchOnItem = FALSE; // Display the inventory slot - uiTotalCost += DisplayInvSlot( (UINT8)sCnt, ArmsDealerOfferArea[ sCnt ].sItemIndex, usPosX, usPosY, + uiTotalCost += DisplayInvSlot( (UINT8)sCnt, ArmsDealerOfferArea[ sCnt ].sItemIndex, usPosX, usPosY, &ArmsDealerOfferArea[ sCnt ].ItemObject, fDisplayHatchOnItem, ARMS_DEALER_OFFER_AREA ); @@ -3432,12 +3310,12 @@ void DisplayArmsDealerOfferArea() swprintf( zTemp, L"%d", uiTotalCost ); InsertCommasForDollarFigure( zTemp ); InsertDollarSignInToString( zTemp ); - DrawTextToScreen( zTemp, SKI_ARMS_DEALER_TOTAL_COST_X, (UINT16)(SKI_ARMS_DEALER_TOTAL_COST_Y+5), SKI_INV_SLOT_WIDTH, SKI_LABEL_FONT, SKI_ITEM_PRICE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DrawTextToScreen( zTemp, SKI_ARMS_DEALER_TOTAL_COST_X, (UINT16)(SKI_ARMS_DEALER_TOTAL_COST_Y+5), SKI_INV_SLOT_WIDTH, SKI_LABEL_FONT, SKI_ITEM_PRICE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); } } -INT8 AddItemToArmsDealerOfferArea( INVENTORY_IN_SLOT* pInvSlot, INT8 bSlotIdInOtherLocation ) +INT8 AddItemToArmsDealerOfferArea( INVENTORY_IN_SLOT* pInvSlot, INT16 bSlotIdInOtherLocation ) { INT8 bCnt; @@ -3447,14 +3325,16 @@ INT8 AddItemToArmsDealerOfferArea( INVENTORY_IN_SLOT* pInvSlot, INT8 bSlotIdInOt if( ArmsDealerOfferArea[bCnt].fActive == FALSE ) { //Copy the inventory items - memcpy( &ArmsDealerOfferArea[bCnt], pInvSlot, sizeof( INVENTORY_IN_SLOT ) ); + ArmsDealerOfferArea[bCnt] = *pInvSlot; //if the shift key is being pressed, add them all - if( gfKeyState[ SHIFT ] ) - ArmsDealerOfferArea[bCnt].ItemObject.ubNumberOfObjects = pInvSlot->ItemObject.ubNumberOfObjects; + if( gfKeyState[ SHIFT ] ) { + //nothing needed + } //If there was more then 1 item, reduce it to only 1 item moved - else if( pInvSlot->ItemObject.ubNumberOfObjects > 1 ) - ArmsDealerOfferArea[bCnt].ItemObject.ubNumberOfObjects = 1; + else if( pInvSlot->ItemObject.ubNumberOfObjects > 1 ) { + ArmsDealerOfferArea[bCnt].ItemObject.RemoveObjectsFromStack(ArmsDealerOfferArea[bCnt].ItemObject.ubNumberOfObjects - 1); + } //Remember where the item came from ArmsDealerOfferArea[bCnt].bSlotIdInOtherLocation = bSlotIdInOtherLocation; @@ -3472,7 +3352,7 @@ INT8 AddItemToArmsDealerOfferArea( INVENTORY_IN_SLOT* pInvSlot, INT8 bSlotIdInOt return( -1 ); } -BOOLEAN RemoveItemFromArmsDealerOfferArea( INT8 bSlotId, BOOLEAN fKeepItem ) +BOOLEAN RemoveItemFromArmsDealerOfferArea( INT16 bSlotId, BOOLEAN fKeepItem ) { // UINT16 usCnt; @@ -3486,7 +3366,7 @@ BOOLEAN RemoveItemFromArmsDealerOfferArea( INT8 bSlotId, BOOLEAN fKeepItem ) // if( ArmsDealerOfferArea[ usCnt ].ItemObject.ubNumberOfObjects > 1 ) if( fKeepItem ) { - gpTempDealersInventory[ ArmsDealerOfferArea[bSlotId].bSlotIdInOtherLocation ].ItemObject.ubNumberOfObjects += ArmsDealerOfferArea[ bSlotId ].ItemObject.ubNumberOfObjects; + gpTempDealersInventory[ ArmsDealerOfferArea[bSlotId].bSlotIdInOtherLocation ].ItemObject.ForceAddObjectsToStack(ArmsDealerOfferArea[ bSlotId ].ItemObject); } //Clear the flag that hatches out the item @@ -3546,7 +3426,7 @@ void SkiHelpTextDoneCallBack( void ) -INT8 AddItemToPlayersOfferArea( UINT8 ubProfileID, INVENTORY_IN_SLOT* pInvSlot, INT8 bSlotIdInOtherLocation ) +INT8 AddItemToPlayersOfferArea( UINT8 ubProfileID, INVENTORY_IN_SLOT* pInvSlot, INT16 bSlotIdInOtherLocation ) { INT8 bCnt; @@ -3565,7 +3445,7 @@ INT8 AddItemToPlayersOfferArea( UINT8 ubProfileID, INVENTORY_IN_SLOT* pInvSlot, //if there are no items here, copy the data in if( PlayersOfferArea[bCnt].fActive == FALSE ) { - memcpy( &PlayersOfferArea[bCnt], pInvSlot, sizeof( INVENTORY_IN_SLOT ) ); + PlayersOfferArea[bCnt] = *pInvSlot; PlayersOfferArea[bCnt].fActive = TRUE; @@ -3584,7 +3464,7 @@ INT8 AddItemToPlayersOfferArea( UINT8 ubProfileID, INVENTORY_IN_SLOT* pInvSlot, { //Since money is always evaluated PlayersOfferArea[ bCnt ].uiFlags |= ARMS_INV_PLAYERS_ITEM_HAS_VALUE; - PlayersOfferArea[ bCnt ].uiItemPrice = PlayersOfferArea[ bCnt ].ItemObject.ItemData.Money.uiMoneyAmount; + PlayersOfferArea[ bCnt ].uiItemPrice = PlayersOfferArea[ bCnt ].ItemObject[0]->data.money.uiMoneyAmount; } gubSkiDirtyLevel = SKI_DIRTY_LEVEL2; @@ -3610,7 +3490,7 @@ BOOLEAN RemoveItemFromPlayersOfferArea( INT8 bSlot ) // Clear the contents ClearPlayersOfferSlot( bSlot ); - // Dirty + // Dirty fInterfacePanelDirty = DIRTYLEVEL2; gubSkiDirtyLevel = SKI_DIRTY_LEVEL1; return( TRUE ); @@ -3655,8 +3535,8 @@ void DisplayPlayersOfferArea() sSoldierID = GetSoldierIDFromMercID( PlayersOfferArea[ sCnt ].ubIdOfMercWhoOwnsTheItem ); Assert(sSoldierID != -1); - PlayersOfferArea[ sCnt ].ItemObject.ItemData.Money.uiMoneyAmount = Menptr[ sSoldierID ].inv[ PlayersOfferArea[ sCnt ].bSlotIdInOtherLocation ].ItemData.Money.uiMoneyAmount; - PlayersOfferArea[ sCnt ].uiItemPrice = PlayersOfferArea[ sCnt ].ItemObject.ItemData.Money.uiMoneyAmount; + PlayersOfferArea[ sCnt ].ItemObject[0]->data.money.uiMoneyAmount = Menptr[ sSoldierID ].inv[ PlayersOfferArea[ sCnt ].bSlotIdInOtherLocation ][0]->data.money.uiMoneyAmount; + PlayersOfferArea[ sCnt ].uiItemPrice = PlayersOfferArea[ sCnt ].ItemObject[0]->data.money.uiMoneyAmount; } } else // not money @@ -3681,7 +3561,7 @@ void DisplayPlayersOfferArea() // fDisplayHatchOnItem = ( PlayersOfferArea[ sCnt ].uiFlags & ( ARMS_INV_PLAYERS_ITEM_HAS_BEEN_EVALUATED | ARMS_INV_JUST_PURCHASED ) ) == 0; // Display the inventory slot - DisplayInvSlot( (UINT8)sCnt, PlayersOfferArea[ sCnt ].sItemIndex, usPosX, usPosY, + DisplayInvSlot( (UINT8)sCnt, PlayersOfferArea[ sCnt ].sItemIndex, usPosX, usPosY, &PlayersOfferArea[ sCnt ].ItemObject, fDisplayHatchOnItem, PLAYERS_OFFER_AREA ); @@ -3714,14 +3594,14 @@ void DisplayPlayersOfferArea() swprintf( zTemp, L"%d", uiTotalCost ); InsertCommasForDollarFigure( zTemp ); InsertDollarSignInToString( zTemp ); - DrawTextToScreen( zTemp, SKI_PLAYERS_TOTAL_VALUE_X, (UINT16)(SKI_PLAYERS_TOTAL_VALUE_Y+5), SKI_INV_SLOT_WIDTH, SKI_LABEL_FONT, SKI_ITEM_PRICE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DrawTextToScreen( zTemp, SKI_PLAYERS_TOTAL_VALUE_X, (UINT16)(SKI_PLAYERS_TOTAL_VALUE_Y+5), SKI_INV_SLOT_WIDTH, SKI_LABEL_FONT, SKI_ITEM_PRICE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); } CrossOutUnwantedItems( ); } -INVENTORY_IN_SLOT *GetPtrToOfferSlotWhereThisItemIs( UINT8 ubProfileID, INT8 bInvPocket ) +INVENTORY_IN_SLOT *GetPtrToOfferSlotWhereThisItemIs( UINT8 ubProfileID, INT16 bInvPocket ) { UINT8 ubCnt = 0; @@ -3729,14 +3609,14 @@ INVENTORY_IN_SLOT *GetPtrToOfferSlotWhereThisItemIs( UINT8 ubProfileID, INT8 bIn { if( ( PlayersOfferArea[ ubCnt ].bSlotIdInOtherLocation == bInvPocket ) && ( PlayersOfferArea[ ubCnt ].ubIdOfMercWhoOwnsTheItem == ubProfileID ) && - ( PlayersOfferArea[ ubCnt ].ItemObject.ubNumberOfObjects != 0 ) ) + ( PlayersOfferArea[ ubCnt ].ItemObject.exists() == true ) ) { return( &( PlayersOfferArea[ ubCnt ] ) ); } if( ( ArmsDealerOfferArea[ ubCnt ].bSlotIdInOtherLocation == bInvPocket ) && ( ArmsDealerOfferArea[ ubCnt ].ubIdOfMercWhoOwnsTheItem == ubProfileID ) && - ( ArmsDealerOfferArea[ ubCnt ].ItemObject.ubNumberOfObjects != 0 ) ) + ( ArmsDealerOfferArea[ ubCnt ].ItemObject.exists() == true ) ) { return( &( ArmsDealerOfferArea[ ubCnt ] ) ); } @@ -3793,7 +3673,7 @@ UINT32 CalculateTotalPlayersValue() { //Calculate a price for the item if( Item[ PlayersOfferArea[ ubCnt ].sItemIndex ].usItemClass == IC_MONEY ) - uiTotal += PlayersOfferArea[ ubCnt ].ItemObject.ItemData.Money.uiMoneyAmount; + uiTotal += PlayersOfferArea[ ubCnt ].ItemObject[0]->data.money.uiMoneyAmount; else uiTotal += PlayersOfferArea[ ubCnt ].uiItemPrice; } @@ -4034,7 +3914,6 @@ void MoveAllArmsDealersItemsInOfferAreaToPlayersOfferArea( ) { //for all items in the dealers items offer area UINT32 uiCnt; - UINT32 uiTotal=0; INT8 bSlotID=0; //loop through all the slots in the shopkeeper's offer area @@ -4057,7 +3936,7 @@ void MoveAllArmsDealersItemsInOfferAreaToPlayersOfferArea( ) } } - + //Remove the items out of the dealers inventory RemoveItemFromDealersInventory( &ArmsDealerOfferArea[ uiCnt ], (UINT8)ArmsDealerOfferArea[ uiCnt ].bSlotIdInOtherLocation ); @@ -4082,16 +3961,13 @@ void MoveAllArmsDealersItemsInOfferAreaToPlayersOfferArea( ) BOOLEAN RemoveItemFromDealersInventory( INVENTORY_IN_SLOT* pInvSlot, UINT8 ubSlot ) { INT16 sInvSlot; - INT16 sItemID; - SPECIAL_ITEM_INFO SpclItemInfo; - + INT16 sItemID; sInvSlot = ubSlot; // sInvSlot = ( gSelectArmsDealerInfo.ubCurrentPage - 1 ) * SKI_NUM_ARMS_DEALERS_INV_SLOTS + ubSlot; //Remove all of this item out of the specified inventory slot sItemID = gpTempDealersInventory[ sInvSlot ].sItemIndex; - SetSpecialItemInfoFromObject( &SpclItemInfo, &(pInvSlot->ItemObject) ); - RemoveItemFromArmsDealerInventory( gbSelectedArmsDealerID, sItemID, &SpclItemInfo, pInvSlot->ItemObject.ubNumberOfObjects ); + RemoveItemFromArmsDealerInventory( gbSelectedArmsDealerID, sItemID, pInvSlot->ItemObject.ubNumberOfObjects, &pInvSlot->ItemObject ); gfResetShopKeepIdleQuote = TRUE; return( TRUE ); @@ -4117,7 +3993,7 @@ void MovePlayerOfferedItemsOfValueToArmsDealersInventory() if( Item[ PlayersOfferArea[ uiCnt ].sItemIndex ].usItemClass == IC_MONEY ) { //add the money to the dealers 'cash' - gArmsDealerStatus[ gbSelectedArmsDealerID ].uiArmsDealersCash += PlayersOfferArea[ uiCnt ].ItemObject.ItemData.Money.uiMoneyAmount; + gArmsDealerStatus[ gbSelectedArmsDealerID ].uiArmsDealersCash += PlayersOfferArea[ uiCnt ].ItemObject[0]->data.money.uiMoneyAmount; } else { @@ -4126,6 +4002,7 @@ void MovePlayerOfferedItemsOfValueToArmsDealersInventory() { // item cease to be merc-owned during this operation AddObjectToArmsDealerInventory( gbSelectedArmsDealerID, &( PlayersOfferArea[ uiCnt ].ItemObject ) ); + PlayersOfferArea[ uiCnt ].ItemObject.initialize(); } } @@ -4143,7 +4020,6 @@ void MovePlayerOfferedItemsOfValueToArmsDealersInventory() void BeginSkiItemPointer( UINT8 ubSource, INT8 bSlotNum, BOOLEAN fOfferToDealerFirst ) { SGPRect Rect; - OBJECTTYPE TempObject; /* // If we are already moving an item @@ -4163,7 +4039,7 @@ void BeginSkiItemPointer( UINT8 ubSource, INT8 bSlotNum, BOOLEAN fOfferToDealerF case ARMS_DEALER_OFFER_AREA: //Get the item from the slot. - memcpy( &gMoveingItem, &ArmsDealerOfferArea[ bSlotNum ], sizeof( INVENTORY_IN_SLOT ) ); + gMoveingItem = ArmsDealerOfferArea[ bSlotNum ]; IfMercOwnedRemoveItemFromMercInv( &gMoveingItem ); //remove the item from the slot @@ -4175,6 +4051,9 @@ void BeginSkiItemPointer( UINT8 ubSource, INT8 bSlotNum, BOOLEAN fOfferToDealerF Rect.iTop = SKI_DEALER_OFFER_AREA_Y; Rect.iRight = SKI_ITEM_MOVEMENT_AREA_X + SKI_ITEM_MOVEMENT_AREA_WIDTH; Rect.iBottom = SKI_ITEM_MOVEMENT_AREA_Y + SKI_ITEM_MOVEMENT_AREA_HEIGHT; + if((UsingNewInventorySystem() == true)){ + Rect.iBottom += 60; + } gpItemPointer = &gMoveingItem.ItemObject; @@ -4196,17 +4075,14 @@ void BeginSkiItemPointer( UINT8 ubSource, INT8 bSlotNum, BOOLEAN fOfferToDealerF case PLAYERS_OFFER_AREA: //Get the item from the slot. - memcpy( &gMoveingItem, &PlayersOfferArea[ bSlotNum ], sizeof( INVENTORY_IN_SLOT ) ); + gMoveingItem = PlayersOfferArea[ bSlotNum ]; // if the slot is overloaded (holds more objects than we have room for valid statuses of) if ( PlayersOfferArea[ bSlotNum ].ItemObject.ubNumberOfObjects > MAX_OBJECTS_PER_SLOT ) { // allow only MAX_OBJECTS_PER_SLOT of those objects to be picked up at a time // (sure it kind of sucks, but it's a lot easier than handling overloaded cursor objects in Interface Items! - gMoveingItem.ItemObject.ubNumberOfObjects = MAX_OBJECTS_PER_SLOT; - - // decrease the number objects left in the slot by that much instead of deleting it - PlayersOfferArea[ bSlotNum ].ItemObject.ubNumberOfObjects -= MAX_OBJECTS_PER_SLOT; + PlayersOfferArea[ bSlotNum ].ItemObject.MoveThisObjectTo(gMoveingItem.ItemObject, MAX_OBJECTS_PER_SLOT); } else // completely legal object { @@ -4222,6 +4098,9 @@ void BeginSkiItemPointer( UINT8 ubSource, INT8 bSlotNum, BOOLEAN fOfferToDealerF Rect.iTop = SKI_ITEM_MOVEMENT_AREA_Y; Rect.iRight = SKI_ITEM_MOVEMENT_AREA_X + SKI_ITEM_MOVEMENT_AREA_WIDTH; Rect.iBottom = SKI_ITEM_MOVEMENT_AREA_Y + SKI_ITEM_MOVEMENT_AREA_HEIGHT; + if((UsingNewInventorySystem() == true)){ + Rect.iBottom += 60; + } gpItemPointer = &gMoveingItem.ItemObject; @@ -4244,10 +4123,10 @@ void BeginSkiItemPointer( UINT8 ubSource, INT8 bSlotNum, BOOLEAN fOfferToDealerF case PLAYERS_INVENTORY: // better be a valid merc pocket index, or -1 - Assert( ( bSlotNum >= -1 ) && ( bSlotNum < NUM_INV_SLOTS ) ); + Assert( ( bSlotNum >= -1 ) && ( bSlotNum < (INT8)gpSMCurrentMerc->inv.size() ) ); // if we're supposed to store the original pocket #, but that pocket still holds more of these - if ( ( bSlotNum != -1 ) && ( gpSMCurrentMerc->inv[ bSlotNum ].ubNumberOfObjects > 0 ) ) + if ( ( bSlotNum != -1 ) && ( gpSMCurrentMerc->inv[ bSlotNum ].exists() == true ) ) { // then we can't store the pocket #, because our system can't return stacked objects bSlotNum = -1; @@ -4266,19 +4145,19 @@ void BeginSkiItemPointer( UINT8 ubSource, INT8 bSlotNum, BOOLEAN fOfferToDealerF { // store the current contents of the cursor in a temporary object structure. // We have to do this before memsetting gMoveingItem, 'cause during swaps, gpItemPointer == &gMoveingItem.ItemObject! - CopyObj( gpItemPointer, &TempObject ); + gTempObject = *gpItemPointer; //ARM: The memset was previously commented out, in order to preserve the owning merc's inv slot # during a swap of // items in an inventory slot. However, that leads to other bugs: if you picked the thing you're swapping in from // a restricted inv slot (headgear, vest, etc.), the item swapped out will end up belonging to an illegal slot, and // return there with a right click on it in the player's offer area. So now ALL items picked up here are unowned. - memset( &gMoveingItem, 0, sizeof( INVENTORY_IN_SLOT ) ); + gMoveingItem.initialize(); //Get the item from the pointer - memcpy( &gMoveingItem.ItemObject, &TempObject, sizeof( OBJECTTYPE ) ); + gMoveingItem.ItemObject = gTempObject; gMoveingItem.fActive = TRUE; - gMoveingItem.sItemIndex = TempObject.usItem; + gMoveingItem.sItemIndex = gTempObject.usItem; gMoveingItem.ubLocationOfObject = ubSource; // By necessity, these items don't belong to a slot (so you can't return them via a right click), @@ -4291,6 +4170,9 @@ void BeginSkiItemPointer( UINT8 ubSource, INT8 bSlotNum, BOOLEAN fOfferToDealerF Rect.iTop = SKI_ITEM_MOVEMENT_AREA_Y; Rect.iRight = SKI_ITEM_MOVEMENT_AREA_X + SKI_ITEM_MOVEMENT_AREA_WIDTH; Rect.iBottom = SKI_ITEM_MOVEMENT_AREA_Y + SKI_ITEM_MOVEMENT_AREA_HEIGHT; + if((UsingNewInventorySystem() == true)){ + Rect.iBottom += 60; + } gpItemPointer = &gMoveingItem.ItemObject; gpItemPointerSoldier = gpSMCurrentMerc; @@ -4361,28 +4243,28 @@ void SetSkiCursor( UINT16 usCursor ) gusExternVoSubIndex = Item[ gMoveingItem.sItemIndex ].ubGraphicNum; SetCurrentCursorFromDatabase( EXTERN_CURSOR ); - MSYS_ChangeRegionCursor( &gSMPanelRegion, usCursor ); + MSYS_ChangeRegionCursor( &gSMPanelRegion, usCursor ); - MSYS_ChangeRegionCursor( &gSKI_EntireScreenMouseRegions, usCursor ); + MSYS_ChangeRegionCursor( &gSKI_EntireScreenMouseRegions, usCursor ); - MSYS_ChangeRegionCursor( &gArmsDealersDropItemToGroundMouseRegions, usCursor ); + MSYS_ChangeRegionCursor( &gArmsDealersDropItemToGroundMouseRegions, usCursor ); MSYS_SetCurrentCursor( usCursor ); //if the item desc window is up if( gInvDesc.uiFlags & MSYS_REGION_EXISTS ) - MSYS_ChangeRegionCursor( &gInvDesc, usCursor ); + MSYS_ChangeRegionCursor( &gInvDesc, usCursor ); for( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++) { if( gItemDescAttachmentRegions[ubCnt].uiFlags & MSYS_REGION_EXISTS ) - MSYS_ChangeRegionCursor( &gItemDescAttachmentRegions[ubCnt], usCursor ); + MSYS_ChangeRegionCursor( &gItemDescAttachmentRegions[ubCnt], usCursor ); } for( ubCnt=0; ubCntdata.money.uiMoneyAmount; } SetSkiRegionHelpText( &PlayersOfferArea[ ubSpotLocation ], &gPlayersOfferSlotsMouseRegions[ ubSpotLocation ], PLAYERS_OFFER_AREA ); @@ -4711,7 +4593,7 @@ void HandleShopKeeperDialog( UINT8 ubInit ) gfCommonQuoteUsedThisSession[ sRandomQuoteToUse ] = TRUE; //increase the random quote delay - guiRandomQuoteDelayTime += SKI_DEALERS_RANDOM_QUOTE_DELAY_INCREASE_RATE; + guiRandomQuoteDelayTime += SKI_DEALERS_RANDOM_QUOTE_DELAY_INCREASE_RATE; } } @@ -4764,7 +4646,7 @@ BOOLEAN IsGunOrAmmoOfSameTypeSelected( OBJECTTYPE *pItemObject ) //if there is a gun if( Item[ pItemObject->usItem ].usItemClass == IC_GUN ) { - //of the same caliber + //of the same caliber if( Weapon[ pItemObject->usItem ].ubCalibre == Magazine[ Item[ gpHighLightedItemObject->usItem ].ubClassIndex ].ubCalibre ) { return( TRUE ); @@ -4778,7 +4660,7 @@ BOOLEAN IsGunOrAmmoOfSameTypeSelected( OBJECTTYPE *pItemObject ) //if there is a gun if( Item[ pItemObject->usItem ].usItemClass == IC_AMMO ) { - //of the same caliber + //of the same caliber if( Weapon[ gpHighLightedItemObject->usItem ].ubCalibre == Magazine[ Item[ pItemObject->usItem ].ubClassIndex ].ubCalibre ) { return( TRUE ); @@ -4823,16 +4705,16 @@ void InitShopKeeperSubTitledText( STR16 pString ) UINT16 usActualHeight=0; SET_USE_WINFONTS( TRUE ); - SET_WINFONT( giSubTitleWinFont ); + SET_WINFONT( giSubTitleWinFont ); + - giPopUpBoxId = PrepareMercPopupBox( giPopUpBoxId, BASIC_MERC_POPUP_BACKGROUND, BASIC_MERC_POPUP_BORDER, gsShopKeeperTalkingText, 300, 0, 0, 0, &usActualWidth, &usActualHeight); - + SET_USE_WINFONTS( FALSE ); // gusPositionOfSubTitlesX = ( 640 - usActualWidth ) / 2 ; //position it to start under the guys face - + gusPositionOfSubTitlesX = 13 + SCREEN_X_OFFSET; RenderMercPopUpBoxFromIndex( giPopUpBoxId, gusPositionOfSubTitlesX, SKI_POSITION_SUBTITLES_Y, FRAME_BUFFER); @@ -4841,7 +4723,7 @@ void InitShopKeeperSubTitledText( STR16 pString ) if( !( gShopKeeperSubTitleMouseRegion.uiFlags & MSYS_REGION_EXISTS ) ) { MSYS_DefineRegion( &gShopKeeperSubTitleMouseRegion, gusPositionOfSubTitlesX, SKI_POSITION_SUBTITLES_Y, (INT16)(gusPositionOfSubTitlesX + usActualWidth), (INT16)(SKI_POSITION_SUBTITLES_Y + usActualHeight), MSYS_PRIORITY_HIGH, - CURSOR_NORMAL, MSYS_NO_CALLBACK, ShopKeeperSubTitleRegionCallBack ); + CURSOR_NORMAL, MSYS_NO_CALLBACK, ShopKeeperSubTitleRegionCallBack ); MSYS_AddRegion( &gShopKeeperSubTitleMouseRegion ); } @@ -5055,13 +4937,13 @@ void CreateSkiAtmButtons() ubCount=0; for( ubCnt=SKI_ATM_1; ubCnt<=SKI_ATM_9;ubCnt++) { - guiSKI_AtmButton[ubCnt] = CreateIconAndTextButton( guiSKI_AtmNumButtonImage, SkiAtmText[ubCnt], SKI_ATM_BUTTON_FONT, - SKI_ATM_BUTTON_COLOR, NO_SHADOW, - SKI_ATM_BUTTON_COLOR, NO_SHADOW, - TEXT_CJUSTIFIED, + guiSKI_AtmButton[ubCnt] = CreateIconAndTextButton( guiSKI_AtmNumButtonImage, SkiAtmText[ubCnt], SKI_ATM_BUTTON_FONT, + SKI_ATM_BUTTON_COLOR, NO_SHADOW, + SKI_ATM_BUTTON_COLOR, NO_SHADOW, + TEXT_CJUSTIFIED, usPosX, usPosY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+2, DEFAULT_MOVE_CALLBACK, BtnSKI_AtmButtonCallback ); - + SpecifyDisabledButtonStyle( guiSKI_AtmButton[ubCnt], DISABLED_STYLE_SHADED ); MSYS_SetBtnUserData(guiSKI_AtmButton[ubCnt], 0, ubCnt ); @@ -5078,10 +4960,10 @@ void CreateSkiAtmButtons() //Create the zero button usPosX = SKI_ATM_BUTTON_X; - guiSKI_AtmButton[SKI_ATM_0] = CreateIconAndTextButton( guiSKI_AtmOkButtonImage, SkiAtmText[SKI_ATM_0], SKI_ATM_BUTTON_FONT, - SKI_ATM_BUTTON_COLOR, NO_SHADOW, - SKI_ATM_BUTTON_COLOR, NO_SHADOW, - TEXT_CJUSTIFIED, + guiSKI_AtmButton[SKI_ATM_0] = CreateIconAndTextButton( guiSKI_AtmOkButtonImage, SkiAtmText[SKI_ATM_0], SKI_ATM_BUTTON_FONT, + SKI_ATM_BUTTON_COLOR, NO_SHADOW, + SKI_ATM_BUTTON_COLOR, NO_SHADOW, + TEXT_CJUSTIFIED, usPosX, usPosY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+2, DEFAULT_MOVE_CALLBACK, BtnSKI_AtmButtonCallback ); MSYS_SetBtnUserData(guiSKI_AtmButton[SKI_ATM_0], 0, SKI_ATM_0 ); @@ -5090,10 +4972,10 @@ void CreateSkiAtmButtons() //Create the ok button usPosX = SKI_ATM_BUTTON_X + SKI_ATM_NUM_BUTTON_WIDTH + 8; - guiSKI_AtmButton[SKI_ATM_OK] = CreateIconAndTextButton( guiSKI_AtmOkButtonImage, SkiAtmText[SKI_ATM_OK], SKI_ATM_BUTTON_FONT, - SKI_ATM_BUTTON_COLOR, NO_SHADOW, - SKI_ATM_BUTTON_COLOR, NO_SHADOW, - TEXT_CJUSTIFIED, + guiSKI_AtmButton[SKI_ATM_OK] = CreateIconAndTextButton( guiSKI_AtmOkButtonImage, SkiAtmText[SKI_ATM_OK], SKI_ATM_BUTTON_FONT, + SKI_ATM_BUTTON_COLOR, NO_SHADOW, + SKI_ATM_BUTTON_COLOR, NO_SHADOW, + TEXT_CJUSTIFIED, usPosX, usPosY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+2, DEFAULT_MOVE_CALLBACK, BtnSKI_AtmButtonCallback ); MSYS_SetBtnUserData(guiSKI_AtmButton[SKI_ATM_OK], 0, SKI_ATM_OK ); @@ -5104,10 +4986,10 @@ void CreateSkiAtmButtons() usPosY = SKI_ATM_BUTTON_Y; for( ubCnt=SKI_ATM_TAKE; ubCnt<=SKI_ATM_CLEAR;ubCnt++ ) { - guiSKI_AtmButton[ubCnt] = CreateIconAndTextButton( guiSKI_AtmSideMenuButtonImage, SkiAtmText[ubCnt], SKI_ATM_BUTTON_FONT, - SKI_ATM_BUTTON_COLOR, NO_SHADOW, - SKI_ATM_BUTTON_COLOR, NO_SHADOW, - TEXT_CJUSTIFIED, + guiSKI_AtmButton[ubCnt] = CreateIconAndTextButton( guiSKI_AtmSideMenuButtonImage, SkiAtmText[ubCnt], SKI_ATM_BUTTON_FONT, + SKI_ATM_BUTTON_COLOR, NO_SHADOW, + SKI_ATM_BUTTON_COLOR, NO_SHADOW, + TEXT_CJUSTIFIED, usPosX, usPosY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+2, DEFAULT_MOVE_CALLBACK, BtnSKI_AtmButtonCallback ); @@ -5149,7 +5031,7 @@ void BtnSKI_AtmButtonCallback(GUI_BUTTON *btn,INT32 reason) } if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { - UINT8 ubButton = (UINT8) MSYS_GetBtnUserData( btn, 0 ); + /*UINT8 ubButton = (UINT8) */MSYS_GetBtnUserData( btn, 0 ); btn->uiFlags &= (~BUTTON_CLICKED_ON ); //ATM: @@ -5158,7 +5040,7 @@ void BtnSKI_AtmButtonCallback(GUI_BUTTON *btn,INT32 reason) InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } -} +} @@ -5303,7 +5185,7 @@ void HandleAtmOK() } if( fOkToClear ) - { + { gubCurrentSkiAtmMode = SKI_ATM_DISABLED_MODE; EnableDisableSkiAtmButtons(); memset( gzSkiAtmTransferString, 0, 32 ); @@ -5328,7 +5210,7 @@ void AddNumberToSkiAtm( UINT8 ubNumber ) gubCurrentSkiAtmMode = SKI_ATM_TAKE_MODE; HandleCurrentModeText( gubCurrentSkiAtmMode ); } - //else if the mode was + //else if the mode was else if( gubCurrentSkiAtmMode == SKI_ATM_ERR_GIVE_MODE ) { gubCurrentSkiAtmMode = SKI_ATM_GIVE_MODE; @@ -5366,10 +5248,10 @@ void DisplaySkiAtmTransferString() wcscpy( zSkiAtmTransferString, gzSkiAtmTransferString ); InsertCommasForDollarFigure( zSkiAtmTransferString ); InsertDollarSignInToString( zSkiAtmTransferString ); - + //Display the transfer string - DrawTextToScreen( zSkiAtmTransferString, SKI_TRANSFER_STRING_X, SKI_TRANSFER_STRING_Y, SKI_TRANSFER_STRING_WIDTH, SKI_ATM_BUTTON_FONT, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); + DrawTextToScreen( zSkiAtmTransferString, SKI_TRANSFER_STRING_X, SKI_TRANSFER_STRING_Y, SKI_TRANSFER_STRING_WIDTH, SKI_ATM_BUTTON_FONT, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); // @@ -5381,8 +5263,8 @@ void DisplaySkiAtmTransferString() InsertCommasForDollarFigure( zSkiAtmTransferString ); InsertDollarSignInToString( zSkiAtmTransferString ); - - DrawTextToScreen( zSkiAtmTransferString, SKI_TRANSFER_STRING_X, SKI_MERCS_MONEY_Y, SKI_TRANSFER_STRING_WIDTH, SKI_ATM_BUTTON_FONT, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); + + DrawTextToScreen( zSkiAtmTransferString, SKI_TRANSFER_STRING_X, SKI_MERCS_MONEY_Y, SKI_TRANSFER_STRING_WIDTH, SKI_ATM_BUTTON_FONT, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); } @@ -5504,7 +5386,7 @@ void HandleCurrentModeText( UINT8 ubMode ) } } } - + switch( ubMode ) { case SKI_ATM_DISABLED_MODE: @@ -5519,7 +5401,7 @@ void HandleCurrentModeText( UINT8 ubMode ) wcscpy( zTemp, gzSkiAtmText[ SKI_ATM_MODE_TEXT_SELECT_FROM_MERC ] ); break; - + case SKI_ATM_GIVE_MODE: //if the player has selected any money yet if( gzSkiAtmTransferString[0] == L'\0' ) @@ -5609,7 +5491,7 @@ void EnableDisableEvaluateAndTransactionButtons() UINT32 uiPlayersOfferAreaTotalCost = CalculateTotalPlayersValue(); UINT32 uiPlayersOfferAreaTotalMoney = CalculateHowMuchMoneyIsInPlayersOfferArea( ); - + //loop through the players offer area //loop through all the items in the players offer area and determine if they can be sold here. for( ubCnt=0; ubCntdata.money.uiMoneyAmount; } } } @@ -5832,7 +5713,7 @@ void MovePlayersItemsToBeRepairedToArmsDealersInventory() { //for all items in the dealers items offer area UINT32 uiCnt; - + //loop through all the slots in the shopkeeper's offer area for( uiCnt=0; uiCntinv.size(); ubCnt++) { // Look for MONEY only, not Gold or Silver!!! And look for a slot not already full - if( ( pSoldier->inv[ ubCnt ].usItem == MONEY ) && ( pSoldier->inv[ ubCnt ].ItemData.Money.uiMoneyAmount < MoneySlotLimit( ubCnt ) ) ) + if( ( pSoldier->inv[ ubCnt ].usItem == MONEY ) && ( pSoldier->inv[ ubCnt ][0]->data.money.uiMoneyAmount < MoneySlotLimit( ubCnt ) ) ) { return( ubCnt ); } @@ -5903,7 +5783,7 @@ INT8 GetInvSlotOfUnfullMoneyInMercInventory( SOLDIERTYPE *pSoldier ) void ClearArmsDealerOfferSlot( INT32 ubSlotToClear ) { // Clear the contents - memset( &ArmsDealerOfferArea[ ubSlotToClear ], 0, sizeof( INVENTORY_IN_SLOT ) ); + ArmsDealerOfferArea[ ubSlotToClear ].initialize(); //Remove the mouse help text from the region SetRegionFastHelpText( &gDealersOfferSlotsMouseRegions[ ubSlotToClear ], L"" ); @@ -5919,7 +5799,7 @@ void ClearArmsDealerOfferSlot( INT32 ubSlotToClear ) void ClearPlayersOfferSlot( INT32 ubSlotToClear ) { // Clear the contents - memset( &PlayersOfferArea[ ubSlotToClear ], 0, sizeof( INVENTORY_IN_SLOT ) ); + PlayersOfferArea[ ubSlotToClear ].initialize(); //Clear the text for the item SetRegionFastHelpText( &gPlayersOfferSlotsMouseRegions[ ubSlotToClear ], L"" ); @@ -5993,7 +5873,7 @@ void EvaluateItemAddedToPlayersOfferArea( INT8 bSlotID, BOOLEAN fFirstOne ) //if the item is damaged, or is a rocket rifle (which always "need repairing" even at 100%, to reset imprinting) - if( ( PlayersOfferArea[ bSlotID ].ItemObject.ItemData.Generic.bStatus[ 0 ] < 100 ) || fRocketRifleWasEvaluated ) + if( ( PlayersOfferArea[ bSlotID ].ItemObject[0]->data.objectStatus < 100 ) || fRocketRifleWasEvaluated ) { INT8 bSlotAddedTo; @@ -6019,7 +5899,7 @@ void EvaluateItemAddedToPlayersOfferArea( INT8 bSlotID, BOOLEAN fFirstOne ) // check if the item is really badly damaged if( Item[ ArmsDealerOfferArea[ bSlotAddedTo ].sItemIndex ].usItemClass != IC_AMMO ) { - if( ArmsDealerOfferArea[ bSlotAddedTo ].ItemObject.ItemData.Generic.bStatus[ 0 ] < REALLY_BADLY_DAMAGED_THRESHOLD ) + if( ArmsDealerOfferArea[ bSlotAddedTo ].ItemObject[0]->data.objectStatus < REALLY_BADLY_DAMAGED_THRESHOLD ) { uiEvalResult = EVAL_RESULT_OK_BUT_REALLY_DAMAGED; } @@ -6095,12 +5975,12 @@ void EvaluateItemAddedToPlayersOfferArea( INT8 bSlotID, BOOLEAN fFirstOne ) { // then he doesn't have quotes 17, 19, or 20, always use 4. Devin doesn't have 18 either, // while the text of 18 seems wrong for Sam & Howard if offered something they should consider valuable. - sQuoteNum = SK_QUOTES_NOT_INTERESTED_IN_THIS_ITEM; + sQuoteNum = SK_QUOTES_NOT_INTERESTED_IN_THIS_ITEM; } else { // he accepts items, but not this one - sQuoteNum = SK_QUOTES_DURING_EVALUATION_STUFF_REJECTED; + sQuoteNum = SK_QUOTES_DURING_EVALUATION_STUFF_REJECTED; } break; @@ -6140,7 +6020,7 @@ void EvaluateItemAddedToPlayersOfferArea( INT8 bSlotID, BOOLEAN fFirstOne ) sQuoteNum = SK_QUOTES_EVALUATION_RESULT_NORMAL; } break; - + default: #ifdef JA2BETAVERSION ScreenMsg( FONT_MCOLOR_WHITE, MSG_BETAVERSION, L"Invalid evaluation result of %d. AM-0", uiEvalResult ); @@ -6309,7 +6189,7 @@ void CrossOutUnwantedItems( void ) INT8 bSlotId = 0; INT16 sBoxStartX = 0, sBoxStartY = 0; INT16 sBoxWidth = 0, sBoxHeight = 0; - + // load the "cross out" graphic GetVideoObject( &hHandle, guiItemCrossOut ); @@ -6368,7 +6248,7 @@ INT16 GetNumberOfItemsInPlayerOfferArea( void ) void HandleCheckIfEnoughOnTheTable( void ) { static INT32 iLastTime = 0; - INT32 iTime = 0, iDifference = 0, iRand = 0; + INT32 iDifference = 0, iRand = 0; UINT32 uiPlayersOfferAreaValue = CalculateTotalPlayersValue(); UINT32 uiArmsDealersItemsCost = CalculateTotalArmsDealerCost(); @@ -6414,9 +6294,9 @@ void InitShopKeeperItemDescBox( OBJECTTYPE *pObject, UINT8 ubPocket, UINT8 ubFro { UINT8 ubSelectedInvSlot = ubPocket - gSelectArmsDealerInfo.ubFirstItemIndexOnPage; - sPosX = SKI_ARMS_DEALERS_INV_START_X + ( SKI_INV_OFFSET_X * ( ubSelectedInvSlot % SKI_NUM_ARMS_DEALERS_INV_COLS ) - ( 358 / 2 ) ) + SKI_INV_SLOT_WIDTH / 2; + sPosX = SKI_ARMS_DEALERS_INV_START_X; // + ( SKI_INV_OFFSET_X * ( ubSelectedInvSlot % SKI_NUM_ARMS_DEALERS_INV_COLS ) - ( 358 / 2 ) ) + SKI_INV_SLOT_WIDTH / 2; - sPosY = SKI_ARMS_DEALERS_INV_START_Y + ( ( SKI_INV_OFFSET_Y * ubSelectedInvSlot / SKI_NUM_ARMS_DEALERS_INV_COLS ) + 1 ) - ( 128 / 2 ) + SKI_INV_SLOT_HEIGHT / 2; + sPosY = SKI_ARMS_DEALERS_INV_START_Y; // + ( ( SKI_INV_OFFSET_Y * ubSelectedInvSlot / SKI_NUM_ARMS_DEALERS_INV_COLS ) + 1 ) - ( 128 / 2 ) + SKI_INV_SLOT_HEIGHT / 2; //if the start position + the height of the box is off the screen, reposition if( sPosY < (0 + SCREEN_Y_OFFSET) ) @@ -6441,9 +6321,9 @@ void InitShopKeeperItemDescBox( OBJECTTYPE *pObject, UINT8 ubPocket, UINT8 ubFro case ARMS_DEALER_OFFER_AREA: { - sPosX = SKI_ARMS_DEALERS_TRADING_INV_X + ( SKI_INV_OFFSET_X * ( ubPocket % ( SKI_NUM_TRADING_INV_SLOTS/2) ) - ( 358 / 2 ) ) + SKI_INV_SLOT_WIDTH / 2; + sPosX = SKI_ARMS_DEALERS_TRADING_INV_X; // + ( SKI_INV_OFFSET_X * ( ubPocket % ( SKI_NUM_TRADING_INV_SLOTS/2) ) - ( 358 / 2 ) ) + SKI_INV_SLOT_WIDTH / 2; - sPosY = SKI_ARMS_DEALERS_TRADING_INV_Y + ( ( SKI_INV_OFFSET_Y * ubPocket / ( SKI_NUM_TRADING_INV_SLOTS/2) ) + 1 ) - ( 128 / 2 ) + SKI_INV_SLOT_HEIGHT / 2; + sPosY = SKI_ARMS_DEALERS_TRADING_INV_Y; // + ( ( SKI_INV_OFFSET_Y * ubPocket / ( SKI_NUM_TRADING_INV_SLOTS/2) ) + 1 ) - ( 128 / 2 ) + SKI_INV_SLOT_HEIGHT / 2; //if the start position + the height of the box is off the screen, reposition if( sPosY < (SCREEN_Y_OFFSET + 0) ) @@ -6487,7 +6367,7 @@ void StartSKIDescriptionBox( void ) // ShadowVideoSurfaceRect( FRAME_BUFFER, 0, 0, 640, 480 ); //if the current merc is too far away, dont shade the SM panel because it is already shaded - + // WANNE: Do not shade the background if( gfSMDisableForItems ) DrawHatchOnInventory( FRAME_BUFFER, SCREEN_X_OFFSET, SCREEN_Y_OFFSET, SKI_INTERFACE_WIDTH, SKI_INTERFACE_HEIGHT ); @@ -6532,7 +6412,6 @@ void StartSKIDescriptionBox( void ) // if( giItemDescAmmoButton >= 0 && ButtonList[ giItemDescAmmoButton ]. // DisableButton( giItemDescAmmoButton ); - RenderItemDescriptionBox( ); } @@ -6545,7 +6424,7 @@ void DeleteShopKeeperItemDescBox() pShopKeeperItemDescObject = NULL; gubSkiDirtyLevel = SKI_DIRTY_LEVEL2; - //Redraw the face + //Redraw the face gFacesData[ giShopKeeperFaceIndex ].uiFlags |= FACE_REDRAW_WHOLE_FACE_NEXT_FRAME; @@ -6592,9 +6471,8 @@ void DeleteShopKeeperItemDescBox() -BOOLEAN OfferObjectToDealer( OBJECTTYPE *pComplexObject, UINT8 ubOwnerProfileId, INT8 bOwnerSlotId ) +BOOLEAN OfferObjectToDealer( OBJECTTYPE *pComplexObject, UINT8 ubOwnerProfileId, INT16 bOwnerSlotId ) { - UINT8 ubTotalSubObjects; UINT8 ubRepairableSubObjects; UINT8 ubNonRepairableSubObjects; UINT8 ubDealerOfferAreaSlotsNeeded; @@ -6603,7 +6481,7 @@ BOOLEAN OfferObjectToDealer( OBJECTTYPE *pComplexObject, UINT8 ubOwnerProfileId, UINT8 ubHowManyMoreItemsCanDealerTake; UINT8 ubSubObject; BOOLEAN fFirstOne = TRUE; - BOOLEAN fSuccess = FALSE; + BOOLEAN fSuccess = FALSE; if ( ArmsDealerInfo[ gbSelectedArmsDealerID ].ubTypeOfArmsDealer != ARMS_DEALER_REPAIRS ) @@ -6621,7 +6499,7 @@ BOOLEAN OfferObjectToDealer( OBJECTTYPE *pComplexObject, UINT8 ubOwnerProfileId, SplitComplexObjectIntoSubObjects( pComplexObject ); // determine how many subobjects of each category this complex object will have to be broken up into - CountSubObjectsInObject( pComplexObject, &ubTotalSubObjects, &ubRepairableSubObjects, &ubNonRepairableSubObjects ); + CountSubObjectsInObject( pComplexObject, &ubRepairableSubObjects, &ubNonRepairableSubObjects ); // in the simplest situation, the # subobjects of each type gives us how many slots of each type are needed ubDealerOfferAreaSlotsNeeded = ubRepairableSubObjects; @@ -6629,8 +6507,8 @@ BOOLEAN OfferObjectToDealer( OBJECTTYPE *pComplexObject, UINT8 ubOwnerProfileId, // consider that if dealer is at or will reach his max # of items repaired limit, not everything repairable will move ubHowManyMoreItemsCanDealerTake = SKI_MAX_AMOUNT_OF_ITEMS_DEALER_CAN_REPAIR_AT_A_TIME - - CountTotalItemsRepairDealerHasInForRepairs( gbSelectedArmsDealerID ) - - CountNumberOfItemsInTheArmsDealersOfferArea(); + CountTotalItemsRepairDealerHasInForRepairs( gbSelectedArmsDealerID ) - + CountNumberOfItemsInTheArmsDealersOfferArea(); // if he can't repair everything repairable that we're about to submit, the space we'll need changes if ( ubDealerOfferAreaSlotsNeeded > ubHowManyMoreItemsCanDealerTake ) @@ -6647,6 +6525,7 @@ BOOLEAN OfferObjectToDealer( OBJECTTYPE *pComplexObject, UINT8 ubOwnerProfileId, ubPlayerOfferAreaSlotsNeeded++; } + //this is a silly assert, was it meant to be something else? Assert( SKI_MAX_AMOUNT_OF_ITEMS_DEALER_CAN_REPAIR_AT_A_TIME < SKI_NUM_TRADING_INV_SLOTS ); /* This code is commented out because a repair dealer will never be allowed to repair over more then @@ -6668,29 +6547,25 @@ BOOLEAN OfferObjectToDealer( OBJECTTYPE *pComplexObject, UINT8 ubOwnerProfileId, } // we have room, so move them all to the appropriate slots - for ( ubSubObject = 0; ubSubObject < MAX_SUBOBJECTS_PER_OBJECT; ubSubObject++ ) + for ( ubSubObject = 0; ubSubObject < subObjects.size(); ubSubObject++ ) { - // if there is something stored there - if ( gSubObject[ ubSubObject ].usItem != NONE ) + // if it's the main item itself (always in the very first subobject), and it has no other subobjects + if ( ( ubSubObject == 0 ) && ( subObjects.size() == 1) ) { - // if it's the main item itself (always in the very first subobject), and it has no other subobjects - if ( ( ubSubObject == 0 ) && ( ubTotalSubObjects == 1) ) - { - // store its owner merc as the owner, and store the correct slot - fSuccess = AddObjectForEvaluation( &gSubObject[ ubSubObject ], ubOwnerProfileId, bOwnerSlotId, fFirstOne ); - } - else // attachments, bullets/payload - { - // store it with a valid owner, but an invalid slot, so it still shows who owns it, but can't return to its slot -// ARM: New code will be needed here if we add parent/child item support & interface - fSuccess = AddObjectForEvaluation( &gSubObject[ ubSubObject ], ubOwnerProfileId, -1, fFirstOne ); - } - - // it has to succeed, or we have a bug in our earlier check for sufficient room - Assert( fSuccess ); - - fFirstOne = FALSE; + // store its owner merc as the owner, and store the correct slot + fSuccess = AddObjectForEvaluation( &subObjects[ ubSubObject ], ubOwnerProfileId, bOwnerSlotId, fFirstOne ); } + else // attachments, bullets/payload + { + // store it with a valid owner, but an invalid slot, so it still shows who owns it, but can't return to its slot +// ARM: New code will be needed here if we add parent/child item support & interface + fSuccess = AddObjectForEvaluation( &subObjects[ ubSubObject ], ubOwnerProfileId, -1, fFirstOne ); + } + + // it has to succeed, or we have a bug in our earlier check for sufficient room + Assert( fSuccess ); + + fFirstOne = FALSE; } gfAlreadySaidTooMuchToRepair = FALSE; @@ -6699,7 +6574,7 @@ BOOLEAN OfferObjectToDealer( OBJECTTYPE *pComplexObject, UINT8 ubOwnerProfileId, //ARM: This comment isn't true unless parent/child support is added. Right now repairmen don't do this! // NOTE that, either way, if owned, the item remains in the merc's inventory (hatched out) until the transaction is completed - // Dirty + // Dirty fInterfacePanelDirty = DIRTYLEVEL2; return(TRUE); // it worked @@ -6709,186 +6584,102 @@ BOOLEAN OfferObjectToDealer( OBJECTTYPE *pComplexObject, UINT8 ubOwnerProfileId, void SplitComplexObjectIntoSubObjects( OBJECTTYPE *pComplexObject ) { - OBJECTTYPE *pNextObj = &gSubObject[ 0 ]; - UINT8 ubNextFreeSlot = 0; - UINT8 ubCnt; - - Assert( pComplexObject ); - Assert( pComplexObject->ubNumberOfObjects > 0 ); - Assert( pComplexObject->ubNumberOfObjects <= MAX_OBJECTS_PER_SLOT ); + Assert( pComplexObject->exists() == true ); + subObjects.clear(); + int usItem = pComplexObject->usItem; + for (int x = 0; x < pComplexObject->ubNumberOfObjects; ++x) { + //we need not worry about attachments!!!! - // clear subobject array - memset (gSubObject, 0, sizeof( OBJECTTYPE ) * MAX_SUBOBJECTS_PER_OBJECT ); + if (pComplexObject->MoveThisObjectTo(gTempObject, 1) == 0) { + subObjects.push_back(gTempObject); + StackedObjectData* pData = subObjects.back()[0]; - - // if it isn't stacked - if ( pComplexObject->ubNumberOfObjects == 1 ) - { - // make the main item into the very first subobject - CopyObj( pComplexObject, pNextObj ); - - // strip off any loaded ammo/payload - if ( Item [ pComplexObject->usItem ].usItemClass == IC_GUN ) - { - // Exception: don't do this with rocket launchers, their "shots left" are fake and this screws 'em up! - if ( !Item[pComplexObject->usItem].singleshotrocketlauncher ) // Madd rpg - still do this + // if it's a gun + if ( Item [ usItem ].usItemClass == IC_GUN ) { - pNextObj->ItemData.Gun.ubGunShotsLeft = 0; - pNextObj->ItemData.Gun.usGunAmmoItem = NONE; - } + int usGunAmmoItem = pData->data.gun.usGunAmmoItem; + int ubGunShotsLeft = pData->data.gun.ubGunShotsLeft; + int bGunAmmoStatus = pData->data.gun.bGunAmmoStatus; -/* gunAmmoStatus is currently not being used that way, it's strictly used as a jammed/unjammed, and so should never be 0 - // if jammed, must remember that, so leave it - if ( pNextObj->bGunAmmoStatus > 0 ) - { - pNextObj->bGunAmmoStatus = 0; - } -*/ - } - -/* ARM: Can now repair with removeable attachments still attached... - // strip off any seperable attachments - for( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++ ) - { - if ( pComplexObject->usAttachItem[ ubCnt ] != NONE ) - { - // If the attachment is detachable - if (! (Item[ pComplexObject->usAttachItem[ ubCnt ] ].fFlags & ITEM_INSEPARABLE ) ) + // strip off any loaded ammo/payload + // Exception: don't do this with rocket launchers, their "shots left" are fake and this screws 'em up! + if ( !Item[usItem].singleshotrocketlauncher ) // Madd rpg - still do this { - pNextObj->usAttachItem[ ubCnt ] = NONE; - pNextObj->bAttachStatus[ ubCnt ] = 0; + pData->data.gun.usGunAmmoItem = NONE; + pData->data.gun.ubGunShotsLeft = 0; + pData->data.gun.ubGunState = 0; + pData->data.gun.ubGunAmmoType = 0; + pData->data.gun.bGunAmmoStatus = 0; } - } - } -*/ - // advance to next available subobject - pNextObj = &gSubObject[ ++ubNextFreeSlot ]; - - - // if it's a gun - if ( Item [ pComplexObject->usItem ].usItemClass == IC_GUN ) - { - // and it has ammo/payload - if ( pComplexObject->ItemData.Gun.usGunAmmoItem != NONE ) - { - // if it's bullets - if ( Item[ pComplexObject->ItemData.Gun.usGunAmmoItem ].usItemClass == IC_AMMO ) + // and it has ammo/payload + if ( usGunAmmoItem != NONE ) { - // and there are some left - if ( pComplexObject->ItemData.Gun.ubGunShotsLeft > 0 ) + // if it's bullets + if ( Item[ usGunAmmoItem ].usItemClass == IC_AMMO ) { - // make the bullets into another subobject - CreateItem( pComplexObject->ItemData.Gun.usGunAmmoItem, 100, pNextObj ); - // set how many are left - pNextObj->ItemData.Generic.bStatus[ 0 ] = pComplexObject->ItemData.Gun.ubGunShotsLeft; - - pNextObj = &gSubObject[ ++ubNextFreeSlot ]; + // and there are some left + if ( ubGunShotsLeft > 0 ) + { + // make the bullets into another subobject + CreateAmmo( usGunAmmoItem, &gTempObject, ubGunShotsLeft ); + subObjects.push_back(gTempObject); + } + // ignore this if it's out of bullets } - // ignore this if it's out of bullets - } - else // non-ammo payload - { - // make the payload into another subobject - CreateItem( pComplexObject->ItemData.Gun.usGunAmmoItem, pComplexObject->ItemData.Gun.bGunAmmoStatus, pNextObj ); - - // if the gun was jammed, fix up the payload's status - if ( pNextObj->ItemData.Generic.bStatus[ 0 ] < 0 ) + else // non-ammo payload { - pNextObj->ItemData.Generic.bStatus[ 0 ] *= -1; + // if the gun was jammed, fix up the payload's status + if ( bGunAmmoStatus < 0 ) + { + bGunAmmoStatus *= -1; + } + + // make the payload into another subobject + CreateItem( usGunAmmoItem, bGunAmmoStatus, &gTempObject ); + subObjects.push_back(gTempObject); } - - pNextObj = &gSubObject[ ++ubNextFreeSlot ]; } } } - - -/* ARM: Can now repair with removeable attachments still attached... - // make each detachable attachment into a separate subobject - for( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++ ) - { - if ( pComplexObject->usAttachItem[ ubCnt ] != NONE ) - { - // If the attachment is detachable - if (! (Item[ pComplexObject->usAttachItem[ ubCnt ] ].fFlags & ITEM_INSEPARABLE ) ) - { - CreateItem( pComplexObject->usAttachItem[ ubCnt ], pComplexObject->bAttachStatus[ ubCnt ], pNextObj ); - - pNextObj = &gSubObject[ ++ubNextFreeSlot ]; - } - } - } -*/ - } - else // stacked - { - // these can't be guns, can't have any attachments, can't be imprinted, etc. - Assert ( Item [ pComplexObject->usItem ].usItemClass != IC_GUN ); - - for( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++ ) - { - Assert( pComplexObject->usAttachItem[ ubCnt ] == NONE ); - } - - // make each item in the stack into a separate subobject - for( ubCnt = 0; ubCnt < pComplexObject->ubNumberOfObjects; ubCnt++ ) - { - CreateItem( pComplexObject->usItem, pComplexObject->ItemData.Generic.bStatus[ ubCnt ], pNextObj ); - - // advance to next available subobject - pNextObj = &gSubObject[ ++ubNextFreeSlot ]; - } } - - // make sure we didn't screw up and honk something! - Assert( ubNextFreeSlot <= MAX_SUBOBJECTS_PER_OBJECT ); } -void CountSubObjectsInObject( OBJECTTYPE *pComplexObject, UINT8 *pubTotalSubObjects, UINT8 *pubRepairableSubObjects, UINT8 *pubNonRepairableSubObjects ) +void CountSubObjectsInObject( OBJECTTYPE *pComplexObject, UINT8 *pubRepairableSubObjects, UINT8 *pubNonRepairableSubObjects ) { UINT8 ubSubObject; - *pubTotalSubObjects = 0; *pubRepairableSubObjects = 0; *pubNonRepairableSubObjects = 0; // check every subobject and count it as either repairable or non- - for ( ubSubObject = 0; ubSubObject < MAX_SUBOBJECTS_PER_OBJECT; ubSubObject++ ) + for ( ubSubObject = 0; ubSubObject < subObjects.size(); ubSubObject++ ) { - // if there is something stored there - if ( gSubObject[ ubSubObject ].usItem != NONE ) + // is it in need of fixing, and also repairable by this dealer? + // A jammed gun with a 100% status is NOT repairable - shouldn't ever happen + if ( ( subObjects[ ubSubObject ][0]->data.objectStatus != 100 ) && + CanDealerRepairItem( gbSelectedArmsDealerID, subObjects[ ubSubObject ].usItem ) ) { - ( *pubTotalSubObjects )++; - - // is it in need of fixing, and also repairable by this dealer? - // A jammed gun with a 100% status is NOT repairable - shouldn't ever happen - if ( ( gSubObject[ ubSubObject ].ItemData.Generic.bStatus[ 0 ] != 100 ) && - CanDealerRepairItem( gbSelectedArmsDealerID, gSubObject[ ubSubObject ].usItem ) ) - - { - ( *pubRepairableSubObjects )++; - } - else - { - ( *pubNonRepairableSubObjects )++; - } + ( *pubRepairableSubObjects )++; + } + else + { + ( *pubNonRepairableSubObjects )++; } } } -BOOLEAN AddObjectForEvaluation(OBJECTTYPE *pObject, UINT8 ubOwnerProfileId, INT8 bOwnerSlotId, BOOLEAN fFirstOne ) +BOOLEAN AddObjectForEvaluation(OBJECTTYPE *pObject, UINT8 ubOwnerProfileId, INT16 bOwnerSlotId, BOOLEAN fFirstOne ) { INVENTORY_IN_SLOT InvSlot; INT8 bAddedToSlotID; // Make a new inv slot out of the subobject - memset( &InvSlot, 0, sizeof( INVENTORY_IN_SLOT ) ); - memcpy( &InvSlot.ItemObject, pObject, sizeof( OBJECTTYPE ) ); + InvSlot.ItemObject = *pObject; InvSlot.sItemIndex = pObject->usItem; InvSlot.ubLocationOfObject = PLAYERS_INVENTORY; @@ -6916,31 +6707,25 @@ BOOLEAN AddObjectForEvaluation(OBJECTTYPE *pObject, UINT8 ubOwnerProfileId, INT8 // This is because the OBJECTTYPEs used within Shopkeeper may contain an illegal ubNumberOfObjects BOOLEAN ShopkeeperAutoPlaceObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObject, BOOLEAN fNewItem ) { - OBJECTTYPE CopyOfObject; - UINT8 ubObjectsLeftToPlace; - // the entire pObj will get memset to 0 by RemoveObjs() if all the items are successfully placed, // so we have to keep a copy to retrieve with every iteration of the loop - memcpy( &CopyOfObject, pObject, sizeof( OBJECTTYPE ) ); + OBJECTTYPE movingObject; - ubObjectsLeftToPlace = pObject->ubNumberOfObjects; - - while ( ubObjectsLeftToPlace > 0 ) + while ( pObject->exists() == true ) { // figure out how many to place during this loop iteration. Can't do more than MAX_OBJECTS_PER_SLOT at a time - pObject->ubNumberOfObjects = min( MAX_OBJECTS_PER_SLOT, ubObjectsLeftToPlace); - ubObjectsLeftToPlace -= pObject->ubNumberOfObjects; + int numToMove = min( MAX_OBJECTS_PER_SLOT, pObject->ubNumberOfObjects); - if (!AutoPlaceObject( pSoldier, pObject, fNewItem )) + pObject->MoveThisObjectTo(movingObject, numToMove); + if (!AutoPlaceObject( pSoldier, &movingObject, fNewItem )) + //if (!AutoPlaceObject( pSoldier, pObject, fNewItem )) { + //CHRISL: When we call this, we don't care about cap limits so stack up to max // no more room, didn't all fit - add back in any that we didn't even get to yet - pObject->ubNumberOfObjects += ubObjectsLeftToPlace; + pObject->AddObjectsToStack(movingObject, -1, 0, NUM_INV_SLOTS, MAX_OBJECTS_PER_SLOT); return( FALSE ); } - - // restore object properties from our backup copy - memcpy( pObject, &CopyOfObject, sizeof( OBJECTTYPE ) ); } return( TRUE ); @@ -6952,25 +6737,17 @@ BOOLEAN ShopkeeperAutoPlaceObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObject, // This is because the OBJECTTYPEs used within Shopkeeper may contain an illegal ubNumberOfObjects void ShopkeeperAddItemToPool( INT16 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel ) { - OBJECTTYPE CopyOfObject; - UINT8 ubObjectsLeftToPlace; - // the entire pObj will get memset to 0 by RemoveObjs() if all the items are successfully placed, // so we have to keep a copy to retrieve with every iteration of the loop - memcpy( &CopyOfObject, pObject, sizeof( OBJECTTYPE ) ); + OBJECTTYPE movingObject; - ubObjectsLeftToPlace = pObject->ubNumberOfObjects; - - while ( ubObjectsLeftToPlace > 0 ) + while ( pObject->exists() == true ) { // figure out how many to place during this loop iteration. Can't do more than MAX_OBJECTS_PER_SLOT at a time - pObject->ubNumberOfObjects = min( MAX_OBJECTS_PER_SLOT, ubObjectsLeftToPlace); - ubObjectsLeftToPlace -= pObject->ubNumberOfObjects; + int numToMove = min( MAX_OBJECTS_PER_SLOT, pObject->ubNumberOfObjects); - AddItemToPool( sGridNo, pObject, bVisible, ubLevel, usFlags, bRenderZHeightAboveLevel ); - - // restore object properties from our backup copy - memcpy( pObject, &CopyOfObject, sizeof( OBJECTTYPE ) ); + pObject->MoveThisObjectTo(movingObject, numToMove); + AddItemToPool( sGridNo, &movingObject, bVisible, ubLevel, usFlags, bRenderZHeightAboveLevel ); } } @@ -6983,18 +6760,19 @@ void IfMercOwnedCopyItemToMercInv( INVENTORY_IN_SLOT *pInv ) //if the item picked up was in a previous location, and that location is on a merc's inventory if ( ( pInv->bSlotIdInOtherLocation != -1 ) && ( pInv->ubIdOfMercWhoOwnsTheItem != NO_PROFILE ) ) { - // then it better be a valid slot # - Assert( pInv->bSlotIdInOtherLocation < NUM_INV_SLOTS ); - // and it better have a valid merc who owned it - Assert( pInv->ubIdOfMercWhoOwnsTheItem != NO_PROFILE ); - // get soldier sSoldierID = GetSoldierIDFromMercID( pInv->ubIdOfMercWhoOwnsTheItem ); Assert( sSoldierID != -1 ); Assert( CanMercInteractWithSelectedShopkeeper( MercPtrs[ sSoldierID ] ) ); + // then it better be a valid slot # + Assert( pInv->bSlotIdInOtherLocation < (INT8)Menptr[ sSoldierID ].inv.size() ); + // and it better have a valid merc who owned it + Assert( pInv->ubIdOfMercWhoOwnsTheItem != NO_PROFILE ); + + //Copy the object back into that merc's original inventory slot - CopyObj( &( pInv->ItemObject ), &( Menptr[ sSoldierID ].inv[ pInv->bSlotIdInOtherLocation ] ) ); + Menptr[ sSoldierID ].inv[ pInv->bSlotIdInOtherLocation ] = pInv->ItemObject; } } @@ -7005,27 +6783,22 @@ void IfMercOwnedRemoveItemFromMercInv( INVENTORY_IN_SLOT *pInv ) } -void IfMercOwnedRemoveItemFromMercInv2( UINT8 ubOwnerProfileId, INT8 bOwnerSlotId ) +void IfMercOwnedRemoveItemFromMercInv2( UINT8 ubOwnerProfileId, INT16 bOwnerSlotId ) { - INT16 sSoldierID; - BOOLEAN fSuccess; - OBJECTTYPE ObjectToRemove; - //if this item was in a previous location, and that location is on a merc's inventory if ( ( bOwnerSlotId != -1 ) && ( ubOwnerProfileId != NO_PROFILE ) ) { - // then it better be a valid slot # - Assert( bOwnerSlotId < NUM_INV_SLOTS ); // and it better have a valid merc who owned it Assert( ubOwnerProfileId != NO_PROFILE ); - - sSoldierID = GetSoldierIDFromMercID( ubOwnerProfileId ); + INT16 sSoldierID = GetSoldierIDFromMercID( ubOwnerProfileId ); Assert( sSoldierID != -1 ); + // then it better be a valid slot # + Assert( bOwnerSlotId < (INT8)Menptr[ sSoldierID ].inv.size() ); + Assert( CanMercInteractWithSelectedShopkeeper( MercPtrs[ sSoldierID ] ) ); //remove the object from that merc's original inventory slot - fSuccess = RemoveObjectFromSlot( &Menptr[ sSoldierID ], bOwnerSlotId, &ObjectToRemove ); - Assert(fSuccess); + DeleteObj(&(Menptr[ sSoldierID ].inv[bOwnerSlotId])); } } @@ -7099,7 +6872,7 @@ BOOLEAN SKITryToAddInvToMercsInventory( INVENTORY_IN_SLOT *pInv, SOLDIERTYPE *pS PlaceObject( pSoldier, bMoneyInvPos, &( pInv->ItemObject ) ); // if the money is all gone - if ( pInv->ItemObject.ItemData.Money.uiMoneyAmount == 0 ) + if ( pInv->ItemObject[0]->data.money.uiMoneyAmount == 0 ) { // we've been succesful! return(TRUE); @@ -7140,16 +6913,16 @@ BOOLEAN CanMercInteractWithSelectedShopkeeper( SOLDIERTYPE *pSoldier ) Assert( pShopkeeper->bActive ); Assert( pShopkeeper->bInSector ); - if ( pShopkeeper->bLife < OKLIFE ) + if ( pShopkeeper->stats.bLife < OKLIFE ) { return( FALSE ); } - if ( pSoldier->bActive && pSoldier->bInSector && IsMercOnCurrentSquad( pSoldier ) && ( pSoldier->bLife >= OKLIFE ) && - !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) ) + if ( pSoldier->bActive && pSoldier->bInSector && IsMercOnCurrentSquad( pSoldier ) && ( pSoldier->stats.bLife >= OKLIFE ) && + !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) ) { sDestGridNo = pShopkeeper->sGridNo; - bDestLevel = pShopkeeper->bLevel; + bDestLevel = pShopkeeper->pathing.bLevel; // If he has LOS... if ( SoldierTo3DLocationLineOfSightTest( pSoldier, sDestGridNo, bDestLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) { @@ -7179,7 +6952,7 @@ void AddShopkeeperToGridNo( UINT8 ubProfile, INT16 sGridNo ) GetCurrentWorldSector( &sSectorX, &sSectorY ); - memset( &MercCreateStruct, 0, sizeof( MercCreateStruct ) ); + MercCreateStruct.initialize(); MercCreateStruct.bTeam = CIV_TEAM; MercCreateStruct.ubProfile = ubProfile; MercCreateStruct.sSectorX = sSectorX; @@ -7277,7 +7050,6 @@ void ResetAllQuoteSaidFlags() void DealWithItemsStillOnTheTable() { - BOOLEAN fAddedCorrectly = FALSE; UINT8 ubCnt; SOLDIERTYPE *pDropSoldier; @@ -7338,7 +7110,7 @@ void ReturnItemToPlayerSomehow( INVENTORY_IN_SLOT *pInvSlot, SOLDIERTYPE *pDropS { // failed to add item, inventory probably filled up or item is unowned and current merc ineligible. // drop it at the specified guy's feet instead - ShopkeeperAddItemToPool( pDropSoldier->sGridNo, &pInvSlot->ItemObject, VISIBLE, pDropSoldier->bLevel, 0, 0 ); + ShopkeeperAddItemToPool( pDropSoldier->sGridNo, &pInvSlot->ItemObject, VISIBLE, pDropSoldier->pathing.bLevel, 0, 0 ); } } } @@ -7349,8 +7121,6 @@ void GivePlayerSomeChange( UINT32 uiAmount ) { INVENTORY_IN_SLOT MoneyInvSlot; - memset( &MoneyInvSlot, 0, sizeof ( MoneyInvSlot ) ); - CreateMoney( uiAmount, &MoneyInvSlot.ItemObject ); MoneyInvSlot.sItemIndex = MoneyInvSlot.ItemObject.usItem; MoneyInvSlot.ubLocationOfObject = PLAYERS_INVENTORY; @@ -7358,7 +7128,7 @@ void GivePlayerSomeChange( UINT32 uiAmount ) AddItemToPlayersOfferArea( NO_PROFILE, &MoneyInvSlot, -1 ); - if ( ( gbSelectedArmsDealerID == ARMS_DEALER_JAKE ) && + if ( ( gbSelectedArmsDealerID == ARMS_DEALER_JAKE ) && ( gArmsDealerStatus[ gbSelectedArmsDealerID ].uiArmsDealersCash < uiAmount ) ) { // HACK HACK HACK: We forgot to write/record quote 27 for Jake, so he ALWAYS must have enough money! @@ -7419,7 +7189,7 @@ void HandlePossibleRepairDelays() if( !gArmsDealerStatus[ gbSelectedArmsDealerID ].fRepairDelayBeenUsed ) { // and it's been a while since the player last dealt with this repairman (within SKI that is) - // this serves 2 purposes: + // this serves 2 purposes: // a) reduces delays being much more likely if player checks time remaining very frequently, AND // b) gives time for the events described in the text of the dealers' excuses to happen (e.g. scouting trip) if ( ( GetWorldTotalMin() - gArmsDealerStatus[ gbSelectedArmsDealerID ].uiTimePlayerLastInSKI ) >= ( 3 * 60 ) ) @@ -7449,61 +7219,41 @@ void HandlePossibleRepairDelays() BOOLEAN RepairmanFixingAnyItemsThatShouldBeDoneNow( UINT32 *puiHoursSinceOldestItemRepaired ) { - UINT16 usItemIndex; - UINT8 ubElement; - DEALER_ITEM_HEADER *pDealerItem; - DEALER_SPECIAL_ITEM *pSpecialItem; + //if the dealer is not a repair dealer, return + if( !DoesDealerDoRepairs( gbSelectedArmsDealerID ) ) + return( FALSE ); + BOOLEAN fFoundOne = FALSE; UINT32 uiMinutesSinceItWasDone; UINT32 uiMinutesShopClosedSinceItWasDone; UINT32 uiWorkingHoursSinceThisItemRepaired; - - //if the dealer is not a repair dealer, return - if( !DoesDealerDoRepairs( gbSelectedArmsDealerID ) ) - return( FALSE ); - *puiHoursSinceOldestItemRepaired = 0; + UINT32 currentTime = GetWorldTotalMin(); //loop through the dealers inventory and check if there are only unrepaired items - for( usItemIndex = 1; usItemIndex < MAXITEMS; usItemIndex++ ) - { - if ( Item[usItemIndex].usItemClass == 0 ) - break; - - pDealerItem = &( gArmsDealersInventory[ gbSelectedArmsDealerID ][ usItemIndex ] ); - - //if there is some items in stock - if( pDealerItem->ubTotalItems ) + for (DealerItemList::iterator iter = gArmsDealersInventory[gbSelectedArmsDealerID].begin(); + iter != gArmsDealersInventory[gbSelectedArmsDealerID].end(); ++iter) { + if ( iter->ItemIsInInventory() == true ) { - //loop through the array of items - for( ubElement=0; ubElement< pDealerItem->ubElementsAlloced; ubElement++ ) + if( iter->IsUnderRepair() == true ) { - pSpecialItem = &( pDealerItem->SpecialItem[ ubElement ] ); - - if ( pSpecialItem->fActive ) + //if the repairs are done + if( iter->uiRepairDoneTime <= currentTime ) { - //if the items status is below 0, the item is being repaired - if( pSpecialItem->Info.bItemCondition < 0 ) + // at least one item is supposed to be done by now + fFoundOne = TRUE; + + uiMinutesSinceItWasDone = currentTime - iter->uiRepairDoneTime; + uiMinutesShopClosedSinceItWasDone = CalculateMinutesClosedBetween( gbSelectedArmsDealerID, iter->uiRepairDoneTime, currentTime ); + + // calculate how many WORKING hours since this item's been repaired + uiWorkingHoursSinceThisItemRepaired = ( uiMinutesSinceItWasDone - uiMinutesShopClosedSinceItWasDone ) / 60; + + // we need to determine how long it's been since the item that's been repaired for the longest time was done + if ( uiWorkingHoursSinceThisItemRepaired > *puiHoursSinceOldestItemRepaired ) { - //if the repairs are done - if( pSpecialItem->uiRepairDoneTime <= GetWorldTotalMin() ) - { - // at least one item is supposed to be done by now - fFoundOne = TRUE; - - uiMinutesSinceItWasDone = GetWorldTotalMin() - pSpecialItem->uiRepairDoneTime; - uiMinutesShopClosedSinceItWasDone = CalculateMinutesClosedBetween( gbSelectedArmsDealerID, pSpecialItem->uiRepairDoneTime, GetWorldTotalMin() ); - - // calculate how many WORKING hours since this item's been repaired - uiWorkingHoursSinceThisItemRepaired = ( uiMinutesSinceItWasDone - uiMinutesShopClosedSinceItWasDone ) / 60; - - // we need to determine how long it's been since the item that's been repaired for the longest time was done - if ( uiWorkingHoursSinceThisItemRepaired > *puiHoursSinceOldestItemRepaired ) - { - *puiHoursSinceOldestItemRepaired = uiWorkingHoursSinceThisItemRepaired; - } - } + *puiHoursSinceOldestItemRepaired = uiWorkingHoursSinceThisItemRepaired; } } } @@ -7518,10 +7268,6 @@ BOOLEAN RepairmanFixingAnyItemsThatShouldBeDoneNow( UINT32 *puiHoursSinceOldestI void DelayRepairsInProgressBy( UINT32 uiMinutesDelayed ) { - UINT16 usItemIndex; - UINT8 ubElement; - DEALER_ITEM_HEADER *pDealerItem; - DEALER_SPECIAL_ITEM *pSpecialItem; UINT32 uiMinutesShopClosedBeforeItsDone; @@ -7530,32 +7276,15 @@ void DelayRepairsInProgressBy( UINT32 uiMinutesDelayed ) return; //loop through the dealers inventory and check if there are only unrepaired items - for( usItemIndex = 1; usItemIndex < MAXITEMS; usItemIndex++ ) - { - if ( Item[usItemIndex].usItemClass == 0 ) - return; - - pDealerItem = &( gArmsDealersInventory[ gbSelectedArmsDealerID ][ usItemIndex ] ); - - //if there is some items in stock - if( pDealerItem->ubTotalItems ) + for (DealerItemList::iterator iter = gArmsDealersInventory[gbSelectedArmsDealerID].begin(); + iter != gArmsDealersInventory[gbSelectedArmsDealerID].end(); ++iter) { + if ( iter->ItemIsInInventory() == true ) { - //loop through the array of items - for( ubElement=0; ubElement< pDealerItem->ubElementsAlloced; ubElement++ ) + if( iter->IsUnderRepair() == true ) { - pSpecialItem = &( pDealerItem->SpecialItem[ ubElement ] ); - - if ( pSpecialItem->fActive ) - { - //if the items status is below 0, the item is being repaired - if( pSpecialItem->Info.bItemCondition < 0 ) - { - uiMinutesShopClosedBeforeItsDone = CalculateOvernightRepairDelay( gbSelectedArmsDealerID, pSpecialItem->uiRepairDoneTime, uiMinutesDelayed ); - - // add this many minutes to the repair time estimate - pSpecialItem->uiRepairDoneTime += ( uiMinutesShopClosedBeforeItsDone + uiMinutesDelayed ); - } - } + uiMinutesShopClosedBeforeItsDone = CalculateOvernightRepairDelay( gbSelectedArmsDealerID, iter->uiRepairDoneTime, uiMinutesDelayed ); + // add this many minutes to the repair time estimate + iter->uiRepairDoneTime += ( uiMinutesShopClosedBeforeItsDone + uiMinutesDelayed ); } } } @@ -7566,7 +7295,7 @@ void DelayRepairsInProgressBy( UINT32 uiMinutesDelayed ) //Mouse Call back for the Arms delaers face void SelectArmsDealersDropItemToGroundRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) { - // WANNE: Not needed to drop the item to the ground -> on the right side of the shopkeeper screen! + // WANNE 2: not needed to drop the item to the ground->on the right side of the shopkeeper screen! /* if (iReason & MSYS_CALLBACK_REASON_INIT) { @@ -7588,9 +7317,9 @@ void SelectArmsDealersDropItemToGroundRegionCallBack(MOUSE_REGION * pRegion, INT //if we don't have an item, pick one up if( gMoveingItem.sItemIndex != 0 ) { - + //add the item to the ground - ShopkeeperAddItemToPool( pDropSoldier->sGridNo, &gMoveingItem.ItemObject, VISIBLE, pDropSoldier->bLevel, 0, 0 ); + ShopkeeperAddItemToPool( pDropSoldier->sGridNo, &gMoveingItem.ItemObject, VISIBLE, pDropSoldier->pathing.bLevel, 0, 0 ); //Reset the cursor SetSkiCursor( CURSOR_NORMAL ); @@ -7603,7 +7332,7 @@ void SelectArmsDealersDropItemToGroundRegionCallBack(MOUSE_REGION * pRegion, INT } void SelectArmsDealersDropItemToGroundMovementRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ if( iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { gfSkiDisplayDropItemToGroundText = FALSE; @@ -7689,7 +7418,7 @@ UINT32 EvaluateInvSlot( INVENTORY_IN_SLOT *pInvSlot ) // check if the item is really badly damaged if( Item[ pInvSlot->sItemIndex ].usItemClass != IC_AMMO ) { - if( pInvSlot->ItemObject.ItemData.Generic.bStatus[ 0 ] < REALLY_BADLY_DAMAGED_THRESHOLD ) + if( pInvSlot->ItemObject[0]->data.objectStatus < REALLY_BADLY_DAMAGED_THRESHOLD ) { uiEvalResult = EVAL_RESULT_OK_BUT_REALLY_DAMAGED; } @@ -7761,7 +7490,7 @@ void BuildRepairTimeString( CHAR16 sString[], UINT32 uiTimeInMinutesToFixItem ) -void BuildDoneWhenTimeString( CHAR16 sString[], UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubElement ) +void BuildDoneWhenTimeString( CHAR16 sString[], UINT8 ubArmsDealer, INVENTORY_IN_SLOT* pObject ) { UINT32 uiDoneTime; UINT32 uiDay, uiHour, uiMin; @@ -7769,21 +7498,30 @@ void BuildDoneWhenTimeString( CHAR16 sString[], UINT8 ubArmsDealer, UINT16 usIte //dealer must be a repair dealer Assert( DoesDealerDoRepairs( ubArmsDealer ) ); - // element index must be valid - Assert( ubElement < gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].ubElementsAlloced ); - // that item must be active - Assert( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].fActive ); + + DEALER_SPECIAL_ITEM* pSpecial = 0; + for (DealerItemList::iterator iter = gArmsDealersInventory[ubArmsDealer].begin(); + iter != gArmsDealersInventory[ubArmsDealer].end(); ++iter) { + if (iter->ItemIsInInventory() == true && iter->IsUnderRepair() == true) { + if (pObject->ItemObject == iter->object) { + pSpecial = &(*iter); + break; + } + } + } + + Assert(pSpecial); // that item must be in repair - Assert( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].Info.bItemCondition < 0 ); + Assert( pSpecial->IsUnderRepair() == true ); //if the item has already been repaired - if( gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].uiRepairDoneTime <= GetWorldTotalMin() ) + uiDoneTime = pSpecial->uiRepairDoneTime; + if( uiDoneTime <= GetWorldTotalMin() ) { wcscpy( sString, L"" ); return; } - uiDoneTime = gArmsDealersInventory[ ubArmsDealer ][ usItemIndex ].SpecialItem[ ubElement ].uiRepairDoneTime; // round off to next higher 15 minutes if ( ( uiDoneTime % REPAIR_MINUTES_INTERVAL ) > 0 ) diff --git a/Tactical/ShopKeeper Interface.h b/Tactical/ShopKeeper Interface.h index a2362d43..0e05fd6c 100644 --- a/Tactical/ShopKeeper Interface.h +++ b/Tactical/ShopKeeper Interface.h @@ -41,22 +41,47 @@ enum #define ARMS_INV_PLAYERS_ITEM_HAS_BEEN_EVALUATED 0x00000080 // The Players item has been evaluated -typedef struct +class OLD_INVENTORY_IN_SLOT_101 { - BOOLEAN fActive; +public: + BOOLEAN fActive; INT16 sItemIndex; - UINT32 uiFlags; - OBJECTTYPE ItemObject; - UINT8 ubLocationOfObject; //An enum value for the location of the item ( either in the arms dealers inventory, one of the offer areas or in the users inventory) + UINT32 uiFlags; + OLD_OBJECTTYPE_101 oldItemObject; + UINT8 ubLocationOfObject; //An enum value for the location of the item ( either in the arms dealers inventory, one of the offer areas or in the users inventory) INT8 bSlotIdInOtherLocation; UINT8 ubIdOfMercWhoOwnsTheItem; - UINT32 uiItemPrice; //Only used for the players item that have been evaluated + UINT32 uiItemPrice; //Only used for the players item that have been evaluated - INT16 sSpecialItemElement; // refers to which special item element an item in a dealer's inventory area - // occupies. -1 Means the item is "perfect" and has no associated special item. + INT16 sSpecialItemElement; // refers to which special item element an item in a dealer's inventory area + // occupies. -1 Means the item is "perfect" and has no associated special item. +}; -} INVENTORY_IN_SLOT; +class INVENTORY_IN_SLOT +{ +public: + BOOLEAN Save(HWFILE hFile); + BOOLEAN Load(HWFILE hFile); + INVENTORY_IN_SLOT() {initialize();}; + INVENTORY_IN_SLOT& operator=(OLD_INVENTORY_IN_SLOT_101& src); + void initialize(); + BOOLEAN fActive; + INT16 sItemIndex; + UINT32 uiFlags; + UINT8 ubLocationOfObject; //An enum value for the location of the item ( either in the arms dealers inventory, one of the offer areas or in the users inventory) + INT16 bSlotIdInOtherLocation; + + UINT8 ubIdOfMercWhoOwnsTheItem; + UINT32 uiItemPrice; //Only used for the players item that have been evaluated + + UINT32 uiRepairDoneTime; //so that we can sort repairman's inventory easily + + char endOfPod; + OBJECTTYPE ItemObject; +}; + +#define SIZEOF_INVENTORY_IN_SLOT_POD offsetof (INVENTORY_IN_SLOT, endOfPod) @@ -88,14 +113,16 @@ UINT32 ShopKeeperScreenInit( void ); UINT32 ShopKeeperScreenHandle( void ); UINT32 ShopKeeperScreenShutdown( void ); +bool ArmsDealerItemQsortCompare(INVENTORY_IN_SLOT& pInvSlot1, INVENTORY_IN_SLOT& pInvSlot2); +bool RepairmanItemQsortCompare(INVENTORY_IN_SLOT& pInvSlot1, INVENTORY_IN_SLOT& pInvSlot2); void EnterShopKeeperInterfaceScreen( UINT8 ubArmsDealer ); -void DrawHatchOnInventory( UINT32 uiSurface, UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT16 usHeight ); +void DrawHatchOnInventory( UINT32 uiSurface, UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT16 usHeight, UINT16 usColor = 0 ); BOOLEAN ShouldSoldierDisplayHatchOnItem( UINT8 ubProfileID, INT16 sSlotNum ); -INT8 AddItemToPlayersOfferArea( UINT8 ubProfileID, INVENTORY_IN_SLOT* pInvSlot, INT8 bSlotIdInOtherLocation ); +INT8 AddItemToPlayersOfferArea( UINT8 ubProfileID, INVENTORY_IN_SLOT* pInvSlot, INT16 bSlotIdInOtherLocation ); void ConfirmToDeductMoneyFromPlayersAccountMessageBoxCallBack( UINT8 bExitValue ); void ConfirmDontHaveEnoughForTheDealerMessageBoxCallBack( UINT8 bExitValue ); @@ -104,7 +131,7 @@ void SetSkiCursor( UINT16 usCursor ); void InitShopKeeperSubTitledText( STR16 pString ); -void AddItemToPlayersOfferAreaAfterShopKeeperOpen( OBJECTTYPE *pItemObject, INT8 bPreviousInvPos ); +void AddItemToPlayersOfferAreaAfterShopKeeperOpen( OBJECTTYPE *pItemObject); void BeginSkiItemPointer( UINT8 ubSource, INT8 bSlotNum, BOOLEAN fOfferToDealerFirst ); diff --git a/Tactical/ShopKeeper Quotes.h b/Tactical/ShopKeeper Quotes.h index 3c29b14c..1240083a 100644 --- a/Tactical/ShopKeeper Quotes.h +++ b/Tactical/ShopKeeper Quotes.h @@ -31,7 +31,7 @@ enum NUM_COMMON_SK_QUOTES, - // Quotes 28+ are NPC Specific, and are not under direct control of the SKI system. The get used by .COD files + // Quotes 28+ are NPC Specific, and are not under direct control of the SKI system. The get used by .COD files }; diff --git a/Tactical/SkillCheck.cpp b/Tactical/SkillCheck.cpp index d1708e3a..fb97a67f 100644 --- a/Tactical/SkillCheck.cpp +++ b/Tactical/SkillCheck.cpp @@ -8,7 +8,7 @@ #include "Dialogue Control.h" #include "Overhead.h" #include "Soldier macros.h" - #include "Isometric Utils.h" + #include "Isometric Utils.h" #include "Morale.h" #include "drugs and alcohol.h" #include "strategicmap.h" @@ -22,12 +22,12 @@ INT8 EffectiveStrength( SOLDIERTYPE * pSoldier ) // Effective strength is: // 1/2 full strength // plus 1/2 strength scaled according to how hurt we are - bBandaged = pSoldier->bLifeMax - pSoldier->bLife - pSoldier->bBleeding; + bBandaged = pSoldier->stats.bLifeMax - pSoldier->stats.bLife - pSoldier->bBleeding; - if (pSoldier->bStrength > 0) + if (pSoldier->stats.bStrength > 0) { - iEffStrength = pSoldier->bStrength / 2; - iEffStrength += (pSoldier->bStrength / 2) * (pSoldier->bLife + bBandaged / 2) / (pSoldier->bLifeMax); + iEffStrength = pSoldier->stats.bStrength / 2; + iEffStrength += (pSoldier->stats.bStrength / 2) * (pSoldier->stats.bLife + bBandaged / 2) / (pSoldier->stats.bLifeMax); } else { @@ -45,7 +45,7 @@ INT8 EffectiveWisdom( SOLDIERTYPE * pSoldier ) { INT32 iEffWisdom; - iEffWisdom = pSoldier->bWisdom; + iEffWisdom = pSoldier->stats.bWisdom; iEffWisdom = EffectStatForBeingDrunk( pSoldier, iEffWisdom ); @@ -56,7 +56,7 @@ INT8 EffectiveAgility( SOLDIERTYPE * pSoldier ) { INT32 iEffAgility; - iEffAgility = pSoldier->bAgility; + iEffAgility = pSoldier->stats.bAgility; iEffAgility = EffectStatForBeingDrunk( pSoldier, iEffAgility ); @@ -73,7 +73,7 @@ INT8 EffectiveMechanical( SOLDIERTYPE * pSoldier ) { INT32 iEffMechanical; - iEffMechanical = pSoldier->bMechanical; + iEffMechanical = pSoldier->stats.bMechanical; iEffMechanical = EffectStatForBeingDrunk( pSoldier, iEffMechanical ); @@ -85,7 +85,7 @@ INT8 EffectiveExplosive( SOLDIERTYPE * pSoldier ) { INT32 iEffExplosive; - iEffExplosive = pSoldier->bExplosive; + iEffExplosive = pSoldier->stats.bExplosive; iEffExplosive = EffectStatForBeingDrunk( pSoldier, iEffExplosive ); @@ -97,7 +97,7 @@ INT8 EffectiveMedical( SOLDIERTYPE * pSoldier ) { INT32 iEffMedical; - iEffMedical = pSoldier->bMedical; + iEffMedical = pSoldier->stats.bMedical; iEffMedical = EffectStatForBeingDrunk( pSoldier, iEffMedical ); @@ -109,7 +109,7 @@ INT8 EffectiveLeadership( SOLDIERTYPE * pSoldier ) INT32 iEffLeadership; INT8 bDrunkLevel; - iEffLeadership = pSoldier->bLeadership; + iEffLeadership = pSoldier->stats.bLeadership; // if we are drunk, effect leader ship in a +ve way... bDrunkLevel = GetDrunkLevel( pSoldier ); @@ -126,15 +126,15 @@ INT8 EffectiveExpLevel( SOLDIERTYPE * pSoldier ) { INT32 iEffExpLevel; INT8 bDrunkLevel; - INT32 iExpModifier[] = + INT32 iExpModifier[] = { 0, // SOBER 0, // Feeling good -1, // Borderline -2, // Drunk - 0, // Hung + 0, // Hung }; - iEffExpLevel = pSoldier->bExpLevel; + iEffExpLevel = pSoldier->stats.bExpLevel; bDrunkLevel = GetDrunkLevel( pSoldier ); @@ -164,7 +164,7 @@ INT8 EffectiveMarksmanship( SOLDIERTYPE * pSoldier ) { INT32 iEffMarksmanship; - iEffMarksmanship = pSoldier->bMarksmanship; + iEffMarksmanship = pSoldier->stats.bMarksmanship; iEffMarksmanship = EffectStatForBeingDrunk( pSoldier, iEffMarksmanship ); @@ -175,7 +175,7 @@ INT8 EffectiveDexterity( SOLDIERTYPE * pSoldier ) { INT32 iEffDexterity; - iEffDexterity = pSoldier->bDexterity; + iEffDexterity = pSoldier->stats.bDexterity; iEffDexterity = EffectStatForBeingDrunk( pSoldier, iEffDexterity ); @@ -188,12 +188,12 @@ UINT8 GetPenaltyForFatigue( SOLDIERTYPE *pSoldier ) { UINT8 ubPercentPenalty; - if ( pSoldier->bBreathMax >= 85 ) ubPercentPenalty = 0; - else if ( pSoldier->bBreathMax >= 70 ) ubPercentPenalty = 10; - else if ( pSoldier->bBreathMax >= 50 ) ubPercentPenalty = 25; - else if ( pSoldier->bBreathMax >= 30 ) ubPercentPenalty = 50; - else if ( pSoldier->bBreathMax >= 15 ) ubPercentPenalty = 75; - else if ( pSoldier->bBreathMax > 0 ) ubPercentPenalty = 90; + if ( pSoldier->bBreathMax >= 85 ) ubPercentPenalty = 0; + else if ( pSoldier->bBreathMax >= 70 ) ubPercentPenalty = 10; + else if ( pSoldier->bBreathMax >= 50 ) ubPercentPenalty = 25; + else if ( pSoldier->bBreathMax >= 30 ) ubPercentPenalty = 50; + else if ( pSoldier->bBreathMax >= 15 ) ubPercentPenalty = 75; + else if ( pSoldier->bBreathMax > 0 ) ubPercentPenalty = 90; else ubPercentPenalty = 100; return( ubPercentPenalty ); @@ -219,7 +219,7 @@ INT32 SkillCheck( SOLDIERTYPE * pSoldier, INT8 bReason, INT8 bChanceMod ) INT32 iLoop; SOLDIERTYPE * pTeamSoldier; INT8 bBuddyIndex; - BOOLEAN fForceDamnSound = FALSE; + BOOLEAN fForceDamnSound = FALSE; iReportChance = -1; @@ -228,14 +228,14 @@ INT32 SkillCheck( SOLDIERTYPE * pSoldier, INT8 bReason, INT8 bChanceMod ) case LOCKPICKING_CHECK: case ELECTRONIC_LOCKPICKING_CHECK: - fForceDamnSound = TRUE; + fForceDamnSound = TRUE; iSkill = EffectiveMechanical( pSoldier ); if (iSkill == 0) { break; } - // adjust skill based on wisdom (knowledge) + // adjust skill based on wisdom (knowledge) iSkill = iSkill * (EffectiveWisdom( pSoldier ) + 100) / 200; // and dexterity (clumsy?) iSkill = iSkill * (EffectiveDexterity( pSoldier ) + 100) / 200; @@ -258,11 +258,11 @@ INT32 SkillCheck( SOLDIERTYPE * pSoldier, INT8 bReason, INT8 bChanceMod ) // this should never happen, but might as well check... iSkill = 0; } - iSkill = iSkill * pSoldier->inv[bSlot].ItemData.Generic.bStatus[0] / 100; + iSkill = iSkill * pSoldier->inv[bSlot][0]->data.objectStatus / 100; break; case ATTACHING_DETONATOR_CHECK: case ATTACHING_REMOTE_DETONATOR_CHECK: - iSkill = EffectiveExplosive( pSoldier ); + iSkill = EffectiveExplosive( pSoldier ); if (iSkill == 0) { break; @@ -295,7 +295,7 @@ INT32 SkillCheck( SOLDIERTYPE * pSoldier, INT8 bReason, INT8 bChanceMod ) case DISARM_TRAP_CHECK: - fForceDamnSound = TRUE; + fForceDamnSound = TRUE; iSkill = EffectiveExplosive( pSoldier ) * 7; if ( iSkill == 0 ) @@ -311,7 +311,7 @@ INT32 SkillCheck( SOLDIERTYPE * pSoldier, INT8 bReason, INT8 bChanceMod ) case DISARM_ELECTRONIC_TRAP_CHECK: - fForceDamnSound = TRUE; + fForceDamnSound = TRUE; iSkill = __max( EffectiveMechanical( pSoldier ) , EffectiveExplosive( pSoldier ) ) * 7; if ( iSkill == 0 ) @@ -333,7 +333,7 @@ INT32 SkillCheck( SOLDIERTYPE * pSoldier, INT8 bReason, INT8 bChanceMod ) case OPEN_WITH_CROWBAR: // Add for crowbar... iSkill = EffectiveStrength( pSoldier ) + 20; - fForceDamnSound = TRUE; + fForceDamnSound = TRUE; break; case SMASH_DOOR_CHECK: @@ -357,7 +357,7 @@ INT32 SkillCheck( SOLDIERTYPE * pSoldier, INT8 bReason, INT8 bChanceMod ) { break; } - // adjust skill based on wisdom (knowledge) + // adjust skill based on wisdom (knowledge) iSkill = iSkill * (EffectiveWisdom( pSoldier ) + 100) / 200; // and dexterity (clumsy?) iSkill = iSkill * (EffectiveDexterity( pSoldier ) + 100) / 200; @@ -449,13 +449,13 @@ INT32 SkillCheck( SOLDIERTYPE * pSoldier, INT8 bReason, INT8 bChanceMod ) // silent check break; default: - DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); break; } } } - else + else { // A buddy might make a positive comment based on our success; // Increase the chance for people with higher skill and for more difficult tasks @@ -463,11 +463,11 @@ INT32 SkillCheck( SOLDIERTYPE * pSoldier, INT8 bReason, INT8 bChanceMod ) if (iRoll < iChance) { // If a buddy of this merc is standing around nearby, they'll make a positive comment. - iLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + iLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; for ( pTeamSoldier = MercPtrs[ iLoop ]; iLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; iLoop++,pTeamSoldier++ ) { if ( OK_INSECTOR_MERC( pTeamSoldier ) ) - { + { bBuddyIndex = WhichBuddy( pTeamSoldier->ubProfile, pSoldier->ubProfile ); if (bBuddyIndex >= 0 && SpacesAway( pSoldier->sGridNo, pTeamSoldier->sGridNo ) < 15) { @@ -491,7 +491,7 @@ INT32 SkillCheck( SOLDIERTYPE * pSoldier, INT8 bReason, INT8 bChanceMod ) } } } - } + } } return( iMadeItBy ); } @@ -504,8 +504,8 @@ INT8 CalcTrapDetectLevel( SOLDIERTYPE * pSoldier, BOOLEAN fExamining ) INT8 bDetectLevel; // formula: 1 pt for every exp_level - // plus 1 pt for every 40 explosives - // less 1 pt for every 20 wisdom MISSING + // plus 1 pt for every 40 explosives + // less 1 pt for every 20 wisdom MISSING bDetectLevel = EffectiveExpLevel( pSoldier ); bDetectLevel += (EffectiveExplosive( pSoldier ) / 40); @@ -517,9 +517,9 @@ INT8 CalcTrapDetectLevel( SOLDIERTYPE * pSoldier, BOOLEAN fExamining ) { bDetectLevel += (INT8) PreRandom(bDetectLevel / 3 + 2); } - + // if substantially bleeding, or still in serious shock, randomly lower value - if ((pSoldier->bBleeding > 20) || (pSoldier->bShock > 1)) + if ((pSoldier->bBleeding > 20) || (pSoldier->aiData.bShock > 1)) { bDetectLevel -= (INT8) PreRandom(3); } diff --git a/Tactical/Soldier Add.cpp b/Tactical/Soldier Add.cpp index 0c96119b..398a2011 100644 --- a/Tactical/Soldier Add.cpp +++ b/Tactical/Soldier Add.cpp @@ -2,7 +2,7 @@ #include "Tactical All.h" #else #include "sgp.h" - #include "Soldier Control.h" + #include "overhead.h" #include "overhead types.h" #include "isometric utils.h" @@ -23,10 +23,15 @@ #include "Exit Grids.h" #endif + +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + // Adds a soldier to a world gridno and set's direction void AddSoldierToSectorGridNo( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection, BOOLEAN fUseAnimation, UINT16 usAnimState, UINT16 usAnimCode ); -UINT16 FindGridNoFromSweetSpotWithStructData( SOLDIERTYPE *pSoldier, UINT16 usAnimState, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection, BOOLEAN fClosestToMerc ); +INT16 FindGridNoFromSweetSpotWithStructData( SOLDIERTYPE *pSoldier, UINT16 usAnimState, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection, BOOLEAN fClosestToMerc ); // SO, STEPS IN CREATING A MERC! @@ -45,17 +50,17 @@ UINT16 FindGridNoFromSweetSpotWithStructData( SOLDIERTYPE *pSoldier, UINT16 usAn // Now we have an allocated soldier, we just need to set him in the world! // 3) When we want them in the world, call AddSoldierToSector(). // This function sets the graphic in the world, lighting effects, etc -// It also formally adds it to the TacticalSoldier slot and interface panel slot. +// It also formally adds it to the TacticalSoldier slot and interface panel slot. -//Kris: modified to actually path from sweetspot to gridno. Previously, it only checked if the +//Kris: modified to actually path from sweetspot to gridno. Previously, it only checked if the //destination was sittable (though it was possible that that location would be trapped. -UINT16 FindGridNoFromSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ) +INT16 FindGridNoFromSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ) { - INT16 sTop, sBottom; - INT16 sLeft, sRight; - INT16 cnt1, cnt2; + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2; INT16 sGridNo; INT32 uiRange, uiLowestRange = 999999; INT16 sLowestGridNo=-1; @@ -65,26 +70,23 @@ UINT16 FindGridNoFromSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 UINT8 ubSaveNPCAPBudget; UINT8 ubSaveNPCDistLimit; - //Save AI pathing vars. changing the distlimit restricts how + //Save AI pathing vars. changing the distlimit restricts how //far away the pathing will consider. ubSaveNPCAPBudget = gubNPCAPBudget; ubSaveNPCDistLimit = gubNPCDistLimit; gubNPCAPBudget = 0; gubNPCDistLimit = ubRadius; - // WDS - Clean up inventory handling //create dummy soldier, and use the pathing to determine which nearby slots are //reachable. - //memset( &soldier, 0, SIZEOF_SOLDIERTYPE ); - soldier.initialize(); - soldier.bLevel = 0; + soldier.pathing.bLevel = 0; soldier.bTeam = 1; soldier.sGridNo = sSweetGridNo; - + sTop = ubRadius; sBottom = -ubRadius; - sLeft = - ubRadius; - sRight = ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; //clear the mapelements of potential residue MAPELEMENT_REACHABLE flags //in the square region. @@ -103,11 +105,11 @@ UINT16 FindGridNoFromSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 } } - //Now, find out which of these gridnos are reachable + //Now, find out which of these gridnos are reachable //(use the fake soldier and the pathing settings) FindBestPath( &soldier, NOWHERE, 0, WALKING, COPYREACHABLE, ( PATH_IGNORE_PERSON_AT_DEST | PATH_THROUGH_PEOPLE ) ); - - uiLowestRange = 999999; + + uiLowestRange = 999999; for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) { @@ -116,16 +118,16 @@ UINT16 FindGridNoFromSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 for( cnt2 = sLeft; cnt2 <= sRight; cnt2++ ) { sGridNo = sSweetGridNo + ( WORLD_COLS * cnt1 ) + cnt2; - if( sGridNo >=0 && sGridNo < WORLD_MAX && sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) + if( sGridNo >=0 && sGridNo < WORLD_MAX && sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) && gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE ) { // Go on sweet stop - if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->bLevel ) ) + if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) ) { // ATE: INstead of using absolute range, use the path cost! - //uiRange = PlotPath( &soldier, sGridNo, NO_COPYROUTE, NO_PLOT, TEMPORARY, WALKING, NOT_STEALTH, FORWARD, 50 ); + //uiRange = PlotPath( &soldier, sGridNo, NO_COPYROUTE, NO_PLOT, TEMPORARY, WALKING, NOT_STEALTH, FORWARD, 50 ); uiRange = CardinalSpacesAway( sSweetGridNo, sGridNo ); - + // if ( uiRange == 0 ) // { // uiRange = 999999; @@ -146,7 +148,7 @@ UINT16 FindGridNoFromSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 if ( fFound ) { // Set direction to center of map! - *pubDirection = (UINT8)GetDirectionToGridNoFromGridNo( sLowestGridNo, ( ( ( WORLD_ROWS / 2 ) * WORLD_COLS ) + ( WORLD_COLS / 2 ) ) ); + *pubDirection = (UINT8)GetDirectionToGridNoFromGridNo( sLowestGridNo, ( ( ( WORLD_ROWS / 2 ) * WORLD_COLS ) + ( WORLD_COLS / 2 ) ) ); return( sLowestGridNo ); } else @@ -155,11 +157,11 @@ UINT16 FindGridNoFromSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 } } -UINT16 FindGridNoFromSweetSpotThroughPeople( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ) +INT16 FindGridNoFromSweetSpotThroughPeople( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ) { - INT16 sTop, sBottom; - INT16 sLeft, sRight; - INT16 cnt1, cnt2; + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2; INT16 sGridNo; INT32 uiRange, uiLowestRange = 999999; INT16 sLowestGridNo=-1; @@ -169,26 +171,23 @@ UINT16 FindGridNoFromSweetSpotThroughPeople( SOLDIERTYPE *pSoldier, INT16 sSweet UINT8 ubSaveNPCAPBudget; UINT8 ubSaveNPCDistLimit; - //Save AI pathing vars. changing the distlimit restricts how + //Save AI pathing vars. changing the distlimit restricts how //far away the pathing will consider. ubSaveNPCAPBudget = gubNPCAPBudget; ubSaveNPCDistLimit = gubNPCDistLimit; gubNPCAPBudget = 0; gubNPCDistLimit = ubRadius; - // WDS - Clean up inventory handling //create dummy soldier, and use the pathing to determine which nearby slots are //reachable. - //memset( &soldier, 0, SIZEOF_SOLDIERTYPE ); - soldier.initialize(); - soldier.bLevel = 0; + soldier.pathing.bLevel = 0; soldier.bTeam = pSoldier->bTeam; soldier.sGridNo = sSweetGridNo; - + sTop = ubRadius; sBottom = -ubRadius; - sLeft = - ubRadius; - sRight = ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; //clear the mapelements of potential residue MAPELEMENT_REACHABLE flags //in the square region. @@ -207,11 +206,11 @@ UINT16 FindGridNoFromSweetSpotThroughPeople( SOLDIERTYPE *pSoldier, INT16 sSweet } } - //Now, find out which of these gridnos are reachable + //Now, find out which of these gridnos are reachable //(use the fake soldier and the pathing settings) FindBestPath( &soldier, NOWHERE, 0, WALKING, COPYREACHABLE, ( PATH_IGNORE_PERSON_AT_DEST | PATH_THROUGH_PEOPLE ) ); - - uiLowestRange = 999999; + + uiLowestRange = 999999; for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) { @@ -220,11 +219,11 @@ UINT16 FindGridNoFromSweetSpotThroughPeople( SOLDIERTYPE *pSoldier, INT16 sSweet for( cnt2 = sLeft; cnt2 <= sRight; cnt2++ ) { sGridNo = sSweetGridNo + ( WORLD_COLS * cnt1 ) + cnt2; - if( sGridNo >=0 && sGridNo < WORLD_MAX && sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) + if( sGridNo >=0 && sGridNo < WORLD_MAX && sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) && gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE ) { // Go on sweet stop - if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->bLevel ) ) + if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) ) { uiRange = GetRangeInCellCoordsFromGridNoDiff( sSweetGridNo, sGridNo ); @@ -245,7 +244,7 @@ UINT16 FindGridNoFromSweetSpotThroughPeople( SOLDIERTYPE *pSoldier, INT16 sSweet if ( fFound ) { // Set direction to center of map! - *pubDirection = (UINT8)GetDirectionToGridNoFromGridNo( sLowestGridNo, ( ( ( WORLD_ROWS / 2 ) * WORLD_COLS ) + ( WORLD_COLS / 2 ) ) ); + *pubDirection = (UINT8)GetDirectionToGridNoFromGridNo( sLowestGridNo, ( ( ( WORLD_ROWS / 2 ) * WORLD_COLS ) + ( WORLD_COLS / 2 ) ) ); return( sLowestGridNo ); } else @@ -255,13 +254,13 @@ UINT16 FindGridNoFromSweetSpotThroughPeople( SOLDIERTYPE *pSoldier, INT16 sSweet } -//Kris: modified to actually path from sweetspot to gridno. Previously, it only checked if the +//Kris: modified to actually path from sweetspot to gridno. Previously, it only checked if the //destination was sittable (though it was possible that that location would be trapped. -UINT16 FindGridNoFromSweetSpotWithStructData( SOLDIERTYPE *pSoldier, UINT16 usAnimState, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection, BOOLEAN fClosestToMerc ) +INT16 FindGridNoFromSweetSpotWithStructData( SOLDIERTYPE *pSoldier, UINT16 usAnimState, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection, BOOLEAN fClosestToMerc ) { - INT16 sTop, sBottom; - INT16 sLeft, sRight; - INT16 cnt1, cnt2, cnt3; + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2, cnt3; INT16 sGridNo; INT32 uiRange, uiLowestRange = 999999; INT16 sLowestGridNo=-1; @@ -272,33 +271,30 @@ UINT16 FindGridNoFromSweetSpotWithStructData( SOLDIERTYPE *pSoldier, UINT16 usAn UINT8 ubSaveNPCDistLimit; UINT8 ubBestDirection=0; - //Save AI pathing vars. changing the distlimit restricts how + //Save AI pathing vars. changing the distlimit restricts how //far away the pathing will consider. ubSaveNPCAPBudget = gubNPCAPBudget; ubSaveNPCDistLimit = gubNPCDistLimit; gubNPCAPBudget = 0; gubNPCDistLimit = ubRadius; - // WDS - Clean up inventory handling //create dummy soldier, and use the pathing to determine which nearby slots are //reachable. - //memset( &soldier, 0, SIZEOF_SOLDIERTYPE ); - soldier.initialize(); - soldier.bLevel = 0; + soldier.pathing.bLevel = 0; soldier.bTeam = 1; soldier.sGridNo = sSweetGridNo; sTop = ubRadius; sBottom = -ubRadius; - sLeft = - ubRadius; - sRight = ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; - // If we are already at this gridno.... - if ( pSoldier->sGridNo == sSweetGridNo && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) - { - *pubDirection = pSoldier->ubDirection; - return( sSweetGridNo ); - } + // If we are already at this gridno.... + if ( pSoldier->sGridNo == sSweetGridNo && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) + { + *pubDirection = pSoldier->ubDirection; + return( sSweetGridNo ); + } //clear the mapelements of potential residue MAPELEMENT_REACHABLE flags //in the square region. @@ -317,11 +313,11 @@ UINT16 FindGridNoFromSweetSpotWithStructData( SOLDIERTYPE *pSoldier, UINT16 usAn } } - //Now, find out which of these gridnos are reachable + //Now, find out which of these gridnos are reachable //(use the fake soldier and the pathing settings) FindBestPath( &soldier, NOWHERE, 0, WALKING, COPYREACHABLE, ( PATH_IGNORE_PERSON_AT_DEST | PATH_THROUGH_PEOPLE ) ); - - uiLowestRange = 999999; + + uiLowestRange = 999999; for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) { @@ -330,16 +326,16 @@ UINT16 FindGridNoFromSweetSpotWithStructData( SOLDIERTYPE *pSoldier, UINT16 usAn for( cnt2 = sLeft; cnt2 <= sRight; cnt2++ ) { sGridNo = sSweetGridNo + ( WORLD_COLS * cnt1 ) + cnt2; - if( sGridNo >=0 && sGridNo < WORLD_MAX && sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) + if( sGridNo >=0 && sGridNo < WORLD_MAX && sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) && gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE ) { // Go on sweet stop - if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->bLevel ) ) + if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) ) { BOOLEAN fDirectionFound = FALSE; UINT16 usOKToAddStructID; STRUCTURE_FILE_REF * pStructureFileRef; - UINT16 usAnimSurface; + UINT16 usAnimSurface; if ( pSoldier->pLevelNode != NULL ) { @@ -358,7 +354,7 @@ UINT16 FindGridNoFromSweetSpotWithStructData( SOLDIERTYPE *pSoldier, UINT16 usAn } // Get animation surface... - usAnimSurface = DetermineSoldierAnimationSurface( pSoldier, usAnimState ); + usAnimSurface = DetermineSoldierAnimationSurface( pSoldier, usAnimState ); // Get structure ref... pStructureFileRef = GetAnimationStructureRef( pSoldier->ubID, usAnimSurface, usAnimState ); @@ -370,7 +366,7 @@ UINT16 FindGridNoFromSweetSpotWithStructData( SOLDIERTYPE *pSoldier, UINT16 usAn // Check each struct in each direction for( cnt3 = 0; cnt3 < 8; cnt3++ ) { - if (OkayToAddStructureToWorld( (INT16)sGridNo, pSoldier->bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[ cnt3 ]]), usOKToAddStructID ) ) + if (OkayToAddStructureToWorld( (INT16)sGridNo, pSoldier->pathing.bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[ cnt3 ]]), usOKToAddStructID ) ) { fDirectionFound = TRUE; break; @@ -382,12 +378,12 @@ UINT16 FindGridNoFromSweetSpotWithStructData( SOLDIERTYPE *pSoldier, UINT16 usAn { if ( fClosestToMerc ) { - uiRange = FindBestPath( pSoldier, sGridNo, pSoldier->bLevel, pSoldier->usUIMovementMode, NO_COPYROUTE, 0 ); + uiRange = FindBestPath( pSoldier, sGridNo, pSoldier->pathing.bLevel, pSoldier->usUIMovementMode, NO_COPYROUTE, 0 ); - if (uiRange == 0 ) - { - uiRange = 999; - } + if (uiRange == 0 ) + { + uiRange = 999; + } } else { @@ -422,11 +418,11 @@ UINT16 FindGridNoFromSweetSpotWithStructData( SOLDIERTYPE *pSoldier, UINT16 usAn } -UINT16 FindGridNoFromSweetSpotWithStructDataUsingGivenDirectionFirst( SOLDIERTYPE *pSoldier, UINT16 usAnimState, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection, BOOLEAN fClosestToMerc, INT8 bGivenDirection ) +INT16 FindGridNoFromSweetSpotWithStructDataUsingGivenDirectionFirst( SOLDIERTYPE *pSoldier, UINT16 usAnimState, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection, BOOLEAN fClosestToMerc, INT8 bGivenDirection ) { - INT16 sTop, sBottom; - INT16 sLeft, sRight; - INT16 cnt1, cnt2, cnt3; + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2, cnt3; INT16 sGridNo; INT32 uiRange, uiLowestRange = 999999; INT16 sLowestGridNo=-1; @@ -437,33 +433,30 @@ UINT16 FindGridNoFromSweetSpotWithStructDataUsingGivenDirectionFirst( SOLDIERTYP UINT8 ubSaveNPCDistLimit; UINT8 ubBestDirection=0; - //Save AI pathing vars. changing the distlimit restricts how + //Save AI pathing vars. changing the distlimit restricts how //far away the pathing will consider. ubSaveNPCAPBudget = gubNPCAPBudget; ubSaveNPCDistLimit = gubNPCDistLimit; gubNPCAPBudget = 0; gubNPCDistLimit = ubRadius; - // WDS - Clean up inventory handling //create dummy soldier, and use the pathing to determine which nearby slots are //reachable. - //memset( &soldier, 0, SIZEOF_SOLDIERTYPE ); - soldier.initialize(); - soldier.bLevel = 0; + soldier.pathing.bLevel = 0; soldier.bTeam = 1; soldier.sGridNo = sSweetGridNo; sTop = ubRadius; sBottom = -ubRadius; - sLeft = - ubRadius; - sRight = ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; - // If we are already at this gridno.... - if ( pSoldier->sGridNo == sSweetGridNo && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) - { - *pubDirection = pSoldier->ubDirection; - return( sSweetGridNo ); - } + // If we are already at this gridno.... + if ( pSoldier->sGridNo == sSweetGridNo && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) + { + *pubDirection = pSoldier->ubDirection; + return( sSweetGridNo ); + } //clear the mapelements of potential residue MAPELEMENT_REACHABLE flags @@ -483,11 +476,11 @@ UINT16 FindGridNoFromSweetSpotWithStructDataUsingGivenDirectionFirst( SOLDIERTYP } } - //Now, find out which of these gridnos are reachable + //Now, find out which of these gridnos are reachable //(use the fake soldier and the pathing settings) FindBestPath( &soldier, NOWHERE, 0, WALKING, COPYREACHABLE, ( PATH_IGNORE_PERSON_AT_DEST | PATH_THROUGH_PEOPLE ) ); - - uiLowestRange = 999999; + + uiLowestRange = 999999; for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) { @@ -496,16 +489,16 @@ UINT16 FindGridNoFromSweetSpotWithStructDataUsingGivenDirectionFirst( SOLDIERTYP for( cnt2 = sLeft; cnt2 <= sRight; cnt2++ ) { sGridNo = sSweetGridNo + ( WORLD_COLS * cnt1 ) + cnt2; - if( sGridNo >=0 && sGridNo < WORLD_MAX && sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) + if( sGridNo >=0 && sGridNo < WORLD_MAX && sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) && gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE ) { // Go on sweet stop - if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->bLevel ) ) + if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) ) { BOOLEAN fDirectionFound = FALSE; UINT16 usOKToAddStructID; STRUCTURE_FILE_REF * pStructureFileRef; - UINT16 usAnimSurface; + UINT16 usAnimSurface; if ( pSoldier->pLevelNode != NULL ) { @@ -524,7 +517,7 @@ UINT16 FindGridNoFromSweetSpotWithStructDataUsingGivenDirectionFirst( SOLDIERTYP } // Get animation surface... - usAnimSurface = DetermineSoldierAnimationSurface( pSoldier, usAnimState ); + usAnimSurface = DetermineSoldierAnimationSurface( pSoldier, usAnimState ); // Get structure ref... pStructureFileRef = GetAnimationStructureRef( pSoldier->ubID, usAnimSurface, usAnimState ); @@ -533,38 +526,38 @@ UINT16 FindGridNoFromSweetSpotWithStructDataUsingGivenDirectionFirst( SOLDIERTYP Assert( 0 ); } - // OK, check the perfered given direction first - if (OkayToAddStructureToWorld( (INT16)sGridNo, pSoldier->bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[ bGivenDirection ]]), usOKToAddStructID ) ) + // OK, check the perfered given direction first + if (OkayToAddStructureToWorld( (INT16)sGridNo, pSoldier->pathing.bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[ bGivenDirection ]]), usOKToAddStructID ) ) { fDirectionFound = TRUE; - cnt3 = bGivenDirection; + cnt3 = bGivenDirection; } - else - { - // Check each struct in each direction - for( cnt3 = 0; cnt3 < 8; cnt3++ ) - { - if ( cnt3 != bGivenDirection ) - { - if (OkayToAddStructureToWorld( (INT16)sGridNo, pSoldier->bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[ cnt3 ]]), usOKToAddStructID ) ) - { - fDirectionFound = TRUE; - break; - } - } - } - } + else + { + // Check each struct in each direction + for( cnt3 = 0; cnt3 < 8; cnt3++ ) + { + if ( cnt3 != bGivenDirection ) + { + if (OkayToAddStructureToWorld( (INT16)sGridNo, pSoldier->pathing.bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[ cnt3 ]]), usOKToAddStructID ) ) + { + fDirectionFound = TRUE; + break; + } + } + } + } if ( fDirectionFound ) { if ( fClosestToMerc ) { - uiRange = FindBestPath( pSoldier, sGridNo, pSoldier->bLevel, pSoldier->usUIMovementMode, NO_COPYROUTE, 0 ); + uiRange = FindBestPath( pSoldier, sGridNo, pSoldier->pathing.bLevel, pSoldier->usUIMovementMode, NO_COPYROUTE, 0 ); - if (uiRange == 0 ) - { - uiRange = 999; - } + if (uiRange == 0 ) + { + uiRange = 999; + } } else { @@ -599,11 +592,11 @@ UINT16 FindGridNoFromSweetSpotWithStructDataUsingGivenDirectionFirst( SOLDIERTYP } -UINT16 FindGridNoFromSweetSpotWithStructDataFromSoldier( SOLDIERTYPE *pSoldier, UINT16 usAnimState, INT8 ubRadius, UINT8 *pubDirection, BOOLEAN fClosestToMerc, SOLDIERTYPE *pSrcSoldier ) +INT16 FindGridNoFromSweetSpotWithStructDataFromSoldier( SOLDIERTYPE *pSoldier, UINT16 usAnimState, INT8 ubRadius, UINT8 *pubDirection, BOOLEAN fClosestToMerc, SOLDIERTYPE *pSrcSoldier ) { - INT16 sTop, sBottom; - INT16 sLeft, sRight; - INT16 cnt1, cnt2, cnt3; + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2, cnt3; INT16 sGridNo; INT32 uiRange, uiLowestRange = 999999; INT16 sLowestGridNo=-1; @@ -614,30 +607,27 @@ UINT16 FindGridNoFromSweetSpotWithStructDataFromSoldier( SOLDIERTYPE *pSoldier, UINT8 ubBestDirection=0; INT16 sSweetGridNo; SOLDIERTYPE soldier; - + sSweetGridNo = pSrcSoldier->sGridNo; - //Save AI pathing vars. changing the distlimit restricts how + //Save AI pathing vars. changing the distlimit restricts how //far away the pathing will consider. ubSaveNPCAPBudget = gubNPCAPBudget; ubSaveNPCDistLimit = gubNPCDistLimit; gubNPCAPBudget = 0; gubNPCDistLimit = ubRadius; - // WDS - Clean up inventory handling //create dummy soldier, and use the pathing to determine which nearby slots are //reachable. - //memset( &soldier, 0, SIZEOF_SOLDIERTYPE ); - soldier.initialize(); - soldier.bLevel = 0; + soldier.pathing.bLevel = 0; soldier.bTeam = 1; soldier.sGridNo = sSweetGridNo; sTop = ubRadius; sBottom = -ubRadius; - sLeft = - ubRadius; - sRight = ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; //clear the mapelements of potential residue MAPELEMENT_REACHABLE flags //in the square region. @@ -656,10 +646,10 @@ UINT16 FindGridNoFromSweetSpotWithStructDataFromSoldier( SOLDIERTYPE *pSoldier, } } - //Now, find out which of these gridnos are reachable + //Now, find out which of these gridnos are reachable FindBestPath( &soldier, NOWHERE, 0, WALKING, COPYREACHABLE, ( PATH_IGNORE_PERSON_AT_DEST | PATH_THROUGH_PEOPLE ) ); - - uiLowestRange = 999999; + + uiLowestRange = 999999; for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) { @@ -668,16 +658,16 @@ UINT16 FindGridNoFromSweetSpotWithStructDataFromSoldier( SOLDIERTYPE *pSoldier, for( cnt2 = sLeft; cnt2 <= sRight; cnt2++ ) { sGridNo = sSweetGridNo + ( WORLD_COLS * cnt1 ) + cnt2; - if( sGridNo >=0 && sGridNo < WORLD_MAX && sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) + if( sGridNo >=0 && sGridNo < WORLD_MAX && sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) && gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE ) { // Go on sweet stop - if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->bLevel ) ) + if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) ) { BOOLEAN fDirectionFound = FALSE; UINT16 usOKToAddStructID; STRUCTURE_FILE_REF * pStructureFileRef; - UINT16 usAnimSurface; + UINT16 usAnimSurface; if ( fClosestToMerc != 3 ) { @@ -691,14 +681,14 @@ UINT16 FindGridNoFromSweetSpotWithStructDataFromSoldier( SOLDIERTYPE *pSoldier, } // Get animation surface... - usAnimSurface = DetermineSoldierAnimationSurface( pSoldier, usAnimState ); + usAnimSurface = DetermineSoldierAnimationSurface( pSoldier, usAnimState ); // Get structure ref... pStructureFileRef = GetAnimationStructureRef( pSoldier->ubID, usAnimSurface, usAnimState ); // Check each struct in each direction for( cnt3 = 0; cnt3 < 8; cnt3++ ) { - if (OkayToAddStructureToWorld( (INT16)sGridNo, pSoldier->bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[ cnt3 ]]), usOKToAddStructID ) ) + if (OkayToAddStructureToWorld( (INT16)sGridNo, pSoldier->pathing.bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[ cnt3 ]]), usOKToAddStructID ) ) { fDirectionFound = TRUE; break; @@ -757,11 +747,11 @@ UINT16 FindGridNoFromSweetSpotWithStructDataFromSoldier( SOLDIERTYPE *pSoldier, } -UINT16 FindGridNoFromSweetSpotExcludingSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ) +INT16 FindGridNoFromSweetSpotExcludingSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ) { - INT16 sTop, sBottom; - INT16 sLeft, sRight; - INT16 cnt1, cnt2; + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2; INT16 sGridNo; INT32 uiRange, uiLowestRange = 999999; INT16 sLowestGridNo=-1; @@ -771,10 +761,10 @@ UINT16 FindGridNoFromSweetSpotExcludingSweetSpot( SOLDIERTYPE *pSoldier, INT16 s sTop = ubRadius; sBottom = -ubRadius; - sLeft = - ubRadius; - sRight = ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; - uiLowestRange = 999999; + uiLowestRange = 999999; for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) { @@ -789,12 +779,12 @@ UINT16 FindGridNoFromSweetSpotExcludingSweetSpot( SOLDIERTYPE *pSoldier, INT16 s continue; } - if ( sGridNo >=0 && sGridNo < WORLD_MAX && - sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) ) + if ( sGridNo >=0 && sGridNo < WORLD_MAX && + sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) ) { // Go on sweet stop - if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->bLevel ) ) + if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) ) { uiRange = GetRangeInCellCoordsFromGridNoDiff( sSweetGridNo, sGridNo ); @@ -814,22 +804,22 @@ UINT16 FindGridNoFromSweetSpotExcludingSweetSpot( SOLDIERTYPE *pSoldier, INT16 s if ( fFound ) { // Set direction to center of map! - *pubDirection = (UINT8)GetDirectionToGridNoFromGridNo( sLowestGridNo, ( ( ( WORLD_ROWS / 2 ) * WORLD_COLS ) + ( WORLD_COLS / 2 ) ) ); + *pubDirection = (UINT8)GetDirectionToGridNoFromGridNo( sLowestGridNo, ( ( ( WORLD_ROWS / 2 ) * WORLD_COLS ) + ( WORLD_COLS / 2 ) ) ); return( sLowestGridNo ); } else { return( NOWHERE ); - } + } } -UINT16 FindGridNoFromSweetSpotExcludingSweetSpotInQuardent( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection, INT8 ubQuardentDir ) +INT16 FindGridNoFromSweetSpotExcludingSweetSpotInQuardent( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection, INT8 ubQuardentDir ) { - INT16 sTop, sBottom; - INT16 sLeft, sRight; - INT16 cnt1, cnt2; + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2; INT16 sGridNo; INT32 uiRange, uiLowestRange = 999999; INT16 sLowestGridNo=-1; @@ -839,8 +829,8 @@ UINT16 FindGridNoFromSweetSpotExcludingSweetSpotInQuardent( SOLDIERTYPE *pSoldie sTop = ubRadius; sBottom = -ubRadius; - sLeft = - ubRadius; - sRight = ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; // Switch on quadrent if ( ubQuardentDir == SOUTHEAST ) @@ -849,7 +839,7 @@ UINT16 FindGridNoFromSweetSpotExcludingSweetSpotInQuardent( SOLDIERTYPE *pSoldie sLeft = 0; } - uiLowestRange = 999999; + uiLowestRange = 999999; for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) { @@ -864,12 +854,12 @@ UINT16 FindGridNoFromSweetSpotExcludingSweetSpotInQuardent( SOLDIERTYPE *pSoldie continue; } - if ( sGridNo >=0 && sGridNo < WORLD_MAX && - sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) ) + if ( sGridNo >=0 && sGridNo < WORLD_MAX && + sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) ) { // Go on sweet stop - if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->bLevel ) ) + if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) ) { uiRange = GetRangeInCellCoordsFromGridNoDiff( sSweetGridNo, sGridNo ); @@ -888,7 +878,7 @@ UINT16 FindGridNoFromSweetSpotExcludingSweetSpotInQuardent( SOLDIERTYPE *pSoldie if ( fFound ) { // Set direction to center of map! - *pubDirection = (UINT8)GetDirectionToGridNoFromGridNo( sLowestGridNo, ( ( ( WORLD_ROWS / 2 ) * WORLD_COLS ) + ( WORLD_COLS / 2 ) ) ); + *pubDirection = (UINT8)GetDirectionToGridNoFromGridNo( sLowestGridNo, ( ( ( WORLD_ROWS / 2 ) * WORLD_COLS ) + ( WORLD_COLS / 2 ) ) ); return( sLowestGridNo ); } @@ -905,16 +895,16 @@ BOOLEAN CanSoldierReachGridNoInGivenTileLimit( SOLDIERTYPE *pSoldier, INT16 sGri INT16 sActionGridNo; UINT8 ubDirection; - if ( pSoldier->bLevel != bLevel ) + if ( pSoldier->pathing.bLevel != bLevel ) { return( FALSE ); } - sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, NULL, FALSE, FALSE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, NULL, FALSE, FALSE ); if ( sActionGridNo == -1 ) { - sActionGridNo = sGridNo; + sActionGridNo = sGridNo; } if ( sActionGridNo == pSoldier->sGridNo ) @@ -922,7 +912,7 @@ BOOLEAN CanSoldierReachGridNoInGivenTileLimit( SOLDIERTYPE *pSoldier, INT16 sGri return( TRUE ); } - iNumTiles = FindBestPath( pSoldier, sActionGridNo, pSoldier->bLevel, WALKING, NO_COPYROUTE, PATH_IGNORE_PERSON_AT_DEST ); + iNumTiles = FindBestPath( pSoldier, sActionGridNo, pSoldier->pathing.bLevel, WALKING, NO_COPYROUTE, PATH_IGNORE_PERSON_AT_DEST ); if ( iNumTiles <= sMaxTiles && iNumTiles != 0 ) { @@ -935,7 +925,7 @@ BOOLEAN CanSoldierReachGridNoInGivenTileLimit( SOLDIERTYPE *pSoldier, INT16 sGri } -UINT16 FindRandomGridNoFromSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ) +INT16 FindRandomGridNoFromSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ) { INT16 sX, sY; INT16 sGridNo; @@ -945,32 +935,28 @@ UINT16 FindRandomGridNoFromSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, SOLDIERTYPE soldier; UINT8 ubSaveNPCAPBudget; UINT8 ubSaveNPCDistLimit; - UINT8 ubBestDirection=0; - INT16 sTop, sBottom; - INT16 sLeft, sRight; - INT16 cnt1, cnt2; - UINT8 ubRoomNum; + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2; + UINT8 ubRoomNum; - //Save AI pathing vars. changing the distlimit restricts how + //Save AI pathing vars. changing the distlimit restricts how //far away the pathing will consider. ubSaveNPCAPBudget = gubNPCAPBudget; ubSaveNPCDistLimit = gubNPCDistLimit; gubNPCAPBudget = 0; gubNPCDistLimit = ubRadius; - // WDS - Clean up inventory handling //create dummy soldier, and use the pathing to determine which nearby slots are //reachable. - //memset( &soldier, 0, SIZEOF_SOLDIERTYPE ); - soldier.initialize(); - soldier.bLevel = 0; + soldier.pathing.bLevel = 0; soldier.bTeam = 1; soldier.sGridNo = sSweetGridNo; sTop = ubRadius; sBottom = -ubRadius; - sLeft = - ubRadius; - sRight = ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; // ATE: CHECK FOR BOUNDARIES!!!!!! for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) @@ -987,7 +973,7 @@ UINT16 FindRandomGridNoFromSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, } } - //Now, find out which of these gridnos are reachable + //Now, find out which of these gridnos are reachable //(use the fake soldier and the pathing settings) FindBestPath( &soldier, NOWHERE, 0, WALKING, COPYREACHABLE, ( PATH_IGNORE_PERSON_AT_DEST | PATH_THROUGH_PEOPLE ) ); @@ -1000,12 +986,12 @@ UINT16 FindRandomGridNoFromSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, sGridNo = sSweetGridNo + ( WORLD_COLS * sY ) + sX; - if ( sGridNo >=0 && sGridNo < WORLD_MAX && - sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) + if ( sGridNo >=0 && sGridNo < WORLD_MAX && + sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) && gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE ) { // Go on sweet stop - if ( NewOKDestination( pSoldier, sGridNo, TRUE , pSoldier->bLevel) ) + if ( NewOKDestination( pSoldier, sGridNo, TRUE , pSoldier->pathing.bLevel) ) { // If we are a crow, we need this additional check if ( pSoldier->ubBodyType == CROW ) @@ -1032,7 +1018,7 @@ UINT16 FindRandomGridNoFromSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, } while( !fFound ); // Set direction to center of map! - *pubDirection = (UINT8)GetDirectionToGridNoFromGridNo( sGridNo, ( ( ( WORLD_ROWS / 2 ) * WORLD_COLS ) + ( WORLD_COLS / 2 ) ) ); + *pubDirection = (UINT8)GetDirectionToGridNoFromGridNo( sGridNo, ( ( ( WORLD_ROWS / 2 ) * WORLD_COLS ) + ( WORLD_COLS / 2 ) ) ); gubNPCAPBudget = ubSaveNPCAPBudget; gubNPCDistLimit = ubSaveNPCDistLimit; @@ -1041,7 +1027,7 @@ UINT16 FindRandomGridNoFromSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, } -UINT16 FindRandomGridNoFromSweetSpotExcludingSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ) +INT16 FindRandomGridNoFromSweetSpotExcludingSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ) { INT16 sX, sY; INT16 sGridNo; @@ -1063,11 +1049,11 @@ UINT16 FindRandomGridNoFromSweetSpotExcludingSweetSpot( SOLDIERTYPE *pSoldier, I continue; } - if ( sGridNo >=0 && sGridNo < WORLD_MAX && - sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) ) + if ( sGridNo >=0 && sGridNo < WORLD_MAX && + sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) ) { // Go on sweet stop - if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->bLevel ) ) + if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) ) { fFound = TRUE; } @@ -1083,7 +1069,7 @@ UINT16 FindRandomGridNoFromSweetSpotExcludingSweetSpot( SOLDIERTYPE *pSoldier, I } while( !fFound ); // Set direction to center of map! - *pubDirection = (UINT8)GetDirectionToGridNoFromGridNo( sGridNo, ( ( ( WORLD_ROWS / 2 ) * WORLD_COLS ) + ( WORLD_COLS / 2 ) ) ); + *pubDirection = (UINT8)GetDirectionToGridNoFromGridNo( sGridNo, ( ( ( WORLD_ROWS / 2 ) * WORLD_COLS ) + ( WORLD_COLS / 2 ) ) ); return( sGridNo ); @@ -1101,20 +1087,20 @@ BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOO DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("InternalAddSoldierToSector")); pSoldier = MercPtrs[ ubID ]; - - if ( pSoldier->bActive ) + + if ( pSoldier->bActive ) { - // ATE: Make sure life of elliot is OK if from a meanwhile - if ( AreInMeanwhile() && pSoldier->ubProfile == ELLIOT ) - { - if ( pSoldier->bLife < OKLIFE ) - { - pSoldier->bLife = 25; - } - } + // ATE: Make sure life of elliot is OK if from a meanwhile + if ( AreInMeanwhile() && pSoldier->ubProfile == ELLIOT ) + { + if ( pSoldier->stats.bLife < OKLIFE ) + { + pSoldier->stats.bLife = 25; + } + } // ADD SOLDIER TO SLOT! - if (pSoldier->uiStatusFlags & SOLDIER_OFF_MAP) + if (pSoldier->flags.uiStatusFlags & SOLDIER_OFF_MAP) { AddAwaySlot( pSoldier ); @@ -1124,7 +1110,7 @@ BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOO } else { - AddMercSlot( pSoldier ); + AddMercSlot( pSoldier ); // Add guy to sector flag pSoldier->bInSector = TRUE; @@ -1132,12 +1118,12 @@ BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOO } // If a driver or passenger - stop here! - if ( pSoldier->uiStatusFlags & SOLDIER_DRIVER || pSoldier->uiStatusFlags & SOLDIER_PASSENGER ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_DRIVER || pSoldier->flags.uiStatusFlags & SOLDIER_PASSENGER ) { return( FALSE ); } - // Add to panel + // Add to panel CheckForAndAddMercToTeamPanel( pSoldier ); pSoldier->usQuoteSaidFlags &= (~SOLDIER_QUOTE_SAID_SPOTTING_CREATURE_ATTACK); @@ -1156,17 +1142,17 @@ BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOO else { if( pSoldier->sInsertionGridNo == NOWHERE ) - { //Add the soldier to the respective entrypoint. This is an error condition. + { //Add the soldier to the respective entrypoint. This is an error condition. // So treat it like an error already then! Assert(0); } - if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { sGridNo = FindGridNoFromSweetSpotWithStructDataUsingGivenDirectionFirst( pSoldier, STANDING, pSoldier->sInsertionGridNo, 12, &ubCalculatedDirection, FALSE, pSoldier->ubInsertionDirection ); - // ATE: Override insertion direction + // ATE: Override insertion direction if (sGridNo == NOWHERE) { - // Well, we gotta place this soldier/vehicle somewhere. Just use the first position for now + // Well, we gotta place this soldier/vehicle somewhere. Just use the first position for now sGridNo = pSoldier->sGridNo = pSoldier->sInsertionGridNo; } else @@ -1178,11 +1164,11 @@ BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOO { sGridNo = FindGridNoFromSweetSpot( pSoldier, pSoldier->sInsertionGridNo, 7, &ubCalculatedDirection ); - // ATE: Error condition - if nowhere use insertion gridno! - if ( sGridNo == NOWHERE ) - { - sGridNo = pSoldier->sInsertionGridNo; - } + // ATE: Error condition - if nowhere use insertion gridno! + if ( sGridNo == NOWHERE ) + { + sGridNo = pSoldier->sInsertionGridNo; + } } // Override calculated direction if we were told to.... @@ -1208,7 +1194,7 @@ BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOO { // We found one // Calculate direction... - ubDirection = (UINT8)GetDirectionToGridNoFromGridNo( sExitGridNo, sGridNo ); + ubDirection = (UINT8)GetDirectionToGridNoFromGridNo( sExitGridNo, sGridNo ); } } } @@ -1266,7 +1252,7 @@ void InternalSoldierInSectorSleep( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN if ( AM_AN_EPC( pSoldier ) ) { - usAnim = STANDING; + usAnim = STANDING; } // OK, look for sutable placement.... @@ -1275,26 +1261,26 @@ void InternalSoldierInSectorSleep( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN sWorldX = CenterX( sGoodGridNo ); sWorldY = CenterY( sGoodGridNo ); - EVENT_SetSoldierPosition( pSoldier, sWorldX, sWorldY ); + pSoldier->EVENT_SetSoldierPosition( sWorldX, sWorldY ); - EVENT_SetSoldierDirection( pSoldier, ubNewDirection ); - EVENT_SetSoldierDesiredDirection( pSoldier, ubNewDirection ); + pSoldier->EVENT_SetSoldierDirection( ubNewDirection ); + pSoldier->EVENT_SetSoldierDesiredDirection( ubNewDirection ); - //pSoldier->bDesiredDirection = pSoldier->ubDirection; + //pSoldier->pathing.bDesiredDirection = pSoldier->ubDirection; if ( AM_AN_EPC( pSoldier ) ) { - EVENT_InitNewSoldierAnim( pSoldier, STANDING, 1, TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( STANDING, 1, TRUE ); } else { if ( fDoTransition ) { - EVENT_InitNewSoldierAnim( pSoldier, GOTO_SLEEP, 1, TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( GOTO_SLEEP, 1, TRUE ); } else { - EVENT_InitNewSoldierAnim( pSoldier, SLEEPING, 1, TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( SLEEPING, 1, TRUE ); } } } @@ -1316,14 +1302,14 @@ void SoldierInSectorIncompaciated( SOLDIERTYPE *pSoldier, INT16 sGridNo ) sWorldX = CenterX( sGoodGridNo ); sWorldY = CenterY( sGoodGridNo ); - EVENT_SetSoldierPosition( pSoldier, sWorldX, sWorldY ); + pSoldier->EVENT_SetSoldierPosition( sWorldX, sWorldY ); - EVENT_SetSoldierDirection( pSoldier, ubNewDirection ); - EVENT_SetSoldierDesiredDirection( pSoldier, ubNewDirection ); + pSoldier->EVENT_SetSoldierDirection( ubNewDirection ); + pSoldier->EVENT_SetSoldierDesiredDirection( ubNewDirection ); - //pSoldier->bDesiredDirection = pSoldier->ubDirection; + //pSoldier->pathing.bDesiredDirection = pSoldier->ubDirection; - EVENT_InitNewSoldierAnim( pSoldier, STAND_FALLFORWARD_STOP, 1, TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( STAND_FALLFORWARD_STOP, 1, TRUE ); } @@ -1352,20 +1338,20 @@ void SoldierInSectorPatient( SOLDIERTYPE *pSoldier, INT16 sGridNo ) sWorldX = CenterX( sGoodGridNo ); sWorldY = CenterY( sGoodGridNo ); - EVENT_SetSoldierPosition( pSoldier, sWorldX, sWorldY ); + pSoldier->EVENT_SetSoldierPosition( sWorldX, sWorldY ); - EVENT_SetSoldierDirection( pSoldier, ubNewDirection ); - EVENT_SetSoldierDesiredDirection( pSoldier, ubNewDirection ); + pSoldier->EVENT_SetSoldierDirection( ubNewDirection ); + pSoldier->EVENT_SetSoldierDesiredDirection( ubNewDirection ); - //pSoldier->bDesiredDirection = pSoldier->ubDirection; + //pSoldier->pathing.bDesiredDirection = pSoldier->ubDirection; if ( !IS_MERC_BODY_TYPE( pSoldier ) ) { - EVENT_InitNewSoldierAnim( pSoldier, STANDING, 1, TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( STANDING, 1, TRUE ); } else { - EVENT_InitNewSoldierAnim( pSoldier, BEING_PATIENT, 1, TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( BEING_PATIENT, 1, TRUE ); } } @@ -1387,20 +1373,20 @@ void SoldierInSectorDoctor( SOLDIERTYPE *pSoldier, INT16 sGridNo ) sWorldX = CenterX( sGoodGridNo ); sWorldY = CenterY( sGoodGridNo ); - EVENT_SetSoldierPosition( pSoldier, sWorldX, sWorldY ); + pSoldier->EVENT_SetSoldierPosition( sWorldX, sWorldY ); - EVENT_SetSoldierDirection( pSoldier, ubNewDirection ); - EVENT_SetSoldierDesiredDirection( pSoldier, ubNewDirection ); + pSoldier->EVENT_SetSoldierDirection( ubNewDirection ); + pSoldier->EVENT_SetSoldierDesiredDirection( ubNewDirection ); - //pSoldier->bDesiredDirection = pSoldier->ubDirection; + //pSoldier->pathing.bDesiredDirection = pSoldier->ubDirection; if ( !IS_MERC_BODY_TYPE( pSoldier ) ) { - EVENT_InitNewSoldierAnim( pSoldier, STANDING, 1, TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( STANDING, 1, TRUE ); } else { - EVENT_InitNewSoldierAnim( pSoldier, BEING_DOCTOR, 1, TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( BEING_DOCTOR, 1, TRUE ); } } @@ -1422,24 +1408,24 @@ void SoldierInSectorRepair( SOLDIERTYPE *pSoldier, INT16 sGridNo ) sWorldX = CenterX( sGoodGridNo ); sWorldY = CenterY( sGoodGridNo ); - EVENT_SetSoldierPosition( pSoldier, sWorldX, sWorldY ); + pSoldier->EVENT_SetSoldierPosition( sWorldX, sWorldY ); - EVENT_SetSoldierDirection( pSoldier, ubNewDirection ); - EVENT_SetSoldierDesiredDirection( pSoldier, ubNewDirection ); + pSoldier->EVENT_SetSoldierDirection( ubNewDirection ); + pSoldier->EVENT_SetSoldierDesiredDirection( ubNewDirection ); - //pSoldier->bDesiredDirection = pSoldier->ubDirection; + //pSoldier->pathing.bDesiredDirection = pSoldier->ubDirection; if ( !IS_MERC_BODY_TYPE( pSoldier ) ) { - EVENT_InitNewSoldierAnim( pSoldier, STANDING, 1, TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( STANDING, 1, TRUE ); } else { - EVENT_InitNewSoldierAnim( pSoldier, BEING_REPAIRMAN, 1, TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( BEING_REPAIRMAN, 1, TRUE ); } } -extern void EVENT_SetSoldierPositionAndMaybeFinalDestAndMaybeNotDestination( SOLDIERTYPE *pSoldier, FLOAT dNewXPos, FLOAT dNewYPos, BOOLEAN fUpdateDest, BOOLEAN fUpdateFinalDest ); +extern void EVENT_SetSoldierPositionAndMaybeFinalDestAndMaybeNotDestination( SOLDIERTYPE *pSoldier, FLOAT dNewXPos, FLOAT dNewYPos, BOOLEAN fUpdateDest, BOOLEAN fUpdateFinalDest ); void AddSoldierToSectorGridNo( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection, BOOLEAN fUseAnimation, UINT16 usAnimState, UINT16 usAnimCode ) { @@ -1465,7 +1451,7 @@ void AddSoldierToSectorGridNo( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDir pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; pSoldier->usPendingAnimation2 = NO_PENDING_ANIMATION; pSoldier->ubPendingDirection = NO_PENDING_DIRECTION; - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; //If we are not loading a saved game if( (gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) @@ -1479,8 +1465,8 @@ void AddSoldierToSectorGridNo( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDir if ( ubInsertionCode == INSERTION_CODE_ARRIVING_GAME ) { EVENT_SetSoldierPositionAndMaybeFinalDestAndMaybeNotDestination( pSoldier, sWorldX, sWorldY, fUpdateFinalPosition, fUpdateFinalPosition ); - EVENT_SetSoldierDirection( pSoldier, ubDirection ); - EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection ); + pSoldier->EVENT_SetSoldierDirection( ubDirection ); + pSoldier->EVENT_SetSoldierDesiredDirection( ubDirection ); } else if ( ubInsertionCode == INSERTION_CODE_CHOPPER ) { @@ -1493,28 +1479,28 @@ void AddSoldierToSectorGridNo( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDir //if we are loading, dont set the direction ( they are already set ) if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { - EVENT_SetSoldierDirection( pSoldier, ubDirection ); + pSoldier->EVENT_SetSoldierDirection( ubDirection ); - EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection ); + pSoldier->EVENT_SetSoldierDesiredDirection( ubDirection ); } } if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { - if ( !( pSoldier->uiStatusFlags & SOLDIER_DEAD ) ) + if ( !( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) ) { if ( pSoldier->bTeam == gbPlayerNum ) { - RevealRoofsAndItems( pSoldier, TRUE, FALSE, pSoldier->bLevel, TRUE ); + RevealRoofsAndItems( pSoldier, TRUE, FALSE, pSoldier->pathing.bLevel, TRUE ); - // ATE: Patch fix: If we are in an non-interruptable animation, stop! - if ( pSoldier->usAnimState == HOPFENCE ) - { - pSoldier->fInNonintAnim = FALSE; - SoldierGotoStationaryStance( pSoldier ); - } + // ATE: Patch fix: If we are in an non-interruptable animation, stop! + if ( pSoldier->usAnimState == HOPFENCE ) + { + pSoldier->flags.fInNonintAnim = FALSE; + pSoldier->SoldierGotoStationaryStance( ); + } - EVENT_StopMerc( pSoldier, sGridNo, ubDirection ); + pSoldier->EVENT_StopMerc( sGridNo, ubDirection ); } } @@ -1523,32 +1509,32 @@ void AddSoldierToSectorGridNo( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDir { // Find a sweetspot near... sNewGridNo = FindGridNoFromSweetSpot( pSoldier, gMapInformation.sNorthGridNo, 4, &ubNewDirection ); - EVENT_GetNewSoldierPath( pSoldier, sNewGridNo, WALKING ); + pSoldier->EVENT_GetNewSoldierPath( sNewGridNo, WALKING ); } // If he's an enemy... set presence - if ( !pSoldier->bNeutral && (pSoldier->bSide != gbPlayerNum ) ) + if ( !pSoldier->aiData.bNeutral && (pSoldier->bSide != gbPlayerNum ) ) { - // ATE: Added if not bloodcats - // only do this once they are seen..... - if ( pSoldier->ubBodyType != BLOODCAT ) - { - SetEnemyPresence( ); - } + // ATE: Added if not bloodcats + // only do this once they are seen..... + if ( pSoldier->ubBodyType != BLOODCAT ) + { + SetEnemyPresence( ); + } } } - if ( !( pSoldier->uiStatusFlags & SOLDIER_DEAD ) ) + if ( !( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) ) { //if we are loading a 'pristine' map ( ie, not loading a saved game ) if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { // ATE: Double check if we are on the roof that there is a roof there! - if ( pSoldier->bLevel == 1 ) + if ( pSoldier->pathing.bLevel == 1 ) { if ( !FindStructure( pSoldier->sGridNo, STRUCTURE_ROOF ) ) { - SetSoldierHeight( pSoldier, (FLOAT)( 0 ) ); + pSoldier->SetSoldierHeight( (FLOAT)( 0 ) ); } } @@ -1559,20 +1545,20 @@ void AddSoldierToSectorGridNo( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDir { if ( fUseAnimation ) { - EVENT_InitNewSoldierAnim( pSoldier, usAnimState, usAnimCode, TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( usAnimState, usAnimCode, TRUE ); } else if ( pSoldier->ubBodyType != CROW ) { - EVENT_InitNewSoldierAnim( pSoldier, STANDING, 1, TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( STANDING, 1, TRUE ); } } // ATE: if we are below OK life, make them lie down! - if ( pSoldier->bLife < OKLIFE ) + if ( pSoldier->stats.bLife < OKLIFE ) { SoldierInSectorIncompaciated( pSoldier, pSoldier->sInsertionGridNo ); } - else if ( pSoldier->fMercAsleep == TRUE ) + else if ( pSoldier->flags.fMercAsleep == TRUE ) { InternalSoldierInSectorSleep( pSoldier, pSoldier->sInsertionGridNo, FALSE ); } @@ -1589,8 +1575,8 @@ void AddSoldierToSectorGridNo( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDir SoldierInSectorRepair( pSoldier, pSoldier->sInsertionGridNo ); } - // ATE: Make sure movement mode is up to date! - pSoldier->usUIMovementMode = GetMoveStateBasedOnStance( pSoldier, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ); + // ATE: Make sure movement mode is up to date! + pSoldier->usUIMovementMode = pSoldier->GetMoveStateBasedOnStance( gAnimControl[ pSoldier->usAnimState ].ubEndHeight ); } } @@ -1598,12 +1584,12 @@ void AddSoldierToSectorGridNo( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDir { // THIS ALL SHOULD HAVE BEEN HANDLED BY THE FACT THAT A GAME WAS LOADED - //EVENT_InitNewSoldierAnim( pSoldier, pSoldier->usAnimState, pSoldier->usAniCode, TRUE ); + //pSoldier->EVENT_InitNewSoldierAnim( pSoldier->usAnimState, pSoldier->usAniCode, TRUE ); // if the merc had a final destination, get the merc walking there - //if( pSoldier->sFinalDestination != pSoldier->sGridNo ) + //if( pSoldier->pathing.sFinalDestination != pSoldier->sGridNo ) //{ - // EVENT_GetNewSoldierPath( pSoldier, pSoldier->sFinalDestination, pSoldier->usUIMovementMode ); + // pSoldier->EVENT_GetNewSoldierPath( pSoldier->pathing.sFinalDestination, pSoldier->usUIMovementMode ); //} } } @@ -1623,9 +1609,9 @@ BOOLEAN IsMercOnTeam(UINT8 ubMercID) ubLastTeamID = gTacticalStatus.Team[ OUR_TEAM ].bLastID; - // look for all mercs on the same team, - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= ubLastTeamID; cnt++,pTeamSoldier++) - { + // look for all mercs on the same team, + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= ubLastTeamID; cnt++,pTeamSoldier++) + { if ( pTeamSoldier->ubProfile == ubMercID ) { if( pTeamSoldier->bActive ) @@ -1647,18 +1633,18 @@ BOOLEAN IsMercOnTeamAndAlive(UINT8 ubMercID) ubLastTeamID = gTacticalStatus.Team[ OUR_TEAM ].bLastID; - // look for all mercs on the same team, - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= ubLastTeamID; cnt++,pTeamSoldier++) - { + // look for all mercs on the same team, + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= ubLastTeamID; cnt++,pTeamSoldier++) + { if ( pTeamSoldier->ubProfile == ubMercID ) { if( pTeamSoldier->bActive ) - { - if ( pTeamSoldier->bLife > 0 ) - { - return(TRUE); - } - } + { + if ( pTeamSoldier->stats.bLife > 0 ) + { + return(TRUE); + } + } } } @@ -1675,9 +1661,9 @@ BOOLEAN IsMercOnTeamAndInOmertaAlready(UINT8 ubMercID) ubLastTeamID = gTacticalStatus.Team[ OUR_TEAM ].bLastID; - // look for all mercs on the same team, - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= ubLastTeamID; cnt++,pTeamSoldier++) - { + // look for all mercs on the same team, + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= ubLastTeamID; cnt++,pTeamSoldier++) + { if ( pTeamSoldier->ubProfile == ubMercID ) { if ( pTeamSoldier->bActive && pTeamSoldier->bAssignment != IN_TRANSIT ) @@ -1698,18 +1684,18 @@ BOOLEAN IsMercOnTeamAndInOmertaAlreadyAndAlive(UINT8 ubMercID) ubLastTeamID = gTacticalStatus.Team[ OUR_TEAM ].bLastID; - // look for all mercs on the same team, - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= ubLastTeamID; cnt++,pTeamSoldier++) - { + // look for all mercs on the same team, + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= ubLastTeamID; cnt++,pTeamSoldier++) + { if ( pTeamSoldier->ubProfile == ubMercID ) { if ( pTeamSoldier->bActive && pTeamSoldier->bAssignment != IN_TRANSIT ) - { - if ( pTeamSoldier->bLife > 0 ) - { - return(TRUE); - } - } + { + if ( pTeamSoldier->stats.bLife > 0 ) + { + return(TRUE); + } + } } } @@ -1728,9 +1714,9 @@ INT16 GetSoldierIDFromMercID(UINT8 ubMercID) ubLastTeamID = gTacticalStatus.Team[ OUR_TEAM ].bLastID; - // look for all mercs on the same team, - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= ubLastTeamID; cnt++,pTeamSoldier++) - { + // look for all mercs on the same team, + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= ubLastTeamID; cnt++,pTeamSoldier++) + { if ( pTeamSoldier->ubProfile == ubMercID ) { if( pTeamSoldier->bActive ) diff --git a/Tactical/Soldier Add.h b/Tactical/Soldier Add.h index 4cc3b105..87f48c51 100644 --- a/Tactical/Soldier Add.h +++ b/Tactical/Soldier Add.h @@ -6,21 +6,21 @@ // Finds a gridno given a sweet spot // Returns a good direction too! -UINT16 FindGridNoFromSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ); +INT16 FindGridNoFromSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ); // Ensures a good path..... -UINT16 FindGridNoFromSweetSpotThroughPeople( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ); +INT16 FindGridNoFromSweetSpotThroughPeople( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ); // Returns a good sweetspot but not the swetspot! -UINT16 FindGridNoFromSweetSpotExcludingSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ); +INT16 FindGridNoFromSweetSpotExcludingSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ); -UINT16 FindGridNoFromSweetSpotExcludingSweetSpotInQuardent( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection, INT8 ubQuardentDir ); +INT16 FindGridNoFromSweetSpotExcludingSweetSpotInQuardent( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection, INT8 ubQuardentDir ); // Finds a gridno near a sweetspot but a random one! -UINT16 FindRandomGridNoFromSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ); +INT16 FindRandomGridNoFromSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ); // Finds a sweetspot but excluding this one! -UINT16 FindRandomGridNoFromSweetSpotExcludingSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ); +INT16 FindRandomGridNoFromSweetSpotExcludingSweetSpot( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ); // Adds a soldier ( already created in mercptrs[] array )! @@ -45,13 +45,13 @@ BOOLEAN IsMercOnTeamAndInOmertaAlreadyAndAlive(UINT8 ubMercID); // GetSoldierIDFromMercID() Gets the Soldier ID from the Merc Profile ID, else returns -1 INT16 GetSoldierIDFromMercID(UINT8 ubMercID); -UINT16 FindGridNoFromSweetSpotWithStructData( SOLDIERTYPE *pSoldier, UINT16 usAnimState, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection, BOOLEAN fClosestToMerc ); +INT16 FindGridNoFromSweetSpotWithStructData( SOLDIERTYPE *pSoldier, UINT16 usAnimState, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection, BOOLEAN fClosestToMerc ); /* void SoldierInSectorSleep( SOLDIERTYPE *pSoldier, INT16 sGridNo ); */ -UINT16 FindGridNoFromSweetSpotWithStructDataFromSoldier( SOLDIERTYPE *pSoldier, UINT16 usAnimState, INT8 ubRadius, UINT8 *pubDirection, BOOLEAN fClosestToMerc, SOLDIERTYPE *pSrcSoldier ); +INT16 FindGridNoFromSweetSpotWithStructDataFromSoldier( SOLDIERTYPE *pSoldier, UINT16 usAnimState, INT8 ubRadius, UINT8 *pubDirection, BOOLEAN fClosestToMerc, SOLDIERTYPE *pSrcSoldier ); void SoldierInSectorPatient( SOLDIERTYPE *pSoldier, INT16 sGridNo ); void SoldierInSectorDoctor( SOLDIERTYPE *pSoldier, INT16 sGridNo ); @@ -60,4 +60,4 @@ void SoldierInSectorRepair( SOLDIERTYPE *pSoldier, INT16 sGridNo ); BOOLEAN CanSoldierReachGridNoInGivenTileLimit( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT16 sMaxTiles, INT8 bLevel ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Soldier Ani.cpp b/Tactical/Soldier Ani.cpp index 7c2e0480..ac5f8605 100644 --- a/Tactical/Soldier Ani.cpp +++ b/Tactical/Soldier Ani.cpp @@ -8,7 +8,7 @@ #include "debug.h" #include "MemMan.h" #include "Overhead Types.h" -#include "Soldier Control.h" +//#include "Soldier Control.h" #include "Animation Cache.h" #include "Animation Data.h" #include "Animation Control.h" @@ -17,7 +17,7 @@ #include "Random.h" #include "video.h" #include "vobject_blitters.h" -#include "Sound Control.h" +#include "Sound Control.h" #include "isometric utils.h" #include "Handle UI.h" #include "Event Pump.h" @@ -63,6 +63,11 @@ #include "Strategic Status.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + #define NO_JUMP 0 #define MAX_ANIFRAMES_PER_FLASH 2 //#define TIME_FOR_RANDOM_ANIM_CHECK 10 @@ -75,8 +80,8 @@ extern void AddFuelToVehicle( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVehicle ); DOUBLE gHopFenceForwardSEDist[ NUMSOLDIERBODYTYPES ] = { 2.2, 0.7, 3.2, 0.7 }; DOUBLE gHopFenceForwardNWDist[ NUMSOLDIERBODYTYPES ] = { 2.7, 1.0, 2.7, 1.0 }; -DOUBLE gHopFenceForwardFullSEDist[ NUMSOLDIERBODYTYPES ] = { 1.1, 1.0, 2.1, 1.1 }; -DOUBLE gHopFenceForwardFullNWDist[ NUMSOLDIERBODYTYPES ] = { 0.8, 0.2, 2.7, 0.8 }; +DOUBLE gHopFenceForwardFullSEDist[ NUMSOLDIERBODYTYPES ] = { 1.1, 1.0, 2.1, 1.1 }; +DOUBLE gHopFenceForwardFullNWDist[ NUMSOLDIERBODYTYPES ] = { 0.8, 0.2, 2.7, 0.8 }; DOUBLE gFalloffBackwardsDist[ NUMSOLDIERBODYTYPES ] = { 1, 0.8, 1, 1 }; DOUBLE gClimbUpRoofDist[ NUMSOLDIERBODYTYPES ] = { 2, 0.1, 2, 2 }; DOUBLE gClimbUpRoofLATDist[ NUMSOLDIERBODYTYPES ] = { 0.7, 0.5, 0.7, 0.5 }; @@ -103,19 +108,19 @@ extern UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndRead // Animation code explanations! // -// 0-399: Actual animation frame indices -// 400-499: Object manipulation codes -// 500-598: Jump to frame x-501, same state. Obvious limit 0-97 -// 600-699: Jump to new state x-600, frame 0 -// 700-798: Play sound -// 800-999: Jump to new state x-700, frame 0 (starts with 100) +// 0-399: Actual animation frame indices +// 400-499: Object manipulation codes +// 500-598: Jump to frame x-501, same state. Obvious limit 0-97 +// 600-699: Jump to new state x-600, frame 0 +// 700-798: Play sound +// 800-999: Jump to new state x-700, frame 0 (starts with 100) // BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) { EV_S_FIREWEAPON SFireWeapon; - UINT16 sNewAniFrame, anAniFrame; + UINT16 sNewAniFrame, anAniFrame; INT8 ubCurrentHeight; UINT16 usOldAnimState; static UINT32 uiJumpAddress = NO_JUMP; @@ -132,7 +137,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) BOOLEAN bOKFireWeapon; BOOLEAN bWeaponJammed; BOOLEAN fFreeUpAttacker=FALSE; - UINT16 usUIMovementMode; + UINT16 usUIMovementMode; do { @@ -168,7 +173,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) { pSoldier->bBreathCollapsed = FALSE; } - else if ( pSoldier->bLife == 0 ) + else if ( pSoldier->stats.bLife == 0 ) { // Death takes precedence... pSoldier->bBreathCollapsed = FALSE; @@ -180,7 +185,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) else { // Wait here until we are free.... - if ( !pSoldier->fInNonintAnim ) + if ( !pSoldier->flags.fInNonintAnim ) { // UNset UI UnSetUIBusy( pSoldier->ubID ); @@ -200,7 +205,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // Adjust / set true ani frame // Use -1 because ani files are 1-based, these are 0-based - ConvertAniCodeToAniFrame( pSoldier, (INT16)( sNewAniFrame - 1 ) ); + pSoldier->ConvertAniCodeToAniFrame( (INT16)( sNewAniFrame - 1 ) ); // Adjust frame control pos, and try again pSoldier->usAniCode++; @@ -214,7 +219,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 402: // DO NOT MOVE FOR THIS FRAME - pSoldier->fPausedMove = TRUE; + pSoldier->flags.fPausedMove = TRUE; break; case 403: @@ -240,11 +245,11 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // Move merc up if ( pSoldier->ubDirection == NORTH ) { - SetSoldierHeight( pSoldier, (FLOAT)(pSoldier->sHeightAdjustment + 2 ) ); + pSoldier->SetSoldierHeight( (FLOAT)(pSoldier->sHeightAdjustment + 2 ) ); } else { - SetSoldierHeight( pSoldier, (FLOAT)( pSoldier->sHeightAdjustment + 3 ) ); + pSoldier->SetSoldierHeight( (FLOAT)( pSoldier->sHeightAdjustment + 3 ) ); } break; @@ -255,29 +260,29 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // Moved here because this represents "already on the roof", so breath collapses and interrupts should // keep the soldier on the roof where he belongs // Move merc up specific height - SetSoldierHeight( pSoldier, (FLOAT)50 ); + pSoldier->SetSoldierHeight( (FLOAT)50 ); { INT16 sXPos, sYPos; - //usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc( pSoldier->ubDirection ) ); + //sNewGridNo = NewGridNo( (INT16)pSoldier->sGridNo, (UINT16)DirectionInc( pSoldier->ubDirection ) ); ConvertMapPosToWorldTileCenter( pSoldier->sTempNewGridNo, &sXPos, &sYPos ); - EVENT_SetSoldierPosition( pSoldier, (FLOAT)sXPos, (FLOAT)sYPos ); + pSoldier->EVENT_SetSoldierPosition( (FLOAT)sXPos, (FLOAT)sYPos ); } // re-enable sight gTacticalStatus.uiFlags &= (~DISALLOW_SIGHT); // Move two CC directions - EVENT_SetSoldierDirection( pSoldier, gTwoCCDirection[ pSoldier->ubDirection ] ); + pSoldier->EVENT_SetSoldierDirection( gTwoCCDirection[ pSoldier->ubDirection ] ); - EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection ); + pSoldier->EVENT_SetSoldierDesiredDirection( pSoldier->ubDirection ); // Set desired anim height! pSoldier->ubDesiredHeight = ANIM_CROUCH; // Madd - usUIMovementMode = GetMoveStateBasedOnStance( pSoldier, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ); + usUIMovementMode = pSoldier->GetMoveStateBasedOnStance( gAnimControl[ pSoldier->usAnimState ].ubEndHeight ); pSoldier->usUIMovementMode = usUIMovementMode; // ATE: Change interface level..... @@ -315,27 +320,27 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 409: //CODE: MOVE DOWN - SetSoldierHeight( pSoldier, (FLOAT)( pSoldier->sHeightAdjustment - 2 ) ); + pSoldier->SetSoldierHeight( (FLOAT)( pSoldier->sHeightAdjustment - 2 ) ); break; case 410: // Move merc down specific height - SetSoldierHeight( pSoldier, (FLOAT)0 ); + pSoldier->SetSoldierHeight( (FLOAT)0 ); break; case 411: // CODE: SPECIALMOVE CLIMB DOWN EVENT // Move two C directions - EVENT_SetSoldierDirection( pSoldier, gTwoCDirection[ pSoldier->ubDirection ] ); + pSoldier->EVENT_SetSoldierDirection( gTwoCDirection[ pSoldier->ubDirection ] ); // Remove the roof marker HandlePlacingRoofMarker( pSoldier, pSoldier->sGridNo, FALSE, TRUE ); - EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection ); + pSoldier->EVENT_SetSoldierDesiredDirection( pSoldier->ubDirection ); // Adjust height - SetSoldierHeight( pSoldier, (FLOAT)gClimbDownRoofStartDist[ pSoldier->ubBodyType ] ); + pSoldier->SetSoldierHeight( (FLOAT)gClimbDownRoofStartDist[ pSoldier->ubBodyType ] ); // Adjust position MoveMercFacingDirection( pSoldier , TRUE, (FLOAT)3.5 ); break; @@ -384,7 +389,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) { INT32 uiSound; - uiSound = Weapon [ pSoldier->usAttackingWeapon ].silencedSound; + uiSound = Weapon [ pSoldier->usAttackingWeapon ].silencedSound; //if ( Weapon[ pSoldier->usAttackingWeapon ].ubCalibre == AMMO9 || Weapon[ pSoldier->usAttackingWeapon ].ubCalibre == AMMO38 || Weapon[ pSoldier->usAttackingWeapon ].ubCalibre == AMMO57 ) //{ // uiSound = S_SILENCER_1; @@ -395,7 +400,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) //} //randomize the rate a bit so that the sound is more believable - PlayJA2Sample( uiSound, 44100-Random(5000)-Random(5000)-Random(5000), SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( uiSound, 44100-Random(5000)-Random(5000)-Random(5000), SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } else @@ -403,7 +408,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) INT8 volume = HIGHVOLUME; if ( noisefactor < 100 ) volume = (volume * noisefactor) / 100; //randomize the rate a bit so that the sound is more believable - PlayJA2Sample( Weapon[ pSoldier->usAttackingWeapon ].sSound, 44100-Random(5000)-Random(5000)-Random(5000), SoundVolume( volume, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( Weapon[ pSoldier->usAttackingWeapon ].sSound, 44100-Random(5000)-Random(5000)-Random(5000), SoundVolume( volume, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } } @@ -421,7 +426,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // PlayJA2Sample( (UINT8)( BULLET_IMPACT_1 + Random(3) ), RATE_11025, MIDVOLUME, 1, MIDDLEPAN ); // PLAY RANDOM GETTING HIT SOUND - // DoMercBattleSound( pSoldier, BATTLE_SOUND_HIT1 ); + // pSoldier->DoMercBattleSound( BATTLE_SOUND_HIT1 ); break; @@ -438,7 +443,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // JUMP TO ANOTHER ANIMATION ( BLOOD ) IF WE WANT BLOOD uiJumpAddress = pSoldier->usAnimState; - ChangeSoldierState( pSoldier, FLYBACK_HIT_BLOOD_STAND, 0, FALSE ); + pSoldier->ChangeSoldierState( FLYBACK_HIT_BLOOD_STAND, 0, FALSE ); return( TRUE ); break; @@ -455,7 +460,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) break; } usOldAnimState = pSoldier->usAnimState; - pSoldier->usAniCode = 0; + pSoldier->usAniCode = 0; do { @@ -465,7 +470,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) if ( anAniFrame == 435 ) { // START PROCESSING HERE - ChangeSoldierState( pSoldier, (UINT16)uiJumpAddress, pSoldier->usAniCode, FALSE ); + pSoldier->ChangeSoldierState( (UINT16)uiJumpAddress, pSoldier->usAniCode, FALSE ); return( TRUE ); } // Adjust frame control pos, and try again @@ -478,7 +483,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) if ( anAniFrame == 999 ) { // Fail jump, re-load old anim - ChangeSoldierState( pSoldier, usOldAnimState, 0, FALSE ); + pSoldier->ChangeSoldierState( usOldAnimState, 0, FALSE ); return( TRUE ); } break; @@ -486,28 +491,28 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 437: // CHANGE DIRECTION AND GET-UP - //sGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)(-1 * DirectionInc( pSoldier->ubDirection ) ) ); + //sGridNo = NewGridNo( (INT16)pSoldier->sGridNo, (UINT16)(-1 * DirectionInc( pSoldier->ubDirection ) ) ); //ConvertMapPosToWorldTileCenter( pSoldier->sGridNo, &sXPos, &sYPos ); //SetSoldierPosition( pSoldier, (FLOAT)sXPos, (FLOAT)sYPos ); // Reverse direction - EVENT_SetSoldierDirection( pSoldier, gOppositeDirection[ pSoldier->ubDirection ] ); - EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection ); + pSoldier->EVENT_SetSoldierDirection( gOppositeDirection[ pSoldier->ubDirection ] ); + pSoldier->EVENT_SetSoldierDesiredDirection( pSoldier->ubDirection ); - ChangeSoldierState( pSoldier, GETUP_FROM_ROLLOVER, 0 , FALSE ); + pSoldier->ChangeSoldierState( GETUP_FROM_ROLLOVER, 0 , FALSE ); return( TRUE ); case 438: - //CODE: START HOLD FLASH - pSoldier->fForceShade = TRUE; + //CODE: START HOLD FLASH + pSoldier->flags.fForceShade = TRUE; break; case 439: - //CODE: END HOLD FLASH - pSoldier->fForceShade = FALSE; + //CODE: END HOLD FLASH + pSoldier->flags.fForceShade = FALSE; break; case 440: @@ -519,7 +524,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) if ( pSoldier->usAnimState == CHARIOTS_OF_FIRE || pSoldier->usAnimState == BODYEXPLODING ) { - SoundStop( pSoldier->uiPendingActionData1 ); + SoundStop( pSoldier->aiData.uiPendingActionData1 ); } @@ -543,7 +548,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) break; } - if ( !pSoldier->fMuzzleFlash ) + if ( !pSoldier->flags.fMuzzleFlash ) { break; } @@ -562,11 +567,11 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) LightSpritePower(pSoldier->iMuzFlash, TRUE); // Get one move forward { - UINT16 usNewGridNo; + INT16 sNewGridNo; INT16 sXPos, sYPos; - usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( pSoldier->ubDirection ) ); - ConvertGridNoToCenterCellXY( usNewGridNo, &sXPos, &sYPos ); + sNewGridNo = NewGridNo( (INT16)pSoldier->sGridNo, DirectionInc( pSoldier->ubDirection ) ); + ConvertGridNoToCenterCellXY( sNewGridNo, &sXPos, &sYPos ); LightSpritePosition( pSoldier->iMuzFlash, (INT16)(sXPos/CELL_X_SIZE), (INT16)(sYPos/CELL_Y_SIZE)); // Start count @@ -577,7 +582,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 442: //CODE: FOR A NON-INTERRUPTABLE SCRIPT - SIGNAL DONE - pSoldier->fInNonintAnim = FALSE; + pSoldier->flags.fInNonintAnim = FALSE; // ATE: if it's the begin cower animation, unset ui, cause it could // be from player changin stance @@ -612,10 +617,10 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) sX = CenterX( pSoldier->sForcastGridno ); sY = CenterY( pSoldier->sForcastGridno ); - EVENT_InternalSetSoldierPosition( pSoldier, (FLOAT) sX, (FLOAT) sY, FALSE, FALSE, FALSE ); - EVENT_SetSoldierDirection( pSoldier, gTwoCDirection[ pSoldier->ubDirection ] ); + pSoldier->EVENT_InternalSetSoldierPosition( (FLOAT) sX, (FLOAT) sY, FALSE, FALSE, FALSE ); + pSoldier->EVENT_SetSoldierDirection( gTwoCDirection[ pSoldier->ubDirection ] ); pSoldier->sZLevelOverride = -1; - EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection ); + pSoldier->EVENT_SetSoldierDesiredDirection( pSoldier->ubDirection ); if ( gTacticalStatus.bBoxingState == BOXING_WAITING_FOR_PLAYER || gTacticalStatus.bBoxingState == PRE_BOXING || gTacticalStatus.bBoxingState == BOXING ) @@ -623,10 +628,10 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) BoxingMovementCheck( pSoldier ); } - if ( SetOffBombsInGridNo( pSoldier->ubID, pSoldier->sGridNo, FALSE, pSoldier->bLevel )) + if ( SetOffBombsInGridNo( pSoldier->ubID, pSoldier->sGridNo, FALSE, pSoldier->pathing.bLevel )) { - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); - return( TRUE ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); + return( TRUE ); } // If we are at our final destination, goto stance of our movement stance... @@ -634,22 +639,21 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) //if ( !( gTacticalStatus.uiFlags & INCOMBAT ) ) // This has to be here to make guys continue along fence path #if 0 - if ( pSoldier->sGridNo == pSoldier->sFinalDestination ) + if ( pSoldier->sGridNo == pSoldier->pathing.sFinalDestination ) { if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != gAnimControl[ pSoldier->usUIMovementMode ].ubEndHeight ) { // Goto Stance... - pSoldier->fDontChargeAPsForStanceChange = TRUE; - ChangeSoldierStance( pSoldier, gAnimControl[ pSoldier->usUIMovementMode ].ubEndHeight ); + pSoldier->flags.fDontChargeAPsForStanceChange = TRUE; + pSoldier->ChangeSoldierStance( gAnimControl[ pSoldier->usUIMovementMode ].ubEndHeight ); return( TRUE ); } else { - //SoldierGotoStationaryStance( pSoldier ); + //pSoldier->SoldierGotoStationaryStance( ); // Set UI Busy UnSetUIBusy( pSoldier->ubID ); - //return( TRUE ); } } @@ -679,29 +683,29 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 446: // CODE: Turn pause move flag on - pSoldier->uiStatusFlags |= SOLDIER_PAUSEANIMOVE; + pSoldier->flags.uiStatusFlags |= SOLDIER_PAUSEANIMOVE; break; case 447: // TRY TO FALL!!! - if ( pSoldier ->fTryingToFall ) - { + if ( pSoldier->flags.fTryingToFall ) + { INT16 sLastAniFrame; // TRY FORWARDS... // FIRST GRIDNO - sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) ); + sNewGridNo = NewGridNo( (INT16)pSoldier->sGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) ); - if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->bLevel, pSoldier->ubDirection, FALLFORWARD_HITDEATH_STOP ) ) + if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->pathing.bLevel, pSoldier->ubDirection, FALLFORWARD_HITDEATH_STOP ) ) { // SECOND GRIDNO - // sNewGridNo = NewGridNo( (UINT16)sNewGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) ); + // sNewGridNo = NewGridNo( (INT16)sNewGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) ); - // if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->bLevel, pSoldier->ubDirection, FALLFORWARD_HITDEATH_STOP ) ) + // if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->pathing.bLevel, pSoldier->ubDirection, FALLFORWARD_HITDEATH_STOP ) ) { // ALL'S OK HERE... - pSoldier->fTryingToFall = FALSE; + pSoldier->flags.fTryingToFall = FALSE; break; } } @@ -709,22 +713,22 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // IF HERE, INCREMENT DIRECTION // ATE: Added Feb1 - can be either direction.... - if ( pSoldier->fFallClockwise ) + if ( pSoldier->flags.fFallClockwise ) { - EVENT_SetSoldierDirection( pSoldier, gOneCDirection[ pSoldier->ubDirection ] ); + pSoldier->EVENT_SetSoldierDirection( gOneCDirection[ pSoldier->ubDirection ] ); } else { - EVENT_SetSoldierDirection( pSoldier, gOneCCDirection[ pSoldier->ubDirection ] ); + pSoldier->EVENT_SetSoldierDirection( gOneCCDirection[ pSoldier->ubDirection ] ); } - EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection ); + pSoldier->EVENT_SetSoldierDesiredDirection( pSoldier->ubDirection ); sLastAniFrame = gusAnimInst[ pSoldier->usAnimState ][ ( pSoldier->usAniCode - 2 ) ]; - ConvertAniCodeToAniFrame( pSoldier, (INT16)( sLastAniFrame ) ); + pSoldier->ConvertAniCodeToAniFrame( (INT16)( sLastAniFrame ) ); if ( pSoldier->ubDirection == pSoldier->bStartFallDir ) { // GO FORWARD HERE... - pSoldier ->fTryingToFall = FALSE; + pSoldier->flags.fTryingToFall = FALSE; break;; } // IF HERE, RETURN SO WE DONOT INCREMENT DIR @@ -752,7 +756,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) DebugMsg(TOPIC_JA2,DBG_LEVEL_3,"AdjustToNextAnimationFrame: Burst case 448, stopping because not enough ammo"); fStop = TRUE; fFreeUpAttacker = TRUE; - if ( pSoldier->bTeam == gbPlayerNum ) + if ( pSoldier->bTeam == gbPlayerNum ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ BURST_FIRE_DEPLETED_CLIP_STR ] ); } @@ -777,14 +781,14 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) SoundStop( pSoldier->iBurstSoundID ); } - if ( pSoldier->bTeam == gbPlayerNum ) + if ( pSoldier->bTeam == gbPlayerNum ) { - PlayJA2Sample( S_DRYFIRE1, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( S_DRYFIRE1, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Gun jammed!" ); } DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - aborting start of attack due to burst gun jam") ); - FreeUpAttacker( ); + FreeUpAttacker( ); } else if ( bWeaponJammed == 255 ) { @@ -800,17 +804,17 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) { if(pSoldier->bDoAutofire) //reset the autofire cursor after firing { - pSoldier->autofireLastStep = FALSE; + pSoldier->flags.autofireLastStep = FALSE; pSoldier->bDoAutofire = 1; } - pSoldier->fDoSpread = FALSE; + pSoldier->flags.fDoSpread = FALSE; pSoldier->bDoBurst = 1; - // pSoldier->fBurstCompleted = TRUE; + // pSoldier->flags.fBurstCompleted = TRUE; if ( fFreeUpAttacker ) { // DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - aborting start of attack") ); - // FreeUpAttacker( pSoldier->ubID ); + // FreeUpAttacker( pSoldier->ubID ); } // ATE; Reduce it due to animation being stopped... @@ -826,26 +830,26 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // END: GOTO AIM STANCE BASED ON HEIGHT // If we are a robot - we need to do stuff different here - // 0verhaul: Ya know, if the robot simply used the same animation for standing and rifle standing, + // 0verhaul: Ya know, if the robot simply used the same animation for standing and rifle standing, // we probably wouldn't need this special case code. if ( AM_A_ROBOT( pSoldier ) ) { - ChangeSoldierState( pSoldier, STANDING, 0 , FALSE ); + pSoldier->ChangeSoldierState( STANDING, 0 , FALSE ); } else { switch ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) { case ANIM_STAND: - ChangeSoldierState( pSoldier, AIM_RIFLE_STAND, 0 , FALSE ); + pSoldier->ChangeSoldierState( AIM_RIFLE_STAND, 0 , FALSE ); break; case ANIM_PRONE: - ChangeSoldierState( pSoldier, AIM_RIFLE_PRONE, 0 , FALSE ); + pSoldier->ChangeSoldierState( AIM_RIFLE_PRONE, 0 , FALSE ); break; case ANIM_CROUCH: - ChangeSoldierState( pSoldier, AIM_RIFLE_CROUCH, 0 , FALSE ); + pSoldier->ChangeSoldierState( AIM_RIFLE_CROUCH, 0 , FALSE ); break; } @@ -854,12 +858,12 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) } // MOVETO CURRENT SPREAD LOCATION - if ( pSoldier->fDoSpread ) + if ( pSoldier->flags.fDoSpread ) { - if ( pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] != 0 ) + if ( pSoldier->sSpreadLocations[ pSoldier->flags.fDoSpread - 1 ] != 0 ) { - EVENT_SetSoldierDirection( pSoldier, (INT8)GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] ) ); - EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection ); + pSoldier->EVENT_SetSoldierDirection( (INT8)GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, pSoldier->sSpreadLocations[ pSoldier->flags.fDoSpread - 1 ] ) ); + pSoldier->EVENT_SetSoldierDesiredDirection( pSoldier->ubDirection ); } } break; @@ -867,17 +871,17 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 449: //CODE: FINISH BURST - pSoldier->fDoSpread = FALSE; + pSoldier->flags.fDoSpread = FALSE; pSoldier->bDoBurst = 1; - // pSoldier->fBurstCompleted = TRUE; + // pSoldier->flags.fBurstCompleted = TRUE; break; case 450: //CODE: BEGINHOPFENCE // MOVE TWO FACGIN GRIDNOS - sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) ); - sNewGridNo = NewGridNo( (UINT16)sNewGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) ); + sNewGridNo = NewGridNo( (INT16)pSoldier->sGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) ); + sNewGridNo = NewGridNo( (INT16)sNewGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) ); pSoldier->sForcastGridno = sNewGridNo; break; @@ -928,11 +932,11 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // Move merc up if ( pSoldier->ubDirection == NORTH ) { - SetSoldierHeight( pSoldier, (FLOAT)(pSoldier->dHeightAdjustment + gClimbUpRoofDist[ pSoldier->ubBodyType ] ) ); + pSoldier->SetSoldierHeight( (FLOAT)(pSoldier->aiData.dHeightAdjustment + gClimbUpRoofDist[ pSoldier->ubBodyType ] ) ); } else { - SetSoldierHeight( pSoldier, (FLOAT)(pSoldier->dHeightAdjustment + gClimbUpRoofDist[ pSoldier->ubBodyType ] ) ); + pSoldier->SetSoldierHeight( (FLOAT)(pSoldier->aiData.dHeightAdjustment + gClimbUpRoofDist[ pSoldier->ubBodyType ] ) ); } break; @@ -942,7 +946,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) MoveMercFacingDirection( pSoldier, FALSE, (FLOAT)gClimbUpRoofLATDist[ pSoldier->ubBodyType ] ); // MOVE DOWN SOME VALUE TOO! - SetSoldierHeight( pSoldier, (FLOAT)(pSoldier->dHeightAdjustment - gClimbUpRoofDistGoingLower[ pSoldier->ubBodyType ] ) ); + pSoldier->SetSoldierHeight( (FLOAT)(pSoldier->aiData.dHeightAdjustment - gClimbUpRoofDistGoingLower[ pSoldier->ubBodyType ] ) ); break; @@ -952,11 +956,11 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // Move merc DOWN if ( pSoldier->ubDirection == NORTH ) { - SetSoldierHeight( pSoldier, (FLOAT)(pSoldier->dHeightAdjustment - gClimbUpRoofDist[ pSoldier->ubBodyType ] ) ); + pSoldier->SetSoldierHeight( (FLOAT)(pSoldier->aiData.dHeightAdjustment - gClimbUpRoofDist[ pSoldier->ubBodyType ] ) ); } else { - SetSoldierHeight( pSoldier, (FLOAT)(pSoldier->dHeightAdjustment - gClimbUpRoofDist[ pSoldier->ubBodyType ] ) ); + pSoldier->SetSoldierHeight( (FLOAT)(pSoldier->aiData.dHeightAdjustment - gClimbUpRoofDist[ pSoldier->ubBodyType ] ) ); } break; @@ -972,7 +976,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) pSoldier->ubAttackingHand = HANDPOS; pSoldier->usAttackingWeapon = pSoldier->inv[pSoldier->ubAttackingHand].usItem; // Adjust fReloading to FALSE - pSoldier->fReloading = FALSE; + pSoldier->flags.fReloading = FALSE; break; case 458: @@ -981,7 +985,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) pSoldier->ubAttackingHand = SECONDHANDPOS; pSoldier->usAttackingWeapon = pSoldier->inv[pSoldier->ubAttackingHand].usItem; // Adjust fReloading to FALSE - pSoldier->fReloading = FALSE; + pSoldier->flags.fReloading = FALSE; break; case 460: @@ -1004,7 +1008,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) DeductPoints( pSoldier, AP_TOSS_ITEM, 0 ); } - CreatePhysicalObject( pSoldier->pTempObject, pSoldier->pThrowParams->dLifeSpan, pSoldier->pThrowParams->dX, pSoldier->pThrowParams->dY, pSoldier->pThrowParams->dZ, pSoldier->pThrowParams->dForceX, pSoldier->pThrowParams->dForceY, pSoldier->pThrowParams->dForceZ, pSoldier->ubID, pSoldier->pThrowParams->ubActionCode, pSoldier->pThrowParams->uiActionData, FALSE ); + CreatePhysicalObject( pSoldier->pTempObject, pSoldier->pThrowParams->dLifeSpan, pSoldier->pThrowParams->dX, pSoldier->pThrowParams->dY, pSoldier->pThrowParams->dZ, pSoldier->pThrowParams->dForceX, pSoldier->pThrowParams->dForceY, pSoldier->pThrowParams->dForceZ, pSoldier->ubID, pSoldier->pThrowParams->ubActionCode, pSoldier->pThrowParams->uiActionData, FALSE ); // Remove object //RemoveObjFrom( &(pSoldier->inv[ HANDPOS ] ), 0 ); @@ -1012,8 +1016,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // Update UI DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); - MemFree( pSoldier->pTempObject ); - pSoldier->pTempObject = NULL; + OBJECTTYPE::DeleteMe( &pSoldier->pTempObject ); MemFree( pSoldier->pThrowParams ); pSoldier->pThrowParams = NULL; @@ -1023,8 +1026,8 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 462: // CODE: MOVE UP FROM CLIFF CLIMB - pSoldier->dHeightAdjustment += (float)2.1; - pSoldier->sHeightAdjustment = (INT16)pSoldier->dHeightAdjustment; + pSoldier->aiData.dHeightAdjustment += (float)2.1; + pSoldier->sHeightAdjustment = (INT16)pSoldier->aiData.dHeightAdjustment; // Move over some... //MoveMercFacingDirection( pSoldier , FALSE, (FLOAT)0.5 ); break; @@ -1039,29 +1042,29 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 464: // CODE: END CLIFF CLIMB - pSoldier->dHeightAdjustment = (float)0; - pSoldier->sHeightAdjustment = (INT16)pSoldier->dHeightAdjustment; + pSoldier->aiData.dHeightAdjustment = (float)0; + pSoldier->sHeightAdjustment = (INT16)pSoldier->aiData.dHeightAdjustment; // Set new gridno { INT16 sTempGridNo, sNewX, sNewY; //Get Next GridNo; - sTempGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (INT16)( DirectionInc(pSoldier->ubDirection ) ) ); + sTempGridNo = NewGridNo( (INT16)pSoldier->sGridNo, (INT16)( DirectionInc(pSoldier->ubDirection ) ) ); // Get center XY ConvertGridNoToCenterCellXY( sTempGridNo, &sNewX, &sNewY ); // Set position - EVENT_SetSoldierPosition( pSoldier, sNewX, sNewY ); + pSoldier->EVENT_SetSoldierPosition( sNewX, sNewY ); // Move two CC directions - EVENT_SetSoldierDirection( pSoldier, gTwoCCDirection[ pSoldier->ubDirection ] ); - EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection ); + pSoldier->EVENT_SetSoldierDirection( gTwoCCDirection[ pSoldier->ubDirection ] ); + pSoldier->EVENT_SetSoldierDesiredDirection( pSoldier->ubDirection ); // Set desired anim height! pSoldier->ubDesiredHeight = ANIM_CROUCH; - pSoldier->sFinalDestination = pSoldier->sGridNo; + pSoldier->pathing.sFinalDestination = pSoldier->sGridNo; } break; @@ -1069,7 +1072,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 465: // CODE: SET GUY TO LIFE OF 0 - pSoldier->bLife = 0; + pSoldier->stats.bLife = 0; break; case 466: @@ -1084,18 +1087,18 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) if ( sDiff > 0 ) { // Adjust! - SetSoldierHeight( pSoldier, (FLOAT)(pSoldier->dHeightAdjustment - 2 ) ); + pSoldier->SetSoldierHeight( (FLOAT)(pSoldier->aiData.dHeightAdjustment - 2 ) ); } else { // Adjust! - SetSoldierHeight( pSoldier, (FLOAT)(pSoldier->dHeightAdjustment + 2 ) ); + pSoldier->SetSoldierHeight( (FLOAT)(pSoldier->aiData.dHeightAdjustment + 2 ) ); } } else { // Adjust! - SetSoldierHeight( pSoldier, (FLOAT)(pSoldier->sDesiredHeight) ); + pSoldier->SetSoldierHeight( (FLOAT)(pSoldier->sDesiredHeight) ); } } else @@ -1103,7 +1106,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // Goto eating animation if ( pSoldier->sDesiredHeight == 0 ) { - ChangeSoldierState( pSoldier, CROW_EAT, 0 , FALSE ); + pSoldier->ChangeSoldierState( CROW_EAT, 0 , FALSE ); } else { @@ -1118,22 +1121,22 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 467: ///CODE: FOR HELIDROP, SET DIRECTION - EVENT_SetSoldierDirection( pSoldier, EAST ); - EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection ); + pSoldier->EVENT_SetSoldierDirection( EAST ); + pSoldier->EVENT_SetSoldierDesiredDirection( pSoldier->ubDirection ); gfIngagedInDrop = FALSE; // OK, now get a sweetspot ( not the place we are now! ) - // sNewGridNo = FindGridNoFromSweetSpotExcludingSweetSpot( pSoldier, pSoldier->sGridNo, 5, &ubNewDirection ); - //sNewGridNo = FindRandomGridNoFromSweetSpotExcludingSweetSpot( pSoldier, pSoldier->sGridNo, 3, &ubNewDirection ); + // sNewGridNo = FindGridNoFromSweetSpotExcludingSweetSpot( pSoldier, pSoldier->sGridNo, 5, &ubNewDirection ); + //sNewGridNo = FindRandomGridNoFromSweetSpotExcludingSweetSpot( pSoldier, pSoldier->sGridNo, 3, &ubNewDirection ); - sNewGridNo = FindGridNoFromSweetSpotExcludingSweetSpotInQuardent( pSoldier, pSoldier->sGridNo, 3, &ubNewDirection, SOUTHEAST ); + sNewGridNo = FindGridNoFromSweetSpotExcludingSweetSpotInQuardent( pSoldier, pSoldier->sGridNo, 3, &ubNewDirection, SOUTHEAST ); // Check for merc arrives quotes... HandleMercArrivesQuotes( pSoldier ); // Find a path to it! - EVENT_GetNewSoldierPath( pSoldier, sNewGridNo, WALKING ); + pSoldier->EVENT_GetNewSoldierPath( sNewGridNo, WALKING ); return( TRUE ); break; @@ -1145,15 +1148,15 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) BOOLEAN fNPCPunch = FALSE; // ATE: Put some code in for NPC punches... - if ( pSoldier->uiStatusFlags & SOLDIER_NPC_DOING_PUNCH ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_NPC_DOING_PUNCH ) { fNPCPunch = TRUE; // Turn off - pSoldier->uiStatusFlags &= (~SOLDIER_NPC_DOING_PUNCH ); + pSoldier->flags.uiStatusFlags &= (~SOLDIER_NPC_DOING_PUNCH ); // Trigger approach... - TriggerNPCWithGivenApproach( pSoldier->ubProfile, (UINT8)pSoldier->uiPendingActionData4, FALSE ); + TriggerNPCWithGivenApproach( pSoldier->ubProfile, (UINT8)pSoldier->aiData.uiPendingActionData4, FALSE ); } @@ -1173,12 +1176,12 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) { if ( fNPCPunch ) { - ChangeSoldierStance( pSoldier, ANIM_STAND ); + pSoldier->ChangeSoldierStance( ANIM_STAND ); return( TRUE ); } else { - ChangeSoldierState( pSoldier, CROUCHING, 0, FALSE ); + pSoldier->ChangeSoldierState( CROUCHING, 0, FALSE ); return( TRUE ); } } @@ -1186,12 +1189,12 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) { if ( fMartialArtist && !AreInMeanwhile( ) ) { - ChangeSoldierState( pSoldier, NINJA_BREATH, 0, FALSE ); + pSoldier->ChangeSoldierState( NINJA_BREATH, 0, FALSE ); return( TRUE ); } else { - ChangeSoldierState( pSoldier, PUNCH_BREATH, 0, FALSE ); + pSoldier->ChangeSoldierState( PUNCH_BREATH, 0, FALSE ); return( TRUE ); } } @@ -1202,14 +1205,14 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 469: // CODE: Begin martial artist attack - DoNinjaAttack( pSoldier ); + pSoldier->DoNinjaAttack( ); return( TRUE ); break; case 470: // CODE: CHECK FOR OK WEAPON SHOT! - bOKFireWeapon = OKFireWeapon( pSoldier ); + bOKFireWeapon = OKFireWeapon( pSoldier ); if ( bOKFireWeapon == FALSE ) { @@ -1222,7 +1225,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // Reduce by a bullet... // pSoldier->bBulletsLeft--; - PlayJA2Sample( S_DRYFIRE1, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( S_DRYFIRE1, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); // Free-up! DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - gun failed to fire") ); @@ -1242,7 +1245,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 471: // CODE: Turn pause move flag off - pSoldier->uiStatusFlags &= (~SOLDIER_PAUSEANIMOVE); + pSoldier->flags.uiStatusFlags &= (~SOLDIER_PAUSEANIMOVE); break; case 472: @@ -1252,17 +1255,17 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // Save old flag, then reset. If we do nothing special here, at least go back // to aim if we were. - fGoBackToAimAfterHit = pSoldier->fGoBackToAimAfterHit; - pSoldier->fGoBackToAimAfterHit = FALSE; + fGoBackToAimAfterHit = pSoldier->flags.fGoBackToAimAfterHit; + pSoldier->flags.fGoBackToAimAfterHit = FALSE; - if ( !( pSoldier->uiStatusFlags & SOLDIER_TURNINGFROMHIT ) ) + if ( !( pSoldier->flags.uiStatusFlags & SOLDIER_TURNINGFROMHIT ) ) { switch( gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) { case ANIM_STAND: // OK, we can do some cool things here - first is to make guy walkl back a bit... - // ChangeSoldierState( pSoldier, STANDING_HIT_BEGINCROUCHDOWN, 0, FALSE ); + // pSoldier->ChangeSoldierState( STANDING_HIT_BEGINCROUCHDOWN, 0, FALSE ); // return( TRUE ); break; @@ -1272,9 +1275,9 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // CODE: HANDLE ANY RANDOM HIT VARIATIONS WE WISH TO DO..... if ( fGoBackToAimAfterHit ) { - if ( pSoldier->bLife >= OKLIFE ) + if ( pSoldier->stats.bLife >= OKLIFE ) { - InternalSoldierReadyWeapon( pSoldier, pSoldier->ubDirection, FALSE ); + pSoldier->InternalSoldierReadyWeapon(pSoldier->ubDirection, FALSE ); } return( TRUE ); } @@ -1294,14 +1297,14 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 474: // CODE: GETUP FROM SLEEP - ChangeSoldierStance( pSoldier, ANIM_STAND ); + pSoldier->ChangeSoldierStance( ANIM_STAND ); return( TRUE ); case 475: // CODE: END CLIMB DOWN ROOF pSoldier->ubDesiredHeight = ANIM_STAND; - pSoldier->sFinalDestination = pSoldier->sGridNo; + pSoldier->pathing.sFinalDestination = pSoldier->sGridNo; // re-enable sight gTacticalStatus.uiFlags &= (~DISALLOW_SIGHT); @@ -1330,7 +1333,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 476: // CODE: GOTO PREVIOUS ANIMATION - ChangeSoldierState( pSoldier, ( pSoldier->sPendingActionData2 ), (UINT8)( pSoldier->uiPendingActionData1 + 1 ), FALSE ); + pSoldier->ChangeSoldierState( ( pSoldier->aiData.sPendingActionData2 ), (UINT8)( pSoldier->aiData.uiPendingActionData1 + 1 ), FALSE ); return( TRUE ); break; @@ -1363,10 +1366,10 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) if ( pSoldier->ubBodyType <= REGFEMALE ) { // Secondly, don't if we are going to collapse - if ( pSoldier->bLife >= OKLIFE && pSoldier->bBreath > 0 && pSoldier->bLevel == 0 ) + if ( pSoldier->stats.bLife >= OKLIFE && pSoldier->bBreath > 0 && pSoldier->pathing.bLevel == 0 ) { // Save old direction - pSoldier->uiPendingActionData1 = pSoldier->ubDirection; + pSoldier->aiData.uiPendingActionData1 = pSoldier->ubDirection; // If we got a head shot...more chance of turning... if ( pSoldier->ubHitLocation != AIM_SHOT_HEAD ) @@ -1374,7 +1377,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) uiChance = Random( 100 ); // 30 % chance to change direction one way - if ( uiChance < 30 ) + if ( uiChance < 30 ) { bNewDirection = gOneCDirection[ pSoldier->ubDirection ]; } @@ -1389,8 +1392,8 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) bNewDirection = pSoldier->ubDirection; } - EVENT_SetSoldierDirection( pSoldier, bNewDirection ); - EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection ); + pSoldier->EVENT_SetSoldierDirection( bNewDirection ); + pSoldier->EVENT_SetSoldierDesiredDirection( pSoldier->ubDirection ); } else @@ -1398,10 +1401,10 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // OK, 50% chance here to turn... uiChance = Random( 100 ); - if ( uiChance < 50 ) + if ( uiChance < 50 ) { // OK, pick a larger direction to goto.... - pSoldier->uiStatusFlags |= SOLDIER_TURNINGFROMHIT; + pSoldier->flags.uiStatusFlags |= SOLDIER_TURNINGFROMHIT; // This becomes an attack busy situation // 0verhaul: There is an attack busy problem with this. The soldier could be in mid-turn // when another bullet is fired (auto-fire or dual-wield, for instance), and the soldier is @@ -1426,10 +1429,10 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) bNewDirection = gOneCCDirection[ bNewDirection ]; } - EVENT_SetSoldierDesiredDirection( pSoldier, bNewDirection ); - } + pSoldier->EVENT_SetSoldierDesiredDirection( bNewDirection ); + } } - } + } } break; } @@ -1440,12 +1443,12 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) if ( pSoldier->ubBodyType <= REGFEMALE ) { // Secondly, don't if we are going to collapse - //if ( pSoldier->bLife >= OKLIFE && pSoldier->bBreath > 0 ) + //if ( pSoldier->stats.bLife >= OKLIFE && pSoldier->bBreath > 0 ) //{ - /// if ( !( pSoldier->uiStatusFlags & SOLDIER_TURNINGFROMHIT ) ) + /// if ( !( pSoldier->flags.uiStatusFlags & SOLDIER_TURNINGFROMHIT ) ) // { - /// pSoldier->ubDirection = (INT8)pSoldier->uiPendingActionData1; - // pSoldier->bDesiredDirection = (INT8)pSoldier->uiPendingActionData1; + /// pSoldier->ubDirection = (INT8)pSoldier->aiData.uiPendingActionData1; + // pSoldier->pathing.bDesiredDirection = (INT8)pSoldier->aiData.uiPendingActionData1; // } //} } @@ -1453,7 +1456,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 480: - // 0verhaul: This is handled in the ReduceAttackBusyCount call + // 0verhaul: This is handled in the ReduceAttackBusyCount call // CODE: FORCE FREE ATTACKER // Release attacker //DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Releasesoldierattacker, code 480") ); @@ -1461,7 +1464,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) //ReleaseSoldiersAttacker( pSoldier ); //FREEUP GETTING HIT FLAG - //pSoldier->fGettingHit = FALSE; + //pSoldier->flags.fGettingHit = FALSE; break; case 481: @@ -1479,20 +1482,20 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 483: // CODE: HANDLE DROP BOMB... - HandleSoldierDropBomb( pSoldier, pSoldier->sPendingActionData2 ); + HandleSoldierDropBomb( pSoldier, pSoldier->aiData.sPendingActionData2 ); break; case 484: // CODE: HANDLE REMOTE... - HandleSoldierUseRemote( pSoldier, pSoldier->sPendingActionData2 ); + HandleSoldierUseRemote( pSoldier, pSoldier->aiData.sPendingActionData2 ); break; case 485: // CODE: Try steal..... // UnSetUIBusy( pSoldier->ubID); - UseHandToHand( pSoldier, pSoldier->sPendingActionData2, TRUE ); + UseHandToHand( pSoldier, pSoldier->aiData.sPendingActionData2, TRUE ); //jackaians: //if we are not waiting for the pickup menu to be displayed // if (guiPendingOverrideEvent != G_GETTINGITEM) @@ -1521,7 +1524,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) //CODE: REMOVE GUY FRMO WORLD DUE TO EXPLOSION - //ChangeSoldierState( pSoldier, RAISE_RIFLE, 0 , FALSE ); + //pSoldier->ChangeSoldierState( RAISE_RIFLE, 0 , FALSE ); //return( TRUE ); //Delete guy //TacticalRemoveSoldier( pSoldier->ubID ); @@ -1533,15 +1536,15 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // CODE: HANDLE END ITEM PICKUP //LOOK INTO HAND, RAISE RIFLE IF WE HAVE ONE.... /* - if ( pSoldier->inv[ HANDPOS ].usItem != NOTHING ) - { + if ( pSoldier->inv[ HANDPOS ].exists() == true ) + { // CHECK IF GUN if ( Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass == IC_GUN ) { if ( Weapon[ pSoldier->inv[ HANDPOS ].usItem ].ubWeaponClass != HANDGUNCLASS ) { // RAISE - ChangeSoldierState( pSoldier, RAISE_RIFLE, 0 , FALSE ); + pSoldier->ChangeSoldierState( RAISE_RIFLE, 0 , FALSE ); return( TRUE ); } @@ -1554,18 +1557,18 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 491: // CODE: HANDLE RANDOM BREATH ANIMATION - //if ( pSoldier->bLife > INJURED_CHANGE_THREASHOLD ) - if ( pSoldier->bLife >= OKLIFE ) + //if ( pSoldier->stats.bLife > INJURED_CHANGE_THREASHOLD ) + if ( pSoldier->stats.bLife >= OKLIFE ) { // Increment time from last update pSoldier->uiTimeOfLastRandomAction++; - if ( pSoldier->uiTimeOfLastRandomAction > TIME_FOR_RANDOM_ANIM_CHECK || pSoldier->bLife < INJURED_CHANGE_THREASHOLD || GetDrunkLevel( pSoldier ) >= BORDERLINE ) + if ( pSoldier->uiTimeOfLastRandomAction > TIME_FOR_RANDOM_ANIM_CHECK || pSoldier->stats.bLife < INJURED_CHANGE_THREASHOLD || GetDrunkLevel( pSoldier ) >= BORDERLINE ) { pSoldier->uiTimeOfLastRandomAction = 0; // Don't do any in water! - if ( !MercInWater( pSoldier ) ) + if ( !pSoldier->MercInWater( ) ) { // OK, make a dice roll ubDiceRoll = (UINT8)Random( 100 ); @@ -1576,7 +1579,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // Default to nothing in hand ( nothing in quotes, we do have something but not just visible ) ubRandomHandIndex = RANDOM_ANIM_NOTHINGINHAND; - if ( usItem != NOTHING ) + if ( pSoldier->inv[ HANDPOS ].exists() == true ) { if ( Item[ usItem ].usItemClass == IC_GUN ) { @@ -1602,13 +1605,13 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) if ( pAnimDef->sAnimID != 0 ) { // If it's an injured animation and we are not in the threashold.... - if ( ( pAnimDef->ubFlags & RANDOM_ANIM_INJURED ) && pSoldier->bLife >= INJURED_CHANGE_THREASHOLD ) + if ( ( pAnimDef->ubFlags & RANDOM_ANIM_INJURED ) && pSoldier->stats.bLife >= INJURED_CHANGE_THREASHOLD ) { continue; } // If we need to do an injured one, don't do any others... - if ( !( pAnimDef->ubFlags & RANDOM_ANIM_INJURED ) && pSoldier->bLife < INJURED_CHANGE_THREASHOLD ) + if ( !( pAnimDef->ubFlags & RANDOM_ANIM_INJURED ) && pSoldier->stats.bLife < INJURED_CHANGE_THREASHOLD ) { continue; } @@ -1635,7 +1638,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) if ( ( pAnimDef->ubFlags & RANDOM_ANIM_CASUAL ) ) { // If he's a bad guy, do not do it! - if ( pSoldier->bTeam != gbPlayerNum || ( gTacticalStatus.uiFlags & INCOMBAT ) ) + if ( pSoldier->bTeam != gbPlayerNum || ( gTacticalStatus.uiFlags & INCOMBAT ) ) { continue; } @@ -1672,26 +1675,26 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) if ( Random( 100 ) < 10 ) { // Play sound - PlayJA2SampleFromFile( pAnimDef->zSoundFile, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2SampleFromFile( pAnimDef->zSoundFile, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } } else { // Play sound - PlayJA2SampleFromFile( pAnimDef->zSoundFile, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2SampleFromFile( pAnimDef->zSoundFile, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } } } else { // Play sound - PlayJA2SampleFromFile( pAnimDef->zSoundFile, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2SampleFromFile( pAnimDef->zSoundFile, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } } else { - ChangeSoldierState( pSoldier, pAnimDef->sAnimID, 0 , FALSE ); + pSoldier->ChangeSoldierState( pAnimDef->sAnimID, 0 , FALSE ); } return( TRUE ); } @@ -1709,26 +1712,26 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // SIGNAL DODGE! // ATE: Only do if we're not inspecial case... - if ( !( pSoldier->uiStatusFlags & SOLDIER_NPC_DOING_PUNCH ) ) + if ( !( pSoldier->flags.uiStatusFlags & SOLDIER_NPC_DOING_PUNCH ) ) { SOLDIERTYPE *pTSoldier; UINT32 uiMercFlags; UINT16 usSoldierIndex; if ( FindSoldier( pSoldier->sTargetGridNo, &usSoldierIndex, &uiMercFlags, FIND_SOLDIER_GRIDNO ) ) - { - GetSoldier( &pTSoldier, usSoldierIndex ); + { + GetSoldier( &pTSoldier, usSoldierIndex ); // IF WE ARE AN ANIMAL, CAR, MONSTER, DONT'T DODGE if ( IS_MERC_BODY_TYPE( pTSoldier ) ) { // ONLY DODGE IF WE ARE SEEN - if ( pTSoldier->bOppList[ pSoldier->ubID ] != 0 || pTSoldier->bTeam == pSoldier->bTeam ) + if ( pTSoldier->aiData.bOppList[ pSoldier->ubID ] != 0 || pTSoldier->bTeam == pSoldier->bTeam ) { if ( gAnimControl[ pTSoldier->usAnimState ].ubHeight == ANIM_STAND ) { // OK, stop merc.... - EVENT_StopMerc( pTSoldier, pTSoldier->sGridNo, pTSoldier->ubDirection ); + pTSoldier->EVENT_StopMerc( pTSoldier->sGridNo, pTSoldier->ubDirection ); if ( pTSoldier->bTeam != gbPlayerNum ) { @@ -1736,10 +1739,10 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) } // Turn towards the person! - EVENT_SetSoldierDesiredDirection( pTSoldier, GetDirectionFromGridNo( pSoldier->sGridNo, pTSoldier ) ); + pTSoldier->EVENT_SetSoldierDesiredDirection( GetDirectionFromGridNo( pSoldier->sGridNo, pTSoldier ) ); // PLAY SOLDIER'S DODGE ANIMATION - ChangeSoldierState( pTSoldier, DODGE_ONE, 0 , FALSE ); + pTSoldier->ChangeSoldierState( DODGE_ONE, 0 , FALSE ); } } } @@ -1751,17 +1754,17 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) //CODE: PICKUP ITEM! // CHECK IF THIS EVENT HAS BEEN SETUP - //if ( pSoldier->ubPendingAction == MERC_PICKUPITEM ) + //if ( pSoldier->aiData.ubPendingAction == MERC_PICKUPITEM ) //{ // DROP ITEM - HandleSoldierPickupItem( pSoldier, pSoldier->uiPendingActionData1, (INT16)(pSoldier->uiPendingActionData4 ), pSoldier->bPendingActionData3 ); + HandleSoldierPickupItem( pSoldier, pSoldier->aiData.uiPendingActionData1, (INT16)(pSoldier->aiData.uiPendingActionData4 ), pSoldier->aiData.bPendingActionData3 ); // EVENT HAS BEEN HANDLED - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; //} //else //{ - // DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Soldier Ani: CODE 493 Error, Pickup item action called but not setup" ); + // DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Soldier Ani: CODE 493 Error, Pickup item action called but not setup" ); //} break; @@ -1769,33 +1772,33 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) //CODE: OPEN STRUCT! // CHECK IF THIS EVENT HAS BEEN SETUP - //if ( pSoldier->ubPendingAction == MERC_OPENSTRUCT ) + //if ( pSoldier->aiData.ubPendingAction == MERC_OPENSTRUCT ) //{ SoldierHandleInteractiveObject( pSoldier ); // EVENT HAS BEEN HANDLED - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; //} //else //{ - // DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Soldier Ani: CODE 494 Error, OPen door action called but not setup" ); + // DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Soldier Ani: CODE 494 Error, OPen door action called but not setup" ); //} break; case 495: - if (pSoldier->bAction == AI_ACTION_UNLOCK_DOOR || (pSoldier->bAction == AI_ACTION_LOCK_DOOR && !(pSoldier->fAIFlags & AI_LOCK_DOOR_INCLUDES_CLOSE) ) ) + if (pSoldier->aiData.bAction == AI_ACTION_UNLOCK_DOOR || (pSoldier->aiData.bAction == AI_ACTION_LOCK_DOOR && !(pSoldier->aiData.fAIFlags & AI_LOCK_DOOR_INCLUDES_CLOSE) ) ) { // EVENT HAS BEEN HANDLED - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; // do nothing here } else { - pSoldier->fAIFlags &= ~(AI_LOCK_DOOR_INCLUDES_CLOSE); + pSoldier->aiData.fAIFlags &= ~(AI_LOCK_DOOR_INCLUDES_CLOSE); pSoldier->ubDoorOpeningNoise = DoorOpeningNoise( pSoldier ); @@ -1806,7 +1809,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) InitOpplistForDoorOpening(); - MakeNoise( pSoldier->ubID, pSoldier->sGridNo, pSoldier->bLevel, gpWorldLevelData[pSoldier->sGridNo].ubTerrainID, pSoldier->ubDoorOpeningNoise, NOISE_CREAKING ); + MakeNoise( pSoldier->ubID, pSoldier->sGridNo, pSoldier->pathing.bLevel, gpWorldLevelData[pSoldier->sGridNo].ubTerrainID, pSoldier->ubDoorOpeningNoise, NOISE_CREAKING ); // gfDelayResolvingBestSighting = FALSE; gubInterruptProvoker = pSoldier->ubID; @@ -1817,7 +1820,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) } // EVENT HAS BEEN HANDLED - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; } @@ -1826,25 +1829,25 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 496: // CODE: GOTO PREVIOUS ANIMATION - ChangeSoldierState( pSoldier, pSoldier->usOldAniState, pSoldier->sOldAniCode, FALSE ); + pSoldier->ChangeSoldierState( pSoldier->usOldAniState, pSoldier->sOldAniCode, FALSE ); return( TRUE ); case 497: // CODE: CHECK FOR UNCONSCIOUS OR DEATH // IF 496 - GOTO PREVIOUS ANIMATION, OTHERWISE PAUSE ANIMATION - if ( pSoldier->bLife == 0 ) + if ( pSoldier->stats.bLife == 0 ) { //HandleSoldierDeath( pSoldier ); // If guy is now dead, and we have not played death sound before, play - if ( pSoldier->bLife == 0 && !pSoldier->fDeadSoundPlayed ) - { + if ( pSoldier->stats.bLife == 0 && !pSoldier->flags.fDeadSoundPlayed ) + { if ( pSoldier->usAnimState != JFK_HITDEATH ) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_DIE1 ); - pSoldier->fDeadSoundPlayed = TRUE; + pSoldier->DoMercBattleSound( BATTLE_SOUND_DIE1 ); + pSoldier->flags.fDeadSoundPlayed = TRUE; } } @@ -1854,61 +1857,61 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) switch( pSoldier->usAnimState ) { case FLYBACK_HIT: - ChangeSoldierState( pSoldier, FLYBACK_HIT_DEATH, 0, FALSE ); + pSoldier->ChangeSoldierState( FLYBACK_HIT_DEATH, 0, FALSE ); break; case GENERIC_HIT_DEATHTWITCHNB: case FALLFORWARD_FROMHIT_STAND: case ENDFALLFORWARD_FROMHIT_CROUCH: - ChangeSoldierState( pSoldier, GENERIC_HIT_DEATH, 0, FALSE ); + pSoldier->ChangeSoldierState( GENERIC_HIT_DEATH, 0, FALSE ); break; case FALLBACK_HIT_DEATHTWITCHNB: case FALLBACK_HIT_STAND: - ChangeSoldierState( pSoldier, FALLBACK_HIT_DEATH, 0, FALSE ); + pSoldier->ChangeSoldierState( FALLBACK_HIT_DEATH, 0, FALSE ); break; case PRONE_HIT_DEATHTWITCHNB: case PRONE_LAY_FROMHIT: - ChangeSoldierState( pSoldier, PRONE_HIT_DEATH, 0, FALSE ); + pSoldier->ChangeSoldierState( PRONE_HIT_DEATH, 0, FALSE ); break; case FALLOFF: - ChangeSoldierState( pSoldier, FALLOFF_DEATH, 0, FALSE ); + pSoldier->ChangeSoldierState( FALLOFF_DEATH, 0, FALSE ); break; case FALLFORWARD_ROOF: - ChangeSoldierState( pSoldier, FALLOFF_FORWARD_DEATH, 0, FALSE); + pSoldier->ChangeSoldierState( FALLOFF_FORWARD_DEATH, 0, FALSE); break; case ADULTMONSTER_DYING: - ChangeSoldierState( pSoldier, ADULTMONSTER_DYING_STOP, 0, FALSE); + pSoldier->ChangeSoldierState( ADULTMONSTER_DYING_STOP, 0, FALSE); break; case LARVAE_DIE: - ChangeSoldierState( pSoldier, LARVAE_DIE_STOP, 0, FALSE); + pSoldier->ChangeSoldierState( LARVAE_DIE_STOP, 0, FALSE); break; case QUEEN_DIE: - ChangeSoldierState( pSoldier, QUEEN_DIE_STOP, 0, FALSE); + pSoldier->ChangeSoldierState( QUEEN_DIE_STOP, 0, FALSE); break; case INFANT_DIE: - ChangeSoldierState( pSoldier, INFANT_DIE_STOP, 0, FALSE); + pSoldier->ChangeSoldierState( INFANT_DIE_STOP, 0, FALSE); break; case CRIPPLE_DIE: - ChangeSoldierState( pSoldier, CRIPPLE_DIE_STOP, 0, FALSE); + pSoldier->ChangeSoldierState( CRIPPLE_DIE_STOP, 0, FALSE); break; case ROBOTNW_DIE: - ChangeSoldierState( pSoldier, ROBOTNW_DIE_STOP, 0, FALSE); + pSoldier->ChangeSoldierState( ROBOTNW_DIE_STOP, 0, FALSE); break; case CRIPPLE_DIE_FLYBACK: - ChangeSoldierState( pSoldier, CRIPPLE_DIE_FLYBACK_STOP, 0, FALSE); + pSoldier->ChangeSoldierState( CRIPPLE_DIE_FLYBACK_STOP, 0, FALSE); break; default: @@ -1952,8 +1955,8 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) gfPotentialTeamChangeDuringDeath = FALSE; // FREEUP GETTING HIT FLAG - pSoldier->fGettingHit = FALSE; - } + pSoldier->flags.fGettingHit = FALSE; + } HandleCheckForDeathCommonCode( pSoldier ); @@ -1967,7 +1970,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // If we have a pending animation, play it, else continue if ( pSoldier->usPendingAnimation != NO_PENDING_ANIMATION ) { - ChangeSoldierState( pSoldier, pSoldier->usPendingAnimation, 0, FALSE ); + pSoldier->ChangeSoldierState( pSoldier->usPendingAnimation, 0, FALSE ); pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; return( TRUE ); } @@ -1976,23 +1979,23 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // JUMP TO NEXT STATIONARY ANIMATION ACCORDING TO HEIGHT case 499: - if (!(pSoldier->uiStatusFlags & SOLDIER_PC)) + if (!(pSoldier->flags.uiStatusFlags & SOLDIER_PC)) { - if ( pSoldier->bAction == AI_ACTION_PULL_TRIGGER ) + if ( pSoldier->aiData.bAction == AI_ACTION_PULL_TRIGGER ) { if ( pSoldier->usAnimState == AI_PULL_SWITCH && gTacticalStatus.ubAttackBusyCount == 0 && gubElementsOnExplosionQueue == 0 ) { FreeUpNPCFromPendingAction( pSoldier ); } } - else if ( pSoldier->bAction == AI_ACTION_PENDING_ACTION - || pSoldier->bAction == AI_ACTION_OPEN_OR_CLOSE_DOOR - || pSoldier->bAction == AI_ACTION_YELLOW_ALERT - || pSoldier->bAction == AI_ACTION_RED_ALERT - || pSoldier->bAction == AI_ACTION_PULL_TRIGGER - || pSoldier->bAction == AI_ACTION_CREATURE_CALL - || pSoldier->bAction == AI_ACTION_UNLOCK_DOOR - || pSoldier->bAction == AI_ACTION_LOCK_DOOR ) + else if ( pSoldier->aiData.bAction == AI_ACTION_PENDING_ACTION + || pSoldier->aiData.bAction == AI_ACTION_OPEN_OR_CLOSE_DOOR + || pSoldier->aiData.bAction == AI_ACTION_YELLOW_ALERT + || pSoldier->aiData.bAction == AI_ACTION_RED_ALERT + || pSoldier->aiData.bAction == AI_ACTION_PULL_TRIGGER + || pSoldier->aiData.bAction == AI_ACTION_CREATURE_CALL + || pSoldier->aiData.bAction == AI_ACTION_UNLOCK_DOOR + || pSoldier->aiData.bAction == AI_ACTION_LOCK_DOOR ) { if ( pSoldier->usAnimState == PICKUP_ITEM || pSoldier->usAnimState == ADJACENT_GET_ITEM || pSoldier->usAnimState == DROP_ITEM || pSoldier->usAnimState == END_OPEN_DOOR || pSoldier->usAnimState == END_OPEN_DOOR_CROUCHED || pSoldier->usAnimState == CLOSE_DOOR || pSoldier->usAnimState == MONSTER_UP || pSoldier->usAnimState == AI_RADIO || pSoldier->usAnimState == AI_CR_RADIO || pSoldier->usAnimState == END_OPENSTRUCT || pSoldier->usAnimState == END_OPENSTRUCT_CROUCHED || pSoldier->usAnimState == QUEEN_CALL ) { @@ -2005,16 +2008,16 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // Check if we are at the desired height if ( pSoldier->ubDesiredHeight == gAnimControl[ pSoldier->usAnimState ].ubEndHeight || pSoldier->ubDesiredHeight == NO_DESIRED_HEIGHT ) - { + { // Adjust movement mode...... - if ( pSoldier->bTeam == gbPlayerNum && !pSoldier->fContinueMoveAfterStanceChange ) + if ( pSoldier->bTeam == gbPlayerNum && !pSoldier->flags.fContinueMoveAfterStanceChange ) { - usUIMovementMode = GetMoveStateBasedOnStance( pSoldier, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ); + usUIMovementMode = pSoldier->GetMoveStateBasedOnStance( gAnimControl[ pSoldier->usAnimState ].ubEndHeight ); // ATE: if we are currently running but have been told to walk, don't! if ( pSoldier->usUIMovementMode == RUNNING && usUIMovementMode == WALKING ) { - // No! + // No! } else { @@ -2025,17 +2028,17 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) pSoldier->ubDesiredHeight = NO_DESIRED_HEIGHT; - // 0verhaul: This is moved to the animation state transition code to make sure it isn't sidestepped. - // if (pSoldier->fChangingStanceDueToSuppression) + // 0verhaul: This is moved to the animation state transition code to make sure it isn't sidestepped. + // if (pSoldier->flags.fChangingStanceDueToSuppression) // { - // pSoldier->fChangingStanceDueToSuppression = FALSE; + // pSoldier->flags.fChangingStanceDueToSuppression = FALSE; // DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - end of suppression stance change") ); // ReduceAttackBusyCount( pSoldier->ubSuppressorID, FALSE ); // } if ( pSoldier->usPendingAnimation == NO_PENDING_ANIMATION && - ( pSoldier->bTurningFromPronePosition != TURNING_FROM_PRONE_ENDING_UP_FROM_MOVE ) && - ( pSoldier->bTurningFromPronePosition != TURNING_FROM_PRONE_ON ) ) + ( pSoldier->flags.bTurningFromPronePosition != TURNING_FROM_PRONE_ENDING_UP_FROM_MOVE ) && + ( pSoldier->flags.bTurningFromPronePosition != TURNING_FROM_PRONE_ON ) ) { if ( gTacticalStatus.ubAttackBusyCount == 0 ) { @@ -2050,8 +2053,8 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) { if ( pSoldier->usPendingAnimation == NO_PENDING_ANIMATION && gTacticalStatus.ubAttackBusyCount == 0 && - pSoldier->bTurningFromPronePosition != TURNING_FROM_PRONE_ENDING_UP_FROM_MOVE && - pSoldier->bTurningFromPronePosition != TURNING_FROM_PRONE_ON ) + pSoldier->flags.bTurningFromPronePosition != TURNING_FROM_PRONE_ENDING_UP_FROM_MOVE && + pSoldier->flags.bTurningFromPronePosition != TURNING_FROM_PRONE_ON ) { HandleSight(pSoldier,SIGHT_LOOK | SIGHT_RADIO | SIGHT_INTERRUPT ); } @@ -2076,7 +2079,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // Have we finished opening doors? // 0verhaul: Added additional check: Are we told to stop at this point, maybe due to being interrupted? - if ( !pSoldier->fNoAPToFinishMove && + if ( !pSoldier->flags.fNoAPToFinishMove && (pSoldier->usAnimState == END_OPEN_DOOR || pSoldier->usAnimState == END_OPEN_DOOR_CROUCHED || pSoldier->usAnimState == CRIPPLE_CLOSE_DOOR || @@ -2090,14 +2093,14 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) pSoldier->bEndDoorOpenCode = 2; // yes.. - EVENT_GetNewSoldierPath( pSoldier, pSoldier->sFinalDestination, pSoldier->usUIMovementMode ); + pSoldier->EVENT_GetNewSoldierPath( pSoldier->pathing.sFinalDestination, pSoldier->usUIMovementMode ); if ( !( gAnimControl[ pSoldier->usAnimState ].uiFlags & ( ANIM_MOVING ) ) ) { if ( pSoldier->sAbsoluteFinalDestination != NOWHERE ) { CancelAIAction( pSoldier, FORCE ); - } + } } // OK, this code, pSoldier->bEndDoorOpenCode will be set to 0 if anythiing @@ -2113,54 +2116,54 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) UINT16 usPendingAnimation = pSoldier->usPendingAnimation; pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; - ChangeSoldierState( pSoldier, usPendingAnimation, 0, FALSE ); + pSoldier->ChangeSoldierState( usPendingAnimation, 0, FALSE ); return( TRUE ); } // Alrighty, do we wish to continue - if ( pSoldier->fContinueMoveAfterStanceChange ) + if ( pSoldier->flags.fContinueMoveAfterStanceChange ) { // OK, if the code is == 2, get the path and try to move.... - if ( pSoldier->fContinueMoveAfterStanceChange == 2 ) + if ( pSoldier->flags.fContinueMoveAfterStanceChange == 2 ) { - pSoldier->usPathIndex++; + pSoldier->pathing.usPathIndex++; - if ( pSoldier->usPathIndex > pSoldier->usPathDataSize ) + if ( pSoldier->pathing.usPathIndex > pSoldier->pathing.usPathDataSize ) { - pSoldier->usPathIndex = pSoldier->usPathDataSize; + pSoldier->pathing.usPathIndex = pSoldier->pathing.usPathDataSize; } - if ( pSoldier->usPathIndex == pSoldier->usPathDataSize ) + if ( pSoldier->pathing.usPathIndex == pSoldier->pathing.usPathDataSize ) { // Stop, don't do anything..... - // 0verhaul: Only if not at the final destination - // Another reason for rebuilding the animation system. This should be part of a common + // 0verhaul: Only if not at the final destination + // Another reason for rebuilding the animation system. This should be part of a common // path continuation code so that any other bug fixes won't need to be duplicated in other areas. - if ( pSoldier->sGridNo != pSoldier->sFinalDestination) + if ( pSoldier->sGridNo != pSoldier->pathing.sFinalDestination) { - if ( !EVENT_InternalGetNewSoldierPath( pSoldier, pSoldier->sFinalDestination, pSoldier->usUIMovementMode, 2, FALSE ) ) + if ( !pSoldier->EVENT_InternalGetNewSoldierPath( pSoldier->pathing.sFinalDestination, pSoldier->usUIMovementMode, 2, FALSE ) ) { } } } else { - EVENT_InitNewSoldierAnim( pSoldier, pSoldier->usUIMovementMode, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( pSoldier->usUIMovementMode, 0 , FALSE ); // UNSET LOCK PENDING ACTION COUNTER FLAG - pSoldier->uiStatusFlags &= ( ~SOLDIER_LOCKPENDINGACTIONCOUNTER ); + pSoldier->flags.uiStatusFlags &= ( ~SOLDIER_LOCKPENDINGACTIONCOUNTER ); - } + } } else { SelectMoveAnimationFromStance( pSoldier ); } - pSoldier->fContinueMoveAfterStanceChange = FALSE; + pSoldier->flags.fContinueMoveAfterStanceChange = FALSE; return( TRUE ); } - SoldierGotoStationaryStance( pSoldier ); + pSoldier->SoldierGotoStationaryStance( ); return( TRUE ); } else @@ -2171,25 +2174,25 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) if ( ubDesiredHeight == ANIM_STAND && ubCurrentHeight == ANIM_CROUCH ) { // Return here because if now, we will skipp a few frames - ChangeSoldierState( pSoldier, KNEEL_UP, 0 , FALSE ); + pSoldier->ChangeSoldierState( KNEEL_UP, 0 , FALSE ); return( TRUE ); } if ( ubDesiredHeight == ANIM_CROUCH && ubCurrentHeight == ANIM_STAND ) { // Return here because if now, we will skipp a few frames - ChangeSoldierState( pSoldier, KNEEL_DOWN, 0 , FALSE ); + pSoldier->ChangeSoldierState( KNEEL_DOWN, 0 , FALSE ); return( TRUE ); } else if ( ubDesiredHeight == ANIM_PRONE && ubCurrentHeight == ANIM_CROUCH ) { // Return here because if now, we will skipp a few frames - ChangeSoldierState( pSoldier, PRONE_DOWN, 0 , FALSE ); + pSoldier->ChangeSoldierState( PRONE_DOWN, 0 , FALSE ); return( TRUE ); } else if ( ubDesiredHeight == ANIM_CROUCH && ubCurrentHeight == ANIM_PRONE ) { // Return here because if now, we will skipp a few frames - ChangeSoldierState( pSoldier, PRONE_UP, 0 , FALSE ); + pSoldier->ChangeSoldierState( PRONE_UP, 0 , FALSE ); return( TRUE ); } } @@ -2198,7 +2201,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) ScreenMsg( FONT_ORANGE, MSG_BETAVERSION, L"Soldier Ani: GOTO Stance not chained properly: %d %d %d", ubDesiredHeight, ubCurrentHeight, pSoldier->usAnimState ); #endif - SoldierGotoStationaryStance( pSoldier ); + pSoldier->SoldierGotoStationaryStance( ); return( TRUE ); } @@ -2208,26 +2211,26 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) } else if ( sNewAniFrame > 499 && sNewAniFrame < 599 ) { - // Jump, + // Jump, // Do not adjust, just try again - pSoldier->usAniCode = sNewAniFrame - 501; + pSoldier->usAniCode = sNewAniFrame - 501; } else if ( sNewAniFrame > 599 && sNewAniFrame <= 699 ) { // Jump, to animation script - EVENT_InitNewSoldierAnim( pSoldier, (UINT16)(sNewAniFrame - 600 ), 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( (UINT16)(sNewAniFrame - 600 ), 0 , FALSE ); return( TRUE ); } else if ( sNewAniFrame > 799 && sNewAniFrame <= 899 ) { // Jump, to animation script ( But in the 100's range ) - EVENT_InitNewSoldierAnim( pSoldier, (UINT16)(sNewAniFrame - 700 ), 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( (UINT16)(sNewAniFrame - 700 ), 0 , FALSE ); return( TRUE ); } else if ( sNewAniFrame > 899 && sNewAniFrame <= 999 ) { // Jump, to animation script ( But in the 200's range ) - EVENT_InitNewSoldierAnim( pSoldier, (UINT16)(sNewAniFrame - 700 ), 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( (UINT16)(sNewAniFrame - 700 ), 0 , FALSE ); return( TRUE ); } else if ( sNewAniFrame > 699 && sNewAniFrame < 799 ) @@ -2236,7 +2239,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) { case 702: // Play fall to knees sound - PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( FALL_1 + Random(2) ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), FALSE ); + PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( FALL_1 + Random(2) ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), FALSE ); break; case 703: @@ -2248,17 +2251,17 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 705: // PLay body splat sound - PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)BODY_SPLAT_1, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)BODY_SPLAT_1, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 706: // PLay head splat - PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)HEADSPLAT_1, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) , TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)HEADSPLAT_1, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) , TRUE ); break; case 707: // PLay creature battle cry - PlayJA2StreamingSample( (UINT8)CREATURE_BATTLECRY_1, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2StreamingSample( (UINT8)CREATURE_BATTLECRY_1, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); break; case 708: @@ -2271,13 +2274,13 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) usItem = pSoldier->inv[ HANDPOS ].usItem; - if ( usItem != NOTHING ) + if ( pSoldier->inv[ HANDPOS ].exists() == true ) { usSoundID = Weapon[ usItem ].sLocknLoadSound; if ( usSoundID != 0 ) { - PlayJA2Sample( usSoundID, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( usSoundID, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } } } @@ -2286,44 +2289,44 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 709: // Knife throw sound... - PlayJA2Sample( Weapon[ THROWING_KNIFE ].sSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( Weapon[ THROWING_KNIFE ].sSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); break; - case 710: + case 710: // Monster footstep in if ( SoldierOnScreen( pSoldier->ubID ) ) { - PlaySoldierJA2Sample( pSoldier->ubID, ACR_STEP_1, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, ACR_STEP_1, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); } break; - case 711: + case 711: // Monster footstep in if ( SoldierOnScreen( pSoldier->ubID ) ) { - PlaySoldierJA2Sample( pSoldier->ubID, ACR_STEP_2, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, ACR_STEP_2, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); } break; - case 712: + case 712: // Monster footstep in if ( SoldierOnScreen( pSoldier->ubID ) ) { - PlaySoldierJA2Sample( pSoldier->ubID, LCR_MOVEMENT, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, LCR_MOVEMENT, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); } break; - case 713: + case 713: // Monster footstep in if ( pSoldier->ubBodyType == INFANT_MONSTER ) { if ( SoldierOnScreen( pSoldier->ubID ) ) { - PlaySoldierJA2Sample( pSoldier->ubID, BCR_DRAGGING, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, BCR_DRAGGING, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); } } break; @@ -2331,19 +2334,19 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 714: // Lunges.... - PlaySoldierJA2Sample( pSoldier->ubID, ACR_LUNGE, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, ACR_LUNGE, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 715: // Swipe - PlaySoldierJA2Sample( pSoldier->ubID, ACR_SWIPE, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, ACR_SWIPE, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 716: // Eat flesh - PlaySoldierJA2Sample( pSoldier->ubID, ACR_EATFLESH, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, ACR_EATFLESH, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 717: @@ -2355,7 +2358,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) //if ( SoldierOnScreen( pSoldier->ubID ) ) { - switch( pSoldier->usActionData ) + switch( pSoldier->aiData.usActionData ) { case CALL_1_PREY: @@ -2412,7 +2415,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) if ( fDoCry ) { - PlayJA2Sample( iSoundID, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( iSoundID, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } } } @@ -2421,24 +2424,24 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 718: - PlaySoldierJA2Sample( pSoldier->ubID, LQ_RUPTURING, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, LQ_RUPTURING, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 719: - // Spit attack start sound... - PlaySoldierJA2Sample( pSoldier->ubID, LQ_ENRAGED_ATTACK, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + // Spit attack start sound... + PlaySoldierJA2Sample( pSoldier->ubID, LQ_ENRAGED_ATTACK, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 720: - // Spit attack start sound... - PlaySoldierJA2Sample( pSoldier->ubID, LQ_WHIP_ATTACK, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + // Spit attack start sound... + PlaySoldierJA2Sample( pSoldier->ubID, LQ_WHIP_ATTACK, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 721: // Play fall from knees to ground... - PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( FALL_TO_GROUND_1 + Random(3) ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), FALSE ); + PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( FALL_TO_GROUND_1 + Random(3) ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), FALSE ); if ( pSoldier->usAnimState == FALLFORWARD_FROMHIT_STAND ) { CheckEquipmentForFragileItemDamage( pSoldier, 20 ); @@ -2447,7 +2450,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 722: // Play fall heavy - PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( HEAVY_FALL_1 ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), FALSE ); + PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( HEAVY_FALL_1 ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), FALSE ); if ( pSoldier->usAnimState == FALLFORWARD_FROMHIT_CROUCH ) { CheckEquipmentForFragileItemDamage( pSoldier, 15 ); @@ -2457,79 +2460,79 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 723: // Play armpit noise... - PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( IDLE_ARMPIT ), RATE_11025, SoundVolume( LOWVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( IDLE_ARMPIT ), RATE_11025, SoundVolume( LOWVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 724: // Play ass scratch - // PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( IDLE_SCRATCH ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + // PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( IDLE_SCRATCH ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 725: // Play back crack - PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( IDLE_BACKCRACK ), RATE_11025, SoundVolume( LOWVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( IDLE_BACKCRACK ), RATE_11025, SoundVolume( LOWVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 726: // Kickin door - PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( KICKIN_DOOR ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( KICKIN_DOOR ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 727: // Swoosh - PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( SWOOSH_1 + Random( 6 ) ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( SWOOSH_1 + Random( 6 ) ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 728: // Creature fall - PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( ACR_FALL_1 ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( ACR_FALL_1 ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 729: // grab roof.... - PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( GRAB_ROOF ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( GRAB_ROOF ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 730: // end climb roof.... - PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( LAND_ON_ROOF ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( LAND_ON_ROOF ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 731: // Stop climb roof.. - PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( FALL_TO_GROUND_1 + Random(3) ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, (UINT8)( FALL_TO_GROUND_1 + Random(3) ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 732: // Play die sound - DoMercBattleSound( pSoldier, BATTLE_SOUND_DIE1 ); - pSoldier->fDeadSoundPlayed = TRUE; + pSoldier->DoMercBattleSound( BATTLE_SOUND_DIE1 ); + pSoldier->flags.fDeadSoundPlayed = TRUE; break; case 750: // CODE: Move Vehicle UP - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { - // SetSoldierHeight( pSoldier, (FLOAT)( pSoldier->sHeightAdjustment + 1 ) ); + // pSoldier->SetSoldierHeight( (FLOAT)( pSoldier->sHeightAdjustment + 1 ) ); } break; case 751: // CODE: Move vehicle down - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { - // SetSoldierHeight( pSoldier, (FLOAT)( pSoldier->sHeightAdjustment - 1 ) ); + // pSoldier->SetSoldierHeight( (FLOAT)( pSoldier->sHeightAdjustment - 1 ) ); } break; @@ -2574,23 +2577,22 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) SOLDIERTYPE *pRobot; // Get pointer... - ubPerson = WhoIsThere2( pSoldier->sPendingActionData2, pSoldier->bLevel ); + ubPerson = WhoIsThere2( pSoldier->aiData.sPendingActionData2, pSoldier->pathing.bLevel ); - if ( ubPerson != NOBODY && MercPtrs[ ubPerson ]->uiStatusFlags & SOLDIER_ROBOT ) + if ( ubPerson != NOBODY && MercPtrs[ ubPerson ]->flags.uiStatusFlags & SOLDIER_ROBOT ) { pRobot = MercPtrs[ ubPerson ]; ReloadGun( pRobot, &(pRobot->inv[ HANDPOS ] ), pSoldier->pTempObject ); // OK, check what was returned and place in inventory if it's non-zero - if ( pSoldier->pTempObject->usItem != NOTHING ) + if ( pSoldier->pTempObject->exists() == true ) { // Add to inv.. AutoPlaceObject( pSoldier, pSoldier->pTempObject, TRUE ); } - MemFree( pSoldier->pTempObject ); - pSoldier->pTempObject = NULL; + OBJECTTYPE::DeleteMe( &pSoldier->pTempObject ); } } break; @@ -2619,10 +2621,10 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) if ( pTarget ) { - EVENT_InitNewSoldierAnim( pTarget, SLAP_HIT, 0 , FALSE ); + pTarget->EVENT_InitNewSoldierAnim( SLAP_HIT, 0 , FALSE ); // Play noise.... - //PlaySoldierJA2Sample( pTarget->ubID, ( S_SLAP_IMPACT ), RATE_11025, SoundVolume( HIGHVOLUME, pTarget->sGridNo ), 1, SoundDir( pTarget->sGridNo ), TRUE ); + //PlaySoldierJA2Sample( pTarget->ubID, ( S_SLAP_IMPACT ), RATE_11025, SoundVolume( HIGHVOLUME, pTarget->sGridNo ), 1, SoundDir( pTarget->sGridNo ), TRUE ); //DoMercBattleSound( pTarget, (INT8)( BATTLE_SOUND_HIT1 + Random( 2 ) ) ); @@ -2643,7 +2645,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) { // Dish out damage! - EVENT_SoldierGotHit( MercPtrs[ pSoldier->uiPendingActionData4 ], TAKE_DAMAGE_BLADE, (INT16) 25, (INT16) 25, gOppositeDirection[ pSoldier->ubDirection ], 50, pSoldier->ubID, 0, ANIM_PRONE, 0, 0 ); + MercPtrs[ pSoldier->aiData.uiPendingActionData4 ]->EVENT_SoldierGotHit( TAKE_DAMAGE_BLADE, (INT16) 25, (INT16) 25, gOppositeDirection[ pSoldier->ubDirection ], 50, pSoldier->ubID, 0, ANIM_PRONE, 0, 0 ); } break; @@ -2656,7 +2658,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) SetOffPanicBombs( pSoldier->ubID, bPanicTrigger ); // any AI guy has been specially given keys for this, now take them // away - pSoldier->bHasKeys = pSoldier->bHasKeys >> 1; + pSoldier->flags.bHasKeys = pSoldier->flags.bHasKeys >> 1; } break; @@ -2668,20 +2670,19 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) { if ( pSoldier->bVisible != -1 ) { - PlayJA2Sample( THROW_IMPACT_2, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( THROW_IMPACT_2, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } - AddItemToPool( pSoldier->sPendingActionData2, pSoldier->pTempObject, 1, pSoldier->bLevel, 0 , -1 ); + AddItemToPool( pSoldier->aiData.sPendingActionData2, pSoldier->pTempObject, 1, pSoldier->pathing.bLevel, 0 , -1 ); NotifySoldiersToLookforItems( ); - MemFree( pSoldier->pTempObject ); - pSoldier->pTempObject = NULL; + OBJECTTYPE::DeleteMe( &pSoldier->pTempObject ); } break; case 764: - PlaySoldierJA2Sample( pSoldier->ubID, PICKING_LOCK, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, PICKING_LOCK, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 765: @@ -2691,12 +2692,12 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) { INT16 sNewGridNo; - InternalDropBlood( pSoldier->sGridNo, pSoldier->bLevel, 0, (UINT8)(MAXBLOODQUANTITY), 1 ); + InternalDropBlood( pSoldier->sGridNo, pSoldier->pathing.bLevel, 0, (UINT8)(MAXBLOODQUANTITY), 1 ); // Move forward one gridno.... - sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)( DirectionInc( gOppositeDirection[ pSoldier->ubDirection ] ) ) ); + sNewGridNo = NewGridNo( (INT16)pSoldier->sGridNo, (UINT16)( DirectionInc( gOppositeDirection[ pSoldier->ubDirection ] ) ) ); - InternalDropBlood( sNewGridNo, pSoldier->bLevel, 0, (UINT8)(MAXBLOODQUANTITY), 1 ); + InternalDropBlood( sNewGridNo, pSoldier->pathing.bLevel, 0, (UINT8)(MAXBLOODQUANTITY), 1 ); } break; @@ -2704,13 +2705,13 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 766: // Say COOL quote - DoMercBattleSound( pSoldier, BATTLE_SOUND_COOL1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_COOL1 ); break; case 767: // Slap sound effect - PlaySoldierJA2Sample( pSoldier->ubID, SLAP_2, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), FALSE ); + PlaySoldierJA2Sample( pSoldier->ubID, SLAP_2, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), FALSE ); break; case 768: @@ -2719,7 +2720,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) if ( NumCapableEnemyInSector( ) == 0 ) { // Stand up... - ChangeSoldierStance( pSoldier, ANIM_STAND ); + pSoldier->ChangeSoldierStance( ANIM_STAND ); return( FALSE ); } break; @@ -2734,7 +2735,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) SOLDIERTYPE *pVehicle; // Get pointer to vehicle... - ubPerson = WhoIsThere2( pSoldier->sPendingActionData2, pSoldier->bLevel ); + ubPerson = WhoIsThere2( pSoldier->aiData.sPendingActionData2, pSoldier->pathing.bLevel ); pVehicle = MercPtrs[ ubPerson ]; // this is a ubID for soldiertype.... @@ -2757,7 +2758,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case 772: //CODE: FOR A REALTIME NON-INTERRUPTABLE SCRIPT - SIGNAL DONE - pSoldier->fRTInNonintAnim = FALSE; + pSoldier->flags.fRTInNonintAnim = FALSE; break; case 773: @@ -2765,7 +2766,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // Kneel up... if ( !pSoldier->bStealthMode ) { - PlaySoldierJA2Sample( pSoldier->ubID, KNEEL_UP_SOUND, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, KNEEL_UP_SOUND, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); } break; @@ -2774,7 +2775,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // Kneel down.. if ( !pSoldier->bStealthMode ) { - PlaySoldierJA2Sample( pSoldier->ubID, KNEEL_DOWN_SOUND, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, KNEEL_DOWN_SOUND, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); } break; @@ -2783,7 +2784,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // prone up.. if ( !pSoldier->bStealthMode ) { - PlaySoldierJA2Sample( pSoldier->ubID, PRONE_UP_SOUND, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, PRONE_UP_SOUND, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); } break; @@ -2792,7 +2793,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // prone down.. if ( !pSoldier->bStealthMode ) { - PlaySoldierJA2Sample( pSoldier->ubID, PRONE_DOWN_SOUND, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, PRONE_DOWN_SOUND, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); } break; @@ -2801,78 +2802,78 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // picking something up if ( !pSoldier->bStealthMode ) { - PlaySoldierJA2Sample( pSoldier->ubID, PICKING_SOMETHING_UP, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, PICKING_SOMETHING_UP, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); } break; case 778: if ( !pSoldier->bStealthMode ) { - PlaySoldierJA2Sample( pSoldier->ubID, ENTER_DEEP_WATER_1, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, ENTER_DEEP_WATER_1, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); } break; case 779: - PlaySoldierJA2Sample( pSoldier->ubID, COW_FALL, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, COW_FALL, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 780: - PlaySoldierJA2Sample( pSoldier->ubID, COW_HIT_SND, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, COW_HIT_SND, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 781: - PlaySoldierJA2Sample( pSoldier->ubID, ACR_DIE_PART2, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), FALSE ); + PlaySoldierJA2Sample( pSoldier->ubID, ACR_DIE_PART2, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), FALSE ); break; case 782: - PlaySoldierJA2Sample( pSoldier->ubID, CREATURE_DISSOLVE_1, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), FALSE ); + PlaySoldierJA2Sample( pSoldier->ubID, CREATURE_DISSOLVE_1, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), FALSE ); break; case 784: - PlaySoldierJA2Sample( pSoldier->ubID, CREATURE_FALL, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), FALSE ); + PlaySoldierJA2Sample( pSoldier->ubID, CREATURE_FALL, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), FALSE ); break; case 785: if ( Random( 5 ) == 0 ) { - PlaySoldierJA2Sample( pSoldier->ubID, CROW_PECKING_AT_FLESH, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, CROW_PECKING_AT_FLESH, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); } break; case 786: - PlaySoldierJA2Sample( pSoldier->ubID, CROW_FLYING_AWAY, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, CROW_FLYING_AWAY, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 787: - PlaySoldierJA2Sample( pSoldier->ubID, SLAP_1, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), FALSE ); + PlaySoldierJA2Sample( pSoldier->ubID, SLAP_1, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), FALSE ); break; case 788: - PlaySoldierJA2Sample( pSoldier->ubID, MORTAR_START, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, MORTAR_START, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 789: - PlaySoldierJA2Sample( pSoldier->ubID, MORTAR_LOAD, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, MORTAR_LOAD, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 790: - PlaySoldierJA2Sample( pSoldier->ubID, COW_FALL_2, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, COW_FALL_2, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; case 791: - PlaySoldierJA2Sample( pSoldier->ubID, FENCE_OPEN, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, FENCE_OPEN, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); break; } @@ -2883,7 +2884,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) { // Go to start, by default - pSoldier->usAniCode = 0; + pSoldier->usAniCode = 0; } @@ -2901,9 +2902,9 @@ BOOLEAN ShouldMercSayHappyWithGunQuote( SOLDIERTYPE *pSoldier ) // How do we do this.... if ( QuoteExp_GotGunOrUsedGun[ pSoldier->ubProfile ] == QUOTE_SATISFACTION_WITH_GUN_AFTER_KILL ) - { + { // For one, only once a day... - if ( pSoldier->usQuoteSaidFlags & SOLDIER_QUOTE_SAID_LIKESGUN ) + if ( pSoldier->usQuoteSaidFlags & SOLDIER_QUOTE_SAID_LIKESGUN ) { return( FALSE ); } @@ -2931,24 +2932,23 @@ void SayBuddyWitnessedQuoteFromKill( SOLDIERTYPE *pKillerSoldier, INT16 sGridNo, { UINT8 ubMercsInSector[ 20 ] = { 0 }; INT8 bBuddyIndex[ 20 ] = { -1 }; - INT8 bTempBuddyIndex; + INT8 bTempBuddyIndex; UINT8 ubNumMercs = 0; UINT8 ubChosenMerc; SOLDIERTYPE *pTeamSoldier; INT32 cnt; - INT16 sDistVisible = FALSE; - UINT16 usQuoteNum; + UINT16 usQuoteNum; // Loop through all our guys and randomly say one from someone in our sector // set up soldier ptr as first element in mercptrs list - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) { // Add guy if he's a candidate... - if ( OK_INSECTOR_MERC( pTeamSoldier ) && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->fMercAsleep && pTeamSoldier->sGridNo != NOWHERE ) + if ( OK_INSECTOR_MERC( pTeamSoldier ) && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->flags.fMercAsleep && pTeamSoldier->sGridNo != NOWHERE ) { // Are we a buddy of killer? bTempBuddyIndex = WhichBuddy( pTeamSoldier->ubProfile, pKillerSoldier->ubProfile ); @@ -2981,7 +2981,7 @@ void SayBuddyWitnessedQuoteFromKill( SOLDIERTYPE *pKillerSoldier, INT16 sGridNo, // TO LOS check to killed // Can we see location of killer? - if ( SoldierTo3DLocationLineOfSightTest( pTeamSoldier, pKillerSoldier->sGridNo, pKillerSoldier->bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) == 0 ) + if ( SoldierTo3DLocationLineOfSightTest( pTeamSoldier, pKillerSoldier->sGridNo, pKillerSoldier->pathing.bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) == 0 ) { continue; } @@ -2995,7 +2995,7 @@ void SayBuddyWitnessedQuoteFromKill( SOLDIERTYPE *pKillerSoldier, INT16 sGridNo, // OK, a good candidate... ubMercsInSector[ ubNumMercs ] = (UINT8)cnt; - bBuddyIndex[ ubNumMercs ] = bTempBuddyIndex; + bBuddyIndex[ ubNumMercs ] = bTempBuddyIndex; ubNumMercs++; } } @@ -3033,7 +3033,7 @@ void SayBuddyWitnessedQuoteFromKill( SOLDIERTYPE *pKillerSoldier, INT16 sGridNo, void HandleKilledQuote( SOLDIERTYPE *pKilledSoldier, SOLDIERTYPE *pKillerSoldier, INT16 sGridNo, INT8 bLevel ) -{ +{ SOLDIERTYPE *pTeamSoldier; INT32 cnt; UINT8 ubMercsInSector[ 20 ] = { 0 }; @@ -3041,7 +3041,6 @@ void HandleKilledQuote( SOLDIERTYPE *pKilledSoldier, SOLDIERTYPE *pKillerSoldier UINT8 ubChosenMerc; BOOLEAN fDoSomeoneElse = FALSE; BOOLEAN fCanWeSeeLocation = FALSE; - INT16 sDistVisible = FALSE; gfLastMercTalkedAboutKillingID = pKilledSoldier->ubID; @@ -3055,7 +3054,7 @@ void HandleKilledQuote( SOLDIERTYPE *pKilledSoldier, SOLDIERTYPE *pKillerSoldier // Can we see? if ( fCanWeSeeLocation ) { - TacticalCharacterDialogue( pKillerSoldier, QUOTE_AIM_KILLED_MIKE ); + TacticalCharacterDialogue( pKillerSoldier, QUOTE_AIM_KILLED_MIKE ); } } // Are we killing factory mamager? @@ -3064,7 +3063,7 @@ void HandleKilledQuote( SOLDIERTYPE *pKilledSoldier, SOLDIERTYPE *pKillerSoldier // Can we see? //f ( fCanWeSeeLocation ) { - TacticalCharacterDialogue( pKillerSoldier, QUOTE_KILLED_FACTORY_MANAGER ); + TacticalCharacterDialogue( pKillerSoldier, QUOTE_KILLED_FACTORY_MANAGER ); } } else @@ -3073,7 +3072,7 @@ void HandleKilledQuote( SOLDIERTYPE *pKilledSoldier, SOLDIERTYPE *pKillerSoldier // If not head shot, just say killed quote - // If head shot... + // If head shot... // If we have a head shot saying,, randomly try that one @@ -3097,14 +3096,14 @@ void HandleKilledQuote( SOLDIERTYPE *pKilledSoldier, SOLDIERTYPE *pKillerSoldier if ( fDoSomeoneElse ) { // Check if a person is here that has this quote.... - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) { if ( cnt != pKillerSoldier->ubID ) { - if ( OK_INSECTOR_MERC( pTeamSoldier ) && !( pTeamSoldier->uiStatusFlags & SOLDIER_GASSED ) && !AM_AN_EPC( pTeamSoldier ) ) + if ( OK_INSECTOR_MERC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !AM_AN_EPC( pTeamSoldier ) ) { // Can we see location? if ( SoldierTo3DLocationLineOfSightTest( pTeamSoldier, sGridNo, bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) @@ -3158,9 +3157,9 @@ void HandleKilledQuote( SOLDIERTYPE *pKilledSoldier, SOLDIERTYPE *pKillerSoldier if (pKilledSoldier->bTeam != CIV_TEAM || pKilledSoldier->ubCivilianGroup != 0) { // Are we happy with our gun? - if ( ShouldMercSayHappyWithGunQuote( pKillerSoldier ) ) + if ( ShouldMercSayHappyWithGunQuote( pKillerSoldier ) ) { - TacticalCharacterDialogue( pKillerSoldier, QUOTE_SATISFACTION_WITH_GUN_AFTER_KILL ); + TacticalCharacterDialogue( pKillerSoldier, QUOTE_SATISFACTION_WITH_GUN_AFTER_KILL ); pKillerSoldier->usQuoteSaidFlags |= SOLDIER_QUOTE_SAID_LIKESGUN; } else @@ -3169,9 +3168,9 @@ void HandleKilledQuote( SOLDIERTYPE *pKilledSoldier, SOLDIERTYPE *pKillerSoldier if ( Random( 100 ) < 33 && pKilledSoldier->ubBodyType != BLOODCAT ) { // If it's a creature...... - if ( pKilledSoldier->uiStatusFlags & SOLDIER_MONSTER ) + if ( pKilledSoldier->flags.uiStatusFlags & SOLDIER_MONSTER ) { - TacticalCharacterDialogue( pKillerSoldier, QUOTE_KILLED_A_CREATURE ); + TacticalCharacterDialogue( pKillerSoldier, QUOTE_KILLED_A_CREATURE ); } else { @@ -3182,11 +3181,11 @@ void HandleKilledQuote( SOLDIERTYPE *pKilledSoldier, SOLDIERTYPE *pKillerSoldier { if ( Random( 50 ) == 25 ) { - DoMercBattleSound( pKillerSoldier, (INT8)( BATTLE_SOUND_LAUGH1 ) ); + pKillerSoldier->DoMercBattleSound( (INT8)( BATTLE_SOUND_LAUGH1 ) ); } else { - DoMercBattleSound( pKillerSoldier, (INT8)( BATTLE_SOUND_COOL1 ) ); + pKillerSoldier->DoMercBattleSound( (INT8)( BATTLE_SOUND_COOL1 ) ); } } } @@ -3208,11 +3207,11 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse ) *pfMadeCorpse = FALSE; - if ( pSoldier->bLife == 0 && !( pSoldier->uiStatusFlags & SOLDIER_DEAD ) ) + if ( pSoldier->stats.bLife == 0 && !( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) ) { // Cancel services here... - ReceivingSoldierCancelServices( pSoldier ); - GivingSoldierCancelServices( pSoldier ); + pSoldier->ReceivingSoldierCancelServices( ); + pSoldier->GivingSoldierCancelServices( ); if ( pSoldier->iMuzFlash != -1 ) { @@ -3225,7 +3224,7 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse ) } //FREEUP GETTING HIT FLAG - pSoldier->fGettingHit = FALSE; + pSoldier->flags.fGettingHit = FALSE; // Find next closest team member! if ( pSoldier->bTeam == gbPlayerNum ) @@ -3236,14 +3235,14 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse ) { fInterfacePanelDirty = DIRTYLEVEL2; } - pSoldier->fUIdeadMerc = TRUE; + pSoldier->flags.fUIdeadMerc = TRUE; if ( !gfKillingGuysForLosingBattle ) { // ATE: THIS IS S DUPLICATE SETTING OF SOLDIER_DEAD. Is set in StrategicHandlePlayerTeamMercDeath() // also, but here it's needed to tell tectical to ignore this dude... // until StrategicHandlePlayerTeamMercDeath() can get called after death skull interface is done - pSoldier->uiStatusFlags |= SOLDIER_DEAD; + pSoldier->flags.uiStatusFlags |= SOLDIER_DEAD; } } @@ -3259,7 +3258,7 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse ) gTacticalStatus.fKilledEnemyOnAttack = TRUE; gTacticalStatus.ubEnemyKilledOnAttack = pSoldier->ubID; gTacticalStatus.ubEnemyKilledOnAttackLocation = pSoldier->sGridNo; - gTacticalStatus.bEnemyKilledOnAttackLevel = pSoldier->bLevel; + gTacticalStatus.bEnemyKilledOnAttackLevel = pSoldier->pathing.bLevel; gTacticalStatus.ubEnemyKilledOnAttackKiller = pSoldier->ubAttackerID; // also check if we are in mapscreen, if so update soldier's list @@ -3273,7 +3272,7 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse ) // We were a visible enemy, say laugh! if ( Random(3) == 0 && !CREATURE_OR_BLOODCAT( MercPtrs[ pSoldier->ubAttackerID ] ) ) { - DoMercBattleSound( MercPtrs[ pSoldier->ubAttackerID ], BATTLE_SOUND_LAUGH1 ); + MercPtrs[ pSoldier->ubAttackerID ]->DoMercBattleSound( BATTLE_SOUND_LAUGH1 ); } } } @@ -3283,7 +3282,7 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse ) // if a friendly with a profile, increment kills // militia also now track kills... - if ( pSoldier->ubAttackerID != NOBODY ) + if ( pSoldier->ubAttackerID != NOBODY ) { if ( MercPtrs[ pSoldier->ubAttackerID ]->bTeam == gbPlayerNum ) { @@ -3312,7 +3311,7 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse ) if ( ubAssister != NOBODY && ubAssister != pSoldier->ubAttackerID ) { if ( MercPtrs[ ubAssister ]->bTeam == gbPlayerNum ) - { + { gMercProfiles[ MercPtrs[ ubAssister ]->ubProfile ].usAssists++; } else if ( MercPtrs[ ubAssister ]->bTeam == MILITIA_TEAM ) @@ -3327,7 +3326,7 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse ) if ( pSoldier->ubPreviousAttackerID != NOBODY && pSoldier->ubPreviousAttackerID != pSoldier->ubAttackerID ) { if ( MercPtrs[ pSoldier->ubPreviousAttackerID ]->bTeam == gbPlayerNum ) - { + { gMercProfiles[ MercPtrs[ pSoldier->ubPreviousAttackerID ]->ubProfile ].usAssists++; } else if ( MercPtrs[ pSoldier->ubPreviousAttackerID ]->bTeam == MILITIA_TEAM ) @@ -3353,8 +3352,8 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse ) // 0verhaul: This is now handled in the death state transitions // if ( pSoldier->bTeam != gbPlayerNum ) // { - // if ( !pSoldier->fDoingExternalDeath ) - // { + // if ( !pSoldier->flags.fDoingExternalDeath ) + // { // // Release attacker // DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Releasesoldierattacker, code 497 = handle soldier death") ); // ReleaseSoldiersAttacker( pSoldier ); @@ -3368,7 +3367,7 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse ) } - if ( pSoldier->bLife > 0 ) + if ( pSoldier->stats.bLife > 0 ) { // If we are here - something funny has heppende // We either have played a death animation when we are not dead, or we are calling @@ -3382,9 +3381,9 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse ) void HandlePlayerTeamMemberDeathAfterSkullAnimation( SOLDIERTYPE *pSoldier ) { - // 0verhaul: This is now handled in the death state transition. + // 0verhaul: This is now handled in the death state transition. // Release attacker - // if ( !pSoldier->fDoingExternalDeath ) + // if ( !pSoldier->flags.fDoingExternalDeath ) // { // DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Releasesoldierattacker, code 497 = handle soldier death") ); // ReleaseSoldiersAttacker( pSoldier ); @@ -3393,7 +3392,7 @@ void HandlePlayerTeamMemberDeathAfterSkullAnimation( SOLDIERTYPE *pSoldier ) HandlePlayerTeamMemberDeath( pSoldier ); // now remove character from a squad - RemoveCharacterFromSquads( pSoldier ); + RemoveCharacterFromSquads( pSoldier ); } BOOLEAN CheckForAndHandleSoldierDeath( SOLDIERTYPE *pSoldier, BOOLEAN *pfMadeCorpse ) @@ -3405,47 +3404,47 @@ BOOLEAN CheckForAndHandleSoldierDeath( SOLDIERTYPE *pSoldier, BOOLEAN *pfMadeCor switch( pSoldier->usAnimState ) { case FLYBACK_HIT_DEATH: - ChangeSoldierState( pSoldier, FLYBACK_HITDEATH_STOP, 0, FALSE ); + pSoldier->ChangeSoldierState( FLYBACK_HITDEATH_STOP, 0, FALSE ); break; case GENERIC_HIT_DEATH: - ChangeSoldierState( pSoldier, FALLFORWARD_HITDEATH_STOP, 0, FALSE ); + pSoldier->ChangeSoldierState( FALLFORWARD_HITDEATH_STOP, 0, FALSE ); break; case FALLBACK_HIT_DEATH: - ChangeSoldierState( pSoldier, FALLBACK_HITDEATH_STOP, 0, FALSE ); + pSoldier->ChangeSoldierState( FALLBACK_HITDEATH_STOP, 0, FALSE ); break; case PRONE_HIT_DEATH: - ChangeSoldierState( pSoldier, PRONE_HITDEATH_STOP, 0, FALSE ); + pSoldier->ChangeSoldierState( PRONE_HITDEATH_STOP, 0, FALSE ); break; case JFK_HITDEATH: - ChangeSoldierState( pSoldier, JFK_HITDEATH_STOP, 0, FALSE ); + pSoldier->ChangeSoldierState( JFK_HITDEATH_STOP, 0, FALSE ); break; case FALLOFF_DEATH: - ChangeSoldierState( pSoldier, FALLOFF_DEATH_STOP, 0, FALSE ); + pSoldier->ChangeSoldierState( FALLOFF_DEATH_STOP, 0, FALSE ); break; case FALLOFF_FORWARD_DEATH: - ChangeSoldierState( pSoldier, FALLOFF_FORWARD_DEATH_STOP, 0, FALSE ); + pSoldier->ChangeSoldierState( FALLOFF_FORWARD_DEATH_STOP, 0, FALSE ); break; case WATER_DIE: - ChangeSoldierState( pSoldier, WATER_DIE_STOP, 0, FALSE ); + pSoldier->ChangeSoldierState( WATER_DIE_STOP, 0, FALSE ); break; case DEEP_WATER_DIE: - ChangeSoldierState( pSoldier, DEEP_WATER_DIE_STOPPING, 0, FALSE ); + pSoldier->ChangeSoldierState( DEEP_WATER_DIE_STOPPING, 0, FALSE ); break; case COW_DYING: - ChangeSoldierState( pSoldier, COW_DYING_STOP, 0, FALSE); + pSoldier->ChangeSoldierState( COW_DYING_STOP, 0, FALSE); break; case BLOODCAT_DYING: - ChangeSoldierState( pSoldier, BLOODCAT_DYING_STOP, 0, FALSE); + pSoldier->ChangeSoldierState( BLOODCAT_DYING_STOP, 0, FALSE); break; default: @@ -3468,11 +3467,11 @@ void CheckForAndHandleSoldierIncompacitated( SOLDIERTYPE *pSoldier ) { INT16 sNewGridNo; - if ( pSoldier->bLife < OKLIFE ) + if ( pSoldier->stats.bLife < OKLIFE ) { // Cancel services here... - ReceivingSoldierCancelServices( pSoldier ); - GivingSoldierCancelServices( pSoldier ); + pSoldier->ReceivingSoldierCancelServices( ); + pSoldier->GivingSoldierCancelServices( ); // If we are a monster, set life to zero ( no unconscious ) @@ -3490,7 +3489,7 @@ void CheckForAndHandleSoldierIncompacitated( SOLDIERTYPE *pSoldier ) case TANK_NW: case TANK_NE: - pSoldier->bLife = 0; + pSoldier->stats.bLife = 0; break; } @@ -3508,25 +3507,25 @@ void CheckForAndHandleSoldierIncompacitated( SOLDIERTYPE *pSoldier ) } // We are unconscious now, play randomly, this animation continued, or a new death - if ( CheckSoldierHitRoof( pSoldier ) ) + if ( pSoldier->CheckSoldierHitRoof( ) ) { return; } // If guy is now dead, play sound! - if ( pSoldier->bLife == 0 ) + if ( pSoldier->stats.bLife == 0 ) { if ( !AreInMeanwhile() ) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_DIE1 ); - pSoldier->fDeadSoundPlayed = TRUE; + pSoldier->DoMercBattleSound( BATTLE_SOUND_DIE1 ); + pSoldier->flags.fDeadSoundPlayed = TRUE; } } // Randomly fall back or forward, if we are in the standing hit animation if ( pSoldier->usAnimState == GENERIC_HIT_STAND || pSoldier->usAnimState == STANDING_BURST_HIT || pSoldier->usAnimState == RIFLE_STAND_HIT ) { - INT8 bTestDirection = pSoldier->ubDirection; + INT8 bTestDirection = pSoldier->ubDirection; BOOLEAN fForceDirection = FALSE; BOOLEAN fDoFallback = FALSE; @@ -3544,15 +3543,15 @@ void CheckForAndHandleSoldierIncompacitated( SOLDIERTYPE *pSoldier ) { // CHECK IF WE HAVE AN ATTACKER, TAKE OPPOSITE DIRECTION! if ( pSoldier->ubAttackerID != NOBODY ) - { + { // Find direction! bTestDirection = (INT8)GetDirectionFromGridNo( MercPtrs[ pSoldier->ubAttackerID ]->sGridNo, pSoldier ); fForceDirection = TRUE; } - sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( gOppositeDirection[ bTestDirection ] ) ); + sNewGridNo = NewGridNo( (INT16)pSoldier->sGridNo, DirectionInc( gOppositeDirection[ bTestDirection ] ) ); - if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->bLevel, bTestDirection, FLYBACK_HIT ) ) + if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->pathing.bLevel, bTestDirection, FLYBACK_HIT ) ) { // CHECKED BEHIND GRIDS - OK fDoFallback = TRUE; @@ -3572,8 +3571,8 @@ void CheckForAndHandleSoldierIncompacitated( SOLDIERTYPE *pSoldier ) { // 1 ) REC DIRECTION // 2 ) SET FLAG FOR STARTING TO FALL - BeginTyingToFall( pSoldier ); - ChangeSoldierState( pSoldier, FALLFORWARD_FROMHIT_STAND, 0, FALSE ); + pSoldier->BeginTyingToFall( ); + pSoldier->ChangeSoldierState( FALLFORWARD_FROMHIT_STAND, 0, FALSE ); return; } else @@ -3581,78 +3580,78 @@ void CheckForAndHandleSoldierIncompacitated( SOLDIERTYPE *pSoldier ) // ALL'S OK HERE..... IF WE FORCED DIRECTION, SET! if ( fForceDirection ) { - EVENT_SetSoldierDesiredDirection( pSoldier, bTestDirection ); - EVENT_SetSoldierDirection( pSoldier, bTestDirection ); + pSoldier->EVENT_SetSoldierDesiredDirection( bTestDirection ); + pSoldier->EVENT_SetSoldierDirection( bTestDirection ); } - ChangeToFallbackAnimation( pSoldier, pSoldier->ubDirection ); + pSoldier->ChangeToFallbackAnimation( pSoldier->ubDirection ); return; } } else if ( pSoldier->usAnimState == GENERIC_HIT_CROUCH || pSoldier->usAnimState == CIV_COWER_HIT) { - ChangeSoldierState( pSoldier, FALLFORWARD_FROMHIT_CROUCH, 0 , FALSE); - BeginTyingToFall( pSoldier ); - return; + pSoldier->ChangeSoldierState( FALLFORWARD_FROMHIT_CROUCH, 0 , FALSE); + pSoldier->BeginTyingToFall( ); + return; } else if ( pSoldier->usAnimState == GENERIC_HIT_PRONE ) { - ChangeSoldierState( pSoldier, PRONE_LAY_FROMHIT, 0 , FALSE ); - return; + pSoldier->ChangeSoldierState( PRONE_LAY_FROMHIT, 0 , FALSE ); + return; } else if ( pSoldier->usAnimState == ADULTMONSTER_HIT ) { - ChangeSoldierState( pSoldier, ADULTMONSTER_DYING, 0 , FALSE ); - return; + pSoldier->ChangeSoldierState( ADULTMONSTER_DYING, 0 , FALSE ); + return; } else if ( pSoldier->usAnimState == LARVAE_HIT ) { - ChangeSoldierState( pSoldier, LARVAE_DIE, 0 , FALSE ); - return; + pSoldier->ChangeSoldierState( LARVAE_DIE, 0 , FALSE ); + return; } else if ( pSoldier->usAnimState == QUEEN_HIT ) { - ChangeSoldierState( pSoldier, QUEEN_DIE, 0 , FALSE ); - return; + pSoldier->ChangeSoldierState( QUEEN_DIE, 0 , FALSE ); + return; } else if ( pSoldier->usAnimState == CRIPPLE_HIT ) { - ChangeSoldierState( pSoldier, CRIPPLE_DIE, 0 , FALSE ); - return; + pSoldier->ChangeSoldierState( CRIPPLE_DIE, 0 , FALSE ); + return; } else if ( pSoldier->usAnimState == ROBOTNW_HIT ) { - ChangeSoldierState( pSoldier, ROBOTNW_DIE, 0 , FALSE ); - return; + pSoldier->ChangeSoldierState( ROBOTNW_DIE, 0 , FALSE ); + return; } else if ( pSoldier->usAnimState == INFANT_HIT ) { - ChangeSoldierState( pSoldier, INFANT_DIE, 0 , FALSE ); - return; + pSoldier->ChangeSoldierState( INFANT_DIE, 0 , FALSE ); + return; } else if ( pSoldier->usAnimState == COW_HIT ) { - ChangeSoldierState( pSoldier, COW_DYING, 0 , FALSE ); - return; + pSoldier->ChangeSoldierState( COW_DYING, 0 , FALSE ); + return; } else if ( pSoldier->usAnimState == BLOODCAT_HIT ) { - ChangeSoldierState( pSoldier, BLOODCAT_DYING, 0 , FALSE ); - return; + pSoldier->ChangeSoldierState( BLOODCAT_DYING, 0 , FALSE ); + return; } else if ( pSoldier->usAnimState == WATER_HIT ) { - ChangeSoldierState( pSoldier, WATER_DIE, 0 , FALSE ); - return; + pSoldier->ChangeSoldierState( WATER_DIE, 0 , FALSE ); + return; } else if ( pSoldier->usAnimState == DEEP_WATER_HIT ) { - ChangeSoldierState( pSoldier, DEEP_WATER_DIE, 0 , FALSE ); - return; + pSoldier->ChangeSoldierState( DEEP_WATER_DIE, 0 , FALSE ); + return; } else { // We have missed something here - send debug msg - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Soldier Ani: Genmeric hit not chained" ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Soldier Ani: Genmeric hit not chained" ); } } @@ -3661,13 +3660,13 @@ void CheckForAndHandleSoldierIncompacitated( SOLDIERTYPE *pSoldier ) BOOLEAN CheckForAndHandleSoldierDyingNotFromHit( SOLDIERTYPE *pSoldier ) { - if ( pSoldier->bLife == 0 ) + if ( pSoldier->stats.bLife == 0 ) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_DIE1 ); - pSoldier->fDeadSoundPlayed = TRUE; + pSoldier->DoMercBattleSound( BATTLE_SOUND_DIE1 ); + pSoldier->flags.fDeadSoundPlayed = TRUE; - // 0verhaul: The bBeingAttackedCount is now obsolete. - // Increment being attacked count + // 0verhaul: The bBeingAttackedCount is now obsolete. + // Increment being attacked count // pSoldier->bBeingAttackedCount++; if ( gGameSettings.fOptions[ TOPTION_BLOOD_N_GORE ] ) @@ -3675,64 +3674,64 @@ BOOLEAN CheckForAndHandleSoldierDyingNotFromHit( SOLDIERTYPE *pSoldier ) switch( pSoldier->usAnimState ) { case FLYBACKHIT_STOP: - ChangeSoldierState( pSoldier, FLYBACK_HIT_DEATH, 0, FALSE ); + pSoldier->ChangeSoldierState( FLYBACK_HIT_DEATH, 0, FALSE ); break; case FALLFORWARD_FROMHIT_STAND: case FALLFORWARD_FROMHIT_CROUCH: case STAND_FALLFORWARD_STOP: - ChangeSoldierState( pSoldier, GENERIC_HIT_DEATH, 0, FALSE ); + pSoldier->ChangeSoldierState( GENERIC_HIT_DEATH, 0, FALSE ); break; case FALLBACKHIT_STOP: - ChangeSoldierState( pSoldier, FALLBACK_HIT_DEATH, 0, FALSE ); + pSoldier->ChangeSoldierState( FALLBACK_HIT_DEATH, 0, FALSE ); break; case PRONE_LAYFROMHIT_STOP: case PRONE_LAY_FROMHIT: - ChangeSoldierState( pSoldier, PRONE_HIT_DEATH, 0, FALSE ); + pSoldier->ChangeSoldierState( PRONE_HIT_DEATH, 0, FALSE ); break; case FALLOFF_STOP: - ChangeSoldierState( pSoldier, FALLOFF_DEATH, 0, FALSE ); + pSoldier->ChangeSoldierState( FALLOFF_DEATH, 0, FALSE ); break; case FALLOFF_FORWARD_STOP: - ChangeSoldierState( pSoldier, FALLOFF_FORWARD_DEATH, 0, FALSE); + pSoldier->ChangeSoldierState( FALLOFF_FORWARD_DEATH, 0, FALSE); break; case ADULTMONSTER_HIT: - ChangeSoldierState( pSoldier, ADULTMONSTER_DYING, 0 , FALSE ); - break; + pSoldier->ChangeSoldierState( ADULTMONSTER_DYING, 0 , FALSE ); + break; case LARVAE_HIT: - ChangeSoldierState( pSoldier, LARVAE_DIE, 0 , FALSE ); - break; + pSoldier->ChangeSoldierState( LARVAE_DIE, 0 , FALSE ); + break; case QUEEN_HIT: - ChangeSoldierState( pSoldier, QUEEN_DIE, 0 , FALSE ); - break; + pSoldier->ChangeSoldierState( QUEEN_DIE, 0 , FALSE ); + break; case CRIPPLE_HIT: - ChangeSoldierState( pSoldier, CRIPPLE_DIE, 0 , FALSE ); + pSoldier->ChangeSoldierState( CRIPPLE_DIE, 0 , FALSE ); break; case ROBOTNW_HIT: - ChangeSoldierState( pSoldier, ROBOTNW_DIE, 0 , FALSE ); - break; + pSoldier->ChangeSoldierState( ROBOTNW_DIE, 0 , FALSE ); + break; case INFANT_HIT: - ChangeSoldierState( pSoldier, INFANT_DIE, 0 , FALSE ); - break; + pSoldier->ChangeSoldierState( INFANT_DIE, 0 , FALSE ); + break; case COW_HIT: - ChangeSoldierState( pSoldier, COW_DYING, 0 , FALSE ); - break; + pSoldier->ChangeSoldierState( COW_DYING, 0 , FALSE ); + break; case BLOODCAT_HIT: - ChangeSoldierState( pSoldier, BLOODCAT_DYING, 0 , FALSE ); - break; + pSoldier->ChangeSoldierState( BLOODCAT_DYING, 0 , FALSE ); + break; default: DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Soldier Control: Death state %d has no death hit", pSoldier->usAnimState ) ); @@ -3766,13 +3765,13 @@ BOOLEAN CheckForImproperFireGunEnd( SOLDIERTYPE *pSoldier ) } // Check single hand for jammed status, ( or ammo is out.. ) - if ( pSoldier->inv[ HANDPOS ].ItemData.Gun.bGunAmmoStatus < 0 || pSoldier->inv[ HANDPOS ].ItemData.Gun.ubGunShotsLeft == 0 ) + if ( pSoldier->inv[ HANDPOS ][0]->data.gun.bGunAmmoStatus < 0 || pSoldier->inv[ HANDPOS ][0]->data.gun.ubGunShotsLeft == 0 ) { // If we have 2 pistols, donot go back! if ( Item[ pSoldier->inv[ SECONDHANDPOS ].usItem ].usItemClass != IC_GUN ) { // OK, put gun down.... - InternalSoldierReadyWeapon( pSoldier, pSoldier->ubDirection, TRUE ); + pSoldier->InternalSoldierReadyWeapon(pSoldier->ubDirection, TRUE ); return( TRUE ); } } @@ -3784,7 +3783,7 @@ BOOLEAN CheckForImproperFireGunEnd( SOLDIERTYPE *pSoldier ) BOOLEAN OKHeightDest( SOLDIERTYPE *pSoldier, INT16 sNewGridNo ) { - if ( pSoldier->bLevel == 0 ) + if ( pSoldier->pathing.bLevel == 0 ) { return( TRUE ); } @@ -3803,55 +3802,55 @@ BOOLEAN HandleUnjamAnimation( SOLDIERTYPE *pSoldier ) { // OK, play intermediate animation here..... save in pending animation data, the current // code we are at! - pSoldier->uiPendingActionData1 = pSoldier->usAniCode; - pSoldier->sPendingActionData2 = pSoldier->usAnimState; - // Check what animatnion we should do..... + pSoldier->aiData.uiPendingActionData1 = pSoldier->usAniCode; + pSoldier->aiData.sPendingActionData2 = pSoldier->usAnimState; + // Check what animatnion we should do..... switch( pSoldier->usAnimState ) { case SHOOT_RIFLE_STAND: case STANDING_BURST: case FIRE_STAND_BURST_SPREAD: // Normal shoot rifle.... play - ChangeSoldierState( pSoldier, STANDING_SHOOT_UNJAM, 0 , FALSE ); + pSoldier->ChangeSoldierState( STANDING_SHOOT_UNJAM, 0 , FALSE ); return( TRUE ); case PRONE_BURST: case SHOOT_RIFLE_PRONE: // Normal shoot rifle.... play - ChangeSoldierState( pSoldier, PRONE_SHOOT_UNJAM, 0 , FALSE ); + pSoldier->ChangeSoldierState( PRONE_SHOOT_UNJAM, 0 , FALSE ); return( TRUE ); case CROUCHED_BURST: case SHOOT_RIFLE_CROUCH: // Normal shoot rifle.... play - ChangeSoldierState( pSoldier, CROUCH_SHOOT_UNJAM, 0 , FALSE ); + pSoldier->ChangeSoldierState( CROUCH_SHOOT_UNJAM, 0 , FALSE ); return( TRUE ); case SHOOT_DUAL_STAND: // Normal shoot rifle.... play - ChangeSoldierState( pSoldier, STANDING_SHOOT_DWEL_UNJAM, 0 , FALSE ); + pSoldier->ChangeSoldierState( STANDING_SHOOT_DWEL_UNJAM, 0 , FALSE ); return( TRUE ); case SHOOT_DUAL_PRONE: // Normal shoot rifle.... play - ChangeSoldierState( pSoldier, PRONE_SHOOT_DWEL_UNJAM, 0 , FALSE ); + pSoldier->ChangeSoldierState( PRONE_SHOOT_DWEL_UNJAM, 0 , FALSE ); return( TRUE ); case SHOOT_DUAL_CROUCH: // Normal shoot rifle.... play - ChangeSoldierState( pSoldier, CROUCH_SHOOT_DWEL_UNJAM, 0 , FALSE ); + pSoldier->ChangeSoldierState( CROUCH_SHOOT_DWEL_UNJAM, 0 , FALSE ); return( TRUE ); case FIRE_LOW_STAND: case FIRE_BURST_LOW_STAND: // Normal shoot rifle.... play - ChangeSoldierState( pSoldier, STANDING_SHOOT_LOW_UNJAM, 0 , FALSE ); + pSoldier->ChangeSoldierState( STANDING_SHOOT_LOW_UNJAM, 0 , FALSE ); return( TRUE ); } @@ -3864,7 +3863,7 @@ BOOLEAN HandleUnjamAnimation( SOLDIERTYPE *pSoldier ) #if 0 //OK, if here, if our health is still good, but we took a lot of damage, try to fall down! -if ( pSoldier->bLife >= OKLIFE ) +if ( pSoldier->stats.bLife >= OKLIFE ) { // Randomly fall back or forward, if we are in the standing hit animation if ( pSoldier->usAnimState == GENERIC_HIT_STAND || pSoldier->usAnimState == RIFLE_STAND_HIT ) @@ -3880,23 +3879,23 @@ if ( pSoldier->bLife >= OKLIFE ) { // CHECK IF WE HAVE AN ATTACKER, TAKE OPPOSITE DIRECTION! if ( pSoldier->ubAttackerID != NOBODY ) - { + { // Find direction! bTestDirection = (INT8)GetDirectionFromGridNo( MercPtrs[ pSoldier->ubAttackerID ]->sGridNo, pSoldier ); fForceDirection = TRUE; } - sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)(-1 * DirectionInc( bTestDirection ) ) ); + sNewGridNo = NewGridNo( (INT16)pSoldier->sGridNo, (UINT16)(-1 * DirectionInc( bTestDirection ) ) ); - if ( NewOKDestination( pSoldier, sNewGridNo, TRUE, pSoldier->bLevel ) && OKHeightDest( pSoldier, sNewGridNo ) ) + if ( NewOKDestination( pSoldier, sNewGridNo, TRUE, pSoldier->pathing.bLevel ) && OKHeightDest( pSoldier, sNewGridNo ) ) { // ALL'S OK HERE..... IF WE FORCED DIRECTION, SET! if ( fForceDirection ) { - EVENT_SetSoldierDirection( pSoldier, bTestDirection ); - EVENT_SetSoldierDesiredDirection( pSoldier, bTestDirection ); + pSoldier->EVENT_SetSoldierDirection( bTestDirection ); + pSoldier->EVENT_SetSoldierDesiredDirection( bTestDirection ); } - ChangeSoldierState( pSoldier, FALLBACK_HIT_STAND, 0, FALSE ); + pSoldier->ChangeSoldierState( FALLBACK_HIT_STAND, 0, FALSE ); return; } } @@ -3944,8 +3943,8 @@ BOOLEAN OKFallDirection( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT usStructureID = pSoldier->ubID; // Okay this is really SCREWY but it's due to the way this function worked before and must - // work now. The function is passing in an adjacent gridno but we need to place the structure - // data in the tile BEFORE. So we take one step back in the direction opposite to bTestDirection + // work now. The function is passing in an adjacent gridno but we need to place the structure + // data in the tile BEFORE. So we take one step back in the direction opposite to bTestDirection // and use that gridno sTestGridNo = NewGridNo( sGridNo, DirectionInc( gOppositeDirection[ ubTestDirection ] ) ); @@ -3964,7 +3963,7 @@ BOOLEAN HandleCheckForDeathCommonCode( SOLDIERTYPE *pSoldier ) // Do we have a primary pending animation? if ( pSoldier->usPendingAnimation2 != NO_PENDING_ANIMATION ) { - ChangeSoldierState( pSoldier, pSoldier->usPendingAnimation2, 0, FALSE ); + pSoldier->ChangeSoldierState( pSoldier->usPendingAnimation2, 0, FALSE ); pSoldier->usPendingAnimation2 = NO_PENDING_ANIMATION; return( TRUE ); } @@ -3972,13 +3971,13 @@ BOOLEAN HandleCheckForDeathCommonCode( SOLDIERTYPE *pSoldier ) // CHECK IF WE HAVE A PENDING ANIMATION HERE if ( pSoldier->usPendingAnimation != NO_PENDING_ANIMATION ) { - ChangeSoldierState( pSoldier, pSoldier->usPendingAnimation, 0, FALSE ); + pSoldier->ChangeSoldierState( pSoldier->usPendingAnimation, 0, FALSE ); pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; return( TRUE ); } // OTHERWISE, GOTO APPROPRIATE STOPANIMATION! - pSoldier->bCollapsed = TRUE; + pSoldier->bCollapsed = TRUE; // CC has requested - handle sight here... HandleSight( pSoldier, SIGHT_LOOK ); @@ -3987,7 +3986,7 @@ BOOLEAN HandleCheckForDeathCommonCode( SOLDIERTYPE *pSoldier ) if ( gTacticalStatus.ubCurrentTeam == pSoldier->bTeam ) { // Try to getup... - BeginSoldierGetup( pSoldier ); + pSoldier->BeginSoldierGetup( ); // Check this to see if above worked if ( !pSoldier->bCollapsed ) @@ -3999,33 +3998,33 @@ BOOLEAN HandleCheckForDeathCommonCode( SOLDIERTYPE *pSoldier ) switch( pSoldier->usAnimState ) { case FLYBACK_HIT: - ChangeSoldierState( pSoldier, FLYBACKHIT_STOP, 0, FALSE ); + pSoldier->ChangeSoldierState( FLYBACKHIT_STOP, 0, FALSE ); break; case GENERIC_HIT_DEATHTWITCHNB: case FALLFORWARD_FROMHIT_STAND: case ENDFALLFORWARD_FROMHIT_CROUCH: - ChangeSoldierState( pSoldier, STAND_FALLFORWARD_STOP, 0, FALSE ); + pSoldier->ChangeSoldierState( STAND_FALLFORWARD_STOP, 0, FALSE ); break; case FALLBACK_HIT_DEATHTWITCHNB: case FALLBACK_HIT_STAND: - ChangeSoldierState( pSoldier, FALLBACKHIT_STOP, 0, FALSE ); + pSoldier->ChangeSoldierState( FALLBACKHIT_STOP, 0, FALSE ); break; case PRONE_HIT_DEATHTWITCHNB: case PRONE_LAY_FROMHIT: - ChangeSoldierState( pSoldier, PRONE_LAYFROMHIT_STOP, 0, FALSE ); + pSoldier->ChangeSoldierState( PRONE_LAYFROMHIT_STOP, 0, FALSE ); break; case FALLOFF: - ChangeSoldierState( pSoldier, FALLOFF_STOP, 0, FALSE ); + pSoldier->ChangeSoldierState( FALLOFF_STOP, 0, FALSE ); break; case FALLFORWARD_ROOF: - ChangeSoldierState( pSoldier, FALLOFF_FORWARD_STOP, 0, FALSE); + pSoldier->ChangeSoldierState( FALLOFF_FORWARD_STOP, 0, FALSE); break; default: @@ -4034,13 +4033,13 @@ BOOLEAN HandleCheckForDeathCommonCode( SOLDIERTYPE *pSoldier ) } // OTHERWISE, GOTO APPROPRIATE STOPANIMATION! - pSoldier->bCollapsed = TRUE; + pSoldier->bCollapsed = TRUE; // ATE: If it is our turn, make them try to getup... if ( gTacticalStatus.ubCurrentTeam == pSoldier->bTeam ) { // Try to getup... - BeginSoldierGetup( pSoldier ); + pSoldier->BeginSoldierGetup( ); // Check this to see if above worked if ( !pSoldier->bCollapsed ) @@ -4052,33 +4051,33 @@ BOOLEAN HandleCheckForDeathCommonCode( SOLDIERTYPE *pSoldier ) switch( pSoldier->usAnimState ) { case FLYBACK_HIT: - ChangeSoldierState( pSoldier, FLYBACKHIT_STOP, 0, FALSE ); + pSoldier->ChangeSoldierState( FLYBACKHIT_STOP, 0, FALSE ); break; case GENERIC_HIT_DEATHTWITCHNB: case FALLFORWARD_FROMHIT_STAND: case ENDFALLFORWARD_FROMHIT_CROUCH: - ChangeSoldierState( pSoldier, STAND_FALLFORWARD_STOP, 0, FALSE ); + pSoldier->ChangeSoldierState( STAND_FALLFORWARD_STOP, 0, FALSE ); break; case FALLBACK_HIT_DEATHTWITCHNB: case FALLBACK_HIT_STAND: - ChangeSoldierState( pSoldier, FALLBACKHIT_STOP, 0, FALSE ); + pSoldier->ChangeSoldierState( FALLBACKHIT_STOP, 0, FALSE ); break; case PRONE_HIT_DEATHTWITCHNB: case PRONE_LAY_FROMHIT: - ChangeSoldierState( pSoldier, PRONE_LAYFROMHIT_STOP, 0, FALSE ); + pSoldier->ChangeSoldierState( PRONE_LAYFROMHIT_STOP, 0, FALSE ); break; case FALLOFF: - ChangeSoldierState( pSoldier, FALLOFF_STOP, 0, FALSE ); + pSoldier->ChangeSoldierState( FALLOFF_STOP, 0, FALSE ); break; case FALLFORWARD_ROOF: - ChangeSoldierState( pSoldier, FALLOFF_FORWARD_STOP, 0, FALSE); + pSoldier->ChangeSoldierState( FALLOFF_FORWARD_STOP, 0, FALSE); break; default: @@ -4096,24 +4095,24 @@ void KickOutWheelchair( SOLDIERTYPE *pSoldier ) INT16 sNewGridNo; // Move forward one gridno.... - sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) ); + sNewGridNo = NewGridNo( (INT16)pSoldier->sGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) ); // ATE: Make sure that the gridno is unoccupied! - if ( !NewOKDestination( pSoldier, sNewGridNo, TRUE, pSoldier->bLevel ) ) + if ( !NewOKDestination( pSoldier, sNewGridNo, TRUE, pSoldier->pathing.bLevel ) ) { // We should just stay put - will look kind of funny but nothing I can do! sNewGridNo = pSoldier->sGridNo; } - EVENT_StopMerc( pSoldier, sNewGridNo, pSoldier->ubDirection ); + pSoldier->EVENT_StopMerc( sNewGridNo, pSoldier->ubDirection ); pSoldier->ubBodyType = REGMALE; - if ( pSoldier->ubProfile == SLAY && pSoldier->bTeam == CIV_TEAM && !pSoldier->bNeutral ) + if ( pSoldier->ubProfile == SLAY && pSoldier->bTeam == CIV_TEAM && !pSoldier->aiData.bNeutral ) { HandleNPCDoAction( pSoldier->ubProfile, NPC_ACTION_THREATENINGLY_RAISE_GUN, 0 ); } else { - EVENT_InitNewSoldierAnim( pSoldier, STANDING, 0 , TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( STANDING, 0 , TRUE ); } // If this person has a profile ID, set body type to regmale diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 33db47e1..967b5207 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -11,7 +11,7 @@ #include "debug.h" #include "MemMan.h" #include "Overhead Types.h" -#include "Soldier Control.h" +//#include "Soldier Control.h" #include "Animation Cache.h" #include "Animation Data.h" #include "Animation Control.h" @@ -27,7 +27,7 @@ #include "video.h" #include "points.h" #include "Win util.h" -#include "Sound Control.h" +#include "Sound Control.h" #include "weapons.h" #include "vobject_blitters.h" #include "Handle UI.h" @@ -97,6 +97,13 @@ #include "Strategic Pathing.h" #endif + + +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + //turnspeed //UINT8 gubPlayerTurnSpeedUpFactor = 1; //UINT8 gubEnemyTurnSpeedUpFactor = 1; @@ -132,7 +139,7 @@ enum } ExtendedWorldDirections; // LUT for conversion from 8-direction to extended direction -UINT8 ubExtDirection[] = +UINT8 ubExtDirection[] = { EX_NORTH, EX_NORTHEAST, @@ -145,7 +152,7 @@ UINT8 ubExtDirection[] = }; -UINT8 gExtOneCDirection[ EX_NUM_WORLD_DIRECTIONS ] = +UINT8 gExtOneCDirection[ EX_NUM_WORLD_DIRECTIONS ] = { 4, 5, @@ -222,152 +229,786 @@ BATTLESNDS_STRUCT gBattleSndsData[] = "enem", 0, 1, 1, 1, 0, }; -// WDS - Clean up inventory handling +// CHRISL: +MERCPROFILEGEAR::MERCPROFILEGEAR() +{ + clearInventory(); + initialize(); +} + +// Assignment operator +MERCPROFILEGEAR& MERCPROFILEGEAR::operator=(const MERCPROFILEGEAR& src) { + if (this != &src) { + memcpy(this, &src, SIZEOF_MERCPROFILEGEAR_POD); + inv = src.inv; + iStatus = src.iStatus; + iDrop = src.iDrop; + iNumber = src.iNumber; + lbe = src.lbe; + lStatus = src.lStatus; + invCnt = src.invCnt; + lbeCnt = src.lbeCnt; + } + return *this; +} + +// Destructor +MERCPROFILEGEAR::~MERCPROFILEGEAR() { +} + +// Initialize the soldier. +// Use this instead of the old method of calling memset! +// Note that the constructor does this automatically. +void MERCPROFILEGEAR::initialize() { + memset( this, 0, SIZEOF_MERCPROFILEGEAR_POD); + clearInventory(); +} + +void MERCPROFILEGEAR::clearInventory() { + //ADB these really should be defines + invCnt = 55; + lbeCnt = 5; + + inv.clear(); + iStatus.clear(); + iDrop.clear(); + iNumber.clear(); + + inv.resize(invCnt); + iStatus.resize(invCnt); + iDrop.resize(invCnt); + iNumber.resize(invCnt); + + lbe.clear(); + lStatus.clear(); + + lbe.resize(lbeCnt); + lStatus.resize(lbeCnt); +} + // ---------------------------------------- // New inventory handling code. // ---------------------------------------- -#if 0 -Inventory::Inventory() { - OBJECTTYPE filler; - memset( &filler, 0, sizeof( OBJECTTYPE ) ); - slotCnt = NUM_INV_SLOTS; - inv.reserve(slotCnt); - for (int idx=0; idx < slotCnt; ++idx) { - //OBJECTTYPE *filler = new OBJECTTYPE; // Use MEMALLOC? - - inv.push_back(filler); - } - clear(); - Assert (inv.size() == slotCnt); -}; -#endif - -Inventory::Inventory(int slotCount ) : - inv(slotCount), - slotCnt( slotCount) { -#if 0 - slotCnt = slotCount; - inv.reserve(slotCnt); - for (int idx=0; idx < slotCnt; ++idx) { - //OBJECTTYPE *filler = new OBJECTTYPE; // Use MEMALLOC? - OBJECTTYPE *filler = NULL; - filler = (OBJECTTYPE*)MemAlloc( sizeof( OBJECTTYPE ) ); - memset( filler, 0, sizeof( OBJECTTYPE ) ); - - inv.push_back(*filler); - } -#endif - initialize(); - Assert (inv.size() == slotCnt); +Inventory::Inventory(int slotCount) { + inv.resize(slotCount);//calls the OBJECTTYPE constructor, will work with non POD data + bNewItemCount.resize(slotCount); + bNewItemCycleCount.resize(slotCount); }; Inventory::Inventory(const Inventory& src) { - // 0verhaul: I do not think the reservation is necessary or advisable. - //inv.reserve(slotCnt); - //Assert (src.inv.size() == slotCnt); inv = src.inv; - // 0verhaul: Must copy the new slot count or a class created with a different count assigned to this one - // will fail the assertion(s). - slotCnt = src.slotCnt; - Assert (inv.size() == slotCnt); + bNewItemCount = src.bNewItemCount; + bNewItemCycleCount = src.bNewItemCycleCount; } -int Inventory::size() const { - Assert (inv.size() == slotCnt); - return slotCnt; +unsigned int Inventory::size() const { + return inv.size(); } - // Assignment operator Inventory& Inventory::operator=(const Inventory& src) { - // This IF is just for setting breakpoints when trying to figure out inventory item problems. Remove it later - if ((src.inv.size() != slotCnt) || - (inv.size() != slotCnt)) { - int i = 0; // Set BP here if following asserts throw - } - Assert (src.inv.size() == src.slotCnt); - Assert (inv.size() == slotCnt); if (this != &src) { - slotCnt = src.slotCnt; inv = src.inv; -#if 0 - if (inv.size() == 0) { - inv.reserve(slotCnt); - for (int idx=0; idx < slotCnt; ++idx) { - inv.push_back(src.inv[idx]); - } - } else { - clear(); - for (int idx=0; idx < slotCnt; ++idx) { - inv[idx] = src.inv[idx]; - } - } -#endif - } - return *this; + bNewItemCount = src.bNewItemCount; + bNewItemCycleCount = src.bNewItemCycleCount; + } + return *this; } Inventory::~Inventory() { + inv.clear(); + bNewItemCount.clear(); + bNewItemCycleCount.clear(); }; - -OBJECTTYPE& Inventory::operator [] (int idx) { - // This IF is just from setting breakpoints when trying to figure out inventory item problems. Remove it later - if ((idx < 0) || - (idx >= slotCnt) || - (inv.size() != slotCnt)) { - int i = inv.size(); // Set BP here if following asserts throw +OBJECTTYPE& Inventory::operator [] (unsigned int idx) +{ + if (idx >= inv.size()) { + inv.resize(idx+1); + bNewItemCount.resize(idx+1); + bNewItemCycleCount.resize(idx+1); + DebugBreakpoint(); } - Assert(idx >= 0); - Assert(idx < slotCnt); - Assert(inv.size() == slotCnt); return inv[idx]; }; -void Inventory::initialize() { - Assert (inv.size() == slotCnt); - for (int idx=0; idx < slotCnt; ++idx) { - memset(&inv[idx], 0, sizeof(OBJECTTYPE)); - } +void Inventory::clear() { + int size = inv.size(); + inv.clear(); + bNewItemCount.clear(); + bNewItemCycleCount.clear(); + + inv.resize(size); + bNewItemCount.resize(size); + bNewItemCycleCount.resize(size); }; // ---------------------------------------- -SOLDIERTYPE::SOLDIERTYPE() : -inv(), -bNewItemCount(inv.size()), -bNewItemCycleCount(inv.size()) +void STRUCT_TimeCounters::ConvertFrom_101_To_102(const OLDSOLDIERTYPE_101& src) { -#if 0 - bNewItemCount.reserve(inv.size()); - bNewItemCycleCount.reserve(inv.size()); - for (int idx=0; idx < (int)inv.size(); ++idx) { - bNewItemCount.push_back(0); - bNewItemCycleCount.push_back(0); - } -#endif - initialize(); - - Assert(bNewItemCount.size() == inv.size()); - Assert(bNewItemCycleCount.size() == inv.size()); - - // The following are based on the "old" SOLDIERTYPE struct - // Remove these later - Assert(SIZEOF_SOLDIERTYPE_POD == 2344); - Assert(offsetof( SOLDIERTYPE, bFiller ) == 2305); + this->UpdateCounter = src.UpdateCounter; + this->DamageCounter = src.DamageCounter; + this->ReloadCounter = src.ReloadCounter; + this->FlashSelCounter = src.FlashSelCounter; + this->AICounter = src.AICounter; + this->FadeCounter = src.FadeCounter; + this->BlinkSelCounter = src.BlinkSelCounter; + this->PortraitFlashCounter = src.PortraitFlashCounter; + this->NextTileCounter = src.NextTileCounter; + this->PanelAnimateCounter = src.PanelAnimateCounter; } +void STRUCT_Drugs::ConvertFrom_101_To_102(const OLDSOLDIERTYPE_101& src) +{ + for (int x = 0; x < 2; ++x) + { + this->bFutureDrugEffect[x] = src.bFutureDrugEffect[x]; // value to represent effect of a needle + this->bDrugEffectRate[x] = src.bDrugEffectRate[x]; // represents rate of increase and decrease of effect + this->bDrugEffect[x] = src.bDrugEffect[x]; // value that affects AP & morale calc ( -ve is poorly ) + this->bDrugSideEffectRate[x] = src.bDrugSideEffectRate[x]; // duration of negative AP and morale effect + this->bDrugSideEffect[x] = src.bDrugSideEffect[x]; // duration of negative AP and morale effect + this->bTimesDrugUsedSinceSleep[x] = src.bTimesDrugUsedSinceSleep[x]; + } +} + +void STRUCT_TimeChanges::ConvertFrom_101_To_102(const OLDSOLDIERTYPE_101& src) +{ + this->uiChangeLevelTime = src.uiChangeLevelTime; + this->uiChangeHealthTime = src.uiChangeHealthTime; + this->uiChangeStrengthTime = src.uiChangeStrengthTime; + this->uiChangeDexterityTime = src.uiChangeDexterityTime; + this->uiChangeAgilityTime = src.uiChangeAgilityTime; + this->uiChangeWisdomTime = src.uiChangeWisdomTime; + this->uiChangeLeadershipTime = src.uiChangeLeadershipTime; + this->uiChangeMarksmanshipTime = src.uiChangeMarksmanshipTime; + this->uiChangeExplosivesTime = src.uiChangeExplosivesTime; + this->uiChangeMedicalTime = src.uiChangeMedicalTime; + this->uiChangeMechanicalTime = src.uiChangeMechanicalTime; +} + +void STRUCT_Flags::ConvertFrom_101_To_102(const OLDSOLDIERTYPE_101& src) +{ + this->ZipperFlag = FALSE; + this->DropPackFlag = FALSE; + + this->bHasKeys = src.bHasKeys; // allows AI controlled dudes to open locked doors + this->fHitByGasFlags = src.fHitByGasFlags; // flags + this->fIsSoldierMoving = src.fIsSoldierMoving; // ie. Record time is on + this->fIsSoldierDelayed = src.fIsSoldierDelayed; //Is the soldier delayed Soldier + this->fSoldierUpdatedFromNetwork = src.fSoldierUpdatedFromNetwork; + this->fChangingStanceDueToSuppression = src.fChangingStanceDueToSuppression; + this->fCheckForNewlyAddedItems = src.fCheckForNewlyAddedItems; + this->fCheckForNewlyAddedItems = src.bEndDoorOpenCode; + this->fMuzzleFlash = src.fMuzzleFlash; + this->fSoldierWasMoving = src.fSoldierWasMoving; + this->fSayAmmoQuotePending = src.fSayAmmoQuotePending; + this->fDontUnsetLastTargetFromTurn = src.fDontUnsetLastTargetFromTurn; + this->fUseMoverrideMoveSpeed = src.fUseMoverrideMoveSpeed; + this->fDieSoundUsed = src.fDieSoundUsed; + this->fUseLandingZoneForArrival = src.fUseLandingZoneForArrival; + this->fFallClockwise = src.fFallClockwise; + this->fComplainedThatTired = src.fComplainedThatTired; + this->fRTInNonintAnim = src.fRTInNonintAnim; + this->fDoingExternalDeath = src.fDoingExternalDeath; + this->fPastXDest = src.fPastXDest; + this->fPastYDest = src.fPastYDest; + this->fBlockedByAnotherMerc = src.fBlockedByAnotherMerc; + this->fReactingFromBeingShot = src.fReactingFromBeingShot; + this->fContractPriceHasIncreased = src.fContractPriceHasIncreased; + this->fFixingSAMSite = src.fFixingSAMSite; + this->fFixingRobot = src.fFixingRobot; + this->fSignedAnotherContract = src.fSignedAnotherContract; + this->fDontChargeTurningAPs = src.fDontChargeTurningAPs; + this->fMercCollapsedFlag = src.fMercCollapsedFlag; + this->fDoneAssignmentAndNothingToDoFlag = src.fDoneAssignmentAndNothingToDoFlag; + this->fMercAsleep = src.fMercAsleep; + this->fDontChargeAPsForStanceChange = src.fDontChargeAPsForStanceChange; + this->fStopPendingNextTile = src.fStopPendingNextTile; + this->fForceShade = src.fForceShade; + this->fForceRenderColor = src.fForceRenderColor; + this->fForceNoRenderPaletteCycle = src.fForceNoRenderPaletteCycle; + this->bTurningFromPronePosition = src.bTurningFromPronePosition; + this->fFlashPortrait = src.fFlashPortrait; + this->fBeginFade = src.fBeginFade; + this->fDontChargeReadyAPs = src.fDontChargeReadyAPs; + this->fPrevInWater = src.fPrevInWater; + this->fGoBackToAimAfterHit = src.fGoBackToAimAfterHit; + this->fDisplayDamage = src.fDisplayDamage; + this->fUIMovementFast = src.fUIMovementFast; + this->fDeadSoundPlayed = src.fDeadSoundPlayed; + this->fClosePanel = src.fClosePanel; + this->fClosePanelToDie = src.fClosePanelToDie; + this->fDeadPanel = src.fDeadPanel; + this->fOpenPanel = src.fOpenPanel; + this->fTryingToFall = src.fTryingToFall; + this->fCloseCall = src.fCloseCall; + this->fDoSpread = src.fDoSpread; + this->fForcedToStayAwake = src.fForcedToStayAwake; // forced by player to stay awake, reset to false, the moment they are set to rest or sleep + this->fDelayedMovement = src.fDelayedMovement; + this->fReloading = src.fReloading; + this->fPauseAim = src.fPauseAim; + this->fInMissionExitNode = src.fInMissionExitNode; + this->fTurnInProgress = src.fTurnInProgress; + this->fIntendedTarget = src.fIntendedTarget; // intentionally shot? + this->fContinueMoveAfterStanceChange = src.fContinueMoveAfterStanceChange; + this->fHoldAttackerUntilDone = src.fHoldAttackerUntilDone; + this->fWarnedAboutBleeding = src.fWarnedAboutBleeding; + this->fDyingComment = src.fDyingComment; + this->fNoAPToFinishMove = src.fNoAPToFinishMove; + this->fPausedMove = src.fPausedMove; + this->fUIdeadMerc = src.fUIdeadMerc; // UI Flags for removing a newly dead merc + this->fUInewMerc = src.fUInewMerc; // UI Flags for adding newly created merc ( panels, etc ) + this->fUICloseMerc = src.fUICloseMerc; // UI Flags for closing panels + this->fUIFirstTimeNOAP = src.fUIFirstTimeNOAP; // UI Flag for diming guys when no APs ( dirty flags ) + this->fUIFirstTimeUNCON = src.fUIFirstTimeUNCON; // UI FLAG For unconscious dirty + this->fBetweenSectors = src.fBetweenSectors; //set when the group isn't actually in a sector. + this->fPauseAllAnimation = src.fPauseAllAnimation; + this->fTurningToShoot = src.fTurningToShoot; + this->fTurningToFall = src.fTurningToFall; + this->fTurningUntilDone = src.fTurningUntilDone; + this->fGettingHit = src.fGettingHit; + this->fInNonintAnim = src.fInNonintAnim; + this->fFlashLocator = src.fFlashLocator; + this->fShowLocator = src.fShowLocator; + this->autofireLastStep = src.autofireLastStep; + this->lastFlankLeft = src.lastFlankLeft; + this->uiStatusFlags = src.uiStatusFlags; +} + +void STRUCT_Statistics::ConvertFrom_101_To_102(const OLDSOLDIERTYPE_101& src) +{ + this->ubSkillTrait1 = src.ubSkillTrait1; + this->ubSkillTrait2 = src.ubSkillTrait2; + this->bDexterity = src.bDexterity; // dexterity (hand coord) value + this->bWisdom = src.bWisdom; + this->bExpLevel = src.bExpLevel; // general experience level + this->bLife = src.bLife; // current life (hit points or health) + this->bAgility = src.bAgility; // agility (speed) value + this->bStrength = src.bStrength; + this->bMechanical = src.bMechanical; + this->bLifeMax = src.bLifeMax; // maximum life for this merc + this->bMedical = src.bMedical; + this->bMarksmanship = src.bMarksmanship; + this->bScientific = src.bScientific; + this->bLeadership = src.bLeadership; + this->bExplosive = src.bExplosive; +} + +void STRUCT_AIData::ConvertFrom_101_To_102(const OLDSOLDIERTYPE_101& src) +{ + memcpy( &(this->bOppList), &(src.bOppList), sizeof(INT8) * MAX_NUM_SOLDIERS ); // AI knowledge database + memcpy( &(this->sPatrolGrid), &(src.usPatrolGrid), sizeof(INT16) * MAXPATROLGRIDS );// AI list for ptr->orders==PATROL + this->bLastAction = src.bLastAction; + this->bAction = src.bAction; + this->usActionData = src.usActionData; + this->bNextAction = src.bNextAction; + this->usNextActionData = src.usNextActionData; + this->bActionInProgress = src.bActionInProgress; + this->bAlertStatus = src.bAlertStatus; + this->bOppCnt = src.bOppCnt; + this->bNeutral = src.bNeutral; + this->bNewSituation = src.bNewSituation; + this->bNextTargetLevel = src.bNextTargetLevel; + this->bOrders = src.bOrders; + this->bAttitude = src.bAttitude; + this->bUnderFire = src.bUnderFire; + this->bShock = src.bShock; + this->bUnderEscort = src.bUnderEscort; + this->bBypassToGreen = src.bBypassToGreen; + this->ubLastMercToRadio = src.ubLastMercToRadio; + this->bDominantDir = src.bDominantDir; // AI main direction to face... + this->bPatrolCnt = src.bPatrolCnt; // number of patrol gridnos + this->bNextPatrolPnt = src.bNextPatrolPnt; // index to next patrol gridno + this->sNoiseGridno = src.sNoiseGridno; + this->ubNoiseVolume = src.ubNoiseVolume; + this->bLastAttackHit = src.bLastAttackHit; + this->ubXRayedBy = src.ubXRayedBy; + this->dHeightAdjustment = src.dHeightAdjustment; + this->bMorale = src.bMorale; + this->bTeamMoraleMod = src.bTeamMoraleMod; + this->bTacticalMoraleMod = src.bTacticalMoraleMod; + this->bStrategicMoraleMod = src.bStrategicMoraleMod; + this->bAIMorale = src.bAIMorale; + this->ubPendingAction = src.ubPendingAction; + this->ubPendingActionAnimCount = src.ubPendingActionAnimCount; + this->uiPendingActionData1 = src.uiPendingActionData1; + this->sPendingActionData2 = src.sPendingActionData2; + this->bPendingActionData3 = src.bPendingActionData3; + this->ubDoorHandleCode = src.ubDoorHandleCode; + this->uiPendingActionData4 = src.uiPendingActionData4; + this->bInterruptDuelPts = src.bInterruptDuelPts; + this->bPassedLastInterrupt = src.bPassedLastInterrupt; + this->bIntStartAPs = src.bIntStartAPs; + this->bMoved = src.bMoved; + this->bHunting = src.bHunting; + this->ubLastCall = src.ubLastCall; + this->ubCaller = src.ubCaller; + this->sCallerGridNo = src.sCallerGridNo; + this->bCallPriority = src.bCallPriority; + this->bCallActedUpon = src.bCallActedUpon; + this->bFrenzied = src.bFrenzied; + this->bNormalSmell = src.bNormalSmell; + this->bMonsterSmell = src.bMonsterSmell; + this->bMobility = src.bMobility; + this->bRTPCombat = src.bRTPCombat; + this->fAIFlags = src.fAIFlags; + this->bAimTime = src.bAimTime; + this->bShownAimTime = src.bShownAimTime; +} + +void STRUCT_Pathing::ConvertFrom_101_To_102(const OLDSOLDIERTYPE_101& src) +{ + memcpy( &(this->usPathingData), &(src.usPathingData), sizeof(UINT16) * MAX_PATH_LIST_SIZE ); + this->bDesiredDirection = src.bDesiredDirection; + this->sDestXPos = src.sDestXPos; + this->sDestYPos = src.sDestYPos; + //this->sDesiredDest = src.sDesiredDest;//apparently not used + this->sDestination = src.sDestination; + this->sFinalDestination = src.sFinalDestination; + this->bLevel = src.bLevel; + this->bStopped = src.bStopped; + this->bNeedToLook = src.bNeedToLook; + this->usPathDataSize = src.usPathDataSize; + this->usPathIndex = src.usPathIndex; + this->sBlackList = src.sBlackList; + this->bPathStored = src.bPathStored; // good for AI to reduct redundancy +} + +// Conversion operator +SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) +{ + if ((void*)this != (void*)&src) { + //member classes + aiData.ConvertFrom_101_To_102(src); + flags.ConvertFrom_101_To_102(src); + timeChanges.ConvertFrom_101_To_102(src); + timeCounters.ConvertFrom_101_To_102(src); + drugs.ConvertFrom_101_To_102(src); + stats.ConvertFrom_101_To_102(src); + pathing.ConvertFrom_101_To_102(src); + inv = src.inv; + + //arrays + memcpy( &(this->name), &(src.name), sizeof(CHAR16) * 10 ); + memcpy( &(this->pShades), &(src.pShades), sizeof(UINT16) * NUM_SOLDIER_SHADES ); // Shading tables + memcpy( &(this->pGlowShades), &(src.pGlowShades), sizeof(UINT16) * 20 ); // + memcpy( &(this->pEffectShades), &(src.pEffectShades), sizeof(UINT16) * NUM_SOLDIER_EFFECTSHADES ); // Shading tables for effects + memcpy( &(this->sSpreadLocations), &(src.sSpreadLocations), sizeof(INT16) * MAX_BURST_SPREAD_TARGETS ); + memcpy( &(this->usFrontArcFullTileList), &(src.usFrontArcFullTileList), sizeof(UINT16) * MAX_FULLTILE_DIRECTIONS ); + memcpy( &(this->usFrontArcFullTileGridNos), &(src.usFrontArcFullTileGridNos), sizeof(INT16) * MAX_FULLTILE_DIRECTIONS ); + memcpy( &(this->HeadPal), &(src.HeadPal), sizeof(PaletteRepID) ); // 30 + memcpy( &(this->PantsPal), &(src.PantsPal), sizeof(PaletteRepID) ); // 30 + memcpy( &(this->VestPal), &(src.VestPal), sizeof(PaletteRepID) ); // 30 + memcpy( &(this->SkinPal), &(src.SkinPal), sizeof(PaletteRepID) ); // 30 + memcpy( &(this->MiscPal), &(src.MiscPal), sizeof(PaletteRepID) ); // 30 + this->sLastTwoLocations[0] = src.sLastTwoLocations[0]; + this->sLastTwoLocations[1] = src.sLastTwoLocations[1]; + + this->ubID = src.ubID; + this->bReserved1 = src.bReserved1; + + this->ubBodyType = src.ubBodyType; + this->bActionPoints = src.bActionPoints; + this->bInitialActionPoints = src.bInitialActionPoints; + + + this->pKeyRing = src.pKeyRing; + this->bOldLife = src.bOldLife; // life at end of last turn, recorded for monster AI + this->bInSector = src.bInSector; + this->bFlashPortraitFrame = src.bFlashPortraitFrame; + this->sFractLife = src.sFractLife; // fraction of life pts (in hundreths) + this->bBleeding = src.bBleeding; // blood loss control variable + this->bBreath = src.bBreath; // current breath value + this->bBreathMax = src.bBreathMax; // max breath, affected by fatigue/sleep + this->bStealthMode = src.bStealthMode; + + this->sBreathRed = src.sBreathRed; // current breath value + + this->ubWaitActionToDo = src.ubWaitActionToDo; + this->ubInsertionDirection = src.ubInsertionDirection; + this->bGunType = src.bGunType; + this->ubOppNum = src.ubOppNum; + this->bLastRenderVisibleValue = src.bLastRenderVisibleValue; + this->ubAttackingHand = src.ubAttackingHand; + this->sWeightCarriedAtTurnStart = src.sWeightCarriedAtTurnStart; + + this->bVisible = src.bVisible; // to render or not to render... + + this->bActive = src.bActive; + this->bTeam = src.bTeam; // Team identifier + + this->ubGroupID = src.ubGroupID; //the movement group the merc is currently part of. + this->ubMovementNoiseHeard = src.ubMovementNoiseHeard;// 8 flags by direction + + + this->dXPos = src.dXPos; + this->dYPos = src.dYPos; + this->dOldXPos = src.dOldXPos; + this->dOldYPos = src.dOldYPos; + this->sInitialGridNo = src.sInitialGridNo; + this->sGridNo = src.sGridNo; + this->ubDirection = src.ubDirection; + this->sHeightAdjustment = src.sHeightAdjustment; + this->sDesiredHeight = src.sDesiredHeight; + this->sTempNewGridNo = src.sTempNewGridNo; // New grid no for advanced animations + this->sRoomNo = src.sRoomNo; + this->bOverTerrainType = src.bOverTerrainType; + this->bOldOverTerrainType = src.bOldOverTerrainType; + this->bCollapsed = src.bCollapsed; // collapsed due to being out of APs + this->bBreathCollapsed = src.bBreathCollapsed; // collapsed due to being out of APs + + + this->ubDesiredHeight = src.ubDesiredHeight; + this->usPendingAnimation = src.usPendingAnimation; + this->ubPendingStanceChange = src.ubPendingStanceChange; + this->usAnimState = src.usAnimState; + + this->uiAIDelay = src.uiAIDelay; + this->sReloadDelay = src.sReloadDelay; + this->ubAttackerID = src.ubAttackerID; + this->ubPreviousAttackerID = src.ubPreviousAttackerID; + + this->sInsertionGridNo = src.sInsertionGridNo; + + + this->AnimCache = src.AnimCache; // will be 9 bytes once changed to pointers + + this->bSide = src.bSide; + this->bViewRange = src.bViewRange; + this->bNewOppCnt = src.bNewOppCnt; + this->bService = src.bService; // first aid, or other time consuming process + + this->usAniCode = src.usAniCode; + this->usAniFrame = src.usAniFrame; + this->sAniDelay = src.sAniDelay; + + this->ubDelayedMovementCauseMerc = src.ubDelayedMovementCauseMerc; + this->sDelayedMovementCauseGridNo = src.sDelayedMovementCauseGridNo; + this->sReservedMovementGridNo = src.sReservedMovementGridNo; + + + this->sTargetGridNo = src.sTargetGridNo; + this->bTargetLevel = src.bTargetLevel; + this->bTargetCubeLevel = src.bTargetCubeLevel; + this->sLastTarget = src.sLastTarget; + this->bTilesMoved = src.bTilesMoved; + this->dNextBleed = src.dNextBleed; + + this->ubTilesMovedPerRTBreathUpdate = src.ubTilesMovedPerRTBreathUpdate; + this->usLastMovementAnimPerRTBreathUpdate = src.usLastMovementAnimPerRTBreathUpdate; + + this->sLocatorFrame = src.sLocatorFrame; + this->iFaceIndex = src.iFaceIndex; + + + this->p8BPPPalette = src.p8BPPPalette; // 4 + this->p16BPPPalette = src.p16BPPPalette; + this->pCurrentShade = src.pCurrentShade; + this->ubFadeLevel = src.ubFadeLevel; + this->ubServiceCount = src.ubServiceCount; + this->ubServicePartner = src.ubServicePartner; + this->pThrowParams = src.pThrowParams; + this->bReverse = src.bReverse; + this->pLevelNode = src.pLevelNode; + this->pExternShadowLevelNode = src.pExternShadowLevelNode; + this->pRoofUILevelNode = src.pRoofUILevelNode; + + this->pBackGround = src.pBackGround; + this->pZBackground = src.pZBackground; + this->usUnblitX = src.usUnblitX; + this->usUnblitY = src.usUnblitY; + this->usUnblitWidth = src.usUnblitWidth; + this->usUnblitHeight = src.usUnblitHeight; + + this->ubStrategicInsertionCode = src.ubStrategicInsertionCode; + this->usStrategicInsertionData = src.usStrategicInsertionData; + + + this->iLight = src.iLight; + this->iMuzFlash = src.iMuzFlash; + this->bMuzFlashCount = src.bMuzFlashCount; + + + this->sX = src.sX; + this->sY = src.sY; + + this->usOldAniState = src.usOldAniState; + this->sOldAniCode = src.sOldAniCode; + + this->bBulletsLeft = src.bBulletsLeft; + this->ubSuppressionPoints = src.ubSuppressionPoints; + + this->uiTimeOfLastRandomAction = src.uiTimeOfLastRandomAction; + this->usLastRandomAnim = src.usLastRandomAnim; + + this->usAnimSurface = src.usAnimSurface; + this->sZLevel = src.sZLevel; + + this->sWalkToAttackGridNo = src.sWalkToAttackGridNo; + this->sWalkToAttackWalkToCost = src.sWalkToAttackWalkToCost; + + + this->sLocatorOffX = src.sLocatorOffX; + this->sLocatorOffY = src.sLocatorOffY; + this->pForcedShade = src.pForcedShade; + + this->bDisplayDamageCount = src.bDisplayDamageCount; + this->sDamage = src.sDamage; + this->sDamageX = src.sDamageX; + this->sDamageY = src.sDamageY; + this->bDamageDir = src.bDamageDir; + this->bDoBurst = src.bDoBurst; + this->usUIMovementMode = src.usUIMovementMode; + this->bUIInterfaceLevel = src.bUIInterfaceLevel; + + this->ubProfile = src.ubProfile; + this->ubQuoteRecord = src.ubQuoteRecord; + this->ubQuoteActionID = src.ubQuoteActionID; + this->ubBattleSoundID = src.ubBattleSoundID; + + this->ubClosePanelFrame = src.ubClosePanelFrame; + this->ubDeadPanelFrame = src.ubDeadPanelFrame; + this->bOpenPanelFrame = src.bOpenPanelFrame; + + this->sPanelFaceX = src.sPanelFaceX; + this->sPanelFaceY = src.sPanelFaceY; + + this->bNumHitsThisTurn = src.bNumHitsThisTurn; + this->usQuoteSaidFlags = src.usQuoteSaidFlags; + this->bLastSkillCheck = src.bLastSkillCheck; + this->ubSkillCheckAttempts = src.ubSkillCheckAttempts; + + this->bVocalVolume = src.bVocalVolume; // verbal sounds need to differ in volume + + this->bStartFallDir = src.bStartFallDir; + + this->ubPendingDirection = src.ubPendingDirection; + this->uiAnimSubFlags = src.uiAnimSubFlags; + + this->bAimShotLocation = src.bAimShotLocation; + this->ubHitLocation = src.ubHitLocation; + + + + this->ubPlannedUIAPCost = src.ubPlannedUIAPCost; + this->sPlannedTargetX = src.sPlannedTargetX; + this->sPlannedTargetY = src.sPlannedTargetY; + + this->sStartGridNo = src.sStartGridNo; + this->sEndGridNo = src.sEndGridNo; + this->sForcastGridno = src.sForcastGridno; + this->sZLevelOverride = src.sZLevelOverride; + this->bMovedPriorToInterrupt = src.bMovedPriorToInterrupt; + this->iEndofContractTime = src.iEndofContractTime; // time, in global time(resolution, minutes) that merc will leave, or if its a M.E.R.C. merc it will be set to -1. -2 for NPC and player generated + this->iStartContractTime = src.iStartContractTime; + this->iTotalContractLength = src.iTotalContractLength; // total time of AIM mercs contract or the time since last paid for a M.E.R.C. merc + this->iNextActionSpecialData = src.iNextActionSpecialData; // AI special action data record for the next action + this->ubWhatKindOfMercAmI = src.ubWhatKindOfMercAmI; //Set to the type of character it is + this->bAssignment = src.bAssignment; // soldiers current assignment + this->bOldAssignment = src.bOldAssignment; // old assignment, for autosleep purposes + this->bTrainStat = src.bTrainStat; // current stat soldier is training + this->sSectorX = src.sSectorX; // X position on the Stategic Map + this->sSectorY = src. sSectorY; // Y position on the Stategic Map + this->bSectorZ = src.bSectorZ; // Z sector location + this->iVehicleId = src.iVehicleId; // the id of the vehicle the char is in + this->pMercPath = src.pMercPath; //Path Structure + this->usMedicalDeposit = src.usMedicalDeposit; // is there a medical deposit on merc + this->usLifeInsurance = src.usLifeInsurance; // is there life insurance taken out on merc + + + this->uiStartMovementTime = src.uiStartMovementTime; // the time since the merc first started moving + this->uiOptimumMovementTime = src.uiOptimumMovementTime; // everytime in ececute overhead the time for the current ani will be added to this total + this->usLastUpdateTime = src.usLastUpdateTime ; // The last time the soldier was in ExecuteOverhead + + this->uiSoldierUpdateNumber = src.uiSoldierUpdateNumber; + this->ubSoldierUpdateType = src.ubSoldierUpdateType; + + this->iStartOfInsuranceContract = src.iStartOfInsuranceContract; + this->uiLastAssignmentChangeMin = src.uiLastAssignmentChangeMin; // timestamp of last assignment change in minutes + this->iTotalLengthOfInsuranceContract = src.iTotalLengthOfInsuranceContract; + + this->ubSoldierClass = src.ubSoldierClass; //admin, elite, troop (creature types?) + this->ubAPsLostToSuppression = src.ubAPsLostToSuppression; + this->ubSuppressorID = src.ubSuppressorID; + + this->ubDesiredSquadAssignment = src.ubDesiredSquadAssignment; + this->ubNumTraversalsAllowedToMerge = src.ubNumTraversalsAllowedToMerge; + + this->usPendingAnimation2 = src.usPendingAnimation2; + this->ubCivilianGroup = src.ubCivilianGroup; + + this->uiUniqueSoldierIdValue = src.uiUniqueSoldierIdValue; // the unique value every instance of a soldier gets - 1 is the first valid value + + this->ubScheduleID = src.ubScheduleID; + this->sEndDoorOpenCodeData = src.sEndDoorOpenCodeData; + this->bBlockedByAnotherMercDirection = src.bBlockedByAnotherMercDirection; + this->usAttackingWeapon = src.usAttackingWeapon; + this->bWeaponMode = src.bWeaponMode; + this->ubTargetID = src.ubTargetID; + this->bAIScheduleProgress = src.bAIScheduleProgress; + this->sOffWorldGridNo = src.sOffWorldGridNo; + this->pAniTile = src.pAniTile; + this->bCamo = src.bCamo; + this->sAbsoluteFinalDestination = src.sAbsoluteFinalDestination; + this->ubHiResDirection = src.ubHiResDirection; + this->ubHiResDesiredDirection = src.ubHiResDesiredDirection; + this->ubLastFootPrintSound = src.ubLastFootPrintSound; + this->bVehicleID = src.bVehicleID; + this->bMovementDirection = src.bMovementDirection; + this->sOldGridNo = src.sOldGridNo; + this->usDontUpdateNewGridNoOnMoveAnimChange = src.usDontUpdateNewGridNoOnMoveAnimChange; + this->sBoundingBoxWidth = src.sBoundingBoxWidth; + this->sBoundingBoxHeight = src.sBoundingBoxHeight; + this->sBoundingBoxOffsetX = src.sBoundingBoxOffsetX; + this->sBoundingBoxOffsetY = src.sBoundingBoxOffsetY; + this->uiTimeSameBattleSndDone = src.uiTimeSameBattleSndDone; + this->bOldBattleSnd = src.bOldBattleSnd; + this->iBurstSoundID = src.iBurstSoundID; + this->bSlotItemTakenFrom = src.bSlotItemTakenFrom; + this->ubAutoBandagingMedic = src.ubAutoBandagingMedic; + this->ubRobotRemoteHolderID = src.ubRobotRemoteHolderID; + this->uiTimeOfLastContractUpdate = src.uiTimeOfLastContractUpdate; + this->bTypeOfLastContract = src.bTypeOfLastContract; + this->bTurnsCollapsed = src.bTurnsCollapsed; + this->bSleepDrugCounter = src.bSleepDrugCounter; + this->ubMilitiaKills = src.ubMilitiaKills; + + + this->bBlindedCounter = src.bBlindedCounter; + + this->ubHoursOnAssignment = src.ubHoursOnAssignment; // used for assignments handled only every X hours + + this->ubMercJustFired = src.ubMercJustFired; // the merc was just fired..there may be dialogue events occuring, this flag will prevent any interaction with contracts + // until after the merc leaves + this->ubTurnsUntilCanSayHeardNoise = src.ubTurnsUntilCanSayHeardNoise; + this->usQuoteSaidExtFlags = src.usQuoteSaidExtFlags; + + this->sContPathLocation = src.sContPathLocation; + this->bGoodContPath = src.bGoodContPath; + this->ubPendingActionInterrupted = src.ubPendingActionInterrupted; + this->bNoiseLevel = src.bNoiseLevel; + this->bRegenerationCounter = src.bRegenerationCounter; + this->bRegenBoostersUsedToday = src.bRegenBoostersUsedToday; + this->bNumPelletsHitBy = src.bNumPelletsHitBy; + this->sSkillCheckGridNo = src.sSkillCheckGridNo; + this->ubLastEnemyCycledID = src.ubLastEnemyCycledID; + + this->ubPrevSectorID = src.ubPrevSectorID; + this->ubNumTilesMovesSinceLastForget = src.ubNumTilesMovesSinceLastForget; + this->bTurningIncrement = src.bTurningIncrement; + this->uiBattleSoundID = src.uiBattleSoundID; + + + this->usValueGoneUp = src.usValueGoneUp; + this->ubNumLocateCycles = src.ubNumLocateCycles; + this->ubDelayedMovementFlags = src.ubDelayedMovementFlags; + this->ubCTGTTargetID = src.ubCTGTTargetID; + + this->uiMercChecksum = src.uiMercChecksum; + + this->bCurrentCivQuote = src.bCurrentCivQuote; + this->bCurrentCivQuoteDelta = src.bCurrentCivQuoteDelta; + this->ubMiscSoldierFlags = src.ubMiscSoldierFlags; + this->ubReasonCantFinishMove = src.ubReasonCantFinishMove; + + this->sLocationOfFadeStart = src.sLocationOfFadeStart; + this->bUseExitGridForReentryDirection = src.bUseExitGridForReentryDirection; + + this->uiTimeSinceLastSpoke = src.uiTimeSinceLastSpoke; + this->ubContractRenewalQuoteCode = src.ubContractRenewalQuoteCode; + this->sPreTraversalGridNo = src.sPreTraversalGridNo; + this->uiXRayActivatedTime = src.uiXRayActivatedTime; + this->bTurningFromUI = src.bTurningFromUI; + this->bPendingActionData5 = src.bPendingActionData5; + + this->bDelayedStrategicMoraleMod = src.bDelayedStrategicMoraleMod; + this->ubDoorOpeningNoise = src.ubDoorOpeningNoise; + + this->pGroup = src.pGroup; + this->ubLeaveHistoryCode = src.ubLeaveHistoryCode; + this->bOverrideMoveSpeed = src.bOverrideMoveSpeed; + + this->uiTimeSoldierWillArrive = src.uiTimeSoldierWillArrive; + this->bVehicleUnderRepairID = src.bVehicleUnderRepairID; + this->iTimeCanSignElsewhere = src.iTimeCanSignElsewhere; + this->bHospitalPriceModifier = src.bHospitalPriceModifier; + this->uiStartTimeOfInsuranceContract = src.uiStartTimeOfInsuranceContract; + this->bCorpseQuoteTolerance = src.bCorpseQuoteTolerance; + this->bDeafenedCounter = src.bDeafenedCounter; + this->iPositionSndID = src.iPositionSndID; + this->iTuringSoundID = src.iTuringSoundID; + this->ubLastDamageReason = src.ubLastDamageReason; + this->uiTimeSinceLastBleedGrunt = src.uiTimeSinceLastBleedGrunt; + this->ubNextToPreviousAttackerID = src.ubNextToPreviousAttackerID; + this->bDoAutofire = src.bDoAutofire; + this->numFlanks = src.numFlanks; + this->lastFlankSpot = src.lastFlankSpot; + this->sniper = src.sniper; + this->origDir = src.origDir; + this->wornCamo = src.wornCamo; + + this->urbanCamo = src.urbanCamo; // Madd: new camo types + this->wornUrbanCamo = src.wornUrbanCamo; + + this->desertCamo = src.desertCamo; + this->wornDesertCamo = src.wornDesertCamo; + + this->snowCamo = src.snowCamo; + this->wornSnowCamo = src.wornSnowCamo; + } + return *this; +} + +SOLDIERTYPE::~SOLDIERTYPE() {} + +SOLDIERTYPE::SOLDIERTYPE() { + initialize(); +} + +UINT32 SOLDIERTYPE::GetChecksum( ) +{ + UINT32 uiChecksum = 1; + UINT32 uiLoop; + + uiChecksum += (this->stats.bLife + 1); + uiChecksum *= (this->stats.bLifeMax + 1); + uiChecksum += (this->stats.bAgility + 1); + uiChecksum *= (this->stats.bDexterity + 1); + uiChecksum += (this->stats.bStrength + 1); + uiChecksum *= (this->stats.bMarksmanship + 1); + uiChecksum += (this->stats.bMedical + 1); + uiChecksum *= (this->stats.bMechanical + 1); + uiChecksum += (this->stats.bExplosive + 1); + + // put in some multipliers too! + uiChecksum *= (this->stats.bExpLevel + 1); + uiChecksum += (this->ubProfile + 1); + + for ( uiLoop = 0; uiLoop < this->inv.size(); uiLoop++ ) + { + uiChecksum += this->inv[ uiLoop ].usItem; + uiChecksum += this->inv[ uiLoop ].ubNumberOfObjects; + } + + return( uiChecksum ); +} + + // Copy Constructor -SOLDIERTYPE::SOLDIERTYPE(const SOLDIERTYPE& src) { +SOLDIERTYPE::SOLDIERTYPE(const SOLDIERTYPE& src) +{ memcpy(this, &src, SIZEOF_SOLDIERTYPE_POD); inv = src.inv; - bNewItemCount = src.bNewItemCount; - bNewItemCycleCount = src.bNewItemCycleCount; - - Assert(bNewItemCount.size() == inv.size()); - Assert(bNewItemCycleCount.size() == inv.size()); + aiData = src.aiData; + flags = src.flags; + timeChanges = src.timeChanges; + timeCounters = src.timeCounters; + drugs = src.drugs; + stats = src.stats; + pathing = src.pathing; } // Assignment operator @@ -375,40 +1016,74 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const SOLDIERTYPE& src) { if (this != &src) { memcpy(this, &src, SIZEOF_SOLDIERTYPE_POD); + aiData = src.aiData; + flags = src.flags; + timeChanges = src.timeChanges; + timeCounters = src.timeCounters; + drugs = src.drugs; + stats = src.stats; + pathing = src.pathing; inv = src.inv; - bNewItemCount = src.bNewItemCount; - bNewItemCycleCount = src.bNewItemCycleCount; - } - return *this; + } + return *this; } -// Destructor -SOLDIERTYPE::~SOLDIERTYPE() { -} - -// Initialize the soldier. +// Initialize the soldier. // Use this instead of the old method of calling memset! // Note that the constructor does this automatically. -void SOLDIERTYPE::initialize() { +void SOLDIERTYPE::initialize() +{ memset( this, 0, SIZEOF_SOLDIERTYPE_POD); - inv.initialize(); - for (int idx=0; idx < (int)inv.size(); ++idx) { - bNewItemCount[idx] = 0; - bNewItemCycleCount[idx] = 0; - } + inv.clear(); - Assert(bNewItemCount.size() == inv.size()); - Assert(bNewItemCycleCount.size() == inv.size()); + memset( &aiData, 0, sizeof(STRUCT_AIData) ); + memset( &flags, 0, sizeof(STRUCT_Flags) ); + memset( &timeChanges, 0, sizeof(STRUCT_TimeChanges) ); + memset( &timeCounters, 0, sizeof(STRUCT_TimeCounters) ); + memset( &drugs, 0, sizeof(STRUCT_Drugs) ); + memset( &stats, 0, sizeof(STRUCT_Statistics) ); + memset( &pathing, 0, sizeof(STRUCT_Pathing) ); } + // Ugly temporary solution // // These two functions map the "old" style inventory (fixed array of ) to the new (a flexibly sized vector). // If you change names or eliminate some positions or such you need to change these. // Eventually the need for these functions will disappear. -void SOLDIERTYPE::CopyOldInventoryToNew() { +UINT32 OLDSOLDIERTYPE_101::GetChecksum() +{ + UINT32 uiChecksum = 1; + UINT32 uiLoop; + + uiChecksum += (this->bLife + 1); + uiChecksum *= (this->bLifeMax + 1); + uiChecksum += (this->bAgility + 1); + uiChecksum *= (this->bDexterity + 1); + uiChecksum += (this->bStrength + 1); + uiChecksum *= (this->bMarksmanship + 1); + uiChecksum += (this->bMedical + 1); + uiChecksum *= (this->bMechanical + 1); + uiChecksum += (this->bExplosive + 1); + + // put in some multipliers too! + uiChecksum *= (this->bExpLevel + 1); + uiChecksum += (this->ubProfile + 1); + + for ( uiLoop = 0; uiLoop < NUM_ORIGINAL_INV_SLOTS; uiLoop++ ) + { + uiChecksum += this->inv[ uiLoop ].usItem; + uiChecksum += this->inv[ uiLoop ].ubNumberOfObjects; + } + + return( uiChecksum ); +} + + +void OLDSOLDIERTYPE_101::CopyOldInventoryToNew() +{ // Do not use a loop in case the new inventory slots are arranged differently than the old inv[HELMETPOS] = DO_NOT_USE_Inv[OldInventory::HELMETPOS]; inv[VESTPOS] = DO_NOT_USE_Inv[OldInventory::VESTPOS]; @@ -430,325 +1105,400 @@ void SOLDIERTYPE::CopyOldInventoryToNew() { inv[SMALLPOCK7POS] = DO_NOT_USE_Inv[OldInventory::SMALLPOCK7POS]; inv[SMALLPOCK8POS] = DO_NOT_USE_Inv[OldInventory::SMALLPOCK8POS]; - bNewItemCount[OldInventory::HELMETPOS] = DO_NOT_USE_bNewItemCount[HELMETPOS]; - bNewItemCount[OldInventory::VESTPOS] = DO_NOT_USE_bNewItemCount[VESTPOS]; - bNewItemCount[OldInventory::LEGPOS] = DO_NOT_USE_bNewItemCount[LEGPOS]; - bNewItemCount[OldInventory::HEAD1POS] = DO_NOT_USE_bNewItemCount[HEAD1POS]; - bNewItemCount[OldInventory::HEAD2POS] = DO_NOT_USE_bNewItemCount[HEAD2POS]; - bNewItemCount[OldInventory::HANDPOS] = DO_NOT_USE_bNewItemCount[HANDPOS]; - bNewItemCount[OldInventory::SECONDHANDPOS] = DO_NOT_USE_bNewItemCount[SECONDHANDPOS]; - bNewItemCount[OldInventory::BIGPOCK1POS] = DO_NOT_USE_bNewItemCount[BIGPOCK1POS]; - bNewItemCount[OldInventory::BIGPOCK2POS] = DO_NOT_USE_bNewItemCount[BIGPOCK2POS]; - bNewItemCount[OldInventory::BIGPOCK3POS] = DO_NOT_USE_bNewItemCount[BIGPOCK3POS]; - bNewItemCount[OldInventory::BIGPOCK4POS] = DO_NOT_USE_bNewItemCount[BIGPOCK4POS]; - bNewItemCount[OldInventory::SMALLPOCK1POS] = DO_NOT_USE_bNewItemCount[SMALLPOCK1POS]; - bNewItemCount[OldInventory::SMALLPOCK2POS] = DO_NOT_USE_bNewItemCount[SMALLPOCK2POS]; - bNewItemCount[OldInventory::SMALLPOCK3POS] = DO_NOT_USE_bNewItemCount[SMALLPOCK3POS]; - bNewItemCount[OldInventory::SMALLPOCK4POS] = DO_NOT_USE_bNewItemCount[SMALLPOCK4POS]; - bNewItemCount[OldInventory::SMALLPOCK5POS] = DO_NOT_USE_bNewItemCount[SMALLPOCK5POS]; - bNewItemCount[OldInventory::SMALLPOCK6POS] = DO_NOT_USE_bNewItemCount[SMALLPOCK6POS]; - bNewItemCount[OldInventory::SMALLPOCK7POS] = DO_NOT_USE_bNewItemCount[SMALLPOCK7POS]; - bNewItemCount[OldInventory::SMALLPOCK8POS] = DO_NOT_USE_bNewItemCount[SMALLPOCK8POS]; + bNewItemCount[HELMETPOS] = DO_NOT_USE_bNewItemCount[OldInventory::HELMETPOS]; + bNewItemCount[VESTPOS] = DO_NOT_USE_bNewItemCount[OldInventory::VESTPOS]; + bNewItemCount[LEGPOS] = DO_NOT_USE_bNewItemCount[OldInventory::LEGPOS]; + bNewItemCount[HEAD1POS] = DO_NOT_USE_bNewItemCount[OldInventory::HEAD1POS]; + bNewItemCount[HEAD2POS] = DO_NOT_USE_bNewItemCount[OldInventory::HEAD2POS]; + bNewItemCount[HANDPOS] = DO_NOT_USE_bNewItemCount[OldInventory::HANDPOS]; + bNewItemCount[SECONDHANDPOS] = DO_NOT_USE_bNewItemCount[OldInventory::SECONDHANDPOS]; + bNewItemCount[BIGPOCK1POS] = DO_NOT_USE_bNewItemCount[OldInventory::BIGPOCK1POS]; + bNewItemCount[BIGPOCK2POS] = DO_NOT_USE_bNewItemCount[OldInventory::BIGPOCK2POS]; + bNewItemCount[BIGPOCK3POS] = DO_NOT_USE_bNewItemCount[OldInventory::BIGPOCK3POS]; + bNewItemCount[BIGPOCK4POS] = DO_NOT_USE_bNewItemCount[OldInventory::BIGPOCK4POS]; + bNewItemCount[SMALLPOCK1POS] = DO_NOT_USE_bNewItemCount[OldInventory::SMALLPOCK1POS]; + bNewItemCount[SMALLPOCK2POS] = DO_NOT_USE_bNewItemCount[OldInventory::SMALLPOCK2POS]; + bNewItemCount[SMALLPOCK3POS] = DO_NOT_USE_bNewItemCount[OldInventory::SMALLPOCK3POS]; + bNewItemCount[SMALLPOCK4POS] = DO_NOT_USE_bNewItemCount[OldInventory::SMALLPOCK4POS]; + bNewItemCount[SMALLPOCK5POS] = DO_NOT_USE_bNewItemCount[OldInventory::SMALLPOCK5POS]; + bNewItemCount[SMALLPOCK6POS] = DO_NOT_USE_bNewItemCount[OldInventory::SMALLPOCK6POS]; + bNewItemCount[SMALLPOCK7POS] = DO_NOT_USE_bNewItemCount[OldInventory::SMALLPOCK7POS]; + bNewItemCount[SMALLPOCK8POS] = DO_NOT_USE_bNewItemCount[OldInventory::SMALLPOCK8POS]; - bNewItemCycleCount[OldInventory::HELMETPOS] = DO_NOT_USE_bNewItemCycleCount[HELMETPOS]; - bNewItemCycleCount[OldInventory::VESTPOS] = DO_NOT_USE_bNewItemCycleCount[VESTPOS]; - bNewItemCycleCount[OldInventory::LEGPOS] = DO_NOT_USE_bNewItemCycleCount[LEGPOS]; - bNewItemCycleCount[OldInventory::HEAD1POS] = DO_NOT_USE_bNewItemCycleCount[HEAD1POS]; - bNewItemCycleCount[OldInventory::HEAD2POS] = DO_NOT_USE_bNewItemCycleCount[HEAD2POS]; - bNewItemCycleCount[OldInventory::HANDPOS] = DO_NOT_USE_bNewItemCycleCount[HANDPOS]; - bNewItemCycleCount[OldInventory::SECONDHANDPOS] = DO_NOT_USE_bNewItemCycleCount[SECONDHANDPOS]; - bNewItemCycleCount[OldInventory::BIGPOCK1POS] = DO_NOT_USE_bNewItemCycleCount[BIGPOCK1POS]; - bNewItemCycleCount[OldInventory::BIGPOCK2POS] = DO_NOT_USE_bNewItemCycleCount[BIGPOCK2POS]; - bNewItemCycleCount[OldInventory::BIGPOCK3POS] = DO_NOT_USE_bNewItemCycleCount[BIGPOCK3POS]; - bNewItemCycleCount[OldInventory::BIGPOCK4POS] = DO_NOT_USE_bNewItemCycleCount[BIGPOCK4POS]; - bNewItemCycleCount[OldInventory::SMALLPOCK1POS] = DO_NOT_USE_bNewItemCycleCount[SMALLPOCK1POS]; - bNewItemCycleCount[OldInventory::SMALLPOCK2POS] = DO_NOT_USE_bNewItemCycleCount[SMALLPOCK2POS]; - bNewItemCycleCount[OldInventory::SMALLPOCK3POS] = DO_NOT_USE_bNewItemCycleCount[SMALLPOCK3POS]; - bNewItemCycleCount[OldInventory::SMALLPOCK4POS] = DO_NOT_USE_bNewItemCycleCount[SMALLPOCK4POS]; - bNewItemCycleCount[OldInventory::SMALLPOCK5POS] = DO_NOT_USE_bNewItemCycleCount[SMALLPOCK5POS]; - bNewItemCycleCount[OldInventory::SMALLPOCK6POS] = DO_NOT_USE_bNewItemCycleCount[SMALLPOCK6POS]; - bNewItemCycleCount[OldInventory::SMALLPOCK7POS] = DO_NOT_USE_bNewItemCycleCount[SMALLPOCK7POS]; - bNewItemCycleCount[OldInventory::SMALLPOCK8POS] = DO_NOT_USE_bNewItemCycleCount[SMALLPOCK8POS]; -} -void SOLDIERTYPE::CopyNewInventoryToOld() { - // Do not use a loop in case the new inventory slots are arranged differently than the old - DO_NOT_USE_Inv[OldInventory::HELMETPOS] = inv[HELMETPOS]; - DO_NOT_USE_Inv[OldInventory::VESTPOS] = inv[VESTPOS]; - DO_NOT_USE_Inv[OldInventory::LEGPOS] = inv[LEGPOS]; - DO_NOT_USE_Inv[OldInventory::HEAD1POS] = inv[HEAD1POS]; - DO_NOT_USE_Inv[OldInventory::HEAD2POS] = inv[HEAD2POS]; - DO_NOT_USE_Inv[OldInventory::HANDPOS] = inv[HANDPOS]; - DO_NOT_USE_Inv[OldInventory::SECONDHANDPOS] = inv[SECONDHANDPOS]; - DO_NOT_USE_Inv[OldInventory::BIGPOCK1POS] = inv[BIGPOCK1POS]; - DO_NOT_USE_Inv[OldInventory::BIGPOCK2POS] = inv[BIGPOCK2POS]; - DO_NOT_USE_Inv[OldInventory::BIGPOCK3POS] = inv[BIGPOCK3POS]; - DO_NOT_USE_Inv[OldInventory::BIGPOCK4POS] = inv[BIGPOCK4POS]; - DO_NOT_USE_Inv[OldInventory::SMALLPOCK1POS] = inv[SMALLPOCK1POS]; - DO_NOT_USE_Inv[OldInventory::SMALLPOCK2POS] = inv[SMALLPOCK2POS]; - DO_NOT_USE_Inv[OldInventory::SMALLPOCK3POS] = inv[SMALLPOCK3POS]; - DO_NOT_USE_Inv[OldInventory::SMALLPOCK4POS] = inv[SMALLPOCK4POS]; - DO_NOT_USE_Inv[OldInventory::SMALLPOCK5POS] = inv[SMALLPOCK5POS]; - DO_NOT_USE_Inv[OldInventory::SMALLPOCK6POS] = inv[SMALLPOCK6POS]; - DO_NOT_USE_Inv[OldInventory::SMALLPOCK7POS] = inv[SMALLPOCK7POS]; - DO_NOT_USE_Inv[OldInventory::SMALLPOCK8POS] = inv[SMALLPOCK8POS]; - - DO_NOT_USE_bNewItemCount[OldInventory::HELMETPOS] = bNewItemCount[HELMETPOS]; - DO_NOT_USE_bNewItemCount[OldInventory::VESTPOS] = bNewItemCount[VESTPOS]; - DO_NOT_USE_bNewItemCount[OldInventory::LEGPOS] = bNewItemCount[LEGPOS]; - DO_NOT_USE_bNewItemCount[OldInventory::HEAD1POS] = bNewItemCount[HEAD1POS]; - DO_NOT_USE_bNewItemCount[OldInventory::HEAD2POS] = bNewItemCount[HEAD2POS]; - DO_NOT_USE_bNewItemCount[OldInventory::HANDPOS] = bNewItemCount[HANDPOS]; - DO_NOT_USE_bNewItemCount[OldInventory::SECONDHANDPOS] = bNewItemCount[SECONDHANDPOS]; - DO_NOT_USE_bNewItemCount[OldInventory::BIGPOCK1POS] = bNewItemCount[BIGPOCK1POS]; - DO_NOT_USE_bNewItemCount[OldInventory::BIGPOCK2POS] = bNewItemCount[BIGPOCK2POS]; - DO_NOT_USE_bNewItemCount[OldInventory::BIGPOCK3POS] = bNewItemCount[BIGPOCK3POS]; - DO_NOT_USE_bNewItemCount[OldInventory::BIGPOCK4POS] = bNewItemCount[BIGPOCK4POS]; - DO_NOT_USE_bNewItemCount[OldInventory::SMALLPOCK1POS] = bNewItemCount[SMALLPOCK1POS]; - DO_NOT_USE_bNewItemCount[OldInventory::SMALLPOCK2POS] = bNewItemCount[SMALLPOCK2POS]; - DO_NOT_USE_bNewItemCount[OldInventory::SMALLPOCK3POS] = bNewItemCount[SMALLPOCK3POS]; - DO_NOT_USE_bNewItemCount[OldInventory::SMALLPOCK4POS] = bNewItemCount[SMALLPOCK4POS]; - DO_NOT_USE_bNewItemCount[OldInventory::SMALLPOCK5POS] = bNewItemCount[SMALLPOCK5POS]; - DO_NOT_USE_bNewItemCount[OldInventory::SMALLPOCK6POS] = bNewItemCount[SMALLPOCK6POS]; - DO_NOT_USE_bNewItemCount[OldInventory::SMALLPOCK7POS] = bNewItemCount[SMALLPOCK7POS]; - DO_NOT_USE_bNewItemCount[OldInventory::SMALLPOCK8POS] = bNewItemCount[SMALLPOCK8POS]; - - DO_NOT_USE_bNewItemCycleCount[OldInventory::HELMETPOS] = bNewItemCycleCount[HELMETPOS]; - DO_NOT_USE_bNewItemCycleCount[OldInventory::VESTPOS] = bNewItemCycleCount[VESTPOS]; - DO_NOT_USE_bNewItemCycleCount[OldInventory::LEGPOS] = bNewItemCycleCount[LEGPOS]; - DO_NOT_USE_bNewItemCycleCount[OldInventory::HEAD1POS] = bNewItemCycleCount[HEAD1POS]; - DO_NOT_USE_bNewItemCycleCount[OldInventory::HEAD2POS] = bNewItemCycleCount[HEAD2POS]; - DO_NOT_USE_bNewItemCycleCount[OldInventory::HANDPOS] = bNewItemCycleCount[HANDPOS]; - DO_NOT_USE_bNewItemCycleCount[OldInventory::SECONDHANDPOS] = bNewItemCycleCount[SECONDHANDPOS]; - DO_NOT_USE_bNewItemCycleCount[OldInventory::BIGPOCK1POS] = bNewItemCycleCount[BIGPOCK1POS]; - DO_NOT_USE_bNewItemCycleCount[OldInventory::BIGPOCK2POS] = bNewItemCycleCount[BIGPOCK2POS]; - DO_NOT_USE_bNewItemCycleCount[OldInventory::BIGPOCK3POS] = bNewItemCycleCount[BIGPOCK3POS]; - DO_NOT_USE_bNewItemCycleCount[OldInventory::BIGPOCK4POS] = bNewItemCycleCount[BIGPOCK4POS]; - DO_NOT_USE_bNewItemCycleCount[OldInventory::SMALLPOCK1POS] = bNewItemCycleCount[SMALLPOCK1POS]; - DO_NOT_USE_bNewItemCycleCount[OldInventory::SMALLPOCK2POS] = bNewItemCycleCount[SMALLPOCK2POS]; - DO_NOT_USE_bNewItemCycleCount[OldInventory::SMALLPOCK3POS] = bNewItemCycleCount[SMALLPOCK3POS]; - DO_NOT_USE_bNewItemCycleCount[OldInventory::SMALLPOCK4POS] = bNewItemCycleCount[SMALLPOCK4POS]; - DO_NOT_USE_bNewItemCycleCount[OldInventory::SMALLPOCK5POS] = bNewItemCycleCount[SMALLPOCK5POS]; - DO_NOT_USE_bNewItemCycleCount[OldInventory::SMALLPOCK6POS] = bNewItemCycleCount[SMALLPOCK6POS]; - DO_NOT_USE_bNewItemCycleCount[OldInventory::SMALLPOCK7POS] = bNewItemCycleCount[SMALLPOCK7POS]; - DO_NOT_USE_bNewItemCycleCount[OldInventory::SMALLPOCK8POS] = bNewItemCycleCount[SMALLPOCK8POS]; + bNewItemCycleCount[HELMETPOS] = DO_NOT_USE_bNewItemCycleCount[OldInventory::HELMETPOS]; + bNewItemCycleCount[VESTPOS] = DO_NOT_USE_bNewItemCycleCount[OldInventory::VESTPOS]; + bNewItemCycleCount[LEGPOS] = DO_NOT_USE_bNewItemCycleCount[OldInventory::LEGPOS]; + bNewItemCycleCount[HEAD1POS] = DO_NOT_USE_bNewItemCycleCount[OldInventory::HEAD1POS]; + bNewItemCycleCount[HEAD2POS] = DO_NOT_USE_bNewItemCycleCount[OldInventory::HEAD2POS]; + bNewItemCycleCount[HANDPOS] = DO_NOT_USE_bNewItemCycleCount[OldInventory::HANDPOS]; + bNewItemCycleCount[SECONDHANDPOS] = DO_NOT_USE_bNewItemCycleCount[OldInventory::SECONDHANDPOS]; + bNewItemCycleCount[BIGPOCK1POS] = DO_NOT_USE_bNewItemCycleCount[OldInventory::BIGPOCK1POS]; + bNewItemCycleCount[BIGPOCK2POS] = DO_NOT_USE_bNewItemCycleCount[OldInventory::BIGPOCK2POS]; + bNewItemCycleCount[BIGPOCK3POS] = DO_NOT_USE_bNewItemCycleCount[OldInventory::BIGPOCK3POS]; + bNewItemCycleCount[BIGPOCK4POS] = DO_NOT_USE_bNewItemCycleCount[OldInventory::BIGPOCK4POS]; + bNewItemCycleCount[SMALLPOCK1POS] = DO_NOT_USE_bNewItemCycleCount[OldInventory::SMALLPOCK1POS]; + bNewItemCycleCount[SMALLPOCK2POS] = DO_NOT_USE_bNewItemCycleCount[OldInventory::SMALLPOCK2POS]; + bNewItemCycleCount[SMALLPOCK3POS] = DO_NOT_USE_bNewItemCycleCount[OldInventory::SMALLPOCK3POS]; + bNewItemCycleCount[SMALLPOCK4POS] = DO_NOT_USE_bNewItemCycleCount[OldInventory::SMALLPOCK4POS]; + bNewItemCycleCount[SMALLPOCK5POS] = DO_NOT_USE_bNewItemCycleCount[OldInventory::SMALLPOCK5POS]; + bNewItemCycleCount[SMALLPOCK6POS] = DO_NOT_USE_bNewItemCycleCount[OldInventory::SMALLPOCK6POS]; + bNewItemCycleCount[SMALLPOCK7POS] = DO_NOT_USE_bNewItemCycleCount[OldInventory::SMALLPOCK7POS]; + bNewItemCycleCount[SMALLPOCK8POS] = DO_NOT_USE_bNewItemCycleCount[OldInventory::SMALLPOCK8POS]; } -// ---------------------------------------- - -MERCPROFILESTRUCT::MERCPROFILESTRUCT() : -inv(NUM_INV_SLOTS), -bInvStatus(inv.size()), -bInvNumber(inv.size()) +UINT32 MERCPROFILESTRUCT::GetChecksum( ) { -#if 0 - inv.reserve(NUM_INV_SLOTS); - bInvStatus.reserve(NUM_INV_SLOTS); - bInvNumber.reserve(NUM_INV_SLOTS); - for (int idx=0; idx < NUM_INV_SLOTS; ++idx) { - inv.push_back(0); - bInvStatus.push_back(0); - bInvNumber.push_back(0); + UINT32 uiChecksum = 1; + UINT32 uiLoop; + + uiChecksum += (this->bLife + 1); + uiChecksum *= (this->bLifeMax + 1); + uiChecksum += (this->bAgility + 1); + uiChecksum *= (this->bDexterity + 1); + uiChecksum += (this->bStrength + 1); + uiChecksum *= (this->bMarksmanship + 1); + uiChecksum += (this->bMedical + 1); + uiChecksum *= (this->bMechanical + 1); + uiChecksum += (this->bExplosive + 1); + + // put in some multipliers too! + uiChecksum *= (this->bExpLevel + 1); + + for ( uiLoop = 0; uiLoop < this->inv.size(); uiLoop++ ) + { + uiChecksum += this->inv[ uiLoop ]; + uiChecksum += this->bInvNumber[ uiLoop ]; } -#endif + + return( uiChecksum ); +} + +OLD_MERCPROFILESTRUCT_101::OLD_MERCPROFILESTRUCT_101() +{ + memset(this, 0, SIZEOF_OLD_MERCPROFILESTRUCT_101_POD); +} + +MERCPROFILESTRUCT::MERCPROFILESTRUCT() +{ initialize(); - - Assert(inv.size() == NUM_INV_SLOTS); - Assert(bInvStatus.size() == NUM_INV_SLOTS); - Assert(bInvStatus.size() == NUM_INV_SLOTS); - - // The following are based on the "old" MERCPROFILESTRUCT struct - // Remove these later - Assert(SIZEOF_MERCPROFILESTRUCT_POD == 0x2cc); //sizeof(OLD_MERCPROFILESTRUCT)); } // Copy Constructor -MERCPROFILESTRUCT::MERCPROFILESTRUCT(const MERCPROFILESTRUCT& src) { +MERCPROFILESTRUCT::MERCPROFILESTRUCT(const MERCPROFILESTRUCT& src) +{ memcpy(this, &src, SIZEOF_MERCPROFILESTRUCT_POD); inv = src.inv; bInvStatus = src.bInvStatus; bInvNumber = src.bInvNumber; +} - Assert(inv.size() == NUM_INV_SLOTS); - Assert(bInvStatus.size() == NUM_INV_SLOTS); - Assert(bInvStatus.size() == NUM_INV_SLOTS); +// Conversion Constructor +MERCPROFILESTRUCT& MERCPROFILESTRUCT::operator=(const OLD_MERCPROFILESTRUCT_101& src) +{ + //Why do we need this if the inv is an array of ints? Because some data will be lost otherwise! + if ((void*)this != (void*)&src) { + CopyOldInventoryToNew(src); + + //arrays + memcpy( &(this->zName), &(src.zName), sizeof(CHAR16) * NAME_LENGTH ); + memcpy( &(this->zNickname), &(src.zNickname), sizeof(CHAR16) * NICKNAME_LENGTH ); + memcpy( &(this->PANTS), &(src.PANTS), sizeof(PaletteRepID) ); // 30 + memcpy( &(this->VEST), &(src.VEST), sizeof(PaletteRepID) ); // 30 + memcpy( &(this->SKIN), &(src.SKIN), sizeof(PaletteRepID) ); // 30 + memcpy( &(this->HAIR), &(src.HAIR), sizeof(PaletteRepID) ); // 30 + + memcpy( &(this->bBuddy), &(src.bBuddy), 5 * sizeof (INT8)); + memcpy( &(this->bHated), &(src.bHated), 5 * sizeof (INT8)); + memcpy( &(this->ubRoomRangeStart), &(src.ubRoomRangeStart), 2 * sizeof (UINT8)); + memcpy( &(this->bMercTownReputation), &(src.bMercTownReputation), 20 * sizeof (INT8)); + memcpy( &(this->usApproachFactor), &(src.usApproachFactor), 4 * sizeof (UINT16)); + + memcpy( &(this->ubApproachVal), &(src.ubApproachVal), 4 * sizeof (UINT8)); + memcpy( &(this->ubApproachMod), &(src.ubApproachMod), 3 * 4 * sizeof (UINT8)); + memcpy( &(this->bMercOpinion), &(src.bMercOpinion), 75 * sizeof (INT8)); + + memcpy( &(this->usStatChangeChances), &(src.usStatChangeChances), 12 * sizeof (UINT16));// used strictly for balancing, never shown! + memcpy( &(this->usStatChangeSuccesses), &(src.usStatChangeSuccesses), 12 * sizeof (UINT16));// used strictly for balancing, never shown! + memcpy( &(this->ubRoomRangeEnd), &(src.ubRoomRangeEnd), 2 * sizeof (UINT8)); + memcpy( &(this->bHatedTime), &(src.bHatedTime), 5 * sizeof (INT8)); + memcpy( &(this->bHatedCount), &(src.bHatedCount), 5 * sizeof (INT8)); + + this->bLearnToLike = src.bLearnToLike; + this->uiAttnSound = src.uiAttnSound; + this->uiCurseSound = src.uiCurseSound; + this->uiDieSound = src.uiDieSound; + this->uiGoodSound = src.uiGoodSound; + this->uiGruntSound = src.uiGruntSound; + this->uiGrunt2Sound = src.uiGrunt2Sound; + this->uiOkSound = src.uiOkSound; + this->ubFaceIndex = src.ubFaceIndex; + this->bSex = src.bSex; + this->bArmourAttractiveness = src.bArmourAttractiveness; + this->ubMiscFlags2 = src.ubMiscFlags2; + this->bEvolution = src.bEvolution; + this->ubMiscFlags = src.ubMiscFlags; + this->bSexist = src.bSexist; + this->bLearnToHate = src.bLearnToHate; + + // skills + this->bStealRate = src.bStealRate; + this->bVocalVolume = src.bVocalVolume; + this->ubQuoteRecord = src.ubQuoteRecord; + this->bDeathRate = src.bDeathRate; + this->bScientific = src.bScientific; + + this->sExpLevelGain = src.sExpLevelGain; + this->sLifeGain = src.sLifeGain; + this->sAgilityGain = src.sAgilityGain; + this->sDexterityGain = src.sDexterityGain; + this->sWisdomGain = src.sWisdomGain; + this->sMarksmanshipGain = src.sMarksmanshipGain; + this->sMedicalGain = src.sMedicalGain; + this->sMechanicGain = src.sMechanicGain; + this->sExplosivesGain = src.sExplosivesGain; + + this->ubBodyType = src.ubBodyType; + this->bMedical = src.bMedical; + + this->usEyesX = src.usEyesX; + this->usEyesY = src.usEyesY; + this->usMouthX = src.usMouthX; + this->usMouthY = src.usMouthY; + this->uiEyeDelay = src.uiEyeDelay; + this->uiMouthDelay = src.uiMouthDelay; + this->uiBlinkFrequency = src.uiBlinkFrequency; + this->uiExpressionFrequency = src.uiExpressionFrequency; + this->sSectorX = src.sSectorX; + this->sSectorY = src.sSectorY; + + this->uiDayBecomesAvailable = src.uiDayBecomesAvailable;//day the merc will be available.used with the bMercStatus + + this->bStrength = src.bStrength; + + this->bLifeMax = src.bLifeMax; + this->bExpLevelDelta = src.bExpLevelDelta; + this->bLifeDelta = src.bLifeDelta; + this->bAgilityDelta = src.bAgilityDelta; + this->bDexterityDelta = src.bDexterityDelta; + this->bWisdomDelta = src.bWisdomDelta; + this->bMarksmanshipDelta = src.bMarksmanshipDelta; + this->bMedicalDelta = src.bMedicalDelta; + this->bMechanicDelta = src.bMechanicDelta; + this->bExplosivesDelta = src.bExplosivesDelta; + this->bStrengthDelta = src.bStrengthDelta; + this->bLeadershipDelta = src.bLeadershipDelta; + this->usKills = src.usKills; + this->usAssists = src.usAssists; + this->usShotsFired = src.usShotsFired; + this->usShotsHit = src.usShotsHit; + this->usBattlesFought = src.usBattlesFought; + this->usTimesWounded = src.usTimesWounded; + this->usTotalDaysServed = src.usTotalDaysServed; + + this->sLeadershipGain = src.sLeadershipGain; + this->sStrengthGain = src.sStrengthGain; + + + + // BODY TYPE SUBSITUTIONS + this->uiBodyTypeSubFlags = src.uiBodyTypeSubFlags; + + this->sSalary = src.sSalary; + this->bLife = src.bLife; + this->bDexterity = src.bDexterity;// dexterity (hand coord) value + this->bPersonalityTrait = src.bPersonalityTrait; + this->bSkillTrait = src.bSkillTrait; + + this->bReputationTolerance = src.bReputationTolerance; + this->bExplosive = src.bExplosive; + this->bSkillTrait2 = src.bSkillTrait2; + this->bLeadership = src.bLeadership; + + this->bExpLevel = src.bExpLevel;// general experience level + + this->bMarksmanship = src.bMarksmanship; + this->bMinService = src.bMinService; + this->bWisdom = src.bWisdom; + this->bResigned = src.bResigned; + this->bActive = src.bActive; + + this->bMainGunAttractiveness = src.bMainGunAttractiveness; + this->bAgility = src.bAgility;// agility (speed) value + + this->fUseProfileInsertionInfo = src.fUseProfileInsertionInfo;// Set to various flags, ( contained in TacticalSave.h ) + this->sGridNo = src.sGridNo;// The Gridno the NPC was in before leaving the sector + this->ubQuoteActionID = src.ubQuoteActionID; + this->bMechanical = src.bMechanical; + + this->ubInvUndroppable = src.ubInvUndroppable; + + this->ubStrategicInsertionCode = src.ubStrategicInsertionCode; + + + this->ubLastQuoteSaid = src.ubLastQuoteSaid; + + this->bRace = src.bRace; + this->bNationality = src.bNationality; + this->bAppearance = src.bAppearance; + this->bAppearanceCareLevel = src.bAppearanceCareLevel; + this->bRefinement = src.bRefinement; + this->bRefinementCareLevel = src.bRefinementCareLevel; + this->bHatedNationality = src.bHatedNationality; + this->bHatedNationalityCareLevel = src.bHatedNationalityCareLevel; + this->bRacist = src.bRacist; + this->uiWeeklySalary = src.uiWeeklySalary; + this->uiBiWeeklySalary = src.uiBiWeeklySalary; + this->bMedicalDeposit = src.bMedicalDeposit; + this->bAttitude = src.bAttitude; + this->bBaseMorale = src.bBaseMorale; + this->sMedicalDepositAmount = src.sMedicalDepositAmount; + + this->bTown = src.bTown; + this->bTownAttachment = src.bTownAttachment; + this->usOptionalGearCost = src.usOptionalGearCost; + this->bApproached = src.bApproached; + this->bMercStatus = src.bMercStatus;//The status of the merc.If negative, see flags at the top of this file.Positive:The number of days the merc is away for.0:Not hired but ready to be. + this->bLearnToLikeTime = src.bLearnToLikeTime; + this->bLearnToHateTime = src.bLearnToHateTime; + this->bLearnToLikeCount = src.bLearnToLikeCount; + this->bLearnToHateCount = src.bLearnToHateCount; + this->ubLastDateSpokenTo = src.ubLastDateSpokenTo; + this->bLastQuoteSaidWasSpecial = src.bLastQuoteSaidWasSpecial; + this->bSectorZ = src.bSectorZ; + this->usStrategicInsertionData = src.usStrategicInsertionData; + this->bFriendlyOrDirectDefaultResponseUsedRecently = src.bFriendlyOrDirectDefaultResponseUsedRecently; + this->bRecruitDefaultResponseUsedRecently = src.bRecruitDefaultResponseUsedRecently; + this->bThreatenDefaultResponseUsedRecently = src.bThreatenDefaultResponseUsedRecently; + this->bNPCData = src.bNPCData;// NPC specific + this->iBalance = src.iBalance; + this->sTrueSalary = src.sTrueSalary; // for use when the person is working for us for free but has a positive salary value + this->ubCivilianGroup = src.ubCivilianGroup; + this->ubNeedForSleep = src.ubNeedForSleep; + this->uiMoney = src.uiMoney; + this->bNPCData2 = src.bNPCData2;// NPC specific + + this->ubMiscFlags3 = src.ubMiscFlags3; + + this->ubDaysOfMoraleHangover = src.ubDaysOfMoraleHangover;// used only when merc leaves team while having poor morale + this->ubNumTimesDrugUseInLifetime = src.ubNumTimesDrugUseInLifetime;// The # times a drug has been used in the player's lifetime... + + // Flags used for the precedent to repeating oneself in Contract negotiations.Used for quote 80 -~107.Gets reset every day + this->uiPrecedentQuoteSaid = src.uiPrecedentQuoteSaid; + this->uiProfileChecksum = src.uiProfileChecksum; + this->sPreCombatGridNo = src.sPreCombatGridNo; + this->ubTimeTillNextHatedComplaint = src.ubTimeTillNextHatedComplaint; + this->ubSuspiciousDeath = src.ubSuspiciousDeath; + + this->iMercMercContractLength = src.iMercMercContractLength;//Used for MERC mercs, specifies how many days the merc has gone since last page + + this->uiTotalCostToDate = src.uiTotalCostToDate;// The total amount of money that has been paid to the merc for their salary + } + return *this; } // Assignment operator MERCPROFILESTRUCT& MERCPROFILESTRUCT::operator=(const MERCPROFILESTRUCT& src) { - if (this != &src) { + if (this != &src) { memcpy(this, &src, SIZEOF_MERCPROFILESTRUCT_POD); inv = src.inv; bInvStatus = src.bInvStatus; bInvNumber = src.bInvNumber; - } - Assert(inv.size() == NUM_INV_SLOTS); - Assert(bInvStatus.size() == NUM_INV_SLOTS); - Assert(bInvStatus.size() == NUM_INV_SLOTS); + } return *this; } // Destructor -MERCPROFILESTRUCT::~MERCPROFILESTRUCT() { +MERCPROFILESTRUCT::~MERCPROFILESTRUCT() +{ } -// Initialize the soldier. +// Initialize the soldier. // Use this instead of the old method of calling memset! // Note that the constructor does this automatically. -void MERCPROFILESTRUCT::initialize() { +void MERCPROFILESTRUCT::initialize() +{ memset( this, 0, SIZEOF_MERCPROFILESTRUCT_POD); clearInventory(); - Assert(inv.size() == NUM_INV_SLOTS); - Assert(bInvStatus.size() == NUM_INV_SLOTS); - Assert(bInvStatus.size() == NUM_INV_SLOTS); } -// Initialize the soldier. +// Initialize the soldier. // Use this instead of the old method of calling memset! // Note that the constructor does this automatically. -void MERCPROFILESTRUCT::clearInventory() { - for (vector::size_type idx=0; idx < inv.size(); ++idx) { - inv[idx] = 0; - bInvStatus[idx] = 0; - bInvNumber[idx] = 0; - } +void MERCPROFILESTRUCT::clearInventory() +{ + inv.clear(); + bInvStatus.clear(); + bInvNumber.clear(); - Assert(inv.size() == NUM_INV_SLOTS); - Assert(bInvStatus.size() == NUM_INV_SLOTS); - Assert(bInvStatus.size() == NUM_INV_SLOTS); + inv.resize(NUM_INV_SLOTS); + bInvStatus.resize(NUM_INV_SLOTS); + bInvNumber.resize(NUM_INV_SLOTS); } -// Ugly temporary solution -// -// These two functions map the "old" style inventory (fixed array of ) to the new (a flexibly sized vector). -// If you change names or eliminate some positions or such you need to change these. -// Eventually the need for these functions will disappear. - -void MERCPROFILESTRUCT::CopyOldInventoryToNew() { +void MERCPROFILESTRUCT::CopyOldInventoryToNew(const OLD_MERCPROFILESTRUCT_101& src) +{ // Do not use a loop in case the new inventory slots are arranged differently than the old - inv[HELMETPOS] = DO_NOT_USE_inv[OldInventory::HELMETPOS]; - inv[VESTPOS] = DO_NOT_USE_inv[OldInventory::VESTPOS]; - inv[LEGPOS] = DO_NOT_USE_inv[OldInventory::LEGPOS]; - inv[HEAD1POS] = DO_NOT_USE_inv[OldInventory::HEAD1POS]; - inv[HEAD2POS] = DO_NOT_USE_inv[OldInventory::HEAD2POS]; - inv[HANDPOS] = DO_NOT_USE_inv[OldInventory::HANDPOS]; - inv[SECONDHANDPOS] = DO_NOT_USE_inv[OldInventory::SECONDHANDPOS]; - inv[BIGPOCK1POS] = DO_NOT_USE_inv[OldInventory::BIGPOCK1POS]; - inv[BIGPOCK2POS] = DO_NOT_USE_inv[OldInventory::BIGPOCK2POS]; - inv[BIGPOCK3POS] = DO_NOT_USE_inv[OldInventory::BIGPOCK3POS]; - inv[BIGPOCK4POS] = DO_NOT_USE_inv[OldInventory::BIGPOCK4POS]; - inv[SMALLPOCK1POS] = DO_NOT_USE_inv[OldInventory::SMALLPOCK1POS]; - inv[SMALLPOCK2POS] = DO_NOT_USE_inv[OldInventory::SMALLPOCK2POS]; - inv[SMALLPOCK3POS] = DO_NOT_USE_inv[OldInventory::SMALLPOCK3POS]; - inv[SMALLPOCK4POS] = DO_NOT_USE_inv[OldInventory::SMALLPOCK4POS]; - inv[SMALLPOCK5POS] = DO_NOT_USE_inv[OldInventory::SMALLPOCK5POS]; - inv[SMALLPOCK6POS] = DO_NOT_USE_inv[OldInventory::SMALLPOCK6POS]; - inv[SMALLPOCK7POS] = DO_NOT_USE_inv[OldInventory::SMALLPOCK7POS]; - inv[SMALLPOCK8POS] = DO_NOT_USE_inv[OldInventory::SMALLPOCK8POS]; + inv[HELMETPOS] = src.DO_NOT_USE_inv[OldInventory::HELMETPOS]; + inv[VESTPOS] = src.DO_NOT_USE_inv[OldInventory::VESTPOS]; + inv[LEGPOS] = src.DO_NOT_USE_inv[OldInventory::LEGPOS]; + inv[HEAD1POS] = src.DO_NOT_USE_inv[OldInventory::HEAD1POS]; + inv[HEAD2POS] = src.DO_NOT_USE_inv[OldInventory::HEAD2POS]; + inv[HANDPOS] = src.DO_NOT_USE_inv[OldInventory::HANDPOS]; + inv[SECONDHANDPOS] = src.DO_NOT_USE_inv[OldInventory::SECONDHANDPOS]; + inv[BIGPOCK1POS] = src.DO_NOT_USE_inv[OldInventory::BIGPOCK1POS]; + inv[BIGPOCK2POS] = src.DO_NOT_USE_inv[OldInventory::BIGPOCK2POS]; + inv[BIGPOCK3POS] = src.DO_NOT_USE_inv[OldInventory::BIGPOCK3POS]; + inv[BIGPOCK4POS] = src.DO_NOT_USE_inv[OldInventory::BIGPOCK4POS]; + inv[SMALLPOCK1POS] = src.DO_NOT_USE_inv[OldInventory::SMALLPOCK1POS]; + inv[SMALLPOCK2POS] = src.DO_NOT_USE_inv[OldInventory::SMALLPOCK2POS]; + inv[SMALLPOCK3POS] = src.DO_NOT_USE_inv[OldInventory::SMALLPOCK3POS]; + inv[SMALLPOCK4POS] = src.DO_NOT_USE_inv[OldInventory::SMALLPOCK4POS]; + inv[SMALLPOCK5POS] = src.DO_NOT_USE_inv[OldInventory::SMALLPOCK5POS]; + inv[SMALLPOCK6POS] = src.DO_NOT_USE_inv[OldInventory::SMALLPOCK6POS]; + inv[SMALLPOCK7POS] = src.DO_NOT_USE_inv[OldInventory::SMALLPOCK7POS]; + inv[SMALLPOCK8POS] = src.DO_NOT_USE_inv[OldInventory::SMALLPOCK8POS]; - bInvStatus[OldInventory::HELMETPOS] = DO_NOT_USE_bInvStatus[HELMETPOS]; - bInvStatus[OldInventory::VESTPOS] = DO_NOT_USE_bInvStatus[VESTPOS]; - bInvStatus[OldInventory::LEGPOS] = DO_NOT_USE_bInvStatus[LEGPOS]; - bInvStatus[OldInventory::HEAD1POS] = DO_NOT_USE_bInvStatus[HEAD1POS]; - bInvStatus[OldInventory::HEAD2POS] = DO_NOT_USE_bInvStatus[HEAD2POS]; - bInvStatus[OldInventory::HANDPOS] = DO_NOT_USE_bInvStatus[HANDPOS]; - bInvStatus[OldInventory::SECONDHANDPOS] = DO_NOT_USE_bInvStatus[SECONDHANDPOS]; - bInvStatus[OldInventory::BIGPOCK1POS] = DO_NOT_USE_bInvStatus[BIGPOCK1POS]; - bInvStatus[OldInventory::BIGPOCK2POS] = DO_NOT_USE_bInvStatus[BIGPOCK2POS]; - bInvStatus[OldInventory::BIGPOCK3POS] = DO_NOT_USE_bInvStatus[BIGPOCK3POS]; - bInvStatus[OldInventory::BIGPOCK4POS] = DO_NOT_USE_bInvStatus[BIGPOCK4POS]; - bInvStatus[OldInventory::SMALLPOCK1POS] = DO_NOT_USE_bInvStatus[SMALLPOCK1POS]; - bInvStatus[OldInventory::SMALLPOCK2POS] = DO_NOT_USE_bInvStatus[SMALLPOCK2POS]; - bInvStatus[OldInventory::SMALLPOCK3POS] = DO_NOT_USE_bInvStatus[SMALLPOCK3POS]; - bInvStatus[OldInventory::SMALLPOCK4POS] = DO_NOT_USE_bInvStatus[SMALLPOCK4POS]; - bInvStatus[OldInventory::SMALLPOCK5POS] = DO_NOT_USE_bInvStatus[SMALLPOCK5POS]; - bInvStatus[OldInventory::SMALLPOCK6POS] = DO_NOT_USE_bInvStatus[SMALLPOCK6POS]; - bInvStatus[OldInventory::SMALLPOCK7POS] = DO_NOT_USE_bInvStatus[SMALLPOCK7POS]; - bInvStatus[OldInventory::SMALLPOCK8POS] = DO_NOT_USE_bInvStatus[SMALLPOCK8POS]; + bInvStatus[HELMETPOS] = src.DO_NOT_USE_bInvStatus[OldInventory::HELMETPOS]; + bInvStatus[VESTPOS] = src.DO_NOT_USE_bInvStatus[OldInventory::VESTPOS]; + bInvStatus[LEGPOS] = src.DO_NOT_USE_bInvStatus[OldInventory::LEGPOS]; + bInvStatus[HEAD1POS] = src.DO_NOT_USE_bInvStatus[OldInventory::HEAD1POS]; + bInvStatus[HEAD2POS] = src.DO_NOT_USE_bInvStatus[OldInventory::HEAD2POS]; + bInvStatus[HANDPOS] = src.DO_NOT_USE_bInvStatus[OldInventory::HANDPOS]; + bInvStatus[SECONDHANDPOS] = src.DO_NOT_USE_bInvStatus[OldInventory::SECONDHANDPOS]; + bInvStatus[BIGPOCK1POS] = src.DO_NOT_USE_bInvStatus[OldInventory::BIGPOCK1POS]; + bInvStatus[BIGPOCK2POS] = src.DO_NOT_USE_bInvStatus[OldInventory::BIGPOCK2POS]; + bInvStatus[BIGPOCK3POS] = src.DO_NOT_USE_bInvStatus[OldInventory::BIGPOCK3POS]; + bInvStatus[BIGPOCK4POS] = src.DO_NOT_USE_bInvStatus[OldInventory::BIGPOCK4POS]; + bInvStatus[SMALLPOCK1POS] = src.DO_NOT_USE_bInvStatus[OldInventory::SMALLPOCK1POS]; + bInvStatus[SMALLPOCK2POS] = src.DO_NOT_USE_bInvStatus[OldInventory::SMALLPOCK2POS]; + bInvStatus[SMALLPOCK3POS] = src.DO_NOT_USE_bInvStatus[OldInventory::SMALLPOCK3POS]; + bInvStatus[SMALLPOCK4POS] = src.DO_NOT_USE_bInvStatus[OldInventory::SMALLPOCK4POS]; + bInvStatus[SMALLPOCK5POS] = src.DO_NOT_USE_bInvStatus[OldInventory::SMALLPOCK5POS]; + bInvStatus[SMALLPOCK6POS] = src.DO_NOT_USE_bInvStatus[OldInventory::SMALLPOCK6POS]; + bInvStatus[SMALLPOCK7POS] = src.DO_NOT_USE_bInvStatus[OldInventory::SMALLPOCK7POS]; + bInvStatus[SMALLPOCK8POS] = src.DO_NOT_USE_bInvStatus[OldInventory::SMALLPOCK8POS]; - bInvNumber[OldInventory::HELMETPOS] = DO_NOT_USE_bInvNumber[HELMETPOS]; - bInvNumber[OldInventory::VESTPOS] = DO_NOT_USE_bInvNumber[VESTPOS]; - bInvNumber[OldInventory::LEGPOS] = DO_NOT_USE_bInvNumber[LEGPOS]; - bInvNumber[OldInventory::HEAD1POS] = DO_NOT_USE_bInvNumber[HEAD1POS]; - bInvNumber[OldInventory::HEAD2POS] = DO_NOT_USE_bInvNumber[HEAD2POS]; - bInvNumber[OldInventory::HANDPOS] = DO_NOT_USE_bInvNumber[HANDPOS]; - bInvNumber[OldInventory::SECONDHANDPOS] = DO_NOT_USE_bInvNumber[SECONDHANDPOS]; - bInvNumber[OldInventory::BIGPOCK1POS] = DO_NOT_USE_bInvNumber[BIGPOCK1POS]; - bInvNumber[OldInventory::BIGPOCK2POS] = DO_NOT_USE_bInvNumber[BIGPOCK2POS]; - bInvNumber[OldInventory::BIGPOCK3POS] = DO_NOT_USE_bInvNumber[BIGPOCK3POS]; - bInvNumber[OldInventory::BIGPOCK4POS] = DO_NOT_USE_bInvNumber[BIGPOCK4POS]; - bInvNumber[OldInventory::SMALLPOCK1POS] = DO_NOT_USE_bInvNumber[SMALLPOCK1POS]; - bInvNumber[OldInventory::SMALLPOCK2POS] = DO_NOT_USE_bInvNumber[SMALLPOCK2POS]; - bInvNumber[OldInventory::SMALLPOCK3POS] = DO_NOT_USE_bInvNumber[SMALLPOCK3POS]; - bInvNumber[OldInventory::SMALLPOCK4POS] = DO_NOT_USE_bInvNumber[SMALLPOCK4POS]; - bInvNumber[OldInventory::SMALLPOCK5POS] = DO_NOT_USE_bInvNumber[SMALLPOCK5POS]; - bInvNumber[OldInventory::SMALLPOCK6POS] = DO_NOT_USE_bInvNumber[SMALLPOCK6POS]; - bInvNumber[OldInventory::SMALLPOCK7POS] = DO_NOT_USE_bInvNumber[SMALLPOCK7POS]; - bInvNumber[OldInventory::SMALLPOCK8POS] = DO_NOT_USE_bInvNumber[SMALLPOCK8POS]; + bInvNumber[HELMETPOS] = src.DO_NOT_USE_bInvNumber[OldInventory::HELMETPOS]; + bInvNumber[VESTPOS] = src.DO_NOT_USE_bInvNumber[OldInventory::VESTPOS]; + bInvNumber[LEGPOS] = src.DO_NOT_USE_bInvNumber[OldInventory::LEGPOS]; + bInvNumber[HEAD1POS] = src.DO_NOT_USE_bInvNumber[OldInventory::HEAD1POS]; + bInvNumber[HEAD2POS] = src.DO_NOT_USE_bInvNumber[OldInventory::HEAD2POS]; + bInvNumber[HANDPOS] = src.DO_NOT_USE_bInvNumber[OldInventory::HANDPOS]; + bInvNumber[SECONDHANDPOS] = src.DO_NOT_USE_bInvNumber[OldInventory::SECONDHANDPOS]; + bInvNumber[BIGPOCK1POS] = src.DO_NOT_USE_bInvNumber[OldInventory::BIGPOCK1POS]; + bInvNumber[BIGPOCK2POS] = src.DO_NOT_USE_bInvNumber[OldInventory::BIGPOCK2POS]; + bInvNumber[BIGPOCK3POS] = src.DO_NOT_USE_bInvNumber[OldInventory::BIGPOCK3POS]; + bInvNumber[BIGPOCK4POS] = src.DO_NOT_USE_bInvNumber[OldInventory::BIGPOCK4POS]; + bInvNumber[SMALLPOCK1POS] = src.DO_NOT_USE_bInvNumber[OldInventory::SMALLPOCK1POS]; + bInvNumber[SMALLPOCK2POS] = src.DO_NOT_USE_bInvNumber[OldInventory::SMALLPOCK2POS]; + bInvNumber[SMALLPOCK3POS] = src.DO_NOT_USE_bInvNumber[OldInventory::SMALLPOCK3POS]; + bInvNumber[SMALLPOCK4POS] = src.DO_NOT_USE_bInvNumber[OldInventory::SMALLPOCK4POS]; + bInvNumber[SMALLPOCK5POS] = src.DO_NOT_USE_bInvNumber[OldInventory::SMALLPOCK5POS]; + bInvNumber[SMALLPOCK6POS] = src.DO_NOT_USE_bInvNumber[OldInventory::SMALLPOCK6POS]; + bInvNumber[SMALLPOCK7POS] = src.DO_NOT_USE_bInvNumber[OldInventory::SMALLPOCK7POS]; + bInvNumber[SMALLPOCK8POS] = src.DO_NOT_USE_bInvNumber[OldInventory::SMALLPOCK8POS]; } -void MERCPROFILESTRUCT::CopyNewInventoryToOld() { - // Do not use a loop in case the new inventory slots are arranged differently than the old - DO_NOT_USE_inv[OldInventory::HELMETPOS] = inv[HELMETPOS]; - DO_NOT_USE_inv[OldInventory::VESTPOS] = inv[VESTPOS]; - DO_NOT_USE_inv[OldInventory::LEGPOS] = inv[LEGPOS]; - DO_NOT_USE_inv[OldInventory::HEAD1POS] = inv[HEAD1POS]; - DO_NOT_USE_inv[OldInventory::HEAD2POS] = inv[HEAD2POS]; - DO_NOT_USE_inv[OldInventory::HANDPOS] = inv[HANDPOS]; - DO_NOT_USE_inv[OldInventory::SECONDHANDPOS] = inv[SECONDHANDPOS]; - DO_NOT_USE_inv[OldInventory::BIGPOCK1POS] = inv[BIGPOCK1POS]; - DO_NOT_USE_inv[OldInventory::BIGPOCK2POS] = inv[BIGPOCK2POS]; - DO_NOT_USE_inv[OldInventory::BIGPOCK3POS] = inv[BIGPOCK3POS]; - DO_NOT_USE_inv[OldInventory::BIGPOCK4POS] = inv[BIGPOCK4POS]; - DO_NOT_USE_inv[OldInventory::SMALLPOCK1POS] = inv[SMALLPOCK1POS]; - DO_NOT_USE_inv[OldInventory::SMALLPOCK2POS] = inv[SMALLPOCK2POS]; - DO_NOT_USE_inv[OldInventory::SMALLPOCK3POS] = inv[SMALLPOCK3POS]; - DO_NOT_USE_inv[OldInventory::SMALLPOCK4POS] = inv[SMALLPOCK4POS]; - DO_NOT_USE_inv[OldInventory::SMALLPOCK5POS] = inv[SMALLPOCK5POS]; - DO_NOT_USE_inv[OldInventory::SMALLPOCK6POS] = inv[SMALLPOCK6POS]; - DO_NOT_USE_inv[OldInventory::SMALLPOCK7POS] = inv[SMALLPOCK7POS]; - DO_NOT_USE_inv[OldInventory::SMALLPOCK8POS] = inv[SMALLPOCK8POS]; - - DO_NOT_USE_bInvStatus[OldInventory::HELMETPOS] = bInvStatus[HELMETPOS]; - DO_NOT_USE_bInvStatus[OldInventory::VESTPOS] = bInvStatus[VESTPOS]; - DO_NOT_USE_bInvStatus[OldInventory::LEGPOS] = bInvStatus[LEGPOS]; - DO_NOT_USE_bInvStatus[OldInventory::HEAD1POS] = bInvStatus[HEAD1POS]; - DO_NOT_USE_bInvStatus[OldInventory::HEAD2POS] = bInvStatus[HEAD2POS]; - DO_NOT_USE_bInvStatus[OldInventory::HANDPOS] = bInvStatus[HANDPOS]; - DO_NOT_USE_bInvStatus[OldInventory::SECONDHANDPOS] = bInvStatus[SECONDHANDPOS]; - DO_NOT_USE_bInvStatus[OldInventory::BIGPOCK1POS] = bInvStatus[BIGPOCK1POS]; - DO_NOT_USE_bInvStatus[OldInventory::BIGPOCK2POS] = bInvStatus[BIGPOCK2POS]; - DO_NOT_USE_bInvStatus[OldInventory::BIGPOCK3POS] = bInvStatus[BIGPOCK3POS]; - DO_NOT_USE_bInvStatus[OldInventory::BIGPOCK4POS] = bInvStatus[BIGPOCK4POS]; - DO_NOT_USE_bInvStatus[OldInventory::SMALLPOCK1POS] = bInvStatus[SMALLPOCK1POS]; - DO_NOT_USE_bInvStatus[OldInventory::SMALLPOCK2POS] = bInvStatus[SMALLPOCK2POS]; - DO_NOT_USE_bInvStatus[OldInventory::SMALLPOCK3POS] = bInvStatus[SMALLPOCK3POS]; - DO_NOT_USE_bInvStatus[OldInventory::SMALLPOCK4POS] = bInvStatus[SMALLPOCK4POS]; - DO_NOT_USE_bInvStatus[OldInventory::SMALLPOCK5POS] = bInvStatus[SMALLPOCK5POS]; - DO_NOT_USE_bInvStatus[OldInventory::SMALLPOCK6POS] = bInvStatus[SMALLPOCK6POS]; - DO_NOT_USE_bInvStatus[OldInventory::SMALLPOCK7POS] = bInvStatus[SMALLPOCK7POS]; - DO_NOT_USE_bInvStatus[OldInventory::SMALLPOCK8POS] = bInvStatus[SMALLPOCK8POS]; - - DO_NOT_USE_bInvNumber[OldInventory::HELMETPOS] = bInvNumber[HELMETPOS]; - DO_NOT_USE_bInvNumber[OldInventory::VESTPOS] = bInvNumber[VESTPOS]; - DO_NOT_USE_bInvNumber[OldInventory::LEGPOS] = bInvNumber[LEGPOS]; - DO_NOT_USE_bInvNumber[OldInventory::HEAD1POS] = bInvNumber[HEAD1POS]; - DO_NOT_USE_bInvNumber[OldInventory::HEAD2POS] = bInvNumber[HEAD2POS]; - DO_NOT_USE_bInvNumber[OldInventory::HANDPOS] = bInvNumber[HANDPOS]; - DO_NOT_USE_bInvNumber[OldInventory::SECONDHANDPOS] = bInvNumber[SECONDHANDPOS]; - DO_NOT_USE_bInvNumber[OldInventory::BIGPOCK1POS] = bInvNumber[BIGPOCK1POS]; - DO_NOT_USE_bInvNumber[OldInventory::BIGPOCK2POS] = bInvNumber[BIGPOCK2POS]; - DO_NOT_USE_bInvNumber[OldInventory::BIGPOCK3POS] = bInvNumber[BIGPOCK3POS]; - DO_NOT_USE_bInvNumber[OldInventory::BIGPOCK4POS] = bInvNumber[BIGPOCK4POS]; - DO_NOT_USE_bInvNumber[OldInventory::SMALLPOCK1POS] = bInvNumber[SMALLPOCK1POS]; - DO_NOT_USE_bInvNumber[OldInventory::SMALLPOCK2POS] = bInvNumber[SMALLPOCK2POS]; - DO_NOT_USE_bInvNumber[OldInventory::SMALLPOCK3POS] = bInvNumber[SMALLPOCK3POS]; - DO_NOT_USE_bInvNumber[OldInventory::SMALLPOCK4POS] = bInvNumber[SMALLPOCK4POS]; - DO_NOT_USE_bInvNumber[OldInventory::SMALLPOCK5POS] = bInvNumber[SMALLPOCK5POS]; - DO_NOT_USE_bInvNumber[OldInventory::SMALLPOCK6POS] = bInvNumber[SMALLPOCK6POS]; - DO_NOT_USE_bInvNumber[OldInventory::SMALLPOCK7POS] = bInvNumber[SMALLPOCK7POS]; - DO_NOT_USE_bInvNumber[OldInventory::SMALLPOCK8POS] = bInvNumber[SMALLPOCK8POS]; -} - BOOLEAN IsValidSecondHandShot( SOLDIERTYPE *pSoldier ); @@ -857,34 +1607,34 @@ void HandleVehicleMovementSound( SOLDIERTYPE *pSoldier, BOOLEAN fOn ) { if ( pVehicle->iMovementSoundID == NO_SAMPLE ) { - pVehicle->iMovementSoundID = PlayJA2Sample( pVehicle->iMoveSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + pVehicle->iMovementSoundID = PlayJA2Sample( pVehicle->iMoveSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } } else { if ( pVehicle->iMovementSoundID != NO_SAMPLE ) { - SoundStop( pVehicle->iMovementSoundID ); + SoundStop( pVehicle->iMovementSoundID ); pVehicle->iMovementSoundID = NO_SAMPLE; } } } -void AdjustNoAPToFinishMove( SOLDIERTYPE *pSoldier, BOOLEAN fSet ) +void SOLDIERTYPE::AdjustNoAPToFinishMove( BOOLEAN fSet ) { - if ( pSoldier->ubBodyType == CROW ) + if ( this->ubBodyType == CROW ) { return; } // Check if we are a vehicle first.... - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( this->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // Turn off sound effects.... if ( fSet ) { - HandleVehicleMovementSound( pSoldier, FALSE ); + HandleVehicleMovementSound( this, FALSE ); } } @@ -892,19 +1642,19 @@ void AdjustNoAPToFinishMove( SOLDIERTYPE *pSoldier, BOOLEAN fSet ) if ( fSet ) { // Position light.... - // SetCheckSoldierLightFlag( pSoldier ); + // this->SetCheckSoldierLightFlag( ); } else { - // DeleteSoldierLight( pSoldier ); + // this->DeleteSoldierLight( ); } - pSoldier->fNoAPToFinishMove = fSet; + this->flags.fNoAPToFinishMove = fSet; if ( !fSet ) { // return reason to default value - pSoldier->ubReasonCantFinishMove = REASON_STOPPED_NO_APS; + this->ubReasonCantFinishMove = REASON_STOPPED_NO_APS; } } @@ -912,7 +1662,7 @@ void HandleCrowShadowVisibility( SOLDIERTYPE *pSoldier ) { if ( pSoldier->ubBodyType == CROW ) { - if ( pSoldier->usAnimState == CROW_FLY ) + if ( pSoldier->usAnimState == CROW_FLY ) { if ( pSoldier->pAniTile != NULL ) { @@ -945,7 +1695,7 @@ void HandleCrowShadowNewGridNo( SOLDIERTYPE *pSoldier ) if ( pSoldier->sGridNo != NOWHERE ) { - if ( pSoldier->usAnimState == CROW_FLY ) + if ( pSoldier->usAnimState == CROW_FLY ) { AniParams.sGridNo = (INT16)pSoldier->sGridNo; AniParams.ubLevelID = ANI_SHADOW_LEVEL; @@ -972,7 +1722,7 @@ void HandleCrowShadowRemoveGridNo( SOLDIERTYPE *pSoldier ) { if ( pSoldier->ubBodyType == CROW ) { - if ( pSoldier->usAnimState == CROW_FLY ) + if ( pSoldier->usAnimState == CROW_FLY ) { if ( pSoldier->pAniTile != NULL ) { @@ -988,7 +1738,7 @@ void HandleCrowShadowNewDirection( SOLDIERTYPE *pSoldier ) { if ( pSoldier->ubBodyType == CROW ) { - if ( pSoldier->usAnimState == CROW_FLY ) + if ( pSoldier->usAnimState == CROW_FLY ) { if ( pSoldier->pAniTile != NULL ) { @@ -1002,7 +1752,7 @@ void HandleCrowShadowNewPosition( SOLDIERTYPE *pSoldier ) { if ( pSoldier->ubBodyType == CROW ) { - if ( pSoldier->usAnimState == CROW_FLY ) + if ( pSoldier->usAnimState == CROW_FLY ) { if ( pSoldier->pAniTile != NULL ) { @@ -1015,49 +1765,49 @@ void HandleCrowShadowNewPosition( SOLDIERTYPE *pSoldier ) -INT8 CalcActionPoints(SOLDIERTYPE *pSold) +INT8 SOLDIERTYPE::CalcActionPoints( void ) { UINT8 ubPoints,ubMaxAPs; INT8 bBandage; // dead guys don't get any APs (they shouldn't be here asking for them!) - if (!pSold->bLife) + if (!this->stats.bLife) return(0); // people with sleep dart drug who have collapsed get no APs - if ( (pSold->bSleepDrugCounter > 0) && pSold->bCollapsed ) + if ( (this->bSleepDrugCounter > 0) && this->bCollapsed ) return( 0 ); // Calculate merc's action points at 100% capability (range is 10 - 25) // round fractions of .5 up (that's why the +20 before the division! - ubPoints = 5 + (((10 * EffectiveExpLevel( pSold ) + - 3 * EffectiveAgility( pSold ) + - 2 * pSold->bLifeMax + - 2 * EffectiveDexterity( pSold ) ) + 20) / 40); + ubPoints = 5 + (((10 * EffectiveExpLevel( this ) + + 3 * EffectiveAgility( this ) + + 2 * this->stats.bLifeMax + + 2 * EffectiveDexterity( this ) ) + 20) / 40); //if (GameOption[INCREASEDAP] % 2 == 1) //points += AP_INCREASE; //Madd: Add in AP Bonuses (Penalties) from worn gear - ubPoints += GetGearAPBonus ( pSold ); + ubPoints += GetGearAPBonus ( this ); // Calculate bandage - bBandage = pSold->bLifeMax - pSold->bLife - pSold->bBleeding; + bBandage = this->stats.bLifeMax - this->stats.bLife - this->bBleeding; // If injured, reduce action points accordingly (by up to 2/3rds) - if (pSold->bLife < pSold->bLifeMax) + if (this->stats.bLife < this->stats.bLifeMax) { - ubPoints -= (2 * ubPoints * (pSold->bLifeMax - pSold->bLife + (bBandage / 2))) / - (3 * pSold->bLifeMax); + ubPoints -= (2 * ubPoints * (this->stats.bLifeMax - this->stats.bLife + (bBandage / 2))) / + (3 * this->stats.bLifeMax); } // If tired, reduce action points accordingly (by up to 1/2) - if (pSold->bBreath < 100) - ubPoints -= (ubPoints * (100 - pSold->bBreath)) / 200; + if (this->bBreath < 100) + ubPoints -= (ubPoints * (100 - this->bBreath)) / 200; - if (pSold->sWeightCarriedAtTurnStart > 100) + if (this->sWeightCarriedAtTurnStart > 100) { - ubPoints = (UINT8) ( ((UINT32)ubPoints) * 100 / pSold->sWeightCarriedAtTurnStart ); + ubPoints = (UINT8) ( ((UINT32)ubPoints) * 100 / this->sWeightCarriedAtTurnStart ); } // If resulting APs are below our permitted minimum, raise them to it! @@ -1065,7 +1815,7 @@ INT8 CalcActionPoints(SOLDIERTYPE *pSold) ubPoints = AP_MINIMUM; // make sure action points doesn't exceed the permitted maximum - ubMaxAPs = gubMaxActionPoints[ pSold->ubBodyType ]; + ubMaxAPs = gubMaxActionPoints[ this->ubBodyType ]; //if (GameOption[INCREASEDAP] % 2 == 1) // maxAPs += AP_INCREASE; @@ -1075,21 +1825,21 @@ INT8 CalcActionPoints(SOLDIERTYPE *pSold) if (ubPoints > ubMaxAPs) ubPoints = ubMaxAPs; - if ( pSold->ubBodyType == BLOODCAT ) + if ( this->ubBodyType == BLOODCAT ) { // use same as young monsters ubPoints = (ubPoints * AP_YOUNG_MONST_FACTOR) / 10; } - else if (pSold->uiStatusFlags & SOLDIER_MONSTER) + else if (this->flags.uiStatusFlags & SOLDIER_MONSTER) { // young monsters get extra APs - if ( pSold->ubBodyType == YAF_MONSTER || pSold->ubBodyType == YAM_MONSTER || pSold->ubBodyType == INFANT_MONSTER ) + if ( this->ubBodyType == YAF_MONSTER || this->ubBodyType == YAM_MONSTER || this->ubBodyType == INFANT_MONSTER ) { ubPoints = (ubPoints * AP_YOUNG_MONST_FACTOR) / 10; } // if frenzied, female monsters get more APs! (for young females, cumulative!) - if (pSold->bFrenzied) + if (this->aiData.bFrenzied) { ubPoints = (ubPoints * AP_MONST_FRENZY_FACTOR) / 10; @@ -1097,35 +1847,35 @@ INT8 CalcActionPoints(SOLDIERTYPE *pSold) } // adjust APs for phobia situations - if ( pSold->ubProfile != NO_PROFILE ) + if ( this->ubProfile != NO_PROFILE ) { - if ( (gMercProfiles[ pSold->ubProfile ].bPersonalityTrait == CLAUSTROPHOBIC) && (gbWorldSectorZ > 0) ) + if ( (gMercProfiles[ this->ubProfile ].bPersonalityTrait == CLAUSTROPHOBIC) && (gbWorldSectorZ > 0) ) { ubPoints = (ubPoints * AP_CLAUSTROPHOBE) / 10; } - else if ( (gMercProfiles[ pSold->ubProfile ].bPersonalityTrait == FEAR_OF_INSECTS) && (MercSeesCreature( pSold ) ) ) + else if ( (gMercProfiles[ this->ubProfile ].bPersonalityTrait == FEAR_OF_INSECTS) && (MercSeesCreature( this ) ) ) { ubPoints = (ubPoints * AP_AFRAID_OF_INSECTS) / 10; } } // Adjusat APs due to drugs... - HandleAPEffectDueToDrugs( pSold, &ubPoints ); + HandleAPEffectDueToDrugs( this, &ubPoints ); // If we are a vehicle, adjust APS... - if ( pSold->uiStatusFlags & SOLDIER_VEHICLE ) + if ( this->flags.uiStatusFlags & SOLDIER_VEHICLE ) { - AdjustVehicleAPs( pSold, &ubPoints ); + AdjustVehicleAPs( this, &ubPoints ); } //Madd - // if ( pSold->bTeam != CIV_TEAM && pSold->bTeam != gbPlayerNum && gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE ) + // if ( this->bTeam != CIV_TEAM && this->bTeam != gbPlayerNum && gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE ) // ubPoints += 5; // everything and everyone moves a little faster against you on insane... //Kaiden: Took your idea a step further adding the bonus for each difficulty level // and then externalized it. AND added it to the Dont max out points section below. - if ( pSold->bTeam != CIV_TEAM && pSold->bTeam != gbPlayerNum) + if ( this->bTeam != CIV_TEAM && this->bTeam != gbPlayerNum) { switch( gGameOptions.ubDifficultyLevel ) @@ -1147,7 +1897,7 @@ INT8 CalcActionPoints(SOLDIERTYPE *pSold) case DIF_LEVEL_INSANE: - ubPoints += gGameExternalOptions.iInsaneAPBonus; + ubPoints += gGameExternalOptions.iInsaneAPBonus; break; default: @@ -1166,72 +1916,72 @@ INT8 CalcActionPoints(SOLDIERTYPE *pSold) return (ubPoints); } -void CalcNewActionPoints( SOLDIERTYPE *pSoldier ) +void SOLDIERTYPE::CalcNewActionPoints( void ) { if ( gTacticalStatus.bBoxingState == BOXING || gTacticalStatus.bBoxingState == PRE_BOXING ) { // if we are in boxing mode, carry 1/2 as many points - if (pSoldier->bActionPoints > MAX_AP_CARRIED / 2) + if (this->bActionPoints > MAX_AP_CARRIED / 2) { - pSoldier->bActionPoints = MAX_AP_CARRIED / 2; + this->bActionPoints = MAX_AP_CARRIED / 2; } } else { - if (pSoldier->bActionPoints > MAX_AP_CARRIED) + if (this->bActionPoints > MAX_AP_CARRIED) { - pSoldier->bActionPoints = MAX_AP_CARRIED; + this->bActionPoints = MAX_AP_CARRIED; } } - pSoldier->bActionPoints += CalcActionPoints( pSoldier); + this->bActionPoints += this->CalcActionPoints( ); // Don't max out if we are drugged.... - if ( !GetDrugEffect( pSoldier, DRUG_TYPE_ADRENALINE ) ) + if ( !GetDrugEffect( this, DRUG_TYPE_ADRENALINE ) ) { //Kaiden: If Enemy, they can max out, but their Max is NOW = MAX + diffAPBonus // No sense in giving them a bonus if some of the points are wasted because we // Didn't raise their cap by the same amount. - if ( pSoldier->bTeam != CIV_TEAM && pSoldier->bTeam != gbPlayerNum) + if ( this->bTeam != CIV_TEAM && this->bTeam != gbPlayerNum) { switch( gGameOptions.ubDifficultyLevel ) { case DIF_LEVEL_EASY: - pSoldier->bActionPoints = __min( pSoldier->bActionPoints, (gubMaxActionPoints[ pSoldier->ubBodyType ] + gGameExternalOptions.iEasyAPBonus)); + this->bActionPoints = __min( this->bActionPoints, (gubMaxActionPoints[ this->ubBodyType ] + gGameExternalOptions.iEasyAPBonus)); break; case DIF_LEVEL_MEDIUM: - pSoldier->bActionPoints = __min( pSoldier->bActionPoints, (gubMaxActionPoints[ pSoldier->ubBodyType ] + gGameExternalOptions.iExperiencedAPBonus)); + this->bActionPoints = __min( this->bActionPoints, (gubMaxActionPoints[ this->ubBodyType ] + gGameExternalOptions.iExperiencedAPBonus)); break; case DIF_LEVEL_HARD: - pSoldier->bActionPoints = __min( pSoldier->bActionPoints, (gubMaxActionPoints[ pSoldier->ubBodyType ] + gGameExternalOptions.iExpertAPBonus)); + this->bActionPoints = __min( this->bActionPoints, (gubMaxActionPoints[ this->ubBodyType ] + gGameExternalOptions.iExpertAPBonus)); break; case DIF_LEVEL_INSANE: - pSoldier->bActionPoints = __min( pSoldier->bActionPoints, (gubMaxActionPoints[ pSoldier->ubBodyType ] + gGameExternalOptions.iInsaneAPBonus)); + this->bActionPoints = __min( this->bActionPoints, (gubMaxActionPoints[ this->ubBodyType ] + gGameExternalOptions.iInsaneAPBonus)); break; default: - pSoldier->bActionPoints = __min( pSoldier->bActionPoints, gubMaxActionPoints[ pSoldier->ubBodyType ] ); + this->bActionPoints = __min( this->bActionPoints, gubMaxActionPoints[ this->ubBodyType ] ); } } else { //Kaiden: Players just max out normally unless drugged - pSoldier->bActionPoints = __min( pSoldier->bActionPoints, (gubMaxActionPoints[ pSoldier->ubBodyType ] + gGameExternalOptions.iPlayerAPBonus) ); + this->bActionPoints = __min( this->bActionPoints, (gubMaxActionPoints[ this->ubBodyType ] + gGameExternalOptions.iPlayerAPBonus) ); } } - pSoldier->bInitialActionPoints = pSoldier->bActionPoints; + this->bInitialActionPoints = this->bActionPoints; } -void DoNinjaAttack( SOLDIERTYPE *pSoldier ) +void SOLDIERTYPE::DoNinjaAttack( void ) { //UINT32 uiMercFlags; UINT16 usSoldierIndex; @@ -1240,19 +1990,19 @@ void DoNinjaAttack( SOLDIERTYPE *pSoldier ) UINT8 ubTargetStance; - usSoldierIndex = WhoIsThere2( pSoldier->sTargetGridNo, pSoldier->bLevel ); + usSoldierIndex = WhoIsThere2( this->sTargetGridNo, this->pathing.bLevel ); if ( usSoldierIndex != NOBODY ) - { - GetSoldier( &pTSoldier, usSoldierIndex ); + { + GetSoldier( &pTSoldier, usSoldierIndex ); // Look at stance of target ubTargetStance = gAnimControl[ pTSoldier->usAnimState ].ubEndHeight; // Get his life...if < certain value, do finish! - if ( (pTSoldier->bLife <= 30 || pTSoldier->bBreath <= 30) && ubTargetStance != ANIM_PRONE ) + if ( (pTSoldier->stats.bLife <= 30 || pTSoldier->bBreath <= 30) && ubTargetStance != ANIM_PRONE ) { // Do finish! - ChangeSoldierState( pSoldier, NINJA_SPINKICK, 0 , FALSE ); + this->ChangeSoldierState( NINJA_SPINKICK, 0 , FALSE ); } else { @@ -1260,19 +2010,19 @@ void DoNinjaAttack( SOLDIERTYPE *pSoldier ) { if ( Random( 2 ) == 0 ) { - ChangeSoldierState( pSoldier, NINJA_LOWKICK, 0 , FALSE ); + this->ChangeSoldierState( NINJA_LOWKICK, 0 , FALSE ); } else { - ChangeSoldierState( pSoldier, NINJA_PUNCH, 0 , FALSE ); + this->ChangeSoldierState( NINJA_PUNCH, 0 , FALSE ); } // CHECK IF HE CAN SEE US, IF SO CHANGE DIRECTION - if ( pTSoldier->bOppList[ pSoldier->ubID ] == 0 && pTSoldier->bTeam != pSoldier->bTeam ) + if ( pTSoldier->aiData.bOppList[ this->ubID ] == 0 && pTSoldier->bTeam != this->bTeam ) { - if ( !( pTSoldier->uiStatusFlags & ( SOLDIER_MONSTER | SOLDIER_ANIMAL | SOLDIER_VEHICLE ) ) ) + if ( !( pTSoldier->flags.uiStatusFlags & ( SOLDIER_MONSTER | SOLDIER_ANIMAL | SOLDIER_VEHICLE ) ) ) { - ubTDirection = (UINT8)GetDirectionFromGridNo( pSoldier->sGridNo, pTSoldier ); + ubTDirection = (UINT8)GetDirectionFromGridNo( this->sGridNo, pTSoldier ); SendSoldierSetDesiredDirectionEvent( pTSoldier, ubTDirection ); } } @@ -1280,23 +2030,23 @@ void DoNinjaAttack( SOLDIERTYPE *pSoldier ) else { // CHECK OUR STANCE - if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_CROUCH ) + if ( gAnimControl[ this->usAnimState ].ubEndHeight != ANIM_CROUCH ) { // SET DESIRED STANCE AND SET PENDING ANIMATION - SendChangeSoldierStanceEvent( pSoldier, ANIM_CROUCH ); - pSoldier->usPendingAnimation = PUNCH_LOW; + SendChangeSoldierStanceEvent( this, ANIM_CROUCH ); + this->usPendingAnimation = PUNCH_LOW; } else { // USE crouched one // NEED TO CHANGE STANCE IF NOT CROUCHD! - EVENT_InitNewSoldierAnim( pSoldier, PUNCH_LOW, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( PUNCH_LOW, 0 , FALSE ); } } } } - if ( pSoldier->ubProfile == 33 ) + if ( this->ubProfile == 33 ) { UINT32 uiSoundID; SOUNDPARMS spParms; @@ -1309,15 +2059,15 @@ void DoNinjaAttack( SOLDIERTYPE *pSoldier ) spParms.uiVolume = (INT8)CalculateSpeechVolume( HIGHVOLUME ); // If we are an enemy.....reduce due to volume - if ( pSoldier->bTeam != gbPlayerNum ) + if ( this->bTeam != gbPlayerNum ) { - spParms.uiVolume = SoundVolume( (UINT8)spParms.uiVolume, pSoldier->sGridNo ); + spParms.uiVolume = SoundVolume( (UINT8)spParms.uiVolume, this->sGridNo ); } spParms.uiLoop = 1; - spParms.uiPan = SoundDir( pSoldier->sGridNo ); + spParms.uiPan = SoundDir( this->sGridNo ); spParms.uiPriority=GROUP_PLAYER; - if ( pSoldier->usAnimState == NINJA_SPINKICK ) + if ( this->usAnimState == NINJA_SPINKICK ) { uiSoundID = SoundPlay( "BATTLESNDS\\033_CHOP2.WAV", &spParms ); } @@ -1336,12 +2086,12 @@ void DoNinjaAttack( SOLDIERTYPE *pSoldier ) if ( uiSoundID != SOUND_ERROR ) { - pSoldier->uiBattleSoundID = uiSoundID; + this->uiBattleSoundID = uiSoundID; - if ( pSoldier->ubProfile != NO_PROFILE ) + if ( this->ubProfile != NO_PROFILE ) { // Get soldier's face ID - iFaceIndex = pSoldier->iFaceIndex; + iFaceIndex = this->iFaceIndex; // Check face index if ( iFaceIndex != -1 ) @@ -1355,7 +2105,7 @@ void DoNinjaAttack( SOLDIERTYPE *pSoldier ) } -BOOLEAN CreateSoldierCommon( UINT8 ubBodyType, SOLDIERTYPE *pSoldier, UINT16 usSoldierID, UINT16 usState ) +BOOLEAN SOLDIERTYPE::CreateSoldierCommon( UINT8 ubBodyType, UINT16 usSoldierID, UINT16 usState ) { BOOLEAN fSuccess = FALSE; INT32 iCounter = 0; @@ -1364,30 +2114,30 @@ BOOLEAN CreateSoldierCommon( UINT8 ubBodyType, SOLDIERTYPE *pSoldier, UINT16 usS if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { // Set initial values for opplist! - InitSoldierOppList( pSoldier ); - HandleSight( pSoldier, SIGHT_LOOK ); + InitSoldierOppList( this ); + HandleSight( this, SIGHT_LOOK ); // Set some quote flags - if ( pSoldier->bLife >= OKLIFE ) + if ( this->stats.bLife >= OKLIFE ) { - pSoldier->fDyingComment = FALSE; + this->flags.fDyingComment = FALSE; } else { - pSoldier->fDyingComment = TRUE; + this->flags.fDyingComment = TRUE; } } // ATE: Reset some timer flags... - pSoldier->uiTimeSameBattleSndDone = 0; + this->uiTimeSameBattleSndDone = 0; // ATE: Reset every time..... - pSoldier->fSoldierWasMoving = TRUE; - pSoldier->iTuringSoundID = NO_SAMPLE; - pSoldier->uiTimeSinceLastBleedGrunt = 0; + this->flags.fSoldierWasMoving = TRUE; + this->iTuringSoundID = NO_SAMPLE; + this->uiTimeSinceLastBleedGrunt = 0; - if ( pSoldier->ubBodyType == QUEENMONSTER ) + if ( this->ubBodyType == QUEENMONSTER ) { - pSoldier->iPositionSndID = NewPositionSnd( NOWHERE, POSITION_SOUND_FROM_SOLDIER, (UINT32)pSoldier, QUEEN_AMBIENT_NOISE ); + this->iPositionSndID = NewPositionSnd( NOWHERE, POSITION_SOUND_FROM_SOLDIER, (UINT32)this, QUEEN_AMBIENT_NOISE ); } @@ -1397,20 +2147,20 @@ BOOLEAN CreateSoldierCommon( UINT8 ubBodyType, SOLDIERTYPE *pSoldier, UINT16 usS if (usSoldierID <= gTacticalStatus.Team[ OUR_TEAM ].bLastID) { - pSoldier->pKeyRing = (KEY_ON_RING *) MemAlloc( NUM_KEYS * sizeof( KEY_ON_RING ) ); - memset( pSoldier->pKeyRing , 0, NUM_KEYS * sizeof( KEY_ON_RING ) ); + this->pKeyRing = (KEY_ON_RING *) MemAlloc( NUM_KEYS * sizeof( KEY_ON_RING ) ); + memset( this->pKeyRing , 0, NUM_KEYS * sizeof( KEY_ON_RING ) ); for( iCounter = 0; iCounter < NUM_KEYS; iCounter++ ) { - pSoldier->pKeyRing[ iCounter ].ubKeyID = INVALID_KEY_NUMBER; + this->pKeyRing[ iCounter ].ubKeyID = INVALID_KEY_NUMBER; } } else { - pSoldier->pKeyRing = NULL; + this->pKeyRing = NULL; } // Create frame cache - if( InitAnimationCache( usSoldierID, &( pSoldier->AnimCache) ) == FALSE ) + if( InitAnimationCache( usSoldierID, &( this->AnimCache) ) == FALSE ) { DebugMsg( TOPIC_JA2, DBG_LEVEL_0, String( "Soldier: Failed animation cache creation" ) ); break; @@ -1422,17 +2172,17 @@ BOOLEAN CreateSoldierCommon( UINT8 ubBodyType, SOLDIERTYPE *pSoldier, UINT16 usS // OFFSET FIRST ANIMATION FRAME FOR NEW MERCS if ( usState != STANDING ) { - EVENT_InitNewSoldierAnim( pSoldier, usState, (UINT8)0, TRUE ); + this->EVENT_InitNewSoldierAnim( usState, (UINT8)0, TRUE ); } else { - EVENT_InitNewSoldierAnim( pSoldier, usState, (UINT8)Random( 10 ), TRUE ); + this->EVENT_InitNewSoldierAnim( usState, (UINT8)Random( 10 ), TRUE ); } } else { /// if we don't have a world loaded, and are in a bad anim, goto standing. - // bad anims are: HOPFENCE, + // bad anims are: HOPFENCE, // CLIMBDOWNROOF, FALLFORWARD_ROOF,FALLOFF, CLIMBUPROOF if( !gfWorldLoaded && ( usState == HOPFENCE || @@ -1441,36 +2191,36 @@ BOOLEAN CreateSoldierCommon( UINT8 ubBodyType, SOLDIERTYPE *pSoldier, UINT16 usS usState == FALLOFF || usState == CLIMBUPROOF ) ) { - EVENT_InitNewSoldierAnim( pSoldier, STANDING, 0, TRUE ); + this->EVENT_InitNewSoldierAnim( STANDING, 0, TRUE ); } else { - EVENT_InitNewSoldierAnim( pSoldier, usState, pSoldier->usAniCode, TRUE ); + this->EVENT_InitNewSoldierAnim( usState, this->usAniCode, TRUE ); } } - //if ( pSoldier->pBackGround != NULL ) - // MemFree( pSoldier->pBackGround ); + //if ( this->pBackGround != NULL ) + // MemFree( this->pBackGround ); // INIT ANIMATION DATA - //if((pSoldier->pBackGround=MemAlloc(SOLDIER_UNBLIT_SIZE))==NULL) + //if((this->pBackGround=MemAlloc(SOLDIER_UNBLIT_SIZE))==NULL) //{ // DebugMsg( TOPIC_JA2, DBG_LEVEL_0, String( "Soldier: Failed unblit memory allocation" ) ); // break; //} - //memset(pSoldier->pBackGround, 0, SOLDIER_UNBLIT_SIZE); + //memset(this->pBackGround, 0, SOLDIER_UNBLIT_SIZE); - //if((pSoldier->pZBackground=MemAlloc(SOLDIER_UNBLIT_SIZE))==NULL) + //if((this->pZBackground=MemAlloc(SOLDIER_UNBLIT_SIZE))==NULL) //{ // DebugMsg( TOPIC_JA2, DBG_LEVEL_0, String( "Soldier: Failed unblit memory allocation" ) ); // break; //} - //memset(pSoldier->pZBackground, 0, SOLDIER_UNBLIT_SIZE); + //memset(this->pZBackground, 0, SOLDIER_UNBLIT_SIZE); // Init palettes - if( CreateSoldierPalettes( pSoldier ) == FALSE ) + if( this->CreateSoldierPalettes( ) == FALSE ) { DebugMsg( TOPIC_JA2, DBG_LEVEL_0, String( "Soldier: Failed in creating soldier palettes" ) ); break; @@ -1482,7 +2232,7 @@ BOOLEAN CreateSoldierCommon( UINT8 ubBodyType, SOLDIERTYPE *pSoldier, UINT16 usS if ( !fSuccess ) { - DeleteSoldier( (pSoldier ) ); + this->DeleteSoldier( ); } return( fSuccess ); @@ -1491,27 +2241,27 @@ BOOLEAN CreateSoldierCommon( UINT8 ubBodyType, SOLDIERTYPE *pSoldier, UINT16 usS -BOOLEAN DeleteSoldier( SOLDIERTYPE *pSoldier ) +BOOLEAN SOLDIERTYPE::DeleteSoldier( void ) { UINT32 cnt; INT32 iGridNo; INT8 bDir; BOOLEAN fRet; - if ( pSoldier != NULL ) + if ( this != NULL ) { - //if(pSoldier->pBackGround!=NULL) - //MemFree(pSoldier->pBackGround); + //if(this->pBackGround!=NULL) + //MemFree(this->pBackGround); - //if(pSoldier->pZBackground!=NULL) - //MemFree(pSoldier->pZBackground); + //if(this->pZBackground!=NULL) + //MemFree(this->pZBackground); - if( pSoldier->sGridNo != NOWHERE ) + if( this->sGridNo != NOWHERE ) { // Remove adjacency records for (bDir = 0; bDir < NUM_WORLD_DIRECTIONS; bDir++) { - iGridNo = pSoldier->sGridNo + DirIncrementer[ bDir ]; + iGridNo = this->sGridNo + DirIncrementer[ bDir ]; if( iGridNo >= 0 && iGridNo < WORLD_MAX ) { gpWorldLevelData[ iGridNo ].ubAdjacentSoldierCnt--; @@ -1520,170 +2270,170 @@ BOOLEAN DeleteSoldier( SOLDIERTYPE *pSoldier ) } // Delete key ring - if (pSoldier->pKeyRing) + if (this->pKeyRing) { - MemFree( pSoldier->pKeyRing ); - pSoldier->pKeyRing = NULL; + MemFree( this->pKeyRing ); + this->pKeyRing = NULL; } // Delete faces - DeleteSoldierFace( pSoldier ); + DeleteSoldierFace( this ); // FREE PALETTES - if ( pSoldier->p8BPPPalette != NULL ) + if ( this->p8BPPPalette != NULL ) { - MemFree( pSoldier->p8BPPPalette ); - pSoldier->p8BPPPalette = NULL; + MemFree( this->p8BPPPalette ); + this->p8BPPPalette = NULL; } - if ( pSoldier->p16BPPPalette != NULL ) + if ( this->p16BPPPalette != NULL ) { - MemFree( pSoldier->p16BPPPalette ); - pSoldier->p16BPPPalette = NULL; + MemFree( this->p16BPPPalette ); + this->p16BPPPalette = NULL; } for ( cnt = 0; cnt < NUM_SOLDIER_SHADES; cnt++ ) { - if ( pSoldier->pShades[ cnt ] != NULL ) + if ( this->pShades[ cnt ] != NULL ) { - MemFree( pSoldier->pShades[ cnt ] ); - pSoldier->pShades[ cnt ] = NULL; + MemFree( this->pShades[ cnt ] ); + this->pShades[ cnt ] = NULL; } } for ( cnt = 0; cnt < NUM_SOLDIER_EFFECTSHADES; cnt++ ) { - if ( pSoldier->pEffectShades[ cnt ] != NULL ) + if ( this->pEffectShades[ cnt ] != NULL ) { - MemFree( pSoldier->pEffectShades[ cnt ] ); - pSoldier->pEffectShades[ cnt ] = NULL; + MemFree( this->pEffectShades[ cnt ] ); + this->pEffectShades[ cnt ] = NULL; } } // Delete glows for ( cnt = 0; cnt < 20; cnt++ ) { - if ( pSoldier->pGlowShades[ cnt ] != NULL ) + if ( this->pGlowShades[ cnt ] != NULL ) { - MemFree( pSoldier->pGlowShades[ cnt ] ); - pSoldier->pGlowShades[ cnt ] = NULL; + MemFree( this->pGlowShades[ cnt ] ); + this->pGlowShades[ cnt ] = NULL; } } - if ( pSoldier->ubBodyType == QUEENMONSTER ) + if ( this->ubBodyType == QUEENMONSTER ) { - DeletePositionSnd( pSoldier->iPositionSndID ); + DeletePositionSnd( this->iPositionSndID ); } // Free any animations we may have locked... - UnLoadCachedAnimationSurfaces( pSoldier->ubID, &( pSoldier->AnimCache) ); + UnLoadCachedAnimationSurfaces( this->ubID, &( this->AnimCache) ); // Free Animation cache - DeleteAnimationCache( pSoldier->ubID, &( pSoldier->AnimCache) ); + DeleteAnimationCache( this->ubID, &( this->AnimCache) ); // Soldier is not active - pSoldier->bActive = FALSE; + this->bActive = FALSE; // Remove light - DeleteSoldierLight( pSoldier ); + this->DeleteSoldierLight( ); // Remove reseved movement value - UnMarkMovementReserved( pSoldier ); + UnMarkMovementReserved( this ); } // REMOVE SOLDIER FROM SLOT! - fRet = RemoveMercSlot( pSoldier ); + fRet = RemoveMercSlot( this ); if (!fRet) { - RemoveAwaySlot( pSoldier ); + RemoveAwaySlot( this ); } return( TRUE ); } -BOOLEAN CreateSoldierLight( SOLDIERTYPE *pSoldier ) +BOOLEAN SOLDIERTYPE::CreateSoldierLight( void ) { - if ( pSoldier->bTeam != gbPlayerNum ) + if ( this->bTeam != gbPlayerNum ) { return( FALSE ); } // DO ONLY IF WE'RE AT A GOOD LEVEL - if ( pSoldier->iLight == -1 ) + if ( this->iLight == -1 ) { // ATE: Check for goggles in headpos.... - if ( GetTotalVisionRangeBonus( pSoldier, NORMAL_LIGHTLEVEL_NIGHT ) >= UVGOGGLES_BONUS ) + if ( GetTotalVisionRangeBonus( this, NORMAL_LIGHTLEVEL_NIGHT ) >= UVGOGGLES_BONUS ) { - if( ( pSoldier->iLight=LightSpriteCreate("Light4", 0 ) )==(-1)) + if( ( this->iLight=LightSpriteCreate("Light4", 0 ) )==(-1)) { DebugMsg( TOPIC_JA2, DBG_LEVEL_0, String( "Soldier: Failed loading light" ) ); return( FALSE ); } else { - LightSprites[ pSoldier->iLight ].uiFlags |= MERC_LIGHT; + LightSprites[ this->iLight ].uiFlags |= MERC_LIGHT; } } - else if ( GetTotalVisionRangeBonus( pSoldier, NORMAL_LIGHTLEVEL_NIGHT ) >= NIGHTSIGHTGOGGLES_BONUS ) + else if ( GetTotalVisionRangeBonus( this, NORMAL_LIGHTLEVEL_NIGHT ) >= NIGHTSIGHTGOGGLES_BONUS ) { - if( ( pSoldier->iLight=LightSpriteCreate("Light3", 0 ) )==(-1)) + if( ( this->iLight=LightSpriteCreate("Light3", 0 ) )==(-1)) { DebugMsg( TOPIC_JA2, DBG_LEVEL_0, String( "Soldier: Failed loading light" ) ); return( FALSE ); } else { - LightSprites[ pSoldier->iLight ].uiFlags |= MERC_LIGHT; + LightSprites[ this->iLight ].uiFlags |= MERC_LIGHT; } } else { - if( ( pSoldier->iLight=LightSpriteCreate("Light2", 0 ) )==(-1)) + if( ( this->iLight=LightSpriteCreate("Light2", 0 ) )==(-1)) { DebugMsg( TOPIC_JA2, DBG_LEVEL_0, String( "Soldier: Failed loading light" ) ); return( FALSE ); } else { - LightSprites[ pSoldier->iLight ].uiFlags |= MERC_LIGHT; + LightSprites[ this->iLight ].uiFlags |= MERC_LIGHT; } } - if ( pSoldier->bLevel != 0 ) + if ( this->pathing.bLevel != 0 ) { - LightSpriteRoofStatus(pSoldier->iLight, TRUE ); + LightSpriteRoofStatus(this->iLight, TRUE ); } } return( TRUE ); } -BOOLEAN ReCreateSoldierLight( SOLDIERTYPE *pSoldier ) +BOOLEAN SOLDIERTYPE::ReCreateSoldierLight( void ) { - if ( pSoldier->bTeam != gbPlayerNum ) + if ( this->bTeam != gbPlayerNum ) { return( FALSE ); } - if ( !pSoldier->bActive ) + if ( !this->bActive ) { return( FALSE ); } - if ( !pSoldier->bInSector ) + if ( !this->bInSector ) { return( FALSE ); } // Delete Light! - DeleteSoldierLight( pSoldier ); + this->DeleteSoldierLight( ); - if ( pSoldier->iLight == -1 ) + if ( this->iLight == -1 ) { - CreateSoldierLight( pSoldier ); + this->CreateSoldierLight( ); } return( TRUE ); @@ -1701,16 +2451,16 @@ BOOLEAN ReCreateSelectedSoldierLight( ) pSoldier = MercPtrs[ gusSelectedSoldier ]; - return( ReCreateSoldierLight( pSoldier ) ); + return( pSoldier->ReCreateSoldierLight( ) ); } -BOOLEAN DeleteSoldierLight( SOLDIERTYPE *pSoldier ) +BOOLEAN SOLDIERTYPE::DeleteSoldierLight( void ) { - if( pSoldier->iLight!=(-1) ) + if( this->iLight!=(-1) ) { - LightSpriteDestroy( pSoldier->iLight ); - pSoldier->iLight = -1; + LightSpriteDestroy( this->iLight ); + this->iLight = -1; } return( TRUE ); @@ -1719,22 +2469,22 @@ BOOLEAN DeleteSoldierLight( SOLDIERTYPE *pSoldier ) // FUNCTIONS CALLED BY EVENT PUMP ///////////////////////////////// -BOOLEAN ChangeSoldierState( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT16 usStartingAniCode, BOOLEAN fForce ) +BOOLEAN SOLDIERTYPE::ChangeSoldierState( UINT16 usNewState, UINT16 usStartingAniCode, BOOLEAN fForce ) { EV_S_CHANGESTATE SChangeState; // Send message that we have changed states SChangeState.usNewState = usNewState; - SChangeState.usSoldierID = pSoldier->ubID; - SChangeState.uiUniqueId = pSoldier -> uiUniqueSoldierIdValue; + SChangeState.usSoldierID = this->ubID; + SChangeState.uiUniqueId = this->uiUniqueSoldierIdValue; SChangeState.usStartingAniCode = usStartingAniCode; - SChangeState.sXPos = pSoldier->sX; - SChangeState.sYPos = pSoldier->sY; + SChangeState.sXPos = this->sX; + SChangeState.sYPos = this->sY; SChangeState.fForce = fForce; - SChangeState.uiUniqueId = pSoldier -> uiUniqueSoldierIdValue; + SChangeState.uiUniqueId = this->uiUniqueSoldierIdValue; //AddGameEvent( S_CHANGESTATE, 0, &SChangeState ); - EVENT_InitNewSoldierAnim( pSoldier, SChangeState.usNewState, SChangeState.usStartingAniCode, SChangeState.fForce ); + this->EVENT_InitNewSoldierAnim( SChangeState.usNewState, SChangeState.usStartingAniCode, SChangeState.fForce ); return( TRUE ); @@ -1750,18 +2500,18 @@ BOOLEAN ReevaluateEnemyStance( SOLDIERTYPE *pSoldier, UINT16 usAnimState ) INT16 sDist, sClosestDist = 10000; // make the chosen one not turn to face us - if ( OK_ENEMY_MERC( pSoldier ) && pSoldier->ubID != gTacticalStatus.ubTheChosenOne && gAnimControl[ usAnimState ].ubEndHeight == ANIM_STAND && !( pSoldier->uiStatusFlags & SOLDIER_UNDERAICONTROL) ) + if ( OK_ENEMY_MERC( pSoldier ) && pSoldier->ubID != gTacticalStatus.ubTheChosenOne && gAnimControl[ usAnimState ].ubEndHeight == ANIM_STAND && !( pSoldier->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL) ) { - if ( pSoldier->bTurningFromPronePosition == TURNING_FROM_PRONE_OFF ) + if ( pSoldier->flags.bTurningFromPronePosition == TURNING_FROM_PRONE_OFF ) { // If we are a queen and see enemies, goto ready if ( pSoldier->ubBodyType == QUEENMONSTER ) { if ( gAnimControl[ usAnimState ].uiFlags & ( ANIM_BREATH ) ) { - if ( pSoldier->bOppCnt > 0 ) + if ( pSoldier->aiData.bOppCnt > 0 ) { - EVENT_InitNewSoldierAnim( pSoldier, QUEEN_INTO_READY, 0 , TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( QUEEN_INTO_READY, 0 , TRUE ); return( TRUE ); } } @@ -1775,12 +2525,12 @@ BOOLEAN ReevaluateEnemyStance( SOLDIERTYPE *pSoldier, UINT16 usAnimState ) if ( gAnimControl[ usAnimState ].uiFlags & ( ANIM_MERCIDLE | ANIM_BREATH ) ) { - if ( pSoldier->bOppCnt > 0 ) + if ( pSoldier->aiData.bOppCnt > 0 ) { // Pick a guy this buddy sees and turn towards them! for ( cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++ ) { - if ( pSoldier->bOppList[ cnt ] == SEEN_CURRENTLY ) + if ( pSoldier->aiData.bOppList[ cnt ] == SEEN_CURRENTLY ) { sDist = PythSpacesAway( pSoldier->sGridNo, MercPtrs[ cnt ]->sGridNo ); if (sDist < sClosestDist) @@ -1796,10 +2546,10 @@ BOOLEAN ReevaluateEnemyStance( SOLDIERTYPE *pSoldier, UINT16 usAnimState ) // Change to fire ready animation ConvertGridNoToXY( MercPtrs[ iClosestEnemy ]->sGridNo, &sTargetXPos, &sTargetYPos ); - pSoldier->fDontChargeReadyAPs = TRUE; + pSoldier->flags.fDontChargeReadyAPs = TRUE; // Ready weapon - fReturnVal = SoldierReadyWeapon( pSoldier, sTargetXPos, sTargetYPos, FALSE ); + fReturnVal = pSoldier->SoldierReadyWeapon( sTargetXPos, sTargetYPos, FALSE ); return( fReturnVal ); } @@ -1825,7 +2575,7 @@ void CheckForFreeupFromHit( SOLDIERTYPE *pSoldier, UINT32 uiOldAnimFlags, UINT32 return; } - if ( usOldAniState != usNewState && ( uiOldAnimFlags & ANIM_HITSTART ) && !( uiNewAnimFlags & ANIM_HITFINISH ) && !( uiNewAnimFlags & ANIM_IGNOREHITFINISH ) && !(pSoldier->uiStatusFlags & SOLDIER_TURNINGFROMHIT ) ) + if ( usOldAniState != usNewState && ( uiOldAnimFlags & ANIM_HITSTART ) && !( uiNewAnimFlags & ANIM_HITFINISH ) && !( uiNewAnimFlags & ANIM_IGNOREHITFINISH ) && !(pSoldier->flags.uiStatusFlags & SOLDIER_TURNINGFROMHIT ) ) { // 0verhaul: Yet again, this is handled by the state transition code. // Release attacker @@ -1833,21 +2583,21 @@ void CheckForFreeupFromHit( SOLDIERTYPE *pSoldier, UINT32 uiOldAnimFlags, UINT32 // ReleaseSoldiersAttacker( pSoldier ); //FREEUP GETTING HIT FLAG - // pSoldier->fGettingHit = FALSE; + // pSoldier->flags.fGettingHit = FALSE; // ATE: if our guy, have 10% change of say damn, if still conscious... - if ( pSoldier->bTeam == gbPlayerNum && pSoldier->bLife >= OKLIFE ) + if ( pSoldier->bTeam == gbPlayerNum && pSoldier->stats.bLife >= OKLIFE ) { if ( Random( 10 ) == 0 ) { - DoMercBattleSound( pSoldier, (INT8)( BATTLE_SOUND_CURSE1 ) ); + pSoldier->DoMercBattleSound( (INT8)( BATTLE_SOUND_CURSE1 ) ); } } } // CHECK IF WE HAVE FINSIHED A HIT WHILE DOWN // OBLY DO THIS IF 1 ) We are dead already or 2 ) We are alive still - if ( ( uiOldAnimFlags & ANIM_HITWHENDOWN ) && ( ( pSoldier->uiStatusFlags & SOLDIER_DEAD ) || pSoldier->bLife != 0 ) ) + if ( ( uiOldAnimFlags & ANIM_HITWHENDOWN ) && ( ( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) || pSoldier->stats.bLife != 0 ) ) { // 0verhaul: Ditto // Release attacker @@ -1855,9 +2605,9 @@ void CheckForFreeupFromHit( SOLDIERTYPE *pSoldier, UINT32 uiOldAnimFlags, UINT32 // ReleaseSoldiersAttacker( pSoldier ); //FREEUP GETTING HIT FLAG - // pSoldier->fGettingHit = FALSE; + // pSoldier->flags.fGettingHit = FALSE; - if ( pSoldier->bLife == 0 ) + if ( pSoldier->stats.bLife == 0 ) { //ATE: Set previous attacker's value! // This is so that the killer can say their killed quote.... @@ -1868,10 +2618,10 @@ void CheckForFreeupFromHit( SOLDIERTYPE *pSoldier, UINT32 uiOldAnimFlags, UINT32 // THIS IS CALLED FROM AN EVENT ( S_CHANGESTATE )! -BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT16 usStartingAniCode, BOOLEAN fForce ) +BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStartingAniCode, BOOLEAN fForce ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,"EVENT_InitNewSoldierAnim"); - UINT16 usNewGridNo = 0; + INT16 sNewGridNo = 0; INT16 sAPCost = 0; INT16 sBPCost = 0; UINT32 uiOldAnimFlags; @@ -1890,12 +2640,12 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { // CHECK IF WE ARE TRYING TO INTURRUPT A SCRIPT WHICH WE DO NOT WANT INTERRUPTED! - if ( pSoldier->fInNonintAnim ) + if ( this->flags.fInNonintAnim ) { return( FALSE ); } - if ( pSoldier->fRTInNonintAnim ) + if ( this->flags.fRTInNonintAnim ) { if ( !(gTacticalStatus.uiFlags & INCOMBAT) ) { @@ -1903,18 +2653,18 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT } else { - pSoldier->fRTInNonintAnim = FALSE; + this->flags.fRTInNonintAnim = FALSE; } } // Check if we can restart this animation if it's the same as our current! - if ( usNewState == pSoldier->usAnimState ) + if ( usNewState == this->usAnimState ) { - if ( ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_NORESTART ) && !fForce ) - { + if ( ( gAnimControl[ this->usAnimState ].uiFlags & ANIM_NORESTART ) && !fForce ) + { fTryingToRestart = TRUE; - } + } } // Check state, if we are not at the same height, set this ani as the pending one and @@ -1922,40 +2672,40 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT // ATE: ONLY IF WE ARE STARTING AT START OF ANIMATION! if ( usStartingAniCode == 0 ) { - if ( gAnimControl[ usNewState ].ubHeight != gAnimControl[ pSoldier->usAnimState ].ubEndHeight && + if ( gAnimControl[ usNewState ].ubHeight != gAnimControl[ this->usAnimState ].ubEndHeight && !( gAnimControl[ usNewState ].uiFlags & ( ANIM_STANCECHANGEANIM | ANIM_IGNORE_AUTOSTANCE ) ) ) { // Check if we are going from crouched height to prone height, and adjust fast turning accordingly // Make guy turn while crouched THEN go into prone - if ( ( gAnimControl[ usNewState ].ubEndHeight == ANIM_PRONE && gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_CROUCH ) && !( gTacticalStatus.uiFlags & INCOMBAT ) ) + if ( ( gAnimControl[ usNewState ].ubEndHeight == ANIM_PRONE && gAnimControl[ this->usAnimState ].ubEndHeight == ANIM_CROUCH ) && !( gTacticalStatus.uiFlags & INCOMBAT ) ) { - pSoldier->fTurningUntilDone = TRUE; - pSoldier->ubPendingStanceChange = gAnimControl[ usNewState ].ubEndHeight; - pSoldier->usPendingAnimation = usNewState; + this->flags.fTurningUntilDone = TRUE; + this->ubPendingStanceChange = gAnimControl[ usNewState ].ubEndHeight; + this->usPendingAnimation = usNewState; return( TRUE ); } // Check if we are in realtime and we are going from stand to crouch - else if ( gAnimControl[ usNewState ].ubEndHeight == ANIM_CROUCH && gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_STAND && ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_MOVING ) && ( ( gTacticalStatus.uiFlags & REALTIME ) || !( gTacticalStatus.uiFlags & INCOMBAT ) ) ) + else if ( gAnimControl[ usNewState ].ubEndHeight == ANIM_CROUCH && gAnimControl[ this->usAnimState ].ubEndHeight == ANIM_STAND && ( gAnimControl[ this->usAnimState ].uiFlags & ANIM_MOVING ) && ( ( gTacticalStatus.uiFlags & REALTIME ) || !( gTacticalStatus.uiFlags & INCOMBAT ) ) ) { - pSoldier->ubDesiredHeight = gAnimControl[ usNewState ].ubEndHeight; + this->ubDesiredHeight = gAnimControl[ usNewState ].ubEndHeight; // Continue with this course of action IE: Do animation and skip from stand to crouch } // Check if we are in realtime and we are going from crouch to stand - else if ( gAnimControl[ usNewState ].ubEndHeight == ANIM_STAND && gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_CROUCH && ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_MOVING ) && ( ( gTacticalStatus.uiFlags & REALTIME ) || !( gTacticalStatus.uiFlags & INCOMBAT ) ) && pSoldier->usAnimState != HELIDROP ) + else if ( gAnimControl[ usNewState ].ubEndHeight == ANIM_STAND && gAnimControl[ this->usAnimState ].ubEndHeight == ANIM_CROUCH && ( gAnimControl[ this->usAnimState ].uiFlags & ANIM_MOVING ) && ( ( gTacticalStatus.uiFlags & REALTIME ) || !( gTacticalStatus.uiFlags & INCOMBAT ) ) && this->usAnimState != HELIDROP ) { - pSoldier->ubDesiredHeight = gAnimControl[ usNewState ].ubEndHeight; + this->ubDesiredHeight = gAnimControl[ usNewState ].ubEndHeight; // Continue with this course of action IE: Do animation and skip from stand to crouch } else { // ONLY DO FOR EVERYONE BUT PLANNING GUYS - if ( pSoldier->ubID < MAX_NUM_SOLDIERS ) + if ( this->ubID < MAX_NUM_SOLDIERS ) { // Set our next moving animation to be pending, after - pSoldier->usPendingAnimation = usNewState; + this->usPendingAnimation = usNewState; // Set new state to be animation to move to new stance - SendChangeSoldierStanceEvent( pSoldier, gAnimControl[ usNewState ].ubHeight ); + SendChangeSoldierStanceEvent( this, gAnimControl[ usNewState ].ubHeight ); return( TRUE ); } } @@ -1964,13 +2714,13 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT if ( usNewState == ADJACENT_GET_ITEM ) { - if ( pSoldier->ubPendingDirection != NO_PENDING_DIRECTION ) + if ( this->ubPendingDirection != NO_PENDING_DIRECTION ) { - EVENT_InternalSetSoldierDesiredDirection( pSoldier, pSoldier->ubPendingDirection, FALSE, pSoldier->usAnimState ); - pSoldier->ubPendingDirection = NO_PENDING_DIRECTION; - pSoldier->usPendingAnimation = ADJACENT_GET_ITEM; - pSoldier->fTurningUntilDone = TRUE; - SoldierGotoStationaryStance( pSoldier ); + EVENT_InternalSetSoldierDesiredDirection( this, this->ubPendingDirection, FALSE, this->usAnimState ); + this->ubPendingDirection = NO_PENDING_DIRECTION; + this->usPendingAnimation = ADJACENT_GET_ITEM; + this->flags.fTurningUntilDone = TRUE; + this->SoldierGotoStationaryStance( ); return( TRUE ); } } @@ -1978,57 +2728,56 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT if ( usNewState == CLIMBUPROOF ) { - if ( pSoldier->ubPendingDirection != NO_PENDING_DIRECTION ) + if ( this->ubPendingDirection != NO_PENDING_DIRECTION ) { - EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubPendingDirection ); - pSoldier->ubPendingDirection = NO_PENDING_DIRECTION; - pSoldier->usPendingAnimation = CLIMBUPROOF; - pSoldier->fTurningUntilDone = TRUE; - SoldierGotoStationaryStance( pSoldier ); + this->EVENT_SetSoldierDesiredDirection( this->ubPendingDirection ); + this->ubPendingDirection = NO_PENDING_DIRECTION; + this->usPendingAnimation = CLIMBUPROOF; + this->flags.fTurningUntilDone = TRUE; + this->SoldierGotoStationaryStance( ); return( TRUE ); } } if ( usNewState == CLIMBDOWNROOF ) { - if ( pSoldier->ubPendingDirection != NO_PENDING_DIRECTION ) + if ( this->ubPendingDirection != NO_PENDING_DIRECTION ) { - EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubPendingDirection ); - pSoldier->ubPendingDirection = NO_PENDING_DIRECTION; - pSoldier->usPendingAnimation = CLIMBDOWNROOF; - pSoldier->bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; - pSoldier->fTurningUntilDone = TRUE; - SoldierGotoStationaryStance( pSoldier ); + this->EVENT_SetSoldierDesiredDirection( this->ubPendingDirection ); + this->ubPendingDirection = NO_PENDING_DIRECTION; + this->usPendingAnimation = CLIMBDOWNROOF; + this->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; + this->flags.fTurningUntilDone = TRUE; + this->SoldierGotoStationaryStance( ); return( TRUE ); } } // ATE: Don't raise/lower automatically if we are low on health, // as our gun looks lowered anyway.... - //if ( pSoldier->bLife > INJURED_CHANGE_THREASHOLD ) + //if ( this->stats.bLife > INJURED_CHANGE_THREASHOLD ) { // Don't do some of this if we are a monster! // ATE: LOWER AIMATION IS GOOD, RAISE ONE HOWEVER MAY CAUSE PROBLEMS FOR AI.... - if ( !(pSoldier->uiStatusFlags & SOLDIER_MONSTER ) && pSoldier->ubBodyType != ROBOTNOWEAPON && pSoldier->bTeam == gbPlayerNum ) + if ( !(this->flags.uiStatusFlags & SOLDIER_MONSTER ) && this->ubBodyType != ROBOTNOWEAPON && this->bTeam == gbPlayerNum ) { // If this animation is a raise_weapon animation - if ( ( gAnimControl[ usNewState ].uiFlags & ANIM_RAISE_WEAPON ) && !( gAnimControl[ pSoldier->usAnimState ].uiFlags & ( ANIM_RAISE_WEAPON | ANIM_NOCHANGE_WEAPON ) ) ) + if ( ( gAnimControl[ usNewState ].uiFlags & ANIM_RAISE_WEAPON ) && !( gAnimControl[ this->usAnimState ].uiFlags & ( ANIM_RAISE_WEAPON | ANIM_NOCHANGE_WEAPON ) ) ) { // We are told that we need to rasie weapon // Do so only if // 1) We have a rifle in hand... - usItem = pSoldier->inv[ HANDPOS ].usItem; + usItem = this->inv[ HANDPOS ].usItem; - // if ( usItem != NOTHING && (Item[ usItem ].fFlags & ITEM_TWO_HANDED) && usItem != ROCKET_LAUNCHER && usItem != RPG7 ) - if ( usItem != NOTHING && (Item[ usItem ].twohanded ) && !Item[usItem].rocketlauncher ) + if ( this->inv[ HANDPOS ].exists() == true && (Item[ usItem ].twohanded ) && !Item[usItem].rocketlauncher ) { // Switch on height! - switch( gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) + switch( gAnimControl[ this->usAnimState ].ubEndHeight ) { case ANIM_STAND: // 2) OK, all's fine... lower weapon first.... - pSoldier->usPendingAnimation = usNewState; + this->usPendingAnimation = usNewState; // Set new state to be animation to move to new stance usNewState = RAISE_RIFLE; } @@ -2036,23 +2785,22 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT } // If this animation is a lower_weapon animation - if ( ( gAnimControl[ usNewState ].uiFlags & ANIM_LOWER_WEAPON ) && !( gAnimControl[ pSoldier->usAnimState ].uiFlags & ( ANIM_LOWER_WEAPON | ANIM_NOCHANGE_WEAPON ) ) ) + if ( ( gAnimControl[ usNewState ].uiFlags & ANIM_LOWER_WEAPON ) && !( gAnimControl[ this->usAnimState ].uiFlags & ( ANIM_LOWER_WEAPON | ANIM_NOCHANGE_WEAPON ) ) ) { // We are told that we need to rasie weapon // Do so only if // 1) We have a rifle in hand... - usItem = pSoldier->inv[ HANDPOS ].usItem; + usItem = this->inv[ HANDPOS ].usItem; - // if ( usItem != NOTHING && (Item[ usItem ].fFlags & ITEM_TWO_HANDED) && usItem != ROCKET_LAUNCHER && usItem != RPG7 ) - if ( usItem != NOTHING && (Item[ usItem ].twohanded ) && !Item[usItem].rocketlauncher ) + if ( this->inv[ HANDPOS ].exists() == true && (Item[ usItem ].twohanded ) && !Item[usItem].rocketlauncher ) { // Switch on height! - switch( gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) + switch( gAnimControl[ this->usAnimState ].ubEndHeight ) { case ANIM_STAND: // 2) OK, all's fine... lower weapon first.... - pSoldier->usPendingAnimation = usNewState; + this->usPendingAnimation = usNewState; // Set new state to be animation to move to new stance usNewState = LOWER_RIFLE; } @@ -2062,27 +2810,27 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT } // Are we cowering and are tyring to move, getup first... - if ( gAnimControl[ usNewState ].uiFlags & ANIM_MOVING && pSoldier->usAnimState == COWERING && gAnimControl[ usNewState ].ubEndHeight == ANIM_STAND ) + if ( gAnimControl[ usNewState ].uiFlags & ANIM_MOVING && this->usAnimState == COWERING && gAnimControl[ usNewState ].ubEndHeight == ANIM_STAND ) { - pSoldier->usPendingAnimation = usNewState; + this->usPendingAnimation = usNewState; // Set new state to be animation to move to new stance usNewState = END_COWER; } // If we want to start swatting, put a pending animation - if( pSoldier->usAnimState != START_SWAT && usNewState == SWATTING ) + if( this->usAnimState != START_SWAT && usNewState == SWATTING ) { // Set new state to be animation to move to new stance usNewState = START_SWAT; } - if( pSoldier->usAnimState == SWATTING && usNewState == CROUCHING ) + if( this->usAnimState == SWATTING && usNewState == CROUCHING ) { // Set new state to be animation to move to new stance usNewState = END_SWAT; } - if( pSoldier->usAnimState == WALKING && usNewState == STANDING && pSoldier->bLife < INJURED_CHANGE_THREASHOLD && pSoldier->ubBodyType <= REGFEMALE && !MercInWater( pSoldier ) ) + if( this->usAnimState == WALKING && usNewState == STANDING && this->stats.bLife < INJURED_CHANGE_THREASHOLD && this->ubBodyType <= REGFEMALE && !this->MercInWater( ) ) { // Set new state to be animation to move to new stance usNewState = END_HURT_WALKING; @@ -2090,19 +2838,19 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT // Check if we are an enemy, and we are in an animation what should be overriden // by if he sees us or not. - if ( ReevaluateEnemyStance( pSoldier, usNewState ) ) + if ( ReevaluateEnemyStance( this, usNewState ) ) { return( TRUE ); } // OK....... - if ( pSoldier->ubBodyType > REGFEMALE ) + if ( this->ubBodyType > REGFEMALE ) { - if ( pSoldier->bLife < INJURED_CHANGE_THREASHOLD ) + if ( this->stats.bLife < INJURED_CHANGE_THREASHOLD ) { if ( usNewState == READY_RIFLE_STAND ) { - // pSoldier->usPendingAnimation2 = usNewState; + // this->usPendingAnimation2 = usNewState; // usNewState = FROM_INJURED_TRANSITION; } } @@ -2111,33 +2859,33 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT // Alrighty, check if we should free buddy up! if ( usNewState == GIVING_AID ) { - UnSetUIBusy( pSoldier->ubID ); + UnSetUIBusy( this->ubID ); } // SUBSTITUDE VARIOUS REG ANIMATIONS WITH ODD BODY TYPES - if ( SubstituteBodyTypeAnimation( pSoldier, usNewState, &usSubState ) ) + if ( SubstituteBodyTypeAnimation( this, usNewState, &usSubState ) ) { usNewState = usSubState; } // CHECK IF WE CAN DO THIS ANIMATION! - if ( IsAnimationValidForBodyType( pSoldier, usNewState ) == FALSE ) + if ( IsAnimationValidForBodyType( this, usNewState ) == FALSE ) { return( FALSE ); } // OK, make guy transition if a big merc... - if ( pSoldier->uiAnimSubFlags & SUB_ANIM_BIGGUYTHREATENSTANCE ) + if ( this->uiAnimSubFlags & SUB_ANIM_BIGGUYTHREATENSTANCE ) { - if ( usNewState == KNEEL_DOWN && pSoldier->usAnimState != BIGMERC_CROUCH_TRANS_INTO ) + if ( usNewState == KNEEL_DOWN && this->usAnimState != BIGMERC_CROUCH_TRANS_INTO ) { UINT16 usItem; // Do we have a rifle? - usItem = pSoldier->inv[ HANDPOS ].usItem; + usItem = this->inv[ HANDPOS ].usItem; - if ( usItem != NOTHING ) + if ( this->inv[ HANDPOS ].exists() == true ) { if ( Item[ usItem ].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) { @@ -2150,14 +2898,14 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT } } - if ( usNewState == KNEEL_UP && pSoldier->usAnimState != BIGMERC_CROUCH_TRANS_OUTOF ) + if ( usNewState == KNEEL_UP && this->usAnimState != BIGMERC_CROUCH_TRANS_OUTOF ) { UINT16 usItem; // Do we have a rifle? - usItem = pSoldier->inv[ HANDPOS ].usItem; + usItem = this->inv[ HANDPOS ].usItem; - if ( usItem != NOTHING ) + if ( this->inv[ HANDPOS ].exists() == true ) { if ( Item[ usItem ].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) { @@ -2172,19 +2920,19 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT } // OK, if we have reverse set, do the side step! - if ( pSoldier->bReverse ) + if ( this->bReverse ) { if ( usNewState == WALKING || usNewState == RUNNING || usNewState == SWATTING ) { // CHECK FOR SIDEWAYS! - if ( pSoldier->ubDirection == gPurpendicularDirection[ pSoldier->ubDirection ][ pSoldier->usPathingData[ pSoldier->usPathIndex ] ] ) + if ( this->ubDirection == gPurpendicularDirection[ this->ubDirection ][ this->pathing.usPathingData[ this->pathing.usPathIndex ] ] ) { // We are perpendicular! usNewState = SIDE_STEP; } else { - if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_CROUCH ) + if ( gAnimControl[ this->usAnimState ].ubEndHeight == ANIM_CROUCH ) { usNewState = SWAT_BACKWARDS; } @@ -2201,14 +2949,14 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT if ( usNewState == CLIMBUPROOF || usNewState == CLIMBDOWNROOF || usNewState == HOPFENCE ) { // Check for breath collapse if a given animation like - if ( CheckForBreathCollapse( pSoldier ) || pSoldier->bCollapsed ) + if ( this->CheckForBreathCollapse( ) || this->bCollapsed ) { // UNset UI - UnSetUIBusy( pSoldier->ubID ); + UnSetUIBusy( this->ubID ); - SoldierCollapse( pSoldier ); + SoldierCollapse( this ); - pSoldier->bBreathCollapsed = FALSE; + this->bBreathCollapsed = FALSE; return( FALSE ); @@ -2216,7 +2964,7 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT } // If we are in water.....and trying to run, change to run - if ( MercInWater( pSoldier) ) + if ( this->MercInWater() ) { // Check animation // Change to walking @@ -2227,10 +2975,10 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT } // Turn off anipause flag for any anim! - pSoldier->uiStatusFlags &= (~SOLDIER_PAUSEANIMOVE); + this->flags.uiStatusFlags &= (~SOLDIER_PAUSEANIMOVE); // Unset paused for no APs..... - AdjustNoAPToFinishMove( pSoldier, FALSE ); + this->AdjustNoAPToFinishMove( FALSE ); #if 0 // 0verhaul: This is a test. The only time I have been able to make this code hit is when @@ -2240,18 +2988,18 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT // to be made for that part. So apparently they found another way to deal with it. So // I disabled the "locked" code for usDontUpdateNewGridNoOnMoveAnimChange since it can cause // problems of its own. Now we see if we can do without this part too. - if ( usNewState == CRAWLING && pSoldier->usDontUpdateNewGridNoOnMoveAnimChange == 1 ) + if ( usNewState == CRAWLING && this->usDontUpdateNewGridNoOnMoveAnimChange == 1 ) { - if ( pSoldier->bTurningFromPronePosition != TURNING_FROM_PRONE_ENDING_UP_FROM_MOVE ) + if ( this->flags.bTurningFromPronePosition != TURNING_FROM_PRONE_ENDING_UP_FROM_MOVE ) { - pSoldier->bTurningFromPronePosition = TURNING_FROM_PRONE_START_UP_FROM_MOVE; + this->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_START_UP_FROM_MOVE; } // ATE: IF we are starting to crawl, but have to getup to turn first...... - if ( pSoldier->bTurningFromPronePosition == TURNING_FROM_PRONE_START_UP_FROM_MOVE ) + if ( this->flags.bTurningFromPronePosition == TURNING_FROM_PRONE_START_UP_FROM_MOVE ) { usNewState = PRONE_UP; - pSoldier->bTurningFromPronePosition = TURNING_FROM_PRONE_ENDING_UP_FROM_MOVE; + this->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_ENDING_UP_FROM_MOVE; } } #endif @@ -2260,27 +3008,27 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT // Handle buddy beginning to move... // check new gridno, etc // ATE: Added: Make check that old anim is not a moving one as well - if ( gAnimControl[ usNewState ].uiFlags & ANIM_MOVING && !( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_MOVING ) || ( gAnimControl[ usNewState ].uiFlags & ANIM_MOVING && fForce ) ) + if ( gAnimControl[ usNewState ].uiFlags & ANIM_MOVING && !( gAnimControl[ this->usAnimState ].uiFlags & ANIM_MOVING ) || ( gAnimControl[ usNewState ].uiFlags & ANIM_MOVING && fForce ) ) { BOOLEAN fKeepMoving; - if ( usNewState == CRAWLING && pSoldier->usDontUpdateNewGridNoOnMoveAnimChange == LOCKED_NO_NEWGRIDNO ) + if ( usNewState == CRAWLING && this->usDontUpdateNewGridNoOnMoveAnimChange == LOCKED_NO_NEWGRIDNO ) { // Turn off lock once we are crawling once... - pSoldier->usDontUpdateNewGridNoOnMoveAnimChange = 1; - } + this->usDontUpdateNewGridNoOnMoveAnimChange = 1; + } // ATE: Additional check here if we have just been told to update animation ONLY, not goto gridno stuff... - if ( !pSoldier->usDontUpdateNewGridNoOnMoveAnimChange ) + if ( !this->usDontUpdateNewGridNoOnMoveAnimChange ) { if ( usNewState != SWATTING ) { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Handling New gridNo for %d: Old %s, New %s", pSoldier->ubID, gAnimControl[ pSoldier->usAnimState ].zAnimStr , gAnimControl[ usNewState ].zAnimStr) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Handling New gridNo for %d: Old %s, New %s", this->ubID, gAnimControl[ this->usAnimState ].zAnimStr , gAnimControl[ usNewState ].zAnimStr) ); if ( !( gAnimControl[ usNewState ].uiFlags & ANIM_SPECIALMOVE ) ) { // Handle goto new tile... - if ( HandleGotoNewGridNo( pSoldier, &fKeepMoving, TRUE, usNewState ) ) + if ( HandleGotoNewGridNo( this, &fKeepMoving, TRUE, usNewState ) ) { if ( !fKeepMoving ) { @@ -2288,18 +3036,18 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT } // Make sure desy = zeroed out... - // pSoldier->fPastXDest = pSoldier->fPastYDest = FALSE; + // this->flags.fPastXDest = this->flags.fPastYDest = FALSE; } else { - if ( pSoldier->bBreathCollapsed ) + if ( this->bBreathCollapsed ) { // UNset UI - UnSetUIBusy( pSoldier->ubID ); + UnSetUIBusy( this->ubID ); - SoldierCollapse( pSoldier ); + SoldierCollapse( this ); - pSoldier->bBreathCollapsed = FALSE; + this->bBreathCollapsed = FALSE; } return( FALSE ); } @@ -2308,18 +3056,18 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT { // Change desired direction // Just change direction - EVENT_InternalSetSoldierDestination( pSoldier, (UINT8) pSoldier->usPathingData[ pSoldier->usPathIndex ], FALSE, pSoldier->usAnimState ); + this->EVENT_InternalSetSoldierDestination( (UINT8) this->pathing.usPathingData[ this->pathing.usPathIndex ], FALSE, this->usAnimState ); } //check for services - ReceivingSoldierCancelServices( pSoldier ); - GivingSoldierCancelServices( pSoldier ); + this->ReceivingSoldierCancelServices( ); + this->GivingSoldierCancelServices( ); // Check if we are a vehicle, and start playing noise sound.... - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( this->flags.uiStatusFlags & SOLDIER_VEHICLE ) { - HandleVehicleMovementSound( pSoldier, TRUE ); + HandleVehicleMovementSound( this, TRUE ); } } } @@ -2327,18 +3075,18 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT else { // Check for stopping movement noise... - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( this->flags.uiStatusFlags & SOLDIER_VEHICLE ) { - HandleVehicleMovementSound( pSoldier, FALSE ); + HandleVehicleMovementSound( this, FALSE ); // If a vehicle, set hewight to 0 - SetSoldierHeight( pSoldier, (FLOAT)( 0 ) ); + this->SetSoldierHeight( (FLOAT)( 0 ) ); } } // Reset to false always..... - // ( Unless locked ) + // ( Unless locked ) if ( gAnimControl[ usNewState ].uiFlags & ANIM_MOVING ) { // 0verhaul: **** Special hack!!!! @@ -2347,10 +3095,10 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT // factors such as maybe getting shot (this is realtime so an enemy could see him), it stays on locked. Once // it stays on locked, the soldier will be unable to navigate around obstacles but will simply stay put // twitching. Since the LOCKED is only set when going prone, this unsets it. - if ( pSoldier->usDontUpdateNewGridNoOnMoveAnimChange != LOCKED_NO_NEWGRIDNO || - (pSoldier->usDontUpdateNewGridNoOnMoveAnimChange == LOCKED_NO_NEWGRIDNO && pSoldier->usAnimState != PRONE_DOWN)) + if ( this->usDontUpdateNewGridNoOnMoveAnimChange != LOCKED_NO_NEWGRIDNO || + (this->usDontUpdateNewGridNoOnMoveAnimChange == LOCKED_NO_NEWGRIDNO && this->usAnimState != PRONE_DOWN)) { - pSoldier->usDontUpdateNewGridNoOnMoveAnimChange = FALSE; + this->usDontUpdateNewGridNoOnMoveAnimChange = FALSE; } } @@ -2365,9 +3113,9 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT // ATE: If this is an AI guy.. unlock him! if ( gTacticalStatus.fEnemySightingOnTheirTurn ) { - if ( gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID == pSoldier->ubID ) + if ( gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID == this->ubID ) { - pSoldier->fPauseAllAnimation = FALSE; + this->flags.fPauseAllAnimation = FALSE; gTacticalStatus.fEnemySightingOnTheirTurn = FALSE; } } @@ -2376,10 +3124,10 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT // HERE DOWN - WE HAVE MADE A DESCISION! ///////////////////////////////////////////////////////////////////// - uiOldAnimFlags = gAnimControl[ pSoldier->usAnimState ].uiFlags; + uiOldAnimFlags = gAnimControl[ this->usAnimState ].uiFlags; uiNewAnimFlags = gAnimControl[ usNewState ].uiFlags; - usNewGridNo = NewGridNo( pSoldier->sGridNo, DirectionInc( (UINT8) pSoldier->usPathingData[ pSoldier->usPathIndex ] ) ); + sNewGridNo = NewGridNo( this->sGridNo, DirectionInc( (UINT8) this->pathing.usPathingData[ this->pathing.usPathIndex ] ) ); // CHECKING IF WE HAVE A HIT FINISH BUT NO DEATH IS DONE WITH A SPECIAL ANI CODE @@ -2397,72 +3145,73 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT #if 0 if ( uiNewAnimFlags & ANIM_NONINTERRUPT ) { - pSoldier->fInNonintAnim = TRUE; + this->flags.fInNonintAnim = TRUE; } if ( uiNewAnimFlags & ANIM_RT_NONINTERRUPT ) { - pSoldier->fRTInNonintAnim = TRUE; + this->flags.fRTInNonintAnim = TRUE; } #else - pSoldier->fInNonintAnim = (uiNewAnimFlags & ANIM_NONINTERRUPT) != 0; - pSoldier->fRTInNonintAnim = (uiNewAnimFlags & ANIM_RT_NONINTERRUPT) != 0; + this->flags.fInNonintAnim = (uiNewAnimFlags & ANIM_NONINTERRUPT) != 0; + this->flags.fRTInNonintAnim = (uiNewAnimFlags & ANIM_RT_NONINTERRUPT) != 0; #endif // CHECK IF WE ARE NOT AIMING, IF NOT, RESET LAST TAGRET! - if ( !(gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIREREADY ) && !(gAnimControl[ usNewState ].uiFlags & ANIM_FIREREADY ) ) + if ( !(gAnimControl[ this->usAnimState ].uiFlags & ANIM_FIREREADY ) && !(gAnimControl[ usNewState ].uiFlags & ANIM_FIREREADY ) ) { // ATE: Also check for the transition anims to not reset this // this should have used a flag but we're out of them.... if ( usNewState != READY_RIFLE_STAND && usNewState != READY_RIFLE_PRONE && usNewState != READY_RIFLE_CROUCH && usNewState != ROBOT_SHOOT ) { - pSoldier->sLastTarget = NOWHERE; + this->sLastTarget = NOWHERE; } } // If a special move state, release np aps if ( ( gAnimControl[ usNewState ].uiFlags & ANIM_SPECIALMOVE ) ) { - AdjustNoAPToFinishMove( pSoldier, FALSE ); + this->AdjustNoAPToFinishMove( FALSE ); } if ( gAnimControl[ usNewState ].uiFlags & ANIM_UPDATEMOVEMENTMODE ) { - if ( pSoldier->bTeam == gbPlayerNum ) + if ( this->bTeam == gbPlayerNum ) { - // pSoldier->usUIMovementMode = GetMoveStateBasedOnStance( pSoldier, gAnimControl[ usNewState ].ubEndHeight ); + // this->usUIMovementMode = GetMoveStateBasedOnStance( this, gAnimControl[ usNewState ].ubEndHeight ); } } // ATE: If not a moving animation - turn off reverse.... if ( !( gAnimControl[ usNewState ].uiFlags & ANIM_MOVING ) ) { - pSoldier->bReverse = FALSE; + this->bReverse = FALSE; } // ONLY DO FOR EVERYONE BUT PLANNING GUYS - if ( pSoldier->ubID < MAX_NUM_SOLDIERS ) + if ( this->ubID < MAX_NUM_SOLDIERS ) { // Do special things based on new state + // CHRISL: Make changes so that we charge extra APs while wearing a backpack while using new inventory system switch( usNewState ) { case STANDING: // Update desired height - pSoldier->ubDesiredHeight = ANIM_STAND; + this->ubDesiredHeight = ANIM_STAND; break; case CROUCHING: // Update desired height - pSoldier->ubDesiredHeight = ANIM_CROUCH; + this->ubDesiredHeight = ANIM_CROUCH; break; case PRONE: // Update desired height - pSoldier->ubDesiredHeight = ANIM_PRONE; + this->ubDesiredHeight = ANIM_PRONE; break; case READY_RIFLE_STAND: @@ -2473,56 +3222,63 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT case READY_DUAL_PRONE: // OK, get points to ready weapon.... - if ( !pSoldier->fDontChargeReadyAPs ) + if ( !this->flags.fDontChargeReadyAPs ) { - sAPCost = GetAPsToReadyWeapon( pSoldier, usNewState ); - DeductPoints( pSoldier, sAPCost, sBPCost ); + sAPCost = GetAPsToReadyWeapon( this, usNewState ); + DeductPoints( this, sAPCost, sBPCost ); } else { - pSoldier->fDontChargeReadyAPs = FALSE; + this->flags.fDontChargeReadyAPs = FALSE; } break; case WALKING: - pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; - pSoldier->ubPendingActionAnimCount = 0; + this->usPendingAnimation = NO_PENDING_ANIMATION; + this->aiData.ubPendingActionAnimCount = 0; break; case SWATTING: - pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; - pSoldier->ubPendingActionAnimCount = 0; + this->usPendingAnimation = NO_PENDING_ANIMATION; + this->aiData.ubPendingActionAnimCount = 0; break; case CRAWLING: // Turn off flag... - pSoldier->bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; - pSoldier->ubPendingActionAnimCount = 0; - pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; + this->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; + this->aiData.ubPendingActionAnimCount = 0; + this->usPendingAnimation = NO_PENDING_ANIMATION; break; case RUNNING: // Only if our previous is not running - if ( pSoldier->usAnimState != RUNNING ) + if ( this->usAnimState != RUNNING ) { - sAPCost = AP_START_RUN_COST; - DeductPoints( pSoldier, sAPCost, sBPCost ); + // CHRISL + if((UsingNewInventorySystem() == true) && this->inv[BPACKPOCKPOS].exists() == true) + { + sAPCost = AP_START_RUN_COST + 2; + sBPCost += 2; + } + else + sAPCost = AP_START_RUN_COST; + DeductPoints( this, sAPCost, sBPCost ); } // Set pending action count to 0 - pSoldier->ubPendingActionAnimCount = 0; - pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; + this->aiData.ubPendingActionAnimCount = 0; + this->usPendingAnimation = NO_PENDING_ANIMATION; break; case ADULTMONSTER_WALKING: - pSoldier->ubPendingActionAnimCount = 0; + this->aiData.ubPendingActionAnimCount = 0; break; case ROBOT_WALK: - pSoldier->ubPendingActionAnimCount = 0; + this->aiData.ubPendingActionAnimCount = 0; break; case KNEEL_UP: @@ -2530,108 +3286,155 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT case BIGMERC_CROUCH_TRANS_INTO: case BIGMERC_CROUCH_TRANS_OUTOF: - if ( !pSoldier->fDontChargeAPsForStanceChange ) + if ( !this->flags.fDontChargeAPsForStanceChange ) { - DeductPoints( pSoldier, AP_CROUCH, BP_CROUCH ); + // CHRISL + if((UsingNewInventorySystem() == true) && this->inv[BPACKPOCKPOS].exists() == true && !this->flags.ZipperFlag) + { + if(usNewState == KNEEL_UP || usNewState == BIGMERC_CROUCH_TRANS_OUTOF) + { + sAPCost=AP_CROUCH+2; + sBPCost=BP_CROUCH+2; + } + else if(usNewState == KNEEL_DOWN || usNewState == BIGMERC_CROUCH_TRANS_INTO) + { + sAPCost=AP_CROUCH+1; + sBPCost=BP_CROUCH+1; + } + else + { + sAPCost=AP_CROUCH; + sBPCost=BP_CROUCH; + } + } + else + { + sAPCost=AP_CROUCH; + sBPCost=BP_CROUCH; + } + DeductPoints( this, sAPCost, sBPCost ); } - pSoldier->fDontChargeAPsForStanceChange = FALSE; + this->flags.fDontChargeAPsForStanceChange = FALSE; break; case PRONE_UP: case PRONE_DOWN: // ATE: If we are NOT waiting for prone down... - if ( pSoldier->bTurningFromPronePosition < TURNING_FROM_PRONE_START_UP_FROM_MOVE && !pSoldier->fDontChargeAPsForStanceChange ) + if ( this->flags.bTurningFromPronePosition < TURNING_FROM_PRONE_START_UP_FROM_MOVE && !this->flags.fDontChargeAPsForStanceChange ) { // ATE: Don't do this if we are still 'moving'.... - if ( pSoldier->sGridNo == pSoldier->sFinalDestination || pSoldier->usPathIndex == 0 ) + if ( this->sGridNo == this->pathing.sFinalDestination || this->pathing.usPathIndex == 0 ) { - DeductPoints( pSoldier, AP_PRONE, BP_PRONE ); + // CHRISL + if((UsingNewInventorySystem() == true) && this->inv[BPACKPOCKPOS].exists() == true && !this->flags.ZipperFlag) + { + if(usNewState == PRONE_UP) + { + sAPCost=AP_PRONE+2; + sBPCost=BP_PRONE+2; + } + else + { + sAPCost=AP_PRONE+1; + sBPCost=BP_PRONE+1; + } + } + else + { + sAPCost=AP_PRONE; + sBPCost=BP_PRONE; + } + DeductPoints( this, sAPCost, sBPCost ); } } - pSoldier->fDontChargeAPsForStanceChange = FALSE; + this->flags.fDontChargeAPsForStanceChange = FALSE; break; //Deduct points for stance change - //sAPCost = GetAPsToChangeStance( pSoldier, gAnimControl[ usNewState ].ubEndHeight ); - //DeductPoints( pSoldier, sAPCost, 0 ); + //sAPCost = GetAPsToChangeStance( this, gAnimControl[ usNewState ].ubEndHeight ); + //DeductPoints( this, sAPCost, 0 ); //break; case START_AID: - DeductPoints( pSoldier, AP_START_FIRST_AID, BP_START_FIRST_AID ); + DeductPoints( this, AP_START_FIRST_AID, BP_START_FIRST_AID ); break; case CUTTING_FENCE: - DeductPoints( pSoldier, AP_USEWIRECUTTERS, BP_USEWIRECUTTERS ); + DeductPoints( this, AP_USEWIRECUTTERS, BP_USEWIRECUTTERS ); break; case PLANT_BOMB: - DeductPoints( pSoldier, AP_DROP_BOMB, 0 ); + DeductPoints( this, AP_DROP_BOMB, 0 ); break; case STEAL_ITEM: - DeductPoints( pSoldier, AP_STEAL_ITEM, 0 ); + DeductPoints( this, AP_STEAL_ITEM, 0 ); break; case CROW_DIE: // Delete shadow of crow.... - if ( pSoldier->pAniTile != NULL ) + if ( this->pAniTile != NULL ) { - DeleteAniTile( pSoldier->pAniTile ); - pSoldier->pAniTile = NULL; + DeleteAniTile( this->pAniTile ); + this->pAniTile = NULL; } break; case CROW_FLY: // Ate: startup a shadow ( if gridno is set ) - HandleCrowShadowNewGridNo( pSoldier ); + HandleCrowShadowNewGridNo( this ); break; case CROW_EAT: // ATE: Make sure height level is 0.... - SetSoldierHeight( pSoldier, (FLOAT)(0) ); - HandleCrowShadowRemoveGridNo( pSoldier ); + this->SetSoldierHeight( (FLOAT)(0) ); + HandleCrowShadowRemoveGridNo( this ); break; case USE_REMOTE: - DeductPoints( pSoldier, AP_USE_REMOTE, 0 ); + DeductPoints( this, AP_USE_REMOTE, 0 ); break; //case PUNCH: //Deduct points for punching - //sAPCost = MinAPsToAttack( pSoldier, pSoldier->sGridNo, FALSE ); - //DeductPoints( pSoldier, sAPCost, 0 ); + //sAPCost = MinAPsToAttack( this, this->sGridNo, FALSE ); + //DeductPoints( this, sAPCost, 0 ); //break; case HOPFENCE: - DeductPoints( pSoldier, AP_JUMPFENCE, BP_JUMPFENCE ); + // CHRISL + if((UsingNewInventorySystem() == true) && this->inv[BPACKPOCKPOS].exists() == true) + DeductPoints( this, AP_JUMPFENCEBPACK, BP_JUMPFENCEBPACK ); + else + DeductPoints( this, AP_JUMPFENCE, BP_JUMPFENCE ); break; // Deduct aps for falling down.... case FALLBACK_HIT_STAND: case FALLFORWARD_FROMHIT_STAND: - DeductPoints( pSoldier, AP_FALL_DOWN, BP_FALL_DOWN ); + DeductPoints( this, AP_FALL_DOWN, BP_FALL_DOWN ); break; case FALLFORWARD_FROMHIT_CROUCH: - DeductPoints( pSoldier, (AP_FALL_DOWN/2), (BP_FALL_DOWN/2) ); + DeductPoints( this, (AP_FALL_DOWN/2), (BP_FALL_DOWN/2) ); break; case QUEEN_SWIPE: // ATE: set damage counter... - pSoldier->uiPendingActionData1 = 0; + this->aiData.uiPendingActionData1 = 0; break; case CLIMBDOWNROOF: @@ -2639,7 +3442,7 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT // disable sight gTacticalStatus.uiFlags |= DISALLOW_SIGHT; - DeductPoints( pSoldier, AP_CLIMBOFFROOF, BP_CLIMBOFFROOF ); + DeductPoints( this, AP_CLIMBOFFROOF, BP_CLIMBOFFROOF ); break; case CLIMBUPROOF: @@ -2647,32 +3450,32 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT // disable sight gTacticalStatus.uiFlags |= DISALLOW_SIGHT; - DeductPoints( pSoldier, AP_CLIMBROOF, BP_CLIMBROOF ); + DeductPoints( this, AP_CLIMBROOF, BP_CLIMBROOF ); break; case JUMP_OVER_BLOCKING_PERSON: // Set path.... { - UINT16 usNewGridNo; + INT16 sNewGridNo; - DeductPoints( pSoldier, AP_JUMP_OVER, BP_JUMP_OVER ); + DeductPoints( this, AP_JUMP_OVER, BP_JUMP_OVER ); - usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( pSoldier->ubDirection ) ); - usNewGridNo = NewGridNo( (UINT16)usNewGridNo, DirectionInc( pSoldier->ubDirection ) ); + sNewGridNo = NewGridNo( (INT16)this->sGridNo, DirectionInc( this->ubDirection ) ); + sNewGridNo = NewGridNo( (INT16)sNewGridNo, DirectionInc( this->ubDirection ) ); - pSoldier->sPlotSrcGrid = pSoldier->sGridNo; - pSoldier->fPastXDest = FALSE; - pSoldier->fPastYDest = FALSE; - pSoldier->usPathDataSize = 0; - pSoldier->usPathIndex = 0; - pSoldier->usPathingData[ pSoldier->usPathDataSize ] = pSoldier->ubDirection; - pSoldier->usPathDataSize++; - pSoldier->usPathingData[ pSoldier->usPathDataSize ] = pSoldier->ubDirection; - pSoldier->usPathDataSize++; - pSoldier->sFinalDestination = usNewGridNo; + this->sPlotSrcGrid = this->sGridNo; + this->flags.fPastXDest = FALSE; + this->flags.fPastYDest = FALSE; + this->pathing.usPathDataSize = 0; + this->pathing.usPathIndex = 0; + this->pathing.usPathingData[ this->pathing.usPathDataSize ] = this->ubDirection; + this->pathing.usPathDataSize++; + this->pathing.usPathingData[ this->pathing.usPathDataSize ] = this->ubDirection; + this->pathing.usPathDataSize++; + this->pathing.sFinalDestination = sNewGridNo; // Set direction - EVENT_InternalSetSoldierDestination( pSoldier, (UINT8) pSoldier->usPathingData[ pSoldier->usPathIndex ], FALSE, JUMP_OVER_BLOCKING_PERSON ); + this->EVENT_InternalSetSoldierDestination( (UINT8) this->pathing.usPathingData[ this->pathing.usPathIndex ], FALSE, JUMP_OVER_BLOCKING_PERSON ); } break; @@ -2704,234 +3507,234 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT case ROBOTNW_DIE: // Set getting hit flag to TRUE - pSoldier->fGettingHit = TRUE; + this->flags.fGettingHit = TRUE; break; case CHARIOTS_OF_FIRE: case BODYEXPLODING: // Merc on fire! - pSoldier->uiPendingActionData1 = PlaySoldierJA2Sample( pSoldier->ubID, ( FIRE_ON_MERC ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 5, SoundDir( pSoldier->sGridNo ), TRUE ); + this->aiData.uiPendingActionData1 = PlaySoldierJA2Sample( this->ubID, ( FIRE_ON_MERC ), RATE_11025, SoundVolume( HIGHVOLUME, this->sGridNo ), 5, SoundDir( this->sGridNo ), TRUE ); break; } } // Remove old animation profile - HandleAnimationProfile( pSoldier, pSoldier->usAnimState, TRUE ); + this->HandleAnimationProfile( this->usAnimState, TRUE ); // From animation control, set surface - if ( SetSoldierAnimationSurface( pSoldier, usNewState ) == FALSE ) + if ( SetSoldierAnimationSurface( this, usNewState ) == FALSE ) { return( FALSE ); } // Set state - pSoldier->usOldAniState = pSoldier->usAnimState; - pSoldier->sOldAniCode = pSoldier->usAniCode; + this->usOldAniState = this->usAnimState; + this->sOldAniCode = this->usAniCode; // Change state value! - pSoldier->usAnimState = usNewState; + this->usAnimState = usNewState; // Set current frame - pSoldier->usAniCode = usStartingAniCode; + this->usAniCode = usStartingAniCode; // Handle cleanup stuff for getting hit. Shouldn't this be part of the animation script? - CheckForFreeupFromHit( pSoldier, uiOldAnimFlags, uiNewAnimFlags, pSoldier->usOldAniState, usNewState ); + CheckForFreeupFromHit( this, uiOldAnimFlags, uiNewAnimFlags, this->usOldAniState, usNewState ); // Perform attack busy stuff - if (pSoldier->usOldAniState != pSoldier->usAnimState) + if (this->usOldAniState != this->usAnimState) { if ( uiNewAnimFlags & ANIM_ATTACK ) { gTacticalStatus.ubAttackBusyCount++; - DebugAttackBusy( String( "**** Attack animation transfer to %s for %d.\nABC now %d\n", gAnimControl[ usNewState ].zAnimStr, pSoldier->ubID, gTacticalStatus.ubAttackBusyCount ) ); - } else if (uiOldAnimFlags & ANIM_ATTACK || pSoldier->fChangingStanceDueToSuppression ) { - DebugAttackBusy( String( "**** Transfer to %s for %d.\n", gAnimControl[ usNewState ].zAnimStr, pSoldier->ubID ) ); + DebugAttackBusy( String( "**** Attack animation transfer to %s for %d.\nABC now %d\n", gAnimControl[ usNewState ].zAnimStr, this->ubID, gTacticalStatus.ubAttackBusyCount ) ); + } else if (uiOldAnimFlags & ANIM_ATTACK || this->flags.fChangingStanceDueToSuppression ) { + DebugAttackBusy( String( "**** Transfer to %s for %d.\n", gAnimControl[ usNewState ].zAnimStr, this->ubID ) ); } if (uiOldAnimFlags & ANIM_ATTACK ) { - DebugAttackBusy( String( "**** Attack animation transfer from %s for %d. Reducing ABC.\n", gAnimControl[ pSoldier->usOldAniState ].zAnimStr, pSoldier->ubID ) ); + DebugAttackBusy( String( "**** Attack animation transfer from %s for %d. Reducing ABC.\n", gAnimControl[ this->usOldAniState ].zAnimStr, this->ubID ) ); ReduceAttackBusyCount( ); - } else if (uiNewAnimFlags & ANIM_ATTACK || pSoldier->fChangingStanceDueToSuppression ) { - DebugAttackBusy( String( "**** Transfer from %s for %d\n", gAnimControl[ pSoldier->usOldAniState ].zAnimStr, pSoldier->ubID ) ); + } else if (uiNewAnimFlags & ANIM_ATTACK || this->flags.fChangingStanceDueToSuppression ) { + DebugAttackBusy( String( "**** Transfer from %s for %d\n", gAnimControl[ this->usOldAniState ].zAnimStr, this->ubID ) ); } } - if (pSoldier->fChangingStanceDueToSuppression) + if (this->flags.fChangingStanceDueToSuppression) { - pSoldier->fChangingStanceDueToSuppression = FALSE; + this->flags.fChangingStanceDueToSuppression = FALSE; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - end of suppression stance change") ); - DebugAttackBusy( String( "@@@@@@@ Freeing up attacker - end of suppression stance change for %d\n", pSoldier->ubID ) ); + DebugAttackBusy( String( "@@@@@@@ Freeing up attacker - end of suppression stance change for %d\n", this->ubID ) ); ReduceAttackBusyCount( ); } - pSoldier->sZLevelOverride = -1; + this->sZLevelOverride = -1; - if ( !( pSoldier->uiStatusFlags & SOLDIER_LOCKPENDINGACTIONCOUNTER ) ) + if ( !( this->flags.uiStatusFlags & SOLDIER_LOCKPENDINGACTIONCOUNTER ) ) { //ATE Cancel ANY pending action... - if ( pSoldier->ubPendingActionAnimCount > 0 && ( gAnimControl[ pSoldier->usOldAniState ].uiFlags & ANIM_MOVING ) ) + if ( this->aiData.ubPendingActionAnimCount > 0 && ( gAnimControl[ this->usOldAniState ].uiFlags & ANIM_MOVING ) ) { // Do some special things for some actions - switch( pSoldier->ubPendingAction ) + switch( this->aiData.ubPendingAction ) { case MERC_GIVEITEM: // Unset target as enaged - MercPtrs[ pSoldier->uiPendingActionData4 ]->uiStatusFlags &= (~SOLDIER_ENGAGEDINACTION); + MercPtrs[ this->aiData.uiPendingActionData4 ]->flags.uiStatusFlags &= (~SOLDIER_ENGAGEDINACTION); break; } - pSoldier->ubPendingAction = NO_PENDING_ACTION; + this->aiData.ubPendingAction = NO_PENDING_ACTION; } else { // Increment this for almost all animations except some movement ones... // That's because this represents ANY animation other than the one we began when the pending action was started // ATE: Added to ignore this count if we are waiting for someone to move out of our way... - if ( usNewState != START_SWAT && usNewState != END_SWAT && !( gAnimControl[ usNewState ].uiFlags & ANIM_NOCHANGE_PENDINGCOUNT ) && !pSoldier->fDelayedMovement && !( pSoldier->uiStatusFlags & SOLDIER_ENGAGEDINACTION ) ) + if ( usNewState != START_SWAT && usNewState != END_SWAT && !( gAnimControl[ usNewState ].uiFlags & ANIM_NOCHANGE_PENDINGCOUNT ) && !this->flags.fDelayedMovement && !( this->flags.uiStatusFlags & SOLDIER_ENGAGEDINACTION ) ) { - pSoldier->ubPendingActionAnimCount++; + this->aiData.ubPendingActionAnimCount++; } } } // Set new animation profile - HandleAnimationProfile( pSoldier, usNewState, FALSE ); + this->HandleAnimationProfile( usNewState, FALSE ); // Reset some animation values - pSoldier->fForceShade = FALSE; + this->flags.fForceShade = FALSE; // CHECK IF WE ARE AT AN IDLE ACTION #if 0 if ( gAnimControl[ usNewState ].uiFlags & ANIM_IDLE ) { - pSoldier->bAction = ACTION_DONE; + this->aiData.bAction = ACTION_DONE; } else { - pSoldier->bAction = ACTION_BUSY; + this->aiData.bAction = ACTION_BUSY; } #endif // ATE; For some animations that could use some variations, do so.... if (usNewState == CHARIOTS_OF_FIRE || usNewState == BODYEXPLODING ) { - pSoldier->usAniCode = (UINT16)( Random( 10 ) ); + this->usAniCode = (UINT16)( Random( 10 ) ); } // ATE: Default to first frame.... // Will get changed ( probably ) by AdjustToNextAnimationFrame() - ConvertAniCodeToAniFrame( pSoldier, (INT16)( 0 ) ); + this->ConvertAniCodeToAniFrame( (INT16)( 0 ) ); // Set delay speed - SetSoldierAniSpeed( pSoldier ); + SetSoldierAniSpeed( this ); // Reset counters - RESETTIMECOUNTER( pSoldier->UpdateCounter, pSoldier->sAniDelay ); + RESETTIMECOUNTER( this->timeCounters.UpdateCounter, this->sAniDelay ); // Adjust to new animation frame ( the first one ) - AdjustToNextAnimationFrame( pSoldier ); + AdjustToNextAnimationFrame( this ); // Setup offset information for UI above guy - SetSoldierLocatorOffsets( pSoldier ); + SetSoldierLocatorOffsets( this ); // Lesh: test fix visibility after raising gun - if ( ( gAnimControl[ pSoldier->usOldAniState ].uiFlags & ANIM_RAISE_WEAPON) && (gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIREREADY) ) - //equivalent if ( (pSoldier->usAnimState == AIM_RIFLE_PRONE) || (pSoldier->usAnimState == AIM_RIFLE_CROUCH) || (pSoldier->usAnimState == AIM_RIFLE_STAND) ) + if ( ( gAnimControl[ this->usOldAniState ].uiFlags & ANIM_RAISE_WEAPON) && (gAnimControl[ this->usAnimState ].uiFlags & ANIM_FIREREADY) ) + //equivalent if ( (this->usAnimState == AIM_RIFLE_PRONE) || (this->usAnimState == AIM_RIFLE_CROUCH) || (this->usAnimState == AIM_RIFLE_STAND) ) { - if ( (pSoldier->usOldAniState == READY_RIFLE_STAND) || (pSoldier->usOldAniState == READY_RIFLE_CROUCH) || (pSoldier->usOldAniState == READY_RIFLE_PRONE) ) + if ( (this->usOldAniState == READY_RIFLE_STAND) || (this->usOldAniState == READY_RIFLE_CROUCH) || (this->usOldAniState == READY_RIFLE_PRONE) ) { - HandleSight(pSoldier,SIGHT_LOOK); + HandleSight(this,SIGHT_LOOK); } } // If our own guy... - if ( pSoldier->bTeam == gbPlayerNum ) + if ( this->bTeam == gbPlayerNum ) { // Are we stationary? if ( gAnimControl[ usNewState ].uiFlags & ANIM_STATIONARY ) { // Position light.... - // SetCheckSoldierLightFlag( pSoldier ); + // this->SetCheckSoldierLightFlag( ); } else { // Hide light..... - // DeleteSoldierLight( pSoldier ); + // this->DeleteSoldierLight( ); } } // If we are certain animations, reload palette if ( usNewState == VEHICLE_DIE || usNewState == CHARIOTS_OF_FIRE || usNewState == BODYEXPLODING ) { - CreateSoldierPalettes( pSoldier ); + this->CreateSoldierPalettes( ); } // ATE: if the old animation was a movement, and new is not, play sound... // OK, play final footstep sound... if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { - if ( ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_STATIONARY ) && - ( gAnimControl[ pSoldier->usOldAniState ].uiFlags & ANIM_MOVING ) ) + if ( ( gAnimControl[ this->usAnimState ].uiFlags & ANIM_STATIONARY ) && + ( gAnimControl[ this->usOldAniState ].uiFlags & ANIM_MOVING ) ) { - PlaySoldierFootstepSound( pSoldier ); + PlaySoldierFootstepSound( this ); } } // Free up from stance change - FreeUpNPCFromStanceChange( pSoldier ); + FreeUpNPCFromStanceChange( this ); return( TRUE ); } -void InternalRemoveSoldierFromGridNo( SOLDIERTYPE *pSoldier, BOOLEAN fForce ) +void SOLDIERTYPE::InternalRemoveSoldierFromGridNo( BOOLEAN fForce ) { INT8 bDir; INT32 iGridNo; - if((pSoldier->sGridNo!=NOWHERE) ) + if((this->sGridNo!=NOWHERE) ) { - if ( pSoldier->bInSector || fForce ) + if ( this->bInSector || fForce ) { // Remove from world ( old pos ) - RemoveMerc( pSoldier->sGridNo, pSoldier, FALSE ); - HandleAnimationProfile( pSoldier, pSoldier->usAnimState, TRUE ); + RemoveMerc( this->sGridNo, this, FALSE ); + this->HandleAnimationProfile( this->usAnimState, TRUE ); // Remove records of this guy being adjacent for (bDir = 0; bDir < NUM_WORLD_DIRECTIONS; bDir++) { - iGridNo = pSoldier->sGridNo + DirIncrementer[ bDir ]; + iGridNo = this->sGridNo + DirIncrementer[ bDir ]; if( iGridNo >= 0 && iGridNo < WORLD_MAX ) { gpWorldLevelData[ iGridNo ].ubAdjacentSoldierCnt--; } } - HandlePlacingRoofMarker( pSoldier, pSoldier->sGridNo, FALSE , FALSE ); + HandlePlacingRoofMarker( this, this->sGridNo, FALSE , FALSE ); // Remove reseved movement value - UnMarkMovementReserved( pSoldier ); + UnMarkMovementReserved( this ); - HandleCrowShadowRemoveGridNo( pSoldier ); + HandleCrowShadowRemoveGridNo( this ); // Reset gridno... - pSoldier->sGridNo = NOWHERE; + this->sGridNo = NOWHERE; } } } -void RemoveSoldierFromGridNo( SOLDIERTYPE *pSoldier ) +void SOLDIERTYPE::RemoveSoldierFromGridNo( void ) { - InternalRemoveSoldierFromGridNo( pSoldier, FALSE ); + this->InternalRemoveSoldierFromGridNo( FALSE ); } -void EVENT_InternalSetSoldierPosition( SOLDIERTYPE *pSoldier, FLOAT dNewXPos, FLOAT dNewYPos ,BOOLEAN fUpdateDest, BOOLEAN fUpdateFinalDest, BOOLEAN fForceRemove ) +void SOLDIERTYPE::EVENT_InternalSetSoldierPosition( FLOAT dNewXPos, FLOAT dNewYPos ,BOOLEAN fUpdateDest, BOOLEAN fUpdateFinalDest, BOOLEAN fForceRemove ) { INT16 sNewGridNo; // Not if we're dead! - if ( ( pSoldier->uiStatusFlags & SOLDIER_DEAD ) ) + if ( ( this->flags.uiStatusFlags & SOLDIER_DEAD ) ) { return; } @@ -2941,70 +3744,70 @@ void EVENT_InternalSetSoldierPosition( SOLDIERTYPE *pSoldier, FLOAT dNewXPos, FL if ( fUpdateDest ) { - pSoldier->sDestination = sNewGridNo; + this->pathing.sDestination = sNewGridNo; } if ( fUpdateFinalDest ) { - pSoldier->sFinalDestination = sNewGridNo; + this->pathing.sFinalDestination = sNewGridNo; } // Copy old values - pSoldier->dOldXPos = pSoldier->dXPos; - pSoldier->dOldYPos = pSoldier->dYPos; + this->dOldXPos = this->dXPos; + this->dOldYPos = this->dYPos; // Set New pos - pSoldier->dXPos = dNewXPos; - pSoldier->dYPos = dNewYPos; + this->dXPos = dNewXPos; + this->dYPos = dNewYPos; - pSoldier->sX = (INT16)dNewXPos; - pSoldier->sY = (INT16)dNewYPos; + this->sX = (INT16)dNewXPos; + this->sY = (INT16)dNewYPos; - HandleCrowShadowNewPosition( pSoldier ); + HandleCrowShadowNewPosition( this ); - SetSoldierGridNo( pSoldier, sNewGridNo, fForceRemove ); + this->SetSoldierGridNo( sNewGridNo, fForceRemove ); - if ( !( pSoldier->uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) ) + if ( !( this->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) ) { if ( gGameSettings.fOptions[ TOPTION_MERC_ALWAYS_LIGHT_UP ] ) { - SetCheckSoldierLightFlag( pSoldier ); + this->SetCheckSoldierLightFlag( ); } } // ATE: Mirror calls if we are a vehicle ( for all our passengers ) - UpdateAllVehiclePassengersGridNo( pSoldier ); + UpdateAllVehiclePassengersGridNo( this ); } -void EVENT_SetSoldierPosition( SOLDIERTYPE *pSoldier, FLOAT dNewXPos, FLOAT dNewYPos ) +void SOLDIERTYPE::EVENT_SetSoldierPosition( FLOAT dNewXPos, FLOAT dNewYPos ) { - EVENT_InternalSetSoldierPosition( pSoldier, dNewXPos, dNewYPos ,TRUE, TRUE, FALSE ); + this->EVENT_InternalSetSoldierPosition( dNewXPos, dNewYPos ,TRUE, TRUE, FALSE ); } -void EVENT_SetSoldierPositionForceDelete( SOLDIERTYPE *pSoldier, FLOAT dNewXPos, FLOAT dNewYPos ) +void SOLDIERTYPE::EVENT_SetSoldierPositionForceDelete( FLOAT dNewXPos, FLOAT dNewYPos ) { - EVENT_InternalSetSoldierPosition( pSoldier, dNewXPos, dNewYPos ,TRUE, TRUE, TRUE ); + this->EVENT_InternalSetSoldierPosition( dNewXPos, dNewYPos ,TRUE, TRUE, TRUE ); } -void EVENT_SetSoldierPositionAndMaybeFinalDest( SOLDIERTYPE *pSoldier, FLOAT dNewXPos, FLOAT dNewYPos, BOOLEAN fUpdateFinalDest ) +void SOLDIERTYPE::EVENT_SetSoldierPositionAndMaybeFinalDest( FLOAT dNewXPos, FLOAT dNewYPos, BOOLEAN fUpdateFinalDest ) { - EVENT_InternalSetSoldierPosition( pSoldier, dNewXPos, dNewYPos ,TRUE, fUpdateFinalDest, FALSE ); + this->EVENT_InternalSetSoldierPosition( dNewXPos, dNewYPos ,TRUE, fUpdateFinalDest, FALSE ); } void EVENT_SetSoldierPositionAndMaybeFinalDestAndMaybeNotDestination( SOLDIERTYPE *pSoldier, FLOAT dNewXPos, FLOAT dNewYPos, BOOLEAN fUpdateDest, BOOLEAN fUpdateFinalDest ) { - EVENT_InternalSetSoldierPosition( pSoldier, dNewXPos, dNewYPos ,fUpdateDest, fUpdateFinalDest, FALSE ); + pSoldier->EVENT_InternalSetSoldierPosition( dNewXPos, dNewYPos ,fUpdateDest, fUpdateFinalDest, FALSE ); } -void InternalSetSoldierHeight( SOLDIERTYPE *pSoldier, FLOAT dNewHeight, BOOLEAN fUpdateLevel ) +void SOLDIERTYPE::InternalSetSoldierHeight( FLOAT dNewHeight, BOOLEAN fUpdateLevel ) { - INT8 bOldLevel = pSoldier->bLevel; + INT8 bOldLevel = this->pathing.bLevel; - pSoldier->dHeightAdjustment = dNewHeight; - pSoldier->sHeightAdjustment = (INT16)pSoldier->dHeightAdjustment; + this->aiData.dHeightAdjustment = dNewHeight; + this->sHeightAdjustment = (INT16)this->aiData.dHeightAdjustment; if ( !fUpdateLevel ) { @@ -3014,51 +3817,51 @@ void InternalSetSoldierHeight( SOLDIERTYPE *pSoldier, FLOAT dNewHeight, BOOLEAN // 0verhaul: Changed this to half the wall height. During a climb up, a soldier's height increases to about 8, then falls // to near 0 before being set to 50 at the end. The animation offsets should probably be changed to make this unnecessary // but this is good enough to keep him from bouncing between level 1 and level 0 (and also triggering weird sight bugs). - if ( pSoldier->sHeightAdjustment > 25 ) + if ( this->sHeightAdjustment > 25 ) { - pSoldier->bLevel = SECOND_LEVEL; + this->pathing.bLevel = SECOND_LEVEL; - ApplyTranslucencyToWalls((INT16)(pSoldier->dXPos/CELL_X_SIZE), (INT16)(pSoldier->dYPos/CELL_Y_SIZE)); - //LightHideTrees((INT16)(pSoldier->dXPos/CELL_X_SIZE), (INT16)(pSoldier->dYPos/CELL_Y_SIZE)); + ApplyTranslucencyToWalls((INT16)(this->dXPos/CELL_X_SIZE), (INT16)(this->dYPos/CELL_Y_SIZE)); + //LightHideTrees((INT16)(this->dXPos/CELL_X_SIZE), (INT16)(this->dYPos/CELL_Y_SIZE)); //ConcealAllWalls(); - //pSoldier->pLevelNode->ubShadeLevel=gpWorldLevelData[pSoldier->sGridNo].pRoofHead->ubShadeLevel; - //pSoldier->pLevelNode->ubSumLights=gpWorldLevelData[pSoldier->sGridNo].pRoofHead->ubSumLights; - //pSoldier->pLevelNode->ubMaxLights=gpWorldLevelData[pSoldier->sGridNo].pRoofHead->ubMaxLights; - //pSoldier->pLevelNode->ubNaturalShadeLevel=gpWorldLevelData[pSoldier->sGridNo].pRoofHead->ubNaturalShadeLevel; + //this->pLevelNode->ubShadeLevel=gpWorldLevelData[this->sGridNo].pRoofHead->ubShadeLevel; + //this->pLevelNode->ubSumLights=gpWorldLevelData[this->sGridNo].pRoofHead->ubSumLights; + //this->pLevelNode->ubMaxLights=gpWorldLevelData[this->sGridNo].pRoofHead->ubMaxLights; + //this->pLevelNode->ubNaturalShadeLevel=gpWorldLevelData[this->sGridNo].pRoofHead->ubNaturalShadeLevel; } else { - pSoldier->bLevel = FIRST_LEVEL; + this->pathing.bLevel = FIRST_LEVEL; - //pSoldier->pLevelNode->ubShadeLevel=gpWorldLevelData[pSoldier->sGridNo].pLandHead->ubShadeLevel; - //pSoldier->pLevelNode->ubSumLights=gpWorldLevelData[pSoldier->sGridNo].pLandHead->ubSumLights; - //pSoldier->pLevelNode->ubMaxLights=gpWorldLevelData[pSoldier->sGridNo].pLandHead->ubMaxLights; - //pSoldier->pLevelNode->ubNaturalShadeLevel=gpWorldLevelData[pSoldier->sGridNo].pLandHead->ubNaturalShadeLevel; + //this->pLevelNode->ubShadeLevel=gpWorldLevelData[this->sGridNo].pLandHead->ubShadeLevel; + //this->pLevelNode->ubSumLights=gpWorldLevelData[this->sGridNo].pLandHead->ubSumLights; + //this->pLevelNode->ubMaxLights=gpWorldLevelData[this->sGridNo].pLandHead->ubMaxLights; + //this->pLevelNode->ubNaturalShadeLevel=gpWorldLevelData[this->sGridNo].pLandHead->ubNaturalShadeLevel; } - if ( bOldLevel == 0 && pSoldier->bLevel == 0 ) + if ( bOldLevel == 0 && this->pathing.bLevel == 0 ) { } else { // Show room at new level - //HideRoom( pSoldier->sGridNo, pSoldier ); + //HideRoom( this->sGridNo, this ); } } -void SetSoldierHeight( SOLDIERTYPE *pSoldier, FLOAT dNewHeight ) +void SOLDIERTYPE::SetSoldierHeight( FLOAT dNewHeight ) { - InternalSetSoldierHeight( pSoldier, dNewHeight, TRUE ); + this->InternalSetSoldierHeight( dNewHeight, TRUE ); } -void SetSoldierGridNo( SOLDIERTYPE *pSoldier, INT16 sNewGridNo, BOOLEAN fForceRemove ) +void SOLDIERTYPE::SetSoldierGridNo( INT16 sNewGridNo, BOOLEAN fForceRemove ) { BOOLEAN fInWaterValue; INT8 bDir; @@ -3068,53 +3871,53 @@ void SetSoldierGridNo( SOLDIERTYPE *pSoldier, INT16 sNewGridNo, BOOLEAN fForceRe //INT16 sX, sY, sWorldX, sZLevel; // Not if we're dead! - if ( ( pSoldier->uiStatusFlags & SOLDIER_DEAD ) ) + if ( ( this->flags.uiStatusFlags & SOLDIER_DEAD ) ) { return; } - if ( sNewGridNo != pSoldier->sGridNo || pSoldier->pLevelNode == NULL ) + if ( sNewGridNo != this->sGridNo || this->pLevelNode == NULL ) { // Check if we are moving AND this is our next dest gridno.... - if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ( ANIM_MOVING | ANIM_SPECIALMOVE ) ) + if ( gAnimControl[ this->usAnimState ].uiFlags & ( ANIM_MOVING | ANIM_SPECIALMOVE ) ) { if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { - if ( sNewGridNo != pSoldier->sDestination ) + if ( sNewGridNo != this->pathing.sDestination ) { // THIS MUST be our new one......MAKE IT SO - sNewGridNo = pSoldier->sDestination; + sNewGridNo = this->pathing.sDestination; } // Now check this baby.... - if ( sNewGridNo == pSoldier->sGridNo ) + if ( sNewGridNo == this->sGridNo ) { return; } } } - pSoldier->sOldGridNo = pSoldier->sGridNo; + this->sOldGridNo = this->sGridNo; - if ( pSoldier->ubBodyType == QUEENMONSTER ) + if ( this->ubBodyType == QUEENMONSTER ) { - SetPositionSndGridNo( pSoldier->iPositionSndID, sNewGridNo ); + SetPositionSndGridNo( this->iPositionSndID, sNewGridNo ); } - if ( !( pSoldier->uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) ) + if ( !( this->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) ) { - InternalRemoveSoldierFromGridNo( pSoldier, fForceRemove ); + this->InternalRemoveSoldierFromGridNo( fForceRemove ); } // CHECK IF OUR NEW GIRDNO IS VALID,IF NOT DONOT SET! if ( !GridNoOnVisibleWorldTile( sNewGridNo ) ) { - pSoldier->sGridNo = sNewGridNo; + this->sGridNo = sNewGridNo; return; } // Alrighty, update UI for this guy, if he's the selected guy... - if ( gusSelectedSoldier == pSoldier->ubID ) + if ( gusSelectedSoldier == this->ubID ) { if ( guiCurrentEvent == C_WAIT_FOR_CONFIRM ) { @@ -3125,51 +3928,51 @@ void SetSoldierGridNo( SOLDIERTYPE *pSoldier, INT16 sNewGridNo, BOOLEAN fForceRe // Reset some flags for optimizations.. - pSoldier->sWalkToAttackGridNo = NOWHERE; + this->sWalkToAttackGridNo = NOWHERE; // ATE: Make sure! - // RemoveMerc( pSoldier->sGridNo, pSoldier, FALSE ); + // RemoveMerc( this->sGridNo, this, FALSE ); - pSoldier->sGridNo = sNewGridNo; + this->sGridNo = sNewGridNo; // OK, check for special code to close door... - if ( pSoldier->bEndDoorOpenCode == 2 ) + if ( this->bEndDoorOpenCode == 2 ) { - pSoldier->bEndDoorOpenCode = 0; + this->bEndDoorOpenCode = 0; - HandleDoorChangeFromGridNo( pSoldier, pSoldier->sEndDoorOpenCodeData, FALSE ); + HandleDoorChangeFromGridNo( this, this->sEndDoorOpenCodeData, FALSE ); } // OK, Update buddy's strategic insertion code.... - pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; - pSoldier->usStrategicInsertionData = sNewGridNo; + this->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; + this->usStrategicInsertionData = sNewGridNo; // Remove this gridno as a reserved place! - if ( !( pSoldier->uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) ) + if ( !( this->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) ) { - UnMarkMovementReserved( pSoldier ); + UnMarkMovementReserved( this ); } - if ( pSoldier->sInitialGridNo == 0 ) + if ( this->sInitialGridNo == 0 ) { - pSoldier->sInitialGridNo = sNewGridNo; - pSoldier->usPatrolGrid[0] = sNewGridNo; + this->sInitialGridNo = sNewGridNo; + this->aiData.sPatrolGrid[0] = sNewGridNo; } // Add records of this guy being adjacent for (bDir = 0; bDir < NUM_WORLD_DIRECTIONS; bDir++) { - gpWorldLevelData[ pSoldier->sGridNo + DirIncrementer[ bDir ] ].ubAdjacentSoldierCnt++; + gpWorldLevelData[ this->sGridNo + DirIncrementer[ bDir ] ].ubAdjacentSoldierCnt++; } - if ( !( pSoldier->uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) ) + if ( !( this->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) ) { - DropSmell( pSoldier ); + DropSmell( this ); } // HANDLE ANY SPECIAL RENDERING SITUATIONS - pSoldier->sZLevelOverride = -1; + this->sZLevelOverride = -1; // If we are over a fence ( hopping ), make us higher! if ( IsJumpableFencePresentAtGridno( sNewGridNo ) ) @@ -3177,102 +3980,102 @@ void SetSoldierGridNo( SOLDIERTYPE *pSoldier, INT16 sNewGridNo, BOOLEAN fForceRe //sX = MapX( sNewGridNo ); //sY = MapY( sNewGridNo ); //GetWorldXYAbsoluteScreenXY( sX, sY, &sWorldX, &sZLevel); - //pSoldier->sZLevelOverride = (sZLevel*Z_SUBLAYERS)+ROOF_Z_LEVEL; - pSoldier->sZLevelOverride = TOPMOST_Z_LEVEL; + //this->sZLevelOverride = (sZLevel*Z_SUBLAYERS)+ROOF_Z_LEVEL; + this->sZLevelOverride = TOPMOST_Z_LEVEL; } // Add/ remove tree if we are near it - // CheckForFullStructures( pSoldier ); + // CheckForFullStructures( this ); // Add merc at new pos - if ( !( pSoldier->uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) ) + if ( !( this->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) ) { - AddMercToHead( pSoldier->sGridNo, pSoldier, TRUE ); + AddMercToHead( this->sGridNo, this, TRUE ); // If we are in the middle of climbing the roof! - if ( pSoldier->usAnimState == CLIMBUPROOF ) + if ( this->usAnimState == CLIMBUPROOF ) { - if(pSoldier->iLight!=(-1)) - LightSpriteRoofStatus(pSoldier->iLight, TRUE ); + if(this->iLight!=(-1)) + LightSpriteRoofStatus(this->iLight, TRUE ); } - else if ( pSoldier->usAnimState == CLIMBDOWNROOF ) + else if ( this->usAnimState == CLIMBDOWNROOF ) { - if(pSoldier->iLight!=(-1)) - LightSpriteRoofStatus(pSoldier->iLight, FALSE ); + if(this->iLight!=(-1)) + LightSpriteRoofStatus(this->iLight, FALSE ); } //JA2Gold: //if the player wants the merc to cast the fake light AND it is night - if( pSoldier->bTeam != OUR_TEAM || gGameSettings.fOptions[ TOPTION_MERC_CASTS_LIGHT ] && NightTime() ) + if( this->bTeam != OUR_TEAM || gGameSettings.fOptions[ TOPTION_MERC_CASTS_LIGHT ] && NightTime() ) { - if ( pSoldier->bLevel > 0 && gpWorldLevelData[pSoldier->sGridNo].pRoofHead != NULL ) + if ( this->pathing.bLevel > 0 && gpWorldLevelData[this->sGridNo].pRoofHead != NULL ) { - gpWorldLevelData[pSoldier->sGridNo].pMercHead->ubShadeLevel=gpWorldLevelData[pSoldier->sGridNo].pRoofHead->ubShadeLevel; - gpWorldLevelData[pSoldier->sGridNo].pMercHead->ubSumLights=gpWorldLevelData[pSoldier->sGridNo].pRoofHead->ubSumLights; - gpWorldLevelData[pSoldier->sGridNo].pMercHead->ubMaxLights=gpWorldLevelData[pSoldier->sGridNo].pRoofHead->ubMaxLights; - gpWorldLevelData[pSoldier->sGridNo].pMercHead->ubNaturalShadeLevel=gpWorldLevelData[pSoldier->sGridNo].pRoofHead->ubNaturalShadeLevel; + gpWorldLevelData[this->sGridNo].pMercHead->ubShadeLevel=gpWorldLevelData[this->sGridNo].pRoofHead->ubShadeLevel; + gpWorldLevelData[this->sGridNo].pMercHead->ubSumLights=gpWorldLevelData[this->sGridNo].pRoofHead->ubSumLights; + gpWorldLevelData[this->sGridNo].pMercHead->ubMaxLights=gpWorldLevelData[this->sGridNo].pRoofHead->ubMaxLights; + gpWorldLevelData[this->sGridNo].pMercHead->ubNaturalShadeLevel=gpWorldLevelData[this->sGridNo].pRoofHead->ubNaturalShadeLevel; } else { - gpWorldLevelData[pSoldier->sGridNo].pMercHead->ubShadeLevel=gpWorldLevelData[pSoldier->sGridNo].pLandHead->ubShadeLevel; - gpWorldLevelData[pSoldier->sGridNo].pMercHead->ubSumLights=gpWorldLevelData[pSoldier->sGridNo].pLandHead->ubSumLights; - gpWorldLevelData[pSoldier->sGridNo].pMercHead->ubMaxLights=gpWorldLevelData[pSoldier->sGridNo].pLandHead->ubMaxLights; - gpWorldLevelData[pSoldier->sGridNo].pMercHead->ubNaturalShadeLevel=gpWorldLevelData[pSoldier->sGridNo].pLandHead->ubNaturalShadeLevel; + gpWorldLevelData[this->sGridNo].pMercHead->ubShadeLevel=gpWorldLevelData[this->sGridNo].pLandHead->ubShadeLevel; + gpWorldLevelData[this->sGridNo].pMercHead->ubSumLights=gpWorldLevelData[this->sGridNo].pLandHead->ubSumLights; + gpWorldLevelData[this->sGridNo].pMercHead->ubMaxLights=gpWorldLevelData[this->sGridNo].pLandHead->ubMaxLights; + gpWorldLevelData[this->sGridNo].pMercHead->ubNaturalShadeLevel=gpWorldLevelData[this->sGridNo].pLandHead->ubNaturalShadeLevel; } } - ///HandlePlacingRoofMarker( pSoldier, pSoldier->sGridNo, TRUE, FALSE ); + ///HandlePlacingRoofMarker( this, this->sGridNo, TRUE, FALSE ); - HandleAnimationProfile( pSoldier, pSoldier->usAnimState, FALSE ); + this->HandleAnimationProfile( this->usAnimState, FALSE ); - HandleCrowShadowNewGridNo( pSoldier ); + HandleCrowShadowNewGridNo( this ); } - pSoldier->bOldOverTerrainType = pSoldier->bOverTerrainType; - pSoldier->bOverTerrainType = GetTerrainType( pSoldier->sGridNo ); + this->bOldOverTerrainType = this->bOverTerrainType; + this->bOverTerrainType = GetTerrainType( this->sGridNo ); // OK, check that our animation is up to date! // Check our water value - if ( !( pSoldier->uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) ) + if ( !( this->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) ) { - fInWaterValue = MercInWater( pSoldier ); + fInWaterValue = this->MercInWater( ); // ATE: If ever in water MAKE SURE WE WALK AFTERWOODS! if ( fInWaterValue ) { - pSoldier->usUIMovementMode = WALKING; + this->usUIMovementMode = WALKING; } - if ( fInWaterValue != pSoldier->fPrevInWater ) + if ( fInWaterValue != this->flags.fPrevInWater ) { //Update Animation data - SetSoldierAnimationSurface( pSoldier, pSoldier->usAnimState ); + SetSoldierAnimationSurface( this, this->usAnimState ); // Update flag - pSoldier->fPrevInWater = fInWaterValue; + this->flags.fPrevInWater = fInWaterValue; // Update sound... if ( fInWaterValue ) { - PlaySoldierJA2Sample( pSoldier->ubID, ENTER_WATER_1, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( this->ubID, ENTER_WATER_1, RATE_11025, SoundVolume( MIDVOLUME, this->sGridNo ), 1, SoundDir( this->sGridNo ), TRUE ); } else { // ATE: Check if we are going from water to land - if so, resume // with regular movement mode... - EVENT_InitNewSoldierAnim( pSoldier, pSoldier->usUIMovementMode, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( this->usUIMovementMode, 0 , FALSE ); } } // OK, If we were not in deep water but we are now, handle deep animations! - if ( TERRAIN_IS_DEEP_WATER( pSoldier->bOverTerrainType) && !TERRAIN_IS_DEEP_WATER( pSoldier->bOldOverTerrainType) ) + if ( TERRAIN_IS_DEEP_WATER( this->bOverTerrainType) && !TERRAIN_IS_DEEP_WATER( this->bOldOverTerrainType) ) { // Based on our current animation, change! - switch( pSoldier->usAnimState ) + switch( this->usAnimState ) { case WALKING: case RUNNING: @@ -3280,79 +4083,79 @@ void SetSoldierGridNo( SOLDIERTYPE *pSoldier, INT16 sNewGridNo, BOOLEAN fForceRe // IN deep water, swim! // Make transition from low to deep - EVENT_InitNewSoldierAnim( pSoldier, LOW_TO_DEEP_WATER, 0 , FALSE ); - pSoldier->usPendingAnimation = DEEP_WATER_SWIM; - pSoldier->usDontUpdateNewGridNoOnMoveAnimChange = 1; - PlayJA2Sample( ENTER_DEEP_WATER_1, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + this->EVENT_InitNewSoldierAnim( LOW_TO_DEEP_WATER, 0 , FALSE ); + this->usPendingAnimation = DEEP_WATER_SWIM; + this->usDontUpdateNewGridNoOnMoveAnimChange = 1; + PlayJA2Sample( ENTER_DEEP_WATER_1, RATE_11025, SoundVolume( MIDVOLUME, this->sGridNo ), 1, SoundDir( this->sGridNo ) ); } } // Damage water if in deep water.... - if ( MercInHighWater( pSoldier) ) + if ( this->MercInHighWater( ) ) { - WaterDamage( pSoldier ); + WaterDamage( this ); } // OK, If we were in deep water but we are NOT now, handle mid animations! - if ( !TERRAIN_IS_DEEP_WATER( pSoldier->bOverTerrainType) && TERRAIN_IS_DEEP_WATER( pSoldier->bOldOverTerrainType) ) + if ( !TERRAIN_IS_DEEP_WATER( this->bOverTerrainType) && TERRAIN_IS_DEEP_WATER( this->bOldOverTerrainType) ) { // Make transition from low to deep - EVENT_InitNewSoldierAnim( pSoldier, DEEP_TO_LOW_WATER, 0 , FALSE ); - pSoldier->usDontUpdateNewGridNoOnMoveAnimChange = 1; - pSoldier->usPendingAnimation = pSoldier->usUIMovementMode; + this->EVENT_InitNewSoldierAnim( DEEP_TO_LOW_WATER, 0 , FALSE ); + this->usDontUpdateNewGridNoOnMoveAnimChange = 1; + this->usPendingAnimation = this->usUIMovementMode; } } // are we now standing in tear gas without a decently working gas mask? - if ( GetSmokeEffectOnTile( sNewGridNo, pSoldier->bLevel ) > 1 ) //lal: removed normal smoke + if ( GetSmokeEffectOnTile( sNewGridNo, this->pathing.bLevel ) > 1 ) //lal: removed normal smoke { BOOLEAN fSetGassed = TRUE; // If we have a functioning gas mask... - if ( FindGasMask ( pSoldier ) != NO_SLOT && pSoldier->inv[ HEAD1POS ].ItemData.Generic.bStatus[ 0 ] >= GASMASK_MIN_STATUS ) + if ( FindGasMask ( this ) != NO_SLOT && this->inv[ HEAD1POS ][0]->data.objectStatus >= GASMASK_MIN_STATUS ) { fSetGassed = FALSE; } - // if ( pSoldier->inv[ HEAD1POS ].usItem == GASMASK && pSoldier->inv[ HEAD1POS ].bStatus[ 0 ] >= GASMASK_MIN_STATUS ) + // if ( this->inv[ HEAD1POS ].usItem == GASMASK && this->inv[ HEAD1POS ][0]->data.objectStatus >= GASMASK_MIN_STATUS ) //{ // fSetGassed = FALSE; //} - // if ( pSoldier->inv[ HEAD2POS ].usItem == GASMASK && pSoldier->inv[ HEAD2POS ].bStatus[ 0 ] >= GASMASK_MIN_STATUS ) + // if ( this->inv[ HEAD2POS ].usItem == GASMASK && this->inv[ HEAD2POS ][0]->data.objectStatus >= GASMASK_MIN_STATUS ) //{ // fSetGassed = FALSE; //} if ( fSetGassed ) { - pSoldier->uiStatusFlags |= SOLDIER_GASSED; + this->flags.uiStatusFlags |= SOLDIER_GASSED; } } - if ( pSoldier->bTeam == gbPlayerNum && pSoldier->bStealthMode ) + if ( this->bTeam == gbPlayerNum && this->bStealthMode ) { // Merc got to a new tile by "sneaking". Did we theoretically sneak // past an enemy? - if ( pSoldier->bOppCnt > 0 ) // opponents in sight + if ( this->aiData.bOppCnt > 0 ) // opponents in sight { // check each possible enemy for ( cnt = 0; cnt < MAX_NUM_SOLDIERS; cnt++ ) { pEnemy = MercPtrs[ cnt ]; // if this guy is here and alive enough to be looking for us - if ( pEnemy->bActive && pEnemy->bInSector && ( pEnemy->bLife >= OKLIFE ) ) + if ( pEnemy->bActive && pEnemy->bInSector && ( pEnemy->stats.bLife >= OKLIFE ) ) { // no points for sneaking by the neutrals & friendlies!!! - if ( !pEnemy->bNeutral && ( pSoldier->bSide != pEnemy->bSide ) && (pEnemy->ubBodyType != COW && pEnemy->ubBodyType != CROW) ) + if ( !pEnemy->aiData.bNeutral && ( this->bSide != pEnemy->bSide ) && (pEnemy->ubBodyType != COW && pEnemy->ubBodyType != CROW) ) { // if we SEE this particular oppponent, and he DOESN'T see us... and he COULD see us... - if ( (pSoldier->bOppList[ cnt ] == SEEN_CURRENTLY) && - pEnemy->bOppList[ pSoldier->ubID ] != SEEN_CURRENTLY && - PythSpacesAway( pSoldier->sGridNo, pEnemy->sGridNo ) < pEnemy->GetMaxDistanceVisible(pSoldier->sGridNo, pSoldier->bLevel ) ) + if ( (this->aiData.bOppList[ cnt ] == SEEN_CURRENTLY) && + pEnemy->aiData.bOppList[ this->ubID ] != SEEN_CURRENTLY && + PythSpacesAway( this->sGridNo, pEnemy->sGridNo ) < pEnemy->GetMaxDistanceVisible(this->sGridNo, this->pathing.bLevel ) ) { // AGILITY (5): Soldier snuck 1 square past unaware enemy - StatChange( pSoldier, AGILAMT, 5, FALSE ); + StatChange( this, AGILAMT, 5, FALSE ); // Keep looping, we'll give'em 1 point for EACH such enemy! } } @@ -3362,17 +4165,17 @@ void SetSoldierGridNo( SOLDIERTYPE *pSoldier, INT16 sNewGridNo, BOOLEAN fForceRe } // Adjust speed based on terrain, etc - SetSoldierAniSpeed( pSoldier ); + SetSoldierAniSpeed( this ); } else { - int i = 0; + //int breakpoint = 0; } } -void EVENT_FireSoldierWeapon( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ) +void SOLDIERTYPE::EVENT_FireSoldierWeapon( INT16 sTargetGridNo ) { INT16 sTargetXPos, sTargetYPos; BOOLEAN fDoFireRightAway = FALSE; @@ -3380,23 +4183,18 @@ void EVENT_FireSoldierWeapon( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ) DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EVENT_FireSoldierWeapon")); // CANNOT BE SAME GRIDNO! - if ( pSoldier->sGridNo == sTargetGridNo ) + if ( this->sGridNo == sTargetGridNo ) { return; } - if ( pSoldier->ubID == 33 ) - { - int i = 0; - } - - //switch ( pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunAmmoType ) + //switch ( this->inv[ this->ubAttackingHand ][0]->data.gun.ubGunAmmoType ) //{ // case AMMO_SLEEP_DART: - // pSoldier->fMuzzleFlash = FALSE; + // this->flags.fMuzzleFlash = FALSE; // break; // default: - // pSoldier->fMuzzleFlash = TRUE; + // this->flags.fMuzzleFlash = TRUE; // break; //} @@ -3407,13 +4205,13 @@ void EVENT_FireSoldierWeapon( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ) // The correct place for this is UseGun, which already has code to set or reset the flash. - if ( IsFlashSuppressor (&pSoldier->inv[ pSoldier->ubAttackingHand ], pSoldier ) ) - pSoldier->fMuzzleFlash = FALSE; - else - pSoldier->fMuzzleFlash = TRUE; + if ( IsFlashSuppressor (&this->inv[ this->ubAttackingHand ], this ) ) + this->flags.fMuzzleFlash = FALSE; + else + this->flags.fMuzzleFlash = TRUE; #endif - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EVENT_FireSoldierWeapon: Muzzle flash = %d",pSoldier->fMuzzleFlash)); + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EVENT_FireSoldierWeapon: Muzzle flash = %d",this->flags.fMuzzleFlash)); // Increment the number of people busy doing stuff because of an attack //if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) ) @@ -3425,49 +4223,49 @@ void EVENT_FireSoldierWeapon( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ) //} // Set soldier's target gridno - // This assignment was redundent because it's already set in + // This assignment was redundent because it's already set in // the actual event call - pSoldier->sTargetGridNo = sTargetGridNo; - //pSoldier->sLastTarget = sTargetGridNo; - pSoldier->ubTargetID = WhoIsThere2( sTargetGridNo, pSoldier->bTargetLevel ); + this->sTargetGridNo = sTargetGridNo; + //this->sLastTarget = sTargetGridNo; + this->ubTargetID = WhoIsThere2( sTargetGridNo, this->bTargetLevel ); #if 0 - // if (Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_GUN) + // if (Item[this->inv[HANDPOS].usItem].usItemClass & IC_GUN) { - if (pSoldier->bDoBurst) + if (this->bDoBurst) { // This is NOT the bullets to fire. That is done as a check of bDoBurst against the weapon burst count or // bDoAutofire, or single-fire. So let the bullet count be managed by the firing code. // Set the TOTAL number of bullets to be fired // Can't shoot more bullets than we have in our magazine! - if(pSoldier->bDoAutofire) - pSoldier->bBulletsLeft = __min( pSoldier->bDoAutofire, pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft ); + if(this->bDoAutofire) + this->bBulletsLeft = __min( this->bDoAutofire, this->inv[ this->ubAttackingHand ][0]->data.gun.ubGunShotsLeft ); else { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,"EVENT_FireSoldierWeapon: do burst"); - if ( pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST ) - pSoldier->bBulletsLeft = __min( Weapon[GetAttachedGrenadeLauncher(&pSoldier->inv[pSoldier->ubAttackingHand])].ubShotsPerBurst, pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft ); + if ( this->bWeaponMode == WM_ATTACHED_GL_BURST ) + this->bBulletsLeft = __min( Weapon[GetAttachedGrenadeLauncher(&this->inv[this->ubAttackingHand])].ubShotsPerBurst, this->inv[ this->ubAttackingHand ][0]->data.gun.ubGunShotsLeft ); else - pSoldier->bBulletsLeft = __min( GetShotsPerBurst(&pSoldier->inv[ pSoldier->ubAttackingHand ]), pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft ); + this->bBulletsLeft = __min( GetShotsPerBurst(&this->inv[ this->ubAttackingHand ]), this->inv[ this->ubAttackingHand ][0]->data.gun.ubGunShotsLeft ); } } - else if ( IsValidSecondHandShot( pSoldier ) ) + else if ( IsValidSecondHandShot( this ) ) { // two-pistol attack - two bullets! - pSoldier->bBulletsLeft = 2; + this->bBulletsLeft = 2; } else { - pSoldier->bBulletsLeft = 1; + this->bBulletsLeft = 1; } - if ( AmmoTypes[pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunAmmoType].numberOfBullets > 1 ) + if ( AmmoTypes[this->inv[ this->ubAttackingHand ][0]->data.gun.ubGunAmmoType].numberOfBullets > 1 ) { - pSoldier->bBulletsLeft *= AmmoTypes[pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunAmmoType].numberOfBullets; + this->bBulletsLeft *= AmmoTypes[this->inv[ this->ubAttackingHand ][0]->data.gun.ubGunAmmoType].numberOfBullets; } } #endif - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("!!!!!!! Starting attack, bullets left %d", pSoldier->bBulletsLeft) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("!!!!!!! Starting attack, bullets left %d", this->bBulletsLeft) ); // Convert our grid-not into an XY ConvertGridNoToXY( sTargetGridNo, &sTargetXPos, &sTargetYPos ); @@ -3475,24 +4273,24 @@ void EVENT_FireSoldierWeapon( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ) // Change to fire animation // Ready weapon - SoldierReadyWeapon( pSoldier, sTargetXPos, sTargetYPos, FALSE ); + this->SoldierReadyWeapon( sTargetXPos, sTargetYPos, FALSE ); // IF WE ARE AN NPC, SLIDE VIEW TO SHOW WHO IS SHOOTING { - //if ( pSoldier->fDoSpread ) + //if ( this->flags.fDoSpread ) //{ // If we are spreading burst, goto right away! - //EVENT_InitNewSoldierAnim( pSoldier, SelectFireAnimation( pSoldier, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ), 0, FALSE ); + //this->EVENT_InitNewSoldierAnim( SelectFireAnimation( this, gAnimControl[ this->usAnimState ].ubEndHeight ), 0, FALSE ); //} // else { - if (pSoldier->uiStatusFlags & SOLDIER_MONSTER ) + if (this->flags.uiStatusFlags & SOLDIER_MONSTER ) { // Force our direction! - EVENT_SetSoldierDirection( pSoldier, pSoldier->bDesiredDirection ); - EVENT_InitNewSoldierAnim( pSoldier, SelectFireAnimation( pSoldier, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ), 0, FALSE ); + this->EVENT_SetSoldierDirection( this->pathing.bDesiredDirection ); + this->EVENT_InitNewSoldierAnim( SelectFireAnimation( this, gAnimControl[ this->usAnimState ].ubEndHeight ), 0, FALSE ); } else { @@ -3503,8 +4301,8 @@ void EVENT_FireSoldierWeapon( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ) } // Check if our weapon has no intermediate anim... - if (Item[pSoldier->inv[ HANDPOS ].usItem].rocketlauncher || Item[pSoldier->inv[ HANDPOS ].usItem].grenadelauncher || Item[pSoldier->inv[ HANDPOS ].usItem].mortar ) - ///* switch( pSoldier->inv[ HANDPOS ].usItem ) + if (Item[this->inv[ HANDPOS ].usItem].rocketlauncher || Item[this->inv[ HANDPOS ].usItem].grenadelauncher || Item[this->inv[ HANDPOS ].usItem].mortar ) + ///* switch( this->inv[ HANDPOS ].usItem ) // { //case RPG7: //case ROCKET_LAUNCHER: @@ -3518,24 +4316,24 @@ void EVENT_FireSoldierWeapon( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ) if ( fDoFireRightAway ) { // Set to true so we don't get toasted twice for APs.. - pSoldier->fDontUnsetLastTargetFromTurn = TRUE; + this->flags.fDontUnsetLastTargetFromTurn = TRUE; // Make sure we don't try and do fancy prone turning..... - pSoldier->bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; + this->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; // Force our direction! - EVENT_SetSoldierDirection( pSoldier, pSoldier->bDesiredDirection ); + this->EVENT_SetSoldierDirection( this->pathing.bDesiredDirection ); - EVENT_InitNewSoldierAnim( pSoldier, SelectFireAnimation( pSoldier, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ), 0, FALSE ); + this->EVENT_InitNewSoldierAnim( SelectFireAnimation( this, gAnimControl[ this->usAnimState ].ubEndHeight ), 0, FALSE ); } - else + else { // Set flag indicating we are about to shoot once destination direction is hit - pSoldier->fTurningToShoot = TRUE; + this->flags.fTurningToShoot = TRUE; - if ( pSoldier->bTeam != gbPlayerNum && pSoldier->bVisible != -1) + if ( this->bTeam != gbPlayerNum && this->bVisible != -1) { - LocateSoldier( pSoldier->ubID, DONTSETLOCATOR ); + LocateSoldier( this->ubID, DONTSETLOCATOR ); } } } @@ -3544,7 +4342,7 @@ void EVENT_FireSoldierWeapon( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ) } //gAnimControl[ pSoldier->usAnimState ].ubEndHeight -// ChangeSoldierState( pSoldier, SHOOT_RIFLE_STAND, 0 , FALSE ); +// pSoldier->ChangeSoldierState( SHOOT_RIFLE_STAND, 0 , FALSE ); UINT16 SelectFireAnimation( SOLDIERTYPE *pSoldier, UINT8 ubHeight ) { @@ -3558,7 +4356,7 @@ UINT16 SelectFireAnimation( SOLDIERTYPE *pSoldier, UINT8 ubHeight ) //Do different things if we are a monster - if (pSoldier->uiStatusFlags & SOLDIER_MONSTER) + if (pSoldier->flags.uiStatusFlags & SOLDIER_MONSTER) { switch( pSoldier->ubBodyType ) { @@ -3632,7 +4430,7 @@ UINT16 SelectFireAnimation( SOLDIERTYPE *pSoldier, UINT8 ubHeight ) usItem = pSoldier->inv[ HANDPOS ].usItem; // CHECK 2ND HAND! - if ( IsValidSecondHandShot( pSoldier ) ) + if ( pSoldier->IsValidSecondHandShot( ) ) { // Increment the number of people busy doing stuff because of an attack //gTacticalStatus.ubAttackBusyCount++; @@ -3662,7 +4460,7 @@ UINT16 SelectFireAnimation( SOLDIERTYPE *pSoldier, UINT8 ubHeight ) //} // Don't do any low shots if in water - if ( MercInWater( pSoldier ) ) + if ( pSoldier->MercInWater( ) ) { fDoLowShot = FALSE; } @@ -3697,12 +4495,12 @@ UINT16 SelectFireAnimation( SOLDIERTYPE *pSoldier, UINT8 ubHeight ) if ( pSoldier->bDoBurst > 0 ) { - // pSoldier->fBurstCompleted = FALSE; + // pSoldier->flags.fBurstCompleted = FALSE; return( PRONE_BURST ); } else { - if ( IsValidSecondHandShot( pSoldier ) ) + if ( pSoldier->IsValidSecondHandShot( ) ) { return( SHOOT_DUAL_PRONE ); } @@ -3715,7 +4513,7 @@ UINT16 SelectFireAnimation( SOLDIERTYPE *pSoldier, UINT8 ubHeight ) case ANIM_CROUCH: - if ( IsValidSecondHandShot( pSoldier ) ) + if ( pSoldier->IsValidSecondHandShot( ) ) { // Increment the number of people busy doing stuff because of an attack //gTacticalStatus.ubAttackBusyCount++; @@ -3727,7 +4525,7 @@ UINT16 SelectFireAnimation( SOLDIERTYPE *pSoldier, UINT8 ubHeight ) { if ( pSoldier->bDoBurst > 0 ) { - // pSoldier->fBurstCompleted = FALSE; + // pSoldier->flags.fBurstCompleted = FALSE; return( CROUCHED_BURST ); } else @@ -3749,13 +4547,13 @@ UINT16 SelectFireAnimation( SOLDIERTYPE *pSoldier, UINT8 ubHeight ) } -UINT16 GetMoveStateBasedOnStance( SOLDIERTYPE *pSoldier, UINT8 ubStanceHeight ) +UINT16 SOLDIERTYPE::GetMoveStateBasedOnStance( UINT8 ubStanceHeight ) { // Determine which animation to do...depending on stance and gun in hand... switch ( ubStanceHeight ) { case ANIM_STAND: - if ( pSoldier->fUIMovementFast && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( this->flags.fUIMovementFast && !( this->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { return( RUNNING ); } @@ -3766,7 +4564,7 @@ UINT16 GetMoveStateBasedOnStance( SOLDIERTYPE *pSoldier, UINT8 ubStanceHeight ) break; case ANIM_PRONE: - if ( pSoldier->fUIMovementFast ) + if ( this->flags.fUIMovementFast ) { return( CRAWLING ); } @@ -3777,13 +4575,13 @@ UINT16 GetMoveStateBasedOnStance( SOLDIERTYPE *pSoldier, UINT8 ubStanceHeight ) break; case ANIM_CROUCH: - if ( pSoldier->fUIMovementFast ) + if ( this->flags.fUIMovementFast ) { return( SWATTING ); } else { - return( SWATTING ); + return( SWATTING ); } break; @@ -3806,52 +4604,52 @@ void SelectFallAnimation( SOLDIERTYPE *pSoldier ) switch ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) { case ANIM_STAND: - EVENT_InitNewSoldierAnim( pSoldier, FLYBACK_HIT, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( FLYBACK_HIT, 0 , FALSE ); break; case ANIM_PRONE: - EVENT_InitNewSoldierAnim( pSoldier, FLYBACK_HIT, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( FLYBACK_HIT, 0 , FALSE ); break; } } -BOOLEAN SoldierReadyWeapon( SOLDIERTYPE *pSoldier ) +BOOLEAN SOLDIERTYPE::SoldierReadyWeapon( void ) { - return( InternalSoldierReadyWeapon( pSoldier, (INT8)pSoldier->ubDirection, FALSE ) ); + return( this->InternalSoldierReadyWeapon( (INT8)this->ubDirection, FALSE ) ); } -BOOLEAN SoldierReadyWeapon( SOLDIERTYPE *pSoldier, INT16 sTargetXPos, INT16 sTargetYPos, BOOLEAN fEndReady ) +BOOLEAN SOLDIERTYPE::SoldierReadyWeapon( INT16 sTargetXPos, INT16 sTargetYPos, BOOLEAN fEndReady ) { INT16 sFacingDir; - sFacingDir = GetDirectionFromXY( sTargetXPos , sTargetYPos, pSoldier ); + sFacingDir = GetDirectionFromXY( sTargetXPos , sTargetYPos, this ); - return( InternalSoldierReadyWeapon( pSoldier, (INT8)sFacingDir, fEndReady ) ); + return( this->InternalSoldierReadyWeapon( (INT8)sFacingDir, fEndReady ) ); } -BOOLEAN InternalSoldierReadyWeapon( SOLDIERTYPE *pSoldier, UINT8 sFacingDir, BOOLEAN fEndReady ) +BOOLEAN SOLDIERTYPE::InternalSoldierReadyWeapon( UINT8 sFacingDir, BOOLEAN fEndReady ) { UINT16 usAnimState; BOOLEAN fReturnVal = FALSE; // Handle monsters differently - if (pSoldier->uiStatusFlags & SOLDIER_MONSTER) + if (this->flags.uiStatusFlags & SOLDIER_MONSTER) { if ( !fEndReady ) { - EVENT_SetSoldierDesiredDirection( pSoldier, sFacingDir ); + this->EVENT_SetSoldierDesiredDirection( sFacingDir ); } return( FALSE ); } DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("InternalSoldierReadyWeapon: PickingAnimation")); - usAnimState = PickSoldierReadyAnimation( pSoldier, fEndReady ); + usAnimState = PickSoldierReadyAnimation( this, fEndReady ); if ( usAnimState != INVALID_ANIMATION ) { - EVENT_InitNewSoldierAnim( pSoldier, usAnimState, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( usAnimState, 0 , FALSE ); fReturnVal = TRUE; } @@ -3860,15 +4658,15 @@ BOOLEAN InternalSoldierReadyWeapon( SOLDIERTYPE *pSoldier, UINT8 sFacingDir, BOO // Ready direction for new facing direction if ( usAnimState == INVALID_ANIMATION ) { - usAnimState = pSoldier->usAnimState; + usAnimState = this->usAnimState; } - EVENT_InternalSetSoldierDesiredDirection( pSoldier, sFacingDir, FALSE, usAnimState ); + EVENT_InternalSetSoldierDesiredDirection( this, sFacingDir, FALSE, usAnimState ); // Check if facing dir is different from ours and change direction if so! - //if ( sFacingDir != pSoldier->ubDirection ) + //if ( sFacingDir != this->ubDirection ) //{ - // DeductPoints( pSoldier, AP_CHANGE_FACING, 0 ); + // DeductPoints( this, AP_CHANGE_FACING, 0 ); //}// } @@ -3881,12 +4679,12 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady ) DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("PickSoldierReadyAnimation")); // Invalid animation if nothing in our hands - if ( pSoldier->inv[ HANDPOS ].usItem == NOTHING ) + if ( pSoldier->inv[ HANDPOS ].exists() == false ) { return( INVALID_ANIMATION ); } - if ( MercInDeepWater( pSoldier) ) + if ( pSoldier->MercInDeepWater( ) ) { return( INVALID_ANIMATION ); } @@ -3915,7 +4713,7 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady ) if ( fEndReady ) { // IF our gun is already drawn, do not change animation, just direction - if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ( ANIM_FIREREADY | ANIM_FIRE )) + if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ( ANIM_FIREREADY | ANIM_FIRE )) { switch ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) @@ -3923,7 +4721,7 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady ) case ANIM_STAND: // CHECK 2ND HAND! - if ( IsValidSecondHandShot( pSoldier ) ) + if ( pSoldier->IsValidSecondHandShot( ) ) { return( END_DUAL_STAND ); } @@ -3935,7 +4733,7 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady ) case ANIM_PRONE: - if ( IsValidSecondHandShot( pSoldier ) ) + if ( pSoldier->IsValidSecondHandShot( ) ) { return( END_DUAL_PRONE ); } @@ -3948,7 +4746,7 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady ) case ANIM_CROUCH: // CHECK 2ND HAND! - if ( IsValidSecondHandShot( pSoldier ) ) + if ( pSoldier->IsValidSecondHandShot( ) ) { return( END_DUAL_CROUCH ); } @@ -3966,7 +4764,7 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady ) { // IF our gun is already drawn, do not change animation, just direction - if ( !(gAnimControl[ pSoldier->usAnimState ].uiFlags & ( ANIM_FIREREADY | ANIM_FIRE ) ) ) + if ( !(gAnimControl[ pSoldier->usAnimState ].uiFlags & ( ANIM_FIREREADY | ANIM_FIRE ) ) ) { { @@ -3975,7 +4773,7 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady ) case ANIM_STAND: // CHECK 2ND HAND! - if ( IsValidSecondHandShot( pSoldier ) ) + if ( pSoldier->IsValidSecondHandShot( ) ) { return( READY_DUAL_STAND ); } @@ -3987,10 +4785,10 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady ) case ANIM_PRONE: // Go into crouch, turn, then go into prone again - //ChangeSoldierStance( pSoldier, ANIM_CROUCH ); + //pSoldier->ChangeSoldierStance( ANIM_CROUCH ); //pSoldier->ubDesiredHeight = ANIM_PRONE; - //ChangeSoldierState( pSoldier, PRONE_UP ); - if ( IsValidSecondHandShot( pSoldier ) ) + //pSoldier->ChangeSoldierState( PRONE_UP ); + if ( pSoldier->IsValidSecondHandShot( ) ) { return( READY_DUAL_PRONE ); } @@ -4003,7 +4801,7 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady ) case ANIM_CROUCH: // CHECK 2ND HAND! - if ( IsValidSecondHandShot( pSoldier ) ) + if ( pSoldier->IsValidSecondHandShot( ) ) { return( READY_DUAL_CROUCH ); } @@ -4029,10 +4827,10 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady ) // ATE: THIS FUNCTION IS USED FOR ALL SOLDIER TAKE DAMAGE FUNCTIONS! -void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, INT16 sBreathLoss, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation, INT16 sSubsequent, INT16 sLocationGrid ) +void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT16 sBreathLoss, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation, INT16 sSubsequent, INT16 sLocationGrid ) { UINT8 ubCombinedLoss, ubVolume, ubReason; - // SOLDIERTYPE * pNewSoldier; +// SOLDIERTYPE * pNewSoldier; ubReason = 0; @@ -4041,41 +4839,41 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa #if 0 // 0verhaul: Under the new ABC system this is no longer necessary. // ATE: If we have gotten hit, but are still in our attack animation, reduce count! - switch ( pSoldier->usAnimState ) + switch ( this->usAnimState ) { - case SHOOT_ROCKET: - case SHOOT_MORTAR: - case THROW_ITEM: + case SHOOT_ROCKET: + case SHOOT_MORTAR: + case THROW_ITEM: // crouch throwing - case THROW_ITEM_CROUCHED: + case THROW_ITEM_CROUCHED: // crouch throwing - case LOB_ITEM: + case LOB_ITEM: - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - ATTACK ANIMATION %s ENDED BY HIT ANIMATION, Now %d", gAnimControl[ pSoldier->usAnimState ].zAnimStr, gTacticalStatus.ubAttackBusyCount ) ); - ReduceAttackBusyCount( pSoldier->ubID, FALSE ); - break; + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - ATTACK ANIMATION %s ENDED BY HIT ANIMATION, Now %d", gAnimControl[ this->usAnimState ].zAnimStr, gTacticalStatus.ubAttackBusyCount ) ); + ReduceAttackBusyCount( this->ubID, FALSE ); + break; } #endif // DO STUFF COMMON FOR ALL TYPES if ( ubAttackerID != NOBODY) { - MercPtrs[ubAttackerID]->bLastAttackHit = TRUE; + MercPtrs[ubAttackerID]->aiData.bLastAttackHit = TRUE; } // Set attacker's ID - pSoldier->ubAttackerID = ubAttackerID; + this->ubAttackerID = ubAttackerID; #if 0 // 0verhaul: Slashing out more unnecessary and reworked code - if ( !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( !( this->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { // Increment being attacked count - pSoldier->bBeingAttackedCount++; + this->bBeingAttackedCount++; } // if defender is a vehicle, there will be no hit animation played! - if ( !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( !( this->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { // Increment the number of people busy doing stuff because of an attack (busy doing hit anim!) gTacticalStatus.ubAttackBusyCount++; @@ -4084,18 +4882,18 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa #endif // ATE; Save hit location info...( for later anim determination stuff ) - pSoldier->ubHitLocation = ubHitLocation; + this->ubHitLocation = ubHitLocation; // handle morale for heavy damage attacks if ( sDamage > 25 ) { - if ( pSoldier->ubAttackerID != NOBODY && MercPtrs[ pSoldier->ubAttackerID ]->bTeam == gbPlayerNum ) + if ( this->ubAttackerID != NOBODY && MercPtrs[ this->ubAttackerID ]->bTeam == gbPlayerNum ) { - HandleMoraleEvent( MercPtrs[ pSoldier->ubAttackerID ], MORALE_DID_LOTS_OF_DAMAGE, MercPtrs[ pSoldier->ubAttackerID ]->sSectorX, MercPtrs[ pSoldier->ubAttackerID ]->sSectorY, MercPtrs[ pSoldier->ubAttackerID ]->bSectorZ ); + HandleMoraleEvent( MercPtrs[ this->ubAttackerID ], MORALE_DID_LOTS_OF_DAMAGE, MercPtrs[ this->ubAttackerID ]->sSectorX, MercPtrs[ this->ubAttackerID ]->sSectorY, MercPtrs[ this->ubAttackerID ]->bSectorZ ); } - if (pSoldier->bTeam == gbPlayerNum) + if (this->bTeam == gbPlayerNum) { - HandleMoraleEvent( pSoldier, MORALE_TOOK_LOTS_OF_DAMAGE, pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ); + HandleMoraleEvent( this, MORALE_TOOK_LOTS_OF_DAMAGE, this->sSectorX, this->sSectorY, this->bSectorZ ); } } @@ -4119,38 +4917,38 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa } // callahan update end - else if ( Item[ usWeaponIndex ].usItemClass & ( IC_GUN | IC_THROWING_KNIFE ) && AmmoTypes[MercPtrs[ubAttackerID]->inv[MercPtrs[ubAttackerID]->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize <= 1) - { + else if ( Item[ usWeaponIndex ].usItemClass & ( IC_GUN | IC_THROWING_KNIFE ) && AmmoTypes[MercPtrs[ubAttackerID]->inv[MercPtrs[ubAttackerID]->ubAttackingHand ][0]->data.gun.ubGunAmmoType].explosionSize <= 1) + { if ( ubSpecial == FIRE_WEAPON_SLEEP_DART_SPECIAL ) { UINT32 uiChance; // put the drug in! - pSoldier->bSleepDrugCounter = 10; + this->bSleepDrugCounter = 10; - uiChance = SleepDartSuccumbChance( pSoldier ); + uiChance = SleepDartSuccumbChance( this ); if ( PreRandom( 100 ) < uiChance ) { // succumb to the drug! - sBreathLoss = (INT16)( pSoldier->bBreathMax * 100 ); + sBreathLoss = (INT16)( this->bBreathMax * 100 ); } } else if ( ubSpecial == FIRE_WEAPON_BLINDED_BY_SPIT_SPECIAL ) { // blinded!! - if ( (pSoldier->bBlindedCounter == 0) ) + if ( (this->bBlindedCounter == 0) ) { // say quote - if (pSoldier->uiStatusFlags & SOLDIER_PC) + if (this->flags.uiStatusFlags & SOLDIER_PC) { - TacticalCharacterDialogue( pSoldier, QUOTE_BLINDED ); + TacticalCharacterDialogue( this, QUOTE_BLINDED ); } - DecayIndividualOpplist( pSoldier ); + DecayIndividualOpplist( this ); } // will always increase counter by at least 1 - pSoldier->bBlindedCounter += (sDamage / 8) + 1; + this->bBlindedCounter += (sDamage / 8) + 1; // Dirty panel fInterfacePanelDirty = DIRTYLEVEL2; @@ -4159,12 +4957,12 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa ubReason = TAKE_DAMAGE_GUNFIRE; } else if ( Item[ usWeaponIndex ].usItemClass & IC_BLADE ) - { + { sBreathLoss = BP_GET_HIT; ubReason = TAKE_DAMAGE_BLADE; } else if ( Item[ usWeaponIndex ].usItemClass & IC_PUNCH ) - { + { // damage from hand-to-hand is 1/4 normal, 3/4 breath.. the sDamage value // is actually how much breath we'll take away sBreathLoss = sDamage * 100; @@ -4176,10 +4974,10 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa } ubReason = TAKE_DAMAGE_HANDTOHAND; } - // marke added one 'or' for explosive ammo. variation of: AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].explosionSize > 1 + // marke added one 'or' for explosive ammo. variation of: AmmoTypes[this->inv[this->ubAttackingHand ][0]->data.gun.ubGunAmmoType].explosionSize > 1 // extracting attacker´s ammo type - else if ( Item[ usWeaponIndex ].usItemClass & IC_EXPLOSV || AmmoTypes[MercPtrs[ubAttackerID]->inv[MercPtrs[ubAttackerID]->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize > 1) - { + else if ( Item[ usWeaponIndex ].usItemClass & IC_EXPLOSV || AmmoTypes[MercPtrs[ubAttackerID]->inv[MercPtrs[ubAttackerID]->ubAttackingHand ][0]->data.gun.ubGunAmmoType].explosionSize > 1) + { INT8 bDeafValue; bDeafValue = Explosive[ Item[ usWeaponIndex ].ubClassIndex ].ubVolume / 10; @@ -4190,34 +4988,34 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa switch ( ubSpecial ) { case FIRE_WEAPON_BLINDED_AND_DEAFENED: - pSoldier->bDeafenedCounter = bDeafValue; + this->bDeafenedCounter = bDeafValue; //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Soldier is blinded and deafened" ); // if soldier in building OR underground if ( InBuilding(sLocationGrid) || (gbWorldSectorZ) ) { // deal max special damage - pSoldier->bBlindedCounter = (INT8)Explosive[ Item[ usWeaponIndex ].ubClassIndex ].ubDuration; + this->bBlindedCounter = (INT8)Explosive[ Item[ usWeaponIndex ].ubClassIndex ].ubDuration; // say quote - if (pSoldier->uiStatusFlags & SOLDIER_PC) + if (this->flags.uiStatusFlags & SOLDIER_PC) { - TacticalCharacterDialogue( pSoldier, QUOTE_BLINDED ); + TacticalCharacterDialogue( this, QUOTE_BLINDED ); } } else if ( NightTime() ) // if soldier outside at night { // halve effect - pSoldier->bBlindedCounter = (INT8)Explosive[ Item[ usWeaponIndex ].ubClassIndex ].ubDuration / 2; - if ( pSoldier->bBlindedCounter == 0 ) - pSoldier->bBlindedCounter = 1; - pSoldier->bDeafenedCounter /= 2; + this->bBlindedCounter = (INT8)Explosive[ Item[ usWeaponIndex ].ubClassIndex ].ubDuration / 2; + if ( this->bBlindedCounter == 0 ) + this->bBlindedCounter = 1; + this->bDeafenedCounter /= 2; // say quote - if (pSoldier->uiStatusFlags & SOLDIER_PC) + if (this->flags.uiStatusFlags & SOLDIER_PC) { - TacticalCharacterDialogue( pSoldier, QUOTE_BLINDED ); + TacticalCharacterDialogue( this, QUOTE_BLINDED ); } } - DecayIndividualOpplist( pSoldier ); + DecayIndividualOpplist( this ); break; case FIRE_WEAPON_BLINDED: @@ -4225,7 +5023,7 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa case FIRE_WEAPON_DEAFENED: //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Soldier is deafened" ); - pSoldier->bDeafenedCounter = bDeafValue; + this->bDeafenedCounter = bDeafValue; break; }; @@ -4256,16 +5054,18 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa // ATE: If it's from GUNFIRE damage, keep in mind bullets... if ( Item[ usWeaponIndex ].usItemClass & IC_GUN ) { - pNewSoldier = FreeUpAttackerGivenTarget( pSoldier->ubAttackerID, pSoldier->ubID ); + pNewSoldier = FreeUpAttackerGivenTarget( this->ubAttackerID, this->ubID ); } else { - pNewSoldier = ReduceAttackBusyGivenTarget( pSoldier->ubAttackerID, pSoldier->ubID ); + pNewSoldier = ReduceAttackBusyGivenTarget( this->ubAttackerID, this->ubID ); } if (pNewSoldier != NULL) { - pSoldier = pNewSoldier; + //warning, if this code is ever uncommented, rename all this + //to this in this function, then init this to this + this = pNewSoldier; } DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("!!!!!!! Tried to free up attacker, attack count now %d", gTacticalStatus.ubAttackBusyCount) ); } @@ -4273,138 +5073,138 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa // OK, If we are a vehicle.... damage vehicle...( people inside... ) - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( this->flags.uiStatusFlags & SOLDIER_VEHICLE ) { - SoldierTakeDamage( pSoldier, ANIM_CROUCH, sDamage, sBreathLoss, ubReason, pSoldier->ubAttackerID, NOWHERE, FALSE, TRUE ); + this->SoldierTakeDamage( ANIM_CROUCH, sDamage, sBreathLoss, ubReason, this->ubAttackerID, NOWHERE, FALSE, TRUE ); return; } // DEDUCT LIFE - ubCombinedLoss = SoldierTakeDamage( pSoldier, ANIM_CROUCH, sDamage, sBreathLoss, ubReason, pSoldier->ubAttackerID, NOWHERE, FALSE, TRUE ); + ubCombinedLoss = this->SoldierTakeDamage( ANIM_CROUCH, sDamage, sBreathLoss, ubReason, this->ubAttackerID, NOWHERE, FALSE, TRUE ); // ATE: OK, Let's check our ASSIGNMENT state, // If anything other than on a squad or guard, make them guard.... - if ( pSoldier->bTeam == gbPlayerNum ) + if ( this->bTeam == gbPlayerNum ) { - if ( pSoldier->bAssignment >= ON_DUTY && pSoldier->bAssignment != ASSIGNMENT_POW ) + if ( this->bAssignment >= ON_DUTY && this->bAssignment != ASSIGNMENT_POW ) { - if( pSoldier->fMercAsleep ) + if( this->flags.fMercAsleep ) { - pSoldier->fMercAsleep = FALSE; - pSoldier -> fForcedToStayAwake = FALSE; + this->flags.fMercAsleep = FALSE; + this->flags.fForcedToStayAwake = FALSE; // refresh map screen fCharacterInfoPanelDirty = TRUE; fTeamPanelDirty = TRUE; } - AddCharacterToAnySquad( pSoldier ); + AddCharacterToAnySquad( this ); } } // SCREAM!!!! - ubVolume = CalcScreamVolume( pSoldier, ubCombinedLoss ); + ubVolume = CalcScreamVolume( this, ubCombinedLoss ); // IF WE ARE AT A HIT_STOP ANIMATION // DO APPROPRIATE HITWHILE DOWN ANIMATION - if ( !( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_HITSTOP ) || pSoldier->usAnimState != JFK_HITDEATH_STOP ) + if ( !( gAnimControl[ this->usAnimState ].uiFlags & ANIM_HITSTOP ) || this->usAnimState != JFK_HITDEATH_STOP ) { - MakeNoise( pSoldier->ubID, pSoldier->sGridNo, pSoldier->bLevel, pSoldier->bOverTerrainType, ubVolume, NOISE_SCREAM); + MakeNoise( this->ubID, this->sGridNo, this->pathing.bLevel, this->bOverTerrainType, ubVolume, NOISE_SCREAM); } // IAN ADDED THIS SAT JUNE 14th : HAVE TO SHOW VICTIM! - if (gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT) && pSoldier->bVisible != -1 && pSoldier->bTeam == gbPlayerNum ) - LocateSoldier(pSoldier->ubID,DONTSETLOCATOR); + if (gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT) && this->bVisible != -1 && this->bTeam == gbPlayerNum ) + LocateSoldier(this->ubID,DONTSETLOCATOR); if ( Item[ usWeaponIndex ].usItemClass & IC_BLADE ) { - PlayJA2Sample( (UINT32)( KNIFE_IMPACT ), RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( (UINT32)( KNIFE_IMPACT ), RATE_11025, SoundVolume( MIDVOLUME, this->sGridNo ), 1, SoundDir( this->sGridNo ) ); } else { - PlayJA2Sample( (UINT32)( BULLET_IMPACT_1 + Random(3) ), RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( (UINT32)( BULLET_IMPACT_1 + Random(3) ), RATE_11025, SoundVolume( MIDVOLUME, this->sGridNo ), 1, SoundDir( this->sGridNo ) ); } // PLAY RANDOM GETTING HIT SOUND // ONLY IF WE ARE CONSCIOUS! - if ( pSoldier->bLife >= CONSCIOUSNESS ) + if ( this->stats.bLife >= CONSCIOUSNESS ) { - if ( pSoldier->ubBodyType == CROW ) + if ( this->ubBodyType == CROW ) { // Exploding crow... - PlayJA2Sample( CROW_EXPLODE_1, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( CROW_EXPLODE_1, RATE_11025, SoundVolume( HIGHVOLUME, this->sGridNo ), 1, SoundDir( this->sGridNo ) ); } else { // ATE: This is to disallow large amounts of smaples being played which is load! - if ( pSoldier->fGettingHit && pSoldier->usAniCode != STANDING_BURST_HIT ) + if ( this->flags.fGettingHit && this->usAniCode != STANDING_BURST_HIT ) { } else { - DoMercBattleSound( pSoldier, (INT8)( BATTLE_SOUND_HIT1 + Random( 2 ) ) ); + this->DoMercBattleSound( (INT8)( BATTLE_SOUND_HIT1 + Random( 2 ) ) ); } } } // CHECK FOR DOING HIT WHILE DOWN - if ( ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_HITSTOP ) ) + if ( ( gAnimControl[ this->usAnimState ].uiFlags & ANIM_HITSTOP ) ) { - switch( pSoldier->usAnimState ) + switch( this->usAnimState ) { case FLYBACKHIT_STOP: - ChangeSoldierState( pSoldier, FALLBACK_DEATHTWICH, 0, FALSE ); + this->ChangeSoldierState( FALLBACK_DEATHTWICH, 0, FALSE ); break; case STAND_FALLFORWARD_STOP: - ChangeSoldierState( pSoldier, GENERIC_HIT_DEATHTWITCHNB, 0, FALSE ); + this->ChangeSoldierState( GENERIC_HIT_DEATHTWITCHNB, 0, FALSE ); break; case JFK_HITDEATH_STOP: - ChangeSoldierState( pSoldier, JFK_HITDEATH_TWITCHB, 0, FALSE ); + this->ChangeSoldierState( JFK_HITDEATH_TWITCHB, 0, FALSE ); break; case FALLBACKHIT_STOP: - ChangeSoldierState( pSoldier, FALLBACK_HIT_DEATHTWITCHNB, 0, FALSE ); + this->ChangeSoldierState( FALLBACK_HIT_DEATHTWITCHNB, 0, FALSE ); break; case PRONE_LAYFROMHIT_STOP: - ChangeSoldierState( pSoldier, PRONE_HIT_DEATHTWITCHNB, 0, FALSE ); + this->ChangeSoldierState( PRONE_HIT_DEATHTWITCHNB, 0, FALSE ); break; case PRONE_HITDEATH_STOP: - ChangeSoldierState( pSoldier, PRONE_HIT_DEATHTWITCHB, 0 , FALSE ); + this->ChangeSoldierState( PRONE_HIT_DEATHTWITCHB, 0 , FALSE ); break; case FALLFORWARD_HITDEATH_STOP: - ChangeSoldierState( pSoldier, GENERIC_HIT_DEATHTWITCHB, 0 , FALSE ); + this->ChangeSoldierState( GENERIC_HIT_DEATHTWITCHB, 0 , FALSE ); break; case FALLBACK_HITDEATH_STOP: - ChangeSoldierState( pSoldier, FALLBACK_HIT_DEATHTWITCHB, 0 , FALSE ); + this->ChangeSoldierState( FALLBACK_HIT_DEATHTWITCHB, 0 , FALSE ); break; case FALLOFF_DEATH_STOP: - ChangeSoldierState( pSoldier, FALLOFF_TWITCHB, 0 , FALSE ); + this->ChangeSoldierState( FALLOFF_TWITCHB, 0 , FALSE ); break; case FALLOFF_STOP: - ChangeSoldierState( pSoldier, FALLOFF_TWITCHNB, 0 , FALSE ); + this->ChangeSoldierState( FALLOFF_TWITCHNB, 0 , FALSE ); break; case FALLOFF_FORWARD_DEATH_STOP: - ChangeSoldierState( pSoldier, FALLOFF_FORWARD_TWITCHB, 0 , FALSE ); + this->ChangeSoldierState( FALLOFF_FORWARD_TWITCHB, 0 , FALSE ); break; case FALLOFF_FORWARD_STOP: - ChangeSoldierState( pSoldier, FALLOFF_FORWARD_TWITCHNB, 0 , FALSE ); + this->ChangeSoldierState( FALLOFF_FORWARD_TWITCHNB, 0 , FALSE ); break; default: - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Soldier Control: Death state %d has no death hit", pSoldier->usAnimState ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Soldier Control: Death state %d has no death hit", this->usAnimState ) ); } return; @@ -4412,35 +5212,35 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa // Set goback to aim after hit flag! // Only if we were aiming! - if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIREREADY ) + if ( gAnimControl[ this->usAnimState ].uiFlags & ANIM_FIREREADY ) { - pSoldier->fGoBackToAimAfterHit = TRUE; + this->flags.fGoBackToAimAfterHit = TRUE; } // IF COWERING, PLAY SPECIFIC GENERIC HIT STAND... - if ( pSoldier->uiStatusFlags & SOLDIER_COWERING ) + if ( this->flags.uiStatusFlags & SOLDIER_COWERING ) { - if ( pSoldier->bLife == 0 || IS_MERC_BODY_TYPE( pSoldier ) ) + if ( this->stats.bLife == 0 || IS_MERC_BODY_TYPE( this ) ) { - EVENT_InitNewSoldierAnim( pSoldier, GENERIC_HIT_STAND, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( GENERIC_HIT_STAND, 0 , FALSE ); } else { - EVENT_InitNewSoldierAnim( pSoldier, CIV_COWER_HIT, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( CIV_COWER_HIT, 0 , FALSE ); } return; } // Change based on body type - switch( pSoldier->ubBodyType ) + switch( this->ubBodyType ) { case COW: - EVENT_InitNewSoldierAnim( pSoldier, COW_HIT, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( COW_HIT, 0 , FALSE ); return; break; case BLOODCAT: - EVENT_InitNewSoldierAnim( pSoldier, BLOODCAT_HIT, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( BLOODCAT_HIT, 0 , FALSE ); return; break; @@ -4449,17 +5249,17 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa case YAF_MONSTER: case YAM_MONSTER: - EVENT_InitNewSoldierAnim( pSoldier, ADULTMONSTER_HIT, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( ADULTMONSTER_HIT, 0 , FALSE ); return; break; case LARVAE_MONSTER: - EVENT_InitNewSoldierAnim( pSoldier, LARVAE_HIT, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( LARVAE_HIT, 0 , FALSE ); return; break; case QUEENMONSTER: - EVENT_InitNewSoldierAnim( pSoldier, QUEEN_HIT, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( QUEEN_HIT, 0 , FALSE ); return; break; @@ -4467,10 +5267,10 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa { // OK, do some code here to allow the fact that poor buddy can be thrown back if it's a big enough hit... - EVENT_InitNewSoldierAnim( pSoldier, CRIPPLE_HIT, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( CRIPPLE_HIT, 0 , FALSE ); - //pSoldier->bLife = 0; - //EVENT_InitNewSoldierAnim( pSoldier, CRIPPLE_DIE_FLYBACK, 0 , FALSE ); + //this->stats.bLife = 0; + //this->EVENT_InitNewSoldierAnim( CRIPPLE_DIE_FLYBACK, 0 , FALSE ); } @@ -4478,18 +5278,18 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa break; case ROBOTNOWEAPON: - EVENT_InitNewSoldierAnim( pSoldier, ROBOTNW_HIT, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( ROBOTNW_HIT, 0 , FALSE ); return; break; case INFANT_MONSTER: - EVENT_InitNewSoldierAnim( pSoldier, INFANT_HIT, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( INFANT_HIT, 0 , FALSE ); return; case CROW: - EVENT_InitNewSoldierAnim( pSoldier, CROW_DIE, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( CROW_DIE, 0 , FALSE ); return; //case FATCIV: @@ -4500,52 +5300,52 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa case KIDCIV: // OK, if life is 0 and not set as dead ( this is a death hit... ) - if ( !( pSoldier->uiStatusFlags & SOLDIER_DEAD ) && pSoldier->bLife == 0 ) + if ( !( this->flags.uiStatusFlags & SOLDIER_DEAD ) && this->stats.bLife == 0 ) { // Randomize death! if ( Random( 2 ) ) { - EVENT_InitNewSoldierAnim( pSoldier, CIV_DIE2, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( CIV_DIE2, 0 , FALSE ); return; } } // IF here, go generic hit ALWAYS..... - EVENT_InitNewSoldierAnim( pSoldier, GENERIC_HIT_STAND, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( GENERIC_HIT_STAND, 0 , FALSE ); return; break; } // If here, we are a merc, check if we are in water - if ( MercInShallowWater( pSoldier) ) + if ( this->MercInShallowWater( ) ) { - EVENT_InitNewSoldierAnim( pSoldier, WATER_HIT, 0 , FALSE ); - return; + this->EVENT_InitNewSoldierAnim( WATER_HIT, 0 , FALSE ); + return; } - if ( MercInDeepWater( pSoldier) ) + if ( this->MercInDeepWater( ) ) { - EVENT_InitNewSoldierAnim( pSoldier, DEEP_WATER_HIT, 0 , FALSE ); - return; + this->EVENT_InitNewSoldierAnim( DEEP_WATER_HIT, 0 , FALSE ); + return; } // SWITCH IN TYPE OF WEAPON if ( Item[ usWeaponIndex ].usItemClass & ( IC_GUN | IC_THROWING_KNIFE ) ) - { - SoldierGotHitGunFire( pSoldier, usWeaponIndex, sDamage, bDirection, sRange, ubAttackerID, ubSpecial, ubHitLocation ); + { + SoldierGotHitGunFire( this, usWeaponIndex, sDamage, bDirection, sRange, ubAttackerID, ubSpecial, ubHitLocation ); } if ( Item[ usWeaponIndex ].usItemClass & IC_BLADE ) - { - SoldierGotHitBlade( pSoldier, usWeaponIndex, sDamage, bDirection, sRange, ubAttackerID, ubSpecial, ubHitLocation ); + { + SoldierGotHitBlade( this, usWeaponIndex, sDamage, bDirection, sRange, ubAttackerID, ubSpecial, ubHitLocation ); } // marke setting ammo explosions included here with 3rd 'or' including ubReason if ( Item[ usWeaponIndex ].usItemClass & IC_EXPLOSV || Item[ usWeaponIndex ].usItemClass & IC_TENTACLES || ubReason == TAKE_DAMAGE_EXPLOSION ) - { - SoldierGotHitExplosion( pSoldier, usWeaponIndex, sDamage, bDirection, sRange, ubAttackerID, ubSpecial, ubHitLocation ); + { + SoldierGotHitExplosion( this, usWeaponIndex, sDamage, bDirection, sRange, ubAttackerID, ubSpecial, ubHitLocation ); } if ( Item[ usWeaponIndex ].usItemClass & IC_PUNCH ) - { - SoldierGotHitPunch( pSoldier, usWeaponIndex, sDamage, bDirection, sRange, ubAttackerID, ubSpecial, ubHitLocation ); + { + SoldierGotHitPunch( this, usWeaponIndex, sDamage, bDirection, sRange, ubAttackerID, ubSpecial, ubHitLocation ); } } @@ -4599,32 +5399,32 @@ void DoGenericHit( SOLDIERTYPE *pSoldier, UINT8 ubSpecial, INT16 bDirection ) if ( ubSpecial == FIRE_WEAPON_BURST_SPECIAL && pSoldier->ubBodyType <= REGFEMALE ) { //SetSoldierDesiredDirection( pSoldier, bDirection ); - EVENT_SetSoldierDirection( pSoldier, (INT8)bDirection ); - EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection ); + pSoldier->EVENT_SetSoldierDirection( (INT8)bDirection ); + pSoldier->EVENT_SetSoldierDesiredDirection( pSoldier->ubDirection ); - EVENT_InitNewSoldierAnim( pSoldier, STANDING_BURST_HIT, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( STANDING_BURST_HIT, 0 , FALSE ); } else { // Check in hand for rifle - if ( SoldierCarriesTwoHandedWeapon( pSoldier ) ) + if ( pSoldier->SoldierCarriesTwoHandedWeapon( ) ) { - EVENT_InitNewSoldierAnim( pSoldier, RIFLE_STAND_HIT, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( RIFLE_STAND_HIT, 0 , FALSE ); } else { - EVENT_InitNewSoldierAnim( pSoldier, GENERIC_HIT_STAND, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( GENERIC_HIT_STAND, 0 , FALSE ); } } break; case ANIM_PRONE: - EVENT_InitNewSoldierAnim( pSoldier, GENERIC_HIT_PRONE, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( GENERIC_HIT_PRONE, 0 , FALSE ); break; case ANIM_CROUCH: - EVENT_InitNewSoldierAnim( pSoldier, GENERIC_HIT_CROUCH, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( GENERIC_HIT_CROUCH, 0 , FALSE ); break; } @@ -4633,14 +5433,14 @@ void DoGenericHit( SOLDIERTYPE *pSoldier, UINT8 ubSpecial, INT16 bDirection ) void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ) { - UINT16 usNewGridNo; + INT16 sNewGridNo; BOOLEAN fBlownAway = FALSE; BOOLEAN fHeadHit = FALSE; BOOLEAN fFallenOver = FALSE; // MAYBE CHANGE TO SPECIAL ANIMATION BASED ON VALUE SET BY DAMAGE CALCULATION CODE // ALL THESE ONLY WORK ON STANDING PEOPLE - if (!(pSoldier->uiStatusFlags & SOLDIER_MONSTER) && gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_STAND) + if (!(pSoldier->flags.uiStatusFlags & SOLDIER_MONSTER) && gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_STAND) { if (gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_STAND ) { @@ -4650,14 +5450,14 @@ void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sD { if (SpacesAway( pSoldier->sGridNo, Menptr[ubAttackerID].sGridNo ) <= MAX_DISTANCE_FOR_MESSY_DEATH || (SpacesAway( pSoldier->sGridNo, Menptr[ubAttackerID].sGridNo ) <= MAX_BARRETT_DISTANCE_FOR_MESSY_DEATH && usWeaponIndex == BARRETT )) { - usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (INT8)( DirectionInc( pSoldier->ubDirection ) ) ); + sNewGridNo = NewGridNo( (INT16)pSoldier->sGridNo, (INT8)( DirectionInc( pSoldier->ubDirection ) ) ); // CHECK OK DESTINATION! - if ( OKFallDirection( pSoldier, usNewGridNo, pSoldier->bLevel, pSoldier->ubDirection, JFK_HITDEATH ) ) + if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->pathing.bLevel, pSoldier->ubDirection, JFK_HITDEATH ) ) { - usNewGridNo = NewGridNo( (UINT16)usNewGridNo, (INT8)( DirectionInc( pSoldier->ubDirection ) ) ); + sNewGridNo = NewGridNo( (INT16)sNewGridNo, (INT8)( DirectionInc( pSoldier->ubDirection ) ) ); - if ( OKFallDirection( pSoldier, usNewGridNo, pSoldier->bLevel, pSoldier->ubDirection, pSoldier->usAnimState ) ) + if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->pathing.bLevel, pSoldier->ubDirection, pSoldier->usAnimState ) ) { fHeadHit = TRUE; } @@ -4675,13 +5475,13 @@ void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sD // possibly play torso explosion anim! if (pSoldier->ubDirection == bDirection) { - usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( gOppositeDirection[ pSoldier->ubDirection ] ) ); + sNewGridNo = NewGridNo( (INT16)pSoldier->sGridNo, DirectionInc( gOppositeDirection[ pSoldier->ubDirection ] ) ); - if ( OKFallDirection( pSoldier, usNewGridNo, pSoldier->bLevel, gOppositeDirection[ bDirection ], FLYBACK_HIT ) ) + if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->pathing.bLevel, gOppositeDirection[ bDirection ], FLYBACK_HIT ) ) { - usNewGridNo = NewGridNo( (UINT16)usNewGridNo, DirectionInc( gOppositeDirection[ bDirection ] ) ); + sNewGridNo = NewGridNo( (INT16)sNewGridNo, DirectionInc( gOppositeDirection[ bDirection ] ) ); - if ( OKFallDirection( pSoldier, usNewGridNo, pSoldier->bLevel, gOppositeDirection[ bDirection ], pSoldier->usAnimState ) ) + if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->pathing.bLevel, gOppositeDirection[ bDirection ], pSoldier->usAnimState ) ) { fBlownAway = TRUE; } @@ -4697,7 +5497,7 @@ void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sD if (IsValidStance( pSoldier, ANIM_PRONE ) ) { // Can't be in water, or not standing - if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_STAND && !MercInWater( pSoldier ) ) + if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_STAND && !pSoldier->MercInWater( ) ) { fFallenOver = TRUE; ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 20 ], pSoldier->name ); @@ -4708,7 +5508,7 @@ void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sD } // IF HERE AND GUY IS DEAD, RETURN! - if ( pSoldier->uiStatusFlags & SOLDIER_DEAD ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) { // 0verhaul: Handled in the soldier state change code // DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Releasesoldierattacker,Dead soldier hit" ) ); @@ -4723,21 +5523,21 @@ void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sD } if ( fBlownAway ) - { + { // Only for mercs... if ( pSoldier->ubBodyType < 4 ) { - ChangeToFlybackAnimation( pSoldier, (INT8)bDirection ); + pSoldier->ChangeToFlybackAnimation( (UINT8)bDirection ); return; } } if ( fHeadHit ) - { + { // Only for mercs ( or KIDS! ) if ( pSoldier->ubBodyType < 4 || pSoldier->ubBodyType == HATKIDCIV || pSoldier->ubBodyType == KIDCIV ) { - EVENT_InitNewSoldierAnim( pSoldier, JFK_HITDEATH, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( JFK_HITDEATH, 0 , FALSE ); return; } } @@ -4751,32 +5551,32 @@ void SoldierGotHitExplosion( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 INT16 sNewGridNo; // IF HERE AND GUY IS DEAD, RETURN! - if ( pSoldier->uiStatusFlags & SOLDIER_DEAD ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) { return; } //check for services - ReceivingSoldierCancelServices( pSoldier ); - GivingSoldierCancelServices( pSoldier ); + pSoldier->ReceivingSoldierCancelServices( ); + pSoldier->GivingSoldierCancelServices( ); if ( gGameSettings.fOptions[ TOPTION_BLOOD_N_GORE ] ) { - if ( Explosive[ Item[ usWeaponIndex ].ubClassIndex ].ubRadius >= 3 && pSoldier->bLife == 0 && gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_PRONE ) + if ( Explosive[ Item[ usWeaponIndex ].ubClassIndex ].ubRadius >= 3 && pSoldier->stats.bLife == 0 && gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_PRONE ) { if ( sRange >= 2 && sRange <= 4 ) { - DoMercBattleSound( pSoldier, (INT8)( BATTLE_SOUND_HIT1 + Random( 2 ) ) ); + pSoldier->DoMercBattleSound( (INT8)( BATTLE_SOUND_HIT1 + Random( 2 ) ) ); - EVENT_InitNewSoldierAnim( pSoldier, CHARIOTS_OF_FIRE, 0 , FALSE ); - return; + pSoldier->EVENT_InitNewSoldierAnim( CHARIOTS_OF_FIRE, 0 , FALSE ); + return; } else if ( sRange <= 1 ) { - DoMercBattleSound( pSoldier, (INT8)( BATTLE_SOUND_HIT1 + Random( 2 ) ) ); + pSoldier->DoMercBattleSound( (INT8)( BATTLE_SOUND_HIT1 + Random( 2 ) ) ); - EVENT_InitNewSoldierAnim( pSoldier, BODYEXPLODING, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( BODYEXPLODING, 0 , FALSE ); return; } } @@ -4813,14 +5613,14 @@ void SoldierGotHitExplosion( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 case 4: case 5: // 6 of 10 - crouch - ChangeSoldierStance( pSoldier, ANIM_CROUCH ); + pSoldier->ChangeSoldierStance( ANIM_CROUCH ); break; case 6: case 7: case 8: // 3 of 10 - fall forward - BeginTyingToFall( pSoldier ); - EVENT_InitNewSoldierAnim( pSoldier, FALLFORWARD_FROMHIT_STAND, 0, FALSE ); + pSoldier->BeginTyingToFall( ); + pSoldier->EVENT_InitNewSoldierAnim( FALLFORWARD_FROMHIT_STAND, 0, FALSE ); break; case 9: // 1 of 10 - still standing @@ -4839,7 +5639,7 @@ void SoldierGotHitExplosion( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 case 3: case 4: // 5 of 10 - crouch - ChangeSoldierStance( pSoldier, ANIM_CROUCH ); + pSoldier->ChangeSoldierStance( ANIM_CROUCH ); break; case 5: case 6: @@ -4847,17 +5647,17 @@ void SoldierGotHitExplosion( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 case 8: // 4 of 10 - fall backward (if possible) either forward // Check behind us! - sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( gOppositeDirection[ bDirection ] ) ); - if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->bLevel, gOppositeDirection[ bDirection ], FLYBACK_HIT ) ) + sNewGridNo = NewGridNo( (INT16)pSoldier->sGridNo, DirectionInc( gOppositeDirection[ bDirection ] ) ); + if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->pathing.bLevel, gOppositeDirection[ bDirection ], FLYBACK_HIT ) ) { - EVENT_SetSoldierDirection( pSoldier, (INT8)bDirection ); - EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection ); - ChangeToFallbackAnimation( pSoldier, (INT8)bDirection ); + pSoldier->EVENT_SetSoldierDirection( (INT8)bDirection ); + pSoldier->EVENT_SetSoldierDesiredDirection( pSoldier->ubDirection ); + pSoldier->ChangeToFallbackAnimation( (UINT8)bDirection ); } else { - BeginTyingToFall( pSoldier ); - EVENT_InitNewSoldierAnim( pSoldier, FALLFORWARD_FROMHIT_STAND, 0, FALSE ); + pSoldier->BeginTyingToFall( ); + pSoldier->EVENT_InitNewSoldierAnim( FALLFORWARD_FROMHIT_STAND, 0, FALSE ); } break; case 9: @@ -4881,22 +5681,22 @@ void SoldierGotHitExplosion( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 break; } - EVENT_SetSoldierDirection( pSoldier, (INT8)bDirection ); - EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection ); + pSoldier->EVENT_SetSoldierDirection( (INT8)bDirection ); + pSoldier->EVENT_SetSoldierDesiredDirection( pSoldier->ubDirection ); // Check behind us! - sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( gOppositeDirection[ bDirection ] ) ); + sNewGridNo = NewGridNo( (INT16)pSoldier->sGridNo, DirectionInc( gOppositeDirection[ bDirection ] ) ); - if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->bLevel, gOppositeDirection[ bDirection ], FLYBACK_HIT ) ) + if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->pathing.bLevel, gOppositeDirection[ bDirection ], FLYBACK_HIT ) ) { - ChangeToFallbackAnimation( pSoldier, (INT8)bDirection ); + pSoldier->ChangeToFallbackAnimation( (UINT8)bDirection ); } else { if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_STAND ) { - BeginTyingToFall( pSoldier ); - EVENT_InitNewSoldierAnim( pSoldier, FALLFORWARD_FROMHIT_STAND, 0, FALSE ); + pSoldier->BeginTyingToFall( ); + pSoldier->EVENT_InitNewSoldierAnim( FALLFORWARD_FROMHIT_STAND, 0, FALSE ); } else { @@ -4918,7 +5718,7 @@ void SoldierGotHitBlade( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDam { // IF HERE AND GUY IS DEAD, RETURN! - if ( pSoldier->uiStatusFlags & SOLDIER_DEAD ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) { return; } @@ -4930,22 +5730,22 @@ void SoldierGotHitBlade( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDam case ANIM_STAND: // Check in hand for rifle - if ( SoldierCarriesTwoHandedWeapon( pSoldier ) ) + if ( pSoldier->SoldierCarriesTwoHandedWeapon( ) ) { - EVENT_InitNewSoldierAnim( pSoldier, RIFLE_STAND_HIT, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( RIFLE_STAND_HIT, 0 , FALSE ); } else { - EVENT_InitNewSoldierAnim( pSoldier, GENERIC_HIT_STAND, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( GENERIC_HIT_STAND, 0 , FALSE ); } break; case ANIM_CROUCH: - EVENT_InitNewSoldierAnim( pSoldier, GENERIC_HIT_CROUCH, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( GENERIC_HIT_CROUCH, 0 , FALSE ); break; case ANIM_PRONE: - EVENT_InitNewSoldierAnim( pSoldier, GENERIC_HIT_PRONE, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( GENERIC_HIT_PRONE, 0 , FALSE ); break; } @@ -4956,7 +5756,7 @@ void SoldierGotHitPunch( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDam { // IF HERE AND GUY IS DEAD, RETURN! - if ( pSoldier->uiStatusFlags & SOLDIER_DEAD ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) { return; } @@ -4966,22 +5766,22 @@ void SoldierGotHitPunch( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDam { case ANIM_STAND: // Check in hand for rifle - if ( SoldierCarriesTwoHandedWeapon( pSoldier ) ) + if ( pSoldier->SoldierCarriesTwoHandedWeapon( ) ) { - EVENT_InitNewSoldierAnim( pSoldier, RIFLE_STAND_HIT, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( RIFLE_STAND_HIT, 0 , FALSE ); } else { - EVENT_InitNewSoldierAnim( pSoldier, GENERIC_HIT_STAND, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( GENERIC_HIT_STAND, 0 , FALSE ); } break; case ANIM_CROUCH: - EVENT_InitNewSoldierAnim( pSoldier, GENERIC_HIT_CROUCH, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( GENERIC_HIT_CROUCH, 0 , FALSE ); break; case ANIM_PRONE: - EVENT_InitNewSoldierAnim( pSoldier, GENERIC_HIT_PRONE, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( GENERIC_HIT_PRONE, 0 , FALSE ); break; } @@ -4989,7 +5789,7 @@ void SoldierGotHitPunch( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDam } -BOOLEAN EVENT_InternalGetNewSoldierPath( SOLDIERTYPE *pSoldier, UINT16 sDestGridNo, UINT16 usMovementAnim, BOOLEAN fFromUI, BOOLEAN fForceRestartAnim ) +BOOLEAN SOLDIERTYPE::EVENT_InternalGetNewSoldierPath( INT16 sDestGridNo, UINT16 usMovementAnim, BOOLEAN fFromUI, BOOLEAN fForceRestartAnim ) { INT32 iDest; INT16 sNewGridNo; @@ -5006,7 +5806,7 @@ BOOLEAN EVENT_InternalGetNewSoldierPath( SOLDIERTYPE *pSoldier, UINT16 sDestGrid // Ifd this code, make true if a player if ( fFromUI == 3 ) { - if ( pSoldier->bTeam == gbPlayerNum ) + if ( this->bTeam == gbPlayerNum ) { fFromUI = 1; } @@ -5017,21 +5817,21 @@ BOOLEAN EVENT_InternalGetNewSoldierPath( SOLDIERTYPE *pSoldier, UINT16 sDestGrid } // ATE: if a civ, and from UI, and were cowering, remove from cowering - if ( AM_AN_EPC( pSoldier ) && fFromUI ) + if ( AM_AN_EPC( this ) && fFromUI ) { - if ( pSoldier->uiStatusFlags & SOLDIER_COWERING ) + if ( this->flags.uiStatusFlags & SOLDIER_COWERING ) { - SetSoldierCowerState( pSoldier, FALSE ); + this->SetSoldierCowerState( FALSE ); usMoveAnimState = WALKING; } } - pSoldier->bGoodContPath = FALSE; + this->bGoodContPath = FALSE; - if ( pSoldier->fDelayedMovement ) + if ( this->flags.fDelayedMovement ) { - if ( pSoldier->ubDelayedMovementFlags & DELAYED_MOVEMENT_FLAG_PATH_THROUGH_PEOPLE ) + if ( this->ubDelayedMovementFlags & DELAYED_MOVEMENT_FLAG_PATH_THROUGH_PEOPLE ) { fFlags = PATH_THROUGH_PEOPLE; } @@ -5039,7 +5839,7 @@ BOOLEAN EVENT_InternalGetNewSoldierPath( SOLDIERTYPE *pSoldier, UINT16 sDestGrid { fFlags = PATH_IGNORE_PERSON_AT_DEST; } - pSoldier->fDelayedMovement = FALSE; + this->flags.fDelayedMovement = FALSE; } if ( gfGetNewPathThroughPeople ) @@ -5048,64 +5848,64 @@ BOOLEAN EVENT_InternalGetNewSoldierPath( SOLDIERTYPE *pSoldier, UINT16 sDestGrid } // ATE: Some stuff here for realtime, going through interface.... - if ( ( !( gTacticalStatus.uiFlags & INCOMBAT ) && ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_MOVING ) && fFromUI == 1 ) || fFromUI == 2 ) + if ( ( !( gTacticalStatus.uiFlags & INCOMBAT ) && ( gAnimControl[ this->usAnimState ].uiFlags & ANIM_MOVING ) && fFromUI == 1 ) || fFromUI == 2 ) { - if ( pSoldier->bCollapsed ) + if ( this->bCollapsed ) { return( FALSE ); } - sMercGridNo = pSoldier->sGridNo; - pSoldier->sGridNo = pSoldier->sDestination; + sMercGridNo = this->sGridNo; + this->sGridNo = this->pathing.sDestination; // Check if path is good before copying it into guy's path... - if ( !(uiDist = FindBestPath( pSoldier, sDestGridNo, pSoldier->bLevel, pSoldier->usUIMovementMode, COPYROUTE, fFlags ) ) ) + if ( !(uiDist = FindBestPath( this, sDestGridNo, this->pathing.bLevel, this->usUIMovementMode, COPYROUTE, fFlags ) ) ) { // Set to old.... - pSoldier->sGridNo = sMercGridNo; + this->sGridNo = sMercGridNo; return( FALSE ); } - //uiDist = FindBestPath( pSoldier, sDestGridNo, pSoldier->bLevel, pSoldier->usUIMovementMode, COPYROUTE, fFlags ); + //uiDist = FindBestPath( this, sDestGridNo, this->pathing.bLevel, this->usUIMovementMode, COPYROUTE, fFlags ); - pSoldier->sGridNo = sMercGridNo; - pSoldier->sFinalDestination = sDestGridNo; + this->sGridNo = sMercGridNo; + this->pathing.sFinalDestination = sDestGridNo; if ( uiDist > 0 ) - { + { // Add one to path data size.... if ( fAdvancePath ) { - memcpy( usPathingData, pSoldier->usPathingData, sizeof( usPathingData ) ); + memcpy( usPathingData, this->pathing.usPathingData, sizeof( usPathingData ) ); ubPathingMaxDirection = (UINT8)usPathingData[ MAX_PATH_LIST_SIZE -1 ]; - memcpy( &(pSoldier->usPathingData[1]), usPathingData, sizeof( usPathingData ) - sizeof( UINT16 ) ); + memcpy( &(this->pathing.usPathingData[1]), usPathingData, sizeof( usPathingData ) - sizeof( UINT16 ) ); // If we have reach the max, go back one sFinalDest.... - if ( pSoldier->usPathDataSize == MAX_PATH_LIST_SIZE ) + if ( this->pathing.usPathDataSize == MAX_PATH_LIST_SIZE ) { - //pSoldier->sFinalDestination = NewGridNo( (UINT16)pSoldier->sFinalDestination, DirectionInc( gOppositeDirection[ ubPathingMaxDirection ] ) ); + //this->pathing.sFinalDestination = NewGridNo( (INT16)this->pathing.sFinalDestination, DirectionInc( gOppositeDirection[ ubPathingMaxDirection ] ) ); } else { - pSoldier->usPathDataSize++; + this->pathing.usPathDataSize++; } } - usMoveAnimState = pSoldier->usUIMovementMode; + usMoveAnimState = this->usUIMovementMode; - if ( MercInDeepWater( pSoldier) ) + if ( this->MercInDeepWater( ) ) { usMoveAnimState = DEEP_WATER_SWIM; } // Change animation only.... set value to NOT call any goto new gridno stuff..... - if ( usMoveAnimState != pSoldier->usAnimState ) + if ( usMoveAnimState != this->usAnimState ) { // - pSoldier->usDontUpdateNewGridNoOnMoveAnimChange = TRUE; + this->usDontUpdateNewGridNoOnMoveAnimChange = TRUE; - EVENT_InitNewSoldierAnim( pSoldier, usMoveAnimState, 0, FALSE ); + this->EVENT_InitNewSoldierAnim( usMoveAnimState, 0, FALSE ); } return( TRUE ); @@ -5117,60 +5917,58 @@ BOOLEAN EVENT_InternalGetNewSoldierPath( SOLDIERTYPE *pSoldier, UINT16 sDestGrid // we can use the soldier's level here because we don't have pathing across levels right now... #if 0 // Uhhmmmm, the name of this function has "NEWPath" in it. - if (pSoldier->bPathStored) + if (this->pathing.bPathStored) { fContinue = TRUE; } else { #endif - iDest = FindBestPath( pSoldier, sDestGridNo, pSoldier->bLevel, usMovementAnim, COPYROUTE, fFlags ); + iDest = FindBestPath( this, sDestGridNo, this->pathing.bLevel, usMovementAnim, COPYROUTE, fFlags ); fContinue = (iDest != 0); -#if 0 - } -#endif +// } // Only if we can get a path here if ( fContinue ) { // Debug messages - DebugMsg( TOPIC_JA2, DBG_LEVEL_0, String( "Soldier %d: Get new path", pSoldier->ubID ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_0, String( "Soldier %d: Get new path", this->ubID ) ); // Set final destination - pSoldier->sFinalDestination = sDestGridNo; - pSoldier->fPastXDest = 0; - pSoldier->fPastYDest = 0; + this->pathing.sFinalDestination = sDestGridNo; + this->flags.fPastXDest = 0; + this->flags.fPastYDest = 0; // CHECK IF FIRST TILE IS FREE - sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( (UINT8)pSoldier->usPathingData[ pSoldier->usPathIndex ] ) ); + sNewGridNo = NewGridNo( (INT16)this->sGridNo, DirectionInc( (UINT8)this->pathing.usPathingData[ this->pathing.usPathIndex ] ) ); // If true, we're OK, if not, WAIT for a guy to pass! // If we are in deep water, we can only swim! - if ( MercInDeepWater( pSoldier) ) + if ( this->MercInDeepWater( ) ) { usMoveAnimState = DEEP_WATER_SWIM; } // Can't forget shallow water! AI will sometimes attempt to swat through it, which is not legal either - else if ( MercInWater( pSoldier) ) + else if ( this->MercInWater( ) ) { usMoveAnimState = WALKING; } // If we were aiming, end aim! - usAnimState = PickSoldierReadyAnimation( pSoldier, TRUE ); + usAnimState = PickSoldierReadyAnimation( this, TRUE ); // Add a pending animation first! // Only if we were standing! - if ( usAnimState != INVALID_ANIMATION && gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_STAND ) + if ( usAnimState != INVALID_ANIMATION && gAnimControl[ this->usAnimState ].ubEndHeight == ANIM_STAND ) { - EVENT_InitNewSoldierAnim( pSoldier, usAnimState, 0, FALSE ); - pSoldier->usPendingAnimation = usMoveAnimState; + this->EVENT_InitNewSoldierAnim( usAnimState, 0, FALSE ); + this->usPendingAnimation = usMoveAnimState; } else { // Call local copy for change soldier state! - EVENT_InitNewSoldierAnim( pSoldier, usMoveAnimState, 0, fForceRestartAnim ); + this->EVENT_InitNewSoldierAnim( usMoveAnimState, 0, fForceRestartAnim ); } @@ -5185,91 +5983,91 @@ BOOLEAN EVENT_InternalGetNewSoldierPath( SOLDIERTYPE *pSoldier, UINT16 sDestGrid return( FALSE ); } -void EVENT_GetNewSoldierPath( SOLDIERTYPE *pSoldier, UINT16 sDestGridNo, UINT16 usMovementAnim ) +void SOLDIERTYPE::EVENT_GetNewSoldierPath( INT16 sDestGridNo, UINT16 usMovementAnim ) { // ATE: Default restart of animation to TRUE - EVENT_InternalGetNewSoldierPath( pSoldier, sDestGridNo, usMovementAnim, FALSE, TRUE ); + this->EVENT_InternalGetNewSoldierPath( sDestGridNo, usMovementAnim, FALSE, TRUE ); } // Change our state based on stance, to stop! -void StopSoldier( SOLDIERTYPE *pSoldier ) +void SOLDIERTYPE::StopSoldier( void ) { - ReceivingSoldierCancelServices( pSoldier ); - GivingSoldierCancelServices( pSoldier ); + this->ReceivingSoldierCancelServices( ); + this->GivingSoldierCancelServices( ); - if ( !( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_STATIONARY ) ) + if ( !( gAnimControl[ this->usAnimState ].uiFlags & ANIM_STATIONARY ) ) { - //SoldierGotoStationaryStance( pSoldier ); - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + //this->SoldierGotoStationaryStance( ); + this->EVENT_StopMerc( this->sGridNo, this->ubDirection ); } // Set desination - pSoldier->sFinalDestination = pSoldier->sGridNo; + this->pathing.sFinalDestination = this->sGridNo; } -void SoldierGotoStationaryStance( SOLDIERTYPE *pSoldier ) +void SOLDIERTYPE::SoldierGotoStationaryStance( void ) { // ATE: This is to turn off fast movement, that us used to change movement mode // for ui display on stance changes.... - if ( pSoldier->bTeam == gbPlayerNum ) + if ( this->bTeam == gbPlayerNum ) { - //pSoldier->fUIMovementFast = FALSE; + //this->flags.fUIMovementFast = FALSE; } // The queen, if she sees anybody, goes to ready, not normal breath.... - if ( pSoldier->ubBodyType == QUEENMONSTER ) + if ( this->ubBodyType == QUEENMONSTER ) { - if ( pSoldier->bOppCnt > 0 || pSoldier->bTeam == gbPlayerNum ) + if ( this->aiData.bOppCnt > 0 || this->bTeam == gbPlayerNum ) { - EVENT_InitNewSoldierAnim( pSoldier, QUEEN_READY, 0 , TRUE ); + this->EVENT_InitNewSoldierAnim( QUEEN_READY, 0 , TRUE ); return; } } // Check if we are in deep water! - if ( MercInDeepWater( pSoldier) ) + if ( this->MercInDeepWater( ) ) { // IN deep water, tred! - EVENT_InitNewSoldierAnim( pSoldier, DEEP_WATER_TRED, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( DEEP_WATER_TRED, 0 , FALSE ); } - else if ( pSoldier->ubServicePartner != NOBODY && pSoldier->bLife >= OKLIFE && pSoldier->bBreath > 0 ) + else if ( this->ubServicePartner != NOBODY && this->stats.bLife >= OKLIFE && this->bBreath > 0 ) { - EVENT_InitNewSoldierAnim( pSoldier, GIVING_AID, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( GIVING_AID, 0 , FALSE ); } else { // Change state back to stationary state for given height - switch( gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) + switch( gAnimControl[ this->usAnimState ].ubEndHeight ) { case ANIM_STAND: // If we are cowering....goto cower state - if ( pSoldier->uiStatusFlags & SOLDIER_COWERING ) + if ( this->flags.uiStatusFlags & SOLDIER_COWERING ) { - EVENT_InitNewSoldierAnim( pSoldier, START_COWER, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( START_COWER, 0 , FALSE ); } else { - EVENT_InitNewSoldierAnim( pSoldier, STANDING, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( STANDING, 0 , FALSE ); } break; case ANIM_CROUCH: // If we are cowering....goto cower state - if ( pSoldier->uiStatusFlags & SOLDIER_COWERING ) + if ( this->flags.uiStatusFlags & SOLDIER_COWERING ) { - EVENT_InitNewSoldierAnim( pSoldier, COWERING, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( COWERING, 0 , FALSE ); } else { - EVENT_InitNewSoldierAnim( pSoldier, CROUCHING, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( CROUCHING, 0 , FALSE ); } break; case ANIM_PRONE: - EVENT_InitNewSoldierAnim( pSoldier, PRONE, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( PRONE, 0 , FALSE ); break; } @@ -5278,93 +6076,97 @@ void SoldierGotoStationaryStance( SOLDIERTYPE *pSoldier ) } -void ChangeSoldierStance( SOLDIERTYPE *pSoldier, UINT8 ubDesiredStance ) +void SOLDIERTYPE::ChangeSoldierStance( UINT8 ubDesiredStance ) { UINT16 usNewState; // Check if they are the same! - if ( ubDesiredStance == gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) + if ( ubDesiredStance == gAnimControl[ this->usAnimState ].ubEndHeight ) { // Free up from stance change - FreeUpNPCFromStanceChange( pSoldier ); + FreeUpNPCFromStanceChange( this ); return; } - if (!IsValidStance( pSoldier, ubDesiredStance)) + if (!IsValidStance( this, ubDesiredStance)) { - AssertMsg( 0, "Attempted to set soldier to an invalid stance."); + //ADB this was recently put in as an assert, but that would make the game crash in certain circumstances, including the example below + //you can comment out the breakpoint if it annoys you, but the return should remain for the indefinate future + //if it's removed you'll have stuff happen like when out of breath and lying collapsed on the ground + //and trying to climb onto a roof you'll crouch, stand, reach for the roof, and then collapse again, which looks really weird. + DebugBreakpoint(); return; } // Set UI Busy - SetUIBusy( pSoldier->ubID ); + SetUIBusy( this->ubID ); // ATE: If we are an NPC, cower.... - if ( pSoldier->ubBodyType >= FATCIV && pSoldier->ubBodyType <= KIDCIV ) + if ( this->ubBodyType >= FATCIV && this->ubBodyType <= KIDCIV ) { if ( ubDesiredStance == ANIM_STAND ) { - SetSoldierCowerState( pSoldier, FALSE ); + this->SetSoldierCowerState( FALSE ); } else { - SetSoldierCowerState( pSoldier, TRUE ); + this->SetSoldierCowerState( TRUE ); } } else { - usNewState = GetNewSoldierStateFromNewStance( pSoldier, ubDesiredStance ); + usNewState = this->GetNewSoldierStateFromNewStance( ubDesiredStance ); // Set desired stance - pSoldier->ubDesiredHeight = ubDesiredStance; + this->ubDesiredHeight = ubDesiredStance; // Now change to appropriate animation - EVENT_InitNewSoldierAnim( pSoldier, usNewState, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( usNewState, 0 , FALSE ); + } } -} -void EVENT_InternalSetSoldierDestination( SOLDIERTYPE *pSoldier, UINT8 ubNewDirection, BOOLEAN fFromMove, UINT16 usAnimState ) +void SOLDIERTYPE::EVENT_InternalSetSoldierDestination( UINT16 usNewDirection, BOOLEAN fFromMove, UINT16 usAnimState ) { INT16 sNewGridNo; INT16 sXPos, sYPos; // Get dest gridno, convert to center coords - sNewGridNo = NewGridNo( pSoldier->sGridNo, DirectionInc( ubNewDirection ) ); + sNewGridNo = NewGridNo( (INT16)this->sGridNo, DirectionInc( (UINT8)usNewDirection ) ); ConvertMapPosToWorldTileCenter( sNewGridNo, &sXPos, &sYPos ); // Save new dest gridno, x, y - pSoldier->sDestination = sNewGridNo; - pSoldier->sDestXPos = sXPos; - pSoldier->sDestYPos = sYPos; + this->pathing.sDestination = sNewGridNo; + this->pathing.sDestXPos = sXPos; + this->pathing.sDestYPos = sYPos; - pSoldier->bMovementDirection = (INT8)ubNewDirection; + this->bMovementDirection = (INT8)usNewDirection; // OK, ATE: If we are side_stepping, calculate a NEW desired direction.... - if ( pSoldier->bReverse && usAnimState == SIDE_STEP ) + if ( this->bReverse && usAnimState == SIDE_STEP ) { UINT8 ubPerpDirection; - // Get a new desired direction, - ubPerpDirection = gPurpendicularDirection[ pSoldier->ubDirection ][ ubNewDirection ]; + // Get a new desired direction, + ubPerpDirection = gPurpendicularDirection[ this->ubDirection ][ usNewDirection ]; // CHange actual and desired direction.... - EVENT_SetSoldierDirection( pSoldier, ubPerpDirection ); - pSoldier->bDesiredDirection = pSoldier->ubDirection; + this->EVENT_SetSoldierDirection( ubPerpDirection ); + this->pathing.bDesiredDirection = this->ubDirection; } else { if ( !( gAnimControl[ usAnimState ].uiFlags & ANIM_SPECIALMOVE ) ) { - EVENT_InternalSetSoldierDesiredDirection( pSoldier, ubNewDirection, fFromMove, usAnimState ); + EVENT_InternalSetSoldierDesiredDirection( this, (UINT8)usNewDirection, fFromMove, usAnimState ); } } } -void EVENT_SetSoldierDestination( SOLDIERTYPE *pSoldier, UINT8 ubNewDirection ) +void SOLDIERTYPE::EVENT_SetSoldierDestination( UINT8 ubNewDirection ) { - EVENT_InternalSetSoldierDestination( pSoldier, ubNewDirection, FALSE, pSoldier->usAnimState ); + this->EVENT_InternalSetSoldierDestination( ubNewDirection, FALSE, this->usAnimState ); } @@ -5420,7 +6222,7 @@ INT8 MultiTiledTurnDirection( SOLDIERTYPE * pSoldier, INT8 bStartDirection, INT8 } // check to see if we can add creature in that direction - fOk = OkayToAddStructureToWorld( pSoldier->sGridNo, pSoldier->bLevel, &(pStructureFileRef->pDBStructureRef[ gOneCDirection[ bCurrentDirection ] ]), usStructureID ); + fOk = OkayToAddStructureToWorld( pSoldier->sGridNo, pSoldier->pathing.bLevel, &(pStructureFileRef->pDBStructureRef[ gOneCDirection[ bCurrentDirection ] ]), usStructureID ); if (!fOk) { break; @@ -5457,24 +6259,24 @@ void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT8 ubNe } - pSoldier->bDesiredDirection = (INT8)ubNewDirection; + pSoldier->pathing.bDesiredDirection = (INT8)ubNewDirection; // If we are prone, goto crouched first! // ONly if we are stationary, and only if directions are differnet! // ATE: If we are fNoAPsToFinnishMove, stop what we were doing and // reset flag..... - if ( pSoldier->fNoAPToFinishMove && ( gAnimControl[ usAnimState ].uiFlags & ANIM_MOVING ) ) + if ( pSoldier->flags.fNoAPToFinishMove && ( gAnimControl[ usAnimState ].uiFlags & ANIM_MOVING ) ) { // ATE; Commented this out: NEVER, EVER, start a new anim from this function, as an eternal loop will result.... - //SoldierGotoStationaryStance( pSoldier ); + //pSoldier->SoldierGotoStationaryStance( ); // Reset flag! - AdjustNoAPToFinishMove( pSoldier, FALSE ); + pSoldier->AdjustNoAPToFinishMove( FALSE ); } - if ( pSoldier->bDesiredDirection != pSoldier->ubDirection ) + if ( pSoldier->pathing.bDesiredDirection != pSoldier->ubDirection ) { - if ( gAnimControl[ usAnimState ].uiFlags & ( ANIM_BREATH | ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_FIREREADY ) && !fInitalMove && !pSoldier->fDontChargeTurningAPs ) + if ( gAnimControl[ usAnimState ].uiFlags & ( ANIM_BREATH | ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_FIREREADY ) && !fInitalMove && !pSoldier->flags.fDontChargeTurningAPs ) { // Deduct points for initial turn! switch( gAnimControl[ usAnimState ].ubEndHeight ) @@ -5495,29 +6297,29 @@ void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT8 ubNe } - pSoldier->fDontChargeTurningAPs = FALSE; + pSoldier->flags.fDontChargeTurningAPs = FALSE; if ( fInitalMove ) { if ( gAnimControl[ usAnimState ].ubHeight == ANIM_PRONE ) { - if ( pSoldier->bTurningFromPronePosition != TURNING_FROM_PRONE_ENDING_UP_FROM_MOVE ) + if ( pSoldier->flags.bTurningFromPronePosition != TURNING_FROM_PRONE_ENDING_UP_FROM_MOVE ) { - pSoldier->bTurningFromPronePosition = TURNING_FROM_PRONE_START_UP_FROM_MOVE; + pSoldier->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_START_UP_FROM_MOVE; } } } - if ( gAnimControl[ usAnimState ].uiFlags & ANIM_STATIONARY || pSoldier->fNoAPToFinishMove || fInitalMove ) + if ( gAnimControl[ usAnimState ].uiFlags & ANIM_STATIONARY || pSoldier->flags.fNoAPToFinishMove || fInitalMove ) { if ( gAnimControl[ usAnimState ].ubHeight == ANIM_PRONE ) { // Set this beasty of a flag to allow us to go back down to prone if we choose! // ATE: Alrighty, set flag to go back down only if we are not moving anywhere - //if ( pSoldier->sDestination == pSoldier->sGridNo ) + //if ( pSoldier->pathing.sDestination == pSoldier->sGridNo ) if ( !fInitalMove ) { - pSoldier->bTurningFromPronePosition = TURNING_FROM_PRONE_ON; + pSoldier->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_ON; // Set a pending animation to change stance first... SendChangeSoldierStanceEvent( pSoldier, ANIM_CROUCH ); @@ -5528,119 +6330,119 @@ void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT8 ubNe } // Set desired direction for the extended directions... - pSoldier->ubHiResDesiredDirection = ubExtDirection[ pSoldier->bDesiredDirection ]; + pSoldier->ubHiResDesiredDirection = ubExtDirection[ pSoldier->pathing.bDesiredDirection ]; - if ( pSoldier->bDesiredDirection != pSoldier->ubDirection ) + if ( pSoldier->pathing.bDesiredDirection != pSoldier->ubDirection ) { - if ( pSoldier->uiStatusFlags & ( SOLDIER_VEHICLE ) || CREATURE_OR_BLOODCAT( pSoldier ) ) + if ( pSoldier->flags.uiStatusFlags & ( SOLDIER_VEHICLE ) || CREATURE_OR_BLOODCAT( pSoldier ) ) { - pSoldier->uiStatusFlags |= SOLDIER_PAUSEANIMOVE; + pSoldier->flags.uiStatusFlags |= SOLDIER_PAUSEANIMOVE; } } - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { pSoldier->bTurningIncrement = (INT8) ExtQuickestDirection( pSoldier->ubHiResDirection, pSoldier->ubHiResDesiredDirection ); } else { - if ( pSoldier->uiStatusFlags & SOLDIER_MULTITILE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE ) { - pSoldier->bTurningIncrement = (INT8) MultiTiledTurnDirection( pSoldier, pSoldier->ubDirection, pSoldier->bDesiredDirection ); + pSoldier->bTurningIncrement = (INT8) MultiTiledTurnDirection( pSoldier, pSoldier->ubDirection, pSoldier->pathing.bDesiredDirection ); } else { - pSoldier->bTurningIncrement = (INT8) QuickestDirection( pSoldier->ubDirection, pSoldier->bDesiredDirection ); + pSoldier->bTurningIncrement = (INT8) QuickestDirection( pSoldier->ubDirection, pSoldier->pathing.bDesiredDirection ); } } } -void EVENT_SetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT8 ubNewDirection ) +void SOLDIERTYPE::EVENT_SetSoldierDesiredDirection( UINT16 usNewDirection ) { - EVENT_InternalSetSoldierDesiredDirection( pSoldier, ubNewDirection, FALSE, pSoldier->usAnimState ); + EVENT_InternalSetSoldierDesiredDirection( this, (UINT8)usNewDirection, FALSE, this->usAnimState ); } -void EVENT_SetSoldierDirection( SOLDIERTYPE *pSoldier, UINT16 usNewDirection ) +void SOLDIERTYPE::EVENT_SetSoldierDirection( UINT16 usNewDirection ) { // Remove old location data - HandleAnimationProfile( pSoldier, pSoldier->usAnimState, TRUE ); + this->HandleAnimationProfile( this->usAnimState, TRUE ); - pSoldier->ubDirection = (INT8)usNewDirection; + this->ubDirection = (INT8)usNewDirection; // Updated extended direction..... - pSoldier->ubHiResDirection = ubExtDirection[ pSoldier->ubDirection ]; + this->ubHiResDirection = ubExtDirection[ this->ubDirection ]; // Add new stuff - HandleAnimationProfile( pSoldier, pSoldier->usAnimState, FALSE ); + this->HandleAnimationProfile( this->usAnimState, FALSE ); // If we are turning, we have chaanged our aim! - if ( !pSoldier->fDontUnsetLastTargetFromTurn ) + if ( !this->flags.fDontUnsetLastTargetFromTurn ) { - pSoldier->sLastTarget = NOWHERE; + this->sLastTarget = NOWHERE; } - AdjustForFastTurnAnimation( pSoldier ); + AdjustForFastTurnAnimation( this ); // Update structure info! - // if ( pSoldier->uiStatusFlags & SOLDIER_MULTITILE ) + // if ( this->flags.uiStatusFlags & SOLDIER_MULTITILE ) { - UpdateMercStructureInfo( pSoldier ); + UpdateMercStructureInfo( this ); } // Handle Profile data for hit locations - HandleAnimationProfile( pSoldier, pSoldier->usAnimState, TRUE ); + this->HandleAnimationProfile( this->usAnimState, TRUE ); - HandleCrowShadowNewDirection( pSoldier ); + HandleCrowShadowNewDirection( this ); // Change values! - SetSoldierLocatorOffsets( pSoldier ); + SetSoldierLocatorOffsets( this ); } -void EVENT_BeginMercTurn( SOLDIERTYPE *pSoldier, BOOLEAN fFromRealTime, INT32 iRealTimeCounter ) +void SOLDIERTYPE::EVENT_BeginMercTurn( BOOLEAN fFromRealTime, INT32 iRealTimeCounter ) { // NB realtimecounter is not used, always passed in as 0 now! INT32 iBlood; - if (pSoldier->bUnderFire) + if (this->aiData.bUnderFire) { // UnderFire now starts at 2 for "under fire this turn", // down to 1 for "under fire last turn", to 0. - pSoldier->bUnderFire--; + this->aiData.bUnderFire--; } // ATE: Add decay effect sfor drugs... if ( fFromRealTime ) //&& iRealTimeCounter % 300 ) { - HandleEndTurnDrugAdjustments( pSoldier ); + HandleEndTurnDrugAdjustments( this ); } else { - HandleEndTurnDrugAdjustments( pSoldier ); + HandleEndTurnDrugAdjustments( this ); } // ATE: Don't bleed if in AUTO BANDAGE! if ( !gTacticalStatus.fAutoBandageMode ) { // Blood is not for the weak of heart, or mechanical - if ( !( pSoldier->uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_ROBOT ) ) ) + if ( !( this->flags.uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_ROBOT ) ) ) { - if ( pSoldier->bBleeding || pSoldier->bLife < OKLIFE ) // is he bleeding or dying? + if ( this->bBleeding || this->stats.bLife < OKLIFE ) // is he bleeding or dying? { - iBlood = CheckBleeding( pSoldier ); // check if he might lose another life point + iBlood = CheckBleeding( this ); // check if he might lose another life point // ATE: Only if in sector! - if ( pSoldier->bInSector ) + if ( this->bInSector ) { if ( iBlood != NOBLOOD ) { - DropBlood( pSoldier, (INT8)iBlood, pSoldier->bVisible ); + DropBlood( this, (INT8)iBlood, this->bVisible ); } } } @@ -5648,63 +6450,63 @@ void EVENT_BeginMercTurn( SOLDIERTYPE *pSoldier, BOOLEAN fFromRealTime, INT32 iR } // survived bleeding, but is he out of breath? - if ( pSoldier->bLife && !pSoldier->bBreath && MercInWater( pSoldier ) ) + if ( this->stats.bLife && !this->bBreath && this->MercInWater( ) ) { // Drowning... } // if he is still alive (didn't bleed to death) - if ( pSoldier->bLife ) + if ( this->stats.bLife ) { // reduce the effects of any residual shock from past injuries by half - pSoldier->bShock /= 2; + this->aiData.bShock /= 2; // if this person has heard a noise that hasn't been investigated - if (pSoldier->sNoiseGridno != NOWHERE) + if (this->aiData.sNoiseGridno != NOWHERE) { - if (pSoldier->ubNoiseVolume) // and the noise volume is still positive + if (this->aiData.ubNoiseVolume) // and the noise volume is still positive { - pSoldier->ubNoiseVolume--; // the volume of the noise "decays" by 1 point + this->aiData.ubNoiseVolume--; // the volume of the noise "decays" by 1 point - if (!pSoldier->ubNoiseVolume) // if the volume has reached zero + if (!this->aiData.ubNoiseVolume) // if the volume has reached zero { - pSoldier->sNoiseGridno = NOWHERE; // forget about the noise! + this->aiData.sNoiseGridno = NOWHERE; // forget about the noise! } } } // save unused action points up to a maximum /* - if ((savedPts = pSoldier->bActionPts) > MAX_AP_CARRIED) + if ((savedPts = this->aiData.bActionPts) > MAX_AP_CARRIED) savedPts = MAX_AP_CARRIED; */ - if ( pSoldier->uiStatusFlags & SOLDIER_GASSED ) + if ( this->flags.uiStatusFlags & SOLDIER_GASSED ) { // then must get a gas mask or leave the gassed area to get over it - // if ( ( pSoldier->inv[ HEAD1POS ].usItem == GASMASK || pSoldier->inv[ HEAD2POS ].usItem == GASMASK ) || !( GetSmokeEffectOnTile( pSoldier->sGridNo, pSoldier->bLevel ) ) ) - if ( FindGasMask( pSoldier ) != NO_SLOT || !( GetSmokeEffectOnTile( pSoldier->sGridNo, pSoldier->bLevel ) ) ) + // if ( ( this->inv[ HEAD1POS ].usItem == GASMASK || this->inv[ HEAD2POS ].usItem == GASMASK ) || !( GetSmokeEffectOnTile( this->sGridNo, this->pathing.bLevel ) ) ) + if ( FindGasMask( this ) != NO_SLOT || !( GetSmokeEffectOnTile( this->sGridNo, this->pathing.bLevel ) ) ) { // Turn off gassed flag.... - pSoldier->uiStatusFlags &= (~SOLDIER_GASSED ); + this->flags.uiStatusFlags &= (~SOLDIER_GASSED ); } } - if ( pSoldier->bBlindedCounter > 0 ) + if ( this->bBlindedCounter > 0 ) { - pSoldier->bBlindedCounter--; - if (pSoldier->bBlindedCounter == 0) + this->bBlindedCounter--; + if (this->bBlindedCounter == 0) { // we can SEE!!!!! - HandleSight( pSoldier, SIGHT_LOOK ); + HandleSight( this, SIGHT_LOOK ); // Dirty panel fInterfacePanelDirty = DIRTYLEVEL2; } } - if ( pSoldier->bDeafenedCounter > 0 ) + if ( this->bDeafenedCounter > 0 ) { - pSoldier->bDeafenedCounter--; + this->bDeafenedCounter--; } // ATE: To get around a problem... @@ -5712,63 +6514,63 @@ void EVENT_BeginMercTurn( SOLDIERTYPE *pSoldier, BOOLEAN fFromRealTime, INT32 iR // Kill them..... - pSoldier->sWeightCarriedAtTurnStart = (INT16) CalculateCarriedWeight( pSoldier ); + this->sWeightCarriedAtTurnStart = (INT16) CalculateCarriedWeight( this ); - UnusedAPsToBreath( pSoldier ); + UnusedAPsToBreath( this ); // Set flag back to normal, after reaching a certain statge - if ( pSoldier->bBreath > 80 ) + if ( this->bBreath > 80 ) { - pSoldier->usQuoteSaidFlags &= ( ~SOLDIER_QUOTE_SAID_LOW_BREATH ); + this->usQuoteSaidFlags &= ( ~SOLDIER_QUOTE_SAID_LOW_BREATH ); } - if ( pSoldier->bBreath > 50 ) + if ( this->bBreath > 50 ) { - pSoldier->usQuoteSaidFlags &= ( ~SOLDIER_QUOTE_SAID_DROWNING ); + this->usQuoteSaidFlags &= ( ~SOLDIER_QUOTE_SAID_DROWNING ); } - if ( pSoldier->ubTurnsUntilCanSayHeardNoise > 0) + if ( this->ubTurnsUntilCanSayHeardNoise > 0) { - pSoldier->ubTurnsUntilCanSayHeardNoise--; + this->ubTurnsUntilCanSayHeardNoise--; } - if ( pSoldier->bInSector ) + if ( this->bInSector ) { - CheckForBreathCollapse( pSoldier ); + this->CheckForBreathCollapse( ); } - CalcNewActionPoints( pSoldier ); + this->CalcNewActionPoints( ); - pSoldier->bTilesMoved = 0; + this->bTilesMoved = 0; - if ( pSoldier->bInSector ) + if ( this->bInSector ) { - BeginSoldierGetup( pSoldier ); + this->BeginSoldierGetup( ); // CJC Nov 30: handle RT opplist decaying in another function which operates less often if ( gTacticalStatus.uiFlags & INCOMBAT ) { - VerifyAndDecayOpplist( pSoldier ); + VerifyAndDecayOpplist( this ); // turn off xray - if ( pSoldier->uiXRayActivatedTime ) + if ( this->uiXRayActivatedTime ) { - TurnOffXRayEffects( pSoldier ); + TurnOffXRayEffects( this ); } } - if ( (pSoldier->bTeam == gbPlayerNum) && (pSoldier->ubProfile != NO_PROFILE) ) + if ( (this->bTeam == gbPlayerNum) && (this->ubProfile != NO_PROFILE) ) { - switch( gMercProfiles[ pSoldier->ubProfile ].bPersonalityTrait ) + switch( gMercProfiles[ this->ubProfile ].bPersonalityTrait ) { case FEAR_OF_INSECTS: - if ( MercSeesCreature( pSoldier ) ) + if ( MercSeesCreature( this ) ) { - HandleMoraleEvent( pSoldier, MORALE_INSECT_PHOBIC_SEES_CREATURE, pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ); - if ( !(pSoldier->usQuoteSaidFlags & SOLDIER_QUOTE_SAID_PERSONALITY) ) + HandleMoraleEvent( this, MORALE_INSECT_PHOBIC_SEES_CREATURE, this->sSectorX, this->sSectorY, this->bSectorZ ); + if ( !(this->usQuoteSaidFlags & SOLDIER_QUOTE_SAID_PERSONALITY) ) { - TacticalCharacterDialogue( pSoldier, QUOTE_PERSONALITY_TRAIT ); - pSoldier->usQuoteSaidFlags |= SOLDIER_QUOTE_SAID_PERSONALITY; + TacticalCharacterDialogue( this, QUOTE_PERSONALITY_TRAIT ); + this->usQuoteSaidFlags |= SOLDIER_QUOTE_SAID_PERSONALITY; } } break; @@ -5776,35 +6578,35 @@ void EVENT_BeginMercTurn( SOLDIERTYPE *pSoldier, BOOLEAN fFromRealTime, INT32 iR if ( gbWorldSectorZ > 0 && Random( 6 - gbWorldSectorZ ) == 0 ) { // underground! - HandleMoraleEvent( pSoldier, MORALE_CLAUSTROPHOBE_UNDERGROUND, pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ); - if ( !(pSoldier->usQuoteSaidFlags & SOLDIER_QUOTE_SAID_PERSONALITY) ) + HandleMoraleEvent( this, MORALE_CLAUSTROPHOBE_UNDERGROUND, this->sSectorX, this->sSectorY, this->bSectorZ ); + if ( !(this->usQuoteSaidFlags & SOLDIER_QUOTE_SAID_PERSONALITY) ) { - TacticalCharacterDialogue( pSoldier, QUOTE_PERSONALITY_TRAIT ); - pSoldier->usQuoteSaidFlags |= SOLDIER_QUOTE_SAID_PERSONALITY; + TacticalCharacterDialogue( this, QUOTE_PERSONALITY_TRAIT ); + this->usQuoteSaidFlags |= SOLDIER_QUOTE_SAID_PERSONALITY; } } break; case NERVOUS: - if ( DistanceToClosestFriend( pSoldier ) > NERVOUS_RADIUS ) + if ( DistanceToClosestFriend( this ) > NERVOUS_RADIUS ) { - // augh!! - if ( pSoldier->bMorale < 50 ) + // augh!! + if ( this->aiData.bMorale < 50 ) { - HandleMoraleEvent( pSoldier, MORALE_NERVOUS_ALONE, pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ); - if ( !(pSoldier->usQuoteSaidFlags & SOLDIER_QUOTE_SAID_PERSONALITY) ) + HandleMoraleEvent( this, MORALE_NERVOUS_ALONE, this->sSectorX, this->sSectorY, this->bSectorZ ); + if ( !(this->usQuoteSaidFlags & SOLDIER_QUOTE_SAID_PERSONALITY) ) { - TacticalCharacterDialogue( pSoldier, QUOTE_PERSONALITY_TRAIT ); - pSoldier->usQuoteSaidFlags |= SOLDIER_QUOTE_SAID_PERSONALITY; + TacticalCharacterDialogue( this, QUOTE_PERSONALITY_TRAIT ); + this->usQuoteSaidFlags |= SOLDIER_QUOTE_SAID_PERSONALITY; } } } else { - if ( pSoldier->bMorale > 45 ) + if ( this->aiData.bMorale > 45 ) { // turn flag off, so that we say it every two turns - pSoldier->usQuoteSaidFlags &= ~SOLDIER_QUOTE_SAID_PERSONALITY; + this->usQuoteSaidFlags &= ~SOLDIER_QUOTE_SAID_PERSONALITY; } } break; @@ -5813,20 +6615,20 @@ void EVENT_BeginMercTurn( SOLDIERTYPE *pSoldier, BOOLEAN fFromRealTime, INT32 iR } // Reset quote flags for under heavy fire and close call! - pSoldier->usQuoteSaidFlags &= ( ~SOLDIER_QUOTE_SAID_BEING_PUMMELED ); - pSoldier->usQuoteSaidExtFlags &= ( ~SOLDIER_QUOTE_SAID_EXT_CLOSE_CALL ); - pSoldier->bNumHitsThisTurn = 0; - pSoldier->ubSuppressionPoints = 0; - pSoldier->fCloseCall = FALSE; + this->usQuoteSaidFlags &= ( ~SOLDIER_QUOTE_SAID_BEING_PUMMELED ); + this->usQuoteSaidExtFlags &= ( ~SOLDIER_QUOTE_SAID_EXT_CLOSE_CALL ); + this->bNumHitsThisTurn = 0; + this->ubSuppressionPoints = 0; + this->flags.fCloseCall = FALSE; - pSoldier->ubMovementNoiseHeard = 0; + this->ubMovementNoiseHeard = 0; // If soldier has new APs, reset flags! - if ( pSoldier->bActionPoints > 0 ) + if ( this->bActionPoints > 0 ) { - pSoldier->fUIFirstTimeNOAP = FALSE; - pSoldier->bMoved = FALSE; - pSoldier->bPassedLastInterrupt = FALSE; + this->flags.fUIFirstTimeNOAP = FALSE; + this->aiData.bMoved = FALSE; + this->aiData.bPassedLastInterrupt = FALSE; } } } @@ -5835,19 +6637,19 @@ void EVENT_BeginMercTurn( SOLDIERTYPE *pSoldier, BOOLEAN fFromRealTime, INT32 iR UINT8 gDirectionFrom8to2[ ] = { 0, 0, 1, 1, 0, 1, 1, 0 }; -BOOLEAN ConvertAniCodeToAniFrame( SOLDIERTYPE *pSoldier, UINT16 usAniFrame ) +BOOLEAN SOLDIERTYPE::ConvertAniCodeToAniFrame( UINT16 usAniFrame ) { UINT16 usAnimSurface; UINT8 ubTempDir; // Given ani code, adjust for facing direction // get anim surface and determine # of frames - usAnimSurface = GetSoldierAnimationSurface( pSoldier, pSoldier->usAnimState ); + usAnimSurface = GetSoldierAnimationSurface( this, this->usAnimState ); CHECKF( usAnimSurface != INVALID_ANIMATION_SURFACE ); // COnvert world direction into sprite direction - ubTempDir = gOneCDirection[ pSoldier->ubDirection ]; + ubTempDir = gOneCDirection[ this->ubDirection ]; //If we are only one frame, ignore what the script is telling us! if ( gAnimSurfaceDatabase[ usAnimSurface ].ubFlags & ANIM_DATA_FLAG_NOFRAMES ) @@ -5857,7 +6659,7 @@ BOOLEAN ConvertAniCodeToAniFrame( SOLDIERTYPE *pSoldier, UINT16 usAniFrame ) if ( gAnimSurfaceDatabase[ usAnimSurface ].uiNumDirections == 32 ) { - ubTempDir = gExtOneCDirection[ pSoldier->ubHiResDirection ]; + ubTempDir = gExtOneCDirection[ this->ubHiResDirection ]; } // Check # of directions /surface, adjust if ness. else if ( gAnimSurfaceDatabase[ usAnimSurface ].uiNumDirections == 4 ) @@ -5872,54 +6674,54 @@ BOOLEAN ConvertAniCodeToAniFrame( SOLDIERTYPE *pSoldier, UINT16 usAniFrame ) // Check # of directions /surface, adjust if ness. else if ( gAnimSurfaceDatabase[ usAnimSurface ].uiNumDirections == 3 ) { - if ( pSoldier->ubDirection == NORTHWEST ) + if ( this->ubDirection == NORTHWEST ) { ubTempDir = 1; } - if ( pSoldier->ubDirection == WEST ) + if ( this->ubDirection == WEST ) { ubTempDir = 0; } - if ( pSoldier->ubDirection == EAST ) + if ( this->ubDirection == EAST ) { ubTempDir = 2; } } else if ( gAnimSurfaceDatabase[ usAnimSurface ].uiNumDirections == 2 ) { - ubTempDir = gDirectionFrom8to2[ pSoldier->ubDirection ]; + ubTempDir = gDirectionFrom8to2[ this->ubDirection ]; } - pSoldier->usAniFrame = usAniFrame + (UINT16) ( ( gAnimSurfaceDatabase[ usAnimSurface ].uiNumFramesPerDir * ubTempDir ) ); + this->usAniFrame = usAniFrame + (UINT16) ( ( gAnimSurfaceDatabase[ usAnimSurface ].uiNumFramesPerDir * ubTempDir ) ); if ( gAnimSurfaceDatabase[ usAnimSurface ].hVideoObject == NULL ) { - pSoldier->usAniFrame = 0; + this->usAniFrame = 0; return( TRUE ); } - if ( pSoldier->usAniFrame >= gAnimSurfaceDatabase[ usAnimSurface ].hVideoObject->usNumberOfObjects ) + if ( this->usAniFrame >= gAnimSurfaceDatabase[ usAnimSurface ].hVideoObject->usNumberOfObjects ) { // Debug msg here.... - // ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Soldier Animation: Wrong Number of frames per number of objects: %d vs %d, %S", gAnimSurfaceDatabase[ usAnimSurface ].uiNumFramesPerDir, gAnimSurfaceDatabase[ usAnimSurface ].hVideoObject->usNumberOfObjects, gAnimControl[ pSoldier->usAnimState ].zAnimStr ); + // ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Soldier Animation: Wrong Number of frames per number of objects: %d vs %d, %S", gAnimSurfaceDatabase[ usAnimSurface ].uiNumFramesPerDir, gAnimSurfaceDatabase[ usAnimSurface ].hVideoObject->usNumberOfObjects, gAnimControl[ this->usAnimState ].zAnimStr ); - pSoldier->usAniFrame = 0; + this->usAniFrame = 0; } return( TRUE ); } -void TurnSoldier( SOLDIERTYPE *pSoldier) +void SOLDIERTYPE::TurnSoldier( void ) { INT16 sDirection; BOOLEAN fDoDirectionChange = TRUE; INT32 cnt; // If we are a vehicle... DON'T TURN! - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( this->flags.uiStatusFlags & SOLDIER_VEHICLE ) { - if ( pSoldier->ubBodyType != TANK_NW && pSoldier->ubBodyType != TANK_NE ) + if ( this->ubBodyType != TANK_NW && this->ubBodyType != TANK_NE ) { return; } @@ -5927,195 +6729,195 @@ void TurnSoldier( SOLDIERTYPE *pSoldier) else // Lesh: patch for "Bug: Enemy turns around in turn based mode!" { // in case of errors in turning tasks - if ( pSoldier->bDesiredDirection > 7 || pSoldier->bDesiredDirection < 0) + if ( this->pathing.bDesiredDirection > 7 || this->pathing.bDesiredDirection < 0) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("TurnSoldier() Warinig: Invalid desired direction for non-vehicle unit") ); - pSoldier->bDesiredDirection = pSoldier->ubDirection; + this->pathing.bDesiredDirection = this->ubDirection; } } // Lesh: patch ended // We handle sight now.... - if ( pSoldier->uiStatusFlags & SOLDIER_LOOK_NEXT_TURNSOLDIER ) + if ( this->flags.uiStatusFlags & SOLDIER_LOOK_NEXT_TURNSOLDIER ) { - if ( ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_STATIONARY && pSoldier->usAnimState != CLIMBUPROOF && pSoldier->usAnimState != CLIMBDOWNROOF ) ) + if ( ( gAnimControl[ this->usAnimState ].uiFlags & ANIM_STATIONARY && this->usAnimState != CLIMBUPROOF && this->usAnimState != CLIMBDOWNROOF ) ) { // HANDLE SIGHT! - HandleSight( pSoldier,SIGHT_LOOK | SIGHT_RADIO ); + HandleSight( this,SIGHT_LOOK | SIGHT_RADIO ); } // Turn off! - pSoldier->uiStatusFlags &= (~SOLDIER_LOOK_NEXT_TURNSOLDIER ); + this->flags.uiStatusFlags &= (~SOLDIER_LOOK_NEXT_TURNSOLDIER ); - HandleSystemNewAISituation( pSoldier, FALSE ); + HandleSystemNewAISituation( this, FALSE ); } - if ( pSoldier->fTurningToShoot ) + if ( this->flags.fTurningToShoot ) { - if ( pSoldier->ubDirection == pSoldier->bDesiredDirection ) + if ( this->ubDirection == this->pathing.bDesiredDirection ) { - if ( ( (gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIREREADY ) && - pSoldier->bTurningFromPronePosition == TURNING_FROM_PRONE_OFF) || - pSoldier->ubBodyType == ROBOTNOWEAPON || - pSoldier->ubBodyType == TANK_NW || - pSoldier->ubBodyType == TANK_NE ) + if ( ( (gAnimControl[ this->usAnimState ].uiFlags & ANIM_FIREREADY ) && + this->flags.bTurningFromPronePosition == TURNING_FROM_PRONE_OFF) || + this->ubBodyType == ROBOTNOWEAPON || + this->ubBodyType == TANK_NW || + this->ubBodyType == TANK_NE ) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("TurnSoldier: EVENT_InitNewSoldierAnim") ); - EVENT_InitNewSoldierAnim( pSoldier, SelectFireAnimation( pSoldier, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ), 0, FALSE ); - pSoldier->fTurningToShoot = FALSE; + this->EVENT_InitNewSoldierAnim( SelectFireAnimation( this, gAnimControl[ this->usAnimState ].ubEndHeight ), 0, FALSE ); + this->flags.fTurningToShoot = FALSE; // Save last target gridno! - //pSoldier->sLastTarget = pSoldier->sTargetGridNo; + //this->sLastTarget = this->sTargetGridNo; } // Else check if we are trying to shoot and once was prone, but am now crouched because we needed to turn... - else if ( pSoldier->bTurningFromPronePosition != TURNING_FROM_PRONE_OFF ) + else if ( this->flags.bTurningFromPronePosition ) { - if ( IsValidStance( pSoldier, ANIM_PRONE ) ) + if ( IsValidStance( this, ANIM_PRONE ) ) { - SendChangeSoldierStanceEvent( pSoldier, ANIM_PRONE ); - pSoldier->usPendingAnimation = SelectFireAnimation( pSoldier, ANIM_PRONE ); + SendChangeSoldierStanceEvent( this, ANIM_PRONE ); + this->usPendingAnimation = SelectFireAnimation( this, ANIM_PRONE ); } else { - EVENT_InitNewSoldierAnim( pSoldier, SelectFireAnimation( pSoldier, ANIM_CROUCH ), 0, FALSE ); + this->EVENT_InitNewSoldierAnim( SelectFireAnimation( this, ANIM_CROUCH ), 0, FALSE ); } - pSoldier->fTurningToShoot = FALSE; - pSoldier->bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; + this->flags.fTurningToShoot = FALSE; + this->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; } } } - if ( pSoldier->fTurningToFall ) + if ( this->flags.fTurningToFall ) { - if ( pSoldier->ubDirection == pSoldier->bDesiredDirection ) + if ( this->ubDirection == this->pathing.bDesiredDirection ) { - SelectFallAnimation( pSoldier ); - pSoldier->fTurningToFall = FALSE; + SelectFallAnimation( this ); + this->flags.fTurningToFall = FALSE; } } - if ( pSoldier->fTurningUntilDone && ( pSoldier->ubPendingStanceChange != NO_PENDING_STANCE ) ) + if ( this->flags.fTurningUntilDone && ( this->ubPendingStanceChange != NO_PENDING_STANCE ) ) { - if ( pSoldier->ubDirection == pSoldier->bDesiredDirection ) + if ( this->ubDirection == this->pathing.bDesiredDirection ) { - SendChangeSoldierStanceEvent( pSoldier, pSoldier->ubPendingStanceChange ); - pSoldier->ubPendingStanceChange = NO_PENDING_STANCE; - pSoldier->fTurningUntilDone = FALSE; + SendChangeSoldierStanceEvent( this, this->ubPendingStanceChange ); + this->ubPendingStanceChange = NO_PENDING_STANCE; + this->flags.fTurningUntilDone = FALSE; } } - if ( pSoldier->fTurningUntilDone && ( pSoldier->usPendingAnimation != NO_PENDING_ANIMATION ) ) + if ( this->flags.fTurningUntilDone && ( this->usPendingAnimation != NO_PENDING_ANIMATION ) ) { - if ( pSoldier->ubDirection == pSoldier->bDesiredDirection ) + if ( this->ubDirection == this->pathing.bDesiredDirection ) { UINT16 usPendingAnimation; - usPendingAnimation = pSoldier->usPendingAnimation; - pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; + usPendingAnimation = this->usPendingAnimation; + this->usPendingAnimation = NO_PENDING_ANIMATION; - EVENT_InitNewSoldierAnim( pSoldier, usPendingAnimation, 0 , FALSE ); - pSoldier->fTurningUntilDone = FALSE; + this->EVENT_InitNewSoldierAnim( usPendingAnimation, 0 , FALSE ); + this->flags.fTurningUntilDone = FALSE; } } // Don't do anything if we are at dest direction! - if ( pSoldier->ubDirection == pSoldier->bDesiredDirection ) + if ( this->ubDirection == this->pathing.bDesiredDirection ) { - if ( pSoldier->ubBodyType == TANK_NW || pSoldier->ubBodyType == TANK_NE ) + if ( this->ubBodyType == TANK_NW || this->ubBodyType == TANK_NE ) { - if ( pSoldier->iTuringSoundID != NO_SAMPLE ) + if ( this->iTuringSoundID != NO_SAMPLE ) { - SoundStop( pSoldier->iTuringSoundID ); - pSoldier->iTuringSoundID = NO_SAMPLE; + SoundStop( this->iTuringSoundID ); + this->iTuringSoundID = NO_SAMPLE; - PlaySoldierJA2Sample( pSoldier->ubID, TURRET_STOP, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( this->ubID, TURRET_STOP, RATE_11025, SoundVolume( HIGHVOLUME, this->sGridNo ), 1, SoundDir( this->sGridNo ), TRUE ); } } // Turn off! - pSoldier->uiStatusFlags &= (~SOLDIER_LOOK_NEXT_TURNSOLDIER ); - pSoldier->fDontUnsetLastTargetFromTurn = FALSE; + this->flags.uiStatusFlags &= (~SOLDIER_LOOK_NEXT_TURNSOLDIER ); + this->flags.fDontUnsetLastTargetFromTurn = FALSE; // Unset ui busy if from ui - if ( pSoldier->bTurningFromUI && - ( pSoldier->bTurningFromPronePosition != TURNING_FROM_PRONE_ENDING_UP_FROM_MOVE ) && - ( pSoldier->bTurningFromPronePosition != TURNING_FROM_PRONE_ON ) ) + if ( this->bTurningFromUI && + ( this->flags.bTurningFromPronePosition != TURNING_FROM_PRONE_ENDING_UP_FROM_MOVE ) && + ( this->flags.bTurningFromPronePosition != TURNING_FROM_PRONE_ON ) ) { - UnSetUIBusy( pSoldier->ubID ); - pSoldier->bTurningFromUI = FALSE; + UnSetUIBusy( this->ubID ); + this->bTurningFromUI = FALSE; } - if ( pSoldier->uiStatusFlags & ( SOLDIER_VEHICLE ) || CREATURE_OR_BLOODCAT( pSoldier ) ) + if ( this->flags.uiStatusFlags & ( SOLDIER_VEHICLE ) || CREATURE_OR_BLOODCAT( this ) ) { - pSoldier->uiStatusFlags &= (~SOLDIER_PAUSEANIMOVE); + this->flags.uiStatusFlags &= (~SOLDIER_PAUSEANIMOVE); } - FreeUpNPCFromTurning( pSoldier, LOOK); + FreeUpNPCFromTurning( this, LOOK); // Undo our flag for prone turning... // Else check if we are trying to shoot and once was prone, but am now crouched because we needed to turn... - if ( pSoldier->bTurningFromPronePosition == TURNING_FROM_PRONE_ON ) + if ( this->flags.bTurningFromPronePosition == TURNING_FROM_PRONE_ON ) { // ATE: Don't do this if we have something in our hands we are going to throw! - if ( IsValidStance( pSoldier, ANIM_PRONE ) && pSoldier->pTempObject == NULL ) + if ( IsValidStance( this, ANIM_PRONE ) && this->pTempObject == NULL ) { - SendChangeSoldierStanceEvent( pSoldier, ANIM_PRONE ); + SendChangeSoldierStanceEvent( this, ANIM_PRONE ); } - pSoldier->bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; + this->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; } // If a special code, make guy crawl after stance change! - if ( pSoldier->bTurningFromPronePosition == TURNING_FROM_PRONE_ENDING_UP_FROM_MOVE && - pSoldier->usAnimState != PRONE_UP && - pSoldier->usAnimState != PRONE_DOWN ) + if ( this->flags.bTurningFromPronePosition == TURNING_FROM_PRONE_ENDING_UP_FROM_MOVE && + this->usAnimState != PRONE_UP && + this->usAnimState != PRONE_DOWN ) { - if ( IsValidStance( pSoldier, ANIM_PRONE ) ) + if ( IsValidStance( this, ANIM_PRONE ) ) { - EVENT_InitNewSoldierAnim( pSoldier, CRAWLING, 0, FALSE ); + this->EVENT_InitNewSoldierAnim( CRAWLING, 0, FALSE ); } // Else swat for a tile so that there's room to resume prone else { - EVENT_InitNewSoldierAnim( pSoldier, pSoldier->usUIMovementMode, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( this->usUIMovementMode, 0 , FALSE ); } } - if ( pSoldier->uiStatusFlags & SOLDIER_TURNINGFROMHIT ) + if ( this->flags.uiStatusFlags & SOLDIER_TURNINGFROMHIT ) { // This section seems problem-prone. It relies on all animations happening without interruption. There must be a more // foolproof method. - if ( pSoldier->fGettingHit == 1 ) + if ( this->flags.fGettingHit == 1 ) { - if ( pSoldier->usPendingAnimation != FALLFORWARD_ROOF && pSoldier->usPendingAnimation != FALLOFF && pSoldier->usAnimState != FALLFORWARD_ROOF && pSoldier->usAnimState != FALLOFF ) + if ( this->usPendingAnimation != FALLFORWARD_ROOF && this->usPendingAnimation != FALLOFF && this->usAnimState != FALLFORWARD_ROOF && this->usAnimState != FALLOFF ) { // Go back to original direction - EVENT_SetSoldierDesiredDirection( pSoldier, (INT8)pSoldier->uiPendingActionData1 ); + this->EVENT_SetSoldierDesiredDirection( (INT8)this->aiData.uiPendingActionData1 ); //SETUP GETTING HIT FLAG TO 2 - pSoldier->fGettingHit = 2; + this->flags.fGettingHit = 2; } else { - pSoldier->uiStatusFlags &= (~SOLDIER_TURNINGFROMHIT ); - pSoldier->fGettingHit = FALSE; + this->flags.uiStatusFlags &= (~SOLDIER_TURNINGFROMHIT ); + this->flags.fGettingHit = FALSE; } } - else if ( pSoldier->fGettingHit == 2 ) + else if ( this->flags.fGettingHit == 2 ) { // Turn off - pSoldier->uiStatusFlags &= (~SOLDIER_TURNINGFROMHIT ); + this->flags.uiStatusFlags &= (~SOLDIER_TURNINGFROMHIT ); // Release attacker // DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Releasesoldierattacker, turning from hit animation ended") ); - // ReleaseSoldiersAttacker( pSoldier ); + // ReleaseSoldiersAttacker( this ); // 0verhaul: Since I disabled the turn from hit ABC increase, I need to disable the turn from hit decrease too. DebugAttackBusy( "Finished turning from hit. Not Reducing attack busy.\n"); //ReduceAttackBusyCount( ); //FREEUP GETTING HIT FLAG - pSoldier->fGettingHit = FALSE; + this->flags.fGettingHit = FALSE; } } @@ -6125,21 +6927,21 @@ void TurnSoldier( SOLDIERTYPE *pSoldier) // IF WE ARE HERE, WE ARE IN THE PROCESS OF TURNING // DOUBLE CHECK TO UNSET fNOAPs... - if ( pSoldier->fNoAPToFinishMove ) + if ( this->flags.fNoAPToFinishMove ) { - AdjustNoAPToFinishMove( pSoldier, FALSE ); + this->AdjustNoAPToFinishMove( FALSE ); } // Do something different for vehicles.... - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( this->flags.uiStatusFlags & SOLDIER_VEHICLE ) { fDoDirectionChange = FALSE; // Get new direction /* - sDirection = pSoldier->ubHiResDirection + ExtQuickestDirection( pSoldier->ubHiResDirection, pSoldier->ubHiResDesiredDirection ); + sDirection = this->ubHiResDirection + ExtQuickestDirection( this->ubHiResDirection, this->ubHiResDesiredDirection ); */ - sDirection = pSoldier->ubHiResDirection + pSoldier->bTurningIncrement; + sDirection = this->ubHiResDirection + this->bTurningIncrement; if (sDirection > 31) { sDirection = 0; @@ -6151,11 +6953,11 @@ void TurnSoldier( SOLDIERTYPE *pSoldier) sDirection = 31; } } - pSoldier->ubHiResDirection = (UINT8)sDirection; + this->ubHiResDirection = (UINT8)sDirection; // Are we at a multiple of a 'cardnal' direction? for ( cnt = 0; cnt < 8; cnt++ ) - { + { if ( sDirection == ubExtDirection[ cnt ] ) { fDoDirectionChange = TRUE; @@ -6166,19 +6968,19 @@ void TurnSoldier( SOLDIERTYPE *pSoldier) } } - if ( pSoldier->ubBodyType == TANK_NW || pSoldier->ubBodyType == TANK_NE ) + if ( this->ubBodyType == TANK_NW || this->ubBodyType == TANK_NE ) { - if ( pSoldier->iTuringSoundID == NO_SAMPLE ) + if ( this->iTuringSoundID == NO_SAMPLE ) { - pSoldier->iTuringSoundID = PlaySoldierJA2Sample( pSoldier->ubID, TURRET_MOVE, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 100, SoundDir( pSoldier->sGridNo ), TRUE ); + this->iTuringSoundID = PlaySoldierJA2Sample( this->ubID, TURRET_MOVE, RATE_11025, SoundVolume( HIGHVOLUME, this->sGridNo ), 100, SoundDir( this->sGridNo ), TRUE ); } } } else { // Get new direction - //sDirection = pSoldier->ubDirection + QuickestDirection( pSoldier->ubDirection, pSoldier->bDesiredDirection ); - sDirection = pSoldier->ubDirection + pSoldier->bTurningIncrement; + //sDirection = this->ubDirection + QuickestDirection( this->ubDirection, this->pathing.bDesiredDirection ); + sDirection = this->ubDirection + this->bTurningIncrement; if (sDirection > 7) { sDirection = 0; @@ -6199,44 +7001,43 @@ void TurnSoldier( SOLDIERTYPE *pSoldier) { // If the soldier is not crawling or multi-tiled, he should be allowed to turn in place. Even if there is some // obstacle he shouldn't be standing on. - if ( OKToAddMercToWorld( pSoldier, (INT8)sDirection ) ) + if ( OKToAddMercToWorld( this, (INT8)sDirection ) ) { - // Don't do this if we are walkoing off screen... if ( gubWaitingForAllMercsToExitCode == WAIT_FOR_MERCS_TO_WALKOFF_SCREEN || gubWaitingForAllMercsToExitCode == WAIT_FOR_MERCS_TO_WALK_TO_GRIDNO ) { + // Don't do this if we are walking off screen... } else { // ATE: We should only do this if we are STATIONARY! - if ( ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_STATIONARY ) ) + if ( ( gAnimControl[ this->usAnimState ].uiFlags & ANIM_STATIONARY ) ) { - pSoldier->uiStatusFlags |= SOLDIER_LOOK_NEXT_TURNSOLDIER; + this->flags.uiStatusFlags |= SOLDIER_LOOK_NEXT_TURNSOLDIER; } // otherwise, it's handled next tile... } - EVENT_SetSoldierDirection( pSoldier, sDirection ); + this->EVENT_SetSoldierDirection( sDirection ); - if ( pSoldier->ubBodyType != LARVAE_MONSTER && !MercInWater( pSoldier ) && pSoldier->bOverTerrainType != DIRT_ROAD && pSoldier->bOverTerrainType != PAVED_ROAD ) + if ( this->ubBodyType != LARVAE_MONSTER && !this->MercInWater( ) && this->bOverTerrainType != DIRT_ROAD && this->bOverTerrainType != PAVED_ROAD ) { - PlaySoldierFootstepSound( pSoldier ); + PlaySoldierFootstepSound( this ); } } - // Are we prone crawling? - else if ( pSoldier->usAnimState == CRAWLING ) + // Are we prone crawling? + else if ( this->usAnimState == CRAWLING ) { // OK, we want to getup, turn and go prone again.... - SendChangeSoldierStanceEvent( pSoldier, ANIM_CROUCH ); - pSoldier->bTurningFromPronePosition = TURNING_FROM_PRONE_ENDING_UP_FROM_MOVE; + SendChangeSoldierStanceEvent( this, ANIM_CROUCH ); + this->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_ENDING_UP_FROM_MOVE; } // If we are a creature, or multi-tiled, cancel AI action.....? - else if ( pSoldier->uiStatusFlags & SOLDIER_MULTITILE ) + else if ( this->flags.uiStatusFlags & SOLDIER_MULTITILE ) { - pSoldier->bDesiredDirection = pSoldier->ubDirection; + this->pathing.bDesiredDirection = this->ubDirection; } - - } + } } @@ -6375,7 +7176,7 @@ UINT8 gOrangeGlowG[]= }; -BOOLEAN CreateSoldierPalettes( SOLDIERTYPE *pSoldier ) +BOOLEAN SOLDIERTYPE::CreateSoldierPalettes( void ) { UINT16 usAnimSurface, usPaletteAnimSurface; CHAR8 zColFilename[ 100 ]; @@ -6387,45 +7188,45 @@ BOOLEAN CreateSoldierPalettes( SOLDIERTYPE *pSoldier ) //NT32 uiCount; //PPaletteEntry Pal[256]; - if ( pSoldier->p8BPPPalette != NULL ) + if ( this->p8BPPPalette != NULL ) { - MemFree( pSoldier->p8BPPPalette ); - pSoldier->p8BPPPalette = NULL; + MemFree( this->p8BPPPalette ); + this->p8BPPPalette = NULL; } // Allocate mem for new palette - pSoldier->p8BPPPalette = (SGPPaletteEntry *) MemAlloc( sizeof( SGPPaletteEntry ) * 256 ); - memset( pSoldier->p8BPPPalette, 0, sizeof( SGPPaletteEntry ) * 256 ); + this->p8BPPPalette = (SGPPaletteEntry *) MemAlloc( sizeof( SGPPaletteEntry ) * 256 ); + memset( this->p8BPPPalette, 0, sizeof( SGPPaletteEntry ) * 256 ); - CHECKF( pSoldier->p8BPPPalette != NULL ); + CHECKF( this->p8BPPPalette != NULL ); // --- TAKE FROM CURRENT ANIMATION HVOBJECT! - usAnimSurface = GetSoldierAnimationSurface( pSoldier, pSoldier->usAnimState ); + usAnimSurface = GetSoldierAnimationSurface( this, this->usAnimState ); CHECKF( usAnimSurface != INVALID_ANIMATION_SURFACE ); - if ( ( bBodyTypePalette = GetBodyTypePaletteSubstitutionCode( pSoldier, pSoldier->ubBodyType, zColFilename ) ) == -1 ) + if ( ( bBodyTypePalette = GetBodyTypePaletteSubstitutionCode( this, this->ubBodyType, zColFilename ) ) == -1 ) { // ATE: here we want to use the breath cycle for the palette..... - usPaletteAnimSurface = LoadSoldierAnimationSurface( pSoldier, STANDING ); + usPaletteAnimSurface = LoadSoldierAnimationSurface( this, STANDING ); if ( usPaletteAnimSurface != INVALID_ANIMATION_SURFACE ) { // Use palette from HVOBJECT, then use substitution for pants, etc - memcpy( pSoldier->p8BPPPalette, gAnimSurfaceDatabase[ usPaletteAnimSurface ].hVideoObject->pPaletteEntry, sizeof( pSoldier->p8BPPPalette ) * 256 ); + memcpy( this->p8BPPPalette, gAnimSurfaceDatabase[ usPaletteAnimSurface ].hVideoObject->pPaletteEntry, sizeof( this->p8BPPPalette ) * 256 ); // Substitute based on head, etc - SetPaletteReplacement( pSoldier->p8BPPPalette, pSoldier->HeadPal ); - SetPaletteReplacement( pSoldier->p8BPPPalette, pSoldier->VestPal ); - SetPaletteReplacement( pSoldier->p8BPPPalette, pSoldier->PantsPal ); - SetPaletteReplacement( pSoldier->p8BPPPalette, pSoldier->SkinPal ); + SetPaletteReplacement( this->p8BPPPalette, this->HeadPal ); + SetPaletteReplacement( this->p8BPPPalette, this->VestPal ); + SetPaletteReplacement( this->p8BPPPalette, this->PantsPal ); + SetPaletteReplacement( this->p8BPPPalette, this->SkinPal ); } } else if ( bBodyTypePalette == 0 ) { // Use palette from hvobject - memcpy( pSoldier->p8BPPPalette, gAnimSurfaceDatabase[ usAnimSurface ].hVideoObject->pPaletteEntry, sizeof( pSoldier->p8BPPPalette ) * 256 ); + memcpy( this->p8BPPPalette, gAnimSurfaceDatabase[ usAnimSurface ].hVideoObject->pPaletteEntry, sizeof( this->p8BPPPalette ) * 256 ); } else { @@ -6433,54 +7234,54 @@ BOOLEAN CreateSoldierPalettes( SOLDIERTYPE *pSoldier ) if ( CreateSGPPaletteFromCOLFile( Temp8BPPPalette, zColFilename ) ) { // Copy into palette - memcpy( pSoldier->p8BPPPalette, Temp8BPPPalette, sizeof( pSoldier->p8BPPPalette ) * 256 ); + memcpy( this->p8BPPPalette, Temp8BPPPalette, sizeof( this->p8BPPPalette ) * 256 ); } else { // Use palette from hvobject - memcpy( pSoldier->p8BPPPalette, gAnimSurfaceDatabase[ usAnimSurface ].hVideoObject->pPaletteEntry, sizeof( pSoldier->p8BPPPalette ) * 256 ); + memcpy( this->p8BPPPalette, gAnimSurfaceDatabase[ usAnimSurface ].hVideoObject->pPaletteEntry, sizeof( this->p8BPPPalette ) * 256 ); } } - if ( pSoldier->p16BPPPalette != NULL ) + if ( this->p16BPPPalette != NULL ) { - MemFree( pSoldier->p16BPPPalette ); - pSoldier->p16BPPPalette = NULL; + MemFree( this->p16BPPPalette ); + this->p16BPPPalette = NULL; } // -- BUILD 16BPP Palette from this - pSoldier->p16BPPPalette = Create16BPPPalette( pSoldier->p8BPPPalette ); + this->p16BPPPalette = Create16BPPPalette( this->p8BPPPalette ); for ( iWhich = 0; iWhich < NUM_SOLDIER_SHADES; iWhich++ ) { - if ( pSoldier->pShades[ iWhich ] != NULL ) + if ( this->pShades[ iWhich ] != NULL ) { - MemFree( pSoldier->pShades[ iWhich ] ); - pSoldier->pShades[ iWhich ] = NULL; + MemFree( this->pShades[ iWhich ] ); + this->pShades[ iWhich ] = NULL; } } for ( iWhich = 0; iWhich < NUM_SOLDIER_EFFECTSHADES; iWhich++ ) { - if ( pSoldier->pEffectShades[ iWhich ] != NULL ) + if ( this->pEffectShades[ iWhich ] != NULL ) { - MemFree( pSoldier->pEffectShades[ iWhich ] ); - pSoldier->pEffectShades[ iWhich ] = NULL; + MemFree( this->pEffectShades[ iWhich ] ); + this->pEffectShades[ iWhich ] = NULL; } } for ( iWhich = 0; iWhich < 20; iWhich++ ) { - if ( pSoldier->pGlowShades[ iWhich ] != NULL ) + if ( this->pGlowShades[ iWhich ] != NULL ) { - MemFree( pSoldier->pGlowShades[ iWhich ] ); - pSoldier->pGlowShades[ iWhich ] = NULL; + MemFree( this->pGlowShades[ iWhich ] ); + this->pGlowShades[ iWhich ] = NULL; } } - CreateSoldierPaletteTables( pSoldier, HVOBJECT_GLOW_GREEN ); + CreateSoldierPaletteTables( this, HVOBJECT_GLOW_GREEN ); // Build a grayscale palette for testing grayout of mercs @@ -6490,42 +7291,42 @@ BOOLEAN CreateSoldierPalettes( SOLDIERTYPE *pSoldier ) // Pal[uiCount].peGreen=(UINT8)(uiCount%128)+128; // Pal[uiCount].peBlue=(UINT8)(uiCount%128)+128; //} - pSoldier->pEffectShades[ 0 ] = Create16BPPPaletteShaded( pSoldier->p8BPPPalette, 100, 100, 100, TRUE ); - pSoldier->pEffectShades[ 1 ] = Create16BPPPaletteShaded( pSoldier->p8BPPPalette, 100, 150, 100, TRUE ); + this->pEffectShades[ 0 ] = Create16BPPPaletteShaded( this->p8BPPPalette, 100, 100, 100, TRUE ); + this->pEffectShades[ 1 ] = Create16BPPPaletteShaded( this->p8BPPPalette, 100, 150, 100, TRUE ); // Build shades for glowing visible bad guy // First do visible guy - pSoldier->pGlowShades[ 0 ] = Create16BPPPaletteShaded( pSoldier->p8BPPPalette, 255, 255, 255, FALSE ); + this->pGlowShades[ 0 ] = Create16BPPPaletteShaded( this->p8BPPPalette, 255, 255, 255, FALSE ); for ( cnt = 1; cnt < 10; cnt++ ) { - pSoldier->pGlowShades[ cnt ] = CreateEnemyGlow16BPPPalette( pSoldier->p8BPPPalette, gRedGlowR[cnt], 255, FALSE ); + this->pGlowShades[ cnt ] = CreateEnemyGlow16BPPPalette( this->p8BPPPalette, gRedGlowR[cnt], 255, FALSE ); } // Now for gray guy... - pSoldier->pGlowShades[ 10 ] = Create16BPPPaletteShaded( pSoldier->p8BPPPalette, 100, 100, 100, TRUE ); + this->pGlowShades[ 10 ] = Create16BPPPaletteShaded( this->p8BPPPalette, 100, 100, 100, TRUE ); for ( cnt = 11; cnt < 19; cnt++ ) { - pSoldier->pGlowShades[ cnt ] = CreateEnemyGreyGlow16BPPPalette( pSoldier->p8BPPPalette, gRedGlowR[cnt], 0, FALSE ); + this->pGlowShades[ cnt ] = CreateEnemyGreyGlow16BPPPalette( this->p8BPPPalette, gRedGlowR[cnt], 0, FALSE ); } - pSoldier->pGlowShades[ 19 ] = CreateEnemyGreyGlow16BPPPalette( pSoldier->p8BPPPalette, gRedGlowR[18], 0, FALSE ); + this->pGlowShades[ 19 ] = CreateEnemyGreyGlow16BPPPalette( this->p8BPPPalette, gRedGlowR[18], 0, FALSE ); // ATE: OK, piggyback on the shades we are not using for 2 colored lighting.... // ORANGE, VISIBLE GUY - pSoldier->pShades[ 20 ] = Create16BPPPaletteShaded( pSoldier->p8BPPPalette, 255, 255, 255, FALSE ); + this->pShades[ 20 ] = Create16BPPPaletteShaded( this->p8BPPPalette, 255, 255, 255, FALSE ); for ( cnt = 21; cnt < 30; cnt++ ) { - pSoldier->pShades[ cnt ] = CreateEnemyGlow16BPPPalette( pSoldier->p8BPPPalette, gOrangeGlowR[ ( cnt - 20 )], gOrangeGlowG[ ( cnt - 20 ) ], TRUE ); + this->pShades[ cnt ] = CreateEnemyGlow16BPPPalette( this->p8BPPPalette, gOrangeGlowR[ ( cnt - 20 )], gOrangeGlowG[ ( cnt - 20 ) ], TRUE ); } // ORANGE, GREY GUY - pSoldier->pShades[ 30 ] = Create16BPPPaletteShaded( pSoldier->p8BPPPalette, 100, 100, 100, TRUE ); + this->pShades[ 30 ] = Create16BPPPaletteShaded( this->p8BPPPalette, 100, 100, 100, TRUE ); for ( cnt = 31; cnt < 39; cnt++ ) { - pSoldier->pShades[ cnt ] = CreateEnemyGreyGlow16BPPPalette( pSoldier->p8BPPPalette, gOrangeGlowR[ ( cnt - 20 ) ], gOrangeGlowG[ ( cnt - 20 ) ], TRUE ); + this->pShades[ cnt ] = CreateEnemyGreyGlow16BPPPalette( this->p8BPPPalette, gOrangeGlowR[ ( cnt - 20 ) ], gOrangeGlowG[ ( cnt - 20 ) ], TRUE ); } - pSoldier->pShades[ 39 ] = CreateEnemyGreyGlow16BPPPalette( pSoldier->p8BPPPalette, gOrangeGlowR[18], gOrangeGlowG[18], TRUE ); + this->pShades[ 39 ] = CreateEnemyGreyGlow16BPPPalette( this->p8BPPPalette, gOrangeGlowR[18], gOrangeGlowG[18], TRUE ); return( TRUE ); } @@ -6547,7 +7348,7 @@ void AdjustAniSpeed( SOLDIERTYPE *pSoldier ) } - RESETTIMECOUNTER( pSoldier->UpdateCounter, pSoldier->sAniDelay ); + RESETTIMECOUNTER( pSoldier->timeCounters.UpdateCounter, pSoldier->sAniDelay ); } @@ -6580,7 +7381,7 @@ void CalculateSoldierAniSpeed( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pStatsSoldier case PRONE: case STANDING: - pSoldier->sAniDelay = ( pStatsSoldier->bBreath * 2 ) + (100 - pStatsSoldier->bLife ); + pSoldier->sAniDelay = ( pStatsSoldier->bBreath * 2 ) + (100 - pStatsSoldier->stats.bLife ); // Limit it! if ( pSoldier->sAniDelay < 40 ) @@ -6592,7 +7393,7 @@ void CalculateSoldierAniSpeed( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pStatsSoldier case CROUCHING: - pSoldier->sAniDelay = ( pStatsSoldier->bBreath * 2 ) + ( (100 - pStatsSoldier->bLife ) ); + pSoldier->sAniDelay = ( pStatsSoldier->bBreath * 2 ) + ( (100 - pStatsSoldier->stats.bLife ) ); // Limit it! if ( pSoldier->sAniDelay < 40 ) @@ -6643,7 +7444,7 @@ void CalculateSoldierAniSpeed( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pStatsSoldier case READY_RIFLE_STAND: // Raise rifle based on aim vs non-aim. - if ( pSoldier->bAimTime == 0 ) + if ( pSoldier->aiData.bAimTime == 0 ) { // Quick shot pSoldier->sAniDelay = 70; @@ -6658,7 +7459,7 @@ void CalculateSoldierAniSpeed( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pStatsSoldier // figure out movement speed (terrspeed) - if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_MOVING ) + if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_MOVING ) { uiSpeed = gsTerrainTypeSpeedModifiers[ pStatsSoldier->bOverTerrainType ]; @@ -6675,14 +7476,14 @@ void CalculateSoldierAniSpeed( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pStatsSoldier bBreathDef = 30; bAgilDef = 50 - ( EffectiveAgility( pStatsSoldier ) / 4 ); - bLifeDef = 50 - ( pStatsSoldier->bLife / 2 ); + bLifeDef = 50 - ( pStatsSoldier->stats.bLife / 2 ); uiTerrainDelay += ( bLifeDef + bBreathDef + bAgilDef + bAdditional ); pSoldier->sAniDelay = (INT16)uiTerrainDelay; // If a moving animation and w/re on drugs, increase speed.... - if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_MOVING ) + if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_MOVING ) { if ( GetDrugEffect( pSoldier, DRUG_TYPE_ADRENALINE ) ) { @@ -6750,7 +7551,7 @@ void SetSoldierAniSpeed( SOLDIERTYPE *pSoldier ) { pSoldier->sAniDelay = 0; } - RESETTIMECOUNTER( pSoldier->UpdateCounter, pSoldier->sAniDelay ); + RESETTIMECOUNTER( pSoldier->timeCounters.UpdateCounter, pSoldier->sAniDelay ); return; } } @@ -6758,7 +7559,7 @@ void SetSoldierAniSpeed( SOLDIERTYPE *pSoldier ) // Default stats soldier to same as normal soldier..... pStatsSoldier = pSoldier; - if ( pSoldier->fUseMoverrideMoveSpeed ) + if ( pSoldier->flags.fUseMoverrideMoveSpeed ) { pStatsSoldier = MercPtrs[ pSoldier->bOverrideMoveSpeed ]; } @@ -6778,8 +7579,8 @@ void SetSoldierAniSpeed( SOLDIERTYPE *pSoldier ) if ( gTacticalStatus.uiFlags & TURNBASED && gTacticalStatus.uiFlags & INCOMBAT ) if( GetSpeedUpFactor() ) - pSoldier->sAniDelay /= GetSpeedUpFactor(); - else + pSoldier->sAniDelay /= GetSpeedUpFactor(); + else pSoldier->sAniDelay = 0; } @@ -6976,12 +7777,12 @@ BOOLEAN GetPaletteRepIndexFromID( PaletteRepID aPalRep, UINT8 *pubPalIndex ) return( FALSE ); } -UINT16 GetNewSoldierStateFromNewStance( SOLDIERTYPE *pSoldier, UINT8 ubDesiredStance ) +UINT16 SOLDIERTYPE::GetNewSoldierStateFromNewStance( UINT8 ubDesiredStance ) { UINT16 usNewState; INT8 bCurrentHeight; - bCurrentHeight = ( ubDesiredStance - gAnimControl[ pSoldier->usAnimState ].ubEndHeight ); + bCurrentHeight = ( ubDesiredStance - gAnimControl[ this->usAnimState ].ubEndHeight ); // Now change to appropriate animation @@ -7012,7 +7813,7 @@ UINT16 GetNewSoldierStateFromNewStance( SOLDIERTYPE *pSoldier, UINT8 ubDesiredSt // Cannot get here unless ub desired stance is bogus DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "GetNewSoldierStateFromNewStance bogus ubDesiredStance value %d", ubDesiredStance ) ); - usNewState = pSoldier->usAnimState; + usNewState = this->usAnimState; } @@ -7024,7 +7825,7 @@ void MoveMercFacingDirection( SOLDIERTYPE *pSoldier, BOOLEAN fReverse, FLOAT dMo { FLOAT dAngle = (FLOAT)0; - // Determine which direction we are in + // Determine which direction we are in switch( pSoldier->ubDirection ) { case NORTH: @@ -7067,78 +7868,83 @@ void MoveMercFacingDirection( SOLDIERTYPE *pSoldier, BOOLEAN fReverse, FLOAT dMo dMovementDist = dMovementDist * -1; } - MoveMerc( pSoldier, dMovementDist, dAngle, FALSE ); + pSoldier->MoveMerc( dMovementDist, dAngle, FALSE ); } -void BeginSoldierClimbUpRoof( SOLDIERTYPE *pSoldier ) +void SOLDIERTYPE::BeginSoldierClimbUpRoof( void ) { + + //CHRISL: Disable climbing up to a roof while wearing a backpack + if((UsingNewInventorySystem() == true) && this->inv[BPACKPOCKPOS].exists() == true) { + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Cannot climb while wearing a backpack" ); + return; + } INT8 bNewDirection; UINT8 ubWhoIsThere; - - if ( FindHeigherLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) && ( pSoldier->bLevel == 0 ) ) + if ( FindHeigherLevel( this, this->sGridNo, this->ubDirection, &bNewDirection ) && ( this->pathing.bLevel == 0 ) ) { - if ( EnoughPoints( pSoldier, GetAPsToClimbRoof( pSoldier, FALSE ), 0, TRUE ) ) + if ( EnoughPoints( this, GetAPsToClimbRoof( this, FALSE ), 0, TRUE ) ) { //Kaiden: Helps if we look where we are going before we try to climb on top of someone - ubWhoIsThere = WhoIsThere2( NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc(bNewDirection ) ), 1 ); - if ( ubWhoIsThere != NOBODY && ubWhoIsThere != pSoldier->ubID ) - { - return; - } + ubWhoIsThere = WhoIsThere2( NewGridNo( (INT16)this->sGridNo, (UINT16)DirectionInc(bNewDirection ) ), 1 ); + if ( ubWhoIsThere != NOBODY && ubWhoIsThere != this->ubID ) + { + return; + } else - { + { - if (pSoldier->bTeam == gbPlayerNum) - { - // OK, SET INTERFACE FIRST - SetUIBusy( pSoldier->ubID ); - } + if (this->bTeam == gbPlayerNum) + { + // OK, SET INTERFACE FIRST + SetUIBusy( this->ubID ); + } - pSoldier->sTempNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc(bNewDirection ) ); + this->sTempNewGridNo = NewGridNo( (INT16)this->sGridNo, (UINT16)DirectionInc(bNewDirection ) ); - pSoldier->ubPendingDirection = bNewDirection; - //pSoldier->usPendingAnimation = CLIMBUPROOF; - EVENT_InitNewSoldierAnim( pSoldier, CLIMBUPROOF, 0 , FALSE ); + this->ubPendingDirection = bNewDirection; + //this->usPendingAnimation = CLIMBUPROOF; + this->EVENT_InitNewSoldierAnim( CLIMBUPROOF, 0 , FALSE ); - InternalReceivingSoldierCancelServices( pSoldier, FALSE ); - InternalGivingSoldierCancelServices( pSoldier, FALSE ); + this->InternalReceivingSoldierCancelServices( FALSE ); + this->InternalGivingSoldierCancelServices( FALSE ); - } + } - } + } } else { - DebugAttackBusy( String( "Soldier %d tried to climb where no roof is.\n", pSoldier->ubID ) ); - pSoldier->bAction = AI_ACTION_NONE; + DebugAttackBusy( String( "Soldier %d tried to climb where no roof is.\n", this->ubID ) ); + this->aiData.bAction = AI_ACTION_NONE; } } -void BeginSoldierClimbFence( SOLDIERTYPE *pSoldier ) +void SOLDIERTYPE::BeginSoldierClimbFence( void ) { INT8 bDirection; // Make sure we hop the correct fence to follow our path! - if (pSoldier->usPathIndex < pSoldier->usPathDataSize) + if (this->pathing.usPathIndex < this->pathing.usPathDataSize) { - bDirection = (INT8) pSoldier->usPathingData[ pSoldier->usPathIndex]; + bDirection = (INT8) this->pathing.usPathingData[ this->pathing.usPathIndex]; } else { - bDirection = pSoldier->ubDirection; + bDirection = this->ubDirection; } - if ( FindFenceJumpDirection( pSoldier, pSoldier->sGridNo, bDirection, &bDirection ) ) + if ( FindFenceJumpDirection( this, this->sGridNo, bDirection, &bDirection ) ) { - pSoldier->sTempNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc(bDirection ) ); - pSoldier->fDontChargeTurningAPs = TRUE; - EVENT_InternalSetSoldierDesiredDirection( pSoldier, bDirection, FALSE, pSoldier->usAnimState ); - pSoldier->fTurningUntilDone = TRUE; + this->sTempNewGridNo = NewGridNo( (INT16)this->sGridNo, (UINT16)DirectionInc(bDirection ) ); + this->flags.fDontChargeTurningAPs = TRUE; + EVENT_InternalSetSoldierDesiredDirection( this, bDirection, FALSE, this->usAnimState ); + this->flags.fTurningUntilDone = TRUE; // ATE: Reset flag to go back to prone... - pSoldier->bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; - pSoldier->usPendingAnimation = HOPFENCE; + this->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; + this->usPendingAnimation = HOPFENCE; } } @@ -7148,7 +7954,7 @@ UINT32 SleepDartSuccumbChance( SOLDIERTYPE * pSoldier ) UINT32 uiChance; INT8 bEffectiveStrength; - // figure out base chance of succumbing, + // figure out base chance of succumbing, bEffectiveStrength = EffectiveStrength( pSoldier ); if (bEffectiveStrength > 90) @@ -7174,10 +7980,10 @@ UINT32 SleepDartSuccumbChance( SOLDIERTYPE * pSoldier ) return( uiChance ); } -void BeginSoldierGetup( SOLDIERTYPE *pSoldier ) +void SOLDIERTYPE::BeginSoldierGetup( void ) { // RETURN IF WE ARE BEING SERVICED - if ( pSoldier->ubServiceCount > 0 ) + if ( this->ubServiceCount > 0 ) { return; } @@ -7188,23 +7994,23 @@ void BeginSoldierGetup( SOLDIERTYPE *pSoldier ) return; } - if ( pSoldier->bCollapsed ) + if ( this->bCollapsed ) { - if ( pSoldier->bLife >= OKLIFE && pSoldier->bBreath >= OKBREATH && (pSoldier->bSleepDrugCounter == 0) ) + if ( this->stats.bLife >= OKLIFE && this->bBreath >= OKBREATH && (this->bSleepDrugCounter == 0) ) { // get up you hoser! - pSoldier->bCollapsed = FALSE; - pSoldier->bTurnsCollapsed = 0; + this->bCollapsed = FALSE; + this->bTurnsCollapsed = 0; - if ( IS_MERC_BODY_TYPE( pSoldier ) ) + if ( IS_MERC_BODY_TYPE( this ) ) { - switch( pSoldier->usAnimState ) + switch( this->usAnimState ) { case FALLOFF_FORWARD_STOP: case PRONE_LAYFROMHIT_STOP: case STAND_FALLFORWARD_STOP: - ChangeSoldierStance( pSoldier, ANIM_CROUCH ); + this->ChangeSoldierStance( ANIM_CROUCH ); break; case FALLBACKHIT_STOP: @@ -7215,50 +8021,50 @@ void BeginSoldierGetup( SOLDIERTYPE *pSoldier ) case FLYBACK_HIT: // ROLL OVER - EVENT_InitNewSoldierAnim( pSoldier, ROLLOVER, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( ROLLOVER, 0 , FALSE ); break; default: - ChangeSoldierStance( pSoldier, ANIM_CROUCH ); + this->ChangeSoldierStance( ANIM_CROUCH ); break; } } else { - EVENT_InitNewSoldierAnim( pSoldier, END_COWER, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( END_COWER, 0 , FALSE ); } } else { - pSoldier->bTurnsCollapsed++; - if ( (gTacticalStatus.bBoxingState == BOXING) && (pSoldier->uiStatusFlags & SOLDIER_BOXER) ) + this->bTurnsCollapsed++; + if ( (gTacticalStatus.bBoxingState == BOXING) && (this->flags.uiStatusFlags & SOLDIER_BOXER) ) { - if (pSoldier->bTurnsCollapsed > 1) + if (this->bTurnsCollapsed > 1) { // We have a winnah! But it isn't this boxer! - EndBoxingMatch( pSoldier ); + EndBoxingMatch( this ); } } } } - else if ( pSoldier->bSleepDrugCounter > 0 ) + else if ( this->bSleepDrugCounter > 0 ) { UINT32 uiChance; - uiChance = SleepDartSuccumbChance( pSoldier ); + uiChance = SleepDartSuccumbChance( this ); if ( PreRandom( 100 ) < uiChance ) { // succumb to the drug! - DeductPoints( pSoldier, 0, (INT16)( pSoldier->bBreathMax * 100 ) ); - SoldierCollapse( pSoldier ); + DeductPoints( this, 0, (INT16)( this->bBreathMax * 100 ) ); + SoldierCollapse( this ); } } - if ( pSoldier->bSleepDrugCounter > 0 ) + if ( this->bSleepDrugCounter > 0 ) { - pSoldier->bSleepDrugCounter--; + this->bSleepDrugCounter--; } } @@ -7277,26 +8083,26 @@ void HandleTakeDamageDeath( SOLDIERTYPE *pSoldier, UINT8 bOldLife, UINT8 ubReaso { if ( ubReason != TAKE_DAMAGE_BLOODLOSS ) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_DIE1 ); - pSoldier->fDeadSoundPlayed = TRUE; + pSoldier->DoMercBattleSound( BATTLE_SOUND_DIE1 ); + pSoldier->flags.fDeadSoundPlayed = TRUE; } } - if ( ( ubReason == TAKE_DAMAGE_ELECTRICITY ) && pSoldier->bLife < OKLIFE ) + if ( ( ubReason == TAKE_DAMAGE_ELECTRICITY ) && pSoldier->stats.bLife < OKLIFE ) { - pSoldier->fInNonintAnim = FALSE; + pSoldier->flags.fInNonintAnim = FALSE; } // Check for < OKLIFE - if ( pSoldier->bLife < OKLIFE && pSoldier->bLife != 0 && !pSoldier->bCollapsed) + if ( pSoldier->stats.bLife < OKLIFE && pSoldier->stats.bLife != 0 && !pSoldier->bCollapsed) { SoldierCollapse( pSoldier ); } // THis is for the die animation that will be happening.... - if ( pSoldier->bLife == 0 ) + if ( pSoldier->stats.bLife == 0 ) { - pSoldier->fDoingExternalDeath = TRUE; + pSoldier->flags.fDoingExternalDeath = TRUE; } // Check if he is dead.... @@ -7306,19 +8112,19 @@ void HandleTakeDamageDeath( SOLDIERTYPE *pSoldier, UINT8 bOldLife, UINT8 ubReaso //if( !( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) { - HandleSoldierTakeDamageFeedback( pSoldier ); + pSoldier->HandleSoldierTakeDamageFeedback( ); } if(( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) || !pSoldier->bInSector ) { - if ( pSoldier->bLife == 0 && !( pSoldier->uiStatusFlags & SOLDIER_DEAD ) ) + if ( pSoldier->stats.bLife == 0 && !( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) ) { StrategicHandlePlayerTeamMercDeath( pSoldier ); // ATE: Here, force always to use die sound... - pSoldier->fDieSoundUsed = FALSE; - DoMercBattleSound( pSoldier, BATTLE_SOUND_DIE1 ); - pSoldier->fDeadSoundPlayed = TRUE; + pSoldier->flags.fDieSoundUsed = FALSE; + pSoldier->DoMercBattleSound( BATTLE_SOUND_DIE1 ); + pSoldier->flags.fDeadSoundPlayed = TRUE; // ATE: DO death sound PlayJA2Sample( (UINT8)DOORCR_1, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); @@ -7331,7 +8137,7 @@ void HandleTakeDamageDeath( SOLDIERTYPE *pSoldier, UINT8 bOldLife, UINT8 ubReaso // 0verhaul: This is also already handled by the animation transitions // if ( ubReason == TAKE_DAMAGE_ELECTRICITY ) // { - // if ( pSoldier->bLife >= OKLIFE ) + // if ( pSoldier->stats.bLife >= OKLIFE ) // { // DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Freeing up attacker from electricity damage") ); // ReleaseSoldiersAttacker( pSoldier ); @@ -7340,7 +8146,7 @@ void HandleTakeDamageDeath( SOLDIERTYPE *pSoldier, UINT8 bOldLife, UINT8 ubReaso } -UINT8 SoldierTakeDamage( SOLDIERTYPE *pSoldier, INT8 bHeight, INT16 sLifeDeduct, INT16 sBreathLoss, UINT8 ubReason, UINT8 ubAttacker, INT16 sSourceGrid, INT16 sSubsequent, BOOLEAN fShowDamage ) +UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBreathLoss, UINT8 ubReason, UINT8 ubAttacker, INT16 sSourceGrid, INT16 sSubsequent, BOOLEAN fShowDamage ) { INT8 bOldLife; UINT8 ubCombinedLoss; @@ -7349,12 +8155,12 @@ UINT8 SoldierTakeDamage( SOLDIERTYPE *pSoldier, INT8 bHeight, INT16 sLifeDeduct, UINT8 ubBlood; UINT16 usItemFlags=0; // Kaiden: Needed for the reveal all items after combat code from UB. - pSoldier->ubLastDamageReason = ubReason; + this->ubLastDamageReason = ubReason; // CJC Jan 21 99: add check to see if we are hurting an enemy in an enemy-controlled // sector; if so, this is a sign of player activity - switch ( pSoldier->bTeam ) + switch ( this->bTeam ) { case ENEMY_TEAM: // if we're in the wilderness this always counts @@ -7369,7 +8175,7 @@ UINT8 SoldierTakeDamage( SOLDIERTYPE *pSoldier, INT8 bHeight, INT16 sLifeDeduct, UpdateLastDayOfPlayerActivity( (UINT16) GetWorldDay() ); break; case CIV_TEAM: - if ( pSoldier->ubCivilianGroup == KINGPIN_CIV_GROUP && gubQuest[ QUEST_RESCUE_MARIA ] == QUESTINPROGRESS && gTacticalStatus.bBoxingState == NOT_BOXING ) + if ( this->ubCivilianGroup == KINGPIN_CIV_GROUP && gubQuest[ QUEST_RESCUE_MARIA ] == QUESTINPROGRESS && gTacticalStatus.bBoxingState == NOT_BOXING ) { SOLDIERTYPE * pMaria = FindSoldierByProfileID( MARIA, FALSE ); if ( pMaria && pMaria->bActive && pMaria->bInSector ) @@ -7383,16 +8189,16 @@ UINT8 SoldierTakeDamage( SOLDIERTYPE *pSoldier, INT8 bHeight, INT16 sLifeDeduct, } // Deduct life!, Show damage if we want! - bOldLife = pSoldier->bLife; + bOldLife = this->stats.bLife; // OK, If we are a vehicle.... damage vehicle...( people inside... ) - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( this->flags.uiStatusFlags & SOLDIER_VEHICLE ) { - if ( TANK( pSoldier ) ) + if ( TANK( this ) ) { //sLifeDeduct = (sLifeDeduct * 2) / 3; } - else + else { if ( ubReason == TAKE_DAMAGE_GUNFIRE ) { @@ -7405,18 +8211,18 @@ UINT8 SoldierTakeDamage( SOLDIERTYPE *pSoldier, INT8 bHeight, INT16 sLifeDeduct, } } - VehicleTakeDamage( pSoldier->bVehicleID, ubReason, sLifeDeduct, pSoldier->sGridNo, ubAttacker ); - HandleTakeDamageDeath( pSoldier, bOldLife, ubReason ); + VehicleTakeDamage( this->bVehicleID, ubReason, sLifeDeduct, this->sGridNo, ubAttacker ); + HandleTakeDamageDeath( this, bOldLife, ubReason ); return( 0 ); } // ATE: If we are elloit being attacked in a meanwhile... - if ( pSoldier->uiStatusFlags & SOLDIER_NPC_SHOOTING ) + if ( this->flags.uiStatusFlags & SOLDIER_NPC_SHOOTING ) { // Almost kill but not quite..... - sLifeDeduct = ( pSoldier->bLife - 1 ); + sLifeDeduct = ( this->stats.bLife - 1 ); // Turn off - pSoldier->uiStatusFlags &= ( ~SOLDIER_NPC_SHOOTING ); + this->flags.uiStatusFlags &= ( ~SOLDIER_NPC_SHOOTING ); } // CJC: make sure Elliot doesn't bleed to death! @@ -7427,24 +8233,24 @@ UINT8 SoldierTakeDamage( SOLDIERTYPE *pSoldier, INT8 bHeight, INT16 sLifeDeduct, // Calculate bandage - bBandage = pSoldier->bLifeMax - pSoldier->bLife - pSoldier->bBleeding; + bBandage = this->stats.bLifeMax - this->stats.bLife - this->bBleeding; if( guiCurrentScreen == MAP_SCREEN ) { fReDrawFace = TRUE; } - if ( CREATURE_OR_BLOODCAT( pSoldier ) ) + if ( CREATURE_OR_BLOODCAT( this ) ) { INT16 sReductionFactor = 0; - if ( pSoldier->ubBodyType == BLOODCAT ) + if ( this->ubBodyType == BLOODCAT ) { sReductionFactor = 2; } - else if (pSoldier->uiStatusFlags & SOLDIER_MONSTER) + else if (this->flags.uiStatusFlags & SOLDIER_MONSTER) { - switch( pSoldier->ubBodyType ) + switch( this->ubBodyType ) { case LARVAE_MONSTER: case INFANT_MONSTER: @@ -7466,7 +8272,7 @@ UINT8 SoldierTakeDamage( SOLDIERTYPE *pSoldier, INT8 bHeight, INT16 sLifeDeduct, } else { - sReductionFactor = 4 + PythSpacesAway( MercPtrs[ ubAttacker ]->sGridNo, pSoldier->sGridNo ) / 2; + sReductionFactor = 4 + PythSpacesAway( MercPtrs[ ubAttacker ]->sGridNo, this->sGridNo ) / 2; } break; } @@ -7487,7 +8293,7 @@ UINT8 SoldierTakeDamage( SOLDIERTYPE *pSoldier, INT8 bHeight, INT16 sLifeDeduct, } // reduce breath loss to a smaller degree, except for the queen... - if ( pSoldier->ubBodyType == QUEENMONSTER ) + if ( this->ubBodyType == QUEENMONSTER ) { // in fact, reduce breath loss by MORE! sReductionFactor = __min( sReductionFactor, 8 ); @@ -7503,40 +8309,40 @@ UINT8 SoldierTakeDamage( SOLDIERTYPE *pSoldier, INT8 bHeight, INT16 sLifeDeduct, } } - if (sLifeDeduct > pSoldier->bLife) + if (sLifeDeduct > this->stats.bLife) { - pSoldier->bLife = 0; + this->stats.bLife = 0; } else { // Decrease Health - pSoldier->bLife -= sLifeDeduct; + this->stats.bLife -= sLifeDeduct; } // ATE: Put some logic in here to allow enemies to die quicker..... // Are we an enemy? - if ( pSoldier->bSide != gbPlayerNum && !pSoldier->bNeutral && pSoldier->ubProfile == NO_PROFILE ) + if ( this->bSide != gbPlayerNum && !this->aiData.bNeutral && this->ubProfile == NO_PROFILE ) { // ATE: Give them a chance to fall down... - if ( pSoldier->bLife > 0 && pSoldier->bLife < ( OKLIFE - 1 ) ) + if ( this->stats.bLife > 0 && this->stats.bLife < ( OKLIFE - 1 ) ) { // Are we taking damage from bleeding? if ( ubReason == TAKE_DAMAGE_BLOODLOSS ) { // Fifty-fifty chance to die now! - if ( Random( 2 ) == 0 || gTacticalStatus.Team[ pSoldier->bTeam ].bMenInSector == 1 ) + if ( Random( 2 ) == 0 || gTacticalStatus.Team[ this->bTeam ].bMenInSector == 1 ) { // Kill! - pSoldier->bLife = 0; + this->stats.bLife = 0; } } else { // OK, see how far we are.. - if ( pSoldier->bLife < ( OKLIFE - 3 ) ) + if ( this->stats.bLife < ( OKLIFE - 3 ) ) { // Kill! - pSoldier->bLife = 0; + this->stats.bLife = 0; } } } @@ -7544,38 +8350,38 @@ UINT8 SoldierTakeDamage( SOLDIERTYPE *pSoldier, INT8 bHeight, INT16 sLifeDeduct, if ( fShowDamage ) { - pSoldier->sDamage += sLifeDeduct; + this->sDamage += sLifeDeduct; } // Truncate life - if ( pSoldier->bLife < 0 ) + if ( this->stats.bLife < 0 ) { - pSoldier->bLife = 0; + this->stats.bLife = 0; } // Calculate damage to our items if from an explosion! if ( ubReason == TAKE_DAMAGE_EXPLOSION || ubReason == TAKE_DAMAGE_STRUCTURE_EXPLOSION) { - CheckEquipmentForDamage( pSoldier, sLifeDeduct ); + CheckEquipmentForDamage( this, sLifeDeduct ); } // Calculate bleeding - if ( ubReason != TAKE_DAMAGE_GAS && !AM_A_ROBOT( pSoldier ) ) + if ( ubReason != TAKE_DAMAGE_GAS && !AM_A_ROBOT( this ) ) { if ( ubReason == TAKE_DAMAGE_HANDTOHAND ) { if ( sLifeDeduct > 0 ) { // HTH does 1 pt bleeding per hit - pSoldier->bBleeding = pSoldier->bBleeding + 1; + this->bBleeding = this->bBleeding + 1; } } else { - pSoldier->bBleeding = pSoldier->bLifeMax - ( pSoldier->bLife + bBandage ); + this->bBleeding = this->stats.bLifeMax - ( this->stats.bLife + bBandage ); } } @@ -7584,23 +8390,23 @@ UINT8 SoldierTakeDamage( SOLDIERTYPE *pSoldier, INT8 bHeight, INT16 sLifeDeduct, sAPCost = (sLifeDeduct / AP_GET_WOUNDED_DIVISOR); // + fallCost; // ATE: if the robot, do not deduct - if ( !AM_A_ROBOT( pSoldier ) ) + if ( !AM_A_ROBOT( this ) ) { - DeductPoints( pSoldier, sAPCost, sBreathLoss , FALSE); + DeductPoints( this, sAPCost, sBreathLoss , FALSE); } ubCombinedLoss = (UINT8) sLifeDeduct / 10 + sBreathLoss / 2000; // Add shock - if ( !AM_A_ROBOT( pSoldier ) ) + if ( !AM_A_ROBOT( this ) ) { - pSoldier->bShock += ubCombinedLoss; + this->aiData.bShock += ubCombinedLoss; } // start the stopwatch - the blood is gushing! - pSoldier->dNextBleed = CalcSoldierNextBleed( pSoldier ); + this->dNextBleed = CalcSoldierNextBleed( this ); - if ( pSoldier->bInSector && pSoldier->bVisible != -1 ) + if ( this->bInSector && this->bVisible != -1 ) { // If we are already dead, don't show damage! if ( bOldLife != 0 && fShowDamage && sLifeDeduct != 0 && sLifeDeduct < 1000 ) @@ -7609,34 +8415,34 @@ UINT8 SoldierTakeDamage( SOLDIERTYPE *pSoldier, INT8 bHeight, INT16 sLifeDeduct, INT16 sOffsetX, sOffsetY; // Set Damage display counter - pSoldier->fDisplayDamage = TRUE; - pSoldier->bDisplayDamageCount = 0; + this->flags.fDisplayDamage = TRUE; + this->bDisplayDamageCount = 0; - if ( pSoldier->ubBodyType == QUEENMONSTER ) + if ( this->ubBodyType == QUEENMONSTER ) { - pSoldier->sDamageX = 0; - pSoldier->sDamageY = 0; + this->sDamageX = 0; + this->sDamageY = 0; } else { - GetSoldierAnimOffsets( pSoldier, &sOffsetX, &sOffsetY ); - pSoldier->sDamageX = sOffsetX; - pSoldier->sDamageY = sOffsetY; + GetSoldierAnimOffsets( this, &sOffsetX, &sOffsetY ); + this->sDamageX = sOffsetX; + this->sDamageY = sOffsetY; } } } // OK, if here, let's see if we should drop our weapon.... - if ( ubReason != TAKE_DAMAGE_BLOODLOSS && !(AM_A_ROBOT( pSoldier )) ) + if ( ubReason != TAKE_DAMAGE_BLOODLOSS && !(AM_A_ROBOT( this )) ) { INT16 sTestOne, sTestTwo, sChanceToDrop; INT8 bVisible = -1; - sTestOne = EffectiveStrength( pSoldier ); + sTestOne = EffectiveStrength( this ); sTestTwo = ( 2 * ( __max( sLifeDeduct, ( sBreathLoss / 100 ) ) ) ); - if (pSoldier->ubAttackerID != NOBODY && MercPtrs[ pSoldier->ubAttackerID ]->ubBodyType == BLOODCAT ) + if (this->ubAttackerID != NOBODY && MercPtrs[ this->ubAttackerID ]->ubBodyType == BLOODCAT ) { // bloodcat boost, let them make people drop items more sTestTwo += 20; @@ -7646,7 +8452,7 @@ UINT8 SoldierTakeDamage( SOLDIERTYPE *pSoldier, INT8 bHeight, INT16 sLifeDeduct, sChanceToDrop = ( __max( 0, ( sTestTwo - sTestOne ) ) ); // ATE: Increase odds of NOT dropping an UNDROPPABLE OBJECT - if ( ( pSoldier->inv[ HANDPOS ].fFlags & OBJECT_UNDROPPABLE ) ) + if ( ( this->inv[ HANDPOS ].fFlags & OBJECT_UNDROPPABLE ) ) { sChanceToDrop -= 30; } @@ -7658,24 +8464,24 @@ UINT8 SoldierTakeDamage( SOLDIERTYPE *pSoldier, INT8 bHeight, INT16 sLifeDeduct, if ( Random( 100 ) < (UINT16) sChanceToDrop ) { // OK, drop item in main hand... - if ( pSoldier->inv[ HANDPOS ].usItem != NOTHING ) + if ( this->inv[ HANDPOS ].exists() == true ) { - if ( !( pSoldier->inv[ HANDPOS ].fFlags & OBJECT_UNDROPPABLE ) ) + if ( !( this->inv[ HANDPOS ].fFlags & OBJECT_UNDROPPABLE ) ) { // ATE: if our guy, make visible.... - if ( pSoldier->bTeam == gbPlayerNum ) + if ( this->bTeam == gbPlayerNum ) { bVisible = 1; } //if this soldier was an enemy // Kaiden Added for UB reveal All items after combat feature! - else if( pSoldier->bTeam == ENEMY_TEAM ) + else if( this->bTeam == ENEMY_TEAM ) { //add a flag to the item so when all enemies are killed, we can run through and reveal all the enemies items usItemFlags |= WORLD_ITEM_DROPPED_FROM_ENEMY; } - AddItemToPool( pSoldier->sGridNo, &(pSoldier->inv[ HANDPOS ]), bVisible, pSoldier->bLevel, usItemFlags, -1 ); //Madd: added usItemFlags to function arguments - DeleteObj( &(pSoldier->inv[HANDPOS]) ); + AddItemToPool( this->sGridNo, &(this->inv[ HANDPOS ]), bVisible, this->pathing.bLevel, usItemFlags, -1 ); //Madd: added usItemFlags to function arguments + DeleteObj( &(this->inv[HANDPOS]) ); } } } @@ -7689,41 +8495,41 @@ UINT8 SoldierTakeDamage( SOLDIERTYPE *pSoldier, INT8 bHeight, INT16 sLifeDeduct, ubBlood = MAXBLOODQUANTITY; } - if ( !( pSoldier->uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_ROBOT ) ) ) + if ( !( this->flags.uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_ROBOT ) ) ) { if ( ubBlood != 0 ) { - if ( pSoldier->bInSector ) + if ( this->bInSector ) { - DropBlood( pSoldier, ubBlood, pSoldier->bVisible ); + DropBlood( this, ubBlood, this->bVisible ); } } } //Set UI Flag for unconscious, if it's our own guy! - if ( pSoldier->bTeam == gbPlayerNum ) + if ( this->bTeam == gbPlayerNum ) { - if ( pSoldier->bLife < OKLIFE && pSoldier->bLife > 0 && bOldLife >= OKLIFE ) + if ( this->stats.bLife < OKLIFE && this->stats.bLife > 0 && bOldLife >= OKLIFE ) { - pSoldier->fUIFirstTimeUNCON = TRUE; + this->flags.fUIFirstTimeUNCON = TRUE; fInterfacePanelDirty = DIRTYLEVEL2; } } - if ( pSoldier->bInSector ) + if ( this->bInSector ) { - CheckForBreathCollapse( pSoldier ); + this->CheckForBreathCollapse( ); } // EXPERIENCE CLASS GAIN (combLoss): Getting wounded in battle - DirtyMercPanelInterface( pSoldier, DIRTYLEVEL1 ); + DirtyMercPanelInterface( this, DIRTYLEVEL1 ); if ( ubAttacker != NOBODY ) { // don't give exp for hitting friends! - if ( (MercPtrs[ ubAttacker ]->bTeam == gbPlayerNum) && (pSoldier->bTeam != gbPlayerNum) ) + if ( (MercPtrs[ ubAttacker ]->bTeam == gbPlayerNum) && (this->bTeam != gbPlayerNum) ) { if ( ubReason == TAKE_DAMAGE_EXPLOSION ) { @@ -7741,52 +8547,53 @@ UINT8 SoldierTakeDamage( SOLDIERTYPE *pSoldier, INT8 bHeight, INT16 sLifeDeduct, } + SOLDIERTYPE *pSoldier = this; if (PTR_OURTEAM) { // EXPERIENCE GAIN: Took some damage - StatChange( pSoldier, EXPERAMT, ( UINT16 )( 5 * ubCombinedLoss ), FROM_FAILURE ); + StatChange( this, EXPERAMT, ( UINT16 )( 5 * ubCombinedLoss ), FROM_FAILURE ); // Check for quote - if ( !(pSoldier->usQuoteSaidFlags & SOLDIER_QUOTE_SAID_BEING_PUMMELED ) ) + if ( !(this->usQuoteSaidFlags & SOLDIER_QUOTE_SAID_BEING_PUMMELED ) ) { // Check attacker! - if ( ubAttacker != NOBODY && ubAttacker != pSoldier->ubID ) + if ( ubAttacker != NOBODY && ubAttacker != this->ubID ) { - pSoldier->bNumHitsThisTurn++; + this->bNumHitsThisTurn++; - if ( (pSoldier->bNumHitsThisTurn >= 3) && ( pSoldier->bLife - pSoldier->bOldLife > 20 ) ) + if ( (this->bNumHitsThisTurn >= 3) && ( this->stats.bLife - this->bOldLife > 20 ) ) { - if ( Random(100) < (UINT16)((40 * ( pSoldier->bNumHitsThisTurn - 2)))) + if ( Random(100) < (UINT16)((40 * ( this->bNumHitsThisTurn - 2)))) { - DelayedTacticalCharacterDialogue( pSoldier, QUOTE_TAKEN_A_BREATING ); - pSoldier->usQuoteSaidFlags |= SOLDIER_QUOTE_SAID_BEING_PUMMELED; - pSoldier->bNumHitsThisTurn = 0; + DelayedTacticalCharacterDialogue( this, QUOTE_TAKEN_A_BREATING ); + this->usQuoteSaidFlags |= SOLDIER_QUOTE_SAID_BEING_PUMMELED; + this->bNumHitsThisTurn = 0; } } } } } - if ((ubAttacker != NOBODY) && (Menptr[ubAttacker].bTeam == OUR_TEAM) && (pSoldier->ubProfile != NO_PROFILE) && (pSoldier->ubProfile >= FIRST_RPC && pSoldier->ubProfile < GASTON )) + if ((ubAttacker != NOBODY) && (Menptr[ubAttacker].bTeam == OUR_TEAM) && (this->ubProfile != NO_PROFILE) && (this->ubProfile >= FIRST_RPC && this->ubProfile < GASTON )) { - gMercProfiles[pSoldier->ubProfile].ubMiscFlags |= PROFILE_MISC_FLAG_WOUNDEDBYPLAYER; - if (pSoldier->ubProfile == 114) + gMercProfiles[this->ubProfile].ubMiscFlags |= PROFILE_MISC_FLAG_WOUNDEDBYPLAYER; + if (this->ubProfile == 114) { SetFactTrue( FACT_PACOS_KILLED ); } } - HandleTakeDamageDeath( pSoldier, bOldLife, ubReason ); + HandleTakeDamageDeath( this, bOldLife, ubReason ); // Check if we are < unconscious, and shutup if so! also wipe sight - if ( pSoldier->bLife < CONSCIOUSNESS ) + if ( this->stats.bLife < CONSCIOUSNESS ) { - ShutupaYoFace( pSoldier->iFaceIndex ); + ShutupaYoFace( this->iFaceIndex ); } - if ( pSoldier->bLife < OKLIFE ) + if ( this->stats.bLife < OKLIFE ) { - DecayIndividualOpplist( pSoldier ); + DecayIndividualOpplist( this ); } @@ -7797,8 +8604,10 @@ UINT8 SoldierTakeDamage( SOLDIERTYPE *pSoldier, INT8 bHeight, INT16 sLifeDeduct, extern BOOLEAN IsMercSayingDialogue( UINT8 ubProfileID ); -BOOLEAN InternalDoMercBattleSound( SOLDIERTYPE *pSoldier, UINT8 ubBattleSoundID, INT8 bSpecialCode ) +BOOLEAN SOLDIERTYPE::InternalDoMercBattleSound( UINT8 ubBattleSoundID, INT8 bSpecialCode ) { + //in this function, pSoldier stands in for the this pointer, since + //this soldier could be a vehicle, then the merc that makes the sound is inside SGPFILENAME zFilename; SOUNDPARMS spParms; UINT8 ubSoundID; @@ -7807,14 +8616,15 @@ BOOLEAN InternalDoMercBattleSound( SOLDIERTYPE *pSoldier, UINT8 ubBattleSoundID, BOOLEAN fDoSub = FALSE; INT32 uiSubSoundID = 0; BOOLEAN fSpeechSound = FALSE; + SOLDIERTYPE* pSoldier = this; // DOUBLECHECK RANGE CHECKF ( ubBattleSoundID < NUM_MERC_BATTLE_SOUNDS ); - if ( ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( ( this->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { // Pick a passenger from vehicle.... - pSoldier = PickRandomPassengerFromVehicle( pSoldier ); + pSoldier = PickRandomPassengerFromVehicle( this ); if ( pSoldier == NULL ) { @@ -7826,7 +8636,7 @@ BOOLEAN InternalDoMercBattleSound( SOLDIERTYPE *pSoldier, UINT8 ubBattleSoundID, // If a death sound, and we have already done ours... if ( ubBattleSoundID == BATTLE_SOUND_DIE1 ) { - if ( pSoldier->fDieSoundUsed ) + if ( pSoldier->flags.fDieSoundUsed ) { return( TRUE ); } @@ -7834,7 +8644,7 @@ BOOLEAN InternalDoMercBattleSound( SOLDIERTYPE *pSoldier, UINT8 ubBattleSoundID, // Are we mute? - if ( pSoldier->uiStatusFlags & SOLDIER_MUTE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_MUTE ) { return( FALSE ); } @@ -7949,7 +8759,7 @@ BOOLEAN InternalDoMercBattleSound( SOLDIERTYPE *pSoldier, UINT8 ubBattleSoundID, fDoSub = TRUE; uiSubSoundID = (UINT32)( EXPLOSION_1 ); - PlayJA2Sample( ROBOT_DEATH, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); + PlayJA2Sample( ROBOT_DEATH, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); break; } @@ -7973,11 +8783,11 @@ BOOLEAN InternalDoMercBattleSound( SOLDIERTYPE *pSoldier, UINT8 ubBattleSoundID, { if( guiCurrentScreen != GAME_SCREEN ) { - PlayJA2Sample( uiSubSoundID, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); + PlayJA2Sample( uiSubSoundID, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); } else { - PlayJA2Sample( uiSubSoundID, RATE_11025, SoundVolume( (UINT8)CalculateSpeechVolume( HIGHVOLUME ), pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( uiSubSoundID, RATE_11025, SoundVolume( (UINT8)CalculateSpeechVolume( HIGHVOLUME ), pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } return( TRUE ); } @@ -8032,11 +8842,11 @@ BOOLEAN InternalDoMercBattleSound( SOLDIERTYPE *pSoldier, UINT8 ubBattleSoundID, // Adjust based on morale... - if ( ubBattleSoundID == BATTLE_SOUND_OK1 && pSoldier->bMorale < LOW_MORALE_BATTLE_SND_THREASHOLD ) + if ( ubBattleSoundID == BATTLE_SOUND_OK1 && pSoldier->aiData.bMorale < LOW_MORALE_BATTLE_SND_THREASHOLD ) { ubBattleSoundID = BATTLE_SOUND_LOWMARALE_OK1; } - if ( ubBattleSoundID == BATTLE_SOUND_ATTN1 && pSoldier->bMorale < LOW_MORALE_BATTLE_SND_THREASHOLD ) + if ( ubBattleSoundID == BATTLE_SOUND_ATTN1 && pSoldier->aiData.bMorale < LOW_MORALE_BATTLE_SND_THREASHOLD ) { ubBattleSoundID = BATTLE_SOUND_LOWMARALE_ATTN1; } @@ -8189,22 +8999,22 @@ BOOLEAN InternalDoMercBattleSound( SOLDIERTYPE *pSoldier, UINT8 ubBattleSoundID, } } -BOOLEAN DoMercBattleSound( SOLDIERTYPE *pSoldier, UINT8 ubBattleSoundID ) +BOOLEAN SOLDIERTYPE::DoMercBattleSound( UINT8 ubBattleSoundID ) { // We WANT to play some RIGHT AWAY..... - if ( gBattleSndsData[ ubBattleSoundID ].fStopDialogue == 1 || ( pSoldier->ubProfile == NO_PROFILE ) || InOverheadMap( ) ) + if ( gBattleSndsData[ ubBattleSoundID ].fStopDialogue == 1 || ( this->ubProfile == NO_PROFILE ) || InOverheadMap( ) ) { - return( InternalDoMercBattleSound( pSoldier, ubBattleSoundID, 0 ) ); + return( this->InternalDoMercBattleSound( ubBattleSoundID, 0 ) ); } // So here, only if we were currently saying dialogue..... - if ( !IsMercSayingDialogue( pSoldier->ubProfile ) ) + if ( !IsMercSayingDialogue( this->ubProfile ) ) { - return( InternalDoMercBattleSound( pSoldier, ubBattleSoundID, 0 ) ); + return( this->InternalDoMercBattleSound( ubBattleSoundID, 0 ) ); } // OK, queue it up otherwise! - TacticalCharacterDialogueWithSpecialEvent( pSoldier, 0, DIALOGUE_SPECIAL_EVENT_DO_BATTLE_SND, ubBattleSoundID,0 ); + TacticalCharacterDialogueWithSpecialEvent( this, 0, DIALOGUE_SPECIAL_EVENT_DO_BATTLE_SND, ubBattleSoundID,0 ); return( TRUE ); } @@ -8254,7 +9064,7 @@ BOOLEAN PreloadSoldierBattleSounds( SOLDIERTYPE *pSoldier, BOOLEAN fRemove ) -BOOLEAN CheckSoldierHitRoof( SOLDIERTYPE *pSoldier ) +BOOLEAN SOLDIERTYPE::CheckSoldierHitRoof( void ) { // Check if we are near a lower level INT8 bNewDirection; @@ -8263,38 +9073,38 @@ BOOLEAN CheckSoldierHitRoof( SOLDIERTYPE *pSoldier ) // Default to true BOOLEAN fDoForwards = TRUE; - if ( pSoldier->bLife >= OKLIFE ) + if ( this->stats.bLife >= OKLIFE ) { return( FALSE ); } - if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) && ( pSoldier->bLevel > 0 ) ) + if ( FindLowerLevel( this, this->sGridNo, this->ubDirection, &bNewDirection ) && ( this->pathing.bLevel > 0 ) ) { // ONly if standing! - if ( gAnimControl[ pSoldier->usAnimState ].ubHeight == ANIM_STAND ) + if ( gAnimControl[ this->usAnimState ].ubHeight == ANIM_STAND ) { // We are near a lower level. // Use opposite direction bNewDirection = gOppositeDirection[ bNewDirection ]; // Alrighty, let's not blindly change here, look at whether the dest gridno is good! - sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( gOppositeDirection[ bNewDirection ] ) ); - if ( !NewOKDestination( pSoldier, sNewGridNo, TRUE, 0 ) ) + sNewGridNo = NewGridNo( (INT16)this->sGridNo, DirectionInc( gOppositeDirection[ bNewDirection ] ) ); + if ( !NewOKDestination( this, sNewGridNo, TRUE, 0 ) ) { return( FALSE ); } - sNewGridNo = NewGridNo( (UINT16)sNewGridNo, DirectionInc( gOppositeDirection[ bNewDirection ] ) ); - if ( !NewOKDestination( pSoldier, sNewGridNo, TRUE, 0 ) ) + sNewGridNo = NewGridNo( (INT16)sNewGridNo, DirectionInc( gOppositeDirection[ bNewDirection ] ) ); + if ( !NewOKDestination( this, sNewGridNo, TRUE, 0 ) ) { return( FALSE ); } // Are wee near enough to fall forwards.... - if ( pSoldier->ubDirection == gOneCDirection[ bNewDirection ] || - pSoldier->ubDirection == gTwoCDirection[ bNewDirection ] || - pSoldier->ubDirection == bNewDirection || - pSoldier->ubDirection == gOneCCDirection[ bNewDirection ] || - pSoldier->ubDirection == gTwoCCDirection[ bNewDirection ] ) + if ( this->ubDirection == gOneCDirection[ bNewDirection ] || + this->ubDirection == gTwoCDirection[ bNewDirection ] || + this->ubDirection == bNewDirection || + this->ubDirection == gOneCCDirection[ bNewDirection ] || + this->ubDirection == gTwoCCDirection[ bNewDirection ] ) { // Do backwards... fDoForwards = FALSE; @@ -8304,15 +9114,15 @@ BOOLEAN CheckSoldierHitRoof( SOLDIERTYPE *pSoldier ) // ATE: Make this more usefull... if ( fDoForwards ) { - pSoldier->sTempNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (INT16)( -1 * DirectionInc(bNewDirection ) ) ); - pSoldier->sTempNewGridNo = NewGridNo( (UINT16)pSoldier->sTempNewGridNo, (INT16)( -1 * DirectionInc( bNewDirection ) ) ); - EVENT_SetSoldierDesiredDirection( pSoldier, gOppositeDirection[ bNewDirection ] ); - pSoldier->fTurningUntilDone = TRUE; - pSoldier->usPendingAnimation = FALLFORWARD_ROOF; - //EVENT_InitNewSoldierAnim( pSoldier, FALLFORWARD_ROOF, 0 , FALSE ); + this->sTempNewGridNo = NewGridNo( (INT16)this->sGridNo, (INT16)( -1 * DirectionInc(bNewDirection ) ) ); + this->sTempNewGridNo = NewGridNo( (INT16)this->sTempNewGridNo, (INT16)( -1 * DirectionInc( bNewDirection ) ) ); + this->EVENT_SetSoldierDesiredDirection( gOppositeDirection[ bNewDirection ] ); + this->flags.fTurningUntilDone = TRUE; + this->usPendingAnimation = FALLFORWARD_ROOF; + //this->EVENT_InitNewSoldierAnim( FALLFORWARD_ROOF, 0 , FALSE ); // Deduct hitpoints/breath for falling! - SoldierTakeDamage( pSoldier, ANIM_CROUCH, 100, 5000, TAKE_DAMAGE_FALLROOF, NOBODY, NOWHERE, 0, TRUE ); + this->SoldierTakeDamage( ANIM_CROUCH, 100, 5000, TAKE_DAMAGE_FALLROOF, NOBODY, NOWHERE, 0, TRUE ); fReturnVal = TRUE; @@ -8320,14 +9130,14 @@ BOOLEAN CheckSoldierHitRoof( SOLDIERTYPE *pSoldier ) else { - pSoldier->sTempNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (INT16)( -1 * DirectionInc( bNewDirection ) ) ); - pSoldier->sTempNewGridNo = NewGridNo( (UINT16)pSoldier->sTempNewGridNo, (INT16)( -1 * DirectionInc( bNewDirection ) ) ); - EVENT_SetSoldierDesiredDirection( pSoldier, bNewDirection ); - pSoldier->fTurningUntilDone = TRUE; - pSoldier->usPendingAnimation = FALLOFF; + this->sTempNewGridNo = NewGridNo( (INT16)this->sGridNo, (INT16)( -1 * DirectionInc( bNewDirection ) ) ); + this->sTempNewGridNo = NewGridNo( (INT16)this->sTempNewGridNo, (INT16)( -1 * DirectionInc( bNewDirection ) ) ); + this->EVENT_SetSoldierDesiredDirection( bNewDirection ); + this->flags.fTurningUntilDone = TRUE; + this->usPendingAnimation = FALLOFF; // Deduct hitpoints/breath for falling! - SoldierTakeDamage( pSoldier, ANIM_CROUCH, 100, 5000, TAKE_DAMAGE_FALLROOF, NOBODY, NOWHERE, 0, TRUE ); + this->SoldierTakeDamage( ANIM_CROUCH, 100, 5000, TAKE_DAMAGE_FALLROOF, NOBODY, NOWHERE, 0, TRUE ); fReturnVal = TRUE; } @@ -8337,43 +9147,43 @@ BOOLEAN CheckSoldierHitRoof( SOLDIERTYPE *pSoldier ) return( fReturnVal ); } -void BeginSoldierClimbDownRoof( SOLDIERTYPE *pSoldier ) +void SOLDIERTYPE::BeginSoldierClimbDownRoof( void ) { INT8 bNewDirection; UINT8 ubWhoIsThere; - if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) && ( pSoldier->bLevel > 0 ) ) + if ( FindLowerLevel( this, this->sGridNo, this->ubDirection, &bNewDirection ) && ( this->pathing.bLevel > 0 ) ) { - if ( EnoughPoints( pSoldier, GetAPsToClimbRoof( pSoldier, TRUE ), 0, TRUE ) ) + if ( EnoughPoints( this, GetAPsToClimbRoof( this, TRUE ), 0, TRUE ) ) { //Kaiden: Helps if we look where we are going before we try to climb on top of someone - ubWhoIsThere = WhoIsThere2( NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc(bNewDirection ) ), 0 ); - if ( ubWhoIsThere != NOBODY && ubWhoIsThere != pSoldier->ubID ) - { - return; - } + ubWhoIsThere = WhoIsThere2( NewGridNo( (INT16)this->sGridNo, (UINT16)DirectionInc(bNewDirection ) ), 0 ); + if ( ubWhoIsThere != NOBODY && ubWhoIsThere != this->ubID ) + { + return; + } else - { + { - if (pSoldier->bTeam == gbPlayerNum) - { - // OK, SET INTERFACE FIRST - SetUIBusy( pSoldier->ubID ); - } + if (this->bTeam == gbPlayerNum) + { + // OK, SET INTERFACE FIRST + SetUIBusy( this->ubID ); + } - pSoldier->sTempNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc(bNewDirection ) ); + this->sTempNewGridNo = NewGridNo( (INT16)this->sGridNo, (UINT16)DirectionInc(bNewDirection ) ); - bNewDirection = gTwoCDirection[ bNewDirection ]; + bNewDirection = gTwoCDirection[ bNewDirection ]; - pSoldier->ubPendingDirection = bNewDirection; - EVENT_InitNewSoldierAnim( pSoldier, CLIMBDOWNROOF, 0 , FALSE ); + this->ubPendingDirection = bNewDirection; + this->EVENT_InitNewSoldierAnim( CLIMBDOWNROOF, 0 , FALSE ); - InternalReceivingSoldierCancelServices( pSoldier, FALSE ); - InternalGivingSoldierCancelServices( pSoldier, FALSE ); + this->InternalReceivingSoldierCancelServices( FALSE ); + this->InternalGivingSoldierCancelServices( FALSE ); } } @@ -8387,7 +9197,7 @@ INT8 bNewDirection; UINT8 ubWhoIsThere; -if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) && ( pSoldier->bLevel > 0 ) ) +if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) && ( pSoldier->pathing.bLevel > 0 ) ) { if ( EnoughPoints( pSoldier, GetAPsToClimbRoof( pSoldier, TRUE ), 0, TRUE ) ) { @@ -8400,15 +9210,15 @@ SetUIBusy( pSoldier->ubID ); -pSoldier->sTempNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc(bNewDirection ) ); +pSoldier->sTempNewGridNo = NewGridNo( (INT16)pSoldier->sGridNo, (UINT16)DirectionInc(bNewDirection ) ); bNewDirection = gTwoCDirection[ bNewDirection ]; pSoldier->ubPendingDirection = bNewDirection; -EVENT_InitNewSoldierAnim( pSoldier, CLIMBDOWNROOF, 0 , FALSE ); +pSoldier->EVENT_InitNewSoldierAnim( CLIMBDOWNROOF, 0 , FALSE ); -InternalReceivingSoldierCancelServices( pSoldier, FALSE ); -InternalGivingSoldierCancelServices( pSoldier, FALSE ); +InternalpSoldier->ReceivingSoldierCancelServices(, FALSE ); +InternalpSoldier->GivingSoldierCancelServices(, FALSE ); } } @@ -8418,7 +9228,7 @@ InternalGivingSoldierCancelServices( pSoldier, FALSE ); -void MoveMerc( SOLDIERTYPE *pSoldier, FLOAT dMovementChange, FLOAT dAngle, BOOLEAN fCheckRange ) +void SOLDIERTYPE::MoveMerc( FLOAT dMovementChange, FLOAT dAngle, BOOLEAN fCheckRange ) { //INT16 dDegAngle; FLOAT dDeltaPos; @@ -8426,26 +9236,26 @@ void MoveMerc( SOLDIERTYPE *pSoldier, FLOAT dMovementChange, FLOAT dAngle, BOOLE BOOLEAN fStop = FALSE; - //dDegAngle = (INT16)( dAngle * 180 / PI ); + //dDegAngle = (INT16)( dAngle * 180 / PI ); //sprintf( gDebugStr, "Move Angle: %d", (int)dDegAngle ); // Find delta Movement for X pos dDeltaPos = (FLOAT) (dMovementChange * sin( dAngle )); // Find new position - dXPos = pSoldier->dXPos + dDeltaPos; + dXPos = this->dXPos + dDeltaPos; if ( fCheckRange ) { fStop = FALSE; - switch( pSoldier->bMovementDirection ) + switch( this->bMovementDirection ) { case NORTHEAST: case EAST: case SOUTHEAST: - if ( dXPos >= pSoldier->sDestXPos ) + if ( dXPos >= this->pathing.sDestXPos ) { fStop = TRUE; } @@ -8455,7 +9265,7 @@ void MoveMerc( SOLDIERTYPE *pSoldier, FLOAT dMovementChange, FLOAT dAngle, BOOLE case WEST: case SOUTHWEST: - if ( dXPos <= pSoldier->sDestXPos ) + if ( dXPos <= this->pathing.sDestXPos ) { fStop = TRUE; } @@ -8469,14 +9279,14 @@ void MoveMerc( SOLDIERTYPE *pSoldier, FLOAT dMovementChange, FLOAT dAngle, BOOLE } - if ( fStop ) + if ( fStop ) { - //dXPos = pSoldier->sDestXPos; - pSoldier->fPastXDest = TRUE; + //dXPos = this->pathing.sDestXPos; + this->flags.fPastXDest = TRUE; - if ( pSoldier->sGridNo == pSoldier->sFinalDestination ) + if ( this->sGridNo == this->pathing.sFinalDestination ) { - dXPos = pSoldier->sDestXPos; + dXPos = this->pathing.sDestXPos; } } } @@ -8485,19 +9295,19 @@ void MoveMerc( SOLDIERTYPE *pSoldier, FLOAT dMovementChange, FLOAT dAngle, BOOLE dDeltaPos = (FLOAT) (dMovementChange * cos( dAngle )); // Find new pos - dYPos = pSoldier->dYPos + dDeltaPos; + dYPos = this->dYPos + dDeltaPos; if ( fCheckRange ) { fStop = FALSE; - switch( pSoldier->bMovementDirection ) + switch( this->bMovementDirection ) { case NORTH: case NORTHEAST: case NORTHWEST: - if ( dYPos <= pSoldier->sDestYPos ) + if ( dYPos <= this->pathing.sDestYPos ) { fStop = TRUE; } @@ -8507,7 +9317,7 @@ void MoveMerc( SOLDIERTYPE *pSoldier, FLOAT dMovementChange, FLOAT dAngle, BOOLE case SOUTHWEST: case SOUTHEAST: - if ( dYPos >= pSoldier->sDestYPos ) + if ( dYPos >= this->pathing.sDestYPos ) { fStop = TRUE; } @@ -8521,20 +9331,20 @@ void MoveMerc( SOLDIERTYPE *pSoldier, FLOAT dMovementChange, FLOAT dAngle, BOOLE } - if ( fStop ) + if ( fStop ) { - //dYPos = pSoldier->sDestYPos; - pSoldier->fPastYDest = TRUE; + //dYPos = this->pathing.sDestYPos; + this->flags.fPastYDest = TRUE; - if ( pSoldier->sGridNo == pSoldier->sFinalDestination ) + if ( this->sGridNo == this->pathing.sFinalDestination ) { - dYPos = pSoldier->sDestYPos; + dYPos = this->pathing.sDestYPos; } } } // OK, set new position - EVENT_InternalSetSoldierPosition( pSoldier, dXPos, dYPos, FALSE, FALSE, FALSE ); + this->EVENT_InternalSetSoldierPosition( dXPos, dYPos, FALSE, FALSE, FALSE ); // DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("X: %f Y: %f", dXPos, dYPos ) ); @@ -8610,7 +9420,7 @@ UINT8 atan8( INT16 sXPos, INT16 sYPos, INT16 sXPos2, INT16 sYPos2 ) angle = atan2( test_x, test_y ); - //dDegAngle = (INT16)( angle * 180 / PI ); + //dDegAngle = (INT16)( angle * 180 / PI ); //sprintf( gDebugStr, "Move Angle: %d", (int)dDegAngle ); do @@ -8749,7 +9559,7 @@ void CheckForFullStructures( SOLDIERTYPE *pSoldier ) { if ( pSoldier->usFrontArcFullTileList[ cnt ] != 0 ) { - RemoveTopmost( pSoldier->usFrontArcFullTileGridNos[ cnt ], pSoldier->usFrontArcFullTileList[ cnt ] ); + RemoveTopmost( pSoldier->usFrontArcFullTileGridNos[ cnt ], pSoldier->usFrontArcFullTileList[ cnt ] ); } pSoldier->usFrontArcFullTileList[ cnt ] = 0; pSoldier->usFrontArcFullTileGridNos[ cnt ] = 0; @@ -8839,7 +9649,7 @@ BOOLEAN FullStructAlone( INT16 sGridNo, UINT8 ubRadius ) iNewIndex = sGridNo + ( WORLD_COLS * cnt1 ) + cnt2; - if ( iNewIndex >=0 && iNewIndex < WORLD_MAX && + if ( iNewIndex >=0 && iNewIndex < WORLD_MAX && iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) ) { if ( iNewIndex != sGridNo ) @@ -8863,9 +9673,9 @@ void AdjustForFastTurnAnimation( SOLDIERTYPE *pSoldier ) // CHECK FOR FASTTURN ANIMATIONS // ATE: Mod: Only fastturn for OUR guys! - if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FASTTURN && pSoldier->bTeam == gbPlayerNum && !( pSoldier->uiStatusFlags & SOLDIER_TURNINGFROMHIT ) ) + if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FASTTURN && pSoldier->bTeam == gbPlayerNum && !( pSoldier->flags.uiStatusFlags & SOLDIER_TURNINGFROMHIT ) ) { - if ( pSoldier->ubDirection != pSoldier->bDesiredDirection ) + if ( pSoldier->ubDirection != pSoldier->pathing.bDesiredDirection ) { pSoldier->sAniDelay = FAST_TURN_ANIM_SPEED; } @@ -8878,9 +9688,9 @@ void AdjustForFastTurnAnimation( SOLDIERTYPE *pSoldier ) } -BOOLEAN IsActionInterruptable( SOLDIERTYPE *pSoldier ) +BOOLEAN SOLDIERTYPE::IsActionInterruptable( void ) { - if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_NONINTERRUPT ) + if ( gAnimControl[ this->usAnimState ].uiFlags & ANIM_NONINTERRUPT ) { return( FALSE ); } @@ -8894,7 +9704,7 @@ void SendSoldierPositionEvent( SOLDIERTYPE *pSoldier, FLOAT dNewXPos, FLOAT dNew EV_S_SETPOSITION SSetPosition; SSetPosition.usSoldierID = pSoldier->ubID; - SSetPosition.uiUniqueId = pSoldier -> uiUniqueSoldierIdValue; + SSetPosition.uiUniqueId = pSoldier->uiUniqueSoldierIdValue; SSetPosition.dNewXPos = dNewXPos; SSetPosition.dNewYPos = dNewYPos; @@ -8910,7 +9720,7 @@ void SendSoldierDestinationEvent( SOLDIERTYPE *pSoldier, UINT16 usNewDestination SChangeDest.usSoldierID = pSoldier->ubID; SChangeDest.usNewDestination = usNewDestination; - SChangeDest.uiUniqueId = pSoldier -> uiUniqueSoldierIdValue; + SChangeDest.uiUniqueId = pSoldier->uiUniqueSoldierIdValue; AddGameEvent( S_CHANGEDEST, 0, &SChangeDest ); @@ -8923,7 +9733,7 @@ void SendSoldierSetDirectionEvent( SOLDIERTYPE *pSoldier, UINT16 usNewDirection SSetDirection.usSoldierID = pSoldier->ubID; SSetDirection.usNewDirection = usNewDirection; - SSetDirection.uiUniqueId = pSoldier -> uiUniqueSoldierIdValue; + SSetDirection.uiUniqueId = pSoldier->uiUniqueSoldierIdValue; AddGameEvent( S_SETDIRECTION, 0, &SSetDirection ); @@ -8936,20 +9746,20 @@ void SendSoldierSetDesiredDirectionEvent( SOLDIERTYPE *pSoldier, UINT16 usDesire SSetDesiredDirection.usSoldierID = pSoldier->ubID; SSetDesiredDirection.usDesiredDirection = usDesiredDirection; - SSetDesiredDirection.uiUniqueId = pSoldier -> uiUniqueSoldierIdValue; + SSetDesiredDirection.uiUniqueId = pSoldier->uiUniqueSoldierIdValue; AddGameEvent( S_SETDESIREDDIRECTION, 0, &SSetDesiredDirection ); } -void SendGetNewSoldierPathEvent( SOLDIERTYPE *pSoldier, UINT16 sDestGridNo, UINT16 usMovementAnim ) +void SendGetNewSoldierPathEvent( SOLDIERTYPE *pSoldier, INT16 sDestGridNo, UINT16 usMovementAnim ) { EV_S_GETNEWPATH SGetNewPath; SGetNewPath.usSoldierID = pSoldier->ubID; SGetNewPath.sDestGridNo = sDestGridNo; SGetNewPath.usMovementAnim = usMovementAnim; - SGetNewPath.uiUniqueId = pSoldier -> uiUniqueSoldierIdValue; + SGetNewPath.uiUniqueId = pSoldier->uiUniqueSoldierIdValue; AddGameEvent( S_GETNEWPATH, 0, &SGetNewPath ); } @@ -8969,12 +9779,12 @@ void SendChangeSoldierStanceEvent( SOLDIERTYPE *pSoldier, UINT8 ubNewStance ) SChangeStance.usSoldierID = pSoldier->ubID; SChangeStance.sXPos = pSoldier->sX; SChangeStance.sYPos = pSoldier->sY; - SChangeStance.uiUniqueId = pSoldier -> uiUniqueSoldierIdValue; + SChangeStance.uiUniqueId = pSoldier->uiUniqueSoldierIdValue; AddGameEvent( S_CHANGESTANCE, 0, &SChangeStance ); #endif - ChangeSoldierStance( pSoldier, ubNewStance ); + pSoldier->ChangeSoldierStance( ubNewStance ); } @@ -8987,9 +9797,9 @@ void SendBeginFireWeaponEvent( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ) SBeginFireWeapon.sTargetGridNo = sTargetGridNo; SBeginFireWeapon.bTargetLevel = pSoldier->bTargetLevel; SBeginFireWeapon.bTargetCubeLevel = pSoldier->bTargetCubeLevel; - SBeginFireWeapon.uiUniqueId = pSoldier -> uiUniqueSoldierIdValue; + SBeginFireWeapon.uiUniqueId = pSoldier->uiUniqueSoldierIdValue; - AddGameEvent( S_BEGINFIREWEAPON, 0, &SBeginFireWeapon ); + AddGameEvent( S_BEGINFIREWEAPON, 0, &SBeginFireWeapon ); } @@ -9030,7 +9840,7 @@ void ReleaseSoldiersAttacker( SOLDIERTYPE *pSoldier ) // ATE: Set to NOBODY if this person is NOT dead // otherise, we keep it so the kill can be awarded! - if ( pSoldier->bLife != 0 && pSoldier->ubBodyType != QUEENMONSTER ) + if ( pSoldier->stats.bLife != 0 && pSoldier->ubBodyType != QUEENMONSTER ) { pSoldier->ubAttackerID = NOBODY; } @@ -9039,10 +9849,10 @@ void ReleaseSoldiersAttacker( SOLDIERTYPE *pSoldier ) } #endif -BOOLEAN MercInWater( SOLDIERTYPE *pSoldier ) +BOOLEAN SOLDIERTYPE::MercInWater( void ) { // Our water texture , for now is of a given type - if ( TERRAIN_IS_WATER( pSoldier->bOverTerrainType)) + if ( TERRAIN_IS_WATER( this->bOverTerrainType)) { return( TRUE ); } @@ -9052,10 +9862,10 @@ BOOLEAN MercInWater( SOLDIERTYPE *pSoldier ) } } -BOOLEAN MercInShallowWater( SOLDIERTYPE *pSoldier ) +BOOLEAN SOLDIERTYPE::MercInShallowWater( void ) { // Our water texture , for now is of a given type - if ( TERRAIN_IS_SHALLOW_WATER( pSoldier->bOverTerrainType)) + if ( TERRAIN_IS_SHALLOW_WATER( this->bOverTerrainType)) { return( TRUE ); } @@ -9066,10 +9876,10 @@ BOOLEAN MercInShallowWater( SOLDIERTYPE *pSoldier ) } -BOOLEAN MercInDeepWater( SOLDIERTYPE *pSoldier ) +BOOLEAN SOLDIERTYPE::MercInDeepWater( void ) { // Our water texture , for now is of a given type - if ( TERRAIN_IS_DEEP_WATER( pSoldier->bOverTerrainType)) + if ( TERRAIN_IS_DEEP_WATER( this->bOverTerrainType)) { return( TRUE ); } @@ -9079,10 +9889,10 @@ BOOLEAN MercInDeepWater( SOLDIERTYPE *pSoldier ) } } -BOOLEAN MercInHighWater( SOLDIERTYPE *pSoldier ) +BOOLEAN SOLDIERTYPE::MercInHighWater( void ) { // Our water texture , for now is of a given type - if ( TERRAIN_IS_HIGH_WATER( pSoldier->bOverTerrainType)) + if ( TERRAIN_IS_HIGH_WATER( this->bOverTerrainType)) { return( TRUE ); } @@ -9102,10 +9912,10 @@ void RevivePlayerTeam( ) // End the turn of player charactors cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) - { - ReviveSoldier( pSoldier ); + { + pSoldier->ReviveSoldier( ); } } @@ -9113,34 +9923,34 @@ void RevivePlayerTeam( ) // What? A zombie function? -void ReviveSoldier( SOLDIERTYPE *pSoldier ) +void SOLDIERTYPE::ReviveSoldier( void ) { INT16 sX, sY; - if ( pSoldier->bLife < OKLIFE && pSoldier->bActive ) + if ( this->stats.bLife < OKLIFE && this->bActive ) { // If dead or unconscious, revive! - pSoldier->uiStatusFlags &= ( ~SOLDIER_DEAD ); + this->flags.uiStatusFlags &= ( ~SOLDIER_DEAD ); - pSoldier->bLife = pSoldier->bLifeMax; - pSoldier->bBleeding = 0; - pSoldier->ubDesiredHeight = ANIM_STAND; + this->stats.bLife = this->stats.bLifeMax; + this->bBleeding = 0; + this->ubDesiredHeight = ANIM_STAND; - AddManToTeam( pSoldier->bTeam ); + AddManToTeam( this->bTeam ); // Set to standing - pSoldier->fInNonintAnim = FALSE; - pSoldier->fRTInNonintAnim = FALSE; + this->flags.fInNonintAnim = FALSE; + this->flags.fRTInNonintAnim = FALSE; // Change to standing,unless we can getup with an animation - EVENT_InitNewSoldierAnim( pSoldier, STANDING, 0, TRUE ); - BeginSoldierGetup( pSoldier ); + this->EVENT_InitNewSoldierAnim( STANDING, 0, TRUE ); + this->BeginSoldierGetup( ); // Makesure center of tile - sX = CenterX( pSoldier->sGridNo ); - sY = CenterY( pSoldier->sGridNo ); + sX = CenterX( this->sGridNo ); + sY = CenterY( this->sGridNo ); - EVENT_SetSoldierPosition( pSoldier, (FLOAT) sX, (FLOAT) sY ); + this->EVENT_SetSoldierPosition( (FLOAT) sX, (FLOAT) sY ); // Dirty INterface fInterfacePanelDirty = DIRTYLEVEL2; @@ -9150,7 +9960,7 @@ void ReviveSoldier( SOLDIERTYPE *pSoldier ) } -void HandleAnimationProfile( SOLDIERTYPE *pSoldier, UINT16 usAnimState, BOOLEAN fRemove ) +void SOLDIERTYPE::HandleAnimationProfile( UINT16 usAnimState, BOOLEAN fRemove ) { //#if 0 ANIM_PROF *pProfile; @@ -9164,7 +9974,7 @@ void HandleAnimationProfile( SOLDIERTYPE *pSoldier, UINT16 usAnimState, BOOLEAN // ATE // Get Surface Index - usAnimSurface = DetermineSoldierAnimationSurface( pSoldier, usAnimState ); + usAnimSurface = DetermineSoldierAnimationSurface( this, usAnimState ); CHECKV( usAnimSurface != INVALID_ANIMATION_SURFACE ); @@ -9177,27 +9987,27 @@ void HandleAnimationProfile( SOLDIERTYPE *pSoldier, UINT16 usAnimState, BOOLEAN pProfile = &(gpAnimProfiles[ bProfileID ] ); // Get direction - pProfileDir = &( pProfile->Dirs[ pSoldier->ubDirection ] ); + pProfileDir = &( pProfile->Dirs[ this->ubDirection ] ); // Loop tiles and set accordingly into world for( iTileCount = 0; iTileCount < pProfileDir->ubNumTiles; iTileCount++ ) { pProfileTile = &( pProfileDir->pTiles[ iTileCount ] ); - sGridNo = pSoldier->sGridNo + ( ( WORLD_COLS * pProfileTile->bTileY ) + pProfileTile->bTileX ); + sGridNo = this->sGridNo + ( ( WORLD_COLS * pProfileTile->bTileY ) + pProfileTile->bTileX ); // Check if in bounds - if ( !OutOfBounds( pSoldier->sGridNo, sGridNo ) ) + if ( !OutOfBounds( this->sGridNo, sGridNo ) ) { if ( fRemove ) { // Remove from world - RemoveMerc( sGridNo, pSoldier, TRUE ); + RemoveMerc( sGridNo, this, TRUE ); } else { // PLace into world - AddMercToHead( sGridNo, pSoldier, FALSE ); + AddMercToHead( sGridNo, this, FALSE ); //if ( pProfileTile->bTileY != 0 || pProfileTile->bTileX != 0 ) { gpWorldLevelData[sGridNo].pMercHead->uiFlags |= LEVELNODE_MERCPLACEHOLDER; @@ -9214,7 +10024,7 @@ void HandleAnimationProfile( SOLDIERTYPE *pSoldier, UINT16 usAnimState, BOOLEAN } -LEVELNODE *GetAnimProfileFlags( UINT16 sGridNo, UINT16 *usFlags, SOLDIERTYPE **ppTargSoldier, LEVELNODE *pGivenNode ) +LEVELNODE *GetAnimProfileFlags( INT16 sGridNo, UINT16 *usFlags, SOLDIERTYPE **ppTargSoldier, LEVELNODE *pGivenNode ) { LEVELNODE *pNode; @@ -9248,7 +10058,7 @@ LEVELNODE *GetAnimProfileFlags( UINT16 sGridNo, UINT16 *usFlags, SOLDIERTYPE **p } -BOOLEAN GetProfileFlagsFromGridno( SOLDIERTYPE *pSoldier, UINT16 usAnimState, UINT16 sTestGridNo, UINT16 *usFlags ) +BOOLEAN SOLDIERTYPE::GetProfileFlagsFromGridno( UINT16 usAnimState, UINT16 sTestGridNo, UINT16 *usFlags ) { ANIM_PROF *pProfile; ANIM_PROF_DIR *pProfileDir; @@ -9259,7 +10069,7 @@ BOOLEAN GetProfileFlagsFromGridno( SOLDIERTYPE *pSoldier, UINT16 usAnimState, UI UINT16 usAnimSurface; // Get Surface Index - usAnimSurface = DetermineSoldierAnimationSurface( pSoldier, usAnimState ); + usAnimSurface = DetermineSoldierAnimationSurface( this, usAnimState ); CHECKF( usAnimSurface != INVALID_ANIMATION_SURFACE ); @@ -9274,17 +10084,17 @@ BOOLEAN GetProfileFlagsFromGridno( SOLDIERTYPE *pSoldier, UINT16 usAnimState, UI pProfile = &(gpAnimProfiles[ bProfileID ] ); // Get direction - pProfileDir = &( pProfile->Dirs[ pSoldier->ubDirection ] ); + pProfileDir = &( pProfile->Dirs[ this->ubDirection ] ); // Loop tiles and set accordingly into world for( iTileCount = 0; iTileCount < pProfileDir->ubNumTiles; iTileCount++ ) { pProfileTile = &( pProfileDir->pTiles[ iTileCount ] ); - sGridNo = pSoldier->sGridNo + ( ( WORLD_COLS * pProfileTile->bTileY ) + pProfileTile->bTileX ); + sGridNo = this->sGridNo + ( ( WORLD_COLS * pProfileTile->bTileY ) + pProfileTile->bTileX ); // Check if in bounds - if ( !OutOfBounds( pSoldier->sGridNo, sGridNo ) ) + if ( !OutOfBounds( this->sGridNo, sGridNo ) ) { if ( sGridNo == sTestGridNo ) { @@ -9300,99 +10110,98 @@ BOOLEAN GetProfileFlagsFromGridno( SOLDIERTYPE *pSoldier, UINT16 usAnimState, UI } -void EVENT_SoldierBeginGiveItem( SOLDIERTYPE *pSoldier ) +void SOLDIERTYPE::EVENT_SoldierBeginGiveItem( void ) { - SOLDIERTYPE *pTSoldier; + SOLDIERTYPE *pTSoldier; - if ( VerifyGiveItem( pSoldier, &pTSoldier ) ) + if ( VerifyGiveItem( this, &pTSoldier ) ) { // CHANGE DIRECTION AND GOTO ANIMATION NOW - pSoldier->bDesiredDirection = pSoldier->bPendingActionData3; - pSoldier->ubDirection = pSoldier->bPendingActionData3; + this->pathing.bDesiredDirection = this->aiData.bPendingActionData3; + this->ubDirection = this->aiData.bPendingActionData3; // begin animation - EVENT_InitNewSoldierAnim( pSoldier, GIVE_ITEM, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( GIVE_ITEM, 0 , FALSE ); } else { - UnSetEngagedInConvFromPCAction( pSoldier ); + UnSetEngagedInConvFromPCAction( this ); - MemFree( pSoldier->pTempObject ); + OBJECTTYPE::DeleteMe( &this->pTempObject ); } } -void EVENT_SoldierBeginBladeAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection ) +void SOLDIERTYPE::EVENT_SoldierBeginBladeAttack( INT16 sGridNo, UINT8 ubDirection ) { SOLDIERTYPE *pTSoldier; //UINT32 uiMercFlags; UINT16 usSoldierIndex; UINT8 ubTDirection; - BOOLEAN fChangeDirection = FALSE; ROTTING_CORPSE *pCorpse; // Increment the number of people busy doing stuff because of an attack //if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) ) //{ - // gTacticalStatus.ubAttackBusyCount++; +// gTacticalStatus.ubAttackBusyCount++; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Begin blade attack: ATB %d", gTacticalStatus.ubAttackBusyCount) ); DebugAttackBusy( String( "Begin blade attack: ATB %d\n", gTacticalStatus.ubAttackBusyCount) ); //} // CHANGE DIRECTION AND GOTO ANIMATION NOW - EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection ); - EVENT_SetSoldierDirection( pSoldier, ubDirection ); + this->EVENT_SetSoldierDesiredDirection( ubDirection ); + this->EVENT_SetSoldierDirection( ubDirection ); // CHANGE TO ANIMATION - // DETERMINE ANIMATION TO PLAY + // DETERMINE ANIMATION TO PLAY // LATER BASED ON IF TAREGT KNOWS OF US, STANCE, ETC // GET POINTER TO TAREGT - if (pSoldier->uiStatusFlags & SOLDIER_MONSTER) + if (this->flags.uiStatusFlags & SOLDIER_MONSTER) { UINT8 ubTargetID; // Is there an unconscious guy at gridno...... - ubTargetID = WhoIsThere2( sGridNo, pSoldier->bTargetLevel ); + ubTargetID = WhoIsThere2( sGridNo, this->bTargetLevel ); - if ( ubTargetID != NOBODY && ( ( MercPtrs[ ubTargetID ]->bLife < OKLIFE && MercPtrs[ ubTargetID ]->bLife > 0 ) || ( MercPtrs[ ubTargetID ]->bBreath < OKBREATH && MercPtrs[ ubTargetID ]->bCollapsed ) ) ) + if ( ubTargetID != NOBODY && ( ( MercPtrs[ ubTargetID ]->stats.bLife < OKLIFE && MercPtrs[ ubTargetID ]->stats.bLife > 0 ) || ( MercPtrs[ ubTargetID ]->bBreath < OKBREATH && MercPtrs[ ubTargetID ]->bCollapsed ) ) ) { - pSoldier->uiPendingActionData4 = ubTargetID; + this->aiData.uiPendingActionData4 = ubTargetID; // add regen bonus - pSoldier->bRegenerationCounter++; - EVENT_InitNewSoldierAnim( pSoldier, MONSTER_BEGIN_EATTING_FLESH, 0, FALSE ); + this->bRegenerationCounter++; + this->EVENT_InitNewSoldierAnim( MONSTER_BEGIN_EATTING_FLESH, 0, FALSE ); } else { - if ( PythSpacesAway( pSoldier->sGridNo, sGridNo ) <= 1 ) + if ( PythSpacesAway( this->sGridNo, sGridNo ) <= 1 ) { - EVENT_InitNewSoldierAnim( pSoldier, MONSTER_CLOSE_ATTACK, 0, FALSE ); + this->EVENT_InitNewSoldierAnim( MONSTER_CLOSE_ATTACK, 0, FALSE ); } else { - EVENT_InitNewSoldierAnim( pSoldier, ADULTMONSTER_ATTACKING, 0, FALSE ); + this->EVENT_InitNewSoldierAnim( ADULTMONSTER_ATTACKING, 0, FALSE ); } } } - else if (pSoldier->ubBodyType == BLOODCAT) + else if (this->ubBodyType == BLOODCAT) { // Check if it's a claws or teeth... - if ( pSoldier->inv[ HANDPOS ].usItem == BLOODCAT_CLAW_ATTACK ) + if ( this->inv[ HANDPOS ].usItem == BLOODCAT_CLAW_ATTACK ) { - EVENT_InitNewSoldierAnim( pSoldier, BLOODCAT_SWIPE, 0, FALSE ); + this->EVENT_InitNewSoldierAnim( BLOODCAT_SWIPE, 0, FALSE ); } else { - EVENT_InitNewSoldierAnim( pSoldier, BLOODCAT_BITE_ANIM, 0, FALSE ); + this->EVENT_InitNewSoldierAnim( BLOODCAT_BITE_ANIM, 0, FALSE ); } } else { - usSoldierIndex = WhoIsThere2( sGridNo, pSoldier->bTargetLevel ); + usSoldierIndex = WhoIsThere2( sGridNo, this->bTargetLevel ); if ( usSoldierIndex != NOBODY ) - { - GetSoldier( &pTSoldier, usSoldierIndex ); + { + GetSoldier( &pTSoldier, usSoldierIndex ); // Look at stance of target switch( gAnimControl[ pTSoldier->usAnimState ].ubEndHeight ) @@ -9401,37 +10210,37 @@ void EVENT_SoldierBeginBladeAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 case ANIM_CROUCH: // CHECK IF HE CAN SEE US, IF SO RANDOMIZE - if ( pTSoldier->bOppList[ pSoldier->ubID ] == 0 && pTSoldier->bTeam != pSoldier->bTeam ) + if ( pTSoldier->aiData.bOppList[ this->ubID ] == 0 && pTSoldier->bTeam != this->bTeam ) { // WE ARE NOT SEEN - EVENT_InitNewSoldierAnim( pSoldier, STAB, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( STAB, 0 , FALSE ); } else { // WE ARE SEEN if ( Random( 50 ) > 25 ) { - EVENT_InitNewSoldierAnim( pSoldier, STAB, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( STAB, 0 , FALSE ); } else { - EVENT_InitNewSoldierAnim( pSoldier, SLICE, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( SLICE, 0 , FALSE ); } // IF WE ARE SEEN, MAKE SURE GUY TURNS! // Get direction to target // IF WE ARE AN ANIMAL, CAR, MONSTER, DONT'T TURN - if ( !( pTSoldier->uiStatusFlags & ( SOLDIER_MONSTER | SOLDIER_ANIMAL | SOLDIER_VEHICLE ) ) ) + if ( !( pTSoldier->flags.uiStatusFlags & ( SOLDIER_MONSTER | SOLDIER_ANIMAL | SOLDIER_VEHICLE ) ) ) { // OK, stop merc.... - EVENT_StopMerc( pTSoldier, pTSoldier->sGridNo, pTSoldier->ubDirection ); + pTSoldier->EVENT_StopMerc( pTSoldier->sGridNo, pTSoldier->ubDirection ); if ( pTSoldier->bTeam != gbPlayerNum ) { CancelAIAction( pTSoldier, TRUE ); } - ubTDirection = (UINT8)GetDirectionFromGridNo( pSoldier->sGridNo, pTSoldier ); + ubTDirection = (UINT8)GetDirectionFromGridNo( this->sGridNo, pTSoldier ); SendSoldierSetDesiredDirectionEvent( pTSoldier, ubTDirection ); } } @@ -9441,17 +10250,17 @@ void EVENT_SoldierBeginBladeAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 case ANIM_PRONE: // CHECK OUR STANCE - if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_CROUCH ) + if ( gAnimControl[ this->usAnimState ].ubEndHeight != ANIM_CROUCH ) { // SET DESIRED STANCE AND SET PENDING ANIMATION - SendChangeSoldierStanceEvent( pSoldier, ANIM_CROUCH ); - pSoldier->usPendingAnimation = CROUCH_STAB; + SendChangeSoldierStanceEvent( this, ANIM_CROUCH ); + this->usPendingAnimation = CROUCH_STAB; } else { // USE crouched one // NEED TO CHANGE STANCE IF NOT CROUCHD! - EVENT_InitNewSoldierAnim( pSoldier, CROUCH_STAB, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( CROUCH_STAB, 0 , FALSE ); } break; } @@ -9459,28 +10268,28 @@ void EVENT_SoldierBeginBladeAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 else { // OK, SEE IF THERE IS AN OBSTACLE HERE... - if ( !NewOKDestination( pSoldier, sGridNo, FALSE, pSoldier->bLevel ) ) + if ( !NewOKDestination( this, sGridNo, FALSE, this->pathing.bLevel ) ) { - EVENT_InitNewSoldierAnim( pSoldier, STAB, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( STAB, 0 , FALSE ); } else { // Check for corpse! - pCorpse = GetCorpseAtGridNo( sGridNo, pSoldier->bLevel ); + pCorpse = GetCorpseAtGridNo( sGridNo, this->pathing.bLevel ); if ( pCorpse == NULL ) { - EVENT_InitNewSoldierAnim( pSoldier, CROUCH_STAB, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( CROUCH_STAB, 0 , FALSE ); } else { if ( IsValidDecapitationCorpse( pCorpse ) ) { - EVENT_InitNewSoldierAnim( pSoldier, DECAPITATE, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( DECAPITATE, 0 , FALSE ); } else { - EVENT_InitNewSoldierAnim( pSoldier, CROUCH_STAB, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( CROUCH_STAB, 0 , FALSE ); } } } @@ -9488,13 +10297,13 @@ void EVENT_SoldierBeginBladeAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 } // SET TARGET GRIDNO - pSoldier->sTargetGridNo = sGridNo; - pSoldier->bTargetLevel = pSoldier->bLevel; - pSoldier->ubTargetID = WhoIsThere2( sGridNo, pSoldier->bTargetLevel ); + this->sTargetGridNo = sGridNo; + this->bTargetLevel = this->pathing.bLevel; + this->ubTargetID = WhoIsThere2( sGridNo, this->bTargetLevel ); } -void EVENT_SoldierBeginPunchAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection ) +void SOLDIERTYPE::EVENT_SoldierBeginPunchAttack( INT16 sGridNo, UINT8 ubDirection ) { BOOLEAN fMartialArtist = FALSE; SOLDIERTYPE *pTSoldier; @@ -9505,23 +10314,23 @@ void EVENT_SoldierBeginPunchAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 UINT16 usItem; // Get item in hand... - usItem = pSoldier->inv[ HANDPOS ].usItem; + usItem = this->inv[ HANDPOS ].usItem; // Increment the number of people busy doing stuff because of an attack //if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) ) //{ - // gTacticalStatus.ubAttackBusyCount++; +// gTacticalStatus.ubAttackBusyCount++; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Begin HTH attack: ATB %d", gTacticalStatus.ubAttackBusyCount) ); DebugAttackBusy( String( "Begin HTH attack: ATB %d\n", gTacticalStatus.ubAttackBusyCount) ); //} // get target..... - usSoldierIndex = WhoIsThere2( pSoldier->sTargetGridNo, pSoldier->bLevel ); + usSoldierIndex = WhoIsThere2( this->sTargetGridNo, this->pathing.bLevel ); if ( usSoldierIndex != NOBODY ) - { - GetSoldier( &pTSoldier, usSoldierIndex ); + { + GetSoldier( &pTSoldier, usSoldierIndex ); fChangeDirection = TRUE; } @@ -9533,12 +10342,12 @@ void EVENT_SoldierBeginPunchAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 if ( fChangeDirection ) { // CHANGE DIRECTION AND GOTO ANIMATION NOW - EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection ); - EVENT_SetSoldierDirection( pSoldier, ubDirection ); + this->EVENT_SetSoldierDesiredDirection( ubDirection ); + this->EVENT_SetSoldierDirection( ubDirection ); } // Are we a martial artist? - if ( HAS_SKILL_TRAIT( pSoldier, MARTIALARTS ) ) + if ( HAS_SKILL_TRAIT( this, MARTIALARTS ) ) { fMartialArtist = TRUE; } @@ -9547,13 +10356,13 @@ void EVENT_SoldierBeginPunchAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 if ( fMartialArtist && !AreInMeanwhile( ) && !Item[usItem].crowbar ) { // Are we in attack mode yet? - if ( pSoldier->usAnimState != NINJA_BREATH && gAnimControl[ pSoldier->usAnimState ].ubHeight == ANIM_STAND && gAnimControl[ pTSoldier->usAnimState ].ubHeight != ANIM_PRONE ) + if ( this->usAnimState != NINJA_BREATH && gAnimControl[ this->usAnimState ].ubHeight == ANIM_STAND && gAnimControl[ pTSoldier->usAnimState ].ubHeight != ANIM_PRONE ) { - EVENT_InitNewSoldierAnim( pSoldier, NINJA_GOTOBREATH, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( NINJA_GOTOBREATH, 0 , FALSE ); } else { - DoNinjaAttack( pSoldier ); + this->DoNinjaAttack( ); } } else @@ -9566,29 +10375,29 @@ void EVENT_SoldierBeginPunchAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 if ( !Item[usItem].crowbar ) { - EVENT_InitNewSoldierAnim( pSoldier, PUNCH, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( PUNCH, 0 , FALSE ); } else { - EVENT_InitNewSoldierAnim( pSoldier, CROWBAR_ATTACK, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( CROWBAR_ATTACK, 0 , FALSE ); } // CHECK IF HE CAN SEE US, IF SO CHANGE DIR - if ( pTSoldier->bOppList[ pSoldier->ubID ] == 0 && pTSoldier->bTeam != pSoldier->bTeam ) + if ( pTSoldier->aiData.bOppList[ this->ubID ] == 0 && pTSoldier->bTeam != this->bTeam ) { // Get direction to target // IF WE ARE AN ANIMAL, CAR, MONSTER, DONT'T TURN - if ( !( pTSoldier->uiStatusFlags & ( SOLDIER_MONSTER | SOLDIER_ANIMAL | SOLDIER_VEHICLE ) ) ) + if ( !( pTSoldier->flags.uiStatusFlags & ( SOLDIER_MONSTER | SOLDIER_ANIMAL | SOLDIER_VEHICLE ) ) ) { // OK, stop merc.... - EVENT_StopMerc( pTSoldier, pTSoldier->sGridNo, pTSoldier->ubDirection ); + pTSoldier->EVENT_StopMerc( pTSoldier->sGridNo, pTSoldier->ubDirection ); if ( pTSoldier->bTeam != gbPlayerNum ) { CancelAIAction( pTSoldier, TRUE ); } - ubTDirection = (UINT8)GetDirectionFromGridNo( pSoldier->sGridNo, pTSoldier ); + ubTDirection = (UINT8)GetDirectionFromGridNo( this->sGridNo, pTSoldier ); SendSoldierSetDesiredDirectionEvent( pTSoldier, ubTDirection ); } } @@ -9598,23 +10407,23 @@ void EVENT_SoldierBeginPunchAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 // CHECK OUR STANCE // ATE: Added this for CIV body types 'cause of elliot - if ( !IS_MERC_BODY_TYPE( pSoldier ) ) + if ( !IS_MERC_BODY_TYPE( this ) ) { - EVENT_InitNewSoldierAnim( pSoldier, PUNCH, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( PUNCH, 0 , FALSE ); } else { - if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_CROUCH ) + if ( gAnimControl[ this->usAnimState ].ubEndHeight != ANIM_CROUCH ) { // SET DESIRED STANCE AND SET PENDING ANIMATION - SendChangeSoldierStanceEvent( pSoldier, ANIM_CROUCH ); - pSoldier->usPendingAnimation = PUNCH_LOW; + SendChangeSoldierStanceEvent( this, ANIM_CROUCH ); + this->usPendingAnimation = PUNCH_LOW; } else { // USE crouched one // NEED TO CHANGE STANCE IF NOT CROUCHD! - EVENT_InitNewSoldierAnim( pSoldier, PUNCH_LOW, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( PUNCH_LOW, 0 , FALSE ); } } break; @@ -9622,90 +10431,90 @@ void EVENT_SoldierBeginPunchAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 } // SET TARGET GRIDNO - pSoldier->sTargetGridNo = sGridNo; - pSoldier->bTargetLevel = pSoldier->bLevel; - pSoldier->sLastTarget = sGridNo; - pSoldier->ubTargetID = WhoIsThere2( sGridNo, pSoldier->bTargetLevel ); + this->sTargetGridNo = sGridNo; + this->bTargetLevel = this->pathing.bLevel; + this->sLastTarget = sGridNo; + this->ubTargetID = WhoIsThere2( sGridNo, this->bTargetLevel ); } -void EVENT_SoldierBeginKnifeThrowAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection ) +void SOLDIERTYPE::EVENT_SoldierBeginKnifeThrowAttack( INT16 sGridNo, UINT8 ubDirection ) { // Increment the number of people busy doing stuff because of an attack //if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) ) //{ - // gTacticalStatus.ubAttackBusyCount++; +// gTacticalStatus.ubAttackBusyCount++; //} - // pSoldier->bBulletsLeft = 1; - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("!!!!!!! Starting knifethrow attack, bullets left %d", pSoldier->bBulletsLeft) ); +// this->bBulletsLeft = 1; + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("!!!!!!! Starting knifethrow attack, bullets left %d", this->bBulletsLeft) ); DebugAttackBusy( String( "Begin knife throwing attack: ATB %d\n", gTacticalStatus.ubAttackBusyCount) ); - EVENT_InitNewSoldierAnim( pSoldier, THROW_KNIFE, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( THROW_KNIFE, 0 , FALSE ); // CHANGE DIRECTION AND GOTO ANIMATION NOW - EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection ); - EVENT_SetSoldierDirection( pSoldier, ubDirection ); + this->EVENT_SetSoldierDesiredDirection( ubDirection ); + this->EVENT_SetSoldierDirection( ubDirection ); // SET TARGET GRIDNO - pSoldier->sTargetGridNo = sGridNo; - pSoldier->sLastTarget = sGridNo; - pSoldier->bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; + this->sTargetGridNo = sGridNo; + this->sLastTarget = sGridNo; + this->flags.bTurningFromPronePosition = 0; // NB target level must be set by functions outside of here... but I think it // is already set in HandleItem or in the AI code - CJC - pSoldier->ubTargetID = WhoIsThere2( sGridNo, pSoldier->bTargetLevel ); + this->ubTargetID = WhoIsThere2( sGridNo, this->bTargetLevel ); } -void EVENT_SoldierBeginDropBomb( SOLDIERTYPE *pSoldier ) +void SOLDIERTYPE::EVENT_SoldierBeginDropBomb( void ) { // Increment the number of people busy doing stuff because of an attack - switch( gAnimControl[ pSoldier->usAnimState ].ubHeight ) + switch( gAnimControl[ this->usAnimState ].ubHeight ) { case ANIM_STAND: - EVENT_InitNewSoldierAnim( pSoldier, PLANT_BOMB, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( PLANT_BOMB, 0 , FALSE ); break; default: // Call hander for planting bomb... - HandleSoldierDropBomb( pSoldier, pSoldier->sPendingActionData2 ); - SoldierGotoStationaryStance( pSoldier ); + HandleSoldierDropBomb( this, this->aiData.sPendingActionData2 ); + this->SoldierGotoStationaryStance( ); break; } } -void EVENT_SoldierBeginUseDetonator( SOLDIERTYPE *pSoldier ) +void SOLDIERTYPE::EVENT_SoldierBeginUseDetonator( void ) { // Increment the number of people busy doing stuff because of an attack - switch( gAnimControl[ pSoldier->usAnimState ].ubHeight ) + switch( gAnimControl[ this->usAnimState ].ubHeight ) { case ANIM_STAND: - EVENT_InitNewSoldierAnim( pSoldier, USE_REMOTE, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( USE_REMOTE, 0 , FALSE ); break; default: // Call hander for planting bomb... - HandleSoldierUseRemote( pSoldier, pSoldier->sPendingActionData2 ); + HandleSoldierUseRemote( this, this->aiData.sPendingActionData2 ); break; } } -void EVENT_SoldierBeginFirstAid( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection ) +void SOLDIERTYPE::EVENT_SoldierBeginFirstAid( INT16 sGridNo, UINT8 ubDirection ) { SOLDIERTYPE *pTSoldier; //UINT32 uiMercFlags; UINT16 usSoldierIndex; BOOLEAN fRefused = FALSE; - usSoldierIndex = WhoIsThere2( sGridNo, pSoldier->bLevel ); + usSoldierIndex = WhoIsThere2( sGridNo, this->pathing.bLevel ); if ( usSoldierIndex != NOBODY ) - { + { pTSoldier = MercPtrs[ usSoldierIndex ]; // OK, check if we should play quote... @@ -9724,7 +10533,7 @@ void EVENT_SoldierBeginFirstAid( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubD fRefused = TRUE; ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, Message[ STR_REFUSE_FIRSTAID_FOR_CREATURE ] ); } - else if ( !pTSoldier->bNeutral && pTSoldier->bLife >= OKLIFE && pTSoldier->bSide != pSoldier->bSide ) + else if ( !pTSoldier->aiData.bNeutral && pTSoldier->stats.bLife >= OKLIFE && pTSoldier->bSide != this->bSide ) { fRefused = TRUE; ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, Message[ STR_REFUSE_FIRSTAID ] ); @@ -9735,79 +10544,79 @@ void EVENT_SoldierBeginFirstAid( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubD if ( fRefused ) { - UnSetUIBusy( pSoldier->ubID ); + UnSetUIBusy( this->ubID ); return; } // ATE: We can only give firsty aid to one perosn at a time... cancel // any now... - InternalGivingSoldierCancelServices( pSoldier, FALSE ); + this->InternalGivingSoldierCancelServices( FALSE ); // CHANGE DIRECTION AND GOTO ANIMATION NOW - EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection ); - EVENT_SetSoldierDirection( pSoldier, ubDirection ); + this->EVENT_SetSoldierDesiredDirection( ubDirection ); + this->EVENT_SetSoldierDirection( ubDirection ); // CHECK OUR STANCE AND GOTO CROUCH IF NEEDED - //if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_CROUCH ) + //if ( gAnimControl[ this->usAnimState ].ubEndHeight != ANIM_CROUCH ) //{ // SET DESIRED STANCE AND SET PENDING ANIMATION - // SendChangeSoldierStanceEvent( pSoldier, ANIM_CROUCH ); - // pSoldier->usPendingAnimation = START_AID; + // SendChangeSoldierStanceEvent( this, ANIM_CROUCH ); + // this->usPendingAnimation = START_AID; //} //else { // CHANGE TO ANIMATION - EVENT_InitNewSoldierAnim( pSoldier, START_AID, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( START_AID, 0 , FALSE ); } // SET TARGET GRIDNO - pSoldier->sTargetGridNo = sGridNo; + this->sTargetGridNo = sGridNo; // SET PARTNER ID - pSoldier->ubServicePartner = (UINT8)usSoldierIndex; + this->ubServicePartner = (UINT8)usSoldierIndex; // SET PARTNER'S COUNT REFERENCE pTSoldier->ubServiceCount++; // If target and doer are no the same guy... - if ( pTSoldier->ubID != pSoldier->ubID && !pTSoldier->bCollapsed ) + if ( pTSoldier->ubID != this->ubID && !pTSoldier->bCollapsed ) { - SoldierGotoStationaryStance( pTSoldier ); + pTSoldier->SoldierGotoStationaryStance( ); } } } -void EVENT_SoldierEnterVehicle( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection ) +void SOLDIERTYPE::EVENT_SoldierEnterVehicle( INT16 sGridNo, UINT8 ubDirection ) { SOLDIERTYPE *pTSoldier; UINT32 uiMercFlags; UINT16 usSoldierIndex; if ( FindSoldier( sGridNo, &usSoldierIndex, &uiMercFlags, FIND_SOLDIER_GRIDNO ) ) - { + { pTSoldier = MercPtrs[ usSoldierIndex ]; // Enter vehicle... - EnterVehicle( pTSoldier, pSoldier ); + EnterVehicle( pTSoldier, this ); } - UnSetUIBusy( pSoldier->ubID ); + UnSetUIBusy( this->ubID ); } -UINT32 SoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, INT16 sKitPts, INT16 sStatus ) +UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT16 sStatus ) { UINT32 uiDressSkill, uiPossible, uiActual, uiMedcost, uiDeficiency, uiAvailAPs, uiUsedAPs; UINT8 ubBelowOKlife, ubPtsLeft; BOOLEAN fRanOut = FALSE; - if (pVictim->bBleeding < 1 && pVictim->bLife >= OKLIFE ) + if (pVictim->bBleeding < 1 && pVictim->stats.bLife >= OKLIFE ) { return(0); // nothing to do, shouldn't have even been called! } - if ( pVictim->bLife == 0 ) + if ( pVictim->stats.bLife == 0 ) { return(0); } @@ -9819,19 +10628,19 @@ UINT32 SoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, INT16 sKi } // calculate wound-dressing skill (3x medical, 2x equip, 1x level, 1x dex) - uiDressSkill = ( ( 3 * EffectiveMedical( pSoldier ) ) + // medical knowledge + uiDressSkill = ( ( 3 * EffectiveMedical( this ) ) + // medical knowledge ( 2 * sStatus) + // state of medical kit - (10 * EffectiveExpLevel( pSoldier ) ) + // battle injury experience - EffectiveDexterity( pSoldier ) ) / 7; // general "handiness" + (10 * EffectiveExpLevel( this ) ) + // battle injury experience + EffectiveDexterity( this ) ) / 7; // general "handiness" // try to use every AP that the merc has left - uiAvailAPs = pSoldier->bActionPoints; + uiAvailAPs = this->bActionPoints; // OK, If we are in real-time, use another value... if (!(gTacticalStatus.uiFlags & TURNBASED) || !(gTacticalStatus.uiFlags & INCOMBAT ) ) { // Set to a value which looks good based on our tactical turns duration - uiAvailAPs = RT_FIRST_AID_GAIN_MODIFIER; + uiAvailAPs = RT_FIRST_AID_GAIN_MODIFIER; } // calculate how much bandaging CAN be done this turn @@ -9842,7 +10651,7 @@ UINT32 SoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, INT16 sKi return(0); - if (Item[pSoldier->inv[ HANDPOS ].usItem].medicalkit ) // using the GOOD medic stuff + if (Item[this->inv[ HANDPOS ].usItem].medicalkit ) // using the GOOD medic stuff { uiPossible += ( uiPossible / 2); // add extra 50 % } @@ -9851,13 +10660,13 @@ UINT32 SoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, INT16 sKi // figure out how far below OKLIFE the victim is - if (pVictim->bLife >= OKLIFE) + if (pVictim->stats.bLife >= OKLIFE) { ubBelowOKlife = 0; } else { - ubBelowOKlife = OKLIFE - pVictim->bLife; + ubBelowOKlife = OKLIFE - pVictim->stats.bLife; } // figure out how many healing pts we need to stop dying (2x cost) @@ -9876,7 +10685,7 @@ UINT32 SoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, INT16 sKi // now make sure we HAVE that much - if (Item[pSoldier->inv[ HANDPOS ].usItem].medicalkit ) + if (Item[this->inv[ HANDPOS ].usItem].medicalkit ) { uiMedcost = (uiActual + 1) / 2; // cost is only half, rounded up @@ -9904,13 +10713,13 @@ UINT32 SoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, INT16 sKi // heal real life points first (if below OKLIFE) because we don't want the // patient still DYING if bandages run out, or medic is disabled/distracted! // NOTE: Dressing wounds for life below OKLIFE now costs 2 pts/life point! - if ( ubPtsLeft && pVictim->bLife < OKLIFE) + if ( ubPtsLeft && pVictim->stats.bLife < OKLIFE) { // if we have enough points to bring him all the way to OKLIFE this turn if ( ubPtsLeft >= (2 * ubBelowOKlife ) ) { // raise life to OKLIFE - pVictim->bLife = OKLIFE; + pVictim->stats.bLife = OKLIFE; // reduce bleeding by the same number of life points healed up pVictim->bBleeding -= ubBelowOKlife; @@ -9920,7 +10729,7 @@ UINT32 SoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, INT16 sKi } else { - pVictim->bLife += ( ubPtsLeft / 2); + pVictim->stats.bLife += ( ubPtsLeft / 2); pVictim->bBleeding -= ( ubPtsLeft / 2); ubPtsLeft = ubPtsLeft % 2; // if ptsLeft was odd, ptsLeft = 1 @@ -9933,13 +10742,13 @@ UINT32 SoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, INT16 sKi } // if this healing brought the patient out of the worst of it, cancel dying - if (pVictim->bLife >= OKLIFE ) + if (pVictim->stats.bLife >= OKLIFE ) { //pVictim->dying = pVictim->dyingComment = FALSE; //pVictim->shootOn = TRUE; // turn off merc QUOTE flags - pVictim->fDyingComment = FALSE; + pVictim->flags.fDyingComment = FALSE; } @@ -9972,7 +10781,7 @@ UINT32 SoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, INT16 sKi // the "warned about bleeding" flag so merc tells us about the next bleeding if ( pVictim->bBleeding <= MIN_BLEEDING_THRESHOLD ) { - pVictim->fWarnedAboutBleeding = FALSE; + pVictim->flags.fWarnedAboutBleeding = FALSE; } @@ -9982,58 +10791,59 @@ UINT32 SoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, INT16 sKi // usedAPs equals (actionPts) * (%of possible points actually used) uiUsedAPs = ( uiActual * uiAvailAPs ) / uiPossible; - if (Item[pSoldier->inv[ HANDPOS ].usItem].medicalkit ) // using the GOOD medic stuff + if (Item[this->inv[ HANDPOS ].usItem].medicalkit ) // using the GOOD medic stuff { uiUsedAPs = ( uiUsedAPs * 2) / 3; // reverse 50% bonus by taking 2/3rds } - DeductPoints( pSoldier, (INT16)uiUsedAPs, (INT16)( ( uiUsedAPs * BP_PER_AP_LT_EFFORT) ) ); + DeductPoints( this, (INT16)uiUsedAPs, (INT16)( ( uiUsedAPs * BP_PER_AP_LT_EFFORT) ) ); + SOLDIERTYPE* pSoldier = this; if ( PTR_OURTEAM ) { // MEDICAL GAIN (actual / 2): Helped someone by giving first aid - StatChange(pSoldier, MEDICALAMT, (UINT16)(uiActual / 2), FALSE); + StatChange(this, MEDICALAMT, (UINT16)(uiActual / 2), FALSE); // DEXTERITY GAIN (actual / 6): Helped someone by giving first aid - StatChange(pSoldier, DEXTAMT, (UINT16)(uiActual / 6), FALSE); + StatChange(this, DEXTAMT, (UINT16)(uiActual / 6), FALSE); } return( uiMedcost ); } -void InternalReceivingSoldierCancelServices( SOLDIERTYPE *pSoldier, BOOLEAN fPlayEndAnim ) +void SOLDIERTYPE::InternalReceivingSoldierCancelServices( BOOLEAN fPlayEndAnim ) { SOLDIERTYPE *pTSoldier; INT32 cnt; - if ( pSoldier->ubServiceCount > 0 ) + if ( this->ubServiceCount > 0 ) { // Loop through guys who have us as servicing for ( pTSoldier = Menptr, cnt = 0; cnt < MAX_NUM_SOLDIERS; pTSoldier++, cnt++ ) { if ( pTSoldier->bActive ) { - if ( pTSoldier->ubServicePartner == pSoldier->ubID ) + if ( pTSoldier->ubServicePartner == this->ubID ) { - // END SERVICE! - pSoldier->ubServiceCount--; + // END SERVICE! + this->ubServiceCount--; pTSoldier->ubServicePartner = NOBODY; if ( gTacticalStatus.fAutoBandageMode ) { - pSoldier->ubAutoBandagingMedic = NOBODY; + this->ubAutoBandagingMedic = NOBODY; ActionDone( pTSoldier ); } else { // don't use end aid animation in autobandage - if ( pTSoldier->bLife >= OKLIFE && pTSoldier->bBreath > 0 && fPlayEndAnim ) + if ( pTSoldier->stats.bLife >= OKLIFE && pTSoldier->bBreath > 0 && fPlayEndAnim ) { - EVENT_InitNewSoldierAnim( pTSoldier, END_AID, 0 , FALSE ); + pTSoldier->EVENT_InitNewSoldierAnim( END_AID, 0 , FALSE ); } } @@ -10047,84 +10857,83 @@ void InternalReceivingSoldierCancelServices( SOLDIERTYPE *pSoldier, BOOLEAN fPla } -void ReceivingSoldierCancelServices( SOLDIERTYPE *pSoldier ) +void SOLDIERTYPE::ReceivingSoldierCancelServices( void ) { - InternalReceivingSoldierCancelServices( pSoldier, TRUE ); + this->InternalReceivingSoldierCancelServices( TRUE ); } -void InternalGivingSoldierCancelServices( SOLDIERTYPE *pSoldier, BOOLEAN fPlayEndAnim ) +void SOLDIERTYPE::InternalGivingSoldierCancelServices( BOOLEAN fPlayEndAnim ) { SOLDIERTYPE *pTSoldier; // GET TARGET SOLDIER - if ( pSoldier->ubServicePartner != NOBODY ) + if ( this->ubServicePartner != NOBODY ) { - pTSoldier = MercPtrs[ pSoldier->ubServicePartner ]; + pTSoldier = MercPtrs[ this->ubServicePartner ]; // END SERVICE! pTSoldier->ubServiceCount--; - pSoldier->ubServicePartner = NOBODY; + this->ubServicePartner = NOBODY; if ( gTacticalStatus.fAutoBandageMode ) { pTSoldier->ubAutoBandagingMedic = NOBODY; - ActionDone( pSoldier ); + ActionDone( this ); } else { - if ( pSoldier->bLife >= OKLIFE && pSoldier->bBreath > 0 && fPlayEndAnim ) + if ( this->stats.bLife >= OKLIFE && this->bBreath > 0 && fPlayEndAnim ) { // don't use end aid animation in autobandage - EVENT_InitNewSoldierAnim( pSoldier, END_AID, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( END_AID, 0 , FALSE ); } } } } -void GivingSoldierCancelServices( SOLDIERTYPE *pSoldier ) +void SOLDIERTYPE::GivingSoldierCancelServices( void ) { - InternalGivingSoldierCancelServices( pSoldier, TRUE ); + this->InternalGivingSoldierCancelServices( TRUE ); } -void HaultSoldierFromSighting( SOLDIERTYPE *pSoldier, BOOLEAN fFromSightingEnemy ) +void SOLDIERTYPE::HaultSoldierFromSighting( BOOLEAN fFromSightingEnemy ) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("HaultSoldierFromSighting") ); // SEND HUALT EVENT! //EV_S_STOP_MERC SStopMerc; - //SStopMerc.sGridNo = pSoldier->sGridNo; - //SStopMerc.bDirection = pSoldier->ubDirection; - //SStopMerc.usSoldierID = pSoldier->ubID; + //SStopMerc.sGridNo = this->sGridNo; + //SStopMerc.bDirection = this->ubDirection; + //SStopMerc.usSoldierID = this->ubID; //AddGameEvent( S_STOP_MERC, 0, &SStopMerc ); // If we are a 'specialmove... ignore... - if ( ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_SPECIALMOVE ) ) + if ( ( gAnimControl[ this->usAnimState ].uiFlags & ANIM_SPECIALMOVE ) ) { return; } // OK, check if we were going to throw something, and give it back if so! - if ( pSoldier->pTempObject != NULL && fFromSightingEnemy ) + if ( this->pTempObject != NULL && fFromSightingEnemy ) { // Place it back into inv.... - AutoPlaceObject( pSoldier, pSoldier->pTempObject, FALSE ); + AutoPlaceObject( this, this->pTempObject, FALSE ); //AXP 25.03.2007: Not needed anymore, grenade costs are only deducted on throwing the object //AXP 24.03.2007: Give APs back if we wanted to throw grenade, but interrupt/spotting occured - //if ( pSoldier->pThrowParams->ubActionCode == THROW_ARM_ITEM ) + //if ( this->pThrowParams->ubActionCode == THROW_ARM_ITEM ) //{ - // DeductPoints( pSoldier, -MinAPsToAttack( pSoldier, pSoldier->sTargetGridNo, FALSE ), 0 ); + // DeductPoints( this, -MinAPsToAttack( this, this->sTargetGridNo, FALSE ), 0 ); //} - MemFree( pSoldier->pTempObject ); - pSoldier->pTempObject = NULL; - pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; - pSoldier->usPendingAnimation2 = NO_PENDING_ANIMATION; + OBJECTTYPE::DeleteMe( &this->pTempObject ); + this->usPendingAnimation = NO_PENDING_ANIMATION; + this->usPendingAnimation2 = NO_PENDING_ANIMATION; // Decrement attack counter... DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Reducing attacker busy count..., ending throw because saw something") ); @@ -10132,9 +10941,9 @@ void HaultSoldierFromSighting( SOLDIERTYPE *pSoldier, BOOLEAN fFromSightingEnemy FreeUpAttacker( ); // ATE: Goto stationary stance...... - SoldierGotoStationaryStance( pSoldier ); + this->SoldierGotoStationaryStance( ); - DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); + DirtyMercPanelInterface( this, DIRTYLEVEL2 ); } @@ -10142,7 +10951,7 @@ void HaultSoldierFromSighting( SOLDIERTYPE *pSoldier, BOOLEAN fFromSightingEnemy // ATE: Dave, don't kill me // Here, we need to handle the situation when we're throweing a knife and we see somebody // cause for some reason throwing a knie does not use the pTempObject stuff that all other stuff does... - if ( pSoldier->usPendingAnimation == THROW_KNIFE ) + if ( this->usPendingAnimation == THROW_KNIFE ) { // Decrement attack counter... DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Reducing attacker busy count..., ending throw knife because saw something") ); @@ -10150,35 +10959,35 @@ void HaultSoldierFromSighting( SOLDIERTYPE *pSoldier, BOOLEAN fFromSightingEnemy FreeUpAttacker( ); // ATE: Goto stationary stance...... - SoldierGotoStationaryStance( pSoldier ); + this->SoldierGotoStationaryStance( ); - DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); + DirtyMercPanelInterface( this, DIRTYLEVEL2 ); } if ( !( gTacticalStatus.uiFlags & INCOMBAT ) ) { - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + this->EVENT_StopMerc( this->sGridNo, this->ubDirection ); } else { // Pause this guy from no APS - AdjustNoAPToFinishMove( pSoldier, TRUE ); + this->AdjustNoAPToFinishMove( TRUE ); - pSoldier->ubReasonCantFinishMove = REASON_STOPPED_SIGHT; + this->ubReasonCantFinishMove = REASON_STOPPED_SIGHT; // ATE; IF turning to shoot, stop! // ATE: We want to do this only for enemies, not items.... - if ( pSoldier->fTurningToShoot && fFromSightingEnemy ) + if ( this->flags.fTurningToShoot && fFromSightingEnemy ) { - pSoldier->fTurningToShoot = FALSE; - // Release attacker + this->flags.fTurningToShoot = FALSE; + // Release attacker // OK - this is hightly annoying , but due to the huge combinations of // things that can happen - 1 of them is that sLastTarget will get unset // after turn is done - so set flag here to tell it not to... - pSoldier->fDontUnsetLastTargetFromTurn = TRUE; + this->flags.fDontUnsetLastTargetFromTurn = TRUE; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Reducing attacker busy count..., ending fire because saw something") ); DebugAttackBusy("@@@@@@@ Reducing attacker busy count..., ending fire because saw something\n"); @@ -10189,40 +10998,40 @@ void HaultSoldierFromSighting( SOLDIERTYPE *pSoldier, BOOLEAN fFromSightingEnemy // OK, if we are stopped at our destination, cancel pending action... if ( fFromSightingEnemy ) { - if ( pSoldier->ubPendingAction != NO_PENDING_ACTION && pSoldier->sGridNo == pSoldier->sFinalDestination ) + if ( this->aiData.ubPendingAction != NO_PENDING_ACTION && this->sGridNo == this->pathing.sFinalDestination ) { - pSoldier->ubPendingAction = NO_PENDING_ACTION; + this->aiData.ubPendingAction = NO_PENDING_ACTION; } // Stop pending animation.... - pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; - pSoldier->usPendingAnimation2 = NO_PENDING_ANIMATION; + this->usPendingAnimation = NO_PENDING_ANIMATION; + this->usPendingAnimation2 = NO_PENDING_ANIMATION; // Kaiden: Another UB Bug Fix. // ATE: Nasty bug - clear out any fence jumping that may be in progress - pSoldier->fContinueMoveAfterStanceChange = FALSE; + this->flags.fContinueMoveAfterStanceChange = FALSE; } - if ( !pSoldier->fTurningToShoot ) + if ( !this->flags.fTurningToShoot ) { - pSoldier->bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; + this->flags.bTurningFromPronePosition = FALSE; } } // Unset UI! - if ( fFromSightingEnemy || ( pSoldier->pTempObject == NULL && !pSoldier->fTurningToShoot ) ) + if ( fFromSightingEnemy || ( this->pTempObject == NULL && !this->flags.fTurningToShoot ) ) { - UnSetUIBusy( pSoldier->ubID ); + UnSetUIBusy( this->ubID ); } - pSoldier->bTurningFromUI = FALSE; + this->bTurningFromUI = FALSE; - UnSetEngagedInConvFromPCAction( pSoldier ); + UnSetEngagedInConvFromPCAction( this ); } // HUALT EVENT IS USED TO STOP A MERC - NETWORKING SHOULD CHECK / ADJUST TO GRIDNO? -void EVENT_StopMerc( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bDirection ) +void SOLDIERTYPE::EVENT_StopMerc( INT16 sGridNo, INT8 bDirection ) { INT16 sX, sY; @@ -10233,40 +11042,40 @@ void EVENT_StopMerc( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bDirection ) //Cancel pending events - if ( !pSoldier->fDelayedMovement ) + if ( !this->flags.fDelayedMovement ) { - pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; - pSoldier->usPendingAnimation2 = NO_PENDING_ANIMATION; - pSoldier->ubPendingDirection = NO_PENDING_DIRECTION; - pSoldier->ubPendingAction = NO_PENDING_ACTION; + this->usPendingAnimation = NO_PENDING_ANIMATION; + this->usPendingAnimation2 = NO_PENDING_ANIMATION; + this->ubPendingDirection = NO_PENDING_DIRECTION; + this->aiData.ubPendingAction = NO_PENDING_ACTION; } - pSoldier->bEndDoorOpenCode = 0; - pSoldier->bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; + this->bEndDoorOpenCode = 0; + this->flags.bTurningFromPronePosition = 0; // Cancel path data! - pSoldier->usPathIndex = pSoldier->usPathDataSize = 0; + this->pathing.usPathIndex = this->pathing.usPathDataSize = 0; // Set ext tile waiting flag off! - pSoldier->fDelayedMovement = FALSE; + this->flags.fDelayedMovement = FALSE; // Turn off reverse... - pSoldier->bReverse = FALSE; + this->bReverse = FALSE; - EVENT_SetSoldierPosition( pSoldier, (FLOAT) sX, (FLOAT) sY ); - pSoldier->sDestXPos = (INT16)pSoldier->dXPos; - pSoldier->sDestYPos = (INT16)pSoldier->dYPos; - EVENT_SetSoldierDirection(pSoldier, bDirection); + this->EVENT_SetSoldierPosition( (FLOAT) sX, (FLOAT) sY ); + this->pathing.sDestXPos = (INT16)this->dXPos; + this->pathing.sDestYPos = (INT16)this->dYPos; + this->EVENT_SetSoldierDirection( bDirection); - if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_MOVING ) + if ( gAnimControl[ this->usAnimState ].uiFlags & ANIM_MOVING ) { - SoldierGotoStationaryStance( pSoldier ); + this->SoldierGotoStationaryStance( ); } // ATE; IF turning to shoot, stop! - if ( pSoldier->fTurningToShoot ) + if ( this->flags.fTurningToShoot ) { - pSoldier->fTurningToShoot = FALSE; + this->flags.fTurningToShoot = FALSE; // Release attacker DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Reducing attacker busy count..., ending fire because saw something") ); DebugAttackBusy("@@@@@@@ Reducing attacker busy count..., ending fire because saw something\n"); @@ -10274,20 +11083,20 @@ void EVENT_StopMerc( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bDirection ) } // Turn off multi-move speed override.... - if ( pSoldier->sGridNo == pSoldier->sFinalDestination ) + if ( this->sGridNo == this->pathing.sFinalDestination ) { - pSoldier->fUseMoverrideMoveSpeed = FALSE; + this->flags.fUseMoverrideMoveSpeed = FALSE; } // Unset UI! - UnSetUIBusy( pSoldier->ubID ); + UnSetUIBusy( this->ubID ); - UnMarkMovementReserved( pSoldier ); + UnMarkMovementReserved( this ); } -void ReLoadSoldierAnimationDueToHandItemChange( SOLDIERTYPE *pSoldier, UINT16 usOldItem, UINT16 usNewItem ) +void SOLDIERTYPE::ReLoadSoldierAnimationDueToHandItemChange( UINT16 usOldItem, UINT16 usNewItem ) { // DON'T continue aiming! // GOTO STANCE @@ -10297,27 +11106,27 @@ void ReLoadSoldierAnimationDueToHandItemChange( SOLDIERTYPE *pSoldier, UINT16 us // Shutoff burst.... // ( we could be on, then change gun that does not have burst ) - if ( Weapon[ usNewItem ].ubShotsPerBurst == 0 && !Weapon[pSoldier->inv[HANDPOS].usItem ].NoSemiAuto ) + if ( Weapon[ usNewItem ].ubShotsPerBurst == 0 && !Weapon[this->inv[HANDPOS].usItem ].NoSemiAuto ) { - pSoldier->bDoBurst = FALSE; - pSoldier->bWeaponMode = WM_NORMAL; - pSoldier->bDoAutofire = 0; + this->bDoBurst = FALSE; + this->bWeaponMode = WM_NORMAL; + this->bDoAutofire = 0; } else if ( Weapon[usNewItem].NoSemiAuto ) { - pSoldier->bDoBurst = TRUE; - pSoldier->bWeaponMode = WM_AUTOFIRE; - pSoldier->bDoAutofire = 1; + this->bDoBurst = TRUE; + this->bWeaponMode = WM_AUTOFIRE; + this->bDoAutofire = 1; } - if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIREREADY ) + if ( gAnimControl[ this->usAnimState ].uiFlags & ANIM_FIREREADY ) { // Stop aiming! - SoldierGotoStationaryStance( pSoldier ); + this->SoldierGotoStationaryStance( ); } // Cancel services... - GivingSoldierCancelServices( pSoldier ); + this->GivingSoldierCancelServices( ); // Did we have a rifle and do we now not have one? if ( usOldItem != NOTHING ) @@ -10330,7 +11139,7 @@ void ReLoadSoldierAnimationDueToHandItemChange( SOLDIERTYPE *pSoldier, UINT16 us fOldRifle = TRUE; } } - } + } if ( usNewItem != NOTHING ) { @@ -10342,33 +11151,33 @@ void ReLoadSoldierAnimationDueToHandItemChange( SOLDIERTYPE *pSoldier, UINT16 us fNewRifle = TRUE; } } - } + } // Switch on stance! - switch( gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) + switch( gAnimControl[ this->usAnimState ].ubEndHeight ) { case ANIM_STAND: if ( fOldRifle && !fNewRifle ) { // Put it away! - EVENT_InitNewSoldierAnim( pSoldier, LOWER_RIFLE, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( LOWER_RIFLE, 0 , FALSE ); } else if ( !fOldRifle && fNewRifle ) { // Bring it up! - EVENT_InitNewSoldierAnim( pSoldier, RAISE_RIFLE, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( RAISE_RIFLE, 0 , FALSE ); } else { - SetSoldierAnimationSurface( pSoldier, pSoldier->usAnimState ); + SetSoldierAnimationSurface( this, this->usAnimState ); } break; case ANIM_CROUCH: case ANIM_PRONE: - SetSoldierAnimationSurface( pSoldier, pSoldier->usAnimState ); + SetSoldierAnimationSurface( this, this->usAnimState ); break; } @@ -10493,10 +11302,10 @@ UINT16 *CreateEnemyGreyGlow16BPPPalette( SGPPaletteEntry *pPalette, UINT32 rscal void ContinueMercMovement( SOLDIERTYPE *pSoldier ) { - INT16 sAPCost; + INT16 sAPCost; INT16 sGridNo; - sGridNo = pSoldier->sFinalDestination; + sGridNo = pSoldier->pathing.sFinalDestination; // Can we afford this? if ( pSoldier->bGoodContPath ) @@ -10506,11 +11315,11 @@ void ContinueMercMovement( SOLDIERTYPE *pSoldier ) else { // ATE: OK, don't cancel count, so pending actions are still valid... - pSoldier->ubPendingActionAnimCount = 0; + pSoldier->aiData.ubPendingActionAnimCount = 0; } // get a path to dest... - if ( FindBestPath( pSoldier, sGridNo, pSoldier->bLevel, pSoldier->usUIMovementMode, NO_COPYROUTE, 0 ) ) + if ( FindBestPath( pSoldier, sGridNo, pSoldier->pathing.bLevel, pSoldier->usUIMovementMode, NO_COPYROUTE, 0 ) ) { sAPCost = PtsToMoveDirection( pSoldier, (UINT8)guiPathingData[ 0 ] ); @@ -10519,7 +11328,7 @@ void ContinueMercMovement( SOLDIERTYPE *pSoldier ) // Acknowledge if ( pSoldier->bTeam == gbPlayerNum ) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_OK1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_OK1 ); // If we have a face, tell text in it to go away! if ( pSoldier->iFaceIndex != -1 ) @@ -10528,53 +11337,53 @@ void ContinueMercMovement( SOLDIERTYPE *pSoldier ) } } - AdjustNoAPToFinishMove( pSoldier, FALSE ); + pSoldier->AdjustNoAPToFinishMove( FALSE ); SetUIBusy( pSoldier->ubID ); // OK, try and get a path to out dest! - EVENT_InternalGetNewSoldierPath( pSoldier, sGridNo, pSoldier->usUIMovementMode, FALSE, TRUE ); + pSoldier->EVENT_InternalGetNewSoldierPath( sGridNo, pSoldier->usUIMovementMode, FALSE, TRUE ); } } } -BOOLEAN CheckForBreathCollapse( SOLDIERTYPE *pSoldier ) +BOOLEAN SOLDIERTYPE::CheckForBreathCollapse( void ) { // Check if we are out of breath! // Only check if > 70 - if ( pSoldier->bBreathMax > 70 ) + if ( this->bBreathMax > 70 ) { - if ( pSoldier->bBreath < 20 && !(pSoldier->usQuoteSaidFlags & SOLDIER_QUOTE_SAID_LOW_BREATH ) && - gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_STAND ) + if ( this->bBreath < 20 && !(this->usQuoteSaidFlags & SOLDIER_QUOTE_SAID_LOW_BREATH ) && + gAnimControl[ this->usAnimState ].ubEndHeight == ANIM_STAND ) { // WARN! - TacticalCharacterDialogue( pSoldier, QUOTE_OUT_OF_BREATH ); + TacticalCharacterDialogue( this, QUOTE_OUT_OF_BREATH ); // Set flag indicating we were warned! - pSoldier->usQuoteSaidFlags |= SOLDIER_QUOTE_SAID_LOW_BREATH; + this->usQuoteSaidFlags |= SOLDIER_QUOTE_SAID_LOW_BREATH; } } // Check for drowing..... - //if ( pSoldier->bBreath < 10 && !(pSoldier->usQuoteSaidFlags & SOLDIER_QUOTE_SAID_DROWNING ) && pSoldier->bOverTerrainType == DEEP_WATER ) + //if ( this->bBreath < 10 && !(this->usQuoteSaidFlags & SOLDIER_QUOTE_SAID_DROWNING ) && this->bOverTerrainType == DEEP_WATER ) //{ // WARN! - // TacticalCharacterDialogue( pSoldier, QUOTE_DROWNING ); + // TacticalCharacterDialogue( this, QUOTE_DROWNING ); // Set flag indicating we were warned! - // pSoldier->usQuoteSaidFlags |= SOLDIER_QUOTE_SAID_DROWNING; + // this->usQuoteSaidFlags |= SOLDIER_QUOTE_SAID_DROWNING; // WISDOM GAIN (25): Starting to drown - // StatChange( pSoldier, WISDOMAMT, 25, FALSE ); + // StatChange( this, WISDOMAMT, 25, FALSE ); //} - if ( pSoldier->bBreath == 0 && !pSoldier->bCollapsed && !( pSoldier->uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_ANIMAL | SOLDIER_MONSTER ) ) ) + if ( this->bBreath == 0 && !this->bCollapsed && !( this->flags.uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_ANIMAL | SOLDIER_MONSTER ) ) ) { // Collapse! // OK, Set a flag, because we may still be in the middle of an animation what is not interruptable... - pSoldier->bBreathCollapsed = TRUE; + this->bBreathCollapsed = TRUE; return( TRUE ); } @@ -10583,7 +11392,7 @@ BOOLEAN CheckForBreathCollapse( SOLDIERTYPE *pSoldier ) } -BOOLEAN InternalIsValidStance( SOLDIERTYPE *pSoldier, INT8 bDirection, INT8 bNewStance ) +BOOLEAN SOLDIERTYPE::InternalIsValidStance( INT8 bDirection, INT8 bNewStance ) { UINT16 usOKToAddStructID=0; STRUCTURE_FILE_REF *pStructureFileRef; @@ -10593,13 +11402,13 @@ BOOLEAN InternalIsValidStance( SOLDIERTYPE *pSoldier, INT8 bDirection, INT8 bNew // Check, if dest is prone, we can actually do this! // If we are a vehicle, we can only 'stand' - if ( ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && bNewStance != ANIM_STAND ) - { + if ( ( this->flags.uiStatusFlags & SOLDIER_VEHICLE ) && bNewStance != ANIM_STAND ) + { return( FALSE ); } // Check if we are in water? - if ( MercInWater( pSoldier ) ) + if ( this->MercInWater( ) ) { if ( bNewStance == ANIM_PRONE || bNewStance == ANIM_CROUCH ) { @@ -10607,13 +11416,13 @@ BOOLEAN InternalIsValidStance( SOLDIERTYPE *pSoldier, INT8 bDirection, INT8 bNew } } - if ( pSoldier->ubBodyType == ROBOTNOWEAPON && bNewStance != ANIM_STAND ) + if ( this->ubBodyType == ROBOTNOWEAPON && bNewStance != ANIM_STAND ) { return( FALSE ); } // Check if we are in water? - if ( AM_AN_EPC( pSoldier ) ) + if ( AM_AN_EPC( this ) ) { if ( bNewStance == ANIM_PRONE ) { @@ -10626,18 +11435,25 @@ BOOLEAN InternalIsValidStance( SOLDIERTYPE *pSoldier, INT8 bDirection, INT8 bNew } - if ( pSoldier->bCollapsed ) + if ( this->bCollapsed ) { - if ( bNewStance == ANIM_STAND || bNewStance == ANIM_CROUCH ) + //CHRISL: Changes from ADB rev 1475. + if ( bNewStance == ANIM_CROUCH ) { return( FALSE ); } + //when civilians are collapsed and die they may change to stand in order to fall forward + if ( bNewStance == ANIM_STAND && this->ubBodyType <= REGFEMALE ) + { + //if we are trying to stand and we are a MERC + return( FALSE ); + } } // Check if we can do this.... - if ( pSoldier->pLevelNode && pSoldier->pLevelNode->pStructureData != NULL ) + if ( this->pLevelNode && this->pLevelNode->pStructureData != NULL ) { - usOKToAddStructID = pSoldier->pLevelNode->pStructureData->usStructureID; + usOKToAddStructID = this->pLevelNode->pStructureData->usStructureID; } else { @@ -10665,19 +11481,19 @@ BOOLEAN InternalIsValidStance( SOLDIERTYPE *pSoldier, INT8 bDirection, INT8 bNew default: // Something gone funny here.... - usAnimState = pSoldier->usAnimState; - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Wrong desired stance given: %d, %d.", bNewStance, pSoldier->usAnimState ); + usAnimState = this->usAnimState; + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Wrong desired stance given: %d, %d.", bNewStance, this->usAnimState ); } - usAnimSurface = DetermineSoldierAnimationSurface( pSoldier, usAnimState ); + usAnimSurface = DetermineSoldierAnimationSurface( this, usAnimState ); // Get structure ref........ - pStructureFileRef = GetAnimationStructureRef( pSoldier->ubID, usAnimSurface, usAnimState ); + pStructureFileRef = GetAnimationStructureRef( this->ubID, usAnimSurface, usAnimState ); if ( pStructureFileRef != NULL ) { // Can we add structure data for this stance...? - if ( !OkayToAddStructureToWorld( pSoldier->sGridNo, pSoldier->bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[ bDirection ]]), usOKToAddStructID ) ) + if ( !OkayToAddStructureToWorld( this->sGridNo, this->pathing.bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[ bDirection ]]), usOKToAddStructID ) ) { return( FALSE ); } @@ -10689,7 +11505,7 @@ BOOLEAN InternalIsValidStance( SOLDIERTYPE *pSoldier, INT8 bDirection, INT8 bNew BOOLEAN IsValidStance( SOLDIERTYPE *pSoldier, INT8 bNewStance ) { - return( InternalIsValidStance( pSoldier, pSoldier->ubDirection, bNewStance ) ); + return( pSoldier->InternalIsValidStance( pSoldier->ubDirection, bNewStance ) ); } @@ -10698,7 +11514,7 @@ BOOLEAN IsValidMovementMode( SOLDIERTYPE *pSoldier, INT16 usMovementMode ) // Check, if dest is prone, we can actually do this! // Check if we are in water? - if ( MercInWater( pSoldier ) ) + if ( pSoldier->MercInWater( ) ) { if ( usMovementMode == RUNNING || usMovementMode == SWATTING || usMovementMode == CRAWLING ) { @@ -10716,15 +11532,15 @@ void SelectMoveAnimationFromStance( SOLDIERTYPE *pSoldier ) switch ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) { case ANIM_STAND: - EVENT_InitNewSoldierAnim( pSoldier, WALKING, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( WALKING, 0 , FALSE ); break; case ANIM_PRONE: - EVENT_InitNewSoldierAnim( pSoldier, CRAWLING, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( CRAWLING, 0 , FALSE ); break; case ANIM_CROUCH: - EVENT_InitNewSoldierAnim( pSoldier, SWATTING, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( SWATTING, 0 , FALSE ); break; } @@ -10750,7 +11566,7 @@ void GetActualSoldierAnimDims( SOLDIERTYPE *pSoldier, INT16 *psHeight, INT16 *ps if ( gAnimSurfaceDatabase[ usAnimSurface ].hVideoObject == NULL ) { *psHeight = (INT16)5; - *psWidth = (INT16)5; + *psWidth = (INT16)5; return; } @@ -10788,7 +11604,7 @@ void GetActualSoldierAnimOffsets( SOLDIERTYPE *pSoldier, INT16 *sOffsetX, INT16 if ( gAnimSurfaceDatabase[ usAnimSurface ].hVideoObject == NULL ) { *sOffsetX = (INT16)0; - *sOffsetY = (INT16)0; + *sOffsetY = (INT16)0; return; } @@ -10819,14 +11635,13 @@ void SetSoldierLocatorOffsets( SOLDIERTYPE *pSoldier ) } -BOOLEAN SoldierCarriesTwoHandedWeapon( SOLDIERTYPE *pSoldier ) +BOOLEAN SOLDIERTYPE::SoldierCarriesTwoHandedWeapon( void ) { UINT16 usItem; - usItem = pSoldier->inv[ HANDPOS ].usItem; + usItem = this->inv[ HANDPOS ].usItem; - // if ( usItem != NOTHING && (Item[ usItem ].fFlags & ITEM_TWO_HANDED) ) - if ( usItem != NOTHING && (Item[ usItem ].twohanded ) ) + if ( this->inv[ HANDPOS ].exists() == true && (Item[ usItem ].twohanded ) ) { return( TRUE ); } @@ -10842,99 +11657,99 @@ INT32 CheckBleeding( SOLDIERTYPE *pSoldier ) INT8 bBandaged; //,savedOurTurn; INT32 iBlood = NOBLOOD; - if ( pSoldier->bLife != 0 ) + if ( pSoldier->stats.bLife != 0 ) { // if merc is hurt beyond the minimum required to bleed, or he's dying - if ( ( pSoldier->bBleeding > MIN_BLEEDING_THRESHOLD) || pSoldier->bLife < OKLIFE ) + if ( ( pSoldier->bBleeding > MIN_BLEEDING_THRESHOLD) || pSoldier->stats.bLife < OKLIFE ) { // if he's NOT in the process of being bandaged or DOCTORed if ( ( pSoldier->ubServiceCount == 0 ) && ( AnyDoctorWhoCanHealThisPatient( pSoldier, HEALABLE_EVER ) == NULL ) ) { // may drop blood whether or not any bleeding takes place this turn if ( pSoldier->bTilesMoved < 1 ) - { - iBlood = ( ( pSoldier->bBleeding - MIN_BLEEDING_THRESHOLD ) / BLOODDIVISOR ); // + pSoldier->dying; - if ( iBlood > MAXBLOODQUANTITY ) - { - iBlood = MAXBLOODQUANTITY; - } - } + { + iBlood = ( ( pSoldier->bBleeding - MIN_BLEEDING_THRESHOLD ) / BLOODDIVISOR ); // + pSoldier->dying; + if ( iBlood > MAXBLOODQUANTITY ) + { + iBlood = MAXBLOODQUANTITY; + } + } else - { - iBlood = NOBLOOD; - } + { + iBlood = NOBLOOD; + } // Are we in a different mode? if ( !(gTacticalStatus.uiFlags & TURNBASED ) || !(gTacticalStatus.uiFlags & INCOMBAT ) ) - { - pSoldier->dNextBleed -= (FLOAT)RT_NEXT_BLEED_MODIFIER; - } + { + pSoldier->dNextBleed -= (FLOAT)RT_NEXT_BLEED_MODIFIER; + } else - { - // Do a single step descrease - pSoldier->dNextBleed--; - } + { + // Do a single step descrease + pSoldier->dNextBleed--; + } // if it's time to lose some blood if ( pSoldier->dNextBleed <= 0) - { - // first, calculate if soldier is bandaged - bBandaged = pSoldier->bLifeMax - pSoldier->bBleeding - pSoldier->bLife; + { + // first, calculate if soldier is bandaged + bBandaged = pSoldier->stats.bLifeMax - pSoldier->bBleeding - pSoldier->stats.bLife; - // as long as he's bandaged and not "dying" - if ( bBandaged && pSoldier->bLife >= OKLIFE ) - { - // just bleeding through existing bandages - pSoldier->bBleeding++; + // as long as he's bandaged and not "dying" + if ( bBandaged && pSoldier->stats.bLife >= OKLIFE ) + { + // just bleeding through existing bandages + pSoldier->bBleeding++; - SoldierBleed( pSoldier, TRUE ); - } - else // soldier is either not bandaged at all or is dying - { - if ( pSoldier->bLife < OKLIFE ) // if he's dying - { - // if he's conscious, and he hasn't already, say his "dying quote" - if ( ( pSoldier->bLife >= CONSCIOUSNESS ) && !pSoldier->fDyingComment ) - { - TacticalCharacterDialogue( pSoldier, QUOTE_SERIOUSLY_WOUNDED ); + SoldierBleed( pSoldier, TRUE ); + } + else // soldier is either not bandaged at all or is dying + { + if ( pSoldier->stats.bLife < OKLIFE ) // if he's dying + { + // if he's conscious, and he hasn't already, say his "dying quote" + if ( ( pSoldier->stats.bLife >= CONSCIOUSNESS ) && !pSoldier->flags.fDyingComment ) + { + TacticalCharacterDialogue( pSoldier, QUOTE_SERIOUSLY_WOUNDED ); - pSoldier->fDyingComment = TRUE; - } + pSoldier->flags.fDyingComment = TRUE; + } - // can't permit lifemax to ever bleed beneath OKLIFE, or that - // soldier might as well be dead! - if (pSoldier->bLifeMax >= OKLIFE) + // can't permit lifemax to ever bleed beneath OKLIFE, or that + // soldier might as well be dead! + if (pSoldier->stats.bLifeMax >= OKLIFE) { // bleeding while "dying" costs a PERMANENT point of life each time! - pSoldier->bLifeMax--; + pSoldier->stats.bLifeMax--; pSoldier->bBleeding--; } } } - // either way, a point of life (health) is lost because of bleeding - // This will also update the life bar + // either way, a point of life (health) is lost because of bleeding + // This will also update the life bar - SoldierBleed( pSoldier, FALSE ); + SoldierBleed( pSoldier, FALSE ); - // if he's not dying (which includes him saying the dying quote just - // now), and he hasn't warned us that he's bleeding yet, he does so - // Also, not if they are being bandaged.... - if ( ( pSoldier->bLife >= OKLIFE ) && !pSoldier->fDyingComment && !pSoldier->fWarnedAboutBleeding && !gTacticalStatus.fAutoBandageMode && pSoldier->ubServiceCount == 0 ) + // if he's not dying (which includes him saying the dying quote just + // now), and he hasn't warned us that he's bleeding yet, he does so + // Also, not if they are being bandaged.... + if ( ( pSoldier->stats.bLife >= OKLIFE ) && !pSoldier->flags.fDyingComment && !pSoldier->flags.fWarnedAboutBleeding && !gTacticalStatus.fAutoBandageMode && pSoldier->ubServiceCount == 0 ) { TacticalCharacterDialogue( pSoldier, QUOTE_STARTING_TO_BLEED ); // "starting to bleed" quote - pSoldier->fWarnedAboutBleeding = TRUE; + pSoldier->flags.fWarnedAboutBleeding = TRUE; } - pSoldier->dNextBleed = CalcSoldierNextBleed( pSoldier ); + pSoldier->dNextBleed = CalcSoldierNextBleed( pSoldier ); } } } - } + } return( iBlood ); } @@ -10944,14 +11759,14 @@ void SoldierBleed( SOLDIERTYPE *pSoldier, BOOLEAN fBandagedBleed ) INT8 bOldLife; // OK, here make some stuff happen for bleeding - // A banaged bleed does not show damage taken , just through existing bandages + // A banaged bleed does not show damage taken , just through existing bandages // ATE: Do this ONLY if buddy is in sector..... if ( ( pSoldier->bInSector && guiCurrentScreen == GAME_SCREEN ) || guiCurrentScreen != GAME_SCREEN ) { - pSoldier->fFlashPortrait = TRUE; + pSoldier->flags.fFlashPortrait = TRUE; pSoldier->bFlashPortraitFrame = FLASH_PORTRAIT_STARTSHADE; - RESETTIMECOUNTER( pSoldier->PortraitFlashCounter, FLASH_PORTRAIT_DELAY ); + RESETTIMECOUNTER( pSoldier->timeCounters.PortraitFlashCounter, FLASH_PORTRAIT_DELAY ); // If we are in mapscreen, set this person as selected if ( guiCurrentScreen == MAP_SCREEN ) @@ -10960,12 +11775,12 @@ void SoldierBleed( SOLDIERTYPE *pSoldier, BOOLEAN fBandagedBleed ) } } - bOldLife = pSoldier->bLife; + bOldLife = pSoldier->stats.bLife; // If we are already dead, don't show damage! if ( !fBandagedBleed ) { - SoldierTakeDamage( pSoldier, ANIM_CROUCH, 1, 100, TAKE_DAMAGE_BLOODLOSS, NOBODY, NOWHERE, 0, TRUE ); + pSoldier->SoldierTakeDamage( ANIM_CROUCH, 1, 100, TAKE_DAMAGE_BLOODLOSS, NOBODY, NOWHERE, 0, TRUE ); } } @@ -10995,11 +11810,11 @@ void SoldierCollapse( SOLDIERTYPE *pSoldier ) DeductPoints( pSoldier,0, (INT16)-5000 ); return; break; - } + } pSoldier->bCollapsed = TRUE; - ReceivingSoldierCancelServices( pSoldier ); + pSoldier->ReceivingSoldierCancelServices( ); // CC has requested - handle sight here... HandleSight( pSoldier, SIGHT_LOOK ); @@ -11009,36 +11824,36 @@ void SoldierCollapse( SOLDIERTYPE *pSoldier ) { case ANIM_STAND: - if ( MercInDeepWater( pSoldier) ) + if ( pSoldier->MercInDeepWater( ) ) { - EVENT_InitNewSoldierAnim( pSoldier, DEEP_WATER_DIE, 0, FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( DEEP_WATER_DIE, 0, FALSE ); } - else if ( MercInShallowWater( pSoldier) ) + else if ( pSoldier->MercInShallowWater( ) ) { - EVENT_InitNewSoldierAnim( pSoldier, WATER_DIE, 0, FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( WATER_DIE, 0, FALSE ); } else { - BeginTyingToFall( pSoldier ); - EVENT_InitNewSoldierAnim( pSoldier, FALLFORWARD_FROMHIT_STAND, 0, FALSE ); + pSoldier->BeginTyingToFall( ); + pSoldier->EVENT_InitNewSoldierAnim( FALLFORWARD_FROMHIT_STAND, 0, FALSE ); } break; case ANIM_CROUCH: // Crouched or prone, only for mercs! - BeginTyingToFall( pSoldier ); + pSoldier->BeginTyingToFall( ); // 0verhaul: No special case here! First the FALLFORWARD_FROMHIT_CROUCH can be filled in to use the FALLFORWARD_FROMHIT_STAND anim // then when real anims come, use them instead. //if ( fMerc ) //{ - EVENT_InitNewSoldierAnim( pSoldier, FALLFORWARD_FROMHIT_CROUCH, 0 , FALSE); + pSoldier->EVENT_InitNewSoldierAnim( FALLFORWARD_FROMHIT_CROUCH, 0 , FALSE); //} //else //{ // // For civs... use fall from stand... - // EVENT_InitNewSoldierAnim( pSoldier, FALLFORWARD_FROMHIT_STAND, 0 , FALSE); + // pSoldier->EVENT_InitNewSoldierAnim( FALLFORWARD_FROMHIT_STAND, 0 , FALSE); //} break; @@ -11049,21 +11864,21 @@ void SoldierCollapse( SOLDIERTYPE *pSoldier ) case FALLFORWARD_FROMHIT_STAND: case ENDFALLFORWARD_FROMHIT_CROUCH: - ChangeSoldierState( pSoldier, STAND_FALLFORWARD_STOP, 0, FALSE ); + pSoldier->ChangeSoldierState( STAND_FALLFORWARD_STOP, 0, FALSE ); break; case FALLBACK_HIT_STAND: - ChangeSoldierState( pSoldier, FALLBACKHIT_STOP, 0, FALSE ); + pSoldier->ChangeSoldierState( FALLBACKHIT_STOP, 0, FALSE ); break; default: - EVENT_InitNewSoldierAnim( pSoldier, PRONE_LAY_FROMHIT, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( PRONE_LAY_FROMHIT, 0 , FALSE ); break; } break; } - if (pSoldier->uiStatusFlags & SOLDIER_ENEMY) + if (pSoldier->flags.uiStatusFlags & SOLDIER_ENEMY) { if ( !(gTacticalStatus.bPanicTriggerIsAlarm) && (gTacticalStatus.ubTheChosenOne == pSoldier->ubID) ) @@ -11073,8 +11888,8 @@ void SoldierCollapse( SOLDIERTYPE *pSoldier ) MakeClosestEnemyChosenOne(); } - if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) && (pSoldier->uiStatusFlags & SOLDIER_UNDERAICONTROL)) - { + if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) && (pSoldier->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL)) + { #ifdef TESTAICONTROL DebugAI( String("Ending turn for %d because of error from HandleItem", pSoldier->ubID ) ); #endif @@ -11089,7 +11904,7 @@ void SoldierCollapse( SOLDIERTYPE *pSoldier ) // Check if this is our selected guy... // if ( pSoldier->ubID == gusSelectedSoldier ) // { - // SelectNextAvailSoldier( pSoldier ); + // SelectNextAvailSoldier( pSoldier ); // } //} } @@ -11104,9 +11919,9 @@ FLOAT CalcSoldierNextBleed( SOLDIERTYPE *pSoldier ) //pSoldier->nextbleed = 2 + (pSoldier->life / (10 + pSoldier->tilesMoved)); // min = 2 // if bandaged, give 1/2 of the bandaged life points back into equation - bBandaged = pSoldier->bLifeMax - pSoldier->bLife - pSoldier->bBleeding; + bBandaged = pSoldier->stats.bLifeMax - pSoldier->stats.bLife - pSoldier->bBleeding; - return( (FLOAT)1 + (FLOAT)( (pSoldier->bLife + bBandaged / 2) / (10 + pSoldier->bTilesMoved) ) ); // min = 1 + return( (FLOAT)1 + (FLOAT)( (pSoldier->stats.bLife + bBandaged / 2) / (10 + pSoldier->bTilesMoved) ) ); // min = 1 } FLOAT CalcSoldierNextUnmovingBleed( SOLDIERTYPE *pSoldier ) @@ -11116,9 +11931,9 @@ FLOAT CalcSoldierNextUnmovingBleed( SOLDIERTYPE *pSoldier ) // calculate bleeding rate without the penalty for tiles moved // if bandaged, give 1/2 of the bandaged life points back into equation - bBandaged = pSoldier->bLifeMax - pSoldier->bLife - pSoldier->bBleeding; + bBandaged = pSoldier->stats.bLifeMax - pSoldier->stats.bLife - pSoldier->bBleeding; - return( (FLOAT)1 + (FLOAT)( (pSoldier->bLife + bBandaged / 2) / 10 ) ); // min = 1 + return( (FLOAT)1 + (FLOAT)( (pSoldier->stats.bLife + bBandaged / 2) / 10 ) ); // min = 1 } void HandlePlacingRoofMarker( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fSet, BOOLEAN fForce ) @@ -11137,7 +11952,7 @@ void HandlePlacingRoofMarker( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fSet } // If we are on the roof, add roof UI peice! - if ( pSoldier->bLevel == SECOND_LEVEL ) + if ( pSoldier->pathing.bLevel == SECOND_LEVEL ) { // Get roof node pRoofNode = gpWorldLevelData[ sGridNo ].pRoofHead; @@ -11190,7 +12005,7 @@ void HandlePlacingRoofMarker( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fSet } } -void PositionSoldierLight( SOLDIERTYPE *pSoldier ) +void SOLDIERTYPE::PositionSoldierLight( void ) { // DO ONLY IF WE'RE AT A GOOD LEVEL if ( ubAmbientLightLevel < MIN_AMB_LEVEL_FOR_MERC_LIGHTS ) @@ -11198,17 +12013,17 @@ void PositionSoldierLight( SOLDIERTYPE *pSoldier ) return; } - if ( !pSoldier->bInSector ) + if ( !this->bInSector ) { return; } - if ( pSoldier->bTeam != gbPlayerNum ) + if ( this->bTeam != gbPlayerNum ) { return; } - if ( pSoldier->bLife < OKLIFE ) + if ( this->stats.bLife < OKLIFE ) { return; } @@ -11219,24 +12034,24 @@ void PositionSoldierLight( SOLDIERTYPE *pSoldier ) return; } - if ( pSoldier->iLight == -1 ) + if ( this->iLight == -1 ) { - CreateSoldierLight( pSoldier ); + this->CreateSoldierLight( ); } - //if ( pSoldier->ubID == gusSelectedSoldier ) + //if ( this->ubID == gusSelectedSoldier ) { - LightSpritePower(pSoldier->iLight, TRUE); - LightSpriteFake(pSoldier->iLight); + LightSpritePower(this->iLight, TRUE); + LightSpriteFake(this->iLight); - LightSpritePosition( pSoldier->iLight, (INT16)(pSoldier->sX/CELL_X_SIZE), (INT16)(pSoldier->sY/CELL_Y_SIZE)); + LightSpritePosition( this->iLight, (INT16)(this->sX/CELL_X_SIZE), (INT16)(this->sY/CELL_Y_SIZE)); } } -void SetCheckSoldierLightFlag( SOLDIERTYPE *pSoldier ) +void SOLDIERTYPE::SetCheckSoldierLightFlag( ) { - PositionSoldierLight( pSoldier ); - //pSoldier->uiStatusFlags |= SOLDIER_RECHECKLIGHT; + this->PositionSoldierLight( ); + //this->flags.uiStatusFlags |= SOLDIER_RECHECKLIGHT; } @@ -11255,24 +12070,24 @@ void PickPickupAnimation( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGridNo pSoldier->ubPendingDirection = bDirection; // Change to pickup animation - EVENT_InitNewSoldierAnim( pSoldier, ADJACENT_GET_ITEM, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( ADJACENT_GET_ITEM, 0 , FALSE ); - if (!(pSoldier->uiStatusFlags & SOLDIER_PC)) + if (!(pSoldier->flags.uiStatusFlags & SOLDIER_PC)) { // set "pending action" value for AI so it will wait - pSoldier->bAction = AI_ACTION_PENDING_ACTION; + pSoldier->aiData.bAction = AI_ACTION_PENDING_ACTION; } } else { // If in water.... - if ( MercInWater( pSoldier ) ) + if ( pSoldier->MercInWater( ) ) { UnSetUIBusy( pSoldier->ubID ); HandleSoldierPickupItem( pSoldier, iItemIndex, sGridNo, bZLevel ); - SoldierGotoStationaryStance( pSoldier ); - if (!(pSoldier->uiStatusFlags & SOLDIER_PC)) + pSoldier->SoldierGotoStationaryStance( ); + if (!(pSoldier->flags.uiStatusFlags & SOLDIER_PC)) { // reset action value for AI because we're done! ActionDone( pSoldier ); @@ -11319,24 +12134,24 @@ void PickPickupAnimation( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGridNo } //pSoldier->ubPendingDirection = bDirection; - EVENT_SetSoldierDesiredDirection( pSoldier, bDirection ); - EVENT_SetSoldierDirection( pSoldier, bDirection ); + pSoldier->EVENT_SetSoldierDesiredDirection( bDirection ); + pSoldier->EVENT_SetSoldierDirection( bDirection ); // Change to pickup animation - EVENT_InitNewSoldierAnim( pSoldier, ADJACENT_GET_ITEM, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( ADJACENT_GET_ITEM, 0 , FALSE ); } //#endif } if ( fDoNormalPickup ) { - EVENT_InitNewSoldierAnim( pSoldier, PICKUP_ITEM, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( PICKUP_ITEM, 0 , FALSE ); } - if (!(pSoldier->uiStatusFlags & SOLDIER_PC)) + if (!(pSoldier->flags.uiStatusFlags & SOLDIER_PC)) { // set "pending action" value for AI so it will wait - pSoldier->bAction = AI_ACTION_PENDING_ACTION; + pSoldier->aiData.bAction = AI_ACTION_PENDING_ACTION; } break; @@ -11345,8 +12160,8 @@ void PickPickupAnimation( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGridNo UnSetUIBusy( pSoldier->ubID ); HandleSoldierPickupItem( pSoldier, iItemIndex, sGridNo, bZLevel ); - SoldierGotoStationaryStance( pSoldier ); - if (!(pSoldier->uiStatusFlags & SOLDIER_PC)) + pSoldier->SoldierGotoStationaryStance( ); + if (!(pSoldier->flags.uiStatusFlags & SOLDIER_PC)) { // reset action value for AI because we're done! ActionDone( pSoldier ); @@ -11357,49 +12172,49 @@ void PickPickupAnimation( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGridNo } } -void PickDropItemAnimation( SOLDIERTYPE *pSoldier ) +void SOLDIERTYPE::PickDropItemAnimation( void ) { // Don't show animation of getting item, if we are not standing - switch ( gAnimControl[ pSoldier->usAnimState ].ubHeight ) + switch ( gAnimControl[ this->usAnimState ].ubHeight ) { case ANIM_STAND: - pSoldier->bAction = AI_ACTION_PENDING_ACTION; - EVENT_InitNewSoldierAnim( pSoldier, DROP_ITEM, 0 , FALSE ); + this->aiData.bAction = AI_ACTION_PENDING_ACTION; + this->EVENT_InitNewSoldierAnim( DROP_ITEM, 0 , FALSE ); break; case ANIM_CROUCH: case ANIM_PRONE: - SoldierHandleDropItem( pSoldier ); - SoldierGotoStationaryStance( pSoldier ); - ActionDone( pSoldier); + SoldierHandleDropItem( this ); + this->SoldierGotoStationaryStance( ); + ActionDone(this); break; } } -void EVENT_SoldierBeginCutFence( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection ) +void SOLDIERTYPE::EVENT_SoldierBeginCutFence( INT16 sGridNo, UINT8 ubDirection ) { // Make sure we have a structure here.... if ( IsCuttableWireFenceAtGridNo( sGridNo ) ) { // CHANGE DIRECTION AND GOTO ANIMATION NOW - EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection ); - EVENT_SetSoldierDirection( pSoldier, ubDirection ); + this->EVENT_SetSoldierDesiredDirection( ubDirection ); + this->EVENT_SetSoldierDirection( ubDirection ); //BOOLEAN CutWireFence( INT16 sGridNo ) // SET TARGET GRIDNO - pSoldier->sTargetGridNo = sGridNo; + this->sTargetGridNo = sGridNo; // CHANGE TO ANIMATION - EVENT_InitNewSoldierAnim( pSoldier, CUTTING_FENCE, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( CUTTING_FENCE, 0 , FALSE ); } } -void EVENT_SoldierBeginRepair( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection ) +void SOLDIERTYPE::EVENT_SoldierBeginRepair( INT16 sGridNo, UINT8 ubDirection ) { INT8 bRepairItem; UINT8 ubID; @@ -11410,32 +12225,32 @@ void EVENT_SoldierBeginRepair( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDir if ( bRepairItem ) { // CHANGE DIRECTION AND GOTO ANIMATION NOW - EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection ); - EVENT_SetSoldierDirection( pSoldier, ubDirection ); + this->EVENT_SetSoldierDesiredDirection( ubDirection ); + this->EVENT_SetSoldierDirection( ubDirection ); //BOOLEAN CutWireFence( INT16 sGridNo ) // SET TARGET GRIDNO - //pSoldier->sTargetGridNo = sGridNo; + //this->sTargetGridNo = sGridNo; // CHANGE TO ANIMATION - EVENT_InitNewSoldierAnim( pSoldier, GOTO_REPAIRMAN, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( GOTO_REPAIRMAN, 0 , FALSE ); // SET BUDDY'S ASSIGNMENT TO REPAIR... // Are we a SAM site? ( 3 == SAM ) if ( bRepairItem == 3 ) { - SetSoldierAssignment( pSoldier, REPAIR, TRUE, FALSE, -1 ); + SetSoldierAssignment( this, REPAIR, TRUE, FALSE, -1 ); } else if ( bRepairItem == 2 ) // ( 2 == VEHICLE ) { - SetSoldierAssignment( pSoldier, REPAIR, FALSE, FALSE, ubID ); + SetSoldierAssignment( this, REPAIR, FALSE, FALSE, ubID ); } } } -void EVENT_SoldierBeginRefuel( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection ) +void SOLDIERTYPE::EVENT_SoldierBeginRefuel( INT16 sGridNo, UINT8 ubDirection ) { INT8 bRefuelItem; UINT8 ubID; @@ -11446,48 +12261,48 @@ void EVENT_SoldierBeginRefuel( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDir if ( bRefuelItem ) { // CHANGE DIRECTION AND GOTO ANIMATION NOW - EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection ); - EVENT_SetSoldierDirection( pSoldier, ubDirection ); + this->EVENT_SetSoldierDesiredDirection( ubDirection ); + this->EVENT_SetSoldierDirection( ubDirection ); //BOOLEAN CutWireFence( INT16 sGridNo ) // SET TARGET GRIDNO - //pSoldier->sTargetGridNo = sGridNo; + //this->sTargetGridNo = sGridNo; // CHANGE TO ANIMATION - EVENT_InitNewSoldierAnim( pSoldier, REFUEL_VEHICLE, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( REFUEL_VEHICLE, 0 , FALSE ); // SET BUDDY'S ASSIGNMENT TO REPAIR... } } -void EVENT_SoldierBeginTakeBlood( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection ) +void SOLDIERTYPE::EVENT_SoldierBeginTakeBlood( INT16 sGridNo, UINT8 ubDirection ) { ROTTING_CORPSE *pCorpse; // See if these is a corpse here.... - pCorpse = GetCorpseAtGridNo( sGridNo , pSoldier->bLevel ); + pCorpse = GetCorpseAtGridNo( sGridNo , this->pathing.bLevel ); if ( pCorpse != NULL ) { - pSoldier->uiPendingActionData4 = pCorpse->iID; + this->aiData.uiPendingActionData4 = pCorpse->iID; // CHANGE DIRECTION AND GOTO ANIMATION NOW - EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection ); - EVENT_SetSoldierDirection( pSoldier, ubDirection ); + this->EVENT_SetSoldierDesiredDirection( ubDirection ); + this->EVENT_SetSoldierDirection( ubDirection ); - EVENT_InitNewSoldierAnim( pSoldier, TAKE_BLOOD_FROM_CORPSE, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( TAKE_BLOOD_FROM_CORPSE, 0 , FALSE ); } else { // Say NOTHING quote... - DoMercBattleSound( pSoldier, BATTLE_SOUND_NOTHING ); + this->DoMercBattleSound( BATTLE_SOUND_NOTHING ); } } -void EVENT_SoldierBeginAttachCan( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection ) +void SOLDIERTYPE::EVENT_SoldierBeginAttachCan( INT16 sGridNo, UINT8 ubDirection ) { STRUCTURE * pStructure; DOOR_STATUS * pDoorStatus; @@ -11495,7 +12310,7 @@ void EVENT_SoldierBeginAttachCan( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ub // OK, find door, attach to door, do animation...., remove item.... // First make sure we still have item in hand.... - if ( !Item[pSoldier->inv[ HANDPOS ].usItem].canandstring ) + if ( !Item[this->inv[ HANDPOS ].usItem].canandstring ) { return; } @@ -11516,7 +12331,7 @@ void EVENT_SoldierBeginAttachCan( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ub else { ModifyDoorStatus( sGridNo, TRUE, TRUE ); - } + } // Now get door status... pDoorStatus = GetDoorStatus( sGridNo ); @@ -11530,126 +12345,126 @@ void EVENT_SoldierBeginAttachCan( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ub pDoorStatus->ubFlags |= DOOR_HAS_TIN_CAN; // Do animation - EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection ); - EVENT_SetSoldierDirection( pSoldier, ubDirection ); + this->EVENT_SetSoldierDesiredDirection( ubDirection ); + this->EVENT_SetSoldierDirection( ubDirection ); - EVENT_InitNewSoldierAnim( pSoldier, ATTACH_CAN_TO_STRING, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( ATTACH_CAN_TO_STRING, 0 , FALSE ); // Remove item... - DeleteObj( &(pSoldier->inv[ HANDPOS ] ) ); + this->inv[ HANDPOS ].RemoveObjectsFromStack(1); fInterfacePanelDirty = DIRTYLEVEL2; } -void EVENT_SoldierBeginReloadRobot( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection, UINT8 ubMercSlot ) +void SOLDIERTYPE::EVENT_SoldierBeginReloadRobot( INT16 sGridNo, UINT8 ubDirection, UINT8 ubMercSlot ) { UINT8 ubPerson; // Make sure we have a robot here.... - ubPerson = WhoIsThere2( sGridNo, pSoldier->bLevel ); + ubPerson = WhoIsThere2( sGridNo, this->pathing.bLevel ); - if ( ubPerson != NOBODY && MercPtrs[ ubPerson ]->uiStatusFlags & SOLDIER_ROBOT ) + if ( ubPerson != NOBODY && MercPtrs[ ubPerson ]->flags.uiStatusFlags & SOLDIER_ROBOT ) { // CHANGE DIRECTION AND GOTO ANIMATION NOW - EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection ); - EVENT_SetSoldierDirection( pSoldier, ubDirection ); + this->EVENT_SetSoldierDesiredDirection( ubDirection ); + this->EVENT_SetSoldierDirection( ubDirection ); // CHANGE TO ANIMATION - EVENT_InitNewSoldierAnim( pSoldier, RELOAD_ROBOT, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( RELOAD_ROBOT, 0 , FALSE ); } } -void ResetSoldierChangeStatTimer( SOLDIERTYPE *pSoldier ) +void SOLDIERTYPE::ResetSoldierChangeStatTimer( void ) { - pSoldier->uiChangeLevelTime = 0; - pSoldier->uiChangeHealthTime = 0; - pSoldier->uiChangeStrengthTime= 0; - pSoldier->uiChangeDexterityTime= 0; - pSoldier->uiChangeAgilityTime= 0; - pSoldier->uiChangeWisdomTime= 0; - pSoldier->uiChangeLeadershipTime= 0; - pSoldier->uiChangeMarksmanshipTime= 0; - pSoldier->uiChangeExplosivesTime= 0; - pSoldier->uiChangeMedicalTime= 0; - pSoldier->uiChangeMechanicalTime= 0; + this->timeChanges.uiChangeLevelTime = 0; + this->timeChanges.uiChangeHealthTime = 0; + this->timeChanges.uiChangeStrengthTime= 0; + this->timeChanges.uiChangeDexterityTime= 0; + this->timeChanges.uiChangeAgilityTime= 0; + this->timeChanges.uiChangeWisdomTime= 0; + this->timeChanges.uiChangeLeadershipTime= 0; + this->timeChanges.uiChangeMarksmanshipTime= 0; + this->timeChanges.uiChangeExplosivesTime= 0; + this->timeChanges.uiChangeMedicalTime= 0; + this->timeChanges.uiChangeMechanicalTime= 0; return; } -void ChangeToFlybackAnimation( SOLDIERTYPE *pSoldier, UINT8 ubDirection ) +void SOLDIERTYPE::ChangeToFlybackAnimation( UINT8 flyBackDirection ) { - INT16 sNewGridNo; UINT8 ubOppositeDir; INT16 sDirectionInc; + INT16 sNewGridNo; - ubOppositeDir = gOppositeDirection[ ubDirection ]; + ubOppositeDir = gOppositeDirection[ flyBackDirection ]; sDirectionInc = DirectionInc( ubOppositeDir); // Get dest gridno, convert to center coords - sNewGridNo = NewGridNo( pSoldier->sGridNo, sDirectionInc ); - if ( gubWorldMovementCosts[ sNewGridNo ][ ubOppositeDir ][ pSoldier->bLevel ] >= TRAVELCOST_BLOCKED ) + sNewGridNo = NewGridNo( this->sGridNo, sDirectionInc ); + if ( gubWorldMovementCosts[ sNewGridNo ][ ubOppositeDir ][ this->pathing.bLevel ] >= TRAVELCOST_BLOCKED ) { // No room to fly back. Pretend we hit the wall and fall forward instead - BeginTyingToFall( pSoldier ); - ChangeSoldierState( pSoldier, FALLFORWARD_FROMHIT_STAND, 0, FALSE ); + this->BeginTyingToFall(); + this->ChangeSoldierState( FALLFORWARD_FROMHIT_STAND, 0, FALSE ); return; } sNewGridNo = NewGridNo( sNewGridNo, sDirectionInc ); - if ( gubWorldMovementCosts[ sNewGridNo ][ ubOppositeDir ][ pSoldier->bLevel ] >= TRAVELCOST_BLOCKED ) + if ( gubWorldMovementCosts[ sNewGridNo ][ ubOppositeDir ][ this->pathing.bLevel ] >= TRAVELCOST_BLOCKED ) { // No room to fly back. Fall back instead - BeginTyingToFall( pSoldier ); - ChangeSoldierState( pSoldier, FALLBACK_HIT_STAND, 0, FALSE ); + this->BeginTyingToFall(); + this->ChangeSoldierState( FALLBACK_HIT_STAND, 0, FALSE ); } // Remove any previous actions - pSoldier->ubPendingAction = NO_PENDING_ACTION; + this->aiData.ubPendingAction = NO_PENDING_ACTION; - pSoldier->sPlotSrcGrid = pSoldier->sGridNo; + this->sPlotSrcGrid = this->sGridNo; // Since we're manually setting our path, we have to reset these @#$@# flags too. Otherwise we don't reach the // destination a lot of the time - pSoldier->fPastXDest = 0; - pSoldier->fPastYDest = 0; + this->flags.fPastXDest = 0; + this->flags.fPastYDest = 0; // Set path.... - pSoldier->usPathDataSize = 0; - pSoldier->usPathIndex = 0; - pSoldier->usPathingData[ pSoldier->usPathDataSize ] = ubOppositeDir; - pSoldier->usPathDataSize++; - pSoldier->usPathingData[ pSoldier->usPathDataSize ] = ubOppositeDir; - pSoldier->usPathDataSize++; - pSoldier->sFinalDestination = sNewGridNo; - EVENT_InternalSetSoldierDestination( pSoldier, (UINT8) pSoldier->usPathingData[ pSoldier->usPathIndex ], FALSE, FLYBACK_HIT ); + this->pathing.usPathDataSize = 0; + this->pathing.usPathIndex = 0; + this->pathing.usPathingData[ this->pathing.usPathDataSize ] = gOppositeDirection[ this->ubDirection ]; + this->pathing.usPathDataSize++; + this->pathing.usPathingData[ this->pathing.usPathDataSize ] = gOppositeDirection[ this->ubDirection ]; + this->pathing.usPathDataSize++; + this->pathing.sFinalDestination = sNewGridNo; + this->EVENT_InternalSetSoldierDestination( (UINT8) this->pathing.usPathingData[ this->pathing.usPathIndex ], FALSE, FLYBACK_HIT ); // Get a new direction based on direction - EVENT_InitNewSoldierAnim( pSoldier, FLYBACK_HIT, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( FLYBACK_HIT, 0 , FALSE ); } -void ChangeToFallbackAnimation( SOLDIERTYPE *pSoldier, UINT8 ubDirection ) +void SOLDIERTYPE::ChangeToFallbackAnimation( UINT8 fallBackDirection ) { INT16 sNewGridNo; UINT8 ubOppositeDir; INT16 sDirection; - ubOppositeDir = gOppositeDirection[ ubDirection ]; + ubOppositeDir = gOppositeDirection[ fallBackDirection ]; sDirection = DirectionInc( ubOppositeDir); // Get dest gridno, convert to center coords - sNewGridNo = NewGridNo( pSoldier->sGridNo, sDirection ); - if ( gubWorldMovementCosts[ sNewGridNo ][ ubOppositeDir ][ pSoldier->bLevel ] >= TRAVELCOST_BLOCKED ) + sNewGridNo = NewGridNo( this->sGridNo, sDirection ); + if ( gubWorldMovementCosts[ sNewGridNo ][ ubOppositeDir ][ this->pathing.bLevel ] >= TRAVELCOST_BLOCKED ) { // No room to fly back. Pretend we hit the wall and fall forward instead - BeginTyingToFall( pSoldier ); - ChangeSoldierState( pSoldier, FALLFORWARD_FROMHIT_STAND, 0, FALSE ); + this->BeginTyingToFall(); + this->ChangeSoldierState( FALLFORWARD_FROMHIT_STAND, 0, FALSE ); return; } @@ -11658,33 +12473,32 @@ void ChangeToFallbackAnimation( SOLDIERTYPE *pSoldier, UINT8 ubDirection ) //usNewGridNo = NewGridNo( (UINT16)usNewGridNo, (UINT16)(-1 * DirectionInc( bDirection ) ) ); // Remove any previous actions - pSoldier->ubPendingAction = NO_PENDING_ACTION; + this->aiData.ubPendingAction = NO_PENDING_ACTION; - pSoldier->sPlotSrcGrid = pSoldier->sGridNo; + this->sPlotSrcGrid = this->sGridNo; // Since we're manually setting our path, we have to reset these @#$@# flags too. Otherwise we don't reach the // destination a lot of the time - pSoldier->fPastXDest = 0; - pSoldier->fPastYDest = 0; + this->flags.fPastXDest = 0; + this->flags.fPastYDest = 0; // Set path.... - pSoldier->usPathDataSize = 0; - pSoldier->usPathIndex = 0; - pSoldier->usPathingData[ pSoldier->usPathDataSize ] = ubOppositeDir; - pSoldier->usPathDataSize++; - pSoldier->sFinalDestination = sNewGridNo; - //pSoldier->sFinalDestination = pSoldier->sGridNo; - EVENT_InternalSetSoldierDestination( pSoldier, ubOppositeDir, FALSE, FALLBACK_HIT_STAND ); + this->pathing.usPathDataSize = 0; + this->pathing.usPathIndex = 0; + this->pathing.usPathingData[ this->pathing.usPathDataSize ] = gOppositeDirection[ this->ubDirection ]; + this->pathing.usPathDataSize++; + this->pathing.sFinalDestination = sNewGridNo; + this->EVENT_InternalSetSoldierDestination( this->pathing.usPathingData[ this->pathing.usPathIndex ], FALSE, FALLBACK_HIT_STAND ); // Get a new direction based on direction - EVENT_InitNewSoldierAnim( pSoldier, FALLBACK_HIT_STAND, 0 , FALSE ); + this->EVENT_InitNewSoldierAnim( FALLBACK_HIT_STAND, 0 , FALSE ); } -void SetSoldierCowerState( SOLDIERTYPE *pSoldier, BOOLEAN fOn ) +void SOLDIERTYPE::SetSoldierCowerState( BOOLEAN fOn ) { // Robot's don't cower! - if ( pSoldier->ubBodyType == ROBOTNOWEAPON ) + if ( this->ubBodyType == ROBOTNOWEAPON ) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("ERROR: Robot was told to cower!" ) ); return; @@ -11693,24 +12507,24 @@ void SetSoldierCowerState( SOLDIERTYPE *pSoldier, BOOLEAN fOn ) // OK< set flag and do anim... if ( fOn ) { - if ( !( pSoldier->uiStatusFlags & SOLDIER_COWERING ) ) + if ( !( this->flags.uiStatusFlags & SOLDIER_COWERING ) ) { - EVENT_InitNewSoldierAnim( pSoldier, START_COWER, 0, FALSE ); + this->EVENT_InitNewSoldierAnim( START_COWER, 0, FALSE ); - pSoldier->uiStatusFlags |= SOLDIER_COWERING; + this->flags.uiStatusFlags |= SOLDIER_COWERING; - pSoldier->ubDesiredHeight = ANIM_CROUCH; + this->ubDesiredHeight = ANIM_CROUCH; } } else { - if ( (pSoldier->uiStatusFlags & SOLDIER_COWERING) || (gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND) ) + if ( (this->flags.uiStatusFlags & SOLDIER_COWERING) || (gAnimControl[ this->usAnimState ].ubEndHeight != ANIM_STAND) ) { - EVENT_InitNewSoldierAnim( pSoldier, END_COWER, 0, FALSE ); + this->EVENT_InitNewSoldierAnim( END_COWER, 0, FALSE ); - pSoldier->uiStatusFlags &= (~SOLDIER_COWERING ); + this->flags.uiStatusFlags &= (~SOLDIER_COWERING ); - pSoldier->ubDesiredHeight = ANIM_STAND; + this->ubDesiredHeight = ANIM_STAND; } } } @@ -11724,16 +12538,16 @@ void MercStealFromMerc( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pTarget ) // OK, find an adjacent gridno.... sGridNo = pTarget->sGridNo; - // See if we can get there to punch + // See if we can get there to punch sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); if ( sActionGridNo != -1 ) { // SEND PENDING ACTION - pSoldier->ubPendingAction = MERC_STEAL; - pSoldier->bTargetLevel = pTarget->bLevel; // 0verhaul: Update the level too! - pSoldier->sPendingActionData2 = pTarget->sGridNo; - pSoldier->bPendingActionData3 = ubDirection; - pSoldier->ubPendingActionAnimCount = 0; + pSoldier->aiData.ubPendingAction = MERC_STEAL; + pSoldier->bTargetLevel = pTarget->pathing.bLevel; // Overhaul: Update the level too! + pSoldier->aiData.sPendingActionData2 = pTarget->sGridNo; + pSoldier->aiData.bPendingActionData3 = ubDirection; + pSoldier->aiData.ubPendingActionAnimCount = 0; // CHECK IF WE ARE AT THIS GRIDNO NOW if ( pSoldier->sGridNo != sActionGridNo ) @@ -11743,12 +12557,12 @@ void MercStealFromMerc( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pTarget ) } else { - EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection ); - EVENT_InitNewSoldierAnim( pSoldier, STEAL_ITEM, 0 , FALSE ); + pSoldier->EVENT_SetSoldierDesiredDirection( ubDirection ); + pSoldier->EVENT_InitNewSoldierAnim( STEAL_ITEM, 0 , FALSE ); } // OK, set UI - // gTacticalStatus.ubAttackBusyCount++; +// gTacticalStatus.ubAttackBusyCount++; // reset attacking item (hand) pSoldier->usAttackingWeapon = 0; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("!!!!!!! Starting STEAL attack, attack count now %d", gTacticalStatus.ubAttackBusyCount) ); @@ -11758,8 +12572,8 @@ void MercStealFromMerc( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pTarget ) } } -SOLDIERTYPE *pTMilitiaSoldier; -BOOLEAN PlayerSoldierStartTalking( SOLDIERTYPE *pSoldier, UINT8 ubTargetID, BOOLEAN fValidate ) +SOLDIERTYPE *pTMilitiaSoldier;//global pointer +BOOLEAN SOLDIERTYPE::PlayerSoldierStartTalking( UINT8 ubTargetID, BOOLEAN fValidate ) { INT16 sFacingDir, sXPos, sYPos, sAPCost; SOLDIERTYPE *pTSoldier; @@ -11780,9 +12594,9 @@ BOOLEAN PlayerSoldierStartTalking( SOLDIERTYPE *pSoldier, UINT8 ubTargetID, BOOL if ( !IsValidTalkableNPC( (UINT8)ubTargetID, FALSE, FALSE, FALSE ) ) { return( FALSE ); - } + } - uiRange = GetRangeFromGridNoDiff( pSoldier->sGridNo, pTSoldier->sGridNo ); + uiRange = GetRangeFromGridNoDiff( this->sGridNo, pTSoldier->sGridNo ); if ( uiRange > ( NPC_TALK_RADIUS * 2 ) ) { @@ -11801,26 +12615,26 @@ BOOLEAN PlayerSoldierStartTalking( SOLDIERTYPE *pSoldier, UINT8 ubTargetID, BOOL ConvertGridNoToXY( pTSoldier->sGridNo, &sXPos, &sYPos ); // Get direction from mouse pos - sFacingDir = GetDirectionFromXY( sXPos, sYPos, pSoldier ); + sFacingDir = GetDirectionFromXY( sXPos, sYPos, this ); // Set our guy facing - SendSoldierSetDesiredDirectionEvent( pSoldier, sFacingDir ); + SendSoldierSetDesiredDirectionEvent( this, sFacingDir ); // Set NPC facing SendSoldierSetDesiredDirectionEvent( pTSoldier, gOppositeDirection[ sFacingDir ] ); // Stop our guys... - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + this->EVENT_StopMerc( this->sGridNo, this->ubDirection ); } pTMilitiaSoldier = pTSoldier; //lal - //lal + //lal // ATE; Check for normal civs... if ( GetCivType( pTSoldier ) != CIV_TYPE_NA ) { //lal - if ( ( pTSoldier->bTeam == MILITIA_TEAM ) && ( gGameExternalOptions.fAllowTacticalMilitiaCommand == TRUE ) && (pSoldier->bSide == pTSoldier->bSide) ) + if ( ( pTSoldier->bTeam == MILITIA_TEAM ) && ( gGameExternalOptions.fAllowTacticalMilitiaCommand == TRUE ) && (this->bSide == pTSoldier->bSide) ) { PopupMilitiaControlMenu( pTSoldier ); return( FALSE ); @@ -11828,7 +12642,7 @@ BOOLEAN PlayerSoldierStartTalking( SOLDIERTYPE *pSoldier, UINT8 ubTargetID, BOOL else { // Deduct points from our guy.... - DeductPoints( pSoldier, sAPCost, 0 ); + DeductPoints( this, sAPCost, 0 ); StartCivQuote( pTSoldier ); return( FALSE ); @@ -11841,10 +12655,10 @@ BOOLEAN PlayerSoldierStartTalking( SOLDIERTYPE *pSoldier, UINT8 ubTargetID, BOOL // Are we an EPC that is being escorted? if ( pTSoldier->ubProfile != NO_PROFILE && pTSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC ) { - return( InitiateConversation( pTSoldier, pSoldier, APPROACH_EPC_WHO_IS_RECRUITED, 0 ) ); - //Converse( pTSoldier->ubProfile, pSoldier->ubProfile, APPROACH_EPC_WHO_IS_RECRUITED, 0 ); + return( InitiateConversation( pTSoldier, this, APPROACH_EPC_WHO_IS_RECRUITED, 0 ) ); + //Converse( pTSoldier->ubProfile, this->ubProfile, APPROACH_EPC_WHO_IS_RECRUITED, 0 ); } - else if (pTSoldier->bNeutral) + else if (pTSoldier->aiData.bNeutral) { switch( pTSoldier->ubProfile ) { @@ -11861,29 +12675,29 @@ BOOLEAN PlayerSoldierStartTalking( SOLDIERTYPE *pSoldier, UINT8 ubTargetID, BOOL break; default: // Start talking! - return( InitiateConversation( pTSoldier, pSoldier, NPC_INITIAL_QUOTE, 0 ) ); + return( InitiateConversation( pTSoldier, this, NPC_INITIAL_QUOTE, 0 ) ); break; } } else { // Start talking with hostile NPC - return( InitiateConversation( pTSoldier, pSoldier, APPROACH_ENEMY_NPC_QUOTE, 0 ) ); + return( InitiateConversation( pTSoldier, this, APPROACH_ENEMY_NPC_QUOTE, 0 ) ); } return( TRUE ); } -BOOLEAN IsValidSecondHandShot( SOLDIERTYPE *pSoldier ) +BOOLEAN SOLDIERTYPE::IsValidSecondHandShot( void ) { - if ( Item[ pSoldier->inv[ SECONDHANDPOS ].usItem ].usItemClass == IC_GUN && - !(Item[ pSoldier->inv[SECONDHANDPOS ].usItem ].twohanded ) && - !pSoldier->bDoBurst && - !Item[pSoldier->inv[ HANDPOS ].usItem].grenadelauncher && - Item[ pSoldier->inv[HANDPOS].usItem ].usItemClass == IC_GUN && - pSoldier->inv[SECONDHANDPOS].ItemData.Gun.bGunStatus >= USABLE && - pSoldier->inv[SECONDHANDPOS].ItemData.Gun.ubGunShotsLeft > 0 ) + if ( Item[ this->inv[ SECONDHANDPOS ].usItem ].usItemClass == IC_GUN && + !(Item[ this->inv[SECONDHANDPOS ].usItem ].twohanded ) && + !this->bDoBurst && + !Item[this->inv[ HANDPOS ].usItem].grenadelauncher && + Item[ this->inv[HANDPOS].usItem ].usItemClass == IC_GUN && + this->inv[SECONDHANDPOS][0]->data.gun.bGunStatus >= USABLE && + this->inv[SECONDHANDPOS][0]->data.gun.ubGunShotsLeft > 0 ) { return( TRUE ); } @@ -11891,17 +12705,17 @@ BOOLEAN IsValidSecondHandShot( SOLDIERTYPE *pSoldier ) return( FALSE ); } -BOOLEAN IsValidSecondHandShotForReloadingPurposes( SOLDIERTYPE *pSoldier ) +BOOLEAN SOLDIERTYPE::IsValidSecondHandShotForReloadingPurposes( void ) { // should be maintained as same as function above with line // about ammo taken out! - if ( Item[ pSoldier->inv[ SECONDHANDPOS ].usItem ].usItemClass == IC_GUN && - !pSoldier->bDoBurst && - !Item[pSoldier->inv[ HANDPOS ].usItem].grenadelauncher && - Item[ pSoldier->inv[HANDPOS].usItem ].usItemClass == IC_GUN && - pSoldier->inv[SECONDHANDPOS].ItemData.Gun.bGunStatus >= USABLE //&& - // pSoldier->inv[SECONDHANDPOS].ubGunShotsLeft > 0 && - // gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_PRONE ) + if ( Item[ this->inv[ SECONDHANDPOS ].usItem ].usItemClass == IC_GUN && + !this->bDoBurst && + !Item[this->inv[ HANDPOS ].usItem].grenadelauncher && + Item[ this->inv[HANDPOS].usItem ].usItemClass == IC_GUN && + this->inv[SECONDHANDPOS][0]->data.gun.bGunStatus >= USABLE //&& + // this->inv[SECONDHANDPOS][0]->data.gun.ubGunShotsLeft > 0 && + // gAnimControl[ this->usAnimState ].ubEndHeight != ANIM_PRONE ) ) { return( TRUE ); @@ -11912,25 +12726,25 @@ BOOLEAN IsValidSecondHandShotForReloadingPurposes( SOLDIERTYPE *pSoldier ) -BOOLEAN CanRobotBeControlled( SOLDIERTYPE *pSoldier ) +BOOLEAN SOLDIERTYPE::CanRobotBeControlled( void ) { SOLDIERTYPE *pController; - if ( !( pSoldier->uiStatusFlags & SOLDIER_ROBOT ) ) + if ( !( this->flags.uiStatusFlags & SOLDIER_ROBOT ) ) { return( FALSE ); } - if ( pSoldier->ubRobotRemoteHolderID == NOBODY ) + if ( this->ubRobotRemoteHolderID == NOBODY ) { return( FALSE ); } - pController = MercPtrs[ pSoldier->ubRobotRemoteHolderID ]; + pController = MercPtrs[ this->ubRobotRemoteHolderID ]; if ( pController->bActive ) { - if ( ControllingRobot( pController ) ) + if ( pController->ControllingRobot( ) ) { // ALL'S OK! return( TRUE ); @@ -11941,38 +12755,38 @@ BOOLEAN CanRobotBeControlled( SOLDIERTYPE *pSoldier ) } -BOOLEAN ControllingRobot( SOLDIERTYPE *pSoldier ) +BOOLEAN SOLDIERTYPE::ControllingRobot( void ) { SOLDIERTYPE *pRobot; INT8 bPos; - if ( !pSoldier->bActive ) + if ( !this->bActive ) { return( FALSE ); } // EPCs can't control the robot (no inventory to hold remote, for one) - if ( AM_AN_EPC( pSoldier ) ) + if ( AM_AN_EPC( this ) ) { return( FALSE ); } - // Don't require pSoldier->bInSector here, it must work from mapscreen! + // Don't require this->bInSector here, it must work from mapscreen! // are we in ok shape? - if ( pSoldier->bLife < OKLIFE || ( pSoldier->bTeam != gbPlayerNum ) ) + if ( this->stats.bLife < OKLIFE || ( this->bTeam != gbPlayerNum ) ) { return( FALSE ); } // allow control from within vehicles - allows strategic travel in a vehicle with robot! - if ( ( pSoldier->bAssignment >= ON_DUTY ) && ( pSoldier->bAssignment != VEHICLE ) ) + if ( ( this->bAssignment >= ON_DUTY ) && ( this->bAssignment != VEHICLE ) ) { return( FALSE ); } // is the soldier wearing a robot remote control? - bPos = FindRemoteControl( pSoldier ); + bPos = FindRemoteControl( this ); if ( bPos == NO_SLOT ) { return( FALSE ); @@ -11989,24 +12803,24 @@ BOOLEAN ControllingRobot( SOLDIERTYPE *pSoldier ) { // Are we in the same sector....? // ARM: CHANGED TO WORK IN MAPSCREEN, DON'T USE WorldSector HERE - if ( pRobot->sSectorX == pSoldier->sSectorX && - pRobot->sSectorY == pSoldier->sSectorY && - pRobot->bSectorZ == pSoldier->bSectorZ ) + if ( pRobot->sSectorX == this->sSectorX && + pRobot->sSectorY == this->sSectorY && + pRobot->bSectorZ == this->bSectorZ ) { // they have to be either both in sector, or both on the road - if ( pRobot->fBetweenSectors == pSoldier->fBetweenSectors ) + if ( pRobot->flags.fBetweenSectors == this->flags.fBetweenSectors ) { // if they're on the road... - if ( pRobot->fBetweenSectors ) + if ( pRobot->flags.fBetweenSectors ) { // they have to be in the same squad or vehicle - if ( pRobot->bAssignment != pSoldier->bAssignment ) + if ( pRobot->bAssignment != this->bAssignment ) { return( FALSE ); } // if in a vehicle, must be the same vehicle - if ( pRobot->bAssignment == VEHICLE && ( pRobot->iVehicleId != pSoldier->iVehicleId ) ) + if ( pRobot->bAssignment == VEHICLE && ( pRobot->iVehicleId != this->iVehicleId ) ) { return( FALSE ); } @@ -12022,34 +12836,36 @@ BOOLEAN ControllingRobot( SOLDIERTYPE *pSoldier ) } -SOLDIERTYPE *GetRobotController( SOLDIERTYPE *pSoldier ) +SOLDIERTYPE *SOLDIERTYPE::GetRobotController( void ) { - if ( pSoldier->ubRobotRemoteHolderID == NOBODY ) + if ( this->ubRobotRemoteHolderID == NOBODY ) { return( NULL ); } else { - return( MercPtrs[ pSoldier->ubRobotRemoteHolderID ] ); + return( MercPtrs[ this->ubRobotRemoteHolderID ] ); } } -void UpdateRobotControllerGivenRobot( SOLDIERTYPE *pRobot ) +void SOLDIERTYPE::UpdateRobotControllerGivenRobot( void ) { + //the original function passed in pRobot, not pSoldier + SOLDIERTYPE *pRobot = this; SOLDIERTYPE *pTeamSoldier; INT32 cnt = 0; // Loop through guys and look for a controller! // set up soldier ptr as first element in mercptrs list - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pTeamSoldier++) { if ( pTeamSoldier->bActive ) { - if ( ControllingRobot( pTeamSoldier ) ) + if ( pTeamSoldier->ControllingRobot( ) ) { pRobot->ubRobotRemoteHolderID = pTeamSoldier->ubID; return; @@ -12061,49 +12877,49 @@ void UpdateRobotControllerGivenRobot( SOLDIERTYPE *pRobot ) } -void UpdateRobotControllerGivenController( SOLDIERTYPE *pSoldier ) +void SOLDIERTYPE::UpdateRobotControllerGivenController( void ) { SOLDIERTYPE *pTeamSoldier; INT32 cnt = 0; // First see if are still controlling the robot - if ( !ControllingRobot( pSoldier ) ) + if ( !this->ControllingRobot( ) ) { return; } // set up soldier ptr as first element in mercptrs list - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // Loop through guys to find the robot.... for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pTeamSoldier++) { - if ( pTeamSoldier->bActive && ( pTeamSoldier->uiStatusFlags & SOLDIER_ROBOT ) ) + if ( pTeamSoldier->bActive && ( pTeamSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) ) { - pTeamSoldier->ubRobotRemoteHolderID = pSoldier->ubID; + pTeamSoldier->ubRobotRemoteHolderID = this->ubID; } } } -void HandleSoldierTakeDamageFeedback( SOLDIERTYPE *pSoldier ) +void SOLDIERTYPE::HandleSoldierTakeDamageFeedback( void ) { // Do sound..... - // if ( pSoldier->bLife >= CONSCIOUSNESS ) + // if ( this->stats.bLife >= CONSCIOUSNESS ) { // ATE: Limit how often we grunt... - if ( ( GetJA2Clock( ) - pSoldier->uiTimeSinceLastBleedGrunt ) > 1000 ) + if ( ( GetJA2Clock( ) - this->uiTimeSinceLastBleedGrunt ) > 1000 ) { - pSoldier->uiTimeSinceLastBleedGrunt = GetJA2Clock( ); + this->uiTimeSinceLastBleedGrunt = GetJA2Clock( ); - DoMercBattleSound( pSoldier, (INT8)( BATTLE_SOUND_HIT1 + Random( 2 ) ) ); + this->DoMercBattleSound( (INT8)( BATTLE_SOUND_HIT1 + Random( 2 ) ) ); } } // Flash portrait.... - pSoldier->fFlashPortrait = TRUE; - pSoldier->bFlashPortraitFrame = FLASH_PORTRAIT_STARTSHADE; - RESETTIMECOUNTER( pSoldier->PortraitFlashCounter, FLASH_PORTRAIT_DELAY ); + this->flags.fFlashPortrait = TRUE; + this->bFlashPortraitFrame = FLASH_PORTRAIT_STARTSHADE; + RESETTIMECOUNTER( this->timeCounters.PortraitFlashCounter, FLASH_PORTRAIT_DELAY ); } @@ -12116,30 +12932,29 @@ void HandleSystemNewAISituation( SOLDIERTYPE *pSoldier, BOOLEAN fResetABC ) // after the interrupt is triggered, so if the AI causes an interrupt and it's the player's turn, he will // continue doing what he was going to do. We need this function to work even when it's the player's turn, // at least in this case. - if ( gTacticalStatus.ubCurrentTeam != gbPlayerNum && pSoldier->bTeam != gbPlayerNum ) - //if ( pSoldier->bTeam != gbPlayerNum ) + //if ( gTacticalStatus.ubCurrentTeam != gbPlayerNum && pSoldier->bTeam != gbPlayerNum ) { - if ( pSoldier->bNewSituation == IS_NEW_SITUATION ) + if ( pSoldier->aiData.bNewSituation == IS_NEW_SITUATION ) { // Cancel what they were doing.... pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; pSoldier->usPendingAnimation2 = NO_PENDING_ANIMATION; - pSoldier->bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; + pSoldier->flags.bTurningFromPronePosition = FALSE; pSoldier->ubPendingDirection = NO_PENDING_DIRECTION; - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; pSoldier->bEndDoorOpenCode = 0; // if this guy isn't under direct AI control, WHO GIVES A FLYING FLICK? - if ( pSoldier->uiStatusFlags & SOLDIER_UNDERAICONTROL ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL ) { - if ( pSoldier->fTurningToShoot ) + if ( pSoldier->flags.fTurningToShoot ) { - pSoldier->fTurningToShoot = FALSE; - // Release attacker + pSoldier->flags.fTurningToShoot = FALSE; + // Release attacker // OK - this is hightly annoying , but due to the huge combinations of // things that can happen - 1 of them is that sLastTarget will get unset // after turn is done - so set flag here to tell it not to... - pSoldier->fDontUnsetLastTargetFromTurn = TRUE; + pSoldier->flags.fDontUnsetLastTargetFromTurn = TRUE; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Reducing attacker busy count..., ending fire because saw something: DONE IN SYSTEM NEW SITUATION") ); DebugAttackBusy( "@@@@@@@ Reducing attacker busy count..., ending fire because saw something: DONE IN SYSTEM NEW SITUATION\n" ); FreeUpAttacker( ); @@ -12149,8 +12964,7 @@ void HandleSystemNewAISituation( SOLDIERTYPE *pSoldier, BOOLEAN fResetABC ) { // Place it back into inv.... AutoPlaceObject( pSoldier, pSoldier->pTempObject, FALSE ); - MemFree( pSoldier->pTempObject ); - pSoldier->pTempObject = NULL; + OBJECTTYPE::DeleteMe( &pSoldier->pTempObject ); pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; pSoldier->usPendingAnimation2 = NO_PENDING_ANIMATION; @@ -12174,16 +12988,16 @@ void InternalPlaySoldierFootstepSound( SOLDIERTYPE * pSoldier ) UINT8 ubRandomMax = 4; // Determine if we are on the floor - if ( !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { if ( pSoldier->usAnimState == HOPFENCE ) { bVolume = HIGHVOLUME; } - if ( pSoldier->uiStatusFlags & SOLDIER_ROBOT ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) { - PlaySoldierJA2Sample( pSoldier->ubID, ROBOT_BEEP, RATE_11025, SoundVolume( bVolume, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, ROBOT_BEEP, RATE_11025, SoundVolume( bVolume, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); return; } @@ -12204,12 +13018,12 @@ void InternalPlaySoldierFootstepSound( SOLDIERTYPE * pSoldier ) { ubSoundBase = WALK_LEFT_ROAD; } - else if ( MercInShallowWater( pSoldier) ) + else if ( pSoldier->MercInShallowWater( ) ) { ubSoundBase = WATER_WALK1_IN; ubRandomMax = 2; } - else if ( MercInDeepWater( pSoldier) ) + else if ( pSoldier->MercInDeepWater( ) ) { ubSoundBase = SWIM_1; ubRandomMax = 2; @@ -12232,7 +13046,7 @@ void InternalPlaySoldierFootstepSound( SOLDIERTYPE * pSoldier ) bVolume = LOWVOLUME; } - PlaySoldierJA2Sample( pSoldier->ubID, ubSoundBase + pSoldier->ubLastFootPrintSound, RATE_11025, SoundVolume( bVolume, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, ubSoundBase + pSoldier->ubLastFootPrintSound, RATE_11025, SoundVolume( bVolume, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); } } } @@ -12296,15 +13110,15 @@ void DebugValidateSoldierData( ) // Loop through our team... cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) - { + { if ( pSoldier->bActive ) { // OK, first check for alive people // Don't do this check if we are a vehicle... - if ( pSoldier->bLife > 0 && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( pSoldier->stats.bLife > 0 && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { // Alive -- now check for proper group IDs - if ( pSoldier->ubGroupID == 0 && pSoldier->bAssignment != IN_TRANSIT && pSoldier->bAssignment != ASSIGNMENT_POW && !( pSoldier->uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) ) + if ( pSoldier->ubGroupID == 0 && pSoldier->bAssignment != IN_TRANSIT && pSoldier->bAssignment != ASSIGNMENT_POW && !( pSoldier->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) ) { // This is bad! swprintf( sString, L"Soldier Data Error: Soldier %d is alive but has a zero group ID.", cnt ); @@ -12319,7 +13133,7 @@ void DebugValidateSoldierData( ) } else { - if ( pSoldier->ubGroupID != 0 && ( pSoldier->uiStatusFlags & SOLDIER_DEAD ) ) + if ( pSoldier->ubGroupID != 0 && ( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) ) { // Dead guys should have 0 group IDs //swprintf( sString, L"GroupID Error: Soldier %d is dead but has a non-zero group ID.", cnt ); @@ -12359,28 +13173,29 @@ void DebugValidateSoldierData( ) -void BeginTyingToFall( SOLDIERTYPE *pSoldier ) +void SOLDIERTYPE::BeginTyingToFall( void ) { - pSoldier->bStartFallDir = pSoldier->ubDirection; - pSoldier->fTryingToFall = TRUE; + this->bStartFallDir = this->ubDirection; + this->flags.fTryingToFall = TRUE; - // Randomize direction + // Randomize direction if ( Random( 50 ) < 25 ) { - pSoldier->fFallClockwise = TRUE; + this->flags.fFallClockwise = TRUE; } else { - pSoldier->fFallClockwise = FALSE; + this->flags.fFallClockwise = FALSE; } } -void SetSoldierAsUnderAiControl( SOLDIERTYPE *pSoldierToSet ) +void SOLDIERTYPE::SetSoldierAsUnderAiControl( void ) { SOLDIERTYPE *pSoldier=NULL; INT32 cnt; - if ( pSoldierToSet == NULL ) + //this is silly, but left over from when pSoldierToSet was passed in as a parameter + if ( this == NULL ) { return; } @@ -12388,14 +13203,14 @@ void SetSoldierAsUnderAiControl( SOLDIERTYPE *pSoldierToSet ) // Loop through ALL teams... cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ LAST_TEAM ].bLastID; cnt++,pSoldier++) - { + { if( pSoldier->bActive ) { - pSoldier->uiStatusFlags &= ~SOLDIER_UNDERAICONTROL; + pSoldier->flags.uiStatusFlags &= ~SOLDIER_UNDERAICONTROL; } } - pSoldierToSet->uiStatusFlags |= SOLDIER_UNDERAICONTROL; + this->flags.uiStatusFlags |= SOLDIER_UNDERAICONTROL; } void HandlePlayerTogglingLightEffects( BOOLEAN fToggleValue ) @@ -12426,18 +13241,18 @@ void EnableDisableSoldierLightEffects( BOOLEAN fEnableLights ) for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++,pSoldier++) { //if the soldier is in the sector - if( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife >= OKLIFE ) + if( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE ) { //if we are to enable the lights if( fEnableLights ) { //Add the light around the merc - PositionSoldierLight( pSoldier ); + pSoldier->PositionSoldierLight( ); } else { //Delete the fake light the merc casts - DeleteSoldierLight( pSoldier ); + pSoldier->DeleteSoldierLight( ); //Light up the merc though SetSoldierPersonalLightLevel( pSoldier ); @@ -12458,7 +13273,7 @@ void SetSoldierPersonalLightLevel( SOLDIERTYPE *pSoldier ) return; } - //The light level for the soldier + //THe light level for the soldier gpWorldLevelData[pSoldier->sGridNo].pMercHead->ubShadeLevel = 3; gpWorldLevelData[pSoldier->sGridNo].pMercHead->ubSumLights = 5; gpWorldLevelData[pSoldier->sGridNo].pMercHead->ubMaxLights = 5; diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index c7ebdbb5..33fe0741 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -2,9 +2,9 @@ #define __SOLDER_CONTROL_H -//Kris: November 10, 1997 -//Please don't change this value from 10. It will invalidate all of the maps and soldiers. -#define MAXPATROLGRIDS 10 // *** THIS IS A DUPLICATION - MUST BE MOVED ! +//Kris: November 10, 1997 +//Please don't change this value from 10. It will invalidate all of the maps and soldiers. +#define MAXPATROLGRIDS 10 // *** THIS IS A DUPLICATION - MUST BE MOVED ! #include "Animation Cache.h" #include "Timer Control.h" @@ -12,24 +12,25 @@ #include "Overhead Types.h" #include "Item Types.h" #include "worlddef.h" - -// WDS - Clean up inventory handling #include #include -using namespace std; +#define PTR_CIVILIAN (pSoldier->bTeam == CIV_TEAM) +#define PTR_CROUCHED (gAnimControl[ pSoldier->usAnimState ].ubHeight == ANIM_CROUCH) +#define PTR_STANDING (gAnimControl[ pSoldier->usAnimState ].ubHeight == ANIM_STAND) +#define PTR_PRONE (gAnimControl[ pSoldier->usAnimState ].ubHeight == ANIM_PRONE) + - // TEMP VALUES FOR NAMES #define MAXCIVLASTNAMES 30 extern UINT16 CivLastNames[MAXCIVLASTNAMES][10]; // ANDREW: these are defines for OKDestanation usage - please move to approprite file -#define IGNOREPEOPLE 0 -#define PEOPLETOO 1 -#define ALLPEOPLE 2 -#define FALLINGTEST 3 +#define IGNOREPEOPLE 0 +#define PEOPLETOO 1 +#define ALLPEOPLE 2 +#define FALLINGTEST 3 #define LOCKED_NO_NEWGRIDNO 2 @@ -47,7 +48,7 @@ extern UINT16 CivLastNames[MAXCIVLASTNAMES][10]; #define TAKE_DAMAGE_GAS 8 #define TAKE_DAMAGE_TENTACLES 9 #define TAKE_DAMAGE_STRUCTURE_EXPLOSION 10 -#define TAKE_DAMAGE_OBJECT 11 +#define TAKE_DAMAGE_OBJECT 11 #define SOLDIER_UNBLIT_SIZE (75*75*2) @@ -103,8 +104,8 @@ extern UINT16 CivLastNames[MAXCIVLASTNAMES][10]; #define SOLDIER_TRAIT_MARTIALARTS 0x0800 #define SOLDIER_TRAIT_KNIFING 0x1000 */ -#define HAS_SKILL_TRAIT( s, t ) (s->ubSkillTrait1 == t || s->ubSkillTrait2 == t) -#define NUM_SKILL_TRAITS( s, t ) ( (s->ubSkillTrait1 == t) ? ( (s->ubSkillTrait2 == t) ? 2 : 1 ) : ( (s->ubSkillTrait2 == t) ? 1 : 0 ) ) +#define HAS_SKILL_TRAIT( s, t ) (s->stats.ubSkillTrait1 == t || s->stats.ubSkillTrait2 == t) +#define NUM_SKILL_TRAITS( s, t ) ( (s->stats.ubSkillTrait1 == t) ? ( (s->stats.ubSkillTrait2 == t) ? 2 : 1 ) : ( (s->stats.ubSkillTrait2 == t) ? 1 : 0 ) ) #define SOLDIER_QUOTE_SAID_IN_SHIT 0x0001 #define SOLDIER_QUOTE_SAID_LOW_BREATH 0x0002 @@ -149,9 +150,9 @@ extern UINT16 CivLastNames[MAXCIVLASTNAMES][10]; #define NOBLOOD MAXBLOOD #define BLOODTIME 5 #define FOOTPRINTTIME 2 -#define MIN_BLEEDING_THRESHOLD 12 // you're OK while <4 Yellow life bars +#define MIN_BLEEDING_THRESHOLD 12 // you're OK while <4 Yellow life bars -#define BANDAGED( s ) (s->bLifeMax - s->bLife - s->bBleeding) +#define BANDAGED( s ) (s->stats.bLifeMax - s->stats.bLife - s->bBleeding) // amount of time a stats is to be displayed differently, due to change #define CHANGE_STAT_RECENTLY_DURATION 60000 @@ -197,7 +198,7 @@ enum MERC_RELOADROBOT, MERC_TAKEBLOOD, MERC_ATTACH_CAN, - MERC_FUEL_VEHICLE, + MERC_FUEL_VEHICLE, }; // ENUMERATIONS FOR THROW ACTIONS @@ -241,13 +242,9 @@ enum MERC_TYPE__NPC, MERC_TYPE__EPC, MERC_TYPE__NPC_WITH_UNEXTENDABLE_CONTRACT, - MERC_TYPE__VEHICLE, + MERC_TYPE__VEHICLE, }; -// I don't care if this isn't intuitive! The hand positions go right -// before the big pockets so we can loop through them that way. --CJC -#define NO_SLOT -1 - // vehicle/human path structure struct path { @@ -262,58 +259,6 @@ struct path typedef struct path PathSt; typedef PathSt *PathStPtr; -enum { - HELMETPOS = 0, - VESTPOS, - LEGPOS, - HEAD1POS, - HEAD2POS, - HANDPOS, - SECONDHANDPOS, - BIGPOCK1POS, - BIGPOCK2POS, - BIGPOCK3POS, - BIGPOCK4POS, - SMALLPOCK1POS, - SMALLPOCK2POS, - SMALLPOCK3POS, - SMALLPOCK4POS, - SMALLPOCK5POS, - SMALLPOCK6POS, - SMALLPOCK7POS, - SMALLPOCK8POS, // = 18, so 19 pockets needed - - NUM_INV_SLOTS, -}; - -// WDS - Clean up inventory handling -// NOTE NOTE NOTE! Leave this alone until it is no longer needed. It must match the -// original definition so old files can be read. -namespace OldInventory { -enum { - HELMETPOS = 0, - VESTPOS, - LEGPOS, - HEAD1POS, - HEAD2POS, - HANDPOS, - SECONDHANDPOS, - BIGPOCK1POS, - BIGPOCK2POS, - BIGPOCK3POS, - BIGPOCK4POS, - SMALLPOCK1POS, - SMALLPOCK2POS, - SMALLPOCK3POS, - SMALLPOCK4POS, - SMALLPOCK5POS, - SMALLPOCK6POS, - SMALLPOCK7POS, - SMALLPOCK8POS, // = 18, so 19 pockets needed - - NUM_INV_SLOTS, -}; -}; //used for color codes, but also shows the enemy type for debugging purposes enum @@ -333,9 +278,9 @@ enum #define SOLDIER_CLASS_MILITIA( bSoldierClass ) ( ( bSoldierClass >= SOLDIER_CLASS_GREEN_MILITIA ) && ( bSoldierClass <= SOLDIER_CLASS_ELITE_MILITIA ) ) // This macro should be used whenever we want to see if someone is neutral -// IF WE ARE CONSIDERING ATTACKING THEM. Creatures & bloodcats will attack neutrals +// IF WE ARE CONSIDERING ATTACKING THEM. Creatures & bloodcats will attack neutrals // but they can't attack empty vehicles!! -#define CONSIDERED_NEUTRAL( me, them ) ( (them->bNeutral) && ( me->bTeam != CREATURE_TEAM || (them->uiStatusFlags & SOLDIER_VEHICLE) ) ) +#define CONSIDERED_NEUTRAL( me, them ) ( (them->aiData.bNeutral) && ( me->bTeam != CREATURE_TEAM || (them->flags.uiStatusFlags & SOLDIER_VEHICLE) ) ) typedef struct { @@ -376,68 +321,1068 @@ enum }; -// WDS - Clean up inventory handling struct LEVELNODE; +//ADB makes the code clearer, used like "thisSoldier->foo();" +//CHRISL: Not sure if it make the code easier to read or not, but it does make it harder to debug +//#define thisSoldier this + +//forward declarations for versioning, it's so long I want it at the end +class OLDSOLDIERTYPE_101; + +//ADB inventory needs a little work, for instance, how to get objects and counts to agree on sizes? +//also makes things more bloated when saving class Inventory { public: // Constructors // Create an inventory with a fixed maximum number of slots - //Inventory(); // Uses NUM_INV_SLOTS for slotCount - // Just make NUM_INV_SLOTS the default. That way there's one routine to control them all Inventory(int slotCount = NUM_INV_SLOTS); // Copy Constructor Inventory(const Inventory&); // Assignment operator - Inventory& operator=(const Inventory&); + Inventory& operator=(const Inventory&); // Destructor ~Inventory(); // Index operator - OBJECTTYPE& operator [] (int idx); + OBJECTTYPE& operator [] (unsigned int idx); - // Resets all items in the inventory to empty - void initialize(); + BOOLEAN Load( HWFILE hFile ); + BOOLEAN Load( INT8** hBuffer, float dMajorMapVersion, UINT8 ubMinorMapVersion); + BOOLEAN Save( HWFILE hFile, bool fSavingMap ); + + // Removes all items from the inventory + void clear(); // How any slots are there in this inventory? - int size() const; + unsigned int size() const; + //temporarily? public + std::vector bNewItemCount; + std::vector bNewItemCycleCount; private: - vector inv; - int slotCnt; + std::vector inv; }; - -//typedef struct -class SOLDIERTYPE + // Added for new inventory system to work +class STRUCT_AIData//last edited at version 102 { public: + void ConvertFrom_101_To_102(const OLDSOLDIERTYPE_101& src); +public: + // AI STUFF from before the changes to the memory structure + INT8 bOppList[MAX_NUM_SOLDIERS]; // AI knowledge database + INT8 bLastAction; + INT8 bAction; + UINT16 usActionData; + INT8 bNextAction; + UINT16 usNextActionData; + INT8 bActionInProgress; + INT8 bAlertStatus; + INT8 bOppCnt; + INT8 bNeutral; + INT8 bNewSituation; + INT8 bNextTargetLevel; + INT8 bOrders; + INT8 bAttitude; + INT8 bUnderFire; + INT8 bShock; + INT8 bUnderEscort; + INT8 bBypassToGreen; + UINT8 ubLastMercToRadio; + INT8 bDominantDir; // AI main direction to face... + INT8 bPatrolCnt; // number of patrol gridnos + INT8 bNextPatrolPnt; // index to next patrol gridno + INT16 sPatrolGrid[MAXPATROLGRIDS];// AI list for ptr->orders==PATROL + INT16 sNoiseGridno; + UINT8 ubNoiseVolume; + INT8 bLastAttackHit; + UINT8 ubXRayedBy; + FLOAT dHeightAdjustment; + INT8 bMorale; + INT8 bTeamMoraleMod; + INT8 bTacticalMoraleMod; + INT8 bStrategicMoraleMod; + INT8 bAIMorale; + UINT8 ubPendingAction; + UINT8 ubPendingActionAnimCount; + UINT32 uiPendingActionData1; + INT16 sPendingActionData2; + INT8 bPendingActionData3; + INT8 ubDoorHandleCode; + UINT32 uiPendingActionData4; + INT8 bInterruptDuelPts; + INT8 bPassedLastInterrupt; + INT8 bIntStartAPs; + INT8 bMoved; + INT8 bHunting; + UINT8 ubLastCall; + UINT8 ubCaller; + INT16 sCallerGridNo; + UINT8 bCallPriority; + INT8 bCallActedUpon; + INT8 bFrenzied; + INT8 bNormalSmell; + INT8 bMonsterSmell; + INT8 bMobility; + INT8 bRTPCombat; + INT8 fAIFlags; + INT8 bAimTime; + INT8 bShownAimTime; +}; + +class STRUCT_Flags//last edited at version 102 +{ +public: + void ConvertFrom_101_To_102(const OLDSOLDIERTYPE_101& src); + +public: + // flags from before the changes to the memory structure + INT8 bHasKeys; // allows AI controlled dudes to open locked doors + BOOLEAN fDelayedMovement; + BOOLEAN fTurnInProgress; + BOOLEAN fBeginFade; + INT8 bTurningFromPronePosition; + BOOLEAN fDontChargeReadyAPs; + BOOLEAN fPrevInWater; + BOOLEAN fGoBackToAimAfterHit; + BOOLEAN fForceRenderColor; + BOOLEAN fForceNoRenderPaletteCycle; + BOOLEAN fStopPendingNextTile; + BOOLEAN fUIMovementFast; + BOOLEAN fForceShade; + BOOLEAN fDeadSoundPlayed; + BOOLEAN fClosePanel; + BOOLEAN fClosePanelToDie; + BOOLEAN fDeadPanel; + BOOLEAN fOpenPanel; + BOOLEAN fIntendedTarget; // intentionally shot? + BOOLEAN fPauseAllAnimation; + BOOLEAN fContinueMoveAfterStanceChange; + BOOLEAN fHoldAttackerUntilDone; + BOOLEAN fWarnedAboutBleeding; + BOOLEAN fDyingComment; + BOOLEAN fTurningToShoot; + BOOLEAN fTurningToFall; + BOOLEAN fTurningUntilDone; + BOOLEAN fGettingHit; + BOOLEAN fInNonintAnim; + BOOLEAN fFlashLocator; + BOOLEAN fShowLocator; + BOOLEAN fFlashPortrait; + BOOLEAN fNoAPToFinishMove; + BOOLEAN fPausedMove; + BOOLEAN fUIdeadMerc; // UI Flags for removing a newly dead merc + BOOLEAN fUInewMerc; // UI Flags for adding newly created merc ( panels, etc ) + BOOLEAN fUICloseMerc; // UI Flags for closing panels + BOOLEAN fUIFirstTimeNOAP; // UI Flag for diming guys when no APs ( dirty flags ) + BOOLEAN fUIFirstTimeUNCON; // UI FLAG For unconscious dirty + BOOLEAN fReloading; + BOOLEAN fPauseAim; + BOOLEAN fInMissionExitNode; + BOOLEAN fBetweenSectors; //set when the group isn't actually in a sector. + BOOLEAN fReactingFromBeingShot; + BOOLEAN fCheckForNewlyAddedItems; + BOOLEAN fBlockedByAnotherMerc; + BOOLEAN fContractPriceHasIncreased; + BOOLEAN fFixingSAMSite; + BOOLEAN fFixingRobot; + BOOLEAN fSignedAnotherContract; + BOOLEAN fDontChargeTurningAPs; + BOOLEAN fChangingStanceDueToSuppression; + BOOLEAN fForcedToStayAwake; // forced by player to stay awake, reset to false, the moment they are set to rest or sleep + BOOLEAN fDoSpread; + BOOLEAN fIsSoldierMoving; // ie. Record time is on + BOOLEAN fIsSoldierDelayed; //Is the soldier delayed Soldier + BOOLEAN fSoldierUpdatedFromNetwork; + BOOLEAN fSayAmmoQuotePending; + BOOLEAN fMuzzleFlash; + BOOLEAN fMercCollapsedFlag; + BOOLEAN fDoneAssignmentAndNothingToDoFlag; + BOOLEAN fMercAsleep; + BOOLEAN fDontChargeAPsForStanceChange; + BOOLEAN fSoldierWasMoving; + BOOLEAN fDontUnsetLastTargetFromTurn; + BOOLEAN fUseMoverrideMoveSpeed; + BOOLEAN fDieSoundUsed; + BOOLEAN fUseLandingZoneForArrival; + BOOLEAN fComplainedThatTired; + BOOLEAN fRTInNonintAnim; + + UINT8 fHitByGasFlags; // flags + INT8 fDisplayDamage; + INT8 fCloseCall; + INT8 fTryingToFall; + INT8 fPastXDest; + INT8 fPastYDest; + BOOLEAN fFallClockwise; + BOOLEAN fDoingExternalDeath; + BOOLEAN autofireLastStep; + BOOLEAN lastFlankLeft; + UINT32 uiStatusFlags; + + //LBE node stuff + BOOLEAN ZipperFlag; + BOOLEAN DropPackFlag; + +}; + +class STRUCT_TimeChanges//last edited at version 102 +{ +public: + void ConvertFrom_101_To_102(const OLDSOLDIERTYPE_101& src); + // time changes...when a stat was changed according to GetJA2Clock(); + UINT32 uiChangeLevelTime; + UINT32 uiChangeHealthTime; + UINT32 uiChangeStrengthTime; + UINT32 uiChangeDexterityTime; + UINT32 uiChangeAgilityTime; + UINT32 uiChangeWisdomTime; + UINT32 uiChangeLeadershipTime; + UINT32 uiChangeMarksmanshipTime; + UINT32 uiChangeExplosivesTime; + UINT32 uiChangeMedicalTime; + UINT32 uiChangeMechanicalTime; +}; + +class STRUCT_Drugs//last edited at version 102 +{ +public: + void ConvertFrom_101_To_102(const OLDSOLDIERTYPE_101& src); + INT8 bFutureDrugEffect[2]; // value to represent effect of a needle + INT8 bDrugEffectRate[2]; // represents rate of increase and decrease of effect + INT8 bDrugEffect[2]; // value that affects AP & morale calc ( -ve is poorly ) + INT8 bDrugSideEffectRate[2]; // duration of negative AP and morale effect + INT8 bDrugSideEffect[2]; // duration of negative AP and morale effect + INT8 bTimesDrugUsedSinceSleep[2]; +}; + +class STRUCT_TimeCounters//last edited at version 102 +{ +public: + void ConvertFrom_101_To_102(const OLDSOLDIERTYPE_101& src); + TIMECOUNTER UpdateCounter; + TIMECOUNTER DamageCounter; + TIMECOUNTER ReloadCounter; + TIMECOUNTER FlashSelCounter; + TIMECOUNTER AICounter; + TIMECOUNTER FadeCounter; + TIMECOUNTER PanelAnimateCounter; + TIMECOUNTER BlinkSelCounter; + TIMECOUNTER PortraitFlashCounter; + TIMECOUNTER NextTileCounter; +}; + +class STRUCT_Statistics//last edited at version 102 +{ +public: + void ConvertFrom_101_To_102(const OLDSOLDIERTYPE_101& src); + INT8 bLife; // current life (hit points or health) + INT8 bLifeMax; // maximum life for this merc + INT8 bExpLevel; // general experience level + INT8 bAgility; // agility (speed) value + INT8 bStrength; + INT8 bMechanical; + INT8 bMarksmanship; + INT8 bExplosive; + UINT8 ubSkillTrait1; + UINT8 ubSkillTrait2; + INT8 bDexterity; // dexterity (hand coord) value + INT8 bWisdom; + INT8 bMedical; + INT8 bScientific; + INT8 bLeadership; +}; + +class STRUCT_Pathing//last edited at version 102 +{ +public: + void ConvertFrom_101_To_102(const OLDSOLDIERTYPE_101& src); + // WALKING STUFF + INT8 bDesiredDirection; + INT16 sDestXPos; + INT16 sDestYPos; + //INT16 sDesiredDest;//apparently not used + INT16 sDestination; + INT16 sFinalDestination; + INT8 bLevel; + INT8 bStopped; + INT8 bNeedToLook; + // PATH STUFF + UINT16 usPathingData[ MAX_PATH_LIST_SIZE ]; + UINT16 usPathDataSize; + UINT16 usPathIndex; + INT16 sBlackList; + INT8 bPathStored; // good for AI to reduct redundancy +}; + +class SOLDIERTYPE//last edited at version 102 +{ +public: + // Conversion operator + SOLDIERTYPE& operator=(const OLDSOLDIERTYPE_101&); + // Constructor SOLDIERTYPE(); // Copy Constructor SOLDIERTYPE(const SOLDIERTYPE&); // Assignment operator - SOLDIERTYPE& operator=(const SOLDIERTYPE&); + SOLDIERTYPE& operator=(const SOLDIERTYPE&); // Destructor ~SOLDIERTYPE(); - // Initialize the soldier. - // Use this instead of the old method of calling memset. - // Note that the constructor does this automatically. + BOOLEAN Load(HWFILE hFile); + BOOLEAN Save(HWFILE hFile); + UINT32 GetChecksum(); + + // Initialize the soldier. + // Use this instead of the old method of calling memset. + // Note that the constructor does this automatically. void initialize(); - // Ugly temporary solution - void CopyOldInventoryToNew(); - void CopyNewInventoryToOld(); - - INT16 GetMaxDistanceVisible(INT16 sGridNo = -1, INT8 bLevel = -1, int calcAsType = -1); - // Note: Place all non-POD items at the end (after endOfPOD) // The format of this structure affects what is written into and read from various - // files (maps, save files, etc.). If you change it then that code will not work + // files (maps, save files, etc.). If you change it then that code will not work // properly until it is all fixed and the files updated. +public: + // ID + UINT8 ubID; + UINT8 bReserved1; + CHAR16 name[ 10 ]; + + INT16 GetMaxDistanceVisible(INT16 sGridNo = -1, INT8 bLevel = -1, int calcAsType = -1); + + // DESCRIPTION / STATS, ETC + UINT8 ubBodyType; + INT8 bActionPoints; + INT8 bInitialActionPoints; + INT8 bOldLife; // life at end of last turn, recorded for monster AI + INT8 bVisible; // to render or not to render... + INT8 bActive; + INT8 bTeam; // Team identifier + + + OBJECTTYPE *pTempObject; + KEY_ON_RING *pKeyRing; + + UINT8 bInSector; + INT8 bFlashPortraitFrame; + INT16 sFractLife; // fraction of life pts (in hundreths) + INT8 bBleeding; // blood loss control variable + INT8 bBreath; // current breath value + INT8 bBreathMax; // max breath, affected by fatigue/sleep + INT8 bStealthMode; + INT16 sBreathRed; // current breath value + + + UINT8 ubWaitActionToDo; + INT8 ubInsertionDirection; + INT8 bGunType; + UINT8 ubOppNum; + INT8 bLastRenderVisibleValue; + UINT8 ubAttackingHand; + INT16 sWeightCarriedAtTurnStart; + + + //NEW MOVEMENT INFORMATION for Strategic Movement + UINT8 ubGroupID; //the movement group the merc is currently part of. + //sSectorX and sSectorY will reflect the sector the + //merc was at last. + + UINT8 ubMovementNoiseHeard;// 8 flags by direction + + + // WORLD POSITION STUFF + FLOAT dXPos; + FLOAT dYPos; + FLOAT dOldXPos; + FLOAT dOldYPos; + INT16 sInitialGridNo; + INT16 sGridNo; + UINT8 ubDirection; + INT16 sHeightAdjustment; + INT16 sDesiredHeight; + INT16 sTempNewGridNo; // New grid no for advanced animations + INT16 sRoomNo; + INT8 bOverTerrainType; + INT8 bOldOverTerrainType; + + INT8 bCollapsed; // collapsed due to being out of APs + INT8 bBreathCollapsed; // collapsed due to being out of APs + + + UINT8 ubDesiredHeight; + UINT16 usPendingAnimation; + UINT8 ubPendingStanceChange; + UINT16 usAnimState; + + + + + UINT32 uiAIDelay; + INT16 sReloadDelay; + UINT8 ubAttackerID; + UINT8 ubPreviousAttackerID; + + INT16 sInsertionGridNo; + + + AnimationSurfaceCacheType AnimCache; // will be 9 bytes once changed to pointers + + UINT8 bSide; + UINT8 bViewRange; + INT8 bNewOppCnt; + INT8 bService; // first aid, or other time consuming process + + UINT16 usAniCode; + UINT16 usAniFrame; + INT16 sAniDelay; + + // MOVEMENT TO NEXT TILE HANDLING STUFF + UINT8 ubDelayedMovementCauseMerc; + INT16 sDelayedMovementCauseGridNo; + INT16 sReservedMovementGridNo; + + + // Weapon Stuff + INT16 sTargetGridNo; + INT8 bTargetLevel; + INT8 bTargetCubeLevel; + INT16 sLastTarget; + INT8 bTilesMoved; + FLOAT dNextBleed; + + UINT8 ubTilesMovedPerRTBreathUpdate; + UINT16 usLastMovementAnimPerRTBreathUpdate; + + INT16 sLocatorFrame; + + INT32 iFaceIndex; + + // FULL 3-d TILE STUFF ( keep records of three tiles infront ) + UINT16 usFrontArcFullTileList[ MAX_FULLTILE_DIRECTIONS ]; + INT16 usFrontArcFullTileGridNos[ MAX_FULLTILE_DIRECTIONS ]; + + + // PALETTE MANAGEMENT STUFF + PaletteRepID HeadPal; // 30 + PaletteRepID PantsPal; // 30 + PaletteRepID VestPal; // 30 + PaletteRepID SkinPal; // 30 + PaletteRepID MiscPal; // 30 + + + + + SGPPaletteEntry *p8BPPPalette; // 4 + UINT16 *p16BPPPalette; + UINT16 *pShades[ NUM_SOLDIER_SHADES ]; // Shading tables + UINT16 *pGlowShades[ 20 ]; // + UINT16 *pCurrentShade; + UINT8 ubFadeLevel; + UINT8 ubServiceCount; + UINT8 ubServicePartner; + THROW_PARAMS *pThrowParams; + INT8 bReverse; + LEVELNODE *pLevelNode; + LEVELNODE *pExternShadowLevelNode; + LEVELNODE *pRoofUILevelNode; + + + + + // UNBLIT BACKGROUND + UINT16 *pBackGround; + UINT16 *pZBackground; + UINT16 usUnblitX, usUnblitY; + UINT16 usUnblitWidth, usUnblitHeight; + + UINT8 ubStrategicInsertionCode; + UINT16 usStrategicInsertionData; + + + INT32 iLight; + INT32 iMuzFlash; + INT8 bMuzFlashCount; + + + INT16 sX; + INT16 sY; + + UINT16 usOldAniState; + INT16 sOldAniCode; + + INT8 bBulletsLeft; + UINT8 ubSuppressionPoints; + + // STUFF FOR RANDOM ANIMATIONS + UINT32 uiTimeOfLastRandomAction; + INT16 usLastRandomAnim; + + + + UINT16 usAnimSurface; + UINT16 sZLevel; + + INT16 sWalkToAttackGridNo; + INT16 sWalkToAttackWalkToCost; + + + INT16 sLocatorOffX; + INT16 sLocatorOffY; + UINT16 *pForcedShade; + + INT8 bDisplayDamageCount; + INT16 sDamage; + INT16 sDamageX; + INT16 sDamageY; + INT8 bDamageDir; + INT8 bDoBurst; + INT16 usUIMovementMode; + INT8 bUIInterfaceLevel; + + UINT8 ubProfile; + UINT8 ubQuoteRecord; + UINT8 ubQuoteActionID; + UINT8 ubBattleSoundID; + + UINT8 ubClosePanelFrame; + UINT8 ubDeadPanelFrame; + INT8 bOpenPanelFrame; + + INT16 sPanelFaceX; + INT16 sPanelFaceY; + + // QUOTE STUFF + INT8 bNumHitsThisTurn; + UINT16 usQuoteSaidFlags; + INT8 bLastSkillCheck; + INT8 ubSkillCheckAttempts; + + INT8 bVocalVolume; // verbal sounds need to differ in volume + + INT8 bStartFallDir; + + UINT8 ubPendingDirection; + UINT32 uiAnimSubFlags; + + UINT8 bAimShotLocation; + UINT8 ubHitLocation; + + UINT16 *pEffectShades[ NUM_SOLDIER_EFFECTSHADES ]; // Shading tables for effects + + UINT8 ubPlannedUIAPCost; + INT16 sPlannedTargetX; + INT16 sPlannedTargetY; + + INT16 sSpreadLocations[ MAX_BURST_SPREAD_TARGETS ]; + INT16 sStartGridNo; + INT16 sEndGridNo; + INT16 sForcastGridno; + INT16 sZLevelOverride; + INT8 bMovedPriorToInterrupt; + INT32 iEndofContractTime; // time, in global time(resolution, minutes) that merc will leave, or if its a M.E.R.C. merc it will be set to -1. -2 for NPC and player generated + INT32 iStartContractTime; + INT32 iTotalContractLength; // total time of AIM mercs contract or the time since last paid for a M.E.R.C. merc + INT32 iNextActionSpecialData; // AI special action data record for the next action + UINT8 ubWhatKindOfMercAmI; //Set to the type of character it is + INT8 bAssignment; // soldiers current assignment + INT8 bOldAssignment; // old assignment, for autosleep purposes + INT8 bTrainStat; // current stat soldier is training + INT16 sSectorX; // X position on the Stategic Map + INT16 sSectorY; // Y position on the Stategic Map + INT8 bSectorZ; // Z sector location + INT32 iVehicleId; // the id of the vehicle the char is in + PathStPtr pMercPath; //Path Structure + UINT16 usMedicalDeposit; // is there a medical deposit on merc + UINT16 usLifeInsurance; // is there life insurance taken out on merc + + + //DEF: Used for the communications + UINT32 uiStartMovementTime; // the time since the merc first started moving + UINT32 uiOptimumMovementTime; // everytime in ececute overhead the time for the current ani will be added to this total + UINT32 usLastUpdateTime ; // The last time the soldier was in ExecuteOverhead + + UINT32 uiSoldierUpdateNumber; + BYTE ubSoldierUpdateType; + //END + + INT32 iStartOfInsuranceContract; + UINT32 uiLastAssignmentChangeMin; // timestamp of last assignment change in minutes + INT32 iTotalLengthOfInsuranceContract; + + UINT8 ubSoldierClass; //admin, elite, troop (creature types?) + UINT8 ubAPsLostToSuppression; + UINT8 ubSuppressorID; + + //Squad merging vars + UINT8 ubDesiredSquadAssignment; + UINT8 ubNumTraversalsAllowedToMerge; + + UINT16 usPendingAnimation2; + UINT8 ubCivilianGroup; + + + UINT32 uiUniqueSoldierIdValue; // the unique value every instance of a soldier gets - 1 is the first valid value + + INT8 bEndDoorOpenCode; + + UINT8 ubScheduleID; + INT16 sEndDoorOpenCodeData; + INT8 bBlockedByAnotherMercDirection; + UINT16 usAttackingWeapon; + INT8 bWeaponMode; + UINT8 ubTargetID; + INT8 bAIScheduleProgress; + INT16 sOffWorldGridNo; + struct TAG_anitile *pAniTile; + INT8 bCamo; + INT16 sAbsoluteFinalDestination; + UINT8 ubHiResDirection; + UINT8 ubHiResDesiredDirection; + UINT8 ubLastFootPrintSound; + INT8 bVehicleID; + INT8 bMovementDirection; + INT16 sOldGridNo; + UINT16 usDontUpdateNewGridNoOnMoveAnimChange; + INT16 sBoundingBoxWidth; + INT16 sBoundingBoxHeight; + INT16 sBoundingBoxOffsetX; + INT16 sBoundingBoxOffsetY; + UINT32 uiTimeSameBattleSndDone; + INT8 bOldBattleSnd; + INT32 iBurstSoundID; + INT8 bSlotItemTakenFrom; + UINT8 ubAutoBandagingMedic; + UINT8 ubRobotRemoteHolderID; + UINT32 uiTimeOfLastContractUpdate; + INT8 bTypeOfLastContract; + INT8 bTurnsCollapsed; + INT8 bSleepDrugCounter; + UINT8 ubMilitiaKills; + + + INT8 bBlindedCounter; + + UINT8 ubHoursOnAssignment; // used for assignments handled only every X hours + + UINT8 ubMercJustFired; // the merc was just fired..there may be dialogue events occuring, this flag will prevent any interaction with contracts + // until after the merc leaves + UINT8 ubTurnsUntilCanSayHeardNoise; + UINT16 usQuoteSaidExtFlags; + + UINT16 sContPathLocation; + INT8 bGoodContPath; + UINT8 ubPendingActionInterrupted; + INT8 bNoiseLevel; + INT8 bRegenerationCounter; + INT8 bRegenBoostersUsedToday; + INT8 bNumPelletsHitBy; + INT16 sSkillCheckGridNo; + UINT8 ubLastEnemyCycledID; + + UINT8 ubPrevSectorID; + UINT8 ubNumTilesMovesSinceLastForget; + INT8 bTurningIncrement; + UINT32 uiBattleSoundID; + + UINT16 usValueGoneUp; + + UINT8 ubNumLocateCycles; + UINT8 ubDelayedMovementFlags; + UINT8 ubCTGTTargetID; + + UINT32 uiMercChecksum; + + INT8 bCurrentCivQuote; + INT8 bCurrentCivQuoteDelta; + UINT8 ubMiscSoldierFlags; + UINT8 ubReasonCantFinishMove; + + INT16 sLocationOfFadeStart; + UINT8 bUseExitGridForReentryDirection; + + UINT32 uiTimeSinceLastSpoke; + UINT8 ubContractRenewalQuoteCode; + INT16 sPreTraversalGridNo; + UINT32 uiXRayActivatedTime; + INT8 bTurningFromUI; + INT8 bPendingActionData5; + + INT8 bDelayedStrategicMoraleMod; + UINT8 ubDoorOpeningNoise; + + struct GROUP *pGroup; + UINT8 ubLeaveHistoryCode; + INT8 bOverrideMoveSpeed; + + UINT32 uiTimeSoldierWillArrive; + + + INT8 bVehicleUnderRepairID; + INT32 iTimeCanSignElsewhere; + INT8 bHospitalPriceModifier; + UINT32 uiStartTimeOfInsuranceContract; + INT8 bCorpseQuoteTolerance; + INT8 bDeafenedCounter; + INT32 iPositionSndID; + INT32 iTuringSoundID; + UINT8 ubLastDamageReason; + INT16 sLastTwoLocations[2]; + INT32 uiTimeSinceLastBleedGrunt; + UINT8 ubNextToPreviousAttackerID; + UINT8 bDoAutofire; + INT8 numFlanks; + INT16 lastFlankSpot; + INT8 sniper; + INT16 origDir; + INT8 wornCamo; + + INT8 urbanCamo; // Madd: new camo types + INT8 wornUrbanCamo; + + INT8 desertCamo; + INT8 wornDesertCamo; + + INT8 snowCamo; + INT8 wornSnowCamo; + + INT16 filler; + + char endOfPOD; // marker for end of POD (plain old data) + + // Note: Place all non-POD items at the end (after endOfPOD) + // The format of this structure affects what is written into and read from various + // files (maps, save files, etc.). If you change it then that code will not work + // properly until it is all fixed and the files updated. + + Inventory inv; + + //data from version 101 wrapped into structs + STRUCT_AIData aiData; + STRUCT_Flags flags; + STRUCT_TimeChanges timeChanges; + STRUCT_TimeCounters timeCounters; + STRUCT_Drugs drugs; + STRUCT_Statistics stats; + STRUCT_Pathing pathing; + + // Debugging data - not saved + INT16 sPlotSrcGrid; + + +public: + // CREATION FUNCTIONS + BOOLEAN DeleteSoldier( void ); + BOOLEAN CreateSoldierLight( void ); + BOOLEAN DeleteSoldierLight( void ); + + BOOLEAN CreateSoldierCommon( UINT8 ubBodyType, UINT16 usSoldierID, UINT16 usState ); + + + // Soldier Management functions, called by Event Pump.c + BOOLEAN EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStartingAniCode, BOOLEAN fForce ); + + BOOLEAN ChangeSoldierState( UINT16 usNewState, UINT16 usStartingAniCode, BOOLEAN fForce ); + void EVENT_SetSoldierPosition( FLOAT dNewXPos, FLOAT dNewYPos ); + void EVENT_SetSoldierDestination( UINT8 ubNewDirection ); + void EVENT_GetNewSoldierPath( INT16 sDestGridNo, UINT16 usMovementAnim ); + + void EVENT_SetSoldierDirection( UINT16 usNewDirection ); + void EVENT_SetSoldierDesiredDirection( UINT16 usNewDirection ); + void EVENT_FireSoldierWeapon( INT16 sTargetGridNo ); + void EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 ubDamage, INT16 sBreathLoss, UINT16 bDirection , UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation, INT16 sSubsequent, INT16 sLocationGridNo ); + void EVENT_SoldierBeginBladeAttack( INT16 sGridNo, UINT8 ubDirection ); + void EVENT_SoldierBeginPunchAttack( INT16 sGridNo, UINT8 ubDirection ); + void EVENT_SoldierBeginFirstAid( INT16 sGridNo, UINT8 ubDirection ); + void EVENT_StopMerc( INT16 sGridNo, INT8 bDirection ); + void EVENT_SoldierBeginCutFence( INT16 sGridNo, UINT8 ubDirection ); + void EVENT_SoldierBeginRepair( INT16 sGridNo, UINT8 ubDirection ); + void EVENT_SoldierBeginRefuel( INT16 sGridNo, UINT8 ubDirection ); + void EVENT_SoldierBeginKnifeThrowAttack( INT16 sGridNo, UINT8 ubDirection ); + void EVENT_SoldierBeginUseDetonator( void ); + void EVENT_SoldierBeginDropBomb( void ); + void EVENT_SoldierEnterVehicle( INT16 sGridNo, UINT8 ubDirection ); + void EVENT_SoldierBeginGiveItem( void ); + void EVENT_SetSoldierPositionAndMaybeFinalDest( FLOAT dNewXPos, FLOAT dNewYPos, BOOLEAN fUpdateFinalDest ); + void EVENT_SetSoldierPositionForceDelete( FLOAT dNewXPos, FLOAT dNewYPos ); + void EVENT_SoldierBeginReloadRobot( INT16 sGridNo, UINT8 ubDirection, UINT8 ubMercSlot ); + void EVENT_SoldierBeginTakeBlood( INT16 sGridNo, UINT8 ubDirection ); + void EVENT_SoldierBeginAttachCan( INT16 sGridNo, UINT8 ubDirection ); + void EVENT_BeginMercTurn( BOOLEAN fFromRealTime, INT32 iRealTimeCounter ); + + BOOLEAN EVENT_InternalGetNewSoldierPath( INT16 sDestGridNo, UINT16 usMovementAnim, BOOLEAN fFromUI, BOOLEAN fForceRestart ); + void EVENT_InternalSetSoldierDestination( UINT16 usNewDirection, BOOLEAN fFromMove, UINT16 usAnimState ); + void EVENT_InternalSetSoldierPosition( FLOAT dNewXPos, FLOAT dNewYPos ,BOOLEAN fUpdateDest, BOOLEAN fUpdateFinalDest, BOOLEAN fForceDelete ); + + + // Soldier Management functions called by Overhead.c + BOOLEAN ConvertAniCodeToAniFrame( UINT16 usAniFrame ); + void TurnSoldier( void ); + void ChangeSoldierStance( UINT8 ubDesiredStance ); + void StopSoldier( void ); + void ReviveSoldier( void ); + UINT8 SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBreathDeduct, UINT8 ubReason, UINT8 ubAttacker, INT16 sSourceGrid, INT16 sSubsequent, BOOLEAN fShowDamage ); + + + // Palette functions for soldiers + BOOLEAN CreateSoldierPalettes( void ); + + // UTILITY FUNCTUIONS + void MoveMerc( FLOAT dMovementChange, FLOAT dAngle, BOOLEAN fCheckRange ); + INT8 CalcActionPoints( void ); + BOOLEAN IsActionInterruptable( void ); + // This function is now obsolete. Call ReduceAttackBusyCount instead. + // void ReleaseSoldiersAttacker( SOLDIERTYPE *pSoldier ); + BOOLEAN MercInWater( void ); + BOOLEAN MercInShallowWater( void ); + BOOLEAN MercInDeepWater( void ); + BOOLEAN MercInHighWater( void ); + UINT16 GetNewSoldierStateFromNewStance( UINT8 ubDesiredStance ); + UINT16 GetMoveStateBasedOnStance( UINT8 ubStanceHeight ); + void SoldierGotoStationaryStance( void ); + BOOLEAN ReCreateSoldierLight( void ); + void RemoveSoldierFromGridNo( void ); + void InternalRemoveSoldierFromGridNo( BOOLEAN fForce ); + + + void CalcNewActionPoints( void ); + void AdjustNoAPToFinishMove( BOOLEAN fSet ); + + + + + UINT32 SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT16 sStatus ); + void ReceivingSoldierCancelServices( void ); + void GivingSoldierCancelServices( void ); + void InternalReceivingSoldierCancelServices( BOOLEAN fPlayEndAnim ); + void InternalGivingSoldierCancelServices( BOOLEAN fPlayEndAnim ); + + + void PositionSoldierLight( void ); + void SetCheckSoldierLightFlag( void ); + void SetSoldierCowerState( BOOLEAN fOn ); + void SetSoldierAsUnderAiControl( void ); + void ResetSoldierChangeStatTimer( void ); + void SetSoldierGridNo( INT16 sNewGridNo, BOOLEAN fForceRemove ); + void SetSoldierHeight( FLOAT dNewHeight ); + void InternalSetSoldierHeight( FLOAT dNewHeight, BOOLEAN fUpdateLevel );//this function did not have a forward declaration + + + BOOLEAN DoMercBattleSound( UINT8 ubBattleSoundID ); + BOOLEAN InternalDoMercBattleSound( UINT8 ubBattleSoundID, INT8 bSpecialCode ); + BOOLEAN GetProfileFlagsFromGridno( UINT16 usAnimState, UINT16 sTestGridNo, UINT16 *usFlags ); + void HaultSoldierFromSighting( BOOLEAN fFromSightingEnemy ); + void ReLoadSoldierAnimationDueToHandItemChange( UINT16 usOldItem, UINT16 usNewItem ); + void DoNinjaAttack( void ); + void PickDropItemAnimation( void ); + + + void BeginSoldierGetup( void ); + void BeginSoldierClimbUpRoof( void ); + void BeginSoldierClimbDownRoof( void ); + void BeginSoldierClimbFence( void ); + void BeginTyingToFall( void ); + void HandleAnimationProfile( UINT16 usAnimState, BOOLEAN fRemove ); + void HandleSoldierTakeDamageFeedback( void ); + void ChangeToFlybackAnimation( UINT8 flyBackDirection ); + void ChangeToFallbackAnimation( UINT8 fallBackDirection ); + + + void UpdateRobotControllerGivenController( void ); + void UpdateRobotControllerGivenRobot( void ); + SOLDIERTYPE *GetRobotController( void ); + BOOLEAN CanRobotBeControlled( void ); + BOOLEAN ControllingRobot( void ); + + + + + BOOLEAN SoldierReadyWeapon( INT16 sTargetXPos, INT16 sTargetYPos, BOOLEAN fEndReady ); + BOOLEAN SoldierReadyWeapon( void ); + BOOLEAN InternalSoldierReadyWeapon( UINT8 sFacingDir, BOOLEAN fEndReady ); + + BOOLEAN CheckSoldierHitRoof( void ); + BOOLEAN CheckForBreathCollapse( void ); + BOOLEAN PlayerSoldierStartTalking( UINT8 ubTargetID, BOOLEAN fValidate ); + BOOLEAN InternalIsValidStance( INT8 bDirection, INT8 bNewStance ); + BOOLEAN IsValidSecondHandShot( void ); + BOOLEAN IsValidSecondHandShotForReloadingPurposes( void ); + BOOLEAN SoldierCarriesTwoHandedWeapon( void ); + +}; // SOLDIERTYPE; + +#define SIZEOF_SOLDIERTYPE_POD offsetof( SOLDIERTYPE, endOfPOD ) +#define SIZEOF_OLDSOLDIERTYPE_101_POD offsetof( OLDSOLDIERTYPE_101, endOfPOD ) + +#define HEALTH_INCREASE 0x0001 +#define STRENGTH_INCREASE 0x0002 +#define DEX_INCREASE 0x0004 +#define AGIL_INCREASE 0x0008 +#define WIS_INCREASE 0x0010 +#define LDR_INCREASE 0x0020 + +#define MRK_INCREASE 0x0040 +#define MED_INCREASE 0x0080 +#define EXP_INCREASE 0x0100 +#define MECH_INCREASE 0x0200 + +#define LVL_INCREASE 0x0400 + + + + +// Moved to weapons.h by ADB, rev 1513 +/*enum WeaponModes +{ + WM_NORMAL = 0, + WM_BURST, + WM_AUTOFIRE, + WM_ATTACHED_GL, + WM_ATTACHED_GL_BURST, + WM_ATTACHED_GL_AUTO, + NUM_WEAPON_MODES +} ; +*/ +// TYPEDEFS FOR ANIMATION PROFILES +typedef struct +{ + UINT16 usTileFlags; + INT8 bTileX; + INT8 bTileY; + +} ANIM_PROF_TILE; + +typedef struct +{ + UINT8 ubNumTiles; + ANIM_PROF_TILE *pTiles; + +} ANIM_PROF_DIR; + +typedef struct ANIM_PROF +{ + + ANIM_PROF_DIR Dirs[8]; + +} ANIM_PROF; + + + +// Globals +////////// + +// VARIABLES FOR PALETTE REPLACEMENTS FOR HAIR, ETC +extern UINT32 guiNumPaletteSubRanges; +extern UINT8 *gubpNumReplacementsPerRange; +extern PaletteSubRangeType *gpPaletteSubRanges; +extern UINT32 guiNumReplacements; +extern PaletteReplacementType *gpPalRep; + +extern UINT8 bHealthStrRanges[]; + + +// Functions +//////////// + +// Soldier Management functions called by Overhead.c +void RevivePlayerTeam( ); + +BOOLEAN ReCreateSelectedSoldierLight( ); + +// Palette functions for soldiers +BOOLEAN GetPaletteRepIndexFromID( PaletteRepID aPalRep, UINT8 *pubPalIndex ); +BOOLEAN SetPaletteReplacement( SGPPaletteEntry *p8BPPPalette, PaletteRepID aPalRep ); +BOOLEAN LoadPaletteData( ); +BOOLEAN DeletePaletteData( ); + +// UTILITY FUNCTUIONS +void MoveMercFacingDirection( SOLDIERTYPE *pSoldier, BOOLEAN fReverse, FLOAT dMovementDist ); +UINT8 GetDirectionFromXY( INT16 sXPos, INT16 sYPos, SOLDIERTYPE *pSoldier ); +UINT8 GetDirectionFromGridNo( INT16 sGridNo, SOLDIERTYPE *pSoldier ); +UINT8 atan8( INT16 sXPos, INT16 sYPos, INT16 sXPos2, INT16 sYPos2 ); +UINT8 atan8FromAngle( DOUBLE dAngle ); +INT16 GetDirectionToGridNoFromGridNo( INT16 sGridNoDest, INT16 sGridNoSrc ); +// This function is now obsolete. Call ReduceAttackBusyCount instead. +// void ReleaseSoldiersAttacker( SOLDIERTYPE *pSoldier ); + + + +// WRAPPERS FOR SOLDIER EVENTS +void SendSoldierPositionEvent( SOLDIERTYPE *pSoldier, FLOAT dNewXPos, FLOAT dNewYPos ); +void SendSoldierDestinationEvent( SOLDIERTYPE *pSoldier, UINT16 usNewDestination ); +void SendGetNewSoldierPathEvent( SOLDIERTYPE *pSoldier, INT16 sDestGridNo, UINT16 usMovementAnim ); +void SendSoldierSetDirectionEvent( SOLDIERTYPE *pSoldier, UINT16 usNewDirection ); +void SendSoldierSetDesiredDirectionEvent( SOLDIERTYPE *pSoldier, UINT16 usDesiredDirection ); +void SendChangeSoldierStanceEvent( SOLDIERTYPE *pSoldier, UINT8 ubNewStance ); +void SendBeginFireWeaponEvent( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ); + + + +void HandleAnimationProfile( SOLDIERTYPE *pSoldier, UINT16 usAnimState, BOOLEAN fRemove ); +BOOLEAN GetProfileFlagsFromGridno( SOLDIERTYPE *pSoldier, UINT16 usAnimState, UINT16 sTestGridNo, UINT16 *usFlags ); +BOOLEAN PreloadSoldierBattleSounds( SOLDIERTYPE *pSoldier, BOOLEAN fRemove ); +void CrowsFlyAway( UINT8 ubTeam ); +void DebugValidateSoldierData( ); +void HandlePlayerTogglingLightEffects( BOOLEAN fToggleValue ); + + +//typedef struct +class OLDSOLDIERTYPE_101 +{ +public: + UINT32 GetChecksum(); + OLDSOLDIERTYPE_101() { + bNewItemCount.reserve(inv.size()); + bNewItemCycleCount.reserve(inv.size()); + for (int idx=0; idx < (int)inv.size(); ++idx) { + bNewItemCount.push_back(0); + bNewItemCycleCount.push_back(0); + } + initialize(); + }; + + // Copy Constructor + OLDSOLDIERTYPE_101(const OLDSOLDIERTYPE_101& src) { + memcpy(this, &src, SIZEOF_OLDSOLDIERTYPE_101_POD); + inv = src.inv; + bNewItemCount = src.bNewItemCount; + bNewItemCycleCount = src.bNewItemCycleCount; + }; + + // Assignment operator + OLDSOLDIERTYPE_101& operator=(const OLDSOLDIERTYPE_101& src) + { + if (this != &src) { + memcpy(this, &src, SIZEOF_OLDSOLDIERTYPE_101_POD); + inv = src.inv; + bNewItemCount = src.bNewItemCount; + bNewItemCycleCount = src.bNewItemCycleCount; + } + return *this; + }; + + // Destructor + ~OLDSOLDIERTYPE_101() { + }; + + // Initialize the soldier. + // Use this instead of the old method of calling memset! + // Note that the constructor does this automatically. + void initialize() { + memset( this, 0, SIZEOF_OLDSOLDIERTYPE_101_POD); + inv.clear(); + for (int idx=0; idx < (int)inv.size(); ++idx) { + bNewItemCount[idx] = 0; + bNewItemCycleCount[idx] = 0; + } + }; + + // Ugly temporary solution + void CopyOldInventoryToNew(); + public: // ID UINT8 ubID; @@ -450,8 +1395,7 @@ public: UINT32 uiStatusFlags; -private: - OBJECTTYPE DO_NOT_USE_Inv[ OldInventory::NUM_INV_SLOTS ]; + OLD_OBJECTTYPE_101 DO_NOT_USE_Inv[ OldInventory::NUM_INV_SLOTS ]; public: OBJECTTYPE *pTempObject; KEY_ON_RING *pKeyRing; @@ -463,7 +1407,7 @@ public: INT16 sFractLife; // fraction of life pts (in hundreths) INT8 bBleeding; // blood loss control variable INT8 bBreath; // current breath value - INT8 bBreathMax; // max breath, affected by fatigue/sleep + INT8 bBreathMax; // max breath, affected by fatigue/sleep INT8 bStealthMode; INT16 sBreathRed; // current breath value @@ -479,7 +1423,7 @@ public: INT8 bLastRenderVisibleValue; BOOLEAN fInMissionExitNode; UINT8 ubAttackingHand; - INT8 bScientific; + INT8 bScientific; // traits INT16 sWeightCarriedAtTurnStart; CHAR16 name[ 10 ]; @@ -502,10 +1446,10 @@ public: // 23 bytes so far // WORLD POSITION STUFF - FLOAT dXPos; - FLOAT dYPos; - FLOAT dOldXPos; - FLOAT dOldYPos; + FLOAT dXPos; + FLOAT dYPos; + FLOAT dOldXPos; + FLOAT dOldYPos; INT16 sInitialGridNo; INT16 sGridNo; UINT8 ubDirection; @@ -572,7 +1516,7 @@ public: UINT16 usAniCode; UINT16 usAniFrame; - INT16 sAniDelay; + INT16 sAniDelay; // MOVEMENT TO NEXT TILE HANDLING STUFF INT8 bAgility; // agility (speed) value @@ -589,7 +1533,7 @@ public: INT8 bTargetCubeLevel; INT16 sLastTarget; INT8 bTilesMoved; - INT8 bLeadership; + INT8 bLeadership; FLOAT dNextBleed; BOOLEAN fWarnedAboutBleeding; BOOLEAN fDyingComment; @@ -621,7 +1565,7 @@ public: // FULL 3-d TILE STUFF ( keep records of three tiles infront ) - UINT16 usFrontArcFullTileList[ MAX_FULLTILE_DIRECTIONS ]; + UINT16 usFrontArcFullTileList[ MAX_FULLTILE_DIRECTIONS ]; INT16 usFrontArcFullTileGridNos[ MAX_FULLTILE_DIRECTIONS ]; @@ -721,7 +1665,7 @@ public: INT8 bDominantDir; // AI main direction to face... INT8 bPatrolCnt; // number of patrol gridnos INT8 bNextPatrolPnt; // index to next patrol gridno - INT16 usPatrolGrid[MAXPATROLGRIDS];// AI list for ptr->orders==PATROL + INT16 usPatrolGrid[MAXPATROLGRIDS];// AI list for ptr->orders==PATROL INT16 sNoiseGridno; UINT8 ubNoiseVolume; INT8 bLastAttackHit; @@ -829,38 +1773,38 @@ public: INT16 sPlannedTargetX; INT16 sPlannedTargetY; - INT16 sSpreadLocations[ MAX_BURST_SPREAD_TARGETS ]; + INT16 sSpreadLocations[ MAX_BURST_SPREAD_TARGETS ]; BOOLEAN fDoSpread; INT16 sStartGridNo; INT16 sEndGridNo; INT16 sForcastGridno; INT16 sZLevelOverride; INT8 bMovedPriorToInterrupt; - INT32 iEndofContractTime; // time, in global time(resolution, minutes) that merc will leave, or if its a M.E.R.C. merc it will be set to -1. -2 for NPC and player generated + INT32 iEndofContractTime; // time, in global time(resolution, minutes) that merc will leave, or if its a M.E.R.C. merc it will be set to -1. -2 for NPC and player generated INT32 iStartContractTime; - INT32 iTotalContractLength; // total time of AIM mercs contract or the time since last paid for a M.E.R.C. merc + INT32 iTotalContractLength; // total time of AIM mercs contract or the time since last paid for a M.E.R.C. merc INT32 iNextActionSpecialData; // AI special action data record for the next action UINT8 ubWhatKindOfMercAmI; //Set to the type of character it is - INT8 bAssignment; // soldiers current assignment + INT8 bAssignment; // soldiers current assignment INT8 bOldAssignment; // old assignment, for autosleep purposes BOOLEAN fForcedToStayAwake; // forced by player to stay awake, reset to false, the moment they are set to rest or sleep - INT8 bTrainStat; // current stat soldier is training - INT16 sSectorX; // X position on the Stategic Map - INT16 sSectorY; // Y position on the Stategic Map + INT8 bTrainStat; // current stat soldier is training + INT16 sSectorX; // X position on the Stategic Map + INT16 sSectorY; // Y position on the Stategic Map INT8 bSectorZ; // Z sector location - INT32 iVehicleId; // the id of the vehicle the char is in - PathStPtr pMercPath; //Path Structure + INT32 iVehicleId; // the id of the vehicle the char is in + PathStPtr pMercPath; //Path Structure UINT8 fHitByGasFlags; // flags - UINT16 usMedicalDeposit; // is there a medical deposit on merc - UINT16 usLifeInsurance; // is there life insurance taken out on merc + UINT16 usMedicalDeposit; // is there a medical deposit on merc + UINT16 usLifeInsurance; // is there life insurance taken out on merc - //DEF: Used for the communications + //DEF: Used for the communications UINT32 uiStartMovementTime; // the time since the merc first started moving UINT32 uiOptimumMovementTime; // everytime in ececute overhead the time for the current ani will be added to this total UINT32 usLastUpdateTime ; // The last time the soldier was in ExecuteOverhead - BOOLEAN fIsSoldierMoving; // ie. Record time is on + BOOLEAN fIsSoldierMoving; // ie. Record time is on BOOLEAN fIsSoldierDelayed; //Is the soldier delayed Soldier BOOLEAN fSoldierUpdatedFromNetwork; UINT32 uiSoldierUpdateNumber; @@ -899,7 +1843,7 @@ public: UINT32 uiUniqueSoldierIdValue; // the unique value every instance of a soldier gets - 1 is the first valid value INT8 UNUSED1; // This is unused at present and can be used for something else -private: +//private: INT8 DO_NOT_USE_bNewItemCount[ OldInventory::NUM_INV_SLOTS ]; INT8 DO_NOT_USE_bNewItemCycleCount[ OldInventory::NUM_INV_SLOTS ]; public: @@ -950,12 +1894,12 @@ public: INT8 bSleepDrugCounter; UINT8 ubMilitiaKills; - INT8 bFutureDrugEffect[2]; // value to represent effect of a needle - INT8 bDrugEffectRate[2]; // represents rate of increase and decrease of effect - INT8 bDrugEffect[2]; // value that affects AP & morale calc ( -ve is poorly ) - INT8 bDrugSideEffectRate[2]; // duration of negative AP and morale effect - INT8 bDrugSideEffect[2]; // duration of negative AP and morale effect - INT8 bTimesDrugUsedSinceSleep[2]; + INT8 bFutureDrugEffect[2]; // value to represent effect of a needle + INT8 bDrugEffectRate[2]; // represents rate of increase and decrease of effect + INT8 bDrugEffect[2]; // value that affects AP & morale calc ( -ve is poorly ) + INT8 bDrugSideEffectRate[2]; // duration of negative AP and morale effect + INT8 bDrugSideEffect[2]; // duration of negative AP and morale effect + INT8 bTimesDrugUsedSinceSleep[2]; INT8 bBlindedCounter; BOOLEAN fMercCollapsedFlag; @@ -965,7 +1909,7 @@ public: UINT8 ubHoursOnAssignment; // used for assignments handled only every X hours - UINT8 ubMercJustFired; // the merc was just fired..there may be dialogue events occuring, this flag will prevent any interaction with contracts + UINT8 ubMercJustFired; // the merc was just fired..there may be dialogue events occuring, this flag will prevent any interaction with contracts // until after the merc leaves UINT8 ubTurnsUntilCanSayHeardNoise; UINT16 usQuoteSaidExtFlags; @@ -1024,26 +1968,26 @@ public: UINT32 uiTimeSoldierWillArrive; BOOLEAN fDieSoundUsed; BOOLEAN fUseLandingZoneForArrival; - BOOLEAN fFallClockwise; - INT8 bVehicleUnderRepairID; - INT32 iTimeCanSignElsewhere; + BOOLEAN fFallClockwise; + INT8 bVehicleUnderRepairID; + INT32 iTimeCanSignElsewhere; INT8 bHospitalPriceModifier; INT8 bFillerBytes[3]; UINT32 uiStartTimeOfInsuranceContract; BOOLEAN fRTInNonintAnim; - BOOLEAN fDoingExternalDeath; - INT8 bCorpseQuoteTolerance; - INT8 bDeafenedCounter; - INT32 iPositionSndID; - INT32 iTuringSoundID; - UINT8 ubLastDamageReason; + BOOLEAN fDoingExternalDeath; + INT8 bCorpseQuoteTolerance; + INT8 bDeafenedCounter; + INT32 iPositionSndID; + INT32 iTuringSoundID; + UINT8 ubLastDamageReason; BOOLEAN fComplainedThatTired; INT16 sLastTwoLocations[2]; - INT16 bFillerDude; - INT32 uiTimeSinceLastBleedGrunt; - UINT8 ubNextToPreviousAttackerID; - UINT8 bDoAutofire; - BOOLEAN autofireLastStep; + INT16 bFillerDude; + INT32 uiTimeSinceLastBleedGrunt; + UINT8 ubNextToPreviousAttackerID; + UINT8 bDoAutofire; + BOOLEAN autofireLastStep; INT8 numFlanks; INT16 lastFlankSpot; BOOLEAN lastFlankLeft; @@ -1063,7 +2007,7 @@ public: UINT8 bFiller[ 36 ]; // - // New and OO stuff goes after here. Above this point any changes will goof up reading from files. + // New and OO stuff goes after here. Above this point any changes will goof up reading from files. // char ef1,ef2,ef3; // Extra filler to get "offsetof(endOfPOD)" to match SIZEOF(oldstruct) @@ -1071,276 +2015,12 @@ public: Inventory inv; - vector bNewItemCount; - vector bNewItemCycleCount; + std::vector bNewItemCount; + std::vector bNewItemCycleCount; + // Debugging data - not saved INT16 sPlotSrcGrid; -}; // SOLDIERTYPE; - -#define SIZEOF_SOLDIERTYPE_POD offsetof( SOLDIERTYPE, endOfPOD ) -#define SIZEOF_SOLDIERTYPE sizeof( SOLDIERTYPE ) - -#define HEALTH_INCREASE 0x0001 -#define STRENGTH_INCREASE 0x0002 -#define DEX_INCREASE 0x0004 -#define AGIL_INCREASE 0x0008 -#define WIS_INCREASE 0x0010 -#define LDR_INCREASE 0x0020 - -#define MRK_INCREASE 0x0040 -#define MED_INCREASE 0x0080 -#define EXP_INCREASE 0x0100 -#define MECH_INCREASE 0x0200 - -#define LVL_INCREASE 0x0400 - - -enum WeaponModes -{ - WM_NORMAL = 0, - WM_BURST, - WM_AUTOFIRE, - WM_ATTACHED_GL, - WM_ATTACHED_GL_BURST, - WM_ATTACHED_GL_AUTO, - NUM_WEAPON_MODES -} ; - -// TYPEDEFS FOR ANIMATION PROFILES -typedef struct -{ - UINT16 usTileFlags; - INT8 bTileX; - INT8 bTileY; - -} ANIM_PROF_TILE; - -typedef struct -{ - UINT8 ubNumTiles; - ANIM_PROF_TILE *pTiles; - -} ANIM_PROF_DIR; - -typedef struct ANIM_PROF -{ - - ANIM_PROF_DIR Dirs[8]; - -} ANIM_PROF; - - - -// Globals -////////// - -// VARIABLES FOR PALETTE REPLACEMENTS FOR HAIR, ETC -extern UINT32 guiNumPaletteSubRanges; -extern UINT8 *gubpNumReplacementsPerRange; -extern PaletteSubRangeType *gpPaletteSubRanges; -extern UINT32 guiNumReplacements; -extern PaletteReplacementType *gpPalRep; - -extern UINT8 bHealthStrRanges[]; - - -// Functions -//////////// - -// CREATION FUNCTIONS -BOOLEAN DeleteSoldier( SOLDIERTYPE *pSoldier ); -BOOLEAN CreateSoldierLight( SOLDIERTYPE *pSoldier ); -BOOLEAN DeleteSoldierLight( SOLDIERTYPE *pSoldier ); - -BOOLEAN CreateSoldierCommon( UINT8 ubBodyType, SOLDIERTYPE *pSoldier, UINT16 usSoldierID, UINT16 usState ); - - -// Soldier Management functions, called by Event Pump.c -BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT16 usStartingAniCode, BOOLEAN fForce ); - -BOOLEAN ChangeSoldierState( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT16 usStartingAniCode, BOOLEAN fForce ); -void EVENT_SetSoldierPosition( SOLDIERTYPE *pSoldier, FLOAT dNewXPos, FLOAT dNewYPos ); -void EVENT_SetSoldierDestination( SOLDIERTYPE *pSoldier, UINT8 ubNewDirection ); -void EVENT_GetNewSoldierPath( SOLDIERTYPE *pSoldier, UINT16 sDestGridNo, UINT16 usMovementAnim ); -BOOLEAN EVENT_InternalGetNewSoldierPath( SOLDIERTYPE *pSoldier, UINT16 sDestGridNo, UINT16 usMovementAnim, BOOLEAN fFromUI, BOOLEAN fForceRestart ); - -void EVENT_SetSoldierDirection( SOLDIERTYPE *pSoldier, UINT16 usNewDirection ); -void EVENT_SetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT8 ubNewDirection ); -void EVENT_FireSoldierWeapon( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ); -void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 ubDamage, INT16 sBreathLoss, UINT16 bDirection , UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation, INT16 sSubsequent, INT16 sLocationGridNo ); -void EVENT_SoldierBeginBladeAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection ); -void EVENT_SoldierBeginPunchAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection ); -void EVENT_SoldierBeginFirstAid( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection ); -void EVENT_StopMerc( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bDirection ); -void EVENT_SoldierBeginCutFence( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection ); -void EVENT_SoldierBeginRepair( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection ); -void EVENT_SoldierBeginRefuel( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection ); - - - -BOOLEAN SoldierReadyWeapon( SOLDIERTYPE *pSoldier, INT16 sTargetXPos, INT16 sTargetYPos, BOOLEAN fEndReady ); -void SetSoldierHeight( SOLDIERTYPE *pSoldier, FLOAT dNewHeight ); -void BeginSoldierClimbUpRoof( SOLDIERTYPE *pSoldier ); -void BeginSoldierClimbDownRoof( SOLDIERTYPE *pSoldier ); -void BeginSoldierClimbFence( SOLDIERTYPE *pSoldier ); -void SetSoldierGridNo( SOLDIERTYPE *pSoldier, INT16 sNewGridNo, BOOLEAN fForceRemove ); - -BOOLEAN CheckSoldierHitRoof( SOLDIERTYPE *pSoldier ); -void BeginSoldierGetup( SOLDIERTYPE *pSoldier ); -BOOLEAN ReCreateSelectedSoldierLight( ); - -// Soldier Management functions called by Overhead.c -BOOLEAN ConvertAniCodeToAniFrame( SOLDIERTYPE *pSoldier, UINT16 usAniFrame ); -void TurnSoldier( SOLDIERTYPE *pSold); -void EVENT_BeginMercTurn( SOLDIERTYPE *pSoldier, BOOLEAN fFromRealTime, INT32 iRealTimeCounter ); -void ChangeSoldierStance( SOLDIERTYPE *pSoldier, UINT8 ubDesiredStance ); -void ModifySoldierAniSpeed( SOLDIERTYPE *pSoldier ); -void StopSoldier( SOLDIERTYPE *pSoldier ); -UINT8 SoldierTakeDamage( SOLDIERTYPE *pSoldier, INT8 bHeight, INT16 sLifeDeduct, INT16 sBreathDeduct, UINT8 ubReason, UINT8 ubAttacker, INT16 sSourceGrid, INT16 sSubsequent, BOOLEAN fShowDamage ); -void RevivePlayerTeam( ); -void ReviveSoldier( SOLDIERTYPE *pSoldier ); - - -// Palette functions for soldiers -BOOLEAN CreateSoldierPalettes( SOLDIERTYPE *pSoldier ); -BOOLEAN GetPaletteRepIndexFromID( PaletteRepID aPalRep, UINT8 *pubPalIndex ); -BOOLEAN SetPaletteReplacement( SGPPaletteEntry *p8BPPPalette, PaletteRepID aPalRep ); -BOOLEAN LoadPaletteData( ); -BOOLEAN DeletePaletteData( ); - -// UTILITY FUNCTUIONS -void MoveMerc( SOLDIERTYPE *pSoldier, FLOAT dMovementChange, FLOAT dAngle, BOOLEAN fCheckRange ); -void MoveMercFacingDirection( SOLDIERTYPE *pSoldier, BOOLEAN fReverse, FLOAT dMovementDist ); -UINT8 GetDirectionFromXY( INT16 sXPos, INT16 sYPos, SOLDIERTYPE *pSoldier ); -UINT8 GetDirectionFromGridNo( INT16 sGridNo, SOLDIERTYPE *pSoldier ); -UINT8 atan8( INT16 sXPos, INT16 sYPos, INT16 sXPos2, INT16 sYPos2 ); -UINT8 atan8FromAngle( DOUBLE dAngle ); -INT8 CalcActionPoints(SOLDIERTYPE *pSold ); -BOOLEAN IsActionInterruptable( SOLDIERTYPE *pSoldier ); -INT16 GetDirectionToGridNoFromGridNo( INT16 sGridNoDest, INT16 sGridNoSrc ); -// This function is now obsolete. Call ReduceAttackBusyCount instead. -// void ReleaseSoldiersAttacker( SOLDIERTYPE *pSoldier ); -BOOLEAN MercInWater( SOLDIERTYPE *pSoldier ); -BOOLEAN MercInShallowWater( SOLDIERTYPE *pSoldier ); -BOOLEAN MercInDeepWater( SOLDIERTYPE *pSoldier ); -BOOLEAN MercInHighWater( SOLDIERTYPE *pSoldier ); -UINT16 GetNewSoldierStateFromNewStance( SOLDIERTYPE *pSoldier, UINT8 ubDesiredStance ); -UINT16 GetMoveStateBasedOnStance( SOLDIERTYPE *pSoldier, UINT8 ubStanceHeight ); -void SoldierGotoStationaryStance( SOLDIERTYPE *pSoldier ); -BOOLEAN ReCreateSoldierLight( SOLDIERTYPE *pSoldier ); - - -BOOLEAN DoMercBattleSound( SOLDIERTYPE *pSoldier, UINT8 ubBattleSoundID ); -BOOLEAN InternalDoMercBattleSound( SOLDIERTYPE *pSoldier, UINT8 ubBattleSoundID, INT8 bSpecialCode ); - - -UINT32 SoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, INT16 sKitPts, INT16 sStatus ); -void ReceivingSoldierCancelServices( SOLDIERTYPE *pSoldier ); -void GivingSoldierCancelServices( SOLDIERTYPE *pSoldier ); -void InternalReceivingSoldierCancelServices( SOLDIERTYPE *pSoldier, BOOLEAN fPlayEndAnim ); -void InternalGivingSoldierCancelServices( SOLDIERTYPE *pSoldier, BOOLEAN fPlayEndAnim ); - - - -// WRAPPERS FOR SOLDIER EVENTS -void SendSoldierPositionEvent( SOLDIERTYPE *pSoldier, FLOAT dNewXPos, FLOAT dNewYPos ); -void SendSoldierDestinationEvent( SOLDIERTYPE *pSoldier, UINT16 usNewDestination ); -void SendGetNewSoldierPathEvent( SOLDIERTYPE *pSoldier, UINT16 sDestGridNo, UINT16 usMovementAnim ); -void SendSoldierSetDirectionEvent( SOLDIERTYPE *pSoldier, UINT16 usNewDirection ); -void SendSoldierSetDesiredDirectionEvent( SOLDIERTYPE *pSoldier, UINT16 usDesiredDirection ); -void SendChangeSoldierStanceEvent( SOLDIERTYPE *pSoldier, UINT8 ubNewStance ); -void SendBeginFireWeaponEvent( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ); - -void HandleAnimationProfile( SOLDIERTYPE *pSoldier, UINT16 usAnimState, BOOLEAN fRemove ); -BOOLEAN GetProfileFlagsFromGridno( SOLDIERTYPE *pSoldier, UINT16 usAnimState, UINT16 sTestGridNo, UINT16 *usFlags ); - -void HaultSoldierFromSighting( SOLDIERTYPE *pSoldier, BOOLEAN fFromSightingEnemy ); -void ReLoadSoldierAnimationDueToHandItemChange( SOLDIERTYPE *pSoldier, UINT16 usOldItem, UINT16 usNewItem ); - -BOOLEAN CheckForBreathCollapse( SOLDIERTYPE *pSoldier ); - -BOOLEAN PreloadSoldierBattleSounds( SOLDIERTYPE *pSoldier, BOOLEAN fRemove ); - -#define PTR_CIVILIAN (pSoldier->bTeam == CIV_TEAM) -#define PTR_CROUCHED (gAnimControl[ pSoldier->usAnimState ].ubHeight == ANIM_CROUCH) -#define PTR_STANDING (gAnimControl[ pSoldier->usAnimState ].ubHeight == ANIM_STAND) -#define PTR_PRONE (gAnimControl[ pSoldier->usAnimState ].ubHeight == ANIM_PRONE) - - -void EVENT_SoldierBeginGiveItem( SOLDIERTYPE *pSoldier ); - -void DoNinjaAttack( SOLDIERTYPE *pSoldier ); - -BOOLEAN SoldierCarriesTwoHandedWeapon( SOLDIERTYPE *pSoldier ); -BOOLEAN InternalSoldierReadyWeapon( SOLDIERTYPE *pSoldier, UINT8 sFacingDir, BOOLEAN fEndReady ); - -void RemoveSoldierFromGridNo( SOLDIERTYPE *pSoldier ); - -void PositionSoldierLight( SOLDIERTYPE *pSoldier ); - -void SetCheckSoldierLightFlag( SOLDIERTYPE *pSoldier ); - -void EVENT_InternalSetSoldierDestination( SOLDIERTYPE *pSoldier, UINT8 ubNewDirection, BOOLEAN fFromMove, UINT16 usAnimState ); - -void ChangeToFlybackAnimation( SOLDIERTYPE *pSoldier, UINT8 ubDirection ); -void ChangeToFallbackAnimation( SOLDIERTYPE *pSoldier, UINT8 ubDirection ); - -//reset soldier timers -void ResetSoldierChangeStatTimer( SOLDIERTYPE *pSoldier ); - -void EVENT_SoldierBeginKnifeThrowAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection ); -void EVENT_SoldierBeginUseDetonator( SOLDIERTYPE *pSoldier ); -void EVENT_SoldierBeginDropBomb( SOLDIERTYPE *pSoldier ); -void EVENT_SoldierEnterVehicle( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection ); - - -void SetSoldierCowerState( SOLDIERTYPE *pSoldier, BOOLEAN fOn ); - -BOOLEAN PlayerSoldierStartTalking( SOLDIERTYPE *pSoldier, UINT8 ubTargetID, BOOLEAN fValidate ); - -void EVENT_InternalSetSoldierPosition( SOLDIERTYPE *pSoldier, FLOAT dNewXPos, FLOAT dNewYPos ,BOOLEAN fUpdateDest, BOOLEAN fUpdateFinalDest, BOOLEAN fForceDelete ); - -void InternalRemoveSoldierFromGridNo( SOLDIERTYPE *pSoldier, BOOLEAN fForce ); - -void EVENT_SetSoldierPositionAndMaybeFinalDest( SOLDIERTYPE *pSoldier, FLOAT dNewXPos, FLOAT dNewYPos, BOOLEAN fUpdateFinalDest ); - -void EVENT_SetSoldierPositionForceDelete( SOLDIERTYPE *pSoldier, FLOAT dNewXPos, FLOAT dNewYPos ); - -void CalcNewActionPoints( SOLDIERTYPE *pSoldier ); - -BOOLEAN InternalIsValidStance( SOLDIERTYPE *pSoldier, INT8 bDirection, INT8 bNewStance ); - -void AdjustNoAPToFinishMove( SOLDIERTYPE *pSoldier, BOOLEAN fSet ); - - -void UpdateRobotControllerGivenController( SOLDIERTYPE *pSoldier ); -void UpdateRobotControllerGivenRobot( SOLDIERTYPE *pSoldier ); -SOLDIERTYPE *GetRobotController( SOLDIERTYPE *pSoldier ); -BOOLEAN CanRobotBeControlled( SOLDIERTYPE *pSoldier ); -BOOLEAN ControllingRobot( SOLDIERTYPE *pSoldier ); - -void EVENT_SoldierBeginReloadRobot( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection, UINT8 ubMercSlot ); - -void EVENT_SoldierBeginTakeBlood( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection ); - -void EVENT_SoldierBeginAttachCan( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection ); - -void HandleSoldierTakeDamageFeedback( SOLDIERTYPE *pSoldier ); - -void PickDropItemAnimation( SOLDIERTYPE *pSoldier ); - -BOOLEAN IsValidSecondHandShot( SOLDIERTYPE *pSoldier ); -BOOLEAN IsValidSecondHandShotForReloadingPurposes( SOLDIERTYPE *pSoldier ); - -void CrowsFlyAway( UINT8 ubTeam ); - -void DebugValidateSoldierData( ); - -void BeginTyingToFall( SOLDIERTYPE *pSoldier ); - -void SetSoldierAsUnderAiControl( SOLDIERTYPE *pSoldier ); -void HandlePlayerTogglingLightEffects( BOOLEAN fToggleValue ); -BOOLEAN SoldierReadyWeapon( SOLDIERTYPE *pSoldier ); +}; // OLDSOLDIERTYPE_101; #endif diff --git a/Tactical/Soldier Create.cpp b/Tactical/Soldier Create.cpp index 08a62456..300b5d39 100644 --- a/Tactical/Soldier Create.cpp +++ b/Tactical/Soldier Create.cpp @@ -10,7 +10,7 @@ #include "soldier profile.h" #include "animation control.h" #include "animation data.h" - #include "sound control.h" + #include "Sound Control.h" #include "overhead types.h" #include "faces.h" #include "isometric utils.h" @@ -65,7 +65,184 @@ #define MAX_PALACE_DISTANCE 20 -// WDS - Clean up inventory handling +OLD_SOLDIERCREATE_STRUCT_101::OLD_SOLDIERCREATE_STRUCT_101() { + initialize(); +} + +// Copy Constructor +OLD_SOLDIERCREATE_STRUCT_101::OLD_SOLDIERCREATE_STRUCT_101(const OLD_SOLDIERCREATE_STRUCT_101& src) { + memcpy(this, &src, SIZEOF_OLD_SOLDIERCREATE_STRUCT_101_POD); + this->Inv = src.Inv; +} + +// Assignment operator +OLD_SOLDIERCREATE_STRUCT_101& OLD_SOLDIERCREATE_STRUCT_101::operator=(const OLD_SOLDIERCREATE_STRUCT_101& src) +{ + if (this != &src) { + memcpy(this, &src, SIZEOF_OLD_SOLDIERCREATE_STRUCT_101_POD); + this->Inv = src.Inv; + } + return *this; +} + +// Destructor +OLD_SOLDIERCREATE_STRUCT_101::~OLD_SOLDIERCREATE_STRUCT_101() { +} + +// Initialize the soldier. +// Use this instead of the old method of calling memset! +// Note that the constructor does this automatically. +void OLD_SOLDIERCREATE_STRUCT_101::initialize() { + memset( this, 0, SIZEOF_OLD_SOLDIERCREATE_STRUCT_101_POD); + Inv.clear(); +} + + + + + +// Conversion operator from old to new +SOLDIERCREATE_STRUCT& SOLDIERCREATE_STRUCT::operator=(const OLD_SOLDIERCREATE_STRUCT_101& src) +{ + if ((void*)this != (void*)&src) { + this->Inv = src.Inv; + + memcpy( &(this->name), &(src.name), sizeof(CHAR16) * 10 ); + memcpy( &(this->HeadPal), &(src.HeadPal), sizeof(PaletteRepID) ); // 30 + memcpy( &(this->PantsPal), &(src.PantsPal), sizeof(PaletteRepID) ); // 30 + memcpy( &(this->VestPal), &(src.VestPal), sizeof(PaletteRepID) ); // 30 + memcpy( &(this->SkinPal), &(src.SkinPal), sizeof(PaletteRepID) ); // 30 + memcpy( &(this->MiscPal), &(src.MiscPal), sizeof(PaletteRepID) ); // 30 + memcpy( &(this->sPatrolGrid), &(src.sPatrolGrid), sizeof(INT16) * MAXPATROLGRIDS ); + + this->bAgility = src.bAgility; + this->bAIMorale = src.bAIMorale; + this->bAttitude = src.bAttitude; + this->bBodyType = src.bBodyType; + this->bDexterity = src.bDexterity; + this->ubDirection = src.ubDirection; + this->bExpLevel = src.bExpLevel; + this->bExplosive = src.bExplosive; + this->bLeadership = src.bLeadership; + this->bLife = src.bLife; + this->bLifeMax = src.bLifeMax; + this->bMarksmanship = src.bMarksmanship; + this->bMechanical = src.bMechanical; + this->bMedical = src.bMedical; + this->bMorale = src.bMorale; + this->bOrders = src.bOrders; + this->bPatrolCnt = src.bPatrolCnt; + this->bSectorZ = src.bSectorZ; + this->bStrength = src.bStrength; + this->bTeam = src.bTeam; + this->bUseGivenVehicleID = src.bUseGivenVehicleID; + this->bWisdom = src.bWisdom; + this->fCopyProfileItemsOver = src.fCopyProfileItemsOver; + this->fHasKeys = src.fHasKeys; + this->fKillSlotIfOwnerDies = src.fKillSlotIfOwnerDies; + this->fOnRoof = src.fOnRoof; + this->fPlayerMerc = src.fPlayerMerc; + this->fPlayerPlan = src.fPlayerPlan; + this->fStatic = src.fStatic; + this->fUseExistingSoldier = src.fUseExistingSoldier; + this->fUseGivenVehicle = src.fUseGivenVehicle; + this->fVisible = src.fVisible; + this->pExistingSoldier = src.pExistingSoldier; + this->sInsertionGridNo = src.sInsertionGridNo; + this->sSectorX = src.sSectorX; + this->sSectorY = src.sSectorY; + this->ubCivilianGroup = src.ubCivilianGroup; + this->ubProfile = src.ubProfile; + this->ubScheduleID = src.ubScheduleID; + this->ubSoldierClass = src.ubSoldierClass; + } + return *this; +} + +// Conversion operator from SOLDIERTYPE to SOLDIERCREATE_STRUCT +SOLDIERCREATE_STRUCT& SOLDIERCREATE_STRUCT::operator=(const SOLDIERTYPE& Soldier) +{ + //WARNING, this may not copy all data you expect over, I'm not sure + //but it does copy all the data from the previous function + //Copy over the data of the soldier. + this->ubProfile = NO_PROFILE; + this->bLife = Soldier.stats.bLife; + this->bLifeMax = Soldier.stats.bLifeMax; + this->bAgility = Soldier.stats.bAgility; + this->bDexterity = Soldier.stats.bDexterity; + this->bExpLevel = Soldier.stats.bExpLevel; + this->bMarksmanship = Soldier.stats.bMarksmanship; + this->bMedical = Soldier.stats.bMedical; + this->bMechanical = Soldier.stats.bMechanical; + this->bExplosive = Soldier.stats.bExplosive; + this->bLeadership = Soldier.stats.bLeadership; + this->bStrength = Soldier.stats.bStrength; + this->bWisdom = Soldier.stats.bWisdom; + this->bAttitude = Soldier.aiData.bAttitude; + this->bOrders = Soldier.aiData.bOrders; + this->bMorale = Soldier.aiData.bMorale; + this->bAIMorale = Soldier.aiData.bAIMorale; + this->bBodyType = Soldier.ubBodyType; + this->ubCivilianGroup = Soldier.ubCivilianGroup; + this->ubScheduleID = Soldier.ubScheduleID; + this->fHasKeys = Soldier.flags.bHasKeys; + this->sSectorX = Soldier.sSectorX; + this->sSectorY = Soldier.sSectorY; + this->bSectorZ = Soldier.bSectorZ; + this->ubSoldierClass = Soldier.ubSoldierClass; + this->bTeam = Soldier.bTeam; + this->ubDirection = Soldier.ubDirection; + + this->fOnRoof = Soldier.pathing.bLevel; + this->sInsertionGridNo = Soldier.sGridNo; + + swprintf( this->name, Soldier.name ); + + //Copy patrol points + this->bPatrolCnt = Soldier.aiData.bPatrolCnt; + memcpy( this->sPatrolGrid, Soldier.aiData.sPatrolGrid, sizeof( INT16 ) * MAXPATROLGRIDS ); + + //copy colors for soldier based on the body type. + sprintf( this->HeadPal, Soldier.HeadPal ); + sprintf( this->VestPal, Soldier.VestPal ); + sprintf( this->SkinPal, Soldier.SkinPal ); + sprintf( this->PantsPal, Soldier.PantsPal ); + sprintf( this->MiscPal, Soldier.MiscPal ); + + //copy soldier's inventory + this->Inv = Soldier.inv; + return *this; +} + +UINT16 SOLDIERCREATE_STRUCT::GetChecksum() +{ + return ( + this->bLife * 7 + + this->bLifeMax * 8 - + this->bAgility * 2 + + this->bDexterity * 1 + + this->bExpLevel * 5 - + this->bMarksmanship * 9 + + this->bMedical * 10 + + this->bMechanical * 3 + + this->bExplosive * 4 + + this->bLeadership * 5 + + this->bStrength * 7 + + this->bWisdom * 11 + + this->bMorale * 7 + + this->bAIMorale * 3 - + this->bBodyType * 7 + + 4 * 6 + + this->sSectorX * 7 - + this->ubSoldierClass * 4 + + this->bTeam * 7 + + this->ubDirection * 5 + + this->fOnRoof * 17 + + this->sInsertionGridNo * 1 + + 3); +} + + SOLDIERCREATE_STRUCT::SOLDIERCREATE_STRUCT() { initialize(); } @@ -79,23 +256,23 @@ SOLDIERCREATE_STRUCT::SOLDIERCREATE_STRUCT(const SOLDIERCREATE_STRUCT& src) { // Assignment operator SOLDIERCREATE_STRUCT& SOLDIERCREATE_STRUCT::operator=(const SOLDIERCREATE_STRUCT& src) { - if (this != &src) { + if (this != &src) { memcpy(this, &src, SIZEOF_SOLDIERCREATE_STRUCT_POD); this->Inv = src.Inv; - } - return *this; + } + return *this; } // Destructor SOLDIERCREATE_STRUCT::~SOLDIERCREATE_STRUCT() { } -// Initialize the soldier. -// Use this instead of the old method of calling memset! -// Note that the constructor does this automatically. +// Initialize the soldier. +// Use this instead of the old method of calling memset! +// Note that the constructor does this automatically. void SOLDIERCREATE_STRUCT::initialize() { - memset( this, 0, SIZEOF_SOLDIERCREATE_STRUCT_POD); - Inv.initialize(); + memset( this, 0, SIZEOF_SOLDIERCREATE_STRUCT_POD); + Inv.clear(); } @@ -105,7 +282,7 @@ void SOLDIERCREATE_STRUCT::initialize() { // If you change names or eliminate some positions or such you need to change these. // Eventually the need for these functions will disappear. -void SOLDIERCREATE_STRUCT::CopyOldInventoryToNew() { +void OLD_SOLDIERCREATE_STRUCT_101::CopyOldInventoryToNew() { // Do not use a loop in case the new inventory slots are arranged differently than the old Inv[HELMETPOS] = DO_NOT_USE_Inv[OldInventory::HELMETPOS]; Inv[VESTPOS] = DO_NOT_USE_Inv[OldInventory::VESTPOS]; @@ -127,7 +304,8 @@ void SOLDIERCREATE_STRUCT::CopyOldInventoryToNew() { Inv[SMALLPOCK7POS] = DO_NOT_USE_Inv[OldInventory::SMALLPOCK7POS]; Inv[SMALLPOCK8POS] = DO_NOT_USE_Inv[OldInventory::SMALLPOCK8POS]; } -void SOLDIERCREATE_STRUCT::CopyNewInventoryToOld() { +/* +void OLD_SOLDIERCREATE_STRUCT_101::CopyNewInventoryToOld() { // Do not use a loop in case the new inventory slots are arranged differently than the old DO_NOT_USE_Inv[OldInventory::HELMETPOS] = Inv[HELMETPOS]; DO_NOT_USE_Inv[OldInventory::VESTPOS] = Inv[VESTPOS]; @@ -149,6 +327,7 @@ void SOLDIERCREATE_STRUCT::CopyNewInventoryToOld() { DO_NOT_USE_Inv[OldInventory::SMALLPOCK7POS] = Inv[SMALLPOCK7POS]; DO_NOT_USE_Inv[OldInventory::SMALLPOCK8POS] = Inv[SMALLPOCK8POS]; } +*/ //Private functions used within TacticalCreateStruct() @@ -166,6 +345,15 @@ UINT32 guiCurrentUniqueSoldierId = 1; // CJC note: trust me, it's easiest just to put this here; this is the only // place it should need to be used +/* CHRISL: There's nothing to fix here. This array is only used on non-hireable NPCs to designate whether an object can +be dropped or not. And we only have an 8bit field to store these flags. So there's no need to change anything. New or +Old inventory system, NPC profiles use the old style pocket system.*/ +//ADB actually that's not correct, all NPC profiles use the new pocket system. +//To verify this, give Fatima the letter then check what slot it is in when she is in A10. +//AFAIK there is no way to seperate non hireable NPCs from hireable NPCs, so to fix Ira all NPC profiles are adjusted. +/* CHRISL: You can't make change to this. You can add values to the end if you want, but prof.dat requires +this setup. That's one of the many reasons I setup the new inventory system to NOT be used by computer +controlled characters. */ UINT8 gubItemDroppableFlag[NUM_INV_SLOTS] = { 0x01, @@ -175,25 +363,25 @@ UINT8 gubItemDroppableFlag[NUM_INV_SLOTS] = 0, 0x08, 0, - 0x10, - 0x20, - 0x40, - 0x80, - 0, - 0, - 0, - 0, + 0, //0x10, + 0, //0x20, + 0, //0x40, + 0, //0x80, 0, 0, 0, + 0x10, //0, + 0x20, //0, + 0x40, //0, + 0x80, //0, 0 }; void RandomizeNewSoldierStats( SOLDIERCREATE_STRUCT *pCreateStruct ) { - pCreateStruct->bLifeMax = (UINT8)Random(50)+50; - pCreateStruct->bLife = pCreateStruct->bLifeMax; + pCreateStruct->bLifeMax = (UINT8)Random(50)+50; + pCreateStruct->bLife = pCreateStruct->bLifeMax; pCreateStruct->bAgility = (UINT8)Random(50)+50; pCreateStruct->bDexterity = (UINT8)Random(50)+50; pCreateStruct->bExpLevel = 1 + (UINT8)Random(4); @@ -241,14 +429,14 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("TacticalCreateSoldier")); //Kris: - //Huge no no! See the header file for description of static detailed placements. + //Huge no no! See the header file for description of static detailed placements. //If this expression ever evaluates to true, then it will expose serious problems. //Simply returning won't help. if( pCreateStruct->fStatic ) - { + { Assert( 0 ); } - + // Some values initialized here but could be changed before going to the common one InitSoldierStruct( &Soldier ); @@ -275,18 +463,18 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * // First off, force player team if they are a player guy! ( do some other stuff for only our guys! if ( pCreateStruct->fPlayerMerc ) { - Soldier.uiStatusFlags |= SOLDIER_PC; + Soldier.flags.uiStatusFlags |= SOLDIER_PC; Soldier.bTeam = gbPlayerNum; Soldier.bVisible = 1; } else if ( pCreateStruct->fPlayerPlan ) { - Soldier.uiStatusFlags |= SOLDIER_PC; + Soldier.flags.uiStatusFlags |= SOLDIER_PC; Soldier.bVisible = 1; } else { - Soldier.uiStatusFlags |= SOLDIER_ENEMY; + Soldier.flags.uiStatusFlags |= SOLDIER_ENEMY; } @@ -297,8 +485,8 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * // OK, if this is our guy, set team as ours! if ( pCreateStruct->fPlayerMerc ) { - Soldier.bTeam = OUR_TEAM; - Soldier.bNormalSmell = NORMAL_HUMAN_SMELL_STRENGTH; + Soldier.bTeam = OUR_TEAM; + Soldier.aiData.bNormalSmell = NORMAL_HUMAN_SMELL_STRENGTH; } else if ( pCreateStruct->fPlayerPlan ) { @@ -313,7 +501,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * case BIGMALE: case STOCKYMALE: case REGFEMALE: - + Soldier.bTeam = ENEMY_TEAM; break; @@ -378,9 +566,9 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * bLastTeamID = gTacticalStatus.Team[ Soldier.bTeam ].bLastID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pTeamSoldier++) - { + { if ( !pTeamSoldier->bActive ) { fGuyAvail = TRUE; @@ -407,7 +595,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * } - Soldier.bActionPoints = CalcActionPoints( &Soldier ); + Soldier.bActionPoints = Soldier.CalcActionPoints( ); Soldier.bInitialActionPoints = Soldier.bActionPoints; Soldier.bSide = gTacticalStatus.Team[ Soldier.bTeam ].bSide; Soldier.bActive = TRUE; @@ -415,41 +603,41 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * Soldier.sSectorY = pCreateStruct->sSectorY; Soldier.bSectorZ = pCreateStruct->bSectorZ; Soldier.ubInsertionDirection = pCreateStruct->ubDirection; - Soldier.bDesiredDirection = pCreateStruct->ubDirection; - Soldier.bDominantDir = pCreateStruct->ubDirection; + Soldier.pathing.bDesiredDirection = pCreateStruct->ubDirection; + Soldier.aiData.bDominantDir = pCreateStruct->ubDirection; Soldier.ubDirection = pCreateStruct->ubDirection; Soldier.sInsertionGridNo = pCreateStruct->sInsertionGridNo; - Soldier.bOldLife = Soldier.bLifeMax; + Soldier.bOldLife = Soldier.stats.bLifeMax; // If a civvy, set neutral - if ( Soldier.bTeam == CIV_TEAM ) + if ( Soldier.bTeam == CIV_TEAM ) { if (Soldier.ubProfile == WARDEN ) { - Soldier.bNeutral = FALSE; + Soldier.aiData.bNeutral = FALSE; } else if (Soldier.ubCivilianGroup != NON_CIV_GROUP) { if ( gTacticalStatus.fCivGroupHostile[ Soldier.ubCivilianGroup ] == CIV_GROUP_HOSTILE ) { - Soldier.bNeutral = FALSE; + Soldier.aiData.bNeutral = FALSE; } else { - Soldier.bNeutral = TRUE; + Soldier.aiData.bNeutral = TRUE; } } else { - Soldier.bNeutral = TRUE; + Soldier.aiData.bNeutral = TRUE; } - + //Weaken stats based on the bodytype of the civilian. if( Soldier.ubProfile == NO_PROFILE ) { switch( Soldier.ubBodyType ) - { + { case REGMALE: case BIGMALE: case STOCKYMALE: @@ -458,22 +646,22 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * break; case FATCIV: //fat, so slower - Soldier.bAgility = (INT8)( 30 + Random( 26 ) ); //30 - 55 + Soldier.stats.bAgility = (INT8)( 30 + Random( 26 ) ); //30 - 55 break; case MANCIV: - Soldier.bLife = Soldier.bLifeMax = (INT8)( 35 + Random( 26 ) ); //35 - 60 + Soldier.stats.bLife = Soldier.stats.bLifeMax = (INT8)( 35 + Random( 26 ) ); //35 - 60 break; case MINICIV: case DRESSCIV: - Soldier.bLife = Soldier.bLifeMax = (INT8)( 30 + Random( 16 ) ); //30 - 45 + Soldier.stats.bLife = Soldier.stats.bLifeMax = (INT8)( 30 + Random( 16 ) ); //30 - 45 break; case HATKIDCIV: case KIDCIV: - Soldier.bLife = Soldier.bLifeMax = (INT8)( 20 + Random( 16 ) ); //20 - 35 + Soldier.stats.bLife = Soldier.stats.bLifeMax = (INT8)( 20 + Random( 16 ) ); //20 - 35 break; case CRIPPLECIV: - Soldier.bLife = Soldier.bLifeMax = (INT8)( 20 + Random( 26 ) ); //20 - 45 - Soldier.bAgility = (INT8)( 30 + Random( 16 ) ); // 30 - 45 + Soldier.stats.bLife = Soldier.stats.bLifeMax = (INT8)( 20 + Random( 26 ) ); //20 - 45 + Soldier.stats.bAgility = (INT8)( 30 + Random( 16 ) ); // 30 - 45 break; } } @@ -483,7 +671,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * // bloodcats are neutral to start out if ( Soldier.ubBodyType == BLOODCAT ) { - Soldier.bNeutral = TRUE; + Soldier.aiData.bNeutral = TRUE; } // otherwise (creatures) false } @@ -496,7 +684,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * // Lesh: disable this - yeah! its feminism! :) // ATE: TEMP : No enemy women mercs (unless elite)! - //if( Soldier.ubProfile == NO_PROFILE && Soldier.bTeam == ENEMY_TEAM && + //if( Soldier.ubProfile == NO_PROFILE && Soldier.bTeam == ENEMY_TEAM && // Soldier.ubBodyType == REGFEMALE && Soldier.ubSoldierClass != SOLDIER_CLASS_ELITE ) //{ // Soldier.ubBodyType = (UINT8)( REGMALE + Random( 3 ) ); @@ -506,31 +694,30 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * // Set some values for variation in anims... if ( Soldier.ubBodyType == BIGMALE ) { - Soldier.uiAnimSubFlags |= SUB_ANIM_BIGGUYTHREATENSTANCE; + Soldier.uiAnimSubFlags |= SUB_ANIM_BIGGUYTHREATENSTANCE; } - //For inventory, look for any face class items that may be located in the big pockets and if found, move + //For inventory, look for any face class items that may be located in the big pockets and if found, move //that item to a face slot and clear the pocket! if( Soldier.bTeam != OUR_TEAM ) { INT32 i; BOOLEAN fSecondFaceItem = FALSE; - for( i = BIGPOCK1POS; i <= BIGPOCK4POS; i++ ) + // CHRISL: + for( i = BIGPOCKSTART; i < BIGPOCKFINAL; i++ ) { if( Item[ Soldier.inv[ i ].usItem ].usItemClass & IC_FACE ) { if( !fSecondFaceItem ) - { //Don't check for compatibility... automatically assume there are no head positions filled. + { //Don't check for compatibility... automatically assume there are no head positions filled. fSecondFaceItem = TRUE; - memcpy( &Soldier.inv[ HEAD1POS ], &Soldier.inv[ i ], sizeof( OBJECTTYPE ) ); - memset( &Soldier.inv[ i ], 0, sizeof( OBJECTTYPE ) ); + Soldier.inv[ i ].MoveThisObjectTo(Soldier.inv[ HEAD1POS ], ALL_OBJECTS, &Soldier, HEAD1POS); } else { //if there is a second item, compare it to the first one we already added. if( CompatibleFaceItem( Soldier.inv[ HEAD1POS ].usItem, Soldier.inv[ i ].usItem ) ) { - memcpy( &Soldier.inv[ HEAD2POS ], &Soldier.inv[ i ], sizeof( OBJECTTYPE ) ); - memset( &Soldier.inv[ i ], 0, sizeof( OBJECTTYPE ) ); + Soldier.inv[ i ].MoveThisObjectTo(Soldier.inv[ HEAD2POS ], ALL_OBJECTS, &Soldier, HEAD2POS); break; } } @@ -557,9 +744,9 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * } //Set some flags, actions based on what body type we are - //NOTE: BE VERY CAREFUL WHAT YOU DO IN THIS SECTION! - // It is very possible to override editor settings, especially orders and attitude. - // In those cases, you can check for !gfEditMode (not in editor). + //NOTE: BE VERY CAREFUL WHAT YOU DO IN THIS SECTION! + // It is very possible to override editor settings, especially orders and attitude. + // In those cases, you can check for !gfEditMode (not in editor). switch ( Soldier.ubBodyType ) { case HATKIDCIV: @@ -573,13 +760,13 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * case DRESSCIV: Soldier.ubBattleSoundID = 7 + (UINT8) Random( 2 ); - Soldier.bNormalSmell = NORMAL_HUMAN_SMELL_STRENGTH; + Soldier.aiData.bNormalSmell = NORMAL_HUMAN_SMELL_STRENGTH; break; case BLOODCAT: AssignCreatureInventory( &Soldier ); - Soldier.bNormalSmell = NORMAL_HUMAN_SMELL_STRENGTH; - Soldier.uiStatusFlags |= SOLDIER_ANIMAL; + Soldier.aiData.bNormalSmell = NORMAL_HUMAN_SMELL_STRENGTH; + Soldier.flags.uiStatusFlags |= SOLDIER_ANIMAL; break; case ADULTFEMALEMONSTER: @@ -591,28 +778,28 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * case QUEENMONSTER: AssignCreatureInventory( &Soldier ); - Soldier.ubCaller = NOBODY; + Soldier.aiData.ubCaller = NOBODY; if( !gfEditMode ) { - Soldier.bOrders = FARPATROL; - Soldier.bAttitude = AGGRESSIVE; + Soldier.aiData.bOrders = FARPATROL; + Soldier.aiData.bAttitude = AGGRESSIVE; } - Soldier.uiStatusFlags |= SOLDIER_MONSTER; - Soldier.bMonsterSmell = NORMAL_CREATURE_SMELL_STRENGTH; + Soldier.flags.uiStatusFlags |= SOLDIER_MONSTER; + Soldier.aiData.bMonsterSmell = NORMAL_CREATURE_SMELL_STRENGTH; break; case COW: - Soldier.uiStatusFlags |= SOLDIER_ANIMAL; - Soldier.bNormalSmell = COW_SMELL_STRENGTH; + Soldier.flags.uiStatusFlags |= SOLDIER_ANIMAL; + Soldier.aiData.bNormalSmell = COW_SMELL_STRENGTH; break; case CROW: - Soldier.uiStatusFlags |= SOLDIER_ANIMAL; + Soldier.flags.uiStatusFlags |= SOLDIER_ANIMAL; break; case ROBOTNOWEAPON: - Soldier.uiStatusFlags |= SOLDIER_ROBOT; + Soldier.flags.uiStatusFlags |= SOLDIER_ROBOT; break; case HUMVEE: @@ -622,26 +809,26 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * case TANK_NW: case TANK_NE: - Soldier.uiStatusFlags |= SOLDIER_VEHICLE; + Soldier.flags.uiStatusFlags |= SOLDIER_VEHICLE; switch( Soldier.ubBodyType ) { case HUMVEE: ubVehicleID = HUMMER; - Soldier.bNeutral = TRUE; + Soldier.aiData.bNeutral = TRUE; break; case ELDORADO: ubVehicleID = ELDORADO_CAR; - Soldier.bNeutral = TRUE; + Soldier.aiData.bNeutral = TRUE; break; case ICECREAMTRUCK: ubVehicleID = ICE_CREAM_TRUCK; - Soldier.bNeutral = TRUE; + Soldier.aiData.bNeutral = TRUE; break; case JEEP: @@ -668,21 +855,19 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * } SetVehicleValuesIntoSoldierType( &Soldier ); break; - + default: - Soldier.bNormalSmell = NORMAL_HUMAN_SMELL_STRENGTH; + Soldier.aiData.bNormalSmell = NORMAL_HUMAN_SMELL_STRENGTH; break; } if( guiCurrentScreen != AUTORESOLVE_SCREEN ) { - // WDS - Clean up inventory handling // Copy into merc struct - //memcpy( MercPtrs[ Soldier.ubID ], &Soldier, SIZEOF_SOLDIERTYPE ); *MercPtrs[ Soldier.ubID ] = Soldier; // Alrighty then, we are set to create the merc, stuff after here can fail! - CHECKF( CreateSoldierCommon( Soldier.ubBodyType, MercPtrs[ Soldier.ubID ], Soldier.ubID, STANDING ) != FALSE ); + CHECKF( MercPtrs[ Soldier.ubID ]->CreateSoldierCommon( Soldier.ubBodyType, Soldier.ubID, STANDING ) != FALSE ); } } else @@ -695,21 +880,19 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * Soldier.iFaceIndex = -1; Soldier.iFaceIndex = InitSoldierFace( &Soldier ); - // ATE: Reset soldier's light value to -1.... - Soldier.iLight = -1; + // ATE: Reset soldier's light value to -1.... + Soldier.iLight = -1; if ( Soldier.ubBodyType == HUMVEE || Soldier.ubBodyType == ICECREAMTRUCK ) - { - Soldier.bNeutral = TRUE; - } + { + Soldier.aiData.bNeutral = TRUE; + } - // WDS - Clean up inventory handling // Copy into merc struct - //memcpy( MercPtrs[ Soldier.ubID ], &Soldier, SIZEOF_SOLDIERTYPE ); *MercPtrs[ Soldier.ubID ] = Soldier; // Alrighty then, we are set to create the merc, stuff after here can fail! - CHECKF( CreateSoldierCommon( Soldier.ubBodyType, MercPtrs[ Soldier.ubID ], Soldier.ubID, Menptr[ Soldier.ubID ].usAnimState ) != FALSE ); + CHECKF( MercPtrs[ Soldier.ubID ]->CreateSoldierCommon( Soldier.ubBodyType, Soldier.ubID, Menptr[ Soldier.ubID ].usAnimState ) != FALSE ); *pubID = Soldier.ubID; @@ -724,7 +907,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * { if( pCreateStruct->fOnRoof && FlatRoofAboveGridNo( pCreateStruct->sInsertionGridNo ) ) { - SetSoldierHeight( MercPtrs[ Soldier.ubID ], 58.0 ); + MercPtrs[ Soldier.ubID ]->SetSoldierHeight( 58.0 ); } //if we are loading DONT add men to team, because the number is restored in gTacticalStatus @@ -745,17 +928,14 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * return MercPtrs[ Soldier.ubID ]; } - else + else { //We are creating a dynamically allocated soldier for autoresolve. SOLDIERTYPE *pSoldier; UINT8 ubSectorID; ubSectorID = GetAutoResolveSectorID(); - // WDS - Clean up inventory handling - pSoldier = new SOLDIERTYPE; //(SOLDIERTYPE*)MemAlloc( SIZEOF_SOLDIERTYPE ); + pSoldier = new SOLDIERTYPE(Soldier); //(SOLDIERTYPE*)MemAlloc( SIZEOF_SOLDIERTYPE ); if( !pSoldier ) return NULL; - //memcpy( pSoldier, &Soldier, SIZEOF_SOLDIERTYPE ); - *pSoldier = Soldier; pSoldier->ubID = 255; pSoldier->sSectorX = (INT16)SECTORX( ubSectorID ); pSoldier->sSectorY = (INT16)SECTORY( ubSectorID ); @@ -776,46 +956,46 @@ BOOLEAN TacticalCopySoldierFromProfile( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STR SET_PALETTEREP_ID ( pSoldier->HeadPal, pProfile->HAIR ); SET_PALETTEREP_ID ( pSoldier->VestPal, pProfile->VEST ); SET_PALETTEREP_ID ( pSoldier->SkinPal, pProfile->SKIN ); - SET_PALETTEREP_ID ( pSoldier->PantsPal, pProfile->PANTS ); + SET_PALETTEREP_ID ( pSoldier->PantsPal, pProfile->PANTS ); // Set profile index! pSoldier->ubProfile = ubProfileIndex; pSoldier->ubScheduleID = pCreateStruct->ubScheduleID; - pSoldier->bHasKeys = pCreateStruct->fHasKeys; + pSoldier->flags.bHasKeys = pCreateStruct->fHasKeys; wcscpy( pSoldier->name, pProfile->zNickname ); - pSoldier->bLife = pProfile->bLife; - pSoldier->bLifeMax = pProfile->bLifeMax; - pSoldier->bAgility = pProfile->bAgility; - pSoldier->bLeadership = pProfile->bLeadership; - pSoldier->bDexterity = pProfile->bDexterity; - pSoldier->bStrength = pProfile->bStrength; - pSoldier->bWisdom = pProfile->bWisdom; - pSoldier->bExpLevel = pProfile->bExpLevel; - pSoldier->bMarksmanship = pProfile->bMarksmanship; - pSoldier->bMedical = pProfile->bMedical; - pSoldier->bMechanical = pProfile->bMechanical; - pSoldier->bExplosive = pProfile->bExplosive; - pSoldier->bScientific = pProfile->bScientific; + pSoldier->stats.bLife = pProfile->bLife; + pSoldier->stats.bLifeMax = pProfile->bLifeMax; + pSoldier->stats.bAgility = pProfile->bAgility; + pSoldier->stats.bLeadership = pProfile->bLeadership; + pSoldier->stats.bDexterity = pProfile->bDexterity; + pSoldier->stats.bStrength = pProfile->bStrength; + pSoldier->stats.bWisdom = pProfile->bWisdom; + pSoldier->stats.bExpLevel = pProfile->bExpLevel; + pSoldier->stats.bMarksmanship = pProfile->bMarksmanship; + pSoldier->stats.bMedical = pProfile->bMedical; + pSoldier->stats.bMechanical = pProfile->bMechanical; + pSoldier->stats.bExplosive = pProfile->bExplosive; + pSoldier->stats.bScientific = pProfile->bScientific; pSoldier->bVocalVolume = MIDVOLUME; pSoldier->uiAnimSubFlags = pProfile->uiBodyTypeSubFlags; pSoldier->ubBodyType = pProfile->ubBodyType; pSoldier->ubCivilianGroup = pProfile->ubCivilianGroup; //OK set initial duty -// pSoldier->bAssignment=ON_DUTY; +// pSoldier->bAssignment=ON_DUTY; pSoldier->bOldAssignment = NO_ASSIGNMENT; - pSoldier->ubSkillTrait1 = pProfile->bSkillTrait; - pSoldier->ubSkillTrait2 = pProfile->bSkillTrait2; + pSoldier->stats.ubSkillTrait1 = pProfile->bSkillTrait; + pSoldier->stats.ubSkillTrait2 = pProfile->bSkillTrait2; - pSoldier->bOrders = pCreateStruct->bOrders; - pSoldier->bAttitude = pCreateStruct->bAttitude; + pSoldier->aiData.bOrders = pCreateStruct->bOrders; + pSoldier->aiData.bAttitude = pCreateStruct->bAttitude; pSoldier->ubDirection = pCreateStruct->ubDirection; - pSoldier->bPatrolCnt = pCreateStruct->bPatrolCnt; - memcpy( pSoldier->usPatrolGrid, pCreateStruct->sPatrolGrid, sizeof( INT16 ) * MAXPATROLGRIDS ); - + pSoldier->aiData.bPatrolCnt = pCreateStruct->bPatrolCnt; + memcpy( pSoldier->aiData.sPatrolGrid, pCreateStruct->sPatrolGrid, sizeof( INT16 ) * MAXPATROLGRIDS ); + if ( HAS_SKILL_TRAIT( pSoldier, CAMOUFLAGED ) ) { // set camouflaged to 100 automatically @@ -840,11 +1020,11 @@ BOOLEAN TacticalCopySoldierFromProfile( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STR } enum { PINKSKIN, TANSKIN, DARKSKIN, BLACKSKIN, NUMSKINS }; -enum { +enum { WHITEHEAD, BLACKHEAD, //black skin (only this line ) BROWNHEAD, //dark skin (this line plus all above) - BLONDEHEAD, REDHEAD, //pink/tan skin (this line plus all above ) - NUMHEADS + BLONDEHEAD, REDHEAD, //pink/tan skin (this line plus all above ) + NUMHEADS }; INT32 ChooseHairColor( SOLDIERTYPE *pSoldier, INT32 skin ) @@ -876,7 +1056,7 @@ INT32 ChooseHairColor( SOLDIERTYPE *pSoldier, INT32 skin ) { hair = WHITEHEAD; if( pSoldier->ubBodyType == REGFEMALE || - pSoldier->ubBodyType == MINICIV || + pSoldier->ubBodyType == MINICIV || pSoldier->ubBodyType == DRESSCIV || pSoldier->ubBodyType == HATKIDCIV || pSoldier->ubBodyType == KIDCIV ) @@ -899,7 +1079,7 @@ INT32 ChooseHairColor( SOLDIERTYPE *pSoldier, INT32 skin ) { hair = WHITEHEAD; if( pSoldier->ubBodyType == REGFEMALE || - pSoldier->ubBodyType == MINICIV || + pSoldier->ubBodyType == MINICIV || pSoldier->ubBodyType == DRESSCIV || pSoldier->ubBodyType == HATKIDCIV || pSoldier->ubBodyType == KIDCIV ) @@ -917,7 +1097,7 @@ INT32 ChooseHairColor( SOLDIERTYPE *pSoldier, INT32 skin ) { hair = WHITEHEAD; if( pSoldier->ubBodyType == REGFEMALE || - pSoldier->ubBodyType == MINICIV || + pSoldier->ubBodyType == MINICIV || pSoldier->ubBodyType == DRESSCIV || pSoldier->ubBodyType == HATKIDCIV || pSoldier->ubBodyType == KIDCIV ) @@ -951,16 +1131,16 @@ void GeneratePaletteForSoldier( SOLDIERTYPE *pSoldier, UINT8 ubSoldierClass ) switch( skin ) { case PINKSKIN: - SET_PALETTEREP_ID( pSoldier->SkinPal, "PINKSKIN" ); + SET_PALETTEREP_ID( pSoldier->SkinPal, "PINKSKIN" ); break; case TANSKIN: - SET_PALETTEREP_ID( pSoldier->SkinPal, "TANSKIN" ); + SET_PALETTEREP_ID( pSoldier->SkinPal, "TANSKIN" ); break; case DARKSKIN: - SET_PALETTEREP_ID( pSoldier->SkinPal, "DARKSKIN" ); + SET_PALETTEREP_ID( pSoldier->SkinPal, "DARKSKIN" ); break; case BLACKSKIN: - SET_PALETTEREP_ID( pSoldier->SkinPal, "BLACKSKIN" ); + SET_PALETTEREP_ID( pSoldier->SkinPal, "BLACKSKIN" ); break; default: AssertMsg( 0, "Skin type not accounted for." ); @@ -975,58 +1155,58 @@ void GeneratePaletteForSoldier( SOLDIERTYPE *pSoldier, UINT8 ubSoldierClass ) case BLACKHEAD: SET_PALETTEREP_ID( pSoldier->HeadPal, "BLACKHEAD" ); break; case WHITEHEAD: SET_PALETTEREP_ID( pSoldier->HeadPal, "WHITEHEAD" ); break; case BLONDEHEAD:SET_PALETTEREP_ID( pSoldier->HeadPal, "BLONDHEAD" ); break; - case REDHEAD: SET_PALETTEREP_ID( pSoldier->HeadPal, "REDHEAD" ); break; - default: AssertMsg( 0, "Hair type not accounted for."); break; + case REDHEAD: SET_PALETTEREP_ID( pSoldier->HeadPal, "REDHEAD" ); break; + default: AssertMsg( 0, "Hair type not accounted for."); break; } // OK, After skin, hair we could have a forced color scheme.. use here if so switch( ubSoldierClass ) { case SOLDIER_CLASS_ADMINISTRATOR: - SET_PALETTEREP_ID( pSoldier->VestPal, "YELLOWVEST" ); - SET_PALETTEREP_ID( pSoldier->PantsPal, "GREENPANTS" ); + SET_PALETTEREP_ID( pSoldier->VestPal, "YELLOWVEST" ); + SET_PALETTEREP_ID( pSoldier->PantsPal, "GREENPANTS" ); pSoldier->ubSoldierClass = ubSoldierClass; return; case SOLDIER_CLASS_ELITE: - SET_PALETTEREP_ID( pSoldier->VestPal, "BLACKSHIRT" ); - SET_PALETTEREP_ID( pSoldier->PantsPal, "BLACKPANTS" ); + SET_PALETTEREP_ID( pSoldier->VestPal, "BLACKSHIRT" ); + SET_PALETTEREP_ID( pSoldier->PantsPal, "BLACKPANTS" ); pSoldier->ubSoldierClass = ubSoldierClass; return; case SOLDIER_CLASS_ARMY: - SET_PALETTEREP_ID( pSoldier->VestPal, "REDVEST" ); - SET_PALETTEREP_ID( pSoldier->PantsPal, "GREENPANTS" ); + SET_PALETTEREP_ID( pSoldier->VestPal, "REDVEST" ); + SET_PALETTEREP_ID( pSoldier->PantsPal, "GREENPANTS" ); pSoldier->ubSoldierClass = ubSoldierClass; return; case SOLDIER_CLASS_GREEN_MILITIA: - SET_PALETTEREP_ID( pSoldier->VestPal, "GREENVEST" ); - SET_PALETTEREP_ID( pSoldier->PantsPal, "BEIGEPANTS" ); + SET_PALETTEREP_ID( pSoldier->VestPal, "GREENVEST" ); + SET_PALETTEREP_ID( pSoldier->PantsPal, "BEIGEPANTS" ); pSoldier->ubSoldierClass = ubSoldierClass; return; case SOLDIER_CLASS_REG_MILITIA: - SET_PALETTEREP_ID( pSoldier->VestPal, "JEANVEST" ); - SET_PALETTEREP_ID( pSoldier->PantsPal, "BEIGEPANTS" ); + SET_PALETTEREP_ID( pSoldier->VestPal, "JEANVEST" ); + SET_PALETTEREP_ID( pSoldier->PantsPal, "BEIGEPANTS" ); pSoldier->ubSoldierClass = ubSoldierClass; return; case SOLDIER_CLASS_ELITE_MILITIA: - SET_PALETTEREP_ID( pSoldier->VestPal, "BLUEVEST" ); - SET_PALETTEREP_ID( pSoldier->PantsPal, "BEIGEPANTS" ); + SET_PALETTEREP_ID( pSoldier->VestPal, "BLUEVEST" ); + SET_PALETTEREP_ID( pSoldier->PantsPal, "BEIGEPANTS" ); pSoldier->ubSoldierClass = ubSoldierClass; return; case SOLDIER_CLASS_MINER: - SET_PALETTEREP_ID( pSoldier->VestPal, "greyVEST" ); - SET_PALETTEREP_ID( pSoldier->PantsPal, "BEIGEPANTS" ); + SET_PALETTEREP_ID( pSoldier->VestPal, "greyVEST" ); + SET_PALETTEREP_ID( pSoldier->PantsPal, "BEIGEPANTS" ); pSoldier->ubSoldierClass = ubSoldierClass; return; } - //there are 2 clothing schemes, 1 for mercs and 1 for civilians. The + //there are 2 clothing schemes, 1 for mercs and 1 for civilians. The //merc clothing scheme is much larger and general and is an exclusive superset //of the civilian clothing scheme which means the civilians will choose the //merc clothing scheme often ( actually 60% of the time ). if( !pSoldier->PantsPal[0] || !pSoldier->VestPal[0] ) { fMercClothingScheme = TRUE; - if( pSoldier->bTeam == CIV_TEAM && Random( 100 ) < 40 ) + if( pSoldier->bTeam == CIV_TEAM && Random( 100 ) < 40 ) { //40% chance of using cheezy civilian colors fMercClothingScheme = FALSE; } @@ -1037,23 +1217,23 @@ void GeneratePaletteForSoldier( SOLDIERTYPE *pSoldier, UINT8 ubSoldierClass ) SET_PALETTEREP_ID( pSoldier->VestPal, "GYELLOWSHIRT" ); switch( Random( 3 ) ) { - case 0: SET_PALETTEREP_ID( pSoldier->PantsPal, "TANPANTS" ); break; + case 0: SET_PALETTEREP_ID( pSoldier->PantsPal, "TANPANTS" ); break; case 1: SET_PALETTEREP_ID( pSoldier->PantsPal, "BEIGEPANTS" ); break; case 2: SET_PALETTEREP_ID( pSoldier->PantsPal, "GREENPANTS" ); break; } } else { //70% chance that the civilian will choose jeans with a shirt. - SET_PALETTEREP_ID( pSoldier->PantsPal, "JEANPANTS" ); + SET_PALETTEREP_ID( pSoldier->PantsPal, "JEANPANTS" ); switch( Random( 7 ) ) { - case 0: SET_PALETTEREP_ID( pSoldier->VestPal, "WHITEVEST" ); break; - case 1: SET_PALETTEREP_ID( pSoldier->VestPal, "BLACKSHIRT" ); break; + case 0: SET_PALETTEREP_ID( pSoldier->VestPal, "WHITEVEST" ); break; + case 1: SET_PALETTEREP_ID( pSoldier->VestPal, "BLACKSHIRT" ); break; case 2: SET_PALETTEREP_ID( pSoldier->VestPal, "PURPLESHIRT" ); break; - case 3: SET_PALETTEREP_ID( pSoldier->VestPal, "BLUEVEST" ); break; - case 4: SET_PALETTEREP_ID( pSoldier->VestPal, "BROWNVEST" ); break; - case 5: SET_PALETTEREP_ID( pSoldier->VestPal, "JEANVEST" ); break; - case 6: SET_PALETTEREP_ID( pSoldier->VestPal, "REDVEST" ); break; + case 3: SET_PALETTEREP_ID( pSoldier->VestPal, "BLUEVEST" ); break; + case 4: SET_PALETTEREP_ID( pSoldier->VestPal, "BROWNVEST" ); break; + case 5: SET_PALETTEREP_ID( pSoldier->VestPal, "JEANVEST" ); break; + case 6: SET_PALETTEREP_ID( pSoldier->VestPal, "REDVEST" ); break; } } return; @@ -1066,9 +1246,9 @@ void GeneratePaletteForSoldier( SOLDIERTYPE *pSoldier, UINT8 ubSoldierClass ) switch( Random( 4 ) ) { case 0: SET_PALETTEREP_ID( pSoldier->VestPal, "YELLOWVEST" ); break; - case 1: SET_PALETTEREP_ID( pSoldier->VestPal, "WHITEVEST" ); break; - case 2: SET_PALETTEREP_ID( pSoldier->VestPal, "BROWNVEST" ); break; - case 3: SET_PALETTEREP_ID( pSoldier->VestPal, "GREENVEST" ); break; + case 1: SET_PALETTEREP_ID( pSoldier->VestPal, "WHITEVEST" ); break; + case 2: SET_PALETTEREP_ID( pSoldier->VestPal, "BROWNVEST" ); break; + case 3: SET_PALETTEREP_ID( pSoldier->VestPal, "GREENVEST" ); break; } break; case 1: @@ -1076,13 +1256,13 @@ void GeneratePaletteForSoldier( SOLDIERTYPE *pSoldier, UINT8 ubSoldierClass ) switch( Random( 8 ) ) { case 0: SET_PALETTEREP_ID( pSoldier->VestPal, "YELLOWVEST" ); break; - case 1: SET_PALETTEREP_ID( pSoldier->VestPal, "WHITEVEST" ); break; + case 1: SET_PALETTEREP_ID( pSoldier->VestPal, "WHITEVEST" ); break; case 2: SET_PALETTEREP_ID( pSoldier->VestPal, "BLACKSHIRT" ); break; - case 3: SET_PALETTEREP_ID( pSoldier->VestPal, "BLUEVEST" ); break; - case 4: SET_PALETTEREP_ID( pSoldier->VestPal, "BROWNVEST" ); break; - case 5: SET_PALETTEREP_ID( pSoldier->VestPal, "GREENVEST" ); break; - case 6: SET_PALETTEREP_ID( pSoldier->VestPal, "JEANVEST" ); break; - case 7: SET_PALETTEREP_ID( pSoldier->VestPal, "REDVEST" ); break; + case 3: SET_PALETTEREP_ID( pSoldier->VestPal, "BLUEVEST" ); break; + case 4: SET_PALETTEREP_ID( pSoldier->VestPal, "BROWNVEST" ); break; + case 5: SET_PALETTEREP_ID( pSoldier->VestPal, "GREENVEST" ); break; + case 6: SET_PALETTEREP_ID( pSoldier->VestPal, "JEANVEST" ); break; + case 7: SET_PALETTEREP_ID( pSoldier->VestPal, "REDVEST" ); break; } break; case 2: @@ -1090,8 +1270,8 @@ void GeneratePaletteForSoldier( SOLDIERTYPE *pSoldier, UINT8 ubSoldierClass ) switch( Random( 4 ) ) { case 0: SET_PALETTEREP_ID( pSoldier->VestPal, "YELLOWVEST" ); break; - case 1: SET_PALETTEREP_ID( pSoldier->VestPal, "WHITEVEST" ); break; - case 2: SET_PALETTEREP_ID( pSoldier->VestPal, "REDVEST" ); break; + case 1: SET_PALETTEREP_ID( pSoldier->VestPal, "WHITEVEST" ); break; + case 2: SET_PALETTEREP_ID( pSoldier->VestPal, "REDVEST" ); break; case 3: SET_PALETTEREP_ID( pSoldier->VestPal, "BLACKSHIRT" ); break; } break; @@ -1104,30 +1284,30 @@ BOOLEAN TacticalCopySoldierFromCreateStruct( SOLDIERTYPE *pSoldier, SOLDIERCREAT pSoldier->ubProfile = NO_PROFILE; // Randomize attributes - pSoldier->bLife = pCreateStruct->bLife; - pSoldier->bLifeMax = pCreateStruct->bLifeMax; - pSoldier->bAgility = pCreateStruct->bAgility; - pSoldier->bDexterity = pCreateStruct->bDexterity; - pSoldier->bExpLevel = pCreateStruct->bExpLevel; + pSoldier->stats.bLife = pCreateStruct->bLife; + pSoldier->stats.bLifeMax = pCreateStruct->bLifeMax; + pSoldier->stats.bAgility = pCreateStruct->bAgility; + pSoldier->stats.bDexterity = pCreateStruct->bDexterity; + pSoldier->stats.bExpLevel = pCreateStruct->bExpLevel; - pSoldier->bMarksmanship = pCreateStruct->bMarksmanship; - pSoldier->bMedical = pCreateStruct->bMedical; - pSoldier->bMechanical = pCreateStruct->bMechanical; - pSoldier->bExplosive = pCreateStruct->bExplosive; - pSoldier->bLeadership = pCreateStruct->bLeadership; - pSoldier->bStrength = pCreateStruct->bStrength; - pSoldier->bWisdom = pCreateStruct->bWisdom; + pSoldier->stats.bMarksmanship = pCreateStruct->bMarksmanship; + pSoldier->stats.bMedical = pCreateStruct->bMedical; + pSoldier->stats.bMechanical = pCreateStruct->bMechanical; + pSoldier->stats.bExplosive = pCreateStruct->bExplosive; + pSoldier->stats.bLeadership = pCreateStruct->bLeadership; + pSoldier->stats.bStrength = pCreateStruct->bStrength; + pSoldier->stats.bWisdom = pCreateStruct->bWisdom; - pSoldier->bAttitude = pCreateStruct->bAttitude; - pSoldier->bOrders = pCreateStruct->bOrders; - pSoldier->bMorale = pCreateStruct->bMorale; - pSoldier->bAIMorale = pCreateStruct->bAIMorale; + pSoldier->aiData.bAttitude = pCreateStruct->bAttitude; + pSoldier->aiData.bOrders = pCreateStruct->bOrders; + pSoldier->aiData.bMorale = pCreateStruct->bMorale; + pSoldier->aiData.bAIMorale = pCreateStruct->bAIMorale; pSoldier->bVocalVolume = MIDVOLUME; pSoldier->ubBodyType = pCreateStruct->bBodyType; pSoldier->ubCivilianGroup = pCreateStruct->ubCivilianGroup; pSoldier->ubScheduleID = pCreateStruct->ubScheduleID; - pSoldier->bHasKeys = pCreateStruct->fHasKeys; + pSoldier->flags.bHasKeys = pCreateStruct->fHasKeys; pSoldier->ubSoldierClass = pCreateStruct->ubSoldierClass; if( pCreateStruct->fVisible ) @@ -1138,7 +1318,7 @@ BOOLEAN TacticalCopySoldierFromCreateStruct( SOLDIERTYPE *pSoldier, SOLDIERCREAT sprintf( pSoldier->SkinPal, pCreateStruct->SkinPal ); } - //KM: March 25, 1999 + //KM: March 25, 1999 //Assign nightops traits to enemies/militia if( pSoldier->ubSoldierClass == SOLDIER_CLASS_ELITE || pSoldier->ubSoldierClass == SOLDIER_CLASS_ELITE_MILITIA ) { @@ -1157,13 +1337,13 @@ BOOLEAN TacticalCopySoldierFromCreateStruct( SOLDIERTYPE *pSoldier, SOLDIERCREAT { iChance = 80; } - + if ( Chance( iChance ) ) { - pSoldier->ubSkillTrait1 = NIGHTOPS; + pSoldier->stats.ubSkillTrait1 = NIGHTOPS; if ( ubProgress >= 40 && Chance( 30 ) ) { - pSoldier->ubSkillTrait2 = NIGHTOPS; + pSoldier->stats.ubSkillTrait2 = NIGHTOPS; } } } @@ -1187,10 +1367,10 @@ BOOLEAN TacticalCopySoldierFromCreateStruct( SOLDIERTYPE *pSoldier, SOLDIERCREAT if ( Chance( iChance ) ) { - pSoldier->ubSkillTrait1 = NIGHTOPS; + pSoldier->stats.ubSkillTrait1 = NIGHTOPS; if ( ubProgress >= 50 && Chance( 20 ) ) { - pSoldier->ubSkillTrait2 = NIGHTOPS; + pSoldier->stats.ubSkillTrait2 = NIGHTOPS; } } } @@ -1202,15 +1382,15 @@ BOOLEAN TacticalCopySoldierFromCreateStruct( SOLDIERTYPE *pSoldier, SOLDIERCREAT { if ( Chance( 20 ) ) { - pSoldier->ubSkillTrait1 = AMBIDEXT; + pSoldier->stats.ubSkillTrait1 = AMBIDEXT; if ( Chance( 10 ) ) { - pSoldier->ubSkillTrait2 = AMBIDEXT; + pSoldier->stats.ubSkillTrait2 = AMBIDEXT; } if ( Item[ pCreateStruct->Inv[ HANDPOS ].usItem ].usItemClass == IC_GUN && !Item[ pCreateStruct->Inv[ HANDPOS ].usItem ].twohanded ) { - memcpy( &(pCreateStruct->Inv[SECONDHANDPOS]), &(pCreateStruct->Inv[HANDPOS]), sizeof( OBJECTTYPE ) ); + (pCreateStruct->Inv[SECONDHANDPOS]) = (pCreateStruct->Inv[HANDPOS]); } } } @@ -1218,42 +1398,42 @@ BOOLEAN TacticalCopySoldierFromCreateStruct( SOLDIERTYPE *pSoldier, SOLDIERCREAT { if ( Chance( 10 ) ) { - pSoldier->ubSkillTrait1 = AMBIDEXT; + pSoldier->stats.ubSkillTrait1 = AMBIDEXT; if ( Chance( 5 ) ) { - pSoldier->ubSkillTrait2 = AMBIDEXT; + pSoldier->stats.ubSkillTrait2 = AMBIDEXT; } if ( Item[ pCreateStruct->Inv[ HANDPOS ].usItem ].usItemClass == IC_GUN && !Item[ pCreateStruct->Inv[ HANDPOS ].usItem ].twohanded ) { - memcpy( &(pCreateStruct->Inv[SECONDHANDPOS]), &(pCreateStruct->Inv[HANDPOS]), sizeof( OBJECTTYPE ) ); + pCreateStruct->Inv[SECONDHANDPOS] = pCreateStruct->Inv[HANDPOS]; } } } - //KM: November 10, 1997 + //KM: November 10, 1997 //Adding patrol points - //CAUTION: CONVERTING SIGNED TO UNSIGNED though the values should never be negative. - pSoldier->bPatrolCnt = pCreateStruct->bPatrolCnt; - memcpy( pSoldier->usPatrolGrid, pCreateStruct->sPatrolGrid, sizeof( INT16 ) * MAXPATROLGRIDS ); - - //Kris: November 10, 1997 + //CAUTION: CONVERTING SIGNED TO UNSIGNED though the values should never be negative. + pSoldier->aiData.bPatrolCnt = pCreateStruct->bPatrolCnt; + memcpy( pSoldier->aiData.sPatrolGrid, pCreateStruct->sPatrolGrid, sizeof( INT16 ) * MAXPATROLGRIDS ); + + //Kris: November 10, 1997 //Expanded the default names based on team. switch( pCreateStruct->bTeam ) { case ENEMY_TEAM: swprintf( pSoldier->name, TacticalStr[ ENEMY_TEAM_MERC_NAME ] ); break; case MILITIA_TEAM: swprintf( pSoldier->name, TacticalStr[ MILITIA_TEAM_MERC_NAME ] ); break; - case CIV_TEAM: + case CIV_TEAM: if( pSoldier->ubSoldierClass == SOLDIER_CLASS_MINER ) { swprintf( pSoldier->name, TacticalStr[ CIV_TEAM_MINER_NAME ] ); } else { - swprintf( pSoldier->name, TacticalStr[ CIV_TEAM_MERC_NAME ] ); + swprintf( pSoldier->name, TacticalStr[ CIV_TEAM_MERC_NAME ] ); } break; - case CREATURE_TEAM: + case CREATURE_TEAM: if( pSoldier->ubBodyType == BLOODCAT ) { swprintf( pSoldier->name, gzLateLocalizedString[ 36 ] ); @@ -1268,9 +1448,7 @@ BOOLEAN TacticalCopySoldierFromCreateStruct( SOLDIERTYPE *pSoldier, SOLDIERCREAT //Generate colors for soldier based on the body type. GeneratePaletteForSoldier( pSoldier, pCreateStruct->ubSoldierClass ); - // WDS - Clean up inventory handling // Copy item info over -// memcpy( pSoldier->inv, pCreateStruct->Inv, sizeof( OBJECTTYPE ) * NUM_INV_SLOTS ); pSoldier->inv = pCreateStruct->Inv; return( TRUE ); @@ -1279,9 +1457,7 @@ BOOLEAN TacticalCopySoldierFromCreateStruct( SOLDIERTYPE *pSoldier, SOLDIERCREAT void InitSoldierStruct( SOLDIERTYPE *pSoldier ) { - // WDS - Clean up inventory handling // Memset values - //memset( pSoldier, 0, SIZEOF_SOLDIERTYPE ); pSoldier->initialize(); // Set default values @@ -1289,7 +1465,7 @@ void InitSoldierStruct( SOLDIERTYPE *pSoldier ) pSoldier->iFaceIndex = -1; // Set morale default - pSoldier->bMorale = DEFAULT_MORALE; + pSoldier->aiData.bMorale = DEFAULT_MORALE; pSoldier->ubAttackerID = NOBODY; pSoldier->ubPreviousAttackerID = NOBODY; @@ -1311,28 +1487,28 @@ void InitSoldierStruct( SOLDIERTYPE *pSoldier ) pSoldier->usPendingAnimation2 = NO_PENDING_ANIMATION; pSoldier->ubPendingStanceChange = NO_PENDING_STANCE; pSoldier->ubPendingDirection = NO_PENDING_DIRECTION; - pSoldier->ubPendingAction = NO_PENDING_ACTION; + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; pSoldier->bLastRenderVisibleValue = -1; pSoldier->bBreath = 99; pSoldier->bBreathMax = 100; pSoldier->bActive = TRUE; - pSoldier->fShowLocator = FALSE; + pSoldier->flags.fShowLocator = FALSE; pSoldier->sLastTarget = NOWHERE; pSoldier->sAbsoluteFinalDestination = NOWHERE; pSoldier->sZLevelOverride = -1; pSoldier->ubServicePartner = NOBODY; pSoldier->ubAttackingHand = HANDPOS; pSoldier->usAnimState = STANDING; - pSoldier->bInterruptDuelPts = NO_INTERRUPT; - pSoldier->bMoved = FALSE; + pSoldier->aiData.bInterruptDuelPts = NO_INTERRUPT; + pSoldier->aiData.bMoved = FALSE; pSoldier->ubRobotRemoteHolderID = NOBODY; - pSoldier->sNoiseGridno = NOWHERE; + pSoldier->aiData.sNoiseGridno = NOWHERE; pSoldier->ubPrevSectorID = 255; - pSoldier->bNextPatrolPnt = 1; + pSoldier->aiData.bNextPatrolPnt = 1; pSoldier->bCurrentCivQuote = -1; pSoldier->bCurrentCivQuoteDelta = 0; pSoldier->uiBattleSoundID = NO_SAMPLE; - pSoldier->ubXRayedBy = NOBODY; + pSoldier->aiData.ubXRayedBy = NOBODY; pSoldier->uiXRayActivatedTime = 0; pSoldier->bBulletsLeft = 0; pSoldier->bVehicleUnderRepairID = -1; @@ -1378,7 +1554,7 @@ BOOLEAN TacticalRemoveSoldierPointer( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveVehi DeleteSchedule( pSoldier->ubScheduleID ); } - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE && fRemoveVehicle ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE && fRemoveVehicle ) { // remove this vehicle from the list RemoveVehicleFromList( pSoldier->bVehicleID ); @@ -1401,18 +1577,18 @@ BOOLEAN TacticalRemoveSoldierPointer( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveVehi // Check if a guy exists here // Does another soldier exist here? - if ( pSoldier->bActive ) + if ( pSoldier->bActive ) { - RemoveSoldierFromGridNo( pSoldier ); + pSoldier->RemoveSoldierFromGridNo( ); - // Delete shadow of crow.... + // Delete shadow of crow.... if ( pSoldier->pAniTile != NULL ) { DeleteAniTile( pSoldier->pAniTile ); pSoldier->pAniTile = NULL; } - if ( ! (pSoldier->uiStatusFlags & SOLDIER_OFF_MAP) ) + if ( ! (pSoldier->flags.uiStatusFlags & SOLDIER_OFF_MAP) ) { // Decrement men in sector number! RemoveManFromTeam( pSoldier->bTeam ); @@ -1421,14 +1597,14 @@ BOOLEAN TacticalRemoveSoldierPointer( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveVehi pSoldier->bActive = FALSE; // Delete! - DeleteSoldier( pSoldier ); + pSoldier->DeleteSoldier( ); } } else { if( gfPersistantPBI ) { - DeleteSoldier( pSoldier ); + pSoldier->DeleteSoldier( ); } MemFree( pSoldier ); @@ -1444,7 +1620,7 @@ BOOLEAN TacticalRemoveSoldier( UINT16 usSoldierIndex ) // returns a soldier difficulty modifier from 0 to 100 based on player's progress, distance from the Palace, mining income, and -// playing difficulty level. Used for generating soldier stats, equipment, and AI skill level. +// playing difficulty level. Used for generating soldier stats, equipment, and AI skill level. INT8 CalcDifficultyModifier( UINT8 ubSoldierClass ) { INT8 bDiffModifier = 0; @@ -1488,7 +1664,7 @@ INT8 CalcDifficultyModifier( UINT8 ubSoldierClass ) case DIF_LEVEL_INSANE: // equally stronger enemies/creatures/bloodcats (+40) if ( SOLDIER_CLASS_MILITIA( ubSoldierClass ) ) - { + { // militia only +20 bDiffModifier += DIFF_FACTOR_GAME_DIFFICULTY; } @@ -1531,7 +1707,7 @@ INT8 CalcDifficultyModifier( UINT8 ubSoldierClass ) // Assert( bDiffModifier <= 100 ); // limit the range of the combined factors to between 0 and 100 - bDiffModifier = __max( 0, bDiffModifier ); + bDiffModifier = __max( 0, bDiffModifier ); bDiffModifier = __min( 100, bDiffModifier ); // DON'T change this function without carefully considering the impact on GenerateRandomEquipment(), @@ -1544,8 +1720,8 @@ INT8 CalcDifficultyModifier( UINT8 ubSoldierClass ) //When the editor modifies the soldier's relative attribute level, //this function is called to update that information. -//Used to generate a detailed placement from a basic placement. This assumes that the detailed placement -//doesn't exist, meaning there are no static attributes. This is called when you wish to convert a basic +//Used to generate a detailed placement from a basic placement. This assumes that the detailed placement +//doesn't exist, meaning there are no static attributes. This is called when you wish to convert a basic //placement into a detailed placement just before creating a soldier. void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, BASIC_SOLDIERCREATE_STRUCT *bp ) { @@ -1562,7 +1738,7 @@ void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, B return; pp->fStatic = FALSE; pp->ubProfile = NO_PROFILE; - pp->sInsertionGridNo = bp->usStartingGridNo; + pp->sInsertionGridNo = bp->sStartingGridNo; pp->fPlayerMerc = FALSE; pp->fPlayerPlan = FALSE; pp->fCopyProfileItemsOver = FALSE; @@ -1626,7 +1802,7 @@ void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, B { //12% chance HATKIDCIV pp->bBodyType = HATKIDCIV; } - else + else { //12% chance KIDCIV pp->bBodyType = KIDCIV; } @@ -1661,13 +1837,13 @@ void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, B // experience level is modified by game difficulty, player's progress, & proximity to Queen's Palace, etc. // This formula gives the following results: - // DIFFICULTY FACTOR EXP. LEVEL MODIFIER LEVEL OF AVG REGULAR TROOP - // 0 to 19 -2 2 - // 20 to 39 -1 3 - // 41 to 59 -0 4 + // DIFFICULTY FACTOR EXP. LEVEL MODIFIER LEVEL OF AVG REGULAR TROOP + // 0 to 19 -2 2 + // 20 to 39 -1 3 + // 41 to 59 -0 4 // 60 to 79 +1 5 // 80 to 99 +2 6 - // 100 +3 7 (can happen in P3 Meduna itself on HARD only!) + // 100 +3 7 (can happen in P3 Meduna itself on HARD only!) bExpLevelModifier = ( ubDiffFactor / 20 ) - 2; // if in the upper half of this difficulty rating (10-19, 30-39, 50-59, 70-79, and 90-99) @@ -1688,9 +1864,9 @@ void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, B { // NOTE: bStatsModifier already includes the bExpLevelModifier since it's based on the level itself! case 0: bExpLevelModifier += -1; bStatsModifier += -1; break; - case 1: bExpLevelModifier += -1; bStatsModifier += 0; break; - case 2: bExpLevelModifier += 0; bStatsModifier += 0; break; - case 3: bExpLevelModifier += +1; bStatsModifier += 0; break; + case 1: bExpLevelModifier += -1; bStatsModifier += 0; break; + case 2: bExpLevelModifier += 0; bStatsModifier += 0; break; + case 3: bExpLevelModifier += +1; bStatsModifier += 0; break; case 4: bExpLevelModifier += +1; bStatsModifier += +1; break; default: @@ -1722,7 +1898,7 @@ void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, B pp->bExpLevel = (INT8) 6 + bExpLevelModifier; break; case SOLDIER_CLASS_MINER: - pp->bExpLevel = bp->bRelativeAttributeLevel; //avg 2 (1-4) + pp->bExpLevel = bp->bRelativeAttributeLevel; //avg 2 (1-4) break; case SOLDIER_CLASS_CREATURE: @@ -1757,14 +1933,14 @@ void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, B break; default: - pp->bExpLevel = bp->bRelativeAttributeLevel; //avg 2 (1-4) + pp->bExpLevel = bp->bRelativeAttributeLevel; //avg 2 (1-4) ubSoldierClass = SOLDIER_CLASS_NONE; break; } DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CreateDetailedPlacementGivenBasicPlacementInfo: set exp. level")); - pp->bExpLevel = max( gGameOptions.ubDifficultyLevel, pp->bExpLevel ); //minimum exp. level of 1 -- madd -> = dif level + pp->bExpLevel = max( gGameOptions.ubDifficultyLevel, pp->bExpLevel ); //minimum exp. level of 1 -- madd->= dif level if ( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE ) pp->bExpLevel = max( 6, pp->bExpLevel ); //minimum exp. level of 6 in insane - madd @@ -1773,7 +1949,7 @@ void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, B ubStatsLevel = pp->bExpLevel + bStatsModifier; - ubStatsLevel = max( gGameOptions.ubDifficultyLevel, ubStatsLevel ); //minimum stats level of 0 -- madd -> = dif level + ubStatsLevel = max( gGameOptions.ubDifficultyLevel, ubStatsLevel ); //minimum stats level of 0 -- madd->= dif level if ( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE ) ubStatsLevel = max( 6, ubStatsLevel ); //minimum stats level of 6 in insane @@ -1787,7 +1963,7 @@ void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, B //Roll soldier's statistics and skills //Stat range is currently 49-99, bell-curved around a range of 16 values dependent on the stats level pp->bLifeMax = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); - pp->bLife = pp->bLifeMax; + pp->bLife = pp->bLifeMax; pp->bAgility = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); pp->bDexterity = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); @@ -1807,7 +1983,7 @@ void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, B ReduceHighExpLevels( &( pp->bExpLevel ) ); pp->fVisible = 0; - + pp->fOnRoof = bp->fOnRoof; pp->ubSoldierClass = ubSoldierClass; @@ -1830,22 +2006,20 @@ void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, B //Used exclusively by the editor when the user wishes to change a basic placement into a detailed placement. //Because the intention is to make some of the attributes static, all of the information that can be generated -//are defaulted to -1. When an attribute is made to be static, that value in replaced by the new static value. -//This information is NOT compatible with TacticalCreateSoldier. Before doing so, you must first convert the -//static detailed placement to a regular detailed placement. +//are defaulted to -1. When an attribute is made to be static, that value in replaced by the new static value. +//This information is NOT compatible with TacticalCreateSoldier. Before doing so, you must first convert the +//static detailed placement to a regular detailed placement. void CreateStaticDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *spp, BASIC_SOLDIERCREATE_STRUCT *bp ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CreateStaticDetailedPlacementGivenBasicPlacementInfo")); - INT32 i; + UINT32 i; if( !spp || !bp ) return; - // WDS - Clean up inventory handling - //memset( spp, 0, SIZEOF_SOLDIERCREATE_STRUCT ); spp->initialize(); spp->fStatic = TRUE; spp->ubProfile = NO_PROFILE; - spp->sInsertionGridNo = bp->usStartingGridNo; + spp->sInsertionGridNo = bp->sStartingGridNo; spp->fPlayerMerc = FALSE; spp->fPlayerPlan = FALSE; spp->fCopyProfileItemsOver = FALSE; @@ -1869,12 +2043,12 @@ void CreateStaticDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT else spp->bBodyType = -1; - //Set up all possible static values. + //Set up all possible static values. //By setting them all to -1, that signifies that the attribute isn't static. //The static placement needs to be later *regenerated* in order to create a valid soldier. spp->bExpLevel = -1; spp->bLifeMax = -1; - spp->bLife = -1; + spp->bLife = -1; spp->bAgility = -1; spp->bDexterity = -1; spp->bMarksmanship = -1; @@ -1886,7 +2060,7 @@ void CreateStaticDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT spp->bWisdom = -1; spp->bMorale = -1; - spp->fVisible = 0; + spp->fVisible = 0; spp->fOnRoof = bp->fOnRoof; @@ -1895,10 +2069,9 @@ void CreateStaticDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT memcpy( spp->sPatrolGrid, bp->sPatrolGrid, sizeof( INT16 ) * MAXPATROLGRIDS ); //Starts with nothing - for( i = 0; i < NUM_INV_SLOTS; i++ ) + for( i = 0; i < spp->Inv.size(); i++ ) { - memset( &(spp->Inv[ i ]), 0, sizeof( OBJECTTYPE ) ); - spp->Inv[ i ].usItem = NOTHING; + DeleteObj(&spp->Inv[ i ]); spp->Inv[ i ].fFlags |= OBJECT_UNDROPPABLE; } @@ -1909,20 +2082,18 @@ void CreateStaticDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT //When you are ready to generate a soldier with a static detailed placement slot, this function will generate //the proper detailed placement slot given the static detailed placement and it's accompanying basic placement. //For the purposes of merc editing, the static detailed placement is preserved. -void CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo( - SOLDIERCREATE_STRUCT *pp, SOLDIERCREATE_STRUCT *spp, BASIC_SOLDIERCREATE_STRUCT *bp ) +void CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo( + SOLDIERCREATE_STRUCT *pp, SOLDIERCREATE_STRUCT *spp, BASIC_SOLDIERCREATE_STRUCT *bp ) { - INT32 i; + UINT32 i; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo")); - // WDS - Clean up inventory handling - //memset( pp, 0, SIZEOF_SOLDIERCREATE_STRUCT ); pp->initialize(); pp->fOnRoof = spp->fOnRoof = bp->fOnRoof; pp->fStatic = FALSE; pp->ubSoldierClass = bp->ubSoldierClass; - //Generate the new placement + //Generate the new placement pp->ubProfile = spp->ubProfile; if( pp->ubProfile != NO_PROFILE ) { @@ -1930,7 +2101,7 @@ void CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo( pp->bTeam = bp->bTeam; pp->ubDirection = bp->ubDirection; - pp->sInsertionGridNo = bp->usStartingGridNo; + pp->sInsertionGridNo = bp->sStartingGridNo; //ATE: Copy over sector coordinates from profile to create struct pp->sSectorX = gMercProfiles[ pp->ubProfile ].sSectorX; @@ -1946,7 +2117,7 @@ void CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo( memcpy( pp->sPatrolGrid, bp->sPatrolGrid, sizeof( INT16 ) * MAXPATROLGRIDS ); pp->fHasKeys = bp->fHasKeys; pp->ubCivilianGroup = bp->ubCivilianGroup; - + return; //done } CreateDetailedPlacementGivenBasicPlacementInfo( pp, bp ); @@ -1975,19 +2146,18 @@ void CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo( sprintf( pp->SkinPal, spp->SkinPal ); } - //This isn't perfect, however, it blindly brings over the items from the static - //detailed placement. Due to the order of things, other items would - for( i = 0; i < NUM_INV_SLOTS; i++ ) + //This isn't perfect, however, it blindly brings over the items from the static + //detailed placement. Due to the order of things, other items would + for( i = 0; i < spp->Inv.size(); i++ ) { //copy over static items and empty slots that are droppable (signifies a forced empty slot) if( spp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE ) { - memcpy( &pp->Inv[ i ], &spp->Inv[ i ], sizeof( OBJECTTYPE ) ); - //memcpy( pp->Inv, spp->Inv, sizeof( OBJECTTYPE ) * NUM_INV_SLOTS ); + pp->Inv[ i ] = spp->Inv[ i ]; //return; } } - //if ( !gGameOptions.fGunNut ) + //if ( !gGameOptions.fGunNut ) //{ // ReplaceExtendedGuns( pp, bp->ubSoldierClass ); //} @@ -2000,78 +2170,76 @@ void CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo( DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo done")); } -//Used to update a existing soldier's attributes with the new static detailed placement info. This is used +//Used to update a existing soldier's attributes with the new static detailed placement info. This is used //by the editor upon exiting the editor into the game, to update the existing soldiers with new information. -//This gives flexibility of testing mercs. Upon entering the editor again, this call will reset all the +//This gives flexibility of testing mercs. Upon entering the editor again, this call will reset all the //mercs to their original states. void UpdateSoldierWithStaticDetailedInformation( SOLDIERTYPE *s, SOLDIERCREATE_STRUCT *spp ) { - //First, check to see if the soldier has a profile. If so, then it'll extract the information - //and update the soldier with the profile information instead. This has complete override + //First, check to see if the soldier has a profile. If so, then it'll extract the information + //and update the soldier with the profile information instead. This has complete override //authority. if( spp->ubProfile != NO_PROFILE ) { TacticalCopySoldierFromProfile( s, spp ); UpdateStaticDetailedPlacementWithProfileInformation( spp, spp->ubProfile ); SetSoldierAnimationSurface( s, s->usAnimState ); - CreateSoldierPalettes( s ); + s->CreateSoldierPalettes( ); return; } switch( spp->ubSoldierClass ) - { //If the soldier is an administrator, then + { //If the soldier is an administrator, then case SOLDIER_CLASS_ADMINISTRATOR: case SOLDIER_CLASS_ARMY: case SOLDIER_CLASS_ELITE: - GeneratePaletteForSoldier( s, spp->ubSoldierClass ); + GeneratePaletteForSoldier( s, spp->ubSoldierClass ); break; } if( spp->bExpLevel != -1 ) { //We have a static experience level, so generate all of the soldier's attributes. INT8 bBaseAttribute; - s->bExpLevel = spp->bExpLevel; + s->stats.bExpLevel = spp->bExpLevel; //Set the minimum base attribute - bBaseAttribute = 49 + ( 4 * s->bExpLevel ); + bBaseAttribute = 49 + ( 4 * s->stats.bExpLevel ); //Roll enemy's combat statistics, taking bExpLevel into account. //Stat range is currently 40-99, slightly bell-curved around the bExpLevel - s->bLifeMax = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); - s->bLife = s->bLifeMax; - s->bAgility = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); - s->bDexterity = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); - s->bMarksmanship = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); - s->bMedical = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); - s->bMechanical = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); - s->bExplosive = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); - s->bLeadership = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); - s->bStrength = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); - s->bWisdom = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); - s->bMorale = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); + s->stats.bLifeMax = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); + s->stats.bLife = s->stats.bLifeMax; + s->stats.bAgility = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); + s->stats.bDexterity = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); + s->stats.bMarksmanship = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); + s->stats.bMedical = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); + s->stats.bMechanical = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); + s->stats.bExplosive = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); + s->stats.bLeadership = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); + s->stats.bStrength = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); + s->stats.bWisdom = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); + s->aiData.bMorale = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); } //Replace any soldier attributes with any static values in the detailed placement. - if( spp->bLife != -1 ) s->bLife = spp->bLife; - if( spp->bLifeMax != -1 ) s->bLifeMax = spp->bLifeMax; - if( spp->bMarksmanship!= -1 ) s->bMarksmanship = spp->bMarksmanship; - if( spp->bStrength != -1 ) s->bStrength = spp->bStrength; - if( spp->bAgility != -1 ) s->bAgility = spp->bAgility; - if( spp->bDexterity != -1 ) s->bDexterity = spp->bDexterity; - if( spp->bWisdom != -1 ) s->bWisdom = spp->bWisdom; - if( spp->bLeadership != -1 ) s->bLeadership = spp->bLeadership; - if( spp->bExplosive != -1 ) s->bExplosive = spp->bExplosive; - if( spp->bMedical != -1 ) s->bMedical = spp->bMedical; - if( spp->bMechanical != -1 ) s->bMechanical = spp->bMechanical; - if( spp->bMorale != -1 ) s->bMorale = spp->bMorale; + if( spp->bLife != -1 ) s->stats.bLife = spp->bLife; + if( spp->bLifeMax != -1 ) s->stats.bLifeMax = spp->bLifeMax; + if( spp->bMarksmanship!= -1 ) s->stats.bMarksmanship = spp->bMarksmanship; + if( spp->bStrength != -1 ) s->stats.bStrength = spp->bStrength; + if( spp->bAgility != -1 ) s->stats.bAgility = spp->bAgility; + if( spp->bDexterity != -1 ) s->stats.bDexterity = spp->bDexterity; + if( spp->bWisdom != -1 ) s->stats.bWisdom = spp->bWisdom; + if( spp->bLeadership != -1 ) s->stats.bLeadership = spp->bLeadership; + if( spp->bExplosive != -1 ) s->stats.bExplosive = spp->bExplosive; + if( spp->bMedical != -1 ) s->stats.bMedical = spp->bMedical; + if( spp->bMechanical != -1 ) s->stats.bMechanical = spp->bMechanical; + if( spp->bMorale != -1 ) s->aiData.bMorale = spp->bMorale; //life can't exceed the life max. - if( s->bLife > s->bLifeMax ) - s->bLife = s->bLifeMax; + if( s->stats.bLife > s->stats.bLifeMax ) + s->stats.bLife = s->stats.bLifeMax; s->ubScheduleID = spp->ubScheduleID; - // WDS - Clean up inventory handling //Copy over the current inventory list. -// memcpy( s->inv, spp->Inv, sizeof( OBJECTTYPE ) * NUM_INV_SLOTS ); s->inv = spp->Inv; } @@ -2089,7 +2257,7 @@ void UpdateStaticDetailedPlacementWithProfileInformation( SOLDIERCREATE_STRUCT * SET_PALETTEREP_ID ( spp->HeadPal, pProfile->HAIR ); SET_PALETTEREP_ID ( spp->VestPal, pProfile->VEST ); SET_PALETTEREP_ID ( spp->SkinPal, pProfile->SKIN ); - SET_PALETTEREP_ID ( spp->PantsPal, pProfile->PANTS ); + SET_PALETTEREP_ID ( spp->PantsPal, pProfile->PANTS ); wcscpy( spp->name, pProfile->zNickname ); @@ -2109,7 +2277,7 @@ void UpdateStaticDetailedPlacementWithProfileInformation( SOLDIERCREATE_STRUCT * spp->bBodyType = pProfile->ubBodyType; // Copy over inv if we want to - for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ ) + for ( cnt = 0; cnt < pProfile->inv.size(); cnt++ ) { CreateItems( pProfile->inv[ cnt ], pProfile->bInvStatus[ cnt ], pProfile->bInvNumber[ cnt ], &(spp->Inv[ cnt ]) ); } @@ -2124,36 +2292,34 @@ void ModifySoldierAttributesWithNewRelativeLevel( SOLDIERTYPE *s, INT8 bRelative // NOTE OF WARNING: THIS CURRENTLY IGNORES THE ENEMY CLASS (ADMIN/REG/ELITE) FOR CALCULATING LEVEL & ATTRIBUTES // Rel level 0: Lvl 1, 1: Lvl 2-3, 2: Lvl 4-5, 3: Lvl 6-7, 4: Lvl 8-9 - s->bExpLevel = (INT8)(2 * bRelativeAttributeLevel + Random(2)); + s->stats.bExpLevel = (INT8)(2 * bRelativeAttributeLevel + Random(2)); - s->bExpLevel = max( 1, s->bExpLevel ); //minimum level of 1 - s->bExpLevel = min( 9, s->bExpLevel ); //maximum level of 9 + s->stats.bExpLevel = max( 1, s->stats.bExpLevel ); //minimum level of 1 + s->stats.bExpLevel = min( 9, s->stats.bExpLevel ); //maximum level of 9 //Set the minimum base attribute - bBaseAttribute = 49 + ( 4 * s->bExpLevel ); + bBaseAttribute = 49 + ( 4 * s->stats.bExpLevel ); //Roll enemy's combat statistics, taking bExpLevel into account. //Stat range is currently 40-99, slightly bell-curved around the bExpLevel - s->bLifeMax = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); - s->bLife = s->bLifeMax; - s->bAgility = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); - s->bDexterity = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); - s->bMarksmanship = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); - s->bMedical = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); - s->bMechanical = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); - s->bExplosive = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); - s->bLeadership = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); - s->bStrength = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); - s->bWisdom = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); - s->bMorale = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); + s->stats.bLifeMax = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); + s->stats.bLife = s->stats.bLifeMax; + s->stats.bAgility = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); + s->stats.bDexterity = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); + s->stats.bMarksmanship = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); + s->stats.bMedical = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); + s->stats.bMechanical = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); + s->stats.bExplosive = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); + s->stats.bLeadership = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); + s->stats.bStrength = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); + s->stats.bWisdom = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); + s->aiData.bMorale = (INT8)(bBaseAttribute + Random( 9 ) + Random( 8 )); } void ForceSoldierProfileID( SOLDIERTYPE *pSoldier, UINT8 ubProfileID ) { SOLDIERCREATE_STRUCT CreateStruct; - - memset( &CreateStruct, 0, sizeof( CreateStruct ) ); CreateStruct.ubProfile = ubProfileID; @@ -2169,8 +2335,8 @@ void ForceSoldierProfileID( SOLDIERTYPE *pSoldier, UINT8 ubProfileID ) SetSoldierAnimationSurface( pSoldier, pSoldier->usAnimState ); // Re-Create palettes - CreateSoldierPalettes( pSoldier ); - + pSoldier->CreateSoldierPalettes( ); + } #define CENTRAL_GRIDNO 13202 @@ -2181,8 +2347,8 @@ SOLDIERTYPE* ReserveTacticalSoldierForAutoresolve( UINT8 ubSoldierClass ) INT32 i, iStart, iEnd; SOLDIERTYPE *pSoldier; //This code looks for a soldier of specified type that currently exists in tactical and - //returns the pointer to that soldier. This is used when copying the exact status of - //all remaining enemy troops (or creatures) to finish the battle in autoresolve. To + //returns the pointer to that soldier. This is used when copying the exact status of + //all remaining enemy troops (or creatures) to finish the battle in autoresolve. To //signify that the troop has already been reserved, we simply set their gridno to NOWHERE. if( ubSoldierClass != SOLDIER_CLASS_CREATURE ) { //use the enemy team @@ -2196,20 +2362,17 @@ SOLDIERTYPE* ReserveTacticalSoldierForAutoresolve( UINT8 ubSoldierClass ) } for( i = iStart; i <= iEnd; i++ ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bInSector && MercPtrs[ i ]->bLife && MercPtrs[ i ]->sGridNo != NOWHERE ) + if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bInSector && MercPtrs[ i ]->stats.bLife && MercPtrs[ i ]->sGridNo != NOWHERE ) { if( MercPtrs[ i ]->ubSoldierClass == ubSoldierClass ) { //reserve this soldier MercPtrs[ i ]->sGridNo = NOWHERE; - // WDS - Clean up inventory handling //Allocate and copy the soldier - pSoldier = new SOLDIERTYPE; //(SOLDIERTYPE*)MemAlloc( SIZEOF_SOLDIERTYPE ); + pSoldier = new SOLDIERTYPE(*MercPtrs[i]); //(SOLDIERTYPE*)MemAlloc( SIZEOF_SOLDIERTYPE ); if( !pSoldier ) return NULL; -// memcpy( pSoldier, MercPtrs[ i ], SIZEOF_SOLDIERTYPE ); - *pSoldier = *MercPtrs[i]; //Assign a bogus ID, then return it pSoldier->ubID = 255; @@ -2235,9 +2398,6 @@ SOLDIERTYPE* TacticalCreateAdministrator() } memset( &bp, 0, sizeof( BASIC_SOLDIERCREATE_STRUCT ) ); - // WDS - Clean up inventory handling - //memset( &pp, 0, SIZEOF_SOLDIERCREATE_STRUCT ); - pp.initialize(); RandomizeRelativeLevel( &( bp.bRelativeAttributeLevel ), SOLDIER_CLASS_ADMINISTRATOR ); RandomizeRelativeLevel( &( bp.bRelativeEquipmentLevel ), SOLDIER_CLASS_ADMINISTRATOR ); bp.bTeam = ENEMY_TEAM; @@ -2250,8 +2410,8 @@ SOLDIERTYPE* TacticalCreateAdministrator() if ( pSoldier ) { // send soldier to centre of map, roughly - pSoldier->sNoiseGridno = (INT16) (CENTRAL_GRIDNO + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) * WORLD_COLS); - pSoldier->ubNoiseVolume = MAX_MISC_NOISE_DURATION; + pSoldier->aiData.sNoiseGridno = (INT16) (CENTRAL_GRIDNO + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) * WORLD_COLS); + pSoldier->aiData.ubNoiseVolume = MAX_MISC_NOISE_DURATION; } return( pSoldier ); } @@ -2271,9 +2431,6 @@ SOLDIERTYPE* TacticalCreateArmyTroop() } memset( &bp, 0, sizeof( BASIC_SOLDIERCREATE_STRUCT ) ); - // WDS - Clean up inventory handling - //memset( &pp, 0, SIZEOF_SOLDIERCREATE_STRUCT ); - pp.initialize(); RandomizeRelativeLevel( &( bp.bRelativeAttributeLevel ), SOLDIER_CLASS_ARMY ); RandomizeRelativeLevel( &( bp.bRelativeEquipmentLevel ), SOLDIER_CLASS_ARMY ); bp.bTeam = ENEMY_TEAM; @@ -2286,8 +2443,8 @@ SOLDIERTYPE* TacticalCreateArmyTroop() if ( pSoldier ) { // send soldier to centre of map, roughly - pSoldier->sNoiseGridno = (INT16) (CENTRAL_GRIDNO + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) * WORLD_COLS); - pSoldier->ubNoiseVolume = MAX_MISC_NOISE_DURATION; + pSoldier->aiData.sNoiseGridno = (INT16) (CENTRAL_GRIDNO + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) * WORLD_COLS); + pSoldier->aiData.ubNoiseVolume = MAX_MISC_NOISE_DURATION; } return( pSoldier ); @@ -2304,14 +2461,10 @@ SOLDIERTYPE* TacticalCreateEliteEnemy() if( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI ) { pSoldier = ReserveTacticalSoldierForAutoresolve( SOLDIER_CLASS_ELITE ); - if( pSoldier ) return pSoldier; + if( pSoldier ) return pSoldier; } memset( &bp, 0, sizeof( BASIC_SOLDIERCREATE_STRUCT ) ); - // WDS - Clean up inventory handling - //memset( &pp, 0, SIZEOF_SOLDIERCREATE_STRUCT ); - pp.initialize(); - RandomizeRelativeLevel( &( bp.bRelativeAttributeLevel ), SOLDIER_CLASS_ELITE ); RandomizeRelativeLevel( &( bp.bRelativeEquipmentLevel ), SOLDIER_CLASS_ELITE ); bp.bTeam = ENEMY_TEAM; @@ -2321,19 +2474,19 @@ SOLDIERTYPE* TacticalCreateEliteEnemy() bp.ubSoldierClass = SOLDIER_CLASS_ELITE; CreateDetailedPlacementGivenBasicPlacementInfo( &pp, &bp ); - //SPECIAL! Certain events in the game can cause profiled NPCs to become enemies. The two cases are - //adding Mike and Iggy. We will only add one NPC in any given combat and the conditions for setting - //the associated facts are done elsewhere. There is also another place where NPCs can get added, which + //SPECIAL! Certain events in the game can cause profiled NPCs to become enemies. The two cases are + //adding Mike and Iggy. We will only add one NPC in any given combat and the conditions for setting + //the associated facts are done elsewhere. There is also another place where NPCs can get added, which //is in AddPlacementToWorld() used for inserting defensive enemies. - //NOTE: We don't want to add Mike or Iggy if this is being called from autoresolve! + //NOTE: We don't want to add Mike or Iggy if this is being called from autoresolve! OkayToUpgradeEliteToSpecialProfiledEnemy( &pp ); - + pSoldier = TacticalCreateSoldier( &pp, &ubID ); if ( pSoldier ) { // send soldier to centre of map, roughly - pSoldier->sNoiseGridno = (INT16)(CENTRAL_GRIDNO + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) * WORLD_COLS); - pSoldier->ubNoiseVolume = MAX_MISC_NOISE_DURATION; + pSoldier->aiData.sNoiseGridno = (INT16)(CENTRAL_GRIDNO + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) * WORLD_COLS); + pSoldier->aiData.ubNoiseVolume = MAX_MISC_NOISE_DURATION; } return( pSoldier ); @@ -2351,20 +2504,17 @@ SOLDIERTYPE* ReserveTacticalMilitiaSoldierForAutoresolve( UINT8 ubSoldierClass ) for( i = iStart; i <= iEnd; i++ ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bInSector && MercPtrs[ i ]->bLife && MercPtrs[ i ]->sGridNo != NOWHERE ) + if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bInSector && MercPtrs[ i ]->stats.bLife && MercPtrs[ i ]->sGridNo != NOWHERE ) { if( MercPtrs[ i ]->ubSoldierClass == ubSoldierClass ) { //reserve this soldier MercPtrs[ i ]->sGridNo = NOWHERE; - // WDS - Clean up inventory handling //Allocate and copy the soldier - pSoldier = new SOLDIERTYPE; //(SOLDIERTYPE*)MemAlloc( SIZEOF_SOLDIERTYPE ); + pSoldier = new SOLDIERTYPE(*MercPtrs[i]); //(SOLDIERTYPE*)MemAlloc( SIZEOF_SOLDIERTYPE ); if( !pSoldier ) return NULL; -// memcpy( pSoldier, MercPtrs[ i ], SIZEOF_SOLDIERTYPE ); - *pSoldier = *MercPtrs[i]; //Assign a bogus ID, then return it pSoldier->ubID = 255; @@ -2390,14 +2540,10 @@ SOLDIERTYPE* TacticalCreateMilitia( UINT8 ubMilitiaClass ) guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI ) { pSoldier = ReserveTacticalMilitiaSoldierForAutoresolve( ubMilitiaClass ); - if( pSoldier ) return pSoldier; + if( pSoldier ) return pSoldier; } memset( &bp, 0, sizeof( BASIC_SOLDIERCREATE_STRUCT ) ); - // WDS - Clean up inventory handling - //memset( &pp, 0, SIZEOF_SOLDIERCREATE_STRUCT ); - pp.initialize(); - RandomizeRelativeLevel( &( bp.bRelativeAttributeLevel ), ubMilitiaClass ); RandomizeRelativeLevel( &( bp.bRelativeEquipmentLevel ), ubMilitiaClass ); bp.bTeam = MILITIA_TEAM; @@ -2426,10 +2572,6 @@ SOLDIERTYPE* TacticalCreateCreature( INT8 bCreatureBodyType ) } memset( &bp, 0, sizeof( BASIC_SOLDIERCREATE_STRUCT ) ); - // WDS - Clean up inventory handling - //memset( &pp, 0, SIZEOF_SOLDIERCREATE_STRUCT ); - pp.initialize(); - RandomizeRelativeLevel( &( bp.bRelativeAttributeLevel ), SOLDIER_CLASS_CREATURE ); RandomizeRelativeLevel( &( bp.bRelativeEquipmentLevel ), SOLDIER_CLASS_CREATURE ); bp.bTeam = CREATURE_TEAM; @@ -2451,7 +2593,7 @@ void RandomizeRelativeLevel( INT8 *pbRelLevel, UINT8 ubSoldierClass ) // We now adjust the relative level by location on the map, so enemies in NE corner will be generally very crappy (lots // of bad and poor, with avg about best), while enemies in the SW will have lots of great and good, with avg about as - // lousy as it gets. Militia are generally unmodified by distance, and never get bad or great at all. + // lousy as it gets. Militia are generally unmodified by distance, and never get bad or great at all. // this returns 0 to DIFF_FACTOR_PALACE_DISTANCE (0 to +30) ubLocationModifier = GetLocationModifier( ubSoldierClass ); @@ -2546,24 +2688,24 @@ void QuickCreateProfileMerc( INT8 bTeam, UINT8 ubProfileID ) SOLDIERCREATE_STRUCT MercCreateStruct; INT16 sWorldX, sWorldY, sSectorX, sSectorY, sGridX, sGridY; UINT8 ubID; - UINT16 usMapPos; + INT16 sMapPos; if ( GetMouseXY( &sGridX, &sGridY ) ) { - usMapPos = MAPROWCOLTOPOS( sGridY, sGridX ); + sMapPos = MAPROWCOLTOPOS( sGridY, sGridX ); // Get Grid Coordinates of mouse if ( GetMouseWorldCoordsInCenter( &sWorldX, &sWorldY ) ) - { + { GetCurrentWorldSector( &sSectorX, &sSectorY ); - memset( &MercCreateStruct, 0, sizeof( MercCreateStruct ) ); + MercCreateStruct.initialize(); MercCreateStruct.bTeam = bTeam; MercCreateStruct.ubProfile = ubProfileID; MercCreateStruct.sSectorX = sSectorX; MercCreateStruct.sSectorY = sSectorY; MercCreateStruct.bSectorZ = gbWorldSectorZ; - MercCreateStruct.sInsertionGridNo = usMapPos; + MercCreateStruct.sInsertionGridNo = sMapPos; RandomizeNewSoldierStats( &MercCreateStruct ); @@ -2578,13 +2720,14 @@ void QuickCreateProfileMerc( INT8 bTeam, UINT8 ubProfileID ) } } +// CHRISL: External function call to resort profile inventory +extern void DistributeInitialGear(MERCPROFILESTRUCT *pProfile); + void CopyProfileItems( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruct ) { UINT32 cnt, cnt2; MERCPROFILESTRUCT * pProfile; - OBJECTTYPE Obj; - UINT32 uiMoneyLeft, uiMoneyLimitInSlot; - INT8 bSlot; + BOOLEAN success, fRet; pProfile = &(gMercProfiles[pCreateStruct->ubProfile]); @@ -2595,39 +2738,78 @@ void CopyProfileItems( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruc { // do some special coding to put stuff in the profile in better-looking // spots - // WDS - Clean up inventory handling -// memset( pSoldier->inv, 0, NUM_INV_SLOTS * sizeof( OBJECTTYPE ) ); - for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ ) + // CHRISL: Resort profile items to use LBE pockets properly + DistributeInitialGear(pProfile); + //place all items that are NOT attachments + for ( cnt = 0; cnt < pProfile->inv.size(); cnt++ ) { - if ( pProfile->inv[ cnt ] != NOTHING ) + if ( pProfile->inv[ cnt ] == NOTHING || Item[pProfile->inv[cnt]].attachment) { + continue; + } + fRet = CreateItems( pProfile->inv[ cnt ], pProfile->bInvStatus[ cnt ], pProfile->bInvNumber[ cnt ], &gTempObject ); + //CHRISL: Place items by slots chosen in profile if using new inventory system + if(fRet) { - CreateItems( pProfile->inv[ cnt ], pProfile->bInvStatus[ cnt ], pProfile->bInvNumber[ cnt ], &Obj ); -// if (Item[Obj.usItem].fFlags & ITEM_ATTACHMENT) - if (Item[Obj.usItem].attachment ) + if((UsingNewInventorySystem() == false)) { + success = AutoPlaceObject( pSoldier, &gTempObject, FALSE ); + } + else { + success = PlaceObject( pSoldier, cnt, &gTempObject ); + } + if (success == FALSE && pSoldier->inv[cnt].exists() == false) { + pSoldier->inv[cnt] = gTempObject; + } + } + } + //done placing all non attachments, now place all attachments on objects! + for ( cnt = 0; cnt < pProfile->inv.size(); cnt++ ) + { + if ( pProfile->inv[ cnt ] == NOTHING) { + continue; + } + if (!Item[pProfile->inv[cnt]].attachment) { + continue; + } + fRet = CreateItems( pProfile->inv[ cnt ], pProfile->bInvStatus[ cnt ], pProfile->bInvNumber[ cnt ], &gTempObject ); + // try to find the appropriate item to attach to! + if(fRet) + { + for ( cnt2 = INV_START_POS; cnt2 < NUM_INV_SLOTS; cnt2++ ) { - // try to find the appropriate item to attach to! - for ( cnt2 = 0; cnt2 < NUM_INV_SLOTS; cnt2++ ) + if ( pSoldier->inv[ cnt2 ].exists() == true && ValidAttachment( gTempObject.usItem, pSoldier->inv[ cnt2 ].usItem ) ) { - if ( pSoldier->inv[ cnt2 ].usItem != NOTHING && ValidAttachment( Obj.usItem, pSoldier->inv[ cnt2 ].usItem ) ) + if(pSoldier->inv[ cnt2 ].AttachObject( NULL, &gTempObject, FALSE )) { - AttachObject( NULL, &(pSoldier->inv[ cnt2 ]), &Obj ); break; } } - if (cnt2 == NUM_INV_SLOTS) - { - // oh well, couldn't find anything to attach to! - AutoPlaceObject( pSoldier, &Obj, FALSE ); + } + if (cnt2 == NUM_INV_SLOTS) + { + // oh well, couldn't find anything to attach to! + //CHRISL: Place items by slots chosen in profile if using new inventory system + if((UsingNewInventorySystem() == false)) { + success = AutoPlaceObject( pSoldier, &gTempObject, FALSE ); + } + else { + // CHRISL: If we're placing a "body" item, then just place it. Otherwise, first + // try to autoplace the item. Only use "PlaceObject" as a last resort. + if(cnt < BIGPOCKSTART) { + success = PlaceObject( pSoldier, cnt, &gTempObject ); + } + else{ + success = AutoPlaceObject( pSoldier, &gTempObject, FALSE ); + if(success == FALSE) { + success = PlaceObject( pSoldier, cnt, &gTempObject ); + } + } + } + if (success == FALSE && pSoldier->inv[cnt].exists() == false) { + pSoldier->inv[cnt] = gTempObject; } } - else - { - AutoPlaceObject( pSoldier, &Obj, FALSE ); - } - } } - pProfile->usOptionalGearCost = 0; } else { @@ -2643,101 +2825,60 @@ void CopyProfileItems( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruc switch( pCreateStruct->ubProfile ) { case BREWSTER: - if ( pProfile->inv[ cnt ] >= KEY_1 && pProfile->inv[ cnt ] <= KEY_32) - { - CreateKeyObject( &(pSoldier->inv[ cnt ] ), pProfile->bInvNumber[ cnt ], 19 ); - } - else - { - memset( &(pSoldier->inv[cnt]), 0, sizeof( OBJECTTYPE ) ); + if ( pProfile->inv[ cnt ] >= KEY_1 && pProfile->inv[ cnt ] <= KEY_32){ + fRet = CreateKeyObject( &gTempObject , pProfile->bInvNumber[ cnt ], 19 ); } break; case SKIPPER: - if ( pProfile->inv[ cnt ] >= KEY_1 && pProfile->inv[ cnt ] <= KEY_32) - { - CreateKeyObject( &(pSoldier->inv[ cnt ] ), pProfile->bInvNumber[ cnt ], 11 ); - } - else - { - memset( &(pSoldier->inv[cnt]), 0, sizeof( OBJECTTYPE ) ); + if ( pProfile->inv[ cnt ] >= KEY_1 && pProfile->inv[ cnt ] <= KEY_32){ + fRet = CreateKeyObject( &gTempObject, pProfile->bInvNumber[ cnt ], 11 ); } break; case DOREEN: - if ( pProfile->inv[ cnt ] >= KEY_1 && pProfile->inv[ cnt ] <= KEY_32) - { - CreateKeyObject( &(pSoldier->inv[ cnt ] ), pProfile->bInvNumber[ cnt ], 32 ); + if ( pProfile->inv[ cnt ] >= KEY_1 && pProfile->inv[ cnt ] <= KEY_32){ + fRet = CreateKeyObject( &gTempObject, pProfile->bInvNumber[ cnt ], 32 ); } - else - { - memset( &(pSoldier->inv[cnt]), 0, sizeof( OBJECTTYPE ) ); - } - break; - default: - memset( &(pSoldier->inv[cnt]), 0, sizeof( OBJECTTYPE ) ); - break; } } else { - CreateItems( pProfile->inv[ cnt ], pProfile->bInvStatus[ cnt ], pProfile->bInvNumber[ cnt ], &(pSoldier->inv[ cnt ] ) ); + fRet = CreateItems( pProfile->inv[ cnt ], pProfile->bInvStatus[ cnt ], pProfile->bInvNumber[ cnt ], &gTempObject ); } - if ( Item[pProfile->inv[ cnt ]].fingerprintid ) + if(fRet) { - pSoldier->inv[ cnt ].ubImprintID = pSoldier->ubProfile; - } - if (gubItemDroppableFlag[cnt]) - { - if (pProfile->ubInvUndroppable & gubItemDroppableFlag[cnt]) + pSoldier->inv[cnt] = gTempObject; + if ( Item[gTempObject.usItem].fingerprintid ) { - pSoldier->inv[cnt].fFlags |= OBJECT_UNDROPPABLE; + for (int x = 0; x < pProfile->bInvNumber[ cnt ]; ++x) { + gTempObject[x]->data.ubImprintID = pSoldier->ubProfile; + } + } + if (gubItemDroppableFlag[cnt]) + { + if (pProfile->ubInvUndroppable & gubItemDroppableFlag[cnt]) + { + gTempObject.fFlags |= OBJECT_UNDROPPABLE; + } } } } - else - { - memset( &(pSoldier->inv[cnt]), 0, sizeof( OBJECTTYPE ) ); - } } if (pProfile->uiMoney > 0) { - uiMoneyLeft = pProfile->uiMoney; - bSlot = FindEmptySlotWithin( pSoldier, BIGPOCK1POS, SMALLPOCK8POS ); - - // add in increments of - while ( bSlot != NO_SLOT ) - { - uiMoneyLimitInSlot = MAX_MONEY_PER_SLOT; - if ( bSlot >= SMALLPOCK1POS ) - { - uiMoneyLimitInSlot /= 2; - } - - CreateItem( MONEY, 100, &( pSoldier->inv[ bSlot ] ) ); - if ( uiMoneyLeft > uiMoneyLimitInSlot ) - { - // fill pocket with money - pSoldier->inv[ bSlot ].ItemData.Money.uiMoneyAmount = uiMoneyLimitInSlot; - uiMoneyLeft -= uiMoneyLimitInSlot; - } - else - { - pSoldier->inv[ bSlot ].ItemData.Money.uiMoneyAmount = uiMoneyLeft; - // done! - break; - } - - bSlot = FindEmptySlotWithin( pSoldier, BIGPOCK1POS, SMALLPOCK8POS ); - } + //only npcs can have money + fRet = CreateMoney(pProfile->uiMoney, &gTempObject ); + if(fRet) + PlaceInAnySlot(pSoldier, &gTempObject, true); } } } } -//SPECIAL! Certain events in the game can cause profiled NPCs to become enemies. The two cases are -//adding Mike and Iggy. We will only add one NPC in any given combat and the conditions for setting -//the associated facts are done elsewhere. The function will set the profile for the SOLDIERCREATE_STRUCT +//SPECIAL! Certain events in the game can cause profiled NPCs to become enemies. The two cases are +//adding Mike and Iggy. We will only add one NPC in any given combat and the conditions for setting +//the associated facts are done elsewhere. The function will set the profile for the SOLDIERCREATE_STRUCT //and the rest will be handled automatically so long the ubProfile field doesn't get changed. -//NOTE: We don't want to add Mike or Iggy if this is being called from autoresolve! +//NOTE: We don't want to add Mike or Iggy if this is being called from autoresolve! void OkayToUpgradeEliteToSpecialProfiledEnemy( SOLDIERCREATE_STRUCT *pp ) { if( !gfProfiledEnemyAdded && gubEnemyEncounterCode != ENEMY_ENCOUNTER_CODE && gubEnemyEncounterCode != ENEMY_INVASION_CODE ) @@ -2760,8 +2901,8 @@ void OkayToUpgradeEliteToSpecialProfiledEnemy( SOLDIERCREATE_STRUCT *pp ) void TrashAllSoldiers( ) { - INT32 cnt; - SOLDIERTYPE *pSoldier; + INT32 cnt; + SOLDIERTYPE *pSoldier; cnt = 0; @@ -2836,12 +2977,12 @@ UINT8 GetPythDistanceFromPalace( INT16 sSectorX, INT16 sSectorY ) sRows = (INT16)(abs((sSectorX) - ( PALACE_SECTOR_X ))); sCols = (INT16)(abs((sSectorY) - ( PALACE_SECTOR_Y ))); - + // apply Pythagoras's theorem for right-handed triangle: // dist^2 = rows^2 + cols^2, so use the square root to get the distance fValue = ( float )sqrt(( float )(sRows * sRows) + ( float )(sCols * sCols)); - if( fmod( fValue, 1.0f ) >= 0.50 ) + if( fmod( fValue, 1.0f ) >= 0.50 ) { ubDistance = (UINT8)( 1 + fValue ); } @@ -2866,7 +3007,7 @@ void ReduceHighExpLevels( INT8 *pbExpLevel ) // this function reduces the experience levels of very high level enemies to something that player can compete with - // for interrupts. It doesn't affect attributes and skills, those are rolled prior to this reduction! + // for interrupts. It doesn't affect attributes and skills, those are rolled prior to this reduction! // adjust for game difficulty level diff --git a/Tactical/Soldier Create.h b/Tactical/Soldier Create.h index 260938a1..ab32a81f 100644 --- a/Tactical/Soldier Create.h +++ b/Tactical/Soldier Create.h @@ -5,19 +5,21 @@ #include "Timer Control.h" #include "vobject.h" #include "Overhead Types.h" -#include "Item Types.h" +//#include "Item Types.h" #include "soldier control.h" -// WDS - Clean up inventory handling #include #include -using namespace std; +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + #define SOLDIER_CREATE_AUTO_TEAM -1 //Kris: -//This value is the total maximum number of slots in a map. +//This value is the total maximum number of slots in a map. //Players 20 //Enemies 32 //Creatures 32 @@ -26,20 +28,20 @@ using namespace std; //Total 148 #define MAX_INDIVIDUALS 148 -//Kris: SERIALIZING INFORMATION +//Kris: SERIALIZING INFORMATION //All maps must have: // -MAPCREATE_STRUCT // MAPCREATE_STRUCT.ubNumIndividuals determines how many BASIC_SOLDIERCREATE_STRUCTs there are -// -The BASIC_SOLDIERCREATE_STRUCTS are saved contiguously, but if any of them +// -The BASIC_SOLDIERCREATE_STRUCTS are saved contiguously, but if any of them // fDetailedPlacement set, then there is a SOLDIERCREATE_STRUCT saved immediately after. //These are the placement slots used by the editor to define where characters are in a map, what -//they are, what team they are on, personality traits, etc. The Merc section of the editor is +//they are, what team they are on, personality traits, etc. The Merc section of the editor is //what is used to define these values. typedef struct { - BOOLEAN fDetailedPlacement; //Specialized information. Has a counterpart containing all info. - UINT16 usStartingGridNo; //Where the placement position is. + BOOLEAN fDetailedPlacement; //Specialized information. Has a counterpart containing all info. + INT16 sStartingGridNo; //Where the placement position is. INT8 bTeam; //The team this individual is part of. INT8 bRelativeAttributeLevel; INT8 bRelativeEquipmentLevel; @@ -57,40 +59,31 @@ typedef struct INT8 PADDINGSLOTS[ 14 ]; } BASIC_SOLDIERCREATE_STRUCT; //50 bytes -// WDS - Clean up inventory handling -//typedef struct -class SOLDIERCREATE_STRUCT +class OLD_SOLDIERCREATE_STRUCT_101 { public: // Constructor - SOLDIERCREATE_STRUCT(); + OLD_SOLDIERCREATE_STRUCT_101(); // Copy Constructor - SOLDIERCREATE_STRUCT(const SOLDIERCREATE_STRUCT&); + OLD_SOLDIERCREATE_STRUCT_101(const OLD_SOLDIERCREATE_STRUCT_101&); // Assignment operator - SOLDIERCREATE_STRUCT& operator=(const SOLDIERCREATE_STRUCT&); + OLD_SOLDIERCREATE_STRUCT_101& operator=(const OLD_SOLDIERCREATE_STRUCT_101&); // Destructor - ~SOLDIERCREATE_STRUCT(); + ~OLD_SOLDIERCREATE_STRUCT_101(); - // Initialize the soldier. - // Use this instead of the old method of calling memset! - // Note that the constructor does this automatically. + // Initialize the soldier. + // Use this instead of the old method of calling memset! + // Note that the constructor does this automatically. void initialize(); - // Ugly temporary solution - // - // Note! These two functions should ONLY be used either just before saving to a + // Note! These two functions should ONLY be used either just before saving to a // file (NewToOld) or after loading a file (OldToNew). void CopyOldInventoryToNew(); - void CopyNewInventoryToOld(); - // Note: Place all non-POD items at the end (after endOfPOD) - // The format of this structure affects what is written into and read from various - // files (maps, save files, etc.). If you change it then that code will not work - // properly until it is all fixed and the files updated. public: //Bulletproofing so static detailed placements aren't used to tactically create soldiers. //Used by editor for validation purposes. - BOOLEAN fStatic; + BOOLEAN fStatic; //Profile information used for special NPCs and player mercs. UINT8 ubProfile; @@ -130,7 +123,7 @@ public: private: //Inventory - OBJECTTYPE DO_NOT_USE_Inv[ OldInventory::NUM_INV_SLOTS ]; + OLD_OBJECTTYPE_101 DO_NOT_USE_Inv[ OldInventory::NUM_INV_SLOTS ]; public: //Palette information for soldiers. @@ -144,7 +137,7 @@ public: INT16 sPatrolGrid[ MAXPATROLGRIDS ]; INT8 bPatrolCnt; - //Kris: Additions November 16, 1997 (padding down to 129 from 150) + //Kris: Additions November 16, 1997 (padding down to 129 from 150) BOOLEAN fVisible; CHAR16 name[ 10 ]; @@ -168,17 +161,128 @@ public: INT8 bPadding[115]; // - // New and OO stuff goes after here. Above this point any changes will goof up reading from files. + // New and OO stuff goes after here. Above this point any changes will goof up reading from files. // char ef1,ef2; // Extra filler to get "offsetof(endOfPOD)" to match SIZEOF(oldstruct) char endOfPOD; // marker for end of POD (plain old data) + Inventory Inv; +}; // OLD_SOLDIERCREATE_STRUCT_101; + + +class SOLDIERCREATE_STRUCT +{ +public: + // Constructor + SOLDIERCREATE_STRUCT(); + // Copy Constructor + SOLDIERCREATE_STRUCT(const SOLDIERCREATE_STRUCT&); + // Assignment operator + SOLDIERCREATE_STRUCT& operator=(const SOLDIERCREATE_STRUCT&); + // Conversion operator from old to new + SOLDIERCREATE_STRUCT& operator=(const OLD_SOLDIERCREATE_STRUCT_101&); + // Conversion operator from SOLDIERTYPE to SOLDIERCREATE_STRUCT + SOLDIERCREATE_STRUCT& operator=(const SOLDIERTYPE&); + // Destructor + ~SOLDIERCREATE_STRUCT(); + + UINT16 GetChecksum(); + + // Initialize the soldier. + // Use this instead of the old method of calling memset! + // Note that the constructor does this automatically. + void initialize(); + + BOOLEAN Load(HWFILE hFile, int versionToLoad, bool loadChecksum); + BOOLEAN Load(INT8 **hBuffer, float dMajorMapVersion, UINT8 ubMinorMapVersion); + BOOLEAN Save(HWFILE hFile, bool fSavingMap); + +public: + //Bulletproofing so static detailed placements aren't used to tactically create soldiers. + //Used by editor for validation purposes. + BOOLEAN fStatic; + + //Profile information used for special NPCs and player mercs. + UINT8 ubProfile; + BOOLEAN fPlayerMerc; + BOOLEAN fPlayerPlan; + BOOLEAN fCopyProfileItemsOver; + + //Location information + INT16 sSectorX; + INT16 sSectorY; + UINT8 ubDirection; + INT16 sInsertionGridNo; + + // Can force a team, but needs flag set + INT8 bTeam; + INT8 bBodyType; + + //Orders and attitude settings + INT8 bAttitude; + INT8 bOrders; + + //Attributes + INT8 bLifeMax; + INT8 bLife; + INT8 bAgility; + INT8 bDexterity; + INT8 bExpLevel; + INT8 bMarksmanship; + INT8 bMedical; + INT8 bMechanical; + INT8 bExplosive; + INT8 bLeadership; + INT8 bStrength; + INT8 bWisdom; + INT8 bMorale; + INT8 bAIMorale; + +public: + + //Palette information for soldiers. + PaletteRepID HeadPal; + PaletteRepID PantsPal; + PaletteRepID VestPal; + PaletteRepID SkinPal; + PaletteRepID MiscPal; + + //Waypoint information for patrolling + INT16 sPatrolGrid[ MAXPATROLGRIDS ]; + INT8 bPatrolCnt; + + //Kris: Additions November 16, 1997 (padding down to 129 from 150) + BOOLEAN fVisible; + CHAR16 name[ 10 ]; + + UINT8 ubSoldierClass; //army, administrator, elite + + BOOLEAN fOnRoof; + + INT8 bSectorZ; + + SOLDIERTYPE *pExistingSoldier; + BOOLEAN fUseExistingSoldier; + UINT8 ubCivilianGroup; + + BOOLEAN fKillSlotIfOwnerDies; + UINT8 ubScheduleID; + + BOOLEAN fUseGivenVehicle; + INT8 bUseGivenVehicleID; + BOOLEAN fHasKeys; + + // + // New and OO stuff goes after here. Above this point any changes will goof up reading from files. + // + char endOfPOD; // marker for end of POD (plain old data) + Inventory Inv; }; // SOLDIERCREATE_STRUCT; +#define SIZEOF_OLD_SOLDIERCREATE_STRUCT_101_POD offsetof( OLD_SOLDIERCREATE_STRUCT_101, endOfPOD ) #define SIZEOF_SOLDIERCREATE_STRUCT_POD offsetof( SOLDIERCREATE_STRUCT, endOfPOD ) -#define SIZEOF_SOLDIERCREATE_STRUCT sizeof( SOLDIERCREATE_STRUCT ) //Original functions currently used throughout the game. @@ -210,45 +314,45 @@ UINT8 GetPythDistanceFromPalace( INT16 sSectorX, INT16 sSectorY ); //These following functions are currently used exclusively by the editor. //Now, this will be useful for the strategic AI. //Definitions: -//Soldier (s): Currently in the game, but subject to modifications. The editor has the capability to -// modify soldier attributes on the fly for testing purposes. -//BasicPlacement (bp): A BASIC_SOLDIERCREATE_STRUCT that contains compact, very general, information about -// a soldier. The BasicPlacement is then used to generate a DetailedPlacement before creating a soldier. +//Soldier (s): Currently in the game, but subject to modifications. The editor has the capability to +// modify soldier attributes on the fly for testing purposes. +//BasicPlacement (bp): A BASIC_SOLDIERCREATE_STRUCT that contains compact, very general, information about +// a soldier. The BasicPlacement is then used to generate a DetailedPlacement before creating a soldier. // Most of the soldiers saved in the maps will be saved in this manner. -//DetailedPlacement (pp): A SOLDIERCREATE_STRUCT ready to be passed to TacticalCreateSoldier to generate -// and add a new soldier to the world. The DetailedPlacement contains all of the necessary information -// to do this. This information won't be saved in maps. In most cases, only very few attributes are static, -// and the rest are generated at runtime. Because of this situation, saved detailed placements must be in a -// different format. -//StaticDetailedPlacement (spp): A hybrid version of the DetailedPlacement. This is the information saved in -// the map via the editor. When loaded, this information is converted to a normal detailed placement, but -// must also use the BasicPlacement information to complete this properly. Once the conversion is complete, -// the static information is lost. This gives us complete flexibility. The basic placements contain relative -// values that work in conjunction with the strategic AI's relative values to generate soldiers. In no -// circumstances will static detailed placements be used outside of the editor. Note, that this hybrid version -// uses the identical structure as detailed placements. All non-static values are set to -1. +//DetailedPlacement (pp): A SOLDIERCREATE_STRUCT ready to be passed to TacticalCreateSoldier to generate +// and add a new soldier to the world. The DetailedPlacement contains all of the necessary information +// to do this. This information won't be saved in maps. In most cases, only very few attributes are static, +// and the rest are generated at runtime. Because of this situation, saved detailed placements must be in a +// different format. +//StaticDetailedPlacement (spp): A hybrid version of the DetailedPlacement. This is the information saved in +// the map via the editor. When loaded, this information is converted to a normal detailed placement, but +// must also use the BasicPlacement information to complete this properly. Once the conversion is complete, +// the static information is lost. This gives us complete flexibility. The basic placements contain relative +// values that work in conjunction with the strategic AI's relative values to generate soldiers. In no +// circumstances will static detailed placements be used outside of the editor. Note, that this hybrid version +// uses the identical structure as detailed placements. All non-static values are set to -1. -//Used to generate a detailed placement from a basic placement. This assumes that the detailed placement -//doesn't exist, meaning there are no static attributes. This is called when you wish to convert a basic +//Used to generate a detailed placement from a basic placement. This assumes that the detailed placement +//doesn't exist, meaning there are no static attributes. This is called when you wish to convert a basic //placement into a detailed placement just before creating a soldier. void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, BASIC_SOLDIERCREATE_STRUCT *bp ); //Used exclusively by the editor when the user wishes to change a basic placement into a detailed placement. //Because the intention is to make some of the attributes static, all of the information that can be generated -//are defaulted to -1. When an attribute is made to be static, that value in replaced by the new static value. -//This information is NOT compatible with TacticalCreateSoldier. Before doing so, you must first convert the -//static detailed placement to a regular detailed placement. +//are defaulted to -1. When an attribute is made to be static, that value in replaced by the new static value. +//This information is NOT compatible with TacticalCreateSoldier. Before doing so, you must first convert the +//static detailed placement to a regular detailed placement. void CreateStaticDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *spp, BASIC_SOLDIERCREATE_STRUCT *bp ); //When you are ready to generate a soldier with a static detailed placement slot, this function will generate //the proper priority placement slot given the static detailed placement and it's accompanying basic placment. //For the purposes of merc editing, the static detailed placement is preserved. void CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo( - SOLDIERCREATE_STRUCT *pp, SOLDIERCREATE_STRUCT *spp, BASIC_SOLDIERCREATE_STRUCT *bp ); + SOLDIERCREATE_STRUCT *pp, SOLDIERCREATE_STRUCT *spp, BASIC_SOLDIERCREATE_STRUCT *bp ); -//Used to update a existing soldier's attributes with the new static detailed placement info. This is used +//Used to update a existing soldier's attributes with the new static detailed placement info. This is used //by the editor upon exiting the editor into the game, to update the existing soldiers with new information. -//This gives flexibility of testing mercs. Upon entering the editor again, this call will reset all the +//This gives flexibility of testing mercs. Upon entering the editor again, this call will reset all the //mercs to their original states. void UpdateSoldierWithStaticDetailedInformation( SOLDIERTYPE *s, SOLDIERCREATE_STRUCT *spp ); @@ -269,11 +373,11 @@ void QuickCreateProfileMerc( INT8 bTeam, UINT8 ubProfileID ); BOOLEAN InternalTacticalRemoveSoldier( UINT16 usSoldierIndex, BOOLEAN fRemoveVehicle ); -//SPECIAL! Certain events in the game can cause profiled NPCs to become enemies. The two cases are -//adding Mike and Iggy. We will only add one NPC in any given combat and the conditions for setting -//the associated facts are done elsewhere. The function will set the profile for the SOLDIERCREATE_STRUCT +//SPECIAL! Certain events in the game can cause profiled NPCs to become enemies. The two cases are +//adding Mike and Iggy. We will only add one NPC in any given combat and the conditions for setting +//the associated facts are done elsewhere. The function will set the profile for the SOLDIERCREATE_STRUCT //and the rest will be handled automatically so long the ubProfile field doesn't get changed. -//NOTE: We don't want to add Mike or Iggy if this is being called from autoresolve! +//NOTE: We don't want to add Mike or Iggy if this is being called from autoresolve! void OkayToUpgradeEliteToSpecialProfiledEnemy( SOLDIERCREATE_STRUCT *pp ); extern BOOLEAN gfProfiledEnemyAdded; //needs to be saved (used by the above function) diff --git a/Tactical/Soldier Find.cpp b/Tactical/Soldier Find.cpp index af64e83d..1ca91d56 100644 --- a/Tactical/Soldier Find.cpp +++ b/Tactical/Soldier Find.cpp @@ -17,7 +17,7 @@ #include "Isometric Utils.h" #include "Event Pump.h" #include "Timer Control.h" - #include "Render Fun.h" + #include "Render Fun.h" #include "Render Dirty.h" #include "mousesystem.h" #include "interface.h" @@ -31,7 +31,7 @@ #include "english.h" #include "overhead.h" #include "opplist.h" - #include "Sound Control.h" + //#include "Sound Control.h" #include "Font Control.h" #include "lighting.h" #include "pathai.h" @@ -64,7 +64,7 @@ void GetSoldierScreenRect( SOLDIERTYPE *pSoldier, SGPRect *pRect ); #define MAX_STACKED_MERCS 10 -UINT32 gScrollSlideInertiaDirection[ NUM_WORLD_DIRECTIONS ] = +UINT32 gScrollSlideInertiaDirection[ NUM_WORLD_DIRECTIONS ] = { 3, 0, @@ -83,7 +83,7 @@ typedef struct UINT8 ubIDs[ MAX_STACKED_MERCS ]; INT8 bCur; BOOLEAN fUseGridNo; - UINT16 sUseGridNoGridNo; + INT16 sUseGridNoGridNo; } SOLDIER_STACK_TYPE; @@ -96,36 +96,36 @@ extern UINT32 guiUITargetSoldierId; BOOLEAN FindSoldierFromMouse( UINT16 *pusSoldierIndex, UINT32 *pMercFlags ) { - UINT16 usMapPos; - + INT16 sMapPos; + *pMercFlags = 0; - if ( GetMouseMapPos( &usMapPos ) ) - { - if ( FindSoldier( usMapPos, pusSoldierIndex, pMercFlags ,FINDSOLDIERSAMELEVEL( gsInterfaceLevel ) ) ) - { - return( TRUE ); - } - } + if ( GetMouseMapPos( &sMapPos ) ) + { + if ( FindSoldier( sMapPos, pusSoldierIndex, pMercFlags ,FINDSOLDIERSAMELEVEL( gsInterfaceLevel ) ) ) + { + return( TRUE ); + } + } - return( FALSE ); + return( FALSE ); } BOOLEAN SelectiveFindSoldierFromMouse( UINT16 *pusSoldierIndex, UINT32 *pMercFlags ) { - UINT16 usMapPos; - + INT16 sMapPos; + *pMercFlags = 0; - if ( GetMouseMapPos( &usMapPos ) ) - { - if ( FindSoldier( usMapPos, pusSoldierIndex, pMercFlags , FINDSOLDIERSAMELEVEL( gsInterfaceLevel ) ) ) - { - return( TRUE ); - } - } + if ( GetMouseMapPos( &sMapPos ) ) + { + if ( FindSoldier( sMapPos, pusSoldierIndex, pMercFlags , FINDSOLDIERSAMELEVEL( gsInterfaceLevel ) ) ) + { + return( TRUE ); + } + } - return( FALSE ); + return( FALSE ); } @@ -144,55 +144,55 @@ UINT32 GetSoldierFindFlags( UINT16 ubID ) } if ( ubID >= gTacticalStatus.Team[ gbPlayerNum ].bFirstID && ubID <= gTacticalStatus.Team[ gbPlayerNum ].bLastID ) { - if ( ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && !GetNumberInVehicle( pSoldier->bVehicleID ) ) - { - // Don't do anything! - } - else - { + if ( ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !GetNumberInVehicle( pSoldier->bVehicleID ) ) + { + // Don't do anything! + } + else + { // It's our own merc - MercFlags |= OWNED_MERC; + MercFlags |= OWNED_MERC; - if ( pSoldier->bAssignment < ON_DUTY ) - { + if ( pSoldier->bAssignment < ON_DUTY ) + { MercFlags |= ONDUTY_MERC; - } - } + } + } } else { - // Check the side, etc - if ( !pSoldier->bNeutral && (pSoldier->bSide != gbPlayerNum ) ) - { + // Check the side, etc + if ( !pSoldier->aiData.bNeutral && (pSoldier->bSide != gbPlayerNum ) ) + { // It's an enemy merc - MercFlags |= ENEMY_MERC; - } - else - { + MercFlags |= ENEMY_MERC; + } + else + { // It's not an enemy merc - MercFlags |= NEUTRAL_MERC; - } + MercFlags |= NEUTRAL_MERC; + } } // Check for a guy who does not have an iterrupt ( when applicable! ) if ( !OK_INTERRUPT_MERC( pSoldier ) ) { - MercFlags |= NOINTERRUPT_MERC; + MercFlags |= NOINTERRUPT_MERC; } - if ( pSoldier->bLife < OKLIFE ) + if ( pSoldier->stats.bLife < OKLIFE ) { - MercFlags |= UNCONSCIOUS_MERC; + MercFlags |= UNCONSCIOUS_MERC; } - if ( pSoldier->bLife == 0 ) + if ( pSoldier->stats.bLife == 0 ) { - MercFlags |= DEAD_MERC; + MercFlags |= DEAD_MERC; } if ( pSoldier->bVisible != -1 || (gTacticalStatus.uiFlags&SHOW_ALL_MERCS) ) { - MercFlags |= VISIBLE_MERC; + MercFlags |= VISIBLE_MERC; } return( MercFlags ); @@ -219,7 +219,7 @@ BOOLEAN FindSoldier( INT16 sGridNo, UINT16 *pusSoldierIndex, UINT32 *pMercFlags, *pusSoldierIndex = NOBODY; - *pMercFlags = 0; + *pMercFlags = 0; if ( _KeyDown( SHIFT ) ) { @@ -227,7 +227,7 @@ BOOLEAN FindSoldier( INT16 sGridNo, UINT16 *pusSoldierIndex, UINT32 *pMercFlags, } // Set some values - if ( uiFlags & FIND_SOLDIER_BEGINSTACK ) + if ( uiFlags & FIND_SOLDIER_BEGINSTACK ) { gSoldierStack.bNum = 0; gSoldierStack.fUseGridNo = FALSE; @@ -242,12 +242,12 @@ BOOLEAN FindSoldier( INT16 sGridNo, UINT16 *pusSoldierIndex, UINT32 *pMercFlags, fInGridNo = FALSE; if ( pSoldier != NULL ) - { + { - if ( pSoldier->bActive && !( pSoldier->uiStatusFlags & SOLDIER_DEAD ) && ( pSoldier->bVisible != -1 || (gTacticalStatus.uiFlags&SHOW_ALL_MERCS) ) ) + if ( pSoldier->bActive && !( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) && ( pSoldier->bVisible != -1 || (gTacticalStatus.uiFlags&SHOW_ALL_MERCS) ) ) { // OK, ignore if we are a passenger... - if ( pSoldier->uiStatusFlags & ( SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) + if ( pSoldier->flags.uiStatusFlags & ( SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) { continue; } @@ -255,7 +255,7 @@ BOOLEAN FindSoldier( INT16 sGridNo, UINT16 *pusSoldierIndex, UINT32 *pMercFlags, // If we want same level, skip if buggy's not on the same level! if ( uiFlags & FIND_SOLDIER_SAMELEVEL ) { - if ( pSoldier->bLevel != (UINT8)( uiFlags >> 16 ) ) + if ( pSoldier->pathing.bLevel != (UINT8)( uiFlags >> 16 ) ) { continue; } @@ -309,7 +309,7 @@ BOOLEAN FindSoldier( INT16 sGridNo, UINT16 *pusSoldierIndex, UINT32 *pMercFlags, { fInGridNo = TRUE; } - + // ATE: If we are an enemy.... if ( !gGameSettings.fOptions[ TOPTION_SMART_CURSOR ] ) { @@ -343,15 +343,15 @@ BOOLEAN FindSoldier( INT16 sGridNo, UINT16 *pusSoldierIndex, UINT32 *pMercFlags, if ( fInScreenRect || fInGridNo ) { // Check if we are a vehicle and refine if so.... - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { usAnimSurface = GetSoldierAnimationSurface( pSoldier, pSoldier->usAnimState ); if ( usAnimSurface != INVALID_ANIMATION_SURFACE ) { iMercScreenX = (INT32)( sScreenX - aRect.iLeft ); - iMercScreenY = (INT32)( -1 * ( sScreenY - aRect.iBottom ) ); - + iMercScreenY = (INT32)( -1 * ( sScreenY - aRect.iBottom ) ); + if ( !CheckVideoObjectScreenCoordinateInData( gAnimSurfaceDatabase[ usAnimSurface ].hVideoObject, pSoldier->usAniFrame, iMercScreenX, iMercScreenY ) ) { continue; @@ -365,66 +365,66 @@ BOOLEAN FindSoldier( INT16 sGridNo, UINT16 *pusSoldierIndex, UINT32 *pMercFlags, } - // Only break here if we're not creating a stack of these fellas - if ( uiFlags & FIND_SOLDIER_BEGINSTACK ) - { - gfHandleStack = TRUE; + // Only break here if we're not creating a stack of these fellas + if ( uiFlags & FIND_SOLDIER_BEGINSTACK ) + { + gfHandleStack = TRUE; // Add this one! - gSoldierStack.ubIDs[ gSoldierStack.bNum ] = pSoldier->ubID; - gSoldierStack.bNum++; + gSoldierStack.ubIDs[ gSoldierStack.bNum ] = pSoldier->ubID; + gSoldierStack.bNum++; - // Determine if it's the current - if ( aRect.iBottom > sHeighestMercScreenY ) - { + // Determine if it's the current + if ( aRect.iBottom > sHeighestMercScreenY ) + { sMaxScreenMercY = (UINT16)aRect.iBottom; sHeighestMercScreenY = sMaxScreenMercY; gSoldierStack.bCur = gSoldierStack.bNum - 1; - } - } - //Are we handling a stack right now? - else if ( gfHandleStack ) - { - // Are we the selected stack? + } + } + //Are we handling a stack right now? + else if ( gfHandleStack ) + { + // Are we the selected stack? if ( gSoldierStack.fUseGridNo ) { - fSoldierFound = FALSE; - break; + fSoldierFound = FALSE; + break; } else if ( gSoldierStack.ubIDs[ gSoldierStack.bCur ] == pSoldier->ubID ) { - // Set it! - ubBestMerc = pSoldier->ubID; + // Set it! + ubBestMerc = pSoldier->ubID; - fSoldierFound = TRUE; - break; + fSoldierFound = TRUE; + break; } - } - else - { - // Determine if it's the best one - if ( aRect.iBottom > sHeighestMercScreenY ) - { + } + else + { + // Determine if it's the best one + if ( aRect.iBottom > sHeighestMercScreenY ) + { sMaxScreenMercY = (UINT16)aRect.iBottom; sHeighestMercScreenY = sMaxScreenMercY; // Set it! ubBestMerc = pSoldier->ubID; - } + } - fSoldierFound = TRUE; - // Don't break here, find the rest! + fSoldierFound = TRUE; + // Don't break here, find the rest! - } + } } - + } else { //Otherwise, look for a bad guy by way of gridno] // Selective means don't give out enemy mercs if they are not visible - + ///&& !NewOKDestination( pSoldier, sGridNo, TRUE, (INT8)gsInterfaceLevel ) if ( pSoldier->sGridNo == sGridNo && !NewOKDestination( pSoldier, sGridNo, TRUE, (INT8)gsInterfaceLevel ) ) { @@ -441,11 +441,11 @@ BOOLEAN FindSoldier( INT16 sGridNo, UINT16 *pusSoldierIndex, UINT32 *pMercFlags, if ( fSoldierFound && ubBestMerc != NOBODY ) { - *pusSoldierIndex = (UINT16)ubBestMerc; + *pusSoldierIndex = (UINT16)ubBestMerc; - (*pMercFlags) = GetSoldierFindFlags( ubBestMerc ); + (*pMercFlags) = GetSoldierFindFlags( ubBestMerc ); - return( TRUE ); + return( TRUE ); } else @@ -469,15 +469,15 @@ BOOLEAN FindSoldier( INT16 sGridNo, UINT16 *pusSoldierIndex, UINT32 *pMercFlags, return( FALSE ); } -BOOLEAN CycleSoldierFindStack( UINT16 usMapPos ) +BOOLEAN CycleSoldierFindStack( INT16 sMapPos ) { - UINT16 usSoldierIndex; + UINT16 usSoldierIndex; UINT32 uiMercFlags; // Have we initalized for this yet? if ( !gfHandleStack ) { - if ( FindSoldier( usMapPos, &usSoldierIndex, &uiMercFlags , FINDSOLDIERSAMELEVEL( gsInterfaceLevel ) | FIND_SOLDIER_BEGINSTACK ) ) + if ( FindSoldier( sMapPos, &usSoldierIndex, &uiMercFlags , FINDSOLDIERSAMELEVEL( gsInterfaceLevel ) | FIND_SOLDIER_BEGINSTACK ) ) { gfHandleStack = TRUE; } @@ -500,7 +500,7 @@ BOOLEAN CycleSoldierFindStack( UINT16 usMapPos ) { gSoldierStack.fUseGridNo = TRUE; gUIActionModeChangeDueToMouseOver = FALSE; - gSoldierStack.sUseGridNoGridNo = usMapPos; + gSoldierStack.sUseGridNoGridNo = sMapPos; } else { @@ -515,11 +515,11 @@ BOOLEAN CycleSoldierFindStack( UINT16 usMapPos ) gusUIFullTargetID = gSoldierStack.ubIDs[ gSoldierStack.bCur ]; guiUIFullTargetFlags = GetSoldierFindFlags( gusUIFullTargetID ); guiUITargetSoldierId = gusUIFullTargetID; - gfUIFullTargetFound = TRUE; + gfUIFullTargetFound = TRUE; } else { - gfUIFullTargetFound = FALSE; + gfUIFullTargetFound = FALSE; } @@ -557,7 +557,7 @@ BOOLEAN IsValidTargetMerc( UINT8 ubSoldierID ) } // CHECK IF DEAD - if( pSoldier->bLife == 0 ) + if( pSoldier->stats.bLife == 0 ) { //return( FALSE ); } @@ -567,7 +567,7 @@ BOOLEAN IsValidTargetMerc( UINT8 ubSoldierID ) { if ( pSoldier->bVisible == -1 && !(gTacticalStatus.uiFlags&SHOW_ALL_MERCS) ) { - return( FALSE ); + return( FALSE ); } } @@ -589,7 +589,7 @@ BOOLEAN IsGridNoInScreenRect( INT16 sGridNo, SGPRect *pRect ) do { GetScreenXYGridNo( (INT16)iXTrav, (INT16)iYTrav, &sMapPos ); - + if ( sMapPos == sGridNo ) { return( TRUE ); @@ -640,7 +640,7 @@ void GetSoldierScreenRect( SOLDIERTYPE *pSoldier, SGPRect *pRect ) void GetSoldierAnimDims( SOLDIERTYPE *pSoldier, INT16 *psHeight, INT16 *psWidth ) { - UINT16 usAnimSurface; + UINT16 usAnimSurface; usAnimSurface = GetSoldierAnimationSurface( pSoldier, pSoldier->usAnimState ); @@ -648,7 +648,7 @@ void GetSoldierAnimDims( SOLDIERTYPE *pSoldier, INT16 *psHeight, INT16 *psWidth { *psHeight = (INT16)5; *psWidth = (INT16)5; - + return; } @@ -656,18 +656,13 @@ void GetSoldierAnimDims( SOLDIERTYPE *pSoldier, INT16 *psHeight, INT16 *psWidth // depending on the frame and the value returned here will vary thusly. However, for the // uses of this function, we should be able to use just the first frame... - if ( pSoldier->usAniFrame >= gAnimSurfaceDatabase[ usAnimSurface ].hVideoObject->usNumberOfObjects ) - { - int i = 0; - } - *psHeight = (INT16)pSoldier->sBoundingBoxHeight; *psWidth = (INT16)pSoldier->sBoundingBoxWidth; } void GetSoldierAnimOffsets( SOLDIERTYPE *pSoldier, INT16 *sOffsetX, INT16 *sOffsetY ) { - UINT16 usAnimSurface; + UINT16 usAnimSurface; usAnimSurface = GetSoldierAnimationSurface( pSoldier, pSoldier->usAnimState ); @@ -688,7 +683,7 @@ void GetSoldierScreenPos( SOLDIERTYPE *pSoldier, INT16 *psScreenX, INT16 *psScre INT16 sMercScreenX, sMercScreenY; FLOAT dOffsetX, dOffsetY; FLOAT dTempX_S, dTempY_S; - UINT16 usAnimSurface; + UINT16 usAnimSurface; // ETRLEObject *pTrav; usAnimSurface = GetSoldierAnimationSurface( pSoldier, pSoldier->usAnimState ); @@ -712,8 +707,8 @@ void GetSoldierScreenPos( SOLDIERTYPE *pSoldier, INT16 *psScreenX, INT16 *psScre sMercScreenY = ( ( gsVIEWPORT_END_Y - gsVIEWPORT_START_Y ) /2 ) + (INT16)dTempY_S; // Adjust starting screen coordinates - sMercScreenX -= gsRenderWorldOffsetX; - sMercScreenY -= gsRenderWorldOffsetY; + sMercScreenX -= gsRenderWorldOffsetX; + sMercScreenY -= gsRenderWorldOffsetY; sMercScreenY -= gpWorldLevelData[ pSoldier->sGridNo ].sHeight; // Adjust for render height @@ -738,7 +733,7 @@ void GetSoldierTRUEScreenPos( SOLDIERTYPE *pSoldier, INT16 *psScreenX, INT16 *ps INT16 sMercScreenX, sMercScreenY; FLOAT dOffsetX, dOffsetY; FLOAT dTempX_S, dTempY_S; - UINT16 usAnimSurface; + UINT16 usAnimSurface; usAnimSurface = GetSoldierAnimationSurface( pSoldier, pSoldier->usAnimState ); @@ -759,8 +754,8 @@ void GetSoldierTRUEScreenPos( SOLDIERTYPE *pSoldier, INT16 *psScreenX, INT16 *ps sMercScreenY = ( ( gsVIEWPORT_END_Y - gsVIEWPORT_START_Y ) /2 ) + (INT16)dTempY_S; // Adjust starting screen coordinates - sMercScreenX -= gsRenderWorldOffsetX; - sMercScreenY -= gsRenderWorldOffsetY; + sMercScreenX -= gsRenderWorldOffsetX; + sMercScreenY -= gsRenderWorldOffsetY; // Adjust for render height sMercScreenY += gsRenderHeight; @@ -779,12 +774,12 @@ BOOLEAN GridNoOnScreen( INT16 sGridNo ) INT16 sNewCenterWorldX, sNewCenterWorldY; INT16 sWorldX; INT16 sWorldY; - INT16 sAllowance = 20; - - if ( gsVIEWPORT_WINDOW_START_Y == 20 ) - { - sAllowance = 40; - } + INT16 sAllowance = 20; + + if ( gsVIEWPORT_WINDOW_START_Y == 20 ) + { + sAllowance = 40; + } ConvertGridNoToXY( sGridNo, &sNewCenterWorldX, &sNewCenterWorldY ); @@ -793,7 +788,7 @@ BOOLEAN GridNoOnScreen( INT16 sGridNo ) // ATE: OK, here, adjust the top value so that it's a tile and a bit over, because of our mercs! if ( sWorldX >= gsTopLeftWorldX && sWorldX <= gsBottomRightWorldX && - sWorldY >= ( gsTopLeftWorldY + sAllowance ) && sWorldY <= ( gsBottomRightWorldY + 20 ) ) + sWorldY >= ( gsTopLeftWorldY + sAllowance ) && sWorldY <= ( gsBottomRightWorldY + 20 ) ) { return( TRUE ); } @@ -816,7 +811,7 @@ BOOLEAN SoldierOnVisibleWorldTile( SOLDIERTYPE *pSoldier ) { return( GridNoOnVisibleWorldTile( pSoldier->sGridNo ) ); } - + BOOLEAN SoldierLocationRelativeToScreen( INT16 sGridNo, UINT16 usReasonID, INT8 *pbDirection, UINT32 *puiScrollFlags ) @@ -839,7 +834,7 @@ BOOLEAN SoldierLocationRelativeToScreen( INT16 sGridNo, UINT16 usReasonID, INT8 // Find the diustance from render center to true world center sDistToCenterX = gsRenderCenterX - gCenterWorldX; sDistToCenterY = gsRenderCenterY - gCenterWorldY; - + // From render center in world coords, convert to render center in "screen" coords FromCellToScreenCoordinates( sDistToCenterX , sDistToCenterY, &sScreenCenterX, &sScreenCenterY ); @@ -856,11 +851,11 @@ BOOLEAN SoldierLocationRelativeToScreen( INT16 sGridNo, UINT16 usReasonID, INT8 *pbDirection = atan8( gsRenderCenterX, gsRenderCenterY, (INT16)(sX), (INT16)(sY) ); // Check values! - if ( sWorldX > ( sScreenCenterX + 20 ) ) + if ( sWorldX > ( sScreenCenterX + 20 ) ) { (*puiScrollFlags) |= SCROLL_RIGHT; } - if ( sWorldX < ( sScreenCenterX - 20 ) ) + if ( sWorldX < ( sScreenCenterX - 20 ) ) { (*puiScrollFlags) |= SCROLL_LEFT; } @@ -876,7 +871,7 @@ BOOLEAN SoldierLocationRelativeToScreen( INT16 sGridNo, UINT16 usReasonID, INT8 // If we are on screen, stop if ( sWorldX >= gsTopLeftWorldX && sWorldX <= gsBottomRightWorldX && - sWorldY >= gsTopLeftWorldY && sWorldY <= ( gsBottomRightWorldY + 20 ) ) + sWorldY >= gsTopLeftWorldY && sWorldY <= ( gsBottomRightWorldY + 20 ) ) { // CHECK IF WE ARE DONE... if ( fCountdown > gScrollSlideInertiaDirection[ *pbDirection ] ) @@ -982,7 +977,7 @@ UINT8 QuickFindSoldier( INT16 sGridNo ) pSoldier = MercSlots[ cnt ]; if ( pSoldier != NULL ) - { + { if ( pSoldier->sGridNo == sGridNo && pSoldier->bVisible != -1 ) { return( (UINT8)cnt ); @@ -1014,8 +1009,8 @@ void GetGridNoScreenPos( INT16 sGridNo, UINT8 ubLevel, INT16 *psScreenX, INT16 * sScreenY = ( ( gsVIEWPORT_END_Y - gsVIEWPORT_START_Y ) /2 ) + (INT16)dTempY_S; // Adjust starting screen coordinates - sScreenX -= gsRenderWorldOffsetX; - sScreenY -= gsRenderWorldOffsetY; + sScreenX -= gsRenderWorldOffsetX; + sScreenY -= gsRenderWorldOffsetY; sScreenY += gsRenderHeight; @@ -1032,3 +1027,4 @@ void GetGridNoScreenPos( INT16 sGridNo, UINT8 ubLevel, INT16 *psScreenX, INT16 * *psScreenY = sScreenY; } + diff --git a/Tactical/Soldier Find.h b/Tactical/Soldier Find.h index aa760eab..0bec17a8 100644 --- a/Tactical/Soldier Find.h +++ b/Tactical/Soldier Find.h @@ -2,6 +2,11 @@ #define __SOLDIER_FIND_H +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + #define FIND_SOLDIER_FULL 0x000000002 #define FIND_SOLDIER_GRIDNO 0x000000004 #define FIND_SOLDIER_SAMELEVEL 0x000000008 @@ -12,7 +17,7 @@ #define SELECTED_MERC 0x000000002 #define OWNED_MERC 0x000000004 #define ENEMY_MERC 0x000000008 -#define UNCONSCIOUS_MERC 0x000000020 +#define UNCONSCIOUS_MERC 0x000000020 #define DEAD_MERC 0x000000040 #define VISIBLE_MERC 0x000000080 #define ONDUTY_MERC 0x000000100 @@ -30,7 +35,7 @@ BOOLEAN SelectiveFindSoldierFromMouse( UINT16 *pusSoldierIndex, UINT32 *pMercFla BOOLEAN FindSoldier( INT16 sGridNo, UINT16 *pusSoldierIndex, UINT32 *pMercFlags , UINT32 uiFlags ); SOLDIERTYPE * SimpleFindSoldier( INT16 sGridNo, INT8 bLevel ); -BOOLEAN CycleSoldierFindStack( UINT16 usMapPos ); +BOOLEAN CycleSoldierFindStack( INT16 sMapPos ); BOOLEAN GridNoOnScreen( INT16 sGridNo ); diff --git a/Tactical/Soldier Init List.cpp b/Tactical/Soldier Init List.cpp index a28ef6dd..2acd66bc 100644 --- a/Tactical/Soldier Init List.cpp +++ b/Tactical/Soldier Init List.cpp @@ -117,7 +117,7 @@ SOLDIERINITNODE* AddBasicPlacementToSoldierInitList( BASIC_SOLDIERCREATE_STRUCT //Copy memory for basic placement memcpy( curr->pBasicPlacement, pBasicPlacement, sizeof( BASIC_SOLDIERCREATE_STRUCT ) ); - //It is impossible to set up detailed placement stuff now. + //It is impossible to set up detailed placement stuff now. //If there is any detailed placement information during map load, it will be added //immediately after this function call. curr->pDetailedPlacement = NULL; @@ -137,7 +137,7 @@ SOLDIERINITNODE* AddBasicPlacementToSoldierInitList( BASIC_SOLDIERCREATE_STRUCT } else { - //TEMP: no sorting, just enemies + //TEMP: no sorting, just enemies curr->prev = gSoldierInitTail; curr->next = NULL; gSoldierInitTail->next = curr; @@ -161,7 +161,7 @@ void RemoveSoldierNodeFromInitList( SOLDIERINITNODE *pNode ) } if( pNode->pDetailedPlacement ) { - MemFree( pNode->pDetailedPlacement ); + delete( pNode->pDetailedPlacement ); pNode->pDetailedPlacement = NULL; } if( pNode->pSoldier ) @@ -172,7 +172,10 @@ void RemoveSoldierNodeFromInitList( SOLDIERINITNODE *pNode ) } else { - INT8 bug = 0; + //bug if gets here and we aren't exiting the game, maybe a bug even if we are exiting (but who cares) + //bug exists since beginning of SVN + DebugBreakpoint(); + //INT8 bug = 0; } } if( pNode == gSoldierInitHead ) @@ -198,9 +201,9 @@ void RemoveSoldierNodeFromInitList( SOLDIERINITNODE *pNode ) MemFree( pNode ); } -//These serialization functions are assuming the passing of a valid file +//These serialization functions are assuming the passing of a valid file //pointer to the beginning of the save/load area, which is not necessarily at -//the beginning of the file. This is just a part of the whole map serialization. +//the beginning of the file. This is just a part of the whole map serialization. BOOLEAN SaveSoldiersToMap( HWFILE fp ) { UINT32 i; @@ -210,14 +213,14 @@ BOOLEAN SaveSoldiersToMap( HWFILE fp ) if( !fp ) return FALSE; - if( gMapInformation.ubNumIndividuals > MAX_INDIVIDUALS ) + if( gMapInformation.ubNumIndividuals > MAX_INDIVIDUALS ) return FALSE; //If we are perhaps in the alternate version of the editor, we don't want bad things to - //happen. This is probably the only place I know where the user gets punished now. If the + //happen. This is probably the only place I know where the user gets punished now. If the //person was in the alternate editor mode, then decided to save the game, the current mercs may - //not be there. This would be bad. What we do is override any merc editing done while in this - //mode, and kill them all, while replacing them with the proper ones. Not only that, the alternate + //not be there. This would be bad. What we do is override any merc editing done while in this + //mode, and kill them all, while replacing them with the proper ones. Not only that, the alternate //editing mode is turned off, and if intentions are to play the game, the user will be facing many //enemies! #ifdef JA2EDITOR @@ -237,9 +240,10 @@ BOOLEAN SaveSoldiersToMap( HWFILE fp ) { if( !curr->pDetailedPlacement ) return FALSE; - // WDS - Clean up inventory handling - curr->pDetailedPlacement->CopyNewInventoryToOld(); - FileWrite( fp, curr->pDetailedPlacement, SIZEOF_SOLDIERCREATE_STRUCT_POD /*SIZEOF_SOLDIERCREATE_STRUCT*/, &uiBytesWritten ); + if ( !curr->pDetailedPlacement->Save(fp, TRUE) ) + { + return FALSE; + } } curr = curr->next; } @@ -248,12 +252,11 @@ BOOLEAN SaveSoldiersToMap( HWFILE fp ) -BOOLEAN LoadSoldiersFromMap( INT8 **hBuffer ) +BOOLEAN LoadSoldiersFromMap( INT8 **hBuffer, float dMajorMapVersion, UINT8 ubMinorMapVersion ) { UINT32 i; UINT8 ubNumIndividuals; BASIC_SOLDIERCREATE_STRUCT tempBasicPlacement; - SOLDIERCREATE_STRUCT tempDetailedPlacement; SOLDIERINITNODE *pNode; BOOLEAN fCowInSector = FALSE; @@ -266,12 +269,12 @@ BOOLEAN LoadSoldiersFromMap( INT8 **hBuffer ) InitSoldierInitList(); - if( ubNumIndividuals > MAX_INDIVIDUALS ) + if( ubNumIndividuals > MAX_INDIVIDUALS ) { - AssertMsg( 0, "Corrupt map check failed. ubNumIndividuals is greater than MAX_INDIVIDUALS." ); + AssertMsg( 0, "Corrupt map check failed. ubNumIndividuals is greater than MAX_INDIVIDUALS." ); return FALSE; //too many mercs } - if( !ubNumIndividuals ) + if( !ubNumIndividuals ) { return TRUE; //no mercs } @@ -279,37 +282,35 @@ BOOLEAN LoadSoldiersFromMap( INT8 **hBuffer ) //Because we are loading the map, we needed to know how many //guys are being loaded, but when we add them to the list here, it //automatically increments that number, effectively doubling it, which - //would be a problem. Now that we know the number, we clear it here, so + //would be a problem. Now that we know the number, we clear it here, so //it gets built again. gMapInformation.ubNumIndividuals = 0; //MUST BE CLEARED HERE!!! + SOLDIERCREATE_STRUCT tempDetailedPlacement; for( i=0; i < ubNumIndividuals; i++ ) { LOADDATA( &tempBasicPlacement, *hBuffer, sizeof( BASIC_SOLDIERCREATE_STRUCT ) ); pNode = AddBasicPlacementToSoldierInitList( &tempBasicPlacement ); - pNode->ubNodeID = (UINT8)i; if( !pNode ) { AssertMsg( 0, "Failed to allocate memory for new basic placement in LoadSoldiersFromMap." ); return FALSE; } + pNode->ubNodeID = (UINT8)i; if( tempBasicPlacement.fDetailedPlacement ) { //Add the static detailed placement information in the same newly created node as the basic placement. - // WDS - Clean up inventory handling - tempDetailedPlacement.initialize(); //read static detailed placement from file - LOADDATA( &tempDetailedPlacement, *hBuffer, SIZEOF_SOLDIERCREATE_STRUCT_POD ); - tempDetailedPlacement.CopyOldInventoryToNew(); + if ( !tempDetailedPlacement.Load(hBuffer, dMajorMapVersion, ubMinorMapVersion) ) + { + return FALSE; + } //allocate memory for new static detailed placement - pNode->pDetailedPlacement = new SOLDIERCREATE_STRUCT;//(SOLDIERCREATE_STRUCT*)MemAlloc( SIZEOF_SOLDIERCREATE_STRUCT ); + pNode->pDetailedPlacement = new SOLDIERCREATE_STRUCT(tempDetailedPlacement);//(SOLDIERCREATE_STRUCT*)MemAlloc( SIZEOF_SOLDIERCREATE_STRUCT ); if( !pNode->pDetailedPlacement ) { AssertMsg( 0, "Failed to allocate memory for new detailed placement in LoadSoldiersFromMap." ); return FALSE; } - //copy the file information from temp var to node in list. - //memcpy( pNode->pDetailedPlacement, &tempDetailedPlacement, SIZEOF_SOLDIERCREATE_STRUCT ); - *pNode->pDetailedPlacement = tempDetailedPlacement; if( tempDetailedPlacement.ubProfile != NO_PROFILE ) { @@ -326,24 +327,24 @@ BOOLEAN LoadSoldiersFromMap( INT8 **hBuffer ) { CHAR8 str[ 40 ]; sprintf( str, "Sounds\\\\cowmoo%d.wav", Random( 3 ) + 1 ); - PlayJA2SampleFromFile( str, RATE_11025, MIDVOLUME, 1, MIDDLEPAN ); + PlayJA2SampleFromFile( str, RATE_11025, MIDVOLUME, 1, MIDDLEPAN ); } return TRUE; } //Because soldiers, creatures, etc., maybe added to the game at anytime theoretically, the -//list will need to be sorted to reflect this. It is quite likely that this won't be needed, -//but the flexibility is there just incase. Now the list is sorted in the following manner: -//-1st priority: Any nodes containing valid pointers to soldiers are moved to the end of the list. +//list will need to be sorted to reflect this. It is quite likely that this won't be needed, +//but the flexibility is there just incase. Now the list is sorted in the following manner: +//-1st priority: Any nodes containing valid pointers to soldiers are moved to the end of the list. // We don't ever want to use two identical placements. -//-2nd priority: Any nodes that have priority existance and detailed placement information are +//-2nd priority: Any nodes that have priority existance and detailed placement information are // put first in the list. //-3rd priority: Any nodes that have priority existance and no detailed placement information are used next. //-4th priority: Any nodes that have detailed placement and no priority existance information are used next. -//-5th priority: The rest of the nodes are basic placements and are placed in the center of the list. Of +//-5th priority: The rest of the nodes are basic placements and are placed in the center of the list. Of // these, they are randomly filled based on the number needed. -//NOTE: This function is called by AddSoldierInitListTeamToWorld(). There is no other place it needs to -// be called. +//NOTE: This function is called by AddSoldierInitListTeamToWorld(). There is no other place it needs to +// be called. void SortSoldierInitList() { SOLDIERINITNODE *temp, *curr; @@ -365,7 +366,7 @@ void SortSoldierInitList() curr = curr->next; } - //1st priority sort + //1st priority sort curr = gSoldierInitTail; while( curr ) { @@ -431,7 +432,7 @@ void SortSoldierInitList() gAlternateSoldierInitListHead = gSoldierInitHead; } else - { + { curr = curr->next; } } @@ -466,12 +467,12 @@ void SortSoldierInitList() gAlternateSoldierInitListHead = gSoldierInitHead; } else - { + { curr = curr->next; } } - //2nd priority sort (by adding these to the front, it'll be before the - //3rd priority sort. This is why we do it after. + //2nd priority sort (by adding these to the front, it'll be before the + //3rd priority sort. This is why we do it after. curr = gSoldierInitHead; while( curr ) { @@ -502,14 +503,14 @@ void SortSoldierInitList() gAlternateSoldierInitListHead = gSoldierInitHead; } else - { + { curr = curr->next; } } //4th priority sort - //Done! If the soldier existing slots are at the end of the list and the - // priority placements are at the beginning of the list, then the - // basic placements are in the middle. + //Done! If the soldier existing slots are at the end of the list and the + // priority placements are at the beginning of the list, then the + // basic placements are in the middle. curr = gSoldierInitHead; while( curr ) @@ -533,29 +534,24 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddPlacementToWorld")); // First check if this guy has a profile and if so check his location such that it matches! - // WDS - Clean up inventory handling // Get profile from placement info - //memset( &tempDetailedPlacement, 0, SIZEOF_SOLDIERCREATE_STRUCT ); - tempDetailedPlacement.initialize(); if (curr->pBasicPlacement->bBodyType == TANK_NW || curr->pBasicPlacement->bBodyType == TANK_NE) { - ROTTING_CORPSE *pCorpse; - //while (1) - do + while (1) { - pCorpse = GetCorpseAtGridNo( curr->pBasicPlacement->usStartingGridNo, 0); // I assume we don't find tanks on the roof + ROTTING_CORPSE *pCorpse = GetCorpseAtGridNo( curr->pBasicPlacement->sStartingGridNo, 0); // I assume we don't find tanks on the roof if (pCorpse) { // Assume this is a dead tank and have the replacement tank haul it away RemoveCorpse( pCorpse->iID); } - //else - //{ - //break; - //} - } while (pCorpse); + else + { + break; + } + } } DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddPlacementToWorld: decide on placement")); @@ -585,14 +581,14 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) if ( FindSoldierByProfileID( ICECREAMTRUCK, TRUE ) != NULL ) { if( curr->pDetailedPlacement->bBodyType == ICECREAMTRUCK ) - { //Check to see if Hamous is here and not recruited. If so, add truck + { //Check to see if Hamous is here and not recruited. If so, add truck if( gMercProfiles[ HAMOUS ].sSectorX != gWorldSectorX || gMercProfiles[ HAMOUS ].sSectorY != gWorldSectorY || gMercProfiles[ HAMOUS ].bSectorZ ) { //not here, so don't add return TRUE; } - //Hamous is here. Check to make sure he isn't recruited. + //Hamous is here. Check to make sure he isn't recruited. if( gMercProfiles[ HAMOUS ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) { return TRUE; @@ -601,7 +597,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) } } CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo( - &tempDetailedPlacement, curr->pDetailedPlacement, curr->pBasicPlacement ); + &tempDetailedPlacement, curr->pDetailedPlacement, curr->pBasicPlacement ); } else { @@ -623,7 +619,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) // Kinpin guys might be guarding Tony if ( tempDetailedPlacement.ubCivilianGroup == KINGPIN_CIV_GROUP && ( gTacticalStatus.fCivGroupHostile[ KINGPIN_CIV_GROUP ] == CIV_GROUP_WILL_BECOME_HOSTILE || ( (gubQuest[ QUEST_KINGPIN_MONEY ] == QUESTINPROGRESS) && (CheckFact( FACT_KINGPIN_CAN_SEND_ASSASSINS, KINGPIN )) ) ) ) { - if (tempDetailedPlacement.ubProfile == NO_PROFILE) + if (tempDetailedPlacement.ubProfile == NO_PROFILE) { // these guys should be guarding Tony! tempDetailedPlacement.sInsertionGridNo = 13531 + @@ -644,7 +640,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) } } - else if (tempDetailedPlacement.ubProfile == BILLY ) + else if (tempDetailedPlacement.ubProfile == BILLY ) { // billy should now be able to roam around tempDetailedPlacement.sInsertionGridNo = 13531 + @@ -658,7 +654,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) return( TRUE ); } else if ( tempDetailedPlacement.ubProfile == NO_PROFILE && InARoom( tempDetailedPlacement.sInsertionGridNo, &ubRoom ) && IN_BROTHEL( ubRoom ) ) - { + { // must be a hooker, shouldn't be there return( TRUE ); } @@ -666,7 +662,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) } else if ( !gfInMeanwhile && gWorldSectorX == 3 && gWorldSectorY == 16 && !gbWorldSectorZ ) { //Special civilian setup for queen's palace. - if( gubFact[ FACT_QUEEN_DEAD ] ) + if( gubFact[ FACT_QUEEN_DEAD ] ) { if( tempDetailedPlacement.ubCivilianGroup == QUEENS_CIV_GROUP ) { //The queen's civs aren't added if queen is dead @@ -685,7 +681,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) } } } - else if ( gWorldSectorX == TIXA_SECTOR_X && gWorldSectorY == TIXA_SECTOR_Y && gbWorldSectorZ == 0 ) + else if ( gWorldSectorX == TIXA_SECTOR_X && gWorldSectorY == TIXA_SECTOR_Y && gbWorldSectorZ == 0 ) { // Tixa prison, once liberated, should not have any civs without profiles unless // they are kids @@ -701,16 +697,16 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) { if ( tempDetailedPlacement.bBodyType == HATKIDCIV || tempDetailedPlacement.bBodyType == KIDCIV ) { - // not there any more! kids have been freeeeed! + // not there any more! kids have been freeeeed! return( TRUE ); } } } } - //SPECIAL! Certain events in the game can cause profiled NPCs to become enemies. The two cases are - //adding Mike and Iggy. We will only add one NPC in any given combat and the conditions for setting - //the associated facts are done elsewhere. There is also another place where NPCs can get added, which + //SPECIAL! Certain events in the game can cause profiled NPCs to become enemies. The two cases are + //adding Mike and Iggy. We will only add one NPC in any given combat and the conditions for setting + //the associated facts are done elsewhere. There is also another place where NPCs can get added, which //is in TacticalCreateElite() used for inserting offensive enemies. if( tempDetailedPlacement.bTeam == ENEMY_TEAM && tempDetailedPlacement.ubSoldierClass == SOLDIER_CLASS_ELITE ) { @@ -760,7 +756,7 @@ void AddPlacementToWorldByProfileID( UINT8 ubProfile ) while( curr ) { if ( curr->pDetailedPlacement && curr->pDetailedPlacement->ubProfile == ubProfile && !curr->pSoldier ) - { + { //Matching profile, so add this placement. AddPlacementToWorld( curr ); break; @@ -784,7 +780,7 @@ UINT8 AddSoldierInitListTeamToWorld( INT8 bTeam, UINT8 ubMaxNum ) //-Any placements with existing soldiers last (overrides others) SortSoldierInitList(); - if( giCurrentTilesetID == 1 ) //cave/mine tileset only + if( giCurrentTilesetID == 1 ) //cave/mine tileset only { //convert all civilians to miners which use uniforms and more masculine body types. curr = gSoldierInitHead; while( curr ) @@ -803,7 +799,7 @@ UINT8 AddSoldierInitListTeamToWorld( INT8 bTeam, UINT8 ubMaxNum ) while( curr ) { if( curr->pBasicPlacement->bTeam == bTeam && curr->pSoldier ) - ubNumAdded++; //already one here! + ubNumAdded++; //already one here! curr = curr->next; } @@ -813,7 +809,7 @@ UINT8 AddSoldierInitListTeamToWorld( INT8 bTeam, UINT8 ubMaxNum ) while( curr && curr->pBasicPlacement->fPriorityExistance && ubNumAdded < ubMaxNum ) { if( curr->pBasicPlacement->bTeam == bTeam ) - { + { //Matching team, so add this placement. if( AddPlacementToWorld( curr ) ) { @@ -861,10 +857,10 @@ UINT8 AddSoldierInitListTeamToWorld( INT8 bTeam, UINT8 ubMaxNum ) } else { - //if it fails to create the soldier, it is likely that it is because the slots in the tactical - //engine are already full. Besides, the strategic AI shouldn't be trying to fill a map with - //more than the maximum allowable soldiers of team. All teams can have a max of 32 individuals, - //except for the player which is 20. Players aren't processed in this list anyway. + //if it fails to create the soldier, it is likely that it is because the slots in the tactical + //engine are already full. Besides, the strategic AI shouldn't be trying to fill a map with + //more than the maximum allowable soldiers of team. All teams can have a max of 32 individuals, + //except for the player which is 20. Players aren't processed in this list anyway. // 0verhaul: Bzzzzzzzttttt.... Wrong! Other reasons for a false return: // Profiled merc not in sector // Profiled merc is recruited @@ -892,7 +888,6 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr SOLDIERINITNODE *curr; INT32 iRandom; UINT8 ubMaxNum; - INT8 bTeam = ENEMY_TEAM; UINT8 ubElitePDSlots = 0, ubEliteDSlots = 0, ubElitePSlots = 0, ubEliteBSlots = 0; UINT8 ubTroopPDSlots = 0, ubTroopDSlots = 0, ubTroopPSlots = 0, ubTroopBSlots = 0; UINT8 ubAdminPDSlots = 0, ubAdminDSlots = 0, ubAdminPSlots = 0, ubAdminBSlots = 0; @@ -909,7 +904,7 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr gfProfiledEnemyAdded = FALSE; //Because the enemy defence forces work differently than the regular map placements, the numbers - //of each type of enemy may not be the same. Elites will choose the best placements, then army, then + //of each type of enemy may not be the same. Elites will choose the best placements, then army, then //administrators. ubMaxNum = ubTotalAdmin + ubTotalTroops + ubTotalElite; @@ -932,7 +927,7 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr { case SOLDIER_CLASS_ELITE: if( curr->pBasicPlacement->fPriorityExistance && curr->pDetailedPlacement ) - ubElitePDSlots++; + ubElitePDSlots++; else if( curr->pBasicPlacement->fPriorityExistance ) ubElitePSlots++; else if( curr->pDetailedPlacement ) @@ -940,9 +935,9 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr else ubEliteBSlots++; break; - case SOLDIER_CLASS_ADMINISTRATOR: + case SOLDIER_CLASS_ADMINISTRATOR: if( curr->pBasicPlacement->fPriorityExistance && curr->pDetailedPlacement ) - ubAdminPDSlots++; + ubAdminPDSlots++; else if( curr->pBasicPlacement->fPriorityExistance ) ubAdminPSlots++; else if( curr->pDetailedPlacement ) @@ -950,9 +945,9 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr else ubAdminBSlots++; break; - case SOLDIER_CLASS_ARMY: + case SOLDIER_CLASS_ARMY: if( curr->pBasicPlacement->fPriorityExistance && curr->pDetailedPlacement ) - ubTroopPDSlots++; + ubTroopPDSlots++; else if( curr->pBasicPlacement->fPriorityExistance ) ubTroopPSlots++; else if( curr->pDetailedPlacement ) @@ -967,13 +962,13 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr //ADD PLACEMENTS WITH PRIORITY EXISTANCE WITH DETAILED PLACEMENT INFORMATION FIRST //we now have the numbers of available slots for each soldier class, so loop through three times - //and randomly choose some (or all) of the matching slots to fill. This is done randomly. + //and randomly choose some (or all) of the matching slots to fill. This is done randomly. for( ubCurrClass = SOLDIER_CLASS_ADMINISTRATOR; ubCurrClass <= SOLDIER_CLASS_ARMY; ubCurrClass++ ) { //First, prepare the counters. switch( ubCurrClass ) { - case SOLDIER_CLASS_ADMINISTRATOR: + case SOLDIER_CLASS_ADMINISTRATOR: pCurrSlots = &ubAdminPDSlots; pCurrTotal = &ubTotalAdmin; break; @@ -987,7 +982,7 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr break; } //Now, loop through the priority existance and detailed placement section of the list. - curr = gSoldierInitHead; + curr = gSoldierInitHead; while( curr && ubMaxNum && *pCurrTotal && *pCurrSlots && curr->pDetailedPlacement && curr->pBasicPlacement->fPriorityExistance ) { @@ -1023,13 +1018,13 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr //ADD PLACEMENTS WITH PRIORITY EXISTANCE AND NO DETAILED PLACEMENT INFORMATION SECOND //we now have the numbers of available slots for each soldier class, so loop through three times - //and randomly choose some (or all) of the matching slots to fill. This is done randomly. + //and randomly choose some (or all) of the matching slots to fill. This is done randomly. for( ubCurrClass = SOLDIER_CLASS_ADMINISTRATOR; ubCurrClass <= SOLDIER_CLASS_ARMY; ubCurrClass++ ) { //First, prepare the counters. switch( ubCurrClass ) { - case SOLDIER_CLASS_ADMINISTRATOR: + case SOLDIER_CLASS_ADMINISTRATOR: pCurrSlots = &ubAdminPSlots; pCurrTotal = &ubTotalAdmin; break; @@ -1079,13 +1074,13 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr //ADD PLACEMENTS WITH NO DETAILED PLACEMENT AND PRIORITY EXISTANCE INFORMATION SECOND //we now have the numbers of available slots for each soldier class, so loop through three times - //and randomly choose some (or all) of the matching slots to fill. This is done randomly. + //and randomly choose some (or all) of the matching slots to fill. This is done randomly. for( ubCurrClass = SOLDIER_CLASS_ADMINISTRATOR; ubCurrClass <= SOLDIER_CLASS_ARMY; ubCurrClass++ ) { //First, prepare the counters. switch( ubCurrClass ) { - case SOLDIER_CLASS_ADMINISTRATOR: + case SOLDIER_CLASS_ADMINISTRATOR: pCurrSlots = &ubAdminDSlots; pCurrTotal = &ubTotalAdmin; break; @@ -1136,10 +1131,10 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr //Kris: January 11, 2000 -- NEW!!! //PRIORITY EXISTANT SLOTS MUST BE FILLED //This must be done to ensure all priority existant slots are filled before ANY other slots are filled, - //even if that means changing the class of the slot. Also, assume that there are no matching fits left - //for priority existance slots. All of the matches have been already assigned in the above passes. + //even if that means changing the class of the slot. Also, assume that there are no matching fits left + //for priority existance slots. All of the matches have been already assigned in the above passes. //We'll have to convert the soldier type of the slot to match. - curr = gSoldierInitHead; + curr = gSoldierInitHead; while( curr && ubMaxNum && curr->pBasicPlacement->fPriorityExistance ) { if( !curr->pSoldier && curr->pBasicPlacement->bTeam == ENEMY_TEAM ) @@ -1177,13 +1172,13 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr //ADD REMAINING PLACEMENTS WITH BASIC PLACEMENT INFORMATION //we now have the numbers of available slots for each soldier class, so loop through three times - //and randomly choose some (or all) of the matching slots to fill. This is done randomly. + //and randomly choose some (or all) of the matching slots to fill. This is done randomly. for( ubCurrClass = SOLDIER_CLASS_ADMINISTRATOR; ubCurrClass <= SOLDIER_CLASS_ARMY; ubCurrClass++ ) { //First, prepare the counters. switch( ubCurrClass ) { - case SOLDIER_CLASS_ADMINISTRATOR: + case SOLDIER_CLASS_ADMINISTRATOR: pCurrSlots = &ubAdminBSlots; pCurrTotal = &ubTotalAdmin; break; @@ -1226,15 +1221,15 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr if( !ubMaxNum ) return; - //If we are at this point, that means that there are some compatibility issues. This is fine. An example - //would be a map containing 1 elite placement, and 31 troop placements. If we had 3 elites move into this - //sector, we would not have placements for two of them. What we have to do is override the class information - //contained in the list by choosing unused placements, and assign them to the elites. This time, we will - //use all free slots including priority placement slots (ignoring the priority placement information). + //If we are at this point, that means that there are some compatibility issues. This is fine. An example + //would be a map containing 1 elite placement, and 31 troop placements. If we had 3 elites move into this + //sector, we would not have placements for two of them. What we have to do is override the class information + //contained in the list by choosing unused placements, and assign them to the elites. This time, we will + //use all free slots including priority placement slots (ignoring the priority placement information). //First, count up the total number of free slots. ubFreeSlots = 0; - curr = gSoldierInitHead; + curr = gSoldierInitHead; while( curr ) { if( !curr->pSoldier && curr->pBasicPlacement->bTeam == ENEMY_TEAM ) @@ -1242,9 +1237,9 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr curr = curr->next; } - //Now, loop through the entire list again, but for the last time. All enemies will be inserted now ignoring + //Now, loop through the entire list again, but for the last time. All enemies will be inserted now ignoring //detailed placements and classes. - curr = gSoldierInitHead; + curr = gSoldierInitHead; while( curr && ubFreeSlots && ubMaxNum ) { if( !curr->pSoldier && curr->pBasicPlacement->bTeam == ENEMY_TEAM ) @@ -1275,9 +1270,9 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr /* DISABLE THE OVERRIDE FOR NOW... if( curr->pDetailedPlacement ) { //delete the detailed placement information. - MemFree( curr->pDetailedPlacement ); - curr->pDetailedPlacement = NULL; - curr->pBasicPlacement->fDetailedPlacement = FALSE; + delete( curr->pDetailedPlacement ); + curr->pDetailedPlacement = NULL; + curr->pBasicPlacement->fDetailedPlacement = FALSE; } */ if( AddPlacementToWorld( curr ) ) @@ -1297,7 +1292,7 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr //If we are adding militia to our map, then we do a few things differently. //First of all, they exist exclusively to the enemy troops, so if the militia exists in the -//sector, then they get to use the enemy placements. However, we remove any orders from +//sector, then they get to use the enemy placements. However, we remove any orders from //placements containing RNDPTPATROL or POINTPATROL orders, as well as remove any detailed //placement information. void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumRegs, UINT8 ubNumElites ) @@ -1307,7 +1302,6 @@ void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumRegs, UINT8 ubNumEl INT32 iRandom; UINT8 ubMaxNum; BOOLEAN fDoPlacement; - INT8 bTeam = ENEMY_TEAM; UINT8 ubEliteSlots = 0; UINT8 ubRegSlots = 0; UINT8 ubGreenSlots = 0; @@ -1361,7 +1355,7 @@ void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumRegs, UINT8 ubNumEl curr->pBasicPlacement->bAttitude = (INT8) Random( MAXATTITUDES ); if( curr->pDetailedPlacement ) { //delete the detailed placement information. - MemFree( curr->pDetailedPlacement ); + delete( curr->pDetailedPlacement ); curr->pDetailedPlacement = NULL; curr->pBasicPlacement->fDetailedPlacement = FALSE; RandomizeRelativeLevel( &( curr->pBasicPlacement->bRelativeAttributeLevel ), curr->pBasicPlacement->ubSoldierClass ); @@ -1398,13 +1392,13 @@ void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumRegs, UINT8 ubNumEl } //we now have the numbers of available slots for each soldier class, so loop through three times - //and randomly choose some (or all) of the matching slots to fill. This is done randomly. + //and randomly choose some (or all) of the matching slots to fill. This is done randomly. for( ubCurrClass = SOLDIER_CLASS_ADMINISTRATOR; ubCurrClass <= SOLDIER_CLASS_ARMY; ubCurrClass++ ) { //First, prepare the counters. switch( ubCurrClass ) { - case SOLDIER_CLASS_ADMINISTRATOR: + case SOLDIER_CLASS_ADMINISTRATOR: pCurrSlots = &ubGreenSlots; pCurrTotal = &ubNumGreen; break; @@ -1431,7 +1425,7 @@ void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumRegs, UINT8 ubNumEl curr->pBasicPlacement->bOrders = STATIONARY; switch( ubCurrClass ) { - case SOLDIER_CLASS_ADMINISTRATOR: + case SOLDIER_CLASS_ADMINISTRATOR: curr->pBasicPlacement->ubSoldierClass = SOLDIER_CLASS_GREEN_MILITIA; break; case SOLDIER_CLASS_ARMY: @@ -1460,15 +1454,15 @@ void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumRegs, UINT8 ubNumEl } if( !ubMaxNum ) return; - //If we are at this point, that means that there are some compatibility issues. This is fine. An example - //would be a map containing 1 elite placement, and 31 troop placements. If we had 3 elites move into this - //sector, we would not have placements for two of them. What we have to do is override the class information - //contained in the list by choosing unused placements, and assign them to the elites. This time, we will - //use all free slots including priority placement slots (ignoring the priority placement information). + //If we are at this point, that means that there are some compatibility issues. This is fine. An example + //would be a map containing 1 elite placement, and 31 troop placements. If we had 3 elites move into this + //sector, we would not have placements for two of them. What we have to do is override the class information + //contained in the list by choosing unused placements, and assign them to the elites. This time, we will + //use all free slots including priority placement slots (ignoring the priority placement information). //First, count up the total number of free slots. ubFreeSlots = 0; - curr = gSoldierInitHead; + curr = gSoldierInitHead; while( curr ) { if( !curr->pSoldier && (curr->pBasicPlacement->bTeam == ENEMY_TEAM || curr->pBasicPlacement->bTeam == MILITIA_TEAM) ) @@ -1476,9 +1470,9 @@ void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumRegs, UINT8 ubNumEl curr = curr->next; } - //Now, loop through the entire list again, but for the last time. All enemies will be inserted now ignoring + //Now, loop through the entire list again, but for the last time. All enemies will be inserted now ignoring //detailed placements and classes. - curr = gSoldierInitHead; + curr = gSoldierInitHead; while( curr && ubFreeSlots && ubMaxNum ) { if( !curr->pSoldier && (curr->pBasicPlacement->bTeam == ENEMY_TEAM || curr->pBasicPlacement->bTeam == MILITIA_TEAM) ) @@ -1511,7 +1505,7 @@ void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumRegs, UINT8 ubNumEl curr->pBasicPlacement->bAttitude = (INT8) Random( MAXATTITUDES ); if( curr->pDetailedPlacement ) { //delete the detailed placement information. - MemFree( curr->pDetailedPlacement ); + delete( curr->pDetailedPlacement ); curr->pDetailedPlacement = NULL; curr->pBasicPlacement->fDetailedPlacement = FALSE; RandomizeRelativeLevel( &( curr->pBasicPlacement->bRelativeAttributeLevel), curr->pBasicPlacement->ubSoldierClass ); @@ -1532,7 +1526,7 @@ void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumRegs, UINT8 ubNumEl } } -void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT8 ubNumLarvae, UINT8 ubNumInfants, +void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT8 ubNumLarvae, UINT8 ubNumInfants, UINT8 ubNumYoungMales, UINT8 ubNumYoungFemales, UINT8 ubNumAdultMales, UINT8 ubNumAdultFemales ) { @@ -1545,13 +1539,13 @@ void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT8 ubNumLarvae, UINT8 ubNum SortSoldierInitList(); - //Okay, if we have a queen, place her first. She MUST have a special placement, else + //Okay, if we have a queen, place her first. She MUST have a special placement, else //we can't use anything. ubNumCreatures = (UINT8)(ubNumLarvae + ubNumInfants + ubNumYoungMales + ubNumYoungFemales + ubNumAdultMales + ubNumAdultFemales); if( fQueen ) { - curr = gSoldierInitHead; - while( curr ) + curr = gSoldierInitHead; + while( curr ) { if( !curr->pSoldier && curr->pBasicPlacement->bTeam == CREATURE_TEAM && curr->pBasicPlacement->bBodyType == QUEENMONSTER ) { @@ -1572,7 +1566,7 @@ void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT8 ubNumLarvae, UINT8 ubNum } //First fill up only the priority existance slots (as long as the availability and bodytypes match) - curr = gSoldierInitHead; + curr = gSoldierInitHead; while( curr && curr->pBasicPlacement->fPriorityExistance && ubNumCreatures ) { fDoPlacement = TRUE; @@ -1610,7 +1604,7 @@ void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT8 ubNumLarvae, UINT8 ubNum return; //Count how many free creature slots are left. - curr = gSoldierInitHead; + curr = gSoldierInitHead; ubFreeSlots = 0; while( curr ) { @@ -1618,9 +1612,9 @@ void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT8 ubNumLarvae, UINT8 ubNum ubFreeSlots++; curr = curr->next; } - //Now, if we still have creatures to place, do so completely randomly, overriding priority + //Now, if we still have creatures to place, do so completely randomly, overriding priority //placements, etc. - curr = gSoldierInitHead; + curr = gSoldierInitHead; while( curr && ubFreeSlots && ubNumCreatures ) { if( !curr->pSoldier && curr->pBasicPlacement->bTeam == CREATURE_TEAM ) @@ -1748,7 +1742,7 @@ void UseEditorAlternateList() } //Any killed people that used detailed placement information must prevent that from occurring -//again in the future. Otherwise, the sniper guy with 99 marksmanship could appear again +//again in the future. Otherwise, the sniper guy with 99 marksmanship could appear again //if the map was loaded again! void EvaluateDeathEffectsToSoldierInitList( SOLDIERTYPE *pSoldier ) { @@ -1764,12 +1758,12 @@ void EvaluateDeathEffectsToSoldierInitList( SOLDIERTYPE *pSoldier ) { //Matching soldier found if( curr->pDetailedPlacement ) { //This soldier used detailed placement information, so we must save the - //node ID into the temp file which signifies that the + //node ID into the temp file which signifies that the //RECORD UBNODEID IN TEMP FILE. curr->pSoldier = NULL; - MemFree( curr->pDetailedPlacement ); + delete( curr->pDetailedPlacement ); curr->pDetailedPlacement = NULL; return; } @@ -1789,7 +1783,7 @@ void RemoveDetailedPlacementInfo( UINT8 ubNodeID ) { if( curr->pDetailedPlacement ) { - MemFree( curr->pDetailedPlacement ); + delete( curr->pDetailedPlacement ); curr->pDetailedPlacement = NULL; return; } @@ -1875,9 +1869,9 @@ BOOLEAN LoadSoldierInitListLinks( HWFILE hfile ) if( curr->ubNodeID == ubNodeID ) { curr->ubSoldierID = ubSoldierID; - if( ubSoldierID >= gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID && + if( ubSoldierID >= gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID && ubSoldierID <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID || - ubSoldierID >= gTacticalStatus.Team[ CIV_TEAM ].bFirstID && + ubSoldierID >= gTacticalStatus.Team[ CIV_TEAM ].bFirstID && ubSoldierID <= gTacticalStatus.Team[ CIV_TEAM ].bLastID ) { //only enemies and creatures. curr->pSoldier = MercPtrs[ ubSoldierID ]; @@ -1929,7 +1923,7 @@ void AddSoldierInitListBloodcats() #ifdef JA2BETAVERSION CHAR16 str[200]; swprintf( str, L"Table specifies that there are %d bloodcat placements in sector %c%d, but the map actually has %d bloodcat placements. Map value takes precedence. KM,LC:1", - pSector->bBloodCatPlacements, gWorldSectorY + 'A' - 1, gWorldSectorX, bBloodCatPlacements ); + pSector->bBloodCatPlacements, gWorldSectorY + 'A' - 1, gWorldSectorX, bBloodCatPlacements ); DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, NULL ); #endif pSector->bBloodCatPlacements = bBloodCatPlacements; @@ -1960,7 +1954,7 @@ void AddSoldierInitListBloodcats() while( curr ) { if( curr->pBasicPlacement->bBodyType == BLOODCAT && curr->pSoldier ) - ubNumAdded++; //already one here! + ubNumAdded++; //already one here! curr = curr->next; } @@ -1970,7 +1964,7 @@ void AddSoldierInitListBloodcats() while( curr && curr->pBasicPlacement->fPriorityExistance && ubNumAdded < ubMaxNum ) { if( curr->pBasicPlacement->bBodyType == BLOODCAT ) - { + { //Matching team, so add this placement. if( AddPlacementToWorld( curr ) ) { @@ -2017,10 +2011,10 @@ void AddSoldierInitListBloodcats() } else { - //if it fails to create the soldier, it is likely that it is because the slots in the tactical - //engine are already full. Besides, the strategic AI shouldn't be trying to fill a map with - //more than the maximum allowable soldiers of team. All teams can have a max of 32 individuals, - //except for the player which is 20. Players aren't processed in this list anyway. + //if it fails to create the soldier, it is likely that it is because the slots in the tactical + //engine are already full. Besides, the strategic AI shouldn't be trying to fill a map with + //more than the maximum allowable soldiers of team. All teams can have a max of 32 individuals, + //except for the player which is 20. Players aren't processed in this list anyway. return; } ubSlotsToFill--; @@ -2054,7 +2048,7 @@ SOLDIERINITNODE * FindSoldierInitListNodeByProfile( UINT8 ubProfile ) } //This is the code that loops through the profiles starting at the RPCs, and adds them using strategic insertion -//information, and not editor placements. The key flag involved for doing it this way is the gMercProfiles[i].fUseProfileInsertionInfo. +//information, and not editor placements. The key flag involved for doing it this way is the gMercProfiles[i].fUseProfileInsertionInfo. void AddProfilesUsingProfileInsertionData() { INT32 i; @@ -2070,9 +2064,9 @@ void AddProfilesUsingProfileInsertionData() gMercProfiles[ i ].bSectorZ != gbWorldSectorZ || gMercProfiles[ i ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED || gMercProfiles[ i ].ubMiscFlags & PROFILE_MISC_FLAG_EPCACTIVE || - // gMercProfiles[ i ].ubMiscFlags2 & PROFILE_MISC_FLAG2_DONT_ADD_TO_SECTOR || +// gMercProfiles[ i ].ubMiscFlags2 & PROFILE_MISC_FLAG2_DONT_ADD_TO_SECTOR || !gMercProfiles[ i ].bLife || - !gMercProfiles[ i ].fUseProfileInsertionInfo + !gMercProfiles[ i ].fUseProfileInsertionInfo ) { //Don't add, so skip to the next soldier. continue; @@ -2084,8 +2078,7 @@ void AddProfilesUsingProfileInsertionData() UINT8 ubID; //Set up the create struct so that we can properly create the profile soldier. - // It's been C++'d, so don't do this! - //memset( &MercCreateStruct, 0, sizeof( MercCreateStruct ) ); + MercCreateStruct.initialize(); MercCreateStruct.bTeam = CIV_TEAM; MercCreateStruct.ubProfile = (UINT8)i; MercCreateStruct.sSectorX = gWorldSectorX; @@ -2099,7 +2092,7 @@ void AddProfilesUsingProfileInsertionData() pSoldier->ubStrategicInsertionCode = gMercProfiles[ i ].ubStrategicInsertionCode; pSoldier->usStrategicInsertionData = gMercProfiles[ i ].usStrategicInsertionData; UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); - // CJC: Note well that unless an error occurs, UpdateMercInSector calls + // CJC: Note well that unless an error occurs, UpdateMercInSector calls // AddSoldierToSector // AddSoldierToSector( pSoldier->ubID ); @@ -2129,7 +2122,7 @@ void AddProfilesUsingProfileInsertionData() { pSchedule->ubSoldierID = pSoldier->ubID; pSoldier->ubScheduleID = curr->pDetailedPlacement->ubScheduleID; - } + } } } } @@ -2144,8 +2137,8 @@ void AddProfilesNotUsingProfileInsertionData() curr = gSoldierInitHead; while( curr ) { - if( !curr->pSoldier && - curr->pBasicPlacement->bTeam == CIV_TEAM && + if( !curr->pSoldier && + curr->pBasicPlacement->bTeam == CIV_TEAM && curr->pDetailedPlacement && curr->pDetailedPlacement->ubProfile != NO_PROFILE && !gMercProfiles[ curr->pDetailedPlacement->ubProfile ].fUseProfileInsertionInfo && @@ -2183,14 +2176,14 @@ BOOLEAN ValidateSoldierInitLinks( UINT8 ubCode ) { case 1: //loading save swprintf( str, L"Error detected in save file WHILE LOADING. Please send save and text files associated with save to Kris and Dave." - L" After doing so, go back into the game and immediately resave the game which will fix the problem." - L" This is the bug responsible for mercs disappearing. Be prepared to answer lots of questions..." ); + L" After doing so, go back into the game and immediately resave the game which will fix the problem." + L" This is the bug responsible for mercs disappearing. Be prepared to answer lots of questions..." ); DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, str, SAVE_LOAD_SCREEN, MSG_BOX_FLAG_OK, ErrorDetectedInSaveCallback ); break; case 2: //saving game //swprintf( str, L"Error detected WHILE SAVING file. Please send save and text files associated with save to Kris and Dave." - // L" After doing so, go back into the game and try reloading the new save and saving it again which *could* fix the problem." - // L" This is the bug responsible for mercs disappearing. Be prepared to answer lots of questions..." ); + // L" After doing so, go back into the game and try reloading the new save and saving it again which *could* fix the problem." + // L" This is the bug responsible for mercs disappearing. Be prepared to answer lots of questions..." ); //if( guiPreviousOptionScreen == MAP_SCREEN ) // DoMapMessageBox( MSG_BOX_BASIC_STYLE, str, MAP_SCREEN, MSG_BOX_FLAG_OK, NULL ); //else @@ -2202,8 +2195,8 @@ BOOLEAN ValidateSoldierInitLinks( UINT8 ubCode ) case 4: //after fade in gfDoDialogOnceGameScreenFadesIn = FALSE; swprintf( str, L"Error detected while entering sector USING TEMP FILES. Please send previous save and text files associated with save to Kris and Dave." - L" After doing so, go back into the game and saving the game, reloading it, and saving it again *could* fix it." - L" This is the bug responsible for mercs disappearing. Be prepared to answer lots of questions..." ); + L" After doing so, go back into the game and saving the game, reloading it, and saving it again *could* fix it." + L" This is the bug responsible for mercs disappearing. Be prepared to answer lots of questions..." ); DoMessageBox( MSG_BOX_BASIC_STYLE, str, GAME_SCREEN, MSG_BOX_FLAG_OK, NULL, NULL ); break; } @@ -2246,7 +2239,7 @@ BOOLEAN NewWayOfLoadingEnemySoldierInitListLinks( HWFILE hfile ) if( curr->ubNodeID == ubNodeID ) { curr->ubSoldierID = ubSoldierID; - if( ubSoldierID >= gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID && + if( ubSoldierID >= gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID && ubSoldierID <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID ) { //only enemies and creatures. curr->pSoldier = MercPtrs[ ubSoldierID ]; @@ -2292,7 +2285,7 @@ BOOLEAN NewWayOfLoadingCivilianInitListLinks( HWFILE hfile ) if( curr->ubNodeID == ubNodeID ) { curr->ubSoldierID = ubSoldierID; - if( ubSoldierID >= gTacticalStatus.Team[ CIV_TEAM ].bFirstID && + if( ubSoldierID >= gTacticalStatus.Team[ CIV_TEAM ].bFirstID && ubSoldierID <= gTacticalStatus.Team[ CIV_TEAM ].bLastID ) { //only enemies and creatures. curr->pSoldier = MercPtrs[ ubSoldierID ]; @@ -2338,7 +2331,7 @@ BOOLEAN LookAtButDontProcessEnemySoldierInitListLinks( HWFILE hfile ) if( curr->ubNodeID == ubNodeID ) { curr->ubSoldierID = ubSoldierID; - if( ubSoldierID >= gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID && + if( ubSoldierID >= gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID && ubSoldierID <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID ) { //only enemies and creatures. curr->pSoldier = MercPtrs[ ubSoldierID ]; @@ -2357,7 +2350,7 @@ void StripEnemyDetailedPlacementsIfSectorWasPlayerLiberated() SOLDIERINITNODE *curr; if( !gfWorldLoaded || gbWorldSectorZ ) - { //No world loaded or underground. Underground sectors don't matter + { //No world loaded or underground. Underground sectors don't matter //seeing enemies (not creatures) never rejuvenate underground. return; } @@ -2369,8 +2362,8 @@ void StripEnemyDetailedPlacementsIfSectorWasPlayerLiberated() return; } - //The player has owned the sector at one point. By stripping all of the detailed placements, only basic - //placements will remain. This prevents tanks and "specially detailed" enemies from coming back. + //The player has owned the sector at one point. By stripping all of the detailed placements, only basic + //placements will remain. This prevents tanks and "specially detailed" enemies from coming back. curr = gSoldierInitHead; while( curr ) { @@ -2394,8 +2387,8 @@ void StripEnemyDetailedPlacementsIfSectorWasPlayerLiberated() } -//////// -//////// For militia squad attack! +//////// +//////// For militia squad attack! //////// #define CENTRAL_GRIDNO 13202 @@ -2411,7 +2404,7 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu ubTotalSoldiers = ubNumGreen + ubNumReg + ubNumElites; - // WANNE: If we have no militia soldiers -> exit! + // WANNE: If we have no militia soldiers->exit! if (ubTotalSoldiers == 0) return; @@ -2421,10 +2414,10 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu case INSERTION_CODE_EAST: bDesiredDirection = SOUTHWEST; break; case INSERTION_CODE_SOUTH: bDesiredDirection = NORTHWEST; break; case INSERTION_CODE_WEST: bDesiredDirection = NORTHEAST; break; - default: AssertMsg( 0, "Illegal direction passed to AddSoldierInitListMilitiaOnEdge()" ); break; + default: AssertMsg( 0, "Illegal direction passed to AddSoldierInitListMilitiaOnEdge()" ); break; } #ifdef JA2TESTVERSION - ScreenMsg( FONT_RED, MSG_INTERFACE, L"Militia reinforcements have arrived! (%d admins, %d troops, %d elite)", ubNumGreen, ubNumReg, ubNumElites ); + ScreenMsg( FONT_RED, MSG_INTERFACE, L"Militia reinforcements have arrived! (%d admins, %d troops, %d elite)", ubNumGreen, ubNumReg, ubNumElites ); #endif ChooseMapEdgepoints( &MapEdgepointInfo, ubStrategicInsertionCode, (UINT8)(ubNumGreen + ubNumReg + ubNumElites) ); @@ -2438,25 +2431,25 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu pSoldier = TacticalCreateMilitia(SOLDIER_CLASS_ELITE_MILITIA); // Lesh: if pSoldier is NULL then no slot for a new men or other problems - // it better to leave this function is such case + // it better to leave this function is such case if ( !pSoldier ) return; pSoldier->ubInsertionDirection = bDesiredDirection; // Lesh: militia came from another sector can't reach opposite side of map in case of battle there - // they are often stop at a half way. trying to fix this + // they are often stop at a half way. trying to fix this if ( gTacticalStatus.Team[ MILITIA_TEAM ].bAwareOfOpposition ) { - pSoldier->bOrders = SEEKENEMY; - pSoldier->bAlertStatus = STATUS_RED; + pSoldier->aiData.bOrders = SEEKENEMY; + pSoldier->aiData.bAlertStatus = STATUS_RED; } else { - pSoldier->bOrders = ONGUARD; - pSoldier->bAlertStatus = STATUS_YELLOW; - pSoldier->sNoiseGridno = (INT16)(CENTRAL_GRIDNO + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) * WORLD_COLS); - pSoldier->ubNoiseVolume = MAX_MISC_NOISE_DURATION; + pSoldier->aiData.bOrders = ONGUARD; + pSoldier->aiData.bAlertStatus = STATUS_YELLOW; + pSoldier->aiData.sNoiseGridno = (INT16)(CENTRAL_GRIDNO + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) * WORLD_COLS); + pSoldier->aiData.ubNoiseVolume = MAX_MISC_NOISE_DURATION; } //Setup the position @@ -2465,7 +2458,7 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; pSoldier->usStrategicInsertionData = MapEdgepointInfo.sGridNo[ ubCurrSlot++ ]; } - else + else { //no edgepoints left, so put him at the entrypoint. pSoldier->ubStrategicInsertionCode = ubStrategicInsertionCode; } @@ -2478,25 +2471,25 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu pSoldier = TacticalCreateMilitia(SOLDIER_CLASS_REG_MILITIA); // Lesh: if pSoldier is NULL then no slot for a new men or other problems - // it better to leave this function is such case + // it better to leave this function is such case if ( !pSoldier ) return; pSoldier->ubInsertionDirection = bDesiredDirection; // Lesh: militia came from another sector can't reach opposite side of map in case of battle there - // they are often stop at a half way. trying to fix this + // they are often stop at a half way. trying to fix this if ( gTacticalStatus.Team[ MILITIA_TEAM ].bAwareOfOpposition ) { - pSoldier->bOrders = SEEKENEMY; - pSoldier->bAlertStatus = STATUS_RED; + pSoldier->aiData.bOrders = SEEKENEMY; + pSoldier->aiData.bAlertStatus = STATUS_RED; } else { - pSoldier->bOrders = ONGUARD; - pSoldier->bAlertStatus = STATUS_YELLOW; - pSoldier->sNoiseGridno = (INT16)(CENTRAL_GRIDNO + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) * WORLD_COLS); - pSoldier->ubNoiseVolume = MAX_MISC_NOISE_DURATION; + pSoldier->aiData.bOrders = ONGUARD; + pSoldier->aiData.bAlertStatus = STATUS_YELLOW; + pSoldier->aiData.sNoiseGridno = (INT16)(CENTRAL_GRIDNO + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) * WORLD_COLS); + pSoldier->aiData.ubNoiseVolume = MAX_MISC_NOISE_DURATION; } //Setup the position @@ -2505,7 +2498,7 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; pSoldier->usStrategicInsertionData = MapEdgepointInfo.sGridNo[ ubCurrSlot++ ]; } - else + else { //no edgepoints left, so put him at the entrypoint. pSoldier->ubStrategicInsertionCode = ubStrategicInsertionCode; } @@ -2518,30 +2511,30 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu pSoldier = TacticalCreateMilitia(SOLDIER_CLASS_GREEN_MILITIA); // Lesh: if pSoldier is NULL then no slot for a new men or other problems - // it better to leave this function is such case + // it better to leave this function is such case if ( !pSoldier ) return; pSoldier->ubInsertionDirection = bDesiredDirection; // Lesh: militia came from another sector can't reach opposite side of map in case of battle there - // they are often stop at a half way. trying to fix this + // they are often stop at a half way. trying to fix this if ( gTacticalStatus.Team[ MILITIA_TEAM ].bAwareOfOpposition ) { - pSoldier->bOrders = SEEKENEMY; - pSoldier->bAlertStatus = STATUS_RED; + pSoldier->aiData.bOrders = SEEKENEMY; + pSoldier->aiData.bAlertStatus = STATUS_RED; } else { - pSoldier->bOrders = ONGUARD; - pSoldier->bAlertStatus = STATUS_YELLOW; - pSoldier->sNoiseGridno = (INT16)(CENTRAL_GRIDNO + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) * WORLD_COLS); - pSoldier->ubNoiseVolume = MAX_MISC_NOISE_DURATION; + pSoldier->aiData.bOrders = ONGUARD; + pSoldier->aiData.bAlertStatus = STATUS_YELLOW; + pSoldier->aiData.sNoiseGridno = (INT16)(CENTRAL_GRIDNO + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) * WORLD_COLS); + pSoldier->aiData.ubNoiseVolume = MAX_MISC_NOISE_DURATION; } - // if ( GetTimeOfDayAmbientLightLevel() < NORMAL_LIGHTLEVEL_DAY + 2 ) - // gTacticalStatus.Team[ ENEMY_TEAM ].bAwareOfOpposition = TRUE; - // gTacticalStatus.Team[ MILITIA_TEAM ].bAwareOfOpposition = TRUE; + //if ( GetTimeOfDayAmbientLightLevel() < NORMAL_LIGHTLEVEL_DAY + 2 ) + // gTacticalStatus.Team[ ENEMY_TEAM ].bAwareOfOpposition = TRUE; + //gTacticalStatus.Team[ MILITIA_TEAM ].bAwareOfOpposition = TRUE; //Setup the position if( ubCurrSlot < MapEdgepointInfo.ubNumPoints ) @@ -2549,7 +2542,7 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; pSoldier->usStrategicInsertionData = MapEdgepointInfo.sGridNo[ ubCurrSlot++ ]; } - else + else { //no edgepoints left, so put him at the entrypoint. pSoldier->ubStrategicInsertionCode = ubStrategicInsertionCode; } diff --git a/Tactical/Soldier Init List.h b/Tactical/Soldier Init List.h index 8743f798..ba03c3fb 100644 --- a/Tactical/Soldier Init List.h +++ b/Tactical/Soldier Init List.h @@ -21,7 +21,7 @@ extern SOLDIERINITNODE *gSoldierInitTail; //These serialization functions are assuming the passing of a valid file //pointer to the beginning of the save/load area, at the correct part of the //map file. -BOOLEAN LoadSoldiersFromMap( INT8 **hBuffer ); +BOOLEAN LoadSoldiersFromMap( INT8 **hBuffer, float dMajorMapVersion, UINT8 ubMinorMapVersion ); BOOLEAN SaveSoldiersToMap( HWFILE fp ); //For the purpose of keeping track of which soldier belongs to which placement within the game, diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index c2b28ea4..067287fa 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -11,7 +11,7 @@ #include "worldman.h" #include "renderworld.h" - #include "Soldier Control.h" + #include "Animation Control.h" #include "Animation Data.h" #include "Isometric Utils.h" @@ -60,6 +60,11 @@ extern BOOLEAN gfProfileDataLoaded; #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + BOOLEAN gfPotentialTeamChangeDuringDeath = FALSE; @@ -70,28 +75,31 @@ BOOLEAN gfPotentialTeamChangeDuringDeath = FALSE; #define SET_PROFILE_GAINS2 500, 500, 500, 500, 500, 500, 500, 500, 500 MERCPROFILESTRUCT gMercProfiles[ NUM_PROFILES ]; +MERCPROFILEGEAR gMercProfileGear[ NUM_PROFILES ]; + +extern UINT8 gubItemDroppableFlag[NUM_INV_SLOTS]; INT8 gbSkillTraitBonus[NUM_SKILLTRAITS] = { - 0, //NO_SKILLTRAIT - 25, //LOCKPICKING - 15, //HANDTOHAND - 15, //ELECTRONICS - 15, //NIGHTOPS - 12, //THROWING - 15, //TEACHING - 15, //HEAVY_WEAPS - 0, //AUTO_WEAPS - 15, //STEALTHY - 0, //AMBIDEXT - 0, //THIEF // UNUSED! - 30, //MARTIALARTS - 30, //KNIFING - 15, //ONROOF - 0, //CAMOUFLAGED - 0, //CAMOUFLAGED_URBAN - 0, //CAMOUFLAGED_DESERT - 0, //CAMOUFLAGED_SNOW + 0, //NO_SKILLTRAIT + 25, //LOCKPICKING + 15, //HANDTOHAND + 15, //ELECTRONICS + 15, //NIGHTOPS + 12, //THROWING + 15, //TEACHING + 15, //HEAVY_WEAPS + 0, //AUTO_WEAPS + 15, //STEALTHY + 0, //AMBIDEXT + 0, //THIEF // UNUSED! + 30, //MARTIALARTS + 30, //KNIFING + 5, //PROF_SNIPER + 0, //CAMOUFLAGED + 0, //CAMOUFLAGED_URBAN + 0, //CAMOUFLAGED_DESERT + 0, //CAMOUFLAGED_SNOW }; @@ -235,8 +243,6 @@ BOOLEAN LoadMercProfiles(void) UINT32 uiLoop, uiLoop2;//, uiLoop3; UINT16 usItem;//, usNewGun, usAmmo, usNewAmmo; - UINT32 uiNumBytesRead; - switch ( gGameOptions.ubDifficultyLevel) { case DIF_LEVEL_EASY: @@ -276,14 +282,52 @@ BOOLEAN LoadMercProfiles(void) for(uiLoop=0; uiLoop< NUM_PROFILES; uiLoop++) { - // WDS - Clean up inventory handling - if( JA2EncryptedFileRead( fptr, &gMercProfiles[uiLoop], SIZEOF_MERCPROFILESTRUCT_POD, &uiNumBytesRead ) != 1) + // Changed by ADB, rev 1513 + //if( !gMercProfiles[uiLoop].Load(fptr, true)) + if( !gMercProfiles[uiLoop].Load(fptr, true, true, true)) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("FAILED to Read Merc Profiles from File %d %s",uiLoop, pFileName) ); FileClose( fptr ); return(FALSE); } - gMercProfiles[ uiLoop ].CopyOldInventoryToNew(); + + /* CHRISL: For now, we should only overwrite prof.dat in the new inventory system. Old system should still use + prof.dat until we're sure we want to replace it with the xml file.*/ + if(UsingNewInventorySystem() == true){ + // Start by resetting all profile inventory values to 0 + gMercProfiles[uiLoop].clearInventory(); + gMercProfiles[uiLoop].ubInvUndroppable = 0; + // Next, go through and assign everything but lbe gear + for(uiLoop2=INV_START_POS; uiLoop2 5) + gMercProfiles[uiLoop].bInvNumber[uiLoop2] = gMercProfileGear[uiLoop].iNumber[uiLoop2]; + else + gMercProfiles[uiLoop].bInvNumber[uiLoop2] = 1; + } + //CHRISL: Moved outside first condition we we set ubInvUndroppable regardless of having an item + if(gMercProfileGear[uiLoop].iDrop[uiLoop2] == 0 && uiLoop > 56){ + gMercProfiles[uiLoop].ubInvUndroppable |= gubItemDroppableFlag[uiLoop2]; + } + } + // Last, go through and assign LBE items. Only needed for new inventory system + if((UsingNewInventorySystem() == true)) + { + for(uiLoop2=0; uiLoop2<5; uiLoop2++) + { + UINT32 uiLoop3 = uiLoop2 + VESTPOCKPOS; + if(gMercProfileGear[uiLoop].lbe[uiLoop2] != NONE){ + gMercProfiles[uiLoop].inv[uiLoop3] = gMercProfileGear[uiLoop].lbe[uiLoop2]; + gMercProfiles[uiLoop].bInvStatus[uiLoop3] = gMercProfileGear[uiLoop].lStatus[uiLoop2]; + gMercProfiles[uiLoop].bInvNumber[uiLoop3] = 1; + } + } + } + } //if the Dialogue exists for the merc, allow the merc to be hired if( DialogueDataFileExistsForProfile( (UINT8)uiLoop, 0, FALSE, NULL ) ) @@ -310,7 +354,7 @@ BOOLEAN LoadMercProfiles(void) { // CJC: replace guns in profile if they aren't available - for ( uiLoop2 = 0; uiLoop2 < NUM_INV_SLOTS; uiLoop2++ ) + for ( uiLoop2 = 0; uiLoop2 < gMercProfiles[uiLoop].inv.size(); uiLoop2++ ) { usItem = gMercProfiles[uiLoop].inv[ uiLoop2 ]; @@ -322,7 +366,7 @@ BOOLEAN LoadMercProfiles(void) gMercProfiles[uiLoop].inv[ uiLoop2 ] = usNewGun; // must search through inventory and replace ammo accordingly - for ( uiLoop3 = 0; uiLoop3 < NUM_INV_SLOTS; uiLoop3++ ) + for ( uiLoop3 = 0; uiLoop3 < gMercProfiles[ uiLoop ].inv.size(); uiLoop3++ ) { usAmmo = gMercProfiles[ uiLoop ].inv[ uiLoop3 ]; if ( (Item[ usAmmo ].usItemClass & IC_AMMO) ) @@ -347,7 +391,7 @@ BOOLEAN LoadMercProfiles(void) gMercProfiles[uiLoop].bMainGunAttractiveness = -1; gMercProfiles[uiLoop].bArmourAttractiveness = -1; - for ( uiLoop2 = 0; uiLoop2 < NUM_INV_SLOTS; uiLoop2++ ) + for ( uiLoop2 = 0; uiLoop2 < gMercProfiles[uiLoop].inv.size(); uiLoop2++ ) { usItem = gMercProfiles[uiLoop].inv[ uiLoop2 ]; @@ -372,7 +416,7 @@ BOOLEAN LoadMercProfiles(void) //add up the items the merc has for the usOptionalGearCost gMercProfiles[ uiLoop ].usOptionalGearCost = 0; - for ( uiLoop2 = 0; uiLoop2< NUM_INV_SLOTS; uiLoop2++ ) + for ( uiLoop2 = 0; uiLoop2< gMercProfiles[ uiLoop ].inv.size(); uiLoop2++ ) { if ( gMercProfiles[ uiLoop ].inv[ uiLoop2 ] != NOTHING ) { @@ -389,8 +433,8 @@ BOOLEAN LoadMercProfiles(void) gMercProfiles[ uiLoop ].sGridNo = 0; // ARM: this is also being done inside the profile editor, but put it here too, so this project's code makes sense - gMercProfiles[ uiLoop ].bHatedCount[0] = gMercProfiles[ uiLoop ].bHatedTime[0]; - gMercProfiles[ uiLoop ].bHatedCount[1] = gMercProfiles[ uiLoop ].bHatedTime[1]; + gMercProfiles[ uiLoop ].bHatedCount[0] = gMercProfiles[ uiLoop ].bHatedTime[0]; + gMercProfiles[ uiLoop ].bHatedCount[1] = gMercProfiles[ uiLoop ].bHatedTime[1]; gMercProfiles[ uiLoop ].bLearnToHateCount = gMercProfiles[ uiLoop ].bLearnToHateTime; gMercProfiles[ uiLoop ].bLearnToLikeCount = gMercProfiles[ uiLoop ].bLearnToLikeTime; } @@ -538,7 +582,6 @@ void MakeRemainingTerroristsTougher( void ) { UINT8 ubRemainingTerrorists = 0, ubLoop; UINT16 usNewItem, usOldItem; - OBJECTTYPE Object; UINT8 ubRemainingDifficulty; for ( ubLoop = 0; ubLoop < NUM_TERRORISTS; ubLoop++ ) @@ -610,9 +653,7 @@ void MakeRemainingTerroristsTougher( void ) usNewItem = HAND_GRENADE; } - DeleteObj( &Object ); - Object.usItem = usNewItem; - Object.ItemData.Generic.bStatus[ 0 ] = 100; + CreateItem(usNewItem, 100, &gTempObject); for ( ubLoop = 0; ubLoop < NUM_TERRORISTS; ubLoop++ ) { @@ -631,7 +672,7 @@ void MakeRemainingTerroristsTougher( void ) { RemoveObjectFromSoldierProfile( gubTerrorists[ ubLoop ], usOldItem ); } - PlaceObjectInSoldierProfile( gubTerrorists[ ubLoop ], &Object ); + PlaceObjectInSoldierProfile( gubTerrorists[ ubLoop ], &gTempObject ); } } } @@ -680,12 +721,11 @@ void MakeRemainingAssassinsTougher( void ) { UINT8 ubRemainingAssassins = 0, ubLoop; UINT16 usNewItem, usOldItem; - OBJECTTYPE Object; UINT8 ubRemainingDifficulty; for ( ubLoop = 0; ubLoop < NUM_ASSASSINS; ubLoop++ ) { - if ( gMercProfiles[ gubAssassins[ ubLoop ] ].bMercStatus != MERC_IS_DEAD ) + if ( gMercProfiles[ gubAssassins[ ubLoop ] ].bMercStatus != MERC_IS_DEAD ) { ubRemainingAssassins++; } @@ -744,10 +784,7 @@ void MakeRemainingAssassinsTougher( void ) usNewItem = HAND_GRENADE; } - DeleteObj( &Object ); - Object.usItem = usNewItem; - Object.ItemData.Generic.bStatus[ 0 ] = 100; - + CreateItem(usNewItem, 100, &gTempObject); for ( ubLoop = 0; ubLoop < NUM_ASSASSINS; ubLoop++ ) { if ( gMercProfiles[ gubAssassins[ ubLoop ] ].bMercStatus != MERC_IS_DEAD ) @@ -756,7 +793,7 @@ void MakeRemainingAssassinsTougher( void ) { RemoveObjectFromSoldierProfile( gubAssassins[ ubLoop ], usOldItem ); } - PlaceObjectInSoldierProfile( gubAssassins[ ubLoop ], &Object ); + PlaceObjectInSoldierProfile( gubAssassins[ ubLoop ], &gTempObject ); } } } @@ -799,11 +836,11 @@ void StartSomeMercsOnAssignment(void) void SetProfileFaceData( UINT8 ubCharNum, UINT8 ubFaceIndex, UINT16 usEyesX, UINT16 usEyesY, UINT16 usMouthX, UINT16 usMouthY ) { - gMercProfiles[ ubCharNum ].ubFaceIndex = ubFaceIndex; - gMercProfiles[ ubCharNum ].usEyesX = usEyesX; - gMercProfiles[ ubCharNum ].usEyesY = usEyesY; - gMercProfiles[ ubCharNum ].usMouthX = usMouthX; - gMercProfiles[ ubCharNum ].usMouthY = usMouthY; + gMercProfiles[ ubCharNum ].ubFaceIndex = ubFaceIndex; + gMercProfiles[ ubCharNum ].usEyesX = usEyesX; + gMercProfiles[ ubCharNum ].usEyesY = usEyesY; + gMercProfiles[ ubCharNum ].usMouthX = usMouthX; + gMercProfiles[ ubCharNum ].usMouthY = usMouthY; } UINT16 CalcCompetence( MERCPROFILESTRUCT * pProfile ) @@ -817,16 +854,16 @@ UINT16 CalcCompetence( MERCPROFILESTRUCT * pProfile ) uiStats = ((2 * pProfile->bLifeMax) + pProfile->bStrength + pProfile->bAgility + pProfile->bDexterity + ((pProfile->bLeadership + pProfile->bWisdom) / 2)) / 3; // marksmanship is very important, count it double - uiSkills = (UINT32) ((2 * (pow((double)pProfile->bMarksmanship, 3) / 10000)) + + uiSkills = (UINT32) ((2 * (pow((double)pProfile->bMarksmanship, 3) / 10000)) + 1.5 * (pow((double)pProfile->bMedical, 3) / 10000) + (pow((double)pProfile->bMechanical, 3) / 10000) + (pow((double)pProfile->bExplosive, 3) / 10000)); // action points uiActionPoints = 5 + (((10 * pProfile->bExpLevel + - 3 * pProfile->bAgility + - 2 * pProfile->bLifeMax + - 2 * pProfile->bDexterity) + 20) / 40); + 3 * pProfile->bAgility + + 2 * pProfile->bLifeMax + + 2 * pProfile->bDexterity) + 20) / 40); // count how many he has, don't care what they are @@ -888,6 +925,8 @@ SOLDIERTYPE *ChangeSoldierTeam( SOLDIERTYPE *pSoldier, UINT8 ubTeam ) UINT32 uiSlot; SOLDIERTYPE *pGroupMember; + BOOLEAN success; + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("ChangeSoldierTeam")); if (gfInTalkPanel) @@ -906,9 +945,7 @@ SOLDIERTYPE *ChangeSoldierTeam( SOLDIERTYPE *pSoldier, UINT8 ubTeam ) // Remove him from the game! InternalTacticalRemoveSoldier( ubID, FALSE ); - // WDS - Clean up inventory handling // Create a new one! - MercCreateStruct.initialize(); MercCreateStruct.bTeam = ubTeam; MercCreateStruct.ubProfile = pSoldier->ubProfile; MercCreateStruct.bBodyType = pSoldier->ubBodyType; @@ -918,7 +955,7 @@ SOLDIERTYPE *ChangeSoldierTeam( SOLDIERTYPE *pSoldier, UINT8 ubTeam ) MercCreateStruct.sInsertionGridNo = pSoldier->sGridNo; MercCreateStruct.ubDirection = pSoldier->ubDirection; - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { MercCreateStruct.ubProfile = NO_PROFILE; MercCreateStruct.fUseGivenVehicle = TRUE; @@ -935,33 +972,50 @@ SOLDIERTYPE *ChangeSoldierTeam( SOLDIERTYPE *pSoldier, UINT8 ubTeam ) pNewSoldier = MercPtrs[ ubID ]; // Copy vital stats back! - pNewSoldier->bLife = pSoldier->bLife; - pNewSoldier->bLifeMax = pSoldier->bLifeMax; - pNewSoldier->bAgility = pSoldier->bAgility; - pNewSoldier->bLeadership = pSoldier->bLeadership; - pNewSoldier->bDexterity = pSoldier->bDexterity; - pNewSoldier->bStrength = pSoldier->bStrength; - pNewSoldier->bWisdom = pSoldier->bWisdom; - pNewSoldier->bExpLevel = pSoldier->bExpLevel; - pNewSoldier->bMarksmanship = pSoldier->bMarksmanship; - pNewSoldier->bMedical = pSoldier->bMedical; - pNewSoldier->bMechanical = pSoldier->bMechanical; - pNewSoldier->bExplosive = pSoldier->bExplosive; - pNewSoldier->bScientific = pSoldier->bScientific; + pNewSoldier->stats.bLife = pSoldier->stats.bLife; + pNewSoldier->stats.bLifeMax = pSoldier->stats.bLifeMax; + pNewSoldier->stats.bAgility = pSoldier->stats.bAgility; + pNewSoldier->stats.bLeadership = pSoldier->stats.bLeadership; + pNewSoldier->stats.bDexterity = pSoldier->stats.bDexterity; + pNewSoldier->stats.bStrength = pSoldier->stats.bStrength; + pNewSoldier->stats.bWisdom = pSoldier->stats.bWisdom; + pNewSoldier->stats.bExpLevel = pSoldier->stats.bExpLevel; + pNewSoldier->stats.bMarksmanship = pSoldier->stats.bMarksmanship; + pNewSoldier->stats.bMedical = pSoldier->stats.bMedical; + pNewSoldier->stats.bMechanical = pSoldier->stats.bMechanical; + pNewSoldier->stats.bExplosive = pSoldier->stats.bExplosive; + pNewSoldier->stats.bScientific = pSoldier->stats.bScientific; pNewSoldier->bLastRenderVisibleValue = pSoldier->bLastRenderVisibleValue; pNewSoldier->bVisible = pSoldier->bVisible; // 0verhaul: Need to pass certain flags over. COWERING is one of them. Others to be determined. - pNewSoldier->uiStatusFlags |= pSoldier->uiStatusFlags & (SOLDIER_COWERING | SOLDIER_MUTE | SOLDIER_GASSED); + pNewSoldier->flags.uiStatusFlags |= pSoldier->flags.uiStatusFlags & (SOLDIER_COWERING | SOLDIER_MUTE | SOLDIER_GASSED); if ( ubTeam == gbPlayerNum ) { pNewSoldier->bVisible = 1; } - // Copy over any items.... - for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ ) + //CHRISL: Rather then resorting the profile, which recreates all the items, what if we simply try and sort the + // objects that are already attached to the RPC we're hiring? + if(UsingNewInventorySystem() == true) { - pNewSoldier->inv[ cnt ] = pSoldier->inv[ cnt ]; + // Start by direct copy of all BODYPOS items (armor, hands, head and LBE) + for(cnt = 0; cnt < (UINT32)BODYPOSFINAL; cnt++) + { + pNewSoldier->inv[cnt] = pSoldier->inv[cnt]; + } + // Next, try to autoplace everything else + for(cnt = BIGPOCKSTART; cnt < pNewSoldier->inv.size(); cnt++ ) + { + if(pSoldier->inv[cnt].exists() == true) + { + success = PlaceInAnyPocket(pNewSoldier, &pSoldier->inv[cnt], FALSE); + if(!success) + { + PlaceObject( pNewSoldier, cnt, &pSoldier->inv[cnt] ); + } + } + } } // OK, loop through all active merc slots, change @@ -988,9 +1042,9 @@ SOLDIERTYPE *ChangeSoldierTeam( SOLDIERTYPE *pSoldier, UINT8 ubTeam ) HandleCheckForDeathCommonCode( pSoldier ); } - if ( gfWorldLoaded && pSoldier->bInSector + if ( gfWorldLoaded && pSoldier->bInSector //pSoldier->sSectorX == gWorldSectorX && pSoldier->sSectorY == gWorldSectorY && pSoldier->bSectorZ == gbWorldSectorZ - ) + ) { AddSoldierToSectorNoCalculateDirectionUseAnimation( ubID, pSoldier->usAnimState, pSoldier->usAniCode ); HandleSight(pNewSoldier, SIGHT_LOOK | SIGHT_RADIO); @@ -1043,9 +1097,18 @@ BOOLEAN RecruitRPC( UINT8 ubCharNum ) // Add this guy to our team! pNewSoldier = ChangeSoldierTeam( pSoldier, gbPlayerNum ); - // handle set up any RPC's that will leave us in time if ( ubCharNum == SLAY ) { + if(gGameExternalOptions.fEnableSlayForever == TRUE) + { + if(gMercProfiles[ ubCharNum ].sSalary == 0) + gMercProfiles[ ubCharNum ].sSalary = gMercProfiles[ 7 ].sSalary; + if(gMercProfiles[ ubCharNum ].uiWeeklySalary == 0) + gMercProfiles[ ubCharNum ].uiWeeklySalary = gMercProfiles[ 7 ].uiWeeklySalary; + if(gMercProfiles[ ubCharNum ].uiBiWeeklySalary == 0) + gMercProfiles[ ubCharNum ].uiBiWeeklySalary = gMercProfiles[ 7 ].uiBiWeeklySalary; + pNewSoldier->iTotalContractLength = 7; + } // slay will leave in a week pNewSoldier->iEndofContractTime = GetWorldTotalMin() + ( 7 * 24 * 60 ); @@ -1064,11 +1127,11 @@ BOOLEAN RecruitRPC( UINT8 ubCharNum ) AddCharacterToAnySquad( pNewSoldier ); } - ResetDeadSquadMemberList( pNewSoldier->bAssignment ); + ResetDeadSquadMemberList( pNewSoldier->bAssignment ); DirtyMercPanelInterface( pNewSoldier, DIRTYLEVEL2 ); - if ( pNewSoldier->inv[ HANDPOS ].usItem == NOTHING ) + if ( pNewSoldier->inv[ HANDPOS ].exists() == false ) { // empty handed - swap in first available weapon INT8 bSlot; @@ -1079,7 +1142,7 @@ BOOLEAN RecruitRPC( UINT8 ubCharNum ) // if ( Item[ pNewSoldier->inv[ bSlot ].usItem ].fFlags & ITEM_TWO_HANDED ) if ( Item[ pNewSoldier->inv[ bSlot ].usItem ].twohanded ) { - if ( bSlot != SECONDHANDPOS && pNewSoldier->inv[ SECONDHANDPOS ].usItem != NOTHING ) + if ( bSlot != SECONDHANDPOS && pNewSoldier->inv[ SECONDHANDPOS ].exists() == true ) { // need to move second hand item out first AutoPlaceObject( pNewSoldier, &(pNewSoldier->inv[ SECONDHANDPOS ]), FALSE ); @@ -1099,6 +1162,10 @@ BOOLEAN RecruitRPC( UINT8 ubCharNum ) // Set whatkind of merc am i pNewSoldier->ubWhatKindOfMercAmI = MERC_TYPE__NPC; + if ( ubCharNum == SLAY && gGameExternalOptions.fEnableSlayForever == TRUE ) + { + pNewSoldier->ubWhatKindOfMercAmI = MERC_TYPE__AIM_MERC; + } // //add a history log that tells the user that a npc has joined the team @@ -1140,7 +1207,7 @@ BOOLEAN RecruitEPC( UINT8 ubCharNum ) AddCharacterToAnySquad( pNewSoldier ); } - ResetDeadSquadMemberList( pNewSoldier->bAssignment ); + ResetDeadSquadMemberList( pNewSoldier->bAssignment ); DirtyMercPanelInterface( pNewSoldier, DIRTYLEVEL2 ); // Make the interface panel dirty.. @@ -1149,15 +1216,15 @@ BOOLEAN RecruitEPC( UINT8 ubCharNum ) // If we are a robot, look to update controller.... - if ( pNewSoldier->uiStatusFlags & SOLDIER_ROBOT ) + if ( pNewSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) { - UpdateRobotControllerGivenRobot( pNewSoldier ); + pNewSoldier->UpdateRobotControllerGivenRobot( ); } // Set whatkind of merc am i pNewSoldier->ubWhatKindOfMercAmI = MERC_TYPE__EPC; - UpdateTeamPanelAssignments( ); + UpdateTeamPanelAssignments( ); return( TRUE ); } @@ -1180,10 +1247,10 @@ BOOLEAN UnRecruitEPC( UINT8 ubCharNum ) return( FALSE ); } - if ( pSoldier->bAssignment < ON_DUTY ) - { - ResetDeadSquadMemberList( pSoldier->bAssignment ); - } + if ( pSoldier->bAssignment < ON_DUTY ) + { + ResetDeadSquadMemberList( pSoldier->bAssignment ); + } // Rmeove from squad.... RemoveCharacterFromSquads( pSoldier ); @@ -1222,7 +1289,7 @@ BOOLEAN UnRecruitEPC( UINT8 ubCharNum ) // Add this guy to CIV team! pNewSoldier = ChangeSoldierTeam( pSoldier, CIV_TEAM ); - UpdateTeamPanelAssignments( ); + UpdateTeamPanelAssignments( ); return( TRUE ); } @@ -1267,8 +1334,8 @@ INT8 WhichHated( UINT8 ubCharNum, UINT8 ubHated ) BOOLEAN IsProfileATerrorist( UINT8 ubProfile ) { if ( ubProfile == 83 || ubProfile == 111 || - ubProfile == 64 || ubProfile == 112 || - ubProfile == 82 || ubProfile == 110 ) + ubProfile == 64 || ubProfile == 112 || + ubProfile == 82 || ubProfile == 110 ) { return( TRUE ); } @@ -1281,8 +1348,8 @@ BOOLEAN IsProfileATerrorist( UINT8 ubProfile ) BOOLEAN IsProfileAHeadMiner( UINT8 ubProfile ) { if ( ubProfile == 106 || ubProfile == 148 || - ubProfile == 156 || ubProfile == 157 || - ubProfile == 158 ) + ubProfile == 156 || ubProfile == 157 || + ubProfile == 158 ) { return( TRUE ); } @@ -1332,19 +1399,19 @@ void UpdateSoldierPointerDataIntoProfile( BOOLEAN fPlayerMercs ) pProfile = &( gMercProfiles[ pSoldier->ubProfile ] ); // Copy.... - pProfile->bLife = pSoldier->bLife; - pProfile->bLifeMax = pSoldier->bLifeMax; - pProfile->bAgility = pSoldier->bAgility; - pProfile->bLeadership = pSoldier->bLeadership; - pProfile->bDexterity = pSoldier->bDexterity; - pProfile->bStrength = pSoldier->bStrength; - pProfile->bWisdom = pSoldier->bWisdom; - pProfile->bExpLevel = pSoldier->bExpLevel; - pProfile->bMarksmanship = pSoldier->bMarksmanship; - pProfile->bMedical = pSoldier->bMedical; - pProfile->bMechanical = pSoldier->bMechanical; - pProfile->bExplosive = pSoldier->bExplosive; - pProfile->bScientific = pSoldier->bScientific; + pProfile->bLife = pSoldier->stats.bLife; + pProfile->bLifeMax = pSoldier->stats.bLifeMax; + pProfile->bAgility = pSoldier->stats.bAgility; + pProfile->bLeadership = pSoldier->stats.bLeadership; + pProfile->bDexterity = pSoldier->stats.bDexterity; + pProfile->bStrength = pSoldier->stats.bStrength; + pProfile->bWisdom = pSoldier->stats.bWisdom; + pProfile->bExpLevel = pSoldier->stats.bExpLevel; + pProfile->bMarksmanship = pSoldier->stats.bMarksmanship; + pProfile->bMedical = pSoldier->stats.bMedical; + pProfile->bMechanical = pSoldier->stats.bMechanical; + pProfile->bExplosive = pSoldier->stats.bExplosive; + pProfile->bScientific = pSoldier->stats.bScientific; } } } @@ -1470,7 +1537,6 @@ SOLDIERTYPE * SwapLarrysProfiles( SOLDIERTYPE * pSoldier ) pNewProfile->bExplosivesDelta = gMercProfiles[ ubSrcProfile ].bExplosivesDelta; */ - // WDS - Clean up inventory handling pNewProfile->bInvStatus = gMercProfiles[ ubSrcProfile ].bInvStatus; pNewProfile->bInvNumber = gMercProfiles[ ubSrcProfile ].bInvNumber; pNewProfile->inv = gMercProfiles[ ubSrcProfile ].inv; @@ -1487,17 +1553,17 @@ SOLDIERTYPE * SwapLarrysProfiles( SOLDIERTYPE * pSoldier ) // replace profile in group ReplaceSoldierProfileInPlayerGroup( pSoldier->ubGroupID, ubSrcProfile, ubDestProfile ); - pSoldier->bStrength = pNewProfile->bStrength + pNewProfile->bStrengthDelta; - pSoldier->bDexterity = pNewProfile->bDexterity + pNewProfile->bDexterityDelta; - pSoldier->bAgility = pNewProfile->bAgility + pNewProfile->bAgilityDelta; - pSoldier->bWisdom = pNewProfile->bWisdom + pNewProfile->bWisdomDelta; - pSoldier->bExpLevel = pNewProfile->bExpLevel + pNewProfile->bExpLevelDelta; - pSoldier->bLeadership = pNewProfile->bLeadership + pNewProfile->bLeadershipDelta; + pSoldier->stats.bStrength = pNewProfile->bStrength + pNewProfile->bStrengthDelta; + pSoldier->stats.bDexterity = pNewProfile->bDexterity + pNewProfile->bDexterityDelta; + pSoldier->stats.bAgility = pNewProfile->bAgility + pNewProfile->bAgilityDelta; + pSoldier->stats.bWisdom = pNewProfile->bWisdom + pNewProfile->bWisdomDelta; + pSoldier->stats.bExpLevel = pNewProfile->bExpLevel + pNewProfile->bExpLevelDelta; + pSoldier->stats.bLeadership = pNewProfile->bLeadership + pNewProfile->bLeadershipDelta; - pSoldier->bMarksmanship = pNewProfile->bMarksmanship + pNewProfile->bMarksmanshipDelta; - pSoldier->bMechanical = pNewProfile->bMechanical + pNewProfile->bMechanicDelta; - pSoldier->bMedical = pNewProfile->bMedical + pNewProfile->bMedicalDelta; - pSoldier->bExplosive = pNewProfile->bExplosive + pNewProfile->bExplosivesDelta; + pSoldier->stats.bMarksmanship = pNewProfile->bMarksmanship + pNewProfile->bMarksmanshipDelta; + pSoldier->stats.bMechanical = pNewProfile->bMechanical + pNewProfile->bMechanicDelta; + pSoldier->stats.bMedical = pNewProfile->bMedical + pNewProfile->bMedicalDelta; + pSoldier->stats.bExplosive = pNewProfile->bExplosive + pNewProfile->bExplosivesDelta; if ( pSoldier->ubProfile == LARRY_DRUNK ) { @@ -1516,36 +1582,36 @@ SOLDIERTYPE * SwapLarrysProfiles( SOLDIERTYPE * pSoldier ) BOOLEAN DoesNPCOwnBuilding( SOLDIERTYPE *pSoldier, INT16 sGridNo ) { - UINT8 ubRoomInfo; + UINT8 ubRoomInfo; - // Get room info - ubRoomInfo = gubWorldRoomInfo[ sGridNo ]; + // Get room info + ubRoomInfo = gubWorldRoomInfo[ sGridNo ]; - if ( ubRoomInfo == NO_ROOM ) - { - return( FALSE ); - } + if ( ubRoomInfo == NO_ROOM ) + { + return( FALSE ); + } - // Are we an NPC? - if ( pSoldier->bTeam != CIV_TEAM ) - { - return( FALSE ); - } + // Are we an NPC? + if ( pSoldier->bTeam != CIV_TEAM ) + { + return( FALSE ); + } - // OK, check both ranges - if ( ubRoomInfo >= gMercProfiles[ pSoldier->ubProfile ].ubRoomRangeStart[ 0 ] && - ubRoomInfo <= gMercProfiles[ pSoldier->ubProfile ].ubRoomRangeEnd[ 0 ] ) - { - return( TRUE ); - } + // OK, check both ranges + if ( ubRoomInfo >= gMercProfiles[ pSoldier->ubProfile ].ubRoomRangeStart[ 0 ] && + ubRoomInfo <= gMercProfiles[ pSoldier->ubProfile ].ubRoomRangeEnd[ 0 ] ) + { + return( TRUE ); + } - if ( ubRoomInfo >= gMercProfiles[ pSoldier->ubProfile ].ubRoomRangeStart[ 1 ] && - ubRoomInfo <= gMercProfiles[ pSoldier->ubProfile ].ubRoomRangeEnd[ 1 ] ) - { - return( TRUE ); - } + if ( ubRoomInfo >= gMercProfiles[ pSoldier->ubProfile ].ubRoomRangeStart[ 1 ] && + ubRoomInfo <= gMercProfiles[ pSoldier->ubProfile ].ubRoomRangeEnd[ 1 ] ) + { + return( TRUE ); + } - return( FALSE ); + return( FALSE ); } BOOLEAN IsProfileIdAnAimOrMERCMerc( UINT8 ubProfileID ) diff --git a/Tactical/Soldier Profile.h b/Tactical/Soldier Profile.h index 3a378803..d4b85aff 100644 --- a/Tactical/Soldier Profile.h +++ b/Tactical/Soldier Profile.h @@ -11,6 +11,8 @@ extern INT16 gsTerroristSector[][5][2]; extern BOOLEAN gfPotentialTeamChangeDuringDeath; extern MERCPROFILESTRUCT gMercProfiles[ NUM_PROFILES ]; +extern MERCPROFILEGEAR gMercProfileGear[ NUM_PROFILES ]; + #define AIM_AND_MERC_MERCS 51 // A.I.M. is 0-39, M.E.R.C.s are 40-50 diff --git a/Tactical/Soldier Tile.cpp b/Tactical/Soldier Tile.cpp index 542b8de3..7bf42b68 100644 --- a/Tactical/Soldier Tile.cpp +++ b/Tactical/Soldier Tile.cpp @@ -10,7 +10,7 @@ #include "debug.h" #include "MemMan.h" #include "Overhead Types.h" - #include "Soldier Control.h" + #include "Animation Cache.h" #include "Animation Data.h" #include "Animation Control.h" @@ -26,7 +26,7 @@ #include "video.h" #include "points.h" #include "Win util.h" - #include "Sound Control.h" +// #include "Sound Control.h" #include "lighting.h" #include "weapons.h" #include "vobject_blitters.h" @@ -63,6 +63,11 @@ extern INT8 gbNumMercsUntilWaitingOver; extern UINT8 gubWaitingForAllMercsToExitCode; +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + #define NEXT_TILE_CHECK_DELAY 700 @@ -70,33 +75,33 @@ extern UINT8 gubWaitingForAllMercsToExitCode; void OutputDebugInfoForTurnBasedNextTileWaiting( SOLDIERTYPE * pSoldier ) { - if ( (gTacticalStatus.uiFlags & INCOMBAT) && (pSoldier->usPathDataSize > 0) ) + if ( (gTacticalStatus.uiFlags & INCOMBAT) && (pSoldier->pathing.usPathDataSize > 0) ) { UINT32 uiLoop; - UINT16 usTemp = NOWHERE; - UINT16 usNewGridNo; + INT16 sTemp = NOWHERE; + INT16 sNewGridNo; - usNewGridNo = NewGridNo( pSoldier->sGridNo, DirectionInc( (UINT8)pSoldier->usPathingData[ pSoldier->usPathIndex ] ) ); + sNewGridNo = NewGridNo( pSoldier->sGridNo, DirectionInc( (UINT8)pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathIndex ] ) ); // provide more info!! - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String(" Soldier path size %d, index %d", pSoldier->usPathDataSize, pSoldier->usPathIndex ) ); - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String(" Who is at blocked gridno: %d", WhoIsThere2( usNewGridNo, pSoldier->bLevel ) ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String(" Soldier path size %d, index %d", pSoldier->pathing.usPathDataSize, pSoldier->pathing.usPathIndex ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String(" Who is at blocked gridno: %d", WhoIsThere2( sNewGridNo, pSoldier->pathing.bLevel ) ) ); - for ( uiLoop = 0; uiLoop < pSoldier->usPathDataSize; uiLoop++ ) + for ( uiLoop = 0; uiLoop < pSoldier->pathing.usPathDataSize; uiLoop++ ) { - if ( uiLoop > pSoldier->usPathIndex ) - { - usTemp = NewGridNo( usTemp, DirectionInc( (UINT8)pSoldier->usPathingData[ uiLoop ] ) ); - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String(" Soldier path[%d]: %d == gridno %d", uiLoop, pSoldier->usPathingData[uiLoop], usTemp ) ); - } - else if ( uiLoop == pSoldier->usPathIndex ) + if ( uiLoop > pSoldier->pathing.usPathIndex ) { - usTemp = usNewGridNo; - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String(" Soldier path[%d]: %d == gridno %d", uiLoop, pSoldier->usPathingData[uiLoop], usTemp ) ); + sTemp = NewGridNo( sTemp, DirectionInc( (UINT8)pSoldier->pathing.usPathingData[ uiLoop ] ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String(" Soldier path[%d]: %d == gridno %d", uiLoop, pSoldier->pathing.usPathingData[uiLoop], sTemp ) ); + } + else if ( uiLoop == pSoldier->pathing.usPathIndex ) + { + sTemp = sNewGridNo; + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String(" Soldier path[%d]: %d == gridno %d", uiLoop, pSoldier->pathing.usPathingData[uiLoop], sTemp ) ); } else { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String(" Soldier path[%d]: %d", uiLoop, pSoldier->usPathingData[uiLoop] ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String(" Soldier path[%d]: %d", uiLoop, pSoldier->pathing.usPathingData[uiLoop] ) ); } } @@ -113,14 +118,14 @@ void SetDelayedTileWaiting( SOLDIERTYPE *pSoldier, INT16 sCauseGridNo, INT8 bVal // Cancel AI Action // CancelAIAction( pSoldier, TRUE ); - pSoldier->fDelayedMovement = bValue; + pSoldier->flags.fDelayedMovement = bValue; pSoldier->sDelayedMovementCauseGridNo = sCauseGridNo; - RESETTIMECOUNTER( pSoldier->NextTileCounter, NEXT_TILE_CHECK_DELAY ); + RESETTIMECOUNTER( pSoldier->timeCounters.NextTileCounter, NEXT_TILE_CHECK_DELAY ); // ATE: Now update realtime movement speed.... // check if guy exists here... - ubPerson = WhoIsThere2( sCauseGridNo, pSoldier->bLevel ); + ubPerson = WhoIsThere2( sCauseGridNo, pSoldier->pathing.bLevel ); // There may not be anybody there, but it's reserved by them! if ( ( gpWorldLevelData[ sCauseGridNo ].uiFlags & MAPELEMENT_MOVEMENT_RESERVED ) ) @@ -136,7 +141,7 @@ void SetDelayedTileWaiting( SOLDIERTYPE *pSoldier, INT16 sCauseGridNo, INT8 bVal // Here we have another guy.... save his stats so we can use them for // speed determinations.... pSoldier->bOverrideMoveSpeed = ubPerson; - pSoldier->fUseMoverrideMoveSpeed = TRUE; + pSoldier->flags.fUseMoverrideMoveSpeed = TRUE; } } } @@ -147,12 +152,12 @@ void SetFinalTile( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fGivenUp ) // OK, If we were waiting for stuff, do it here... // ATE: Disabled stuff below, made obsolete by timeout... - //if ( pSoldier->ubWaitActionToDo ) + //if ( pSoldier->ubWaitActionToDo ) //{ // pSoldier->ubWaitActionToDo = 0; // gbNumMercsUntilWaitingOver--; //} - pSoldier->sFinalDestination = pSoldier->sGridNo; + pSoldier->pathing.sFinalDestination = pSoldier->sGridNo; #ifdef JA2BETAVERSION if ( gTacticalStatus.uiFlags & INCOMBAT ) @@ -161,12 +166,12 @@ void SetFinalTile( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fGivenUp ) } #endif - if ( pSoldier->bTeam == gbPlayerNum && fGivenUp ) - { + if ( pSoldier->bTeam == gbPlayerNum && fGivenUp ) + { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ NO_PATH_FOR_MERC ], pSoldier->name ); - } + } - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); } @@ -210,7 +215,7 @@ void UnMarkMovementReserved( SOLDIERTYPE *pSoldier ) } } -INT8 TileIsClear( SOLDIERTYPE *pSoldier, INT8 bDirection, INT16 sGridNo, INT8 bLevel ) +INT8 TileIsClear( SOLDIERTYPE *pSoldier, INT8 bDirection, INT16 sGridNo, INT8 bLevel ) { UINT8 ubPerson; INT16 sTempDestGridNo; @@ -234,13 +239,13 @@ INT8 TileIsClear( SOLDIERTYPE *pSoldier, INT8 bDirection, INT16 sGridNo, INT8 b if ( pSoldier->bTeam != gbPlayerNum ) // CJC: shouldn't this be in all cases??? //if ( 0 ) { - pSoldier->fBlockedByAnotherMerc = TRUE; + pSoldier->flags.fBlockedByAnotherMerc = TRUE; // Set direction we were trying to goto pSoldier->bBlockedByAnotherMercDirection = bDirection; // Are we only temporarily blocked? // Check if our final destination is = our gridno - if ( ( MercPtrs[ ubPerson ]->sFinalDestination == MercPtrs[ ubPerson ]->sGridNo ) ) + if ( ( MercPtrs[ ubPerson ]->pathing.sFinalDestination == MercPtrs[ ubPerson ]->sGridNo ) ) { return( MOVE_TILE_STATIONARY_BLOCKED ); } @@ -248,35 +253,35 @@ INT8 TileIsClear( SOLDIERTYPE *pSoldier, INT8 bDirection, INT16 sGridNo, INT8 b { // OK, if buddy who is blocking us is trying to move too... // And we are in opposite directions... - if ( MercPtrs[ ubPerson ]->fBlockedByAnotherMerc && MercPtrs[ ubPerson ]->bBlockedByAnotherMercDirection == gOppositeDirection[ bDirection ] ) + if ( MercPtrs[ ubPerson ]->flags.fBlockedByAnotherMerc && MercPtrs[ ubPerson ]->bBlockedByAnotherMercDirection == gOppositeDirection[ bDirection ] ) { // OK, try and get a path around buddy.... // We have to temporarily make buddy stopped... - sTempDestGridNo = MercPtrs[ ubPerson ]->sFinalDestination; - MercPtrs[ ubPerson ]->sFinalDestination = MercPtrs[ ubPerson ]->sGridNo; + sTempDestGridNo = MercPtrs[ ubPerson ]->pathing.sFinalDestination; + MercPtrs[ ubPerson ]->pathing.sFinalDestination = MercPtrs[ ubPerson ]->sGridNo; - if ( PlotPath( pSoldier, pSoldier->sFinalDestination, NO_COPYROUTE, NO_PLOT, TEMPORARY, pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ) ) + if ( PlotPath( pSoldier, pSoldier->pathing.sFinalDestination, NO_COPYROUTE, NO_PLOT, TEMPORARY, pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ) ) { - pSoldier->bPathStored = FALSE; + pSoldier->pathing.bPathStored = FALSE; // OK, make guy go here... - EVENT_GetNewSoldierPath( pSoldier, pSoldier->sFinalDestination, pSoldier->usUIMovementMode ); + pSoldier->EVENT_GetNewSoldierPath( pSoldier->pathing.sFinalDestination, pSoldier->usUIMovementMode ); // Restore final dest.... - MercPtrs[ ubPerson ]->sFinalDestination = sTempDestGridNo; - pSoldier->fBlockedByAnotherMerc = FALSE; + MercPtrs[ ubPerson ]->pathing.sFinalDestination = sTempDestGridNo; + pSoldier->flags.fBlockedByAnotherMerc = FALSE; // Is the next tile blocked too? - sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( (UINT8)guiPathingData[ 0 ] ) ); + sNewGridNo = NewGridNo( (INT16)pSoldier->sGridNo, DirectionInc( (UINT8)guiPathingData[ 0 ] ) ); - return( TileIsClear( pSoldier, (UINT8)guiPathingData[ 0 ], sNewGridNo, pSoldier->bLevel ) ); - } + return( TileIsClear( pSoldier, (UINT8)guiPathingData[ 0 ], sNewGridNo, pSoldier->pathing.bLevel ) ); + } else { // Not for multi-tiled things... - if ( !( pSoldier->uiStatusFlags & SOLDIER_MULTITILE ) ) + if ( !( pSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE ) ) { // Is the next movement cost for a door? - if ( DoorTravelCost( pSoldier, sGridNo, gubWorldMovementCosts[ sGridNo ][ bDirection ][ pSoldier->bLevel ], (BOOLEAN)( pSoldier->bTeam == gbPlayerNum ), NULL ) == TRAVELCOST_DOOR ) + if ( DoorTravelCost( pSoldier, sGridNo, gubWorldMovementCosts[ sGridNo ][ bDirection ][ pSoldier->pathing.bLevel ], (BOOLEAN)( pSoldier->bTeam == gbPlayerNum ), NULL ) == TRAVELCOST_DOOR ) { fSwapInDoor = TRUE; } @@ -285,18 +290,18 @@ INT8 TileIsClear( SOLDIERTYPE *pSoldier, INT8 bDirection, INT16 sGridNo, INT8 b // Swap now! - MercPtrs[ ubPerson ]->fBlockedByAnotherMerc = FALSE; + MercPtrs[ ubPerson ]->flags.fBlockedByAnotherMerc = FALSE; // Restore final dest.... - MercPtrs[ ubPerson ]->sFinalDestination = sTempDestGridNo; - + MercPtrs[ ubPerson ]->pathing.sFinalDestination = sTempDestGridNo; + // Swap merc positions..... SwapMercPositions( pSoldier, MercPtrs[ ubPerson ] ); - + // With these two guys swapped, they should try and continue on their way.... // Start them both again along their way... - EVENT_GetNewSoldierPath( pSoldier, pSoldier->sFinalDestination, pSoldier->usUIMovementMode ); - EVENT_GetNewSoldierPath( MercPtrs[ ubPerson ], MercPtrs[ ubPerson ]->sFinalDestination, MercPtrs[ ubPerson ]->usUIMovementMode ); + pSoldier->EVENT_GetNewSoldierPath( pSoldier->pathing.sFinalDestination, pSoldier->usUIMovementMode ); + MercPtrs[ ubPerson ]->EVENT_GetNewSoldierPath( MercPtrs[ ubPerson ]->pathing.sFinalDestination, MercPtrs[ ubPerson ]->usUIMovementMode ); } } } @@ -308,14 +313,14 @@ INT8 TileIsClear( SOLDIERTYPE *pSoldier, INT8 bDirection, INT16 sGridNo, INT8 b //return( MOVE_TILE_STATIONARY_BLOCKED ); // ATE: OK, put some smartshere... // If we are waiting for more than a few times, change to stationary... - if ( MercPtrs[ ubPerson ]->fDelayedMovement >= 105 ) + if ( MercPtrs[ ubPerson ]->flags.fDelayedMovement >= 105 ) { // Set to special 'I want to walk through people' value - pSoldier->fDelayedMovement = 150; + pSoldier->flags.fDelayedMovement = 150; return( MOVE_TILE_STATIONARY_BLOCKED ); } - if ( MercPtrs[ ubPerson ]->sGridNo == MercPtrs[ ubPerson ]->sFinalDestination ) + if ( MercPtrs[ ubPerson ]->sGridNo == MercPtrs[ ubPerson ]->pathing.sFinalDestination ) { return( MOVE_TILE_STATIONARY_BLOCKED ); } @@ -333,22 +338,22 @@ INT8 TileIsClear( SOLDIERTYPE *pSoldier, INT8 bDirection, INT16 sGridNo, INT8 b } // Are we clear of structs? - if ( !NewOKDestination( pSoldier, sGridNo, FALSE, pSoldier->bLevel ) ) + if ( !NewOKDestination( pSoldier, sGridNo, FALSE, pSoldier->pathing.bLevel ) ) { // ATE: Fence cost is an exclusiuon here.... - if ( gubWorldMovementCosts[ sGridNo ][ bDirection ][ pSoldier->bLevel ] != TRAVELCOST_FENCE ) + if ( gubWorldMovementCosts[ sGridNo ][ bDirection ][ pSoldier->pathing.bLevel ] != TRAVELCOST_FENCE ) { // ATE: HIdden structs - we do something here... reveal it! - if ( gubWorldMovementCosts[ sGridNo ][ bDirection ][ pSoldier->bLevel ] == TRAVELCOST_HIDDENOBSTACLE ) + if ( gubWorldMovementCosts[ sGridNo ][ bDirection ][ pSoldier->pathing.bLevel ] == TRAVELCOST_HIDDENOBSTACLE ) { gpWorldLevelData[ sGridNo ].uiFlags|=MAPELEMENT_REVEALED; gpWorldLevelData[ sGridNo ].uiFlags|=MAPELEMENT_REDRAW; SetRenderFlags(RENDER_FLAG_MARKED); - RecompileLocalMovementCosts( (UINT16)sGridNo ); + RecompileLocalMovementCosts( (INT16)sGridNo ); } // Unset flag for blocked by soldier... - pSoldier->fBlockedByAnotherMerc = FALSE; + pSoldier->flags.fBlockedByAnotherMerc = FALSE; return( MOVE_TILE_STATIONARY_BLOCKED ); } else @@ -369,7 +374,7 @@ INT8 TileIsClear( SOLDIERTYPE *pSoldier, INT8 bDirection, INT16 sGridNo, INT8 b } // Unset flag for blocked by soldier... - pSoldier->fBlockedByAnotherMerc = FALSE; + pSoldier->flags.fBlockedByAnotherMerc = FALSE; return( MOVE_TILE_CLEAR ); @@ -382,7 +387,7 @@ BOOLEAN HandleNextTile( SOLDIERTYPE *pSoldier, INT8 bDirection, INT16 sGridNo, I INT8 bBlocked; INT16 bOverTerrainType; - // Check for blocking if in realtime + // Check for blocking if in realtime ///if ( ( gTacticalStatus.uiFlags & REALTIME ) || !( gTacticalStatus.uiFlags & INCOMBAT ) ) // ATE: If not on visible tile, return clear ( for path out of map ) @@ -398,7 +403,7 @@ BOOLEAN HandleNextTile( SOLDIERTYPE *pSoldier, INT8 bDirection, INT16 sGridNo, I } { - bBlocked = TileIsClear( pSoldier, bDirection, sGridNo, pSoldier->bLevel ); + bBlocked = TileIsClear( pSoldier, bDirection, sGridNo, pSoldier->pathing.bLevel ); // Check if we are blocked... if ( bBlocked != MOVE_TILE_CLEAR ) @@ -415,21 +420,21 @@ BOOLEAN HandleNextTile( SOLDIERTYPE *pSoldier, INT8 bDirection, INT16 sGridNo, I // CHECK IF they are stationary else if ( bBlocked == MOVE_TILE_STATIONARY_BLOCKED ) { - // Stationary, + // Stationary, { INT16 sOldFinalDest; // Maintain sFinalDest.... - sOldFinalDest = pSoldier->sFinalDestination; + sOldFinalDest = pSoldier->pathing.sFinalDestination; #ifdef JA2BETAVERSION if ( gTacticalStatus.uiFlags & INCOMBAT ) { OutputDebugInfoForTurnBasedNextTileWaiting( pSoldier ); } #endif - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); // Restore... - pSoldier->sFinalDestination = sOldFinalDest; + pSoldier->pathing.sFinalDestination = sOldFinalDest; SetDelayedTileWaiting( pSoldier, sGridNo, 1 ); @@ -442,17 +447,17 @@ BOOLEAN HandleNextTile( SOLDIERTYPE *pSoldier, INT8 bDirection, INT16 sGridNo, I INT16 sOldFinalDest; // Maintain sFinalDest.... - sOldFinalDest = pSoldier->sFinalDestination; + sOldFinalDest = pSoldier->pathing.sFinalDestination; #ifdef JA2BETAVERSION if ( gTacticalStatus.uiFlags & INCOMBAT ) { OutputDebugInfoForTurnBasedNextTileWaiting( pSoldier ); } #endif - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); // Restore... - pSoldier->sFinalDestination = sOldFinalDest; - + pSoldier->pathing.sFinalDestination = sOldFinalDest; + // Setting to two means: try and wait until this tile becomes free.... SetDelayedTileWaiting( pSoldier, sGridNo, 100 ); } @@ -480,7 +485,7 @@ BOOLEAN HandleNextTile( SOLDIERTYPE *pSoldier, INT8 bDirection, INT16 sGridNo, I case ANIM_CROUCH: // Change height to stand - pSoldier->fContinueMoveAfterStanceChange = TRUE; + pSoldier->flags.fContinueMoveAfterStanceChange = TRUE; SendChangeSoldierStanceEvent( pSoldier, ANIM_STAND ); break; } @@ -489,7 +494,7 @@ BOOLEAN HandleNextTile( SOLDIERTYPE *pSoldier, INT8 bDirection, INT16 sGridNo, I // Change to walking if ( pSoldier->usAnimState == RUNNING ) { - ChangeSoldierState( pSoldier, WALKING, 0 , FALSE ); + pSoldier->ChangeSoldierState( WALKING, 0 , FALSE ); } } } @@ -504,17 +509,17 @@ BOOLEAN HandleNextTileWaiting( SOLDIERTYPE *pSoldier ) // Buddy is waiting to continue his path INT8 bBlocked, bPathBlocked; INT16 sCost; - INT16 sNewGridNo, sCheckGridNo; + INT16 sNewGridNo, sCheckGridNo; UINT8 ubDirection, bCauseDirection; UINT8 ubPerson; UINT8 fFlags = 0; - - if ( pSoldier->fDelayedMovement ) + + if ( pSoldier->flags.fDelayedMovement ) { - if ( TIMECOUNTERDONE( pSoldier->NextTileCounter, NEXT_TILE_CHECK_DELAY ) ) + if ( TIMECOUNTERDONE( pSoldier->timeCounters.NextTileCounter, NEXT_TILE_CHECK_DELAY ) ) { - RESETTIMECOUNTER( pSoldier->NextTileCounter, NEXT_TILE_CHECK_DELAY ); + RESETTIMECOUNTER( pSoldier->timeCounters.NextTileCounter, NEXT_TILE_CHECK_DELAY ); // ATE: Allow path to exit grid! if ( pSoldier->ubWaitActionToDo == 1 && gubWaitingForAllMercsToExitCode == WAIT_FOR_MERCS_TO_WALK_TO_GRIDNO ) @@ -525,20 +530,20 @@ BOOLEAN HandleNextTileWaiting( SOLDIERTYPE *pSoldier ) // Get direction from gridno... bCauseDirection = (INT8)GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, pSoldier->sDelayedMovementCauseGridNo ); - bBlocked = TileIsClear( pSoldier, bCauseDirection, pSoldier->sDelayedMovementCauseGridNo, pSoldier->bLevel ); + bBlocked = TileIsClear( pSoldier, bCauseDirection, pSoldier->sDelayedMovementCauseGridNo, pSoldier->pathing.bLevel ); // If we are waiting for a temp blockage.... continue to wait - if ( pSoldier->fDelayedMovement >= 100 && bBlocked == MOVE_TILE_TEMP_BLOCKED ) + if ( pSoldier->flags.fDelayedMovement >= 100 && bBlocked == MOVE_TILE_TEMP_BLOCKED ) { // ATE: Increment 1 - pSoldier->fDelayedMovement++; + pSoldier->flags.fDelayedMovement++; // Are we close enough to give up? ( and are a pc ) - if ( pSoldier->fDelayedMovement > 120 ) + if ( pSoldier->flags.fDelayedMovement > 120 ) { // Quit... SetFinalTile( pSoldier, pSoldier->sGridNo, TRUE ); - pSoldier->fDelayedMovement = FALSE; + pSoldier->flags.fDelayedMovement = FALSE; } gfPlotPathToExitGrid = FALSE; return( TRUE ); @@ -548,9 +553,9 @@ BOOLEAN HandleNextTileWaiting( SOLDIERTYPE *pSoldier ) if ( bBlocked != MOVE_TILE_TEMP_BLOCKED ) { // Set to normal delay - if ( pSoldier->fDelayedMovement >= 100 && pSoldier->fDelayedMovement != 150 ) + if ( pSoldier->flags.fDelayedMovement >= 100 && pSoldier->flags.fDelayedMovement != 150 ) { - pSoldier->fDelayedMovement = 1; + pSoldier->flags.fDelayedMovement = 1; } // Default to pathing through people @@ -560,77 +565,76 @@ BOOLEAN HandleNextTileWaiting( SOLDIERTYPE *pSoldier ) // Use other flag // CJC: path-through-people includes ignoring person at dest /* - if ( pSoldier->fDelayedMovement >= 150 ) + if ( pSoldier->flags.fDelayedMovement >= 150 ) { fFlags = PATH_IGNORE_PERSON_AT_DEST; } */ // Check destination first! - if ( pSoldier->sAbsoluteFinalDestination == pSoldier->sFinalDestination ) + if ( pSoldier->sAbsoluteFinalDestination == pSoldier->pathing.sFinalDestination ) { // on last lap of scripted move, make sure we get to final dest - sCheckGridNo = pSoldier->sAbsoluteFinalDestination; + sCheckGridNo = pSoldier->sAbsoluteFinalDestination; } - else if (!NewOKDestination( pSoldier, pSoldier->sFinalDestination, TRUE, pSoldier->bLevel )) + else if (!NewOKDestination( pSoldier, pSoldier->pathing.sFinalDestination, TRUE, pSoldier->pathing.bLevel )) { - if ( pSoldier->fDelayedMovement >= 150 ) + if ( pSoldier->flags.fDelayedMovement >= 150 ) { // OK, look around dest for the first one! - sCheckGridNo = FindGridNoFromSweetSpot( pSoldier, pSoldier->sFinalDestination, 6, &ubDirection ); + sCheckGridNo = FindGridNoFromSweetSpot( pSoldier, pSoldier->pathing.sFinalDestination, 6, &ubDirection ); if ( sCheckGridNo == NOWHERE ) { // If this is nowhere, try harder! - sCheckGridNo = FindGridNoFromSweetSpot( pSoldier, pSoldier->sFinalDestination, 16, &ubDirection ); + sCheckGridNo = FindGridNoFromSweetSpot( pSoldier, pSoldier->pathing.sFinalDestination, 16, &ubDirection ); } } else { // OK, look around dest for the first one! - sCheckGridNo = FindGridNoFromSweetSpotThroughPeople( pSoldier, pSoldier->sFinalDestination, 6, &ubDirection ); + sCheckGridNo = FindGridNoFromSweetSpotThroughPeople( pSoldier, pSoldier->pathing.sFinalDestination, 6, &ubDirection ); if ( sCheckGridNo == NOWHERE ) { // If this is nowhere, try harder! - sCheckGridNo = FindGridNoFromSweetSpotThroughPeople( pSoldier, pSoldier->sFinalDestination, 16, &ubDirection ); + sCheckGridNo = FindGridNoFromSweetSpotThroughPeople( pSoldier, pSoldier->pathing.sFinalDestination, 16, &ubDirection ); } } } else { - sCheckGridNo = pSoldier->sFinalDestination; + sCheckGridNo = pSoldier->pathing.sFinalDestination; } - sCost = (INT16) FindBestPath( pSoldier, sCheckGridNo, pSoldier->bLevel, pSoldier->usUIMovementMode, NO_COPYROUTE, fFlags ); - + sCost = (INT16) FindBestPath( pSoldier, sCheckGridNo, pSoldier->pathing.bLevel, pSoldier->usUIMovementMode, NO_COPYROUTE, fFlags ); + // Can we get there if ( sCost > 0 ) { // Is the next tile blocked too? - sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( (UINT8)guiPathingData[ 0 ] ) ); + sNewGridNo = NewGridNo( (INT16)pSoldier->sGridNo, DirectionInc( (UINT8)guiPathingData[ 0 ] ) ); - bPathBlocked = TileIsClear( pSoldier, (UINT8)guiPathingData[ 0 ], sNewGridNo, pSoldier->bLevel ); + bPathBlocked = TileIsClear( pSoldier, (UINT8)guiPathingData[ 0 ], sNewGridNo, pSoldier->pathing.bLevel ); if ( bPathBlocked == MOVE_TILE_STATIONARY_BLOCKED ) { // Try to path around everyone except dest person - sCost = (INT16) FindBestPath( pSoldier, sCheckGridNo, pSoldier->bLevel, pSoldier->usUIMovementMode, NO_COPYROUTE, PATH_IGNORE_PERSON_AT_DEST ); + sCost = (INT16) FindBestPath( pSoldier, sCheckGridNo, pSoldier->pathing.bLevel, pSoldier->usUIMovementMode, NO_COPYROUTE, PATH_IGNORE_PERSON_AT_DEST ); // Is the next tile in this new path blocked too? - sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( (UINT8)guiPathingData[ 0 ] ) ); + sNewGridNo = NewGridNo( (INT16)pSoldier->sGridNo, DirectionInc( (UINT8)guiPathingData[ 0 ] ) ); - bPathBlocked = TileIsClear( pSoldier, (UINT8)guiPathingData[ 0 ], sNewGridNo, pSoldier->bLevel ); + bPathBlocked = TileIsClear( pSoldier, (UINT8)guiPathingData[ 0 ], sNewGridNo, pSoldier->pathing.bLevel ); - // now working with a path which does not go through people + // now working with a path which does not go through people pSoldier->ubDelayedMovementFlags &= (~DELAYED_MOVEMENT_FLAG_PATH_THROUGH_PEOPLE); - } else { // path through people worked fine - if ( pSoldier->fDelayedMovement < 150 ) + if ( pSoldier->flags.fDelayedMovement < 150 ) { pSoldier->ubDelayedMovementFlags |= DELAYED_MOVEMENT_FLAG_PATH_THROUGH_PEOPLE; } @@ -639,92 +643,92 @@ BOOLEAN HandleNextTileWaiting( SOLDIERTYPE *pSoldier ) // Are we clear? if ( bPathBlocked == MOVE_TILE_CLEAR ) { - //pSoldier->fDelayedMovement = FALSE; + //pSoldier->flags.fDelayedMovement = FALSE; // ATE: THis will get set in EENT_GetNewSoldierPath.... - pSoldier->usActionData = sCheckGridNo; + pSoldier->aiData.usActionData = sCheckGridNo; - pSoldier->bPathStored = FALSE; - - EVENT_GetNewSoldierPath( pSoldier, sCheckGridNo, pSoldier->usUIMovementMode ); + pSoldier->pathing.bPathStored = FALSE; + pSoldier->EVENT_GetNewSoldierPath( sCheckGridNo, pSoldier->usUIMovementMode ); gfPlotPathToExitGrid = FALSE; + return( TRUE ); } } - pSoldier->fDelayedMovement++; + pSoldier->flags.fDelayedMovement++; - if ( pSoldier->fDelayedMovement == 99 ) + if ( pSoldier->flags.fDelayedMovement == 99 ) { // Cap at 99 - pSoldier->fDelayedMovement = 99; + pSoldier->flags.fDelayedMovement = 99; } // Do we want to force a swap? - if (pSoldier->fDelayedMovement == 3 && (pSoldier->sAbsoluteFinalDestination != NOWHERE || gTacticalStatus.fAutoBandageMode) ) + if (pSoldier->flags.fDelayedMovement == 3 && (pSoldier->sAbsoluteFinalDestination != NOWHERE || gTacticalStatus.fAutoBandageMode) ) { // with person who is in the way? - ubPerson = WhoIsThere2( pSoldier->sDelayedMovementCauseGridNo, pSoldier->bLevel ); + ubPerson = WhoIsThere2( pSoldier->sDelayedMovementCauseGridNo, pSoldier->pathing.bLevel ); // if either on a mission from god, or two AI guys not on stationary... - if ( ubPerson != NOBODY && ( pSoldier->ubQuoteRecord != 0 || ( pSoldier->bTeam != gbPlayerNum && pSoldier->bOrders != STATIONARY && MercPtrs[ ubPerson ]->bTeam != gbPlayerNum && MercPtrs[ ubPerson ]->bOrders != STATIONARY ) || (pSoldier->bTeam == gbPlayerNum && gTacticalStatus.fAutoBandageMode && !(MercPtrs[ ubPerson ]->bTeam == CIV_TEAM && MercPtrs[ ubPerson ]->bOrders == STATIONARY ) ) ) ) - { + if ( ubPerson != NOBODY && ( pSoldier->ubQuoteRecord != 0 || ( pSoldier->bTeam != gbPlayerNum && pSoldier->aiData.bOrders != STATIONARY && MercPtrs[ ubPerson ]->bTeam != gbPlayerNum && MercPtrs[ ubPerson ]->aiData.bOrders != STATIONARY ) || (pSoldier->bTeam == gbPlayerNum && gTacticalStatus.fAutoBandageMode && !(MercPtrs[ ubPerson ]->bTeam == CIV_TEAM && MercPtrs[ ubPerson ]->aiData.bOrders == STATIONARY ) ) ) ) + { // Swap now! - //MercPtrs[ ubPerson ]->fBlockedByAnotherMerc = FALSE; + //MercPtrs[ ubPerson ]->flags.fBlockedByAnotherMerc = FALSE; // Restore final dest.... - //MercPtrs[ ubPerson ]->sFinalDestination = sTempDestGridNo; + //MercPtrs[ ubPerson ]->pathing.sFinalDestination = sTempDestGridNo; // Swap merc positions..... SwapMercPositions( pSoldier, MercPtrs[ ubPerson ] ); - - // With these two guys swapped, we should try to continue on our way.... - pSoldier->fDelayedMovement = FALSE; + + // With these two guys swapped, we should try to continue on our way.... + pSoldier->flags.fDelayedMovement = FALSE; // We must calculate the path here so that we can give it the "through people" parameter if ( gTacticalStatus.fAutoBandageMode && pSoldier->sAbsoluteFinalDestination == NOWHERE ) { - FindBestPath( pSoldier, pSoldier->sFinalDestination, pSoldier->bLevel, pSoldier->usUIMovementMode, COPYROUTE, PATH_THROUGH_PEOPLE ); + FindBestPath( pSoldier, pSoldier->pathing.sFinalDestination, pSoldier->pathing.bLevel, pSoldier->usUIMovementMode, COPYROUTE, PATH_THROUGH_PEOPLE ); } - else if ( pSoldier->sAbsoluteFinalDestination != NOWHERE && !FindBestPath( pSoldier, pSoldier->sAbsoluteFinalDestination, pSoldier->bLevel, pSoldier->usUIMovementMode, COPYROUTE, PATH_THROUGH_PEOPLE ) ) + else if ( pSoldier->sAbsoluteFinalDestination != NOWHERE && !FindBestPath( pSoldier, pSoldier->sAbsoluteFinalDestination, pSoldier->pathing.bLevel, pSoldier->usUIMovementMode, COPYROUTE, PATH_THROUGH_PEOPLE ) ) { // check to see if we're there now! if ( pSoldier->sGridNo == pSoldier->sAbsoluteFinalDestination ) { NPCReachedDestination( pSoldier, FALSE ); - pSoldier->bNextAction = AI_ACTION_WAIT; - pSoldier->usNextActionData = 500; + pSoldier->aiData.bNextAction = AI_ACTION_WAIT; + pSoldier->aiData.usNextActionData = 500; gfPlotPathToExitGrid = FALSE; return( TRUE ); } } - pSoldier->bPathStored = TRUE; + pSoldier->pathing.bPathStored = TRUE; - EVENT_GetNewSoldierPath( pSoldier, pSoldier->sAbsoluteFinalDestination, pSoldier->usUIMovementMode ); - //EVENT_GetNewSoldierPath( MercPtrs[ ubPerson ], MercPtrs[ ubPerson ]->sFinalDestination, MercPtrs[ ubPerson ]->usUIMovementMode ); + pSoldier->EVENT_GetNewSoldierPath( pSoldier->sAbsoluteFinalDestination, pSoldier->usUIMovementMode ); + //EVENT_GetNewSoldierPath( MercPtrs[ ubPerson ], MercPtrs[ ubPerson ]->pathing.sFinalDestination, MercPtrs[ ubPerson ]->usUIMovementMode ); } } // Are we close enough to give up? ( and are a pc ) - if ( pSoldier->fDelayedMovement > 20 && pSoldier->fDelayedMovement != 150) + if ( pSoldier->flags.fDelayedMovement > 20 && pSoldier->flags.fDelayedMovement != 150) { - if ( PythSpacesAway( pSoldier->sGridNo, pSoldier->sFinalDestination ) < 5 && pSoldier->bTeam == gbPlayerNum ) + if ( PythSpacesAway( pSoldier->sGridNo, pSoldier->pathing.sFinalDestination ) < 5 && pSoldier->bTeam == gbPlayerNum ) { // Quit... SetFinalTile( pSoldier, pSoldier->sGridNo, FALSE ); - pSoldier->fDelayedMovement = FALSE; + pSoldier->flags.fDelayedMovement = FALSE; } } // Are we close enough to give up? ( and are a pc ) - if ( pSoldier->fDelayedMovement > 170 ) + if ( pSoldier->flags.fDelayedMovement > 170 ) { - if ( PythSpacesAway( pSoldier->sGridNo, pSoldier->sFinalDestination ) < 5 && pSoldier->bTeam == gbPlayerNum ) + if ( PythSpacesAway( pSoldier->sGridNo, pSoldier->pathing.sFinalDestination ) < 5 && pSoldier->bTeam == gbPlayerNum ) { // Quit... SetFinalTile( pSoldier, pSoldier->sGridNo, FALSE ); - pSoldier->fDelayedMovement = FALSE; + pSoldier->flags.fDelayedMovement = FALSE; } } @@ -747,21 +751,21 @@ BOOLEAN TeleportSoldier( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fForce ) // TELEPORT TO THIS LOCATION! sX = CenterX( sGridNo ); sY = CenterY( sGridNo ); - EVENT_SetSoldierPosition( pSoldier, (FLOAT) sX, (FLOAT) sY ); + pSoldier->EVENT_SetSoldierPosition( (FLOAT) sX, (FLOAT) sY ); - pSoldier->sFinalDestination = sGridNo; + pSoldier->pathing.sFinalDestination = sGridNo; // Make call to FOV to update items... - RevealRoofsAndItems(pSoldier, TRUE, TRUE, pSoldier->bLevel, TRUE ); - + RevealRoofsAndItems(pSoldier, TRUE, TRUE, pSoldier->pathing.bLevel, TRUE ); + // Handle sight! HandleSight(pSoldier,SIGHT_LOOK | SIGHT_RADIO); // Cancel services... - GivingSoldierCancelServices( pSoldier ); + pSoldier->GivingSoldierCancelServices( ); // Change light.... - if ( pSoldier->bLevel == 0 ) + if ( pSoldier->pathing.bLevel == 0 ) { if(pSoldier->iLight!=(-1)) LightSpriteRoofStatus(pSoldier->iLight, FALSE ); @@ -787,8 +791,8 @@ void SwapMercPositions( SOLDIERTYPE *pSoldier1, SOLDIERTYPE *pSoldier2 ) sGridNo2 = pSoldier2->sGridNo; // OK, remove each..... - RemoveSoldierFromGridNo( pSoldier1 ); - RemoveSoldierFromGridNo( pSoldier2 ); + pSoldier1->RemoveSoldierFromGridNo( ); + pSoldier2->RemoveSoldierFromGridNo( ); // OK, test OK destination for each....... if ( NewOKDestination( pSoldier1, sGridNo2, TRUE, 0 ) && NewOKDestination( pSoldier2, sGridNo1, TRUE, 0 ) ) @@ -808,9 +812,9 @@ void SwapMercPositions( SOLDIERTYPE *pSoldier1, SOLDIERTYPE *pSoldier2 ) BOOLEAN CanExchangePlaces( SOLDIERTYPE *pSoldier1, SOLDIERTYPE *pSoldier2, BOOLEAN fShow ) { - // NB checks outside of this function + // NB checks outside of this function if ( EnoughPoints( pSoldier1, AP_EXCHANGE_PLACES, 0, fShow ) ){ - if ( EnoughPoints( pSoldier2, AP_EXCHANGE_PLACES, 0, fShow ) ){ + if ( EnoughPoints( pSoldier2, AP_EXCHANGE_PLACES, 0, fShow ) ){ if ( ( gAnimControl[ pSoldier2->usAnimState ].uiFlags & ANIM_MOVING ) ) return( FALSE ); @@ -818,33 +822,33 @@ BOOLEAN CanExchangePlaces( SOLDIERTYPE *pSoldier1, SOLDIERTYPE *pSoldier2, BOOLE return( FALSE ); if ( pSoldier2->bSide == 0 ) - return( TRUE ); + return( TRUE ); // hehe - don't allow animals to exchange places - if ( pSoldier2->uiStatusFlags & ( SOLDIER_ANIMAL ) ) + if ( pSoldier2->flags.uiStatusFlags & ( SOLDIER_ANIMAL ) ) return( FALSE ); // must NOT be hostile, must NOT have stationary orders OR militia team, must be >= OKLIFE - if( pSoldier2->bNeutral && pSoldier2->bLife >= OKLIFE && - pSoldier2->ubCivilianGroup != HICKS_CIV_GROUP && - ( ( pSoldier2->bOrders != STATIONARY || pSoldier2->bTeam == MILITIA_TEAM ) || + if( pSoldier2->aiData.bNeutral && pSoldier2->stats.bLife >= OKLIFE && + pSoldier2->ubCivilianGroup != HICKS_CIV_GROUP && + ( ( pSoldier2->aiData.bOrders != STATIONARY || pSoldier2->bTeam == MILITIA_TEAM ) || ( pSoldier2->sAbsoluteFinalDestination != NOWHERE && pSoldier2->sAbsoluteFinalDestination != pSoldier2->sGridNo ) ) - ) + ) return( TRUE ); if ( fShow ){ if ( pSoldier2->ubProfile == NO_PROFILE ) - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ REFUSE_EXCHANGE_PLACES ] ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ REFUSE_EXCHANGE_PLACES ] ); else - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, gzLateLocalizedString[3], pSoldier2->name ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, gzLateLocalizedString[3], pSoldier2->name ); } // ATE: OK, reduce this guy's next ai counter.... pSoldier2->uiAIDelay = 100; return( FALSE ); - }else{ - return( FALSE ); - } + }else{ + return( FALSE ); + } } // if SirTech wouldn't setup your nested if statements so messily then perhaps wierd code like this // could be avoided... cleaned up the ifs too (jonathanl) diff --git a/Tactical/Soldier macros.h b/Tactical/Soldier macros.h index cedf4f7d..7a81fc70 100644 --- a/Tactical/Soldier macros.h +++ b/Tactical/Soldier macros.h @@ -15,21 +15,21 @@ #define AM_A_ROBOT( p ) ( ( p->ubProfile == NO_PROFILE ) ? FALSE : ( gMercProfiles[ p->ubProfile ].ubBodyType == ROBOTNOWEAPON ) ) -#define OK_ENEMY_MERC( p ) ( !p->bNeutral && (p->bSide != gbPlayerNum ) && p->bLife >= OKLIFE ) +#define OK_ENEMY_MERC( p ) ( !p->aiData.bNeutral && (p->bSide != gbPlayerNum ) && p->stats.bLife >= OKLIFE ) // Checks if our guy can be controllable .... checks bInSector, team, on duty, etc... -#define OK_CONTROLLABLE_MERC( p ) ( p->bLife >= OKLIFE && p->bActive && p->bInSector && p->bTeam == gbPlayerNum && p->bAssignment < ON_DUTY ) +#define OK_CONTROLLABLE_MERC( p ) ( p->stats.bLife >= OKLIFE && p->bActive && p->bInSector && p->bTeam == gbPlayerNum && p->bAssignment < ON_DUTY ) // Checks if our guy can be controllable .... checks bInSector, team, on duty, etc... -#define OK_INSECTOR_MERC( p ) ( p->bLife >= OKLIFE && p->bActive && p->bInSector && p->bTeam == gbPlayerNum && p->bAssignment < ON_DUTY ) +#define OK_INSECTOR_MERC( p ) ( p->stats.bLife >= OKLIFE && p->bActive && p->bInSector && p->bTeam == gbPlayerNum && p->bAssignment < ON_DUTY ) // Checkf if our guy can be selected and is not in a position where our team has an interupt and he does not have one... -#define OK_INTERRUPT_MERC( p ) ( ( INTERRUPT_QUEUED != 0 ) ? ( ( p->bMoved ) ? FALSE : TRUE ) : TRUE ) +#define OK_INTERRUPT_MERC( p ) ( ( INTERRUPT_QUEUED != 0 ) ? ( ( p->aiData.bMoved ) ? FALSE : TRUE ) : TRUE ) -#define CREATURE_OR_BLOODCAT( p ) ( (p->uiStatusFlags & SOLDIER_MONSTER) || p->ubBodyType == BLOODCAT ) +#define CREATURE_OR_BLOODCAT( p ) ( (p->flags.uiStatusFlags & SOLDIER_MONSTER) || p->ubBodyType == BLOODCAT ) #define TANK( p ) (p->ubBodyType == TANK_NE || p->ubBodyType == TANK_NW ) -#define OK_ENTERABLE_VEHICLE( p ) ( ( p->uiStatusFlags & SOLDIER_VEHICLE ) && !TANK( p ) && p->bLife >= OKLIFE ) +#define OK_ENTERABLE_VEHICLE( p ) ( ( p->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !TANK( p ) && p->stats.bLife >= OKLIFE ) #endif \ No newline at end of file diff --git a/Tactical/SoldierTooltips.cpp b/Tactical/SoldierTooltips.cpp index cf4c06c6..58295fb3 100644 --- a/Tactical/SoldierTooltips.cpp +++ b/Tactical/SoldierTooltips.cpp @@ -3,7 +3,7 @@ #else #include "Types.h" #include "Windows.h" -#include "Soldier Control.h" +//#include "Soldier Control.h" #include "Input.h" #include "english.h" #include "Isometric Utils.h" @@ -22,8 +22,13 @@ #include "line.h" #endif -struct MOUSETT -{ +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + +struct MOUSETT +{ CHAR16 FastHelpText[ 1024 ]; INT32 iX; INT32 iY; @@ -44,10 +49,10 @@ void DrawMouseTooltip(void); #define MAX(a, b) (a > b ? a : b) void SoldierTooltip( SOLDIERTYPE* pSoldier ) -{ +{ SGPRect aRect; extern void GetSoldierScreenRect(SOLDIERTYPE*,SGPRect*); - GetSoldierScreenRect( pSoldier, &aRect ); + GetSoldierScreenRect( pSoldier, &aRect ); INT16 a1,a2; BOOLEAN fDrawTooltip = FALSE; @@ -57,7 +62,7 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) MOUSETT *pRegion = &mouseTT; CHAR16 pStrInfo[ sizeof( pRegion->FastHelpText ) ]; int iNVG = 0; - UINT16 usSoldierGridNo; + INT16 sSoldierGridNo; BOOLEAN fDisplayBigSlotItem = FALSE; BOOLEAN fMercIsUsingScope = FALSE; UINT16 iCarriedRL = 0; @@ -68,12 +73,14 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) fDrawTooltip = TRUE; // get the gridno the cursor is at - GetMouseMapPos( &usSoldierGridNo ); + GetMouseMapPos( &sSoldierGridNo ); // get the distance to enemy's tile from the selected merc if ( gusSelectedSoldier != NOBODY ) - { - iRangeToTarget = GetRangeInCellCoordsFromGridNoDiff( MercPtrs[ gusSelectedSoldier ]->sGridNo, usSoldierGridNo ) / 10; + { + //CHRISL: Changed the second parameter to use the same information as the 'F' hotkey uses. + //iRangeToTarget = GetRangeInCellCoordsFromGridNoDiff( MercPtrs[ gusSelectedSoldier ]->sGridNo, sSoldierGridNo ) / 10; + iRangeToTarget = GetRangeInCellCoordsFromGridNoDiff( MercPtrs[ gusSelectedSoldier ]->sGridNo, MercPtrs[ gusUIFullTargetID ]->sGridNo ) / 10; } // WANNE: If we want to show the tooltip of milita and no merc is present in the sector else @@ -82,10 +89,10 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) } if ( gGameExternalOptions.fEnableDynamicSoldierTooltips ) - { - for ( INT32 cnt = 0; cnt < MAX_ATTACHMENTS; cnt++ ) - { - if ( Item[MercPtrs[gusSelectedSoldier]->inv[HANDPOS].usAttachItem[cnt]].visionrangebonus > 0 ) + { + OBJECTTYPE* pObject = &(MercPtrs[gusSelectedSoldier]->inv[HANDPOS]); + for (attachmentList::iterator iter = (*pObject)[0]->attachments.begin(); iter != (*pObject)[0]->attachments.end(); ++iter) { + if ( Item[iter->usItem].visionrangebonus > 0 ) { fMercIsUsingScope = TRUE; break; @@ -100,14 +107,14 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) else { // add 10% to max tooltip viewing distance per level of the merc - uiMaxTooltipDistance *= 1 + (MercPtrs[ gusSelectedSoldier ]->bExpLevel / 10); + uiMaxTooltipDistance *= 1 + (MercPtrs[ gusSelectedSoldier ]->stats.bExpLevel / 10); if ( gGameExternalOptions.gfAllowLimitedVision ) uiMaxTooltipDistance *= 1 - (gGameExternalOptions.ubVisDistDecreasePerRainIntensity / 100); if ( !(Item[MercPtrs[gusSelectedSoldier]->inv[HEAD1POS].usItem].nightvisionrangebonus > 0) && - !(Item[MercPtrs[gusSelectedSoldier]->inv[HEAD2POS].usItem].nightvisionrangebonus > 0) && - !DayTime() ) + !(Item[MercPtrs[gusSelectedSoldier]->inv[HEAD2POS].usItem].nightvisionrangebonus > 0) && + !DayTime() ) { // if night reduce max tooltip viewing distance by a factor of 4 if merc is not wearing NVG uiMaxTooltipDistance >>= 2; @@ -138,8 +145,8 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) { // Get the current selected merc SOLDIERTYPE* pMerc = MercPtrs[ gusSelectedSoldier ]; - - if ( pMerc->bOppList[pSoldier->ubID] != SEEN_CURRENTLY ) + + if ( pMerc->aiData.bOppList[pSoldier->ubID] != SEEN_CURRENTLY ) { // We do not see the enemy. Return and do not display the tooltip. return; @@ -151,21 +158,21 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) { // display "debug" info if ( gGameExternalOptions.fEnableSoldierTooltipLocation ) - swprintf( pStrInfo, gzTooltipStrings[STR_TT_CAT_LOCATION], pStrInfo, usSoldierGridNo ); + swprintf( pStrInfo, gzTooltipStrings[STR_TT_CAT_LOCATION], pStrInfo, sSoldierGridNo ); if ( gGameExternalOptions.fEnableSoldierTooltipBrightness ) - swprintf( pStrInfo, gzTooltipStrings[STR_TT_CAT_BRIGHTNESS], pStrInfo, SHADE_MIN - LightTrueLevel( usSoldierGridNo, gsInterfaceLevel ), SHADE_MIN ); + swprintf( pStrInfo, gzTooltipStrings[STR_TT_CAT_BRIGHTNESS], pStrInfo, SHADE_MIN - LightTrueLevel( sSoldierGridNo, gsInterfaceLevel ), SHADE_MIN ); if ( gGameExternalOptions.fEnableSoldierTooltipRangeToTarget ) swprintf( pStrInfo, gzTooltipStrings[STR_TT_CAT_RANGE_TO_TARGET], pStrInfo, iRangeToTarget ); if ( gGameExternalOptions.fEnableSoldierTooltipID ) swprintf( pStrInfo, gzTooltipStrings[STR_TT_CAT_ID], pStrInfo, pSoldier->ubID ); if ( gGameExternalOptions.fEnableSoldierTooltipOrders ) - swprintf( pStrInfo, gzTooltipStrings[STR_TT_CAT_ORDERS], pStrInfo, pSoldier->bOrders ); + swprintf( pStrInfo, gzTooltipStrings[STR_TT_CAT_ORDERS], pStrInfo, pSoldier->aiData.bOrders ); if ( gGameExternalOptions.fEnableSoldierTooltipAttitude ) - swprintf( pStrInfo, gzTooltipStrings[STR_TT_CAT_ATTITUDE], pStrInfo, pSoldier->bAttitude ); + swprintf( pStrInfo, gzTooltipStrings[STR_TT_CAT_ATTITUDE], pStrInfo, pSoldier->aiData.bAttitude ); if ( gGameExternalOptions.fEnableSoldierTooltipActionPoints ) swprintf( pStrInfo, gzTooltipStrings[STR_TT_CAT_CURRENT_APS], pStrInfo, pSoldier->bActionPoints ); if ( gGameExternalOptions.fEnableSoldierTooltipHealth ) - swprintf( pStrInfo, gzTooltipStrings[STR_TT_CAT_CURRENT_HEALTH], pStrInfo, pSoldier->bLife ); + swprintf( pStrInfo, gzTooltipStrings[STR_TT_CAT_CURRENT_HEALTH], pStrInfo, pSoldier->stats.bLife ); } // armor info code block start @@ -266,9 +273,9 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) // weapon in off hand info code block end // large objects in big inventory slots info code block start - for ( UINT8 BigSlot = BIGPOCK1POS; BigSlot <= BIGPOCK4POS; BigSlot++ ) + for ( UINT8 BigSlot = BIGPOCKSTART; BigSlot < BIGPOCKFINAL; BigSlot++ ) { - if ( pSoldier->inv[ BigSlot ].usItem == 0 ) + if ( pSoldier->inv[ BigSlot ].exists() == false ) continue; // slot is empty, move on to the next slot switch( BigSlot ) @@ -285,22 +292,35 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) case BIGPOCK3POS: if ( !gGameExternalOptions.fEnableSoldierTooltipBigSlot3 ) continue; - break; + break; case BIGPOCK4POS: if ( !gGameExternalOptions.fEnableSoldierTooltipBigSlot4 ) continue; break; +// CHRISL: Added new large pockets introduced by new inventory system + case BIGPOCK5POS: + if ( !gGameExternalOptions.fEnableSoldierTooltipBigSlot5 ) + continue; + break; + case BIGPOCK6POS: + if ( !gGameExternalOptions.fEnableSoldierTooltipBigSlot6 ) + continue; + break; + case BIGPOCK7POS: + if ( !gGameExternalOptions.fEnableSoldierTooltipBigSlot7 ) + continue; + break; } if ( Item[ pSoldier->inv[ BigSlot ].usItem ].rocketlauncher ) iCarriedRL = pSoldier->inv[ BigSlot ].usItem; // remember that enemy is carrying a rocket launcher when check for rocket ammo is made later on - if ( ( Item[ pSoldier->inv[ BigSlot ].usItem ].usItemClass == IC_LAUNCHER ) || - ( Item[ pSoldier->inv[ BigSlot ].usItem ].usItemClass == IC_GUN ) ) + if ( ( Item[ pSoldier->inv[ BigSlot ].usItem ].usItemClass == IC_LAUNCHER ) || + ( Item[ pSoldier->inv[ BigSlot ].usItem ].usItemClass == IC_GUN ) ) { // it's a firearm if ( ( Weapon[pSoldier->inv[ BigSlot ].usItem].ubWeaponClass != HANDGUNCLASS ) && - ( Weapon[pSoldier->inv[ BigSlot ].usItem].ubWeaponClass != SMGCLASS ) ) + ( Weapon[pSoldier->inv[ BigSlot ].usItem].ubWeaponClass != SMGCLASS ) ) { // it's a long gun or heavy weapon fDisplayBigSlotItem = TRUE; @@ -310,7 +330,7 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) { // check for rocket ammo if ( ( iCarriedRL != 0 ) && // soldier is carrying a RL ... - ValidLaunchable( pSoldier->inv[ BigSlot ].usItem, iCarriedRL ) ) // this item is launchable by the RL + ValidLaunchable( pSoldier->inv[ BigSlot ].usItem, iCarriedRL ) ) // this item is launchable by the RL { fDisplayBigSlotItem = TRUE; } @@ -325,7 +345,7 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) // large objects in big inventory slots info code block end pRegion->iX = gusMouseXPos; - pRegion->iY = gusMouseYPos; + pRegion->iY = gusMouseYPos; // if ( gGameExternalOptions.ubSoldierTooltipDetailLevel == DL_Debug ) // swprintf( pRegion->FastHelpText, L"%s\n|String |Length|: %d", pStrInfo, wcslen(pStrInfo) ); @@ -393,34 +413,30 @@ void DisplayWeaponInfo( SOLDIERTYPE* pSoldier, CHAR16* pStrInfo, UINT8 ubSlot, U if ( gGameExternalOptions.ubSoldierTooltipDetailLevel >= DL_Basic ) { // display weapon attachments - for ( INT32 cnt = 0; cnt < MAX_ATTACHMENTS; cnt++ ) - { - if ( pSoldier->inv[ubSlot].usAttachItem[ cnt ] != NOTHING ) - { - if ( ubTooltipDetailLevel == DL_Basic ) + for (attachmentList::iterator iter = pSoldier->inv[ubSlot][0]->attachments.begin(); iter != pSoldier->inv[ubSlot][0]->attachments.end(); ++iter) { + if ( ubTooltipDetailLevel == DL_Basic ) + { + // display only externally-visible weapon attachments + if ( !Item[iter->usItem].hiddenattachment ) { - // display only externally-visible weapon attachments - if ( !Item[pSoldier->inv[ubSlot].usAttachItem[ cnt ]].hiddenattachment ) - { - fDisplayAttachment = TRUE; - } + fDisplayAttachment = TRUE; } + } + else + { + // display all weapon attachments + fDisplayAttachment = TRUE; + } + if ( fDisplayAttachment ) + { + iNumAttachments++; + if ( iNumAttachments == 1 ) + wcscat( pStrInfo, L"\n[" ); else - { - // display all weapon attachments - fDisplayAttachment = TRUE; - } - if ( fDisplayAttachment ) - { - iNumAttachments++; - if ( iNumAttachments == 1 ) - wcscat( pStrInfo, L"\n[" ); - else - wcscat( pStrInfo, L", " ); - wcscat( pStrInfo, ItemNames[ pSoldier->inv[ubSlot].usAttachItem[ cnt ] ] ); - fDisplayAttachment = FALSE; // clear flag for next loop iteration - } - } // pSoldier->inv[HANDPOS].usAttachItem[ cnt ] != NOTHING + wcscat( pStrInfo, L", " ); + wcscat( pStrInfo, ItemNames[ iter->usItem ] ); + fDisplayAttachment = FALSE; // clear flag for next loop iteration + } } // for if ( iNumAttachments > 0 ) wcscat( pStrInfo, pMessageStrings[ MSG_END_ATTACHMENT_LIST ] ); // append ' attached]' to end of string @@ -434,11 +450,8 @@ void DrawMouseTooltip() { UINT8 *pDestBuf; UINT32 uiDestPitchBYTES; - UINT16 usFillColor = Get16BPPColor(FROMRGB(250, 240, 188)); - UINT16 usRectColor1 = Get16BPPColor( FROMRGB( 65, 57, 15 ) ); - UINT16 usRectColor2 = Get16BPPColor( FROMRGB( 227, 198, 88 ) ); static INT32 iX, iY, iW, iH; - + extern INT16 GetWidthOfString(const STR16); extern INT16 GetNumberOfLinesInHeight(const STR16); extern void DisplayHelpTokenizedString(const STR16,INT16,INT16); @@ -457,7 +470,7 @@ void DrawMouseTooltip() iY -= (iH / 2); if (gusMouseXPos > (SCREEN_WIDTH / 2)) iX = gusMouseXPos - iW - 24; - else + else iX = gusMouseXPos + 24; //if (gusMouseYPos > (SCREEN_HEIGHT / 2)) // iY -= 32; @@ -466,10 +479,10 @@ void DrawMouseTooltip() } else { //draw in panel - //502,485 658,596 160*110 580,540 + //502,485 658,596 160*110 580,540 iX = 580 - (iW / 2); iY = 540 - (iH/2); - if (iY + iH > SCREEN_HEIGHT) iY = SCREEN_HEIGHT - iH - 3 ; + if (iY + iH > SCREEN_HEIGHT) iY = SCREEN_HEIGHT - iH - 3 ; } pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); @@ -483,7 +496,7 @@ void DrawMouseTooltip() SetFont( FONT10ARIAL ); SetFontShadow( FONT_NEARBLACK ); DisplayHelpTokenizedString( mouseTT.FastHelpText ,( INT16 )( iX + 5 ), ( INT16 )( iY + 5 ) ); - InvalidateRegion( iX, iY, (iX + iW) , (iY + iH) ); + InvalidateRegion( iX, iY, (iX + iW) , (iY + iH) ); //InvalidateScreen(); } \ No newline at end of file diff --git a/Tactical/Spread Burst.cpp b/Tactical/Spread Burst.cpp index 3115e966..c590ab7c 100644 --- a/Tactical/Spread Burst.cpp +++ b/Tactical/Spread Burst.cpp @@ -6,7 +6,7 @@ #include "wcheck.h" #include "stdlib.h" #include "debug.h" - #include "soldier control.h" + //#include "soldier control.h" #include "weapons.h" #include "cursor control.h" #include "cursors.h" @@ -19,6 +19,11 @@ #include "points.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + BURST_LOCATIONS gsBurstLocations[ MAX_BURST_LOCATIONS ]; INT8 gbNumBurstLocations = 0; @@ -55,7 +60,7 @@ void InternalAccumulateBurstLocation( INT16 sGridNo ) } } -//Madd: to add a bit more usefulness to spread fire, I'm making it so that +//Madd: to add a bit more usefulness to spread fire, I'm making it so that //it will automatically latch onto enemies within iSearchRange tiles of the mouse drag. void AccumulateBurstLocation( INT16 sGridNo ) { @@ -71,19 +76,19 @@ void AccumulateBurstLocation( INT16 sGridNo ) if (pTarget) { - InternalAccumulateBurstLocation(sGridNo); - foundTarget = TRUE; + InternalAccumulateBurstLocation(sGridNo); + foundTarget = TRUE; } //let's now look around this square - maybe there are some adjacent enemies we can latch onto // stay away from the edges // determine maximum horizontal limits - sMaxLeft = min( iSearchRange, (sGridNo % MAXCOL)); + sMaxLeft = min( iSearchRange, (sGridNo % MAXCOL)); sMaxRight = min( iSearchRange, MAXCOL - ((sGridNo % MAXCOL) + 1)); // determine maximum vertical limits - sMaxUp = min( iSearchRange, (sGridNo / MAXROW)); + sMaxUp = min( iSearchRange, (sGridNo / MAXROW)); sMaxDown = min( iSearchRange, MAXROW - ((sGridNo / MAXROW) + 1)); // reset the "reachable" flags in the region we're looking at @@ -103,9 +108,9 @@ void AccumulateBurstLocation( INT16 sGridNo ) pTarget = SimpleFindSoldier(sAdjacentGridNo, 1); //try on a roof if (pTarget) - { + { InternalAccumulateBurstLocation(sAdjacentGridNo); //there's somebody there! let's latch onto him - foundTarget = TRUE; + foundTarget = TRUE; } } } @@ -144,7 +149,7 @@ void PickBurstLocations( SOLDIERTYPE *pSoldier ) pSoldier->bDoAutofire++; sAPCosts = CalcTotalAPsToAttack( pSoldier, gsBurstLocations[0].sGridNo, TRUE, 0); } - while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire && gbNumBurstLocations >= pSoldier->bDoAutofire); + while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.gun.ubGunShotsLeft >= pSoldier->bDoAutofire && gbNumBurstLocations >= pSoldier->bDoAutofire); pSoldier->bDoAutofire--; ubShotsPerBurst = pSoldier->bDoAutofire; @@ -165,7 +170,7 @@ void PickBurstLocations( SOLDIERTYPE *pSoldier ) if (ubShotsPerBurst == 1) { - pSoldier->fDoSpread = FALSE; + pSoldier->flags.fDoSpread = FALSE; return; } @@ -299,15 +304,16 @@ void RenderAccumulatedBurstLocations( ) //sXPos -= 10; //sYPos -= 10; - iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, sXPos, sYPos, (INT16)(sXPos +40 ), (INT16)(sYPos + 40 ) ); + iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, sXPos, sYPos, (INT16)(sXPos +40 ), (INT16)(sYPos + 40 ) ); if ( iBack != -1 ) { SetBackgroundRectFilled( iBack ); } - BltVideoObject( FRAME_BUFFER, hVObject, 1, sXPos, sYPos, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( FRAME_BUFFER, hVObject, 1, sXPos, sYPos, VO_BLT_SRCTRANSPARENCY, NULL ); } } } + diff --git a/Tactical/Squads.cpp b/Tactical/Squads.cpp index 49efcb40..aeefeb8c 100644 --- a/Tactical/Squads.cpp +++ b/Tactical/Squads.cpp @@ -32,7 +32,7 @@ typedef struct // squad array SOLDIERTYPE *Squad[ NUMBER_OF_SQUADS ][ NUMBER_OF_SOLDIERS_PER_SQUAD ]; -// list of dead guys for squads...in id values -> -1 means no one home +// list of dead guys for squads...in id values->-1 means no one home INT16 sDeadMercs[ NUMBER_OF_SQUADS ][ NUMBER_OF_SOLDIERS_PER_SQUAD ]; // the movement group ids @@ -64,13 +64,13 @@ void InitSquads( void ) GROUP *pGroup = NULL; // null each list of ptrs. - for( iCounter = 0; iCounter < NUMBER_OF_SQUADS; iCounter++ ) + for( iCounter = 0; iCounter < NUMBER_OF_SQUADS; iCounter++ ) { for( iCounterB =0; iCounterB < NUMBER_OF_SOLDIERS_PER_SQUAD; iCounterB++ ) { - - // squad, soldier - Squad[ iCounter ][ iCounterB ]= NULL; + + // squad, soldier + Squad[ iCounter ][ iCounterB ]= NULL; } @@ -144,14 +144,14 @@ BOOLEAN AddCharacterToSquad( SOLDIERTYPE *pCharacter, INT8 bSquadValue ) } - // ATE: If any vehicle exists in this squad AND we're not set to + // ATE: If any vehicle exists in this squad AND we're not set to // a driver or or passenger, when return false if ( DoesVehicleExistInSquad( bSquadValue ) ) { // We're not allowing anybody to go on a vehicle if they are not passengers! // NB: We obviously need to make sure that REAL passengers have their // flags set before adding them to a squad! - if ( !( pCharacter->uiStatusFlags & ( SOLDIER_PASSENGER | SOLDIER_DRIVER | SOLDIER_VEHICLE ) ) ) + if ( !( pCharacter->flags.uiStatusFlags & ( SOLDIER_PASSENGER | SOLDIER_DRIVER | SOLDIER_VEHICLE ) ) ) { return( FALSE ); } @@ -165,7 +165,7 @@ BOOLEAN AddCharacterToSquad( SOLDIERTYPE *pCharacter, INT8 bSquadValue ) // nope, go away now return( FALSE ); } - + for( bCounter =0; bCounter < NUMBER_OF_SOLDIERS_PER_SQUAD; bCounter++ ) @@ -186,14 +186,14 @@ BOOLEAN AddCharacterToSquad( SOLDIERTYPE *pCharacter, INT8 bSquadValue ) GetLocationOfSquad( &sX, &sY, &bZ, bSquadValue ); // if not same, return false - if( ( pCharacter->sSectorX != sX ) || ( pCharacter -> sSectorY != sY ) ||( pCharacter->bSectorZ != bZ) ) + if( ( pCharacter->sSectorX != sX ) || ( pCharacter->sSectorY != sY ) ||( pCharacter->bSectorZ != bZ) ) { return ( FALSE ); } // remove them RemoveCharacterFromSquads( pCharacter ); -// fBetweenSectors = Squad[ bSquadValue ][ 0 ]->fBetweenSectors; +// fBetweenSectors = Squad[ bSquadValue ][ 0 ]->flags.fBetweenSectors; } else { @@ -204,7 +204,7 @@ BOOLEAN AddCharacterToSquad( SOLDIERTYPE *pCharacter, INT8 bSquadValue ) /* if( fBetweenSectors == TRUE ) { - pCharacter->fBetweenSectors = TRUE; + pCharacter->flags.fBetweenSectors = TRUE; } */ @@ -212,44 +212,44 @@ BOOLEAN AddCharacterToSquad( SOLDIERTYPE *pCharacter, INT8 bSquadValue ) CopyPathOfSquadToCharacter( pCharacter, bSquadValue ); // check if old mvt group - if( pCharacter -> ubGroupID != 0 ) + if( pCharacter->ubGroupID != 0 ) { // in valid group, remove from that group - RemovePlayerFromGroup( pCharacter -> ubGroupID , pCharacter ); + RemovePlayerFromGroup( pCharacter->ubGroupID , pCharacter ); // character not on a reserved group if( ( pCharacter->bAssignment >= ON_DUTY ) && ( pCharacter->bAssignment != VEHICLE ) ) { // get the group from the character - pGroup = GetGroup( pCharacter -> ubGroupID ); - + pGroup = GetGroup( pCharacter->ubGroupID ); + // if valid group, delete it if( pGroup ) { RemoveGroupFromList( pGroup ); } } - + } - - - if( ( pCharacter->bAssignment == VEHICLE ) && ( pCharacter->iVehicleId == iHelicopterVehicleId ) && ( pCharacter-> iVehicleId != -1 ) ) + + + if( ( pCharacter->bAssignment == VEHICLE ) && ( pCharacter->iVehicleId == iHelicopterVehicleId ) && ( pCharacter->iVehicleId != -1 ) ) { - // if creating a new squad from guys exiting the chopper + // if creating a new squad from guys exiting the chopper fNewSquad = SquadIsEmpty( bSquadValue ); RemoveSoldierFromHelicopter( pCharacter ); - AddPlayerToGroup( SquadMovementGroups[ bSquadValue ], pCharacter ); + AddPlayerToGroup( SquadMovementGroups[ bSquadValue ], pCharacter ); SetGroupSectorValue( pCharacter->sSectorX, pCharacter->sSectorY, pCharacter->bSectorZ, SquadMovementGroups[ bSquadValue ] ); - pCharacter -> ubGroupID = SquadMovementGroups[ bSquadValue ]; + pCharacter->ubGroupID = SquadMovementGroups[ bSquadValue ]; // if we've just started a new squad if ( fNewSquad ) { - // set mvt group for + // set mvt group for GROUP *pGroup; // grab group @@ -258,38 +258,38 @@ BOOLEAN AddCharacterToSquad( SOLDIERTYPE *pCharacter, INT8 bSquadValue ) if( pGroup ) { - // set where it is and where it's going, then make it arrive there. Don't check for battle + // set where it is and where it's going, then make it arrive there. Don't check for battle PlaceGroupInSector( SquadMovementGroups[ bSquadValue ], pGroup->ubPrevX, pGroup->ubPrevY, pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubSectorZ, FALSE ); } } } - else if( ( pCharacter->bAssignment == VEHICLE ) && ( pCharacter-> iVehicleId != -1 ) ) + else if( ( pCharacter->bAssignment == VEHICLE ) && ( pCharacter->iVehicleId != -1 ) ) { fExitingVehicleToSquad = TRUE; // remove from vehicle TakeSoldierOutOfVehicle( pCharacter ); fExitingVehicleToSquad = FALSE; - - AddPlayerToGroup( SquadMovementGroups[ bSquadValue ], pCharacter ); + + AddPlayerToGroup( SquadMovementGroups[ bSquadValue ], pCharacter ); SetGroupSectorValue( pCharacter->sSectorX, pCharacter->sSectorY, pCharacter->bSectorZ, SquadMovementGroups[ bSquadValue ] ); - pCharacter -> ubGroupID = SquadMovementGroups[ bSquadValue ]; + pCharacter->ubGroupID = SquadMovementGroups[ bSquadValue ]; } - else + else { - AddPlayerToGroup( SquadMovementGroups[ bSquadValue ], pCharacter ); + AddPlayerToGroup( SquadMovementGroups[ bSquadValue ], pCharacter ); SetGroupSectorValue( pCharacter->sSectorX, pCharacter->sSectorY, pCharacter->bSectorZ, SquadMovementGroups[ bSquadValue ] ); - pCharacter -> ubGroupID = SquadMovementGroups[ bSquadValue ]; + pCharacter->ubGroupID = SquadMovementGroups[ bSquadValue ]; } // assign here Squad[ bSquadValue ][ bCounter ] = pCharacter; - + if( ( pCharacter->bAssignment != bSquadValue ) ) { // check to see if we should wake them up - if ( pCharacter->fMercAsleep ) + if ( pCharacter->flags.fMercAsleep ) { // try to wake him up SetMercAwake( pCharacter, FALSE, FALSE ); @@ -303,7 +303,7 @@ BOOLEAN AddCharacterToSquad( SOLDIERTYPE *pCharacter, INT8 bSquadValue ) { pCharacter->bOldAssignment = bSquadValue; } - + // if current tactical sqaud...upadte panel if( NumberOfPeopleInSquad( ( INT8 )iCurrentTacticalSquad ) == 0 ) { @@ -319,7 +319,7 @@ BOOLEAN AddCharacterToSquad( SOLDIERTYPE *pCharacter, INT8 bSquadValue ) { SetCurrentSquad( bSquadValue, TRUE ); } - + return ( TRUE ); } @@ -336,7 +336,7 @@ BOOLEAN AddCharacterToAnySquad( SOLDIERTYPE *pCharacter ) INT8 bCounter = 0; INT8 bFirstEmptySquad = -1; - + // remove them from current squad RemoveCharacterFromSquads( pCharacter ); @@ -380,7 +380,7 @@ INT8 AddCharacterToUniqueSquad( SOLDIERTYPE *pCharacter ) { // add character to any squad, if character is assigned to a squad, returns TRUE INT8 bCounter = 0; - + // check if character on a squad // remove them @@ -400,12 +400,33 @@ INT8 AddCharacterToUniqueSquad( SOLDIERTYPE *pCharacter ) return( -1 ); } +void SortSquadByID( INT8 bSquadValue ) +{ + INT8 teamOrder[18] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; + + for(int count = 0; count < NUMBER_OF_SOLDIERS_PER_SQUAD; count ++) + { + if(Squad[bSquadValue][0] != NULL) + { + teamOrder[Squad[bSquadValue][0]->ubID] = count; + RemoveCharacterFromSquads( Squad[bSquadValue][0] ); + } + } + for(int count = 0; count < 18; count++) + //for(int count = 17; count >= 0; count--) + { + if(teamOrder[count] != -1) + { + AddCharacterToSquad(MercPtrs[count], bSquadValue); + } + } +} BOOLEAN SquadIsEmpty( INT8 bSquadValue ) { // run through this squad's slots and find if they ALL are empty INT32 iCounter = 0; - + for( iCounter = 0; iCounter < NUMBER_OF_SOLDIERS_PER_SQUAD ; iCounter++ ) { if( Squad[ bSquadValue ][ iCounter ] != NULL ) @@ -438,32 +459,32 @@ BOOLEAN RemoveCharacterFromSquads( SOLDIERTYPE *pCharacter ) // check if on current squad and current slot? if( Squad[ iCounterA ][ iCounter ] == pCharacter ) { - - + + // found and nulled Squad[ iCounterA ][ iCounter ] = NULL; // Release memory for his personal path, BUT DON'T CLEAR HIS GROUP'S PATH/WAYPOINTS (pass in groupID -1). // Just because one guy leaves a group is no reason to cancel movement for the rest of the group. - pCharacter -> pMercPath = ClearStrategicPathList( pCharacter -> pMercPath, -1 ); + pCharacter->pMercPath = ClearStrategicPathList( pCharacter->pMercPath, -1 ); // remove character from mvt group - RemovePlayerFromGroup( SquadMovementGroups[ iCounterA ], pCharacter ); - - // reset player mvt group id value - pCharacter -> ubGroupID = 0; + RemovePlayerFromGroup( SquadMovementGroups[ iCounterA ], pCharacter ); - if( ( pCharacter->fBetweenSectors )&&( pCharacter-> uiStatusFlags & SOLDIER_VEHICLE ) ) + // reset player mvt group id value + pCharacter->ubGroupID = 0; + + if( ( pCharacter->flags.fBetweenSectors )&&( pCharacter->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { - ubGroupId = CreateNewPlayerGroupDepartingFromSector( ( INT8 ) ( pCharacter -> sSectorX ) , ( INT8 ) ( pCharacter -> sSectorY ) ); - + ubGroupId = CreateNewPlayerGroupDepartingFromSector( ( INT8 ) ( pCharacter->sSectorX ) , ( INT8 ) ( pCharacter->sSectorY ) ); + // assign to a group - AddPlayerToGroup( ubGroupId, pCharacter ); + AddPlayerToGroup( ubGroupId, pCharacter ); } - + RebuildSquad( ( INT8 )iCounterA ); - if( pCharacter->bLife == 0 ) + if( pCharacter->stats.bLife == 0 ) { AddDeadCharacterToSquadDeadGuys( pCharacter, iCounterA ); } @@ -504,7 +525,7 @@ BOOLEAN RemoveCharacterFromASquad( SOLDIERTYPE *pCharacter, INT8 bSquadValue ) RemovePlayerFromGroup( SquadMovementGroups[ bSquadValue ], pCharacter ); - if( pCharacter->bLife == 0 ) + if( pCharacter->stats.bLife == 0 ) { AddDeadCharacterToSquadDeadGuys( pCharacter, iCounterA ); } @@ -650,7 +671,7 @@ BOOLEAN IsRobotControllerInSquad( INT8 bSquadValue ) for( bCounter = 0; bCounter < NUMBER_OF_SOLDIERS_PER_SQUAD ; bCounter++ ) { // valid slot? - if ( ( Squad[ bSquadValue ][ bCounter ] != NULL ) && ControllingRobot( Squad[ bSquadValue ][ bCounter ] ) ) + if ( ( Squad[ bSquadValue ][ bCounter ] != NULL ) && Squad[ bSquadValue ][ bCounter ]->ControllingRobot( ) ) { // yep return( TRUE ); @@ -664,7 +685,7 @@ BOOLEAN IsRobotControllerInSquad( INT8 bSquadValue ) BOOLEAN SectorSquadIsIn(INT8 bSquadValue, INT16 *sMapX, INT16 *sMapY, INT16 *sMapZ ) { // returns if there is anyone on the squad and what sector ( strategic ) they are in - INT8 bCounter =0; + INT8 bCounter =0; Assert( bSquadValue < ON_DUTY ); @@ -673,9 +694,9 @@ BOOLEAN SectorSquadIsIn(INT8 bSquadValue, INT16 *sMapX, INT16 *sMapY, INT16 *sMa // if valid soldier, get current sector and return if( Squad[ bSquadValue ][ bCounter ] != NULL ) { - *sMapX = Squad[ bSquadValue ][ bCounter ] -> sSectorX; - *sMapY = Squad[ bSquadValue ][ bCounter ] -> sSectorY; - *sMapZ = ( INT16 )Squad[ bSquadValue ][ bCounter ] -> bSectorZ; + *sMapX = Squad[ bSquadValue ][ bCounter ]->sSectorX; + *sMapY = Squad[ bSquadValue ][ bCounter ]->sSectorY; + *sMapZ = ( INT16 )Squad[ bSquadValue ][ bCounter ]->bSectorZ; return ( TRUE ); } @@ -687,22 +708,22 @@ BOOLEAN SectorSquadIsIn(INT8 bSquadValue, INT16 *sMapX, INT16 *sMapY, INT16 *sMa } -BOOLEAN CopyPathOfSquadToCharacter( SOLDIERTYPE *pCharacter, INT8 bSquadValue ) +BOOLEAN CopyPathOfSquadToCharacter( SOLDIERTYPE *pCharacter, INT8 bSquadValue ) { // copy path from squad to character INT8 bCounter = 0; - - + + for( bCounter = 0; bCounter < NUMBER_OF_SOLDIERS_PER_SQUAD ; bCounter++ ) { if( ( Squad[ bSquadValue ][ bCounter ] != pCharacter ) &&( Squad[ bSquadValue ][ bCounter ] != NULL ) ) { // valid character, copy paths - pCharacter -> pMercPath = CopyPaths( Squad[ bSquadValue ][ bCounter ] -> pMercPath, pCharacter -> pMercPath); + pCharacter->pMercPath = CopyPaths( Squad[ bSquadValue ][ bCounter ]->pMercPath, pCharacter->pMercPath); - // return success - return ( TRUE ); + // return success + return ( TRUE ); } } @@ -717,7 +738,7 @@ BOOLEAN CopyPathOfCharacterToSquad( SOLDIERTYPE *pCharacter, INT8 bSquadValue ) BOOLEAN fSuccess = FALSE; INT8 bCounter =0; - // anyone else on squad? + // anyone else on squad? if( NumberOfPeopleInSquad( bSquadValue ) < 2) { // nope @@ -727,20 +748,20 @@ BOOLEAN CopyPathOfCharacterToSquad( SOLDIERTYPE *pCharacter, INT8 bSquadValue ) } // copy each person on squad, skip this character - for( bCounter = 0; bCounter < NUMBER_OF_SOLDIERS_PER_SQUAD ; bCounter++ ) + for( bCounter = 0; bCounter < NUMBER_OF_SOLDIERS_PER_SQUAD ; bCounter++ ) { if( ( Squad[ bSquadValue ][ bCounter ] != pCharacter ) &&( Squad[ bSquadValue ][ bCounter ] != NULL ) ) { // valid character, copy paths // first empty path - Squad[ bSquadValue ][ bCounter ] -> pMercPath = ClearStrategicPathList( Squad[ bSquadValue ][ bCounter ] -> pMercPath, -1 ); - - // then copy - Squad[ bSquadValue ][ bCounter ] -> pMercPath = CopyPaths( pCharacter -> pMercPath, Squad[ bSquadValue ][ bCounter ] -> pMercPath ); + Squad[ bSquadValue ][ bCounter ]->pMercPath = ClearStrategicPathList( Squad[ bSquadValue ][ bCounter ]->pMercPath, -1 ); - // successful at least once - fSuccess = TRUE; + // then copy + Squad[ bSquadValue ][ bCounter ]->pMercPath = CopyPaths( pCharacter->pMercPath, Squad[ bSquadValue ][ bCounter ]->pMercPath ); + + // successful at least once + fSuccess = TRUE; } } @@ -764,10 +785,10 @@ BOOLEAN SetCurrentSquad( INT32 iCurrentSquad, BOOLEAN fForce ) // ARM: can't call SetCurrentSquad() in mapscreen, it calls SelectSoldier(), that will initialize interface panels!!! - // ATE: Adjusted conditions a bit ( sometimes were not getting selected ) + // ATE: Adjusted conditions a bit ( sometimes were not getting selected ) if ( guiCurrentScreen == LAPTOP_SCREEN || guiCurrentScreen == MAP_SCREEN ) - { - return( FALSE ); + { + return( FALSE ); } // ATE; Added to allow us to have NO current squad @@ -806,15 +827,15 @@ BOOLEAN SetCurrentSquad( INT32 iCurrentSquad, BOOLEAN fForce ) RemoveAllPlayersFromSlot( ); // set all auto faces inactive - SetAllAutoFacesInactive( ); + SetAllAutoFacesInactive( ); if( iCurrentTacticalSquad != NO_CURRENT_SQUAD ) { for( iCounter = 0; iCounter < NUMBER_OF_SOLDIERS_PER_SQUAD; iCounter++ ) { - if( Squad[ iCurrentTacticalSquad ][ iCounter ] != NULL ) + if( Squad[ iCurrentTacticalSquad ][ iCounter ] != NULL ) { - // squad set, now add soldiers in + // squad set, now add soldiers in CheckForAndAddMercToTeamPanel( Squad[ iCurrentTacticalSquad ][ iCounter ] ); } } @@ -842,7 +863,6 @@ void RebuildCurrentSquad( void ) { // rebuilds current squad to reset faces in tactical INT32 iCounter = 0; - INT32 iCount = 0; SOLDIERTYPE *pDeadSoldier = NULL; // check if valid value passed @@ -859,7 +879,7 @@ void RebuildCurrentSquad( void ) RemoveAllPlayersFromSlot( ); // set all auto faces inactive - SetAllAutoFacesInactive( ); + SetAllAutoFacesInactive( ); gfPausedTacticalRenderInterfaceFlags = DIRTYLEVEL2; @@ -867,22 +887,22 @@ void RebuildCurrentSquad( void ) { for( iCounter = 0; iCounter < NUMBER_OF_SOLDIERS_PER_SQUAD; iCounter++ ) { - if( Squad[ iCurrentTacticalSquad ][ iCounter ] != NULL ) + if( Squad[ iCurrentTacticalSquad ][ iCounter ] != NULL ) { - // squad set, now add soldiers in + // squad set, now add soldiers in CheckForAndAddMercToTeamPanel( Squad[ iCurrentTacticalSquad ][ iCounter ] ); } } for( iCounter = 0; iCounter < NUMBER_OF_SOLDIERS_PER_SQUAD; iCounter++ ) { - if( sDeadMercs[ iCurrentTacticalSquad ][ iCounter ] != -1 ) + if( sDeadMercs[ iCurrentTacticalSquad ][ iCounter ] != -1 ) { pDeadSoldier = FindSoldierByProfileID( ( UINT8 )( sDeadMercs[ iCurrentTacticalSquad ][ iCounter ] ), TRUE ); if( pDeadSoldier ) { - // squad set, now add soldiers in + // squad set, now add soldiers in CheckForAndAddMercToTeamPanel( pDeadSoldier ); } } @@ -894,19 +914,18 @@ void RebuildCurrentSquad( void ) void ExamineCurrentSquadLights( void ) { // rebuilds current squad to reset faces in tactical - INT32 iCounter = 0; UINT8 ubLoop; // OK, we should add lights for any guy currently bInSector who is not bad OKLIFE... ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; for ( ; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++) { - if ( MercPtrs[ ubLoop ]->bInSector && MercPtrs[ ubLoop ]->bLife >= OKLIFE ) + if ( MercPtrs[ ubLoop ]->bInSector && MercPtrs[ ubLoop ]->stats.bLife >= OKLIFE ) { - PositionSoldierLight( MercPtrs[ ubLoop ] ); + MercPtrs[ ubLoop ]->PositionSoldierLight( ); } } - + // check if valid value passed //if( ( iCurrentTacticalSquad >= NUMBER_OF_SQUADS ) || ( iCurrentTacticalSquad < 0 ) ) @@ -917,7 +936,7 @@ void ExamineCurrentSquadLights( void ) //for( iCounter = 0; iCounter < NUMBER_OF_SOLDIERS_PER_SQUAD; iCounter++ ) //{ - // if( Squad[ iCurrentTacticalSquad ][ iCounter ] != NULL ) + // if( Squad[ iCurrentTacticalSquad ][ iCounter ] != NULL ) // { // PositionSoldierLight( Squad[ iCurrentTacticalSquad ][ iCounter ] ); // } @@ -963,10 +982,10 @@ BOOLEAN IsSquadOnCurrentTacticalMap( INT32 iCurrentSquad ) // go through memebrs of squad...if anyone on this map, return true for( iCounter = 0; iCounter < NUMBER_OF_SOLDIERS_PER_SQUAD; iCounter++ ) { - if( Squad[ iCurrentSquad ][ iCounter ] != NULL ) + if( Squad[ iCurrentSquad ][ iCounter ] != NULL ) { // ATE; Added more checks here for being in sector ( fBetweenSectors and SectorZ ) - if( ( Squad[ iCurrentSquad ][ iCounter ]->sSectorX == gWorldSectorX ) && ( Squad[ iCurrentSquad ][ iCounter ]->sSectorY == gWorldSectorY ) && Squad[ iCurrentSquad ][ iCounter ]->bSectorZ == gbWorldSectorZ && Squad[ iCurrentSquad ][ iCounter ]->fBetweenSectors != TRUE ) + if( ( Squad[ iCurrentSquad ][ iCounter ]->sSectorX == gWorldSectorX ) && ( Squad[ iCurrentSquad ][ iCounter ]->sSectorY == gWorldSectorY ) && Squad[ iCurrentSquad ][ iCounter ]->bSectorZ == gbWorldSectorZ && Squad[ iCurrentSquad ][ iCounter ]->flags.fBetweenSectors != TRUE ) { return( TRUE ); } @@ -1004,7 +1023,7 @@ void SetDefaultSquadOnSectorEntry( BOOLEAN fForce ) // If here, set to no current squad SetCurrentSquad( NO_CURRENT_SQUAD, FALSE ); - + return; } @@ -1036,8 +1055,8 @@ void GetSquadPosition( UINT8 *ubNextX, UINT8 *ubNextY, UINT8 *ubPrevX, UINT8 *ub if( SquadMovementGroups[ ubSquadValue ] == 0 ) { *ubNextX = 0; - *ubNextY = 0; - *ubPrevX = 0; + *ubNextY = 0; + *ubPrevX = 0; *ubPrevY = 0; *uiTraverseTime = 0; *uiArriveTime = 0; @@ -1046,20 +1065,20 @@ void GetSquadPosition( UINT8 *ubNextX, UINT8 *ubNextY, UINT8 *ubPrevX, UINT8 *ub // grab this squads mvt position GetGroupPosition( ubNextX, ubNextY, ubPrevX, ubPrevY, uiTraverseTime, uiArriveTime, SquadMovementGroups[ ubSquadValue ] ); - + return; } -void SetSquadPositionBetweenSectors( UINT8 ubNextX, UINT8 ubNextY, UINT8 ubPrevX, UINT8 ubPrevY, UINT32 uiTraverseTime, UINT32 uiArriveTime, UINT8 ubSquadValue ) +void SetSquadPositionBetweenSectors( UINT8 ubNextX, UINT8 ubNextY, UINT8 ubPrevX, UINT8 ubPrevY, UINT32 uiTraverseTime, UINT32 uiArriveTime, UINT8 ubSquadValue ) { - // set mvt group position for squad for + // set mvt group position for squad for if( SquadMovementGroups[ ubSquadValue ] == 0 ) { return; } - SetGroupPosition( ubNextX, ubNextY, ubPrevX, ubPrevY, uiTraverseTime, uiArriveTime, SquadMovementGroups[ ubSquadValue ] ); + SetGroupPosition( ubNextX, ubNextY, ubPrevX, ubPrevY, uiTraverseTime, uiArriveTime, SquadMovementGroups[ ubSquadValue ] ); return; } @@ -1076,7 +1095,7 @@ BOOLEAN SaveSquadInfoToSavedGameFile( HWFILE hFile ) INT32 iCounter =0; - for( iCounter = 0; iCounter < NUMBER_OF_SQUADS; iCounter++ ) + for( iCounter = 0; iCounter < NUMBER_OF_SQUADS; iCounter++ ) { for( iCounterB =0; iCounterB < NUMBER_OF_SOLDIERS_PER_SQUAD; iCounterB++ ) { @@ -1122,12 +1141,12 @@ BOOLEAN LoadSquadInfoFromSavedGameFile( HWFILE hFile ) INT32 iCounter =0; // null each list of ptrs. - for( iCounter = 0; iCounter < NUMBER_OF_SQUADS; iCounter++ ) + for( iCounter = 0; iCounter < NUMBER_OF_SQUADS; iCounter++ ) { for( iCounterB =0; iCounterB < NUMBER_OF_SOLDIERS_PER_SQUAD; iCounterB++ ) { - // squad, soldier - Squad[ iCounter ][ iCounterB ]= NULL; + // squad, soldier + Squad[ iCounter ][ iCounterB ]= NULL; } } @@ -1144,7 +1163,7 @@ BOOLEAN LoadSquadInfoFromSavedGameFile( HWFILE hFile ) // Loop through the array loaded in - for( iCounter = 0; iCounter < NUMBER_OF_SQUADS; iCounter++ ) + for( iCounter = 0; iCounter < NUMBER_OF_SQUADS; iCounter++ ) { for( iCounterB =0; iCounterB < NUMBER_OF_SOLDIERS_PER_SQUAD; iCounterB++ ) { @@ -1194,7 +1213,7 @@ BOOLEAN IsThisSquadOnTheMove( INT8 bSquadValue ) { if( Squad[ bSquadValue ][ iCounter ] ) { - return( Squad[ bSquadValue ][ iCounter ]->fBetweenSectors ); + return( Squad[ bSquadValue ][ iCounter ]->flags.fBetweenSectors ); } } @@ -1237,8 +1256,8 @@ void UpdateCurrentlySelectedMerc( SOLDIERTYPE *pSoldier, INT8 bSquadValue ) // Are we the selected guy? if( gusSelectedSoldier == pSoldier->ubID ) { - ubID = FindNextActiveAndAliveMerc( pSoldier, FALSE, FALSE ); - + ubID = FindNextActiveAndAliveMerc( pSoldier, FALSE, FALSE ); + if ( ubID != NOBODY && ubID != gusSelectedSoldier ) { SelectSoldier( ubID, FALSE, FALSE ); @@ -1247,7 +1266,7 @@ void UpdateCurrentlySelectedMerc( SOLDIERTYPE *pSoldier, INT8 bSquadValue ) { gusSelectedSoldier = NOBODY; - // ATE: Make sure we are in TEAM panel at this point! + // ATE: Make sure we are in TEAM panel at this point! SetCurrentInterfacePanel( TEAM_PANEL ); } } @@ -1264,7 +1283,7 @@ BOOLEAN IsSquadInSector( SOLDIERTYPE *pSoldier, UINT8 ubSquad ) return( FALSE ); } - if( pSoldier->fBetweenSectors == TRUE ) + if( pSoldier->flags.fBetweenSectors == TRUE ) { return( FALSE ); } @@ -1289,7 +1308,7 @@ BOOLEAN IsSquadInSector( SOLDIERTYPE *pSoldier, UINT8 ubSquad ) return( FALSE ); } - if( Squad[ ubSquad ][ 0 ]->fBetweenSectors == TRUE ) + if( Squad[ ubSquad ][ 0 ]->flags.fBetweenSectors == TRUE ) { return( FALSE ); } @@ -1312,7 +1331,7 @@ BOOLEAN IsAnyMercOnSquadAsleep( UINT8 ubSquadValue ) { if( Squad[ ubSquadValue ][ iCounter ] != NULL ) { - if( Squad[ ubSquadValue ][ iCounter ]-> fMercAsleep ) + if( Squad[ ubSquadValue ][ iCounter ]->flags.fMercAsleep ) { return( TRUE ); } @@ -1372,7 +1391,7 @@ BOOLEAN AddDeadCharacterToSquadDeadGuys( SOLDIERTYPE *pSoldier, INT32 iSquadValu { // nope sDeadMercs[ iSquadValue ][ iCounter ] = pSoldier->ubProfile; - return( TRUE ); + return( TRUE ); } } @@ -1463,11 +1482,11 @@ BOOLEAN ResetDeadSquadMemberList( INT32 iSquadValue ) } -// this passed soldier on the current squad int he tactical map +// this passed soldier on the current squad int he tactical map BOOLEAN IsMercOnCurrentSquad( SOLDIERTYPE *pSoldier ) { INT32 iCounter = 0; - + // valid soldier? if( pSoldier == NULL ) { @@ -1483,7 +1502,7 @@ BOOLEAN IsMercOnCurrentSquad( SOLDIERTYPE *pSoldier ) } // current squad valid? - if( iCurrentTacticalSquad >= NUMBER_OF_SQUADS ) + if( iCurrentTacticalSquad >= NUMBER_OF_SQUADS ) { // no return( FALSE ); @@ -1523,9 +1542,9 @@ INT8 NumberOfPlayerControllableMercsInSquad( INT8 bSquadValue ) // yep pSoldier = Squad[ bSquadValue ][ bCounter ] ; - //Kris: This breaks the CLIENT of this function, tactical traversal. Do NOT check for EPCS or ROBOT here. - //if ( !AM_AN_EPC( pSoldier ) && !AM_A_ROBOT( pSoldier ) && - if( !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + //Kris: This breaks the CLIENT of this function, tactical traversal. Do NOT check for EPCS or ROBOT here. + //if ( !AM_AN_EPC( pSoldier ) && !AM_A_ROBOT( pSoldier ) && + if( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { bSquadCount++; } @@ -1541,7 +1560,6 @@ BOOLEAN DoesVehicleExistInSquad( INT8 bSquadValue ) { SOLDIERTYPE *pSoldier; INT8 bCounter = 0; - INT8 bSquadCount = 0; if( bSquadValue == NO_CURRENT_SQUAD ) { @@ -1558,7 +1576,7 @@ BOOLEAN DoesVehicleExistInSquad( INT8 bSquadValue ) pSoldier = Squad[ bSquadValue ][ bCounter ] ; // If we are an EPC or ROBOT, don't allow this - if ( ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { return( TRUE ); } @@ -1587,4 +1605,4 @@ void CheckSquadMovementGroups( void ) pGroup->fPersistant = TRUE; } } -} \ No newline at end of file +} diff --git a/Tactical/Squads.h b/Tactical/Squads.h index 85e80079..d3efb153 100644 --- a/Tactical/Squads.h +++ b/Tactical/Squads.h @@ -35,7 +35,7 @@ enum{ // ATE: Added so we can have no current squad // happens in we move off sector via tactical, but nobody is left! -#define NO_CURRENT_SQUAD NUMBER_OF_SQUADS +#define NO_CURRENT_SQUAD NUMBER_OF_SQUADS // ptrs to soldier types of squads and their members @@ -90,7 +90,7 @@ BOOLEAN SectorSquadIsIn(INT8 bSquadValue, INT16 *sMapX, INT16 *sMapY, INT16 *sMa void RebuildCurrentSquad( void ); // copy path of squad to character -BOOLEAN CopyPathOfSquadToCharacter( SOLDIERTYPE *pCharacter, INT8 bSquadValue ); +BOOLEAN CopyPathOfSquadToCharacter( SOLDIERTYPE *pCharacter, INT8 bSquadValue ); // copy path from character back to squad BOOLEAN CopyPathOfCharacterToSquad( SOLDIERTYPE *pCharacter, INT8 bSquadValue ); @@ -101,6 +101,9 @@ INT32 CurrentSquad( void ); // add character to unique squad (returns the squad #, -1 if failed) INT8 AddCharacterToUniqueSquad( SOLDIERTYPE *pCharacter ); +// resort the squad by ubID +void SortSquadByID( INT8 bSquadValue ); + // is this squad empty? BOOLEAN SquadIsEmpty( INT8 bSquadValue ); @@ -118,7 +121,7 @@ void SetDefaultSquadOnSectorEntry( BOOLEAN fForce ); INT32 GetLastSquadActive( void ); // set squads between sector position -void SetSquadPositionBetweenSectors( UINT8 ubNextX, UINT8 ubNextY, UINT8 ubPrevX, UINT8 ubPrevY, UINT32 uiTraverseTime, UINT32 uiArriveTime, UINT8 ubSquadValue ); +void SetSquadPositionBetweenSectors( UINT8 ubNextX, UINT8 ubNextY, UINT8 ubPrevX, UINT8 ubPrevY, UINT32 uiTraverseTime, UINT32 uiArriveTime, UINT8 ubSquadValue ); // get squads between sector positions and times void GetSquadPosition( UINT8 *ubNextX, UINT8 *ubNextY, UINT8 *ubPrevX, UINT8 *ubPrevY, UINT32 *uiTraverseTime, UINT32 *uiArriveTime, UINT8 ubSquadValue ); @@ -144,7 +147,7 @@ BOOLEAN IsSquadInSector( SOLDIERTYPE *pSoldier, UINT8 ubSquad ); // is any merc on squad asleep? BOOLEAN IsAnyMercOnSquadAsleep( UINT8 ubSquadValue ); -// is therea dead guy here +// is therea dead guy here BOOLEAN IsDeadGuyInThisSquadSlot( INT8 bSlotId, INT8 bSquadValue , INT8 *bNumberOfDeadGuysSoFar ); // dead soldier was on squad @@ -153,7 +156,7 @@ BOOLEAN SoldierIsDeadAndWasOnSquad( SOLDIERTYPE *pSoldier, INT8 bSquadValue ); // now reset the table for these mercs BOOLEAN ResetDeadSquadMemberList( INT32 iSquadValue ); -// this passed soldier on the current squad int he tactical map +// this passed soldier on the current squad int he tactical map BOOLEAN IsMercOnCurrentSquad( SOLDIERTYPE *pSoldier ); // is this squad filled up? diff --git a/Tactical/Strategic Exit GUI.cpp b/Tactical/Strategic Exit GUI.cpp index 335493e7..c180ec81 100644 --- a/Tactical/Strategic Exit GUI.cpp +++ b/Tactical/Strategic Exit GUI.cpp @@ -1,7 +1,7 @@ #ifdef PRECOMPILEDHEADERS #include "Tactical All.h" #include "PreBattle Interface.h" - #include "creature spreading.h" + #include "creature spreading.h" #else #include "builddefines.h" #include @@ -105,16 +105,16 @@ typedef struct EXIT_DIALOG_STRUCT gExitDialog; -UINT8 gubExitGUIDirection; -INT16 gsExitGUIAdditionalData; -INT16 gsWarpWorldX; -INT16 gsWarpWorldY; -INT8 gbWarpWorldZ; -INT16 gsWarpGridNo; +UINT8 gubExitGUIDirection; +INT16 gsExitGUIAdditionalData; +INT16 gsWarpWorldX; +INT16 gsWarpWorldY; +INT8 gbWarpWorldZ; +INT16 gsWarpGridNo; -//KM: New method is coded for more sophistocated rules. All the information is stored within the gExitDialog struct -// and calculated upon entry to this function instead of passing in multiple arguments and calculating it prior. +//KM: New method is coded for more sophistocated rules. All the information is stored within the gExitDialog struct +// and calculated upon entry to this function instead of passing in multiple arguments and calculating it prior. BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT16 sAdditionalData ) { UINT32 uiTraverseTimeInMinutes; @@ -122,11 +122,11 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT16 sAdditionalData ) INT32 i; SGPRect aRect; UINT16 usTextBoxWidth, usTextBoxHeight; - UINT16 usMapPos = 0; + INT16 sMapPos = 0; INT8 bExitCode = -1; BOOLEAN OkExitCode; - //STEP 1: Calculate the information for the exit gui + //STEP 1: Calculate the information for the exit gui memset( &gExitDialog, 0, sizeof( EXIT_DIALOG_STRUCT ) ); gExitDialog.bSingleMoveWillIsolateEPC = -1; @@ -147,11 +147,11 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT16 sAdditionalData ) break; case DIRECTION_EXITGRID: bExitCode = -1; - usMapPos = sAdditionalData; + sMapPos = sAdditionalData; break; } - OkExitCode = OKForSectorExit( bExitCode, usMapPos, &uiTraverseTimeInMinutes ); + OkExitCode = OKForSectorExit( bExitCode, sMapPos, &uiTraverseTimeInMinutes ); if( uiTraverseTimeInMinutes <= 5 ) { //if the traverse time is short, then traversal is percieved to be instantaneous. @@ -189,12 +189,12 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT16 sAdditionalData ) gExitDialog.fGotoSectorDisabled = TRUE; } } - - //STEP 2: Setup the exit gui - + + //STEP 2: Setup the exit gui + EnterModalTactical( TACTICAL_MODAL_WITHMOUSE ); gfIgnoreScrolling = TRUE; - + aRect.iTop = 0; aRect.iLeft = 0; aRect.iBottom = INV_INTERFACE_START_Y; @@ -208,7 +208,7 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT16 sAdditionalData ) gExitDialog.ubNumPeopleOnSquad = NumberOfPlayerControllableMercsInSquad( MercPtrs[ gusSelectedSoldier ]->bAssignment ); - //Determine + //Determine for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) { pSoldier = MercPtrs[ i ]; @@ -216,15 +216,15 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT16 sAdditionalData ) { continue; } - if( !pSoldier->fBetweenSectors && + if( !pSoldier->flags.fBetweenSectors && pSoldier->sSectorX == gWorldSectorX && pSoldier->sSectorY == gWorldSectorY && pSoldier->bSectorZ == gbWorldSectorZ && - pSoldier->bLife >= OKLIFE && - pSoldier->bAssignment != MercPtrs[ gusSelectedSoldier ]->bAssignment && + pSoldier->stats.bLife >= OKLIFE && + pSoldier->bAssignment != MercPtrs[ gusSelectedSoldier ]->bAssignment && pSoldier->bAssignment != ASSIGNMENT_POW && pSoldier->bAssignment != IN_TRANSIT && pSoldier->bAssignment != ASSIGNMENT_DEAD ) - { //KM: We need to determine if there are more than one squad (meaning other concious mercs in a different squad or assignment) - // These conditions were done to the best of my knowledge, so if there are other situations that require modification, - // then feel free to do so. - gExitDialog.fMultipleSquadsInSector = TRUE; + { //KM: We need to determine if there are more than one squad (meaning other concious mercs in a different squad or assignment) + // These conditions were done to the best of my knowledge, so if there are other situations that require modification, + // then feel free to do so. + gExitDialog.fMultipleSquadsInSector = TRUE; break; } } @@ -238,11 +238,11 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT16 sAdditionalData ) { gExitDialog.fSingleMoveOn = FALSE; gExitDialog.fAllMoveOn = TRUE; - gExitDialog.fSelectedMercIsEPC = TRUE; + gExitDialog.fSelectedMercIsEPC = TRUE; } gExitDialog.fSingleMoveDisabled = TRUE; } - else + else { //check to see if we have one selected merc and one or more EPCs. //If so, don't allow the selected merc to leave by himself. //Assuming that the matching squad assignment is in the same sector. @@ -259,9 +259,9 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT16 sAdditionalData ) if( AM_AN_EPC( MercPtrs[ i ] ) ) { ubNumEPCs++; - //record the slot of the epc. If there are more than one EPCs, then - //it doesn't matter. This is used in building the text message explaining - //why the selected merc can't leave. This is how we extract the EPC's name. + //record the slot of the epc. If there are more than one EPCs, then + //it doesn't matter. This is used in building the text message explaining + //why the selected merc can't leave. This is how we extract the EPC's name. gExitDialog.bSingleMoveWillIsolateEPC = (INT8)i; } else @@ -288,7 +288,7 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT16 sAdditionalData ) if( gTacticalStatus.fEnemyInSector ) { if( gExitDialog.fMultipleSquadsInSector ) - { //We have multiple squads in a hostile sector. That means that we can't load the adjacent sector. + { //We have multiple squads in a hostile sector. That means that we can't load the adjacent sector. gExitDialog.fGotoSectorDisabled = TRUE; gExitDialog.fGotoSector = FALSE; } @@ -322,45 +322,45 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT16 sAdditionalData ) guiPendingOverrideEvent = EX_EXITSECTORMENU; HandleTacticalUI( ); - + gfInSectorExitMenu = TRUE; MSYS_DefineRegion( &(gExitDialog.BackRegion), 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST-1, - CURSOR_NORMAL, MSYS_NO_CALLBACK, SectorExitBackgroundCallback ); + CURSOR_NORMAL, MSYS_NO_CALLBACK, SectorExitBackgroundCallback ); gExitDialog.iButtonImages = LoadButtonImage( "INTERFACE\\popupbuttons.sti", -1,0,-1,1,-1 ); MSYS_DefineRegion( &gExitDialog.SingleRegion, (INT16)(gExitDialog.sX + 20), (INT16)(gExitDialog.sY + 37), (INT16)(gExitDialog.sX + 45 + 120), (INT16)(gExitDialog.sY + 37 + 12), MSYS_PRIORITY_HIGHEST, - CURSOR_NORMAL, SingleRegionMoveCallback, SingleRegionCallback ); + CURSOR_NORMAL, SingleRegionMoveCallback, SingleRegionCallback ); MSYS_AllowDisabledRegionFastHelp( &gExitDialog.SingleRegion, TRUE ); MSYS_DefineRegion( &(gExitDialog.AllRegion), (INT16)(gExitDialog.sX + 20), (INT16)(gExitDialog.sY + 57), (INT16)(gExitDialog.sX + 45 + 120), (INT16)(gExitDialog.sY + 57 + 12), MSYS_PRIORITY_HIGHEST, - CURSOR_NORMAL, AllRegionMoveCallback, AllRegionCallback ); + CURSOR_NORMAL, AllRegionMoveCallback, AllRegionCallback ); MSYS_AllowDisabledRegionFastHelp( &gExitDialog.AllRegion, TRUE ); MSYS_DefineRegion( &(gExitDialog.LoadRegion), (INT16)(gExitDialog.sX + 155), (INT16)(gExitDialog.sY + 45), (INT16)(gExitDialog.sX + 180 + 85), (INT16)(gExitDialog.sY + 45 + 15), MSYS_PRIORITY_HIGHEST, - CURSOR_NORMAL, LoadRegionMoveCallback, LoadRegionCallback ); + CURSOR_NORMAL, LoadRegionMoveCallback, LoadRegionCallback ); MSYS_AllowDisabledRegionFastHelp( &gExitDialog.LoadRegion, TRUE ); gExitDialog.uiLoadCheckButton = CreateCheckBoxButton( (INT16)(gExitDialog.sX + 155 ), (INT16)(gExitDialog.sY + 43 ), "INTERFACE\\popupcheck.sti", MSYS_PRIORITY_HIGHEST, CheckLoadMapCallback ); - gExitDialog.uiSingleMoveButton = CreateCheckBoxButton( (INT16)(gExitDialog.sX + 20 ), (INT16)(gExitDialog.sY + 35 ), "INTERFACE\\popupradiobuttons.sti", MSYS_PRIORITY_HIGHEST, SingleMoveCallback ); + gExitDialog.uiSingleMoveButton = CreateCheckBoxButton( (INT16)(gExitDialog.sX + 20 ), (INT16)(gExitDialog.sY + 35 ), "INTERFACE\\popupradiobuttons.sti", MSYS_PRIORITY_HIGHEST, SingleMoveCallback ); - gExitDialog.uiAllMoveButton = CreateCheckBoxButton( (INT16)(gExitDialog.sX + 20 ), (INT16)(gExitDialog.sY + 55 ), "INTERFACE\\popupradiobuttons.sti", MSYS_PRIORITY_HIGHEST, AllMoveCallback ); + gExitDialog.uiAllMoveButton = CreateCheckBoxButton( (INT16)(gExitDialog.sX + 20 ), (INT16)(gExitDialog.sY + 55 ), "INTERFACE\\popupradiobuttons.sti", MSYS_PRIORITY_HIGHEST, AllMoveCallback ); - gExitDialog.uiOKButton = CreateIconAndTextButton( gExitDialog.iButtonImages, TacticalStr[ OK_BUTTON_TEXT_STR ], FONT12ARIAL, - FONT_MCOLOR_WHITE, DEFAULT_SHADOW, - FONT_MCOLOR_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, + gExitDialog.uiOKButton = CreateIconAndTextButton( gExitDialog.iButtonImages, TacticalStr[ OK_BUTTON_TEXT_STR ], FONT12ARIAL, + FONT_MCOLOR_WHITE, DEFAULT_SHADOW, + FONT_MCOLOR_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, (INT16)(gExitDialog.sX + 65 ), (INT16)(gExitDialog.sY + 78 ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)OKCallback ); - gExitDialog.uiCancelButton = CreateIconAndTextButton( gExitDialog.iButtonImages, TacticalStr[ CANCEL_BUTTON_TEXT_STR ], FONT12ARIAL, - FONT_MCOLOR_WHITE, DEFAULT_SHADOW, - FONT_MCOLOR_WHITE, DEFAULT_SHADOW, - TEXT_CJUSTIFIED, + gExitDialog.uiCancelButton = CreateIconAndTextButton( gExitDialog.iButtonImages, TacticalStr[ CANCEL_BUTTON_TEXT_STR ], FONT12ARIAL, + FONT_MCOLOR_WHITE, DEFAULT_SHADOW, + FONT_MCOLOR_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, (INT16)(gExitDialog.sX + 135 ), (INT16)(gExitDialog.sY + 78 ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)CancelCallback ); @@ -384,16 +384,16 @@ void DoneFadeOutWarpCallback( void ) INT32 cnt; SOLDIERTYPE *pSoldier; - // Warp! + // Warp! - // Set insertion data... + // Set insertion data... cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) - { + { // Are we in this sector, On the current squad? - if ( pSoldier->bActive && pSoldier->bLife >= OKLIFE && pSoldier->bInSector ) + if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && pSoldier->bInSector ) { gfTacticalTraversal = TRUE; SetGroupSectorValue( gsWarpWorldX, gsWarpWorldY, gbWarpWorldZ, pSoldier->ubGroupID ); @@ -407,7 +407,7 @@ void DoneFadeOutWarpCallback( void ) pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; pSoldier->usStrategicInsertionData = gsWarpGridNo; // Set direction to face.... - pSoldier->ubInsertionDirection = 100 + NORTHWEST; + pSoldier->ubInsertionDirection = 100 + NORTHWEST; } } @@ -428,36 +428,36 @@ void DoneFadeOutWarpCallback( void ) void WarpToSurfaceCallback( UINT8 bExitValue ) { - if( bExitValue == MSG_BOX_RETURN_YES ) + if( bExitValue == MSG_BOX_RETURN_YES ) { - gFadeOutDoneCallback = DoneFadeOutWarpCallback; + gFadeOutDoneCallback = DoneFadeOutWarpCallback; - FadeOutGameScreen( ); - } - else - { - InternalInitSectorExitMenu( gubExitGUIDirection, gsExitGUIAdditionalData ); - } + FadeOutGameScreen( ); + } + else + { + InternalInitSectorExitMenu( gubExitGUIDirection, gsExitGUIAdditionalData ); + } } BOOLEAN InitSectorExitMenu( UINT8 ubDirection, INT16 sAdditionalData ) { - gubExitGUIDirection = ubDirection; - gsExitGUIAdditionalData = sAdditionalData; + gubExitGUIDirection = ubDirection; + gsExitGUIAdditionalData = sAdditionalData; - if ( gbWorldSectorZ >= 2 && gubQuest[ QUEST_CREATURES ] == QUESTDONE ) - { - if ( GetWarpOutOfMineCodes( &gsWarpWorldX, &gsWarpWorldY, &gbWarpWorldZ, &gsWarpGridNo ) ) - { - // ATE: Check if we are in a creature lair and bring up box if so.... - DoMessageBox( MSG_BOX_BASIC_STYLE, gzLateLocalizedString[ 33 ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, WarpToSurfaceCallback, NULL ); + if ( gbWorldSectorZ >= 2 && gubQuest[ QUEST_CREATURES ] == QUESTDONE ) + { + if ( GetWarpOutOfMineCodes( &gsWarpWorldX, &gsWarpWorldY, &gbWarpWorldZ, &gsWarpGridNo ) ) + { + // ATE: Check if we are in a creature lair and bring up box if so.... + DoMessageBox( MSG_BOX_BASIC_STYLE, gzLateLocalizedString[ 33 ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, WarpToSurfaceCallback, NULL ); - return( TRUE ); - } - } + return( TRUE ); + } + } - return( InternalInitSectorExitMenu( ubDirection, sAdditionalData ) ); + return( InternalInitSectorExitMenu( ubDirection, sAdditionalData ) ); } @@ -496,7 +496,7 @@ void UpdateSectorExitMenu( ) DisableButton( gExitDialog.uiLoadCheckButton ); MSYS_DisableRegion(&(gExitDialog.LoadRegion ) ); if( gExitDialog.fMultipleSquadsInSector && gExitDialog.fGotoSectorText && gTacticalStatus.fEnemyInSector ) - { //We have multiple squads in a hostile sector. That means that we can't load the adjacent sector. + { //We have multiple squads in a hostile sector. That means that we can't load the adjacent sector. SetButtonFastHelpText( gExitDialog.uiLoadCheckButton, pExitingSectorHelpText[ EXIT_GUI_CANT_LEAVE_HOSTILE_SECTOR_HELPTEXT ] ); SetRegionFastHelpText( &gExitDialog.LoadRegion, pExitingSectorHelpText[ EXIT_GUI_CANT_LEAVE_HOSTILE_SECTOR_HELPTEXT ] ); } @@ -536,23 +536,23 @@ void UpdateSectorExitMenu( ) CHAR16 str[ 256 ]; swprintf( str, pExitingSectorHelpText[ EXIT_GUI_ESCORTED_CHARACTERS_MUST_BE_ESCORTED_HELPTEXT ], MercPtrs[ gusSelectedSoldier ]->name ); SetButtonFastHelpText( gExitDialog.uiSingleMoveButton, str ); - SetRegionFastHelpText( &gExitDialog.SingleRegion, str ); + SetRegionFastHelpText( &gExitDialog.SingleRegion, str ); } else if( gExitDialog.bSingleMoveWillIsolateEPC != -1 ) { //It has been previously determined that there are only two mercs in the squad, the selected merc - //isn't an EPC, but the other merc is. That means that this merc cannot leave the sector alone + //isn't an EPC, but the other merc is. That means that this merc cannot leave the sector alone //as he would isolate the EPC. CHAR16 str[ 256 ]; if( !gExitDialog.fSquadHasMultipleEPCs ) { if( gMercProfiles[ MercPtrs[ gusSelectedSoldier ]->ubProfile ].bSex == MALE ) { //male singular - swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_MALE_SINGULAR ], MercPtrs[ gusSelectedSoldier ]->name, + swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_MALE_SINGULAR ], MercPtrs[ gusSelectedSoldier ]->name, MercPtrs[ gExitDialog.bSingleMoveWillIsolateEPC ]->name ); } else { //female singular - swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_FEMALE_SINGULAR ], MercPtrs[ gusSelectedSoldier ]->name, + swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_FEMALE_SINGULAR ], MercPtrs[ gusSelectedSoldier ]->name, MercPtrs[ gExitDialog.bSingleMoveWillIsolateEPC ]->name ); } } @@ -568,7 +568,7 @@ void UpdateSectorExitMenu( ) } } SetButtonFastHelpText( gExitDialog.uiSingleMoveButton, str ); - SetRegionFastHelpText( &gExitDialog.SingleRegion, str ); + SetRegionFastHelpText( &gExitDialog.SingleRegion, str ); } } else @@ -588,12 +588,12 @@ void UpdateSectorExitMenu( ) if( gExitDialog.fUncontrolledRobotInSquad ) { SetButtonFastHelpText( gExitDialog.uiAllMoveButton, gzLateLocalizedString[ 1 ] ); - SetRegionFastHelpText( &gExitDialog.AllRegion, gzLateLocalizedString[ 1 ] ); + SetRegionFastHelpText( &gExitDialog.AllRegion, gzLateLocalizedString[ 1 ] ); } else { SetButtonFastHelpText( gExitDialog.uiAllMoveButton, pExitingSectorHelpText[ EXIT_GUI_ALL_MERCS_MUST_BE_TOGETHER_TO_ALLOW_HELPTEXT ] ); - SetRegionFastHelpText( &gExitDialog.AllRegion, pExitingSectorHelpText[ EXIT_GUI_ALL_MERCS_MUST_BE_TOGETHER_TO_ALLOW_HELPTEXT ] ); + SetRegionFastHelpText( &gExitDialog.AllRegion, pExitingSectorHelpText[ EXIT_GUI_ALL_MERCS_MUST_BE_TOGETHER_TO_ALLOW_HELPTEXT ] ); } } else @@ -601,7 +601,7 @@ void UpdateSectorExitMenu( ) EnableButton( gExitDialog.uiAllMoveButton ); MSYS_EnableRegion(&(gExitDialog.AllRegion) ); SetButtonFastHelpText( gExitDialog.uiAllMoveButton, pExitingSectorHelpText[ EXIT_GUI_ALL_TRAVERSAL_WILL_MOVE_CURRENT_SQUAD_HELPTEXT ] ); - SetRegionFastHelpText( &gExitDialog.AllRegion, pExitingSectorHelpText[ EXIT_GUI_ALL_TRAVERSAL_WILL_MOVE_CURRENT_SQUAD_HELPTEXT ] ); + SetRegionFastHelpText( &gExitDialog.AllRegion, pExitingSectorHelpText[ EXIT_GUI_ALL_TRAVERSAL_WILL_MOVE_CURRENT_SQUAD_HELPTEXT ] ); } } @@ -613,7 +613,7 @@ void RenderSectorExitMenu( ) // ATE: Reset mouse Y gsGlobalCursorYOffset = 0; SetCurrentCursorFromDatabase( CURSOR_NORMAL ); - + while( DequeueEvent( &Event ) ) { if( Event.usEvent == KEY_DOWN ) @@ -632,54 +632,54 @@ void RenderSectorExitMenu( ) UpdateSectorExitMenu( ); - RenderMercPopUpBoxFromIndex( gExitDialog.iBoxId, gExitDialog.sX, gExitDialog.sY, FRAME_BUFFER ); + RenderMercPopUpBoxFromIndex( gExitDialog.iBoxId, gExitDialog.sX, gExitDialog.sY, FRAME_BUFFER ); InvalidateRegion( gExitDialog.sX, gExitDialog.sY, gExitDialog.usWidth, gExitDialog.usHeight ); SetFont( FONT12ARIAL ); SetFontBackground( FONT_MCOLOR_BLACK ); - - if ( gExitDialog.fSingleMoveDisabled ) + + if ( gExitDialog.fSingleMoveDisabled ) { - SetFontForeground( FONT_MCOLOR_DKGRAY ); + SetFontForeground( FONT_MCOLOR_DKGRAY ); } - else if ( gExitDialog.fSingleMoveHilighted ) + else if ( gExitDialog.fSingleMoveHilighted ) { - SetFontForeground( FONT_MCOLOR_LTYELLOW ); + SetFontForeground( FONT_MCOLOR_LTYELLOW ); } else { - SetFontForeground( FONT_MCOLOR_WHITE ); + SetFontForeground( FONT_MCOLOR_WHITE ); } mprintf( gExitDialog.sX + 45, gExitDialog.sY + 37, TacticalStr[ EXIT_GUI_SELECTED_MERC_STR ] ); - if ( gExitDialog.fAllMoveDisabled ) + if ( gExitDialog.fAllMoveDisabled ) { - SetFontForeground( FONT_MCOLOR_DKGRAY ); + SetFontForeground( FONT_MCOLOR_DKGRAY ); } - else if ( gExitDialog.fAllMoveHilighted ) + else if ( gExitDialog.fAllMoveHilighted ) { - SetFontForeground( FONT_MCOLOR_LTYELLOW ); + SetFontForeground( FONT_MCOLOR_LTYELLOW ); } else { - SetFontForeground( FONT_MCOLOR_WHITE ); + SetFontForeground( FONT_MCOLOR_WHITE ); } mprintf( gExitDialog.sX + 45, gExitDialog.sY + 57, TacticalStr[ EXIT_GUI_ALL_MERCS_IN_SQUAD_STR ] ); - if ( gExitDialog.fGotoSectorDisabled ) + if ( gExitDialog.fGotoSectorDisabled ) { - SetFontForeground( FONT_MCOLOR_DKGRAY ); + SetFontForeground( FONT_MCOLOR_DKGRAY ); } - else if ( gExitDialog.fGotoSectorHilighted ) + else if ( gExitDialog.fGotoSectorHilighted ) { - SetFontForeground( FONT_MCOLOR_LTYELLOW ); + SetFontForeground( FONT_MCOLOR_LTYELLOW ); } else { - SetFontForeground( FONT_MCOLOR_WHITE ); + SetFontForeground( FONT_MCOLOR_WHITE ); } if( gExitDialog.fGotoSectorText ) @@ -687,7 +687,7 @@ void RenderSectorExitMenu( ) mprintf( gExitDialog.sX + 180, gExitDialog.sY + 45, TacticalStr[ EXIT_GUI_GOTO_SECTOR_STR ] ); } else - { //most sectors don't allow tactical traversal. Exiting results in entering the mapscreen. + { //most sectors don't allow tactical traversal. Exiting results in entering the mapscreen. mprintf( gExitDialog.sX + 180, gExitDialog.sY + 45, TacticalStr[ EXIT_GUI_GOTO_MAP_STR ] ); } @@ -722,7 +722,7 @@ void RemoveSectorExitMenu( BOOLEAN fOk ) RemoveButton( gExitDialog.uiOKButton ); RemoveButton( gExitDialog.uiCancelButton ); - + UnloadButtonImage( gExitDialog.iButtonImages ); MSYS_RemoveRegion(&(gExitDialog.BackRegion) ); @@ -751,8 +751,8 @@ void RemoveSectorExitMenu( BOOLEAN fOk ) // Check if there are more than one in this squad if ( gExitDialog.ubNumPeopleOnSquad == 0 ) { - swprintf( Str, pMessageStrings[ MSG_EPC_CANT_TRAVERSE ], MercPtrs[ gusSelectedSoldier ]->name ); - + swprintf( Str, pMessageStrings[ MSG_EPC_CANT_TRAVERSE ], MercPtrs[ gusSelectedSoldier ]->name ); + DoMessageBox( MSG_BOX_BASIC_STYLE, Str, GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_OK, NULL, NULL ); return; } @@ -763,34 +763,34 @@ void RemoveSectorExitMenu( BOOLEAN fOk ) // Handle the effects here! if ( gExitDialog.fAllMove && gExitDialog.fGotoSector && gExitDialog.fGotoSectorText ) { - JumpIntoAdjacentSector( gExitDialog.ubDirection, JUMP_ALL_LOAD_NEW, gExitDialog.sAdditionalData ); + JumpIntoAdjacentSector( gExitDialog.ubDirection, JUMP_ALL_LOAD_NEW, gExitDialog.sAdditionalData ); return; } //KM : August 6, 1999 Patch fix - // Added the !gExitDialog.fGotoSectorText to the conditions to prevent the player from LOADING an - // adjacent sector (this only happens when instant traversal is overriden because of a battle in progress - // in the previous sector + // Added the !gExitDialog.fGotoSectorText to the conditions to prevent the player from LOADING an + // adjacent sector (this only happens when instant traversal is overriden because of a battle in progress + // in the previous sector if ( gExitDialog.fAllMove && ( !gExitDialog.fGotoSector || !gExitDialog.fGotoSectorText ) ) { // Here, move all men out of sector but don't load new one... - JumpIntoAdjacentSector( gExitDialog.ubDirection, JUMP_ALL_NO_LOAD, gExitDialog.sAdditionalData ); + JumpIntoAdjacentSector( gExitDialog.ubDirection, JUMP_ALL_NO_LOAD, gExitDialog.sAdditionalData ); } if ( gExitDialog.fSingleMove && gExitDialog.fGotoSector && gExitDialog.fGotoSectorText ) { - JumpIntoAdjacentSector( gExitDialog.ubDirection, JUMP_SINGLE_LOAD_NEW, gExitDialog.sAdditionalData ); + JumpIntoAdjacentSector( gExitDialog.ubDirection, JUMP_SINGLE_LOAD_NEW, gExitDialog.sAdditionalData ); return; } //KM : August 6, 1999 Patch fix - // Added the !gExitDialog.fGotoSectorText to the conditions to prevent the player from LOADING an - // adjacent sector (this only happens when instant traversal is overriden because of a battle in progress - // in the previous sector + // Added the !gExitDialog.fGotoSectorText to the conditions to prevent the player from LOADING an + // adjacent sector (this only happens when instant traversal is overriden because of a battle in progress + // in the previous sector if ( gExitDialog.fSingleMove && ( !gExitDialog.fGotoSector || !gExitDialog.fGotoSectorText ) ) { // Here, move all men out of sector but don't load new one... - JumpIntoAdjacentSector( gExitDialog.ubDirection, JUMP_SINGLE_NO_LOAD, gExitDialog.sAdditionalData ); + JumpIntoAdjacentSector( gExitDialog.ubDirection, JUMP_SINGLE_NO_LOAD, gExitDialog.sAdditionalData ); } } @@ -863,7 +863,7 @@ void SingleMoveCallback(GUI_BUTTON *btn, INT32 reason ) SingleMoveAction(); } } - + void AllMoveCallback(GUI_BUTTON *btn, INT32 reason ) { @@ -880,7 +880,7 @@ void OKCallback(GUI_BUTTON *btn, INT32 reason ) { btn->uiFlags |= BUTTON_CLICKED_ON; } - else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); @@ -897,7 +897,7 @@ void CancelCallback(GUI_BUTTON *btn, INT32 reason ) { btn->uiFlags |= BUTTON_CLICKED_ON; } - else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); diff --git a/Tactical/Strategic Exit GUI.h b/Tactical/Strategic Exit GUI.h index 013e560f..c1c8b062 100644 --- a/Tactical/Strategic Exit GUI.h +++ b/Tactical/Strategic Exit GUI.h @@ -12,7 +12,7 @@ enum enum { LEAVE_SECTOR_GOTO_SECTOR_NOT_DISABLED, //Shows helptext for checkbox explaining what will happen if button is checked - LEAVE_SECTOR_GOTO_MAP_NOT_DISABLED, //Same as previous, but uses "map" instead of "sector". + LEAVE_SECTOR_GOTO_MAP_NOT_DISABLED, //Same as previous, but uses "map" instead of "sector". LEAVE_SECTOR_DISABLED_BECAUSE_MULTIPLE_SQUADS_IN_HOSTILE_SECTOR, //Self-explanatory }; diff --git a/Tactical/Structure Wrap.cpp b/Tactical/Structure Wrap.cpp index f144ab54..eca7bd16 100644 --- a/Tactical/Structure Wrap.cpp +++ b/Tactical/Structure Wrap.cpp @@ -200,7 +200,7 @@ BOOLEAN IsDoorVisibleAtGridNo( INT16 sGridNo ) } - } + } // Return true here, even if she does not exist return( TRUE ); @@ -217,7 +217,7 @@ BOOLEAN DoesGridnoContainHiddenStruct( INT16 sGridNo, BOOLEAN *pfVisible ) //if ( pStructure != NULL ) //{ - // if ( !(gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) && !(gTacticalStatus.uiFlags&SHOW_ALL_MERCS) ) + // if ( !(gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) && !(gTacticalStatus.uiFlags&SHOW_ALL_MERCS) ) // { // *pfVisible = FALSE; // } @@ -263,7 +263,7 @@ BOOLEAN WallExistsOfTopLeftOrientation( INT16 sGridNo ) { return( TRUE ); } - + pStructure = FindNextStructure( pStructure, STRUCTURE_WALL ); } @@ -310,7 +310,7 @@ BOOLEAN WallOrClosedDoorExistsOfTopLeftOrientation( INT16 sGridNo ) return( TRUE ); } } - + pStructure = FindNextStructure( pStructure, STRUCTURE_WALLSTUFF ); } @@ -335,7 +335,7 @@ BOOLEAN WallOrClosedDoorExistsOfTopRightOrientation( INT16 sGridNo ) return( TRUE ); } } - + pStructure = FindNextStructure( pStructure, STRUCTURE_WALLSTUFF ); } @@ -359,7 +359,7 @@ BOOLEAN OpenRightOrientedDoorWithDoorOnRightOfEdgeExists( INT16 sGridNo ) return( TRUE ); } } - + pStructure = FindNextStructure( pStructure, STRUCTURE_ANYDOOR ); } @@ -383,7 +383,7 @@ BOOLEAN OpenLeftOrientedDoorWithDoorOnLeftOfEdgeExists( INT16 sGridNo ) return( TRUE ); } } - + pStructure = FindNextStructure( pStructure, STRUCTURE_ANYDOOR ); } @@ -406,7 +406,7 @@ STRUCTURE * FindCuttableWireFenceAtGridNo( INT16 sGridNo ) BOOLEAN CutWireFence( INT16 sGridNo ) { STRUCTURE * pStructure; - + pStructure = FindCuttableWireFenceAtGridNo( sGridNo ); if (pStructure) { @@ -441,7 +441,7 @@ BOOLEAN IsRepairableStructAtGridNo( INT16 sGridNo, UINT8 *pubID ) if ( ubMerc != NOBODY ) { - if ( MercPtrs[ ubMerc ]->uiStatusFlags & SOLDIER_VEHICLE ) + if ( MercPtrs[ ubMerc ]->flags.uiStatusFlags & SOLDIER_VEHICLE ) { return( 2 ); } @@ -473,7 +473,7 @@ BOOLEAN IsRefuelableStructAtGridNo( INT16 sGridNo, UINT8 *pubID ) if ( ubMerc != NOBODY ) { - if ( MercPtrs[ ubMerc ]->uiStatusFlags & SOLDIER_VEHICLE ) + if ( MercPtrs[ ubMerc ]->flags.uiStatusFlags & SOLDIER_VEHICLE ) { return( TRUE ); } @@ -567,4 +567,4 @@ BOOLEAN SetOpenableStructureToClosed( INT16 sGridNo, UINT8 ubLevel ) } // else leave it as is! return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/Tactical All.h b/Tactical/Tactical All.h index 6bf473cb..0f53a310 100644 --- a/Tactical/Tactical All.h +++ b/Tactical/Tactical All.h @@ -178,9 +178,9 @@ #include "Strategic Merc Handler.h" #include "Militia Control.h" #include "Queen Command.h" -#include "editscreen.h" +#include "editscreen.h" #include "soldier tile.h" -#ifdef NETWORKED +#ifdef NETWORKED #include "Networking.h" #include "NetworkEvent.h" #endif diff --git a/Tactical/Tactical Save.cpp b/Tactical/Tactical Save.cpp index 34da1e75..e5b44c45 100644 --- a/Tactical/Tactical Save.cpp +++ b/Tactical/Tactical Save.cpp @@ -5,7 +5,6 @@ #include "Types.h" #include "MemMan.h" #include "message.h" - #include "Item Types.h" #include "Items.h" #include "Handle Items.h" #include "StrategicMap.h" @@ -26,7 +25,6 @@ #include "Game Clock.h" #include "Animation Control.h" #include "Map Information.h" - //#include "pathai.h" #include "SaveLoadMap.h" #include "debug.h" #include "Random.h" @@ -53,6 +51,9 @@ BOOLEAN gfWasInMeanwhile = FALSE; +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; /////////////////////////////////////////////////////////////// // @@ -76,7 +77,7 @@ typedef struct UINT16 usGoToGridno; -} TempNPCQuoteInfoSave; +} TempNPCQuoteInfoSave; @@ -93,8 +94,6 @@ typedef struct /////////////////////////////////////////////////////////////// -extern UINT32 guiNumWorldItems; - extern NPCQuoteInfo * gpNPCQuoteInfoArray[NUM_PROFILES]; extern UINT32 guiJA2EncryptionSet; @@ -282,7 +281,7 @@ BOOLEAN SaveMapTempFilesToSavedGameFile( HWFILE hFile ) return FALSE; } - + //Save the door table to the saved game file if( TempNode->uiFlags & SF_DOOR_TABLE_TEMP_FILES_EXISTS ) { @@ -330,7 +329,7 @@ BOOLEAN SaveMapTempFilesToSavedGameFile( HWFILE hFile ) //ttt - + TempNode = TempNode->next; } @@ -338,6 +337,8 @@ BOOLEAN SaveMapTempFilesToSavedGameFile( HWFILE hFile ) return( TRUE ); } +extern int gEnemyPreservedTempFileVersion[256]; +extern int gCivPreservedTempFileVersion[256]; // LoadMapTempFilesFromSavedGameFile() loads all the temp files from the saved game file and writes them into the temp directory BOOLEAN LoadMapTempFilesFromSavedGameFile( HWFILE hFile ) @@ -350,7 +351,7 @@ BOOLEAN LoadMapTempFilesFromSavedGameFile( HWFILE hFile ) // HACK FOR GABBY - if ( (gTacticalStatus.uiFlags & LOADING_SAVED_GAME) && guiSaveGameVersion < 81 ) + if ( (gTacticalStatus.uiFlags & LOADING_SAVED_GAME) && guiCurrentSaveGameVersion < 81 ) { if ( gMercProfiles[ GABBY ].bMercStatus != MERC_IS_DEAD ) { @@ -390,6 +391,14 @@ BOOLEAN LoadMapTempFilesFromSavedGameFile( HWFILE hFile ) //sync up the temp file data to the sector structure data SynchronizeItemTempFileVisbleItemsToSectorInfoVisbleItems( sMapX, sMapY, 0, TRUE ); + + if (guiCurrentSaveGameVersion != SAVE_GAME_VERSION) + { + for (int z = 0; z < 4; ++z) + { + UpdateWorldItemsTempFile(sMapX, sMapY, z); + } + } } if( SectorInfo[ SECTOR( sMapX,sMapY) ].uiFlags & SF_ROTTING_CORPSE_TEMP_FILE_EXISTS ) @@ -428,6 +437,7 @@ BOOLEAN LoadMapTempFilesFromSavedGameFile( HWFILE hFile ) { if ( !RetrieveTempFileFromSavedGame( hFile, SF_ENEMY_PRESERVED_TEMP_FILE_EXISTS, sMapX, sMapY, 0 ) ) return FALSE; + gEnemyPreservedTempFileVersion[SECTOR( sMapX,sMapY)] = guiCurrentSaveGameVersion; } if( SectorInfo[ SECTOR( sMapX,sMapY) ].uiFlags & SF_CIV_PRESERVED_TEMP_FILE_EXISTS ) @@ -435,7 +445,7 @@ BOOLEAN LoadMapTempFilesFromSavedGameFile( HWFILE hFile ) if ( !RetrieveTempFileFromSavedGame( hFile, SF_CIV_PRESERVED_TEMP_FILE_EXISTS, sMapX, sMapY, 0 ) ) return FALSE; - if ( (gTacticalStatus.uiFlags & LOADING_SAVED_GAME) && guiSaveGameVersion < 78 ) + if ( (gTacticalStatus.uiFlags & LOADING_SAVED_GAME) && guiCurrentSaveGameVersion < 78 ) { CHAR8 pMapName[ 128 ]; @@ -447,6 +457,8 @@ BOOLEAN LoadMapTempFilesFromSavedGameFile( HWFILE hFile ) SectorInfo[ SECTOR( sMapX,sMapY) ].uiFlags &= (~SF_CIV_PRESERVED_TEMP_FILE_EXISTS); } + + gCivPreservedTempFileVersion[SECTOR( sMapX,sMapY)] = guiCurrentSaveGameVersion; } if( SectorInfo[ SECTOR( sMapX,sMapY) ].uiFlags & SF_SMOKE_EFFECTS_TEMP_FILE_EXISTS ) @@ -529,7 +541,7 @@ BOOLEAN LoadMapTempFilesFromSavedGameFile( HWFILE hFile ) { if ( !RetrieveTempFileFromSavedGame( hFile, SF_CIV_PRESERVED_TEMP_FILE_EXISTS, TempNode->ubSectorX, TempNode->ubSectorY, TempNode->ubSectorZ ) ) return FALSE; - if ( (gTacticalStatus.uiFlags & LOADING_SAVED_GAME) && guiSaveGameVersion < 78 ) + if ( (gTacticalStatus.uiFlags & LOADING_SAVED_GAME) && guiCurrentSaveGameVersion < 78 ) { CHAR8 pMapName[ 128 ]; @@ -563,9 +575,65 @@ BOOLEAN LoadMapTempFilesFromSavedGameFile( HWFILE hFile ) } +BOOLEAN UpdateWorldItemsTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) +{ + UINT32 uiTotalNumberOfItems=0; + WORLDITEM* pTotalSectorList = NULL; + BOOLEAN fReturn = GetNumberOfWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, &( uiTotalNumberOfItems ), FALSE ); + if (fReturn == false) + { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("GetNumberOfWorldItemsFromTempItemFile failed" ) ); + Assert( fReturn ); + } + + if( uiTotalNumberOfItems > 0 ) + { + // allocate space for the list + pTotalSectorList = new WORLDITEM[ uiTotalNumberOfItems ]; + + LoadWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, pTotalSectorList ); + int backup = guiCurrentSaveGameVersion; + guiCurrentSaveGameVersion = SAVE_GAME_VERSION; + SaveWorldItemsToTempItemFile( sMapX, sMapY, bMapZ, uiTotalNumberOfItems, pTotalSectorList); + guiCurrentSaveGameVersion = backup; + } + // if anything was alloced, then get rid of it + if( pTotalSectorList != NULL ) + { + delete[]( pTotalSectorList ); + pTotalSectorList = NULL; + } + + return TRUE; +} + +/* +BOOLEAN UpdateENEMYTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) +{ + NewWayOfSavingEnemyAndCivliansToTempFile( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, TRUE, TRUE ); + NewWayOfSavingEnemyAndCivliansToTempFile( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, FALSE, TRUE ); + LoadWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, pTotalSectorList ); + int backup = guiCurrentSaveGameVersion; + guiCurrentSaveGameVersion = SAVE_GAME_VERSION; + SaveWorldItemsToTempItemFile( sMapX, sMapY, bMapZ, uiTotalNumberOfItems, pTotalSectorList); + guiCurrentSaveGameVersion = backup; +} + + +BOOLEAN UpdateCIVTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) +{ + LoadWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, pTotalSectorList ); + int backup = guiCurrentSaveGameVersion; + guiCurrentSaveGameVersion = SAVE_GAME_VERSION; + SaveWorldItemsToTempItemFile( sMapX, sMapY, bMapZ, uiTotalNumberOfItems, pTotalSectorList); + guiCurrentSaveGameVersion = backup; + return TRUE; +} +*/ + BOOLEAN SaveWorldItemsToTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ, UINT32 uiNumberOfItems, WORLDITEM *pData ) { HWFILE hFile; @@ -593,11 +661,10 @@ BOOLEAN SaveWorldItemsToTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ, UINT //if there are items to save.. - if( uiNumberOfItems != 0 ) + for (unsigned int x = 0; x < uiNumberOfItems; ++x) { //Save the ITem array - FileWrite( hFile, pData, uiNumberOfItems * sizeof( WORLDITEM ), &uiNumBytesWritten ); - if( uiNumBytesWritten != uiNumberOfItems * sizeof( WORLDITEM ) ) + if ( !pData[x].Save(hFile, FALSE) ) { //Error Writing size of array to disk FileClose( hFile ); @@ -652,12 +719,14 @@ BOOLEAN LoadWorldItemsFromTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ, WO } // Load the World ITem table - FileRead( hFile, pData, uiNumberOfItems * sizeof( WORLDITEM ), &uiNumBytesRead ); - if( uiNumBytesRead != uiNumberOfItems * sizeof( WORLDITEM ) ) + for (unsigned int x = 0; x < uiNumberOfItems; ++x) { - //Error Writing size of array to disk - FileClose( hFile ); - return( FALSE ); + if ( !pData[x].Load(hFile) ) + { + //Error Writing size of array to disk + FileClose( hFile ); + return( FALSE ); + } } FileClose( hFile ); @@ -681,7 +750,8 @@ BOOLEAN GetNumberOfWorldItemsFromTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bM { if( fIfEmptyCreate ) { - WORLDITEM TempWorldItems[ 10 ]; + //ADB: I don't know why we are initing 10 WORLDITEMS then saving them, but that's what the code was. + WORLDITEM TempWorldItems[ 10 ]; UINT32 uiNumberOfItems = 10; UINT32 uiNumBytesWritten=0; @@ -693,8 +763,6 @@ BOOLEAN GetNumberOfWorldItemsFromTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bM return( FALSE ); } - memset( TempWorldItems, 0, ( sizeof( WORLDITEM ) * 10 ) ); - //write the the number of item in the maps item file FileWrite( hFile, &uiNumberOfItems, sizeof( UINT32 ), &uiNumBytesWritten ); if( uiNumBytesWritten != sizeof( UINT32 ) ) @@ -705,12 +773,14 @@ BOOLEAN GetNumberOfWorldItemsFromTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bM } //write the the number of item in the maps item file - FileWrite( hFile, TempWorldItems, uiNumberOfItems * sizeof( WORLDITEM ), &uiNumBytesWritten ); - if( uiNumBytesWritten != uiNumberOfItems * sizeof( WORLDITEM ) ) + for (unsigned int x = 0; x < uiNumberOfItems; ++x) { - //Error Writing size of array to disk - FileClose( hFile ); - return( FALSE ); + if ( !TempWorldItems[x].Save(hFile, FALSE) ) + { + //Error Writing size of array to disk + FileClose( hFile ); + return( FALSE ); + } } //Close the file @@ -767,21 +837,18 @@ BOOLEAN AddItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT16 sG } //Allocate memeory for the item - pWorldItems = (WORLDITEM *) MemAlloc( sizeof( WORLDITEM ) * uiNumberOfItems ); + pWorldItems = new WORLDITEM[uiNumberOfItems]; if( pWorldItems == NULL ) { //Error Allocating memory for the temp item array return( FALSE ); } - //Clear the memory - memset( pWorldItems, 0, sizeof( WORLDITEM ) * uiNumberOfItems ); - //Load in the sectors Item Info if( !LoadWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, pWorldItems ) ) { - //error reading in the items from the Item mod file - MemFree( pWorldItems ); + //error reading in the items from the Item mod file + delete[] pWorldItems; return( FALSE ); } @@ -813,12 +880,17 @@ BOOLEAN AddItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT16 sG if( cnt == ( uiNumberOfItems ) ) { //Error, there wasnt a free spot. Reallocate memory for the array - pWorldItems = (WORLDITEM *) MemRealloc( pWorldItems, sizeof( WORLDITEM ) * (uiNumberOfItems + 1 ) ); - if( pWorldItems == NULL ) + WORLDITEM* pTemp = new WORLDITEM[uiNumberOfItems + 1]; + if( pTemp == NULL ) { //error realloctin memory return( FALSE ); } + for (unsigned int x = 0; x < uiNumberOfItems; ++x) { + pTemp[x] = pWorldItems[x]; + } + delete[] pWorldItems; + pWorldItems = pTemp; //Increment the total number of item in the array uiNumberOfItems++; @@ -841,11 +913,11 @@ BOOLEAN AddItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT16 sG pWorldItems[ cnt ].usFlags |= WORLD_ITEM_GRIDNO_NOT_SET_USE_ENTRY_POINT; // Display warning..... - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Error: Trying to add item ( %d: %s ) to invalid gridno in unloaded sector. Please Report.", pWorldItems[ cnt ].o.usItem, ItemNames[pWorldItems[ cnt ].o.usItem] ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Error: Trying to add item ( %d: %s ) to invalid gridno in unloaded sector. Please Report.", pWorldItems[ cnt ].object.usItem, ItemNames[pWorldItems[ cnt ].object.usItem] ); } - - memcpy( &(pWorldItems[ cnt ].o), &pObject[uiLoop1], sizeof( OBJECTTYPE ) ); + + pWorldItems[ cnt ].object = pObject[uiLoop1]; } //Save the Items to the the file @@ -853,7 +925,7 @@ BOOLEAN AddItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT16 sG //Free the memory used to load in the item array - MemFree( pWorldItems ); + delete[]( pWorldItems ); return( TRUE ); } @@ -883,7 +955,7 @@ BOOLEAN SaveCurrentSectorsInformationToTempItemFile( ) //Save the Blood, smell and the revealed status for map elements SaveBloodSmellAndRevealedStatesFromMapToTempFile(); - + // handle all reachable before save HandleAllReachAbleItemsInTheSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); @@ -903,7 +975,7 @@ BOOLEAN SaveCurrentSectorsInformationToTempItemFile( ) return( FALSE ); } - //save the Doortable array to the temp door map file + //save the Doortable array to the temp door map file if( !SaveDoorTableToDoorTableTempFile( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ) ) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("SaveCurrentSectorsInformationToTempItemFile: failed in SaveDoorTableToDoorTableTempFile()" ) ); @@ -1020,7 +1092,7 @@ void HandleAllReachAbleItemsInTheSector( INT16 sSectorX, INT16 sSectorY, INT8 bS AssertMsg( 0, String( "Map %c%d_b%d does not have any entry points!", 'A' + gWorldSectorY - 1, gWorldSectorX, gbWorldSectorZ ) ); return; } - + if ( gMapInformation.sIsolatedGridNo != -1 ) { sGridNo2 = gMapInformation.sIsolatedGridNo; @@ -1028,9 +1100,9 @@ void HandleAllReachAbleItemsInTheSector( INT16 sSectorX, INT16 sSectorY, INT8 bS for( uiCounter = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; uiCounter < gTacticalStatus.Team[ gbPlayerNum ].bLastID; uiCounter++ ) { pSoldier = MercPtrs[ uiCounter ]; - if ( pSoldier && pSoldier->bActive && pSoldier->bLife > 0 && pSoldier->sSectorX == sSectorX && pSoldier->sSectorY == sSectorY && pSoldier->bSectorZ == bSectorZ ) + if ( pSoldier && pSoldier->bActive && pSoldier->stats.bLife > 0 && pSoldier->sSectorX == sSectorX && pSoldier->sSectorY == sSectorY && pSoldier->bSectorZ == bSectorZ ) { - if ( FindBestPath( pSoldier, sGridNo2, pSoldier->bLevel, WALKING, NO_COPYROUTE, 0 ) ) + if ( FindBestPath( pSoldier, sGridNo2, pSoldier->pathing.bLevel, WALKING, NO_COPYROUTE, 0 ) ) { fSecondary = TRUE; break; @@ -1049,10 +1121,9 @@ void HandleAllReachAbleItemsInTheSector( INT16 sSectorX, INT16 sSectorY, INT8 bS for( uiCounter = 0; uiCounter < guiNumWorldItems; uiCounter++ ) { - // reset reachablity fReachable = FALSE; - + // item doesn't exist, ignore it if( gWorldItems[ uiCounter ].fExists == FALSE ) { @@ -1060,7 +1131,7 @@ void HandleAllReachAbleItemsInTheSector( INT16 sSectorX, INT16 sSectorY, INT8 bS } // if the item is trapped then flag it as unreachable, period - if ( gWorldItems[ uiCounter ].o.bTrap > 0 ) + if ( gWorldItems[ uiCounter ].object[0]->data.bTrap > 0 ) { fReachable = FALSE; } @@ -1068,7 +1139,7 @@ void HandleAllReachAbleItemsInTheSector( INT16 sSectorX, INT16 sSectorY, INT8 bS { fReachable = FALSE; } - else if ( gWorldItems[ uiCounter ].o.usItem == CHALICE ) + else if ( gWorldItems[ uiCounter ].object.usItem == CHALICE ) { fReachable = FALSE; } @@ -1077,7 +1148,7 @@ void HandleAllReachAbleItemsInTheSector( INT16 sSectorX, INT16 sSectorY, INT8 bS // the gridno itself is reachable so the item is reachable fReachable = TRUE; } - else if ( gWorldItems[ uiCounter ].ubLevel > 0 ) + else if ( gWorldItems[ uiCounter ].ubLevel > 0 ) { // items on roofs are always reachable fReachable = TRUE; @@ -1090,7 +1161,7 @@ void HandleAllReachAbleItemsInTheSector( INT16 sSectorX, INT16 sSectorY, INT8 bS sNewLoc = NewGridNo( gWorldItems[ uiCounter ].sGridNo, DirectionInc( ubDir ) ); if ( sNewLoc != gWorldItems[ uiCounter ].sGridNo ) { - // then it's a valid gridno, so test it + // then it's a valid gridno, so test it // requires non-wall movement cost from one location to the other! if ( gpWorldLevelData[ sNewLoc ].uiFlags & MAPELEMENT_REACHABLE ) { @@ -1199,7 +1270,7 @@ BOOLEAN LoadCurrentSectorsInformationFromTempItemsFile() //if the save is an older version, use the old way of loading it up - if( guiSavedGameVersion < 57 ) + if( guiCurrentSaveGameVersion < 57 ) { if( DoesTempFileExistsForMap( SF_ENEMY_PRESERVED_TEMP_FILE_EXISTS, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ) ) { @@ -1282,8 +1353,8 @@ void SetLastTimePlayerWasInSector() //loop through and look for the right underground sector while( pTempNode ) { - if( ( pTempNode->ubSectorX == gWorldSectorX ) && - ( pTempNode->ubSectorY == gWorldSectorY ) && + if( ( pTempNode->ubSectorX == gWorldSectorX ) && + ( pTempNode->ubSectorY == gWorldSectorY ) && ( pTempNode->ubSectorZ == gbWorldSectorZ ) ) { //set the flag indicating that ther is a temp item file exists for the sector @@ -1313,8 +1384,8 @@ UINT32 GetLastTimePlayerWasInSector() //loop through and look for the right underground sector while( pTempNode ) { - if( ( pTempNode->ubSectorX == gWorldSectorX ) && - ( pTempNode->ubSectorY == gWorldSectorY ) && + if( ( pTempNode->ubSectorX == gWorldSectorX ) && + ( pTempNode->ubSectorY == gWorldSectorY ) && ( pTempNode->ubSectorZ == gbWorldSectorZ ) ) { //set the flag indicating that ther is a temp item file exists for the sector @@ -1351,7 +1422,7 @@ BOOLEAN LoadAndAddWorldItemsFromTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) if( uiNumberOfItems ) { - pWorldItems = (WORLDITEM *) MemAlloc( sizeof( WORLDITEM ) * uiNumberOfItems ); + pWorldItems = new WORLDITEM[ uiNumberOfItems ]; if( pWorldItems == NULL ) { //Error Allocating memory for the temp item array @@ -1378,13 +1449,10 @@ BOOLEAN LoadAndAddWorldItemsFromTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) return( TRUE ); } - //Clear the memory - memset( pWorldItems, 0, sizeof( WORLDITEM ) * uiNumberOfItems ); - //Load the World Items from the file if( !LoadWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, pWorldItems ) ) { - MemFree( pWorldItems ); + delete[]( pWorldItems ); return( FALSE ); } @@ -1432,11 +1500,11 @@ BOOLEAN LoadAndAddWorldItemsFromTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) } //add the item to the world - AddItemToPool( pWorldItems[cnt].sGridNo, &pWorldItems[cnt].o, pWorldItems[cnt].bVisible, pWorldItems[cnt].ubLevel, pWorldItems[cnt].usFlags, pWorldItems[cnt].bRenderZHeightAboveLevel ); + AddItemToPool( pWorldItems[cnt].sGridNo, &pWorldItems[cnt].object, pWorldItems[cnt].bVisible, pWorldItems[cnt].ubLevel, pWorldItems[cnt].usFlags, pWorldItems[cnt].bRenderZHeightAboveLevel, pWorldItems[cnt].soldierID ); } } - MemFree( pWorldItems ); + delete[]( pWorldItems ); return( TRUE ); } @@ -1580,7 +1648,7 @@ BOOLEAN SaveRottingCorpsesToTempCorpseFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ // Set the flag indicating that there is a rotting corpse Temp File // SectorInfo[ SECTOR( sMapX,sMapY) ].uiFlags |= SF_ROTTING_CORPSE_TEMP_FILE_EXISTS; SetSectorFlag( sMapX, sMapY, bMapZ, SF_ROTTING_CORPSE_TEMP_FILE_EXISTS ); - + return( TRUE ); } @@ -1591,7 +1659,7 @@ BOOLEAN DeleteTempItemMapFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) // CHAR8 zTempName[ 128 ]; CHAR8 zMapName[ 128 ]; - // grab the sector id + // grab the sector id bSectorId = SECTOR( sMapX, sMapY ); /* //Convert the current sector location into a file name @@ -1627,7 +1695,7 @@ BOOLEAN LoadRottingCorpsesFromTempCorpseFile( INT16 sMapX, INT16 sMapY, INT8 bMa BOOLEAN fDontAddCorpse = FALSE; INT8 bTownId; - + //Delete the existing rotting corpse array RemoveCorpses( ); /* @@ -1764,7 +1832,6 @@ BOOLEAN LoadRottingCorpsesFromTempCorpseFile( INT16 sMapX, INT16 sMapY, INT8 bMa BOOLEAN AddWorldItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT16 sGridNo, UINT32 uiNumberOfItemsToAdd, WORLDITEM *pWorldItem, BOOLEAN fOverWrite ) { UINT32 uiLoop; - BOOLEAN fLoop=fOverWrite; UINT32 uiLastItemPos; UINT32 uiNumberOfItems; WORLDITEM *pWorldItems; @@ -1776,21 +1843,18 @@ BOOLEAN AddWorldItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT } //Allocate memory for the item - pWorldItems = (WORLDITEM *) MemAlloc( sizeof( WORLDITEM ) * uiNumberOfItems ); + pWorldItems = new WORLDITEM[ uiNumberOfItems ]; if( pWorldItems == NULL ) { //Error Allocating memory for the temp item array return( FALSE ); } - //Clear the memory - memset( pWorldItems, 0, sizeof( WORLDITEM ) * uiNumberOfItems ); - //Load in the sectors Item Info if( !LoadWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, pWorldItems ) ) { - //error reading in the items from the Item mod file - MemFree( pWorldItems ); + //error reading in the items from the Item mod file + delete[] pWorldItems; return( FALSE ); } @@ -1824,12 +1888,18 @@ BOOLEAN AddWorldItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT if( uiLastItemPos == ( uiNumberOfItems ) ) { //Error, there wasnt a free spot. Reallocate memory for the array - pWorldItems = (WORLDITEM *) MemRealloc( pWorldItems, sizeof( WORLDITEM ) * (uiNumberOfItems + 1 ) ); - if( pWorldItems == NULL ) + WORLDITEM* pTemp; + pTemp = new WORLDITEM [uiNumberOfItems + 1]; + if( pTemp == NULL ) { //error realloctin memory return( FALSE ); } + for (unsigned int x = 0; x < uiNumberOfItems; ++x) { + pTemp[x] = pWorldItems[x]; + } + delete[] pWorldItems; + pWorldItems = pTemp; //Increment the total number of item in the array uiNumberOfItems++; @@ -1849,11 +1919,11 @@ BOOLEAN AddWorldItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT pWorldItems[ uiLastItemPos ].usFlags |= WORLD_ITEM_GRIDNO_NOT_SET_USE_ENTRY_POINT; // Display warning..... - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Error: Trying to add item ( %d: %s ) to invalid gridno in unloaded sector. Please Report.", pWorldItems[ uiLoop ].o.usItem, ItemNames[pWorldItems[ uiLoop ].o.usItem] ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Error: Trying to add item ( %d: %s ) to invalid gridno in unloaded sector. Please Report.", pWorldItems[ uiLoop ].object.usItem, ItemNames[pWorldItems[ uiLoop ].object.usItem] ); } - - memcpy( &(pWorldItems[ uiLastItemPos ].o), &pWorldItem[ uiLoop ].o, sizeof( OBJECTTYPE ) ); + + pWorldItems[ uiLastItemPos ].object = pWorldItem[ uiLoop ].object; } //Save the Items to the the file @@ -1861,7 +1931,7 @@ BOOLEAN AddWorldItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT //Free the memory used to load in the item array - MemFree( pWorldItems ); + delete[]( pWorldItems ); #if 0 // The old excruciatingly inefficient code @@ -1870,8 +1940,8 @@ BOOLEAN AddWorldItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT //If the item exists if( pWorldItem[uiLoop].fExists ) { - AddItemsToUnLoadedSector( sMapX, sMapY, bMapZ, pWorldItem[uiLoop].sGridNo, 1, &pWorldItem[ uiLoop ].o, pWorldItem[ uiLoop ].ubLevel, pWorldItem[ uiLoop ].usFlags, pWorldItem[ uiLoop ].bRenderZHeightAboveLevel, pWorldItem[ uiLoop ].bVisible, fLoop ); - + AddItemsToUnLoadedSector( sMapX, sMapY, bMapZ, pWorldItem[uiLoop].sGridNo, 1, &pWorldItem[ uiLoop ].object, pWorldItem[ uiLoop ].ubLevel, pWorldItem[ uiLoop ].usFlags, pWorldItem[ uiLoop ].bRenderZHeightAboveLevel, pWorldItem[ uiLoop ].bVisible, fLoop ); + fLoop = FALSE; } } @@ -1882,7 +1952,7 @@ BOOLEAN AddWorldItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT void SaveNPCInformationToProfileStruct( ) { - UINT32 cnt; + UINT32 cnt; SOLDIERTYPE * pSoldier; MERCPROFILESTRUCT * pProfile; @@ -1893,9 +1963,9 @@ void SaveNPCInformationToProfileStruct( ) { return; } - + for ( cnt = 0; cnt < guiNumMercSlots; cnt++) - { + { pSoldier = MercSlots[ cnt ]; //if it is an active NPC @@ -1915,7 +1985,7 @@ void SaveNPCInformationToProfileStruct( ) continue; } - if ( pProfile->ubMiscFlags3 & PROFILE_MISC_FLAG3_PERMANENT_INSERTION_CODE ) + if ( pProfile->ubMiscFlags3 & PROFILE_MISC_FLAG3_PERMANENT_INSERTION_CODE ) { continue; } @@ -1931,9 +2001,9 @@ void SaveNPCInformationToProfileStruct( ) else { // If the NPC is moving, save the final destination, else save the current location - if ( pSoldier->sFinalDestination != pSoldier->sGridNo ) + if ( pSoldier->pathing.sFinalDestination != pSoldier->sGridNo ) { - pProfile->usStrategicInsertionData = pSoldier->sFinalDestination; + pProfile->usStrategicInsertionData = pSoldier->pathing.sFinalDestination; } else { @@ -1958,7 +2028,7 @@ void LoadNPCInformationFromProfileStruct() return; /* commented out the disabled code (jonathanl) for ( cnt = FIRST_RPC; cnt < NUM_PROFILES; cnt++ ) - { + { if ( gMercProfiles[ cnt ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) { // don't load @@ -1981,7 +2051,7 @@ void LoadNPCInformationFromProfileStruct() LoadTempNpcQuoteInfoForNPCFromTempFile( (UINT8)cnt ); } - // load insertion info + // load insertion info //if ( gMercProfiles[ cnt ] ) //{ // pSoldier->ubInsertionCode = pProfile->ubStrategicInsertionCode; @@ -1993,7 +2063,7 @@ void LoadNPCInformationFromProfileStruct() /* INT16 sX, sY; - UINT16 cnt; + UINT16 cnt; SOLDIERTYPE *pSoldier; INT16 sSoldierID; INT16 sXPos, sYPos; @@ -2003,7 +2073,7 @@ void LoadNPCInformationFromProfileStruct() //Loop through the active NPC's // cnt = gTacticalStatus.Team[ OUR_TEAM ].bLastID + 1; for(cnt=FIRST_RPC; cntsGridNo == pSoldier->sFinalDestination ) + if( pSoldier->sGridNo == pSoldier->pathing.sFinalDestination ) { if (pSoldier->ubQuoteRecord && pSoldier->ubQuoteActionID == QUOTE_ACTION_ID_CHECKFORDEST ) { //the mercs gridno has to be the same as the final destination - EVENT_SetSoldierPosition( pSoldier, (FLOAT) sX, (FLOAT) sY ); + pSoldier->EVENT_SetSoldierPosition( (FLOAT) sX, (FLOAT) sY ); NPCReachedDestination( pSoldier, FALSE ); } @@ -2056,9 +2126,9 @@ void LoadNPCInformationFromProfileStruct() if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { //Set the NPC's destination - pSoldier->sDestination = gMercProfiles[ cnt ].sGridNo; - pSoldier->sDestXPos = sXPos; - pSoldier->sDestYPos = sYPos; + pSoldier->pathing.sDestination = gMercProfiles[ cnt ].sGridNo; + pSoldier->pathing.sDestXPos = sXPos; + pSoldier->pathing.sDestYPos = sYPos; // We have moved to a diferent sector and are returning to it, therefore the merc should be in the final dest EVENT_SetSoldierPositionAndMaybeFinalDestAndMaybeNotDestination( pSoldier, (FLOAT) sX, (FLOAT) sY, FALSE, TRUE ); @@ -2069,7 +2139,7 @@ void LoadNPCInformationFromProfileStruct() { //Set the NPC's position - // EVENT_SetSoldierPosition( pSoldier, (FLOAT) sX, (FLOAT) sY ); + // pSoldier->EVENT_SetSoldierPosition( (FLOAT) sX, (FLOAT) sY ); EVENT_SetSoldierPositionAndMaybeFinalDestAndMaybeNotDestination( pSoldier, (FLOAT) sX, (FLOAT) sY, FALSE, FALSE ); } } @@ -2116,11 +2186,11 @@ BOOLEAN GetNumberOfActiveWorldItemsFromTempFile( INT16 sMapX, INT16 sMapY, INT8 break; } - + TempNode = TempNode->next; } } - + if( fFileLoaded ) { //Get the number of items from the file @@ -2133,16 +2203,13 @@ BOOLEAN GetNumberOfActiveWorldItemsFromTempFile( INT16 sMapX, INT16 sMapY, INT8 //If there items in the data file if( uiNumberOfItems != 0 ) { - pWorldItems = (WORLDITEM *) MemAlloc( sizeof( WORLDITEM ) * uiNumberOfItems ); + pWorldItems = new WORLDITEM[ uiNumberOfItems ]; if( pWorldItems == NULL ) { //Error Allocating memory for the temp item array return( FALSE ); } - //Clear the memory - memset( pWorldItems, 0, sizeof( WORLDITEM ) * uiNumberOfItems ); - //Load the World Items from the file if( !LoadWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, pWorldItems ) ) return( FALSE ); @@ -2153,7 +2220,7 @@ BOOLEAN GetNumberOfActiveWorldItemsFromTempFile( INT16 sMapX, INT16 sMapY, INT8 if( pWorldItems[cnt].fExists ) uiNumberOfActive++; } - MemFree( pWorldItems ); + delete[]( pWorldItems ); } *pNumberOfData = uiNumberOfActive; } @@ -2198,9 +2265,9 @@ INT16 GetSoldierIDFromAnyMercID(UINT8 ubMercID) ubLastTeamID = TOTAL_SOLDIERS; - // look for all mercs on the same team, + // look for all mercs on the same team, for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= ubLastTeamID; cnt++,pTeamSoldier++) - { + { if( pTeamSoldier->bActive ) { if ( pTeamSoldier->ubProfile == ubMercID ) @@ -2216,13 +2283,11 @@ INT16 GetSoldierIDFromAnyMercID(UINT8 ubMercID) -//Initializes the NPC temp array +//Initializes the NPC temp array BOOLEAN InitTempNpcQuoteInfoForNPCFromTempFile() { UINT32 uiNumBytesWritten; UINT8 ubCnt; - UINT8 ubOne=1; - UINT8 ubZero=0; TempNPCQuoteInfoSave TempNpcQuote[ NUM_NPC_QUOTE_RECORDS ]; UINT32 uiSizeOfTempArray = sizeof( TempNPCQuoteInfoSave ) * NUM_NPC_QUOTE_RECORDS; UINT16 usCnt1; @@ -2249,7 +2314,7 @@ BOOLEAN InitTempNpcQuoteInfoForNPCFromTempFile() { if( gpNPCQuoteInfoArray[ usCnt1 ] ) { - TempNpcQuote[ ubCnt ].usFlags = gpNPCQuoteInfoArray[ usCnt1 ][ ubCnt ].fFlags; + TempNpcQuote[ ubCnt ].usFlags = gpNPCQuoteInfoArray[ usCnt1 ][ ubCnt ].fFlags; TempNpcQuote[ ubCnt ].sRequiredItem = gpNPCQuoteInfoArray[ usCnt1 ][ ubCnt ].sRequiredItem; TempNpcQuote[ ubCnt ].usGoToGridno = gpNPCQuoteInfoArray[ usCnt1 ][ ubCnt ].usGoToGridno; } @@ -2259,7 +2324,7 @@ BOOLEAN InitTempNpcQuoteInfoForNPCFromTempFile() FileWrite( hFile, TempNpcQuote, uiSizeOfTempArray, &uiNumBytesWritten ); if( uiNumBytesWritten != uiSizeOfTempArray ) { - FileClose( hFile ); + FileClose( hFile ); return( FALSE ); } } @@ -2274,8 +2339,6 @@ BOOLEAN SaveTempNpcQuoteInfoForNPCToTempFile( UINT8 ubNpcId ) { UINT32 uiNumBytesWritten; UINT8 ubCnt; - UINT8 ubOne=1; - UINT8 ubZero=0; TempNPCQuoteInfoSave TempNpcQuote[ NUM_NPC_QUOTE_RECORDS ]; UINT32 uiSizeOfTempArray = sizeof( TempNPCQuoteInfoSave ) * NUM_NPC_QUOTE_RECORDS; UINT32 uiSpotInFile = ubNpcId - FIRST_RPC; @@ -2297,7 +2360,7 @@ BOOLEAN SaveTempNpcQuoteInfoForNPCToTempFile( UINT8 ubNpcId ) //Loop through and build the temp array to save for( ubCnt=0; ubCntubSectorX == (UINT8)sSectorX ) && - ( pTempNode->ubSectorY == (UINT8)sSectorY ) && + if( ( pTempNode->ubSectorX == (UINT8)sSectorX ) && + ( pTempNode->ubSectorY == (UINT8)sSectorY ) && ( pTempNode->ubSectorZ == ubSectorZ ) ) { //set the flag indicating that ther is a temp item file exists for the sector @@ -2537,8 +2598,8 @@ BOOLEAN ReSetUnderGroundSectorFlag( INT16 sSectorX, INT16 sSectorY, UINT8 ubSect //loop through and look for the right underground sector while( pTempNode ) { - if( ( pTempNode->ubSectorX == (UINT8)sSectorX ) && - ( pTempNode->ubSectorY == (UINT8)sSectorY ) && + if( ( pTempNode->ubSectorX == (UINT8)sSectorX ) && + ( pTempNode->ubSectorY == (UINT8)sSectorY ) && ( pTempNode->ubSectorZ == ubSectorZ ) ) { //set the flag indicating that ther is a temp item file exists for the sector @@ -2561,8 +2622,8 @@ BOOLEAN GetUnderGroundSectorFlagStatus( INT16 sSectorX, INT16 sSectorY, UINT8 ub //loop through and look for the right underground sector while( pTempNode ) { - if( ( pTempNode->ubSectorX == (UINT8)sSectorX ) && - ( pTempNode->ubSectorY == (UINT8)sSectorY ) && + if( ( pTempNode->ubSectorX == (UINT8)sSectorX ) && + ( pTempNode->ubSectorY == (UINT8)sSectorY ) && ( pTempNode->ubSectorZ == ubSectorZ ) ) { //set the flag indicating that ther is a temp item file exists for the sector @@ -2652,10 +2713,6 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S FALLBACK_HIT_DEATH, PRONE_HIT_DEATH, FLYBACK_HIT_DEATH }; - const UINT8 ubNumOfDeaths=4; - - - //setup the flags for the items and the rotting corpses if( uiFlags & ADD_DEAD_SOLDIER_USE_GRIDNO ) { @@ -2664,7 +2721,7 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S } else if( uiFlags & ADD_DEAD_SOLDIER_TO_SWEETSPOT ) - { + { uiFlagsForWorldItems |= WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO | WORLD_ITEM_REACHABLE; usFlagsForRottingCorpse |= ROTTING_CORPSE_FIND_SWEETSPOT_FROM_GRIDNO; } @@ -2679,9 +2736,9 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S //go through and and find out how many items there are uiNumberOfItems = 0; - for ( i = 0; i < NUM_INV_SLOTS; i++ ) - { - if( pSoldier->inv[ i ].usItem != 0 ) + for ( i = 0; i < pSoldier->inv.size(); i++ ) + { + if( pSoldier->inv[ i ].exists() == true ) { // if not a player soldier if ( pSoldier->bTeam != gbPlayerNum ) @@ -2713,20 +2770,18 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S if( uiNumberOfItems ) { //allocate memory for the world item array - pWorldItems = (WORLDITEM *) MemAlloc( sizeof( WORLDITEM ) * uiNumberOfItems ); + pWorldItems = new WORLDITEM[ uiNumberOfItems ]; if( pWorldItems == NULL ) { //Error Allocating memory for the temp item array return( FALSE ); } - //Clear the memory - memset( pWorldItems, 0, sizeof( WORLDITEM ) * uiNumberOfItems ); //loop through all the soldiers items and add them to the world item array bCount = 0; - for ( i = 0; i < NUM_INV_SLOTS; i++ ) - { - if( pSoldier->inv[ i ].usItem != 0 ) + for ( i = 0; i < pSoldier->inv.size(); i++ ) + { + if( pSoldier->inv[ i ].exists() == true ) { //if the item can be dropped if( !(pSoldier->inv[ i ].fFlags & OBJECT_UNDROPPABLE) || pSoldier->bTeam == gbPlayerNum ) @@ -2735,17 +2790,17 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S pWorldItems[ bCount ].fExists = TRUE; pWorldItems[ bCount ].sGridNo = sGridNo; - pWorldItems[ bCount ].ubLevel = (UINT8)pSoldier->bLevel; + pWorldItems[ bCount ].ubLevel = (UINT8)pSoldier->pathing.bLevel; pWorldItems[ bCount ].usFlags = uiFlagsForWorldItems; pWorldItems[ bCount ].bVisible = TRUE; pWorldItems[ bCount ].bRenderZHeightAboveLevel = 0; if ( Item[pSoldier->inv[i].usItem].damageable ) // Madd: drop crappier items on higher difficulty levels { - pSoldier->inv[i].ItemData.Generic.bStatus[0] -= (gGameOptions.ubDifficultyLevel - 1) * Random(20); - pSoldier->inv[i].ItemData.Generic.bStatus[0] = max(pSoldier->inv[i].ItemData.Generic.bStatus[0],1); // never below 1% + pSoldier->inv[i][0]->data.objectStatus -= (gGameOptions.ubDifficultyLevel - 1) * Random(20); + pSoldier->inv[i][0]->data.objectStatus = max(pSoldier->inv[i][0]->data.objectStatus,1); // never below 1% } - pWorldItems[ bCount ].o = pSoldier->inv[i]; + pWorldItems[ bCount ].object = pSoldier->inv[i]; bCount++; } } @@ -2755,10 +2810,10 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S AddWorldItemsToUnLoadedSector( sMapX, sMapY, bMapZ, sGridNo, uiNumberOfItems, pWorldItems, FALSE ); } - DropKeysInKeyRing( pSoldier, sGridNo, pSoldier->bLevel, 1, FALSE, 0, TRUE ); + DropKeysInKeyRing( pSoldier, sGridNo, pSoldier->pathing.bLevel, 1, FALSE, 0, TRUE ); // - //Convert the soldier into a rottng corpse + //Convert the soldier into a rottng corpse // memset( &Corpse, 0, sizeof( ROTTING_CORPSE_DEFINITION ) ); @@ -2802,7 +2857,7 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S AddRottingCorpseToUnloadedSectorsRottingCorpseFile( sMapX, sMapY, bMapZ, &Corpse); //FRee the memory used for the pWorldItem array - MemFree( pWorldItems ); + delete[]( pWorldItems ); pWorldItems = NULL; return( TRUE ); @@ -2831,72 +2886,34 @@ void InitExitGameDialogBecauseFileHackDetected() SGPRect CenteringRect= {0, 0, 639, 479 }; // do message box and return - giErrorMessageBox = DoMessageBox( MSG_BOX_BASIC_STYLE, pAntiHackerString[ ANTIHACKERSTR_EXITGAME ], + giErrorMessageBox = DoMessageBox( MSG_BOX_BASIC_STYLE, pAntiHackerString[ ANTIHACKERSTR_EXITGAME ], GAME_SCREEN, MSG_BOX_FLAG_OK, TempFileLoadErrorMessageReturnCallback, &CenteringRect ); } - - -UINT32 MercChecksum( SOLDIERTYPE * pSoldier ) +// CHRISL: New Checksum for LBENODE +UINT32 LBENODEChecksum( LBENODE * pNode ) { UINT32 uiChecksum = 1; UINT32 uiLoop; - uiChecksum += (pSoldier->bLife + 1); - uiChecksum *= (pSoldier->bLifeMax + 1); - uiChecksum += (pSoldier->bAgility + 1); - uiChecksum *= (pSoldier->bDexterity + 1); - uiChecksum += (pSoldier->bStrength + 1); - uiChecksum *= (pSoldier->bMarksmanship + 1); - uiChecksum += (pSoldier->bMedical + 1); - uiChecksum *= (pSoldier->bMechanical + 1); - uiChecksum += (pSoldier->bExplosive + 1); + uiChecksum += (pNode->lbeClass + 1); + uiChecksum *= (pNode->lbeIndex +1); + uiChecksum += (pNode->ubID +1); - // put in some multipliers too! - uiChecksum *= (pSoldier->bExpLevel + 1); - uiChecksum += (pSoldier->ubProfile + 1); - - for ( uiLoop = 0; uiLoop < NUM_INV_SLOTS; uiLoop++ ) + for ( uiLoop = 0; uiLoop < pNode->inv.size(); uiLoop++ ) { - uiChecksum += pSoldier->inv[ uiLoop ].usItem; - uiChecksum += pSoldier->inv[ uiLoop ].ubNumberOfObjects; + uiChecksum += pNode->inv[ uiLoop ].usItem; } return( uiChecksum ); } -UINT32 ProfileChecksum( MERCPROFILESTRUCT * pProfile ) -{ - UINT32 uiChecksum = 1; - UINT32 uiLoop; - - uiChecksum += (pProfile->bLife + 1); - uiChecksum *= (pProfile->bLifeMax + 1); - uiChecksum += (pProfile->bAgility + 1); - uiChecksum *= (pProfile->bDexterity + 1); - uiChecksum += (pProfile->bStrength + 1); - uiChecksum *= (pProfile->bMarksmanship + 1); - uiChecksum += (pProfile->bMedical + 1); - uiChecksum *= (pProfile->bMechanical + 1); - uiChecksum += (pProfile->bExplosive + 1); - - // put in some multipliers too! - uiChecksum *= (pProfile->bExpLevel + 1); - - for ( uiLoop = 0; uiLoop < NUM_INV_SLOTS; uiLoop++ ) - { - uiChecksum += pProfile->inv[ uiLoop ]; - uiChecksum += pProfile->bInvNumber[ uiLoop ]; - } - - return( uiChecksum ); -} //UINT8 gubEncryptionArray4[ BASE_NUMBER_OF_ROTATION_ARRAYS * 3 ][ NEW_ROTATION_ARRAY_SIZE ] = UINT8 * GetRotationArray( void ) { // based on guiJA2EncryptionSet - if ( guiJA2EncryptionSet < BASE_NUMBER_OF_ROTATION_ARRAYS * 6 ) + if ( guiJA2EncryptionSet < BASE_NUMBER_OF_ROTATION_ARRAYS * 6 ) { if ( guiJA2EncryptionSet < BASE_NUMBER_OF_ROTATION_ARRAYS * 3 ) { @@ -2963,7 +2980,7 @@ BOOLEAN NewJA2EncryptedFileWrite( HWFILE hFile, PTR pDest, UINT32 uiBytesToWrite UINT8 * pubRotationArray; pMemBlock = (UINT8 *) MemAlloc( uiBytesToWrite ); - + if ( !pMemBlock ) { return( FALSE ); @@ -2972,7 +2989,7 @@ BOOLEAN NewJA2EncryptedFileWrite( HWFILE hFile, PTR pDest, UINT32 uiBytesToWrite pubRotationArray = GetRotationArray(); - memcpy( pMemBlock, pDest, uiBytesToWrite ); + memcpy( pMemBlock, pDest, uiBytesToWrite ); for ( uiLoop = 0; uiLoop < uiBytesToWrite; uiLoop++ ) { pMemBlock[ uiLoop ] += ubLastByte + pubRotationArray[ ubArrayIndex ]; @@ -3037,7 +3054,7 @@ BOOLEAN JA2EncryptedFileWrite( HWFILE hFile, PTR pDest, UINT32 uiBytesToWrite, U BOOLEAN fRet; pMemBlock = (UINT8 *) MemAlloc( uiBytesToWrite ); - + if ( !pMemBlock ) { return( FALSE ); @@ -3045,7 +3062,7 @@ BOOLEAN JA2EncryptedFileWrite( HWFILE hFile, PTR pDest, UINT32 uiBytesToWrite, U memset( pMemBlock, 0, uiBytesToWrite ); - memcpy( pMemBlock, pDest, uiBytesToWrite ); + memcpy( pMemBlock, pDest, uiBytesToWrite ); for ( uiLoop = 0; uiLoop < uiBytesToWrite; uiLoop++ ) { //ubTemp = pMemBlock[ uiLoop ]; @@ -3128,7 +3145,7 @@ void GetMapTempFileName( UINT32 uiType, STR pMapName, INT16 sMapX, INT16 sMapY, case SF_CIV_PRESERVED_TEMP_FILE_EXISTS: // NB save game version 0 is "saving game" - if ( (gTacticalStatus.uiFlags & LOADING_SAVED_GAME) && guiSaveGameVersion != 0 && guiSaveGameVersion < 78 ) + if ( (gTacticalStatus.uiFlags & LOADING_SAVED_GAME) && guiCurrentSaveGameVersion != 0 && guiCurrentSaveGameVersion < 78 ) { sprintf( pMapName, "%s\\c_%s", MAPS_DIR, zTempName); } @@ -3221,39 +3238,47 @@ void SynchronizeItemTempFileVisbleItemsToSectorInfoVisbleItems( INT16 sMapX, INT // get total number, visable and invisible fReturn = GetNumberOfActiveWorldItemsFromTempFile( sMapX, sMapY, bMapZ, &( uiTotalNumberOfRealItems ) ); - Assert( fReturn ); + if (fReturn == false) + { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("GetNumberOfActiveWorldItemsFromTempFile failed" ) ); + Assert( fReturn ); + } fReturn = GetNumberOfWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, &( uiTotalNumberOfItems ), FALSE ); - Assert( fReturn ); + if (fReturn == false) + { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("GetNumberOfWorldItemsFromTempItemFile failed" ) ); + Assert( fReturn ); + } if( uiTotalNumberOfItems > 0 ) { // allocate space for the list - pTotalSectorList = (WORLDITEM *) MemAlloc( sizeof( WORLDITEM ) * uiTotalNumberOfItems ); + pTotalSectorList = new WORLDITEM[ uiTotalNumberOfItems ]; // now load into mem LoadWorldItemsFromTempItemFile( sMapX, sMapY, bMapZ, pTotalSectorList ); } - // now run through list and + // now run through list and for( iCounter = 0; ( UINT32 )( iCounter )< uiTotalNumberOfRealItems; iCounter++ ) { // if visible to player, then state fact if( IsMapScreenWorldItemVisibleInMapInventory( &pTotalSectorList[ iCounter ] ) ) { - uiItemCount += pTotalSectorList[ iCounter ].o.ubNumberOfObjects; + uiItemCount += pTotalSectorList[ iCounter ].object.ubNumberOfObjects; } } - + // if anything was alloced, then get rid of it if( pTotalSectorList != NULL ) { - MemFree( pTotalSectorList ); + delete[]( pTotalSectorList ); pTotalSectorList = NULL; } - #ifdef JA2BETAVERSION - if( fLoadingGame && guiSaveGameVersion >= 86 ) + #ifdef JA2BETAVERSION + if( fLoadingGame && guiCurrentSaveGameVersion >= 86 ) { UINT32 uiReported = GetNumberOfVisibleWorldItemsFromSectorStructureForSector( sMapX, sMapY, bMapZ ); @@ -3281,11 +3306,11 @@ UINT32 UpdateLoadedSectorsItemInventory( INT16 sMapX, INT16 sMapY, INT8 bMapZ, U if( IsMapScreenWorldItemVisibleInMapInventory( &gWorldItems[ uiCounter ] ) ) { //increment - uiItemCounter += gWorldItems[ uiCounter ].o.ubNumberOfObjects; + uiItemCounter += gWorldItems[ uiCounter ].object.ubNumberOfObjects; } } - //if the item count is DIFFERENT + //if the item count is DIFFERENT if( uiItemCounter != uiNumberOfItems ) { //Update the value in the sector info struct diff --git a/Tactical/Tactical Save.h b/Tactical/Tactical Save.h index 25afd534..b58d0265 100644 --- a/Tactical/Tactical Save.h +++ b/Tactical/Tactical Save.h @@ -49,6 +49,9 @@ BOOLEAN LoadCurrentSectorsInformationFromTempItemsFile(); // Loads a World Item array from that sectors temp item file BOOLEAN LoadWorldItemsFromTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ, WORLDITEM *pData ); +//When the savegame version changes, load the temp files, then immediately save them again in the new format +BOOLEAN UpdateWorldItemsTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ ); + // Adds an array of Item Objects to the specified location on a unloaded map. // If you want to overwrite all the items in the array set fReplaceEntireFile to TRUE. BOOLEAN AddItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT16 sGridNo, UINT32 uiNumberOfItems, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 bVisible, BOOLEAN fReplaceEntireFile ); @@ -99,8 +102,11 @@ BOOLEAN LoadTempNpcQuoteArrayToSaveGameFile( HWFILE hFile ); //Loads the NPC temp Quote file from the saved game file BOOLEAN SaveTempNpcQuoteArrayToSaveGameFile( HWFILE hFile ); +//LBE node stuff UINT32 MercChecksum( SOLDIERTYPE * pSoldier ); UINT32 ProfileChecksum( MERCPROFILESTRUCT * pProfile ); +UINT32 LBENODEChecksum( LBENODE * pNode ); + BOOLEAN JA2EncryptedFileRead( HWFILE hFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead ); BOOLEAN JA2EncryptedFileWrite( HWFILE hFile, PTR pDest, UINT32 uiBytesToWrite, UINT32 *puiBytesWritten ); diff --git a/Tactical/Tactical Turns.cpp b/Tactical/Tactical Turns.cpp index 2756e95d..a4571784 100644 --- a/Tactical/Tactical Turns.cpp +++ b/Tactical/Tactical Turns.cpp @@ -42,14 +42,14 @@ extern UINT8 NumEnemyInSector(); -void HandleRPCDescription( ) +void HandleRPCDescription( ) { UINT8 ubMercsInSector[ 20 ] = { 0 }; UINT8 ubNumMercs = 0; UINT8 ubChosenMerc; SOLDIERTYPE *pTeamSoldier; INT32 cnt2; - BOOLEAN fSAMSite = FALSE; + BOOLEAN fSAMSite = FALSE; if ( !gTacticalStatus.fCountingDownForGuideDescription ) @@ -57,27 +57,27 @@ void HandleRPCDescription( ) return; } - // ATE: postpone if we are not in tactical - if ( guiCurrentScreen != GAME_SCREEN ) - { - return; - } + // ATE: postpone if we are not in tactical + if ( guiCurrentScreen != GAME_SCREEN ) + { + return; + } - if ( ( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) ) - { - return; - } + if ( ( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) ) + { + return; + } - // Are we a SAM site? - if ( gTacticalStatus.ubGuideDescriptionToUse == 27 || - gTacticalStatus.ubGuideDescriptionToUse == 30 || - gTacticalStatus.ubGuideDescriptionToUse == 32 || - gTacticalStatus.ubGuideDescriptionToUse == 25 || - gTacticalStatus.ubGuideDescriptionToUse == 31 ) - { - fSAMSite = TRUE; - gTacticalStatus.bGuideDescriptionCountDown = 1; - } + // Are we a SAM site? + if ( gTacticalStatus.ubGuideDescriptionToUse == 27 || + gTacticalStatus.ubGuideDescriptionToUse == 30 || + gTacticalStatus.ubGuideDescriptionToUse == 32 || + gTacticalStatus.ubGuideDescriptionToUse == 25 || + gTacticalStatus.ubGuideDescriptionToUse == 31 ) + { + fSAMSite = TRUE; + gTacticalStatus.bGuideDescriptionCountDown = 1; + } // ATE; Don't do in combat if ( ( gTacticalStatus.uiFlags & INCOMBAT ) && !fSAMSite ) @@ -95,12 +95,12 @@ void HandleRPCDescription( ) gTacticalStatus.bGuideDescriptionCountDown--; if ( gTacticalStatus.bGuideDescriptionCountDown == 0 ) - { + { gTacticalStatus.fCountingDownForGuideDescription = FALSE; // OK, count how many rpc guys we have.... // set up soldier ptr as first element in mercptrs list - cnt2 = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + cnt2 = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list for ( pTeamSoldier = MercPtrs[ cnt2 ]; cnt2 <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt2++,pTeamSoldier++ ) @@ -108,15 +108,15 @@ void HandleRPCDescription( ) // Add guy if he's a candidate... if ( RPC_RECRUITED( pTeamSoldier ) ) { - if ( pTeamSoldier->bLife >= OKLIFE && pTeamSoldier->bActive && - pTeamSoldier->sSectorX == gTacticalStatus.bGuideDescriptionSectorX && pTeamSoldier->sSectorY == gTacticalStatus.bGuideDescriptionSectorY && - pTeamSoldier->bSectorZ == gbWorldSectorZ && - !pTeamSoldier->fBetweenSectors ) - { - if ( pTeamSoldier->ubProfile == IRA || - pTeamSoldier->ubProfile == MIGUEL || - pTeamSoldier->ubProfile == CARLOS || - pTeamSoldier->ubProfile == DIMITRI ) + if ( pTeamSoldier->stats.bLife >= OKLIFE && pTeamSoldier->bActive && + pTeamSoldier->sSectorX == gTacticalStatus.bGuideDescriptionSectorX && pTeamSoldier->sSectorY == gTacticalStatus.bGuideDescriptionSectorY && + pTeamSoldier->bSectorZ == gbWorldSectorZ && + !pTeamSoldier->flags.fBetweenSectors ) + { + if ( pTeamSoldier->ubProfile == IRA || + pTeamSoldier->ubProfile == MIGUEL || + pTeamSoldier->ubProfile == CARLOS || + pTeamSoldier->ubProfile == DIMITRI ) { ubMercsInSector[ ubNumMercs ] = (UINT8)cnt2; ubNumMercs++; @@ -131,17 +131,17 @@ void HandleRPCDescription( ) ubChosenMerc = (UINT8)Random( ubNumMercs ); TacticalCharacterDialogueWithSpecialEvent( MercPtrs[ ubMercsInSector[ ubChosenMerc ] ], gTacticalStatus.ubGuideDescriptionToUse, DIALOGUE_SPECIAL_EVENT_USE_ALTERNATE_FILES, 0, 0 ); - } + } } } void HandleTacticalEndTurn( ) -{ +{ UINT32 cnt; SOLDIERTYPE *pSoldier; UINT32 uiTime; - static UINT32 uiTimeSinceLastStrategicUpdate = 0; + static UINT32 uiTimeSinceLastStrategicUpdate = 0; // OK, Do a number of things here.... // Every few turns...... @@ -149,13 +149,13 @@ void HandleTacticalEndTurn( ) // Get time elasped uiTime = GetWorldTotalSeconds( ); - if ( ( uiTimeSinceLastStrategicUpdate - uiTime ) > 1200 ) - { + if ( ( uiTimeSinceLastStrategicUpdate - uiTime ) > 1200 ) + { HandleRottingCorpses( ); - //DecayTacticalMoraleModifiers(); + //DecayTacticalMoraleModifiers(); - uiTimeSinceLastStrategicUpdate = uiTime; - } + uiTimeSinceLastStrategicUpdate = uiTime; + } DecayBombTimers( ); @@ -173,11 +173,11 @@ void HandleTacticalEndTurn( ) DecayRottingCorpseAIWarnings(); //Check for enemy pooling (add enemies if there happens to be more than the max in the - //current battle. If one or more slots have freed up, we can add them now. + //current battle. If one or more slots have freed up, we can add them now. AddPossiblePendingEnemiesToBattle(); AddPossiblePendingMilitiaToBattle(); - + // Loop through each active team and decay public opplist... // May want this done every few times too NonCombatDecayPublicOpplist( uiTime ); @@ -187,8 +187,8 @@ void HandleTacticalEndTurn( ) if ( gTacticalStatus.Team[ cnt ].bMenInSector > 0 ) { // decay team's public opplist - DecayPublicOpplist( (INT8)cnt ); - } + DecayPublicOpplist( (INT8)cnt ); + } } */ @@ -196,13 +196,13 @@ void HandleTacticalEndTurn( ) // Loop through our own mercs: // Check things like ( even if not in our sector ) // 1 ) All updates of breath, shock, bleeding, etc - // 2 ) Updating First AID, etc - // ( If in our sector: ) + // 2 ) Updating First AID, etc + // ( If in our sector: ) // 3 ) Update things like decayed opplist, etc // Second pass: - // Loop through all mercs in tactical engine - // If not a player merc ( ubTeam ) , do things like 1 , 2 , 3 above + // Loop through all mercs in tactical engine + // If not a player merc ( ubTeam ) , do things like 1 , 2 , 3 above // First exit if we are not in realtime combat or realtime noncombat @@ -213,11 +213,11 @@ void HandleTacticalEndTurn( ) cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) - { - if ( pSoldier->bActive && pSoldier->bLife > 0 && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && !( AM_A_ROBOT( pSoldier ) ) ) + { + if ( pSoldier->bActive && pSoldier->stats.bLife > 0 && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !( AM_A_ROBOT( pSoldier ) ) ) { // Handle everything from getting breath back, to bleeding, etc - EVENT_BeginMercTurn( pSoldier, TRUE, 0 ); + pSoldier->EVENT_BeginMercTurn( TRUE, 0 ); // Handle Player services HandlePlayerServices( pSoldier ); @@ -250,8 +250,8 @@ void HandleTacticalEndTurn( ) if ( pSoldier->bTeam != gbPlayerNum ) { // Handle everything from getting breath back, to bleeding, etc - EVENT_BeginMercTurn( pSoldier, TRUE, 0 ); - + pSoldier->EVENT_BeginMercTurn( TRUE, 0 ); + // Handle Player services HandlePlayerServices( pSoldier ); } @@ -264,3 +264,4 @@ void HandleTacticalEndTurn( ) } + diff --git a/Tactical/Tactical.vcproj b/Tactical/Tactical.vcproj index d1f0bb8f..290d45c5 100644 --- a/Tactical/Tactical.vcproj +++ b/Tactical/Tactical.vcproj @@ -390,7 +390,7 @@ FavorSizeOrSpeed="1" OptimizeForProcessor="3" OptimizeForWindowsApplication="TRUE" - AdditionalIncludeDirectories=""..\Standard Gaming Platform";..\TileEngine;..\;..\Utils;..\tacticalai;..\Editor;..\strategic;..\Laptop;.\;..\lua" + AdditionalIncludeDirectories=""..\Standard Gaming Platform";..\TileEngine;..\;..\Utils;..\tacticalai;..\Editor;..\strategic;..\Laptop;.\" PreprocessorDefinitions="CALLBACKTIMER;PRECOMPILEDHEADERS;NDEBUG;WIN32;_WINDOWS;JA2;XML_STATIC;CINTERFACE" StringPooling="TRUE" RuntimeLibrary="0" diff --git a/Tactical/Tactical_2005Express.vcproj b/Tactical/Tactical_2005Express.vcproj index 7becf421..a8f87a56 100644 --- a/Tactical/Tactical_2005Express.vcproj +++ b/Tactical/Tactical_2005Express.vcproj @@ -1,7 +1,7 @@ - + + + + + + + + + + + + + + + + + + @@ -180,6 +242,10 @@ RelativePath=".\Auto Bandage.h" > + + @@ -598,6 +664,10 @@ RelativePath=".\Inventory Choosing.cpp" > + + @@ -830,10 +900,22 @@ RelativePath=".\XML_Launchable.cpp" > + + + + + + diff --git a/Tactical/TeamTurns.cpp b/Tactical/TeamTurns.cpp index 838a9280..2ec962a6 100644 --- a/Tactical/TeamTurns.cpp +++ b/Tactical/TeamTurns.cpp @@ -2,7 +2,6 @@ #include "Tactical All.h" #else #include "types.h" - #include "soldier control.h" #include "overhead.h" #include "animation control.h" #include "points.h" @@ -51,6 +50,11 @@ #include "Reinforcement.h" +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + extern INT8 STRAIGHT; //extern UINT8 gubSpeedUpAnimationFactor; @@ -70,7 +74,7 @@ void RecalculateSoldiersAniSpeed() // if this merc is inactive, at base, on assignment, dead, unconscious if (!pSoldier) { - continue; // next merc + continue; // next merc } SetSoldierAniSpeed( pSoldier ); @@ -140,7 +144,7 @@ BOOLEAN BloodcatsPresent( void ) { pSoldier = MercPtrs[ iLoop ]; - if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife > 0 && pSoldier->ubBodyType == BLOODCAT ) + if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 && pSoldier->ubBodyType == BLOODCAT ) { return( TRUE ); } @@ -157,8 +161,8 @@ void StartPlayerTeamTurn( BOOLEAN fDoBattleSnd, BOOLEAN fEnteringCombatMode ) // EV_S_BEGINTURN SBeginTurn; // Start the turn of player charactors - - // + + // // PATCH 1.06: // // make sure set properly in gTacticalStatus: @@ -182,10 +186,10 @@ void StartPlayerTeamTurn( BOOLEAN fDoBattleSnd, BOOLEAN fEnteringCombatMode ) // Check for victory conditions // ATE: Commented out - looks like this message is called earlier for our team - // look for all mercs on the same team, + // look for all mercs on the same team, //for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) - //{ - // if ( pSoldier->bActive && pSoldier->bLife > 0 ) + //{ + // if ( pSoldier->bActive && pSoldier->stats.bLife > 0 ) // { // SBeginTurn.usSoldierID = (UINT16)cnt; // AddGameEvent( S_BEGINTURN, 0, &SBeginTurn ); @@ -194,11 +198,11 @@ void StartPlayerTeamTurn( BOOLEAN fDoBattleSnd, BOOLEAN fEnteringCombatMode ) // Are we in combat already? if ( gTacticalStatus.uiFlags & INCOMBAT ) - { + { if ( gusSelectedSoldier != NOBODY ) { // Check if this guy is able to be selected.... - if ( MercPtrs[ gusSelectedSoldier ]->bLife < OKLIFE ) + if ( MercPtrs[ gusSelectedSoldier ]->stats.bLife < OKLIFE ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("StartPlayerTeamTurn: SelectNextAvailSoldier")); SelectNextAvailSoldier( MercPtrs[ gusSelectedSoldier ] ); @@ -216,7 +220,7 @@ void StartPlayerTeamTurn( BOOLEAN fDoBattleSnd, BOOLEAN fEnteringCombatMode ) if ( fDoBattleSnd ) { // Say ATTENTION SOUND... - DoMercBattleSound( MercPtrs[ gusSelectedSoldier ], BATTLE_SOUND_ATTN1 ); + MercPtrs[ gusSelectedSoldier ]->DoMercBattleSound( BATTLE_SOUND_ATTN1 ); } if ( gsInterfaceLevel == 1 ) @@ -245,9 +249,9 @@ void StartPlayerTeamTurn( BOOLEAN fDoBattleSnd, BOOLEAN fEnteringCombatMode ) // Signal UI done enemy's turn guiPendingOverrideEvent = LU_ENDUILOCK; - // ATE: Reset killed on attack variable.. this is because sometimes timing is such - /// that a baddie can die and still maintain it's attacker ID - gTacticalStatus.fKilledEnemyOnAttack = FALSE; + // ATE: Reset killed on attack variable.. this is because sometimes timing is such + /// that a baddie can die and still maintain it's attacker ID + gTacticalStatus.fKilledEnemyOnAttack = FALSE; HandleTacticalUI( ); } @@ -269,7 +273,7 @@ void FreezeInterfaceForEnemyTurn( void ) { EndUIMessage( ); } -} +} void EndTurn( UINT8 ubNextTeam ) @@ -279,7 +283,7 @@ void EndTurn( UINT8 ubNextTeam ) INT32 cnt; //Check for enemy pooling (add enemies if there happens to be more than the max in the - //current battle. If one or more slots have freed up, we can add them now. + //current battle. If one or more slots have freed up, we can add them now. EndDeadlockMsg( ); @@ -310,11 +314,11 @@ void EndTurn( UINT8 ubNextTeam ) { if ( pSoldier->bActive ) { - pSoldier->bMoved = TRUE; + pSoldier->aiData.bMoved = TRUE; } } - gTacticalStatus.ubCurrentTeam = ubNextTeam; + gTacticalStatus.ubCurrentTeam = ubNextTeam; BeginTeamTurn( gTacticalStatus.ubCurrentTeam ); @@ -341,10 +345,10 @@ void EndAITurn( void ) { if ( pSoldier->bActive ) { - pSoldier->bMoved = TRUE; + pSoldier->aiData.bMoved = TRUE; // record old life value... for creature AI; the human AI might // want to use this too at some point - pSoldier->bOldLife = pSoldier->bLife; + pSoldier->bOldLife = pSoldier->stats.bLife; } } @@ -374,11 +378,11 @@ void EndAllAITurns( void ) { if ( pSoldier->bActive ) { - pSoldier->bMoved = TRUE; - pSoldier->uiStatusFlags &= (~SOLDIER_UNDERAICONTROL); + pSoldier->aiData.bMoved = TRUE; + pSoldier->flags.uiStatusFlags &= (~SOLDIER_UNDERAICONTROL); // record old life value... for creature AI; the human AI might // want to use this too at some point - pSoldier->bOldLife = pSoldier->bLife; + pSoldier->bOldLife = pSoldier->stats.bLife; } } @@ -415,12 +419,12 @@ void BeginTeamTurn( UINT8 ubTeam ) INT32 cnt; UINT8 ubID; SOLDIERTYPE *pSoldier; - + //rain if( !LightningEndOfTurn( ubTeam ) )return; //end rain - - + + while( 1 ) { if ( ubTeam > LAST_TEAM ) @@ -443,7 +447,7 @@ void BeginTeamTurn( UINT8 ubTeam ) ubTeam++; gTacticalStatus.ubCurrentTeam++; // skip back to the top, as we are processing another team now. - continue; + continue; } if ( gTacticalStatus.uiFlags & TURNBASED ) @@ -455,11 +459,11 @@ void BeginTeamTurn( UINT8 ubTeam ) cnt = gTacticalStatus.Team[ ubTeam ].bFirstID; for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ ubTeam ].bLastID; cnt++,pSoldier++) - { - if ( pSoldier->bActive && pSoldier->bLife > 0) + { + if ( pSoldier->bActive && pSoldier->stats.bLife > 0) { // decay personal opplist, and refresh APs and BPs - EVENT_BeginMercTurn( pSoldier, FALSE, 0 ); + pSoldier->EVENT_BeginMercTurn( FALSE, 0 ); } } @@ -493,7 +497,7 @@ void BeginTeamTurn( UINT8 ubTeam ) break; #endif - // Set First enemy merc to AI control + // Set First enemy merc to AI control if ( BuildAIListForTeam( ubTeam ) ) { @@ -554,9 +558,9 @@ void DisplayHiddenInterrupt( SOLDIERTYPE * pSoldier ) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"about to call AdjustNoAPToFinishMove"); // Stop our guy.... - AdjustNoAPToFinishMove( MercPtrs[ LATEST_INTERRUPT_GUY ], TRUE ); + MercPtrs[ LATEST_INTERRUPT_GUY ]->AdjustNoAPToFinishMove( TRUE ); // Stop him from going to prone position if doing a turn while prone - MercPtrs[ LATEST_INTERRUPT_GUY ]->bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; + MercPtrs[ LATEST_INTERRUPT_GUY ]->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"about to call AddTopMessage"); // get rid of any old overlay message @@ -593,15 +597,15 @@ void DisplayHiddenTurnbased( SOLDIERTYPE * pActingSoldier ) } // Enter combat mode starting with this side's turn - gTacticalStatus.ubCurrentTeam = pActingSoldier->bTeam; + gTacticalStatus.ubCurrentTeam = pActingSoldier->bTeam; CommonEnterCombatModeCode( ); //JA2Gold: use function to make sure flags turned off everywhere else - //pActingSoldier->uiStatusFlags |= SOLDIER_UNDERAICONTROL; - SetSoldierAsUnderAiControl( pActingSoldier ); + //pActingSoldier->flags.uiStatusFlags |= SOLDIER_UNDERAICONTROL; + pActingSoldier->SetSoldierAsUnderAiControl( ); DebugAI( String( "Giving AI control to %d", pActingSoldier->ubID ) ); - pActingSoldier->fTurnInProgress = TRUE; + pActingSoldier->flags.fTurnInProgress = TRUE; gTacticalStatus.uiTimeSinceMercAIStart = GetJA2Clock(); if ( gTacticalStatus.ubTopMessageType != COMPUTER_TURN_MESSAGE) @@ -665,7 +669,7 @@ void StartInterrupt( void ) // display everyone on int queue! for ( cnt = gubOutOfTurnPersons; cnt > 0; cnt-- ) { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("STARTINT: Q position %d: %d", cnt, gubOutOfTurnOrder[ cnt ] ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("STARTINT: Q position %d: %d", cnt, gubOutOfTurnOrder[ cnt ] ) ); } //DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("INTERRUPT: %d is now on top of the interrupt queue", ubFirstInterrupter ) ); @@ -677,8 +681,8 @@ void StartInterrupt( void ) { if ( pTempSoldier->bActive ) { - pTempSoldier->bMovedPriorToInterrupt = pTempSoldier->bMoved; - pTempSoldier->bMoved = TRUE; + pTempSoldier->bMovedPriorToInterrupt = pTempSoldier->aiData.bMoved; + pTempSoldier->aiData.bMoved = TRUE; } } @@ -692,7 +696,7 @@ void StartInterrupt( void ) // build string for display of who gets interrupt while( 1 ) { - MercPtrs[ubInterrupter]->bMoved = FALSE; + MercPtrs[ubInterrupter]->aiData.bMoved = FALSE; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("INTERRUPT: popping %d off of the interrupt queue", ubInterrupter ) ); REMOVE_LATEST_INTERRUPT_GUY(); @@ -717,7 +721,7 @@ void StartInterrupt( void ) for ( iCounter = 0; iCounter < NUMBER_OF_SOLDIERS_PER_SQUAD; iCounter++ ) { pTempSoldier = Squad[ iSquad ][ iCounter ]; - if ( pTempSoldier && pTempSoldier->bActive && pTempSoldier->bInSector && !pTempSoldier->bMoved ) + if ( pTempSoldier && pTempSoldier->bActive && pTempSoldier->bInSector && !pTempSoldier->aiData.bMoved ) { // then this guy got an interrupt... ubInterrupters++; @@ -726,7 +730,7 @@ void StartInterrupt( void ) // flush... display string, then clear it (we could have 20 names!) // add comma to end, we know we have another person after this... wcscat( sTemp, L", " ); - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, sTemp ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, sTemp ); wcscpy( sTemp, L"" ); ubInterrupters = 1; } @@ -740,7 +744,7 @@ void StartInterrupt( void ) } } - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, sTemp ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, sTemp ); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("INTERRUPT: starting interrupt for %d", ubFirstInterrupter ) ); // gusSelectedSoldier should become the topmost guy on the interrupt list @@ -748,7 +752,7 @@ void StartInterrupt( void ) // Remove deadlock message EndDeadlockMsg( ); - + // Select guy.... SelectSoldier( ubFirstInterrupter, TRUE, TRUE ); @@ -757,7 +761,7 @@ void StartInterrupt( void ) // Dirty panel interface! fInterfacePanelDirty = DIRTYLEVEL2; - gTacticalStatus.ubCurrentTeam = pSoldier->bTeam; + gTacticalStatus.ubCurrentTeam = pSoldier->bTeam; // Signal UI done enemy's turn guiPendingOverrideEvent = LU_ENDUILOCK; @@ -773,7 +777,7 @@ void StartInterrupt( void ) { if ( OK_INSECTOR_MERC( MercPtrs[ iCounter ] ) ) { - if ( MercPtrs[ iCounter ]->fCloseCall ) + if ( MercPtrs[ iCounter ]->flags.fCloseCall ) { if ( MercPtrs[ iCounter ]->bNumHitsThisTurn == 0 && !(MercPtrs[ iCounter ]->usQuoteSaidExtFlags & SOLDIER_QUOTE_SAID_EXT_CLOSE_CALL) && Random( 3 ) == 0 ) { @@ -781,7 +785,7 @@ void StartInterrupt( void ) TacticalCharacterDialogue( MercPtrs[ iCounter ], QUOTE_CLOSE_CALL ); MercPtrs[ iCounter ]->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_EXT_CLOSE_CALL; } - MercPtrs[ iCounter ]->fCloseCall = FALSE; + MercPtrs[ iCounter ]->flags.fCloseCall = FALSE; } } } @@ -798,8 +802,8 @@ void StartInterrupt( void ) { if ( pTempSoldier->bActive ) { - pTempSoldier->bMovedPriorToInterrupt = pTempSoldier->bMoved; - pTempSoldier->bMoved = TRUE; + pTempSoldier->bMovedPriorToInterrupt = pTempSoldier->aiData.bMoved; + pTempSoldier->aiData.bMoved = TRUE; } } */ @@ -807,7 +811,7 @@ void StartInterrupt( void ) while( 1 ) { - MercPtrs[ubInterrupter]->bMoved = FALSE; + MercPtrs[ubInterrupter]->aiData.bMoved = FALSE; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("INTERRUPT: popping %d off of the interrupt queue", ubInterrupter ) ); @@ -849,8 +853,8 @@ void StartInterrupt( void ) } // otherwise it's the AI interrupting another AI team - gTacticalStatus.ubCurrentTeam = pSoldier->bTeam; - + gTacticalStatus.ubCurrentTeam = pSoldier->bTeam; + #ifdef JA2BETAVERSION ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Interrupt ( could be hidden )" ); #endif @@ -861,8 +865,8 @@ void StartInterrupt( void ) if ( !gfHiddenInterrupt ) { // Stop this guy.... - AdjustNoAPToFinishMove( MercPtrs[ LATEST_INTERRUPT_GUY ], TRUE ); - MercPtrs[ LATEST_INTERRUPT_GUY ]->bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; + MercPtrs[ LATEST_INTERRUPT_GUY ]->AdjustNoAPToFinishMove( TRUE ); + MercPtrs[ LATEST_INTERRUPT_GUY ]->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; } DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"StartInterrupt done"); @@ -881,7 +885,7 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) for ( cnt = gubOutOfTurnPersons; cnt > 0; cnt-- ) { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("ENDINT: Q position %d: %d", cnt, gubOutOfTurnOrder[ cnt ] ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("ENDINT: Q position %d: %d", cnt, gubOutOfTurnOrder[ cnt ] ) ); } // ATE: OK, now if this all happended on one frame, we may not have to stop @@ -900,12 +904,12 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) cnt = gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bFirstID; for ( pTempSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bLastID; cnt++,pTempSoldier++) { - if ( pTempSoldier->bActive && pTempSoldier->bInSector && !pTempSoldier->bMoved && (pTempSoldier->bActionPoints == pTempSoldier->bIntStartAPs)) + if ( pTempSoldier->bActive && pTempSoldier->bInSector && !pTempSoldier->aiData.bMoved && (pTempSoldier->bActionPoints == pTempSoldier->aiData.bIntStartAPs)) { ubMinAPsToAttack = MinAPsToAttack( pTempSoldier, pTempSoldier->sLastTarget, FALSE ); if ( (ubMinAPsToAttack <= pTempSoldier->bActionPoints) && (ubMinAPsToAttack > 0) ) { - pTempSoldier->bPassedLastInterrupt = TRUE; + pTempSoldier->aiData.bPassedLastInterrupt = TRUE; } } } @@ -933,22 +937,22 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) // AI guys only here... if ( pTempSoldier->bActionPoints == 0 ) { - pTempSoldier->bMoved = TRUE; + pTempSoldier->aiData.bMoved = TRUE; } - else if ( pTempSoldier->bTeam != gbPlayerNum && pTempSoldier->bNewSituation == IS_NEW_SITUATION ) + else if ( pTempSoldier->bTeam != gbPlayerNum && pTempSoldier->aiData.bNewSituation == IS_NEW_SITUATION ) { - pTempSoldier->bMoved = FALSE; + pTempSoldier->aiData.bMoved = FALSE; } else { - pTempSoldier->bMoved = pTempSoldier->bMovedPriorToInterrupt; - } + pTempSoldier->aiData.bMoved = pTempSoldier->bMovedPriorToInterrupt; + } } } // change team - gTacticalStatus.ubCurrentTeam = pSoldier->bTeam; + gTacticalStatus.ubCurrentTeam = pSoldier->bTeam; // switch appropriate messages & flags if ( pSoldier->bTeam == OUR_TEAM) { @@ -960,7 +964,7 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) { if ( pTempSoldier->bActive ) { - pTempSoldier->bMoved = pTempSoldier->bMovedPriorToInterrupt; + pTempSoldier->aiData.bMoved = pTempSoldier->bMovedPriorToInterrupt; } } */ @@ -968,7 +972,7 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) ClearIntList(); // Select soldier.... - if ( MercPtrs[ ubInterruptedSoldier ]->bLife < OKLIFE ) + if ( MercPtrs[ ubInterruptedSoldier ]->stats.bLife < OKLIFE ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EndInterrupt: SelectNextAvailSoldier")); SelectNextAvailSoldier( MercPtrs[ ubInterruptedSoldier ] ); @@ -984,14 +988,14 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) gfHiddenInterrupt = FALSE; // If we can continue a move, do so! - if ( MercPtrs[ gusSelectedSoldier ]->fNoAPToFinishMove && pSoldier->ubReasonCantFinishMove != REASON_STOPPED_SIGHT ) + if ( MercPtrs[ gusSelectedSoldier ]->flags.fNoAPToFinishMove && pSoldier->ubReasonCantFinishMove != REASON_STOPPED_SIGHT ) { // Continue - AdjustNoAPToFinishMove( MercPtrs[ gusSelectedSoldier ], FALSE ); + MercPtrs[ gusSelectedSoldier ]->AdjustNoAPToFinishMove( FALSE ); - if ( MercPtrs[ gusSelectedSoldier ]->sGridNo != MercPtrs[ gusSelectedSoldier ]->sFinalDestination ) + if ( MercPtrs[ gusSelectedSoldier ]->sGridNo != MercPtrs[ gusSelectedSoldier ]->pathing.sFinalDestination ) { - EVENT_GetNewSoldierPath( MercPtrs[ gusSelectedSoldier ], MercPtrs[ gusSelectedSoldier ]->sFinalDestination, MercPtrs[ gusSelectedSoldier ]->usUIMovementMode ); + MercPtrs[ gusSelectedSoldier ]->EVENT_GetNewSoldierPath( MercPtrs[ gusSelectedSoldier ]->pathing.sFinalDestination, MercPtrs[ gusSelectedSoldier ]->usUIMovementMode ); } else { @@ -1023,7 +1027,7 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) SlideTo( NOWHERE, gusSelectedSoldier, NOBODY ,SETLOCATOR); // Say ATTENTION SOUND... - DoMercBattleSound( MercPtrs[ gusSelectedSoldier ], BATTLE_SOUND_ATTN1 ); + MercPtrs[ gusSelectedSoldier ]->DoMercBattleSound( BATTLE_SOUND_ATTN1 ); if ( gsInterfaceLevel == 1 ) { @@ -1053,15 +1057,15 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) // Reset flags gfPlotNewMovement = TRUE; - + // restart AI with first available soldier - fFound = FALSE; + fFound = FALSE; // rebuild list for this team if anyone on the team is still available cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; for ( pTempSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bLastID; cnt++,pTempSoldier++) - { - if ( pTempSoldier->bActive && pTempSoldier->bInSector && pTempSoldier->bLife >= OKLIFE ) + { + if ( pTempSoldier->bActive && pTempSoldier->bInSector && pTempSoldier->stats.bLife >= OKLIFE ) { fFound = TRUE; break; @@ -1086,7 +1090,7 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) if (cnt != NOBODY) { fFound = TRUE; - StartNPCAI( MercPtrs[ cnt ] ); + StartNPCAI( MercPtrs[ cnt ] ); } } @@ -1192,7 +1196,7 @@ BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT8 ubOpponent return(FALSE); */ pOpponent = NULL; - } + } // if interrupts have been disabled for any reason if (!InterruptsAllowed) @@ -1208,7 +1212,7 @@ BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT8 ubOpponent if (pSoldier->bTeam == gTacticalStatus.ubCurrentTeam ) { // if this is a player's a merc or civilian - if ((pSoldier->uiStatusFlags & SOLDIER_PC) || PTR_CIVILIAN) + if ((pSoldier->flags.uiStatusFlags & SOLDIER_PC) || PTR_CIVILIAN) { // then they are not allowed to interrupt their own team return(FALSE); @@ -1216,12 +1220,12 @@ BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT8 ubOpponent else { // enemies, MAY interrupt each other, but NOT themselves! - //if ( pSoldier->uiStatusFlags & SOLDIER_UNDERAICONTROL ) + //if ( pSoldier->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL ) //{ return(FALSE); //} } - + // CJC, July 9 1998 // NO ONE EVER interrupts his own team //return( FALSE ); @@ -1240,7 +1244,7 @@ BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT8 ubOpponent } // soldiers at less than OKLIFE can't perform any actions - if (pSoldier->bLife < OKLIFE) + if (pSoldier->stats.bLife < OKLIFE) { return(FALSE); } @@ -1258,14 +1262,14 @@ BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT8 ubOpponent } // soldiers gagging on gas are too busy about holding their cookies down... - if ( pSoldier->uiStatusFlags & SOLDIER_GASSED ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) { return(FALSE); } // a soldier already engaged in a life & death battle is too busy doing his // best to survive to worry about "getting the jump" on additional threats - if (pSoldier->bUnderFire) + if (pSoldier->aiData.bUnderFire) { return(FALSE); } @@ -1276,7 +1280,7 @@ BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT8 ubOpponent } // don't allow neutral folks to get interrupts - if (pSoldier->bNeutral) + if (pSoldier->aiData.bNeutral) { return( FALSE ); } @@ -1305,7 +1309,7 @@ BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT8 ubOpponent if (pSoldier->bSide == pOpponent->bSide) { // human/civilians on same side can't interrupt each other - if ((pSoldier->uiStatusFlags & SOLDIER_PC) || PTR_CIVILIAN) + if ((pSoldier->flags.uiStatusFlags & SOLDIER_PC) || PTR_CIVILIAN) { return(FALSE); } @@ -1332,7 +1336,7 @@ BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT8 ubOpponent } else { - if ( !(pOpponent->uiStatusFlags & SOLDIER_UNDERAICONTROL) && (pSoldier->bSide != pOpponent->bSide)) + if ( !(pOpponent->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL) && (pSoldier->bSide != pOpponent->bSide)) { return( FALSE ); } @@ -1353,17 +1357,17 @@ BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT8 ubOpponent // if this is a "SEEING" interrupt - if (pSoldier->bOppList[ubOpponentID] == SEEN_CURRENTLY) + if (pSoldier->aiData.bOppList[ubOpponentID] == SEEN_CURRENTLY) { // if pSoldier already saw the opponent last "look" or at least this turn if ((bOldOppList == SEEN_CURRENTLY) || (bOldOppList == SEEN_THIS_TURN)) { - return(FALSE); // no interrupt is possible + return(FALSE); // no interrupt is possible } // if the soldier is behind him and not very close, forget it bDir = atan8( pSoldier->sX, pSoldier->sY, pOpponent->sX, pOpponent->sY ); - if ( gOppositeDirection[ pSoldier->bDesiredDirection ] == bDir ) + if ( gOppositeDirection[ pSoldier->pathing.bDesiredDirection ] == bDir ) { // directly behind; allow interrupts only within # of tiles equal to level if ( PythSpacesAway( pSoldier->sGridNo, pOpponent->sGridNo ) > EffectiveExpLevel( pSoldier ) ) @@ -1371,7 +1375,7 @@ BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT8 ubOpponent return( FALSE ); } } - + // if the soldier isn't currently crouching if (!PTR_CROUCHED) { @@ -1382,14 +1386,14 @@ BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT8 ubOpponent ubMinPtsNeeded = MinPtsToMove(pSoldier); } } - else // this is a "HEARING" interrupt + else // this is a "HEARING" interrupt { // if the opponent can't see the "interrupter" either, OR // if the "interrupter" already has any opponents already in sight, OR // if the "interrupter" already heard the active soldier this turn - if ((pOpponent->bOppList[pSoldier->ubID] != SEEN_CURRENTLY) || (pSoldier->bOppCnt > 0) || (bOldOppList == HEARD_THIS_TURN)) + if ((pOpponent->aiData.bOppList[pSoldier->ubID] != SEEN_CURRENTLY) || (pSoldier->aiData.bOppCnt > 0) || (bOldOppList == HEARD_THIS_TURN)) { - return(FALSE); // no interrupt is possible + return(FALSE); // no interrupt is possible } } } @@ -1402,7 +1406,7 @@ BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT8 ubOpponent } // soldier passed on the chance to react during previous interrupt this turn - if (pSoldier->bPassedLastInterrupt) + if (pSoldier->aiData.bPassedLastInterrupt) { #ifdef RECORDNET fprintf(NetDebugFile,"\tStandardInterruptConditionsMet: FAILING because PassedLastInterrupt %d(%s)\n", @@ -1430,20 +1434,20 @@ INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT8 ubOpponentID, BOOLEAN f DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CalcInterruptDuelPts"); // extra check to make sure neutral folks never get interrupts - if (pSoldier->bNeutral) + if (pSoldier->aiData.bNeutral) { return( NO_INTERRUPT ); } // Old: BASE is one point for each experience level. // Snap: Agility should be a factor, since it is a measure of - // a person's reactions. We'll give more weight to experience + // a person's reactions. We'll give more weight to experience // though, since combat initiative is too important to be left up // to an ordinary skill like agility. // BASE = (2*lev + agi/10) / 3 // Robot has interrupt points based on the controller... // Controller's interrupt points are reduced by 2 for being distracted... - if ( pSoldier->uiStatusFlags & SOLDIER_ROBOT && CanRobotBeControlled( pSoldier ) ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT && pSoldier->CanRobotBeControlled( ) ) { //iPoints = EffectiveExpLevel( MercPtrs[ pSoldier->ubRobotRemoteHolderID ] ) - 2; // Snap: (do some proper rounding here) @@ -1465,7 +1469,7 @@ INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT8 ubOpponentID, BOOLEAN f } */ - if ( ControllingRobot( pSoldier ) ) + if ( pSoldier->ControllingRobot( ) ) { iPoints -= 2; } @@ -1474,29 +1478,29 @@ INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT8 ubOpponentID, BOOLEAN f if (fUseWatchSpots) { // if this is a previously noted spot of enemies, give bonus points! - iPoints += GetWatchedLocPoints( pSoldier->ubID, MercPtrs[ ubOpponentID ]->sGridNo, MercPtrs[ ubOpponentID ]->bLevel ); + iPoints += GetWatchedLocPoints( pSoldier->ubID, MercPtrs[ ubOpponentID ]->sGridNo, MercPtrs[ ubOpponentID ]->pathing.bLevel ); } // LOSE one point for each 2 additional opponents he currently sees, above 2 - if (pSoldier->bOppCnt > 2) + if (pSoldier->aiData.bOppCnt > 2) { // subtract 1 here so there is a penalty of 1 for seeing 3 enemies - iPoints -= (pSoldier->bOppCnt - 1) / 2; + iPoints -= (pSoldier->aiData.bOppCnt - 1) / 2; } // LOSE one point if he's trying to interrupt only by hearing - if (pSoldier->bOppList[ubOpponentID] == HEARD_THIS_TURN) + if (pSoldier->aiData.bOppList[ubOpponentID] == HEARD_THIS_TURN) { iPoints--; } // if soldier is still in shock from recent injuries, that penalizes him - iPoints -= pSoldier->bShock; + iPoints -= pSoldier->aiData.bShock; ubDistance = (UINT8) PythSpacesAway( pSoldier->sGridNo, MercPtrs[ ubOpponentID ]->sGridNo ); - // if we are in combat mode - thus doing an interrupt rather than determine who gets first turn - - // then give bonus + // if we are in combat mode - thus doing an interrupt rather than determine who gets first turn - + // then give bonus if ( (gTacticalStatus.uiFlags & INCOMBAT) && (pSoldier->bTeam != gTacticalStatus.ubCurrentTeam) ) { // passive player gets penalty due to range @@ -1506,7 +1510,7 @@ INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT8 ubOpponentID, BOOLEAN f { // either non-combat or the player with the current turn... i.e. active... // unfortunately we can't use opplist here to record whether or not we saw this guy before, because at this point - // the opplist has been updated to seen. But we can use gbSeenOpponents ... + // the opplist has been updated to seen. But we can use gbSeenOpponents ... // this soldier is moving, so give them a bonus for crawling or swatting at long distances if ( !gbSeenOpponents[ ubOpponentID ][ pSoldier->ubID ] ) @@ -1536,7 +1540,7 @@ INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT8 ubOpponentID, BOOLEAN f if ( HAS_SKILL_TRAIT( pSoldier, NIGHTOPS ) ) { - bLightLevel = LightTrueLevel(pSoldier->sGridNo, pSoldier->bLevel); + bLightLevel = LightTrueLevel(pSoldier->sGridNo, pSoldier->pathing.bLevel); if (bLightLevel > NORMAL_LIGHTLEVEL_DAY + 3) { // it's dark, give a bonus for interrupts @@ -1547,8 +1551,8 @@ INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT8 ubOpponentID, BOOLEAN f // if he's a computer soldier // CJC note: this will affect friendly AI as well... - - if ( pSoldier->uiStatusFlags & SOLDIER_PC ) + + if ( pSoldier->flags.uiStatusFlags & SOLDIER_PC ) { if ( pSoldier->bAssignment >= ON_DUTY ) { @@ -1560,7 +1564,7 @@ INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT8 ubOpponentID, BOOLEAN f // check for TRUE because -1 means we JUST saw him (always so here) if (gbSeenOpponents[pSoldier->ubID][ubOpponentID] == TRUE) { - iPoints++; // seen him before, easier to react to him + iPoints++; // seen him before, easier to react to him } } else if ( pSoldier->bTeam == ENEMY_TEAM ) @@ -1569,7 +1573,7 @@ INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT8 ubOpponentID, BOOLEAN f // check for TRUE because -1 means we JUST saw him (always so here) if (gbSeenOpponents[pSoldier->ubID][ubOpponentID] == TRUE) { - iPoints++; // seen him before, easier to react to him + iPoints++; // seen him before, easier to react to him } else if (gbPublicOpplist[pSoldier->bTeam][ubOpponentID] != NOT_HEARD_OR_SEEN) { @@ -1607,24 +1611,24 @@ BOOLEAN InterruptDuel( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOpponent) BOOLEAN fResult = FALSE; // if opponent can't currently see us and we can see them - if ( pSoldier->bOppList[ pOpponent->ubID ] == SEEN_CURRENTLY && pOpponent->bOppList[pSoldier->ubID] != SEEN_CURRENTLY ) + if ( pSoldier->aiData.bOppList[ pOpponent->ubID ] == SEEN_CURRENTLY && pOpponent->aiData.bOppList[pSoldier->ubID] != SEEN_CURRENTLY ) { - fResult = TRUE; // we automatically interrupt + fResult = TRUE; // we automatically interrupt // fix up our interrupt duel pts if necessary - if (pSoldier->bInterruptDuelPts < pOpponent->bInterruptDuelPts) + if (pSoldier->aiData.bInterruptDuelPts < pOpponent->aiData.bInterruptDuelPts) { - pSoldier->bInterruptDuelPts = pOpponent->bInterruptDuelPts; + pSoldier->aiData.bInterruptDuelPts = pOpponent->aiData.bInterruptDuelPts; } } else { // If our total points is HIGHER, then we interrupt him anyway - if (pSoldier->bInterruptDuelPts > pOpponent->bInterruptDuelPts) + if (pSoldier->aiData.bInterruptDuelPts > pOpponent->aiData.bInterruptDuelPts) { fResult = TRUE; } } -// ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Interrupt duel %d (%d pts) vs %d (%d pts)", pSoldier->ubID, pSoldier->bInterruptDuelPts, pOpponent->ubID, pOpponent->bInterruptDuelPts ); +// ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Interrupt duel %d (%d pts) vs %d (%d pts)", pSoldier->ubID, pSoldier->aiData.bInterruptDuelPts, pOpponent->ubID, pOpponent->aiData.bInterruptDuelPts ); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"InterruptDuel done"); return( fResult ); } @@ -1679,7 +1683,7 @@ void AddToIntList( UINT8 ubID, BOOLEAN fGainControl, BOOLEAN fCommunicate ) // ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%d added to int list", ubID ); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("INTERRUPT: adding ID %d who %s", ubID, fGainControl ? "gains control" : "loses control" ) ); - + // check whether 'who' is already anywhere on the queue after the first index // which we want to preserve so we can restore turn order for (ubLoop = 2; ubLoop <= gubOutOfTurnPersons; ubLoop++) @@ -1696,7 +1700,7 @@ void AddToIntList( UINT8 ubID, BOOLEAN fGainControl, BOOLEAN fCommunicate ) { // GAINING control, so delete him from this slot (because later he'll // get added to the end and we don't want him listed more than once!) - DeleteFromIntList( ubLoop, FALSE ); + DeleteFromIntList( ubLoop, FALSE ); } } } @@ -1719,16 +1723,16 @@ void AddToIntList( UINT8 ubID, BOOLEAN fGainControl, BOOLEAN fCommunicate ) { // record his initial APs at the start of his interrupt at this time // this is not the ideal place for this, but it's the best I could do... - Menptr[ubID].bIntStartAPs = Menptr[ubID].bActionPoints; + Menptr[ubID].aiData.bIntStartAPs = Menptr[ubID].bActionPoints; } else { gubLastInterruptedGuy = ubID; // turn off AI control flag if they lost control - if (Menptr[ubID].uiStatusFlags & SOLDIER_UNDERAICONTROL) + if (Menptr[ubID].flags.uiStatusFlags & SOLDIER_UNDERAICONTROL) { DebugAI( String( "Taking away AI control from %d", ubID ) ); - Menptr[ubID].uiStatusFlags &= (~SOLDIER_UNDERAICONTROL); + Menptr[ubID].flags.uiStatusFlags &= (~SOLDIER_UNDERAICONTROL); } } } @@ -1767,10 +1771,10 @@ void VerifyOutOfTurnOrderArray() while( gubOutOfTurnOrder[ ubNextIndex ] != ubNextInArrayOnTeam ) { // Pause them... - AdjustNoAPToFinishMove( MercPtrs[ gubOutOfTurnOrder[ ubNextIndex ] ], TRUE ); + MercPtrs[ gubOutOfTurnOrder[ ubNextIndex ] ]->AdjustNoAPToFinishMove( TRUE ); // If they were turning from prone, stop them - MercPtrs[ gubOutOfTurnOrder[ ubNextIndex ] ]->bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; + MercPtrs[ gubOutOfTurnOrder[ ubNextIndex ] ]->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; DeleteFromIntList( ubNextIndex, FALSE ); } @@ -1799,11 +1803,11 @@ void VerifyOutOfTurnOrderArray() ubTeamHighest[ ubTeam ] = ubLoop; } - // Another potential problem: the player is interrupted by the enemy who is interrupted by - // the militia. In this situation the enemy should just lose their interrupt. + // Another potential problem: the player is interrupted by the enemy who is interrupted by + // the militia. In this situation the enemy should just lose their interrupt. // (Or, the militia is interrupted by the enemy who is interrupted by the player.) - - // Check for 3+ teams in the interrupt queue. If three exist then abort all interrupts (return + + // Check for 3+ teams in the interrupt queue. If three exist then abort all interrupts (return // control to the first team) ubTeamsInList = 0; for ( ubLoop = 0; ubLoop < MAXTEAMS; ubLoop++ ) @@ -1815,7 +1819,7 @@ void VerifyOutOfTurnOrderArray() } if ( ubTeamsInList >= 3 ) { - // This is bad. Loop through everyone but the first person in the INT list and remove 'em + // This is bad. Loop through everyone but the first person in the INT list and remove 'em for (ubLoop = 2; ubLoop <= gubOutOfTurnPersons; ) { if ( MercPtrs[ gubOutOfTurnOrder[ ubLoop ] ]->bTeam != MercPtrs[ gubOutOfTurnOrder[ 1 ] ]->bTeam ) @@ -1823,10 +1827,10 @@ void VerifyOutOfTurnOrderArray() // remove! // Pause them... - AdjustNoAPToFinishMove( MercPtrs[ gubOutOfTurnOrder[ ubLoop ] ], TRUE ); + MercPtrs[ gubOutOfTurnOrder[ ubLoop ] ]->AdjustNoAPToFinishMove( TRUE ); // If they were turning from prone, stop them - MercPtrs[ gubOutOfTurnOrder[ ubLoop ] ]->bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; + MercPtrs[ gubOutOfTurnOrder[ ubLoop ] ]->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; DeleteFromIntList( ubLoop, FALSE ); @@ -1884,23 +1888,23 @@ void ResolveInterruptsVs( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType) for ( ubOpp = gTacticalStatus.Team[ ubTeam ].bFirstID; ubOpp <= gTacticalStatus.Team[ ubTeam ].bLastID; ubOpp++) { pOpponent = MercPtrs[ubOpp]; - if ( pOpponent->bActive && pOpponent->bInSector && (pOpponent->bLife >= OKLIFE) && !(pOpponent->bCollapsed) ) + if ( pOpponent->bActive && pOpponent->bInSector && (pOpponent->stats.bLife >= OKLIFE) && !(pOpponent->bCollapsed) ) { if ( ubInterruptType == NOISEINTERRUPT ) { - // don't grant noise interrupts at greater than max. visible distance + // don't grant noise interrupts at greater than max. visible distance if ( PythSpacesAway( pSoldier->sGridNo, pOpponent->sGridNo ) > MaxNormalDistanceVisible() ) { - pOpponent->bInterruptDuelPts = NO_INTERRUPT; + pOpponent->aiData.bInterruptDuelPts = NO_INTERRUPT; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Resetting int pts for %d - NOISE BEYOND SIGHT DISTANCE!?", pOpponent->ubID ) ); continue; } } - else if ( pOpponent->bOppList[pSoldier->ubID] != SEEN_CURRENTLY ) + else if ( pOpponent->aiData.bOppList[pSoldier->ubID] != SEEN_CURRENTLY ) { - pOpponent->bInterruptDuelPts = NO_INTERRUPT; + pOpponent->aiData.bInterruptDuelPts = NO_INTERRUPT; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Resetting int pts for %d - DOESN'T SEE ON SIGHT INTERRUPT!?", pOpponent->ubID ) ); @@ -1908,7 +1912,7 @@ void ResolveInterruptsVs( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType) continue; } - switch (pOpponent->bInterruptDuelPts) + switch (pOpponent->aiData.bInterruptDuelPts) { case NO_INTERRUPT: // no interrupt possible, no duel necessary DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("ResolveInterruptsVs: No interrupt for opponent %d", pOpponent->ubID ) ); @@ -1916,7 +1920,7 @@ void ResolveInterruptsVs( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType) break; case AUTOMATIC_INTERRUPT: // interrupts occurs automatically - pSoldier->bInterruptDuelPts = 0; // just to have a valid intDiff later + pSoldier->aiData.bInterruptDuelPts = 0; // just to have a valid intDiff later fIntOccurs = TRUE; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("INTERRUPT: automatic interrupt on %d by %d", pSoldier->ubID, pOpponent->ubID ) ); @@ -1925,12 +1929,12 @@ void ResolveInterruptsVs( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType) default: // interrupt is possible, run a duel DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Calculating int duel pts for onlooker in ResolveInterruptsVs" ); - pSoldier->bInterruptDuelPts = CalcInterruptDuelPts(pSoldier,pOpponent->ubID,TRUE); + pSoldier->aiData.bInterruptDuelPts = CalcInterruptDuelPts(pSoldier,pOpponent->ubID,TRUE); fIntOccurs = InterruptDuel(pOpponent,pSoldier); #ifdef DEBUG_INTERRUPTS if (fIntOccurs) { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("INTERRUPT: standard interrupt on %d (%d pts) by %d (%d pts)", pSoldier->ubID, pSoldier->bInterruptDuelPts, pOpponent->ubID, pOpponent->bInterruptDuelPts) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("INTERRUPT: standard interrupt on %d (%d pts) by %d (%d pts)", pSoldier->ubID, pSoldier->aiData.bInterruptDuelPts, pOpponent->ubID, pOpponent->aiData.bInterruptDuelPts) ); } #endif @@ -1943,7 +1947,7 @@ void ResolveInterruptsVs( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType) ubIntList[ubIntCnt] = pOpponent->ubID; // and by how much he beat us in the duel - ubIntDiff[ubIntCnt] = pOpponent->bInterruptDuelPts - pSoldier->bInterruptDuelPts; + ubIntDiff[ubIntCnt] = pOpponent->aiData.bInterruptDuelPts - pSoldier->aiData.bInterruptDuelPts; // increment counter of interrupts lost ubIntCnt++; @@ -1951,30 +1955,30 @@ void ResolveInterruptsVs( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType) else { /* - if (pOpponent->bInterruptDuelPts != NO_INTERRUPT) + if (pOpponent->aiData.bInterruptDuelPts != NO_INTERRUPT) { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%d fails to interrupt %d (%d vs %d pts)", pOpponent->ubID, pSoldier->ubID, pOpponent->bInterruptDuelPts, pSoldier->bInterruptDuelPts); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%d fails to interrupt %d (%d vs %d pts)", pOpponent->ubID, pSoldier->ubID, pOpponent->aiData.bInterruptDuelPts, pSoldier->aiData.bInterruptDuelPts); } */ } // either way, clear out both sides' bInterruptDuelPts field to prepare next one - if (pSoldier->bInterruptDuelPts != NO_INTERRUPT) + if (pSoldier->aiData.bInterruptDuelPts != NO_INTERRUPT) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Resetting int pts for %d", pSoldier->ubID ) ); } - pSoldier->bInterruptDuelPts = NO_INTERRUPT; + pSoldier->aiData.bInterruptDuelPts = NO_INTERRUPT; - if (pOpponent->bInterruptDuelPts != NO_INTERRUPT) + if (pOpponent->aiData.bInterruptDuelPts != NO_INTERRUPT) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Resetting int pts for %d", pOpponent->ubID ) ); } - pOpponent->bInterruptDuelPts = NO_INTERRUPT; + pOpponent->aiData.bInterruptDuelPts = NO_INTERRUPT; } @@ -1985,22 +1989,22 @@ void ResolveInterruptsVs( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType) // if any interrupts are scheduled to occur (ie. I lost at least once) if (ubIntCnt) { - // First add currently active character to the interrupt queue. This is + // First add currently active character to the interrupt queue. This is // USUALLY pSoldier->guynum, but NOT always, because one enemy can // "interrupt" on another enemy's turn if he hears another team's wound - // victim's screaming... the guy screaming is pSoldier here, it's not his turn! + // victim's screaming... the guy screaming is pSoldier here, it's not his turn! //AddToIntList( (UINT8) gusSelectedSoldier, FALSE, TRUE); if ( (gTacticalStatus.ubCurrentTeam != pSoldier->bTeam) && !(gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bHuman) ) { - // if anyone on this team is under AI control, remove + // if anyone on this team is under AI control, remove // their AI control flag and put them on the queue instead of this guy for ( ubLoop = gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bFirstID; ubLoop <= gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bLastID; ubLoop++ ) { - if ( (MercPtrs[ ubLoop ]->uiStatusFlags & SOLDIER_UNDERAICONTROL) ) + if ( (MercPtrs[ ubLoop ]->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL) ) { // this guy lost control - MercPtrs[ ubLoop ]->uiStatusFlags &= (~SOLDIER_UNDERAICONTROL); + MercPtrs[ ubLoop ]->flags.uiStatusFlags &= (~SOLDIER_UNDERAICONTROL); AddToIntList( ubLoop, FALSE, TRUE); break; } @@ -2040,7 +2044,7 @@ void ResolveInterruptsVs( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType) return; } - ubIntDiff[ubSmallestSlot] = NO_INTERRUPT; // mark slot as been handled + ubIntDiff[ubSmallestSlot] = NO_INTERRUPT; // mark slot as been handled } } @@ -2126,7 +2130,7 @@ BOOLEAN NPCFirstDraw( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTargetSoldier ) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"NPCFirstDraw"); // if attacking an NPC check to see who draws first! - if ( pTargetSoldier->ubProfile != NO_PROFILE && pTargetSoldier->ubProfile != SLAY && pTargetSoldier->bNeutral && pTargetSoldier->bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY && ( FindAIUsableObjClass( pTargetSoldier, IC_WEAPON ) != NO_SLOT ) ) + if ( pTargetSoldier->ubProfile != NO_PROFILE && pTargetSoldier->ubProfile != SLAY && pTargetSoldier->aiData.bNeutral && pTargetSoldier->aiData.bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY && ( FindAIUsableObjClass( pTargetSoldier, IC_WEAPON ) != NO_SLOT ) ) { UINT8 ubLargerHalf, ubSmallerHalf, ubTargetLargerHalf, ubTargetSmallerHalf; @@ -2135,7 +2139,7 @@ BOOLEAN NPCFirstDraw( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTargetSoldier ) // if level 4, roll Random( 2 + 1 ) + 2 for result from 2 to 4 ubSmallerHalf = EffectiveExpLevel( pSoldier ) / 2; ubLargerHalf = EffectiveExpLevel( pSoldier ) - ubSmallerHalf; - + ubTargetSmallerHalf = EffectiveExpLevel( pTargetSoldier ) / 2; ubTargetLargerHalf = EffectiveExpLevel( pTargetSoldier ) - ubTargetSmallerHalf; if ( gMercProfiles[ pTargetSoldier->ubProfile ].bApproached & gbFirstApproachFlags[ APPROACH_THREATEN - 1 ] ) diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index e568dd92..5d118220 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -16,7 +16,7 @@ #include "math.h" #include "jascreens.h" #include "pathai.h" -#include "Soldier Control.h" +//#include "Soldier Control.h" #include "Animation Control.h" #include "Animation Data.h" #include "Event Pump.h" @@ -24,7 +24,7 @@ #include "cursors.h" #include "Handle UI.h" #include "Isometric Utils.h" -#include "input.h" +#include "input.h" #include "overhead.h" #include "Sys Globals.h" #include "screenids.h" @@ -118,13 +118,16 @@ #include "Quest Debug System.h" +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; extern UIKEYBOARD_HOOK gUIKeyboardHook; extern BOOLEAN fRightButtonDown; extern BOOLEAN fLeftButtonDown; extern BOOLEAN fIgnoreLeftUp; -extern UINT32 guiCurrentEvent; +extern UINT32 guiCurrentEvent; extern UINT8 gubIntTileCheckFlags; extern UINT32 guiCurrentUICursor; extern SOLDIERTYPE *gpSMCurrentMerc; @@ -132,7 +135,7 @@ extern INT16 gsOverItemsGridNo; extern INT16 gsOverItemsLevel; extern BOOLEAN gfUIShowExitSouth; -extern INT32 giStartingMemValue; +extern INT32 giStartingMemValue; extern BOOLEAN gfBeginBurstSpreadTracking; @@ -179,12 +182,18 @@ SOLDIERTYPE *gpExchangeSoldier1; SOLDIERTYPE *gpExchangeSoldier2; -BOOLEAN ConfirmActionCancel( UINT16 usMapPos, UINT16 usOldMapPos ); +BOOLEAN ConfirmActionCancel( INT16 sMapPos, UINT16 usOldMapPos ); BOOLEAN gfNextFireJam = FALSE; +extern INT16 ITEMDESC_START_X; +extern INT16 ITEMDESC_START_Y; + //Little functions called by keyboard input +void SwapGoggles(); +void SeperateItems(); +void StackAndSort( BOOLEAN fRestrictToAmmo ); void CreateRandomItem(); void MakeSelectedSoldierTired(); void ToggleRealTime( UINT32 *puiNewEvent ); @@ -208,9 +217,6 @@ void ToggleCliffDebug(); void CreateCow(); void CreatePlayerControlledCow(); void ToggleRealTimeConfirm(); -void GrenadeTest1(); -void GrenadeTest2(); -void GrenadeTest3(); void TestMeanWhile( INT32 iID ); void CreatePlayerControlledMonster(); void ChangeCurrentSquad( INT32 iSquad ); @@ -234,7 +240,6 @@ void HandleStealthChangeFromUIKeys( ); UINT8 gubCheatLevel = STARTING_CHEAT_LEVEL; -extern void StackObjs( OBJECTTYPE * pSourceObj, OBJECTTYPE * pTargetObj, UINT8 ubNumberToCopy ); extern BOOLEAN CompatibleAmmoForGun( OBJECTTYPE *pTryObject, OBJECTTYPE *pTestObject ); extern void DetermineWhichAssignmentMenusCanBeShown( void ); extern void DetermineWhichMilitiaControlMenusCanBeShown( void ); //lalien @@ -247,18 +252,17 @@ void GetTBMouseButtonInput( UINT32 *puiNewEvent ) void QueryTBLeftButton( UINT32 *puiNewEvent ) { - SOLDIERTYPE *pSoldier; - UINT16 usMapPos; + SOLDIERTYPE *pSoldier; + INT16 sMapPos; static BOOLEAN fClickHoldIntercepted = FALSE; - //BOOLEAN fOnInterTile = FALSE; - static BOOLEAN fCanCheckForSpeechAdvance = FALSE; + static BOOLEAN fCanCheckForSpeechAdvance = FALSE; static INT16 sMoveClickGridNo = 0; // LEFT MOUSE BUTTON if ( gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA ) - { - if (!GetMouseMapPos( &usMapPos ) && !gfUIShowExitSouth ) + { + if (!GetMouseMapPos( &sMapPos ) && !gfUIShowExitSouth ) { return; } @@ -277,7 +281,7 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) if( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { - pSoldier->sStartGridNo = usMapPos; + pSoldier->sStartGridNo = sMapPos; } break; @@ -292,7 +296,7 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) if ( !HandleCheckForExitArrowsInput( FALSE ) && gpItemPointer == NULL ) { // First check if we clicked on a guy, if so, make selected if it's ours - if ( gfUIFullTargetFound && ( guiUIFullTargetFlags & OWNED_MERC ) ) + if ( gfUIFullTargetFound && ( guiUIFullTargetFlags & OWNED_MERC ) ) { if ( !( guiUIFullTargetFlags & UNCONSCIOUS_MERC ) ) { @@ -300,7 +304,7 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) // Select guy if( GetSoldier( &pSoldier, gusUIFullTargetID ) && gpItemPointer == NULL ) - { + { if( pSoldier->bAssignment >= ON_DUTY ) { // do nothing @@ -321,7 +325,7 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) { if ( InUIPlanMode( ) ) { - AddUIPlan( usMapPos, UIPLAN_ACTION_MOVETO ); + AddUIPlan( sMapPos, UIPLAN_ACTION_MOVETO ); } else { @@ -333,13 +337,13 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) GetSoldier( &pSoldier, gusSelectedSoldier ); - bReturnVal = HandleMoveModeInteractiveClick( usMapPos, puiNewEvent ); + bReturnVal = HandleMoveModeInteractiveClick( sMapPos, puiNewEvent ); // All's OK for interactive tile? if ( bReturnVal == -2 ) { // Confirm! - if ( SelectedMercCanAffordMove( ) ) + if ( SelectedMercCanAffordMove( ) ) { *puiNewEvent = C_WAIT_FOR_CONFIRM; } @@ -355,12 +359,12 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) if ( gsCurrentActionPoints == 0 ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ NO_PATH ] ); - } - else if ( SelectedMercCanAffordMove( ) ) + } + else if ( SelectedMercCanAffordMove( ) ) { BOOLEAN fResult; - if ( ( fResult = UIOKMoveDestination( MercPtrs[ gusSelectedSoldier ], usMapPos ) ) == 1 ) + if ( ( fResult = UIOKMoveDestination( MercPtrs[ gusSelectedSoldier ], sMapPos ) ) == 1 ) { // ATE: CHECK IF WE CAN GET TO POSITION // Check if we are not in combat @@ -371,11 +375,11 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ NO_PATH ] ); } else - { + { *puiNewEvent = C_WAIT_FOR_CONFIRM; } } - else + else { if ( fResult == 2 ) { @@ -383,21 +387,21 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) } else { - //if ( usMapPos != sMoveClickGridNo || pSoldier->uiStatusFlags & SOLDIER_ROBOT ) + //if ( sMapPos != sMoveClickGridNo || pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) //{ - // sMoveClickGridNo = usMapPos; + // sMoveClickGridNo = sMapPos; //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ CANT_MOVE_THERE_STR ] ); // Goto hand cursor mode.... - // *puiNewEvent = M_CHANGE_TO_HANDMODE; - // gsOverItemsGridNo = usMapPos; + // *puiNewEvent = M_CHANGE_TO_HANDMODE; + // gsOverItemsGridNo = sMapPos; // gsOverItemsLevel = gsInterfaceLevel; //} //else //{ // sMoveClickGridNo = 0; - // *puiNewEvent = M_CHANGE_TO_HANDMODE; - //} + // *puiNewEvent = M_CHANGE_TO_HANDMODE; + //} } //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, L"Invalid move destination." ); @@ -416,7 +420,7 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) else { fClickHoldIntercepted = TRUE; - fIgnoreLeftUp = TRUE; + fIgnoreLeftUp = TRUE; } } @@ -440,7 +444,7 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) if ( gfUIFullTargetFound ) { // Select guy - if ( ( guiUIFullTargetFlags & SELECTED_MERC) && !( guiUIFullTargetFlags & UNCONSCIOUS_MERC ) && !( MercPtrs[ gusUIFullTargetID ]->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( ( guiUIFullTargetFlags & SELECTED_MERC) && !( guiUIFullTargetFlags & UNCONSCIOUS_MERC ) && !( MercPtrs[ gusUIFullTargetID ]->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { *puiNewEvent = M_CHANGE_TO_ADJPOS_MODE; fIgnoreLeftUp = FALSE; @@ -465,7 +469,7 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) } else { - if ( fLeftButtonDown ) + if ( fLeftButtonDown ) { if ( !fIgnoreLeftUp ) { @@ -482,7 +486,7 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) // CHECK IF WE CLICKED-HELD if ( COUNTERDONE( LMOUSECLICK_DELAY_COUNTER ) ) - { + { // LEFT CLICK-HOLD EVENT // Switch on UI mode switch( gCurrentUIMode ) @@ -493,13 +497,13 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) { if ( pSoldier->bDoBurst ) { - pSoldier->sEndGridNo = usMapPos; + pSoldier->sEndGridNo = sMapPos; gfBeginBurstSpreadTracking = FALSE; if ( pSoldier->sEndGridNo != pSoldier->sStartGridNo ) { - pSoldier->fDoSpread = TRUE; + pSoldier->flags.fDoSpread = TRUE; PickBurstLocations( pSoldier ); @@ -507,7 +511,7 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) } else { - pSoldier->fDoSpread = FALSE; + pSoldier->flags.fDoSpread = FALSE; } fClickHoldIntercepted = TRUE; @@ -535,7 +539,7 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) { if ( gpItemPointer != NULL ) { - if ( HandleItemPointerClick( usMapPos ) ) + if ( HandleItemPointerClick( sMapPos ) ) { // getout of mode EndItemPointer( ); @@ -582,8 +586,8 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) if ( ( guiUIFullTargetFlags & OWNED_MERC ) && !( guiUIFullTargetFlags & UNCONSCIOUS_MERC ) ) { // Select guy - if( GetSoldier( &pSoldier, gusUIFullTargetID ) && ( gpItemPointer == NULL ) && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) - { + if( GetSoldier( &pSoldier, gusUIFullTargetID ) && ( gpItemPointer == NULL ) && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) + { if( pSoldier->bAssignment >= ON_DUTY ) { PopupAssignmentMenuInTactical( pSoldier ); @@ -599,7 +603,7 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) case HANDCURSOR_MODE: - HandleHandCursorClick( usMapPos, puiNewEvent ); + HandleHandCursorClick( sMapPos, puiNewEvent ); break; case JUMPOVER_MODE: @@ -617,7 +621,7 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) if ( InUIPlanMode( ) ) { - AddUIPlan( usMapPos, UIPLAN_ACTION_FIRE ); + AddUIPlan( sMapPos, UIPLAN_ACTION_FIRE ); } else { @@ -626,7 +630,7 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) if ( !HandleUIReloading( pSoldier ) ) { // ATE: Reset refine aim.. - pSoldier->bShownAimTime = 0; + pSoldier->aiData.bShownAimTime = 0; if ( gsCurrentActionPoints == 0 ) { @@ -636,7 +640,7 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) else if ( UIMouseOnValidAttackLocation( pSoldier ) && SelectedMercCanAffordAttack( ) ) { *puiNewEvent = A_CHANGE_TO_CONFIM_ACTION; - pSoldier->sStartGridNo = usMapPos; + pSoldier->sStartGridNo = sMapPos; } } @@ -696,7 +700,7 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) // Reset flag fLeftButtonDown = FALSE; - fIgnoreLeftUp = FALSE; + fIgnoreLeftUp = FALSE; fClickHoldIntercepted = FALSE; fCanCheckForSpeechAdvance = FALSE; gfFirstCycleMovementStarted = FALSE; @@ -720,7 +724,7 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) { if( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { - pSoldier->fDoSpread = FALSE; + pSoldier->flags.fDoSpread = FALSE; } gfBeginBurstSpreadTracking = FALSE; } @@ -733,9 +737,9 @@ void QueryTBRightButton( UINT32 *puiNewEvent ) static BOOLEAN fClickHoldIntercepted = FALSE; static BOOLEAN fClickIntercepted = FALSE; SOLDIERTYPE *pSoldier; - UINT16 usMapPos; + INT16 sMapPos; BOOLEAN fDone = FALSE; - if (!GetMouseMapPos( &usMapPos ) ) + if (!GetMouseMapPos( &sMapPos ) ) { return; } @@ -782,8 +786,8 @@ void QueryTBRightButton( UINT32 *puiNewEvent ) if ( ( guiUIFullTargetFlags & OWNED_MERC ) && !( guiUIFullTargetFlags & UNCONSCIOUS_MERC ) ) { // Select guy - if( GetSoldier( &pSoldier, gusUIFullTargetID ) && ( gpItemPointer == NULL ) && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) - { + if( GetSoldier( &pSoldier, gusUIFullTargetID ) && ( gpItemPointer == NULL ) && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) + { //if( pSoldier->bAssignment >= ON_DUTY ) { PopupAssignmentMenuInTactical( pSoldier ); @@ -803,7 +807,7 @@ void QueryTBRightButton( UINT32 *puiNewEvent ) fClickHoldIntercepted = TRUE; } //} - //else + //else //{ // If we are on a selected guy // if ( guiUIFullTargetFlags & SELECTED_MERC && !( guiUIFullTargetFlags & UNCONSCIOUS_MERC ) ) @@ -832,7 +836,7 @@ void QueryTBRightButton( UINT32 *puiNewEvent ) if ( fLeftButtonDown ) { - fIgnoreLeftUp = TRUE; + fIgnoreLeftUp = TRUE; if ( gpItemPointer == NULL ) { @@ -841,8 +845,8 @@ void QueryTBRightButton( UINT32 *puiNewEvent ) { switch( gCurrentUIMode ) { - case CONFIRM_MOVE_MODE: - case MOVE_MODE: + case CONFIRM_MOVE_MODE: + case MOVE_MODE: if ( gfUICanBeginAllMoveCycle ) { @@ -873,7 +877,7 @@ void QueryTBRightButton( UINT32 *puiNewEvent ) { gfBeginBurstSpreadTracking = FALSE; gfRTClickLeftHoldIntercepted = TRUE; - MercPtrs[ gusSelectedSoldier ]->fDoSpread = FALSE; + MercPtrs[ gusSelectedSoldier ]->flags.fDoSpread = FALSE; fClickHoldIntercepted = TRUE; *puiNewEvent = A_END_ACTION; gCurrentUIMode = MOVE_MODE; @@ -886,9 +890,9 @@ void QueryTBRightButton( UINT32 *puiNewEvent ) if ( !fClickHoldIntercepted && !fClickIntercepted ) { if ( gpItemPointer == NULL ) - { - // ATE: - if ( gusSelectedSoldier != NOBODY ) + { + // ATE: + if ( gusSelectedSoldier != NOBODY ) { // Switch on UI mode switch( gCurrentUIMode ) @@ -933,7 +937,7 @@ void QueryTBRightButton( UINT32 *puiNewEvent ) if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { - HandleRightClickAdjustCursor( pSoldier, usMapPos ); + HandleRightClickAdjustCursor( pSoldier, sMapPos ); } fClickIntercepted = TRUE; break; @@ -947,14 +951,14 @@ void QueryTBRightButton( UINT32 *puiNewEvent ) } } - } - else - { - if ( gfUIFullTargetFound ) + } + else + { + if ( gfUIFullTargetFound ) { gfItemPointerDifferentThanDefault = !gfItemPointerDifferentThanDefault; } - } + } } } } @@ -976,7 +980,7 @@ extern BOOLEAN gUIActionModeChangeDueToMouseOver; void GetTBMousePositionInput( UINT32 *puiNewEvent ) { - UINT16 usMapPos; + INT16 sMapPos; static UINT16 usOldMapPos = 0; SOLDIERTYPE *pSoldier; BOOLEAN bHandleCode; @@ -984,7 +988,7 @@ void GetTBMousePositionInput( UINT32 *puiNewEvent ) static UINT32 uiMoveTargetSoldierId = NOBODY; - if (!GetMouseMapPos( &usMapPos ) ) + if (!GetMouseMapPos( &sMapPos ) ) { return; } @@ -1051,13 +1055,13 @@ void GetTBMousePositionInput( UINT32 *puiNewEvent ) // Check for being on terrain if( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { - if ( IsValidJumpLocation( pSoldier, usMapPos, TRUE ) ) + if ( IsValidJumpLocation( pSoldier, sMapPos, TRUE ) ) { - gsJumpOverGridNo = usMapPos; + gsJumpOverGridNo = sMapPos; *puiNewEvent = JP_ON_TERRAIN; return; } - else + else { if( gfUIFullTargetFound ) { @@ -1085,7 +1089,7 @@ void GetTBMousePositionInput( UINT32 *puiNewEvent ) fOnValidGuy = FALSE; - if ( gfUIFullTargetFound ) + if ( gfUIFullTargetFound ) //if ( gfUIFullTargetFound ) { if ( IsValidTargetMerc( (UINT8)gusUIFullTargetID ) ) @@ -1105,7 +1109,7 @@ void GetTBMousePositionInput( UINT32 *puiNewEvent ) } } } - } + } else { if ( gUIActionModeChangeDueToMouseOver ) @@ -1155,7 +1159,7 @@ void GetTBMousePositionInput( UINT32 *puiNewEvent ) case JUMPOVER_MODE: // ATE: Make sure! - if ( gsJumpOverGridNo != usMapPos ) + if ( gsJumpOverGridNo != sMapPos ) { *puiNewEvent = A_CHANGE_TO_MOVE; } @@ -1167,7 +1171,7 @@ void GetTBMousePositionInput( UINT32 *puiNewEvent ) case CONFIRM_MOVE_MODE: - if ( usMapPos != usOldMapPos ) + if ( sMapPos != usOldMapPos ) { // Switch event out of confirm mode *puiNewEvent = A_CHANGE_TO_MOVE; @@ -1187,18 +1191,18 @@ void GetTBMousePositionInput( UINT32 *puiNewEvent ) { if ( pSoldier->bDoBurst ) { - pSoldier->sEndGridNo = usMapPos; + pSoldier->sEndGridNo = sMapPos; if ( pSoldier->sEndGridNo != pSoldier->sStartGridNo && fLeftButtonDown ) { - pSoldier->fDoSpread = TRUE; + pSoldier->flags.fDoSpread = TRUE; gfBeginBurstSpreadTracking = TRUE; } - if ( pSoldier->fDoSpread ) + if ( pSoldier->flags.fDoSpread ) { // Accumulate gridno - AccumulateBurstLocation( usMapPos ); + AccumulateBurstLocation( sMapPos ); *puiNewEvent = CA_ON_TERRAIN; break; @@ -1212,7 +1216,7 @@ void GetTBMousePositionInput( UINT32 *puiNewEvent ) if ( guiUITargetSoldierId != gusUIFullTargetID ) { // Switch event out of confirm mode - *puiNewEvent = CA_END_CONFIRM_ACTION; + *puiNewEvent = CA_END_CONFIRM_ACTION; } else { @@ -1225,14 +1229,14 @@ void GetTBMousePositionInput( UINT32 *puiNewEvent ) if ( fOnValidGuy ) { // Switch event out of confirm mode - *puiNewEvent = CA_END_CONFIRM_ACTION; + *puiNewEvent = CA_END_CONFIRM_ACTION; } else { - if ( ConfirmActionCancel( usMapPos, usOldMapPos ) ) + if ( ConfirmActionCancel( sMapPos, usOldMapPos ) ) { // Switch event out of confirm mode - *puiNewEvent = CA_END_CONFIRM_ACTION; + *puiNewEvent = CA_END_CONFIRM_ACTION; } else { @@ -1249,7 +1253,7 @@ void GetTBMousePositionInput( UINT32 *puiNewEvent ) } - usOldMapPos = usMapPos; + usOldMapPos = sMapPos; } } @@ -1278,7 +1282,7 @@ void GetPolledKeyboardInput( UINT32 *puiNewEvent ) case ACTION_MODE: case HANDCURSOR_MODE: - if ( _KeyDown( CTRL ) ) + if ( _KeyDown( CTRL ) ) { if ( fCtrlDown == FALSE ) { @@ -1298,12 +1302,12 @@ void GetPolledKeyboardInput( UINT32 *puiNewEvent ) break; } - // CHECK FOR ALT + // CHECK FOR ALT switch( gCurrentUIMode ) { case MOVE_MODE: - if ( _KeyDown( ALT ) ) + if ( _KeyDown( ALT ) ) { if ( fAltDown == FALSE ) { @@ -1335,7 +1339,7 @@ void GetPolledKeyboardInput( UINT32 *puiNewEvent ) // Check realtime input! if ( ( ( gTacticalStatus.uiFlags & REALTIME ) || !( gTacticalStatus.uiFlags & INCOMBAT ) ) ) { - //if ( _KeyDown( CAPS ) ) //&& !fShifted ) + //if ( _KeyDown( CAPS ) ) //&& !fShifted ) //{ // fShifted = TRUE; // if ( gCurrentUIMode != ACTION_MODE && gCurrentUIMode != CONFIRM_ACTION_MODE ) @@ -1352,7 +1356,7 @@ void GetPolledKeyboardInput( UINT32 *puiNewEvent ) //} - if ( _KeyDown( SHIFT ) ) //&& !fShifted ) + if ( _KeyDown( SHIFT ) ) //&& !fShifted ) { fShifted2 = TRUE; if ( gCurrentUIMode != MOVE_MODE && gCurrentUIMode != CONFIRM_MOVE_MODE ) @@ -1409,18 +1413,18 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { InputAtom InputEvent; BOOLEAN fKeyTaken = FALSE; - POINT MousePos; + POINT MousePos; //SOLDIERTYPE *pSoldier; static BOOLEAN fShifted = FALSE; static BOOLEAN fShifted2 = FALSE; static BOOLEAN fAltDown = FALSE; - UINT16 usMapPos; + INT16 sMapPos; BOOLEAN fGoodCheatLevelKey = FALSE; GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! + ScreenToClient(ghWindow, &MousePos); // In window coords! - GetMouseMapPos( &usMapPos ); + GetMouseMapPos( &sMapPos ); while (DequeueEvent(&InputEvent) == TRUE) { @@ -1436,7 +1440,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) case RIGHT_BUTTON_DOWN: MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - case RIGHT_BUTTON_UP: + case RIGHT_BUTTON_UP: MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; @@ -1504,14 +1508,14 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) */ if ((InputEvent.usEvent == KEY_UP )&& ( InputEvent.usParam == PAUSE ) && !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV) ) - { + { // Pause game! HandlePlayerPauseUnPauseOfGame( ); } // FIRST DO KEYS THAT ARE USED EVERYWHERE! if ((InputEvent.usEvent == KEY_DOWN )&& ( InputEvent.usParam == 'x') && ( InputEvent.usKeyState & ALT_DOWN )) - { + { HandleShortCutExitState( ); //*puiNewEvent = I_EXIT; } @@ -1576,16 +1580,15 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) if ( CHEATER_CHEAT_LEVEL( ) ) { if ((InputEvent.usEvent == KEY_DOWN )&& ( InputEvent.usParam == ENTER ) && ( InputEvent.usKeyState & ALT_DOWN ) ) - { - // ESCAPE ENEMY'S TURN + { + // ESCAPE ENEMY'S TURN EndAIDeadlock(); - // Decrease global busy counter... + // Decrease global busy counter... gTacticalStatus.ubAttackBusyCount = 0; #ifdef DEBUG_ATTACKBUSY OutputDebugString( "Resetting attack busy due to keyboard interrupt.\n"); #endif - guiPendingOverrideEvent = LU_ENDUILOCK; UIHandleLUIEndLock( NULL ); @@ -1593,18 +1596,18 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) } //Madd: removed from cheat mode if ((InputEvent.usEvent == KEY_DOWN )&& ( InputEvent.usParam == ENTER ) && ( InputEvent.usKeyState & CTRL_DOWN ) ) - { + { EscapeUILock( ); } } else { if ( CHEATER_CHEAT_LEVEL( ) && (InputEvent.usEvent == KEY_DOWN )&& ( InputEvent.usParam == ENTER ) && ( InputEvent.usKeyState & CTRL_DOWN ) ) - { + { //UNLOCK UI EscapeUILock( ); } - else if ( (InputEvent.usEvent == KEY_DOWN ) && InputEvent.usParam == ENTER ) + else if ( (InputEvent.usEvent == KEY_DOWN ) && InputEvent.usParam == ENTER ) { // Cycle through enemys CycleThroughKnownEnemies( ); @@ -1645,13 +1648,13 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) // CHECK ESC KEYS HERE.... if ((InputEvent.usEvent == KEY_DOWN )&& ( InputEvent.usParam == ESC )) - { + { //EscapeUILock( ); #ifdef JA2TESTVERSION if ( InAirRaid( ) ) { EndAirRaid( ); - } + } #endif // Cancel out of spread burst... @@ -1659,7 +1662,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) gfRTClickLeftHoldIntercepted = TRUE; if ( gusSelectedSoldier != NOBODY ) { - MercPtrs[ gusSelectedSoldier ]->fDoSpread = FALSE; + MercPtrs[ gusSelectedSoldier ]->flags.fDoSpread = FALSE; } @@ -1697,7 +1700,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) if ( gusSelectedSoldier != NOBODY ) { // If soldier is not stationary, stop - StopSoldier( MercPtrs[ gusSelectedSoldier ] ); + MercPtrs[ gusSelectedSoldier ]->StopSoldier( ); *puiNewEvent = A_CHANGE_TO_MOVE; } // ATE: OK, stop any mercs who are moving by selection method.... @@ -1721,7 +1724,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) // Check all those we want if enemy's turn if ((InputEvent.usEvent == KEY_UP )&& ( InputEvent.usParam == 'q') ) - { + { if ( InputEvent.usKeyState & ALT_DOWN ) { if ( CHEATER_CHEAT_LEVEL( ) ) @@ -1758,7 +1761,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { if ( INFORMATION_CHEAT_LEVEL( ) ) { - *puiNewEvent = I_SOLDIERDEBUG; + *puiNewEvent = I_SOLDIERDEBUG; } else { @@ -1797,32 +1800,32 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) for ( i = 0; i < 1000; i++ ) { - CalculateLaunchItemChanceToGetThrough( MercPtrs[ gusSelectedSoldier ], &(MercPtrs[ gusSelectedSoldier ]->inv[ HANDPOS ] ), usMapPos, 0, 0, &sGridNo, TRUE, (INT8 *)&ubLevel, TRUE ); + CalculateLaunchItemChanceToGetThrough( MercPtrs[ gusSelectedSoldier ], &(MercPtrs[ gusSelectedSoldier ]->inv[ HANDPOS ] ), sMapPos, 0, 0, &sGridNo, TRUE, (INT8 *)&ubLevel, TRUE ); } - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Physics 100 times: %d", ( GetJA2Clock( ) - iTime ) ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Physics 100 times: %d", ( GetJA2Clock( ) - iTime ) ); } #endif #ifdef NETWORKED - // DEF: Test Networking + // DEF: Test Networking if ((InputEvent.usEvent == KEY_DOWN )&& ( InputEvent.usParam == '0') && ( InputEvent.usKeyState & ALT_DOWN )) - { + { DisplayMultiPlayerInfo(); } if ((InputEvent.usEvent == KEY_DOWN )&& ( InputEvent.usParam == '9') && ( InputEvent.usKeyState & ALT_DOWN )) - { + { DisplayDirectPlayInfo(); } if ((InputEvent.usEvent == KEY_DOWN )&& ( InputEvent.usParam == '8') && ( InputEvent.usKeyState & ALT_DOWN )) - { + { DisplayDirectPlayPlayerInfo(); } if ((InputEvent.usEvent == KEY_DOWN )&& ( InputEvent.usParam == '7') && ( InputEvent.usKeyState & ALT_DOWN )) - { + { SetDisplayFlag(); } #endif @@ -1838,7 +1841,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) case SPACE: // nothing in hand and either not in SM panel, or the matching button is enabled if we are in SM panel - if ( !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) && + if ( !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) && ( ( gsCurInterfacePanel != SM_PANEL ) || ( ButtonList[ iSMPanelButtons[ NEXTMERC_BUTTON ] ]->uiFlags & BUTTON_ENABLED ) ) ) { if ( !InKeyRingPopup( ) ) @@ -1849,9 +1852,9 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) INT32 iCurrentSquad; if ( gusSelectedSoldier != NOBODY ) - { + { // only allow if nothing in hand and if in SM panel, the Change Squad button must be enabled - if ( + if ( ( ( gsCurInterfacePanel != TEAM_PANEL ) || ( ButtonList[ iTEAMPanelButtons[ CHANGE_SQUAD_BUTTON ] ]->uiFlags & BUTTON_ENABLED ) ) ) { //Select next squad @@ -2074,21 +2077,21 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { if( DEBUG_CHEAT_LEVEL( ) ) { - GetMouseMapPos( &gusQdsEnteringGridNo ); + GetMouseMapPos( &gsQdsEnteringGridNo ); LeaveTacticalScreen( QUEST_DEBUG_SCREEN ); } } break; - case F12: + case F12: #ifdef JA2TESTVERSION if( fAlt ) { UINT8 ubProfile = TONY; - GetMouseMapPos( &gusQdsEnteringGridNo ); - AddShopkeeperToGridNo( ubProfile, gusQdsEnteringGridNo ); + GetMouseMapPos( &gsQdsEnteringGridNo ); + AddShopkeeperToGridNo( ubProfile, gsQdsEnteringGridNo ); EnterShopKeeperInterfaceScreen( ubProfile ); } #endif @@ -2097,7 +2100,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { ClearTacticalMessageQueue( ); } - else if ( !fAlt ) + else if ( !fAlt ) { ClearDisplayedListOfTacticalStrings( ); } @@ -2110,8 +2113,8 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) if ( CHEATER_CHEAT_LEVEL( ) ) { //ChangeSoldiersBodyType( TANK_NW, TRUE ); - // MercPtrs[ gusSelectedSoldier ]->uiStatusFlags |= SOLDIER_CREATURE; - //EVENT_InitNewSoldierAnim( MercPtrs[ gusSelectedSoldier ], CRIPPLE_BEG, 0 , TRUE ); + // MercPtrs[ gusSelectedSoldier ]->flags.uiStatusFlags |= SOLDIER_CREATURE; + //EVENT_InitNewSoldierAnim( MercPtrs[ gusSelectedSoldier ], CRIPPLE_BEG, 0 , TRUE ); } } else @@ -2144,12 +2147,12 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { if ( CHEATER_CHEAT_LEVEL( ) ) { - EVENT_InitNewSoldierAnim( MercPtrs[ gusSelectedSoldier ], KID_SKIPPING, 0 , TRUE ); + MercPtrs[ gusSelectedSoldier ]->EVENT_InitNewSoldierAnim( KID_SKIPPING, 0 , TRUE ); //ChangeSoldiersBodyType( LARVAE_MONSTER, TRUE ); //MercPtrs[ gusSelectedSoldier ]->usAttackingWeapon = TANK_CANNON; //LocateSoldier( gusSelectedSoldier, FALSE ); - //EVENT_FireSoldierWeapon( MercPtrs[ gusSelectedSoldier ], usMapPos ); + //EVENT_FireSoldierWeapon( MercPtrs[ gusSelectedSoldier ], sMapPos ); } } else @@ -2223,14 +2226,14 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) pSoldier2 = MercPtrs[ gusUIFullTargetID ]; // Check if both OK.... - if ( pSoldier1->bLife >= OKLIFE && pSoldier2->ubID != gusSelectedSoldier ) + if ( pSoldier1->stats.bLife >= OKLIFE && pSoldier2->ubID != gusSelectedSoldier ) { - if ( pSoldier2->bLife >= OKLIFE ) + if ( pSoldier2->stats.bLife >= OKLIFE ) { if (CanSoldierReachGridNoInGivenTileLimit( pSoldier1, pSoldier2->sGridNo, 1, (INT8)gsInterfaceLevel ) ) { // Exclude enemies.... - if ( !pSoldier2->bNeutral && (pSoldier2->bSide != gbPlayerNum ) ) + if ( !pSoldier2->aiData.bNeutral && (pSoldier2->bSide != gbPlayerNum ) ) { } @@ -2242,7 +2245,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) SwapMercPositions( pSoldier1, pSoldier2 ); DeductPoints( pSoldier1, AP_EXCHANGE_PLACES, 0 ); - DeductPoints( pSoldier2, AP_EXCHANGE_PLACES, 0 ); + DeductPoints( pSoldier2, AP_EXCHANGE_PLACES, 0 ); } } } @@ -2320,6 +2323,100 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) } break; + case 'A': + //CHRISL: Ammo Crate + if ( fCtrl ) + { + INT32 crateItem; + INT32 worldItem; + bool mergeSuccessful; + OBJECTTYPE newCrate; + //look through all sector items for ammo. + for(unsigned int wItem = 0; wItem < guiNumWorldItems; wItem++) + { + crateItem = 0; + mergeSuccessful = false; + if(Item[gWorldItems[wItem].object.usItem].usItemClass == IC_AMMO && gWorldItems[wItem].bVisible == TRUE && gWorldItems[wItem].fExists && (gWorldItems[wItem].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[wItem].usFlags & WORLD_ITEM_ARMED_BOMB)) + { + worldItem = gWorldItems[wItem].object.usItem; + //we don't want to do anything if the world item is already an ammo crate + if(Item[worldItem].ammocrate == TRUE) + continue; + //we have a valid, ammo item. Look through Items.xml and see if we have an ammo crate for + // this ammo type + for(int iLoop = 0; iLoop < MAXITEMS; iLoop++) + { + //if ammocrate && calibers match && Ammo Types match + if(Item[iLoop].ammocrate == TRUE && Magazine[Item[iLoop].ubClassIndex].ubCalibre == Magazine[Item[worldItem].ubClassIndex].ubCalibre && Magazine[Item[iLoop].ubClassIndex].ubAmmoType == Magazine[Item[worldItem].ubClassIndex].ubAmmoType) + { + crateItem = iLoop; + break; + } + } + //if we found a crateItem in the list, we first want to see if we already have an item created + if(crateItem != 0) + { + //look through world items first + for(unsigned int loop=0; loop < guiNumWorldItems; loop++) + { + if(gWorldItems[loop].object.usItem == crateItem) + { + DistributeStatus(&gWorldItems[wItem].object, &gWorldItems[loop].object, Magazine[Item[crateItem].ubClassIndex].ubMagSize); + if(gWorldItems[wItem].object.ubNumberOfObjects < 1) + { + mergeSuccessful = true; + RemoveItemFromPool(gWorldItems[wItem].sGridNo,(wItem),gWorldItems[wItem].ubLevel); + RemoveItemFromWorld(wItem); + break; + } + } + } + //no crates in sector inventory. search merc inventories + if(mergeSuccessful == false) + { + for(int loop=0; loop<18; loop++) + { + if(MercPtrs[loop]->bActive && MercPtrs[loop]->bInSector) + { + for(unsigned int pocket=0; pocket < MercPtrs[loop]->inv.size(); pocket++) + { + if(MercPtrs[loop]->inv[pocket].usItem == crateItem) + { + DistributeStatus(&gWorldItems[wItem].object, &MercPtrs[loop]->inv[pocket], Magazine[Item[crateItem].ubClassIndex].ubMagSize); + if(gWorldItems[wItem].object.ubNumberOfObjects < 1) + { + mergeSuccessful = true; + RemoveItemFromPool(gWorldItems[wItem].sGridNo,(wItem),gWorldItems[wItem].ubLevel); + RemoveItemFromWorld(wItem); + break; + } + } + } + if(mergeSuccessful == true) + break; + } + } + } + //no crates in merc inventory. create a new sector item + if(mergeSuccessful == false) + { + CreateAmmo(crateItem, &newCrate, 0); + DistributeStatus(&gWorldItems[wItem].object, &newCrate, Magazine[Item[crateItem].ubClassIndex].ubMagSize); + AddItemToPool(gWorldItems[wItem].sGridNo, &newCrate, 1, gWorldItems[wItem].ubLevel, gWorldItems[wItem].usFlags, gWorldItems[wItem].bRenderZHeightAboveLevel); + if(gWorldItems[wItem].object.ubNumberOfObjects < 1) + { + mergeSuccessful = true; + RemoveItemFromPool(gWorldItems[wItem].sGridNo,(wItem),gWorldItems[wItem].ubLevel); + RemoveItemFromWorld(wItem); + } + } + } + } + } + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pImpButtonText[11] ); + } + break; + case 'j': if( fAlt ) @@ -2362,16 +2459,16 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) if ( fNearLowerLevel ) { - BeginSoldierClimbDownRoof( pjSoldier ); + pjSoldier->BeginSoldierClimbDownRoof( ); } if ( fNearHeigherLevel ) { - BeginSoldierClimbUpRoof( pjSoldier ); + pjSoldier->BeginSoldierClimbUpRoof( ); } if ( FindFenceJumpDirection( pjSoldier, pjSoldier->sGridNo, pjSoldier->ubDirection, &bDirection ) ) { - BeginSoldierClimbFence( pjSoldier ); + pjSoldier->BeginSoldierClimbFence( ); } } } @@ -2431,6 +2528,24 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) } } break; + case 'B': + //Drop pack for all mercs on current map + if(UsingNewInventorySystem() == true) + { + SOLDIERTYPE *pTeamSoldier; + INT8 bLoop; + for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++) + { + //if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) && pTeamSoldier->inv[BPACKPOCKPOS].exists() == true ) + if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && !AM_A_ROBOT( pTeamSoldier ) && pTeamSoldier->inv[BPACKPOCKPOS].exists() == true ) + { + ChangeDropPackStatus(pTeamSoldier, TRUE); + } + } + fCharacterInfoPanelDirty = TRUE; + fInterfacePanelDirty = DIRTYLEVEL2; + } + break; case 'c': if( fAlt ) @@ -2447,7 +2562,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) ToggleCliffDebug(); } } - else + else { HandleStanceChangeFromUIKeys( ANIM_CROUCH ); } @@ -2457,10 +2572,10 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) if( gTacticalStatus.uiFlags & TURNBASED && gTacticalStatus.uiFlags & INCOMBAT ) { if( gTacticalStatus.ubCurrentTeam == gbPlayerNum ) - { + { // nothing in hand and the Done button for whichever panel we're in must be enabled if ( ( gpItemPointer == NULL ) && !gfDisableTacticalPanelButtons && - ( ( ( gsCurInterfacePanel == SM_PANEL ) && ( ButtonList[ iSMPanelButtons[ SM_DONE_BUTTON ] ]->uiFlags & BUTTON_ENABLED ) ) || + ( ( ( gsCurInterfacePanel == SM_PANEL ) && ( ButtonList[ iSMPanelButtons[ SM_DONE_BUTTON ] ]->uiFlags & BUTTON_ENABLED ) ) || ( ( gsCurInterfacePanel == TEAM_PANEL ) && ( ButtonList[ iTEAMPanelButtons[ TEAM_DONE_BUTTON ] ]->uiFlags & BUTTON_ENABLED ) ) ) ) { if( fAlt ) @@ -2471,11 +2586,11 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) if ( CHEATER_CHEAT_LEVEL( ) ) { for ( pSoldier = MercPtrs[ gbPlayerNum ], cnt = 0; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) - { - if ( pSoldier->bActive && pSoldier->bLife > 0 ) + { + if ( pSoldier->bActive && pSoldier->stats.bLife > 0 ) { // Get APs back... - CalcNewActionPoints( pSoldier ); + pSoldier->CalcNewActionPoints( ); fInterfacePanelDirty = DIRTYLEVEL2; } @@ -2519,8 +2634,8 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { pSoldier = MercPtrs[ gusSelectedSoldier ]; - if ( pSoldier->bOppCnt > 0 ) - { + if ( pSoldier->aiData.bOppCnt > 0 ) + { // Cycle.... CycleVisibleEnemies( pSoldier ); } @@ -2532,9 +2647,28 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) } break; + case 'E': + //CHRISL: drop all items + if ( gusSelectedSoldier != NOBODY && !(gTacticalStatus.fEnemyInSector) ) + { + SOLDIERTYPE *pSoldier = MercPtrs[ gusSelectedSoldier ]; + for(int i = BODYPOSFINAL; iinv[i].exists() == true) + { + AddItemToPool(pSoldier->sGridNo, &pSoldier->inv[i], 1, pSoldier->pathing.bLevel, 0, -1); + //pSoldier->inv[i].initialize(); + DeleteObj(&pSoldier->inv[i]); + } + } + fCharacterInfoPanelDirty = TRUE; + fInterfacePanelDirty = DIRTYLEVEL2; + } + break; + case 'f': if( fCtrl ) - { + { if ( INFORMATION_CHEAT_LEVEL( ) ) { //Toggle Frame Rate Display @@ -2561,13 +2695,13 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) } else { - UINT16 usGridNo; + INT16 sGridNo; //Get the gridno the cursor is at - GetMouseMapPos( &usGridNo ); + GetMouseMapPos( &sGridNo ); //if there is a selected soldier, and the cursor location is valid - if( gusSelectedSoldier != NOBODY && usGridNo != NOWHERE ) + if( gusSelectedSoldier != NOBODY && sGridNo != NOWHERE ) { //if the cursor is over someone if( gfUIFullTargetFound ) @@ -2578,74 +2712,34 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) else { //Display the range to the target - DisplayRangeToTarget( MercPtrs[ gusSelectedSoldier ], usGridNo ); + DisplayRangeToTarget( MercPtrs[ gusSelectedSoldier ], sGridNo ); } } } break; - - case 'F': - if ( !(gTacticalStatus.fEnemyInSector) ) + if( fCtrl && UsingNewInventorySystem() == true ) { - HandleAllReachAbleItemsInTheSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); - - for ( UINT32 uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ ) //for all items in sector + // pick up back packs + SOLDIERTYPE *pTeamSoldier; + INT8 bLoop; + for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++) { - if ( (gWorldItems[ uiLoop ].bVisible == TRUE) && (gWorldItems[ uiLoop ].fExists) && (gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_ARMED_BOMB) )//item exists, is reachable, is visible and is not trapped + if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && !AM_A_ROBOT( pTeamSoldier ) && pTeamSoldier->inv[BPACKPOCKPOS].exists() == false ) { - if (( Item[ gWorldItems[ uiLoop ].o.usItem ].usItemClass == IC_GUN ) && (gGameExternalOptions.gfShiftFUnloadWeapons == TRUE) )//item is a gun and unloading is allowed - { - //Remove magazine - if ( (gWorldItems[ uiLoop ].o.ItemData.Gun.usGunAmmoItem != NONE) && (gWorldItems[ uiLoop ].o.ItemData.Gun.ubGunShotsLeft > 0) ) - { - OBJECTTYPE newObj; //Create object - CreateItem(gWorldItems[ uiLoop ].o.ItemData.Gun.usGunAmmoItem, 100, &newObj); - newObj.ItemData.Ammo.ubShotsLeft[0] = gWorldItems[ uiLoop ].o.ItemData.Gun.ubGunShotsLeft; - gWorldItems[ uiLoop ].o.ItemData.Gun.ubGunShotsLeft = 0; - gWorldItems[ uiLoop ].o.ItemData.Gun.usGunAmmoItem = NONE; - - // put it on the ground - AddItemToPool( gWorldItems[ uiLoop ].sGridNo, &newObj, 1, gWorldItems[ uiLoop ].ubLevel, 0 , -1 ); - } - } - - //remove attachments - if ( gGameExternalOptions.gfShiftFRemoveAttachments == TRUE ) - { - for (int bAttachPos = MAX_ATTACHMENTS-1; bAttachPos >= 0; bAttachPos--) - { - if (gWorldItems[ uiLoop ].o.usAttachItem[ bAttachPos ] != NOTHING) - { - if ( !Item[ gWorldItems[ uiLoop ].o.usAttachItem[ bAttachPos ] ].inseparable ) - { - OBJECTTYPE newObj; - if (RemoveAttachment( &(gWorldItems[ uiLoop ].o), bAttachPos, &newObj )) - { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ ATTACHMENT_REMOVED ] ); - } - // put it on the ground - AddItemToPool( gWorldItems[ uiLoop ].sGridNo, &newObj, 1, gWorldItems[ uiLoop ].ubLevel, 0 , -1 ); - } - } - } - } - - + ChangeDropPackStatus(pTeamSoldier, FALSE); } } } + SeperateItems(); + if( fCtrl ) + StackAndSort( TRUE ); break; - - - - - case 'D': - if ( gGameSettings.fOptions[TOPTION_DROP_ALL] ) - { + if ( gGameSettings.fOptions[TOPTION_DROP_ALL] ) + { gGameSettings.fOptions[TOPTION_DROP_ALL] = FALSE; ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_DROP_ALL_OFF ] ); } @@ -2656,8 +2750,8 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) } break; case 'q': - if ( gGameSettings.fOptions[TOPTION_GL_HIGH_ANGLE] ) - { + if ( gGameSettings.fOptions[TOPTION_GL_HIGH_ANGLE] ) + { gGameSettings.fOptions[TOPTION_GL_HIGH_ANGLE] = FALSE; ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_GL_LOW_ANGLE ] ); } @@ -2670,8 +2764,8 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) case 'G': - if ( gGameSettings.fOptions[TOPTION_GL_BURST_CURSOR] ) - { + if ( gGameSettings.fOptions[TOPTION_GL_BURST_CURSOR] ) + { gGameSettings.fOptions[TOPTION_GL_BURST_CURSOR] = FALSE; ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_GL_BURST_CURSOR_OFF ] ); } @@ -2717,7 +2811,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) } else { - HandlePlayerTogglingLightEffects( TRUE ); + HandlePlayerTogglingLightEffects( TRUE ); } break; case 'H': @@ -2783,7 +2877,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) } else { - if ( gGameSettings.fOptions[ TOPTION_GLOW_ITEMS ] ) + if ( gGameSettings.fOptions[ TOPTION_GLOW_ITEMS ] ) { gGameSettings.fOptions[ TOPTION_GLOW_ITEMS ] = FALSE; ToggleItemGlow( FALSE ); @@ -2824,7 +2918,6 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { if ( CHEATER_CHEAT_LEVEL( ) ) { - GrenadeTest1(); } } } @@ -2832,15 +2925,31 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { if ( CHEATER_CHEAT_LEVEL( ) ) { - GrenadeTest2(); } - } + } else { BeginKeyPanelFromKeyShortcut( ); } break; + case 'K': + //CHRISL: Swap gunsling + if ( gusSelectedSoldier != NOBODY && UsingNewInventorySystem() == true) + { + SOLDIERTYPE *pSoldier = MercPtrs[ gusSelectedSoldier ]; + BOOLEAN handFit = (CanItemFitInPosition(pSoldier, &pSoldier->inv[HANDPOS], GUNSLINGPOCKPOS, FALSE) || (pSoldier->inv[HANDPOS].exists() == false && pSoldier->inv[SECONDHANDPOS].exists() == false)); + BOOLEAN slingFit = (CanItemFitInPosition(pSoldier, &pSoldier->inv[GUNSLINGPOCKPOS], HANDPOS, FALSE) || pSoldier->inv[GUNSLINGPOCKPOS].exists() == false); + if( handFit == TRUE && slingFit == TRUE) + { + SwapObjs(&pSoldier->inv[HANDPOS], &pSoldier->inv[GUNSLINGPOCKPOS]); + HandleTacticalEffectsOfEquipmentChange(pSoldier, HANDPOS, pSoldier->inv[GUNSLINGPOCKPOS].usItem, pSoldier->inv[HANDPOS].usItem); + } + fCharacterInfoPanelDirty = TRUE; + fInterfacePanelDirty = DIRTYLEVEL2; + } + break; + case INSERT: // WANNE: Commented this out, because the interface panel is not correctly redrawn! @@ -2954,18 +3063,18 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { if ( INFORMATION_CHEAT_LEVEL( ) ) { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Memory Used: %d + %d = %d vs: %d", guiMemTotal, giMemUsedInSurfaces, ( guiMemTotal + giMemUsedInSurfaces), ( giStartingMemValue - MemGetFree() ) ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Memory Used: %d + %d = %d vs: %d", guiMemTotal, giMemUsedInSurfaces, ( guiMemTotal + giMemUsedInSurfaces), ( giStartingMemValue - MemGetFree() ) ); } } else { // nothing in hand and the Map Screen button for whichever panel we're in must be enabled if ( ( gpItemPointer == NULL ) && !gfDisableTacticalPanelButtons && - ( ( ( gsCurInterfacePanel == SM_PANEL ) && ( ButtonList[ iSMPanelButtons[ SM_MAP_SCREEN_BUTTON ] ]->uiFlags & BUTTON_ENABLED ) ) || + ( ( ( gsCurInterfacePanel == SM_PANEL ) && ( ButtonList[ iSMPanelButtons[ SM_MAP_SCREEN_BUTTON ] ]->uiFlags & BUTTON_ENABLED ) ) || ( ( gsCurInterfacePanel == TEAM_PANEL ) && ( ButtonList[ iTEAMPanelButtons[ TEAM_MAP_SCREEN_BUTTON ] ]->uiFlags & BUTTON_ENABLED ) ) ) ) { // go to Map screen - if ( !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) ) + if ( !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) ) { GoToMapScreenFromTactical(); } @@ -2980,10 +3089,12 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) } else if( fCtrl ) { - + // Merge all items + StackAndSort( FALSE ); } else { + // Move all sector items to current mercs feet if ( !(gTacticalStatus.fEnemyInSector) ) { HandleAllReachAbleItemsInTheSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); @@ -2995,18 +3106,17 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) for ( UINT32 uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ ) //for all items in sector { if ( (gWorldItems[ uiLoop ].bVisible == TRUE) && (gWorldItems[ uiLoop ].fExists) && (gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_ARMED_BOMB) && (gWorldItems[ uiLoop ].sGridNo != pSoldier->sGridNo) )//item exists and is reachable and is not already on soldiers tile - { - MoveItemPools(gWorldItems[ uiLoop ].sGridNo, pSoldier->sGridNo, gWorldItems[ uiLoop ].ubLevel, pSoldier->bLevel); + { + MoveItemPools(gWorldItems[ uiLoop ].sGridNo, pSoldier->sGridNo, gWorldItems[ uiLoop ].ubLevel, pSoldier->pathing.bLevel); } } - + NotifySoldiersToLookforItems( ); } } } break; - case PGDN: if ( CHEATER_CHEAT_LEVEL( ) ) @@ -3015,12 +3125,12 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) AttemptToChangeFloorLevel( +1 ); //try to enter a lower underground level } - if ( guiCurrentScreen != DEBUG_SCREEN ) + if ( guiCurrentScreen != DEBUG_SCREEN ) { if ( gusSelectedSoldier != NOBODY ) { // nothing in hand and either not in SM panel, or the matching button is enabled if we are in SM panel - if ( ( gpItemPointer == NULL ) ) + if ( ( gpItemPointer == NULL ) ) { GotoLowerStance( MercPtrs[ gusSelectedSoldier ] ); } @@ -3037,7 +3147,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) AttemptToChangeFloorLevel( -1 ); //try to go up towards ground level } - if ( guiCurrentScreen != DEBUG_SCREEN ) + if ( guiCurrentScreen != DEBUG_SCREEN ) { if ( gusSelectedSoldier != NOBODY ) { @@ -3053,7 +3163,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) case '*': - if ( gTacticalStatus.uiFlags & RED_ITEM_GLOW_ON ) + if ( gTacticalStatus.uiFlags & RED_ITEM_GLOW_ON ) { gTacticalStatus.uiFlags &= (~RED_ITEM_GLOW_ON ); } @@ -3068,116 +3178,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) // swap sungoggles and nightgoggles case 'N': { - /* CHRISL - Adjusted this option to allow the game to search through Helmet attachments - as well as inventory positions. - */ - SOLDIERTYPE *pTeamSoldier; - OBJECTTYPE * pObj; - INT8 bLoop, bSlot1, bSlot2, bSlot3, temp, tempStatus=0; - INT16 lastBonus=0, tempItem=0; - for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++) - { - if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) ) - { - //2 head slots - for (bSlot1 = HEAD1POS; bSlot1 <= HEAD2POS; bSlot1++) - { - if ( Item[pTeamSoldier->inv[bSlot1].usItem].brightlightvisionrangebonus > 0 ) - { - lastBonus=0; - bSlot2 = ITEM_NOT_FOUND; - bSlot3 = ITEM_NOT_FOUND; - temp = 0; - pObj = &(pTeamSoldier->inv[HELMETPOS]); - while (temp != ITEM_NOT_FOUND) - { - temp = FindNightGoggles( pTeamSoldier, lastBonus ); - if ( temp > ITEM_NOT_FOUND ) - { - lastBonus = Item[pTeamSoldier->inv[temp].usItem].nightvisionrangebonus; - bSlot2 = temp; - } - } - for (int i = 0; i < MAX_ATTACHMENTS; i++) - { - if ( Item[ pObj->usAttachItem[i] ].nightvisionrangebonus > lastBonus && Item[ pObj->usAttachItem[i] ].usItemClass == IC_FACE ) - { - bSlot2 = ITEM_NOT_FOUND; - bSlot3 = i; - lastBonus = Item[ pObj->usAttachItem[i] ].nightvisionrangebonus; - } - } - if ( bSlot3 != ITEM_NOT_FOUND ) - { - // Duplicate item in helmet attachment slot - tempItem = pObj->usAttachItem[bSlot3]; - tempStatus = pObj->bAttachStatus[bSlot3]; - // Replace helmet attachment with face slot - pObj->usAttachItem[bSlot3] = pTeamSoldier->inv[bSlot1].usItem; - pObj->bAttachStatus[bSlot3] = pTeamSoldier->inv[bSlot1].ItemData.Generic.bStatus[0]; - // Replace face slot with helmet attachment from temp - pTeamSoldier->inv[bSlot1].usItem = tempItem; - pTeamSoldier->inv[bSlot1].ItemData.Generic.bStatus[0] = tempStatus; - } - else if ( bSlot2 != ITEM_NOT_FOUND ) - { - SwapObjs( pTeamSoldier, bSlot1, bSlot2, TRUE ); - } - break; - } - else if(Item[pTeamSoldier->inv[bSlot1].usItem].nightvisionrangebonus > 0) - { - lastBonus=0; - bSlot2 = ITEM_NOT_FOUND; - bSlot3 = ITEM_NOT_FOUND; - temp = 0; - pObj = &(pTeamSoldier->inv[HELMETPOS]); - while (temp != ITEM_NOT_FOUND) - { - temp = FindSunGoggles( pTeamSoldier, lastBonus ); - if ( temp > ITEM_NOT_FOUND ) - { - lastBonus = Item[pTeamSoldier->inv[temp].usItem].brightlightvisionrangebonus; - bSlot2 = temp; - } - } - for (int i = 0; i < MAX_ATTACHMENTS; i++) - { - if ( Item[ pObj->usAttachItem[i] ].brightlightvisionrangebonus > lastBonus && Item[ pObj->usAttachItem[i] ].usItemClass == IC_FACE ) - { - bSlot2 = ITEM_NOT_FOUND; - bSlot3 = i; - lastBonus = Item[ pObj->usAttachItem[i] ].brightlightvisionrangebonus; - } - } - if ( bSlot3 != ITEM_NOT_FOUND ) - { - // Duplicate item in helmet attachment slot - tempItem = pObj->usAttachItem[bSlot3]; - tempStatus = pObj->bAttachStatus[bSlot3]; - // Replace helmet attachment with face slot - pObj->usAttachItem[bSlot3] = pTeamSoldier->inv[bSlot1].usItem; - pObj->bAttachStatus[bSlot3] = pTeamSoldier->inv[bSlot1].ItemData.Generic.bStatus[0]; - // Replace face slot with helmet attachment from temp - pTeamSoldier->inv[bSlot1].usItem = tempItem; - pTeamSoldier->inv[bSlot1].ItemData.Generic.bStatus[0] = tempStatus; - } - else if ( bSlot2 != ITEM_NOT_FOUND ) - { - SwapObjs( pTeamSoldier, bSlot1, bSlot2, TRUE ); - } - break; - } - } - fCharacterInfoPanelDirty = TRUE; - fInterfacePanelDirty = DIRTYLEVEL2; - DeleteSoldierLight( pTeamSoldier ); - PositionSoldierLight( pTeamSoldier ); - } - } - /* CHRISL - Adjusted this option to allow the game to search through Helmet attachments - as well as inventory positions. - */ + SwapGoggles(); } break; @@ -3223,19 +3224,19 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) if( gfUIShowCurIntTile ^= TRUE ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Turning Enhanced mouse detection ON." ); - gubIntTileCheckFlags = INTILE_CHECK_FULL; + gubIntTileCheckFlags = INTILE_CHECK_FULL; } else { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Turning Enhanced mouse detection OFF." ); - gubIntTileCheckFlags = INTILE_CHECK_SELECTIVE; + gubIntTileCheckFlags = INTILE_CHECK_SELECTIVE; } } #endif } else - if( !CycleSoldierFindStack( usMapPos ) )// Are we over a merc stack? - CycleIntTileFindStack( usMapPos ); // If not, now check if we are over a struct stack + if( !CycleSoldierFindStack( sMapPos ) )// Are we over a merc stack? + CycleIntTileFindStack( sMapPos ); // If not, now check if we are over a struct stack break; case 'o': @@ -3293,7 +3294,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) // Make auto reload with magazines from sector inventory - case 'R': + case 'R': if (! ( gTacticalStatus.fEnemyInSector ) ) { SOLDIERTYPE *pTeamSoldier; @@ -3304,37 +3305,37 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++) { if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) ) - { + { // Search for gun in soldier inventory - for (UINT32 bLoop2 = 0; bLoop2 < NUM_INV_SLOTS; bLoop2++) + for (UINT32 bLoop2 = 0; bLoop2 < pTeamSoldier->inv.size(); bLoop2++) { if ( (Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass & IC_GUN) || (Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass == IC_LAUNCHER) ) - { - pGun = &(pTeamSoldier->inv[bLoop2]); + { + pGun = &(pTeamSoldier->inv[bLoop2]); //if magazine is not full - if ( pGun->ItemData.Gun.ubGunShotsLeft < GetMagSize( pGun ) ) + if ( (*pGun)[0]->data.gun.ubGunShotsLeft < GetMagSize( pGun ) ) { // Search for ammo in sector - for ( UINT32 uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ ) + for ( UINT32 uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ ) { if ( (gWorldItems[ uiLoop ].bVisible == TRUE) && (gWorldItems[ uiLoop ].fExists) && (gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_ARMED_BOMB) )//item exists, is reachable, is visible and is not trapped { - if ( ( Item[ gWorldItems[ uiLoop ].o.usItem ].usItemClass & IC_AMMO ) ) // the item is ammo + if ( ( Item[ gWorldItems[ uiLoop ].object.usItem ].usItemClass & IC_AMMO ) ) // the item is ammo { - pAmmo = &( gWorldItems[ uiLoop ].o ); + pAmmo = &( gWorldItems[ uiLoop ].object ); if ( CompatibleAmmoForGun( pAmmo, pGun ) ) // can use the ammo with this gun { - // same ammo type in gun and magazine - if ( Magazine[Item[pGun->ItemData.Gun.usGunAmmoItem].ubClassIndex].ubAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType ) + // same ammo type in gun and magazine + if ( Magazine[Item[(*pGun)[0]->data.gun.usGunAmmoItem].ubClassIndex].ubAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType ) { ReloadGun( pTeamSoldier, pGun, pAmmo ); } - if (pAmmo->ItemData.Ammo.ubShotsLeft[0] == 0) - { + if ((*pAmmo)[0]->data.ubShotsLeft == 0) + { RemoveItemFromPool( gWorldItems[ uiLoop ].sGridNo, uiLoop, gWorldItems[ uiLoop ].ubLevel ); } } @@ -3356,33 +3357,33 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++) { if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) ) - { + { if ( (Item[pTeamSoldier->inv[HANDPOS].usItem].usItemClass & IC_GUN) || (Item[pTeamSoldier->inv[HANDPOS].usItem].usItemClass == IC_LAUNCHER) ) { if ( ( gTacticalStatus.uiFlags & INCOMBAT ) ) { - pGun = &(pTeamSoldier->inv[HANDPOS]); + pGun = &(pTeamSoldier->inv[HANDPOS]); //magazine is not full - if ( pGun->ItemData.Gun.ubGunShotsLeft < GetMagSize( pGun ) ) + if ( (*pGun)[0]->data.gun.ubGunShotsLeft < GetMagSize( pGun ) ) { - AutoReload( pTeamSoldier ); + AutoReload( pTeamSoldier ); } } else { // Search for gun in soldier inventory - for (UINT32 bLoop2 = 0; bLoop2 < NUM_INV_SLOTS; bLoop2++) + for (UINT32 bLoop2 = 0; bLoop2 < pTeamSoldier->inv.size(); bLoop2++) { if ( (Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass & IC_GUN) || (Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass == IC_LAUNCHER) ) - { - pGun = &(pTeamSoldier->inv[bLoop2]); + { + pGun = &(pTeamSoldier->inv[bLoop2]); //if magazine is not full - if ( pGun->ItemData.Gun.ubGunShotsLeft < GetMagSize( pGun ) ) + if ( (*pGun)[0]->data.gun.ubGunShotsLeft < GetMagSize( pGun ) ) { // Search for ammo in soldier inventory - for ( UINT32 uiLoop = 0; uiLoop < NUM_INV_SLOTS; uiLoop++ ) + for ( UINT32 uiLoop = 0; uiLoop < pTeamSoldier->inv.size(); uiLoop++ ) { if ( (Item[pTeamSoldier->inv[uiLoop].usItem].usItemClass & IC_AMMO ) ) // the item is ammo { @@ -3390,8 +3391,8 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) if ( CompatibleAmmoForGun( pAmmo, pGun ) ) // can use the ammo with this gun { - // same ammo type in gun and magazine - if ( Magazine[Item[pGun->ItemData.Gun.usGunAmmoItem].ubClassIndex].ubAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType ) + // same ammo type in gun and magazine + if ( Magazine[Item[(*pGun)[0]->data.gun.usGunAmmoItem].ubClassIndex].ubAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType ) { ReloadGun( pTeamSoldier, pGun, pAmmo ); @@ -3432,18 +3433,18 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) } } else - { - if ( !MercInWater( MercPtrs[ gusSelectedSoldier ] ) && !(MercPtrs[ gusSelectedSoldier ]->uiStatusFlags & SOLDIER_ROBOT ) ) + { + if ( !MercPtrs[ gusSelectedSoldier ]->MercInWater( ) && !(MercPtrs[ gusSelectedSoldier ]->flags.uiStatusFlags & SOLDIER_ROBOT ) ) { //change selected merc to run if ( MercPtrs[ gusSelectedSoldier ]->usUIMovementMode != WALKING && MercPtrs[ gusSelectedSoldier ]->usUIMovementMode != RUNNING ) { UIHandleSoldierStanceChange( (UINT8)gusSelectedSoldier, ANIM_STAND ); - MercPtrs[ gusSelectedSoldier ]->fUIMovementFast = 1; + MercPtrs[ gusSelectedSoldier ]->flags.fUIMovementFast = 1; } else { - MercPtrs[ gusSelectedSoldier ]->fUIMovementFast = 1; + MercPtrs[ gusSelectedSoldier ]->flags.fUIMovementFast = 1; MercPtrs[ gusSelectedSoldier ]->usUIMovementMode = RUNNING; gfPlotNewMovement = TRUE; } @@ -3452,49 +3453,10 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) } break; - - - - case 'S': - if (! ( gTacticalStatus.fEnemyInSector ) ) - { - HandleAllReachAbleItemsInTheSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); - - for ( UINT32 uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ ) - { - if ( (gWorldItems[ uiLoop ].bVisible == TRUE) && (gWorldItems[ uiLoop ].fExists) && (gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_ARMED_BOMB) )//item exists, is reachable, is visible and is not trapped - { - //find out how many items can be put in a big slot - INT8 ubSlotLimit = ItemSlotLimit( gWorldItems[ uiLoop ].o.usItem, BIGPOCK1POS ); - - //if we still have some space - INT32 i = 0; - while ( gWorldItems[ uiLoop ].o.ubNumberOfObjects < ubSlotLimit ) - { - i++; - //if the next item is the same - if ( gWorldItems[ uiLoop ].o.usItem == gWorldItems[ uiLoop + i ].o.usItem ) - { - INT8 ubObjCount = ubSlotLimit - gWorldItems[ uiLoop ].o.ubNumberOfObjects; - INT8 bPointsToMove = __min( ubObjCount, gWorldItems[ uiLoop + i ].o.ubNumberOfObjects ); - - StackObjs( &(gWorldItems[ uiLoop + i ].o), &(gWorldItems[ uiLoop ].o), bPointsToMove); - - } - else - { - break; - } - } - } - } - - //HandleAllReachAbleItemsInTheSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); - } + StackAndSort( TRUE ); break; - case 's': if( fCtrl ) @@ -3520,7 +3482,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) } } } - else + else if( fAlt ) { if( !fDisableMapInterfaceDueToBattle && !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) ) @@ -3552,7 +3514,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { if ( CHEATER_CHEAT_LEVEL( ) ) { - TeleportSelectedSoldier(); + TeleportSelectedSoldier(); } } else if( fCtrl ) @@ -3568,6 +3530,10 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) ToggleTreeTops(); break; + case 'T': + //resort Team by ubID + SortSquadByID(MercPtrs[gusSelectedSoldier]->bTeam); + break; case '=': //if the display cover or line of sight is being displayed @@ -3601,9 +3567,9 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { // Check if this guy is OK to control.... - if ( OK_CONTROLLABLE_MERC( pSoldier ) && !( pSoldier->uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) ) + if ( OK_CONTROLLABLE_MERC( pSoldier ) && !( pSoldier->flags.uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) ) { - pSoldier->uiStatusFlags |= SOLDIER_MULTI_SELECTED; + pSoldier->flags.uiStatusFlags |= SOLDIER_MULTI_SELECTED; } } EndMultiSoldierSelection( TRUE ); @@ -3640,14 +3606,14 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) if ( CHEATER_CHEAT_LEVEL( ) && gusSelectedSoldier != NOBODY ) { for ( pSoldier = MercPtrs[ gbPlayerNum ], cnt = 0; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) - { - if ( pSoldier->bActive && pSoldier->bLife > 0 ) + { + if ( pSoldier->bActive && pSoldier->stats.bLife > 0 ) { // Get breath back pSoldier->bBreath = pSoldier->bBreathMax; // Get life back - pSoldier->bLife = pSoldier->bLifeMax; + pSoldier->stats.bLife = pSoldier->stats.bLifeMax; pSoldier->bBleeding = 0; fInterfacePanelDirty = DIRTYLEVEL2; @@ -3665,16 +3631,16 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { #ifdef JA2TESTVERSION if( gfDoVideoScroll ^= TRUE ) - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Video Scroll ON" ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Video Scroll ON" ); else - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Video Scroll OFF" ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Video Scroll OFF" ); #endif } else if( fCtrl ) { #ifdef SGP_VIDEO_DEBUGGING - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"VObjects: %d", guiVObjectSize ); - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"VSurfaces: %d", guiVSurfaceSize ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"VObjects: %d", guiVObjectSize ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"VSurfaces: %d", guiVSurfaceSize ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"SGPVideoDump.txt updated..." ); PerformVideoInfoDumpIntoFile( "SGPVideoDump.txt", TRUE ); #endif @@ -3693,7 +3659,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) if ( InItemDescriptionBox( ) ) { // Swap item in description panel... - CycleItemDescriptionItem( ); + CycleItemDescriptionItem( ITEMDESC_START_X, ITEMDESC_START_Y); } else @@ -3712,7 +3678,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) } } } - else + else ToggleWireFrame(); break; @@ -3733,7 +3699,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) // Create object and set CreateItem( (UINT16) G41, 100, &Object ); - pSoldier = FindSoldierByProfileID( ROBOT, FALSE ); + pSoldier = FindSoldierByProfileID( MARIA, FALSE ); AutoPlaceObject( pSoldier, &Object, FALSE ); @@ -3768,7 +3734,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++) { if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) ) - { + { if ( pTeamSoldier->bStealthMode ) { fStealthOn = TRUE; @@ -3781,7 +3747,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++) { if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) ) - { + { if ( gpSMCurrentMerc != NULL && bLoop == gpSMCurrentMerc->ubID ) { gfUIStanceDifferent = TRUE; @@ -3844,7 +3810,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) else { #ifdef JA2TESTVERSION - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Using Normal Scroll Speed" ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Using Normal Scroll Speed" ); gubCurScrollSpeedID = 1; #endif } @@ -3858,31 +3824,40 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) if(MusicGetVolume() <= 107) MusicSetVolume(MusicGetVolume()+20); else - MusicSetVolume(127); + MusicSetVolume(127); } else if( fCtrl ) { gTacticalStatus.bRealtimeSpeed = min( MAX_REALTIME_SPEED_VAL, gTacticalStatus.bRealtimeSpeed+1 ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Increasing Realtime speed to %d", gTacticalStatus.bRealtimeSpeed ); } - else + else { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Using Higher Scroll Speed" ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Using Higher Scroll Speed" ); gubCurScrollSpeedID = 2; } #endif break; case '`': + if( fAlt ) + { + if ( CHEATER_CHEAT_LEVEL( ) ) + { + EnvBeginRainStorm( 1 ); + } + } + else if( fCtrl ) + { + if ( CHEATER_CHEAT_LEVEL( ) ) + { + EnvEndRainStorm( ); + } + } + else // Switch panels... { ToggleTacticalPanels(); - - if ( CHEATER_CHEAT_LEVEL( ) ) - { - //EnvBeginRainStorm( 1 ); - } - } break; @@ -3911,7 +3886,7 @@ void HandleTalkingMenuKeys( InputAtom *pInputEvent, UINT32 *puiNewEvent ) if ( pInputEvent->usEvent == KEY_UP ) { if ( pInputEvent->usParam == ESC ) - { + { //Handle esc in talking menu if ( HandleTalkingMenuEscape( TRUE, TRUE ) ) { @@ -3930,7 +3905,7 @@ void HandleSectorExitMenuKeys( InputAtom *pInputEvent, UINT32 *puiNewEvent ) { // CHECK ESC KEYS HERE.... if ( ( pInputEvent->usEvent == KEY_UP )&& ( pInputEvent->usParam == ESC )) - { + { //Handle esc in talking menu RemoveSectorExitMenu( FALSE ); @@ -3943,7 +3918,7 @@ void HandleOpenDoorMenuKeys( InputAtom *pInputEvent, UINT32 *puiNewEvent ) { // CHECK ESC KEYS HERE.... if ( ( pInputEvent->usEvent == KEY_UP )&& ( pInputEvent->usParam == ESC )) - { + { //Handle esc in talking menu CancelOpenDoorMenu( ); HandleOpenDoorMenu( ); @@ -3956,7 +3931,7 @@ void HandleMenuKeys( InputAtom *pInputEvent, UINT32 *puiNewEvent ) { // CHECK ESC KEYS HERE.... if ( ( pInputEvent->usEvent == KEY_UP )&& ( pInputEvent->usParam == ESC )) - { + { //Handle esc in talking menu CancelMovementMenu( ); @@ -3968,7 +3943,7 @@ void HandleItemMenuKeys( InputAtom *pInputEvent, UINT32 *puiNewEvent ) { // CHECK ESC KEYS HERE.... if ( ( pInputEvent->usEvent == KEY_UP )&& ( pInputEvent->usParam == ESC )) - { + { //Handle esc in talking menu RemoveItemPickupMenu( ); *puiNewEvent = A_CHANGE_TO_MOVE; @@ -3977,7 +3952,7 @@ void HandleItemMenuKeys( InputAtom *pInputEvent, UINT32 *puiNewEvent ) BOOLEAN HandleCheckForExitArrowsInput( BOOLEAN fAdjustConfirm ) { - UINT16 usMapPos; + INT16 sMapPos; // If not in move mode, return! if ( gCurrentUIMode != MOVE_MODE ) @@ -4023,12 +3998,12 @@ BOOLEAN HandleCheckForExitArrowsInput( BOOLEAN fAdjustConfirm ) { //Use the singular version of the string if( gMercProfiles[ MercPtrs[ gusSelectedSoldier ]->ubProfile ].bSex == MALE ) { //male singular - swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_MALE_SINGULAR ], MercPtrs[ gusSelectedSoldier ]->name, + swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_MALE_SINGULAR ], MercPtrs[ gusSelectedSoldier ]->name, MercPtrs[ gbPotentiallyAbandonedEPCSlotID ]->name ); } else { //female singular - swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_FEMALE_SINGULAR ], MercPtrs[ gusSelectedSoldier ]->name, + swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_FEMALE_SINGULAR ], MercPtrs[ gusSelectedSoldier ]->name, MercPtrs[ gbPotentiallyAbandonedEPCSlotID ]->name ); } } @@ -4055,7 +4030,7 @@ BOOLEAN HandleCheckForExitArrowsInput( BOOLEAN fAdjustConfirm ) } // Check if we want to exit! - if ( guiCurrentUICursor == EXIT_GRID_UICURSOR || guiCurrentUICursor == CONFIRM_EXIT_GRID_UICURSOR ) + if ( guiCurrentUICursor == EXIT_GRID_UICURSOR || guiCurrentUICursor == CONFIRM_EXIT_GRID_UICURSOR ) { if ( fAdjustConfirm ) { @@ -4065,21 +4040,21 @@ BOOLEAN HandleCheckForExitArrowsInput( BOOLEAN fAdjustConfirm ) } else { - if ( !GetMouseMapPos( &usMapPos ) ) + if ( !GetMouseMapPos( &sMapPos ) ) { return( FALSE ); } // Goto next sector //SimulateMouseMovement( gusMouseXPos - 5, gusMouseYPos ); - InitSectorExitMenu( DIRECTION_EXITGRID, usMapPos ); + InitSectorExitMenu( DIRECTION_EXITGRID, sMapPos ); } } return( TRUE ); } // Check if we want to exit! - if ( guiCurrentUICursor == EXIT_EAST_UICURSOR || guiCurrentUICursor == CONFIRM_EXIT_EAST_UICURSOR ) + if ( guiCurrentUICursor == EXIT_EAST_UICURSOR || guiCurrentUICursor == CONFIRM_EXIT_EAST_UICURSOR ) { if ( fAdjustConfirm ) { @@ -4096,7 +4071,7 @@ BOOLEAN HandleCheckForExitArrowsInput( BOOLEAN fAdjustConfirm ) } return( TRUE ); } - if ( guiCurrentUICursor == EXIT_WEST_UICURSOR || guiCurrentUICursor == CONFIRM_EXIT_WEST_UICURSOR ) + if ( guiCurrentUICursor == EXIT_WEST_UICURSOR || guiCurrentUICursor == CONFIRM_EXIT_WEST_UICURSOR ) { if ( fAdjustConfirm ) { @@ -4155,12 +4130,11 @@ BOOLEAN HandleCheckForExitArrowsInput( BOOLEAN fAdjustConfirm ) void CreateRandomItem() { - OBJECTTYPE Object; - UINT16 usMapPos; - if ( GetMouseMapPos( &usMapPos ) ) + INT16 sMapPos; + if ( GetMouseMapPos( &sMapPos ) ) { - CreateItem( (UINT16) (Random( 35 ) + 1), 100, &Object ); - AddItemToPool( usMapPos, &Object, -1 , 0, 0, 0 ); + CreateItem( (UINT16) (Random( 35 ) + 1), 100, &gTempObject ); + AddItemToPool( sMapPos, &gTempObject, -1 , 0, 0, 0 ); } } @@ -4168,12 +4142,11 @@ void MakeSelectedSoldierTired() { // Key to make guy get tired! SOLDIERTYPE *pSoldier; - OBJECTTYPE Object; - UINT16 usMapPos; - if ( GetMouseMapPos( &usMapPos ) ) + INT16 sMapPos; + if ( GetMouseMapPos( &sMapPos ) ) { - CreateItem( (UINT16)TNT, 100, &Object ); - AddItemToPool( usMapPos, &Object, -1, 0, 0, 0 ); + CreateItem( (UINT16)TNT, 100, &gTempObject ); + AddItemToPool( sMapPos, &gTempObject, -1, 0, 0, 0 ); } // CHECK IF WE'RE ON A GUY ( EITHER SELECTED, OURS, OR THEIRS @@ -4189,7 +4162,7 @@ void MakeSelectedSoldierTired() } void ToggleRealTime( UINT32 *puiNewEvent ) -{ +{ if ( gTacticalStatus.uiFlags & TURNBASED ) { // Change to real-time @@ -4241,7 +4214,7 @@ void ToggleViewAllItems() gTacticalStatus.uiFlags |= SHOW_ALL_ITEMS; } - if ( gGameSettings.fOptions[ TOPTION_GLOW_ITEMS ] ) + if ( gGameSettings.fOptions[ TOPTION_GLOW_ITEMS ] ) { ToggleItemGlow( TRUE ); } @@ -4256,14 +4229,14 @@ void ToggleViewAllItems() void TestExplosion() { - UINT16 usMapPos; - if ( GetMouseMapPos( &usMapPos ) ) + INT16 sMapPos; + if ( GetMouseMapPos( &sMapPos ) ) { EXPLOSION_PARAMS ExpParams ; ExpParams.uiFlags = 0; ExpParams.ubOwner = NOBODY; ExpParams.ubTypeID = STUN_BLAST; - ExpParams.sGridNo = usMapPos; + ExpParams.sGridNo = sMapPos; GenerateExplosion( &ExpParams ); @@ -4284,9 +4257,35 @@ void CycleSelectedMercsItem() usOldItem = pSoldier->inv[ HANDPOS ].usItem; - usOldItem++; + //CHRISL: Why not make this work like CycleItemDescriptionItem in that holding the SHIFT key reverses the cycle? + if ( _KeyDown( SHIFT ) ) + { + usOldItem--; + while ( usOldItem > 0 && ( Item[usOldItem].usItemClass == IC_NONE || Item[usOldItem].usItemClass == 0 ) && (UsingNewInventorySystem() == false || (UsingNewInventorySystem() == true && Item[usOldItem].ItemSize <= 34)) ) + { + usOldItem--; + } - if ( usOldItem > MAXITEMS ) + if ( usOldItem < 0 ) + { + usOldItem = MAXITEMS-1; + } + } + else + { + usOldItem++; + if ( usOldItem > MAXITEMS ) + { + usOldItem = 0; + } + + while (usOldItem < MAXITEMS && (Item[usOldItem].usItemClass == IC_NONE || Item[usOldItem].usItemClass == 0 ) && (UsingNewInventorySystem() == false || (UsingNewInventorySystem() == true && Item[usOldItem].ItemSize <= 34)) ) + { + usOldItem++; + } + } + + if ( usOldItem > MAXITEMS ) { usOldItem = 0; } @@ -4319,26 +4318,27 @@ void ToggleWireFrame() void RefreshSoldier() { SOLDIERTYPE *pSoldier; - UINT16 usMapPos; + INT16 sMapPos; // CHECK IF WE'RE ON A GUY ( EITHER SELECTED, OURS, OR THEIRS if ( gfUIFullTargetFound ) { // Get Soldier GetSoldier( &pSoldier, gusUIFullTargetID ); - ReviveSoldier( pSoldier ); + pSoldier->ReviveSoldier( ); } - if ( GetMouseMapPos( &usMapPos ) ) - sprintf( gDebugStr, "%d %d %d %d %d %d %d %d", gubWorldMovementCosts[ usMapPos ][ 0 ][ 0 ], - gubWorldMovementCosts[ usMapPos ][ 1 ][gsInterfaceLevel], - gubWorldMovementCosts[ usMapPos ][ 2 ][gsInterfaceLevel], - gubWorldMovementCosts[ usMapPos ][ 3 ][gsInterfaceLevel], - gubWorldMovementCosts[ usMapPos ][ 4 ][gsInterfaceLevel], - gubWorldMovementCosts[ usMapPos ][ 5 ][gsInterfaceLevel], - gubWorldMovementCosts[ usMapPos ][ 6 ][gsInterfaceLevel], - gubWorldMovementCosts[ usMapPos ][ 7 ][gsInterfaceLevel] ); + if ( GetMouseMapPos( &sMapPos ) ) + sprintf( gDebugStr, "%d %d %d %d %d %d %d %d", + gubWorldMovementCosts[ sMapPos ][ 0 ][gsInterfaceLevel], + gubWorldMovementCosts[ sMapPos ][ 1 ][gsInterfaceLevel], + gubWorldMovementCosts[ sMapPos ][ 2 ][gsInterfaceLevel], + gubWorldMovementCosts[ sMapPos ][ 3 ][gsInterfaceLevel], + gubWorldMovementCosts[ sMapPos ][ 4 ][gsInterfaceLevel], + gubWorldMovementCosts[ sMapPos ][ 5 ][gsInterfaceLevel], + gubWorldMovementCosts[ sMapPos ][ 6 ][gsInterfaceLevel], + gubWorldMovementCosts[ sMapPos ][ 7 ][gsInterfaceLevel] ); } void ChangeSoldiersBodyType( UINT8 ubBodyType, BOOLEAN fCreateNewPalette ) @@ -4349,11 +4349,11 @@ void ChangeSoldiersBodyType( UINT8 ubBodyType, BOOLEAN fCreateNewPalette ) if( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { pSoldier->ubBodyType = ubBodyType; - EVENT_InitNewSoldierAnim( pSoldier, STANDING, 0 , TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( STANDING, 0 , TRUE ); //SetSoldierAnimationSurface( pSoldier, pSoldier->usAnimState ); if( fCreateNewPalette ) { - CreateSoldierPalettes( pSoldier ); + pSoldier->CreateSoldierPalettes( ); switch( ubBodyType ) { @@ -4365,8 +4365,7 @@ void ChangeSoldiersBodyType( UINT8 ubBodyType, BOOLEAN fCreateNewPalette ) case INFANT_MONSTER: case QUEENMONSTER: - pSoldier->uiStatusFlags |= SOLDIER_MONSTER; - memset( &(pSoldier->inv), 0, sizeof( OBJECTTYPE ) * NUM_INV_SLOTS ); + pSoldier->flags.uiStatusFlags |= SOLDIER_MONSTER; AssignCreatureInventory( pSoldier ); CreateItem( CREATURE_YOUNG_MALE_SPIT, 100, &(pSoldier->inv[HANDPOS]) ); @@ -4375,7 +4374,7 @@ void ChangeSoldiersBodyType( UINT8 ubBodyType, BOOLEAN fCreateNewPalette ) case TANK_NW: case TANK_NE: - pSoldier->uiStatusFlags |= SOLDIER_VEHICLE; + pSoldier->flags.uiStatusFlags |= SOLDIER_VEHICLE; //pSoldier->inv[ HANDPOS ].usItem = TANK_CANNON; pSoldier->inv[ HANDPOS ].usItem = MINIMI; @@ -4392,28 +4391,28 @@ void ChangeSoldiersBodyType( UINT8 ubBodyType, BOOLEAN fCreateNewPalette ) void TeleportSelectedSoldier() { SOLDIERTYPE *pSoldier; - UINT16 usMapPos; + INT16 sMapPos; // CHECK IF WE'RE ON A GUY ( EITHER SELECTED, OURS, OR THEIRS if( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { - if ( GetMouseMapPos( &usMapPos ) ) + if ( GetMouseMapPos( &sMapPos ) ) { // Check level first.... if ( gsInterfaceLevel == 0 ) { - SetSoldierHeight( pSoldier, 0 ); - TeleportSoldier( pSoldier, usMapPos, FALSE ); - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + pSoldier->SetSoldierHeight( 0 ); + TeleportSoldier( pSoldier, sMapPos, FALSE ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); } else { // Is there a roof? - if ( FindStructure( usMapPos, STRUCTURE_ROOF ) != NULL ) + if ( FindStructure( sMapPos, STRUCTURE_ROOF ) != NULL ) { - SetSoldierHeight( pSoldier, 50.0 ); + pSoldier->SetSoldierHeight( 50.0 ); - TeleportSoldier( pSoldier, usMapPos, TRUE ); - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + TeleportSoldier( pSoldier, sMapPos, TRUE ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); } } } @@ -4459,7 +4458,7 @@ void ToggleZBuffer() void TogglePlanningMode() { SOLDIERTYPE *pSoldier; - UINT16 usMapPos; + INT16 sMapPos; // DO ONLY IN TURNED BASED! if ( gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT) ) { @@ -4468,7 +4467,7 @@ void TogglePlanningMode() { EndUIPlan( ); } - else if ( GetMouseMapPos( &usMapPos ) ) + else if ( GetMouseMapPos( &sMapPos ) ) { switch( gCurrentUIMode ) { @@ -4477,7 +4476,7 @@ void TogglePlanningMode() { GetSoldier( &pSoldier, gusSelectedSoldier ); BeginUIPlan( pSoldier ); - AddUIPlan( usMapPos, UIPLAN_ACTION_MOVETO ); + AddUIPlan( sMapPos, UIPLAN_ACTION_MOVETO ); } break; case ACTION_MODE: @@ -4485,7 +4484,7 @@ void TogglePlanningMode() { GetSoldier( &pSoldier, gusSelectedSoldier ); BeginUIPlan( pSoldier ); - AddUIPlan( usMapPos, UIPLAN_ACTION_FIRE ); + AddUIPlan( sMapPos, UIPLAN_ACTION_FIRE ); } break; } @@ -4515,13 +4514,13 @@ void ObliterateSector() for ( pTSoldier = MercPtrs[ cnt ]; cnt < MAX_NUM_SOLDIERS; pTSoldier++, cnt++ ) { - if ( pTSoldier->bActive && !pTSoldier->bNeutral && (pTSoldier->bSide != gbPlayerNum ) ) + if ( pTSoldier->bActive && !pTSoldier->aiData.bNeutral && (pTSoldier->bSide != gbPlayerNum ) ) { // ANITILE_PARAMS AniParams; // memset( &AniParams, 0, sizeof( ANITILE_PARAMS ) ); // AniParams.sGridNo = pTSoldier->sGridNo; // AniParams.ubLevelID = ANI_STRUCT_LEVEL; - // AniParams.usTileType = FIRSTEXPLOSION; + // AniParams.usTileType = FIRSTEXPLOSION; // AniParams.usTileIndex = FIRSTEXPLOSION1; // AniParams.sDelay = 80; // AniParams.sStartFrame = 0; @@ -4530,7 +4529,7 @@ void ObliterateSector() // CreateAnimationTile( &AniParams ); //PlayJA2Sample( EXPLOSION_1, RATE_11025, MIDVOLUME, 1, MIDDLEPAN ); - EVENT_SoldierGotHit( pTSoldier, 0, 400, 0, pTSoldier->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pTSoldier->bAimShotLocation, 0, NOWHERE ); + pTSoldier->EVENT_SoldierGotHit( 0, 400, 0, pTSoldier->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pTSoldier->bAimShotLocation, 0, NOWHERE ); } } } @@ -4557,23 +4556,22 @@ void JumpFence() { if ( FindFenceJumpDirection( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bDirection ) ) { - BeginSoldierClimbFence( pSoldier ); + pSoldier->BeginSoldierClimbFence( ); } } -} +} void CreateNextCivType() { INT16 sWorldX, sWorldY; SOLDIERCREATE_STRUCT MercCreateStruct; - UINT16 usMapPos; + INT16 sMapPos; static INT8 bBodyType = FATCIV; // Get Grid Corrdinates of mouse - if ( GetMouseWorldCoordsInCenter( &sWorldX, &sWorldY ) && GetMouseMapPos( &usMapPos ) ) - { + if ( GetMouseWorldCoordsInCenter( &sWorldX, &sWorldY ) && GetMouseMapPos( &sMapPos ) ) + { INT8 iNewIndex; - memset( &MercCreateStruct, 0, sizeof( MercCreateStruct ) ); MercCreateStruct.ubProfile = NO_PROFILE; MercCreateStruct.sSectorX = gWorldSectorX; MercCreateStruct.sSectorY = gWorldSectorY; @@ -4589,7 +4587,7 @@ void CreateNextCivType() } MercCreateStruct.bTeam = CIV_TEAM; - MercCreateStruct.sInsertionGridNo = usMapPos; + MercCreateStruct.sInsertionGridNo = sMapPos; RandomizeNewSoldierStats( &MercCreateStruct ); if ( TacticalCreateSoldier( &MercCreateStruct, (UINT8 *)&iNewIndex ) ) @@ -4625,13 +4623,12 @@ void CreateCow() { INT16 sWorldX, sWorldY; SOLDIERCREATE_STRUCT MercCreateStruct; - UINT16 usMapPos; + INT16 sMapPos; // Get Grid Corrdinates of mouse - if ( GetMouseWorldCoordsInCenter( &sWorldX, &sWorldY ) && GetMouseMapPos( &usMapPos ) ) - { + if ( GetMouseWorldCoordsInCenter( &sWorldX, &sWorldY ) && GetMouseMapPos( &sMapPos ) ) + { INT8 iNewIndex; - memset( &MercCreateStruct, 0, sizeof( MercCreateStruct ) ); MercCreateStruct.ubProfile = NO_PROFILE; MercCreateStruct.sSectorX = gWorldSectorX; MercCreateStruct.sSectorY = gWorldSectorY; @@ -4639,7 +4636,7 @@ void CreateCow() MercCreateStruct.bBodyType = COW; //MercCreateStruct.bTeam = SOLDIER_CREATE_AUTO_TEAM; MercCreateStruct.bTeam = CIV_TEAM; - MercCreateStruct.sInsertionGridNo = usMapPos; + MercCreateStruct.sInsertionGridNo = sMapPos; RandomizeNewSoldierStats( &MercCreateStruct ); if ( TacticalCreateSoldier( &MercCreateStruct, (UINT8 *)&iNewIndex ) ) @@ -4657,19 +4654,18 @@ void CreatePlayerControlledCow() { INT16 sWorldX, sWorldY; SOLDIERCREATE_STRUCT MercCreateStruct; - UINT16 usMapPos; + INT16 sMapPos; // Get Grid Corrdinates of mouse - if ( GetMouseWorldCoordsInCenter( &sWorldX, &sWorldY ) && GetMouseMapPos( &usMapPos ) ) - { + if ( GetMouseWorldCoordsInCenter( &sWorldX, &sWorldY ) && GetMouseMapPos( &sMapPos ) ) + { INT8 iNewIndex; - memset( &MercCreateStruct, 0, sizeof( MercCreateStruct ) ); MercCreateStruct.ubProfile = 12; MercCreateStruct.sSectorX = gWorldSectorX; MercCreateStruct.sSectorY = gWorldSectorY; MercCreateStruct.bSectorZ = gbWorldSectorZ; MercCreateStruct.bBodyType = COW; - MercCreateStruct.sInsertionGridNo = usMapPos; + MercCreateStruct.sInsertionGridNo = sMapPos; MercCreateStruct.bTeam = SOLDIER_CREATE_AUTO_TEAM; MercCreateStruct.fPlayerMerc = TRUE; @@ -4688,9 +4684,9 @@ void CreatePlayerControlledCow() void ToggleRealTimeConfirm() { -} - +} +/* void GrenadeTest1() { // Get mousexy @@ -4699,9 +4695,9 @@ void GrenadeTest1() { OBJECTTYPE Object; Object.usItem = MUSTARD_GRENADE; - Object.ItemData.Generic.bStatus[ 0 ] = 100; + Object[0]->data.objectStatus = 100; Object.ubNumberOfObjects = 1; - CreatePhysicalObject( &Object, 60, (FLOAT)(sX * CELL_X_SIZE), (FLOAT)(sY * CELL_Y_SIZE ), 256, -20, 20, 158, NOBODY, THROW_ARM_ITEM, 0, FALSE ); + CreatePhysicalObject( &Object, 60, (FLOAT)(sX * CELL_X_SIZE), (FLOAT)(sY * CELL_Y_SIZE ), 256, -20, 20, 158, NOBODY, THROW_ARM_ITEM, 0, FALSE ); } } @@ -4713,9 +4709,9 @@ void GrenadeTest2() { OBJECTTYPE Object; Object.usItem = HAND_GRENADE; - Object.ItemData.Generic.bStatus[ 0 ] = 100; + Object[0]->data.objectStatus = 100; Object.ubNumberOfObjects = 1; - CreatePhysicalObject( &Object, 60, (FLOAT)(sX * CELL_X_SIZE), (FLOAT)(sY * CELL_Y_SIZE ), 256, 0, -30, 158, NOBODY, THROW_ARM_ITEM, 0, FALSE ); + CreatePhysicalObject( &Object, 60, (FLOAT)(sX * CELL_X_SIZE), (FLOAT)(sY * CELL_Y_SIZE ), 256, 0, -30, 158, NOBODY, THROW_ARM_ITEM, 0, FALSE ); } } @@ -4727,36 +4723,34 @@ void GrenadeTest3() { OBJECTTYPE Object; Object.usItem = HAND_GRENADE; - Object.ItemData.Generic.bStatus[ 0 ] = 100; + Object[0]->data.objectStatus = 100; Object.ubNumberOfObjects = 1; - CreatePhysicalObject( &Object, 60, (FLOAT)(sX * CELL_X_SIZE), (FLOAT)(sY * CELL_Y_SIZE ), 256, -10, 10, 158, NOBODY, THROW_ARM_ITEM, 0, FALSE ); + CreatePhysicalObject( &Object, 60, (FLOAT)(sX * CELL_X_SIZE), (FLOAT)(sY * CELL_Y_SIZE ), 256, -10, 10, 158, NOBODY, THROW_ARM_ITEM, 0, FALSE ); } } - +*/ void CreatePlayerControlledMonster() { INT16 sWorldX, sWorldY; - UINT16 usMapPos; - if ( GetMouseWorldCoordsInCenter( &sWorldX, &sWorldY ) && GetMouseMapPos( &usMapPos ) ) - { + INT16 sMapPos; + if ( GetMouseWorldCoordsInCenter( &sWorldX, &sWorldY ) && GetMouseMapPos( &sMapPos ) ) + { SOLDIERCREATE_STRUCT MercCreateStruct; INT8 iNewIndex; - // WDS - Clean up inventory handling - MercCreateStruct.initialize(); MercCreateStruct.ubProfile = NO_PROFILE; MercCreateStruct.sSectorX = gWorldSectorX; MercCreateStruct.sSectorY = gWorldSectorY; MercCreateStruct.bSectorZ = gbWorldSectorZ; - //Note: only gets called if Alt and/or Ctrl isn't pressed! + //Note: only gets called if Alt and/or Ctrl isn't pressed! if ( _KeyDown( INSERT ) ) MercCreateStruct.bBodyType = QUEENMONSTER; //MercCreateStruct.bBodyType = LARVAE_MONSTER; else - MercCreateStruct.bBodyType = ADULTFEMALEMONSTER; + MercCreateStruct.bBodyType = ADULTFEMALEMONSTER; MercCreateStruct.bTeam = SOLDIER_CREATE_AUTO_TEAM; - MercCreateStruct.sInsertionGridNo = usMapPos; + MercCreateStruct.sInsertionGridNo = sMapPos; RandomizeNewSoldierStats( &MercCreateStruct ); if ( TacticalCreateSoldier( &MercCreateStruct, (UINT8 *)&iNewIndex ) ) @@ -4767,15 +4761,15 @@ void CreatePlayerControlledMonster() } -INT8 CheckForAndHandleHandleVehicleInteractiveClick( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLEAN fMovementMode ) +INT8 CheckForAndHandleHandleVehicleInteractiveClick( SOLDIERTYPE *pSoldier, INT16 sMapPos, BOOLEAN fMovementMode ) { // Look for an item pool INT16 sActionGridNo; UINT8 ubDirection; - SOLDIERTYPE *pTSoldier; + SOLDIERTYPE *pTSoldier; INT16 sAPCost = 0; - if ( gfUIFullTargetFound ) + if ( gfUIFullTargetFound ) { pTSoldier = MercPtrs[ gusUIFullTargetID ]; @@ -4794,23 +4788,23 @@ INT8 CheckForAndHandleHandleVehicleInteractiveClick( SOLDIERTYPE *pSoldier, UINT if ( EnoughPoints( pSoldier, sAPCost, 0, TRUE ) ) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_OK1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_OK1 ); // CHECK IF WE ARE AT THIS GRIDNO NOW if ( pSoldier->sGridNo != sActionGridNo ) { // SEND PENDING ACTION - pSoldier->ubPendingAction = MERC_ENTER_VEHICLE; - pSoldier->sPendingActionData2 = pTSoldier->sGridNo; - pSoldier->bPendingActionData3 = ubDirection; - pSoldier->ubPendingActionAnimCount = 0; + pSoldier->aiData.ubPendingAction = MERC_ENTER_VEHICLE; + pSoldier->aiData.sPendingActionData2 = pTSoldier->sGridNo; + pSoldier->aiData.bPendingActionData3 = ubDirection; + pSoldier->aiData.ubPendingActionAnimCount = 0; // WALK UP TO DEST FIRST - EVENT_InternalGetNewSoldierPath( pSoldier, sActionGridNo, pSoldier->usUIMovementMode, 3 , pSoldier->fNoAPToFinishMove ); + pSoldier->EVENT_InternalGetNewSoldierPath( sActionGridNo, pSoldier->usUIMovementMode, 3 , pSoldier->flags.fNoAPToFinishMove ); } else { - EVENT_SoldierEnterVehicle( pSoldier, pTSoldier->sGridNo, ubDirection ); + pSoldier->EVENT_SoldierEnterVehicle( pTSoldier->sGridNo, ubDirection ); } // OK, set UI @@ -4827,7 +4821,7 @@ INT8 CheckForAndHandleHandleVehicleInteractiveClick( SOLDIERTYPE *pSoldier, UINT return( 0 ); } -void HandleHandCursorClick( UINT16 usMapPos, UINT32 *puiNewEvent ) +void HandleHandCursorClick( INT16 sMapPos, UINT32 *puiNewEvent ) { SOLDIERTYPE *pSoldier; LEVELNODE *pIntTile; @@ -4849,7 +4843,7 @@ void HandleHandCursorClick( UINT16 usMapPos, UINT32 *puiNewEvent ) return; } - if ( CheckForAndHandleHandleVehicleInteractiveClick( pSoldier, usMapPos, FALSE ) == -1 ) + if ( CheckForAndHandleHandleVehicleInteractiveClick( pSoldier, sMapPos, FALSE ) == -1 ) { return; } @@ -4860,7 +4854,7 @@ void HandleHandCursorClick( UINT16 usMapPos, UINT32 *puiNewEvent ) { if ( ( guiUIFullTargetFlags & ENEMY_MERC ) && !( guiUIFullTargetFlags & UNCONSCIOUS_MERC ) ) { - sActionGridNo = FindAdjacentGridEx( pSoldier, MercPtrs[ gusUIFullTargetID ]->sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, MercPtrs[ gusUIFullTargetID ]->sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); if ( sActionGridNo == -1 ) { sActionGridNo = sAdjustedGridNo; @@ -4885,7 +4879,7 @@ void HandleHandCursorClick( UINT16 usMapPos, UINT32 *puiNewEvent ) } // Default action gridno to mouse.... - sActionGridNo = usMapPos; + sActionGridNo = sMapPos; // If we are over an interactive struct, adjust gridno to this.... pIntTile = ConditionalGetCurInteractiveTileGridNoAndStructure( &sIntTileGridNo , &pStructure, FALSE ); @@ -4899,7 +4893,7 @@ void HandleHandCursorClick( UINT16 usMapPos, UINT32 *puiNewEvent ) fIgnoreItems = TRUE; } - if ( pStructure->fFlags & ( STRUCTURE_ANYDOOR ) && sActionGridNo != usMapPos ) + if ( pStructure->fFlags & ( STRUCTURE_ANYDOOR ) && sActionGridNo != sMapPos ) { fIgnoreItems = TRUE; } @@ -4907,11 +4901,11 @@ void HandleHandCursorClick( UINT16 usMapPos, UINT32 *puiNewEvent ) // Check if we are over an item pool // ATE: Ignore items will be set if over a switch interactive tile... - if ( GetItemPool( sActionGridNo, &pItemPool, pSoldier->bLevel ) && ITEMPOOL_VISIBLE( pItemPool ) && !fIgnoreItems ) + if ( GetItemPool( sActionGridNo, &pItemPool, pSoldier->pathing.bLevel ) && ITEMPOOL_VISIBLE( pItemPool ) && !fIgnoreItems ) { if ( AM_AN_EPC( pSoldier ) ) { - // Display message + // Display message // ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ NO_PATH ] ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ EPC_CANNOT_DO_THAT ] ); } @@ -4919,7 +4913,7 @@ void HandleHandCursorClick( UINT16 usMapPos, UINT32 *puiNewEvent ) { INT8 bZLevel; - bZLevel = GetZLevelOfItemPoolGivenStructure( sActionGridNo, pSoldier->bLevel, pStructure ); + bZLevel = GetZLevelOfItemPoolGivenStructure( sActionGridNo, pSoldier->pathing.bLevel, pStructure ); SoldierPickupItem( pSoldier, pItemPool->iItemIndex, sActionGridNo, bZLevel ); @@ -4931,7 +4925,7 @@ void HandleHandCursorClick( UINT16 usMapPos, UINT32 *puiNewEvent ) { if ( pIntTile != NULL && !( pStructure->fFlags & STRUCTURE_HASITEMONTOP ) ) { - sActionGridNo = FindAdjacentGridEx( pSoldier, sIntTileGridNo, &ubDirection, NULL, FALSE, TRUE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, sIntTileGridNo, &ubDirection, NULL, FALSE, TRUE ); if ( sActionGridNo == -1 ) { sActionGridNo = sIntTileGridNo; @@ -4944,7 +4938,7 @@ void HandleHandCursorClick( UINT16 usMapPos, UINT32 *puiNewEvent ) } else { - if ( SelectedMercCanAffordMove( ) ) + if ( SelectedMercCanAffordMove( ) ) { *puiNewEvent = C_MOVE_MERC; } @@ -4956,14 +4950,14 @@ void HandleHandCursorClick( UINT16 usMapPos, UINT32 *puiNewEvent ) // Why should we not let them make fools of themselves....? if ( AM_AN_EPC( pSoldier ) ) { - // Display message + // Display message // ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ NO_PATH ] ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ EPC_CANNOT_DO_THAT ] ); } else { // Check morale, if < threashold, refuse... - if ( pSoldier->bMorale < 30 ) + if ( pSoldier->aiData.bMorale < 30 ) { TacticalCharacterDialogue( pSoldier, QUOTE_REFUSING_ORDER ); } @@ -4998,7 +4992,7 @@ void ExchangeMessageBoxCallBack( UINT8 bExitValue ) } -INT8 HandleMoveModeInteractiveClick( UINT16 usMapPos, UINT32 *puiNewEvent ) +INT8 HandleMoveModeInteractiveClick( INT16 sMapPos, UINT32 *puiNewEvent ) { // Look for an item pool ITEM_POOL *pItemPool; @@ -5017,32 +5011,32 @@ INT8 HandleMoveModeInteractiveClick( UINT16 usMapPos, UINT32 *puiNewEvent ) // If we are out of breath, no cursor... // if ( pSoldier->bBreath < OKBREATH ) //{ - // return( -1 ); + // return( -1 ); //} // ATE: If we are a vehicle, no moving! - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ VEHICLE_CANT_MOVE_IN_TACTICAL ] ); return( -3 ); } // OK, check for height differences..... - if ( gpWorldLevelData[ usMapPos ].sHeight != gpWorldLevelData[ pSoldier->sGridNo ].sHeight ) + if ( gpWorldLevelData[ sMapPos ].sHeight != gpWorldLevelData[ pSoldier->sGridNo ].sHeight ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ CANT_GET_THERE ] ); return( -1 ); } // See if we are over a vehicle, and walk up to it and enter.... - if ( CheckForAndHandleHandleVehicleInteractiveClick( pSoldier, usMapPos, TRUE ) == -1 ) + if ( CheckForAndHandleHandleVehicleInteractiveClick( pSoldier, sMapPos, TRUE ) == -1 ) { return( -1 ); } // Check if we are over a civillian.... if ( gfUIFullTargetFound ) - { + { if ( ValidQuickExchangePosition( ) ) { // Check if we can... @@ -5067,11 +5061,11 @@ INT8 HandleMoveModeInteractiveClick( UINT16 usMapPos, UINT32 *puiNewEvent ) // Check if we are over an item pool, take precedence over that..... // EXCEPT FOR SWITCHES! - if ( GetItemPool( sIntTileGridNo, &pItemPool, pSoldier->bLevel ) && !( pStructure->fFlags & ( STRUCTURE_SWITCH | STRUCTURE_ANYDOOR ) ) ) + if ( GetItemPool( sIntTileGridNo, &pItemPool, pSoldier->pathing.bLevel ) && !( pStructure->fFlags & ( STRUCTURE_SWITCH | STRUCTURE_ANYDOOR ) ) ) { if ( AM_AN_EPC( pSoldier ) ) { - // Display message + // Display message // ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ NO_PATH ] ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ EPC_CANNOT_DO_THAT ] ); bReturnCode = -1; @@ -5088,7 +5082,7 @@ INT8 HandleMoveModeInteractiveClick( UINT16 usMapPos, UINT32 *puiNewEvent ) if ( ( gTacticalStatus.uiFlags & INCOMBAT ) && ( gTacticalStatus.uiFlags & TURNBASED ) ) { - //puiNewEvent = C_WAIT_FOR_CONFIRM; + //puiNewEvent = C_WAIT_FOR_CONFIRM; SoldierPickupItem( pSoldier, pItemPool->iItemIndex, sIntTileGridNo, bZLevel ); } else @@ -5103,7 +5097,7 @@ INT8 HandleMoveModeInteractiveClick( UINT16 usMapPos, UINT32 *puiNewEvent ) if ( fContinue ) { - sActionGridNo = FindAdjacentGridEx( MercPtrs[ gusSelectedSoldier ], sIntTileGridNo, &ubDirection, NULL, FALSE, TRUE ); + sActionGridNo = FindAdjacentGridEx( MercPtrs[ gusSelectedSoldier ], sIntTileGridNo, &ubDirection, NULL, FALSE, TRUE ); if ( sActionGridNo == -1 ) { sActionGridNo = sIntTileGridNo; @@ -5149,7 +5143,7 @@ BOOLEAN HandleUIReloading( SOLDIERTYPE *pSoldier ) // ATE: Re-examine cursor info! gfUIForceReExamineCursorData = TRUE; - } + } return( TRUE ); } @@ -5168,7 +5162,7 @@ BOOLEAN HandleUIReloading( SOLDIERTYPE *pSoldier ) } -BOOLEAN ConfirmActionCancel( UINT16 usMapPos, UINT16 usOldMapPos ) +BOOLEAN ConfirmActionCancel( INT16 sMapPos, UINT16 usOldMapPos ) { // OK, most times we want to leave confirm mode if our // gridno is different... but if we are in the grenade throw @@ -5177,14 +5171,14 @@ BOOLEAN ConfirmActionCancel( UINT16 usMapPos, UINT16 usOldMapPos ) //{ // Calculate distence between both gridnos..... // if ( GetRangeFromGridNoDiff( GetInAimCubeUIGridNo( ), usOldMapPos ) > 1 ) - //if ( usMapPos != usOldMapPos ) + //if ( sMapPos != usOldMapPos ) // { // return( TRUE ); // } // //else { - if ( usMapPos != usOldMapPos ) + if ( sMapPos != usOldMapPos ) { return( TRUE ); } @@ -5201,6 +5195,8 @@ void ChangeCurrentSquad( INT32 iSquad ) { if ( IsSquadOnCurrentTacticalMap( iSquad ) ) { + //resort the squad in case the order has, for any reason, changed + SortSquadByID((INT8)iSquad); SetCurrentSquad( iSquad, FALSE ); } } @@ -5237,11 +5233,11 @@ void TestMeanWhile( INT32 iID ) MeanwhileDef.sSectorY = 14; // Loop through our mercs and set gridnos once some found..... - // look for all mercs on the same team, + // look for all mercs on the same team, cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) - { + { // Are we a POW in this sector? if ( pSoldier->bActive && pSoldier->bInSector ) { @@ -5251,7 +5247,7 @@ void TestMeanWhile( INT32 iID ) pSoldier->sSectorX = 7; pSoldier->sSectorY = 14; } - } + } } @@ -5264,12 +5260,11 @@ void EscapeUILock( ) //UNLOCK UI UnSetUIBusy( (UINT8)gusSelectedSoldier ); - // Decrease global busy counter... + // Decrease global busy counter... gTacticalStatus.ubAttackBusyCount = 0; #ifdef DEBUG_ATTACKBUSY OutputDebugString( "Resetting attack busy due to escape of UI lock.\n"); #endif - guiPendingOverrideEvent = LU_ENDUILOCK; UIHandleLUIEndLock( NULL ); } @@ -5316,7 +5311,6 @@ void HandleStanceChangeFromUIKeys( UINT8 ubAnimHeight ) // If we have multiple guys selected, make all change stance! SOLDIERTYPE * pSoldier; INT32 cnt; - SOLDIERTYPE *pFirstSoldier = NULL; if ( gTacticalStatus.fAtLeastOneGuyOnMultiSelect ) { @@ -5328,7 +5322,7 @@ void HandleStanceChangeFromUIKeys( UINT8 ubAnimHeight ) { if ( pSoldier->bActive && pSoldier->bInSector ) { - if ( pSoldier->uiStatusFlags & SOLDIER_MULTI_SELECTED ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) { UIHandleSoldierStanceChange( pSoldier->ubID, ubAnimHeight ); } @@ -5354,7 +5348,7 @@ void ToggleStealthMode( SOLDIERTYPE *pSoldier ) } pSoldier->bStealthMode = ! pSoldier->bStealthMode; - gfPlotNewMovement = TRUE; + gfPlotNewMovement = TRUE; fInterfacePanelDirty = DIRTYLEVEL2; if ( pSoldier->bStealthMode ) @@ -5369,12 +5363,11 @@ void ToggleStealthMode( SOLDIERTYPE *pSoldier ) } -void HandleStealthChangeFromUIKeys( ) +void HandleStealthChangeFromUIKeys( ) { // If we have multiple guys selected, make all change stance! SOLDIERTYPE * pSoldier; INT32 cnt; - SOLDIERTYPE *pFirstSoldier = NULL; if ( gTacticalStatus.fAtLeastOneGuyOnMultiSelect ) { @@ -5386,7 +5379,7 @@ void HandleStealthChangeFromUIKeys( ) { if ( pSoldier->bActive && !AM_A_ROBOT( pSoldier ) && pSoldier->bInSector ) { - if ( pSoldier->uiStatusFlags & SOLDIER_MULTI_SELECTED ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) { ToggleStealthMode( pSoldier ); } @@ -5423,14 +5416,14 @@ void TestCapture( ) // loop through sodliers and pick 3 lucky ones.... for ( cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID, pSoldier=MercPtrs[cnt]; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; cnt++, pSoldier++ ) { - if ( pSoldier->bLife >= OKLIFE && pSoldier->bActive && pSoldier->bInSector ) - { + if ( pSoldier->stats.bLife >= OKLIFE && pSoldier->bActive && pSoldier->bInSector ) + { if ( uiNumChosen < 3 ) { EnemyCapturesPlayerSoldier( pSoldier ); // Remove them from tectical.... - RemoveSoldierFromGridNo( pSoldier ); + pSoldier->RemoveSoldierFromGridNo( ); uiNumChosen++; } @@ -5465,3 +5458,214 @@ void PopupMilitiaControlMenu( SOLDIERTYPE *pSoldier ) fFirstClickInMilitiaControlScreenMask = TRUE; gfIgnoreScrolling = TRUE; } + + +void SwapGoggles() +{ + /* CHRISL - Adjusted this option to allow the game to search through Helmet attachments + as well as inventory positions. + */ + SOLDIERTYPE *pTeamSoldier; + OBJECTTYPE * pObj; + INT8 bLoop, bSlot1; + for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++) + { + if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) ) + { + //2 head slots + for (bSlot1 = HEAD1POS; bSlot1 <= HEAD2POS; bSlot1++) + { + if ( Item[pTeamSoldier->inv[bSlot1].usItem].brightlightvisionrangebonus > 0 ) + { + int bestBonus = 0; + OBJECTTYPE* pGoggles = FindNightGogglesInInv( pTeamSoldier ); + //search for better goggles on the helmet + if (pGoggles) { + Item[pGoggles->usItem].nightvisionrangebonus; + } + pObj = &(pTeamSoldier->inv[HELMETPOS]); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if ( Item[ iter->usItem ].nightvisionrangebonus > bestBonus + && Item[ iter->usItem ].usItemClass == IC_FACE ) + { + pGoggles = &(*iter); + bestBonus = Item[ iter->usItem ].nightvisionrangebonus; + } + } + if ( pGoggles ) + { + SwapObjs( pTeamSoldier, bSlot1, pGoggles, TRUE ); + break; + } + } + else if(Item[pTeamSoldier->inv[bSlot1].usItem].nightvisionrangebonus > 0) + { + int bestBonus = 0; + OBJECTTYPE* pGoggles = FindSunGogglesInInv( pTeamSoldier ); + //search for better goggles on the helmet + if (pGoggles) { + Item[pGoggles->usItem].brightlightvisionrangebonus; + } + pObj = &(pTeamSoldier->inv[HELMETPOS]); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if ( Item[ iter->usItem ].brightlightvisionrangebonus > bestBonus + && Item[ iter->usItem ].usItemClass == IC_FACE ) + { + pGoggles = &(*iter); + bestBonus = Item[ iter->usItem ].brightlightvisionrangebonus; + } + } + if ( pGoggles ) + { + SwapObjs( pTeamSoldier, bSlot1, pGoggles, TRUE ); + break; + } + } + } + fCharacterInfoPanelDirty = TRUE; + fInterfacePanelDirty = DIRTYLEVEL2; + pTeamSoldier->DeleteSoldierLight( ); + pTeamSoldier->PositionSoldierLight( ); + } + } +} + +void SeperateItems() +{ + if ( !(gTacticalStatus.fEnemyInSector) ) + { + HandleAllReachAbleItemsInTheSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); + for ( UINT32 uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ ) //for all items in sector + { + if ( (gWorldItems[ uiLoop ].bVisible == TRUE) && (gWorldItems[ uiLoop ].fExists) && (gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_ARMED_BOMB) )//item exists, is reachable, is visible and is not trapped + { + for (int x = 0; x < gWorldItems[ uiLoop ].object.ubNumberOfObjects; ++x) { + if (( Item[ gWorldItems[ uiLoop ].object.usItem ].usItemClass == IC_GUN ) && (gGameExternalOptions.gfShiftFUnloadWeapons == TRUE) )//item is a gun and unloading is allowed + { + //Remove magazine + if ( (gWorldItems[ uiLoop ].object[x]->data.gun.usGunAmmoItem != NONE) && (gWorldItems[ uiLoop ].object[x]->data.gun.ubGunShotsLeft > 0) ) + { + CreateAmmo(gWorldItems[ uiLoop ].object[x]->data.gun.usGunAmmoItem, &gTempObject, gWorldItems[ uiLoop ].object[x]->data.gun.ubGunShotsLeft); + gWorldItems[ uiLoop ].object[x]->data.gun.ubGunShotsLeft = 0; + gWorldItems[ uiLoop ].object[x]->data.gun.usGunAmmoItem = NONE; + + // put it on the ground + AddItemToPool( gWorldItems[ uiLoop ].sGridNo, &gTempObject, 1, gWorldItems[ uiLoop ].ubLevel, WORLD_ITEM_REACHABLE , -1 ); + } + } + + //remove attachments + if ( gGameExternalOptions.gfShiftFRemoveAttachments == TRUE ) + { + //CHRISL: We run into a problem here because GetFreeWorldItemIndex, which gets called + // from AddItemToPool, resets gWorldItems when it increases it's size. This means + // iter loses it's relationship which causes a CTD if we use this hotkey and there + // aren't enough open WorldItems to accomodate all the attachments we're seperating. + UINT8 cnt = 0, uiLoopCnt = 0; + // uiLoopCnt is an extra failsafe. I think I've already managed to eliminate the + // infinite loop, but just in case, we'll use uiLoopCnt to force a break after a + // certain point. + while(gWorldItems[uiLoop].object[x]->attachments.size() != cnt) + { + gTempObject = *gWorldItems[uiLoop].object[x]->GetAttachmentAtIndex(cnt); + if (gWorldItems[ uiLoop ].object.RemoveAttachment(&gTempObject,0,x)) + { + AddItemToPool( gWorldItems[ uiLoop ].sGridNo, &gTempObject, 1, gWorldItems[ uiLoop ].ubLevel, WORLD_ITEM_REACHABLE , -1 ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ ATTACHMENT_REMOVED ] ); + } + else + { + cnt++; + } + uiLoopCnt ++; + if(uiLoopCnt > 100) + break; + } + } + } + } + } + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pImpButtonText[11] ); + } +} + +void StackAndSort( BOOLEAN fRestrictToAmmo ) +{ + if (! ( gTacticalStatus.fEnemyInSector ) ) + { + HandleAllReachAbleItemsInTheSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); + + for ( UINT32 uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ ) + { + if ( (gWorldItems[ uiLoop ].bVisible == TRUE) && (gWorldItems[ uiLoop ].fExists) && (gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_ARMED_BOMB) )//item exists, is reachable, is visible and is not trapped + { + //start by putting all identical items into one large pile regardless of stacking limits so we can merge them + WORLDITEM dummyItem = gWorldItems[uiLoop]; + RemoveItemFromPool(gWorldItems[uiLoop].sGridNo,(uiLoop),gWorldItems[uiLoop].ubLevel); + RemoveItemFromWorld(uiLoop); + for(UINT32 i = uiLoop+1; i < guiNumWorldItems; i++) + { + if(dummyItem.object.usItem == gWorldItems[i].object.usItem && gWorldItems[i].bVisible == TRUE && gWorldItems[i].fExists && (gWorldItems[i].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[i].usFlags & WORLD_ITEM_ARMED_BOMB)) + { + dummyItem.object.AddObjectsToStack(gWorldItems[i].object,-1,NULL,NUM_INV_SLOTS,MAX_OBJECTS_PER_SLOT,false); + if(gWorldItems[i].object.exists() == false && gWorldItems[i].fExists) + { + RemoveItemFromPool(gWorldItems[i].sGridNo,i,gWorldItems[i].ubLevel); + RemoveItemFromWorld(i); + } + } + } + + //merge items in stack + if(fRestrictToAmmo == FALSE || Item[dummyItem.object.usItem].usItemClass == IC_AMMO) + CleanUpStack(&dummyItem.object, NULL); + + //return item to world + AddItemToPool(dummyItem.sGridNo, &dummyItem.object, dummyItem.bVisible, dummyItem.ubLevel, dummyItem.usFlags, dummyItem.bRenderZHeightAboveLevel, dummyItem.soldierID); + + //find out how many items can be put in a big slot + UINT8 ubSlotLimit = ItemSlotLimit( &gWorldItems[ uiLoop ].object, STACK_SIZE_LIMIT ); + +/* //if we still have some space + INT32 i = 0; + while ( gWorldItems[ uiLoop ].object.ubNumberOfObjects < ubSlotLimit ) + { + i++; + //if the next item is the same + if ( gWorldItems[ uiLoop ].object.usItem == gWorldItems[ uiLoop + i ].object.usItem ) + { + // Clean up ammo stacks prior to trying to merge them + if(fRestrictToAmmo == FALSE || Item[gWorldItems[uiLoop].object.usItem].usItemClass == IC_AMMO) + { + CleanUpStack(&gWorldItems[uiLoop].object, NULL); + CleanUpStack(&gWorldItems[uiLoop+i].object, NULL); + } + INT8 ubObjCount = ubSlotLimit - gWorldItems[ uiLoop ].object.ubNumberOfObjects; + INT8 bPointsToMove = __min( ubObjCount, gWorldItems[ uiLoop + i ].object.ubNumberOfObjects ); + + gWorldItems[ uiLoop ].object.AddObjectsToStack( (gWorldItems[ uiLoop + i ].object), bPointsToMove); + if(fRestrictToAmmo == FALSE || Item[gWorldItems[uiLoop].object.usItem].usItemClass == IC_AMMO) + CleanUpStack(&gWorldItems[uiLoop].object, NULL); + //CHRISL: After adding the object to the stack, we need to delete the old object from + // both gWorldItems and the ItemPool otherwise we cause a CTD. + if(gWorldItems[uiLoop+i].object.exists() == false && gWorldItems[ uiLoop ].fExists) + { + RemoveItemFromPool(gWorldItems[uiLoop+i].sGridNo,(uiLoop+i),gWorldItems[uiLoop+i].ubLevel); + RemoveItemFromWorld(uiLoop+i); + } + } + //CHRISL: by changing this to a condition, we can use this hotkey immediately after the + // SHITFT+F hotkey. Otherwise, if a stackable item ends up at the end of the inventory + // list, we won't be able to add it to the initial stack. + else if(uiLoop+i == guiNumWorldItems) + { + break; + } + }*/ + } + } + NotifySoldiersToLookforItems( ); + //HandleAllReachAbleItemsInTheSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pImpButtonText[11] ); + } +} diff --git a/Tactical/UI Cursors.cpp b/Tactical/UI Cursors.cpp index 79308fdd..1e92ffcb 100644 --- a/Tactical/UI Cursors.cpp +++ b/Tactical/UI Cursors.cpp @@ -4,7 +4,7 @@ #include "items.h" #include "weapons.h" #include "Interface Cursors.h" - #include "Soldier Control.h" + #include "overhead.h" #include "Handle UI.h" #include "Animation Control.h" @@ -31,21 +31,26 @@ #include "PATHAI.H" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + // FUNCTIONS FOR ITEM CURSOR HANDLING -UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLEAN fShowAPs, BOOLEAN fRecalc, UINT32 uiCursorFlags ); -UINT8 HandleNonActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLEAN fShowAPs, BOOLEAN fRecalc, UINT32 uiCursorFlags ); -UINT8 HandleKnifeCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fActivated, UINT32 uiCursorFlags ); -UINT8 HandlePunchCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fActivated, UINT32 uiCursorFlagsl ); -UINT8 HandleAidCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fActivated, UINT32 uiCursorFlags ); -UINT8 HandleActivatedTossCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT8 ubCursor ); -UINT8 HandleNonActivatedTossCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLEAN fRecalc, UINT32 uiCursorFlags, UINT8 ubCursor ); -UINT8 HandleWirecutterCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiCursorFlags ); -UINT8 HandleRepairCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiCursorFlags ); -UINT8 HandleRefuelCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiCursorFlags ); -UINT8 HandleRemoteCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fActivated, UINT32 uiCursorFlags ); -UINT8 HandleBombCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fActivated, UINT32 uiCursorFlags ); -UINT8 HandleJarCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiCursorFlags ); -UINT8 HandleTinCanCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiCursorFlags ); +UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, INT16 sMapPos, BOOLEAN fShowAPs, BOOLEAN fRecalc, UINT32 uiCursorFlags ); +UINT8 HandleNonActivatedTargetCursor( SOLDIERTYPE *pSoldier, INT16 sMapPos, BOOLEAN fShowAPs, BOOLEAN fRecalc, UINT32 uiCursorFlags ); +UINT8 HandleKnifeCursor( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fActivated, UINT32 uiCursorFlags ); +UINT8 HandlePunchCursor( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fActivated, UINT32 uiCursorFlagsl ); +UINT8 HandleAidCursor( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fActivated, UINT32 uiCursorFlags ); +UINT8 HandleActivatedTossCursor( SOLDIERTYPE *pSoldier, INT16 sMapPos, UINT8 ubCursor ); +UINT8 HandleNonActivatedTossCursor( SOLDIERTYPE *pSoldier, INT16 sMapPos, BOOLEAN fRecalc, UINT32 uiCursorFlags, UINT8 ubCursor ); +UINT8 HandleWirecutterCursor( SOLDIERTYPE *pSoldier, INT16 sMapPos, UINT32 uiCursorFlags ); +UINT8 HandleRepairCursor( SOLDIERTYPE *pSoldier, INT16 sMapPos, UINT32 uiCursorFlags ); +UINT8 HandleRefuelCursor( SOLDIERTYPE *pSoldier, INT16 sMapPos, UINT32 uiCursorFlags ); +UINT8 HandleRemoteCursor( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fActivated, UINT32 uiCursorFlags ); +UINT8 HandleBombCursor( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fActivated, UINT32 uiCursorFlags ); +UINT8 HandleJarCursor( SOLDIERTYPE *pSoldier, INT16 sMapPos, UINT32 uiCursorFlags ); +UINT8 HandleTinCanCursor( SOLDIERTYPE *pSoldier, INT16 sMapPos, UINT32 uiCursorFlags ); extern BOOLEAN HandleCheckForBadChangeToGetThrough( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pTargetSoldier, INT16 sTargetGridNo , INT8 bLevel ); @@ -55,7 +60,7 @@ extern UINT32 guiUITargetSoldierId; BOOLEAN gfDisplayFullCountRing = FALSE; UINT8 gubAimRingRanges[] = {30, 55, 75, 90}; // These are the cutoff ranges for the aiming rings -extern INT8 gbNumBurstLocations; //number of burst points +extern INT8 gbNumBurstLocations; //number of burst points BOOLEAN GetMouseRecalcAndShowAPFlags( UINT32 *puiCursorFlags, BOOLEAN *pfShowAPs ) @@ -70,11 +75,11 @@ BOOLEAN GetMouseRecalcAndShowAPFlags( UINT32 *puiCursorFlags, BOOLEAN *pfShowAPs // Force if we are currently cycling guys... if ( gfUIForceReExamineCursorData ) - { + { fDoNewTile = TRUE; - fRecalc = TRUE; + fRecalc = TRUE; gfUIForceReExamineCursorData = FALSE; - } + } // IF CURSOR IS MOVING if ( uiCursorFlags & MOUSE_MOVING ) @@ -86,10 +91,10 @@ BOOLEAN GetMouseRecalcAndShowAPFlags( UINT32 *puiCursorFlags, BOOLEAN *pfShowAPs RESETCOUNTER( PATHFINDCOUNTER ); fDoNewTile = TRUE; } - } + } - if ( uiCursorFlags & MOUSE_STATIONARY ) - { + if ( uiCursorFlags & MOUSE_STATIONARY ) + { // ONLY DIPSLAY APS AFTER A DELAY if ( COUNTERDONE( PATHFINDCOUNTER ) ) { @@ -99,35 +104,35 @@ BOOLEAN GetMouseRecalcAndShowAPFlags( UINT32 *puiCursorFlags, BOOLEAN *pfShowAPs if ( fDoNewTile ) { fDoNewTile = FALSE; - fRecalc = TRUE; + fRecalc = TRUE; } } - - } - if ( puiCursorFlags ) - { + } + + if ( puiCursorFlags ) + { (*puiCursorFlags) = uiCursorFlags; - } + } - if ( pfShowAPs ) - { + if ( pfShowAPs ) + { (*pfShowAPs) = fShowAPs; - } + } - return( fRecalc ); + return( fRecalc ); } // FUNCTIONS FOR CURSOR DETERMINATION! -UINT8 GetProperItemCursor( UINT8 ubSoldierID, UINT16 ubItemIndex, UINT16 usMapPos, BOOLEAN fActivated ) +UINT8 GetProperItemCursor( UINT8 ubSoldierID, UINT16 ubItemIndex, INT16 sMapPos, BOOLEAN fActivated ) { SOLDIERTYPE *pSoldier; UINT32 uiCursorFlags; BOOLEAN fShowAPs = FALSE; BOOLEAN fRecalc = FALSE; - INT16 sTargetGridNo = usMapPos; + INT16 sTargetGridNo = sMapPos; UINT8 ubCursorID=0; UINT8 ubItemCursor; @@ -150,11 +155,11 @@ UINT8 GetProperItemCursor( UINT8 ubSoldierID, UINT16 ubItemIndex, UINT16 usMapPo } else { - sTargetGridNo = usMapPos; + sTargetGridNo = sMapPos; } - ubItemCursor = GetActionModeCursor( pSoldier ); + ubItemCursor = GetActionModeCursor( pSoldier ); switch( ubItemCursor ) { @@ -166,7 +171,7 @@ UINT8 GetProperItemCursor( UINT8 ubSoldierID, UINT16 ubItemIndex, UINT16 usMapPo case KNIFECURS: //Madd: quick hack to make wirecutter cursor appear when using a knife that can cut through wire - if ( Item[ubItemIndex].wirecutters && IsCuttableWireFenceAtGridNo( sTargetGridNo ) && pSoldier->bLevel == 0 ) + if ( Item[ubItemIndex].wirecutters && IsCuttableWireFenceAtGridNo( sTargetGridNo ) && pSoldier->pathing.bLevel == 0 ) { ubCursorID = GOOD_WIRECUTTER_UICURSOR; } @@ -176,7 +181,7 @@ UINT8 GetProperItemCursor( UINT8 ubSoldierID, UINT16 ubItemIndex, UINT16 usMapPo case AIDCURS: - ubCursorID = HandleAidCursor( pSoldier, usMapPos, fActivated, uiCursorFlags ); + ubCursorID = HandleAidCursor( pSoldier, sMapPos, fActivated, uiCursorFlags ); break; case TARGETCURS: @@ -202,16 +207,16 @@ UINT8 GetProperItemCursor( UINT8 ubSoldierID, UINT16 ubItemIndex, UINT16 usMapPo { // ATE: Check for ammo if ( IsValidTargetMerc( (UINT8)gusUIFullTargetID ) && EnoughAmmo( pSoldier, FALSE, HANDPOS ) && - (!IsValidSecondHandShotForReloadingPurposes( pSoldier) || EnoughAmmo( pSoldier, FALSE, SECONDHANDPOS) ) ) + (!pSoldier->IsValidSecondHandShotForReloadingPurposes( ) || EnoughAmmo( pSoldier, FALSE, SECONDHANDPOS) ) ) { - // IF it's an ememy, goto confirm action mode - if ( ( guiUIFullTargetFlags & ENEMY_MERC ) && ( guiUIFullTargetFlags & VISIBLE_MERC ) && !( guiUIFullTargetFlags & DEAD_MERC ) && !gfCannotGetThrough ) - { + // IF it's an ememy, goto confirm action mode + if ( ( guiUIFullTargetFlags & ENEMY_MERC ) && ( guiUIFullTargetFlags & VISIBLE_MERC ) && !( guiUIFullTargetFlags & DEAD_MERC ) && !gfCannotGetThrough ) + { guiPendingOverrideEvent = A_CHANGE_TO_CONFIM_ACTION; - } - + } + } - } + } } break; @@ -220,18 +225,18 @@ UINT8 GetProperItemCursor( UINT8 ubSoldierID, UINT16 ubItemIndex, UINT16 usMapPo if ( fActivated ) { - if ( !gfUIHandlePhysicsTrajectory ) - { - ubCursorID = HandleNonActivatedTossCursor( pSoldier, sTargetGridNo, fRecalc, uiCursorFlags, ubItemCursor ); - } - else - { - ubCursorID = HandleActivatedTossCursor( pSoldier, sTargetGridNo, ubItemCursor ); - } + if ( !gfUIHandlePhysicsTrajectory ) + { + ubCursorID = HandleNonActivatedTossCursor( pSoldier, sTargetGridNo, fRecalc, uiCursorFlags, ubItemCursor ); + } + else + { + ubCursorID = HandleActivatedTossCursor( pSoldier, sTargetGridNo, ubItemCursor ); + } } else { - ubCursorID = HandleNonActivatedTossCursor( pSoldier, sTargetGridNo, fRecalc, uiCursorFlags, ubItemCursor ); + ubCursorID = HandleNonActivatedTossCursor( pSoldier, sTargetGridNo, fRecalc, uiCursorFlags, ubItemCursor ); } #if 0 @@ -243,14 +248,14 @@ UINT8 GetProperItemCursor( UINT8 ubSoldierID, UINT16 ubItemIndex, UINT16 usMapPo // ATE: Check for ammo if ( IsValidTargetMerc( (UINT8)gusUIFullTargetID ) && EnoughAmmo( pSoldier, FALSE, HANDPOS ) ) { - // IF it's an ememy, goto confirm action mode - if ( ( guiUIFullTargetFlags & ENEMY_MERC ) && ( guiUIFullTargetFlags & VISIBLE_MERC ) && !( guiUIFullTargetFlags & DEAD_MERC ) && !gfCannotGetThrough ) - { + // IF it's an ememy, goto confirm action mode + if ( ( guiUIFullTargetFlags & ENEMY_MERC ) && ( guiUIFullTargetFlags & VISIBLE_MERC ) && !( guiUIFullTargetFlags & DEAD_MERC ) && !gfCannotGetThrough ) + { guiPendingOverrideEvent = A_CHANGE_TO_CONFIM_ACTION; - } - + } + } - } + } } #endif break; @@ -280,7 +285,7 @@ UINT8 GetProperItemCursor( UINT8 ubSoldierID, UINT16 ubItemIndex, UINT16 usMapPo ubCursorID = HandleJarCursor( pSoldier, sTargetGridNo, uiCursorFlags ); break; - + case TINCANCURS: ubCursorID = HandleTinCanCursor( pSoldier, sTargetGridNo, uiCursorFlags ); @@ -293,7 +298,7 @@ UINT8 GetProperItemCursor( UINT8 ubSoldierID, UINT16 ubItemIndex, UINT16 usMapPo case INVALIDCURS: - ubCursorID = INVALID_ACTION_UICURSOR; + ubCursorID = INVALID_ACTION_UICURSOR; break; } @@ -316,7 +321,7 @@ UINT8 GetProperItemCursor( UINT8 ubSoldierID, UINT16 ubItemIndex, UINT16 usMapPo // WANNE: Shows the target cursor over the enemy soldier -UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLEAN fShowAPs, BOOLEAN fRecalc, UINT32 uiCursorFlags ) +UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, INT16 sMapPos, BOOLEAN fShowAPs, BOOLEAN fRecalc, UINT32 uiCursorFlags ) { UINT8 switchVal; BOOLEAN fEnoughPoints = TRUE; @@ -332,27 +337,27 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE UINT8 maxAimLevels = AllowedAimingLevels(pSoldier); usInHand = pSoldier->inv[ HANDPOS ].usItem; - + if ( Item[ usInHand ].usItemClass != IC_THROWING_KNIFE ) { // If we are in realtime, follow! if ( ( !( gTacticalStatus.uiFlags & INCOMBAT ) ) ) { if ( ( gAnimControl[ MercPtrs[ gusSelectedSoldier ]->usAnimState ].uiFlags & ANIM_STATIONARY ) ) - { + { if ( gUITargetShotWaiting ) { guiPendingOverrideEvent = CA_MERC_SHOOT; } } - //SoldierFollowGridNo( pSoldier, usMapPos ); + //SoldierFollowGridNo( pSoldier, sMapPos ); } // Check if we are reloading if ( ( ( gTacticalStatus.uiFlags & REALTIME ) || !( gTacticalStatus.uiFlags & INCOMBAT ) ) ) { - if ( pSoldier->fReloading || pSoldier->fPauseAim ) + if ( pSoldier->flags.fReloading || pSoldier->flags.fPauseAim ) { return( ACTION_TARGET_RELOADING ); } @@ -375,22 +380,22 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE { INT16 sCurAPCosts, sAPCosts; - sCurAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0); + sCurAPCosts = CalcTotalAPsToAttack( pSoldier, sMapPos, TRUE, 0); do { pSoldier->bDoAutofire++; - sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0); + sAPCosts = CalcTotalAPsToAttack( pSoldier, sMapPos, TRUE, 0); } - while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && sAPCosts == sCurAPCosts && pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire); + while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && sAPCosts == sCurAPCosts && pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.gun.ubGunShotsLeft >= pSoldier->bDoAutofire); pSoldier->bDoAutofire--; } gfUIAutofireBulletCount = TRUE; gsBulletCount = pSoldier->bDoAutofire; - gsTotalBulletCount = pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft; + gsTotalBulletCount = pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.gun.ubGunShotsLeft; - if(pSoldier->autofireLastStep) //set the orange tint on the numbers if we at the last step + if(pSoldier->flags.autofireLastStep) //set the orange tint on the numbers if we at the last step gTintBulletCounts = TRUE; else gTintBulletCounts = FALSE; @@ -399,15 +404,15 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE else gfUIAutofireBulletCount = FALSE; - gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, (INT8)(pSoldier->bShownAimTime ) ); + gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, sMapPos, TRUE, (INT8)(pSoldier->aiData.bShownAimTime ) ); gfUIDisplayActionPoints = TRUE; gfUIDisplayActionPointsCenter = TRUE; - + while(!EnoughPoints( pSoldier, gsCurrentActionPoints, 0 , FALSE ) && pSoldier->bDoAutofire > 1) //oops, we don't have enough points if we are in auto-fire try to decrease bulletcount { pSoldier->bDoAutofire--; - gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, (INT8)(pSoldier->bShownAimTime ) ); + gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, sMapPos, TRUE, (INT8)(pSoldier->aiData.bShownAimTime ) ); } // If we don't have any points and we are at the first refine, do nothing but warn! @@ -420,14 +425,14 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE else { // WANNE: How oft increased? - bFutureAim = (INT8)( pSoldier->bShownAimTime + 1 ); + bFutureAim = (INT8)( pSoldier->aiData.bShownAimTime + 1 ); if ( bFutureAim <= maxAimLevels ) { if (reverse == 0) { // WANNE: Current AP costs for targeting - sAPCosts = MinAPsToAttack( pSoldier, usMapPos, TRUE ) + ( bFutureAim ); + sAPCosts = MinAPsToAttack( pSoldier, sMapPos, TRUE ) + ( bFutureAim ); //gsCurrentActionPoints = sAPCosts; @@ -439,11 +444,11 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE } else { - sAPCosts = MinAPsToAttack( pSoldier, usMapPos, TRUE ) + maxAimLevels - (bFutureAim + 1); + sAPCosts = MinAPsToAttack( pSoldier, sMapPos, TRUE ) + maxAimLevels - (bFutureAim + 1); gsCurrentActionPoints = sAPCosts; - sAPCostsMin = MinAPsToAttack( pSoldier, usMapPos, TRUE ); + sAPCostsMin = MinAPsToAttack( pSoldier, sMapPos, TRUE ); if (sAPCosts < sAPCostsMin) { fEnoughPoints = FALSE; @@ -457,36 +462,36 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE //} } - + } } if ( ( ( gTacticalStatus.uiFlags & REALTIME ) || !( gTacticalStatus.uiFlags & INCOMBAT ) ) ) { - if ( !pSoldier->fPauseAim ) + if ( !pSoldier->flags.fPauseAim ) { - if ( COUNTERDONE( TARGETREFINE ) ) + if ( COUNTERDONE( TARGETREFINE ) ) { // Reset counter RESETCOUNTER( TARGETREFINE ); if ( pSoldier->bDoBurst ) { - pSoldier->bShownAimTime = REFINE_AIM_BURST; + pSoldier->aiData.bShownAimTime = REFINE_AIM_BURST; } else { - pSoldier->bShownAimTime++; + pSoldier->aiData.bShownAimTime++; - if ( pSoldier->bShownAimTime > maxAimLevels ) + if ( pSoldier->aiData.bShownAimTime > maxAimLevels ) { - pSoldier->bShownAimTime = maxAimLevels; + pSoldier->aiData.bShownAimTime = maxAimLevels; } else { - if ( pSoldier->bShownAimTime % 2 ) + if ( pSoldier->aiData.bShownAimTime % 2 ) { - PlayJA2Sample( TARG_REFINE_BEEP, RATE_11025, MIDVOLUME, 1, MIDDLEPAN ); + PlayJA2Sample( TARG_REFINE_BEEP, RATE_11025, MIDVOLUME, 1, MIDDLEPAN ); } } } @@ -509,7 +514,7 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE } else { - if ( SoldierToLocationChanceToGetThrough( pSoldier, usMapPos, (INT8) gsInterfaceLevel, pSoldier->bTargetCubeLevel, NOBODY ) < OK_CHANCE_TO_GET_THROUGH ) + if ( SoldierToLocationChanceToGetThrough( pSoldier, sMapPos, (INT8) gsInterfaceLevel, pSoldier->bTargetCubeLevel, NOBODY ) < OK_CHANCE_TO_GET_THROUGH ) { gfCannotGetThrough = TRUE; } @@ -526,18 +531,18 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE //gfCannotGetThrough = FALSE; } - if ( pSoldier->fDoSpread && pSoldier->bDoAutofire) //approximate spread-auto costs + if ( pSoldier->flags.fDoSpread && pSoldier->bDoAutofire) //approximate spread-auto costs { if(gbNumBurstLocations > pSoldier->bDoAutofire) { INT16 sAPCosts; - + do { pSoldier->bDoAutofire++; sAPCosts = CalcTotalAPsToAttack( pSoldier, gsBurstLocations[0].sGridNo, TRUE, 0); } - while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire && gbNumBurstLocations >= pSoldier->bDoAutofire); + while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.gun.ubGunShotsLeft >= pSoldier->bDoAutofire && gbNumBurstLocations >= pSoldier->bDoAutofire); pSoldier->bDoAutofire--; gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, gsBurstLocations[0].sGridNo, TRUE, 0 ); @@ -556,15 +561,15 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE usCursor = RED_THROW_UICURSOR; } else - { + { usCursor = ACTION_TARGETRED_UICURSOR; } } else if ( pSoldier->bDoBurst ) { - if ( pSoldier->fDoSpread ) + if ( pSoldier->flags.fDoSpread ) { - usCursor = ACTION_TARGETREDBURST_UICURSOR; + usCursor = ACTION_TARGETREDBURST_UICURSOR; } else { @@ -577,7 +582,7 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE pSoldier->bTargetLevel = (INT8) gsInterfaceLevel; UINT32 uiHitChance; - uiHitChance = CalcChanceToHitGun( pSoldier, usMapPos, 0, pSoldier->bAimShotLocation ); + uiHitChance = CalcChanceToHitGun( pSoldier, sMapPos, 0, pSoldier->bAimShotLocation ); pSoldier->bTargetLevel = bTempTargetLevel; @@ -597,16 +602,16 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE pSoldier->bTargetLevel = (INT8) gsInterfaceLevel; UINT32 uiHitChance; - uiHitChance = CalcChanceToHitGun( pSoldier, usMapPos, (INT8)(pSoldier->bShownAimTime ), pSoldier->bAimShotLocation ); + uiHitChance = CalcChanceToHitGun( pSoldier, sMapPos, (INT8)(pSoldier->aiData.bShownAimTime ), pSoldier->bAimShotLocation ); pSoldier->bTargetLevel = bTempTargetLevel; - + gfUICtHBar = TRUE; gbCtH = (gbCtH+uiHitChance)/2; } - - switchVal = pSoldier->bShownAimTime; - + + switchVal = pSoldier->aiData.bShownAimTime; + switch( switchVal ) { case REFINE_AIM_1: @@ -653,7 +658,7 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE } else if ( fEnoughPoints ) { - usCursor = ACTION_THROWAIM3_UICURSOR; + usCursor = ACTION_THROWAIM3_UICURSOR; } else { @@ -668,7 +673,7 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE } else if ( fEnoughPoints ) { - usCursor = ACTION_TARGETAIM3_UICURSOR; + usCursor = ACTION_TARGETAIM3_UICURSOR; } else { @@ -755,11 +760,11 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE } else if ( fEnoughPoints ) { - usCursor = ACTION_THROWAIM9_UICURSOR; + usCursor = ACTION_THROWAIM9_UICURSOR; } else { - usCursor = ACTION_THROWAIMCANT5_UICURSOR; + usCursor = ACTION_THROWAIMCANT5_UICURSOR; } } else @@ -770,18 +775,18 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE } else if ( fEnoughPoints ) { - usCursor = ACTION_TARGETAIM9_UICURSOR; + usCursor = ACTION_TARGETAIM9_UICURSOR; } else { - usCursor = ACTION_TARGETAIMCANT5_UICURSOR; + usCursor = ACTION_TARGETAIMCANT5_UICURSOR; } } break; case REFINE_AIM_MID1: - //usCursor = ACTION_TARGETAIM2_UICURSOR; + //usCursor = ACTION_TARGETAIM2_UICURSOR; if ( Item[ usInHand ].usItemClass == IC_THROWING_KNIFE ) { if ( gfDisplayFullCountRing ) @@ -825,7 +830,7 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE } else if ( fEnoughPoints ) { - usCursor = ACTION_THROWAIM4_UICURSOR; + usCursor = ACTION_THROWAIM4_UICURSOR; } else { @@ -840,7 +845,7 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE } else if ( fEnoughPoints ) { - usCursor = ACTION_TARGETAIM4_UICURSOR; + usCursor = ACTION_TARGETAIM4_UICURSOR; } else { @@ -853,7 +858,7 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE case REFINE_AIM_MID3: //usCursor = ACTION_TARGETAIM6_UICURSOR; - + if ( Item[ usInHand ].usItemClass == IC_THROWING_KNIFE ) { if ( gfDisplayFullCountRing ) @@ -888,7 +893,7 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE break; case REFINE_AIM_MID4: - //usCursor = ACTION_TARGETAIM8_UICURSOR; + //usCursor = ACTION_TARGETAIM8_UICURSOR; if ( Item[ usInHand ].usItemClass == IC_THROWING_KNIFE ) { if ( gfDisplayFullCountRing ) @@ -929,13 +934,13 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE RemoveCursorFlags( gUICursors[ usCursor ].usFreeCursorName, CURSOR_TO_FLASH ); RemoveCursorFlags( gUICursors[ usCursor ].usFreeCursorName, CURSOR_TO_PLAY_SOUND ); - if ( gfCannotGetThrough ) + if ( gfCannotGetThrough ) { SetCursorSpecialFrame( gUICursors[ usCursor ].usFreeCursorName, 1 ); } else { - if ( !InRange( pSoldier, usMapPos ) ) + if ( !InRange( pSoldier, sMapPos ) ) { // OK, make buddy flash! SetCursorFlags( gUICursors[ usCursor ].usFreeCursorName, CURSOR_TO_FLASH ); @@ -953,9 +958,9 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE // WANNE: Shows the target cursor if we are not hovering over an enemy soldier -UINT8 HandleNonActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos , BOOLEAN fShowAPs, BOOLEAN fRecalc, UINT32 uiCursorFlags ) +UINT8 HandleNonActivatedTargetCursor( SOLDIERTYPE *pSoldier, INT16 sMapPos , BOOLEAN fShowAPs, BOOLEAN fRecalc, UINT32 uiCursorFlags ) { - UINT16 usInHand; + UINT16 usInHand; usInHand = pSoldier->inv[ HANDPOS ].usItem; @@ -966,20 +971,21 @@ UINT8 HandleNonActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos , B //DetermineCursorBodyLocation( (UINT8)gusSelectedSoldier, FALSE, fRecalc ); DetermineCursorBodyLocation( (UINT8)gusSelectedSoldier, fShowAPs, fRecalc ); - if ( pSoldier->fReloading || pSoldier->fPauseAim ) + if ( pSoldier->flags.fReloading || pSoldier->flags.fPauseAim ) { return( ACTION_TARGET_RELOADING ); } - } + } + //CHRISL: We need to only check the second hand if the weapon in the second hand is onehanded // Check for enough ammo... - if ( !EnoughAmmo( pSoldier, FALSE, HANDPOS ) || (IsValidSecondHandShotForReloadingPurposes( pSoldier) && !EnoughAmmo( pSoldier, FALSE, SECONDHANDPOS) ) ) + if ( !EnoughAmmo( pSoldier, FALSE, HANDPOS ) || (pSoldier->IsValidSecondHandShotForReloadingPurposes( ) && !EnoughAmmo( pSoldier, FALSE, SECONDHANDPOS) && !Item[pSoldier->inv[SECONDHANDPOS].usItem].twohanded ) ) { // Check if ANY ammo exists..... if ( FindAmmoToReload( pSoldier, HANDPOS, NO_SLOT ) == NO_SLOT ) { // OK, use BAD reload cursor..... - return( BAD_RELOAD_UICURSOR ); + return( BAD_RELOAD_UICURSOR ); } else { @@ -991,7 +997,7 @@ UINT8 HandleNonActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos , B //gUIDisplayActionPointsOffY = 7; // OK, use GOOD reload cursor..... - return( GOOD_RELOAD_UICURSOR ); + return( GOOD_RELOAD_UICURSOR ); } } } @@ -1000,7 +1006,7 @@ UINT8 HandleNonActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos , B { DetermineCursorBodyLocation( (UINT8)gusSelectedSoldier, fShowAPs, fRecalc ); - gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, (INT8)(pSoldier->bShownAimTime ) ); + gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, sMapPos, TRUE, (INT8)(pSoldier->aiData.bShownAimTime ) ); gfUIDisplayActionPoints = TRUE; gfUIDisplayActionPointsCenter = TRUE; @@ -1020,21 +1026,21 @@ UINT8 HandleNonActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos , B } - if(gusUIFullTargetID == NOBODY && pSoldier->bDoAutofire && !pSoldier->fDoSpread) //reset autofire if we move the mouse off the target, however don't reset it if we are spread-bursting + if(gusUIFullTargetID == NOBODY && pSoldier->bDoAutofire && !pSoldier->flags.fDoSpread) //reset autofire if we move the mouse off the target, however don't reset it if we are spread-bursting { if(gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT )) pSoldier->bDoAutofire = 1; else pSoldier->bDoAutofire = 6; - pSoldier->autofireLastStep = FALSE; + pSoldier->flags.autofireLastStep = FALSE; } //if ( gTacticalStatus.uiFlags & TURNBASED && !(gTacticalStatus.uiFlags & INCOMBAT ) ) { if ( fRecalc ) { - if ( SoldierToLocationChanceToGetThrough( pSoldier, usMapPos, (INT8) gsInterfaceLevel, pSoldier->bTargetCubeLevel, NOBODY ) < OK_CHANCE_TO_GET_THROUGH ) + if ( SoldierToLocationChanceToGetThrough( pSoldier, sMapPos, (INT8) gsInterfaceLevel, pSoldier->bTargetCubeLevel, NOBODY ) < OK_CHANCE_TO_GET_THROUGH ) { gfCannotGetThrough = TRUE; } @@ -1049,40 +1055,40 @@ UINT8 HandleNonActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos , B { gfCannotGetThrough = FALSE; } - + if ( gfCannotGetThrough ) { if ( pSoldier->bDoBurst ) { - return( ACTION_NOCHANCE_BURST_UICURSOR ); + return( ACTION_NOCHANCE_BURST_UICURSOR ); } else if ( Item[ usInHand ].usItemClass == IC_THROWING_KNIFE ) { - return( BAD_THROW_UICURSOR ); + return( BAD_THROW_UICURSOR ); } else { - return( ACTION_NOCHANCE_SHOOT_UICURSOR ); + return( ACTION_NOCHANCE_SHOOT_UICURSOR ); } } } // Determine if good range - if ( !InRange( pSoldier, usMapPos ) ) + if ( !InRange( pSoldier, sMapPos ) ) { // Flash cursor! // Check if we're in burst mode! if ( Item[ usInHand ].usItemClass == IC_THROWING_KNIFE ) { - return( FLASH_THROW_UICURSOR ); + return( FLASH_THROW_UICURSOR ); } else if ( pSoldier->bDoBurst ) { //return( ACTION_FIRSTAID_RED ); - return( ACTION_FLASH_BURST_UICURSOR ); + return( ACTION_FLASH_BURST_UICURSOR ); } else - { + { //return( ACTION_FIRSTAID_RED ); return( ACTION_FLASH_SHOOT_UICURSOR ); } @@ -1092,7 +1098,7 @@ UINT8 HandleNonActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos , B // Check if we're in burst mode! if ( Item[ usInHand ].usItemClass == IC_THROWING_KNIFE ) { - return( GOOD_THROW_UICURSOR ); + return( GOOD_THROW_UICURSOR ); } else if ( pSoldier->bDoBurst ) { @@ -1100,7 +1106,7 @@ UINT8 HandleNonActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos , B return( ACTION_TARGETBURST_UICURSOR ); } else - { + { //return( ACTION_FIRSTAID_RED ); return( ACTION_SHOOT_UICURSOR ); } @@ -1112,7 +1118,7 @@ UINT8 HandleNonActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos , B void DetermineCursorBodyLocation( UINT8 ubSoldierID, BOOLEAN fDisplay, BOOLEAN fRecalc ) { - UINT16 usMapPos; + INT16 sMapPos; SOLDIERTYPE *pTargetSoldier = NULL, *pSoldier; UINT16 usFlags; INT16 sMouseX, sMouseY, sCellX, sCellY, sScreenX, sScreenY; @@ -1133,13 +1139,13 @@ void DetermineCursorBodyLocation( UINT8 ubSoldierID, BOOLEAN fDisplay, BOOLEAN f // ALWAYS SET AIM LOCATION TO NOTHING pSoldier->bAimShotLocation = AIM_SHOT_RANDOM; - if( !GetMouseMapPos( &usMapPos) ) + if( !GetMouseMapPos( &sMapPos) ) { return; } // Determine which body part it's on - pNode = GetAnimProfileFlags( usMapPos, &usFlags, &pTargetSoldier, NULL ); + pNode = GetAnimProfileFlags( sMapPos, &usFlags, &pTargetSoldier, NULL ); while( pNode != NULL ) { @@ -1153,7 +1159,7 @@ void DetermineCursorBodyLocation( UINT8 ubSoldierID, BOOLEAN fDisplay, BOOLEAN f fOnGuy = TRUE; - // Check if we have a half tile profile + // Check if we have a half tile profile if ( usFlags & TILE_FLAG_NORTH_HALF ) { // Check if we are in north half of tile! @@ -1164,7 +1170,7 @@ void DetermineCursorBodyLocation( UINT8 ubSoldierID, BOOLEAN fDisplay, BOOLEAN f fOnGuy = FALSE; } } - // Check if we have a half tile profile + // Check if we have a half tile profile if ( usFlags & TILE_FLAG_SOUTH_HALF ) { // Check if we are in north half of tile! @@ -1175,7 +1181,7 @@ void DetermineCursorBodyLocation( UINT8 ubSoldierID, BOOLEAN fDisplay, BOOLEAN f fOnGuy = FALSE; } } - // Check if we have a half tile profile + // Check if we have a half tile profile if ( usFlags & TILE_FLAG_WEST_HALF ) { // Check if we are in north half of tile! @@ -1225,7 +1231,7 @@ void DetermineCursorBodyLocation( UINT8 ubSoldierID, BOOLEAN fDisplay, BOOLEAN f } } - + // Check if mouse is iin bounding box of soldier if ( !IsPointInSoldierBoundingBox( pTargetSoldier, gusMouseXPos, gusMouseYPos ) ) { @@ -1236,7 +1242,7 @@ void DetermineCursorBodyLocation( UINT8 ubSoldierID, BOOLEAN fDisplay, BOOLEAN f if ( fOnGuy ) break; - pNode = GetAnimProfileFlags( usMapPos, &usFlags, &pTargetSoldier, pNode ); + pNode = GetAnimProfileFlags( sMapPos, &usFlags, &pTargetSoldier, pNode ); } @@ -1246,12 +1252,12 @@ void DetermineCursorBodyLocation( UINT8 ubSoldierID, BOOLEAN fDisplay, BOOLEAN f // Check if we can find a soldier here if ( gfUIFullTargetFound ) { - pTargetSoldier = MercPtrs[ gusUIFullTargetID ]; + pTargetSoldier = MercPtrs[ gusUIFullTargetID ]; - if ( FindRelativeSoldierPosition( pTargetSoldier, &usFlags, gusMouseXPos, gusMouseYPos ) ) - { + if ( FindRelativeSoldierPosition( pTargetSoldier, &usFlags, gusMouseXPos, gusMouseYPos ) ) + { fOnGuy = TRUE; - } + } } } @@ -1260,7 +1266,7 @@ void DetermineCursorBodyLocation( UINT8 ubSoldierID, BOOLEAN fDisplay, BOOLEAN f if ( fOnGuy ) { if ( IsValidTargetMerc( pTargetSoldier->ubID ) ) - { + { if ( usFlags & TILE_FLAG_FEET ) { pSoldier->bAimShotLocation = AIM_SHOT_LEGS; @@ -1330,7 +1336,7 @@ void DetermineCursorBodyLocation( UINT8 ubSoldierID, BOOLEAN fDisplay, BOOLEAN f } -UINT8 HandleKnifeCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fActivated, UINT32 uiCursorFlags ) +UINT8 HandleKnifeCursor( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fActivated, UINT32 uiCursorFlags ) { INT16 sAPCosts; INT8 bFutureAim; @@ -1351,7 +1357,7 @@ UINT8 HandleKnifeCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fActivat // Calculate action points if ( gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT) ) { - gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, sGridNo, TRUE, (INT8)(pSoldier->bShownAimTime ) ); + gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, sGridNo, TRUE, (INT8)(pSoldier->aiData.bShownAimTime ) ); gfUIDisplayActionPoints = TRUE; gfUIDisplayActionPointsCenter = TRUE; @@ -1360,7 +1366,7 @@ UINT8 HandleKnifeCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fActivat { gfUIDisplayActionPointsInvalid = TRUE; - if ( pSoldier->bShownAimTime == REFINE_KNIFE_1 ) + if ( pSoldier->aiData.bShownAimTime == REFINE_KNIFE_1 ) { return( KNIFE_HIT_UICURSOR ); } @@ -1380,26 +1386,26 @@ UINT8 HandleKnifeCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fActivat if ( ( ( gTacticalStatus.uiFlags & REALTIME ) || !( gTacticalStatus.uiFlags & INCOMBAT ) ) ) { - if ( !pSoldier->fPauseAim ) + if ( !pSoldier->flags.fPauseAim ) { - if ( COUNTERDONE( NONGUNTARGETREFINE ) ) + if ( COUNTERDONE( NONGUNTARGETREFINE ) ) { // Reset counter RESETCOUNTER( NONGUNTARGETREFINE ); - if ( pSoldier->bShownAimTime == REFINE_KNIFE_1 ) + if ( pSoldier->aiData.bShownAimTime == REFINE_KNIFE_1 ) { - PlayJA2Sample( TARG_REFINE_BEEP, RATE_11025, MIDVOLUME, 1, MIDDLEPAN ); + PlayJA2Sample( TARG_REFINE_BEEP, RATE_11025, MIDVOLUME, 1, MIDDLEPAN ); } - pSoldier->bShownAimTime = REFINE_KNIFE_2; + pSoldier->aiData.bShownAimTime = REFINE_KNIFE_2; } } } - switch( pSoldier->bShownAimTime ) + switch( pSoldier->aiData.bShownAimTime ) { case REFINE_KNIFE_1: @@ -1458,7 +1464,7 @@ UINT8 HandleKnifeCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fActivat } -UINT8 HandlePunchCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fActivated, UINT32 uiCursorFlags ) +UINT8 HandlePunchCursor( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fActivated, UINT32 uiCursorFlags ) { INT16 sAPCosts; INT8 bFutureAim; @@ -1479,7 +1485,7 @@ UINT8 HandlePunchCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fActivat // Calculate action points if ( gTacticalStatus.uiFlags & TURNBASED ) { - gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, sGridNo, TRUE, (INT8)(pSoldier->bShownAimTime ) ); + gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, sGridNo, TRUE, (INT8)(pSoldier->aiData.bShownAimTime ) ); gfUIDisplayActionPoints = TRUE; gfUIDisplayActionPointsCenter = TRUE; @@ -1488,7 +1494,7 @@ UINT8 HandlePunchCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fActivat { gfUIDisplayActionPointsInvalid = TRUE; - if ( pSoldier->bShownAimTime == REFINE_PUNCH_1 ) + if ( pSoldier->aiData.bShownAimTime == REFINE_PUNCH_1 ) { return( ACTION_PUNCH_RED ); } @@ -1508,25 +1514,25 @@ UINT8 HandlePunchCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fActivat if ( ( ( gTacticalStatus.uiFlags & REALTIME ) || !( gTacticalStatus.uiFlags & INCOMBAT ) ) ) { - if ( !pSoldier->fPauseAim ) + if ( !pSoldier->flags.fPauseAim ) { - if ( COUNTERDONE( NONGUNTARGETREFINE ) ) + if ( COUNTERDONE( NONGUNTARGETREFINE ) ) { // Reset counter RESETCOUNTER( NONGUNTARGETREFINE ); - if ( pSoldier->bShownAimTime == REFINE_PUNCH_1 ) + if ( pSoldier->aiData.bShownAimTime == REFINE_PUNCH_1 ) { - PlayJA2Sample( TARG_REFINE_BEEP, RATE_11025, MIDVOLUME, 1, MIDDLEPAN ); + PlayJA2Sample( TARG_REFINE_BEEP, RATE_11025, MIDVOLUME, 1, MIDDLEPAN ); } - pSoldier->bShownAimTime = REFINE_PUNCH_2; + pSoldier->aiData.bShownAimTime = REFINE_PUNCH_2; } } } - switch( pSoldier->bShownAimTime ) + switch( pSoldier->aiData.bShownAimTime ) { case REFINE_PUNCH_1: @@ -1584,7 +1590,7 @@ UINT8 HandlePunchCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fActivat } } -UINT8 HandleAidCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fActivated, UINT32 uiCursorFlags ) +UINT8 HandleAidCursor( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fActivated, UINT32 uiCursorFlags ) { // DRAW PATH TO GUY HandleUIMovementCursor( pSoldier, uiCursorFlags, sGridNo, MOVEUI_TARGET_MERCSFORAID ); @@ -1607,23 +1613,19 @@ UINT8 HandleAidCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fActivated } } -UINT8 HandleActivatedTossCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubItemCursor ) +UINT8 HandleActivatedTossCursor( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubItemCursor ) { return( ACTION_TOSS_UICURSOR ); } -UINT8 HandleNonActivatedTossCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fRecalc, UINT32 uiCursorFlags, UINT8 ubItemCursor ) +UINT8 HandleNonActivatedTossCursor( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fRecalc, UINT32 uiCursorFlags, UINT8 ubItemCursor ) { INT16 sFinalGridNo; static BOOLEAN fBadCTGH = FALSE; BOOLEAN fArmed = FALSE; INT8 bLevel; - OBJECTTYPE TempObject; - INT8 bSlot; OBJECTTYPE * pObj; - INT8 bAttachPos; - // Check for enough ammo... if ( ubItemCursor == TRAJECTORYCURS ) @@ -1636,7 +1638,7 @@ UINT8 HandleNonActivatedTossCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLE if ( FindAmmoToReload( pSoldier, HANDPOS, NO_SLOT ) == NO_SLOT ) { // OK, use BAD reload cursor..... - return( BAD_RELOAD_UICURSOR ); + return( BAD_RELOAD_UICURSOR ); } else { @@ -1648,7 +1650,7 @@ UINT8 HandleNonActivatedTossCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLE //gUIDisplayActionPointsOffY = 7; // OK, use GOOD reload cursor..... - return( GOOD_RELOAD_UICURSOR ); + return( GOOD_RELOAD_UICURSOR ); } } } @@ -1658,7 +1660,7 @@ UINT8 HandleNonActivatedTossCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLE { if ( ubItemCursor == TRAJECTORYCURS ) { - gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, sGridNo, TRUE, (INT8)(pSoldier->bShownAimTime ) ); + gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, sGridNo, TRUE, (INT8)(pSoldier->aiData.bShownAimTime ) ); } else { @@ -1693,36 +1695,14 @@ UINT8 HandleNonActivatedTossCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLE } else { - // ATE: Find the object to use... - memcpy( &TempObject, &(pSoldier->inv[ HANDPOS ] ), sizeof( OBJECTTYPE ) ); - - // Do we have a launcable? - pObj = &(pSoldier->inv[HANDPOS]); - for (bAttachPos = 0; bAttachPos < MAX_ATTACHMENTS; bAttachPos++) - { - if (pObj->usAttachItem[ bAttachPos ] != NOTHING) - { - if ( Item[ pObj->usAttachItem[ bAttachPos ] ].usItemClass & IC_EXPLOSV ) - { - break; - } - } - } - if (bAttachPos != MAX_ATTACHMENTS) - { - CreateItem( pObj->usAttachItem[ bAttachPos ], pObj->bAttachStatus[ bAttachPos ], &TempObject ); - } - UINT16 glItem = GetAttachedGrenadeLauncher( &(pSoldier->inv[HANDPOS])); if ((pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO )&& glItem != NONE ) { - bSlot = FindAttachment( &(pSoldier->inv[HANDPOS]), glItem ); + OBJECTTYPE* pAttachment = FindAttachment( &(pSoldier->inv[HANDPOS]), glItem ); - if ( bSlot != NO_SLOT ) + if ( pAttachment ) { - CreateItem( glItem, pSoldier->inv[HANDPOS].bAttachStatus[ bSlot ], &TempObject ); - - if ( !CalculateLaunchItemChanceToGetThrough( pSoldier, &TempObject, sGridNo, (INT8)gsInterfaceLevel, (INT16)( gsInterfaceLevel * 256 ), &sFinalGridNo, fArmed, &bLevel, TRUE ) ) + if ( !CalculateLaunchItemChanceToGetThrough( pSoldier, pAttachment, sGridNo, (INT8)gsInterfaceLevel, (INT16)( gsInterfaceLevel * 256 ), &sFinalGridNo, fArmed, &bLevel, TRUE ) ) { fBadCTGH = TRUE; } @@ -1730,12 +1710,23 @@ UINT8 HandleNonActivatedTossCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLE { fBadCTGH = FALSE; } - BeginPhysicsTrajectoryUI( sFinalGridNo, bLevel, fBadCTGH ); + BeginPhysicsTrajectoryUI( sFinalGridNo, bLevel, fBadCTGH ); } } else { - if ( !CalculateLaunchItemChanceToGetThrough( pSoldier, &TempObject, sGridNo, (INT8)gsInterfaceLevel, (INT16)( gsInterfaceLevel * 256 ), &sFinalGridNo, fArmed, &bLevel, TRUE ) ) + OBJECTTYPE* pObject = &(pSoldier->inv[HANDPOS]); + // Do we have a launcable? + pObj = &(pSoldier->inv[HANDPOS]); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if ( Item[ iter->usItem ].usItemClass & IC_EXPLOSV ) + { + pObject = &(*iter); + break; + } + } + + if ( !CalculateLaunchItemChanceToGetThrough( pSoldier, pObject, sGridNo, (INT8)gsInterfaceLevel, (INT16)( gsInterfaceLevel * 256 ), &sFinalGridNo, fArmed, &bLevel, TRUE ) ) { fBadCTGH = TRUE; } @@ -1743,7 +1734,7 @@ UINT8 HandleNonActivatedTossCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLE { fBadCTGH = FALSE; } - BeginPhysicsTrajectoryUI( sFinalGridNo, bLevel, fBadCTGH ); + BeginPhysicsTrajectoryUI( sFinalGridNo, bLevel, fBadCTGH ); } } } @@ -1756,13 +1747,13 @@ UINT8 HandleNonActivatedTossCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLE } -UINT8 HandleWirecutterCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT32 uiCursorFlags ) +UINT8 HandleWirecutterCursor( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT32 uiCursorFlags ) { // DRAW PATH TO GUY HandleUIMovementCursor( pSoldier, uiCursorFlags, sGridNo, MOVEUI_TARGET_WIREFENCE ); // Are we over a cuttable fence? - if ( IsCuttableWireFenceAtGridNo( sGridNo ) && pSoldier->bLevel == 0 ) + if ( IsCuttableWireFenceAtGridNo( sGridNo ) && pSoldier->pathing.bLevel == 0 ) { return( GOOD_WIRECUTTER_UICURSOR ); } @@ -1771,13 +1762,13 @@ UINT8 HandleWirecutterCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT32 uiCu } -UINT8 HandleRepairCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT32 uiCursorFlags ) +UINT8 HandleRepairCursor( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT32 uiCursorFlags ) { // DRAW PATH TO GUY HandleUIMovementCursor( pSoldier, uiCursorFlags, sGridNo, MOVEUI_TARGET_REPAIR ); // Are we over a cuttable fence? - if ( IsRepairableStructAtGridNo( sGridNo, NULL ) && pSoldier->bLevel == 0 ) + if ( IsRepairableStructAtGridNo( sGridNo, NULL ) && pSoldier->pathing.bLevel == 0 ) { return( GOOD_REPAIR_UICURSOR ); } @@ -1785,13 +1776,13 @@ UINT8 HandleRepairCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT32 uiCursor return( BAD_REPAIR_UICURSOR ); } -UINT8 HandleRefuelCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT32 uiCursorFlags ) +UINT8 HandleRefuelCursor( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT32 uiCursorFlags ) { // DRAW PATH TO GUY HandleUIMovementCursor( pSoldier, uiCursorFlags, sGridNo, MOVEUI_TARGET_REFUEL ); // Are we over a cuttable fence? - if ( IsRefuelableStructAtGridNo( sGridNo, NULL ) && pSoldier->bLevel == 0 ) + if ( IsRefuelableStructAtGridNo( sGridNo, NULL ) && pSoldier->pathing.bLevel == 0 ) { return( REFUEL_RED_UICURSOR ); } @@ -1800,13 +1791,13 @@ UINT8 HandleRefuelCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT32 uiCursor } -UINT8 HandleJarCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT32 uiCursorFlags ) +UINT8 HandleJarCursor( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT32 uiCursorFlags ) { // DRAW PATH TO GUY HandleUIMovementCursor( pSoldier, uiCursorFlags, sGridNo, MOVEUI_TARGET_JAR ); // Are we over a cuttable fence? - if ( IsCorpseAtGridNo( sGridNo, pSoldier->bLevel ) ) + if ( IsCorpseAtGridNo( sGridNo, pSoldier->pathing.bLevel ) ) { return( GOOD_JAR_UICURSOR ); } @@ -1815,10 +1806,10 @@ UINT8 HandleJarCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT32 uiCursorFla } -UINT8 HandleTinCanCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT32 uiCursorFlags ) +UINT8 HandleTinCanCursor( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT32 uiCursorFlags ) { STRUCTURE *pStructure; - INT16 sIntTileGridNo; + INT16 sIntTileGridNo; LEVELNODE *pIntTile; @@ -1832,7 +1823,7 @@ UINT8 HandleTinCanCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT32 uiCursor if ( pIntTile != NULL ) { if (pStructure->fFlags & STRUCTURE_ANYDOOR) - { + { return( PLACE_TINCAN_GREY_UICURSOR ); } } @@ -1841,9 +1832,8 @@ UINT8 HandleTinCanCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT32 uiCursor } -UINT8 HandleRemoteCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fActivated, UINT32 uiCursorFlags ) +UINT8 HandleRemoteCursor( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fActivated, UINT32 uiCursorFlags ) { - BOOLEAN fEnoughPoints = TRUE; // Calculate action points if ( gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT) ) @@ -1870,9 +1860,8 @@ UINT8 HandleRemoteCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fActiva } -UINT8 HandleBombCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fActivated, UINT32 uiCursorFlags ) +UINT8 HandleBombCursor( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fActivated, UINT32 uiCursorFlags ) { - BOOLEAN fEnoughPoints = TRUE; // DRAW PATH TO GUY HandleUIMovementCursor( pSoldier, uiCursorFlags, sGridNo, MOVEUI_TARGET_BOMB ); @@ -1911,7 +1900,7 @@ void HandleEndConfirmCursor( SOLDIERTYPE *pSoldier ) // LOOK IN GUY'S HAND TO CHECK LOCATION usInHand = pSoldier->inv[HANDPOS].usItem; - ubItemCursor = GetActionModeCursor( pSoldier ); + ubItemCursor = GetActionModeCursor( pSoldier ); if ( ubItemCursor == TOSSCURS ) { @@ -1923,12 +1912,12 @@ void HandleLeftClickCursor( SOLDIERTYPE *pSoldier ) { UINT16 usInHand; UINT8 ubItemCursor; - UINT16 usGridNo; + INT16 sGridNo; // LOOK IN GUY'S HAND TO CHECK LOCATION usInHand = pSoldier->inv[HANDPOS].usItem; - ubItemCursor = GetActionModeCursor( pSoldier ); + ubItemCursor = GetActionModeCursor( pSoldier ); // OK, if we are i realtime.. goto directly to shoot if ( ( ( gTacticalStatus.uiFlags & TURNBASED ) && !( gTacticalStatus.uiFlags & INCOMBAT ) ) )//&& ubItemCursor != TOSSCURS && ubItemCursor != TRAJECTORYCURS ) @@ -1937,12 +1926,12 @@ void HandleLeftClickCursor( SOLDIERTYPE *pSoldier ) // ( only if not burst mode.. ) if ( !pSoldier->bDoBurst ) { - guiPendingOverrideEvent = CA_MERC_SHOOT; + guiPendingOverrideEvent = CA_MERC_SHOOT; } return; } - if (!GetMouseMapPos( &usGridNo ) ) + if (!GetMouseMapPos( &sGridNo ) ) { return; } @@ -1957,13 +1946,13 @@ void HandleLeftClickCursor( SOLDIERTYPE *pSoldier ) if ( gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT ) ) { - pSoldier->bShownAimTime = REFINE_AIM_1; - pSoldier->fPauseAim = FALSE; + pSoldier->aiData.bShownAimTime = REFINE_AIM_1; + pSoldier->flags.fPauseAim = FALSE; } - else + else { - pSoldier->bShownAimTime = REFINE_AIM_1; - pSoldier->fPauseAim = FALSE; + pSoldier->aiData.bShownAimTime = REFINE_AIM_1; + pSoldier->flags.fPauseAim = FALSE; } // Reset counter RESETCOUNTER( TARGETREFINE ); @@ -1973,13 +1962,13 @@ void HandleLeftClickCursor( SOLDIERTYPE *pSoldier ) if ( gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT ) ) { - pSoldier->bShownAimTime = REFINE_PUNCH_1; - pSoldier->fPauseAim = FALSE; + pSoldier->aiData.bShownAimTime = REFINE_PUNCH_1; + pSoldier->flags.fPauseAim = FALSE; } - else + else { - pSoldier->bShownAimTime = REFINE_PUNCH_1; - pSoldier->fPauseAim = FALSE; + pSoldier->aiData.bShownAimTime = REFINE_PUNCH_1; + pSoldier->flags.fPauseAim = FALSE; } // Reset counter @@ -1991,13 +1980,13 @@ void HandleLeftClickCursor( SOLDIERTYPE *pSoldier ) if ( gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT ) ) { - pSoldier->bShownAimTime = REFINE_KNIFE_1; - pSoldier->fPauseAim = FALSE; + pSoldier->aiData.bShownAimTime = REFINE_KNIFE_1; + pSoldier->flags.fPauseAim = FALSE; } else { - pSoldier->bShownAimTime = REFINE_KNIFE_1; - pSoldier->fPauseAim = FALSE; + pSoldier->aiData.bShownAimTime = REFINE_KNIFE_1; + pSoldier->flags.fPauseAim = FALSE; } // Reset counter @@ -2006,7 +1995,7 @@ void HandleLeftClickCursor( SOLDIERTYPE *pSoldier ) case TOSSCURS: - //BeginAimCubeUI( pSoldier, usGridNo, (INT8)gsInterfaceLevel, 0, 0 ); + //BeginAimCubeUI( pSoldier, sGridNo, (INT8)gsInterfaceLevel, 0, 0 ); //break; default: @@ -2020,9 +2009,9 @@ void HandleLeftClickCursor( SOLDIERTYPE *pSoldier ) -void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 usMapPos ) +void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 sMapPos ) { - UINT16 usInHand; + UINT16 usInHand; INT16 sAPCosts; INT8 bFutureAim; UINT8 ubCursor; @@ -2033,47 +2022,47 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 usMapPos ) usInHand = pSoldier->inv[HANDPOS].usItem; - ubCursor = GetActionModeCursor( pSoldier ); + ubCursor = GetActionModeCursor( pSoldier ); UINT8 maxAimLevels = AllowedAimingLevels(pSoldier); // 'snap' cursor to target tile.... if ( gfUIFullTargetFound ) { - usMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; + sMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; } switch( ubCursor ) { case TARGETCURS: - + // CHECK IF GUY HAS IN HAND A WEAPON if ( pSoldier->bDoBurst && !pSoldier->bDoAutofire) { // Do nothing! - // pSoldier->bShownAimTime = REFINE_AIM_BURST; + // pSoldier->aiData.bShownAimTime = REFINE_AIM_BURST; } else if(pSoldier->bDoAutofire) { INT16 sCurAPCosts; - - if(pSoldier->autofireLastStep) + + if(pSoldier->flags.autofireLastStep) { pSoldier->bDoAutofire = 1; //reset the bullet counter - pSoldier->autofireLastStep = FALSE; + pSoldier->flags.autofireLastStep = FALSE; return; } - if(pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft > pSoldier->bDoAutofire ) + if(pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.gun.ubGunShotsLeft > pSoldier->bDoAutofire ) { //Calculate how many bullets we need to fire to add at least one more AP - sAPCosts = sCurAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0); - while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && sAPCosts <= sCurAPCosts && pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft > pSoldier->bDoAutofire) //Increment the bullet count until we run out of APs or we spend the whole AP + sAPCosts = sCurAPCosts = CalcTotalAPsToAttack( pSoldier, sMapPos, TRUE, 0); + while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && sAPCosts <= sCurAPCosts && pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.gun.ubGunShotsLeft > pSoldier->bDoAutofire) //Increment the bullet count until we run out of APs or we spend the whole AP { pSoldier->bDoAutofire++; - sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0); + sAPCosts = CalcTotalAPsToAttack( pSoldier, sMapPos, TRUE, 0); } //we've stepped over the border and used up one more ap, now let's make sure that it is spent to maximize the bullets @@ -2083,30 +2072,30 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 usMapPos ) do { pSoldier->bDoAutofire++; - sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0); + sAPCosts = CalcTotalAPsToAttack( pSoldier, sMapPos, TRUE, 0); } - while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && sAPCosts == sCurAPCosts && pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire); + while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && sAPCosts == sCurAPCosts && pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.gun.ubGunShotsLeft >= pSoldier->bDoAutofire); pSoldier->bDoAutofire--; - sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0); + sAPCosts = CalcTotalAPsToAttack( pSoldier, sMapPos, TRUE, 0); if(!EnoughPoints( pSoldier, sAPCosts, 0, FALSE )) //We've not enough points to fire those bullets { - pSoldier->autofireLastStep = TRUE; + pSoldier->flags.autofireLastStep = TRUE; pSoldier->bDoAutofire--; } else - pSoldier->autofireLastStep = FALSE; //both last step conditions are false + pSoldier->flags.autofireLastStep = FALSE; //both last step conditions are false } else { - pSoldier->autofireLastStep = TRUE; + pSoldier->flags.autofireLastStep = TRUE; } } else { - sGridNo = usMapPos; - bTargetLevel = (INT8)gsInterfaceLevel; + sGridNo = sMapPos; + bTargetLevel = (INT8)gsInterfaceLevel; // Look for a target here... if ( gfUIFullTargetFound ) @@ -2114,7 +2103,7 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 usMapPos ) // Get target soldier, if one exists pTSoldier = MercPtrs[ gusUIFullTargetID ]; sGridNo = pTSoldier->sGridNo; - bTargetLevel = pSoldier->bLevel; + bTargetLevel = pSoldier->pathing.bLevel; if ( !HandleCheckForBadChangeToGetThrough( pSoldier, pTSoldier, sGridNo , bTargetLevel ) ) { @@ -2122,19 +2111,19 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 usMapPos ) } } - bFutureAim = (INT8)( pSoldier->bShownAimTime + 1 ); + bFutureAim = (INT8)( pSoldier->aiData.bShownAimTime + 1 ); if ( bFutureAim <= maxAimLevels ) { - sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, (INT8)(bFutureAim ) ); + sAPCosts = CalcTotalAPsToAttack( pSoldier, sMapPos, TRUE, (INT8)(bFutureAim ) ); // Determine if we can afford! if ( EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) ) { - pSoldier->bShownAimTime+= 1; - if ( pSoldier->bShownAimTime > maxAimLevels ) + pSoldier->aiData.bShownAimTime+= 1; + if ( pSoldier->aiData.bShownAimTime > maxAimLevels ) { - pSoldier->bShownAimTime = maxAimLevels; + pSoldier->aiData.bShownAimTime = maxAimLevels; } } // Else - goto first level! @@ -2146,7 +2135,7 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 usMapPos ) } else { - pSoldier->bShownAimTime = REFINE_AIM_1; + pSoldier->aiData.bShownAimTime = REFINE_AIM_1; gfDisplayFullCountRing = FALSE; } } @@ -2159,7 +2148,7 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 usMapPos ) } else { - pSoldier->bShownAimTime = REFINE_AIM_1; + pSoldier->aiData.bShownAimTime = REFINE_AIM_1; gfDisplayFullCountRing = FALSE; } } @@ -2168,21 +2157,21 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 usMapPos ) case PUNCHCURS: - - bFutureAim = (INT8)( pSoldier->bShownAimTime + REFINE_PUNCH_2 ); + + bFutureAim = (INT8)( pSoldier->aiData.bShownAimTime + REFINE_PUNCH_2 ); if ( bFutureAim <= REFINE_PUNCH_2 ) { - sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, (INT8)(bFutureAim / 2) ); + sAPCosts = CalcTotalAPsToAttack( pSoldier, sMapPos, TRUE, (INT8)(bFutureAim / 2) ); // Determine if we can afford! if ( EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) ) { - pSoldier->bShownAimTime+= REFINE_PUNCH_2; + pSoldier->aiData.bShownAimTime+= REFINE_PUNCH_2; - if ( pSoldier->bShownAimTime > REFINE_PUNCH_2 ) + if ( pSoldier->aiData.bShownAimTime > REFINE_PUNCH_2 ) { - pSoldier->bShownAimTime = REFINE_PUNCH_2; + pSoldier->aiData.bShownAimTime = REFINE_PUNCH_2; } } // Else - goto first level! @@ -2194,7 +2183,7 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 usMapPos ) } else { - pSoldier->bShownAimTime = REFINE_PUNCH_1; + pSoldier->aiData.bShownAimTime = REFINE_PUNCH_1; gfDisplayFullCountRing = FALSE; } } @@ -2207,7 +2196,7 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 usMapPos ) } else { - pSoldier->bShownAimTime = REFINE_PUNCH_1; + pSoldier->aiData.bShownAimTime = REFINE_PUNCH_1; gfDisplayFullCountRing = FALSE; } } @@ -2215,21 +2204,21 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 usMapPos ) case KNIFECURS: - - bFutureAim = (INT8)( pSoldier->bShownAimTime + REFINE_KNIFE_2 ); + + bFutureAim = (INT8)( pSoldier->aiData.bShownAimTime + REFINE_KNIFE_2 ); if ( bFutureAim <= REFINE_KNIFE_2 ) { - sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, (INT8)(bFutureAim / 2) ); + sAPCosts = CalcTotalAPsToAttack( pSoldier, sMapPos, TRUE, (INT8)(bFutureAim / 2) ); // Determine if we can afford! if ( EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) ) { - pSoldier->bShownAimTime+= REFINE_KNIFE_2; + pSoldier->aiData.bShownAimTime+= REFINE_KNIFE_2; - if ( pSoldier->bShownAimTime > REFINE_KNIFE_2 ) + if ( pSoldier->aiData.bShownAimTime > REFINE_KNIFE_2 ) { - pSoldier->bShownAimTime = REFINE_KNIFE_2; + pSoldier->aiData.bShownAimTime = REFINE_KNIFE_2; } } // Else - goto first level! @@ -2241,7 +2230,7 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 usMapPos ) } else { - pSoldier->bShownAimTime = REFINE_KNIFE_1; + pSoldier->aiData.bShownAimTime = REFINE_KNIFE_1; gfDisplayFullCountRing = FALSE; } } @@ -2254,7 +2243,7 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 usMapPos ) } else { - pSoldier->bShownAimTime = REFINE_KNIFE_1; + pSoldier->aiData.bShownAimTime = REFINE_KNIFE_1; gfDisplayFullCountRing = FALSE; } } @@ -2277,30 +2266,30 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 usMapPos ) UINT8 GetActionModeCursor( SOLDIERTYPE *pSoldier ) { UINT8 ubCursor; - UINT16 usInHand; + UINT16 usInHand; // If we are an EPC, do nothing.... - //if ( ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + //if ( ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) //{ // return( INVALIDCURS ); //} // AN EPC is always not - attackable unless they are a robot! - if ( AM_AN_EPC( pSoldier ) && !( pSoldier->uiStatusFlags & SOLDIER_ROBOT ) ) + if ( AM_AN_EPC( pSoldier ) && !( pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) ) { return( INVALIDCURS ); } // ATE: if a vehicle.... same thing - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { return( INVALIDCURS ); } // If we can't be controlled, returninvalid... - if ( pSoldier->uiStatusFlags & SOLDIER_ROBOT ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) { - if ( !CanRobotBeControlled( pSoldier ) ) + if ( !pSoldier->CanRobotBeControlled( ) ) { // Display message that robot cannot be controlled.... return( INVALIDCURS ); @@ -2308,7 +2297,6 @@ UINT8 GetActionModeCursor( SOLDIERTYPE *pSoldier ) } - // If we are in attach shoot mode, use toss cursor... if ( pSoldier->bWeaponMode == WM_ATTACHED_GL ) { return( TRAJECTORYCURS ); @@ -2325,7 +2313,7 @@ UINT8 GetActionModeCursor( SOLDIERTYPE *pSoldier ) if ( gGameSettings.fOptions [ TOPTION_GL_BURST_CURSOR ] ) return( TARGETCURS ); else - return ( TRAJECTORYCURS ); + return ( TRAJECTORYCURS ); } usInHand = pSoldier->inv[HANDPOS].usItem; @@ -2367,7 +2355,7 @@ void HandleUICursorRTFeedback( SOLDIERTYPE *pSoldier ) { UINT8 ubItemCursor; - ubItemCursor = GetActionModeCursor( pSoldier ); + ubItemCursor = GetActionModeCursor( pSoldier ); switch( ubItemCursor ) { diff --git a/Tactical/UI Cursors.h b/Tactical/UI Cursors.h index 6df93376..c7b76082 100644 --- a/Tactical/UI Cursors.h +++ b/Tactical/UI Cursors.h @@ -9,11 +9,11 @@ #define REFINE_KNIFE_2 6 -UINT8 GetProperItemCursor( UINT8 ubSoldierID, UINT16 ubItemIndex, UINT16 usMapPos, BOOLEAN fActivated ); +UINT8 GetProperItemCursor( UINT8 ubSoldierID, UINT16 ubItemIndex, INT16 sMapPos, BOOLEAN fActivated ); void DetermineCursorBodyLocation( UINT8 ubSoldierID, BOOLEAN fDisplay, BOOLEAN fRecalc ); void HandleLeftClickCursor( SOLDIERTYPE *pSoldier ); -void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 usMapPos ); +void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 sMapPos ); UINT8 GetActionModeCursor( SOLDIERTYPE *pSoldier ); diff --git a/Tactical/Vehicles.cpp b/Tactical/Vehicles.cpp index 50a16a4c..d13fd03e 100644 --- a/Tactical/Vehicles.cpp +++ b/Tactical/Vehicles.cpp @@ -1,6 +1,6 @@ #ifdef PRECOMPILEDHEADERS #include "Tactical All.h" -#else +#else #include "Vehicles.h" #include "String.h" #include "Strategic Pathing.h" @@ -11,7 +11,7 @@ #include "Game Clock.h" #include "overhead.h" #include "soldier profile.h" - #include "sound control.h" + #include "Sound Control.h" #include "soundman.h" #include "soldier add.h" #include "interface panels.h" @@ -57,13 +57,13 @@ extern INT8 SquadMovementGroups[ ]; // the mvt groups associated with vehcile types INT32 iMvtTypes[]={ - CAR, // eldorado - CAR, // hummer - CAR, // ice cream truck - CAR, // jeep - CAR, // tank + CAR, // eldorado + CAR, // hummer + CAR, // ice cream truck + CAR, // jeep + CAR, // tank - AIR, // helicopter + AIR, // helicopter }; @@ -99,7 +99,7 @@ INT32 iMoveVehicleSndID[] = { }; UINT8 ubVehicleTypeProfileID[ ] = { - + PROF_ELDERODO, PROF_HUMMER, PROF_ICECREAM, @@ -132,7 +132,7 @@ INT8 bInternalCritHitsByLocation[ NUMBER_OF_EXTERNAL_HIT_LOCATIONS_ON_VEHICLE ][ */ INT16 sVehicleArmourType[ NUMBER_OF_TYPES_OF_VEHICLES ] = -{ +{ KEVLAR_VEST, // El Dorado SPECTRA_VEST, // Hummer KEVLAR_VEST, // Ice cream truck @@ -182,7 +182,7 @@ void InitVehicles( ) INT32 cnt; GROUP *pGroup = NULL; - for( cnt = 0; cnt < MAX_VEHICLES; cnt++ ) + for( cnt = 0; cnt < MAX_VEHICLES; cnt++ ) { // create mvt groups gubVehicleMovementGroups[ cnt ] = CreateNewVehicleGroupDepartingFromSector( 1, 1, cnt ); @@ -200,11 +200,11 @@ void SetVehicleValuesIntoSoldierType( SOLDIERTYPE *pVehicle ) pVehicle->ubProfile = pVehicleList[ pVehicle->bVehicleID ].ubProfileID; - // Init fuel! - pVehicle->sBreathRed = 10000; - pVehicle->bBreath = 100; + // Init fuel! + pVehicle->sBreathRed = 10000; + pVehicle->bBreath = 100; - pVehicle->ubWhatKindOfMercAmI = MERC_TYPE__VEHICLE; + pVehicle->ubWhatKindOfMercAmI = MERC_TYPE__VEHICLE; } INT32 AddVehicleToList( INT16 sMapX, INT16 sMapY, INT16 sGridNo, UINT8 ubType ) @@ -229,7 +229,7 @@ INT32 AddVehicleToList( INT16 sMapX, INT16 sMapY, INT16 sGridNo, UINT8 ubType ) iCount = iCounter; iCounter = ubNumberOfVehicles; fFoundEmpty = TRUE; - iVehicleIdValue = iCount; + iVehicleIdValue = iCount; } } } @@ -247,9 +247,9 @@ INT32 AddVehicleToList( INT16 sMapX, INT16 sMapY, INT16 sGridNo, UINT8 ubType ) memset( pVehicleList, 0, sizeof( VEHICLETYPE ) ); ubNumberOfVehicles = 1; - iVehicleIdValue = 0; + iVehicleIdValue = 0; } - + if( ( iVehicleIdValue == -1 ) && ( iCount != 0 ) && ( fFoundEmpty == FALSE ) ) { @@ -292,10 +292,10 @@ INT32 AddVehicleToList( INT16 sMapX, INT16 sMapY, INT16 sGridNo, UINT8 ubType ) pVehicleList[ iCount ].pMercPath = NULL; pVehicleList[ iCount ].fFunctional = TRUE; pVehicleList[ iCount ].fDestroyed = FALSE; - pVehicleList[ iCount ].iMoveSound = iMoveVehicleSndID[ ubType ]; + pVehicleList[ iCount ].iMoveSound = iMoveVehicleSndID[ ubType ]; pVehicleList[ iCount ].iOutOfSound = iEnterVehicleSndID[ ubType ]; pVehicleList[ iCount ].ubProfileID = ubVehicleTypeProfileID[ ubType ]; - pVehicleList[ iCount ].ubMovementGroup = gubVehicleMovementGroups[ iCount ]; + pVehicleList[ iCount ].ubMovementGroup = gubVehicleMovementGroups[ iCount ]; // ATE: Add movement mask to group... pGroup = GetGroup( pVehicleList[ iCount ].ubMovementGroup ); @@ -315,11 +315,11 @@ INT32 AddVehicleToList( INT16 sMapX, INT16 sMapY, INT16 sGridNo, UINT8 ubType ) // ARM: setup group movement defaults pGroup->ubSectorX = ( UINT8 ) sMapX; - pGroup->ubNextX = ( UINT8 ) sMapX; + pGroup->ubNextX = ( UINT8 ) sMapX; pGroup->ubSectorY = ( UINT8 ) sMapY; - pGroup->ubNextY = ( UINT8 ) sMapY; + pGroup->ubNextY = ( UINT8 ) sMapY; pGroup->uiTraverseTime = 0; - pGroup->uiArrivalTime = 0; + pGroup->uiArrivalTime = 0; SetUpArmorForVehicle( ( UINT8 )iCount ); @@ -336,7 +336,7 @@ BOOLEAN RemoveVehicleFromList( INT32 iId ) { return ( FALSE ); } - + // clear remaining path nodes if( pVehicleList[ iId ].pMercPath != NULL ) { @@ -375,7 +375,7 @@ void ClearOutVehicleList( void ) ubNumberOfVehicles = 0; } -/* +/* // empty out the vehicle list if( pVehicleList ) { @@ -405,7 +405,7 @@ BOOLEAN IsThisVehicleAccessibleToSoldier( SOLDIERTYPE *pSoldier, INT32 iId ) } // if the soldier or the vehicle is between sectors - if( pSoldier->fBetweenSectors || pVehicleList[ iId ].fBetweenSectors ) + if( pSoldier->flags.fBetweenSectors || pVehicleList[ iId ].fBetweenSectors ) { return( FALSE ); } @@ -427,10 +427,11 @@ BOOLEAN IsThisVehicleAccessibleToSoldier( SOLDIERTYPE *pSoldier, INT32 iId ) return( TRUE ); } - + BOOLEAN AddSoldierToVehicle( SOLDIERTYPE *pSoldier, INT32 iId ) { INT32 iCounter = 0; + INT8 vCount = 0; SOLDIERTYPE *pVehicleSoldier = NULL; @@ -447,17 +448,31 @@ BOOLEAN AddSoldierToVehicle( SOLDIERTYPE *pSoldier, INT32 iId ) { return( FALSE ); } - + // get the vehicle soldiertype pVehicleSoldier = GetSoldierStructureForVehicle( iId ); - + + //CHRISL: Get number of vehicles currently in player team + for(int x = 0; x < 20; x++) + { + if(MercPtrs[x]->bTeam == OUR_TEAM && (MercPtrs[x]->flags.uiStatusFlags & SOLDIER_VEHICLE) && MercPtrs[x]->bActive == TRUE) + vCount ++; + } + if( pVehicleSoldier ) { if ( pVehicleSoldier->bTeam != gbPlayerNum ) { + // Can we add a new vehicle + if( vCount >= 2 ) + { + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[VEHICLE_CAN_NOT_BE_ADDED] ); + return( FALSE ); + } + // Change sides... pVehicleSoldier = ChangeSoldierTeam( pVehicleSoldier, gbPlayerNum ); - // add it to mapscreen list + // add it to mapscreen list fReBuildCharacterList = TRUE; } } @@ -470,19 +485,19 @@ BOOLEAN AddSoldierToVehicle( SOLDIERTYPE *pSoldier, INT32 iId ) // ATE: OK funcky stuff here! // We have now a guy on a squad group, remove him! - RemovePlayerFromGroup( SquadMovementGroups[ pVehicleSoldier->bAssignment ], pVehicleSoldier ); + RemovePlayerFromGroup( SquadMovementGroups[ pVehicleSoldier->bAssignment ], pVehicleSoldier ); - // I really have vehicles.\ - // ONLY add to vehicle group once! - if ( !DoesPlayerExistInPGroup( pVehicleList[ iId ].ubMovementGroup, pVehicleSoldier ) ) - { - //NOW.. add guy to vehicle group.... - AddPlayerToGroup( pVehicleList[ iId ].ubMovementGroup, pVehicleSoldier ); - } - else - { - pVehicleSoldier->ubGroupID = pVehicleList[ iId ].ubMovementGroup; - } + // I really have vehicles.\ + // ONLY add to vehicle group once! + if ( !DoesPlayerExistInPGroup( pVehicleList[ iId ].ubMovementGroup, pVehicleSoldier ) ) + { + //NOW.. add guy to vehicle group.... + AddPlayerToGroup( pVehicleList[ iId ].ubMovementGroup, pVehicleSoldier ); + } + else + { + pVehicleSoldier->ubGroupID = pVehicleList[ iId ].ubMovementGroup; + } } // check if the grunt is already here @@ -498,12 +513,12 @@ BOOLEAN AddSoldierToVehicle( SOLDIERTYPE *pSoldier, INT32 iId ) if ( pVehicleSoldier ) { // can't call SelectSoldier in mapscreen, that will initialize interface panels!!! - if ( guiCurrentScreen == GAME_SCREEN ) + if ( guiCurrentScreen == GAME_SCREEN ) { SelectSoldier( pVehicleSoldier->ubID, FALSE, TRUE ); } - PlayJA2Sample( pVehicleList[ pVehicleSoldier->bVehicleID ].iOutOfSound, RATE_11025, SoundVolume( HIGHVOLUME, pVehicleSoldier->sGridNo ), 1, SoundDir( pVehicleSoldier->sGridNo ) ); + PlayJA2Sample( pVehicleList[ pVehicleSoldier->bVehicleID ].iOutOfSound, RATE_11025, SoundVolume( HIGHVOLUME, pVehicleSoldier->sGridNo ), 1, SoundDir( pVehicleSoldier->sGridNo ) ); } for( iCounter = 0; iCounter < iSeatingCapacities[ pVehicleList[ iId ].ubVehicleType ]; iCounter++ ) @@ -517,7 +532,7 @@ BOOLEAN AddSoldierToVehicle( SOLDIERTYPE *pSoldier, INT32 iId ) if( pSoldier->bAssignment == VEHICLE ) { TakeSoldierOutOfVehicle( pSoldier ); - // NOTE: This will leave the soldier on a squad. Must be done PRIOR TO and in AS WELL AS the call + // NOTE: This will leave the soldier on a squad. Must be done PRIOR TO and in AS WELL AS the call // to RemoveCharacterFromSquads() that's coming up, to permit direct vehicle->vehicle reassignment! } @@ -533,7 +548,7 @@ BOOLEAN AddSoldierToVehicle( SOLDIERTYPE *pSoldier, INT32 iId ) pSoldier->ubGroupID = 0; } - if( ( pSoldier->bAssignment != VEHICLE ) || ( pSoldier -> iVehicleId != iId ) ) + if( ( pSoldier->bAssignment != VEHICLE ) || ( pSoldier->iVehicleId != iId ) ) { SetTimeOfAssignmentChangeForMerc( pSoldier ); } @@ -542,7 +557,7 @@ BOOLEAN AddSoldierToVehicle( SOLDIERTYPE *pSoldier, INT32 iId ) ChangeSoldiersAssignment( pSoldier, VEHICLE ); // set vehicle id - pSoldier -> iVehicleId = iId; + pSoldier->iVehicleId = iId; // if vehicle is part of mvt group, then add character to mvt group if( pVehicleList[ iId ].ubMovementGroup != 0 ) @@ -553,10 +568,10 @@ BOOLEAN AddSoldierToVehicle( SOLDIERTYPE *pSoldier, INT32 iId ) } // Are we the first? - if ( GetNumberInVehicle( iId ) == 1 ) + if ( GetNumberInVehicle( iId ) == 1 ) { // Set as driver... - pSoldier->uiStatusFlags |= SOLDIER_DRIVER; + pSoldier->flags.uiStatusFlags |= SOLDIER_DRIVER; SetDriver( iId , pSoldier->ubID ); @@ -564,19 +579,19 @@ BOOLEAN AddSoldierToVehicle( SOLDIERTYPE *pSoldier, INT32 iId ) else { // Set as driver... - pSoldier->uiStatusFlags |= SOLDIER_PASSENGER; + pSoldier->flags.uiStatusFlags |= SOLDIER_PASSENGER; } // Remove soldier's graphic - RemoveSoldierFromGridNo( pSoldier ); + pSoldier->RemoveSoldierFromGridNo( ); if ( pVehicleSoldier ) { // Set gridno for vehicle..... - EVENT_SetSoldierPosition( pSoldier, pVehicleSoldier->dXPos, pVehicleSoldier->dYPos ); + pSoldier->EVENT_SetSoldierPosition( pVehicleSoldier->dXPos, pVehicleSoldier->dYPos ); // Stop from any movement..... - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); // can't call SetCurrentSquad OR SelectSoldier in mapscreen, that will initialize interface panels!!! if ( guiCurrentScreen == GAME_SCREEN ) @@ -597,19 +612,19 @@ BOOLEAN AddSoldierToVehicle( SOLDIERTYPE *pSoldier, INT32 iId ) void SetSoldierExitVehicleInsertionData( SOLDIERTYPE *pSoldier, INT32 iId ) { if ( iId == iHelicopterVehicleId && !pSoldier->bInSector ) - { - if( pSoldier->sSectorX != BOBBYR_SHIPPING_DEST_SECTOR_X || pSoldier->sSectorY != BOBBYR_SHIPPING_DEST_SECTOR_Y || pSoldier->bSectorZ != BOBBYR_SHIPPING_DEST_SECTOR_Z ) - { - // Not anything different here - just use center gridno...... - pSoldier->ubStrategicInsertionCode = INSERTION_CODE_CENTER; - } - else - { - // This is drassen, make insertion gridno specific... - pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; - pSoldier->usStrategicInsertionData = 10125; - } - } + { + if( pSoldier->sSectorX != BOBBYR_SHIPPING_DEST_SECTOR_X || pSoldier->sSectorY != BOBBYR_SHIPPING_DEST_SECTOR_Y || pSoldier->bSectorZ != BOBBYR_SHIPPING_DEST_SECTOR_Z ) + { + // Not anything different here - just use center gridno...... + pSoldier->ubStrategicInsertionCode = INSERTION_CODE_CENTER; + } + else + { + // This is drassen, make insertion gridno specific... + pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; + pSoldier->usStrategicInsertionData = 10125; + } + } } BOOLEAN RemoveSoldierFromVehicle( SOLDIERTYPE *pSoldier, INT32 iId ) @@ -644,9 +659,9 @@ BOOLEAN RemoveSoldierFromVehicle( SOLDIERTYPE *pSoldier, INT32 iId ) pVehicleList[ iId ].pPassengers[ iCounter ]->sSectorX = pVehicleList[ iId ].sSectorX; pVehicleList[ iId ].pPassengers[ iCounter ]->bSectorZ = ( INT8 )pVehicleList[ iId ].sSectorZ; pVehicleList[ iId ].pPassengers[ iCounter ] = NULL; - - - pSoldier->uiStatusFlags &= ( ~( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ); + + + pSoldier->flags.uiStatusFlags &= ( ~( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ); // check if anyone left in vehicle fSoldierLeft = FALSE; @@ -658,7 +673,7 @@ BOOLEAN RemoveSoldierFromVehicle( SOLDIERTYPE *pSoldier, INT32 iId ) } } - + if( pVehicleList[ iId ].ubMovementGroup != 0 ) { RemovePlayerFromGroup( pVehicleList[ iId ].ubMovementGroup, pSoldier ); @@ -681,7 +696,7 @@ BOOLEAN RemoveSoldierFromVehicle( SOLDIERTYPE *pSoldier, INT32 iId ) if ( !fSoldierFound ) { - return( FALSE ); + return( FALSE ); } @@ -711,13 +726,13 @@ BOOLEAN RemoveSoldierFromVehicle( SOLDIERTYPE *pSoldier, INT32 iId ) TeleportVehicleToItsClosestSector( iId, pVehicleSoldier->ubGroupID ); } - // Remove vehicle from squad..... - RemoveCharacterFromSquads( pVehicleSoldier ); - // ATE: Add him back to vehicle group! - if ( !DoesPlayerExistInPGroup( pVehicleList[ iId ].ubMovementGroup, pVehicleSoldier ) ) - { - AddPlayerToGroup( pVehicleList[ iId ].ubMovementGroup, pVehicleSoldier ); - } + // Remove vehicle from squad..... + RemoveCharacterFromSquads( pVehicleSoldier ); + // ATE: Add him back to vehicle group! + if ( !DoesPlayerExistInPGroup( pVehicleList[ iId ].ubMovementGroup, pVehicleSoldier ) ) + { + AddPlayerToGroup( pVehicleList[ iId ].ubMovementGroup, pVehicleSoldier ); + } ChangeSoldiersAssignment( pVehicleSoldier, ASSIGNMENT_EMPTY ); @@ -742,15 +757,15 @@ BOOLEAN RemoveSoldierFromVehicle( SOLDIERTYPE *pSoldier, INT32 iId ) if ( iId == iHelicopterVehicleId ) { // and he's alive - if ( pSoldier->bLife >= OKLIFE ) + if ( pSoldier->stats.bLife >= OKLIFE ) { // mark the sector as visited (flying around in the chopper doesn't, so this does it as soon as we get off it) SetSectorFlag( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ, SF_ALREADY_VISITED ); } - SetSoldierExitVehicleInsertionData( pSoldier, iId ); + SetSoldierExitVehicleInsertionData( pSoldier, iId ); - // Update in sector if this is the current sector..... + // Update in sector if this is the current sector..... if ( pSoldier->sSectorX == gWorldSectorX && pSoldier->sSectorY == gWorldSectorY && pSoldier->bSectorZ == gbWorldSectorZ ) { UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); @@ -777,13 +792,13 @@ void RemoveSoldierFromVehicleBetweenSectors( pSoldier, iId ) // set up a mvt group for the grunt - pSoldier->fBetweenSectors = TRUE; + pSoldier->flags.fBetweenSectors = TRUE; // ok, the guy wasn't in a squad // get his mvt groups position and set the squads to this GetGroupPosition(&ubNextX, &ubNextY, &ubPrevX, &ubPrevY, &uiTraverseTime, &uiArriveTime, pVehicleList[ iId ].ubMovementGroup ); - ubGroupId = CreateNewPlayerGroupDepartingFromSector( ( INT8 ) ( pSoldier -> sSectorX ) , ( INT8 ) ( pSoldier -> sSectorY ) ); + ubGroupId = CreateNewPlayerGroupDepartingFromSector( ( INT8 ) ( pSoldier->sSectorX ) , ( INT8 ) ( pSoldier->sSectorY ) ); // assign to a group AddPlayerToGroup( ubGroupId, pSoldier ); @@ -835,7 +850,7 @@ void RemoveSoldierFromVehicleBetweenSectors( pSoldier, iId ) if( iCurrentCostInTime == 0xffffffff ) { - AssertMsg( 0, String("Group %d (%s) attempting illegal move from sector %d, dir %d (%s).", + AssertMsg( 0, String("Group %d (%s) attempting illegal move from sector %d, dir %d (%s).", pGroup->ubGroupID, ( pGroup->fPlayer ) ? "Player" : "AI", ubSector, ubDirection, gszTerrain[SectorInfo[ubSector].ubTraversability[ubDirection]] ) ); @@ -847,10 +862,10 @@ void RemoveSoldierFromVehicleBetweenSectors( pSoldier, iId ) // calculate how much longer we have to go on foot to get there uiArriveTime = ( UINT32 )( ( ( 1.0 - flTripFractionCovered ) * ( float )iCurrentCostInTime ) + GetWorldTotalMin( ) ); - SetGroupPosition( ubNextX, ubNextY, ubPrevX, ubPrevY, iCurrentCostInTime, uiArriveTime, pSoldier -> ubGroupID ); + SetGroupPosition( ubNextX, ubNextY, ubPrevX, ubPrevY, iCurrentCostInTime, uiArriveTime, pSoldier->ubGroupID ); // ARM: if this is ever reactivated, there seem to be the following additional problems: - 1) The soldier removed isn't showing any DEST. Must set up his strategic path/destination. + 1) The soldier removed isn't showing any DEST. Must set up his strategic path/destination. 2) The arrive time seems to be much later than it should have been, suggesting the math above is wrong somehow 3) Reassigning multiple mercs at once out of a vehicle onroute doesn't work 'cause the group is between sectors so only the first merc gets added successfully, the others all fail. @@ -869,14 +884,14 @@ BOOLEAN MoveCharactersPathToVehicle( SOLDIERTYPE *pSoldier ) } // check if character is in fact in a vehicle - if( ( pSoldier->bAssignment != VEHICLE ) && ( ! ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) ) + if( ( pSoldier->bAssignment != VEHICLE ) && ( ! ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) ) { // now clear soldier's path pSoldier->pMercPath = ClearStrategicPathList( pSoldier->pMercPath, 0 ); return( FALSE ); } - if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // grab the id the character is iId = pSoldier->bVehicleID; @@ -897,7 +912,7 @@ BOOLEAN MoveCharactersPathToVehicle( SOLDIERTYPE *pSoldier ) pSoldier->pMercPath = ClearStrategicPathList( pSoldier->pMercPath, 0 ); return ( FALSE ); } - + // now check if vehicle is valid if( pVehicleList[ iId ].fValid == FALSE ) { @@ -936,12 +951,12 @@ BOOLEAN CopyVehiclePathToSoldier( SOLDIERTYPE *pSoldier ) } // check if character is in fact in a vehicle - if( ( pSoldier->bAssignment != VEHICLE ) && ( ! ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) ) + if( ( pSoldier->bAssignment != VEHICLE ) && ( ! ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) ) { return( FALSE ); } - if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // grab the id the character is iId = pSoldier->bVehicleID; @@ -960,7 +975,7 @@ BOOLEAN CopyVehiclePathToSoldier( SOLDIERTYPE *pSoldier ) { return ( FALSE ); } - + // now check if vehicle is valid if( pVehicleList[ iId ].fValid == FALSE ) { @@ -971,11 +986,11 @@ BOOLEAN CopyVehiclePathToSoldier( SOLDIERTYPE *pSoldier ) // reset mvt group for the grunt // ATE: NOT if we are the vehicle - if ( !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { pSoldier->ubGroupID = pVehicleList[ iId ].ubMovementGroup; } - + // valid vehicle // clear grunt path @@ -999,16 +1014,16 @@ BOOLEAN SetUpMvtGroupForVehicle( SOLDIERTYPE *pSoldier ) // for pathing purposes, will be reset to zero in copying of path INT32 iId = 0; #ifndef RELEASE_WITH_DEBUG_INFO - INT32 iCounter = 0; + //INT32 iCounter = 0; #endif // RELEASE_WITH_DEBUG_INFO // check if character is in fact in a vehicle - if( ( pSoldier->bAssignment != VEHICLE ) && ( ! ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) ) + if( ( pSoldier->bAssignment != VEHICLE ) && ( ! ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) ) { return( FALSE ); } - if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // grab the id the character is iId = pSoldier->bVehicleID; @@ -1073,7 +1088,7 @@ INT32 GetTravelTimeOfVehicle( INT32 iId ) { GROUP *pGroup; - + // valid vehicle? if( VehicleIdIsValid( iId ) == FALSE ) { @@ -1116,7 +1131,7 @@ void UpdatePositionOfMercsInVehicle( INT32 iId ) { pVehicleList[ iId ].pPassengers[ iCounter ]->sSectorY = pVehicleList[ iId ].sSectorY; pVehicleList[ iId ].pPassengers[ iCounter ]->sSectorX = pVehicleList[ iId ].sSectorX; - pVehicleList[ iId ].pPassengers[ iCounter ]->fBetweenSectors = FALSE; + pVehicleList[ iId ].pPassengers[ iCounter ]->flags.fBetweenSectors = FALSE; } } @@ -1142,7 +1157,7 @@ INT32 GivenMvtGroupIdFindVehicleId( UINT8 ubGroupId ) { if( pVehicleList[ iCounter ].ubMovementGroup == ubGroupId ) { - return( iCounter ); + return( iCounter ); } } } @@ -1194,22 +1209,22 @@ BOOLEAN InjurePersonInVehicle( INT32 iId, SOLDIERTYPE *pSoldier, UINT8 ubPointsO } // now check hpts of merc - if( pSoldier->bLife == 0 ) + if( pSoldier->stats.bLife == 0 ) { // guy is dead, leave return( FALSE ); } // see if we will infact kill them - if( ubPointsOfDmg >= pSoldier->bLife ) + if( ubPointsOfDmg >= pSoldier->stats.bLife ) { return( KillPersonInVehicle( iId, pSoldier ) ); } // otherwise hurt them - SoldierTakeDamage( pSoldier, 0, ubPointsOfDmg, ubPointsOfDmg, TAKE_DAMAGE_GUNFIRE, NOBODY, NOWHERE, 0, TRUE ); + pSoldier->SoldierTakeDamage( 0, ubPointsOfDmg, ubPointsOfDmg, TAKE_DAMAGE_GUNFIRE, NOBODY, NOWHERE, 0, TRUE ); - HandleSoldierTakeDamageFeedback( pSoldier ); + pSoldier->HandleSoldierTakeDamageFeedback( ); return( TRUE ); } @@ -1229,14 +1244,14 @@ BOOLEAN KillPersonInVehicle( INT32 iId, SOLDIERTYPE *pSoldier ) } // now check hpts of merc - if( pSoldier->bLife == 0 ) + if( pSoldier->stats.bLife == 0 ) { // guy is dead, leave return( FALSE ); } // otherwise hurt them - SoldierTakeDamage( pSoldier, 0, 100, 100, TAKE_DAMAGE_BLOODLOSS, NOBODY, NOWHERE, 0, TRUE ); + pSoldier->SoldierTakeDamage( 0, 100, 100, TAKE_DAMAGE_BLOODLOSS, NOBODY, NOWHERE, 0, TRUE ); return( TRUE ); } @@ -1327,7 +1342,7 @@ BOOLEAN IsRobotControllerInVehicle( INT32 iId ) for( iCounter = 0; iCounter < iSeatingCapacities[ pVehicleList[ iId ].ubVehicleType ]; iCounter++ ) { pSoldier = pVehicleList[ iId ].pPassengers[ iCounter ]; - if ( pSoldier != NULL && ControllingRobot( pSoldier ) ) + if ( pSoldier != NULL && pSoldier->ControllingRobot( ) ) { return( TRUE ); } @@ -1397,9 +1412,9 @@ BOOLEAN PutSoldierInVehicle( SOLDIERTYPE *pSoldier, INT8 bVehicleId ) SOLDIERTYPE *pVehicleSoldier = NULL; - if( ( pSoldier->sSectorX != gWorldSectorX ) || ( pSoldier->sSectorY != gWorldSectorY ) || ( pSoldier->bSectorZ != 0 ) || ( bVehicleId == iHelicopterVehicleId ) ) + if( ( pSoldier->sSectorX != gWorldSectorX ) || ( pSoldier->sSectorY != gWorldSectorY ) || ( pSoldier->bSectorZ != 0 ) || ( bVehicleId == iHelicopterVehicleId ) ) { - // add the soldier + // add the soldier return( AddSoldierToVehicle( pSoldier, bVehicleId ) ); } else @@ -1423,7 +1438,7 @@ BOOLEAN TakeSoldierOutOfVehicle( SOLDIERTYPE *pSoldier ) if( ( pSoldier->sSectorX != gWorldSectorX ) || ( pSoldier->sSectorY != gWorldSectorY ) || ( pSoldier->bSectorZ != 0 ) || !pSoldier->bInSector ) { - // add the soldier + // add the soldier return( RemoveSoldierFromVehicle( pSoldier, pSoldier->iVehicleId ) ); } else @@ -1445,10 +1460,8 @@ BOOLEAN TakeSoldierOutOfVehicle( SOLDIERTYPE *pSoldier ) BOOLEAN EnterVehicle( SOLDIERTYPE *pVehicle, SOLDIERTYPE *pSoldier ) { - INT16 sOldGridNo = 0; - // TEST IF IT'S VALID... - if ( pVehicle->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pVehicle->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // Is there room... if ( IsEnoughSpaceInVehicle( pVehicle->bVehicleID ) ) @@ -1472,15 +1485,15 @@ BOOLEAN EnterVehicle( SOLDIERTYPE *pVehicle, SOLDIERTYPE *pSoldier ) SOLDIERTYPE *GetVehicleSoldierPointerFromPassenger( SOLDIERTYPE *pSrcSoldier ) { UINT32 cnt; - SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pSoldier; // End the turn of player charactors cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - // look for all mercs on the same team, - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) - { - if ( pSoldier->bActive && pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + // look for all mercs on the same team, + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) + { + if ( pSoldier->bActive && pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // Check ubID.... if ( pSoldier->bVehicleID == pSrcSoldier->iVehicleId ) @@ -1489,7 +1502,7 @@ SOLDIERTYPE *GetVehicleSoldierPointerFromPassenger( SOLDIERTYPE *pSrcSoldier ) } } } - + return( NULL ); } @@ -1509,7 +1522,7 @@ BOOLEAN ExitVehicle( SOLDIERTYPE *pSoldier ) } // TEST IF IT'S VALID... - if ( pVehicle->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pVehicle->flags.uiStatusFlags & SOLDIER_VEHICLE ) { sGridNo = FindGridNoFromSweetSpotWithStructDataFromSoldier( pSoldier, pSoldier->usUIMovementMode, 5, &ubDirection, 3, pVehicle ); @@ -1529,19 +1542,19 @@ BOOLEAN ExitVehicle( SOLDIERTYPE *pSoldier ) pSoldier->iVehicleId = -1; //AllTeamsLookForAll( FALSE ); - pSoldier->bOppList[ pVehicle->ubID ] = 1; + pSoldier->aiData.bOppList[ pVehicle->ubID ] = 1; // Add to sector.... - EVENT_SetSoldierPosition( pSoldier, CenterX( sGridNo ), CenterY( sGridNo ) ); - + pSoldier->EVENT_SetSoldierPosition( CenterX( sGridNo ), CenterY( sGridNo ) ); + // Update visiblity..... HandleSight(pSoldier,SIGHT_LOOK | SIGHT_RADIO ); - + // Add to unique squad.... AddCharacterToUniqueSquad( pSoldier ); // can't call SetCurrentSquad OR SelectSoldier in mapscreen, that will initialize interface panels!!! - if ( guiCurrentScreen == GAME_SCREEN ) + if ( guiCurrentScreen == GAME_SCREEN ) { SetCurrentSquad( pSoldier->bAssignment, TRUE ); @@ -1568,17 +1581,15 @@ void AddPassangersToTeamPanel( INT32 iId ) AddPlayerToInterfaceTeamSlot( pVehicleList[ iId ].pPassengers[ cnt ]->ubID ); } } -} +} void VehicleTakeDamage( UINT8 ubID, UINT8 ubReason, INT16 sDamage, INT16 sGridNo, UINT8 ubAttackerID ) { - INT16 sOldDmgValue = 0; - - if ( ubReason != TAKE_DAMAGE_GAS ) - { - PlayJA2Sample( (UINT32)( S_METAL_IMPACT3 ), RATE_11025, SoundVolume( MIDVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); - } + if ( ubReason != TAKE_DAMAGE_GAS ) + { + PlayJA2Sample( (UINT32)( S_METAL_IMPACT3 ), RATE_11025, SoundVolume( MIDVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); + } // check if there was in fact damage done to the vehicle if( ( ubReason == TAKE_DAMAGE_HANDTOHAND ) || ( ubReason == TAKE_DAMAGE_GAS ) ) @@ -1606,11 +1617,7 @@ void HandleCriticalHitForVehicleInLocation( UINT8 ubID, INT16 sDmg, INT16 sGridN { // check state the armor was s'posed to be in vs. the current state..the difference / orig state is % chance // that a critical hit will occur - INT16 sOrigValue = 0, sCurrValue = 0; - FLOAT fChance = 0.0; - INT32 iRand = 0, iCrit = 0; SOLDIERTYPE *pSoldier; - BOOLEAN fDestroyVehicle = FALSE; BOOLEAN fMadeCorpse = FALSE; #if 0 @@ -1630,19 +1637,19 @@ void HandleCriticalHitForVehicleInLocation( UINT8 ubID, INT16 sDmg, INT16 sGridN pSoldier = GetSoldierStructureForVehicle( ubID ); - if ( sDmg > pSoldier->bLife ) + if ( sDmg > pSoldier->stats.bLife ) { - pSoldier->bLife = 0; + pSoldier->stats.bLife = 0; } else { // Decrease Health - pSoldier->bLife -= sDmg; + pSoldier->stats.bLife -= sDmg; } - if ( pSoldier->bLife < OKLIFE ) + if ( pSoldier->stats.bLife < OKLIFE ) { - pSoldier->bLife = 0; + pSoldier->stats.bLife = 0; } //Show damage @@ -1657,7 +1664,7 @@ void HandleCriticalHitForVehicleInLocation( UINT8 ubID, INT16 sDmg, INT16 sGridN INT16 sMercScreenX, sMercScreenY, sOffsetX, sOffsetY; // Set Damage display counter - pSoldier->fDisplayDamage = TRUE; + pSoldier->flags.fDisplayDamage = TRUE; pSoldier->bDisplayDamageCount = 0; GetSoldierScreenPos( pSoldier, &sMercScreenX, &sMercScreenY ); @@ -1667,9 +1674,9 @@ void HandleCriticalHitForVehicleInLocation( UINT8 ubID, INT16 sDmg, INT16 sGridN } } - if ( pSoldier->bLife == 0 && !pVehicleList[ ubID ].fDestroyed ) + if ( pSoldier->stats.bLife == 0 && !pVehicleList[ ubID ].fDestroyed ) { - pVehicleList[ ubID ].fDestroyed = TRUE; + pVehicleList[ ubID ].fDestroyed = TRUE; // Explode vehicle... IgniteExplosion( ubAttackerID, CenterX( sGridNo ), CenterY( sGridNo ), 0, sGridNo, GREAT_BIG_EXPLOSION, 0 ); @@ -1677,14 +1684,14 @@ void HandleCriticalHitForVehicleInLocation( UINT8 ubID, INT16 sDmg, INT16 sGridN if ( pSoldier != NULL ) { // Tacticlly remove soldier.... - // EVENT_InitNewSoldierAnim( pSoldier, VEHICLE_DIE, 0, FALSE ); + // pSoldier->EVENT_InitNewSoldierAnim( VEHICLE_DIE, 0, FALSE ); //TacticalRemoveSoldier( pSoldier->ubID ); CheckForAndHandleSoldierDeath( pSoldier, &fMadeCorpse ); } - // Kill all in vehicle... - KillAllInVehicle( ubID ); + // Kill all in vehicle... + KillAllInVehicle( ubID ); } @@ -1714,7 +1721,7 @@ BOOLEAN DoesVehicleNeedAnyRepairs( INT32 iVehicleId ) // get the vehicle soldiertype pVehicleSoldier = GetSoldierStructureForVehicle( iVehicleId ); - if ( pVehicleSoldier->bLife != pVehicleSoldier->bLifeMax ) + if ( pVehicleSoldier->stats.bLife != pVehicleSoldier->stats.bLifeMax ) { return( TRUE ); } @@ -1751,19 +1758,19 @@ INT8 RepairVehicle( INT32 iVehicleId, INT8 bRepairPtsLeft, BOOLEAN *pfNothingToR return( bRepairPtsUsed ); } - bOldLife = pVehicleSoldier->bLife; + bOldLife = pVehicleSoldier->stats.bLife; // Repair - pVehicleSoldier->bLife += ( bRepairPtsLeft / VEHICLE_REPAIR_POINTS_DIVISOR ); + pVehicleSoldier->stats.bLife += ( bRepairPtsLeft / VEHICLE_REPAIR_POINTS_DIVISOR ); // Check - if ( pVehicleSoldier->bLife > pVehicleSoldier->bLifeMax ) + if ( pVehicleSoldier->stats.bLife > pVehicleSoldier->stats.bLifeMax ) { - pVehicleSoldier->bLife = pVehicleSoldier->bLifeMax; + pVehicleSoldier->stats.bLife = pVehicleSoldier->stats.bLifeMax; } // Calculate pts used; - bRepairPtsUsed = ( pVehicleSoldier->bLife - bOldLife ) * VEHICLE_REPAIR_POINTS_DIVISOR; + bRepairPtsUsed = ( pVehicleSoldier->stats.bLife - bOldLife ) * VEHICLE_REPAIR_POINTS_DIVISOR; // ARM: personally, I'd love to know where in Arulco the mechanic gets the PARTS to do this stuff, but hey, it's a game! (*pfNothingToRepair) = !DoesVehicleNeedAnyRepairs( iVehicleId ); @@ -1798,7 +1805,7 @@ SOLDIERTYPE * GetSoldierStructureForVehicle( INT32 iId ) if ( pSoldier->bActive ) { - if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { if( pSoldier->bVehicleID == iId ) { @@ -1815,8 +1822,6 @@ SOLDIERTYPE * GetSoldierStructureForVehicle( INT32 iId ) void SetUpArmorForVehicle( UINT8 ubID ) { - INT32 iCounter = 0; - /* // set up the internal and external armor for vehicles for( iCounter = 0; iCounter < NUMBER_OF_INTERNAL_HIT_LOCATIONS_IN_VEHICLE; iCounter++ ) @@ -1906,7 +1911,7 @@ BOOLEAN SaveVehicleInformationToSaveGameFile( HWFILE hFile ) //loop through the passengers for( ubPassengerCnt=0; ubPassengerCnt<10; ubPassengerCnt++) { - TempVehicle.pPassengers[ ubPassengerCnt ] = ( SOLDIERTYPE * )NO_PROFILE; + TempVehicle.pPassengers[ ubPassengerCnt ] = ( SOLDIERTYPE * )NO_PROFILE; //if there is a passenger here if( pVehicleList[cnt].pPassengers[ ubPassengerCnt ] ) @@ -1952,7 +1957,7 @@ BOOLEAN SaveVehicleInformationToSaveGameFile( HWFILE hFile ) { return( FALSE ); } - + pTempPathPtr = pTempPathPtr->pNext; } } @@ -2017,28 +2022,28 @@ BOOLEAN LoadVehicleInformationFromSavedGameFile( HWFILE hFile, UINT32 uiSavedGam //loop through all the passengers for(ubPassengerCnt=0; ubPassengerCnt<10; ubPassengerCnt++) { - if ( uiSavedGameVersion < 86 ) - { - if( pVehicleList[cnt].pPassengers[ubPassengerCnt] != 0 ) - { - // ! The id of the soldier was saved in the passenger pointer. The passenger pointer is converted back - // ! to a UINT8 so we can get the REAL pointer to the soldier. - pVehicleList[cnt].pPassengers[ubPassengerCnt] = FindSoldierByProfileID( (UINT8)pVehicleList[cnt].pPassengers[ ubPassengerCnt ], FALSE ); - } - } - else - { - if( pVehicleList[cnt].pPassengers[ubPassengerCnt] != ( SOLDIERTYPE * )NO_PROFILE ) - { - // ! The id of the soldier was saved in the passenger pointer. The passenger pointer is converted back - // ! to a UINT8 so we can get the REAL pointer to the soldier. - pVehicleList[cnt].pPassengers[ubPassengerCnt] = FindSoldierByProfileID( (UINT8)pVehicleList[cnt].pPassengers[ ubPassengerCnt ], FALSE ); - } - else - { - pVehicleList[cnt].pPassengers[ubPassengerCnt] = NULL; - } - } + if ( uiSavedGameVersion < 86 ) + { + if( pVehicleList[cnt].pPassengers[ubPassengerCnt] != 0 ) + { + // ! The id of the soldier was saved in the passenger pointer. The passenger pointer is converted back + // ! to a UINT8 so we can get the REAL pointer to the soldier. + pVehicleList[cnt].pPassengers[ubPassengerCnt] = FindSoldierByProfileID( (UINT8)pVehicleList[cnt].pPassengers[ ubPassengerCnt ], FALSE ); + } + } + else + { + if( pVehicleList[cnt].pPassengers[ubPassengerCnt] != ( SOLDIERTYPE * )NO_PROFILE ) + { + // ! The id of the soldier was saved in the passenger pointer. The passenger pointer is converted back + // ! to a UINT8 so we can get the REAL pointer to the soldier. + pVehicleList[cnt].pPassengers[ubPassengerCnt] = FindSoldierByProfileID( (UINT8)pVehicleList[cnt].pPassengers[ ubPassengerCnt ], FALSE ); + } + else + { + pVehicleList[cnt].pPassengers[ubPassengerCnt] = NULL; + } + } } @@ -2078,7 +2083,7 @@ BOOLEAN LoadVehicleInformationFromSavedGameFile( HWFILE hFile, UINT32 uiSavedGam if( pVehicleList[cnt].pMercPath == NULL ) pVehicleList[cnt].pMercPath = pTempPath; - + //if there is a previous node if( pPath != NULL ) @@ -2123,7 +2128,7 @@ void UpdateAllVehiclePassengersGridNo( SOLDIERTYPE *pSoldier ) SOLDIERTYPE *pPassenger; // If not a vehicle, ignore! - if ( !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { return; } @@ -2136,9 +2141,9 @@ void UpdateAllVehiclePassengersGridNo( SOLDIERTYPE *pSoldier ) if( pVehicleList[ iId ].pPassengers[ iCounter ] != NULL ) { pPassenger = pVehicleList[ iId ].pPassengers[ iCounter ]; - + // Set gridno..... - EVENT_SetSoldierPosition( pPassenger, pSoldier->dXPos, pSoldier->dYPos ); + pPassenger->EVENT_SetSoldierPosition( pSoldier->dXPos, pSoldier->dYPos ); } } } @@ -2147,8 +2152,6 @@ void UpdateAllVehiclePassengersGridNo( SOLDIERTYPE *pSoldier ) BOOLEAN SaveVehicleMovementInfoToSavedGameFile( HWFILE hFile ) { UINT32 uiNumBytesWritten = 0; - UINT32 uiSaveSize=0; - //Save all the vehicle movement id's FileWrite( hFile, gubVehicleMovementGroups, sizeof( INT8 ) * 5, &uiNumBytesWritten ); if( uiNumBytesWritten != sizeof( INT8 ) * 5 ) @@ -2165,8 +2168,6 @@ BOOLEAN LoadVehicleMovementInfoFromSavedGameFile( HWFILE hFile ) INT32 cnt; GROUP *pGroup = NULL; UINT32 uiNumBytesRead=0; - UINT32 uiSaveSize=0; - //Load in the Squad movement id's FileRead( hFile, gubVehicleMovementGroups, sizeof( INT8 ) * 5, &uiNumBytesRead ); if( uiNumBytesRead != sizeof( INT8 ) * 5 ) @@ -2174,7 +2175,7 @@ BOOLEAN LoadVehicleMovementInfoFromSavedGameFile( HWFILE hFile ) return(FALSE); } - for( cnt = 5; cnt < MAX_VEHICLES; cnt++ ) + for( cnt = 5; cnt < MAX_VEHICLES; cnt++ ) { // create mvt groups gubVehicleMovementGroups[ cnt ] = CreateNewVehicleGroupDepartingFromSector( 1, 1, cnt ); @@ -2191,8 +2192,6 @@ BOOLEAN LoadVehicleMovementInfoFromSavedGameFile( HWFILE hFile ) BOOLEAN NewSaveVehicleMovementInfoToSavedGameFile( HWFILE hFile ) { UINT32 uiNumBytesWritten = 0; - UINT32 uiSaveSize=0; - //Save all the vehicle movement id's FileWrite( hFile, gubVehicleMovementGroups, sizeof( INT8 ) * MAX_VEHICLES, &uiNumBytesWritten ); if( uiNumBytesWritten != sizeof( INT8 ) * MAX_VEHICLES ) @@ -2207,8 +2206,6 @@ BOOLEAN NewSaveVehicleMovementInfoToSavedGameFile( HWFILE hFile ) BOOLEAN NewLoadVehicleMovementInfoFromSavedGameFile( HWFILE hFile ) { UINT32 uiNumBytesRead=0; - UINT32 uiSaveSize=0; - //Load in the Squad movement id's FileRead( hFile, gubVehicleMovementGroups, sizeof( INT8 ) * MAX_VEHICLES, &uiNumBytesRead ); if( uiNumBytesRead != sizeof( INT8 ) * MAX_VEHICLES ) @@ -2285,32 +2282,32 @@ void TeleportVehicleToItsClosestSector( INT32 iVehicleId, UINT8 ubGroupID ) // make it arrive immediately, not eventually (it's driverless) SetGroupArrivalTime( pGroup, GetWorldTotalMin() ); - // change where it is and where it's going, then make it arrive there. Don't check for battle + // change where it is and where it's going, then make it arrive there. Don't check for battle PlaceGroupInSector( ubGroupID, sPrevX, sPrevY, sNextX, sNextY, 0, FALSE ); } void AddVehicleFuelToSave( ) { - INT32 iCounter; - SOLDIERTYPE *pVehicleSoldier = NULL; + INT32 iCounter; + SOLDIERTYPE *pVehicleSoldier = NULL; for( iCounter = 0; iCounter < ubNumberOfVehicles ; iCounter++ ) { // might have an empty slot if( pVehicleList[ iCounter ].fValid ) - { - // get the vehicle soldiertype - pVehicleSoldier = GetSoldierStructureForVehicle( iCounter ); - - if( pVehicleSoldier ) - { - // Init fuel! - pVehicleSoldier->sBreathRed = 10000; - pVehicleSoldier->bBreath = 100; - } - } - } + { + // get the vehicle soldiertype + pVehicleSoldier = GetSoldierStructureForVehicle( iCounter ); + + if( pVehicleSoldier ) + { + // Init fuel! + pVehicleSoldier->sBreathRed = 10000; + pVehicleSoldier->bBreath = 100; + } + } + } } @@ -2336,20 +2333,20 @@ BOOLEAN CanSoldierDriveVehicle( SOLDIERTYPE *pSoldier, INT32 iVehicleId, BOOLEAN return( FALSE ); } - if( !fIgnoreAsleep && ( pSoldier->fMercAsleep == TRUE ) ) + if( !fIgnoreAsleep && ( pSoldier->flags.fMercAsleep == TRUE ) ) { // asleep! return( FALSE ); } - if( ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) || AM_A_ROBOT( pSoldier ) || AM_AN_EPC( pSoldier ) ) + if( ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) || AM_A_ROBOT( pSoldier ) || AM_AN_EPC( pSoldier ) ) { // vehicles, robot, and EPCs can't drive! return (FALSE); } // too wounded to drive - if( pSoldier->bLife < OKLIFE ) + if( pSoldier->stats.bLife < OKLIFE ) { return (FALSE); } @@ -2387,7 +2384,7 @@ BOOLEAN SoldierMustDriveVehicle( SOLDIERTYPE *pSoldier, INT32 iVehicleId, BOOLEA if ( CanSoldierDriveVehicle( pSoldier, iVehicleId, TRUE ) ) { // and he's the ONLY one aboard who can do so - if ( OnlyThisSoldierCanDriveVehicle( pSoldier, iVehicleId ) ) + if ( OnlythisCanDriveVehicle( pSoldier, iVehicleId ) ) { return( TRUE ); } @@ -2399,7 +2396,7 @@ BOOLEAN SoldierMustDriveVehicle( SOLDIERTYPE *pSoldier, INT32 iVehicleId, BOOLEA -BOOLEAN OnlyThisSoldierCanDriveVehicle( SOLDIERTYPE *pThisSoldier, INT32 iVehicleId ) +BOOLEAN OnlythisCanDriveVehicle( SOLDIERTYPE *pthis, INT32 iVehicleId ) { INT32 iCounter = 0; SOLDIERTYPE *pSoldier = NULL; @@ -2407,16 +2404,16 @@ BOOLEAN OnlyThisSoldierCanDriveVehicle( SOLDIERTYPE *pThisSoldier, INT32 iVehicl for( iCounter = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; iCounter <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; iCounter++ ) { - // get the current soldier + // get the current soldier pSoldier = &Menptr[ iCounter ]; // skip checking THIS soldier, we wanna know about everyone else - if ( pSoldier == pThisSoldier ) + if ( pSoldier == pthis ) { continue; } - if( pSoldier -> bActive ) + if( pSoldier->bActive ) { // don't count mercs who are asleep here if ( CanSoldierDriveVehicle( pSoldier, iVehicleId, FALSE ) ) @@ -2473,7 +2470,7 @@ BOOLEAN IsSoldierInThisVehicleSquad( SOLDIERTYPE *pSoldier, INT8 bSquadNumber ) } -SOLDIERTYPE* PickRandomPassengerFromVehicle( SOLDIERTYPE *pSoldier ) +SOLDIERTYPE* PickRandomPassengerFromVehicle( SOLDIERTYPE *pSoldier ) { UINT8 ubMercsInSector[ 20 ] = { 0 }; UINT8 ubNumMercs = 0; @@ -2481,7 +2478,7 @@ SOLDIERTYPE* PickRandomPassengerFromVehicle( SOLDIERTYPE *pSoldier ) INT32 iCounter, iId; // If not a vehicle, ignore! - if ( !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { return( NULL ); } @@ -2503,10 +2500,10 @@ SOLDIERTYPE* PickRandomPassengerFromVehicle( SOLDIERTYPE *pSoldier ) ubChosenMerc = (UINT8)Random( ubNumMercs ); // If we are air raid, AND red exists somewhere... - return( pVehicleList[ iId ].pPassengers[ ubChosenMerc ] ); - } + return( pVehicleList[ iId ].pPassengers[ ubChosenMerc ] ); + } - return( NULL ); + return( NULL ); } BOOLEAN DoesVehicleHaveAnyPassengers( INT32 iVehicleID ) @@ -2526,7 +2523,7 @@ BOOLEAN DoesVehicleGroupHaveAnyPassengers( GROUP *pGroup ) if( iVehicleID == -1 ) { #ifdef JA2BETAVERSION - AssertMsg( iVehicleID != -1, "DoesVehicleGroupHaveAnyPassengers() for vehicle group. Invalid iVehicleID." ); + AssertMsg( iVehicleID != -1, "DoesVehicleGroupHaveAnyPassengers() for vehicle group. Invalid iVehicleID." ); #endif return FALSE; } @@ -2535,3 +2532,4 @@ BOOLEAN DoesVehicleGroupHaveAnyPassengers( GROUP *pGroup ) } + diff --git a/Tactical/Vehicles.h b/Tactical/Vehicles.h index 0a156281..ad35df98 100644 --- a/Tactical/Vehicles.h +++ b/Tactical/Vehicles.h @@ -49,33 +49,32 @@ enum{ extern INT16 sVehicleOrigArmorValues[ NUMBER_OF_TYPES_OF_VEHICLES][ NUMBER_OF_INTERNAL_HIT_LOCATIONS_IN_VEHICLE]; -// WDS - Clean up inventory handling #define MAXPASSENGERS 10 // struct for vehicles typedef struct { - PathStPtr pMercPath; // vehicle's stategic path list - UINT8 ubMovementGroup; // the movement group this vehicle belongs to - UINT8 ubVehicleType; // type of vehicle - INT16 sSectorX; // X position on the Stategic Map - INT16 sSectorY; // Y position on the Stategic Map - INT16 sSectorZ; - BOOLEAN fBetweenSectors; // between sectors? - INT16 sGridNo; // location in tactical + PathStPtr pMercPath; // vehicle's stategic path list + UINT8 ubMovementGroup; // the movement group this vehicle belongs to + UINT8 ubVehicleType; // type of vehicle + INT16 sSectorX; // X position on the Stategic Map + INT16 sSectorY; // Y position on the Stategic Map + INT16 sSectorZ; + BOOLEAN fBetweenSectors; // between sectors? + INT16 sGridNo; // location in tactical SOLDIERTYPE *pPassengers[ MAXPASSENGERS ]; - UINT8 ubDriver; - INT16 sInternalHitLocations[ NUMBER_OF_EXTERNAL_HIT_LOCATIONS_ON_VEHICLE ]; - INT16 sArmourType; - INT16 sExternalArmorLocationsStatus[ NUMBER_OF_EXTERNAL_HIT_LOCATIONS_ON_VEHICLE ]; - INT16 sCriticalHits[ NUMBER_OF_INTERNAL_HIT_LOCATIONS_IN_VEHICLE ]; - INT32 iOnSound; - INT32 iOffSound; - INT32 iMoveSound; - INT32 iOutOfSound; - BOOLEAN fFunctional; - BOOLEAN fDestroyed; - INT32 iMovementSoundID; - UINT8 ubProfileID; + UINT8 ubDriver; + INT16 sInternalHitLocations[ NUMBER_OF_EXTERNAL_HIT_LOCATIONS_ON_VEHICLE ]; + INT16 sArmourType; + INT16 sExternalArmorLocationsStatus[ NUMBER_OF_EXTERNAL_HIT_LOCATIONS_ON_VEHICLE ]; + INT16 sCriticalHits[ NUMBER_OF_INTERNAL_HIT_LOCATIONS_IN_VEHICLE ]; + INT32 iOnSound; + INT32 iOffSound; + INT32 iMoveSound; + INT32 iOutOfSound; + BOOLEAN fFunctional; + BOOLEAN fDestroyed; + INT32 iMovementSoundID; + UINT8 ubProfileID; BOOLEAN fValid; @@ -221,13 +220,13 @@ void AddVehicleFuelToSave( ); BOOLEAN CanSoldierDriveVehicle( SOLDIERTYPE *pSoldier, INT32 iVehicleId, BOOLEAN fIgnoreAsleep ); BOOLEAN SoldierMustDriveVehicle( SOLDIERTYPE *pSoldier, INT32 iVehicleId, BOOLEAN fTryingToTravel ); -BOOLEAN OnlyThisSoldierCanDriveVehicle( SOLDIERTYPE *pSoldier, INT32 iVehicleId ); +BOOLEAN OnlythisCanDriveVehicle( SOLDIERTYPE *pSoldier, INT32 iVehicleId ); BOOLEAN IsEnoughSpaceInVehicle( INT32 iID ); BOOLEAN IsSoldierInThisVehicleSquad( SOLDIERTYPE *pSoldier, INT8 bSquadNumber ); -SOLDIERTYPE* PickRandomPassengerFromVehicle( SOLDIERTYPE *pSoldier ); +SOLDIERTYPE* PickRandomPassengerFromVehicle( SOLDIERTYPE *pSoldier ); BOOLEAN DoesVehicleHaveAnyPassengers( INT32 iVehicleID ); BOOLEAN DoesVehicleGroupHaveAnyPassengers( GROUP *pGroup ); diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index b288c8a8..4f12b5a5 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -4,7 +4,7 @@ #include "sgp.h" #include "overhead types.h" #include "Sound Control.h" - #include "Soldier Control.h" + #include "overhead.h" #include "Event Pump.h" #include "weapons.h" @@ -48,6 +48,11 @@ #include "Auto Resolve.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + //rain //#define WEAPON_RELIABILITY_REDUCTION_PER_RAIN_INTENSITY 0 extern INT8 gbCurrentRainIntensity; @@ -66,11 +71,11 @@ extern INT8 gbCurrentRainIntensity; #define MIN_TANK_RANGE 120 // range at which tank starts really having trouble aiming // percent reduction in sight range per point of aiming -#define SNIPERSCOPE_AIM_BONUS 20 +#define SNIPERSCOPE_AIM_BONUS 20 // bonus to hit with working laser scope #define LASERSCOPE_BONUS 20 // percent reduction in sight range per point of aiming -#define REFLEXSCOPE_AIM_BONUS 10 +#define REFLEXSCOPE_AIM_BONUS 10 #define MANDATORY_WEAPON_DELAY 1200 #define NO_WEAPON_SOUND 0 @@ -129,7 +134,7 @@ BOOLEAN gfReportHitChances = FALSE; // from Compendium of Modern Firearms (Edge of the Sword Vol 1) // JA2 GOLD: reduced pistol ready time to 0, tweaked sniper rifle values and G11 range -WEAPONTYPE Weapon[ MAXITEMS ]; +WEAPONTYPE Weapon[ MAXITEMS ]; // MADD MARKER @@ -203,48 +208,48 @@ ARMOURTYPE Armour[MAXITEMS+1];// = //{ // // Class Protection Degradation% Description // // ------------- ---------- ------------ ---------------- -// { ARMOURCLASS_VEST, 10, 25 }, /* Flak jacket */ -// { ARMOURCLASS_VEST, 13, 20 }, /* Flak jacket w X */ -// { ARMOURCLASS_VEST, 16, 15 }, /* Flak jacket w Y */ -// { ARMOURCLASS_VEST, 15, 20 }, /* Kevlar jacket */ -// { ARMOURCLASS_VEST, 19, 15 }, /* Kevlar jack w X */ -// { ARMOURCLASS_VEST, 24, 10 }, /* Kevlar jack w Y */ -// { ARMOURCLASS_VEST, 30, 15 }, /* Spectra jacket */ +// { ARMOURCLASS_VEST, 10, 25 }, /* Flak jacket */ +// { ARMOURCLASS_VEST, 13, 20 }, /* Flak jacket w X */ +// { ARMOURCLASS_VEST, 16, 15 }, /* Flak jacket w Y */ +// { ARMOURCLASS_VEST, 15, 20 }, /* Kevlar jacket */ +// { ARMOURCLASS_VEST, 19, 15 }, /* Kevlar jack w X */ +// { ARMOURCLASS_VEST, 24, 10 }, /* Kevlar jack w Y */ +// { ARMOURCLASS_VEST, 30, 15 }, /* Spectra jacket */ // { ARMOURCLASS_VEST, 36, 10 }, /* Spectra jack w X*/ // { ARMOURCLASS_VEST, 42, 5 }, /* Spectra jack w Y*/ -// { ARMOURCLASS_LEGGINGS, 15, 20 }, /* Kevlar leggings */ -// { ARMOURCLASS_LEGGINGS, 19, 15 }, /* Kevlar legs w X */ +// { ARMOURCLASS_LEGGINGS, 15, 20 }, /* Kevlar leggings */ +// { ARMOURCLASS_LEGGINGS, 19, 15 }, /* Kevlar legs w X */ // -// { ARMOURCLASS_LEGGINGS, 24, 10 }, /* Kevlar legs w Y */ -// { ARMOURCLASS_LEGGINGS, 30, 15 }, /* Spectra leggings*/ -// { ARMOURCLASS_LEGGINGS, 36, 10 }, /* Spectra legs w X*/ -// { ARMOURCLASS_LEGGINGS, 42, 5 }, /* Spectra legs w Y*/ -// { ARMOURCLASS_HELMET, 10, 5 }, /* Steel helmet */ -// { ARMOURCLASS_HELMET, 15, 20 }, /* Kevlar helmet */ -// { ARMOURCLASS_HELMET, 19, 15 }, /* Kevlar helm w X */ -// { ARMOURCLASS_HELMET, 24, 10 }, /* Kevlar helm w Y */ -// { ARMOURCLASS_HELMET, 30, 15 }, /* Spectra helmet */ -// { ARMOURCLASS_HELMET, 36, 10 }, /* Spectra helm w X*/ +// { ARMOURCLASS_LEGGINGS, 24, 10 }, /* Kevlar legs w Y */ +// { ARMOURCLASS_LEGGINGS, 30, 15 }, /* Spectra leggings*/ +// { ARMOURCLASS_LEGGINGS, 36, 10 }, /* Spectra legs w X*/ +// { ARMOURCLASS_LEGGINGS, 42, 5 }, /* Spectra legs w Y*/ +// { ARMOURCLASS_HELMET, 10, 5 }, /* Steel helmet */ +// { ARMOURCLASS_HELMET, 15, 20 }, /* Kevlar helmet */ +// { ARMOURCLASS_HELMET, 19, 15 }, /* Kevlar helm w X */ +// { ARMOURCLASS_HELMET, 24, 10 }, /* Kevlar helm w Y */ +// { ARMOURCLASS_HELMET, 30, 15 }, /* Spectra helmet */ +// { ARMOURCLASS_HELMET, 36, 10 }, /* Spectra helm w X*/ // -// { ARMOURCLASS_HELMET, 42, 5 }, /* Spectra helm w Y*/ -// { ARMOURCLASS_PLATE, 15, 200 }, /* Ceramic plates */ +// { ARMOURCLASS_HELMET, 42, 5 }, /* Spectra helm w Y*/ +// { ARMOURCLASS_PLATE, 15, 200 }, /* Ceramic plates */ // { ARMOURCLASS_MONST, 3, 0 }, /* Infant creature hide */ // { ARMOURCLASS_MONST, 5, 0 }, /* Young male creature hide */ // { ARMOURCLASS_MONST, 6, 0 }, /* Male creature hide */ // { ARMOURCLASS_MONST, 20, 0 }, /* Queen creature hide */ -// { ARMOURCLASS_VEST, 2, 25 }, /* Leather jacket */ -// { ARMOURCLASS_VEST, 12, 30 }, /* Leather jacket w kevlar */ -// { ARMOURCLASS_VEST, 16, 25 }, /* Leather jacket w kevlar & compound 18 */ -// { ARMOURCLASS_VEST, 19, 20 }, /* Leather jacket w kevlar & queen blood */ +// { ARMOURCLASS_VEST, 2, 25 }, /* Leather jacket */ +// { ARMOURCLASS_VEST, 12, 30 }, /* Leather jacket w kevlar */ +// { ARMOURCLASS_VEST, 16, 25 }, /* Leather jacket w kevlar & compound 18 */ +// { ARMOURCLASS_VEST, 19, 20 }, /* Leather jacket w kevlar & queen blood */ // // { ARMOURCLASS_MONST, 7, 0 }, /* Young female creature hide */ // { ARMOURCLASS_MONST, 8, 0 }, /* Old female creature hide */ -// { ARMOURCLASS_VEST, 1, 25 }, /* T-shirt */ -// { ARMOURCLASS_VEST, 22, 20 }, /* Kevlar 2 jacket */ -// { ARMOURCLASS_VEST, 27, 15 }, /* Kevlar 2 jack w X */ -// { ARMOURCLASS_VEST, 32, 10 }, /* Kevlar 2 jack w Y */ +// { ARMOURCLASS_VEST, 1, 25 }, /* T-shirt */ +// { ARMOURCLASS_VEST, 22, 20 }, /* Kevlar 2 jacket */ +// { ARMOURCLASS_VEST, 27, 15 }, /* Kevlar 2 jack w X */ +// { ARMOURCLASS_VEST, 32, 10 }, /* Kevlar 2 jack w Y */ //}; - + EXPLOSIVETYPE Explosive[MAXITEMS+1];// = //{ // // Type Yield Yield2 Radius Volume Volatility Animation Description @@ -336,7 +341,7 @@ struct WEAPONTYPE curWeapon; WEAPONTYPE * curWeaponList; UINT32 maxWeapons; - + UINT32 currentDepth; UINT32 maxReadDepth; } @@ -420,7 +425,7 @@ weaponCharacterDataHandle(void *userData, const XML_Char *str, int len) { weaponParseData * pData = (weaponParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); @@ -644,7 +649,7 @@ BOOLEAN ReadInWeaponStats(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + weaponParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading weapons.xml" ); @@ -653,7 +658,7 @@ BOOLEAN ReadInWeaponStats(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -668,15 +673,15 @@ BOOLEAN ReadInWeaponStats(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, weaponStartElementHandle, weaponEndElementHandle); XML_SetCharacterDataHandler(parser, weaponCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); pData.curWeaponList = Weapon; - pData.maxWeapons = MAXITEMS; - + pData.maxWeapons = MAXITEMS; + XML_SetUserData(parser, &pData); @@ -699,7 +704,7 @@ BOOLEAN ReadInWeaponStats(STR fileName) hFile = FileOpen( "TABLEDATA\\~Weapons out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -716,7 +721,7 @@ BOOLEAN ReadInWeaponStats(STR fileName) { UINT32 uiCharLoc = strcspn(szRemainder,"&<>\'\"\0"); CHAR8 invChar = szRemainder[uiCharLoc]; - + if(uiCharLoc) { szRemainder[uiCharLoc] = '\0'; @@ -796,13 +801,13 @@ BOOLEAN ReadInWeaponStats(STR fileName) BOOLEAN WriteWeaponStats() { HWFILE hFile; - + //Debug code; make sure that what we got from the file is the same as what's there // Open a new file hFile = FileOpen( "TABLEDATA\\Weapons out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -819,7 +824,7 @@ BOOLEAN WriteWeaponStats() { UINT32 uiCharLoc = strcspn(szRemainder,"&<>\'\"\0"); INT8 invChar = szRemainder[uiCharLoc]; - + if(uiCharLoc) { szRemainder[uiCharLoc] = '\0'; @@ -923,7 +928,7 @@ UINT16 GunRange( OBJECTTYPE * pObj ) // DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("GunRange: Found extender rng=%d",rng)); //} - //if ( Weapon [ pObj->usItem ].ubWeaponType == GUN_SHOTGUN && pObj->ubGunAmmoType != AMMO_BUCKSHOT ) + //if ( Weapon [ pObj->usItem ].ubWeaponType == GUN_SHOTGUN && (*pObj)[0]->data.gun.ubGunAmmoType != AMMO_BUCKSHOT ) //{ // rng += SOLID_SLUG_RANGE_BONUS; // DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("GunRange: Found solid slug rng=%d",rng)); @@ -954,25 +959,24 @@ UINT16 GunRange( OBJECTTYPE * pObj ) INT32 EffectiveArmour( OBJECTTYPE * pObj ) { INT32 iValue; - INT8 bPlate; if (pObj == NULL || Item[pObj->usItem].usItemClass != IC_ARMOUR) { return( 0 ); } iValue = Armour[ Item[pObj->usItem].ubClassIndex ].ubProtection; - iValue = iValue * pObj->ItemData.Generic.bStatus[0] * Armour[ Item[pObj->usItem].ubClassIndex ].ubCoverage / 10000; + iValue = iValue * (*pObj)[0]->data.objectStatus * Armour[ Item[pObj->usItem].ubClassIndex ].ubCoverage / 10000; -// bPlate = FindAttachment( pObj, CERAMIC_PLATES ); - bPlate = FindFirstArmourAttachment( pObj ); - if ( bPlate != ITEM_NOT_FOUND ) - { - INT32 iValue2; + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if (Item[iter->usItem].usItemClass == IC_ARMOUR && (*iter)[0]->data.objectStatus > 0 ) + { + INT32 iValue2; - iValue2 = Armour[ Item[ pObj->usAttachItem[bPlate] ].ubClassIndex ].ubProtection; - iValue2 = iValue2 * pObj->bAttachStatus[ bPlate ] * Armour[ Item[ pObj->usAttachItem[bPlate] ].ubClassIndex ].ubCoverage / 10000; + iValue2 = Armour[ Item[ iter->usItem ].ubClassIndex ].ubProtection; + iValue2 = iValue2 * (*iter)[0]->data.objectStatus * Armour[ Item[ iter->usItem ].ubClassIndex ].ubCoverage / 10000; - iValue += iValue2; + iValue += iValue2; + } } return( max(iValue,1) ); } @@ -982,7 +986,7 @@ INT32 ArmourPercent( SOLDIERTYPE * pSoldier ) INT32 iVest, iHelmet, iLeg; INT32 iDivideValue; - if (pSoldier->inv[VESTPOS].usItem) + if (pSoldier->inv[VESTPOS].exists() == true) { iVest = EffectiveArmour( &(pSoldier->inv[VESTPOS]) ); iDivideValue = ( ( Armour[ Item[ SPECTRA_VEST_18 ].ubClassIndex ].ubProtection * Armour[ Item[ SPECTRA_VEST_18 ].ubClassIndex ].ubCoverage ) + ( Armour[ Item[ CERAMIC_PLATES ].ubClassIndex ].ubProtection * Armour[ Item[ CERAMIC_PLATES ].ubClassIndex ].ubCoverage ) ); @@ -1003,7 +1007,7 @@ INT32 ArmourPercent( SOLDIERTYPE * pSoldier ) iVest = 0; } - if (pSoldier->inv[HELMETPOS].usItem) + if (pSoldier->inv[HELMETPOS].exists() == true) { iHelmet = EffectiveArmour( &(pSoldier->inv[HELMETPOS]) ); iDivideValue = ( Armour[ Item[ SPECTRA_HELMET_18 ].ubClassIndex ].ubProtection * Armour[ Item[ SPECTRA_HELMET_18 ].ubClassIndex ].ubCoverage ); @@ -1024,7 +1028,7 @@ INT32 ArmourPercent( SOLDIERTYPE * pSoldier ) iHelmet = 0; } - if (pSoldier->inv[LEGPOS].usItem) + if (pSoldier->inv[LEGPOS].exists() == true) { iLeg = EffectiveArmour( &(pSoldier->inv[LEGPOS]) ); iDivideValue = ( Armour[ Item[ SPECTRA_LEGGINGS_18 ].ubClassIndex ].ubProtection * Armour[ Item[ SPECTRA_LEGGINGS_18 ].ubClassIndex ].ubCoverage ); @@ -1050,29 +1054,29 @@ INT32 ArmourPercent( SOLDIERTYPE * pSoldier ) INT32 ExplosiveEffectiveArmour( OBJECTTYPE * pObj ) { INT32 iValue; - INT8 bPlate; if (pObj == NULL || Item[pObj->usItem].usItemClass != IC_ARMOUR) { return( 0 ); } iValue = Armour[ Item[pObj->usItem].ubClassIndex ].ubProtection; - iValue = iValue * pObj->ItemData.Generic.bStatus[0] * Armour[ Item[pObj->usItem].ubClassIndex ].ubCoverage / 10000; + iValue = iValue * (*pObj)[0]->data.objectStatus * Armour[ Item[pObj->usItem].ubClassIndex ].ubCoverage / 10000; if ( Item[pObj->usItem].flakjacket ) { // increase value for flak jackets! iValue *= 3; } - bPlate = FindFirstArmourAttachment( pObj ); - if ( bPlate != ITEM_NOT_FOUND ) - { - INT32 iValue2; + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if (Item[iter->usItem].usItemClass == IC_ARMOUR && (*iter)[0]->data.objectStatus > 0 ) + { + INT32 iValue2; - iValue2 = Armour[ Item[ pObj->usAttachItem[bPlate] ].ubClassIndex ].ubProtection; - iValue2 = iValue2 * pObj->bAttachStatus[ bPlate ] * Armour[ Item[ pObj->usAttachItem[bPlate] ].ubClassIndex ].ubCoverage / 10000; + iValue2 = Armour[ Item[ iter->usItem ].ubClassIndex ].ubProtection; + iValue2 *= (*iter)[0]->data.objectStatus * Armour[ Item[ iter->usItem ].ubClassIndex ].ubCoverage / 10000; - iValue += iValue2; + iValue += iValue2; + } } return( max(iValue,1) ); } @@ -1082,7 +1086,7 @@ INT8 ArmourVersusExplosivesPercent( SOLDIERTYPE * pSoldier ) // returns the % damage reduction from grenades INT32 iVest, iHelmet, iLeg; - if (pSoldier->inv[VESTPOS].usItem) + if (pSoldier->inv[VESTPOS].exists() == true) { iVest = ExplosiveEffectiveArmour( &(pSoldier->inv[VESTPOS]) ); // convert to % of best; ignoring bug-treated stuff @@ -1093,7 +1097,7 @@ INT8 ArmourVersusExplosivesPercent( SOLDIERTYPE * pSoldier ) iVest = 0; } - if (pSoldier->inv[HELMETPOS].usItem) + if (pSoldier->inv[HELMETPOS].exists() == true) { iHelmet = ExplosiveEffectiveArmour( &(pSoldier->inv[HELMETPOS]) ); // convert to % of best; ignoring bug-treated stuff @@ -1104,7 +1108,7 @@ INT8 ArmourVersusExplosivesPercent( SOLDIERTYPE * pSoldier ) iHelmet = 0; } - if (pSoldier->inv[LEGPOS].usItem) + if (pSoldier->inv[LEGPOS].exists() == true) { iLeg = ExplosiveEffectiveArmour( &(pSoldier->inv[LEGPOS]) ); // convert to % of best; ignoring bug-treated stuff @@ -1124,15 +1128,15 @@ void AdjustImpactByHitLocation( INT32 iImpact, UINT8 ubHitLocation, INT32 * piNe case AIM_SHOT_HEAD: // 1.5x damage from successful hits to the head! *piImpactForCrits = HEAD_DAMAGE_ADJUSTMENT( iImpact ); - *piNewImpact = *piImpactForCrits; + *piNewImpact = *piImpactForCrits; break; case AIM_SHOT_LEGS: // half damage for determining critical hits - // quarter actual damage + // quarter actual damage *piImpactForCrits = LEGS_DAMAGE_ADJUSTMENT( iImpact ); *piNewImpact = LEGS_DAMAGE_ADJUSTMENT( *piImpactForCrits ); break; - default: + default: *piImpactForCrits = iImpact; *piNewImpact = iImpact; break; @@ -1149,32 +1153,32 @@ BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier ) { OBJECTTYPE * pObj; INT32 iChance, iResult; - + // should jams apply to enemies? - if (pSoldier->uiStatusFlags & SOLDIER_PC) + if (pSoldier->flags.uiStatusFlags & SOLDIER_PC) { if ( Item[pSoldier->usAttackingWeapon].usItemClass == IC_GUN && !EXPLOSIVE_GUN( pSoldier->usAttackingWeapon ) ) { pObj = &(pSoldier->inv[pSoldier->ubAttackingHand]); - if (pObj->ItemData.Gun.bGunAmmoStatus > 0) + if ((*pObj)[0]->data.gun.bGunAmmoStatus > 0) { // gun might jam, figure out the chance - //iChance = (80 - pObj->bGunStatus); - + //iChance = (80 - (*pObj)[0]->data.gun.bGunStatus); + //rain - iChance = (80 - pObj->ItemData.Gun.bGunStatus) + gGameExternalOptions.ubWeaponReliabilityReductionPerRainIntensity * gbCurrentRainIntensity; + iChance = (80 - (*pObj)[0]->data.gun.bGunStatus) + gGameExternalOptions.ubWeaponReliabilityReductionPerRainIntensity * gbCurrentRainIntensity; //end rain // CJC: removed reliability from formula... - + // jams can happen to unreliable guns "earlier" than normal or reliable ones. //iChance = iChance - Item[pObj->usItem].bReliability * 2; - // decrease the chance of a jam by 20% per point of reliability; + // decrease the chance of a jam by 20% per point of reliability; // increased by 20% per negative point... //iChance = iChance * (10 - Item[pObj->usItem].bReliability * 2) / 10; - + //rain // iChance = iChance * (10 - Item[pObj->usItem].bReliability * 2) / 10; // Madd: took it back out //end rain @@ -1198,7 +1202,7 @@ BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier ) gfNextFireJam = FALSE; // jam! negate the gun ammo status. - pObj->ItemData.Gun.bGunAmmoStatus *= -1; + (*pObj)[0]->data.gun.bGunAmmoStatus *= -1; // Deduct AMMO! DeductAmmo( pSoldier, pSoldier->ubAttackingHand ); @@ -1207,14 +1211,14 @@ BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier ) return( TRUE ); } } - else if (pObj->ItemData.Gun.bGunAmmoStatus < 0) + else if ((*pObj)[0]->data.gun.bGunAmmoStatus < 0) { // try to unjam gun - iResult = SkillCheck( pSoldier, UNJAM_GUN_CHECK, (INT8) ((Item[pObj->usItem].bReliability + Item[pObj->ItemData.Gun.usGunAmmoItem].bReliability)* 4) ); + iResult = SkillCheck( pSoldier, UNJAM_GUN_CHECK, (INT8) ((Item[pObj->usItem].bReliability + Item[(*pObj)[0]->data.gun.usGunAmmoItem].bReliability)* 4) ); if (iResult > 0) { // yay! unjammed the gun - pObj->ItemData.Gun.bGunAmmoStatus *= -1; + (*pObj)[0]->data.gun.bGunAmmoStatus *= -1; // MECHANICAL/DEXTERITY GAIN: Unjammed a gun StatChange( pSoldier, MECHANAMT, 5, FALSE ); @@ -1252,7 +1256,7 @@ BOOLEAN OKFireWeapon( SOLDIERTYPE *pSoldier ) { if ( pSoldier->bTeam == gbPlayerNum ) { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[ STR_2ND_CLIP_DEPLETED ] ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[ STR_2ND_CLIP_DEPLETED ] ); return( FALSE ); } @@ -1282,7 +1286,7 @@ BOOLEAN FireWeapon( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) // If realtime and we are reloading - do not fire until counter is done! if ( ( ( gTacticalStatus.uiFlags & REALTIME ) || !( gTacticalStatus.uiFlags & INCOMBAT ) ) && !pSoldier->bDoBurst ) { - if ( pSoldier->fReloading ) + if ( pSoldier->flags.fReloading ) { return( FALSE ); } @@ -1314,41 +1318,41 @@ BOOLEAN FireWeapon( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) else { // ATE: PAtch up - bookkeeping for spreading done out of whak - if ( pSoldier->fDoSpread) + if ( pSoldier->flags.fDoSpread) { // 0verhaul: This check does not work! All auto-fire has bDoBurst turned on. And only allowing a spread // for a single-shot mode is useless. - //if (pSoldier->bDoBurst ) + //if (pSoldier->flags.fDoBurst ) //{ - // pSoldier->fDoSpread = FALSE; + // pSoldier->flags.fDoSpread = FALSE; //} //else // 0verhaul: The original code seemed brain damaged: If the current spread target was 0 it would shoot at the - // non-spread target grid # instead. Also fDoSpread is used as a counter from 1 to MAX_BURST_SPREAD_TARGETS, + // non-spread target grid # instead. Also fDoSpread is used as a counter from 1 to MAX_BURST_SPREAD_TARGETS, // but was actually reset before it got there. So the final spread target would never be shot at. Hopefully this // will work better. - if (pSoldier->fDoSpread > MAX_BURST_SPREAD_TARGETS || - pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] == 0) + if (pSoldier->flags.fDoSpread > MAX_BURST_SPREAD_TARGETS || + pSoldier->sSpreadLocations[ pSoldier->flags.fDoSpread - 1 ] == 0) { - if (pSoldier->fDoSpread == 1) + if (pSoldier->flags.fDoSpread == 1) { // If no spread locations are defined, don't spread - pSoldier->fDoSpread = 0; + pSoldier->flags.fDoSpread = 0; } else { // If we hit the end of the array, either by finding a 0 or by exceeding its size, reset - pSoldier->fDoSpread = 1; + pSoldier->flags.fDoSpread = 1; } } } - if ( pSoldier->fDoSpread ) + if ( pSoldier->flags.fDoSpread ) { - UseGun( pSoldier, pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] ); - pSoldier->fDoSpread++; + UseGun( pSoldier, pSoldier->sSpreadLocations[ pSoldier->flags.fDoSpread - 1 ] ); + pSoldier->flags.fDoSpread++; } else { @@ -1369,43 +1373,43 @@ BOOLEAN FireWeapon( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) UseGun( pSoldier, sTargetGridNo ); else // ATE: PAtch up - bookkeeping for spreading done out of whak - if ( pSoldier->fDoSpread) + if ( pSoldier->flags.fDoSpread) { if (!pSoldier->bDoBurst ) { - pSoldier->fDoSpread = FALSE; + pSoldier->flags.fDoSpread = FALSE; } // 0verhaul: The original code seemed brain damaged: If the current spread target was 0 it would shoot at the - // non-spread target grid # instead. Also fDoSpread is used as a counter from 1 to MAX_BURST_SPREAD_TARGETS, + // non-spread target grid # instead. Also fDoSpread is used as a counter from 1 to MAX_BURST_SPREAD_TARGETS, // but was actually reset before it got there. So the final spread target would never be shot at. Hopefully this // will work better. - else if ( pSoldier->fDoSpread > MAX_BURST_SPREAD_TARGETS || - pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] == 0) + else if ( pSoldier->flags.fDoSpread > MAX_BURST_SPREAD_TARGETS || + pSoldier->sSpreadLocations[ pSoldier->flags.fDoSpread - 1 ] == 0) { - if (pSoldier->fDoSpread == 1) + if (pSoldier->flags.fDoSpread == 1) { // If no spread locations are defined, don't spread - pSoldier->fDoSpread = 0; + pSoldier->flags.fDoSpread = 0; } else { // If we hit the end of the array, either by finding a 0 or by exceeding its size, reset - pSoldier->fDoSpread = 1; + pSoldier->flags.fDoSpread = 1; } } } - if ( pSoldier->fDoSpread ) + if ( pSoldier->flags.fDoSpread ) { - UseLauncher( pSoldier, pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] ); - pSoldier->fDoSpread++; + UseLauncher( pSoldier, pSoldier->sSpreadLocations[ pSoldier->flags.fDoSpread - 1 ] ); + pSoldier->flags.fDoSpread++; } else { UseLauncher( pSoldier, sTargetGridNo ); } - + break; default: @@ -1424,12 +1428,12 @@ void GetTargetWorldPositions( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, FLOAT FLOAT dTargetZ; SOLDIERTYPE *pTargetSoldier; INT8 bStructHeight; - INT16 sXMapPos, sYMapPos; + INT16 sXMapPos, sYMapPos; UINT32 uiRoll; pTargetSoldier = SimpleFindSoldier( sTargetGridNo, pSoldier->bTargetLevel ); if ( pTargetSoldier ) - { + { // SAVE OPP ID pSoldier->ubOppNum = pTargetSoldier->ubID; dTargetX = (FLOAT) CenterX( pTargetSoldier->sGridNo ); @@ -1466,7 +1470,7 @@ void GetTargetWorldPositions( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, FLOAT } switch( pSoldier->bAimShotLocation ) - { + { case AIM_SHOT_HEAD: CalculateSoldierZPos( pTargetSoldier, HEAD_TARGET_POS, &dTargetZ ); break; @@ -1500,7 +1504,7 @@ void GetTargetWorldPositions( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, FLOAT { bStructHeight = GetStructureTargetHeight( sTargetGridNo, (BOOLEAN) (pSoldier->bTargetLevel == 1) ); if (bStructHeight > 0) - { + { // fire at the centre of the cube *one below* the tallest of the tallest structure if (bStructHeight > 1) { @@ -1528,7 +1532,7 @@ void GetTargetWorldPositions( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, FLOAT BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) { UINT32 uiHitChance, uiDiceRoll; - INT16 sXMapPos, sYMapPos; + INT16 sXMapPos, sYMapPos; INT16 sAPCost; FLOAT dTargetX; FLOAT dTargetY; @@ -1546,7 +1550,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("UseGun") ); // Deduct points! - sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, FALSE, pSoldier->bAimTime ); + sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, FALSE, pSoldier->aiData.bAimTime ); usItemNum = pSoldier->usAttackingWeapon; @@ -1555,8 +1559,8 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) // ONly deduct points once if ( pSoldier->bDoBurst == 1 ) { - INT8 bShotsToFire = pSoldier->bDoAutofire ? - pSoldier->bDoAutofire : + INT8 bShotsToFire = pSoldier->bDoAutofire ? + pSoldier->bDoAutofire : GetShotsPerBurst(&pSoldier->inv[HANDPOS]); if ( Weapon[ usItemNum ].sBurstSound != NO_WEAPON_SOUND ) @@ -1569,7 +1573,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) sprintf( zBurstString, gzBurstSndStrings[ Weapon[ usItemNum ].sSilencedBurstSound ], bShotsToFire ); // Try playing sound... - pSoldier->iBurstSoundID = PlayJA2SampleFromFile( zBurstString, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + pSoldier->iBurstSoundID = PlayJA2SampleFromFile( zBurstString, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } else { @@ -1580,16 +1584,16 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) INT8 volume = HIGHVOLUME; if ( noisefactor < 100 ) volume = (INT8) ((volume * noisefactor) / 100); // Try playing sound... - pSoldier->iBurstSoundID = PlayJA2SampleFromFile( zBurstString, RATE_11025, SoundVolume( (INT8) volume, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + pSoldier->iBurstSoundID = PlayJA2SampleFromFile( zBurstString, RATE_11025, SoundVolume( (INT8) volume, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } /* //DIGICRAB: We don't need this anymore, because of the burst sound modification - // If we don't have the burst sound, a normal shot will be played for each shot + // If we don't have the burst sound, a normal shot will be played for each shot if ( pSoldier->iBurstSoundID == NO_SAMPLE ) { // If failed, play normal default.... - pSoldier->iBurstSoundID = PlayJA2Sample( Weapon[ usItemNum ].sBurstSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + pSoldier->iBurstSoundID = PlayJA2Sample( Weapon[ usItemNum ].sBurstSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } */ } @@ -1601,13 +1605,13 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) else { // ONLY DEDUCT FOR THE FIRST HAND when doing two-pistol attacks - if ( IsValidSecondHandShot( pSoldier ) && pSoldier->inv[ HANDPOS ].ItemData.Gun.bGunStatus >= USABLE && pSoldier->inv[HANDPOS].ItemData.Gun.bGunAmmoStatus > 0 ) + if ( pSoldier->IsValidSecondHandShot( ) && pSoldier->inv[ HANDPOS ][0]->data.gun.bGunStatus >= USABLE && pSoldier->inv[HANDPOS][0]->data.gun.bGunAmmoStatus > 0 ) { // only deduct APs when the main gun fires if ( pSoldier->ubAttackingHand == HANDPOS ) { DeductPoints( pSoldier, sAPCost, 0 ); - } + } } else { @@ -1634,14 +1638,14 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) // uiSound = S_SILENCER_2; //} - PlayJA2Sample( uiSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); - + PlayJA2Sample( uiSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + } else { INT8 volume = HIGHVOLUME; if ( noisefactor < 100 ) volume = (volume * noisefactor) / 100; - PlayJA2Sample( Weapon[ usItemNum ].sSound, RATE_11025, SoundVolume( volume, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( Weapon[ usItemNum ].sSound, RATE_11025, SoundVolume( volume, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } } } @@ -1650,47 +1654,51 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) // CALC CHANCE TO HIT if ( Item[ usItemNum ].usItemClass == IC_THROWING_KNIFE ) { - uiHitChance = CalcThrownChanceToHit( pSoldier, sTargetGridNo, pSoldier->bAimTime, pSoldier->bAimShotLocation ); + uiHitChance = CalcThrownChanceToHit( pSoldier, sTargetGridNo, pSoldier->aiData.bAimTime, pSoldier->bAimShotLocation ); } else { - uiHitChance = CalcChanceToHitGun( pSoldier, sTargetGridNo, pSoldier->bAimTime, pSoldier->bAimShotLocation ); + uiHitChance = CalcChanceToHitGun( pSoldier, sTargetGridNo, pSoldier->aiData.bAimTime, pSoldier->bAimShotLocation ); } //DIGICRAB: Barrel extender wear code // Relocated from CalcChanceToHitGun if ( Item[ usItemNum ].usItemClass == IC_GUN ) { - INT8 bAttachPos; - OBJECTTYPE * pInHand; - pInHand = &(pSoldier->inv[pSoldier->ubAttackingHand]); - UINT32 item; - //item = FindRangeBonusAttachment(pInHand); - //bAttachPos = FindAttachment( pInHand, item ); + OBJECTTYPE * pInHand = &(pSoldier->inv[pSoldier->ubAttackingHand]); // lalien: search for barrel extender not for any item with range bonus. (else barrel extender will fall off even when none is attached) - bAttachPos = FindAttachment( pInHand, GUN_BARREL_EXTENDER ); + OBJECTTYPE* pAttachment = FindAttachment( pInHand, GUN_BARREL_EXTENDER ); - if ( bAttachPos != ITEM_NOT_FOUND ) + if ( pAttachment ) { - item = Item[pInHand->usAttachItem[bAttachPos]].uiIndex; - // reduce status and see if it falls off - pInHand->bAttachStatus[ bAttachPos ] -= (INT8) Random( 2 ); + (*pAttachment)[0]->data.objectStatus -= (INT8) Random( 2 ); - if ( pInHand->bAttachStatus[ bAttachPos ] - Random( 35 ) - Random( 35 ) < USABLE ) + if ( (*pAttachment)[0]->data.objectStatus - Random( 35 ) - Random( 35 ) < USABLE ) { + //CHRISL: This setup assumes that remove() will work successfully, but if it doesn't we'll duplicate the item. // barrel extender falls off! - OBJECTTYPE Temp; + // drop it to ground + //AddItemToPool( pSoldier->sGridNo, pAttachment, 1, pSoldier->pathing.bLevel, 0, -1 ); // since barrel extenders are not removable we cannot call RemoveAttachment here // and must create the item by hand - CreateItem( item, pInHand->bAttachStatus[ bAttachPos ], &Temp ); - pInHand->usAttachItem[ bAttachPos ] = NOTHING; - pInHand->bAttachStatus[ bAttachPos ] = 0; + //(*pInHand)[0]->attachments.remove(*pAttachment); + //ADB ubWeight has been removed, see comments in OBJECTTYPE + //pInHand->ubWeight = CalculateObjectWeight( pInHand ); - // drop it to ground - AddItemToPool( pSoldier->sGridNo, &Temp, 1, pSoldier->bLevel, 0, -1 ); + //CHRISL: Instead of the above, use this function which is basially redundant to what remove() does, but includes + // a failsafe so we don't cause an item duplication. + for(std::list::iterator iter = (*pInHand)[0]->attachments.begin(); + iter != (*pInHand)[0]->attachments.end(); ++iter){ + if(*iter == *pAttachment) + { + AddItemToPool( pSoldier->sGridNo, pAttachment, 1, pSoldier->pathing.bLevel, 0, -1 ); + iter = (*pInHand)[0]->attachments.erase(iter); + break; + } + } // big penalty to hit if(uiHitChance < 30) @@ -1701,7 +1709,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) // curse! if ( pSoldier->bTeam == OUR_TEAM ) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 46 ], pSoldier->name ); } @@ -1746,31 +1754,31 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) pSoldier->sReloadDelay = (INT16)( Weapon[ usItemNum ].usReloadDelay + MANDATORY_WEAPON_DELAY ); // If a bad guy, double the delay! - if ( (pSoldier->uiStatusFlags & SOLDIER_ENEMY ) ) + if ( (pSoldier->flags.uiStatusFlags & SOLDIER_ENEMY ) ) { pSoldier->sReloadDelay = ( pSoldier->sReloadDelay * 2 ); } - + // slow down demo mode! if ( gTacticalStatus.uiFlags & DEMOMODE ) { pSoldier->sReloadDelay *= 2; } - //pSoldier->fReloading = TRUE; - //RESETTIMECOUNTER( pSoldier->ReloadCounter, pSoldier->sReloadDelay ); + //pSoldier->flags.fReloading = TRUE; + //RESETTIMECOUNTER( pSoldier->timeCounters.ReloadCounter, pSoldier->sReloadDelay ); } // Deduct AMMO! DeductAmmo( pSoldier, pSoldier->ubAttackingHand ); // ATE: Check if we should say quote... - if ( pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft == 0 && !Item[pSoldier->usAttackingWeapon].rocketlauncher ) + if ( pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.gun.ubGunShotsLeft == 0 && !Item[pSoldier->usAttackingWeapon].rocketlauncher ) { if ( pSoldier->bTeam == gbPlayerNum ) { - pSoldier->fSayAmmoQuotePending = TRUE; + pSoldier->flags.fSayAmmoQuotePending = TRUE; } } @@ -1783,11 +1791,11 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) // grant extra exp for hitting a difficult target usExpGain += (UINT8) (100 - uiHitChance) / 25; - if ( pSoldier->bAimTime && !pSoldier->bDoBurst ) + if ( pSoldier->aiData.bAimTime && !pSoldier->bDoBurst ) { - // gain extra exp for aiming, up to the amount from + // gain extra exp for aiming, up to the amount from // the difficulty of the shot - usExpGain += __min( pSoldier->bAimTime, usExpGain ); + usExpGain += __min( pSoldier->aiData.bAimTime, usExpGain ); } // base pts extra for hitting @@ -1797,7 +1805,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) // add base pts for taking a shot, whether it hits or misses usExpGain += 3; - if ( IsValidSecondHandShot( pSoldier ) && pSoldier->inv[ HANDPOS ].ItemData.Gun.bGunStatus >= USABLE && pSoldier->inv[HANDPOS].ItemData.Gun.bGunAmmoStatus > 0 ) + if ( pSoldier->IsValidSecondHandShot( ) && pSoldier->inv[ HANDPOS ][0]->data.gun.bGunStatus >= USABLE && pSoldier->inv[HANDPOS][0]->data.gun.bGunAmmoStatus > 0 ) { // reduce exp gain for two pistol shooting since both shots give xp usExpGain = (usExpGain * 2) / 3; @@ -1807,14 +1815,14 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) { usExpGain /= 2; } - else if ( MercPtrs[ pSoldier->ubTargetID ]->uiStatusFlags & SOLDIER_VEHICLE || AM_A_ROBOT( MercPtrs[ pSoldier->ubTargetID ] ) || TANK( MercPtrs[ pSoldier->ubTargetID ] ) ) + else if ( MercPtrs[ pSoldier->ubTargetID ]->flags.uiStatusFlags & SOLDIER_VEHICLE || AM_A_ROBOT( MercPtrs[ pSoldier->ubTargetID ] ) || TANK( MercPtrs[ pSoldier->ubTargetID ] ) ) { - // no exp from shooting a vehicle that you can't damage and can't move! + // no exp from shooting a vehicle that you can't damage and can't move! usExpGain = 0; } // MARKSMANSHIP GAIN: gun attack - StatChange( pSoldier, MARKAMT, usExpGain, ( UINT8 )( fGonnaHit ? FALSE : FROM_FAILURE ) ); + StatChange( pSoldier, MARKAMT, usExpGain, ( UINT8 )( fGonnaHit ? FALSE : FROM_FAILURE ) ); } // set buckshot and muzzle flash @@ -1822,22 +1830,22 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) if (!CREATURE_OR_BLOODCAT( pSoldier ) ) { if ( IsFlashSuppressor(&pSoldier->inv[ pSoldier->ubAttackingHand ], pSoldier ) ) - pSoldier->fMuzzleFlash = FALSE; + pSoldier->flags.fMuzzleFlash = FALSE; else - pSoldier->fMuzzleFlash = TRUE; + pSoldier->flags.fMuzzleFlash = TRUE; - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("UseGun: Muzzle flash = %d",pSoldier->fMuzzleFlash)); + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("UseGun: Muzzle flash = %d",pSoldier->flags.fMuzzleFlash)); - if ( AmmoTypes[pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].numberOfBullets > 1 ) + if ( AmmoTypes[pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.gun.ubGunAmmoType].numberOfBullets > 1 ) fBuckshot = TRUE; - //switch ( pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunAmmoType ) + //switch ( pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.gun.ubGunAmmoType ) //{ // case AMMO_BUCKSHOT: // fBuckshot = TRUE; // break; // case AMMO_SLEEP_DART: - // pSoldier->fMuzzleFlash = FALSE; + // pSoldier->flags.fMuzzleFlash = FALSE; // break; // default: // break; @@ -1847,7 +1855,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) else // throwing knife { fBuckshot = FALSE; - pSoldier->fMuzzleFlash = FALSE; + pSoldier->flags.fMuzzleFlash = FALSE; // Deduct knife from inv! (not here, later?) @@ -1859,11 +1867,11 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) // grant extra exp for hitting a difficult target usExpGain += (UINT8) (100 - uiHitChance) / 10; - if (pSoldier->bAimTime) + if (pSoldier->aiData.bAimTime) { - // gain extra exp for aiming, up to the amount from + // gain extra exp for aiming, up to the amount from // the difficulty of the throw - usExpGain += ( 2 * __min( pSoldier->bAimTime, usExpGain ) ); + usExpGain += ( 2 * __min( pSoldier->aiData.bAimTime, usExpGain ) ); } // base pts extra for hitting @@ -1877,15 +1885,15 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) { usExpGain /= 2; } - else if ( MercPtrs[ pSoldier->ubTargetID ]->uiStatusFlags & SOLDIER_VEHICLE || AM_A_ROBOT( MercPtrs[ pSoldier->ubTargetID ] ) || TANK( MercPtrs[ pSoldier->ubTargetID ] ) ) + else if ( MercPtrs[ pSoldier->ubTargetID ]->flags.uiStatusFlags & SOLDIER_VEHICLE || AM_A_ROBOT( MercPtrs[ pSoldier->ubTargetID ] ) || TANK( MercPtrs[ pSoldier->ubTargetID ] ) ) { - // no exp from shooting a vehicle that you can't damage and can't move! + // no exp from shooting a vehicle that you can't damage and can't move! usExpGain = 0; } // MARKSMANSHIP/DEXTERITY GAIN: throwing knife attack - StatChange( pSoldier, MARKAMT, ( UINT16 )( usExpGain / 2 ), ( UINT8 )( fGonnaHit ? FALSE : FROM_FAILURE ) ); - StatChange( pSoldier, DEXTAMT, ( UINT16 )( usExpGain / 2 ), ( UINT8 )( fGonnaHit ? FALSE : FROM_FAILURE ) ); + StatChange( pSoldier, MARKAMT, ( UINT16 )( usExpGain / 2 ), ( UINT8 )( fGonnaHit ? FALSE : FROM_FAILURE ) ); + StatChange( pSoldier, DEXTAMT, ( UINT16 )( usExpGain / 2 ), ( UINT8 )( fGonnaHit ? FALSE : FROM_FAILURE ) ); } } @@ -1895,19 +1903,19 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) { if ( Item[usItemNum].singleshotrocketlauncher ) { - CreateItem( Item[usItemNum].discardedlauncheritem , pSoldier->inv[ HANDPOS ].ItemData.Generic.bStatus[ 0 ],&(pSoldier->inv[ HANDPOS ] ) ); + CreateItem( Item[usItemNum].discardedlauncheritem , pSoldier->inv[ HANDPOS ][0]->data.objectStatus,&(pSoldier->inv[ HANDPOS ] ) ); DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); - IgniteExplosion( pSoldier->ubID, (INT16)CenterX( pSoldier->sGridNo ), (INT16)CenterY( pSoldier->sGridNo ), 0, pSoldier->sGridNo, C1, pSoldier->bLevel ); + IgniteExplosion( pSoldier->ubID, (INT16)CenterX( pSoldier->sGridNo ), (INT16)CenterY( pSoldier->sGridNo ), 0, pSoldier->sGridNo, C1, pSoldier->pathing.bLevel ); } else { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("StructureHit: RPG7 item: %d, Ammo: %d",pSoldier->inv[HANDPOS].usItem , pSoldier->inv[HANDPOS].usGunAmmoItem ) ); - - IgniteExplosion( pSoldier->ubID, (INT16)CenterX( pSoldier->sGridNo ), (INT16)CenterY( pSoldier->sGridNo ), 0, pSoldier->sGridNo, pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.usGunAmmoItem, pSoldier->bLevel ); - pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.usGunAmmoItem = NONE; + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("StructureHit: RPG7 item: %d, Ammo: %d",pSoldier->inv[HANDPOS].usItem , pSoldier->inv[HANDPOS][0]->data.gun.usGunAmmoItem ) ); + + IgniteExplosion( pSoldier->ubID, (INT16)CenterX( pSoldier->sGridNo ), (INT16)CenterY( pSoldier->sGridNo ), 0, pSoldier->sGridNo, pSoldier->inv[pSoldier->ubAttackingHand ][0]->data.gun.usGunAmmoItem, pSoldier->pathing.bLevel ); + pSoldier->inv[pSoldier->ubAttackingHand ][0]->data.gun.usGunAmmoItem = NONE; } // Reduce again for attack end 'cause it has been incremented for a normal attack - // + // // Not anymore. Only the attack animation was increased, and it will decrease itself. DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - ATTACK ANIMATION %s ENDED BY BAD EXPLOSIVE CHECK, Now %d", gAnimControl[ pSoldier->usAnimState ].zAnimStr, gTacticalStatus.ubAttackBusyCount ) ); DebugAttackBusy( String("@@@@@@@ Freeing up attacker - ATTACK ANIMATION %s ENDED BY BAD EXPLOSIVE CHECK\n", gAnimControl[ pSoldier->usAnimState ].zAnimStr ) ); @@ -1924,24 +1932,24 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) if ( Item[ usItemNum ].usItemClass == IC_THROWING_KNIFE ) { - // Here, remove the knife... or (for now) rocket launcher - RemoveObjs( &(pSoldier->inv[ HANDPOS ] ), 1 ); + // Here, remove the knife... or (for now) rocket launcher + pSoldier->inv[ HANDPOS ].RemoveObjectsFromStack(1); DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); } - else if ( Item[usItemNum].rocketlauncher ) + else if ( Item[usItemNum].rocketlauncher ) { if ( Item[usItemNum].singleshotrocketlauncher ) { - CreateItem( Item[usItemNum].discardedlauncheritem, pSoldier->inv[ HANDPOS ].ItemData.Generic.bStatus[ 0 ], &(pSoldier->inv[ HANDPOS ] ) ); + CreateItem( Item[usItemNum].discardedlauncheritem, pSoldier->inv[ HANDPOS ][0]->data.objectStatus, &(pSoldier->inv[ HANDPOS ] ) ); DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); } // Direction to center of explosion ubDirection = gOppositeDirection[ pSoldier->ubDirection ]; - sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)(1 * DirectionInc( ubDirection ) ) ); + sNewGridNo = NewGridNo( (INT16)pSoldier->sGridNo, (UINT16)(1 * DirectionInc( ubDirection ) ) ); // Check if a person exists here and is not prone.... - ubMerc = WhoIsThere2( sNewGridNo, pSoldier->bLevel ); + ubMerc = WhoIsThere2( sNewGridNo, pSoldier->pathing.bLevel ); if ( ubMerc != NOBODY ) { @@ -1952,7 +1960,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Incrementing Attack: Exaust from LAW", gTacticalStatus.ubAttackBusyCount ) ); DebugAttackBusy( "Incrementing Attack: Exaust from LAW\n" ); - EVENT_SoldierGotHit( MercPtrs[ ubMerc ], MINI_GRENADE, 10, 200, pSoldier->ubDirection, 0, pSoldier->ubID, 0, ANIM_CROUCH, 0, sNewGridNo ); + MercPtrs[ ubMerc ]->EVENT_SoldierGotHit( MINI_GRENADE, 10, 200, pSoldier->ubDirection, 0, pSoldier->ubID, 0, ANIM_CROUCH, 0, sNewGridNo ); } } } @@ -1970,7 +1978,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) } } - MakeNoise( pSoldier->ubID, pSoldier->sGridNo, pSoldier->bLevel, pSoldier->bOverTerrainType, ubVolume, NOISE_GUNFIRE ); + MakeNoise( pSoldier->ubID, pSoldier->sGridNo, pSoldier->pathing.bLevel, pSoldier->bOverTerrainType, ubVolume, NOISE_GUNFIRE ); if ( pSoldier->bDoBurst ) { @@ -1984,25 +1992,25 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) if ( Item[usItemNum].usItemClass == IC_GUN ) { OBJECTTYPE *pGun = &(pSoldier->inv[pSoldier->ubAttackingHand]); - ammoReliability = Item[pGun->ItemData.Gun.usGunAmmoItem].bReliability; + ammoReliability = Item[(*pGun)[0]->data.gun.usGunAmmoItem].bReliability; } uiDepreciateTest = BASIC_DEPRECIATE_CHANCE + 3 * (Item[ usItemNum ].bReliability + ammoReliability); - if ( !PreRandom( uiDepreciateTest ) && ( pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Generic.bStatus[0] > 1) ) + if ( !PreRandom( uiDepreciateTest ) && ( pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.objectStatus > 1) ) { - pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Generic.bStatus[ 0 ]--; + pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.objectStatus--; } // reduce monster smell (gunpowder smell) - if ( pSoldier->bMonsterSmell > 0 && Random( 2 ) == 0 ) + if ( pSoldier->aiData.bMonsterSmell > 0 && Random( 2 ) == 0 ) { - pSoldier->bMonsterSmell--; + pSoldier->aiData.bMonsterSmell--; } // manual recharge if (Weapon[Item[usItemNum].ubClassIndex].APsToReloadManually > 0) - pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunState &= ~GS_CARTRIDGE_IN_CHAMBER; + pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.gun.ubGunState &= ~GS_CARTRIDGE_IN_CHAMBER; // DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("UseGun: done")); return( TRUE ); @@ -2012,7 +2020,7 @@ BOOLEAN UseBlade( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) { SOLDIERTYPE * pTargetSoldier; INT32 iHitChance, iDiceRoll; - INT16 sXMapPos, sYMapPos; + INT16 sXMapPos, sYMapPos; INT16 sAPCost; EV_S_WEAPONHIT SWeaponHit; INT32 iImpact, iImpactForCrits; @@ -2020,35 +2028,35 @@ BOOLEAN UseBlade( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) UINT16 usExpGain = 0; INT8 bMaxDrop; BOOLEAN fSurpriseAttack; - + // Deduct points! - sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, FALSE, pSoldier->bAimTime ); + sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, FALSE, pSoldier->aiData.bAimTime ); DeductPoints( pSoldier, sAPCost, 0 ); - + // GET TARGET XY VALUES ConvertGridNoToCenterCellXY( sTargetGridNo, &sXMapPos, &sYMapPos ); // See if a guy is here! pTargetSoldier = SimpleFindSoldier( sTargetGridNo, pSoldier->bTargetLevel ); if ( pTargetSoldier ) - { + { // set target as noticed attack - pSoldier->uiStatusFlags |= SOLDIER_ATTACK_NOTICED; - pTargetSoldier->fIntendedTarget = TRUE; + pSoldier->flags.uiStatusFlags |= SOLDIER_ATTACK_NOTICED; + pTargetSoldier->flags.fIntendedTarget = TRUE; // SAVE OPP ID pSoldier->ubOppNum = pTargetSoldier->ubID; // CHECK IF BUDDY KNOWS ABOUT US - if ( pTargetSoldier->bOppList[ pSoldier->ubID ] == NOT_HEARD_OR_SEEN || pTargetSoldier->bLife < OKLIFE || pTargetSoldier->bCollapsed ) + if ( pTargetSoldier->aiData.bOppList[ pSoldier->ubID ] == NOT_HEARD_OR_SEEN || pTargetSoldier->stats.bLife < OKLIFE || pTargetSoldier->bCollapsed ) { iHitChance = 100; fSurpriseAttack = TRUE; } else { - iHitChance = CalcChanceToStab( pSoldier, pTargetSoldier, pSoldier->bAimTime ); + iHitChance = CalcChanceToStab( pSoldier, pTargetSoldier, pSoldier->aiData.bAimTime ); fSurpriseAttack = FALSE; } @@ -2066,13 +2074,13 @@ BOOLEAN UseBlade( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) iImpact = HTHImpact( pSoldier, pTargetSoldier, (iHitChance - iDiceRoll), TRUE ); // modify this by the knife's condition (if it's dull, not much good) - iImpact = ( iImpact * WEAPON_STATUS_MOD(pSoldier->inv[pSoldier->ubAttackingHand].ItemData.Generic.bStatus[0]) ) / 100; + iImpact = ( iImpact * WEAPON_STATUS_MOD(pSoldier->inv[pSoldier->ubAttackingHand][0]->data.objectStatus) ) / 100; // modify by hit location AdjustImpactByHitLocation( iImpact, pSoldier->bAimShotLocation, &iImpact, &iImpactForCrits ); // bonus for surprise - if ( fSurpriseAttack ) + if ( fSurpriseAttack ) { iImpact = (iImpact * 3) / 2; } @@ -2083,17 +2091,17 @@ BOOLEAN UseBlade( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) iImpact = 1; } - if ( pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Generic.bStatus[ 0 ] > USABLE ) + if ( pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.objectStatus > USABLE ) { bMaxDrop = (iImpact / 20); // the duller they get, the slower they get any worse... - bMaxDrop = __min( bMaxDrop, pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Generic.bStatus[ 0 ] / 10 ); + bMaxDrop = __min( bMaxDrop, pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.objectStatus / 10 ); // as long as its still > USABLE, it drops another point 1/2 the time bMaxDrop = __max( bMaxDrop, 2 ); - pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Generic.bStatus[ 0 ] -= (INT8) Random( bMaxDrop ); // 0 to (maxDrop - 1) + pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.objectStatus -= (INT8) Random( bMaxDrop ); // 0 to (maxDrop - 1) } // Send event for getting hit @@ -2102,7 +2110,7 @@ BOOLEAN UseBlade( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) SWeaponHit.uiUniqueId = pTargetSoldier->uiUniqueSoldierIdValue; SWeaponHit.usWeaponIndex = pSoldier->usAttackingWeapon; SWeaponHit.sDamage = (INT16) iImpact; - SWeaponHit.usDirection = GetDirectionFromGridNo( pSoldier->sGridNo, pTargetSoldier ); + SWeaponHit.usDirection = (UINT8)GetDirectionFromGridNo( pSoldier->sGridNo, pTargetSoldier ); SWeaponHit.sXPos = (INT16)pTargetSoldier->dXPos; SWeaponHit.sYPos = (INT16)pTargetSoldier->dYPos; SWeaponHit.sZPos = 20; @@ -2110,7 +2118,7 @@ BOOLEAN UseBlade( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) SWeaponHit.ubAttackerID = pSoldier->ubID; SWeaponHit.fHit = TRUE; SWeaponHit.ubSpecial = FIRE_WEAPON_NO_SPECIAL; - AddGameEvent( S_WEAPONHIT, (UINT16) 20, &SWeaponHit ); + AddGameEvent( S_WEAPONHIT, (UINT16) 20, &SWeaponHit ); } else { @@ -2130,7 +2138,7 @@ BOOLEAN UseBlade( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) // DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - missed in knife attack") ); // FreeUpAttacker( (UINT8) pSoldier->ubID ); } - + if ( PTR_OURTEAM && pSoldier->ubTargetID != NOBODY) { if ( fGonnaHit ) @@ -2138,11 +2146,11 @@ BOOLEAN UseBlade( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) // grant extra exp for hitting a difficult target usExpGain += (UINT8) (100 - iHitChance) / 10; - if (pSoldier->bAimTime) + if (pSoldier->aiData.bAimTime) { - // gain extra exp for aiming, up to the amount from + // gain extra exp for aiming, up to the amount from // the difficulty of the attack - usExpGain += ( 2 * __min( pSoldier->bAimTime, usExpGain ) ); + usExpGain += ( 2 * __min( pSoldier->aiData.bAimTime, usExpGain ) ); } // base pts extra for hitting @@ -2151,21 +2159,21 @@ BOOLEAN UseBlade( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) // add base pts for taking a shot, whether it hits or misses usExpGain += 10; - + if ( MercPtrs[ pSoldier->ubTargetID ]->ubBodyType == COW || MercPtrs[ pSoldier->ubTargetID ]->ubBodyType == CROW ) { usExpGain /= 2; } - else if ( MercPtrs[ pSoldier->ubTargetID ]->uiStatusFlags & SOLDIER_VEHICLE || AM_A_ROBOT( MercPtrs[ pSoldier->ubTargetID ] ) || TANK( MercPtrs[ pSoldier->ubTargetID ] ) ) + else if ( MercPtrs[ pSoldier->ubTargetID ]->flags.uiStatusFlags & SOLDIER_VEHICLE || AM_A_ROBOT( MercPtrs[ pSoldier->ubTargetID ] ) || TANK( MercPtrs[ pSoldier->ubTargetID ] ) ) { - // no exp from shooting a vehicle that you can't damage and can't move! + // no exp from shooting a vehicle that you can't damage and can't move! usExpGain = 0; } // DEXTERITY GAIN: Made a knife attack, successful or not - StatChange( pSoldier, DEXTAMT, usExpGain, ( UINT8 )( fGonnaHit ? FALSE : FROM_FAILURE ) ); - StatChange( pSoldier, AGILAMT, usExpGain/3, ( UINT8 )( fGonnaHit ? FALSE : FROM_FAILURE ) ); - StatChange( pSoldier, STRAMT, usExpGain/3, ( UINT8 )( fGonnaHit ? FALSE : FROM_FAILURE ) ); + StatChange( pSoldier, DEXTAMT, usExpGain, ( UINT8 )( fGonnaHit ? FALSE : FROM_FAILURE ) ); + StatChange( pSoldier, AGILAMT, usExpGain/3, ( UINT8 )( fGonnaHit ? FALSE : FROM_FAILURE ) ); + StatChange( pSoldier, STRAMT, usExpGain/3, ( UINT8 )( fGonnaHit ? FALSE : FROM_FAILURE ) ); } } // 0verhaul: This case is also handled by the animation translations @@ -2176,9 +2184,9 @@ BOOLEAN UseBlade( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) // } // possibly reduce monster smell - if ( pSoldier->bMonsterSmell > 0 && Random( 5 ) == 0 ) + if ( pSoldier->aiData.bMonsterSmell > 0 && Random( 5 ) == 0 ) { - pSoldier->bMonsterSmell--; + pSoldier->aiData.bMonsterSmell--; } @@ -2190,7 +2198,7 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea { SOLDIERTYPE * pTargetSoldier; INT32 iHitChance, iDiceRoll; - INT16 sXMapPos, sYMapPos; + INT16 sXMapPos, sYMapPos; INT16 sAPCost; EV_S_WEAPONHIT SWeaponHit; INT32 iImpact; @@ -2207,7 +2215,7 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea // Punch the enemy if (!fStealing) { - sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, FALSE, pSoldier->bAimTime ); + sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, FALSE, pSoldier->aiData.bAimTime ); DeductPoints( pSoldier, sAPCost, 0 ); } // Steal from the enemy @@ -2215,14 +2223,14 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea { // APs were already reduced! } - + // See if a guy is here! pTargetSoldier = SimpleFindSoldier( sTargetGridNo, pSoldier->bTargetLevel ); if ( pTargetSoldier ) - { + { // set target as noticed attack - pSoldier->uiStatusFlags |= SOLDIER_ATTACK_NOTICED; - pTargetSoldier->fIntendedTarget = TRUE; + pSoldier->flags.uiStatusFlags |= SOLDIER_ATTACK_NOTICED; + pTargetSoldier->flags.fIntendedTarget = TRUE; // SAVE OPP ID pSoldier->ubOppNum = pTargetSoldier->ubID; @@ -2234,30 +2242,30 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea { iHitChance = 0; } - else if ( pTargetSoldier->bOppList[ pSoldier->ubID ] == NOT_HEARD_OR_SEEN ) + else if ( pTargetSoldier->aiData.bOppList[ pSoldier->ubID ] == NOT_HEARD_OR_SEEN ) { // give bonus for surprise, but not so much as struggle would still occur - iHitChance = CalcChanceToSteal( pSoldier, pTargetSoldier, pSoldier->bAimTime ) + 20; + iHitChance = CalcChanceToSteal( pSoldier, pTargetSoldier, pSoldier->aiData.bAimTime ) + 20; } - else if ( pTargetSoldier->bLife < OKLIFE || pTargetSoldier->bCollapsed ) + else if ( pTargetSoldier->stats.bLife < OKLIFE || pTargetSoldier->bCollapsed ) { iHitChance = 100; fSoldierCollapsed = TRUE; } else { - iHitChance = CalcChanceToSteal( pSoldier, pTargetSoldier, pSoldier->bAimTime ); + iHitChance = CalcChanceToSteal( pSoldier, pTargetSoldier, pSoldier->aiData.bAimTime ); } } else { - if ( pTargetSoldier->bOppList[ pSoldier->ubID ] == NOT_HEARD_OR_SEEN || pTargetSoldier->bLife < OKLIFE || pTargetSoldier->bCollapsed ) + if ( pTargetSoldier->aiData.bOppList[ pSoldier->ubID ] == NOT_HEARD_OR_SEEN || pTargetSoldier->stats.bLife < OKLIFE || pTargetSoldier->bCollapsed ) { iHitChance = 100; } else { - iHitChance = CalcChanceToPunch( pSoldier, pTargetSoldier, pSoldier->bAimTime ); + iHitChance = CalcChanceToPunch( pSoldier, pTargetSoldier, pSoldier->aiData.bAimTime ); } } @@ -2297,21 +2305,22 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea if ( sNumStolenItems == 1) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[ STR_STOLE_SOMETHING ], pSoldier->name, ShortItemNames[ pTargetSoldier->inv[ubIndexRet].usItem ] ); - - // Try to place the item in the merc inventory - if (!AutoPlaceObject( pSoldier, &(pTargetSoldier->inv[ubIndexRet]), TRUE )) - { - // Place the item on the ground - AddItemToPool( pSoldier->sGridNo, &(pTargetSoldier->inv[HANDPOS]), 1, pSoldier->bLevel, 0, -1 ); + if (pTargetSoldier->inv[ubIndexRet].MoveThisObjectTo(gTempObject, 1) == 0) { + + // Try to place the item in the merc inventory + if (!AutoPlaceObject( pSoldier, &gTempObject, TRUE )) + { + // Place the item on the ground + AddItemToPool( pSoldier->sGridNo, &gTempObject, 1, pSoldier->pathing.bLevel, 0, -1 ); + } } - DeleteObj( &(pTargetSoldier->inv[ubIndexRet]) ); // The item that the enemy holds in his hand before the stealing usNewItem = pTargetSoldier->inv[HANDPOS].usItem; if (usOldItem != usNewItem) - { - ReLoadSoldierAnimationDueToHandItemChange(pTargetSoldier, usOldItem, usNewItem ); + { + pTargetSoldier->ReLoadSoldierAnimationDueToHandItemChange( usOldItem, usNewItem ); } } // The enemy has no more items to steal @@ -2321,30 +2330,31 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea } } // We had not much luck, so we can only steal 1 item. - else if ( pTargetSoldier->inv[HANDPOS].usItem != NOTHING ) + else if ( pTargetSoldier->inv[HANDPOS].exists() == true ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[ STR_STOLE_SOMETHING ], pSoldier->name, ShortItemNames[ pTargetSoldier->inv[HANDPOS].usItem ] ); usOldItem = pTargetSoldier->inv[HANDPOS].usItem; if ( pSoldier->bTeam == gbPlayerNum ) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); } // Item dropped somewhere... roll based on the same chance to determine where! - iDiceRoll = (INT32) PreRandom( 100 ); - if (iDiceRoll < iHitChance) - { - // Drop item in the our tile - AddItemToPool( pSoldier->sGridNo, &(pTargetSoldier->inv[HANDPOS]), 1, pSoldier->bLevel, 0, -1 ); + if (pTargetSoldier->inv[HANDPOS].MoveThisObjectTo(gTempObject, 1) == 0) { + iDiceRoll = (INT32) PreRandom( 100 ); + if (iDiceRoll < iHitChance) + { + // Drop item in the our tile + AddItemToPool( pSoldier->sGridNo, &gTempObject, 1, pSoldier->pathing.bLevel, 0, -1 ); + } + else + { + // Drop item in the target's tile + AddItemToPool( pTargetSoldier->sGridNo, &gTempObject, 1, pSoldier->pathing.bLevel, 0, -1 ); + } } - else - { - // Drop item in the target's tile - AddItemToPool( pTargetSoldier->sGridNo, &(pTargetSoldier->inv[HANDPOS]), 1, pSoldier->bLevel, 0, -1 ); - } - DeleteObj( &(pTargetSoldier->inv[HANDPOS]) ); // Reload buddy's animation... - ReLoadSoldierAnimationDueToHandItemChange( pTargetSoldier, usOldItem, NOTHING ); + pTargetSoldier->ReLoadSoldierAnimationDueToHandItemChange( usOldItem, NOTHING ); } // Enemy has no item in his hand. else @@ -2352,7 +2362,7 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea fNoMoreItemInHand = TRUE; } // Reload buddy's animation... - //ReLoadSoldierAnimationDueToHandItemChange( pTargetSoldier, usOldItem, NOTHING ); + //pTargetSoldier->ReLoadSoldierAnimationDueToHandItemChange( usOldItem, NOTHING ); } // We could not steal from the enemy, we had no luck else @@ -2364,39 +2374,39 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea if (fFailure) { // Only report if it was not the Nada item! - if (pTargetSoldier->inv[HANDPOS].usItem != NOTHING) + if (pTargetSoldier->inv[HANDPOS].exists() == true) { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, - Message[ STR_FAILED_TO_STEAL_SOMETHING ], + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, + Message[ STR_FAILED_TO_STEAL_SOMETHING ], pSoldier->name, ShortItemNames[ pTargetSoldier->inv[HANDPOS].usItem ] ); - + if ( pSoldier->bTeam == gbPlayerNum ) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); } } else { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, - Message[ STR_NO_MORE_ITEM_IN_HAND ]); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, + Message[ STR_NO_MORE_ITEM_IN_HAND ]); } } // Enemy had no item in its hand else if (fNoMoreItemInHand == TRUE) { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, - Message[ STR_NO_MORE_ITEM_IN_HAND ]); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, + Message[ STR_NO_MORE_ITEM_IN_HAND ]); } // The enemy has no more items to steal else if (fNoMoreItems == TRUE) { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, - Message[ STR_NO_MORE_ITEMS_TO_STEAL ]); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, + Message[ STR_NO_MORE_ITEMS_TO_STEAL ]); } // Give some experience - if ( iHitChance > 0 && pSoldier->bTeam == gbPlayerNum && pTargetSoldier->bTeam != gbPlayerNum && !(pTargetSoldier->uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( pTargetSoldier ) && !TANK( pTargetSoldier ) ) + if ( iHitChance > 0 && pSoldier->bTeam == gbPlayerNum && pTargetSoldier->bTeam != gbPlayerNum && !(pTargetSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( pTargetSoldier ) && !TANK( pTargetSoldier ) ) { if (fFailure == FALSE) { @@ -2434,13 +2444,13 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea } if ( pSoldier->bTeam == gbPlayerNum && pTargetSoldier->bTeam != gbPlayerNum ) - { + { // made an HTH attack; give experience if ( iDiceRoll <= iHitChance ) { ubExpGain = 8; - if ( pTargetSoldier->uiStatusFlags & SOLDIER_VEHICLE || AM_A_ROBOT( pTargetSoldier ) || TANK( pTargetSoldier ) ) + if ( pTargetSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE || AM_A_ROBOT( pTargetSoldier ) || TANK( pTargetSoldier ) ) { ubExpGain = 0; } @@ -2448,7 +2458,7 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea { ubExpGain /= 2; } - + StatChange( pSoldier, DEXTAMT, ubExpGain, FALSE ); StatChange( pSoldier, STRAMT, (ubExpGain+1)/3, FALSE ); @@ -2458,7 +2468,7 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea { ubExpGain = 4; - if ( pTargetSoldier->uiStatusFlags & SOLDIER_VEHICLE || AM_A_ROBOT( pTargetSoldier ) || TANK( pTargetSoldier ) ) + if ( pTargetSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE || AM_A_ROBOT( pTargetSoldier ) || TANK( pTargetSoldier ) ) { ubExpGain = 0; } @@ -2494,7 +2504,7 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea SWeaponHit.usSoldierID = pTargetSoldier->ubID; SWeaponHit.usWeaponIndex = pSoldier->usAttackingWeapon; SWeaponHit.sDamage = (INT16) iImpact; - SWeaponHit.usDirection = GetDirectionFromGridNo( pSoldier->sGridNo, pTargetSoldier ); + SWeaponHit.usDirection = (UINT8)GetDirectionFromGridNo( pSoldier->sGridNo, pTargetSoldier ); SWeaponHit.sXPos = (INT16)pTargetSoldier->dXPos; SWeaponHit.sYPos = (INT16)pTargetSoldier->dYPos; SWeaponHit.sZPos = 20; @@ -2502,7 +2512,7 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea SWeaponHit.ubAttackerID = pSoldier->ubID; SWeaponHit.fHit = TRUE; SWeaponHit.ubSpecial = FIRE_WEAPON_NO_SPECIAL; - AddGameEvent( S_WEAPONHIT, (UINT16) 20, &SWeaponHit ); + AddGameEvent( S_WEAPONHIT, (UINT16) 20, &SWeaponHit ); } // 0verhaul: And this too // else @@ -2514,9 +2524,9 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea } // possibly reduce monster smell (gunpowder smell) - if ( pSoldier->bMonsterSmell > 0 && Random( 5 ) == 0 ) + if ( pSoldier->aiData.bMonsterSmell > 0 && Random( 5 ) == 0 ) { - pSoldier->bMonsterSmell--; + pSoldier->aiData.bMonsterSmell--; } @@ -2531,7 +2541,7 @@ BOOLEAN UseThrown( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ) SOLDIERTYPE * pTargetSoldier; INT16 sAPCost = 0; - uiHitChance = CalcThrownChanceToHit( pSoldier, sTargetGridNo, pSoldier->bAimTime, AIM_SHOT_TORSO ); + uiHitChance = CalcThrownChanceToHit( pSoldier, sTargetGridNo, pSoldier->aiData.bAimTime, AIM_SHOT_TORSO ); uiDiceRoll = PreRandom( 100 ); @@ -2554,7 +2564,7 @@ BOOLEAN UseThrown( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ) { pTargetSoldier = MercPtrs[ ubTargetID ]; } - + if ( pTargetSoldier && pTargetSoldier->bTeam == pSoldier->bTeam ) { // ignore! @@ -2617,10 +2627,10 @@ BOOLEAN UseThrown( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ) } } - + CalculateLaunchItemParamsForThrow( pSoldier, sTargetGridNo, pSoldier->bTargetLevel, (INT16)(pSoldier->bTargetLevel * 256 ), &(pSoldier->inv[ HANDPOS ] ), (INT8)(uiDiceRoll - uiHitChance), THROW_ARM_ITEM, 0 ); - //AXP 25.03.2007: Cleaned up throwing AP costs. Now only turning + stance change AP + //AXP 25.03.2007: Cleaned up throwing AP costs. Now only turning + stance change AP // costs are deducted. Final throw cost is deducted on creating the grenade object if ( (UINT8)GetDirectionFromGridNo( sTargetGridNo, pSoldier ) != pSoldier->ubDirection ) sAPCost += (INT16)GetAPsToLook( pSoldier ); @@ -2628,12 +2638,12 @@ BOOLEAN UseThrown( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ) HandleSoldierThrowItem( pSoldier, pSoldier->sTargetGridNo ); DeductPoints( pSoldier, sAPCost, 0 ); - RemoveObjs( &(pSoldier->inv[ HANDPOS ] ), 1 ); - + pSoldier->inv[ HANDPOS ].RemoveObjectsFromStack(1); + /* // Madd: Next 2 lines added: Deduct points! - sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, FALSE, pSoldier->bAimTime ); + sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, FALSE, pSoldier->aiData.bAimTime ); // Kaiden: Deducting points too early, moving the line down //DeductPoints( pSoldier, sAPCost, 0 ); @@ -2651,7 +2661,6 @@ BOOLEAN UseLauncher( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ) { UINT32 uiHitChance, uiDiceRoll; INT16 sAPCost = 0; - INT8 bAttachPos; OBJECTTYPE Launchable; OBJECTTYPE * pObj; UINT16 usItemNum; @@ -2666,27 +2675,24 @@ BOOLEAN UseLauncher( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ) return( FALSE ); } - pObj = &(pSoldier->inv[HANDPOS]); - for (bAttachPos = 0; bAttachPos < MAX_ATTACHMENTS; bAttachPos++) - { - if (pObj->usAttachItem[ bAttachPos ] != NOTHING) + pObj = &(pSoldier->inv[HANDPOS]); + attachmentList::iterator iter; + for (iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { + if ( Item[ iter->usItem ].usItemClass & IC_EXPLOSV ) { - if ( Item[ pObj->usAttachItem[ bAttachPos ] ].usItemClass & IC_EXPLOSV ) - { - break; - } + break; } } - if (bAttachPos == MAX_ATTACHMENTS) + if (iter == (*pObj)[0]->attachments.end()) { // this should not happen!! return( FALSE ); } if ( Weapon[GetAttachedGrenadeLauncher(pObj)].ubMagSize > 1 || ( Item[pObj->usItem].grenadelauncher && GetMagSize(pObj) > 1 )) - CreateItem( pObj->usAttachItem[ bAttachPos ], 100, &Launchable ); + CreateItem( iter->usItem, 100, &Launchable ); else - CreateItem( pObj->usAttachItem[ bAttachPos ], pObj->bAttachStatus[ bAttachPos ], &Launchable ); + CreateItem( iter->usItem, (*iter)[0]->data.objectStatus, &Launchable ); //if ( pSoldier->usAttackingWeapon == pObj->usItem ) //{ DeductAmmo( pSoldier, HANDPOS ); @@ -2695,7 +2701,7 @@ BOOLEAN UseLauncher( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ) //{ // // Firing an attached grenade launcher... the attachment we found above // // is the one to remove! - // RemoveAttachment( pObj, bAttachPos, NULL ); + // RemoveAttachment( pObj, bAttachPos); //} // ATE: Check here if the launcher should fail 'cause of bad status..... @@ -2705,7 +2711,7 @@ BOOLEAN UseLauncher( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ) // So we still should have ABC > 0 // Begin explosion due to failure... - IgniteExplosion( pSoldier->ubID, (INT16)CenterX( pSoldier->sGridNo ), (INT16)CenterY( pSoldier->sGridNo ), 0, pSoldier->sGridNo, Launchable.usItem, pSoldier->bLevel ); + IgniteExplosion( pSoldier->ubID, (INT16)CenterX( pSoldier->sGridNo ), (INT16)CenterY( pSoldier->sGridNo ), 0, pSoldier->sGridNo, Launchable.usItem, pSoldier->pathing.bLevel ); // Reduce again for attack end 'cause it has been incremented for a normal attack // Nope, not anymore. @@ -2720,12 +2726,12 @@ BOOLEAN UseLauncher( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ) if ( Weapon[ usItemNum ].sSound != NO_WEAPON_SOUND ) { if (Item[ usItemNum ].usItemClass == IC_GUN ) - PlayJA2Sample( Weapon[ UNDER_GLAUNCHER ].sSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( Weapon[ UNDER_GLAUNCHER ].sSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); else - PlayJA2Sample( Weapon[ usItemNum ].sSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( Weapon[ usItemNum ].sSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } - uiHitChance = CalcThrownChanceToHit( pSoldier, sTargetGridNo, pSoldier->bAimTime, AIM_SHOT_TORSO ); + uiHitChance = CalcThrownChanceToHit( pSoldier, sTargetGridNo, pSoldier->aiData.bAimTime, AIM_SHOT_TORSO ); uiDiceRoll = PreRandom( 100 ); @@ -2774,8 +2780,7 @@ BOOLEAN UseLauncher( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo ) //pObject->fPotentialForDebug = TRUE; - MemFree( pSoldier->pTempObject ); - pSoldier->pTempObject = NULL; + OBJECTTYPE::DeleteMe( &pSoldier->pTempObject ); MemFree( pSoldier->pThrowParams ); pSoldier->pThrowParams = NULL; @@ -2795,7 +2800,7 @@ BOOLEAN DoSpecialEffectAmmoMiss( UINT8 ubAttackerID, INT16 sGridNo, INT16 sXPos, UINT8 ubAmmoType; UINT16 usItem; - ubAmmoType = MercPtrs[ ubAttackerID ]->inv[ MercPtrs[ ubAttackerID ]->ubAttackingHand ].ItemData.Gun.ubGunAmmoType; + ubAmmoType = MercPtrs[ ubAttackerID ]->inv[ MercPtrs[ ubAttackerID ]->ubAttackingHand ][0]->data.gun.ubGunAmmoType; usItem = MercPtrs[ ubAttackerID ]->inv[ MercPtrs[ ubAttackerID ]->ubAttackingHand ].usItem; memset( &AniParams, 0, sizeof( ANITILE_PARAMS ) ); @@ -2828,11 +2833,11 @@ BOOLEAN DoSpecialEffectAmmoMiss( UINT8 ubAttackerID, INT16 sGridNo, INT16 sXPos, if ( sGridNo != NOWHERE ) { - PlayJA2Sample( SMALL_EXPLODE_1 , RATE_11025, SoundVolume( (INT8)HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); + PlayJA2Sample( SMALL_EXPLODE_1 , RATE_11025, SoundVolume( (INT8)HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); } else { - PlayJA2Sample( SMALL_EXPLODE_1 , RATE_11025, MIDVOLUME, 1, MIDDLE ); + PlayJA2Sample( SMALL_EXPLODE_1 , RATE_11025, MIDVOLUME, 1, MIDDLE ); } return( TRUE ); @@ -2865,11 +2870,11 @@ BOOLEAN DoSpecialEffectAmmoMiss( UINT8 ubAttackerID, INT16 sGridNo, INT16 sXPos, if ( sGridNo != NOWHERE ) { - PlayJA2Sample( EXPLOSION_1 , RATE_11025, SoundVolume( (INT8)HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); + PlayJA2Sample( EXPLOSION_1 , RATE_11025, SoundVolume( (INT8)HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); } else { - PlayJA2Sample( EXPLOSION_1 , RATE_11025, MIDVOLUME, 1, MIDDLE ); + PlayJA2Sample( EXPLOSION_1 , RATE_11025, MIDVOLUME, 1, MIDDLE ); } return( TRUE ); @@ -2902,11 +2907,11 @@ BOOLEAN DoSpecialEffectAmmoMiss( UINT8 ubAttackerID, INT16 sGridNo, INT16 sXPos, if ( sGridNo != NOWHERE ) { - PlayJA2Sample( EXPLOSION_BLAST_2 , RATE_11025, SoundVolume( (INT8)HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); + PlayJA2Sample( EXPLOSION_BLAST_2 , RATE_11025, SoundVolume( (INT8)HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); } else { - PlayJA2Sample( EXPLOSION_BLAST_2 , RATE_11025, MIDVOLUME, 1, MIDDLE ); + PlayJA2Sample( EXPLOSION_BLAST_2 , RATE_11025, MIDVOLUME, 1, MIDDLE ); } return( TRUE ); @@ -2952,44 +2957,44 @@ void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 s // Get attacker pSoldier = MercPtrs[ ubAttackerID ]; - + // Get Target pTargetSoldier = MercPtrs[ usSoldierID ]; - MakeNoise( ubAttackerID, pTargetSoldier->sGridNo, pTargetSoldier->bLevel, gpWorldLevelData[pTargetSoldier->sGridNo].ubTerrainID, Weapon[ usWeaponIndex ].ubHitVolume, NOISE_BULLET_IMPACT ); + MakeNoise( ubAttackerID, pTargetSoldier->sGridNo, pTargetSoldier->pathing.bLevel, gpWorldLevelData[pTargetSoldier->sGridNo].ubTerrainID, Weapon[ usWeaponIndex ].ubHitVolume, NOISE_BULLET_IMPACT ); // CALLAHAN START BUGFIX - if ( EXPLOSIVE_GUN( usWeaponIndex ) || AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize > 1) + if ( EXPLOSIVE_GUN( usWeaponIndex ) || AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ][0]->data.gun.ubGunAmmoType].explosionSize > 1) // CALLAHAN END BUGFIX { // Reduce attacker count! - //TODO: Madd --- I don't think this code will ever get called for the HE ammo -- the EXPLOSIVE_GUN check filters out regular guns - // marke test mag ammo type: pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType + //TODO: Madd --- I don't think this code will ever get called for the HE ammo -- the EXPLOSIVE_GUN check filters out regular guns + // marke test mag ammo type: pSoldier->inv[pSoldier->ubAttackingHand ][0]->data.gun.ubGunAmmoType // 2cond 'or' added - if ( Item[usWeaponIndex].rocketlauncher || AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize > 1 ) + if ( Item[usWeaponIndex].rocketlauncher || AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ][0]->data.gun.ubGunAmmoType].explosionSize > 1 ) { if ( Item[usWeaponIndex].singleshotrocketlauncher ) { - IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, (INT16) (GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos )), C1, pTargetSoldier->bLevel ); + IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, (INT16) (GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos )), C1, pTargetSoldier->pathing.bLevel ); } // changed rpg type to work only with two flags matching else if ( !Item[usWeaponIndex].singleshotrocketlauncher && Item[usWeaponIndex].rocketlauncher) { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("WeaponHit: RPG7 item: %d, Ammo: %d",pSoldier->inv[HANDPOS].usItem , pSoldier->inv[HANDPOS].usGunAmmoItem ) ); - - IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, (INT16) (GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos )), pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.usGunAmmoItem, pTargetSoldier->bLevel ); - pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.usGunAmmoItem = NONE; + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("WeaponHit: RPG7 item: %d, Ammo: %d",pSoldier->inv[HANDPOS].usItem , pSoldier->inv[HANDPOS][0]->data.gun.usGunAmmoItem ) ); + + IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, (INT16) (GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos )), pSoldier->inv[pSoldier->ubAttackingHand ][0]->data.gun.usGunAmmoItem, pTargetSoldier->pathing.bLevel ); + pSoldier->inv[pSoldier->ubAttackingHand ][0]->data.gun.usGunAmmoItem = NONE; } - else if ( AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize > 1) + else if ( AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ][0]->data.gun.ubGunAmmoType].explosionSize > 1) { // re-routed the Highexplosive value to define exposion type - IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, (INT16) (GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos )), AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].highExplosive , pTargetSoldier->bLevel ); - // pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem = NONE; + IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, (INT16) (GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos )), AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ][0]->data.gun.ubGunAmmoType].highExplosive , pTargetSoldier->pathing.bLevel ); + // pSoldier->inv[pSoldier->ubAttackingHand ][0]->data.gun.usGunAmmoItem = NONE; } } else // tank cannon { - IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, (INT16) (GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos )), TANK_SHELL, pTargetSoldier->bLevel ); + IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, (INT16) (GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos )), TANK_SHELL, pTargetSoldier->pathing.bLevel ); } // 0verhaul: No longer necessary @@ -3003,9 +3008,9 @@ void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 s // OK, SHOT HAS HIT, DO THINGS APPROPRIATELY // ATE: This is 'cause of that darn smoke effect that could potentially kill // the poor bastard .. so check - if ( !pTargetSoldier->fDoingExternalDeath ) + if ( !pTargetSoldier->flags.fDoingExternalDeath ) { - EVENT_SoldierGotHit( pTargetSoldier, usWeaponIndex, sDamage, sBreathLoss, usDirection, sRange, ubAttackerID, ubSpecial, ubHitLocation, 0, NOWHERE ); + pTargetSoldier->EVENT_SoldierGotHit( usWeaponIndex, sDamage, sBreathLoss, usDirection, sRange, ubAttackerID, ubSpecial, ubHitLocation, 0, NOWHERE ); } // else // { @@ -3017,7 +3022,7 @@ void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 s } -void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT8 ubAttackerID, UINT16 sXPos, INT16 sYPos, INT16 sZPos, UINT16 usStructureID, INT32 iImpact, BOOLEAN fStopped ) +void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UINT8 ubAttackerID, UINT16 sXPos, INT16 sYPos, INT16 sZPos, UINT16 usStructureID, INT32 iImpact, BOOLEAN fStopped ) { BOOLEAN fDoMissForGun = FALSE; ANITILE *pNode; @@ -3029,7 +3034,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT BOOLEAN fHitSameStructureAsBefore; BULLET * pBullet; SOLDIERTYPE * pAttacker = NULL; - + pBullet = GetBulletPtr( iBullet ); if ( fStopped && ubAttackerID != NOBODY ) @@ -3050,7 +3055,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT } } } - + if ( pBullet ) { fHitSameStructureAsBefore = ( usStructureID == pBullet->usLastStructureHit ); @@ -3085,7 +3090,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT // Get attacker pSoldier = MercPtrs[ ubAttackerID ]; // marke added one 'or' to get this working with HE ammo - if ( Item[usWeaponIndex].rocketlauncher || AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize > 1) + if ( Item[usWeaponIndex].rocketlauncher || AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ][0]->data.gun.ubGunAmmoType].explosionSize > 1) { // Reduce attacker count! DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - end of LAW fire") ); @@ -3097,20 +3102,20 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT // changed too to use 2 flag to determine else if ( !Item[usWeaponIndex].singleshotrocketlauncher && Item[usWeaponIndex].rocketlauncher) { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("StructureHit: RPG7 item: %d, Ammo: %d",pAttacker->inv[HANDPOS].usItem , pAttacker->inv[HANDPOS].usGunAmmoItem ) ); - IgniteExplosion( ubAttackerID, (INT16)CenterX( sGridNo ), (INT16)CenterY( sGridNo ), 0, sGridNo, pAttacker->inv[pAttacker->ubAttackingHand ].ItemData.Gun.usGunAmmoItem , (INT8)( sZPos >= WALL_HEIGHT ) ); - pAttacker->inv[pAttacker->ubAttackingHand ].ItemData.Gun.usGunAmmoItem = NONE; + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("StructureHit: RPG7 item: %d, Ammo: %d",pAttacker->inv[HANDPOS].usItem , pAttacker->inv[HANDPOS][0]->data.gun.usGunAmmoItem ) ); + IgniteExplosion( ubAttackerID, (INT16)CenterX( sGridNo ), (INT16)CenterY( sGridNo ), 0, sGridNo, pAttacker->inv[pAttacker->ubAttackingHand ][0]->data.gun.usGunAmmoItem , (INT8)( sZPos >= WALL_HEIGHT ) ); + pAttacker->inv[pAttacker->ubAttackingHand ][0]->data.gun.usGunAmmoItem = NONE; } - else if ( AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize > 1) + else if ( AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ][0]->data.gun.ubGunAmmoType].explosionSize > 1) { // re-routed the Highexplosive value to define exposion type - IgniteExplosion( ubAttackerID, (INT16)CenterX( sGridNo ), (INT16)CenterY( sGridNo ), 0, sGridNo, AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].highExplosive , (INT8)( sZPos >= WALL_HEIGHT ) ); - // pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem = NONE; + IgniteExplosion( ubAttackerID, (INT16)CenterX( sGridNo ), (INT16)CenterY( sGridNo ), 0, sGridNo, AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ][0]->data.gun.ubGunAmmoType].highExplosive , (INT8)( sZPos >= WALL_HEIGHT ) ); + // pSoldier->inv[pSoldier->ubAttackingHand ][0]->data.gun.usGunAmmoItem = NONE; } // Moved here to make sure ABC stays >0 until everything done RemoveBullet( iBullet ); - + return; } @@ -3153,7 +3158,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT { if ( Random( 40 ) == 0 ) { - DoMercBattleSound( MercPtrs[ ubAttackerID ], BATTLE_SOUND_CURSE1 ); + MercPtrs[ ubAttackerID ]->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); } } } @@ -3170,7 +3175,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT // DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - monster attack hit structure") ); // FreeUpAttacker( (UINT8) ubAttackerID ); - //PlayJA2Sample( SPIT_RICOCHET , RATE_11025, uiMissVolume, 1, SoundDir( sGridNo ) ); + //PlayJA2Sample( SPIT_RICOCHET , RATE_11025, uiMissVolume, 1, SoundDir( sGridNo ) ); break; case KNIFECLASS: @@ -3178,15 +3183,13 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT // When it hits the ground, leave on map... if ( Item[ usWeaponIndex ].usItemClass == IC_THROWING_KNIFE ) { - OBJECTTYPE Object; - // OK, have we hit ground? if ( usStructureID == INVALID_STRUCTURE_ID ) - { + { // Add item - CreateItem( usWeaponIndex, bWeaponStatus, &Object ); + CreateItem( usWeaponIndex, bWeaponStatus, &gTempObject ); - AddItemToPool( sGridNo, &Object, -1 , 0, 0, -1 ); + AddItemToPool( sGridNo, &gTempObject, -1 , 0, 0, -1 ); // Make team look for items NotifySoldiersToLookforItems( ); @@ -3194,7 +3197,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT if ( !fHitSameStructureAsBefore ) { - PlayJA2Sample( MISS_KNIFE, RATE_11025, uiMissVolume, 1, SoundDir( sGridNo ) ); + PlayJA2Sample( MISS_KNIFE, RATE_11025, uiMissVolume, 1, SoundDir( sGridNo ) ); } RemoveBullet( iBullet ); @@ -3202,7 +3205,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT // FreeUpAttacker( (UINT8) ubAttackerID ); } } - + if ( fDoMissForGun ) { // OK, are we a shotgun, if so , make sounds lower... @@ -3218,7 +3221,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT // PLAY SOUND AND FLING DEBRIS // RANDOMIZE SOUND SYSTEM - + // IF WE HIT THE GROUND if ( fHitSameStructureAsBefore ) @@ -3237,11 +3240,11 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT { if ( sZPos == 0 ) { - PlayJA2Sample( MISS_G2 , RATE_11025, uiMissVolume, 1, SoundDir( sGridNo ) ); + PlayJA2Sample( MISS_G2 , RATE_11025, uiMissVolume, 1, SoundDir( sGridNo ) ); } else { - PlayJA2Sample( MISS_1 + Random(8), RATE_11025, uiMissVolume, 1, SoundDir( sGridNo ) ); + PlayJA2Sample( MISS_1 + Random(8), RATE_11025, uiMissVolume, 1, SoundDir( sGridNo ) ); } // Default hit is the ground @@ -3272,7 +3275,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT pNode->pLevelNode->sRelativeY = sYPos; pNode->pLevelNode->sRelativeZ = sZPos; - } + } memset( &AniParams, 0, sizeof( ANITILE_PARAMS ) ); AniParams.sGridNo = sGridNo; @@ -3302,7 +3305,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT pNode->pLevelNode->sRelativeX = sXPos; pNode->pLevelNode->sRelativeY = sYPos; pNode->pLevelNode->sRelativeZ = sZPos; - + // ATE: Show misses...( if our team ) if ( gGameSettings.fOptions[ TOPTION_SHOW_MISSES ] ) { @@ -3335,12 +3338,12 @@ void WindowHit( INT16 sGridNo, UINT16 usStructureID, BOOLEAN fBlowWindowSouth, B // ATE: Make large force always for now ( feel thing ) fLargeForce = TRUE; - // we have to do two things here: swap the window structure + // we have to do two things here: swap the window structure // (right now just using the partner stuff in a chain from - // intact to cracked to shattered) and display the + // intact to cracked to shattered) and display the // animation if we've reached shattered - // find the wall structure, and go one length along the chain + // find the wall structure, and go one length along the chain pWallAndWindow = FindStructureByID( sGridNo, usStructureID ); if (pWallAndWindow == NULL) { @@ -3443,32 +3446,33 @@ void WindowHit( INT16 sGridNo, UINT16 usStructureID, BOOLEAN fBlowWindowSouth, B pNode = CreateAnimationTile( &AniParams ); - PlayJA2Sample( GLASS_SHATTER1 + Random(2), RATE_11025, MIDVOLUME, 1, SoundDir( sGridNo ) ); + PlayJA2Sample( GLASS_SHATTER1 + Random(2), RATE_11025, MIDVOLUME, 1, SoundDir( sGridNo ) ); } BOOLEAN InRange( SOLDIERTYPE *pSoldier, INT16 sGridNo ) { - INT16 sRange; + INT16 sRange; UINT16 usInHand; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("InRange")); usInHand = pSoldier->inv[HANDPOS].usItem; + INVTYPE* pItemInHand = &Item[ usInHand ]; - if ( Item[ usInHand ].usItemClass == IC_GUN || Item[ usInHand ].usItemClass == IC_THROWING_KNIFE || (Item[usInHand].rocketlauncher && !Item[usInHand].singleshotrocketlauncher)) + if ( pItemInHand->usItemClass == IC_GUN || pItemInHand->usItemClass == IC_THROWING_KNIFE || (pItemInHand->rocketlauncher && !pItemInHand->singleshotrocketlauncher)) { // Determine range sRange = (INT16)GetRangeInCellCoordsFromGridNoDiff( pSoldier->sGridNo, sGridNo ); - if ( Item[ usInHand ].usItemClass == IC_THROWING_KNIFE ) + if ( pItemInHand->usItemClass == IC_THROWING_KNIFE ) { // NB CalcMaxTossRange returns range in tiles, not in world units if ( sRange <= CalcMaxTossRange( pSoldier, usInHand, TRUE ) * CELL_X_SIZE ) { return( TRUE ); } - } + } else { // For given weapon, check range @@ -3481,13 +3485,13 @@ BOOLEAN InRange( SOLDIERTYPE *pSoldier, INT16 sGridNo ) return( FALSE ); } -UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime, UINT8 ubAimPos ) +UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAimTime, UINT8 ubAimPos ) { //SOLDIERTYPE *vicpSoldier; SOLDIERTYPE * pTarget; INT32 iChance, iRange, iSightRange, iMaxRange, iBonus; //, minRange; //rain - //INT32 iScopeBonus; + //INT32 iScopeBonus; //end rain INT32 iGunCondition, iMarksmanship; @@ -3499,21 +3503,33 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime INT16 sDistVis; UINT8 ubAdjAimPos; UINT8 ubTargetID; + bool highPowerScope = false; + UINT32 pScope; - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CalcChanceToHitGun")); + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CalcChanceToHitGun")); - if ( pSoldier->bMarksmanship == 0 ) + if ( pSoldier->stats.bMarksmanship == 0 ) { // always min chance return( MINCHANCETOHIT ); } - // make sure the guy's actually got a weapon in his hand! + // make sure the guy's actually got a weapon in his hand! pInHand = &(pSoldier->inv[pSoldier->ubAttackingHand]); - usInHand = pSoldier->usAttackingWeapon; + usInHand = pSoldier->usAttackingWeapon; + //CHRISL: We have new modifiers when using a high power scope so find out if we have one from the start + for(attachmentList::iterator iter = (*pInHand)[0]->attachments.begin(); iter != (*pInHand)[0]->attachments.end(); iter++) + { + if(Item[iter->usItem].aimbonus > HIGH_POWER_SCOPE) + { + highPowerScope = true; + pScope = iter->usItem; + break; + } + } // DETERMINE BASE CHANCE OF HITTING - iGunCondition = WEAPON_STATUS_MOD( pInHand->ItemData.Gun.bGunStatus ); + iGunCondition = WEAPON_STATUS_MOD( (*pInHand)[0]->data.gun.bGunStatus ); if (Item[usInHand].rocketlauncher ) { @@ -3533,7 +3549,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime { SOLDIERTYPE * pSoldier2; - pSoldier2 = GetRobotController( pSoldier ); + pSoldier2 = pSoldier->GetRobotController( ); if ( pSoldier2 ) { iMarksmanship = __max( iMarksmanship, EffectiveMarksmanship( pSoldier2 ) ); @@ -3572,8 +3588,21 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime // calculate actual range (in units, 10 units = 1 tile) iRange = GetRangeInCellCoordsFromGridNoDiff( pSoldier->sGridNo, sGridNo ); + if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_STAND ) + { + //CHRISL: Incur a penalty if using a highPowerScope + if(highPowerScope == true && iRange > Item[pScope].minrangeforaimbonus) + { + iPenalty = (Item[pScope].aimbonus * (iRange-Item[pScope].minrangeforaimbonus)) / 1000; + if (iPenalty > AIM_BONUS_PRONE) + { + iPenalty = AIM_BONUS_PRONE; + } + iChance -= iPenalty; + } + } // if shooter is crouched, he aims slightly better (to max of AIM_BONUS_CROUCHING) - if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_CROUCH ) + else if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_CROUCH ) { iBonus = iRange / 10; if (iBonus > AIM_BONUS_CROUCHING) @@ -3581,6 +3610,16 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime iBonus = AIM_BONUS_CROUCHING; } iChance += iBonus; + //CHRISL: Incur a penalty if using a highPowerScope + if(highPowerScope == true && iRange > Item[pScope].minrangeforaimbonus) + { + iPenalty = ((Item[pScope].aimbonus/2) * (iRange-Item[pScope].minrangeforaimbonus)) / 1000; + if (iPenalty > AIM_BONUS_CROUCHING) + { + iPenalty = AIM_BONUS_CROUCHING; + } + iChance -= iPenalty; + } } // if shooter is prone, he aims even better, except at really close range else if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_PRONE ) @@ -3608,14 +3647,14 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime // if ( !(Item[ usInHand ].fFlags & ITEM_TWO_HANDED) ) if ( !(Item[ usInHand ].twohanded ) ) { - if (pSoldier->inv[SECONDHANDPOS].usItem == NOTHING) + if (pSoldier->inv[SECONDHANDPOS].exists() == false) { - // firing with gun in right hand, and second hand empty (ie: no grenade, med kit or anything there) + // firing with gun in right hand, and second hand empty (ie: no grenade, med kit or anything there) // Madd: easier to fire pistol/smg w/one hand free, essentially this will make pistols a little bit more accurate, and hopefully still useful later in the game if (Weapon[usInHand].ubWeaponClass == HANDGUNCLASS) iChance += AIM_BONUS_TWO_HANDED_PISTOL; } - else + else { // Madd: harder to fire smgs w/something in other hand // SMGs are treated as pistols for these purpose except there is a -5 penalty; @@ -3626,7 +3665,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime if ( !HAS_SKILL_TRAIT( pSoldier, AMBIDEXT ) ) { - if ( IsValidSecondHandShot( pSoldier ) ) + if ( pSoldier->IsValidSecondHandShot( ) ) { // penalty to aim when firing two pistols iChance -= AIM_PENALTY_DUAL_PISTOLS; @@ -3701,15 +3740,15 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime //ADB because A) the bullet can travel farther than I can see and B) I might have a spotter //We are firing a gun, and so the gun will be pointed and the scope will be used, even if it isn't now, so don't forget that we are in a firing animation - if (ubTargetID != NOBODY && pSoldier->bOppList[ubTargetID] == SEEN_CURRENTLY || gbPublicOpplist[pSoldier->bTeam][ubTargetID] == SEEN_CURRENTLY) + if (ubTargetID != NOBODY && pSoldier->aiData.bOppList[ubTargetID] == SEEN_CURRENTLY || gbPublicOpplist[pSoldier->bTeam][ubTargetID] == SEEN_CURRENTLY) { - iSightRange = SoldierToSoldierLineOfSightTest( pSoldier, MercPtrs[ubTargetID], TRUE, NO_DISTANCE_LIMIT, pSoldier->bAimShotLocation, false ); + iSightRange = SoldierToSoldierLineOfSightTest( pSoldier, MercPtrs[ubTargetID], TRUE, NO_DISTANCE_LIMIT, pSoldier->bAimShotLocation, false ); } if (iSightRange == -1) // didn't do a bodypart-based test { iSightRange = SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, pSoldier->bTargetLevel, pSoldier->bTargetCubeLevel, TRUE, NO_DISTANCE_LIMIT, false ); } - + //restore old flag gAnimControl[ pSoldier->usAnimState ].uiFlags = oldFlag; @@ -3721,9 +3760,26 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime // if shooter spent some extra time aiming and can see the target if (iSightRange > 0 && ubAimTime && !pSoldier->bDoBurst ) - iChance += (AIM_BONUS_PER_AP * ubAimTime); // bonus for every pt of aiming + { + INT32 aimTimeBonus = 0; + if(highPowerScope == true) + { + if ( NUM_SKILL_TRAITS( pSoldier, PROF_SNIPER ) == 2 ) + aimTimeBonus = -((__max(0,75-pSoldier->stats.bMarksmanship))/(pSoldier->stats.bExpLevel*2)); + else if( NUM_SKILL_TRAITS( pSoldier, PROF_SNIPER ) == 1 ) + aimTimeBonus = -((__max(0,85-pSoldier->stats.bMarksmanship))/(pSoldier->stats.bExpLevel*2)); + else + aimTimeBonus = -((__max(0,100-pSoldier->stats.bMarksmanship))/(pSoldier->stats.bExpLevel)); + aimTimeBonus = __max(-9, aimTimeBonus); + aimTimeBonus = __min(0, aimTimeBonus); + aimTimeBonus += AIM_BONUS_PER_AP; + } + else + aimTimeBonus = AIM_BONUS_PER_AP; + iChance += (aimTimeBonus * ubAimTime); // bonus for every pt of aiming + } - if ( !(pSoldier->uiStatusFlags & SOLDIER_PC ) ) // if this is a computer AI controlled enemy + if ( !(pSoldier->flags.uiStatusFlags & SOLDIER_PC ) ) // if this is a computer AI controlled enemy { if ( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY ) { @@ -3740,7 +3796,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime } // if shooter is being affected by gas - if ( pSoldier->uiStatusFlags & SOLDIER_GASSED ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) { iChance -= AIM_PENALTY_GASSED; } @@ -3750,8 +3806,8 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime iChance -= AIM_PENALTY_GETTINGAID; // if shooter is still in shock - if (pSoldier->bShock) - iChance -= (pSoldier->bShock * AIM_PENALTY_PER_SHOCK); + if (pSoldier->aiData.bShock) + iChance -= (pSoldier->aiData.bShock * AIM_PENALTY_PER_SHOCK); // WANNE: Changed this, because RPGs are not in the calculation, only guns //if ( Item[ usInHand ].usItemClass == IC_GUN ) @@ -3789,7 +3845,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime // iScopeBonus = (iScopeBonus * WEAPON_STATUS_MOD(pInHand->bAttachStatus[bAttachPos])) / 100; //rain - // reduce scope effectiveness when it's raining + // reduce scope effectiveness when it's raining // iScopeBonus /= 1 + gbCurrentRainIntensity; //madd: commented out -- didn't do anything but cause a warning :S //end rain @@ -3808,13 +3864,13 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime // if ( usInHand == ROCKET_RIFLE || usInHand == AUTO_ROCKET_RIFLE ) // { - // bLaserStatus = WEAPON_STATUS_MOD(pInHand->bGunStatus); + // bLaserStatus = WEAPON_STATUS_MOD((*pInHand)[0]->data.gun.bGunStatus); // } // else // { // bLaserStatus = WEAPON_STATUS_MOD(pInHand->bAttachStatus[ bAttachPos ]); // } - // + // // // laser scope isn't of much use in high light levels; add something for that // if (bLaserStatus > 50) // { @@ -3825,7 +3881,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime // // laser scope in bad condition creates aim penalty! // iScopeBonus = - LASERSCOPE_BONUS * (50 - bLaserStatus) / 50; // } - // + // // iChance += iScopeBonus; //} @@ -3838,6 +3894,11 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime // Reduce effective range by the aiming bonus (e.g. from sniper scope) iSightRange -= GetAimBonus( pInHand, iRange, ubAimTime ); + //CHRISL: If we have the Sniper skill, reduce effective range + if ( HAS_SKILL_TRAIT( pSoldier, PROF_SNIPER ) ) + { + iSightRange -= ((gbSkillTraitBonus[ PROF_SNIPER ] * NUM_SKILL_TRAITS( pSoldier, PROF_SNIPER )) * iRange) /100; + } if (iSightRange < 1) { iSightRange = 1; @@ -3853,7 +3914,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime } // if aiming at the head, reduce chance to hit - if (ubAimPos == AIM_SHOT_HEAD) + if (ubAimPos == AIM_SHOT_HEAD) { // penalty of 3% per tile iPenalty = 3 * iSightRange / 10; @@ -3897,7 +3958,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime { // Effects based on aiming & sight // From for JA2.5: 3% bonus/penalty for each tile different from range NORMAL_RANGE. - // This doesn't provide a bigger bonus at close range, but stretches it out, making medium + // This doesn't provide a bigger bonus at close range, but stretches it out, making medium // range less penalized, and longer range more penalized iChance += 3 * ( NORMAL_RANGE - iSightRange ) / CELL_X_SIZE; /* @@ -3916,7 +3977,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime } // adjust for roof/not on roof - if ( pSoldier->bLevel == 0 ) + if ( pSoldier->pathing.bLevel == 0 ) { if ( pSoldier->bTargetLevel > 0 ) { @@ -3924,24 +3985,19 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime iChance -= AIM_PENALTY_FIRING_UP; } } - else // pSoldier->bLevel > 0 ) + else // pSoldier->pathing.bLevel > 0 ) { if ( pSoldier->bTargetLevel == 0 ) { iChance += AIM_BONUS_FIRING_DOWN; } - // if have roof trait, give bonus - if ( HAS_SKILL_TRAIT( pSoldier, ONROOF ) ) - { - iChance += gbSkillTraitBonus[ ONROOF ] * NUM_SKILL_TRAITS( pSoldier, ONROOF ); - } } pTarget = SimpleFindSoldier( sGridNo, pSoldier->bTargetLevel ); if (pTarget != NULL) { - // targeting a merc + // targeting a merc // adjust for crouched/prone target switch( gAnimControl[ pTarget->usAnimState ].ubHeight ) { @@ -4013,7 +4069,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime // if target sees us, he may have a chance to dodge before the gun goes off // but ability to dodge is reduced if crouched or prone! - if (pTarget->bOppList[pSoldier->ubID] == SEEN_CURRENTLY && !TANK( pTarget ) && !(pSoldier->ubBodyType != QUEENMONSTER) ) + if (pTarget->aiData.bOppList[pSoldier->ubID] == SEEN_CURRENTLY && !TANK( pTarget ) && !(pSoldier->ubBodyType != QUEENMONSTER) ) { iPenalty = ( EffectiveAgility( pTarget ) / 5 + EffectiveExpLevel( pTarget ) * 2); switch( gAnimControl[ pTarget->usAnimState ].ubHeight ) @@ -4024,7 +4080,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime case ANIM_PRONE: iPenalty /= 3; break; - } + } // reduce dodge ability by the attacker's stats iBonus = ( EffectiveDexterity( pSoldier ) / 5 + EffectiveExpLevel( pSoldier ) * 2); @@ -4080,14 +4136,14 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime #endif // IF CHANCE EXISTS, BUT SHOOTER IS INJURED - if ((iChance > 0) && (pSoldier->bLife < pSoldier->bLifeMax)) + if ((iChance > 0) && (pSoldier->stats.bLife < pSoldier->stats.bLifeMax)) { // if bandaged, give 1/2 of the bandaged life points back into equation - bBandaged = pSoldier->bLifeMax - pSoldier->bLife - pSoldier->bBleeding; + bBandaged = pSoldier->stats.bLifeMax - pSoldier->stats.bLife - pSoldier->bBleeding; // injury penalty is based on % damage taken (max 2/3rds chance) - iPenalty = (iChance * 2 * (pSoldier->bLifeMax - pSoldier->bLife + (bBandaged / 2))) / - (3 * pSoldier->bLifeMax); + iPenalty = (iChance * 2 * (pSoldier->stats.bLifeMax - pSoldier->stats.bLife + (bBandaged / 2))) / + (3 * pSoldier->stats.bLifeMax); // reduce injury penalty due to merc's experience level (he can take it!) iChance -= (iPenalty * (100 - (10 * ( EffectiveExpLevel( pSoldier ) - 1)))) / 100; @@ -4143,7 +4199,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime return (iChance); } -UINT32 AICalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime, UINT8 ubAimPos ) +UINT32 AICalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAimTime, UINT8 ubAimPos ) { UINT16 usTrueState; UINT32 uiChance; @@ -4160,7 +4216,7 @@ INT32 CalcBodyImpactReduction( UINT8 ubAmmoType, UINT8 ubHitLocation ) { // calculate how much bullets are slowed by passing through someone INT32 iReduction = BodyImpactReduction[ubHitLocation]; - + iReduction = (INT32)(iReduction * AmmoTypes[ubAmmoType].armourImpactReductionMultiplier / max(1,AmmoTypes[ubAmmoType].armourImpactReductionDivisor)); //switch (ubAmmoType) //{ @@ -4180,7 +4236,7 @@ INT32 CalcBodyImpactReduction( UINT8 ubAmmoType, UINT8 ubHitLocation ) return( iReduction ); } -INT32 ArmourProtection( SOLDIERTYPE * pTarget, UINT16 ubArmourType, INT8 * pbStatus, INT32 iImpact, UINT8 ubAmmoType, BOOLEAN *plateHit ) +INT32 ArmourProtection( SOLDIERTYPE * pTarget, UINT16 ubArmourType, INT16 * pbStatus, INT32 iImpact, UINT8 ubAmmoType, BOOLEAN *plateHit ) { INT32 iProtection, iAppliedProtection, iFailure, iCoverage; @@ -4232,7 +4288,7 @@ INT32 ArmourProtection( SOLDIERTYPE * pTarget, UINT16 ubArmourType, INT8 * pbSta // break; //} - // figure out how much of the armour's protection value is necessary + // figure out how much of the armour's protection value is necessary // in defending against this bullet if (iProtection > iImpact ) { @@ -4251,7 +4307,7 @@ INT32 ArmourProtection( SOLDIERTYPE * pTarget, UINT16 ubArmourType, INT8 * pbSta // creature spit damages armour a lot! an extra 3x for a total of 4x normal *pbStatus -= 3 * (iAppliedProtection * Armour[ubArmourType].ubDegradePercent) / 100; - // reduce amount of protection from armour + // reduce amount of protection from armour iProtection /= 2; } else if ( AmmoTypes[ubAmmoType].ignoreArmour ) @@ -4278,19 +4334,18 @@ INT32 TotalArmourProtection( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 u { INT32 iTotalProtection = 0, iSlot; OBJECTTYPE * pArmour; - INT8 bPlatePos = -1; BOOLEAN plateHit = false; - if (pTarget->uiStatusFlags & SOLDIER_VEHICLE) + if (pTarget->flags.uiStatusFlags & SOLDIER_VEHICLE) { - INT8 bDummyStatus = 100; + INT16 bDummyStatus = 100; BOOLEAN dummyCoverage = true; - //bDummyStatus = (INT8) pVehicleList[ pTarget->bVehicleID ].sExternalArmorLocationsStatus[ ubHitLocation ]; + //bDummyStatus = pVehicleList[ pTarget->bVehicleID ].sExternalArmorLocationsStatus[ ubHitLocation ]; iTotalProtection += ArmourProtection( pTarget, (UINT8) pVehicleList[ pTarget->bVehicleID ].sArmourType, &bDummyStatus, iImpact, ubAmmoType, &dummyCoverage ); - //pVehicleList[ pTarget->bVehicleID ].sExternalArmorLocationsStatus[ ubHitLocation ] = bDummyStatus; + //pVehicleList[ pTarget->bVehicleID ].sExternalArmorLocationsStatus[ ubHitLocation ] = bDummyStatus; } else @@ -4314,53 +4369,46 @@ INT32 TotalArmourProtection( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 u } pArmour = &(pTarget->inv[ iSlot ]); - if (pArmour->usItem != NOTHING) + if (pArmour->exists() == true) { - // check plates first - //if ( iSlot == VESTPOS ) - //{ -// bPlatePos = FindAttachment( pArmour, CERAMIC_PLATES ); - bPlatePos = FindFirstArmourAttachment( pArmour); - if (bPlatePos != -1) + for (attachmentList::iterator iter = (*pArmour)[0]->attachments.begin(); iter != (*pArmour)[0]->attachments.end(); ++iter) { + if (Item[iter->usItem].usItemClass == IC_ARMOUR && (*iter)[0]->data.objectStatus > 0 ) { // bullet got through jacket; apply ceramic plate armour - iTotalProtection += ArmourProtection( pTarget, Item[pArmour->usAttachItem[bPlatePos]].ubClassIndex, &(pArmour->bAttachStatus[bPlatePos]), iImpact, ubAmmoType, &plateHit ); - if ( pArmour->bAttachStatus[bPlatePos] < USABLE ) + iTotalProtection += ArmourProtection( pTarget, Item[iter->usItem].ubClassIndex, &((*iter)[0]->data.objectStatus), iImpact, ubAmmoType, &plateHit ); + if ( (*iter)[0]->data.objectStatus < USABLE ) { // destroy plates! - pArmour->usAttachItem[ bPlatePos ] = NOTHING; - pArmour->bAttachStatus[ bPlatePos ] = 0; + pArmour->RemoveAttachment(&(*iter)); DirtyMercPanelInterface( pTarget, DIRTYLEVEL2 ); -#ifdef ENGLISH +//#ifdef ENGLISH if ( pTarget->bTeam == gbPlayerNum ) { // report plates destroyed! ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[61], pTarget->name ); } -#endif +//#endif } + break;//original code only used the first ceramic plate } - //} + } // if the plate didn't stop the bullet... if ( iImpact > iTotalProtection ) { - iTotalProtection += ArmourProtection( pTarget, Item[pArmour->usItem].ubClassIndex, &(pArmour->ItemData.Generic.bStatus[0]), iImpact, ubAmmoType, &plateHit ); - if ( pArmour->ItemData.Generic.bStatus[ 0 ] < USABLE ) + iTotalProtection += ArmourProtection( pTarget, Item[pArmour->usItem].ubClassIndex, &((*pArmour)[0]->data.objectStatus), iImpact, ubAmmoType, &plateHit ); + if ( (*pArmour)[0]->data.objectStatus < USABLE ) { //Madd: put any attachments that someone might have added to the armour in the merc's inventory - for (int bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++) - { - OBJECTTYPE newObj; - CreateItem(pArmour->usAttachItem[bLoop], pArmour->bAttachStatus[bLoop], &newObj); - if ( !AutoPlaceObject( pTarget, &newObj, FALSE ) ) + for (attachmentList::iterator iter = (*pArmour)[0]->attachments.begin(); iter != (*pArmour)[0]->attachments.end(); ++iter) { + if ( !AutoPlaceObject( pTarget, &(*iter), FALSE ) ) { // put it on the ground - AddItemToPool( pTarget->sGridNo, &newObj, 1, pTarget->bLevel, 0 , -1 ); + AddItemToPool( pTarget->sGridNo, &(*iter), 1, pTarget->pathing.bLevel, 0 , -1 ); } } - DeleteObj( pArmour ); + DeleteObj( pArmour );//takes care of attachments, no need to remove() or erase() DirtyMercPanelInterface( pTarget, DIRTYLEVEL2 ); } } @@ -4385,10 +4433,10 @@ INT32 BulletImpact( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 ubHitLocat } else { - ubAmmoType = pFirer->inv[pFirer->ubAttackingHand].ItemData.Gun.ubGunAmmoType; + ubAmmoType = pFirer->inv[pFirer->ubAttackingHand][0]->data.gun.ubGunAmmoType; } - if ( TANK( pTarget ) ) + if ( TANK( pTarget ) ) { if ( !AmmoTypes[ubAmmoType].antiTank ) { @@ -4399,7 +4447,7 @@ INT32 BulletImpact( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 ubHitLocat // plus/minus up to 25% due to "random" factors (major organs hit or missed, // lucky lighter in breast pocket, divine intervention on behalf of "Rev"...) - iFluke = PreRandom(51) - 25; // gives (0 to 50 -25) -> -25% to +25% + iFluke = PreRandom(51) - 25; // gives (0 to 50 -25)->-25% to +25% //NumMessage("Fluke = ",fluke); // up to 50% extra impact for making particularly accurate successful shots @@ -4420,7 +4468,7 @@ INT32 BulletImpact( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 ubHitLocat // iOrigImpact = AMMO_DAMAGE_ADJUSTMENT_HE( iOrigImpact ); iOrigImpact = (INT32)(iOrigImpact * AmmoTypes[ubAmmoType].beforeArmourDamageMultiplier / max(1,AmmoTypes[ubAmmoType].beforeArmourDamageDivisor) ); - if ( TANK( pTarget ) ) + if ( TANK( pTarget ) ) { // HEAT round on tank, divide by 3 for damage iOrigImpact /= 2; @@ -4469,14 +4517,14 @@ INT32 BulletImpact( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 ubHitLocat { if ( AmmoTypes[ubAmmoType].dart && sHitBy > 20 ) - { + { if (pubSpecial) { *pubSpecial = FIRE_WEAPON_SLEEP_DART_SPECIAL; } return( iImpact ); } - + iImpact = (INT32)(iImpact * AmmoTypes[ubAmmoType].afterArmourDamageMultiplier / max(1,AmmoTypes[ubAmmoType].afterArmourDamageDivisor) ) ; //if (ubAmmoType == AMMO_HP) //{ // good solid hit with a hollow-point bullet, which got through armour! @@ -4491,18 +4539,18 @@ INT32 BulletImpact( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 ubHitLocat // is the blow deadly enough for an instant kill? if ( PythSpacesAway( pFirer->sGridNo, pTarget->sGridNo ) <= MAX_DISTANCE_FOR_MESSY_DEATH || (PythSpacesAway( pFirer->sGridNo, pTarget->sGridNo ) <= MAX_BARRETT_DISTANCE_FOR_MESSY_DEATH && pFirer->usAttackingWeapon == BARRETT )) { - if (iImpactForCrits > MIN_DAMAGE_FOR_INSTANT_KILL && iImpactForCrits < pTarget->bLife) + if (iImpactForCrits > MIN_DAMAGE_FOR_INSTANT_KILL && iImpactForCrits < pTarget->stats.bLife) { // blow to the head is so deadly that it causes instant death; // the target has more life than iImpact so we increase it - iImpact = pTarget->bLife + Random( 10 ); + iImpact = pTarget->stats.bLife + Random( 10 ); iImpactForCrits = iImpact; } if (pubSpecial) { // is the blow deadly enough to cause a head explosion? - if ( iImpactForCrits >= pTarget->bLife ) + if ( iImpactForCrits >= pTarget->stats.bLife ) { if (iImpactForCrits > MIN_DAMAGE_FOR_HEAD_EXPLOSION ) { @@ -4519,9 +4567,9 @@ INT32 BulletImpact( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 ubHitLocat break; case AIM_SHOT_LEGS: // is the damage enough to make us fall over? - if ( pubSpecial && IS_MERC_BODY_TYPE( pTarget ) && gAnimControl[ pTarget->usAnimState ].ubEndHeight == ANIM_STAND && !MercInWater( pTarget) ) + if ( pubSpecial && IS_MERC_BODY_TYPE( pTarget ) && gAnimControl[ pTarget->usAnimState ].ubEndHeight == ANIM_STAND && !pTarget->MercInWater() ) { - if (iImpactForCrits > MIN_DAMAGE_FOR_AUTO_FALL_OVER ) + if (iImpactForCrits > MIN_DAMAGE_FOR_AUTO_FALL_OVER ) { *pubSpecial = FIRE_WEAPON_LEG_FALLDOWN_SPECIAL; } @@ -4531,31 +4579,31 @@ INT32 BulletImpact( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 ubHitLocat *pubSpecial = FIRE_WEAPON_LEG_FALLDOWN_SPECIAL; } } - break; + break; case AIM_SHOT_TORSO: // normal damage to torso // is the blow deadly enough for an instant kill? // since this value is much lower than the others, it only applies at short range... if ( PythSpacesAway( pFirer->sGridNo, pTarget->sGridNo ) <= MAX_DISTANCE_FOR_MESSY_DEATH || (PythSpacesAway( pFirer->sGridNo, pTarget->sGridNo ) <= MAX_BARRETT_DISTANCE_FOR_MESSY_DEATH && pFirer->usAttackingWeapon == BARRETT )) { - if (iImpact > MIN_DAMAGE_FOR_INSTANT_KILL && iImpact < pTarget->bLife) + if (iImpact > MIN_DAMAGE_FOR_INSTANT_KILL && iImpact < pTarget->stats.bLife) { // blow to the chest is so deadly that it causes instant death; // the target has more life than iImpact so we increase it - iImpact = pTarget->bLife + Random( 10 ); + iImpact = pTarget->stats.bLife + Random( 10 ); iImpactForCrits = iImpact; } // special thing for hitting chest - allow cumulative damage to count else if ( (iImpact + pTarget->sDamage) > (MIN_DAMAGE_FOR_BLOWN_AWAY + MIN_DAMAGE_FOR_INSTANT_KILL) ) { - iImpact = pTarget->bLife + Random( 10 ); + iImpact = pTarget->stats.bLife + Random( 10 ); iImpactForCrits = iImpact; } // is the blow deadly enough to cause a chest explosion? if (pubSpecial) { - if (iImpact > MIN_DAMAGE_FOR_BLOWN_AWAY && iImpact >= pTarget->bLife) + if (iImpact > MIN_DAMAGE_FOR_BLOWN_AWAY && iImpact >= pTarget->stats.bLife) { *pubSpecial = FIRE_WEAPON_CHEST_EXPLODE_SPECIAL; } @@ -4569,51 +4617,51 @@ INT32 BulletImpact( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 ubHitLocat { iImpactForCrits = 0; } - + // don't do critical hits against people who are gonna die! if( !IsAutoResolveActive() ) { - if ( AmmoTypes[ubAmmoType].knife && pFirer->bOppList[ pTarget->ubID ] == SEEN_CURRENTLY ) + if ( AmmoTypes[ubAmmoType].knife && pFirer->aiData.bOppList[ pTarget->ubID ] == SEEN_CURRENTLY ) { // is this a stealth attack? - if ( pTarget->bOppList[ pFirer->ubID ] == NOT_HEARD_OR_SEEN && !CREATURE_OR_BLOODCAT( pTarget ) && (ubHitLocation == AIM_SHOT_HEAD || ubHitLocation == AIM_SHOT_TORSO ) ) + if ( pTarget->aiData.bOppList[ pFirer->ubID ] == NOT_HEARD_OR_SEEN && !CREATURE_OR_BLOODCAT( pTarget ) && (ubHitLocation == AIM_SHOT_HEAD || ubHitLocation == AIM_SHOT_TORSO ) ) { if ( PreRandom( 100 ) < (UINT32)(sHitBy + 10 * NUM_SKILL_TRAITS( pFirer, THROWING )) ) { - // instant death! - iImpact = pTarget->bLife + Random( 10 ); + // instant death! + iImpact = pTarget->stats.bLife + Random( 10 ); iImpactForCrits = iImpact; } } } - if (iImpactForCrits > 0 && iImpactForCrits < pTarget->bLife ) + if (iImpactForCrits > 0 && iImpactForCrits < pTarget->stats.bLife ) { - if (PreRandom( iImpactForCrits / 2 + pFirer->bAimTime * 5) + 1 > CRITICAL_HIT_THRESHOLD) + if (PreRandom( iImpactForCrits / 2 + pFirer->aiData.bAimTime * 5) + 1 > CRITICAL_HIT_THRESHOLD) { bStatLoss = (INT8) PreRandom( iImpactForCrits / 2 ) + 1; switch( ubHitLocation ) { case AIM_SHOT_HEAD: - if (bStatLoss >= pTarget->bWisdom) + if (bStatLoss >= pTarget->stats.bWisdom) { - bStatLoss = pTarget->bWisdom - 1; + bStatLoss = pTarget->stats.bWisdom - 1; } if ( bStatLoss > 0 ) { - pTarget->bWisdom -= bStatLoss; + pTarget->stats.bWisdom -= bStatLoss; if (pTarget->ubProfile != NO_PROFILE) { - gMercProfiles[ pTarget->ubProfile ].bWisdom = pTarget->bWisdom; + gMercProfiles[ pTarget->ubProfile ].bWisdom = pTarget->stats.bWisdom; } if (pTarget->name[0] && pTarget->bVisible == TRUE) { // make stat RED for a while... - pTarget->uiChangeWisdomTime = GetJA2Clock(); + pTarget->timeChanges.uiChangeWisdomTime = GetJA2Clock(); pTarget->usValueGoneUp &= ~( WIS_INCREASE ); if (bStatLoss == 1) @@ -4632,25 +4680,25 @@ INT32 BulletImpact( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 ubHitLocat } break; case AIM_SHOT_TORSO: - if (PreRandom( 1 ) == 0 && !(pTarget->uiStatusFlags & SOLDIER_MONSTER) ) + if (PreRandom( 1 ) == 0 && !(pTarget->flags.uiStatusFlags & SOLDIER_MONSTER) ) { - if (bStatLoss >= pTarget->bDexterity) + if (bStatLoss >= pTarget->stats.bDexterity) { - bStatLoss = pTarget->bDexterity - 1; + bStatLoss = pTarget->stats.bDexterity - 1; } if ( bStatLoss > 0 ) { - pTarget->bDexterity -= bStatLoss; + pTarget->stats.bDexterity -= bStatLoss; if (pTarget->ubProfile != NO_PROFILE) { - gMercProfiles[ pTarget->ubProfile ].bDexterity = pTarget->bDexterity; + gMercProfiles[ pTarget->ubProfile ].bDexterity = pTarget->stats.bDexterity; } if (pTarget->name[0] && pTarget->bVisible == TRUE) { // make stat RED for a while... - pTarget->uiChangeDexterityTime = GetJA2Clock(); + pTarget->timeChanges.uiChangeDexterityTime = GetJA2Clock(); pTarget->usValueGoneUp &= ~( DEX_INCREASE ); if (bStatLoss == 1) @@ -4666,23 +4714,23 @@ INT32 BulletImpact( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 ubHitLocat } else { - if (bStatLoss >= pTarget->bStrength) + if (bStatLoss >= pTarget->stats.bStrength) { - bStatLoss = pTarget->bStrength - 1; + bStatLoss = pTarget->stats.bStrength - 1; } if ( bStatLoss > 0 ) { - pTarget->bStrength -= bStatLoss; + pTarget->stats.bStrength -= bStatLoss; if (pTarget->ubProfile != NO_PROFILE) { - gMercProfiles[ pTarget->ubProfile ].bStrength = pTarget->bStrength; + gMercProfiles[ pTarget->ubProfile ].bStrength = pTarget->stats.bStrength; } if (pTarget->name[0] && pTarget->bVisible == TRUE) { // make stat RED for a while... - pTarget->uiChangeStrengthTime = GetJA2Clock(); + pTarget->timeChanges.uiChangeStrengthTime = GetJA2Clock(); pTarget->usValueGoneUp &= ~( STRENGTH_INCREASE ); if (bStatLoss == 1) @@ -4698,23 +4746,23 @@ INT32 BulletImpact( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 ubHitLocat } break; case AIM_SHOT_LEGS: - if (bStatLoss >= pTarget->bAgility) + if (bStatLoss >= pTarget->stats.bAgility) { - bStatLoss = pTarget->bAgility - 1; - } + bStatLoss = pTarget->stats.bAgility - 1; + } if ( bStatLoss > 0 ) - { - pTarget->bAgility -= bStatLoss; + { + pTarget->stats.bAgility -= bStatLoss; if (pTarget->ubProfile != NO_PROFILE) { - gMercProfiles[ pTarget->ubProfile ].bAgility = pTarget->bAgility; + gMercProfiles[ pTarget->ubProfile ].bAgility = pTarget->stats.bAgility; } if (pTarget->name[0] && pTarget->bVisible == TRUE) { // make stat RED for a while... - pTarget->uiChangeAgilityTime = GetJA2Clock(); + pTarget->timeChanges.uiChangeAgilityTime = GetJA2Clock(); pTarget->usValueGoneUp &= ~( AGIL_INCREASE ); if (bStatLoss == 1) @@ -4732,7 +4780,7 @@ INT32 BulletImpact( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 ubHitLocat } else if ( ubHitLocation == AIM_SHOT_HEAD && pTarget->bNumPelletsHitBy == 0 ) { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[STR_HEAD_HIT], pTarget->name ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[STR_HEAD_HIT], pTarget->name ); } } } @@ -4781,11 +4829,11 @@ INT32 HTHImpact( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTarget, INT32 iHitBy, BO } } - + iFluke = PreRandom( 51 ) - 25; // +/-25% bonus due to random factors iBonus = iHitBy / 2; // up to 50% extra impact for accurate attacks - + iImpact = iImpact * (100 + iFluke + iBonus) / 100; if (!fBladeAttack) @@ -4799,12 +4847,12 @@ INT32 HTHImpact( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTarget, INT32 iHitBy, BO iImpact *= 2; } } - if ( HAS_SKILL_TRAIT( pSoldier, HANDTOHAND ) ) + if ( HAS_SKILL_TRAIT( pSoldier, HANDTOHAND ) ) { // SPECIAL - give TRIPLE bonus for damage for hand-to-hand trait // because the HTH bonus is half that of martial arts, and gets only 1x for to-hit bonus iImpact = iImpact * ( 100 + 3 * gbSkillTraitBonus[HANDTOHAND] * NUM_SKILL_TRAITS( pSoldier, HANDTOHAND ) ) / 100; - } + } } return( iImpact ); @@ -4845,17 +4893,17 @@ void ShotMiss( UINT8 ubAttackerID, INT32 iBullet ) { if ( Random(40) == 0 ) { - DoMercBattleSound( MercPtrs[ ubAttackerID ], BATTLE_SOUND_CURSE1 ); + MercPtrs[ ubAttackerID ]->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); } } fDoMissForGun = TRUE; break; case MONSTERCLASS: - PlayJA2Sample( SPIT_RICOCHET, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); + PlayJA2Sample( SPIT_RICOCHET, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); break; } - + if ( fDoMissForGun ) { // PLAY SOUND AND FLING DEBRIS @@ -4863,7 +4911,7 @@ void ShotMiss( UINT8 ubAttackerID, INT32 iBullet ) if ( !DoSpecialEffectAmmoMiss( ubAttackerID, NOWHERE, 0, 0, 0, TRUE, TRUE, 0 ) ) { - PlayJA2Sample( MISS_1 + Random(8), RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); + PlayJA2Sample( MISS_1 + Random(8), RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); } // ATE: Show misses...( if our team ) @@ -4892,10 +4940,10 @@ UINT32 CalcChanceHTH( SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, UINT8 ubAi usInHand = pAttacker->usAttackingWeapon; - if ( (usInHand != CREATURE_QUEEN_TENTACLES ) && (pDefender->bLife < OKLIFE || pDefender->bBreath < OKBREATH) ) + if ( (usInHand != CREATURE_QUEEN_TENTACLES ) && (pDefender->stats.bLife < OKLIFE || pDefender->bBreath < OKBREATH) ) { // there is NO way to miss - return( 100 ); + return( 100 ); } if (ubMode == HTH_MODE_STAB) @@ -4923,14 +4971,14 @@ UINT32 CalcChanceHTH( SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, UINT8 ubAi // this is more of a brute force strength-vs-strength check iAttRating = ( EffectiveDexterity( pAttacker ) + // coordination, accuracy EffectiveAgility( pAttacker ) + // speed & reflexes - 3 * pAttacker->bStrength + // physical strength (TRIPLED!) + 3 * pAttacker->stats.bStrength + // physical strength (TRIPLED!) (10 * EffectiveExpLevel( pAttacker ) ) ); // experience, knowledge } else { iAttRating = (3 * EffectiveDexterity( pAttacker ) + // coordination, accuracy (TRIPLED!) EffectiveAgility( pAttacker ) + // speed & reflexes - pAttacker->bStrength + // physical strength + pAttacker->stats.bStrength + // physical strength (10 * EffectiveExpLevel( pAttacker ) ) ); // experience, knowledge } @@ -4956,13 +5004,13 @@ UINT32 CalcChanceHTH( SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, UINT8 ubAi iAttRating += ((AIM_BONUS_PER_AP * ubAimTime) / 2); //bonus for aiming } - if (! (pAttacker->uiStatusFlags & SOLDIER_PC) ) // if attacker is a computer AI controlled enemy + if (! (pAttacker->flags.uiStatusFlags & SOLDIER_PC) ) // if attacker is a computer AI controlled enemy { iAttRating += gbDiff[ DIFF_ENEMY_TO_HIT_MOD ][ SoldierDifficultyLevel( pAttacker ) ]; } // if attacker is being affected by gas - if ( pAttacker->uiStatusFlags & SOLDIER_GASSED ) + if ( pAttacker->flags.uiStatusFlags & SOLDIER_GASSED ) iAttRating -= AIM_PENALTY_GASSED; // if attacker is being bandaged at the same time, his concentration is off @@ -4970,8 +5018,8 @@ UINT32 CalcChanceHTH( SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, UINT8 ubAi iAttRating -= AIM_PENALTY_GETTINGAID; // if attacker is still in shock - if (pAttacker->bShock) - iAttRating -= (pAttacker->bShock * AIM_PENALTY_PER_SHOCK); + if (pAttacker->aiData.bShock) + iAttRating -= (pAttacker->aiData.bShock * AIM_PENALTY_PER_SHOCK); /* // if the attacker is an A.I.M. mercenary @@ -4980,13 +5028,13 @@ UINT32 CalcChanceHTH( SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, UINT8 ubAi */ // If attacker injured, reduce chance accordingly (by up to 2/3rds) - if ((iAttRating > 0) && (pAttacker->bLife < pAttacker->bLifeMax)) + if ((iAttRating > 0) && (pAttacker->stats.bLife < pAttacker->stats.bLifeMax)) { // if bandaged, give 1/2 of the bandaged life points back into equation - ubBandaged = pAttacker->bLifeMax - pAttacker->bLife - pAttacker->bBleeding; + ubBandaged = pAttacker->stats.bLifeMax - pAttacker->stats.bLife - pAttacker->bBleeding; - iAttRating -= (2 * iAttRating * (pAttacker->bLifeMax - pAttacker->bLife + (ubBandaged / 2))) / - (3 * pAttacker->bLifeMax); + iAttRating -= (2 * iAttRating * (pAttacker->stats.bLifeMax - pAttacker->stats.bLife + (ubBandaged / 2))) / + (3 * pAttacker->stats.bLifeMax); } // If attacker tired, reduce chance accordingly (by up to 1/2) @@ -4997,7 +5045,7 @@ UINT32 CalcChanceHTH( SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, UINT8 ubAi { if (ubMode == HTH_MODE_STAB) { - if (HAS_SKILL_TRAIT( pAttacker, KNIFING )) + if (HAS_SKILL_TRAIT( pAttacker, KNIFING )) { iAttRating += gbSkillTraitBonus[KNIFING] * NUM_SKILL_TRAITS( pAttacker, KNIFING ); } @@ -5026,17 +5074,17 @@ UINT32 CalcChanceHTH( SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, UINT8 ubAi { iDefRating = (EffectiveAgility( pDefender )) + // speed & reflexes EffectiveDexterity( pDefender ) + // coordination, accuracy - 3 * pDefender->bStrength + // physical strength (TRIPLED!) + 3 * pDefender->stats.bStrength + // physical strength (TRIPLED!) (10 * EffectiveExpLevel( pDefender ) ); // experience, knowledge } else { iDefRating = (3 * EffectiveAgility( pDefender ) ) + // speed & reflexes (TRIPLED!) EffectiveDexterity( pDefender ) + // coordination, accuracy - pDefender->bStrength + // physical strength + pDefender->stats.bStrength + // physical strength (10 * EffectiveExpLevel( pDefender ) ); // experience, knowledge } - + iDefRating /= 6; // convert from 6-600 to 1-100 // modify chance to dodge by morale @@ -5046,7 +5094,7 @@ UINT32 CalcChanceHTH( SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, UINT8 ubAi iDefRating -= GetSkillCheckPenaltyForFatigue( pDefender, iDefRating ); // if attacker is being affected by gas - if ( pDefender->uiStatusFlags & SOLDIER_GASSED ) + if ( pDefender->flags.uiStatusFlags & SOLDIER_GASSED ) iDefRating -= AIM_PENALTY_GASSED; // if defender is being bandaged at the same time, his concentration is off @@ -5054,8 +5102,8 @@ UINT32 CalcChanceHTH( SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, UINT8 ubAi iDefRating -= AIM_PENALTY_GETTINGAID; // if defender is still in shock - if (pDefender->bShock) - iDefRating -= (pDefender->bShock * AIM_PENALTY_PER_SHOCK); + if (pDefender->aiData.bShock) + iDefRating -= (pDefender->aiData.bShock * AIM_PENALTY_PER_SHOCK); /* // if the defender is an A.I.M. mercenary @@ -5064,13 +5112,13 @@ UINT32 CalcChanceHTH( SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, UINT8 ubAi */ // If defender injured, reduce chance accordingly (by up to 2/3rds) - if ((iDefRating > 0) && (pDefender->bLife < pDefender->bLifeMax)) + if ((iDefRating > 0) && (pDefender->stats.bLife < pDefender->stats.bLifeMax)) { // if bandaged, give 1/2 of the bandaged life points back into equation - ubBandaged = pDefender->bLifeMax - pDefender->bLife - pDefender->bBleeding; + ubBandaged = pDefender->stats.bLifeMax - pDefender->stats.bLife - pDefender->bBleeding; - iDefRating -= (2 * iDefRating * (pDefender->bLifeMax - pDefender->bLife + (ubBandaged / 2))) / - (3 * pDefender->bLifeMax); + iDefRating -= (2 * iDefRating * (pDefender->stats.bLifeMax - pDefender->stats.bLife + (ubBandaged / 2))) / + (3 * pDefender->stats.bLifeMax); } @@ -5090,7 +5138,7 @@ UINT32 CalcChanceHTH( SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, UINT8 ubAi { if ( gAnimControl[ pDefender->usAnimState ].ubEndHeight == ANIM_PRONE ) { - // make it well-nigh impossible to hit someone who is prone! + // make it well-nigh impossible to hit someone who is prone! iDefRating += 1000; } else @@ -5126,7 +5174,7 @@ UINT32 CalcChanceHTH( SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, UINT8 ubAi { // the knife gets in the way but we're still better than nobody iDefRating += ( gbSkillTraitBonus[MARTIALARTS] * NUM_SKILL_TRAITS( pDefender, MARTIALARTS ) ) / 3; - } + } } else { @@ -5145,7 +5193,7 @@ UINT32 CalcChanceHTH( SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, UINT8 ubAi else { // punch/hand-to-hand/martial arts attack/steal if (Item[pDefender->inv[HANDPOS].usItem].usItemClass == IC_BLADE && ubMode != HTH_MODE_STEAL) - { + { if (HAS_SKILL_TRAIT( pDefender, KNIFING )) { // with our knife, we get some bonus at defending from HTH attacks @@ -5175,11 +5223,11 @@ UINT32 CalcChanceHTH( SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, UINT8 ubAi // calculate chance to hit by comparing the 2 opponent's ratings // iChance = (100 * iAttRating) / (iAttRating + iDefRating); - + if (ubMode == HTH_MODE_STEAL) { - // make this more extreme so that weak people have a harder time stealing from + // make this more extreme so that weak people have a harder time stealing from // the stronger iChance = 50 * iAttRating / iDefRating; } @@ -5233,38 +5281,43 @@ void ReloadWeapon( SOLDIERTYPE *pSoldier, UINT8 ubHandPos ) { // NB this is a cheat function, don't award experience - if ( pSoldier->inv[ ubHandPos ].usItem != NOTHING ) + if ( pSoldier->inv[ ubHandPos ].exists() == true ) { - pSoldier->inv[ ubHandPos ].ItemData.Gun.ubGunShotsLeft = GetMagSize(&pSoldier->inv[ ubHandPos ]); + pSoldier->inv[ ubHandPos ][0]->data.gun.ubGunShotsLeft = GetMagSize(&pSoldier->inv[ ubHandPos ]); // Dirty Bars DirtyMercPanelInterface( pSoldier, DIRTYLEVEL1 ); } } - - -BOOLEAN IsGunWeaponModeCapable( SOLDIERTYPE *pSoldier, UINT8 ubHandPos , UINT8 bWpnMode) +// Changed by ADB, rev 1513 +//BOOLEAN IsGunWeaponModeCapable( SOLDIERTYPE *pSoldier, UINT8 ubHandPos , UINT8 bWpnMode) +BOOLEAN IsGunWeaponModeCapable( OBJECTTYPE* pObject, WeaponMode bWpnMode, SOLDIERTYPE *pSoldier ) { DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("IsGunWeaponModeCapable: weapon mode=%d",bWpnMode)); switch(bWpnMode) { case WM_NORMAL: - return (pSoldier->inv[ ubHandPos ].usItem != NOTHING && Item[ pSoldier->inv[ ubHandPos ].usItem ].usItemClass & IC_WEAPON && !Weapon[ pSoldier->inv[ ubHandPos ].usItem ].NoSemiAuto ); // Check for being a weapon.... + //return (pSoldier->inv[ ubHandPos ].exists() == true && Item[ pSoldier->inv[ ubHandPos ].usItem ].usItemClass & IC_WEAPON && !Weapon[ pSoldier->inv[ ubHandPos ].usItem ].NoSemiAuto ); // Check for being a weapon.... + return (pObject->exists() == true && Item[ pObject->usItem ].usItemClass & IC_WEAPON && !Weapon[ pObject->usItem ].NoSemiAuto ); // Check for being a weapon.... case WM_BURST: - return IsGunBurstCapable(pSoldier, ubHandPos, FALSE); + //return IsGunBurstCapable(pSoldier, ubHandPos, FALSE); + return IsGunBurstCapable(pObject, FALSE, pSoldier); case WM_AUTOFIRE: - return ((IsGunAutofireCapable(pSoldier, ubHandPos) || Weapon[ pSoldier->inv[ ubHandPos ].usItem ].NoSemiAuto )&& !Item[pSoldier->inv[ubHandPos].usItem].grenadelauncher ); + //return ((IsGunAutofireCapable(pSoldier, ubHandPos) || Weapon[ pSoldier->inv[ ubHandPos ].usItem ].NoSemiAuto )&& !Item[pSoldier->inv[ubHandPos].usItem].grenadelauncher ); + return ((IsGunAutofireCapable(pObject) || Weapon[ pObject->usItem ].NoSemiAuto )&& !Item[pObject->usItem].grenadelauncher ); case WM_ATTACHED_GL: -// return (FindAttachment( &(pSoldier->inv[ubHandPos]), UNDER_GLAUNCHER ) != ITEM_NOT_FOUND && FindLaunchableAttachment( &(pSoldier->inv[ubHandPos]), UNDER_GLAUNCHER ) != ITEM_NOT_FOUND ); - - return (!Item[pSoldier->inv[ubHandPos].usItem].grenadelauncher && IsGrenadeLauncherAttached( &(pSoldier->inv[ubHandPos]) ) && FindLaunchableAttachment( &(pSoldier->inv[ubHandPos]), GetAttachedGrenadeLauncher( &(pSoldier->inv[ubHandPos]) )) != ITEM_NOT_FOUND ); - +// return (FindAttachment( &(pSoldier->inv[ubHandPos]), UNDER_GLAUNCHER ) != 0 && FindLaunchableAttachment( &(pSoldier->inv[ubHandPos]), UNDER_GLAUNCHER ) != 0 ); + + //return (!Item[pSoldier->inv[ubHandPos].usItem].grenadelauncher && IsGrenadeLauncherAttached( &(pSoldier->inv[ubHandPos]) ) && FindLaunchableAttachment( &(pSoldier->inv[ubHandPos]), GetAttachedGrenadeLauncher( &(pSoldier->inv[ubHandPos]) )) != 0 ); + return (!Item[pObject->usItem].grenadelauncher && IsGrenadeLauncherAttached( pObject ) && FindLaunchableAttachment( pObject, GetAttachedGrenadeLauncher( pObject )) != 0 ); + case WM_ATTACHED_GL_BURST: - return (!Item[pSoldier->inv[ubHandPos].usItem].grenadelauncher && IsGrenadeLauncherAttached( &(pSoldier->inv[ubHandPos]) ) && Weapon[GetAttachedGrenadeLauncher(&pSoldier->inv[ubHandPos])].ubShotsPerBurst > 0 && FindLaunchableAttachment( &(pSoldier->inv[ubHandPos]), GetAttachedGrenadeLauncher( &(pSoldier->inv[ubHandPos]))) != ITEM_NOT_FOUND ); + //return (!Item[pSoldier->inv[ubHandPos].usItem].grenadelauncher && IsGrenadeLauncherAttached( &(pSoldier->inv[ubHandPos]) ) && Weapon[GetAttachedGrenadeLauncher(&pSoldier->inv[ubHandPos])].ubShotsPerBurst > 0 && FindLaunchableAttachment( &(pSoldier->inv[ubHandPos]), GetAttachedGrenadeLauncher( &(pSoldier->inv[ubHandPos]))) != 0 ); + return (!Item[pObject->usItem].grenadelauncher && IsGrenadeLauncherAttached( pObject ) && Weapon[GetAttachedGrenadeLauncher(pObject)].ubShotsPerBurst > 0 && FindLaunchableAttachment( pObject, GetAttachedGrenadeLauncher( pObject)) != 0 ); case WM_ATTACHED_GL_AUTO: return FALSE; @@ -5275,16 +5328,21 @@ BOOLEAN IsGunWeaponModeCapable( SOLDIERTYPE *pSoldier, UINT8 ubHandPos , UINT8 b } } -BOOLEAN IsGunAutofireCapable( SOLDIERTYPE *pSoldier, UINT8 ubHandPos ) +// Changed by ADB, rev 1513 +//BOOLEAN IsGunAutofireCapable( SOLDIERTYPE *pSoldier, UINT8 ubHandPos ) +BOOLEAN IsGunAutofireCapable( OBJECTTYPE* pObject ) { BOOLEAN fCapable = FALSE; - if ( pSoldier->inv[ ubHandPos ].usItem != NOTHING ) + //if ( pSoldier->inv[ ubHandPos ].exists() == true ) + if ( pObject->exists() == true ) { // ATE: Check for being a weapon.... - if ( Item[ pSoldier->inv[ ubHandPos ].usItem ].usItemClass & IC_WEAPON ) + //if ( Item[ pSoldier->inv[ ubHandPos ].usItem ].usItemClass & IC_WEAPON ) + if ( Item[ pObject->usItem ].usItemClass & IC_WEAPON ) { - if ( GetAutofireShotsPerFiveAPs(&pSoldier->inv[ ubHandPos ]) > 0 ) + //if ( GetAutofireShotsPerFiveAPs(&pSoldier->inv[ ubHandPos ]) > 0 ) + if ( GetAutofireShotsPerFiveAPs(pObject) > 0 ) { fCapable = TRUE; } @@ -5294,30 +5352,98 @@ BOOLEAN IsGunAutofireCapable( SOLDIERTYPE *pSoldier, UINT8 ubHandPos ) return( fCapable ); } -BOOLEAN IsGunBurstCapable( SOLDIERTYPE *pSoldier, UINT8 ubHandPos , BOOLEAN fNotify ) +// Changed by ADB, rev 1513 +//BOOLEAN IsGunBurstCapable( SOLDIERTYPE *pSoldier, UINT8 ubHandPos , BOOLEAN fNotify ) +BOOLEAN IsGunBurstCapable(OBJECTTYPE* pObject, BOOLEAN fNotify, SOLDIERTYPE* pSoldier ) { BOOLEAN fCapable = FALSE; - if ( pSoldier->inv[ ubHandPos ].usItem != NOTHING ) + //if ( pSoldier->inv[ ubHandPos ].exists() == true ) + if ( pObject->exists() == true ) { // ATE: Check for being a weapon.... - if ( Item[ pSoldier->inv[ ubHandPos ].usItem ].usItemClass & IC_WEAPON ) + //if ( Item[ pSoldier->inv[ ubHandPos ].usItem ].usItemClass & IC_WEAPON ) + if ( Item[ pObject->usItem ].usItemClass & IC_WEAPON ) { - if ( GetShotsPerBurst(&pSoldier->inv[ ubHandPos ]) > 0 ) + //if ( GetShotsPerBurst(&pSoldier->inv[ ubHandPos ]) > 0 ) + if ( GetShotsPerBurst(pObject) > 0 ) { fCapable = TRUE; } } } - if ( fNotify && !fCapable ) + //ADB fNotify is always false, so notify and pSoldier are not necessary parameters + if ( fNotify && !fCapable && pSoldier != NULL ) { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, Message[ STR_NOT_BURST_CAPABLE ], pSoldier->name ); + //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, Message[ STR_NOT_BURST_CAPABLE ], pSoldier->name ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, Message[ STR_NOT_BURST_CAPABLE ], pSoldier->name ); } return( fCapable ); } +void HandleTacticalEffectsOfEquipmentChange( SOLDIERTYPE *pSoldier, UINT32 uiInvPos, UINT16 usOldItem, UINT16 usNewItem ) +{ +#ifdef ADB_TODO + SetBurstAndAutoFireMode(pSoldier, GetWeaponMode(&pSoldier->inv[uiInvPos])); +#endif + // if in attached weapon mode and don't have weapon with GL attached in hand, reset weapon mode + if ( (pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO )&& !IsGrenadeLauncherAttached( &(pSoldier->inv[ HANDPOS ]) ) ) + { + if ( !Weapon[pSoldier->inv[ HANDPOS ].usItem].NoSemiAuto ) + { + pSoldier->bWeaponMode = WM_NORMAL; + pSoldier->bDoBurst = FALSE; + pSoldier->bDoAutofire = 0; + } + else + { + pSoldier->bWeaponMode = WM_AUTOFIRE; + pSoldier->bDoBurst = TRUE; + pSoldier->bDoAutofire = 1; + } + } + + // if he is loaded tactically + if ( pSoldier->bInSector ) + { + // If this is our main hand + if ( uiInvPos == HANDPOS || uiInvPos == SECONDHANDPOS ) + { + // check if we need to change animation! + pSoldier->ReLoadSoldierAnimationDueToHandItemChange( usOldItem, usNewItem ); + } + + // if this is head gear + if ( uiInvPos == HEAD1POS || uiInvPos == HEAD2POS ) + { + // Could be because of GOGGLES change... Re-create light... + pSoldier->DeleteSoldierLight( ); + pSoldier->PositionSoldierLight( ); + } + } + else + { + // as a minimum + if ( (Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass & IC_WEAPON) && GetShotsPerBurst(&pSoldier->inv[ HANDPOS ]) == 0 ) + { + if ( !Weapon[pSoldier->inv[ HANDPOS ].usItem].NoSemiAuto ) + { + pSoldier->bWeaponMode = WM_NORMAL; + pSoldier->bDoBurst = FALSE; + pSoldier->bDoAutofire = 0; + } + else + { + pSoldier->bWeaponMode = WM_AUTOFIRE; + pSoldier->bDoAutofire = 1; + pSoldier->bDoBurst = TRUE; + } + } + } +} + INT32 CalcMaxTossRange( SOLDIERTYPE * pSoldier, UINT16 usItem, BOOLEAN fArmed ) { @@ -5367,14 +5493,14 @@ INT32 CalcMaxTossRange( SOLDIERTYPE * pSoldier, UINT16 usItem, BOOLEAN fArmed ) // start with the range based on the soldier's strength and the item's weight iRange = 2 + ( ( EffectiveStrength( pSoldier ) / ( 5 + Item[usItem].ubWeight) ) ); } - + // adjust for thrower's remaining breath (lose up to 1/2 of range) iRange -= (iRange * (100 - pSoldier->bBreath)) / 200; if ( HAS_SKILL_TRAIT( pSoldier, THROWING ) ) { // better max range due to expertise - iRange = iRange * (100 + gbSkillTraitBonus[THROWING] * NUM_SKILL_TRAITS( pSoldier, THROWING ) ) / 100; + iRange = iRange * (100 + gbSkillTraitBonus[THROWING] * NUM_SKILL_TRAITS( pSoldier, THROWING ) ) / 100; } // Adjust for thrower's stance @@ -5437,7 +5563,7 @@ UINT32 CalcThrownChanceToHit(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAimTi { // MECHANICALLY FIRED arced projectile (ie. mortar), need brains & know-how - iChance = ( EffectiveDexterity( pSoldier ) + EffectiveMarksmanship( pSoldier ) + EffectiveWisdom( pSoldier ) + pSoldier->bExpLevel ) / 4; + iChance = ( EffectiveDexterity( pSoldier ) + EffectiveMarksmanship( pSoldier ) + EffectiveWisdom( pSoldier ) + pSoldier->stats.bExpLevel ) / 4; // heavy weapons trait helps out if (HAS_SKILL_TRAIT( pSoldier, HEAVY_WEAPS )) @@ -5486,7 +5612,7 @@ UINT32 CalcThrownChanceToHit(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAimTi */ // if shooter is being affected by gas - if ( pSoldier->uiStatusFlags & SOLDIER_GASSED ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) { iChance -= AIM_PENALTY_GASSED; } @@ -5498,9 +5624,9 @@ UINT32 CalcThrownChanceToHit(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAimTi } // if shooter is still in shock - if (pSoldier->bShock) + if (pSoldier->aiData.bShock) { - iChance -= (pSoldier->bShock * AIM_PENALTY_PER_SHOCK); + iChance -= (pSoldier->aiData.bShock * AIM_PENALTY_PER_SHOCK); } // calculate actual range (in world units) @@ -5545,14 +5671,14 @@ UINT32 CalcThrownChanceToHit(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAimTi } // IF CHANCE EXISTS, BUT ATTACKER IS INJURED - if ((iChance > 0) && (pSoldier->bLife < pSoldier->bLifeMax)) + if ((iChance > 0) && (pSoldier->stats.bLife < pSoldier->stats.bLifeMax)) { // if bandaged, give 1/2 of the bandaged life points back into equation - bBandaged = pSoldier->bLifeMax - pSoldier->bLife - pSoldier->bBleeding; + bBandaged = pSoldier->stats.bLifeMax - pSoldier->stats.bLife - pSoldier->bBleeding; // injury penalty is based on % damage taken (max 2/3rds iChance) - bPenalty = (2 * iChance * (pSoldier->bLifeMax - pSoldier->bLife + (bBandaged / 2))) / - (3 * pSoldier->bLifeMax); + bPenalty = (2 * iChance * (pSoldier->stats.bLifeMax - pSoldier->stats.bLife + (bBandaged / 2))) / + (3 * pSoldier->stats.bLifeMax); // for mechanically-fired projectiles, reduce penalty in half if ( Item[ usHandItem ].usItemClass == IC_LAUNCHER ) @@ -5581,7 +5707,7 @@ UINT32 CalcThrownChanceToHit(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAimTi // if iChance exists, but it's a mechanical item being used if ((iChance > 0) && (Item[ usHandItem ].usItemClass == IC_LAUNCHER )) // reduce iChance to hit DIRECTLY by the item's working condition - iChance = (iChance * WEAPON_STATUS_MOD(pSoldier->inv[HANDPOS].ItemData.Generic.bStatus[0])) / 100; + iChance = (iChance * WEAPON_STATUS_MOD(pSoldier->inv[HANDPOS][0]->data.objectStatus)) / 100; // MAKE SURE CHANCE TO HIT IS WITHIN DEFINED LIMITS if (iChance < MINCHANCETOHIT) @@ -5617,7 +5743,9 @@ void ChangeWeaponMode( SOLDIERTYPE * pSoldier ) pSoldier->bWeaponMode = WM_NORMAL; } } - while(IsGunWeaponModeCapable( pSoldier, HANDPOS, pSoldier->bWeaponMode ) == FALSE && pSoldier->bWeaponMode != WM_NORMAL); + // Changed by ADB, rev 1513 + //while(IsGunWeaponModeCapable( pSoldier, HANDPOS, pSoldier->bWeaponMode ) == FALSE && pSoldier->bWeaponMode != WM_NORMAL); + while(IsGunWeaponModeCapable( &pSoldier->inv[HANDPOS], static_cast(pSoldier->bWeaponMode), pSoldier ) == FALSE && pSoldier->bWeaponMode != WM_NORMAL); if (pSoldier->bWeaponMode == WM_AUTOFIRE || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO ) { @@ -5635,7 +5763,8 @@ void ChangeWeaponMode( SOLDIERTYPE * pSoldier ) pSoldier->bDoAutofire = 0; } - pSoldier->fDoSpread = 0; + // Changed by ADB, rev 1513 + //pSoldier->flags.fDoSpread = 0; DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); gfUIForceReExamineCursorData = TRUE; @@ -5664,7 +5793,7 @@ void DishoutQueenSwipeDamage( SOLDIERTYPE *pQueenSoldier ) if ( pSoldier->ubID != pQueenSoldier->ubID ) { // ATE: Ok, lets check for some basic things here! - if ( pSoldier->bLife >= OKLIFE && pSoldier->sGridNo != NOWHERE && pSoldier->bActive && pSoldier->bInSector ) + if ( pSoldier->stats.bLife >= OKLIFE && pSoldier->sGridNo != NOWHERE && pSoldier->bActive && pSoldier->bInSector ) { // Get Pyth spaces away.... if ( GetRangeInCellCoordsFromGridNoDiff( pQueenSoldier->sGridNo, pSoldier->sGridNo ) <= Weapon[ CREATURE_QUEEN_TENTACLES].usRange ) @@ -5672,10 +5801,10 @@ void DishoutQueenSwipeDamage( SOLDIERTYPE *pQueenSoldier ) // get direction bDir = (INT8)GetDirectionFromGridNo( pSoldier->sGridNo, pQueenSoldier ); - // + // for ( cnt2 = 0; cnt2 < 2; cnt2++ ) { - if ( bValidDishoutDirs[ pQueenSoldier->uiPendingActionData1 ][ cnt2 ] == bDir ) + if ( bValidDishoutDirs[ pQueenSoldier->aiData.uiPendingActionData1 ][ cnt2 ] == bDir ) { iChance = CalcChanceToStab( pQueenSoldier, pSoldier, 0 ); @@ -5686,7 +5815,7 @@ void DishoutQueenSwipeDamage( SOLDIERTYPE *pQueenSoldier ) { // Hit! iImpact = HTHImpact( pQueenSoldier, pSoldier, iHitBy, TRUE ); - EVENT_SoldierGotHit( pSoldier, CREATURE_QUEEN_TENTACLES, (INT16) iImpact, (INT16) iImpact, gOppositeDirection[ bDir ], 50, pQueenSoldier->ubID, 0, ANIM_CROUCH, 0, 0 ); + pSoldier->EVENT_SoldierGotHit( CREATURE_QUEEN_TENTACLES, (INT16) iImpact, (INT16) iImpact, gOppositeDirection[ bDir ], 50, pQueenSoldier->ubID, 0, ANIM_CROUCH, 0, 0 ); } } } @@ -5696,7 +5825,7 @@ void DishoutQueenSwipeDamage( SOLDIERTYPE *pQueenSoldier ) } } - pQueenSoldier->uiPendingActionData1++; + pQueenSoldier->aiData.uiPendingActionData1++; } @@ -5704,13 +5833,13 @@ BOOLEAN WillExplosiveWeaponFail( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj ) { if ( pSoldier->bTeam == gbPlayerNum || pSoldier->bVisible == 1 ) { - if ( (INT8)(PreRandom( 40 ) + PreRandom( 40 ) ) > pObj->ItemData.Generic.bStatus[0] ) + if ( (INT8)(PreRandom( 40 ) + PreRandom( 40 ) ) > (*pObj)[0]->data.objectStatus ) { // Do second dice roll if ( PreRandom( 2 ) == 1 ) { // Fail - return( TRUE ); + return( TRUE ); } } } @@ -5720,8 +5849,8 @@ BOOLEAN WillExplosiveWeaponFail( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj ) BOOLEAN IsWeapon ( UINT16 itemIndex ) { - UINT16 usItemClass = Item[itemIndex].usItemClass; - return (usItemClass == IC_GUN || usItemClass == IC_PUNCH || usItemClass == IC_BLADE || + UINT32 usItemClass = Item[itemIndex].usItemClass; + return (usItemClass == IC_GUN || usItemClass == IC_PUNCH || usItemClass == IC_BLADE || usItemClass == IC_LAUNCHER || usItemClass == IC_THROWING_KNIFE || usItemClass == IC_THROWN || usItemClass == IC_GRENADE || usItemClass == IC_TENTACLES); } @@ -5738,7 +5867,7 @@ UINT8 GetDamage ( OBJECTTYPE *pObj ) else { UINT8 ubDamage = Weapon[ pObj->usItem ].ubImpact; - if (Item[ pObj->usItem ].ubPerPocket == 0) + if (FitsInSmallPocket(pObj) == true) { ubDamage += GetDamageBonus(pObj); } @@ -5759,7 +5888,7 @@ UINT8 GetBurstPenalty( OBJECTTYPE *pObj, BOOLEAN fProneStance ) { // Snap: Make sure burst bonus does not exceed burst penalty! INT16 bns = GetBurstToHitBonus(pObj, fProneStance); - + if ( bns > Weapon[ pObj->usItem ].ubBurstPenalty ) { return 0; } @@ -5770,7 +5899,7 @@ UINT8 GetAutoPenalty( OBJECTTYPE *pObj, BOOLEAN fProneStance ) { // Snap: Make sure burst bonus does not exceed burst penalty! INT16 bns = GetAutoToHitBonus(pObj, fProneStance); - + if ( bns > Weapon[ pObj->usItem ].AutoPenalty ) { return 0; } @@ -5784,24 +5913,24 @@ UINT8 GetAutofireShotsPerFiveAPs( OBJECTTYPE *pObj ) return Weapon[ pObj->usItem ].bAutofireShotsPerFiveAP; } -UINT8 GetMagSize( OBJECTTYPE *pObj ) +UINT16 GetMagSize( OBJECTTYPE *pObj ) { // DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("GetMagSize")); return Weapon[ pObj->usItem ].ubMagSize + GetMagSizeBonus(pObj); } -BOOLEAN WeaponReady(SOLDIERTYPE * pSoldier) +bool WeaponReady(SOLDIERTYPE * pSoldier) { #ifdef ROBOT_ALWAYS_READY if ( AM_A_ROBOT( pSoldier) ) - return TRUE; + return true; #endif - if ( (gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIREREADY ) || + if ( (gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIREREADY ) || (gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIRE ) ) - return TRUE; + return true; else - return FALSE; + return false; } INT8 GetAPsToReload( OBJECTTYPE *pObj ) @@ -5813,3 +5942,6 @@ INT8 GetAPsToReload( OBJECTTYPE *pObj ) } + + + diff --git a/Tactical/Weapons.h b/Tactical/Weapons.h index 4f97e44e..c42018ed 100644 --- a/Tactical/Weapons.h +++ b/Tactical/Weapons.h @@ -3,6 +3,22 @@ #include "Soldier Control.h" +//ADB moved from Soldier Control.h +enum WeaponMode +{ + WM_NORMAL = 0, + WM_BURST, + WM_AUTOFIRE, + WM_ATTACHED_GL, + WM_ATTACHED_GL_BURST, + WM_ATTACHED_GL_AUTO, + NUM_WEAPON_MODES +} ; + +//ADB moved from Interface Panels.h +void HandleTacticalEffectsOfEquipmentChange( SOLDIERTYPE *pSoldier, UINT32 uiInvPos, UINT16 usOldItem, UINT16 usNewItem ); + + #define MAXCHANCETOHIT 99 #define BAD_DODGE_POSITION_PENALTY 20 @@ -209,43 +225,44 @@ enum // one quarter of punching damage is "real" rather than breath damage #define PUNCH_REAL_DAMAGE_PORTION 4 -#define AIM_BONUS_SAME_TARGET 10 // chance-to-hit bonus (in %) -#define AIM_BONUS_PER_AP 10 // chance-to-hit bonus (in %) for aim -#define AIM_BONUS_CROUCHING 10 -#define AIM_BONUS_PRONE 20 +#define AIM_BONUS_SAME_TARGET 10 // chance-to-hit bonus (in %) +#define AIM_BONUS_PER_AP 10 // chance-to-hit bonus (in %) for aim +#define AIM_BONUS_CROUCHING 10 +#define AIM_BONUS_PRONE 20 #define AIM_BONUS_TWO_HANDED_PISTOL 5 #define AIM_BONUS_FIRING_DOWN 15 #define AIM_PENALTY_ONE_HANDED_PISTOL 5 #define AIM_PENALTY_DUAL_PISTOLS 20 -#define AIM_PENALTY_SMG 5 -#define AIM_PENALTY_GASSED 50 -#define AIM_PENALTY_GETTINGAID 20 -#define AIM_PENALTY_PER_SHOCK 5 // 5% penalty per point of shock -#define AIM_BONUS_TARGET_HATED 20 -#define AIM_BONUS_PSYCHO 15 -#define AIM_PENALTY_TARGET_BUDDY 20 +#define AIM_PENALTY_SMG 5 +#define AIM_PENALTY_GASSED 50 +#define AIM_PENALTY_GETTINGAID 20 +#define AIM_PENALTY_PER_SHOCK 5 // 5% penalty per point of shock +#define AIM_BONUS_TARGET_HATED 20 +#define AIM_BONUS_PSYCHO 15 +#define AIM_PENALTY_TARGET_BUDDY 20 #define AIM_PENALTY_BURSTING 10 -#define AIM_PENALTY_GENTLEMAN 15 +#define AIM_PENALTY_GENTLEMAN 15 #define AIM_PENALTY_TARGET_CROUCHED 20 #define AIM_PENALTY_TARGET_PRONE 40 #define AIM_PENALTY_BLIND 80 #define AIM_PENALTY_FIRING_UP 25 +#define HIGH_POWER_SCOPE 14 #define MAX_WEAPON_NAME_LENGTH 20 typedef struct { - UINT8 ubWeaponClass; // handgun/shotgun/rifle/knife - UINT8 ubWeaponType; // exact type (for display purposes) - UINT8 ubCalibre; // type of ammunition needed - UINT8 ubReadyTime; // APs to ready/unready weapon - UINT8 ubShotsPer4Turns; // maximum (mechanical) firing rate + UINT8 ubWeaponClass; // handgun/shotgun/rifle/knife + UINT8 ubWeaponType; // exact type (for display purposes) + UINT8 ubCalibre; // type of ammunition needed + UINT8 ubReadyTime; // APs to ready/unready weapon + UINT8 ubShotsPer4Turns; // maximum (mechanical) firing rate UINT8 ubShotsPerBurst; - UINT8 ubBurstPenalty; // % penalty per shot after first - UINT8 ubBulletSpeed; // bullet's travelling speed - UINT8 ubImpact; // weapon's max damage impact (size & speed) - UINT8 ubDeadliness; // comparative ratings of guns - INT8 bAccuracy; // accuracy or penalty + UINT8 ubBurstPenalty; // % penalty per shot after first + UINT8 ubBulletSpeed; // bullet's travelling speed + UINT8 ubImpact; // weapon's max damage impact (size & speed) + UINT8 ubDeadliness; // comparative ratings of guns + INT8 bAccuracy; // accuracy or penalty UINT8 ubMagSize; UINT16 usRange; UINT16 usReloadDelay; @@ -268,7 +285,7 @@ typedef struct UINT8 maxdistformessydeath; BOOLEAN NoSemiAuto; UINT8 AutoPenalty; - INT16 sAniDelay; // Lesh: for burst animation delay + INT16 sAniDelay; // Lesh: for burst animation delay UINT8 APsToReloadManually; UINT16 ManualReloadSound; @@ -276,7 +293,7 @@ typedef struct typedef struct { UINT8 ubCalibre; - UINT8 ubMagSize; + UINT16 ubMagSize; UINT8 ubAmmoType; UINT32 uiIndex; @@ -311,7 +328,7 @@ extern WEAPONTYPE Weapon[ MAXITEMS ]; extern ARMOURTYPE Armour[MAXITEMS+1]; extern MAGTYPE Magazine[MAXITEMS+1]; extern EXPLOSIVETYPE Explosive[MAXITEMS+1]; -extern CHAR8 gzBurstSndStrings[MAXITEMS*2][128]; // Lesh: changed this +extern CHAR8 gzBurstSndStrings[MAXITEMS*2][128]; // Lesh: changed this extern AMMOTYPE AmmoTypes[MAXITEMS]; extern BOOLEAN ReadInWeaponStats(STR fileName); @@ -321,20 +338,24 @@ extern INT32 EffectiveArmour( OBJECTTYPE * pObj ); extern INT8 ArmourVersusExplosivesPercent( SOLDIERTYPE * pSoldier ); extern BOOLEAN FireWeapon( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ); extern void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 sBreathLoss, UINT16 usDirection, INT16 sXPos, INT16 sYPos, INT16 sZPos, INT16 sRange , UINT8 ubAttackerID, BOOLEAN fHit, UINT8 ubSpecial, UINT8 ubHitLocation ); -extern void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT8 ubAttackerID, UINT16 sXPos, INT16 sYPos, INT16 sZPos, UINT16 usStructureID, INT32 iImpact, BOOLEAN fStopped ); +extern void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UINT8 ubAttackerID, UINT16 sXPos, INT16 sYPos, INT16 sZPos, UINT16 usStructureID, INT32 iImpact, BOOLEAN fStopped ); extern void WindowHit( INT16 sGridNo, UINT16 usStructureID, BOOLEAN fBlowWindowSouth, BOOLEAN fLargeForce ); extern INT32 BulletImpact( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 ubHitLocation, INT32 iImpact, INT16 sHitBy, UINT8 * pubSpecial ); extern BOOLEAN InRange( SOLDIERTYPE *pSoldier, INT16 sGridNo ); extern void ShotMiss( UINT8 ubAttackerID, INT32 iBullet ); -extern UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime, UINT8 ubAimPos ); -extern UINT32 AICalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime, UINT8 ubAimPos ); +extern UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAimTime, UINT8 ubAimPos ); +extern UINT32 AICalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAimTime, UINT8 ubAimPos ); extern UINT32 CalcChanceToPunch(SOLDIERTYPE *pAttacker, SOLDIERTYPE * pDefender, UINT8 ubAimTime); extern UINT32 CalcChanceToStab(SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, UINT8 ubAimTime); UINT32 CalcChanceToSteal(SOLDIERTYPE *pAttacker, SOLDIERTYPE * pDefender, UINT8 ubAimTime); extern void ReloadWeapon( SOLDIERTYPE *pSoldier, UINT8 ubHandPos ); -extern BOOLEAN IsGunWeaponModeCapable( SOLDIERTYPE *pSoldier, UINT8 ubHandPos , UINT8 bWpnMode ); -extern BOOLEAN IsGunBurstCapable( SOLDIERTYPE *pSoldier, UINT8 ubHandPos , BOOLEAN fNotify ); -extern BOOLEAN IsGunAutofireCapable( SOLDIERTYPE *pSoldier, UINT8 ubHandPos ); +// Changed by ADB, rev 1513 +//extern BOOLEAN IsGunWeaponModeCapable( SOLDIERTYPE *pSoldier, UINT8 ubHandPos , UINT8 bWpnMode ); +//extern BOOLEAN IsGunBurstCapable( SOLDIERTYPE *pSoldier, UINT8 ubHandPos , BOOLEAN fNotify ); +//extern BOOLEAN IsGunAutofireCapable( SOLDIERTYPE *pSoldier, UINT8 ubHandPos ); +extern BOOLEAN IsGunWeaponModeCapable( OBJECTTYPE* pObject, WeaponMode weaponMode, SOLDIERTYPE *pSoldier = NULL ); +extern BOOLEAN IsGunBurstCapable( OBJECTTYPE* pObject, BOOLEAN fNotify, SOLDIERTYPE *pSoldier = NULL ); +extern BOOLEAN IsGunAutofireCapable( OBJECTTYPE* pObject ); extern INT32 CalcBodyImpactReduction( UINT8 ubAmmoType, UINT8 ubHitLocation ); extern INT32 TotalArmourProtection( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 ubHitLocation, INT32 iImpact, UINT8 ubAmmoType ); extern INT32 ArmourPercent( SOLDIERTYPE * pSoldier ); @@ -363,8 +384,8 @@ UINT8 GetBaseAutoFireCost( OBJECTTYPE *pObj ); UINT8 GetBurstPenalty( OBJECTTYPE *pObj, BOOLEAN fProneStance = FALSE ); UINT8 GetAutoPenalty( OBJECTTYPE *pObj, BOOLEAN fProneStance = FALSE ); UINT8 GetShotsPerBurst( OBJECTTYPE *pObj ); -UINT8 GetMagSize( OBJECTTYPE *pObj ); -BOOLEAN WeaponReady(SOLDIERTYPE * pSoldier); +UINT16 GetMagSize( OBJECTTYPE *pObj ); +bool WeaponReady(SOLDIERTYPE * pSoldier); INT8 GetAPsToReload( OBJECTTYPE *pObj ); diff --git a/Tactical/World Items.cpp b/Tactical/World Items.cpp index 3957b683..3b9a6adf 100644 --- a/Tactical/World Items.cpp +++ b/Tactical/World Items.cpp @@ -41,6 +41,111 @@ void DeleteWorldItemsBelongingToTerroristsWhoAreNotThere( void ); void DeleteWorldItemsBelongingToQueenIfThere( void ); extern UINT16 StandardGunListAmmoReplacement( UINT16 usAmmo ); +extern UINT8 GetDealerItemCategoryNumber( UINT16 usItemIndex ); + +bool WORLDITEM::operator<(WORLDITEM& compare) +{ + if ( this->fExists == false || this->object.exists() == false) { + return false; + } + if ( compare.fExists == false || compare.object.exists() == false) { + return true; + } + + + UINT8 ubItem1Category = GetDealerItemCategoryNumber( this->object.usItem ); + UINT8 ubItem2Category = GetDealerItemCategoryNumber( compare.object.usItem ); + // lower category first + if ( ubItem1Category < ubItem2Category ) { + return( true ); + } + else if ( ubItem1Category > ubItem2Category ) { + return false; + } + + + // the same category + //Madd: sort by name (for now at least): + int retVal = _wcsicmp(Item[this->object.usItem].szBRName,Item[compare.object.usItem].szBRName); + if ( retVal < 0 ) { + return true; + } + else if ( retVal > 0 ) { + return false; + } + + + if (this->object.ubNumberOfObjects > compare.object.ubNumberOfObjects) { + return true; + } + else if (this->object.ubNumberOfObjects < compare.object.ubNumberOfObjects) { + return false; + } + +/* + if (this->object[0]->attachments.size() > compare.object[0]->attachments.size()) { + return true; + } + else if (this->object[0]->attachments.size() < compare.object[0]->attachments.size()) { + return false; + } +*/ + + // higher quality first + if ( this->object[0]->data.objectStatus > compare.object[0]->data.objectStatus ) { + return( true ); + } + else { + // identical items! + return( false ); + } + return false; +} + +void WORLDITEM::initialize() +{ + this->fExists = 0; + this->sGridNo = 0; + this->ubLevel = 0; + this->usFlags = 0; + this->bRenderZHeightAboveLevel = 0; + this->bVisible = 0; + this->ubNonExistChance = 0; + this->soldierID = -1; + this->object.initialize(); +} + +WORLDITEM& WORLDITEM::operator=(OLD_WORLDITEM_101& src) +{ + //the first conversion is simple enough that it can be done here + this->fExists = src.fExists; + this->sGridNo = src.sGridNo; + this->ubLevel = src.ubLevel; + this->usFlags = src.usFlags; + this->bRenderZHeightAboveLevel = src.bRenderZHeightAboveLevel; + this->bVisible = src.bVisible; + this->ubNonExistChance = src.ubNonExistChance; + this->soldierID = -1; + + //convert the OBJECTTYPE + this->object = src.oldObject; + return *this; +} + +WORLDITEM& WORLDITEM::operator=(const WORLDITEM& src) +{ + this->fExists = src.fExists; + this->sGridNo = src.sGridNo; + this->ubLevel = src.ubLevel; + this->usFlags = src.usFlags; + this->bRenderZHeightAboveLevel = src.bRenderZHeightAboveLevel; + this->bVisible = src.bVisible; + this->ubNonExistChance = src.ubNonExistChance; + this->soldierID = src.soldierID; + this->object = src.object; + return *this; +} + INT32 GetFreeWorldBombIndex( void ) { @@ -64,7 +169,7 @@ INT32 GetFreeWorldBombIndex( void ) } //Clear the rest of the new array - memset( &newWorldBombs[ uiOldNumWorldBombs ], 0, + memset( &newWorldBombs[ uiOldNumWorldBombs ], 0, sizeof( WORLDBOMB ) * ( guiNumWorldBombs - uiOldNumWorldBombs ) ); gWorldBombs = newWorldBombs; @@ -155,19 +260,17 @@ void FindPanicBombsAndTriggers( void ) STRUCTURE * pSwitch; INT16 sGridNo = NOWHERE; INT8 bPanicIndex; - BOOLEAN fPanicTriggerIsAlarm = FALSE; - for (uiBombIndex = 0; uiBombIndex < guiNumWorldBombs; uiBombIndex++) { if (gWorldBombs[ uiBombIndex ].fExists) { - pObj = &(gWorldItems[ gWorldBombs[ uiBombIndex ].iItemIndex ].o); - if (pObj->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY || pObj->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_2 || pObj->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_3 ) + pObj = &(gWorldItems[ gWorldBombs[ uiBombIndex ].iItemIndex ].object); + if ((*pObj)[0]->data.misc.bFrequency == PANIC_FREQUENCY || (*pObj)[0]->data.misc.bFrequency == PANIC_FREQUENCY_2 || (*pObj)[0]->data.misc.bFrequency == PANIC_FREQUENCY_3 ) { if (pObj->usItem == SWITCH) { sGridNo = gWorldItems[ gWorldBombs[ uiBombIndex ].iItemIndex ].sGridNo; - switch( pObj->ItemData.Trigger.BombTrigger.bFrequency ) + switch( (*pObj)[0]->data.misc.bFrequency ) { case PANIC_FREQUENCY: bPanicIndex = 0; @@ -180,7 +283,7 @@ void FindPanicBombsAndTriggers( void ) case PANIC_FREQUENCY_3: bPanicIndex = 2; break; - + default: // augh!!! continue; @@ -189,10 +292,10 @@ void FindPanicBombsAndTriggers( void ) pSwitch = FindStructure( sGridNo, STRUCTURE_SWITCH ); if (pSwitch) { - switch( pSwitch->ubWallOrientation ) + switch( pSwitch->ubWallOrientation ) { case INSIDE_TOP_LEFT: - case OUTSIDE_TOP_LEFT: + case OUTSIDE_TOP_LEFT: sGridNo += DirectionInc( SOUTH ); break; case INSIDE_TOP_RIGHT: @@ -205,8 +308,8 @@ void FindPanicBombsAndTriggers( void ) } gTacticalStatus.sPanicTriggerGridNo[ bPanicIndex ] = sGridNo; - gTacticalStatus.ubPanicTolerance[ bPanicIndex ] = pObj->ItemData.Trigger.Area.ubTolerance; - if (pObj->fFlags & OBJECT_ALARM_TRIGGER) + gTacticalStatus.ubPanicTolerance[ bPanicIndex ] = (*pObj)[0]->data.misc.ubTolerance; + if ((*pObj).fFlags & OBJECT_ALARM_TRIGGER) { gTacticalStatus.bPanicTriggerIsAlarm[ bPanicIndex ] = TRUE; } @@ -241,15 +344,20 @@ INT32 GetFreeWorldItemIndex( void ) uiOldNumWorldItems = guiNumWorldItems; guiNumWorldItems += 10; //Allocate new table with max+10 items. - newWorldItems = (WORLDITEM*)MemRealloc( gWorldItems, sizeof( WORLDITEM ) * guiNumWorldItems ); + newWorldItems = new WORLDITEM [ guiNumWorldItems ]; if (newWorldItems == NULL) { return( -1 ); } - //Clear the rest of the new array - memset( &newWorldItems[ uiOldNumWorldItems ], 0, - sizeof( WORLDITEM ) * ( guiNumWorldItems - uiOldNumWorldItems ) ); + if (gWorldItems) + { + for (unsigned int x = 0; x < uiOldNumWorldItems; ++x) + { + newWorldItems[x] = gWorldItems[x]; + } + delete[] gWorldItems; + } gWorldItems = newWorldItems; // Return uiCount..... @@ -262,11 +370,6 @@ UINT32 GetNumUsedWorldItems( void ) UINT32 uiCount, uiNumItems; uiNumItems = 0; - if ( guiNumWorldItems == 0 ) - { - return( 0 ); - } - for( uiCount = 0; uiCount < guiNumWorldItems; uiCount++ ) { if( gWorldItems[ uiCount ].fExists ) @@ -280,7 +383,7 @@ UINT32 GetNumUsedWorldItems( void ) -INT32 AddItemToWorld( INT16 sGridNo, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 bVisible ) +INT32 AddItemToWorld( INT16 sGridNo, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 bVisible, INT8 soldierID ) { UINT32 iItemIndex; INT32 iReturn; @@ -303,9 +406,10 @@ INT32 AddItemToWorld( INT16 sGridNo, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 gWorldItems[ iItemIndex ].ubLevel = ubLevel; gWorldItems[ iItemIndex ].usFlags = usFlags; gWorldItems[ iItemIndex ].bVisible = bVisible; - gWorldItems[ iItemIndex ].bRenderZHeightAboveLevel = bRenderZHeightAboveLevel; + gWorldItems[ iItemIndex ].bRenderZHeightAboveLevel = bRenderZHeightAboveLevel; + gWorldItems[ iItemIndex ].soldierID = soldierID; - memcpy( &(gWorldItems[ iItemIndex ].o), pObject, sizeof( OBJECTTYPE ) ); + gWorldItems[ iItemIndex ].object = *pObject; // Add a bomb reference if needed if (usFlags & WORLD_ITEM_ARMED_BOMB) @@ -346,7 +450,7 @@ void TrashWorldItems() RemoveItemFromPool( gWorldItems[ i ].sGridNo, i, gWorldItems[ i ].ubLevel ); } } - MemFree( gWorldItems ); + delete[] gWorldItems; gWorldItems = NULL; guiNumWorldItems = 0; } @@ -372,21 +476,19 @@ void SaveWorldItemsToMap( HWFILE fp ) for( i = 0; i < guiNumWorldItems; i++ ) { if( gWorldItems[ i ].fExists ) - FileWrite( fp, &gWorldItems[ i ], sizeof( WORLDITEM ), &uiBytesWritten ); + gWorldItems[ i ].Save(fp, TRUE); } } -void LoadWorldItemsFromMap( INT8 **hBuffer ) +void LoadWorldItemsFromMap( INT8 **hBuffer, float dMajorMapVersion, int ubMinorMapVersion ) { // Start loading itmes... - + UINT32 i; WORLDITEM dummyItem; INT32 iItemIndex; UINT32 uiNumWorldItems; - UINT32 uiLevelItems = 0; - //If any world items exist, we must delete them now. TrashWorldItems(); @@ -394,27 +496,36 @@ void LoadWorldItemsFromMap( INT8 **hBuffer ) LOADDATA( &uiNumWorldItems, *hBuffer, 4 ); if( gTacticalStatus.uiFlags & LOADING_SAVED_GAME && !gfEditMode ) - { //The sector has already been visited. The items are saved in a different format that will be - //loaded later on. So, all we need to do is skip the data entirely. - *hBuffer += sizeof( WORLDITEM ) * uiNumWorldItems; + { //The sector has already been visited. The items are saved in a different format that will be + //loaded later on. So, all we need to do is skip the data entirely. + if (dMajorMapVersion >= 6.0 && ubMinorMapVersion > 26 ) { + for (unsigned int x = 0; x < uiNumWorldItems; ++x) + { + //ADB WORLDITEM's size on disk is unknown + dummyItem.Load(hBuffer, dMajorMapVersion, ubMinorMapVersion); + } + } + else { + *hBuffer += sizeof ( OLD_WORLDITEM_101 ) * uiNumWorldItems; + } return; } else for ( i = 0; i < uiNumWorldItems; i++ ) { //Add all of the items to the world indirectly through AddItemToPool, but only if the chance //associated with them succeed. - LOADDATA( &dummyItem, *hBuffer, sizeof( WORLDITEM ) ); - if( dummyItem.o.usItem == OWNERSHIP ) + dummyItem.Load(hBuffer, dMajorMapVersion, ubMinorMapVersion); + if( dummyItem.object.usItem == OWNERSHIP ) { dummyItem.ubNonExistChance = 0; } if( gfEditMode || dummyItem.ubNonExistChance <= PreRandom( 100 ) ) { if( !gfEditMode ) - { + { //check for matching item existance modes and only add if there is a match! //if we are in platinum mode, REALISTIC items are allowed, but not SCIFI items if( dummyItem.usFlags & WORLD_ITEM_SCIFI_ONLY && !(gGameOptions.ubGameStyle == STYLE_SCIFI) || - dummyItem.usFlags & WORLD_ITEM_REALISTIC_ONLY && (gGameOptions.ubGameStyle == STYLE_SCIFI) ) + dummyItem.usFlags & WORLD_ITEM_REALISTIC_ONLY && (gGameOptions.ubGameStyle == STYLE_SCIFI) ) { //no match, so don't add item to world continue; } @@ -424,59 +535,59 @@ void LoadWorldItemsFromMap( INT8 **hBuffer ) UINT16 usReplacement; // do replacements? - if ( Item[ dummyItem.o.usItem ].usItemClass == IC_GUN ) + if ( Item[ dummyItem.object.usItem ].usItemClass == IC_GUN ) { INT8 bAmmo, bNewAmmo; - usReplacement = StandardGunListReplacement( dummyItem.o.usItem ); + usReplacement = StandardGunListReplacement( dummyItem.object.usItem ); if ( usReplacement ) { // everything else can be the same? no. - bAmmo = dummyItem.o.ubGunShotsLeft; - bNewAmmo = (Weapon[ usReplacement ].ubMagSize * bAmmo) / Weapon[ dummyItem.o.usItem ].ubMagSize; + bAmmo = dummyItem.object[0]->data.gun.ubGunShotsLeft; + bNewAmmo = (Weapon[ usReplacement ].ubMagSize * bAmmo) / Weapon[ dummyItem.object.usItem ].ubMagSize; if ( bAmmo > 0 && bNewAmmo == 0 ) { bNewAmmo = 1; } - dummyItem.o.usItem = usReplacement; - dummyItem.o.ubGunShotsLeft = bNewAmmo; + dummyItem.object.usItem = usReplacement; + dummyItem.object[0]->data.gun.ubGunShotsLeft = bNewAmmo; } } - if ( Item[ dummyItem.o.usItem ].usItemClass == IC_AMMO ) + if ( Item[ dummyItem.object.usItem ].usItemClass == IC_AMMO ) { - usReplacement = StandardGunListAmmoReplacement( dummyItem.o.usItem ); + usReplacement = StandardGunListAmmoReplacement( dummyItem.object.usItem ); if ( usReplacement ) { UINT8 ubLoop; // go through status values and scale up/down - for ( ubLoop = 0; ubLoop < dummyItem.o.ubNumberOfObjects; ubLoop++ ) + for ( ubLoop = 0; ubLoop < dummyItem.object.ubNumberOfObjects; ubLoop++ ) { - dummyItem.o.bStatus[ ubLoop ] = dummyItem.o.bStatus[ ubLoop ] * Magazine[ Item[ usReplacement ].ubClassIndex ].ubMagSize / Magazine[ Item[ dummyItem.o.usItem ].ubClassIndex ].ubMagSize; + dummyItem.object.status.bStatus[ ubLoop ] = dummyItem.object.status.bStatus[ ubLoop ] * Magazine[ Item[ usReplacement ].ubClassIndex ].ubMagSize / Magazine[ Item[ dummyItem.object.usItem ].ubClassIndex ].ubMagSize; } // then replace item # - dummyItem.o.usItem = usReplacement; + dummyItem.object.usItem = usReplacement; } } } */ } - if( dummyItem.o.usItem == ACTION_ITEM && gfLoadPitsWithoutArming ) + if( dummyItem.object.usItem == ACTION_ITEM && gfLoadPitsWithoutArming ) { //if we are loading a pit, they are typically loaded without being armed. - if( dummyItem.o.ItemData.Trigger.bActionValue == ACTION_ITEM_SMALL_PIT || dummyItem.o.ItemData.Trigger.bActionValue == ACTION_ITEM_LARGE_PIT ) + if( dummyItem.object[0]->data.misc.bActionValue == ACTION_ITEM_SMALL_PIT || dummyItem.object[0]->data.misc.bActionValue == ACTION_ITEM_LARGE_PIT ) { dummyItem.usFlags &= ~WORLD_ITEM_ARMED_BOMB; dummyItem.bVisible = BURIED; - dummyItem.o.ItemData.Trigger.bDetonatorType = 0; + dummyItem.object[0]->data.misc.bDetonatorType = 0; } } - - else if ( dummyItem.bVisible == HIDDEN_ITEM && dummyItem.o.bTrap > 0 && ( Item[dummyItem.o.usItem].mine || dummyItem.o.usItem == TRIP_FLARE || dummyItem.o.usItem == TRIP_KLAXON) ) + + else if ( dummyItem.bVisible == HIDDEN_ITEM && dummyItem.object[0]->data.bTrap > 0 && ( Item[dummyItem.object.usItem].mine || dummyItem.object.usItem == TRIP_FLARE || dummyItem.object.usItem == TRIP_KLAXON) ) { - ArmBomb( &dummyItem.o, BOMB_PRESSURE ); + ArmBomb( &dummyItem.object, BOMB_PRESSURE ); dummyItem.usFlags |= WORLD_ITEM_ARMED_BOMB; // this is coming from the map so the enemy must know about it. gpWorldLevelData[ dummyItem.sGridNo ].uiFlags |= MAPELEMENT_ENEMY_MINE_PRESENT; @@ -487,13 +598,13 @@ void LoadWorldItemsFromMap( INT8 **hBuffer ) { //all armed bombs are buried dummyItem.bVisible = BURIED; } - AddItemToPoolAndGetIndex( dummyItem.sGridNo, &dummyItem.o, dummyItem.bVisible, dummyItem.ubLevel, dummyItem.usFlags, dummyItem.bRenderZHeightAboveLevel, &iItemIndex ); + AddItemToPoolAndGetIndex( dummyItem.sGridNo, &dummyItem.object, dummyItem.bVisible, dummyItem.ubLevel, dummyItem.usFlags, dummyItem.bRenderZHeightAboveLevel, dummyItem.soldierID, &iItemIndex ); gWorldItems[ iItemIndex ].ubNonExistChance = dummyItem.ubNonExistChance; } } if ( !gfEditMode ) - { + { DeleteWorldItemsBelongingToTerroristsWhoAreNotThere(); if ( gWorldSectorX == 3 && gWorldSectorY == MAP_ROW_P && gbWorldSectorZ == 1 ) { @@ -516,14 +627,14 @@ void DeleteWorldItemsBelongingToTerroristsWhoAreNotThere( void ) for ( uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ ) { // loop through all items, look for ownership - if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].o.usItem == OWNERSHIP ) + if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].object.usItem == OWNERSHIP ) { // if owner is a terrorist - if ( IsProfileATerrorist( gWorldItems[ uiLoop ].o.ItemData.Owner.ubOwnerProfile ) ) + if ( IsProfileATerrorist( (UINT8) gWorldItems[ uiLoop ].object[0]->data.owner.ubOwnerProfile ) ) { // and they were not set in the current sector - if ( gMercProfiles[ gWorldItems[ uiLoop ].o.ItemData.Owner.ubOwnerProfile ].sSectorX != gWorldSectorX || - gMercProfiles[ gWorldItems[ uiLoop ].o.ItemData.Owner.ubOwnerProfile ].sSectorY != gWorldSectorY ) + if ( gMercProfiles[ gWorldItems[ uiLoop ].object[0]->data.owner.ubOwnerProfile ].sSectorX != gWorldSectorX || + gMercProfiles[ gWorldItems[ uiLoop ].object[0]->data.owner.ubOwnerProfile ].sSectorY != gWorldSectorY ) { // then all items in this location should be deleted sGridNo = gWorldItems[ uiLoop ].sGridNo; @@ -553,17 +664,17 @@ void DeleteWorldItemsBelongingToQueenIfThere( void ) INT8 bSlot; if ( gMercProfiles[ QUEEN ].sSectorX == gWorldSectorX && - gMercProfiles[ QUEEN ].sSectorY == gWorldSectorY && + gMercProfiles[ QUEEN ].sSectorY == gWorldSectorY && gMercProfiles[ QUEEN ].bSectorZ == gbWorldSectorZ ) { for ( uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ ) { // loop through all items, look for ownership - if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].o.usItem == OWNERSHIP ) + if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].object.usItem == OWNERSHIP ) { // if owner is the Queen - if ( gWorldItems[ uiLoop ].o.ItemData.Owner.ubOwnerProfile == QUEEN ) + if ( gWorldItems[ uiLoop ].object[0]->data.owner.ubOwnerProfile == QUEEN ) { // then all items in this location should be deleted sGridNo = gWorldItems[ uiLoop ].sGridNo; @@ -574,7 +685,7 @@ void DeleteWorldItemsBelongingToQueenIfThere( void ) if ( gWorldItems[ uiLoop2 ].fExists && gWorldItems[ uiLoop2 ].sGridNo == sGridNo && gWorldItems[ uiLoop2 ].ubLevel == ubLevel ) { // upgrade equipment - switch ( gWorldItems[ uiLoop2 ].o.usItem ) + switch ( gWorldItems[ uiLoop2 ].object.usItem ) { case AUTO_ROCKET_RIFLE: bSlot = FindObjectInSoldierProfile( QUEEN, ROCKET_RIFLE ); @@ -610,15 +721,14 @@ void DeleteWorldItemsBelongingToQueenIfThere( void ) void RefreshWorldItemsIntoItemPools( WORLDITEM * pItemList, INT32 iNumberOfItems ) { INT32 i; - WORLDITEM dummyItem; for ( i = 0; i < iNumberOfItems; i++ ) - { + { if( pItemList[ i ].fExists ) { - memcpy( &dummyItem, &( pItemList[ i ] ), sizeof( WORLDITEM ) ); + WORLDITEM& dummyItem = pItemList[ i ]; - AddItemToPool( dummyItem.sGridNo, &dummyItem.o, dummyItem.bVisible, dummyItem.ubLevel, dummyItem.usFlags, dummyItem.bRenderZHeightAboveLevel ); + AddItemToPool( dummyItem.sGridNo, &dummyItem.object, dummyItem.bVisible, dummyItem.ubLevel, dummyItem.usFlags, dummyItem.bRenderZHeightAboveLevel, dummyItem.soldierID ); } } diff --git a/Tactical/World Items.h b/Tactical/World Items.h index 244f7ad5..0d7dd2b3 100644 --- a/Tactical/World Items.h +++ b/Tactical/World Items.h @@ -15,35 +15,59 @@ //Kaiden: This constant is to flag items that an enemy drops when they die. #define WORLD_ITEM_DROPPED_FROM_ENEMY 0x0800 -//typedef struct -struct WORLDITEM +class OLD_WORLDITEM_101 { - BOOLEAN fExists; +public: + BOOLEAN fExists; INT16 sGridNo; UINT8 ubLevel; - OBJECTTYPE o; - UINT16 usFlags; + OLD_OBJECTTYPE_101 oldObject; + UINT16 usFlags; INT8 bRenderZHeightAboveLevel; + INT8 bVisible; + UINT8 ubNonExistChance; +}; + +class WORLDITEM +{ +public: + WORLDITEM() {initialize();}; + WORLDITEM& operator=(OLD_WORLDITEM_101& src); + WORLDITEM& operator=(const WORLDITEM& src); + bool operator<(WORLDITEM& compare); + BOOLEAN Save( HWFILE hFile, bool fSavingMap ); + BOOLEAN Load( HWFILE hFile ); + BOOLEAN Load( INT8** hBuffer, float dMajorMapVersion, UINT8 ubMinorMapVersion ); + void initialize(); + BOOLEAN fExists; + INT16 sGridNo; + UINT8 ubLevel; + UINT16 usFlags; + INT8 bRenderZHeightAboveLevel; INT8 bVisible; - //This is the chance associated with an item or a trap not-existing in the world. The reason why + //This is the chance associated with an item or a trap not-existing in the world. The reason why //this is reversed (10 meaning item has 90% chance of appearing, is because the order that the map //is saved, we don't know if the version is older or not until after the items are loaded and added. //Because this value is zero in the saved maps, we can't change it to 100, hence the reversal method. - //This check is only performed the first time a map is loaded. Later, it is entirely skipped. - UINT8 ubNonExistChance; + //This check is only performed the first time a map is loaded. Later, it is entirely skipped. + UINT8 ubNonExistChance; + INT8 soldierID; -}; // WORLDITEM; + char endOfPod; + OBJECTTYPE object; +}; +#define SIZEOF_WORLDITEM_POD (offsetof(WORLDITEM, endOfPod)) extern WORLDITEM *gWorldItems; extern UINT32 guiNumWorldItems; -INT32 AddItemToWorld( INT16 sGridNo, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 bVisible ); +INT32 AddItemToWorld( INT16 sGridNo, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 bVisible, INT8 soldierID ); void RemoveItemFromWorld( INT32 iItemIndex ); INT32 FindWorldItem( UINT16 usItem ); -void LoadWorldItemsFromMap( INT8 **hBuffer ); +void LoadWorldItemsFromMap( INT8 **hBuffer, float dMajorMapVersion, int ubMinorMapVersion ); void SaveWorldItemsToMap( HWFILE fp ); void TrashWorldItems(); diff --git a/Tactical/XML.h b/Tactical/XML.h index 00174b38..853ec292 100644 --- a/Tactical/XML.h +++ b/Tactical/XML.h @@ -5,6 +5,11 @@ #include "EnemyItemDrops.h" #include "Loading Screen.h" +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + enum { ELEMENT_NONE = 0, @@ -39,51 +44,56 @@ typedef PARSE_STAGE; #define ENEMYITEMCHOICESFILENAME "EnemyItemChoices.xml" #define IMPITEMCHOICESFILENAME "IMPItemChoices.xml" -#define TONYINVENTORYFILENAME "NPCInventory\\TonyInventory.xml" -#define DEVININVENTORYFILENAME "NPCInventory\\DevinInventory.xml" -#define FRANZINVENTORYFILENAME "NPCInventory\\FranzInventory.xml" -#define KEITHINVENTORYFILENAME "NPCInventory\\KeithInventory.xml" -#define SAMINVENTORYFILENAME "NPCInventory\\SamInventory.xml" -#define JAKEINVENTORYFILENAME "NPCInventory\\JakeInventory.xml" -#define HOWARDINVENTORYFILENAME "NPCInventory\\HowardInventory.xml" -#define GABBYINVENTORYFILENAME "NPCInventory\\GabbyInventory.xml" -#define FRANKINVENTORYFILENAME "NPCInventory\\FrankInventory.xml" -#define ELGININVENTORYFILENAME "NPCInventory\\ElginInventory.xml" -#define MANNYINVENTORYFILENAME "NPCInventory\\MannyInventory.xml" -#define HERVEINVENTORYFILENAME "NPCInventory\\HerveInventory.xml" -#define PETERINVENTORYFILENAME "NPCInventory\\PeterInventory.xml" -#define ALBERTOINVENTORYFILENAME "NPCInventory\\AlbertoInventory.xml" -#define CARLOINVENTORYFILENAME "NPCInventory\\CarloInventory.xml" -#define MICKEYINVENTORYFILENAME "NPCInventory\\MickeyInventory.xml" -#define ARNIEINVENTORYFILENAME "NPCInventory\\ArnieInventory.xml" -#define PERKOINVENTORYFILENAME "NPCInventory\\PerkoInventory.xml" -#define FREDOINVENTORYFILENAME "NPCInventory\\FredoInventory.xml" +// CHRISL: +#define LOADBEARINGEQUIPMENTFILENAME "LoadBearingEquipment.xml" +#define LBEPOCKETFILENAME "Pockets.xml" +#define MERCSTARTINGGEARFILENAME "MercStartingGear.xml" -#define BOBBYRAYSTRINGSFILENAME "BobbyRayStrings.xml" -#define AMMOCALIBERSTRINGSFILENAME "AmmoCaliberStrings.xml" +#define TONYINVENTORYFILENAME "NPCInventory\\TonyInventory.xml" +#define DEVININVENTORYFILENAME "NPCInventory\\DevinInventory.xml" +#define FRANZINVENTORYFILENAME "NPCInventory\\FranzInventory.xml" +#define KEITHINVENTORYFILENAME "NPCInventory\\KeithInventory.xml" +#define SAMINVENTORYFILENAME "NPCInventory\\SamInventory.xml" +#define JAKEINVENTORYFILENAME "NPCInventory\\JakeInventory.xml" +#define HOWARDINVENTORYFILENAME "NPCInventory\\HowardInventory.xml" +#define GABBYINVENTORYFILENAME "NPCInventory\\GabbyInventory.xml" +#define FRANKINVENTORYFILENAME "NPCInventory\\FrankInventory.xml" +#define ELGININVENTORYFILENAME "NPCInventory\\ElginInventory.xml" +#define MANNYINVENTORYFILENAME "NPCInventory\\MannyInventory.xml" +#define HERVEINVENTORYFILENAME "NPCInventory\\HerveInventory.xml" +#define PETERINVENTORYFILENAME "NPCInventory\\PeterInventory.xml" +#define ALBERTOINVENTORYFILENAME "NPCInventory\\AlbertoInventory.xml" +#define CARLOINVENTORYFILENAME "NPCInventory\\CarloInventory.xml" +#define MICKEYINVENTORYFILENAME "NPCInventory\\MickeyInventory.xml" +#define ARNIEINVENTORYFILENAME "NPCInventory\\ArnieInventory.xml" +#define PERKOINVENTORYFILENAME "NPCInventory\\PerkoInventory.xml" +#define FREDOINVENTORYFILENAME "NPCInventory\\FredoInventory.xml" -#define SOUNDSFILENAME "Sounds\\Sounds.xml" -#define BURSTSOUNDSFILENAME "Sounds\\BurstSounds.xml" +#define BOBBYRAYSTRINGSFILENAME "BobbyRayStrings.xml" +#define AMMOCALIBERSTRINGSFILENAME "AmmoCaliberStrings.xml" -#define EXPLOSIONDATAFILENAME "ExplosionData.xml" +#define SOUNDSFILENAME "Sounds\\Sounds.xml" +#define BURSTSOUNDSFILENAME "Sounds\\BurstSounds.xml" -#define CITYTABLEFILENAME "Map\\Cities.xml" -#define MOVEMENTCOSTFILENAME "Map\\MovementCosts.xml" -#define ALTSECTORSFILENAME "Map\\AltSectors.xml" -#define SAMSITESFILENAME "Map\\SamSites.xml" +#define EXPLOSIONDATAFILENAME "ExplosionData.xml" + +#define CITYTABLEFILENAME "Map\\Cities.xml" +#define MOVEMENTCOSTFILENAME "Map\\MovementCosts.xml" +#define ALTSECTORSFILENAME "Map\\AltSectors.xml" +#define SAMSITESFILENAME "Map\\SamSites.xml" #define ROAMINGMILITIAFILENAME "Map\\RestrictedRoamingMilitia.xml" -#define GARRISONFILENAME "Army\\GarrisonGroups.xml" -#define PATROLFILENAME "Army\\PatrolGroups.xml" -#define COMPOSITIONFILENAME "Army\\ArmyComposition.xml" +#define GARRISONFILENAME "Army\\GarrisonGroups.xml" +#define PATROLFILENAME "Army\\PatrolGroups.xml" +#define COMPOSITIONFILENAME "Army\\ArmyComposition.xml" // WANNE: drops filename -#define ENEMYWEAPONDROPSFILENAME "EnemyWeaponDrops.xml" -#define ENEMYAMMODROPSFILENAME "EnemyAmmoDrops.xml" -#define ENEMYEXPLOSIVEDROPSFILENAME "EnemyExplosiveDrops.xml" -#define ENEMYARMOURDROPSFILENAME "EnemyArmourDrops.xml" -#define ENEMYMISCDROPSFILENAME "EnemyMiscDrops.xml" +#define ENEMYWEAPONDROPSFILENAME "EnemyWeaponDrops.xml" +#define ENEMYAMMODROPSFILENAME "EnemyAmmoDrops.xml" +#define ENEMYEXPLOSIVEDROPSFILENAME "EnemyExplosiveDrops.xml" +#define ENEMYARMOURDROPSFILENAME "EnemyArmourDrops.xml" +#define ENEMYMISCDROPSFILENAME "EnemyMiscDrops.xml" // WANNE: Sector loadscreens [2007-05-18] #define SECTORLOADSCREENSFILENAME "Map\\SectorLoadscreens.xml" @@ -119,6 +129,16 @@ extern BOOLEAN WriteAttachmentComboMergeStats(); extern BOOLEAN ReadInArmourStats(STR fileName); extern BOOLEAN WriteArmourStats(); +// CHRISL: +extern BOOLEAN ReadInlbeStats(STR fileName); +extern BOOLEAN WritelbeEquipmentStats(); + +extern BOOLEAN ReadInLBEPocketStats(STR fileName, BOOLEAN localizedVersion); +extern BOOLEAN WriteLBEPocketEquipmentStats(); + +extern BOOLEAN ReadInMercStartingGearStats(STR fileName); +extern BOOLEAN WriteMercStartingGearStats(); + extern BOOLEAN ReadInExplosiveStats(STR fileName); extern BOOLEAN WriteExplosiveStats(); diff --git a/Tactical/XML_AmmoStrings.cpp b/Tactical/XML_AmmoStrings.cpp index 5c1dbc3e..35d2c0fd 100644 --- a/Tactical/XML_AmmoStrings.cpp +++ b/Tactical/XML_AmmoStrings.cpp @@ -3,42 +3,8 @@ #else #include "sgp.h" #include "overhead types.h" - #include "Sound Control.h" - #include "Soldier Control.h" #include "overhead.h" - #include "Event Pump.h" - #include "weapons.h" - #include "Animation Control.h" - #include "sys globals.h" - #include "Handle UI.h" - #include "Isometric Utils.h" - #include "worldman.h" - #include "math.h" - #include "points.h" - #include "ai.h" - #include "los.h" - #include "renderworld.h" - #include "opplist.h" - #include "interface.h" - #include "message.h" - #include "campaign.h" - #include "items.h" #include "text.h" - #include "Soldier Profile.h" - #include "tile animation.h" - #include "Dialogue Control.h" - #include "SkillCheck.h" - #include "explosion control.h" - #include "Quests.h" - #include "Physics.h" - #include "Random.h" - #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" - #include "meanwhile.h" - #include "SkillCheck.h" - #include "gamesettings.h" - #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" @@ -51,13 +17,13 @@ struct CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; UINT32 maxArraySize; - UINT32 curIndex; + UINT32 curIndex; UINT32 currentDepth; UINT32 maxReadDepth; } typedef ammoParseData; -static void XMLCALL +static void XMLCALL ammoStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { ammoParseData * pData = (ammoParseData *)userData; @@ -98,9 +64,9 @@ ammoCharacterDataHandle(void *userData, const XML_Char *str, int len) { ammoParseData * pData = (ammoParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); } } @@ -108,8 +74,10 @@ ammoCharacterDataHandle(void *userData, const XML_Char *str, int len) static void XMLCALL ammoEndElementHandle(void *userData, const XML_Char *name) -{ +{ +#if 0 char temp; +#endif ammoParseData * pData = (ammoParseData *)userData; if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading @@ -177,7 +145,7 @@ BOOLEAN ReadInAmmoStats(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + ammoParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading AmmoStrings.xml" ); @@ -186,7 +154,7 @@ BOOLEAN ReadInAmmoStats(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -201,19 +169,19 @@ BOOLEAN ReadInAmmoStats(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, ammoStartElementHandle, ammoEndElementHandle); XML_SetCharacterDataHandler(parser, ammoCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); - pData.maxArraySize = MAXITEMS; + pData.maxArraySize = MAXITEMS; pData.curIndex = -1; - + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -240,7 +208,7 @@ BOOLEAN WriteAmmoStats() hFile = FileOpen( "TABLEDATA\\Ammos out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -256,7 +224,7 @@ BOOLEAN WriteAmmoStats() { UINT32 uiCharLoc = wcscspn(szRemainder,L"&<>\'\"\0"); CHAR16 invChar = szRemainder[uiCharLoc]; - + if(uiCharLoc) { szRemainder[uiCharLoc] = '\0'; @@ -304,7 +272,7 @@ BOOLEAN WriteAmmoStats() { UINT32 uiCharLoc = wcscspn(szRemainder,L"&<>\'\"\0"); CHAR16 invChar = szRemainder[uiCharLoc]; - + if(uiCharLoc) { szRemainder[uiCharLoc] = '\0'; @@ -352,4 +320,4 @@ BOOLEAN WriteAmmoStats() FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_AmmoTypes.cpp b/Tactical/XML_AmmoTypes.cpp index 7acad268..0dc9ab18 100644 --- a/Tactical/XML_AmmoTypes.cpp +++ b/Tactical/XML_AmmoTypes.cpp @@ -2,49 +2,14 @@ #include "Tactical All.h" #else #include "sgp.h" - #include "overhead types.h" - #include "Sound Control.h" - #include "Soldier Control.h" + #include "weapons.h" #include "overhead.h" - #include "Event Pump.h" - #include "weapons.h" - #include "Animation Control.h" - #include "sys globals.h" - #include "Handle UI.h" - #include "Isometric Utils.h" - #include "worldman.h" - #include "math.h" - #include "points.h" - #include "ai.h" - #include "los.h" - #include "renderworld.h" - #include "opplist.h" - #include "interface.h" - #include "message.h" - #include "campaign.h" - #include "items.h" - #include "weapons.h" - #include "text.h" - #include "Soldier Profile.h" - #include "tile animation.h" - #include "Dialogue Control.h" - #include "SkillCheck.h" - #include "explosion control.h" - #include "Quests.h" - #include "Physics.h" - #include "Random.h" - #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" - #include "meanwhile.h" - #include "SkillCheck.h" - #include "gamesettings.h" - #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" #endif + struct { PARSE_STAGE curElement; @@ -53,13 +18,13 @@ struct AMMOTYPE curAmmoType; AMMOTYPE * curArray; UINT32 maxArraySize; - + UINT32 currentDepth; UINT32 maxReadDepth; } typedef ammotypeParseData; -static void XMLCALL +static void XMLCALL ammotypeStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { ammotypeParseData * pData = (ammotypeParseData *)userData; @@ -130,11 +95,11 @@ ammotypeCharacterDataHandle(void *userData, const XML_Char *str, int len) { ammotypeParseData * pData = (ammotypeParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); - } + } } @@ -161,147 +126,147 @@ ammotypeEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "uiIndex") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.uiIndex = (UINT32) atol(pData->szCharData); + pData->curAmmoType.uiIndex = (UINT32) atol(pData->szCharData); } else if(strcmp(name, "fontColour") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.fontColour = (UINT8) atol(pData->szCharData); + pData->curAmmoType.fontColour = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "grayed") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.grayed = (INT32) atol(pData->szCharData); + pData->curAmmoType.grayed = (INT32) atol(pData->szCharData); } else if(strcmp(name, "offNormal") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.offNormal = (INT32) atol(pData->szCharData); + pData->curAmmoType.offNormal = (INT32) atol(pData->szCharData); } else if(strcmp(name, "onNormal") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.onNormal = (INT32) atol(pData->szCharData); + pData->curAmmoType.onNormal = (INT32) atol(pData->szCharData); } else if(strcmp(name, "structureImpactReductionMultiplier") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.structureImpactReductionMultiplier = (INT32) atol(pData->szCharData); + pData->curAmmoType.structureImpactReductionMultiplier = (INT32) atol(pData->szCharData); } else if(strcmp(name, "armourImpactReductionMultiplier") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.armourImpactReductionMultiplier = (INT32) atol(pData->szCharData); + pData->curAmmoType.armourImpactReductionMultiplier = (INT32) atol(pData->szCharData); } else if(strcmp(name, "afterArmourDamageMultiplier") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.afterArmourDamageMultiplier = (INT32) atol(pData->szCharData); + pData->curAmmoType.afterArmourDamageMultiplier = (INT32) atol(pData->szCharData); } else if(strcmp(name, "beforeArmourDamageMultiplier") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.beforeArmourDamageMultiplier = (INT32) atol(pData->szCharData); + pData->curAmmoType.beforeArmourDamageMultiplier = (INT32) atol(pData->szCharData); } else if(strcmp(name, "multipleBulletDamageMultiplier") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.multipleBulletDamageMultiplier = (INT32) atol(pData->szCharData); + pData->curAmmoType.multipleBulletDamageMultiplier = (INT32) atol(pData->szCharData); } else if(strcmp(name, "structureImpactReductionDivisor") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.structureImpactReductionDivisor = (INT32) atol(pData->szCharData); + pData->curAmmoType.structureImpactReductionDivisor = (INT32) atol(pData->szCharData); } else if(strcmp(name, "armourImpactReductionDivisor") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.armourImpactReductionDivisor = (INT32) atol(pData->szCharData); + pData->curAmmoType.armourImpactReductionDivisor = (INT32) atol(pData->szCharData); } else if(strcmp(name, "afterArmourDamageDivisor") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.afterArmourDamageDivisor = (INT32) atol(pData->szCharData); + pData->curAmmoType.afterArmourDamageDivisor = (INT32) atol(pData->szCharData); } else if(strcmp(name, "beforeArmourDamageDivisor") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.beforeArmourDamageDivisor = (INT32) atol(pData->szCharData); + pData->curAmmoType.beforeArmourDamageDivisor = (INT32) atol(pData->szCharData); } else if(strcmp(name, "multipleBulletDamageDivisor") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.multipleBulletDamageDivisor = (INT32) atol(pData->szCharData); + pData->curAmmoType.multipleBulletDamageDivisor = (INT32) atol(pData->szCharData); } else if(strcmp(name, "lockBustingPower") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.lockBustingPower = (INT16) atol(pData->szCharData); + pData->curAmmoType.lockBustingPower = (INT16) atol(pData->szCharData); } else if(strcmp(name, "zeroMinimumDamage") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.zeroMinimumDamage = (BOOLEAN) atol(pData->szCharData); + pData->curAmmoType.zeroMinimumDamage = (BOOLEAN) atol(pData->szCharData); } else if(strcmp(name, "canGoThrough") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.canGoThrough = (BOOLEAN) atol(pData->szCharData); + pData->curAmmoType.canGoThrough = (BOOLEAN) atol(pData->szCharData); } else if(strcmp(name, "standardIssue") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.standardIssue = (BOOLEAN) atol(pData->szCharData); + pData->curAmmoType.standardIssue = (BOOLEAN) atol(pData->szCharData); } else if(strcmp(name, "numberOfBullets") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.numberOfBullets = (UINT8) atol(pData->szCharData); + pData->curAmmoType.numberOfBullets = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "highExplosive") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.highExplosive = (BOOLEAN) atol(pData->szCharData); + pData->curAmmoType.highExplosive = (BOOLEAN) atol(pData->szCharData); } else if(strcmp(name, "explosionSize") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.explosionSize = (UINT8) atol(pData->szCharData); + pData->curAmmoType.explosionSize = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "antiTank") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.antiTank = (BOOLEAN) atol(pData->szCharData); + pData->curAmmoType.antiTank = (BOOLEAN) atol(pData->szCharData); } else if(strcmp(name, "dart") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.dart = (BOOLEAN) atol(pData->szCharData); + pData->curAmmoType.dart = (BOOLEAN) atol(pData->szCharData); } else if(strcmp(name, "knife") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.knife = (BOOLEAN) atol(pData->szCharData); + pData->curAmmoType.knife = (BOOLEAN) atol(pData->szCharData); } else if(strcmp(name, "monsterSpit") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.monsterSpit = (BOOLEAN) atol(pData->szCharData); + pData->curAmmoType.monsterSpit = (BOOLEAN) atol(pData->szCharData); } else if(strcmp(name, "ignoreArmour") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.ignoreArmour = (BOOLEAN) atol(pData->szCharData); + pData->curAmmoType.ignoreArmour = (BOOLEAN) atol(pData->szCharData); } else if(strcmp(name, "acidic") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.acidic = (BOOLEAN) atol(pData->szCharData); + pData->curAmmoType.acidic = (BOOLEAN) atol(pData->szCharData); } else if(strcmp(name, "tracerEffect") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.tracerEffect = (BOOLEAN) atol(pData->szCharData); + pData->curAmmoType.tracerEffect = (BOOLEAN) atol(pData->szCharData); } pData->maxReadDepth--; @@ -320,7 +285,7 @@ BOOLEAN ReadInAmmoTypeStats(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + ammotypeParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading AmmoTypes.xml" ); @@ -329,7 +294,7 @@ BOOLEAN ReadInAmmoTypeStats(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -344,19 +309,19 @@ BOOLEAN ReadInAmmoTypeStats(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, ammotypeStartElementHandle, ammotypeEndElementHandle); XML_SetCharacterDataHandler(parser, ammotypeCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); pData.curArray = AmmoTypes; - pData.maxArraySize = MAXITEMS; - + pData.maxArraySize = MAXITEMS; + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -385,7 +350,7 @@ BOOLEAN WriteAmmoTypeStats() hFile = FileOpen( "TABLEDATA\\AmmoType out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -396,34 +361,34 @@ BOOLEAN WriteAmmoTypeStats() FilePrintf(hFile,"\t\r\n"); FilePrintf(hFile,"\t\t%d\r\n", cnt ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].fontColour ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].grayed ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].offNormal ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].onNormal ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].structureImpactReductionMultiplier ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].structureImpactReductionDivisor ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].armourImpactReductionMultiplier ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].armourImpactReductionDivisor ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].beforeArmourDamageMultiplier ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].beforeArmourDamageDivisor ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].afterArmourDamageMultiplier ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].afterArmourDamageDivisor ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].zeroMinimumDamage ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].canGoThrough ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].standardIssue ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].numberOfBullets ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].multipleBulletDamageMultiplier ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].multipleBulletDamageDivisor ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].highExplosive ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].explosionSize ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].antiTank ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].dart ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].knife ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].monsterSpit ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].acidic ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].ignoreArmour ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].lockBustingPower ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].tracerEffect ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].fontColour ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].grayed ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].offNormal ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].onNormal ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].structureImpactReductionMultiplier ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].structureImpactReductionDivisor ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].armourImpactReductionMultiplier ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].armourImpactReductionDivisor ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].beforeArmourDamageMultiplier ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].beforeArmourDamageDivisor ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].afterArmourDamageMultiplier ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].afterArmourDamageDivisor ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].zeroMinimumDamage ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].canGoThrough ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].standardIssue ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].numberOfBullets ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].multipleBulletDamageMultiplier ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].multipleBulletDamageDivisor ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].highExplosive ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].explosionSize ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].antiTank ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].dart ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].knife ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].monsterSpit ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].acidic ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].ignoreArmour ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].lockBustingPower ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].tracerEffect ); FilePrintf(hFile,"\t\r\n"); @@ -433,4 +398,4 @@ BOOLEAN WriteAmmoTypeStats() FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_Armour.cpp b/Tactical/XML_Armour.cpp index 4f273bf0..b37c4424 100644 --- a/Tactical/XML_Armour.cpp +++ b/Tactical/XML_Armour.cpp @@ -2,44 +2,9 @@ #include "Tactical All.h" #else #include "sgp.h" - #include "overhead types.h" - #include "Sound Control.h" - #include "Soldier Control.h" + #include "weapons.h" #include "overhead.h" - #include "Event Pump.h" - #include "weapons.h" - #include "Animation Control.h" - #include "sys globals.h" - #include "Handle UI.h" - #include "Isometric Utils.h" - #include "worldman.h" - #include "math.h" - #include "points.h" - #include "ai.h" - #include "los.h" - #include "renderworld.h" - #include "opplist.h" - #include "interface.h" - #include "message.h" - #include "campaign.h" - #include "items.h" - #include "weapons.h" - #include "text.h" - #include "Soldier Profile.h" - #include "tile animation.h" - #include "Dialogue Control.h" - #include "SkillCheck.h" - #include "explosion control.h" - #include "Quests.h" - #include "Physics.h" - #include "Random.h" - #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" - #include "meanwhile.h" - #include "SkillCheck.h" - #include "gamesettings.h" - #include "SaveLoadMap.h" + #include "GameSettings.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" @@ -53,13 +18,13 @@ struct ARMOURTYPE curArmour; ARMOURTYPE * curArray; UINT32 maxArraySize; - + UINT32 currentDepth; UINT32 maxReadDepth; } typedef armourParseData; -static void XMLCALL +static void XMLCALL armourStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { armourParseData * pData = (armourParseData *)userData; @@ -106,11 +71,11 @@ armourCharacterDataHandle(void *userData, const XML_Char *str, int len) { armourParseData * pData = (armourParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); - } + } } @@ -137,12 +102,12 @@ armourEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "uiIndex") == 0) { pData->curElement = ELEMENT; - pData->curArmour.uiIndex = (UINT32) atol(pData->szCharData); + pData->curArmour.uiIndex = (UINT32) atol(pData->szCharData); } else if(strcmp(name, "ubArmourClass") == 0) { pData->curElement = ELEMENT; - pData->curArmour.ubArmourClass = (UINT8) atol(pData->szCharData); + pData->curArmour.ubArmourClass = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "ubProtection") == 0) { @@ -160,7 +125,7 @@ armourEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "ubDegradePercent") == 0) { pData->curElement = ELEMENT; - pData->curArmour.ubDegradePercent = (UINT8) atol(pData->szCharData); + pData->curArmour.ubDegradePercent = (UINT8) atol(pData->szCharData); } pData->maxReadDepth--; @@ -179,7 +144,7 @@ BOOLEAN ReadInArmourStats(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + armourParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading Armours.xml" ); @@ -188,7 +153,7 @@ BOOLEAN ReadInArmourStats(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -203,19 +168,19 @@ BOOLEAN ReadInArmourStats(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, armourStartElementHandle, armourEndElementHandle); XML_SetCharacterDataHandler(parser, armourCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); pData.curArray = Armour; - pData.maxArraySize = MAXITEMS; - + pData.maxArraySize = MAXITEMS; + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -244,7 +209,7 @@ BOOLEAN WriteArmourStats() hFile = FileOpen( "TABLEDATA\\Armour out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -255,10 +220,10 @@ BOOLEAN WriteArmourStats() FilePrintf(hFile,"\t\r\n"); FilePrintf(hFile,"\t\t%d\r\n", cnt ); - FilePrintf(hFile,"\t\t%d\r\n", Armour[cnt].ubArmourClass ); - FilePrintf(hFile,"\t\t%d\r\n", Armour[cnt].ubProtection ); - FilePrintf(hFile,"\t\t%d\r\n", Armour[cnt].ubCoverage ); - FilePrintf(hFile,"\t\t%d\r\n", Armour[cnt].ubDegradePercent ); + FilePrintf(hFile,"\t\t%d\r\n", Armour[cnt].ubArmourClass ); + FilePrintf(hFile,"\t\t%d\r\n", Armour[cnt].ubProtection ); + FilePrintf(hFile,"\t\t%d\r\n", Armour[cnt].ubCoverage ); + FilePrintf(hFile,"\t\t%d\r\n", Armour[cnt].ubDegradePercent ); FilePrintf(hFile,"\t\r\n"); } @@ -267,4 +232,4 @@ BOOLEAN WriteArmourStats() FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_AttachmentInfo.cpp b/Tactical/XML_AttachmentInfo.cpp index 31e9c11a..0aacb7da 100644 --- a/Tactical/XML_AttachmentInfo.cpp +++ b/Tactical/XML_AttachmentInfo.cpp @@ -2,43 +2,8 @@ #include "Tactical All.h" #else #include "sgp.h" - #include "overhead types.h" - #include "Sound Control.h" - #include "Soldier Control.h" #include "overhead.h" - #include "Event Pump.h" #include "weapons.h" - #include "Animation Control.h" - #include "sys globals.h" - #include "Handle UI.h" - #include "Isometric Utils.h" - #include "worldman.h" - #include "math.h" - #include "points.h" - #include "ai.h" - #include "los.h" - #include "renderworld.h" - #include "opplist.h" - #include "interface.h" - #include "message.h" - #include "campaign.h" - #include "items.h" - #include "text.h" - #include "Soldier Profile.h" - #include "tile animation.h" - #include "Dialogue Control.h" - #include "SkillCheck.h" - #include "explosion control.h" - #include "Quests.h" - #include "Physics.h" - #include "Random.h" - #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" - #include "meanwhile.h" - #include "SkillCheck.h" - #include "gamesettings.h" - #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" @@ -52,13 +17,13 @@ struct AttachmentInfoStruct curAttachmentInfo; AttachmentInfoStruct * curArray; UINT32 maxArraySize; - + UINT32 currentDepth; UINT32 maxReadDepth; } typedef attachmentinfoParseData; -static void XMLCALL +static void XMLCALL attachmentinfoStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { attachmentinfoParseData * pData = (attachmentinfoParseData *)userData; @@ -105,11 +70,11 @@ attachmentinfoCharacterDataHandle(void *userData, const XML_Char *str, int len) { attachmentinfoParseData * pData = (attachmentinfoParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); - } + } } @@ -136,12 +101,12 @@ attachmentinfoEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "uiIndex") == 0) { pData->curElement = ELEMENT; - pData->curAttachmentInfo.uiIndex = (UINT32) atol(pData->szCharData); + pData->curAttachmentInfo.uiIndex = (UINT32) atol(pData->szCharData); } else if(strcmp(name, "usItem") == 0) { pData->curElement = ELEMENT; - pData->curAttachmentInfo.usItem = (UINT16) atol(pData->szCharData); + pData->curAttachmentInfo.usItem = (UINT16) atol(pData->szCharData); } else if(strcmp(name, "uiItemClass") == 0) { @@ -151,12 +116,12 @@ attachmentinfoEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "bAttachmentSkillCheck") == 0) { pData->curElement = ELEMENT; - pData->curAttachmentInfo.bAttachmentSkillCheck = (INT8) atol(pData->szCharData); + pData->curAttachmentInfo.bAttachmentSkillCheck = (INT8) atol(pData->szCharData); } else if(strcmp(name, "bAttachmentSkillCheckMod") == 0) { pData->curElement = ELEMENT; - pData->curAttachmentInfo.bAttachmentSkillCheckMod = (INT8) atol(pData->szCharData); + pData->curAttachmentInfo.bAttachmentSkillCheckMod = (INT8) atol(pData->szCharData); } pData->maxReadDepth--; @@ -175,7 +140,7 @@ BOOLEAN ReadInAttachmentInfoStats(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + attachmentinfoParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading AttachmentInfo.xml" ); @@ -184,7 +149,7 @@ BOOLEAN ReadInAttachmentInfoStats(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -199,19 +164,19 @@ BOOLEAN ReadInAttachmentInfoStats(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, attachmentinfoStartElementHandle, attachmentinfoEndElementHandle); XML_SetCharacterDataHandler(parser, attachmentinfoCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); pData.curArray = AttachmentInfo; - pData.maxArraySize = MAXITEMS; - + pData.maxArraySize = MAXITEMS; + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -240,7 +205,7 @@ BOOLEAN WriteAttachmentInfoStats() hFile = FileOpen( "TABLEDATA\\AttachmentInfo out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -252,9 +217,9 @@ BOOLEAN WriteAttachmentInfoStats() FilePrintf(hFile,"\t\t%d\r\n", cnt ); FilePrintf(hFile,"\t\t%d\r\n", AttachmentInfo[cnt].usItem ); - FilePrintf(hFile,"\t\t%d\r\n", AttachmentInfo[cnt].uiItemClass ); - FilePrintf(hFile,"\t\t%d\r\n", AttachmentInfo[cnt].bAttachmentSkillCheck ); - FilePrintf(hFile,"\t\t%d\r\n", AttachmentInfo[cnt].bAttachmentSkillCheckMod ); + FilePrintf(hFile,"\t\t%d\r\n", AttachmentInfo[cnt].uiItemClass ); + FilePrintf(hFile,"\t\t%d\r\n", AttachmentInfo[cnt].bAttachmentSkillCheck ); + FilePrintf(hFile,"\t\t%d\r\n", AttachmentInfo[cnt].bAttachmentSkillCheckMod ); FilePrintf(hFile,"\t\r\n"); } @@ -263,4 +228,4 @@ BOOLEAN WriteAttachmentInfoStats() FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_Attachments.cpp b/Tactical/XML_Attachments.cpp index 9bff01a2..892e1606 100644 --- a/Tactical/XML_Attachments.cpp +++ b/Tactical/XML_Attachments.cpp @@ -2,43 +2,8 @@ #include "Tactical All.h" #else #include "sgp.h" - #include "overhead types.h" - #include "Sound Control.h" - #include "Soldier Control.h" #include "overhead.h" - #include "Event Pump.h" #include "weapons.h" - #include "Animation Control.h" - #include "sys globals.h" - #include "Handle UI.h" - #include "Isometric Utils.h" - #include "worldman.h" - #include "math.h" - #include "points.h" - #include "ai.h" - #include "los.h" - #include "renderworld.h" - #include "opplist.h" - #include "interface.h" - #include "message.h" - #include "campaign.h" - #include "items.h" - #include "text.h" - #include "Soldier Profile.h" - #include "tile animation.h" - #include "Dialogue Control.h" - #include "SkillCheck.h" - #include "explosion control.h" - #include "Quests.h" - #include "Physics.h" - #include "Random.h" - #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" - #include "meanwhile.h" - #include "SkillCheck.h" - #include "gamesettings.h" - #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" @@ -52,13 +17,13 @@ struct UINT16 curAttachment[3]; UINT32 maxArraySize; - UINT32 curIndex; + UINT32 curIndex; UINT32 currentDepth; UINT32 maxReadDepth; } typedef attachmentParseData; -static void XMLCALL +static void XMLCALL attachmentStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { attachmentParseData * pData = (attachmentParseData *)userData; @@ -104,9 +69,9 @@ attachmentCharacterDataHandle(void *userData, const XML_Char *str, int len) { attachmentParseData * pData = (attachmentParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); } } @@ -167,7 +132,7 @@ BOOLEAN ReadInAttachmentStats(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + attachmentParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading Attachments.xml" ); @@ -176,7 +141,7 @@ BOOLEAN ReadInAttachmentStats(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -191,19 +156,19 @@ BOOLEAN ReadInAttachmentStats(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, attachmentStartElementHandle, attachmentEndElementHandle); XML_SetCharacterDataHandler(parser, attachmentCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); - pData.maxArraySize = MAXATTACHMENTS; + pData.maxArraySize = MAXATTACHMENTS; pData.curIndex = -1; - + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -230,7 +195,7 @@ BOOLEAN WriteAttachmentStats() hFile = FileOpen( "TABLEDATA\\Attachments out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -250,4 +215,4 @@ BOOLEAN WriteAttachmentStats() FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_BurstSounds.cpp b/Tactical/XML_BurstSounds.cpp index 022b1f48..bdb183d0 100644 --- a/Tactical/XML_BurstSounds.cpp +++ b/Tactical/XML_BurstSounds.cpp @@ -49,15 +49,15 @@ struct PARSE_STAGE curElement; CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; - + UINT32 maxArraySize; - UINT32 curIndex; + UINT32 curIndex; UINT32 currentDepth; UINT32 maxReadDepth; } typedef burstSoundParseData; -static void XMLCALL +static void XMLCALL burstSoundStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { burstSoundParseData * pData = (burstSoundParseData *)userData; @@ -90,9 +90,9 @@ burstSoundCharacterDataHandle(void *userData, const XML_Char *str, int len) { burstSoundParseData * pData = (burstSoundParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); } } @@ -140,7 +140,7 @@ BOOLEAN ReadInBurstSoundArray(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + burstSoundParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("Loading %s",SOUNDSFILENAME ) ); @@ -149,7 +149,7 @@ BOOLEAN ReadInBurstSoundArray(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -164,19 +164,19 @@ BOOLEAN ReadInBurstSoundArray(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, burstSoundStartElementHandle, burstSoundEndElementHandle); XML_SetCharacterDataHandler(parser, burstSoundCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); - pData.maxArraySize = MAX_SAMPLES; + pData.maxArraySize = MAX_SAMPLES; pData.curIndex = -1; XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -203,7 +203,7 @@ BOOLEAN WriteBurstSoundArray() hFile = FileOpen( "TABLEDATA\\BurstSounds out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -218,7 +218,7 @@ BOOLEAN WriteBurstSoundArray() { UINT32 uiCharLoc = strcspn(szRemainder,"&<>\'\"\0"); char invChar = szRemainder[uiCharLoc]; - + if(uiCharLoc) { szRemainder[uiCharLoc] = '\0'; diff --git a/Tactical/XML_ComboMergeInfo.cpp b/Tactical/XML_ComboMergeInfo.cpp index c22e7ee6..12847d1c 100644 --- a/Tactical/XML_ComboMergeInfo.cpp +++ b/Tactical/XML_ComboMergeInfo.cpp @@ -2,44 +2,8 @@ #include "Tactical All.h" #else #include "sgp.h" - #include "overhead types.h" - #include "Sound Control.h" - #include "Soldier Control.h" #include "overhead.h" - #include "Event Pump.h" #include "weapons.h" - #include "Animation Control.h" - #include "sys globals.h" - #include "Handle UI.h" - #include "Isometric Utils.h" - #include "worldman.h" - #include "math.h" - #include "points.h" - #include "ai.h" - #include "los.h" - #include "renderworld.h" - #include "opplist.h" - #include "interface.h" - #include "message.h" - #include "campaign.h" - #include "items.h" - #include "weapons.h" - #include "text.h" - #include "Soldier Profile.h" - #include "tile animation.h" - #include "Dialogue Control.h" - #include "SkillCheck.h" - #include "explosion control.h" - #include "Quests.h" - #include "Physics.h" - #include "Random.h" - #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" - #include "meanwhile.h" - #include "SkillCheck.h" - #include "gamesettings.h" - #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" @@ -53,13 +17,13 @@ struct ComboMergeInfoStruct curAttachmentComboMerge; ComboMergeInfoStruct * curArray; UINT32 maxArraySize; - + UINT32 currentDepth; UINT32 maxReadDepth; } typedef attachmentcombomergeParseData; -static void XMLCALL +static void XMLCALL attachmentcombomergeStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { attachmentcombomergeParseData * pData = (attachmentcombomergeParseData *)userData; @@ -106,11 +70,11 @@ attachmentcombomergeCharacterDataHandle(void *userData, const XML_Char *str, int { attachmentcombomergeParseData * pData = (attachmentcombomergeParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); - } + } } @@ -137,12 +101,12 @@ attachmentcombomergeEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "uiIndex") == 0) { pData->curElement = ELEMENT; - pData->curAttachmentComboMerge.uiIndex = (UINT32) atol(pData->szCharData); + pData->curAttachmentComboMerge.uiIndex = (UINT32) atol(pData->szCharData); } else if(strcmp(name, "usItem") == 0) { pData->curElement = ELEMENT; - pData->curAttachmentComboMerge.usItem = (UINT16) atol(pData->szCharData); + pData->curAttachmentComboMerge.usItem = (UINT16) atol(pData->szCharData); } else if(strcmp(name, "usAttachment1") == 0) { @@ -157,7 +121,7 @@ attachmentcombomergeEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "usResult") == 0) { pData->curElement = ELEMENT; - pData->curAttachmentComboMerge.usResult = (UINT16) atol(pData->szCharData); + pData->curAttachmentComboMerge.usResult = (UINT16) atol(pData->szCharData); } pData->maxReadDepth--; @@ -176,7 +140,7 @@ BOOLEAN ReadInAttachmentComboMergeStats(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + attachmentcombomergeParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading AttachmentComboMerges.xml" ); @@ -185,7 +149,7 @@ BOOLEAN ReadInAttachmentComboMergeStats(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -193,7 +157,7 @@ BOOLEAN ReadInAttachmentComboMergeStats(STR fileName) if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) ) { MemFree(lpcBuffer); - FileClose( hFile ); /* added, Sgt. Kolja */ + FileClose( hFile ); /* added, Sgt. Kolja */ return( FALSE ); } @@ -201,19 +165,19 @@ BOOLEAN ReadInAttachmentComboMergeStats(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, attachmentcombomergeStartElementHandle, attachmentcombomergeEndElementHandle); XML_SetCharacterDataHandler(parser, attachmentcombomergeCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); pData.curArray = AttachmentComboMerge; - pData.maxArraySize = MAXITEMS; - + pData.maxArraySize = MAXITEMS; + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -221,7 +185,7 @@ BOOLEAN ReadInAttachmentComboMergeStats(STR fileName) LiveMessage(errorBuf); MemFree(lpcBuffer); - XML_ParserFree(parser); /* added, Sgt. Kolja */ + XML_ParserFree(parser); /* added, Sgt. Kolja */ return FALSE; } @@ -243,7 +207,7 @@ BOOLEAN WriteAttachmentComboMergeStats() hFile = FileOpen( "TABLEDATA\\AttachmentComboMerge out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -254,10 +218,10 @@ BOOLEAN WriteAttachmentComboMergeStats() FilePrintf(hFile,"\t\r\n"); FilePrintf(hFile,"\t\t%d\r\n", cnt ); - FilePrintf(hFile,"\t\t%d\r\n", AttachmentComboMerge[cnt].usItem ); - FilePrintf(hFile,"\t\t%d\r\n", AttachmentComboMerge[cnt].usAttachment[0] ); - FilePrintf(hFile,"\t\t%d\r\n", AttachmentComboMerge[cnt].usAttachment[1] ); - FilePrintf(hFile,"\t\t%d\r\n", AttachmentComboMerge[cnt].usResult ); + FilePrintf(hFile,"\t\t%d\r\n", AttachmentComboMerge[cnt].usItem ); + FilePrintf(hFile,"\t\t%d\r\n", AttachmentComboMerge[cnt].usAttachment[0] ); + FilePrintf(hFile,"\t\t%d\r\n", AttachmentComboMerge[cnt].usAttachment[1] ); + FilePrintf(hFile,"\t\t%d\r\n", AttachmentComboMerge[cnt].usResult ); FilePrintf(hFile,"\t\r\n"); } @@ -266,4 +230,4 @@ BOOLEAN WriteAttachmentComboMergeStats() FileClose( hFile ); return( TRUE ); -} +} diff --git a/Tactical/XML_CompatibleFaceItems.cpp b/Tactical/XML_CompatibleFaceItems.cpp index ac5b0730..fc1d6bd2 100644 --- a/Tactical/XML_CompatibleFaceItems.cpp +++ b/Tactical/XML_CompatibleFaceItems.cpp @@ -2,43 +2,8 @@ #include "Tactical All.h" #else #include "sgp.h" - #include "overhead types.h" - #include "Sound Control.h" - #include "Soldier Control.h" #include "overhead.h" - #include "Event Pump.h" #include "weapons.h" - #include "Animation Control.h" - #include "sys globals.h" - #include "Handle UI.h" - #include "Isometric Utils.h" - #include "worldman.h" - #include "math.h" - #include "points.h" - #include "ai.h" - #include "los.h" - #include "renderworld.h" - #include "opplist.h" - #include "interface.h" - #include "message.h" - #include "campaign.h" - #include "items.h" - #include "text.h" - #include "Soldier Profile.h" - #include "tile animation.h" - #include "Dialogue Control.h" - #include "SkillCheck.h" - #include "explosion control.h" - #include "Quests.h" - #include "Physics.h" - #include "Random.h" - #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" - #include "meanwhile.h" - #include "SkillCheck.h" - #include "gamesettings.h" - #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" @@ -52,13 +17,13 @@ struct UINT16 curCompatibleFaceItem[2]; UINT32 maxArraySize; - UINT32 curIndex; + UINT32 curIndex; UINT32 currentDepth; UINT32 maxReadDepth; } typedef compatiblefaceitemParseData; -static void XMLCALL +static void XMLCALL compatiblefaceitemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { compatiblefaceitemParseData * pData = (compatiblefaceitemParseData *)userData; @@ -103,9 +68,9 @@ compatiblefaceitemCharacterDataHandle(void *userData, const XML_Char *str, int l { compatiblefaceitemParseData * pData = (compatiblefaceitemParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); } } @@ -160,7 +125,7 @@ BOOLEAN ReadInCompatibleFaceItemStats(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + compatiblefaceitemParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading CompatibleFaceItems.xml" ); @@ -169,7 +134,7 @@ BOOLEAN ReadInCompatibleFaceItemStats(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -184,19 +149,19 @@ BOOLEAN ReadInCompatibleFaceItemStats(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, compatiblefaceitemStartElementHandle, compatiblefaceitemEndElementHandle); XML_SetCharacterDataHandler(parser, compatiblefaceitemCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); - pData.maxArraySize = MAXITEMS; + pData.maxArraySize = MAXITEMS; pData.curIndex = -1; - + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -223,7 +188,7 @@ BOOLEAN WriteCompatibleFaceItemStats() hFile = FileOpen( "TABLEDATA\\CompatibleFaceItems out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -242,4 +207,4 @@ BOOLEAN WriteCompatibleFaceItemStats() FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_EnemyAmmoDrops.cpp b/Tactical/XML_EnemyAmmoDrops.cpp index 5d1461a5..8785964f 100644 --- a/Tactical/XML_EnemyAmmoDrops.cpp +++ b/Tactical/XML_EnemyAmmoDrops.cpp @@ -2,47 +2,11 @@ #include "Tactical All.h" #else #include "sgp.h" - #include "overhead types.h" - #include "Sound Control.h" - #include "Soldier Control.h" #include "overhead.h" - #include "Event Pump.h" #include "weapons.h" - #include "Animation Control.h" - #include "sys globals.h" - #include "Handle UI.h" - #include "Isometric Utils.h" - #include "worldman.h" - #include "math.h" - #include "points.h" - #include "ai.h" - #include "los.h" - #include "renderworld.h" - #include "opplist.h" - #include "interface.h" - #include "message.h" - #include "campaign.h" - #include "items.h" - #include "text.h" - #include "Soldier Profile.h" - #include "tile animation.h" - #include "Dialogue Control.h" - #include "SkillCheck.h" - #include "explosion control.h" - #include "Quests.h" - #include "Physics.h" - #include "Random.h" - #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" - #include "meanwhile.h" - #include "SkillCheck.h" - #include "gamesettings.h" - #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" - #include "EnemyItemDrops.h" #endif struct @@ -54,13 +18,13 @@ struct AMMO_DROPS * curArray; UINT32 maxArraySize; - UINT32 curIndex; + UINT32 curIndex; UINT32 currentDepth; UINT32 maxReadDepth; } typedef ammoDropParseData; -static void XMLCALL +static void XMLCALL ammoDropStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { ammoDropParseData * pData = (ammoDropParseData *)userData; @@ -84,7 +48,7 @@ ammoDropStartElementHandle(void *userData, const XML_Char *name, const XML_Char pData->maxReadDepth++; //we are not skipping this element } else if(pData->curElement == ELEMENT && - (strcmp(name, "uiIndex") == 0 || + (strcmp(name, "uiIndex") == 0 || strcmp(name, "uiType") == 0 || strcmp(name, "ubEnemyDropRate") == 0 || strcmp(name, "ubMilitiaDropRate") == 0)) @@ -106,9 +70,9 @@ ammoDropCharacterDataHandle(void *userData, const XML_Char *str, int len) { ammoDropParseData * pData = (ammoDropParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); } } @@ -116,7 +80,7 @@ ammoDropCharacterDataHandle(void *userData, const XML_Char *str, int len) static void XMLCALL ammoDropEndElementHandle(void *userData, const XML_Char *name) -{ +{ ammoDropParseData * pData = (ammoDropParseData *)userData; if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading @@ -137,22 +101,22 @@ ammoDropEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "uiIndex") == 0) { pData->curElement = ELEMENT; - pData->curAmmoDrop.uiIndex = (UINT32) atol(pData->szCharData); + pData->curAmmoDrop.uiIndex = (UINT32) atol(pData->szCharData); } else if(strcmp(name, "uiType") == 0) { pData->curElement = ELEMENT; - pData->curAmmoDrop.uiType = (UINT32) atol(pData->szCharData); + pData->curAmmoDrop.uiType = (UINT32) atol(pData->szCharData); } else if(strcmp(name, "ubEnemyDropRate") == 0) { pData->curElement = ELEMENT; - pData->curAmmoDrop.ubEnemyDropRate = (UINT8) atol(pData->szCharData); + pData->curAmmoDrop.ubEnemyDropRate = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "ubMilitiaDropRate") == 0) { pData->curElement = ELEMENT; - pData->curAmmoDrop.ubMilitiaDropRate = (UINT8) atol(pData->szCharData); + pData->curAmmoDrop.ubMilitiaDropRate = (UINT8) atol(pData->szCharData); } pData->maxReadDepth--; @@ -171,7 +135,7 @@ BOOLEAN ReadInEnemyAmmoDropsStats(AMMO_DROPS *pEnemyAmmoDrops, STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + ammoDropParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading EnemyAmmoDrops.xml" ); @@ -180,7 +144,7 @@ BOOLEAN ReadInEnemyAmmoDropsStats(AMMO_DROPS *pEnemyAmmoDrops, STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -195,19 +159,19 @@ BOOLEAN ReadInEnemyAmmoDropsStats(AMMO_DROPS *pEnemyAmmoDrops, STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, ammoDropStartElementHandle, ammoDropEndElementHandle); XML_SetCharacterDataHandler(parser, ammoDropCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); pData.curArray = pEnemyAmmoDrops; - pData.maxArraySize = MAX_DROP_ITEMS; - + pData.maxArraySize = MAX_DROP_ITEMS; + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -236,7 +200,7 @@ BOOLEAN WriteEnemyAmmoDropsStats(AMMO_DROPS *pEnemyAmmoDrops, STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -258,4 +222,4 @@ BOOLEAN WriteEnemyAmmoDropsStats(AMMO_DROPS *pEnemyAmmoDrops, STR fileName) FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_EnemyArmourDrops.cpp b/Tactical/XML_EnemyArmourDrops.cpp index 367767f1..98e65507 100644 --- a/Tactical/XML_EnemyArmourDrops.cpp +++ b/Tactical/XML_EnemyArmourDrops.cpp @@ -2,47 +2,11 @@ #include "Tactical All.h" #else #include "sgp.h" - #include "overhead types.h" - #include "Sound Control.h" - #include "Soldier Control.h" #include "overhead.h" - #include "Event Pump.h" #include "weapons.h" - #include "Animation Control.h" - #include "sys globals.h" - #include "Handle UI.h" - #include "Isometric Utils.h" - #include "worldman.h" - #include "math.h" - #include "points.h" - #include "ai.h" - #include "los.h" - #include "renderworld.h" - #include "opplist.h" - #include "interface.h" - #include "message.h" - #include "campaign.h" - #include "items.h" - #include "text.h" - #include "Soldier Profile.h" - #include "tile animation.h" - #include "Dialogue Control.h" - #include "SkillCheck.h" - #include "explosion control.h" - #include "Quests.h" - #include "Physics.h" - #include "Random.h" - #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" - #include "meanwhile.h" - #include "SkillCheck.h" - #include "gamesettings.h" - #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" - #include "EnemyItemDrops.h" #endif struct @@ -54,13 +18,13 @@ struct ARMOUR_DROPS * curArray; UINT32 maxArraySize; - UINT32 curIndex; + UINT32 curIndex; UINT32 currentDepth; UINT32 maxReadDepth; } typedef armourDropParseData; -static void XMLCALL +static void XMLCALL armourDropStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { armourDropParseData * pData = (armourDropParseData *)userData; @@ -84,7 +48,7 @@ armourDropStartElementHandle(void *userData, const XML_Char *name, const XML_Cha pData->maxReadDepth++; //we are not skipping this element } else if(pData->curElement == ELEMENT && - (strcmp(name, "uiIndex") == 0 || + (strcmp(name, "uiIndex") == 0 || strcmp(name, "ubArmourClass") == 0 || strcmp(name, "ubEnemyDropRate") == 0 || strcmp(name, "ubMilitiaDropRate") == 0 )) @@ -106,9 +70,9 @@ armourDropCharacterDataHandle(void *userData, const XML_Char *str, int len) { armourDropParseData * pData = (armourDropParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); } } @@ -116,7 +80,7 @@ armourDropCharacterDataHandle(void *userData, const XML_Char *str, int len) static void XMLCALL armourDropEndElementHandle(void *userData, const XML_Char *name) -{ +{ armourDropParseData * pData = (armourDropParseData *)userData; if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading @@ -137,22 +101,22 @@ armourDropEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "uiIndex") == 0) { pData->curElement = ELEMENT; - pData->curArmourDrop.uiIndex = (UINT32) atol(pData->szCharData); + pData->curArmourDrop.uiIndex = (UINT32) atol(pData->szCharData); } else if(strcmp(name, "ubArmourClass") == 0) { pData->curElement = ELEMENT; - pData->curArmourDrop.ubArmourClass = (UINT8) atol(pData->szCharData); + pData->curArmourDrop.ubArmourClass = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "ubEnemyDropRate") == 0) { pData->curElement = ELEMENT; - pData->curArmourDrop.ubEnemyDropRate = (UINT8) atol(pData->szCharData); + pData->curArmourDrop.ubEnemyDropRate = (UINT8) atol(pData->szCharData); } else if (strcmp(name, "ubMilitiaDropRate") == 0) { pData->curElement = ELEMENT; - pData->curArmourDrop.ubMilitiaDropRate = (UINT8) atol(pData->szCharData); + pData->curArmourDrop.ubMilitiaDropRate = (UINT8) atol(pData->szCharData); } pData->maxReadDepth--; @@ -171,7 +135,7 @@ BOOLEAN ReadInEnemyArmourDropsStats(ARMOUR_DROPS *pEnemyArmourDrops, STR fileNam UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + armourDropParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading EnemyArmourDrops.xml" ); @@ -180,7 +144,7 @@ BOOLEAN ReadInEnemyArmourDropsStats(ARMOUR_DROPS *pEnemyArmourDrops, STR fileNam hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -195,19 +159,19 @@ BOOLEAN ReadInEnemyArmourDropsStats(ARMOUR_DROPS *pEnemyArmourDrops, STR fileNam FileClose( hFile ); - + XML_SetElementHandler(parser, armourDropStartElementHandle, armourDropEndElementHandle); XML_SetCharacterDataHandler(parser, armourDropCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); pData.curArray = pEnemyArmourDrops; - pData.maxArraySize = MAX_DROP_ITEMS; - + pData.maxArraySize = MAX_DROP_ITEMS; + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -236,7 +200,7 @@ BOOLEAN WriteEnemyArmourDropsStats(ARMOUR_DROPS *pEnemyArmourDrops, STR fileName hFile = FileOpen( fileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -258,4 +222,4 @@ BOOLEAN WriteEnemyArmourDropsStats(ARMOUR_DROPS *pEnemyArmourDrops, STR fileName FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_EnemyExplosiveDrops.cpp b/Tactical/XML_EnemyExplosiveDrops.cpp index 97fb14ab..5203339e 100644 --- a/Tactical/XML_EnemyExplosiveDrops.cpp +++ b/Tactical/XML_EnemyExplosiveDrops.cpp @@ -2,47 +2,11 @@ #include "Tactical All.h" #else #include "sgp.h" - #include "overhead types.h" - #include "Sound Control.h" - #include "Soldier Control.h" #include "overhead.h" - #include "Event Pump.h" #include "weapons.h" - #include "Animation Control.h" - #include "sys globals.h" - #include "Handle UI.h" - #include "Isometric Utils.h" - #include "worldman.h" - #include "math.h" - #include "points.h" - #include "ai.h" - #include "los.h" - #include "renderworld.h" - #include "opplist.h" - #include "interface.h" - #include "message.h" - #include "campaign.h" - #include "items.h" - #include "text.h" - #include "Soldier Profile.h" - #include "tile animation.h" - #include "Dialogue Control.h" - #include "SkillCheck.h" - #include "explosion control.h" - #include "Quests.h" - #include "Physics.h" - #include "Random.h" - #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" - #include "meanwhile.h" - #include "SkillCheck.h" - #include "gamesettings.h" - #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" - #include "EnemyItemDrops.h" #endif struct @@ -54,13 +18,13 @@ struct EXPLOSIVE_DROPS * curArray; UINT32 maxArraySize; - UINT32 curIndex; + UINT32 curIndex; UINT32 currentDepth; UINT32 maxReadDepth; } typedef explosiveDropParseData; -static void XMLCALL +static void XMLCALL explosiveDropStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { explosiveDropParseData * pData = (explosiveDropParseData *)userData; @@ -84,7 +48,7 @@ explosiveDropStartElementHandle(void *userData, const XML_Char *name, const XML_ pData->maxReadDepth++; //we are not skipping this element } else if(pData->curElement == ELEMENT && - (strcmp(name, "uiIndex") == 0 || + (strcmp(name, "uiIndex") == 0 || strcmp(name, "ubType") == 0 || strcmp(name, "ubEnemyDropRate") == 0 || strcmp(name, "ubMilitiaDropRate") == 0 )) @@ -106,9 +70,9 @@ explosiveDropCharacterDataHandle(void *userData, const XML_Char *str, int len) { explosiveDropParseData * pData = (explosiveDropParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); } } @@ -116,7 +80,7 @@ explosiveDropCharacterDataHandle(void *userData, const XML_Char *str, int len) static void XMLCALL explosiveDropEndElementHandle(void *userData, const XML_Char *name) -{ +{ explosiveDropParseData * pData = (explosiveDropParseData *)userData; if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading @@ -137,22 +101,22 @@ explosiveDropEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "uiIndex") == 0) { pData->curElement = ELEMENT; - pData->curExplosiveDrop.uiIndex = (UINT32) atol(pData->szCharData); + pData->curExplosiveDrop.uiIndex = (UINT32) atol(pData->szCharData); } else if(strcmp(name, "ubType") == 0) { pData->curElement = ELEMENT; - pData->curExplosiveDrop.ubType = (UINT8) atol(pData->szCharData); + pData->curExplosiveDrop.ubType = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "ubEnemyDropRate") == 0) { pData->curElement = ELEMENT; - pData->curExplosiveDrop.ubEnemyDropRate = (UINT8) atol(pData->szCharData); + pData->curExplosiveDrop.ubEnemyDropRate = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "ubMilitiaDropRate") == 0) { pData->curElement = ELEMENT; - pData->curExplosiveDrop.ubMilitiaDropRate = (UINT8) atol(pData->szCharData); + pData->curExplosiveDrop.ubMilitiaDropRate = (UINT8) atol(pData->szCharData); } pData->maxReadDepth--; @@ -171,7 +135,7 @@ BOOLEAN ReadInEnemyExplosiveDropsStats(EXPLOSIVE_DROPS *pEnemyExplosiveDrops, ST UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + explosiveDropParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading EnemyExplosiveDrops.xml" ); @@ -180,7 +144,7 @@ BOOLEAN ReadInEnemyExplosiveDropsStats(EXPLOSIVE_DROPS *pEnemyExplosiveDrops, ST hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -195,19 +159,19 @@ BOOLEAN ReadInEnemyExplosiveDropsStats(EXPLOSIVE_DROPS *pEnemyExplosiveDrops, ST FileClose( hFile ); - + XML_SetElementHandler(parser, explosiveDropStartElementHandle, explosiveDropEndElementHandle); XML_SetCharacterDataHandler(parser, explosiveDropCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); pData.curArray = pEnemyExplosiveDrops; - pData.maxArraySize = MAX_DROP_ITEMS; - + pData.maxArraySize = MAX_DROP_ITEMS; + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -236,7 +200,7 @@ BOOLEAN WriteEnemyExplosiveDropsStats(EXPLOSIVE_DROPS *pEnemyExplosiveDrops, STR hFile = FileOpen( fileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -258,4 +222,4 @@ BOOLEAN WriteEnemyExplosiveDropsStats(EXPLOSIVE_DROPS *pEnemyExplosiveDrops, STR FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_EnemyItemChoice.cpp b/Tactical/XML_EnemyItemChoice.cpp index 2910ee9b..ef2331f4 100644 --- a/Tactical/XML_EnemyItemChoice.cpp +++ b/Tactical/XML_EnemyItemChoice.cpp @@ -2,44 +2,8 @@ #include "Tactical All.h" #else #include "sgp.h" - #include "overhead types.h" - #include "Sound Control.h" - #include "Soldier Control.h" #include "overhead.h" - #include "Event Pump.h" #include "weapons.h" - #include "Animation Control.h" - #include "sys globals.h" - #include "Handle UI.h" - #include "Isometric Utils.h" - #include "worldman.h" - #include "math.h" - #include "points.h" - #include "ai.h" - #include "los.h" - #include "renderworld.h" - #include "opplist.h" - #include "interface.h" - #include "message.h" - #include "campaign.h" - #include "items.h" - #include "weapons.h" - #include "text.h" - #include "Soldier Profile.h" - #include "tile animation.h" - #include "Dialogue Control.h" - #include "SkillCheck.h" - #include "explosion control.h" - #include "Quests.h" - #include "Physics.h" - #include "Random.h" - #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" - #include "meanwhile.h" - #include "SkillCheck.h" - #include "gamesettings.h" - #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" @@ -54,13 +18,13 @@ struct ARMY_GUN_CHOICE_TYPE curArmyItemChoices; ARMY_GUN_CHOICE_TYPE * curArray; UINT32 maxArraySize; - + UINT32 currentDepth; UINT32 maxReadDepth; } typedef armyitemchoicesParseData; -static void XMLCALL +static void XMLCALL armyitemchoicesStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { armyitemchoicesParseData * pData = (armyitemchoicesParseData *)userData; @@ -154,11 +118,11 @@ armyitemchoicesCharacterDataHandle(void *userData, const XML_Char *str, int len) { armyitemchoicesParseData * pData = (armyitemchoicesParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); - } + } } @@ -185,12 +149,12 @@ armyitemchoicesEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "uiIndex") == 0) { pData->curElement = ELEMENT; - pData->curArmyItemChoices.uiIndex = (UINT32) atol(pData->szCharData); + pData->curArmyItemChoices.uiIndex = (UINT32) atol(pData->szCharData); } else if(strcmp(name, "ubChoices") == 0) { pData->curElement = ELEMENT; - pData->curArmyItemChoices.ubChoices = (UINT8) atol(pData->szCharData); + pData->curArmyItemChoices.ubChoices = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "bItemNo1") == 0) { @@ -459,7 +423,7 @@ BOOLEAN ReadInArmyItemChoicesStats(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + armyitemchoicesParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading EnemyItemChoicess.xml" ); @@ -468,7 +432,7 @@ BOOLEAN ReadInArmyItemChoicesStats(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -483,19 +447,19 @@ BOOLEAN ReadInArmyItemChoicesStats(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, armyitemchoicesStartElementHandle, armyitemchoicesEndElementHandle); XML_SetCharacterDataHandler(parser, armyitemchoicesCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); pData.curArray = gArmyItemChoices; - pData.maxArraySize = MAX_ITEM_TYPES; - + pData.maxArraySize = MAX_ITEM_TYPES; + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -524,7 +488,7 @@ BOOLEAN WriteArmyItemChoicesStats() hFile = FileOpen( "TABLEDATA\\EnemyItemChoices out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -535,9 +499,9 @@ BOOLEAN WriteArmyItemChoicesStats() FilePrintf(hFile,"\t\r\n"); FilePrintf(hFile,"\t\t%d\r\n", cnt ); - FilePrintf(hFile,"\t\t%d\r\n", gArmyItemChoices[cnt].ubChoices ); + FilePrintf(hFile,"\t\t%d\r\n", gArmyItemChoices[cnt].ubChoices ); for (int i=0;i<50;i++) - FilePrintf(hFile,"\t\t%d\r\n",i+1,gArmyItemChoices[cnt].bItemNo[i],i+1 ); + FilePrintf(hFile,"\t\t%d\r\n",i+1,gArmyItemChoices[cnt].bItemNo[i],i+1 ); FilePrintf(hFile,"\t\r\n"); @@ -547,4 +511,4 @@ BOOLEAN WriteArmyItemChoicesStats() FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_EnemyMiscDrops.cpp b/Tactical/XML_EnemyMiscDrops.cpp index 63d25091..215a92b6 100644 --- a/Tactical/XML_EnemyMiscDrops.cpp +++ b/Tactical/XML_EnemyMiscDrops.cpp @@ -2,43 +2,8 @@ #include "Tactical All.h" #else #include "sgp.h" - #include "overhead types.h" - #include "Sound Control.h" - #include "Soldier Control.h" #include "overhead.h" - #include "Event Pump.h" #include "weapons.h" - #include "Animation Control.h" - #include "sys globals.h" - #include "Handle UI.h" - #include "Isometric Utils.h" - #include "worldman.h" - #include "math.h" - #include "points.h" - #include "ai.h" - #include "los.h" - #include "renderworld.h" - #include "opplist.h" - #include "interface.h" - #include "message.h" - #include "campaign.h" - #include "items.h" - #include "text.h" - #include "Soldier Profile.h" - #include "tile animation.h" - #include "Dialogue Control.h" - #include "SkillCheck.h" - #include "explosion control.h" - #include "Quests.h" - #include "Physics.h" - #include "Random.h" - #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" - #include "meanwhile.h" - #include "SkillCheck.h" - #include "gamesettings.h" - #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" @@ -54,13 +19,13 @@ struct MISC_DROPS * curArray; UINT32 maxArraySize; - UINT32 curIndex; + UINT32 curIndex; UINT32 currentDepth; UINT32 maxReadDepth; } typedef miscDropParseData; -static void XMLCALL +static void XMLCALL miscDropStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { miscDropParseData * pData = (miscDropParseData *)userData; @@ -84,9 +49,9 @@ miscDropStartElementHandle(void *userData, const XML_Char *name, const XML_Char pData->maxReadDepth++; //we are not skipping this element } else if(pData->curElement == ELEMENT && - (strcmp(name, "uiIndex") == 0 || + (strcmp(name, "uiIndex") == 0 || strcmp(name, "usItemClass") == 0 || - strcmp(name, "ubEnemyDropRate") == 0 || + strcmp(name, "ubEnemyDropRate") == 0 || strcmp(name, "ubMilitiaDropRate") == 0 )) { pData->curElement = ELEMENT_PROPERTY; @@ -106,9 +71,9 @@ miscDropCharacterDataHandle(void *userData, const XML_Char *str, int len) { miscDropParseData * pData = (miscDropParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); } } @@ -116,7 +81,7 @@ miscDropCharacterDataHandle(void *userData, const XML_Char *str, int len) static void XMLCALL miscDropEndElementHandle(void *userData, const XML_Char *name) -{ +{ miscDropParseData * pData = (miscDropParseData *)userData; if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading @@ -137,22 +102,22 @@ miscDropEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "uiIndex") == 0) { pData->curElement = ELEMENT; - pData->curMiscDrop.uiIndex = (UINT32) atol(pData->szCharData); + pData->curMiscDrop.uiIndex = (UINT32) atol(pData->szCharData); } else if(strcmp(name, "usItemClass") == 0) { pData->curElement = ELEMENT; - pData->curMiscDrop.usItemClass = (UINT32) atol(pData->szCharData); + pData->curMiscDrop.usItemClass = (UINT32) atol(pData->szCharData); } else if(strcmp(name, "ubEnemyDropRate") == 0) { pData->curElement = ELEMENT; - pData->curMiscDrop.ubEnemyDropRate = (UINT8) atol(pData->szCharData); + pData->curMiscDrop.ubEnemyDropRate = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "ubMilitiaDropRate") == 0) { pData->curElement = ELEMENT; - pData->curMiscDrop.ubMilitiaDropRate = (UINT8) atol(pData->szCharData); + pData->curMiscDrop.ubMilitiaDropRate = (UINT8) atol(pData->szCharData); } pData->maxReadDepth--; @@ -171,7 +136,7 @@ BOOLEAN ReadInEnemyMiscDropsStats(MISC_DROPS *pEnemyMiscDrops, STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + miscDropParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading EnemyMiscDrops.xml" ); @@ -180,7 +145,7 @@ BOOLEAN ReadInEnemyMiscDropsStats(MISC_DROPS *pEnemyMiscDrops, STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -195,19 +160,19 @@ BOOLEAN ReadInEnemyMiscDropsStats(MISC_DROPS *pEnemyMiscDrops, STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, miscDropStartElementHandle, miscDropEndElementHandle); XML_SetCharacterDataHandler(parser, miscDropCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); pData.curArray = pEnemyMiscDrops; - pData.maxArraySize = MAX_DROP_ITEMS; - + pData.maxArraySize = MAX_DROP_ITEMS; + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -236,7 +201,7 @@ BOOLEAN WriteEnemyMiscDropsStats(MISC_DROPS *pEnemyMiscDrops, STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -258,4 +223,4 @@ BOOLEAN WriteEnemyMiscDropsStats(MISC_DROPS *pEnemyMiscDrops, STR fileName) FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_EnemyWeaponChoice.cpp b/Tactical/XML_EnemyWeaponChoice.cpp index b2bad67d..8068ac1f 100644 --- a/Tactical/XML_EnemyWeaponChoice.cpp +++ b/Tactical/XML_EnemyWeaponChoice.cpp @@ -2,44 +2,8 @@ #include "Tactical All.h" #else #include "sgp.h" - #include "overhead types.h" - #include "Sound Control.h" - #include "Soldier Control.h" #include "overhead.h" - #include "Event Pump.h" #include "weapons.h" - #include "Animation Control.h" - #include "sys globals.h" - #include "Handle UI.h" - #include "Isometric Utils.h" - #include "worldman.h" - #include "math.h" - #include "points.h" - #include "ai.h" - #include "los.h" - #include "renderworld.h" - #include "opplist.h" - #include "interface.h" - #include "message.h" - #include "campaign.h" - #include "items.h" - #include "weapons.h" - #include "text.h" - #include "Soldier Profile.h" - #include "tile animation.h" - #include "Dialogue Control.h" - #include "SkillCheck.h" - #include "explosion control.h" - #include "Quests.h" - #include "Physics.h" - #include "Random.h" - #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" - #include "meanwhile.h" - #include "SkillCheck.h" - #include "gamesettings.h" - #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" @@ -54,13 +18,13 @@ struct ARMY_GUN_CHOICE_TYPE curExtendedArmyGunChoices; ARMY_GUN_CHOICE_TYPE * curArray; UINT32 maxArraySize; - + UINT32 currentDepth; UINT32 maxReadDepth; } typedef extendedarmygunchoicesParseData; -static void XMLCALL +static void XMLCALL extendedarmygunchoicesStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { extendedarmygunchoicesParseData * pData = (extendedarmygunchoicesParseData *)userData; @@ -154,11 +118,11 @@ extendedarmygunchoicesCharacterDataHandle(void *userData, const XML_Char *str, i { extendedarmygunchoicesParseData * pData = (extendedarmygunchoicesParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); - } + } } @@ -185,12 +149,12 @@ extendedarmygunchoicesEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "uiIndex") == 0) { pData->curElement = ELEMENT; - pData->curExtendedArmyGunChoices.uiIndex = (UINT32) atol(pData->szCharData); + pData->curExtendedArmyGunChoices.uiIndex = (UINT32) atol(pData->szCharData); } else if(strcmp(name, "ubChoices") == 0) { pData->curElement = ELEMENT; - pData->curExtendedArmyGunChoices.ubChoices = (UINT8) atol(pData->szCharData); + pData->curExtendedArmyGunChoices.ubChoices = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "bItemNo1") == 0) { @@ -459,7 +423,7 @@ BOOLEAN ReadInExtendedArmyGunChoicesStats(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + extendedarmygunchoicesParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading EnemyGunChoicess.xml" ); @@ -468,7 +432,7 @@ BOOLEAN ReadInExtendedArmyGunChoicesStats(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -483,19 +447,19 @@ BOOLEAN ReadInExtendedArmyGunChoicesStats(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, extendedarmygunchoicesStartElementHandle, extendedarmygunchoicesEndElementHandle); XML_SetCharacterDataHandler(parser, extendedarmygunchoicesCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); pData.curArray = gExtendedArmyGunChoices; - pData.maxArraySize = ARMY_GUN_LEVELS; - + pData.maxArraySize = ARMY_GUN_LEVELS; + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -524,7 +488,7 @@ BOOLEAN WriteExtendedArmyGunChoicesStats() hFile = FileOpen( "TABLEDATA\\EnemyGunChoices out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -535,9 +499,9 @@ BOOLEAN WriteExtendedArmyGunChoicesStats() FilePrintf(hFile,"\t\r\n"); FilePrintf(hFile,"\t\t%d\r\n", cnt ); - FilePrintf(hFile,"\t\t%d\r\n", gExtendedArmyGunChoices[cnt].ubChoices ); + FilePrintf(hFile,"\t\t%d\r\n", gExtendedArmyGunChoices[cnt].ubChoices ); for (int i=0;i<50;i++) - FilePrintf(hFile,"\t\t%d\r\n",i+1,gExtendedArmyGunChoices[cnt].bItemNo[i],i+1 ); + FilePrintf(hFile,"\t\t%d\r\n",i+1,gExtendedArmyGunChoices[cnt].bItemNo[i],i+1 ); FilePrintf(hFile,"\t\r\n"); @@ -547,4 +511,4 @@ BOOLEAN WriteExtendedArmyGunChoicesStats() FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_EnemyWeaponDrops.cpp b/Tactical/XML_EnemyWeaponDrops.cpp index 2c86a2ce..d96a6aad 100644 --- a/Tactical/XML_EnemyWeaponDrops.cpp +++ b/Tactical/XML_EnemyWeaponDrops.cpp @@ -3,8 +3,6 @@ #else #include "sgp.h" #include "overhead types.h" - #include "Sound Control.h" - #include "Soldier Control.h" #include "overhead.h" #include "Event Pump.h" #include "weapons.h" @@ -54,13 +52,13 @@ struct WEAPON_DROPS * curArray; UINT32 maxArraySize; - UINT32 curIndex; + UINT32 curIndex; UINT32 currentDepth; UINT32 maxReadDepth; } typedef weaponDropParseData; -static void XMLCALL +static void XMLCALL weaponDropStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { weaponDropParseData * pData = (weaponDropParseData *)userData; @@ -84,9 +82,9 @@ weaponDropStartElementHandle(void *userData, const XML_Char *name, const XML_Cha pData->maxReadDepth++; //we are not skipping this element } else if(pData->curElement == ELEMENT && - (strcmp(name, "uiIndex") == 0 || + (strcmp(name, "uiIndex") == 0 || strcmp(name, "ubWeaponType") == 0 || - strcmp(name, "ubEnemyDropRate") == 0 || + strcmp(name, "ubEnemyDropRate") == 0 || strcmp(name, "ubMilitiaDropRate") == 0 )) { pData->curElement = ELEMENT_PROPERTY; @@ -106,9 +104,9 @@ weaponDropCharacterDataHandle(void *userData, const XML_Char *str, int len) { weaponDropParseData * pData = (weaponDropParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); } } @@ -116,7 +114,7 @@ weaponDropCharacterDataHandle(void *userData, const XML_Char *str, int len) static void XMLCALL weaponDropEndElementHandle(void *userData, const XML_Char *name) -{ +{ weaponDropParseData * pData = (weaponDropParseData *)userData; if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading @@ -137,22 +135,22 @@ weaponDropEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "uiIndex") == 0) { pData->curElement = ELEMENT; - pData->curWeaponDrop.uiIndex = (UINT32) atol(pData->szCharData); + pData->curWeaponDrop.uiIndex = (UINT32) atol(pData->szCharData); } else if(strcmp(name, "ubWeaponType") == 0) { pData->curElement = ELEMENT; - pData->curWeaponDrop.ubWeaponType = (UINT8) atol(pData->szCharData); + pData->curWeaponDrop.ubWeaponType = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "ubEnemyDropRate") == 0) { pData->curElement = ELEMENT; - pData->curWeaponDrop.ubEnemyDropRate = (UINT8) atol(pData->szCharData); + pData->curWeaponDrop.ubEnemyDropRate = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "ubMilitiaDropRate") == 0) { pData->curElement = ELEMENT; - pData->curWeaponDrop.ubMilitiaDropRate = (UINT8) atol(pData->szCharData); + pData->curWeaponDrop.ubMilitiaDropRate = (UINT8) atol(pData->szCharData); } pData->maxReadDepth--; @@ -171,7 +169,7 @@ BOOLEAN ReadInEnemyWeaponDropsStats(WEAPON_DROPS *pEnemyWeaponDrops, STR fileNam UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + weaponDropParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading EnemyWeaponDrops.xml" ); @@ -180,7 +178,7 @@ BOOLEAN ReadInEnemyWeaponDropsStats(WEAPON_DROPS *pEnemyWeaponDrops, STR fileNam hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -195,19 +193,19 @@ BOOLEAN ReadInEnemyWeaponDropsStats(WEAPON_DROPS *pEnemyWeaponDrops, STR fileNam FileClose( hFile ); - + XML_SetElementHandler(parser, weaponDropStartElementHandle, weaponDropEndElementHandle); XML_SetCharacterDataHandler(parser, weaponDropCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); pData.curArray = pEnemyWeaponDrops; - pData.maxArraySize = MAX_DROP_ITEMS; - + pData.maxArraySize = MAX_DROP_ITEMS; + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -236,7 +234,7 @@ BOOLEAN WriteEnemyWeaponDropsStats(WEAPON_DROPS *pEnemyWeaponDrops, STR fileName hFile = FileOpen( fileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -258,4 +256,4 @@ BOOLEAN WriteEnemyWeaponDropsStats(WEAPON_DROPS *pEnemyWeaponDrops, STR fileName FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_Explosive.cpp b/Tactical/XML_Explosive.cpp index 2ed24a25..cc1a7a68 100644 --- a/Tactical/XML_Explosive.cpp +++ b/Tactical/XML_Explosive.cpp @@ -2,44 +2,8 @@ #include "Tactical All.h" #else #include "sgp.h" - #include "overhead types.h" - #include "Sound Control.h" - #include "Soldier Control.h" #include "overhead.h" - #include "Event Pump.h" #include "weapons.h" - #include "Animation Control.h" - #include "sys globals.h" - #include "Handle UI.h" - #include "Isometric Utils.h" - #include "worldman.h" - #include "math.h" - #include "points.h" - #include "ai.h" - #include "los.h" - #include "renderworld.h" - #include "opplist.h" - #include "interface.h" - #include "message.h" - #include "campaign.h" - #include "items.h" - #include "weapons.h" - #include "text.h" - #include "Soldier Profile.h" - #include "tile animation.h" - #include "Dialogue Control.h" - #include "SkillCheck.h" - #include "explosion control.h" - #include "Quests.h" - #include "Physics.h" - #include "Random.h" - #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" - #include "meanwhile.h" - #include "SkillCheck.h" - #include "gamesettings.h" - #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" @@ -53,13 +17,13 @@ struct EXPLOSIVETYPE curExplosive; EXPLOSIVETYPE * curArray; UINT32 maxArraySize; - + UINT32 currentDepth; UINT32 maxReadDepth; } typedef explosiveParseData; -static void XMLCALL +static void XMLCALL explosiveStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { explosiveParseData * pData = (explosiveParseData *)userData; @@ -111,11 +75,11 @@ explosiveCharacterDataHandle(void *userData, const XML_Char *str, int len) { explosiveParseData * pData = (explosiveParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); - } + } } @@ -142,12 +106,12 @@ explosiveEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "uiIndex") == 0) { pData->curElement = ELEMENT; - pData->curExplosive.uiIndex = (UINT32) atol(pData->szCharData); + pData->curExplosive.uiIndex = (UINT32) atol(pData->szCharData); } else if(strcmp(name, "ubType") == 0) { pData->curElement = ELEMENT; - pData->curExplosive.ubType = (UINT8) atol(pData->szCharData); + pData->curExplosive.ubType = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "ubDamage") == 0) { @@ -157,37 +121,37 @@ explosiveEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "ubStunDamage") == 0) { pData->curElement = ELEMENT; - pData->curExplosive.ubStunDamage = (UINT8) atol(pData->szCharData); + pData->curExplosive.ubStunDamage = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "ubRadius") == 0) { pData->curElement = ELEMENT; - pData->curExplosive.ubRadius = (UINT8) atol(pData->szCharData); + pData->curExplosive.ubRadius = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "ubVolume") == 0) { pData->curElement = ELEMENT; - pData->curExplosive.ubVolume = (UINT8) atol(pData->szCharData); + pData->curExplosive.ubVolume = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "ubVolatility") == 0) { pData->curElement = ELEMENT; - pData->curExplosive.ubVolatility = (UINT8) atol(pData->szCharData); + pData->curExplosive.ubVolatility = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "ubAnimationID") == 0) { pData->curElement = ELEMENT; - pData->curExplosive.ubAnimationID = (UINT8) atol(pData->szCharData); + pData->curExplosive.ubAnimationID = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "ubStartRadius") == 0) { pData->curElement = ELEMENT; - pData->curExplosive.ubStartRadius = (UINT8) atol(pData->szCharData); + pData->curExplosive.ubStartRadius = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "ubDuration") == 0) { pData->curElement = ELEMENT; - pData->curExplosive.ubDuration = (UINT8) atol(pData->szCharData); + pData->curExplosive.ubDuration = (UINT8) atol(pData->szCharData); } pData->maxReadDepth--; @@ -206,7 +170,7 @@ BOOLEAN ReadInExplosiveStats(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + explosiveParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading Explosives.xml" ); @@ -215,7 +179,7 @@ BOOLEAN ReadInExplosiveStats(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -230,19 +194,19 @@ BOOLEAN ReadInExplosiveStats(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, explosiveStartElementHandle, explosiveEndElementHandle); XML_SetCharacterDataHandler(parser, explosiveCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); pData.curArray = Explosive; - pData.maxArraySize = MAXITEMS; - + pData.maxArraySize = MAXITEMS; + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -271,7 +235,7 @@ BOOLEAN WriteExplosiveStats() hFile = FileOpen( "TABLEDATA\\Explosives out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -282,15 +246,15 @@ BOOLEAN WriteExplosiveStats() FilePrintf(hFile,"\t\r\n"); FilePrintf(hFile,"\t\t%d\r\n", cnt ); - FilePrintf(hFile,"\t\t%d\r\n", Explosive[cnt].ubType ); - FilePrintf(hFile,"\t\t%d\r\n", Explosive[cnt].ubDamage ); - FilePrintf(hFile,"\t\t%d\r\n", Explosive[cnt].ubStunDamage ); - FilePrintf(hFile,"\t\t%d\r\n", Explosive[cnt].ubRadius ); - FilePrintf(hFile,"\t\t%d\r\n", Explosive[cnt].ubVolume ); - FilePrintf(hFile,"\t\t%d\r\n", Explosive[cnt].ubVolatility ); - FilePrintf(hFile,"\t\t%d\r\n", Explosive[cnt].ubAnimationID ); - FilePrintf(hFile,"\t\t%d\r\n", Explosive[cnt].ubDuration ); - FilePrintf(hFile,"\t\t%d\r\n", Explosive[cnt].ubStartRadius ); + FilePrintf(hFile,"\t\t%d\r\n", Explosive[cnt].ubType ); + FilePrintf(hFile,"\t\t%d\r\n", Explosive[cnt].ubDamage ); + FilePrintf(hFile,"\t\t%d\r\n", Explosive[cnt].ubStunDamage ); + FilePrintf(hFile,"\t\t%d\r\n", Explosive[cnt].ubRadius ); + FilePrintf(hFile,"\t\t%d\r\n", Explosive[cnt].ubVolume ); + FilePrintf(hFile,"\t\t%d\r\n", Explosive[cnt].ubVolatility ); + FilePrintf(hFile,"\t\t%d\r\n", Explosive[cnt].ubAnimationID ); + FilePrintf(hFile,"\t\t%d\r\n", Explosive[cnt].ubDuration ); + FilePrintf(hFile,"\t\t%d\r\n", Explosive[cnt].ubStartRadius ); FilePrintf(hFile,"\t\r\n"); } @@ -299,4 +263,4 @@ BOOLEAN WriteExplosiveStats() FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_IMPItemChoices.cpp b/Tactical/XML_IMPItemChoices.cpp index 95ca45e3..94b42d67 100644 --- a/Tactical/XML_IMPItemChoices.cpp +++ b/Tactical/XML_IMPItemChoices.cpp @@ -2,44 +2,8 @@ #include "Tactical All.h" #else #include "sgp.h" - #include "overhead types.h" - #include "Sound Control.h" - #include "Soldier Control.h" #include "overhead.h" - #include "Event Pump.h" #include "weapons.h" - #include "Animation Control.h" - #include "sys globals.h" - #include "Handle UI.h" - #include "Isometric Utils.h" - #include "worldman.h" - #include "math.h" - #include "points.h" - #include "ai.h" - #include "los.h" - #include "renderworld.h" - #include "opplist.h" - #include "interface.h" - #include "message.h" - #include "campaign.h" - #include "items.h" - #include "weapons.h" - #include "text.h" - #include "Soldier Profile.h" - #include "tile animation.h" - #include "Dialogue Control.h" - #include "SkillCheck.h" - #include "explosion control.h" - #include "Quests.h" - #include "Physics.h" - #include "Random.h" - #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" - #include "meanwhile.h" - #include "SkillCheck.h" - #include "gamesettings.h" - #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" @@ -53,13 +17,13 @@ struct IMP_ITEM_CHOICE_TYPE curIMPItemChoices; IMP_ITEM_CHOICE_TYPE * curArray; UINT32 maxArraySize; - + UINT32 currentDepth; UINT32 maxReadDepth; } typedef IMPitemchoicesParseData; -static void XMLCALL +static void XMLCALL IMPitemchoicesStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { IMPitemchoicesParseData * pData = (IMPitemchoicesParseData *)userData; @@ -154,11 +118,11 @@ IMPitemchoicesCharacterDataHandle(void *userData, const XML_Char *str, int len) { IMPitemchoicesParseData * pData = (IMPitemchoicesParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); - } + } } @@ -185,12 +149,12 @@ IMPitemchoicesEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "uiIndex") == 0) { pData->curElement = ELEMENT; - pData->curIMPItemChoices.uiIndex = (UINT32) atol(pData->szCharData); + pData->curIMPItemChoices.uiIndex = (UINT32) atol(pData->szCharData); } else if(strcmp(name, "ubChoices") == 0) { pData->curElement = ELEMENT; - pData->curIMPItemChoices.ubChoices = (UINT8) atol(pData->szCharData); + pData->curIMPItemChoices.ubChoices = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "ubNumItems") == 0) { @@ -464,7 +428,7 @@ BOOLEAN ReadInIMPItemChoicesStats(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + IMPitemchoicesParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading IMPItemChoicess.xml" ); @@ -473,7 +437,7 @@ BOOLEAN ReadInIMPItemChoicesStats(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -488,19 +452,19 @@ BOOLEAN ReadInIMPItemChoicesStats(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, IMPitemchoicesStartElementHandle, IMPitemchoicesEndElementHandle); XML_SetCharacterDataHandler(parser, IMPitemchoicesCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); pData.curArray = gIMPItemChoices; - pData.maxArraySize = MAX_IMP_ITEM_TYPES; - + pData.maxArraySize = MAX_IMP_ITEM_TYPES; + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -529,7 +493,7 @@ BOOLEAN WriteIMPItemChoicesStats() hFile = FileOpen( "TABLEDATA\\IMPItemChoices out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -540,10 +504,10 @@ BOOLEAN WriteIMPItemChoicesStats() FilePrintf(hFile,"\t\r\n"); FilePrintf(hFile,"\t\t%d\r\n", cnt ); - FilePrintf(hFile,"\t\t%d\r\n", gIMPItemChoices[cnt].ubChoices ); - FilePrintf(hFile,"\t\t%d\r\n", gIMPItemChoices[cnt].ubNumItems ); + FilePrintf(hFile,"\t\t%d\r\n", gIMPItemChoices[cnt].ubChoices ); + FilePrintf(hFile,"\t\t%d\r\n", gIMPItemChoices[cnt].ubNumItems ); for (int i=0;i<50;i++) - FilePrintf(hFile,"\t\t%d\r\n",i+1,gIMPItemChoices[cnt].bItemNo[i],i+1 ); + FilePrintf(hFile,"\t\t%d\r\n",i+1,gIMPItemChoices[cnt].bItemNo[i],i+1 ); FilePrintf(hFile,"\t\r\n"); @@ -555,3 +519,4 @@ BOOLEAN WriteIMPItemChoicesStats() return( TRUE ); } + diff --git a/Tactical/XML_IncompatibleAttachments.cpp b/Tactical/XML_IncompatibleAttachments.cpp index 4109d436..16f2f505 100644 --- a/Tactical/XML_IncompatibleAttachments.cpp +++ b/Tactical/XML_IncompatibleAttachments.cpp @@ -2,43 +2,8 @@ #include "Tactical All.h" #else #include "sgp.h" - #include "overhead types.h" - #include "Sound Control.h" - #include "Soldier Control.h" #include "overhead.h" - #include "Event Pump.h" #include "weapons.h" - #include "Animation Control.h" - #include "sys globals.h" - #include "Handle UI.h" - #include "Isometric Utils.h" - #include "worldman.h" - #include "math.h" - #include "points.h" - #include "ai.h" - #include "los.h" - #include "renderworld.h" - #include "opplist.h" - #include "interface.h" - #include "message.h" - #include "campaign.h" - #include "items.h" - #include "text.h" - #include "Soldier Profile.h" - #include "tile animation.h" - #include "Dialogue Control.h" - #include "SkillCheck.h" - #include "explosion control.h" - #include "Quests.h" - #include "Physics.h" - #include "Random.h" - #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" - #include "meanwhile.h" - #include "SkillCheck.h" - #include "gamesettings.h" - #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" @@ -52,13 +17,13 @@ struct UINT16 curIncompatibleAttachment[2]; UINT32 maxArraySize; - UINT32 curIndex; + UINT32 curIndex; UINT32 currentDepth; UINT32 maxReadDepth; } typedef incompatibleattachmentParseData; -static void XMLCALL +static void XMLCALL incompatibleattachmentStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { incompatibleattachmentParseData * pData = (incompatibleattachmentParseData *)userData; @@ -103,9 +68,9 @@ incompatibleattachmentCharacterDataHandle(void *userData, const XML_Char *str, i { incompatibleattachmentParseData * pData = (incompatibleattachmentParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); } } @@ -160,7 +125,7 @@ BOOLEAN ReadInIncompatibleAttachmentStats(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + incompatibleattachmentParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading IncompatibleAttachments.xml" ); @@ -169,7 +134,7 @@ BOOLEAN ReadInIncompatibleAttachmentStats(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -184,19 +149,19 @@ BOOLEAN ReadInIncompatibleAttachmentStats(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, incompatibleattachmentStartElementHandle, incompatibleattachmentEndElementHandle); XML_SetCharacterDataHandler(parser, incompatibleattachmentCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); - pData.maxArraySize = MAXATTACHMENTS; + pData.maxArraySize = MAXATTACHMENTS; pData.curIndex = -1; - + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -223,7 +188,7 @@ BOOLEAN WriteIncompatibleAttachmentStats() hFile = FileOpen( "TABLEDATA\\IncompatibleAttachments out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -242,4 +207,4 @@ BOOLEAN WriteIncompatibleAttachmentStats() FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_LBEPocket.cpp b/Tactical/XML_LBEPocket.cpp new file mode 100644 index 00000000..45e228fb --- /dev/null +++ b/Tactical/XML_LBEPocket.cpp @@ -0,0 +1,485 @@ +#ifdef PRECOMPILEDHEADERS + #include "Tactical All.h" +#else + #include "sgp.h" + #include "overhead.h" + #include "weapons.h" + #include "Debug Control.h" + #include "expat.h" + #include "XML.h" +#endif + +struct +{ + PARSE_STAGE curElement; + + CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; + POCKETTYPE curLBEPocket; +// POCKETTYPE * curArray; +// UINT32 maxArraySize; + + UINT32 currentDepth; + UINT32 maxReadDepth; +} +typedef lbepocketParseData; + +BOOLEAN onlyLocalizedText; + +static void XMLCALL +lbepocketStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) +{ + lbepocketParseData * pData = (lbepocketParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element? + { + if(strcmp(name, "POCKETLIST") == 0 && pData->curElement == ELEMENT_NONE) + { + pData->curElement = ELEMENT_LIST; + + //memset(pData->curArray,0,sizeof(POCKETTYPE)*pData->maxArraySize); + + pData->maxReadDepth++; //we are not skipping this element + } + else if(strcmp(name, "POCKET") == 0 && pData->curElement == ELEMENT_LIST) + { + pData->curElement = ELEMENT; + + //memset(&pData->curLBEPocket,0,sizeof(POCKETTYPE)); + pData->curLBEPocket = POCKETTYPE(); + + pData->maxReadDepth++; //we are not skipping this element + } + else if(pData->curElement == ELEMENT && + (strcmp(name, "pIndex") == 0 || + strcmp(name, "pName") == 0 || + strcmp(name, "pSilhouette") == 0 || + strcmp(name, "pType") == 0 || + strcmp(name, "pRestriction") == 0 || + strcmp(name, "ItemCapacityPerSize.0") == 0 || strcmp(name, "ItemCapacityPerSize0") == 0 || + strcmp(name, "ItemCapacityPerSize.1") == 0 || strcmp(name, "ItemCapacityPerSize1") == 0 || + strcmp(name, "ItemCapacityPerSize.2") == 0 || strcmp(name, "ItemCapacityPerSize2") == 0 || + strcmp(name, "ItemCapacityPerSize.3") == 0 || strcmp(name, "ItemCapacityPerSize3") == 0 || + strcmp(name, "ItemCapacityPerSize.4") == 0 || strcmp(name, "ItemCapacityPerSize4") == 0 || + strcmp(name, "ItemCapacityPerSize.5") == 0 || strcmp(name, "ItemCapacityPerSize5") == 0 || + strcmp(name, "ItemCapacityPerSize.6") == 0 || strcmp(name, "ItemCapacityPerSize6") == 0 || + strcmp(name, "ItemCapacityPerSize.7") == 0 || strcmp(name, "ItemCapacityPerSize7") == 0 || + strcmp(name, "ItemCapacityPerSize.8") == 0 || strcmp(name, "ItemCapacityPerSize8") == 0 || + strcmp(name, "ItemCapacityPerSize.9") == 0 || strcmp(name, "ItemCapacityPerSize9") == 0 || + strcmp(name, "ItemCapacityPerSize.10") == 0 || strcmp(name, "ItemCapacityPerSize10") == 0 || + strcmp(name, "ItemCapacityPerSize.11") == 0 || strcmp(name, "ItemCapacityPerSize11") == 0 || + strcmp(name, "ItemCapacityPerSize.12") == 0 || strcmp(name, "ItemCapacityPerSize12") == 0 || + strcmp(name, "ItemCapacityPerSize.13") == 0 || strcmp(name, "ItemCapacityPerSize13") == 0 || + strcmp(name, "ItemCapacityPerSize.14") == 0 || strcmp(name, "ItemCapacityPerSize14") == 0 || + strcmp(name, "ItemCapacityPerSize.15") == 0 || strcmp(name, "ItemCapacityPerSize15") == 0 || + strcmp(name, "ItemCapacityPerSize.16") == 0 || strcmp(name, "ItemCapacityPerSize16") == 0 || + strcmp(name, "ItemCapacityPerSize.17") == 0 || strcmp(name, "ItemCapacityPerSize17") == 0 || + strcmp(name, "ItemCapacityPerSize.18") == 0 || strcmp(name, "ItemCapacityPerSize18") == 0 || + strcmp(name, "ItemCapacityPerSize.19") == 0 || strcmp(name, "ItemCapacityPerSize19") == 0 || + strcmp(name, "ItemCapacityPerSize.20") == 0 || strcmp(name, "ItemCapacityPerSize20") == 0 || + strcmp(name, "ItemCapacityPerSize.21") == 0 || strcmp(name, "ItemCapacityPerSize21") == 0 || + strcmp(name, "ItemCapacityPerSize.22") == 0 || strcmp(name, "ItemCapacityPerSize22") == 0 || + strcmp(name, "ItemCapacityPerSize.23") == 0 || strcmp(name, "ItemCapacityPerSize23") == 0 || + strcmp(name, "ItemCapacityPerSize.24") == 0 || strcmp(name, "ItemCapacityPerSize24") == 0 || + strcmp(name, "ItemCapacityPerSize.25") == 0 || strcmp(name, "ItemCapacityPerSize25") == 0 || + strcmp(name, "ItemCapacityPerSize.26") == 0 || strcmp(name, "ItemCapacityPerSize26") == 0 || + strcmp(name, "ItemCapacityPerSize.27") == 0 || strcmp(name, "ItemCapacityPerSize27") == 0 || + strcmp(name, "ItemCapacityPerSize.28") == 0 || strcmp(name, "ItemCapacityPerSize28") == 0 || + strcmp(name, "ItemCapacityPerSize.29") == 0 || strcmp(name, "ItemCapacityPerSize29") == 0 || + strcmp(name, "ItemCapacityPerSize.30") == 0 || strcmp(name, "ItemCapacityPerSize30") == 0 || + strcmp(name, "ItemCapacityPerSize.31") == 0 || strcmp(name, "ItemCapacityPerSize31") == 0 || + strcmp(name, "ItemCapacityPerSize.32") == 0 || strcmp(name, "ItemCapacityPerSize32") == 0 || + strcmp(name, "ItemCapacityPerSize.33") == 0 || strcmp(name, "ItemCapacityPerSize33") == 0 || + strcmp(name, "ItemCapacityPerSize.34") == 0 || strcmp(name, "ItemCapacityPerSize34") == 0 )) + { + pData->curElement = ELEMENT_PROPERTY; + + pData->maxReadDepth++; //we are not skipping this element + } + + pData->szCharData[0] = '\0'; + } + + pData->currentDepth++; + +} + +static void XMLCALL +lbepocketCharacterDataHandle(void *userData, const XML_Char *str, int len) +{ + lbepocketParseData * pData = (lbepocketParseData *)userData; + + if( (pData->currentDepth <= pData->maxReadDepth) && + (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) + ){ + strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); + } +} + + +static void XMLCALL +lbepocketEndElementHandle(void *userData, const XML_Char *name) +{ + lbepocketParseData * pData = (lbepocketParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading + { + if(strcmp(name, "POCKETLIST") == 0) + { + pData->curElement = ELEMENT_NONE; + } + else if(strcmp(name, "POCKET") == 0) + { + pData->curElement = ELEMENT_LIST; + if ( !onlyLocalizedText ) + LBEPocketType.push_back(pData->curLBEPocket); + else + strcpy(LBEPocketType[pData->curLBEPocket.pIndex].pName, pData->curLBEPocket.pName); + } + else if(strcmp(name, "pIndex") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.pIndex = (UINT16) atol(pData->szCharData); + } + else if(strcmp(name, "pName") == 0) + { + pData->curElement = ELEMENT; + if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData)) + strcpy(pData->curLBEPocket.pName,pData->szCharData); + else + { + strncpy(pData->curLBEPocket.pName,pData->szCharData,MAX_CHAR_DATA_LENGTH); + pData->curLBEPocket.pName[MAX_CHAR_DATA_LENGTH] = '\0'; + } + } + else if(strcmp(name, "pSilhouette") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.pSilhouette = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "pType") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.pType = (UINT16) atol(pData->szCharData); + } + else if(strcmp(name, "pRestriction") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.pRestriction = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.0") == 0 || strcmp(name, "ItemCapacityPerSize0") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[0] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.1") == 0 || strcmp(name, "ItemCapacityPerSize1") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[1] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.2") == 0 || strcmp(name, "ItemCapacityPerSize2") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[2] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.3") == 0 || strcmp(name, "ItemCapacityPerSize3") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[3] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.4") == 0 || strcmp(name, "ItemCapacityPerSize4") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[4] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.5") == 0 || strcmp(name, "ItemCapacityPerSize5") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[5] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.6") == 0 || strcmp(name, "ItemCapacityPerSize6") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[6] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.7") == 0 || strcmp(name, "ItemCapacityPerSize7") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[7] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.8") == 0 || strcmp(name, "ItemCapacityPerSize8") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[8] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.9") == 0 || strcmp(name, "ItemCapacityPerSize9") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[9] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.10") == 0 || strcmp(name, "ItemCapacityPerSize10") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[10] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.11") == 0 || strcmp(name, "ItemCapacityPerSize11") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[11] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.12") == 0 || strcmp(name, "ItemCapacityPerSize12") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[12] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.13") == 0 || strcmp(name, "ItemCapacityPerSize13") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[13] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.14") == 0 || strcmp(name, "ItemCapacityPerSize14") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[14] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.15") == 0 || strcmp(name, "ItemCapacityPerSize15") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[15] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.16") == 0 || strcmp(name, "ItemCapacityPerSize16") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[16] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.17") == 0 || strcmp(name, "ItemCapacityPerSize17") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[17] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.18") == 0 || strcmp(name, "ItemCapacityPerSize18") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[18] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.19") == 0 || strcmp(name, "ItemCapacityPerSize19") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[19] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.20") == 0 || strcmp(name, "ItemCapacityPerSize20") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[20] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.21") == 0 || strcmp(name, "ItemCapacityPerSize21") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[21] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.22") == 0 || strcmp(name, "ItemCapacityPerSize22") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[22] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.23") == 0 || strcmp(name, "ItemCapacityPerSize23") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[23] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.24") == 0 || strcmp(name, "ItemCapacityPerSize24") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[24] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.25") == 0 || strcmp(name, "ItemCapacityPerSize25") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[25] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.26") == 0 || strcmp(name, "ItemCapacityPerSize26") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[26] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.27") == 0 || strcmp(name, "ItemCapacityPerSize27") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[27] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.28") == 0 || strcmp(name, "ItemCapacityPerSize28") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[28] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.29") == 0 || strcmp(name, "ItemCapacityPerSize29") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[29] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.30") == 0 || strcmp(name, "ItemCapacityPerSize30") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[30] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.31") == 0 || strcmp(name, "ItemCapacityPerSize31") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[31] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.32") == 0 || strcmp(name, "ItemCapacityPerSize32") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[32] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.33") == 0 || strcmp(name, "ItemCapacityPerSize33") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[33] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "ItemCapacityPerSize.34") == 0 || strcmp(name, "ItemCapacityPerSize34") == 0) + { + pData->curElement = ELEMENT; + pData->curLBEPocket.ItemCapacityPerSize[34] = (UINT8) atol(pData->szCharData); + } + + pData->maxReadDepth--; + } + + pData->currentDepth--; +} + + + + +BOOLEAN ReadInLBEPocketStats(STR fileName, BOOLEAN localizedVersion) +{ + HWFILE hFile; + UINT32 uiBytesRead; + UINT32 uiFSize; + CHAR8 * lpcBuffer; + XML_Parser parser = XML_ParserCreate(NULL); + + lbepocketParseData pData; + + onlyLocalizedText = localizedVersion; + + DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading LBEPocket.xml" ); + + // Open loadbearingequipment file + hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); + if ( !hFile ) + return( FALSE ); + + uiFSize = FileGetSize(hFile); + lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); + + //Read in block + if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) ) + { + MemFree(lpcBuffer); + return( FALSE ); + } + + lpcBuffer[uiFSize] = 0; //add a null terminator + + FileClose( hFile ); + + + XML_SetElementHandler(parser, lbepocketStartElementHandle, lbepocketEndElementHandle); + XML_SetCharacterDataHandler(parser, lbepocketCharacterDataHandle); + + + memset(&pData,0,sizeof(pData)); + //pData.curArray = LBEPocketType; + //pData.maxArraySize = MAXITEMS; + + XML_SetUserData(parser, &pData); + + + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + { + CHAR8 errorBuf[511]; + + sprintf(errorBuf, "XML Parser Error in Pocket.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); + LiveMessage(errorBuf); + + MemFree(lpcBuffer); + return FALSE; + } + + MemFree(lpcBuffer); + + + XML_ParserFree(parser); + + + return( TRUE ); +} +BOOLEAN WriteLBEPocketEquipmentStats() +{ + //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"writelbepocketsstats"); + HWFILE hFile; + + //Debug code; make sure that what we got from the file is the same as what's there + // Open a new file + hFile = FileOpen( "TABLEDATA\\Pocket out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); + if ( !hFile ) + return( FALSE ); + + { + UINT32 cnt; + + FilePrintf(hFile,"\r\n"); + for(cnt = 0;cnt < MAXITEMS;cnt++) + { + + FilePrintf(hFile,"\t\r\n"); + + FilePrintf(hFile,"\t\t%d\r\n", cnt ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].pSilhouette ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].pType ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].pRestriction ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[0] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[1] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[2] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[3] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[4] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[5] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[6] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[7] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[8] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[9] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[10] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[11] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[12] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[13] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[14] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[15] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[16] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[17] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[18] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[19] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[20] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[21] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[22] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[23] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[24] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[25] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[26] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[27] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[28] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[29] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[30] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[31] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[32] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[33] ); + FilePrintf(hFile,"\t\t%d\r\n", LBEPocketType[cnt].ItemCapacityPerSize[34] ); + + FilePrintf(hFile,"\t\r\n"); + } + FilePrintf(hFile,"\r\n"); + } + FileClose( hFile ); + + return( TRUE ); +} diff --git a/Tactical/XML_Launchable.cpp b/Tactical/XML_Launchable.cpp index f569d7f2..80bef4c1 100644 --- a/Tactical/XML_Launchable.cpp +++ b/Tactical/XML_Launchable.cpp @@ -2,43 +2,8 @@ #include "Tactical All.h" #else #include "sgp.h" - #include "overhead types.h" - #include "Sound Control.h" - #include "Soldier Control.h" #include "overhead.h" - #include "Event Pump.h" #include "weapons.h" - #include "Animation Control.h" - #include "sys globals.h" - #include "Handle UI.h" - #include "Isometric Utils.h" - #include "worldman.h" - #include "math.h" - #include "points.h" - #include "ai.h" - #include "los.h" - #include "renderworld.h" - #include "opplist.h" - #include "interface.h" - #include "message.h" - #include "campaign.h" - #include "items.h" - #include "text.h" - #include "Soldier Profile.h" - #include "tile animation.h" - #include "Dialogue Control.h" - #include "SkillCheck.h" - #include "explosion control.h" - #include "Quests.h" - #include "Physics.h" - #include "Random.h" - #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" - #include "meanwhile.h" - #include "SkillCheck.h" - #include "gamesettings.h" - #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" @@ -52,13 +17,13 @@ struct UINT16 curLaunchable[2]; UINT32 maxArraySize; - UINT32 curIndex; + UINT32 curIndex; UINT32 currentDepth; UINT32 maxReadDepth; } typedef launchableParseData; -static void XMLCALL +static void XMLCALL launchableStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { launchableParseData * pData = (launchableParseData *)userData; @@ -103,9 +68,9 @@ launchableCharacterDataHandle(void *userData, const XML_Char *str, int len) { launchableParseData * pData = (launchableParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); } } @@ -160,7 +125,7 @@ BOOLEAN ReadInLaunchableStats(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + launchableParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading Launchables.xml" ); @@ -169,7 +134,7 @@ BOOLEAN ReadInLaunchableStats(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -184,19 +149,19 @@ BOOLEAN ReadInLaunchableStats(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, launchableStartElementHandle, launchableEndElementHandle); XML_SetCharacterDataHandler(parser, launchableCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); - pData.maxArraySize = MAXITEMS; + pData.maxArraySize = MAXITEMS; pData.curIndex = -1; - + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -223,7 +188,7 @@ BOOLEAN WriteLaunchableStats() hFile = FileOpen( "TABLEDATA\\Launchables out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -242,4 +207,4 @@ BOOLEAN WriteLaunchableStats() FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_LoadBearingEquipment.cpp b/Tactical/XML_LoadBearingEquipment.cpp new file mode 100644 index 00000000..d935c82b --- /dev/null +++ b/Tactical/XML_LoadBearingEquipment.cpp @@ -0,0 +1,299 @@ +#ifdef PRECOMPILEDHEADERS + #include "Tactical All.h" +#else + #include "sgp.h" + #include "overhead.h" + #include "weapons.h" + #include "Debug Control.h" + #include "expat.h" + #include "XML.h" +#endif + +struct +{ + PARSE_STAGE curElement; + + CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; + LBETYPE curLBE; + UINT32 currentDepth; + UINT32 maxReadDepth; +} +typedef lbeParseData; + +static void XMLCALL +lbeStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) +{ + lbeParseData * pData = (lbeParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element? + { + if(strcmp(name, "LOADBEARINGEQUIPMENTLIST") == 0 && pData->curElement == ELEMENT_NONE) + { + pData->curElement = ELEMENT_LIST; + + pData->maxReadDepth++; //we are not skipping this element + } + else if(strcmp(name, "LOADBEARINGEQUIPMENT") == 0 && pData->curElement == ELEMENT_LIST) + { + pData->curElement = ELEMENT; + + pData->curLBE = LBETYPE(); + + pData->maxReadDepth++; //we are not skipping this element + } + else if(pData->curElement == ELEMENT && + (strcmp(name, "lbeIndex") == 0 || + strcmp(name, "lbeClass") == 0 || + strcmp(name, "lbeCombo") == 0 || + strcmp(name, "lbeFilledSize") == 0 || + strcmp(name, "lbePocketIndex.1") == 0 || strcmp(name, "lbePocketIndex1") == 0 || + strcmp(name, "lbePocketIndex.2") == 0 || strcmp(name, "lbePocketIndex2") == 0 || + strcmp(name, "lbePocketIndex.3") == 0 || strcmp(name, "lbePocketIndex3") == 0 || + strcmp(name, "lbePocketIndex.4") == 0 || strcmp(name, "lbePocketIndex4") == 0 || + strcmp(name, "lbePocketIndex.5") == 0 || strcmp(name, "lbePocketIndex5") == 0 || + strcmp(name, "lbePocketIndex.6") == 0 || strcmp(name, "lbePocketIndex6") == 0 || + strcmp(name, "lbePocketIndex.7") == 0 || strcmp(name, "lbePocketIndex7") == 0 || + strcmp(name, "lbePocketIndex.8") == 0 || strcmp(name, "lbePocketIndex8") == 0 || + strcmp(name, "lbePocketIndex.9") == 0 || strcmp(name, "lbePocketIndex9") == 0 || + strcmp(name, "lbePocketIndex.10") == 0 || strcmp(name, "lbePocketIndex10") == 0 || + strcmp(name, "lbePocketIndex.11") == 0 || strcmp(name, "lbePocketIndex11") == 0 || + strcmp(name, "lbePocketIndex.12") == 0 || strcmp(name, "lbePocketIndex12") == 0 )) + { + pData->curElement = ELEMENT_PROPERTY; + + pData->maxReadDepth++; //we are not skipping this element + } + + pData->szCharData[0] = '\0'; + } + + pData->currentDepth++; + +} + +static void XMLCALL +lbeCharacterDataHandle(void *userData, const XML_Char *str, int len) +{ + lbeParseData * pData = (lbeParseData *)userData; + + if( (pData->currentDepth <= pData->maxReadDepth) && + (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) + ){ + strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); + } +} + + +static void XMLCALL +lbeEndElementHandle(void *userData, const XML_Char *name) +{ + lbeParseData * pData = (lbeParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading + { + if(strcmp(name, "LOADBEARINGEQUIPMENTLIST") == 0) + { + pData->curElement = ELEMENT_NONE; + } + else if(strcmp(name, "LOADBEARINGEQUIPMENT") == 0) + { + pData->curElement = ELEMENT_LIST; + LoadBearingEquipment.push_back(pData->curLBE); + } + else if(strcmp(name, "lbeIndex") == 0) + { + pData->curElement = ELEMENT; + pData->curLBE.lbeIndex = (UINT16) atol(pData->szCharData); + } + else if(strcmp(name, "lbeClass") == 0) + { + pData->curElement = ELEMENT; + pData->curLBE.lbeClass = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "lbeCombo") == 0) + { + pData->curElement = ELEMENT; + pData->curLBE.lbeCombo = (UINT32) atol(pData->szCharData); + } + else if(strcmp(name, "lbeFilledSize") == 0) + { + pData->curElement = ELEMENT; + pData->curLBE.lbeFilledSize = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "lbePocketIndex.1") == 0 || strcmp(name, "lbePocketIndex1") == 0) + { + pData->curElement = ELEMENT; + pData->curLBE.lbePocketIndex[0] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "lbePocketIndex.2") == 0 || strcmp(name, "lbePocketIndex2") == 0) + { + pData->curElement = ELEMENT; + pData->curLBE.lbePocketIndex[1] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "lbePocketIndex.3") == 0 || strcmp(name, "lbePocketIndex3") == 0) + { + pData->curElement = ELEMENT; + pData->curLBE.lbePocketIndex[2] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "lbePocketIndex.4") == 0 || strcmp(name, "lbePocketIndex4") == 0) + { + pData->curElement = ELEMENT; + pData->curLBE.lbePocketIndex[3] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "lbePocketIndex.5") == 0 || strcmp(name, "lbePocketIndex5") == 0) + { + pData->curElement = ELEMENT; + pData->curLBE.lbePocketIndex[4] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "lbePocketIndex.6") == 0 || strcmp(name, "lbePocketIndex6") == 0) + { + pData->curElement = ELEMENT; + pData->curLBE.lbePocketIndex[5] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "lbePocketIndex.7") == 0 || strcmp(name, "lbePocketIndex7") == 0) + { + pData->curElement = ELEMENT; + pData->curLBE.lbePocketIndex[6] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "lbePocketIndex.8") == 0 || strcmp(name, "lbePocketIndex8") == 0) + { + pData->curElement = ELEMENT; + pData->curLBE.lbePocketIndex[7] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "lbePocketIndex.9") == 0 || strcmp(name, "lbePocketIndex9") == 0) + { + pData->curElement = ELEMENT; + pData->curLBE.lbePocketIndex[8] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "lbePocketIndex.10") == 0 || strcmp(name, "lbePocketIndex10") == 0) + { + pData->curElement = ELEMENT; + pData->curLBE.lbePocketIndex[9] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "lbePocketIndex.11") == 0 || strcmp(name, "lbePocketIndex11") == 0) + { + pData->curElement = ELEMENT; + pData->curLBE.lbePocketIndex[10] = (UINT8) atol(pData->szCharData); + } + else if(strcmp(name, "lbePocketIndex.12") == 0 || strcmp(name, "lbePocketIndex12") == 0) + { + pData->curElement = ELEMENT; + pData->curLBE.lbePocketIndex[11] = (UINT8) atol(pData->szCharData); + } + + pData->maxReadDepth--; + } + + pData->currentDepth--; +} + + + + +BOOLEAN ReadInlbeStats(STR fileName) +{ + HWFILE hFile; + UINT32 uiBytesRead; + UINT32 uiFSize; + CHAR8 * lpcBuffer; + XML_Parser parser = XML_ParserCreate(NULL); + + lbeParseData pData; + + DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading LoadBearingEquipment.xml" ); + + // Open loadbearingequipment file + hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); + if ( !hFile ) + return( FALSE ); + + uiFSize = FileGetSize(hFile); + lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); + + //Read in block + if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) ) + { + MemFree(lpcBuffer); + return( FALSE ); + } + + lpcBuffer[uiFSize] = 0; //add a null terminator + + FileClose( hFile ); + + + XML_SetElementHandler(parser, lbeStartElementHandle, lbeEndElementHandle); + XML_SetCharacterDataHandler(parser, lbeCharacterDataHandle); + + + memset(&pData,0,sizeof(pData)); + //pData.curArray = LoadBearingEquipment; + //pData.maxArraySize = MAXITEMS; + + XML_SetUserData(parser, &pData); + + + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + { + CHAR8 errorBuf[511]; + + sprintf(errorBuf, "XML Parser Error in LoadBearingEquipment.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); + LiveMessage(errorBuf); + + MemFree(lpcBuffer); + return FALSE; + } + + MemFree(lpcBuffer); + + + XML_ParserFree(parser); + + + return( TRUE ); +} +BOOLEAN WritelbeEquipmentStats() +{ + //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"writelbestats"); + HWFILE hFile; + + //Debug code; make sure that what we got from the file is the same as what's there + // Open a new file + hFile = FileOpen( "TABLEDATA\\LoadBearingEquipment out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); + if ( !hFile ) + return( FALSE ); + + { + UINT32 cnt; + + FilePrintf(hFile,"\r\n"); + for(cnt = 0;cnt < MAXITEMS;cnt++) + { + + FilePrintf(hFile,"\t\r\n"); + + FilePrintf(hFile,"\t\t%d\r\n", cnt ); + FilePrintf(hFile,"\t\t%d\r\n", LoadBearingEquipment[cnt].lbeClass ); + FilePrintf(hFile,"\t\t%d\r\n", LoadBearingEquipment[cnt].lbeCombo ); + FilePrintf(hFile,"\t\t%d\r\n", LoadBearingEquipment[cnt].lbeFilledSize ); + FilePrintf(hFile,"\t\t%d\r\n", LoadBearingEquipment[cnt].lbePocketIndex[0] ); + FilePrintf(hFile,"\t\t%d\r\n", LoadBearingEquipment[cnt].lbePocketIndex[1] ); + FilePrintf(hFile,"\t\t%d\r\n", LoadBearingEquipment[cnt].lbePocketIndex[2] ); + FilePrintf(hFile,"\t\t%d\r\n", LoadBearingEquipment[cnt].lbePocketIndex[3] ); + FilePrintf(hFile,"\t\t%d\r\n", LoadBearingEquipment[cnt].lbePocketIndex[4] ); + FilePrintf(hFile,"\t\t%d\r\n", LoadBearingEquipment[cnt].lbePocketIndex[5] ); + FilePrintf(hFile,"\t\t%d\r\n", LoadBearingEquipment[cnt].lbePocketIndex[6] ); + FilePrintf(hFile,"\t\t%d\r\n", LoadBearingEquipment[cnt].lbePocketIndex[7] ); + FilePrintf(hFile,"\t\t%d\r\n", LoadBearingEquipment[cnt].lbePocketIndex[8] ); + FilePrintf(hFile,"\t\t%d\r\n", LoadBearingEquipment[cnt].lbePocketIndex[9] ); + FilePrintf(hFile,"\t\t%d\r\n", LoadBearingEquipment[cnt].lbePocketIndex[10] ); + FilePrintf(hFile,"\t\t%d\r\n", LoadBearingEquipment[cnt].lbePocketIndex[11] ); + + FilePrintf(hFile,"\t\r\n"); + } + FilePrintf(hFile,"\r\n"); + } + FileClose( hFile ); + + return( TRUE ); +} diff --git a/Tactical/XML_Magazine.cpp b/Tactical/XML_Magazine.cpp index bacf2046..972e0d09 100644 --- a/Tactical/XML_Magazine.cpp +++ b/Tactical/XML_Magazine.cpp @@ -2,44 +2,8 @@ #include "Tactical All.h" #else #include "sgp.h" - #include "overhead types.h" - #include "Sound Control.h" - #include "Soldier Control.h" #include "overhead.h" - #include "Event Pump.h" #include "weapons.h" - #include "Animation Control.h" - #include "sys globals.h" - #include "Handle UI.h" - #include "Isometric Utils.h" - #include "worldman.h" - #include "math.h" - #include "points.h" - #include "ai.h" - #include "los.h" - #include "renderworld.h" - #include "opplist.h" - #include "interface.h" - #include "message.h" - #include "campaign.h" - #include "items.h" - #include "weapons.h" - #include "text.h" - #include "Soldier Profile.h" - #include "tile animation.h" - #include "Dialogue Control.h" - #include "SkillCheck.h" - #include "explosion control.h" - #include "Quests.h" - #include "Physics.h" - #include "Random.h" - #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" - #include "meanwhile.h" - #include "SkillCheck.h" - #include "gamesettings.h" - #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" @@ -53,13 +17,13 @@ struct MAGTYPE curMagazine; MAGTYPE * curArray; UINT32 maxArraySize; - + UINT32 currentDepth; UINT32 maxReadDepth; } typedef magazineParseData; -static void XMLCALL +static void XMLCALL magazineStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { magazineParseData * pData = (magazineParseData *)userData; @@ -105,11 +69,11 @@ magazineCharacterDataHandle(void *userData, const XML_Char *str, int len) { magazineParseData * pData = (magazineParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); - } + } } @@ -136,22 +100,22 @@ magazineEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "uiIndex") == 0) { pData->curElement = ELEMENT; - pData->curMagazine.uiIndex = (UINT32) atol(pData->szCharData); + pData->curMagazine.uiIndex = (UINT32) atol(pData->szCharData); } else if(strcmp(name, "ubCalibre") == 0) { pData->curElement = ELEMENT; - pData->curMagazine.ubCalibre = (UINT8) atol(pData->szCharData); + pData->curMagazine.ubCalibre = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "ubMagSize") == 0) { pData->curElement = ELEMENT; - pData->curMagazine.ubMagSize = (UINT8) atol(pData->szCharData); + pData->curMagazine.ubMagSize = (UINT16) atol(pData->szCharData); } else if(strcmp(name, "ubAmmoType") == 0) { pData->curElement = ELEMENT; - pData->curMagazine.ubAmmoType = (UINT8) atol(pData->szCharData); + pData->curMagazine.ubAmmoType = (UINT8) atol(pData->szCharData); } pData->maxReadDepth--; @@ -170,7 +134,7 @@ BOOLEAN ReadInMagazineStats(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + magazineParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading Magazines.xml" ); @@ -179,7 +143,7 @@ BOOLEAN ReadInMagazineStats(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -194,19 +158,19 @@ BOOLEAN ReadInMagazineStats(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, magazineStartElementHandle, magazineEndElementHandle); XML_SetCharacterDataHandler(parser, magazineCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); pData.curArray = Magazine; - pData.maxArraySize = MAXITEMS; - + pData.maxArraySize = MAXITEMS; + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -235,7 +199,7 @@ BOOLEAN WriteMagazineStats() hFile = FileOpen( "TABLEDATA\\Magazine out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -246,9 +210,9 @@ BOOLEAN WriteMagazineStats() FilePrintf(hFile,"\t\r\n"); FilePrintf(hFile,"\t\t%d\r\n", cnt ); - FilePrintf(hFile,"\t\t%d\r\n", Magazine[cnt].ubCalibre ); - FilePrintf(hFile,"\t\t%d\r\n", Magazine[cnt].ubMagSize ); - FilePrintf(hFile,"\t\t%d\r\n", Magazine[cnt].ubAmmoType ); + FilePrintf(hFile,"\t\t%d\r\n", Magazine[cnt].ubCalibre ); + FilePrintf(hFile,"\t\t%d\r\n", Magazine[cnt].ubMagSize ); + FilePrintf(hFile,"\t\t%d\r\n", Magazine[cnt].ubAmmoType ); FilePrintf(hFile,"\t\r\n"); } @@ -257,4 +221,4 @@ BOOLEAN WriteMagazineStats() FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_MercStartingGear.cpp b/Tactical/XML_MercStartingGear.cpp new file mode 100644 index 00000000..f7199727 --- /dev/null +++ b/Tactical/XML_MercStartingGear.cpp @@ -0,0 +1,721 @@ +#ifdef PRECOMPILEDHEADERS + #include "Tactical All.h" +#else + #include "sgp.h" + #include "overhead.h" + #include "weapons.h" + #include "Debug Control.h" + #include "expat.h" + #include "XML.h" + #include "Soldier Profile.h" +#endif + +struct +{ + PARSE_STAGE curElement; + + CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; + MERCPROFILEGEAR curMercStartingGear; + MERCPROFILEGEAR * curArray; + UINT32 maxArraySize; + + UINT32 currentDepth; + UINT32 maxReadDepth; +} +typedef MercStartingGearParseData; + +static void XMLCALL +MercStartingGearStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) +{ + MercStartingGearParseData * pData = (MercStartingGearParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element? + { + if(strcmp(name, "MERCGEARLIST") == 0 && pData->curElement == ELEMENT_NONE) + { + pData->curElement = ELEMENT_LIST; + + //pData->curArray = &(MERCPROFILEGEAR()); + //memset(pData->curArray,0,sizeof(MERCPROFILEGEAR)*pData->maxArraySize); + + pData->maxReadDepth++; //we are not skipping this element + } + else if(strcmp(name, "MERCGEAR") == 0 && pData->curElement == ELEMENT_LIST) + { + pData->curElement = ELEMENT; + + pData->curMercStartingGear = MERCPROFILEGEAR(); + //memset(&pData->curMercStartingGear,0,sizeof(MERCPROFILEGEAR)); + + pData->maxReadDepth++; //we are not skipping this element + } + else if(pData->curElement == ELEMENT && + (strcmp(name, "mIndex") == 0 || + strcmp(name, "mName") == 0 || + strcmp(name, "mHelmet") == 0 || + strcmp(name, "mHelmetStatus") == 0 || + strcmp(name, "mHelmetDrop") == 0 || + strcmp(name, "mVest") == 0 || + strcmp(name, "mVestStatus") == 0 || + strcmp(name, "mVestDrop") == 0 || + strcmp(name, "mLeg") == 0 || + strcmp(name, "mLegStatus") == 0 || + strcmp(name, "mLegDrop") == 0 || + strcmp(name, "mWeapon") == 0 || + strcmp(name, "mWeaponStatus") == 0 || + strcmp(name, "mWeaponDrop") == 0 || + strcmp(name, "mBig0") == 0 || + strcmp(name, "mBig0Quantity") == 0 || + strcmp(name, "mBig0Status") == 0 || + strcmp(name, "mBig0Drop") == 0 || + strcmp(name, "mBig1") == 0 || + strcmp(name, "mBig1Quantity") == 0 || + strcmp(name, "mBig1Status") == 0 || + strcmp(name, "mBig1Drop") == 0 || + strcmp(name, "mBig2") == 0 || + strcmp(name, "mBig2Quantity") == 0 || + strcmp(name, "mBig2Status") == 0 || + strcmp(name, "mBig2Drop") == 0 || + strcmp(name, "mBig3") == 0 || + strcmp(name, "mBig3Quantity") == 0 || + strcmp(name, "mBig3Status") == 0 || + strcmp(name, "mBig3Drop") == 0 || + strcmp(name, "mSmall0") == 0 || + strcmp(name, "mSmall0Quantity") == 0 || + strcmp(name, "mSmall0Status") == 0 || + strcmp(name, "mSmall1") == 0 || + strcmp(name, "mSmall1Quantity") == 0 || + strcmp(name, "mSmall1Status") == 0 || + strcmp(name, "mSmall2") == 0 || + strcmp(name, "mSmall2Quantity") == 0 || + strcmp(name, "mSmall2Status") == 0 || + strcmp(name, "mSmall3") == 0 || + strcmp(name, "mSmall3Quantity") == 0 || + strcmp(name, "mSmall3Status") == 0 || + strcmp(name, "mSmall4") == 0 || + strcmp(name, "mSmall4Quantity") == 0 || + strcmp(name, "mSmall4Status") == 0 || + strcmp(name, "mSmall5") == 0 || + strcmp(name, "mSmall5Quantity") == 0 || + strcmp(name, "mSmall5Status") == 0 || + strcmp(name, "mSmall6") == 0 || + strcmp(name, "mSmall6Quantity") == 0 || + strcmp(name, "mSmall6Status") == 0 || + strcmp(name, "mSmall7") == 0 || + strcmp(name, "mSmall7Quantity") == 0 || + strcmp(name, "mSmall7Status") == 0 || + strcmp(name, "lVest") == 0 || + strcmp(name, "lVestStatus") == 0 || + strcmp(name, "lLeftThigh") == 0 || + strcmp(name, "lLeftThighStatus") == 0 || + strcmp(name, "lRightThigh") == 0 || + strcmp(name, "lRightThighStatus") == 0 || + strcmp(name, "lCPack") == 0 || + strcmp(name, "lCPackStatus") == 0 || + strcmp(name, "lBPack") == 0 || + strcmp(name, "lBPackStatus") == 0 )) + { + pData->curElement = ELEMENT_PROPERTY; + + pData->maxReadDepth++; //we are not skipping this element + } + + pData->szCharData[HELMETPOS] = '\0'; + } + + pData->currentDepth++; + +} + +static void XMLCALL +MercStartingGearCharacterDataHandle(void *userData, const XML_Char *str, int len) +{ + MercStartingGearParseData * pData = (MercStartingGearParseData *)userData; + + if( (pData->currentDepth <= pData->maxReadDepth) && + (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) + ){ + strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); + } +} + + +static void XMLCALL +MercStartingGearEndElementHandle(void *userData, const XML_Char *name) +{ + MercStartingGearParseData * pData = (MercStartingGearParseData *)userData; + char temp; + + if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading + { + if(strcmp(name, "MERCGEARLIST") == 0) + { + pData->curElement = ELEMENT_NONE; + } + else if(strcmp(name, "MERCGEAR") == 0) + { + pData->curElement = ELEMENT_LIST; + + if(pData->curMercStartingGear.mIndex < pData->maxArraySize) + { + pData->curArray[pData->curMercStartingGear.mIndex] = pData->curMercStartingGear; //write the armour into the table + } + } + else if(strcmp(name, "mIndex") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.mIndex = (UINT16) atol(pData->szCharData); + } + else if(strcmp(name, "mName") == 0) + { + pData->curElement = ELEMENT; + if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData)) + strcpy(pData->curMercStartingGear.mName,pData->szCharData); + else + { + strncpy(pData->curMercStartingGear.mName,pData->szCharData,MAX_CHAR_DATA_LENGTH); + pData->curMercStartingGear.mName[MAX_CHAR_DATA_LENGTH] = '\0'; + } + for(int i=0;iszCharData),MAX_CHAR_DATA_LENGTH);i++) + { + temp = pData->szCharData[i]; + pData->curMercStartingGear.mName[i] = temp; + //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: itemname[%d] = %s, temp = %s",i,&pData->curItem.szItemName[i],&temp)); + } + } + else if(strcmp(name, "mHelmet") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.inv[HELMETPOS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mVest") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.inv[VESTPOS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mLeg") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.inv[LEGPOS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mWeapon") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.inv[HANDPOS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mBig0") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.inv[BIGPOCK1POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mBig1") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.inv[BIGPOCK2POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mBig2") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.inv[BIGPOCK3POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mBig3") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.inv[BIGPOCK4POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall0") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.inv[SMALLPOCK1POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall1") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.inv[SMALLPOCK2POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall2") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.inv[SMALLPOCK3POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall3") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.inv[SMALLPOCK4POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall4") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.inv[SMALLPOCK5POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall5") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.inv[SMALLPOCK6POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall6") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.inv[SMALLPOCK7POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall7") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.inv[SMALLPOCK8POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mHelmetStatus") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iStatus[HELMETPOS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mVestStatus") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iStatus[VESTPOS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mLegStatus") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iStatus[LEGPOS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mWeaponStatus") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iStatus[HANDPOS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mBig0Status") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iStatus[BIGPOCK1POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mBig1Status") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iStatus[BIGPOCK2POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mBig2Status") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iStatus[BIGPOCK3POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mBig3Status") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iStatus[BIGPOCK4POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall0Status") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iStatus[SMALLPOCK1POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall1Status") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iStatus[SMALLPOCK2POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall2Status") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iStatus[SMALLPOCK3POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall3Status") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iStatus[SMALLPOCK4POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall4Status") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iStatus[SMALLPOCK5POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall5Status") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iStatus[SMALLPOCK6POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall6Status") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iStatus[SMALLPOCK7POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall7Status") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iStatus[SMALLPOCK8POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mHelmetDrop") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iDrop[HELMETPOS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mVestDrop") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iDrop[VESTPOS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mLegDrop") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iDrop[LEGPOS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mWeaponDrop") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iDrop[HANDPOS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mBig0Drop") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iDrop[BIGPOCK1POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mBig1Drop") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iDrop[BIGPOCK2POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mBig2Drop") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iDrop[BIGPOCK3POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mBig3Drop") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iDrop[BIGPOCK4POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mBig0Quantity") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iNumber[BIGPOCK1POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mBig1Quantity") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iNumber[BIGPOCK2POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mBig2Quantity") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iNumber[BIGPOCK3POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mBig3Quantity") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iNumber[BIGPOCK4POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall0Quantity") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iNumber[SMALLPOCK1POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall1Quantity") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iNumber[SMALLPOCK2POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall2Quantity") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iNumber[SMALLPOCK3POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall3Quantity") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iNumber[SMALLPOCK4POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall4Quantity") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iNumber[SMALLPOCK5POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall5Quantity") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iNumber[SMALLPOCK6POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall6Quantity") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iNumber[SMALLPOCK7POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "mSmall7Quantity") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.iNumber[SMALLPOCK8POS] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "lVest") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.lbe[0] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "lLeftThigh") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.lbe[1] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "lRightThigh") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.lbe[2] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "lCPack") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.lbe[3] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "lBPack") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.lbe[4] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "lVestStatus") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.lStatus[0] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "lLeftThighStatus") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.lStatus[1] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "lRightThighStatus") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.lStatus[2] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "lCPackStatus") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.lStatus[3] = (int) atol(pData->szCharData); + } + else if(strcmp(name, "lBPackStatus") == 0) + { + pData->curElement = ELEMENT; + pData->curMercStartingGear.lStatus[4] = (int) atol(pData->szCharData); + } + + pData->maxReadDepth--; + } + + pData->currentDepth--; +} + + + + +BOOLEAN ReadInMercStartingGearStats(STR fileName) +{ + HWFILE hFile; + UINT32 uiBytesRead; + UINT32 uiFSize; + CHAR8 * lpcBuffer; + XML_Parser parser = XML_ParserCreate(NULL); + + MercStartingGearParseData pData; + + DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading MercStartingGear.xml" ); + + // Open gMercProfileGear file + hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); + if ( !hFile ) + return( FALSE ); + + uiFSize = FileGetSize(hFile); + lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); + + //Read in block + if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) ) + { + MemFree(lpcBuffer); + return( FALSE ); + } + + lpcBuffer[uiFSize] = 0; //add a null terminator + + FileClose( hFile ); + + + XML_SetElementHandler(parser, MercStartingGearStartElementHandle, MercStartingGearEndElementHandle); + XML_SetCharacterDataHandler(parser, MercStartingGearCharacterDataHandle); + + + memset(&pData,0,sizeof(pData)); + pData.curArray = gMercProfileGear; + pData.maxArraySize = NUM_PROFILES; + + XML_SetUserData(parser, &pData); + + + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + { + CHAR8 errorBuf[511]; + + sprintf(errorBuf, "XML Parser Error in MercStartingGear.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); + LiveMessage(errorBuf); + + MemFree(lpcBuffer); + return FALSE; + } + + MemFree(lpcBuffer); + + + XML_ParserFree(parser); + + + return( TRUE ); +} +BOOLEAN WriteMercStartingGearStats() +{ + //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"writemercstartinggearstats"); + HWFILE hFile; + + //Debug code; make sure that what we got from the file is the same as what's there + // Open a new file + hFile = FileOpen( "TABLEDATA\\MercStartingGear out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); + if ( !hFile ) + return( FALSE ); + + { + UINT32 cnt; + CHAR16 str[100]; + + FilePrintf(hFile,"\r\n"); + for(cnt = 0;cnt < NUM_PROFILES;cnt++) + { + + FilePrintf(hFile,"\t\r\n"); + + FilePrintf(hFile,"\t\t%d\r\n", cnt ); +// FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].mName ); + + + int j = -1; + for (int i=0;i<80;i++) + { + j++; + if ( i<(int)strlen(gMercProfileGear[cnt].mName)) + { + str[i] = gMercProfileGear[cnt].mName [j]; + } + else + { + str[i] ='\0'; + } + } + STR16 szRemainder = str; + FilePrintf(hFile,"\t\t"); + while(szRemainder[HELMETPOS] != '\0') + { + UINT32 uiCharLoc = wcscspn(szRemainder, L"&<>\'\"\0"); + CHAR16 invChar = szRemainder[uiCharLoc]; + + if(uiCharLoc) + { + szRemainder[uiCharLoc] = '\0'; + FilePrintf(hFile,"%S",szRemainder); + szRemainder[uiCharLoc] = invChar; + } + + szRemainder += uiCharLoc; + + switch(invChar) + { + case '&': + FilePrintf(hFile,"&"); + szRemainder++; + break; + + case '<': + FilePrintf(hFile,"<"); + szRemainder++; + break; + + case '>': + FilePrintf(hFile,">"); + szRemainder++; + break; + + case '\'': + FilePrintf(hFile,"'"); + szRemainder++; + break; + + case '\"': + FilePrintf(hFile,"""); + szRemainder++; + break; + } + } + FilePrintf(hFile,"\r\n"); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].inv[HELMETPOS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].inv[VESTPOS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].inv[LEGPOS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].inv[HANDPOS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iStatus[HELMETPOS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iStatus[VESTPOS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iStatus[LEGPOS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iStatus[HANDPOS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iDrop[HELMETPOS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iDrop[VESTPOS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iDrop[LEGPOS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iDrop[HANDPOS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].inv[BIGPOCK1POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].inv[BIGPOCK2POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].inv[BIGPOCK3POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].inv[BIGPOCK4POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iNumber[BIGPOCK1POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iNumber[BIGPOCK2POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iNumber[BIGPOCK3POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iNumber[BIGPOCK4POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iStatus[BIGPOCK1POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iStatus[BIGPOCK2POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iStatus[BIGPOCK3POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iStatus[BIGPOCK4POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iDrop[BIGPOCK1POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iDrop[BIGPOCK2POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iDrop[BIGPOCK3POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iDrop[BIGPOCK4POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].inv[SMALLPOCK1POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].inv[SMALLPOCK2POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].inv[SMALLPOCK3POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].inv[SMALLPOCK4POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].inv[SMALLPOCK5POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].inv[SMALLPOCK6POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].inv[SMALLPOCK7POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].inv[SMALLPOCK8POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iNumber[SMALLPOCK1POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iNumber[SMALLPOCK2POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iNumber[SMALLPOCK3POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iNumber[SMALLPOCK4POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iNumber[SMALLPOCK5POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iNumber[SMALLPOCK6POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iNumber[SMALLPOCK7POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iNumber[SMALLPOCK8POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iStatus[SMALLPOCK1POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iStatus[SMALLPOCK2POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iStatus[SMALLPOCK3POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iStatus[SMALLPOCK4POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iStatus[SMALLPOCK5POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iStatus[SMALLPOCK6POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iStatus[SMALLPOCK7POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].iStatus[SMALLPOCK8POS] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].lbe[0] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].lbe[1] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].lbe[2] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].lbe[3] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].lbe[4] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].lStatus[0] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].lStatus[1] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].lStatus[2] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].lStatus[3] ); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfileGear[cnt].lStatus[4] ); + + FilePrintf(hFile,"\t\r\n"); + } + FilePrintf(hFile,"\r\n"); + } + FileClose( hFile ); + + return( TRUE ); +} diff --git a/Tactical/XML_Merge.cpp b/Tactical/XML_Merge.cpp index 0f965481..c345c84a 100644 --- a/Tactical/XML_Merge.cpp +++ b/Tactical/XML_Merge.cpp @@ -2,43 +2,8 @@ #include "Tactical All.h" #else #include "sgp.h" - #include "overhead types.h" - #include "Sound Control.h" - #include "Soldier Control.h" #include "overhead.h" - #include "Event Pump.h" #include "weapons.h" - #include "Animation Control.h" - #include "sys globals.h" - #include "Handle UI.h" - #include "Isometric Utils.h" - #include "worldman.h" - #include "math.h" - #include "points.h" - #include "ai.h" - #include "los.h" - #include "renderworld.h" - #include "opplist.h" - #include "interface.h" - #include "message.h" - #include "campaign.h" - #include "items.h" - #include "text.h" - #include "Soldier Profile.h" - #include "tile animation.h" - #include "Dialogue Control.h" - #include "SkillCheck.h" - #include "explosion control.h" - #include "Quests.h" - #include "Physics.h" - #include "Random.h" - #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" - #include "meanwhile.h" - #include "SkillCheck.h" - #include "gamesettings.h" - #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" @@ -52,13 +17,13 @@ struct UINT16 curMerge[6]; UINT32 maxArraySize; - UINT32 curIndex; + UINT32 curIndex; UINT32 currentDepth; UINT32 maxReadDepth; } typedef mergeParseData; -static void XMLCALL +static void XMLCALL mergeStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { mergeParseData * pData = (mergeParseData *)userData; @@ -107,9 +72,9 @@ mergeCharacterDataHandle(void *userData, const XML_Char *str, int len) { mergeParseData * pData = (mergeParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); } } @@ -188,7 +153,7 @@ BOOLEAN ReadInMergeStats(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + mergeParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading Merges.xml" ); @@ -197,7 +162,7 @@ BOOLEAN ReadInMergeStats(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -212,19 +177,19 @@ BOOLEAN ReadInMergeStats(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, mergeStartElementHandle, mergeEndElementHandle); XML_SetCharacterDataHandler(parser, mergeCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); - pData.maxArraySize = MAXITEMS; + pData.maxArraySize = MAXITEMS; pData.curIndex = -1; - + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -251,7 +216,7 @@ BOOLEAN WriteMergeStats() hFile = FileOpen( "TABLEDATA\\Merges out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -274,4 +239,4 @@ BOOLEAN WriteMergeStats() FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_SectorLoadscreens.cpp b/Tactical/XML_SectorLoadscreens.cpp index e4afb118..d3df5bb3 100644 --- a/Tactical/XML_SectorLoadscreens.cpp +++ b/Tactical/XML_SectorLoadscreens.cpp @@ -2,43 +2,8 @@ #include "Tactical All.h" #else #include "sgp.h" - #include "overhead types.h" - #include "Sound Control.h" - #include "Soldier Control.h" #include "overhead.h" - #include "Event Pump.h" #include "weapons.h" - #include "Animation Control.h" - #include "sys globals.h" - #include "Handle UI.h" - #include "Isometric Utils.h" - #include "worldman.h" - #include "math.h" - #include "points.h" - #include "ai.h" - #include "los.h" - #include "renderworld.h" - #include "opplist.h" - #include "interface.h" - #include "message.h" - #include "campaign.h" - #include "items.h" - #include "text.h" - #include "Soldier Profile.h" - #include "tile animation.h" - #include "Dialogue Control.h" - #include "SkillCheck.h" - #include "explosion control.h" - #include "Quests.h" - #include "Physics.h" - #include "Random.h" - #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" - #include "meanwhile.h" - #include "SkillCheck.h" - #include "gamesettings.h" - #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" @@ -54,13 +19,13 @@ struct SECTOR_LOADSCREENS * curArray; UINT32 maxArraySize; - UINT32 curIndex; + UINT32 curIndex; UINT32 currentDepth; UINT32 maxReadDepth; } typedef sectorLoadscreensParseData; -static void XMLCALL +static void XMLCALL sectorLoadscreensStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { sectorLoadscreensParseData * pData = (sectorLoadscreensParseData *)userData; @@ -85,7 +50,7 @@ sectorLoadscreensStartElementHandle(void *userData, const XML_Char *name, const } else if (pData->curElement == ELEMENT && (strcmp(name, "uiIndex") == 0 || - strcmp(name, "szLocation") == 0 || + strcmp(name, "szLocation") == 0 || strcmp(name, "RandomAltSector") == 0 || strcmp(name, "szImageFormat") == 0 || strcmp(name, "szDay") == 0 || @@ -110,9 +75,9 @@ sectorLoadscreensCharacterDataHandle(void *userData, const XML_Char *str, int le { sectorLoadscreensParseData * pData = (sectorLoadscreensParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); } } @@ -120,7 +85,7 @@ sectorLoadscreensCharacterDataHandle(void *userData, const XML_Char *str, int le static void XMLCALL sectorLoadscreensEndElementHandle(void *userData, const XML_Char *name) -{ +{ char temp; sectorLoadscreensParseData * pData = (sectorLoadscreensParseData *)userData; @@ -142,7 +107,7 @@ sectorLoadscreensEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "uiIndex") == 0) { pData->curElement = ELEMENT; - pData->curSectorLoadscreens.uiIndex = (UINT32) atol(pData->szCharData); + pData->curSectorLoadscreens.uiIndex = (UINT32) atol(pData->szCharData); } else if(strcmp(name, "szLocation") == 0) { @@ -166,7 +131,7 @@ sectorLoadscreensEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "RandomAltSector") == 0) { pData->curElement = ELEMENT; - pData->curSectorLoadscreens.RandomAltSector = (BOOLEAN) atol(pData->szCharData); + pData->curSectorLoadscreens.RandomAltSector = (BOOLEAN) atol(pData->szCharData); } else if(strcmp(name, "szImageFormat") == 0) { @@ -190,7 +155,7 @@ sectorLoadscreensEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "szDay") == 0) { pData->curElement = ELEMENT; - + if(MAX_IMAGE_PATH_CHARS >= strlen(pData->szCharData)) strcpy(pData->curSectorLoadscreens.szDay,pData->szCharData); else @@ -209,7 +174,7 @@ sectorLoadscreensEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "szNight") == 0) { pData->curElement = ELEMENT; - + if(MAX_IMAGE_PATH_CHARS >= strlen(pData->szCharData)) strcpy(pData->curSectorLoadscreens.szNight,pData->szCharData); else @@ -228,7 +193,7 @@ sectorLoadscreensEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "szDayAlt") == 0) { pData->curElement = ELEMENT; - + if(MAX_IMAGE_PATH_CHARS >= strlen(pData->szCharData)) strcpy(pData->curSectorLoadscreens.szDayAlt,pData->szCharData); else @@ -247,7 +212,7 @@ sectorLoadscreensEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "szNightAlt") == 0) { pData->curElement = ELEMENT; - + if(MAX_IMAGE_PATH_CHARS >= strlen(pData->szCharData)) strcpy(pData->curSectorLoadscreens.szNightAlt,pData->szCharData); else @@ -280,7 +245,7 @@ BOOLEAN ReadInSectorLoadscreensStats(SECTOR_LOADSCREENS *pSectorLoadscreens, STR UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + sectorLoadscreensParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading SectorLoadscreens.xml" ); @@ -289,7 +254,7 @@ BOOLEAN ReadInSectorLoadscreensStats(SECTOR_LOADSCREENS *pSectorLoadscreens, STR hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -304,19 +269,19 @@ BOOLEAN ReadInSectorLoadscreensStats(SECTOR_LOADSCREENS *pSectorLoadscreens, STR FileClose( hFile ); - + XML_SetElementHandler(parser, sectorLoadscreensStartElementHandle, sectorLoadscreensEndElementHandle); XML_SetCharacterDataHandler(parser, sectorLoadscreensCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); pData.curArray = pSectorLoadscreens; - pData.maxArraySize = MAX_SECTOR_LOADSCREENS; - + pData.maxArraySize = MAX_SECTOR_LOADSCREENS; + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -345,7 +310,7 @@ BOOLEAN WriteSectorLoadscreensStats(SECTOR_LOADSCREENS *pSectorLoadscreens, STR hFile = FileOpen( fileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -371,4 +336,4 @@ BOOLEAN WriteSectorLoadscreensStats(SECTOR_LOADSCREENS *pSectorLoadscreens, STR FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_Sounds.cpp b/Tactical/XML_Sounds.cpp index 817444d8..445b1817 100644 --- a/Tactical/XML_Sounds.cpp +++ b/Tactical/XML_Sounds.cpp @@ -4,7 +4,6 @@ #include "sgp.h" #include "overhead types.h" #include "Sound Control.h" - #include "Soldier Control.h" #include "overhead.h" #include "Event Pump.h" #include "weapons.h" @@ -49,15 +48,15 @@ struct PARSE_STAGE curElement; CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; - + UINT32 maxArraySize; - UINT32 curIndex; + UINT32 curIndex; UINT32 currentDepth; UINT32 maxReadDepth; } typedef soundParseData; -static void XMLCALL +static void XMLCALL soundStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { soundParseData * pData = (soundParseData *)userData; @@ -90,9 +89,9 @@ soundCharacterDataHandle(void *userData, const XML_Char *str, int len) { soundParseData * pData = (soundParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); } } @@ -140,7 +139,7 @@ BOOLEAN ReadInSoundArray(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + soundParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("Loading %s",SOUNDSFILENAME ) ); @@ -149,7 +148,7 @@ BOOLEAN ReadInSoundArray(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -164,19 +163,19 @@ BOOLEAN ReadInSoundArray(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, soundStartElementHandle, soundEndElementHandle); XML_SetCharacterDataHandler(parser, soundCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); - pData.maxArraySize = MAX_SAMPLES; + pData.maxArraySize = MAX_SAMPLES; pData.curIndex = -1; XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -203,7 +202,7 @@ BOOLEAN WriteSoundArray() hFile = FileOpen( "TABLEDATA\\Sounds out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -212,13 +211,13 @@ BOOLEAN WriteSoundArray() { FilePrintf(hFile,"\t"); - STR8 szRemainder = szSoundEffects[cnt]; //the remaining string to be output (for making valid XML) + STR8 szRemainder = szSoundEffects[cnt]; //the remaining string to be output (for making valid XML) while(szRemainder[0] != '\0') { UINT32 uiCharLoc = strcspn(szRemainder,"&<>\'\"\0"); char invChar = szRemainder[uiCharLoc]; - + if(uiCharLoc) { szRemainder[uiCharLoc] = '\0'; @@ -268,3 +267,4 @@ BOOLEAN WriteSoundArray() return( TRUE ); } + diff --git a/Tactical/XML_TonyInventory.cpp b/Tactical/XML_TonyInventory.cpp index 70cad70f..c438e560 100644 --- a/Tactical/XML_TonyInventory.cpp +++ b/Tactical/XML_TonyInventory.cpp @@ -2,44 +2,8 @@ #include "Tactical All.h" #else #include "sgp.h" - #include "overhead types.h" - #include "Sound Control.h" - #include "Soldier Control.h" #include "overhead.h" - #include "Event Pump.h" #include "weapons.h" - #include "Animation Control.h" - #include "sys globals.h" - #include "Handle UI.h" - #include "Isometric Utils.h" - #include "worldman.h" - #include "math.h" - #include "points.h" - #include "ai.h" - #include "los.h" - #include "renderworld.h" - #include "opplist.h" - #include "interface.h" - #include "message.h" - #include "campaign.h" - #include "items.h" - #include "weapons.h" - #include "text.h" - #include "Soldier Profile.h" - #include "tile animation.h" - #include "Dialogue Control.h" - #include "SkillCheck.h" - #include "explosion control.h" - #include "Quests.h" - #include "Physics.h" - #include "Random.h" - #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" - #include "meanwhile.h" - #include "SkillCheck.h" - #include "gamesettings.h" - #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" @@ -53,13 +17,13 @@ struct DEALER_POSSIBLE_INV curInventory; DEALER_POSSIBLE_INV * curArray; UINT32 maxArraySize; - + UINT32 currentDepth; UINT32 maxReadDepth; } typedef inventoryParseData; -static void XMLCALL +static void XMLCALL inventoryStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { inventoryParseData * pData = (inventoryParseData *)userData; @@ -104,11 +68,11 @@ inventoryCharacterDataHandle(void *userData, const XML_Char *str, int len) { inventoryParseData * pData = (inventoryParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); - } + } } @@ -135,12 +99,12 @@ inventoryEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "uiIndex") == 0) { pData->curElement = ELEMENT; - pData->curInventory.uiIndex = (UINT32) atol(pData->szCharData); + pData->curInventory.uiIndex = (UINT32) atol(pData->szCharData); } else if(strcmp(name, "sItemIndex") == 0) { pData->curElement = ELEMENT; - pData->curInventory.sItemIndex = (INT16) atol(pData->szCharData); + pData->curInventory.sItemIndex = (INT16) atol(pData->szCharData); } else if(strcmp(name, "ubOptimalNumber") == 0) { @@ -164,7 +128,7 @@ BOOLEAN ReadInInventoryStats(DEALER_POSSIBLE_INV *pInv, STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + inventoryParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading Inventory.xml" ); @@ -173,7 +137,7 @@ BOOLEAN ReadInInventoryStats(DEALER_POSSIBLE_INV *pInv, STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -188,19 +152,19 @@ BOOLEAN ReadInInventoryStats(DEALER_POSSIBLE_INV *pInv, STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, inventoryStartElementHandle, inventoryEndElementHandle); XML_SetCharacterDataHandler(parser, inventoryCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); pData.curArray = pInv; - pData.maxArraySize = MAXITEMS; - + pData.maxArraySize = MAXITEMS; + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -229,7 +193,7 @@ BOOLEAN WriteInventoryStats(DEALER_POSSIBLE_INV *pInv, STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -240,8 +204,8 @@ BOOLEAN WriteInventoryStats(DEALER_POSSIBLE_INV *pInv, STR fileName) FilePrintf(hFile,"\t\r\n"); FilePrintf(hFile,"\t\t%d\r\n", cnt ); - FilePrintf(hFile,"\t\t%d\r\n", pInv[cnt].sItemIndex ); - FilePrintf(hFile,"\t\t%d\r\n", pInv[cnt].ubOptimalNumber ); + FilePrintf(hFile,"\t\t%d\r\n", pInv[cnt].sItemIndex ); + FilePrintf(hFile,"\t\t%d\r\n", pInv[cnt].ubOptimalNumber ); FilePrintf(hFile,"\t\r\n"); } @@ -250,4 +214,4 @@ BOOLEAN WriteInventoryStats(DEALER_POSSIBLE_INV *pInv, STR fileName) FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/bullets.cpp b/Tactical/bullets.cpp index f003c7bb..29d96572 100644 --- a/Tactical/bullets.cpp +++ b/Tactical/bullets.cpp @@ -37,7 +37,7 @@ // GLOBAL FOR FACES LISTING BULLET gBullets[ NUM_BULLET_SLOTS ]; -UINT32 guiNumBullets = 0; +UINT32 guiNumBullets = 0; BOOLEAN fTracer = FALSE; @@ -103,7 +103,7 @@ INT32 CreateBullet( UINT8 ubFirerID, BOOLEAN fFake, UINT16 usFlags,UINT16 fromIt pBullet->fReal = TRUE; // gBullets[ iBullet ].pFirer->bBulletsLeft++; gTacticalStatus.ubAttackBusyCount++; - DebugAttackBusy( String( "Creating a new bullet for %d. ABC now %d\n", ubFirerID, gTacticalStatus.ubAttackBusyCount) ); + DebugAttackBusy( String( "Creating a new bullet for %d. ABC now %d\n", ubFirerID, gTacticalStatus.ubAttackBusyCount) ); } return( iBulletIndex ); @@ -142,7 +142,7 @@ void HandleBulletSpecialFlags( INT32 iBulletIndex ) else if ( pBullet->usFlags & ( BULLET_FLAG_KNIFE ) ) { strcpy( AniParams.zCachedFile, "TILECACHE\\KNIFING.STI" ); - pBullet->ubItemStatus = pBullet->pFirer->inv[ HANDPOS ].ItemData.Generic.bStatus[0]; + pBullet->ubItemStatus = pBullet->pFirer->inv[ HANDPOS ][0]->data.objectStatus; } // Get direction to use for this guy.... @@ -159,7 +159,7 @@ void HandleBulletSpecialFlags( INT32 iBulletIndex ) if ( pBullet->usFlags & ( BULLET_FLAG_KNIFE ) ) { AniParams.ubLevelID = ANI_SHADOW_LEVEL; - AniParams.sZ = 0; + AniParams.sZ = 0; pBullet->pShadowAniTile = CreateAnimationTile( &AniParams ); } @@ -173,7 +173,7 @@ void RemoveBullet( INT32 iBullet ) CHECKV( iBullet < NUM_BULLET_SLOTS ); // decrease soldier's bullet count - + if (gBullets[ iBullet ].fReal) { // set to be deleted at next update @@ -182,7 +182,7 @@ void RemoveBullet( INT32 iBullet ) // decrement reference to bullet in the firer // gBullets[ iBullet ].pFirer->bBulletsLeft--; // DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("!!!!!!! Ending bullet, bullets left %d", gBullets[ iBullet ].pFirer->bBulletsLeft ) ); -// DebugAttackBusy( String( "Deleting a bullet for %d. Total count now %d\n", gBullets[ iBullet].ubFirerID, gBullets[ iBullet ].pFirer->bBulletsLeft) ); +// DebugAttackBusy( String( "Deleting a bullet for %d. Total count now %d\n", gBullets[ iBullet].ubFirerID, gBullets[ iBullet ].pFirer->bBulletsLeft) ); // Nah, just decrement the attack busy count and be done with it DebugAttackBusy( String( "Deleting a bullet for %d.\n", gBullets[ iBullet].ubFirerID ) ); ReduceAttackBusyCount( ); @@ -219,24 +219,24 @@ void LocateBullet( INT32 iBulletIndex ) { if ( gGameSettings.fOptions[ TOPTION_SHOW_MISSES ] ) { - // Check if a bad guy fired! - if ( gBullets[ iBulletIndex ].ubFirerID != NOBODY ) - { - if ( MercPtrs[ gBullets[ iBulletIndex ].ubFirerID ]->bSide == gbPlayerNum ) - { - if ( !gBullets[ iBulletIndex ].fLocated ) - { - gBullets[ iBulletIndex ].fLocated = TRUE; + // Check if a bad guy fired! + if ( gBullets[ iBulletIndex ].ubFirerID != NOBODY ) + { + if ( MercPtrs[ gBullets[ iBulletIndex ].ubFirerID ]->bSide == gbPlayerNum ) + { + if ( !gBullets[ iBulletIndex ].fLocated ) + { + gBullets[ iBulletIndex ].fLocated = TRUE; - //Only if we are in turnbased and noncombat - if ( gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT) ) - { - LocateGridNo( (INT16)gBullets[ iBulletIndex ].sGridNo ); - } - } - } - } - } + //Only if we are in turnbased and noncombat + if ( gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT) ) + { + LocateGridNo( (INT16)gBullets[ iBulletIndex ].sGridNo ); + } + } + } + } + } } @@ -299,7 +299,7 @@ void UpdateBullets( ) { gBullets[ uiCount ].pAniTile->sRelativeX = (INT16) FIXEDPT_TO_INT32( gBullets[ uiCount ].qCurrX ); gBullets[ uiCount ].pAniTile->sRelativeY = (INT16) FIXEDPT_TO_INT32( gBullets[ uiCount ].qCurrY ); - gBullets[ uiCount ].pAniTile->pLevelNode->sRelativeZ = (INT16) CONVERT_HEIGHTUNITS_TO_PIXELS( FIXEDPT_TO_INT32( gBullets[ uiCount ].qCurrZ ) ); + gBullets[ uiCount ].pAniTile->pLevelNode->sRelativeZ = (INT16) CONVERT_HEIGHTUNITS_TO_PIXELS( FIXEDPT_TO_INT32( gBullets[ uiCount ].qCurrZ ) ); if ( gBullets[ uiCount ].usFlags & ( BULLET_FLAG_KNIFE ) ) { @@ -346,14 +346,14 @@ void UpdateBullets( ) } } } - else + else { if ( gBullets[ uiCount ].fToDelete ) { gBullets[ uiCount ].fAllocated = FALSE; fDeletedSome = TRUE; } - } + } } } @@ -454,7 +454,7 @@ void AddMissileTrail( BULLET *pBullet, FIXEDPT qCurrX, FIXEDPT qCurrY, FIXEDPT q 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->pathing.bLevel > 0 ) // if firer on roof then { if ( FindBuilding(AniParams.sGridNo) != NULL ) // if this spot is still within the building's grid area { @@ -539,7 +539,7 @@ BOOLEAN LoadBulletStructureFromSavedGameFile( HWFILE hFile ) return( FALSE ); } - //Set some parameters + //Set some parameters gBullets[usCnt].uiLastUpdate = 0; if( gBullets[usCnt].ubFirerID != NOBODY ) gBullets[usCnt].pFirer = &Menptr[ gBullets[usCnt].ubFirerID ]; diff --git a/Tactical/faces.h b/Tactical/faces.h index a1c2e4ac..d62e0375 100644 --- a/Tactical/faces.h +++ b/Tactical/faces.h @@ -1,9 +1,9 @@ #ifndef __TALKING_H_ #define __TALKING_H_ -#define NO_EXPRESSION 0 +#define NO_EXPRESSION 0 #define BLINKING 1 #define ANGRY 2 -#define SURPRISED 3 +#define SURPRISED 3 #include "soldier control.h" @@ -17,28 +17,28 @@ struct audio_gap struct audio_gap *pNext; }; -#define FACE_AUTO_DISPLAY_BUFFER 0xFFFFF000 -#define FACE_AUTO_RESTORE_BUFFER 0xFFFFFF00 -#define FACE_NO_RESTORE_BUFFER 0xFFFFFFF0 +#define FACE_AUTO_DISPLAY_BUFFER 0xFFFFF000 +#define FACE_AUTO_RESTORE_BUFFER 0xFFFFFF00 +#define FACE_NO_RESTORE_BUFFER 0xFFFFFFF0 // FLAGS.... -#define FACE_DESTROY_OVERLAY 0x00000000 // A face may contain a video overlay -#define FACE_BIGFACE 0x00000001 // A BIGFACE instead of small face -#define FACE_POTENTIAL_KEYWAIT 0x00000002 // If the option is set, will not stop face until key pressed -#define FACE_PCTRIGGER_NPC 0x00000004 // This face has to trigger an NPC after being done -#define FACE_INACTIVE_HANDLED_ELSEWHERE 0x00000008 // This face has been setup and any disable should be done +#define FACE_DESTROY_OVERLAY 0x00000000 // A face may contain a video overlay +#define FACE_BIGFACE 0x00000001 // A BIGFACE instead of small face +#define FACE_POTENTIAL_KEYWAIT 0x00000002 // If the option is set, will not stop face until key pressed +#define FACE_PCTRIGGER_NPC 0x00000004 // This face has to trigger an NPC after being done +#define FACE_INACTIVE_HANDLED_ELSEWHERE 0x00000008 // This face has been setup and any disable should be done // Externally -#define FACE_TRIGGER_PREBATTLE_INT 0x00000010 -#define FACE_SHOW_WHITE_HILIGHT 0x00000020 // Show highlight around face -#define FACE_FORCE_SMALL 0x00000040 // force to small face -#define FACE_MODAL 0x00000080 // make game modal -#define FACE_MAKEACTIVE_ONCE_DONE 0x00000100 -#define FACE_SHOW_MOVING_HILIGHT 0x00000200 -#define FACE_REDRAW_WHOLE_FACE_NEXT_FRAME 0x00000400 // Redraw the complete face next frame +#define FACE_TRIGGER_PREBATTLE_INT 0x00000010 +#define FACE_SHOW_WHITE_HILIGHT 0x00000020 // Show highlight around face +#define FACE_FORCE_SMALL 0x00000040 // force to small face +#define FACE_MODAL 0x00000080 // make game modal +#define FACE_MAKEACTIVE_ONCE_DONE 0x00000100 +#define FACE_SHOW_MOVING_HILIGHT 0x00000200 +#define FACE_REDRAW_WHOLE_FACE_NEXT_FRAME 0x00000400 // Redraw the complete face next frame -#define FACE_DRAW_TEXT_OVER 2 -#define FACE_ERASE_TEXT_OVER 1 -#define FACE_NO_TEXT_OVER 0 +#define FACE_DRAW_TEXT_OVER 2 +#define FACE_ERASE_TEXT_OVER 1 +#define FACE_NO_TEXT_OVER 0 // duration for talking @@ -48,15 +48,15 @@ typedef struct audio_gap AUDIO_GAP; typedef struct { - // This is a structure that will contain data about the gaps in a particular + // This is a structure that will contain data about the gaps in a particular // wave file - UINT32 size; /* the number of entries in the list of AUDIO_GAPs itself*/ - UINT32 current_time; - // Pointer to head and current entry of gap list + UINT32 size; /* the number of entries in the list of AUDIO_GAPs itself*/ + UINT32 current_time; + // Pointer to head and current entry of gap list AUDIO_GAP *pHead; AUDIO_GAP *pCurrent; - + BOOLEAN audio_gap_active; } AudioGapList; @@ -86,8 +86,8 @@ typedef struct UINT8 ubSoldierID; // SoldierID if one specified UINT8 ubCharacterNum; // Profile ID num - UINT16 usFaceX; // X location to render face - UINT16 usFaceY; // Y location to render face + UINT16 usFaceX; // X location to render face + UINT16 usFaceY; // Y location to render face UINT16 usFaceWidth; UINT16 usFaceHeight; UINT32 uiAutoDisplayBuffer; // Display buffer for face @@ -113,11 +113,11 @@ typedef struct UINT16 usMouthOffsetY; UINT16 usMouthWidth; UINT16 usMouthHeight; - - UINT16 sEyeFrame; + + UINT16 sEyeFrame; INT8 ubEyeWait; - UINT32 uiEyelast; - UINT32 uiEyeDelay; + UINT32 uiEyelast; + UINT32 uiEyeDelay; UINT32 uiBlinkFrequency; UINT32 uiExpressionFrequency; UINT32 uiStopOverlayTimer; @@ -134,13 +134,13 @@ typedef struct BOOLEAN fOldShowMoveHilight; UINT16 sMouthFrame; - UINT32 uiMouthlast; - UINT32 uiMouthDelay; + UINT32 uiMouthlast; + UINT32 uiMouthDelay; UINT32 uiLastBlink; UINT32 uiLastExpression; - UINT32 uiVideoObject; + UINT32 uiVideoObject; UINT32 uiUserData1; UINT32 uiUserData2; diff --git a/Tactical/fov.cpp b/Tactical/fov.cpp index 5cb0ed6b..3c52fa2c 100644 --- a/Tactical/fov.cpp +++ b/Tactical/fov.cpp @@ -30,12 +30,12 @@ #endif /* view directions */ -#define DLEFT 0 -#define DRIGHT 1 -#define UP 2 -#define LEFT 3 -#define RIGHT 4 -#define NOVIEW 5 +#define DLEFT 0 +#define DRIGHT 1 +#define UP 2 +#define LEFT 3 +#define RIGHT 4 +#define NOVIEW 5 #define MAXVIEWPATHS 17 #define VIEWPATHLENGTH 13 @@ -51,7 +51,7 @@ UINT8 gubFOVDebugInfoInfo[ WORLD_MAX ]; #endif -UINT8 ViewPath[MAXVIEWPATHS][VIEWPATHLENGTH] ={ +UINT8 ViewPath[MAXVIEWPATHS][VIEWPATHLENGTH] ={ {NOVIEW,UP,UP,UP,UP,UP,UP,UP,UP, UP, UP, UP, UP}, {UP,UP,UP,UP,DRIGHT,UP,UP,UP,UP, UP, UP, UP, UP}, {UP,UP,UP,UP,DLEFT,UP,UP,UP,UP, UP, UP, UP, UP}, @@ -71,15 +71,15 @@ UINT8 ViewPath[MAXVIEWPATHS][VIEWPATHLENGTH] ={ {RIGHT,DRIGHT,DRIGHT,DRIGHT,DRIGHT,DRIGHT,UP,UP,UP, UP, UP, UP, UP}, {LEFT,DLEFT,DLEFT,DLEFT,DLEFT,DLEFT,UP,UP,UP, UP, UP, UP, UP}, - {DLEFT,LEFT,LEFT,UP,NOVIEW,NOVIEW,NOVIEW,NOVIEW,NOVIEW, NOVIEW, NOVIEW, NOVIEW, NOVIEW}, + {DLEFT,LEFT,LEFT,UP,NOVIEW,NOVIEW,NOVIEW,NOVIEW,NOVIEW, NOVIEW, NOVIEW, NOVIEW, NOVIEW}, {LEFT,LEFT,LEFT,UP,LEFT,NOVIEW,NOVIEW,NOVIEW,NOVIEW, NOVIEW, NOVIEW, NOVIEW, NOVIEW}, {DRIGHT,RIGHT,RIGHT,UP,NOVIEW,NOVIEW,NOVIEW,NOVIEW,NOVIEW,NOVIEW, NOVIEW, NOVIEW, NOVIEW}, - {RIGHT,RIGHT,RIGHT,UP,RIGHT,NOVIEW,NOVIEW,NOVIEW,NOVIEW, NOVIEW, NOVIEW, NOVIEW, NOVIEW} + {RIGHT,RIGHT,RIGHT,UP,RIGHT,NOVIEW,NOVIEW,NOVIEW,NOVIEW, NOVIEW, NOVIEW, NOVIEW, NOVIEW} }; -UINT8 ViewPath2[MAXVIEWPATHS][VIEWPATHLENGTH]= { +UINT8 ViewPath2[MAXVIEWPATHS][VIEWPATHLENGTH]= { {NOVIEW,UP,UP,UP,UP,UP,UP,NOVIEW,NOVIEW, NOVIEW, NOVIEW, NOVIEW, NOVIEW}, {UP,UP,DLEFT,UP,UP,UP,DLEFT,DRIGHT,NOVIEW, NOVIEW, NOVIEW, NOVIEW, NOVIEW}, {UP,UP,DLEFT,UP,UP,UP,DRIGHT,DLEFT,NOVIEW, NOVIEW, NOVIEW, NOVIEW, NOVIEW}, @@ -115,57 +115,57 @@ void BuildSightDir(UINT32 dir, UINT32 *One, UINT32 *Two, UINT32 *Three, UINT32 * { switch(dir) { - case NORTH : *One = NORTHWEST; - *Two = NORTHEAST; - *Three = NORTH; - *Four = WEST; - *Five = EAST; - break; - case NORTHEAST: *One = NORTH; - *Two = EAST; - *Three = NORTHEAST; - *Four = NORTHWEST; - *Five = SOUTHEAST; - break; - case EAST : *One = NORTHEAST; - *Two = SOUTHEAST; - *Three = EAST; - *Four = NORTH; - *Five = SOUTH; - break; - case SOUTHEAST: *One = EAST; - *Two = SOUTH; - *Three = SOUTHEAST; - *Four = NORTHEAST; - *Five = SOUTHWEST; - break; - case SOUTH : *One = SOUTHEAST; - *Two = SOUTHWEST; - *Three = SOUTH; - *Four = EAST; - *Five = WEST; - break; - case SOUTHWEST: *One = SOUTH; - *Two = WEST; - *Three = SOUTHWEST; - *Four = SOUTHEAST; - *Five = NORTHWEST; - break; - case WEST : *One = SOUTHWEST; - *Two = NORTHWEST; - *Three = WEST; - *Four = SOUTH; - *Five = NORTH; - break; - case NORTHWEST: *One = WEST; - *Two = NORTH; - *Three = NORTHWEST; - *Four = SOUTHWEST; - *Five = NORTHEAST; - break; + case NORTH : *One = NORTHWEST; + *Two = NORTHEAST; + *Three = NORTH; + *Four = WEST; + *Five = EAST; + break; + case NORTHEAST: *One = NORTH; + *Two = EAST; + *Three = NORTHEAST; + *Four = NORTHWEST; + *Five = SOUTHEAST; + break; + case EAST : *One = NORTHEAST; + *Two = SOUTHEAST; + *Three = EAST; + *Four = NORTH; + *Five = SOUTH; + break; + case SOUTHEAST: *One = EAST; + *Two = SOUTH; + *Three = SOUTHEAST; + *Four = NORTHEAST; + *Five = SOUTHWEST; + break; + case SOUTH : *One = SOUTHEAST; + *Two = SOUTHWEST; + *Three = SOUTH; + *Four = EAST; + *Five = WEST; + break; + case SOUTHWEST: *One = SOUTH; + *Two = WEST; + *Three = SOUTHWEST; + *Four = SOUTHEAST; + *Five = NORTHWEST; + break; + case WEST : *One = SOUTHWEST; + *Two = NORTHWEST; + *Three = WEST; + *Four = SOUTH; + *Five = NORTH; + break; + case NORTHWEST: *One = WEST; + *Two = NORTH; + *Three = NORTHWEST; + *Four = SOUTHWEST; + *Five = NORTHEAST; + break; #ifdef BETAVERSION - default: - NumMessage("BuildSightDir: Invalid 'dir' value, = ",dir); + default: + NumMessage("BuildSightDir: Invalid 'dir' value, = ",dir); #endif } } @@ -242,7 +242,7 @@ BOOLEAN FindSlantRoofSlot( INT16 sGridNo ) if ( gSlantRoofData[uiCount].sGridNo == sGridNo ) { return( TRUE ); - } + } } } @@ -293,7 +293,7 @@ void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLo INT32 Inc[6],Dir[6]; INT8 itemVisible = FALSE; INT8 Blocking,twoMoreTiles,markerDir; - INT8 nextDir=0,AlreadySawItem=FALSE; + INT8 nextDir=0; UINT8 who; //,itemIndex; // for each square checked UINT8 dir,range,Path2; UINT8 ubRoomNo; @@ -311,24 +311,24 @@ void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLo INT8 bTallestStructureHeight; INT32 iDoorGridNo; STRUCTURE * pStructure, *pDummy; - INT8 bStructHeight; - INT8 bThroughWindowDirection; + INT8 bStructHeight; + INT8 bThroughWindowDirection; - if ( pSoldier->uiStatusFlags & SOLDIER_ENEMY ) - { - //pSoldier->needToLookForItems = FALSE; - return; - } + if ( pSoldier->flags.uiStatusFlags & SOLDIER_ENEMY ) + { + //pSoldier->needToLookForItems = FALSE; + return; + } - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { return; } // Return if this guy has no gridno, has bad life, etc - if( pSoldier->sGridNo == NOWHERE || !pSoldier->bInSector || pSoldier->bLife < OKLIFE ) + if( pSoldier->sGridNo == NOWHERE || !pSoldier->bInSector || pSoldier->stats.bLife < OKLIFE ) { - return; + return; } if (pSoldier->bBlindedCounter > 0) @@ -351,39 +351,39 @@ void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLo MercLooksForDoors( pSoldier, TRUE ); - who = pSoldier->ubID; - dir = pSoldier->ubDirection; + who = pSoldier->ubID; + dir = pSoldier->ubDirection; //NumMessage("good old reveal",dir); - // a gassed merc can only see 1 tile away due to blurred vision - if ( pSoldier->uiStatusFlags & SOLDIER_GASSED ) + // a gassed merc can only see 1 tile away due to blurred vision + if ( pSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) { range = 1; } - else + else { - range = pSoldier->bViewRange; + range = pSoldier->bViewRange; // balance item viewing range between normal and the limit set by opplist-type functions -- CJC - range = (AdjustMaxSightRangeForEnvEffects( pSoldier, LightTrueLevel( pSoldier->sGridNo, pSoldier->bLevel), range ) + range) / 2; + range = (AdjustMaxSightRangeForEnvEffects( pSoldier, LightTrueLevel( pSoldier->sGridNo, pSoldier->pathing.bLevel), range ) + range) / 2; } - BuildSightDir(dir,(UINT32 *)&Dir[0],(UINT32 *)&Dir[1],(UINT32 *)&Dir[2],(UINT32 *)&Dir[3],(UINT32 *)&Dir[4]); - - for (cnt = 0; cnt < 5; cnt++) - Inc[cnt] = DirectionInc( (UINT8) Dir[cnt]); + BuildSightDir(dir,(UINT32 *)&Dir[0],(UINT32 *)&Dir[1],(UINT32 *)&Dir[2],(UINT32 *)&Dir[3],(UINT32 *)&Dir[4]); - // create gridno increment for NOVIEW - in other words, no increment! - Inc[5] = 0; - Dir[5] = pSoldier->ubDirection; + for (cnt = 0; cnt < 5; cnt++) + Inc[cnt] = DirectionInc( (UINT8) Dir[cnt]); + + // create gridno increment for NOVIEW - in other words, no increment! + Inc[5] = 0; + Dir[5] = pSoldier->ubDirection; + + if (dir % 2 == 1) /* even numbers use ViewPath2 */ + Path2 = TRUE; + else + Path2 = FALSE; - if (dir % 2 == 1) /* even numbers use ViewPath2 */ - Path2 = TRUE; - else - Path2 = FALSE; - // ATE: if in this special cercumstance... our guys are moving on their own... // Stop sighting items // IN the future, we may want to do something else here... @@ -393,170 +393,170 @@ void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLo itemsToo = FALSE; } - for (maincnt = 0; maincnt < MAXVIEWPATHS; maincnt++) - { - marker = pSoldier->sGridNo; - Blocking = FALSE; - twoMoreTiles = FALSE; - tilesLeftToSee = 99; - fRevealItems = TRUE; - fStopRevealingItemsAfterThisTile = FALSE; + for (maincnt = 0; maincnt < MAXVIEWPATHS; maincnt++) + { + marker = pSoldier->sGridNo; + Blocking = FALSE; + twoMoreTiles = FALSE; + tilesLeftToSee = 99; + fRevealItems = TRUE; + fStopRevealingItemsAfterThisTile = FALSE; #ifdef _DEBUG - if ( _KeyDown( NUM_LOCK ) ) - { - memset( gubFOVDebugInfoInfo, 0, sizeof( gubFOVDebugInfoInfo ) ); + if ( _KeyDown( NUM_LOCK ) ) + { + memset( gubFOVDebugInfoInfo, 0, sizeof( gubFOVDebugInfoInfo ) ); - SetRenderFlags( RENDER_FLAG_FULL ); - RenderWorld( ); - } + SetRenderFlags( RENDER_FLAG_FULL ); + RenderWorld( ); + } #endif - for (markercnt = 0; markercnt < range; markercnt++) - { + for (markercnt = 0; markercnt < range; markercnt++) + { - //fGoneThroughDoor = FALSE; - //fThroughWindow = FALSE; + //fGoneThroughDoor = FALSE; + //fThroughWindow = FALSE; - prevmarker = marker; + prevmarker = marker; - nextDir = 99; - fCheckForRooms = FALSE; - fTravelCostObs = FALSE; - if ( fStopRevealingItemsAfterThisTile ) - { - fRevealItems = FALSE; - fStopRevealingItemsAfterThisTile = FALSE; - } + nextDir = 99; + fCheckForRooms = FALSE; + fTravelCostObs = FALSE; + if ( fStopRevealingItemsAfterThisTile ) + { + fRevealItems = FALSE; + fStopRevealingItemsAfterThisTile = FALSE; + } - if (Path2) - { + if (Path2) + { markerDir = ViewPath2[maincnt][markercnt]; if (markercnt < 12) - nextDir = ViewPath2[maincnt][markercnt+1]; - } - else - { + nextDir = ViewPath2[maincnt][markercnt+1]; + } + else + { markerDir = ViewPath[maincnt][markercnt]; if (markercnt < 12) - nextDir = ViewPath[maincnt][markercnt+1]; - } + nextDir = ViewPath[maincnt][markercnt+1]; + } - // OK, check flags for going through door/window last tile - if ( fThroughWindow == 1 ) - { - // ATE: Make sure we are going through the same direction! - // THis is to solve the drassen SAM problem with seeing through walls - if ( Dir[markerDir] == bThroughWindowDirection) - { - fThroughWindow = 2; - } - else - { - fThroughWindow = 0; - } - } - else if ( fThroughWindow == 2 ) - { - // We've overstayed our welcome - remove! + // OK, check flags for going through door/window last tile + if ( fThroughWindow == 1 ) + { + // ATE: Make sure we are going through the same direction! + // THis is to solve the drassen SAM problem with seeing through walls + if ( Dir[markerDir] == bThroughWindowDirection) + { + fThroughWindow = 2; + } + else + { fThroughWindow = 0; - } - - - if ( fGoneThroughDoor == 1 ) - { - fGoneThroughDoor = 2; - } - else if ( fGoneThroughDoor == 2 ) - { + } + } + else if ( fThroughWindow == 2 ) + { // We've overstayed our welcome - remove! - fGoneThroughDoor = 0; - } + fThroughWindow = 0; + } + + + if ( fGoneThroughDoor == 1 ) + { + fGoneThroughDoor = 2; + } + else if ( fGoneThroughDoor == 2 ) + { + // We've overstayed our welcome - remove! + fGoneThroughDoor = 0; + } - //ATE CHECK FOR NOVIEW! - if ( nextDir == NOVIEW ) - { - nextDir = 99; - } + //ATE CHECK FOR NOVIEW! + if ( nextDir == NOVIEW ) + { + nextDir = 99; + } - marker = NewGridNo((INT16)marker,(INT16)Inc[markerDir]); + marker = NewGridNo((INT16)marker,(INT16)Inc[markerDir]); if ( marker == 12426 ) { int i = 0; } - // End if this is a no view... - if ( markerDir == NOVIEW && markercnt != 0 ) - { - break; - } + // End if this is a no view... + if ( markerDir == NOVIEW && markercnt != 0 ) + { + break; + } #ifdef _DEBUG - if ( _KeyDown( NUM_LOCK ) ) - { - int cnt = GetJA2Clock( ); + if ( _KeyDown( NUM_LOCK ) ) + { + int cnt = GetJA2Clock( ); - gubFOVDebugInfoInfo[ marker ] = (UINT8)markercnt; + gubFOVDebugInfoInfo[ marker ] = (UINT8)markercnt; - StartFrameBufferRender(); + StartFrameBufferRender(); - RenderFOVDebug( ); + RenderFOVDebug( ); - SetFont( LARGEFONT1 ); - SetFontBackground( FONT_MCOLOR_BLACK ); - SetFontForeground( FONT_MCOLOR_WHITE ); - mprintf( 10, 10 , L"%d", maincnt ); - //mprintf( 10, 20 , L"%d", marker ); - //mprintf( 50, 20 , L"%d", pSoldier->sGridNo ); + SetFont( LARGEFONT1 ); + SetFontBackground( FONT_MCOLOR_BLACK ); + SetFontForeground( FONT_MCOLOR_WHITE ); + mprintf( 10, 10 , L"%d", maincnt ); + //mprintf( 10, 20 , L"%d", marker ); + //mprintf( 50, 20 , L"%d", pSoldier->sGridNo ); - InvalidateScreen( ); - EndFrameBufferRender(); - RefreshScreen( NULL ); + InvalidateScreen( ); + EndFrameBufferRender(); + RefreshScreen( NULL ); - do - { + do + { - } while( ( GetJA2Clock( ) - cnt ) < 250 ); - - } + } while( ( GetJA2Clock( ) - cnt ) < 250 ); + + } #endif - // Check if we can get to this gridno from our direction in - ubMovementCost = gubWorldMovementCosts[ marker ][ Dir[ markerDir ] ][ ubLevel ]; + // Check if we can get to this gridno from our direction in + ubMovementCost = gubWorldMovementCosts[ marker ][ Dir[ markerDir ] ][ ubLevel ]; - // ATE: Added: If our current sector is below ground, ignore any blocks! - if ( gfCaves && ubMovementCost != TRAVELCOST_CAVEWALL ) - { - ubMovementCost = TRAVELCOST_FLAT; - } + // ATE: Added: If our current sector is below ground, ignore any blocks! + if ( gfCaves && ubMovementCost != TRAVELCOST_CAVEWALL ) + { + ubMovementCost = TRAVELCOST_FLAT; + } - if ( IS_TRAVELCOST_DOOR( ubMovementCost ) ) - { - ubMovementCost = DoorTravelCost( pSoldier, marker, ubMovementCost, (BOOLEAN) (pSoldier->bTeam == gbPlayerNum), &iDoorGridNo ); - pStructure = FindStructure( (INT16) iDoorGridNo, STRUCTURE_ANYDOOR ); - if ( pStructure != NULL && pStructure->fFlags & STRUCTURE_TRANSPARENT) - { + if ( IS_TRAVELCOST_DOOR( ubMovementCost ) ) + { + ubMovementCost = DoorTravelCost( pSoldier, marker, ubMovementCost, (BOOLEAN) (pSoldier->bTeam == gbPlayerNum), &iDoorGridNo ); + pStructure = FindStructure( (INT16) iDoorGridNo, STRUCTURE_ANYDOOR ); + if ( pStructure != NULL && pStructure->fFlags & STRUCTURE_TRANSPARENT) + { // cell door or somehow otherwise transparent; allow merc to see through ubMovementCost = TRAVELCOST_FLAT; - } - } + } + } - // If we have hit an obstacle, STOP HERE - if ( ubMovementCost >= TRAVELCOST_BLOCKED ) - { + // If we have hit an obstacle, STOP HERE + if ( ubMovementCost >= TRAVELCOST_BLOCKED ) + { // We have an obstacle here... // If it is bigger than a breadbox... err... taller than a man... // Then stop path altogether - // otherwise just stop revealing items - - // CJC: only do this when the direction is horizontal; easier and faster to check + // otherwise just stop revealing items + + // CJC: only do this when the direction is horizontal; easier and faster to check // and the effect should still be good enough if ( ubMovementCost == TRAVELCOST_WALL || ubMovementCost == TRAVELCOST_DOOR || ubMovementCost == TRAVELCOST_EXITGRID ) @@ -572,7 +572,7 @@ void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLo { fTravelCostObs = TRUE; fStopRevealingItemsAfterThisTile = TRUE; - } + } else if ( bTallestStructureHeight != 0 ) { // stop revealing items after this tile but keep going @@ -593,14 +593,14 @@ void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLo fRevealItems = FALSE; } else - { + { bTallestStructureHeight = GetTallestStructureHeight( (INT16) marker, FALSE ); if (bTallestStructureHeight >= 3) { fTravelCostObs = TRUE; fStopRevealingItemsAfterThisTile = TRUE; - } + } else if ( bTallestStructureHeight != 0 ) { // stop revealing items after this tile but keep going @@ -608,102 +608,102 @@ void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLo } } - } + } - // Check if it's been done already! - if ( gubGridNoMarkers[ marker ] != gubGridNoValue ) - { + // Check if it's been done already! + if ( gubGridNoMarkers[ marker ] != gubGridNoValue ) + { + + // Mark gridno + gubGridNoMarkers[ marker ] = gubGridNoValue; + + // check and see if the gridno changed + // if the gridno is the same, avoid redundancy and break + if (marker==prevmarker && markercnt != 0 ) + { + + } + else // it changed + { - // Mark gridno - gubGridNoMarkers[ marker ] = gubGridNoValue; - - // check and see if the gridno changed - // if the gridno is the same, avoid redundancy and break - if (marker==prevmarker && markercnt != 0 ) - { - - } - else // it changed - { - // Skip others if we have gone through a door but are too far away.... if ( fGoneThroughDoor ) { - if (markercnt > 5 ) // Are we near the door? + if (markercnt > 5 ) // Are we near the door? { break; } - } - // DO MINE FINDING STUFF - // GET INDEX FOR ITEM HERE - // if there IS a direction after this one, nextdir WILL NOT be 99 - if (nextDir != 99) - { + } + // DO MINE FINDING STUFF + // GET INDEX FOR ITEM HERE + // if there IS a direction after this one, nextdir WILL NOT be 99 + if (nextDir != 99) + { Blocking = GetBlockingStructureInfo( (INT16)marker, (INT8)Dir[ markerDir ], (INT8)Dir[ nextDir ], ubLevel, &bStructHeight, &pDummy, FALSE ); - } - else // no "next" direction, so pass in a NOWHERE so that - // "SpecialViewObstruction" will know not to take it UINT32o consideration - { - Blocking = GetBlockingStructureInfo( (INT16)marker, (INT8)Dir[markerDir], (INT8)30, ubLevel, &bStructHeight, &pDummy, FALSE ); - } + } + else // no "next" direction, so pass in a NOWHERE so that + // "SpecialViewObstruction" will know not to take it UINT32o consideration + { + Blocking = GetBlockingStructureInfo( (INT16)marker, (INT8)Dir[markerDir], (INT8)30, ubLevel, &bStructHeight, &pDummy, FALSE ); + } - if ( gfCaves ) - { - Blocking = NOTHING_BLOCKING; - } + if ( gfCaves ) + { + Blocking = NOTHING_BLOCKING; + } - // CHECK FOR ROOMS - if ( Blocking == BLOCKING_TOPLEFT_WINDOW || Blocking == BLOCKING_TOPLEFT_OPEN_WINDOW ) - { + // CHECK FOR ROOMS + if ( Blocking == BLOCKING_TOPLEFT_WINDOW || Blocking == BLOCKING_TOPLEFT_OPEN_WINDOW ) + { // CHECK FACING DIRECTION! if ( Dir[markerDir] == NORTH || Dir[markerDir] == SOUTH ) { - if (markercnt <= 1 ) // Are we right beside it? + if (markercnt <= 1 ) // Are we right beside it? { fThroughWindow = TRUE; - bThroughWindowDirection = ( INT8 ) Dir[ markerDir ]; + bThroughWindowDirection = ( INT8 ) Dir[ markerDir ]; } } - } - if ( Blocking == BLOCKING_TOPRIGHT_WINDOW || Blocking == BLOCKING_TOPRIGHT_OPEN_WINDOW ) - { + } + if ( Blocking == BLOCKING_TOPRIGHT_WINDOW || Blocking == BLOCKING_TOPRIGHT_OPEN_WINDOW ) + { // CHECK FACING DIRECTION! if ( Dir[markerDir] == EAST || Dir[markerDir] == WEST ) { - if (markercnt <= 1 ) // Are we right beside it? + if (markercnt <= 1 ) // Are we right beside it? { fThroughWindow = TRUE; - bThroughWindowDirection = ( INT8 ) Dir[ markerDir ]; + bThroughWindowDirection = ( INT8 ) Dir[ markerDir ]; } } - } + } - if ( Blocking == BLOCKING_TOPLEFT_DOOR ) - { + if ( Blocking == BLOCKING_TOPLEFT_DOOR ) + { fGoneThroughDoor = TRUE; - } - if ( Blocking == BLOCKING_TOPRIGHT_DOOR ) - { + } + if ( Blocking == BLOCKING_TOPRIGHT_DOOR ) + { fGoneThroughDoor = TRUE; - } + } - // ATE: If we hit this tile, find item always! - //if (Blocking < FULL_BLOCKING ) - { + // ATE: If we hit this tile, find item always! + //if (Blocking < FULL_BLOCKING ) + { // Handle special things for our mercs, like uncovering roofs // and revealing objects... //gpSoldier->shad |= SEENBIT; - //itemVisible = ObjList[itemIndex].visible; + //itemVisible = ObjList[itemIndex].visible; - // NOTE: don't allow object viewing if gassed XXX + // NOTE: don't allow object viewing if gassed XXX - if (itemsToo && fRevealItems ) // && itemIndex < MAXOBJECTLIST) - { - // OK, look for corpses... - LookForAndMayCommentOnSeeingCorpse( pSoldier, (INT16)marker, ubLevel ); + if (itemsToo && fRevealItems ) // && itemIndex < MAXOBJECTLIST) + { + // OK, look for corpses... + LookForAndMayCommentOnSeeingCorpse( pSoldier, (INT16)marker, ubLevel ); if ( GetItemPool( (INT16)marker, &pItemPool, ubLevel ) ) { @@ -726,13 +726,13 @@ void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLo // ATE: Only if in combat... if ( gTacticalStatus.uiFlags & INCOMBAT ) { - HaultSoldierFromSighting( pSoldier, FALSE ); + pSoldier->HaultSoldierFromSighting( FALSE ); } - else - { - // ATE: Make sure we show locators... - gTacticalStatus.fLockItemLocators = FALSE; - } + else + { + // ATE: Make sure we show locators... + gTacticalStatus.fLockItemLocators = FALSE; + } if ( !fItemsQuoteSaid && gTacticalStatus.fLockItemLocators == FALSE ) { @@ -742,22 +742,22 @@ void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLo { gTacticalStatus.fItemsSeenOnAttack = TRUE; gTacticalStatus.ubItemsSeenOnAttackSoldier = pSoldier->ubID; - gTacticalStatus.usItemsSeenOnAttackGridNo = (INT16)(marker); + gTacticalStatus.sItemsSeenOnAttackGridNo = (INT16)(marker); } else { // Display quote! - if ( !AM_AN_EPC( pSoldier ) ) - { - TacticalCharacterDialogueWithSpecialEvent( pSoldier, (UINT16)( QUOTE_SPOTTED_SOMETHING_ONE + Random( 2 ) ), DIALOGUE_SPECIAL_EVENT_SIGNAL_ITEM_LOCATOR_START, (INT16)(marker), 0 ); - } - else - { - // Turn off item lock for locators... - gTacticalStatus.fLockItemLocators = FALSE; - // Slide to location! - SlideToLocation( 0, (INT16)(marker) ); - } + if ( !AM_AN_EPC( pSoldier ) ) + { + TacticalCharacterDialogueWithSpecialEvent( pSoldier, (UINT16)( QUOTE_SPOTTED_SOMETHING_ONE + Random( 2 ) ), DIALOGUE_SPECIAL_EVENT_SIGNAL_ITEM_LOCATOR_START, (INT16)(marker), 0 ); + } + else + { + // Turn off item lock for locators... + gTacticalStatus.fLockItemLocators = FALSE; + // Slide to location! + SlideToLocation( 0, (INT16)(marker) ); + } } fItemsQuoteSaid = TRUE; } @@ -766,27 +766,27 @@ void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLo } } - } + } - // if blood here, let the user see it now... - //if (ExtGrid[marker].patrolInfo < MAXBLOOD) - // gpSoldier->blood = ExtGrid[marker].patrolInfo; + // if blood here, let the user see it now... + //if (ExtGrid[marker].patrolInfo < MAXBLOOD) + // gpSoldier->blood = ExtGrid[marker].patrolInfo; - //DoRoofs(marker,gpSoldier); + //DoRoofs(marker,gpSoldier); - tilesLeftToSee--; + tilesLeftToSee--; } - // CHECK FOR HIDDEN STRUCTS - // IF we had a hidden struct here that is not visible ( which will still be true because - // we set it revealed below... - if ( DoesGridnoContainHiddenStruct( (UINT16)marker, &fHiddenStructVisible ) ) + // CHECK FOR HIDDEN STRUCTS + // IF we had a hidden struct here that is not visible ( which will still be true because + // we set it revealed below... + if ( DoesGridnoContainHiddenStruct( (INT16)marker, &fHiddenStructVisible ) ) { if ( !fHiddenStructVisible ) { gpWorldLevelData[marker].uiFlags|=MAPELEMENT_REDRAW; SetRenderFlags(RENDER_FLAG_MARKED); - RecompileLocalMovementCosts( (UINT16)marker ); + RecompileLocalMovementCosts( (INT16)marker ); } } @@ -826,7 +826,7 @@ void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLo } - // Set gridno as revealed + // Set gridno as revealed if ( ubLevel == FIRST_LEVEL ) { if ( gfBasement || gfCaves ) @@ -857,51 +857,51 @@ void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLo { if ( InAHiddenRoom( (INT16)marker, &ubRoomNo ) ) { - RemoveRoomRoof( (INT16)marker, ubRoomNo, pSoldier ); - if ( ubRoomNo == ROOM_SURROUNDING_BOXING_RING && gWorldSectorX == BOXING_SECTOR_X && gWorldSectorY == BOXING_SECTOR_Y && gbWorldSectorZ == BOXING_SECTOR_Z ) - { + RemoveRoomRoof( (INT16)marker, ubRoomNo, pSoldier ); + if ( ubRoomNo == ROOM_SURROUNDING_BOXING_RING && gWorldSectorX == BOXING_SECTOR_X && gWorldSectorY == BOXING_SECTOR_Y && gbWorldSectorZ == BOXING_SECTOR_Z ) + { // reveal boxing ring at same time RemoveRoomRoof( (INT16)marker, BOXING_RING, pSoldier ); - } + } } } } else { - gpWorldLevelData[ marker ].uiFlags |= MAPELEMENT_REVEALED_ROOF; + gpWorldLevelData[ marker ].uiFlags |= MAPELEMENT_REVEALED_ROOF; } // Check for blood.... UpdateBloodGraphics( (INT16)marker, ubLevel ); - if ( Blocking != NOTHING_BLOCKING && Blocking != BLOCKING_TOPLEFT_DOOR && Blocking != BLOCKING_TOPRIGHT_DOOR && Blocking != BLOCKING_TOPLEFT_WINDOW && Blocking != BLOCKING_TOPRIGHT_WINDOW && Blocking != BLOCKING_TOPRIGHT_OPEN_WINDOW && Blocking != BLOCKING_TOPLEFT_OPEN_WINDOW) + if ( Blocking != NOTHING_BLOCKING && Blocking != BLOCKING_TOPLEFT_DOOR && Blocking != BLOCKING_TOPRIGHT_DOOR && Blocking != BLOCKING_TOPLEFT_WINDOW && Blocking != BLOCKING_TOPRIGHT_WINDOW && Blocking != BLOCKING_TOPRIGHT_OPEN_WINDOW && Blocking != BLOCKING_TOPLEFT_OPEN_WINDOW) { - break; + break; } - //gpWorldLevelData[ marker ].uiFlags |= MAPELEMENT_SHADELAND; + //gpWorldLevelData[ marker ].uiFlags |= MAPELEMENT_SHADELAND; } - } // End of duplicate check - else - { + } // End of duplicate check + else + { if ( fTravelCostObs ) { break; } - } + } } // end of one path - } // end of path loop + } // end of path loop // Loop through all availible slant roofs we collected and perform cool stuff on them ExamineSlantRoofFOVSlots( ); - //pSoldier->needToLookForItems = FALSE; + //pSoldier->needToLookForItems = FALSE; //LookForDoors(pSoldier,UNAWARE); } diff --git a/Tactical/interface Dialogue.h b/Tactical/interface Dialogue.h index 2f614538..de4f626e 100644 --- a/Tactical/interface Dialogue.h +++ b/Tactical/interface Dialogue.h @@ -59,7 +59,7 @@ BOOLEAN TalkingMenuDialogue( UINT16 usQuoteNum ); // Removes memory allocated for structure, removes face... -void DeleteTalkingMenu( ); +void DeleteTalkingMenu( ); // Dirty menu void SetTalkingMenuDirty( BOOLEAN fDirtyLevel ); @@ -75,7 +75,7 @@ BOOLEAN TalkingMenuGiveItem( UINT8 ubNPC, OBJECTTYPE *pObject, INT8 bInvPos ); // Triggers an NPC record BOOLEAN NPCTriggerNPC( UINT8 ubTargetNPC, UINT8 ubTargetRecord, UINT8 ubTargetApproach, BOOLEAN fShowDialogueMenu ); // NPC goto gridno -BOOLEAN NPCGotoGridNo( UINT8 ubTargetNPC, UINT16 usGridNo, UINT8 ubQuoteNum ); +BOOLEAN NPCGotoGridNo( UINT8 ubTargetNPC, INT16 sGridNo, UINT8 ubQuoteNum ); // NPC Do action BOOLEAN NPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum ); @@ -87,7 +87,7 @@ void HandleWaitTimerForNPCTrigger( ); void HandleNPCClosePanel( ); void HandleNPCItemGiven( UINT8 ubNPC, OBJECTTYPE *pObject, INT8 bInvPos ); void HandleNPCTriggerNPC( UINT8 ubTargetNPC, UINT8 ubTargetRecord, BOOLEAN fShowDialogueMenu, UINT8 ubTargetApproach ); -void HandleNPCGotoGridNo( UINT8 ubTargetNPC, UINT16 usGridNo, UINT8 ubRecordNum ); +void HandleNPCGotoGridNo( UINT8 ubTargetNPC, INT16 sGridNo, UINT8 ubRecordNum ); void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum ); BOOLEAN ProfileCurrentlyTalkingInDialoguePanel( UINT8 ubProfile ); @@ -235,7 +235,7 @@ enum NPC_ACTION_REDUCE_CONRAD_SALARY_CONDITIONS, NPC_ACTION_REMOVE_CONRAD, NPC_ACTION_KROTT_REQUESTOR, - NPC_ACTION_KROTT_ALIVE_LOYALTY_BOOST, /* Delayed loyalty effects elimininated. Sep.12/98. ARM */ + NPC_ACTION_KROTT_ALIVE_LOYALTY_BOOST, /* Delayed loyalty effects elimininated. Sep.12/98. ARM */ NPC_ACTION_TRIGGER_YANNI, // 185 NPC_ACTION_TRIGGER_MARY_OR_JOHN_RECORD_9, NPC_ACTION_TRIGGER_MARY_OR_JOHN_RECORD_10, @@ -264,7 +264,7 @@ enum NPC_ACTION_CHANGE_MANNY_POSITION = 210, NPC_ACTION_TIMER_FOR_VEHICLE, // 211 NPC_ACTION_ASK_ABOUT_PAYING_RPC_WITH_DAILY_SALARY,//212 - NPC_ACTION_TRIGGER_MICKY_BY_SCI_FI, // 213 + NPC_ACTION_TRIGGER_MICKY_BY_SCI_FI, // 213 // 214 is blank NPC_ACTION_TRIGGER_ELLIOT_BY_BATTLE_RESULT = 215, NPC_ACTION_TRIGGER_ELLIOT_BY_SAM_DISABLED, diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index 6e3decd0..5f6d10a8 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -64,7 +64,7 @@ void OurNoise( UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrType, void TheirNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType ); void ProcessNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubBaseVolume, UINT8 ubNoiseType); UINT8 CalcEffVolume(SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT8 ubNoiseType, UINT8 ubBaseVolume, UINT8 bCheckTerrain, UINT8 ubTerrType1, UINT8 ubTerrType2); -void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 bLevel, UINT8 ubVolume, UINT8 ubNoiseType, UINT8 *ubSeen); +void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubVolume, UINT8 ubNoiseType, UINT8 *ubSeen); void TellPlayerAboutNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubVolume, UINT8 ubNoiseType, UINT8 ubNoiseDir ); void OurTeamSeesSomeone( SOLDIERTYPE * pSoldier, INT8 bNumReRevealed, INT8 bNumNewEnemies ); @@ -83,19 +83,19 @@ void HandleManNoLongerSeen( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOpponent, INT // for ManLooksForMan() -#define MANLOOKSFOROTHERTEAMS 0 -#define OTHERTEAMSLOOKFORMAN 1 -#define VERIFYANDDECAYOPPLIST 2 -#define HANDLESTEPPEDLOOKAT 3 -#define LOOKANDLISTEN 4 +#define MANLOOKSFOROTHERTEAMS 0 +#define OTHERTEAMSLOOKFORMAN 1 +#define VERIFYANDDECAYOPPLIST 2 +#define HANDLESTEPPEDLOOKAT 3 +#define LOOKANDLISTEN 4 #define UPDATEPUBLIC 5 #define CALLER_UNKNOWN 6 // this variable is a flag used in HandleSight to determine whether (while in non-combat RT) // someone has just been seen, EITHER THE MOVER OR SOMEONE THE MOVER SEES BOOLEAN gfPlayerTeamSawCreatures = FALSE; -BOOLEAN gfPlayerTeamSawJoey = FALSE; -BOOLEAN gfMikeShouldSayHi = FALSE; +BOOLEAN gfPlayerTeamSawJoey = FALSE; +BOOLEAN gfMikeShouldSayHi = FALSE; UINT8 gubBestToMakeSighting[BEST_SIGHTING_ARRAY_SIZE]; UINT8 gubBestToMakeSightingSize = 0; @@ -123,31 +123,31 @@ INT8 gbPublicNoiseLevel[MAXTEAMS]; UINT8 gubKnowledgeValue[10][10] = { - // P E R S O N A L O P P L I S T // - // -4 -3 -2 -1 0 1 2 3 4 5 // - { 0, 1, 2, 3, 0, 5, 4, 3, 2, 1}, // -4 - { 0, 0, 1, 2, 0, 4, 3, 2, 1, 0}, // -3 O - { 0, 0, 0, 1, 0, 3, 2, 1, 0, 0}, // -2 P P - { 0, 0, 0, 0, 0, 2, 1, 0, 0, 0}, // -1 U P - { 0, 1, 2, 3, 0, 5, 4, 3, 2, 1}, // 0 B L - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 1 L I - { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, // 2 I S - { 0, 0, 0, 1, 0, 2, 1, 0, 0, 0}, // 3 C T - { 0, 0, 1, 2, 0, 3, 2, 1, 0, 0}, // 4 - { 0, 1, 2, 3, 0, 4, 3, 2, 1, 0} // 5 + // P E R S O N A L O P P L I S T // + // -4 -3 -2 -1 0 1 2 3 4 5 // + { 0, 1, 2, 3, 0, 5, 4, 3, 2, 1}, // -4 + { 0, 0, 1, 2, 0, 4, 3, 2, 1, 0}, // -3 O + { 0, 0, 0, 1, 0, 3, 2, 1, 0, 0}, // -2 P P + { 0, 0, 0, 0, 0, 2, 1, 0, 0, 0}, // -1 U P + { 0, 1, 2, 3, 0, 5, 4, 3, 2, 1}, // 0 B L + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 1 L I + { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, // 2 I S + { 0, 0, 0, 1, 0, 2, 1, 0, 0, 0}, // 3 C T + { 0, 0, 1, 2, 0, 3, 2, 1, 0, 0}, // 4 + { 0, 1, 2, 3, 0, 4, 3, 2, 1, 0} // 5 /* - // P E R S O N A L O P P L I S T // - // -3 -2 -1 0 1 2 3 4 // - { 0, 1, 2, 0, 4, 3, 2, 1 }, // -3 O - { 0, 0, 1, 0, 3, 2, 1, 0 }, // -2 P P - { 0, 0, 0, 0, 2, 1, 0, 0 }, // -1 U P - { 1, 2, 3, 0, 5, 4, 3, 2 }, // 0 B L - { 0, 0, 0, 0, 0, 0, 0, 0 }, // 1 L I - { 0, 0, 0, 0, 1, 0, 0, 0 }, // 2 I S - { 0, 0, 1, 0, 2, 1, 0, 0 }, // 3 C T - { 0, 1, 2, 0, 3, 2, 1, 0 } // 4 - */ + // P E R S O N A L O P P L I S T // + // -3 -2 -1 0 1 2 3 4 // + { 0, 1, 2, 0, 4, 3, 2, 1 }, // -3 O + { 0, 0, 1, 0, 3, 2, 1, 0 }, // -2 P P + { 0, 0, 0, 0, 2, 1, 0, 0 }, // -1 U P + { 1, 2, 3, 0, 5, 4, 3, 2 }, // 0 B L + { 0, 0, 0, 0, 0, 0, 0, 0 }, // 1 L I + { 0, 0, 0, 0, 1, 0, 0, 0 }, // 2 I S + { 0, 0, 1, 0, 2, 1, 0, 0 }, // 3 C T + { 0, 1, 2, 0, 3, 2, 1, 0 } // 4 + */ }; #define MAX_WATCHED_LOC_POINTS 4 @@ -169,15 +169,15 @@ INT8 STRAIGHT; void InitSightRange() { - BEHIND = (INT8)( BEHIND_RATIO * gGameExternalOptions.ubStraightSightRange ); - SBEHIND = (INT8)( SBEHIND_RATIO * gGameExternalOptions.ubStraightSightRange ); - SIDE = (INT8)( SIDE_RATIO * gGameExternalOptions.ubStraightSightRange ); - ANGLE = (INT8)( ANGLE_RATIO * gGameExternalOptions.ubStraightSightRange ); - STRAIGHT = (INT8)( STRAIGHT_RATIO * gGameExternalOptions.ubStraightSightRange ); + BEHIND = (INT8)( BEHIND_RATIO * gGameExternalOptions.ubStraightSightRange ); + SBEHIND = (INT8)( SBEHIND_RATIO * gGameExternalOptions.ubStraightSightRange ); + SIDE = (INT8)( SIDE_RATIO * gGameExternalOptions.ubStraightSightRange ); + ANGLE = (INT8)( ANGLE_RATIO * gGameExternalOptions.ubStraightSightRange ); + STRAIGHT = (INT8)( STRAIGHT_RATIO * gGameExternalOptions.ubStraightSightRange ); INT8 dummy[15][15]; - - + + { //Pulmu: VC6 compatibility for (int i=0; i<8; i++) { @@ -205,27 +205,27 @@ void InitSightRange() gbLookDistance[i][j] = dummy[i][j]; } } - //gbLookDistance[8][8] = + //gbLookDistance[8][8] = //{ - // // LOOKER DIR LOOKEE DIR - // // NORTH | NORTHEAST | EAST | SOUTHEAST | SOUTH | SOUTHWEST | WEST | NORTHWEST - // /* NORTH */ STRAIGHT, ANGLE, SIDE, SBEHIND, BEHIND, SBEHIND, SIDE, ANGLE, - // /* NORTHEAST */ ANGLE, STRAIGHT, ANGLE, SIDE, SBEHIND, BEHIND, SBEHIND, SIDE, - // /* EAST */ SIDE, ANGLE, STRAIGHT, ANGLE, SIDE, SBEHIND, BEHIND, SBEHIND, - // /* SOUTHEAST */ SBEHIND, SIDE, ANGLE, STRAIGHT, ANGLE, SIDE, SBEHIND, BEHIND, - // /* SOUTH */ BEHIND, SBEHIND, SIDE, ANGLE, STRAIGHT, ANGLE, SIDE, SBEHIND, - // /* SOUTHWEST */ SBEHIND, BEHIND, SBEHIND, SIDE, ANGLE, STRAIGHT, ANGLE, SIDE, - // /* WEST */ SIDE, SBEHIND, BEHIND, SBEHIND, SIDE, ANGLE, STRAIGHT, ANGLE, - // /* NORTHWEST */ ANGLE, SIDE, SBEHIND, BEHIND, SBEHIND, SIDE, ANGLE, STRAIGHT + // // LOOKER DIR LOOKEE DIR + // // NORTH | NORTHEAST | EAST | SOUTHEAST | SOUTH | SOUTHWEST | WEST | NORTHWEST + // /* NORTH */ STRAIGHT, ANGLE, SIDE, SBEHIND, BEHIND, SBEHIND, SIDE, ANGLE, + // /* NORTHEAST */ ANGLE, STRAIGHT, ANGLE, SIDE, SBEHIND, BEHIND, SBEHIND, SIDE, + // /* EAST */ SIDE, ANGLE, STRAIGHT, ANGLE, SIDE, SBEHIND, BEHIND, SBEHIND, + // /* SOUTHEAST */ SBEHIND, SIDE, ANGLE, STRAIGHT, ANGLE, SIDE, SBEHIND, BEHIND, + // /* SOUTH */ BEHIND, SBEHIND, SIDE, ANGLE, STRAIGHT, ANGLE, SIDE, SBEHIND, + // /* SOUTHWEST */ SBEHIND, BEHIND, SBEHIND, SIDE, ANGLE, STRAIGHT, ANGLE, SIDE, + // /* WEST */ SIDE, SBEHIND, BEHIND, SBEHIND, SIDE, ANGLE, STRAIGHT, ANGLE, + // /* NORTHWEST */ ANGLE, SIDE, SBEHIND, BEHIND, SBEHIND, SIDE, ANGLE, STRAIGHT // }; } INT8 gbSmellStrength[3] = { - NORMAL_HUMAN_SMELL_STRENGTH, // normal + NORMAL_HUMAN_SMELL_STRENGTH, // normal NORMAL_HUMAN_SMELL_STRENGTH + 2, // slob - NORMAL_HUMAN_SMELL_STRENGTH - 1 // snob + NORMAL_HUMAN_SMELL_STRENGTH - 1 // snob }; @@ -236,70 +236,70 @@ UINT16 gsWhoThrewRock = NOBODY; INT8 gbLightSighting[1][SHADE_MIN+1] = { { // human - 80, // brightest - 86, - 93, + 80, // brightest + 86, + 93, 100, // normal daylight, 3 - 94, - 88, - 82, - 76, - 70, // mid-dawn, 8 - 64, - 58, - 51, - 43, // normal nighttime, 12 (11 tiles) - 30, - 17, - 9 + 94, + 88, + 82, + 76, + 70, // mid-dawn, 8 + 64, + 58, + 51, + 43, // normal nighttime, 12 (11 tiles) + 30, + 17, + 9 } }; /* { { // human - 80, // brightest - 86, - 93, + 80, // brightest + 86, + 93, 100, // normal daylight, 3 - 93, - 86, - 79, - 72, - 65, // mid-dawn, 8 - 58, - 53, - 43, // normal nighttime, 11 (11 tiles) - 35, - 26, - 17, - 9 + 93, + 86, + 79, + 72, + 65, // mid-dawn, 8 + 58, + 53, + 43, // normal nighttime, 11 (11 tiles) + 35, + 26, + 17, + 9 } }; */ UINT8 gubSightFlags = 0; -#define DECAY_OPPLIST_VALUE( value )\ -{\ - if ( (value) >= SEEN_THIS_TURN)\ - {\ - (value)++;\ - if ( (value) > OLDEST_SEEN_VALUE )\ - {\ - (value) = NOT_HEARD_OR_SEEN;\ - }\ - }\ - else\ - {\ - if ( (value) <= HEARD_THIS_TURN)\ - {\ - (value)--;\ - if ( (value) < OLDEST_HEARD_VALUE)\ - {\ - (value) = NOT_HEARD_OR_SEEN;\ - }\ - }\ - }\ +void DECAY_OPPLIST_VALUE( INT8& value ) +{ + if ( (value) >= SEEN_THIS_TURN) + { + (value)++; + if ( (value) > OLDEST_SEEN_VALUE ) + { + (value) = NOT_HEARD_OR_SEEN; + } + } + else + { + if ( (value) <= HEARD_THIS_TURN) + { + (value)--; + if ( (value) < OLDEST_HEARD_VALUE) + { + (value) = NOT_HEARD_OR_SEEN; + } + } + } } @@ -325,7 +325,7 @@ INT16 AdjustMaxSightRangeForEnvEffects( SOLDIERTYPE *pSoldier, INT8 bLightLevel, sNewDist = sNewDist * ( 100 - min( gGameExternalOptions.ubVisDistDecreasePerRainIntensity * gbCurrentRainIntensity, 100) ) / 100; //end rain } - + //rain if( gfLightningInProgress ) sNewDist += sNewDist * ( ubRealAmbientLightLevel ) / 10; // 10% per dark level @@ -354,12 +354,12 @@ void ReevaluateBestSightingPosition( SOLDIERTYPE * pSoldier, INT8 bInterruptDuel return; } - if ( !( pSoldier->uiStatusFlags & SOLDIER_MONSTER ) ) + if ( !( pSoldier->flags.uiStatusFlags & SOLDIER_MONSTER ) ) { //gfHumanSawSomeoneInRealtime = TRUE; } - if ( (pSoldier->bInterruptDuelPts != NO_INTERRUPT) && (bInterruptDuelPts < pSoldier->bInterruptDuelPts) ) + if ( (pSoldier->aiData.bInterruptDuelPts != NO_INTERRUPT) && (bInterruptDuelPts < pSoldier->aiData.bInterruptDuelPts) ) { fPointsGotLower = TRUE; } @@ -376,17 +376,17 @@ void ReevaluateBestSightingPosition( SOLDIERTYPE * pSoldier, INT8 bInterruptDuel } } - // this guy has fewer interrupt pts vs another enemy! reduce position unless in last place + // this guy has fewer interrupt pts vs another enemy! reduce position unless in last place if (fFound) { // set new points DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "RBSP: reducing points for %d to %d", pSoldier->ubID, bInterruptDuelPts ) ); - pSoldier->bInterruptDuelPts = bInterruptDuelPts; + pSoldier->aiData.bInterruptDuelPts = bInterruptDuelPts; - // must percolate him down + // must percolate him down for ( ubLoop2 = ubLoop + 1; ubLoop2 < gubBestToMakeSightingSize; ubLoop2++ ) { - if ( gubBestToMakeSighting[ ubLoop2 ] != NOBODY && MercPtrs[ gubBestToMakeSighting[ ubLoop2 - 1 ] ]->bInterruptDuelPts < MercPtrs[ gubBestToMakeSighting[ ubLoop2 ] ]->bInterruptDuelPts ) + if ( gubBestToMakeSighting[ ubLoop2 ] != NOBODY && MercPtrs[ gubBestToMakeSighting[ ubLoop2 - 1 ] ]->aiData.bInterruptDuelPts < MercPtrs[ gubBestToMakeSighting[ ubLoop2 ] ]->aiData.bInterruptDuelPts ) { SwapBestSightingPositions( (UINT8) (ubLoop2 - 1), ubLoop2 ); } @@ -400,7 +400,7 @@ void ReevaluateBestSightingPosition( SOLDIERTYPE * pSoldier, INT8 bInterruptDuel { // in list but can't be bumped down... set his new points DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "RBSP: reduced points for last individual %d to %d", pSoldier->ubID, bInterruptDuelPts ) ); - pSoldier->bInterruptDuelPts = bInterruptDuelPts; + pSoldier->aiData.bInterruptDuelPts = bInterruptDuelPts; } } else @@ -419,27 +419,27 @@ void ReevaluateBestSightingPosition( SOLDIERTYPE * pSoldier, INT8 bInterruptDuel { for ( ubLoop = 0; ubLoop < gubBestToMakeSightingSize; ubLoop++ ) { - if ( (gubBestToMakeSighting[ ubLoop ] == NOBODY) || (bInterruptDuelPts > MercPtrs[ gubBestToMakeSighting[ ubLoop ] ]->bInterruptDuelPts ) ) + if ( (gubBestToMakeSighting[ ubLoop ] == NOBODY) || (bInterruptDuelPts > MercPtrs[ gubBestToMakeSighting[ ubLoop ] ]->aiData.bInterruptDuelPts ) ) { if ( gubBestToMakeSighting[ gubBestToMakeSightingSize - 1 ] != NOBODY ) { - MercPtrs[ gubBestToMakeSighting[ gubBestToMakeSightingSize - 1 ] ]->bInterruptDuelPts = NO_INTERRUPT; + MercPtrs[ gubBestToMakeSighting[ gubBestToMakeSightingSize - 1 ] ]->aiData.bInterruptDuelPts = NO_INTERRUPT; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "RBSP: resetting points for %d to zilch", pSoldier->ubID ) ); } // set new points DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "RBSP: setting points for %d to %d", pSoldier->ubID, bInterruptDuelPts ) ); - pSoldier->bInterruptDuelPts = bInterruptDuelPts; + pSoldier->aiData.bInterruptDuelPts = bInterruptDuelPts; // insert here! for ( ubLoop2 = gubBestToMakeSightingSize - 1; ubLoop2 > ubLoop; ubLoop2-- ) { gubBestToMakeSighting[ ubLoop2 ] = gubBestToMakeSighting[ ubLoop2 - 1 ]; } - gubBestToMakeSighting[ ubLoop ] = pSoldier->ubID; + gubBestToMakeSighting[ ubLoop ] = pSoldier->ubID; break; } - } + } } // else points didn't get lower, so do nothing (because we want to leave each merc with as low int points as possible) } @@ -448,7 +448,7 @@ void ReevaluateBestSightingPosition( SOLDIERTYPE * pSoldier, INT8 bInterruptDuel { if ( (gubBestToMakeSighting[ ubLoop ] != NOBODY) ) { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "RBSP entry %d: %d (%d pts)", ubLoop, gubBestToMakeSighting[ ubLoop ], MercPtrs[ gubBestToMakeSighting[ ubLoop ] ]->bInterruptDuelPts ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "RBSP entry %d: %d (%d pts)", ubLoop, gubBestToMakeSighting[ ubLoop ], MercPtrs[ gubBestToMakeSighting[ ubLoop ] ]->aiData.bInterruptDuelPts ) ); } } @@ -489,7 +489,7 @@ void HandleBestSightingPositionInRealtime( void ) // if 1st and 2nd on same team, or 1st and 3rd on same team, or there IS no 3rd, award turn to 1st if ( ( MercPtrs[gubBestToMakeSighting[ 0 ]]->bTeam == MercPtrs[gubBestToMakeSighting[ 1 ]]->bTeam ) || ( (gubBestToMakeSighting[ 2 ] == NOBODY) || ( MercPtrs[gubBestToMakeSighting[ 0 ]]->bTeam == MercPtrs[gubBestToMakeSighting[ 2 ]]->bTeam ) ) - ) + ) { EnterCombatMode( MercPtrs[gubBestToMakeSighting[ 0 ]]->bTeam ); } @@ -507,26 +507,26 @@ void HandleBestSightingPositionInRealtime( void ) } } } - + for ( ubLoop = 0; ubLoop < BEST_SIGHTING_ARRAY_SIZE; ubLoop++ ) { if ( gubBestToMakeSighting[ ubLoop ] != NOBODY ) { - MercPtrs[ gubBestToMakeSighting[ ubLoop ]]->bInterruptDuelPts = NO_INTERRUPT; + MercPtrs[ gubBestToMakeSighting[ ubLoop ]]->aiData.bInterruptDuelPts = NO_INTERRUPT; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "RBSP: done, resetting points for %d to zilch", MercPtrs[ gubBestToMakeSighting[ ubLoop ] ]->ubID ) ); } - } + } for ( ubLoop = 0; ubLoop < guiNumMercSlots; ubLoop++ ) { - if ( MercSlots[ ubLoop ] ) + if ( MercSlots[ ubLoop ] ) { - AssertMsg( MercSlots[ ubLoop ]->bInterruptDuelPts == NO_INTERRUPT, String( "%S (%d) still has interrupt pts!", MercSlots[ ubLoop ]->name, MercSlots[ ubLoop ]->ubID ) ); + AssertMsg( MercSlots[ ubLoop ]->aiData.bInterruptDuelPts == NO_INTERRUPT, String( "%S (%d) still has interrupt pts!", MercSlots[ ubLoop ]->name, MercSlots[ ubLoop ]->ubID ) ); } - } + } } - + } void HandleBestSightingPositionInTurnbased( void ) @@ -540,7 +540,7 @@ void HandleBestSightingPositionInTurnbased( void ) { if ( MercPtrs[ gubBestToMakeSighting[ 0 ] ]->bTeam != gTacticalStatus.ubCurrentTeam ) { - + // interrupt! for ( ubLoop = 0; ubLoop < gubBestToMakeSightingSize; ubLoop++ ) { @@ -558,7 +558,7 @@ void HandleBestSightingPositionInTurnbased( void ) fOk = TRUE; break; } - + } else if ( MercPtrs[ gubBestToMakeSighting[ ubLoop ] ]->bTeam == gTacticalStatus.ubCurrentTeam ) { @@ -584,18 +584,18 @@ void HandleBestSightingPositionInTurnbased( void ) { if ( gubBestToMakeSighting[ ubLoop ] != NOBODY ) { - MercPtrs[ gubBestToMakeSighting[ ubLoop ]]->bInterruptDuelPts = NO_INTERRUPT; + MercPtrs[ gubBestToMakeSighting[ ubLoop ]]->aiData.bInterruptDuelPts = NO_INTERRUPT; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "RBSP (TB): done, resetting points for %d to zilch", MercPtrs[ gubBestToMakeSighting[ ubLoop ] ]->ubID ) ); } } for ( ubLoop = 0; ubLoop < guiNumMercSlots; ubLoop++ ) { - if ( MercSlots[ ubLoop ] ) + if ( MercSlots[ ubLoop ] ) { - AssertMsg( MercSlots[ ubLoop ]->bInterruptDuelPts == NO_INTERRUPT, String( "%S (%d) still has interrupt pts!", MercSlots[ ubLoop ]->name, MercSlots[ ubLoop ]->ubID ) ); + AssertMsg( MercSlots[ ubLoop ]->aiData.bInterruptDuelPts == NO_INTERRUPT, String( "%S (%d) still has interrupt pts!", MercSlots[ ubLoop ]->name, MercSlots[ ubLoop ]->ubID ) ); } - } + } } @@ -613,16 +613,16 @@ void InitSightArrays( void ) //gfHumanSawSomeoneInRealtime = FALSE; // It is assumed that once the sight arrays are (re)initialized, the enemies should all have no - // interrupt points. At least a paranoia check in the HandleSightingInRealtime and HandleSightingInTurnBased + // interrupt points. At least a paranoia check in the HandleSightingInRealtime and HandleSightingInTurnBased // both make sure no interrupt points remain after they drain the sighting list. // I do not fully grok the interrupt system, but it IS possible for this function to be called when there are - // still soldiers on the sighting list, which gives them lingering interrupt points. So the best course of - // action is to reset their points. However, I think I'll just do a clean sweep here to make sure I get them all. + // still soldiers on the sighting list, which gives them lingering interrupt points. So the best course of + // action is to reset their points. However, I think I'll just do a clean sweep here to make sure I get them all. for ( uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++ ) { if (MercSlots[ uiLoop ] ) { - MercSlots[ uiLoop ]->bInterruptDuelPts = NO_INTERRUPT; + MercSlots[ uiLoop ]->aiData.bInterruptDuelPts = NO_INTERRUPT; } } } @@ -633,7 +633,7 @@ void AddToShouldBecomeHostileOrSayQuoteList( UINT8 ubID ) Assert( gubNumShouldBecomeHostileOrSayQuote < SHOULD_BECOME_HOSTILE_SIZE ); - if ( MercPtrs[ ubID ]->bLife < OKLIFE ) + if ( MercPtrs[ ubID ]->stats.bLife < OKLIFE ) { return; } @@ -662,7 +662,7 @@ UINT8 SelectSpeakerFromHostileOrSayQuoteList( void ) pSoldier = MercPtrs[ gubShouldBecomeHostileOrSayQuote[ ubLoop ] ]; if ( pSoldier->ubProfile != NO_PROFILE ) { - + // make sure person can say quote!!!! gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags2 |= PROFILE_MISC_FLAG2_NEEDS_TO_SAY_HOSTILE_QUOTE; @@ -710,7 +710,7 @@ void CheckHostileOrSayQuoteList( void ) for ( ubLoop = 0; ubLoop < gubNumShouldBecomeHostileOrSayQuote; ubLoop++ ) { pSoldier = MercPtrs[ gubShouldBecomeHostileOrSayQuote[ ubLoop ] ]; - if ( pSoldier->bNeutral ) + if ( pSoldier->aiData.bNeutral ) { MakeCivHostile( pSoldier, 2 ); // make civ group, if any, hostile @@ -723,7 +723,7 @@ void CheckHostileOrSayQuoteList( void ) // unpause all AI UnPauseAI(); - // reset the list + // reset the list memset( &gubShouldBecomeHostileOrSayQuote, NOBODY, SHOULD_BECOME_HOSTILE_SIZE ); gubNumShouldBecomeHostileOrSayQuote = 0; //and return/go into combat @@ -740,7 +740,7 @@ void CheckHostileOrSayQuoteList( void ) // We want to make this guy visible to the player. if ( MercPtrs[ ubSpeaker ]->bVisible != TRUE ) - { + { gbPublicOpplist[ gbPlayerNum ][ ubSpeaker ] = HEARD_THIS_TURN; HandleSight( MercPtrs[ ubSpeaker ], SIGHT_LOOK | SIGHT_RADIO ); } @@ -756,7 +756,7 @@ void HandleSight(SOLDIERTYPE *pSoldier, UINT8 ubSightFlags) SOLDIERTYPE *pThem; INT8 bTempNewSituation; - if (!pSoldier->bActive || !pSoldier->bInSector || pSoldier->uiStatusFlags & SOLDIER_DEAD ) + if (!pSoldier->bActive || !pSoldier->bInSector || pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) { // I DON'T THINK SO! return; @@ -788,35 +788,35 @@ void HandleSight(SOLDIERTYPE *pSoldier, UINT8 ubSightFlags) gfPlayerTeamSawCreatures = FALSE; // store new situation value - bTempNewSituation = pSoldier->bNewSituation; - pSoldier->bNewSituation = FALSE; + bTempNewSituation = pSoldier->aiData.bNewSituation; + pSoldier->aiData.bNewSituation = FALSE; // if we've been told to make this soldier look (& others look back at him) if (ubSightFlags & SIGHT_LOOK) { // if this soldier's under our control and well enough to look - if (pSoldier->bLife >= OKLIFE ) + if (pSoldier->stats.bLife >= OKLIFE ) { - /* + /* #ifdef RECORDOPPLIST - fprintf(OpplistFile,"ManLooksForOtherTeams (HandleSight/Look) for %d\n",pSoldier->guynum); + fprintf(OpplistFile,"ManLooksForOtherTeams (HandleSight/Look) for %d\n",pSoldier->guynum); #endif */ // he looks for all other soldiers not on his own team ManLooksForOtherTeams(pSoldier); - // if "Show only enemies seen" option is ON and it's this guy looking - //if (pSoldier->ubID == ShowOnlySeenPerson) - //NewShowOnlySeenPerson(pSoldier); // update the string + // if "Show only enemies seen" option is ON and it's this guy looking + //if (pSoldier->ubID == ShowOnlySeenPerson) + //NewShowOnlySeenPerson(pSoldier); // update the string } - /* + /* #ifdef RECORDOPPLIST - fprintf(OpplistFile,"OtherTeamsLookForMan (HandleSight/Look) for %d\n",ptr->guynum); + fprintf(OpplistFile,"OtherTeamsLookForMan (HandleSight/Look) for %d\n",ptr->guynum); #endif - */ + */ // all soldiers under our control but not on ptr's team look for him OtherTeamsLookForMan(pSoldier); @@ -826,23 +826,23 @@ void HandleSight(SOLDIERTYPE *pSoldier, UINT8 ubSightFlags) if ((gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) && (ubSightFlags & SIGHT_INTERRUPT)) { ResolveInterruptsVs( pSoldier, SIGHTINTERRUPT ); - } + } if ( gubBestToMakeSightingSize == BEST_SIGHTING_ARRAY_SIZE_NONCOMBAT ) { HandleBestSightingPositionInRealtime(); } - if ( pSoldier->bNewSituation && !(pSoldier->uiStatusFlags & SOLDIER_PC) ) + if ( pSoldier->aiData.bNewSituation && !(pSoldier->flags.uiStatusFlags & SOLDIER_PC) ) { - HaultSoldierFromSighting( pSoldier, TRUE ); + pSoldier->HaultSoldierFromSighting( TRUE ); } - pSoldier->bNewSituation = __max( pSoldier->bNewSituation, bTempNewSituation ); - + pSoldier->aiData.bNewSituation = __max( pSoldier->aiData.bNewSituation, bTempNewSituation ); + // if we've been told to radio the results if (ubSightFlags & SIGHT_RADIO) { - if (pSoldier->uiStatusFlags & SOLDIER_PC ) + if (pSoldier->flags.uiStatusFlags & SOLDIER_PC ) { // update our team's public knowledge RadioSightings(pSoldier,EVERYBODY, pSoldier->bTeam ); @@ -854,13 +854,13 @@ void HandleSight(SOLDIERTYPE *pSoldier, UINT8 ubSightFlags) // if it's our local player's merc if (PTR_OURTEAM) // revealing roofs and looking for items handled here, too - RevealRoofsAndItems(pSoldier,TRUE, TRUE, pSoldier->bLevel, FALSE ); + RevealRoofsAndItems(pSoldier,TRUE, TRUE, pSoldier->pathing.bLevel, FALSE ); } // unless in easy mode allow alerted enemies to radio else if ( gGameOptions.ubDifficultyLevel >= DIF_LEVEL_MEDIUM ) { // don't allow admins to radio - //Madd: Huh? why not admins? removed. + //Madd: Huh? why not admins? removed. if ( pSoldier->bTeam == ENEMY_TEAM && gTacticalStatus.Team[ ENEMY_TEAM ].bAwareOfOpposition ) //&& pSoldier->ubSoldierClass != SOLDIER_CLASS_ADMINISTRATOR ) { RadioSightings(pSoldier,EVERYBODY, pSoldier->bTeam ); @@ -868,7 +868,7 @@ void HandleSight(SOLDIERTYPE *pSoldier, UINT8 ubSightFlags) } pSoldier->bNewOppCnt = 0; - pSoldier->bNeedToLook = FALSE; + pSoldier->pathing.bNeedToLook = FALSE; // Temporary for opplist synching - disable random order radioing @@ -880,20 +880,20 @@ void HandleSight(SOLDIERTYPE *pSoldier, UINT8 ubSightFlags) // all non-humans under our control would now radio, if they were allowed - // to radio automatically (but they're not). So just nuke new opp cnt + // to radio automatically (but they're not). So just nuke new opp cnt // NEW: under LOCALOPPLIST, humans on other teams now also radio in here for (uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++) { pThem = MercSlots[ uiLoop ]; - if (pThem != NULL && pThem->bLife >= OKLIFE) + if (pThem != NULL && pThem->stats.bLife >= OKLIFE) { // if this merc is on the same team as the target soldier if (pThem->bTeam == pSoldier->bTeam) - continue; // he doesn't look (he ALWAYS knows about him) + continue; // he doesn't look (he ALWAYS knows about him) // other human team's merc report sightings to their teams now - if (pThem->uiStatusFlags & SOLDIER_PC) + if (pThem->flags.uiStatusFlags & SOLDIER_PC) { // Temporary for opplist synching - disable random order radioing #ifdef RECORDOPPLIST @@ -917,7 +917,7 @@ void HandleSight(SOLDIERTYPE *pSoldier, UINT8 ubSightFlags) pThem->bNewOppCnt = 0; - pThem->bNeedToLook = FALSE; + pThem->pathing.bNeedToLook = FALSE; } } } @@ -938,14 +938,14 @@ void OurTeamRadiosRandomlyAbout(UINT8 ubAbout) // Temporary for opplist synching - disable random order radioing #ifdef RECORDOPPLIST for (iLoop = Status.team[Net.pnum].guystart,ourPtr = MercPtrs[iLoop]; iLoop < Status.team[Net.pnum].guyend; iLoop++,ourPtr++) - { - // if this merc is active, in this sector, and well enough to look - if (pSoldier->active && pSoldier->bInSector && (pSoldier->bLife >= OKLIFE)) - { - RadioSightings(pSoldier,ubAbout,pSoldier->bTeam); - pSoldier->bNewOppCnt = 0; - } - } + { + // if this merc is active, in this sector, and well enough to look + if (pSoldier->active && pSoldier->bInSector && (pSoldier->stats.bLife >= OKLIFE)) + { + RadioSightings(pSoldier,ubAbout,pSoldier->bTeam); + pSoldier->bNewOppCnt = 0; + } + } return; #endif @@ -956,35 +956,35 @@ void OurTeamRadiosRandomlyAbout(UINT8 ubAbout) // make a list of all of our team's mercs for (pSoldier = MercPtrs[iLoop]; iLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; iLoop++,pSoldier++) - { - // if this merc is active, in this sector, and well enough to look - if (pSoldier->bActive && pSoldier->bInSector && (pSoldier->bLife >= OKLIFE)) - // put him on our list, and increment the counter - radioMan[radioCnt++] = (INT8)iLoop; - } + { + // if this merc is active, in this sector, and well enough to look + if (pSoldier->bActive && pSoldier->bInSector && (pSoldier->stats.bLife >= OKLIFE)) + // put him on our list, and increment the counter + radioMan[radioCnt++] = (INT8)iLoop; + } // now RANDOMLY handle each of the mercs on our list, until none remain // (this is all being done ONLY so that the mercs in the earliest merc - // slots do not arbitrarily get the bulk of the sighting speech quote - // action, while the later ones almost never pipe up, and is NOT - // strictly necessary, but a nice improvement over original JA) + // slots do not arbitrarily get the bulk of the sighting speech quote + // action, while the later ones almost never pipe up, and is NOT + // strictly necessary, but a nice improvement over original JA) while (radioCnt) - { - // pick a merc from one of the remaining slots at random - iLoop = Random(radioCnt); + { + // pick a merc from one of the remaining slots at random + iLoop = Random(radioCnt); - // handle radioing for that merc - RadioSightings(MercPtrs[radioMan[iLoop]],ubAbout,MercPtrs[radioMan[iLoop]]->bTeam); - Menptr[radioMan[iLoop]].bNewOppCnt = 0; + // handle radioing for that merc + RadioSightings(MercPtrs[radioMan[iLoop]],ubAbout,MercPtrs[radioMan[iLoop]]->bTeam); + Menptr[radioMan[iLoop]].bNewOppCnt = 0; - // unless it WAS the last used slot that we happened to pick - if (iLoop != (radioCnt - 1)) - // move the contents of the last slot into the one just handled - radioMan[iLoop] = radioMan[radioCnt - 1]; + // unless it WAS the last used slot that we happened to pick + if (iLoop != (radioCnt - 1)) + // move the contents of the last slot into the one just handled + radioMan[iLoop] = radioMan[radioCnt - 1]; - radioCnt--; - } + radioCnt--; + } } @@ -998,31 +998,31 @@ void OurTeamRadiosRandomlyAbout(UINT8 ubAbout) INT16 TeamNoLongerSeesMan( UINT8 ubTeam, SOLDIERTYPE *pOpponent, UINT8 ubExcludeID, INT8 bIteration ) { - UINT16 bLoop; - SOLDIERTYPE *pMate; + UINT16 bLoop; + SOLDIERTYPE *pMate; - bLoop = gTacticalStatus.Team[ubTeam].bFirstID; + bLoop = gTacticalStatus.Team[ubTeam].bFirstID; // look for all mercs on the same team, check opplists for this soldier - for (pMate = MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[ubTeam].bLastID; bLoop++,pMate++) - { - // if this "teammate" is me, myself, or I (whom we want to exclude) - if (bLoop == ubExcludeID) - continue; // skip to next teammate, I KNOW I don't see him... + for (pMate = MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[ubTeam].bLastID; bLoop++,pMate++) + { + // if this "teammate" is me, myself, or I (whom we want to exclude) + if (bLoop == ubExcludeID) + continue; // skip to next teammate, I KNOW I don't see him... - // if this merc is not on the same team - if (pMate->bTeam != ubTeam) - continue; // skip him, he's no teammate at all! + // if this merc is not on the same team + if (pMate->bTeam != ubTeam) + continue; // skip him, he's no teammate at all! - // if this merc is not active, at base, on assignment, dead, unconscious - if (!pMate->bActive || !pMate->bInSector || (pMate->bLife < OKLIFE)) - continue; // next merc + // if this merc is not active, at base, on assignment, dead, unconscious + if (!pMate->bActive || !pMate->bInSector || (pMate->stats.bLife < OKLIFE)) + continue; // next merc - // if this teammate currently sees this opponent - if (pMate->bOppList[pOpponent->ubID] == SEEN_CURRENTLY) - return(FALSE); // that's all I need to know, get out of here - } + // if this teammate currently sees this opponent + if (pMate->aiData.bOppList[pOpponent->ubID] == SEEN_CURRENTLY) + return(FALSE); // that's all I need to know, get out of here + } #ifdef WE_SEE_WHAT_MILITIA_SEES_AND_VICE_VERSA if ( bIteration == 0 ) @@ -1060,14 +1060,14 @@ INT16 DistanceSmellable( SOLDIERTYPE *pSoldier, SOLDIERTYPE * pSubject ) if (pSubject) { - if (pSubject->uiStatusFlags & SOLDIER_MONSTER) + if (pSubject->flags.uiStatusFlags & SOLDIER_MONSTER) { // trying to smell a friend; change nothing } else { // smelling a human or animal; if they are coated with monster smell, distance shrinks - sDistVisible = sDistVisible * (pSubject->bNormalSmell - pSubject->bMonsterSmell) / NORMAL_HUMAN_SMELL_STRENGTH; + sDistVisible = sDistVisible * (pSubject->aiData.bNormalSmell - pSubject->aiData.bMonsterSmell) / NORMAL_HUMAN_SMELL_STRENGTH; if (sDistVisible < 0) { sDistVisible = 0; @@ -1088,14 +1088,14 @@ INT16 SOLDIERTYPE::GetMaxDistanceVisible(INT16 sGridNo, INT8 bLevel, int calcAsT return MaxNormalDistanceVisible(); } if (bLevel == -1) { - bLevel = this->bLevel; + bLevel = this->pathing.bLevel; } if (calcAsType == CALC_FROM_ALL_DIRS) { return DistanceVisible( this, DIRECTION_IRRELEVANT, DIRECTION_IRRELEVANT, sGridNo, bLevel ); } else { - return DistanceVisible( this, (SoldierHasLimitedVision(this) ? this->bDesiredDirection : DIRECTION_IRRELEVANT), DIRECTION_IRRELEVANT, sGridNo, bLevel ); + return DistanceVisible( this, (SoldierHasLimitedVision(this) ? this->pathing.bDesiredDirection : DIRECTION_IRRELEVANT), DIRECTION_IRRELEVANT, sGridNo, bLevel ); } } @@ -1108,9 +1108,9 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir, pSubject = SimpleFindSoldier( sSubjectGridNo, bLevel ); - if (pSoldier->uiStatusFlags & SOLDIER_MONSTER) + if (pSoldier->flags.uiStatusFlags & SOLDIER_MONSTER) { - if ( !pSubject ) + if ( !pSubject ) { return( FALSE ); } @@ -1126,12 +1126,12 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir, if ( bFacingDir == DIRECTION_IRRELEVANT && TANK( pSoldier ) ) { // always calculate direction for tanks so we have something to work with - bFacingDir = pSoldier->bDesiredDirection; + bFacingDir = pSoldier->pathing.bDesiredDirection; bSubjectDir = (INT8) GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, sSubjectGridNo ); //bSubjectDir = atan8(pSoldier->sX,pSoldier->sY,pOpponent->sX,pOpponent->sY); } - if ( !TANK( pSoldier ) && ( bFacingDir == DIRECTION_IRRELEVANT || (pSoldier->uiStatusFlags & SOLDIER_ROBOT) || (pSubject && pSubject->fMuzzleFlash) ) ) + if ( !TANK( pSoldier ) && ( bFacingDir == DIRECTION_IRRELEVANT || (pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT) || (pSubject && pSubject->flags.fMuzzleFlash) ) ) { sDistVisible = MaxNormalDistanceVisible(); } @@ -1145,7 +1145,7 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir, } else { - // Lesh: added this + // Lesh: added this if( SoldierHasLimitedVision(pSoldier) ) { bSubjectDir = (INT8) GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, sSubjectGridNo ); @@ -1156,15 +1156,15 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir, sDistVisible = gbLookDistance[bFacingDir][bSubjectDir]; - // Lesh: and this - if ( (sDistVisible == 0) && (SoldierHasLimitedVision(pSoldier)) ) - return(0); + // Lesh: and this + if ( (sDistVisible == 0) && (SoldierHasLimitedVision(pSoldier)) ) + return(0); if ( sDistVisible != STRAIGHT ) { INT16 tunnelVisionInPercent = GetPercentTunnelVision(pSoldier); - - if ( tunnelVisionInPercent > 0) + + if ( tunnelVisionInPercent > 0) { sideViewLimit = TRUE; sDistVisible = sDistVisible * (100 - tunnelVisionInPercent ) / 100 ; @@ -1173,7 +1173,7 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir, // ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"sDistVisible: %d", GetPercentTunnelVision(pSoldier) ); - if ( sDistVisible == ANGLE && (pSoldier->bTeam == OUR_TEAM || pSoldier->bAlertStatus >= STATUS_RED ) ) + if ( sDistVisible == ANGLE && (pSoldier->bTeam == OUR_TEAM || pSoldier->aiData.bAlertStatus >= STATUS_RED ) ) { sDistVisible = STRAIGHT; } @@ -1191,7 +1191,7 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir, } } - if (pSoldier->bLevel != bLevel) + if (pSoldier->pathing.bLevel != bLevel) { // add two tiles distance to visibility to/from roofs // sDistVisible += (STRAIGHT_RATIO * 2); //2; @@ -1201,7 +1201,7 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir, // now reduce based on light level; SHADE_MIN is the define for the // highest number the light can be - // If we're about to ask for a light level for a location outside of our + // If we're about to ask for a light level for a location outside of our // valid map references then use the ambient light level instead. if(0 > sSubjectGridNo || sSubjectGridNo > WORLD_MAX) { @@ -1217,8 +1217,8 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir, // Snap: I think this was intended to give maximum visibility to targets with muzzle flash... // Corrected accordingly: - //if ( pSubject && !( pSubject->fMuzzleFlash && (bLightLevel > NORMAL_LIGHTLEVEL_DAY) ) ) - if ( !( pSubject && pSubject->fMuzzleFlash && (bLightLevel > NORMAL_LIGHTLEVEL_DAY) ) ) + //if ( pSubject && !( pSubject->flags.fMuzzleFlash && (bLightLevel > NORMAL_LIGHTLEVEL_DAY) ) ) + if ( !( pSubject && pSubject->flags.fMuzzleFlash && (bLightLevel > NORMAL_LIGHTLEVEL_DAY) ) ) { // ATE: Made function to adjust light distance... sDistVisible = AdjustMaxSightRangeForEnvEffects( pSoldier, bLightLevel, sDistVisible ); @@ -1243,7 +1243,7 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir, { sDistVisible += NightBonusScale( UVGOGGLES_BONUS, bLightLevel); } - else if ( AM_A_ROBOT( pSoldier ) ) + else if ( AM_A_ROBOT( pSoldier ) ) { sDistVisible += NightBonusScale( NIGHTSIGHTGOGGLES_BONUS, bLightLevel); } @@ -1254,7 +1254,7 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir, #if 0 if ( TANK(pSoldier) && sDistVisible > 0 && pSubject) { - sDistVisible = __max( sDistVisible + 5, pSubject->GetMaxDistanceVisible(pSoldier->sGridNo, pSoldier->bLevel) ); + sDistVisible = __max( sDistVisible + 5, pSubject->GetMaxDistanceVisible(pSoldier->sGridNo, pSoldier->pathing.bLevel) ); } else { sDistVisible = __max( sDistVisible + 5, pSoldier->GetMaxDistanceVisible() ); @@ -1293,7 +1293,7 @@ void EndMuzzleFlash( SOLDIERTYPE * pSoldier ) UINT32 uiLoop; SOLDIERTYPE * pOtherSoldier; - pSoldier->fMuzzleFlash = FALSE; + pSoldier->flags.fMuzzleFlash = FALSE; #ifdef WE_SEE_WHAT_MILITIA_SEES_AND_VICE_VERSA if ( pSoldier->bTeam != gbPlayerNum && pSoldier->bTeam != MILITIA_TEAM ) @@ -1310,14 +1310,14 @@ void EndMuzzleFlash( SOLDIERTYPE * pSoldier ) if ( pOtherSoldier != NULL ) { - if ( pOtherSoldier->bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY ) + if ( pOtherSoldier->aiData.bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY ) { if ( pOtherSoldier->sGridNo != NOWHERE ) - { - if ( PythSpacesAway( pOtherSoldier->sGridNo, pSoldier->sGridNo ) > pOtherSoldier->GetMaxDistanceVisible(pSoldier->sGridNo, pSoldier->bLevel, CALC_FROM_WANTED_DIR ) ) + { + if ( PythSpacesAway( pOtherSoldier->sGridNo, pSoldier->sGridNo ) > pOtherSoldier->GetMaxDistanceVisible(pSoldier->sGridNo, pSoldier->pathing.bLevel, CALC_FROM_WANTED_DIR ) ) { // if this guy can no longer see us, change to seen this turn - HandleManNoLongerSeen( pOtherSoldier, pSoldier, &(pOtherSoldier->bOppList[ pSoldier->ubID ]), &(gbPublicOpplist[ pOtherSoldier->bTeam ][ pSoldier->ubID ] ) ); + HandleManNoLongerSeen( pOtherSoldier, pSoldier, &(pOtherSoldier->aiData.bOppList[ pSoldier->ubID ]), &(gbPublicOpplist[ pOtherSoldier->bTeam ][ pSoldier->ubID ] ) ); } // else this person is still seen, if the looker is on our side or the militia the person should stay visible @@ -1347,7 +1347,7 @@ void TurnOffEveryonesMuzzleFlashes( void ) { pSoldier = MercSlots[ uiLoop ]; - if ( pSoldier != NULL && pSoldier->fMuzzleFlash ) + if ( pSoldier != NULL && pSoldier->flags.fMuzzleFlash ) { EndMuzzleFlash( pSoldier ); } @@ -1363,7 +1363,7 @@ void TurnOffTeamsMuzzleFlashes( UINT8 ubTeam ) { pSoldier = MercPtrs[ ubLoop ]; - if ( pSoldier->fMuzzleFlash ) + if ( pSoldier->flags.fMuzzleFlash ) { EndMuzzleFlash( pSoldier ); } @@ -1381,14 +1381,14 @@ INT8 DecideHearing( SOLDIERTYPE * pSoldier ) { return( -5 ); } - else if ( pSoldier->uiStatusFlags & SOLDIER_MONSTER ) + else if ( pSoldier->flags.uiStatusFlags & SOLDIER_MONSTER ) { return( -10 ); } bHearing = 0; - if (pSoldier->bExpLevel > 3) + if (pSoldier->stats.bExpLevel > 3) { bHearing++; } @@ -1405,10 +1405,10 @@ INT8 DecideHearing( SOLDIERTYPE * pSoldier ) if ( bSlot != -1 ) { // at 81-100% adds +5, at 61-80% adds +4, at 41-60% adds +3, etc. - bHearing += GetHearingRangeBonus(pSoldier); // pSoldier->inv[bSlot].bStatus[0] / 20 + 1; + bHearing += GetHearingRangeBonus(pSoldier); // pSoldier->inv[bSlot][0]->data.objectStatus / 20 + 1; } - // adjust for dark conditions + // adjust for dark conditions switch ( ubAmbientLightLevel ) { case 8: @@ -1418,7 +1418,7 @@ INT8 DecideHearing( SOLDIERTYPE * pSoldier ) case 10: bHearing += 2; break; - case 11: + case 11: case 12: case 13: case 14: @@ -1478,16 +1478,16 @@ void AllTeamsLookForAll(UINT8 ubAllowInterrupts) { pSoldier = MercSlots[ uiLoop ]; - if ( pSoldier != NULL && pSoldier->bLife >= OKLIFE ) + if ( pSoldier != NULL && pSoldier->stats.bLife >= OKLIFE ) { - HandleSight(pSoldier,SIGHT_LOOK); // no radio or interrupts yet + HandleSight(pSoldier,SIGHT_LOOK); // no radio or interrupts yet } - } + } // the player team now radios about all sightings for ( uiLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; uiLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; uiLoop++ ) { - HandleSight( MercPtrs[ uiLoop ], SIGHT_RADIO ); // looking was done above + HandleSight( MercPtrs[ uiLoop ], SIGHT_RADIO ); // looking was done above } if ( !(gTacticalStatus.uiFlags & INCOMBAT) ) @@ -1519,35 +1519,35 @@ void AllTeamsLookForAll(UINT8 ubAllowInterrupts) // this is done here so we can first handle everyone looking through the // door, and deal with the resulting opplist changes, interrupts, etc. if (Status.doorCreakedGridno != NOWHERE) - { - // opening/closing a door makes a bit of noise (constant volume) - MakeNoise(Status.doorCreakedGuynum,Status.doorCreakedGridno,TTypeList[Grid[Status.doorCreakedGridno].land],DOOR_NOISE_VOLUME,NOISE_CREAKING,EXPECTED_NOSEND); + { + // opening/closing a door makes a bit of noise (constant volume) + MakeNoise(Status.doorCreakedGuynum,Status.doorCreakedGridno,TTypeList[Grid[Status.doorCreakedGridno].land],DOOR_NOISE_VOLUME,NOISE_CREAKING,EXPECTED_NOSEND); - Status.doorCreakedGridno = NOWHERE; - Status.doorCreakedGuynum = NOBODY; - } + Status.doorCreakedGridno = NOWHERE; + Status.doorCreakedGuynum = NOBODY; + } // all soldiers now radio their findings (NO interrupts permitted this early!) // NEW: our entire team must radio first, so that they radio about EVERYBODY // rather radioing about individuals one a a time (repeats see 1 enemy quote) for (cnt = Status.team[Net.pnum].guystart,ptr = MercPtrs[cnt]; cnt < Status.team[Net.pnum].guyend; cnt++,ptr++) - { - if (ptr->active && ptr->in_sector && (ptr->life >= OKLIFE)) - HandleSight(ptr,SIGHT_RADIO); // looking was done above - } + { + if (ptr->active && ptr->in_sector && (ptr->life >= OKLIFE)) + HandleSight(ptr,SIGHT_RADIO); // looking was done above + } for (cnt = 0,ptr = Menptr; cnt < MAXMERCS; cnt++,ptr++) - { - if (ptr->active && ptr->in_sector && (ptr->life >= OKLIFE) && !PTR_OURTEAM) - HandleSight(ptr,SIGHT_RADIO); // looking was done above - } + { + if (ptr->active && ptr->in_sector && (ptr->life >= OKLIFE) && !PTR_OURTEAM) + HandleSight(ptr,SIGHT_RADIO); // looking was done above + } // if interrupts were allowed if (allowInterrupts) - // resolve interrupts against the selected character (others disallowed) - HandleSight(MercPtrs[Status.allLookCharacter],SIGHT_INTERRUPT); + // resolve interrupts against the selected character (others disallowed) + HandleSight(MercPtrs[Status.allLookCharacter],SIGHT_INTERRUPT); // revert to normal interrupt operation @@ -1570,23 +1570,23 @@ void ManLooksForOtherTeams(SOLDIERTYPE *pSoldier) #ifdef TESTOPPLIST DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, - String("MANLOOKSFOROTHERTEAMS ID %d(%S) team %d side %d",pSoldier->ubID,pSoldier->name,pSoldier->bTeam,pSoldier->bSide)); + String("MANLOOKSFOROTHERTEAMS ID %d(%S) team %d side %d",pSoldier->ubID,pSoldier->name,pSoldier->bTeam,pSoldier->bSide)); #endif - // one soldier (pSoldier) looks for every soldier on another team (pOpponent) + // one soldier (pSoldier) looks for every soldier on another team (pOpponent) for (uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++) { - pOpponent = MercSlots[ uiLoop ]; + pOpponent = MercSlots[ uiLoop ]; - // if this soldier is around and alive - if (pOpponent && pOpponent->bLife) + // if this soldier is around and alive + if (pOpponent && pOpponent->stats.bLife) + { + // and if he's on another team... + if (pSoldier->bTeam != pOpponent->bTeam) { - // and if he's on another team... - if (pSoldier->bTeam != pOpponent->bTeam) - { // use both sides actual x,y co-ordinates (neither side's moving) // if he sees this opponent... @@ -1596,14 +1596,14 @@ void ManLooksForOtherTeams(SOLDIERTYPE *pSoldier) // This allows us to walk away from buddy and have them disappear instantly if ( gTacticalStatus.uiFlags & TURNBASED && !( gTacticalStatus.uiFlags & INCOMBAT ) ) { - if ( pOpponent->bVisible == 0) + if ( pOpponent->bVisible == 0) { - pOpponent->bVisible = -1; + pOpponent->bVisible = -1; } } - } - } + } + } } } @@ -1620,11 +1620,11 @@ void HandleManNoLongerSeen( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOpponent, INT // don't use UpdatePersonal() here, because we're changing to a *lower* // opplist value (which UpdatePersonal ignores) and we're not updating // the lastKnown gridno at all, we're keeping it at its previous value - /* + /* #ifdef RECORDOPPLIST - fprintf(OpplistFile,"ManLooksForMan: changing personalOpplist to %d for guynum %d, opp %d\n",SEEN_THIS_TURN,ptr->guynum,oppPtr->guynum); + fprintf(OpplistFile,"ManLooksForMan: changing personalOpplist to %d for guynum %d, opp %d\n",SEEN_THIS_TURN,ptr->guynum,oppPtr->guynum); #endif - */ + */ *pPersOL = SEEN_THIS_TURN; @@ -1637,9 +1637,9 @@ void HandleManNoLongerSeen( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOpponent, INT // unauthorized! // make guard run to block guard room CancelAIAction( pSoldier, TRUE ); - RESETTIMECOUNTER( pSoldier->AICounter, 0 ); - pSoldier->bNextAction = AI_ACTION_RUN; - pSoldier->usNextActionData = 13250; + RESETTIMECOUNTER( pSoldier->timeCounters.AICounter, 0 ); + pSoldier->aiData.bNextAction = AI_ACTION_RUN; + pSoldier->aiData.usNextActionData = 13250; } } @@ -1677,7 +1677,7 @@ void HandleManNoLongerSeen( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOpponent, INT } } #ifdef TESTOPPLIST - else + else DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String("ManLooksForMan: ID %d(%S) to ID %d Personally seen, public %d",pSoldier->ubID,pSoldier->name,pOpponent->ubID,*pbPublOL) ); #endif @@ -1695,103 +1695,103 @@ INT16 ManLooksForMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubCall { INT8 bDir,bAware = FALSE,bSuccess = FALSE; INT16 sDistVisible,sDistAway; - INT8 *pPersOL,*pbPublOL; + INT8 *pPersOL,*pbPublOL; /* if (ptr->guynum >= TOTAL_SOLDIERS) - { + { #ifdef BETAVERSION - NumMessage("ManLooksForMan: ERROR - ptr->guynum = ",ptr->guynum); + NumMessage("ManLooksForMan: ERROR - ptr->guynum = ",ptr->guynum); #endif - return(success); - } + return(success); + } if (oppPtr->guynum >= TOTAL_SOLDIERS) - { + { #ifdef BETAVERSION - NumMessage("ManLooksForMan: ERROR - oppPtr->guynum = ",oppPtr->guynum); + NumMessage("ManLooksForMan: ERROR - oppPtr->guynum = ",oppPtr->guynum); #endif - return(success); - } + return(success); + } */ // if we're somehow looking while inactive, at base, dead or dying - if (!pSoldier->bActive || !pSoldier->bInSector || (pSoldier->bLife < OKLIFE)) + if (!pSoldier->bActive || !pSoldier->bInSector || (pSoldier->stats.bLife < OKLIFE)) { /* #ifdef BETAVERSION - sprintf(tempstr,"ManLooksForMan: ERROR - %s is looking while inactive/at base/dead/dying. Caller %s", - ExtMen[ptr->guynum].name,LastCaller2Text[caller]); + sprintf(tempstr,"ManLooksForMan: ERROR - %s is looking while inactive/at base/dead/dying. Caller %s", + ExtMen[ptr->guynum].name,LastCaller2Text[caller]); #ifdef RECORDNET - fprintf(NetDebugFile,"\n\t%s\n\n",tempstr); + fprintf(NetDebugFile,"\n\t%s\n\n",tempstr); #endif - PopMessage(tempstr); + PopMessage(tempstr); #endif */ #ifdef TESTOPPLIST - DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, + DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String("ERROR: ManLooksForMan - WE are inactive/dead etc ID %d(%S)to ID %d",pSoldier->ubID,pSoldier->name,pOpponent->ubID) ); #endif - return(FALSE); - } + return(FALSE); + } // if we're somehow looking for a guy who is inactive, at base, or already dead - if (!pOpponent->bActive || !pOpponent->bInSector || pOpponent->bLife <= 0 || pOpponent->sGridNo == NOWHERE ) + if (!pOpponent->bActive || !pOpponent->bInSector || pOpponent->stats.bLife <= 0 || pOpponent->sGridNo == NOWHERE ) { /* #ifdef BETAVERSION - sprintf(tempstr,"ManLooksForMan: ERROR - %s looks for %s, who is inactive/at base/dead. Caller %s", - ExtMen[ptr->guynum].name,ExtMen[oppPtr->guynum].name,LastCaller2Text[caller]); + sprintf(tempstr,"ManLooksForMan: ERROR - %s looks for %s, who is inactive/at base/dead. Caller %s", + ExtMen[ptr->guynum].name,ExtMen[oppPtr->guynum].name,LastCaller2Text[caller]); #ifdef RECORDNET - fprintf(NetDebugFile,"\n\t%s\n\n",tempstr); + fprintf(NetDebugFile,"\n\t%s\n\n",tempstr); #endif - PopMessage(tempstr); + PopMessage(tempstr); #endif */ #ifdef TESTOPPLIST - DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, + DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String("ERROR: ManLooksForMan - TARGET is inactive etc ID %d(%S)to ID %d",pSoldier->ubID,pSoldier->name,pOpponent->ubID) ); #endif - return(FALSE); + return(FALSE); } // if he's looking for a guy who is on the same team if (pSoldier->bTeam == pOpponent->bTeam) - { + { /* #ifdef BETAVERSION - sprintf(tempstr,"ManLooksFormMan: ERROR - on SAME TEAM. ptr->guynum = %d, oppPtr->guynum = %d", + sprintf(tempstr,"ManLooksFormMan: ERROR - on SAME TEAM. ptr->guynum = %d, oppPtr->guynum = %d", ptr->guynum,oppPtr->guynum); #ifdef RECORDNET - fprintf(NetDebugFile,"\n\t%s\n\n",tempstr); + fprintf(NetDebugFile,"\n\t%s\n\n",tempstr); #endif - PopMessage(tempstr); + PopMessage(tempstr); #endif */ #ifdef TESTOPPLIST - DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, + DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String("ERROR: ManLooksForMan - SAME TEAM ID %d(%S)to ID %d",pSoldier->ubID,pSoldier->name,pOpponent->ubID) ); #endif - return(FALSE); - } + return(FALSE); + } - if (pSoldier->bLife < OKLIFE || pSoldier->fMercAsleep == TRUE ) + if (pSoldier->stats.bLife < OKLIFE || pSoldier->flags.fMercAsleep == TRUE ) { return( FALSE ); } @@ -1800,10 +1800,10 @@ INT16 ManLooksForMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubCall /* // don't allow unconscious persons to look, but COLLAPSED, etc. is OK if (ptr->anitype[ptr->anim] == UNCONSCIOUS) - return(success); + return(success); */ - if ( pSoldier->ubBodyType == LARVAE_MONSTER || (pSoldier->uiStatusFlags & SOLDIER_VEHICLE && pSoldier->bTeam == OUR_TEAM) ) + if ( pSoldier->ubBodyType == LARVAE_MONSTER || (pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE && pSoldier->bTeam == OUR_TEAM) ) { // don't do sight for these return( FALSE ); @@ -1812,45 +1812,45 @@ INT16 ManLooksForMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubCall /* if (ptrProjected) - { - // use looker's PROJECTED x,y co-ordinates (those of his next gridno) - fromX = ptr->destx; - fromY = ptr->desty; - fromGridno = ExtMen[ptr->guynum].nextGridno; - } + { + // use looker's PROJECTED x,y co-ordinates (those of his next gridno) + fromX = ptr->destx; + fromY = ptr->desty; + fromGridno = ExtMen[ptr->guynum].nextGridno; + } else - { - // use looker's ACTUAL x,y co-ordinates (those of gridno he's in now) - fromX = ptr->x; - fromY = ptr->y; - fromGridno = ptr->sGridNo; - } + { + // use looker's ACTUAL x,y co-ordinates (those of gridno he's in now) + fromX = ptr->x; + fromY = ptr->y; + fromGridno = ptr->sGridNo; + } if (oppPtrProjected) - { - // use target's PROJECTED x,y co-ordinates (those of his next gridno) - toX = oppPtr->destx; - toY = oppPtr->desty; - toGridno = ExtMen[oppPtr->guynum].nextGridno; - } + { + // use target's PROJECTED x,y co-ordinates (those of his next gridno) + toX = oppPtr->destx; + toY = oppPtr->desty; + toGridno = ExtMen[oppPtr->guynum].nextGridno; + } else - { - // use target's ACTUAL x,y co-ordinates (those of gridno he's in now) - toX = oppPtr->x; - toY = oppPtr->y; - toGridno = oppPtr->gridno; - } + { + // use target's ACTUAL x,y co-ordinates (those of gridno he's in now) + toX = oppPtr->x; + toY = oppPtr->y; + toGridno = oppPtr->gridno; + } */ - pPersOL = &(pSoldier->bOppList[pOpponent->ubID]); + pPersOL = &(pSoldier->aiData.bOppList[pOpponent->ubID]); pbPublOL = &(gbPublicOpplist[pSoldier->bTeam][pOpponent->ubID]); // if soldier is known about (SEEN or HEARD within last few turns) if (*pPersOL || *pbPublOL) - { - bAware = TRUE; + { + bAware = TRUE; // then we look for him full viewing distance in EVERY direction @@ -1858,7 +1858,7 @@ INT16 ManLooksForMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubCall //sDistVisible = DistanceVisible(pSoldier, (SoldierHasLimitedVision(pSoldier) ? pSoldier->bDesiredDirection : DIRECTION_IRRELEVANT), 0, pOpponent->sGridNo, pOpponent->bLevel, pOpponent ); //if the code below says CALC_FROM_ALL_DIRS, then the opponent will NOT be greyed out if a merc sees him and a second merc turns away from him //calcing from the wanted dir will make the opponent be greyed out, which I think is the intended effect - sDistVisible = pSoldier->GetMaxDistanceVisible( pOpponent->sGridNo, pOpponent->bLevel, CALC_FROM_WANTED_DIR ); + sDistVisible = pSoldier->GetMaxDistanceVisible( pOpponent->sGridNo, pOpponent->pathing.bLevel, CALC_FROM_WANTED_DIR ); //if (pSoldier->ubID == 0) //sprintf(gDebugStr,"ALREADY KNOW: ME %d him %d val %d",pSoldier->ubID,pOpponent->ubID,pSoldier->bOppList[pOpponent->ubID]); } @@ -1869,7 +1869,7 @@ INT16 ManLooksForMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubCall // BIG NOTE: must use desdir instead of direction, since in a projected // situation, the direction may still be changing if it's one of the first // few animation steps when this guy's turn to do his stepped look comes up - sDistVisible = DistanceVisible(pSoldier,pSoldier->bDesiredDirection,bDir, pOpponent->sGridNo, pOpponent->bLevel ); + sDistVisible = DistanceVisible(pSoldier,pSoldier->pathing.bDesiredDirection,bDir, pOpponent->sGridNo, pOpponent->pathing.bLevel ); //if (pSoldier->ubID == 0) //sprintf(gDebugStr,"dist visible %d: my dir %d to him %d",sDistVisible,pSoldier->bDesiredDirection,bDir); } @@ -1888,21 +1888,21 @@ INT16 ManLooksForMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubCall // must use the REAL opplist value here since we may or may not know of him if (SoldierToSoldierLineOfSightTest(pSoldier,pOpponent,bAware,sDistVisible)) { - ManSeesMan(pSoldier,pOpponent,pOpponent->sGridNo,pOpponent->bLevel,MANLOOKSFORMAN,ubCaller); + ManSeesMan(pSoldier,pOpponent,pOpponent->sGridNo,pOpponent->pathing.bLevel,MANLOOKSFORMAN,ubCaller); bSuccess = TRUE; - } + } #ifdef TESTOPPLIST - else + else DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String("FAILED LINEOFSIGHT: ID %d (%S)to ID %d Personally %d, public %d",pSoldier->ubID,pSoldier->name,pOpponent->ubID,*pPersOL,*pbPublOL) ); #endif /* - // if we're looking for a local merc, and changed doors were in the way - if (PTR_OURTEAM && (NextFreeDoorIndex > 0)) - // make or fail, if we passed through any "changed" doors along the way, - // reveal their true status (change the structure to its real value) - // (do this even if we don't have LOS, to close doors that *BREAK* LOS) - RevealDoorsAlongLOS(); + // if we're looking for a local merc, and changed doors were in the way + if (PTR_OURTEAM && (NextFreeDoorIndex > 0)) + // make or fail, if we passed through any "changed" doors along the way, + // reveal their true status (change the structure to its real value) + // (do this even if we don't have LOS, to close doors that *BREAK* LOS) + RevealDoorsAlongLOS(); */ } @@ -1932,8 +1932,8 @@ INT16 ManLooksForMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubCall #ifdef TESTOPPLIST DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String("NO LONGER VISIBLE ID %d (%S)to ID %d Personally %d, public %d success: %d",pSoldier->ubID,pSoldier->name,pOpponent->ubID,*pPersOL,*pbPublOL,bSuccess) ); #endif - - + + // we didn't see the opponent, but since we didn't last time, we should be //if (*pbPublOL) //pOpponent->bVisible = TRUE; @@ -1943,8 +1943,8 @@ INT16 ManLooksForMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubCall DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String("COOL. STILL VISIBLE ID %d (%S)to ID %d Personally %d, public %d success: %d",pSoldier->ubID,pSoldier->name,pOpponent->ubID,*pPersOL,*pbPublOL,bSuccess) ); #endif - - + + } @@ -1960,7 +1960,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, INT8 bDoLocate = FALSE; BOOLEAN fNewOpponent = FALSE; BOOLEAN fNotAddedToList = TRUE; - INT8 bOldOppList = pSoldier->bOppList[pOpponent->ubID]; + INT8 bOldOppList = pSoldier->aiData.bOppList[pOpponent->ubID]; DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"ManSeesMan"); if (pSoldier->ubID >= TOTAL_SOLDIERS) @@ -1984,7 +1984,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, } // if we're somehow looking while inactive, at base, dying or already dead - if (!pSoldier->bActive || !pSoldier->bInSector || (pSoldier->bLife < OKLIFE)) + if (!pSoldier->bActive || !pSoldier->bInSector || (pSoldier->stats.bLife < OKLIFE)) { /* #ifdef BETAVERSION @@ -1996,7 +1996,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, } // if we're somehow seeing a guy who is inactive, at base, or already dead - if (!pOpponent->bActive || !pOpponent->bInSector || pOpponent->bLife <= 0) + if (!pOpponent->bActive || !pOpponent->bInSector || pOpponent->stats.bLife <= 0) { /* #ifdef BETAVERSION @@ -2022,7 +2022,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, } // if we're seeing a guy we didn't see on our last chance to look for him - if (pSoldier->bOppList[pOpponent->ubID] != SEEN_CURRENTLY) + if (pSoldier->aiData.bOppList[pOpponent->ubID] != SEEN_CURRENTLY) { if ( pOpponent->bTeam == gbPlayerNum ) { @@ -2030,11 +2030,11 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, { if ( pSoldier->bTeam == CIV_TEAM ) { - // if this person doing the sighting is a member of a civ group that hates us but + // if this person doing the sighting is a member of a civ group that hates us but // this fact hasn't been revealed, change the side of these people now. This will // make them non-neutral so AddOneOpponent will be called, and the guy will say his // "I hate you" quote - if ( pSoldier->bNeutral ) + if ( pSoldier->aiData.bNeutral ) { if ( pSoldier->ubCivilianGroup != NON_CIV_GROUP && gTacticalStatus.fCivGroupHostile[ pSoldier->ubCivilianGroup ] >= CIV_GROUP_WILL_BECOME_HOSTILE ) { @@ -2057,10 +2057,10 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, if (pOpponent->ubProfile == SLAY ) // 64 { // Carmen goes to war (against Slay) - if ( pSoldier->bNeutral ) + if ( pSoldier->aiData.bNeutral ) { //SetSoldierNonNeutral( pSoldier ); - pSoldier->bAttitude = ATTACKSLAYONLY; + pSoldier->aiData.bAttitude = ATTACKSLAYONLY; TriggerNPCRecord( pSoldier->ubProfile, 28 ); } /* @@ -2072,7 +2072,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, } break; case ELDIN: - if ( pSoldier->bNeutral ) + if ( pSoldier->aiData.bNeutral ) { UINT8 ubRoom = 0; // if player is in behind the ropes of the museum display @@ -2093,10 +2093,10 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, case OLGA: case TYRONE: // change orders, reset action! - if ( pSoldier->bOrders != SEEKENEMY ) + if ( pSoldier->aiData.bOrders != SEEKENEMY ) { - pSoldier->bOrders = SEEKENEMY; - if ( pSoldier->bOppCnt == 0 ) + pSoldier->aiData.bOrders = SEEKENEMY; + if ( pSoldier->aiData.bOppCnt == 0 ) { // didn't see anyone before! CancelAIAction( pSoldier, TRUE ); @@ -2117,7 +2117,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, { CancelAIAction( pSoldier, TRUE ); pSoldier->sAbsoluteFinalDestination = NOWHERE; - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); TriggerNPCRecord( ANGEL, 20 ); // trigger Angel to walk off afterwards //TriggerNPCRecord( ANGEL, 24 ); @@ -2140,7 +2140,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, } } } - else + else { switch( pSoldier->ubProfile ) { @@ -2168,7 +2168,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, { if ( pSoldier->bTeam == CIV_TEAM ) { - if ( pSoldier->ubCivilianGroup != NON_CIV_GROUP && gTacticalStatus.fCivGroupHostile[ pSoldier->ubCivilianGroup ] >= CIV_GROUP_WILL_BECOME_HOSTILE && pSoldier->bNeutral ) + if ( pSoldier->ubCivilianGroup != NON_CIV_GROUP && gTacticalStatus.fCivGroupHostile[ pSoldier->ubCivilianGroup ] >= CIV_GROUP_WILL_BECOME_HOSTILE && pSoldier->aiData.bNeutral ) { AddToShouldBecomeHostileOrSayQuoteList( pSoldier->ubID ); } @@ -2251,7 +2251,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, // (so we are assured we won't count 'em twice for oppcnt purposes) if ( pSoldier->ubBodyType == BLOODCAT ) { - if ( pSoldier->bNeutral ) + if ( pSoldier->aiData.bNeutral ) { MakeBloodcatsHostile(); /* @@ -2267,7 +2267,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, } else { - if ( pSoldier->bOppCnt == 0 ) + if ( pSoldier->aiData.bOppCnt == 0 ) { if ( Random( 2 ) == 0 ) { @@ -2276,7 +2276,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, } } } - else if ( pOpponent->ubBodyType == BLOODCAT && pOpponent->bNeutral) + else if ( pOpponent->ubBodyType == BLOODCAT && pOpponent->aiData.bNeutral) { MakeBloodcatsHostile(); /* @@ -2300,7 +2300,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, #endif // if we also haven't seen him earlier this turn - if (pSoldier->bOppList[pOpponent->ubID] != SEEN_THIS_TURN) + if (pSoldier->aiData.bOppList[pOpponent->ubID] != SEEN_THIS_TURN) { fNewOpponent = TRUE; pSoldier->bNewOppCnt++; // increment looker's NEW opponent count @@ -2309,7 +2309,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, //ExtMen[ptr->guynum].lastCaller = caller; //ExtMen[ptr->guynum].lastCaller2 = caller2; - IncrementWatchedLoc( pSoldier->ubID, pOpponent->sGridNo, pOpponent->bLevel ); + IncrementWatchedLoc( pSoldier->ubID, pOpponent->sGridNo, pOpponent->pathing.bLevel ); if ( pSoldier->bTeam == OUR_TEAM && pOpponent->bTeam == ENEMY_TEAM ) { @@ -2323,7 +2323,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, } else { - SetWatchedLocAsUsed( pSoldier->ubID, pOpponent->sGridNo, pOpponent->bLevel ); + SetWatchedLocAsUsed( pSoldier->ubID, pOpponent->sGridNo, pOpponent->pathing.bLevel ); } // we already know the soldier isn't SEEN_CURRENTLY, @@ -2331,7 +2331,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, // if the looker hasn't seen this opponent at all earlier this turn, OR // if the opponent is not where the looker last thought him to be - if ((pSoldier->bOppList[pOpponent->ubID] != SEEN_THIS_TURN) || + if ((pSoldier->aiData.bOppList[pOpponent->ubID] != SEEN_THIS_TURN) || (gsLastKnownOppLoc[pSoldier->ubID][pOpponent->ubID] != sOppGridno)) { SetNewSituation( pSoldier ); // force the looker to re-evaluate @@ -2342,7 +2342,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, // something we were quite expecting, so make a new decision. For // other (combat) movement decisions, we took his position into account // when we made it, so don't make us think again & slow things down. - switch (pSoldier->bAction) + switch (pSoldier->aiData.bAction) { case AI_ACTION_RANDOM_PATROL: case AI_ACTION_SEEK_OPPONENT: @@ -2361,7 +2361,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, else DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String( "ManSeesMan: ID %d(%S) to ID %d ALREADYSEENCURRENTLY",pSoldier->ubID,pSoldier->name,pOpponent->ubID) ); #endif - //bOldOppValue = pSoldier->bOppList[ pOpponent->ubID ]; + //bOldOppValue = pSoldier->aiData.bOppList[ pOpponent->ubID ]; // remember that the soldier is currently seen and his new location UpdatePersonal(pSoldier,pOpponent->ubID,SEEN_CURRENTLY,sOppGridno,bOppLevel); @@ -2382,7 +2382,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, } // require the enemy not to be dying if we are the sighter; in other words, // always add for AI guys, and always add for people with life >= OKLIFE - else if ( !(pSoldier->bTeam == gbPlayerNum && pOpponent->bLife < OKLIFE ) ) + else if ( !(pSoldier->bTeam == gbPlayerNum && pOpponent->stats.bLife < OKLIFE ) ) { ReevaluateBestSightingPosition( pSoldier, CalcInterruptDuelPts( pSoldier, pOpponent->ubID, TRUE ) ); } @@ -2425,11 +2425,11 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, //ATE: Cancel any fading going on! // ATE: Added for fade in..... - if ( pOpponent->fBeginFade == 1 || pOpponent->fBeginFade == 2 ) + if ( pOpponent->flags.fBeginFade == 1 || pOpponent->flags.fBeginFade == 2 ) { - pOpponent->fBeginFade = FALSE; + pOpponent->flags.fBeginFade = FALSE; - if ( pOpponent->bLevel > 0 && gpWorldLevelData[ pOpponent->sGridNo ].pRoofHead != NULL ) + if ( pOpponent->pathing.bLevel > 0 && gpWorldLevelData[ pOpponent->sGridNo ].pRoofHead != NULL ) { pOpponent->ubFadeLevel = gpWorldLevelData[ pOpponent->sGridNo ].pRoofHead->ubShadeLevel; } @@ -2480,7 +2480,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, if ( gTacticalStatus.uiFlags & TURNBASED && ( ( gTacticalStatus.uiFlags & INCOMBAT ) | gTacticalStatus.fVirginSector ) ) { - if (!pOpponent->bNeutral && (pSoldier->bSide != pOpponent->bSide)) + if (!pOpponent->aiData.bNeutral && (pSoldier->bSide != pOpponent->bSide)) { //SlideTo(0,pOpponent->ubID, pSoldier->ubID, SETLOCATOR); //rain @@ -2506,11 +2506,11 @@ void DecideTrueVisibility(SOLDIERTYPE *pSoldier, UINT8 ubLocate) // if his visibility is still in the special "limbo" state (FALSE) if (pSoldier->bVisible == FALSE) { - // then none of our team's merc turned him visible, - // therefore he now becomes truly invisible - pSoldier->bVisible = -1; + // then none of our team's merc turned him visible, + // therefore he now becomes truly invisible + pSoldier->bVisible = -1; - // Don;t adjust anim speed here, it's done once fade is over! + // Don;t adjust anim speed here, it's done once fade is over! } @@ -2520,32 +2520,32 @@ void DecideTrueVisibility(SOLDIERTYPE *pSoldier, UINT8 ubLocate) if (ubLocate) - { - // if he remains visible (or ShowEnemies ON) - if ((pSoldier->bVisible >= 0) || gbShowEnemies) - { - /* + { + // if he remains visible (or ShowEnemies ON) + if ((pSoldier->bVisible >= 0) || gbShowEnemies) + { + /* #ifdef RECORDNET - fprintf(NetDebugFile,"\tDecideTrueVisibility - LOCATE\n"); + fprintf(NetDebugFile,"\tDecideTrueVisibility - LOCATE\n"); #endif */ - if (PTR_OURTEAM) - { - //if (ConfigOptions[FOLLOWMODE] && Status.stopSlidingAt == NOBODY) - // LocateMember(ptr->guynum,DONTSETLOCATOR); - } - else // not our team - if we're NOT allied then locate... - //if (pSoldier->side != gTacticalStatus.Team[gbPlayerNum].side && ConfigOptions[FOLLOWMODE]) - //if (Status.stopSlidingAt == NOBODY) - if (gTacticalStatus.uiFlags & TURNBASED && ( gTacticalStatus.uiFlags & INCOMBAT ) ) - //LocateSoldier(pSoldier->ubID,DONTSETLOCATOR); + if (PTR_OURTEAM) + { + //if (ConfigOptions[FOLLOWMODE] && Status.stopSlidingAt == NOBODY) + // LocateMember(ptr->guynum,DONTSETLOCATOR); + } + else // not our team - if we're NOT allied then locate... + //if (pSoldier->side != gTacticalStatus.Team[gbPlayerNum].side && ConfigOptions[FOLLOWMODE]) + //if (Status.stopSlidingAt == NOBODY) + if (gTacticalStatus.uiFlags & TURNBASED && ( gTacticalStatus.uiFlags & INCOMBAT ) ) + //LocateSoldier(pSoldier->ubID,DONTSETLOCATOR); SlideTo(0,pSoldier->ubID, NOBODY, DONTSETLOCATOR); - // follow his movement on our screen as he moves around... - //LocateMember(ptr->guynum,DONTSETLOCATOR); - } - } + // follow his movement on our screen as he moves around... + //LocateMember(ptr->guynum,DONTSETLOCATOR); + } + } } @@ -2563,9 +2563,9 @@ void OtherTeamsLookForMan(SOLDIERTYPE *pOpponent) // if the guy we're looking for is NOT on our team AND is currently visible #ifdef WE_SEE_WHAT_MILITIA_SEES_AND_VICE_VERSA - if ((pOpponent->bTeam != gbPlayerNum && pOpponent->bTeam != MILITIA_TEAM) && (pOpponent->bVisible >= 0 && pOpponent->bVisible < 2) && pOpponent->bLife) + if ((pOpponent->bTeam != gbPlayerNum && pOpponent->bTeam != MILITIA_TEAM) && (pOpponent->bVisible >= 0 && pOpponent->bVisible < 2) && pOpponent->stats.bLife) #else - if ((pOpponent->bTeam != gbPlayerNum) && (pOpponent->bVisible >= 0 && pOpponent->bVisible < 2) && pOpponent->bLife) + if ((pOpponent->bTeam != gbPlayerNum) && (pOpponent->bVisible >= 0 && pOpponent->bVisible < 2) && pOpponent->stats.bLife) #endif { // assume he's no longer visible, until one of our mercs sees him again @@ -2573,7 +2573,7 @@ void OtherTeamsLookForMan(SOLDIERTYPE *pOpponent) } #ifdef TESTOPPLIST - DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, + DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String("OTHERTEAMSLOOKFORMAN ID %d(%S) team %d side %d",pOpponent->ubID,pOpponent->name,pOpponent->bTeam,pOpponent->bSide )); #endif @@ -2584,15 +2584,15 @@ void OtherTeamsLookForMan(SOLDIERTYPE *pOpponent) pSoldier = MercSlots[ uiLoop ]; // if this merc is active, in this sector, and well enough to look - if (pSoldier != NULL && pSoldier->bLife >= OKLIFE && (pSoldier->ubBodyType != LARVAE_MONSTER)) + if (pSoldier != NULL && pSoldier->stats.bLife >= OKLIFE && (pSoldier->ubBodyType != LARVAE_MONSTER)) { // if this merc is on the same team as the target soldier if (pSoldier->bTeam == pOpponent->bTeam) { - continue; // he doesn't look (he ALWAYS knows about him) + continue; // he doesn't look (he ALWAYS knows about him) } - bOldOppList = pSoldier->bOppList[pOpponent->ubID]; + bOldOppList = pSoldier->aiData.bOppList[pOpponent->ubID]; // this merc looks for the soldier in question // use both sides actual x,y co-ordinates (neither side's moving) @@ -2611,13 +2611,13 @@ void OtherTeamsLookForMan(SOLDIERTYPE *pOpponent) // as long as viewer meets minimum interrupt conditions if ( gubSightFlags & SIGHT_INTERRUPT && StandardInterruptConditionsMet(pSoldier,pOpponent->ubID,bOldOppList)) { - // calculate the interrupt duel points - pSoldier->bInterruptDuelPts = CalcInterruptDuelPts(pSoldier, pOpponent->ubID, TRUE); - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Calculating int duel pts in OtherTeamsLookForMan, %d has %d points", pSoldier->ubID, pSoldier->bInterruptDuelPts ) ); + // calculate the interrupt duel points + pSoldier->aiData.bInterruptDuelPts = CalcInterruptDuelPts(pSoldier, pOpponent->ubID, TRUE); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Calculating int duel pts in OtherTeamsLookForMan, %d has %d points", pSoldier->ubID, pSoldier->aiData.bInterruptDuelPts ) ); } else { - pSoldier->bInterruptDuelPts = NO_INTERRUPT; + pSoldier->aiData.bInterruptDuelPts = NO_INTERRUPT; } } } @@ -2625,7 +2625,7 @@ void OtherTeamsLookForMan(SOLDIERTYPE *pOpponent) // if "Show only enemies seen" option is ON and it's this guy looking //if (ptr->guynum == ShowOnlySeenPerson) - //NewShowOnlySeenPerson(ptr); // update the string + //NewShowOnlySeenPerson(ptr); // update the string } } @@ -2633,16 +2633,16 @@ void OtherTeamsLookForMan(SOLDIERTYPE *pOpponent) // if he's not on our team if (pOpponent->bTeam != gbPlayerNum) { - // don't do a locate here, it's already done by Man Sees Man for new opps. - DecideTrueVisibility(pOpponent,NOLOCATE); + // don't do a locate here, it's already done by Man Sees Man for new opps. + DecideTrueVisibility(pOpponent,NOLOCATE); } } void AddOneOpponent(SOLDIERTYPE *pSoldier) { - INT8 bOldOppCnt = pSoldier->bOppCnt; + INT8 bOldOppCnt = pSoldier->aiData.bOppCnt; - pSoldier->bOppCnt++; + pSoldier->aiData.bOppCnt++; if (!bOldOppCnt) { @@ -2653,17 +2653,17 @@ void AddOneOpponent(SOLDIERTYPE *pSoldier) return; } - if (pSoldier->bAlertStatus < STATUS_RED) + if (pSoldier->aiData.bAlertStatus < STATUS_RED) { CheckForChangingOrders(pSoldier); } - pSoldier->bAlertStatus = STATUS_BLACK; // force black AI status right away + pSoldier->aiData.bAlertStatus = STATUS_BLACK; // force black AI status right away - if (pSoldier->uiStatusFlags & SOLDIER_MONSTER) + if (pSoldier->flags.uiStatusFlags & SOLDIER_MONSTER) { - pSoldier->ubCaller = NOBODY; - pSoldier->bCallPriority = 0; + pSoldier->aiData.ubCaller = NOBODY; + pSoldier->aiData.bCallPriority = 0; } } @@ -2679,20 +2679,20 @@ void AddOneOpponent(SOLDIERTYPE *pSoldier) void RemoveOneOpponent(SOLDIERTYPE *pSoldier) { - pSoldier->bOppCnt--; + pSoldier->aiData.bOppCnt--; - if ( pSoldier->bOppCnt < 0 ) + if ( pSoldier->aiData.bOppCnt < 0 ) { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Oppcnt for %d (%s) tried to go below 0", pSoldier->ubID, pSoldier->name ) ); - #ifdef JA2BETAVERSION - ScreenMsg( MSG_FONT_YELLOW, MSG_UI_FEEDBACK, L"Opponent counter dropped below 0 for person %d (%s). Please inform Sir-tech of this, and what has just been happening in the game.", pSoldier->ubID, pSoldier->name ); - #endif - pSoldier->bOppCnt = 0; + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Oppcnt for %d (%s) tried to go below 0", pSoldier->ubID, pSoldier->name ) ); + #ifdef JA2BETAVERSION + ScreenMsg( MSG_FONT_YELLOW, MSG_UI_FEEDBACK, L"Opponent counter dropped below 0 for person %d (%s). Please inform Sir-tech of this, and what has just been happening in the game.", pSoldier->ubID, pSoldier->name ); + #endif + pSoldier->aiData.bOppCnt = 0; } // if no opponents remain in sight, drop status to RED (but NOT newSit.!) - if (!pSoldier->bOppCnt) - pSoldier->bAlertStatus = STATUS_RED; + if (!pSoldier->aiData.bOppCnt) + pSoldier->aiData.bAlertStatus = STATUS_RED; } @@ -2709,8 +2709,8 @@ void RemoveManAsTarget(SOLDIERTYPE *pSoldier) // clean up the public opponent lists and locations for (ubLoop = 0; ubLoop < MAXTEAMS; ubLoop++) - // never causes any additional looks - UpdatePublic(ubLoop,ubTarget,NOT_HEARD_OR_SEEN,NOWHERE,0); + // never causes any additional looks + UpdatePublic(ubLoop,ubTarget,NOT_HEARD_OR_SEEN,NOWHERE,0); /* @@ -2719,10 +2719,10 @@ IAN COMMENTED THIS OUT MAY 1997 - DO WE NEED THIS? // make sure this guy is no longer a possible target for anyone for (cnt = 0, pOpponent = Menptr; cnt < MAXMERCS; cnt++,pOpponent++) - { - if (pOpponent->bOppNum == ubTarget) - pOpponent->bOppNum = NOBODY; - } + { + if (pOpponent->bOppNum == ubTarget) + pOpponent->bOppNum = NOBODY; + } */ @@ -2732,11 +2732,11 @@ IAN COMMENTED THIS OUT MAY 1997 - DO WE NEED THIS? { pOpponent = MercSlots[ ubLoop ]; - // if the target is active, a true opponent and currently seen by this merc + // if the target is active, a true opponent and currently seen by this merc if (pOpponent) { // check to see if OPPONENT considers US neutral - if ( (pOpponent->bOppList[ubTarget] == SEEN_CURRENTLY) && !pOpponent->bNeutral && !CONSIDERED_NEUTRAL( pOpponent, pSoldier ) && (pSoldier->bSide != pOpponent->bSide) ) + if ( (pOpponent->aiData.bOppList[ubTarget] == SEEN_CURRENTLY) && !pOpponent->aiData.bNeutral && !CONSIDERED_NEUTRAL( pOpponent, pSoldier ) && (pSoldier->bSide != pOpponent->bSide) ) { RemoveOneOpponent(pOpponent); } @@ -2744,32 +2744,32 @@ IAN COMMENTED THIS OUT MAY 1997 - DO WE NEED THIS? gbSeenOpponents[ubLoop][ubTarget] = FALSE; } } - + /* for (ubLoop = 0,pOpponent = Menptr; ubLoop < MAXMERCS; ubLoop++,pOpponent++) - { - // if the target is a true opponent and currently seen by this merc - if (!pSoldier->bNeutral && !pSoldier->bNeutral && - (pOpponent->bOppList[ubTarget] == SEEN_CURRENTLY) + { + // if the target is a true opponent and currently seen by this merc + if (!pSoldier->aiData.bNeutral && !pSoldier->aiData.bNeutral && + (pOpponent->aiData.bOppList[ubTarget] == SEEN_CURRENTLY) - ) - ///*** UNTIL ANDREW GETS THE SIDE PARAMETERS WORKING - // && (pSoldier->side != pOpponent->side)) - { - RemoveOneOpponent(pOpponent); - } + ) + ///*** UNTIL ANDREW GETS THE SIDE PARAMETERS WORKING + // && (pSoldier->side != pOpponent->side)) + { + RemoveOneOpponent(pOpponent); + } - UpdatePersonal(pOpponent,ubTarget,NOT_HEARD_OR_SEEN,NOWHERE,0); + UpdatePersonal(pOpponent,ubTarget,NOT_HEARD_OR_SEEN,NOWHERE,0); - gbSeenOpponents[ubLoop][ubTarget] = FALSE; - } + gbSeenOpponents[ubLoop][ubTarget] = FALSE; + } */ ResetLastKnownLocs(pSoldier); if (gTacticalStatus.Team[pSoldier->bTeam].ubLastMercToRadio == ubTarget) - gTacticalStatus.Team[pSoldier->bTeam].ubLastMercToRadio = NOBODY; + gTacticalStatus.Team[pSoldier->bTeam].ubLastMercToRadio = NOBODY; } @@ -2791,15 +2791,15 @@ void UpdatePublic(UINT8 ubTeam, UINT8 ubID, INT8 bNewOpplist, INT16 sGridno, INT // if new opplist is more up-to-date, or we are just wiping it for some reason if ((gubKnowledgeValue[*pbPublOL - OLDEST_HEARD_VALUE][bNewOpplist - OLDEST_HEARD_VALUE] > 0) || - (bNewOpplist == NOT_HEARD_OR_SEEN)) - { - // if this team is becoming aware of a soldier it wasn't previously aware of - if ((bNewOpplist != NOT_HEARD_OR_SEEN) && (*pbPublOL == NOT_HEARD_OR_SEEN)) - ubTeamMustLookAgain = TRUE; + (bNewOpplist == NOT_HEARD_OR_SEEN)) + { + // if this team is becoming aware of a soldier it wasn't previously aware of + if ((bNewOpplist != NOT_HEARD_OR_SEEN) && (*pbPublOL == NOT_HEARD_OR_SEEN)) + ubTeamMustLookAgain = TRUE; - // change the public opplist *BEFORE* anyone looks again or we'll recurse! - *pbPublOL = bNewOpplist; - } + // change the public opplist *BEFORE* anyone looks again or we'll recurse! + *pbPublOL = bNewOpplist; + } // always update the gridno, no matter what @@ -2808,32 +2808,32 @@ void UpdatePublic(UINT8 ubTeam, UINT8 ubID, INT8 bNewOpplist, INT16 sGridno, INT // if team has been told about a guy the team was completely unaware of if (ubTeamMustLookAgain) - { - // then everyone on team who's not aware of guynum must look for him - cnt = gTacticalStatus.Team[ubTeam].bFirstID; + { + // then everyone on team who's not aware of guynum must look for him + cnt = gTacticalStatus.Team[ubTeam].bFirstID; - for (pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[ubTeam].bLastID; cnt++,pSoldier++) - { - // if this soldier is active, in this sector, and well enough to look - if (pSoldier->bActive && pSoldier->bInSector && (pSoldier->bLife >= OKLIFE) && !( pSoldier->uiStatusFlags & SOLDIER_GASSED ) ) - { - // if soldier isn't aware of guynum, give him another chance to see - if (pSoldier->bOppList[ubID] == NOT_HEARD_OR_SEEN) - { + for (pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[ubTeam].bLastID; cnt++,pSoldier++) + { + // if this soldier is active, in this sector, and well enough to look + if (pSoldier->bActive && pSoldier->bInSector && (pSoldier->stats.bLife >= OKLIFE) && !( pSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) ) + { + // if soldier isn't aware of guynum, give him another chance to see + if (pSoldier->aiData.bOppList[ubID] == NOT_HEARD_OR_SEEN) + { if (ManLooksForMan(pSoldier,MercPtrs[ubID],UPDATEPUBLIC)) // then he actually saw guynum because of our new public knowledge ubMadeDifference = TRUE; - // whether successful or not, whack newOppCnt. Since this is a + // whether successful or not, whack newOppCnt. Since this is a // delayed reaction to a radio call, there's no chance of interrupt! pSoldier->bNewOppCnt = 0; // if "Show only enemies seen" option is ON and it's this guy looking //if (pSoldier->ubID == ShowOnlySeenPerson) - // NewShowOnlySeenPerson(pSoldier); // update the string - } - } - } + // NewShowOnlySeenPerson(pSoldier); // update the string + } + } + } } } @@ -2853,11 +2853,11 @@ void UpdatePersonal(SOLDIERTYPE *pSoldier, UINT8 ubID, INT8 bNewOpplist, INT16 s // if new opplist is more up-to-date, or we are just wiping it for some reason - if ((gubKnowledgeValue[pSoldier->bOppList[ubID] - OLDEST_HEARD_VALUE][bNewOpplist - OLDEST_HEARD_VALUE] > 0) || - (bNewOpplist == NOT_HEARD_OR_SEEN)) - { - pSoldier->bOppList[ubID] = bNewOpplist; - } + if ((gubKnowledgeValue[pSoldier->aiData.bOppList[ubID] - OLDEST_HEARD_VALUE][bNewOpplist - OLDEST_HEARD_VALUE] > 0) || + (bNewOpplist == NOT_HEARD_OR_SEEN)) + { + pSoldier->aiData.bOppList[ubID] = bNewOpplist; + } // always update the gridno, no matter what gsLastKnownOppLoc[pSoldier->ubID][ubID] = sGridno; @@ -2877,25 +2877,25 @@ INT8 OurMaxPublicOpplist() for (uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++) { - pSoldier = MercSlots[ uiLoop ]; + pSoldier = MercSlots[ uiLoop ]; - // if this merc is inactive, at base, on assignment, or dead - if (!pSoldier || !pSoldier->bLife) - continue; // next merc + // if this merc is inactive, at base, on assignment, or dead + if (!pSoldier || !pSoldier->stats.bLife) + continue; // next merc - // if this man is NEUTRAL / on our side, he's not an opponent - if (pSoldier->bNeutral || (gTacticalStatus.Team[gbPlayerNum].bSide == Menptr[pSoldier->ubID].bSide)) - continue; // next merc + // if this man is NEUTRAL / on our side, he's not an opponent + if (pSoldier->aiData.bNeutral || (gTacticalStatus.Team[gbPlayerNum].bSide == Menptr[pSoldier->ubID].bSide)) + continue; // next merc - // opponent, check our public opplist value for him - ubOppValue = gubKnowledgeValue[0 - OLDEST_HEARD_VALUE][gbPublicOpplist[gbPlayerNum][pSoldier->ubID] - OLDEST_HEARD_VALUE]; + // opponent, check our public opplist value for him + ubOppValue = gubKnowledgeValue[0 - OLDEST_HEARD_VALUE][gbPublicOpplist[gbPlayerNum][pSoldier->ubID] - OLDEST_HEARD_VALUE]; - if (ubOppValue > ubHighestValue) - { - ubHighestValue = ubOppValue; - bHighestOpplist = gbPublicOpplist[gbPlayerNum][pSoldier->ubID]; - } - } + if (ubOppValue > ubHighestValue) + { + ubHighestValue = ubOppValue; + bHighestOpplist = gbPublicOpplist[gbPlayerNum][pSoldier->ubID]; + } + } return(bHighestOpplist); } @@ -2912,40 +2912,40 @@ BOOLEAN VisibleAnywhere(SOLDIERTYPE *pSoldier) // this takes care of any mercs on our own team if (pSoldier->bVisible >= 0) - return(TRUE); + return(TRUE); // if playing alone, "anywhere" is just over here! //if (!Net.multiType || Net.activePlayers < 2) - //return(FALSE); + //return(FALSE); for (bTeam = 0; bTeam < MAXTEAMS; bTeam++) - { - // skip our team (local visible flag will do for them) - if (bTeam == gbPlayerNum) - continue; + { + // skip our team (local visible flag will do for them) + if (bTeam == gbPlayerNum) + continue; - // skip any inactive teams - if (!gTacticalStatus.team[bTeam].teamActive) - continue; + // skip any inactive teams + if (!gTacticalStatus.team[bTeam].teamActive) + continue; - // skip non-human teams (they don't communicate for their machines!) - if (!gTacticalStatus.Team[bTeam].human) - continue; + // skip non-human teams (they don't communicate for their machines!) + if (!gTacticalStatus.Team[bTeam].human) + continue; - // so we're left with another human player's team of mercs... + // so we're left with another human player's team of mercs... - // check if soldier is currently visible to any human mercs on other teams - for (cnt = Status.team[team].guystart,oppPtr = Menptr + cnt; cnt < Status.team[team].guyend; cnt++,oppPtr++) - { - // if this merc is inactive, or in no condition to care - if (!oppPtr->active || !oppPtr->in_sector || oppPtr->deadAndRemoved || (oppPtr->life < OKLIFE)) - continue; // skip him! + // check if soldier is currently visible to any human mercs on other teams + for (cnt = Status.team[team].guystart,oppPtr = Menptr + cnt; cnt < Status.team[team].guyend; cnt++,oppPtr++) + { + // if this merc is inactive, or in no condition to care + if (!oppPtr->active || !oppPtr->in_sector || oppPtr->deadAndRemoved || (oppPtr->life < OKLIFE)) + continue; // skip him! - if (oppPtr->opplist[ptr->guynum] == SEEN_CURRENTLY) - return(TRUE); - } - } + if (oppPtr->opplist[ptr->guynum] == SEEN_CURRENTLY) + return(TRUE); + } + } // nobody anywhere sees him @@ -2964,7 +2964,7 @@ void ResetLastKnownLocs(SOLDIERTYPE *pSoldier) if (MercSlots[uiLoop]) { gsLastKnownOppLoc[pSoldier->ubID][MercSlots[uiLoop]->ubID] = NOWHERE; - + // IAN added this June 14/97 gsPublicLastKnownOppLoc[pSoldier->bTeam][MercSlots[uiLoop]->ubID] = NOWHERE; } @@ -3040,8 +3040,8 @@ void InitOpponentKnowledgeSystem(void) void InitSoldierOppList(SOLDIERTYPE *pSoldier) { - memset(pSoldier->bOppList,NOT_HEARD_OR_SEEN,sizeof(pSoldier->bOppList)); - pSoldier->bOppCnt = 0; + memset(pSoldier->aiData.bOppList,NOT_HEARD_OR_SEEN,sizeof(pSoldier->aiData.bOppList)); + pSoldier->aiData.bOppCnt = 0; ResetLastKnownLocs(pSoldier); memset(gbSeenOpponents[pSoldier->ubID],0,MAXMERCS); } @@ -3053,10 +3053,10 @@ void BetweenTurnsVisibilityAdjustments(void) SOLDIERTYPE *pSoldier; - // make all soldiers on other teams that are no longer seen not visible - for (cnt = 0, pSoldier = Menptr; cnt < MAXMERCS; cnt++,pSoldier++) + // make all soldiers on other teams that are no longer seen not visible + for (cnt = 0, pSoldier = Menptr; cnt < MAXMERCS; cnt++,pSoldier++) { - if (pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife) + if (pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife) { #ifdef WE_SEE_WHAT_MILITIA_SEES_AND_VICE_VERSA if (!PTR_OURTEAM && pSoldier->bTeam != MILITIA_TEAM) @@ -3117,25 +3117,25 @@ void SaySeenQuote( SOLDIERTYPE *pSoldier, BOOLEAN fSeenCreature, BOOLEAN fVirgin { if ( !OK_ENEMY_MERC( pTeamSoldier ) ) { - if ( pTeamSoldier->bOppCnt >= ( ubNumEnemies / 2 ) ) - { + if ( pTeamSoldier->aiData.bOppCnt >= ( ubNumEnemies / 2 ) ) + { ubNumAllies++; - } + } } } } // now check! - if ( ( pSoldier->bOppCnt - ubNumAllies ) > 2 ) + if ( ( pSoldier->aiData.bOppCnt - ubNumAllies ) > 2 ) { // Say quote! - TacticalCharacterDialogue( pSoldier, QUOTE_IN_TROUBLE_SLASH_IN_BATTLE ); + TacticalCharacterDialogue( pSoldier, QUOTE_IN_TROUBLE_SLASH_IN_BATTLE ); pSoldier->usQuoteSaidFlags |= SOLDIER_QUOTE_SAID_IN_SHIT; return; } - + } @@ -3161,7 +3161,7 @@ void SaySeenQuote( SOLDIERTYPE *pSoldier, BOOLEAN fSeenCreature, BOOLEAN fVirgin { if ( OK_ENEMY_MERC( pTeamSoldier ) ) { - if ( pTeamSoldier->uiStatusFlags & SOLDIER_MONSTER && pSoldier->bOppList[ pTeamSoldier->ubID ] == SEEN_CURRENTLY ) + if ( pTeamSoldier->flags.uiStatusFlags & SOLDIER_MONSTER && pSoldier->aiData.bOppList[ pTeamSoldier->ubID ] == SEEN_CURRENTLY ) { ubNumEnemies++; } @@ -3173,10 +3173,10 @@ void SaySeenQuote( SOLDIERTYPE *pSoldier, BOOLEAN fSeenCreature, BOOLEAN fVirgin { // Yes, set flag pSoldier->usQuoteSaidFlags |= SOLDIER_QUOTE_SAID_MULTIPLE_CREATURES; - + // Say quote - TacticalCharacterDialogue( pSoldier, QUOTE_ATTACKED_BY_MULTIPLE_CREATURES ); - } + TacticalCharacterDialogue( pSoldier, QUOTE_ATTACKED_BY_MULTIPLE_CREATURES ); + } else { TacticalCharacterDialogue( pSoldier, QUOTE_SEE_CREATURE ); @@ -3192,13 +3192,13 @@ void SaySeenQuote( SOLDIERTYPE *pSoldier, BOOLEAN fSeenCreature, BOOLEAN fVirgin // Yes, set flag gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags |= PROFILE_MISC_FLAG_HAVESEENCREATURE; - TacticalCharacterDialogue( pSoldier, QUOTE_FIRSTTIME_GAME_SEE_CREATURE ); + TacticalCharacterDialogue( pSoldier, QUOTE_FIRSTTIME_GAME_SEE_CREATURE ); } } // 2 is for bloodcat... else if ( fSeenCreature == 2 ) { - TacticalCharacterDialogue( pSoldier, QUOTE_SPOTTED_BLOODCAT ); + TacticalCharacterDialogue( pSoldier, QUOTE_SPOTTED_BLOODCAT ); } else { @@ -3212,7 +3212,7 @@ void SaySeenQuote( SOLDIERTYPE *pSoldier, BOOLEAN fSeenCreature, BOOLEAN fVirgin #ifdef ENGLISH if ( Random( 100 ) < 30 ) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_ENEMY ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_ENEMY ); } else { @@ -3235,7 +3235,7 @@ void OurTeamSeesSomeone( SOLDIERTYPE * pSoldier, INT8 bNumReRevealed, INT8 bNumN // Say quote! SaySeenQuote( pSoldier, gfPlayerTeamSawCreatures, TRUE, gfPlayerTeamSawJoey ); - HaultSoldierFromSighting( pSoldier, TRUE ); + pSoldier->HaultSoldierFromSighting( TRUE ); // Set virgin sector to false.... gTacticalStatus.fVirginSector = FALSE; @@ -3243,7 +3243,7 @@ void OurTeamSeesSomeone( SOLDIERTYPE * pSoldier, INT8 bNumReRevealed, INT8 bNumN else { // if this merc is selected and he's actually moving - //if ((pSoldier->ubID == gusSelectedSoldier) && !pSoldier->bStopped) + //if ((pSoldier->ubID == gusSelectedSoldier) && !pSoldier->pathing.bLevel) // ATE: Change this to if the guy is ours.... // How will this feel? if ( pSoldier->bTeam == gbPlayerNum ) @@ -3252,14 +3252,14 @@ void OurTeamSeesSomeone( SOLDIERTYPE * pSoldier, INT8 bNumReRevealed, INT8 bNumN /// Speek up! if ( bNumReRevealed > 0 && bNumNewEnemies == 0 ) { - DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 ); + pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); } else { SaySeenQuote( pSoldier, gfPlayerTeamSawCreatures, FALSE, gfPlayerTeamSawJoey ); } - HaultSoldierFromSighting( pSoldier, TRUE ); + pSoldier->HaultSoldierFromSighting( TRUE ); if ( gTacticalStatus.fEnemySightingOnTheirTurn ) { @@ -3267,7 +3267,7 @@ void OurTeamSeesSomeone( SOLDIERTYPE * pSoldier, INT8 bNumReRevealed, INT8 bNumN LocateSoldier( pSoldier->ubID, SETLOCATOR ); // Now slide to other guy.... - SlideTo( NOWHERE, gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID, NOBODY ,SETLOCATOR); + SlideTo( NOWHERE, gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID, NOBODY ,SETLOCATOR); } @@ -3303,15 +3303,15 @@ void RadioSightings(SOLDIERTYPE *pSoldier, UINT8 ubAbout, UINT8 ubTeamToRadioTo #ifdef TESTOPPLIST -DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, - String("RADIO SIGHTINGS: for %d about %d",pSoldier->ubID,ubAbout) ); +DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, + String("RADIO SIGHTINGS: for %d about %d",pSoldier->ubID,ubAbout) ); #endif #ifdef RECORDNET if (!ptr->human) - fprintf(NetDebugFile,"\tNPC %d(%s) radios his sightings to his team\n",ptr->guynum,ExtMen[ptr->guynum].name); + fprintf(NetDebugFile,"\tNPC %d(%s) radios his sightings to his team\n",ptr->guynum,ExtMen[ptr->guynum].name); #endif gTacticalStatus.Team[pSoldier->bTeam].ubLastMercToRadio = pSoldier->ubID; @@ -3323,19 +3323,19 @@ DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, // who are we radioing about? if (ubAbout == EVERYBODY) - { - start = 0; - end = MAXMERCS; - } + { + start = 0; + end = MAXMERCS; + } else - { - start = ubAbout; - end = ubAbout + 1; - } + { + start = ubAbout; + end = ubAbout + 1; + } // hang a pointer to the start of our this guy's personal opplist - pPersOL = &(pSoldier->bOppList[start]); + pPersOL = &(pSoldier->aiData.bOppList[start]); // hang a pointer to the start of this guy's opponents in the public opplist pbPublOL = &(gbPublicOpplist[ubTeamToRadioTo][start]); @@ -3344,146 +3344,146 @@ DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, // loop through every one of this guy's opponents for (iLoop = start; iLoop < end; iLoop++,pOpponent++,pPersOL++,pbPublOL++) - { - fContactSeen = FALSE; + { + fContactSeen = FALSE; #ifdef TESTOPPLIST - DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, - String("RS: checking %d",pOpponent->ubID) ); + DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, + String("RS: checking %d",pOpponent->ubID) ); #endif - // make sure this merc is active, here & still alive (unconscious OK) - if (!pOpponent->bActive || !pOpponent->bInSector || !pOpponent->bLife) - { + // make sure this merc is active, here & still alive (unconscious OK) + if (!pOpponent->bActive || !pOpponent->bInSector || !pOpponent->stats.bLife) + { #ifdef TESTOPPLIST - DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, + DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String("RS: inactive/notInSector/life %d",pOpponent->ubID) ); #endif - continue; // skip to the next merc - } + continue; // skip to the next merc + } - // if these two mercs are on the same SIDE, then they're NOT opponents - // NEW: Apr. 21 '96: must allow ALL non-humans to get radioed about - if ((pSoldier->bSide == pOpponent->bSide) && (pOpponent->uiStatusFlags & SOLDIER_PC)) - { + // if these two mercs are on the same SIDE, then they're NOT opponents + // NEW: Apr. 21 '96: must allow ALL non-humans to get radioed about + if ((pSoldier->bSide == pOpponent->bSide) && (pOpponent->flags.uiStatusFlags & SOLDIER_PC)) + { #ifdef TESTOPPLIST - DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, - String("RS: same side %d",pSoldier->bSide) ); + DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, + String("RS: same side %d",pSoldier->bSide) ); #endif - continue; // skip to the next merc - } + continue; // skip to the next merc + } - // determine whether we think we're still unseen or if "our cover's blown" - // if we know about this opponent's location for any reason - if ((pOpponent->bVisible >= 0) || gbShowEnemies) - { - // and he can see us, then gotta figure we KNOW that he can see us - if (pOpponent->bOppList[pSoldier->ubID] == SEEN_CURRENTLY) - stillUnseen = FALSE; - } + // determine whether we think we're still unseen or if "our cover's blown" + // if we know about this opponent's location for any reason + if ((pOpponent->bVisible >= 0) || gbShowEnemies) + { + // and he can see us, then gotta figure we KNOW that he can see us + if (pOpponent->aiData.bOppList[pSoldier->ubID] == SEEN_CURRENTLY) + stillUnseen = FALSE; + } - // if we personally don't know a thing about this opponent - if (*pPersOL == NOT_HEARD_OR_SEEN) - { + // if we personally don't know a thing about this opponent + if (*pPersOL == NOT_HEARD_OR_SEEN) + { #ifdef RECORDOPPLIST - //fprintf(OpplistFile,"not heard or seen\n"); + //fprintf(OpplistFile,"not heard or seen\n"); #endif #ifdef TESTOPPLIST - DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, - String("RS: not heard or seen") ); + DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, + String("RS: not heard or seen") ); #endif - continue; // skip to the next opponent - } + continue; // skip to the next opponent + } - // if personal knowledge is NOT more up to date and NOT the same as public - if ((!gubKnowledgeValue[*pbPublOL - OLDEST_HEARD_VALUE][*pPersOL - OLDEST_HEARD_VALUE]) && - (*pbPublOL != *pPersOL)) - { + // if personal knowledge is NOT more up to date and NOT the same as public + if ((!gubKnowledgeValue[*pbPublOL - OLDEST_HEARD_VALUE][*pPersOL - OLDEST_HEARD_VALUE]) && + (*pbPublOL != *pPersOL)) + { #ifdef RECORDOPPLIST - //fprintf(OpplistFile,"no new knowledge (per %d, pub %d)\n",*pPersOL,*pbPublOL); -#endif - -#ifdef TESTOPPLIST - DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, - String("RS: no new knowledge per %d pub %d",*pPersOL,*pbPublOL) ); + //fprintf(OpplistFile,"no new knowledge (per %d, pub %d)\n",*pPersOL,*pbPublOL); #endif - - - continue; // skip to the next opponent - } +#ifdef TESTOPPLIST + DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, + String("RS: no new knowledge per %d pub %d",*pPersOL,*pbPublOL) ); +#endif + + + + continue; // skip to the next opponent + } #ifdef RECORDOPPLIST - //fprintf(OpplistFile,"made it!\n"); + //fprintf(OpplistFile,"made it!\n"); #endif #ifdef TESTOPPLIST - DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, - String("RS: made it!") ); + DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, + String("RS: made it!") ); #endif - // if it's our merc, and he currently sees this opponent - if (PTR_OURTEAM && (*pPersOL == SEEN_CURRENTLY) && !(( pOpponent->bSide == pSoldier->bSide) || pOpponent->bNeutral)) - { - // used by QueueDayMessage() to scroll to one of the new enemies - // scroll to the last guy seen, unless we see a hated guy, then use him! - if (!sightedHatedOpponent) - scrollToGuynum = pOpponent->ubID; + // if it's our merc, and he currently sees this opponent + if (PTR_OURTEAM && (*pPersOL == SEEN_CURRENTLY) && !(( pOpponent->bSide == pSoldier->bSide) || pOpponent->aiData.bNeutral)) + { + // used by QueueDayMessage() to scroll to one of the new enemies + // scroll to the last guy seen, unless we see a hated guy, then use him! + if (!sightedHatedOpponent) + scrollToGuynum = pOpponent->ubID; - // don't care whether and how many new enemies are seen if everyone visible - // and he's healthy enough to be a threat (so is worth talking about) + // don't care whether and how many new enemies are seen if everyone visible + // and he's healthy enough to be a threat (so is worth talking about) // do the following if we're radioing to our own team; if radioing to militia // then alert them instead if ( ubTeamToRadioTo != MILITIA_TEAM ) { - if (!gbShowEnemies && (pOpponent->bLife >= OKLIFE)) + if (!gbShowEnemies && (pOpponent->stats.bLife >= OKLIFE)) { - // if this enemy has not been publicly seen or heard recently - if (*pbPublOL == NOT_HEARD_OR_SEEN) - { - // chalk up another "unknown" enemy - unknownEnemies++; + // if this enemy has not been publicly seen or heard recently + if (*pbPublOL == NOT_HEARD_OR_SEEN) + { + // chalk up another "unknown" enemy + unknownEnemies++; fContactSeen = TRUE; - // if this enemy is hated by the merc doing the sighting - //if (MercHated(Proptr[ptr->characternum].p_bias,oppPtr->characternum)) - //sightedHatedOpponent = TRUE; + // if this enemy is hated by the merc doing the sighting + //if (MercHated(Proptr[ptr->characternum].p_bias,oppPtr->characternum)) + //sightedHatedOpponent = TRUE; - // now the important part: does this enemy see him/her back? - if (pOpponent->bOppList[pSoldier->ubID] != SEEN_CURRENTLY) - { - // EXPERIENCE GAIN (10): Discovered a new enemy without being seen - StatChange(pSoldier,EXPERAMT,10,FALSE); - } + // now the important part: does this enemy see him/her back? + if (pOpponent->aiData.bOppList[pSoldier->ubID] != SEEN_CURRENTLY) + { + // EXPERIENCE GAIN (10): Discovered a new enemy without being seen + StatChange(pSoldier,EXPERAMT,10,FALSE); + } } - else - { + else + { - // if he has publicly not been seen now, or anytime during this turn - if ((*pbPublOL != SEEN_CURRENTLY) && (*pbPublOL != SEEN_THIS_TURN)) + // if he has publicly not been seen now, or anytime during this turn + if ((*pbPublOL != SEEN_CURRENTLY) && (*pbPublOL != SEEN_THIS_TURN)) { - // chalk up another "revealed" enemy - revealedEnemies++; + // chalk up another "revealed" enemy + revealedEnemies++; fContactSeen = TRUE; } else { - if ( MercPtrs[0]->bLife < 10 ) + if ( MercPtrs[0]->stats.bLife < 10 ) { - int i = 0; + //int breakpoint = 0; } } - } + } if ( fContactSeen ) { @@ -3496,22 +3496,22 @@ DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, { // this has already come up so turn OFF the pause-all-anims flag for the previous // person and set it for this next person - MercPtrs[gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID]->fPauseAllAnimation = FALSE; + MercPtrs[gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID]->flags.fPauseAllAnimation = FALSE; } else { gTacticalStatus.fEnemySightingOnTheirTurn = TRUE; } gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID = pOpponent->ubID; - gTacticalStatus.ubEnemySightingOnTheirTurnPlayerID = pSoldier->ubID; + gTacticalStatus.ubEnemySightingOnTheirTurnPlayerID = pSoldier->ubID; gTacticalStatus.uiTimeSinceDemoOn = GetJA2Clock( ); - pOpponent->fPauseAllAnimation = TRUE; + pOpponent->flags.fPauseAllAnimation = TRUE; } } - if ( pOpponent->uiStatusFlags & SOLDIER_MONSTER ) + if ( pOpponent->flags.uiStatusFlags & SOLDIER_MONSTER ) { gfPlayerTeamSawCreatures = TRUE; } @@ -3525,7 +3525,7 @@ DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, } - if ( pOpponent->uiStatusFlags & SOLDIER_MONSTER ) + if ( pOpponent->flags.uiStatusFlags & SOLDIER_MONSTER ) { if ( !(gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags & PROFILE_MISC_FLAG_HAVESEENCREATURE) ) { @@ -3543,58 +3543,58 @@ DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, HandleInitialRedAlert( MILITIA_TEAM, FALSE ); } } - } // end of our team's merc sees new opponent + } // end of our team's merc sees new opponent - // IF WE'RE HERE, OUR PERSONAL INFORMATION IS AT LEAST AS UP-TO-DATE - // AS THE PUBLIC KNOWLEDGE, SO WE WILL REPLACE THE PUBLIC KNOWLEDGE + // IF WE'RE HERE, OUR PERSONAL INFORMATION IS AT LEAST AS UP-TO-DATE + // AS THE PUBLIC KNOWLEDGE, SO WE WILL REPLACE THE PUBLIC KNOWLEDGE #ifdef RECORDOPPLIST - fprintf(OpplistFile,"UpdatePublic (RadioSightings) for team %d about %d\n",ptr->team,oppPtr->guynum); + fprintf(OpplistFile,"UpdatePublic (RadioSightings) for team %d about %d\n",ptr->team,oppPtr->guynum); #endif #ifdef TESTOPPLIST - DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, - String("...............UPDATE PUBLIC: soldier %d SEEING soldier %d",pSoldier->ubID,pOpponent->ubID) ); + DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, + String("...............UPDATE PUBLIC: soldier %d SEEING soldier %d",pSoldier->ubID,pOpponent->ubID) ); #endif - UpdatePublic(ubTeamToRadioTo,pOpponent->ubID,*pPersOL,gsLastKnownOppLoc[pSoldier->ubID][pOpponent->ubID],gbLastKnownOppLevel[pSoldier->ubID][pOpponent->ubID]); - } + UpdatePublic(ubTeamToRadioTo,pOpponent->ubID,*pPersOL,gsLastKnownOppLoc[pSoldier->ubID][pOpponent->ubID],gbLastKnownOppLevel[pSoldier->ubID][pOpponent->ubID]); + } // if soldier heard a misc noise more important that his team's public one - if (pSoldier->ubNoiseVolume > gubPublicNoiseVolume[ubTeamToRadioTo]) - { - // replace the soldier's team's public noise with his - gsPublicNoiseGridno[ubTeamToRadioTo] = pSoldier->sNoiseGridno; - gbPublicNoiseLevel[ubTeamToRadioTo] = pSoldier->bNoiseLevel; - gubPublicNoiseVolume[ubTeamToRadioTo] = pSoldier->ubNoiseVolume; - } + if (pSoldier->aiData.ubNoiseVolume > gubPublicNoiseVolume[ubTeamToRadioTo]) + { + // replace the soldier's team's public noise with his + gsPublicNoiseGridno[ubTeamToRadioTo] = pSoldier->aiData.sNoiseGridno; + gbPublicNoiseLevel[ubTeamToRadioTo] = pSoldier->bNoiseLevel; + gubPublicNoiseVolume[ubTeamToRadioTo] = pSoldier->aiData.ubNoiseVolume; + } // if this soldier is on the local team - if (PTR_OURTEAM) - { - // don't trigger sighting quotes or stop merc's movement if everyone visible - //if (!(gTacticalStatus.uiFlags & SHOW_ALL_MERCS)) - { - // if we've revealed any enemies, or seen any previously unknown enemies - if (revealedEnemies || unknownEnemies) - { + if (PTR_OURTEAM) + { + // don't trigger sighting quotes or stop merc's movement if everyone visible + //if (!(gTacticalStatus.uiFlags & SHOW_ALL_MERCS)) + { + // if we've revealed any enemies, or seen any previously unknown enemies + if (revealedEnemies || unknownEnemies) + { // First check for a virgin map and set to false if we see our first guy.... // Only if this guy is an ememy! - OurTeamSeesSomeone( pSoldier, revealedEnemies, unknownEnemies ); + OurTeamSeesSomeone( pSoldier, revealedEnemies, unknownEnemies ); } else if (fSawCreatureForFirstTime) { gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags |= PROFILE_MISC_FLAG_HAVESEENCREATURE; - TacticalCharacterDialogue( pSoldier, QUOTE_FIRSTTIME_GAME_SEE_CREATURE ); + TacticalCharacterDialogue( pSoldier, QUOTE_FIRSTTIME_GAME_SEE_CREATURE ); } - } - } + } + } } @@ -3612,7 +3612,7 @@ void DebugSoldierPage1( ) SOLDIERTYPE *pSoldier; UINT16 usSoldierIndex; UINT32 uiMercFlags; - UINT16 usMapPos; + INT16 sMapPos; UINT8 ubLine=0; if ( FindSoldierFromMouse( &usSoldierIndex, &uiMercFlags ) ) @@ -3647,7 +3647,7 @@ void DebugSoldierPage1( ) SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"STATUS FLAGS:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%x", pSoldier->uiStatusFlags ); + gprintf( 150, LINE_HEIGHT * ubLine, L"%x", pSoldier->flags.uiStatusFlags ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); @@ -3672,13 +3672,13 @@ void DebugSoldierPage1( ) SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"Life:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->bLife ); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->stats.bLife ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"LifeMax:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->bLifeMax ); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->stats.bLifeMax ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); @@ -3691,88 +3691,88 @@ void DebugSoldierPage1( ) SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 200, LINE_HEIGHT * ubLine, L"Agility:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 350, LINE_HEIGHT * ubLine, L"%d ( %d )", pSoldier->bAgility, EffectiveAgility( pSoldier ) ); + gprintf( 350, LINE_HEIGHT * ubLine, L"%d ( %d )", pSoldier->stats.bAgility, EffectiveAgility( pSoldier ) ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 200, LINE_HEIGHT * ubLine, L"Dexterity:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 350, LINE_HEIGHT * ubLine, L"%d( %d )", pSoldier->bDexterity, EffectiveDexterity( pSoldier ) ); + gprintf( 350, LINE_HEIGHT * ubLine, L"%d( %d )", pSoldier->stats.bDexterity, EffectiveDexterity( pSoldier ) ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 200, LINE_HEIGHT * ubLine, L"Strength:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 350, LINE_HEIGHT * ubLine, L"%d", pSoldier->bStrength ); + gprintf( 350, LINE_HEIGHT * ubLine, L"%d", pSoldier->stats.bStrength ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 200, LINE_HEIGHT * ubLine, L"Wisdom:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 350, LINE_HEIGHT * ubLine, L"%d ( %d )", pSoldier->bWisdom, EffectiveWisdom( pSoldier ) ); + gprintf( 350, LINE_HEIGHT * ubLine, L"%d ( %d )", pSoldier->stats.bWisdom, EffectiveWisdom( pSoldier ) ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 200, LINE_HEIGHT * ubLine, L"Exp Lvl:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 350, LINE_HEIGHT * ubLine, L"%d ( %d )", pSoldier->bExpLevel, EffectiveExpLevel( pSoldier ) ); + gprintf( 350, LINE_HEIGHT * ubLine, L"%d ( %d )", pSoldier->stats.bExpLevel, EffectiveExpLevel( pSoldier ) ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 200, LINE_HEIGHT * ubLine, L"Mrksmnship:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 350, LINE_HEIGHT * ubLine, L"%d ( %d )", pSoldier->bMarksmanship, EffectiveMarksmanship( pSoldier ) ); + gprintf( 350, LINE_HEIGHT * ubLine, L"%d ( %d )", pSoldier->stats.bMarksmanship, EffectiveMarksmanship( pSoldier ) ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 200, LINE_HEIGHT * ubLine, L"Mechanical:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 350, LINE_HEIGHT * ubLine, L"%d", pSoldier->bMechanical); + gprintf( 350, LINE_HEIGHT * ubLine, L"%d", pSoldier->stats.bMechanical); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 200, LINE_HEIGHT * ubLine, L"Explosive:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 350, LINE_HEIGHT * ubLine, L"%d", pSoldier->bExplosive); + gprintf( 350, LINE_HEIGHT * ubLine, L"%d", pSoldier->stats.bExplosive); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 200, LINE_HEIGHT * ubLine, L"Medical:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 350, LINE_HEIGHT * ubLine, L"%d", pSoldier->bMedical); + gprintf( 350, LINE_HEIGHT * ubLine, L"%d", pSoldier->stats.bMedical); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 200, LINE_HEIGHT * ubLine, L"Drug Effects:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 400, LINE_HEIGHT * ubLine, L"%d", pSoldier->bDrugEffect[0] ); + gprintf( 400, LINE_HEIGHT * ubLine, L"%d", pSoldier->drugs.bDrugEffect[0] ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 200, LINE_HEIGHT * ubLine, L"Drug Side Effects:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 400, LINE_HEIGHT * ubLine, L"%d", pSoldier->bDrugSideEffect[0] ); + gprintf( 400, LINE_HEIGHT * ubLine, L"%d", pSoldier->drugs.bDrugSideEffect[0] ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 200, LINE_HEIGHT * ubLine, L"Booze Effects:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 400, LINE_HEIGHT * ubLine, L"%d", pSoldier->bDrugEffect[1] ); + gprintf( 400, LINE_HEIGHT * ubLine, L"%d", pSoldier->drugs.bDrugEffect[1] ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 200, LINE_HEIGHT * ubLine, L"Hangover Side Effects:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 400, LINE_HEIGHT * ubLine, L"%d", pSoldier->bDrugSideEffect[1] ); + gprintf( 400, LINE_HEIGHT * ubLine, L"%d", pSoldier->drugs.bDrugSideEffect[1] ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 200, LINE_HEIGHT * ubLine, L"AI has Keys:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 400, LINE_HEIGHT * ubLine, L"%d", pSoldier->bHasKeys ); + gprintf( 400, LINE_HEIGHT * ubLine, L"%d", pSoldier->flags.bHasKeys ); ubLine++; } - else if ( GetMouseMapPos( &usMapPos ) ) + else if ( GetMouseMapPos( &sMapPos ) ) { SetFont( LARGEFONT1 ); gprintf( 0,0,L"DEBUG LAND PAGE ONE" ); @@ -3795,8 +3795,8 @@ void DebugSoldierPage2( ) SOLDIERTYPE *pSoldier; UINT16 usSoldierIndex; UINT32 uiMercFlags; - UINT16 usMapPos; - TILE_ELEMENT TileElem; + INT16 sMapPos; + TILE_ELEMENT TileElem; LEVELNODE *pNode; UINT8 ubLine; @@ -3816,7 +3816,7 @@ void DebugSoldierPage2( ) SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->ubID ); ubLine++; - + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"Body Type:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); @@ -3826,7 +3826,7 @@ void DebugSoldierPage2( ) SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"Opp Cnt:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->bOppCnt); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->aiData.bOppCnt); ubLine++; if (pSoldier->bTeam == OUR_TEAM || pSoldier->bTeam == MILITIA_TEAM) // look at 8 to 15 opplist entries @@ -3834,8 +3834,8 @@ void DebugSoldierPage2( ) SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"Opplist B:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d %d %d %d %d %d %d %d", pSoldier->bOppList[20],pSoldier->bOppList[21],pSoldier->bOppList[22], - pSoldier->bOppList[23],pSoldier->bOppList[24],pSoldier->bOppList[25],pSoldier->bOppList[26],pSoldier->bOppList[27]); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d %d %d %d %d %d %d %d", pSoldier->aiData.bOppList[20],pSoldier->aiData.bOppList[21],pSoldier->aiData.bOppList[22], + pSoldier->aiData.bOppList[23],pSoldier->aiData.bOppList[24],pSoldier->aiData.bOppList[25],pSoldier->aiData.bOppList[26],pSoldier->aiData.bOppList[27]); ubLine++; } else // team 1 - enemies so look at first 8 (0-7) opplist entries @@ -3843,9 +3843,9 @@ void DebugSoldierPage2( ) SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"OppList A:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d %d %d %d %d %d %d %d", pSoldier->bOppList[0],pSoldier->bOppList[1],pSoldier->bOppList[2], - pSoldier->bOppList[3],pSoldier->bOppList[4],pSoldier->bOppList[5],pSoldier->bOppList[6], - pSoldier->bOppList[7]); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d %d %d %d %d %d %d %d", pSoldier->aiData.bOppList[0],pSoldier->aiData.bOppList[1],pSoldier->aiData.bOppList[2], + pSoldier->aiData.bOppList[3],pSoldier->aiData.bOppList[4],pSoldier->aiData.bOppList[5],pSoldier->aiData.bOppList[6], + pSoldier->aiData.bOppList[7]); ubLine++; } @@ -3864,7 +3864,7 @@ void DebugSoldierPage2( ) SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"DesDirection:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%S", gzDirectionStr[ pSoldier->bDesiredDirection] ); + gprintf( 150, LINE_HEIGHT * ubLine, L"%S", gzDirectionStr[ pSoldier->pathing.bDesiredDirection] ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); @@ -3876,47 +3876,47 @@ void DebugSoldierPage2( ) SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"Dest:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->sFinalDestination ); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->pathing.sFinalDestination ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"Path Size:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->usPathDataSize); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->pathing.usPathDataSize); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"Path Index:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->usPathIndex ); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->pathing.usPathIndex ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"First 3 Steps:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d %d %d", pSoldier->usPathingData[0], - pSoldier->usPathingData[1], - pSoldier->usPathingData[2] ); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d %d %d", pSoldier->pathing.usPathingData[0], + pSoldier->pathing.usPathingData[1], + pSoldier->pathing.usPathingData[2] ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"Next 3 Steps:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d %d %d", pSoldier->usPathingData[pSoldier->usPathIndex], - pSoldier->usPathingData[pSoldier->usPathIndex + 1], - pSoldier->usPathingData[pSoldier->usPathIndex + 2] ); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d %d %d", pSoldier->pathing.usPathingData[pSoldier->pathing.usPathIndex], + pSoldier->pathing.usPathingData[pSoldier->pathing.usPathIndex + 1], + pSoldier->pathing.usPathingData[pSoldier->pathing.usPathIndex + 2] ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"FlashInd:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->fFlashLocator ); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->flags.fFlashLocator ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"ShowInd:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->fShowLocator ); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->flags.fShowLocator ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); @@ -3931,17 +3931,17 @@ void DebugSoldierPage2( ) gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SECONDHANDPOS].usItem] ); ubLine++; - if ( GetMouseMapPos( &usMapPos ) ) + if ( GetMouseMapPos( &sMapPos ) ) { SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"CurrGridNo:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d", usMapPos ); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d", sMapPos ); ubLine++; } } - else if ( GetMouseMapPos( &usMapPos ) ) + else if ( GetMouseMapPos( &sMapPos ) ) { SetFont( LARGEFONT1 ); gprintf( 0,0,L"DEBUG LAND PAGE TWO" ); @@ -3952,24 +3952,24 @@ void DebugSoldierPage2( ) SetFontColors(COLOR1); mprintf( 0, LINE_HEIGHT * ubLine, L"Land Raised:"); SetFontColors(COLOR2); - mprintf( 150, LINE_HEIGHT * ubLine, L"%d", gpWorldLevelData[ usMapPos ].sHeight ); + mprintf( 150, LINE_HEIGHT * ubLine, L"%d", gpWorldLevelData[ sMapPos ].sHeight ); ubLine++; SetFontColors(COLOR1); mprintf( 0, LINE_HEIGHT * ubLine, L"Land Node:"); SetFontColors(COLOR2); - mprintf( 150, LINE_HEIGHT * ubLine, L"%x", gpWorldLevelData[ usMapPos ].pLandHead ); + mprintf( 150, LINE_HEIGHT * ubLine, L"%x", gpWorldLevelData[ sMapPos ].pLandHead ); ubLine++; - if ( gpWorldLevelData[ usMapPos ].pLandHead != NULL ) + if ( gpWorldLevelData[ sMapPos ].pLandHead != NULL ) { SetFontColors(COLOR1); mprintf( 0, LINE_HEIGHT * ubLine, L"Land Node:"); SetFontColors(COLOR2); - mprintf( 150, LINE_HEIGHT * ubLine, L"%d", gpWorldLevelData[ usMapPos ].pLandHead->usIndex ); + mprintf( 150, LINE_HEIGHT * ubLine, L"%d", gpWorldLevelData[ sMapPos ].pLandHead->usIndex ); ubLine++; - TileElem = gTileDatabase[ gpWorldLevelData[ usMapPos ].pLandHead->usIndex ]; + TileElem = gTileDatabase[ gpWorldLevelData[ sMapPos ].pLandHead->usIndex ]; // Check for full tile SetFontColors(COLOR1); @@ -3982,77 +3982,77 @@ void DebugSoldierPage2( ) SetFontColors(COLOR1); mprintf( 0, LINE_HEIGHT * ubLine, L"Land St Node:"); SetFontColors(COLOR2); - mprintf( 150, LINE_HEIGHT * ubLine, L"%x", gpWorldLevelData[ usMapPos ].pLandStart ); + mprintf( 150, LINE_HEIGHT * ubLine, L"%x", gpWorldLevelData[ sMapPos ].pLandStart ); ubLine++; SetFontColors(COLOR1); mprintf( 0, LINE_HEIGHT * ubLine, L"GRIDNO:"); SetFontColors(COLOR2); - mprintf( 150, LINE_HEIGHT * ubLine, L"%d", usMapPos ); + mprintf( 150, LINE_HEIGHT * ubLine, L"%d", sMapPos ); ubLine++; - if ( gpWorldLevelData[ usMapPos ].uiFlags & MAPELEMENT_MOVEMENT_RESERVED ) + if ( gpWorldLevelData[ sMapPos ].uiFlags & MAPELEMENT_MOVEMENT_RESERVED ) { SetFontColors(COLOR2); - mprintf( 0, LINE_HEIGHT * ubLine, L"Merc: %d", gpWorldLevelData[ usMapPos ].ubReservedSoldierID ); + mprintf( 0, LINE_HEIGHT * ubLine, L"Merc: %d", gpWorldLevelData[ sMapPos ].ubReservedSoldierID ); SetFontColors(COLOR2); - mprintf( 150, LINE_HEIGHT * ubLine, L"RESERVED MOVEMENT FLAG ON:" ); + mprintf( 150, LINE_HEIGHT * ubLine, L"RESERVED MOVEMENT FLAG ON:" ); ubLine++; } - pNode = GetCurInteractiveTile( ); - + pNode = GetCurInteractiveTile( ); + if ( pNode != NULL ) { SetFontColors(COLOR2); - mprintf( 0, LINE_HEIGHT * ubLine, L"Tile: %d", pNode->usIndex ); + mprintf( 0, LINE_HEIGHT * ubLine, L"Tile: %d", pNode->usIndex ); SetFontColors(COLOR2); - mprintf( 150, LINE_HEIGHT * ubLine, L"ON INT TILE" ); + mprintf( 150, LINE_HEIGHT * ubLine, L"ON INT TILE" ); ubLine++; } - if ( gpWorldLevelData[ usMapPos ].uiFlags & MAPELEMENT_REVEALED ) + if ( gpWorldLevelData[ sMapPos ].uiFlags & MAPELEMENT_REVEALED ) { SetFontColors(COLOR2); - //mprintf( 0, LINE_HEIGHT * 9, L"Merc: %d", gpWorldLevelData[ usMapPos ].ubReservedSoldierID ); + //mprintf( 0, LINE_HEIGHT * 9, L"Merc: %d", gpWorldLevelData[ sMapPos ].ubReservedSoldierID ); SetFontColors(COLOR2); - mprintf( 150, LINE_HEIGHT * ubLine, L"REVEALED" ); + mprintf( 150, LINE_HEIGHT * ubLine, L"REVEALED" ); ubLine++; } - if ( gpWorldLevelData[ usMapPos ].uiFlags & MAPELEMENT_RAISE_LAND_START ) + if ( gpWorldLevelData[ sMapPos ].uiFlags & MAPELEMENT_RAISE_LAND_START ) { SetFontColors(COLOR2); - //mprintf( 0, LINE_HEIGHT * 9, L"Merc: %d", gpWorldLevelData[ usMapPos ].ubReservedSoldierID ); + //mprintf( 0, LINE_HEIGHT * 9, L"Merc: %d", gpWorldLevelData[ sMapPos ].ubReservedSoldierID ); SetFontColors(COLOR2); - mprintf( 150, LINE_HEIGHT * ubLine, L"Land Raise Start" ); + mprintf( 150, LINE_HEIGHT * ubLine, L"Land Raise Start" ); ubLine++; } - if ( gpWorldLevelData[ usMapPos ].uiFlags & MAPELEMENT_RAISE_LAND_END ) + if ( gpWorldLevelData[ sMapPos ].uiFlags & MAPELEMENT_RAISE_LAND_END ) { SetFontColors(COLOR2); - //mprintf( 0, LINE_HEIGHT * 9, L"Merc: %d", gpWorldLevelData[ usMapPos ].ubReservedSoldierID ); + //mprintf( 0, LINE_HEIGHT * 9, L"Merc: %d", gpWorldLevelData[ sMapPos ].ubReservedSoldierID ); SetFontColors(COLOR2); - mprintf( 150, LINE_HEIGHT * ubLine, L"Raise Land End" ); + mprintf( 150, LINE_HEIGHT * ubLine, L"Raise Land End" ); ubLine++; } - if (gubWorldRoomInfo[ usMapPos ] != NO_ROOM ) + if (gubWorldRoomInfo[ sMapPos ] != NO_ROOM ) { SetFontColors(COLOR2); - mprintf( 0, LINE_HEIGHT * ubLine, L"Room Number" ); + mprintf( 0, LINE_HEIGHT * ubLine, L"Room Number" ); SetFontColors(COLOR2); - mprintf( 150, LINE_HEIGHT * ubLine, L"%d", gubWorldRoomInfo[ usMapPos ] ); + mprintf( 150, LINE_HEIGHT * ubLine, L"%d", gubWorldRoomInfo[ sMapPos ] ); ubLine++; } - if ( gpWorldLevelData[ usMapPos ].ubExtFlags[0] & MAPELEMENT_EXT_NOBURN_STRUCT ) + if ( gpWorldLevelData[ sMapPos ].ubExtFlags[0] & MAPELEMENT_EXT_NOBURN_STRUCT ) { SetFontColors(COLOR2); - mprintf( 0, LINE_HEIGHT * ubLine, L"Don't Use Burn Through For Soldier" ); + mprintf( 0, LINE_HEIGHT * ubLine, L"Don't Use Burn Through For Soldier" ); ubLine++; } @@ -4066,7 +4066,7 @@ void DebugSoldierPage3( ) SOLDIERTYPE *pSoldier; UINT16 usSoldierIndex; UINT32 uiMercFlags; - UINT16 usMapPos; + INT16 sMapPos; UINT8 ubLine; if ( FindSoldierFromMouse( &usSoldierIndex, &uiMercFlags ) ) @@ -4077,7 +4077,7 @@ void DebugSoldierPage3( ) SetFont( LARGEFONT1 ); gprintf( 0,0,L"DEBUG SOLDIER PAGE THREE, GRIDNO %d", pSoldier->sGridNo ); SetFont( LARGEFONT1 ); - + ubLine = 2; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); @@ -4089,37 +4089,37 @@ void DebugSoldierPage3( ) SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"Action:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%S", gzActionStr[ pSoldier->bAction ] ); - if (pSoldier->uiStatusFlags & SOLDIER_ENEMY ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%S", gzActionStr[ pSoldier->aiData.bAction ] ); + if (pSoldier->flags.uiStatusFlags & SOLDIER_ENEMY ) { - gprintf( 350, LINE_HEIGHT * ubLine, L"Alert %S", gzAlertStr[ pSoldier->bAlertStatus ] ); + gprintf( 350, LINE_HEIGHT * ubLine, L"Alert %S", gzAlertStr[ pSoldier->aiData.bAlertStatus ] ); } ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"Action Data:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->usActionData ); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->aiData.usActionData ); - if (pSoldier->uiStatusFlags & SOLDIER_ENEMY ) + if (pSoldier->flags.uiStatusFlags & SOLDIER_ENEMY ) { - gprintf( 350, LINE_HEIGHT * ubLine, L"AIMorale %d", pSoldier->bAIMorale ); + gprintf( 350, LINE_HEIGHT * ubLine, L"AIMorale %d", pSoldier->aiData.bAIMorale ); } else { - gprintf( 350, LINE_HEIGHT * ubLine, L"Morale %d", pSoldier->bMorale ); + gprintf( 350, LINE_HEIGHT * ubLine, L"Morale %d", pSoldier->aiData.bMorale ); } ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"Delayed Movement:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->fDelayedMovement ); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->flags.fDelayedMovement ); if ( gubWatchedLocPoints[ pSoldier->ubID ][ 0 ] > 0 ) { - gprintf( 350, LINE_HEIGHT * ubLine, L"Watch %d/%d for %d pts", - gsWatchedLoc[ pSoldier->ubID ][ 0 ], - gbWatchedLocLevel[ pSoldier->ubID ][ 0 ], + gprintf( 350, LINE_HEIGHT * ubLine, L"Watch %d/%d for %d pts", + gsWatchedLoc[ pSoldier->ubID ][ 0 ], + gbWatchedLocLevel[ pSoldier->ubID ][ 0 ], gubWatchedLocPoints[ pSoldier->ubID ][ 0 ] ); } @@ -4129,13 +4129,13 @@ void DebugSoldierPage3( ) SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"ActionInProg:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->bActionInProgress); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->aiData.bActionInProgress); ubLine++; if ( gubWatchedLocPoints[ pSoldier->ubID ][ 1 ] > 0 ) { - gprintf( 350, LINE_HEIGHT * ubLine, L"Watch %d/%d for %d pts", - gsWatchedLoc[ pSoldier->ubID ][ 1 ], - gbWatchedLocLevel[ pSoldier->ubID ][ 1 ], + gprintf( 350, LINE_HEIGHT * ubLine, L"Watch %d/%d for %d pts", + gsWatchedLoc[ pSoldier->ubID ][ 1 ], + gbWatchedLocLevel[ pSoldier->ubID ][ 1 ], gubWatchedLocPoints[ pSoldier->ubID ][ 1 ] ); } @@ -4143,14 +4143,14 @@ void DebugSoldierPage3( ) SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"Last Action:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%S", gzActionStr[ pSoldier->bLastAction ] ); + gprintf( 150, LINE_HEIGHT * ubLine, L"%S", gzActionStr[ pSoldier->aiData.bLastAction ] ); ubLine++; if ( gubWatchedLocPoints[ pSoldier->ubID ][ 2 ] > 0 ) { - gprintf( 350, LINE_HEIGHT * ubLine, L"Watch %d/%d for %d pts", - gsWatchedLoc[ pSoldier->ubID ][ 2 ], - gbWatchedLocLevel[ pSoldier->ubID ][ 2 ], + gprintf( 350, LINE_HEIGHT * ubLine, L"Watch %d/%d for %d pts", + gsWatchedLoc[ pSoldier->ubID ][ 2 ], + gbWatchedLocLevel[ pSoldier->ubID ][ 2 ], gubWatchedLocPoints[ pSoldier->ubID ][ 2 ] ); } @@ -4164,9 +4164,9 @@ void DebugSoldierPage3( ) /* if ( gubWatchedLocPoints[ pSoldier->ubID ][ 3 ] > 0 ) { - gprintf( 350, LINE_HEIGHT * ubLine, L"Watch %d/%d for %d pts", - gsWatchedLoc[ pSoldier->ubID ][ 3 ], - gbWatchedLocLevel[ pSoldier->ubID ][ 3 ], + gprintf( 350, LINE_HEIGHT * ubLine, L"Watch %d/%d for %d pts", + gsWatchedLoc[ pSoldier->ubID ][ 3 ], + gbWatchedLocLevel[ pSoldier->ubID ][ 3 ], gubWatchedLocPoints[ pSoldier->ubID ][ 3 ] ); } @@ -4175,7 +4175,7 @@ void DebugSoldierPage3( ) SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"Getting Hit:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->fGettingHit ); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->flags.fGettingHit ); if (pSoldier->ubCivilianGroup != 0) { @@ -4188,7 +4188,7 @@ void DebugSoldierPage3( ) SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->ubSuppressionPoints ); ubLine++; - + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"Attacker ID:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); @@ -4198,7 +4198,7 @@ void DebugSoldierPage3( ) SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"EndAINotCalled:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->fTurnInProgress ); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->flags.fTurnInProgress ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); @@ -4228,7 +4228,7 @@ void DebugSoldierPage3( ) SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"No APS To fin Move:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->fNoAPToFinishMove ); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->flags.fNoAPToFinishMove ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); @@ -4240,7 +4240,7 @@ void DebugSoldierPage3( ) SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"Reloading:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->fReloading ); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->flags.fReloading ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); @@ -4252,13 +4252,13 @@ void DebugSoldierPage3( ) SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"Anim non-int:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->fInNonintAnim ); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->flags.fInNonintAnim ); ubLine++; SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"RT Anim non-int:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->fRTInNonintAnim ); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->flags.fRTInNonintAnim ); ubLine++; // OPIONION OF SELECTED MERC @@ -4272,17 +4272,17 @@ void DebugSoldierPage3( ) } } - else if ( GetMouseMapPos( &usMapPos ) ) + else if ( GetMouseMapPos( &sMapPos ) ) { DOOR_STATUS *pDoorStatus; STRUCTURE *pStructure; - + SetFont( LARGEFONT1 ); gprintf( 0,0,L"DEBUG LAND PAGE THREE" ); SetFont( LARGEFONT1 ); // OK, display door information here..... - pDoorStatus = GetDoorStatus( usMapPos ); + pDoorStatus = GetDoorStatus( sMapPos ); ubLine = 1; @@ -4299,7 +4299,7 @@ void DebugSoldierPage3( ) SetFontColors(COLOR1); mprintf( 0, LINE_HEIGHT * ubLine, L"Door Status Found:"); SetFontColors(COLOR2); - mprintf( 150, LINE_HEIGHT * ubLine, L" %d", usMapPos ); + mprintf( 150, LINE_HEIGHT * ubLine, L" %d", sMapPos ); ubLine++; SetFontColors(COLOR1); @@ -4340,7 +4340,7 @@ void DebugSoldierPage3( ) } //Find struct data and se what it says...... - pStructure = FindStructure( usMapPos, STRUCTURE_ANYDOOR ); + pStructure = FindStructure( sMapPos, STRUCTURE_ANYDOOR ); if ( pStructure == NULL ) { @@ -4391,23 +4391,21 @@ void WriteQuantityAndAttachments( OBJECTTYPE *pObject, INT32 yp ) { CHAR16 szAttach[30]; BOOLEAN fAttachments; - //100% Qty: 2 Attach: - //100% Qty: 2 - //100% Attach: + //100% Qty: 2 Attach: + //100% Qty: 2 + //100% Attach: //100% - if( !pObject->usItem ) + if( pObject->exists() == false ) return; //Build attachment string fAttachments = FALSE; - if( pObject->usAttachItem[0] || pObject->usAttachItem[1] || - pObject->usAttachItem[2] || pObject->usAttachItem[3] ) + if( (*pObject)[0]->attachments.empty() == false ) { fAttachments = TRUE; swprintf( szAttach, L"(" ); - AppendAttachmentCode( pObject->usAttachItem[0], szAttach ); - AppendAttachmentCode( pObject->usAttachItem[1], szAttach ); - AppendAttachmentCode( pObject->usAttachItem[2], szAttach ); - AppendAttachmentCode( pObject->usAttachItem[3], szAttach ); + for (attachmentList::iterator iter = (*pObject)[0]->attachments.begin(); iter != (*pObject)[0]->attachments.end(); ++iter) { + AppendAttachmentCode( iter->usItem, szAttach ); + } wcscat( szAttach, L" )" ); } @@ -4418,36 +4416,36 @@ void WriteQuantityAndAttachments( OBJECTTYPE *pObject, INT32 yp ) CHAR16 str[100]; CHAR16 temp[10]; UINT8 i; - swprintf( str, L"Clips: %d (%d", pObject->ubNumberOfObjects, pObject->ItemData.Generic.bStatus[0] ); + swprintf( str, L"Clips: %d (%d", pObject->ubNumberOfObjects, (*pObject)[0]->data.objectStatus ); for( i = 1; i < pObject->ubNumberOfObjects; i++ ) { - swprintf( temp, L", %d", pObject->ItemData.Generic.bStatus[0] ); + swprintf( temp, L", %d", (*pObject)[0]->data.objectStatus ); wcscat( str, temp ); } wcscat( str, L")" ); - gprintf( 320, yp, str ); + gprintf( 320, yp, str ); } else - gprintf( 320, yp, L"%d rounds", pObject->ItemData.Generic.bStatus[0] ); + gprintf( 320, yp, L"%d rounds", (*pObject)[0]->data.objectStatus ); return; } if( pObject->ubNumberOfObjects > 1 && fAttachments ) { //everything - gprintf( 320, yp, L"%d%% Qty: %d %s", - pObject->ItemData.Generic.bStatus[0], pObject->ubNumberOfObjects, szAttach ); + gprintf( 320, yp, L"%d%% Qty: %d %s", + (*pObject)[0]->data.objectStatus, pObject->ubNumberOfObjects, szAttach ); } else if( pObject->ubNumberOfObjects > 1 ) { //condition and quantity - gprintf( 320, yp, L"%d%% Qty: %d ", - pObject->ItemData.Generic.bStatus[0], pObject->ubNumberOfObjects ); + gprintf( 320, yp, L"%d%% Qty: %d ", + (*pObject)[0]->data.objectStatus, pObject->ubNumberOfObjects ); } else if( fAttachments ) { //condition and attachments - gprintf( 320, yp, L"%d%% %s", pObject->ItemData.Generic.bStatus[0], szAttach ); + gprintf( 320, yp, L"%d%% %s", (*pObject)[0]->data.objectStatus, szAttach ); } else { //condition - gprintf( 320, yp, L"%d%%", pObject->ItemData.Generic.bStatus[0] ); + gprintf( 320, yp, L"%d%%", (*pObject)[0]->data.objectStatus ); } } @@ -4473,7 +4471,7 @@ void DebugSoldierPage4( ) SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"Exp. Level:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->bExpLevel ); + gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->stats.bExpLevel ); switch( pSoldier->ubSoldierClass ) { case SOLDIER_CLASS_ADMINISTRATOR: gprintf( 320, LINE_HEIGHT * ubLine, L"(Administrator)" ); break; @@ -4484,14 +4482,14 @@ void DebugSoldierPage4( ) case SOLDIER_CLASS_REG_MILITIA: gprintf( 320, LINE_HEIGHT * ubLine, L"(Reg Militia)" ); break; case SOLDIER_CLASS_ELITE_MILITIA: gprintf( 320, LINE_HEIGHT * ubLine, L"(Elite Militia)" ); break; case SOLDIER_CLASS_MINER: gprintf( 320, LINE_HEIGHT * ubLine, L"(Miner)" ); break; - default: break; //don't care (don't write anything) + default: break; //don't care (don't write anything) } ubLine++; if( pSoldier->bTeam != OUR_TEAM ) { SOLDIERINITNODE *pNode; - switch( pSoldier->bOrders ) + switch( pSoldier->aiData.bOrders ) { case STATIONARY: swprintf( szOrders, L"STATIONARY" ); break; case ONGUARD: swprintf( szOrders, L"ON GUARD" ); break; @@ -4504,7 +4502,7 @@ void DebugSoldierPage4( ) case SNIPER: swprintf( szOrders, L"SNIPER" ); break; default: swprintf( szOrders, L"UNKNOWN" ); break; } - switch( pSoldier->bAttitude ) + switch( pSoldier->aiData.bAttitude ) { case DEFENSIVE: swprintf( szAttitude, L"DEFENSIVE" ); break; case BRAVESOLO: swprintf( szAttitude, L"BRAVE SOLO" ); break; @@ -4525,12 +4523,12 @@ void DebugSoldierPage4( ) if( pNode ) { gprintf( 0, LINE_HEIGHT * ubLine, L"%s, %s, REL EQUIP: %d, REL ATTR: %d", - szOrders, szAttitude, pNode->pBasicPlacement->bRelativeEquipmentLevel, + szOrders, szAttitude, pNode->pBasicPlacement->bRelativeEquipmentLevel, pNode->pBasicPlacement->bRelativeAttributeLevel ); } else { - gprintf( 0, LINE_HEIGHT * ubLine, L"%s, %s", szOrders, szAttitude ); + gprintf( 0, LINE_HEIGHT * ubLine, L"%s, %s", szOrders, szAttitude ); } ubLine++; } @@ -4629,6 +4627,63 @@ void DebugSoldierPage4( ) WriteQuantityAndAttachments( &pSoldier->inv[BIGPOCK4POS], LINE_HEIGHT*ubLine ); ubLine++; + // CHRISL: Added entries for all the new inventory pockets. + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"BIGPOCK5POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[BIGPOCK5POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[BIGPOCK5POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[BIGPOCK5POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"BIGPOCK6POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[BIGPOCK6POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[BIGPOCK6POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[BIGPOCK6POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"BIGPOCK7POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[BIGPOCK7POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[BIGPOCK7POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[BIGPOCK7POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"MEDPOCK1POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[MEDPOCK1POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[MEDPOCK1POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[MEDPOCK1POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"MEDPOCK2POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[MEDPOCK2POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[MEDPOCK2POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[MEDPOCK2POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"MEDPOCK3POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[MEDPOCK3POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[MEDPOCK3POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[MEDPOCK3POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"MEDPOCK4POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[MEDPOCK4POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[MEDPOCK4POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[MEDPOCK4POS], LINE_HEIGHT*ubLine ); + ubLine++; + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK1POS:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); @@ -4685,6 +4740,7 @@ void DebugSoldierPage4( ) WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK7POS], LINE_HEIGHT*ubLine ); ubLine++; + // CHRISL: Added entries for all the new inventory pockets SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK8POS:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); @@ -4692,6 +4748,182 @@ void DebugSoldierPage4( ) gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK8POS].usItem] ); WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK8POS], LINE_HEIGHT*ubLine ); ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK9POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[SMALLPOCK9POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK9POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK9POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK10POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[SMALLPOCK10POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK10POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK10POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK11POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[SMALLPOCK11POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK11POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK11POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK12POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[SMALLPOCK12POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK12POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK12POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK13POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[SMALLPOCK13POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK13POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK13POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK14POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[SMALLPOCK14POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK14POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK14POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK15POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[SMALLPOCK15POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK15POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK15POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK16POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[SMALLPOCK16POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK16POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK16POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK17POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[SMALLPOCK17POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK17POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK17POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK18POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[SMALLPOCK18POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK18POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK18POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK19POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[SMALLPOCK19POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK19POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK19POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK20POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[SMALLPOCK20POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK20POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK20POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK21POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[SMALLPOCK21POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK21POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK21POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK22POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[SMALLPOCK22POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK22POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK22POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK23POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[SMALLPOCK23POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK23POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK23POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK24POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[SMALLPOCK24POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK24POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK24POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK25POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[SMALLPOCK25POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK25POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK25POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK26POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[SMALLPOCK26POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK26POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK26POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK27POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[SMALLPOCK27POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK27POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK27POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK28POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[SMALLPOCK28POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK28POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK28POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK29POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[SMALLPOCK29POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK29POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK29POS], LINE_HEIGHT*ubLine ); + ubLine++; + + SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); + gprintf( 0, LINE_HEIGHT * ubLine, L"SMALLPOCK30POS:"); + SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); + if( pSoldier->inv[SMALLPOCK30POS].usItem ) + gprintf( 150, LINE_HEIGHT * ubLine, L"%s", ShortItemNames[pSoldier->inv[SMALLPOCK30POS].usItem] ); + WriteQuantityAndAttachments( &pSoldier->inv[SMALLPOCK30POS], LINE_HEIGHT*ubLine ); + ubLine++; } else { @@ -4701,7 +4933,7 @@ void DebugSoldierPage4( ) } } -// +// // Noise stuff // @@ -4714,7 +4946,7 @@ UINT8 MovementNoise( SOLDIERTYPE *pSoldier ) INT8 bInWater = FALSE; if ( pSoldier->bTeam == ENEMY_TEAM ) - { + { return( (UINT8) (MAX_MOVEMENT_NOISE - PreRandom( 2 )) ); } @@ -4737,8 +4969,8 @@ UINT8 MovementNoise( SOLDIERTYPE *pSoldier ) //NumMessage("Base Stealth = ",stealthSkill); - ubBandaged = pSoldier->bLifeMax - pSoldier->bLife - pSoldier->bBleeding; - ubEffLife = pSoldier->bLife + (ubBandaged / 2); + ubBandaged = pSoldier->stats.bLifeMax - pSoldier->stats.bLife - pSoldier->bBleeding; + ubEffLife = pSoldier->stats.bLife + (ubBandaged / 2); // IF "SNEAKER'S" "EFFECTIVE LIFE" IS AT LESS THAN 50 if (ubEffLife < 50) @@ -4764,15 +4996,15 @@ UINT8 MovementNoise( SOLDIERTYPE *pSoldier ) iStealthSkill -= 20; // 20% penalty } - if ( pSoldier->bDrugEffect[ DRUG_TYPE_ADRENALINE ] ) + if ( pSoldier->drugs.bDrugEffect[ DRUG_TYPE_ADRENALINE ] ) { // minus 3 percent per bonus AP from adrenaline - iStealthSkill -= 3 * pSoldier->bDrugEffect[ DRUG_TYPE_ADRENALINE ]; + iStealthSkill -= 3 * pSoldier->drugs.bDrugEffect[ DRUG_TYPE_ADRENALINE ]; } /* // if sneaker is too eager and impatient to "do it right" - if ((pSoldier->bTrait == OVER_ENTHUS) || (pSoldier->bAttitude == AGGRESSIVE)) + if ((pSoldier->bTrait == OVER_ENTHUS) || (pSoldier->aiData.bAttitude == AGGRESSIVE)) { ubStealthSkill -= 10; // 10% penalty } @@ -4815,7 +5047,7 @@ UINT8 MovementNoise( SOLDIERTYPE *pSoldier ) { iRoll = (INT32) PreRandom(100); // roll them bones! - if (iRoll >= iStealthSkill) // v1.13 modification: give a second chance! + if (iRoll >= iStealthSkill) // v1.13 modification: give a second chance! { iRoll = (INT32) PreRandom(100); } @@ -4826,7 +5058,7 @@ UINT8 MovementNoise( SOLDIERTYPE *pSoldier ) } else // OOPS! { - ubVolume = 1 + ((iRoll - iStealthSkill + 1) / 16); // volume is 1 - 7 ... + ubVolume = 1 + ((iRoll - iStealthSkill + 1) / 16); // volume is 1 - 7 ... switch (pSoldier->usAnimState) { case CRAWLING: @@ -4863,7 +5095,7 @@ UINT8 DoorOpeningNoise( SOLDIERTYPE *pSoldier ) UINT8 ubDoorNoise; // door being opened gridno is always the pending-action-data2 value - sGridNo = pSoldier->sPendingActionData2; + sGridNo = pSoldier->aiData.sPendingActionData2; pDoorStatus = GetDoorStatus( sGridNo ); if ( pDoorStatus && pDoorStatus->ubFlags & DOOR_HAS_TIN_CAN ) @@ -4884,7 +5116,7 @@ UINT8 DoorOpeningNoise( SOLDIERTYPE *pSoldier ) { // succeeded in being stealthy! return( 0 ); - } + } } void MakeNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType ) @@ -4909,7 +5141,7 @@ void MakeNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrType, // now call directly OurNoise( SNoise.ubNoiseMaker, SNoise.sGridNo, SNoise.bLevel, SNoise.ubTerrType, SNoise.ubVolume, SNoise.ubNoiseType ); - + } /* @@ -4954,7 +5186,7 @@ void MakeNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrType, { // EXPECTED_SEND, TheirNoise() will be triggered by the arrival of the - // NET_NOISE message, not by us. Wait here until that's all done... + // NET_NOISE message, not by us. Wait here until that's all done... // wait for the NET_NOISE to arrive (it will set noiseReceived flag) //stopAction = TRUE; // prevent real-time events from passing us by @@ -4985,7 +5217,6 @@ void MakeNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrType, void OurNoise( UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType ) { - INT8 bSendNoise = FALSE; SOLDIERTYPE *pSoldier; @@ -4995,8 +5226,8 @@ void OurNoise( UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrType, #ifdef BETAVERSION - sprintf(tempstr,"OurNoise: ubNoiseType = %s, ubNoiseMaker = %d, ubNoiseMode = %d, sGridNo = %d, ubVolume = %d", - NoiseTypeStr[ubNoiseType],ubNoiseMaker,ubNoiseMode,sGridNo,ubVolume); + tempstr = String("OurNoise: ubNoiseType = %s, ubNoiseMaker = %d, ubNoiseMode = %d, sGridNo = %d, ubVolume = %d", + NoiseTypeStr[ubNoiseType],ubNoiseMaker,ubNoiseMode,sGridNo,ubVolume); #ifdef RECORDNET fprintf(NetDebugFile,"\t%s\n",tempstr); #endif @@ -5034,8 +5265,8 @@ void TheirNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrType #ifdef BETAVERSION - sprintf(tempstr,"TheirNoise: ubNoiseType = %s, ubNoiseMaker = %d, ubNoiseMode = %d, sGridNo = %d, ubVolume = %d", - NoiseTypeStr[ubNoiseType],ubNoiseMaker,ubNoiseMode,sGridNo,ubVolume); + tempstr = String("TheirNoise: ubNoiseType = %s, ubNoiseMaker = %d, ubNoiseMode = %d, sGridNo = %d, ubVolume = %d", + NoiseTypeStr[ubNoiseType],ubNoiseMaker,ubNoiseMode,sGridNo,ubVolume); #ifdef RECORDNET fprintf(NetDebugFile,"\t%s\n",tempstr); #endif @@ -5066,7 +5297,7 @@ void TheirNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrType else { // the gridno is added to end of the string by KeyHitReport itself... - sprintf(tempstr,"TheirNoise: Waiting for NOISE_INT_DONE for guynum %d, ubNoiseType %d(%s), sGridNo ", + tempstr = String("TheirNoise: Waiting for NOISE_INT_DONE for guynum %d, ubNoiseType %d(%s), sGridNo ", pSoldier->guynum,ubNoiseType,NoiseTypeStr[ubNoiseType]); KeyHitReport(tempstr,sGridNo); } @@ -5108,7 +5339,7 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrTy // EXPLOSIONs are special, because they COULD be caused by a merc who is // no longer alive (but he placed the bomb or flaky grenade in the past). - // Later noiseMaker gets whacked to NOBODY anyway, so that's OK. So a + // Later noiseMaker gets whacked to NOBODY anyway, so that's OK. So a // dead noiseMaker is only used here to decide WHICH soldiers HearNoise(). // if noise is made by a person, AND it's not noise from an explosion @@ -5116,7 +5347,7 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrTy { // inactive/not in sector/dead soldiers, shouldn't be making noise! if (!Menptr[ubNoiseMaker].bActive || !Menptr[ubNoiseMaker].bInSector || - Menptr[ubNoiseMaker].uiStatusFlags & SOLDIER_DEAD) + Menptr[ubNoiseMaker].flags.uiStatusFlags & SOLDIER_DEAD) { #ifdef BETAVERSION NumMessage("ProcessNoise: ERROR - Noisemaker is inactive/not in sector/dead, Guy #",ubNoiseMaker); @@ -5125,7 +5356,7 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrTy } // if he's out of life, and this isn't just his "dying scream" which is OK - if (!Menptr[ubNoiseMaker].bLife && (ubNoiseType != NOISE_SCREAM)) + if (!Menptr[ubNoiseMaker].stats.bLife && (ubNoiseType != NOISE_SCREAM)) { #ifdef BETAVERSION NumMessage("ProcessNoise: ERROR - Noisemaker is lifeless, Guy #",ubNoiseMaker); @@ -5203,7 +5434,7 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrTy { continue; } - + if (gTacticalStatus.Team[bTeam].bHuman) { if (gbPublicOpplist[bTeam][ubNoiseMaker] == SEEN_CURRENTLY) @@ -5232,11 +5463,11 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrTy case NOISE_BULLET_IMPACT: case NOISE_ROCK_IMPACT: case NOISE_GRENADE_IMPACT: - // It's noise caused by a projectile. If the projectile was seen by + // It's noise caused by a projectile. If the projectile was seen by // the local player while in flight (PublicBullet), then don't bother // giving him a message about the noise it made, he's obviously aware. if (1 /*PublicBullet*/) - { + { bTellPlayer = FALSE; } @@ -5262,7 +5493,7 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrTy // if noisemaker has been *PUBLICLY* SEEN OR HEARD during THIS TURN if ((gbPublicOpplist[bTeam][ubNoiseMaker] == SEEN_CURRENTLY) || // seen now (gbPublicOpplist[bTeam][ubNoiseMaker] == SEEN_THIS_TURN) || // seen this turn - (gbPublicOpplist[bTeam][ubNoiseMaker] == HEARD_THIS_TURN)) // heard this turn + (gbPublicOpplist[bTeam][ubNoiseMaker] == HEARD_THIS_TURN)) // heard this turn { // then don't bother reporting any noise made by him to the player bTellPlayer = FALSE; @@ -5274,7 +5505,7 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrTy } */ - if ( MercPtrs[ ubNoiseMaker ]->bLife == 0 ) + if ( MercPtrs[ ubNoiseMaker ]->stats.bLife == 0 ) { // this guy is dead (just dying) so don't report to player bTellPlayer = FALSE; @@ -5294,12 +5525,12 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrTy for (bLoop = gTacticalStatus.Team[bTeam].bFirstID,pSoldier = Menptr + bLoop; bLoop <= gTacticalStatus.Team[bTeam].bLastID; bLoop++,pSoldier++) { // if this "listener" is inactive, or in no condition to care - if (!pSoldier->bActive || !pSoldier->bInSector || pSoldier->uiStatusFlags & SOLDIER_DEAD || (pSoldier->bLife < OKLIFE) || pSoldier->ubBodyType == LARVAE_MONSTER) + if (!pSoldier->bActive || !pSoldier->bInSector || pSoldier->flags.uiStatusFlags & SOLDIER_DEAD || (pSoldier->stats.bLife < OKLIFE) || pSoldier->ubBodyType == LARVAE_MONSTER) { - continue; // skip him! + continue; // skip him! } - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE && pSoldier->bTeam == OUR_TEAM ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE && pSoldier->bTeam == OUR_TEAM ) { continue; // skip } @@ -5314,12 +5545,12 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrTy if (ubNoiseMaker < TOTAL_SOLDIERS) { // if this listener can see this noise maker - if (pSoldier->bOppList[ubNoiseMaker] == SEEN_CURRENTLY) + if (pSoldier->aiData.bOppList[ubNoiseMaker] == SEEN_CURRENTLY) { // civilians care about gunshots even if they come from someone they can see - if ( !( pSoldier->bNeutral && ubNoiseType == NOISE_GUNFIRE ) ) + if ( !( pSoldier->aiData.bNeutral && ubNoiseType == NOISE_GUNFIRE ) ) { - continue; // then who cares whether he can also hear the guy? + continue; // then who cares whether he can also hear the guy? } } @@ -5389,13 +5620,13 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrTy #ifdef RECORDOPPLIST fprintf(OpplistFile,"PN: guy %d - effVol=%d,chkTer=%d,pSoldier->tType=%d,srcTType=%d\n", - bLoop,effVolume,bCheckTerrain,pSoldier->terrtype,ubSourceTerrType); + bLoop,effVolume,bCheckTerrain,pSoldier->terrtype,ubSourceTerrType); #endif if (ubEffVolume > 0) { - // ALL RIGHT! Passed all the tests, this listener hears this noise!!! + // ALL RIGHT! Passed all the tests, this listener hears this noise!!! HearNoise(pSoldier,ubSource,sGridNo,bLevel,ubEffVolume,ubNoiseType, (UINT8 *)&bSeen); bHeard = TRUE; @@ -5403,7 +5634,7 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrTy ubNoiseDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sGridNo),CenterY(sGridNo)); // check the 'noise heard & reported' bit for that soldier & direction - if ( ubNoiseType != NOISE_MOVEMENT || bTeam != OUR_TEAM || (pSoldier->bInterruptDuelPts != NO_INTERRUPT) || !(pSoldier->ubMovementNoiseHeard & (1 << ubNoiseDir) ) ) + if ( ubNoiseType != NOISE_MOVEMENT || bTeam != OUR_TEAM || (pSoldier->aiData.bInterruptDuelPts != NO_INTERRUPT) || !(pSoldier->ubMovementNoiseHeard & (1 << ubNoiseDir) ) ) { if (ubEffVolume > ubLoudestEffVolume) { @@ -5416,8 +5647,8 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrTy } else { - //NameMessage(pSoldier," can't hear this noise",2500); - ubEffVolume = 0; + //NameMessage(pSoldier," can't hear this noise",2500); + ubEffVolume = 0; } } @@ -5440,14 +5671,14 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrTy if ( ubNoiseType == NOISE_MOVEMENT) { - MercPtrs[ ubHeardLoudestBy ]->ubMovementNoiseHeard |= (1 << ubNoiseDir); + MercPtrs[ ubHeardLoudestBy ]->ubMovementNoiseHeard |= (1 << ubNoiseDir); } } //if ( !(pSoldier->ubMovementNoiseHeard & (1 << ubNoiseDir) ) ) } #ifdef REPORTTHEIRNOISE - else // debugging: report noise heard by other team's soldiers + else // debugging: report noise heard by other team's soldiers { if (bTellPlayer) { @@ -5524,7 +5755,7 @@ UINT8 CalcEffVolume(SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT8 ubN return( 0 ); } - if ( FindWalkman(pSoldier) != ITEM_NOT_FOUND ) + if ( FindWalkman(pSoldier) != ITEM_NOT_FOUND ) { return( 0 ); } @@ -5543,10 +5774,10 @@ UINT8 CalcEffVolume(SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT8 ubN // adjust default noise volume by listener's hearing capability iEffVolume = (INT32) ubBaseVolume + (INT32) DecideHearing( pSoldier ); - + // effective volume reduced by listener's number of opponents in sight - iEffVolume -= pSoldier->bOppCnt; + iEffVolume -= pSoldier->aiData.bOppCnt; // calculate the distance (in adjusted pixels) between the source of the @@ -5555,7 +5786,7 @@ UINT8 CalcEffVolume(SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT8 ubN /* distance = AdjPixelsAway(pSoldier->x,pSoldier->y,CenterX(sGridNo),CenterY(sGridNo)); - distance /= 15; // divide by 15 to convert from adj. pixels to tiles + distance /= 15; // divide by 15 to convert from adj. pixels to tiles */ //NumMessage("Distance = ",distance); @@ -5582,7 +5813,7 @@ UINT8 CalcEffVolume(SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT8 ubN break; } } - else if (pSoldier->bNeutral) + else if (pSoldier->aiData.bNeutral) { // NPCs and people in groups ignore attack noises unless they are no longer neutral switch (ubNoiseType) @@ -5608,16 +5839,16 @@ UINT8 CalcEffVolume(SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT8 ubN if (pSoldier->bAssignment == SLEEPING ) { // decrease effective volume since we're asleep! - iEffVolume -= 5; + iEffVolume -= 5; } // check for floor/roof difference - if (bLevel > pSoldier->bLevel) + if (bLevel > pSoldier->pathing.bLevel) { // sound is amplified by roof iEffVolume += 5; } - else if (bLevel < pSoldier->bLevel) + else if (bLevel < pSoldier->pathing.bLevel) { // sound is muffled iEffVolume -= 5; @@ -5660,7 +5891,7 @@ UINT8 CalcEffVolume(SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT8 ubN -void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 bLevel, UINT8 ubVolume, +void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubVolume, UINT8 ubNoiseType, UINT8 *ubSeen) { INT16 sNoiseX, sNoiseY; @@ -5681,16 +5912,16 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 b // "Turn head" towards the source of the noise and try to see what's there // don't use DistanceVisible here, but use maximum visibility distance - // in as straight line instead. Represents guy "turning just his head" + // in as straight line instead. Represents guy "turning just his head" - // CJC 97/10: CHANGE! Since STRAIGHT can not reliably be used as a + // CJC 97/10: CHANGE! Since STRAIGHT can not reliably be used as a // max sighting distance (varies based on realtime/turnbased), call // the function with the new DIRECTION_IRRELEVANT define // is he close enough to see that gridno if he turns his head? // ignore muzzle flashes when turning head to see noise - if ( ubNoiseType == NOISE_GUNFIRE && ubNoiseMaker != NOBODY && MercPtrs[ ubNoiseMaker ]->fMuzzleFlash ) + if ( ubNoiseType == NOISE_GUNFIRE && ubNoiseMaker != NOBODY && MercPtrs[ ubNoiseMaker ]->flags.fMuzzleFlash ) { sNoiseX = CenterX(sGridNo); sNoiseY = CenterY(sGridNo); @@ -5698,19 +5929,19 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 b if ( pSoldier->ubDirection != bDirection && pSoldier->ubDirection != gOneCDirection[ bDirection ] && pSoldier->ubDirection != gOneCCDirection[ bDirection ] ) { // temporarily turn off muzzle flash so DistanceVisible can be calculated without it - MercPtrs[ ubNoiseMaker ]->fMuzzleFlash = FALSE; + MercPtrs[ ubNoiseMaker ]->flags.fMuzzleFlash = FALSE; fMuzzleFlash = TRUE; } } - + int sDistVisible = pSoldier->GetMaxDistanceVisible(sGridNo, bLevel, CALC_FROM_WANTED_DIR ); if ( fMuzzleFlash ) { // turn flash on again - MercPtrs[ ubNoiseMaker ]->fMuzzleFlash = TRUE; + MercPtrs[ ubNoiseMaker ]->flags.fMuzzleFlash = TRUE; } - + if (PythSpacesAway(pSoldier->sGridNo,sGridNo) <= sDistVisible ) { // just use the XXadjustedXX center of the gridno @@ -5729,7 +5960,7 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 b // and we can trace a line of sight to his x,y coordinates? // (taking into account we are definitely aware of this guy now) - // skip LOS check if we had to turn and we're a tank. sorry Mr Tank, no looking out of the sides for you! + // skip LOS check if we had to turn and we're a tank. sorry Mr Tank, no looking out of the sides for you! if ( !( bHadToTurn && TANK( pSoldier ) ) ) { if ( SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, bLevel, 0, TRUE, sDistVisible ) ) @@ -5758,18 +5989,18 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 b // if noise is made by a person if (ubNoiseMaker < TOTAL_SOLDIERS) { - bOldOpplist = pSoldier->bOppList[ubNoiseMaker]; + bOldOpplist = pSoldier->aiData.bOppList[ubNoiseMaker]; // WE ALREADY KNOW THAT HE'S ON ANOTHER TEAM, AND HE'S NOT BEING SEEN // ProcessNoise() ALREADY DID THAT WORK FOR US if (bSourceSeen) { - ManSeesMan(pSoldier,MercPtrs[ubNoiseMaker],Menptr[ubNoiseMaker].sGridNo,Menptr[ubNoiseMaker].bLevel,HEARNOISE,CALLER_UNKNOWN); + ManSeesMan(pSoldier,MercPtrs[ubNoiseMaker],Menptr[ubNoiseMaker].sGridNo,Menptr[ubNoiseMaker].pathing.bLevel,HEARNOISE,CALLER_UNKNOWN); // if it's an AI soldier, he is not allowed to automatically radio any // noise heard, but manSeesMan has set his newOppCnt, so clear it here - if (!(pSoldier->uiStatusFlags & SOLDIER_PC)) + if (!(pSoldier->flags.uiStatusFlags & SOLDIER_PC)) { pSoldier->bNewOppCnt = 0; } @@ -5778,23 +6009,23 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 b // RadioSightings() must only be called later on by ProcessNoise() itself // because we want the soldier who heard noise the LOUDEST to report it - if ( pSoldier->bNeutral ) + if ( pSoldier->aiData.bNeutral ) { // could be a civilian watching us shoot at an enemy if (((ubNoiseType == NOISE_GUNFIRE) || (ubNoiseType == NOISE_BULLET_IMPACT)) && (ubVolume >= 3)) { // if status is only GREEN or YELLOW - if (pSoldier->bAlertStatus < STATUS_RED) + if (pSoldier->aiData.bAlertStatus < STATUS_RED) { // then this soldier goes to status RED, has proof of enemy presence - pSoldier->bAlertStatus = STATUS_RED; + pSoldier->aiData.bAlertStatus = STATUS_RED; CheckForChangingOrders(pSoldier); } } } } - else // noise maker still can't be seen + else // noise maker still can't be seen { SetNewSituation( pSoldier ); // re-evaluate situation @@ -5802,10 +6033,10 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 b if (((ubNoiseType == NOISE_GUNFIRE) || (ubNoiseType == NOISE_BULLET_IMPACT)) && (ubVolume >= 3)) { // if status is only GREEN or YELLOW - if (pSoldier->bAlertStatus < STATUS_RED) + if (pSoldier->aiData.bAlertStatus < STATUS_RED) { // then this soldier goes to status RED, has proof of enemy presence - pSoldier->bAlertStatus = STATUS_RED; + pSoldier->aiData.bAlertStatus = STATUS_RED; CheckForChangingOrders(pSoldier); } } @@ -5814,32 +6045,32 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 b UpdatePersonal(pSoldier,ubNoiseMaker,HEARD_THIS_TURN,sGridNo, bLevel); // Public info is not set unless EVERYONE on the team fails to see the - // ubnoisemaker, leaving the 'seen' flag FALSE. See ProcessNoise(). + // ubnoisemaker, leaving the 'seen' flag FALSE. See ProcessNoise(). // CJC: set the noise gridno for the soldier, if appropriate - this is what is looked at by the AI! - if (ubVolume >= pSoldier->ubNoiseVolume) + if (ubVolume >= pSoldier->aiData.ubNoiseVolume) { // yes it is, so remember this noise INSTEAD (old noise is forgotten) - pSoldier->sNoiseGridno = sGridNo; + pSoldier->aiData.sNoiseGridno = sGridNo; pSoldier->bNoiseLevel = bLevel; // no matter how loud noise was, don't remember it for than 12 turns! if (ubVolume < MAX_MISC_NOISE_DURATION) { - pSoldier->ubNoiseVolume = ubVolume; + pSoldier->aiData.ubNoiseVolume = ubVolume; } else { - pSoldier->ubNoiseVolume = MAX_MISC_NOISE_DURATION; + pSoldier->aiData.ubNoiseVolume = MAX_MISC_NOISE_DURATION; } - SetNewSituation( pSoldier ); // force a fresh AI decision to be made + SetNewSituation( pSoldier ); // force a fresh AI decision to be made } } - if ( pSoldier->fAIFlags & AI_ASLEEP ) - { + if ( pSoldier->aiData.fAIFlags & AI_ASLEEP ) + { switch( ubNoiseType ) { case NOISE_BULLET_IMPACT: @@ -5849,7 +6080,7 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 b case NOISE_WINDOW_SMASHING: case NOISE_DOOR_SMASHING: // WAKE UP! - pSoldier->fAIFlags &= (~AI_ASLEEP); + pSoldier->aiData.fAIFlags &= (~AI_ASLEEP); break; default: break; @@ -5862,10 +6093,10 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 b // regardless of whether the noisemaker (who's not NOBODY) was seen or not, // as long as listener meets minimum interrupt conditions if ( gfDelayResolvingBestSightingDueToDoor) - { + { if ( bSourceSeen && (!( (gTacticalStatus.uiFlags & TURNBASED) && ( gTacticalStatus.uiFlags & INCOMBAT ) ) || (gubSightFlags & SIGHTINTERRUPT && StandardInterruptConditionsMet(pSoldier,ubNoiseMaker,bOldOpplist)) ) ) { - // we should be adding this to the array for the AllTeamLookForAll to handle + // we should be adding this to the array for the AllTeamLookForAll to handle // since this is a door opening noise, add a bonus equal to half the door volume UINT8 ubPoints; @@ -5874,7 +6105,7 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 b { // require the enemy not to be dying if we are the sighter; in other words, // always add for AI guys, and always add for people with life >= OKLIFE - if ( pSoldier->bTeam != gbPlayerNum || MercPtrs[ ubNoiseMaker ]->bLife >= OKLIFE ) + if ( pSoldier->bTeam != gbPlayerNum || MercPtrs[ ubNoiseMaker ]->stats.bLife >= OKLIFE ) { ReevaluateBestSightingPosition( pSoldier, (UINT8) (ubPoints + (ubVolume / 2)) ); } @@ -5888,12 +6119,12 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 b if (StandardInterruptConditionsMet(pSoldier,ubNoiseMaker,bOldOpplist)) { // he gets a chance to interrupt the noisemaker - pSoldier->bInterruptDuelPts = CalcInterruptDuelPts(pSoldier,ubNoiseMaker, TRUE ); - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Calculating int duel pts in noise code, %d has %d points", pSoldier->ubID, pSoldier->bInterruptDuelPts ) ); + pSoldier->aiData.bInterruptDuelPts = CalcInterruptDuelPts(pSoldier,ubNoiseMaker, TRUE ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Calculating int duel pts in noise code, %d has %d points", pSoldier->ubID, pSoldier->aiData.bInterruptDuelPts ) ); } else { - pSoldier->bInterruptDuelPts = NO_INTERRUPT; + pSoldier->aiData.bInterruptDuelPts = NO_INTERRUPT; } } else if ( bSourceSeen ) @@ -5905,10 +6136,10 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 b } } - else // noise made by NOBODY + else // noise made by NOBODY { // if noise type was unmistakably that of an explosion (seen or not) or alarm - if (!(pSoldier->uiStatusFlags & SOLDIER_PC)) + if (!(pSoldier->flags.uiStatusFlags & SOLDIER_PC)) { if ( ( ubNoiseType == NOISE_EXPLOSION || ubNoiseType == NOISE_SILENT_ALARM ) && (ubVolume >= 3) ) { @@ -5917,10 +6148,10 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 b WearGasMaskIfAvailable( pSoldier ); } // if status is only GREEN or YELLOW - if (pSoldier->bAlertStatus < STATUS_RED) + if (pSoldier->aiData.bAlertStatus < STATUS_RED) { // then this soldier goes to status RED, has proof of enemy presence - pSoldier->bAlertStatus = STATUS_RED; + pSoldier->aiData.bAlertStatus = STATUS_RED; CheckForChangingOrders(pSoldier); } } @@ -5932,36 +6163,36 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 b { // check if the effective volume of this new noise is greater than or at // least equal to the volume of the currently noticed noise stored - if (ubVolume >= pSoldier->ubNoiseVolume) + if (ubVolume >= pSoldier->aiData.ubNoiseVolume) { // yes it is, so remember this noise INSTEAD (old noise is forgotten) - pSoldier->sNoiseGridno = sGridNo; + pSoldier->aiData.sNoiseGridno = sGridNo; pSoldier->bNoiseLevel = bLevel; // no matter how loud noise was, don't remember it for than 12 turns! if (ubVolume < MAX_MISC_NOISE_DURATION) { - pSoldier->ubNoiseVolume = ubVolume; + pSoldier->aiData.ubNoiseVolume = ubVolume; } else { - pSoldier->ubNoiseVolume = MAX_MISC_NOISE_DURATION; + pSoldier->aiData.ubNoiseVolume = MAX_MISC_NOISE_DURATION; } - SetNewSituation( pSoldier ); // force a fresh AI decision to be made + SetNewSituation( pSoldier ); // force a fresh AI decision to be made } } else // if listener sees the source of the noise, AND it's either a grenade, - // or it's a rock that he watched land (didn't need to turn) + // or it's a rock that he watched land (didn't need to turn) { - SetNewSituation( pSoldier ); // re-evaluate situation + SetNewSituation( pSoldier ); // re-evaluate situation // if status is only GREEN or YELLOW - if (pSoldier->bAlertStatus < STATUS_RED) + if (pSoldier->aiData.bAlertStatus < STATUS_RED) { // then this soldier goes to status RED, has proof of enemy presence - pSoldier->bAlertStatus = STATUS_RED; + pSoldier->aiData.bAlertStatus = STATUS_RED; CheckForChangingOrders(pSoldier); } } @@ -5975,12 +6206,12 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 b // reasonable to assume the guy throwing wants to wait for their reaction! if (StandardInterruptConditionsMet(pSoldier,NOBODY,FALSE)) { - pSoldier->bInterruptDuelPts = AUTOMATIC_INTERRUPT; // force automatic interrupt - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Calculating int duel pts in noise code, %d has %d points", pSoldier->ubID, pSoldier->bInterruptDuelPts ) ); + pSoldier->aiData.bInterruptDuelPts = AUTOMATIC_INTERRUPT; // force automatic interrupt + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Calculating int duel pts in noise code, %d has %d points", pSoldier->ubID, pSoldier->aiData.bInterruptDuelPts ) ); } else { - pSoldier->bInterruptDuelPts = NO_INTERRUPT; + pSoldier->aiData.bInterruptDuelPts = NO_INTERRUPT; } } } @@ -5999,10 +6230,10 @@ void TellPlayerAboutNoise( SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, INT16 sGri else if (ubVolume < 8) // 4-7: definite noise { ubVolumeIndex = 1; - } + } else if (ubVolume < 12) // 8-11: loud noise { - ubVolumeIndex = 2; + ubVolumeIndex = 2; } else // 12+: very loud noise { @@ -6020,11 +6251,11 @@ void TellPlayerAboutNoise( SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, INT16 sGri #endif } - if ( bLevel == pSoldier->bLevel || ubNoiseType == NOISE_EXPLOSION || ubNoiseType == NOISE_SCREAM || ubNoiseType == NOISE_ROCK_IMPACT || ubNoiseType == NOISE_GRENADE_IMPACT ) + if ( bLevel == pSoldier->pathing.bLevel || ubNoiseType == NOISE_EXPLOSION || ubNoiseType == NOISE_SCREAM || ubNoiseType == NOISE_ROCK_IMPACT || ubNoiseType == NOISE_GRENADE_IMPACT ) { ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, pNewNoiseStr[ubNoiseType], pSoldier->name, pNoiseVolStr[ubVolumeIndex], pDirectionStr[ubNoiseDir] ); } - else if ( bLevel > pSoldier->bLevel ) + else if ( bLevel > pSoldier->pathing.bLevel ) { // from above! ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, pNewNoiseStr[ubNoiseType], pSoldier->name, pNoiseVolStr[ubVolumeIndex], gzLateLocalizedString[6] ); @@ -6052,7 +6283,7 @@ void TellPlayerAboutNoise( SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, INT16 sGri } } - + //DIGICRAB: Loud Sound Locator //show a locator for very loud noises if we are in PLATINUM mode and have an extended ear //Madd: if(gGameOptions.ubGameStyle == STYLE_PLATINUM && ubVolumeIndex >= 2) @@ -6073,7 +6304,7 @@ void TellPlayerAboutNoise( SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, INT16 sGri void VerifyAndDecayOpplist(SOLDIERTYPE *pSoldier) { UINT32 uiLoop; - INT8 *pPersOL; // pointer into soldier's opponent list + INT8 *pPersOL; // pointer into soldier's opponent list SOLDIERTYPE *pOpponent; // reduce all seen/known opponent's turn counters by 1 (towards 0) @@ -6082,10 +6313,10 @@ void VerifyAndDecayOpplist(SOLDIERTYPE *pSoldier) // 3) forget about known opponents who haven't been noticed in some time // if soldier is unconscious, make sure his opplist is wiped out & bail out - if (pSoldier->bLife < OKLIFE) + if (pSoldier->stats.bLife < OKLIFE) { - memset(pSoldier->bOppList,NOT_HEARD_OR_SEEN,sizeof(pSoldier->bOppList)); - pSoldier->bOppCnt = 0; + memset(pSoldier->aiData.bOppList,NOT_HEARD_OR_SEEN,sizeof(pSoldier->aiData.bOppList)); + pSoldier->aiData.bOppCnt = 0; return; } @@ -6093,7 +6324,7 @@ void VerifyAndDecayOpplist(SOLDIERTYPE *pSoldier) if (pSoldier->bNewOppCnt) { #ifdef BETAVERSION - sprintf(tempstr,"VerifyAndDecayOpplist: WARNING - %d(%s) still has %d NEW OPPONENTS - lastCaller %s/%s", + tempstr = String("VerifyAndDecayOpplist: WARNING - %d(%s) still has %d NEW OPPONENTS - lastCaller %s/%s", pSoldier->guynum,ExtMen[pSoldier->guynum].name,pSoldier->newOppCnt, LastCallerText[ExtMen[pSoldier->guynum].lastCaller], LastCaller2Text[ExtMen[pSoldier->guynum].lastCaller2]); @@ -6108,7 +6339,7 @@ void VerifyAndDecayOpplist(SOLDIERTYPE *pSoldier) #endif - if (pSoldier->uiStatusFlags & SOLDIER_PC) + if (pSoldier->flags.uiStatusFlags & SOLDIER_PC) { RadioSightings(pSoldier,EVERYBODY,pSoldier->bTeam); } @@ -6122,7 +6353,7 @@ void VerifyAndDecayOpplist(SOLDIERTYPE *pSoldier) pOpponent = MercSlots[ uiLoop ]; // if this merc is active, here, and alive - if (pOpponent != NULL && pOpponent->bLife) + if (pOpponent != NULL && pOpponent->stats.bLife) { // if this merc is on the same team, he's no opponent, so skip him if (pSoldier->bTeam == pOpponent->bTeam) @@ -6130,87 +6361,87 @@ void VerifyAndDecayOpplist(SOLDIERTYPE *pSoldier) continue; } - pPersOL = pSoldier->bOppList + pOpponent->ubID; - - // if this opponent is "known" in any way (seen or heard recently) - if (*pPersOL != NOT_HEARD_OR_SEEN) - { - // use both sides actual x,y co-ordinates (neither side's moving) - ManLooksForMan(pSoldier,pOpponent,VERIFYANDDECAYOPPLIST); + pPersOL = pSoldier->aiData.bOppList + pOpponent->ubID; - // decay opplist value if necessary - DECAY_OPPLIST_VALUE( *pPersOL ); - /* - // if opponent was SEEN recently but is NOT visible right now - if (*pPersOL >= SEEN_THIS_TURN) - { - (*pPersOL)++; // increment #turns it's been since last seen + // if this opponent is "known" in any way (seen or heard recently) + if (*pPersOL != NOT_HEARD_OR_SEEN) + { + // use both sides actual x,y co-ordinates (neither side's moving) + ManLooksForMan(pSoldier,pOpponent,VERIFYANDDECAYOPPLIST); - // if it's now been longer than the maximum we care to remember - if (*pPersOL > SEEN_2_TURNS_AGO) - *pPersOL = 0; // forget that we knew this guy - } - else - { - // if opponent was merely HEARD recently, not actually seen - if (*pPersOL <= HEARD_THIS_TURN) - { - (*pPersOL)--; // increment #turns it's been since last heard + // decay opplist value if necessary + DECAY_OPPLIST_VALUE( *pPersOL ); + /* + // if opponent was SEEN recently but is NOT visible right now + if (*pPersOL >= SEEN_THIS_TURN) + { + (*pPersOL)++; // increment #turns it's been since last seen - // if it's now been longer than the maximum we care to remember - if (*pPersOL < HEARD_2_TURNS_AGO) - *pPersOL = 0; // forget that we knew this guy - } + // if it's now been longer than the maximum we care to remember + if (*pPersOL > SEEN_2_TURNS_AGO) + *pPersOL = 0; // forget that we knew this guy + } + else + { + // if opponent was merely HEARD recently, not actually seen + if (*pPersOL <= HEARD_THIS_TURN) + { + (*pPersOL)--; // increment #turns it's been since last heard + + // if it's now been longer than the maximum we care to remember + if (*pPersOL < HEARD_2_TURNS_AGO) + *pPersOL = 0; // forget that we knew this guy + } } */ - } + } - } - } + } + } // if any new opponents were seen if (pSoldier->bNewOppCnt) - { - // turns out this is NOT an error! If this guy was gassed last time he - // looked, his sight limit was 2 tiles, and now he may no longer be gassed - // and thus he sees opponents much further away for the first time! - // - Always happens if you STUNGRENADE an opponent by surprise... + { + // turns out this is NOT an error! If this guy was gassed last time he + // looked, his sight limit was 2 tiles, and now he may no longer be gassed + // and thus he sees opponents much further away for the first time! + // - Always happens if you STUNGRENADE an opponent by surprise... #ifdef RECORDNET - fprintf(NetDebugFile,"\tVerifyAndDecayOpplist: d(%s) saw %d new opponents\n", - pSoldier->guynum,ExtMen[pSoldier->guynum].name,pSoldier->newOppCnt); + fprintf(NetDebugFile,"\tVerifyAndDecayOpplist: d(%s) saw %d new opponents\n", + pSoldier->guynum,ExtMen[pSoldier->guynum].name,pSoldier->newOppCnt); #endif - if (pSoldier->uiStatusFlags & SOLDIER_PC) - RadioSightings(pSoldier,EVERYBODY,pSoldier->bTeam); + if (pSoldier->flags.uiStatusFlags & SOLDIER_PC) + RadioSightings(pSoldier,EVERYBODY,pSoldier->bTeam); - pSoldier->bNewOppCnt = 0; - } + pSoldier->bNewOppCnt = 0; + } } void DecayIndividualOpplist(SOLDIERTYPE *pSoldier) { UINT32 uiLoop; - INT8 *pPersOL; // pointer into soldier's opponent list + INT8 *pPersOL; // pointer into soldier's opponent list SOLDIERTYPE *pOpponent; // reduce all currently seen opponent's turn counters by 1 (towards 0) // if soldier is unconscious, make sure his opplist is wiped out & bail out - if (pSoldier->bLife < OKLIFE) + if (pSoldier->stats.bLife < OKLIFE) { // must make sure that public opplist is kept to match... for ( uiLoop = 0; uiLoop < TOTAL_SOLDIERS; uiLoop++ ) { - if ( pSoldier->bOppList[ uiLoop ] == SEEN_CURRENTLY ) + if ( pSoldier->aiData.bOppList[ uiLoop ] == SEEN_CURRENTLY ) { - HandleManNoLongerSeen( pSoldier, MercPtrs[ uiLoop ], &(pSoldier->bOppList[ uiLoop ]), &(gbPublicOpplist[ pSoldier->bTeam ][ uiLoop ]) ); + HandleManNoLongerSeen( pSoldier, MercPtrs[ uiLoop ], &(pSoldier->aiData.bOppList[ uiLoop ]), &(gbPublicOpplist[ pSoldier->bTeam ][ uiLoop ]) ); } } //void HandleManNoLongerSeen( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOpponent, INT8 * pPersOL, INT8 * pbPublOL ) - memset(pSoldier->bOppList,NOT_HEARD_OR_SEEN,sizeof(pSoldier->bOppList)); - pSoldier->bOppCnt = 0; + memset(pSoldier->aiData.bOppList,NOT_HEARD_OR_SEEN,sizeof(pSoldier->aiData.bOppList)); + pSoldier->aiData.bOppCnt = 0; return; } @@ -6220,7 +6451,7 @@ void DecayIndividualOpplist(SOLDIERTYPE *pSoldier) pOpponent = MercSlots[ uiLoop ]; // if this merc is active, here, and alive - if (pOpponent != NULL && pOpponent->bLife) + if (pOpponent != NULL && pOpponent->stats.bLife) { // if this merc is on the same team, he's no opponent, so skip him if (pSoldier->bTeam == pOpponent->bTeam) @@ -6228,11 +6459,11 @@ void DecayIndividualOpplist(SOLDIERTYPE *pSoldier) continue; } - pPersOL = pSoldier->bOppList + pOpponent->ubID; - - // if this opponent is seen currently - if (*pPersOL == SEEN_CURRENTLY) - { + pPersOL = pSoldier->aiData.bOppList + pOpponent->ubID; + + // if this opponent is seen currently + if (*pPersOL == SEEN_CURRENTLY) + { // they are NOT visible now! (*pPersOL)++; if (!CONSIDERED_NEUTRAL( pOpponent, pSoldier ) && !CONSIDERED_NEUTRAL( pSoldier, pOpponent ) && (pSoldier->bSide != pOpponent->bSide)) @@ -6240,9 +6471,9 @@ void DecayIndividualOpplist(SOLDIERTYPE *pSoldier) RemoveOneOpponent(pSoldier); } - } - } - } + } + } + } } @@ -6250,7 +6481,7 @@ void DecayIndividualOpplist(SOLDIERTYPE *pSoldier) void VerifyPublicOpplistDueToDeath(SOLDIERTYPE *pSoldier) { UINT32 uiLoop,uiTeamMateLoop; - INT8 *pPersOL,*pMatePersOL; // pointers into soldier's opponent list + INT8 *pPersOL,*pMatePersOL; // pointers into soldier's opponent list SOLDIERTYPE *pOpponent,*pTeamMate; BOOLEAN bOpponentStillSeen; @@ -6259,8 +6490,8 @@ void VerifyPublicOpplistDueToDeath(SOLDIERTYPE *pSoldier) // immediately in the Public Opplist. - // If deceased didn't see ANYONE, don't bother - if (pSoldier->bOppCnt == 0) + // If deceased didn't see ANYONE, don't bother + if (pSoldier->aiData.bOppCnt == 0) { return; } @@ -6271,12 +6502,12 @@ void VerifyPublicOpplistDueToDeath(SOLDIERTYPE *pSoldier) { // first, initialize flag since this will be a "new" opponent bOpponentStillSeen = FALSE; - + // grab a pointer to the "opponent" pOpponent = MercSlots[ uiLoop ]; // if this opponent is active, here, and alive - if (pOpponent != NULL && pOpponent->bLife) + if (pOpponent != NULL && pOpponent->stats.bLife) { // if this opponent is on the same team, he's no opponent, so skip him if (pSoldier->bTeam == pOpponent->bTeam) @@ -6285,8 +6516,8 @@ void VerifyPublicOpplistDueToDeath(SOLDIERTYPE *pSoldier) } // point to what the deceased's personal opplist value is - pPersOL = pSoldier->bOppList + pOpponent->ubID; - + pPersOL = pSoldier->aiData.bOppList + pOpponent->ubID; + // if this opponent was CURRENTLY SEEN by the deceased (before his // untimely demise) if (*pPersOL == SEEN_CURRENTLY) @@ -6299,7 +6530,7 @@ void VerifyPublicOpplistDueToDeath(SOLDIERTYPE *pSoldier) pTeamMate = MercSlots[ uiTeamMateLoop ]; // if this teammate is active, here, and alive - if (pTeamMate != NULL && pTeamMate->bLife) + if (pTeamMate != NULL && pTeamMate->stats.bLife) { // if this opponent is NOT on the same team, then skip him if (pTeamMate->bTeam != pSoldier->bTeam) @@ -6308,14 +6539,14 @@ void VerifyPublicOpplistDueToDeath(SOLDIERTYPE *pSoldier) } // point to what the teammate's personal opplist value is - pMatePersOL = pTeamMate->bOppList + pOpponent->ubID; + pMatePersOL = pTeamMate->aiData.bOppList + pOpponent->ubID; // test to see if this value is "seen currently" if (*pMatePersOL == SEEN_CURRENTLY) { - // this opponent HAS been verified! + // this opponent HAS been verified! bOpponentStillSeen = TRUE; - + // we can stop looking for other witnesses now break; } @@ -6348,7 +6579,7 @@ void DecayPublicOpplist(INT8 bTeam) if (gubPublicNoiseVolume[bTeam] > 0) { if ( gTacticalStatus.uiFlags & INCOMBAT ) - { + { gubPublicNoiseVolume[bTeam] = (UINT8) ( (UINT32) (gubPublicNoiseVolume[bTeam] * 7) / 10 ); } else @@ -6368,7 +6599,7 @@ void DecayPublicOpplist(INT8 bTeam) pSoldier = MercSlots[uiLoop]; // for every active, living soldier on ANOTHER team - if (pSoldier && pSoldier->bLife && (pSoldier->bTeam != bTeam)) + if (pSoldier && pSoldier->stats.bLife && (pSoldier->bTeam != bTeam)) { // hang a pointer to the byte holding team's public opplist for this merc pbPublOL = &gbPublicOpplist[bTeam][pSoldier->ubID]; @@ -6384,14 +6615,14 @@ void DecayPublicOpplist(INT8 bTeam) // if this person has been SEEN recently, but is not currently visible if (*pbPublOL >= SEEN_THIS_TURN) { - (*pbPublOL)++; // increment how long it's been + (*pbPublOL)++; // increment how long it's been } else { // if this person has been only HEARD recently if (*pbPublOL <= HEARD_THIS_TURN) { - (*pbPublOL)--; // increment how long it's been + (*pbPublOL)--; // increment how long it's been } } @@ -6444,8 +6675,8 @@ void NonCombatDecayPublicOpplist( UINT32 uiTime ) if ( gTacticalStatus.Team[ cnt ].bMenInSector > 0 ) { // decay team's public opplist - DecayPublicOpplist( (INT8)cnt ); - } + DecayPublicOpplist( (INT8)cnt ); + } } // update time gTacticalStatus.uiTimeSinceLastOpplistDecay = uiTime; @@ -6456,23 +6687,23 @@ void RecalculateOppCntsDueToNoLongerNeutral( SOLDIERTYPE * pSoldier ) { UINT32 uiLoop; SOLDIERTYPE * pOpponent; - - pSoldier->bOppCnt = 0; - if (!pSoldier->bNeutral) + pSoldier->aiData.bOppCnt = 0; + + if (!pSoldier->aiData.bNeutral) { for (uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++) { pOpponent = MercSlots[uiLoop]; // for every active, living soldier on ANOTHER team - if (pOpponent && pOpponent->bLife && !pOpponent->bNeutral && (pOpponent->bTeam != pSoldier->bTeam) && (!CONSIDERED_NEUTRAL( pOpponent, pSoldier ) && !CONSIDERED_NEUTRAL( pSoldier, pOpponent ) && (pSoldier->bSide != pOpponent->bSide)) ) + if (pOpponent && pOpponent->stats.bLife && !pOpponent->aiData.bNeutral && (pOpponent->bTeam != pSoldier->bTeam) && (!CONSIDERED_NEUTRAL( pOpponent, pSoldier ) && !CONSIDERED_NEUTRAL( pSoldier, pOpponent ) && (pSoldier->bSide != pOpponent->bSide)) ) { - if ( pSoldier->bOppList[pOpponent->ubID] == SEEN_CURRENTLY ) + if ( pSoldier->aiData.bOppList[pOpponent->ubID] == SEEN_CURRENTLY ) { AddOneOpponent( pSoldier ); } - if ( pOpponent->bOppList[pSoldier->ubID] == SEEN_CURRENTLY ) + if ( pOpponent->aiData.bOppList[pSoldier->ubID] == SEEN_CURRENTLY ) { // have to add to opponent's oppcount as well since we just became non-neutral AddOneOpponent( pOpponent ); @@ -6486,19 +6717,19 @@ void RecalculateOppCntsDueToBecomingNeutral( SOLDIERTYPE * pSoldier ) { UINT32 uiLoop; SOLDIERTYPE * pOpponent; - - if (pSoldier->bNeutral) + + if (pSoldier->aiData.bNeutral) { - pSoldier->bOppCnt = 0; + pSoldier->aiData.bOppCnt = 0; for (uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++) { pOpponent = MercSlots[uiLoop]; // for every active, living soldier on ANOTHER team - if (pOpponent && pOpponent->bLife && !pOpponent->bNeutral && (pOpponent->bTeam != pSoldier->bTeam) && !CONSIDERED_NEUTRAL( pSoldier, pOpponent ) && (pSoldier->bSide != pOpponent->bSide) ) + if (pOpponent && pOpponent->stats.bLife && !pOpponent->aiData.bNeutral && (pOpponent->bTeam != pSoldier->bTeam) && !CONSIDERED_NEUTRAL( pSoldier, pOpponent ) && (pSoldier->bSide != pOpponent->bSide) ) { - if ( pOpponent->bOppList[pSoldier->ubID] == SEEN_CURRENTLY ) + if ( pOpponent->aiData.bOppList[pSoldier->ubID] == SEEN_CURRENTLY ) { // have to rem from opponent's oppcount as well since we just became neutral RemoveOneOpponent( pOpponent ); @@ -6531,37 +6762,37 @@ void NoticeUnseenAttacker( SOLDIERTYPE * pAttacker, SOLDIERTYPE * pDefender, INT // do we need to do checks for life/breath here? - if ( pDefender->ubBodyType == LARVAE_MONSTER || (pDefender->uiStatusFlags & SOLDIER_VEHICLE && pDefender->bTeam == OUR_TEAM) ) + if ( pDefender->ubBodyType == LARVAE_MONSTER || (pDefender->flags.uiStatusFlags & SOLDIER_VEHICLE && pDefender->bTeam == OUR_TEAM) ) { return; } - bOldOppList = pDefender->bOppList[ pAttacker->ubID ]; - // check LOS, considering we are now aware of the attacker - // ignore muzzle flashes when must turning head - if ( pAttacker->fMuzzleFlash ) + bOldOppList = pDefender->aiData.bOppList[ pAttacker->ubID ]; + // check LOS, considering we are now aware of the attacker + // ignore muzzle flashes when must turning head + if ( pAttacker->flags.fMuzzleFlash ) + { + bDirection = atan8( pDefender->sX,pDefender->sY, pAttacker->sX, pAttacker->sY ); + if ( pDefender->ubDirection != bDirection && pDefender->ubDirection != gOneCDirection[ bDirection ] && pDefender->ubDirection != gOneCCDirection[ bDirection ] ) { - bDirection = atan8( pDefender->sX,pDefender->sY, pAttacker->sX, pAttacker->sY ); - if ( pDefender->ubDirection != bDirection && pDefender->ubDirection != gOneCDirection[ bDirection ] && pDefender->ubDirection != gOneCCDirection[ bDirection ] ) - { - // temporarily turn off muzzle flash so DistanceVisible can be calculated without it - pAttacker->fMuzzleFlash = FALSE; - fMuzzleFlash = TRUE; - } + // temporarily turn off muzzle flash so DistanceVisible can be calculated without it + pAttacker->flags.fMuzzleFlash = FALSE; + fMuzzleFlash = TRUE; } + } if (SoldierToSoldierLineOfSightTest( pDefender, pAttacker, TRUE, CALC_FROM_WANTED_DIR ) != 0) - { - fSeesAttacker = TRUE; - } - if ( fMuzzleFlash ) - { - pAttacker->fMuzzleFlash = TRUE; - } + { + fSeesAttacker = TRUE; + } + if ( fMuzzleFlash ) + { + pAttacker->flags.fMuzzleFlash = TRUE; + } if (fSeesAttacker) { - ManSeesMan( pDefender, pAttacker, pAttacker->sGridNo, pAttacker->bLevel, NOTICEUNSEENATTACKER, CALLER_UNKNOWN ); + ManSeesMan( pDefender, pAttacker, pAttacker->sGridNo, pAttacker->pathing.bLevel, NOTICEUNSEENATTACKER, CALLER_UNKNOWN ); // newOppCnt not needed here (no radioing), must get reset right away // CJC: Huh? well, leave it in for now @@ -6584,27 +6815,27 @@ void NoticeUnseenAttacker( SOLDIERTYPE * pAttacker, SOLDIERTYPE * pDefender, INT ReevaluateEnemyStance( pDefender, pDefender->usAnimState ); } } - else // victim NOTICED the attack, but CAN'T SEE the actual attacker + else // victim NOTICED the attack, but CAN'T SEE the actual attacker { - SetNewSituation( pDefender ); // re-evaluate situation + SetNewSituation( pDefender ); // re-evaluate situation // if victim's alert status is only GREEN or YELLOW - if (pDefender->bAlertStatus < STATUS_RED) + if (pDefender->aiData.bAlertStatus < STATUS_RED) { // then this soldier goes to status RED, has proof of enemy presence - pDefender->bAlertStatus = STATUS_RED; + pDefender->aiData.bAlertStatus = STATUS_RED; CheckForChangingOrders( pDefender ); } - UpdatePersonal( pDefender, pAttacker->ubID, HEARD_THIS_TURN, pAttacker->sGridNo, pAttacker->bLevel ); + UpdatePersonal( pDefender, pAttacker->ubID, HEARD_THIS_TURN, pAttacker->sGridNo, pAttacker->pathing.bLevel ); // if the victim is a human-controlled soldier, instantly report publicly - if (pDefender->uiStatusFlags & SOLDIER_PC) + if (pDefender->flags.uiStatusFlags & SOLDIER_PC) { // mark attacker as having been PUBLICLY heard THIS TURN & remember where - UpdatePublic( pDefender->bTeam, pAttacker->ubID, HEARD_THIS_TURN, pAttacker->sGridNo, pAttacker->bLevel ); + UpdatePublic( pDefender->bTeam, pAttacker->ubID, HEARD_THIS_TURN, pAttacker->sGridNo, pAttacker->pathing.bLevel ); } - } + } if ( StandardInterruptConditionsMet( pDefender, pAttacker->ubID, bOldOppList ) ) { @@ -6612,41 +6843,41 @@ void NoticeUnseenAttacker( SOLDIERTYPE * pAttacker, SOLDIERTYPE * pDefender, INT // calculate the interrupt duel points DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Calculating int duel pts for defender in NUA" ); - pDefender->bInterruptDuelPts = CalcInterruptDuelPts( pDefender, pAttacker->ubID, FALSE); + pDefender->aiData.bInterruptDuelPts = CalcInterruptDuelPts( pDefender, pAttacker->ubID, FALSE); } else { - pDefender->bInterruptDuelPts = NO_INTERRUPT; + pDefender->aiData.bInterruptDuelPts = NO_INTERRUPT; } // say quote - if (pDefender->bInterruptDuelPts != NO_INTERRUPT) + if (pDefender->aiData.bInterruptDuelPts != NO_INTERRUPT) { // check for possible interrupt and handle control change if it happens // this code is basically ResolveInterruptsVs for 1 man only... // calculate active soldier's dueling pts for the upcoming interrupt duel DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Calculating int duel pts for attacker in NUA" ); - pAttacker->bInterruptDuelPts = CalcInterruptDuelPts( pAttacker, pDefender->ubID, FALSE ); + pAttacker->aiData.bInterruptDuelPts = CalcInterruptDuelPts( pAttacker, pDefender->ubID, FALSE ); if ( InterruptDuel( pDefender, pAttacker ) ) { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("INTERRUPT: NoticeUnseenAttacker, defender pts %d, attacker pts %d, defender gets interrupt", pDefender->bInterruptDuelPts, pAttacker->bInterruptDuelPts ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("INTERRUPT: NoticeUnseenAttacker, defender pts %d, attacker pts %d, defender gets interrupt", pDefender->aiData.bInterruptDuelPts, pAttacker->aiData.bInterruptDuelPts ) ); AddToIntList( pAttacker->ubID, FALSE, TRUE); AddToIntList( pDefender->ubID, TRUE, TRUE); DoneAddingToIntList( pDefender, TRUE, SIGHTINTERRUPT ); } // either way, clear out both sides' duelPts fields to prepare next duel - pDefender->bInterruptDuelPts = NO_INTERRUPT; + pDefender->aiData.bInterruptDuelPts = NO_INTERRUPT; #ifdef DEBUG_INTERRUPTS DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Resetting int pts for %d in NUA", pDefender->ubID ) ); #endif - pAttacker->bInterruptDuelPts = NO_INTERRUPT; + pAttacker->aiData.bInterruptDuelPts = NO_INTERRUPT; #ifdef DEBUG_INTERRUPTS DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Resetting int pts for %d in NUA", pAttacker->ubID ) ); #endif - } + } } void CheckForAlertWhenEnemyDies( SOLDIERTYPE * pDyingSoldier ) @@ -6661,13 +6892,13 @@ void CheckForAlertWhenEnemyDies( SOLDIERTYPE * pDyingSoldier ) pSoldier = MercPtrs[ ubID ]; - if ( pSoldier->bActive && pSoldier->bInSector && (pSoldier != pDyingSoldier) && (pSoldier->bLife >= OKLIFE) && (pSoldier->bAlertStatus < STATUS_RED ) ) + if ( pSoldier->bActive && pSoldier->bInSector && (pSoldier != pDyingSoldier) && (pSoldier->stats.bLife >= OKLIFE) && (pSoldier->aiData.bAlertStatus < STATUS_RED ) ) { // this guy might have seen the man die // distance we "see" then depends on the direction he is located from us bDir = atan8(pSoldier->sX,pSoldier->sY,pDyingSoldier->sX,pDyingSoldier->sY); - sDistVisible = DistanceVisible( pSoldier, pSoldier->bDesiredDirection, bDir, pDyingSoldier->sGridNo, pDyingSoldier->bLevel ); + sDistVisible = DistanceVisible( pSoldier, pSoldier->pathing.bDesiredDirection, bDir, pDyingSoldier->sGridNo, pDyingSoldier->pathing.bLevel ); sDistAway = PythSpacesAway( pSoldier->sGridNo, pDyingSoldier->sGridNo ); // if we see close enough to see the soldier @@ -6675,9 +6906,9 @@ void CheckForAlertWhenEnemyDies( SOLDIERTYPE * pDyingSoldier ) { // and we can trace a line of sight to his x,y coordinates // assume enemies are always aware of their buddies... - if ( SoldierTo3DLocationLineOfSightTest( pSoldier, pDyingSoldier->sGridNo, pDyingSoldier->bLevel, 0, TRUE, sDistVisible ) ) + if ( SoldierTo3DLocationLineOfSightTest( pSoldier, pDyingSoldier->sGridNo, pDyingSoldier->pathing.bLevel, 0, TRUE, sDistVisible ) ) { - pSoldier->bAlertStatus = STATUS_RED; + pSoldier->aiData.bAlertStatus = STATUS_RED; CheckForChangingOrders( pSoldier ); } } @@ -6691,7 +6922,7 @@ BOOLEAN ArmyKnowsOfPlayersPresence( void ) { UINT8 ubID; SOLDIERTYPE * pSoldier; - + // if anyone is still left... if (gTacticalStatus.Team[ ENEMY_TEAM ].bTeamActive && gTacticalStatus.Team[ ENEMY_TEAM ].bMenInSector > 0 ) { @@ -6699,7 +6930,7 @@ BOOLEAN ArmyKnowsOfPlayersPresence( void ) { pSoldier = MercPtrs[ ubID ]; - if ( pSoldier->bActive && pSoldier->bInSector && (pSoldier->bLife >= OKLIFE) && (pSoldier->bAlertStatus >= STATUS_RED ) ) + if ( pSoldier->bActive && pSoldier->bInSector && (pSoldier->stats.bLife >= OKLIFE) && (pSoldier->aiData.bAlertStatus >= STATUS_RED ) ) { return( TRUE ); } @@ -6710,14 +6941,13 @@ BOOLEAN ArmyKnowsOfPlayersPresence( void ) BOOLEAN MercSeesCreature( SOLDIERTYPE * pSoldier ) { - BOOLEAN fSeesCreature = FALSE; UINT8 ubID; - if (pSoldier->bOppCnt > 0) + if (pSoldier->aiData.bOppCnt > 0) { for ( ubID = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; ubID <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; ubID++ ) { - if ( (pSoldier->bOppList[ ubID ] == SEEN_CURRENTLY) && (MercPtrs[ ubID ]->uiStatusFlags & SOLDIER_MONSTER) ) + if ( (pSoldier->aiData.bOppList[ ubID ] == SEEN_CURRENTLY) && (MercPtrs[ ubID ]->flags.uiStatusFlags & SOLDIER_MONSTER) ) { return( TRUE ); } @@ -6761,7 +6991,7 @@ INT8 FindWatchedLoc( UINT8 ubID, INT16 sGridNo, INT8 bLevel ) for ( bLoop = 0; bLoop < NUM_WATCHED_LOCS; bLoop++ ) { - if ( gsWatchedLoc[ ubID ][ bLoop ] != NOWHERE && gbWatchedLocLevel[ ubID ][ bLoop ] == bLevel ) + if ( gsWatchedLoc[ ubID ][ bLoop ] != NOWHERE && gbWatchedLocLevel[ ubID ][ bLoop ] == bLevel ) { if ( SpacesAway( gsWatchedLoc[ ubID ][ bLoop ], sGridNo ) <= WATCHED_LOC_RADIUS ) { @@ -6843,11 +7073,11 @@ void CommunicateWatchedLoc( UINT8 ubID, INT16 sGridNo, INT8 bLevel, UINT8 ubPoin for ( ubLoop = gTacticalStatus.Team[ bTeam ].bFirstID; ubLoop < gTacticalStatus.Team[ bTeam ].bLastID; ubLoop++ ) { - if ( ubLoop == ubID || MercPtrs[ ubLoop ]->bActive == FALSE || MercPtrs[ ubLoop ]->bInSector == FALSE || MercPtrs[ ubLoop ]->bLife < OKLIFE ) + if ( ubLoop == ubID || MercPtrs[ ubLoop ]->bActive == FALSE || MercPtrs[ ubLoop ]->bInSector == FALSE || MercPtrs[ ubLoop ]->stats.bLife < OKLIFE ) { continue; } - bLoopPoint = FindWatchedLoc( ubLoop, sGridNo, bLevel ); + bLoopPoint = FindWatchedLoc( ubLoop, sGridNo, bLevel ); if ( bLoopPoint == -1 ) { // add this as a watched point @@ -6891,9 +7121,9 @@ void IncrementWatchedLoc( UINT8 ubID, INT16 sGridNo, INT8 bLevel ) if (bPoint == -1) { // if we have a point with only 1 point left, replace it - bPoint = FindWatchedLocWithLessThanXPointsLeft( ubID, 1 ); + bPoint = FindWatchedLocWithLessThanXPointsLeft( ubID, 1 ); } - + if (bPoint != -1) { gsWatchedLoc[ ubID ][ bPoint ] = sGridNo; @@ -6901,13 +7131,13 @@ void IncrementWatchedLoc( UINT8 ubID, INT16 sGridNo, INT8 bLevel ) gubWatchedLocPoints[ ubID ][ bPoint ] = 1; gfWatchedLocReset[ ubID ][ bPoint ] = FALSE; gfWatchedLocHasBeenIncremented[ ubID ][ bPoint ] = TRUE; - + CommunicateWatchedLoc( ubID, sGridNo, bLevel, 1 ); } // otherwise abort; no points available } else - { + { if ( !gfWatchedLocHasBeenIncremented[ ubID ][ bPoint ] && gubWatchedLocPoints[ ubID ][ bPoint ] < MAX_WATCHED_LOC_POINTS ) { gubWatchedLocPoints[ ubID ][ bPoint ]++; @@ -6969,7 +7199,7 @@ void DecayWatchedLocs( INT8 bTeam ) // if the reset flag is still set, then we should decay this point if (gfWatchedLocReset[ cnt ][ cnt2 ]) { - // turn flag off again + // turn flag off again gfWatchedLocReset[ cnt ][ cnt2 ] = FALSE; // halve points @@ -6998,15 +7228,15 @@ void MakeBloodcatsHostile( void ) iLoop = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; for (pSoldier = MercPtrs[iLoop]; iLoop <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; iLoop++,pSoldier++ ) - { - if ( pSoldier->ubBodyType == BLOODCAT && pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife > 0 ) + { + if ( pSoldier->ubBodyType == BLOODCAT && pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 ) { - SetSoldierNonNeutral( pSoldier ); - RecalculateOppCntsDueToNoLongerNeutral( pSoldier ); - if ( ( gTacticalStatus.uiFlags & INCOMBAT ) ) - { - CheckForPotentialAddToBattleIncrement( pSoldier ); - } + SetSoldierNonNeutral( pSoldier ); + RecalculateOppCntsDueToNoLongerNeutral( pSoldier ); + if ( ( gTacticalStatus.uiFlags & INCOMBAT ) ) + { + CheckForPotentialAddToBattleIncrement( pSoldier ); + } } } diff --git a/Tactical/opplist.h b/Tactical/opplist.h index 7f033a5e..74f8a5f0 100644 --- a/Tactical/opplist.h +++ b/Tactical/opplist.h @@ -2,16 +2,16 @@ #define _OPPLIST_H -#define EVERYBODY MAXMERCS +#define EVERYBODY MAXMERCS -#define MAX_MISC_NOISE_DURATION 12 // max dur for VERY loud NOBODY noises +#define MAX_MISC_NOISE_DURATION 12 // max dur for VERY loud NOBODY noises -#define DOOR_NOISE_VOLUME 2 +#define DOOR_NOISE_VOLUME 2 #define WINDOW_CRACK_VOLUME 4 #define WINDOW_SMASH_VOLUME 8 -#define MACHETE_VOLUME 9 -#define TRIMMER_VOLUME 18 -#define CHAINSAW_VOLUME 30 +#define MACHETE_VOLUME 9 +#define TRIMMER_VOLUME 18 +#define CHAINSAW_VOLUME 30 #define SMASHING_DOOR_VOLUME 6 #define CROWBAR_DOOR_VOLUME 4 #define ITEM_THROWN_VOLUME 2 @@ -25,9 +25,9 @@ #define AUTOMATIC_INTERRUPT 100 #define NO_INTERRUPT 127 -#define MOVEINTERRUPT 0 -#define SIGHTINTERRUPT 1 -#define NOISEINTERRUPT 2 +#define MOVEINTERRUPT 0 +#define SIGHTINTERRUPT 1 +#define NOISEINTERRUPT 2 // noise type constants @@ -71,8 +71,8 @@ extern UINT8 gubKnowledgeValue[10][10]; extern INT8 gbLookDistance[8][8]; extern INT8 gfKnowAboutOpponents; -extern BOOLEAN gfPlayerTeamSawJoey; -extern BOOLEAN gfMikeShouldSayHi; +extern BOOLEAN gfPlayerTeamSawJoey; +extern BOOLEAN gfMikeShouldSayHi; extern INT16 gsWatchedLoc[ TOTAL_SOLDIERS ][ NUM_WATCHED_LOCS ]; diff --git a/Tactical/soldier profile type.h b/Tactical/soldier profile type.h index 9d85541b..ab9c3c5a 100644 --- a/Tactical/soldier profile type.h +++ b/Tactical/soldier profile type.h @@ -59,7 +59,7 @@ //self explanatory #define MERC_IS_DEAD -5 -//set when the merc is returning home. A delay for 1,2 or 3 days +//set when the merc is returning home. A delay for 1,2 or 3 days #define MERC_RETURNING_HOME -6 // used when merc starts game on assignment, goes on assignment later, or leaves to go on another contract @@ -95,7 +95,7 @@ typedef enum THIEF, MARTIALARTS, KNIFING, - ONROOF, + PROF_SNIPER, CAMOUFLAGED, CAMOUFLAGED_URBAN, CAMOUFLAGED_DESERT, @@ -161,38 +161,42 @@ typedef enum{ #define BUDDY_OPINION +25 #define HATED_OPINION -25 -// WDS - Clean up inventory handling -//typedef struct -class MERCPROFILESTRUCT { +// CHRISL: Class to handle profile equipment from XML_MercStartingGear +class MERCPROFILEGEAR { public: // Constructor - MERCPROFILESTRUCT(); - // Copy Constructor - MERCPROFILESTRUCT(const MERCPROFILESTRUCT&); + MERCPROFILEGEAR(); // Assignment operator - MERCPROFILESTRUCT& operator=(const MERCPROFILESTRUCT&); + MERCPROFILEGEAR& operator=(const MERCPROFILEGEAR&); // Destructor - ~MERCPROFILESTRUCT(); + ~MERCPROFILEGEAR(); - // Initialize the mercenary profile. - // Use this instead of the old method of calling memset. - // Note that the constructor does this automatically. + // Initialize the mercenary profile gear void initialize(); - // Clear out the mercenary profile's invetory - // Use this instead of the old method of calling memset. // Note that the constructor does this automatically. void clearInventory(); - - // Ugly temporary solution - void CopyOldInventoryToNew(); - void CopyNewInventoryToOld(); - - // Note: Place all non-POD items at the end (after endOfPOD) - // The format of this structure affects what is written into and read from various - // files (maps, save files, etc.). If you change it then that code will not work - // properly until it is all fixed and the files updated. public: + UINT16 mIndex; + CHAR8 mName[80]; + char endOfPOD; // marker for end of POD (plain old data) + std::vector inv; + std::vector iStatus; + std::vector iDrop; + std::vector iNumber; + std::vector lbe; + std::vector lStatus; +private: + int invCnt; + int lbeCnt; +}; +#define SIZEOF_MERCPROFILEGEAR_POD offsetof( MERCPROFILEGEAR, endOfPOD ) + +class OLD_MERCPROFILESTRUCT_101 +{ +public: + // Constructor + OLD_MERCPROFILESTRUCT_101(); CHAR16 zName[ NAME_LENGTH ]; CHAR16 zNickname[ NICKNAME_LENGTH ]; UINT32 uiAttnSound; @@ -201,7 +205,7 @@ public: UINT32 uiGoodSound; UINT32 uiGruntSound; UINT32 uiGrunt2Sound; - UINT32 uiOkSound; + UINT32 uiOkSound; UINT8 ubFaceIndex; PaletteRepID PANTS; PaletteRepID VEST; @@ -246,7 +250,7 @@ public: UINT16 sSectorX; UINT16 sSectorY; - UINT32 uiDayBecomesAvailable; //day the merc will be available. used with the bMercStatus + UINT32 uiDayBecomesAvailable; //day the merc will be available. used with the bMercStatus INT8 bStrength; @@ -260,15 +264,15 @@ public: INT8 bMedicalDelta; INT8 bMechanicDelta; INT8 bExplosivesDelta; - INT8 bStrengthDelta; - INT8 bLeadershipDelta; - UINT16 usKills; - UINT16 usAssists; - UINT16 usShotsFired; - UINT16 usShotsHit; - UINT16 usBattlesFought; - UINT16 usTimesWounded; - UINT16 usTotalDaysServed; + INT8 bStrengthDelta; + INT8 bLeadershipDelta; + UINT16 usKills; + UINT16 usAssists; + UINT16 usShotsFired; + UINT16 usShotsHit; + UINT16 usBattlesFought; + UINT16 usTimesWounded; + UINT16 usTotalDaysServed; INT16 sLeadershipGain; INT16 sStrengthGain; @@ -299,10 +303,8 @@ public: UINT8 bResigned; UINT8 bActive; -private: UINT8 DO_NOT_USE_bInvStatus[OldInventory::NUM_INV_SLOTS]; - UINT8 DO_NOT_USE_bInvNumber[OldInventory::NUM_INV_SLOTS]; -public: + UINT8 DO_NOT_USE_bInvNumber[OldInventory::NUM_INV_SLOTS]; UINT16 usApproachFactor[4]; INT8 bMainGunAttractiveness; @@ -315,9 +317,7 @@ public: UINT8 ubInvUndroppable; UINT8 ubRoomRangeStart[2]; -private: UINT16 DO_NOT_USE_inv[OldInventory::NUM_INV_SLOTS]; -public: INT8 bMercTownReputation[ 20 ]; UINT16 usStatChangeChances[ 12 ]; // used strictly for balancing, never shown! @@ -355,7 +355,7 @@ public: UINT16 usOptionalGearCost; INT8 bMercOpinion[75]; INT8 bApproached; - INT8 bMercStatus; //The status of the merc. If negative, see flags at the top of this file. Positive: The number of days the merc is away for. 0: Not hired but ready to be. + INT8 bMercStatus; //The status of the merc. If negative, see flags at the top of this file. Positive: The number of days the merc is away for. 0: Not hired but ready to be. INT8 bHatedTime[5]; INT8 bLearnToLikeTime; INT8 bLearnToHateTime; @@ -382,7 +382,7 @@ public: UINT8 ubDaysOfMoraleHangover; // used only when merc leaves team while having poor morale UINT8 ubNumTimesDrugUseInLifetime; // The # times a drug has been used in the player's lifetime... - // Flags used for the precedent to repeating oneself in Contract negotiations. Used for quote 80 - ~107. Gets reset every day + // Flags used for the precedent to repeating oneself in Contract negotiations. Used for quote 80 - ~107. Gets reset every day UINT32 uiPrecedentQuoteSaid; UINT32 uiProfileChecksum; INT16 sPreCombatGridNo; @@ -395,19 +395,251 @@ public: UINT8 ubBuffer[4]; // - // New and OO stuff goes after here. Above this point any changes will goof up reading from files. + // New and OO stuff goes after here. Above this point any changes will goof up reading from files. + // + + char endOfPOD; // marker for end of POD (plain old data) +}; +#define SIZEOF_OLD_MERCPROFILESTRUCT_101_POD offsetof( OLD_MERCPROFILESTRUCT_101, endOfPOD ) + +class MERCPROFILESTRUCT { +public: + // Constructor + MERCPROFILESTRUCT(); + // Copy Constructor + MERCPROFILESTRUCT(const MERCPROFILESTRUCT&); + // Conversion operator + MERCPROFILESTRUCT& operator=(const OLD_MERCPROFILESTRUCT_101& src); + // Assignment operator + MERCPROFILESTRUCT& operator=(const MERCPROFILESTRUCT&); + // Destructor + ~MERCPROFILESTRUCT(); + + void CopyOldInventoryToNew(const OLD_MERCPROFILESTRUCT_101& src); + // Changed by ADB, rev 1513 + //BOOLEAN Load(HWFILE hFile, bool forceLoadOldVersion); + BOOLEAN Load(HWFILE hFile, bool forceLoadOldVersion, bool forceLoadOldEncryption, bool wasSavedWithEncryption); + BOOLEAN Save(HWFILE hFile); + UINT32 GetChecksum(); + + // Initialize the mercenary profile. + // Use this instead of the old method of calling memset. + // Note that the constructor does this automatically. + void initialize(); + + // Clear out the mercenary profile's invetory + // Use this instead of the old method of calling memset. + // Note that the constructor does this automatically. + void clearInventory(); + + // Note: Place all non-POD items at the end (after endOfPOD) + // The format of this structure affects what is written into and read from various + // files (maps, save files, etc.). If you change it then that code will not work + // properly until it is all fixed and the files updated. +public: + CHAR16 zName[ NAME_LENGTH ]; + CHAR16 zNickname[ NICKNAME_LENGTH ]; + UINT32 uiAttnSound; + UINT32 uiCurseSound; + UINT32 uiDieSound; + UINT32 uiGoodSound; + UINT32 uiGruntSound; + UINT32 uiGrunt2Sound; + UINT32 uiOkSound; + UINT8 ubFaceIndex; + PaletteRepID PANTS; + PaletteRepID VEST; + PaletteRepID SKIN; + PaletteRepID HAIR; + INT8 bSex; + INT8 bArmourAttractiveness; + UINT8 ubMiscFlags2; + INT8 bEvolution; + UINT8 ubMiscFlags; + UINT8 bSexist; + INT8 bLearnToHate; + + // skills + INT8 bStealRate; + INT8 bVocalVolume; + UINT8 ubQuoteRecord; + INT8 bDeathRate; + INT8 bScientific; + + INT16 sExpLevelGain; + INT16 sLifeGain; + INT16 sAgilityGain; + INT16 sDexterityGain; + INT16 sWisdomGain; + INT16 sMarksmanshipGain; + INT16 sMedicalGain; + INT16 sMechanicGain; + INT16 sExplosivesGain; + + UINT8 ubBodyType; + INT8 bMedical; + + UINT16 usEyesX; + UINT16 usEyesY; + UINT16 usMouthX; + UINT16 usMouthY; + UINT32 uiEyeDelay; + UINT32 uiMouthDelay; + UINT32 uiBlinkFrequency; + UINT32 uiExpressionFrequency; + UINT16 sSectorX; + UINT16 sSectorY; + + UINT32 uiDayBecomesAvailable; //day the merc will be available. used with the bMercStatus + + INT8 bStrength; + + INT8 bLifeMax; + INT8 bExpLevelDelta; + INT8 bLifeDelta; + INT8 bAgilityDelta; + INT8 bDexterityDelta; + INT8 bWisdomDelta; + INT8 bMarksmanshipDelta; + INT8 bMedicalDelta; + INT8 bMechanicDelta; + INT8 bExplosivesDelta; + INT8 bStrengthDelta; + INT8 bLeadershipDelta; + UINT16 usKills; + UINT16 usAssists; + UINT16 usShotsFired; + UINT16 usShotsHit; + UINT16 usBattlesFought; + UINT16 usTimesWounded; + UINT16 usTotalDaysServed; + + INT16 sLeadershipGain; + INT16 sStrengthGain; + + + + // BODY TYPE SUBSITUTIONS + UINT32 uiBodyTypeSubFlags; + + INT16 sSalary; + INT8 bLife; + INT8 bDexterity; // dexterity (hand coord) value + INT8 bPersonalityTrait; + INT8 bSkillTrait; + + INT8 bReputationTolerance; + INT8 bExplosive; + INT8 bSkillTrait2; + INT8 bLeadership; + + INT8 bBuddy[5]; + INT8 bHated[5]; + INT8 bExpLevel; // general experience level + + INT8 bMarksmanship; + UINT8 bMinService; + INT8 bWisdom; + UINT8 bResigned; + UINT8 bActive; + + UINT16 usApproachFactor[4]; + + INT8 bMainGunAttractiveness; + INT8 bAgility; // agility (speed) value + + BOOLEAN fUseProfileInsertionInfo; // Set to various flags, ( contained in TacticalSave.h ) + INT16 sGridNo; // The Gridno the NPC was in before leaving the sector + UINT8 ubQuoteActionID; + INT8 bMechanical; + + UINT8 ubInvUndroppable; + UINT8 ubRoomRangeStart[2]; + INT8 bMercTownReputation[ 20 ]; + + UINT16 usStatChangeChances[ 12 ]; // used strictly for balancing, never shown! + UINT16 usStatChangeSuccesses[ 12 ]; // used strictly for balancing, never shown! + + UINT8 ubStrategicInsertionCode; + + UINT8 ubRoomRangeEnd[2]; + + UINT8 ubLastQuoteSaid; + + INT8 bRace; + INT8 bNationality; + INT8 bAppearance; + INT8 bAppearanceCareLevel; + INT8 bRefinement; + INT8 bRefinementCareLevel; + INT8 bHatedNationality; + INT8 bHatedNationalityCareLevel; + INT8 bRacist; + UINT32 uiWeeklySalary; + UINT32 uiBiWeeklySalary; + INT8 bMedicalDeposit; + INT8 bAttitude; + INT8 bBaseMorale; + UINT16 sMedicalDepositAmount; + + INT8 bLearnToLike; + UINT8 ubApproachVal[4]; + UINT8 ubApproachMod[3][4]; + INT8 bTown; + INT8 bTownAttachment; + UINT16 usOptionalGearCost; + INT8 bMercOpinion[75]; + INT8 bApproached; + INT8 bMercStatus; //The status of the merc. If negative, see flags at the top of this file. Positive: The number of days the merc is away for. 0: Not hired but ready to be. + INT8 bHatedTime[5]; + INT8 bLearnToLikeTime; + INT8 bLearnToHateTime; + INT8 bHatedCount[5]; + INT8 bLearnToLikeCount; + INT8 bLearnToHateCount; + UINT8 ubLastDateSpokenTo; + UINT8 bLastQuoteSaidWasSpecial; + INT8 bSectorZ; + UINT16 usStrategicInsertionData; + INT8 bFriendlyOrDirectDefaultResponseUsedRecently; + INT8 bRecruitDefaultResponseUsedRecently; + INT8 bThreatenDefaultResponseUsedRecently; + INT8 bNPCData; // NPC specific + INT32 iBalance; + INT16 sTrueSalary; // for use when the person is working for us for free but has a positive salary value + UINT8 ubCivilianGroup; + UINT8 ubNeedForSleep; + UINT32 uiMoney; + INT8 bNPCData2; // NPC specific + + UINT8 ubMiscFlags3; + + UINT8 ubDaysOfMoraleHangover; // used only when merc leaves team while having poor morale + UINT8 ubNumTimesDrugUseInLifetime; // The # times a drug has been used in the player's lifetime... + + // Flags used for the precedent to repeating oneself in Contract negotiations. Used for quote 80 - ~107. Gets reset every day + UINT32 uiPrecedentQuoteSaid; + UINT32 uiProfileChecksum; + INT16 sPreCombatGridNo; + UINT8 ubTimeTillNextHatedComplaint; + UINT8 ubSuspiciousDeath; + + INT32 iMercMercContractLength; //Used for MERC mercs, specifies how many days the merc has gone since last page + + UINT32 uiTotalCostToDate; // The total amount of money that has been paid to the merc for their salary + + // + // New and OO stuff goes after here. Above this point any changes will goof up reading from files. // - //char ef1; // Extra filler to get "offsetof(endOfPOD)" to match SIZEOF(oldstruct) char endOfPOD; // marker for end of POD (plain old data) - vector inv; - vector bInvStatus; - vector bInvNumber; + std::vector inv; + std::vector bInvStatus; + std::vector bInvNumber; }; // MERCPROFILESTRUCT; #define SIZEOF_MERCPROFILESTRUCT_POD offsetof( MERCPROFILESTRUCT, endOfPOD ) -#define SIZEOF_MERCPROFILESTRUCT sizeof( MERCPROFILESTRUCT ) #define TIME_BETWEEN_HATED_COMPLAINTS 24 diff --git a/Tactical/soldier tile.h b/Tactical/soldier tile.h index cb47d5c8..f3c20a38 100644 --- a/Tactical/soldier tile.h +++ b/Tactical/soldier tile.h @@ -4,8 +4,8 @@ #include "soldier control.h" #define MOVE_TILE_CLEAR 1 -#define MOVE_TILE_TEMP_BLOCKED -1 -#define MOVE_TILE_STATIONARY_BLOCKED -2 +#define MOVE_TILE_TEMP_BLOCKED -1 +#define MOVE_TILE_STATIONARY_BLOCKED -2 diff --git a/TacticalAI/AIInternals.h b/TacticalAI/AIInternals.h index 7bf4ad4e..be5d4f32 100644 --- a/TacticalAI/AIInternals.h +++ b/TacticalAI/AIInternals.h @@ -9,32 +9,32 @@ extern BOOLEAN gfTurnBasedAI; #define MAX_DIST 160 -// THIS IS AN ITEM # - AND FOR NOW JUST COMPLETELY FAKE... +// THIS IS AN ITEM # - AND FOR NOW JUST COMPLETELY FAKE... -#define MAX_TOSS_SEARCH_DIST 1 // must throw within this of opponent -#define NPC_TOSS_SAFETY_MARGIN 4 // all friends must be this far away +#define MAX_TOSS_SEARCH_DIST 1 // must throw within this of opponent +#define NPC_TOSS_SAFETY_MARGIN 4 // all friends must be this far away -#define ACTING_ON_SCHEDULE( p ) ( (p)->fAIFlags & AI_CHECK_SCHEDULE ) +#define ACTING_ON_SCHEDULE( p ) ( (p)->aiData.fAIFlags & AI_CHECK_SCHEDULE ) // the AI should try to have this many APs before climbing a roof, if possible #define AI_AP_CLIMBROOF 15 -#define TEMPORARILY 0 -#define FOREVER 1 +#define TEMPORARILY 0 +#define FOREVER 1 -#define IGNORE_PATH 0 -#define ENSURE_PATH 1 -#define ENSURE_PATH_COST 2 +#define IGNORE_PATH 0 +#define ENSURE_PATH 1 +#define ENSURE_PATH_COST 2 -//Kris: November 10, 1997 -//Please don't change this value from 10. It will invalidate all of the maps and soldiers. -#define MAXPATROLGRIDS 10 +//Kris: November 10, 1997 +//Please don't change this value from 10. It will invalidate all of the maps and soldiers. +#define MAXPATROLGRIDS 10 -#define NOWATER 0 -#define WATEROK 1 +#define NOWATER 0 +#define WATEROK 1 #define DONTADDTURNCOST 0 -#define ADDTURNCOST 1 +#define ADDTURNCOST 1 enum { @@ -44,17 +44,17 @@ enum NUM_URGENCY_STATES }; -#define NOWATER 0 -#define WATEROK 1 +#define NOWATER 0 +#define WATEROK 1 -#define IGNORE_PATH 0 -#define ENSURE_PATH 1 -#define ENSURE_PATH_COST 2 +#define IGNORE_PATH 0 +#define ENSURE_PATH 1 +#define ENSURE_PATH_COST 2 -#define DONTFORCE 0 -#define FORCE 1 +#define DONTFORCE 0 +#define FORCE 1 -#define MAX_ROAMING_RANGE WORLD_COLS +#define MAX_ROAMING_RANGE WORLD_COLS #define PTR_CIV_OR_MILITIA ( PTR_CIVILIAN || (pSoldier->bTeam == MILITIA_TEAM) ) @@ -62,40 +62,40 @@ enum #define REALTIME_CIV_AI_DELAY ( 1000 * (gTacticalStatus.Team[ MILITIA_TEAM ].bMenInSector + gTacticalStatus.Team[ CIV_TEAM ].bMenInSector) + 5000 + 2000 * Random( 3 ) ) #define REALTIME_CREATURE_AI_DELAY ( 10000 + 1000 * Random( 3 ) ) -//#define PLAYINGMODE 0 -//#define CAMPAIGNLENGTH 1 -//#define LASTUSABLESLOT 2 -//#define RANDOMMERCS 3 -//#define AVAILABLEMERCS 4 -//#define HIRINGKNOWLEDGE 5 -//#define EQUIPMENTLEVEL 6 -//#define ENEMYTEAMSIZE 7 -#define ENEMYDIFFICULTY 8 // this is being used in this module -//#define FOG_OF_WAR 9 -//#define TURNLENGTH 10 -//#define INCREASEDAP 11 -//#define BLOODSTAINS 12 -//#define STARTINGBALANCE 13 -#define MAXGAMEOPTIONS 14 +//#define PLAYINGMODE 0 +//#define CAMPAIGNLENGTH 1 +//#define LASTUSABLESLOT 2 +//#define RANDOMMERCS 3 +//#define AVAILABLEMERCS 4 +//#define HIRINGKNOWLEDGE 5 +//#define EQUIPMENTLEVEL 6 +//#define ENEMYTEAMSIZE 7 +#define ENEMYDIFFICULTY 8 // this is being used in this module +//#define FOG_OF_WAR 9 +//#define TURNLENGTH 10 +//#define INCREASEDAP 11 +//#define BLOODSTAINS 12 +//#define STARTINGBALANCE 13 +#define MAXGAMEOPTIONS 14 -#define NOSHOOT_WAITABIT -1 -#define NOSHOOT_WATER -2 -#define NOSHOOT_MYSELF -3 -#define NOSHOOT_HURT -4 -#define NOSHOOT_NOAMMO -5 -#define NOSHOOT_NOLOAD -6 -#define NOSHOOT_NOWEAPON -7 +#define NOSHOOT_WAITABIT -1 +#define NOSHOOT_WATER -2 +#define NOSHOOT_MYSELF -3 +#define NOSHOOT_HURT -4 +#define NOSHOOT_NOAMMO -5 +#define NOSHOOT_NOLOAD -6 +#define NOSHOOT_NOWEAPON -7 -#define PERCENT_TO_IGNORE_THREAT 50 // any less, use threat value +#define PERCENT_TO_IGNORE_THREAT 50 // any less, use threat value #define ACTION_TIMEOUT_CYCLES 50 // # failed cycles through AI -#define MAX_THREAT_RANGE 400 // 30 tiles worth +#define MAX_THREAT_RANGE 400 // 30 tiles worth #define MIN_PERCENT_BETTER 5 // 5% improvement in cover is good -#define TOSSES_PER_10TURNS 18 // max # of grenades tossable in 10 turns -#define SHELLS_PER_10TURNS 13 // max # of shells firable in 10 turns +#define TOSSES_PER_10TURNS 18 // max # of grenades tossable in 10 turns +#define SHELLS_PER_10TURNS 13 // max # of shells firable in 10 turns -#define SEE_THRU_COVER_THRESHOLD 5 // min chance to get through +#define SEE_THRU_COVER_THRESHOLD 5 // min chance to get through #undef min #define min(a,b) ((a) < (b) ? (a) : (b)) @@ -119,15 +119,15 @@ typedef struct typedef struct { - UINT8 ubPossible; // is this attack form possible? T/F - UINT8 ubOpponent; // which soldier is the victim? + UINT8 ubPossible; // is this attack form possible? T/F + UINT8 ubOpponent; // which soldier is the victim? UINT8 ubAimTime; // how many extra APs to spend on aiming - UINT8 ubChanceToReallyHit; // chance to hit * chance to get through cover - INT32 iAttackValue; // relative worthiness of this type of attack + UINT8 ubChanceToReallyHit; // chance to hit * chance to get through cover + INT32 iAttackValue; // relative worthiness of this type of attack INT16 sTarget; // target gridno of this attack - INT8 bTargetLevel; // target level of this attack + INT8 bTargetLevel; // target level of this attack UINT8 ubAPCost; // how many APs the attack will use up - INT8 bWeaponIn; // the inv slot of the weapon in question + INT8 bWeaponIn; // the inv slot of the weapon in question } ATTACKTYPE; extern THREATTYPE Threat[MAXMERCS]; @@ -226,5 +226,5 @@ void CheckIfShotPossible(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN s INT16 FindBestCoverNearTheGridNo(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubSearchRadius ); -INT8 FindDirectionForClimbing( INT16 sGridNo, INT8 bLevel); +INT8 FindDirectionForClimbing( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel); diff --git a/TacticalAI/AIList.cpp b/TacticalAI/AIList.cpp index 2e60aed0..5a01f98f 100644 --- a/TacticalAI/AIList.cpp +++ b/TacticalAI/AIList.cpp @@ -1,6 +1,6 @@ /* * - * This file contains code for the AI linked list which + * This file contains code for the AI linked list which * (in TURNBASED COMBAT) keeps track of which AI guy should * be handled next. * @@ -133,7 +133,7 @@ BOOLEAN InsertIntoAIList( UINT8 ubID, INT8 bPriority ) AILIST * pEntry, * pNewEntry, * pPrevEntry = NULL; ubNewEntry = FindEmptyAIListEntry(); - + pNewEntry = CreateNewAIListEntry( ubNewEntry, ubID, bPriority ); // look through the list now to see where to insert the entry @@ -147,7 +147,7 @@ BOOLEAN InsertIntoAIList( UINT8 ubID, INT8 bPriority ) else { pEntry = gpFirstAIListEntry; - do + do { if ( bPriority > pEntry->bPriority ) { @@ -182,25 +182,25 @@ BOOLEAN InsertIntoAIList( UINT8 ubID, INT8 bPriority ) return( FALSE ); } -BOOLEAN SatisfiesAIListConditions( SOLDIERTYPE * pSoldier, UINT8 * pubDoneCount, BOOLEAN fDoRandomChecks ) +BOOLEAN SatisfiesAIListConditions( SOLDIERTYPE * pSoldier, UINT8 * pubDoneCount, BOOLEAN fDoRandomChecks ) { - if ( (gTacticalStatus.bBoxingState == BOXING) && !(pSoldier->uiStatusFlags & SOLDIER_BOXER) ) + if ( (gTacticalStatus.bBoxingState == BOXING) && !(pSoldier->flags.uiStatusFlags & SOLDIER_BOXER) ) { return( FALSE ); } - if ( ! ( pSoldier->bActive && pSoldier->bInSector ) ) + if ( ! ( pSoldier->bActive && pSoldier->bInSector ) ) { - // the check for + // the check for return( FALSE ); } - if ( ! ( pSoldier->bLife >= OKLIFE && pSoldier->bBreath >= OKBREATH ) ) + if ( ! ( pSoldier->stats.bLife >= OKLIFE && pSoldier->bBreath >= OKBREATH ) ) { return( FALSE ); } - if ( pSoldier->bMoved ) + if ( pSoldier->aiData.bMoved ) { if ( pSoldier->bActionPoints <= 1 && pubDoneCount ) { @@ -223,9 +223,9 @@ BOOLEAN SatisfiesAIListConditions( SOLDIERTYPE * pSoldier, UINT8 * pubDoneCount, } // if someone in a civ group is neutral but the civ group is non-neutral, should be handled all the time - if ( pSoldier->bNeutral && (pSoldier->ubCivilianGroup == NON_CIV_GROUP || gTacticalStatus.fCivGroupHostile[pSoldier->ubCivilianGroup] == CIV_GROUP_NEUTRAL ) ) + if ( pSoldier->aiData.bNeutral && (pSoldier->ubCivilianGroup == NON_CIV_GROUP || gTacticalStatus.fCivGroupHostile[pSoldier->ubCivilianGroup] == CIV_GROUP_NEUTRAL ) ) { - if ( pSoldier->bAlertStatus < STATUS_RED ) + if ( pSoldier->aiData.bAlertStatus < STATUS_RED ) { // unalerted, barely handle if ( fDoRandomChecks && PreRandom( 10 ) && !(pSoldier->ubQuoteRecord) ) @@ -236,7 +236,7 @@ BOOLEAN SatisfiesAIListConditions( SOLDIERTYPE * pSoldier, UINT8 * pubDoneCount, else { // heard gunshots - if ( pSoldier->uiStatusFlags & SOLDIER_COWERING ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_COWERING ) { if ( pSoldier->bVisible ) { @@ -270,9 +270,9 @@ BOOLEAN SatisfiesAIListConditions( SOLDIERTYPE * pSoldier, UINT8 * pubDoneCount, // non-neutral civs should be handled all the time, right? // reset last action if cowering - if ( pSoldier->uiStatusFlags & SOLDIER_COWERING ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_COWERING ) { - pSoldier->bLastAction = AI_ACTION_NONE; + pSoldier->aiData.bLastAction = AI_ACTION_NONE; } } @@ -298,12 +298,12 @@ BOOLEAN MoveToFrontOfAIList( UINT8 ubID ) if (gpFirstAIListEntry == NULL) { - return( InsertIntoAIList( ubID, MAX_AI_PRIORITY ) ); + return( InsertIntoAIList( ubID, MAX_AI_PRIORITY ) ); } else { bPriority = gpFirstAIListEntry->bPriority; - ubNewEntry = FindEmptyAIListEntry(); + ubNewEntry = FindEmptyAIListEntry(); pNewEntry = CreateNewAIListEntry( ubNewEntry, ubID, bPriority ); // insert at front @@ -329,11 +329,11 @@ BOOLEAN BuildAIListForTeam( INT8 bTeam ) // clear the AI list ClearAIList(); - + // create a new list for( uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++ ) { - // non-null merc slot ensures active + // non-null merc slot ensures active pSoldier = MercSlots[ uiLoop ]; if ( pSoldier && pSoldier->bTeam == bTeam ) { @@ -342,7 +342,7 @@ BOOLEAN BuildAIListForTeam( INT8 bTeam ) continue; } - bPriority = pSoldier->bAlertStatus; + bPriority = pSoldier->aiData.bAlertStatus; if ( pSoldier->bVisible == TRUE ) { bPriority += 3; @@ -371,574 +371,574 @@ BOOLEAN BuildAIListForTeam( INT8 bTeam ) UINT8 gubEncryptionArray1[ BASE_NUMBER_OF_ROTATION_ARRAYS * 3 ][ NEW_ROTATION_ARRAY_SIZE ] = { - { - 11,129,18,136,163,80,128, - 53,174,146,188,240,208,162, - 127,192,251,6,52,128,119, - 123,234,131,60,66,171,237, - 89,192,17,37,139,20,185, - 48,218,176,116,87,91,156, - 166,224,215,100,237,71,157 - }, - - { - 99,93,179,25,113,109,38, - 135,144,248,17,108,178,84, - 210,254,54,240,209,92,35, - 121,166,153,203,239,27,134, - 231,193,97,73,188,59,87, - 146,111,103,48,161,25,196, - 84,201,179,208,220,189,113 - }, - - { - 217,122,77,162,22,25,203, - 190,115,43,235,154,27,227, - 44,125,34,58,157,17,83, - 26,63,221,159,135,149,85, - 26,32,201,22,253,189,250, - 113,185,171,252,214,115,41, - 65,49,3,174,27,220,206 - }, - - { - 180,29,63,146,101,192,164, - 128,7,28,111,172,125,203, - 63,77,184,220,27,184,98, - 224,64,156,178,229,167,105, - 169,147,215,103,168,25,40, - 114,156,45,253,198,179,207, - 35,235,225,20,205,34,14 - }, - - { - 144,113,83,76,208,239,2, - 236,97,66,38,195,185,52, - 121,123,196,66,34,78,50, - 66,57,247,79,216,38,63, - 155,107,62,234,218,142,175, - 125,209,159,31,135,99,143, - 250,243,90,127,249,32,121 - }, - - { - 76,189,22,40,143,9,197, - 91,66,142,145,3,138,202, - 4,170,214,219,20,140,212, - 214,183,197,98,142,57,235, - 16,71,13,186,77,72,147, - 14,206,204,152,226,86,66, - 219,148,100,89,148,22,243 - }, - - { - 206,52,86,217,117,60,134, - 215,114,154,137,4,37,66, - 48,147,170,113,137,175,130, - 112,246,87,69,40,64,249, - 227,97,91,216,102,11,40, - 195,173,91,205,85,32,40, - 248,63,194,73,172,181,184 - }, - - { - 95,234,168,147,217,213,204, - 132,140,158,22,201,182,222, - 191,104,206,165,108,154,226, - 236,135,245,247,166,112,180, - 49,43,146,43,23,40,249, - 206,228,226,135,211,33,241, - 74,214,104,47,44,132,187 - }, - - { - 26,121,193,40,90,98,61, - 42,168,13,248,146,203,80, - 166,90,223,172,107,45,168, - 161,239,10,34,239,59,209, - 4,231,81,23,120,85,12, - 12,182,35,39,229,187,83, - 243,142,218,94,179,241,90 - }, - - { - 142,9,212,220,121,125,115, - 191,40,144,216,56,6,76, - 46,90,51,206,241,201,77, - 202,90,67,73,116,203,199, - 115,197,174,133,56,174,132, - 91,185,8,143,5,221,216, - 232,211,225,219,86,5,16 - }, - - { - 195,200,131,175,42,189,78, - 186,174,122,45,142,55,106, - 248,10,204,112,38,82,5, - 154,209,193,124,244,5,29, - 79,237,97,175,16,8,250, - 93,44,79,143,63,64,84, - 205,244,74,6,242,42,58 - }, - - { - 82,107,124,208,214,175,77, - 77,123,32,162,220,87,3, - 156,62,171,114,178,161,88, - 102,51,47,152,147,54,41, - 105,91,137,53,107,125,183, - 174,142,207,195,133,127,164, - 165,161,2,37,44,65,60 - }, - - { - 79,86,68,37,213,189,232, - 15,143,41,230,136,191,222, - 103,133,217,205,204,23,10, - 45,197,140,55,160,166,99, - 169,119,117,198,35,51,178, - 15,139,203,66,8,252,236, - 125,90,88,169,222,244,35 - }, - - { - 206,62,201,224,92,24,183, - 166,85,215,246,29,100,157, - 224,164,126,118,116,219,18, - 120,92,60,230,206,224,4, - 51,19,146,37,19,255,11, - 123,233,236,157,232,207,13, - 66,177,158,229,169,180,180 - }, - - { - 254,188,196,16,50,108,215, - 198,166,37,72,138,227,191, - 212,60,245,70,171,57,30, - 97,27,98,4,211,66,152, - 225,198,91,154,166,86,234, - 10,124,31,130,130,182,56, - 85,134,152,104,78,51,237 - }, - - { - 236,233,113,237,175,131,167, - 99,63,81,142,139,103,199, - 62,171,185,154,14,203,229, - 21,89,153,52,2,198,224, - 253,212,40,155,123,88,134, - 5,188,144,130,185,34,11, - 131,71,64,82,241,56,101 - }, - - { - 201,241,254,183,146,209,209, - 56,204,180,211,122,211,146, - 154,117,190,49,116,68,216, - 29,125,35,65,69,224,144, - 123,84,91,223,20,83,90, - 22,36,186,200,111,220,126, - 240,96,223,53,112,101,142 - }, - - { - 243,182,138,24,233,13,236, - 111,101,139,30,233,72,14, - 184,190,152,139,8,27,43, - 209,11,1,28,32,184,180, - 23,136,221,224,23,172,92, - 54,164,174,55,183,64,226, - 55,110,252,49,136,184,237 - }, - - { - 168,31,242,128,40,66,176, - 76,175,24,54,137,56,123, - 117,172,160,14,64,79,145, - 189,229,248,232,177,1,228, - 140,236,147,75,46,114,76, - 98,236,88,11,153,87,150, - 113,38,187,224,182,142,66 - }, - - { - 122,108,52,202,69,109,124, - 11,236,192,188,209,141,143, - 107,2,161,242,191,43,149, - 213,80,56,214,152,203,56, - 184,181,95,171,8,24,230, - 90,155,103,126,27,205,246, - 138,151,25,142,214,114,214 - }, - - { - 213,206,212,75,128,138,215, - 3,9,165,183,182,42,136, - 95,160,201,65,37,150,152, - 120,86,194,18,154,95,72, - 32,216,51,191,18,14,196, - 210,34,39,38,205,70,33, - 49,149,117,58,69,184,47 - }, - - { - 103,250,19,106,176,94,193, - 170,129,145,215,119,136,99, - 150,230,68,189,140,121,205, - 122,113,250,249,128,25,160, - 111,175,78,31,194,145,244, - 241,50,63,74,129,28,126, - 145,114,195,134,27,192,129 - }, - - { - 105,226,237,237,149,175,252, - 47,105,12,92,232,88,227, - 150,6,135,43,231,207,108, - 96,125,141,94,67,149,47, - 140,149,47,26,91,70,142, - 191,156,210,71,9,152,66, - 2,50,96,134,186,44,99 - }, - - { - 170,175,37,193,148,175,69, - 82,195,14,57,200,212,237, - 173,12,48,17,66,33,172, - 253,26,162,149,146,154,80, - 201,219,119,146,111,85,150, - 130,251,78,244,97,242,176, - 24,248,51,221,36,223,33 - }, - - { - 213,62,25,152,108,57,4, - 234,182,62,27,201,109,115, - 108,127,138,80,90,52,185, - 155,125,184,249,199,67,143, - 9,170,32,163,226,66,228, - 119,8,136,33,43,190,251, - 25,44,15,242,48,231,170 - }, - - { - 69,91,100,123,125,126,3, - 16,15,53,81,162,184,255, - 71,231,166,75,180,107,111, - 70,76,164,128,12,27,134, - 15,3,189,185,48,3,58, - 65,38,37,200,190,124,195, - 106,2,12,153,166,58,138 - }, - - { - 123,65,90,159,168,71,9, - 59,29,75,192,44,243,30, - 96,151,51,235,228,107,25, - 10,122,99,77,82,172,172, - 238,98,218,213,14,151,193, - 17,99,33,53,103,222,249, - 211,243,248,47,243,195,56 - }, - - { - 56,101,106,235,205,98,227, - 149,9,73,232,235,35,111, - 57,2,186,181,5,123,226, - 25,5,73,234,254,89,240, - 29,109,202,196,100,234,133, - 21,35,57,225,202,22,171, - 86,96,154,71,43,190,51 - }, - - { - 113,4,220,161,78,222,190, - 105,166,150,161,29,113,135, - 244,63,197,107,244,34,109, - 12,130,139,204,212,9,130, - 89,234,19,21,88,222,93, - 119,22,135,8,75,90,48, - 186,108,73,157,75,30,108 - }, - - { - 17,212,231,18,216,185,255, - 206,139,136,155,69,129,54, - 249,247,173,184,136,88,86, - 87,234,205,238,209,80,233, - 120,180,224,128,177,228,157, - 229,131,214,148,251,230,103, - 174,80,190,201,4,2,208 - }, - - { - 146,254,166,111,69,45,224, - 229,101,23,235,77,130,235, - 201,210,60,113,78,20,166, - 239,198,159,25,140,106,57, - 210,220,85,242,120,14,58, - 186,211,127,152,111,219,20, - 147,21,114,47,54,65,221 - }, - - { - 155,85,87,94,68,199,179, - 247,16,43,80,193,182,242, - 2,222,241,243,234,109,211, - 36,48,131,165,204,150,166, - 31,224,17,175,90,178,226, - 156,73,193,106,70,25,207, - 45,110,76,9,57,33,236 - }, - - { - 92,120,224,167,215,16,147, - 48,40,91,171,186,7,158, - 131,243,194,20,101,62,158, - 82,46,144,65,190,23,223, - 233,24,132,74,164,166,105, - 255,50,68,41,33,225,183, - 114,136,18,144,18,185,137 - }, - - { - 17,38,234,111,64,195,105, - 13,188,100,59,18,103,53, - 94,165,126,168,103,216,69, - 76,238,220,198,89,149,145, - 208,249,2,180,199,181,161, - 111,85,255,154,106,166,101, - 176,38,55,72,130,223,209 - }, - - { - 167,241,154,215,233,21,164, - 109,34,121,61,150,197,43, - 152,236,80,57,1,247,197, - 38,56,196,145,26,241,225, - 184,26,125,57,215,61,108, - 5,217,25,106,86,248,82, - 244,93,228,157,51,255,155 - }, - - { - 17,171,212,222,22,253,38, - 199,218,104,6,108,146,77, - 24,18,109,109,32,217,136, - 11,245,112,196,192,233,176, - 199,40,69,165,19,35,228, - 253,123,233,162,79,218,165, - 141,47,92,202,150,152,45 - }, - - { - 225,196,143,248,9,135,132, - 255,208,73,103,33,197,201, - 226,174,65,101,190,110,210, - 217,216,142,238,169,181,244, - 21,167,20,177,57,211,138, - 7,141,14,153,186,125,207, - 52,40,255,101,49,219,7 - }, - - { - 221,161,17,57,52,123,239, - 174,209,155,220,246,5,150, - 183,9,120,65,88,110,87, - 121,50,70,26,37,101,116, - 179,214,27,159,28,19,139, - 66,223,181,127,121,199,102, - 162,222,47,153,130,15,38 - }, - - { - 17,153,36,244,88,45,209, - 13,52,102,102,28,128,115, - 92,56,99,16,189,213,111, - 73,11,146,130,213,230,111, - 254,221,49,151,65,127,210, - 67,208,249,241,212,65,196, - 197,202,67,119,183,143,207 - }, - - { - 215,34,213,248,221,72,132, - 67,21,208,217,15,31,125, - 206,1,200,69,102,231,110, - 158,231,21,29,36,182,156, - 61,82,201,119,35,142,102, - 8,89,59,54,229,1,5, - 70,123,34,41,23,101,57 - }, - - { - 237,73,8,231,245,255,96, - 23,192,156,114,102,247,212, - 103,60,202,216,189,92,25, - 135,142,70,147,87,94,74, - 147,3,108,158,231,159,5, - 78,65,36,186,99,128,2, - 18,25,152,230,144,115,68 - }, - - { - 67,160,17,62,161,74,151, - 54,117,56,133,66,108,253, - 205,246,229,26,15,240,160, - 164,184,238,53,49,8,79, - 128,206,34,19,134,160,42, - 46,244,13,175,78,210,242, - 70,225,118,232,164,133,95 - }, - - { - 234,31,155,10,134,212,66, - 76,236,106,93,102,226,169, - 245,73,20,225,147,59,178, - 82,227,106,224,136,73,140, - 225,8,166,24,129,254,2, - 60,177,128,86,36,201,254, - 46,168,120,115,83,251,187 - }, - - { - 250,68,115,1,74,167,252, - 185,210,119,96,136,228,20, - 226,83,178,12,92,93,137, - 176,99,183,16,82,157,33, - 240,58,214,190,190,59,230, - 162,107,243,19,160,47,144, - 237,98,48,50,92,59,202 - }, - - { - 200,215,171,200,126,118,10, - 108,131,226,88,154,98,215, - 172,254,156,39,46,143,200, - 255,29,50,226,118,222,231, - 11,231,124,91,113,98,162, - 28,148,147,126,109,164,97, - 127,240,42,199,123,23,180 - }, - - { - 12,31,155,207,220,35,247, - 228,132,83,16,83,176,193, - 3,101,248,53,107,111,184, - 58,242,191,69,225,126,151, - 54,140,231,245,181,216,122, - 88,139,10,38,53,235,254, - 183,99,170,32,231,44,224 - }, - - { - 58,165,53,170,203,99,6, - 7,176,212,91,123,166,220, - 253,142,168,30,92,181,147, - 230,151,199,9,241,63,145, - 18,185,118,166,114,193,176, - 248,40,177,209,100,8,139, - 202,181,248,231,144,70,195 - }, - - { - 130,125,204,233,239,251,121, - 125,221,146,233,122,172,27, - 30,135,191,89,246,172,84, - 164,101,232,68,230,205,26, - 131,152,212,69,170,4,10, - 157,124,120,171,85,158,175, - 253,165,128,27,100,7,165 - }, - - { - 73,196,31,75,40,86,63, - 169,84,115,12,176,43,123, - 51,162,223,112,169,80,73, - 82,110,99,145,226,70,121, - 158,222,108,131,72,70,172, - 32,48,207,219,106,99,30, - 51,249,130,195,120,123,171 - }, - - { - 200,109,185,213,166,141,95, - 219,114,120,103,244,57,23, - 111,193,41,233,225,180,176, - 121,66,10,13,97,114,5, - 125,233,83,167,164,179,138, - 170,44,99,209,215,82,191, - 160,149,104,78,138,201,227 - }, - - { - 213,42,215,30,187,239,231, - 72,204,179,60,193,67,75, - 188,94,173,32,126,173,132, - 254,121,236,7,2,33,168, - 68,249,31,180,211,23,228, - 135,44,63,68,159,20,222, - 221,240,43,142,123,23,244 - }, - - { - 94,48,61,112,51,92,118, - 161,242,95,128,16,237,38, - 159,179,81,76,164,62,254, - 14,169,65,160,197,179,44, - 81,30,183,138,178,196,54, - 141,197,193,234,76,97,64, - 186,179,158,235,115,169,11 - }, - - { - 168,114,74,10,218,199,193, - 41,245,250,186,205,131,243, - 215,15,105,59,42,17,150, - 13,40,194,220,108,22,72, - 37,197,83,249,187,57,148, - 64,234,33,109,51,156,254, - 53,72,55,68,174,240,117 - }, - - { - 55,124,124,107,105,194,22, - 114,242,8,53,46,244,181, - 96,111,133,70,140,37,165, - 131,1,12,65,220,11,103, - 233,72,92,101,91,163,116, - 125,83,15,224,107,242,66, - 178,12,37,63,4,213,48 - }, - - { - 115,221,24,12,172,92,193, - 137,224,105,238,239,70,221, - 224,35,164,110,174,229,104, - 50,86,88,100,25,108,68, - 195,55,41,87,21,47,249, - 212,245,152,96,232,85,190, - 77,39,177,136,180,82,111 - }, - - { - 231,138,6,145,159,235,88, - 248,198,164,9,130,209,202, - 96,14,128,170,71,217,142, - 180,183,53,110,173,41,252, - 249,214,242,217,100,66,95, - 181,71,11,111,109,35,175, - 240,32,51,69,251,41,220 - }, - - { - 177,114,53,161,177,151,101, - 226,222,87,255,85,102,86, - 161,114,178,99,106,206,188, - 98,29,157,53,65,169,67, - 74,31,24,83,60,48,80, - 186,116,113,179,144,90,220, - 252,71,167,25,110,167,94 - }, + { + 11,129,18,136,163,80,128, + 53,174,146,188,240,208,162, + 127,192,251,6,52,128,119, + 123,234,131,60,66,171,237, + 89,192,17,37,139,20,185, + 48,218,176,116,87,91,156, + 166,224,215,100,237,71,157 + }, -}; \ No newline at end of file + { + 99,93,179,25,113,109,38, + 135,144,248,17,108,178,84, + 210,254,54,240,209,92,35, + 121,166,153,203,239,27,134, + 231,193,97,73,188,59,87, + 146,111,103,48,161,25,196, + 84,201,179,208,220,189,113 + }, + + { + 217,122,77,162,22,25,203, + 190,115,43,235,154,27,227, + 44,125,34,58,157,17,83, + 26,63,221,159,135,149,85, + 26,32,201,22,253,189,250, + 113,185,171,252,214,115,41, + 65,49,3,174,27,220,206 + }, + + { + 180,29,63,146,101,192,164, + 128,7,28,111,172,125,203, + 63,77,184,220,27,184,98, + 224,64,156,178,229,167,105, + 169,147,215,103,168,25,40, + 114,156,45,253,198,179,207, + 35,235,225,20,205,34,14 + }, + + { + 144,113,83,76,208,239,2, + 236,97,66,38,195,185,52, + 121,123,196,66,34,78,50, + 66,57,247,79,216,38,63, + 155,107,62,234,218,142,175, + 125,209,159,31,135,99,143, + 250,243,90,127,249,32,121 + }, + + { + 76,189,22,40,143,9,197, + 91,66,142,145,3,138,202, + 4,170,214,219,20,140,212, + 214,183,197,98,142,57,235, + 16,71,13,186,77,72,147, + 14,206,204,152,226,86,66, + 219,148,100,89,148,22,243 + }, + + { + 206,52,86,217,117,60,134, + 215,114,154,137,4,37,66, + 48,147,170,113,137,175,130, + 112,246,87,69,40,64,249, + 227,97,91,216,102,11,40, + 195,173,91,205,85,32,40, + 248,63,194,73,172,181,184 + }, + + { + 95,234,168,147,217,213,204, + 132,140,158,22,201,182,222, + 191,104,206,165,108,154,226, + 236,135,245,247,166,112,180, + 49,43,146,43,23,40,249, + 206,228,226,135,211,33,241, + 74,214,104,47,44,132,187 + }, + + { + 26,121,193,40,90,98,61, + 42,168,13,248,146,203,80, + 166,90,223,172,107,45,168, + 161,239,10,34,239,59,209, + 4,231,81,23,120,85,12, + 12,182,35,39,229,187,83, + 243,142,218,94,179,241,90 + }, + + { + 142,9,212,220,121,125,115, + 191,40,144,216,56,6,76, + 46,90,51,206,241,201,77, + 202,90,67,73,116,203,199, + 115,197,174,133,56,174,132, + 91,185,8,143,5,221,216, + 232,211,225,219,86,5,16 + }, + + { + 195,200,131,175,42,189,78, + 186,174,122,45,142,55,106, + 248,10,204,112,38,82,5, + 154,209,193,124,244,5,29, + 79,237,97,175,16,8,250, + 93,44,79,143,63,64,84, + 205,244,74,6,242,42,58 + }, + + { + 82,107,124,208,214,175,77, + 77,123,32,162,220,87,3, + 156,62,171,114,178,161,88, + 102,51,47,152,147,54,41, + 105,91,137,53,107,125,183, + 174,142,207,195,133,127,164, + 165,161,2,37,44,65,60 + }, + + { + 79,86,68,37,213,189,232, + 15,143,41,230,136,191,222, + 103,133,217,205,204,23,10, + 45,197,140,55,160,166,99, + 169,119,117,198,35,51,178, + 15,139,203,66,8,252,236, + 125,90,88,169,222,244,35 + }, + + { + 206,62,201,224,92,24,183, + 166,85,215,246,29,100,157, + 224,164,126,118,116,219,18, + 120,92,60,230,206,224,4, + 51,19,146,37,19,255,11, + 123,233,236,157,232,207,13, + 66,177,158,229,169,180,180 + }, + + { + 254,188,196,16,50,108,215, + 198,166,37,72,138,227,191, + 212,60,245,70,171,57,30, + 97,27,98,4,211,66,152, + 225,198,91,154,166,86,234, + 10,124,31,130,130,182,56, + 85,134,152,104,78,51,237 + }, + + { + 236,233,113,237,175,131,167, + 99,63,81,142,139,103,199, + 62,171,185,154,14,203,229, + 21,89,153,52,2,198,224, + 253,212,40,155,123,88,134, + 5,188,144,130,185,34,11, + 131,71,64,82,241,56,101 + }, + + { + 201,241,254,183,146,209,209, + 56,204,180,211,122,211,146, + 154,117,190,49,116,68,216, + 29,125,35,65,69,224,144, + 123,84,91,223,20,83,90, + 22,36,186,200,111,220,126, + 240,96,223,53,112,101,142 + }, + + { + 243,182,138,24,233,13,236, + 111,101,139,30,233,72,14, + 184,190,152,139,8,27,43, + 209,11,1,28,32,184,180, + 23,136,221,224,23,172,92, + 54,164,174,55,183,64,226, + 55,110,252,49,136,184,237 + }, + + { + 168,31,242,128,40,66,176, + 76,175,24,54,137,56,123, + 117,172,160,14,64,79,145, + 189,229,248,232,177,1,228, + 140,236,147,75,46,114,76, + 98,236,88,11,153,87,150, + 113,38,187,224,182,142,66 + }, + + { + 122,108,52,202,69,109,124, + 11,236,192,188,209,141,143, + 107,2,161,242,191,43,149, + 213,80,56,214,152,203,56, + 184,181,95,171,8,24,230, + 90,155,103,126,27,205,246, + 138,151,25,142,214,114,214 + }, + + { + 213,206,212,75,128,138,215, + 3,9,165,183,182,42,136, + 95,160,201,65,37,150,152, + 120,86,194,18,154,95,72, + 32,216,51,191,18,14,196, + 210,34,39,38,205,70,33, + 49,149,117,58,69,184,47 + }, + + { + 103,250,19,106,176,94,193, + 170,129,145,215,119,136,99, + 150,230,68,189,140,121,205, + 122,113,250,249,128,25,160, + 111,175,78,31,194,145,244, + 241,50,63,74,129,28,126, + 145,114,195,134,27,192,129 + }, + + { + 105,226,237,237,149,175,252, + 47,105,12,92,232,88,227, + 150,6,135,43,231,207,108, + 96,125,141,94,67,149,47, + 140,149,47,26,91,70,142, + 191,156,210,71,9,152,66, + 2,50,96,134,186,44,99 + }, + + { + 170,175,37,193,148,175,69, + 82,195,14,57,200,212,237, + 173,12,48,17,66,33,172, + 253,26,162,149,146,154,80, + 201,219,119,146,111,85,150, + 130,251,78,244,97,242,176, + 24,248,51,221,36,223,33 + }, + + { + 213,62,25,152,108,57,4, + 234,182,62,27,201,109,115, + 108,127,138,80,90,52,185, + 155,125,184,249,199,67,143, + 9,170,32,163,226,66,228, + 119,8,136,33,43,190,251, + 25,44,15,242,48,231,170 + }, + + { + 69,91,100,123,125,126,3, + 16,15,53,81,162,184,255, + 71,231,166,75,180,107,111, + 70,76,164,128,12,27,134, + 15,3,189,185,48,3,58, + 65,38,37,200,190,124,195, + 106,2,12,153,166,58,138 + }, + + { + 123,65,90,159,168,71,9, + 59,29,75,192,44,243,30, + 96,151,51,235,228,107,25, + 10,122,99,77,82,172,172, + 238,98,218,213,14,151,193, + 17,99,33,53,103,222,249, + 211,243,248,47,243,195,56 + }, + + { + 56,101,106,235,205,98,227, + 149,9,73,232,235,35,111, + 57,2,186,181,5,123,226, + 25,5,73,234,254,89,240, + 29,109,202,196,100,234,133, + 21,35,57,225,202,22,171, + 86,96,154,71,43,190,51 + }, + + { + 113,4,220,161,78,222,190, + 105,166,150,161,29,113,135, + 244,63,197,107,244,34,109, + 12,130,139,204,212,9,130, + 89,234,19,21,88,222,93, + 119,22,135,8,75,90,48, + 186,108,73,157,75,30,108 + }, + + { + 17,212,231,18,216,185,255, + 206,139,136,155,69,129,54, + 249,247,173,184,136,88,86, + 87,234,205,238,209,80,233, + 120,180,224,128,177,228,157, + 229,131,214,148,251,230,103, + 174,80,190,201,4,2,208 + }, + + { + 146,254,166,111,69,45,224, + 229,101,23,235,77,130,235, + 201,210,60,113,78,20,166, + 239,198,159,25,140,106,57, + 210,220,85,242,120,14,58, + 186,211,127,152,111,219,20, + 147,21,114,47,54,65,221 + }, + + { + 155,85,87,94,68,199,179, + 247,16,43,80,193,182,242, + 2,222,241,243,234,109,211, + 36,48,131,165,204,150,166, + 31,224,17,175,90,178,226, + 156,73,193,106,70,25,207, + 45,110,76,9,57,33,236 + }, + + { + 92,120,224,167,215,16,147, + 48,40,91,171,186,7,158, + 131,243,194,20,101,62,158, + 82,46,144,65,190,23,223, + 233,24,132,74,164,166,105, + 255,50,68,41,33,225,183, + 114,136,18,144,18,185,137 + }, + + { + 17,38,234,111,64,195,105, + 13,188,100,59,18,103,53, + 94,165,126,168,103,216,69, + 76,238,220,198,89,149,145, + 208,249,2,180,199,181,161, + 111,85,255,154,106,166,101, + 176,38,55,72,130,223,209 + }, + + { + 167,241,154,215,233,21,164, + 109,34,121,61,150,197,43, + 152,236,80,57,1,247,197, + 38,56,196,145,26,241,225, + 184,26,125,57,215,61,108, + 5,217,25,106,86,248,82, + 244,93,228,157,51,255,155 + }, + + { + 17,171,212,222,22,253,38, + 199,218,104,6,108,146,77, + 24,18,109,109,32,217,136, + 11,245,112,196,192,233,176, + 199,40,69,165,19,35,228, + 253,123,233,162,79,218,165, + 141,47,92,202,150,152,45 + }, + + { + 225,196,143,248,9,135,132, + 255,208,73,103,33,197,201, + 226,174,65,101,190,110,210, + 217,216,142,238,169,181,244, + 21,167,20,177,57,211,138, + 7,141,14,153,186,125,207, + 52,40,255,101,49,219,7 + }, + + { + 221,161,17,57,52,123,239, + 174,209,155,220,246,5,150, + 183,9,120,65,88,110,87, + 121,50,70,26,37,101,116, + 179,214,27,159,28,19,139, + 66,223,181,127,121,199,102, + 162,222,47,153,130,15,38 + }, + + { + 17,153,36,244,88,45,209, + 13,52,102,102,28,128,115, + 92,56,99,16,189,213,111, + 73,11,146,130,213,230,111, + 254,221,49,151,65,127,210, + 67,208,249,241,212,65,196, + 197,202,67,119,183,143,207 + }, + + { + 215,34,213,248,221,72,132, + 67,21,208,217,15,31,125, + 206,1,200,69,102,231,110, + 158,231,21,29,36,182,156, + 61,82,201,119,35,142,102, + 8,89,59,54,229,1,5, + 70,123,34,41,23,101,57 + }, + + { + 237,73,8,231,245,255,96, + 23,192,156,114,102,247,212, + 103,60,202,216,189,92,25, + 135,142,70,147,87,94,74, + 147,3,108,158,231,159,5, + 78,65,36,186,99,128,2, + 18,25,152,230,144,115,68 + }, + + { + 67,160,17,62,161,74,151, + 54,117,56,133,66,108,253, + 205,246,229,26,15,240,160, + 164,184,238,53,49,8,79, + 128,206,34,19,134,160,42, + 46,244,13,175,78,210,242, + 70,225,118,232,164,133,95 + }, + + { + 234,31,155,10,134,212,66, + 76,236,106,93,102,226,169, + 245,73,20,225,147,59,178, + 82,227,106,224,136,73,140, + 225,8,166,24,129,254,2, + 60,177,128,86,36,201,254, + 46,168,120,115,83,251,187 + }, + + { + 250,68,115,1,74,167,252, + 185,210,119,96,136,228,20, + 226,83,178,12,92,93,137, + 176,99,183,16,82,157,33, + 240,58,214,190,190,59,230, + 162,107,243,19,160,47,144, + 237,98,48,50,92,59,202 + }, + + { + 200,215,171,200,126,118,10, + 108,131,226,88,154,98,215, + 172,254,156,39,46,143,200, + 255,29,50,226,118,222,231, + 11,231,124,91,113,98,162, + 28,148,147,126,109,164,97, + 127,240,42,199,123,23,180 + }, + + { + 12,31,155,207,220,35,247, + 228,132,83,16,83,176,193, + 3,101,248,53,107,111,184, + 58,242,191,69,225,126,151, + 54,140,231,245,181,216,122, + 88,139,10,38,53,235,254, + 183,99,170,32,231,44,224 + }, + + { + 58,165,53,170,203,99,6, + 7,176,212,91,123,166,220, + 253,142,168,30,92,181,147, + 230,151,199,9,241,63,145, + 18,185,118,166,114,193,176, + 248,40,177,209,100,8,139, + 202,181,248,231,144,70,195 + }, + + { + 130,125,204,233,239,251,121, + 125,221,146,233,122,172,27, + 30,135,191,89,246,172,84, + 164,101,232,68,230,205,26, + 131,152,212,69,170,4,10, + 157,124,120,171,85,158,175, + 253,165,128,27,100,7,165 + }, + + { + 73,196,31,75,40,86,63, + 169,84,115,12,176,43,123, + 51,162,223,112,169,80,73, + 82,110,99,145,226,70,121, + 158,222,108,131,72,70,172, + 32,48,207,219,106,99,30, + 51,249,130,195,120,123,171 + }, + + { + 200,109,185,213,166,141,95, + 219,114,120,103,244,57,23, + 111,193,41,233,225,180,176, + 121,66,10,13,97,114,5, + 125,233,83,167,164,179,138, + 170,44,99,209,215,82,191, + 160,149,104,78,138,201,227 + }, + + { + 213,42,215,30,187,239,231, + 72,204,179,60,193,67,75, + 188,94,173,32,126,173,132, + 254,121,236,7,2,33,168, + 68,249,31,180,211,23,228, + 135,44,63,68,159,20,222, + 221,240,43,142,123,23,244 + }, + + { + 94,48,61,112,51,92,118, + 161,242,95,128,16,237,38, + 159,179,81,76,164,62,254, + 14,169,65,160,197,179,44, + 81,30,183,138,178,196,54, + 141,197,193,234,76,97,64, + 186,179,158,235,115,169,11 + }, + + { + 168,114,74,10,218,199,193, + 41,245,250,186,205,131,243, + 215,15,105,59,42,17,150, + 13,40,194,220,108,22,72, + 37,197,83,249,187,57,148, + 64,234,33,109,51,156,254, + 53,72,55,68,174,240,117 + }, + + { + 55,124,124,107,105,194,22, + 114,242,8,53,46,244,181, + 96,111,133,70,140,37,165, + 131,1,12,65,220,11,103, + 233,72,92,101,91,163,116, + 125,83,15,224,107,242,66, + 178,12,37,63,4,213,48 + }, + + { + 115,221,24,12,172,92,193, + 137,224,105,238,239,70,221, + 224,35,164,110,174,229,104, + 50,86,88,100,25,108,68, + 195,55,41,87,21,47,249, + 212,245,152,96,232,85,190, + 77,39,177,136,180,82,111 + }, + + { + 231,138,6,145,159,235,88, + 248,198,164,9,130,209,202, + 96,14,128,170,71,217,142, + 180,183,53,110,173,41,252, + 249,214,242,217,100,66,95, + 181,71,11,111,109,35,175, + 240,32,51,69,251,41,220 + }, + + { + 177,114,53,161,177,151,101, + 226,222,87,255,85,102,86, + 161,114,178,99,106,206,188, + 98,29,157,53,65,169,67, + 74,31,24,83,60,48,80, + 186,116,113,179,144,90,220, + 252,71,167,25,110,167,94 + }, + +}; diff --git a/TacticalAI/AIMain.cpp b/TacticalAI/AIMain.cpp index fe4ee853..cabdf5cc 100644 --- a/TacticalAI/AIMain.cpp +++ b/TacticalAI/AIMain.cpp @@ -112,7 +112,7 @@ void DebugAI( STR szOutput ) // Send regular debug msg AND AI debug message FILE * DebugFile; - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, szOutput ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, szOutput ); if ((DebugFile = fopen( "aidebug.txt", "a+t" )) != NULL) { fputs( szOutput, DebugFile ); @@ -169,7 +169,7 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) // ATE // Bail if we are engaged in a NPC conversation/ and/or sequence ... or we have a pause because // we just saw someone... or if there are bombs on the bomb queue - if ( pSoldier->uiStatusFlags & SOLDIER_ENGAGEDINACTION || gTacticalStatus.fEnemySightingOnTheirTurn || (gubElementsOnExplosionQueue != 0) ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_ENGAGEDINACTION || gTacticalStatus.fEnemySightingOnTheirTurn || (gubElementsOnExplosionQueue != 0) ) { return; } @@ -179,16 +179,16 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) return; } - if (pSoldier->uiStatusFlags & SOLDIER_PC) + if (pSoldier->flags.uiStatusFlags & SOLDIER_PC) { // if we're in autobandage, or the AI control flag is set and the player has a quote record to perform, or is a boxer, // let AI process this merc; otherwise abort - if ( !(gTacticalStatus.fAutoBandageMode) && !(pSoldier->uiStatusFlags & SOLDIER_PCUNDERAICONTROL && (pSoldier->ubQuoteRecord != 0 || pSoldier->uiStatusFlags & SOLDIER_BOXER) ) ) + if ( !(gTacticalStatus.fAutoBandageMode) && !(pSoldier->flags.uiStatusFlags & SOLDIER_PCUNDERAICONTROL && (pSoldier->ubQuoteRecord != 0 || pSoldier->flags.uiStatusFlags & SOLDIER_BOXER) ) ) { // patch... - if ( pSoldier->fAIFlags & AI_HANDLE_EVERY_FRAME ) + if ( pSoldier->aiData.fAIFlags & AI_HANDLE_EVERY_FRAME ) { - pSoldier->fAIFlags &= ~AI_HANDLE_EVERY_FRAME; + pSoldier->aiData.fAIFlags &= ~AI_HANDLE_EVERY_FRAME; } return; } @@ -198,7 +198,7 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) else { // AI is run on all PCs except the one who is selected - if (pSoldier->uiStatusFlags & SOLDIER_PC ) + if (pSoldier->flags.uiStatusFlags & SOLDIER_PC ) { // if this soldier is "selected" then only let user give orders! if ((pSoldier->ubID == gusSelectedSoldier) && !(gTacticalStatus.uiFlags & DEMOMODE)) @@ -228,8 +228,8 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) } // why do we let the quote record thing be in here? we're in turnbased the quote record doesn't matter, // we can't act out of turn! - if ( !(pSoldier->uiStatusFlags & SOLDIER_UNDERAICONTROL) ) - //if ( !(pSoldier->uiStatusFlags & SOLDIER_UNDERAICONTROL) && (pSoldier->ubQuoteRecord == 0)) + if ( !(pSoldier->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL) ) + //if ( !(pSoldier->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL) && (pSoldier->ubQuoteRecord == 0)) { return; } @@ -239,10 +239,10 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) #ifdef JA2BETAVERSION ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_ERROR, L"Turning off AI flag for %d because trying to act out of turn", pSoldier->ubID ); #endif - pSoldier->uiStatusFlags &= ~SOLDIER_UNDERAICONTROL; + pSoldier->flags.uiStatusFlags &= ~SOLDIER_UNDERAICONTROL; return; } - if ( pSoldier->bMoved ) + if ( pSoldier->aiData.bMoved ) { #ifdef TESTAICONTROL if (gfTurnBasedAI) @@ -256,11 +256,11 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) } } - else if ( !(pSoldier->fAIFlags & AI_HANDLE_EVERY_FRAME) ) // if set to handle every frame, ignore delay! + else if ( !(pSoldier->aiData.fAIFlags & AI_HANDLE_EVERY_FRAME) ) // if set to handle every frame, ignore delay! { //#ifndef AI_PROFILING //Time to handle guys in realtime (either combat or not ) - if ( !TIMECOUNTERDONE( pSoldier->AICounter, pSoldier->uiAIDelay ) ) + if ( !TIMECOUNTERDONE( pSoldier->timeCounters.AICounter, pSoldier->uiAIDelay ) ) { // CAMFIELD, LOOK HERE! return; @@ -268,30 +268,30 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) else { //Reset counter! - RESETTIMECOUNTER( pSoldier->AICounter, pSoldier->uiAIDelay ); - //DebugMsg( TOPIC_JA2, DBG_LEVEL_0, String( "%s waiting %d from %d", pSoldier->name, pSoldier->AICounter, uiCurrTime ) ); + RESETTIMECOUNTER( pSoldier->timeCounters.AICounter, pSoldier->uiAIDelay ); + //DebugMsg( TOPIC_JA2, DBG_LEVEL_0, String( "%s waiting %d from %d", pSoldier->name, pSoldier->timeCounters.AICounter, uiCurrTime ) ); } //#endif } - if ( pSoldier->fAIFlags & AI_HANDLE_EVERY_FRAME ) // if set to handle every frame, ignore delay! + if ( pSoldier->aiData.fAIFlags & AI_HANDLE_EVERY_FRAME ) // if set to handle every frame, ignore delay! { if (pSoldier->ubQuoteActionID != QUOTE_ACTION_ID_TURNTOWARDSPLAYER) { // turn off flag! - pSoldier->fAIFlags &= (~AI_HANDLE_EVERY_FRAME); + pSoldier->aiData.fAIFlags &= (~AI_HANDLE_EVERY_FRAME); } } // if this NPC is getting hit, abort - if (pSoldier->fGettingHit) + if (pSoldier->flags.fGettingHit) { - return; + return; } if ( gTacticalStatus.bBoxingState == PRE_BOXING || gTacticalStatus.bBoxingState == BOXING || gTacticalStatus.bBoxingState == WON_ROUND || gTacticalStatus.bBoxingState == LOST_ROUND ) { - if ( ! ( pSoldier->uiStatusFlags & SOLDIER_BOXER ) ) + if ( ! ( pSoldier->flags.uiStatusFlags & SOLDIER_BOXER ) ) { // do nothing! #ifdef TESTAICONTROL @@ -306,9 +306,9 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) } // if this NPC is dying, bail - if (pSoldier->bLife < OKLIFE || !pSoldier->bActive ) + if (pSoldier->stats.bLife < OKLIFE || !pSoldier->bActive ) { - if ( pSoldier->bActive && pSoldier->fMuzzleFlash ) + if ( pSoldier->bActive && pSoldier->flags.fMuzzleFlash ) { EndMuzzleFlash( pSoldier ); } @@ -323,15 +323,15 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) return; } - if ( pSoldier->fAIFlags & AI_ASLEEP ) + if ( pSoldier->aiData.fAIFlags & AI_ASLEEP ) { if ( gfTurnBasedAI && pSoldier->bVisible ) { // turn off sleep flag, guy's got to be able to do stuff in turnbased // if he's visible - pSoldier->fAIFlags &= ~AI_ASLEEP; + pSoldier->aiData.fAIFlags &= ~AI_ASLEEP; } - else if ( !(pSoldier->fAIFlags & AI_CHECK_SCHEDULE) ) + else if ( !(pSoldier->aiData.fAIFlags & AI_CHECK_SCHEDULE) ) { // don't do anything! #ifdef TESTAICONTROL @@ -346,7 +346,7 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) } } - if ( pSoldier->bInSector == FALSE && !(pSoldier->fAIFlags & AI_CHECK_SCHEDULE) ) + if ( pSoldier->bInSector == FALSE && !(pSoldier->aiData.fAIFlags & AI_CHECK_SCHEDULE) ) { // don't do anything! #ifdef TESTAICONTROL @@ -360,7 +360,7 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) return; } - if ( ( (pSoldier->uiStatusFlags & SOLDIER_VEHICLE) && !TANK( pSoldier ) ) || AM_A_ROBOT( pSoldier ) ) + if ( ( (pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && !TANK( pSoldier ) ) || AM_A_ROBOT( pSoldier ) ) { // bail out! #ifdef TESTAICONTROL @@ -377,7 +377,7 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) if (pSoldier->bCollapsed) { // being handled so turn off muzzle flash - if ( pSoldier->fMuzzleFlash ) + if ( pSoldier->flags.fMuzzleFlash ) { EndMuzzleFlash( pSoldier ); } @@ -402,9 +402,9 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) return; } - // ATE: Did some changes here + // ATE: Did some changes here // DON'T rethink if we are determined to get somewhere.... - if ( pSoldier->bNewSituation == IS_NEW_SITUATION ) + if ( pSoldier->aiData.bNewSituation == IS_NEW_SITUATION ) { BOOLEAN fProcessNewSituation; @@ -415,7 +415,7 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) fProcessNewSituation = FALSE; #if 0 // HACK!! - if ( pSoldier->bAction == AI_ACTION_FIRE_GUN ) + if ( pSoldier->aiData.bAction == AI_ACTION_FIRE_GUN ) { if ( guiNumBullets == 0 ) { @@ -425,7 +425,7 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) fProcessNewSituation = TRUE; } } - else if ( pSoldier->bAction == AI_ACTION_TOSS_PROJECTILE ) + else if ( pSoldier->aiData.bAction == AI_ACTION_TOSS_PROJECTILE ) { if ( guiNumObjectSlots == 0 ) { @@ -436,7 +436,7 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) } } #endif - } + } else { fProcessNewSituation = TRUE; @@ -444,7 +444,7 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) if ( fProcessNewSituation ) { - if ( (pSoldier->uiStatusFlags & SOLDIER_UNDERAICONTROL) && pSoldier->ubQuoteActionID >= QUOTE_ACTION_ID_TRAVERSE_EAST && pSoldier->ubQuoteActionID <= QUOTE_ACTION_ID_TRAVERSE_NORTH && !GridNoOnVisibleWorldTile( pSoldier->sGridNo ) ) + if ( (pSoldier->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL) && pSoldier->ubQuoteActionID >= QUOTE_ACTION_ID_TRAVERSE_EAST && pSoldier->ubQuoteActionID <= QUOTE_ACTION_ID_TRAVERSE_NORTH && !GridNoOnVisibleWorldTile( pSoldier->sGridNo ) ) { // traversing offmap, ignore new situations } @@ -454,27 +454,27 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) // now we don't have AI controlled escorted mercs though - CJC CancelAIAction( pSoldier, FORCE ); // zap any next action too - if ( pSoldier->bAction != AI_ACTION_END_COWER_AND_MOVE ) + if ( pSoldier->aiData.bAction != AI_ACTION_END_COWER_AND_MOVE ) { - pSoldier->bNextAction = AI_ACTION_NONE; + pSoldier->aiData.bNextAction = AI_ACTION_NONE; } DecideAlertStatus( pSoldier ); } - else + else { if ( pSoldier->ubQuoteRecord ) { // make sure we're not using combat AI - pSoldier->bAlertStatus = STATUS_GREEN; + pSoldier->aiData.bAlertStatus = STATUS_GREEN; } - pSoldier->bNewSituation = WAS_NEW_SITUATION; + pSoldier->aiData.bNewSituation = WAS_NEW_SITUATION; } } } else { // might have been in 'was' state; no longer so... - pSoldier->bNewSituation = NOT_NEW_SITUATION; + pSoldier->aiData.bNewSituation = NOT_NEW_SITUATION; } #ifdef TESTAI @@ -494,11 +494,11 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) // ATE: Display message that deadlock occured... LiveMessage( "Breaking Deadlock" ); -#ifdef JA2TESTVERSION +#ifdef JA2TESTVERSION // display deadlock message gfUIInDeadlock = TRUE; gUIDeadlockedSoldier = pSoldier->ubID; - DebugAI( String("DEADLOCK soldier %d action %s ABC %d", pSoldier->ubID, gzActionStr[pSoldier->bAction], gTacticalStatus.ubAttackBusyCount ) ); + DebugAI( String("DEADLOCK soldier %d action %s ABC %d", pSoldier->ubID, gzActionStr[pSoldier->aiData.bAction], gTacticalStatus.ubAttackBusyCount ) ); #else // If we are in beta version, also report message! @@ -507,7 +507,7 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) #endif // just abort EndAIDeadlock(); - if ( !(pSoldier->uiStatusFlags & SOLDIER_UNDERAICONTROL) ) + if ( !(pSoldier->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL) ) { return; } @@ -522,10 +522,10 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) return; } - if (pSoldier->bAction == AI_ACTION_NONE) - { + if (pSoldier->aiData.bAction == AI_ACTION_NONE) + { // being handled so turn off muzzle flash - if ( pSoldier->fMuzzleFlash ) + if ( pSoldier->flags.fMuzzleFlash ) { EndMuzzleFlash( pSoldier ); } @@ -534,10 +534,10 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) // figure out what to do! if (gfTurnBasedAI) { - if (pSoldier->fNoAPToFinishMove) + if (pSoldier->flags.fNoAPToFinishMove) { // well that move must have been cancelled because we're thinking now! - //pSoldier->fNoAPToFinishMove = FALSE; + //pSoldier->flags.fNoAPToFinishMove = FALSE; } TurnBasedHandleNPCAI( pSoldier ); } @@ -551,15 +551,15 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) { // an old action was in progress; continue it - if (pSoldier->bAction >= FIRST_MOVEMENT_ACTION && pSoldier->bAction <= LAST_MOVEMENT_ACTION && !pSoldier->fDelayedMovement) + if (pSoldier->aiData.bAction >= FIRST_MOVEMENT_ACTION && pSoldier->aiData.bAction <= LAST_MOVEMENT_ACTION && !pSoldier->flags.fDelayedMovement) { - if (pSoldier->usPathIndex == pSoldier->usPathDataSize) + if (pSoldier->pathing.usPathIndex == pSoldier->pathing.usPathDataSize) { if (pSoldier->sAbsoluteFinalDestination != NOWHERE) { if ( !ACTING_ON_SCHEDULE( pSoldier ) && SpacesAway( pSoldier->sGridNo, pSoldier->sAbsoluteFinalDestination ) < 4 ) { - // This is close enough... reached final destination for NPC system move + // This is close enough... reached final destination for NPC system move if ( pSoldier->sAbsoluteFinalDestination != pSoldier->sGridNo ) { // update NPC records to replace our final dest with this location @@ -567,7 +567,7 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) } pSoldier->sAbsoluteFinalDestination = pSoldier->sGridNo; // change action data so that we consider this our final destination below - pSoldier->usActionData = pSoldier->sGridNo; + pSoldier->aiData.usActionData = pSoldier->sGridNo; } if ( pSoldier->sAbsoluteFinalDestination == pSoldier->sGridNo ) @@ -578,8 +578,8 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) { NPCReachedDestination( pSoldier, FALSE ); // wait just a little bit so the queue can be processed - pSoldier->bNextAction = AI_ACTION_WAIT; - pSoldier->usNextActionData = 500; + pSoldier->aiData.bNextAction = AI_ACTION_WAIT; + pSoldier->aiData.usNextActionData = 500; } else if (pSoldier->ubQuoteActionID >= QUOTE_ACTION_ID_TRAVERSE_EAST && pSoldier->ubQuoteActionID <= QUOTE_ACTION_ID_TRAVERSE_NORTH) @@ -591,7 +591,7 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) else { // make sure this guy is handled next frame! - pSoldier->uiStatusFlags |= AI_HANDLE_EVERY_FRAME; + pSoldier->flags.uiStatusFlags |= AI_HANDLE_EVERY_FRAME; } } // for regular guys still have to check for leaving the map @@ -606,19 +606,19 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) DebugMsg( TOPIC_JA2AI, DBG_LEVEL_0, String("OPPONENT %d REACHES DEST - ACTION DONE",pSoldier->ubID ) ); #endif - if ( pSoldier->sGridNo == pSoldier->sFinalDestination ) + if ( pSoldier->sGridNo == pSoldier->pathing.sFinalDestination ) { - if ( pSoldier->bAction == AI_ACTION_MOVE_TO_CLIMB ) + if ( pSoldier->aiData.bAction == AI_ACTION_MOVE_TO_CLIMB ) { // successfully moved to roof! // fake setting action to climb roof and see if we can afford this - pSoldier->bAction = AI_ACTION_CLIMB_ROOF; + pSoldier->aiData.bAction = AI_ACTION_CLIMB_ROOF; if (IsActionAffordable(pSoldier)) { // set action to none and next action to climb roof so we do that next - pSoldier->bAction = AI_ACTION_NONE; - pSoldier->bNextAction = AI_ACTION_CLIMB_ROOF; + pSoldier->aiData.bAction = AI_ACTION_NONE; + pSoldier->aiData.bNextAction = AI_ACTION_CLIMB_ROOF; } } @@ -628,7 +628,7 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) } //*** TRICK- TAKE INTO ACCOUNT PAUSED FOR NO TIME ( FOR NOW ) - if (pSoldier->fNoAPToFinishMove ) + if (pSoldier->flags.fNoAPToFinishMove ) { SoldierTriesToContinueAlongPath(pSoldier); } @@ -637,7 +637,7 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) { // ATE: Put some ( MORE ) refinements on here.... // If we are trying to open door, or jump fence don't continue until done... - if ( !pSoldier->fContinueMoveAfterStanceChange && !pSoldier->bEndDoorOpenCode ) + if ( !pSoldier->flags.fContinueMoveAfterStanceChange && !pSoldier->bEndDoorOpenCode ) { //ATE: just a few more..... // If we have ANY pending aninmation that is movement..... @@ -685,7 +685,7 @@ void EndAIGuysTurn( SOLDIERTYPE *pSoldier ) { if ( OK_INSECTOR_MERC( MercPtrs[ ubID ] ) ) { - if ( MercPtrs[ ubID ]->fCloseCall ) + if ( MercPtrs[ ubID ]->flags.fCloseCall ) { if ( !gTacticalStatus.fSomeoneHit && MercPtrs[ ubID ]->bNumHitsThisTurn == 0 && !(MercPtrs[ ubID ]->usQuoteSaidExtFlags & SOLDIER_QUOTE_SAID_EXT_CLOSE_CALL) && Random( 3 ) == 0 ) { @@ -693,17 +693,17 @@ void EndAIGuysTurn( SOLDIERTYPE *pSoldier ) TacticalCharacterDialogue( MercPtrs[ ubID ], QUOTE_CLOSE_CALL ); MercPtrs[ ubID ]->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_EXT_CLOSE_CALL; } - MercPtrs[ ubID ]->fCloseCall = FALSE; + MercPtrs[ ubID ]->flags.fCloseCall = FALSE; } } } gTacticalStatus.fSomeoneHit = FALSE; // if civ in civ group and hostile, try to change nearby guys to hostile - if ( pSoldier->ubCivilianGroup != NON_CIV_GROUP && !pSoldier->bNeutral ) + if ( pSoldier->ubCivilianGroup != NON_CIV_GROUP && !pSoldier->aiData.bNeutral ) { - if ( !(pSoldier->uiStatusFlags & SOLDIER_BOXER) || !( gTacticalStatus.bBoxingState == PRE_BOXING || gTacticalStatus.bBoxingState == BOXING ) ) + if ( !(pSoldier->flags.uiStatusFlags & SOLDIER_BOXER) || !( gTacticalStatus.bBoxingState == PRE_BOXING || gTacticalStatus.bBoxingState == BOXING ) ) { UINT8 ubFirstProfile; @@ -724,10 +724,10 @@ void EndAIGuysTurn( SOLDIERTYPE *pSoldier ) // End this NPC's control, move to next dude EndRadioLocator( pSoldier->ubID ); - pSoldier->uiStatusFlags &= ( ~SOLDIER_UNDERAICONTROL ); - pSoldier->fTurnInProgress = FALSE; - pSoldier->bMoved = TRUE; - pSoldier->bBypassToGreen = FALSE; + pSoldier->flags.uiStatusFlags &= ( ~SOLDIER_UNDERAICONTROL ); + pSoldier->flags.fTurnInProgress = FALSE; + pSoldier->aiData.bMoved = TRUE; + pSoldier->aiData.bBypassToGreen = FALSE; #ifdef TESTAICONTROL if (!(gTacticalStatus.uiFlags & DEMOMODE)) @@ -738,7 +738,7 @@ void EndAIGuysTurn( SOLDIERTYPE *pSoldier ) ubID = RemoveFirstAIListEntry(); if (ubID != NOBODY) { - StartNPCAI( MercPtrs[ ubID ] ); + StartNPCAI( MercPtrs[ ubID ] ); return; } @@ -761,14 +761,14 @@ void EndAIDeadlock(void) SOLDIERTYPE *pSoldier; INT8 bFound=FALSE; - // ESCAPE ENEMY'S TURN + // ESCAPE ENEMY'S TURN // find enemy with problem and free him up... for (cnt=0,pSoldier=Menptr; cnt < MAXMERCS; cnt++,pSoldier++) { if ( pSoldier->bActive && pSoldier->bInSector ) { - if (pSoldier->uiStatusFlags & SOLDIER_UNDERAICONTROL) + if (pSoldier->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL) { CancelAIAction(pSoldier,FORCE); #ifdef TESTAICONTROL @@ -808,10 +808,10 @@ void StartNPCAI(SOLDIERTYPE *pSoldier) if(!gfAmIHost) return; #endif - //pSoldier->uiStatusFlags |= SOLDIER_UNDERAICONTROL; - SetSoldierAsUnderAiControl( pSoldier ); + //pSoldier->flags.uiStatusFlags |= SOLDIER_UNDERAICONTROL; + pSoldier->SetSoldierAsUnderAiControl( ); - pSoldier->fTurnInProgress = TRUE; + pSoldier->flags.fTurnInProgress = TRUE; pSoldier->sLastTwoLocations[0] = NOWHERE; pSoldier->sLastTwoLocations[1] = NOWHERE; @@ -830,7 +830,7 @@ void StartNPCAI(SOLDIERTYPE *pSoldier) // important: if "fPausedAnimation" is TRUE, then we have to turn it off else // HandleSoldierAI() will not be called! - if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { if ( GetNumberInVehicle( pSoldier->bVehicleID ) == 0 ) { @@ -842,10 +842,10 @@ void StartNPCAI(SOLDIERTYPE *pSoldier) // If we are not in an interrupt situation! if ( (( gTacticalStatus.uiFlags & TURNBASED ) && ( gTacticalStatus.uiFlags & INCOMBAT )) && gubOutOfTurnPersons == 0 ) { - if( ( ( pSoldier->bVisible != -1 && pSoldier->bLife) || ( gTacticalStatus.uiFlags & SHOW_ALL_MERCS ) ) && ( fInValidSoldier == FALSE ) ) + if( ( ( pSoldier->bVisible != -1 && pSoldier->stats.bLife) || ( gTacticalStatus.uiFlags & SHOW_ALL_MERCS ) ) && ( fInValidSoldier == FALSE ) ) { // If we are on a roof, set flag for rendering... - if ( pSoldier->bLevel != 0 && ( gTacticalStatus.uiFlags & INCOMBAT ) ) + if ( pSoldier->pathing.bLevel != 0 && ( gTacticalStatus.uiFlags & INCOMBAT ) ) { gTacticalStatus.uiFlags |= SHOW_ALL_ROOFS; SetRenderFlags( RENDER_FLAG_FULL ); @@ -856,7 +856,7 @@ void StartNPCAI(SOLDIERTYPE *pSoldier) //ATE: Changed to show locator // Skip locator for green friendly militia - if ( !(pSoldier->bTeam == MILITIA_TEAM && pSoldier->bSide == 0 && pSoldier->bAlertStatus == STATUS_GREEN) ) + if ( !(pSoldier->bTeam == MILITIA_TEAM && pSoldier->bSide == 0 && pSoldier->aiData.bAlertStatus == STATUS_GREEN) ) { LocateSoldier( pSoldier->ubID, SETLOCATORFAST ); } @@ -864,7 +864,7 @@ void StartNPCAI(SOLDIERTYPE *pSoldier) // try commenting this out altogether /* // so long as he's not a neutral civ or a militia friendly to the player - if ( !(pSoldier->bNeutral || (pSoldier->bTeam == MILITIA_TEAM && pSoldier->bSide == 0) ) ) + if ( !(pSoldier->aiData.bNeutral || (pSoldier->bTeam == MILITIA_TEAM && pSoldier->bSide == 0) ) ) { PauseAITemporarily(); } @@ -873,7 +873,7 @@ void StartNPCAI(SOLDIERTYPE *pSoldier) UpdateEnemyUIBar( ); - } + } // Remove deadlock message DebugMsg( TOPIC_JA2AI, DBG_LEVEL_3 , "About to remove deadlock message" ); @@ -897,7 +897,7 @@ BOOLEAN DestNotSpokenFor(SOLDIERTYPE *pSoldier, INT16 sGridno) { if ( pOurTeam->bActive ) { - if (pOurTeam->sGridNo == sGridno || pOurTeam->usActionData == sGridno) + if (pOurTeam->sGridNo == sGridno || pOurTeam->aiData.usActionData == sGridno) return(FALSE); } } @@ -918,12 +918,12 @@ INT16 FindAdjacentSpotBeside(SOLDIERTYPE *pSoldier, INT16 sGridno) sTempGridno = sGridno + mods[cnt]; if (!OutOfBounds(sGridno,sTempGridno)) { - if (NewOKDestination(pSoldier,sTempGridno,PEOPLETOO, pSoldier->bLevel ) && DestNotSpokenFor(pSoldier,sTempGridno)) + if (NewOKDestination(pSoldier,sTempGridno,PEOPLETOO, pSoldier->pathing.bLevel ) && DestNotSpokenFor(pSoldier,sTempGridno)) { sMovementCost = PlotPath(pSoldier,sTempGridno,FALSE,FALSE,FALSE,WALKING,FALSE,FALSE,0); if (sMovementCost < sCheapestCost) { - sCheapestCost = sMovementCost; + sCheapestCost = sMovementCost; sCheapestDest = sTempGridno; } @@ -942,7 +942,7 @@ UINT8 GetMostThreateningOpponent( SOLDIERTYPE *pSoldier ) SOLDIERTYPE *pTargetSoldier; UINT8 ubTargetSoldier = NOBODY; - // Loop through all mercs + // Loop through all mercs for (uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++) { @@ -956,20 +956,20 @@ UINT8 GetMostThreateningOpponent( SOLDIERTYPE *pSoldier ) // if this soldier is on same team as me, skip him if (pTargetSoldier->bTeam == pSoldier->bTeam || pTargetSoldier->bSide == pSoldier->bSide) { - continue; + continue; } // if potential opponent is dead, skip him - if (!pTargetSoldier->bLife) + if (!pTargetSoldier->stats.bLife) { continue; } - if (pSoldier->bOppList[pTargetSoldier->ubID] != SEEN_CURRENTLY) + if (pSoldier->aiData.bOppList[pTargetSoldier->ubID] != SEEN_CURRENTLY) continue; // Special stuff for Carmen the bounty hunter - if (pSoldier->bAttitude == ATTACKSLAYONLY && pTargetSoldier->ubProfile != 64) + if (pSoldier->aiData.bAttitude == ATTACKSLAYONLY && pTargetSoldier->ubProfile != 64) { continue; // next opponent } @@ -992,14 +992,14 @@ void FreeUpNPCFromPendingAction( SOLDIERTYPE *pSoldier ) { if ( pSoldier ) { - if ( pSoldier->bAction == AI_ACTION_PENDING_ACTION - || pSoldier->bAction == AI_ACTION_OPEN_OR_CLOSE_DOOR - || pSoldier->bAction == AI_ACTION_CREATURE_CALL - || pSoldier->bAction == AI_ACTION_YELLOW_ALERT - || pSoldier->bAction == AI_ACTION_RED_ALERT - || pSoldier->bAction == AI_ACTION_UNLOCK_DOOR - || pSoldier->bAction == AI_ACTION_PULL_TRIGGER - || pSoldier->bAction == AI_ACTION_LOCK_DOOR ) + if ( pSoldier->aiData.bAction == AI_ACTION_PENDING_ACTION + || pSoldier->aiData.bAction == AI_ACTION_OPEN_OR_CLOSE_DOOR + || pSoldier->aiData.bAction == AI_ACTION_CREATURE_CALL + || pSoldier->aiData.bAction == AI_ACTION_YELLOW_ALERT + || pSoldier->aiData.bAction == AI_ACTION_RED_ALERT + || pSoldier->aiData.bAction == AI_ACTION_UNLOCK_DOOR + || pSoldier->aiData.bAction == AI_ACTION_PULL_TRIGGER + || pSoldier->aiData.bAction == AI_ACTION_LOCK_DOOR ) { if ( pSoldier->ubProfile != NO_PROFILE ) { @@ -1030,15 +1030,15 @@ void FreeUpNPCFromAttacking(UINT8 ubID) pSoldier = MercPtrs[ubID]; ActionDone(pSoldier); - pSoldier->bNeedToLook = TRUE; + pSoldier->pathing.bNeedToLook = TRUE; /* - if (pSoldier->bActionInProgress) - { + if (pSoldier->aiData.bActionInProgress) + { #ifdef TESTAI DebugMsg( TOPIC_JA2AI, DBG_LEVEL_0, String( "FreeUpNPCFromAttacking for %d", pSoldier->ubID ) ); #endif - if (pSoldier->bAction == AI_ACTION_FIRE_GUN) + if (pSoldier->aiData.bAction == AI_ACTION_FIRE_GUN) { if (pSoldier->bDoBurst) { @@ -1047,29 +1047,29 @@ void FreeUpNPCFromAttacking(UINT8 ubID) // now find the target and have them say "close call" quote if // applicable pTarget = SimpleFindSoldier( pSoldier->sTargetGridNo, pSoldier->bTargetLevel ); - if (pTarget && pTarget->bTeam == OUR_TEAM && pTarget->fCloseCall && pTarget->bShock == 0) + if (pTarget && pTarget->bTeam == OUR_TEAM && pTarget->flags.fCloseCall && pTarget->bShock == 0) { // say close call quote! TacticalCharacterDialogue( pTarget, QUOTE_CLOSE_CALL ); - pTarget->fCloseCall = FALSE; + pTarget->flags.fCloseCall = FALSE; } ActionDone(pSoldier); pSoldier->bDoBurst = FALSE; - } + } } else { pTarget = SimpleFindSoldier( pSoldier->sTargetGridNo, pSoldier->bTargetLevel ); - if (pTarget && pTarget->bTeam == OUR_TEAM && pTarget->fCloseCall && pTarget->bShock == 0) + if (pTarget && pTarget->bTeam == OUR_TEAM && pTarget->flags.fCloseCall && pTarget->bShock == 0) { // say close call quote! TacticalCharacterDialogue( pTarget, QUOTE_CLOSE_CALL ); - pTarget->fCloseCall = FALSE; + pTarget->flags.fCloseCall = FALSE; } - ActionDone(pSoldier); + ActionDone(pSoldier); } } - else if ((pSoldier->bAction == AI_ACTION_TOSS_PROJECTILE) || (pSoldier->bAction == AI_ACTION_KNIFE_STAB)) + else if ((pSoldier->aiData.bAction == AI_ACTION_TOSS_PROJECTILE) || (pSoldier->aiData.bAction == AI_ACTION_KNIFE_STAB)) { ActionDone(pSoldier); } @@ -1079,7 +1079,7 @@ void FreeUpNPCFromAttacking(UINT8 ubID) //pSoldier->sTarget = NOWHERE; // make him look in case he turns to face a new direction - pSoldier->bNeedToLook = TRUE; + pSoldier->pathing.bNeedToLook = TRUE; // This is here to speed up resolution of interrupts that have already been // delayed while AttackingPerson was still set (causing ChangeControl to @@ -1091,7 +1091,7 @@ void FreeUpNPCFromAttacking(UINT8 ubID) void FreeUpNPCFromLoweringGun( SOLDIERTYPE *pSoldier ) { - if ( pSoldier && pSoldier->bAction == AI_ACTION_LOWER_GUN ) + if ( pSoldier && pSoldier->aiData.bAction == AI_ACTION_LOWER_GUN ) { ActionDone(pSoldier); } @@ -1101,11 +1101,11 @@ void FreeUpNPCFromTurning(SOLDIERTYPE *pSoldier, INT8 bLook) { // if NPC is in the process of changing facing, mark him as being done! - if ((pSoldier->bAction == AI_ACTION_CHANGE_FACING) && pSoldier->bActionInProgress) + if ((pSoldier->aiData.bAction == AI_ACTION_CHANGE_FACING) && pSoldier->aiData.bActionInProgress) { #ifdef TESTAI - DebugMsg( TOPIC_JA2AI, DBG_LEVEL_3, - String("FREEUPNPCFROMTURNING: our action %d, desdir %d dir %d",pSoldier->bAction,pSoldier->bDesiredDirection,pSoldier->ubDirection) ); + DebugMsg( TOPIC_JA2AI, DBG_LEVEL_3, + String("FREEUPNPCFROMTURNING: our action %d, desdir %d dir %d",pSoldier->aiData.bAction,pSoldier->pathing.bDesiredDirection,pSoldier->ubDirection) ); #endif @@ -1123,13 +1123,13 @@ void FreeUpNPCFromTurning(SOLDIERTYPE *pSoldier, INT8 bLook) void FreeUpNPCFromStanceChange(SOLDIERTYPE *pSoldier ) { // are we/were we doing something? - if (pSoldier->bActionInProgress) + if (pSoldier->aiData.bActionInProgress) { // check and see if we were changing stance - if (pSoldier->bAction == AI_ACTION_CHANGE_STANCE || pSoldier->bAction == AI_ACTION_COWER || pSoldier->bAction == AI_ACTION_STOP_COWERING) + if (pSoldier->aiData.bAction == AI_ACTION_CHANGE_STANCE || pSoldier->aiData.bAction == AI_ACTION_COWER || pSoldier->aiData.bAction == AI_ACTION_STOP_COWERING) { // yes we were - are we finished? - if ( gAnimControl[ pSoldier->usAnimState ].ubHeight == pSoldier->usActionData ) + if ( gAnimControl[ pSoldier->usAnimState ].ubHeight == pSoldier->aiData.usActionData ) { // yes! Free us up to do other fun things ActionDone(pSoldier); @@ -1141,10 +1141,10 @@ void FreeUpNPCFromStanceChange(SOLDIERTYPE *pSoldier ) void FreeUpNPCFromRoofClimb(SOLDIERTYPE *pSoldier ) { // are we/were we doing something? - if (pSoldier->bActionInProgress) + if (pSoldier->aiData.bActionInProgress) { // check and see if we were climbing - if (pSoldier->bAction == AI_ACTION_CLIMB_ROOF) + if (pSoldier->aiData.bAction == AI_ACTION_CLIMB_ROOF) { // yes! Free us up to do other fun things ActionDone(pSoldier); @@ -1158,13 +1158,13 @@ void FreeUpNPCFromRoofClimb(SOLDIERTYPE *pSoldier ) void ActionDone(SOLDIERTYPE *pSoldier) { // if an action is currently selected - if (pSoldier->bAction != AI_ACTION_NONE) + if (pSoldier->aiData.bAction != AI_ACTION_NONE) { - if (pSoldier->uiStatusFlags & SOLDIER_MONSTER) + if (pSoldier->flags.uiStatusFlags & SOLDIER_MONSTER) { #ifdef TESTAI - DebugMsg( TOPIC_JA2AI, DBG_LEVEL_3, - String("Cancelling actiondone: our action %d, desdir %d dir %d",pSoldier->bAction,pSoldier->bDesiredDirection,pSoldier->ubDirection) ); + DebugMsg( TOPIC_JA2AI, DBG_LEVEL_3, + String("Cancelling actiondone: our action %d, desdir %d dir %d",pSoldier->aiData.bAction,pSoldier->pathing.bDesiredDirection,pSoldier->ubDirection) ); #endif } @@ -1177,36 +1177,36 @@ void ActionDone(SOLDIERTYPE *pSoldier) //} // cancel any turning & movement by making current settings desired ones - pSoldier->sFinalDestination = pSoldier->sGridNo; + pSoldier->pathing.sFinalDestination = pSoldier->sGridNo; - if ( !pSoldier->fNoAPToFinishMove ) + if ( !pSoldier->flags.fNoAPToFinishMove ) { - EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection ); - AdjustNoAPToFinishMove( pSoldier, FALSE ); + pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); + pSoldier->AdjustNoAPToFinishMove( FALSE ); } //Lalien: moved later in ExecuteAction() case AI_ACTION_RAISE_GUN: //AXP 23.03.2007: Sniper deadlock fix - //if ( pSoldier->bOrders == SNIPER && pSoldier->bAction == AI_ACTION_RAISE_GUN && pSoldier->bLastAction == AI_ACTION_RAISE_GUN) + //if ( pSoldier->aiData.bOrders == SNIPER && pSoldier->aiData.bAction == AI_ACTION_RAISE_GUN && pSoldier->aiData.bLastAction == AI_ACTION_RAISE_GUN) //{ - // pSoldier->bNextAction = AI_ACTION_END_TURN; + // pSoldier->aiData.bNextAction = AI_ACTION_END_TURN; //} // cancel current action - pSoldier->bLastAction = pSoldier->bAction; - pSoldier->bAction = AI_ACTION_NONE; - pSoldier->usActionData = NOWHERE; - pSoldier->bActionInProgress = FALSE; - pSoldier->fDelayedMovement = FALSE; + pSoldier->aiData.bLastAction = pSoldier->aiData.bAction; + pSoldier->aiData.bAction = AI_ACTION_NONE; + pSoldier->aiData.usActionData = NOWHERE; + pSoldier->aiData.bActionInProgress = FALSE; + pSoldier->flags.fDelayedMovement = FALSE; /* - if ( pSoldier->bLastAction == AI_ACTION_CHANGE_STANCE || pSoldier->bLastAction == AI_ACTION_COWER || pSoldier->bLastAction == AI_ACTION_STOP_COWERING ) + if ( pSoldier->aiData.bLastAction == AI_ACTION_CHANGE_STANCE || pSoldier->aiData.bLastAction == AI_ACTION_COWER || pSoldier->aiData.bLastAction == AI_ACTION_STOP_COWERING ) { - SoldierGotoStationaryStance( pSoldier ); + pSoldier->SoldierGotoStationaryStance( ); } */ - if ( pSoldier->bLastAction == AI_ACTION_RAISE_GUN ) + if ( pSoldier->aiData.bLastAction == AI_ACTION_RAISE_GUN ) { HandleSight( pSoldier, SIGHT_LOOK ); } @@ -1215,10 +1215,10 @@ void ActionDone(SOLDIERTYPE *pSoldier) // This is possible if we decide on an action that we have no points for // (but which set pathStored). The action is retained until next turn, // although NewDest isn't called. A newSit. could cancel it before then! - pSoldier->bPathStored = FALSE; + pSoldier->pathing.bPathStored = FALSE; } - if (pSoldier->uiStatusFlags & SOLDIER_DEAD) + if (pSoldier->flags.uiStatusFlags & SOLDIER_DEAD) { // The last action killed the soldier (stepped on a mine, detonated a LAW too close, etc) EndAIGuysTurn( pSoldier); @@ -1266,7 +1266,7 @@ void NPCDoesAct(SOLDIERTYPE *pSoldier) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"NPCDoesAct"); // if the action is visible and we're in a hidden turnbased mode, go to turnbased - if (gTacticalStatus.uiFlags & TURNBASED && !(gTacticalStatus.uiFlags & INCOMBAT) && (pSoldier->bAction == AI_ACTION_FIRE_GUN || pSoldier->bAction == AI_ACTION_TOSS_PROJECTILE || pSoldier->bAction == AI_ACTION_KNIFE_MOVE || pSoldier->bAction == AI_ACTION_KNIFE_STAB || pSoldier->bAction == AI_ACTION_THROW_KNIFE) ) + if (gTacticalStatus.uiFlags & TURNBASED && !(gTacticalStatus.uiFlags & INCOMBAT) && (pSoldier->aiData.bAction == AI_ACTION_FIRE_GUN || pSoldier->aiData.bAction == AI_ACTION_TOSS_PROJECTILE || pSoldier->aiData.bAction == AI_ACTION_KNIFE_MOVE || pSoldier->aiData.bAction == AI_ACTION_KNIFE_STAB || pSoldier->aiData.bAction == AI_ACTION_THROW_KNIFE) ) { DisplayHiddenTurnbased( pSoldier ); } @@ -1280,9 +1280,9 @@ void NPCDoesAct(SOLDIERTYPE *pSoldier) // CJC Feb 18 99: make sure that soldier is not in the middle of a turn due to visual crap to make enemies // face and point their guns at us - if ( pSoldier->bDesiredDirection != pSoldier->ubDirection ) + if ( pSoldier->pathing.bDesiredDirection != pSoldier->ubDirection ) { - pSoldier->bDesiredDirection = pSoldier->ubDirection; + pSoldier->pathing.bDesiredDirection = pSoldier->ubDirection; } DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"NPCDoesAct done"); @@ -1325,17 +1325,17 @@ void CancelAIAction(SOLDIERTYPE *pSoldier, UINT8 ubForce) SkipCoverCheck = FALSE; // turn off new situation flag to stop this from repeating all the time! - if ( pSoldier->bNewSituation == IS_NEW_SITUATION ) + if ( pSoldier->aiData.bNewSituation == IS_NEW_SITUATION ) { - pSoldier->bNewSituation = WAS_NEW_SITUATION; + pSoldier->aiData.bNewSituation = WAS_NEW_SITUATION; } // NPCs getting escorted do NOT react to new situations, unless forced! - if (pSoldier->bUnderEscort && !ubForce) + if (pSoldier->aiData.bUnderEscort && !ubForce) return; // turn off RED/YELLOW status "bypass to Green", to re-check all actions - pSoldier->bBypassToGreen = FALSE; + pSoldier->aiData.bBypassToGreen = FALSE; ActionDone(pSoldier); } @@ -1362,9 +1362,9 @@ return; // check if it's a problem with a offensive combat action -if ((pSoldier->bAction == AI_ACTION_FIRE_GUN) || -(pSoldier->bAction == AI_ACTION_TOSS_PROJECTILE) || -(pSoldier->bAction == AI_ACTION_KNIFE_STAB)) +if ((pSoldier->aiData.bAction == AI_ACTION_FIRE_GUN) || +(pSoldier->aiData.bAction == AI_ACTION_TOSS_PROJECTILE) || +(pSoldier->aiData.bAction == AI_ACTION_KNIFE_STAB)) { // THESE ARE LESS SERIOUS, SINCE THEY LIKELY WON'T REPEAT THEMSELVES attackAction = TRUE; @@ -1374,7 +1374,7 @@ attackAction = TRUE; #ifdef BETAVERSION sprintf(tempstr,"ActionInProgress - ERROR: %s's timeout limit exceeded. Action #%d (%d)", -pSoldier->name,pSoldier->bAction,pSoldier->usActionData); +pSoldier->name,pSoldier->aiData.bAction,pSoldier->aiData.usActionData); #ifdef RECORDNET fprintf(NetDebugFile,"\n%s\n\n",tempstr); @@ -1417,17 +1417,17 @@ SendNetData(cnt); if (!alreadyFreedUp) FreeUpManFromAttacking(pSoldier->ubID,COMMUNICATE); } -else if (pSoldier->bAction == AI_ACTION_CHANGE_FACING) +else if (pSoldier->aiData.bAction == AI_ACTION_CHANGE_FACING) { #ifdef BETAVERSION NameMessage(pSoldier,"will now be freed up from turning...",2000); #endif // force him to face in the right direction (as long as it's legal) -if ((pSoldier->bDesiredDirection >= 1) && (pSoldier->bDesiredDirection <= 8)) -pSoldier->ubDirection = pSoldier->bDesiredDirection; +if ((pSoldier->pathing.bDesiredDirection >= 1) && (pSoldier->pathing.bDesiredDirection <= 8)) +pSoldier->ubDirection = pSoldier->pathing.bDesiredDirection; else -pSoldier->bDesiredDirection = pSoldier->ubDirection; +pSoldier->pathing.bDesiredDirection = pSoldier->ubDirection; // free up ONLY players from whom we haven't received an AI_ACTION_DONE yet // we can all agree the action is DONE and we can continue... @@ -1435,7 +1435,7 @@ pSoldier->bDesiredDirection = pSoldier->ubDirection; NetSend.msgType = NET_FREE_UP_TURN; NetSend.ubID = pSoldier->ubID; NetSend.misc_UCHAR = pSoldier->ubDirection; -NetSend.answer = pSoldier->bDesiredDirection; +NetSend.answer = pSoldier->pathing.bDesiredDirection; for (cnt = 0; cnt < MAXPLAYERS; cnt++) { @@ -1465,7 +1465,7 @@ CancelAIAction(pSoldier,FORCE); // reset the timeout counter for next time -pSoldier->bActionTimeout = 0; +pSoldier->aiData.bActionTimeout = 0; } */ @@ -1475,22 +1475,22 @@ pSoldier->bActionTimeout = 0; INT16 ActionInProgress(SOLDIERTYPE *pSoldier) { // if NPC has a desired destination, but isn't currently going there - if ((pSoldier->sFinalDestination != NOWHERE) && (pSoldier->sDestination != pSoldier->sFinalDestination)) + if ((pSoldier->pathing.sFinalDestination != NOWHERE) && (pSoldier->pathing.sDestination != pSoldier->pathing.sFinalDestination)) { // return success (TRUE) if we successfully resume the movement - return(TryToResumeMovement(pSoldier,pSoldier->sFinalDestination)); + return(TryToResumeMovement(pSoldier,pSoldier->pathing.sFinalDestination)); } // this here should never happen, but it seems to (turns sometimes hang!) - if ((pSoldier->bAction == AI_ACTION_CHANGE_FACING) && (pSoldier->bDesiredDirection != pSoldier->usActionData)) + if ((pSoldier->aiData.bAction == AI_ACTION_CHANGE_FACING) && (pSoldier->pathing.bDesiredDirection != pSoldier->aiData.usActionData)) { #ifdef TESTVERSION PopMessage("ActionInProgress: WARNING - CONTINUING FACING CHANGE..."); #endif // don't try to pay any more APs for this, it was paid for once already! - pSoldier->bDesiredDirection = (INT8) pSoldier->usActionData; // turn to face direction in actionData + pSoldier->pathing.bDesiredDirection = (INT8) pSoldier->aiData.usActionData; // turn to face direction in actionData return(TRUE); } @@ -1600,7 +1600,7 @@ void TurnBasedHandleNPCAI(SOLDIERTYPE *pSoldier) // // If man is inactive/at base/dead/unconscious - if (!pSoldier->bActive || !pSoldier->bInSector || (pSoldier->bLife < OKLIFE)) + if (!pSoldier->bActive || !pSoldier->bInSector || (pSoldier->stats.bLife < OKLIFE)) { #ifdef DEBUGDECISIONS AINumMessage("HandleManAI - Unavailable man, skipping guy#",pSoldier->ubID); @@ -1611,7 +1611,7 @@ void TurnBasedHandleNPCAI(SOLDIERTYPE *pSoldier) } if (PTR_CIVILIAN && pSoldier->service && - (pSoldier->bNeutral || MedicsMissionIsEscort(pSoldier))) + (pSoldier->aiData.bNeutral || MedicsMissionIsEscort(pSoldier))) { #ifdef DEBUGDECISIONS AINumMessage("HandleManAI - Civilian is being serviced, skipping guy#",pSoldier->ubID); @@ -1665,7 +1665,7 @@ void TurnBasedHandleNPCAI(SOLDIERTYPE *pSoldier) // if NPC's has been forced to stop by an opponent's interrupt or similar - if (pSoldier->forcedToStop) + if (pSoldier->flags.forcedToStop) { #ifdef DEBUGBUSY AINumMessage("HandleManAI - Forced to stop, skipping guy #",pSoldier->ubID); @@ -1687,14 +1687,14 @@ void TurnBasedHandleNPCAI(SOLDIERTYPE *pSoldier) */ // yikes, this shouldn't occur! we should be trying to finish our move! - // pSoldier->fNoAPToFinishMove = FALSE; + // pSoldier->flags.fNoAPToFinishMove = FALSE; // unless in mid-move, get an up-to-date alert status for this guy - if (pSoldier->bStopped) + if (pSoldier->pathing.bStopped) { // if active team is waiting for oppChanceToDecide, that means we have NOT // had a chance to go through NewSelectedNPC(), so do the refresh here - /* + /* ??? if (gTacticalStatus.team[Net.turnActive].allowOppChanceToDecide) { @@ -1713,7 +1713,7 @@ void TurnBasedHandleNPCAI(SOLDIERTYPE *pSoldier) /* // move this clause outside of the function... - if (pSoldier->bNewSituation) + if (pSoldier->aiData.bNewSituation) // don't force, don't want escorted mercs reacting to new opponents, etc. CancelAIAction(pSoldier,DONTFORCE); @@ -1733,15 +1733,15 @@ void TurnBasedHandleNPCAI(SOLDIERTYPE *pSoldier) - if ((pSoldier->bAction != AI_ACTION_NONE) && pSoldier->bActionInProgress) + if ((pSoldier->aiData.bAction != AI_ACTION_NONE) && pSoldier->aiData.bActionInProgress) { /* - if (pSoldier->bAction == AI_ACTION_RANDOM_PATROL) + if (pSoldier->aiData.bAction == AI_ACTION_RANDOM_PATROL) { - if (pSoldier->usPathIndex == pSoldier->usPathDataSize) - //if (pSoldier->usActionData == pSoldier->sGridNo ) - //(IC?) if (pSoldier->bAction == AI_ACTION_RANDOM_PATROL && ( pSoldier->usPathIndex == pSoldier->usPathDataSize ) ) - //(old?) if (pSoldier->bAction == AI_ACTION_RANDOM_PATROL && ( pSoldier->usActionData == pSoldier->sGridNo ) ) + if (pSoldier->pathing.usPathIndex == pSoldier->pathing.usPathDataSize) + //if (pSoldier->aiData.usActionData == pSoldier->sGridNo ) + //(IC?) if (pSoldier->aiData.bAction == AI_ACTION_RANDOM_PATROL && ( pSoldier->pathing.usPathIndex == pSoldier->pathing.usPathDataSize ) ) + //(old?) if (pSoldier->aiData.bAction == AI_ACTION_RANDOM_PATROL && ( pSoldier->aiData.usActionData == pSoldier->sGridNo ) ) { #ifdef TESTAI DebugMsg( TOPIC_JA2AI, DBG_LEVEL_0, String("OPPONENT %d REACHES DEST - ACTION DONE",pSoldier->ubID ) ); @@ -1750,8 +1750,8 @@ void TurnBasedHandleNPCAI(SOLDIERTYPE *pSoldier) } //*** TRICK- TAKE INTO ACCOUNT PAUSED FOR NO TIME ( FOR NOW ) - if (pSoldier->fNoAPToFinishMove) - //if (pSoldier->bAction == AI_ACTION_RANDOM_PATROL && pSoldier->fNoAPToFinishMove) + if (pSoldier->flags.fNoAPToFinishMove) + //if (pSoldier->aiData.bAction == AI_ACTION_RANDOM_PATROL && pSoldier->flags.fNoAPToFinishMove) { // OK, we have a move to finish... @@ -1789,10 +1789,10 @@ void TurnBasedHandleNPCAI(SOLDIERTYPE *pSoldier) // if man has nothing to do - if (pSoldier->bAction == AI_ACTION_NONE) + if (pSoldier->aiData.bAction == AI_ACTION_NONE) { // make sure this flag is turned off (it already should be!) - pSoldier->bActionInProgress = FALSE; + pSoldier->aiData.bActionInProgress = FALSE; // Since we're NEVER going to "continue" along an old path at this point, // then it would be nice place to reinitialize "pathStored" flag for @@ -1809,67 +1809,67 @@ void TurnBasedHandleNPCAI(SOLDIERTYPE *pSoldier) // The only reason we would NEED to reinitialize it here is if I've // incorrectly set pathStored to TRUE in a process that doesn't end up // calling NewDest() - pSoldier->bPathStored = FALSE; + pSoldier->pathing.bPathStored = FALSE; // decide on the next action - if (pSoldier->bNextAction != AI_ACTION_NONE) + if (pSoldier->aiData.bNextAction != AI_ACTION_NONE) { // do the next thing we have to do... - if ( pSoldier->bNextAction == AI_ACTION_END_COWER_AND_MOVE ) + if ( pSoldier->aiData.bNextAction == AI_ACTION_END_COWER_AND_MOVE ) { - if ( pSoldier->uiStatusFlags & SOLDIER_COWERING ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_COWERING ) { - pSoldier->bAction = AI_ACTION_STOP_COWERING; - pSoldier->usActionData = ANIM_STAND; + pSoldier->aiData.bAction = AI_ACTION_STOP_COWERING; + pSoldier->aiData.usActionData = ANIM_STAND; } else if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight < ANIM_STAND ) { // stand up! - pSoldier->bAction = AI_ACTION_CHANGE_STANCE; - pSoldier->usActionData = ANIM_STAND; + pSoldier->aiData.bAction = AI_ACTION_CHANGE_STANCE; + pSoldier->aiData.usActionData = ANIM_STAND; } else { - pSoldier->bAction = AI_ACTION_NONE; + pSoldier->aiData.bAction = AI_ACTION_NONE; } - if ( pSoldier->sGridNo == pSoldier->usNextActionData ) + if ( pSoldier->sGridNo == pSoldier->aiData.usNextActionData ) { // no need to walk after this - pSoldier->bNextAction = AI_ACTION_NONE; - pSoldier->usNextActionData = NOWHERE; + pSoldier->aiData.bNextAction = AI_ACTION_NONE; + pSoldier->aiData.usNextActionData = NOWHERE; } else { - pSoldier->bNextAction = AI_ACTION_WALK; + pSoldier->aiData.bNextAction = AI_ACTION_WALK; // leave next-action-data as is since that's where we want to go } } else { - pSoldier->bAction = pSoldier->bNextAction; - pSoldier->usActionData = pSoldier->usNextActionData; - pSoldier->bTargetLevel = pSoldier->bNextTargetLevel; - pSoldier->bNextAction = AI_ACTION_NONE; - pSoldier->usNextActionData = 0; - pSoldier->bNextTargetLevel = 0; + pSoldier->aiData.bAction = pSoldier->aiData.bNextAction; + pSoldier->aiData.usActionData = pSoldier->aiData.usNextActionData; + pSoldier->bTargetLevel = pSoldier->aiData.bNextTargetLevel; + pSoldier->aiData.bNextAction = AI_ACTION_NONE; + pSoldier->aiData.usNextActionData = 0; + pSoldier->aiData.bNextTargetLevel = 0; } - if (pSoldier->bAction == AI_ACTION_PICKUP_ITEM) + if (pSoldier->aiData.bAction == AI_ACTION_PICKUP_ITEM) { // the item pool index was stored in the special data field - pSoldier->uiPendingActionData1 = pSoldier->iNextActionSpecialData; + pSoldier->aiData.uiPendingActionData1 = pSoldier->iNextActionSpecialData; } } else if ( pSoldier->sAbsoluteFinalDestination != NOWHERE ) { if ( ACTING_ON_SCHEDULE( pSoldier ) ) { - pSoldier->bAction = AI_ACTION_SCHEDULE_MOVE; + pSoldier->aiData.bAction = AI_ACTION_SCHEDULE_MOVE; } else { - pSoldier->bAction = AI_ACTION_WALK; + pSoldier->aiData.bAction = AI_ACTION_WALK; } - pSoldier->usActionData = pSoldier->sAbsoluteFinalDestination; + pSoldier->aiData.usActionData = pSoldier->sAbsoluteFinalDestination; } else { @@ -1877,26 +1877,26 @@ void TurnBasedHandleNPCAI(SOLDIERTYPE *pSoldier) { if (CREATURE_OR_BLOODCAT( pSoldier )) { - pSoldier->bAction = CreatureDecideAction( pSoldier ); + pSoldier->aiData.bAction = CreatureDecideAction( pSoldier ); } else if (pSoldier->ubBodyType == CROW) { - pSoldier->bAction = CrowDecideAction( pSoldier ); + pSoldier->aiData.bAction = CrowDecideAction( pSoldier ); } else { - pSoldier->bAction = DecideAction(pSoldier); + pSoldier->aiData.bAction = DecideAction(pSoldier); } } } - if (pSoldier->bAction == AI_ACTION_ABSOLUTELY_NONE) + if (pSoldier->aiData.bAction == AI_ACTION_ABSOLUTELY_NONE) { - pSoldier->bAction = AI_ACTION_NONE; + pSoldier->aiData.bAction = AI_ACTION_NONE; } // if he chose to continue doing nothing - if (pSoldier->bAction == AI_ACTION_NONE) + if (pSoldier->aiData.bAction == AI_ACTION_NONE) { #ifdef RECORDNET fprintf(NetDebugFile,"\tMOVED BECOMING TRUE: Chose to do nothing, guynum %d\n",pSoldier->ubID); @@ -1926,7 +1926,7 @@ void TurnBasedHandleNPCAI(SOLDIERTYPE *pSoldier) if ( CHEATER_CHEAT_LEVEL( ) ) { - //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Soldier %d decides action %d with data %d", pSoldier->ubID, pSoldier->bAction, pSoldier->usActionData ); + //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Soldier %d decides action %d with data %d", pSoldier->ubID, pSoldier->aiData.bAction, pSoldier->aiData.usActionData ); } // see if we can afford to do this action @@ -1935,9 +1935,9 @@ void TurnBasedHandleNPCAI(SOLDIERTYPE *pSoldier) NPCDoesAct(pSoldier); // perform the chosen action - pSoldier->bActionInProgress = ExecuteAction(pSoldier); // if started, mark us as busy + pSoldier->aiData.bActionInProgress = ExecuteAction(pSoldier); // if started, mark us as busy - if ( !pSoldier->bActionInProgress && pSoldier->sAbsoluteFinalDestination != NOWHERE ) + if ( !pSoldier->aiData.bActionInProgress && pSoldier->sAbsoluteFinalDestination != NOWHERE ) { // turn based... abort this guy's turn EndAIGuysTurn( pSoldier ); @@ -1961,28 +1961,28 @@ void RefreshAI(SOLDIERTYPE *pSoldier) // MarkDetectableMines(pSoldier); // whether last attack hit or not doesn't matter once control has been lost - pSoldier->bLastAttackHit = FALSE; + pSoldier->aiData.bLastAttackHit = FALSE; // get an up-to-date alert status for this guy DecideAlertStatus(pSoldier); - if (pSoldier->bAlertStatus == STATUS_YELLOW) + if (pSoldier->aiData.bAlertStatus == STATUS_YELLOW) SkipCoverCheck = FALSE; // if he's in battle or knows opponents are here if (gfTurnBasedAI) { - if ((pSoldier->bAlertStatus == STATUS_BLACK) || (pSoldier->bAlertStatus == STATUS_RED)) + if ((pSoldier->aiData.bAlertStatus == STATUS_BLACK) || (pSoldier->aiData.bAlertStatus == STATUS_RED)) { // always freshly rethink things at start of his turn - pSoldier->bNewSituation = IS_NEW_SITUATION; + pSoldier->aiData.bNewSituation = IS_NEW_SITUATION; } else { // make sure any paths stored during out last AI decision but not reacted // to (probably due to lack of APs) get re-tested by the ExecuteAction() - // function in AI, since the ->sDestination may no longer be legal now! - pSoldier->bPathStored = FALSE; + // function in AI, since the->pathing.sDestination may no longer be legal now! + pSoldier->pathing.bPathStored = FALSE; // if not currently engaged, or even alerted // take a quick look around to see if any friends seem to be in trouble @@ -1990,7 +1990,7 @@ void RefreshAI(SOLDIERTYPE *pSoldier) // allow stationary GREEN Civilians to turn again at least 1/turn! } - pSoldier->bLastAction = AI_ACTION_NONE; + pSoldier->aiData.bLastAction = AI_ACTION_NONE; } } @@ -2016,12 +2016,12 @@ void AIDecideRadioAnimation( SOLDIERTYPE *pSoldier ) { case ANIM_STAND: - EVENT_InitNewSoldierAnim( pSoldier, AI_RADIO, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( AI_RADIO, 0 , FALSE ); break; case ANIM_CROUCH: - EVENT_InitNewSoldierAnim( pSoldier, AI_CR_RADIO, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( AI_CR_RADIO, 0 , FALSE ); break; case ANIM_PRONE: @@ -2042,24 +2042,24 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) SkipCoverCheck = FALSE; // reset this field, too - pSoldier->bLastAttackHit = FALSE; + pSoldier->aiData.bLastAttackHit = FALSE; UINT16 usHandItem = pSoldier->inv[HANDPOS].usItem; #ifdef TESTAICONTROL if (gfTurnBasedAI || gTacticalStatus.fAutoBandageMode) { - DebugAI( String( "%d does %s (a.d. %d) in %d with %d APs left", pSoldier->ubID, gzActionStr[pSoldier->bAction], pSoldier->usActionData, pSoldier->sGridNo, pSoldier->bActionPoints ) ); + DebugAI( String( "%d does %s (a.d. %d) in %d with %d APs left", pSoldier->ubID, gzActionStr[pSoldier->aiData.bAction], pSoldier->aiData.usActionData, pSoldier->sGridNo, pSoldier->bActionPoints ) ); } #endif - DebugAI( String( "%d does %s (a.d. %d) at time %ld", pSoldier->ubID, gzActionStr[pSoldier->bAction], pSoldier->usActionData, GetJA2Clock() ) ); + DebugAI( String( "%d does %s (a.d. %d) at time %ld", pSoldier->ubID, gzActionStr[pSoldier->aiData.bAction], pSoldier->aiData.usActionData, GetJA2Clock() ) ); - // 0verhaul: The decideaction stage does so many path plots and overrides that + // 0verhaul: The decideaction stage does so many path plots and overrides that // relying on a stored path from there is a bad idea. - pSoldier->usPathDataSize = pSoldier->usPathIndex = pSoldier->bPathStored = 0; + pSoldier->pathing.usPathDataSize = pSoldier->pathing.usPathIndex = pSoldier->pathing.bPathStored = 0; - switch (pSoldier->bAction) + switch (pSoldier->aiData.bAction) { case AI_ACTION_NONE: // maintain current position & facing // do nothing @@ -2073,10 +2073,10 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) } else { - RESETTIMECOUNTER( pSoldier->AICounter, pSoldier->usActionData ); + RESETTIMECOUNTER( pSoldier->timeCounters.AICounter, pSoldier->aiData.usActionData ); if (pSoldier->ubProfile != NO_PROFILE) { - //DebugMsg( TOPIC_JA2, DBG_LEVEL_0, String( "%s waiting %d from %d", pSoldier->name, pSoldier->AICounter, GetJA2Clock() ) ); + //DebugMsg( TOPIC_JA2, DBG_LEVEL_0, String( "%s waiting %d from %d", pSoldier->name, pSoldier->timeCounters.AICounter, GetJA2Clock() ) ); } } ActionDone( pSoldier ); @@ -2086,7 +2086,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) // as long as we don't see anyone new, cover won't have changed // if we see someone new, it will cause a new situation & remove this // 0verhaul: If turning and not moving, set the final destination to the current position - pSoldier->sFinalDestination = pSoldier->sGridNo; + pSoldier->pathing.sFinalDestination = pSoldier->sGridNo; SkipCoverCheck = TRUE; #ifdef DEBUGDECISIONS @@ -2095,16 +2095,16 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) DebugAI (tempstr); #endif - // pSoldier->bDesiredDirection = (UINT8) ; // turn to face direction in actionData - SendSoldierSetDesiredDirectionEvent( pSoldier, pSoldier->usActionData ); + // pSoldier->pathing.bDesiredDirection = (UINT8) ; // turn to face direction in actionData + SendSoldierSetDesiredDirectionEvent( pSoldier, pSoldier->aiData.usActionData ); // now we'll have to wait for the turning to finish; no need to call TurnSoldier here - //TurnSoldier( pSoldier ); + //pSoldier->TurnSoldier( ); /* - if (!StartTurn(pSoldier,pSoldier->usActionData,FASTTURN)) + if (!StartTurn(pSoldier,pSoldier->aiData.usActionData,FASTTURN)) { #ifdef BETAVERSION sprintf(tempstr,"ERROR: %s tried TURN to direction %d, StartTurn failed, action %d CANCELED", - pSoldier->name,pSoldier->usActionData,pSoldier->bAction); + pSoldier->name,pSoldier->aiData.usActionData,pSoldier->aiData.bAction); PopMessage(tempstr); #endif @@ -2117,41 +2117,50 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) else { #ifdef RECORDNET - fprintf(NetDebugFile,"\tAI decides to turn guynum %d to dir %d\n",pSoldier->ubID,pSoldier->usActionData); + fprintf(NetDebugFile,"\tAI decides to turn guynum %d to dir %d\n",pSoldier->ubID,pSoldier->aiData.usActionData); #endif - NetLookTowardsDir(pSoldier,pSoldier->usActionData); + NetLookTowardsDir(pSoldier,pSoldier->aiData.usActionData); } */ break; case AI_ACTION_PICKUP_ITEM: // grab something! - SoldierPickupItem( pSoldier, pSoldier->uiPendingActionData1, pSoldier->usActionData, 0 ); + SoldierPickupItem( pSoldier, pSoldier->aiData.uiPendingActionData1, pSoldier->aiData.usActionData, 0 ); break; case AI_ACTION_DROP_ITEM: // drop item in hand - SoldierDropItem( pSoldier, &(pSoldier->inv[HANDPOS]) ); - DeleteObj( &(pSoldier->inv[HANDPOS]) ); + //CHRISL: If we have a weapon in both hands, we need to drop the weapon that isn't usable + if(pSoldier->inv[HANDPOS].fFlags & OBJECT_AI_UNUSABLE) + { + SoldierDropItem( pSoldier, &(pSoldier->inv[HANDPOS]) ); + DeleteObj( &(pSoldier->inv[HANDPOS]) ); + } + if(pSoldier->inv[SECONDHANDPOS].exists() == true && Item[pSoldier->inv[SECONDHANDPOS].usItem].usItemClass == IC_GUN && pSoldier->inv[SECONDHANDPOS].fFlags & OBJECT_AI_UNUSABLE) + { + SoldierDropItem( pSoldier, &(pSoldier->inv[SECONDHANDPOS]) ); + DeleteObj( &(pSoldier->inv[SECONDHANDPOS]) ); + } // 0verhaul: Moved into PickDropAnimation because when something is dropped while crouched there's nothing to wait for - // pSoldier->bAction = AI_ACTION_PENDING_ACTION; + // pSoldier->aiData.bAction = AI_ACTION_PENDING_ACTION; break; //case AI_ACTION_MOVE_TO_CLIMB: - // if ( pSoldier->usActionData == pSoldier->sGridNo ) + // if ( pSoldier->aiData.usActionData == pSoldier->sGridNo ) // { // // change action to climb now and try that. - // pSoldier->bAction = AI_ACTION_CLIMB_ROOF; + // pSoldier->aiData.bAction = AI_ACTION_CLIMB_ROOF; // if (IsActionAffordable(pSoldier)) // { // return( ExecuteAction( pSoldier ) ); // } // else - // { + // { // // no action started // return( FALSE ); // } // } - // fall through + // fall through case AI_ACTION_RANDOM_PATROL: // move towards a particular location case AI_ACTION_SEEK_FRIEND: // move towards friend in trouble case AI_ACTION_SEEK_OPPONENT: // move towards a reported opponent @@ -2173,13 +2182,13 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) case AI_ACTION_FLANK_RIGHT: case AI_ACTION_RUN: case AI_ACTION_MOVE_TO_CLIMB: - if ( pSoldier->bAction == AI_ACTION_MOVE_TO_CLIMB ) + if ( pSoldier->aiData.bAction == AI_ACTION_MOVE_TO_CLIMB ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Executing: AI_ACTION_MOVE_TO_CLIMB"); - DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("Soldier GridNo = %d, action data = %d ", pSoldier->sGridNo , pSoldier->usActionData)); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("Soldier GridNo = %d, action data = %d ", pSoldier->sGridNo , pSoldier->aiData.usActionData)); } - if ( gfTurnBasedAI && pSoldier->bAlertStatus < STATUS_BLACK ) + if ( gfTurnBasedAI && pSoldier->aiData.bAlertStatus < STATUS_BLACK ) { if ( pSoldier->sLastTwoLocations[0] == NOWHERE ) { @@ -2190,7 +2199,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) pSoldier->sLastTwoLocations[1] = pSoldier->sGridNo; } // check for loop - else if ( pSoldier->usActionData == pSoldier->sLastTwoLocations[1] && pSoldier->sGridNo == pSoldier->sLastTwoLocations[0] ) + else if ( pSoldier->aiData.usActionData == pSoldier->sLastTwoLocations[1] && pSoldier->sGridNo == pSoldier->sLastTwoLocations[0] ) { DebugAI( String( "%d in movement loop, aborting turn", pSoldier->ubID ) ); @@ -2212,7 +2221,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) { if ( Random( 2 ) == 0 ) { - PlaySoldierJA2Sample( pSoldier->ubID, ( BLOODCAT_GROWL_1 + Random( 4 ) ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); + PlaySoldierJA2Sample( pSoldier->ubID, ( BLOODCAT_GROWL_1 + Random( 4 ) ), RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE ); } } } @@ -2220,32 +2229,32 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) // on YELLOW/GREEN status, NPCs keep the actions from turn to turn // (newSituation is intentionally NOT set in NewSelectedNPC()), so the // possibility exists that NOW the actionData is no longer a valid - // NPC ->sDestination (path got blocked, someone is now standing at that - // gridno, etc.) So we gotta check again that the ->sDestination's legal! + // NPC->pathing.sDestination (path got blocked, someone is now standing at that + // gridno, etc.) So we gotta check again that the->pathing.sDestination's legal! // optimization - Ian (if up-to-date path is known, do not check again) - if (!pSoldier->bPathStored) + if (!pSoldier->pathing.bPathStored) { if ( (pSoldier->sAbsoluteFinalDestination != NOWHERE || gTacticalStatus.fAutoBandageMode) && !(gTacticalStatus.uiFlags & INCOMBAT) ) { // NPC system move, allow path through - if (LegalNPCDestination(pSoldier,pSoldier->usActionData,ENSURE_PATH,WATEROK, PATH_THROUGH_PEOPLE )) + if (LegalNPCDestination(pSoldier,pSoldier->aiData.usActionData,ENSURE_PATH,WATEROK, PATH_THROUGH_PEOPLE )) { // optimization - Ian: prevent another path call in SetNewCourse() - pSoldier->bPathStored = TRUE; + pSoldier->pathing.bPathStored = TRUE; } } else { - if (LegalNPCDestination(pSoldier,pSoldier->usActionData,ENSURE_PATH,WATEROK, 0)) + if (LegalNPCDestination(pSoldier,pSoldier->aiData.usActionData,ENSURE_PATH,WATEROK, 0)) { // optimization - Ian: prevent another path call in SetNewCourse() - pSoldier->bPathStored = TRUE; + pSoldier->pathing.bPathStored = TRUE; } } // if we STILL don't have a path - if ( !pSoldier->bPathStored ) + if ( !pSoldier->pathing.bPathStored ) { // Check if we were told to move by NPC stuff if ( pSoldier->sAbsoluteFinalDestination != NOWHERE && !(gTacticalStatus.uiFlags & INCOMBAT) ) @@ -2262,20 +2271,20 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) else { // This is important, so try taking a path through people (and bumping them aside) - if (LegalNPCDestination(pSoldier,pSoldier->usActionData,ENSURE_PATH,WATEROK, PATH_THROUGH_PEOPLE)) + if (LegalNPCDestination(pSoldier,pSoldier->aiData.usActionData,ENSURE_PATH,WATEROK, PATH_THROUGH_PEOPLE)) { // optimization - Ian: prevent another path call in SetNewCourse() - pSoldier->bPathStored = TRUE; - } + pSoldier->pathing.bPathStored = TRUE; + } else { // Have buddy wait a while... - pSoldier->bNextAction = AI_ACTION_WAIT; - pSoldier->usNextActionData = (UINT16)REALTIME_AI_DELAY; + pSoldier->aiData.bNextAction = AI_ACTION_WAIT; + pSoldier->aiData.usNextActionData = (UINT16)REALTIME_AI_DELAY; } } - if (!pSoldier->bPathStored) + if (!pSoldier->pathing.bPathStored) { CancelAIAction(pSoldier,FORCE); return(FALSE); // nothing is in progress @@ -2293,34 +2302,34 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) switch( pSoldier->ubQuoteActionID ) { case QUOTE_ACTION_ID_TRAVERSE_EAST: - pSoldier->sOffWorldGridNo = pSoldier->usActionData; - AdjustSoldierPathToGoOffEdge( pSoldier, pSoldier->usActionData, EAST ); + pSoldier->sOffWorldGridNo = pSoldier->aiData.usActionData; + AdjustSoldierPathToGoOffEdge( pSoldier, pSoldier->aiData.usActionData, EAST ); break; case QUOTE_ACTION_ID_TRAVERSE_SOUTH: - pSoldier->sOffWorldGridNo = pSoldier->usActionData; - AdjustSoldierPathToGoOffEdge( pSoldier, pSoldier->usActionData, SOUTH ); + pSoldier->sOffWorldGridNo = pSoldier->aiData.usActionData; + AdjustSoldierPathToGoOffEdge( pSoldier, pSoldier->aiData.usActionData, SOUTH ); break; case QUOTE_ACTION_ID_TRAVERSE_WEST: - pSoldier->sOffWorldGridNo = pSoldier->usActionData; - AdjustSoldierPathToGoOffEdge( pSoldier, pSoldier->usActionData, WEST ); + pSoldier->sOffWorldGridNo = pSoldier->aiData.usActionData; + AdjustSoldierPathToGoOffEdge( pSoldier, pSoldier->aiData.usActionData, WEST ); break; case QUOTE_ACTION_ID_TRAVERSE_NORTH: - pSoldier->sOffWorldGridNo = pSoldier->usActionData; - AdjustSoldierPathToGoOffEdge( pSoldier, pSoldier->usActionData, NORTH ); + pSoldier->sOffWorldGridNo = pSoldier->aiData.usActionData; + AdjustSoldierPathToGoOffEdge( pSoldier, pSoldier->aiData.usActionData, NORTH ); break; default: break; } - NewDest(pSoldier,pSoldier->usActionData); // set new ->sDestination to actionData + NewDest(pSoldier,pSoldier->aiData.usActionData); // set new->pathing.sDestination to actionData - // make sure it worked (check that pSoldier->sDestination == pSoldier->usActionData) - if (pSoldier->sFinalDestination != pSoldier->usActionData) + // make sure it worked (check that pSoldier->pathing.sDestination == pSoldier->aiData.usActionData) + if (pSoldier->pathing.sFinalDestination != pSoldier->aiData.usActionData) { #ifdef BETAVERSION // this should NEVER happen, indicates AI picked an illegal spot! sprintf(tempstr,"ExecuteAction: ERROR - %s tried MOVE to gridno %d, NewDest failed, action %d CANCELED", - pSoldier->name,pSoldier->usActionData,pSoldier->bAction); + pSoldier->name,pSoldier->aiData.usActionData,pSoldier->aiData.bAction); #ifdef RECORDNET fprintf(NetDebugFile,"\n%s\n\n",tempstr); @@ -2328,36 +2337,36 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) PopMessage(tempstr); - sprintf(tempstr,"BLACK-LISTING gridno %d for %s",pSoldier->usActionData,pSoldier->name); + sprintf(tempstr,"BLACK-LISTING gridno %d for %s",pSoldier->aiData.usActionData,pSoldier->name); PopMessage(tempstr); SaveGame(ERROR_SAVE); #endif // temporarily black list this gridno to stop enemy from going there - pSoldier->sBlackList = (INT16) pSoldier->usActionData; + pSoldier->pathing.sBlackList = (INT16) pSoldier->aiData.usActionData; - DebugAI( String( "Setting blacklist for %d to %d", pSoldier->ubID, pSoldier->sBlackList ) ); + DebugAI( String( "Setting blacklist for %d to %d", pSoldier->ubID, pSoldier->pathing.sBlackList ) ); CancelAIAction(pSoldier,FORCE); return(FALSE); // nothing is in progress } - // cancel any old black-listed gridno, got a valid new ->sDestination - pSoldier->sBlackList = NOWHERE; + // cancel any old black-listed gridno, got a valid new->pathing.sDestination + pSoldier->pathing.sBlackList = NOWHERE; break; case AI_ACTION_ESCORTED_MOVE: // go where told to by escortPlayer // since this is a delayed move, gotta make sure that it hasn't become - // illegal since escort orders were issued (->sDestination/route blocked). + // illegal since escort orders were issued (->pathing.sDestination/route blocked). // So treat it like a CONTINUE movement, and handle errors that way - if (!TryToResumeMovement(pSoldier,pSoldier->usActionData)) + if (!TryToResumeMovement(pSoldier,pSoldier->aiData.usActionData)) { // don't black-list anything here, and action already got canceled return(FALSE); // nothing is in progress } - // cancel any old black-listed gridno, got a valid new ->sDestination - pSoldier->sBlackList = NOWHERE; + // cancel any old black-listed gridno, got a valid new->pathing.sDestination + pSoldier->pathing.sBlackList = NOWHERE; break; case AI_ACTION_TOSS_PROJECTILE: // throw grenade at/near opponent(s) @@ -2365,7 +2374,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) // drop through here... case AI_ACTION_KNIFE_MOVE: // preparing to stab opponent - if (pSoldier->bAction == AI_ACTION_KNIFE_MOVE) // if statement because toss falls through + if (pSoldier->aiData.bAction == AI_ACTION_KNIFE_MOVE) // if statement because toss falls through { pSoldier->usUIMovementMode = DetermineMovementMode( pSoldier, AI_ACTION_KNIFE_MOVE ); } @@ -2388,30 +2397,30 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) } #ifdef RECORDNET fprintf(NetDebugFile,"\tExecuteAction: %d calling HandleItem(), inHand %d, actionData %d, anitype %d, oldani %d\n", - pSoldier->ubID,pSoldier->inv[HANDPOS].item,pSoldier->usActionData,pSoldier->anitype[pSoldier->anim],pSoldier->oldani); + pSoldier->ubID,pSoldier->inv[HANDPOS].item,pSoldier->aiData.usActionData,pSoldier->anitype[pSoldier->anim],pSoldier->oldani); #endif #ifdef TESTVERSION - if (pSoldier->bAction == AI_ACTION_KNIFE_MOVE) + if (pSoldier->aiData.bAction == AI_ACTION_KNIFE_MOVE) { sprintf(tempstr,"TEST MSG: %s is about to go stab %s. MAKE SURE HE DOES!", pSoldier->name, - ExtMen[WhoIsThere(pSoldier->usActionData)].name); + ExtMen[WhoIsThere(pSoldier->aiData.usActionData)].name); SimulMessage(tempstr,3000,NODECRYPT); } #endif - if ( pSoldier->bAction == AI_ACTION_TOSS_PROJECTILE && IsGrenadeLauncherAttached(&pSoldier->inv[HANDPOS]) ) + if ( pSoldier->aiData.bAction == AI_ACTION_TOSS_PROJECTILE && IsGrenadeLauncherAttached(&pSoldier->inv[HANDPOS]) ) usHandItem = GetAttachedGrenadeLauncher(&pSoldier->inv[HANDPOS]); - iRetCode = HandleItem( pSoldier, pSoldier->usActionData, pSoldier->bTargetLevel, usHandItem, FALSE ); + iRetCode = HandleItem( pSoldier, pSoldier->aiData.usActionData, pSoldier->bTargetLevel, usHandItem, FALSE ); if ( iRetCode != ITEM_HANDLE_OK) { if ( iRetCode != ITEM_HANDLE_BROKEN ) // if the item broke, this is 'legal' and doesn't need reporting { - DebugAI( String( "AI %d got error code %ld from HandleItem, doing action %d, has %d APs... aborting deadlock!", pSoldier->ubID, iRetCode, pSoldier->bAction, pSoldier->bActionPoints ) ); - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"AI %d got error code %ld from HandleItem, doing action %d... aborting deadlock!", pSoldier->ubID, iRetCode, pSoldier->bAction ); + DebugAI( String( "AI %d got error code %ld from HandleItem, doing action %d, has %d APs... aborting deadlock!", pSoldier->ubID, iRetCode, pSoldier->aiData.bAction, pSoldier->bActionPoints ) ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"AI %d got error code %ld from HandleItem, doing action %d... aborting deadlock!", pSoldier->ubID, iRetCode, pSoldier->aiData.bAction ); } CancelAIAction( pSoldier, FORCE); #ifdef TESTAICONTROL @@ -2421,7 +2430,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) } #endif EndAIGuysTurn( pSoldier ); - } + } break; case AI_ACTION_PULL_TRIGGER: // activate an adjacent panic trigger @@ -2436,7 +2445,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) SendSoldierSetDesiredDirectionEvent( pSoldier, WEST ); } - EVENT_InitNewSoldierAnim( pSoldier, AI_PULL_SWITCH, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( AI_PULL_SWITCH, 0 , FALSE ); DeductPoints( pSoldier, AP_PULL_TRIGGER, 0 ); @@ -2444,7 +2453,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) gTacticalStatus.ubTheChosenOne = NOBODY; break; - case AI_ACTION_USE_DETONATOR: + case AI_ACTION_USE_DETONATOR: //gTacticalStatus.fPanicFlags = 0; // turn all flags off gTacticalStatus.ubTheChosenOne = NOBODY; //gTacticalStatus.sPanicTriggerGridno = NOWHERE; @@ -2455,16 +2464,16 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) SetOffPanicBombs( pSoldier->ubID, 0 ); // action completed immediately, cancel it right away - pSoldier->usActionData = NOWHERE; - pSoldier->bLastAction = pSoldier->bAction; - pSoldier->bAction = AI_ACTION_NONE; + pSoldier->aiData.usActionData = NOWHERE; + pSoldier->aiData.bLastAction = pSoldier->aiData.bAction; + pSoldier->aiData.bAction = AI_ACTION_NONE; return(FALSE); // no longer in progress break; case AI_ACTION_RED_ALERT: // tell friends opponent(s) seen // if a computer merc, and up to now they didn't know you're here - if (!(pSoldier->uiStatusFlags & SOLDIER_PC) && ( !(gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition) || ( ( gTacticalStatus.fPanicFlags & PANIC_TRIGGERS_HERE ) && gTacticalStatus.ubTheChosenOne == NOBODY ) ) ) + if (!(pSoldier->flags.uiStatusFlags & SOLDIER_PC) && ( !(gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition) || ( ( gTacticalStatus.fPanicFlags & PANIC_TRIGGERS_HERE ) && gTacticalStatus.ubTheChosenOne == NOBODY ) ) ) { HandleInitialRedAlert(pSoldier->bTeam, TRUE); } @@ -2494,7 +2503,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) break; case AI_ACTION_CHANGE_STANCE: // crouch - if ( gAnimControl[ pSoldier->usAnimState ].ubHeight == pSoldier->usActionData ) + if ( gAnimControl[ pSoldier->usAnimState ].ubHeight == pSoldier->aiData.usActionData ) { // abort! ActionDone( pSoldier ); @@ -2507,12 +2516,12 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) sprintf( tempstr, "ExecuteAction: SkipCoverCheck ON\n" ); DebugAI (tempstr); #endif - SendChangeSoldierStanceEvent( pSoldier, (UINT8) pSoldier->usActionData ); + SendChangeSoldierStanceEvent( pSoldier, (UINT8) pSoldier->aiData.usActionData ); break; case AI_ACTION_COWER: // make sure action data is set right - if ( pSoldier->uiStatusFlags & SOLDIER_COWERING ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_COWERING ) { // nothing to do! ActionDone( pSoldier ); @@ -2520,17 +2529,17 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) } else { - pSoldier->usActionData = ANIM_CROUCH; - SetSoldierCowerState( pSoldier, TRUE ); + pSoldier->aiData.usActionData = ANIM_CROUCH; + pSoldier->SetSoldierCowerState( TRUE ); } break; case AI_ACTION_STOP_COWERING: // make sure action data is set right - if ( pSoldier->uiStatusFlags & SOLDIER_COWERING ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_COWERING ) { - pSoldier->usActionData = ANIM_STAND; - SetSoldierCowerState( pSoldier, FALSE ); + pSoldier->aiData.usActionData = ANIM_STAND; + pSoldier->SetSoldierCowerState( FALSE ); } else { @@ -2542,11 +2551,11 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) case AI_ACTION_GIVE_AID: // help injured/dying friend //pSoldier->usUIMovementMode = RUNNING; - iRetCode = HandleItem( pSoldier, pSoldier->usActionData, 0, pSoldier->inv[HANDPOS].usItem, FALSE ); + iRetCode = HandleItem( pSoldier, pSoldier->aiData.usActionData, 0, pSoldier->inv[HANDPOS].usItem, FALSE ); if ( iRetCode != ITEM_HANDLE_OK) { #ifdef JA2BETAVERSION - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_ERROR, L"AI %d got error code %ld from HandleItem, doing action %d... aborting deadlock!", pSoldier->ubID, iRetCode, pSoldier->bAction ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_ERROR, L"AI %d got error code %ld from HandleItem, doing action %d... aborting deadlock!", pSoldier->ubID, iRetCode, pSoldier->aiData.bAction ); #endif CancelAIAction( pSoldier, FORCE); #ifdef TESTAICONTROL @@ -2556,7 +2565,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) } #endif EndAIGuysTurn( pSoldier ); - } + } break; case AI_ACTION_OPEN_OR_CLOSE_DOOR: @@ -2567,7 +2576,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) UINT8 ubDirection; INT16 sDoorGridNo; - ubDirection = GetDirectionFromGridNo( (INT16)pSoldier->usActionData, pSoldier ); + ubDirection = GetDirectionFromGridNo( (INT16)pSoldier->aiData.usActionData, pSoldier ); if (ubDirection == EAST || ubDirection == SOUTH) { sDoorGridNo = pSoldier->sGridNo; @@ -2590,7 +2599,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) DebugAI( String("Ending turn for %d because of error opening door", pSoldier->ubID ) ); } #endif - EndAIGuysTurn( pSoldier ); + EndAIGuysTurn( pSoldier ); } StartInteractiveObject( sDoorGridNo, pStructure->usStructureID, pSoldier, ubDirection ); @@ -2600,19 +2609,19 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) case AI_ACTION_LOWER_GUN: // for now, just do "action done" - InternalSoldierReadyWeapon(pSoldier,pSoldier->ubDirection,TRUE); + pSoldier->InternalSoldierReadyWeapon(pSoldier->ubDirection,TRUE); HandleSight(pSoldier, SIGHT_LOOK ); ActionDone( pSoldier ); break; case AI_ACTION_RAISE_GUN: //Madd: action added for snipers to ready weapon and use vision range bonuses - SoldierReadyWeapon(pSoldier); + pSoldier->SoldierReadyWeapon(); HandleSight(pSoldier, SIGHT_LOOK | SIGHT_RADIO); //AXP 23.03.2007: Sniper deadlock fix - if ( pSoldier->bOrders == SNIPER && pSoldier->bLastAction == AI_ACTION_RAISE_GUN) + if ( pSoldier->aiData.bOrders == SNIPER && pSoldier->aiData.bLastAction == AI_ACTION_RAISE_GUN) { - pSoldier->bNextAction = AI_ACTION_END_TURN; + pSoldier->aiData.bNextAction = AI_ACTION_END_TURN; } ActionDone( pSoldier ); @@ -2621,14 +2630,14 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) case AI_ACTION_CLIMB_ROOF: DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Executing: AI_ACTION_CLIMB_ROOF"); - if (pSoldier->bLevel == 0) + if (pSoldier->pathing.bLevel == 0) { - BeginSoldierClimbUpRoof( pSoldier ); + pSoldier->BeginSoldierClimbUpRoof( ); } else { - BeginSoldierClimbDownRoof( pSoldier ); - } + pSoldier->BeginSoldierClimbDownRoof( ); + } break; case AI_ACTION_END_TURN: @@ -2661,7 +2670,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) default: #ifdef BETAVERSION - NumMessage("ExecuteAction - Illegal action type = ",pSoldier->bAction); + NumMessage("ExecuteAction - Illegal action type = ",pSoldier->aiData.bAction); #endif return(FALSE); } @@ -2671,51 +2680,51 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) } void CheckForChangingOrders(SOLDIERTYPE *pSoldier) -{ - switch( pSoldier->bAlertStatus ) +{ + switch( pSoldier->aiData.bAlertStatus ) { case STATUS_GREEN: if ( !CREATURE_OR_BLOODCAT( pSoldier ) ) { - if ( pSoldier->bTeam == CIV_TEAM && pSoldier->ubProfile != NO_PROFILE && pSoldier->bNeutral && gMercProfiles[ pSoldier->ubProfile ].sPreCombatGridNo != NOWHERE && pSoldier->ubCivilianGroup != QUEENS_CIV_GROUP ) + if ( pSoldier->bTeam == CIV_TEAM && pSoldier->ubProfile != NO_PROFILE && pSoldier->aiData.bNeutral && gMercProfiles[ pSoldier->ubProfile ].sPreCombatGridNo != NOWHERE && pSoldier->ubCivilianGroup != QUEENS_CIV_GROUP ) { // must make them uncower first, then return to start location - pSoldier->bNextAction = AI_ACTION_END_COWER_AND_MOVE; - pSoldier->usNextActionData = gMercProfiles[ pSoldier->ubProfile ].sPreCombatGridNo; + pSoldier->aiData.bNextAction = AI_ACTION_END_COWER_AND_MOVE; + pSoldier->aiData.usNextActionData = gMercProfiles[ pSoldier->ubProfile ].sPreCombatGridNo; gMercProfiles[ pSoldier->ubProfile ].sPreCombatGridNo = NOWHERE; } - else if ( pSoldier->uiStatusFlags & SOLDIER_COWERING ) + else if ( pSoldier->flags.uiStatusFlags & SOLDIER_COWERING ) { - pSoldier->bNextAction = AI_ACTION_STOP_COWERING; - pSoldier->usNextActionData = ANIM_STAND; + pSoldier->aiData.bNextAction = AI_ACTION_STOP_COWERING; + pSoldier->aiData.usNextActionData = ANIM_STAND; } else { - pSoldier->bNextAction = AI_ACTION_CHANGE_STANCE; - pSoldier->usNextActionData = ANIM_STAND; + pSoldier->aiData.bNextAction = AI_ACTION_CHANGE_STANCE; + pSoldier->aiData.usNextActionData = ANIM_STAND; } } break; case STATUS_YELLOW: break; default: - if ((pSoldier->bOrders == ONGUARD) || (pSoldier->bOrders == CLOSEPATROL)) + if ((pSoldier->aiData.bOrders == ONGUARD) || (pSoldier->aiData.bOrders == CLOSEPATROL)) { // crank up ONGUARD to CLOSEPATROL, and CLOSEPATROL to FARPATROL - pSoldier->bOrders++; // increase roaming range by 1 category + pSoldier->aiData.bOrders++; // increase roaming range by 1 category } - else if ( pSoldier->bTeam == MILITIA_TEAM && pSoldier->bOrders != SNIPER ) + else if ( pSoldier->bTeam == MILITIA_TEAM && pSoldier->aiData.bOrders != SNIPER ) { // go on alert! - pSoldier->bOrders = SEEKENEMY; + pSoldier->aiData.bOrders = SEEKENEMY; } else if ( CREATURE_OR_BLOODCAT( pSoldier ) ) { - if (pSoldier->bOrders != STATIONARY && pSoldier->bOrders != ONCALL) + if (pSoldier->aiData.bOrders != STATIONARY && pSoldier->aiData.bOrders != ONCALL) { - pSoldier->bOrders = SEEKENEMY; + pSoldier->aiData.bOrders = SEEKENEMY; } - } + } if ( pSoldier->ubProfile == WARDEN ) { @@ -2769,13 +2778,13 @@ void HandleInitialRedAlert( INT8 bTeam, UINT8 ubCommunicate) pSoldier = FindSoldierByProfileID( QUEEN, FALSE ); if ( pSoldier ) { - pSoldier->bAlertStatus = STATUS_RED; + pSoldier->aiData.bAlertStatus = STATUS_RED; } pSoldier = FindSoldierByProfileID( JOE, FALSE ); if ( pSoldier ) { - pSoldier->bAlertStatus = STATUS_RED; + pSoldier->aiData.bAlertStatus = STATUS_RED; } } @@ -2806,7 +2815,7 @@ void ManChecksOnFriends(SOLDIERTYPE *pSoldier) } // if this man is neutral / NOT on my side, he's not my friend - if (pFriend->bNeutral || (pSoldier->bSide != pFriend->bSide)) + if (pFriend->aiData.bNeutral || (pSoldier->bSide != pFriend->bSide)) continue; // next merc // if this merc is actually ME @@ -2818,7 +2827,7 @@ void ManChecksOnFriends(SOLDIERTYPE *pSoldier) if (SoldierToSoldierLineOfSightTest(pSoldier, pFriend, TRUE, CALC_FROM_ALL_DIRS)) { // if my friend is in battle or something is clearly happening there - if ((pFriend->bAlertStatus >= STATUS_RED) || pFriend->bUnderFire || (pFriend->bLife < OKLIFE)) + if ((pFriend->aiData.bAlertStatus >= STATUS_RED) || pFriend->aiData.bUnderFire || (pFriend->stats.bLife < OKLIFE)) { #ifdef DEBUGDECISIONS STR16 tempstr; @@ -2826,7 +2835,7 @@ void ManChecksOnFriends(SOLDIERTYPE *pSoldier) AIPopMessage(tempstr); #endif - pSoldier->bAlertStatus = STATUS_RED; + pSoldier->aiData.bAlertStatus = STATUS_RED; CheckForChangingOrders(pSoldier); SetNewSituation( pSoldier ); break; // don't bother checking on any other friends @@ -2835,17 +2844,17 @@ void ManChecksOnFriends(SOLDIERTYPE *pSoldier) { // if he seems suspicious or acts like he thought he heard something // and I'm still on status GREEN - if ((pFriend->bAlertStatus == STATUS_YELLOW) && - (pSoldier->bAlertStatus < STATUS_YELLOW)) + if ((pFriend->aiData.bAlertStatus == STATUS_YELLOW) && + (pSoldier->aiData.bAlertStatus < STATUS_YELLOW)) { #ifdef TESTVERSION sprintf(tempstr,"TEST MSG: %s sees %s listening, goes to YELLOW ALERT!",pSoldier->name,ExtMen[pFriend->ubID].name); PopMessage(tempstr); #endif - pSoldier->bAlertStatus = STATUS_YELLOW; // also get suspicious + pSoldier->aiData.bAlertStatus = STATUS_YELLOW; // also get suspicious SetNewSituation( pSoldier ); - pSoldier->sNoiseGridno = pFriend->sGridNo; // pretend FRIEND made noise - pSoldier->ubNoiseVolume = 3; // remember this for 3 turns + pSoldier->aiData.sNoiseGridno = pFriend->sGridNo; // pretend FRIEND made noise + pSoldier->aiData.ubNoiseVolume = 3; // remember this for 3 turns // keep check other friends, too, in case any are already on RED } } @@ -2858,7 +2867,7 @@ void SetNewSituation( SOLDIERTYPE * pSoldier ) { if ( pSoldier->bTeam != gbPlayerNum ) { - if ( pSoldier->ubQuoteRecord == 0 && !gTacticalStatus.fAutoBandageMode && !(pSoldier->bNeutral && gTacticalStatus.uiFlags & ENGAGED_IN_CONV) ) + if ( pSoldier->ubQuoteRecord == 0 && !gTacticalStatus.fAutoBandageMode && !(pSoldier->aiData.bNeutral && gTacticalStatus.uiFlags & ENGAGED_IN_CONV) ) { // allow new situation to be set //if (gTacticalStatus.ubAttackBusyCount > 0) @@ -2868,7 +2877,7 @@ void SetNewSituation( SOLDIERTYPE * pSoldier ) //else { // 0verhaul: Let's see if we can do without this. - pSoldier->bNewSituation = IS_NEW_SITUATION; + pSoldier->aiData.bNewSituation = IS_NEW_SITUATION; } if ( gTacticalStatus.ubAttackBusyCount != 0 ) @@ -2879,7 +2888,7 @@ void SetNewSituation( SOLDIERTYPE * pSoldier ) if ( !(gTacticalStatus.uiFlags & INCOMBAT) || (gTacticalStatus.uiFlags & REALTIME) ) { // reset delay if necessary! - RESETTIMECOUNTER( pSoldier->AICounter, Random( 1000 ) ); + RESETTIMECOUNTER( pSoldier->timeCounters.AICounter, Random( 1000 ) ); } } } @@ -2910,13 +2919,13 @@ void HandleAITacticalTraversal( SOLDIERTYPE * pSoldier ) EndAIGuysTurn( pSoldier ); RemoveManAsTarget( pSoldier ); - if (pSoldier->bTeam == CIV_TEAM && pSoldier->fAIFlags & AI_CHECK_SCHEDULE) + if (pSoldier->bTeam == CIV_TEAM && pSoldier->aiData.fAIFlags & AI_CHECK_SCHEDULE) { MoveSoldierFromMercToAwaySlot( pSoldier ); pSoldier->bInSector = FALSE; } else - { + { int iMapX = gWorldSectorX; int iMapY = gWorldSectorY; @@ -2954,7 +2963,7 @@ void HandleAITacticalTraversal( SOLDIERTYPE * pSoldier ) } - ProcessQueenCmdImplicationsOfDeath( pSoldier ); + ProcessQueenCmdImplicationsOfDeath( pSoldier ); TacticalRemoveSoldier( pSoldier->ubID ); } CheckForEndOfBattle( TRUE ); diff --git a/TacticalAI/AIUtils.cpp b/TacticalAI/AIUtils.cpp index 66d5ce7b..c0bd6b21 100644 --- a/TacticalAI/AIUtils.cpp +++ b/TacticalAI/AIUtils.cpp @@ -101,11 +101,11 @@ INT8 OKToAttack(SOLDIERTYPE * pSoldier, int target) return(NOSHOOT_NOLOAD); } } - else if (pSoldier->inv[HANDPOS].ItemData.Gun.ubGunShotsLeft == 0 /*SB*/ || - !(pSoldier->inv[HANDPOS].ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) || - (IsValidSecondHandShotForReloadingPurposes( pSoldier) && - (pSoldier->inv[SECONDHANDPOS].ItemData.Gun.ubGunShotsLeft == 0 || - !(pSoldier->inv[SECONDHANDPOS].ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER)))) + else if (pSoldier->inv[HANDPOS][0]->data.gun.ubGunShotsLeft == 0 /*SB*/ || + !(pSoldier->inv[HANDPOS][0]->data.gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) || + (pSoldier->IsValidSecondHandShotForReloadingPurposes( ) && + (pSoldier->inv[SECONDHANDPOS][0]->data.gun.ubGunShotsLeft == 0 || + !(pSoldier->inv[SECONDHANDPOS][0]->data.gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER)))) { return(NOSHOOT_NOAMMO); } @@ -128,7 +128,7 @@ BOOLEAN ConsiderProne( SOLDIERTYPE * pSoldier ) INT8 bOpponentLevel; INT32 iRange; - if (pSoldier->bAIMorale >= MORALE_NORMAL) + if (pSoldier->aiData.bAIMorale >= MORALE_NORMAL) { return( FALSE ); } @@ -160,7 +160,7 @@ UINT8 StanceChange( SOLDIERTYPE * pSoldier, UINT8 ubAttackAPCost ) else if ( IsValidStance( pSoldier, ANIM_CROUCH ) ) { return( ANIM_CROUCH ); - } + } } } else if (PTR_CROUCHED) @@ -176,11 +176,11 @@ UINT8 StanceChange( SOLDIERTYPE * pSoldier, UINT8 ubAttackAPCost ) UINT8 ShootingStanceChange( SOLDIERTYPE * pSoldier, ATTACKTYPE * pAttack, INT8 bDesiredDirection ) { // Figure out the best stance for this attack - + // We don't want to go through a lot of complex calculations here, - // just compare the chance of the bullet hitting if we are + // just compare the chance of the bullet hitting if we are // standing, crouched, or prone - + UINT16 usRealAnimState, usBestAnimState; INT8 bBestStanceDiff=-1; INT8 bLoop, bStanceNum, bStanceDiff, bAPsAfterAttack, bCurAimTime; @@ -229,21 +229,21 @@ UINT8 ShootingStanceChange( SOLDIERTYPE * pSoldier, ATTACKTYPE * pAttack, INT8 b switch( bLoop ) { case 0: - if ( !InternalIsValidStance( pSoldier, bDesiredDirection, ANIM_STAND ) ) + if ( !pSoldier->InternalIsValidStance( bDesiredDirection, ANIM_STAND ) ) { continue; } pSoldier->usAnimState = STANDING; - break; + break; case 1: - if ( !InternalIsValidStance( pSoldier, bDesiredDirection, ANIM_CROUCH ) ) + if ( !pSoldier->InternalIsValidStance( bDesiredDirection, ANIM_CROUCH ) ) { continue; } pSoldier->usAnimState = CROUCHING; break; default: - if ( !InternalIsValidStance( pSoldier, bDesiredDirection, ANIM_PRONE ) ) + if ( !pSoldier->InternalIsValidStance( bDesiredDirection, ANIM_PRONE ) ) { continue; } @@ -251,7 +251,7 @@ UINT8 ShootingStanceChange( SOLDIERTYPE * pSoldier, ATTACKTYPE * pAttack, INT8 b break; } - // Hack: Assumes the cost to reach the target stance from the current stance is the same as going back. Probably true. + // Hack: Assumes the cost to reach the target stance from the current stance is the same as going back. Probably true. bCurAimTime = __min( bAPsAfterAttack - GetAPsToChangeStance( pSoldier, bStanceNum), pAttack->ubAimTime); // If can't fire at all from this stance, don't bother with the chances of hitting if (bCurAimTime < 0) @@ -266,7 +266,7 @@ UINT8 ShootingStanceChange( SOLDIERTYPE * pSoldier, ATTACKTYPE * pAttack, INT8 b // artificially augment "chance of damage" to reflect penalty to be shot at various stances switch( pSoldier->usAnimState ) { - case CROUCHING: + case CROUCHING: if (iRange > POINT_BLANK_RANGE + 10 * (AIM_PENALTY_TARGET_CROUCHED / 3)) { uiStanceBonus = AIM_BONUS_CROUCHING; @@ -326,13 +326,13 @@ UINT8 ShootingStanceChange( SOLDIERTYPE * pSoldier, ATTACKTYPE * pAttack, INT8 b UINT16 DetermineMovementMode( SOLDIERTYPE * pSoldier, INT8 bAction ) { - if ( pSoldier->fUIMovementFast ) + if ( pSoldier->flags.fUIMovementFast ) { return( RUNNING ); } else if ( CREATURE_OR_BLOODCAT( pSoldier ) ) { - if (pSoldier->bAlertStatus == STATUS_GREEN) + if (pSoldier->aiData.bAlertStatus == STATUS_GREEN) { return( WALKING ); } @@ -347,7 +347,7 @@ UINT16 DetermineMovementMode( SOLDIERTYPE * pSoldier, INT8 bAction ) } else { - if ( (pSoldier->fAIFlags & AI_CAUTIOUS) && (MovementMode[bAction][Urgency[pSoldier->bAlertStatus][pSoldier->bAIMorale]] == RUNNING) ) + if ( (pSoldier->aiData.fAIFlags & AI_CAUTIOUS) && (MovementMode[bAction][Urgency[pSoldier->aiData.bAlertStatus][pSoldier->aiData.bAIMorale]] == RUNNING) ) { return( WALKING ); } @@ -355,13 +355,13 @@ UINT16 DetermineMovementMode( SOLDIERTYPE * pSoldier, INT8 bAction ) { return( WALKING ); } - else if ( (pSoldier->ubBodyType == HATKIDCIV || pSoldier->ubBodyType == KIDCIV) && (pSoldier->bAlertStatus == STATUS_GREEN) && Random( 10 ) == 0 ) + else if ( (pSoldier->ubBodyType == HATKIDCIV || pSoldier->ubBodyType == KIDCIV) && (pSoldier->aiData.bAlertStatus == STATUS_GREEN) && Random( 10 ) == 0 ) { return( KID_SKIPPING ); } else { - return( MovementMode[bAction][Urgency[pSoldier->bAlertStatus][pSoldier->bAIMorale]] ); + return( MovementMode[bAction][Urgency[pSoldier->aiData.bAlertStatus][pSoldier->aiData.bAIMorale]] ); } } } @@ -369,19 +369,19 @@ UINT16 DetermineMovementMode( SOLDIERTYPE * pSoldier, INT8 bAction ) void NewDest(SOLDIERTYPE *pSoldier, UINT16 usGridNo) { // ATE: Setting sDestination? Tis does not make sense... - //pSoldier->sDestination = usGridNo; + //pSoldier->pathing.sDestination = usGridNo; BOOLEAN fSet = FALSE; - - if ( IS_MERC_BODY_TYPE( pSoldier ) && pSoldier->bAction == AI_ACTION_TAKE_COVER && (pSoldier->bOrders == DEFENSIVE || pSoldier->bOrders == CUNNINGSOLO || pSoldier->bOrders == CUNNINGAID ) && (SoldierDifficultyLevel( pSoldier ) >= 2) ) + + if ( IS_MERC_BODY_TYPE( pSoldier ) && pSoldier->aiData.bAction == AI_ACTION_TAKE_COVER && (pSoldier->aiData.bOrders == DEFENSIVE || pSoldier->aiData.bOrders == CUNNINGSOLO || pSoldier->aiData.bOrders == CUNNINGAID ) && (SoldierDifficultyLevel( pSoldier ) >= 2) ) { UINT16 usMovementMode; // getting real movement anim for someone who is going to take cover, not just considering - usMovementMode = MovementMode[AI_ACTION_TAKE_COVER][Urgency[pSoldier->bAlertStatus][pSoldier->bAIMorale]]; + usMovementMode = MovementMode[AI_ACTION_TAKE_COVER][Urgency[pSoldier->aiData.bAlertStatus][pSoldier->aiData.bAIMorale]]; if ( usMovementMode != SWATTING ) { // really want to look at path, see how far we could get on path while swatting - if ( EnoughPoints( pSoldier, RecalculatePathCost( pSoldier, SWATTING ), 0, FALSE ) || (pSoldier->bLastAction == AI_ACTION_TAKE_COVER && pSoldier->usUIMovementMode == SWATTING ) ) + if ( EnoughPoints( pSoldier, RecalculatePathCost( pSoldier, SWATTING ), 0, FALSE ) || (pSoldier->aiData.bLastAction == AI_ACTION_TAKE_COVER && pSoldier->usUIMovementMode == SWATTING ) ) { pSoldier->usUIMovementMode = SWATTING; } @@ -398,18 +398,18 @@ void NewDest(SOLDIERTYPE *pSoldier, UINT16 usGridNo) } else { - if ( pSoldier->bTeam == ENEMY_TEAM && pSoldier->bAlertStatus == STATUS_RED ) + if ( pSoldier->bTeam == ENEMY_TEAM && pSoldier->aiData.bAlertStatus == STATUS_RED ) { - switch( pSoldier->bAction ) + switch( pSoldier->aiData.bAction ) { - + case AI_ACTION_MOVE_TO_CLIMB: case AI_ACTION_RUN_AWAY: - pSoldier->usUIMovementMode = DetermineMovementMode( pSoldier, pSoldier->bAction ); + pSoldier->usUIMovementMode = DetermineMovementMode( pSoldier, pSoldier->aiData.bAction ); fSet = TRUE; break; default: -/* if ( PreRandom( 5 - SoldierDifficultyLevel( pSoldier ) ) == 0 ) +/* if ( PreRandom( 5 - SoldierDifficultyLevel( pSoldier ) ) == 0 ) { INT16 sClosestNoise = (INT16) MostImportantNoiseHeard( pSoldier, NULL, NULL, NULL ); if ( sClosestNoise != NOWHERE && PythSpacesAway( pSoldier->sGridNo, sClosestNoise ) < MaxDistanceVisible() + 10 ) @@ -420,7 +420,7 @@ void NewDest(SOLDIERTYPE *pSoldier, UINT16 usGridNo) }*/ if ( !fSet ) { - pSoldier->usUIMovementMode = DetermineMovementMode( pSoldier, pSoldier->bAction ); + pSoldier->usUIMovementMode = DetermineMovementMode( pSoldier, pSoldier->aiData.bAction ); fSet = TRUE; } break; @@ -429,7 +429,7 @@ void NewDest(SOLDIERTYPE *pSoldier, UINT16 usGridNo) } else { - pSoldier->usUIMovementMode = DetermineMovementMode( pSoldier, pSoldier->bAction ); + pSoldier->usUIMovementMode = DetermineMovementMode( pSoldier, pSoldier->aiData.bAction ); fSet = TRUE; } @@ -439,11 +439,11 @@ void NewDest(SOLDIERTYPE *pSoldier, UINT16 usGridNo) } } - //EVENT_GetNewSoldierPath( pSoldier, pSoldier->sDestination, pSoldier->usUIMovementMode ); + //pSoldier->EVENT_GetNewSoldierPath( pSoldier->pathing.sDestination, pSoldier->usUIMovementMode ); // ATE: Using this more versitile version // Last paramater says whether to re-start the soldier's animation // This should be done if buddy was paused for fNoApstofinishMove... - EVENT_InternalGetNewSoldierPath( pSoldier, usGridNo, pSoldier->usUIMovementMode , FALSE, pSoldier->fNoAPToFinishMove ); + pSoldier->EVENT_InternalGetNewSoldierPath( usGridNo, pSoldier->usUIMovementMode , FALSE, pSoldier->flags.fNoAPToFinishMove ); } @@ -452,11 +452,11 @@ BOOLEAN IsActionAffordable(SOLDIERTYPE *pSoldier) { INT8 bMinPointsNeeded = 0; INT8 bAPForStandUp = 0; - INT8 bAPToLookAtWall = ( FindDirectionForClimbing( pSoldier->sGridNo, pSoldier->bLevel ) == pSoldier->ubDirection ) ? 0 : 1; + INT8 bAPToLookAtWall = ( FindDirectionForClimbing( pSoldier, pSoldier->sGridNo, pSoldier->pathing.bLevel ) == pSoldier->ubDirection ) ? 0 : 1; //NumMessage("AffordableAction - Guy#",pSoldier->ubID); - switch (pSoldier->bAction) + switch (pSoldier->aiData.bAction) { case AI_ACTION_NONE: // maintain current position & facing // no cost for doing nothing! @@ -495,7 +495,7 @@ BOOLEAN IsActionAffordable(SOLDIERTYPE *pSoldier) case AI_ACTION_LOCK_DOOR: bMinPointsNeeded = MinPtsToMove(pSoldier); break; - + case AI_ACTION_DROP_ITEM: bMinPointsNeeded = AP_PICKUP_ITEM; break; @@ -505,14 +505,14 @@ BOOLEAN IsActionAffordable(SOLDIERTYPE *pSoldier) case AI_ACTION_KNIFE_MOVE: // preparing to stab adjacent opponent case AI_ACTION_THROW_KNIFE: // only FIRE_GUN currently actually pays extra turning costs! - bMinPointsNeeded = MinAPsToAttack(pSoldier,pSoldier->usActionData,ADDTURNCOST); + bMinPointsNeeded = MinAPsToAttack(pSoldier,pSoldier->aiData.usActionData,ADDTURNCOST); #ifdef BETAVERSION if (ptsNeeded > pSoldier->bActionPoints) { /* sprintf(tempstr,"AI ERROR: %s has insufficient points for attack action %d at grid %d", - pSoldier->name,pSoldier->bAction,pSoldier->usActionData); + pSoldier->name,pSoldier->aiData.bAction,pSoldier->aiData.usActionData); PopMessage(tempstr); */ } @@ -542,18 +542,18 @@ BOOLEAN IsActionAffordable(SOLDIERTYPE *pSoldier) break; case AI_ACTION_CLIMB_ROOF: - if (pSoldier->bLevel == 0) + if (pSoldier->pathing.bLevel == 0) { if( PTR_CROUCHED ) bAPForStandUp = 2; if( PTR_PRONE ) bAPForStandUp = 4; bMinPointsNeeded = AP_CLIMBROOF + bAPForStandUp + bAPToLookAtWall; } - else + else { if( !PTR_CROUCHED ) bAPForStandUp = 2; bMinPointsNeeded = AP_CLIMBOFFROOF + bAPForStandUp + bAPToLookAtWall; } - break; + break; case AI_ACTION_COWER: case AI_ACTION_STOP_COWERING: @@ -563,10 +563,10 @@ BOOLEAN IsActionAffordable(SOLDIERTYPE *pSoldier) case AI_ACTION_OFFER_SURRENDER: bMinPointsNeeded = 0; break; - + default: #ifdef BETAVERSION - //NumMessage("AffordableAction - Illegal action type = ",pSoldier->bAction); + //NumMessage("AffordableAction - Illegal action type = ",pSoldier->aiData.bAction); #endif break; } @@ -641,14 +641,14 @@ INT16 RandomFriendWithin(SOLDIERTYPE *pSoldier) // if this man not neutral, but is on my side, OR if he is neutral, but // so am I, then he's a "friend" for the purposes of random visitations - if ((!pFriend->bNeutral && (pSoldier->bSide == pFriend->bSide)) || - (pFriend->bNeutral && pSoldier->bNeutral)) + if ((!pFriend->aiData.bNeutral && (pSoldier->bSide == pFriend->bSide)) || + (pFriend->aiData.bNeutral && pSoldier->aiData.bNeutral)) { // if we're not already neighbors if (SpacesAway(pSoldier->sGridNo,pFriend->sGridNo) > 1) { - // remember his guynum, increment friend counter - ubFriendIDs[ubFriendCount++] = pFriend->ubID; + // remember his guynum, increment friend counter + ubFriendIDs[ubFriendCount++] = pFriend->ubID; } } } @@ -664,7 +664,7 @@ INT16 RandomFriendWithin(SOLDIERTYPE *pSoldier) if (!fRangeRestricted || (SpacesAway(usOrigin,Menptr[ubFriendID].sGridNo) - 1) <= usMaxDist) { - // should be close enough, try to find a legal ->sDestination within 1 tile + // should be close enough, try to find a legal->pathing.sDestination within 1 tile // clear dirChecked flag for all 8 directions for (ubDirection = 0; ubDirection < 8; ubDirection++) @@ -701,10 +701,10 @@ INT16 RandomFriendWithin(SOLDIERTYPE *pSoldier) { if (LegalNPCDestination(pSoldier,usDest,ENSURE_PATH,NOWATER, 0)) { - fFound = TRUE; // found a spot - pSoldier->usActionData = usDest; // store this ->sDestination - pSoldier->bPathStored = TRUE; // optimization - Ian - break; // stop checking in other directions + fFound = TRUE; // found a spot + pSoldier->aiData.usActionData = usDest; // store this->pathing.sDestination + pSoldier->pathing.bPathStored = TRUE; // optimization - Ian + break; // stop checking in other directions } } } @@ -740,7 +740,7 @@ INT16 RandDestWithinRange(SOLDIERTYPE *pSoldier) sOrigX = sOrigY = -1; sMaxLeft = sMaxRight = sMaxUp = sMaxDown = sXRange = sYRange = -1; - // Try to find a random ->sDestination that's no more than maxDist away from + // Try to find a random->pathing.sDestination that's no more than maxDist away from // the given gridno of origin if (gfTurnBasedAI) @@ -754,10 +754,10 @@ INT16 RandDestWithinRange(SOLDIERTYPE *pSoldier) usMaxDist = RoamingRange(pSoldier, (INT16 *)&usOrigin); - if ( pSoldier->bOrders <= CLOSEPATROL && (pSoldier->bTeam == CIV_TEAM || pSoldier->ubProfile != NO_PROFILE ) ) + if ( pSoldier->aiData.bOrders <= CLOSEPATROL && (pSoldier->bTeam == CIV_TEAM || pSoldier->ubProfile != NO_PROFILE ) ) { // any other combo uses the default of ubRoom == 0, set above - if ( !InARoom( pSoldier->usPatrolGrid[0], &ubRoom ) ) + if ( !InARoom( pSoldier->aiData.sPatrolGrid[0], &ubRoom ) ) { ubRoom = 0; } @@ -772,11 +772,11 @@ INT16 RandDestWithinRange(SOLDIERTYPE *pSoldier) sOrigX = usOrigin % MAXCOL; sOrigY = usOrigin / MAXCOL; - sMaxLeft = min(usMaxDist, sOrigX); + sMaxLeft = min(usMaxDist, sOrigX); sMaxRight = min(usMaxDist,MAXCOL - (sOrigX + 1)); // determine maximum vertical limits - sMaxUp = min(usMaxDist, sOrigY); + sMaxUp = min(usMaxDist, sOrigY); sMaxDown = min(usMaxDist,MAXROW - (sOrigY + 1)); sXRange = sMaxLeft + sMaxRight + 1; @@ -813,17 +813,17 @@ INT16 RandDestWithinRange(SOLDIERTYPE *pSoldier) if (!LegalNPCDestination(pSoldier,sRandDest,ENSURE_PATH,NOWATER,0)) { sRandDest = NOWHERE; - continue; // try again! + continue; // try again! } - // passed all the tests, ->sDestination is acceptable + // passed all the tests,->pathing.sDestination is acceptable fFound = TRUE; - pSoldier->bPathStored = TRUE; // optimization - Ian + pSoldier->pathing.bPathStored = TRUE; // optimization - Ian } } else { - // keep rolling random ->sDestinations until one's satisfactory or retries used + // keep rolling random->pathing.sDestinations until one's satisfactory or retries used while ((ubTriesLeft--) && !fFound) { if (fLimited) @@ -856,12 +856,12 @@ INT16 RandDestWithinRange(SOLDIERTYPE *pSoldier) if (!LegalNPCDestination(pSoldier,sRandDest,ENSURE_PATH,NOWATER,0)) { sRandDest = NOWHERE; - continue; // try again! + continue; // try again! } - // passed all the tests, ->sDestination is acceptable + // passed all the tests,->pathing.sDestination is acceptable fFound = TRUE; - pSoldier->bPathStored = TRUE; // optimization - Ian + pSoldier->pathing.bPathStored = TRUE; // optimization - Ian } } @@ -898,7 +898,7 @@ INT16 ClosestReachableDisturbance(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK, pbNoiseLevel = &gbPublicNoiseLevel[pSoldier->bTeam]; // hang pointers at start of this guy's personal and public opponent opplists -// pbPersOL = &pSoldier->bOppList[0]; +// pbPersOL = &pSoldier->aiData.bOppList[0]; // pbPublOL = &(gbPublicOpplist[pSoldier->bTeam][0]); // psLastLoc = &(gsLastKnownOppLoc[pSoldier->ubID][0]); @@ -910,16 +910,16 @@ INT16 ClosestReachableDisturbance(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK, // if this merc is inactive, at base, on assignment, or dead if (!pOpp) { - continue; // next merc + continue; // next merc } // if this merc is neutral/on same side, he's not an opponent if ( CONSIDERED_NEUTRAL( pSoldier, pOpp ) || (pSoldier->bSide == pOpp->bSide) ) { - continue; // next merc + continue; // next merc } - pbPersOL = pSoldier->bOppList + pOpp->ubID; + pbPersOL = pSoldier->aiData.bOppList + pOpp->ubID; pbPublOL = gbPublicOpplist[pSoldier->bTeam] + pOpp->ubID; psLastLoc = gsLastKnownOppLoc[pSoldier->ubID] + pOpp->ubID; pbLastLevel = gbLastKnownOppLevel[pSoldier->ubID] + pOpp->ubID; @@ -927,12 +927,12 @@ INT16 ClosestReachableDisturbance(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK, // if this opponent is unknown personally and publicly if ((*pbPersOL == NOT_HEARD_OR_SEEN) && (*pbPublOL == NOT_HEARD_OR_SEEN)) { - continue; // next merc + continue; // next merc } // this is possible if get here from BLACK AI in one of those rare // instances when we couldn't get a meaningful shot off at a guy in sight - if ((*pbPersOL == SEEN_CURRENTLY) && (pOpp->bLife >= OKLIFE)) + if ((*pbPersOL == SEEN_CURRENTLY) && (pOpp->stats.bLife >= OKLIFE)) { // don't allow this to return any valid values, this guy remains a // serious threat and the last thing we want to do is approach him! @@ -941,7 +941,7 @@ INT16 ClosestReachableDisturbance(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK, // if personal knowledge is more up to date or at least equal if ((gubKnowledgeValue[*pbPublOL - OLDEST_HEARD_VALUE][*pbPersOL - OLDEST_HEARD_VALUE] > 0) || - (*pbPersOL == *pbPublOL)) + (*pbPersOL == *pbPublOL)) { // using personal knowledge, obtain opponent's "best guess" gridno sGridNo = *psLastLoc; @@ -957,7 +957,7 @@ INT16 ClosestReachableDisturbance(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK, // if we are standing at that gridno (!, obviously our info is old...) if (sGridNo == pSoldier->sGridNo) { - continue; // next merc + continue; // next merc } if (sGridNo == NOWHERE) @@ -992,21 +992,21 @@ INT16 ClosestReachableDisturbance(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK, } iShortestPath = iPathCost; fClosestClimbingNecessary = fClimbingNecessary; - } + } } // if any "misc. noise" was also heard recently - if (pSoldier->sNoiseGridno != NOWHERE && pSoldier->sNoiseGridno != sClosestDisturbance) + if (pSoldier->aiData.sNoiseGridno != NOWHERE && pSoldier->aiData.sNoiseGridno != sClosestDisturbance) { // test this gridno, too - sGridNo = pSoldier->sNoiseGridno; + sGridNo = pSoldier->aiData.sNoiseGridno; bLevel = pSoldier->bNoiseLevel; // if we are there (at the noise gridno) if (sGridNo == pSoldier->sGridNo) { - pSoldier->sNoiseGridno = NOWHERE; // wipe it out, not useful anymore - pSoldier->ubNoiseVolume = 0; + pSoldier->aiData.sNoiseGridno = NOWHERE; // wipe it out, not useful anymore + pSoldier->aiData.ubNoiseVolume = 0; } else { @@ -1025,7 +1025,7 @@ INT16 ClosestReachableDisturbance(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK, } iShortestPath = iPathCost; fClosestClimbingNecessary = fClimbingNecessary; - } + } } } @@ -1038,7 +1038,7 @@ INT16 ClosestReachableDisturbance(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK, bLevel = *pbNoiseLevel; // if we are not NEAR the noise gridno... - if ( pSoldier->bLevel != bLevel || PythSpacesAway( pSoldier->sGridNo, sGridNo ) >= 6 || SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, bLevel, 0, FALSE, NO_DISTANCE_LIMIT ) == 0 ) + if ( pSoldier->pathing.bLevel != bLevel || PythSpacesAway( pSoldier->sGridNo, sGridNo ) >= 6 || SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, bLevel, 0, FALSE, NO_DISTANCE_LIMIT ) == 0 ) // if we are NOT there (at the noise gridno) // if (sGridNo != pSoldier->sGridNo) { @@ -1057,7 +1057,7 @@ INT16 ClosestReachableDisturbance(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK, } iShortestPath = iPathCost; fClosestClimbingNecessary = fClimbingNecessary; - } + } } else { @@ -1084,7 +1084,7 @@ INT16 ClosestKnownOpponent(SOLDIERTYPE *pSoldier, INT16 * psGridNo, INT8 * pbLev UINT32 uiLoop; INT32 iRange, iClosestRange = 1500; INT8 *pbPersOL,*pbPublOL; - INT8 bLevel, bClosestLevel; + INT8 bLevel, bClosestLevel; SOLDIERTYPE * pOpp; bClosestLevel = -1; @@ -1094,7 +1094,7 @@ INT16 ClosestKnownOpponent(SOLDIERTYPE *pSoldier, INT16 * psGridNo, INT8 * pbLev psLastLoc = &(gsLastKnownOppLoc[pSoldier->ubID][0]); // hang pointers at start of this guy's personal and public opponent opplists - pbPersOL = &pSoldier->bOppList[0]; + pbPersOL = &pSoldier->aiData.bOppList[0]; pbPublOL = &(gbPublicOpplist[pSoldier->bTeam][0]); // look through this man's personal & public opplists for opponents known @@ -1105,34 +1105,34 @@ INT16 ClosestKnownOpponent(SOLDIERTYPE *pSoldier, INT16 * psGridNo, INT8 * pbLev // if this merc is inactive, at base, on assignment, or dead if (!pOpp) { - continue; // next merc + continue; // next merc } // if this merc is neutral/on same side, he's not an opponent if ( CONSIDERED_NEUTRAL( pSoldier, pOpp ) || (pSoldier->bSide == pOpp->bSide)) { - continue; // next merc + continue; // next merc } // Special stuff for Carmen the bounty hunter - if (pSoldier->bAttitude == ATTACKSLAYONLY && pOpp->ubProfile != 64) + if (pSoldier->aiData.bAttitude == ATTACKSLAYONLY && pOpp->ubProfile != 64) { - continue; // next opponent + continue; // next opponent } - pbPersOL = pSoldier->bOppList + pOpp->ubID; + pbPersOL = pSoldier->aiData.bOppList + pOpp->ubID; pbPublOL = gbPublicOpplist[pSoldier->bTeam] + pOpp->ubID; psLastLoc = gsLastKnownOppLoc[pSoldier->ubID] + pOpp->ubID; // if this opponent is unknown personally and publicly if ((*pbPersOL == NOT_HEARD_OR_SEEN) && (*pbPublOL == NOT_HEARD_OR_SEEN)) { - continue; // next merc + continue; // next merc } // if personal knowledge is more up to date or at least equal if ((gubKnowledgeValue[*pbPublOL - OLDEST_HEARD_VALUE][*pbPersOL - OLDEST_HEARD_VALUE] > 0) || - (*pbPersOL == *pbPublOL)) + (*pbPersOL == *pbPublOL)) { // using personal knowledge, obtain opponent's "best guess" gridno sGridNo = gsLastKnownOppLoc[pSoldier->ubID][pOpp->ubID]; @@ -1148,13 +1148,13 @@ INT16 ClosestKnownOpponent(SOLDIERTYPE *pSoldier, INT16 * psGridNo, INT8 * pbLev // if we are standing at that gridno(!, obviously our info is old...) if (sGridNo == pSoldier->sGridNo) { - continue; // next merc + continue; // next merc } // this function is used only for turning towards closest opponent or changing stance - // as such, if they AI is in a building, + // as such, if they AI is in a building, // we should ignore people who are on the roof of the same building as the AI - if ( (bLevel != pSoldier->bLevel) && SameBuilding( pSoldier->sGridNo, sGridNo ) ) + if ( (bLevel != pSoldier->pathing.bLevel) && SameBuilding( pSoldier->sGridNo, sGridNo ) ) { continue; } @@ -1195,7 +1195,7 @@ INT16 ClosestSeenOpponent(SOLDIERTYPE *pSoldier, INT16 * psGridNo, INT8 * pbLeve UINT32 uiLoop; INT32 iRange, iClosestRange = 1500; INT8 *pbPersOL; - INT8 bLevel, bClosestLevel; + INT8 bLevel, bClosestLevel; SOLDIERTYPE * pOpp; bClosestLevel = -1; @@ -1208,43 +1208,43 @@ INT16 ClosestSeenOpponent(SOLDIERTYPE *pSoldier, INT16 * psGridNo, INT8 * pbLeve // if this merc is inactive, at base, on assignment, or dead if (!pOpp) { - continue; // next merc + continue; // next merc } // if this merc is neutral/on same side, he's not an opponent if ( CONSIDERED_NEUTRAL( pSoldier, pOpp ) || (pSoldier->bSide == pOpp->bSide)) { - continue; // next merc + continue; // next merc } // Special stuff for Carmen the bounty hunter - if (pSoldier->bAttitude == ATTACKSLAYONLY && pOpp->ubProfile != 64) + if (pSoldier->aiData.bAttitude == ATTACKSLAYONLY && pOpp->ubProfile != 64) { - continue; // next opponent + continue; // next opponent } - pbPersOL = pSoldier->bOppList + pOpp->ubID; + pbPersOL = pSoldier->aiData.bOppList + pOpp->ubID; // if this opponent is not seen personally if (*pbPersOL != SEEN_CURRENTLY) { - continue; // next merc + continue; // next merc } // since we're dealing with seen people, use exact gridnos sGridNo = pOpp->sGridNo; - bLevel = pOpp->bLevel; + bLevel = pOpp->pathing.bLevel; // if we are standing at that gridno(!, obviously our info is old...) if (sGridNo == pSoldier->sGridNo) { - continue; // next merc + continue; // next merc } // this function is used only for turning towards closest opponent or changing stance - // as such, if they AI is in a building, + // as such, if they AI is in a building, // we should ignore people who are on the roof of the same building as the AI - if ( (bLevel != pSoldier->bLevel) && SameBuilding( pSoldier->sGridNo, sGridNo ) ) + if ( (bLevel != pSoldier->pathing.bLevel) && SameBuilding( pSoldier->sGridNo, sGridNo ) ) { continue; } @@ -1296,18 +1296,18 @@ INT16 ClosestPC( SOLDIERTYPE *pSoldier, INT16 * psDistance ) ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; for ( ; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++) - { + { pTargetSoldier = Menptr + ubLoop; if (!pTargetSoldier->bActive || !pTargetSoldier->bInSector) { continue; } - + // if not conscious, skip him - if (pTargetSoldier->bLife < OKLIFE) + if (pTargetSoldier->stats.bLife < OKLIFE) { - continue; + continue; } if ( AM_AN_EPC( pTargetSoldier ) ) @@ -1316,10 +1316,10 @@ INT16 ClosestPC( SOLDIERTYPE *pSoldier, INT16 * psDistance ) } sDist = PythSpacesAway(pSoldier->sGridNo,pTargetSoldier->sGridNo); - + // if this PC is not visible to the soldier, then add a penalty to the distance // so that we weight in favour of visible mercs - if ( pTargetSoldier->bTeam != pSoldier->bTeam && pSoldier->bOppList[ ubLoop ] != SEEN_CURRENTLY ) + if ( pTargetSoldier->bTeam != pSoldier->bTeam && pSoldier->aiData.bOppList[ ubLoop ] != SEEN_CURRENTLY ) { sDist += 10; } @@ -1328,7 +1328,7 @@ INT16 ClosestPC( SOLDIERTYPE *pSoldier, INT16 * psDistance ) { sMinDist = sDist; sGridNo = pTargetSoldier->sGridNo; - } + } } if ( psDistance ) @@ -1345,7 +1345,7 @@ INT16 FindClosestClimbPointAvailableToAI( SOLDIERTYPE * pSoldier, INT16 sStartGr INT16 sRoamingOrigin; INT16 sRoamingRange; - if ( pSoldier->uiStatusFlags & SOLDIER_PC ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_PC ) { sRoamingOrigin = pSoldier->sGridNo; sRoamingRange = 99; @@ -1355,7 +1355,7 @@ INT16 FindClosestClimbPointAvailableToAI( SOLDIERTYPE * pSoldier, INT16 sStartGr sRoamingRange = RoamingRange( pSoldier, &sRoamingOrigin ); } - // since climbing necessary involves going an extra tile, we compare against 1 less than the roam range... + // since climbing necessary involves going an extra tile, we compare against 1 less than the roam range... // or add 1 to the distance to the climb point sGridNo = FindClosestClimbPoint( pSoldier, sStartGridNo, sDesiredGridNo, fClimbUp ); @@ -1373,9 +1373,9 @@ INT16 FindClosestClimbPointAvailableToAI( SOLDIERTYPE * pSoldier, INT16 sStartGr BOOLEAN ClimbingNecessary( SOLDIERTYPE * pSoldier, INT16 sDestGridNo, INT8 bDestLevel ) { - if (pSoldier->bLevel == bDestLevel) + if (pSoldier->pathing.bLevel == bDestLevel) { - if ( (pSoldier->bLevel == 0) || ( gubBuildingInfo[ pSoldier->sGridNo ] == gubBuildingInfo[ sDestGridNo ] ) ) + if ( (pSoldier->pathing.bLevel == 0) || ( gubBuildingInfo[ pSoldier->sGridNo ] == gubBuildingInfo[ sDestGridNo ] ) ) { return( FALSE ); } @@ -1392,9 +1392,9 @@ BOOLEAN ClimbingNecessary( SOLDIERTYPE * pSoldier, INT16 sDestGridNo, INT8 bDest INT16 GetInterveningClimbingLocation( SOLDIERTYPE * pSoldier, INT16 sDestGridNo, INT8 bDestLevel, BOOLEAN * pfClimbingNecessary ) { - if (pSoldier->bLevel == bDestLevel) + if (pSoldier->pathing.bLevel == bDestLevel) { - if ( (pSoldier->bLevel == 0) || ( gubBuildingInfo[ pSoldier->sGridNo ] == gubBuildingInfo[ sDestGridNo ] ) ) + if ( (pSoldier->pathing.bLevel == 0) || ( gubBuildingInfo[ pSoldier->sGridNo ] == gubBuildingInfo[ sDestGridNo ] ) ) { // on ground or same building... normal! *pfClimbingNecessary = FALSE; @@ -1412,7 +1412,7 @@ INT16 GetInterveningClimbingLocation( SOLDIERTYPE * pSoldier, INT16 sDestGridNo, { *pfClimbingNecessary = TRUE; // different levels - if (pSoldier->bLevel == 0) + if (pSoldier->pathing.bLevel == 0) { // got to go UP onto building return( FindClosestClimbPointAvailableToAI( pSoldier, pSoldier->sGridNo, sDestGridNo, TRUE ) ); @@ -1430,9 +1430,9 @@ INT16 EstimatePathCostToLocation( SOLDIERTYPE * pSoldier, INT16 sDestGridNo, INT INT16 sPathCost; INT16 sClimbGridNo; - if (pSoldier->bLevel == bDestLevel) + if (pSoldier->pathing.bLevel == bDestLevel) { - if ( (pSoldier->bLevel == 0) || ( gubBuildingInfo[ pSoldier->sGridNo ] == gubBuildingInfo[ sDestGridNo ] ) ) + if ( (pSoldier->pathing.bLevel == 0) || ( gubBuildingInfo[ pSoldier->sGridNo ] == gubBuildingInfo[ sDestGridNo ] ) ) { // on ground or same building... normal! sPathCost = EstimatePlotPath( pSoldier, sDestGridNo, FALSE, FALSE, FALSE, WALKING, FALSE, FALSE, 0); @@ -1476,10 +1476,10 @@ INT16 EstimatePathCostToLocation( SOLDIERTYPE * pSoldier, INT16 sDestGridNo, INT else { // different levels - if (pSoldier->bLevel == 0) + if (pSoldier->pathing.bLevel == 0) { //got to go UP onto building - sClimbGridNo = FindClosestClimbPointAvailableToAI( pSoldier, pSoldier->sGridNo, sDestGridNo, TRUE ); + sClimbGridNo = FindClosestClimbPointAvailableToAI( pSoldier, pSoldier->sGridNo, sDestGridNo, TRUE ); } else { @@ -1497,7 +1497,7 @@ INT16 EstimatePathCostToLocation( SOLDIERTYPE * pSoldier, INT16 sDestGridNo, INT if (sPathCost != 0) { // add in the cost of climbing up or down - if (pSoldier->bLevel == 0) + if (pSoldier->pathing.bLevel == 0) { // must climb up sPathCost += AP_CLIMBROOF; @@ -1538,12 +1538,12 @@ BOOLEAN GuySawEnemyThisTurnOrBefore( SOLDIERTYPE * pSoldier ) for ( ubIDLoop = gTacticalStatus.Team[ ubTeamLoop ].bFirstID; ubIDLoop <= gTacticalStatus.Team[ ubTeamLoop ].bLastID; ubIDLoop++ ) { // if this guy SAW an enemy recently... - if ( pSoldier->bOppList[ ubIDLoop ] >= SEEN_CURRENTLY ) + if ( pSoldier->aiData.bOppList[ ubIDLoop ] >= SEEN_CURRENTLY ) { return( TRUE ); } } - } + } } return( FALSE ); @@ -1570,37 +1570,37 @@ INT16 ClosestReachableFriendInTrouble(SOLDIERTYPE *pSoldier, BOOLEAN * pfClimbin // if this merc is inactive, at base, on assignment, or dead if (!pFriend) { - continue; // next merc + continue; // next merc } // if this merc is neutral or NOT on the same side, he's not a friend - if (pFriend->bNeutral || (pSoldier->bSide != pFriend->bSide)) + if (pFriend->aiData.bNeutral || (pSoldier->bSide != pFriend->bSide)) { - continue; // next merc + continue; // next merc } // if this "friend" is actually US if (pFriend->ubID == pSoldier->ubID) { - continue; // next merc + continue; // next merc } // CJC: restrict "last one to radio" to only if that guy saw us this turn or last turn // if this friend is not under fire, and isn't the last one to radio - if ( ! ( pFriend->bUnderFire || (pFriend->ubID == gTacticalStatus.Team[pFriend->bTeam].ubLastMercToRadio && GuySawEnemyThisTurnOrBefore( pFriend ) ) ) ) + if ( ! ( pFriend->aiData.bUnderFire || (pFriend->ubID == gTacticalStatus.Team[pFriend->bTeam].ubLastMercToRadio && GuySawEnemyThisTurnOrBefore( pFriend ) ) ) ) { - continue; // next merc + continue; // next merc } // if we're already neighbors if (SpacesAway(pSoldier->sGridNo,pFriend->sGridNo) == 1) { - continue; // next merc + continue; // next merc } // get the AP cost to go to this friend's gridno - sPathCost = EstimatePathCostToLocation( pSoldier, pFriend->sGridNo, pFriend->bLevel, TRUE, &fClimbingNecessary, &sClimbGridNo ); + sPathCost = EstimatePathCostToLocation( pSoldier, pFriend->sGridNo, pFriend->pathing.bLevel, TRUE, &fClimbingNecessary, &sClimbGridNo ); // if we can get there if (sPathCost != 0) @@ -1649,7 +1649,7 @@ INT16 DistanceToClosestFriend( SOLDIERTYPE * pSoldier ) ubLoop = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; for ( ; ubLoop <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; ubLoop++ ) - { + { if (ubLoop == pSoldier->ubID) { // same guy - continue! @@ -1665,9 +1665,9 @@ INT16 DistanceToClosestFriend( SOLDIERTYPE * pSoldier ) continue; } // if not conscious, skip him - else if (pTargetSoldier->bLife < OKLIFE) + else if (pTargetSoldier->stats.bLife < OKLIFE) { - continue; + continue; } } else @@ -1679,9 +1679,9 @@ INT16 DistanceToClosestFriend( SOLDIERTYPE * pSoldier ) { continue; } - else if (pTargetSoldier->bLife < OKLIFE) + else if (pTargetSoldier->stats.bLife < OKLIFE) { - continue; + continue; } else { @@ -1689,13 +1689,13 @@ INT16 DistanceToClosestFriend( SOLDIERTYPE * pSoldier ) return( 1 ); } } - + sDist = SpacesAway(pSoldier->sGridNo,pTargetSoldier->sGridNo); - + if (sDist < sMinDist) { sMinDist = sDist; - } + } } return( sMinDist ); @@ -1709,20 +1709,20 @@ BOOLEAN InWaterGasOrSmoke( SOLDIERTYPE *pSoldier, INT16 sGridNo ) } // smoke - if (gpWorldLevelData[sGridNo].ubExtFlags[ pSoldier->bLevel ] & MAPELEMENT_EXT_SMOKE) + if (gpWorldLevelData[sGridNo].ubExtFlags[ pSoldier->pathing.bLevel ] & MAPELEMENT_EXT_SMOKE) { return( TRUE ); } // tear/mustard gas - //if ( (gpWorldLevelData[sGridNo].ubExtFlags[ pSoldier->bLevel ] & (MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) && + //if ( (gpWorldLevelData[sGridNo].ubExtFlags[ pSoldier->pathing.bLevel ] & (MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) && // (pSoldier->inv[HEAD1POS].usItem != GASMASK && pSoldier->inv[HEAD2POS].usItem != GASMASK) ) - if ( (gpWorldLevelData[sGridNo].ubExtFlags[ pSoldier->bLevel ] & (MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) && - FindGasMask(pSoldier) == NO_SLOT ) + if ( (gpWorldLevelData[sGridNo].ubExtFlags[ pSoldier->pathing.bLevel ] & (MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) && + FindGasMask(pSoldier) == NO_SLOT ) { return( TRUE ); } - if ( gpWorldLevelData[sGridNo].ubExtFlags[ pSoldier->bLevel ] & MAPELEMENT_EXT_BURNABLEGAS ) + if ( gpWorldLevelData[sGridNo].ubExtFlags[ pSoldier->pathing.bLevel ] & MAPELEMENT_EXT_BURNABLEGAS ) { return( TRUE ); } @@ -1733,20 +1733,20 @@ BOOLEAN InWaterGasOrSmoke( SOLDIERTYPE *pSoldier, INT16 sGridNo ) BOOLEAN InGasOrSmoke( SOLDIERTYPE *pSoldier, INT16 sGridNo ) { // smoke - if (gpWorldLevelData[sGridNo].ubExtFlags[pSoldier->bLevel] & MAPELEMENT_EXT_SMOKE) + if (gpWorldLevelData[sGridNo].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_SMOKE) { return( TRUE ); } // tear/mustard gas - //if ( (gpWorldLevelData[sGridNo].ubExtFlags[pSoldier->bLevel] & (MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) && + //if ( (gpWorldLevelData[sGridNo].ubExtFlags[pSoldier->pathing.bLevel] & (MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) && // (pSoldier->inv[HEAD1POS].usItem != GASMASK && pSoldier->inv[HEAD2POS].usItem != GASMASK) ) - if ( (gpWorldLevelData[sGridNo].ubExtFlags[pSoldier->bLevel] & (MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) && - FindGasMask(pSoldier) == NO_SLOT ) + if ( (gpWorldLevelData[sGridNo].ubExtFlags[pSoldier->pathing.bLevel] & (MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) && + FindGasMask(pSoldier) == NO_SLOT ) { return( TRUE ); } - if ( gpWorldLevelData[sGridNo].ubExtFlags[pSoldier->bLevel] & MAPELEMENT_EXT_BURNABLEGAS ) + if ( gpWorldLevelData[sGridNo].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_BURNABLEGAS ) { return( TRUE ); } @@ -1763,12 +1763,12 @@ INT16 InWaterOrGas(SOLDIERTYPE *pSoldier, INT16 sGridNo) } // tear/mustard gas - if ( (gpWorldLevelData[sGridNo].ubExtFlags[pSoldier->bLevel] & (MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) && + if ( (gpWorldLevelData[sGridNo].ubExtFlags[pSoldier->pathing.bLevel] & (MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) && FindGasMask(pSoldier) == NO_SLOT ) { return( TRUE ); } - if ( gpWorldLevelData[sGridNo].ubExtFlags[pSoldier->bLevel] & MAPELEMENT_EXT_BURNABLEGAS ) + if ( gpWorldLevelData[sGridNo].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_BURNABLEGAS ) { return( TRUE ); } @@ -1779,12 +1779,12 @@ INT16 InWaterOrGas(SOLDIERTYPE *pSoldier, INT16 sGridNo) BOOLEAN InGas( SOLDIERTYPE *pSoldier, INT16 sGridNo ) { // tear/mustard gas - if ( (gpWorldLevelData[sGridNo].ubExtFlags[pSoldier->bLevel] & (MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) && + if ( (gpWorldLevelData[sGridNo].ubExtFlags[pSoldier->pathing.bLevel] & (MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) && FindGasMask(pSoldier) == NO_SLOT ) { return( TRUE ); } - if ( gpWorldLevelData[sGridNo].ubExtFlags[pSoldier->bLevel] & MAPELEMENT_EXT_BURNABLEGAS ) + if ( gpWorldLevelData[sGridNo].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_BURNABLEGAS ) { return( TRUE ); } @@ -1805,11 +1805,11 @@ BOOLEAN WearGasMaskIfAvailable( SOLDIERTYPE * pSoldier ) { return( FALSE ); } - if ( pSoldier->inv[ HEAD1POS ].usItem == NOTHING) + if ( pSoldier->inv[ HEAD1POS ].exists() == false) { bNewSlot = HEAD1POS; } - else if ( pSoldier->inv[ HEAD2POS ].usItem == NOTHING ) + else if ( pSoldier->inv[ HEAD2POS ].exists() == false ) { bNewSlot = HEAD2POS; } @@ -1826,7 +1826,7 @@ BOOLEAN WearGasMaskIfAvailable( SOLDIERTYPE * pSoldier ) BOOLEAN InLightAtNight( INT16 sGridNo, INT8 bLevel ) { UINT8 ubBackgroundLightLevel; - + // do not consider us to be "in light" if we're in an underground sector if ( gbWorldSectorZ > 0 ) { @@ -1847,7 +1847,7 @@ BOOLEAN InLightAtNight( INT16 sGridNo, INT8 bLevel ) return( FALSE ); } - // NB light levels are backwards, so a lower light level means the + // NB light levels are backwards, so a lower light level means the // spot in question is BRIGHTER if ( LightTrueLevel( sGridNo, bLevel ) < ubBackgroundLightLevel ) @@ -1867,224 +1867,224 @@ INT8 CalcMorale(SOLDIERTYPE *pSoldier) INT8 bMostRecentOpplistValue; INT8 bMoraleCategory; UINT8 *pSeenOpp; //,*friendOlPtr; - INT8 *pbPersOL, *pbPublOL; + INT8 *pbPersOL, *pbPublOL; SOLDIERTYPE *pOpponent,*pFriend; // if army guy has NO weapons left then panic! if ( pSoldier->bTeam == ENEMY_TEAM ) { - if ( FindAIUsableObjClass( pSoldier, IC_WEAPON ) == NO_SLOT ) - { - return( MORALE_HOPELESS ); - } + if ( FindAIUsableObjClass( pSoldier, IC_WEAPON ) == NO_SLOT ) + { + return( MORALE_HOPELESS ); + } } // hang pointers to my personal opplist, my team's public opplist, and my // list of previously seen opponents - pSeenOpp = (UINT8 *) &(gbSeenOpponents[pSoldier->ubID][0]); + pSeenOpp = (UINT8 *) &(gbSeenOpponents[pSoldier->ubID][0]); // loop through every one of my possible opponents for (uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++) { pOpponent = MercSlots[ uiLoop ]; - // if this merc is inactive, at base, on assignment, dead, unconscious - if (!pOpponent || (pOpponent->bLife < OKLIFE)) - continue; // next merc + // if this merc is inactive, at base, on assignment, dead, unconscious + if (!pOpponent || (pOpponent->stats.bLife < OKLIFE)) + continue; // next merc - // if this merc is neutral/on same side, he's not an opponent, skip him! - if ( CONSIDERED_NEUTRAL( pSoldier, pOpponent ) || (pSoldier->bSide == pOpponent->bSide)) - continue; // next merc + // if this merc is neutral/on same side, he's not an opponent, skip him! + if ( CONSIDERED_NEUTRAL( pSoldier, pOpponent ) || (pSoldier->bSide == pOpponent->bSide)) + continue; // next merc // Special stuff for Carmen the bounty hunter - if (pSoldier->bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != 64) + if (pSoldier->aiData.bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != 64) { - continue; // next opponent + continue; // next opponent } - pbPersOL = pSoldier->bOppList + pOpponent->ubID; - pbPublOL = gbPublicOpplist[pSoldier->bTeam] + pOpponent->ubID; - pSeenOpp = (UINT8 *)gbSeenOpponents[pSoldier->ubID] + pOpponent->ubID; + pbPersOL = pSoldier->aiData.bOppList + pOpponent->ubID; + pbPublOL = gbPublicOpplist[pSoldier->bTeam] + pOpponent->ubID; + pSeenOpp = (UINT8 *)gbSeenOpponents[pSoldier->ubID] + pOpponent->ubID; - // if this opponent is unknown to me personally AND unknown to my team, too - if ((*pbPersOL == NOT_HEARD_OR_SEEN) && (*pbPublOL == NOT_HEARD_OR_SEEN)) - { - // if I have never seen him before anywhere in this sector, either - if (!(*pSeenOpp)) - continue; // next merc + // if this opponent is unknown to me personally AND unknown to my team, too + if ((*pbPersOL == NOT_HEARD_OR_SEEN) && (*pbPublOL == NOT_HEARD_OR_SEEN)) + { + // if I have never seen him before anywhere in this sector, either + if (!(*pSeenOpp)) + continue; // next merc - // have seen him in the past, so he remains something of a threat - bMostRecentOpplistValue = 0; // uses the free slot for 0 opplist - } - else // decide which opplist is more current - { - // if personal knowledge is more up to date or at least equal - if ((gubKnowledgeValue[*pbPublOL - OLDEST_HEARD_VALUE][*pbPersOL - OLDEST_HEARD_VALUE] > 0) || (*pbPersOL == *pbPublOL)) - bMostRecentOpplistValue = *pbPersOL; // use personal - else - bMostRecentOpplistValue = *pbPublOL; // use public - } + // have seen him in the past, so he remains something of a threat + bMostRecentOpplistValue = 0; // uses the free slot for 0 opplist + } + else // decide which opplist is more current + { + // if personal knowledge is more up to date or at least equal + if ((gubKnowledgeValue[*pbPublOL - OLDEST_HEARD_VALUE][*pbPersOL - OLDEST_HEARD_VALUE] > 0) || (*pbPersOL == *pbPublOL)) + bMostRecentOpplistValue = *pbPersOL; // use personal + else + bMostRecentOpplistValue = *pbPublOL; // use public + } - iPercent = ThreatPercent[bMostRecentOpplistValue - OLDEST_HEARD_VALUE]; + iPercent = ThreatPercent[bMostRecentOpplistValue - OLDEST_HEARD_VALUE]; - sOppThreatValue = (iPercent * CalcManThreatValue(pOpponent,pSoldier->sGridNo,FALSE,pSoldier)) / 100; + sOppThreatValue = (iPercent * CalcManThreatValue(pOpponent,pSoldier->sGridNo,FALSE,pSoldier)) / 100; - //sprintf(tempstr,"Known opponent %s, opplist status %d, percent %d, threat = %d", - // ExtMen[pOpponent->ubID].name,ubMostRecentOpplistValue,ubPercent,sOppThreatValue); - //PopMessage(tempstr); + //sprintf(tempstr,"Known opponent %s, opplist status %d, percent %d, threat = %d", + // ExtMen[pOpponent->ubID].name,ubMostRecentOpplistValue,ubPercent,sOppThreatValue); + //PopMessage(tempstr); - // ADD this to their running total threatValue (decreases my MORALE) - iTheirTotalThreat += sOppThreatValue; - //NumMessage("Their TOTAL threat now = ",sTheirTotalThreat); + // ADD this to their running total threatValue (decreases my MORALE) + iTheirTotalThreat += sOppThreatValue; + //NumMessage("Their TOTAL threat now = ",sTheirTotalThreat); - // NOW THE FUN PART: SINCE THIS OPPONENT IS KNOWN TO ME IN SOME WAY, - // ANY FRIENDS OF MINE THAT KNOW ABOUT HIM BOOST MY MORALE. SO, LET'S GO - // THROUGH THEIR PERSONAL OPPLISTS AND CHECK WHICH OF MY FRIENDS KNOW - // SOMETHING ABOUT HIM AND WHAT THEIR THREAT VALUE TO HIM IS. + // NOW THE FUN PART: SINCE THIS OPPONENT IS KNOWN TO ME IN SOME WAY, + // ANY FRIENDS OF MINE THAT KNOW ABOUT HIM BOOST MY MORALE. SO, LET'S GO + // THROUGH THEIR PERSONAL OPPLISTS AND CHECK WHICH OF MY FRIENDS KNOW + // SOMETHING ABOUT HIM AND WHAT THEIR THREAT VALUE TO HIM IS. - for (uiLoop2 = 0; uiLoop2 < guiNumMercSlots; uiLoop2++) - { - pFriend = MercSlots[ uiLoop2 ]; + for (uiLoop2 = 0; uiLoop2 < guiNumMercSlots; uiLoop2++) + { + pFriend = MercSlots[ uiLoop2 ]; - // if this merc is inactive, at base, on assignment, dead, unconscious - if (!pFriend || (pFriend->bLife < OKLIFE)) - continue; // next merc + // if this merc is inactive, at base, on assignment, dead, unconscious + if (!pFriend || (pFriend->stats.bLife < OKLIFE)) + continue; // next merc - // if this merc is not on my side, then he's NOT one of my friends + // if this merc is not on my side, then he's NOT one of my friends - // WE CAN'T AFFORD TO CONSIDER THE ENEMY OF MY ENEMY MY FRIEND, HERE! - // ONLY IF WE ARE ACTUALLY OFFICIALLY CO-OPERATING TOGETHER (SAME SIDE) - if ( pFriend->bNeutral && !( pSoldier->ubCivilianGroup != NON_CIV_GROUP && pSoldier->ubCivilianGroup == pFriend->ubCivilianGroup ) ) - { - continue; // next merc - } - - if ( pSoldier->bSide != pFriend->bSide ) - continue; // next merc + // WE CAN'T AFFORD TO CONSIDER THE ENEMY OF MY ENEMY MY FRIEND, HERE! + // ONLY IF WE ARE ACTUALLY OFFICIALLY CO-OPERATING TOGETHER (SAME SIDE) + if ( pFriend->aiData.bNeutral && !( pSoldier->ubCivilianGroup != NON_CIV_GROUP && pSoldier->ubCivilianGroup == pFriend->ubCivilianGroup ) ) + { + continue; // next merc + } - // THIS TEST IS INVALID IF A COMPUTER-TEAM IS PLAYING CO-OPERATIVELY - // WITH A NON-COMPUTER TEAM SINCE THE OPPLISTS INVOLVED ARE NOT - // UP-TO-DATE. THIS SITUATION IS CURRENTLY NOT POSSIBLE IN HTH/DG. + if ( pSoldier->bSide != pFriend->bSide ) + continue; // next merc - // ALSO NOTE THAT WE COUNT US AS OUR (BEST) FRIEND FOR THESE CALCULATIONS + // THIS TEST IS INVALID IF A COMPUTER-TEAM IS PLAYING CO-OPERATIVELY + // WITH A NON-COMPUTER TEAM SINCE THE OPPLISTS INVOLVED ARE NOT + // UP-TO-DATE. THIS SITUATION IS CURRENTLY NOT POSSIBLE IN HTH/DG. + + // ALSO NOTE THAT WE COUNT US AS OUR (BEST) FRIEND FOR THESE CALCULATIONS // subtract HEARD_2_TURNS_AGO (which is negative) to make values start at 0 and // be positive otherwise - iPercent = ThreatPercent[pFriend->bOppList[pOpponent->ubID] - OLDEST_HEARD_VALUE]; + iPercent = ThreatPercent[pFriend->aiData.bOppList[pOpponent->ubID] - OLDEST_HEARD_VALUE]; - // reduce the percentage value based on how far away they are from the enemy, if they only hear him - if ( pFriend->bOppList[ pOpponent->ubID ] <= HEARD_LAST_TURN ) - { - iPercent -= PythSpacesAway( pSoldier->sGridNo, pFriend->sGridNo ) * 2; - if ( iPercent <= 0 ) - { - //ignore! - continue; - } - } + // reduce the percentage value based on how far away they are from the enemy, if they only hear him + if ( pFriend->aiData.bOppList[ pOpponent->ubID ] <= HEARD_LAST_TURN ) + { + iPercent -= PythSpacesAway( pSoldier->sGridNo, pFriend->sGridNo ) * 2; + if ( iPercent <= 0 ) + { + //ignore! + continue; + } + } - sFrndThreatValue = (iPercent * CalcManThreatValue(pFriend,pOpponent->sGridNo,FALSE,pSoldier)) / 100; + sFrndThreatValue = (iPercent * CalcManThreatValue(pFriend,pOpponent->sGridNo,FALSE,pSoldier)) / 100; - //sprintf(tempstr,"Known by friend %s, opplist status %d, percent %d, threat = %d", - // ExtMen[pFriend->ubID].name,pFriend->bOppList[pOpponent->ubID],ubPercent,sFrndThreatValue); - //PopMessage(tempstr); + //sprintf(tempstr,"Known by friend %s, opplist status %d, percent %d, threat = %d", + // ExtMen[pFriend->ubID].name,pFriend->aiData.bOppList[pOpponent->ubID],ubPercent,sFrndThreatValue); + //PopMessage(tempstr); - // ADD this to our running total threatValue (increases my MORALE) - // We multiply by sOppThreatValue to PRO-RATE this based on opponent's - // threat value to ME personally. Divide later by sum of them all. - iOurTotalThreat += sOppThreatValue * sFrndThreatValue; - } + // ADD this to our running total threatValue (increases my MORALE) + // We multiply by sOppThreatValue to PRO-RATE this based on opponent's + // threat value to ME personally. Divide later by sum of them all. + iOurTotalThreat += sOppThreatValue * sFrndThreatValue; + } - // this could get slow if I have a lot of friends... - //KeepInterfaceGoing(); - } + // this could get slow if I have a lot of friends... + //KeepInterfaceGoing(); + } // if they are no threat whatsoever if (!iTheirTotalThreat) - sMorale = 500; // our morale is just incredible + sMorale = 500; // our morale is just incredible else - { - // now divide sOutTotalThreat by sTheirTotalThreat to get the REAL value - iOurTotalThreat /= iTheirTotalThreat; + { + // now divide sOutTotalThreat by sTheirTotalThreat to get the REAL value + iOurTotalThreat /= iTheirTotalThreat; - // calculate the morale (100 is even, < 100 is us losing, > 100 is good) - sMorale = (INT16) ((100 * iOurTotalThreat) / iTheirTotalThreat); - } + // calculate the morale (100 is even, < 100 is us losing, > 100 is good) + sMorale = (INT16) ((100 * iOurTotalThreat) / iTheirTotalThreat); + } - if (sMorale <= 25) // odds 1:4 or worse - bMoraleCategory = MORALE_HOPELESS; - else if (sMorale <= 50) // odds between 1:4 and 1:2 - bMoraleCategory = MORALE_WORRIED; - else if (sMorale <= 150) // odds between 1:2 and 3:2 - bMoraleCategory = MORALE_NORMAL; - else if (sMorale <= 300) // odds between 3:2 and 3:1 - bMoraleCategory = MORALE_CONFIDENT; - else // odds better than 3:1 - bMoraleCategory = MORALE_FEARLESS; + if (sMorale <= 25) // odds 1:4 or worse + bMoraleCategory = MORALE_HOPELESS; + else if (sMorale <= 50) // odds between 1:4 and 1:2 + bMoraleCategory = MORALE_WORRIED; + else if (sMorale <= 150) // odds between 1:2 and 3:2 + bMoraleCategory = MORALE_NORMAL; + else if (sMorale <= 300) // odds between 3:2 and 3:1 + bMoraleCategory = MORALE_CONFIDENT; + else // odds better than 3:1 + bMoraleCategory = MORALE_FEARLESS; - switch (pSoldier->bAttitude) - { - case DEFENSIVE: bMoraleCategory--; break; - case BRAVESOLO: bMoraleCategory += 2; break; - case BRAVEAID: bMoraleCategory += 2; break; - case CUNNINGSOLO: break; - case CUNNINGAID: break; - case AGGRESSIVE: bMoraleCategory++; break; - } + switch (pSoldier->aiData.bAttitude) + { + case DEFENSIVE: bMoraleCategory--; break; + case BRAVESOLO: bMoraleCategory += 2; break; + case BRAVEAID: bMoraleCategory += 2; break; + case CUNNINGSOLO: break; + case CUNNINGAID: break; + case AGGRESSIVE: bMoraleCategory++; break; + } // make idiot administrators much more aggressive if ( pSoldier->ubSoldierClass == SOLDIER_CLASS_ADMINISTRATOR ) { - bMoraleCategory += 2; + bMoraleCategory += 2; } // if still full of energy if (pSoldier->bBreath > 75) - bMoraleCategory++; + bMoraleCategory++; else - { - // if getting a bit low on breath - if (pSoldier->bBreath < 40) - bMoraleCategory--; + { + // if getting a bit low on breath + if (pSoldier->bBreath < 40) + bMoraleCategory--; - // if getting REALLY low on breath - if (pSoldier->bBreath < 10) - bMoraleCategory--; - } + // if getting REALLY low on breath + if (pSoldier->bBreath < 10) + bMoraleCategory--; + } // if still very healthy - if (pSoldier->bLife > 75) - bMoraleCategory++; + if (pSoldier->stats.bLife > 75) + bMoraleCategory++; else - { - // if getting a bit low on life - if (pSoldier->bLife < 40) - bMoraleCategory--; + { + // if getting a bit low on life + if (pSoldier->stats.bLife < 40) + bMoraleCategory--; - // if getting REALLY low on life - if (pSoldier->bLife < 20) - bMoraleCategory--; - } + // if getting REALLY low on life + if (pSoldier->stats.bLife < 20) + bMoraleCategory--; + } // if soldier is currently not under fire - if (!pSoldier->bUnderFire) - bMoraleCategory++; + if (!pSoldier->aiData.bUnderFire) + bMoraleCategory++; // if adjustments made it outside the allowed limits if (bMoraleCategory < MORALE_HOPELESS) - bMoraleCategory = MORALE_HOPELESS; + bMoraleCategory = MORALE_HOPELESS; else - { - if (bMoraleCategory > MORALE_FEARLESS) - bMoraleCategory = MORALE_FEARLESS; - } + { + if (bMoraleCategory > MORALE_FEARLESS) + bMoraleCategory = MORALE_FEARLESS; + } // if only 1/4 of side left, reduce morale // and do this after we've capped all those other silly values @@ -2092,21 +2092,21 @@ INT8 CalcMorale(SOLDIERTYPE *pSoldier) if ( pSoldier->bTeam == ENEMY_TEAM && gTacticalStatus.Team[ ENEMY_TEAM ].bMenInSector <= gTacticalStatus.bOriginalSizeOfEnemyForce / 4 ) { bMoraleCategory -= 2; - if (bMoraleCategory < MORALE_HOPELESS) - bMoraleCategory = MORALE_HOPELESS; + if (bMoraleCategory < MORALE_HOPELESS) + bMoraleCategory = MORALE_HOPELESS; } */ // brave guys never get hopeless, at worst they get worried if (bMoraleCategory == MORALE_HOPELESS && - (pSoldier->bAttitude == BRAVESOLO || pSoldier->bAttitude == BRAVEAID)) - bMoraleCategory = MORALE_WORRIED; + (pSoldier->aiData.bAttitude == BRAVESOLO || pSoldier->aiData.bAttitude == BRAVEAID)) + bMoraleCategory = MORALE_WORRIED; #ifdef DEBUGDECISIONS STR tempstr; sprintf( tempstr, "Morale = %d (category %d)\n", - pSoldier->bMorale,bMoraleCategory); + pSoldier->aiData.bMorale,bMoraleCategory); DebugAI (tempstr); #endif @@ -2119,7 +2119,7 @@ INT32 CalcManThreatValue( SOLDIERTYPE *pEnemy, INT16 sMyGrid, UINT8 ubReduceForC BOOLEAN fForCreature = CREATURE_OR_BLOODCAT( pMe ); // If man is inactive, at base, on assignment, dead, unconscious - if (!pEnemy->bActive || !pEnemy->bInSector || !pEnemy->bLife) + if (!pEnemy->bActive || !pEnemy->bInSector || !pEnemy->stats.bLife) { // he's no threat at all, return a negative number iThreatValue = -999; @@ -2127,7 +2127,7 @@ INT32 CalcManThreatValue( SOLDIERTYPE *pEnemy, INT16 sMyGrid, UINT8 ubReduceForC } // in boxing mode, let only a boxer be considered a threat. - if ( (gTacticalStatus.bBoxingState == BOXING) && !(pEnemy->uiStatusFlags & SOLDIER_BOXER) ) + if ( (gTacticalStatus.bBoxingState == BOXING) && !(pEnemy->flags.uiStatusFlags & SOLDIER_BOXER) ) { iThreatValue = -999; return( iThreatValue ); @@ -2136,7 +2136,7 @@ INT32 CalcManThreatValue( SOLDIERTYPE *pEnemy, INT16 sMyGrid, UINT8 ubReduceForC if (fForCreature) { // health (1-100) - iThreatValue += pEnemy->bLife; + iThreatValue += pEnemy->stats.bLife; // bleeding (more attactive!) (1-100) iThreatValue += pEnemy->bBleeding; // decrease according to distance @@ -2146,16 +2146,16 @@ INT32 CalcManThreatValue( SOLDIERTYPE *pEnemy, INT16 sMyGrid, UINT8 ubReduceForC else { // ADD twice the man's level (2-20) - iThreatValue += pEnemy->bExpLevel; + iThreatValue += pEnemy->stats.bExpLevel; // ADD man's total action points (10-35) - iThreatValue += CalcActionPoints(pEnemy); + iThreatValue += pEnemy->CalcActionPoints(); // ADD 1/2 of man's current action points (4-17) iThreatValue += (pEnemy->bActionPoints / 2); // ADD 1/10 of man's current health (0-10) - iThreatValue += (pEnemy->bLife / 10); + iThreatValue += (pEnemy->stats.bLife / 10); if (pEnemy->bAssignment < ON_DUTY ) { @@ -2163,7 +2163,7 @@ INT32 CalcManThreatValue( SOLDIERTYPE *pEnemy, INT16 sMyGrid, UINT8 ubReduceForC iThreatValue += ArmourPercent( pEnemy ) / 4; // ADD 1/5 of man's marksmanship skill (0-20) - iThreatValue += (pEnemy->bMarksmanship / 5); + iThreatValue += (pEnemy->stats.bMarksmanship / 5); if ( Item[ pEnemy->inv[HANDPOS].usItem ].usItemClass & IC_WEAPON ) { @@ -2179,7 +2179,7 @@ INT32 CalcManThreatValue( SOLDIERTYPE *pEnemy, INT16 sMyGrid, UINT8 ubReduceForC iThreatValue -= ((100 - pEnemy->bBreath) / 10); // SUBTRACT man's current shock value - iThreatValue -= pEnemy->bShock; + iThreatValue -= pEnemy->aiData.bShock; } // if I have a specifically defined spot where I'm at (sometime I don't!) @@ -2201,7 +2201,7 @@ INT32 CalcManThreatValue( SOLDIERTYPE *pEnemy, INT16 sMyGrid, UINT8 ubReduceForC } // if this man is conscious - if (pEnemy->bLife >= OKLIFE) + if (pEnemy->stats.bLife >= OKLIFE) { // and we were told to reduce threat for my cover if (ubReduceForCover && (sMyGrid != NOWHERE)) @@ -2209,7 +2209,7 @@ INT32 CalcManThreatValue( SOLDIERTYPE *pEnemy, INT16 sMyGrid, UINT8 ubReduceForC // Reduce iThreatValue to same % as the chance HE has shoot through at ME //iThreatValue = (iThreatValue * ChanceToGetThrough( pEnemy, myGrid, FAKE, ACTUAL, TESTWALLS, 9999, M9PISTOL, NOT_FOR_LOS)) / 100; //iThreatValue = (iThreatValue * SoldierTo3DLocationChanceToGetThrough( pEnemy, myGrid, FAKE, ACTUAL, TESTWALLS, 9999, M9PISTOL, NOT_FOR_LOS)) / 100; - iThreatValue = (iThreatValue * SoldierToLocationChanceToGetThrough( pEnemy, sMyGrid, pMe->bLevel, 0, pMe->ubID ) ) / 100; + iThreatValue = (iThreatValue * SoldierToLocationChanceToGetThrough( pEnemy, sMyGrid, pMe->pathing.bLevel, 0, pMe->ubID ) ) / 100; } } else @@ -2218,7 +2218,7 @@ INT32 CalcManThreatValue( SOLDIERTYPE *pEnemy, INT16 sMyGrid, UINT8 ubReduceForC if (iThreatValue > 0) { // drastically reduce his threat value (divide by 5 to 18) - iThreatValue /= (4 + (OKLIFE - pEnemy->bLife)); + iThreatValue /= (4 + (OKLIFE - pEnemy->stats.bLife)); } } @@ -2255,28 +2255,28 @@ INT16 RoamingRange(SOLDIERTYPE *pSoldier, INT16 * pusFromGridNo) { if ( CREATURE_OR_BLOODCAT( pSoldier ) ) { - if ( pSoldier->bAlertStatus == STATUS_BLACK ) + if ( pSoldier->aiData.bAlertStatus == STATUS_BLACK ) { *pusFromGridNo = pSoldier->sGridNo; // from current position! return(MAX_ROAMING_RANGE); } } - if ( pSoldier->bOrders == POINTPATROL || pSoldier->bOrders == RNDPTPATROL ) + if ( pSoldier->aiData.bOrders == POINTPATROL || pSoldier->aiData.bOrders == RNDPTPATROL ) { // roam near NEXT PATROL POINT, not from where merc starts out - *pusFromGridNo = pSoldier->usPatrolGrid[pSoldier->bNextPatrolPnt]; + *pusFromGridNo = pSoldier->aiData.sPatrolGrid[pSoldier->aiData.bNextPatrolPnt]; } else { // roam around where mercs started //*pusFromGridNo = pSoldier->sInitialGridNo; - *pusFromGridNo = pSoldier->usPatrolGrid[0]; + *pusFromGridNo = pSoldier->aiData.sPatrolGrid[0]; } - switch (pSoldier->bOrders) + switch (pSoldier->aiData.bOrders) { // JA2 GOLD: give non-NPCs a 5 tile roam range for cover in combat when being shot at - case STATIONARY: if (pSoldier->ubProfile != NO_PROFILE || (pSoldier->bAlertStatus < STATUS_BLACK && !(pSoldier->bUnderFire))) + case STATIONARY: if (pSoldier->ubProfile != NO_PROFILE || (pSoldier->aiData.bAlertStatus < STATUS_BLACK && !(pSoldier->aiData.bUnderFire))) { return( 0 ); } @@ -2287,8 +2287,8 @@ INT16 RoamingRange(SOLDIERTYPE *pSoldier, INT16 * pusFromGridNo) case ONGUARD: return( 5 ); case CLOSEPATROL: return( 15 ); case RNDPTPATROL: - case POINTPATROL: return(10 ); // from nextPatrolGrid, not whereIWas - case FARPATROL: if (pSoldier->bAlertStatus < STATUS_RED) + case POINTPATROL: return(10 ); // from nextPatrolGrid, not whereIWas + case FARPATROL: if (pSoldier->aiData.bAlertStatus < STATUS_RED) { return( 25 ); } @@ -2296,20 +2296,20 @@ INT16 RoamingRange(SOLDIERTYPE *pSoldier, INT16 * pusFromGridNo) { return( 50 ); } - case ONCALL: if (pSoldier->bAlertStatus < STATUS_RED) + case ONCALL: if (pSoldier->aiData.bAlertStatus < STATUS_RED) { return( 10 ); } else { return( 30 ); - } + } case SEEKENEMY: *pusFromGridNo = pSoldier->sGridNo; // from current position! return(MAX_ROAMING_RANGE); case SNIPER: return ( 5 ); default: #ifdef BETAVERSION - sprintf(tempstr,"%s has invalid orders = %d",pSoldier->name,pSoldier->bOrders); + sprintf(tempstr,"%s has invalid orders = %d",pSoldier->name,pSoldier->aiData.bOrders); PopMessage(tempstr); #endif return(0); @@ -2333,28 +2333,28 @@ BOOLEAN FindBetterSpotForItem( SOLDIERTYPE * pSoldier, INT8 bSlot ) { // looks for a place in the slots to put an item in a hand or armour // position, and moves it there. - if (bSlot >= BIGPOCK1POS) + if (bSlot >= BIGPOCKSTART) { return( FALSE ); } - if (pSoldier->inv[bSlot].usItem == NOTHING) + if (pSoldier->inv[bSlot].exists() == false) { // well that's just fine then! return( TRUE ); } - if (Item[pSoldier->inv[bSlot].usItem].ubPerPocket == 0) + if(FitsInSmallPocket(&pSoldier->inv[bSlot]) == false) { // then we're looking for a big pocket - bSlot = FindEmptySlotWithin( pSoldier, BIGPOCK1POS, BIGPOCK4POS ); + bSlot = FindEmptySlotWithin( pSoldier, BIGPOCKSTART, MEDPOCKFINAL ); } else { // try a small pocket first - bSlot = FindEmptySlotWithin( pSoldier, SMALLPOCK1POS, SMALLPOCK8POS ); + bSlot = FindEmptySlotWithin( pSoldier, SMALLPOCKSTART, NUM_INV_SLOTS ); if (bSlot == NO_SLOT) { - bSlot = FindEmptySlotWithin( pSoldier, BIGPOCK1POS, BIGPOCK4POS ); + bSlot = FindEmptySlotWithin( pSoldier, BIGPOCKSTART, MEDPOCKFINAL ); } } if (bSlot == NO_SLOT) @@ -2427,12 +2427,12 @@ UINT8 SoldierDifficultyLevel( SOLDIERTYPE * pSoldier ) default: if (pSoldier->bTeam == CREATURE_TEAM) - { - bDifficulty = bDifficultyBase + pSoldier->bLevel / 4; + { + bDifficulty = bDifficultyBase + pSoldier->pathing.bLevel / 4; } else // civ... { - bDifficulty = (bDifficultyBase + pSoldier->bLevel / 4) - 1; + bDifficulty = (bDifficultyBase + pSoldier->pathing.bLevel / 4) - 1; } break; @@ -2456,7 +2456,7 @@ BOOLEAN ValidCreatureTurn( SOLDIERTYPE * pCreature, INT8 bNewDirection ) for( bLoop = 0; bLoop < 2; bLoop++ ) { fFound = TRUE; - + bTempDir = pCreature->ubDirection; do @@ -2471,7 +2471,7 @@ BOOLEAN ValidCreatureTurn( SOLDIERTYPE * pCreature, INT8 bNewDirection ) { bTempDir = NORTH; } - if (!InternalIsValidStance( pCreature, bTempDir, ANIM_STAND )) + if (!pCreature->InternalIsValidStance( bTempDir, ANIM_STAND )) { fFound = FALSE; break; @@ -2502,16 +2502,16 @@ INT32 RangeChangeDesire( SOLDIERTYPE * pSoldier ) { INT32 iRangeFactorMultiplier; - iRangeFactorMultiplier = pSoldier->bAIMorale - 1; - switch (pSoldier->bAttitude) + iRangeFactorMultiplier = pSoldier->aiData.bAIMorale - 1; + switch (pSoldier->aiData.bAttitude) { case DEFENSIVE: iRangeFactorMultiplier += -1; break; - case BRAVESOLO: iRangeFactorMultiplier += 2; break; - case BRAVEAID: iRangeFactorMultiplier += 2; break; - case CUNNINGSOLO: iRangeFactorMultiplier += 0; break; - case CUNNINGAID: iRangeFactorMultiplier += 0; break; + case BRAVESOLO: iRangeFactorMultiplier += 2; break; + case BRAVEAID: iRangeFactorMultiplier += 2; break; + case CUNNINGSOLO: iRangeFactorMultiplier += 0; break; + case CUNNINGAID: iRangeFactorMultiplier += 0; break; case ATTACKSLAYONLY: - case AGGRESSIVE: iRangeFactorMultiplier += 1; break; + case AGGRESSIVE: iRangeFactorMultiplier += 1; break; } if ( gTacticalStatus.bConsNumTurnsWeHaventSeenButEnemyDoes > 0 ) { @@ -2529,7 +2529,7 @@ BOOLEAN ArmySeesOpponents( void ) { pSoldier = MercPtrs[ cnt ]; - if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife >= OKLIFE && pSoldier->bOppCnt > 0 ) + if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE && pSoldier->aiData.bOppCnt > 0 ) { return( TRUE ); } @@ -2544,21 +2544,21 @@ void AIPopMessage ( STR16 str ) DebugAI(str); } -void AIPopMessage ( const STR8 str ) +void AIPopMessage ( const STR8 str ) { STR tempstr; sprintf( tempstr,"%s", str); DebugAI(tempstr); } -void AINumMessage(const STR8 str, INT32 num) +void AINumMessage(const STR8 str, INT32 num) { STR tempstr; sprintf( tempstr,"%s %d", str, num); DebugAI(tempstr); } -void AINameMessage(SOLDIERTYPE * pSoldier,const STR8 str,INT32 num) +void AINameMessage(SOLDIERTYPE * pSoldier,const STR8 str,INT32 num) { STR tempstr; sprintf( tempstr,"%d %s %d",pSoldier->name , str, num); diff --git a/TacticalAI/Attacks.cpp b/TacticalAI/Attacks.cpp index 1f86b176..71ede088 100644 --- a/TacticalAI/Attacks.cpp +++ b/TacticalAI/Attacks.cpp @@ -58,7 +58,7 @@ void LoadWeaponIfNeeded(SOLDIERTYPE *pSoldier) if (bPayloadPocket == NO_SLOT) { #ifdef BETAVERSION - NumMessage("LoadWeaponIfNeeded: ERROR - no mortar shells found to load MORTAR! Guynum",pSoldier->ubID); + NumMessage("LoadWeaponIfNeeded: ERROR - no mortar shells found to load MORTAR! Guynum",pSoldier->ubID); #endif return; // no shells, can't fire the MORTAR } @@ -67,10 +67,10 @@ void LoadWeaponIfNeeded(SOLDIERTYPE *pSoldier) else if (Item[usInHand].grenadelauncher ) { bPayloadPocket = FindGLGrenade( pSoldier ); - if (bPayloadPocket == NO_SLOT || FindNonSmokeLaunchableAttachment( &pSoldier->inv[HANDPOS],usInHand ) != ITEM_NOT_FOUND ) + if (bPayloadPocket == NO_SLOT || FindNonSmokeLaunchableAttachment( &pSoldier->inv[HANDPOS],usInHand ) != 0 ) { #ifdef BETAVERSION - NumMessage("LoadWeaponIfNeeded: ERROR - no grenades found to load GLAUNCHER! Guynum",pSoldier->ubID); + NumMessage("LoadWeaponIfNeeded: ERROR - no grenades found to load GLAUNCHER! Guynum",pSoldier->ubID); #endif return; // no grenades, can't fire the GLAUNCHER... or the launcher has a magsize > 1 } @@ -101,26 +101,17 @@ void LoadWeaponIfNeeded(SOLDIERTYPE *pSoldier) DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("LoadWeaponIfNeeded: remove payload from its pocket, and add it as the hand weapon's first attachment")); // remove payload from its pocket, and add it as the hand weapon's first attachment - OBJECTTYPE Temp; - CreateItem(pSoldier->inv[bPayloadPocket].usItem,pSoldier->inv[bPayloadPocket].ItemData.Generic.bStatus[0],&Temp); - AttachObject ( pSoldier, &pSoldier->inv[HANDPOS],&Temp,FALSE); - - //pSoldier->inv[HANDPOS].usAttachItem[0] = pSoldier->inv[bPayloadPocket].usItem; - //pSoldier->inv[HANDPOS].bAttachStatus[0] = pSoldier->inv[bPayloadPocket].bStatus[0]; - if ( TANK( pSoldier ) ) { // don't remove ammo - return; + gTempObject = pSoldier->inv[bPayloadPocket]; + if (gTempObject.ubNumberOfObjects > 1) { + gTempObject.RemoveObjectsFromStack(gTempObject.ubNumberOfObjects - 1); + } + pSoldier->inv[HANDPOS].AttachObject(pSoldier,&gTempObject,FALSE); } - // if there's only one in payload pocket (only/last grenade, or any shell) - if ((Item[ pSoldier->inv[bPayloadPocket].usItem ].ubPerPocket == 1) || (pSoldier->inv[bPayloadPocket].ubNumberOfObjects == 1)) - { - DeleteObj(&(pSoldier->inv[bPayloadPocket])); - } - else // multiple grenades, remove one of them - { - pSoldier->inv[bPayloadPocket].ubNumberOfObjects--; + else if (pSoldier->inv[bPayloadPocket].MoveThisObjectTo(gTempObject, 1) == 0) { + pSoldier->inv[HANDPOS].AttachObject( pSoldier,&gTempObject,FALSE); } } @@ -143,12 +134,12 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns pSoldier->usAttackingWeapon = pSoldier->inv[HANDPOS].usItem; pSoldier->bWeaponMode = WM_NORMAL; - ubBurstAPs = CalcAPsToBurst( CalcActionPoints( pSoldier ), &(pSoldier->inv[HANDPOS]) ); + ubBurstAPs = CalcAPsToBurst( pSoldier->CalcActionPoints( ), &(pSoldier->inv[HANDPOS]) ); - InitAttackType(pBestShot); // set all structure fields to defaults + InitAttackType(pBestShot); // set all structure fields to defaults // hang a pointer into active soldier's personal opponent list - //pbPersOL = &(pSoldier->bOppList[0]); + //pbPersOL = &(pSoldier->aiData.bOppList[0]); // determine which attack against which target has the greatest attack value for (uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++) @@ -156,29 +147,29 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns pOpponent = MercSlots[ uiLoop ]; // if this merc is inactive, at base, on assignment, or dead - if (!pOpponent || !pOpponent->bLife) - continue; // next merc + if (!pOpponent || !pOpponent->stats.bLife) + continue; // next merc // if this man is neutral / on the same side, he's not an opponent if ( CONSIDERED_NEUTRAL( pSoldier, pOpponent ) || (pSoldier->bSide == pOpponent->bSide)) - continue; // next merc + continue; // next merc // if this opponent is not currently in sight (ignore known but unseen!) - if ((pSoldier->bOppList[pOpponent->ubID] != SEEN_CURRENTLY && !shootUnseen)) //guys we can't see + if ((pSoldier->aiData.bOppList[pOpponent->ubID] != SEEN_CURRENTLY && !shootUnseen)) //guys we can't see { - DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("CalcBestShot: soldier = %d, target = %d, skip guys we can't see, shootUnseen = %d, personal opplist = %d",pSoldier->ubID, pOpponent->ubID, shootUnseen, pSoldier->bOppList[pOpponent->ubID])); - continue; // next opponent + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("CalcBestShot: soldier = %d, target = %d, skip guys we can't see, shootUnseen = %d, personal opplist = %d",pSoldier->ubID, pOpponent->ubID, shootUnseen, pSoldier->aiData.bOppList[pOpponent->ubID])); + continue; // next opponent } - if ((pSoldier->bOppList[pOpponent->ubID] != SEEN_CURRENTLY && gbPublicOpplist[pSoldier->bTeam][pOpponent->ubID] != SEEN_CURRENTLY)) // guys nobody sees + if ((pSoldier->aiData.bOppList[pOpponent->ubID] != SEEN_CURRENTLY && gbPublicOpplist[pSoldier->bTeam][pOpponent->ubID] != SEEN_CURRENTLY)) // guys nobody sees { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("CalcBestShot: soldier = %d, target = %d, skip guys nobody sees, shootUnseen = %d, public opplist = %d",pSoldier->ubID, pOpponent->ubID, shootUnseen,gbPublicOpplist[pSoldier->bTeam][pOpponent->ubID])); - continue; // next opponent + continue; // next opponent } // Special stuff for Carmen the bounty hunter - if (pSoldier->bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != SLAY) - continue; // next opponent + if (pSoldier->aiData.bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != SLAY) + continue; // next opponent #ifdef DEBUGATTACKS DebugAI( String( "%s sees %s at gridno %d\n",pSoldier->name,ExtMen[pOpponent->ubID].name,pOpponent->sGridNo ) ); @@ -187,15 +178,15 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns // calculate minimum action points required to shoot at this opponent // if ( !Weapon[pSoldier->usAttackingWeapon].NoSemiAuto ) ubMinAPcost = MinAPsToAttack(pSoldier,pOpponent->sGridNo,ADDTURNCOST); - // What the.... The APs to attack on the HandleItem side does not make a test like this. It always uses the MinAPs as a base. + // What the.... The APs to attack on the HandleItem side does not make a test like this. It always uses the MinAPs as a base. // else - // ubMinAPcost = CalcAPsToAutofire( CalcActionPoints( pSoldier ), &(pSoldier->inv[HANDPOS]), 3 ); + // ubMinAPcost = CalcAPsToAutofire( pSoldier->CalcActionPoints( ), &(pSoldier->inv[HANDPOS]), 3 ); //NumMessage("MinAPcost to shoot this opponent = ",ubMinAPcost); // if we don't have enough APs left to shoot even a snap-shot at this guy if (ubMinAPcost > pSoldier->bActionPoints) - continue; // next opponent + continue; // next opponent //KeepInterfaceGoing(); @@ -203,21 +194,21 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns ubChanceToGetThrough = AISoldierToSoldierChanceToGetThrough( pSoldier, pOpponent ); - // ubChanceToGetThrough = ChanceToGetThrough(pSoldier,pOpponent->sGridNo,NOTFAKE,ACTUAL,TESTWALLS,9999,M9PISTOL,NOT_FOR_LOS); + // ubChanceToGetThrough = ChanceToGetThrough(pSoldier,pOpponent->sGridNo,NOTFAKE,ACTUAL,TESTWALLS,9999,M9PISTOL,NOT_FOR_LOS); //NumMessage("Chance to get through = ",ubChanceToGetThrough); // if we can't possibly get through all the cover if (ubChanceToGetThrough == 0) - continue; // next opponent + continue; // next opponent - if ( (pSoldier->uiStatusFlags & SOLDIER_MONSTER) && (pSoldier->ubBodyType != QUEENMONSTER ) ) + if ( (pSoldier->flags.uiStatusFlags & SOLDIER_MONSTER) && (pSoldier->ubBodyType != QUEENMONSTER ) ) { STRUCTURE_FILE_REF * pStructureFileRef; UINT16 usAnimSurface; usAnimSurface = DetermineSoldierAnimationSurface( pSoldier, pSoldier->usUIMovementMode ); - pStructureFileRef = GetAnimationStructureRef( pSoldier->ubID, usAnimSurface,pSoldier->usUIMovementMode ); + pStructureFileRef = GetAnimationStructureRef( pSoldier->ubID, usAnimSurface,pSoldier->usUIMovementMode ); if ( pStructureFileRef ) { @@ -237,7 +228,7 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns usStructureID = INVALID_STRUCTURE_ID; } - if ( ! OkayToAddStructureToWorld( pSoldier->sGridNo, pSoldier->bLevel, &(pStructureFileRef->pDBStructureRef[ gOneCDirection[ bDir ] ]), usStructureID ) ) + if ( ! OkayToAddStructureToWorld( pSoldier->sGridNo, pSoldier->pathing.bLevel, &(pStructureFileRef->pDBStructureRef[ gOneCDirection[ bDir ] ]), usStructureID ) ) { // can't turn in that dir.... next opponent continue; @@ -255,7 +246,7 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns //ubRawAPCost -= AP_CHANGE_TARGET; } - iBestHitRate = 0; // reset best hit rate to minimum + iBestHitRate = 0; // reset best hit rate to minimum // calculate the maximum possible aiming time @@ -320,14 +311,14 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns // if we can't get any kind of hit rate at all if (iBestHitRate == 0) - continue; // next opponent + continue; // next opponent // calculate chance to REALLY hit: shoot accurately AND get past cover ubChanceToReallyHit = (ubBestChanceToHit * ubChanceToGetThrough) / 100; // if we can't REALLY hit at all if (ubChanceToReallyHit == 0) - continue; // next opponent + continue; // next opponent // really limit knife throwing so it doesn't look wrong if ( Item[ pSoldier->usAttackingWeapon ].usItemClass == IC_THROWING_KNIFE && (ubChanceToReallyHit < 30 || ( PythSpacesAway( pSoldier->sGridNo, pOpponent->sGridNo ) > CalcMaxTossRange( pSoldier, pSoldier->usAttackingWeapon, FALSE ) )))// Madd / 2 ) ) ) @@ -368,7 +359,7 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns // if this chance to really hit is more than 50% worse, and the other // guy is conscious at all - if ((iPercentBetter < -PERCENT_TO_IGNORE_THREAT) && (Menptr[pBestShot->ubOpponent].bLife >= OKLIFE)) + if ((iPercentBetter < -PERCENT_TO_IGNORE_THREAT) && (Menptr[pBestShot->ubOpponent].stats.bLife >= OKLIFE)) // then stick with the older guy as the better target continue; @@ -378,19 +369,19 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns // then the one with the higher ATTACK VALUE is the better target if (iAttackValue < pBestShot->iAttackValue) // the previous guy is more important since he's more dangerous - continue; // next opponent + continue; // next opponent } } - // OOOF! That was a lot of work! But we've got a new best target! - pBestShot->ubPossible = TRUE; - pBestShot->ubOpponent = pOpponent->ubID; - pBestShot->ubAimTime = ubBestAimTime; + // OOOF! That was a lot of work! But we've got a new best target! + pBestShot->ubPossible = TRUE; + pBestShot->ubOpponent = pOpponent->ubID; + pBestShot->ubAimTime = ubBestAimTime; pBestShot->ubChanceToReallyHit = ubChanceToReallyHit; - pBestShot->sTarget = pOpponent->sGridNo; - pBestShot->bTargetLevel = pOpponent->bLevel; - pBestShot->iAttackValue = iAttackValue; - pBestShot->ubAPCost = ubMinAPcost; + pBestShot->sTarget = pOpponent->sGridNo; + pBestShot->bTargetLevel = pOpponent->pathing.bLevel; + pBestShot->iAttackValue = iAttackValue; + pBestShot->ubAPCost = ubMinAPcost; } } } @@ -439,7 +430,7 @@ BOOLEAN CloseEnoughForGrenadeToss( INT16 sGridNo, INT16 sGridNo2 ) sYPos2 = CenterY( sGridNo2 ); ubDirection = atan8( sXPos, sYPos, sXPos2, sYPos2 ); - // For each step of the loop, we are checking for door or obstacle movement costs. If we + // For each step of the loop, we are checking for door or obstacle movement costs. If we // find we're blocked, then this is no good for grenade tossing! do { @@ -480,7 +471,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) UINT8 ubOppsInRange, ubOppsAdjacent; BOOLEAN fSkipLocation; INT8 bPayloadPocket; - INT8 bMaxLeft,bMaxRight,bMaxUp,bMaxDown,bXOffset,bYOffset; + INT8 bMaxLeft,bMaxRight,bMaxUp,bMaxDown,bXOffset,bYOffset; INT8 bPersOL, bPublOL; SOLDIERTYPE *pOpponent, *pFriend; static INT16 sExcludeTile[100]; // This array is for storing tiles that we have @@ -596,7 +587,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) continue; // next soldier } - if (pFriend->bLife == 0) + if (pFriend->stats.bLife == 0) { continue; } @@ -604,19 +595,19 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) /* // if this soldier is inactive, at base, on assignment, or dead if (!Menptr[ubLoop].bActive || !Menptr[ubLoop].bInSector || !Menptr[ubLoop].bLife) - continue; // next soldier + continue; // next soldier */ // if this man is neutral / NOT on the same side, he's not a friend - if (pFriend->bNeutral || (pSoldier->bSide != pFriend->bSide)) + if (pFriend->aiData.bNeutral || (pSoldier->bSide != pFriend->bSide)) { - continue; // next soldier + continue; // next soldier } // active friend, remember where he is so that we DON'T blow him up! // this includes US, since we don't want to blow OURSELVES up either sFriendTile[ubFriendCnt] = pFriend->sGridNo; - bFriendLevel[ubFriendCnt] = pFriend->bLevel; + bFriendLevel[ubFriendCnt] = pFriend->pathing.bLevel; ubFriendCnt++; } @@ -630,34 +621,34 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) if (!pOpponent) { // inactive or not in sector - continue; // next soldier + continue; // next soldier } - if (!pOpponent->bLife) + if (!pOpponent->stats.bLife) { - continue; // next soldier + continue; // next soldier } /* // if this soldier is inactive, at base, on assignment, or dead - if (!pOpponent->bActive || !pOpponent->bInSector || !pOpponent->bLife) - continue; // next soldier + if (!pOpponent->bActive || !pOpponent->bInSector || !pOpponent->stats.bLife) + continue; // next soldier */ // if this man is neutral / on the same side, he's not an opponent if ( CONSIDERED_NEUTRAL( pSoldier, pOpponent ) || (pSoldier->bSide == pOpponent->bSide)) { - continue; // next soldier + continue; // next soldier } // Special stuff for Carmen the bounty hunter - if (pSoldier->bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != 64) + if (pSoldier->aiData.bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != 64) { - continue; // next opponent + continue; // next opponent } - bPersOL = pSoldier->bOppList[pOpponent->ubID]; + bPersOL = pSoldier->aiData.bOppList[pOpponent->ubID]; if ((Item[usInHand].mortar ) || (Item[usInHand].grenadelauncher ) ) { @@ -665,25 +656,25 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // allow long range firing, where target doesn't PERSONALLY see opponent if ((bPersOL != SEEN_CURRENTLY) && (bPublOL != SEEN_CURRENTLY)) { - continue; // next soldier + continue; // next soldier } // active KNOWN opponent, remember where he is so that we DO blow him up! sOpponentTile[ubOpponentCnt] = pOpponent->sGridNo; - bOpponentLevel[ubOpponentCnt] = pOpponent->bLevel; + bOpponentLevel[ubOpponentCnt] = pOpponent->pathing.bLevel; } else { /* - if (bPersOL != SEEN_CURRENTLY && bPersOL != SEEN_LAST_TURN) // if not in sight right now + if (bPersOL != SEEN_CURRENTLY && bPersOL != SEEN_LAST_TURN) // if not in sight right now { - continue; // next soldier + continue; // next soldier } */ if (bPersOL == SEEN_CURRENTLY) { // active KNOWN opponent, remember where he is so that we DO blow him up! sOpponentTile[ubOpponentCnt] = pOpponent->sGridNo; - bOpponentLevel[ubOpponentCnt] = pOpponent->bLevel; + bOpponentLevel[ubOpponentCnt] = pOpponent->pathing.bLevel; } else if (bPersOL == SEEN_LAST_TURN) { @@ -739,7 +730,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) { continue; } - if ( !Item[usGrenade].flare && !pSoldier->bUnderFire && pSoldier->bShock == 0 ) + if ( !Item[usGrenade].flare && !pSoldier->aiData.bUnderFire && pSoldier->aiData.bShock == 0 ) { continue; } @@ -774,14 +765,14 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) case 0: case 1: // they won't use them until they have 2+ opponents as long as half life left - if ((ubOpponentCnt < 2) && (pSoldier->bLife > (pSoldier->bLifeMax / 2))) + if ((ubOpponentCnt < 2) && (pSoldier->stats.bLife > (pSoldier->stats.bLifeMax / 2))) { return; } break; case 2: // they won't use them until they have 2+ opponents as long as 3/4 life left - if ((ubOpponentCnt < 2) && (pSoldier->bLife > (pSoldier->bLifeMax / 4) * 3 )) + if ((ubOpponentCnt < 2) && (pSoldier->stats.bLife > (pSoldier->stats.bLifeMax / 4) * 3 )) { return; } @@ -793,7 +784,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) } DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"calcbestthrow: about to initattacktype"); - InitAttackType(pBestThrow); // set all structure fields to defaults + InitAttackType(pBestThrow); // set all structure fields to defaults // look at the squares near each known opponent and try to find the one // place where a tossed projectile would do the most harm to the opponents @@ -806,7 +797,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) ubSearchRange = MAX_TOSS_SEARCH_DIST; // determine maximum horizontal limits - //bMaxLeft = min(ubSearchRange,(sOpponentTile[ubLoop] % MAXCOL)); + //bMaxLeft = min(ubSearchRange,(sOpponentTile[ubLoop] % MAXCOL)); bMaxLeft = ubSearchRange; //NumMessage("bMaxLeft = ",bMaxLeft); //bMaxRight = min(ubSearchRange,MAXCOL - ((sOpponentTile[ubLoop] % MAXCOL) + 1)); @@ -814,7 +805,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) //NumMessage("bMaxRight = ",bMaxRight); // determine maximum vertical limits - bMaxUp = ubSearchRange; + bMaxUp = ubSearchRange; //NumMessage("bMaxUp = ",bMaxUp); bMaxDown = ubSearchRange; //NumMessage("bMaxDown = ",bMaxDown); @@ -910,7 +901,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // if we don't have enough APs left to throw even without aiming DebugMsg(TOPIC_JA2 , DBG_LEVEL_3 , String("Soldier's action points = %d",pSoldier->bActionPoints )); if (ubMinAPcost > pSoldier->bActionPoints) - continue; // next gridno + continue; // next gridno // check whether there are any friends standing near this gridno fFriendsNearby = FALSE; @@ -921,12 +912,12 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) { //NumMessage("Friend too close: at gridno",sFriendTile[ubLoop2]); fFriendsNearby = TRUE; - break; // don't bother checking any other friends + break; // don't bother checking any other friends } } if (fFriendsNearby) - continue; // this location is no good, move along now + continue; // this location is no good, move along now // Well this place shows some promise, evaluate its "damage potential" iTotalThreatValue = 0; @@ -968,7 +959,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) iTotalThreatValue += (iThreatValue * iEstDamage); // only count opponents still standing worth shooting at (in range) - if (Menptr[ ubOpponentID[ubLoop2] ].bLife >= OKLIFE) + if (Menptr[ ubOpponentID[ubLoop2] ].stats.bLife >= OKLIFE) { ubOppsInRange++; if (usOppDist < 2) @@ -1060,9 +1051,9 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // this is try to minimize enemies wasting their (few) mortar shells or LAWs // they won't use them on less than 2 targets as long as half life left if ((Item[usInHand].mortar || Item[usInHand].rocketlauncher ) && (ubOppsInRange < 2) && - (pSoldier->bLife > (pSoldier->bLifeMax / 2))) + (pSoldier->stats.bLife > (pSoldier->stats.bLifeMax / 2))) { - continue; // next gridno + continue; // next gridno } // calculate the maximum possible aiming time @@ -1117,7 +1108,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // if we can't REALLY hit at all if (ubChanceToReallyHit == 0) - continue; // next gridno + continue; // next gridno // calculate the combined "attack value" for this opponent // maximum possible attack value here should be about 140 million @@ -1133,14 +1124,14 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) DebugAI( String( "CalcBestThrow: new best attackValue vs %d = %d\n",ubOpponentID[ubLoop],iAttackValue ) ); #endif - // OOOF! That was a lot of work! But we've got a new best target! - pBestThrow->ubPossible = TRUE; - pBestThrow->ubOpponent = ubOpponentID[ubLoop]; - pBestThrow->ubAimTime = ubMaxPossibleAimTime; + // OOOF! That was a lot of work! But we've got a new best target! + pBestThrow->ubPossible = TRUE; + pBestThrow->ubOpponent = ubOpponentID[ubLoop]; + pBestThrow->ubAimTime = ubMaxPossibleAimTime; pBestThrow->ubChanceToReallyHit = ubChanceToReallyHit; - pBestThrow->sTarget = sGridNo; - pBestThrow->iAttackValue = iAttackValue; - pBestThrow->ubAPCost = ubMinAPcost + ubMaxPossibleAimTime; + pBestThrow->sTarget = sGridNo; + pBestThrow->iAttackValue = iAttackValue; + pBestThrow->ubAPCost = ubMinAPcost + ubMaxPossibleAimTime; pBestThrow->bTargetLevel = bOpponentLevel[ubLoop]; //sprintf(tempstr,"new best THROW AttackValue = %d at grid #%d",iAttackValue/100000,gridno); @@ -1188,7 +1179,7 @@ void CalcBestStab(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab, BOOLEAN fBladeAt SOLDIERTYPE *pOpponent; UINT16 usTrueMovementMode; - InitAttackType(pBestStab); // set all structure fields to defaults + InitAttackType(pBestStab); // set all structure fields to defaults pSoldier->usAttackingWeapon = pSoldier->inv[HANDPOS].usItem; @@ -1204,24 +1195,24 @@ void CalcBestStab(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab, BOOLEAN fBladeAt pOpponent = MercSlots[ uiLoop ]; // if this merc is inactive, at base, on assignment, or dead - if (!pOpponent || !pOpponent->bLife) - continue; // next merc + if (!pOpponent || !pOpponent->stats.bLife) + continue; // next merc // if this man is neutral / on the same side, he's not an opponent if ( CONSIDERED_NEUTRAL( pSoldier, pOpponent ) || (pSoldier->bSide == pOpponent->bSide) ) - continue; // next merc + continue; // next merc // if this opponent is not currently in sight (ignore known but unseen!) - if (pSoldier->bOppList[pOpponent->ubID] != SEEN_CURRENTLY) - continue; // next merc + if (pSoldier->aiData.bOppList[pOpponent->ubID] != SEEN_CURRENTLY) + continue; // next merc // if this opponent is not on the same level - if (pSoldier->bLevel != pOpponent->bLevel) - continue; // next merc + if (pSoldier->pathing.bLevel != pOpponent->pathing.bLevel) + continue; // next merc // Special stuff for Carmen the bounty hunter - if (pSoldier->bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != 64) - continue; // next opponent + if (pSoldier->aiData.bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != 64) + continue; // next opponent #ifdef DEBUGATTACKS DebugAI( String( "%s can see %s\n",pSoldier->name,ExtMen[pOpponent->ubID].name ) ); @@ -1234,7 +1225,7 @@ void CalcBestStab(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab, BOOLEAN fBladeAt //NumMessage("MinAPcost to stab this opponent = ",ubMinAPCost); // Human: if I don't have enough APs left to get there & stab at this guy, skip 'im. - // Monster: I'll do an extra check later on to see if I can reach the guy this turn. + // Monster: I'll do an extra check later on to see if I can reach the guy this turn. // if 0 is returned then no path! if ( ubMinAPCost > pSoldier->bActionPoints || ubMinAPCost == 0 ) @@ -1249,7 +1240,7 @@ void CalcBestStab(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab, BOOLEAN fBladeAt } else { - continue; // next merc + continue; // next merc } */ } @@ -1263,20 +1254,20 @@ void CalcBestStab(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab, BOOLEAN fBladeAt // determine if this is a surprise stab (must be next to opponent & unseen) - fSurpriseStab = FALSE; // assume it is not a surprise stab + fSurpriseStab = FALSE; // assume it is not a surprise stab // if opponent doesn't see the attacker - if (pOpponent->bOppList[pSoldier->ubID] != SEEN_CURRENTLY) + if (pOpponent->aiData.bOppList[pSoldier->ubID] != SEEN_CURRENTLY) { // and he's only one space away from attacker if (SpacesAway(pSoldier->sGridNo,pOpponent->sGridNo) == 1) { - fSurpriseStab = TRUE; // we got 'im lined up where we want 'im! + fSurpriseStab = TRUE; // we got 'im lined up where we want 'im! } } - iBestHitRate = 0; // reset best hit rate to minimum + iBestHitRate = 0; // reset best hit rate to minimum // calculate the maximum possible aiming time ubMaxPossibleAimTime = min(AllowedAimingLevels(pSoldier),pSoldier->bActionPoints - ubMinAPCost); @@ -1325,13 +1316,13 @@ void CalcBestStab(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab, BOOLEAN fBladeAt // if we can't get any kind of hit rate at all if (iBestHitRate == 0) - continue; // next opponent + continue; // next opponent // stabs are not affected by cover, so the chance to REALLY hit is the same ubChanceToReallyHit = ubBestChanceToHit; // calculate this opponent's threat value - // NOTE: ignore my cover! By the time I run beside him I won't have any! + // NOTE: ignore my cover! By the time I run beside him I won't have any! iThreatValue = CalcManThreatValue(pOpponent,pSoldier->sGridNo,FALSE,pSoldier); @@ -1361,7 +1352,7 @@ void CalcBestStab(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab, BOOLEAN fBladeAt // if this chance to really hit is more than 50% worse, and the other // guy is conscious at all - if ((iPercentBetter < -PERCENT_TO_IGNORE_THREAT) && (Menptr[pBestStab->ubOpponent].bLife >= OKLIFE)) + if ((iPercentBetter < -PERCENT_TO_IGNORE_THREAT) && (Menptr[pBestStab->ubOpponent].stats.bLife >= OKLIFE)) // then stick with the older guy as the better target continue; @@ -1371,19 +1362,19 @@ void CalcBestStab(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab, BOOLEAN fBladeAt // then the one with the higher ATTACK VALUE is the better target if (iAttackValue < pBestStab->iAttackValue) // the previous guy is more important since he's more dangerous - continue; // next opponent + continue; // next opponent } } - // OOOF! That was a lot of work! But we've got a new best target! - pBestStab->ubPossible = TRUE; - pBestStab->ubOpponent = pOpponent->ubID; - pBestStab->ubAimTime = ubBestAimTime; + // OOOF! That was a lot of work! But we've got a new best target! + pBestStab->ubPossible = TRUE; + pBestStab->ubOpponent = pOpponent->ubID; + pBestStab->ubAimTime = ubBestAimTime; pBestStab->ubChanceToReallyHit = ubChanceToReallyHit; - pBestStab->sTarget = pOpponent->sGridNo; - pBestStab->bTargetLevel = pOpponent->bLevel; - pBestStab->iAttackValue = iAttackValue; - pBestStab->ubAPCost = ubMinAPCost + ubBestAimTime; + pBestStab->sTarget = pOpponent->sGridNo; + pBestStab->bTargetLevel = pOpponent->pathing.bLevel; + pBestStab->iAttackValue = iAttackValue; + pBestStab->ubAPCost = ubMinAPCost + ubBestAimTime; } } @@ -1401,7 +1392,7 @@ void CalcTentacleAttack(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab ) SOLDIERTYPE *pOpponent; - InitAttackType(pBestStab); // set all structure fields to defaults + InitAttackType(pBestStab); // set all structure fields to defaults pSoldier->usAttackingWeapon = pSoldier->inv[HANDPOS].usItem; @@ -1412,20 +1403,20 @@ void CalcTentacleAttack(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab ) pOpponent = MercSlots[ uiLoop ]; // if this merc is inactive, at base, on assignment, or dead - if (!pOpponent || !pOpponent->bLife) - continue; // next merc + if (!pOpponent || !pOpponent->stats.bLife) + continue; // next merc // if this man is neutral / on the same side, he's not an opponent if ( CONSIDERED_NEUTRAL( pSoldier, pOpponent ) || (pSoldier->bSide == pOpponent->bSide)) - continue; // next merc + continue; // next merc // if this opponent is not currently in sight (ignore known but unseen!) - if (pSoldier->bOppList[pOpponent->ubID] != SEEN_CURRENTLY) - continue; // next merc + if (pSoldier->aiData.bOppList[pOpponent->ubID] != SEEN_CURRENTLY) + continue; // next merc // if this opponent is not on the same level - if (pSoldier->bLevel != pOpponent->bLevel) - continue; // next merc + if (pSoldier->pathing.bLevel != pOpponent->pathing.bLevel) + continue; // next merc // if this opponent is outside the range of our tentacles if ( GetRangeInCellCoordsFromGridNoDiff( pSoldier->sGridNo, pOpponent->sGridNo ) > Weapon[ CREATURE_QUEEN_TENTACLES].usRange ) @@ -1449,15 +1440,15 @@ void CalcTentacleAttack(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab ) //NumMessage("ubRawAPCost to stab this opponent = ",ubRawAPCost); // determine if this is a surprise stab (for tentacles, enemy must not see us, no dist limit) - fSurpriseStab = FALSE; // assume it is not a surprise stab + fSurpriseStab = FALSE; // assume it is not a surprise stab // if opponent doesn't see the attacker - if (pOpponent->bOppList[pSoldier->ubID] != SEEN_CURRENTLY) + if (pOpponent->aiData.bOppList[pSoldier->ubID] != SEEN_CURRENTLY) { - fSurpriseStab = TRUE; // we got 'im lined up where we want 'im! + fSurpriseStab = TRUE; // we got 'im lined up where we want 'im! } - iBestHitRate = 0; // reset best hit rate to minimum + iBestHitRate = 0; // reset best hit rate to minimum // calculate the maximum possible aiming time @@ -1500,13 +1491,13 @@ void CalcTentacleAttack(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab ) // if we can't get any kind of hit rate at all if (iBestHitRate == 0) - continue; // next opponent + continue; // next opponent // stabs are not affected by cover, so the chance to REALLY hit is the same ubChanceToReallyHit = ubBestChanceToHit; // calculate this opponent's threat value - // NOTE: ignore my cover! By the time I run beside him I won't have any! + // NOTE: ignore my cover! By the time I run beside him I won't have any! iThreatValue = CalcManThreatValue(pOpponent,pSoldier->sGridNo,FALSE,pSoldier); // estimate the damage this stab would do to this opponent @@ -1527,18 +1518,18 @@ void CalcTentacleAttack(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab ) // chance to actually hit him and maybe scare him, knock him down, etc. if (iAttackValue > 0) { - // OOOF! That was a lot of work! But we've got a new best target! - pBestStab->ubPossible = TRUE; - pBestStab->ubOpponent = pOpponent->ubID; - pBestStab->ubAimTime = ubBestAimTime; + // OOOF! That was a lot of work! But we've got a new best target! + pBestStab->ubPossible = TRUE; + pBestStab->ubOpponent = pOpponent->ubID; + pBestStab->ubAimTime = ubBestAimTime; pBestStab->ubChanceToReallyHit = ubChanceToReallyHit; - pBestStab->sTarget = pOpponent->sGridNo; - pBestStab->bTargetLevel = pOpponent->bLevel; + pBestStab->sTarget = pOpponent->sGridNo; + pBestStab->bTargetLevel = pOpponent->pathing.bLevel; // ADD this target's attack value to our TOTAL... pBestStab->iAttackValue += iAttackValue; - pBestStab->ubAPCost = ubMinAPCost + ubBestAimTime; + pBestStab->ubAPCost = ubMinAPCost + ubBestAimTime; } } @@ -1554,7 +1545,7 @@ UINT8 NumMercsCloseTo( INT16 sGridNo, UINT8 ubMaxDist ) { pSoldier = MercSlots[ uiLoop ]; - if ( pSoldier && pSoldier->bTeam == gbPlayerNum && pSoldier->bLife >= OKLIFE ) + if ( pSoldier && pSoldier->bTeam == gbPlayerNum && pSoldier->stats.bLife >= OKLIFE ) { if (PythSpacesAway( sGridNo, pSoldier->sGridNo ) <= ubMaxDist) { @@ -1573,13 +1564,13 @@ INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ub UINT8 ubBonus; INT32 iHeadProt = 0, iTorsoProt = 0, iLegProt = 0; INT32 iTotalProt; - INT8 bPlatePos; + //INT8 bPlatePos; UINT8 ubAmmoType; UINT16 usItem; OBJECTTYPE *pObj; /* - if ( pOpponent->uiStatusFlags & SOLDIER_VEHICLE ) + if ( pOpponent->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // only thing that can damage vehicles is HEAP rounds? return( 0 ); @@ -1595,7 +1586,7 @@ INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ub } else { - ubAmmoType = pObj->ItemData.Gun.ubGunAmmoType; + ubAmmoType = (*pObj)[0]->data.gun.ubGunAmmoType; } // calculate distance to target, obtain his gun's maximum range rating @@ -1607,7 +1598,7 @@ INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ub iPowerLost = ((50 * iRange) / iMaxRange); // up to 50% extra impact for making particularly accurate successful shots - ubBonus = ubChanceToHit / 4; // /4 is really /2 and /2 again + ubBonus = ubChanceToHit / 4; // /4 is really /2 and /2 again iDamage = ((GetDamage(pObj)) * (100 - iPowerLost + ubBonus) / 100) ; @@ -1617,7 +1608,7 @@ INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ub if (pOpponent->inv[HELMETPOS].usItem) { iHeadProt += (INT32) Armour[Item[pOpponent->inv[HELMETPOS].usItem].ubClassIndex].ubProtection * - (INT32) pOpponent->inv[HELMETPOS].ItemData.Generic.bStatus[0] / 100; + (INT32) pOpponent->inv[HELMETPOS][0]->data.objectStatus / 100; } // if opponent is wearing a protective vest @@ -1627,30 +1618,30 @@ INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ub if (pOpponent->inv[VESTPOS].usItem) { iTorsoProt += (INT32) Armour[Item[pOpponent->inv[VESTPOS].usItem].ubClassIndex].ubProtection * - (INT32) pOpponent->inv[VESTPOS].ItemData.Generic.bStatus[0] / 100; + (INT32) pOpponent->inv[VESTPOS][0]->data.objectStatus / 100; } } // check for ceramic plates; these do affect monster spit - bPlatePos = FindFirstArmourAttachment( &(pOpponent->inv[VESTPOS]) ); - if (bPlatePos != -1) - { - iTorsoProt += (INT32) Armour[Item[pOpponent->inv[VESTPOS].usAttachItem[bPlatePos]].ubClassIndex].ubProtection * - (INT32) pOpponent->inv[VESTPOS].bAttachStatus[bPlatePos] / 100; + for (attachmentList::iterator iter = pOpponent->inv[VESTPOS][0]->attachments.begin(); iter != pOpponent->inv[VESTPOS][0]->attachments.end(); ++iter) { + if (Item[iter->usItem].usItemClass == IC_ARMOUR && (*iter)[0]->data.objectStatus > 0 ) + { + iTorsoProt += (INT32) Armour[Item[iter->usItem].ubClassIndex].ubProtection * + (INT32) (*iter)[0]->data.objectStatus / 100; + } } - // if opponent is wearing armoured leggings (LEGPOS) if ( !AmmoTypes[ubAmmoType].ignoreArmour ) { // monster spit and knives ignore kevlar leggings if (pOpponent->inv[LEGPOS].usItem) { iLegProt += (INT32) Armour[Item[pOpponent->inv[LEGPOS].usItem].ubClassIndex].ubProtection * - (INT32) pOpponent->inv[LEGPOS].ItemData.Generic.bStatus[0] / 100; + (INT32) pOpponent->inv[LEGPOS][0]->data.objectStatus / 100; } } - // 15% of all shots are to the head, 80% are to the torso. Calc. avg. prot. + // 15% of all shots are to the head, 80% are to the torso. Calc. avg. prot. // NB: make AI guys shoot at head 15% of time, 5% of time at legs iTotalProt = ((15 * iHeadProt) + (75 * iTorsoProt) + 5 * iLegProt) / 100; @@ -1691,16 +1682,16 @@ INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ub iDamage += ( 3 * Explosive[ Item[ LARGE_CREATURE_GAS ].ubClassIndex ].ubDamage * NumMercsCloseTo( pOpponent->sGridNo, (UINT8)Explosive[ Item[ LARGE_CREATURE_GAS ].ubClassIndex ].ubRadius ) ) / 2; break; case CREATURE_OLD_MALE_SPIT: - iDamage += ( 3 * Explosive[ Item[ SMALL_CREATURE_GAS ].ubClassIndex ].ubDamage * NumMercsCloseTo( pOpponent->sGridNo, (UINT8)Explosive[ Item[ SMALL_CREATURE_GAS ].ubClassIndex ].ubRadius ) ) / 2; + iDamage += ( 3 * Explosive[ Item[ SMALL_CREATURE_GAS ].ubClassIndex ].ubDamage * NumMercsCloseTo( pOpponent->sGridNo, (UINT8)Explosive[ Item[ SMALL_CREATURE_GAS ].ubClassIndex ].ubRadius ) ) / 2; break; default: - iDamage += ( 3 * Explosive[ Item[ VERY_SMALL_CREATURE_GAS ].ubClassIndex ].ubDamage * NumMercsCloseTo( pOpponent->sGridNo, (UINT8)Explosive[ Item[ VERY_SMALL_CREATURE_GAS ].ubClassIndex ].ubRadius ) ) / 2; + iDamage += ( 3 * Explosive[ Item[ VERY_SMALL_CREATURE_GAS ].ubClassIndex ].ubDamage * NumMercsCloseTo( pOpponent->sGridNo, (UINT8)Explosive[ Item[ VERY_SMALL_CREATURE_GAS ].ubClassIndex ].ubRadius ) ) / 2; break; } } if (iDamage < 1) - iDamage = 1; // assume we can do at LEAST 1 pt minimum damage + iDamage = 1; // assume we can do at LEAST 1 pt minimum damage return( iDamage ); } @@ -1712,10 +1703,10 @@ INT32 EstimateThrowDamage( SOLDIERTYPE *pSoldier, UINT8 ubItemPos, SOLDIERTYPE * INT8 bSlot; - if( pSoldier == NULL || pOpponent == NULL || ubItemPos > NUM_INV_SLOTS || sGridno > NUMBEROFTILES ) + if( pSoldier == NULL || pOpponent == NULL || ubItemPos > pSoldier->inv.size() || sGridno > NUMBEROFTILES ) return 0; - if( pSoldier->inv[ubItemPos].usItem == NOTHING ) + if( pSoldier->inv[ubItemPos].exists() == false ) return 0; @@ -1723,7 +1714,7 @@ INT32 EstimateThrowDamage( SOLDIERTYPE *pSoldier, UINT8 ubItemPos, SOLDIERTYPE * //{ //case GL_SMOKE_GRENADE: //case SMOKE_GRENADE: - // // Don't want to value throwing smoke very much. This value is based relative + // // Don't want to value throwing smoke very much. This value is based relative // // to the value for knocking somebody down, which was giving values that were // // too high // return( 5 ); @@ -1736,9 +1727,9 @@ INT32 EstimateThrowDamage( SOLDIERTYPE *pSoldier, UINT8 ubItemPos, SOLDIERTYPE * ubExplosiveIndex = Item[ C1 ].ubClassIndex; else if ( Item[pSoldier->inv[ ubItemPos ].usItem].rocketlauncher || Item[pSoldier->inv[ ubItemPos ].usItem].grenadelauncher || Item[pSoldier->inv[ ubItemPos ].usItem].mortar ) { - bSlot = FindLaunchableAttachment(&pSoldier->inv[ ubItemPos ],pSoldier->inv[ ubItemPos ].usItem ) ; - if ( bSlot != ITEM_NOT_FOUND ) - ubExplosiveIndex = Item[pSoldier->inv[ bSlot ].usItem].ubClassIndex; + OBJECTTYPE* pAttachment = FindLaunchableAttachment(&pSoldier->inv[ ubItemPos ],pSoldier->inv[ ubItemPos ].usItem ) ; + if ( pAttachment ) + ubExplosiveIndex = Item[pAttachment->usItem].ubClassIndex; else return 0; } @@ -1752,7 +1743,7 @@ INT32 EstimateThrowDamage( SOLDIERTYPE *pSoldier, UINT8 ubItemPos, SOLDIERTYPE * // JA2Gold: added if ( Item[pSoldier->inv[ubItemPos].usItem].flare ) { - return( 5 * ( LightTrueLevel( pOpponent->sGridNo, pOpponent->bLevel ) - NORMAL_LIGHTLEVEL_DAY ) ); + return( 5 * ( LightTrueLevel( pOpponent->sGridNo, pOpponent->pathing.bLevel ) - NORMAL_LIGHTLEVEL_DAY ) ); } @@ -1763,13 +1754,13 @@ INT32 EstimateThrowDamage( SOLDIERTYPE *pSoldier, UINT8 ubItemPos, SOLDIERTYPE * { // if target gridno is outdoors (where tear gas lasts only 1-2 turns) if (gpWorldLevelData[sGridno].ubTerrainID != FLAT_FLOOR) - iBreathDamage /= 2; // reduce effective breath damage by 1/2 + iBreathDamage /= 2; // reduce effective breath damage by 1/2 bSlot = FindObj( pOpponent, GASMASK ); if (bSlot == HEAD1POS || bSlot == HEAD2POS) { // take condition of the gas mask into account - it could be leaking - iBreathDamage = (iBreathDamage * (100 - pOpponent->inv[bSlot].ItemData.Generic.bStatus[0])) / 100; + iBreathDamage = (iBreathDamage * (100 - pOpponent->inv[bSlot][0]->data.objectStatus)) / 100; //NumMessage("damage after GAS MASK: ",iBreathDamage); } @@ -1778,7 +1769,7 @@ INT32 EstimateThrowDamage( SOLDIERTYPE *pSoldier, UINT8 ubItemPos, SOLDIERTYPE * { // if target gridno is outdoors (where tear gas lasts only 1-2 turns) if (gpWorldLevelData[sGridno].ubTerrainID != FLAT_FLOOR) - iBreathDamage /= 2; // reduce effective breath damage by 1/2 + iBreathDamage /= 2; // reduce effective breath damage by 1/2 } else if (iExplosDamage) { @@ -1808,7 +1799,7 @@ INT32 EstimateThrowDamage( SOLDIERTYPE *pSoldier, UINT8 ubItemPos, SOLDIERTYPE * // approximate chance of the grenade going off (Ian's formulas are too funky) // then use that to reduce the expected damage because thing may not blow! - iDamage = (iDamage * pSoldier->inv[ubItemPos].ItemData.Generic.bStatus[0]) / 100; + iDamage = (iDamage * pSoldier->inv[ubItemPos][0]->data.objectStatus) / 100; // if the target gridno is in water, grenade may not blow (guess 50% of time) /* @@ -1820,7 +1811,7 @@ INT32 EstimateThrowDamage( SOLDIERTYPE *pSoldier, UINT8 ubItemPos, SOLDIERTYPE * } INT32 EstimateStabDamage( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, - UINT8 ubChanceToHit, BOOLEAN fBladeAttack ) + UINT8 ubChanceToHit, BOOLEAN fBladeAttack ) { INT32 iImpact, iFluke, iBonus; @@ -1849,7 +1840,7 @@ INT32 EstimateStabDamage( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, } - iImpact += (pSoldier->bExpLevel / 2); // 0 to 4 for level + iImpact += (pSoldier->stats.bExpLevel / 2); // 0 to 4 for level iFluke = 0; iBonus = ubChanceToHit / 4; // up to 50% extra impact for accurate attacks @@ -1900,22 +1891,22 @@ INT8 TryToReload( SOLDIERTYPE * pSoldier ) // manual recharge pObj = &(pSoldier->inv[HANDPOS]); - if (pObj->ItemData.Gun.ubGunShotsLeft && !(pObj->ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) ) + if ((*pObj)[0]->data.gun.ubGunShotsLeft && !((*pObj)[0]->data.gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) ) { - pObj->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; + (*pObj)[0]->data.gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; DeductPoints(pSoldier, Weapon[Item[(pObj)->usItem].ubClassIndex].APsToReloadManually, 0); PlayJA2Sample( Weapon[ Item[pObj->usItem].ubClassIndex ].ManualReloadSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); - if ( IsValidSecondHandShot( pSoldier ) ) + if ( pSoldier->IsValidSecondHandShot( ) ) { pObj2 = &(pSoldier->inv[SECONDHANDPOS]); - if (pObj2->ItemData.Gun.ubGunShotsLeft && !(pObj2->ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) ) + if ((*pObj2)[0]->data.gun.ubGunShotsLeft && !((*pObj2)[0]->data.gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) ) { - pObj2->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; + (*pObj2)[0]->data.gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; PlayJA2Sample( Weapon[ Item[pObj2->usItem].ubClassIndex ].ManualReloadSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } } @@ -1924,13 +1915,13 @@ INT8 TryToReload( SOLDIERTYPE * pSoldier ) } else { - if ( IsValidSecondHandShot( pSoldier ) ) + if ( pSoldier->IsValidSecondHandShot( ) ) { pObj2 = &(pSoldier->inv[SECONDHANDPOS]); - if (pObj2->ItemData.Gun.ubGunShotsLeft && !(pObj2->ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) ) + if ((*pObj2)[0]->data.gun.ubGunShotsLeft && !((*pObj2)[0]->data.gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) ) { - pObj2->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; + (*pObj2)[0]->data.gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; DeductPoints(pSoldier, Weapon[Item[(pObj2)->usItem].ubClassIndex].APsToReloadManually, 0); @@ -1981,7 +1972,7 @@ INT8 CanNPCAttack(SOLDIERTYPE *pSoldier) // NEUTRAL civilians are not allowed to attack, but those that are not // neutral (KILLNPC mission guynums, escorted guys) can, if they're armed - if (PTR_CIVILIAN && pSoldier->bNeutral) + if (PTR_CIVILIAN && pSoldier->aiData.bNeutral) { return(FALSE); } @@ -2009,7 +2000,8 @@ INT8 CanNPCAttack(SOLDIERTYPE *pSoldier) if ( (Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass == IC_GUN) && !(Item[ pSoldier->inv[ HANDPOS ].usItem ].twohanded ) ) { // look for another pistol/SMG if available - bWeaponIn = FindAIUsableObjClassWithin( pSoldier, IC_WEAPON, BIGPOCK1POS, SMALLPOCK8POS ); + // CHRISL: Change final parameter to use dynamic pocket definition + bWeaponIn = FindAIUsableObjClassWithin( pSoldier, IC_WEAPON, BIGPOCKSTART, NUM_INV_SLOTS ); // if (bWeaponIn != NO_SLOT && (Item[ pSoldier->inv[ bWeaponIn ].usItem ].usItemClass == IC_GUN) && !(Item[ pSoldier->inv[ bWeaponIn ].usItem ].fFlags & ITEM_TWO_HANDED ) ) if (bWeaponIn != NO_SLOT && (Item[ pSoldier->inv[ bWeaponIn ].usItem ].usItemClass == IC_GUN) && !(Item[ pSoldier->inv[ bWeaponIn ].usItem ].twohanded ) ) { @@ -2054,7 +2046,7 @@ void CheckIfTossPossible(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) { // Consider rocket launcher/cannon pBestThrow->bWeaponIn = FindRocketLauncherOrCannon( pSoldier ); - if ( pBestThrow->bWeaponIn == NO_SLOT || ( !EnoughAmmo( pSoldier, FALSE, pBestThrow->bWeaponIn) && FindAmmoToReload( pSoldier, pBestThrow->bWeaponIn, NO_SLOT) == NO_SLOT) ) + if ( pBestThrow->bWeaponIn == NO_SLOT || ( !EnoughAmmo( pSoldier, FALSE, pBestThrow->bWeaponIn) && FindAmmoToReload( pSoldier, pBestThrow->bWeaponIn, NO_SLOT) == NO_SLOT) ) { //no rocket launcher (or empty) -- let's look for an underslung/attached GL // AND a launchable grenade! @@ -2076,8 +2068,8 @@ void CheckIfTossPossible(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) } else { - // Have rocket launcher... maybe have grenades as well. which one to use? - if ( pSoldier->bAIMorale > MORALE_WORRIED && PreRandom( 2 ) ) + // Have rocket launcher... maybe have grenades as well. which one to use? + if ( pSoldier->aiData.bAIMorale > MORALE_WORRIED && PreRandom( 2 ) ) { pBestThrow->bWeaponIn = FindThrowableGrenade( pSoldier ); } @@ -2223,7 +2215,7 @@ INT8 CountAdjacentSpreadTargets( SOLDIERTYPE * pSoldier, INT16 sFirstTarget, INT } if (bDirLoop == 6 && bTargets > 1) { - // we're done! otherwise we continue and try to find people in front/behind + // we're done! otherwise we continue and try to find people in front/behind break; } else if (pTargets[bTargetIndex] != NULL) @@ -2235,7 +2227,7 @@ INT8 CountAdjacentSpreadTargets( SOLDIERTYPE * pSoldier, INT16 sFirstTarget, INT if (pTarget) { // check to see if guy is visible - if (pSoldier->bOppList[ pTarget->ubID ] == SEEN_CURRENTLY) + if (pSoldier->aiData.bOppList[ pTarget->ubID ] == SEEN_CURRENTLY) { pTargets[bTargetIndex] = pTarget; bTargets++; @@ -2352,7 +2344,7 @@ INT16 CalcSpreadBurst( SOLDIERTYPE * pSoldier, INT16 sFirstTarget, INT8 bTargetL } if (bDirLoop == 6 && bTargets > 1) { - // we're done! otherwise we continue and try to find people in front/behind + // we're done! otherwise we continue and try to find people in front/behind break; } else if (pTargets[bTargetIndex] != NULL) @@ -2361,7 +2353,7 @@ INT16 CalcSpreadBurst( SOLDIERTYPE * pSoldier, INT16 sFirstTarget, INT8 bTargetL } sTarget = sFirstTarget + DirIncrementer[bCheckDir]; pTarget = SimpleFindSoldier( sTarget, bTargetLevel ); - if (pTarget && pSoldier->bOppList[ pTarget->ubID ] == SEEN_CURRENTLY) + if (pTarget && pSoldier->aiData.bOppList[ pTarget->ubID ] == SEEN_CURRENTLY) { bOtherAdjacents = CountAdjacentSpreadTargets( pSoldier, sTarget, bTargetLevel ); if (bOtherAdjacents > bAdjacents) @@ -2411,7 +2403,7 @@ INT16 CalcSpreadBurst( SOLDIERTYPE * pSoldier, INT16 sFirstTarget, INT8 bTargetL } } AIPickBurstLocations( pSoldier, bTargets, pTargets ); - pSoldier->fDoSpread = TRUE; + pSoldier->flags.fDoSpread = TRUE; } return( sFirstTarget ); } @@ -2475,8 +2467,8 @@ void CheckIfShotPossible(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN s } //if ( (!suppressionFire && ( (IsScoped(pObj) && GunRange(pObj) > pSoldier->MaxDistanceVisible(pBestShot->sTarget, pBestShot->bTargetLevel) ) || pSoldier->bOrders == SNIPER ) ) || - if ( (!suppressionFire && ( (IsScoped(pObj) && GunRange(pObj) > MaxNormalDistanceVisible() ) || pSoldier->bOrders == SNIPER ) ) || - (suppressionFire && IsGunAutofireCapable(pSoldier,pBestShot->bWeaponIn ) && GetMagSize(pObj) > 30 && pObj->ItemData.Gun.ubGunShotsLeft > 20 )) + if ( (!suppressionFire && ( (IsScoped(pObj) && GunRange(pObj) > MaxNormalDistanceVisible() ) || pSoldier->aiData.bOrders == SNIPER ) ) || + (suppressionFire && IsGunAutofireCapable(&pSoldier->inv[pBestShot->bWeaponIn] ) && GetMagSize(pObj) > 30 && (*pObj)[0]->data.gun.ubGunShotsLeft > 20 )) { // get the minimum cost to attack with this item DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CheckIfShotPossible: getting min aps"); diff --git a/TacticalAI/CreatureDecideAction.cpp b/TacticalAI/CreatureDecideAction.cpp index b4ca2156..116490e6 100644 --- a/TacticalAI/CreatureDecideAction.cpp +++ b/TacticalAI/CreatureDecideAction.cpp @@ -2,7 +2,7 @@ #include "AI All.h" #else #include "types.h" - #include "soldier control.h" + //#include "soldier control.h" #include "ai.h" #include "AIInternals.h" #include "opplist.h" @@ -11,6 +11,11 @@ #include "soldier add.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + extern INT8 STRAIGHT; //lal #define CAN_CALL( s ) (s->ubBodyType != BLOODCAT && s->ubBodyType != LARVAE_MONSTER && s->ubBodyType != INFANT_MONSTER) @@ -18,7 +23,7 @@ extern INT8 STRAIGHT; //lal enum { - CALLER_FEMALE = 0, + CALLER_FEMALE = 0, CALLER_MALE, CALLER_INFANT, CALLER_QUEEN, @@ -49,7 +54,7 @@ INT8 gbHuntCallPriority[NUM_CREATURE_CALLS] = 4, //CALL_1_PREY 5, //CALL_MULTIPLE_PREY 7, //CALL_ATTACKED - 8 //CALL_CRIPPLED + 8 //CALL_CRIPPLED }; #define PRIORITY_DECR_DISTANCE 30 @@ -88,13 +93,13 @@ void CreatureCall( SOLDIERTYPE * pCaller ) ubCallerType = CALLER_FEMALE; break; } - if (pCaller->bHunting) // which should only be set for females outside of the hive + if (pCaller->aiData.bHunting) // which should only be set for females outside of the hive { - bFullPriority = gbHuntCallPriority[pCaller->usActionData]; + bFullPriority = gbHuntCallPriority[pCaller->aiData.usActionData]; } else { - bFullPriority = gbCallPriority[pCaller->usActionData][ubCallerType]; + bFullPriority = gbCallPriority[pCaller->aiData.usActionData][ubCallerType]; } // OK, do animation based on body type... @@ -105,12 +110,12 @@ void CreatureCall( SOLDIERTYPE * pCaller ) case AM_MONSTER: case YAM_MONSTER: - EVENT_InitNewSoldierAnim( pCaller, MONSTER_UP, 0 , FALSE ); + pCaller->EVENT_InitNewSoldierAnim( MONSTER_UP, 0 , FALSE ); break; case QUEENMONSTER: - EVENT_InitNewSoldierAnim( pCaller, QUEEN_CALL, 0 , FALSE ); + pCaller->EVENT_InitNewSoldierAnim( QUEEN_CALL, 0 , FALSE ); break; } @@ -118,24 +123,24 @@ void CreatureCall( SOLDIERTYPE * pCaller ) for (ubReceiver = gTacticalStatus.Team[ pCaller->bTeam ].bFirstID; ubReceiver <= gTacticalStatus.Team[ pCaller->bTeam ].bLastID; ubReceiver++) { pReceiver = MercPtrs[ubReceiver]; - if (pReceiver->bActive && pReceiver->bInSector && (pReceiver->bLife >= OKLIFE) && (pReceiver != pCaller) && (pReceiver->bAlertStatus < STATUS_BLACK)) + if (pReceiver->bActive && pReceiver->bInSector && (pReceiver->stats.bLife >= OKLIFE) && (pReceiver != pCaller) && (pReceiver->aiData.bAlertStatus < STATUS_BLACK)) { if (pReceiver->ubBodyType != LARVAE_MONSTER && pReceiver->ubBodyType != INFANT_MONSTER && pReceiver->ubBodyType != QUEENMONSTER) { usDistToCaller = PythSpacesAway( pReceiver->sGridNo, pCaller->sGridNo ); bPriority = bFullPriority - (INT8) (usDistToCaller / PRIORITY_DECR_DISTANCE); - if (bPriority > pReceiver->bCallPriority) + if (bPriority > pReceiver->aiData.bCallPriority) { - pReceiver->bCallPriority = bPriority; - pReceiver->bAlertStatus = STATUS_RED; // our status can't be more than red to begin with - pReceiver->ubCaller = pCaller->ubID; - pReceiver->sCallerGridNo = pCaller->sGridNo; - pReceiver->bCallActedUpon = FALSE; + pReceiver->aiData.bCallPriority = bPriority; + pReceiver->aiData.bAlertStatus = STATUS_RED; // our status can't be more than red to begin with + pReceiver->aiData.ubCaller = pCaller->ubID; + pReceiver->aiData.sCallerGridNo = pCaller->sGridNo; + pReceiver->aiData.bCallActedUpon = FALSE; CancelAIAction(pReceiver, FORCE); if ((bPriority > FRENZY_THRESHOLD) && (pReceiver->ubBodyType == ADULTFEMALEMONSTER || pReceiver->ubBodyType == YAF_MONSTER)) { // go berzerk! - pReceiver->bFrenzied = TRUE; + pReceiver->aiData.bFrenzied = TRUE; } } } @@ -144,23 +149,23 @@ void CreatureCall( SOLDIERTYPE * pCaller ) } INT8 CreatureDecideActionGreen( SOLDIERTYPE * pSoldier ) -{ +{ INT32 iChance, iSneaky = 10; //INT8 bInWater; INT8 bInGas; - //bInWater = MercInWater(pSoldier); + //bInWater = pSoldier->MercInWater(); // NB creatures would ignore smoke completely :-) - if ( pSoldier->bMobility == CREATURE_CRAWLER && pSoldier->bActionPoints < pSoldier->bInitialActionPoints) + if ( pSoldier->aiData.bMobility == CREATURE_CRAWLER && pSoldier->bActionPoints < pSoldier->bInitialActionPoints) { return( AI_ACTION_NONE ); } bInGas = InGas( pSoldier, pSoldier->sGridNo ); - if (pSoldier->bMobility == CREATURE_MOBILE) + if (pSoldier->aiData.bMobility == CREATURE_MOBILE) { if (TrackScent( pSoldier )) @@ -174,30 +179,30 @@ INT8 CreatureDecideActionGreen( SOLDIERTYPE * pSoldier ) // this takes priority over water/gas checks, so that point patrol WILL work // from island to island, and through gas covered areas, too - if ((pSoldier->bOrders == POINTPATROL) && (pSoldier->bBreath >= 50)) + if ((pSoldier->aiData.bOrders == POINTPATROL) && (pSoldier->bBreath >= 50)) { if (PointPatrolAI(pSoldier)) { if (!gfTurnBasedAI) { // pause at the end of the walk! - pSoldier->bNextAction = AI_ACTION_WAIT; - pSoldier->usNextActionData = (UINT16) REALTIME_CREATURE_AI_DELAY; + pSoldier->aiData.bNextAction = AI_ACTION_WAIT; + pSoldier->aiData.usNextActionData = (UINT16) REALTIME_CREATURE_AI_DELAY; } return(AI_ACTION_POINT_PATROL); } } - if ((pSoldier->bOrders == RNDPTPATROL) && (pSoldier->bBreath >=50)) + if ((pSoldier->aiData.bOrders == RNDPTPATROL) && (pSoldier->bBreath >=50)) { if (RandomPointPatrolAI(pSoldier)) { if (!gfTurnBasedAI) { // pause at the end of the walk! - pSoldier->bNextAction = AI_ACTION_WAIT; - pSoldier->usNextActionData = (UINT16) REALTIME_CREATURE_AI_DELAY; + pSoldier->aiData.bNextAction = AI_ACTION_WAIT; + pSoldier->aiData.usNextActionData = (UINT16) REALTIME_CREATURE_AI_DELAY; } return(AI_ACTION_POINT_PATROL); @@ -210,13 +215,13 @@ INT8 CreatureDecideActionGreen( SOLDIERTYPE * pSoldier ) if ( /*bInWater || */ bInGas) { - pSoldier->usActionData = FindNearestUngassedLand(pSoldier); + pSoldier->aiData.usActionData = FindNearestUngassedLand(pSoldier); - if (pSoldier->usActionData != NOWHERE) + if (pSoldier->aiData.usActionData != NOWHERE) { #ifdef DEBUGDECISIONS STR16 tempstr; - sprintf(tempstr,"%s - SEEKING NEAREST UNGASSED LAND at grid %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - SEEKING NEAREST UNGASSED LAND at grid %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif @@ -233,44 +238,44 @@ INT8 CreatureDecideActionGreen( SOLDIERTYPE * pSoldier ) if ((pSoldier->bBreath < 75) /*&& !bInWater*/) { // take a breather for gods sake! - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return(AI_ACTION_NONE); } //////////////////////////////////////////////////////////////////////////// - // RANDOM PATROL: determine % chance to start a new patrol route + // RANDOM PATROL: determine % chance to start a new patrol route //////////////////////////////////////////////////////////////////////////// - if (pSoldier->bMobility != CREATURE_IMMOBILE ) + if (pSoldier->aiData.bMobility != CREATURE_IMMOBILE ) { iChance = 25; // set base chance according to orders - switch (pSoldier->bOrders) + switch (pSoldier->aiData.bOrders) { - case STATIONARY: iChance += -20; break; - case ONGUARD: iChance += -15; break; - case ONCALL: break; - case CLOSEPATROL: iChance += +15; break; + case STATIONARY: iChance += -20; break; + case ONGUARD: iChance += -15; break; + case ONCALL: break; + case CLOSEPATROL: iChance += +15; break; case RNDPTPATROL: - case POINTPATROL: iChance = 0; break; - case FARPATROL: iChance += +25; break; - case SEEKENEMY: iChance += -10; break; + case POINTPATROL: iChance = 0; break; + case FARPATROL: iChance += +25; break; + case SEEKENEMY: iChance += -10; break; } // modify chance of patrol (and whether it's a sneaky one) by attitude - switch (pSoldier->bAttitude) + switch (pSoldier->aiData.bAttitude) { - case DEFENSIVE: iChance += -10; break; - case BRAVESOLO: iChance += 5; break; - case BRAVEAID: break; - case CUNNINGSOLO: iChance += 5; iSneaky += 10; break; - case CUNNINGAID: iSneaky += 5; break; - case AGGRESSIVE: iChance += 10; iSneaky += -5; break; + case DEFENSIVE: iChance += -10; break; + case BRAVESOLO: iChance += 5; break; + case BRAVEAID: break; + case CUNNINGSOLO: iChance += 5; iSneaky += 10; break; + case CUNNINGAID: iSneaky += 5; break; + case AGGRESSIVE: iChance += 10; iSneaky += -5; break; } // reduce chance for any injury, less likely to wander around when hurt - iChance -= (pSoldier->bLifeMax - pSoldier->bLife); + iChance -= (pSoldier->stats.bLifeMax - pSoldier->stats.bLife); // reduce chance if breath is down, less likely to wander around when tired iChance -= (100 - pSoldier->bBreath); @@ -279,24 +284,24 @@ INT8 CreatureDecideActionGreen( SOLDIERTYPE * pSoldier ) // OR if we roll under the chance calculated if ( /*bInWater ||*/ ((INT16) PreRandom(100) < iChance)) { - pSoldier->usActionData = RandDestWithinRange(pSoldier); + pSoldier->aiData.usActionData = RandDestWithinRange(pSoldier); - if (pSoldier->usActionData != NOWHERE) + if (pSoldier->aiData.usActionData != NOWHERE) { #ifdef DEBUGDECISIONS STR16 tempstr; - sprintf(tempstr,"%s - RANDOM PATROL to grid %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - RANDOM PATROL to grid %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif if (!gfTurnBasedAI) { // pause at the end of the walk! - pSoldier->bNextAction = AI_ACTION_WAIT; - pSoldier->usNextActionData = (UINT16) REALTIME_CREATURE_AI_DELAY; - if (pSoldier->bMobility == CREATURE_CRAWLER) + pSoldier->aiData.bNextAction = AI_ACTION_WAIT; + pSoldier->aiData.usNextActionData = (UINT16) REALTIME_CREATURE_AI_DELAY; + if (pSoldier->aiData.bMobility == CREATURE_CRAWLER) { - pSoldier->usNextActionData *= 2; + pSoldier->aiData.usNextActionData *= 2; } } @@ -305,7 +310,7 @@ INT8 CreatureDecideActionGreen( SOLDIERTYPE * pSoldier ) } /* - if (pSoldier->bMobility == CREATURE_MOBILE) + if (pSoldier->aiData.bMobility == CREATURE_MOBILE) { //////////////////////////////////////////////////////////////////////////// // SEEK FRIEND: determine %chance for man to pay a friendly visit @@ -313,49 +318,49 @@ INT8 CreatureDecideActionGreen( SOLDIERTYPE * pSoldier ) iChance = 25; // set base chance and maximum seeking distance according to orders - switch (pSoldier->bOrders) + switch (pSoldier->aiData.bOrders) { - case STATIONARY: iChance += -20; break; - case ONGUARD: iChance += -15; break; - case ONCALL: break; - case CLOSEPATROL: iChance += +10; break; + case STATIONARY: iChance += -20; break; + case ONGUARD: iChance += -15; break; + case ONCALL: break; + case CLOSEPATROL: iChance += +10; break; case RNDPTPATROL: - case POINTPATROL: iChance = -10; break; - case FARPATROL: iChance += +20; break; - case SEEKENEMY: iChance += -10; break; + case POINTPATROL: iChance = -10; break; + case FARPATROL: iChance += +20; break; + case SEEKENEMY: iChance += -10; break; } // modify for attitude - switch (pSoldier->bAttitude) + switch (pSoldier->aiData.bAttitude) { - case DEFENSIVE: break; - case BRAVESOLO: iChance /= 2; break; // loners - case BRAVEAID: iChance += 10; break; // friendly - case CUNNINGSOLO: iChance /= 2; break; // loners - case CUNNINGAID: iChance += 10; break; // friendly - case AGGRESSIVE: break; + case DEFENSIVE: break; + case BRAVESOLO: iChance /= 2; break; // loners + case BRAVEAID: iChance += 10; break; // friendly + case CUNNINGSOLO: iChance /= 2; break; // loners + case CUNNINGAID: iChance += 10; break; // friendly + case AGGRESSIVE: break; } // reduce chance for any injury, less likely to wander around when hurt - iChance -= (pSoldier->bLifeMax - pSoldier->bLife); + iChance -= (pSoldier->stats.bLifeMax - pSoldier->stats.bLife); // reduce chance if breath is down - iChance -= (100 - pSoldier->bBreath); // very likely to wait when exhausted + iChance -= (100 - pSoldier->bBreath); // very likely to wait when exhausted if ((INT16) PreRandom(100) < iChance) { if (RandomFriendWithin(pSoldier)) { #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - SEEK FRIEND at grid %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - SEEK FRIEND at grid %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif if (!gfTurnBasedAI) { // pause at the end of the walk! - pSoldier->bNextAction = AI_ACTION_WAIT; - pSoldier->usNextActionData = (UINT16) REALTIME_CREATURE_AI_DELAY; + pSoldier->aiData.bNextAction = AI_ACTION_WAIT; + pSoldier->aiData.usNextActionData = (UINT16) REALTIME_CREATURE_AI_DELAY; } return(AI_ACTION_SEEK_FRIEND); @@ -369,18 +374,18 @@ INT8 CreatureDecideActionGreen( SOLDIERTYPE * pSoldier ) //////////////////////////////////////////////////////////////////////////// // avoid 2 consecutive random turns in a row - if (pSoldier->bLastAction != AI_ACTION_CHANGE_FACING && (GetAPsToLook( pSoldier ) <= pSoldier->bActionPoints)) + if (pSoldier->aiData.bLastAction != AI_ACTION_CHANGE_FACING && (GetAPsToLook( pSoldier ) <= pSoldier->bActionPoints)) { iChance = 25; // set base chance according to orders - if (pSoldier->bOrders == STATIONARY) + if (pSoldier->aiData.bOrders == STATIONARY) iChance += 25; - if (pSoldier->bOrders == ONGUARD) + if (pSoldier->aiData.bOrders == ONGUARD) iChance += 20; - if (pSoldier->bAttitude == DEFENSIVE) + if (pSoldier->aiData.bAttitude == DEFENSIVE) iChance += 25; if ((INT16)PreRandom(100) < iChance) @@ -390,32 +395,32 @@ INT8 CreatureDecideActionGreen( SOLDIERTYPE * pSoldier ) { // if man has a LEGAL dominant facing, and isn't facing it, he will turn // back towards that facing 50% of the time here (normally just enemies) - if ((pSoldier->bDominantDir >= 0) && (pSoldier->bDominantDir <= 8) && - (pSoldier->ubDirection != pSoldier->bDominantDir) && PreRandom(2)) + if ((pSoldier->aiData.bDominantDir >= 0) && (pSoldier->aiData.bDominantDir <= 8) && + (pSoldier->ubDirection != pSoldier->aiData.bDominantDir) && PreRandom(2)) { - pSoldier->usActionData = pSoldier->bDominantDir; + pSoldier->aiData.usActionData = pSoldier->aiData.bDominantDir; } else { - pSoldier->usActionData = (UINT16)PreRandom(8); + pSoldier->aiData.usActionData = (UINT16)PreRandom(8); } - } while (pSoldier->usActionData == pSoldier->ubDirection); + } while (pSoldier->aiData.usActionData == pSoldier->ubDirection); #ifdef DEBUGDECISIONS STR16 tempstr; - sprintf(tempstr,"%s - TURNS to face direction %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - TURNS to face direction %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif - if ( ValidCreatureTurn( pSoldier, (INT8) pSoldier->usActionData ) ) + if ( ValidCreatureTurn( pSoldier, (INT8) pSoldier->aiData.usActionData ) ) - //InternalIsValidStance( pSoldier, (INT8) pSoldier->usActionData, ANIM_STAND ) ) + //pSoldier->InternalIsValidStance( (INT8) pSoldier->usActionData, ANIM_STAND ) ) { if (!gfTurnBasedAI) { // pause at the end of the turn! - pSoldier->bNextAction = AI_ACTION_WAIT; - pSoldier->usNextActionData = (UINT16) REALTIME_CREATURE_AI_DELAY; + pSoldier->aiData.bNextAction = AI_ACTION_WAIT; + pSoldier->aiData.usNextActionData = (UINT16) REALTIME_CREATURE_AI_DELAY; } return(AI_ACTION_CHANGE_FACING); @@ -429,14 +434,14 @@ INT8 CreatureDecideActionGreen( SOLDIERTYPE * pSoldier ) //////////////////////////////////////////////////////////////////////////// // by default, if everything else fails, just stands in place without turning - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return(AI_ACTION_NONE); } INT8 CreatureDecideActionYellow( SOLDIERTYPE * pSoldier ) { - // monster AI - heard something + // monster AI - heard something UINT8 ubNoiseDir; INT16 sNoiseGridNo; INT32 iNoiseValue; @@ -445,7 +450,7 @@ INT8 CreatureDecideActionYellow( SOLDIERTYPE * pSoldier ) BOOLEAN fReachable; // INT16 sClosestFriend; - if ( pSoldier->bMobility == CREATURE_CRAWLER && pSoldier->bActionPoints < pSoldier->bInitialActionPoints) + if ( pSoldier->aiData.bMobility == CREATURE_CRAWLER && pSoldier->bActionPoints < pSoldier->bInitialActionPoints) { return( AI_ACTION_NONE ); } @@ -472,7 +477,7 @@ INT8 CreatureDecideActionYellow( SOLDIERTYPE * pSoldier ) // LOOK AROUND TOWARD NOISE: determine %chance for man to turn towards noise //////////////////////////////////////////////////////////////////////////// - if (pSoldier->bMobility != CREATURE_IMMOBILE) + if (pSoldier->aiData.bMobility != CREATURE_IMMOBILE) { // determine direction from this soldier in which the noise lies ubNoiseDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sNoiseGridNo),CenterY(sNoiseGridNo)); @@ -482,24 +487,24 @@ INT8 CreatureDecideActionYellow( SOLDIERTYPE * pSoldier ) if ((GetAPsToLook( pSoldier ) <= pSoldier->bActionPoints) && (pSoldier->ubDirection != ubNoiseDir) && PythSpacesAway(pSoldier->sGridNo,sNoiseGridNo) <= STRAIGHT) { // set base chance according to orders - if ((pSoldier->bOrders == STATIONARY) || (pSoldier->bOrders == ONGUARD)) + if ((pSoldier->aiData.bOrders == STATIONARY) || (pSoldier->aiData.bOrders == ONGUARD)) iChance = 60; - else // all other orders + else // all other orders iChance = 35; - if (pSoldier->bAttitude == DEFENSIVE) + if (pSoldier->aiData.bAttitude == DEFENSIVE) iChance += 15; if ((INT16)PreRandom(100) < iChance) { - pSoldier->usActionData = ubNoiseDir; + pSoldier->aiData.usActionData = ubNoiseDir; #ifdef DEBUGDECISIONS STR16 tempstr; - sprintf(tempstr,"%s - TURNS TOWARDS NOISE to face direction %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - TURNS TOWARDS NOISE to face direction %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif - //if ( InternalIsValidStance( pSoldier, (INT8) pSoldier->usActionData, ANIM_STAND ) ) - if ( ValidCreatureTurn( pSoldier, (INT8) pSoldier->usActionData ) ) + //if ( pSoldier->InternalIsValidStance( (INT8) pSoldier->usActionData, ANIM_STAND ) ) + if ( ValidCreatureTurn( pSoldier, (INT8) pSoldier->aiData.usActionData ) ) { return(AI_ACTION_CHANGE_FACING); } @@ -512,14 +517,14 @@ INT8 CreatureDecideActionYellow( SOLDIERTYPE * pSoldier ) //////////////////////////////////////////////////////////////////////// // if our breath is running a bit low, and we're not in water - if ((pSoldier->bBreath < 25) /*&& !MercInWater(pSoldier) */ ) + if ((pSoldier->bBreath < 25) /*&& !pSoldier->MercInWater() */ ) { // take a breather for gods sake! - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return(AI_ACTION_NONE); } - if (pSoldier->bMobility != CREATURE_IMMOBILE && fReachable) + if (pSoldier->aiData.bMobility != CREATURE_IMMOBILE && fReachable) { //////////////////////////////////////////////////////////////////////////// // SEEK NOISE @@ -530,27 +535,27 @@ INT8 CreatureDecideActionYellow( SOLDIERTYPE * pSoldier ) iSneaky = 30; // set base chance according to orders - switch (pSoldier->bOrders) + switch (pSoldier->aiData.bOrders) { - case STATIONARY: iChance += -20; break; - case ONGUARD: iChance += -15; break; - case ONCALL: break; - case CLOSEPATROL: iChance += -10; break; + case STATIONARY: iChance += -20; break; + case ONGUARD: iChance += -15; break; + case ONCALL: break; + case CLOSEPATROL: iChance += -10; break; case RNDPTPATROL: - case POINTPATROL: break; - case FARPATROL: iChance += 10; break; - case SEEKENEMY: iChance += 25; break; + case POINTPATROL: break; + case FARPATROL: iChance += 10; break; + case SEEKENEMY: iChance += 25; break; } // modify chance of patrol (and whether it's a sneaky one) by attitude - switch (pSoldier->bAttitude) + switch (pSoldier->aiData.bAttitude) { - case DEFENSIVE: iChance += -10; iSneaky += 15; break; - case BRAVESOLO: iChance += 10; break; - case BRAVEAID: iChance += 5; break; - case CUNNINGSOLO: iChance += 5; iSneaky += 30; break; - case CUNNINGAID: iSneaky += 30; break; - case AGGRESSIVE: iChance += 20; iSneaky += -10; break; + case DEFENSIVE: iChance += -10; iSneaky += 15; break; + case BRAVESOLO: iChance += 10; break; + case BRAVEAID: iChance += 5; break; + case CUNNINGSOLO: iChance += 5; iSneaky += 30; break; + case CUNNINGAID: iSneaky += 30; break; + case AGGRESSIVE: iChance += 20; iSneaky += -10; break; } // reduce chance if breath is down, less likely to wander around when tired @@ -558,14 +563,14 @@ INT8 CreatureDecideActionYellow( SOLDIERTYPE * pSoldier ) if ((INT16) PreRandom(100) < iChance) { - pSoldier->usActionData = GoAsFarAsPossibleTowards(pSoldier,sNoiseGridNo, AI_ACTION_SEEK_NOISE); + pSoldier->aiData.usActionData = GoAsFarAsPossibleTowards(pSoldier,sNoiseGridNo, AI_ACTION_SEEK_NOISE); - if (pSoldier->usActionData != NOWHERE) + if (pSoldier->aiData.usActionData != NOWHERE) { #ifdef DEBUGDECISIONS STR16 tempstr; sprintf(tempstr,"%s - INVESTIGATING NOISE at grid %d, moving to %d", - pSoldier->name,sNoiseGridNo,pSoldier->usActionData); + pSoldier->name,sNoiseGridNo,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif @@ -580,7 +585,7 @@ INT8 CreatureDecideActionYellow( SOLDIERTYPE * pSoldier ) } } - + //////////////////////////////////////////////////////////////////////////// // DO NOTHING: Not enough points left to move, so save them for next turn @@ -591,7 +596,7 @@ INT8 CreatureDecideActionYellow( SOLDIERTYPE * pSoldier ) #endif // by default, if everything else fails, just stands in place without turning - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return(AI_ACTION_NONE); } @@ -610,22 +615,22 @@ INT8 CreatureDecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) // if we have absolutely no action points, we can't do a thing under RED! if (!pSoldier->bActionPoints) - { - pSoldier->usActionData = NOWHERE; - return(AI_ACTION_NONE); - } + { + pSoldier->aiData.usActionData = NOWHERE; + return(AI_ACTION_NONE); + } - if ( pSoldier->bMobility == CREATURE_CRAWLER && pSoldier->bActionPoints < pSoldier->bInitialActionPoints) + if ( pSoldier->aiData.bMobility == CREATURE_CRAWLER && pSoldier->bActionPoints < pSoldier->bInitialActionPoints) { return( AI_ACTION_NONE ); } // can this guy move to any of the neighbouring squares ? (sets TRUE/FALSE) - ubCanMove = ((pSoldier->bMobility != CREATURE_IMMOBILE) && (pSoldier->bActionPoints >= MinPtsToMove(pSoldier))); + ubCanMove = ((pSoldier->aiData.bMobility != CREATURE_IMMOBILE) && (pSoldier->bActionPoints >= MinPtsToMove(pSoldier))); // determine if we happen to be in water (in which case we're in BIG trouble!) - //bInWater = MercInWater(pSoldier); + //bInWater = pSoldier->MercInWater(); // check if standing in tear gas without a gas mask on bInGas = InGas( pSoldier, pSoldier->sGridNo ); @@ -636,43 +641,43 @@ INT8 CreatureDecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) //////////////////////////////////////////////////////////////////////////// if (bInGas && ubCanMove) - { - pSoldier->usActionData = FindNearestUngassedLand(pSoldier); + { + pSoldier->aiData.usActionData = FindNearestUngassedLand(pSoldier); - if (pSoldier->usActionData != NOWHERE) - { + if (pSoldier->aiData.usActionData != NOWHERE) + { #ifdef DEBUGDECISIONS STR16 tempstr; - sprintf(tempstr,"%s - SEEKING NEAREST UNGASSED LAND at grid %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - SEEKING NEAREST UNGASSED LAND at grid %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif - return(AI_ACTION_LEAVE_WATER_GAS); - } - } + return(AI_ACTION_LEAVE_WATER_GAS); + } + } //////////////////////////////////////////////////////////////////////////// // CALL FOR AID IF HURT - //////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////// if ( CAN_CALL( pSoldier ) ) { if ((pSoldier->bActionPoints >= AP_RADIO) && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1)) { - if (pSoldier->bLife < pSoldier->bOldLife) + if (pSoldier->stats.bLife < pSoldier->bOldLife) { // got injured, maybe call - if ((pSoldier->bOldLife == pSoldier->bLifeMax) && (pSoldier->bOldLife - pSoldier->bLife > 10)) + if ((pSoldier->bOldLife == pSoldier->stats.bLifeMax) && (pSoldier->bOldLife - pSoldier->stats.bLife > 10)) { // hurt for first time! - pSoldier->usActionData = CALL_CRIPPLED; - pSoldier->bOldLife = pSoldier->bLife; // don't want to call more than once + pSoldier->aiData.usActionData = CALL_CRIPPLED; + pSoldier->bOldLife = pSoldier->stats.bLife; // don't want to call more than once return(AI_ACTION_CREATURE_CALL); } - else if (pSoldier->bLifeMax / pSoldier->bLife > 2) + else if (pSoldier->stats.bLifeMax / pSoldier->stats.bLife > 2) { // crippled, 1/3 or less health! - pSoldier->usActionData = CALL_ATTACKED; - pSoldier->bOldLife = pSoldier->bLife; // don't want to call more than once + pSoldier->aiData.usActionData = CALL_ATTACKED; + pSoldier->bOldLife = pSoldier->stats.bLife; // don't want to call more than once return(AI_ACTION_CREATURE_CALL); } } @@ -685,17 +690,17 @@ INT8 CreatureDecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) //////////////////////////////////////////////////////////////////////// // if our breath is running a bit low, and we're not in water or under fire - if ((pSoldier->bBreath < 25) /*&& !bInWater*/ && !pSoldier->bUnderFire) - { + if ((pSoldier->bBreath < 25) /*&& !bInWater*/ && !pSoldier->aiData.bUnderFire) + { #ifdef DEBUGDECISIONS STR16 tempstr; sprintf(tempstr,"%s RESTS (STATUS RED), breath = %d",pSoldier->name,pSoldier->bBreath); AIPopMessage(tempstr); #endif - pSoldier->usActionData = NOWHERE; - return(AI_ACTION_NONE); - } + pSoldier->aiData.usActionData = NOWHERE; + return(AI_ACTION_NONE); + } //////////////////////////////////////////////////////////////////////////// // CALL IN SIGHTING: determine %chance to call others and report contact @@ -709,9 +714,9 @@ INT8 CreatureDecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) { // if there hasn't been a general sighting call sent yet - // might want to check the specifics of who we see + // might want to check the specifics of who we see iChance = 20; - + if (iChance) { #ifdef DEBUGDECISIONS @@ -723,50 +728,50 @@ INT8 CreatureDecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) #ifdef DEBUGDECISIONS AINameMessage(pSoldier,"decides to call an alert!",1000); #endif - pSoldier->usActionData = CALL_1_PREY; - return(AI_ACTION_CREATURE_CALL); + pSoldier->aiData.usActionData = CALL_1_PREY; + return(AI_ACTION_CREATURE_CALL); } } } } - if ( pSoldier->bMobility != CREATURE_IMMOBILE ) + if ( pSoldier->aiData.bMobility != CREATURE_IMMOBILE ) { if ( FindAIUsableObjClass( pSoldier, IC_WEAPON ) == ITEM_NOT_FOUND ) { // probably a baby bug... run away! run away! - // look for best place to RUN AWAY to (farthest from the closest threat) - pSoldier->usActionData = FindSpotMaxDistFromOpponents( pSoldier ); + // look for best place to RUN AWAY to (farthest from the closest threat) + pSoldier->aiData.usActionData = FindSpotMaxDistFromOpponents( pSoldier ); - if (pSoldier->usActionData != NOWHERE) - { - return(AI_ACTION_RUN_AWAY); - } - else - { + if (pSoldier->aiData.usActionData != NOWHERE) + { + return(AI_ACTION_RUN_AWAY); + } + else + { return( AI_ACTION_NONE ); - } + } } // Respond to call if any - if ( CAN_LISTEN_TO_CALL( pSoldier ) && pSoldier->ubCaller != NOBODY ) + if ( CAN_LISTEN_TO_CALL( pSoldier ) && pSoldier->aiData.ubCaller != NOBODY ) { - if ( PythSpacesAway( pSoldier->sGridNo, pSoldier->sCallerGridNo ) <= STOPSHORTDIST ) + if ( PythSpacesAway( pSoldier->sGridNo, pSoldier->aiData.sCallerGridNo ) <= STOPSHORTDIST ) { // call completed... hmm, nothing found - pSoldier->ubCaller = NOBODY; + pSoldier->aiData.ubCaller = NOBODY; } else { - pSoldier->usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, pSoldier->sCallerGridNo, -1, AI_ACTION_SEEK_FRIEND, FLAG_STOPSHORT); + pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, pSoldier->aiData.sCallerGridNo, -1, AI_ACTION_SEEK_FRIEND, FLAG_STOPSHORT); - if (pSoldier->usActionData != NOWHERE) + if (pSoldier->aiData.usActionData != NOWHERE) { #ifdef DEBUGDECISIONS STR16 tempstr; sprintf(tempstr,"%s - SEEKING FRIEND at %d, MOVING to %d", - pSoldier->name,sClosestFriend,pSoldier->usActionData); + pSoldier->name,sClosestFriend,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif return(AI_ACTION_SEEK_FRIEND); @@ -784,16 +789,16 @@ INT8 CreatureDecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) ////////////////////////////////////////////////////////////////////// // try to move towards him - pSoldier->usActionData = GoAsFarAsPossibleTowards(pSoldier,sClosestDisturbance,AI_ACTION_SEEK_OPPONENT); + pSoldier->aiData.usActionData = GoAsFarAsPossibleTowards(pSoldier,sClosestDisturbance,AI_ACTION_SEEK_OPPONENT); // if it's possible - if (pSoldier->usActionData != NOWHERE) + if (pSoldier->aiData.usActionData != NOWHERE) { #ifdef DEBUGDECISIONS // do it! STR16 tempstr; sprintf(tempstr,"%s - SEEKING OPPONENT at grid %d, MOVING to %d", - pSoldier->name,sClosestDisturbance,pSoldier->usActionData); + pSoldier->name,sClosestDisturbance,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif @@ -801,78 +806,78 @@ INT8 CreatureDecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) } } - //////////////////////////////////////////////////////////////////////////// - // TAKE A BITE, PERHAPS - //////////////////////////////////////////////////////////////////////////// - if (pSoldier->bHunting) - { - pSoldier->usActionData = FindNearestRottingCorpse( pSoldier ); - // need smell/visibility check? - if (PythSpacesAway( pSoldier->sGridNo, pSoldier->usActionData) < MAX_EAT_DIST ) - { - INT16 sGridNo; - - sGridNo = FindAdjacentGridEx( pSoldier, pSoldier->usActionData, &ubOpponentDir, &sAdjustedGridNo, FALSE, FALSE ); - - if ( sGridNo != -1 ) - { - pSoldier->usActionData = sGridNo; - return( AI_ACTION_APPROACH_MERC ); - } - } - } + //////////////////////////////////////////////////////////////////////////// + // TAKE A BITE, PERHAPS + //////////////////////////////////////////////////////////////////////////// + if (pSoldier->aiData.bHunting) + { + pSoldier->aiData.usActionData = FindNearestRottingCorpse( pSoldier ); + // need smell/visibility check? + if (PythSpacesAway( pSoldier->sGridNo, pSoldier->aiData.usActionData) < MAX_EAT_DIST ) + { + INT16 sGridNo; - //////////////////////////////////////////////////////////////////////////// - // TRACK A SCENT, IF ONE IS PRESENT - //////////////////////////////////////////////////////////////////////////// - if (TrackScent( pSoldier )) + sGridNo = FindAdjacentGridEx( pSoldier, pSoldier->aiData.usActionData, &ubOpponentDir, &sAdjustedGridNo, FALSE, FALSE ); + + if ( sGridNo != -1 ) + { + pSoldier->aiData.usActionData = sGridNo; + return( AI_ACTION_APPROACH_MERC ); + } + } + } + + //////////////////////////////////////////////////////////////////////////// + // TRACK A SCENT, IF ONE IS PRESENT + //////////////////////////////////////////////////////////////////////////// + if (TrackScent( pSoldier )) { return( AI_ACTION_TRACK ); } - //////////////////////////////////////////////////////////////////////////// - // LOOK AROUND TOWARD CLOSEST KNOWN OPPONENT, IF KNOWN - //////////////////////////////////////////////////////////////////////////// - if (GetAPsToLook( pSoldier ) <= pSoldier->bActionPoints) - { - // determine the location of the known closest opponent - // (don't care if he's conscious, don't care if he's reachable at all) - sClosestOpponent = ClosestKnownOpponent(pSoldier, NULL, NULL); + //////////////////////////////////////////////////////////////////////////// + // LOOK AROUND TOWARD CLOSEST KNOWN OPPONENT, IF KNOWN + //////////////////////////////////////////////////////////////////////////// + if (GetAPsToLook( pSoldier ) <= pSoldier->bActionPoints) + { + // determine the location of the known closest opponent + // (don't care if he's conscious, don't care if he's reachable at all) + sClosestOpponent = ClosestKnownOpponent(pSoldier, NULL, NULL); - if (sClosestOpponent != NOWHERE) + if (sClosestOpponent != NOWHERE) { - // determine direction from this soldier to the closest opponent - ubOpponentDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sClosestOpponent),CenterY(sClosestOpponent)); + // determine direction from this soldier to the closest opponent + ubOpponentDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sClosestOpponent),CenterY(sClosestOpponent)); // if soldier is not already facing in that direction, // and the opponent is close enough that he could possibly be seen // note, have to change this to use the level returned from ClosestKnownOpponent sDistVisible = pSoldier->GetMaxDistanceVisible(sClosestOpponent, 0 ); - if ((pSoldier->ubDirection != ubOpponentDir) && (PythSpacesAway(pSoldier->sGridNo,sClosestOpponent) <= sDistVisible)) + if ((pSoldier->ubDirection != ubOpponentDir) && (PythSpacesAway(pSoldier->sGridNo,sClosestOpponent) <= sDistVisible)) { - // set base chance according to orders - if ((pSoldier->bOrders == STATIONARY) || (pSoldier->bOrders == ONGUARD)) - iChance = 50; - else // all other orders - iChance = 25; + // set base chance according to orders + if ((pSoldier->aiData.bOrders == STATIONARY) || (pSoldier->aiData.bOrders == ONGUARD)) + iChance = 50; + else // all other orders + iChance = 25; - if (pSoldier->bAttitude == DEFENSIVE) - iChance += 25; + if (pSoldier->aiData.bAttitude == DEFENSIVE) + iChance += 25; - //if ( (INT16)PreRandom(100) < iChance && InternalIsValidStance( pSoldier, ubOpponentDir, ANIM_STAND ) ) - if ( (INT16)PreRandom(100) < iChance && ValidCreatureTurn( pSoldier, ubOpponentDir ) ) - { - pSoldier->usActionData = ubOpponentDir; + //if ( (INT16)PreRandom(100) < iChance && pSoldier->InternalIsValidStance( ubOpponentDir, ANIM_STAND ) ) + if ( (INT16)PreRandom(100) < iChance && ValidCreatureTurn( pSoldier, ubOpponentDir ) ) + { + pSoldier->aiData.usActionData = ubOpponentDir; #ifdef DEBUGDECISIONS STR16 tempstr; - sprintf(tempstr,"%s - TURNS TOWARDS CLOSEST ENEMY to face direction %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - TURNS TOWARDS CLOSEST ENEMY to face direction %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif - return(AI_ACTION_CHANGE_FACING); + return(AI_ACTION_CHANGE_FACING); } } } @@ -893,7 +898,7 @@ INT8 CreatureDecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) AINameMessage(pSoldier,"- DOES NOTHING (RED)",1000); #endif - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return(AI_ACTION_NONE); } @@ -916,43 +921,43 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier ) // if we have absolutely no action points, we can't do a thing under BLACK! if (!pSoldier->bActionPoints) - { - pSoldier->usActionData = NOWHERE; - return(AI_ACTION_NONE); - } + { + pSoldier->aiData.usActionData = NOWHERE; + return(AI_ACTION_NONE); + } - if ( pSoldier->bMobility == CREATURE_CRAWLER && pSoldier->bActionPoints < pSoldier->bInitialActionPoints) + if ( pSoldier->aiData.bMobility == CREATURE_CRAWLER && pSoldier->bActionPoints < pSoldier->bInitialActionPoints) { return( AI_ACTION_NONE ); } //////////////////////////////////////////////////////////////////////////// // CALL FOR AID IF HURT OR IF OTHERS ARE UNAWARE - //////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////// if ( CAN_CALL( pSoldier ) ) { if ((pSoldier->bActionPoints >= AP_RADIO) && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1)) { - if (pSoldier->bLife < pSoldier->bOldLife) + if (pSoldier->stats.bLife < pSoldier->bOldLife) { // got injured, maybe call /* // don't call when crippled and have target... save breath for attacking! - if ((pSoldier->bOldLife == pSoldier->bLifeMax) && (pSoldier->bOldLife - pSoldier->bLife > 10)) + if ((pSoldier->bOldLife == pSoldier->stats.bLifeMax) && (pSoldier->bOldLife - pSoldier->stats.bLife > 10)) { // hurt for first time! - pSoldier->usActionData = CALL_CRIPPLED; - pSoldier->bOldLife = pSoldier->bLife; // don't want to call more than once + pSoldier->aiData.usActionData = CALL_CRIPPLED; + pSoldier->bOldLife = pSoldier->stats.bLife; // don't want to call more than once return(AI_ACTION_CREATURE_CALL); } - else + else */ - if (pSoldier->bLifeMax / pSoldier->bLife > 2) + if (pSoldier->stats.bLifeMax / pSoldier->stats.bLife > 2) { // crippled, 1/3 or less health! - pSoldier->usActionData = CALL_ATTACKED; - pSoldier->bOldLife = pSoldier->bLife; // don't want to call more than once + pSoldier->aiData.usActionData = CALL_ATTACKED; + pSoldier->bOldLife = pSoldier->stats.bLife; // don't want to call more than once return(AI_ACTION_CREATURE_CALL); } } @@ -966,20 +971,20 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier ) } else { - uiChance = 20 * pSoldier->bOppCnt; + uiChance = 20 * pSoldier->aiData.bOppCnt; } if ( Random( 100 ) < uiChance ) { // alert! alert! - if (pSoldier->bOppCnt > 1) + if (pSoldier->aiData.bOppCnt > 1) { - pSoldier->usActionData = CALL_MULTIPLE_PREY; + pSoldier->aiData.usActionData = CALL_MULTIPLE_PREY; } else { - pSoldier->usActionData = CALL_1_PREY; + pSoldier->aiData.usActionData = CALL_1_PREY; } - return(AI_ACTION_CREATURE_CALL); + return(AI_ACTION_CREATURE_CALL); } } } @@ -987,10 +992,10 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier ) } // can this guy move to any of the neighbouring squares ? (sets TRUE/FALSE) - ubCanMove = ((pSoldier->bMobility != CREATURE_IMMOBILE) && (pSoldier->bActionPoints >= MinPtsToMove(pSoldier))); + ubCanMove = ((pSoldier->aiData.bMobility != CREATURE_IMMOBILE) && (pSoldier->bActionPoints >= MinPtsToMove(pSoldier))); // determine if we happen to be in water (in which case we're in BIG trouble!) - //bInWater = MercInWater(pSoldier); + //bInWater = pSoldier->MercInWater(); // check if standing in tear gas without a gas mask on bInGas = InGas( pSoldier, pSoldier->sGridNo ); @@ -1002,26 +1007,26 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier ) // if we're desperately short on breath (it's OK if we're in water, though!) if (bInGas || (pSoldier->bBreath < 5)) - { - // if soldier has enough APs left to move at least 1 square's worth - if (ubCanMove) - { - // look for best place to RUN AWAY to (farthest from the closest threat) - pSoldier->usActionData = FindSpotMaxDistFromOpponents(pSoldier); + { + // if soldier has enough APs left to move at least 1 square's worth + if (ubCanMove) + { + // look for best place to RUN AWAY to (farthest from the closest threat) + pSoldier->aiData.usActionData = FindSpotMaxDistFromOpponents(pSoldier); - if (pSoldier->usActionData != NOWHERE) - { + if (pSoldier->aiData.usActionData != NOWHERE) + { #ifdef DEBUGDECISIONS STR16 tempstr; - sprintf(tempstr,"%s - GASSED or LOW ON BREATH (%d), RUNNING AWAY to grid %d",pSoldier->name,pSoldier->bBreath,pSoldier->usActionData); + sprintf(tempstr,"%s - GASSED or LOW ON BREATH (%d), RUNNING AWAY to grid %d",pSoldier->name,pSoldier->bBreath,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif - return(AI_ACTION_RUN_AWAY); - } - } + return(AI_ACTION_RUN_AWAY); + } + } - } + } //////////////////////////////////////////////////////////////////////////// @@ -1030,19 +1035,19 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier ) // if soldier in water/gas has enough APs left to move at least 1 square if ((/*bInWater ||*/ bInGas) && ubCanMove) - { - pSoldier->usActionData = FindNearestUngassedLand(pSoldier); + { + pSoldier->aiData.usActionData = FindNearestUngassedLand(pSoldier); - if (pSoldier->usActionData != NOWHERE) - { + if (pSoldier->aiData.usActionData != NOWHERE) + { #ifdef DEBUGDECISIONS STR16 tempstr; - sprintf(tempstr,"%s - SEEKING NEAREST UNGASSED LAND at grid %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - SEEKING NEAREST UNGASSED LAND at grid %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif - return(AI_ACTION_LEAVE_WATER_GAS); - } + return(AI_ACTION_LEAVE_WATER_GAS); + } } //////////////////////////////////////////////////////////////////////////// @@ -1096,8 +1101,8 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier ) } - BestShot.ubPossible = FALSE; // by default, assume Shooting isn't possible - BestStab.ubPossible = FALSE; // by default, assume Stabbing isn't possible + BestShot.ubPossible = FALSE; // by default, assume Shooting isn't possible + BestStab.ubPossible = FALSE; // by default, assume Stabbing isn't possible BestAttack.ubChanceToReallyHit = 0; @@ -1111,15 +1116,15 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier ) // FIRE A GUN AT AN OPPONENT ////////////////////////////////////////////////////////////////////////// - pSoldier->bAimShotLocation = AIM_SHOT_RANDOM; + pSoldier->bAimShotLocation = AIM_SHOT_RANDOM; bWeaponIn = FindObjClass( pSoldier, IC_GUN ); if (bWeaponIn != NO_SLOT) { - if (Item[pSoldier->inv[bWeaponIn].usItem].usItemClass == IC_GUN && pSoldier->inv[bWeaponIn].ItemData.Gun.bGunStatus >= USABLE) + if (Item[pSoldier->inv[bWeaponIn].usItem].usItemClass == IC_GUN && pSoldier->inv[bWeaponIn][0]->data.gun.bGunStatus >= USABLE) { - if (pSoldier->inv[bWeaponIn].ItemData.Gun.ubGunShotsLeft > 0) + if (pSoldier->inv[bWeaponIn][0]->data.gun.ubGunShotsLeft > 0) { bSpitIn = bWeaponIn; // if it's in another pocket, swap it into his hand temporarily @@ -1146,12 +1151,12 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier ) // if the selected opponent is not a threat (unconscious & !serviced) // (usually, this means all the guys we see our unconscious, but, on - // rare occasions, we may not be able to shoot a healthy guy, too) - if ((Menptr[BestShot.ubOpponent].bLife < OKLIFE) && + // rare occasions, we may not be able to shoot a healthy guy, too) + if ((Menptr[BestShot.ubOpponent].stats.bLife < OKLIFE) && !Menptr[BestShot.ubOpponent].bService) { // if our attitude is NOT aggressive - if (pSoldier->bAttitude != AGGRESSIVE) + if (pSoldier->aiData.bAttitude != AGGRESSIVE) { // get the location of the closest CONSCIOUS reachable opponent sClosestDisturbance = ClosestReachableDisturbance(pSoldier,FALSE,&fChangeLevel); @@ -1253,21 +1258,21 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier ) if (pSoldier->bActionPoints >= ubMinAPCost) { // then look around for a worthy target (which sets BestStab.ubPossible) - - if (pSoldier->ubBodyType == QUEENMONSTER) - { + + if (pSoldier->ubBodyType == QUEENMONSTER) + { CalcTentacleAttack( pSoldier, &CurrStab ); - } - else - { + } + else + { CalcBestStab(pSoldier, &CurrStab, TRUE); - } + } if (CurrStab.ubPossible) { // now we KNOW FOR SURE that we will do something (stab, at least) NPCDoesAct(pSoldier); - } + } // if it was in his holster, swap it back into his holster for now if (bWeaponIn != HANDPOS) @@ -1315,16 +1320,16 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier ) memcpy(&BestAttack,&BestShot,sizeof(BestAttack)); break; - case AI_ACTION_KNIFE_MOVE: - memcpy(&BestAttack,&BestStab,sizeof(BestAttack)); - break; + case AI_ACTION_KNIFE_MOVE: + memcpy(&BestAttack,&BestStab,sizeof(BestAttack)); + break; } - // if necessary, swap the weapon into the hand position + // if necessary, swap the weapon into the hand position if (BestAttack.bWeaponIn != HANDPOS) { - // IS THIS NOT BEING SET RIGHT????? + // IS THIS NOT BEING SET RIGHT????? DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"creaturedecideactionblack: swapping best weapon into hand"); RearrangePocket(pSoldier,HANDPOS,BestAttack.bWeaponIn,FOREVER); } @@ -1333,8 +1338,8 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier ) // GO AHEAD & ATTACK! ////////////////////////////////////////////////////////////////////////// - pSoldier->usActionData = BestAttack.sTarget; - pSoldier->bAimTime = BestAttack.ubAimTime; + pSoldier->aiData.usActionData = BestAttack.sTarget; + pSoldier->aiData.bAimTime = BestAttack.ubAimTime; if ( ubBestAttackAction == AI_ACTION_FIRE_GUN && BestAttack.ubChanceToReallyHit > 50 ) { @@ -1356,7 +1361,7 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier ) #endif return(ubBestAttackAction); - + } } @@ -1368,73 +1373,73 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier ) if ( !fRunAway ) { - if ( (GetAPsToLook( pSoldier ) <= pSoldier->bActionPoints) ) - { - // determine the location of the known closest opponent - // (don't care if he's conscious, don't care if he's reachable at all) - sClosestOpponent = ClosestKnownOpponent(pSoldier, NULL, NULL); - // if we have a closest reachable opponent - if (sClosestOpponent != NOWHERE) - { + if ( (GetAPsToLook( pSoldier ) <= pSoldier->bActionPoints) ) + { + // determine the location of the known closest opponent + // (don't care if he's conscious, don't care if he's reachable at all) + sClosestOpponent = ClosestKnownOpponent(pSoldier, NULL, NULL); + // if we have a closest reachable opponent + if (sClosestOpponent != NOWHERE) + { if ( ubCanMove && PythSpacesAway( pSoldier->sGridNo, sClosestOpponent ) > 2 ) { if ( bSpitIn != NO_SLOT ) { - pSoldier->usActionData = AdvanceToFiringRange( pSoldier, sClosestOpponent ); - if (pSoldier->usActionData == NOWHERE) + pSoldier->aiData.usActionData = AdvanceToFiringRange( pSoldier, sClosestOpponent ); + if (pSoldier->aiData.usActionData == NOWHERE) { - pSoldier->usActionData = GoAsFarAsPossibleTowards(pSoldier,sClosestOpponent,AI_ACTION_SEEK_OPPONENT); + pSoldier->aiData.usActionData = GoAsFarAsPossibleTowards(pSoldier,sClosestOpponent,AI_ACTION_SEEK_OPPONENT); } } else { - pSoldier->usActionData = GoAsFarAsPossibleTowards(pSoldier,sClosestOpponent,AI_ACTION_SEEK_OPPONENT); + pSoldier->aiData.usActionData = GoAsFarAsPossibleTowards(pSoldier,sClosestOpponent,AI_ACTION_SEEK_OPPONENT); } } else { - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; } - if (pSoldier->usActionData != NOWHERE) // charge! + if (pSoldier->aiData.usActionData != NOWHERE) // charge! { return( AI_ACTION_SEEK_OPPONENT ); } else if (GetAPsToLook( pSoldier ) <= pSoldier->bActionPoints) // turn to face enemy { - bDirection = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sClosestOpponent),CenterY(sClosestOpponent)); + bDirection = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sClosestOpponent),CenterY(sClosestOpponent)); - // if we're not facing towards him - if (pSoldier->ubDirection != bDirection && ValidCreatureTurn( pSoldier, bDirection ) ) - { - pSoldier->usActionData = bDirection; + // if we're not facing towards him + if (pSoldier->ubDirection != bDirection && ValidCreatureTurn( pSoldier, bDirection ) ) + { + pSoldier->aiData.usActionData = bDirection; #ifdef DEBUGDECISIONS STR16 tempstr; - sprintf(tempstr,"%s - TURNS to face CLOSEST OPPONENT in direction %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - TURNS to face CLOSEST OPPONENT in direction %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif - return(AI_ACTION_CHANGE_FACING); - } + return(AI_ACTION_CHANGE_FACING); } - } - } + } + } + } } else { // run away! - if ( ubCanMove ) - { - // look for best place to RUN AWAY to (farthest from the closest threat) - //pSoldier->usActionData = RunAway( pSoldier ); - pSoldier->usActionData = FindSpotMaxDistFromOpponents( pSoldier ); + if ( ubCanMove ) + { + // look for best place to RUN AWAY to (farthest from the closest threat) + //pSoldier->aiData.usActionData = RunAway( pSoldier ); + pSoldier->aiData.usActionData = FindSpotMaxDistFromOpponents( pSoldier ); - if (pSoldier->usActionData != NOWHERE) - { - return(AI_ACTION_RUN_AWAY); - } - } + if (pSoldier->aiData.usActionData != NOWHERE) + { + return(AI_ACTION_RUN_AWAY); + } + } } //////////////////////////////////////////////////////////////////////////// @@ -1446,7 +1451,7 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier ) #endif // by default, if everything else fails, just stand in place and wait - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return(AI_ACTION_NONE); } @@ -1458,7 +1463,7 @@ INT8 CreatureDecideAction( SOLDIERTYPE *pSoldier ) { INT8 bAction = AI_ACTION_NONE; - switch (pSoldier->bAlertStatus) + switch (pSoldier->aiData.bAlertStatus) { case STATUS_GREEN: #ifdef DEBUGDECISIONS @@ -1491,7 +1496,7 @@ INT8 CreatureDecideAction( SOLDIERTYPE *pSoldier ) #ifdef DEBUGDECISIONS STR tempstr; - sprintf( tempstr, "DecideAction: selected action %d, actionData %d\n\n",bAction,pSoldier->usActionData ); + sprintf( tempstr, "DecideAction: selected action %d, actionData %d\n\n",bAction,pSoldier->aiData.usActionData ); DebugAI(tempstr); #endif @@ -1518,13 +1523,13 @@ void CreatureDecideAlertStatus( SOLDIERTYPE *pSoldier ) case AM_MONSTER: case YAM_MONSTER: case INFANT_MONSTER: - pSoldier->bMobility = CREATURE_MOBILE; + pSoldier->aiData.bMobility = CREATURE_MOBILE; break; case QUEENMONSTER: - pSoldier->bMobility = CREATURE_IMMOBILE; + pSoldier->aiData.bMobility = CREATURE_IMMOBILE; break; case LARVAE_MONSTER: - pSoldier->bMobility = CREATURE_CRAWLER; + pSoldier->aiData.bMobility = CREATURE_CRAWLER; break; } @@ -1532,15 +1537,15 @@ void CreatureDecideAlertStatus( SOLDIERTYPE *pSoldier ) if (pSoldier->ubBodyType == LARVAE_MONSTER) { // larvae never do anything much! - pSoldier->bAlertStatus = STATUS_GREEN; + pSoldier->aiData.bAlertStatus = STATUS_GREEN; return; } // save the man's previous status - bOldStatus = pSoldier->bAlertStatus; + bOldStatus = pSoldier->aiData.bAlertStatus; // determine the current alert status for this category of man - if (pSoldier->bOppCnt > 0) // opponent(s) in sight + if (pSoldier->aiData.bOppCnt > 0) // opponent(s) in sight { // must search through list of people to see if any of them have // attacked us, or do some check to see if we have been attacked @@ -1548,13 +1553,13 @@ void CreatureDecideAlertStatus( SOLDIERTYPE *pSoldier ) { case STATUS_GREEN: case STATUS_YELLOW: - pSoldier->bAlertStatus = STATUS_BLACK; + pSoldier->aiData.bAlertStatus = STATUS_BLACK; break; case STATUS_RED: case STATUS_BLACK: - pSoldier->bAlertStatus = STATUS_BLACK; + pSoldier->aiData.bAlertStatus = STATUS_BLACK; } - + } else // no opponents are in sight { @@ -1562,7 +1567,7 @@ void CreatureDecideAlertStatus( SOLDIERTYPE *pSoldier ) { case STATUS_BLACK: // then drop back to RED status - pSoldier->bAlertStatus = STATUS_RED; + pSoldier->aiData.bAlertStatus = STATUS_RED; break; case STATUS_RED: @@ -1571,28 +1576,28 @@ void CreatureDecideAlertStatus( SOLDIERTYPE *pSoldier ) case STATUS_YELLOW: // if all enemies have been RED alerted, or we're under fire - if (gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition || pSoldier->bUnderFire) + if (gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition || pSoldier->aiData.bUnderFire) { - pSoldier->bAlertStatus = STATUS_RED; + pSoldier->aiData.bAlertStatus = STATUS_RED; } else { // if we are NOT aware of any uninvestigated noises right now // and we are not currently in the middle of an action // (could still be on his way heading to investigate a noise!) - if ((MostImportantNoiseHeard(pSoldier,&iDummy,&fClimbDummy,&fReachableDummy) == NOWHERE) && !pSoldier->bActionInProgress) + if ((MostImportantNoiseHeard(pSoldier,&iDummy,&fClimbDummy,&fReachableDummy) == NOWHERE) && !pSoldier->aiData.bActionInProgress) { // then drop back to GREEN status - pSoldier->bAlertStatus = STATUS_GREEN; + pSoldier->aiData.bAlertStatus = STATUS_GREEN; } } break; case STATUS_GREEN: // if all enemies have been RED alerted, or we're under fire - if (gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition || pSoldier->bUnderFire) + if (gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition || pSoldier->aiData.bUnderFire) { - pSoldier->bAlertStatus = STATUS_RED; + pSoldier->aiData.bAlertStatus = STATUS_RED; } else { @@ -1600,27 +1605,27 @@ void CreatureDecideAlertStatus( SOLDIERTYPE *pSoldier ) if (MostImportantNoiseHeard(pSoldier,&iDummy,&fClimbDummy,&fReachableDummy) != NOWHERE) { // then move up to YELLOW status - pSoldier->bAlertStatus = STATUS_YELLOW; + pSoldier->aiData.bAlertStatus = STATUS_YELLOW; } } break; } - // otherwise, RED stays RED, YELLOW stays YELLOW, GREEN stays GREEN + // otherwise, RED stays RED, YELLOW stays YELLOW, GREEN stays GREEN } // if the creatures alert status has changed in any way - if (pSoldier->bAlertStatus != bOldStatus) + if (pSoldier->aiData.bAlertStatus != bOldStatus) { // HERE ARE TRYING TO AVOID NPCs SHUFFLING BACK & FORTH BETWEEN RED & BLACK // if either status is < RED (ie. anything but RED->BLACK && BLACK->RED) - if ((bOldStatus < STATUS_RED) || (pSoldier->bAlertStatus < STATUS_RED)) + if ((bOldStatus < STATUS_RED) || (pSoldier->aiData.bAlertStatus < STATUS_RED)) { // force a NEW action decision on next pass through HandleManAI() SetNewSituation( pSoldier ); } // if this guy JUST discovered that there were opponents here for sure... - if ((bOldStatus < STATUS_RED) && (pSoldier->bAlertStatus >= STATUS_RED)) + if ((bOldStatus < STATUS_RED) && (pSoldier->aiData.bAlertStatus >= STATUS_RED)) { // might want to make custom to let them go anywhere CheckForChangingOrders(pSoldier); @@ -1632,34 +1637,34 @@ void CreatureDecideAlertStatus( SOLDIERTYPE *pSoldier ) // { STR16 tempstr; sprintf(tempstr,"%s's Alert Status changed from %d to %d", - pSoldier->name ,bOldStatus,pSoldier->bAlertStatus); + pSoldier->name ,bOldStatus,pSoldier->aiData.bAlertStatus); AIPopMessage(tempstr); // } #endif } - else // status didn't change + else // status didn't change { // if a guy on status GREEN or YELLOW is running low on breath - if (((pSoldier->bAlertStatus == STATUS_GREEN) && (pSoldier->bBreath < 75)) || - ((pSoldier->bAlertStatus == STATUS_YELLOW) && (pSoldier->bBreath < 50))) + if (((pSoldier->aiData.bAlertStatus == STATUS_GREEN) && (pSoldier->bBreath < 75)) || + ((pSoldier->aiData.bAlertStatus == STATUS_YELLOW) && (pSoldier->bBreath < 50))) { // as long as he's not in water (standing on a bridge is OK) - if (!MercInWater(pSoldier)) + if (!pSoldier->MercInWater()) { // force a NEW decision so that he can get some rest SetNewSituation( pSoldier ); // current action will be canceled. if noise is no longer important - if ((pSoldier->bAlertStatus == STATUS_YELLOW) && + if ((pSoldier->aiData.bAlertStatus == STATUS_YELLOW) && (MostImportantNoiseHeard(pSoldier,&iDummy,&fClimbDummy,&fReachableDummy) == NOWHERE)) { // then drop back to GREEN status - pSoldier->bAlertStatus = STATUS_GREEN; + pSoldier->aiData.bAlertStatus = STATUS_GREEN; CheckForChangingOrders(pSoldier); } } - } + } } } @@ -1672,7 +1677,7 @@ INT8 CrowDecideActionRed( SOLDIERTYPE * pSoldier ) //HandleCrowFlyAway( pSoldier ); if (!gfTurnBasedAI) { - pSoldier->usActionData = 30000; + pSoldier->aiData.usActionData = 30000; return( AI_ACTION_WAIT ); } else @@ -1693,36 +1698,36 @@ INT8 CrowDecideActionGreen( SOLDIERTYPE * pSoldier ) if ( sCorpseGridNo != NOWHERE ) { - // Are we close, if so , peck! - if ( SpacesAway( pSoldier->sGridNo, sCorpseGridNo ) < 2 ) - { - // Change facing - sFacingDir = GetDirectionFromGridNo( sCorpseGridNo, pSoldier ); + // Are we close, if so , peck! + if ( SpacesAway( pSoldier->sGridNo, sCorpseGridNo ) < 2 ) + { + // Change facing + sFacingDir = GetDirectionFromGridNo( sCorpseGridNo, pSoldier ); if ( sFacingDir != pSoldier->ubDirection ) { - pSoldier->usActionData = sFacingDir; - return(AI_ACTION_CHANGE_FACING); + pSoldier->aiData.usActionData = sFacingDir; + return(AI_ACTION_CHANGE_FACING); } else if (!gfTurnBasedAI) { - pSoldier->usActionData = 30000; + pSoldier->aiData.usActionData = 30000; return( AI_ACTION_WAIT ); } else { return( AI_ACTION_NONE ); } - } - else - { - // Walk to nearest one! - pSoldier->usActionData = FindGridNoFromSweetSpot( pSoldier, sCorpseGridNo, 4, &ubDirection ); - if ( pSoldier->usActionData != NOWHERE ) - { - return( AI_ACTION_GET_CLOSER ); - } - } + } + else + { + // Walk to nearest one! + pSoldier->aiData.usActionData = FindGridNoFromSweetSpot( pSoldier, sCorpseGridNo, 4, &ubDirection ); + if ( pSoldier->aiData.usActionData != NOWHERE ) + { + return( AI_ACTION_GET_CLOSER ); + } + } } return( AI_ACTION_NONE ); @@ -1735,7 +1740,7 @@ INT8 CrowDecideAction( SOLDIERTYPE * pSoldier ) return( AI_ACTION_NONE ); } - switch( pSoldier->bAlertStatus ) + switch( pSoldier->aiData.bAlertStatus ) { case STATUS_GREEN: case STATUS_YELLOW: @@ -1749,4 +1754,4 @@ INT8 CrowDecideAction( SOLDIERTYPE * pSoldier ) Assert( FALSE ); return( AI_ACTION_NONE ); } -} \ No newline at end of file +} diff --git a/TacticalAI/DecideAction.cpp b/TacticalAI/DecideAction.cpp index ccbfd4a7..d630e18b 100644 --- a/TacticalAI/DecideAction.cpp +++ b/TacticalAI/DecideAction.cpp @@ -62,7 +62,7 @@ UINT32 guiRedSeekCounter = 0, guiRedHelpCounter = 0; guiRedHideCounter = 0; void DoneScheduleAction( SOLDIERTYPE * pSoldier ) { - pSoldier->fAIFlags &= (~AI_CHECK_SCHEDULE); + pSoldier->aiData.fAIFlags &= (~AI_CHECK_SCHEDULE); pSoldier->bAIScheduleProgress = 0; PostNextSchedule( pSoldier ); } @@ -112,7 +112,7 @@ INT8 DecideActionSchedule( SOLDIERTYPE * pSoldier ) usGridNo2 = pSchedule->usData2[ iScheduleIndex ]; // assume soldier is awake unless the action is a sleep - pSoldier->fAIFlags &= ~(AI_ASLEEP); + pSoldier->aiData.fAIFlags &= ~(AI_ASLEEP); switch( ubScheduleAction ) { @@ -132,8 +132,8 @@ INT8 DecideActionSchedule( SOLDIERTYPE * pSoldier ) } else { - pSoldier->usActionData = usGridNo1; - pSoldier->sAbsoluteFinalDestination = pSoldier->usActionData; + pSoldier->aiData.usActionData = usGridNo1; + pSoldier->sAbsoluteFinalDestination = pSoldier->aiData.usActionData; return( AI_ACTION_SCHEDULE_MOVE ); } // fall through @@ -168,7 +168,7 @@ INT8 DecideActionSchedule( SOLDIERTYPE * pSoldier ) { // not only do we have to lock the door but // close it too! - pSoldier->fAIFlags |= AI_LOCK_DOOR_INCLUDES_CLOSE; + pSoldier->aiData.fAIFlags |= AI_LOCK_DOOR_INCLUDES_CLOSE; } else { @@ -197,7 +197,7 @@ INT8 DecideActionSchedule( SOLDIERTYPE * pSoldier ) if (fDoUseDoor) { - pSoldier->usActionData = usGridNo1; + pSoldier->aiData.usActionData = usGridNo1; return( AI_ACTION_LOCK_DOOR ); } @@ -213,7 +213,7 @@ INT8 DecideActionSchedule( SOLDIERTYPE * pSoldier ) if ( pSoldier->sGridNo != NOWHERE ) { - pSoldier->usPatrolGrid[0] = pSoldier->sGridNo; + pSoldier->aiData.sPatrolGrid[0] = pSoldier->sGridNo; } } else @@ -223,8 +223,8 @@ INT8 DecideActionSchedule( SOLDIERTYPE * pSoldier ) // told to go to edge of map, so go off at that point! pSoldier->ubQuoteActionID = GetTraversalQuoteActionID( bDirection ); } - pSoldier->usActionData = usGridNo2; - pSoldier->sAbsoluteFinalDestination = pSoldier->usActionData; + pSoldier->aiData.usActionData = usGridNo2; + pSoldier->sAbsoluteFinalDestination = pSoldier->aiData.usActionData; return( AI_ACTION_SCHEDULE_MOVE ); } break; @@ -248,8 +248,8 @@ INT8 DecideActionSchedule( SOLDIERTYPE * pSoldier ) } else { - pSoldier->usActionData = usGridNo1; - pSoldier->sAbsoluteFinalDestination = pSoldier->usActionData; + pSoldier->aiData.usActionData = usGridNo1; + pSoldier->sAbsoluteFinalDestination = pSoldier->aiData.usActionData; return( AI_ACTION_SCHEDULE_MOVE ); } // fall through @@ -335,7 +335,7 @@ INT8 DecideActionSchedule( SOLDIERTYPE * pSoldier ) if (fDoUseDoor) { - pSoldier->usActionData = usGridNo1; + pSoldier->aiData.usActionData = usGridNo1; if (ubScheduleAction == SCHEDULE_ACTION_UNLOCKDOOR) { return( AI_ACTION_UNLOCK_DOOR ); @@ -357,7 +357,7 @@ INT8 DecideActionSchedule( SOLDIERTYPE * pSoldier ) DoneScheduleAction( pSoldier ); if ( pSoldier->sGridNo != NOWHERE ) { - pSoldier->usPatrolGrid[0] = pSoldier->sGridNo; + pSoldier->aiData.sPatrolGrid[0] = pSoldier->sGridNo; } } else @@ -367,8 +367,8 @@ INT8 DecideActionSchedule( SOLDIERTYPE * pSoldier ) // told to go to edge of map, so go off at that point! pSoldier->ubQuoteActionID = GetTraversalQuoteActionID( bDirection ); } - pSoldier->usActionData = usGridNo2; - pSoldier->sAbsoluteFinalDestination = pSoldier->usActionData; + pSoldier->aiData.usActionData = usGridNo2; + pSoldier->sAbsoluteFinalDestination = pSoldier->aiData.usActionData; return( AI_ACTION_SCHEDULE_MOVE ); } break; @@ -383,14 +383,14 @@ INT8 DecideActionSchedule( SOLDIERTYPE * pSoldier ) DoneScheduleAction( pSoldier ); if ( pSoldier->sGridNo != NOWHERE ) { - pSoldier->usPatrolGrid[0] = pSoldier->sGridNo; + pSoldier->aiData.sPatrolGrid[0] = pSoldier->sGridNo; } } else { // move! - pSoldier->usActionData = usGridNo1; - pSoldier->sAbsoluteFinalDestination = pSoldier->usActionData; + pSoldier->aiData.usActionData = usGridNo1; + pSoldier->sAbsoluteFinalDestination = pSoldier->aiData.usActionData; return( AI_ACTION_SCHEDULE_MOVE ); } break; @@ -400,9 +400,9 @@ INT8 DecideActionSchedule( SOLDIERTYPE * pSoldier ) { case 0: // start the action - pSoldier->usActionData = FindNearestEdgePoint( pSoldier->sGridNo ); + pSoldier->aiData.usActionData = FindNearestEdgePoint( pSoldier->sGridNo ); - if (pSoldier->usActionData == NOWHERE) + if (pSoldier->aiData.usActionData == NOWHERE) { #ifdef JA2BETAVERSION ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Civilian could not find path to map edge!" ); @@ -411,7 +411,7 @@ INT8 DecideActionSchedule( SOLDIERTYPE * pSoldier ) return( AI_ACTION_NONE ); } - if ( pSoldier->sGridNo == pSoldier->usActionData ) + if ( pSoldier->sGridNo == pSoldier->aiData.usActionData ) { // time to go off the map pSoldier->bAIScheduleProgress++; @@ -419,7 +419,7 @@ INT8 DecideActionSchedule( SOLDIERTYPE * pSoldier ) else { // move! - pSoldier->sAbsoluteFinalDestination = pSoldier->usActionData; + pSoldier->sAbsoluteFinalDestination = pSoldier->aiData.usActionData; return( AI_ACTION_SCHEDULE_MOVE ); } @@ -427,8 +427,8 @@ INT8 DecideActionSchedule( SOLDIERTYPE * pSoldier ) case 1: // near edge - pSoldier->usActionData = FindNearbyPointOnEdgeOfMap( pSoldier, &bDirection ); - if (pSoldier->usActionData == NOWHERE) + pSoldier->aiData.usActionData = FindNearbyPointOnEdgeOfMap( pSoldier, &bDirection ); + if (pSoldier->aiData.usActionData == NOWHERE) { // what the heck?? // ABORT! @@ -438,7 +438,7 @@ INT8 DecideActionSchedule( SOLDIERTYPE * pSoldier ) { pSoldier->ubQuoteActionID = GetTraversalQuoteActionID( bDirection ); pSoldier->bAIScheduleProgress++; - pSoldier->sAbsoluteFinalDestination = pSoldier->usActionData; + pSoldier->sAbsoluteFinalDestination = pSoldier->aiData.usActionData; return( AI_ACTION_SCHEDULE_MOVE ); } break; @@ -464,12 +464,12 @@ INT8 DecideActionSchedule( SOLDIERTYPE * pSoldier ) case 0: sX = CenterX( pSoldier->sOffWorldGridNo ); sY = CenterY( pSoldier->sOffWorldGridNo ); - EVENT_SetSoldierPosition( pSoldier, sX, sY ); + pSoldier->EVENT_SetSoldierPosition( sX, sY ); pSoldier->bInSector = TRUE; MoveSoldierFromAwayToMercSlot( pSoldier ); - pSoldier->usActionData = usGridNo1; + pSoldier->aiData.usActionData = usGridNo1; pSoldier->bAIScheduleProgress++; - pSoldier->sAbsoluteFinalDestination = pSoldier->usActionData; + pSoldier->sAbsoluteFinalDestination = pSoldier->aiData.usActionData; return( AI_ACTION_SCHEDULE_MOVE ); case 1: if (pSoldier->sGridNo == usGridNo1) @@ -477,13 +477,13 @@ INT8 DecideActionSchedule( SOLDIERTYPE * pSoldier ) DoneScheduleAction( pSoldier ); if ( pSoldier->sGridNo != NOWHERE ) { - pSoldier->usPatrolGrid[0] = pSoldier->sGridNo; + pSoldier->aiData.sPatrolGrid[0] = pSoldier->sGridNo; } } else { - pSoldier->usActionData = usGridNo1; - pSoldier->sAbsoluteFinalDestination = pSoldier->usActionData; + pSoldier->aiData.usActionData = usGridNo1; + pSoldier->sAbsoluteFinalDestination = pSoldier->aiData.usActionData; return( AI_ACTION_SCHEDULE_MOVE ); } break; @@ -496,12 +496,12 @@ INT8 DecideActionSchedule( SOLDIERTYPE * pSoldier ) { // th-th-th-that's it! DoneScheduleAction( pSoldier ); - pSoldier->usPatrolGrid[0] = pSoldier->sGridNo; + pSoldier->aiData.sPatrolGrid[0] = pSoldier->sGridNo; } else { - pSoldier->usActionData = pSoldier->sInitialGridNo; - pSoldier->sAbsoluteFinalDestination = pSoldier->usActionData; + pSoldier->aiData.usActionData = pSoldier->sInitialGridNo; + pSoldier->sAbsoluteFinalDestination = pSoldier->aiData.usActionData; return( AI_ACTION_SCHEDULE_MOVE ); } break; @@ -511,17 +511,17 @@ INT8 DecideActionSchedule( SOLDIERTYPE * pSoldier ) if (pSoldier->sGridNo == usGridNo1) { // Sleep - pSoldier->fAIFlags |= AI_ASLEEP; + pSoldier->aiData.fAIFlags |= AI_ASLEEP; DoneScheduleAction( pSoldier ); if ( pSoldier->sGridNo != NOWHERE ) { - pSoldier->usPatrolGrid[0] = pSoldier->sGridNo; + pSoldier->aiData.sPatrolGrid[0] = pSoldier->sGridNo; } } else { - pSoldier->usActionData = usGridNo1; - pSoldier->sAbsoluteFinalDestination = pSoldier->usActionData; + pSoldier->aiData.usActionData = usGridNo1; + pSoldier->sAbsoluteFinalDestination = pSoldier->aiData.usActionData; return( AI_ACTION_SCHEDULE_MOVE ); } break; @@ -552,13 +552,13 @@ INT8 DecideActionBoxerEnteringRing(SOLDIERTYPE *pSoldier) ubDesiredMercDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sDesiredMercLoc),CenterY(sDesiredMercLoc)); // if not already facing in that direction, - if ( pSoldier->ubDirection != ubDesiredMercDir && InternalIsValidStance( pSoldier, ubDesiredMercDir, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) ) + if ( pSoldier->ubDirection != ubDesiredMercDir && pSoldier->InternalIsValidStance( ubDesiredMercDir, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) ) { - pSoldier->usActionData = ubDesiredMercDir; + pSoldier->aiData.usActionData = ubDesiredMercDir; #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - TURNS TOWARDS CLOSEST PC to face direction %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - TURNS TOWARDS CLOSEST PC to face direction %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif @@ -570,7 +570,7 @@ INT8 DecideActionBoxerEnteringRing(SOLDIERTYPE *pSoldier) else { // move to starting spot - pSoldier->usActionData = FindClosestBoxingRingSpot( pSoldier, TRUE ); + pSoldier->aiData.usActionData = FindClosestBoxingRingSpot( pSoldier, TRUE ); return( AI_ACTION_GET_CLOSER ); } } @@ -604,7 +604,7 @@ INT8 DecideActionNamedNPC( SOLDIERTYPE * pSoldier ) // see if this triggers a conversation/NPC record PCsNearNPC( pSoldier->ubProfile ); // clear "handle every frame" flag - pSoldier->fAIFlags &= (~AI_HANDLE_EVERY_FRAME); + pSoldier->aiData.fAIFlags &= (~AI_HANDLE_EVERY_FRAME); return( AI_ACTION_ABSOLUTELY_NONE ); } @@ -612,13 +612,13 @@ INT8 DecideActionNamedNPC( SOLDIERTYPE * pSoldier ) ubDesiredMercDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sDesiredMercLoc),CenterY(sDesiredMercLoc)); // if not already facing in that direction, - if (pSoldier->ubDirection != ubDesiredMercDir && InternalIsValidStance( pSoldier, ubDesiredMercDir, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) ) + if (pSoldier->ubDirection != ubDesiredMercDir && pSoldier->InternalIsValidStance( ubDesiredMercDir, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) ) { - pSoldier->usActionData = ubDesiredMercDir; + pSoldier->aiData.usActionData = ubDesiredMercDir; #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - TURNS TOWARDS CLOSEST PC to face direction %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - TURNS TOWARDS CLOSEST PC to face direction %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif @@ -635,8 +635,8 @@ INT8 DecideActionNamedNPC( SOLDIERTYPE * pSoldier ) /////////////// // CHECK TO SEE IF WE WANT TO GO UP TO PERSON AND SAY SOMETHING /////////////// - pSoldier->usActionData = NPCConsiderInitiatingConv( pSoldier, &ubDesiredMerc ); - if (pSoldier->usActionData != NOWHERE) + pSoldier->aiData.usActionData = NPCConsiderInitiatingConv( pSoldier, &ubDesiredMerc ); + if (pSoldier->aiData.usActionData != NOWHERE) { return( AI_ACTION_APPROACH_MERC ); } @@ -657,13 +657,13 @@ INT8 DecideActionNamedNPC( SOLDIERTYPE * pSoldier ) { AddToShouldBecomeHostileOrSayQuoteList( pSoldier->ubID ); // now wait a bit! - pSoldier->usActionData = 5000; + pSoldier->aiData.usActionData = 5000; return( AI_ACTION_WAIT ); } else { - pSoldier->usActionData = GoAsFarAsPossibleTowards( pSoldier, sDesiredMercLoc, AI_ACTION_APPROACH_MERC ); - if ( pSoldier->usActionData != NOWHERE ) + pSoldier->aiData.usActionData = GoAsFarAsPossibleTowards( pSoldier, sDesiredMercLoc, AI_ACTION_APPROACH_MERC ); + if ( pSoldier->aiData.usActionData != NOWHERE ) { return( AI_ACTION_APPROACH_MERC ); } @@ -686,16 +686,16 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) STR16 tempstr; #endif - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen, orders = %d",pSoldier->bOrders)); + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen, orders = %d",pSoldier->aiData.bOrders)); - 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->aiData.bNeutral || (pSoldier->ubBodyType >= FATCIV && pSoldier->ubBodyType <= CRIPPLECIV) ) ); BOOLEAN fCivilianOrMilitia = PTR_CIV_OR_MILITIA; gubNPCPathCount = 0; if ( gTacticalStatus.bBoxingState != NOT_BOXING ) { - if (pSoldier->uiStatusFlags & SOLDIER_BOXER) + if (pSoldier->flags.uiStatusFlags & SOLDIER_BOXER) { if ( gTacticalStatus.bBoxingState == PRE_BOXING ) { @@ -716,20 +716,20 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) if (pSoldier->ubID == gubBoxerID[ ubLoop ]) { // we should go back where we started - pSoldier->usActionData = gsBoxerGridNo[ ubLoop ]; + pSoldier->aiData.usActionData = gsBoxerGridNo[ ubLoop ]; return( AI_ACTION_GET_CLOSER ); } } - pSoldier->usActionData = FindClosestBoxingRingSpot( pSoldier, FALSE ); + pSoldier->aiData.usActionData = FindClosestBoxingRingSpot( pSoldier, FALSE ); return( AI_ACTION_GET_CLOSER ); } else { // done! - pSoldier->uiStatusFlags &= ~(SOLDIER_BOXER); + pSoldier->flags.uiStatusFlags &= ~(SOLDIER_BOXER); if (pSoldier->bTeam == gbPlayerNum) { - pSoldier->uiStatusFlags &= (~SOLDIER_PCUNDERAICONTROL); + pSoldier->flags.uiStatusFlags &= (~SOLDIER_PCUNDERAICONTROL); TriggerEndOfBoxingRecord( pSoldier ); } else if ( CountPeopleInBoxingRing() == 0 ) @@ -758,7 +758,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) { if ( pSoldier->ubDirection != ubRingDir ) { - pSoldier->usActionData = ubRingDir; + pSoldier->aiData.usActionData = ubRingDir; return( AI_ACTION_CHANGE_FACING ); } } @@ -784,10 +784,10 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) { // special stuff for civs - if (pSoldier->uiStatusFlags & SOLDIER_COWERING) + if (pSoldier->flags.uiStatusFlags & SOLDIER_COWERING) { // everything's peaceful again, stop cowering!! - pSoldier->usActionData = ANIM_STAND; + pSoldier->aiData.usActionData = ANIM_STAND; return( AI_ACTION_STOP_COWERING ); } @@ -796,21 +796,21 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) // ****************** // REAL TIME NPC CODE // ****************** - if (pSoldier->fAIFlags & AI_CHECK_SCHEDULE) + if (pSoldier->aiData.fAIFlags & AI_CHECK_SCHEDULE) { - pSoldier->bAction = DecideActionSchedule( pSoldier ); - if (pSoldier->bAction != AI_ACTION_NONE) + pSoldier->aiData.bAction = DecideActionSchedule( pSoldier ); + if (pSoldier->aiData.bAction != AI_ACTION_NONE) { - return( pSoldier->bAction ); + return( pSoldier->aiData.bAction ); } } if (pSoldier->ubProfile != NO_PROFILE) { - pSoldier->bAction = DecideActionNamedNPC( pSoldier ); - if ( pSoldier->bAction != AI_ACTION_NONE ) + pSoldier->aiData.bAction = DecideActionNamedNPC( pSoldier ); + if ( pSoldier->aiData.bAction != AI_ACTION_NONE ) { - return( pSoldier->bAction ); + return( pSoldier->aiData.bAction ); } // can we act again? not for a minute since we were last spoken to/triggered a record if ( pSoldier->uiTimeSinceLastSpoke && (GetJA2Clock() < pSoldier->uiTimeSinceLastSpoke + 60000) ) @@ -845,15 +845,15 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) // this takes priority over water/gas checks, so that point patrol WILL work // from island to island, and through gas covered areas, too - if ((pSoldier->bOrders == POINTPATROL) && (pSoldier->bBreath >= 75)) + if ((pSoldier->aiData.bOrders == POINTPATROL) && (pSoldier->bBreath >= 75)) { if (PointPatrolAI(pSoldier)) { if (!gfTurnBasedAI) { // wait after this... - pSoldier->bNextAction = AI_ACTION_WAIT; - pSoldier->usNextActionData = RealtimeDelay( pSoldier ); + pSoldier->aiData.bNextAction = AI_ACTION_WAIT; + pSoldier->aiData.usNextActionData = RealtimeDelay( pSoldier ); } return(AI_ACTION_POINT_PATROL); } @@ -864,15 +864,15 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) } } - if ((pSoldier->bOrders == RNDPTPATROL) && (pSoldier->bBreath >=75)) + if ((pSoldier->aiData.bOrders == RNDPTPATROL) && (pSoldier->bBreath >=75)) { if (RandomPointPatrolAI(pSoldier)) { if (!gfTurnBasedAI) { // wait after this... - pSoldier->bNextAction = AI_ACTION_WAIT; - pSoldier->usNextActionData = RealtimeDelay( pSoldier ); + pSoldier->aiData.bNextAction = AI_ACTION_WAIT; + pSoldier->aiData.usNextActionData = RealtimeDelay( pSoldier ); } return(AI_ACTION_POINT_PATROL); } @@ -892,12 +892,12 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) if (bInWater || bInGas) { - pSoldier->usActionData = FindNearestUngassedLand(pSoldier); + pSoldier->aiData.usActionData = FindNearestUngassedLand(pSoldier); - if (pSoldier->usActionData != NOWHERE) + if (pSoldier->aiData.usActionData != NOWHERE) { #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - SEEKING NEAREST UNGASSED LAND at grid %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - SEEKING NEAREST UNGASSED LAND at grid %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif @@ -917,7 +917,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) { // take a breather for gods sake! // for realtime, AI will use a standard wait set outside of here - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return(AI_ACTION_NONE); } @@ -926,12 +926,12 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) // CLIMB A BUILDING //////////////////////////////////////////////////////////////////////////// - if (!fCivilian && pSoldier->bLastAction != AI_ACTION_CLIMB_ROOF) + if (!fCivilian && pSoldier->aiData.bLastAction != AI_ACTION_CLIMB_ROOF) { - iChance = 10 + pSoldier->bBypassToGreen; + iChance = 10 + pSoldier->aiData.bBypassToGreen; // set base chance and maximum seeking distance according to orders - switch (pSoldier->bOrders) + switch (pSoldier->aiData.bOrders) { case STATIONARY: iChance *= 0; break; case ONGUARD: iChance += 10; break; @@ -945,7 +945,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) } // modify for attitude - switch (pSoldier->bAttitude) + switch (pSoldier->aiData.bAttitude) { case DEFENSIVE: iChance *= 1.5; break; case BRAVESOLO: iChance /= 2; break; @@ -963,14 +963,14 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) iChance += 20; // reduce chance for any injury, less likely to hop up if hurt - iChance -= (pSoldier->bLifeMax - pSoldier->bLife); + iChance -= (pSoldier->stats.bLifeMax - pSoldier->stats.bLife); // reduce chance if breath is down //iChance -= (100 - pSoldier->bBreath); // don't care // This is the chance that we want to be on the roof. If already there, invert the chance to see if we want back // down - if (pSoldier->bLevel > 0) + if (pSoldier->pathing.bLevel > 0) { iChance = 100 - iChance; } @@ -978,11 +978,11 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) if ((INT16) PreRandom(100) < iChance) { BOOLEAN fUp = FALSE; - if ( pSoldier->bLevel == 0 ) + if ( pSoldier->pathing.bLevel == 0 ) { fUp = TRUE; } - else if (pSoldier->bLevel > 0 ) + else if (pSoldier->pathing.bLevel > 0 ) { fUp = FALSE; } @@ -994,12 +994,12 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) } else { - pSoldier->usActionData = FindClosestClimbPoint(pSoldier, fUp ); + pSoldier->aiData.usActionData = FindClosestClimbPoint(pSoldier, fUp ); // Added the check here because sniper militia who are locked inside of a building without keys // will still have a >100% chance to want to climb, which means an infinite loop. In fact, any // time a move is desired, there probably also will be a need to check for a path. - if ( pSoldier->usActionData != NOWHERE && - LegalNPCDestination(pSoldier,pSoldier->usActionData,ENSURE_PATH,WATEROK, 0 )) + if ( pSoldier->aiData.usActionData != NOWHERE && + LegalNPCDestination(pSoldier,pSoldier->aiData.usActionData,ENSURE_PATH,WATEROK, 0 )) { return( AI_ACTION_MOVE_TO_CLIMB ); } @@ -1014,10 +1014,10 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) if (!gubNPCPathCount) // try to limit pathing in Green AI { - iChance = 25 + pSoldier->bBypassToGreen; + iChance = 25 + pSoldier->aiData.bBypassToGreen; // set base chance according to orders - switch (pSoldier->bOrders) + switch (pSoldier->aiData.bOrders) { case STATIONARY: iChance += -20; break; case ONGUARD: iChance += -15; break; @@ -1045,7 +1045,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) } // modify chance of patrol (and whether it's a sneaky one) by attitude - switch (pSoldier->bAttitude) + switch (pSoldier->aiData.bAttitude) { case DEFENSIVE: iChance += -10; break; case BRAVESOLO: iChance += 5; break; @@ -1057,7 +1057,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) } // reduce chance for any injury, less likely to wander around when hurt - iChance -= (pSoldier->bLifeMax - pSoldier->bLife); + iChance -= (pSoldier->stats.bLifeMax - pSoldier->stats.bLife); // reduce chance if breath is down, less likely to wander around when tired iChance -= (100 - pSoldier->bBreath); @@ -1067,25 +1067,25 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) // OR if we roll under the chance calculated if (bInWater || ((INT16) PreRandom(100) < iChance)) { - pSoldier->usActionData = RandDestWithinRange(pSoldier); + pSoldier->aiData.usActionData = RandDestWithinRange(pSoldier); - if (pSoldier->usActionData != NOWHERE) + if (pSoldier->aiData.usActionData != NOWHERE) { - pSoldier->usActionData = GoAsFarAsPossibleTowards( pSoldier, pSoldier->usActionData, AI_ACTION_RANDOM_PATROL ); + pSoldier->aiData.usActionData = GoAsFarAsPossibleTowards( pSoldier, pSoldier->aiData.usActionData, AI_ACTION_RANDOM_PATROL ); } - if (pSoldier->usActionData != NOWHERE) + if (pSoldier->aiData.usActionData != NOWHERE) { #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - RANDOM PATROL to grid %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - RANDOM PATROL to grid %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif if (!gfTurnBasedAI) { // wait after this... - pSoldier->bNextAction = AI_ACTION_WAIT; - pSoldier->usNextActionData = RealtimeDelay( pSoldier ); + pSoldier->aiData.bNextAction = AI_ACTION_WAIT; + pSoldier->aiData.usNextActionData = RealtimeDelay( pSoldier ); } return(AI_ACTION_RANDOM_PATROL); } @@ -1098,10 +1098,10 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) // SEEK FRIEND: determine %chance for man to pay a friendly visit //////////////////////////////////////////////////////////////////////////// - iChance = 25 + pSoldier->bBypassToGreen; + iChance = 25 + pSoldier->aiData.bBypassToGreen; // set base chance and maximum seeking distance according to orders - switch (pSoldier->bOrders) + switch (pSoldier->aiData.bOrders) { case STATIONARY: iChance += -20; break; case ONGUARD: iChance += -15; break; @@ -1115,7 +1115,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) } // modify for attitude - switch (pSoldier->bAttitude) + switch (pSoldier->aiData.bAttitude) { case DEFENSIVE: break; case BRAVESOLO: iChance /= 2; break; // loners @@ -1127,7 +1127,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) } // reduce chance for any injury, less likely to wander around when hurt - iChance -= (pSoldier->bLifeMax - pSoldier->bLife); + iChance -= (pSoldier->stats.bLifeMax - pSoldier->stats.bLife); // reduce chance if breath is down iChance -= (100 - pSoldier->bBreath); // very likely to wait when exhausted @@ -1137,19 +1137,19 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) { if (RandomFriendWithin(pSoldier)) { - if ( pSoldier->usActionData == GoAsFarAsPossibleTowards( pSoldier, pSoldier->usActionData, AI_ACTION_SEEK_FRIEND ) ) + if ( pSoldier->aiData.usActionData == GoAsFarAsPossibleTowards( pSoldier, pSoldier->aiData.usActionData, AI_ACTION_SEEK_FRIEND ) ) { #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - SEEK FRIEND at grid %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - SEEK FRIEND at grid %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif if (fCivilianOrMilitia && !gfTurnBasedAI) { // pause at the end of the walk! - pSoldier->bNextAction = AI_ACTION_WAIT; - pSoldier->usNextActionData = (UINT16) REALTIME_CIV_AI_DELAY; + pSoldier->aiData.bNextAction = AI_ACTION_WAIT; + pSoldier->aiData.usNextActionData = (UINT16) REALTIME_CIV_AI_DELAY; } return(AI_ACTION_SEEK_FRIEND); @@ -1165,12 +1165,12 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Snipers like to crouch, sniper = %d",pSoldier->sniper)); // if not in water and not already crouched, try to crouch down first - if (pSoldier->bOrders == SNIPER && !PTR_CROUCHED && IsValidStance( pSoldier, ANIM_CROUCH ) && pSoldier->bLevel == 1 ) + if (pSoldier->aiData.bOrders == SNIPER && !PTR_CROUCHED && IsValidStance( pSoldier, ANIM_CROUCH ) && pSoldier->pathing.bLevel == 1 ) { if (!gfTurnBasedAI || (GetAPsToChangeStance( pSoldier, ANIM_CROUCH ) <= pSoldier->bActionPoints)) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Sniper is crouching")); - pSoldier->usActionData = ANIM_CROUCH; + pSoldier->aiData.usActionData = ANIM_CROUCH; pSoldier->sniper = 0; return(AI_ACTION_CHANGE_STANCE); } @@ -1181,7 +1181,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) //////////////////////////////////////////////////////////////////////////// DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Snipers like to raise weapons, sniper = %d",pSoldier->sniper)); - if ( pSoldier->bOrders == SNIPER && pSoldier->sniper == 0 && ( pSoldier->bLevel == 1 || Random(100) < 40 ) ) + if ( pSoldier->aiData.bOrders == SNIPER && pSoldier->sniper == 0 && ( pSoldier->pathing.bLevel == 1 || Random(100) < 40 ) ) { if (!gfTurnBasedAI || GetAPsToReadyWeapon( pSoldier, READY_RIFLE_CROUCH ) <= pSoldier->bActionPoints) { @@ -1208,21 +1208,21 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) if (!gfTurnBasedAI || GetAPsToLook( pSoldier ) <= pSoldier->bActionPoints) { // avoid 2 consecutive random turns in a row - if (pSoldier->bLastAction != AI_ACTION_CHANGE_FACING) + if (pSoldier->aiData.bLastAction != AI_ACTION_CHANGE_FACING) { - iChance = 25 + pSoldier->bBypassToGreen; + iChance = 25 + pSoldier->aiData.bBypassToGreen; // set base chance according to orders - if (pSoldier->bOrders == STATIONARY || pSoldier->bOrders == SNIPER) + if (pSoldier->aiData.bOrders == STATIONARY || pSoldier->aiData.bOrders == SNIPER) iChance += 25; - if (pSoldier->bOrders == ONGUARD) + if (pSoldier->aiData.bOrders == ONGUARD) iChance += 20; - if (pSoldier->bAttitude == DEFENSIVE) + if (pSoldier->aiData.bAttitude == DEFENSIVE) iChance += 25; - if ( pSoldier->bOrders == SNIPER && pSoldier->bLevel == 1) + if ( pSoldier->aiData.bOrders == SNIPER && pSoldier->pathing.bLevel == 1) iChance += 35; if ((INT16)PreRandom(100) < iChance) @@ -1232,10 +1232,10 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) { // if man has a LEGAL dominant facing, and isn't facing it, he will turn // back towards that facing 50% of the time here (normally just enemies) - if ((pSoldier->bDominantDir >= 0) && (pSoldier->bDominantDir <= 8) && - (pSoldier->ubDirection != pSoldier->bDominantDir) && PreRandom(2) && pSoldier->bOrders != SNIPER ) + if ((pSoldier->aiData.bDominantDir >= 0) && (pSoldier->aiData.bDominantDir <= 8) && + (pSoldier->ubDirection != pSoldier->aiData.bDominantDir) && PreRandom(2) && pSoldier->aiData.bOrders != SNIPER ) { - pSoldier->usActionData = pSoldier->bDominantDir; + pSoldier->aiData.usActionData = pSoldier->aiData.bDominantDir; } else { @@ -1250,30 +1250,30 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) ) == pSoldier->ubDirection ) { - pSoldier->usActionData = (UINT16)PreRandom(8); + pSoldier->aiData.usActionData = (UINT16)PreRandom(8); } else { - pSoldier->usActionData = ubNoiseDir; + pSoldier->aiData.usActionData = ubNoiseDir; } } - } while (pSoldier->usActionData == pSoldier->ubDirection); + } while (pSoldier->aiData.usActionData == pSoldier->ubDirection); #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - TURNS to face direction %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - TURNS to face direction %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Trying to turn - checking stance validity, sniper = %d",pSoldier->sniper)); - if ( InternalIsValidStance( pSoldier, (INT8) pSoldier->usActionData, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) ) + if ( pSoldier->InternalIsValidStance( (INT8) pSoldier->aiData.usActionData, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) ) { if ( !gfTurnBasedAI ) { // wait after this... - pSoldier->bNextAction = AI_ACTION_WAIT; - pSoldier->usNextActionData = RealtimeDelay( pSoldier ); + pSoldier->aiData.bNextAction = AI_ACTION_WAIT; + pSoldier->aiData.usNextActionData = RealtimeDelay( pSoldier ); } DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Soldier is turning")); @@ -1290,7 +1290,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) // by default, if everything else fails, just stands in place without turning // for realtime, regular AI guys will use a standard wait set outside of here - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return(AI_ACTION_NONE); } @@ -1302,7 +1302,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) INT32 iNoiseValue; INT32 iChance, iSneaky; INT16 sClosestFriend; - 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->aiData.bNeutral || (pSoldier->ubBodyType >= FATCIV && pSoldier->ubBodyType <= CRIPPLECIV) ) ); BOOLEAN fClimb; BOOLEAN fReachable; #ifdef DEBUGDECISIONS @@ -1312,10 +1312,10 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) if (fCivilian) { - if (pSoldier->uiStatusFlags & SOLDIER_COWERING) + if (pSoldier->flags.uiStatusFlags & SOLDIER_COWERING) { // everything's peaceful again, stop cowering!! - pSoldier->usActionData = ANIM_STAND; + pSoldier->aiData.usActionData = ANIM_STAND; return( AI_ACTION_STOP_COWERING ); } if (!gfTurnBasedAI) @@ -1325,10 +1325,10 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) // ****************** if (pSoldier->ubProfile != NO_PROFILE) { - pSoldier->bAction = DecideActionNamedNPC( pSoldier ); - if ( pSoldier->bAction != AI_ACTION_NONE ) + pSoldier->aiData.bAction = DecideActionNamedNPC( pSoldier ); + if ( pSoldier->aiData.bAction != AI_ACTION_NONE ) { - return( pSoldier->bAction ); + return( pSoldier->aiData.bAction ); } } @@ -1371,27 +1371,27 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) if ((pSoldier->ubDirection != ubNoiseDir) && PythSpacesAway(pSoldier->sGridNo,sNoiseGridNo) <= pSoldier->GetMaxDistanceVisible(sNoiseGridNo) ) { // set base chance according to orders - if ((pSoldier->bOrders == STATIONARY) || (pSoldier->bOrders == ONGUARD) ) + if ((pSoldier->aiData.bOrders == STATIONARY) || (pSoldier->aiData.bOrders == ONGUARD) ) iChance = 50; else // all other orders iChance = 25; - if (pSoldier->bAttitude == DEFENSIVE) + if (pSoldier->aiData.bAttitude == DEFENSIVE) iChance += 15; - if ((INT16)PreRandom(100) < iChance && InternalIsValidStance( pSoldier, ubNoiseDir, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) ) + if ((INT16)PreRandom(100) < iChance && pSoldier->InternalIsValidStance( ubNoiseDir, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) ) { - pSoldier->usActionData = ubNoiseDir; + pSoldier->aiData.usActionData = ubNoiseDir; #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - TURNS TOWARDS NOISE to face direction %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - TURNS TOWARDS NOISE to face direction %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif - if ( pSoldier->bOrders == SNIPER ) + if ( pSoldier->aiData.bOrders == SNIPER ) { if (!gfTurnBasedAI || GetAPsToReadyWeapon( pSoldier, READY_RIFLE_CROUCH ) <= pSoldier->bActionPoints) { - pSoldier->bNextAction = AI_ACTION_RAISE_GUN; + pSoldier->aiData.bNextAction = AI_ACTION_RAISE_GUN; } } return(AI_ACTION_CHANGE_FACING); @@ -1423,7 +1423,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) //iChance += gsDiff[DIFF_RADIO_RED_ALERT][GameOption[ENEMYDIFFICULTY]] / 2; // modify base chance according to orders - switch (pSoldier->bOrders) + switch (pSoldier->aiData.bOrders) { case STATIONARY: iChance += 20; break; case ONGUARD: iChance += 15; break; @@ -1437,7 +1437,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) } // modify base chance according to attitude - switch (pSoldier->bAttitude) + switch (pSoldier->aiData.bAttitude) { case DEFENSIVE: iChance += 20; break; case BRAVESOLO: iChance += -10; break; @@ -1473,10 +1473,10 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) //////////////////////////////////////////////////////////////////////// // if our breath is running a bit low, and we're not in water - if ((pSoldier->bBreath < 25) && !MercInWater(pSoldier)) + if ((pSoldier->bBreath < 25) && !pSoldier->MercInWater()) { // take a breather for gods sake! - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return(AI_ACTION_NONE); } @@ -1492,7 +1492,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) INT16 currDir = GetDirectionFromGridNo ( tempGridNo, pSoldier ); INT16 origDir = pSoldier->origDir; pSoldier->numFlanks += 1; - if ( pSoldier->lastFlankLeft ) + if ( pSoldier->flags.lastFlankLeft ) { if ( origDir > currDir ) origDir -= 8; @@ -1503,8 +1503,8 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) } else { - pSoldier->usActionData = FindFlankingSpot (pSoldier, tempGridNo , AI_ACTION_FLANK_LEFT); - if ( pSoldier->usActionData != NOWHERE ) //&& (currDir - origDir) < 2 ) + pSoldier->aiData.usActionData = FindFlankingSpot (pSoldier, tempGridNo , AI_ACTION_FLANK_LEFT); + if ( pSoldier->aiData.usActionData != NOWHERE ) //&& (currDir - origDir) < 2 ) return AI_ACTION_FLANK_LEFT ; else pSoldier->numFlanks = MAX_FLANKS_YELLOW; @@ -1521,8 +1521,8 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) } else { - pSoldier->usActionData = FindFlankingSpot (pSoldier, tempGridNo , AI_ACTION_FLANK_RIGHT); - if ( pSoldier->usActionData != NOWHERE )//&& (origDir - currDir) < 2 ) + pSoldier->aiData.usActionData = FindFlankingSpot (pSoldier, tempGridNo , AI_ACTION_FLANK_RIGHT); + if ( pSoldier->aiData.usActionData != NOWHERE )//&& (origDir - currDir) < 2 ) return AI_ACTION_FLANK_RIGHT ; else pSoldier->numFlanks = MAX_FLANKS_YELLOW; @@ -1533,7 +1533,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) if ( pSoldier->numFlanks == MAX_FLANKS_YELLOW ) { pSoldier->numFlanks += 1; - pSoldier->usActionData = GoAsFarAsPossibleTowards(pSoldier,tempGridNo,AI_ACTION_SEEK_NOISE); + pSoldier->aiData.usActionData = GoAsFarAsPossibleTowards(pSoldier,tempGridNo,AI_ACTION_SEEK_NOISE); return AI_ACTION_SEEK_NOISE ; } @@ -1541,14 +1541,14 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) // However, civilians with no profile (and likely no weapons) do not need to be seeking out noises. Most don't // even have the body type for it (can't climb or jump). //if ( !( pSoldier->bTeam == CIV_TEAM && pSoldier->ubProfile != NO_PROFILE && pSoldier->ubProfile != ELDIN ) ) - //if ( pSoldier->bTeam != CIV_TEAM || ( !pSoldier->bNeutral && pSoldier->ubProfile != ELDIN ) ) + //if ( pSoldier->bTeam != CIV_TEAM || ( !pSoldier->aiData.bNeutral && pSoldier->ubProfile != ELDIN ) ) // ADB: Eldin is the only neutral civilian who should be seeking out noises. As the museum curator, he can be // available to talk to. As the night watchman, he needs to look for thieves. bool onCivTeam = (pSoldier->bTeam == CIV_TEAM); bool isNamedCiv = (pSoldier->ubProfile != NO_PROFILE); bool isEldin = (pSoldier->ubProfile == ELDIN);//logically flipped from the original, isNotEldin == false is confusing // For purpose of seeking noise, cowardly civs are neutral, even if attacked by your thugs - bool isNeutral = pSoldier->bNeutral || pSoldier->uiStatusFlags & SOLDIER_COWERING; + bool isNeutral = pSoldier->aiData.bNeutral || pSoldier->flags.uiStatusFlags & SOLDIER_COWERING; if ( (onCivTeam == false) || //true #1 (onCivTeam == true && isNamedCiv == true && isNeutral == false) || //true #2 @@ -1558,13 +1558,13 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) // IF WE ARE MILITIA/CIV IN REALTIME, CLOSE TO NOISE, AND CAN SEE THE SPOT WHERE THE NOISE CAME FROM, FORGET IT if ( fReachable && !fClimb && !gfTurnBasedAI && (pSoldier->bTeam == MILITIA_TEAM || pSoldier->bTeam == CIV_TEAM )&& PythSpacesAway( pSoldier->sGridNo, sNoiseGridNo ) < 5 ) { - if ( SoldierTo3DLocationLineOfSightTest( pSoldier, sNoiseGridNo, pSoldier->bLevel, 0, TRUE, 6 ) ) + if ( SoldierTo3DLocationLineOfSightTest( pSoldier, sNoiseGridNo, pSoldier->pathing.bLevel, 0, TRUE, 6 ) ) { // set reachable to false so we don't investigate fReachable = FALSE; // forget about noise - pSoldier->sNoiseGridno = NOWHERE; - pSoldier->ubNoiseVolume = 0; + pSoldier->aiData.sNoiseGridno = NOWHERE; + pSoldier->aiData.ubNoiseVolume = 0; } } @@ -1581,7 +1581,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) // increase // set base chance according to orders - switch (pSoldier->bOrders) + switch (pSoldier->aiData.bOrders) { case STATIONARY: iChance += -20; break; case ONGUARD: iChance += -15; break; @@ -1595,7 +1595,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) } // modify chance of patrol (and whether it's a sneaky one) by attitude - switch (pSoldier->bAttitude) + switch (pSoldier->aiData.bAttitude) { case DEFENSIVE: iChance += -10; iSneaky += 15; break; case BRAVESOLO: iChance += 10; break; @@ -1617,21 +1617,21 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) if ((INT16) PreRandom(100) < iChance ) { - pSoldier->usActionData = GoAsFarAsPossibleTowards(pSoldier,sNoiseGridNo,AI_ACTION_SEEK_NOISE); + pSoldier->aiData.usActionData = GoAsFarAsPossibleTowards(pSoldier,sNoiseGridNo,AI_ACTION_SEEK_NOISE); - if (pSoldier->usActionData != NOWHERE) + if (pSoldier->aiData.usActionData != NOWHERE) { #ifdef DEBUGDECISIONS sprintf(tempstr,"%s - INVESTIGATING NOISE at grid %d, moving to %d", - pSoldier->name,sNoiseGridNo,pSoldier->usActionData); + pSoldier->name,sNoiseGridNo,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif - if ( fClimb )//&& pSoldier->usActionData == sNoiseGridNo) + if ( fClimb )//&& pSoldier->aiData.usActionData == sNoiseGridNo) { // need to climb AND have enough APs to get there this turn BOOLEAN fUp = TRUE; - if (pSoldier->bLevel > 0 ) + if (pSoldier->pathing.bLevel > 0 ) fUp = FALSE; if (!fUp) @@ -1650,16 +1650,16 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) } else { -// pSoldier->usActionData = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sNoiseGridNo , fUp ); - pSoldier->usActionData = sNoiseGridNo; - //if ( pSoldier->usActionData != NOWHERE ) +// pSoldier->aiData.usActionData = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sNoiseGridNo , fUp ); + pSoldier->aiData.usActionData = sNoiseGridNo; + //if ( pSoldier->aiData.usActionData != NOWHERE ) { return( AI_ACTION_MOVE_TO_CLIMB ); } } } - if ( ( pSoldier->bAttitude == CUNNINGAID || pSoldier->bAttitude == CUNNINGSOLO || pSoldier->bAttitude == BRAVESOLO ) ) + if ( ( pSoldier->aiData.bAttitude == CUNNINGAID || pSoldier->aiData.bAttitude == CUNNINGSOLO || pSoldier->aiData.bAttitude == BRAVESOLO ) ) { INT8 action = AI_ACTION_SEEK_NOISE; INT16 dist = PythSpacesAway ( pSoldier->sGridNo, sNoiseGridNo ); @@ -1672,11 +1672,11 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) case 1: case 2: case 3: - if ( pSoldier->bLastAction != AI_ACTION_FLANK_LEFT && pSoldier->bLastAction != AI_ACTION_FLANK_RIGHT ) + if ( pSoldier->aiData.bLastAction != AI_ACTION_FLANK_LEFT && pSoldier->aiData.bLastAction != AI_ACTION_FLANK_RIGHT ) action = AI_ACTION_FLANK_LEFT ; break; default: - if ( pSoldier->bLastAction != AI_ACTION_FLANK_LEFT && pSoldier->bLastAction != AI_ACTION_FLANK_RIGHT ) + if ( pSoldier->aiData.bLastAction != AI_ACTION_FLANK_LEFT && pSoldier->aiData.bLastAction != AI_ACTION_FLANK_RIGHT ) action = AI_ACTION_FLANK_RIGHT ; break; } @@ -1684,20 +1684,20 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) else return AI_ACTION_SEEK_NOISE ; - pSoldier->usActionData = FindFlankingSpot (pSoldier, sNoiseGridNo, action ); + pSoldier->aiData.usActionData = FindFlankingSpot (pSoldier, sNoiseGridNo, action ); - if ( pSoldier->usActionData == NOWHERE || pSoldier->numFlanks >= MAX_FLANKS_YELLOW ) + if ( pSoldier->aiData.usActionData == NOWHERE || pSoldier->numFlanks >= MAX_FLANKS_YELLOW ) { - pSoldier->usActionData = GoAsFarAsPossibleTowards(pSoldier,sNoiseGridNo,AI_ACTION_SEEK_NOISE); + pSoldier->aiData.usActionData = GoAsFarAsPossibleTowards(pSoldier,sNoiseGridNo,AI_ACTION_SEEK_NOISE); //pSoldier->numFlanks = 0; return(AI_ACTION_SEEK_NOISE); } else { if ( action == AI_ACTION_FLANK_LEFT ) - pSoldier->lastFlankLeft = TRUE; + pSoldier->flags.lastFlankLeft = TRUE; else - pSoldier->lastFlankLeft = FALSE; + pSoldier->flags.lastFlankLeft = FALSE; if ( pSoldier->lastFlankSpot != sNoiseGridNo) pSoldier->numFlanks = 0; @@ -1732,7 +1732,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) iSneaky = 10; // set base chance according to orders - switch (pSoldier->bOrders) + switch (pSoldier->aiData.bOrders) { case STATIONARY: iChance += -20; break; case ONGUARD: iChance += -15; break; @@ -1746,7 +1746,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) } // modify chance of patrol (and whether it's a sneaky one) by attitude - switch (pSoldier->bAttitude) + switch (pSoldier->aiData.bAttitude) { case DEFENSIVE: iChance += -10; iSneaky += 15; break; case BRAVESOLO: break; @@ -1762,21 +1762,21 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) if ((INT16)PreRandom(100) < iChance) { - pSoldier->usActionData = GoAsFarAsPossibleTowards(pSoldier,sClosestFriend,AI_ACTION_SEEK_FRIEND); + pSoldier->aiData.usActionData = GoAsFarAsPossibleTowards(pSoldier,sClosestFriend,AI_ACTION_SEEK_FRIEND); - if (pSoldier->usActionData != NOWHERE) + if (pSoldier->aiData.usActionData != NOWHERE) { #ifdef DEBUGDECISIONS sprintf(tempstr,"%s - SEEKING FRIEND at %d, MOVING to %d", - pSoldier->name,sClosestFriend,pSoldier->usActionData); + pSoldier->name,sClosestFriend,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif - if ( fClimb )//&& pSoldier->usActionData == sClosestFriend) + if ( fClimb )//&& pSoldier->aiData.usActionData == sClosestFriend) { // need to climb AND have enough APs to get there this turn BOOLEAN fUp = TRUE; - if (pSoldier->bLevel > 0 ) + if (pSoldier->pathing.bLevel > 0 ) fUp = FALSE; if (!fUp) @@ -1794,16 +1794,16 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) } else { - //pSoldier->usActionData = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sClosestFriend , fUp ); - pSoldier->usActionData = sClosestFriend; - //if ( pSoldier->usActionData != NOWHERE ) + //pSoldier->aiData.usActionData = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sClosestFriend , fUp ); + pSoldier->aiData.usActionData = sClosestFriend; + //if ( pSoldier->aiData.usActionData != NOWHERE ) { return( AI_ACTION_MOVE_TO_CLIMB ); } } } - //if (fClimb && pSoldier->usActionData == sClosestFriend) + //if (fClimb && pSoldier->aiData.usActionData == sClosestFriend) //{ //// need to climb AND have enough APs to get there this turn //return( AI_ACTION_CLIMB_ROOF ); @@ -1826,7 +1826,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) iSneaky = 30; // set base chance according to orders - switch (pSoldier->bOrders) + switch (pSoldier->aiData.bOrders) { case STATIONARY: iChance += 20; break; case ONGUARD: iChance += 15; break; @@ -1840,7 +1840,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) } // modify chance (and whether it's sneaky) by attitude - switch (pSoldier->bAttitude) + switch (pSoldier->aiData.bAttitude) { case DEFENSIVE: iChance += 10; iSneaky += 15; break; case BRAVESOLO: iChance += -15; iSneaky += -20; break; @@ -1861,13 +1861,13 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) if ((INT16)PreRandom(100) < iChance) { - pSoldier->bAIMorale = CalcMorale( pSoldier ); - pSoldier->usActionData = FindBestNearbyCover(pSoldier,pSoldier->bAIMorale,&iDummy); + pSoldier->aiData.bAIMorale = CalcMorale( pSoldier ); + pSoldier->aiData.usActionData = FindBestNearbyCover(pSoldier,pSoldier->aiData.bAIMorale,&iDummy); - if (pSoldier->usActionData != NOWHERE) + if (pSoldier->aiData.usActionData != NOWHERE) { #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - TAKING COVER at grid %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - TAKING COVER at grid %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif @@ -1891,7 +1891,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) #endif // Skip YELLOW until new situation, 15% extra chance to do GREEN actions - pSoldier->bBypassToGreen = 15; + pSoldier->aiData.bBypassToGreen = 15; return(DecideActionGreen(pSoldier)); } @@ -1910,7 +1910,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) if (!gfTurnBasedAI || GetAPsToChangeStance( pSoldier, ANIM_CROUCH ) <= pSoldier->bActionPoints) { - pSoldier->usActionData = ANIM_CROUCH; + pSoldier->aiData.usActionData = ANIM_CROUCH; return(AI_ACTION_CHANGE_STANCE); } } @@ -1925,7 +1925,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) #endif // by default, if everything else fails, just stands in place without turning - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return(AI_ACTION_NONE); } @@ -1949,15 +1949,15 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) #endif BOOLEAN fClimb; BOOLEAN fCivilian = (PTR_CIVILIAN && (pSoldier->ubCivilianGroup == NON_CIV_GROUP || - (pSoldier->bNeutral && gTacticalStatus.fCivGroupHostile[pSoldier->ubCivilianGroup] == CIV_GROUP_NEUTRAL) || + (pSoldier->aiData.bNeutral && gTacticalStatus.fCivGroupHostile[pSoldier->ubCivilianGroup] == CIV_GROUP_NEUTRAL) || (pSoldier->ubBodyType >= FATCIV && pSoldier->ubBodyType <= CRIPPLECIV) ) ); - DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("DecideActionRed: soldier orders = %d",pSoldier->bOrders)); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("DecideActionRed: soldier orders = %d",pSoldier->aiData.bOrders)); // if we have absolutely no action points, we can't do a thing under RED! if (!pSoldier->bActionPoints) { - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return(AI_ACTION_NONE); } @@ -2024,12 +2024,12 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) if (bInGas && ubCanMove) { - pSoldier->usActionData = FindNearestUngassedLand(pSoldier); + pSoldier->aiData.usActionData = FindNearestUngassedLand(pSoldier); - if (pSoldier->usActionData != NOWHERE) + if (pSoldier->aiData.usActionData != NOWHERE) { #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - SEEKING NEAREST UNGASSED LAND at grid %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - SEEKING NEAREST UNGASSED LAND at grid %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif @@ -2043,25 +2043,25 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) if ( FindAIUsableObjClass( pSoldier, IC_WEAPON ) == ITEM_NOT_FOUND ) { // cower in fear!! - if ( pSoldier->uiStatusFlags & SOLDIER_COWERING ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_COWERING ) { if ( gfTurnBasedAI || gTacticalStatus.fEnemyInSector ) // battle! { // in battle! - if ( pSoldier->bLastAction == AI_ACTION_COWER ) + if ( pSoldier->aiData.bLastAction == AI_ACTION_COWER ) { // do nothing - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return( AI_ACTION_NONE ); } else { // set up next action to run away - pSoldier->usNextActionData = FindSpotMaxDistFromOpponents( pSoldier ); - if ( pSoldier->usNextActionData != NOWHERE ) + pSoldier->aiData.usNextActionData = FindSpotMaxDistFromOpponents( pSoldier ); + if ( pSoldier->aiData.usNextActionData != NOWHERE ) { - pSoldier->bNextAction = AI_ACTION_RUN_AWAY; - pSoldier->usActionData = ANIM_STAND; + pSoldier->aiData.bNextAction = AI_ACTION_RUN_AWAY; + pSoldier->aiData.usActionData = ANIM_STAND; return( AI_ACTION_STOP_COWERING ); } else @@ -2072,11 +2072,11 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) } else { - if ( pSoldier->bNewSituation == NOT_NEW_SITUATION ) + if ( pSoldier->aiData.bNewSituation == NOT_NEW_SITUATION ) { // stop cowering, not in battle, timer expired // we have to turn off whatever is necessary to stop status red... - pSoldier->bAlertStatus = STATUS_GREEN; + pSoldier->aiData.bAlertStatus = STATUS_GREEN; return( AI_ACTION_STOP_COWERING ); } else @@ -2090,14 +2090,14 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) if ( gfTurnBasedAI || gTacticalStatus.fEnemyInSector ) { // battle - cower!!! - pSoldier->usActionData = ANIM_CROUCH; + pSoldier->aiData.usActionData = ANIM_CROUCH; return( AI_ACTION_COWER ); } else // not in battle, cower for a certain length of time { - pSoldier->bNextAction = AI_ACTION_WAIT; - pSoldier->usNextActionData = (UINT16) REALTIME_CIV_AI_DELAY; - pSoldier->usActionData = ANIM_CROUCH; + pSoldier->aiData.bNextAction = AI_ACTION_WAIT; + pSoldier->aiData.usNextActionData = (UINT16) REALTIME_CIV_AI_DELAY; + pSoldier->aiData.usActionData = ANIM_CROUCH; return( AI_ACTION_COWER ); } } @@ -2110,25 +2110,25 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) if ( FindAIUsableObjClass( pSoldier, IC_WEAPON ) == ITEM_NOT_FOUND ) { // cower in fear!! - if ( pSoldier->uiStatusFlags & SOLDIER_COWERING ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_COWERING ) { if ( gfTurnBasedAI || gTacticalStatus.fEnemyInSector ) // battle! { // in battle! - if ( pSoldier->bLastAction == AI_ACTION_COWER ) + if ( pSoldier->aiData.bLastAction == AI_ACTION_COWER ) { // do nothing - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return( AI_ACTION_NONE ); } else { // set up next action to run away - pSoldier->usNextActionData = FindSpotMaxDistFromOpponents( pSoldier ); - if ( pSoldier->usNextActionData != NOWHERE ) + pSoldier->aiData.usNextActionData = FindSpotMaxDistFromOpponents( pSoldier ); + if ( pSoldier->aiData.usNextActionData != NOWHERE ) { - pSoldier->bNextAction = AI_ACTION_RUN_AWAY; - pSoldier->usActionData = ANIM_STAND; + pSoldier->aiData.bNextAction = AI_ACTION_RUN_AWAY; + pSoldier->aiData.usActionData = ANIM_STAND; return( AI_ACTION_STOP_COWERING ); } else @@ -2139,11 +2139,11 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) } else { - if ( pSoldier->bNewSituation == NOT_NEW_SITUATION ) + if ( pSoldier->aiData.bNewSituation == NOT_NEW_SITUATION ) { // stop cowering, not in battle, timer expired // we have to turn off whatever is necessary to stop status red... - pSoldier->bAlertStatus = STATUS_GREEN; + pSoldier->aiData.bAlertStatus = STATUS_GREEN; return( AI_ACTION_STOP_COWERING ); } else @@ -2157,14 +2157,14 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) if ( gfTurnBasedAI || gTacticalStatus.fEnemyInSector ) { // battle - cower!!! - pSoldier->usActionData = ANIM_CROUCH; + pSoldier->aiData.usActionData = ANIM_CROUCH; return( AI_ACTION_COWER ); } else // not in battle, cower for a certain length of time { - pSoldier->bNextAction = AI_ACTION_WAIT; - pSoldier->usNextActionData = (UINT16) REALTIME_CIV_AI_DELAY; - pSoldier->usActionData = ANIM_CROUCH; + pSoldier->aiData.bNextAction = AI_ACTION_WAIT; + pSoldier->aiData.usNextActionData = (UINT16) REALTIME_CIV_AI_DELAY; + pSoldier->aiData.usActionData = ANIM_CROUCH; return( AI_ACTION_COWER ); } } @@ -2176,7 +2176,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) //////////////////////////////////////////////////////////////////////// // can't do this in realtime, because the player could be shooting a gun or whatever at the same time! - if (gfTurnBasedAI && !fCivilian && !bInWater && !bInGas && !(pSoldier->uiStatusFlags & SOLDIER_BOXER) && (CanNPCAttack(pSoldier) == TRUE)) + if (gfTurnBasedAI && !fCivilian && !bInWater && !bInGas && !(pSoldier->flags.uiStatusFlags & SOLDIER_BOXER) && (CanNPCAttack(pSoldier) == TRUE)) { BestThrow.ubPossible = FALSE; // by default, assume Throwing isn't possible @@ -2193,7 +2193,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) // Get new gridno! sCheckGridNo = NewGridNo( pSoldier->sGridNo, DirectionInc( ubOpponentDir ) ); - if ( OKFallDirection( pSoldier, sCheckGridNo, pSoldier->bLevel, ubOpponentDir, pSoldier->usAnimState ) ) + if ( OKFallDirection( pSoldier, sCheckGridNo, pSoldier->pathing.bLevel, ubOpponentDir, pSoldier->usAnimState ) ) { // then do it! The functions have already made sure that we have a @@ -2204,8 +2204,8 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) if (BestThrow.bWeaponIn != HANDPOS) RearrangePocket(pSoldier,HANDPOS,BestThrow.bWeaponIn,FOREVER); - pSoldier->usActionData = BestThrow.sTarget; - pSoldier->bAimTime = BestThrow.ubAimTime; + pSoldier->aiData.usActionData = BestThrow.sTarget; + pSoldier->aiData.bAimTime = BestThrow.ubAimTime; return(AI_ACTION_TOSS_PROJECTILE); } @@ -2216,9 +2216,9 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) // try behind us, see if there's room to move back sCheckGridNo = NewGridNo( pSoldier->sGridNo, DirectionInc( gOppositeDirection[ ubOpponentDir ] ) ); - if ( OKFallDirection( pSoldier, sCheckGridNo, pSoldier->bLevel, gOppositeDirection[ ubOpponentDir ], pSoldier->usAnimState ) ) + if ( OKFallDirection( pSoldier, sCheckGridNo, pSoldier->pathing.bLevel, gOppositeDirection[ ubOpponentDir ], pSoldier->usAnimState ) ) { - pSoldier->usActionData = (UINT16) sCheckGridNo; + pSoldier->aiData.usActionData = (UINT16) sCheckGridNo; return( AI_ACTION_GET_CLOSER ); } @@ -2246,7 +2246,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) AINameMessage(pSoldier,"calls for spotters!",1000); #endif - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return(AI_ACTION_NONE); } } @@ -2268,8 +2268,8 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) if (BestShot.bWeaponIn != HANDPOS) RearrangePocket(pSoldier,HANDPOS,BestShot.bWeaponIn,FOREVER); - pSoldier->usActionData = BestShot.sTarget; - pSoldier->bAimTime = BestShot.ubAimTime; + pSoldier->aiData.usActionData = BestShot.sTarget; + pSoldier->aiData.bAimTime = BestShot.ubAimTime; ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[ MSG113_SNIPER ] ); return(AI_ACTION_FIRE_GUN ); } @@ -2285,8 +2285,8 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) if (BestShot.bWeaponIn != NO_SLOT) { OBJECTTYPE * gun = &pSoldier->inv[BestShot.bWeaponIn]; DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("decideactionred: men in sector %d, ubspotters called by %d, nobody %d",gTacticalStatus.Team[pSoldier->bTeam].bMenInSector,gTacticalStatus.ubSpottersCalledForBy,NOBODY )); - //if ( ( ( IsScoped(gun) && GunRange(gun) > pSoldier->GetMaxDistanceVisible(BestShot.sTarget, BestShot.bTargetLevel) ) || pSoldier->bOrders == SNIPER ) && - if ( ( ( IsScoped(gun) && GunRange(gun) > MaxNormalDistanceVisible() ) || pSoldier->bOrders == SNIPER ) && + //if ( ( ( IsScoped(gun) && GunRange(gun) > pSoldier->GetMaxDistanceVisible(BestShot.sTarget, BestShot.bTargetLevel) ) || pSoldier->aiData.bOrders == SNIPER ) && + if ( ( ( IsScoped(gun) && GunRange(gun) > MaxNormalDistanceVisible() ) || pSoldier->aiData.bOrders == SNIPER ) && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1) && (gTacticalStatus.ubSpottersCalledForBy == NOBODY)) @@ -2298,7 +2298,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"decideactionred: calling for sniper spotters"); - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return(AI_ACTION_NONE); } } @@ -2309,7 +2309,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) CheckIfShotPossible(pSoldier,&BestShot,TRUE); //must have a small chance to hit and the opponent must be on the ground (can't suppress guys on the roof) - if ( BestShot.ubPossible && BestShot.ubChanceToReallyHit < 50 && Menptr[BestShot.ubOpponent].bLevel == 0 && pSoldier->bOrders != SNIPER ) + if ( BestShot.ubPossible && BestShot.ubChanceToReallyHit < 50 && Menptr[BestShot.ubOpponent].pathing.bLevel == 0 && pSoldier->aiData.bOrders != SNIPER ) { // then do it! @@ -2319,31 +2319,31 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) if (BestShot.bWeaponIn != HANDPOS) RearrangePocket(pSoldier,HANDPOS,BestShot.bWeaponIn,FOREVER); - pSoldier->usActionData = BestShot.sTarget; - //pSoldier->bAimTime = BestShot.ubAimTime; + pSoldier->aiData.usActionData = BestShot.sTarget; + //pSoldier->aiData.bAimTime = BestShot.ubAimTime; UINT8 ubBurstAPs = 0; pSoldier->bDoAutofire = 0; do { pSoldier->bDoAutofire++; - ubBurstAPs = CalcAPsToAutofire( CalcActionPoints( pSoldier ), &(pSoldier->inv[BestShot.bWeaponIn]), pSoldier->bDoAutofire ); + ubBurstAPs = CalcAPsToAutofire( pSoldier->CalcActionPoints(), &(pSoldier->inv[BestShot.bWeaponIn]), pSoldier->bDoAutofire ); } while( pSoldier->bActionPoints >= BestShot.ubAPCost + ubBurstAPs && - pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire && + pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.gun.ubGunShotsLeft >= pSoldier->bDoAutofire && GetAutoPenalty(&pSoldier->inv[ pSoldier->ubAttackingHand ], gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_PRONE)*pSoldier->bDoAutofire <= 80 ); pSoldier->bDoAutofire--; // Make sure we decided to fire at least one shot! - ubBurstAPs = CalcAPsToAutofire( CalcActionPoints( pSoldier ), &(pSoldier->inv[BestShot.bWeaponIn]), pSoldier->bDoAutofire ); + ubBurstAPs = CalcAPsToAutofire( pSoldier->CalcActionPoints(), &(pSoldier->inv[BestShot.bWeaponIn]), pSoldier->bDoAutofire ); // minimum 10 bullets // Hmmm, automatic suppression? Howcome we don't get this? if (pSoldier->bDoAutofire >= 10 && pSoldier->bActionPoints >= BestShot.ubAPCost + ubBurstAPs ) { - pSoldier->bAimTime = 0; + pSoldier->aiData.bAimTime = 0; pSoldier->bDoBurst = 1; ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[ MSG113_SUPPRESSIONFIRE ] ); @@ -2353,7 +2353,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) } else { - pSoldier->bAimTime = 0; + pSoldier->aiData.bAimTime = 0; pSoldier->bDoBurst = 0; pSoldier->bDoAutofire = 0; // not enough aps - do somthing else @@ -2373,7 +2373,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) if ( !bInDeepWater ) { // modify base chance according to orders - switch (pSoldier->bOrders) + switch (pSoldier->aiData.bOrders) { case STATIONARY: iChance += 20; break; case ONGUARD: iChance += 15; break; @@ -2386,7 +2386,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) } // modify base chance according to attitude - switch (pSoldier->bAttitude) + switch (pSoldier->aiData.bAttitude) { case DEFENSIVE: iChance += 20; break; case BRAVESOLO: iChance += -10; break; @@ -2398,7 +2398,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) } // modify base chance according to morale - switch (pSoldier->bAIMorale) + switch (pSoldier->aiData.bAIMorale) { case MORALE_HOPELESS: iChance *= 3; break; case MORALE_WORRIED: iChance *= 2; break; @@ -2423,10 +2423,10 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) //////////////////////////////////////////////////////////////////////////// // WHEN IN THE LIGHT, GET OUT OF THERE! //////////////////////////////////////////////////////////////////////////// - if ( ubCanMove && InLightAtNight( pSoldier->sGridNo, pSoldier->bLevel ) && pSoldier->bOrders != STATIONARY ) + if ( ubCanMove && InLightAtNight( pSoldier->sGridNo, pSoldier->pathing.bLevel ) && pSoldier->aiData.bOrders != STATIONARY ) { - pSoldier->usActionData = FindNearbyDarkerSpot( pSoldier ); - if ( pSoldier->usActionData != NOWHERE ) + pSoldier->aiData.usActionData = FindNearbyDarkerSpot( pSoldier ); + if ( pSoldier->aiData.usActionData != NOWHERE ) { // move as if leaving water or gas return( AI_ACTION_LEAVE_WATER_GAS ); @@ -2439,7 +2439,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) //////////////////////////////////////////////////////////////////////// // if our breath is running a bit low, and we're not in water or under fire - if ((pSoldier->bBreath < 25) && !bInWater && !pSoldier->bUnderFire) + if ((pSoldier->bBreath < 25) && !bInWater && !pSoldier->aiData.bUnderFire) { // if not already crouched, try to crouch down first if (!fCivilian && !PTR_CROUCHED && IsValidStance( pSoldier, ANIM_CROUCH ) && gAnimControl[ pSoldier->usAnimState ].ubHeight != ANIM_PRONE) @@ -2451,7 +2451,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) if (!gfTurnBasedAI || GetAPsToChangeStance( pSoldier, ANIM_CROUCH ) <= pSoldier->bActionPoints) { - pSoldier->usActionData = ANIM_CROUCH; + pSoldier->aiData.usActionData = ANIM_CROUCH; return(AI_ACTION_CHANGE_STANCE); } @@ -2462,7 +2462,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) AIPopMessage(tempstr); #endif - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return(AI_ACTION_NONE); } @@ -2470,10 +2470,10 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"decideactionred: calculate morale"); // calculate our morale - pSoldier->bAIMorale = CalcMorale(pSoldier); + pSoldier->aiData.bAIMorale = CalcMorale(pSoldier); // if a guy is feeling REALLY discouraged, he may continue to run like hell - if ((pSoldier->bAIMorale == MORALE_HOPELESS) && ubCanMove) + if ((pSoldier->aiData.bAIMorale == MORALE_HOPELESS) && ubCanMove) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"decideactionred: run away"); //////////////////////////////////////////////////////////////////////// @@ -2481,12 +2481,12 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) //////////////////////////////////////////////////////////////////////// // look for best place to RUN AWAY to (farthest from the closest threat) - pSoldier->usActionData = FindSpotMaxDistFromOpponents(pSoldier); + pSoldier->aiData.usActionData = FindSpotMaxDistFromOpponents(pSoldier); - if (pSoldier->usActionData != NOWHERE) + if (pSoldier->aiData.usActionData != NOWHERE) { #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s RUNNING AWAY to grid %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s RUNNING AWAY to grid %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif @@ -2519,7 +2519,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) if (iChance && !bInDeepWater) { // modify base chance according to orders - switch (pSoldier->bOrders) + switch (pSoldier->aiData.bOrders) { case STATIONARY: iChance += 20; break; case ONGUARD: iChance += 15; break; @@ -2533,7 +2533,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) } // modify base chance according to attitude - switch (pSoldier->bAttitude) + switch (pSoldier->aiData.bAttitude) { case DEFENSIVE: iChance += 20; break; case BRAVESOLO: iChance += -10; break; @@ -2551,7 +2551,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) else { // modify base chance according to morale - switch (pSoldier->bAIMorale) + switch (pSoldier->aiData.bAIMorale) { case MORALE_HOPELESS: iChance *= 3; break; case MORALE_WORRIED: iChance *= 2; break; @@ -2602,7 +2602,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) INT16 currDir = GetDirectionFromGridNo ( tempGridNo, pSoldier ); INT16 origDir = pSoldier->origDir; pSoldier->numFlanks += 1; - if ( pSoldier->lastFlankLeft ) + if ( pSoldier->flags.lastFlankLeft ) { if ( origDir > currDir ) origDir -= 8; @@ -2613,8 +2613,8 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) } else { - pSoldier->usActionData = FindFlankingSpot (pSoldier, tempGridNo , AI_ACTION_FLANK_LEFT); - if ( pSoldier->usActionData != NOWHERE ) //&& (currDir - origDir) < 2 ) + pSoldier->aiData.usActionData = FindFlankingSpot (pSoldier, tempGridNo , AI_ACTION_FLANK_LEFT); + if ( pSoldier->aiData.usActionData != NOWHERE ) //&& (currDir - origDir) < 2 ) return AI_ACTION_FLANK_LEFT ; else pSoldier->numFlanks = MAX_FLANKS_RED; @@ -2631,8 +2631,8 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) } else { - pSoldier->usActionData = FindFlankingSpot (pSoldier, tempGridNo , AI_ACTION_FLANK_RIGHT); - if ( pSoldier->usActionData != NOWHERE )//&& (origDir - currDir) < 2 ) + pSoldier->aiData.usActionData = FindFlankingSpot (pSoldier, tempGridNo , AI_ACTION_FLANK_RIGHT); + if ( pSoldier->aiData.usActionData != NOWHERE )//&& (origDir - currDir) < 2 ) return AI_ACTION_FLANK_RIGHT ; else pSoldier->numFlanks = MAX_FLANKS_RED; @@ -2645,16 +2645,16 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"decideactionred: stop flanking"); if (PythSpacesAway ( pSoldier->sGridNo, tempGridNo ) > MIN_FLANK_DIST_RED * 2 ) { - pSoldier->usActionData = InternalGoAsFarAsPossibleTowards(pSoldier,tempGridNo,AP_PRONE,AI_ACTION_SEEK_OPPONENT,0); + pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier,tempGridNo,AP_PRONE,AI_ACTION_SEEK_OPPONENT,0); - if ( LocationToLocationLineOfSightTest( pSoldier->usActionData, pSoldier->bLevel, tempGridNo, pSoldier->bLevel, TRUE) ) + if ( LocationToLocationLineOfSightTest( pSoldier->aiData.usActionData, pSoldier->pathing.bLevel, tempGridNo, pSoldier->pathing.bLevel, TRUE) ) { // reserve APs for a possible crouch plus a shot - pSoldier->usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, tempGridNo, (INT8) (MinAPsToAttack( pSoldier, tempGridNo, ADDTURNCOST) + AP_CROUCH), AI_ACTION_SEEK_OPPONENT, FLAG_CAUTIOUS ); - if ( pSoldier->usActionData != NOWHERE ) + pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, tempGridNo, (INT8) (MinAPsToAttack( pSoldier, tempGridNo, ADDTURNCOST) + AP_CROUCH), AI_ACTION_SEEK_OPPONENT, FLAG_CAUTIOUS ); + if ( pSoldier->aiData.usActionData != NOWHERE ) { - pSoldier->fAIFlags |= AI_CAUTIOUS; - pSoldier->bNextAction = AI_ACTION_END_TURN; + pSoldier->aiData.fAIFlags |= AI_CAUTIOUS; + pSoldier->aiData.bNextAction = AI_ACTION_END_TURN; return(AI_ACTION_SEEK_OPPONENT); } } @@ -2665,7 +2665,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) } else { - pSoldier->usActionData = FindBestNearbyCover(pSoldier,pSoldier->bAIMorale,&iDummy); + pSoldier->aiData.usActionData = FindBestNearbyCover(pSoldier,pSoldier->aiData.bAIMorale,&iDummy); return AI_ACTION_TAKE_COVER ; } } @@ -2687,7 +2687,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) else { - DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("decideactionred: checking hide/seek/help/watch points... orders = %d, attitude = %d",pSoldier->bOrders,pSoldier->bAttitude)); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("decideactionred: checking hide/seek/help/watch points... orders = %d, attitude = %d",pSoldier->aiData.bOrders,pSoldier->aiData.bAttitude)); // calculate initial points for watch based on highest watch loc bWatchPts = GetHighestWatchedLocPoints( pSoldier->ubID ); @@ -2698,7 +2698,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) } // modify RED movement tendencies according to morale - switch (pSoldier->bAIMorale) + switch (pSoldier->aiData.bAIMorale) { case MORALE_HOPELESS: bSeekPts = -99; bHelpPts = -99; bHidePts = +2; bWatchPts = -99; break; case MORALE_WORRIED: bSeekPts += -2; bHelpPts += 0; bHidePts += +2; bWatchPts += 1; break; @@ -2708,7 +2708,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) } // modify tendencies according to orders - switch (pSoldier->bOrders) + switch (pSoldier->aiData.bOrders) { case STATIONARY: bSeekPts += -1; bHelpPts += -1; bHidePts += +1; bWatchPts += +1; break; case ONGUARD: bSeekPts += -1; bHelpPts += 0; bHidePts += +1; bWatchPts += +1; break; @@ -2722,7 +2722,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) } // modify tendencies according to attitude - switch (pSoldier->bAttitude) + switch (pSoldier->aiData.bAttitude) { case DEFENSIVE: bSeekPts += -1; bHelpPts += 0; bHidePts += +2; bWatchPts += +1; break; case BRAVESOLO: bSeekPts += +1; bHelpPts += -1; bHidePts += -1; bWatchPts += -1; break; @@ -2772,36 +2772,36 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) ////////////////////////////////////////////////////////////////////// // try to move towards him - pSoldier->usActionData = InternalGoAsFarAsPossibleTowards(pSoldier,sClosestDisturbance,AP_CROUCH,AI_ACTION_SEEK_OPPONENT,0); + pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier,sClosestDisturbance,AP_CROUCH,AI_ACTION_SEEK_OPPONENT,0); - if (pSoldier->usActionData != NOWHERE) + if (pSoldier->aiData.usActionData != NOWHERE) { // Check for a trap if ( !ArmySeesOpponents() ) { - if ( GetNearestRottingCorpseAIWarning( pSoldier->usActionData ) > 0 ) + if ( GetNearestRottingCorpseAIWarning( pSoldier->aiData.usActionData ) > 0 ) { // abort! abort! - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; } } } // if it's possible - if (pSoldier->usActionData != NOWHERE) + if (pSoldier->aiData.usActionData != NOWHERE) { #ifdef DEBUGDECISIONS // do it! sprintf(tempstr,"%s - SEEKING OPPONENT at grid %d, MOVING to %d", - pSoldier->name,sClosestDisturbance,pSoldier->usActionData); + pSoldier->name,sClosestDisturbance,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif - if (fClimb)//&& pSoldier->usActionData == sClosestDisturbance) + if (fClimb)//&& pSoldier->aiData.usActionData == sClosestDisturbance) { // need to climb AND have enough APs to get there this turn BOOLEAN fUp = TRUE; - if (pSoldier->bLevel > 0 ) + if (pSoldier->pathing.bLevel > 0 ) fUp = FALSE; if (!fUp) @@ -2830,18 +2830,18 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) INT16 usClimbPoint = sClosestDisturbance; if ( usClimbPoint != NOWHERE ) { - pSoldier->usActionData = usClimbPoint; + pSoldier->aiData.usActionData = usClimbPoint; return( AI_ACTION_MOVE_TO_CLIMB ); } } } - //if ( fClimb && pSoldier->usActionData == sClosestDisturbance) + //if ( fClimb && pSoldier->aiData.usActionData == sClosestDisturbance) //{ // return( AI_ACTION_CLIMB_ROOF ); //} - if ( ( pSoldier->bAttitude == CUNNINGAID || pSoldier->bAttitude == CUNNINGSOLO || pSoldier->bAttitude == BRAVESOLO ) && gAnimControl[ pSoldier->usAnimState ].ubHeight != ANIM_PRONE ) + if ( ( pSoldier->aiData.bAttitude == CUNNINGAID || pSoldier->aiData.bAttitude == CUNNINGSOLO || pSoldier->aiData.bAttitude == BRAVESOLO ) && gAnimControl[ pSoldier->usAnimState ].ubHeight != ANIM_PRONE ) { INT8 action = AI_ACTION_SEEK_OPPONENT; INT16 dist = PythSpacesAway ( pSoldier->sGridNo, sClosestDisturbance ); @@ -2854,11 +2854,11 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) case 1: case 2: case 3: - if ( pSoldier->bLastAction != AI_ACTION_FLANK_LEFT && pSoldier->bLastAction != AI_ACTION_FLANK_RIGHT ) + if ( pSoldier->aiData.bLastAction != AI_ACTION_FLANK_LEFT && pSoldier->aiData.bLastAction != AI_ACTION_FLANK_RIGHT ) action = AI_ACTION_FLANK_LEFT ; break; default: - if ( pSoldier->bLastAction != AI_ACTION_FLANK_LEFT && pSoldier->bLastAction != AI_ACTION_FLANK_RIGHT ) + if ( pSoldier->aiData.bLastAction != AI_ACTION_FLANK_LEFT && pSoldier->aiData.bLastAction != AI_ACTION_FLANK_RIGHT ) action = AI_ACTION_FLANK_RIGHT ; break; } @@ -2870,20 +2870,20 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) else return AI_ACTION_SEEK_OPPONENT ; - pSoldier->usActionData = FindFlankingSpot (pSoldier, sClosestDisturbance, action ); + pSoldier->aiData.usActionData = FindFlankingSpot (pSoldier, sClosestDisturbance, action ); - if ( pSoldier->usActionData == NOWHERE || pSoldier->numFlanks >= MAX_FLANKS_RED ) + if ( pSoldier->aiData.usActionData == NOWHERE || pSoldier->numFlanks >= MAX_FLANKS_RED ) { - pSoldier->usActionData = InternalGoAsFarAsPossibleTowards(pSoldier,sClosestDisturbance,AP_CROUCH, AI_ACTION_SEEK_OPPONENT,0); + pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier,sClosestDisturbance,AP_CROUCH, AI_ACTION_SEEK_OPPONENT,0); //pSoldier->numFlanks = 0; - if ( PythSpacesAway( pSoldier->usActionData, sClosestDisturbance ) < 5 || LocationToLocationLineOfSightTest( pSoldier->usActionData, pSoldier->bLevel, sClosestDisturbance, pSoldier->bLevel, TRUE ) ) + if ( PythSpacesAway( pSoldier->aiData.usActionData, sClosestDisturbance ) < 5 || LocationToLocationLineOfSightTest( pSoldier->aiData.usActionData, pSoldier->pathing.bLevel, sClosestDisturbance, pSoldier->pathing.bLevel, TRUE ) ) { // reserve APs for a possible crouch plus a shot - pSoldier->usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, sClosestDisturbance, (INT8) (MinAPsToAttack( pSoldier, sClosestDisturbance, ADDTURNCOST) + AP_CROUCH), AI_ACTION_SEEK_OPPONENT, FLAG_CAUTIOUS ); - if ( pSoldier->usActionData != NOWHERE ) + pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, sClosestDisturbance, (INT8) (MinAPsToAttack( pSoldier, sClosestDisturbance, ADDTURNCOST) + AP_CROUCH), AI_ACTION_SEEK_OPPONENT, FLAG_CAUTIOUS ); + if ( pSoldier->aiData.usActionData != NOWHERE ) { - pSoldier->fAIFlags |= AI_CAUTIOUS; - pSoldier->bNextAction = AI_ACTION_END_TURN; + pSoldier->aiData.fAIFlags |= AI_CAUTIOUS; + pSoldier->aiData.bNextAction = AI_ACTION_END_TURN; return(AI_ACTION_SEEK_OPPONENT); } } @@ -2896,9 +2896,9 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) else { if ( action == AI_ACTION_FLANK_LEFT ) - pSoldier->lastFlankLeft = TRUE; + pSoldier->flags.lastFlankLeft = TRUE; else - pSoldier->lastFlankLeft = FALSE; + pSoldier->flags.lastFlankLeft = FALSE; if ( pSoldier->lastFlankSpot != sClosestDisturbance) pSoldier->numFlanks=0; @@ -2913,14 +2913,14 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) else { // let's be a bit cautious about going right up to a location without enough APs to shoot - if ( PythSpacesAway( pSoldier->usActionData, sClosestDisturbance ) < 5 || LocationToLocationLineOfSightTest( pSoldier->usActionData, pSoldier->bLevel, sClosestDisturbance, pSoldier->bLevel, TRUE ) ) + if ( PythSpacesAway( pSoldier->aiData.usActionData, sClosestDisturbance ) < 5 || LocationToLocationLineOfSightTest( pSoldier->aiData.usActionData, pSoldier->pathing.bLevel, sClosestDisturbance, pSoldier->pathing.bLevel, TRUE ) ) { // reserve APs for a possible crouch plus a shot - pSoldier->usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, sClosestDisturbance, (INT8) (MinAPsToAttack( pSoldier, sClosestDisturbance, ADDTURNCOST) + AP_CROUCH), AI_ACTION_SEEK_OPPONENT, FLAG_CAUTIOUS ); - if ( pSoldier->usActionData != NOWHERE ) + pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, sClosestDisturbance, (INT8) (MinAPsToAttack( pSoldier, sClosestDisturbance, ADDTURNCOST) + AP_CROUCH), AI_ACTION_SEEK_OPPONENT, FLAG_CAUTIOUS ); + if ( pSoldier->aiData.usActionData != NOWHERE ) { - pSoldier->fAIFlags |= AI_CAUTIOUS; - pSoldier->bNextAction = AI_ACTION_END_TURN; + pSoldier->aiData.fAIFlags |= AI_CAUTIOUS; + pSoldier->aiData.bNextAction = AI_ACTION_END_TURN; return(AI_ACTION_SEEK_OPPONENT); } } @@ -2955,29 +2955,29 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) // if soldier is not already facing in that direction, // and the opponent is close enough that he could possibly be seen - if ( pSoldier->ubDirection != ubOpponentDir && InternalIsValidStance( pSoldier, ubOpponentDir, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) ) + if ( pSoldier->ubDirection != ubOpponentDir && pSoldier->InternalIsValidStance( ubOpponentDir, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) ) { // turn - pSoldier->usActionData = ubOpponentDir; - pSoldier->bNextAction = AI_ACTION_END_TURN; + pSoldier->aiData.usActionData = ubOpponentDir; + pSoldier->aiData.bNextAction = AI_ACTION_END_TURN; return(AI_ACTION_CHANGE_FACING); } else { // consider at least crouching - if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_STAND && InternalIsValidStance( pSoldier, ubOpponentDir, ANIM_CROUCH ) ) + if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_STAND && pSoldier->InternalIsValidStance( ubOpponentDir, ANIM_CROUCH ) ) { - pSoldier->usActionData = ANIM_CROUCH; - pSoldier->bNextAction = AI_ACTION_END_TURN; + pSoldier->aiData.usActionData = ANIM_CROUCH; + pSoldier->aiData.bNextAction = AI_ACTION_END_TURN; return(AI_ACTION_CHANGE_STANCE); } else if ( gAnimControl[ pSoldier->usAnimState ].ubHeight != ANIM_PRONE ) { // maybe go prone - if ( PreRandom( 2 ) == 0 && InternalIsValidStance( pSoldier, ubOpponentDir, ANIM_PRONE ) ) + if ( PreRandom( 2 ) == 0 && pSoldier->InternalIsValidStance( ubOpponentDir, ANIM_PRONE ) ) { - pSoldier->usActionData = ANIM_PRONE; - pSoldier->bNextAction = AI_ACTION_END_TURN; + pSoldier->aiData.usActionData = ANIM_PRONE; + pSoldier->aiData.bNextAction = AI_ACTION_END_TURN; return( AI_ACTION_CHANGE_STANCE ); } // end turn @@ -3013,21 +3013,21 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) ////////////////////////////////////////////////////////////////////// // GO DIRECTLY TOWARDS CLOSEST FRIEND UNDER FIRE OR WHO LAST RADIOED ////////////////////////////////////////////////////////////////////// - pSoldier->usActionData = InternalGoAsFarAsPossibleTowards(pSoldier,sClosestFriend,AP_CROUCH, AI_ACTION_SEEK_OPPONENT,0); + pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier,sClosestFriend,AP_CROUCH, AI_ACTION_SEEK_OPPONENT,0); - if (pSoldier->usActionData != NOWHERE) + if (pSoldier->aiData.usActionData != NOWHERE) { #ifdef DEBUGDECISIONS sprintf(tempstr,"%s - SEEKING FRIEND at %d, MOVING to %d", - pSoldier->name,sClosestFriend,pSoldier->usActionData); + pSoldier->name,sClosestFriend,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif - if ( fClimb )//&& pSoldier->usActionData == sClosestFriend) + if ( fClimb )//&& pSoldier->aiData.usActionData == sClosestFriend) { // need to climb AND have enough APs to get there this turn BOOLEAN fUp = TRUE; - if (pSoldier->bLevel > 0 ) + if (pSoldier->pathing.bLevel > 0 ) fUp = FALSE; if (!fUp) @@ -3045,16 +3045,16 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) } else { - pSoldier->usActionData = sClosestFriend; + pSoldier->aiData.usActionData = sClosestFriend; //INT16 sClimbPoint = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sClosestFriend , fUp ); //if ( sClimbPoint != NOWHERE ) { - //pSoldier->usActionData = sClimbPoint; + //pSoldier->aiData.usActionData = sClimbPoint; return( AI_ACTION_MOVE_TO_CLIMB ); } } } - //if (fClimb && pSoldier->usActionData == sClosestFriend) + //if (fClimb && pSoldier->aiData.usActionData == sClosestFriend) //{ // return( AI_ACTION_CLIMB_ROOF ); //} @@ -3087,7 +3087,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) uiStartTime = GetJA2Clock(); #endif - pSoldier->usActionData = FindBestNearbyCover(pSoldier,pSoldier->bAIMorale,&iDummy); + pSoldier->aiData.usActionData = FindBestNearbyCover(pSoldier,pSoldier->aiData.bAIMorale,&iDummy); #ifdef AI_TIMING_TESTS uiEndTime = GetJA2Clock(); @@ -3096,14 +3096,14 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) #endif // let's be a bit cautious about going right up to a location without enough APs to shoot - if ( pSoldier->usActionData != NOWHERE ) + if ( pSoldier->aiData.usActionData != NOWHERE ) { sClosestDisturbance = ClosestReachableDisturbance(pSoldier, ubUnconsciousOK, &fClimb); - if ( sClosestDisturbance != NOWHERE && ( SpacesAway( pSoldier->usActionData, sClosestDisturbance ) < 5 || SpacesAway( pSoldier->usActionData, sClosestDisturbance ) + 5 < SpacesAway( pSoldier->sGridNo, sClosestDisturbance ) ) ) + if ( sClosestDisturbance != NOWHERE && ( SpacesAway( pSoldier->aiData.usActionData, sClosestDisturbance ) < 5 || SpacesAway( pSoldier->aiData.usActionData, sClosestDisturbance ) + 5 < SpacesAway( pSoldier->sGridNo, sClosestDisturbance ) ) ) { // either moving significantly closer or into very close range // ensure will we have enough APs for a possible crouch plus a shot - if ( InternalGoAsFarAsPossibleTowards( pSoldier, pSoldier->usActionData, (INT8) (MinAPsToAttack( pSoldier, sClosestOpponent, ADDTURNCOST) + AP_CROUCH), AI_ACTION_TAKE_COVER, 0 ) == pSoldier->usActionData ) + if ( InternalGoAsFarAsPossibleTowards( pSoldier, pSoldier->aiData.usActionData, (INT8) (MinAPsToAttack( pSoldier, sClosestOpponent, ADDTURNCOST) + AP_CROUCH), AI_ACTION_TAKE_COVER, 0 ) == pSoldier->aiData.usActionData ) { return(AI_ACTION_TAKE_COVER); } @@ -3132,19 +3132,19 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) //////////////////////////////////////////////////////////////////////////// // if we're currently under fire (presumably, attacker is hidden) - if (pSoldier->bUnderFire || fCivilian) + if (pSoldier->aiData.bUnderFire || fCivilian) { // only try to run if we've actually been hit recently & noticably so // otherwise, presumably our current cover is pretty good & sufficient - if (pSoldier->bShock > 0 || fCivilian) + if (pSoldier->aiData.bShock > 0 || fCivilian) { // look for best place to RUN AWAY to (farthest from the closest threat) - pSoldier->usActionData = FindSpotMaxDistFromOpponents(pSoldier); + pSoldier->aiData.usActionData = FindSpotMaxDistFromOpponents(pSoldier); - if (pSoldier->usActionData != NOWHERE) + if (pSoldier->aiData.usActionData != NOWHERE) { #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s RUNNING AWAY to grid %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s RUNNING AWAY to grid %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif @@ -3173,7 +3173,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) AIPopMessage(tempstr); #endif - pSoldier->usActionData = ANIM_CROUCH; + pSoldier->aiData.usActionData = ANIM_CROUCH; return(AI_ACTION_CHANGE_STANCE); } } @@ -3182,7 +3182,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) // maybe go prone if ( PreRandom( 2 ) == 0 && IsValidStance( pSoldier, ANIM_PRONE ) ) { - pSoldier->usActionData = ANIM_PRONE; + pSoldier->aiData.usActionData = ANIM_PRONE; return( AI_ACTION_CHANGE_STANCE ); } @@ -3216,12 +3216,12 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) if ((pSoldier->ubDirection != ubOpponentDir) && (PythSpacesAway(pSoldier->sGridNo,sClosestOpponent) <= sDistVisible)) { // set base chance according to orders - if ((pSoldier->bOrders == STATIONARY) || (pSoldier->bOrders == ONGUARD)) + if ((pSoldier->aiData.bOrders == STATIONARY) || (pSoldier->aiData.bOrders == ONGUARD)) iChance = 50; else // all other orders iChance = 25; - if (pSoldier->bAttitude == DEFENSIVE) + if (pSoldier->aiData.bAttitude == DEFENSIVE) iChance += 25; if ( TANK( pSoldier ) ) @@ -3229,26 +3229,26 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) iChance += 50; } - if ((INT16)PreRandom(100) < iChance && InternalIsValidStance( pSoldier, ubOpponentDir, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) ) + if ((INT16)PreRandom(100) < iChance && pSoldier->InternalIsValidStance( ubOpponentDir, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) ) { - pSoldier->usActionData = ubOpponentDir; + pSoldier->aiData.usActionData = ubOpponentDir; #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - TURNS TOWARDS CLOSEST ENEMY to face direction %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - TURNS TOWARDS CLOSEST ENEMY to face direction %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif - if ( pSoldier->bOrders == SNIPER ) + if ( pSoldier->aiData.bOrders == SNIPER ) { if (!gfTurnBasedAI || GetAPsToReadyWeapon( pSoldier, READY_RIFLE_CROUCH ) <= pSoldier->bActionPoints) { - pSoldier->bNextAction = AI_ACTION_RAISE_GUN; + pSoldier->aiData.bNextAction = AI_ACTION_RAISE_GUN; } } return(AI_ACTION_CHANGE_FACING); } } - else if ( pSoldier->ubDirection == ubOpponentDir && pSoldier->bOrders == SNIPER ) + else if ( pSoldier->ubDirection == ubOpponentDir && pSoldier->aiData.bOrders == SNIPER ) { if (!gfTurnBasedAI || GetAPsToReadyWeapon( pSoldier, READY_RIFLE_CROUCH ) <= pSoldier->bActionPoints) { @@ -3279,26 +3279,26 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) if ( (pSoldier->ubDirection != ubOpponentDir) ) { - if ( (pSoldier->bActionPoints == pSoldier->bInitialActionPoints || (INT16)PreRandom(100) < 60) && InternalIsValidStance( pSoldier, ubOpponentDir, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) ) + if ( (pSoldier->bActionPoints == pSoldier->bInitialActionPoints || (INT16)PreRandom(100) < 60) && pSoldier->InternalIsValidStance( ubOpponentDir, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) ) { - pSoldier->usActionData = ubOpponentDir; + pSoldier->aiData.usActionData = ubOpponentDir; #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - TURNS TOWARDS CLOSEST ENEMY to face direction %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - TURNS TOWARDS CLOSEST ENEMY to face direction %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif // limit turning a bit... if the last thing we did was also a turn, add a 60% chance of this being our last turn - if ( pSoldier->bLastAction == AI_ACTION_CHANGE_FACING && PreRandom( 100 ) < 60 ) + if ( pSoldier->aiData.bLastAction == AI_ACTION_CHANGE_FACING && PreRandom( 100 ) < 60 ) { if ( gfTurnBasedAI ) { - pSoldier->bNextAction = AI_ACTION_END_TURN; + pSoldier->aiData.bNextAction = AI_ACTION_END_TURN; } else { - pSoldier->bNextAction = AI_ACTION_WAIT; - pSoldier->usNextActionData = (UINT16) REALTIME_AI_DELAY; + pSoldier->aiData.bNextAction = AI_ACTION_WAIT; + pSoldier->aiData.usNextActionData = (UINT16) REALTIME_AI_DELAY; } } @@ -3322,14 +3322,14 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) // PICKUP A NEARBY ITEM THAT'S USEFUL //////////////////////////////////////////////////////////////////////////// - if ( ubCanMove && !pSoldier->bNeutral && (gfTurnBasedAI || pSoldier->bTeam == ENEMY_TEAM ) ) + if ( ubCanMove && !pSoldier->aiData.bNeutral && (gfTurnBasedAI || pSoldier->bTeam == ENEMY_TEAM ) ) { - pSoldier->bAction = SearchForItems( pSoldier, SEARCH_GENERAL_ITEMS, pSoldier->inv[HANDPOS].usItem ); + pSoldier->aiData.bAction = SearchForItems( pSoldier, SEARCH_GENERAL_ITEMS, pSoldier->inv[HANDPOS].usItem ); - if (pSoldier->bAction != AI_ACTION_NONE) + if (pSoldier->aiData.bAction != AI_ACTION_NONE) { - return( pSoldier->bAction ); + return( pSoldier->aiData.bAction ); } } @@ -3357,7 +3357,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) //////////////////////////////////////////////////////////////////////////// // if not in combat or under fire, and we COULD have moved, just chose not to - if ( (pSoldier->bAlertStatus != STATUS_BLACK) && !pSoldier->bUnderFire && ubCanMove && (!gfTurnBasedAI || pSoldier->bActionPoints >= pSoldier->bInitialActionPoints) && ( ClosestReachableDisturbance(pSoldier, TRUE, &fClimb) == NOWHERE) ) + if ( (pSoldier->aiData.bAlertStatus != STATUS_BLACK) && !pSoldier->aiData.bUnderFire && ubCanMove && (!gfTurnBasedAI || pSoldier->bActionPoints >= pSoldier->bInitialActionPoints) && ( ClosestReachableDisturbance(pSoldier, TRUE, &fClimb) == NOWHERE) ) { // addition: if soldier is bleeding then reduce bleeding and do nothing if ( pSoldier->bBleeding > MIN_BLEEDING_THRESHOLD ) @@ -3375,7 +3375,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) #endif // Skip RED until new situation/next turn, 30% extra chance to do GREEN actions - pSoldier->bBypassToGreen = 30; + pSoldier->aiData.bBypassToGreen = 30; return(DecideActionGreen(pSoldier)); } @@ -3400,7 +3400,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) AIPopMessage(tempstr); #endif - pSoldier->usActionData = ANIM_CROUCH; + pSoldier->aiData.usActionData = ANIM_CROUCH; return(AI_ACTION_CHANGE_STANCE); } } @@ -3410,7 +3410,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) // IF UNDER FIRE, FACE THE MOST IMPORTANT NOISE WE KNOW AND GO PRONE //////////////////////////////////////////////////////////////////////////// - if ( !fCivilian && pSoldier->bUnderFire && pSoldier->bActionPoints >= (pSoldier->bInitialActionPoints - GetAPsToLook( pSoldier ) ) && IsValidStance( pSoldier, ANIM_PRONE ) ) + if ( !fCivilian && pSoldier->aiData.bUnderFire && pSoldier->bActionPoints >= (pSoldier->bInitialActionPoints - GetAPsToLook( pSoldier ) ) && IsValidStance( pSoldier, ANIM_PRONE ) ) { sClosestDisturbance = MostImportantNoiseHeard( pSoldier, NULL, NULL, NULL ); if ( sClosestDisturbance != NOWHERE ) @@ -3420,15 +3420,15 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) { if ( !gfTurnBasedAI || GetAPsToLook( pSoldier ) <= pSoldier->bActionPoints ) { - pSoldier->usActionData = ubOpponentDir; + pSoldier->aiData.usActionData = ubOpponentDir; return( AI_ACTION_CHANGE_FACING ); } } - else if ( (!gfTurnBasedAI || GetAPsToChangeStance( pSoldier, ANIM_PRONE ) <= pSoldier->bActionPoints ) && InternalIsValidStance( pSoldier, ubOpponentDir, ANIM_PRONE ) ) + else if ( (!gfTurnBasedAI || GetAPsToChangeStance( pSoldier, ANIM_PRONE ) <= pSoldier->bActionPoints ) && pSoldier->InternalIsValidStance( ubOpponentDir, ANIM_PRONE ) ) { // go prone, end turn - pSoldier->bNextAction = AI_ACTION_END_TURN; - pSoldier->usActionData = ANIM_PRONE; + pSoldier->aiData.bNextAction = AI_ACTION_END_TURN; + pSoldier->aiData.usActionData = ANIM_PRONE; return( AI_ACTION_CHANGE_STANCE ); } } @@ -3438,7 +3438,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) //////////////////////////////////////////////////////////////////////////// // If sniper and nothing else to do then raise gun, and if that doesn't find somebody then goto yellow //////////////////////////////////////////////////////////////////////////// - if ( pSoldier->bOrders == SNIPER ) + if ( pSoldier->aiData.bOrders == SNIPER ) { if ( pSoldier->sniper == 0 ) { @@ -3464,7 +3464,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) AINameMessage(pSoldier,"- DOES NOTHING (RED)",1000); #endif - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return(AI_ACTION_NONE); } @@ -3483,10 +3483,10 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) #ifdef DEBUGDECISIONS STR16 tempstr; #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->aiData.bOrders,pSoldier->aiData.bAttitude)); 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->aiData.bNeutral || (pSoldier->ubBodyType >= FATCIV && pSoldier->ubBodyType <= CRIPPLECIV) ) ); UINT8 ubBestStance = 1, ubStanceCost; BOOLEAN fChangeStanceFirst; // before firing BOOLEAN fClimb; @@ -3505,7 +3505,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) // if we have absolutely no action points, we can't do a thing under BLACK! if (!pSoldier->bActionPoints) { - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return(AI_ACTION_NONE); } @@ -3551,7 +3551,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) } } - if ( pSoldier->uiStatusFlags & SOLDIER_BOXER ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_BOXER ) { if ( gTacticalStatus.bBoxingState == PRE_BOXING ) { @@ -3565,7 +3565,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) bInGas = FALSE; // calculate our morale - pSoldier->bAIMorale = CalcMorale(pSoldier); + pSoldier->aiData.bAIMorale = CalcMorale(pSoldier); // and continue on... } else //???? @@ -3584,7 +3584,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) bInGas = InGasOrSmoke( pSoldier, pSoldier->sGridNo ); // calculate our morale - pSoldier->bAIMorale = CalcMorale(pSoldier); + pSoldier->aiData.bAIMorale = CalcMorale(pSoldier); //////////////////////////////////////////////////////////////////////////// // WHEN LEFT IN GAS, WEAR GAS MASK IF AVAILABLE AND NOT WORN @@ -3610,12 +3610,12 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) if (ubCanMove) { // look for best place to RUN AWAY to (farthest from the closest threat) - pSoldier->usActionData = FindSpotMaxDistFromOpponents(pSoldier); + pSoldier->aiData.usActionData = FindSpotMaxDistFromOpponents(pSoldier); - if (pSoldier->usActionData != NOWHERE) + if (pSoldier->aiData.usActionData != NOWHERE) { #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - GASSED or LOW ON BREATH (%d), RUNNING AWAY to grid %d",pSoldier->name,pSoldier->bBreath,pSoldier->usActionData); + sprintf(tempstr,"%s - GASSED or LOW ON BREATH (%d), RUNNING AWAY to grid %d",pSoldier->name,pSoldier->bBreath,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif @@ -3627,10 +3627,10 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) if ( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE ) { pSoldier->bBreath = pSoldier->bBreathMax; //Madd: backed into a corner, so go crazy like a wild animal... - pSoldier->bAIMorale = MORALE_FEARLESS; + pSoldier->aiData.bAIMorale = MORALE_FEARLESS; } else - pSoldier->bAIMorale = MORALE_HOPELESS; + pSoldier->aiData.bAIMorale = MORALE_HOPELESS; } } @@ -3644,12 +3644,12 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) // if soldier in water/gas has enough APs left to move at least 1 square if ( ( bInDeepWater || bInGas ) && ubCanMove) { - pSoldier->usActionData = FindNearestUngassedLand(pSoldier); + pSoldier->aiData.usActionData = FindNearestUngassedLand(pSoldier); - if (pSoldier->usActionData != NOWHERE) + if (pSoldier->aiData.usActionData != NOWHERE) { #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - SEEKING NEAREST UNGASSED LAND at grid %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - SEEKING NEAREST UNGASSED LAND at grid %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif @@ -3659,12 +3659,12 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) // couldn't find ANY land within 25 tiles(!), this should never happen... // look for best place to RUN AWAY to (farthest from the closest threat) - pSoldier->usActionData = FindSpotMaxDistFromOpponents(pSoldier); + pSoldier->aiData.usActionData = FindSpotMaxDistFromOpponents(pSoldier); - if (pSoldier->usActionData != NOWHERE) + if (pSoldier->aiData.usActionData != NOWHERE) { #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - NO LAND NEAR, RUNNING AWAY to grid %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - NO LAND NEAR, RUNNING AWAY to grid %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif @@ -3676,15 +3676,15 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) if ( bInGas && gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE ) { pSoldier->bBreath = pSoldier->bBreathMax; - pSoldier->bAIMorale = MORALE_FEARLESS; // Can't move, can't get away, go nuts instead... + pSoldier->aiData.bAIMorale = MORALE_FEARLESS; // Can't move, can't get away, go nuts instead... } else - pSoldier->bAIMorale = MORALE_HOPELESS; + pSoldier->aiData.bAIMorale = MORALE_HOPELESS; } // offer surrender? - if ( pSoldier->bTeam == ENEMY_TEAM && pSoldier->bVisible == TRUE && !( gTacticalStatus.fEnemyFlags & ENEMY_OFFERED_SURRENDER ) && pSoldier->bLife >= pSoldier->bLifeMax / 2 ) + if ( pSoldier->bTeam == ENEMY_TEAM && pSoldier->bVisible == TRUE && !( gTacticalStatus.fEnemyFlags & ENEMY_OFFERED_SURRENDER ) && pSoldier->stats.bLife >= pSoldier->stats.bLifeMax / 2 ) { if ( gTacticalStatus.Team[ MILITIA_TEAM ].bMenInSector == 0 && NumPCsInSector() < 4 && gTacticalStatus.Team[ ENEMY_TEAM ].bMenInSector >= NumPCsInSector() * 3 ) { @@ -3705,11 +3705,11 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) // NPCs in water/tear gas without masks are not permitted to shoot/stab/throw - if ((pSoldier->bActionPoints < 2) || bInDeepWater || bInGas || pSoldier->bRTPCombat == RTP_COMBAT_REFRAIN) + if ((pSoldier->bActionPoints < 2) || bInDeepWater || bInGas || pSoldier->aiData.bRTPCombat == RTP_COMBAT_REFRAIN) { bCanAttack = FALSE; } - else if (pSoldier->uiStatusFlags & SOLDIER_BOXER) + else if (pSoldier->flags.uiStatusFlags & SOLDIER_BOXER) { bCanAttack = TRUE; fTryPunching = TRUE; @@ -3724,25 +3724,25 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) { if (fCivilian) { - if ( ( bCanAttack == NOSHOOT_NOWEAPON) && !(pSoldier->uiStatusFlags & SOLDIER_BOXER) && pSoldier->ubBodyType != COW && pSoldier->ubBodyType != CRIPPLECIV ) + if ( ( bCanAttack == NOSHOOT_NOWEAPON) && !(pSoldier->flags.uiStatusFlags & SOLDIER_BOXER) && pSoldier->ubBodyType != COW && pSoldier->ubBodyType != CRIPPLECIV ) { // cower in fear!! - if ( pSoldier->uiStatusFlags & SOLDIER_COWERING ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_COWERING ) { - if ( pSoldier->bLastAction == AI_ACTION_COWER ) + if ( pSoldier->aiData.bLastAction == AI_ACTION_COWER ) { // do nothing - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return( AI_ACTION_NONE ); } else { // set up next action to run away - pSoldier->usNextActionData = FindSpotMaxDistFromOpponents( pSoldier ); - if ( pSoldier->usNextActionData != NOWHERE ) + pSoldier->aiData.usNextActionData = FindSpotMaxDistFromOpponents( pSoldier ); + if ( pSoldier->aiData.usNextActionData != NOWHERE ) { - pSoldier->bNextAction = AI_ACTION_RUN_AWAY; - pSoldier->usActionData = ANIM_STAND; + pSoldier->aiData.bNextAction = AI_ACTION_RUN_AWAY; + pSoldier->aiData.usActionData = ANIM_STAND; return( AI_ACTION_STOP_COWERING ); } else @@ -3754,24 +3754,31 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) else { // cower!!! - pSoldier->usActionData = ANIM_CROUCH; + pSoldier->aiData.usActionData = ANIM_CROUCH; return( AI_ACTION_COWER ); } } } - else if (bCanAttack == NOSHOOT_NOAMMO && ubCanMove && !pSoldier->bNeutral) + else if (bCanAttack == NOSHOOT_NOAMMO && ubCanMove && !pSoldier->aiData.bNeutral) { - // try to find more ammo - pSoldier->bAction = SearchForItems( pSoldier, SEARCH_AMMO, pSoldier->inv[HANDPOS].usItem ); + int handPOS; + //CHRISL: We need to know which weapon has no ammo in case the soldier is holding a weapoin in SECONDHANDPOS + if(pSoldier->inv[SECONDHANDPOS].exists() == true && pSoldier->inv[SECONDHANDPOS][0]->data.gun.ubGunShotsLeft == 0) + handPOS = SECONDHANDPOS; + else + handPOS = HANDPOS; - if (pSoldier->bAction == AI_ACTION_NONE) + // try to find more ammo + pSoldier->aiData.bAction = SearchForItems( pSoldier, SEARCH_AMMO, pSoldier->inv[handPOS].usItem ); + + if (pSoldier->aiData.bAction == AI_ACTION_NONE) { // the current weapon appears is useless right now! // (since we got a return code of noammo, we know the hand usItem // is our gun) - pSoldier->inv[HANDPOS].fFlags |= OBJECT_AI_UNUSABLE; + pSoldier->inv[handPOS].fFlags |= OBJECT_AI_UNUSABLE; // move the gun into another pocket... - if (!AutoPlaceObject( pSoldier, &(pSoldier->inv[HANDPOS]), FALSE ) ) + if (!AutoPlaceObject( pSoldier, &(pSoldier->inv[handPOS]), FALSE ) ) { // If there's no room in his pockets for the useless gun, just throw it away return AI_ACTION_DROP_ITEM; @@ -3779,7 +3786,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) } else { - return( pSoldier->bAction ); + return( pSoldier->aiData.bAction ); } } else @@ -3795,9 +3802,9 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) if (!bCanAttack) { - if (pSoldier->bAIMorale > MORALE_WORRIED) + if (pSoldier->aiData.bAIMorale > MORALE_WORRIED) { - pSoldier->bAIMorale = MORALE_WORRIED; + pSoldier->aiData.bAIMorale = MORALE_WORRIED; } if (!fCivilian) @@ -3810,13 +3817,13 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) } // if we don't have a gun, look around for a weapon! - if (FindAIUsableObjClass( pSoldier, IC_GUN ) == ITEM_NOT_FOUND && ubCanMove && !pSoldier->bNeutral) + if (FindAIUsableObjClass( pSoldier, IC_GUN ) == ITEM_NOT_FOUND && ubCanMove && !pSoldier->aiData.bNeutral) { // look around for a gun... - pSoldier->bAction = SearchForItems( pSoldier, SEARCH_WEAPONS, pSoldier->inv[HANDPOS].usItem ); - if (pSoldier->bAction != AI_ACTION_NONE ) + pSoldier->aiData.bAction = SearchForItems( pSoldier, SEARCH_WEAPONS, pSoldier->inv[HANDPOS].usItem ); + if (pSoldier->aiData.bAction != AI_ACTION_NONE ) { - return( pSoldier->bAction ); + return( pSoldier->aiData.bAction ); } } @@ -3851,7 +3858,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) } // now it better be a gun, or the guy can't shoot (but has other attack(s)) - if (Item[pSoldier->inv[HANDPOS].usItem].usItemClass == IC_GUN && pSoldier->inv[HANDPOS].ItemData.Gun.bGunStatus >= USABLE) + if (Item[pSoldier->inv[HANDPOS].usItem].usItemClass == IC_GUN && pSoldier->inv[HANDPOS][0]->data.gun.bGunStatus >= USABLE) { // get the minimum cost to attack the same target with this gun ubMinAPCost = MinAPsToAttack(pSoldier,pSoldier->sLastTarget,ADDTURNCOST); @@ -3866,7 +3873,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) CalcBestShot(pSoldier,&BestShot,shootUnseen); - if (pSoldier->bTeam == gbPlayerNum && pSoldier->bRTPCombat == RTP_COMBAT_CONSERVE) + if (pSoldier->bTeam == gbPlayerNum && pSoldier->aiData.bRTPCombat == RTP_COMBAT_CONSERVE) { if (BestShot.ubChanceToReallyHit < 30) { @@ -3880,11 +3887,11 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) // if the selected opponent is not a threat (unconscious & !serviced) // (usually, this means all the guys we see are unconscious, but, on // rare occasions, we may not be able to shoot a healthy guy, too) - if ((Menptr[BestShot.ubOpponent].bLife < OKLIFE) && + if ((Menptr[BestShot.ubOpponent].stats.bLife < OKLIFE) && !Menptr[BestShot.ubOpponent].bService) { // if our attitude is NOT aggressive - if ( pSoldier->bAttitude != AGGRESSIVE || BestShot.ubChanceToReallyHit < 60 ) + if ( pSoldier->aiData.bAttitude != AGGRESSIVE || BestShot.ubChanceToReallyHit < 60 ) { // get the location of the closest CONSCIOUS reachable opponent sClosestDisturbance = ClosestReachableDisturbance(pSoldier,FALSE, &fClimb); @@ -3942,16 +3949,16 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) // Get new gridno! sCheckGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc( ubOpponentDir ) ); - if ( !OKFallDirection( pSoldier, sCheckGridNo, pSoldier->bLevel, ubOpponentDir, pSoldier->usAnimState ) ) + if ( !OKFallDirection( pSoldier, sCheckGridNo, pSoldier->pathing.bLevel, ubOpponentDir, pSoldier->usAnimState ) ) { // can't fire! BestThrow.ubPossible = FALSE; // try behind us, see if there's room to move back sCheckGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc( gOppositeDirection[ ubOpponentDir ] ) ); - if ( OKFallDirection( pSoldier, sCheckGridNo, pSoldier->bLevel, gOppositeDirection[ ubOpponentDir ], pSoldier->usAnimState ) ) + if ( OKFallDirection( pSoldier, sCheckGridNo, pSoldier->pathing.bLevel, gOppositeDirection[ ubOpponentDir ], pSoldier->usAnimState ) ) { - pSoldier->usActionData = sCheckGridNo; + pSoldier->aiData.usActionData = sCheckGridNo; return( AI_ACTION_GET_CLOSER ); } @@ -4012,7 +4019,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) // if the selected opponent is not a threat (unconscious & !serviced) // (usually, this means all the guys we see are unconscious, but, on // rare occasions, we may not be able to shoot a healthy guy, too) - if ((Menptr[BestStab.ubOpponent].bLife < OKLIFE) && + if ((Menptr[BestStab.ubOpponent].stats.bLife < OKLIFE) && !Menptr[BestStab.ubOpponent].bService) { // don't throw a knife at him. @@ -4086,7 +4093,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) if ( ( ubBestAttackAction == AI_ACTION_NONE ) && fTryPunching ) { // nothing (else) to attack with so let's try hand-to-hand - bWeaponIn = FindObjWithin( pSoldier, NOTHING, HANDPOS, SMALLPOCK8POS ); + bWeaponIn = FindObj( pSoldier, NOTHING, HANDPOS, NUM_INV_SLOTS ); if (bWeaponIn != NO_SLOT) { @@ -4156,11 +4163,11 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) } // NB a desire of 4 or more is only achievable by brave/aggressive guys with high morale - if ( pSoldier->bActionPoints == pSoldier->bInitialActionPoints && ubBestAttackAction == AI_ACTION_FIRE_GUN && (pSoldier->bShock == 0) && (pSoldier->bLife >= pSoldier->bLifeMax / 2) && BestAttack.ubChanceToReallyHit < 30 && ( PythSpacesAway( pSoldier->sGridNo, BestAttack.sTarget ) > Weapon[ pSoldier->inv[ BestAttack.bWeaponIn ].usItem ].usRange / CELL_X_SIZE ) && RangeChangeDesire( pSoldier ) >= 4 ) + if ( pSoldier->bActionPoints == pSoldier->bInitialActionPoints && ubBestAttackAction == AI_ACTION_FIRE_GUN && (pSoldier->aiData.bShock == 0) && (pSoldier->stats.bLife >= pSoldier->stats.bLifeMax / 2) && BestAttack.ubChanceToReallyHit < 30 && ( PythSpacesAway( pSoldier->sGridNo, BestAttack.sTarget ) > Weapon[ pSoldier->inv[ BestAttack.bWeaponIn ].usItem ].usRange / CELL_X_SIZE ) && RangeChangeDesire( pSoldier ) >= 4 ) { // okay, really got to wonder about this... could taking cover be an option? - if (ubCanMove && pSoldier->bOrders != STATIONARY && !gfHiddenInterrupt && - !(pSoldier->uiStatusFlags & SOLDIER_BOXER) ) + if (ubCanMove && pSoldier->aiData.bOrders != STATIONARY && !gfHiddenInterrupt && + !(pSoldier->flags.uiStatusFlags & SOLDIER_BOXER) ) { // make militia a bit more cautious if ( ( (pSoldier->bTeam == MILITIA_TEAM) && (PreRandom( 20 ) > BestAttack.ubChanceToReallyHit) ) @@ -4191,12 +4198,12 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) iCoverPercentBetter = 0; if ( (ubCanMove && !SkipCoverCheck && !gfHiddenInterrupt && - ((ubBestAttackAction == AI_ACTION_NONE) || pSoldier->bLastAttackHit) && - (pSoldier->bTeam != gbPlayerNum || pSoldier->fAIFlags & AI_RTP_OPTION_CAN_SEEK_COVER) && - !(pSoldier->uiStatusFlags & SOLDIER_BOXER) ) + ((ubBestAttackAction == AI_ACTION_NONE) || pSoldier->aiData.bLastAttackHit) && + (pSoldier->bTeam != gbPlayerNum || pSoldier->aiData.fAIFlags & AI_RTP_OPTION_CAN_SEEK_COVER) && + !(pSoldier->flags.uiStatusFlags & SOLDIER_BOXER) ) || fAllowCoverCheck ) { - sBestCover = FindBestNearbyCover(pSoldier,pSoldier->bAIMorale,&iCoverPercentBetter); + sBestCover = FindBestNearbyCover(pSoldier,pSoldier->aiData.bAIMorale,&iCoverPercentBetter); } @@ -4217,7 +4224,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) iDefense = iCoverPercentBetter; // based on how we feel about the situation, decide whether to attack first - switch (pSoldier->bAIMorale) + switch (pSoldier->aiData.bAIMorale) { case MORALE_FEARLESS: iOffense += iOffense / 2; // increase 50% @@ -4241,18 +4248,18 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) // smart guys more likely to try to stay alive, dolts more likely to shoot! - if (pSoldier->bWisdom >= 50) //Madd: reduced the wisdom required to want to live... + if (pSoldier->stats.bWisdom >= 50) //Madd: reduced the wisdom required to want to live... iDefense += 10; - else if (pSoldier->bWisdom < 30) + else if (pSoldier->stats.bWisdom < 30) iDefense -= 10; // some orders are more offensive, others more defensive - if (pSoldier->bOrders == SEEKENEMY) + if (pSoldier->aiData.bOrders == SEEKENEMY) iOffense += 10; - else if ((pSoldier->bOrders == STATIONARY) || (pSoldier->bOrders == ONGUARD) || pSoldier->bOrders == SNIPER ) + else if ((pSoldier->aiData.bOrders == STATIONARY) || (pSoldier->aiData.bOrders == ONGUARD) || pSoldier->aiData.bOrders == SNIPER ) iDefense += 10; - switch (pSoldier->bAttitude) + switch (pSoldier->aiData.bAttitude) { case DEFENSIVE: iDefense += 30; break; case BRAVESOLO: iDefense -= 0; break; @@ -4289,7 +4296,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) fChangeStanceFirst = FALSE; // default settings - pSoldier->bAimTime = BestAttack.ubAimTime; + pSoldier->aiData.bAimTime = BestAttack.ubAimTime; pSoldier->bDoBurst = 0; if (ubBestAttackAction == AI_ACTION_FIRE_GUN) @@ -4306,7 +4313,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) else { iChance = 50; - switch (pSoldier->bAttitude) + switch (pSoldier->aiData.bAttitude) { case DEFENSIVE: iChance += 20; break; case BRAVESOLO: iChance -= 10; break; @@ -4328,20 +4335,20 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) if (ubBestStance != 0) { // change stance first! - if ( pSoldier->ubDirection != bDirection && InternalIsValidStance( pSoldier, bDirection, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) ) + if ( pSoldier->ubDirection != bDirection && pSoldier->InternalIsValidStance( bDirection, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) ) { // we're not facing towards him, so turn first! - pSoldier->usActionData = bDirection; + pSoldier->aiData.usActionData = bDirection; #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - TURNS to face CLOSEST OPPONENT in direction %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - TURNS to face CLOSEST OPPONENT in direction %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif return(AI_ACTION_CHANGE_FACING); } - // pSoldier->usActionData = ubBestStance; + // pSoldier->aiData.usActionData = ubBestStance; // attack after we change stance // we don't just return here because we want to check whether to @@ -4372,14 +4379,14 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) // IF ENOUGH APs TO BURST, RANDOM CHANCE OF DOING SO ////////////////////////////////////////////////////////////////////////// - if (IsGunBurstCapable( pSoldier, BestAttack.bWeaponIn, FALSE ) && - !(Menptr[BestShot.ubOpponent].bLife < OKLIFE) && // don't burst at downed targets - pSoldier->inv[BestAttack.bWeaponIn].ItemData.Gun.ubGunShotsLeft > 1 && - (pSoldier->bTeam != gbPlayerNum || pSoldier->bRTPCombat == RTP_COMBAT_AGGRESSIVE) ) + if (IsGunBurstCapable( &pSoldier->inv[BestAttack.bWeaponIn], FALSE, pSoldier ) && + !(Menptr[BestShot.ubOpponent].stats.bLife < OKLIFE) && // don't burst at downed targets + pSoldier->inv[BestAttack.bWeaponIn][0]->data.gun.ubGunShotsLeft > 1 && + (pSoldier->bTeam != gbPlayerNum || pSoldier->aiData.bRTPCombat == RTP_COMBAT_AGGRESSIVE) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: ENOUGH APs TO BURST, RANDOM CHANCE OF DOING SO"); - ubBurstAPs = CalcAPsToBurst( CalcActionPoints( pSoldier ), &(pSoldier->inv[BestAttack.bWeaponIn]) ); + ubBurstAPs = CalcAPsToBurst( pSoldier->CalcActionPoints(), &(pSoldier->inv[BestAttack.bWeaponIn]) ); if (pSoldier->bActionPoints >= BestAttack.ubAPCost + BestAttack.ubAimTime + ubBurstAPs ) { @@ -4391,7 +4398,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) else { iChance = (25 / max((BestAttack.ubAimTime + 1),1)); - switch (pSoldier->bAttitude) + switch (pSoldier->aiData.bAttitude) { case DEFENSIVE: iChance += -5; break; case BRAVESOLO: iChance += 5; break; @@ -4402,7 +4409,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) case ATTACKSLAYONLY:iChance += 30; break; } - if ( pSoldier->inv[BestAttack.bWeaponIn].ItemData.Gun.ubGunShotsLeft > 50 ) + if ( pSoldier->inv[BestAttack.bWeaponIn][0]->data.gun.ubGunShotsLeft > 50 ) iChance += 20; // increase chance based on proximity and difficulty of enemy @@ -4410,7 +4417,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) { DebugMsg(TOPIC_JA2AI,DBG_LEVEL_3,String("DecideActionBlack: check chance to burst")); iChance += ( 15 - PythSpacesAway( pSoldier->sGridNo, BestAttack.sTarget ) ) * ( 1 + SoldierDifficultyLevel( pSoldier ) ); - if ( pSoldier->bAttitude == ATTACKSLAYONLY ) + if ( pSoldier->aiData.bAttitude == ATTACKSLAYONLY ) { // increase it more! iChance += 5 * ( 15 - PythSpacesAway( pSoldier->sGridNo, BestAttack.sTarget ) ); @@ -4427,7 +4434,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) BestAttack.ubAimTime = BURSTING; BestAttack.ubAPCost = BestAttack.ubAPCost + ubBurstAPs; // check for spread burst possibilities - if (pSoldier->bAttitude != ATTACKSLAYONLY) + if (pSoldier->aiData.bAttitude != ATTACKSLAYONLY) { CalcSpreadBurst( pSoldier, BestAttack.sTarget, BestAttack.bTargetLevel ); } @@ -4435,9 +4442,9 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) } } - if (IsGunAutofireCapable( pSoldier, BestAttack.bWeaponIn ) && - !(Menptr[BestShot.ubOpponent].bLife < OKLIFE) && // don't burst at downed targets - (( pSoldier->inv[BestAttack.bWeaponIn].ItemData.Gun.ubGunShotsLeft > 1 && + if (IsGunAutofireCapable( &pSoldier->inv[BestAttack.bWeaponIn] ) && + !(Menptr[BestShot.ubOpponent].stats.bLife < OKLIFE) && // don't burst at downed targets + (( pSoldier->inv[BestAttack.bWeaponIn][0]->data.gun.ubGunShotsLeft > 1 && BestAttack.ubAimTime != BURSTING ) || Weapon[pSoldier->inv[BestAttack.bWeaponIn].usItem].NoSemiAuto) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: ENOUGH APs TO AUTOFIRE, RANDOM CHANCE OF DOING SO"); @@ -4445,10 +4452,10 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) do { pSoldier->bDoAutofire++; - ubBurstAPs = CalcAPsToAutofire( CalcActionPoints( pSoldier ), &(pSoldier->inv[BestAttack.bWeaponIn]), pSoldier->bDoAutofire ); + ubBurstAPs = CalcAPsToAutofire( pSoldier->CalcActionPoints(), &(pSoldier->inv[BestAttack.bWeaponIn]), pSoldier->bDoAutofire ); } while( pSoldier->bActionPoints >= BestAttack.ubAPCost + ubBurstAPs && - pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire && + pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.gun.ubGunShotsLeft >= pSoldier->bDoAutofire && GetAutoPenalty(&pSoldier->inv[ BestAttack.bWeaponIn ], gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_PRONE)*pSoldier->bDoAutofire <= 80); @@ -4456,7 +4463,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) pSoldier->bDoAutofire--; if (pSoldier->bDoAutofire > 0) { - ubBurstAPs = CalcAPsToAutofire( CalcActionPoints( pSoldier ), &(pSoldier->inv[BestAttack.bWeaponIn]), pSoldier->bDoAutofire ); + ubBurstAPs = CalcAPsToAutofire( pSoldier->CalcActionPoints(), &(pSoldier->inv[BestAttack.bWeaponIn]), pSoldier->bDoAutofire ); if (pSoldier->bActionPoints >= BestAttack.ubAPCost + ubBurstAPs ) { @@ -4468,7 +4475,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) else { iChance = (100 / max((BestAttack.ubAimTime + 1),1)); - switch (pSoldier->bAttitude) + switch (pSoldier->aiData.bAttitude) { case DEFENSIVE: iChance += -5; break; case BRAVESOLO: iChance += 5; break; @@ -4480,7 +4487,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) } - if ( pSoldier->inv[BestAttack.bWeaponIn].ItemData.Gun.ubGunShotsLeft > 50 ) + if ( pSoldier->inv[BestAttack.bWeaponIn][0]->data.gun.ubGunShotsLeft > 50 ) iChance += 30; if ( bInGas ) @@ -4491,7 +4498,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) { DebugMsg(TOPIC_JA2AI,DBG_LEVEL_3,String("DecideActionBlack: check chance to autofire")); iChance += ( 15 - PythSpacesAway( pSoldier->sGridNo, BestAttack.sTarget ) ) * ( 1 + SoldierDifficultyLevel( pSoldier ) ); - if ( pSoldier->bAttitude == ATTACKSLAYONLY ) + if ( pSoldier->aiData.bAttitude == ATTACKSLAYONLY ) { // increase it more! iChance += 5 * ( 15 - PythSpacesAway( pSoldier->sGridNo, BestAttack.sTarget ) ); @@ -4502,13 +4509,13 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) if ((INT32) PreRandom( 100 ) < iChance || Weapon[pSoldier->inv[BestAttack.bWeaponIn].usItem].NoSemiAuto) { BestAttack.ubAimTime = AUTOFIRING + pSoldier->bDoAutofire; - BestAttack.ubAPCost = BestAttack.ubAPCost + CalcAPsToAutofire( CalcActionPoints( pSoldier ), &(pSoldier->inv[BestAttack.bWeaponIn]), pSoldier->bDoAutofire ); + BestAttack.ubAPCost = BestAttack.ubAPCost + CalcAPsToAutofire( pSoldier->CalcActionPoints(), &(pSoldier->inv[BestAttack.bWeaponIn]), pSoldier->bDoAutofire ); } } } else { - pSoldier->bAimTime = 0; + pSoldier->aiData.bAimTime = 0; pSoldier->bDoBurst = 0; pSoldier->bDoAutofire = 0; // not enough aps - do somthing else @@ -4524,13 +4531,13 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) if (BestAttack.ubAimTime == BURSTING) { - pSoldier->bAimTime = 0; + pSoldier->aiData.bAimTime = 0; pSoldier->bDoBurst = 1; pSoldier->bDoAutofire = 0; } else if(BestAttack.ubAimTime >= AUTOFIRING) { - pSoldier->bAimTime = 0; + pSoldier->aiData.bAimTime = 0; pSoldier->bDoBurst = 1; pSoldier->bDoAutofire = BestAttack.ubAimTime-AUTOFIRING; @@ -4540,7 +4547,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) /* else // defaults already set { - pSoldier->bAimTime = BestAttack.ubAimTime; + pSoldier->aiData.bAimTime = BestAttack.ubAimTime; pSoldier->bDoBurst = 0; } */ @@ -4552,13 +4559,13 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) { // we had better make sure we lower our gun first! - pSoldier->bAction = AI_ACTION_LOWER_GUN; - pSoldier->usActionData = 0; + pSoldier->aiData.bAction = AI_ACTION_LOWER_GUN; + pSoldier->aiData.usActionData = 0; // queue up attack for after we lower weapon if any - pSoldier->bNextAction = AI_ACTION_THROW_KNIFE; - pSoldier->usNextActionData = BestAttack.sTarget; - pSoldier->bNextTargetLevel = BestAttack.bTargetLevel; + pSoldier->aiData.bNextAction = AI_ACTION_THROW_KNIFE; + pSoldier->aiData.usNextActionData = BestAttack.sTarget; + pSoldier->aiData.bNextTargetLevel = BestAttack.bTargetLevel; } } @@ -4578,16 +4585,16 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) if (fChangeStanceFirst) { // currently only for guns... - pSoldier->bNextAction = AI_ACTION_FIRE_GUN; - pSoldier->usNextActionData = BestAttack.sTarget; - pSoldier->bNextTargetLevel = BestAttack.bTargetLevel; - pSoldier->usActionData = ubBestStance; + pSoldier->aiData.bNextAction = AI_ACTION_FIRE_GUN; + pSoldier->aiData.usNextActionData = BestAttack.sTarget; + pSoldier->aiData.bNextTargetLevel = BestAttack.bTargetLevel; + pSoldier->aiData.usActionData = ubBestStance; return( AI_ACTION_CHANGE_STANCE ); } else { - pSoldier->usActionData = BestAttack.sTarget; + pSoldier->aiData.usActionData = BestAttack.sTarget; pSoldier->bTargetLevel = BestAttack.bTargetLevel; #ifdef DEBUGDECISIONS @@ -4602,13 +4609,13 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) #endif - DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("DecideActionBlack: Check for GL Bursts, is launcher capable? = %d, rtpcombat? = %d, bestattackaction = %d",IsGunBurstCapable( pSoldier, BestAttack.bWeaponIn, FALSE ),pSoldier->bRTPCombat,ubBestAttackAction )); - if (ubBestAttackAction == AI_ACTION_TOSS_PROJECTILE && (Item[pSoldier->inv[BestAttack.bWeaponIn].usItem].usItemClass == IC_LAUNCHER && IsGunBurstCapable( pSoldier, BestAttack.bWeaponIn, FALSE )) && - (pSoldier->bTeam != gbPlayerNum || pSoldier->bRTPCombat == RTP_COMBAT_AGGRESSIVE) ) + DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("DecideActionBlack: Check for GL Bursts, is launcher capable? = %d, rtpcombat? = %d, bestattackaction = %d",IsGunBurstCapable( pSoldier, BestAttack.bWeaponIn, FALSE ),pSoldier->aiData.bRTPCombat,ubBestAttackAction )); + if (ubBestAttackAction == AI_ACTION_TOSS_PROJECTILE && (Item[pSoldier->inv[BestAttack.bWeaponIn].usItem].usItemClass == IC_LAUNCHER && IsGunBurstCapable( &pSoldier->inv[BestAttack.bWeaponIn], FALSE, pSoldier )) && + (pSoldier->bTeam != gbPlayerNum || pSoldier->aiData.bRTPCombat == RTP_COMBAT_AGGRESSIVE) ) { DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "DecideActionBlack: Doing burst calc"); - ubBurstAPs = CalcAPsToBurst( CalcActionPoints( pSoldier ), &(pSoldier->inv[BestAttack.bWeaponIn]) ); + ubBurstAPs = CalcAPsToBurst( pSoldier->CalcActionPoints(), &(pSoldier->inv[BestAttack.bWeaponIn]) ); if ( (pSoldier->bActionPoints - BestAttack.ubAPCost) >= ubBurstAPs ) { @@ -4620,7 +4627,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) else { iChance = 50; - switch (pSoldier->bAttitude) + switch (pSoldier->aiData.bAttitude) { case DEFENSIVE: iChance += -5; break; case BRAVESOLO: iChance += 5; break; @@ -4639,9 +4646,9 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) { DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "DecideActionBlack: Doing GL burst"); BestAttack.ubAimTime = BURSTING; - BestAttack.ubAPCost = BestAttack.ubAPCost + CalcAPsToBurst( CalcActionPoints( pSoldier ), &(pSoldier->inv[HANDPOS]) ); + BestAttack.ubAPCost = BestAttack.ubAPCost + CalcAPsToBurst( pSoldier->CalcActionPoints(), &(pSoldier->inv[HANDPOS]) ); // check for spread burst possibilities - if (pSoldier->bAttitude != ATTACKSLAYONLY) + if (pSoldier->aiData.bAttitude != ATTACKSLAYONLY) { CalcSpreadBurst( pSoldier, BestAttack.sTarget, BestAttack.bTargetLevel ); } @@ -4664,7 +4671,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) } // try to make boxer close if possible - if (pSoldier->uiStatusFlags & SOLDIER_BOXER ) + if (pSoldier->flags.uiStatusFlags & SOLDIER_BOXER ) { if ( ubCanMove ) { @@ -4674,18 +4681,18 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) // temporarily make boxer have orders of CLOSEPATROL rather than STATIONARY // And make him patrol the ring, not his usual place // so he has a good roaming range - USHORT tgrd = pSoldier->usPatrolGrid[0]; - pSoldier->usPatrolGrid[0] = pSoldier->sGridNo; - pSoldier->bOrders = CLOSEPATROL; - pSoldier->usActionData = GoAsFarAsPossibleTowards( pSoldier, sClosestOpponent, AI_ACTION_GET_CLOSER ); - pSoldier->usPatrolGrid[0] = tgrd; - pSoldier->bOrders = STATIONARY; - if ( pSoldier->usActionData != NOWHERE ) + USHORT tgrd = pSoldier->aiData.sPatrolGrid[0]; + pSoldier->aiData.sPatrolGrid[0] = pSoldier->sGridNo; + pSoldier->aiData.bOrders = CLOSEPATROL; + pSoldier->aiData.usActionData = GoAsFarAsPossibleTowards( pSoldier, sClosestOpponent, AI_ACTION_GET_CLOSER ); + pSoldier->aiData.sPatrolGrid[0] = tgrd; + pSoldier->aiData.bOrders = STATIONARY; + if ( pSoldier->aiData.usActionData != NOWHERE ) { // truncate path to 1 step - pSoldier->usActionData = pSoldier->sGridNo + DirectionInc( (UINT8) pSoldier->usPathingData[0] ); - pSoldier->sFinalDestination = pSoldier->usActionData; - pSoldier->bNextAction = AI_ACTION_END_TURN; + pSoldier->aiData.usActionData = pSoldier->sGridNo + DirectionInc( (UINT8) pSoldier->pathing.usPathingData[0] ); + pSoldier->pathing.sFinalDestination = pSoldier->aiData.usActionData; + pSoldier->aiData.bNextAction = AI_ACTION_END_TURN; return( AI_ACTION_GET_CLOSER ); } } @@ -4706,8 +4713,8 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) pSoldier->name,sBestCover,iCoverPercentBetter); DebugAI( tempstr ) ; #endif - //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"AI %d taking cover, morale %d, from %d to %d", pSoldier->ubID, pSoldier->bAIMorale, pSoldier->sGridNo, sBestCover ); - pSoldier->usActionData = sBestCover; + //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"AI %d taking cover, morale %d, from %d to %d", pSoldier->ubID, pSoldier->aiData.bAIMorale, pSoldier->sGridNo, sBestCover ); + pSoldier->aiData.usActionData = sBestCover; return(AI_ACTION_TAKE_COVER); } @@ -4718,18 +4725,18 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) //////////////////////////////////////////////////////////////////////////// // if soldier has enough APs left to move at least 1 square's worth - if ( ubCanMove && (pSoldier->bTeam != gbPlayerNum || pSoldier->fAIFlags & AI_RTP_OPTION_CAN_RETREAT) ) + if ( ubCanMove && (pSoldier->bTeam != gbPlayerNum || pSoldier->aiData.fAIFlags & AI_RTP_OPTION_CAN_RETREAT) ) { - if ((pSoldier->bAIMorale == MORALE_HOPELESS) || !bCanAttack) + if ((pSoldier->aiData.bAIMorale == MORALE_HOPELESS) || !bCanAttack) { // look for best place to RUN AWAY to (farthest from the closest threat) - //pSoldier->usActionData = RunAway( pSoldier ); - pSoldier->usActionData = FindSpotMaxDistFromOpponents(pSoldier); + //pSoldier->aiData.usActionData = RunAway( pSoldier ); + pSoldier->aiData.usActionData = FindSpotMaxDistFromOpponents(pSoldier); - if (pSoldier->usActionData != NOWHERE) + if (pSoldier->aiData.usActionData != NOWHERE) { #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - RUNNING AWAY to grid %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - RUNNING AWAY to grid %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif @@ -4747,7 +4754,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) // and we're not swimming in deep water, and somebody has called for spotters // and we see the location of at least 2 opponents if ((gTacticalStatus.ubSpottersCalledForBy != NOBODY) && (pSoldier->bActionPoints >= AP_RADIO) && - (pSoldier->bOppCnt > 1) && !fCivilian && + (pSoldier->aiData.bOppCnt > 1) && !fCivilian && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1) && !bInDeepWater) { // base chance depends on how much new info we have to radio to the others @@ -4781,14 +4788,14 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) { if ( !fCivilian && !gfHiddenInterrupt && IsValidStance( pSoldier, ANIM_CROUCH ) ) { - pSoldier->usActionData = StanceChange( pSoldier, BestAttack.ubAPCost ); - if (pSoldier->usActionData != 0) + pSoldier->aiData.usActionData = StanceChange( pSoldier, BestAttack.ubAPCost ); + if (pSoldier->aiData.usActionData != 0) { - if (pSoldier->usActionData == ANIM_PRONE) + if (pSoldier->aiData.usActionData == ANIM_PRONE) { // we might want to turn before lying down! - if ( (!gfTurnBasedAI || GetAPsToLook( pSoldier ) <= pSoldier->bActionPoints - GetAPsToChangeStance( pSoldier, (INT8) pSoldier->usActionData )) && - (((pSoldier->bAIMorale > MORALE_HOPELESS) || ubCanMove) && !AimingGun(pSoldier)) ) + if ( (!gfTurnBasedAI || GetAPsToLook( pSoldier ) <= pSoldier->bActionPoints - GetAPsToChangeStance( pSoldier, (INT8) pSoldier->aiData.usActionData )) && + (((pSoldier->aiData.bAIMorale > MORALE_HOPELESS) || ubCanMove) && !AimingGun(pSoldier)) ) { // determine the location of the known closest opponent // (don't care if he's conscious, don't care if he's reachable at all) @@ -4802,23 +4809,23 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) // if we're not facing towards him if (pSoldier->ubDirection != bDirection) { - if ( InternalIsValidStance( pSoldier, bDirection, (INT8) pSoldier->usActionData) ) + if ( pSoldier->InternalIsValidStance( bDirection, (INT8) pSoldier->aiData.usActionData) ) { // change direction, THEN change stance! - pSoldier->bNextAction = AI_ACTION_CHANGE_STANCE; - pSoldier->usNextActionData = pSoldier->usActionData; - pSoldier->usActionData = bDirection; + pSoldier->aiData.bNextAction = AI_ACTION_CHANGE_STANCE; + pSoldier->aiData.usNextActionData = pSoldier->aiData.usActionData; + pSoldier->aiData.usActionData = bDirection; #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - TURNS to face CLOSEST OPPONENT in direction %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - TURNS to face CLOSEST OPPONENT in direction %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif return(AI_ACTION_CHANGE_FACING); } - else if ( (pSoldier->usActionData == ANIM_PRONE) && (InternalIsValidStance( pSoldier, bDirection, ANIM_CROUCH) ) ) + else if ( (pSoldier->aiData.usActionData == ANIM_PRONE) && (pSoldier->InternalIsValidStance( bDirection, ANIM_CROUCH) ) ) { // we shouldn't go prone, since we can't turn to shoot - pSoldier->usActionData = ANIM_CROUCH; - pSoldier->bNextAction = AI_ACTION_END_TURN; + pSoldier->aiData.usActionData = ANIM_CROUCH; + pSoldier->aiData.bNextAction = AI_ACTION_END_TURN; return( AI_ACTION_CHANGE_STANCE ); } } @@ -4830,7 +4837,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) // we don't want to turn } - pSoldier->bNextAction = AI_ACTION_END_TURN; + pSoldier->aiData.bNextAction = AI_ACTION_END_TURN; return( AI_ACTION_CHANGE_STANCE ); } } @@ -4845,7 +4852,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) // hopeless guys shouldn't waste their time this way, UNLESS they CAN move // but chose not to to get this far (which probably means they're cornered) // ALSO, don't bother turning if we're already aiming a gun - if ( !gfHiddenInterrupt && ((pSoldier->bAIMorale > MORALE_HOPELESS) || ubCanMove) && !AimingGun(pSoldier)) + if ( !gfHiddenInterrupt && ((pSoldier->aiData.bAIMorale > MORALE_HOPELESS) || ubCanMove) && !AimingGun(pSoldier)) { // determine the location of the known closest opponent // (don't care if he's conscious, don't care if he's reachable at all) @@ -4858,12 +4865,12 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) bDirection = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sClosestOpponent),CenterY(sClosestOpponent)); // if we're not facing towards him - if ( pSoldier->ubDirection != bDirection && InternalIsValidStance( pSoldier, bDirection, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) ) + if ( pSoldier->ubDirection != bDirection && pSoldier->InternalIsValidStance( bDirection, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) ) { - pSoldier->usActionData = bDirection; + pSoldier->aiData.usActionData = bDirection; #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - TURNS to face CLOSEST OPPONENT in direction %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - TURNS to face CLOSEST OPPONENT in direction %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif @@ -4896,7 +4903,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) if (iChance && !bInDeepWater) { // modify base chance according to orders - switch (pSoldier->bOrders) + switch (pSoldier->aiData.bOrders) { case STATIONARY: iChance += 20; break; case ONGUARD: iChance += 15; break; @@ -4910,7 +4917,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) } // modify base chance according to attitude - switch (pSoldier->bAttitude) + switch (pSoldier->aiData.bAttitude) { case DEFENSIVE: iChance += 20; break; case BRAVESOLO: iChance += -10; break; @@ -4928,7 +4935,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) else { // modify base chance according to morale - switch (pSoldier->bAIMorale) + switch (pSoldier->aiData.bAIMorale) { case MORALE_HOPELESS: iChance *= 3; break; case MORALE_WORRIED: iChance *= 2; break; @@ -4971,7 +4978,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) #endif // by default, if everything else fails, just stand in place and wait - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return(AI_ACTION_NONE); } @@ -4990,7 +4997,7 @@ INT8 DecideAction(SOLDIERTYPE *pSoldier) if ( pSoldier->bTeam != MILITIA_TEAM ) { - if ( !sniperwarning && pSoldier->bOrders == SNIPER ) + if ( !sniperwarning && pSoldier->aiData.bOrders == SNIPER ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_WATHCHOUTFORSNIPERS] ); sniperwarning = TRUE; @@ -5004,13 +5011,13 @@ INT8 DecideAction(SOLDIERTYPE *pSoldier) } } // turn off cautious flag - pSoldier->fAIFlags &= (~AI_CAUTIOUS); + pSoldier->aiData.fAIFlags &= (~AI_CAUTIOUS); //reset flank count //NumMessage("DecideAction - Guy#",pSoldier->ubID); // if the NPC is being "ESCORTED" (seen civilians only for now) - if (pSoldier->bUnderEscort) + if (pSoldier->aiData.bUnderEscort) { #ifdef DEBUGDECISIONS AIPopMessage("AlertStatus = ESCORT"); @@ -5021,18 +5028,18 @@ INT8 DecideAction(SOLDIERTYPE *pSoldier) else // "normal" NPC AI { // if status over-ride is set, bypass RED/YELLOW and go directly to GREEN! - if ((pSoldier->bBypassToGreen) && (pSoldier->bAlertStatus < STATUS_BLACK)) + if ((pSoldier->aiData.bBypassToGreen) && (pSoldier->aiData.bAlertStatus < STATUS_BLACK)) { bAction = DecideActionGreen(pSoldier); if ( !gfTurnBasedAI ) { // reset bypass now - pSoldier->bBypassToGreen = 0; + pSoldier->aiData.bBypassToGreen = 0; } } else { - switch (pSoldier->bAlertStatus) + switch (pSoldier->aiData.bAlertStatus) { case STATUS_GREEN: #ifdef DEBUGDECISIONS @@ -5101,7 +5108,7 @@ INT8 DecideAction(SOLDIERTYPE *pSoldier) #ifdef DEBUGDECISIONS - sprintf( tempstr,"DecideAction: selected action %d, actionData %d\n\n",bAction,pSoldier->usActionData); + sprintf( tempstr,"DecideAction: selected action %d, actionData %d\n\n",bAction,pSoldier->aiData.usActionData); DebugAI( tempstr ); #endif @@ -5117,10 +5124,10 @@ INT8 DecideActionEscort(SOLDIERTYPE *pSoldier) #endif // if he has a place to go, and isn't already there... go! - if (pSoldier->usActionData != NOWHERE && (pSoldier->sGridNo != pSoldier->usActionData)) + if (pSoldier->aiData.usActionData != NOWHERE && (pSoldier->sGridNo != pSoldier->aiData.usActionData)) { #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - ESCORTED NPC GOING to grid %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - ESCORTED NPC GOING to grid %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif @@ -5148,20 +5155,20 @@ void DecideAlertStatus( SOLDIERTYPE *pSoldier ) // save the man's previous status - if (pSoldier->uiStatusFlags & SOLDIER_MONSTER) + if (pSoldier->flags.uiStatusFlags & SOLDIER_MONSTER) { CreatureDecideAlertStatus( pSoldier ); return; } - bOldStatus = pSoldier->bAlertStatus; + bOldStatus = pSoldier->aiData.bAlertStatus; // determine the current alert status for this category of man - //if (!(pSoldier->uiStatusFlags & SOLDIER_PC)) + //if (!(pSoldier->flags.uiStatusFlags & SOLDIER_PC)) { - if (pSoldier->bOppCnt > 0) // opponent(s) in sight + if (pSoldier->aiData.bOppCnt > 0) // opponent(s) in sight { - pSoldier->bAlertStatus = STATUS_BLACK; + pSoldier->aiData.bAlertStatus = STATUS_BLACK; CheckForChangingOrders( pSoldier ); } else // no opponents are in sight @@ -5170,7 +5177,7 @@ void DecideAlertStatus( SOLDIERTYPE *pSoldier ) { case STATUS_BLACK: // then drop back to RED status - pSoldier->bAlertStatus = STATUS_RED; + pSoldier->aiData.bAlertStatus = STATUS_RED; break; case STATUS_RED: @@ -5179,19 +5186,19 @@ void DecideAlertStatus( SOLDIERTYPE *pSoldier ) case STATUS_YELLOW: // if all enemies have been RED alerted, or we're under fire - if (!PTR_CIVILIAN && (gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition || pSoldier->bUnderFire)) + if (!PTR_CIVILIAN && (gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition || pSoldier->aiData.bUnderFire)) { - pSoldier->bAlertStatus = STATUS_RED; + pSoldier->aiData.bAlertStatus = STATUS_RED; } else { // if we are NOT aware of any uninvestigated noises right now // and we are not currently in the middle of an action // (could still be on his way heading to investigate a noise!) - if ((MostImportantNoiseHeard(pSoldier,&iDummy,&fClimbDummy,&fReachableDummy) == NOWHERE) && !pSoldier->bActionInProgress) + if ((MostImportantNoiseHeard(pSoldier,&iDummy,&fClimbDummy,&fReachableDummy) == NOWHERE) && !pSoldier->aiData.bActionInProgress) { // then drop back to GREEN status - pSoldier->bAlertStatus = STATUS_GREEN; + pSoldier->aiData.bAlertStatus = STATUS_GREEN; CheckForChangingOrders( pSoldier ); } } @@ -5199,9 +5206,9 @@ void DecideAlertStatus( SOLDIERTYPE *pSoldier ) case STATUS_GREEN: // if all enemies have been RED alerted, or we're under fire - if (!PTR_CIVILIAN && (gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition || pSoldier->bUnderFire)) + if (!PTR_CIVILIAN && (gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition || pSoldier->aiData.bUnderFire)) { - pSoldier->bAlertStatus = STATUS_RED; + pSoldier->aiData.bAlertStatus = STATUS_RED; } else { @@ -5209,7 +5216,7 @@ void DecideAlertStatus( SOLDIERTYPE *pSoldier ) if (MostImportantNoiseHeard(pSoldier,&iDummy,&fClimbDummy,&fReachableDummy) != NOWHERE) { // then move up to YELLOW status - pSoldier->bAlertStatus = STATUS_YELLOW; + pSoldier->aiData.bAlertStatus = STATUS_YELLOW; } } break; @@ -5223,20 +5230,20 @@ void DecideAlertStatus( SOLDIERTYPE *pSoldier ) { if (pSoldier->bOppCnt > 0) { - pSoldier->bAlertStatus = STATUS_BLACK; // opponent(s) in sight + pSoldier->aiData.bAlertStatus = STATUS_BLACK; // opponent(s) in sight } else { - pSoldier->bAlertStatus = STATUS_RED; // enemy sector + pSoldier->aiData.bAlertStatus = STATUS_RED; // enemy sector /* // wow, JA1 stuff... // good guys all have a built-in, magic, "enemy detecting radar"... if (Status.enemies) - pSoldier->bAlertStatus = STATUS_RED; // enemy sector + pSoldier->aiData.bAlertStatus = STATUS_RED; // enemy sector else { - pSoldier->bAlertStatus = STATUS_GREEN; // secured sector + pSoldier->aiData.bAlertStatus = STATUS_GREEN; // secured sector // if he just dropped back from alert status, and it's a GUARD if ((oldStatus >= STATUS_RED) && (pSoldier->manCategory == MAN_GUARD)) @@ -5267,18 +5274,18 @@ void DecideAlertStatus( SOLDIERTYPE *pSoldier ) { // if the man's alert status has changed in any way - if (pSoldier->bAlertStatus != bOldStatus) + if (pSoldier->aiData.bAlertStatus != bOldStatus) { // HERE ARE TRYING TO AVOID NPCs SHUFFLING BACK & FORTH BETWEEN RED & BLACK // if either status is < RED (ie. anything but RED->BLACK && BLACK->RED) - if ((bOldStatus < STATUS_RED) || (pSoldier->bAlertStatus < STATUS_RED)) + if ((bOldStatus < STATUS_RED) || (pSoldier->aiData.bAlertStatus < STATUS_RED)) { // force a NEW action decision on next pass through HandleManAI() SetNewSituation( pSoldier ); } // if this guy JUST discovered that there were opponents here for sure... - if ((bOldStatus < STATUS_RED) && (pSoldier->bAlertStatus >= STATUS_RED)) + if ((bOldStatus < STATUS_RED) && (pSoldier->aiData.bAlertStatus >= STATUS_RED)) { CheckForChangingOrders(pSoldier); } @@ -5286,7 +5293,7 @@ void DecideAlertStatus( SOLDIERTYPE *pSoldier ) #ifdef DEBUGDECISIONS // don't report status changes for human-controlled mercs sprintf(tempstr,"%s's Alert Status changed from %d to %d", - pSoldier->name,bOldStatus,pSoldier->bAlertStatus); + pSoldier->name,bOldStatus,pSoldier->aiData.bAlertStatus); AIPopMessage(tempstr); #endif @@ -5295,21 +5302,21 @@ void DecideAlertStatus( SOLDIERTYPE *pSoldier ) { // only do this stuff in TB // if a guy on status GREEN or YELLOW is running low on breath - if (((pSoldier->bAlertStatus == STATUS_GREEN) && (pSoldier->bBreath < 75)) || - ((pSoldier->bAlertStatus == STATUS_YELLOW) && (pSoldier->bBreath < 50))) + if (((pSoldier->aiData.bAlertStatus == STATUS_GREEN) && (pSoldier->bBreath < 75)) || + ((pSoldier->aiData.bAlertStatus == STATUS_YELLOW) && (pSoldier->bBreath < 50))) { // as long as he's not in water (standing on a bridge is OK) - if (!MercInWater(pSoldier)) + if (!pSoldier->MercInWater()) { // force a NEW decision so that he can get some rest SetNewSituation( pSoldier ); // current action will be canceled. if noise is no longer important - if ((pSoldier->bAlertStatus == STATUS_YELLOW) && + if ((pSoldier->aiData.bAlertStatus == STATUS_YELLOW) && (MostImportantNoiseHeard(pSoldier,&iDummy,&fClimbDummy,&fReachableDummy) == NOWHERE)) { // then drop back to GREEN status - pSoldier->bAlertStatus = STATUS_GREEN; + pSoldier->aiData.bAlertStatus = STATUS_GREEN; CheckForChangingOrders( pSoldier ); } } @@ -5320,7 +5327,7 @@ void DecideAlertStatus( SOLDIERTYPE *pSoldier ) gTacticalStatus.bBoxingState == WON_ROUND || gTacticalStatus.bBoxingState == LOST_ROUND) { - pSoldier->bAlertStatus = STATUS_GREEN; + pSoldier->aiData.bAlertStatus = STATUS_GREEN; } } diff --git a/TacticalAI/FindLocations.cpp b/TacticalAI/FindLocations.cpp index 207e10a0..2915942a 100644 --- a/TacticalAI/FindLocations.cpp +++ b/TacticalAI/FindLocations.cpp @@ -27,7 +27,8 @@ #include "strategicmap.h" #include "environment.h" #include "lighting.h" - #include "Buildings.h" + #include "Buildings.h" + #include "GameSettings.h" #endif #include "PathAIDebug.h" @@ -58,38 +59,38 @@ INT32 CalcPercentBetter(INT32 iOldValue, INT32 iNewValue, INT32 iOldScale, INT32 // here, the change in cover HAS to be an improvement over current cover if (iValueChange <= 0) - { + { #ifdef BETAVERSION - sprintf(tempstr,"CalcPercentBetter: ERROR - invalid valueChange = %d",valueChange); + sprintf(tempstr,"CalcPercentBetter: ERROR - invalid valueChange = %d",valueChange); #ifdef RECORDNET - fprintf(NetDebugFile,"\n\t%s\n\n",tempstr); + fprintf(NetDebugFile,"\n\t%s\n\n",tempstr); #endif - PopMessage(tempstr); + PopMessage(tempstr); #endif - return(NOWHERE); - } + return(NOWHERE); + } iScaleSum = iOldScale + iNewScale; // here, the change in cover HAS to be an improvement over current cover if (iScaleSum <= 0) - { + { #ifdef BETAVERSION - sprintf(tempstr,"CalcPercentBetter: ERROR - invalid scaleSum = %d",iScaleSum); + sprintf(tempstr,"CalcPercentBetter: ERROR - invalid scaleSum = %d",iScaleSum); #ifdef RECORDNET - fprintf(NetDebugFile,"\n\t%s\n\n",tempstr); + fprintf(NetDebugFile,"\n\t%s\n\n",tempstr); #endif - PopMessage(tempstr); + PopMessage(tempstr); #endif - return(NOWHERE); - } + return(NOWHERE); + } @@ -143,7 +144,7 @@ INT8 CalcWorstCTGTForPosition( SOLDIERTYPE * pSoldier, UINT8 ubOppID, INT16 sOpp bThisCTGT = SoldierToLocationChanceToGetThrough( pSoldier, sOppGridNo, bLevel, bCubeLevel, ubOppID ); if (bThisCTGT < bWorstCTGT) - { + { bWorstCTGT = bThisCTGT; // if there is perfect cover if (bWorstCTGT == 0) @@ -159,7 +160,7 @@ INT8 CalcAverageCTGTForPosition( SOLDIERTYPE * pSoldier, UINT8 ubOppID, INT16 sO // When considering a gridno for cover, we want to take into account cover if we // lie down, so we return the LOWEST chance to get through for that location. INT8 bCubeLevel; - INT32 iTotalCTGT = 0, bValidCubeLevels = 0;; + INT32 iTotalCTGT = 0, bValidCubeLevels = 0; for (bCubeLevel = 1; bCubeLevel <= 3; bCubeLevel++) { @@ -240,7 +241,7 @@ INT8 CalcBestCTGT( SOLDIERTYPE *pSoldier, UINT8 ubOppID, INT16 sOppGridNo, INT8 sCheckSpot = sSouthGridNo; break; } - + // ATE: OLD STUFF // if the adjacent gridno is reachable from the starting spot if ( NewOKDestination( pSoldier, sCheckSpot, FALSE, bLevel ) ) @@ -249,11 +250,11 @@ INT8 CalcBestCTGT( SOLDIERTYPE *pSoldier, UINT8 ubOppID, INT16 sOppGridNo, INT8 // "virtually" so we can calculate what our cover is from there // NOTE: GOTTA SET THESE 3 FIELDS *BACK* AFTER USING THIS FUNCTION!!! - pSoldier->sGridNo = sAdjSpot; // pretend he's standing at 'sAdjSpot' - AICenterXY( sAdjSpot, &(pSoldier->dXPos), &(pSoldier->dYPos) ); + pSoldier->sGridNo = sAdjSpot; // pretend he's standing at 'sAdjSpot' + AICenterXY( sAdjSpot, &(pSoldier->dXPos), &(pSoldier->dYPos) ); bThisCTGT = CalcWorstCTGTForPosition( pSoldier, ubOppID, sOppGridNo, bLevel, iMyAPsLeft ); if (bThisCTGT > bBestCTGT) - { + { bBestCTGT = bThisCTGT; // if there is no cover if (bBestCTGT == 100) @@ -270,7 +271,7 @@ INT8 CalcBestCTGT( SOLDIERTYPE *pSoldier, UINT8 ubOppID, INT16 sOppGridNo, INT8 INT32 CalcCoverValue(SOLDIERTYPE *pMe, INT16 sMyGridNo, INT32 iMyThreat, INT32 iMyAPsLeft, - UINT32 uiThreatIndex, INT32 iRange, INT32 morale, INT32 *iTotalScale) + UINT32 uiThreatIndex, INT32 iRange, INT32 morale, INT32 *iTotalScale) { DebugMsg(TOPIC_JA2AI,DBG_LEVEL_3,String("CalcCoverValue")); @@ -289,17 +290,17 @@ INT32 CalcCoverValue(SOLDIERTYPE *pMe, INT16 sMyGridNo, INT32 iMyThreat, INT32 i pHim = Threat[uiThreatIndex].pOpponent; sHisGridNo = Threat[uiThreatIndex].sGridNo; - // THE FOLLOWING STUFF IS *VEERRRY SCAARRRY*, BUT SHOULD WORK. IF YOU REALLY + // THE FOLLOWING STUFF IS *VEERRRY SCAARRRY*, BUT SHOULD WORK. IF YOU REALLY // HATE IT, THEN CHANGE ChanceToGetThrough() TO WORK FROM A GRIDNO TO GRIDNO // if this is theoretical, and I'm not actually at sMyGridNo right now if (pMe->sGridNo != sMyGridNo) { - sMyRealGridNo = pMe->sGridNo; // remember where I REALLY am + sMyRealGridNo = pMe->sGridNo; // remember where I REALLY am dMyX = pMe->dXPos; dMyY = pMe->dYPos; - pMe->sGridNo = sMyGridNo; // but pretend I'm standing at sMyGridNo + pMe->sGridNo = sMyGridNo; // but pretend I'm standing at sMyGridNo ConvertGridNoToCenterCellXY( sMyGridNo, &sTempX, &sTempY ); pMe->dXPos = (FLOAT) sTempX; pMe->dYPos = (FLOAT) sTempY; @@ -308,11 +309,11 @@ INT32 CalcCoverValue(SOLDIERTYPE *pMe, INT16 sMyGridNo, INT32 iMyThreat, INT32 i // if this is theoretical, and he's not actually at hisGrid right now if (pHim->sGridNo != sHisGridNo) { - sHisRealGridNo = pHim->sGridNo; // remember where he REALLY is + sHisRealGridNo = pHim->sGridNo; // remember where he REALLY is dHisX = pHim->dXPos; dHisY = pHim->dYPos; - pHim->sGridNo = sHisGridNo; // but pretend he's standing at sHisGridNo + pHim->sGridNo = sHisGridNo; // but pretend he's standing at sHisGridNo ConvertGridNoToCenterCellXY( sHisGridNo, &sTempX, &sTempY ); pHim->dXPos = (FLOAT) sTempX; pHim->dYPos = (FLOAT) sTempY; @@ -327,8 +328,8 @@ INT32 CalcCoverValue(SOLDIERTYPE *pMe, INT16 sMyGridNo, INT32 iMyThreat, INT32 i { // optimistically assume we'll be behind the best cover available at this spot - //bHisActualCTGT = ChanceToGetThrough(pHim,sMyGridNo,FAKE,ACTUAL,TESTWALLS,9999,M9PISTOL,NOT_FOR_LOS); // assume a gunshot - bHisActualCTGT = CalcWorstCTGTForPosition( pHim, pMe->ubID, sMyGridNo, pMe->bLevel, iMyAPsLeft ); + //bHisActualCTGT = ChanceToGetThrough(pHim,sMyGridNo,FAKE,ACTUAL,TESTWALLS,9999,M9PISTOL,NOT_FOR_LOS); // assume a gunshot + bHisActualCTGT = CalcWorstCTGTForPosition( pHim, pMe->ubID, sMyGridNo, pMe->pathing.bLevel, iMyAPsLeft ); } // normally, that will be the cover I'll use, unless worst case over-rides it @@ -341,13 +342,13 @@ INT32 CalcCoverValue(SOLDIERTYPE *pMe, INT16 sMyGridNo, INT32 iMyThreat, INT32 i // because calculating worst case is about to play with it in a big way! if (sHisRealGridNo == NOWHERE) { - sHisRealGridNo = pHim->sGridNo; // remember where he REALLY is + sHisRealGridNo = pHim->sGridNo; // remember where he REALLY is dHisX = pHim->dXPos; dHisY = pHim->dYPos; } // calculate where my cover is worst if opponent moves just 1 tile over - bHisBestCTGT = CalcBestCTGT(pHim, pMe->ubID, sMyGridNo, pMe->bLevel, iMyAPsLeft); + bHisBestCTGT = CalcBestCTGT(pHim, pMe->ubID, sMyGridNo, pMe->pathing.bLevel, iMyAPsLeft); // if he can actually improve his CTGT by moving to a nearby gridno if (bHisBestCTGT > bHisActualCTGT) @@ -378,7 +379,7 @@ INT32 CalcCoverValue(SOLDIERTYPE *pMe, INT16 sMyGridNo, INT32 iMyThreat, INT32 i // let's not assume anything about the stance the enemy might take, so take an average // value... no cover give a higher value than partial cover - bMyCTGT = CalcAverageCTGTForPosition( pMe, pHim->ubID, sHisGridNo, pHim->bLevel, iMyAPsLeft ); + bMyCTGT = CalcAverageCTGTForPosition( pMe, pHim->ubID, sHisGridNo, pHim->pathing.bLevel, iMyAPsLeft ); // since NPCs are too dumb to shoot "blind", ie. at opponents that they // themselves can't see (mercs can, using another as a spotter!), if the @@ -392,47 +393,47 @@ INT32 CalcCoverValue(SOLDIERTYPE *pMe, INT16 sMyGridNo, INT32 iMyThreat, INT32 i // UNDO ANY TEMPORARY "DAMAGE" DONE ABOVE if (sMyRealGridNo != NOWHERE) { - pMe->sGridNo = sMyRealGridNo; // put me back where I belong! - pMe->dXPos = dMyX; // also change the 'x' - pMe->dYPos = dMyY; // and the 'y' + pMe->sGridNo = sMyRealGridNo; // put me back where I belong! + pMe->dXPos = dMyX; // also change the 'x' + pMe->dYPos = dMyY; // and the 'y' } if (sHisRealGridNo != NOWHERE) { - pHim->sGridNo = sHisRealGridNo; // put HIM back where HE belongs! - pHim->dXPos = dHisX; // also change the 'x' - pHim->dYPos = dHisY; // and the 'y' + pHim->sGridNo = sHisRealGridNo; // put HIM back where HE belongs! + pHim->dXPos = dHisX; // also change the 'x' + pHim->dYPos = dHisY; // and the 'y' } // these value should be < 1 million each iHisPosValue = bHisCTGT * Threat[uiThreatIndex].iValue * Threat[uiThreatIndex].iAPs; - iMyPosValue = bMyCTGT * iMyThreat * iMyAPsLeft; + iMyPosValue = bMyCTGT * iMyThreat * iMyAPsLeft; // try to account for who outnumbers who: the side with the advantage thus // (hopefully) values offense more, while those in trouble will play defense - if (pHim->bOppCnt > 1) + if (pHim->aiData.bOppCnt > 1) { - iHisPosValue /= pHim->bOppCnt; + iHisPosValue /= pHim->aiData.bOppCnt; } - if (pMe->bOppCnt > 1) + if (pMe->aiData.bOppCnt > 1) { - iMyPosValue /= pMe->bOppCnt; + iMyPosValue /= pMe->aiData.bOppCnt; } // if my positional value is worth something at all here if (iMyPosValue > 0) - { - // if I CAN'T crouch when I get there, that makes it significantly less - // appealing a spot (how much depends on range), so that's a penalty to me - if (iMyAPsLeft < AP_CROUCH) - // subtract another 1 % penalty for NOT being able to crouch per tile - // the farther away we are, the bigger a difference crouching will make! - iMyPosValue -= ((iMyPosValue * (AIM_PENALTY_TARGET_CROUCHED + (iRange / CELL_X_SIZE))) / 100); - } + { + // if I CAN'T crouch when I get there, that makes it significantly less + // appealing a spot (how much depends on range), so that's a penalty to me + if (iMyAPsLeft < AP_CROUCH) + // subtract another 1 % penalty for NOT being able to crouch per tile + // the farther away we are, the bigger a difference crouching will make! + iMyPosValue -= ((iMyPosValue * (AIM_PENALTY_TARGET_CROUCHED + (iRange / CELL_X_SIZE))) / 100); + } // high morale prefers decreasing the range (positive factor), while very @@ -479,7 +480,7 @@ INT32 CalcCoverValue(SOLDIERTYPE *pMe, INT16 sMyGridNo, INT32 iMyThreat, INT32 i // the farther apart we are, the less important the cover differences are // the less certain his position, the less important cover differences are iReductionFactor = ((MAX_THREAT_RANGE - iRange) * Threat[uiThreatIndex].iCertainty) / - MAX_THREAT_RANGE; + MAX_THREAT_RANGE; // divide by a 100 to make the numbers more managable and avoid 32-bit limit iThisScale = max( iMyPosValue, iHisPosValue) / 100; @@ -495,9 +496,9 @@ INT32 CalcCoverValue(SOLDIERTYPE *pMe, INT16 sMyGridNo, INT32 iMyThreat, INT32 i #ifdef DEBUGCOVER DebugAI( String( "CalcCoverValue: iCoverValue %d, sMyGridNo %d, sHisGrid %d, iRange %d, morale %d\n",iCoverValue,sMyGridNo,sHisGridNo,iRange,morale) ); - DebugAI( String( "CalcCoverValue: iCertainty %d, his bOppCnt %d, my bOppCnt %d\n",Threat[uiThreatIndex].iCertainty,pHim->bOppCnt,pMe->bOppCnt) ); + DebugAI( String( "CalcCoverValue: iCertainty %d, his bOppCnt %d, my bOppCnt %d\n",Threat[uiThreatIndex].iCertainty,pHim->aiData.bOppCnt,pMe->aiData.bOppCnt) ); DebugAI( String( "CalcCoverValue: bHisCTGT = %d, hisThreat = %d, hisFullAPs = %d\n",bHisCTGT,Threat[uiThreatIndex].iValue,Threat[uiThreatIndex].iAPs) ); - DebugAI( String( "CalcCoverValue: bMyCTGT = %d, iMyThreat = %d, iMyAPsLeft = %d\n", bMyCTGT, iMyThreat,iMyAPsLeft) ); + DebugAI( String( "CalcCoverValue: bMyCTGT = %d, iMyThreat = %d, iMyAPsLeft = %d\n", bMyCTGT, iMyThreat,iMyAPsLeft) ); DebugAI( String( "CalcCoverValue: hisPosValue = %d, myPosValue = %d\n",iHisPosValue,iMyPosValue) ); DebugAI( String( "CalcCoverValue: iThisScale = %d, iTotalScale = %d, iReductionFactor %d\n\n",iThisScale,*iTotalScale, iReductionFactor) ); #endif @@ -518,7 +519,7 @@ UINT8 NumberOfTeamMatesAdjacent( SOLDIERTYPE * pSoldier, INT16 sGridNo ) sTempGridNo = NewGridNo( sGridNo, DirectionInc( ubLoop ) ); if ( sTempGridNo != sGridNo ) { - ubWhoIsThere = WhoIsThere2( sGridNo, pSoldier->bLevel ); + ubWhoIsThere = WhoIsThere2( sGridNo, pSoldier->pathing.bLevel ); if ( ubWhoIsThere != NOBODY && ubWhoIsThere != pSoldier->ubID && MercPtrs[ ubWhoIsThere ]->bTeam == pSoldier->bTeam ) { ubCount++; @@ -602,7 +603,7 @@ INT16 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB pusLastLoc = &(gsLastKnownOppLoc[pSoldier->ubID][0]); // hang a pointer into personal opplist - pbPersOL = &(pSoldier->bOppList[0]); + pbPersOL = &(pSoldier->aiData.bOppList[0]); // hang a pointer into public opplist pbPublOL = &(gbPublicOpplist[pSoldier->bTeam][0]); @@ -610,7 +611,7 @@ INT16 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB iSearchRange = gbDiff[DIFF_MAX_COVER_RANGE][ SoldierDifficultyLevel( pSoldier ) ]; /* - switch (pSoldier->bAttitude) + switch (pSoldier->aiData.bAttitude) { case DEFENSIVE: iSearchRange += 2; break; case BRAVESOLO: iSearchRange -= 4; break; @@ -622,9 +623,9 @@ INT16 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB // maximum search range is 1 tile / 8 pts of wisdom - if (iSearchRange > (pSoldier->bWisdom / 8)) + if (iSearchRange > (pSoldier->stats.bWisdom / 8)) { - iSearchRange = (pSoldier->bWisdom / 8); + iSearchRange = (pSoldier->stats.bWisdom / 8); } if (!gfTurnBasedAI) @@ -635,7 +636,7 @@ INT16 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB usMovementMode = DetermineMovementMode( pSoldier, AI_ACTION_TAKE_COVER ); - if (pSoldier->bAlertStatus >= STATUS_RED) // if already in battle + if (pSoldier->aiData.bAlertStatus >= STATUS_RED) // if already in battle { // must be able to reach the cover, so it can't possibly be more than // action points left (rounded down) tiles away, since minimum @@ -668,37 +669,37 @@ INT16 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB pOpponent = MercSlots[ uiLoop ]; // if this merc is inactive, at base, on assignment, dead, unconscious - if (!pOpponent || pOpponent->bLife < OKLIFE) + if (!pOpponent || pOpponent->stats.bLife < OKLIFE) { - continue; // next merc + continue; // next merc } // if this man is neutral / on the same side, he's not an opponent if ( CONSIDERED_NEUTRAL( pSoldier, pOpponent ) || (pSoldier->bSide == pOpponent->bSide)) { - continue; // next merc + continue; // next merc } - pbPersOL = pSoldier->bOppList + pOpponent->ubID; + pbPersOL = pSoldier->aiData.bOppList + pOpponent->ubID; pbPublOL = gbPublicOpplist[pSoldier->bTeam] + pOpponent->ubID; pusLastLoc = gsLastKnownOppLoc[pSoldier->ubID] + pOpponent->ubID; // if this opponent is unknown personally and publicly if ((*pbPersOL == NOT_HEARD_OR_SEEN) && (*pbPublOL == NOT_HEARD_OR_SEEN)) { - continue; // next merc + continue; // next merc } // Special stuff for Carmen the bounty hunter - if (pSoldier->bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != 64) + if (pSoldier->aiData.bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != 64) { - continue; // next opponent + continue; // next opponent } // if personal knowledge is more up to date or at least equal if ((gubKnowledgeValue[*pbPublOL - OLDEST_HEARD_VALUE][*pbPersOL - OLDEST_HEARD_VALUE] > 0) || (*pbPersOL == *pbPublOL)) - { + { // using personal knowledge, obtain opponent's "best guess" gridno sThreatLoc = *pusLastLoc; iThreatCertainty = ThreatPercent[*pbPersOL - OLDEST_HEARD_VALUE]; @@ -727,7 +728,7 @@ INT16 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB // AINameMessage(pOpponent,"is too far away to be a threat",1000); #endif - continue; // check next opponent + continue; // check next opponent } // remember this opponent as a current threat, but DON'T REDUCE FOR COVER! @@ -737,7 +738,7 @@ INT16 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB if (Threat[uiThreatCnt].iValue == -999) { //NameMessage(pOpponent,"is thought to be no threat"); - continue; // check next opponent + continue; // check next opponent } //NameMessage(pOpponent,"added to the list of threats"); @@ -749,7 +750,7 @@ INT16 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB Threat[uiThreatCnt].iOrigRange = iThreatRange; // calculate how many APs he will have at the start of the next turn - Threat[uiThreatCnt].iAPs = CalcActionPoints(pOpponent); + Threat[uiThreatCnt].iAPs = pOpponent->CalcActionPoints(); if (iThreatRange < iClosestThreatRange) { @@ -808,8 +809,8 @@ INT16 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB iRoamRange = RoamingRange(pSoldier,&sOrigin); // if status isn't black (life & death combat), and roaming range is limited - if ((pSoldier->bAlertStatus != STATUS_BLACK) && (iRoamRange < MAX_ROAMING_RANGE) && - (sOrigin != NOWHERE)) + if ((pSoldier->aiData.bAlertStatus != STATUS_BLACK) && (iRoamRange < MAX_ROAMING_RANGE) && + (sOrigin != NOWHERE)) { // must try to stay within or return to the point of origin iDistFromOrigin = SpacesAway(sOrigin,pSoldier->sGridNo); @@ -834,7 +835,7 @@ INT16 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB DebugAI( tempstr ); #endif - if (pSoldier->bAlertStatus >= STATUS_RED) // if already in battle + if (pSoldier->aiData.bAlertStatus >= STATUS_RED) // if already in battle { // to speed this up, tell PathAI to cancel any paths beyond our AP reach! gubNPCAPBudget = pSoldier->bActionPoints; @@ -843,12 +844,12 @@ INT16 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB { // even if not under pressure, limit to 1 turn's travelling distance // hope this isn't too expensive... - gubNPCAPBudget = CalcActionPoints( pSoldier ); + gubNPCAPBudget = pSoldier->CalcActionPoints( ); //gubNPCAPBudget = pSoldier->bInitialAPs; } // Call FindBestPath to set flags in all locations that we can - // walk into within range. We have to set some things up first... + // walk into within range. We have to set some things up first... // set the distance limit of the square region gubNPCDistLimit = (UINT8) iSearchRange; @@ -868,7 +869,7 @@ INT16 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB } } - FindBestPath( pSoldier, NOWHERE, pSoldier->bLevel, DetermineMovementMode( pSoldier, AI_ACTION_TAKE_COVER ), COPYREACHABLE_AND_APS, 0 ); + FindBestPath( pSoldier, NOWHERE, pSoldier->pathing.bLevel, DetermineMovementMode( pSoldier, AI_ACTION_TAKE_COVER ), COPYREACHABLE_AND_APS, 0 ); // Turn off the "reachable" flag for his current location // so we don't consider it @@ -897,11 +898,11 @@ INT16 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB // if this is outside roaming range, and doesn't get us closer to it if ((iDistCoverFromOrigin > iRoamRange) && - (iDistFromOrigin <= iDistCoverFromOrigin)) + (iDistFromOrigin <= iDistCoverFromOrigin)) { continue; // then we can't go there } - } + } /* if (Net.pnum != Net.turnActive) @@ -920,7 +921,7 @@ INT16 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB } // ignore blacklisted spot - if ( sGridNo == pSoldier->sBlackList ) + if ( sGridNo == pSoldier->pathing.sBlackList ) { continue; } @@ -932,23 +933,23 @@ INT16 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB if (!iPathCost) { - continue; // skip on to the next potential grid + continue; // skip on to the next potential grid } // CJC: This should be a redundent check because the path code is given an // AP limit to begin with! - if (pSoldier->bAlertStatus == STATUS_BLACK) // in battle + if (pSoldier->aiData.bAlertStatus == STATUS_BLACK) // in battle { // must be able to afford the APs to get to this cover this turn if (iPathCost > pSoldier->bActionPoints) { //NumMessage("In BLACK, and can't afford to get there, cost = ",iPathCost); - continue; // skip on to the next potential grid + continue; // skip on to the next potential grid } } */ - // OK, this place shows potential. How useful is it as cover? + // OK, this place shows potential. How useful is it as cover? // EVALUATE EACH GRID #, remembering the BEST PROTECTED ONE iCoverValue = 0; iCoverScale = 0; @@ -987,7 +988,7 @@ INT16 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB // reduce cover at nighttime based on how bright the light is at that location // using the difference in sighting distance between the background and the // light for this tile - ubLightPercentDifference = (gbLightSighting[ 0 ][ LightTrueLevel( sGridNo, pSoldier->bLevel ) ] - ubBackgroundLightPercent ); + ubLightPercentDifference = (gbLightSighting[ 0 ][ LightTrueLevel( sGridNo, pSoldier->pathing.bLevel ) ] - ubBackgroundLightPercent ); if ( iCoverValue >= 0 ) { iCoverValue -= (iCoverValue / 100) * ubLightPercentDifference; @@ -1062,12 +1063,12 @@ INT16 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB EndFrameBufferRender(); RefreshScreen( NULL ); /* - iLoop = GetJA2Clock(); - do - { + iLoop = GetJA2Clock(); + do + { - } while( ( GetJA2Clock( ) - iLoop ) < 2000 ); - */ + } while( ( GetJA2Clock( ) - iLoop ) < 2000 ); + */ } #endif @@ -1095,10 +1096,10 @@ INT16 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB SnuggleDebug(pSoldier,"Found Cover"); #endif - return((INT16)sBestCover); // return the gridno of that cover + return((INT16)sBestCover); // return the gridno of that cover } } - return(NOWHERE); // return that no suitable cover was found + return(NOWHERE); // return that no suitable cover was found } INT16 FindSpotMaxDistFromOpponents(SOLDIERTYPE *pSoldier) @@ -1124,41 +1125,41 @@ INT16 FindSpotMaxDistFromOpponents(SOLDIERTYPE *pSoldier) pOpponent = MercSlots[ uiLoop ]; // if this merc is inactive, at base, on assignment, dead, unconscious - if (!pOpponent || (pOpponent->bLife < OKLIFE)) + if (!pOpponent || (pOpponent->stats.bLife < OKLIFE)) { - continue; // next merc + continue; // next merc } // if this man is neutral / on the same side, he's not an opponent if ( CONSIDERED_NEUTRAL( pSoldier, pOpponent ) || (pSoldier->bSide == pOpponent->bSide)) { - continue; // next merc + continue; // next merc } - pbPersOL = &(pSoldier->bOppList[pOpponent->ubID]); + pbPersOL = &(pSoldier->aiData.bOppList[pOpponent->ubID]); pbPublOL = &(gbPublicOpplist[pSoldier->bTeam][pOpponent->ubID]); // if this opponent is unknown personally and publicly if ((*pbPersOL == NOT_HEARD_OR_SEEN) && (*pbPublOL == NOT_HEARD_OR_SEEN)) { - continue; // check next opponent + continue; // check next opponent } // Special stuff for Carmen the bounty hunter - if (pSoldier->bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != 64) + if (pSoldier->aiData.bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != 64) { - continue; // next opponent + continue; // next opponent } // if the opponent is no threat at all for some reason if (CalcManThreatValue(pOpponent,pSoldier->sGridNo,FALSE,pSoldier) == -999) { - continue; // check next opponent + continue; // check next opponent } // if personal knowledge is more up to date or at least equal if ((gubKnowledgeValue[*pbPublOL - OLDEST_HEARD_VALUE][*pbPersOL - OLDEST_HEARD_VALUE] > 0) || - (*pbPersOL == *pbPublOL)) + (*pbPersOL == *pbPublOL)) { // using personal knowledge, obtain opponent's "best guess" gridno sThreatLoc = gsLastKnownOppLoc[pSoldier->ubID][pOpponent->ubID]; @@ -1210,7 +1211,7 @@ INT16 FindSpotMaxDistFromOpponents(SOLDIERTYPE *pSoldier) // THIS IS A LOT QUICKER THAN COVER, SO DO A LARGER AREA, NOT AFFECTED BY // DIFFICULTY SETTINGS... - if (pSoldier->bAlertStatus == STATUS_BLACK) // if already in battle + if (pSoldier->aiData.bAlertStatus == STATUS_BLACK) // if already in battle { iSearchRange = pSoldier->bActionPoints / 2; @@ -1220,7 +1221,7 @@ INT16 FindSpotMaxDistFromOpponents(SOLDIERTYPE *pSoldier) else { // even if not under pressure, limit to 1 turn's travelling distance - gubNPCAPBudget = __min( pSoldier->bActionPoints / 2, CalcActionPoints( pSoldier ) ); + gubNPCAPBudget = __min( pSoldier->bActionPoints / 2, pSoldier->CalcActionPoints( ) ); iSearchRange = gubNPCAPBudget / 2; } @@ -1261,7 +1262,7 @@ INT16 FindSpotMaxDistFromOpponents(SOLDIERTYPE *pSoldier) //NumMessage("sMaxDown = ",sMaxDown); // Call FindBestPath to set flags in all locations that we can - // walk into within range. We have to set some things up first... + // walk into within range. We have to set some things up first... // set the distance limit of the square region gubNPCDistLimit = (UINT8) iSearchRange; @@ -1281,7 +1282,7 @@ INT16 FindSpotMaxDistFromOpponents(SOLDIERTYPE *pSoldier) } } - FindBestPath( pSoldier, NOWHERE, pSoldier->bLevel, DetermineMovementMode( pSoldier, AI_ACTION_RUN_AWAY ), COPYREACHABLE, 0 ); + FindBestPath( pSoldier, NOWHERE, pSoldier->pathing.bLevel, DetermineMovementMode( pSoldier, AI_ACTION_RUN_AWAY ), COPYREACHABLE, 0 ); // Turn off the "reachable" flag for his current location // so we don't consider it @@ -1304,10 +1305,10 @@ INT16 FindSpotMaxDistFromOpponents(SOLDIERTYPE *pSoldier) continue; } - if ( sGridNo == pSoldier->sBlackList ) + if ( sGridNo == pSoldier->pathing.sBlackList ) { continue; - } + } if ( pSoldier->bTeam == CIV_TEAM ) { @@ -1325,17 +1326,17 @@ INT16 FindSpotMaxDistFromOpponents(SOLDIERTYPE *pSoldier) } //Madd: skip lighted spots - if ( InLightAtNight( sGridNo, pSoldier->bLevel ) ) + if ( InLightAtNight( sGridNo, pSoldier->pathing.bLevel ) ) continue; - // OK, this place shows potential. How useful is it as cover? + // OK, this place shows potential. How useful is it as cover? //NumMessage("Promising seems gridno #",gridno); iSpotClosestThreatRange = 1500; if ( pSoldier->bTeam == ENEMY_TEAM && GridNoOnEdgeOfMap( sGridNo, &bEscapeDirection ) ) { - // We can escape! This is better than anything else except a closer spot which we can + // We can escape! This is better than anything else except a closer spot which we can // cross over from. // Subtract the straight-line distance from our location to this one as an estimate of @@ -1382,7 +1383,7 @@ INT16 FindSpotMaxDistFromOpponents(SOLDIERTYPE *pSoldier) if (bBestEscapeDirection != -1) { - // Woohoo! We can escape! Fake some stuff with the quote-related actions + // Woohoo! We can escape! Fake some stuff with the quote-related actions pSoldier->ubQuoteActionID = GetTraversalQuoteActionID( bBestEscapeDirection ); } @@ -1416,7 +1417,7 @@ INT16 FindNearestUngassedLand(SOLDIERTYPE *pSoldier) //NumMessage("sMaxDown = ",sMaxDown); // Call FindBestPath to set flags in all locations that we can - // walk into within range. We have to set some things up first... + // walk into within range. We have to set some things up first... // set the distance limit of the square region gubNPCDistLimit = (UINT8) iSearchRange; @@ -1436,7 +1437,7 @@ INT16 FindNearestUngassedLand(SOLDIERTYPE *pSoldier) } } - FindBestPath( pSoldier, NOWHERE, pSoldier->bLevel, DetermineMovementMode( pSoldier, AI_ACTION_LEAVE_WATER_GAS ), COPYREACHABLE, 0 ); + FindBestPath( pSoldier, NOWHERE, pSoldier->pathing.bLevel, DetermineMovementMode( pSoldier, AI_ACTION_LEAVE_WATER_GAS ), COPYREACHABLE, 0 ); // Turn off the "reachable" flag for his current location // so we don't consider it @@ -1461,7 +1462,7 @@ INT16 FindNearestUngassedLand(SOLDIERTYPE *pSoldier) } // ignore blacklisted spot - if ( sGridNo == pSoldier->sBlackList ) + if ( sGridNo == pSoldier->pathing.sBlackList ) { continue; } @@ -1473,7 +1474,7 @@ INT16 FindNearestUngassedLand(SOLDIERTYPE *pSoldier) if (!sPathCost) { - continue; // skip on to the next potential grid + continue; // skip on to the next potential grid } // if this path is shorter than the one to the closest land found so far @@ -1490,7 +1491,7 @@ INT16 FindNearestUngassedLand(SOLDIERTYPE *pSoldier) } // if we found a piece of land in this search area - if (sClosestLand != NOWHERE) // quit now, no need to look any farther + if (sClosestLand != NOWHERE) // quit now, no need to look any farther break; } @@ -1508,7 +1509,7 @@ INT16 FindNearbyDarkerSpot( SOLDIERTYPE *pSoldier ) INT32 iRoamRange; INT16 sOrigin; - bCurrLightLevel = LightTrueLevel( pSoldier->sGridNo, pSoldier->bLevel ); + bCurrLightLevel = LightTrueLevel( pSoldier->sGridNo, pSoldier->pathing.bLevel ); iRoamRange = RoamingRange( pSoldier, &sOrigin ); @@ -1529,7 +1530,7 @@ INT16 FindNearbyDarkerSpot( SOLDIERTYPE *pSoldier ) //NumMessage("sMaxDown = ",sMaxDown); // Call FindBestPath to set flags in all locations that we can - // walk into within range. We have to set some things up first... + // walk into within range. We have to set some things up first... // set the distance limit of the square region gubNPCDistLimit = (UINT8) iSearchRange; @@ -1549,7 +1550,7 @@ INT16 FindNearbyDarkerSpot( SOLDIERTYPE *pSoldier ) } } - FindBestPath( pSoldier, NOWHERE, pSoldier->bLevel, DetermineMovementMode( pSoldier, AI_ACTION_LEAVE_WATER_GAS ), COPYREACHABLE, 0 ); + FindBestPath( pSoldier, NOWHERE, pSoldier->pathing.bLevel, DetermineMovementMode( pSoldier, AI_ACTION_LEAVE_WATER_GAS ), COPYREACHABLE, 0 ); // Turn off the "reachable" flag for his current location // so we don't consider it @@ -1574,7 +1575,7 @@ INT16 FindNearbyDarkerSpot( SOLDIERTYPE *pSoldier ) } // ignore blacklisted spot - if ( sGridNo == pSoldier->sBlackList ) + if ( sGridNo == pSoldier->pathing.sBlackList ) { continue; } @@ -1586,7 +1587,7 @@ INT16 FindNearbyDarkerSpot( SOLDIERTYPE *pSoldier ) } // screen out anything brighter than our current best spot - bLightLevel = LightTrueLevel( sGridNo, pSoldier->bLevel ); + bLightLevel = LightTrueLevel( sGridNo, pSoldier->pathing.bLevel ); bLightDiff = gbLightSighting[0][ bCurrLightLevel ] - gbLightSighting[0][ bLightLevel ]; @@ -1603,7 +1604,7 @@ INT16 FindNearbyDarkerSpot( SOLDIERTYPE *pSoldier ) if (!sPathCost) { - continue; // skip on to the next potential grid + continue; // skip on to the next potential grid } // decrease the "cost" of the spot by the amount of light/darkness @@ -1612,7 +1613,7 @@ INT16 FindNearbyDarkerSpot( SOLDIERTYPE *pSoldier ) if ( iSpotValue < iBestSpotValue ) { // remember it instead - iBestSpotValue = iSpotValue; + iBestSpotValue = iSpotValue; //NumMessage("New shortest route = ",shortestPath); sClosestSpot = sGridNo; @@ -1622,7 +1623,7 @@ INT16 FindNearbyDarkerSpot( SOLDIERTYPE *pSoldier ) } // if we found a piece of land in this search area - if (sClosestSpot != NOWHERE) // quit now, no need to look any farther + if (sClosestSpot != NOWHERE) // quit now, no need to look any farther { break; } @@ -1668,20 +1669,20 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) iSearchRange = gbDiff[DIFF_MAX_COVER_RANGE][ SoldierDifficultyLevel( pSoldier ) ]; - switch (pSoldier->bAttitude) + switch (pSoldier->aiData.bAttitude) { - case DEFENSIVE: iSearchRange --; break; + case DEFENSIVE: iSearchRange --; break; case BRAVESOLO: iSearchRange += 2; break; case BRAVEAID: iSearchRange += 2; break; case CUNNINGSOLO: iSearchRange -= 2; break; case CUNNINGAID: iSearchRange -= 2; break; - case AGGRESSIVE: iSearchRange ++; break; + case AGGRESSIVE: iSearchRange ++; break; } // maximum search range is 1 tile / 10 pts of wisdom - if (iSearchRange > (pSoldier->bWisdom / 10)) + if (iSearchRange > (pSoldier->stats.bWisdom / 10)) { - iSearchRange = (pSoldier->bWisdom / 10); + iSearchRange = (pSoldier->stats.bWisdom / 10); } if (!gfTurnBasedAI) @@ -1706,7 +1707,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) //NumMessage("sMaxDown = ",sMaxDown); // Call FindBestPath to set flags in all locations that we can - // walk into within range. We have to set some things up first... + // walk into within range. We have to set some things up first... // set the distance limit of the square region gubNPCDistLimit = (UINT8) iSearchRange; @@ -1730,7 +1731,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) } } - FindBestPath( pSoldier, NOWHERE, pSoldier->bLevel, DetermineMovementMode( pSoldier, AI_ACTION_PICKUP_ITEM ), COPYREACHABLE, 0 ); + FindBestPath( pSoldier, NOWHERE, pSoldier->pathing.bLevel, DetermineMovementMode( pSoldier, AI_ACTION_PICKUP_ITEM ), COPYREACHABLE, 0 ); // SET UP DOUBLE-LOOP TO STEP THROUGH POTENTIAL GRID #s for (sYOffset = -sMaxUp; sYOffset <= sMaxDown; sYOffset++) @@ -1755,35 +1756,35 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) { // ignore blacklisted spot - if ( sGridNo == pSoldier->sBlackList ) + if ( sGridNo == pSoldier->pathing.sBlackList ) { continue; } iValue = 0; - GetItemPool( sGridNo, &pItemPool, pSoldier->bLevel ); + GetItemPool( sGridNo, &pItemPool, pSoldier->pathing.bLevel ); switch( bReason ) { case SEARCH_AMMO: // we are looking for ammo to match the gun in usItem while( pItemPool ) { - pObj = &(gWorldItems[ pItemPool->iItemIndex ].o); + pObj = &(gWorldItems[ pItemPool->iItemIndex ].object); pItem = &(Item[pObj->usItem]); - if ( pItem->usItemClass == IC_GUN && pObj->ItemData.Generic.bStatus[0] >= MINIMUM_REQUIRED_STATUS ) + if ( pItem->usItemClass == IC_GUN && (*pObj)[0]->data.objectStatus >= MINIMUM_REQUIRED_STATUS ) { // maybe this gun has ammo (adjust for whether it is better than ours!) - if ( pObj->ItemData.Gun.bGunAmmoStatus < 0 || pObj->ItemData.Gun.ubGunShotsLeft == 0 || (Item[pObj->usItem].fingerprintid && pObj->ubImprintID != NOBODY && pObj->ubImprintID != pSoldier->ubID) ) + if ( (*pObj)[0]->data.gun.bGunAmmoStatus < 0 || (*pObj)[0]->data.gun.ubGunShotsLeft == 0 || (Item[pObj->usItem].fingerprintid && (*pObj)[0]->data.ubImprintID != NOBODY && (*pObj)[0]->data.ubImprintID != pSoldier->ubID) ) { iTempValue = 0; } else { - iTempValue = pObj->ItemData.Gun.ubGunShotsLeft * Weapon[pObj->usItem].ubDeadliness / Weapon[usItem].ubDeadliness; + iTempValue = (*pObj)[0]->data.gun.ubGunShotsLeft * Weapon[pObj->usItem].ubDeadliness / Weapon[usItem].ubDeadliness; } } else if (ValidAmmoType( usItem, pObj->usItem ) ) - { + { iTempValue = TotalPoints( pObj ); } else @@ -1791,7 +1792,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) iTempValue = 0; } if (iTempValue > iValue ) - { + { iValue = iTempValue; iItemIndex = pItemPool->iItemIndex; } @@ -1801,11 +1802,11 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) case SEARCH_WEAPONS: while( pItemPool ) { - pObj = &(gWorldItems[ pItemPool->iItemIndex ].o); + pObj = &(gWorldItems[ pItemPool->iItemIndex ].object); pItem = &(Item[pObj->usItem]); - if (pItem->usItemClass & IC_WEAPON && pObj->ItemData.Generic.bStatus[0] >= MINIMUM_REQUIRED_STATUS ) + if (pItem->usItemClass & IC_WEAPON && (*pObj)[0]->data.objectStatus >= MINIMUM_REQUIRED_STATUS ) { - if ( (pItem->usItemClass & IC_GUN) && (pObj->ItemData.Gun.bGunAmmoStatus < 0 || pObj->ItemData.Gun.ubGunShotsLeft == 0 || (( Item[pObj->usItem].fingerprintid ) && pObj->ubImprintID != NOBODY && pObj->ubImprintID != pSoldier->ubID) ) ) + if ( (pItem->usItemClass & IC_GUN) && ((*pObj)[0]->data.gun.bGunAmmoStatus < 0 || (*pObj)[0]->data.gun.ubGunShotsLeft == 0 || (( Item[pObj->usItem].fingerprintid ) && (*pObj)[0]->data.ubImprintID != NOBODY && (*pObj)[0]->data.ubImprintID != pSoldier->ubID) ) ) { // jammed or out of ammo, skip it! iTempValue = 0; @@ -1831,7 +1832,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) iTempValue = 0; } if (iTempValue > iValue ) - { + { iValue = iTempValue; iItemIndex = pItemPool->iItemIndex; } @@ -1841,16 +1842,16 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) default: while( pItemPool ) { - pObj = &(gWorldItems[ pItemPool->iItemIndex ].o); + pObj = &(gWorldItems[ pItemPool->iItemIndex ].object); pItem = &(Item[pObj->usItem]); - if ( pItem->usItemClass & IC_WEAPON && pObj->ItemData.Generic.bStatus[0] >= MINIMUM_REQUIRED_STATUS ) + if ( pItem->usItemClass & IC_WEAPON && (*pObj)[0]->data.objectStatus >= MINIMUM_REQUIRED_STATUS ) { - if ( (pItem->usItemClass & IC_GUN) && (pObj->ItemData.Gun.bGunAmmoStatus < 0 || pObj->ItemData.Gun.ubGunShotsLeft == 0 || (( Item[pObj->usItem].fingerprintid ) && pObj->ubImprintID != NOBODY && pObj->ubImprintID != pSoldier->ubID) ) ) + if ( (pItem->usItemClass & IC_GUN) && ((*pObj)[0]->data.gun.bGunAmmoStatus < 0 || (*pObj)[0]->data.gun.ubGunShotsLeft == 0 || (( Item[pObj->usItem].fingerprintid ) && (*pObj)[0]->data.ubImprintID != NOBODY && (*pObj)[0]->data.ubImprintID != pSoldier->ubID) ) ) { // jammed or out of ammo, skip it! iTempValue = 0; } - else if ( (Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_WEAPON) ) + else if ( (Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_WEAPON) ) { if (Weapon[pObj->usItem].ubDeadliness > Weapon[pSoldier->inv[HANDPOS].usItem].ubDeadliness) { @@ -1866,12 +1867,12 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) iTempValue = 200 + Weapon[pObj->usItem].ubDeadliness; } } - else if (pItem->usItemClass == IC_ARMOUR && pObj->ItemData.Generic.bStatus[0] >= MINIMUM_REQUIRED_STATUS ) + else if (pItem->usItemClass == IC_ARMOUR && (*pObj)[0]->data.objectStatus >= MINIMUM_REQUIRED_STATUS ) { switch( Armour[pItem->ubClassIndex].ubArmourClass ) { case ARMOURCLASS_HELMET: - if (pSoldier->inv[HELMETPOS].usItem == NOTHING) + if (pSoldier->inv[HELMETPOS].exists() == false) { iTempValue = 200 + EffectiveArmour( pObj ); } @@ -1885,7 +1886,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) } break; case ARMOURCLASS_VEST: - if (pSoldier->inv[VESTPOS].usItem == NOTHING) + if (pSoldier->inv[VESTPOS].exists() == false) { iTempValue = 200 + EffectiveArmour( pObj ); } @@ -1899,7 +1900,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) } break; case ARMOURCLASS_LEGGINGS: - if (pSoldier->inv[LEGPOS].usItem == NOTHING) + if (pSoldier->inv[LEGPOS].exists() == false) { iTempValue = 200 + EffectiveArmour( pObj ); } @@ -1922,12 +1923,12 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) } if (iTempValue > iValue ) - { + { iValue = iTempValue; iItemIndex = pItemPool->iItemIndex; } pItemPool = pItemPool->pNext; - } + } break; } iValue = (3 * iValue) / (3 + PythSpacesAway( sGridNo, pSoldier->sGridNo )); @@ -1943,9 +1944,11 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) if (sBestSpot != NOWHERE) { - DebugAI( String( "%d decides to pick up %S", pSoldier->ubID, ItemNames[ gWorldItems[ iBestItemIndex ].o.usItem ] ) ); - if (Item[gWorldItems[ iBestItemIndex ].o.usItem].usItemClass == IC_GUN) + DebugAI( String( "%d decides to pick up %S", pSoldier->ubID, ItemNames[ gWorldItems[ iBestItemIndex ].object.usItem ] ) ); + if (Item[gWorldItems[ iBestItemIndex ].object.usItem].usItemClass == IC_GUN) { + //CHRISL: This is the line from ADB's code but I removed it, for now, to match what 0verhaul has been working on + //if (pSoldier->inv[HANDPOS].exists() == true && PlaceInAnyPocket(pSoldier, &pSoldier->inv[HANDPOS], false) == false) if (FindBetterSpotForItem( pSoldier, HANDPOS ) == FALSE) { if (pSoldier->bActionPoints < AP_PICKUP_ITEM + AP_PICKUP_ITEM) @@ -1964,15 +1967,15 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) // we want to drop this item! DebugAI( String( "%d decides he must drop %S first", pSoldier->ubID, ItemNames[ pSoldier->inv[HANDPOS].usItem ] ) ); - pSoldier->bNextAction = AI_ACTION_PICKUP_ITEM; - pSoldier->usNextActionData = sBestSpot; + pSoldier->aiData.bNextAction = AI_ACTION_PICKUP_ITEM; + pSoldier->aiData.usNextActionData = sBestSpot; pSoldier->iNextActionSpecialData = iBestItemIndex; return( AI_ACTION_DROP_ITEM ); } } - } - pSoldier->uiPendingActionData1 = iBestItemIndex; - pSoldier->usActionData = sBestSpot; + } + pSoldier->aiData.uiPendingActionData1 = iBestItemIndex; + pSoldier->aiData.usActionData = sBestSpot; return( AI_ACTION_PICKUP_ITEM ); } @@ -2052,7 +2055,7 @@ INT16 FindNearestEdgepointOnSpecifiedEdge( INT16 sGridNo, INT8 bEdgeCode ) return( NOWHERE ); } - // Do a 2D search to find the closest map edgepoint and + // Do a 2D search to find the closest map edgepoint and // try to create a path there for ( iLoop = 0; iLoop < iEdgepointArraySize; iLoop++ ) @@ -2125,7 +2128,7 @@ INT16 FindNearestEdgePoint( INT16 sGridNo ) return( NOWHERE ); } - // Do a 2D search to find the closest map edgepoint and + // Do a 2D search to find the closest map edgepoint and // try to create a path there for ( iLoop = 0; iLoop < iEdgepointArraySize; iLoop++ ) @@ -2155,7 +2158,7 @@ INT16 FindNearbyPointOnEdgeOfMap( SOLDIERTYPE * pSoldier, INT8 * pbDirection ) bClosestDirection = -1; // Call FindBestPath to set flags in all locations that we can - // walk into within range. We have to set some things up first... + // walk into within range. We have to set some things up first... // set the distance limit of the square region gubNPCDistLimit = EDGE_OF_MAP_SEARCH; @@ -2188,7 +2191,7 @@ INT16 FindNearbyPointOnEdgeOfMap( SOLDIERTYPE * pSoldier, INT8 * pbDirection ) } } - FindBestPath( pSoldier, NOWHERE, pSoldier->bLevel, WALKING, COPYREACHABLE, 0 ); + FindBestPath( pSoldier, NOWHERE, pSoldier->pathing.bLevel, WALKING, COPYREACHABLE, 0 ); // Turn off the "reachable" flag for his current location // so we don't consider it @@ -2236,9 +2239,9 @@ INT16 FindRouteBackOntoMap( SOLDIERTYPE * pSoldier, INT16 sDestGridNo ) // values // well, let's TRY just taking a path to the place we're supposed to go... - if ( FindBestPath( pSoldier, sDestGridNo, pSoldier->bLevel, WALKING, COPYROUTE, 0 ) ) + if ( FindBestPath( pSoldier, sDestGridNo, pSoldier->pathing.bLevel, WALKING, COPYROUTE, 0 ) ) { - pSoldier->bPathStored = TRUE; + pSoldier->pathing.bPathStored = TRUE; return( sDestGridNo ); } else @@ -2374,13 +2377,13 @@ INT16 FindFlankingSpot(SOLDIERTYPE *pSoldier, INT16 sPos, INT8 bAction ) DebugMsg ( TOPIC_JA2AI , DBG_LEVEL_3 , String("FindFlankingSpot: orig loc = %d, loc to flank = %d", pSoldier->sGridNo , sPos)); // hit the edge of the map - if ( FindNearestEdgePoint ( pSoldier->sGridNo ) == pSoldier->sGridNo ) + if ( FindNearestEdgePoint ( pSoldier->sGridNo ) == pSoldier->sGridNo ) return NOWHERE; if ( gfTurnBasedAI ) { - //if (pSoldier->bAlertStatus == STATUS_BLACK) // if already in battle + //if (pSoldier->aiData.bAlertStatus == STATUS_BLACK) // if already in battle //{ // iSearchRange = pSoldier->bActionPoints - ( MinAPsToAttack( pSoldier, sPos, ADDTURNCOST)); @@ -2393,7 +2396,7 @@ INT16 FindFlankingSpot(SOLDIERTYPE *pSoldier, INT16 sPos, INT8 bAction ) // // even if not under pressure, limit to 1 turn's travelling distance // iSearchRange = pSoldier->bActionPoints - ( MinAPsToAttack( pSoldier, sPos, ADDTURNCOST)); - // gubNPCAPBudget = iSearchRange; //__min( pSoldier->bActionPoints / 2, CalcActionPoints( pSoldier ) ); + // gubNPCAPBudget = iSearchRange; //__min( pSoldier->bActionPoints / 2, pSoldier->CalcActionPoints( ) ); //iSearchRange = gubNPCAPBudget; //} @@ -2411,7 +2414,7 @@ INT16 FindFlankingSpot(SOLDIERTYPE *pSoldier, INT16 sPos, INT8 bAction ) //} gubNPCAPBudget=(UINT8) (iSearchRange*3); - + // assume we have to stand up and turn // use the min macro here to make sure we don't wrap the UINT8 to 255... @@ -2434,7 +2437,7 @@ INT16 FindFlankingSpot(SOLDIERTYPE *pSoldier, INT16 sPos, INT8 bAction ) //NumMessage("sMaxDown = ",sMaxDown); // Call FindBestPath to set flags in all locations that we can - // walk into within range. We have to set some things up first... + // walk into within range. We have to set some things up first... // set the distance limit of the square region gubNPCDistLimit = (UINT8) iSearchRange; @@ -2454,7 +2457,7 @@ INT16 FindFlankingSpot(SOLDIERTYPE *pSoldier, INT16 sPos, INT8 bAction ) } } - FindBestPath( pSoldier, NOWHERE, pSoldier->bLevel, DetermineMovementMode( pSoldier, bAction ), COPYREACHABLE, 0 ); + FindBestPath( pSoldier, NOWHERE, pSoldier->pathing.bLevel, DetermineMovementMode( pSoldier, bAction ), COPYREACHABLE, 0 ); // Turn off the "reachable" flag for his current location // so we don't consider it @@ -2480,7 +2483,7 @@ INT16 FindFlankingSpot(SOLDIERTYPE *pSoldier, INT16 sPos, INT8 bAction ) break; default: sDesiredDir = sDir; - } + } if ( sDesiredDir < 0 ) sDesiredDir += 8; @@ -2510,10 +2513,10 @@ INT16 FindFlankingSpot(SOLDIERTYPE *pSoldier, INT16 sPos, INT8 bAction ) continue; } - if ( sGridNo == pSoldier->sBlackList ) + if ( sGridNo == pSoldier->pathing.sBlackList ) { continue; - } + } // exclude locations with tear/mustard gas (at this point, smoke is cool!) if ( InGas( pSoldier, sGridNo ) ) @@ -2522,7 +2525,7 @@ INT16 FindFlankingSpot(SOLDIERTYPE *pSoldier, INT16 sPos, INT8 bAction ) } //Madd: skip lighted spots - if ( InLightAtNight( sGridNo, pSoldier->bLevel ) ) + if ( InLightAtNight( sGridNo, pSoldier->pathing.bLevel ) ) continue; // allow an extra direction for flanking @@ -2565,7 +2568,6 @@ INT16 FindFlankingSpot(SOLDIERTYPE *pSoldier, INT16 sPos, INT8 bAction ) INT16 FindClosestClimbPoint (SOLDIERTYPE *pSoldier, BOOLEAN fClimbUp ) { - INT16 sBestSpot = NOWHERE; //DebugMsg( TOPIC_JA2AI , DBG_LEVEL_3 , "FindClosestClimbPoint"); @@ -2613,7 +2615,7 @@ INT16 FindClosestClimbPoint (SOLDIERTYPE *pSoldier, BOOLEAN fClimbUp ) } - if ( sGridNo == pSoldier->sBlackList ) + if ( sGridNo == pSoldier->pathing.sBlackList ) { continue; } @@ -2663,7 +2665,7 @@ INT16 FindClosestClimbPoint (SOLDIERTYPE *pSoldier, BOOLEAN fClimbUp ) BOOLEAN CanClimbFromHere (SOLDIERTYPE * pSoldier, BOOLEAN fUp ) { #if 1 - return FindDirectionForClimbing( pSoldier->sGridNo, pSoldier->bLevel) != DIRECTION_IRRELEVANT; + return FindDirectionForClimbing( pSoldier, pSoldier->sGridNo, pSoldier->pathing.bLevel) != DIRECTION_IRRELEVANT; #else BUILDING * pBuilding; INT16 i; @@ -2682,7 +2684,7 @@ BOOLEAN CanClimbFromHere (SOLDIERTYPE * pSoldier, BOOLEAN fUp ) sMaxDown = (INT16) min( iSearchRange, MAXROW - ((pSoldier->sGridNo / MAXROW) + 1)); INT16 sGridNo=NOWHERE; - + for (sYOffset = -sMaxUp; sYOffset <= sMaxDown; sYOffset++) { for (sXOffset = -sMaxLeft; sXOffset <= sMaxRight; sXOffset++) @@ -2698,13 +2700,13 @@ BOOLEAN CanClimbFromHere (SOLDIERTYPE * pSoldier, BOOLEAN fUp ) } - if ( sGridNo == pSoldier->sBlackList ) + if ( sGridNo == pSoldier->pathing.sBlackList ) { continue; - } + } - // OK, this place shows potential. How useful is it as cover? + // OK, this place shows potential. How useful is it as cover? //NumMessage("Promising seems gridno #",gridno); // Kaiden: From this point down I've removed an unneccessary call to @@ -2714,7 +2716,7 @@ BOOLEAN CanClimbFromHere (SOLDIERTYPE * pSoldier, BOOLEAN fUp ) pBuilding = FindBuilding ( sGridNo ); if ( pBuilding != NULL) - { + { if ( fUp ) { @@ -2742,7 +2744,7 @@ BOOLEAN CanClimbFromHere (SOLDIERTYPE * pSoldier, BOOLEAN fUp ) return FALSE; #endif } - // OK, this place shows potential. How useful is it as cover? + // OK, this place shows potential. How useful is it as cover? //NumMessage("Promising seems gridno #",gridno); /* if ( FindBuilding ( sGridNo ) != NULL ) @@ -2752,7 +2754,7 @@ BOOLEAN CanClimbFromHere (SOLDIERTYPE * pSoldier, BOOLEAN fUp ) DebugMsg( TOPIC_JA2AI , DBG_LEVEL_3 , String("Adjacent Building climb spots = %d" , pBuilding->ubNumClimbSpots )); if ( pBuilding != NULL) - { + { if ( fUp ) { for (i = 0 ; i < pBuilding->ubNumClimbSpots; i++) @@ -2786,25 +2788,25 @@ INT16 FindBestCoverNearTheGridNo(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubS INT32 iPercentBetter; // INT16 sTrueGridNo; INT16 sResultGridNo; - INT8 bRealWisdom = pSoldier->bWisdom; + INT8 bRealWisdom = pSoldier->stats.bWisdom; // sTrueGridNo = pSoldier->sGridNo; // pSoldier->sGridNo = sGridNo; - pSoldier->bWisdom = 8 * ubSearchRadius;// 5 tiles - + pSoldier->stats.bWisdom = 8 * ubSearchRadius;// 5 tiles + sResultGridNo = FindBestNearbyCover( pSoldier, MORALE_NORMAL, &iPercentBetter); - - pSoldier->bWisdom = bRealWisdom; + + pSoldier->stats.bWisdom = bRealWisdom; // pSoldier->sGridNo = sTrueGridNo; if( sResultGridNo != NOWHERE ) return sResultGridNo; - else + else return sGridNo; } -INT8 FindDirectionForClimbing( INT16 sGridNo, INT8 bLevel ) +INT8 FindDirectionForClimbing( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel ) { UINT8 ubClimbDir; INT16 sClimbSpot; @@ -2826,6 +2828,9 @@ INT8 FindDirectionForClimbing( INT16 sGridNo, INT8 bLevel ) } else if (bLevel == 1) { + //CHRISL: If NewInv and wearing a backpack, don't allow climbing + if(UsingNewInventorySystem() == true && pSoldier->inv[BPACKPOCKPOS].exists() == true) + return DIRECTION_IRRELEVANT; if (gpWorldLevelData[ sGridNo].ubExtFlags[1] & MAPELEMENT_EXT_CLIMBPOINT) { for (ubClimbDir=0; ubClimbDir<8; ubClimbDir+=2) diff --git a/TacticalAI/Knowledge.cpp b/TacticalAI/Knowledge.cpp index 8d36fb87..51506742 100644 --- a/TacticalAI/Knowledge.cpp +++ b/TacticalAI/Knowledge.cpp @@ -35,13 +35,13 @@ void CallAvailableEnemiesTo( INT16 sGridNo ) iLoop2 = gTacticalStatus.Team[ iLoop ].bFirstID; for ( pSoldier = MercPtrs[iLoop2]; iLoop2 <= gTacticalStatus.Team[ iLoop ].bLastID; iLoop2++, pSoldier++ ) { - if (pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife >= OKLIFE) + if (pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE) { SetNewSituation( pSoldier ); WearGasMaskIfAvailable( pSoldier ); } } - + } } @@ -69,7 +69,7 @@ void CallAvailableTeamEnemiesTo( INT16 sGridno, INT8 bTeam ) iLoop2 = gTacticalStatus.Team[ bTeam ].bFirstID; for ( pSoldier = MercPtrs[iLoop2]; iLoop2 <= gTacticalStatus.Team[ bTeam ].bLastID; iLoop2++, pSoldier++ ) { - if (pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife >= OKLIFE) + if (pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE) { SetNewSituation( pSoldier ); WearGasMaskIfAvailable( pSoldier ); @@ -82,7 +82,7 @@ void CallAvailableTeamEnemiesTo( INT16 sGridno, INT8 bTeam ) void CallAvailableKingpinMenTo( INT16 sGridNo ) { - // like call all enemies, but only affects civgroup KINGPIN guys with + // like call all enemies, but only affects civgroup KINGPIN guys with // NO PROFILE INT32 iLoop2; @@ -101,7 +101,7 @@ void CallAvailableKingpinMenTo( INT16 sGridNo ) iLoop2 = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; for ( pSoldier = MercPtrs[iLoop2]; iLoop2 <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; iLoop2++, pSoldier++ ) { - if (pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife >= OKLIFE && pSoldier->ubCivilianGroup == KINGPIN_CIV_GROUP && pSoldier->ubProfile == NO_PROFILE) + if (pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE && pSoldier->ubCivilianGroup == KINGPIN_CIV_GROUP && pSoldier->ubProfile == NO_PROFILE) { SetNewSituation( pSoldier ); } @@ -120,7 +120,7 @@ void CallEldinTo( INT16 sGridNo ) { // new situation for Eldin pSoldier = FindSoldierByProfileID( ELDIN, FALSE ); - if ( pSoldier && pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife >= OKLIFE && (pSoldier->bAlertStatus == STATUS_GREEN || pSoldier->ubNoiseVolume < (MAX_MISC_NOISE_DURATION / 2) ) ) + if ( pSoldier && pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE && (pSoldier->aiData.bAlertStatus == STATUS_GREEN || pSoldier->aiData.ubNoiseVolume < (MAX_MISC_NOISE_DURATION / 2) ) ) { if ( SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, 0, 0, TRUE ) ) { @@ -130,15 +130,15 @@ void CallEldinTo( INT16 sGridNo ) } else { - pSoldier->sNoiseGridno = sGridNo; - pSoldier->ubNoiseVolume = MAX_MISC_NOISE_DURATION; - pSoldier->bAlertStatus = STATUS_RED; - if ( (pSoldier->bAction != AI_ACTION_GET_CLOSER) || CheckFact( FACT_MUSEUM_ALARM_WENT_OFF, 0 ) == FALSE ) + pSoldier->aiData.sNoiseGridno = sGridNo; + pSoldier->aiData.ubNoiseVolume = MAX_MISC_NOISE_DURATION; + pSoldier->aiData.bAlertStatus = STATUS_RED; + if ( (pSoldier->aiData.bAction != AI_ACTION_GET_CLOSER) || CheckFact( FACT_MUSEUM_ALARM_WENT_OFF, 0 ) == FALSE ) { CancelAIAction( pSoldier, TRUE ); - pSoldier->bNextAction = AI_ACTION_GET_CLOSER; - pSoldier->usNextActionData = sGridNo; - RESETTIMECOUNTER( pSoldier->AICounter, 100 ); + pSoldier->aiData.bNextAction = AI_ACTION_GET_CLOSER; + pSoldier->aiData.usNextActionData = sGridNo; + RESETTIMECOUNTER( pSoldier->timeCounters.AICounter, 100 ); } // otherwise let AI handle this normally // SetNewSituation( pSoldier ); @@ -164,7 +164,7 @@ INT16 MostImportantNoiseHeard( SOLDIERTYPE *pSoldier, INT32 *piRetValue, BOOLEAN INT8 bBestLevel = 0; INT16 sClimbingGridNo; BOOLEAN fClimbingNecessary = FALSE; - SOLDIERTYPE * pTemp; + SOLDIERTYPE * pTemp; pubNoiseVolume = &gubPublicNoiseVolume[pSoldier->bTeam]; psNoiseGridNo = &gsPublicNoiseGridno[pSoldier->bTeam]; @@ -173,7 +173,7 @@ INT16 MostImportantNoiseHeard( SOLDIERTYPE *pSoldier, INT32 *piRetValue, BOOLEAN psLastLoc = gsLastKnownOppLoc[pSoldier->ubID]; // hang pointers at start of this guy's personal and public opponent opplists - pbPersOL = pSoldier->bOppList; + pbPersOL = pSoldier->aiData.bOppList; pbPublOL = gbPublicOpplist[pSoldier->bTeam]; // look through this man's personal & public opplists for opponents heard @@ -182,14 +182,14 @@ INT16 MostImportantNoiseHeard( SOLDIERTYPE *pSoldier, INT32 *piRetValue, BOOLEAN pTemp = MercSlots[ uiLoop ]; // if this merc is inactive, at base, on assignment, or dead - if (!pTemp || !pTemp->bLife) - continue; // next merc + if (!pTemp || !pTemp->stats.bLife) + continue; // next merc // if this merc is neutral/on same side, he's not an opponent if ( CONSIDERED_NEUTRAL( pSoldier, pTemp ) || (pSoldier->bSide == pTemp->bSide)) - continue; // next merc + continue; // next merc - pbPersOL = pSoldier->bOppList + pTemp->ubID; + pbPersOL = pSoldier->aiData.bOppList + pTemp->ubID; pbPublOL = gbPublicOpplist[pSoldier->bTeam] + pTemp->ubID; psLastLoc = gsLastKnownOppLoc[pSoldier->ubID] + pTemp->ubID; pbLastLevel = gbLastKnownOppLevel[pSoldier->ubID] + pTemp->ubID; @@ -199,7 +199,7 @@ INT16 MostImportantNoiseHeard( SOLDIERTYPE *pSoldier, INT32 *piRetValue, BOOLEAN { // calculate how far this noise was, and its relative "importance" iDistAway = SpacesAway(pSoldier->sGridNo,*psLastLoc); - iNoiseValue = (*pbPersOL) * iDistAway; // always a negative number! + iNoiseValue = (*pbPersOL) * iDistAway; // always a negative number! if (iNoiseValue > iBestValue) { @@ -214,7 +214,7 @@ INT16 MostImportantNoiseHeard( SOLDIERTYPE *pSoldier, INT32 *piRetValue, BOOLEAN { // calculate how far this noise was, and its relative "importance" iDistAway = SpacesAway(pSoldier->sGridNo,gsPublicLastKnownOppLoc[pSoldier->bTeam][pTemp->ubID]); - iNoiseValue = (*pbPublOL) * iDistAway; // always a negative number! + iNoiseValue = (*pbPublOL) * iDistAway; // always a negative number! if (iNoiseValue > iBestValue) { @@ -227,26 +227,26 @@ INT16 MostImportantNoiseHeard( SOLDIERTYPE *pSoldier, INT32 *piRetValue, BOOLEAN } // if any "misc. noise" was also heard recently - if (pSoldier->sNoiseGridno != NOWHERE) + if (pSoldier->aiData.sNoiseGridno != NOWHERE) { - if ( pSoldier->bNoiseLevel != pSoldier->bLevel || PythSpacesAway( pSoldier->sGridNo, pSoldier->sNoiseGridno ) >= 6 || SoldierTo3DLocationLineOfSightTest( pSoldier, pSoldier->sNoiseGridno, pSoldier->bNoiseLevel, 0, FALSE, NO_DISTANCE_LIMIT ) == 0 ) + if ( pSoldier->bNoiseLevel != pSoldier->pathing.bLevel || PythSpacesAway( pSoldier->sGridNo, pSoldier->aiData.sNoiseGridno ) >= 6 || SoldierTo3DLocationLineOfSightTest( pSoldier, pSoldier->aiData.sNoiseGridno, pSoldier->bNoiseLevel, 0, FALSE, NO_DISTANCE_LIMIT ) == 0 ) { // calculate how far this noise was, and its relative "importance" - iDistAway = SpacesAway(pSoldier->sGridNo,pSoldier->sNoiseGridno); - iNoiseValue = ((pSoldier->ubNoiseVolume / 2) - 6) * iDistAway; + iDistAway = SpacesAway(pSoldier->sGridNo,pSoldier->aiData.sNoiseGridno); + iNoiseValue = ((pSoldier->aiData.ubNoiseVolume / 2) - 6) * iDistAway; if (iNoiseValue > iBestValue) { iBestValue = iNoiseValue; - sBestGridNo = pSoldier->sNoiseGridno; + sBestGridNo = pSoldier->aiData.sNoiseGridno; bBestLevel = pSoldier->bNoiseLevel; } } else { // we are there or near - pSoldier->sNoiseGridno = NOWHERE; // wipe it out, not useful anymore - pSoldier->ubNoiseVolume = 0; + pSoldier->aiData.sNoiseGridno = NOWHERE; // wipe it out, not useful anymore + pSoldier->aiData.ubNoiseVolume = 0; } } @@ -254,11 +254,11 @@ INT16 MostImportantNoiseHeard( SOLDIERTYPE *pSoldier, INT32 *piRetValue, BOOLEAN // if any recent PUBLIC "misc. noise" is also known if ( (pSoldier->bTeam != CIV_TEAM) || ( pSoldier->ubCivilianGroup == KINGPIN_CIV_GROUP ) ) { - + if (*psNoiseGridNo != NOWHERE) { // if we are NOT there (at the noise gridno) - if ( *pbNoiseLevel != pSoldier->bLevel || PythSpacesAway( pSoldier->sGridNo, *psNoiseGridNo ) >= 6 || SoldierTo3DLocationLineOfSightTest( pSoldier, *psNoiseGridNo, *pbNoiseLevel, 0, FALSE, NO_DISTANCE_LIMIT ) == 0 ) + if ( *pbNoiseLevel != pSoldier->pathing.bLevel || PythSpacesAway( pSoldier->sGridNo, *psNoiseGridNo ) >= 6 || SoldierTo3DLocationLineOfSightTest( pSoldier, *psNoiseGridNo, *pbNoiseLevel, 0, FALSE, NO_DISTANCE_LIMIT ) == 0 ) { // calculate how far this noise was, and its relative "importance" iDistAway = SpacesAway(pSoldier->sGridNo,*psNoiseGridNo); @@ -280,14 +280,14 @@ INT16 MostImportantNoiseHeard( SOLDIERTYPE *pSoldier, INT32 *piRetValue, BOOLEAN *pfReachable = TRUE; // make civs not walk to noises outside their room if on close patrol/onguard - if ( pSoldier->bOrders <= CLOSEPATROL && (pSoldier->bTeam == CIV_TEAM || pSoldier->ubProfile != NO_PROFILE ) ) + if ( pSoldier->aiData.bOrders <= CLOSEPATROL && (pSoldier->bTeam == CIV_TEAM || pSoldier->ubProfile != NO_PROFILE ) ) { UINT8 ubRoom, ubNewRoom; // any other combo uses the default of ubRoom == 0, set above - if ( InARoom( pSoldier->usPatrolGrid[0], &ubRoom ) ) + if ( InARoom( pSoldier->aiData.sPatrolGrid[0], &ubRoom ) ) { - if ( !InARoom( pSoldier->usPatrolGrid[0], &ubNewRoom ) || ubRoom != ubNewRoom ) + if ( !InARoom( pSoldier->aiData.sPatrolGrid[0], &ubNewRoom ) || ubRoom != ubNewRoom ) { *pfReachable = FALSE; } @@ -296,7 +296,7 @@ INT16 MostImportantNoiseHeard( SOLDIERTYPE *pSoldier, INT32 *piRetValue, BOOLEAN if ( *pfReachable ) { - // if there is a climb involved then we should store the location + // if there is a climb involved then we should store the location // of where we have to climb to instead sClimbingGridNo = GetInterveningClimbingLocation( pSoldier, sBestGridNo, bBestLevel, &fClimbingNecessary ); if ( fClimbingNecessary ) @@ -315,7 +315,7 @@ INT16 MostImportantNoiseHeard( SOLDIERTYPE *pSoldier, INT32 *piRetValue, BOOLEAN else { fClimbingNecessary = FALSE; - } + } } } @@ -346,14 +346,14 @@ INT16 WhatIKnowThatPublicDont(SOLDIERTYPE *pSoldier, UINT8 ubInSightOnly) SOLDIERTYPE * pTemp; // if merc knows of a more important misc. noise than his team does - if (!(CREATURE_OR_BLOODCAT( pSoldier )) && (pSoldier->ubNoiseVolume > gubPublicNoiseVolume[pSoldier->bTeam])) + if (!(CREATURE_OR_BLOODCAT( pSoldier )) && (pSoldier->aiData.ubNoiseVolume > gubPublicNoiseVolume[pSoldier->bTeam])) { // the difference in volume is added to the "new info" total - ubTotal += pSoldier->ubNoiseVolume - gubPublicNoiseVolume[pSoldier->bTeam]; + ubTotal += pSoldier->aiData.ubNoiseVolume - gubPublicNoiseVolume[pSoldier->bTeam]; } // hang pointers at start of this guy's personal and public opponent opplists - pbPersOL = &(pSoldier->bOppList[0]); + pbPersOL = &(pSoldier->aiData.bOppList[0]); pbPublOL = &(gbPublicOpplist[pSoldier->bTeam][0]); // for every opponent @@ -365,20 +365,20 @@ INT16 WhatIKnowThatPublicDont(SOLDIERTYPE *pSoldier, UINT8 ubInSightOnly) for (uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++) { pTemp = MercSlots[ uiLoop ]; - + // if this merc is inactive, at base, on assignment, or dead if (!pTemp) { - continue; // next merc + continue; // next merc } // if this merc is neutral/on same side, he's not an opponent if ( CONSIDERED_NEUTRAL( pSoldier, pTemp ) || (pSoldier->bSide == pTemp->bSide)) { - continue; // next merc + continue; // next merc } - pbPersOL = pSoldier->bOppList + pTemp->ubID; + pbPersOL = pSoldier->aiData.bOppList + pTemp->ubID; pbPublOL = gbPublicOpplist[pSoldier->bTeam] + pTemp->ubID; diff --git a/TacticalAI/Medical.cpp b/TacticalAI/Medical.cpp index 3a42745d..483a35e6 100644 --- a/TacticalAI/Medical.cpp +++ b/TacticalAI/Medical.cpp @@ -3,7 +3,7 @@ #else #include "types.h" #include "wcheck.h" - #include "Soldier Control.h" + #include "Soldier Functions.h" #include "ai.h" #include "AIInternals.h" @@ -17,10 +17,15 @@ #include "Assignments.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + extern BOOLEAN gfAutoBandageFailed; // -// This file contains code devoted to the player AI-controlled medical system. Maybe it +// This file contains code devoted to the player AI-controlled medical system. Maybe it // can be used or adapted for the enemies too... // @@ -78,8 +83,8 @@ BOOLEAN FullPatientCheck( SOLDIERTYPE * pPatient ) return( TRUE ); } - if ( pPatient->bLevel != 0 ) - { // look for a clear spot for jumping up + if ( pPatient->pathing.bLevel != 0 ) + { // look for a clear spot for jumping up // special "closest" search that ignores climb spots IF they are occupied by non-medics return( FindAutobandageClimbPoint( pPatient->sGridNo, TRUE ) ); @@ -94,14 +99,14 @@ BOOLEAN FullPatientCheck( SOLDIERTYPE * pPatient ) if ( CanCharacterAutoBandageTeammate( pSoldier ) == TRUE ) { // can this guy path to the patient? - if ( pSoldier->bLevel == 0 ) + if ( pSoldier->pathing.bLevel == 0 ) { // do a regular path check if ( FindBestPath( pSoldier, pPatient->sGridNo, 0, WALKING, NO_COPYROUTE, PATH_THROUGH_PEOPLE ) ) { return( TRUE ); } - } + } else { // if on different levels, assume okay @@ -189,13 +194,13 @@ BOOLEAN CanCharacterAutoBandageTeammate( SOLDIERTYPE *pSoldier ) // can this soldier autobandage others in sector { // if the soldier isn't active or in sector, we have problems..leave - if ( !(pSoldier->bActive) || !(pSoldier->bInSector) || ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) || (pSoldier->bAssignment == VEHICLE ) ) + if ( !(pSoldier->bActive) || !(pSoldier->bInSector) || ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) || (pSoldier->bAssignment == VEHICLE ) ) { return( FALSE ); } // they must have oklife or more, not be collapsed, have some level of medical competence, and have a med kit of some sort - if ( (pSoldier->bLife >= OKLIFE) && !(pSoldier->bCollapsed) && (pSoldier->bMedical > 0) && (FindObjClass( pSoldier, IC_MEDKIT ) != NO_SLOT) ) + if ( (pSoldier->stats.bLife >= OKLIFE) && !(pSoldier->bCollapsed) && (pSoldier->stats.bMedical > 0) && (FindObjClass( pSoldier, IC_MEDKIT ) != NO_SLOT) ) { return( TRUE ); } @@ -208,12 +213,12 @@ BOOLEAN CanCharacterAutoBandageTeammate( SOLDIERTYPE *pSoldier ) BOOLEAN CanCharacterBeAutoBandagedByTeammate( SOLDIERTYPE *pSoldier ) { // if the soldier isn't active or in sector, we have problems..leave - if ( !(pSoldier->bActive) || !(pSoldier->bInSector) || ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) || (pSoldier->bAssignment == VEHICLE ) ) + if ( !(pSoldier->bActive) || !(pSoldier->bInSector) || ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) || (pSoldier->bAssignment == VEHICLE ) ) { return( FALSE ); } - if ( (pSoldier->bLife > 0) && (pSoldier->bBleeding > 0) ) + if ( (pSoldier->stats.bLife > 0) && (pSoldier->bBleeding > 0) ) { // someone's bleeding and not being given first aid! return( TRUE ); @@ -248,13 +253,13 @@ INT8 FindBestPatient( SOLDIERTYPE * pSoldier, BOOLEAN * pfDoClimb ) continue; // NEXT!!! } - if (pPatient->bLife > 0 && pPatient->bBleeding && pPatient->ubServiceCount == 0) + if (pPatient->stats.bLife > 0 && pPatient->bBleeding && pPatient->ubServiceCount == 0) { - if (pPatient->bLife < OKLIFE) + if (pPatient->stats.bLife < OKLIFE) { bPatientPriority = 3; } - else if (pPatient->bLife < OKLIFE * 2) + else if (pPatient->stats.bLife < OKLIFE * 2) { bPatientPriority = 2; } @@ -265,7 +270,7 @@ INT8 FindBestPatient( SOLDIERTYPE * pSoldier, BOOLEAN * pfDoClimb ) if (bPatientPriority >= bBestPriority) { - if ( !ClimbingNecessary( pSoldier, pPatient->sGridNo, pPatient->bLevel ) ) + if ( !ClimbingNecessary( pSoldier, pPatient->sGridNo, pPatient->pathing.bLevel ) ) { sPatientGridNo = pPatient->sGridNo; @@ -276,7 +281,7 @@ INT8 FindBestPatient( SOLDIERTYPE * pSoldier, BOOLEAN * pfDoClimb ) for ( cnt2 = 0; cnt2 < NUM_WORLD_DIRECTIONS; cnt2++ ) { sPatientGridNo = pPatient->sGridNo + DirectionInc( cnt2 ); - if ( WhoIsThere2( sPatientGridNo, pPatient->bLevel ) == pPatient->ubID ) + if ( WhoIsThere2( sPatientGridNo, pPatient->pathing.bLevel ) == pPatient->ubID ) { // patient is also here, try this location sAdjacentGridNo = FindAdjacentGridEx( pSoldier, sPatientGridNo, &ubDirection, &sAdjustedGridNo, FALSE, FALSE ); @@ -353,7 +358,7 @@ INT8 FindBestPatient( SOLDIERTYPE * pSoldier, BOOLEAN * pfDoClimb ) { sClimbGridNo = NOWHERE; // see if guy on another building etc and we need to climb somewhere - sPathCost = EstimatePathCostToLocation( pSoldier, pPatient->sGridNo, pPatient->bLevel, FALSE, &fClimbingNecessary, &sClimbGridNo ); + sPathCost = EstimatePathCostToLocation( pSoldier, pPatient->sGridNo, pPatient->pathing.bLevel, FALSE, &fClimbingNecessary, &sClimbGridNo ); // if we can get there if ( sPathCost != 0 && fClimbingNecessary && sPathCost < sShortestClimbPath ) { @@ -381,19 +386,19 @@ INT8 FindBestPatient( SOLDIERTYPE * pSoldier, BOOLEAN * pfDoClimb ) *pfDoClimb = FALSE; if ( CardinalSpacesAway( pSoldier->sGridNo, sBestPatientGridNo ) == 1 ) { - pSoldier->usActionData = sBestPatientGridNo; + pSoldier->aiData.usActionData = sBestPatientGridNo; return( AI_ACTION_GIVE_AID ); } else { - pSoldier->usActionData = sBestAdjGridNo; + pSoldier->aiData.usActionData = sBestAdjGridNo; return( AI_ACTION_GET_CLOSER ); } } else if (sBestClimbGridNo != NOWHERE ) { *pfDoClimb = TRUE; - pSoldier->usActionData = sBestClimbGridNo; + pSoldier->aiData.usActionData = sBestClimbGridNo; return( AI_ACTION_MOVE_TO_CLIMB ); } else @@ -408,7 +413,7 @@ INT8 DecideAutoBandage( SOLDIERTYPE * pSoldier ) BOOLEAN fDoClimb; - if (pSoldier->bMedical == 0 || pSoldier->ubServicePartner != NOBODY) + if (pSoldier->stats.bMedical == 0 || pSoldier->ubServicePartner != NOBODY) { // don't/can't make decision return( AI_ACTION_NONE ); @@ -424,7 +429,7 @@ INT8 DecideAutoBandage( SOLDIERTYPE * pSoldier ) if (pSoldier->bBleeding) { // heal self first! - pSoldier->usActionData = pSoldier->sGridNo; + pSoldier->aiData.usActionData = pSoldier->sGridNo; if (bSlot != HANDPOS) { pSoldier->bSlotItemTakenFrom = bSlot; @@ -443,9 +448,9 @@ INT8 DecideAutoBandage( SOLDIERTYPE * pSoldier ) return( AI_ACTION_GIVE_AID ); } -// pSoldier->usActionData = FindClosestPatient( pSoldier ); - pSoldier->bAction = FindBestPatient( pSoldier, &fDoClimb ); - if (pSoldier->bAction != AI_ACTION_NONE) +// pSoldier->aiData.usActionData = FindClosestPatient( pSoldier ); + pSoldier->aiData.bAction = FindBestPatient( pSoldier, &fDoClimb ); + if (pSoldier->aiData.bAction != AI_ACTION_NONE) { pSoldier->usUIMovementMode = RUNNING; if (bSlot != HANDPOS) @@ -454,9 +459,9 @@ INT8 DecideAutoBandage( SOLDIERTYPE * pSoldier ) SwapObjs( pSoldier, HANDPOS, bSlot, TRUE ); } - return( pSoldier->bAction ); + return( pSoldier->aiData.bAction ); } // do nothing - return( AI_ACTION_NONE ); -} \ No newline at end of file + return( AI_ACTION_NONE ); +} diff --git a/TacticalAI/Movement.cpp b/TacticalAI/Movement.cpp index f8e3638a..6b543123 100644 --- a/TacticalAI/Movement.cpp +++ b/TacticalAI/Movement.cpp @@ -13,11 +13,16 @@ #include "mapscreen.h" #include "strategic.h" #include "Strategic Pathing.h" - #include "Soldier Control.h" + #include "Soldier macros.h" #include "Render Fun.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + // from strategic extern INT16 DirXIncrementer[8]; extern INT16 DirYIncrementer[8]; @@ -32,19 +37,19 @@ extern INT16 DirYIncrementer[8]; int LegalNPCDestination(SOLDIERTYPE *pSoldier, INT16 sGridno, UINT8 ubPathMode, UINT8 ubWaterOK, UINT8 fFlags) { BOOLEAN fSkipTilesWithMercs; - + if ((sGridno < 0) || (sGridno >= GRIDSIZE)) - { + { #ifdef RECORDNET - fprintf(NetDebugFile,"LegalNPC->sDestination: ERROR - rcvd invalid gridno %d",gridno); + fprintf(NetDebugFile,"LegalNPC->pathing.sDestination: ERROR - rcvd invalid gridno %d",gridno); #endif #ifdef BETAVERSION - NumMessage("LegalNPC->sDestination: ERROR - rcvd invalid gridno ",gridno); + NumMessage("LegalNPC->pathing.sDestination: ERROR - rcvd invalid gridno ",gridno); #endif - return(FALSE); - } + return(FALSE); + } // return false if gridno on different level from merc if ( GridNoOnVisibleWorldTile( pSoldier->sGridNo ) && gpWorldLevelData[ pSoldier->sGridNo ].sHeight != gpWorldLevelData[ sGridno ].sHeight ) @@ -63,67 +68,67 @@ int LegalNPCDestination(SOLDIERTYPE *pSoldier, INT16 sGridno, UINT8 ubPathMode, // AND the gridno hasn't been black-listed for us // Nov 28 98: skip people in destination tile if in turnbased - if ( ( NewOKDestination(pSoldier, sGridno, fSkipTilesWithMercs, pSoldier->bLevel ) ) && + if ( ( NewOKDestination(pSoldier, sGridno, fSkipTilesWithMercs, pSoldier->pathing.bLevel ) ) && ( !InGas( pSoldier, sGridno ) ) && ( sGridno != pSoldier->sGridNo ) && - ( sGridno != pSoldier->sBlackList ) ) + ( sGridno != pSoldier->pathing.sBlackList ) ) /* - if ( ( NewOKDestination(pSoldier, sGridno, FALSE, pSoldier->bLevel ) ) && + if ( ( NewOKDestination(pSoldier, sGridno, FALSE, pSoldier->pathing.bLevel ) ) && ( !(gpWorldLevelData[ sGridno ].ubExtFlags[0] & (MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) || ( pSoldier->inv[ HEAD1POS ].usItem == GASMASK || pSoldier->inv[ HEAD2POS ].usItem == GASMASK ) ) && ( sGridno != pSoldier->sGridNo ) && - ( sGridno != pSoldier->sBlackList ) )*/ + ( sGridno != pSoldier->pathing.sBlackList ) )*/ /* - if ( ( NewOKDestination(pSoldier,sGridno,ALLPEOPLE, pSoldier->bLevel ) ) && + if ( ( NewOKDestination(pSoldier,sGridno,ALLPEOPLE, pSoldier->pathing.bLevel ) ) && ( !(gpWorldLevelData[ sGridno ].ubExtFlags[0] & (MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) || ( pSoldier->inv[ HEAD1POS ].usItem == GASMASK || pSoldier->inv[ HEAD2POS ].usItem == GASMASK ) ) && ( sGridno != pSoldier->sGridNo ) && - ( sGridno != pSoldier->sBlackList ) ) + ( sGridno != pSoldier->pathing.sBlackList ) ) */ - { - - // if water's a problem, and gridno is in a water tile (bridges are OK) + { + + // if water's a problem, and gridno is in a water tile (bridges are OK) if (!ubWaterOK && Water(sGridno)) - return(FALSE); + return(FALSE); //Madd: added to prevent people from running into gas and fire - if ( (gpWorldLevelData[sGridno].ubExtFlags[pSoldier->bLevel] & (MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) && - FindGasMask(pSoldier) == NO_SLOT ) + if ( (gpWorldLevelData[sGridno].ubExtFlags[pSoldier->pathing.bLevel] & (MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) && + FindGasMask(pSoldier) == NO_SLOT ) { return( FALSE ); } - if ( gpWorldLevelData[sGridno].ubExtFlags[pSoldier->bLevel] & MAPELEMENT_EXT_BURNABLEGAS ) + if ( gpWorldLevelData[sGridno].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_BURNABLEGAS ) { return( FALSE ); } - // passed all checks, now try to make sure we can get there! - switch (ubPathMode) - { - // if finding a path wasn't asked for (could have already been done, - // for example), don't bother - case IGNORE_PATH : return(TRUE); + // passed all checks, now try to make sure we can get there! + switch (ubPathMode) + { + // if finding a path wasn't asked for (could have already been done, + // for example), don't bother + case IGNORE_PATH : return(TRUE); - case ENSURE_PATH : if ( FindBestPath( pSoldier, sGridno, pSoldier->bLevel, WALKING, COPYROUTE, fFlags ) ) + case ENSURE_PATH : if ( FindBestPath( pSoldier, sGridno, pSoldier->pathing.bLevel, WALKING, COPYROUTE, fFlags ) ) { - return(TRUE); // legal destination + return(TRUE); // legal destination } - else // got this far, but found no clear path, + else // got this far, but found no clear path, { // so test fails - return(FALSE); + return(FALSE); } // *** NOTE: movement mode hardcoded to WALKING !!!!! case ENSURE_PATH_COST: return(PlotPath(pSoldier,sGridno,FALSE,FALSE,FALSE,WALKING,FALSE,FALSE,0)); - default : + default : #ifdef BETAVERSION - NumMessage("LegalNPC->sDestination: ERROR - illegal pathMode = ",ubPathMode); + NumMessage("LegalNPC->pathing.sDestination: ERROR - illegal pathMode = ",ubPathMode); #endif - return(FALSE); - } - } - else // something failed - didn't even have to test path - return(FALSE); // illegal destination + return(FALSE); + } + } + else // something failed - didn't even have to test path + return(FALSE); // illegal destination } @@ -145,15 +150,15 @@ int TryToResumeMovement(SOLDIERTYPE *pSoldier, INT16 sGridno) DebugAI( tempstr ); #endif - pSoldier->bPathStored = TRUE; // optimization - Ian + pSoldier->pathing.bPathStored = TRUE; // optimization - Ian // make him go to it (needed to continue movement across multiple turns) NewDest(pSoldier,sGridno); ubSuccess = TRUE; - - // make sure that it worked (check that pSoldier->sDestination == pSoldier->sGridNo) - if (pSoldier->sDestination == sGridno) + + // make sure that it worked (check that pSoldier->pathing.sDestination == pSoldier->sGridNo) + if (pSoldier->pathing.sDestination == sGridno) { ubSuccess = TRUE; } @@ -174,9 +179,9 @@ int TryToResumeMovement(SOLDIERTYPE *pSoldier, INT16 sGridno) CancelAIAction(pSoldier,FORCE); } - } + } else - { + { // don't black-list anything here, this situation can come up quite // legally if another soldier gets in the way between turns @@ -194,7 +199,7 @@ int TryToResumeMovement(SOLDIERTYPE *pSoldier, INT16 sGridno) #endif - if (!pSoldier->bUnderEscort) + if (!pSoldier->aiData.bUnderEscort) { CancelAIAction(pSoldier,DONTFORCE); // no need to force this } @@ -202,17 +207,17 @@ int TryToResumeMovement(SOLDIERTYPE *pSoldier, INT16 sGridno) { // this is an escorted NPC, don't want to just completely stop // moving, try to find a nearby "next best" destination if possible - pSoldier->usActionData = GoAsFarAsPossibleTowards(pSoldier,sGridno,pSoldier->bAction); + pSoldier->aiData.usActionData = GoAsFarAsPossibleTowards(pSoldier,sGridno,pSoldier->aiData.bAction); // if it's not possible to get any closer - if (pSoldier->usActionData == NOWHERE) + if (pSoldier->aiData.usActionData == NOWHERE) { ubGottaCancel = TRUE; } else { // change his desired destination to this new one - sGridno = pSoldier->usActionData; + sGridno = pSoldier->aiData.usActionData; // GoAsFar... sets pathStored TRUE only if he could go all the way @@ -220,8 +225,8 @@ int TryToResumeMovement(SOLDIERTYPE *pSoldier, INT16 sGridno) NewDest(pSoldier,sGridno); - // make sure that it worked (check that pSoldier->sDestination == pSoldier->sGridNo) - if (pSoldier->sDestination == sGridno) + // make sure that it worked (check that pSoldier->pathing.sDestination == pSoldier->sGridNo) + if (pSoldier->pathing.sDestination == sGridno) ubSuccess = TRUE; else ubGottaCancel = TRUE; @@ -246,25 +251,25 @@ int TryToResumeMovement(SOLDIERTYPE *pSoldier, INT16 sGridno) INT16 NextPatrolPoint(SOLDIERTYPE *pSoldier) { // patrol slot 0 is UNUSED, so max patrolCnt is actually only 9 - if ((pSoldier->bPatrolCnt < 1) || (pSoldier->bPatrolCnt >= MAXPATROLGRIDS)) - { + if ((pSoldier->aiData.bPatrolCnt < 1) || (pSoldier->aiData.bPatrolCnt >= MAXPATROLGRIDS)) + { #ifdef BETAVERSION - sprintf(tempstr,"NextPatrolPoint: ERROR: Invalid patrol count = %d for %s",pSoldier->bPatrolCnt,pSoldier->name); - PopMessage(tempstr); + sprintf(tempstr,"NextPatrolPoint: ERROR: Invalid patrol count = %d for %s",pSoldier->aiData.bPatrolCnt,pSoldier->name); + PopMessage(tempstr); #endif - return(NOWHERE); - } + return(NOWHERE); + } + + + pSoldier->aiData.bNextPatrolPnt++; - - pSoldier->bNextPatrolPnt++; - // if there are no more patrol points, return back to the first one - if (pSoldier->bNextPatrolPnt > pSoldier->bPatrolCnt) - pSoldier->bNextPatrolPnt = 1; // ZERO is not used! + if (pSoldier->aiData.bNextPatrolPnt > pSoldier->aiData.bPatrolCnt) + pSoldier->aiData.bNextPatrolPnt = 1; // ZERO is not used! - return(pSoldier->usPatrolGrid[pSoldier->bNextPatrolPnt]); + return(pSoldier->aiData.sPatrolGrid[pSoldier->aiData.bNextPatrolPnt]); } @@ -272,74 +277,74 @@ INT16 NextPatrolPoint(SOLDIERTYPE *pSoldier) INT8 PointPatrolAI(SOLDIERTYPE *pSoldier) { INT16 sPatrolPoint; - INT8 bOldOrders; + INT8 bOldOrders; #ifdef DEBUGDECISIONS STR16 tempstr; #endif - sPatrolPoint = pSoldier->usPatrolGrid[pSoldier->bNextPatrolPnt]; + sPatrolPoint = pSoldier->aiData.sPatrolGrid[pSoldier->aiData.bNextPatrolPnt]; // if we're already there, advance next patrol point - if (pSoldier->sGridNo == sPatrolPoint || pSoldier->bNextPatrolPnt == 0) - { - // find next valid patrol point - do - { - sPatrolPoint = NextPatrolPoint(pSoldier); - } - while ((sPatrolPoint != NOWHERE) && (NewOKDestination(pSoldier,sPatrolPoint,IGNOREPEOPLE, pSoldier->bLevel) < 1)); + if (pSoldier->sGridNo == sPatrolPoint || pSoldier->aiData.bNextPatrolPnt == 0) + { + // find next valid patrol point + do + { + sPatrolPoint = NextPatrolPoint(pSoldier); + } + while ((sPatrolPoint != NOWHERE) && (NewOKDestination(pSoldier,sPatrolPoint,IGNOREPEOPLE, pSoldier->pathing.bLevel) < 1)); - // if we're back where we started, then ALL other patrol points are junk! - if (pSoldier->sGridNo == sPatrolPoint) - { + // if we're back where we started, then ALL other patrol points are junk! + if (pSoldier->sGridNo == sPatrolPoint) + { #ifdef BETAVERSION - NumMessage("PROBLEM WITH SCENARIO: All other patrol points are invalid for guynum ",pSoldier->ubID); + NumMessage("PROBLEM WITH SCENARIO: All other patrol points are invalid for guynum ",pSoldier->ubID); #endif - // force change of orders & an abort - sPatrolPoint = NOWHERE; - } - } + // force change of orders & an abort + sPatrolPoint = NOWHERE; + } + } // if we don't have a legal patrol point if (sPatrolPoint == NOWHERE) - { + { #ifdef BETAVERSION - NumMessage("PointPatrolAI: ERROR - no legal patrol point for %d",pSoldier->ubID); + NumMessage("PointPatrolAI: ERROR - no legal patrol point for %d",pSoldier->ubID); #endif - // over-ride orders to something safer - pSoldier->bOrders = FARPATROL; - return(FALSE); - } + // over-ride orders to something safer + pSoldier->aiData.bOrders = FARPATROL; + return(FALSE); + } // make sure we can get there from here at this time, if we can't get all // the way there, at least do our best to get close if (LegalNPCDestination(pSoldier,sPatrolPoint,ENSURE_PATH,WATEROK,0)) - { - pSoldier->bPathStored = TRUE; // optimization - Ian - pSoldier->usActionData = sPatrolPoint; - } + { + pSoldier->pathing.bPathStored = TRUE; // optimization - Ian + pSoldier->aiData.usActionData = sPatrolPoint; + } else - { - // temporarily extend roaming range to infinity by changing orders, else - // this won't work if the next patrol point is > 10 tiles away! - bOldOrders = pSoldier->bOrders; - pSoldier->bOrders = ONCALL; + { + // temporarily extend roaming range to infinity by changing orders, else + // this won't work if the next patrol point is > 10 tiles away! + bOldOrders = pSoldier->aiData.bOrders; + pSoldier->aiData.bOrders = ONCALL; - pSoldier->usActionData = GoAsFarAsPossibleTowards(pSoldier,sPatrolPoint,pSoldier->bAction); + pSoldier->aiData.usActionData = GoAsFarAsPossibleTowards(pSoldier,sPatrolPoint,pSoldier->aiData.bAction); - pSoldier->bOrders = bOldOrders; + pSoldier->aiData.bOrders = bOldOrders; - // if it's not possible to get any closer, that's OK, but fail this call - if (pSoldier->usActionData == NOWHERE) - return(FALSE); - } + // if it's not possible to get any closer, that's OK, but fail this call + if (pSoldier->aiData.usActionData == NOWHERE) + return(FALSE); + } // passed all tests - start moving towards next patrol point #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - POINT PATROL to grid %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - POINT PATROL to grid %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif @@ -352,13 +357,13 @@ INT8 RandomPointPatrolAI(SOLDIERTYPE *pSoldier) STR16 tempstr; #endif INT16 sPatrolPoint; - INT8 bOldOrders, bPatrolIndex; + INT8 bOldOrders, bPatrolIndex; INT8 bCnt; - sPatrolPoint = pSoldier->usPatrolGrid[pSoldier->bNextPatrolPnt]; + sPatrolPoint = pSoldier->aiData.sPatrolGrid[pSoldier->aiData.bNextPatrolPnt]; // if we're already there, advance next patrol point - if (pSoldier->sGridNo == sPatrolPoint || pSoldier->bNextPatrolPnt == 0) + if (pSoldier->sGridNo == sPatrolPoint || pSoldier->aiData.bNextPatrolPnt == 0) { // find next valid patrol point // we keep a count of the # of times we are in here to make sure we don't get into an endless @@ -367,23 +372,23 @@ INT8 RandomPointPatrolAI(SOLDIERTYPE *pSoldier) do { // usPatrolGrid[0] gets used for centre of close etc patrols, so we have to add 1 to the Random # - bPatrolIndex = (INT8) PreRandom( pSoldier->bPatrolCnt ) + 1; - sPatrolPoint = pSoldier->usPatrolGrid[ bPatrolIndex]; + bPatrolIndex = (INT8) PreRandom( pSoldier->aiData.bPatrolCnt ) + 1; + sPatrolPoint = pSoldier->aiData.sPatrolGrid[ bPatrolIndex]; bCnt++; } - while ( (sPatrolPoint == pSoldier->sGridNo) || ( (sPatrolPoint != NOWHERE) && (bCnt < pSoldier->bPatrolCnt) && (NewOKDestination(pSoldier,sPatrolPoint,IGNOREPEOPLE, pSoldier->bLevel ) < 1)) ); + while ( (sPatrolPoint == pSoldier->sGridNo) || ( (sPatrolPoint != NOWHERE) && (bCnt < pSoldier->aiData.bPatrolCnt) && (NewOKDestination(pSoldier,sPatrolPoint,IGNOREPEOPLE, pSoldier->pathing.bLevel ) < 1)) ); - if (bCnt == pSoldier->bPatrolCnt) + if (bCnt == pSoldier->aiData.bPatrolCnt) { // ok, we tried doing this randomly, didn't work well, so now do a linear search - pSoldier->bNextPatrolPnt = 0; + pSoldier->aiData.bNextPatrolPnt = 0; do { sPatrolPoint = NextPatrolPoint(pSoldier); } - while ((sPatrolPoint != NOWHERE) && (NewOKDestination(pSoldier,sPatrolPoint,IGNOREPEOPLE, pSoldier->bLevel) < 1)); + while ((sPatrolPoint != NOWHERE) && (NewOKDestination(pSoldier,sPatrolPoint,IGNOREPEOPLE, pSoldier->pathing.bLevel) < 1)); } - + // do nothing this time around if (pSoldier->sGridNo == sPatrolPoint) { @@ -399,7 +404,7 @@ INT8 RandomPointPatrolAI(SOLDIERTYPE *pSoldier) #endif // over-ride orders to something safer - pSoldier->bOrders = FARPATROL; + pSoldier->aiData.bOrders = FARPATROL; return(FALSE); } @@ -407,29 +412,29 @@ INT8 RandomPointPatrolAI(SOLDIERTYPE *pSoldier) // the way there, at least do our best to get close if (LegalNPCDestination(pSoldier,sPatrolPoint,ENSURE_PATH,WATEROK,0)) { - pSoldier->bPathStored = TRUE; // optimization - Ian - pSoldier->usActionData = sPatrolPoint; + pSoldier->pathing.bPathStored = TRUE; // optimization - Ian + pSoldier->aiData.usActionData = sPatrolPoint; } else { // temporarily extend roaming range to infinity by changing orders, else // this won't work if the next patrol point is > 10 tiles away! - bOldOrders = pSoldier->bOrders; - pSoldier->bOrders = SEEKENEMY; + bOldOrders = pSoldier->aiData.bOrders; + pSoldier->aiData.bOrders = SEEKENEMY; - pSoldier->usActionData = GoAsFarAsPossibleTowards(pSoldier,sPatrolPoint,pSoldier->bAction); + pSoldier->aiData.usActionData = GoAsFarAsPossibleTowards(pSoldier,sPatrolPoint,pSoldier->aiData.bAction); - pSoldier->bOrders = bOldOrders; + pSoldier->aiData.bOrders = bOldOrders; // if it's not possible to get any closer, that's OK, but fail this call - if (pSoldier->usActionData == NOWHERE) + if (pSoldier->aiData.usActionData == NOWHERE) return(FALSE); } // passed all tests - start moving towards next patrol point #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - POINT PATROL to grid %d",pSoldier->name,pSoldier->usActionData); + sprintf(tempstr,"%s - POINT PATROL to grid %d",pSoldier->name,pSoldier->aiData.usActionData); AIPopMessage(tempstr); #endif @@ -452,9 +457,9 @@ INT16 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT16 sDesGrid, IN UINT8 ubRoomRequired = 0, ubTempRoom; BOOLEAN fAllowDest = FALSE; - // 0verhaul: Make sure to clear the stored path since this always calculates a new one. + // 0verhaul: Make sure to clear the stored path since this always calculates a new one. // This is needed if the path cannot be found. - pSoldier->bPathStored = FALSE; + pSoldier->pathing.bPathStored = FALSE; if ( bReserveAPs == -1 ) { @@ -474,9 +479,9 @@ INT16 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT16 sDesGrid, IN // obtain maximum roaming distance from soldier's sOrigin usMaxDist = RoamingRange(pSoldier,&sOrigin); - if ( pSoldier->bOrders <= CLOSEPATROL && (pSoldier->bTeam == CIV_TEAM || pSoldier->ubProfile != NO_PROFILE ) ) + if ( pSoldier->aiData.bOrders <= CLOSEPATROL && (pSoldier->bTeam == CIV_TEAM || pSoldier->ubProfile != NO_PROFILE ) ) { - if ( InARoom( pSoldier->usPatrolGrid[0], &ubRoomRequired ) ) + if ( InARoom( pSoldier->aiData.sPatrolGrid[0], &ubRoomRequired ) ) { // make sure this doesn't interfere with pathing for scripts if ( pSoldier->sAbsoluteFinalDestination != NOWHERE ) @@ -544,7 +549,7 @@ INT16 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT16 sDesGrid, IN if ( CREATURE_OR_BLOODCAT( pSoldier ) ) { // we tried to get close, failed; abort! - pSoldier->usPathIndex = pSoldier->usPathDataSize = 0; + pSoldier->pathing.usPathIndex = pSoldier->pathing.usPathDataSize = 0; return( NOWHERE ); } else @@ -583,13 +588,13 @@ INT16 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT16 sDesGrid, IN if (LegalNPCDestination(pSoldier,sTempDest,ENSURE_PATH,NOWATER,0)) { - fFound = TRUE; // found a spot + fFound = TRUE; // found a spot #ifdef DEBUGDECISIONS - AINumMessage("Found a spot! ubDirection = ",ubDirection + 1); + AINumMessage("Found a spot! ubDirection = ",ubDirection + 1); #endif - break; // stop checking in other directions + break; // stop checking in other directions } } @@ -599,7 +604,7 @@ INT16 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT16 sDesGrid, IN AINumMessage("Couldn't find OK destination around grid #",sDesGrid); #endif - pSoldier->usPathIndex = pSoldier->usPathDataSize = 0; + pSoldier->pathing.usPathIndex = pSoldier->pathing.usPathDataSize = 0; return(NOWHERE); } @@ -613,11 +618,11 @@ INT16 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT16 sDesGrid, IN #ifdef DEBUGDECISIONS AINumMessage("Chosen legal destination is gridno ",sDesGrid); - AINumMessage("Tracing along path, pathRouteToGo = ",pSoldier->usPathIndex); + AINumMessage("Tracing along path, pathRouteToGo = ",pSoldier->pathing.usPathIndex); #endif - sGoToGrid = pSoldier->sGridNo; // start back where soldier is standing now - sAPCost = 0; // initialize path cost counter + sGoToGrid = pSoldier->sGridNo; // start back where soldier is standing now + sAPCost = 0; // initialize path cost counter // 0verhaul: If the destination is within the patrol route, allow it. This is necessary to allow an errant soldier // to return to his patrol route if flanking or other actions have pulled him beyond his allowed range from origin. @@ -629,149 +634,149 @@ INT16 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT16 sDesGrid, IN // we'll only go as far along the plotted route as is within our // permitted roaming range, and we'll stop as soon as we're down to <= 5 APs - for (sLoop = 0; sLoop < (pSoldier->usPathDataSize - pSoldier->usPathIndex); sLoop++) - { - // what is the next gridno in the path? + for (sLoop = 0; sLoop < (pSoldier->pathing.usPathDataSize - pSoldier->pathing.usPathIndex); sLoop++) + { + // what is the next gridno in the path? - //sTempDest = NewGridNo( sGoToGrid,DirectionInc( (INT16) (pSoldier->usPathingData[sLoop] + 1) ) ); - sTempDest = NewGridNo( sGoToGrid,DirectionInc( (UINT8) (pSoldier->usPathingData[sLoop]) ) ); - //NumMessage("sTempDest = ",sTempDest); + //sTempDest = NewGridNo( sGoToGrid,DirectionInc( (INT16) (pSoldier->pathing.usPathingData[sLoop] + 1) ) ); + sTempDest = NewGridNo( sGoToGrid,DirectionInc( (UINT8) (pSoldier->pathing.usPathingData[sLoop]) ) ); + //NumMessage("sTempDest = ",sTempDest); - // this should NEVER be out of bounds - if (sTempDest == sGoToGrid) - { + // this should NEVER be out of bounds + if (sTempDest == sGoToGrid) + { #ifdef BETAVERSION - sprintf(tempstr,"GoAsFarAsPossibleTowards: ERROR - gridno along valid route is invalid! guynum %d, sTempDest = %d",pSoldier->ubID,sTempDest); + sprintf(tempstr,"GoAsFarAsPossibleTowards: ERROR - gridno along valid route is invalid! guynum %d, sTempDest = %d",pSoldier->ubID,sTempDest); #ifdef RECORDNET - fprintf(NetDebugFile,"\n\t%s\n",tempstr); + fprintf(NetDebugFile,"\n\t%s\n",tempstr); #endif - PopMessage(tempstr); - SaveGame(ERROR_SAVE); + PopMessage(tempstr); + SaveGame(ERROR_SAVE); #endif - break; // quit here, sGoToGrid is where we are going - } + break; // quit here, sGoToGrid is where we are going + } - // if this takes us beyond our permitted "roaming range" + // if this takes us beyond our permitted "roaming range" // but if it brings us closer, then allow it! if (SpacesAway(sOrigin,sTempDest) > usMaxDist && !fAllowDest) - break; // quit here, sGoToGrid is where we are going + break; // quit here, sGoToGrid is where we are going - if ( ubRoomRequired ) - { + if ( ubRoomRequired ) + { if ( !( InARoom( sTempDest, &ubTempRoom ) && ubTempRoom == ubRoomRequired ) ) { - // quit here, limited by room! - break; + // quit here, limited by room! + break; } - } + } - if ( (fFlags & FLAG_STOPSHORT) && SpacesAway( sDesGrid, sTempDest ) <= STOPSHORTDIST ) - { - break; // quit here, sGoToGrid is where we are going - } + if ( (fFlags & FLAG_STOPSHORT) && SpacesAway( sDesGrid, sTempDest ) <= STOPSHORTDIST ) + { + break; // quit here, sGoToGrid is where we are going + } - // if this gridno is NOT a legal NPC destination - // DONT'T test path again - that would replace the traced path! - Ian - // NOTE: It's OK to go *THROUGH* water to try and get to the destination! - if (!LegalNPCDestination(pSoldier,sTempDest,IGNORE_PATH,WATEROK,0)) - break; // quit here, sGoToGrid is where we are going + // if this gridno is NOT a legal NPC destination + // DONT'T test path again - that would replace the traced path! - Ian + // NOTE: It's OK to go *THROUGH* water to try and get to the destination! + if (!LegalNPCDestination(pSoldier,sTempDest,IGNORE_PATH,WATEROK,0)) + break; // quit here, sGoToGrid is where we are going - // CAN'T CALL PathCost() HERE! IT CALLS findBestPath() and overwrites - // pathRouteToGo !!! Gotta calculate the cost ourselves - Ian - // - //ubAPsLeft = pSoldier->bActionPoints - PathCost(pSoldier,sTempDest,FALSE,FALSE,FALSE,FALSE,FALSE); + // CAN'T CALL PathCost() HERE! IT CALLS findBestPath() and overwrites + // pathRouteToGo !!! Gotta calculate the cost ourselves - Ian + // + //ubAPsLeft = pSoldier->bActionPoints - PathCost(pSoldier,sTempDest,FALSE,FALSE,FALSE,FALSE,FALSE); - if (gfTurnBasedAI) - { - // if we're just starting the "costing" process (first gridno) - if (sLoop == 0) + if (gfTurnBasedAI) + { + // if we're just starting the "costing" process (first gridno) + if (sLoop == 0) { /* - // first, add any additional costs - such as intermediate animations, etc. - switch(pSoldier->anitype[pSoldier->anim]) + // first, add any additional costs - such as intermediate animations, etc. + switch(pSoldier->anitype[pSoldier->anim]) { - // in theory, no NPC should ever be in one of these animations as - // things stand (they don't medic anyone), but leave it for robustness - case START_AID : - case GIVING_AID : sAnimCost = AP_STOP_FIRST_AID; + // in theory, no NPC should ever be in one of these animations as + // things stand (they don't medic anyone), but leave it for robustness + case START_AID : + case GIVING_AID : sAnimCost = AP_STOP_FIRST_AID; break; - case TWISTOMACH : - case COLLAPSED : sAnimCost = AP_GET_UP; + case TWISTOMACH : + case COLLAPSED : sAnimCost = AP_GET_UP; break; - case TWISTBACK : - case UNCONSCIOUS : sAnimCost = (AP_ROLL_OVER + AP_GET_UP); + case TWISTBACK : + case UNCONSCIOUS : sAnimCost = (AP_ROLL_OVER + AP_GET_UP); break; - default : sAnimCost = 0; + default : sAnimCost = 0; } - // this is our first cost - sAPCost += sAnimCost; - */ + // this is our first cost + sAPCost += sAnimCost; + */ - if (pSoldier->usUIMovementMode == RUNNING) - { + if (pSoldier->usUIMovementMode == RUNNING) + { sAPCost += AP_START_RUN_COST; - } + } } - // ATE: Direction here? - sAPCost += EstimateActionPointCost( pSoldier, sTempDest, (INT8) pSoldier->usPathingData[sLoop], pSoldier->usUIMovementMode, (INT8) sLoop, (INT8) pSoldier->usPathDataSize ); + // ATE: Direction here? + sAPCost += EstimateActionPointCost( pSoldier, sTempDest, (INT8) pSoldier->pathing.usPathingData[sLoop], pSoldier->usUIMovementMode, (INT8) sLoop, (INT8) pSoldier->pathing.usPathDataSize ); - bAPsLeft = pSoldier->bActionPoints - sAPCost; - } + bAPsLeft = pSoldier->bActionPoints - sAPCost; + } - // if after this, we have <= 5 APs remaining, that's far enough, break out - // (the idea is to preserve APs so we can crouch or react if - // necessary, and benefit from the carry-over next turn if not needed) - // This routine is NOT used by any GREEN AI, so such caution is warranted! + // if after this, we have <= 5 APs remaining, that's far enough, break out + // (the idea is to preserve APs so we can crouch or react if + // necessary, and benefit from the carry-over next turn if not needed) + // This routine is NOT used by any GREEN AI, so such caution is warranted! - if ( gfTurnBasedAI && (bAPsLeft < bReserveAPs) ) - break; - else + if ( gfTurnBasedAI && (bAPsLeft < bReserveAPs) ) + break; + else { - sGoToGrid = sTempDest; // we're OK up to here + sGoToGrid = sTempDest; // we're OK up to here - // if exactly 5 APs left, don't bother checking any further - if ( gfTurnBasedAI && (bAPsLeft == bReserveAPs) ) - break; - } - } + // if exactly 5 APs left, don't bother checking any further + if ( gfTurnBasedAI && (bAPsLeft == bReserveAPs) ) + break; + } + } // if it turned out we couldn't go even 1 tile towards the desired gridno if (sGoToGrid == pSoldier->sGridNo) - { + { #ifdef DEBUGDECISIONS sprintf(tempstr,"%s will go NOWHERE, path doesn't meet criteria",pSoldier->name); AIPopMessage(tempstr); #endif - pSoldier->usPathIndex = pSoldier->usPathDataSize = 0; - return(NOWHERE); // then go nowhere - } + pSoldier->pathing.usPathIndex = pSoldier->pathing.usPathDataSize = 0; + return(NOWHERE); // then go nowhere + } else { // possible optimization - stored path IS good if we're going all the way if (sGoToGrid == sDesGrid) - { - pSoldier->bPathStored = TRUE; - pSoldier->sFinalDestination = sGoToGrid; - } - else if ( pSoldier->usPathIndex == 0 ) - { + { + pSoldier->pathing.bPathStored = TRUE; + pSoldier->pathing.sFinalDestination = sGoToGrid; + } + else if ( pSoldier->pathing.usPathIndex == 0 ) + { // we can hack this surely! -- CJC - pSoldier->bPathStored = TRUE; - pSoldier->sFinalDestination = sGoToGrid; - pSoldier->usPathDataSize = sLoop + 1; - } + pSoldier->pathing.bPathStored = TRUE; + pSoldier->pathing.sFinalDestination = sGoToGrid; + pSoldier->pathing.usPathDataSize = sLoop + 1; + } #ifdef DEBUGDECISIONS ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"%d to %d with %d APs left", pSoldier->ubID, sGoToGrid, pSoldier->bActionPoints ); @@ -779,36 +784,36 @@ INT16 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT16 sDesGrid, IN return( sGoToGrid ); - } + } } - + INT16 GoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT16 sDesGrid, INT8 bAction) { return( InternalGoAsFarAsPossibleTowards( pSoldier, sDesGrid, -1, bAction, 0 ) ); } - + void SoldierTriesToContinueAlongPath(SOLDIERTYPE *pSoldier) { - INT16 usNewGridNo,bAPCost; + INT16 sNewGridNo,bAPCost; // turn off the flag now that we're going to do something about it... // ATE: USed to be redundent, now if called befroe NewDest can cause some side efects... - // AdjustNoAPToFinishMove( pSoldier, FALSE ); + // pSoldier->AdjustNoAPToFinishMove( FALSE ); - if (pSoldier->bNewSituation == IS_NEW_SITUATION) + if (pSoldier->aiData.bNewSituation == IS_NEW_SITUATION) { CancelAIAction(pSoldier,DONTFORCE); return; } - if (pSoldier->usActionData >= NOWHERE) + if (pSoldier->aiData.usActionData >= NOWHERE) { - CancelAIAction(pSoldier,DONTFORCE); + CancelAIAction(pSoldier,DONTFORCE); return; } - if (!NewOKDestination( pSoldier,pSoldier->usActionData, TRUE, pSoldier->bLevel )) + if (!NewOKDestination( pSoldier,pSoldier->aiData.usActionData, TRUE, pSoldier->pathing.bLevel )) { CancelAIAction(pSoldier,DONTFORCE); return; @@ -816,14 +821,14 @@ void SoldierTriesToContinueAlongPath(SOLDIERTYPE *pSoldier) if (IsActionAffordable(pSoldier)) { - if (pSoldier->bActionInProgress == FALSE) + if (pSoldier->aiData.bActionInProgress == FALSE) { // start a move that didn't even get started before... // hope this works... NPCDoesAct(pSoldier); // perform the chosen action - pSoldier->bActionInProgress = ExecuteAction(pSoldier); // if started, mark us as busy + pSoldier->aiData.bActionInProgress = ExecuteAction(pSoldier); // if started, mark us as busy } else { @@ -834,37 +839,37 @@ void SoldierTriesToContinueAlongPath(SOLDIERTYPE *pSoldier) { CancelAIAction(pSoldier,DONTFORCE); #ifdef TESTAI - DebugMsg( TOPIC_JA2AI, DBG_LEVEL_3, + DebugMsg( TOPIC_JA2AI, DBG_LEVEL_3, String("Soldier (%d) HAS NOT ENOUGH AP to continue along path",pSoldier->ubID) ); #endif } - usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( (UINT8)pSoldier->usPathingData[ pSoldier->usPathIndex ] ) ); + sNewGridNo = NewGridNo( (INT16)pSoldier->sGridNo, DirectionInc( (UINT8)pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathIndex ] ) ); // Find out how much it takes to move here! - bAPCost = EstimateActionPointCost( pSoldier, usNewGridNo, (INT8)pSoldier->usPathingData[ pSoldier->usPathIndex ], pSoldier->usUIMovementMode, (INT8) pSoldier->usPathIndex, (INT8) pSoldier->usPathDataSize ); + bAPCost = EstimateActionPointCost( pSoldier, sNewGridNo, (INT8)pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathIndex ], pSoldier->usUIMovementMode, (INT8) pSoldier->pathing.usPathIndex, (INT8) pSoldier->pathing.usPathDataSize ); if (pSoldier->bActionPoints >= bAPCost) { // seems to have enough points... - NewDest(pSoldier,usNewGridNo); + NewDest(pSoldier,sNewGridNo); // maybe we didn't actually start the action last turn... - pSoldier->bActionInProgress = TRUE; + pSoldier->aiData.bActionInProgress = TRUE; #ifdef TESTAI - DebugMsg( TOPIC_JA2AI, DBG_LEVEL_3, + DebugMsg( TOPIC_JA2AI, DBG_LEVEL_3, String("Soldier (%d) continues along path",pSoldier->ubID) ); #endif } else - { + { CancelAIAction(pSoldier,DONTFORCE); #ifdef TESTAI - DebugMsg( TOPIC_JA2AI, DBG_LEVEL_3, + DebugMsg( TOPIC_JA2AI, DBG_LEVEL_3, String("Soldier (%d) HAS NOT ENOUGH AP to continue along path",pSoldier->ubID) ); #endif - } -} - + } +} + void HaltMoveForSoldierOutOfPoints(SOLDIERTYPE *pSoldier) { // If a special move, ignore this! @@ -874,13 +879,13 @@ void HaltMoveForSoldierOutOfPoints(SOLDIERTYPE *pSoldier) } // record that this merc can no longer animate and why... - AdjustNoAPToFinishMove( pSoldier, TRUE ); + pSoldier->AdjustNoAPToFinishMove( TRUE ); // We'll keep his action intact though... DebugAI( String("NO AP TO FINISH MOVE for %d (%d APs left)",pSoldier->ubID, pSoldier->bActionPoints) ); // if this dude is under AI right now, then pass the baton to someone else - if (pSoldier->uiStatusFlags & SOLDIER_UNDERAICONTROL) + if (pSoldier->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL) { #ifdef TESTAICONTROL DebugAI( String("Ending turn for %d because out of APs for movement", pSoldier->ubID ) ); @@ -900,41 +905,41 @@ void SetCivilianDestination(UINT8 ubWho, INT16 sGridno) /* // if we control the civilian if (PTR_OURCONTROL) - { + { */ - // if the destination is different from what he has now - if (pSoldier->usActionData != sGridno) - { - // store his new destination - pSoldier->usActionData = sGridno; + // if the destination is different from what he has now + if (pSoldier->aiData.usActionData != sGridno) + { + // store his new destination + pSoldier->aiData.usActionData = sGridno; - // and cancel any movement in progress that he was still engaged in - pSoldier->bAction = AI_ACTION_NONE; - pSoldier->bActionInProgress = FALSE; - } + // and cancel any movement in progress that he was still engaged in + pSoldier->aiData.bAction = AI_ACTION_NONE; + pSoldier->aiData.bActionInProgress = FALSE; + } - // only set the underEscort flag once you give him a destination - // (that way AI can keep him appearing to act on his own until you - // give him orders). - // - // Either way, once set, it should stay that way, preventing AI from - // doing anything other than advance him towards destination. - pSoldier->bUnderEscort = TRUE; + // only set the underEscort flag once you give him a destination + // (that way AI can keep him appearing to act on his own until you + // give him orders). + // + // Either way, once set, it should stay that way, preventing AI from + // doing anything other than advance him towards destination. + pSoldier->aiData.bUnderEscort = TRUE; - // change orders to maximize roaming range so he can Go As Far As Possible - pSoldier->bOrders = ONCALL; + // change orders to maximize roaming range so he can Go As Far As Possible + pSoldier->aiData.bOrders = ONCALL; /* - } + } else - { - NetSend.msgType = NET_CIV_DEST; - NetSend.ubID = pSoldier->ubID; - NetSend.gridno = gridno; + { + NetSend.msgType = NET_CIV_DEST; + NetSend.ubID = pSoldier->ubID; + NetSend.gridno = gridno; - // only the civilian's controller needs to know this - SendNetData(pSoldier->controller); - } + // only the civilian's controller needs to know this + SendNetData(pSoldier->controller); + } */ } @@ -962,7 +967,7 @@ INT16 TrackScent( SOLDIERTYPE * pSoldier ) if (CREATURE_OR_BLOODCAT( pSoldier ) ) // or bloodcats { - // tracking humans; search the edges of a 7x7 square for the + // tracking humans; search the edges of a 7x7 square for the // most promising tile ubSoughtSmell = HUMAN; for (iYDiff = -RADIUS; iYDiff < (RADIUS + 1); iYDiff++) @@ -994,7 +999,7 @@ INT16 TrackScent( SOLDIERTYPE * pSoldier ) // wrapped across map! continue; } - if (LegalNPCDestination(pSoldier,pSoldier->usActionData,ENSURE_PATH,WATEROK,0)) + if (LegalNPCDestination(pSoldier,pSoldier->aiData.usActionData,ENSURE_PATH,WATEROK,0)) { // check this location out pMapElement = &(gpWorldLevelData[iGridNo]); @@ -1040,7 +1045,7 @@ INT16 TrackScent( SOLDIERTYPE * pSoldier ) } } - } + } } } } @@ -1050,11 +1055,11 @@ INT16 TrackScent( SOLDIERTYPE * pSoldier ) } else { - // who else can track? + // who else can track? } if (iBestGridNo != NOWHERE ) { - pSoldier->usActionData = (INT16) iBestGridNo; + pSoldier->aiData.usActionData = (INT16) iBestGridNo; return( (INT16) iBestGridNo ); } return( 0 ); @@ -1065,8 +1070,8 @@ UINT16 RunAway( SOLDIERTYPE * pSoldier ) { // "Run away! Run away!!!" // This code should figure out which directions are safe for the enemy - // to run in. They shouldn't try to run off in directions which will - // take them into enemy territory. We must presume that they inform each + // to run in. They shouldn't try to run off in directions which will + // take them into enemy territory. We must presume that they inform each // other by radio when sectors are taken by the player! :-) // The second wrinkle would be to look at the directions to known player // mercs and use that to influence the direction in which we run. @@ -1079,24 +1084,24 @@ UINT16 RunAway( SOLDIERTYPE * pSoldier ) INT32 iNewSectorX, iNewSectorY, iNewSector; INT32 iRunX, iRunY, iRunGridNo; SOLDIERTYPE * pOpponent; - + iSector = pSoldier->sSectorX + pSoldier->sSectorY * MAP_WORLD_X; // first start by scanning through opposing mercs and find out what directions are blocked. for (ubLoop = 0,pOpponent = Menptr; ubLoop < MAXMERCS; ubLoop++,pOpponent++) { // if this merc is inactive, at base, on assignment, or dead - if (!pOpponent->bActive || !pOpponent->bInSector || !pOpponent->bLife) + if (!pOpponent->bActive || !pOpponent->bInSector || !pOpponent->stats.bLife) { - continue; // next merc + continue; // next merc } // if this man is neutral / on the same side, he's not an opponent - if (pOpponent->bNeutral || (pSoldier->bSide == pOpponent->bSide)) + if (pOpponent->aiData.bNeutral || (pSoldier->bSide == pOpponent->bSide)) { - continue; // next merc + continue; // next merc } - + // we don't want to run in that direction! bOkayDir[ atan8( pSoldier->sX, pSoldier->sY, pOpponent->sX, pOpponent->sY ) ] = FALSE; } @@ -1138,7 +1143,7 @@ UINT16 RunAway( SOLDIERTYPE * pSoldier ) } } if (ubBestDistToEdge < WORLD_COLS) - { + { switch( ubBestDir ) { case 0: diff --git a/TacticalAI/NPC.cpp b/TacticalAI/NPC.cpp index f83f6cd3..46f20803 100644 --- a/TacticalAI/NPC.cpp +++ b/TacticalAI/NPC.cpp @@ -1,14 +1,14 @@ #ifdef PRECOMPILEDHEADERS #include "AI All.h" #include "interface items.h" - + #else #include "types.h" #include "wcheck.h" #include "overhead.h" #include "ai.h" #include "Soldier Profile.h" - #include "Soldier Control.h" + #include "NPC.h" #include "Isometric Utils.h" #include "Quests.h" @@ -49,6 +49,11 @@ #include "Campaign Types.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + #define NUM_CIVQUOTE_SECTORS 20 #define MINERS_CIV_QUOTE_INDEX 16 @@ -148,13 +153,13 @@ NPCQuoteInfo * LoadQuoteFile( UINT8 ubNPC ) // If we are the queen.... if ( ubNPC == QUEEN ) { - sprintf( zFileName, "NPCData\\%03d.npc", gubAlternateNPCFileNumsForQueenMeanwhiles[ GetMeanwhileID( ) ] ); + sprintf( zFileName, "NPCData\\%03d.npc", gubAlternateNPCFileNumsForQueenMeanwhiles[ GetMeanwhileID( ) ] ); } // If we are elliot.... if ( ubNPC == ELLIOT ) { - sprintf( zFileName, "NPCData\\%03d.npc", gubAlternateNPCFileNumsForElliotMeanwhiles[ GetMeanwhileID( ) ] ); + sprintf( zFileName, "NPCData\\%03d.npc", gubAlternateNPCFileNumsForElliotMeanwhiles[ GetMeanwhileID( ) ] ); } } @@ -174,7 +179,7 @@ NPCQuoteInfo * LoadQuoteFile( UINT8 ubNPC ) pFileData = NULL; } } - + FileClose( hFile ); // check for Russian script & make a runtime conversion of it to International :D // just offset ptr 4 bytes backward @@ -189,7 +194,7 @@ NPCQuoteInfo * LoadQuoteFile( UINT8 ubNPC ) return( pFileData ); } -void RevertToOriginalQuoteFile( UINT8 ubNPC ) +void RevertToOriginalQuoteFile( UINT8 ubNPC ) { if ( gpBackupNPCQuoteInfoArray[ ubNPC ] && gpNPCQuoteInfoArray[ubNPC] ) { @@ -221,7 +226,7 @@ BOOLEAN EnsureQuoteFileLoaded( UINT8 ubNPC ) if ( ubNPC >= FIRST_RPC && ubNPC < FIRST_NPC ) { - if (gMercProfiles[ ubNPC ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED) + if (gMercProfiles[ ubNPC ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED) { // recruited if ( gpBackupNPCQuoteInfoArray[ ubNPC ] == NULL ) @@ -255,7 +260,7 @@ BOOLEAN EnsureQuoteFileLoaded( UINT8 ubNPC ) if ( ubNPC != NO_PROFILE ) { SOLDIERTYPE * pNull = NULL; - pNull->bLife = 0; // crash! + pNull->stats.bLife = 0; // crash! } #else @@ -279,7 +284,7 @@ BOOLEAN EnsureQuoteFileLoaded( UINT8 ubNPC ) { // crash! SOLDIERTYPE * pNull = NULL; - pNull->bLife = 0; + pNull->stats.bLife = 0; } } @@ -401,7 +406,7 @@ NPCQuoteInfo * LoadCivQuoteFile( UINT8 ubIndex ) pFileData = NULL; } } - + FileClose( hFile ); return( pFileData ); @@ -470,7 +475,7 @@ void ShutdownNPCQuotes( void ) MemFree( gpBackupNPCQuoteInfoArray[ ubLoop ] ); gpBackupNPCQuoteInfoArray[ ubLoop ] = NULL; } - + } @@ -589,7 +594,7 @@ UINT8 CalcDesireToTalk( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach ) else { iEffectiveLeadership = ((INT32) pMercProfile->bLeadership) * pMercProfile->usApproachFactor[bApproach - 1] / 100; - iApproachVal = pNPCProfile->ubApproachVal[bApproach - 1] * iEffectiveLeadership / 50; + iApproachVal = pNPCProfile->ubApproachVal[bApproach - 1] * iEffectiveLeadership / 50; } // NB if town attachment is less than 100% then we should make personal value proportionately more important! if ( pNPCProfile->bTownAttachment < 100 ) @@ -613,7 +618,7 @@ UINT8 CalcDesireToTalk( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach ) void ApproachedForFirstTime( MERCPROFILESTRUCT * pNPCProfile, INT8 bApproach ) { - UINT8 ubLoop; + UINT8 ubLoop; UINT32 uiTemp; pNPCProfile->bApproached |= gbFirstApproachFlags[bApproach - 1]; @@ -630,7 +635,7 @@ void ApproachedForFirstTime( MERCPROFILESTRUCT * pNPCProfile, INT8 bApproach ) UINT8 NPCConsiderTalking( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT8 ubRecord, NPCQuoteInfo * pNPCQuoteInfoArray, NPCQuoteInfo ** ppResultQuoteInfo, UINT8 *pubQuoteNum ) { - // This function returns the opinion level required of the "most difficult" quote + // This function returns the opinion level required of the "most difficult" quote // that the NPC is willing to say to the merc. It can also provide the quote #. MERCPROFILESTRUCT * pNPCProfile=NULL; NPCQuoteInfo * pNPCQuoteInfo=NULL; @@ -767,7 +772,7 @@ UINT8 NPCConsiderTalking( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT8 ubRec else { if (ppResultQuoteInfo) - { + { (*ppResultQuoteInfo) = NULL; } if ( pubQuoteNum ) @@ -780,7 +785,7 @@ UINT8 NPCConsiderTalking( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT8 ubRec UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE * pObj, NPCQuoteInfo * pNPCQuoteInfoArray, NPCQuoteInfo ** ppResultQuoteInfo, UINT8 *pubQuoteNum ) { - // This function returns the opinion level required of the "most difficult" quote + // This function returns the opinion level required of the "most difficult" quote // that the NPC is willing to say to the merc. It can also provide the quote #. MERCPROFILESTRUCT * pNPCProfile; NPCQuoteInfo * pNPCQuoteInfo; @@ -832,7 +837,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE * case MONEY: case SILVER: case GOLD: - if (pObj->ItemData.Money.uiMoneyAmount < LARGE_AMOUNT_MONEY) + if ((*pObj)[0]->data.money.uiMoneyAmount < LARGE_AMOUNT_MONEY) { SetFactTrue( FACT_SMALL_AMOUNT_OF_MONEY ); } @@ -845,12 +850,12 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE * case WINE: case BEER: usItemToConsider = ALCOHOL; - break; + break; default: break; } - if (pObj->ItemData.Generic.bStatus[0] < 50) + if ((*pObj)[0]->data.objectStatus < 50) { SetFactTrue( FACT_ITEM_POOR_CONDITION ); } @@ -874,14 +879,14 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE * case DARREN: if (usItemToConsider == MONEY && pNPCQuoteInfo->sActionData == NPC_ACTION_DARREN_GIVEN_CASH) { - if (pObj->ItemData.Money.uiMoneyAmount < 1000) + if ((*pObj)[0]->data.money.uiMoneyAmount < 1000) { // refuse, bet too low - record 15 (*ppResultQuoteInfo) = &pNPCQuoteInfoArray[15]; (*pubQuoteNum) = 15; return( (*ppResultQuoteInfo)->ubOpinionRequired ); } - else if (pObj->ItemData.Money.uiMoneyAmount > 5000) + else if ((*pObj)[0]->data.money.uiMoneyAmount > 5000) { // refuse, bet too high - record 16 (*ppResultQuoteInfo) = &pNPCQuoteInfoArray[16]; @@ -905,7 +910,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE * */ // record amount of bet - gMercProfiles[ DARREN ].iBalance = pObj->ItemData.Money.uiMoneyAmount; + gMercProfiles[ DARREN ].iBalance = (*pObj)[0]->data.money.uiMoneyAmount; SetFactFalse( FACT_DARREN_EXPECTING_MONEY ); // if never fought before, use record 17 @@ -916,7 +921,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE * (*ppResultQuoteInfo) = &pNPCQuoteInfoArray[17]; (*pubQuoteNum) = 17; } - else + else { // find Kingpin, if he's in his house, invoke the script to move him to the bar SOLDIERTYPE * pKingpin; @@ -944,22 +949,22 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE * } } - + return( (*ppResultQuoteInfo)->ubOpinionRequired ); } } break; - case ANGEL: + case ANGEL: if (usItemToConsider == MONEY && pNPCQuoteInfo->sActionData == NPC_ACTION_ANGEL_GIVEN_CASH) { - if (pObj->ItemData.Money.uiMoneyAmount < Item[LEATHER_JACKET_W_KEVLAR].usPrice) + if ((*pObj)[0]->data.money.uiMoneyAmount < Item[LEATHER_JACKET_W_KEVLAR].usPrice) { // refuse, bet too low - record 8 (*ppResultQuoteInfo) = &pNPCQuoteInfoArray[8]; (*pubQuoteNum) = 8; return( (*ppResultQuoteInfo)->ubOpinionRequired ); } - else if (pObj->ItemData.Money.uiMoneyAmount > Item[LEATHER_JACKET_W_KEVLAR].usPrice) + else if ((*pObj)[0]->data.money.uiMoneyAmount > Item[LEATHER_JACKET_W_KEVLAR].usPrice) { // refuse, bet too high - record 9 (*ppResultQuoteInfo) = &pNPCQuoteInfoArray[9]; @@ -983,15 +988,15 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE * // say quote about not catering to women! (*ppResultQuoteInfo) = &pNPCQuoteInfoArray[5]; (*pubQuoteNum) = 5; - return( (*ppResultQuoteInfo)->ubOpinionRequired ); + return( (*ppResultQuoteInfo)->ubOpinionRequired ); } - switch( pObj->ItemData.Money.uiMoneyAmount ) + switch( (*pObj)[0]->data.money.uiMoneyAmount ) { case 100: case 200: // Carla if ( CheckFact( FACT_CARLA_AVAILABLE, 0 ) ) { - gMercProfiles[ MADAME ].bNPCData += (INT8) (pObj->ItemData.Money.uiMoneyAmount / 100); + gMercProfiles[ MADAME ].bNPCData += (INT8) ((*pObj)[0]->data.money.uiMoneyAmount / 100); TriggerNPCRecord( MADAME, 16 ); } else @@ -1006,7 +1011,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE * case 1000: // Cindy if ( CheckFact( FACT_CINDY_AVAILABLE, 0 ) ) { - gMercProfiles[ MADAME ].bNPCData += (INT8) (pObj->ItemData.Money.uiMoneyAmount / 500); + gMercProfiles[ MADAME ].bNPCData += (INT8) ((*pObj)[0]->data.money.uiMoneyAmount / 500); TriggerNPCRecord( MADAME, 17 ); } else @@ -1021,7 +1026,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE * case 600: // Bambi if ( CheckFact( FACT_BAMBI_AVAILABLE, 0 ) ) { - gMercProfiles[ MADAME ].bNPCData += (INT8) (pObj->ItemData.Money.uiMoneyAmount / 300); + gMercProfiles[ MADAME ].bNPCData += (INT8) ((*pObj)[0]->data.money.uiMoneyAmount / 300); TriggerNPCRecord( MADAME, 18 ); } else @@ -1033,10 +1038,10 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE * } break; case 400: - case 800: // Maria? + case 800: // Maria? if ( gubQuest[ QUEST_RESCUE_MARIA ] == QUESTINPROGRESS ) { - gMercProfiles[ MADAME ].bNPCData += (INT8) (pObj->ItemData.Money.uiMoneyAmount / 400); + gMercProfiles[ MADAME ].bNPCData += (INT8) ((*pObj)[0]->data.money.uiMoneyAmount / 400); TriggerNPCRecord( MADAME, 19 ); break; } @@ -1081,8 +1086,8 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE * if ( CheckFact( FACT_VINCE_EXPECTING_MONEY, ubNPC ) == FALSE && gMercProfiles[ ubNPC ].iBalance < 0 && pNPCQuoteInfo->sActionData != NPC_ACTION_DONT_ACCEPT_ITEM ) { // increment balance - gMercProfiles[ ubNPC ].iBalance += (INT32) pObj->ItemData.Money.uiMoneyAmount; - gMercProfiles[ ubNPC ].uiTotalCostToDate += pObj->ItemData.Money.uiMoneyAmount; + gMercProfiles[ ubNPC ].iBalance += (INT32) (*pObj)[0]->data.money.uiMoneyAmount; + gMercProfiles[ ubNPC ].uiTotalCostToDate += (*pObj)[0]->data.money.uiMoneyAmount; if ( gMercProfiles[ ubNPC ].iBalance > 0 ) { gMercProfiles[ ubNPC ].iBalance = 0; @@ -1099,13 +1104,13 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE * else { (*ppResultQuoteInfo) = &pNPCQuoteInfoArray[ 7 ]; - } + } return( (*ppResultQuoteInfo)->ubOpinionRequired ); } else { // handle the player giving NPC some money - HandleNPCBeingGivenMoneyByPlayer( ubNPC, pObj->ItemData.Money.uiMoneyAmount, pubQuoteNum ); + HandleNPCBeingGivenMoneyByPlayer( ubNPC, (*pObj)[0]->data.money.uiMoneyAmount, pubQuoteNum ); (*ppResultQuoteInfo) = &pNPCQuoteInfoArray[ *pubQuoteNum ]; return( (*ppResultQuoteInfo)->ubOpinionRequired ); } @@ -1113,7 +1118,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE * else { // handle the player giving NPC some money - HandleNPCBeingGivenMoneyByPlayer( ubNPC, pObj->ItemData.Money.uiMoneyAmount, pubQuoteNum ); + HandleNPCBeingGivenMoneyByPlayer( ubNPC, (*pObj)[0]->data.money.uiMoneyAmount, pubQuoteNum ); (*ppResultQuoteInfo) = &pNPCQuoteInfoArray[ *pubQuoteNum ]; return( (*ppResultQuoteInfo)->ubOpinionRequired ); } @@ -1122,7 +1127,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE * case KINGPIN: if ( usItemToConsider == MONEY && gubQuest[ QUEST_KINGPIN_MONEY ] == QUESTINPROGRESS ) { - HandleNPCBeingGivenMoneyByPlayer( ubNPC, pObj->ItemData.Money.uiMoneyAmount, pubQuoteNum ); + HandleNPCBeingGivenMoneyByPlayer( ubNPC, (*pObj)[0]->data.money.uiMoneyAmount, pubQuoteNum ); (*ppResultQuoteInfo) = &pNPCQuoteInfoArray[ *pubQuoteNum ]; return( (*ppResultQuoteInfo)->ubOpinionRequired ); } @@ -1133,8 +1138,8 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE * if ( gMercProfiles[ ubNPC ].iBalance < 0 && pNPCQuoteInfo->sActionData != NPC_ACTION_DONT_ACCEPT_ITEM ) { // increment balance - gMercProfiles[ ubNPC ].iBalance += (INT32) pObj->ItemData.Money.uiMoneyAmount; - gMercProfiles[ ubNPC ].uiTotalCostToDate += pObj->ItemData.Money.uiMoneyAmount; + gMercProfiles[ ubNPC ].iBalance += (INT32) (*pObj)[0]->data.money.uiMoneyAmount; + gMercProfiles[ ubNPC ].uiTotalCostToDate += (*pObj)[0]->data.money.uiMoneyAmount; if ( gMercProfiles[ ubNPC ].iBalance > 0 ) { gMercProfiles[ ubNPC ].iBalance = 0; @@ -1168,7 +1173,7 @@ BOOLEAN HandleNPCBeingGivenMoneyByPlayer( UINT8 ubNPC, UINT32 uiMoneyAmount, UIN INT32 iCost; iCost = (INT32) CalcMedicalCost( ubNPC ); - + // check amount of money if ( (INT32)uiMoneyAmount + giHospitalTempBalance + giHospitalRefund >= iCost ) { @@ -1181,7 +1186,7 @@ BOOLEAN HandleNPCBeingGivenMoneyByPlayer( UINT8 ubNPC, UINT32 uiMoneyAmount, UIN { *pQuoteValue = 25; } - + if ( giHospitalRefund > 0 ) { giHospitalRefund = __max( 0, giHospitalRefund - iCost + uiMoneyAmount ); @@ -1196,7 +1201,7 @@ BOOLEAN HandleNPCBeingGivenMoneyByPlayer( UINT8 ubNPC, UINT32 uiMoneyAmount, UIN InsertDollarSignInToString( sTempString ); // not enough cash - ScreenMsg( FONT_MCOLOR_LTYELLOW, + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[ STR_NEED_TO_GIVE_MONEY ], gMercProfiles[ ubNPC ].zNickname, @@ -1206,7 +1211,7 @@ BOOLEAN HandleNPCBeingGivenMoneyByPlayer( UINT8 ubNPC, UINT32 uiMoneyAmount, UIN } } break; - case KINGPIN: + case KINGPIN: if ( (INT32) uiMoneyAmount < -gMercProfiles[ KINGPIN ].iBalance ) { *pQuoteValue = 9; @@ -1275,7 +1280,7 @@ UINT8 NPCConsiderQuote( UINT8 ubNPC, UINT8 ubMerc, UINT8 ubApproach, UINT8 ubQuo { pNPCProfile = &(gMercProfiles[ubNPC]); } - + // How much do we want to talk with this merc? uiDay = GetWorldDay(); @@ -1306,7 +1311,7 @@ UINT8 NPCConsiderQuote( UINT8 ubNPC, UINT8 ubMerc, UINT8 ubApproach, UINT8 ubQuo NpcRecordLogging( ubApproach, "Quest(%d:'%S') Must be in Progress, status is %d. %s", pNPCQuoteInfo->ubQuest, QuestDescText[ pNPCQuoteInfo->ubQuest ], gubQuest[pNPCQuoteInfo->ubQuest], (gubQuest[pNPCQuoteInfo->ubQuest] != QUESTINPROGRESS) ? "False, return" : "True" ); #endif - if (pNPCQuoteInfo->ubQuest > QUEST_DONE_NUM) + if (pNPCQuoteInfo->ubQuest > QUEST_DONE_NUM) { if (gubQuest[pNPCQuoteInfo->ubQuest - QUEST_DONE_NUM] != QUESTDONE) { @@ -1336,7 +1341,7 @@ UINT8 NPCConsiderQuote( UINT8 ubNPC, UINT8 ubMerc, UINT8 ubApproach, UINT8 ubQuo #ifdef JA2TESTVERSION //Add entry to the quest debug file NpcRecordLogging( ubApproach, "Fact (%d:'%S') Must be True, status is %s", pNPCQuoteInfo->usFactMustBeTrue, FactDescText[pNPCQuoteInfo->usFactMustBeTrue], (fTrue == FALSE) ? "False, returning" : "True" ); - #endif + #endif if (fTrue == FALSE) { return( FALSE ); @@ -1353,17 +1358,17 @@ UINT8 NPCConsiderQuote( UINT8 ubNPC, UINT8 ubMerc, UINT8 ubApproach, UINT8 ubQuo //Add entry to the quest debug file NpcRecordLogging( ubApproach, "Fact(%d:'%S') Must be False status is %s", pNPCQuoteInfo->usFactMustBeFalse, FactDescText[pNPCQuoteInfo->usFactMustBeFalse], (fTrue == TRUE) ? "True, return" : "FALSE" ); #endif - + if (fTrue == TRUE) { return( FALSE ); } } - + // check for required approach // since the "I hate you" code triggers the record, triggering has to work properly - // with the other value that is stored! + // with the other value that is stored! if ( pNPCQuoteInfo->ubApproachRequired || !(ubApproach == APPROACH_FRIENDLY || ubApproach == APPROACH_DIRECT || ubApproach == TRIGGER_NPC ) ) { #ifdef JA2TESTVERSION @@ -1526,10 +1531,10 @@ void ResetOncePerConvoRecordsForAllNPCsInLoadedSector( void ) for ( ubLoop = FIRST_RPC; ubLoop < GASTON; ubLoop++ ) { - if ( gMercProfiles[ ubLoop ].sSectorX == gWorldSectorX && - gMercProfiles[ ubLoop ].sSectorY == gWorldSectorY && + if ( gMercProfiles[ ubLoop ].sSectorX == gWorldSectorX && + gMercProfiles[ ubLoop ].sSectorY == gWorldSectorY && gMercProfiles[ ubLoop ].bSectorZ == gbWorldSectorZ && - gpNPCQuoteInfoArray[ ubLoop ] != NULL ) + gpNPCQuoteInfoArray[ ubLoop ] != NULL ) { ResetOncePerConvoRecordsForNPC( ubLoop ); } @@ -1556,7 +1561,7 @@ void ReturnItemToPlayerIfNecessary( UINT8 ubMerc, INT8 bApproach, UINT32 uiAppro { InternalBeginItemPointer( pSoldier, pObj, NO_SLOT ); } - DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); + DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); } } @@ -1597,14 +1602,14 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData } // make sure civ is awake now - pNPC->fAIFlags &= (~AI_ASLEEP); + pNPC->aiData.fAIFlags &= (~AI_ASLEEP); } if (EnsureQuoteFileLoaded( ubNPC ) == FALSE) { // error!!! - if ( fAttemptingToGiveItem ) + if ( fAttemptingToGiveItem ) { ReturnItemToPlayerIfNecessary( ubMerc, bApproach, uiApproachData, NULL ); } @@ -1630,7 +1635,7 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData // turn the NPC to face us // this '1' value is a dummy.... NPCDoAction( ubNPC, NPC_ACTION_TURN_TO_FACE_NEAREST_MERC, 1 ); - + if (pProfile->ubLastDateSpokenTo > 0) { uiDay = GetWorldDay(); @@ -1640,7 +1645,7 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData if (pQuotePtr != NULL) { // converse using this approach instead! - if ( fAttemptingToGiveItem ) + if ( fAttemptingToGiveItem ) { ReturnItemToPlayerIfNecessary( ubMerc, bApproach, uiApproachData, NULL ); } @@ -1653,7 +1658,7 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData else { // say nothing! - if ( fAttemptingToGiveItem ) + if ( fAttemptingToGiveItem ) { ReturnItemToPlayerIfNecessary( ubMerc, bApproach, uiApproachData, NULL ); } @@ -1667,7 +1672,7 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData if (pQuotePtr != NULL) { // converse using this approach instead! - if ( fAttemptingToGiveItem ) + if ( fAttemptingToGiveItem ) { ReturnItemToPlayerIfNecessary( ubMerc, bApproach, uiApproachData, NULL ); } @@ -1679,7 +1684,7 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData if (pQuotePtr != NULL) { // converse using this approach instead! - if ( fAttemptingToGiveItem ) + if ( fAttemptingToGiveItem ) { ReturnItemToPlayerIfNecessary( ubMerc, bApproach, uiApproachData, NULL ); } @@ -1815,7 +1820,7 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData { ubQuoteNum = QUOTE_GETLOST; } - else + else { ubQuoteNum = QUOTE_RECRUIT_NO; pProfile->bRecruitDefaultResponseUsedRecently = TRUE; @@ -1825,7 +1830,7 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData ubQuoteNum = QUOTE_GIVEITEM_NO; /* - CC - now handled below + CC - now handled below */ break; case TRIGGER_NPC: @@ -1884,13 +1889,13 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData if ( pQuotePtr->sActionData <= -NPC_ACTION_TURN_TO_FACE_NEAREST_MERC ) { pSoldier = FindSoldierByProfileID( ubNPC, FALSE ); - ZEROTIMECOUNTER( pSoldier->AICounter ); - if (pSoldier->bNextAction == AI_ACTION_WAIT) + ZEROTIMECOUNTER( pSoldier->timeCounters.AICounter ); + if (pSoldier->aiData.bNextAction == AI_ACTION_WAIT) { - pSoldier->bNextAction = AI_ACTION_NONE; - pSoldier->usNextActionData = 0; + pSoldier->aiData.bNextAction = AI_ACTION_NONE; + pSoldier->aiData.usNextActionData = 0; } - NPCDoAction( ubNPC, (UINT16) -(pQuotePtr->sActionData), ubRecordNum ); + NPCDoAction( ubNPC, (UINT16) -(pQuotePtr->sActionData), ubRecordNum ); } if (pQuotePtr->ubQuoteNum != NO_QUOTE) { @@ -1923,13 +1928,12 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData // Is this one of us? if ( pSoldier->bTeam == gbPlayerNum ) { - INT8 bSlot; - - bSlot = FindExactObj( pSoldier, pObj ); - if (bSlot != NO_SLOT) - { - RemoveObjs( &(pSoldier->inv[bSlot]), pObj->ubNumberOfObjects ); - DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); + for (int x = INV_START_POS; x < NUM_INV_SLOTS; ++x) { + if (&(pSoldier->inv[x]) == pObj) { + DeleteObj(&pSoldier->inv[x]); + DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); + break; + } } } else @@ -2046,29 +2050,29 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData TalkingMenuGiveItem( ubNPC, &(pSoldier->inv[ bInvPos ] ), bInvPos ); } - } + } // Action before movement? if ( pQuotePtr->sActionData < 0 && pQuotePtr->sActionData > -NPC_ACTION_TURN_TO_FACE_NEAREST_MERC ) { pSoldier = FindSoldierByProfileID( ubNPC, FALSE ); - ZEROTIMECOUNTER( pSoldier->AICounter ); - if (pSoldier->bNextAction == AI_ACTION_WAIT) + ZEROTIMECOUNTER( pSoldier->timeCounters.AICounter ); + if (pSoldier->aiData.bNextAction == AI_ACTION_WAIT) { - pSoldier->bNextAction = AI_ACTION_NONE; - pSoldier->usNextActionData = 0; + pSoldier->aiData.bNextAction = AI_ACTION_NONE; + pSoldier->aiData.usNextActionData = 0; } - NPCDoAction( ubNPC, (UINT16) -(pQuotePtr->sActionData), ubRecordNum ); + NPCDoAction( ubNPC, (UINT16) -(pQuotePtr->sActionData), ubRecordNum ); } else if ( pQuotePtr->usGoToGridno == NO_MOVE && pQuotePtr->sActionData > 0 ) { pSoldier = FindSoldierByProfileID( ubNPC, FALSE ); - ZEROTIMECOUNTER( pSoldier->AICounter ); - if (pSoldier->bNextAction == AI_ACTION_WAIT) + ZEROTIMECOUNTER( pSoldier->timeCounters.AICounter ); + if (pSoldier->aiData.bNextAction == AI_ACTION_WAIT) { - pSoldier->bNextAction = AI_ACTION_NONE; - pSoldier->usNextActionData = 0; + pSoldier->aiData.bNextAction = AI_ACTION_NONE; + pSoldier->aiData.usNextActionData = 0; } - NPCDoAction( ubNPC, (UINT16) (pQuotePtr->sActionData), ubRecordNum ); + NPCDoAction( ubNPC, (UINT16) (pQuotePtr->sActionData), ubRecordNum ); } // Movement? @@ -2077,10 +2081,10 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData pSoldier = FindSoldierByProfileID( ubNPC, FALSE ); // stupid hack CC - if (pSoldier && ubNPC == KYLE) + if (pSoldier && ubNPC == KYLE) { // make sure he has keys - pSoldier->bHasKeys = TRUE; + pSoldier->flags.bHasKeys = TRUE; } if (pSoldier && pSoldier->sGridNo == pQuotePtr->usGoToGridno ) { @@ -2091,10 +2095,10 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData else { // turn off cowering - if ( pNPC->uiStatusFlags & SOLDIER_COWERING) + if ( pNPC->flags.uiStatusFlags & SOLDIER_COWERING) { - //pNPC->uiStatusFlags &= ~SOLDIER_COWERING; - EVENT_InitNewSoldierAnim( pNPC, STANDING, 0 , FALSE ); + //pNPC->flags.uiStatusFlags &= ~SOLDIER_COWERING; + pNPC->EVENT_InitNewSoldierAnim( STANDING, 0 , FALSE ); } pSoldier->ubQuoteRecord = ubRecordNum + 1; // add 1 so that the value is guaranteed nonzero @@ -2133,14 +2137,14 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData } } - // Ian says it is okay to take this out! + // Ian says it is okay to take this out! /* if (bApproach == APPROACH_ENEMY_NPC_QUOTE) { NPCClosePanel(); } */ - + } break; } @@ -2165,7 +2169,7 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData } // return item? - if ( fAttemptingToGiveItem ) + if ( fAttemptingToGiveItem ) { ReturnItemToPlayerIfNecessary( ubMerc, bApproach, uiApproachData, pQuotePtr ); } @@ -2210,10 +2214,10 @@ INT16 NPCConsiderInitiatingConv( SOLDIERTYPE * pNPC, UINT8 * pubDesiredMerc ) } // if they're not visible, don't think about it - if (pNPC->bOppList[ubMerc] != SEEN_CURRENTLY) + if (pNPC->aiData.bOppList[ubMerc] != SEEN_CURRENTLY) { continue; - } + } // what's the opinion required for the highest-opinion quote that we would // say to this merc @@ -2255,14 +2259,14 @@ INT16 NPCConsiderInitiatingConv( SOLDIERTYPE * pNPC, UINT8 * pubDesiredMerc ) UINT8 NPCTryToInitiateConv( SOLDIERTYPE * pNPC ) { // assumes current action is ACTION_APPROACH_MERC - if (pNPC->bAction != AI_ACTION_APPROACH_MERC) + if (pNPC->aiData.bAction != AI_ACTION_APPROACH_MERC) { return( AI_ACTION_NONE ); } - if (PythSpacesAway( pNPC->sGridNo, MercPtrs[pNPC->usActionData]->sGridNo ) < CONVO_DIST) + if (PythSpacesAway( pNPC->sGridNo, MercPtrs[pNPC->aiData.usActionData]->sGridNo ) < CONVO_DIST) { // initiate conversation! - Converse( pNPC->ubProfile, MercPtrs[pNPC->usActionData]->ubProfile, NPC_INITIATING_CONV, 0 ); + Converse( pNPC->ubProfile, MercPtrs[pNPC->aiData.usActionData]->ubProfile, NPC_INITIATING_CONV, 0 ); // after talking, wait a while before moving anywhere else return( AI_ACTION_WAIT ); } @@ -2327,9 +2331,9 @@ void NPCReachedDestination( SOLDIERTYPE * pNPC, BOOLEAN fAlreadyThere ) if (pNPC->bTeam == gbPlayerNum) { // the "under ai control" flag was set temporarily; better turn it off now - pNPC->uiStatusFlags &= (~SOLDIER_PCUNDERAICONTROL); + pNPC->flags.uiStatusFlags &= (~SOLDIER_PCUNDERAICONTROL); // make damn sure the AI_HANDLE_EVERY_FRAME flag is turned off - pNPC->fAIFlags &= (AI_HANDLE_EVERY_FRAME); + pNPC->aiData.fAIFlags &= (AI_HANDLE_EVERY_FRAME); } ubNPC = pNPC->ubProfile; @@ -2351,7 +2355,7 @@ void NPCReachedDestination( SOLDIERTYPE * pNPC, BOOLEAN fAlreadyThere ) if ( pQuotePtr->sActionData > 0) { NPCDoAction( ubNPC, (UINT16) pQuotePtr->sActionData, ubQuoteRecord ); - } + } } for ( ubLoop = 0; ubLoop < NUM_NPC_QUOTE_RECORDS; ubLoop++ ) @@ -2363,12 +2367,12 @@ void NPCReachedDestination( SOLDIERTYPE * pNPC, BOOLEAN fAlreadyThere ) { if (fAlreadyThere) { - TriggerNPCRecord( ubNPC, ubLoop ); + TriggerNPCRecord( ubNPC, ubLoop ); } else { // trigger this quote - TriggerNPCRecordImmediately( ubNPC, ubLoop ); + TriggerNPCRecordImmediately( ubNPC, ubLoop ); } return; } @@ -2409,12 +2413,12 @@ void TriggerNPCRecordImmediately( UINT8 ubTriggerNPC, UINT8 ubTriggerNPCRec ) // Check if we have a quote to trigger... NPCQuoteInfo *pQuotePtr; BOOLEAN fDisplayDialogue = TRUE; - + if (EnsureQuoteFileLoaded( ubTriggerNPC ) == FALSE) { // error!!! return; - } + } pQuotePtr = &(gpNPCQuoteInfoArray[ ubTriggerNPC ][ ubTriggerNPCRec ]); if ( pQuotePtr->ubQuoteNum == IRRELEVANT ) { @@ -2447,7 +2451,7 @@ void PCsNearNPC( UINT8 ubNPC ) { // error!!! return; - } + } pNPCQuoteInfoArray = gpNPCQuoteInfoArray[ubNPC]; // see what this triggers... @@ -2487,7 +2491,7 @@ BOOLEAN PCDoesFirstAidOnNPC( UINT8 ubNPC ) { // error!!! return( FALSE ); - } + } pNPCQuoteInfoArray = gpNPCQuoteInfoArray[ubNPC]; // Get ptr to NPC @@ -2523,19 +2527,19 @@ void TriggerClosestMercWhoCanSeeNPC( UINT8 ubNPC, NPCQuoteInfo *pQuotePtr ) SOLDIERTYPE *pTeamSoldier, *pSoldier; INT32 cnt; - // First get pointer to NPC + // First get pointer to NPC pSoldier = FindSoldierByProfileID( ubNPC, FALSE ); // Loop through all our guys and randomly say one from someone in our sector // set up soldier ptr as first element in mercptrs list - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) { // Add guy if he's a candidate... - if ( OK_INSECTOR_MERC( pTeamSoldier ) && pTeamSoldier->bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY ) + if ( OK_INSECTOR_MERC( pTeamSoldier ) && pTeamSoldier->aiData.bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY ) { ubMercsInSector[ ubNumMercs ] = (UINT8)cnt; ubNumMercs++; @@ -2576,7 +2580,7 @@ BOOLEAN TriggerNPCWithIHateYouQuote( UINT8 ubTriggerNPC ) // error!!! return( FALSE ); } - + pNPCQuoteInfoArray = gpNPCQuoteInfoArray[ubTriggerNPC]; for ( ubLoop = 0; ubLoop < NUM_NPC_QUOTE_RECORDS; ubLoop++ ) @@ -2608,7 +2612,7 @@ BOOLEAN NPCHasUnusedRecordWithGivenApproach( UINT8 ubNPC, UINT8 ubApproach ) // error!!! return( FALSE ); } - + pNPCQuoteInfoArray = gpNPCQuoteInfoArray[ubNPC]; for ( ubLoop = 0; ubLoop < NUM_NPC_QUOTE_RECORDS; ubLoop++ ) @@ -2636,7 +2640,7 @@ BOOLEAN NPCHasUnusedHostileRecord( UINT8 ubNPC, UINT8 ubApproach ) // error!!! return( FALSE ); } - + pNPCQuoteInfoArray = gpNPCQuoteInfoArray[ubNPC]; for ( ubLoop = 0; ubLoop < NUM_NPC_QUOTE_RECORDS; ubLoop++ ) @@ -2673,7 +2677,7 @@ BOOLEAN NPCWillingToAcceptItem( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE * pObj ) // error!!! return( FALSE ); } - + pNPCQuoteInfoArray = gpNPCQuoteInfoArray[ubNPC]; ubOpinion = NPCConsiderReceivingItemFromMerc( ubNPC, ubMerc, pObj, pNPCQuoteInfoArray, &pQuotePtr, &ubQuoteNum ); @@ -2699,7 +2703,7 @@ BOOLEAN GetInfoForAbandoningEPC( UINT8 ubNPC, UINT16 * pusQuoteNum, UINT16 * pus // error!!! return( FALSE ); } - + pNPCQuoteInfoArray = gpNPCQuoteInfoArray[ubNPC]; for ( ubLoop = 0; ubLoop < NUM_NPC_QUOTE_RECORDS; ubLoop++ ) @@ -2728,7 +2732,7 @@ BOOLEAN TriggerNPCWithGivenApproach( UINT8 ubTriggerNPC, UINT8 ubApproach, BOOLE // error!!! return( FALSE ); } - + pNPCQuoteInfoArray = gpNPCQuoteInfoArray[ubTriggerNPC]; for ( ubLoop = 0; ubLoop < NUM_NPC_QUOTE_RECORDS; ubLoop++ ) @@ -2768,7 +2772,7 @@ BOOLEAN SaveNPCInfoToSaveGameFile( HWFILE hFile ) //Loop through all the NPC quotes for( cnt=0; cnt= 44 ) uiNumberToLoad = NUM_PROFILES; else @@ -2863,7 +2867,7 @@ BOOLEAN LoadNPCInfoFromSavedGameFile( HWFILE hFile, UINT32 uiSaveGameVersion ) gpNPCQuoteInfoArray[ cnt ] = NULL; } - //if there is a npc quote + //if there is a npc quote if( ubLoadQuote ) { //if there is no memory allocated @@ -3011,7 +3015,7 @@ BOOLEAN SaveBackupNPCInfoToSaveGameFile( HWFILE hFile ) //Loop through all the NPC quotes for( cnt=0; cntbActive && pSoldier->bInSector && pTeamSoldier->bLife >= OKLIFE && pTeamSoldier->bBreath >= OKBREATH && pTeamSoldier->bOppCnt > 0 && pTeamSoldier->ubProfile != NO_PROFILE ) + if ( pTeamSoldier->bActive && pSoldier->bInSector && pTeamSoldier->stats.bLife >= OKLIFE && pTeamSoldier->bBreath >= OKBREATH && pTeamSoldier->aiData.bOppCnt > 0 && pTeamSoldier->ubProfile != NO_PROFILE ) { if ( bTeam == CIV_TEAM && pSoldier->ubCivilianGroup != NON_CIV_GROUP && pTeamSoldier->ubCivilianGroup != pSoldier->ubCivilianGroup ) { continue; } - + if ( ! ( gMercProfiles[ pTeamSoldier->ubProfile ].ubMiscFlags & PROFILE_MISC_FLAG_SAID_HOSTILE_QUOTE ) ) { ubMercsAvailable[ ubNumMercsAvailable ] = pTeamSoldier->ubProfile; @@ -3144,7 +3148,7 @@ void TriggerFriendWithHostileQuote( UINT8 ubNPC ) { CivilianGroupMemberChangesSides( pSoldier ); } - + if (ubNumMercsAvailable > 0) { PauseAITemporarily(); @@ -3171,7 +3175,7 @@ UINT8 ActionIDForMovementRecord( UINT8 ubNPC, UINT8 ubRecord ) // error!!! return( FALSE ); } - + pNPCQuoteInfoArray = gpNPCQuoteInfoArray[ ubNPC ]; pQuotePtr = &( pNPCQuoteInfoArray[ ubRecord ] ); @@ -3198,7 +3202,7 @@ UINT8 ActionIDForMovementRecord( UINT8 ubNPC, UINT8 ubRecord ) void HandleNPCChangesForTacticalTraversal( SOLDIERTYPE * pSoldier ) { - if ( !pSoldier || pSoldier->ubProfile == NO_PROFILE || (pSoldier->fAIFlags & AI_CHECK_SCHEDULE) ) + if ( !pSoldier || pSoldier->ubProfile == NO_PROFILE || (pSoldier->aiData.fAIFlags & AI_CHECK_SCHEDULE) ) { return; } @@ -3209,7 +3213,7 @@ void HandleNPCChangesForTacticalTraversal( SOLDIERTYPE * pSoldier ) gMercProfiles[pSoldier->ubProfile].sSectorX++; // Call to change the NPC's Sector Location - ChangeNpcToDifferentSector( pSoldier->ubProfile, + ChangeNpcToDifferentSector( pSoldier->ubProfile, gMercProfiles[pSoldier->ubProfile].sSectorX, gMercProfiles[pSoldier->ubProfile].sSectorY, gMercProfiles[pSoldier->ubProfile].bSectorZ ); @@ -3218,7 +3222,7 @@ void HandleNPCChangesForTacticalTraversal( SOLDIERTYPE * pSoldier ) gMercProfiles[pSoldier->ubProfile].sSectorY++; // Call to change the NPC's Sector Location - ChangeNpcToDifferentSector( pSoldier->ubProfile, + ChangeNpcToDifferentSector( pSoldier->ubProfile, gMercProfiles[pSoldier->ubProfile].sSectorX, gMercProfiles[pSoldier->ubProfile].sSectorY, gMercProfiles[pSoldier->ubProfile].bSectorZ ); @@ -3227,7 +3231,7 @@ void HandleNPCChangesForTacticalTraversal( SOLDIERTYPE * pSoldier ) gMercProfiles[pSoldier->ubProfile].sSectorX--; // Call to change the NPC's Sector Location - ChangeNpcToDifferentSector( pSoldier->ubProfile, + ChangeNpcToDifferentSector( pSoldier->ubProfile, gMercProfiles[pSoldier->ubProfile].sSectorX, gMercProfiles[pSoldier->ubProfile].sSectorY, gMercProfiles[pSoldier->ubProfile].bSectorZ ); @@ -3236,7 +3240,7 @@ void HandleNPCChangesForTacticalTraversal( SOLDIERTYPE * pSoldier ) gMercProfiles[pSoldier->ubProfile].sSectorY--; // Call to change the NPC's Sector Location - ChangeNpcToDifferentSector( pSoldier->ubProfile, + ChangeNpcToDifferentSector( pSoldier->ubProfile, gMercProfiles[pSoldier->ubProfile].sSectorX, gMercProfiles[pSoldier->ubProfile].sSectorY, gMercProfiles[pSoldier->ubProfile].bSectorZ ); @@ -3328,7 +3332,7 @@ void ToggleNPCRecordDisplay( void ) void UpdateDarrelScriptToGoTo( SOLDIERTYPE * pSoldier ) { - // change destination in Darrel record 10 to go to a gridno adjacent to the + // change destination in Darrel record 10 to go to a gridno adjacent to the // soldier's gridno, and destination in record 11 INT16 sAdjustedGridNo; UINT8 ubDummyDirection; @@ -3352,7 +3356,7 @@ void UpdateDarrelScriptToGoTo( SOLDIERTYPE * pSoldier ) return; } } - + EnsureQuoteFileLoaded( DARREL ); gpNPCQuoteInfoArray[ DARREL ][ 10 ].usGoToGridno = sAdjustedGridNo; gpNPCQuoteInfoArray[ DARREL ][ 11 ].sRequiredGridno = -(sAdjustedGridNo); @@ -3415,7 +3419,7 @@ INT8 ConsiderCivilianQuotes( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, BOO // error!!! return( -1 ); } - + pCivQuoteInfoArray = gpCivQuoteInfoArray[ bCivQuoteSectorIndex ]; for ( bLoop = 0; bLoop < NUM_NPC_QUOTE_RECORDS; bLoop++ ) diff --git a/TacticalAI/NPC.h b/TacticalAI/NPC.h index 15f4aaca..90a512b6 100644 --- a/TacticalAI/NPC.h +++ b/TacticalAI/NPC.h @@ -24,7 +24,7 @@ #define NPC_TALK_RADIUS 4 #define TURN_UI_OFF 65000 -#define TURN_UI_ON 65001 +#define TURN_UI_ON 65001 #define SPECIAL_TURN_UI_OFF 65002 #define SPECIAL_TURN_UI_ON 65003 @@ -54,18 +54,18 @@ typedef struct UINT8 ubFirstDay; // first day quote can be said UINT8 ubLastDay; // last day quote can be said UINT8 ubApproachRequired; // must use this approach to generate quote - UINT8 ubOpinionRequired; // opinion needed for this quote 13 bytes + UINT8 ubOpinionRequired; // opinion needed for this quote 13 bytes // quote to say (if any) UINT8 ubQuoteNum; // this is the quote to say - UINT8 ubNumQuotes; // total # of quotes to say 15 bytes + UINT8 ubNumQuotes; // total # of quotes to say 15 bytes // actions UINT8 ubStartQuest; UINT8 ubEndQuest; UINT8 ubTriggerNPC; UINT8 ubTriggerNPCRec; - UINT8 ubFiller; // 20 bytes + UINT8 ubFiller; // 20 bytes UINT16 usSetFactTrue; UINT16 usGiftItem; // item NPC gives to merc after saying quote UINT16 usGoToGridno; @@ -203,7 +203,7 @@ BOOLEAN GetInfoForAbandoningEPC( UINT8 ubNPC, UINT16 * pusQuoteNum, UINT16 * pus BOOLEAN RecordHasDialogue( UINT8 ubNPC, UINT8 ubRecord ); -INT8 ConsiderCivilianQuotes( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, BOOLEAN fSetAsUsed ); +INT8 ConsiderCivilianQuotes( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, BOOLEAN fSetAsUsed ); void ResetOncePerConvoRecordsForNPC( UINT8 ubNPC ); diff --git a/TacticalAI/PanicButtons.cpp b/TacticalAI/PanicButtons.cpp index 3a27277f..0c64e3c6 100644 --- a/TacticalAI/PanicButtons.cpp +++ b/TacticalAI/PanicButtons.cpp @@ -50,15 +50,15 @@ void MakeClosestEnemyChosenOne() } // if this merc is unconscious, or dead - if (pSoldier->bLife < OKLIFE) + if (pSoldier->stats.bLife < OKLIFE) { - continue; // next soldier + continue; // next soldier } // if this guy's too tired to go if (pSoldier->bBreath < OKBREATH) { - continue; // next soldier + continue; // next soldier } if ( gWorldSectorX == TIXA_SECTOR_X && gWorldSectorY == TIXA_SECTOR_Y ) @@ -78,21 +78,21 @@ void MakeClosestEnemyChosenOne() } // if this guy is in battle with opponent(s) - if (pSoldier->bOppCnt > 0) + if (pSoldier->aiData.bOppCnt > 0) { - continue; // next soldier + continue; // next soldier } // if this guy is still in serious shock - if (pSoldier->bShock > 2) + if (pSoldier->aiData.bShock > 2) { - continue; // next soldier + continue; // next soldier } - if ( pSoldier->bLevel != 0 ) + if ( pSoldier->pathing.bLevel != 0 ) { // screw having guys on the roof go for panic triggers! - continue; // next soldier + continue; // next soldier } bPanicTrigger = ClosestPanicTrigger( pSoldier ); @@ -109,27 +109,27 @@ void MakeClosestEnemyChosenOne() } // remember whether this guy had keys before - //bOldKeys = pSoldier->bHasKeys; + //bOldKeys = pSoldier->flags.bHasKeys; // give him keys to see if with them he can get to the panic trigger - pSoldier->bHasKeys = (pSoldier->bHasKeys << 1) | 1; + pSoldier->flags.bHasKeys = (pSoldier->flags.bHasKeys << 1) | 1; // we now path directly to the panic trigger - + // if he can't get to a spot where he could get at the panic trigger /* if ( FindAdjacentGridEx( pSoldier, gTacticalStatus.sPanicTriggerGridno, &ubDirection, &sAdjSpot, FALSE, FALSE ) == -1 ) { - pSoldier->bHasKeys = bOldKeys; - continue; // next merc + pSoldier->flags.bHasKeys = bOldKeys; + continue; // next merc } */ // ok, this enemy appears to be eligible - // FindAdjacentGrid set HandGrid for us. If we aren't at that spot already + // FindAdjacentGrid set HandGrid for us. If we aren't at that spot already if (pSoldier->sGridNo != sPanicTriggerGridNo) { // get the AP cost for this enemy to go to target position @@ -141,7 +141,7 @@ void MakeClosestEnemyChosenOne() } // set his keys value back to what it was before this hack - pSoldier->bHasKeys = (pSoldier->bHasKeys >> 1 ); + pSoldier->flags.bHasKeys = (pSoldier->flags.bHasKeys >> 1 ); // if he can get there (or is already there!) if (sPathCost || (pSoldier->sGridNo == sPanicTriggerGridNo)) @@ -159,21 +159,21 @@ void MakeClosestEnemyChosenOne() // if we found have an eligible enemy, make him our "chosen one" if (ubClosestEnemy < TOTAL_SOLDIERS) { - gTacticalStatus.ubTheChosenOne = ubClosestEnemy; // flag him as the chosen one + gTacticalStatus.ubTheChosenOne = ubClosestEnemy; // flag him as the chosen one #ifdef TESTVERSION NumMessage("TEST MSG: The chosen one is ",TheChosenOne); #endif pSoldier = MercPtrs[gTacticalStatus.ubTheChosenOne]; - if ( pSoldier->bAlertStatus < STATUS_RED ) + if ( pSoldier->aiData.bAlertStatus < STATUS_RED ) { - pSoldier->bAlertStatus = STATUS_RED; + pSoldier->aiData.bAlertStatus = STATUS_RED; CheckForChangingOrders( pSoldier ); } - SetNewSituation( pSoldier ); // set new situation for the chosen one - pSoldier->bHasKeys = (pSoldier->bHasKeys << 1) | 1; // cheat and give him keys to every door - //pSoldier->bHasKeys = TRUE; + SetNewSituation( pSoldier ); // set new situation for the chosen one + pSoldier->flags.bHasKeys = (pSoldier->flags.bHasKeys << 1) | 1; // cheat and give him keys to every door + //pSoldier->flags.bHasKeys = TRUE; } #ifdef TESTVERSION else @@ -194,7 +194,7 @@ void PossiblyMakeThisEnemyChosenOne( SOLDIERTYPE * pSoldier ) return; } - if ( pSoldier->bLevel != 0 ) + if ( pSoldier->pathing.bLevel != 0 ) { // screw having guys on the roof go for panic triggers! return; @@ -216,8 +216,8 @@ void PossiblyMakeThisEnemyChosenOne( SOLDIERTYPE * pSoldier ) return; } - //bOldKeys = pSoldier->bHasKeys; - pSoldier->bHasKeys = (pSoldier->bHasKeys << 1) | 1; + //bOldKeys = pSoldier->flags.bHasKeys; + pSoldier->flags.bHasKeys = (pSoldier->flags.bHasKeys << 1) | 1; // if he can't get to a spot where he could get at the panic trigger iAPCost = AP_PULL_TRIGGER; @@ -226,23 +226,23 @@ void PossiblyMakeThisEnemyChosenOne( SOLDIERTYPE * pSoldier ) iPathCost = PlotPath( pSoldier, sPanicTriggerGridNo, FALSE, FALSE, FALSE, RUNNING, FALSE, FALSE, 0); if (iPathCost == 0) { - //pSoldier->bHasKeys = bOldKeys; - pSoldier->bHasKeys = (pSoldier->bHasKeys >> 1); + //pSoldier->flags.bHasKeys = bOldKeys; + pSoldier->flags.bHasKeys = (pSoldier->flags.bHasKeys >> 1); return; } iAPCost += iPathCost; } - if ( iAPCost <= CalcActionPoints( pSoldier ) * 2) + if ( iAPCost <= pSoldier->CalcActionPoints( ) * 2) { // go!!! gTacticalStatus.ubTheChosenOne = pSoldier->ubID; return; } // else return keys to normal - //pSoldier->bHasKeys = bOldKeys; - pSoldier->bHasKeys = (pSoldier->bHasKeys >> 1); + //pSoldier->flags.bHasKeys = bOldKeys; + pSoldier->flags.bHasKeys = (pSoldier->flags.bHasKeys >> 1); } @@ -278,9 +278,9 @@ INT8 PanicAI(SOLDIERTYPE *pSoldier, UINT8 ubCanMove) // blow up all the PANIC bombs! return(AI_ACTION_USE_DETONATOR); } - else // otherwise, wait a turn + else // otherwise, wait a turn { - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return(AI_ACTION_NONE); } } @@ -305,12 +305,12 @@ INT8 PanicAI(SOLDIERTYPE *pSoldier, UINT8 ubCanMove) // if not standing on the panic trigger if (pSoldier->sGridNo != sPanicTriggerGridNo) { - // determine whether we can still get there + // determine whether we can still get there iPathCost = PlotPath( pSoldier, sPanicTriggerGridNo, FALSE, FALSE, FALSE, RUNNING, FALSE, FALSE, 0); if (iPathCost != 0) { fFoundRoute = TRUE; - } + } } else { @@ -324,15 +324,15 @@ INT8 PanicAI(SOLDIERTYPE *pSoldier, UINT8 ubCanMove) /* *** COMMENTED OUT BECAUSE WE DON'T HAVE SUPPORT ROUTINES YET - // make sure it's not in water (those triggers can't be pulled) - if (Water(Terrain(gTacticalStatus.sHandGrid),Structure(gTacticalStatus.sHandGrid))) + // make sure it's not in water (those triggers can't be pulled) + if (Water(Terrain(gTacticalStatus.sHandGrid),Structure(gTacticalStatus.sHandGrid))) { #ifdef BETAVERSION - PopMessage("BAD SCENARIO DESIGN: Enemies can't use this panic trigger!"); + PopMessage("BAD SCENARIO DESIGN: Enemies can't use this panic trigger!"); #endif - gTacticalStatus.ubTheChosenOne = NOBODY; // strip him of his Chosen One status - // don't bother replacing him either, the next won't have more luck! - return(-1); + gTacticalStatus.ubTheChosenOne = NOBODY; // strip him of his Chosen One status + // don't bother replacing him either, the next won't have more luck! + return(-1); } */ @@ -347,23 +347,23 @@ INT8 PanicAI(SOLDIERTYPE *pSoldier, UINT8 ubCanMove) if (pSoldier->bActionPoints >= AP_PULL_TRIGGER) { // blow up the all the PANIC bombs (or just the journal) - pSoldier->usActionData = sPanicTriggerGridNo; + pSoldier->aiData.usActionData = sPanicTriggerGridNo; #ifdef TESTVERSION sprintf(tempstr,"TEST MSG: %s - PULLS PANIC TRIGGER at grid %d", - pSoldier->name,pSoldier->usActionData); + pSoldier->name,pSoldier->aiData.usActionData); PopMessage(tempstr); #endif return(AI_ACTION_PULL_TRIGGER); } - else // otherwise, wait a turn + else // otherwise, wait a turn { - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return(AI_ACTION_NONE); } } - else // we are NOT at the HandGrid spot + else // we are NOT at the HandGrid spot { // if we can move at least 1 square's worth if (ubCanMove) @@ -372,39 +372,39 @@ INT8 PanicAI(SOLDIERTYPE *pSoldier, UINT8 ubCanMove) // animations don't allow trigger-pulling from water, so we won't! if (LegalNPCDestination(pSoldier,sPanicTriggerGridNo,ENSURE_PATH,NOWATER,0)) { - pSoldier->usActionData = sPanicTriggerGridNo; - pSoldier->bPathStored = TRUE; + pSoldier->aiData.usActionData = sPanicTriggerGridNo; + pSoldier->pathing.bPathStored = TRUE; #ifdef DEBUGDECISIONS - sprintf(tempstr,"%s - GETTING CLOSER to PANIC TRIGGER at grid %d (Trigger at %d)", pSoldier->name,pSoldier->usActionData,sPanicTriggerGridNo); + sprintf(tempstr,"%s - GETTING CLOSER to PANIC TRIGGER at grid %d (Trigger at %d)", pSoldier->name,pSoldier->aiData.usActionData,sPanicTriggerGridNo); AIPopMessage(tempstr); #endif return(AI_ACTION_GET_CLOSER); } - else // Oh oh, the chosen one can't get to the trigger! + else // Oh oh, the chosen one can't get to the trigger! { #ifdef TESTVERSION - PopMessage("TEST MSG: Oh oh! !legalDest - ChosenOne can't get to the trigger!"); + PopMessage("TEST MSG: Oh oh! !legalDest - ChosenOne can't get to the trigger!"); #endif - gTacticalStatus.ubTheChosenOne = NOBODY; // strip him of his Chosen One status - MakeClosestEnemyChosenOne(); // and replace him! + gTacticalStatus.ubTheChosenOne = NOBODY; // strip him of his Chosen One status + MakeClosestEnemyChosenOne(); // and replace him! } } - else // can't move, wait 1 turn + else // can't move, wait 1 turn { - pSoldier->usActionData = NOWHERE; + pSoldier->aiData.usActionData = NOWHERE; return(AI_ACTION_NONE); } } } - else // Oh oh, the chosen one can't get to the trigger! + else // Oh oh, the chosen one can't get to the trigger! { #ifdef TESTVERSION - PopMessage("TEST MSG: Oh oh! !adjacentFound - ChosenOne can't get to the trigger!"); + PopMessage("TEST MSG: Oh oh! !adjacentFound - ChosenOne can't get to the trigger!"); #endif gTacticalStatus.ubTheChosenOne = NOBODY; // strip him of his Chosen One status - MakeClosestEnemyChosenOne(); // and replace him! + MakeClosestEnemyChosenOne(); // and replace him! } } } @@ -428,13 +428,13 @@ INT8 ClosestPanicTrigger( SOLDIERTYPE * pSoldier ) INT8 bClosestTrigger = -1; UINT32 uiPercentEnemiesKilled; - uiPercentEnemiesKilled = (UINT32)( 100 * (UINT32)(gTacticalStatus.ubArmyGuysKilled) / (UINT32)( gTacticalStatus.Team[ ENEMY_TEAM ].bMenInSector + gTacticalStatus.ubArmyGuysKilled ) ); + uiPercentEnemiesKilled = (UINT32)( 100 * (UINT32)(gTacticalStatus.ubArmyGuysKilled) / (UINT32)( gTacticalStatus.Team[ ENEMY_TEAM ].bMenInSector + gTacticalStatus.ubArmyGuysKilled ) ); for ( bLoop = 0; bLoop < NUM_PANIC_TRIGGERS; bLoop++ ) { if ( gTacticalStatus.sPanicTriggerGridNo[ bLoop ] != NOWHERE ) { - + if ( gTacticalStatus.ubPanicTolerance[ bLoop ] > uiPercentEnemiesKilled ) { // not yet... not yet... @@ -496,7 +496,7 @@ BOOLEAN NeedToRadioAboutPanicTrigger( void ) } - uiPercentEnemiesKilled = (UINT32)( 100 * (UINT32)(gTacticalStatus.ubArmyGuysKilled) / (UINT32)( gTacticalStatus.Team[ ENEMY_TEAM ].bMenInSector + gTacticalStatus.ubArmyGuysKilled ) ); + uiPercentEnemiesKilled = (UINT32)( 100 * (UINT32)(gTacticalStatus.ubArmyGuysKilled) / (UINT32)( gTacticalStatus.Team[ ENEMY_TEAM ].bMenInSector + gTacticalStatus.ubArmyGuysKilled ) ); for ( bLoop = 0; bLoop < NUM_PANIC_TRIGGERS; bLoop++ ) { @@ -517,7 +517,7 @@ BOOLEAN NeedToRadioAboutPanicTrigger( void ) INT8 HeadForTheStairCase( SOLDIERTYPE * pSoldier ) { UNDERGROUND_SECTORINFO * pBasementInfo; - + pBasementInfo = FindUnderGroundSector( 3, MAP_ROW_P, 1 ); if ( pBasementInfo && pBasementInfo->uiTimeCurrentSectorWasLastLoaded != 0 && ( pBasementInfo->ubNumElites + pBasementInfo->ubNumTroops + pBasementInfo->ubNumAdmins ) < 5 ) { @@ -532,7 +532,7 @@ INT8 HeadForTheStairCase( SOLDIERTYPE * pSoldier ) { if ( LegalNPCDestination( pSoldier, STAIRCASE_GRIDNO, ENSURE_PATH, WATEROK, 0 ) ) { - pSoldier->usActionData = STAIRCASE_GRIDNO; + pSoldier->aiData.usActionData = STAIRCASE_GRIDNO; return( AI_ACTION_GET_CLOSER ); } } diff --git a/TacticalAI/QuestDebug.cpp b/TacticalAI/QuestDebug.cpp index 0b5fed30..82ce571b 100644 --- a/TacticalAI/QuestDebug.cpp +++ b/TacticalAI/QuestDebug.cpp @@ -91,15 +91,15 @@ void QuestDebugFileMsg( UINT8 ubQuoteType, UINT8 ubPriority, STR pStringA, ...) static UINT32 uiLineNumber = 1; HWFILE hFile; UINT32 uiByteWritten; - va_list argptr; - char TempString[1024]; - char DestString[1024]; + va_list argptr; + char TempString[1024]; + char DestString[1024]; TempString[0] = '\0'; DestString[0] = '\0'; - va_start(argptr, pStringA); // Set up variable argument pointer + va_start(argptr, pStringA); // Set up variable argument pointer vsprintf(TempString, pStringA, argptr); // process gprintf string (get output str) va_end(argptr); diff --git a/TacticalAI/Realtime.cpp b/TacticalAI/Realtime.cpp index b8edbc25..962b1282 100644 --- a/TacticalAI/Realtime.cpp +++ b/TacticalAI/Realtime.cpp @@ -34,7 +34,7 @@ INT8 RTPlayerDecideAction( SOLDIERTYPE * pSoldier ) #ifdef DEBUGDECISIONS STR tempstr; - sprintf(tempstr,"DecideAction: selected action %d, actionData %d\n\n",bAction,pSoldier->usActionData); + sprintf(tempstr,"DecideAction: selected action %d, actionData %d\n\n",bAction,pSoldier->aiData.usActionData); DebugAI( tempstr ); #endif @@ -64,7 +64,7 @@ INT8 RTDecideAction(SOLDIERTYPE *pSoldier) gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags3 &= (~PROFILE_MISC_FLAG3_HANDLE_DONE_TRAVERSAL); pSoldier->ubQuoteActionID = 0; // wait a tiny bit - pSoldier->usActionData = 100; + pSoldier->aiData.usActionData = 100; return( AI_ACTION_WAIT ); } @@ -74,17 +74,17 @@ INT8 RTDecideAction(SOLDIERTYPE *pSoldier) UINT16 RealtimeDelay( SOLDIERTYPE * pSoldier ) { - if ( PTR_CIV_OR_MILITIA && !(pSoldier->ubCivilianGroup == KINGPIN_CIV_GROUP ) ) + if ( PTR_CIV_OR_MILITIA && !(pSoldier->ubCivilianGroup == KINGPIN_CIV_GROUP ) ) { return( (UINT16) REALTIME_CIV_AI_DELAY ); } - else if ( CREATURE_OR_BLOODCAT( pSoldier ) && !( pSoldier->bHunting ) ) + else if ( CREATURE_OR_BLOODCAT( pSoldier ) && !( pSoldier->aiData.bHunting ) ) { return( (UINT16) REALTIME_CREATURE_AI_DELAY ); } else { - + if ( pSoldier->ubCivilianGroup == KINGPIN_CIV_GROUP ) { UINT8 ubRoom; @@ -107,8 +107,8 @@ void RTHandleAI( SOLDIERTYPE * pSoldier ) INT32 iLoop; #endif - if ((pSoldier->bAction != AI_ACTION_NONE) && pSoldier->bActionInProgress) - { + if ((pSoldier->aiData.bAction != AI_ACTION_NONE) && pSoldier->aiData.bActionInProgress) + { // if action should remain in progress if (ActionInProgress(pSoldier)) { @@ -117,16 +117,16 @@ void RTHandleAI( SOLDIERTYPE * pSoldier ) #endif // let it continue return; - } + } } // if man has nothing to do - if (pSoldier->bAction == AI_ACTION_NONE) + if (pSoldier->aiData.bAction == AI_ACTION_NONE) { - if (pSoldier->bNextAction == AI_ACTION_NONE) + if (pSoldier->aiData.bNextAction == AI_ACTION_NONE) { // make sure this flag is turned off (it already should be!) - pSoldier->bActionInProgress = FALSE; + pSoldier->aiData.bActionInProgress = FALSE; // truly nothing to do! RefreshAI( pSoldier ); @@ -147,123 +147,123 @@ void RTHandleAI( SOLDIERTYPE * pSoldier ) // The only reason we would NEED to reinitialize it here is if I've // incorrectly set pathStored to TRUE in a process that doesn't end up // calling NewDest() - pSoldier->bPathStored = FALSE; + pSoldier->pathing.bPathStored = FALSE; // decide on the next action #ifdef AI_PROFILING for (iLoop = 0; iLoop < 1000; iLoop++) #endif { - if (pSoldier->bNextAction != AI_ACTION_NONE) + if (pSoldier->aiData.bNextAction != AI_ACTION_NONE) { - if ( pSoldier->bNextAction == AI_ACTION_END_COWER_AND_MOVE ) + if ( pSoldier->aiData.bNextAction == AI_ACTION_END_COWER_AND_MOVE ) { - if ( pSoldier->uiStatusFlags & SOLDIER_COWERING ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_COWERING ) { - pSoldier->bAction = AI_ACTION_STOP_COWERING; - pSoldier->usActionData = ANIM_STAND; + pSoldier->aiData.bAction = AI_ACTION_STOP_COWERING; + pSoldier->aiData.usActionData = ANIM_STAND; } else if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight < ANIM_STAND ) { // stand up! - pSoldier->bAction = AI_ACTION_CHANGE_STANCE; - pSoldier->usActionData = ANIM_STAND; + pSoldier->aiData.bAction = AI_ACTION_CHANGE_STANCE; + pSoldier->aiData.usActionData = ANIM_STAND; } else { - pSoldier->bAction = AI_ACTION_NONE; + pSoldier->aiData.bAction = AI_ACTION_NONE; } - if ( pSoldier->sGridNo == pSoldier->usNextActionData ) + if ( pSoldier->sGridNo == pSoldier->aiData.usNextActionData ) { // no need to walk after this - pSoldier->bNextAction = AI_ACTION_NONE; - pSoldier->usNextActionData = NOWHERE; + pSoldier->aiData.bNextAction = AI_ACTION_NONE; + pSoldier->aiData.usNextActionData = NOWHERE; } else { - pSoldier->bNextAction = AI_ACTION_WALK; + pSoldier->aiData.bNextAction = AI_ACTION_WALK; // leave next-action-data as is since that's where we want to go } } else { // do the next thing we have to do... - pSoldier->bAction = pSoldier->bNextAction; - pSoldier->usActionData = pSoldier->usNextActionData; - pSoldier->bTargetLevel = pSoldier->bNextTargetLevel; - pSoldier->bNextAction = AI_ACTION_NONE; - pSoldier->usNextActionData = 0; - pSoldier->bNextTargetLevel = 0; + pSoldier->aiData.bAction = pSoldier->aiData.bNextAction; + pSoldier->aiData.usActionData = pSoldier->aiData.usNextActionData; + pSoldier->bTargetLevel = pSoldier->aiData.bNextTargetLevel; + pSoldier->aiData.bNextAction = AI_ACTION_NONE; + pSoldier->aiData.usNextActionData = 0; + pSoldier->aiData.bNextTargetLevel = 0; } - if (pSoldier->bAction == AI_ACTION_PICKUP_ITEM) + if (pSoldier->aiData.bAction == AI_ACTION_PICKUP_ITEM) { // the item pool index was stored in the special data field - pSoldier->uiPendingActionData1 = pSoldier->iNextActionSpecialData; + pSoldier->aiData.uiPendingActionData1 = pSoldier->iNextActionSpecialData; } } else if ( pSoldier->sAbsoluteFinalDestination != NOWHERE ) { if ( ACTING_ON_SCHEDULE( pSoldier ) ) { - pSoldier->bAction = AI_ACTION_SCHEDULE_MOVE; + pSoldier->aiData.bAction = AI_ACTION_SCHEDULE_MOVE; } else { - pSoldier->bAction = AI_ACTION_WALK; + pSoldier->aiData.bAction = AI_ACTION_WALK; } - pSoldier->usActionData = pSoldier->sAbsoluteFinalDestination; + pSoldier->aiData.usActionData = pSoldier->sAbsoluteFinalDestination; } else { if (!(gTacticalStatus.uiFlags & ENGAGED_IN_CONV)) { - pSoldier->bAction = RTDecideAction( pSoldier ); + pSoldier->aiData.bAction = RTDecideAction( pSoldier ); } } } // if he chose to continue doing nothing - if (pSoldier->bAction == AI_ACTION_NONE) + if (pSoldier->aiData.bAction == AI_ACTION_NONE) { #ifdef RECORDNET fprintf(NetDebugFile,"\tMOVED BECOMING TRUE: Chose to do nothing, guynum %d\n",pSoldier->ubID); #endif // do a standard wait before doing anything else! - pSoldier->bAction = AI_ACTION_WAIT; - //if (PTR_CIVILIAN && pSoldier->bAlertStatus != STATUS_BLACK) - if ( PTR_CIV_OR_MILITIA && !(pSoldier->ubCivilianGroup == KINGPIN_CIV_GROUP ) ) + pSoldier->aiData.bAction = AI_ACTION_WAIT; + //if (PTR_CIVILIAN && pSoldier->aiData.bAlertStatus != STATUS_BLACK) + if ( PTR_CIV_OR_MILITIA && !(pSoldier->ubCivilianGroup == KINGPIN_CIV_GROUP ) ) { - pSoldier->usActionData = (UINT16) REALTIME_CIV_AI_DELAY; + pSoldier->aiData.usActionData = (UINT16) REALTIME_CIV_AI_DELAY; } - else if ( CREATURE_OR_BLOODCAT( pSoldier ) && !( pSoldier->bHunting ) ) + else if ( CREATURE_OR_BLOODCAT( pSoldier ) && !( pSoldier->aiData.bHunting ) ) { - pSoldier->usActionData = (UINT16) REALTIME_CREATURE_AI_DELAY; + pSoldier->aiData.usActionData = (UINT16) REALTIME_CREATURE_AI_DELAY; } else { - pSoldier->usActionData = (UINT16) REALTIME_AI_DELAY; + pSoldier->aiData.usActionData = (UINT16) REALTIME_AI_DELAY; if ( pSoldier->ubCivilianGroup == KINGPIN_CIV_GROUP ) { UINT8 ubRoom; if ( InARoom( pSoldier->sGridNo, &ubRoom ) && IN_BROTHEL( ubRoom ) ) { - pSoldier->usActionData /= 3; + pSoldier->aiData.usActionData /= 3; } } } } - else if (pSoldier->bAction == AI_ACTION_ABSOLUTELY_NONE) + else if (pSoldier->aiData.bAction == AI_ACTION_ABSOLUTELY_NONE) { - pSoldier->bAction = AI_ACTION_NONE; + pSoldier->aiData.bAction = AI_ACTION_NONE; } - } + } // to get here, we MUST have an action selected, but not in progress... NPCDoesAct(pSoldier); // perform the chosen action - pSoldier->bActionInProgress = ExecuteAction(pSoldier); // if started, mark us as busy + pSoldier->aiData.bActionInProgress = ExecuteAction(pSoldier); // if started, mark us as busy } diff --git a/TacticalAI/TacticalAI_2005Express.vcproj b/TacticalAI/TacticalAI_2005Express.vcproj index d72f3db0..4b237169 100644 --- a/TacticalAI/TacticalAI_2005Express.vcproj +++ b/TacticalAI/TacticalAI_2005Express.vcproj @@ -1,7 +1,7 @@ - + + + + + + + + + + + + + + + + + + diff --git a/TacticalAI/ai.h b/TacticalAI/ai.h index ac8b840e..c4171b62 100644 --- a/TacticalAI/ai.h +++ b/TacticalAI/ai.h @@ -25,8 +25,8 @@ enum CreatureCalls NUM_CREATURE_CALLS } ; -#define DONTFORCE 0 -#define FORCE 1 +#define DONTFORCE 0 +#define FORCE 1 // ANY NEW ACTIONS ADDED - UPDATE OVERHEAD.C ARRAY WITH ACTION'S STRING VALUE #define FIRST_MOVEMENT_ACTION AI_ACTION_RANDOM_PATROL @@ -81,7 +81,7 @@ typedef enum AI_ACTION_WAIT, // RT: don't do anything for a certain length of time AI_ACTION_PENDING_ACTION, // RT: wait for pending action (pickup, door open, etc) to finish AI_ACTION_DROP_ITEM, // duh - AI_ACTION_COWER, // for civilians: cower in fear and stay there! + AI_ACTION_COWER, // for civilians: cower in fear and stay there! AI_ACTION_STOP_COWERING, // stop cowering AI_ACTION_OPEN_OR_CLOSE_DOOR, // schedule-provoked; open or close door @@ -131,12 +131,12 @@ enum QuoteActionType #define IS_NEW_SITUATION 2 -#define DIFF_ENEMY_EQUIP_MOD 0 -#define DIFF_ENEMY_TO_HIT_MOD 1 -#define DIFF_ENEMY_INTERRUPT_MOD 2 -#define DIFF_RADIO_RED_ALERT 3 -#define DIFF_MAX_COVER_RANGE 4 -#define MAX_DIFF_PARMS 5 // how many different difficulty variables? +#define DIFF_ENEMY_EQUIP_MOD 0 +#define DIFF_ENEMY_TO_HIT_MOD 1 +#define DIFF_ENEMY_INTERRUPT_MOD 2 +#define DIFF_RADIO_RED_ALERT 3 +#define DIFF_MAX_COVER_RANGE 4 +#define MAX_DIFF_PARMS 5 // how many different difficulty variables? extern INT8 gbDiff[MAX_DIFF_PARMS][5]; @@ -171,7 +171,7 @@ INT16 DistanceToClosestFriend( SOLDIERTYPE * pSoldier ); void EndAIDeadlock(void); void EndAIGuysTurn( SOLDIERTYPE *pSoldier ); -INT8 ExecuteAction(SOLDIERTYPE *pSoldier); +INT8 ExecuteAction(SOLDIERTYPE *pSoldier); INT16 FindAdjacentSpotBeside(SOLDIERTYPE *pSoldier, INT16 sGridno); INT16 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *pPercentBetter); @@ -179,7 +179,7 @@ INT16 FindClosestDoor( SOLDIERTYPE * pSoldier ); INT16 FindNearbyPointOnEdgeOfMap( SOLDIERTYPE * pSoldier, INT8 * pbDirection ); INT16 FindNearestEdgePoint( INT16 sGridNo ); -//Kris: Added these as I need specific searches on certain sides. +//Kris: Added these as I need specific searches on certain sides. enum { NORTH_EDGEPOINT_SEARCH, diff --git a/TileEngine/Ambient Control.cpp b/TileEngine/Ambient Control.cpp index af91da34..7baeb619 100644 --- a/TileEngine/Ambient Control.cpp +++ b/TileEngine/Ambient Control.cpp @@ -19,131 +19,131 @@ AMBIENTDATA_STRUCT gAmbData[ MAX_AMBIENT_SOUNDS ]; INT16 gsNumAmbData = 0; -UINT8 gubCurrentSteadyStateAmbience = SSA_NONE; -UINT8 gubCurrentSteadyStateSound = 0; -UINT32 guiCurrentSteadyStateSoundHandle = NO_SAMPLE; -STEADY_STATE_AMBIENCE gSteadyStateAmbientTable[ NUM_STEADY_STATE_AMBIENCES ] = +UINT8 gubCurrentSteadyStateAmbience = SSA_NONE; +UINT8 gubCurrentSteadyStateSound = 0; +UINT32 guiCurrentSteadyStateSoundHandle = NO_SAMPLE; +STEADY_STATE_AMBIENCE gSteadyStateAmbientTable[ NUM_STEADY_STATE_AMBIENCES ] = { - // NONE - "", - "", - "", - "", - // NIGHT - "", - "", - "", - "", - // COUNTRYSIZE - // DAY - "SOUNDS\\SSA\\insects Day 01.wav", - "", - "", - "", - // NIGHT - "SOUNDS\\SSA\\night_crickets_01D.wav", - "SOUNDS\\SSA\\night_crickets_01B.wav", - "SOUNDS\\SSA\\night_crickets_01C.wav", - "SOUNDS\\SSA\\night_crickets_01A.wav", - // NEAR WATER - // DAY - "SOUNDS\\SSA\\swamp_day_01a.wav", - "SOUNDS\\SSA\\swamp_day_01b.wav", - "SOUNDS\\SSA\\swamp_day_01c.wav", - "SOUNDS\\SSA\\swamp_day_01d.wav", - //NIGHT - "SOUNDS\\SSA\\marsh_at_night_01a.wav", - "SOUNDS\\SSA\\marsh_at_night_01b.wav", - "SOUNDS\\SSA\\marsh_at_night_01c.wav", - "SOUNDS\\SSA\\marsh_at_night_01d.wav", - //INWATER - //DAY - "SOUNDS\\SSA\\middle_of_water_01d.wav", - "SOUNDS\\SSA\\middle_of_water_01c.wav", - "SOUNDS\\SSA\\middle_of_water_01b.wav", - "SOUNDS\\SSA\\middle_of_water_01a.wav", - // night - "SOUNDS\\SSA\\middle_of_water_01d.wav", - "SOUNDS\\SSA\\middle_of_water_01c.wav", - "SOUNDS\\SSA\\middle_of_water_01b.wav", - "SOUNDS\\SSA\\middle_of_water_01a.wav", - // HEAVY FOREST - // day - "SOUNDS\\SSA\\JUNGLE_DAY_01a.wav", - "SOUNDS\\SSA\\JUNGLE_DAY_01b.wav", - "SOUNDS\\SSA\\JUNGLE_DAY_01c.wav", - "SOUNDS\\SSA\\JUNGLE_DAY_01d.wav", - // night - "SOUNDS\\SSA\\night_crickets_03a.wav", - "SOUNDS\\SSA\\night_crickets_03b.wav", - "SOUNDS\\SSA\\night_crickets_03c.wav", - "SOUNDS\\SSA\\night_crickets_03d.wav", - // PINE FOREST - // DAY - "SOUNDS\\SSA\\pine_forest_01a.wav", - "SOUNDS\\SSA\\pine_forest_01b.wav", - "SOUNDS\\SSA\\pine_forest_01c.wav", - "SOUNDS\\SSA\\pine_forest_01d.wav", - // NIGHT - "SOUNDS\\SSA\\night_crickets_02a.wav", - "SOUNDS\\SSA\\night_crickets_02b.wav", - "SOUNDS\\SSA\\night_crickets_02c.wav", - "SOUNDS\\SSA\\night_crickets_02d.wav", - // ABANDANDED - // DAY - "SOUNDS\\SSA\\metal_wind_01a.wav", - "SOUNDS\\SSA\\metal_wind_01b.wav", - "SOUNDS\\SSA\\metal_wind_01c.wav", - "SOUNDS\\SSA\\metal_wind_01d.wav", - // NIGHT - "SOUNDS\\SSA\\night_insects_01a.wav", - "SOUNDS\\SSA\\night_insects_01b.wav", - "SOUNDS\\SSA\\night_insects_01c.wav", - "SOUNDS\\SSA\\night_insects_01d.wav", - // AIRPORT - // DAY - "SOUNDS\\SSA\\rotating radar dish.wav", - "", - "", - "", - // NIGHT - "SOUNDS\\SSA\\rotating radar dish.wav", - "", - "", - "", - // WASTE LAND - // DAY - "SOUNDS\\SSA\\gentle_wind.wav", - "", - "", - "", - // NIGHT - "SOUNDS\\SSA\\insects_at_night_04.wav", - "", - "", - "", - // UNDERGROUND - // DAY - "SOUNDS\\SSA\\low ominous ambience.wav", - "", - "", - "", - // NIGHT - "SOUNDS\\SSA\\low ominous ambience.wav", - "", - "", - "", - // OCEAN - // DAY - "SOUNDS\\SSA\\sea_01a.wav", - "SOUNDS\\SSA\\sea_01b.wav", - "SOUNDS\\SSA\\sea_01c.wav", - "SOUNDS\\SSA\\sea_01d.wav", - // NIGHT - "SOUNDS\\SSA\\ocean_waves_01a.wav", - "SOUNDS\\SSA\\ocean_waves_01b.wav", - "SOUNDS\\SSA\\ocean_waves_01c.wav", - "SOUNDS\\SSA\\ocean_waves_01d.wav", + // NONE + "", + "", + "", + "", + // NIGHT + "", + "", + "", + "", + // COUNTRYSIZE + // DAY + "SOUNDS\\SSA\\insects Day 01.wav", + "", + "", + "", + // NIGHT + "SOUNDS\\SSA\\night_crickets_01D.wav", + "SOUNDS\\SSA\\night_crickets_01B.wav", + "SOUNDS\\SSA\\night_crickets_01C.wav", + "SOUNDS\\SSA\\night_crickets_01A.wav", + // NEAR WATER + // DAY + "SOUNDS\\SSA\\swamp_day_01a.wav", + "SOUNDS\\SSA\\swamp_day_01b.wav", + "SOUNDS\\SSA\\swamp_day_01c.wav", + "SOUNDS\\SSA\\swamp_day_01d.wav", + //NIGHT + "SOUNDS\\SSA\\marsh_at_night_01a.wav", + "SOUNDS\\SSA\\marsh_at_night_01b.wav", + "SOUNDS\\SSA\\marsh_at_night_01c.wav", + "SOUNDS\\SSA\\marsh_at_night_01d.wav", + //INWATER + //DAY + "SOUNDS\\SSA\\middle_of_water_01d.wav", + "SOUNDS\\SSA\\middle_of_water_01c.wav", + "SOUNDS\\SSA\\middle_of_water_01b.wav", + "SOUNDS\\SSA\\middle_of_water_01a.wav", + // night + "SOUNDS\\SSA\\middle_of_water_01d.wav", + "SOUNDS\\SSA\\middle_of_water_01c.wav", + "SOUNDS\\SSA\\middle_of_water_01b.wav", + "SOUNDS\\SSA\\middle_of_water_01a.wav", + // HEAVY FOREST + // day + "SOUNDS\\SSA\\JUNGLE_DAY_01a.wav", + "SOUNDS\\SSA\\JUNGLE_DAY_01b.wav", + "SOUNDS\\SSA\\JUNGLE_DAY_01c.wav", + "SOUNDS\\SSA\\JUNGLE_DAY_01d.wav", + // night + "SOUNDS\\SSA\\night_crickets_03a.wav", + "SOUNDS\\SSA\\night_crickets_03b.wav", + "SOUNDS\\SSA\\night_crickets_03c.wav", + "SOUNDS\\SSA\\night_crickets_03d.wav", + // PINE FOREST + // DAY + "SOUNDS\\SSA\\pine_forest_01a.wav", + "SOUNDS\\SSA\\pine_forest_01b.wav", + "SOUNDS\\SSA\\pine_forest_01c.wav", + "SOUNDS\\SSA\\pine_forest_01d.wav", + // NIGHT + "SOUNDS\\SSA\\night_crickets_02a.wav", + "SOUNDS\\SSA\\night_crickets_02b.wav", + "SOUNDS\\SSA\\night_crickets_02c.wav", + "SOUNDS\\SSA\\night_crickets_02d.wav", + // ABANDANDED + // DAY + "SOUNDS\\SSA\\metal_wind_01a.wav", + "SOUNDS\\SSA\\metal_wind_01b.wav", + "SOUNDS\\SSA\\metal_wind_01c.wav", + "SOUNDS\\SSA\\metal_wind_01d.wav", + // NIGHT + "SOUNDS\\SSA\\night_insects_01a.wav", + "SOUNDS\\SSA\\night_insects_01b.wav", + "SOUNDS\\SSA\\night_insects_01c.wav", + "SOUNDS\\SSA\\night_insects_01d.wav", + // AIRPORT + // DAY + "SOUNDS\\SSA\\rotating radar dish.wav", + "", + "", + "", + // NIGHT + "SOUNDS\\SSA\\rotating radar dish.wav", + "", + "", + "", + // WASTE LAND + // DAY + "SOUNDS\\SSA\\gentle_wind.wav", + "", + "", + "", + // NIGHT + "SOUNDS\\SSA\\insects_at_night_04.wav", + "", + "", + "", + // UNDERGROUND + // DAY + "SOUNDS\\SSA\\low ominous ambience.wav", + "", + "", + "", + // NIGHT + "SOUNDS\\SSA\\low ominous ambience.wav", + "", + "", + "", + // OCEAN + // DAY + "SOUNDS\\SSA\\sea_01a.wav", + "SOUNDS\\SSA\\sea_01b.wav", + "SOUNDS\\SSA\\sea_01c.wav", + "SOUNDS\\SSA\\sea_01d.wav", + // NIGHT + "SOUNDS\\SSA\\ocean_waves_01a.wav", + "SOUNDS\\SSA\\ocean_waves_01b.wav", + "SOUNDS\\SSA\\ocean_waves_01c.wav", + "SOUNDS\\SSA\\ocean_waves_01d.wav", }; @@ -216,7 +216,7 @@ void HandleNewSectorAmbience( UINT8 ubAmbientID ) } else { - DebugMsg(TOPIC_JA2, DBG_LEVEL_0, String("Cannot load Ambient data for tileset" ) ); + DebugMsg(TOPIC_JA2, DBG_LEVEL_0, String("Cannot load Ambient data for tileset" ) ); } } } @@ -232,8 +232,8 @@ UINT32 SetupNewAmbientSound( UINT32 uiAmbientID ) { RANDOMPARMS rpParms; - //SoundLog((CHAR8 *)String(" SetupNewAmbientSound()1: uiAmbientID: '%d'", uiAmbientID ) ); - + //SoundLog((CHAR8 *)String(" SetupNewAmbientSound()1: uiAmbientID: '%d'", uiAmbientID ) ); + memset(&rpParms, 0xff, sizeof(RANDOMPARMS)); rpParms.uiTimeMin = gAmbData[ uiAmbientID ].uiMinTime; @@ -242,9 +242,9 @@ UINT32 SetupNewAmbientSound( UINT32 uiAmbientID ) rpParms.uiVolMax = CalculateSoundEffectsVolume( gAmbData[ uiAmbientID ].uiVol ); rpParms.uiPriority = GROUP_AMBIENT; - //SoundLog((CHAR8 *)String(" SetupNewAmbientSound()2: gAmbData[ uiAmbientID ].zFilename: '%s', Params: '%s'", gAmbData[ uiAmbientID ].zFilename, &rpParms ) ); - - return SoundPlayRandom( gAmbData[ uiAmbientID ].zFilename, &rpParms ); //bug Nr14 + //SoundLog((CHAR8 *)String(" SetupNewAmbientSound()2: gAmbData[ uiAmbientID ].zFilename: '%s', Params: '%s'", gAmbData[ uiAmbientID ].zFilename, &rpParms ) ); + + return SoundPlayRandom( gAmbData[ uiAmbientID ].zFilename, &rpParms ); //bug Nr14 } @@ -265,48 +265,48 @@ SOUNDPARMS spParms; BOOLEAN SetSteadyStateAmbience( UINT8 ubAmbience ) { - BOOLEAN fInNight = FALSE; - INT32 cnt; - UINT8 ubNumSounds = 0; - UINT8 ubChosenSound; + BOOLEAN fInNight = FALSE; + INT32 cnt; + UINT8 ubNumSounds = 0; + UINT8 ubChosenSound; - // Stop all ambients... + // Stop all ambients... if ( guiCurrentSteadyStateSoundHandle != NO_SAMPLE ) { SoundStop( guiCurrentSteadyStateSoundHandle ); guiCurrentSteadyStateSoundHandle = NO_SAMPLE; } - // Determine what time of day we are in ( day/night) + // Determine what time of day we are in ( day/night) if( gubEnvLightValue >= LIGHT_DUSK_CUTOFF) { - fInNight = TRUE; - } + fInNight = TRUE; + } - // loop through listing to get num sounds... - for ( cnt = ( fInNight * 4 ); cnt < ( NUM_SOUNDS_PER_TIMEFRAME / 2 ); cnt++ ) - { - if ( gSteadyStateAmbientTable[ ubAmbience ].zSoundNames[ cnt ][ 0 ] == 0 ) - { - break; - } - - ubNumSounds++; - } + // loop through listing to get num sounds... + for ( cnt = ( fInNight * 4 ); cnt < ( NUM_SOUNDS_PER_TIMEFRAME / 2 ); cnt++ ) + { + if ( gSteadyStateAmbientTable[ ubAmbience ].zSoundNames[ cnt ][ 0 ] == 0 ) + { + break; + } - if ( ubNumSounds == 0 ) - { - return( FALSE ); - } + ubNumSounds++; + } - // Pick one - ubChosenSound = (UINT8) Random( ubNumSounds ); + if ( ubNumSounds == 0 ) + { + return( FALSE ); + } - // Set! - gubCurrentSteadyStateAmbience = ubAmbience; - gubCurrentSteadyStateSound = ubChosenSound; + // Pick one + ubChosenSound = (UINT8) Random( ubNumSounds ); - guiCurrentSteadyStateSoundHandle = StartSteadyStateAmbient( LOWVOLUME, 0 ); + // Set! + gubCurrentSteadyStateAmbience = ubAmbience; + gubCurrentSteadyStateSound = ubChosenSound; - return( TRUE ); -} \ No newline at end of file + guiCurrentSteadyStateSoundHandle = StartSteadyStateAmbient( LOWVOLUME, 0 ); + + return( TRUE ); +} diff --git a/TileEngine/Ambient Control.h b/TileEngine/Ambient Control.h index 67585fe0..67fc3428 100644 --- a/TileEngine/Ambient Control.h +++ b/TileEngine/Ambient Control.h @@ -19,30 +19,30 @@ extern INT16 gsNumAmbData; BOOLEAN SetSteadyStateAmbience( UINT8 ubAmbience ); -#define SOUND_NAME_SIZE 256 -#define NUM_SOUNDS_PER_TIMEFRAME 8 +#define SOUND_NAME_SIZE 256 +#define NUM_SOUNDS_PER_TIMEFRAME 8 enum { - SSA_NONE, - SSA_COUNTRYSIZE, - SSA_NEAR_WATER, - SSA_IN_WATER, - SSA_HEAVY_FOREST, - SSA_PINE_FOREST, - SSA_ABANDONED, - SSA_AIRPORT, - SSA_WASTELAND, - SSA_UNDERGROUND, - SSA_OCEAN, - NUM_STEADY_STATE_AMBIENCES + SSA_NONE, + SSA_COUNTRYSIZE, + SSA_NEAR_WATER, + SSA_IN_WATER, + SSA_HEAVY_FOREST, + SSA_PINE_FOREST, + SSA_ABANDONED, + SSA_AIRPORT, + SSA_WASTELAND, + SSA_UNDERGROUND, + SSA_OCEAN, + NUM_STEADY_STATE_AMBIENCES }; typedef struct { - CHAR8 zSoundNames[ NUM_SOUNDS_PER_TIMEFRAME ][ SOUND_NAME_SIZE ]; - + CHAR8 zSoundNames[ NUM_SOUNDS_PER_TIMEFRAME ][ SOUND_NAME_SIZE ]; + } STEADY_STATE_AMBIENCE; diff --git a/TileEngine/Buildings.cpp b/TileEngine/Buildings.cpp index f990635f..423dd306 100644 --- a/TileEngine/Buildings.cpp +++ b/TileEngine/Buildings.cpp @@ -69,17 +69,14 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot ) return( NULL ); } - // WDS - Clean up inventory handling // set up fake soldier for location testing -// memset( &FakeSoldier, 0, SIZEOF_SOLDIERTYPE ); #if 0 - FakeSoldier.initialize(); FakeSoldier.sGridNo = sDesiredSpot; - FakeSoldier.bLevel = 1; + FakeSoldier.pathing.bLevel = 1; FakeSoldier.bTeam = 1; #endif - // Set reachable + // Set reachable RoofReachableTest( sDesiredSpot, ubBuildingID ); // 0verhaul: The RoofReachableTest now finds ALL of the climb points for each climbable building, instead of a max of @@ -90,8 +87,8 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot ) // From sGridNo, search until we find a spot that isn't part of the building ubDirection = NORTHWEST; sTempGridNo = sDesiredSpot; - // using diagonal directions to hopefully prevent picking a - // spot that + // using diagonal directions to hopefully prevent picking a + // spot that while( (gpWorldLevelData[ sTempGridNo ].uiFlags & MAPELEMENT_REACHABLE ) ) { sNextTempGridNo = NewGridNo( sTempGridNo, DirectionInc( ubDirection ) ); @@ -104,7 +101,7 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot ) { sTempGridNo = sNextTempGridNo; } - } + } // we've got our spot sStartGridNo = sTempGridNo; @@ -222,8 +219,8 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot ) gubBuildingInfo[ sCurrGridNo ] = ubBuildingID; - // consider this location as possible climb gridno - // there must be a regular wall adjacent to this for us to consider it a + // consider this location as possible climb gridno + // there must be a regular wall adjacent to this for us to consider it a // climb gridno // if the direction is east or north, the wall would be in our gridno; @@ -283,7 +280,7 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot ) bSkipSpots--; } else if ( Random( uiChanceIn ) == 0 ) - { + { // don't consider people as obstacles //if ( NewOKDestination( &FakeSoldier, sCurrGridNo, FALSE, 0 ) ) { @@ -309,13 +306,13 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot ) //{ // if location is not added, 100% chance of handling next location // and the next until we can add one - // uiChanceIn = 1; + //uiChanceIn = 1; //} } else { - // didn't pick this location, so increase chance that next location + // didn't pick this location, so increase chance that next location // will be considered if (uiChanceIn > 2) { @@ -396,7 +393,7 @@ BUILDING * FindBuilding( INT16 sGridNo ) { return( NULL ); /* - // need extra checks to see if is valid spot... + // need extra checks to see if is valid spot... // must have valid room information and be a flat-roofed // building if ( InARoom( sGridNo, &ubRoomNo ) && (FindStructure( sGridNo, STRUCTURE_NORMAL_ROOF ) != NULL) ) @@ -582,4 +579,4 @@ BOOLEAN SameBuilding( INT16 sGridNo1, INT16 sGridNo2 ) return( FALSE ); } return( (BOOLEAN) (gubBuildingInfo[ sGridNo1] == gubBuildingInfo[ sGridNo2 ]) ); -} \ No newline at end of file +} diff --git a/TileEngine/Exit Grids.cpp b/TileEngine/Exit Grids.cpp index 736807f9..5a1fab82 100644 --- a/TileEngine/Exit Grids.cpp +++ b/TileEngine/Exit Grids.cpp @@ -33,10 +33,10 @@ BOOLEAN gfOverrideInsertionWithExitGrid = FALSE; INT32 ConvertExitGridToINT32( EXITGRID *pExitGrid ) { INT32 iExitGridInfo; - iExitGridInfo = (pExitGrid->ubGotoSectorX-1)<< 28; + iExitGridInfo = (pExitGrid->ubGotoSectorX-1)<< 28; iExitGridInfo += (pExitGrid->ubGotoSectorY-1)<< 24; - iExitGridInfo += pExitGrid->ubGotoSectorZ << 20; - iExitGridInfo += pExitGrid->usGridNo & 0x0000ffff; + iExitGridInfo += pExitGrid->ubGotoSectorZ << 20; + iExitGridInfo += pExitGrid->sGridNo & 0x0000ffff; return iExitGridInfo; } @@ -46,13 +46,13 @@ void ConvertINT32ToExitGrid( INT32 iExitGridInfo, EXITGRID *pExitGrid ) pExitGrid->ubGotoSectorX = (UINT8)(((iExitGridInfo & 0xf0000000)>>28)+1); pExitGrid->ubGotoSectorY = (UINT8)(((iExitGridInfo & 0x0f000000)>>24)+1); pExitGrid->ubGotoSectorZ = (UINT8)((iExitGridInfo & 0x00f00000)>>20); - pExitGrid->usGridNo = (UINT16)(iExitGridInfo & 0x0000ffff); + pExitGrid->sGridNo = (INT16)(iExitGridInfo & 0x0000ffff); } -BOOLEAN GetExitGrid( UINT16 usMapIndex, EXITGRID *pExitGrid ) +BOOLEAN GetExitGrid( INT16 sMapIndex, EXITGRID *pExitGrid ) { LEVELNODE *pShadow; - pShadow = gpWorldLevelData[ usMapIndex ].pShadowHead; + pShadow = gpWorldLevelData[ sMapIndex ].pShadowHead; //Search through object layer for an exitgrid while( pShadow ) { @@ -66,14 +66,14 @@ BOOLEAN GetExitGrid( UINT16 usMapIndex, EXITGRID *pExitGrid ) pExitGrid->ubGotoSectorX = 0; pExitGrid->ubGotoSectorY = 0; pExitGrid->ubGotoSectorZ = 0; - pExitGrid->usGridNo = 0; - return FALSE; + pExitGrid->sGridNo = 0; + return FALSE; } -BOOLEAN ExitGridAtGridNo( UINT16 usMapIndex ) +BOOLEAN ExitGridAtGridNo( INT16 sMapIndex ) { LEVELNODE *pShadow; - pShadow = gpWorldLevelData[ usMapIndex ].pShadowHead; + pShadow = gpWorldLevelData[ sMapIndex ].pShadowHead; //Search through object layer for an exitgrid while( pShadow ) { @@ -83,13 +83,13 @@ BOOLEAN ExitGridAtGridNo( UINT16 usMapIndex ) } pShadow = pShadow->pNext; } - return FALSE; + return FALSE; } -BOOLEAN GetExitGridLevelNode( UINT16 usMapIndex, LEVELNODE **ppLevelNode ) +BOOLEAN GetExitGridLevelNode( INT16 sMapIndex, LEVELNODE **ppLevelNode ) { LEVELNODE *pShadow; - pShadow = gpWorldLevelData[ usMapIndex ].pShadowHead; + pShadow = gpWorldLevelData[ sMapIndex ].pShadowHead; //Search through object layer for an exitgrid while( pShadow ) { @@ -100,7 +100,7 @@ BOOLEAN GetExitGridLevelNode( UINT16 usMapIndex, LEVELNODE **ppLevelNode ) } pShadow = pShadow->pNext; } - return FALSE; + return FALSE; } @@ -116,7 +116,7 @@ void AddExitGridToWorld( INT32 iMapIndex, EXITGRID *pExitGrid ) if( pShadow->uiFlags & LEVELNODE_EXITGRID ) { //we have found an existing exitgrid in this node, so replace it with the new information. pShadow->iExitGridInfo = ConvertExitGridToINT32( pExitGrid ); - //SmoothExitGridRadius( (UINT16)iMapIndex, 0 ); + //SmoothExitGridRadius( (INT16)iMapIndex, 0 ); return; } pShadow = pShadow->pNext; @@ -134,7 +134,7 @@ void AddExitGridToWorld( INT32 iMapIndex, EXITGRID *pExitGrid ) //Add the exit grid to the sector, only if we call ApplyMapChangesToMapTempFile() first. if( !gfEditMode && !gfLoadingExitGrids ) { - AddExitGridToMapTempFile( (UINT16)iMapIndex, pExitGrid, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); + AddExitGridToMapTempFile( (INT16)iMapIndex, pExitGrid, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); } } @@ -172,17 +172,17 @@ void LoadExitGrids( INT8 **hBuffer ) EXITGRID exitGrid; UINT16 x; UINT16 usNumSaved; - UINT16 usMapIndex; + INT16 sMapIndex; gfLoadingExitGrids = TRUE; LOADDATA( &usNumSaved, *hBuffer, 2 ); //FileRead( hfile, &usNumSaved, 2, NULL); for( x = 0; x < usNumSaved; x++ ) { - LOADDATA( &usMapIndex, *hBuffer, 2 ); - //FileRead( hfile, &usMapIndex, 2, NULL); + LOADDATA( &sMapIndex, *hBuffer, 2 ); + //FileRead( hfile, &sMapIndex, 2, NULL); LOADDATA( &exitGrid, *hBuffer, 5 ); //FileRead( hfile, &exitGrid, 5, NULL); - AddExitGridToWorld( usMapIndex, &exitGrid ); + AddExitGridToWorld( sMapIndex, &exitGrid ); } gfLoadingExitGrids = FALSE; } @@ -230,11 +230,11 @@ void AttemptToChangeFloorLevel( INT8 bRelativeZLevel ) } -UINT16 FindGridNoFromSweetSpotCloseToExitGrid( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ) +INT16 FindGridNoFromSweetSpotCloseToExitGrid( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ) { - INT16 sTop, sBottom; - INT16 sLeft, sRight; - INT16 cnt1, cnt2; + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2; INT16 sGridNo; INT32 uiRange, uiLowestRange = 999999; INT16 sLowestGridNo=0; @@ -246,24 +246,21 @@ UINT16 FindGridNoFromSweetSpotCloseToExitGrid( SOLDIERTYPE *pSoldier, INT16 sSwe EXITGRID ExitGrid; UINT8 ubGotoSectorX, ubGotoSectorY, ubGotoSectorZ; - //Save AI pathing vars. changing the distlimit restricts how + //Save AI pathing vars. changing the distlimit restricts how //far away the pathing will consider. ubSaveNPCAPBudget = gubNPCAPBudget; ubSaveNPCDistLimit = gubNPCDistLimit; gubNPCAPBudget = 0; gubNPCDistLimit = ubRadius; - // WDS - Clean up inventory handling //create dummy soldier, and use the pathing to determine which nearby slots are //reachable. -// memset( &soldier, 0, SIZEOF_SOLDIERTYPE ); - soldier.initialize(); - soldier.bLevel = 0; + soldier.pathing.bLevel = 0; soldier.bTeam = 1; soldier.sGridNo = pSoldier->sGridNo; // OK, Get an exit grid ( if possible ) - if ( !GetExitGrid( sSweetGridNo, &ExitGrid ) ) + if ( !GetExitGrid( sSweetGridNo, &ExitGrid ) ) { return( NOWHERE ); } @@ -276,8 +273,8 @@ UINT16 FindGridNoFromSweetSpotCloseToExitGrid( SOLDIERTYPE *pSoldier, INT16 sSwe sTop = ubRadius; sBottom = -ubRadius; - sLeft = - ubRadius; - sRight = ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; //clear the mapelements of potential residue MAPELEMENT_REACHABLE flags //in the square region. @@ -295,11 +292,11 @@ UINT16 FindGridNoFromSweetSpotCloseToExitGrid( SOLDIERTYPE *pSoldier, INT16 sSwe gfPlotPathToExitGrid = TRUE; - //Now, find out which of these gridnos are reachable + //Now, find out which of these gridnos are reachable //(use the fake soldier and the pathing settings) FindBestPath( &soldier, NOWHERE, 0, WALKING, COPYREACHABLE, PATH_THROUGH_PEOPLE ); - - uiLowestRange = 999999; + + uiLowestRange = 999999; for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) { @@ -308,13 +305,13 @@ UINT16 FindGridNoFromSweetSpotCloseToExitGrid( SOLDIERTYPE *pSoldier, INT16 sSwe for( cnt2 = sLeft; cnt2 <= sRight; cnt2++ ) { sGridNo = pSoldier->sGridNo + ( WORLD_COLS * cnt1 ) + cnt2; - if ( sGridNo >=0 && sGridNo < WORLD_MAX && sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) && + if ( sGridNo >=0 && sGridNo < WORLD_MAX && sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) && gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE ) { // Go on sweet stop // ATE: Added this check because for all intensive purposes, cavewalls will be not an OKDEST // but we want thenm too... - if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->bLevel ) ) + if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) ) { if ( GetExitGrid( sGridNo, &ExitGrid ) ) { @@ -343,7 +340,7 @@ UINT16 FindGridNoFromSweetSpotCloseToExitGrid( SOLDIERTYPE *pSoldier, INT16 sSwe if ( fFound ) { // Set direction to center of map! - *pubDirection = (UINT8)GetDirectionToGridNoFromGridNo( sLowestGridNo, ( ( ( WORLD_ROWS / 2 ) * WORLD_COLS ) + ( WORLD_COLS / 2 ) ) ); + *pubDirection = (UINT8)GetDirectionToGridNoFromGridNo( sLowestGridNo, ( ( ( WORLD_ROWS / 2 ) * WORLD_COLS ) + ( WORLD_COLS / 2 ) ) ); return( sLowestGridNo ); } else @@ -353,11 +350,11 @@ UINT16 FindGridNoFromSweetSpotCloseToExitGrid( SOLDIERTYPE *pSoldier, INT16 sSwe } -UINT16 FindClosestExitGrid( SOLDIERTYPE *pSoldier, INT16 sSrcGridNo, INT8 ubRadius ) +INT16 FindClosestExitGrid( SOLDIERTYPE *pSoldier, INT16 sSrcGridNo, INT8 ubRadius ) { - INT16 sTop, sBottom; - INT16 sLeft, sRight; - INT16 cnt1, cnt2; + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2; INT16 sGridNo; INT32 uiRange, uiLowestRange = 999999; INT16 sLowestGridNo=0; @@ -368,11 +365,11 @@ UINT16 FindClosestExitGrid( SOLDIERTYPE *pSoldier, INT16 sSrcGridNo, INT8 ubRadi sTop = ubRadius; sBottom = -ubRadius; - sLeft = - ubRadius; - sRight = ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; //clear the mapelements of potential residue MAPELEMENT_REACHABLE flags - uiLowestRange = 999999; + uiLowestRange = 999999; for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) { @@ -409,3 +406,4 @@ UINT16 FindClosestExitGrid( SOLDIERTYPE *pSoldier, INT16 sSrcGridNo, INT8 ubRadi } + diff --git a/TileEngine/Exit Grids.h b/TileEngine/Exit Grids.h index 4353b358..bf68f3c8 100644 --- a/TileEngine/Exit Grids.h +++ b/TileEngine/Exit Grids.h @@ -5,17 +5,18 @@ #include "Worlddef.h" typedef struct //for exit grids (object level) -{ //if an item pool is also in same gridno, then this would be a separate levelnode +{ + //if an item pool is also in same gridno, then this would be a separate levelnode //in the object level list - UINT16 usGridNo; //sweet spot for placing mercs in new sector. + INT16 sGridNo; //sweet spot for placing mercs in new sector. UINT8 ubGotoSectorX; UINT8 ubGotoSectorY; UINT8 ubGotoSectorZ; }EXITGRID; -BOOLEAN ExitGridAtGridNo( UINT16 usMapIndex ); -BOOLEAN GetExitGridLevelNode( UINT16 usMapIndex, LEVELNODE **ppLevelNode ); -BOOLEAN GetExitGrid( UINT16 usMapIndex, EXITGRID *pExitGrid ); +BOOLEAN ExitGridAtGridNo( INT16 sMapIndex ); +BOOLEAN GetExitGridLevelNode( INT16 sMapIndex, LEVELNODE **ppLevelNode ); +BOOLEAN GetExitGrid( INT16 sMapIndex, EXITGRID *pExitGrid ); void AddExitGridToWorld( INT32 iMapIndex, EXITGRID *pExitGrid ); void RemoveExitGridFromWorld( INT32 iMapIndex ); @@ -28,10 +29,10 @@ void AttemptToChangeFloorLevel( INT8 bRelativeZLevel ); extern EXITGRID gExitGrid; extern BOOLEAN gfOverrideInsertionWithExitGrid; -// Finds closest ExitGrid of same type as is at gridno, within a radius. Checks +// Finds closest ExitGrid of same type as is at gridno, within a radius. Checks // valid paths, destinations, etc. -UINT16 FindGridNoFromSweetSpotCloseToExitGrid( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ); +INT16 FindGridNoFromSweetSpotCloseToExitGrid( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection ); -UINT16 FindClosestExitGrid( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 ubRadius ); +INT16 FindClosestExitGrid( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 ubRadius ); #endif diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index 3e4e7fad..13b031f6 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -10,10 +10,10 @@ #include "wcheck.h" #include "stdlib.h" #include "debug.h" -#include "soldier control.h" +//#include "soldier control.h" #include "weapons.h" #include "handle items.h" -#include "worlddef.h" +#include "worlddef.h" #include "worldman.h" #include "rotting corpses.h" #include "tile cache.h" @@ -70,6 +70,11 @@ #include "Soldier Macros.h" +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + // MODULE FOR EXPLOSIONS @@ -79,30 +84,30 @@ BOOLEAN ExpAffect( INT16 sBombGridNo, INT16 sGridNo, UINT32 uiDist, UINT16 usIte // Flashbang effect on soldier UINT8 DetermineFlashbangEffect( SOLDIERTYPE *pSoldier, INT8 ubExplosionDir, BOOLEAN fInBuilding); -extern INT8 gbSAMGraphicList[ MAX_NUMBER_OF_SAMS ]; -extern void AddToShouldBecomeHostileOrSayQuoteList( UINT8 ubID ); +extern INT8 gbSAMGraphicList[ MAX_NUMBER_OF_SAMS ]; +extern void AddToShouldBecomeHostileOrSayQuoteList( UINT8 ubID ); extern void RecompileLocalMovementCostsForWall( INT16 sGridNo, UINT8 ubOrientation ); void FatigueCharacter( SOLDIERTYPE *pSoldier ); #define NO_ALT_SOUND -1 -EXPLOSION_DATA gExpAniData[ NUM_EXP_TYPES ] = +EXPLOSION_DATA gExpAniData[ NUM_EXP_TYPES ] = { - // Trans Damage Explosion Alternative Explosion Animation - // Key Key Sound Explosion Animation Speed - // Frame Frame ID SoundID Filename - {0, 0, EXPLOSION_1, EXPLOSION_ALT_BLAST_1, "", 0}, - {17, 3, EXPLOSION_1, EXPLOSION_ALT_BLAST_1, "TILECACHE\\ZGRAV_D.STI", 80}, - {28, 5, EXPLOSION_BLAST_2, NO_ALT_SOUND, "TILECACHE\\ZGRAV_C.STI", 80}, - {24, 5, EXPLOSION_BLAST_2, NO_ALT_SOUND, "TILECACHE\\ZGRAV_B.STI", 80}, - {1, 5, EXPLOSION_1, EXPLOSION_ALT_BLAST_1, "TILECACHE\\shckwave.STI", 20}, - {1, 18, AIR_ESCAPING_1, NO_ALT_SOUND, "TILECACHE\\WAT_EXP.STI", 80}, - {1, 18, AIR_ESCAPING_1, NO_ALT_SOUND, "TILECACHE\\TEAR_EXP.STI", 80}, - {1, 18, AIR_ESCAPING_1, NO_ALT_SOUND, "TILECACHE\\TEAR_EXP.STI", 80}, - {1, 18, AIR_ESCAPING_1, NO_ALT_SOUND, "TILECACHE\\MUST_EXP.STI", 80} + // Trans Damage Explosion Alternative Explosion Animation + // Key Key Sound Explosion Animation Speed + // Frame Frame ID SoundID Filename + {0, 0, EXPLOSION_1, EXPLOSION_ALT_BLAST_1, "", 0}, + {17, 3, EXPLOSION_1, EXPLOSION_ALT_BLAST_1, "TILECACHE\\ZGRAV_D.STI", 80}, + {28, 5, EXPLOSION_BLAST_2, NO_ALT_SOUND, "TILECACHE\\ZGRAV_C.STI", 80}, + {24, 5, EXPLOSION_BLAST_2, NO_ALT_SOUND, "TILECACHE\\ZGRAV_B.STI", 80}, + {1, 5, EXPLOSION_1, EXPLOSION_ALT_BLAST_1, "TILECACHE\\shckwave.STI", 20}, + {1, 18, AIR_ESCAPING_1, NO_ALT_SOUND, "TILECACHE\\WAT_EXP.STI", 80}, + {1, 18, AIR_ESCAPING_1, NO_ALT_SOUND, "TILECACHE\\TEAR_EXP.STI", 80}, + {1, 18, AIR_ESCAPING_1, NO_ALT_SOUND, "TILECACHE\\TEAR_EXP.STI", 80}, + {1, 18, AIR_ESCAPING_1, NO_ALT_SOUND, "TILECACHE\\MUST_EXP.STI", 80} }; -//UINT8 ubTransKeyFrame[ NUM_EXP_TYPES ] = +//UINT8 ubTransKeyFrame[ NUM_EXP_TYPES ] = //{ // 0, // 17, @@ -115,7 +120,7 @@ EXPLOSION_DATA gExpAniData[ NUM_EXP_TYPES ] = // 1, //}; // -//UINT8 ubDamageKeyFrame[ NUM_EXP_TYPES ] = +//UINT8 ubDamageKeyFrame[ NUM_EXP_TYPES ] = //{ // 0, // 3, @@ -133,7 +138,7 @@ EXPLOSION_DATA gExpAniData[ NUM_EXP_TYPES ] = //{ // EXPLOSION_1, // EXPLOSION_1, -// EXPLOSION_BLAST_2, //LARGE +// EXPLOSION_BLAST_2, //LARGE // EXPLOSION_BLAST_2, // EXPLOSION_1, // AIR_ESCAPING_1, @@ -157,7 +162,7 @@ EXPLOSION_DATA gExpAniData[ NUM_EXP_TYPES ] = //}; // //CHAR8 sBlastSpeeds[] = -//{ +//{ // 0, // 80, // 80, @@ -172,22 +177,22 @@ EXPLOSION_DATA gExpAniData[ NUM_EXP_TYPES ] = #define BOMB_QUEUE_DELAY (1000 + Random( 500 ) ) #define MAX_BOMB_QUEUE 40 -ExplosionQueueElement gExplosionQueue[MAX_BOMB_QUEUE]; -UINT8 gubElementsOnExplosionQueue = 0; -BOOLEAN gfExplosionQueueActive = FALSE; +ExplosionQueueElement gExplosionQueue[MAX_BOMB_QUEUE]; +UINT8 gubElementsOnExplosionQueue = 0; +BOOLEAN gfExplosionQueueActive = FALSE; -BOOLEAN gfExplosionQueueMayHaveChangedSight = FALSE; -UINT8 gubPersonToSetOffExplosions = NOBODY; +BOOLEAN gfExplosionQueueMayHaveChangedSight = FALSE; +UINT8 gubPersonToSetOffExplosions = NOBODY; -INT16 gsTempActionGridNo = NOWHERE; +INT16 gsTempActionGridNo = NOWHERE; extern UINT8 gubInterruptProvoker; -#define NUM_EXPLOSION_SLOTS 100 +#define NUM_EXPLOSION_SLOTS 100 // GLOBAL FOR SMOKE LISTING -EXPLOSIONTYPE gExplosionData[ NUM_EXPLOSION_SLOTS ]; -UINT32 guiNumExplosions = 0; +EXPLOSIONTYPE gExplosionData[ NUM_EXPLOSION_SLOTS ]; +UINT32 guiNumExplosions = 0; INT32 GetFreeExplosion( void ); @@ -245,13 +250,13 @@ void InternalIgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT16 // Okay, we either got an explosive or a real attacker to check for. // Let's check for the attacker first. - if ( ubOwner != NOBODY ) + if ( ubOwner != NOBODY ) { - if ( !( Item[ usItem ].usItemClass & IC_EXPLOSV ) && AmmoTypes[MercPtrs[ubOwner]->inv[MercPtrs[ubOwner]->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize < 2 ) + if ( !( Item[ usItem ].usItemClass & IC_EXPLOSV ) && AmmoTypes[MercPtrs[ubOwner]->inv[MercPtrs[ubOwner]->ubAttackingHand ][0]->data.gun.ubGunAmmoType].explosionSize < 2 ) { return; // no explosive and attackers gun is not fireing HE } - } + } // Increment attack counter... if (gubElementsOnExplosionQueue == 0) @@ -268,28 +273,28 @@ void InternalIgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT16 // OK, go on! - ExpParams.uiFlags = EXPLOSION_FLAG_USEABSPOS; - ExpParams.ubOwner = ubOwner; + ExpParams.uiFlags = EXPLOSION_FLAG_USEABSPOS; + ExpParams.ubOwner = ubOwner; // No explosive but an attacker with HE ammo. if ( !( Item[ usItem ].usItemClass & IC_EXPLOSV ) && ubOwner != NOBODY) { - ExpParams.ubTypeID = (INT8)Explosive[AmmoTypes[MercPtrs[ubOwner]->inv[MercPtrs[ubOwner]->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].highExplosive].ubAnimationID; + ExpParams.ubTypeID = (INT8)Explosive[AmmoTypes[MercPtrs[ubOwner]->inv[MercPtrs[ubOwner]->ubAttackingHand ][0]->data.gun.ubGunAmmoType].highExplosive].ubAnimationID; // return; } else // just normal explosives should get here { ExpParams.ubTypeID = (INT8)Explosive[ Item[ usItem ].ubClassIndex ].ubAnimationID; - } + } // Callahan end - ExpParams.sX = sX; - ExpParams.sY = sY; - ExpParams.sZ = sZ; - ExpParams.sGridNo = sGridNo; - ExpParams.usItem = usItem; - ExpParams.fLocate = fLocate; - ExpParams.bLevel = bLevel; + ExpParams.sX = sX; + ExpParams.sY = sY; + ExpParams.sZ = sZ; + ExpParams.sGridNo = sGridNo; + ExpParams.usItem = usItem; + ExpParams.fLocate = fLocate; + ExpParams.bLevel = bLevel; GenerateExplosion( &ExpParams ); } @@ -305,28 +310,28 @@ void IgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT16 sGridNo void GenerateExplosion( EXPLOSION_PARAMS *pExpParams ) { - EXPLOSIONTYPE *pExplosion; - UINT32 uiFlags; - UINT8 ubOwner; - UINT8 ubTypeID; - INT16 sX; - INT16 sY; - INT16 sZ; - INT16 sGridNo; - UINT16 usItem; - INT32 iIndex; - INT8 bLevel; + EXPLOSIONTYPE *pExplosion; + UINT32 uiFlags; + UINT8 ubOwner; + UINT8 ubTypeID; + INT16 sX; + INT16 sY; + INT16 sZ; + INT16 sGridNo; + UINT16 usItem; + INT32 iIndex; + INT8 bLevel; // Assign param values - uiFlags = pExpParams->uiFlags; - ubOwner = pExpParams->ubOwner; - ubTypeID = pExpParams->ubTypeID; - sX = pExpParams->sX; - sY = pExpParams->sY; - sZ = pExpParams->sZ; - sGridNo = pExpParams->sGridNo; - usItem = pExpParams->usItem; - bLevel = pExpParams->bLevel; + uiFlags = pExpParams->uiFlags; + ubOwner = pExpParams->ubOwner; + ubTypeID = pExpParams->ubTypeID; + sX = pExpParams->sX; + sY = pExpParams->sY; + sZ = pExpParams->sZ; + sGridNo = pExpParams->sGridNo; + usItem = pExpParams->usItem; + bLevel = pExpParams->bLevel; { @@ -344,7 +349,7 @@ void GenerateExplosion( EXPLOSION_PARAMS *pExpParams ) memset( pExplosion, 0, sizeof( EXPLOSIONTYPE ) ); // Setup some data... - memcpy( &(pExplosion->Params), pExpParams, sizeof( EXPLOSION_PARAMS ) ); + memcpy( &(pExplosion->Params), pExpParams, sizeof( EXPLOSION_PARAMS ) ); pExplosion->fAllocated = TRUE; pExplosion->iID = iIndex; @@ -361,30 +366,30 @@ void GenerateExplosion( EXPLOSION_PARAMS *pExpParams ) void GenerateExplosionFromExplosionPointer( EXPLOSIONTYPE *pExplosion ) { - UINT32 uiFlags; - UINT8 ubOwner; - UINT8 ubTypeID; - INT16 sX; - INT16 sY; - INT16 sZ; - INT16 sGridNo; - UINT16 usItem; - UINT8 ubTerrainType; - INT8 bLevel; - UINT32 uiSoundID; + UINT32 uiFlags; + UINT8 ubOwner; + UINT8 ubTypeID; + INT16 sX; + INT16 sY; + INT16 sZ; + INT16 sGridNo; + UINT16 usItem; + UINT8 ubTerrainType; + INT8 bLevel; + UINT32 uiSoundID; ANITILE_PARAMS AniParams; // Assign param values - uiFlags = pExplosion->Params.uiFlags; - ubOwner = pExplosion->Params.ubOwner; - ubTypeID = pExplosion->Params.ubTypeID; - sX = pExplosion->Params.sX; - sY = pExplosion->Params.sY; - sZ = pExplosion->Params.sZ; - sGridNo = pExplosion->Params.sGridNo; - usItem = pExplosion->Params.usItem; - bLevel = pExplosion->Params.bLevel; + uiFlags = pExplosion->Params.uiFlags; + ubOwner = pExplosion->Params.ubOwner; + ubTypeID = pExplosion->Params.ubTypeID; + sX = pExplosion->Params.sX; + sY = pExplosion->Params.sY; + sZ = pExplosion->Params.sZ; + sGridNo = pExplosion->Params.sGridNo; + usItem = pExplosion->Params.usItem; + bLevel = pExplosion->Params.bLevel; // If Z value given is 0 and bLevel > 0, make z heigher if ( sZ == 0 && bLevel > 0 ) @@ -400,11 +405,11 @@ void GenerateExplosionFromExplosionPointer( EXPLOSIONTYPE *pExplosion ) // Setup explosion! memset( &AniParams, 0, sizeof( ANITILE_PARAMS ) ); - AniParams.sGridNo = sGridNo; - AniParams.ubLevelID = ANI_TOPMOST_LEVEL; - AniParams.sDelay = gExpAniData[ ubTypeID ].sBlastSpeed; // Lesh: edit this line + AniParams.sGridNo = sGridNo; + AniParams.ubLevelID = ANI_TOPMOST_LEVEL; + AniParams.sDelay = gExpAniData[ ubTypeID ].sBlastSpeed; // Lesh: edit this line AniParams.sStartFrame = pExplosion->sCurrentFrame; - AniParams.uiFlags = ANITILE_CACHEDTILE | ANITILE_FORWARD | ANITILE_EXPLOSION; + AniParams.uiFlags = ANITILE_CACHEDTILE | ANITILE_FORWARD | ANITILE_EXPLOSION; if ( TERRAIN_IS_WATER(ubTerrainType) ) { @@ -421,19 +426,19 @@ void GenerateExplosionFromExplosionPointer( EXPLOSIONTYPE *pExplosion ) if ( uiFlags & EXPLOSION_FLAG_USEABSPOS ) { - AniParams.sX = sX; - AniParams.sY = sY; - AniParams.sZ = sZ; + AniParams.sX = sX; + AniParams.sY = sY; + AniParams.sZ = sZ; - //AniParams.uiFlags |= ANITILE_USEABSOLUTEPOS; + //AniParams.uiFlags |= ANITILE_USEABSOLUTEPOS; } - AniParams.ubKeyFrame1 = gExpAniData[ ubTypeID ].ubTransKeyFrame; // Lesh: edit this line + AniParams.ubKeyFrame1 = gExpAniData[ ubTypeID ].ubTransKeyFrame; // Lesh: edit this line AniParams.uiKeyFrame1Code = ANI_KEYFRAME_BEGIN_TRANSLUCENCY; if ( !( uiFlags & EXPLOSION_FLAG_DISPLAYONLY ) ) { - AniParams.ubKeyFrame2 = gExpAniData[ ubTypeID ].ubDamageKeyFrame; // Lesh: edit this line + AniParams.ubKeyFrame2 = gExpAniData[ ubTypeID ].ubDamageKeyFrame; // Lesh: edit this line AniParams.uiKeyFrame2Code = ANI_KEYFRAME_BEGIN_DAMAGE; } AniParams.uiUserData = usItem; @@ -443,15 +448,15 @@ void GenerateExplosionFromExplosionPointer( EXPLOSIONTYPE *pExplosion ) strcpy( AniParams.zCachedFile, gExpAniData[ ubTypeID ].zBlastFilename ); // Lesh: edit this line - // A little safety here, for just in case. If it fails to create an explosion tile, don't increase the attack busy count. - // But if it succeeds, do it here. Don't futz with the count in other locations when it can be centralized! + // A little safety here, for just in case. If it fails to create an explosion tile, don't increase the attack busy count. + // But if it succeeds, do it here. Don't futz with the count in other locations when it can be centralized! if (CreateAnimationTile( &AniParams ) ) { gTacticalStatus.ubAttackBusyCount++; - DebugAttackBusy( String( "Explosion started. Incrementing attack busy, now %d\n", gTacticalStatus.ubAttackBusyCount ) ); + DebugAttackBusy( String( "Explosion started. Incrementing attack busy, now %d\n", gTacticalStatus.ubAttackBusyCount ) ); } - // set light source for flashbangs.... or... + // set light source for flashbangs.... or... if ( pExplosion->Params.ubTypeID == FLASHBANG_EXP ) { pExplosion->iLightID = LightSpriteCreate("FLSHBANG.LHT", 0 ); @@ -466,9 +471,9 @@ void GenerateExplosionFromExplosionPointer( EXPLOSIONTYPE *pExplosion ) if( pExplosion->iLightID != -1 ) { - LightSpritePower ( pExplosion->iLightID, TRUE ); + LightSpritePower ( pExplosion->iLightID, TRUE ); LightSpriteRoofStatus( pExplosion->iLightID, pExplosion->Params.bLevel ); - LightSpritePosition ( pExplosion->iLightID, (INT16)(sX/CELL_X_SIZE), (INT16)(sY/CELL_Y_SIZE) ); + LightSpritePosition ( pExplosion->iLightID, (INT16)(sX/CELL_X_SIZE), (INT16)(sY/CELL_Y_SIZE) ); } // Lesh: sound randomization @@ -484,7 +489,7 @@ void GenerateExplosionFromExplosionPointer( EXPLOSIONTYPE *pExplosion ) } // Lesh: sound randomization ends - PlayJA2Sample( uiSoundID, RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); + PlayJA2Sample( uiSoundID, RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); } @@ -523,7 +528,7 @@ void HandleFencePartnerCheck( INT16 sStructGridNo ) { STRUCTURE *pFenceStructure, *pFenceBaseStructure; LEVELNODE *pFenceNode; - INT8 bFenceDestructionPartner = -1; + INT8 bFenceDestructionPartner = -1; UINT32 uiFenceType; UINT16 usTileIndex; @@ -546,7 +551,7 @@ void HandleFencePartnerCheck( INT16 sStructGridNo ) bFenceDestructionPartner = -1 * ( pFenceBaseStructure->pDBStructureRef->pDBStructure->bDestructionPartner ); // Get new index - GetTileIndexFromTypeSubIndex( uiFenceType, (INT8)( bFenceDestructionPartner ), &usTileIndex ); + GetTileIndexFromTypeSubIndex( uiFenceType, (INT8)( bFenceDestructionPartner ), &usTileIndex ); //Set a flag indicating that the following changes are to go the the maps, temp file ApplyMapChangesToMapTempFile( TRUE ); @@ -565,21 +570,21 @@ void HandleFencePartnerCheck( INT16 sStructGridNo ) -BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNextCurrent, INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLEAN *pfRecompileMovementCosts, BOOLEAN fOnlyWalls, BOOLEAN fSubSequentMultiTilesTransitionDamage, UINT8 ubOwner, INT8 bLevel ) +BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNextCurrent, INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLEAN *pfRecompileMovementCosts, BOOLEAN fOnlyWalls, BOOLEAN fSubSequentMultiTilesTransitionDamage, UINT8 ubOwner, INT8 bLevel ) { INT16 sX, sY; - STRUCTURE *pBase, *pWallStruct, *pAttached, *pAttachedBase; + STRUCTURE *pBase, *pWallStruct, *pAttached, *pAttachedBase; LEVELNODE *pNode = NULL, *pNewNode = NULL, *pAttachedNode; INT16 sNewGridNo, sStructGridNo; INT16 sNewIndex, sSubIndex; UINT16 usObjectIndex, usTileIndex; - UINT8 ubNumberOfTiles, ubLoop; + UINT8 ubNumberOfTiles, ubLoop; DB_STRUCTURE_TILE ** ppTile; INT8 bDestructionPartner=-1; - INT8 bDamageReturnVal; + INT8 bDamageReturnVal; BOOLEAN fContinue; UINT32 uiTileType; - INT16 sBaseGridNo; + INT16 sBaseGridNo; BOOLEAN fExplosive; // ATE: Check for O3 statue for special damage.. @@ -692,7 +697,7 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe // debris... if ( bDestructionPartner > 39 ) { - GetTileIndexFromTypeSubIndex( SECONDEXPLDEBRIS, (INT8)( bDestructionPartner - 40 ), &usTileIndex ); + GetTileIndexFromTypeSubIndex( SECONDEXPLDEBRIS, (INT8)( bDestructionPartner - 40 ), &usTileIndex ); } else { @@ -766,9 +771,9 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe case OUTSIDE_TOP_RIGHT: case INSIDE_TOP_RIGHT: - sStructGridNo = NewGridNo( pBase->sGridNo, DirectionInc( SOUTH ) ); + sStructGridNo = NewGridNo( pBase->sGridNo, DirectionInc( SOUTH ) ); HandleFencePartnerCheck( sStructGridNo ); - sStructGridNo = NewGridNo( pBase->sGridNo, DirectionInc( NORTH ) ); + sStructGridNo = NewGridNo( pBase->sGridNo, DirectionInc( NORTH ) ); HandleFencePartnerCheck( sStructGridNo ); break; @@ -1089,8 +1094,8 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe // CJC, Sept 16: if we destroy any wall of the brothel, make Kingpin's men hostile! if ( gWorldSectorX == 5 && gWorldSectorY == MAP_ROW_C && gbWorldSectorZ == 0 ) { - UINT8 ubRoom; - BOOLEAN fInRoom; + UINT8 ubRoom; + BOOLEAN fInRoom; fInRoom = InARoom( sGridNo, &ubRoom ); if ( !fInRoom ) @@ -1112,7 +1117,7 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe } - // OK, we need to remove the water from the fountain + // OK, we need to remove the water from the fountain // Lots of HARD CODING HERE :( // Get tile type GetTileType( pNode->usIndex, &uiTileType ); @@ -1154,7 +1159,7 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe { // We have a levelnode... // Get new index for new grpahic.... - GetTileIndexFromTypeSubIndex( uiTileType, bDestructionPartner, &usTileIndex ); + GetTileIndexFromTypeSubIndex( uiTileType, bDestructionPartner, &usTileIndex ); ApplyMapChangesToMapTempFile( TRUE ); @@ -1211,24 +1216,24 @@ STRUCTURE *gStruct; void ExplosiveDamageGridNo( INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLEAN *pfRecompileMovementCosts, BOOLEAN fOnlyWalls, INT8 bMultiStructSpecialFlag, BOOLEAN fSubSequentMultiTilesTransitionDamage, UINT8 ubOwner, INT8 bLevel ) { - STRUCTURE * pCurrent, *pNextCurrent, *pStructure; - STRUCTURE * pBaseStructure; - INT16 sDesiredLevel; - DB_STRUCTURE_TILE **ppTile = NULL; - UINT8 ubLoop, ubLoop2; - INT16 sNewGridNo, sNewGridNo2, sBaseGridNo = NOWHERE; - BOOLEAN fToBreak = FALSE; - BOOLEAN fMultiStructure = FALSE; - UINT8 ubNumberOfTiles = 0xff; - BOOLEAN fMultiStructSpecialFlag = FALSE; - BOOLEAN fExplodeDamageReturn = FALSE; + STRUCTURE * pCurrent, *pNextCurrent, *pStructure; + STRUCTURE * pBaseStructure; + INT16 sDesiredLevel; + DB_STRUCTURE_TILE **ppTile; + UINT8 ubLoop, ubLoop2; + INT16 sNewGridNo, sNewGridNo2, sBaseGridNo; + BOOLEAN fToBreak = FALSE; + BOOLEAN fMultiStructure = FALSE; + UINT8 ubNumberOfTiles; + BOOLEAN fMultiStructSpecialFlag = FALSE; + BOOLEAN fExplodeDamageReturn = FALSE; // Based on distance away, damage any struct at this gridno // OK, loop through structures and damage! - pCurrent = gpWorldLevelData[ sGridNo ].pStructureHead; - sDesiredLevel = STRUCTURE_ON_GROUND; + pCurrent = gpWorldLevelData[ sGridNo ].pStructureHead; + sDesiredLevel = STRUCTURE_ON_GROUND; - // This code gets a little hairy because + // This code gets a little hairy because // (1) we might need to destroy the currently-examined structure while (pCurrent != NULL) { @@ -1259,6 +1264,9 @@ void ExplosiveDamageGridNo( INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLE else { fMultiStructure = FALSE; + sBaseGridNo = 0; + ubNumberOfTiles = 0; + ppTile = 0; } pNextCurrent = pCurrent->pNext; @@ -1267,7 +1275,7 @@ void ExplosiveDamageGridNo( INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLE // Check level! if (pCurrent->sCubeOffset == sDesiredLevel ) { - fExplodeDamageReturn = ExplosiveDamageStructureAtGridNo( pCurrent, &pNextCurrent, sGridNo, sWoundAmt, uiDist, pfRecompileMovementCosts, fOnlyWalls, 0, ubOwner, bLevel ); + fExplodeDamageReturn = ExplosiveDamageStructureAtGridNo( pCurrent, &pNextCurrent, sGridNo, sWoundAmt, uiDist, pfRecompileMovementCosts, fOnlyWalls, 0, ubOwner, bLevel ); // Are we overwriting damage due to multi-tile...? if ( fExplodeDamageReturn ) @@ -1292,7 +1300,7 @@ void ExplosiveDamageGridNo( INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLE // part unless fExplodeDamageReturn was actually set. When it was being executed, tossing a grenade just behind the // plane in Drassen, for instance, would cause an infinite recursion in this code. The reason is that the plane's // armor is (amazingly enough) stronger than a grenade blast can even damage. This code here seems to rely on the - // structure in question being destroyed by the blast since it indiscriminently recurses on neighbors, creating a + // structure in question being destroyed by the blast since it indiscriminently recurses on neighbors, creating a // ping pong on two adjacent parts of the plane. Probably the reason this was not found before is that fExplodeDamageReturn // was uninitialized before and usually was non-zero. Now it is initialized to false. @@ -1323,7 +1331,7 @@ void ExplosiveDamageGridNo( INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLE if ( sNewGridNo2 != sNewGridNo && sNewGridNo2 != sGridNo ) { pStructure = FindStructure( sNewGridNo2, STRUCTURE_MULTI ); - if ( pStructure ) + if ( pStructure ) { fMultiStructSpecialFlag = ( ( pStructure->fFlags & STRUCTURE_SPECIAL ) != 0 ); @@ -1378,9 +1386,9 @@ BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT16 sBombGridNo BOOLEAN fFlashbang = Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_FLASHBANG; UINT16 usHalfExplosionRadius; - pSoldier = MercPtrs[ ubPerson ]; // someone is here, and they're gonna get hurt + pSoldier = MercPtrs[ ubPerson ]; // someone is here, and they're gonna get hurt - if (!pSoldier->bActive || !pSoldier->bInSector || !pSoldier->bLife ) + if (!pSoldier->bActive || !pSoldier->bInSector || !pSoldier->stats.bLife ) return( FALSE ); if ( pSoldier->ubMiscSoldierFlags & SOLDIER_MISC_HURT_BY_EXPLOSION ) @@ -1402,7 +1410,7 @@ BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT16 sBombGridNo ubDirection = (UINT8)GetDirectionFromGridNo( sBombGridNo, pSoldier ); // Increment attack counter... - // gTacticalStatus.ubAttackBusyCount++; + // gTacticalStatus.ubAttackBusyCount++; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Incrementing Attack: Explosion dishing out damage, Count now %d", gTacticalStatus.ubAttackBusyCount ) ); DebugAttackBusy( String("Explosion dishing out damage to %d\n", pSoldier->ubID) ); @@ -1418,7 +1426,7 @@ BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT16 sBombGridNo ubSpecial = DetermineFlashbangEffect( pSoldier, ubDirection, fInBuilding); } - EVENT_SoldierGotHit( pSoldier, usItem, sNewWoundAmt, sBreathAmt, ubDirection, (INT16)uiDist, ubOwner, ubSpecial, ANIM_CROUCH, sSubsequent, sBombGridNo ); + pSoldier->EVENT_SoldierGotHit( usItem, sNewWoundAmt, sBreathAmt, ubDirection, (INT16)uiDist, ubOwner, ubSpecial, ANIM_CROUCH, sSubsequent, sBombGridNo ); pSoldier->ubMiscSoldierFlags |= SOLDIER_MISC_HURT_BY_EXPLOSION; @@ -1432,29 +1440,29 @@ BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT16 sBombGridNo BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, UINT8 ubOwner ) { - INT8 bPosOfMask = NO_SLOT; + INT8 bPosOfMask = NO_SLOT; - if (!pSoldier->bActive || !pSoldier->bInSector || !pSoldier->bLife || AM_A_ROBOT( pSoldier ) ) + if (!pSoldier->bActive || !pSoldier->bInSector || !pSoldier->stats.bLife || AM_A_ROBOT( pSoldier ) ) { return( fRecompileMovementCosts ); } if ( pExplosive->ubType == EXPLOSV_CREATUREGAS || pExplosive->ubType == EXPLOSV_BURNABLEGAS) { - if ( pSoldier->uiStatusFlags & SOLDIER_MONSTER ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_MONSTER ) { // unaffected by own gas effects return( fRecompileMovementCosts ); } - if ( sSubsequent && pSoldier->fHitByGasFlags & HIT_BY_CREATUREGAS ) + if ( sSubsequent && pSoldier->flags.fHitByGasFlags & HIT_BY_CREATUREGAS ) { // already affected by creature gas this turn - return( fRecompileMovementCosts ); + return( fRecompileMovementCosts ); } - if ( sSubsequent && pSoldier->fHitByGasFlags & HIT_BY_BURNABLEGAS ) + if ( sSubsequent && pSoldier->flags.fHitByGasFlags & HIT_BY_BURNABLEGAS ) { // already affected by BURNABLEGAS this turn - return( fRecompileMovementCosts ); + return( fRecompileMovementCosts ); } } @@ -1468,11 +1476,11 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN return( fRecompileMovementCosts ); } - // ignore whether subsequent or not if hit this turn - if ( pSoldier->fHitByGasFlags & HIT_BY_TEARGAS ) + // ignore whether subsequent or not if hit this turn + if ( pSoldier->flags.fHitByGasFlags & HIT_BY_TEARGAS ) { // already affected by creature gas this turn - return( fRecompileMovementCosts ); + return( fRecompileMovementCosts ); } } else if ( pExplosive->ubType == EXPLOSV_MUSTGAS ) @@ -1482,55 +1490,55 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN return( fRecompileMovementCosts ); } - if ( sSubsequent && pSoldier->fHitByGasFlags & HIT_BY_MUSTARDGAS ) + if ( sSubsequent && pSoldier->flags.fHitByGasFlags & HIT_BY_MUSTARDGAS ) { // already affected by creature gas this turn - return( fRecompileMovementCosts ); + return( fRecompileMovementCosts ); } } bPosOfMask = FindGasMask(pSoldier); - if ( bPosOfMask == NO_SLOT || pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] < USABLE ) + if ( bPosOfMask == NO_SLOT || pSoldier->inv[ bPosOfMask ][0]->data.objectStatus < USABLE ) { bPosOfMask = NO_SLOT; } - //if ( pSoldier->inv[ HEAD1POS ].usItem == GASMASK && pSoldier->inv[ HEAD1POS ].bStatus[0] >= USABLE ) + //if ( pSoldier->inv[ HEAD1POS ].usItem == GASMASK && pSoldier->inv[ HEAD1POS ][0]->data.objectStatus >= USABLE ) //{ // bPosOfMask = HEAD1POS; //} - //else if ( pSoldier->inv[ HEAD2POS ].usItem == GASMASK && pSoldier->inv[ HEAD2POS ].bStatus[0] >= USABLE ) + //else if ( pSoldier->inv[ HEAD2POS ].usItem == GASMASK && pSoldier->inv[ HEAD2POS ][0]->data.objectStatus >= USABLE ) //{ // bPosOfMask = HEAD2POS; //} - if ( bPosOfMask != NO_SLOT ) + if ( bPosOfMask != NO_SLOT ) { - if ( pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] < GASMASK_MIN_STATUS ) + if ( pSoldier->inv[ bPosOfMask ][0]->data.objectStatus < GASMASK_MIN_STATUS ) { // GAS MASK reduces breath loss by its work% (it leaks if not at least 70%) - sBreathAmt = ( sBreathAmt * ( 100 - pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] ) ) / 100; + sBreathAmt = ( sBreathAmt * ( 100 - pSoldier->inv[ bPosOfMask ][0]->data.objectStatus ) ) / 100; if ( sBreathAmt > 500 ) { // if at least 500 of breath damage got through // the soldier within the blast radius is gassed for at least one // turn, possibly more if it's tear gas (which hangs around a while) - pSoldier->uiStatusFlags |= SOLDIER_GASSED; + pSoldier->flags.uiStatusFlags |= SOLDIER_GASSED; } - if ( pSoldier->uiStatusFlags & SOLDIER_PC ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_PC ) { if ( sWoundAmt > 1 ) { - pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] = - pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] - (INT8) Random( 4 ); - sWoundAmt = ( sWoundAmt * ( 100 - pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] ) ) / 100; + pSoldier->inv[ bPosOfMask ][0]->data.objectStatus = + pSoldier->inv[ bPosOfMask ][0]->data.objectStatus - (INT8) Random( 4 ); + sWoundAmt = ( sWoundAmt * ( 100 - pSoldier->inv[ bPosOfMask ][0]->data.objectStatus ) ) / 100; } else if ( sWoundAmt == 1 ) { - pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] = - pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] - (INT8) Random( 2 ); + pSoldier->inv[ bPosOfMask ][0]->data.objectStatus = + pSoldier->inv[ bPosOfMask ][0]->data.objectStatus - (INT8) Random( 2 ); } } } @@ -1541,17 +1549,17 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN { if ( sWoundAmt == 1 ) { - pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] = - pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] - (INT8) Random( 2 ); + pSoldier->inv[ bPosOfMask ][0]->data.objectStatus = + pSoldier->inv[ bPosOfMask ][0]->data.objectStatus - (INT8) Random( 2 ); } else { // use up gas mask - pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] = - pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] - (INT8) Random( 4 ); + pSoldier->inv[ bPosOfMask ][0]->data.objectStatus = + pSoldier->inv[ bPosOfMask ][0]->data.objectStatus - (INT8) Random( 4 ); } } - sWoundAmt = 0; + sWoundAmt = 0; } } @@ -1562,29 +1570,29 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN switch( pExplosive->ubType ) { case EXPLOSV_CREATUREGAS: - pSoldier->fHitByGasFlags |= HIT_BY_CREATUREGAS; + pSoldier->flags.fHitByGasFlags |= HIT_BY_CREATUREGAS; break; case EXPLOSV_TEARGAS: - pSoldier->fHitByGasFlags |= HIT_BY_TEARGAS; + pSoldier->flags.fHitByGasFlags |= HIT_BY_TEARGAS; break; case EXPLOSV_MUSTGAS: - pSoldier->fHitByGasFlags |= HIT_BY_MUSTARDGAS; + pSoldier->flags.fHitByGasFlags |= HIT_BY_MUSTARDGAS; break; case EXPLOSV_BURNABLEGAS: - pSoldier->fHitByGasFlags |= HIT_BY_BURNABLEGAS; + pSoldier->flags.fHitByGasFlags |= HIT_BY_BURNABLEGAS; break; default: break; } - //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"ExpControl pSoldier->fHitByGasFlags: %d", pSoldier->fHitByGasFlags ); + //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"ExpControl pSoldier->flags.fHitByGasFlags: %d", pSoldier->flags.fHitByGasFlags ); // a gas effect, take damage directly... - SoldierTakeDamage( pSoldier, ANIM_STAND, sWoundAmt, sBreathAmt, TAKE_DAMAGE_GAS, NOBODY, NOWHERE, 0, TRUE ); + pSoldier->SoldierTakeDamage( ANIM_STAND, sWoundAmt, sBreathAmt, TAKE_DAMAGE_GAS, NOBODY, NOWHERE, 0, TRUE ); - if ( pSoldier->bLife >= CONSCIOUSNESS ) + if ( pSoldier->stats.bLife >= CONSCIOUSNESS ) { - DoMercBattleSound( pSoldier, (INT8)( BATTLE_SOUND_HIT1 + Random( 2 ) ) ); + pSoldier->DoMercBattleSound( (INT8)( BATTLE_SOUND_HIT1 + Random( 2 ) ) ); } if ( ubOwner != NOBODY && MercPtrs[ ubOwner ]->bTeam == gbPlayerNum && pSoldier->bTeam != gbPlayerNum ) @@ -1595,7 +1603,7 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN return( fRecompileMovementCosts ); } -BOOLEAN ExpAffect( INT16 sBombGridNo, INT16 sGridNo, UINT32 uiDist, UINT16 usItem, UINT8 ubOwner, INT16 sSubsequent, BOOLEAN *pfMercHit, INT8 bLevel, INT32 iSmokeEffectID ) +BOOLEAN ExpAffect( INT16 sBombGridNo, INT16 sGridNo, UINT32 uiDist, UINT16 usItem, UINT8 ubOwner, INT16 sSubsequent, BOOLEAN *pfMercHit, INT8 bLevel, INT32 iSmokeEffectID ) { INT16 sWoundAmt = 0,sBreathAmt = 0, /* sNewWoundAmt = 0, sNewBreathAmt = 0, */ sStructDmgAmt; UINT8 ubPerson; @@ -1604,7 +1612,7 @@ BOOLEAN ExpAffect( INT16 sBombGridNo, INT16 sGridNo, UINT32 uiDist, UINT16 usIte INT16 sX, sY; BOOLEAN fRecompileMovementCosts = FALSE; BOOLEAN fSmokeEffect = FALSE; - BOOLEAN fStunEffect = FALSE; + BOOLEAN fStunEffect = FALSE; BOOLEAN fBlastEffect = TRUE; BOOLEAN fBloodEffect = FALSE; INT8 bSmokeEffectType = 0; @@ -1617,52 +1625,52 @@ BOOLEAN ExpAffect( INT16 sBombGridNo, INT16 sGridNo, UINT32 uiDist, UINT16 usIte if ( sSubsequent == BLOOD_SPREAD_EFFECT ) { - fSmokeEffect = FALSE; - fBlastEffect = FALSE; - fBloodEffect = TRUE; + fSmokeEffect = FALSE; + fBlastEffect = FALSE; + fBloodEffect = TRUE; } else { // Turn off blast effect if some types of items... - switch( Explosive[Item[usItem].ubClassIndex].ubType ) + switch( Explosive[Item[usItem].ubClassIndex].ubType ) { case EXPLOSV_MUSTGAS: - fSmokeEffect = TRUE; - bSmokeEffectType = MUSTARDGAS_SMOKE_EFFECT; - fBlastEffect = FALSE; + fSmokeEffect = TRUE; + bSmokeEffectType = MUSTARDGAS_SMOKE_EFFECT; + fBlastEffect = FALSE; break; case EXPLOSV_BURNABLEGAS: - fSmokeEffect = TRUE; - bSmokeEffectType = BURNABLEGAS_SMOKE_EFFECT; - fBlastEffect = FALSE; + fSmokeEffect = TRUE; + bSmokeEffectType = BURNABLEGAS_SMOKE_EFFECT; + fBlastEffect = FALSE; break; case EXPLOSV_TEARGAS: - fSmokeEffect = TRUE; - bSmokeEffectType = TEARGAS_SMOKE_EFFECT; - fBlastEffect = FALSE; + fSmokeEffect = TRUE; + bSmokeEffectType = TEARGAS_SMOKE_EFFECT; + fBlastEffect = FALSE; break; case EXPLOSV_SMOKE: - fSmokeEffect = TRUE; - bSmokeEffectType = NORMAL_SMOKE_EFFECT; - fBlastEffect = FALSE; + fSmokeEffect = TRUE; + bSmokeEffectType = NORMAL_SMOKE_EFFECT; + fBlastEffect = FALSE; break; case EXPLOSV_STUN: - fStunEffect = TRUE; + fStunEffect = TRUE; break; case EXPLOSV_CREATUREGAS: - fSmokeEffect = TRUE; - bSmokeEffectType = CREATURE_SMOKE_EFFECT; - fBlastEffect = FALSE; + fSmokeEffect = TRUE; + bSmokeEffectType = CREATURE_SMOKE_EFFECT; + fBlastEffect = FALSE; break; } } @@ -1726,7 +1734,7 @@ BOOLEAN ExpAffect( INT16 sBombGridNo, INT16 sGridNo, UINT32 uiDist, UINT16 usIte { if ( Item[ usItem ].usItemClass & IC_GRENADE ) { - sStructDmgAmt = sWoundAmt / 3; + sStructDmgAmt = sWoundAmt / 3; } else // most explosives { @@ -1767,7 +1775,7 @@ BOOLEAN ExpAffect( INT16 sBombGridNo, INT16 sGridNo, UINT32 uiDist, UINT16 usIte } // NB radius can be 0 so cannot divide it by 2 here - if (!fStunEffect && (uiDist * 2 <= pExplosive->ubRadius) ) + if (!fStunEffect && (uiDist * 2 <= pExplosive->ubRadius) ) { GetItemPool( sGridNo, &pItemPool, bLevel ); @@ -1775,7 +1783,7 @@ BOOLEAN ExpAffect( INT16 sBombGridNo, INT16 sGridNo, UINT32 uiDist, UINT16 usIte { pItemPoolNext = pItemPool->pNext; - if ( DamageItemOnGround( &(gWorldItems[ pItemPool->iItemIndex ].o), sGridNo, bLevel, (INT32) (sWoundAmt * 2), ubOwner ) ) + if ( DamageItemOnGround( &(gWorldItems[ pItemPool->iItemIndex ].object), sGridNo, bLevel, (INT32) (sWoundAmt * 2), ubOwner ) ) { // item was destroyed RemoveItemFromPool( sGridNo, pItemPool->iItemIndex, bLevel ); @@ -1788,11 +1796,11 @@ BOOLEAN ExpAffect( INT16 sBombGridNo, INT16 sGridNo, UINT32 uiDist, UINT16 usIte while ( ( iWorldItem = GetItemOfClassTypeInPool( sGridNo, IC_EXPLOSV, bLevel ) ) != -1 ) { // Get usItem - usItem = gWorldItems[ iWorldItem ].o.usItem; + usItem = gWorldItems[ iWorldItem ].object.usItem; DamageItem - if ( CheckForChainReaction( usItem, gWorldItems[ iWorldItem ].o.bStatus[0], sWoundAmt, TRUE ) ) + if ( CheckForChainReaction( usItem, gWorldItems[ iWorldItem ].object[0]->data.objectStatus, sWoundAmt, TRUE ) ) { RemoveItemFromPool( sGridNo, iWorldItem, bLevel ); @@ -1869,26 +1877,26 @@ BOOLEAN ExpAffect( INT16 sBombGridNo, INT16 sGridNo, UINT32 uiDist, UINT16 usIte return( fRecompileMovementCosts ); } - pSoldier = MercPtrs[ ubPerson ]; // someone is here, and they're gonna get hurt + pSoldier = MercPtrs[ ubPerson ]; // someone is here, and they're gonna get hurt fRecompileMovementCosts = DishOutGasDamage( pSoldier, pExplosive, sSubsequent, fRecompileMovementCosts, sWoundAmt, sBreathAmt, ubOwner ); /* - if (!pSoldier->bActive || !pSoldier->bInSector || !pSoldier->bLife || AM_A_ROBOT( pSoldier ) ) + if (!pSoldier->bActive || !pSoldier->bInSector || !pSoldier->stats.bLife || AM_A_ROBOT( pSoldier ) ) { return( fRecompileMovementCosts ); } if ( pExplosive->ubType == EXPLOSV_CREATUREGAS ) { - if ( pSoldier->uiStatusFlags & SOLDIER_MONSTER ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_MONSTER ) { // unaffected by own gas effects return( fRecompileMovementCosts ); } - if ( sSubsequent && pSoldier->fHitByGasFlags & HIT_BY_CREATUREGAS ) + if ( sSubsequent && pSoldier->flags.fHitByGasFlags & HIT_BY_CREATUREGAS ) { // already affected by creature gas this turn - return( fRecompileMovementCosts ); + return( fRecompileMovementCosts ); } } else // no gas mask help from creature attacks @@ -1899,61 +1907,61 @@ BOOLEAN ExpAffect( INT16 sBombGridNo, INT16 sGridNo, UINT32 uiDist, UINT16 usIte if ( pExplosive->ubType == EXPLOSV_TEARGAS ) { - // ignore whether subsequent or not if hit this turn - if ( pSoldier->fHitByGasFlags & HIT_BY_TEARGAS ) + // ignore whether subsequent or not if hit this turn + if ( pSoldier->flags.fHitByGasFlags & HIT_BY_TEARGAS ) { // already affected by creature gas this turn - return( fRecompileMovementCosts ); + return( fRecompileMovementCosts ); } } else if ( pExplosive->ubType == EXPLOSV_MUSTGAS ) { - if ( sSubsequent && pSoldier->fHitByGasFlags & HIT_BY_MUSTARDGAS ) + if ( sSubsequent && pSoldier->flags.fHitByGasFlags & HIT_BY_MUSTARDGAS ) { // already affected by creature gas this turn - return( fRecompileMovementCosts ); + return( fRecompileMovementCosts ); } } - if ( sSubsequent && pSoldier->fHitByGasFlags & HIT_BY_CREATUREGAS ) + if ( sSubsequent && pSoldier->flags.fHitByGasFlags & HIT_BY_CREATUREGAS ) { // already affected by creature gas this turn - return( fRecompileMovementCosts ); + return( fRecompileMovementCosts ); } - if ( pSoldier->inv[ HEAD1POS ].usItem == GASMASK && pSoldier->inv[ HEAD1POS ].bStatus[0] >= USABLE ) + if ( pSoldier->inv[ HEAD1POS ].usItem == GASMASK && pSoldier->inv[ HEAD1POS ][0]->data.objectStatus >= USABLE ) { bPosOfMask = HEAD1POS; } - else if ( pSoldier->inv[ HEAD2POS ].usItem == GASMASK && pSoldier->inv[ HEAD2POS ].bStatus[0] >= USABLE ) + else if ( pSoldier->inv[ HEAD2POS ].usItem == GASMASK && pSoldier->inv[ HEAD2POS ][0]->data.objectStatus >= USABLE ) { bPosOfMask = HEAD2POS; } - if ( bPosOfMask != NO_SLOT ) + if ( bPosOfMask != NO_SLOT ) { - if ( pSoldier->inv[ bPosOfMask ].bStatus[0] < GASMASK_MIN_STATUS ) + if ( pSoldier->inv[ bPosOfMask ][0]->data.objectStatus < GASMASK_MIN_STATUS ) { // GAS MASK reduces breath loss by its work% (it leaks if not at least 70%) - sBreathAmt = ( sBreathAmt * ( 100 - pSoldier->inv[ bPosOfMask ].bStatus[0] ) ) / 100; + sBreathAmt = ( sBreathAmt * ( 100 - pSoldier->inv[ bPosOfMask ][0]->data.objectStatus ) ) / 100; if ( sBreathAmt > 500 ) { // if at least 500 of breath damage got through // the soldier within the blast radius is gassed for at least one // turn, possibly more if it's tear gas (which hangs around a while) - pSoldier->uiStatusFlags |= SOLDIER_GASSED; + pSoldier->flags.uiStatusFlags |= SOLDIER_GASSED; } if ( sWoundAmt > 1 ) { - pSoldier->inv[ bPosOfMask ].bStatus[0] -= (INT8) Random( 4 ); - sWoundAmt = ( sWoundAmt * ( 100 - pSoldier->inv[ bPosOfMask ].bStatus[0] ) ) / 100; + pSoldier->inv[ bPosOfMask ][0]->data.objectStatus -= (INT8) Random( 4 ); + sWoundAmt = ( sWoundAmt * ( 100 - pSoldier->inv[ bPosOfMask ][0]->data.objectStatus ) ) / 100; } else if ( sWoundAmt == 1 ) { - pSoldier->inv[ bPosOfMask ].bStatus[0] -= (INT8) Random( 2 ); + pSoldier->inv[ bPosOfMask ][0]->data.objectStatus -= (INT8) Random( 2 ); } } else @@ -1963,15 +1971,15 @@ BOOLEAN ExpAffect( INT16 sBombGridNo, INT16 sGridNo, UINT32 uiDist, UINT16 usIte { if ( sWoundAmt == 1 ) { - pSoldier->inv[ bPosOfMask ].bStatus[0] -= (INT8) Random( 2 ); + pSoldier->inv[ bPosOfMask ][0]->data.objectStatus -= (INT8) Random( 2 ); } else { // use up gas mask - pSoldier->inv[ bPosOfMask ].bStatus[0] -= (INT8) Random( 4 ); + pSoldier->inv[ bPosOfMask ][0]->data.objectStatus -= (INT8) Random( 4 ); } } - sWoundAmt = 0; + sWoundAmt = 0; } } @@ -1982,28 +1990,28 @@ BOOLEAN ExpAffect( INT16 sBombGridNo, INT16 sGridNo, UINT32 uiDist, UINT16 usIte switch( pExplosive->ubType ) { case EXPLOSV_CREATUREGAS: - pSoldier->fHitByGasFlags |= HIT_BY_CREATUREGAS; + pSoldier->flags.fHitByGasFlags |= HIT_BY_CREATUREGAS; break; case EXPLOSV_TEARGAS: - pSoldier->fHitByGasFlags |= HIT_BY_TEARGAS; + pSoldier->flags.fHitByGasFlags |= HIT_BY_TEARGAS; break; case EXPLOSV_MUSTGAS: - pSoldier->fHitByGasFlags |= HIT_BY_MUSTARDGAS; + pSoldier->flags.fHitByGasFlags |= HIT_BY_MUSTARDGAS; break; default: break; } // a gas effect, take damage directly... - SoldierTakeDamage( pSoldier, ANIM_STAND, sWoundAmt, sBreathAmt, TAKE_DAMAGE_GAS, NOBODY, NOWHERE, 0, TRUE ); - if ( pSoldier->bLife >= CONSCIOUSNESS ) + pSoldier->SoldierTakeDamage( ANIM_STAND, sWoundAmt, sBreathAmt, TAKE_DAMAGE_GAS, NOBODY, NOWHERE, 0, TRUE ); + if ( pSoldier->stats.bLife >= CONSCIOUSNESS ) { - DoMercBattleSound( pSoldier, (INT8)( BATTLE_SOUND_HIT1 + Random( 2 ) ) ); + pSoldier->DoMercBattleSound( (INT8)( BATTLE_SOUND_HIT1 + Random( 2 ) ) ); } } */ } - (*pfMercHit) = TRUE; + (*pfMercHit) = TRUE; } return( fRecompileMovementCosts ); @@ -2012,15 +2020,15 @@ BOOLEAN ExpAffect( INT16 sBombGridNo, INT16 sGridNo, UINT32 uiDist, UINT16 usIte void GetRayStopInfo( UINT32 uiNewSpot, UINT8 ubDir, INT8 bLevel, BOOLEAN fSmokeEffect, INT32 uiCurRange, INT32 *piMaxRange, UINT8 *pubKeepGoing ) { - INT8 bStructHeight; - UINT8 ubMovementCost; - INT8 Blocking, BlockingTemp; - BOOLEAN fTravelCostObs = FALSE; - UINT32 uiRangeReduce; - INT16 sNewGridNo; + INT8 bStructHeight; + UINT8 ubMovementCost; + INT8 Blocking, BlockingTemp; + BOOLEAN fTravelCostObs = FALSE; + UINT32 uiRangeReduce; + INT16 sNewGridNo; STRUCTURE * pBlockingStructure; - BOOLEAN fBlowWindowSouth = FALSE; - BOOLEAN fReduceRay = TRUE; + BOOLEAN fBlowWindowSouth = FALSE; + BOOLEAN fReduceRay = TRUE; ubMovementCost = gubWorldMovementCosts[ uiNewSpot ][ ubDir ][ bLevel ]; @@ -2030,7 +2038,7 @@ void GetRayStopInfo( UINT32 uiNewSpot, UINT8 ubDir, INT8 bLevel, BOOLEAN fSmokeE // If we have hit a wall, STOP HERE if (ubMovementCost >= TRAVELCOST_BLOCKED) { - fTravelCostObs = TRUE; + fTravelCostObs = TRUE; } } else @@ -2062,7 +2070,7 @@ void GetRayStopInfo( UINT32 uiNewSpot, UINT8 ubDir, INT8 bLevel, BOOLEAN fSmokeE } // ATE: For smoke, don't let it go over roof.... - // 0verhaul: Why not? + // 0verhaul: Why not? if ( fSmokeEffect ) { if ( bLevel ) @@ -2215,7 +2223,7 @@ void GetRayStopInfo( UINT32 uiNewSpot, UINT8 ubDir, INT8 bLevel, BOOLEAN fSmokeE uiRangeReduce = 0; break; - } + } } else { @@ -2250,17 +2258,17 @@ void GetRayStopInfo( UINT32 uiNewSpot, UINT8 ubDir, INT8 bLevel, BOOLEAN fSmokeE -void SpreadEffect( INT16 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectID ) +void SpreadEffect( INT16 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectID ) { INT32 uiNewSpot, uiTempSpot, uiBranchSpot, cnt, branchCnt; - INT32 uiTempRange, ubBranchRange; - UINT8 ubDir,ubBranchDir, ubKeepGoing; + INT32 uiTempRange, ubBranchRange; + UINT8 ubDir,ubBranchDir, ubKeepGoing; INT16 sRange; - BOOLEAN fRecompileMovement = FALSE; - BOOLEAN fAnyMercHit = FALSE; - BOOLEAN fSmokeEffect = FALSE; + BOOLEAN fRecompileMovement = FALSE; + BOOLEAN fAnyMercHit = FALSE; + BOOLEAN fSmokeEffect = FALSE; - switch( Explosive[Item[usItem].ubClassIndex].ubType ) + switch( Explosive[Item[usItem].ubClassIndex].ubType ) { case EXPLOSV_MUSTGAS: @@ -2353,7 +2361,7 @@ void SpreadEffect( INT16 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner, while( branchCnt <= ubBranchRange) // end of range loop { - ubKeepGoing = TRUE; + ubKeepGoing = TRUE; uiNewSpot = NewGridNo( (INT16)uiBranchSpot, DirectionInc(ubBranchDir)); if (uiNewSpot != uiBranchSpot) @@ -2374,12 +2382,12 @@ void SpreadEffect( INT16 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner, //else { // check if it's ANY door, and if so, affect that spot so it's damaged - // if (RealDoorAt(uiNewSpot)) - // { - // ExpAffect(sGridNo,uiNewSpot,cnt,ubReason,fSubsequent); - // } + // if (RealDoorAt(uiNewSpot)) + // { + // ExpAffect(sGridNo,uiNewSpot,cnt,ubReason,fSubsequent); + // } // blocked, break out of the the sub-branch loop - // break; + // break; } } @@ -2396,7 +2404,7 @@ void SpreadEffect( INT16 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner, } // end of if a branch to do } - else // at edge, or tile blocks further spread in that direction + else // at edge, or tile blocks further spread in that direction { break; } @@ -2458,7 +2466,7 @@ void SpreadEffect( INT16 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner, { MercSlots[ cnt ]->ubMiscSoldierFlags &= ~SOLDIER_MISC_HURT_BY_EXPLOSION; } - } + } } if ( fSubsequent != BLOOD_SPREAD_EFFECT ) @@ -2470,7 +2478,7 @@ void SpreadEffect( INT16 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner, void ToggleActionItemsByFrequency( INT8 bFrequency ) { - UINT32 uiWorldBombIndex; + UINT32 uiWorldBombIndex; OBJECTTYPE * pObj; // Go through all the bombs in the world, and look for remote ones @@ -2478,20 +2486,20 @@ void ToggleActionItemsByFrequency( INT8 bFrequency ) { if (gWorldBombs[uiWorldBombIndex].fExists) { - pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o ); - if ( pObj->ItemData.Trigger.bDetonatorType == BOMB_REMOTE ) + pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].object ); + if ( (*pObj)[0]->data.misc.bDetonatorType == BOMB_REMOTE ) { // Found a remote bomb, so check to see if it has the same frequency - if (pObj->ItemData.Trigger.BombTrigger.bFrequency == bFrequency) + if ((*pObj)[0]->data.misc.bFrequency == bFrequency) { // toggle its active flag - if (pObj->fFlags & OBJECT_DISABLED_BOMB) + if ((*pObj).fFlags & OBJECT_DISABLED_BOMB) { - pObj->fFlags &= (~OBJECT_DISABLED_BOMB); + (*pObj).fFlags &= (~OBJECT_DISABLED_BOMB); } else { - pObj->fFlags |= OBJECT_DISABLED_BOMB; + (*pObj).fFlags |= OBJECT_DISABLED_BOMB; } } } @@ -2501,7 +2509,7 @@ void ToggleActionItemsByFrequency( INT8 bFrequency ) void TogglePressureActionItemsInGridNo( INT16 sGridNo ) { - UINT32 uiWorldBombIndex; + UINT32 uiWorldBombIndex; OBJECTTYPE * pObj; // Go through all the bombs in the world, and look for remote ones @@ -2509,18 +2517,18 @@ void TogglePressureActionItemsInGridNo( INT16 sGridNo ) { if ( gWorldBombs[uiWorldBombIndex].fExists && gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].sGridNo == sGridNo ) { - pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o ); - if ( pObj->ItemData.Trigger.bDetonatorType == BOMB_PRESSURE ) + pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].object ); + if ( (*pObj)[0]->data.misc.bDetonatorType == BOMB_PRESSURE ) { // Found a pressure item // toggle its active flag - if (pObj->fFlags & OBJECT_DISABLED_BOMB) + if ((*pObj).fFlags & OBJECT_DISABLED_BOMB) { - pObj->fFlags &= (~OBJECT_DISABLED_BOMB); + (*pObj).fFlags &= (~OBJECT_DISABLED_BOMB); } else { - pObj->fFlags |= OBJECT_DISABLED_BOMB; + (*pObj).fFlags |= OBJECT_DISABLED_BOMB; } } } @@ -2548,14 +2556,14 @@ void BillyBlocksDoorCallback( void ) BOOLEAN HookerInRoom( UINT8 ubRoom ) { - UINT8 ubLoop, ubTempRoom; - SOLDIERTYPE * pSoldier; + UINT8 ubLoop, ubTempRoom; + SOLDIERTYPE * pSoldier; for ( ubLoop = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; ubLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ubLoop++ ) { pSoldier = MercPtrs[ ubLoop ]; - if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife >= OKLIFE && pSoldier->bNeutral && pSoldier->ubBodyType == MINICIV ) + if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE && pSoldier->aiData.bNeutral && pSoldier->ubBodyType == MINICIV ) { if ( InARoom( pSoldier->sGridNo, &ubTempRoom ) && ubTempRoom == ubRoom ) { @@ -2571,7 +2579,7 @@ void PerformItemAction( INT16 sGridNo, OBJECTTYPE * pObj ) { STRUCTURE * pStructure; - switch( pObj->ItemData.Trigger.bActionValue ) + switch( (*pObj)[0]->data.misc.bActionValue ) { case ACTION_ITEM_OPEN_DOOR: pStructure = FindStructure( sGridNo, STRUCTURE_ANYDOOR ); @@ -2721,10 +2729,10 @@ void PerformItemAction( INT16 sGridNo, OBJECTTYPE * pObj ) break; case ACTION_ITEM_ENTER_BROTHEL: // JA2Gold: Disable brothel tracking - /* + /* if ( ! (gTacticalStatus.uiFlags & INCOMBAT) ) { - UINT8 ubID; + UINT8 ubID; ubID = WhoIsThere2( sGridNo, 0 ); if ( (ubID != NOBODY) && (MercPtrs[ ubID ]->bTeam == gbPlayerNum) ) @@ -2786,20 +2794,20 @@ void PerformItemAction( INT16 sGridNo, OBJECTTYPE * pObj ) else { // someone wants to leave the brothel - TriggerNPCRecord( BILLY, 5 ); + TriggerNPCRecord( BILLY, 5 ); } } } - */ + */ break; case ACTION_ITEM_EXIT_BROTHEL: // JA2Gold: Disable brothel tracking - /* + /* if ( ! (gTacticalStatus.uiFlags & INCOMBAT) ) { - UINT8 ubID; + UINT8 ubID; ubID = WhoIsThere2( sGridNo, 0 ); if ( (ubID != NOBODY) && (MercPtrs[ ubID ]->bTeam == gbPlayerNum) && MercPtrs[ ubID ]->sOldGridNo == sGridNo + DirectionInc( NORTH ) ) @@ -2815,7 +2823,7 @@ void PerformItemAction( INT16 sGridNo, OBJECTTYPE * pObj ) SetCustomizableTimerCallbackAndDelay( 1000, DelayedBillyTriggerToBlockOnExit, TRUE ); } } - */ + */ break; case ACTION_ITEM_KINGPIN_ALARM: PlayJA2Sample( KLAXON_ALARM, RATE_11025, SoundVolume( MIDVOLUME, sGridNo ), 5, SoundDir( sGridNo ) ); @@ -2824,7 +2832,7 @@ void PerformItemAction( INT16 sGridNo, OBJECTTYPE * pObj ) gTacticalStatus.fCivGroupHostile[ KINGPIN_CIV_GROUP ] = CIV_GROUP_HOSTILE; { - UINT8 ubID, ubID2; + UINT8 ubID, ubID2; BOOLEAN fEnterCombat = FALSE; for ( ubID = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; ubID <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ubID++ ) @@ -2833,7 +2841,7 @@ void PerformItemAction( INT16 sGridNo, OBJECTTYPE * pObj ) { for ( ubID2 = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; ubID2 <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubID2++ ) { - if ( MercPtrs[ ubID ]->bOppList[ ubID2 ] == SEEN_CURRENTLY ) + if ( MercPtrs[ ubID ]->aiData.bOppList[ ubID2 ] == SEEN_CURRENTLY ) { MakeCivHostile( MercPtrs[ ubID ], 2 ); fEnterCombat = TRUE; @@ -2849,19 +2857,19 @@ void PerformItemAction( INT16 sGridNo, OBJECTTYPE * pObj ) } // now zap this object so it won't activate again - pObj->fFlags &= (~OBJECT_DISABLED_BOMB); + (*pObj).fFlags &= (~OBJECT_DISABLED_BOMB); break; case ACTION_ITEM_SEX: // JA2Gold: Disable brothel sex Madd: Re-enabled if ( ! (gTacticalStatus.uiFlags & INCOMBAT) ) { - UINT8 ubID; + UINT8 ubID; OBJECTTYPE DoorCloser; - INT16 sTeleportSpot; - INT16 sDoorSpot; - UINT8 ubDirection; - UINT8 ubRoom, ubOldRoom; + INT16 sTeleportSpot; + INT16 sDoorSpot; + UINT8 ubDirection; + UINT8 ubRoom, ubOldRoom; ubID = WhoIsThere2( sGridNo, 0 ); if ( (ubID != NOBODY) && (MercPtrs[ ubID ]->bTeam == gbPlayerNum) ) @@ -2873,7 +2881,7 @@ void PerformItemAction( INT16 sGridNo, OBJECTTYPE * pObj ) { // stop the merc... - EVENT_StopMerc( MercPtrs[ ubID ], MercPtrs[ ubID ]->sGridNo, MercPtrs[ ubID ]->ubDirection ); + MercPtrs[ ubID ]->EVENT_StopMerc( MercPtrs[ ubID ]->sGridNo, MercPtrs[ ubID ]->ubDirection ); switch( sGridNo ) { @@ -2900,16 +2908,16 @@ void PerformItemAction( INT16 sGridNo, OBJECTTYPE * pObj ) if ( sDoorSpot != NOWHERE && sTeleportSpot != NOWHERE ) { - // close the door... - DoorCloser.ItemData.Trigger.bActionValue = ACTION_ITEM_CLOSE_DOOR; + // close the door... + DoorCloser[0]->data.misc.bActionValue = ACTION_ITEM_CLOSE_DOOR; PerformItemAction( sDoorSpot, &DoorCloser ); // have sex - HandleNPCDoAction( 0, NPC_ACTION_SEX, 0 ); + HandleNPCDoAction( 0, NPC_ACTION_SEX, 0 ); // move the merc outside of the room again sTeleportSpot = FindGridNoFromSweetSpotWithStructData( MercPtrs[ ubID ], STANDING, sTeleportSpot, 2, &ubDirection, FALSE ); - ChangeSoldierState( MercPtrs[ ubID ], STANDING, 0, TRUE ); + MercPtrs[ ubID ]->ChangeSoldierState( STANDING, 0, TRUE ); TeleportSoldier( MercPtrs[ ubID ], sTeleportSpot, FALSE ); HandleMoraleEvent( MercPtrs[ ubID ], MORALE_SEX, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); @@ -2917,7 +2925,7 @@ void PerformItemAction( INT16 sGridNo, OBJECTTYPE * pObj ) FatigueCharacter( MercPtrs[ ubID ] ); FatigueCharacter( MercPtrs[ ubID ] ); FatigueCharacter( MercPtrs[ ubID ] ); - DirtyMercPanelInterface( MercPtrs[ ubID ], DIRTYLEVEL1 ); + DirtyMercPanelInterface( MercPtrs[ ubID ], DIRTYLEVEL1 ); } } @@ -2937,7 +2945,7 @@ void PerformItemAction( INT16 sGridNo, OBJECTTYPE * pObj ) } } break; - case ACTION_ITEM_LOCAL_ALARM: + case ACTION_ITEM_LOCAL_ALARM: MakeNoise( NOBODY, sGridNo, 0, gpWorldLevelData[sGridNo].ubTerrainID, 30, NOISE_SILENT_ALARM ); break; case ACTION_ITEM_GLOBAL_ALARM: @@ -2985,12 +2993,12 @@ void AddBombToQueue( UINT32 uiWorldBombIndex, UINT32 uiTimeStamp ) void HandleExplosionQueue( void ) { - UINT32 uiIndex; - UINT32 uiWorldBombIndex; - UINT32 uiCurrentTime; - INT16 sGridNo; + UINT32 uiIndex; + UINT32 uiWorldBombIndex; + UINT32 uiCurrentTime; + INT16 sGridNo; OBJECTTYPE * pObj; - UINT8 ubLevel; + UINT8 ubLevel; if ( !gfExplosionQueueActive ) { @@ -3006,21 +3014,21 @@ void HandleExplosionQueue( void ) // Preliminary assignments: uiWorldBombIndex = gExplosionQueue[ uiIndex ].uiWorldBombIndex; - pObj = &( gWorldItems[ gWorldBombs[ uiWorldBombIndex ].iItemIndex ].o ); + pObj = &( gWorldItems[ gWorldBombs[ uiWorldBombIndex ].iItemIndex ].object ); sGridNo = gWorldItems[ gWorldBombs[ uiWorldBombIndex ].iItemIndex ].sGridNo; ubLevel = gWorldItems[ gWorldBombs[ uiWorldBombIndex ].iItemIndex ].ubLevel; - if (pObj->usItem == ACTION_ITEM && pObj->ItemData.Trigger.bActionValue != ACTION_ITEM_BLOW_UP) + if (pObj->usItem == ACTION_ITEM && (*pObj)[0]->data.misc.bActionValue != ACTION_ITEM_BLOW_UP) { PerformItemAction( sGridNo, pObj ); } - else if ( pObj->ItemData.Trigger.usBombItem == TRIP_KLAXON ) + else if ( (*pObj)[0]->data.misc.usBombItem == TRIP_KLAXON ) { PlayJA2Sample( KLAXON_ALARM, RATE_11025, SoundVolume( MIDVOLUME, sGridNo ), 5, SoundDir( sGridNo ) ); CallAvailableEnemiesTo( sGridNo ); //RemoveItemFromPool( sGridNo, gWorldBombs[ uiWorldBombIndex ].iItemIndex, 0 ); } - else if ( pObj->ItemData.Trigger.usBombItem == TRIP_FLARE ) + else if ( (*pObj)[0]->data.misc.usBombItem == TRIP_FLARE ) { NewLightEffect( sGridNo, (UINT8)Explosive[pObj->usItem].ubDuration, (UINT8)Explosive[pObj->usItem].ubStartRadius ); RemoveItemFromPool( sGridNo, gWorldBombs[ uiWorldBombIndex ].iItemIndex, ubLevel ); @@ -3043,14 +3051,14 @@ void HandleExplosionQueue( void ) // BOOM! // bomb objects only store the SIDE who placed the bomb! :-( - if ( pObj->ItemData.Trigger.ubBombOwner > 1 ) + if ( (*pObj)[0]->data.misc.ubBombOwner > 1 ) { - IgniteExplosion( (UINT8) (pObj->ItemData.Trigger.ubBombOwner - 2), CenterX( sGridNo ), CenterY( sGridNo ), 0, sGridNo, pObj->ItemData.Trigger.usBombItem, ubLevel ); + IgniteExplosion( (UINT8) ((*pObj)[0]->data.misc.ubBombOwner - 2), CenterX( sGridNo ), CenterY( sGridNo ), 0, sGridNo, (*pObj)[0]->data.misc.usBombItem, ubLevel ); } else { // pre-placed - IgniteExplosion( NOBODY, CenterX( sGridNo ), CenterY( sGridNo ), 0, sGridNo, pObj->ItemData.Trigger.usBombItem, ubLevel ); + IgniteExplosion( NOBODY, CenterX( sGridNo ), CenterY( sGridNo ), 0, sGridNo, (*pObj)[0]->data.misc.usBombItem, ubLevel ); } } @@ -3068,12 +3076,12 @@ void HandleExplosionQueue( void ) if ( gubElementsOnExplosionQueue == 0 && (gubPersonToSetOffExplosions == NOBODY || gTacticalStatus.ubAttackBusyCount == 0) ) { - // turn off explosion queue + // turn off explosion queue // re-enable sight gTacticalStatus.uiFlags &= (~DISALLOW_SIGHT); - if ( gubPersonToSetOffExplosions != NOBODY && !(MercPtrs[ gubPersonToSetOffExplosions ]->uiStatusFlags & SOLDIER_PC) ) + if ( gubPersonToSetOffExplosions != NOBODY && !(MercPtrs[ gubPersonToSetOffExplosions ]->flags.uiStatusFlags & SOLDIER_PC) ) { FreeUpNPCFromPendingAction( MercPtrs[ gubPersonToSetOffExplosions ] ); } @@ -3093,7 +3101,7 @@ void HandleExplosionQueue( void ) { if ( pTeamSoldier->bActive && pTeamSoldier->bInSector ) { - RevealRoofsAndItems( pTeamSoldier, TRUE, FALSE, pTeamSoldier->bLevel, FALSE ); + RevealRoofsAndItems( pTeamSoldier, TRUE, FALSE, pTeamSoldier->pathing.bLevel, FALSE ); } } @@ -3116,8 +3124,8 @@ void HandleExplosionQueue( void ) void DecayBombTimers( void ) { - UINT32 uiWorldBombIndex; - UINT32 uiTimeStamp; + UINT32 uiWorldBombIndex; + UINT32 uiTimeStamp; OBJECTTYPE * pObj; uiTimeStamp = GetJA2Clock(); @@ -3127,26 +3135,26 @@ void DecayBombTimers( void ) { if (gWorldBombs[uiWorldBombIndex].fExists) { - pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o ); - if ( pObj->ItemData.Trigger.bDetonatorType == BOMB_TIMED && !(pObj->fFlags & OBJECT_DISABLED_BOMB) ) + pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].object ); + if ( (*pObj)[0]->data.misc.bDetonatorType == BOMB_TIMED && !((*pObj).fFlags & OBJECT_DISABLED_BOMB) ) { // Found a timed bomb, so decay its delay value and see if it goes off - pObj->ItemData.Trigger.BombTrigger.bDelay--; - if (pObj->ItemData.Trigger.BombTrigger.bDelay == 0) + (*pObj)[0]->data.misc.bDelay--; + if ((*pObj)[0]->data.misc.bDelay == 0) { // put this bomb on the queue AddBombToQueue( uiWorldBombIndex, uiTimeStamp ); // ATE: CC black magic.... - if ( pObj->ItemData.Trigger.ubBombOwner > 1 ) + if ( (*pObj)[0]->data.misc.ubBombOwner > 1 ) { - gubPersonToSetOffExplosions = (UINT8) (pObj->ItemData.Trigger.ubBombOwner - 2); + gubPersonToSetOffExplosions = (UINT8) ((*pObj)[0]->data.misc.ubBombOwner - 2); } else { gubPersonToSetOffExplosions = NOBODY; } - if (pObj->usItem != ACTION_ITEM || pObj->ItemData.Trigger.bActionValue == ACTION_ITEM_BLOW_UP) + if (pObj->usItem != ACTION_ITEM || (*pObj)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP) { uiTimeStamp += BOMB_QUEUE_DELAY; } @@ -3158,8 +3166,8 @@ void DecayBombTimers( void ) void SetOffBombsByFrequency( UINT8 ubID, INT8 bFrequency ) { - UINT32 uiWorldBombIndex; - UINT32 uiTimeStamp; + UINT32 uiWorldBombIndex; + UINT32 uiTimeStamp; OBJECTTYPE * pObj; uiTimeStamp = GetJA2Clock(); @@ -3169,18 +3177,18 @@ void SetOffBombsByFrequency( UINT8 ubID, INT8 bFrequency ) { if (gWorldBombs[uiWorldBombIndex].fExists) { - pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o ); - if ( pObj->ItemData.Trigger.bDetonatorType == BOMB_REMOTE && !(pObj->fFlags & OBJECT_DISABLED_BOMB) ) + pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].object ); + if ( (*pObj)[0]->data.misc.bDetonatorType == BOMB_REMOTE && !((*pObj).fFlags & OBJECT_DISABLED_BOMB) ) { // Found a remote bomb, so check to see if it has the same frequency - if (pObj->ItemData.Trigger.BombTrigger.bFrequency == bFrequency) + if ((*pObj)[0]->data.misc.bFrequency == bFrequency) { gubPersonToSetOffExplosions = ubID; // put this bomb on the queue AddBombToQueue( uiWorldBombIndex, uiTimeStamp ); - if (pObj->usItem != ACTION_ITEM || pObj->ItemData.Trigger.bActionValue == ACTION_ITEM_BLOW_UP) + if (pObj->usItem != ACTION_ITEM || (*pObj)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP) { uiTimeStamp += BOMB_QUEUE_DELAY; } @@ -3194,8 +3202,8 @@ void SetOffPanicBombs( UINT8 ubID, INT8 bPanicTrigger ) { // need to turn off gridnos & flags in gTacticalStatus gTacticalStatus.sPanicTriggerGridNo[ bPanicTrigger ] = NOWHERE; - if ( (gTacticalStatus.sPanicTriggerGridNo[0] == NOWHERE) && - (gTacticalStatus.sPanicTriggerGridNo[1] == NOWHERE) && + if ( (gTacticalStatus.sPanicTriggerGridNo[0] == NOWHERE) && + (gTacticalStatus.sPanicTriggerGridNo[1] == NOWHERE) && (gTacticalStatus.sPanicTriggerGridNo[2] == NOWHERE) ) { gTacticalStatus.fPanicFlags &= ~(PANIC_TRIGGERS_HERE); @@ -3203,7 +3211,7 @@ void SetOffPanicBombs( UINT8 ubID, INT8 bPanicTrigger ) switch( bPanicTrigger ) { - case 0: + case 0: SetOffBombsByFrequency( ubID, PANIC_FREQUENCY ); gTacticalStatus.fPanicFlags &= ~(PANIC_BOMBS_HERE); break; @@ -3230,10 +3238,10 @@ void SetOffPanicBombs( UINT8 ubID, INT8 bPanicTrigger ) BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT16 sGridNo, BOOLEAN fAllBombs, INT8 bLevel ) { - UINT32 uiWorldBombIndex; - UINT32 uiTimeStamp; + UINT32 uiWorldBombIndex; + UINT32 uiTimeStamp; OBJECTTYPE * pObj; - BOOLEAN fFoundMine = FALSE; + BOOLEAN fFoundMine = FALSE; uiTimeStamp = GetJA2Clock(); @@ -3242,10 +3250,10 @@ BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT16 sGridNo, BOOLEAN fAllBombs, INT8 { if (gWorldBombs[uiWorldBombIndex].fExists && gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].sGridNo == sGridNo && gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].ubLevel == bLevel ) { - pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o ); - if (!(pObj->fFlags & OBJECT_DISABLED_BOMB)) + pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].object ); + if (!((*pObj).fFlags & OBJECT_DISABLED_BOMB)) { - if (fAllBombs || pObj->ItemData.Trigger.bDetonatorType == BOMB_PRESSURE) + if (fAllBombs || (*pObj)[0]->data.misc.bDetonatorType == BOMB_PRESSURE) { // Snap: if we do set off our own trap (e.g. by trying to disarm it), we pay! /*if (!fAllBombs && MercPtrs[ ubID ]->bTeam != gbPlayerNum ) @@ -3259,7 +3267,7 @@ BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT16 sGridNo, BOOLEAN fAllBombs, INT8 } // player and militia ignore bombs set by player - if ( pObj->ubBombOwner > 1 && (MercPtrs[ ubID ]->bTeam == gbPlayerNum || MercPtrs[ ubID ]->bTeam == MILITIA_TEAM) ) + if ( (*pObj)[0]->data.misc.ubBombOwner > 1 && (MercPtrs[ ubID ]->bTeam == gbPlayerNum || MercPtrs[ ubID ]->bTeam == MILITIA_TEAM) ) { continue; @@ -3269,7 +3277,7 @@ BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT16 sGridNo, BOOLEAN fAllBombs, INT8 { // send out a signal to detonate other bombs, rather than this which // isn't a bomb but a trigger - SetOffBombsByFrequency( ubID, pObj->ItemData.Trigger.BombTrigger.bFrequency ); + SetOffBombsByFrequency( ubID, (*pObj)[0]->data.misc.bFrequency ); } else { @@ -3277,12 +3285,12 @@ BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT16 sGridNo, BOOLEAN fAllBombs, INT8 // put this bomb on the queue AddBombToQueue( uiWorldBombIndex, uiTimeStamp ); - if (pObj->usItem != ACTION_ITEM || pObj->ItemData.Trigger.bActionValue == ACTION_ITEM_BLOW_UP) + if (pObj->usItem != ACTION_ITEM || (*pObj)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP) { uiTimeStamp += BOMB_QUEUE_DELAY; } - if ( pObj->ItemData.Trigger.usBombItem != NOTHING && Item[ pObj->ItemData.Trigger.usBombItem ].usItemClass & IC_EXPLOSV ) + if ( (*pObj)[0]->data.misc.usBombItem != NOTHING && Item[ (*pObj)[0]->data.misc.usBombItem ].usItemClass & IC_EXPLOSV ) { fFoundMine = TRUE; } @@ -3297,7 +3305,7 @@ BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT16 sGridNo, BOOLEAN fAllBombs, INT8 void ActivateSwitchInGridNo( UINT8 ubID, INT16 sGridNo ) { - UINT32 uiWorldBombIndex; + UINT32 uiWorldBombIndex; OBJECTTYPE * pObj; // Go through all the bombs in the world, and look for mines at this location @@ -3305,9 +3313,9 @@ void ActivateSwitchInGridNo( UINT8 ubID, INT16 sGridNo ) { if (gWorldBombs[uiWorldBombIndex].fExists && gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].sGridNo == sGridNo) { - pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o ); + pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].object ); - if ( pObj->usItem == SWITCH && ( !(pObj->fFlags & OBJECT_DISABLED_BOMB) ) && pObj->ItemData.Trigger.bDetonatorType == BOMB_SWITCH) + if ( pObj->usItem == SWITCH && ( !((*pObj).fFlags & OBJECT_DISABLED_BOMB) ) && (*pObj)[0]->data.misc.bDetonatorType == BOMB_SWITCH) { // send out a signal to detonate other bombs, rather than this which // isn't a bomb but a trigger @@ -3316,7 +3324,7 @@ void ActivateSwitchInGridNo( UINT8 ubID, INT16 sGridNo ) // No, not a good idea. // gTacticalStatus.ubAttackBusyCount = 0; - SetOffBombsByFrequency( ubID, pObj->ItemData.Trigger.BombTrigger.bFrequency ); + SetOffBombsByFrequency( ubID, (*pObj)[0]->data.misc.bFrequency ); } } } @@ -3383,7 +3391,7 @@ BOOLEAN SaveExplosionTableToSaveGameFile( HWFILE hFile ) for( uiCnt=0; uiCnt< NUM_EXPLOSION_SLOTS; uiCnt++) { if( gExplosionData[ uiCnt ].fAllocated ) - { + { FileWrite( hFile, &gExplosionData[ uiCnt ], sizeof( EXPLOSIONTYPE ), &uiNumBytesWritten ); if( uiNumBytesWritten != sizeof( EXPLOSIONTYPE ) ) { @@ -3404,7 +3412,6 @@ BOOLEAN SaveExplosionTableToSaveGameFile( HWFILE hFile ) BOOLEAN LoadExplosionTableFromSavedGameFile( HWFILE hFile ) { UINT32 uiNumBytesRead; - //UINT32 uiExplosionCount=0; UINT32 uiCnt; @@ -3527,12 +3534,12 @@ void UpdateAndDamageSAMIfFound( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, } -void UpdateSAMDoneRepair( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) +void UpdateSAMDoneRepair( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) { INT32 cnt; INT16 sSectorNo; - BOOLEAN fInSector = FALSE; - UINT16 usGoodGraphic, usDamagedGraphic; + BOOLEAN fInSector = FALSE; + UINT16 usGoodGraphic, usDamagedGraphic; // ATE: If we are below, return right away... if ( sSectorZ != 0 ) @@ -3554,7 +3561,7 @@ void UpdateSAMDoneRepair( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) if ( pSamList[ cnt ] == sSectorNo ) { // get graphic....... - GetTileIndexFromTypeSubIndex( EIGHTISTRUCT, (UINT16)( gbSAMGraphicList[ cnt ] ), &usGoodGraphic ); + GetTileIndexFromTypeSubIndex( EIGHTISTRUCT, (UINT16)( gbSAMGraphicList[ cnt ] ), &usGoodGraphic ); // Damaged one ( current ) is 2 less... usDamagedGraphic = usGoodGraphic - 2; @@ -3594,8 +3601,8 @@ void UpdateSAMDoneRepair( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) // see if they get angry void HandleBuldingDestruction( INT16 sGridNo, UINT8 ubOwner ) { - SOLDIERTYPE * pSoldier; - UINT8 cnt; + SOLDIERTYPE * pSoldier; + UINT8 cnt; if ( ubOwner == NOBODY ) { @@ -3610,7 +3617,7 @@ void HandleBuldingDestruction( INT16 sGridNo, UINT8 ubOwner ) cnt = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; cnt++ ,pSoldier++ ) { - if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife && pSoldier->bNeutral ) + if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife && pSoldier->aiData.bNeutral ) { if ( pSoldier->ubProfile != NO_PROFILE ) { @@ -3631,8 +3638,8 @@ void HandleBuldingDestruction( INT16 sGridNo, UINT8 ubOwner ) INT32 FindActiveTimedBomb( void ) { - UINT32 uiWorldBombIndex; - UINT32 uiTimeStamp; + UINT32 uiWorldBombIndex; + UINT32 uiTimeStamp; OBJECTTYPE * pObj; uiTimeStamp = GetJA2Clock(); @@ -3642,10 +3649,10 @@ INT32 FindActiveTimedBomb( void ) { if (gWorldBombs[uiWorldBombIndex].fExists) { - pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o ); - if ( pObj->ItemData.Trigger.bDetonatorType == BOMB_TIMED && !(pObj->fFlags & OBJECT_DISABLED_BOMB) ) + pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].object ); + if ( (*pObj)[0]->data.misc.bDetonatorType == BOMB_TIMED && !((*pObj).fFlags & OBJECT_DISABLED_BOMB) ) { - return( gWorldBombs[uiWorldBombIndex].iItemIndex ); + return( gWorldBombs[uiWorldBombIndex].iItemIndex ); } } } @@ -3685,13 +3692,13 @@ UINT8 DetermineFlashbangEffect( SOLDIERTYPE *pSoldier, INT8 ubExplosionDir, BOOL INT8 bNumTurns; UINT16 usHeadItem1, usHeadItem2; - bNumTurns = FindNumTurnsBetweenDirs(pSoldier->ubDirection, ubExplosionDir); + bNumTurns = FindNumTurnsBetweenDirs(pSoldier->ubDirection, ubExplosionDir); usHeadItem1 = pSoldier->inv[ HEAD1POS ].usItem; usHeadItem2 = pSoldier->inv[ HEAD2POS ].usItem; // if soldier got in explosion area check if he is affected by flash // if soldier wears sun goggles OR grenade behind him OR - // (he is not underground AND it is day AND he is outdoor) + // (he is not underground AND it is day AND he is outdoor) if ( (usHeadItem1 == SUNGOGGLES || usHeadItem2 == SUNGOGGLES) || (bNumTurns > 1) || (!gbWorldSectorZ && !NightTime() && !fInBuilding) ) { @@ -3700,4 +3707,4 @@ UINT8 DetermineFlashbangEffect( SOLDIERTYPE *pSoldier, INT8 ubExplosionDir, BOOL } return ( FIRE_WEAPON_BLINDED_AND_DEAFENED ); -} \ No newline at end of file +} diff --git a/TileEngine/Explosion Control.h b/TileEngine/Explosion Control.h index 5658c592..18767413 100644 --- a/TileEngine/Explosion Control.h +++ b/TileEngine/Explosion Control.h @@ -67,12 +67,12 @@ enum EXPLOSION_TYPES typedef struct { - UINT8 ubTransKeyFrame; - UINT8 ubDamageKeyFrame; - UINT32 uiExplosionSoundID; - UINT32 uiAltExplosionSoundID; - CHAR8 zBlastFilename[MAX_BLAST_FILENAME_LEN]; - CHAR8 sBlastSpeed; + UINT8 ubTransKeyFrame; + UINT8 ubDamageKeyFrame; + UINT32 uiExplosionSoundID; + UINT32 uiAltExplosionSoundID; + CHAR8 zBlastFilename[MAX_BLAST_FILENAME_LEN]; + CHAR8 sBlastSpeed; } EXPLOSION_DATA; extern EXPLOSION_DATA gExpAniData[NUM_EXP_TYPES]; @@ -118,7 +118,7 @@ void UpdateExplosionFrame( INT32 iIndex, INT16 sCurrentFrame ); void RemoveExplosionData( INT32 iIndex ); void UpdateAndDamageSAMIfFound( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, INT16 sGridNo, UINT8 ubDamage ); -void UpdateSAMDoneRepair( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ); +void UpdateSAMDoneRepair( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ); BOOLEAN SaveExplosionTableToSaveGameFile( HWFILE hFile ); diff --git a/TileEngine/Fog Of War.cpp b/TileEngine/Fog Of War.cpp index cae23a52..b7e6a65a 100644 --- a/TileEngine/Fog Of War.cpp +++ b/TileEngine/Fog Of War.cpp @@ -16,7 +16,6 @@ void RemoveFogFromGridNo( UINT32 uiGridNo ) { INT32 i; INT32 x, y; - UINT32 uiAdjacentGridNo = 0; x = uiGridNo % WORLD_COLS; y = uiGridNo / WORLD_COLS; for( i = 0; i < MAX_LIGHT_SPRITES; i++ ) @@ -32,4 +31,4 @@ void RemoveFogFromGridNo( UINT32 uiGridNo ) } } } -} \ No newline at end of file +} diff --git a/TileEngine/Fog Of War.h b/TileEngine/Fog Of War.h index 75ba2a00..5408151b 100644 --- a/TileEngine/Fog Of War.h +++ b/TileEngine/Fog Of War.h @@ -2,7 +2,7 @@ #define __FOG_OF_WAR_H -//Called after a map is loaded. By keying on the MAPELEMENT_REVEALED value, we can easily +//Called after a map is loaded. By keying on the MAPELEMENT_REVEALED value, we can easily //determine what is hidden by the fog. void InitializeFogInWorld(); diff --git a/TileEngine/Interactive Tiles.cpp b/TileEngine/Interactive Tiles.cpp index 18920b93..3d9ac20d 100644 --- a/TileEngine/Interactive Tiles.cpp +++ b/TileEngine/Interactive Tiles.cpp @@ -68,7 +68,7 @@ typedef struct } INTERACTIVE_TILE_STACK_TYPE; - + INTERACTIVE_TILE_STACK_TYPE gCurIntTileStack; BOOLEAN gfCycleIntTile = FALSE; @@ -106,12 +106,12 @@ BOOLEAN StartInteractiveObject( INT16 sGridNo, UINT16 usStructureID, SOLDIERTYPE { STRUCTURE * pStructure; - // ATE: Patch fix: Don't allow if alreay in animation - if ( pSoldier->usAnimState == OPEN_STRUCT || pSoldier->usAnimState == OPEN_STRUCT_CROUCHED || - pSoldier->usAnimState == BEGIN_OPENSTRUCT || pSoldier->usAnimState == BEGIN_OPENSTRUCT_CROUCHED ) - { - return( FALSE ); - } + // ATE: Patch fix: Don't allow if alreay in animation + if ( pSoldier->usAnimState == OPEN_STRUCT || pSoldier->usAnimState == OPEN_STRUCT_CROUCHED || + pSoldier->usAnimState == BEGIN_OPENSTRUCT || pSoldier->usAnimState == BEGIN_OPENSTRUCT_CROUCHED ) + { + return( FALSE ); + } pStructure = FindStructureByID( sGridNo, usStructureID ); if (pStructure == NULL) @@ -121,22 +121,22 @@ BOOLEAN StartInteractiveObject( INT16 sGridNo, UINT16 usStructureID, SOLDIERTYPE if (pStructure->fFlags & STRUCTURE_ANYDOOR) { // Add soldier event for opening door.... - pSoldier->ubPendingAction = MERC_OPENDOOR; - pSoldier->uiPendingActionData1 = usStructureID; - pSoldier->sPendingActionData2 = sGridNo; - pSoldier->bPendingActionData3 = ubDirection; - pSoldier->ubPendingActionAnimCount = 0; + pSoldier->aiData.ubPendingAction = MERC_OPENDOOR; + pSoldier->aiData.uiPendingActionData1 = usStructureID; + pSoldier->aiData.sPendingActionData2 = sGridNo; + pSoldier->aiData.bPendingActionData3 = ubDirection; + pSoldier->aiData.ubPendingActionAnimCount = 0; - } + } else { // Add soldier event for opening door.... - pSoldier->ubPendingAction = MERC_OPENSTRUCT; - pSoldier->uiPendingActionData1 = usStructureID; - pSoldier->sPendingActionData2 = sGridNo; - pSoldier->bPendingActionData3 = ubDirection; - pSoldier->ubPendingActionAnimCount = 0; + pSoldier->aiData.ubPendingAction = MERC_OPENSTRUCT; + pSoldier->aiData.uiPendingActionData1 = usStructureID; + pSoldier->aiData.sPendingActionData2 = sGridNo; + pSoldier->aiData.bPendingActionData3 = ubDirection; + pSoldier->aiData.ubPendingActionAnimCount = 0; } @@ -164,7 +164,7 @@ BOOLEAN CalcInteractiveObjectAPs( INT16 sGridNo, STRUCTURE * pStructure, INT16 * // *psAPCost = 0; // *psBPCost = 0; //} - } + } else { *psAPCost = AP_OPEN_DOOR; @@ -187,7 +187,7 @@ BOOLEAN InteractWithInteractiveObject( SOLDIERTYPE *pSoldier, STRUCTURE *pStruct if (pStructure->fFlags & STRUCTURE_ANYDOOR) { fDoor = TRUE; - } + } InteractWithOpenableStruct( pSoldier, pStructure, ubDirection, fDoor ); @@ -200,10 +200,10 @@ BOOLEAN SoldierHandleInteractiveObject( SOLDIERTYPE *pSoldier ) STRUCTURE *pStructure; UINT16 usStructureID; INT16 sGridNo; - - sGridNo = pSoldier->sPendingActionData2; - usStructureID = (UINT16)pSoldier->uiPendingActionData1; + + sGridNo = pSoldier->aiData.sPendingActionData2; + usStructureID = (UINT16)pSoldier->aiData.uiPendingActionData1; // HANDLE SOLDIER ACTIONS pStructure = FindStructureByID( sGridNo, usStructureID ); @@ -212,23 +212,22 @@ BOOLEAN SoldierHandleInteractiveObject( SOLDIERTYPE *pSoldier ) //DEBUG MSG! return( FALSE ); } - - return( HandleOpenableStruct( pSoldier, sGridNo, pStructure ) ); + + return( HandleOpenableStruct( pSoldier, sGridNo, pStructure ) ); } void HandleStructChangeFromGridNo( SOLDIERTYPE *pSoldier, INT16 sGridNo ) { STRUCTURE *pStructure, *pNewStructure; - //INT16 sAPCost = 0, sBPCost = 0; ITEM_POOL *pItemPool; - BOOLEAN fDidMissingQuote = FALSE; + BOOLEAN fDidMissingQuote = FALSE; pStructure = FindStructure( sGridNo, STRUCTURE_OPENABLE ); if ( pStructure == NULL ) { #ifdef JA2TESTVERSION - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"ERROR: Told to handle struct that does not exist at %d.", sGridNo ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"ERROR: Told to handle struct that does not exist at %d.", sGridNo ); #endif return; } @@ -237,12 +236,12 @@ void HandleStructChangeFromGridNo( SOLDIERTYPE *pSoldier, INT16 sGridNo ) if ( !( pStructure->fFlags & STRUCTURE_OPEN ) ) { // Play Opening sound... - PlayJA2Sample( GetStructureOpenSound( pStructure, FALSE ), RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); + PlayJA2Sample( GetStructureOpenSound( pStructure, FALSE ), RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); } else { // Play Opening sound... - PlayJA2Sample( ( GetStructureOpenSound( pStructure, TRUE ) ), RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); + PlayJA2Sample( ( GetStructureOpenSound( pStructure, TRUE ) ), RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); } // ATE: Don't handle switches! @@ -255,7 +254,7 @@ void HandleStructChangeFromGridNo( SOLDIERTYPE *pSoldier, INT16 sGridNo ) SetFactFalse( 38); // Reset whether we punched Pablo lately SetFactFalse( FACT_PABLO_RETURNED_GOODS); SayQuoteFromNearbyMercInSector( BOBBYR_SHIPPING_DEST_GRIDNO, 3, QUOTE_STUFF_MISSING_DRASSEN ); - fDidMissingQuote = TRUE; + fDidMissingQuote = TRUE; } } else if ( pSoldier->bTeam == CIV_TEAM ) @@ -268,7 +267,7 @@ void HandleStructChangeFromGridNo( SOLDIERTYPE *pSoldier, INT16 sGridNo ) // LOOK for item pool here... - if ( GetItemPool( (INT16)sGridNo, &pItemPool, pSoldier->bLevel ) ) + if ( GetItemPool( (INT16)sGridNo, &pItemPool, pSoldier->pathing.bLevel ) ) { // Update visiblity.... if ( !( pStructure->fFlags & STRUCTURE_OPEN ) ) @@ -283,7 +282,7 @@ void HandleStructChangeFromGridNo( SOLDIERTYPE *pSoldier, INT16 sGridNo ) } // Look for ownership here.... - if ( gWorldItems[ pItemPool->iItemIndex ].o.usItem == OWNERSHIP ) + if ( gWorldItems[ pItemPool->iItemIndex ].object.usItem == OWNERSHIP ) { fDoHumm = FALSE; TacticalCharacterDialogueWithSpecialEvent( pSoldier, 0, DIALOGUE_SPECIAL_EVENT_DO_BATTLE_SND, BATTLE_SOUND_NOTHING , 500 ); @@ -296,24 +295,24 @@ void HandleStructChangeFromGridNo( SOLDIERTYPE *pSoldier, INT16 sGridNo ) //TacticalCharacterDialogue( pSoldier, (UINT16)( QUOTE_SPOTTED_SOMETHING_ONE + Random( 2 ) ) ); // ATE: Check now many things in pool..... - if ( !fDidMissingQuote ) - { - if ( pItemPool->pNext != NULL ) - { - if ( pItemPool->pNext->pNext != NULL ) - { - fDoHumm = FALSE; + if ( !fDidMissingQuote ) + { + if ( pItemPool->pNext != NULL ) + { + if ( pItemPool->pNext->pNext != NULL ) + { + fDoHumm = FALSE; - TacticalCharacterDialogueWithSpecialEvent( pSoldier, 0, DIALOGUE_SPECIAL_EVENT_DO_BATTLE_SND, BATTLE_SOUND_COOL1 , 500 ); + TacticalCharacterDialogueWithSpecialEvent( pSoldier, 0, DIALOGUE_SPECIAL_EVENT_DO_BATTLE_SND, BATTLE_SOUND_COOL1 , 500 ); - } - } + } + } - if ( fDoHumm ) - { - TacticalCharacterDialogueWithSpecialEvent( pSoldier, 0, DIALOGUE_SPECIAL_EVENT_DO_BATTLE_SND, BATTLE_SOUND_HUMM , 500 ); - } - } + if ( fDoHumm ) + { + TacticalCharacterDialogueWithSpecialEvent( pSoldier, 0, DIALOGUE_SPECIAL_EVENT_DO_BATTLE_SND, BATTLE_SOUND_HUMM , 500 ); + } + } } else { @@ -352,10 +351,10 @@ void HandleStructChangeFromGridNo( SOLDIERTYPE *pSoldier, INT16 sGridNo ) UINT32 GetInteractiveTileCursor( UINT32 uiOldCursor, BOOLEAN fConfirm ) -{ - LEVELNODE *pIntNode; - STRUCTURE *pStructure; - INT16 sGridNo; +{ + LEVELNODE *pIntNode; + STRUCTURE *pStructure; + INT16 sGridNo; // OK, first see if we have an in tile... pIntNode = GetCurInteractiveTileGridNoAndStructure( &sGridNo, &pStructure ); @@ -378,11 +377,11 @@ UINT32 GetInteractiveTileCursor( UINT32 uiOldCursor, BOOLEAN fConfirm ) } else { - if( pStructure->fFlags & STRUCTURE_SWITCH ) - { - wcscpy( gzIntTileLocation, gzLateLocalizedString[ 25 ] ); - gfUIIntTileLocation = TRUE; - } + if( pStructure->fFlags & STRUCTURE_SWITCH ) + { + wcscpy( gzIntTileLocation, gzLateLocalizedString[ 25 ] ); + gfUIIntTileLocation = TRUE; + } if ( fConfirm ) @@ -399,18 +398,18 @@ UINT32 GetInteractiveTileCursor( UINT32 uiOldCursor, BOOLEAN fConfirm ) return( uiOldCursor ); } - -void SetActionModeDoorCursorText( ) -{ - LEVELNODE *pIntNode; - STRUCTURE *pStructure; - INT16 sGridNo; - // If we are over a merc, don't - if ( gfUIFullTargetFound ) - { - return; - } +void SetActionModeDoorCursorText( ) +{ + LEVELNODE *pIntNode; + STRUCTURE *pStructure; + INT16 sGridNo; + + // If we are over a merc, don't + if ( gfUIFullTargetFound ) + { + return; + } // OK, first see if we have an in tile... pIntNode = GetCurInteractiveTileGridNoAndStructure( &sGridNo, &pStructure ); @@ -433,7 +432,7 @@ void GetLevelNodeScreenRect( LEVELNODE *pNode, SGPRect *pRect, INT16 sXPos, INT1 ETRLEObject *pTrav; UINT32 usHeight, usWidth; TILE_ELEMENT *TileElem; - + // Get 'TRUE' merc position @@ -449,7 +448,7 @@ void GetLevelNodeScreenRect( LEVELNODE *pNode, SGPRect *pRect, INT16 sXPos, INT1 else { TileElem = &(gTileDatabase[pNode->usIndex]); - + //Adjust for current frames and animations.... if ( TileElem->uiFlags & ANIMATED_TILE) { @@ -458,7 +457,7 @@ void GetLevelNodeScreenRect( LEVELNODE *pNode, SGPRect *pRect, INT16 sXPos, INT1 } else if( ( pNode->uiFlags & LEVELNODE_ANIMATION ) ) { - if ( pNode->sCurrentFrame != -1 ) + if ( pNode->sCurrentFrame != -1 ) { Assert( TileElem->pAnimData != NULL ); TileElem = &gTileDatabase[TileElem->pAnimData->pusFrames[pNode->sCurrentFrame]]; @@ -525,7 +524,7 @@ void LogMouseOverInteractiveTile( INT16 sGridNo ) } // Also, don't allow for mercs who are on upper level... - if ( gusSelectedSoldier != NOBODY && MercPtrs[ gusSelectedSoldier ]->bLevel == 1 ) + if ( gusSelectedSoldier != NOBODY && MercPtrs[ gusSelectedSoldier ]->pathing.bLevel == 1 ) { return; } @@ -653,7 +652,7 @@ LEVELNODE *GetCurInteractiveTile( ) LEVELNODE *GetCurInteractiveTileGridNo( INT16 *psGridNo ) { LEVELNODE *pNode; - + pNode = GetCurInteractiveTile( ); if ( pNode != NULL ) @@ -676,7 +675,7 @@ LEVELNODE *ConditionalGetCurInteractiveTileGridNoAndStructure( INT16 *psGridNo, STRUCTURE *pStructure; *ppStructure = NULL; - + pNode = InternalGetCurInteractiveTile( fRejectOnTopItems ); if ( pNode != NULL ) @@ -751,16 +750,16 @@ void EndCurInteractiveTileCheck( ) } gCurIntTile.sGridNo = pCurIntTile->sFoundGridNo; - gCurIntTile.sTileIndex = pCurIntTile->pFoundNode->usIndex; + gCurIntTile.sTileIndex = pCurIntTile->pFoundNode->usIndex; if ( pCurIntTile->pFoundNode->pStructureData != NULL ) { gCurIntTile.usStructureID = pCurIntTile->pFoundNode->pStructureData->usStructureID; - gCurIntTile.fStructure = TRUE; + gCurIntTile.fStructure = TRUE; } else { - gCurIntTile.fStructure = FALSE; + gCurIntTile.fStructure = FALSE; } @@ -781,8 +780,8 @@ void EndCurInteractiveTileCheck( ) BOOLEAN RefineLogicOnStruct( INT16 sGridNo, LEVELNODE *pNode ) { TILE_ELEMENT *TileElem; - STRUCTURE *pStructure; - + STRUCTURE *pStructure; + if ( pNode->uiFlags & LEVELNODE_CACHEDANITILE ) { @@ -839,7 +838,7 @@ BOOLEAN RefineLogicOnStruct( INT16 sGridNo, LEVELNODE *pNode ) { return( FALSE ); } - } + } } else { @@ -885,7 +884,7 @@ BOOLEAN RefineLogicOnStruct( INT16 sGridNo, LEVELNODE *pNode ) } } } - + // Check if it's a hidden struct and we have not revealed anything! if ( TileElem->uiFlags & HIDDEN_TILE ) { @@ -908,7 +907,7 @@ BOOLEAN RefinePointCollisionOnStruct( INT16 sGridNo, INT16 sTestX, INT16 sTestY, if ( pNode->uiFlags & LEVELNODE_CACHEDANITILE ) { //Check it! - return ( CheckVideoObjectScreenCoordinateInData( gpTileCache[ pNode->pAniTile->sCachedTileID ].pImagery->vo, pNode->pAniTile->sCurrentFrame, (INT32)( sTestX - sSrcX ), (INT32)( -1 * ( sTestY - sSrcY ) ) ) ); + return ( CheckVideoObjectScreenCoordinateInData( gpTileCache[ pNode->pAniTile->sCachedTileID ].pImagery->vo, pNode->pAniTile->sCurrentFrame, (INT32)( sTestX - sSrcX ), (INT32)( -1 * ( sTestY - sSrcY ) ) ) ); } else @@ -923,7 +922,7 @@ BOOLEAN RefinePointCollisionOnStruct( INT16 sGridNo, INT16 sTestX, INT16 sTestY, } else if( ( pNode->uiFlags & LEVELNODE_ANIMATION ) ) { - if ( pNode->sCurrentFrame != -1 ) + if ( pNode->sCurrentFrame != -1 ) { Assert( TileElem->pAnimData != NULL ); TileElem = &gTileDatabase[TileElem->pAnimData->pusFrames[pNode->sCurrentFrame]]; @@ -931,7 +930,7 @@ BOOLEAN RefinePointCollisionOnStruct( INT16 sGridNo, INT16 sTestX, INT16 sTestY, } //Check it! - return ( CheckVideoObjectScreenCoordinateInData( TileElem->hTileSurface, TileElem->usRegionIndex, (INT32)( sTestX - sSrcX ), (INT32)( -1 * ( sTestY - sSrcY ) ) ) ); + return ( CheckVideoObjectScreenCoordinateInData( TileElem->hTileSurface, TileElem->usRegionIndex, (INT32)( sTestX - sSrcX ), (INT32)( -1 * ( sTestY - sSrcY ) ) ) ); } } @@ -942,12 +941,12 @@ BOOLEAN CheckVideoObjectScreenCoordinateInData( HVOBJECT hSrcVObject, UINT16 usI { UINT32 uiOffset; UINT32 usHeight, usWidth; - UINT8 *SrcPtr; + UINT8 *SrcPtr; UINT32 LineSkip; ETRLEObject *pTrav; - BOOLEAN fDataFound = FALSE; - INT32 iTestPos, iStartPos; - + BOOLEAN fDataFound = FALSE; + INT32 iTestPos, iStartPos; + // Assertions Assert( hSrcVObject != NULL ); @@ -962,7 +961,7 @@ BOOLEAN CheckVideoObjectScreenCoordinateInData( HVOBJECT hSrcVObject, UINT16 usI // Calculate from 0, 0 at top left! iTestPos = ( ( usHeight - iTestY ) * usWidth ) + iTestX; iStartPos = 0; - LineSkip = usWidth; + LineSkip = usWidth; SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; @@ -989,7 +988,7 @@ BlitDispatch: jnc BlitNTL2 inc esi - + // Check cmp edi, iTestPos je BlitFound @@ -1029,7 +1028,7 @@ BlitNTL4: cmp edi, iTestPos je BlitFound add edi, 1 - + // Check cmp edi, iTestPos je BlitFound @@ -1059,7 +1058,7 @@ BlitTransparent: BlitDoneLine: - + // Here check if we have passed! cmp edi, iTestPos jge BlitDone @@ -1079,7 +1078,7 @@ BlitDone: return(fDataFound); -} +} BOOLEAN ShouldCheckForMouseDetections( ) @@ -1087,8 +1086,8 @@ BOOLEAN ShouldCheckForMouseDetections( ) BOOLEAN fOK = FALSE; if ( gsINTOldRenderCenterX != gsRenderCenterX || gsINTOldRenderCenterY != gsRenderCenterY || - gusINTOldMousePosX != gusMouseXPos || gusINTOldMousePosY != gusMouseYPos ) - { + gusINTOldMousePosX != gusMouseXPos || gusINTOldMousePosY != gusMouseYPos ) + { fOK = TRUE; } @@ -1103,7 +1102,7 @@ BOOLEAN ShouldCheckForMouseDetections( ) } -void CycleIntTileFindStack( UINT16 usMapPos ) +void CycleIntTileFindStack( INT16 sMapPos ) { gfCycleIntTile = TRUE; @@ -1117,4 +1116,4 @@ void CycleIntTileFindStack( UINT16 usMapPos ) { gCurIntTileStack.bCur = 0; } -} \ No newline at end of file +} diff --git a/TileEngine/Interactive Tiles.h b/TileEngine/Interactive Tiles.h index e3d0fb19..eb9ab4f9 100644 --- a/TileEngine/Interactive Tiles.h +++ b/TileEngine/Interactive Tiles.h @@ -21,7 +21,7 @@ BOOLEAN AddInteractiveTile( INT16 sGridNo, LEVELNODE *pLevelNode, UINT32 uiFlags BOOLEAN StartInteractiveObject( INT16 sGridNo, UINT16 usStructureID, SOLDIERTYPE *pSoldier, UINT8 ubDirection ); BOOLEAN StartInteractiveObjectFromMouse( SOLDIERTYPE *pSoldier, UINT8 ubDirection ); void CompileInteractiveTiles( ); -UINT32 GetInteractiveTileCursor( UINT32 uiOldCursor, BOOLEAN fConfirm ); +UINT32 GetInteractiveTileCursor( UINT32 uiOldCursor, BOOLEAN fConfirm ); BOOLEAN InteractWithInteractiveObject( SOLDIERTYPE *pSoldier, STRUCTURE *pStructure, UINT8 ubDirection ); BOOLEAN SoldierHandleInteractiveObject( SOLDIERTYPE *pSoldier ); @@ -35,7 +35,7 @@ void EndCurInteractiveTileCheck( ); void LogMouseOverInteractiveTile( INT16 sGridNo ); BOOLEAN ShouldCheckForMouseDetections( ); -void CycleIntTileFindStack( UINT16 usMapPos ); +void CycleIntTileFindStack( INT16 sMapPos ); void SetActionModeDoorCursorText( ); LEVELNODE *GetCurInteractiveTile( ); diff --git a/TileEngine/Isometric Utils.cpp b/TileEngine/Isometric Utils.cpp index 308db466..8686bf60 100644 --- a/TileEngine/Isometric Utils.cpp +++ b/TileEngine/Isometric Utils.cpp @@ -25,19 +25,19 @@ UINT32 guiForceRefreshMousePositionCalculation = 0; // GLOBALS INT16 DirIncrementer[8] = { - -MAPWIDTH, //N - 1-MAPWIDTH, //NE - 1, //E - 1+MAPWIDTH, //SE - MAPWIDTH, //S - MAPWIDTH-1, //SW - -1, //W - -MAPWIDTH-1 //NW + -MAPWIDTH, //N + 1-MAPWIDTH, //NE + 1, //E + 1+MAPWIDTH, //SE + MAPWIDTH, //S + MAPWIDTH-1, //SW + -1, //W + -MAPWIDTH-1 //NW }; // Opposite directions -UINT8 gOppositeDirection[ NUM_WORLD_DIRECTIONS ] = +UINT8 gOppositeDirection[ NUM_WORLD_DIRECTIONS ] = { SOUTH, SOUTHWEST, @@ -50,7 +50,7 @@ UINT8 gOppositeDirection[ NUM_WORLD_DIRECTIONS ] = }; -UINT8 gTwoCCDirection[ NUM_WORLD_DIRECTIONS ] = +UINT8 gTwoCCDirection[ NUM_WORLD_DIRECTIONS ] = { WEST, NORTHWEST, @@ -63,7 +63,7 @@ UINT8 gTwoCCDirection[ NUM_WORLD_DIRECTIONS ] = }; -UINT8 gTwoCDirection[ NUM_WORLD_DIRECTIONS ] = +UINT8 gTwoCDirection[ NUM_WORLD_DIRECTIONS ] = { EAST, SOUTHEAST, @@ -77,7 +77,7 @@ UINT8 gTwoCDirection[ NUM_WORLD_DIRECTIONS ] = }; -UINT8 gOneCDirection[ NUM_WORLD_DIRECTIONS ] = +UINT8 gOneCDirection[ NUM_WORLD_DIRECTIONS ] = { NORTHEAST, EAST, @@ -89,7 +89,7 @@ UINT8 gOneCDirection[ NUM_WORLD_DIRECTIONS ] = NORTH }; -UINT8 gOneCCDirection[ NUM_WORLD_DIRECTIONS ] = +UINT8 gOneCCDirection[ NUM_WORLD_DIRECTIONS ] = { NORTHWEST, NORTH, @@ -101,7 +101,7 @@ UINT8 gOneCCDirection[ NUM_WORLD_DIRECTIONS ] = WEST }; -// DIRECTION FACING DIRECTION WE WANT TO GOTO +// DIRECTION FACING DIRECTION WE WANT TO GOTO UINT8 gPurpendicularDirection[ NUM_WORLD_DIRECTIONS ][ NUM_WORLD_DIRECTIONS ] = { // NORTH @@ -198,8 +198,8 @@ void FromCellToScreenCoordinates( INT16 sCellX, INT16 sCellY, INT16 *psScreenX, void FromScreenToCellCoordinates( INT16 sScreenX, INT16 sScreenY, INT16 *psCellX, INT16 *psCellY ) { - *psCellX = ( ( sScreenX + ( 2 * sScreenY ) ) / 4 ); - *psCellY = ( ( 2 * sScreenY ) - sScreenX ) / 4; + *psCellX = ( ( sScreenX + ( 2 * sScreenY ) ) / 4 ); + *psCellY = ( ( 2 * sScreenY ) - sScreenX ) / 4; } // These two functions take into account that our world is projected and attached @@ -209,7 +209,7 @@ void FromScreenToCellCoordinates( INT16 sScreenX, INT16 sScreenY, INT16 *psCellX void FloatFromCellToScreenCoordinates( FLOAT dCellX, FLOAT dCellY, FLOAT *pdScreenX, FLOAT *pdScreenY ) { FLOAT dScreenX, dScreenY; - + dScreenX = ( 2 * dCellX ) - ( 2 * dCellY ); dScreenY = dCellX + dCellY; @@ -221,14 +221,14 @@ void FloatFromScreenToCellCoordinates( FLOAT dScreenX, FLOAT dScreenY, FLOAT *pd { FLOAT dCellX, dCellY; - dCellX = ( ( dScreenX + ( 2 * dScreenY ) ) / 4 ); - dCellY = ( ( 2 * dScreenY ) - dScreenX ) / 4; + dCellX = ( ( dScreenX + ( 2 * dScreenY ) ) / 4 ); + dCellY = ( ( 2 * dScreenY ) - dScreenX ) / 4; *pdCellX = dCellX; *pdCellY = dCellY; } - + BOOLEAN GetMouseXY( INT16 *psMouseX, INT16 *psMouseY ) { INT16 sWorldX, sWorldY; @@ -274,9 +274,9 @@ BOOLEAN GetMouseWorldCoords( INT16 *psMouseX, INT16 *psMouseY ) INT16 sOffsetX, sOffsetY; INT16 sTempPosX_W, sTempPosY_W; INT16 sStartPointX_W, sStartPointY_W; - + // Convert mouse screen coords into offset from center - if ( ! ( gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA ) ) + if ( ! ( gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA ) ) { *psMouseX = 0; *psMouseY = 0; @@ -301,7 +301,7 @@ BOOLEAN GetMouseWorldCoords( INT16 *psMouseX, INT16 *psMouseY ) // check if we are out of bounds.. - if ( sStartPointX_W < 0 || sStartPointX_W >= WORLD_COORD_ROWS || sStartPointY_W < 0 || sStartPointY_W >= WORLD_COORD_COLS ) + if ( sStartPointX_W < 0 || sStartPointX_W >= WORLD_COORD_ROWS || sStartPointY_W < 0 || sStartPointY_W >= WORLD_COORD_COLS ) { *psMouseX = 0; *psMouseY = 0; @@ -329,8 +329,8 @@ BOOLEAN GetMouseWorldCoordsInCenter( INT16 *psMouseX, INT16 *psMouseY ) } // Now adjust these cell coords into world coords - *psMouseX = ( ( sMouseX ) * CELL_X_SIZE ) + ( CELL_X_SIZE / 2 ); - *psMouseY = ( ( sMouseY ) * CELL_Y_SIZE ) + ( CELL_Y_SIZE / 2 ); + *psMouseX = ( ( sMouseX ) * CELL_X_SIZE ) + ( CELL_X_SIZE / 2 ); + *psMouseY = ( ( sMouseY ) * CELL_Y_SIZE ) + ( CELL_Y_SIZE / 2 ); return( TRUE ); @@ -338,62 +338,62 @@ BOOLEAN GetMouseWorldCoordsInCenter( INT16 *psMouseX, INT16 *psMouseY ) #if 0 // 0verhaul -// I did that (or actually uncasted a bunch of stuff and re-typed others to correct them), so +// I did that (or actually uncasted a bunch of stuff and re-typed others to correct them), so // no worries // (jonathanl) to save me having to cast all the previous code -BOOLEAN GetMouseMapPos( UINT16 *psMapPos ) +BOOLEAN GetMouseMapPos( INT16 *psMapPos ) { - return GetMouseMapPos( (INT16 *)psMapPos ); + return GetMouseMapPos( (INT16 *)psMapPos ); } #endif -BOOLEAN GetMouseMapPos( UINT16 *pusMapPos ) +BOOLEAN GetMouseMapPos( INT16 *pusMapPos ) { - INT16 sWorldX, sWorldY; - static INT16 sSameCursorPos; - static UINT32 uiOldFrameNumber = 99999; + INT16 sWorldX, sWorldY; + static INT16 sSameCursorPos; + static UINT32 uiOldFrameNumber = 99999; - // Check if this is the same frame as before, return already calculated value if so! - if ( uiOldFrameNumber == guiGameCycleCounter && !guiForceRefreshMousePositionCalculation ) - { - ( *pusMapPos ) = sSameCursorPos; + // Check if this is the same frame as before, return already calculated value if so! + if ( uiOldFrameNumber == guiGameCycleCounter && !guiForceRefreshMousePositionCalculation ) + { + ( *pusMapPos ) = sSameCursorPos; - if ( sSameCursorPos == 0 ) - { + if ( sSameCursorPos == 0 ) + { return( FALSE ); - } - return( TRUE ); - } + } + return( TRUE ); + } - uiOldFrameNumber = guiGameCycleCounter; - guiForceRefreshMousePositionCalculation = FALSE; + uiOldFrameNumber = guiGameCycleCounter; + guiForceRefreshMousePositionCalculation = FALSE; - if ( GetMouseXY( &sWorldX, &sWorldY ) ) - { + if ( GetMouseXY( &sWorldX, &sWorldY ) ) + { *pusMapPos = MAPROWCOLTOPOS( sWorldY, sWorldX ); sSameCursorPos = (*pusMapPos); return( TRUE ); - } - else - { - *pusMapPos = 0; + } + else + { + *pusMapPos = 0; sSameCursorPos = (*pusMapPos); return( FALSE ); - } + } } -BOOLEAN ConvertMapPosToWorldTileCenter( UINT16 usMapPos, INT16 *psXPos, INT16 *psYPos ) +BOOLEAN ConvertMapPosToWorldTileCenter( INT16 sMapPos, INT16 *psXPos, INT16 *psYPos ) { INT16 sWorldX, sWorldY; INT16 sCellX, sCellY; // Get X, Y world GRID Coordinates - sWorldY = ( usMapPos / WORLD_COLS ); - sWorldX = usMapPos - ( sWorldY * WORLD_COLS ); + sWorldY = ( sMapPos / WORLD_COLS ); + sWorldX = sMapPos - ( sWorldY * WORLD_COLS ); // Convert into cell coords sCellY = sWorldY * CELL_Y_SIZE; @@ -402,7 +402,7 @@ BOOLEAN ConvertMapPosToWorldTileCenter( UINT16 usMapPos, INT16 *psXPos, INT16 *p // Add center tile positions *psXPos = sCellX + ( CELL_X_SIZE / 2 ); *psYPos = sCellY + ( CELL_Y_SIZE / 2 ); - + return( TRUE ); } @@ -411,7 +411,7 @@ void GetScreenXYWorldCoords( INT16 sScreenX, INT16 sScreenY, INT16 *psWorldX, IN INT16 sOffsetX, sOffsetY; INT16 sTempPosX_W, sTempPosY_W; INT16 sStartPointX_W, sStartPointY_W; - + // Convert mouse screen coords into offset from center sOffsetX = sScreenX - ( gsVIEWPORT_END_X - gsVIEWPORT_START_X ) /2; sOffsetY = sScreenY - ( gsVIEWPORT_END_Y - gsVIEWPORT_START_Y ) /2; @@ -430,7 +430,7 @@ void GetScreenXYWorldCoords( INT16 sScreenX, INT16 sScreenY, INT16 *psWorldX, IN } - + void GetScreenXYWorldCell( INT16 sScreenX, INT16 sScreenY, INT16 *psWorldCellX, INT16 *psWorldCellY ) { INT16 sWorldX, sWorldY; @@ -451,18 +451,18 @@ void GetScreenXYGridNo( INT16 sScreenX, INT16 sScreenY, INT16 *psMapPos ) GetScreenXYWorldCell( sScreenX, sScreenY, &sWorldX, &sWorldY ); *psMapPos = MAPROWCOLTOPOS( sWorldY, sWorldX ); - + } void GetWorldXYAbsoluteScreenXY( INT32 sWorldCellX, INT32 sWorldCellY, INT16 *psWorldScreenX, INT16 *psWorldScreenY ) { INT16 sScreenCenterX, sScreenCenterY; INT16 sDistToCenterY, sDistToCenterX; - + // Find the diustance from render center to true world center sDistToCenterX = (INT16) ( ( sWorldCellX * CELL_X_SIZE ) - gCenterWorldX); sDistToCenterY = (INT16) ( ( sWorldCellY * CELL_Y_SIZE ) - gCenterWorldY); - + // From render center in world coords, convert to render center in "screen" coords @@ -482,24 +482,24 @@ void GetFromAbsoluteScreenXYWorldXY( INT32 *psWorldCellX, INT32* psWorldCellY, I { INT16 sWorldCenterX, sWorldCenterY; INT16 sDistToCenterY, sDistToCenterX; - + // Subtract screen center sDistToCenterX = sWorldScreenX - gsCX + gsTLX; sDistToCenterY = sWorldScreenY - gsCY + gsTLY; - + // From render center in world coords, convert to render center in "screen" coords // ATE: We should call the fowllowing function but I'm putting it here verbatim for speed //FromCellToScreenCoordinates( sDistToCenterX , sDistToCenterY, &sScreenCenterX, &sScreenCenterY ); - sWorldCenterX = ( ( sDistToCenterX + ( 2 * sDistToCenterY ) ) / 4 ); - sWorldCenterY = ( ( 2 * sDistToCenterY ) - sDistToCenterX ) / 4; + sWorldCenterX = ( ( sDistToCenterX + ( 2 * sDistToCenterY ) ) / 4 ); + sWorldCenterY = ( ( 2 * sDistToCenterY ) - sDistToCenterX ) / 4; // Goto center again *psWorldCellX = sWorldCenterX + gCenterWorldX; *psWorldCellY = sWorldCenterY + gCenterWorldY; } - + // UTILITY FUNTIONS @@ -510,31 +510,31 @@ INT32 OutOfBounds(INT16 sGridno, INT16 sProposedGridno) // get modulas of our origin sMod = sGridno % MAXCOL; - if (sMod != 0) // if we're not on leftmost grid - if (sMod != RIGHTMOSTGRID) // if we're not on rightmost grid - if (sGridno < LASTROWSTART) // if we're above bottom row - if (sGridno > MAXCOL) // if we're below top row - // Everything's OK - we're not on the edge of the map - return(FALSE); + if (sMod != 0) // if we're not on leftmost grid + if (sMod != RIGHTMOSTGRID) // if we're not on rightmost grid + if (sGridno < LASTROWSTART) // if we're above bottom row + if (sGridno > MAXCOL) // if we're below top row + // Everything's OK - we're not on the edge of the map + return(FALSE); - // if we've got this far, there's a potential problem - check it out! + // if we've got this far, there's a potential problem - check it out! if (sProposedGridno < 0) - return(TRUE); + return(TRUE); sPropMod = sProposedGridno % MAXCOL; if (sMod == 0 && sPropMod == RIGHTMOSTGRID) - return(TRUE); - else - if (sMod == RIGHTMOSTGRID && sPropMod == 0) return(TRUE); else - if (sGridno >= LASTROWSTART && sProposedGridno >= GRIDSIZE) + if (sMod == RIGHTMOSTGRID && sPropMod == 0) return(TRUE); - else - return(FALSE); + else + if (sGridno >= LASTROWSTART && sProposedGridno >= GRIDSIZE) + return(TRUE); + else + return(FALSE); } @@ -543,7 +543,7 @@ INT16 NewGridNo(INT16 sGridno, INT16 sDirInc) { INT16 sProposedGridno = sGridno + sDirInc; - // now check for out-of-bounds + // now check for out-of-bounds if (OutOfBounds(sGridno,sProposedGridno)) // return ORIGINAL gridno to user sProposedGridno = sGridno; @@ -555,17 +555,17 @@ INT16 NewGridNo(INT16 sGridno, INT16 sDirInc) INT16 DirectionInc(UINT8 ubDirection) { if (ubDirection > 7) - { + { //#ifdef BETAVERSION -// NumMessage("DirectionInc: Invalid direction received, = ",direction); +// NumMessage("DirectionInc: Invalid direction received, = ",direction); //#endif - //direction = random(8); // replace garbage with random direction + //direction = random(8); // replace garbage with random direction ubDirection = 0; - } + } + - return(DirIncrementer[ubDirection]); } @@ -621,7 +621,7 @@ INT32 GetRangeFromGridNoDiff( INT16 sGridNo1, INT16 sGridNo2 ) // Convert our grid-not into an XY ConvertGridNoToXY( sGridNo2, &sXPos2, &sYPos2 ); - uiDist = (INT16)sqrt((double) ( sXPos2 - sXPos )*( sXPos2 - sXPos ) + ( sYPos2 - sYPos ) * ( sYPos2 - sYPos ) ); + uiDist = (INT16)sqrt((double) ( sXPos2 - sXPos )*( sXPos2 - sXPos ) + ( sYPos2 - sYPos ) * ( sYPos2 - sYPos ) ); return( uiDist ); } @@ -636,7 +636,7 @@ INT32 GetRangeInCellCoordsFromGridNoDiff( INT16 sGridNo1, INT16 sGridNo2 ) // Convert our grid-not into an XY ConvertGridNoToXY( sGridNo2, &sXPos2, &sYPos2 ); - return( (INT32)( sqrt((double) ( sXPos2 - sXPos ) * ( sXPos2 - sXPos ) + ( sYPos2 - sYPos ) * ( sYPos2 - sYPos ) ) ) * CELL_X_SIZE ); + return( (INT32)( sqrt((double) ( sXPos2 - sXPos ) * ( sXPos2 - sXPos ) + ( sYPos2 - sYPos ) * ( sYPos2 - sYPos ) ) ) * CELL_X_SIZE ); } @@ -675,7 +675,7 @@ INT16 PythSpacesAway(INT16 sOrigin, INT16 sDest) sRows = (INT16) abs((sOrigin / MAXCOL) - (sDest / MAXCOL)); sCols = (INT16) abs((sOrigin % MAXROW) - (sDest % MAXROW)); - + // apply Pythagoras's theorem for right-handed triangle: // dist^2 = rows^2 + cols^2, so use the square root to get the distance sResult = (INT16)sqrt((double) (sRows * sRows) + (sCols * sCols)); @@ -694,7 +694,7 @@ INT16 SpacesAway(INT16 sOrigin, INT16 sDest) return( __max( sRows, sCols ) ); } -INT16 CardinalSpacesAway(INT16 sOrigin, INT16 sDest) +INT16 CardinalSpacesAway(INT16 sOrigin, INT16 sDest) // distance away, ignoring diagonals! { INT16 sRows,sCols; @@ -709,7 +709,7 @@ INT8 FindNumTurnsBetweenDirs( INT8 sDir1, INT8 sDir2 ) { INT16 sDirection; INT16 sNumTurns = 0; - + sDirection = sDir1; do @@ -719,7 +719,7 @@ INT8 FindNumTurnsBetweenDirs( INT8 sDir1, INT8 sDir2 ) if (sDirection > 7) { - sDirection = 0; + sDirection = 0; } else { @@ -763,12 +763,12 @@ BOOLEAN FindHeigherLevel( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bStartingDi { return( FALSE ); } - + // LOOP THROUGH ALL 8 DIRECTIONS for ( cnt = 0; cnt < 8; cnt+= 2 ) { - sNewGridNo = NewGridNo( (UINT16)sGridNo, (UINT16)DirectionInc( (UINT8)cnt ) ); - + sNewGridNo = NewGridNo( (INT16)sGridNo, (UINT16)DirectionInc( (UINT8)cnt ) ); + if ( NewOKDestination( pSoldier, sNewGridNo, TRUE, 1 ) ) { // Check if this tile has a higher level @@ -777,7 +777,7 @@ BOOLEAN FindHeigherLevel( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bStartingDi fFound = TRUE; // FInd how many turns we should go to get here - bNumTurns = FindNumTurnsBetweenDirs( (INT8)cnt, bStartingDir ); + bNumTurns = FindNumTurnsBetweenDirs( (INT8)cnt, bStartingDir ); if ( bNumTurns < bMinNumTurns ) { @@ -809,8 +809,8 @@ BOOLEAN FindLowerLevel( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bStartingDir, // LOOP THROUGH ALL 8 DIRECTIONS for ( cnt = 0; cnt < 8; cnt+= 2 ) { - sNewGridNo = NewGridNo( (UINT16)sGridNo, (UINT16)DirectionInc( (UINT8)cnt ) ); - + sNewGridNo = NewGridNo( (INT16)sGridNo, (UINT16)DirectionInc( (UINT8)cnt ) ); + // Make sure there is NOT a roof here... // Check OK destination if ( NewOKDestination( pSoldier, sNewGridNo, TRUE, 0 ) ) @@ -821,7 +821,7 @@ BOOLEAN FindLowerLevel( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bStartingDir, fFound = TRUE; // FInd how many turns we should go to get here - bNumTurns = FindNumTurnsBetweenDirs( (INT8)cnt, bStartingDir ); + bNumTurns = FindNumTurnsBetweenDirs( (INT8)cnt, bStartingDir ); if ( bNumTurns < bMinNumTurns ) { @@ -849,29 +849,29 @@ INT16 QuickestDirection(INT16 origin, INT16 dest) INT16 v1,v2; if (origin==dest) - return(0); + return(0); if ((abs(origin - dest)) == 4) - return(1); // this could be made random + return(1); // this could be made random else - if (origin > dest) - { + if (origin > dest) + { v1 = (INT16) abs(origin - dest); - v2 = (8 - origin) + dest; - if (v1 > v2) - return(1); - else - return(-1); - } - else - { + v2 = (8 - origin) + dest; + if (v1 > v2) + return(1); + else + return(-1); + } + else + { v1 = (INT16) abs(origin - dest); - v2 = (8 - dest) + origin; - if (v1 > v2) - return(-1); - else - return(1); - } + v2 = (8 - dest) + origin; + if (v1 > v2) + return(-1); + else + return(1); + } } @@ -880,34 +880,34 @@ INT16 ExtQuickestDirection(INT16 origin, INT16 dest) INT16 v1,v2; if (origin==dest) - return(0); + return(0); if ((abs(origin - dest)) == 16) - return(1); // this could be made random + return(1); // this could be made random else - if (origin > dest) - { + if (origin > dest) + { v1 = (INT16) abs(origin - dest); - v2 = (32 - origin) + dest; - if (v1 > v2) - return(1); - else - return(-1); - } - else - { + v2 = (32 - origin) + dest; + if (v1 > v2) + return(1); + else + return(-1); + } + else + { v1 = (INT16) abs(origin - dest); - v2 = (32 - dest) + origin; - if (v1 > v2) - return(-1); - else - return(1); - } + v2 = (32 - dest) + origin; + if (v1 > v2) + return(-1); + else + return(1); + } } // Returns the (center ) cell coordinates in X -INT16 CenterX( INT16 sGridNo ) +INT16 CenterX( INT16 sGridNo ) { INT16 sYPos, sXPos; @@ -919,7 +919,7 @@ INT16 CenterX( INT16 sGridNo ) // Returns the (center ) cell coordinates in Y -INT16 CenterY( INT16 sGridNo ) +INT16 CenterY( INT16 sGridNo ) { INT16 sYPos, sXPos; @@ -930,7 +930,7 @@ INT16 CenterY( INT16 sGridNo ) } -INT16 MapX( INT16 sGridNo ) +INT16 MapX( INT16 sGridNo ) { INT16 sYPos, sXPos; @@ -941,7 +941,7 @@ INT16 MapX( INT16 sGridNo ) } -INT16 MapY( INT16 sGridNo ) +INT16 MapY( INT16 sGridNo ) { INT16 sYPos, sXPos; @@ -966,7 +966,7 @@ BOOLEAN GridNoOnVisibleWorldTile( INT16 sGridNo ) GetWorldXYAbsoluteScreenXY( sXMapPos, sYMapPos, &sWorldX, &sWorldY); if ( sWorldX > 0 && sWorldX < ( gsTRX - gsTLX - 20 ) && - sWorldY > 20 && sWorldY < ( gsBLY - gsTLY - 20 ) ) + sWorldY > 20 && sWorldY < ( gsBLY - gsTLY - 20 ) ) { return( TRUE ); } @@ -991,7 +991,7 @@ BOOLEAN GridNoOnVisibleWorldTileGivenYLimits( INT16 sGridNo ) GetWorldXYAbsoluteScreenXY( sXMapPos, sYMapPos, &sWorldX, &sWorldY); if ( sWorldX > 0 && sWorldX < ( gsTRX - gsTLX - 20 ) && - sWorldY > 40 && sWorldY < ( gsBLY - gsTLY - 20 ) ) + sWorldY > 40 && sWorldY < ( gsBLY - gsTLY - 20 ) ) { return( TRUE ); } @@ -1038,9 +1038,9 @@ BOOLEAN FindFenceJumpDirection( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bStar for ( cnt = 0; cnt < 8; cnt+= 2 ) { // go out *2* tiles - sNewGridNo = NewGridNo( (UINT16)sGridNo, (UINT16)DirectionInc( (UINT8)cnt ) ); - sOtherSideOfFence = NewGridNo( (UINT16)sNewGridNo, (UINT16)DirectionInc( (UINT8)cnt ) ); - + sNewGridNo = NewGridNo( (INT16)sGridNo, (UINT16)DirectionInc( (UINT8)cnt ) ); + sOtherSideOfFence = NewGridNo( (INT16)sNewGridNo, (UINT16)DirectionInc( (UINT8)cnt ) ); + if ( NewOKDestination( pSoldier, sOtherSideOfFence, TRUE, 0 ) ) { // ATE: Check if there is somebody waiting here..... @@ -1052,7 +1052,7 @@ BOOLEAN FindFenceJumpDirection( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bStar fFound = TRUE; // FInd how many turns we should go to get here - bNumTurns = FindNumTurnsBetweenDirs( (INT8)cnt, bStartingDir ); + bNumTurns = FindNumTurnsBetweenDirs( (INT8)cnt, bStartingDir ); if ( bNumTurns < bMinNumTurns ) { diff --git a/TileEngine/Isometric Utils.h b/TileEngine/Isometric Utils.h index f78a03bb..c068dcf6 100644 --- a/TileEngine/Isometric Utils.h +++ b/TileEngine/Isometric Utils.h @@ -6,10 +6,10 @@ //DEFINES #define MAXCOL WORLD_COLS #define MAXROW WORLD_ROWS -#define GRIDSIZE (MAXCOL * MAXROW) -#define RIGHTMOSTGRID (MAXCOL - 1) -#define LASTROWSTART (GRIDSIZE - MAXCOL) -#define NOWHERE (GRIDSIZE + 1) +#define GRIDSIZE (MAXCOL * MAXROW) +#define RIGHTMOSTGRID (MAXCOL - 1) +#define LASTROWSTART (GRIDSIZE - MAXCOL) +#define NOWHERE (GRIDSIZE + 1) //#define NO_MAP_POS NOWHERE #define MAPWIDTH (WORLD_COLS) #define MAPHEIGHT (WORLD_ROWS) @@ -30,7 +30,7 @@ extern UINT8 gPurpendicularDirection[ NUM_WORLD_DIRECTIONS ][ NUM_WORLD_DIRECTIO // Macros -// |Check for map bounds------------------------------------------| |Invalid-| |Valid-------------------| +// |Check for map bounds------------------------------------------| |Invalid-| |Valid-------------------| #define MAPROWCOLTOPOS( r, c ) ( ( (r < 0) || (r >= WORLD_ROWS) || (c < 0) || (c >= WORLD_COLS) ) ? ( 0xffff ) : ( (r) * WORLD_COLS + (c) ) ) #define GETWORLDINDEXFROMWORLDCOORDS( y, x ) ( (INT16) ( x / CELL_X_SIZE ) ) + WORLD_COLS * ( (INT16) ( y / CELL_Y_SIZE ) ) @@ -50,7 +50,7 @@ INT32 OutOfBounds(INT16 sGridno, INT16 sProposedGridno); BOOLEAN GetMouseCell( INT32 *piMouseMapPos ); BOOLEAN GetMouseXY( INT16 *psMouseX, INT16 *psMouseY ); BOOLEAN GetMouseWorldCoords( INT16 *psMouseX, INT16 *psMouseY ); -BOOLEAN GetMouseMapPos( UINT16 *psMapPos ); +BOOLEAN GetMouseMapPos( INT16 *psMapPos ); BOOLEAN GetMouseWorldCoordsInCenter( INT16 *psMouseX, INT16 *psMouseY ); BOOLEAN GetMouseXYWithRemainder( INT16 *psMouseX, INT16 *psMouseY, INT16 *psCellX, INT16 *psCellY ); @@ -74,7 +74,7 @@ BOOLEAN GridNoOnVisibleWorldTile( INT16 sGridNo ); BOOLEAN GridNoOnVisibleWorldTileGivenYLimits( INT16 sGridNo ); BOOLEAN GridNoOnEdgeOfMap( INT16 sGridNo, INT8 * pbDirection ); -BOOLEAN ConvertMapPosToWorldTileCenter( UINT16 usMapPos, INT16 *psXPos, INT16 *psYPos ); +BOOLEAN ConvertMapPosToWorldTileCenter( INT16 sMapPos, INT16 *psXPos, INT16 *psYPos ); BOOLEAN CellXYToScreenXY(INT16 sCellX, INT16 sCellY, INT16 *sScreenX, INT16 *sScreenY); diff --git a/TileEngine/LightEffects.cpp b/TileEngine/LightEffects.cpp index 4fa74905..92560c21 100644 --- a/TileEngine/LightEffects.cpp +++ b/TileEngine/LightEffects.cpp @@ -8,10 +8,10 @@ #include "wcheck.h" #include "stdlib.h" #include "debug.h" - #include "soldier control.h" + //#include "soldier control.h" #include "weapons.h" #include "handle items.h" - #include "worlddef.h" + #include "worlddef.h" #include "worldman.h" #include "animation control.h" #include "tile animation.h" @@ -32,6 +32,11 @@ #include "SaveLoadGame.h" +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + #define NUM_LIGHT_EFFECT_SLOTS 25 @@ -85,7 +90,7 @@ void UpdateLightingSprite( LIGHTEFFECT *pLight ) // Delete old one if one exists... if( pLight->iLight!=(-1) ) { - LightSpriteDestroy( pLight->iLight ); + LightSpriteDestroy( pLight->iLight ); pLight->iLight = -1; } @@ -103,7 +108,7 @@ void UpdateLightingSprite( LIGHTEFFECT *pLight ) INT32 NewLightEffect( INT16 sGridNo, UINT8 ubDuration, UINT8 ubStartRadius ) -{ +{ LIGHTEFFECT *pLight; INT32 iLightIndex; @@ -120,18 +125,18 @@ INT32 NewLightEffect( INT16 sGridNo, UINT8 ubDuration, UINT8 ubStartRadius ) pLight->uiTimeOfLastUpdate = GetWorldTotalSeconds( ); pLight->ubDuration = ubDuration; - pLight->bRadius = ubStartRadius; + pLight->bRadius = ubStartRadius; pLight->bAge = 0; - pLight->fAllocated = TRUE; + pLight->fAllocated = TRUE; UpdateLightingSprite( pLight ); - // Handle sight here.... + // Handle sight here.... AllTeamsLookForAll( FALSE ); //Play the breaklight sound // PlayJA2Sample( BREAK_LIGHT_IGNITING, RATE_11025, SoundVolume( LOWVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); -// MAdd: for some reason this crashes the game! +// MAdd: for some reason this crashes the game! return( pLight->iLight ); } @@ -143,10 +148,10 @@ void RemoveLightEffectFromTile( INT16 sGridNo ) UINT32 cnt; // Set to unallocated.... - for ( cnt = 0; cnt < guiNumLightEffects; cnt++ ) - { + for ( cnt = 0; cnt < guiNumLightEffects; cnt++ ) + { pLight = &gLightEffectData[ cnt ]; - + if ( pLight->fAllocated ) { if ( pLight->sGridNo == sGridNo ) @@ -156,7 +161,7 @@ void RemoveLightEffectFromTile( INT16 sGridNo ) // Remove light.... if( pLight->iLight != (-1) ) { - LightSpriteDestroy( pLight->iLight ); + LightSpriteDestroy( pLight->iLight ); } break; } @@ -171,10 +176,10 @@ BOOLEAN IsLightEffectAtTile( INT16 sGridNo ) UINT32 cnt; // Set to unallocated.... - for ( cnt = 0; cnt < guiNumLightEffects; cnt++ ) - { + for ( cnt = 0; cnt < guiNumLightEffects; cnt++ ) + { pLight = &gLightEffectData[ cnt ]; - + if ( pLight->fAllocated ) { if ( pLight->sGridNo == sGridNo ) @@ -184,27 +189,27 @@ BOOLEAN IsLightEffectAtTile( INT16 sGridNo ) } } - return FALSE; + return FALSE; } void DecayLightEffects( UINT32 uiTime ) { LIGHTEFFECT *pLight; UINT32 cnt, cnt2; - BOOLEAN fDelete = FALSE; - UINT16 usNumUpdates = 1; + BOOLEAN fDelete = FALSE; + UINT16 usNumUpdates = 1; - // age all active tear gas clouds, deactivate those that are just dispersing - for ( cnt = 0; cnt < guiNumLightEffects; cnt++ ) - { + // age all active tear gas clouds, deactivate those that are just dispersing + for ( cnt = 0; cnt < guiNumLightEffects; cnt++ ) + { pLight = &gLightEffectData[ cnt ]; - + fDelete = FALSE; if ( pLight->fAllocated ) { // ATE: Do this every so ofte, to acheive the effect we want... - if ( ( uiTime - pLight->uiTimeOfLastUpdate ) > 10 ) + if ( ( uiTime - pLight->uiTimeOfLastUpdate ) > 10 ) { usNumUpdates = ( UINT16 ) ( ( uiTime - pLight->uiTimeOfLastUpdate ) / 10 ); @@ -246,20 +251,20 @@ void DecayLightEffects( UINT32 uiTime ) if ( fDelete ) { - pLight->fAllocated = FALSE; + pLight->fAllocated = FALSE; if( pLight->iLight != (-1) ) { - LightSpriteDestroy( pLight->iLight ); + LightSpriteDestroy( pLight->iLight ); } } - + // Handle sight here.... AllTeamsLookForAll( FALSE ); } } - } + } } @@ -315,10 +320,10 @@ BOOLEAN LoadLightEffectsFromLoadGameFile( HWFILE hFile ) UINT32 uiNumBytesRead; UINT32 uiCount; - //no longer need to load Light effects. They are now in temp files - if( guiSaveGameVersion < 76 ) + //no longer need to load Light effects. They are now in temp files + if( guiCurrentSaveGameVersion < 76 ) { - memset( gLightEffectData, 0, sizeof( LIGHTEFFECT ) * NUM_LIGHT_EFFECT_SLOTS ); + memset( gLightEffectData, 0, sizeof( LIGHTEFFECT ) * NUM_LIGHT_EFFECT_SLOTS ); //Load the Number of Light Effects FileRead( hFile, &guiNumLightEffects, sizeof( UINT32 ), &uiNumBytesRead ); @@ -347,7 +352,7 @@ BOOLEAN LoadLightEffectsFromLoadGameFile( HWFILE hFile ) for(uiCount=0; uiCount < guiNumLightEffects; uiCount++) { if( gLightEffectData[uiCount].fAllocated ) - UpdateLightingSprite( &( gLightEffectData[uiCount] ) ); + UpdateLightingSprite( &( gLightEffectData[uiCount] ) ); } } @@ -440,7 +445,6 @@ BOOLEAN LoadLightEffectsFromMapTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) UINT32 uiCount; UINT32 uiCnt=0; HWFILE hFile; - UINT32 uiNumBytesWritten=0; CHAR8 zMapName[ 128 ]; GetMapTempFileName( SF_LIGHTING_EFFECTS_TEMP_FILE_EXISTS, zMapName, sMapX, sMapY, bMapZ ); @@ -482,7 +486,7 @@ BOOLEAN LoadLightEffectsFromMapTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) for(uiCount=0; uiCount < guiNumLightEffects; uiCount++) { if( gLightEffectData[uiCount].fAllocated ) - UpdateLightingSprite( &( gLightEffectData[uiCount] ) ); + UpdateLightingSprite( &( gLightEffectData[uiCount] ) ); } FileClose( hFile ); diff --git a/TileEngine/LightEffects.h b/TileEngine/LightEffects.h index 78aaa979..28f5cd4a 100644 --- a/TileEngine/LightEffects.h +++ b/TileEngine/LightEffects.h @@ -13,11 +13,11 @@ enum typedef struct { - INT16 sGridNo; // gridno at which the tear gas cloud is centered + INT16 sGridNo; // gridno at which the tear gas cloud is centered - UINT8 ubDuration; // the number of turns will remain effective - UINT8 bRadius; // the current radius - UINT8 bAge; // the number of turns light has been around + UINT8 ubDuration; // the number of turns will remain effective + UINT8 bRadius; // the current radius + UINT8 bAge; // the number of turns light has been around BOOLEAN fAllocated; INT8 bType; INT32 iLight; diff --git a/TileEngine/Map Edgepoints.cpp b/TileEngine/Map Edgepoints.cpp index e5e45b32..b1066e96 100644 --- a/TileEngine/Map Edgepoints.cpp +++ b/TileEngine/Map Edgepoints.cpp @@ -3,7 +3,7 @@ #else #include #include "Map Edgepoints.h" - #include "Soldier Control.h" + #include "pathai.h" #include "ai.h" #include "Map Information.h" @@ -19,6 +19,11 @@ #include "worldman.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + //dynamic arrays that contain the valid gridno's for each edge INT16 *gps1stNorthEdgepointArray = NULL; INT16 *gps1stEastEdgepointArray = NULL; @@ -122,10 +127,6 @@ void ValidateEdgepoints() INT32 i; UINT16 usValidEdgepoints; SOLDIERTYPE Soldier; - - // WDS - Clean up inventory handling -// memset( &Soldier, 0, SIZEOF_SOLDIERTYPE ); - Soldier.initialize(); Soldier.bTeam = 1; //north @@ -316,9 +317,9 @@ void CompactEdgepointArray( INT16 **psArray, UINT16 *pusMiddleIndex, UINT16 *pus Assert( *psArray ); } -void InternallyClassifyEdgepoints( SOLDIERTYPE *pSoldier, INT16 sGridNo, - INT16 **psArray1, UINT16 *pusMiddleIndex1, UINT16 *pusArraySize1, - INT16 **psArray2, UINT16 *pusMiddleIndex2, UINT16 *pusArraySize2 ) +void InternallyClassifyEdgepoints( SOLDIERTYPE *pSoldier, INT16 sGridNo, + INT16 **psArray1, UINT16 *pusMiddleIndex1, UINT16 *pusArraySize1, + INT16 **psArray2, UINT16 *pusMiddleIndex2, UINT16 *pusArraySize2 ) { INT32 i; UINT16 us1stBenchmarkID, us2ndBenchmarkID; @@ -360,8 +361,8 @@ void InternallyClassifyEdgepoints( SOLDIERTYPE *pSoldier, INT16 sGridNo, break; } } - //Now we have found the two benchmarks, so go in both directions for each one to determine which entrypoints - //are going to be used in the primary array. All rejections will be positioned in the secondary array for + //Now we have found the two benchmarks, so go in both directions for each one to determine which entrypoints + //are going to be used in the primary array. All rejections will be positioned in the secondary array for //use for isolated entry when tactically traversing. if( us1stBenchmarkID != 0xffff ) { @@ -401,7 +402,7 @@ void InternallyClassifyEdgepoints( SOLDIERTYPE *pSoldier, INT16 sGridNo, for( i = us2ndBenchmarkID; i > *pusMiddleIndex1; i-- ) { if( !EdgepointsClose( pSoldier, (*psArray1)[ i ], (*psArray1)[ i-1 ] ) ) - { //All edgepoints from 1st middle index to i-1 are rejected. + { //All edgepoints from 1st middle index to i-1 are rejected. while( i > *pusMiddleIndex1 ) { i--; @@ -437,9 +438,6 @@ void ClassifyEdgepoints() SOLDIERTYPE Soldier; INT16 sGridNo = -1; - // WDS - Clean up inventory handling -// memset( &Soldier, 0, SIZEOF_SOLDIERTYPE ); - Soldier.initialize(); Soldier.bTeam = 1; //north @@ -447,8 +445,8 @@ void ClassifyEdgepoints() { sGridNo = FindNearestEdgepointOnSpecifiedEdge( gMapInformation.sNorthGridNo, NORTH_EDGEPOINT_SEARCH ); if( sGridNo != NOWHERE ) - { - InternallyClassifyEdgepoints( &Soldier, sGridNo, + { + InternallyClassifyEdgepoints( &Soldier, sGridNo, &gps1stNorthEdgepointArray, &gus1stNorthEdgepointMiddleIndex, &gus1stNorthEdgepointArraySize, &gps2ndNorthEdgepointArray, &gus2ndNorthEdgepointMiddleIndex, &gus2ndNorthEdgepointArraySize ); } @@ -458,8 +456,8 @@ void ClassifyEdgepoints() { sGridNo = FindNearestEdgepointOnSpecifiedEdge( gMapInformation.sEastGridNo, EAST_EDGEPOINT_SEARCH ); if( sGridNo != NOWHERE ) - { - InternallyClassifyEdgepoints( &Soldier, sGridNo, + { + InternallyClassifyEdgepoints( &Soldier, sGridNo, &gps1stEastEdgepointArray, &gus1stEastEdgepointMiddleIndex, &gus1stEastEdgepointArraySize, &gps2ndEastEdgepointArray, &gus2ndEastEdgepointMiddleIndex, &gus2ndEastEdgepointArraySize ); } @@ -469,8 +467,8 @@ void ClassifyEdgepoints() { sGridNo = FindNearestEdgepointOnSpecifiedEdge( gMapInformation.sSouthGridNo, SOUTH_EDGEPOINT_SEARCH ); if( sGridNo != NOWHERE ) - { - InternallyClassifyEdgepoints( &Soldier, sGridNo, + { + InternallyClassifyEdgepoints( &Soldier, sGridNo, &gps1stSouthEdgepointArray, &gus1stSouthEdgepointMiddleIndex, &gus1stSouthEdgepointArraySize, &gps2ndSouthEdgepointArray, &gus2ndSouthEdgepointMiddleIndex, &gus2ndSouthEdgepointArraySize ); } @@ -480,8 +478,8 @@ void ClassifyEdgepoints() { sGridNo = FindNearestEdgepointOnSpecifiedEdge( gMapInformation.sWestGridNo, WEST_EDGEPOINT_SEARCH ); if( sGridNo != NOWHERE ) - { - InternallyClassifyEdgepoints( &Soldier, sGridNo, + { + InternallyClassifyEdgepoints( &Soldier, sGridNo, &gps1stWestEdgepointArray, &gus1stWestEdgepointMiddleIndex, &gus1stWestEdgepointArraySize, &gps2ndWestEdgepointArray, &gus2ndWestEdgepointMiddleIndex, &gus2ndWestEdgepointArraySize ); } @@ -493,8 +491,6 @@ void GenerateMapEdgepoints() INT32 i=-1; INT16 sGridNo=-1; INT16 sVGridNo[400]; - UINT8 gubSaveNPCAPBudget=0; - UINT8 gubSaveNPCDistLimit=0; //Get rid of the current edgepoint lists. TrashMapEdgepoints(); @@ -521,39 +517,39 @@ void GenerateMapEdgepoints() { //1st row sGridNo = gsTLGridNo; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stNorthEdgepointArraySize++ ] = sGridNo; while( sGridNo > gsTRGridNo ) { sGridNo++; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stNorthEdgepointArraySize++ ] = sGridNo; sGridNo -= 160; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stNorthEdgepointArraySize++ ] = sGridNo; } //2nd row gus1stNorthEdgepointMiddleIndex = gus1stNorthEdgepointArraySize; sGridNo = gsTLGridNo + 161; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stNorthEdgepointArraySize++ ] = sGridNo; while( sGridNo > gsTRGridNo + 161 ) { sGridNo++; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stNorthEdgepointArraySize++ ] = sGridNo; sGridNo -= 160; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stNorthEdgepointArraySize++ ] = sGridNo; } if( gus1stNorthEdgepointArraySize ) - { + { //Allocate and copy over the valid gridnos. gps1stNorthEdgepointArray = (INT16*)MemAlloc( gus1stNorthEdgepointArraySize * sizeof( INT16) ); for( i = 0; i < gus1stNorthEdgepointArraySize; i++ ) @@ -565,35 +561,35 @@ void GenerateMapEdgepoints() { //1st row sGridNo = gsTRGridNo; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stEastEdgepointArraySize++ ] = sGridNo; while( sGridNo < gsBRGridNo ) { sGridNo += 160; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stEastEdgepointArraySize++ ] = sGridNo; sGridNo++; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stEastEdgepointArraySize++ ] = sGridNo; } //2nd row gus1stEastEdgepointMiddleIndex = gus1stEastEdgepointArraySize; sGridNo = gsTRGridNo + 159; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stEastEdgepointArraySize++ ] = sGridNo; while( sGridNo < gsBRGridNo + 159 ) { sGridNo += 160; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stEastEdgepointArraySize++ ] = sGridNo; sGridNo++; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stEastEdgepointArraySize++ ] = sGridNo; } if( gus1stEastEdgepointArraySize ) @@ -608,35 +604,35 @@ void GenerateMapEdgepoints() { //1st row sGridNo = gsBLGridNo; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stSouthEdgepointArraySize++ ] = sGridNo; while( sGridNo > gsBRGridNo ) { sGridNo++; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stSouthEdgepointArraySize++ ] = sGridNo; sGridNo -= 160; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stSouthEdgepointArraySize++ ] = sGridNo; } //2nd row gus1stSouthEdgepointMiddleIndex = gus1stSouthEdgepointArraySize; sGridNo = gsBLGridNo - 161; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stSouthEdgepointArraySize++ ] = sGridNo; while( sGridNo > gsBRGridNo - 161 ) { sGridNo++; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stSouthEdgepointArraySize++ ] = sGridNo; sGridNo -= 160; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stSouthEdgepointArraySize++ ] = sGridNo; } if( gus1stSouthEdgepointArraySize ) @@ -651,35 +647,35 @@ void GenerateMapEdgepoints() { //1st row sGridNo = gsTLGridNo; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stWestEdgepointArraySize++ ] = sGridNo; while( sGridNo < gsBLGridNo ) { sGridNo++; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stWestEdgepointArraySize++ ] = sGridNo; sGridNo += 160; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stWestEdgepointArraySize++ ] = sGridNo; } //2nd row gus1stWestEdgepointMiddleIndex = gus1stWestEdgepointArraySize; sGridNo = gsTLGridNo - 159; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stWestEdgepointArraySize++ ] = sGridNo; while( sGridNo < gsBLGridNo - 159 ) { sGridNo++; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stWestEdgepointArraySize++ ] = sGridNo; sGridNo += 160; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus1stWestEdgepointArraySize++ ] = sGridNo; } if( gus1stWestEdgepointArraySize ) @@ -698,39 +694,39 @@ void GenerateMapEdgepoints() { //1st row sGridNo = gsTLGridNo; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndNorthEdgepointArraySize++ ] = sGridNo; while( sGridNo > gsTRGridNo ) { sGridNo++; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndNorthEdgepointArraySize++ ] = sGridNo; sGridNo -= 160; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndNorthEdgepointArraySize++ ] = sGridNo; } //2nd row gus2ndNorthEdgepointMiddleIndex = gus2ndNorthEdgepointArraySize; sGridNo = gsTLGridNo + 161; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndNorthEdgepointArraySize++ ] = sGridNo; while( sGridNo > gsTRGridNo + 161 ) { sGridNo++; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndNorthEdgepointArraySize++ ] = sGridNo; sGridNo -= 160; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndNorthEdgepointArraySize++ ] = sGridNo; } if( gus2ndNorthEdgepointArraySize ) - { + { //Allocate and copy over the valid gridnos. gps2ndNorthEdgepointArray = (INT16*)MemAlloc( gus2ndNorthEdgepointArraySize * sizeof( INT16) ); for( i = 0; i < gus2ndNorthEdgepointArraySize; i++ ) @@ -742,35 +738,35 @@ void GenerateMapEdgepoints() { //1st row sGridNo = gsTRGridNo; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndEastEdgepointArraySize++ ] = sGridNo; while( sGridNo < gsBRGridNo ) { sGridNo += 160; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndEastEdgepointArraySize++ ] = sGridNo; sGridNo++; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndEastEdgepointArraySize++ ] = sGridNo; } //2nd row gus2ndEastEdgepointMiddleIndex = gus2ndEastEdgepointArraySize; sGridNo = gsTRGridNo + 159; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndEastEdgepointArraySize++ ] = sGridNo; while( sGridNo < gsBRGridNo + 159 ) { sGridNo += 160; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndEastEdgepointArraySize++ ] = sGridNo; sGridNo++; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndEastEdgepointArraySize++ ] = sGridNo; } if( gus2ndEastEdgepointArraySize ) @@ -785,35 +781,35 @@ void GenerateMapEdgepoints() { //1st row sGridNo = gsBLGridNo; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndSouthEdgepointArraySize++ ] = sGridNo; while( sGridNo > gsBRGridNo ) { sGridNo++; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndSouthEdgepointArraySize++ ] = sGridNo; sGridNo -= 160; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndSouthEdgepointArraySize++ ] = sGridNo; } //2nd row gus2ndSouthEdgepointMiddleIndex = gus2ndSouthEdgepointArraySize; sGridNo = gsBLGridNo - 161; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndSouthEdgepointArraySize++ ] = sGridNo; while( sGridNo > gsBRGridNo - 161 ) { sGridNo++; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndSouthEdgepointArraySize++ ] = sGridNo; sGridNo -= 160; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndSouthEdgepointArraySize++ ] = sGridNo; } if( gus2ndSouthEdgepointArraySize ) @@ -828,35 +824,35 @@ void GenerateMapEdgepoints() { //1st row sGridNo = gsTLGridNo; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndWestEdgepointArraySize++ ] = sGridNo; while( sGridNo < gsBLGridNo ) { sGridNo++; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndWestEdgepointArraySize++ ] = sGridNo; sGridNo += 160; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndWestEdgepointArraySize++ ] = sGridNo; } //2nd row gus2ndWestEdgepointMiddleIndex = gus2ndWestEdgepointArraySize; sGridNo = gsTLGridNo - 159; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndWestEdgepointArraySize++ ] = sGridNo; while( sGridNo < gsBLGridNo - 159 ) { sGridNo++; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndWestEdgepointArraySize++ ] = sGridNo; sGridNo += 160; - if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && - (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) + if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REACHABLE && + (!gubWorldRoomInfo[ sGridNo ] || gfBasement) ) sVGridNo[ gus2ndWestEdgepointArraySize++ ] = sGridNo; } if( gus2ndWestEdgepointArraySize ) @@ -867,18 +863,18 @@ void GenerateMapEdgepoints() } } } - - //Eliminates any edgepoints not accessible to the edge of the world. This is done to the primary edgepoints + + //Eliminates any edgepoints not accessible to the edge of the world. This is done to the primary edgepoints ValidateEdgepoints(); //Second step is to process the primary edgepoints and determine if any of the edgepoints aren't accessible from - //the associated entrypoint. These edgepoints that are rejected are placed in the secondary list. + //the associated entrypoint. These edgepoints that are rejected are placed in the secondary list. if( gMapInformation.sIsolatedGridNo != -1 ) - { //only if there is an isolated gridno in the map. There is a flaw in the design of this system. The classification + { //only if there is an isolated gridno in the map. There is a flaw in the design of this system. The classification //process will automatically assign areas to be isolated if there is an obstacle between one normal edgepoint and another - //causing a 5 tile connection check to fail. So, all maps with isolated edgepoints will need to be checked manually to + //causing a 5 tile connection check to fail. So, all maps with isolated edgepoints will need to be checked manually to //make sure there are no obstacles causing this to happen (except for obstacles between normal areas and the isolated area) - //Good thing most maps don't have isolated sections. This is one expensive function to call! Maybe 200MI! + //Good thing most maps don't have isolated sections. This is one expensive function to call! Maybe 200MI! ClassifyEdgepoints(); } @@ -904,7 +900,7 @@ void SaveMapEdgepoints( HWFILE fp ) FileWrite( fp, &gus1stWestEdgepointMiddleIndex, 2, NULL ); if( gus1stWestEdgepointArraySize ) FileWrite( fp, gps1stWestEdgepointArray, gus1stWestEdgepointArraySize * sizeof( INT16 ), NULL ); - //2nd priority edgepoints -- for isolated areas. Okay to be zero + //2nd priority edgepoints -- for isolated areas. Okay to be zero FileWrite( fp, &gus2ndNorthEdgepointArraySize, 2, NULL ); FileWrite( fp, &gus2ndNorthEdgepointMiddleIndex, 2, NULL ); if( gus2ndNorthEdgepointArraySize ) @@ -963,8 +959,8 @@ BOOLEAN LoadMapEdgepoints( INT8 **hBuffer ) { TrashMapEdgepoints(); if( gMapInformation.ubMapVersion < 17 ) - { //To prevent invalidation of older maps, which only used one layer of edgepoints, and a UINT8 for - //containing the size, we will preserve that paradigm, then kill the loaded edgepoints and + { //To prevent invalidation of older maps, which only used one layer of edgepoints, and a UINT8 for + //containing the size, we will preserve that paradigm, then kill the loaded edgepoints and //regenerate them. OldLoadMapEdgepoints( hBuffer ); TrashMapEdgepoints(); @@ -1071,7 +1067,7 @@ UINT16 ChooseMapEdgepoint( UINT8 ubStrategicInsertionCode ) usArraySize = gus1stWestEdgepointArraySize; break; default: - AssertMsg( 0, "ChooseMapEdgepoints: Failed to pass a valid strategic insertion code." ); + AssertMsg( 0, "ChooseMapEdgepoints: Failed to pass a valid strategic insertion code." ); break; } if( !usArraySize ) @@ -1089,8 +1085,8 @@ void ChooseMapEdgepoints( MAPEDGEPOINTINFO *pMapEdgepointInfo, UINT8 ubStrategic UINT16 usSlots, usCurrSlot; INT16 *psTempArray = NULL; - AssertMsg( ubNumDesiredPoints > 0 && ubNumDesiredPoints <= 32, - String( "ChooseMapEdgepoints: Desired points = %d, valid range is 1-32", ubNumDesiredPoints ) ); + AssertMsg( ubNumDesiredPoints > 0 && ubNumDesiredPoints <= 32, + String( "ChooseMapEdgepoints: Desired points = %d, valid range is 1-32", ubNumDesiredPoints ) ); //First validate and get access to the correct array based on strategic direction. //We will use the selected array to choose insertion gridno's. switch( ubStrategicInsertionCode ) @@ -1112,7 +1108,7 @@ void ChooseMapEdgepoints( MAPEDGEPOINTINFO *pMapEdgepointInfo, UINT8 ubStrategic usArraySize = gus1stWestEdgepointArraySize; break; default: - AssertMsg( 0, "ChooseMapEdgepoints: Failed to pass a valid strategic insertion code." ); + AssertMsg( 0, "ChooseMapEdgepoints: Failed to pass a valid strategic insertion code." ); break; } pMapEdgepointInfo->ubStrategicInsertionCode = ubStrategicInsertionCode; @@ -1120,18 +1116,18 @@ void ChooseMapEdgepoints( MAPEDGEPOINTINFO *pMapEdgepointInfo, UINT8 ubStrategic if( !psArray || !usArraySize ) { if( gMapInformation.sNorthGridNo == -1 && gMapInformation.sEastGridNo == -1 && - gMapInformation.sSouthGridNo == -1 && gMapInformation.sWestGridNo == -1 && + gMapInformation.sSouthGridNo == -1 && gMapInformation.sWestGridNo == -1 && gMapInformation.sCenterGridNo == -1 ) { if( gbWorldSectorZ ) { - AssertMsg( 0, + AssertMsg( 0, String( "Map %c%d_b%d(_a) doesn't have ANY entry points which means that it is impossible to generate map edgepoints. (LC : 1)", gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) ); } else { - AssertMsg( 0, + AssertMsg( 0, String( "Map %c%d(_a) doesn't have ANY entry points which means that it is impossible to generate map edgepoints. (LC : 1)", gWorldSectorY + 'A' - 1, gWorldSectorX ) ); } @@ -1139,16 +1135,16 @@ void ChooseMapEdgepoints( MAPEDGEPOINTINFO *pMapEdgepointInfo, UINT8 ubStrategic else switch( ubStrategicInsertionCode ) { case INSERTION_CODE_NORTH: - AssertMsg( 0, "This map doesn't have any north mapedgepoints. Possibly because there is no north entry point. (LC : 1)" ); + AssertMsg( 0, "This map doesn't have any north mapedgepoints. Possibly because there is no north entry point. (LC : 1)" ); break; case INSERTION_CODE_EAST: - AssertMsg( 0, "This map doesn't have any east mapedgepoints. Possibly because there is no east entry point. (LC : 1)" ); + AssertMsg( 0, "This map doesn't have any east mapedgepoints. Possibly because there is no east entry point. (LC : 1)" ); break; case INSERTION_CODE_SOUTH: - AssertMsg( 0, "This map doesn't have any south mapedgepoints. Possibly because there is no south entry point. (LC : 1)" ); + AssertMsg( 0, "This map doesn't have any south mapedgepoints. Possibly because there is no south entry point. (LC : 1)" ); break; case INSERTION_CODE_WEST: - AssertMsg( 0, "This map doesn't have any west mapedgepoints. Possibly because there is no west entry point. NOTE: Teleportation always uses the west entrypoint. Some maps shouldn't have west entrypoints. (LC : 1)" ); + AssertMsg( 0, "This map doesn't have any west mapedgepoints. Possibly because there is no west entry point. NOTE: Teleportation always uses the west entrypoint. Some maps shouldn't have west entrypoints. (LC : 1)" ); break; } } @@ -1237,12 +1233,12 @@ void BeginMapEdgepointSearch() sGridNo = gMapInformation.sSouthGridNo; else if( gMapInformation.sWestGridNo != -1 ) sGridNo = gMapInformation.sWestGridNo; - else + else return; GlobalReachableTest( sGridNo ); - //Now, we have the path values calculated. Now, we can check for closest edgepoints. + //Now, we have the path values calculated. Now, we can check for closest edgepoints. } void EndMapEdgepointSearch() @@ -1264,8 +1260,8 @@ INT16 SearchForClosestPrimaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode BOOLEAN fReserved; if( gsReservedIndex >= 20 ) - { //Everything is reserved. - AssertMsg( 0, "All closest map edgepoints have been reserved. We should only have 20 soldiers maximum..."); + { //Everything is reserved. + AssertMsg( 0, "All closest map edgepoints have been reserved. We should only have 20 soldiers maximum..."); } switch( ubInsertionCode ) { @@ -1273,29 +1269,29 @@ INT16 SearchForClosestPrimaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode psArray = gps1stNorthEdgepointArray; usArraySize = gus1stNorthEdgepointArraySize; if( !usArraySize ) - AssertMsg( 0, String( "Sector %c%d level %d doesn't have any north mapedgepoints. LC:1", - gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) ); + AssertMsg( 0, String( "Sector %c%d level %d doesn't have any north mapedgepoints. LC:1", + gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) ); break; case INSERTION_CODE_EAST: psArray = gps1stEastEdgepointArray; usArraySize = gus1stEastEdgepointArraySize; if( !usArraySize ) - AssertMsg( 0, String( "Sector %c%d level %d doesn't have any east mapedgepoints. LC:1", - gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) ); + AssertMsg( 0, String( "Sector %c%d level %d doesn't have any east mapedgepoints. LC:1", + gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) ); break; case INSERTION_CODE_SOUTH: psArray = gps1stSouthEdgepointArray; usArraySize = gus1stSouthEdgepointArraySize; if( !usArraySize ) - AssertMsg( 0, String( "Sector %c%d level %d doesn't have any south mapedgepoints. LC:1", - gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) ); + AssertMsg( 0, String( "Sector %c%d level %d doesn't have any south mapedgepoints. LC:1", + gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) ); break; case INSERTION_CODE_WEST: psArray = gps1stWestEdgepointArray; usArraySize = gus1stWestEdgepointArraySize; if( !usArraySize ) - AssertMsg( 0, String( "Sector %c%d level %d doesn't have any west mapedgepoints. LC:1", - gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) ); + AssertMsg( 0, String( "Sector %c%d level %d doesn't have any west mapedgepoints. LC:1", + gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) ); break; } if( !usArraySize ) @@ -1352,7 +1348,7 @@ INT16 SearchForClosestPrimaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode { sGridNo += sDirection; if( sGridNo < 0 || sGridNo >= WORLD_MAX ) - continue; + continue; //Check the gridno, to see if it is available and an edgepoint. fReserved = FALSE; for( i = 0; i < gsReservedIndex; i++ ) @@ -1391,8 +1387,8 @@ INT16 SearchForClosestSecondaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCod BOOLEAN fReserved; if( gsReservedIndex >= 20 ) - { //Everything is reserved. - AssertMsg( 0, "All closest map edgepoints have been reserved. We should only have 20 soldiers maximum..."); + { //Everything is reserved. + AssertMsg( 0, "All closest map edgepoints have been reserved. We should only have 20 soldiers maximum..."); } switch( ubInsertionCode ) { @@ -1400,29 +1396,29 @@ INT16 SearchForClosestSecondaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCod psArray = gps2ndNorthEdgepointArray; usArraySize = gus2ndNorthEdgepointArraySize; if( !usArraySize ) - AssertMsg( 0, String( "Sector %c%d level %d doesn't have any isolated north mapedgepoints. KM:1", - gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) ); + AssertMsg( 0, String( "Sector %c%d level %d doesn't have any isolated north mapedgepoints. KM:1", + gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) ); break; case INSERTION_CODE_EAST: psArray = gps2ndEastEdgepointArray; usArraySize = gus2ndEastEdgepointArraySize; if( !usArraySize ) - AssertMsg( 0, String( "Sector %c%d level %d doesn't have any isolated east mapedgepoints. KM:1", - gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) ); + AssertMsg( 0, String( "Sector %c%d level %d doesn't have any isolated east mapedgepoints. KM:1", + gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) ); break; case INSERTION_CODE_SOUTH: psArray = gps2ndSouthEdgepointArray; usArraySize = gus2ndSouthEdgepointArraySize; if( !usArraySize ) - AssertMsg( 0, String( "Sector %c%d level %d doesn't have any isolated south mapedgepoints. KM:1", - gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) ); + AssertMsg( 0, String( "Sector %c%d level %d doesn't have any isolated south mapedgepoints. KM:1", + gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) ); break; case INSERTION_CODE_WEST: psArray = gps2ndWestEdgepointArray; usArraySize = gus2ndWestEdgepointArraySize; if( !usArraySize ) - AssertMsg( 0, String( "Sector %c%d level %d doesn't have any isolated west mapedgepoints. KM:1", - gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) ); + AssertMsg( 0, String( "Sector %c%d level %d doesn't have any isolated west mapedgepoints. KM:1", + gWorldSectorY + 'A' - 1, gWorldSectorX, gbWorldSectorZ ) ); break; } if( !usArraySize ) @@ -1479,7 +1475,7 @@ INT16 SearchForClosestSecondaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCod { sGridNo += sDirection; if( sGridNo < 0 || sGridNo >= WORLD_MAX ) - continue; + continue; //Check the gridno, to see if it is available and an edgepoint. fReserved = FALSE; for( i = 0; i < gsReservedIndex; i++ ) @@ -1522,18 +1518,18 @@ BOOLEAN VerifyEdgepoint( SOLDIERTYPE * pSoldier, INT16 sEdgepoint ) iSearchRange = EDGE_OF_MAP_SEARCH; // determine maximum horizontal limits - sMaxLeft = min( iSearchRange, (pSoldier->sGridNo % MAXCOL)); + sMaxLeft = min( iSearchRange, (pSoldier->sGridNo % MAXCOL)); //NumMessage("sMaxLeft = ",sMaxLeft); sMaxRight = min( iSearchRange, MAXCOL - ((pSoldier->sGridNo % MAXCOL) + 1)); //NumMessage("sMaxRight = ",sMaxRight); // determine maximum vertical limits - sMaxUp = min( iSearchRange, (pSoldier->sGridNo / MAXROW)); + sMaxUp = min( iSearchRange, (pSoldier->sGridNo / MAXROW)); //NumMessage("sMaxUp = ",sMaxUp); sMaxDown = min( iSearchRange, MAXROW - ((pSoldier->sGridNo / MAXROW) + 1)); // Call FindBestPath to set flags in all locations that we can - // walk into within range. We have to set some things up first... + // walk into within range. We have to set some things up first... // set the distance limit of the square region gubNPCDistLimit = EDGE_OF_MAP_SEARCH; @@ -1548,7 +1544,7 @@ BOOLEAN VerifyEdgepoint( SOLDIERTYPE * pSoldier, INT16 sEdgepoint ) } } - FindBestPath( pSoldier, NOWHERE, pSoldier->bLevel, WALKING, COPYREACHABLE, PATH_THROUGH_PEOPLE ); + FindBestPath( pSoldier, NOWHERE, pSoldier->pathing.bLevel, WALKING, COPYREACHABLE, PATH_THROUGH_PEOPLE ); // Turn off the "reachable" flag for the current location // so we don't consider it @@ -1588,7 +1584,7 @@ BOOLEAN EdgepointsClose( SOLDIERTYPE *pSoldier, INT16 sEdgepoint1, INT16 sEdgepo pSoldier->sGridNo = sEdgepoint1; if( gWorldSectorX == 14 && gWorldSectorY == 9 && !gbWorldSectorZ ) - { //BRUTAL CODE -- special case map. + { //BRUTAL CODE -- special case map. iSearchRange = 250; } else @@ -1597,18 +1593,18 @@ BOOLEAN EdgepointsClose( SOLDIERTYPE *pSoldier, INT16 sEdgepoint1, INT16 sEdgepo } // determine maximum horizontal limits - sMaxLeft = min( iSearchRange, (pSoldier->sGridNo % MAXCOL)); + sMaxLeft = min( iSearchRange, (pSoldier->sGridNo % MAXCOL)); //NumMessage("sMaxLeft = ",sMaxLeft); sMaxRight = min( iSearchRange, MAXCOL - ((pSoldier->sGridNo % MAXCOL) + 1)); //NumMessage("sMaxRight = ",sMaxRight); // determine maximum vertical limits - sMaxUp = min( iSearchRange, (pSoldier->sGridNo / MAXROW)); + sMaxUp = min( iSearchRange, (pSoldier->sGridNo / MAXROW)); //NumMessage("sMaxUp = ",sMaxUp); sMaxDown = min( iSearchRange, MAXROW - ((pSoldier->sGridNo / MAXROW) + 1)); // Call FindBestPath to set flags in all locations that we can - // walk into within range. We have to set some things up first... + // walk into within range. We have to set some things up first... // set the distance limit of the square region gubNPCDistLimit = (UINT8)iSearchRange; @@ -1623,7 +1619,7 @@ BOOLEAN EdgepointsClose( SOLDIERTYPE *pSoldier, INT16 sEdgepoint1, INT16 sEdgepo } } - if( FindBestPath( pSoldier, sEdgepoint2, pSoldier->bLevel, WALKING, COPYREACHABLE, PATH_THROUGH_PEOPLE ) ) + if( FindBestPath( pSoldier, sEdgepoint2, pSoldier->pathing.bLevel, WALKING, COPYREACHABLE, PATH_THROUGH_PEOPLE ) ) { return TRUE; } @@ -1640,13 +1636,10 @@ UINT8 CalcMapEdgepointClassInsertionCode( INT16 sGridNo ) INT16 sClosestSpot2 = NOWHERE, sClosestDist2 = 0x7FFF; BOOLEAN fPrimaryValid = FALSE, fSecondaryValid = FALSE; - // WDS - Clean up inventory handling -// memset( &Soldier, 0, SIZEOF_SOLDIERTYPE ); - Soldier.initialize(); Soldier.bTeam = 1; Soldier.sGridNo = sGridNo; - if( gMapInformation.sIsolatedGridNo == -1 ) + if( gMapInformation.sIsolatedGridNo == -1 ) { //If the map has no isolated area, then all edgepoints are primary. return INSERTION_CODE_PRIMARY_EDGEINDEX; } @@ -1682,7 +1675,7 @@ UINT8 CalcMapEdgepointClassInsertionCode( INT16 sGridNo ) return INSERTION_CODE_PRIMARY_EDGEINDEX; } - // Do a 2D search to find the closest map edgepoint and + // Do a 2D search to find the closest map edgepoint and // try to create a path there for ( iLoop = 0; iLoop < iEdgepointArraySize1; iLoop++ ) { @@ -1833,11 +1826,11 @@ void ShowMapEdgepoints() { ScreenMsg( 0, MSG_TESTVERSION, L"Showing display of map edgepoints (%d illegal primary, %d illegal secondary)" ); } - ScreenMsg( 0, MSG_TESTVERSION, L"N:%d:%d E:%d:%d S:%d:%d W:%d:%d", - gus1stNorthEdgepointArraySize, gus2ndNorthEdgepointArraySize, - gus1stEastEdgepointArraySize, gus2ndEastEdgepointArraySize, - gus1stSouthEdgepointArraySize, gus2ndSouthEdgepointArraySize, - gus1stWestEdgepointArraySize, gus2ndWestEdgepointArraySize ); + ScreenMsg( 0, MSG_TESTVERSION, L"N:%d:%d E:%d:%d S:%d:%d W:%d:%d", + gus1stNorthEdgepointArraySize, gus2ndNorthEdgepointArraySize, + gus1stEastEdgepointArraySize, gus2ndEastEdgepointArraySize, + gus1stSouthEdgepointArraySize, gus2ndSouthEdgepointArraySize, + gus1stWestEdgepointArraySize, gus2ndWestEdgepointArraySize ); } void HideMapEdgepoints() @@ -1872,7 +1865,7 @@ void HideMapEdgepoints() RemoveAllTopmostsOfTypeRange( gps1stWestEdgepointArray[ i ], FIRSTPOINTERS, FIRSTPOINTERS ); } } - + for( i = 0 ; i < gus2ndNorthEdgepointArraySize; i++ ) { if( gps2ndNorthEdgepointArray[ i ] != -1 ) @@ -1902,4 +1895,4 @@ void HideMapEdgepoints() } } } -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Map Edgepoints.h b/TileEngine/Map Edgepoints.h index 2d947014..e365a784 100644 --- a/TileEngine/Map Edgepoints.h +++ b/TileEngine/Map Edgepoints.h @@ -8,7 +8,7 @@ typedef struct MAPEDGEPOINTINFO { UINT8 ubNumPoints; UINT8 ubStrategicInsertionCode; - UINT16 sGridNo[ 32 ]; + INT16 sGridNo[ 32 ]; }MAPEDGEPOINTINFO; UINT16 ChooseMapEdgepoint( UINT8 ubStrategicInsertionCode ); @@ -55,10 +55,10 @@ extern UINT16 gus2ndSouthEdgepointMiddleIndex; extern UINT16 gus2ndWestEdgepointMiddleIndex; //This is the search code that will determine the closest map edgepoint to a given gridno and -//a strategic insertion code. You must call the begin...() first, the call SearchForClosestMapEdgepoint() -//for each soldier that is looking. After you are completely finished, call the end..(). The return value +//a strategic insertion code. You must call the begin...() first, the call SearchForClosestMapEdgepoint() +//for each soldier that is looking. After you are completely finished, call the end..(). The return value //will return NOWHERE if the information is invalid (no edgepoint info for that particular side, or all -//spots are reserved. There are only 20 spots that can be reserved (one for each player soldier). This +//spots are reserved. There are only 20 spots that can be reserved (one for each player soldier). This //code shouldn't be used for enemies or anybody else. void BeginMapEdgepointSearch(); void EndMapEdgepointSearch(); @@ -66,10 +66,10 @@ INT16 SearchForClosestPrimaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode INT16 SearchForClosestSecondaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode ); //There are two classes of edgepoints. -//PRIMARY : The default list of edgepoints. This list includes edgepoints that are easily accessible from the +//PRIMARY : The default list of edgepoints. This list includes edgepoints that are easily accessible from the // strategic level. -//SECONDARY : The isolated list of edgepoints. Certain areas of the game are blocked off, but tactically traversing -// to these areas is possible. Examples would be isolated sections of Grumm or Alma, which you can't +//SECONDARY : The isolated list of edgepoints. Certain areas of the game are blocked off, but tactically traversing +// to these areas is possible. Examples would be isolated sections of Grumm or Alma, which you can't // immediately // UINT8 CalcMapEdgepointClassInsertionCode( INT16 sGridNo ); diff --git a/TileEngine/Radar Screen.cpp b/TileEngine/Radar Screen.cpp index 9aa087a6..ede0c029 100644 --- a/TileEngine/Radar Screen.cpp +++ b/TileEngine/Radar Screen.cpp @@ -32,8 +32,14 @@ #include "meanwhile.h" #include "strategicmap.h" #include "Animation Data.h" + #include "GameSettings.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + extern INT32 iCurrentMapSectorZ; void AdjustWorldCenterFromRadarCoords( INT16 sRadarX, INT16 sRadarY ); @@ -49,7 +55,7 @@ void TacticalSquadListBtnCallBack(MOUSE_REGION * pRegion, INT32 iReason ); // the squad list font #define SQUAD_FONT COMPFONT -#define SQUAD_REGION_HEIGHT 2 * RADAR_WINDOW_HEIGHT +#define SQUAD_REGION_HEIGHT 2 * RADAR_WINDOW_HEIGHT #define SQUAD_WINDOW_TM_Y RADAR_WINDOW_TM_Y + GetFontHeight( SQUAD_FONT ) // subtractor for squad list from size of radar view region height @@ -60,12 +66,22 @@ INT16 gsRadarX; INT16 gsRadarY; UINT32 gusRadarImage; BOOLEAN fImageLoaded = FALSE; -BOOLEAN fRenderRadarScreen = TRUE; +BOOLEAN fRenderRadarScreen = TRUE; INT16 sSelectedSquadLine = -1; +// CHRISL: Moved radar coords from header file +INT16 RADAR_WINDOW_TM_X; +INT16 RADAR_WINDOW_SM_X; +INT16 RADAR_WINDOW_TM_Y; +INT16 RADAR_WINDOW_SM_Y; +INT16 RADAR_WINDOW_WIDTH; +INT16 RADAR_WINDOW_HEIGHT; +INT16 RADAR_WINDOW_STRAT_X; +INT16 RADAR_WINDOW_STRAT_Y; + BOOLEAN gfRadarCurrentGuyFlash = FALSE; -// WANNE: Are we allowed to scroll in radar map? +// WANNE: Are we allowed to scroll in radar map? // (E.g: It is not allowed to scroll, if the whole tactical map fits in the radar map) [2007-05-14] BOOLEAN fAllowRadarMovementHor = TRUE; BOOLEAN fAllowRadarMovementVer = TRUE; @@ -73,15 +89,29 @@ BOOLEAN fAllowRadarMovementVer = TRUE; MOUSE_REGION gRadarRegionSquadList[ NUMBER_OF_SQUADS ]; +void InitRadarScreenCoords( ) +{ + RADAR_WINDOW_TM_X = (SCREEN_WIDTH - 97); + RADAR_WINDOW_SM_X = (SCREEN_WIDTH - 97); + RADAR_WINDOW_TM_Y = (INTERFACE_START_Y + 13); + RADAR_WINDOW_SM_Y = ((UsingNewInventorySystem() == false)) ? (INV_INTERFACE_START_Y + 33) : (INV_INTERFACE_START_Y + 116); + RADAR_WINDOW_WIDTH = 88; + RADAR_WINDOW_HEIGHT = 44; + RADAR_WINDOW_STRAT_X = (SCREEN_WIDTH - 97); + RADAR_WINDOW_STRAT_Y = (SCREEN_HEIGHT - 107); +} + BOOLEAN InitRadarScreen( ) { + // CHRISL: Move screen coord setup to it's own function + InitRadarScreenCoords(); // Add region for radar - MSYS_DefineRegion( &gRadarRegion, RADAR_WINDOW_X, RADAR_WINDOW_TM_Y, - RADAR_WINDOW_X + RADAR_WINDOW_WIDTH, - RADAR_WINDOW_TM_Y + RADAR_WINDOW_HEIGHT, - MSYS_PRIORITY_HIGHEST, 0, - RadarRegionMoveCallback, - RadarRegionButtonCallback ); + MSYS_DefineRegion( &gRadarRegion, RADAR_WINDOW_TM_X, RADAR_WINDOW_TM_Y, + RADAR_WINDOW_TM_X + RADAR_WINDOW_WIDTH, + RADAR_WINDOW_TM_Y + RADAR_WINDOW_HEIGHT, + MSYS_PRIORITY_HIGHEST, 0, + RadarRegionMoveCallback, + RadarRegionButtonCallback ); // Add region MSYS_AddRegion( &gRadarRegion ); @@ -89,7 +119,7 @@ BOOLEAN InitRadarScreen( ) //disable the radar map MSYS_DisableRegion(&gRadarRegion); - gsRadarX = RADAR_WINDOW_X; + gsRadarX = RADAR_WINDOW_TM_X; gsRadarY = RADAR_WINDOW_TM_Y; return( TRUE ); @@ -104,46 +134,46 @@ BOOLEAN LoadRadarScreenBitmap(CHAR8 * aFilename ) strcpy( zFilename, aFilename ); - // If we have loaded, remove old one - if ( fImageLoaded ) - { - DeleteVideoObjectFromIndex( gusRadarImage ); - - fImageLoaded = FALSE; - } + // If we have loaded, remove old one + if ( fImageLoaded ) + { + DeleteVideoObjectFromIndex( gusRadarImage ); -/* ARM - Restriction removed Nov.29/98. Must be able to view different radar maps from map screen while underground! - // If we are in a cave or basement..... dont get a new one... - if( !gfBasement && !gfCaves ) + fImageLoaded = FALSE; + } + +/* ARM - Restriction removed Nov.29/98. Must be able to view different radar maps from map screen while underground! + // If we are in a cave or basement..... dont get a new one... + if( !gfBasement && !gfCaves ) */ - { - // Remove extension - for ( cnt = strlen( zFilename )-1; cnt >=0; cnt-- ) - { - if ( zFilename[ cnt ] == '.' ) - { - zFilename[ cnt ] = '\0'; - } - } + { + // Remove extension + for ( cnt = strlen( zFilename )-1; cnt >=0; cnt-- ) + { + if ( zFilename[ cnt ] == '.' ) + { + zFilename[ cnt ] = '\0'; + } + } - // Grab the Map image - VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; - sprintf( VObjectDesc.ImageFile, "RADARMAPS\\%s.STI", zFilename ); + // Grab the Map image + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + sprintf( VObjectDesc.ImageFile, "RADARMAPS\\%s.STI", zFilename ); - CHECKF(AddVideoObject(&VObjectDesc, &gusRadarImage)); + CHECKF(AddVideoObject(&VObjectDesc, &gusRadarImage)); - fImageLoaded = TRUE; + fImageLoaded = TRUE; - if( GetVideoObject( &hVObject, gusRadarImage ) ) - { + if( GetVideoObject( &hVObject, gusRadarImage ) ) + { // ATE: Add a shade table! - hVObject->pShades[ 0 ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 255, 255, 255, FALSE ); - hVObject->pShades[ 1 ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 100, 100, 100, FALSE ); - } - } + hVObject->pShades[ 0 ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 255, 255, 255, FALSE ); + hVObject->pShades[ 1 ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 100, 100, 100, FALSE ); + } + } - // Dirty interface - fInterfacePanelDirty = TRUE; + // Dirty interface + fInterfacePanelDirty = TRUE; return( TRUE ); } @@ -151,11 +181,11 @@ BOOLEAN LoadRadarScreenBitmap(CHAR8 * aFilename ) void ClearOutRadarMapImage( void ) { // If we have loaded, remove old one - if ( fImageLoaded ) - { - DeleteVideoObjectFromIndex( gusRadarImage ); - fImageLoaded = FALSE; - } + if ( fImageLoaded ) + { + DeleteVideoObjectFromIndex( gusRadarImage ); + fImageLoaded = FALSE; + } } @@ -173,23 +203,29 @@ void MoveRadarScreen() // Add new one - // Move based on inventory panel + // CHRISL: Reset coords + InitRadarScreenCoords(); + // Move based on inventory panel if( guiCurrentScreen == MAP_SCREEN ) { + gsRadarX = RADAR_WINDOW_STRAT_X; gsRadarY = RADAR_WINDOW_STRAT_Y; } else if ( gsCurInterfacePanel == SM_PANEL ) { - gsRadarY = RADAR_WINDOW_TM_Y; + gsRadarX = RADAR_WINDOW_SM_X; + gsRadarY = RADAR_WINDOW_SM_Y; } else { + gsRadarX = RADAR_WINDOW_TM_X; gsRadarY = RADAR_WINDOW_TM_Y; } // Add region for radar - MSYS_DefineRegion( &gRadarRegion, RADAR_WINDOW_X, (UINT16)(gsRadarY), - RADAR_WINDOW_X + RADAR_WINDOW_WIDTH, + // CHRISL: + MSYS_DefineRegion( &gRadarRegion, (UINT16) (gsRadarX), (UINT16)(gsRadarY), + (UINT16) (gsRadarX + RADAR_WINDOW_WIDTH), (UINT16)(gsRadarY + RADAR_WINDOW_HEIGHT), MSYS_PRIORITY_HIGHEST, 0, RadarRegionMoveCallback, @@ -218,7 +254,7 @@ void RadarRegionMoveCallback( MOUSE_REGION * pRegion, INT32 iReason ) // WANNE: If the tactical map fits in the whole radar map, disable scrolling in radar map. [2007-05-14] if (fAllowRadarMovementHor) // Use relative coordinates to set center of viewport - sRadarX = pRegion->RelativeXPos - ( RADAR_WINDOW_WIDTH / 2 ); + sRadarX = pRegion->RelativeXPos - ( RADAR_WINDOW_WIDTH / 2 ); else sRadarX = 0; @@ -253,7 +289,7 @@ void RadarRegionButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ) // WANNE: If the tactical map fits in the whole radar map, disable scrolling in radar map. [2007-05-14] if (fAllowRadarMovementHor) // Use relative coordinates to set center of viewport - sRadarX = pRegion->RelativeXPos - ( RADAR_WINDOW_WIDTH / 2 ); + sRadarX = pRegion->RelativeXPos - ( RADAR_WINDOW_WIDTH / 2 ); else sRadarX = 0; @@ -265,7 +301,7 @@ void RadarRegionButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ) if (fAllowRadarMovementHor || fAllowRadarMovementVer) { AdjustWorldCenterFromRadarCoords( sRadarX, sRadarY ); - + SetRenderFlags(RENDER_FLAG_FULL); } } @@ -311,12 +347,12 @@ void RenderRadarScreen( ) INT16 sXSoldPos, sYSoldPos, sXSoldScreen, sYSoldScreen, sXSoldRadar, sYSoldRadar; - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; - UINT16 usLineColor; - UINT32 cnt; - INT16 sHeight, sWidth, sX, sY; - INT32 iCounter = 0; + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; + UINT16 usLineColor; + UINT32 cnt; + INT16 sHeight, sWidth, sX, sY; + INT32 iCounter = 0; // create / destroy squad list regions as nessacary @@ -350,18 +386,20 @@ void RenderRadarScreen( ) } } - BltVideoObjectFromIndex( guiSAVEBUFFER, gusRadarImage, 0, RADAR_WINDOW_X, gsRadarY, VO_BLT_SRCTRANSPARENCY, NULL ); + // CHRISL: + BltVideoObjectFromIndex( guiSAVEBUFFER, gusRadarImage, 0, gsRadarX, gsRadarY, VO_BLT_SRCTRANSPARENCY, NULL ); } // FIRST DELETE WHAT'S THERE - RestoreExternBackgroundRect( RADAR_WINDOW_X, gsRadarY, RADAR_WINDOW_WIDTH + 1 , RADAR_WINDOW_HEIGHT + 1 ); + // CHRISL: + RestoreExternBackgroundRect( gsRadarX, gsRadarY, RADAR_WINDOW_WIDTH + 1 , RADAR_WINDOW_HEIGHT + 1 ); // Determine scale factors // Find the diustance from render center to true world center sDistToCenterX = gsRenderCenterX - gCenterWorldX; sDistToCenterY = gsRenderCenterY - gCenterWorldY; - + // From render center in world coords, convert to render center in "screen" coords FromCellToScreenCoordinates( sDistToCenterX , sDistToCenterY, &sScreenCenterX, &sScreenCenterY ); @@ -374,17 +412,17 @@ void RenderRadarScreen( ) sX_S = ( ( gsVIEWPORT_END_X - gsVIEWPORT_START_X ) /2 ); sY_S = ( ( gsVIEWPORT_END_Y - gsVIEWPORT_START_Y ) /2 ); - sTopLeftWorldX = sScreenCenterX - sX_S; - sTopLeftWorldY = sScreenCenterY - sY_S; + sTopLeftWorldX = sScreenCenterX - sX_S; + sTopLeftWorldY = sScreenCenterY - sY_S; - sTopRightWorldX = sScreenCenterX + sX_S; - sTopRightWorldY = sScreenCenterY - sY_S; - - sBottomLeftWorldX = sScreenCenterX - sX_S; - sBottomLeftWorldY = sScreenCenterY + sY_S; + sTopRightWorldX = sScreenCenterX + sX_S; + sTopRightWorldY = sScreenCenterY - sY_S; - sBottomRightWorldX = sScreenCenterX + sX_S; - sBottomRightWorldY = sScreenCenterY + sY_S; + sBottomLeftWorldX = sScreenCenterX - sX_S; + sBottomLeftWorldY = sScreenCenterY + sY_S; + + sBottomRightWorldX = sScreenCenterX + sX_S; + sBottomRightWorldY = sScreenCenterY + sY_S; // Determine radar coordinates @@ -394,12 +432,12 @@ void RenderRadarScreen( ) sWidth = ( RADAR_WINDOW_WIDTH ); sHeight = ( RADAR_WINDOW_HEIGHT ); - sX = RADAR_WINDOW_X; + sX = RADAR_WINDOW_TM_X; sY = gsRadarY; - sRadarTLX = (INT16)( ( sTopLeftWorldX * gdScaleX ) - sRadarCX + sX + ( sWidth /2 ) ); - sRadarTLY = (INT16)( ( sTopLeftWorldY * gdScaleY ) - sRadarCY + gsRadarY + ( sHeight /2 ) ); + sRadarTLX = (INT16)( ( sTopLeftWorldX * gdScaleX ) - sRadarCX + sX + ( sWidth /2 ) ); + sRadarTLY = (INT16)( ( sTopLeftWorldY * gdScaleY ) - sRadarCY + gsRadarY + ( sHeight /2 ) ); sRadarBRX = (INT16)( ( sBottomRightWorldX * gdScaleX ) - sRadarCX + sX + ( sWidth /2 ) ); sRadarBRY = (INT16)( ( sBottomRightWorldY * gdScaleY ) - sRadarCY + gsRadarY + ( sHeight /2 ) ); @@ -419,7 +457,8 @@ void RenderRadarScreen( ) pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); - SetClippingRegionAndImageWidth( uiDestPitchBYTES, RADAR_WINDOW_X, gsRadarY, ( RADAR_WINDOW_X + RADAR_WINDOW_WIDTH - 1 ), ( gsRadarY + RADAR_WINDOW_HEIGHT - 1 ) ); + // CHRISL: + SetClippingRegionAndImageWidth( uiDestPitchBYTES, gsRadarX, gsRadarY, ( gsRadarX + RADAR_WINDOW_WIDTH - 1 ), ( gsRadarY + RADAR_WINDOW_HEIGHT - 1 ) ); if( !( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) { @@ -428,8 +467,8 @@ void RenderRadarScreen( ) // WANNE: Correct radar rectangle size if it is too large to fit in radar screen [2007-05-14] if (fAllowRadarMovementHor == FALSE) { - sRadarTLX = RADAR_WINDOW_X; - sRadarBRX = RADAR_WINDOW_X + RADAR_WINDOW_WIDTH; + sRadarTLX = RADAR_WINDOW_TM_X; + sRadarBRX = RADAR_WINDOW_TM_X + RADAR_WINDOW_WIDTH; } if (fAllowRadarMovementVer == FALSE) @@ -468,7 +507,7 @@ void RenderRadarScreen( ) iItemNumber = iCounter + iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT; // stolen item - if( ( pInventoryPoolList[ iItemNumber ].o.ubNumberOfObjects == 0 )||( pInventoryPoolList[ iItemNumber ].sGridNo == 0 ) ) + if( ( pInventoryPoolList[ iItemNumber ].object.exists() == false )||( pInventoryPoolList[ iItemNumber ].sGridNo == 0 ) ) { // yep, continue on continue; @@ -483,7 +522,7 @@ void RenderRadarScreen( ) // Add starting relative to interface - sXSoldRadar += RADAR_WINDOW_X; + sXSoldRadar += RADAR_WINDOW_TM_X; sYSoldRadar += gsRadarY; // if we are in 16 bit mode....kind of redundant @@ -491,13 +530,13 @@ void RenderRadarScreen( ) { if( ( fFlashHighLightInventoryItemOnradarMap ) ) { - usLineColor = Get16BPPColor( FROMRGB( 0, 255, 0 ) ); + usLineColor = Get16BPPColor( FROMRGB( 0, 255, 0 ) ); } else { // DB Need to add a radar color for 8-bit - usLineColor = Get16BPPColor( FROMRGB( 255, 255, 255 ) ); + usLineColor = Get16BPPColor( FROMRGB( 255, 255, 255 ) ); } if( iCurrentlyHighLightedItem == iCounter ) @@ -507,7 +546,7 @@ void RenderRadarScreen( ) } } } - + if( !( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) { // RE-RENDER RADAR @@ -516,7 +555,7 @@ void RenderRadarScreen( ) pSoldier = MercSlots[ cnt ]; if ( pSoldier != NULL ) - { + { // Don't place guys in radar until visible! if ( pSoldier->bVisible == -1 && !(gTacticalStatus.uiFlags&SHOW_ALL_MERCS) && !(pSoldier->ubMiscSoldierFlags & SOLDIER_MISC_XRAYED) ) { @@ -524,7 +563,7 @@ void RenderRadarScreen( ) } // Don't render guys if they are dead! - if ( ( pSoldier->uiStatusFlags & SOLDIER_DEAD ) ) + if ( ( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) ) { continue; } @@ -549,13 +588,13 @@ void RenderRadarScreen( ) } // Add starting relative to interface - sXSoldRadar += RADAR_WINDOW_X; + sXSoldRadar += RADAR_WINDOW_TM_X; sYSoldRadar += gsRadarY; if(gbPixelDepth==16) { - // DB Need to add a radar color for 8-bit + // DB Need to add a radar color for 8-bit // Are we a selected guy? if ( pSoldier->ubID == gusSelectedSoldier ) @@ -566,47 +605,47 @@ void RenderRadarScreen( ) } else { - // If on roof, make darker.... - if ( pSoldier->bLevel > 0 ) - { - usLineColor = Get16BPPColor( FROMRGB( 150, 150, 0 ) ); - } - else - { - usLineColor = Get16BPPColor( gTacticalStatus.Team[ pSoldier->bTeam ].RadarColor ); - } - } + // If on roof, make darker.... + if ( pSoldier->pathing.bLevel > 0 ) + { + usLineColor = Get16BPPColor( FROMRGB( 150, 150, 0 ) ); + } + else + { + usLineColor = Get16BPPColor( gTacticalStatus.Team[ pSoldier->bTeam ].RadarColor ); + } + } } else { usLineColor = Get16BPPColor( gTacticalStatus.Team[ pSoldier->bTeam ].RadarColor ); - // Override civ team with red if hostile... - if ( pSoldier->bTeam == CIV_TEAM && !pSoldier->bNeutral && ( pSoldier->bSide != gbPlayerNum ) ) - { + // Override civ team with red if hostile... + if ( pSoldier->bTeam == CIV_TEAM && !pSoldier->aiData.bNeutral && ( pSoldier->bSide != gbPlayerNum ) ) + { usLineColor = Get16BPPColor( FROMRGB( 255, 0, 0 ) ); - } + } // Render different color if an enemy and he's unconscious - if ( pSoldier->bTeam != gbPlayerNum && pSoldier->bLife < OKLIFE ) + if ( pSoldier->bTeam != gbPlayerNum && pSoldier->stats.bLife < OKLIFE ) { usLineColor = Get16BPPColor( FROMRGB( 128, 128, 128 ) ); } - // If on roof, make darker.... - if ( pSoldier->bTeam == gbPlayerNum && pSoldier->bLevel > 0 ) - { - usLineColor = Get16BPPColor( FROMRGB( 150, 150, 0 ) ); - } + // If on roof, make darker.... + if ( pSoldier->bTeam == gbPlayerNum && pSoldier->pathing.bLevel > 0 ) + { + usLineColor = Get16BPPColor( FROMRGB( 150, 150, 0 ) ); + } } - RectangleDraw( TRUE, sXSoldRadar, sYSoldRadar, sXSoldRadar+1, sYSoldRadar+1, usLineColor, pDestBuf ); + RectangleDraw( TRUE, sXSoldRadar, sYSoldRadar, sXSoldRadar+1, sYSoldRadar+1, usLineColor, pDestBuf ); } else if(gbPixelDepth==8) { // DB Need to change this to a color from the 8-but standard palette usLineColor = COLOR_BLUE; - RectangleDraw8( TRUE, sXSoldRadar, sYSoldRadar, sXSoldRadar+1, sYSoldRadar+1, usLineColor, pDestBuf ); + RectangleDraw8( TRUE, sXSoldRadar, sYSoldRadar, sXSoldRadar+1, sYSoldRadar+1, usLineColor, pDestBuf ); } } } @@ -616,8 +655,9 @@ void RenderRadarScreen( ) if( ( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) && ( fShowMapInventoryPool == TRUE ) ) { - InvalidateRegion( RADAR_WINDOW_X, gsRadarY, - RADAR_WINDOW_X + RADAR_WINDOW_WIDTH, + // CHRISL: + InvalidateRegion( gsRadarX, gsRadarY, + gsRadarX + RADAR_WINDOW_WIDTH, gsRadarY + RADAR_WINDOW_HEIGHT ); } @@ -643,15 +683,15 @@ void AdjustWorldCenterFromRadarCoords( INT16 sRadarX, INT16 sRadarY ) sScreenY -= ( ( gsVIEWPORT_END_Y - gsVIEWPORT_START_Y ) /2 ); //Make sure these coordinates are multiples of scroll steps - sNumXSteps = sScreenX / SCROLL_X_STEP; + sNumXSteps = sScreenX / SCROLL_X_STEP; sNumYSteps = sScreenY / SCROLL_Y_STEP; sScreenX = ( sNumXSteps * SCROLL_X_STEP ); sScreenY = ( sNumYSteps * SCROLL_Y_STEP ); // Adjust back - sScreenX += ( ( gsVIEWPORT_END_X - gsVIEWPORT_START_X ) /2 ); - sScreenY += ( ( gsVIEWPORT_END_Y - gsVIEWPORT_START_Y ) /2 ); + sScreenX += ( ( gsVIEWPORT_END_X - gsVIEWPORT_START_X ) /2 ); + sScreenY += ( ( gsVIEWPORT_END_Y - gsVIEWPORT_START_Y ) /2 ); // Subtract world center //sScreenX += gsCX; @@ -688,10 +728,10 @@ void ToggleRadarScreenRender( void ) BOOLEAN CreateDestroyMouseRegionsForSquadList( void ) { - // will check the state of renderradarscreen flag and decide if we need to create mouse regions for + // will check the state of renderradarscreen flag and decide if we need to create mouse regions for static BOOLEAN fCreated = FALSE; INT16 sCounter = 0; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; HVOBJECT hHandle; UINT32 uiHandle; @@ -699,16 +739,16 @@ BOOLEAN CreateDestroyMouseRegionsForSquadList( void ) { // create regions // load graphics - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\squadpanel.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &uiHandle)); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\squadpanel.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiHandle)); + + GetVideoObject(&hHandle, uiHandle); + - GetVideoObject(&hHandle, uiHandle); - - BltVideoObject( guiSAVEBUFFER , hHandle, 0,(SCREEN_WIDTH - 102 - 1), gsVIEWPORT_END_Y, VO_BLT_SRCTRANSPARENCY,NULL ); RestoreExternBackgroundRect ((SCREEN_WIDTH - 102 - 1), gsVIEWPORT_END_Y, 102,( INT16 ) ( SCREEN_HEIGHT - gsVIEWPORT_END_Y ) ); - + for( sCounter = 0; sCounter < NUMBER_OF_SQUADS; sCounter++ ) { // run through list of squads and place appropriatly @@ -716,14 +756,16 @@ BOOLEAN CreateDestroyMouseRegionsForSquadList( void ) { // left half of list - MSYS_DefineRegion( &gRadarRegionSquadList[ sCounter ], RADAR_WINDOW_X , ( INT16 )( SQUAD_WINDOW_TM_Y + ( sCounter * ( ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / ( NUMBER_OF_SQUADS / 2 ) ) ) ), RADAR_WINDOW_X + RADAR_WINDOW_WIDTH / 2 - 1, ( INT16 )( SQUAD_WINDOW_TM_Y + ( ( sCounter + 1 ) * ( ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / ( NUMBER_OF_SQUADS / 2 ) ) ) ) ,MSYS_PRIORITY_HIGHEST, + // CHRISL: + MSYS_DefineRegion( &gRadarRegionSquadList[ sCounter ], RADAR_WINDOW_TM_X , ( INT16 )( SQUAD_WINDOW_TM_Y + ( sCounter * ( ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / ( NUMBER_OF_SQUADS / 2 ) ) ) ), RADAR_WINDOW_TM_X + RADAR_WINDOW_WIDTH / 2 - 1, ( INT16 )( SQUAD_WINDOW_TM_Y + ( ( sCounter + 1 ) * ( ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / ( NUMBER_OF_SQUADS / 2 ) ) ) ) ,MSYS_PRIORITY_HIGHEST, 0, TacticalSquadListMvtCallback, TacticalSquadListBtnCallBack ); } else { // right half of list - MSYS_DefineRegion( &gRadarRegionSquadList[ sCounter ], RADAR_WINDOW_X + RADAR_WINDOW_WIDTH / 2, ( INT16 )( SQUAD_WINDOW_TM_Y + ( ( sCounter - ( NUMBER_OF_SQUADS / 2) ) * ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), RADAR_WINDOW_X + RADAR_WINDOW_WIDTH - 1, ( INT16 )( SQUAD_WINDOW_TM_Y + ( ( ( sCounter + 1 ) - ( NUMBER_OF_SQUADS / 2) )* ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), MSYS_PRIORITY_HIGHEST, + // CHRISL: + MSYS_DefineRegion( &gRadarRegionSquadList[ sCounter ], RADAR_WINDOW_TM_X + RADAR_WINDOW_WIDTH / 2, ( INT16 )( SQUAD_WINDOW_TM_Y + ( ( sCounter - ( NUMBER_OF_SQUADS / 2) ) * ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), RADAR_WINDOW_TM_X + RADAR_WINDOW_WIDTH - 1, ( INT16 )( SQUAD_WINDOW_TM_Y + ( ( ( sCounter + 1 ) - ( NUMBER_OF_SQUADS / 2) )* ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), MSYS_PRIORITY_HIGHEST, 0, TacticalSquadListMvtCallback, TacticalSquadListBtnCallBack ); } @@ -746,20 +788,20 @@ BOOLEAN CreateDestroyMouseRegionsForSquadList( void ) for( sCounter = 0; sCounter < NUMBER_OF_SQUADS; sCounter++ ) { - MSYS_RemoveRegion( &gRadarRegionSquadList[ sCounter ] ); + MSYS_RemoveRegion( &gRadarRegionSquadList[ sCounter ] ); } // set fact regions are destroyed fCreated = FALSE; - + if ( guiCurrentScreen == GAME_SCREEN ) { // dirty region fInterfacePanelDirty = DIRTYLEVEL2; - + MarkButtonsDirty( ); - + // re render region RenderTacticalInterface( ); @@ -782,10 +824,12 @@ void RenderSquadList( void ) INT16 sX, sY; // clear region - RestoreExternBackgroundRect( RADAR_WINDOW_X, gsRadarY, RADAR_WINDOW_WIDTH , SQUAD_REGION_HEIGHT ); + // CHRISL: + RestoreExternBackgroundRect( gsRadarX, gsRadarY, RADAR_WINDOW_WIDTH , SQUAD_REGION_HEIGHT ); // fill area - ColorFillVideoSurfaceArea( FRAME_BUFFER, RADAR_WINDOW_X, RADAR_WINDOW_TM_Y, RADAR_WINDOW_X + RADAR_WINDOW_WIDTH, RADAR_WINDOW_TM_Y + SQUAD_REGION_HEIGHT , Get16BPPColor( FROMRGB(0,0,0) ) ); + // CHRISL: + ColorFillVideoSurfaceArea( FRAME_BUFFER, RADAR_WINDOW_TM_X, RADAR_WINDOW_TM_Y, RADAR_WINDOW_TM_X + RADAR_WINDOW_WIDTH, RADAR_WINDOW_TM_Y + SQUAD_REGION_HEIGHT , Get16BPPColor( FROMRGB(0,0,0) ) ); // set font SetFont( SQUAD_FONT ); @@ -795,11 +839,13 @@ void RenderSquadList( void ) // run through list of squads and place appropriatly if( sCounter < NUMBER_OF_SQUADS / 2 ) { - FindFontCenterCoordinates( RADAR_WINDOW_X , ( INT16 )( SQUAD_WINDOW_TM_Y + ( sCounter * ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), RADAR_WINDOW_WIDTH / 2 - 1, ( INT16 )( ( ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ) ,pSquadMenuStrings[ sCounter ] , SQUAD_FONT, &sX, &sY); + // CHRISL: + FindFontCenterCoordinates( RADAR_WINDOW_TM_X , ( INT16 )( SQUAD_WINDOW_TM_Y + ( sCounter * ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), RADAR_WINDOW_WIDTH / 2 - 1, ( INT16 )( ( ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ) ,pSquadMenuStrings[ sCounter ] , SQUAD_FONT, &sX, &sY); } else { - FindFontCenterCoordinates(RADAR_WINDOW_X + RADAR_WINDOW_WIDTH / 2, ( INT16 )( SQUAD_WINDOW_TM_Y + ( ( sCounter - ( NUMBER_OF_SQUADS / 2) ) * ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), RADAR_WINDOW_WIDTH / 2 - 1, ( INT16 )( ( ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), pSquadMenuStrings[ sCounter ] , SQUAD_FONT, &sX, &sY); + // CHRISL: + FindFontCenterCoordinates(RADAR_WINDOW_TM_X + RADAR_WINDOW_WIDTH / 2, ( INT16 )( SQUAD_WINDOW_TM_Y + ( ( sCounter - ( NUMBER_OF_SQUADS / 2) ) * ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), RADAR_WINDOW_WIDTH / 2 - 1, ( INT16 )( ( ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), pSquadMenuStrings[ sCounter ] , SQUAD_FONT, &sX, &sY); } // highlight line? @@ -817,7 +863,7 @@ void RenderSquadList( void ) } else { - SetFontForeground( FONT_DKGREEN); + SetFontForeground( FONT_DKGREEN); } } else @@ -830,11 +876,11 @@ void RenderSquadList( void ) if( sCounter < NUMBER_OF_SQUADS / 2 ) { - sX = RADAR_WINDOW_X + 2; + sX = RADAR_WINDOW_TM_X + 2; } else { - sX = RADAR_WINDOW_X + ( RADAR_WINDOW_WIDTH / 2 ) - 2; + sX = RADAR_WINDOW_TM_X + ( RADAR_WINDOW_WIDTH / 2 ) - 2; } mprintf( sX, sY , pSquadMenuStrings[ sCounter ]); } @@ -850,7 +896,7 @@ void TacticalSquadListMvtCallback( MOUSE_REGION * pRegion, INT32 iReason ) { if( IsSquadOnCurrentTacticalMap( iValue ) == TRUE ) { - sSelectedSquadLine = ( INT16 )iValue; + sSelectedSquadLine = ( INT16 )iValue; } } if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) diff --git a/TileEngine/Radar Screen.h b/TileEngine/Radar Screen.h index a6392d64..4480fb5b 100644 --- a/TileEngine/Radar Screen.h +++ b/TileEngine/Radar Screen.h @@ -9,13 +9,16 @@ void RadarRegionButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ); BOOLEAN LoadRadarScreenBitmap( CHAR8 * aFilename ); +// CHRISL: Changed radar coord defines to standard variables and moved definition to radar screen.cpp // RADAR WINDOW DEFINES -#define RADAR_WINDOW_X (SCREEN_WIDTH - 97) //543 -#define RADAR_WINDOW_TM_Y INTERFACE_START_Y + 13 -#define RADAR_WINDOW_SM_Y INV_INTERFACE_START_Y + 13 -#define RADAR_WINDOW_WIDTH 88 -#define RADAR_WINDOW_HEIGHT 44 -#define RADAR_WINDOW_STRAT_Y (SCREEN_HEIGHT - 107) //373 +extern INT16 RADAR_WINDOW_TM_X; +extern INT16 RADAR_WINDOW_SM_X; +extern INT16 RADAR_WINDOW_TM_Y; +extern INT16 RADAR_WINDOW_SM_Y; +extern INT16 RADAR_WINDOW_WIDTH; +extern INT16 RADAR_WINDOW_HEIGHT; +extern INT16 RADAR_WINDOW_STRAT_X; +extern INT16 RADAR_WINDOW_STRAT_Y; BOOLEAN InitRadarScreen( ); void RenderRadarScreen( ); @@ -37,6 +40,6 @@ BOOLEAN CreateDestroyMouseRegionsForSquadList( void ); void ClearOutRadarMapImage( void ); // do we render the radar screen?..or the squad list? -extern BOOLEAN fRenderRadarScreen; +extern BOOLEAN fRenderRadarScreen; #endif \ No newline at end of file diff --git a/TileEngine/Render Dirty.cpp b/TileEngine/Render Dirty.cpp index ae099484..a666e8ba 100644 --- a/TileEngine/Render Dirty.cpp +++ b/TileEngine/Render Dirty.cpp @@ -2,7 +2,7 @@ #ifdef PRECOMPILEDHEADERS #include "TileEngine All.h" - #include "winfont.h" + #include "winfont.h" #else #include "math.h" @@ -104,7 +104,7 @@ void AddBaseDirtyRect( INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom ) iBottom = SCREEN_HEIGHT; } - if ( ( iRight - iLeft ) == 0 || ( iBottom - iTop ) == 0 ) + if ( ( iRight - iLeft ) == 0 || ( iBottom - iTop ) == 0 ) { return; } @@ -128,7 +128,7 @@ void AddBaseDirtyRect( INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom ) InvalidateRegionEx( aRect.iLeft, aRect.iTop, aRect.iRight, aRect.iBottom, 0 ); } - + BOOLEAN ExecuteBaseDirtyRectQueue( ) { if(gfViewportDirty) @@ -169,7 +169,7 @@ UINT32 uiCount; else { //else display an error message - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("ERROR! GetFreeBackgroundBuffer(): Trying to allocate more saves then there is room: guiCurrentScreen = %d", guiCurrentScreen ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("ERROR! GetFreeBackgroundBuffer(): Trying to allocate more saves then there is room: guiCurrentScreen = %d", guiCurrentScreen ) ); } #endif @@ -197,10 +197,10 @@ INT32 RegisterBackgroundRect(UINT32 uiFlags, INT16 *pSaveArea, INT16 sLeft, INT1 { UINT32 uiBufSize; INT32 iBackIndex; -INT32 ClipX1, ClipY1, ClipX2, ClipY2; +INT32 ClipX1, ClipY1, ClipX2, ClipY2; INT32 uiLeftSkip, uiRightSkip, uiTopSkip, uiBottomSkip; UINT32 usHeight, usWidth; -INT32 iTempX, iTempY; +INT32 iTempX, iTempY; // Don't register if we are rendering and we are below the viewport @@ -215,7 +215,7 @@ INT32 iTempX, iTempY; ClipY2= gDirtyClipRect.iBottom; usHeight = sBottom - sTop; - usWidth = sRight - sLeft; + usWidth = sRight - sLeft; //if((sClipLeft >= sClipRight) || (sClipTop >= sClipBottom)) // return(-1); @@ -229,25 +229,20 @@ INT32 iTempX, iTempY; uiBottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); // check if whole thing is clipped - if((uiLeftSkip >=(INT32)usWidth) || (uiRightSkip >=(INT32)usWidth)) + if((uiLeftSkip >=(INT32)usWidth) || (uiRightSkip >=(INT32)usWidth)) return(-1 ); // check if whole thing is clipped - if((uiTopSkip >=(INT32)usHeight) || (uiBottomSkip >=(INT32)usHeight)) + if((uiTopSkip >=(INT32)usHeight) || (uiBottomSkip >=(INT32)usHeight)) return(-1 ); // Set re-set values given based on clipping - sLeft = sLeft + (INT16)uiLeftSkip; + sLeft = sLeft + (INT16)uiLeftSkip; sRight = sRight - (INT16)uiRightSkip; - sTop = sTop + (INT16)uiTopSkip; + sTop = sTop + (INT16)uiTopSkip; sBottom = sBottom - (INT16)uiBottomSkip; -if ( sLeft == 192 || sLeft == 188 ) -{ - int i = 0; -} - if((iBackIndex=GetFreeBackgroundBuffer())==(-1)) return(-1); @@ -258,10 +253,10 @@ if ( sLeft == 192 || sLeft == 188 ) if(pSaveArea==NULL) { uiBufSize=((sRight-sLeft)*2)*(sBottom-sTop); - + if(uiBufSize==0) return(-1); - + if ( uiFlags & BGND_FLAG_SAVERECT ) { if((gBackSaves[iBackIndex].pSaveArea = (INT16 *) MemAlloc(uiBufSize))==NULL) @@ -289,7 +284,7 @@ if ( sLeft == 192 || sLeft == 188 ) gBackSaves[iBackIndex].sBottom=sBottom; gBackSaves[iBackIndex].sWidth=(sRight-sLeft); gBackSaves[iBackIndex].sHeight=(sBottom-sTop); - + gBackSaves[iBackIndex].fFilled=FALSE; return(iBackIndex); @@ -307,7 +302,7 @@ void SetBackgroundRectFilled( UINT32 uiBackgroundID ) BOOLEAN RestoreBackgroundRects(void) { UINT32 uiCount, uiDestPitchBYTES, uiSrcPitchBYTES; -UINT8 *pDestBuf, *pSrcBuf; +UINT8 *pDestBuf, *pSrcBuf; pDestBuf = LockVideoSurface(guiRENDERBUFFER, &uiDestPitchBYTES); pSrcBuf = LockVideoSurface(guiSAVEBUFFER, &uiSrcPitchBYTES); @@ -322,8 +317,8 @@ UINT8 *pDestBuf, *pSrcBuf; if ( gBackSaves[uiCount].pSaveArea != NULL ) { Blt16BPPTo16BPP( (UINT16*)pDestBuf, uiDestPitchBYTES, (UINT16 *)gBackSaves[uiCount].pSaveArea, gBackSaves[uiCount].sWidth*2, - gBackSaves[uiCount].sLeft , gBackSaves[uiCount].sTop, - 0, 0, + gBackSaves[uiCount].sLeft , gBackSaves[uiCount].sTop, + 0, 0, gBackSaves[uiCount].sWidth, gBackSaves[uiCount].sHeight); AddBaseDirtyRect(gBackSaves[uiCount].sLeft, gBackSaves[uiCount].sTop, @@ -336,17 +331,17 @@ UINT8 *pDestBuf, *pSrcBuf; if ( gBackSaves[uiCount].fZBuffer ) { Blt16BPPTo16BPP( (UINT16*)gpZBuffer, uiDestPitchBYTES, (UINT16 *)gBackSaves[uiCount].pZSaveArea, gBackSaves[uiCount].sWidth*2, - gBackSaves[uiCount].sLeft , gBackSaves[uiCount].sTop, + gBackSaves[uiCount].sLeft , gBackSaves[uiCount].sTop, 0, 0, gBackSaves[uiCount].sWidth, gBackSaves[uiCount].sHeight); } } else { - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - gBackSaves[uiCount].sLeft , gBackSaves[uiCount].sTop, - gBackSaves[uiCount].sLeft , gBackSaves[uiCount].sTop, + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + gBackSaves[uiCount].sLeft , gBackSaves[uiCount].sTop, + gBackSaves[uiCount].sLeft , gBackSaves[uiCount].sTop, gBackSaves[uiCount].sWidth, gBackSaves[uiCount].sHeight); AddBaseDirtyRect(gBackSaves[uiCount].sLeft, gBackSaves[uiCount].sTop, @@ -405,7 +400,7 @@ BOOLEAN EmptyBackgroundRects(void) { if ( gBackSaves[uiCount].pSaveArea != NULL ) { - MemFree(gBackSaves[uiCount].pSaveArea); + MemFree(gBackSaves[uiCount].pSaveArea); } } @@ -431,7 +426,7 @@ BOOLEAN EmptyBackgroundRects(void) BOOLEAN SaveBackgroundRects(void) { UINT32 uiCount, uiDestPitchBYTES, uiSrcPitchBYTES; -UINT8 *pDestBuf, *pSrcBuf; +UINT8 *pDestBuf, *pSrcBuf; pSrcBuf = LockVideoSurface(guiRENDERBUFFER, &uiDestPitchBYTES ); pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiSrcPitchBYTES); @@ -446,19 +441,19 @@ UINT8 *pDestBuf, *pSrcBuf; { Blt16BPPTo16BPP((UINT16 *)gBackSaves[uiCount].pSaveArea, gBackSaves[uiCount].sWidth*2, (UINT16 *)pSrcBuf, uiDestPitchBYTES, - 0, 0, - gBackSaves[uiCount].sLeft , gBackSaves[uiCount].sTop, + 0, 0, + gBackSaves[uiCount].sLeft , gBackSaves[uiCount].sTop, gBackSaves[uiCount].sWidth, gBackSaves[uiCount].sHeight); } - } + } else if(gBackSaves[uiCount].fZBuffer) { - Blt16BPPTo16BPP((UINT16 *)gBackSaves[uiCount].pZSaveArea, gBackSaves[uiCount].sWidth*2, - (UINT16 *)gpZBuffer, uiDestPitchBYTES, - 0, 0, - gBackSaves[uiCount].sLeft , gBackSaves[uiCount].sTop, + Blt16BPPTo16BPP((UINT16 *)gBackSaves[uiCount].pZSaveArea, gBackSaves[uiCount].sWidth*2, + (UINT16 *)gpZBuffer, uiDestPitchBYTES, + 0, 0, + gBackSaves[uiCount].sLeft , gBackSaves[uiCount].sTop, gBackSaves[uiCount].sWidth, gBackSaves[uiCount].sHeight); } else @@ -479,7 +474,7 @@ UINT8 *pDestBuf, *pSrcBuf; return(TRUE); } - + BOOLEAN FreeBackgroundRect(INT32 iIndex) { if ( iIndex != -1 ) @@ -488,14 +483,14 @@ BOOLEAN FreeBackgroundRect(INT32 iIndex) RecountBackgrounds(); } - + return(TRUE); } BOOLEAN FreeBackgroundRectPending(INT32 iIndex) { gBackSaves[iIndex].fPendingDelete = TRUE; - + return(TRUE); } @@ -543,7 +538,7 @@ UINT32 uiCount; } RecountBackgrounds(); - + return(TRUE); } @@ -586,11 +581,11 @@ void DisableBackgroundRect( INT32 iIndex, BOOLEAN fDisabled ) BOOLEAN UpdateSaveBuffer(void) { UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; - UINT8 *pDestBuf, *pSrcBuf; + UINT8 *pDestBuf, *pSrcBuf; UINT16 usWidth, usHeight; - UINT8 ubBitDepth; + UINT8 ubBitDepth; + - // Update saved buffer - do for the viewport size ony! GetCurrentVideoSettings( &usWidth, &usHeight, &ubBitDepth ); @@ -600,15 +595,15 @@ BOOLEAN UpdateSaveBuffer(void) if(gbPixelDepth==16) { // BLIT HERE - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - 0, gsVIEWPORT_WINDOW_START_Y, 0, gsVIEWPORT_WINDOW_START_Y, usWidth, ( gsVIEWPORT_WINDOW_END_Y - gsVIEWPORT_WINDOW_START_Y ) ); + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + 0, gsVIEWPORT_WINDOW_START_Y, 0, gsVIEWPORT_WINDOW_START_Y, usWidth, ( gsVIEWPORT_WINDOW_END_Y - gsVIEWPORT_WINDOW_START_Y ) ); } else if(gbPixelDepth==8) { // BLIT HERE - Blt8BPPTo8BPP(pDestBuf, uiDestPitchBYTES, - pSrcBuf, uiSrcPitchBYTES, + Blt8BPPTo8BPP(pDestBuf, uiDestPitchBYTES, + pSrcBuf, uiSrcPitchBYTES, 0, gsVIEWPORT_WINDOW_START_Y, 0, gsVIEWPORT_WINDOW_START_Y, usWidth, gsVIEWPORT_WINDOW_END_Y ); } @@ -624,7 +619,7 @@ BOOLEAN RestoreExternBackgroundRect( INT16 sLeft, INT16 sTop, INT16 sWidth, INT1 { UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; - UINT8 *pDestBuf, *pSrcBuf; + UINT8 *pDestBuf, *pSrcBuf; Assert( ( sLeft >= 0 ) && ( sTop >= 0 ) && ( sLeft + sWidth <= SCREEN_WIDTH ) && ( sTop + sHeight <= SCREEN_HEIGHT ) ); @@ -634,18 +629,18 @@ BOOLEAN RestoreExternBackgroundRect( INT16 sLeft, INT16 sTop, INT16 sWidth, INT1 if(gbPixelDepth==16) { - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + sLeft , sTop, + sLeft , sTop, sWidth, sHeight); } else if(gbPixelDepth==8) { - Blt8BPPTo8BPP(pDestBuf, uiDestPitchBYTES, - pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, + Blt8BPPTo8BPP(pDestBuf, uiDestPitchBYTES, + pSrcBuf, uiSrcPitchBYTES, + sLeft , sTop, + sLeft , sTop, sWidth, sHeight); } UnLockVideoSurface(guiRENDERBUFFER); @@ -662,7 +657,7 @@ BOOLEAN RestoreExternBackgroundRectGivenID( INT32 iBack ) { UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; INT16 sLeft, sTop, sWidth, sHeight; - UINT8 *pDestBuf, *pSrcBuf; + UINT8 *pDestBuf, *pSrcBuf; if( !gBackSaves[iBack].fAllocated ) @@ -682,18 +677,18 @@ BOOLEAN RestoreExternBackgroundRectGivenID( INT32 iBack ) if(gbPixelDepth==16) { - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + sLeft , sTop, + sLeft , sTop, sWidth, sHeight); } else if(gbPixelDepth==8) { - Blt8BPPTo8BPP(pDestBuf, uiDestPitchBYTES, - pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, + Blt8BPPTo8BPP(pDestBuf, uiDestPitchBYTES, + pSrcBuf, uiSrcPitchBYTES, + sLeft , sTop, + sLeft , sTop, sWidth, sHeight); } UnLockVideoSurface(guiRENDERBUFFER); @@ -710,7 +705,7 @@ BOOLEAN CopyExternBackgroundRect( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 s { UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; - UINT8 *pDestBuf, *pSrcBuf; + UINT8 *pDestBuf, *pSrcBuf; Assert( ( sLeft >= 0 ) && ( sTop >= 0 ) && ( sLeft + sWidth <= SCREEN_WIDTH ) && ( sTop + sHeight <= SCREEN_HEIGHT ) ); @@ -720,18 +715,18 @@ BOOLEAN CopyExternBackgroundRect( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 s if(gbPixelDepth==16) { - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + sLeft , sTop, + sLeft , sTop, sWidth, sHeight); } else if(gbPixelDepth==8) { - Blt8BPPTo8BPP(pDestBuf, uiDestPitchBYTES, - pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, + Blt8BPPTo8BPP(pDestBuf, uiDestPitchBYTES, + pSrcBuf, uiSrcPitchBYTES, + sLeft , sTop, + sLeft , sTop, sWidth, sHeight); } UnLockVideoSurface(guiSAVEBUFFER); @@ -748,7 +743,7 @@ BOOLEAN CopyExternBackgroundRect( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 s // background for a given call to gprintf. Note that this must be called before // the backgrounds are saved, and before the actual call to gprintf that writes // to the video buffer. -// +// //***************************************************************************** UINT16 gprintfdirty(INT16 x, INT16 y, STR16 pFontString, ...) { @@ -759,24 +754,24 @@ INT32 iBack; Assert(pFontString!=NULL); - va_start(argptr, pFontString); // Set up variable argument pointer + va_start(argptr, pFontString); // Set up variable argument pointer vswprintf(string, pFontString, argptr); // process gprintf string (get output str) va_end(argptr); - if ( USE_WINFONTS( ) ) - { - uiStringLength=WinFontStringPixLength( string, GET_WINFONT( ) ); - uiStringHeight=GetWinFontHeight( string, GET_WINFONT( ) ); - } - else - { - uiStringLength=StringPixLength(string, FontDefault); - uiStringHeight=GetFontHeight(FontDefault); - } + if ( USE_WINFONTS( ) ) + { + uiStringLength=WinFontStringPixLength( string, GET_WINFONT( ) ); + uiStringHeight=GetWinFontHeight( string, GET_WINFONT( ) ); + } + else + { + uiStringLength=StringPixLength(string, FontDefault); + uiStringHeight=GetFontHeight(FontDefault); + } if ( uiStringLength > 0 ) { - iBack = RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, x, y, (INT16)(x + uiStringLength), (INT16)(y + uiStringHeight)); + iBack = RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, x, y, (INT16)(x + uiStringLength), (INT16)(y + uiStringHeight)); if ( iBack != -1 ) { @@ -795,7 +790,7 @@ UINT16 uiStringLength, uiStringHeight; Assert(pFontString!=NULL); - va_start(argptr, pFontString); // Set up variable argument pointer + va_start(argptr, pFontString); // Set up variable argument pointer vswprintf(string, pFontString, argptr); // process gprintf string (get output str) va_end(argptr); @@ -804,7 +799,7 @@ UINT16 uiStringLength, uiStringHeight; if ( uiStringLength > 0 ) { - InvalidateRegionEx( x, y, (INT16)(x + uiStringLength), (INT16)(y + uiStringHeight), 0 ); + InvalidateRegionEx( x, y, (INT16)(x + uiStringLength), (INT16)(y + uiStringHeight), 0 ); } return(uiStringLength); } @@ -817,7 +812,7 @@ UINT16 uiStringLength, uiStringHeight; Assert(pFontString!=NULL); - va_start(argptr, pFontString); // Set up variable argument pointer + va_start(argptr, pFontString); // Set up variable argument pointer vswprintf(string, pFontString, argptr); // process gprintf string (get output str) va_end(argptr); @@ -826,7 +821,7 @@ UINT16 uiStringLength, uiStringHeight; if ( uiStringLength > 0 ) { - RestoreExternBackgroundRect( x, y, uiStringLength, uiStringHeight ); + RestoreExternBackgroundRect( x, y, uiStringLength, uiStringHeight ); } return(uiStringLength); @@ -836,7 +831,7 @@ UINT16 uiStringLength, uiStringHeight; // OVERLAY STUFF INT32 GetFreeVideoOverlay(void) { - UINT32 uiCount; + UINT32 uiCount; for(uiCount=0; uiCount < guiNumVideoOverlays; uiCount++) { @@ -853,7 +848,7 @@ INT32 GetFreeVideoOverlay(void) void RecountVideoOverlays(void) { - INT32 uiCount; + INT32 uiCount; for(uiCount=guiNumVideoOverlays-1; (uiCount >=0) ; uiCount--) { @@ -906,18 +901,18 @@ INT32 RegisterVideoOverlay( UINT32 uiFlags, VIDEO_OVERLAY_DESC *pTopmostDesc ) // Init new blitter memset(&gVideoOverlays[ iBlitterIndex ], 0, sizeof( VIDEO_OVERLAY ) ); - gVideoOverlays[ iBlitterIndex ].uiFlags = uiFlags; - gVideoOverlays[ iBlitterIndex ].fAllocated = 2; + gVideoOverlays[ iBlitterIndex ].uiFlags = uiFlags; + gVideoOverlays[ iBlitterIndex ].fAllocated = 2; gVideoOverlays[ iBlitterIndex ].uiBackground = iBackIndex; - gVideoOverlays[ iBlitterIndex ].pBackground = &( gBackSaves[ iBackIndex ] ); - gVideoOverlays[ iBlitterIndex ].BltCallback = pTopmostDesc->BltCallback; + gVideoOverlays[ iBlitterIndex ].pBackground = &( gBackSaves[ iBackIndex ] ); + gVideoOverlays[ iBlitterIndex ].BltCallback = pTopmostDesc->BltCallback; // Update blitter info // Set update flags to zero since we are forcing all updates pTopmostDesc->uiFlags = 0; UpdateVideoOverlay( pTopmostDesc, iBlitterIndex , TRUE ); - // Set disabled flag to true + // Set disabled flag to true if ( uiFlags & VOVERLAY_STARTDISABLED ) { gVideoOverlays[ iBlitterIndex ].fDisabled = TRUE; @@ -932,7 +927,7 @@ INT32 RegisterVideoOverlay( UINT32 uiFlags, VIDEO_OVERLAY_DESC *pTopmostDesc ) } - + void SetVideoOverlayPendingDelete( INT32 iVideoOverlay ) { if ( iVideoOverlay != -1 ) @@ -960,7 +955,7 @@ void RemoveVideoOverlay( INT32 iVideoOverlay ) // Remove background FreeBackgroundRect( gVideoOverlays[ iVideoOverlay ].uiBackground ); - + //DebugMsg( TOPIC_JA2, DBG_LEVEL_0, String( "Delete Overlay %d %S", iVideoOverlay, gVideoOverlays[ iVideoOverlay ].zText ) ); @@ -973,7 +968,7 @@ void RemoveVideoOverlay( INT32 iVideoOverlay ) // Set as not allocated - gVideoOverlays[ iVideoOverlay ].fAllocated = FALSE; + gVideoOverlays[ iVideoOverlay ].fAllocated = FALSE; } } } @@ -996,11 +991,11 @@ BOOLEAN UpdateVideoOverlay( VIDEO_OVERLAY_DESC *pTopmostDesc, UINT32 iBlitterInd if ( fForceAll ) { - gVideoOverlays[ iBlitterIndex ].uiFontID = pTopmostDesc->uiFontID; - gVideoOverlays[ iBlitterIndex ].sX = pTopmostDesc->sX; - gVideoOverlays[ iBlitterIndex ].sY = pTopmostDesc->sY; - gVideoOverlays[ iBlitterIndex ].ubFontBack = pTopmostDesc->ubFontBack; - gVideoOverlays[ iBlitterIndex ].ubFontFore = pTopmostDesc->ubFontFore; + gVideoOverlays[ iBlitterIndex ].uiFontID = pTopmostDesc->uiFontID; + gVideoOverlays[ iBlitterIndex ].sX = pTopmostDesc->sX; + gVideoOverlays[ iBlitterIndex ].sY = pTopmostDesc->sY; + gVideoOverlays[ iBlitterIndex ].ubFontBack = pTopmostDesc->ubFontBack; + gVideoOverlays[ iBlitterIndex ].ubFontFore = pTopmostDesc->ubFontFore; if ( pTopmostDesc->pzText != NULL ) { @@ -1044,8 +1039,8 @@ BOOLEAN UpdateVideoOverlay( VIDEO_OVERLAY_DESC *pTopmostDesc, UINT32 iBlitterInd FreeBackgroundRectPending( gVideoOverlays[ iBlitterIndex ].uiBackground ); gVideoOverlays[ iBlitterIndex ].uiBackground = RegisterBackgroundRect( BGND_FLAG_PERMANENT, NULL, pTopmostDesc->sLeft, pTopmostDesc->sTop, (INT16)(pTopmostDesc->sLeft + uiStringLength), (INT16)(pTopmostDesc->sTop + uiStringHeight) ); - gVideoOverlays[ iBlitterIndex ].sX = pTopmostDesc->sX; - gVideoOverlays[ iBlitterIndex ].sY = pTopmostDesc->sY; + gVideoOverlays[ iBlitterIndex ].sX = pTopmostDesc->sX; + gVideoOverlays[ iBlitterIndex ].sY = pTopmostDesc->sY; } @@ -1083,7 +1078,7 @@ void ExecuteVideoOverlays( ) } else if ( gVideoOverlays[uiCount].fAllocated == 2 ) { - gVideoOverlays[uiCount].fAllocated = 1; + gVideoOverlays[uiCount].fAllocated = 1; } } @@ -1100,7 +1095,7 @@ void ExecuteVideoOverlays( ) void ExecuteVideoOverlaysToAlternateBuffer( UINT32 uiNewDestBuffer ) { - UINT32 uiCount; + UINT32 uiCount; UINT32 uiOldDestBuffer; for(uiCount=0; uiCount < guiNumVideoOverlays; uiCount++) @@ -1109,12 +1104,12 @@ void ExecuteVideoOverlaysToAlternateBuffer( UINT32 uiNewDestBuffer ) { if ( gVideoOverlays[uiCount].fActivelySaving ) { - uiOldDestBuffer = gVideoOverlays[uiCount].uiDestBuff; + uiOldDestBuffer = gVideoOverlays[uiCount].uiDestBuff; gVideoOverlays[uiCount].uiDestBuff = uiNewDestBuffer; // Call Blit Function - (*(gVideoOverlays[uiCount].BltCallback ) ) ( &(gVideoOverlays[uiCount]) ); + (*(gVideoOverlays[uiCount].BltCallback ) ) ( &(gVideoOverlays[uiCount]) ); gVideoOverlays[uiCount].uiDestBuff = uiOldDestBuffer; } @@ -1145,7 +1140,7 @@ void AllocateVideoOverlaysArea( ) // Allocate if( ( gVideoOverlays[ uiCount ].pSaveArea = (INT16 *) MemAlloc( uiBufSize ) ) == NULL ) { - continue; + continue; } } } @@ -1183,7 +1178,7 @@ void SaveVideoOverlaysArea( UINT32 uiSrcBuffer ) UINT32 uiCount; UINT32 iBackIndex; UINT32 uiSrcPitchBYTES; - UINT8 *pSrcBuf; + UINT8 *pSrcBuf; pSrcBuf = LockVideoSurface( uiSrcBuffer, &uiSrcPitchBYTES ); @@ -1204,8 +1199,8 @@ void SaveVideoOverlaysArea( UINT32 uiSrcBuffer ) // Save data from frame buffer! Blt16BPPTo16BPP((UINT16 *)gVideoOverlays[uiCount].pSaveArea, gBackSaves[ iBackIndex ].sWidth*2, (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - 0, 0, - gBackSaves[ iBackIndex ].sLeft , gBackSaves[ iBackIndex ].sTop, + 0, 0, + gBackSaves[ iBackIndex ].sLeft , gBackSaves[ iBackIndex ].sTop, gBackSaves[ iBackIndex ].sWidth, gBackSaves[ iBackIndex ].sHeight ); } } @@ -1220,7 +1215,7 @@ void SaveVideoOverlayArea( UINT32 uiSrcBuffer, UINT32 uiCount ) { UINT32 iBackIndex; UINT32 uiSrcPitchBYTES; - UINT8 *pSrcBuf; + UINT8 *pSrcBuf; pSrcBuf = LockVideoSurface( uiSrcBuffer, &uiSrcPitchBYTES ); @@ -1240,8 +1235,8 @@ void SaveVideoOverlayArea( UINT32 uiSrcBuffer, UINT32 uiCount ) // Save data from frame buffer! Blt16BPPTo16BPP((UINT16 *)gVideoOverlays[uiCount].pSaveArea, gBackSaves[ iBackIndex ].sWidth*2, (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - 0, 0, - gBackSaves[ iBackIndex ].sLeft , gBackSaves[ iBackIndex ].sTop, + 0, 0, + gBackSaves[ iBackIndex ].sLeft , gBackSaves[ iBackIndex ].sTop, gBackSaves[ iBackIndex ].sWidth, gBackSaves[ iBackIndex ].sHeight ); } } @@ -1282,16 +1277,16 @@ void DeleteVideoOverlaysArea( ) } -BOOLEAN RestoreShiftedVideoOverlays( INT16 sShiftX, INT16 sShiftY ) +BOOLEAN RestoreShiftedVideoOverlays( INT16 sShiftX, INT16 sShiftY ) { UINT32 uiCount, uiDestPitchBYTES; - UINT8 *pDestBuf; + UINT8 *pDestBuf; UINT32 iBackIndex; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; + INT32 ClipX1, ClipY1, ClipX2, ClipY2; INT32 uiLeftSkip, uiRightSkip, uiTopSkip, uiBottomSkip; UINT32 usHeight, usWidth; - INT32 iTempX, iTempY; + INT32 iTempX, iTempY; INT16 sLeft, sTop, sRight, sBottom; ClipX1= 0; @@ -1302,7 +1297,7 @@ BOOLEAN RestoreShiftedVideoOverlays( INT16 sShiftX, INT16 sShiftY ) pDestBuf = LockVideoSurface( BACKBUFFER, &uiDestPitchBYTES); - for(uiCount=0; uiCount < guiNumVideoOverlays; uiCount++) + for(uiCount=0; uiCount < guiNumVideoOverlays; uiCount++) { if( gVideoOverlays[uiCount].fAllocated && !gVideoOverlays[uiCount].fDisabled ) { @@ -1313,11 +1308,11 @@ BOOLEAN RestoreShiftedVideoOverlays( INT16 sShiftX, INT16 sShiftY ) { // Get restore background values sLeft = gBackSaves[ iBackIndex ].sLeft; - sTop = gBackSaves[ iBackIndex ].sTop; + sTop = gBackSaves[ iBackIndex ].sTop; sRight = gBackSaves[ iBackIndex ].sRight; sBottom = gBackSaves[ iBackIndex ].sBottom; - usHeight = gBackSaves[ iBackIndex ].sHeight; - usWidth = gBackSaves[ iBackIndex ].sWidth; + usHeight = gBackSaves[ iBackIndex ].sHeight; + usWidth = gBackSaves[ iBackIndex ].sWidth; // Clip!! @@ -1331,29 +1326,29 @@ BOOLEAN RestoreShiftedVideoOverlays( INT16 sShiftX, INT16 sShiftY ) uiBottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); // check if whole thing is clipped - if((uiLeftSkip >=(INT32)usWidth) || (uiRightSkip >=(INT32)usWidth)) + if((uiLeftSkip >=(INT32)usWidth) || (uiRightSkip >=(INT32)usWidth)) continue; // check if whole thing is clipped - if((uiTopSkip >=(INT32)usHeight) || (uiBottomSkip >=(INT32)usHeight)) + if((uiTopSkip >=(INT32)usHeight) || (uiBottomSkip >=(INT32)usHeight)) continue; // Set re-set values given based on clipping - sLeft = iTempX + (INT16)uiLeftSkip; - sTop = iTempY + (INT16)uiTopSkip; - sRight = sRight + sShiftX - (INT16)uiRightSkip; - sBottom = sBottom + sShiftY - (INT16)uiBottomSkip; + sLeft = iTempX + (INT16)uiLeftSkip; + sTop = iTempY + (INT16)uiTopSkip; + sRight = sRight + sShiftX - (INT16)uiRightSkip; + sBottom = sBottom + sShiftY - (INT16)uiBottomSkip; usHeight = sBottom - sTop; - usWidth = sRight - sLeft; + usWidth = sRight - sLeft; if(gbPixelDepth==16) { Blt16BPPTo16BPP((UINT16 *)(UINT16 *)pDestBuf, uiDestPitchBYTES, (UINT16 *)gVideoOverlays[uiCount].pSaveArea, gBackSaves[ iBackIndex ].sWidth*2, - sLeft, sTop, - uiLeftSkip, uiTopSkip, + sLeft, sTop, + uiLeftSkip, uiTopSkip, usWidth, usHeight ); } @@ -1374,7 +1369,7 @@ BOOLEAN RestoreShiftedVideoOverlays( INT16 sShiftX, INT16 sShiftY ) } UnLockVideoSurface( BACKBUFFER ); - + return(TRUE); } @@ -1399,7 +1394,7 @@ BOOLEAN SetOverlayUserData( INT32 iVideoOverlay, UINT8 ubNum, UINT32 uiData ) // Common callbacks for topmost blitters void BlitMFont( VIDEO_OVERLAY *pBlitter ) { - UINT8 *pDestBuf; + UINT8 *pDestBuf; UINT32 uiDestPitchBYTES; pDestBuf = LockVideoSurface( pBlitter->uiDestBuff, &uiDestPitchBYTES); @@ -1418,15 +1413,15 @@ void BlitMFont( VIDEO_OVERLAY *pBlitter ) BOOLEAN BlitBufferToBuffer(UINT32 uiSrcBuffer, UINT32 uiDestBuffer, UINT16 usSrcX, UINT16 usSrcY, UINT16 usWidth, UINT16 usHeight) { UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; - UINT8 *pDestBuf, *pSrcBuf; + UINT8 *pDestBuf, *pSrcBuf; BOOLEAN fRetVal; pDestBuf = LockVideoSurface(uiDestBuffer, &uiDestPitchBYTES); pSrcBuf = LockVideoSurface(uiSrcBuffer, &uiSrcPitchBYTES); fRetVal = Blt16BPPTo16BPP( (UINT16*)pDestBuf, uiDestPitchBYTES, (UINT16*)pSrcBuf, uiSrcPitchBYTES, - usSrcX, usSrcY, - usSrcX, usSrcY, + usSrcX, usSrcY, + usSrcX, usSrcY, usWidth, usHeight); UnLockVideoSurface(uiDestBuffer); @@ -1445,10 +1440,10 @@ void EnableVideoOverlay( BOOLEAN fEnable, INT32 iOverlayIndex ) // enable or disable VideoOverlayDesc.fDisabled = !fEnable; - + // go play with enable/disable state - VideoOverlayDesc.uiFlags = VOVERLAY_DESC_DISABLED; - + VideoOverlayDesc.uiFlags = VOVERLAY_DESC_DISABLED; + UpdateVideoOverlay( &VideoOverlayDesc, iOverlayIndex, FALSE ); } diff --git a/TileEngine/Render Fun.cpp b/TileEngine/Render Fun.cpp index 1a401e98..608f5267 100644 --- a/TileEngine/Render Fun.cpp +++ b/TileEngine/Render Fun.cpp @@ -7,7 +7,7 @@ #include "Render Fun.h" #include "worlddef.h" - #include "input.h" + #include "input.h" #include "sysutil.h" #include "debug.h" #include "wcheck.h" @@ -54,13 +54,13 @@ void SetTileRangeRoomNum( SGPRect *pSelectRegion, UINT8 ubRoomNum ) { for ( cnt2 = pSelectRegion->iLeft; cnt2 <= pSelectRegion->iRight; cnt2++ ) { - gubWorldRoomInfo[ (INT16)MAPROWCOLTOPOS( cnt1, cnt2 ) ] = ubRoomNum; + gubWorldRoomInfo[ (INT16)MAPROWCOLTOPOS( cnt1, cnt2 ) ] = ubRoomNum; } } } -BOOLEAN InARoom( UINT16 sGridNo, UINT8 *pubRoomNo ) +BOOLEAN InARoom( INT16 sGridNo, UINT8 *pubRoomNo ) { if ( gubWorldRoomInfo[ sGridNo ] != NO_ROOM ) { @@ -75,7 +75,7 @@ BOOLEAN InARoom( UINT16 sGridNo, UINT8 *pubRoomNo ) } -BOOLEAN InAHiddenRoom( UINT16 sGridNo, UINT8 *pubRoomNo ) +BOOLEAN InAHiddenRoom( INT16 sGridNo, UINT8 *pubRoomNo ) { if ( gubWorldRoomInfo[ sGridNo ] != NO_ROOM ) { @@ -109,31 +109,31 @@ void SetRecalculateWireFrameFlagRadius(INT16 sX, INT16 sY, INT16 sRadius) } -void SetGridNoRevealedFlag( UINT16 sGridNo ) +void SetGridNoRevealedFlag( INT16 sGridNo ) { // UINT32 cnt; -// ITEM_POOL *pItemPool; +// ITEM_POOL *pItemPool; // INT16 sX, sY; LEVELNODE *pNode = NULL; STRUCTURE *pStructure, *pBase; // Set hidden flag, for any roofs - SetRoofIndexFlagsFromTypeRange( sGridNo, FIRSTROOF, FOURTHROOF, LEVELNODE_HIDDEN ); + SetRoofIndexFlagsFromTypeRange( sGridNo, FIRSTROOF, FOURTHROOF, LEVELNODE_HIDDEN ); // ATE: Do this only if we are in a room... if ( gubWorldRoomInfo[ sGridNo ] != NO_ROOM ) { - SetStructAframeFlags( sGridNo, LEVELNODE_HIDDEN ); + SetStructAframeFlags( sGridNo, LEVELNODE_HIDDEN ); // Find gridno one east as well... if ( ( sGridNo + WORLD_COLS ) < NOWHERE ) { - SetStructAframeFlags( sGridNo + WORLD_COLS, LEVELNODE_HIDDEN ); + SetStructAframeFlags( sGridNo + WORLD_COLS, LEVELNODE_HIDDEN ); } if ( ( sGridNo + 1 ) < NOWHERE ) { - SetStructAframeFlags( sGridNo + 1, LEVELNODE_HIDDEN ); + SetStructAframeFlags( sGridNo + 1, LEVELNODE_HIDDEN ); } } @@ -146,7 +146,7 @@ void SetGridNoRevealedFlag( UINT16 sGridNo ) // ATE: If there are any structs here, we can render them with the obscured flag! // Look for anything but walls pn this gridno! - pStructure = gpWorldLevelData[ (INT16)sGridNo ].pStructureHead; + pStructure = gpWorldLevelData[ (INT16)sGridNo ].pStructureHead; while ( pStructure != NULL ) { @@ -162,7 +162,7 @@ void SetGridNoRevealedFlag( UINT16 sGridNo ) Assert( 0 ); continue; } - + // Get LEVELNODE for struct and remove! pNode = FindLevelNodeBasedOnStructure( pBase->sGridNo, pBase ); @@ -188,7 +188,7 @@ void SetGridNoRevealedFlag( UINT16 sGridNo ) } -void ExamineGridNoForSlantRoofExtraGraphic( UINT16 sCheckGridNo ) +void ExamineGridNoForSlantRoofExtraGraphic( INT16 sCheckGridNo ) { LEVELNODE *pNode = NULL; STRUCTURE *pStructure, *pBase; @@ -205,7 +205,7 @@ void ExamineGridNoForSlantRoofExtraGraphic( UINT16 sCheckGridNo ) { // We have a slanted roof here ... find base and remove... pBase = FindBaseStructure( pStructure ); - + // Get LEVELNODE for struct and remove! pNode = FindLevelNodeBasedOnStructure( pBase->sGridNo, pBase ); @@ -220,7 +220,7 @@ void ExamineGridNoForSlantRoofExtraGraphic( UINT16 sCheckGridNo ) continue; } - // Given gridno, + // Given gridno, // IF NOT REVEALED AND HIDDEN.... if ( !( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) && pNode->uiFlags & LEVELNODE_HIDDEN ) { @@ -232,7 +232,7 @@ void ExamineGridNoForSlantRoofExtraGraphic( UINT16 sCheckGridNo ) fChanged = TRUE; } } - + // Revealed? if ( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) { @@ -243,7 +243,7 @@ void ExamineGridNoForSlantRoofExtraGraphic( UINT16 sCheckGridNo ) fChanged = TRUE; } } - + } } @@ -257,12 +257,11 @@ void ExamineGridNoForSlantRoofExtraGraphic( UINT16 sCheckGridNo ) } -void RemoveRoomRoof( UINT16 sGridNo, UINT8 bRoomNum, SOLDIERTYPE *pSoldier ) +void RemoveRoomRoof( INT16 sGridNo, UINT8 bRoomNum, SOLDIERTYPE *pSoldier ) { UINT32 cnt; - ITEM_POOL *pItemPool; + ITEM_POOL *pItemPool; INT16 sX, sY; - LEVELNODE *pNode = NULL; BOOLEAN fSaidItemSeenQuote = FALSE; // STRUCTURE *pStructure;//, *pBase; @@ -273,12 +272,12 @@ void RemoveRoomRoof( UINT16 sGridNo, UINT8 bRoomNum, SOLDIERTYPE *pSoldier ) if ( gubWorldRoomInfo[ cnt ] == bRoomNum ) { - SetGridNoRevealedFlag( (UINT16)cnt ); + SetGridNoRevealedFlag( (INT16)cnt ); - RemoveRoofIndexFlagsFromTypeRange( cnt, FIRSTROOF, SECONDSLANTROOF, LEVELNODE_REVEAL ); + RemoveRoofIndexFlagsFromTypeRange( cnt, FIRSTROOF, SECONDSLANTROOF, LEVELNODE_REVEAL ); // Reveal any items if here! - if ( GetItemPool( (INT16)cnt, &pItemPool, 0 ) ) + if ( GetItemPoolFromGround( (INT16)cnt, &pItemPool ) ) { // Set visible! ( only if invisible... ) if ( SetItemPoolVisibilityOn( pItemPool, INVISIBLE, TRUE ) ) @@ -307,7 +306,7 @@ void RemoveRoomRoof( UINT16 sGridNo, UINT8 bRoomNum, SOLDIERTYPE *pSoldier ) //{ // if ( gubWorldRoomInfo[ cnt ] == bRoomNum ) // { - // ExamineGridNoForSlantRoofExtraGraphic( (UINT16)cnt ); + // ExamineGridNoForSlantRoofExtraGraphic( (INT16)cnt ); // } //} @@ -322,7 +321,7 @@ void RemoveRoomRoof( UINT16 sGridNo, UINT8 bRoomNum, SOLDIERTYPE *pSoldier ) -BOOLEAN AddSpecialTileRange( SGPRect *pSelectRegion ) +BOOLEAN AddSpecialTileRange( SGPRect *pSelectRegion ) { INT32 cnt1, cnt2; @@ -330,15 +329,15 @@ BOOLEAN AddSpecialTileRange( SGPRect *pSelectRegion ) { for ( cnt2 = pSelectRegion->iLeft; cnt2 <= pSelectRegion->iRight; cnt2++ ) { - AddObjectToHead( (INT16)MAPROWCOLTOPOS( cnt1, cnt2 ), SPECIALTILE_MAPEXIT ); + AddObjectToHead( (INT16)MAPROWCOLTOPOS( cnt1, cnt2 ), SPECIALTILE_MAPEXIT ); } } return( TRUE ); } - -BOOLEAN RemoveSpecialTileRange( SGPRect *pSelectRegion ) + +BOOLEAN RemoveSpecialTileRange( SGPRect *pSelectRegion ) { INT32 cnt1, cnt2; @@ -346,10 +345,10 @@ BOOLEAN RemoveSpecialTileRange( SGPRect *pSelectRegion ) { for ( cnt2 = pSelectRegion->iLeft; cnt2 <= pSelectRegion->iRight; cnt2++ ) { - RemoveObject( (INT16)MAPROWCOLTOPOS( cnt1, cnt2 ), SPECIALTILE_MAPEXIT ); + RemoveObject( (INT16)MAPROWCOLTOPOS( cnt1, cnt2 ), SPECIALTILE_MAPEXIT ); } } return( TRUE ); } - + diff --git a/TileEngine/Render Fun.h b/TileEngine/Render Fun.h index 9812e824..9387f7c1 100644 --- a/TileEngine/Render Fun.h +++ b/TileEngine/Render Fun.h @@ -5,7 +5,7 @@ #include "worlddef.h" #define NO_ROOM 0 -#define MAX_ROOMS 250 +#define MAX_ROOMS 250 extern UINT8 gubWorldRoomHidden[ MAX_ROOMS ]; @@ -18,13 +18,13 @@ void ShutdownRoomDatabase( ); void SetTileRoomNum( INT16 sGridNo, UINT8 ubRoomNum ); void SetTileRangeRoomNum( SGPRect *pSelectRegion, UINT8 ubRoomNum ); -void RemoveRoomRoof( UINT16 sGridNo, UINT8 bRoomNum, SOLDIERTYPE *pSoldier ); -BOOLEAN InARoom( UINT16 sGridNo, UINT8 *pubRoomNo ); -BOOLEAN InAHiddenRoom( UINT16 sGridNo, UINT8 *pubRoomNo ); +void RemoveRoomRoof( INT16 sGridNo, UINT8 bRoomNum, SOLDIERTYPE *pSoldier ); +BOOLEAN InARoom( INT16 sGridNo, UINT8 *pubRoomNo ); +BOOLEAN InAHiddenRoom( INT16 sGridNo, UINT8 *pubRoomNo ); -void SetGridNoRevealedFlag( UINT16 sGridNo ); +void SetGridNoRevealedFlag( INT16 sGridNo ); -void ExamineGridNoForSlantRoofExtraGraphic( UINT16 sCheckGridNo ); +void ExamineGridNoForSlantRoofExtraGraphic( INT16 sCheckGridNo ); void SetRecalculateWireFrameFlagRadius(INT16 sX, INT16 sY, INT16 sRadius); diff --git a/TileEngine/Render Z.cpp b/TileEngine/Render Z.cpp index 57e51f0c..e428049f 100644 --- a/TileEngine/Render Z.cpp +++ b/TileEngine/Render Z.cpp @@ -1,3 +1,4 @@ +#include "Render Z.h" #include "worlddef.h" #include "renderworld.h" #include "Isometric Utils.h" @@ -5,239 +6,96 @@ INT16 gsRScreenCenterX, gsRScreenCenterY; INT16 gsRDistToCenterY, gsRDistToCenterX; -#define GetMapXYWorldY( sWorldCellX, sWorldCellY, sWorldY )\ -{\ -\ - gsRDistToCenterX = ( sWorldCellX * CELL_X_SIZE ) - gCenterWorldX;\ - gsRDistToCenterY = ( sWorldCellY * CELL_Y_SIZE ) - gCenterWorldY;\ -\ - gsRScreenCenterY = gsRDistToCenterX + gsRDistToCenterY;\ -\ - sWorldY = gsRScreenCenterY + gsCY - gsTLY;\ +INT16 GetMapXYWorldY( INT16 sWorldCellX, INT16 sWorldCellY ) +{ + gsRDistToCenterX = ( sWorldCellX * CELL_X_SIZE ) - gCenterWorldX; + gsRDistToCenterY = ( sWorldCellY * CELL_Y_SIZE ) - gCenterWorldY; + + gsRScreenCenterY = gsRDistToCenterX + gsRDistToCenterY; + + return (gsRScreenCenterY + gsCY - gsTLY); } -#define GetMapXYWorldYFromCellCoords( sWorldCellX, sWorldCellY, sWorldY )\ -{\ -\ - gsRDistToCenterX = sWorldCellX - gCenterWorldX;\ - gsRDistToCenterY = sWorldCellY - gCenterWorldY;\ -\ - gsRScreenCenterY = gsRDistToCenterX + gsRDistToCenterY;\ -\ - sWorldY = gsRScreenCenterY + gsCY - gsTLY;\ +INT16 GetMapXYWorldYFromCellCoords( INT16 sWorldCellX, INT16 sWorldCellY ) +{ + gsRDistToCenterX = sWorldCellX - gCenterWorldX; + gsRDistToCenterY = sWorldCellY - gCenterWorldY; + + gsRScreenCenterY = gsRDistToCenterX + gsRDistToCenterY; + + return gsRScreenCenterY + gsCY - gsTLY; } -#define LandZLevel( sMapX, sMapY )\ -{\ - sZLevel = LAND_Z_LEVEL;\ +INT16 LandZLevel( INT16 sMapX, INT16 sMapY ) +{ + return LAND_Z_LEVEL; } -#define ObjectZLevel( TileElem, pNode, sMapX, sMapY )\ -{\ - GetMapXYWorldY( sMapX, sMapY, sWorldY );\ -\ - if ( uiTileElemFlags & CLIFFHANG_TILE )\ - {\ - sZLevel=LAND_Z_LEVEL;\ - }\ - else if ( uiTileElemFlags & OBJECTLAYER_USEZHEIGHT )\ - {\ - sZLevel=( ( sWorldY ) *Z_SUBLAYERS)+LAND_Z_LEVEL;\ - }\ - else\ - {\ - sZLevel=OBJECT_Z_LEVEL;\ - }\ +INT16 ObjectZLevel( TILE_ELEMENT* TileElem, LEVELNODE* pNode, UINT32 uiTileElemFlags, INT32 sMapX, INT32 sMapY, INT16& sWorldY ) +{ + sWorldY = GetMapXYWorldY( sMapX, sMapY ); + + if ( uiTileElemFlags & CLIFFHANG_TILE ) + { + return LAND_Z_LEVEL; + } + else if ( uiTileElemFlags & OBJECTLAYER_USEZHEIGHT ) + { + return ( ( sWorldY ) * Z_SUBLAYERS)+LAND_Z_LEVEL; + } + else + { + return OBJECT_Z_LEVEL; + } } -#define StructZLevel( sMapX, sMapY )\ -{\ -\ - GetMapXYWorldY( sMapX, sMapY, sWorldY );\ -\ - if ( ( uiLevelNodeFlags & LEVELNODE_ROTTINGCORPSE ) )\ - {\ - if ( pCorpse->def.usFlags & ROTTING_CORPSE_VEHICLE )\ - {\ -\ - if ( pNode->pStructureData != NULL )\ - {\ - sZOffsetX = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetX;\ - sZOffsetY = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetY;\ - }\ - \ - GetMapXYWorldY( (sMapX + sZOffsetX), (sMapY + sZOffsetY), sWorldY );\ - \ - GetMapXYWorldY( (sMapX + sZOffsetX), (sMapY + sZOffsetY), sWorldY );\ - \ - sZLevel=( ( sWorldY ) * Z_SUBLAYERS)+STRUCT_Z_LEVEL;\ - \ - }\ - else\ - {\ - sZOffsetX = -1;\ - sZOffsetY = -1;\ - GetMapXYWorldY( (sMapX + sZOffsetX), (sMapY + sZOffsetY), sWorldY );\ - \ - sWorldY += 20;\ -\ - sZLevel=( ( sWorldY ) * Z_SUBLAYERS)+LAND_Z_LEVEL;\ - }\ - }\ - else if ( uiLevelNodeFlags & LEVELNODE_PHYSICSOBJECT )\ - {\ - sWorldY += pNode->sRelativeZ;\ - \ - sZLevel=(sWorldY*Z_SUBLAYERS)+ONROOF_Z_LEVEL;\ -\ - }\ - else if ( uiLevelNodeFlags & LEVELNODE_ITEM )\ - {\ - if ( pNode->pItemPool->bRenderZHeightAboveLevel > 0 )\ - {\ - sZLevel=(sWorldY*Z_SUBLAYERS)+STRUCT_Z_LEVEL;\ - sZLevel+=( pNode->pItemPool->bRenderZHeightAboveLevel );\ - }\ - else\ - {\ - sZLevel=(sWorldY*Z_SUBLAYERS)+OBJECT_Z_LEVEL;\ - }\ - }\ - else if ( uiAniTileFlags & ANITILE_SMOKE_EFFECT )\ - {\ - sZLevel=(sWorldY*Z_SUBLAYERS)+OBJECT_Z_LEVEL;\ - }\ - else if ( ( uiLevelNodeFlags & LEVELNODE_USEZ ) )\ - {\ -\ - if ( ( uiLevelNodeFlags & LEVELNODE_NOZBLITTER ) )\ - {\ - sWorldY += 40;\ - }\ - else\ - {\ - sWorldY += pNode->sRelativeZ;\ - }\ -\ - sZLevel=(sWorldY*Z_SUBLAYERS)+ONROOF_Z_LEVEL;\ - }\ - else\ - {\ - sZLevel=(sWorldY*Z_SUBLAYERS)+STRUCT_Z_LEVEL;\ - }\ -\ +INT16 RoofZLevel( INT16 sMapX, INT16 sMapY, INT16& sWorldY ) +{ + sWorldY = GetMapXYWorldY( sMapX, sMapY ); + sWorldY += WALL_HEIGHT; + + return (sWorldY*Z_SUBLAYERS)+ROOF_Z_LEVEL; + } -#define RoofZLevel( sMapX, sMapY )\ -{\ -\ - GetMapXYWorldY( sMapX, sMapY, sWorldY );\ -\ - sWorldY += WALL_HEIGHT;\ -\ - sZLevel=(sWorldY*Z_SUBLAYERS)+ROOF_Z_LEVEL;\ -\ +INT16 OnRoofZLevel( INT16 sMapX, INT16 sMapY, INT16& sWorldY, UINT32 uiLevelNodeFlags ) +{ + sWorldY = GetMapXYWorldY( sMapX, sMapY ); + + if ( uiLevelNodeFlags & LEVELNODE_ROTTINGCORPSE ) + { + sWorldY += ( WALL_HEIGHT + 40 ); + } + if ( uiLevelNodeFlags & LEVELNODE_ROTTINGCORPSE ) + { + sWorldY += ( WALL_HEIGHT + 40 ); + } + else + { + sWorldY += WALL_HEIGHT; + } + + return(sWorldY*Z_SUBLAYERS)+ONROOF_Z_LEVEL; + } -#define OnRoofZLevel( sMapX, sMapY )\ -{\ -\ - GetMapXYWorldY( sMapX, sMapY, sWorldY );\ -\ - if ( uiLevelNodeFlags & LEVELNODE_ROTTINGCORPSE )\ - {\ - sWorldY += ( WALL_HEIGHT + 40 );\ - }\ - if ( uiLevelNodeFlags & LEVELNODE_ROTTINGCORPSE )\ - {\ - sWorldY += ( WALL_HEIGHT + 40 );\ - }\ - else\ - {\ - sWorldY += WALL_HEIGHT;\ - }\ -\ - sZLevel=(sWorldY*Z_SUBLAYERS)+ONROOF_Z_LEVEL;\ -\ +INT16 TopmostZLevel( INT16 sMapX, INT16 sMapY, INT16& sWorldY ) +{ + sWorldY = GetMapXYWorldY( sMapX, sMapY ); + + return TOPMOST_Z_LEVEL; } -#define TopmostZLevel( sMapX, sMapY )\ -{\ -\ - GetMapXYWorldY( sMapX, sMapY, sWorldY );\ -\ - sZLevel=TOPMOST_Z_LEVEL;\ -\ +INT16 ShadowZLevel( INT16 sMapX, INT16 sMapY, INT16& sWorldY ) +{ + sWorldY = GetMapXYWorldY( sMapX, sMapY ); + + return __max( ( (sWorldY - 80 ) *Z_SUBLAYERS )+SHADOW_Z_LEVEL, 0 ); } -#define ShadowZLevel( sMapX, sMapY )\ -{\ -\ - GetMapXYWorldY( sMapX, sMapY, sWorldY );\ -\ - sZLevel=__max( ( (sWorldY - 80 ) *Z_SUBLAYERS )+SHADOW_Z_LEVEL, 0 );\ -\ -} - -#define SoldierZLevel( pSoldier, sMapX, sMapY )\ -{\ -\ - if ( ( pSoldier->uiStatusFlags & SOLDIER_MULTITILE ) )\ - {\ -\ - if ( pNode->pStructureData != NULL )\ - {\ - sZOffsetX = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetX;\ - sZOffsetY = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetY;\ - }\ -\ - GetMapXYWorldY( (sMapX + sZOffsetX), (sMapY + sZOffsetY), sWorldY );\ -\ - }\ - else\ - {\ - GetMapXYWorldY( sMapX, sMapY, sWorldY );\ - }\ -\ - if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE )\ - {\ - sZLevel=(sWorldY*Z_SUBLAYERS)+STRUCT_Z_LEVEL;\ - }\ - else\ - {\ - if ( pSoldier->dHeightAdjustment > 0 )\ - {\ - sWorldY += ( WALL_HEIGHT + 20 );\ -\ - sZLevel=(sWorldY*Z_SUBLAYERS)+ONROOF_Z_LEVEL;\ - }\ - else\ - {\ - if ( ( pSoldier->uiStatusFlags & SOLDIER_DEAD ) )\ - {\ - sZLevel=(sWorldY*Z_SUBLAYERS)+MERC_Z_LEVEL;\ - }\ - else\ - {\ - sZLevel=(sWorldY*Z_SUBLAYERS)+MERC_Z_LEVEL;\ - }\ - }\ - \ - if ( pSoldier->sZLevelOverride != -1 )\ - {\ - sZLevel = pSoldier->sZLevelOverride;\ - }\ - \ - if ( gsForceSoldierZLevel != 0 )\ - {\ - sZLevel = gsForceSoldierZLevel;\ - }\ - }\ -\ -} //#if 0 diff --git a/TileEngine/Render Z.h b/TileEngine/Render Z.h new file mode 100644 index 00000000..92160d09 --- /dev/null +++ b/TileEngine/Render Z.h @@ -0,0 +1,151 @@ +#include "worlddef.h" +#include "renderworld.h" +#include "Isometric Utils.h" + + +INT16 ObjectZLevel( TILE_ELEMENT* TileElem, LEVELNODE* pNode, UINT32 uiTileElemFlags, INT32 sMapX, INT32 sMapY, INT16& sWorldY ); +INT16 GetMapXYWorldY( INT16 sWorldCellX, INT16 sWorldCellY ); +INT16 GetMapXYWorldYFromCellCoords( INT16 sWorldCellX, INT16 sWorldCellY ); +INT16 LandZLevel( INT16 sMapX, INT16 sMapY ); +INT16 RoofZLevel( INT16 sMapX, INT16 sMapY, INT16& sWorldY ); +INT16 OnRoofZLevel( INT16 sMapX, INT16 sMapY, INT16& sWorldY, UINT32 uiLevelNodeFlags ); +INT16 TopmostZLevel( INT16 sMapX, INT16 sMapY, INT16& sWorldY ); +INT16 ShadowZLevel( INT16 sMapX, INT16 sMapY, INT16& sWorldY ); + + + +#define StructZLevel( sMapX, sMapY )\ +{\ +\ + sWorldY = GetMapXYWorldY( sMapX, sMapY );\ +\ + if ( ( uiLevelNodeFlags & LEVELNODE_ROTTINGCORPSE ) )\ + {\ + if ( pCorpse->def.usFlags & ROTTING_CORPSE_VEHICLE )\ + {\ +\ + if ( pNode->pStructureData != NULL )\ + {\ + sZOffsetX = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetX;\ + sZOffsetY = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetY;\ + }\ + \ + sWorldY = GetMapXYWorldY( (sMapX + sZOffsetX), (sMapY + sZOffsetY) );\ + \ + sWorldY = GetMapXYWorldY( (sMapX + sZOffsetX), (sMapY + sZOffsetY) );\ + \ + sZLevel=( ( sWorldY ) * Z_SUBLAYERS)+STRUCT_Z_LEVEL;\ + \ + }\ + else\ + {\ + sZOffsetX = -1;\ + sZOffsetY = -1;\ + sWorldY = GetMapXYWorldY( (sMapX + sZOffsetX), (sMapY + sZOffsetY) );\ + \ + sWorldY += 20;\ +\ + sZLevel=( ( sWorldY ) * Z_SUBLAYERS)+LAND_Z_LEVEL;\ + }\ + }\ + else if ( uiLevelNodeFlags & LEVELNODE_PHYSICSOBJECT )\ + {\ + sWorldY += pNode->sRelativeZ;\ + \ + sZLevel=(sWorldY*Z_SUBLAYERS)+ONROOF_Z_LEVEL;\ +\ + }\ + else if ( uiLevelNodeFlags & LEVELNODE_ITEM )\ + {\ + if ( pNode->pItemPool->bRenderZHeightAboveLevel > 0 )\ + {\ + sZLevel=(sWorldY*Z_SUBLAYERS)+STRUCT_Z_LEVEL;\ + sZLevel+=( pNode->pItemPool->bRenderZHeightAboveLevel );\ + }\ + else\ + {\ + sZLevel=(sWorldY*Z_SUBLAYERS)+OBJECT_Z_LEVEL;\ + }\ + }\ + else if ( uiAniTileFlags & ANITILE_SMOKE_EFFECT )\ + {\ + sZLevel=(sWorldY*Z_SUBLAYERS)+OBJECT_Z_LEVEL;\ + }\ + else if ( ( uiLevelNodeFlags & LEVELNODE_USEZ ) )\ + {\ +\ + if ( ( uiLevelNodeFlags & LEVELNODE_NOZBLITTER ) )\ + {\ + sWorldY += 40;\ + }\ + else\ + {\ + sWorldY += pNode->sRelativeZ;\ + }\ +\ + sZLevel=(sWorldY*Z_SUBLAYERS)+ONROOF_Z_LEVEL;\ + }\ + else\ + {\ + sZLevel=(sWorldY*Z_SUBLAYERS)+STRUCT_Z_LEVEL;\ + }\ +\ +} + + +#define SoldierZLevel( pSoldier, sMapX, sMapY )\ +{\ +\ + if ( ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE ) )\ + {\ +\ + if ( pNode->pStructureData != NULL )\ + {\ + sZOffsetX = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetX;\ + sZOffsetY = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetY;\ + }\ +\ + sWorldY = GetMapXYWorldY( (sMapX + sZOffsetX), (sMapY + sZOffsetY) );\ +\ + }\ + else\ + {\ + sWorldY = GetMapXYWorldY( sMapX, sMapY );\ + }\ +\ + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE )\ + {\ + sZLevel=(sWorldY*Z_SUBLAYERS)+STRUCT_Z_LEVEL;\ + }\ + else\ + {\ + if ( pSoldier->aiData.dHeightAdjustment > 0 )\ + {\ + sWorldY += ( WALL_HEIGHT + 20 );\ +\ + sZLevel=(sWorldY*Z_SUBLAYERS)+ONROOF_Z_LEVEL;\ + }\ + else\ + {\ + if ( ( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) )\ + {\ + sZLevel=(sWorldY*Z_SUBLAYERS)+MERC_Z_LEVEL;\ + }\ + else\ + {\ + sZLevel=(sWorldY*Z_SUBLAYERS)+MERC_Z_LEVEL;\ + }\ + }\ + \ + if ( pSoldier->sZLevelOverride != -1 )\ + {\ + sZLevel = pSoldier->sZLevelOverride;\ + }\ + \ + if ( gsForceSoldierZLevel != 0 )\ + {\ + sZLevel = gsForceSoldierZLevel;\ + }\ + }\ +\ +} diff --git a/TileEngine/SaveLoadMap.cpp b/TileEngine/SaveLoadMap.cpp index 66d5ef99..42204503 100644 --- a/TileEngine/SaveLoadMap.cpp +++ b/TileEngine/SaveLoadMap.cpp @@ -26,7 +26,7 @@ extern BOOLEAN gfLoadingExitGrids; BOOLEAN gfApplyChangesToTempFile = FALSE; -// There are 3200 bytes, and each bit represents the revelaed status. +// There are 3200 bytes, and each bit represents the revelaed status. // 3200 bytes * 8 bits = 25600 map elements UINT8 *gpRevealedMap; @@ -36,7 +36,7 @@ UINT8 *gpRevealedMap; void RemoveSavedStructFromMap( UINT32 uiMapIndex, UINT16 usIndex ); void AddObjectFromMapTempFileToMap( UINT32 uiMapIndex, UINT16 usIndex ); void AddBloodOrSmellFromMapTempFileToMap( MODIFY_MAP *pMap ); -void SetSectorsRevealedBit( UINT16 usMapIndex ); +void SetSectorsRevealedBit( INT16 sMapIndex ); void SetMapRevealedStatus(); void DamageStructsFromMapTempFile( MODIFY_MAP * pMap ); BOOLEAN ModifyWindowStatus( UINT32 uiMapIndex ); @@ -174,7 +174,7 @@ BOOLEAN LoadAllMapChangesFromMapTempFileAndApplyThem( ) case SLM_OBJECT: GetTileIndexFromTypeSubIndex( pMap->usImageType, pMap->usSubImageIndex, &usIndex ); - AddObjectFromMapTempFileToMap( pMap->usGridNo, usIndex ); + AddObjectFromMapTempFileToMap( pMap->sGridNo, usIndex ); // Save this struct back to the temp file SaveModifiedMapStructToMapTempFile( pMap, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); @@ -186,7 +186,7 @@ BOOLEAN LoadAllMapChangesFromMapTempFileAndApplyThem( ) case SLM_STRUCT: GetTileIndexFromTypeSubIndex( pMap->usImageType, pMap->usSubImageIndex, &usIndex ); - AddStructFromMapTempFileToMap( pMap->usGridNo, usIndex ); + AddStructFromMapTempFileToMap( pMap->sGridNo, usIndex ); // Save this struct back to the temp file SaveModifiedMapStructToMapTempFile( pMap, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); @@ -219,12 +219,12 @@ BOOLEAN LoadAllMapChangesFromMapTempFileAndApplyThem( ) if ( pMap->usImageType >= FIRSTDOOR && pMap->usImageType <= FOURTHDOOR ) { // Remove ANY door... - RemoveAllStructsOfTypeRange( pMap->usGridNo, FIRSTDOOR, FOURTHDOOR ); + RemoveAllStructsOfTypeRange( pMap->sGridNo, FIRSTDOOR, FOURTHDOOR ); } else { GetTileIndexFromTypeSubIndex( pMap->usImageType, pMap->usSubImageIndex, &usIndex ); - RemoveSavedStructFromMap( pMap->usGridNo, usIndex ); + RemoveSavedStructFromMap( pMap->sGridNo, usIndex ); } // Save this struct back to the temp file @@ -257,12 +257,12 @@ BOOLEAN LoadAllMapChangesFromMapTempFileAndApplyThem( ) { EXITGRID ExitGrid; gfLoadingExitGrids = TRUE; - ExitGrid.usGridNo = pMap->usSubImageIndex; + ExitGrid.sGridNo = pMap->usSubImageIndex; ExitGrid.ubGotoSectorX = (UINT8) pMap->usImageType; ExitGrid.ubGotoSectorY = (UINT8) ( pMap->usImageType >> 8 ) ; ExitGrid.ubGotoSectorZ = pMap->ubExtra; - AddExitGridToWorld( pMap->usGridNo, &ExitGrid ); + AddExitGridToWorld( pMap->sGridNo, &ExitGrid ); gfLoadingExitGrids = FALSE; // Save this struct back to the temp file @@ -274,11 +274,11 @@ BOOLEAN LoadAllMapChangesFromMapTempFileAndApplyThem( ) break; case SLM_OPENABLE_STRUCT: - SetOpenableStructStatusFromMapTempFile( pMap->usGridNo, (BOOLEAN)pMap->usImageType ); + SetOpenableStructStatusFromMapTempFile( pMap->sGridNo, (BOOLEAN)pMap->usImageType ); break; case SLM_WINDOW_HIT: - if ( ModifyWindowStatus( pMap->usGridNo ) ) + if ( ModifyWindowStatus( pMap->sGridNo ) ) { // Save this struct back to the temp file SaveModifiedMapStructToMapTempFile( pMap, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); @@ -289,7 +289,7 @@ BOOLEAN LoadAllMapChangesFromMapTempFileAndApplyThem( ) break; default: - AssertMsg( 0, "ERROR! Map Type not in switch when loading map changes from temp file"); + AssertMsg( 0, "ERROR! Map Type not in switch when loading map changes from temp file"); break; } @@ -306,7 +306,7 @@ BOOLEAN LoadAllMapChangesFromMapTempFileAndApplyThem( ) //Free the memory used for the temp array MemFree( pTempArrayOfMaps ); pTempArrayOfMaps = NULL; - + return( TRUE ); } @@ -335,7 +335,7 @@ void AddStructToMapTempFile( UINT32 uiMapIndex, UINT16 usIndex ) memset( &Map, 0, sizeof( MODIFY_MAP ) ); - Map.usGridNo = (UINT16)uiMapIndex; + Map.sGridNo = (INT16)uiMapIndex; // Map.usIndex = usIndex; Map.usImageType = (UINT16)uiType; Map.usSubImageIndex = usSubIndex; @@ -369,7 +369,7 @@ void AddObjectToMapTempFile( UINT32 uiMapIndex, UINT16 usIndex ) memset( &Map, 0, sizeof( MODIFY_MAP ) ); - Map.usGridNo = (UINT16)uiMapIndex; + Map.sGridNo = (INT16)uiMapIndex; // Map.usIndex = usIndex; Map.usImageType = (UINT16)uiType; Map.usSubImageIndex = usSubIndex; @@ -402,7 +402,7 @@ void AddRemoveObjectToMapTempFile( UINT32 uiMapIndex, UINT16 usIndex ) memset( &Map, 0, sizeof( MODIFY_MAP ) ); - Map.usGridNo = (UINT16)uiMapIndex; + Map.sGridNo = (INT16)uiMapIndex; // Map.usIndex = usIndex; Map.usImageType = (UINT16)uiType; Map.usSubImageIndex = usSubIndex; @@ -430,7 +430,7 @@ void RemoveStructFromMapTempFile( UINT32 uiMapIndex, UINT16 usIndex ) memset( &Map, 0, sizeof( MODIFY_MAP ) ); - Map.usGridNo = (UINT16)uiMapIndex; + Map.sGridNo = (INT16)uiMapIndex; // Map.usIndex = usIndex; Map.usImageType = (UINT16)uiType; Map.usSubImageIndex = usSubIndex; @@ -472,7 +472,7 @@ void SaveBloodSmellAndRevealedStatesFromMapToTempFile() // Save the BloodInfo in the bottom byte and the smell info in the upper byte - Map.usGridNo = cnt; + Map.sGridNo = (INT16)cnt; // Map.usIndex = gpWorldLevelData[cnt].ubBloodInfo | ( gpWorldLevelData[cnt].ubSmellInfo << 8 ); Map.usImageType = gpWorldLevelData[cnt].ubBloodInfo; Map.usSubImageIndex = gpWorldLevelData[cnt].ubSmellInfo; @@ -496,7 +496,7 @@ void SaveBloodSmellAndRevealedStatesFromMapToTempFile() { STRUCTURE * pCurrent; - pCurrent = gpWorldLevelData[cnt].pStructureHead; + pCurrent = gpWorldLevelData[cnt].pStructureHead; pCurrent = FindStructure( cnt, STRUCTURE_BASE_TILE ); @@ -515,7 +515,7 @@ void SaveBloodSmellAndRevealedStatesFromMapToTempFile() memset( &Map, 0, sizeof( MODIFY_MAP ) ); // Save the Damaged value - Map.usGridNo = cnt; + Map.sGridNo = (INT16)cnt; // Map.usIndex = StructureFlagToType( pCurrent->fFlags ) | ( pCurrent->ubHitPoints << 8 ); Map.usImageType = StructureFlagToType( pCurrent->fFlags ); Map.usSubImageIndex = pCurrent->ubHitPoints; @@ -554,19 +554,19 @@ void SaveBloodSmellAndRevealedStatesFromMapToTempFile() // The BloodInfo is saved in the bottom byte and the smell info in the upper byte void AddBloodOrSmellFromMapTempFileToMap( MODIFY_MAP *pMap ) { - gpWorldLevelData[ pMap->usGridNo ].ubBloodInfo = (UINT8)pMap->usImageType; + gpWorldLevelData[ pMap->sGridNo ].ubBloodInfo = (UINT8)pMap->usImageType; //if the blood and gore option IS set, add blood if( gGameSettings.fOptions[ TOPTION_BLOOD_N_GORE ] ) { // Update graphics for both levels... - gpWorldLevelData[ pMap->usGridNo ].uiFlags |= MAPELEMENT_REEVALUATEBLOOD; - UpdateBloodGraphics( pMap->usGridNo, 0 ); - gpWorldLevelData[ pMap->usGridNo ].uiFlags |= MAPELEMENT_REEVALUATEBLOOD; - UpdateBloodGraphics( pMap->usGridNo, 1 ); + gpWorldLevelData[ pMap->sGridNo ].uiFlags |= MAPELEMENT_REEVALUATEBLOOD; + UpdateBloodGraphics( pMap->sGridNo, 0 ); + gpWorldLevelData[ pMap->sGridNo ].uiFlags |= MAPELEMENT_REEVALUATEBLOOD; + UpdateBloodGraphics( pMap->sGridNo, 1 ); } - gpWorldLevelData[ pMap->usGridNo ].ubSmellInfo = (UINT8)pMap->usSubImageIndex; + gpWorldLevelData[ pMap->sGridNo ].ubSmellInfo = (UINT8)pMap->usSubImageIndex; } @@ -671,7 +671,7 @@ BOOLEAN LoadRevealedStatusArrayFromRevealedTempFile() //Loop through and set the bits in the map that are revealed SetMapRevealedStatus(); - + MemFree( gpRevealedMap ); gpRevealedMap = NULL; @@ -680,13 +680,13 @@ BOOLEAN LoadRevealedStatusArrayFromRevealedTempFile() return( TRUE ); } -void SetSectorsRevealedBit( UINT16 usMapIndex ) +void SetSectorsRevealedBit( INT16 sMapIndex ) { UINT16 usByteNumber; UINT8 ubBitNumber; - usByteNumber = usMapIndex / 8; - ubBitNumber = usMapIndex % 8; + usByteNumber = sMapIndex / 8; + ubBitNumber = sMapIndex % 8; gpRevealedMap[ usByteNumber ] |= 1 << ubBitNumber; } @@ -697,10 +697,10 @@ void SetMapRevealedStatus() { UINT16 usByteCnt; UINT8 ubBitCnt; - UINT16 usMapIndex; + INT16 sMapIndex; if( gpRevealedMap == NULL ) - AssertMsg( 0, "gpRevealedMap is NULL. DF 1" ); + AssertMsg( 0, "gpRevealedMap is NULL. DF 1" ); ClearSlantRoofs( ); @@ -711,16 +711,16 @@ void SetMapRevealedStatus() //loop through all the bits in the byte for( ubBitCnt=0; ubBitCnt<8; ubBitCnt++) { - usMapIndex = ( usByteCnt * 8 ) + ubBitCnt; + sMapIndex = ( usByteCnt * 8 ) + ubBitCnt; if( gpRevealedMap[ usByteCnt ] & ( 1 << ubBitCnt ) ) { - gpWorldLevelData[ usMapIndex ].uiFlags |= MAPELEMENT_REVEALED; - SetGridNoRevealedFlag( usMapIndex ); + gpWorldLevelData[ sMapIndex ].uiFlags |= MAPELEMENT_REVEALED; + SetGridNoRevealedFlag( sMapIndex ); } else { - gpWorldLevelData[ usMapIndex ].uiFlags &= (~MAPELEMENT_REVEALED ); + gpWorldLevelData[ sMapIndex ].uiFlags &= (~MAPELEMENT_REVEALED ); } } } @@ -738,12 +738,11 @@ void DamageStructsFromMapTempFile( MODIFY_MAP * pMap ) INT8 bLevel; UINT8 ubWallOrientation; UINT8 ubBitToSet = 0x80; - UINT8 ubHitPoints=0; UINT8 ubType=0; //Find the base structure - pCurrent = FindStructure( (INT16)pMap->usGridNo, STRUCTURE_BASE_TILE ); + pCurrent = FindStructure( (INT16)pMap->sGridNo, STRUCTURE_BASE_TILE ); if( pCurrent == NULL ) return; @@ -754,7 +753,7 @@ void DamageStructsFromMapTempFile( MODIFY_MAP * pMap ) //Check to see if the desired strucure node is in this tile - pCurrent = FindStructureBySavedInfo( pMap->usGridNo, ubType, ubWallOrientation, bLevel ); + pCurrent = FindStructureBySavedInfo( pMap->sGridNo, ubType, ubWallOrientation, bLevel ); if( pCurrent != NULL ) { @@ -769,7 +768,7 @@ void DamageStructsFromMapTempFile( MODIFY_MAP * pMap ) ////////////// -void AddStructToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ) +void AddStructToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ) { MODIFY_MAP Map; UINT32 uiType; @@ -783,7 +782,7 @@ void AddStructToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sS memset( &Map, 0, sizeof( MODIFY_MAP ) ); - Map.usGridNo = (UINT16)uiMapIndex; + Map.sGridNo = (INT16)uiMapIndex; // Map.usIndex = usIndex; Map.usImageType = (UINT16)uiType; Map.usSubImageIndex = usSubIndex; @@ -794,7 +793,7 @@ void AddStructToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sS SaveModifiedMapStructToMapTempFile( &Map, sSectorX, sSectorY, ubSectorZ ); } -void AddObjectToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ) +void AddObjectToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ) { MODIFY_MAP Map; UINT32 uiType; @@ -808,7 +807,7 @@ void AddObjectToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sS memset( &Map, 0, sizeof( MODIFY_MAP ) ); - Map.usGridNo = (UINT16)uiMapIndex; + Map.sGridNo = (INT16)uiMapIndex; // Map.usIndex = usIndex; Map.usImageType = (UINT16)uiType; Map.usSubImageIndex = usSubIndex; @@ -819,7 +818,7 @@ void AddObjectToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sS } -void RemoveStructFromUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ) +void RemoveStructFromUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ) { MODIFY_MAP Map; UINT32 uiType; @@ -833,7 +832,7 @@ void RemoveStructFromUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT memset( &Map, 0, sizeof( MODIFY_MAP ) ); - Map.usGridNo = (UINT16)uiMapIndex; + Map.sGridNo = (INT16)uiMapIndex; // Map.usIndex = usIndex; Map.usImageType = (UINT16)uiType; Map.usSubImageIndex = usSubIndex; @@ -844,7 +843,7 @@ void RemoveStructFromUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT } -void AddRemoveObjectToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ) +void AddRemoveObjectToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ) { MODIFY_MAP Map; UINT32 uiType; @@ -858,7 +857,7 @@ void AddRemoveObjectToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, IN memset( &Map, 0, sizeof( MODIFY_MAP ) ); - Map.usGridNo = (UINT16)uiMapIndex; + Map.sGridNo = (INT16)uiMapIndex; // Map.usIndex = usIndex; Map.usImageType = (UINT16)uiType; Map.usSubImageIndex = usSubIndex; @@ -869,7 +868,7 @@ void AddRemoveObjectToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, IN } -void AddExitGridToMapTempFile( UINT16 usGridNo, EXITGRID *pExitGrid, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ) +void AddExitGridToMapTempFile( INT16 sGridNo, EXITGRID *pExitGrid, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ) { MODIFY_MAP Map; @@ -884,11 +883,11 @@ void AddExitGridToMapTempFile( UINT16 usGridNo, EXITGRID *pExitGrid, INT16 sSect memset( &Map, 0, sizeof( MODIFY_MAP ) ); - Map.usGridNo = usGridNo; + Map.sGridNo = sGridNo; // Map.usIndex = pExitGrid->ubGotoSectorX; Map.usImageType = pExitGrid->ubGotoSectorX | ( pExitGrid->ubGotoSectorY << 8 ); - Map.usSubImageIndex = pExitGrid->usGridNo; + Map.usSubImageIndex = pExitGrid->sGridNo; Map.ubExtra = pExitGrid->ubGotoSectorZ; Map.ubType = SLM_EXIT_GRIDS; @@ -922,7 +921,7 @@ BOOLEAN RemoveGraphicFromTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSec //Check to see if the file exists if( !FileExists( zMapName ) ) { - //If the file doesnt exists, + //If the file doesnt exists, return( FALSE ); } @@ -972,7 +971,7 @@ BOOLEAN RemoveGraphicFromTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSec pMap = &pTempArrayOfMaps[ cnt ]; //if this is the peice we are looking for - if( pMap->usGridNo == uiMapIndex && pMap->usImageType == uiType && pMap->usSubImageIndex == usSubIndex ) + if( pMap->sGridNo == uiMapIndex && pMap->usImageType == uiType && pMap->usSubImageIndex == usSubIndex ) { //Do nothin fRetVal = TRUE; @@ -995,7 +994,7 @@ void AddOpenableStructStatusToMapTempFile( UINT32 uiMapIndex, BOOLEAN fOpened ) memset( &Map, 0, sizeof( MODIFY_MAP ) ); - Map.usGridNo = (UINT16)uiMapIndex; + Map.sGridNo = (INT16)uiMapIndex; Map.usImageType = fOpened; Map.ubType = SLM_OPENABLE_STRUCT; @@ -1009,7 +1008,7 @@ void AddWindowHitToMapTempFile( UINT32 uiMapIndex ) memset( &Map, 0, sizeof( MODIFY_MAP ) ); - Map.usGridNo = (UINT16)uiMapIndex; + Map.sGridNo = (INT16)uiMapIndex; Map.ubType = SLM_WINDOW_HIT; SaveModifiedMapStructToMapTempFile( &Map, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); @@ -1022,7 +1021,7 @@ BOOLEAN ModifyWindowStatus( UINT32 uiMapIndex ) pStructure = FindStructure( (INT16) uiMapIndex, STRUCTURE_WALLNWINDOW ); if (pStructure) { - SwapStructureForPartner( (INT16) uiMapIndex, pStructure ); + SwapStructureForPartner( (INT16) uiMapIndex, pStructure ); return( TRUE ); } // else forget it, window could be destroyed @@ -1035,13 +1034,13 @@ void SetOpenableStructStatusFromMapTempFile( UINT32 uiMapIndex, BOOLEAN fOpened STRUCTURE * pBase; BOOLEAN fStatusOnTheMap; ITEM_POOL *pItemPool; - INT16 sBaseGridNo = (INT16)uiMapIndex; + INT16 sBaseGridNo = (INT16)uiMapIndex; - pStructure = FindStructure( (UINT16)uiMapIndex, STRUCTURE_OPENABLE ); + pStructure = FindStructure( (INT16)uiMapIndex, STRUCTURE_OPENABLE ); if( pStructure == NULL ) { -// ScreenMsg( FONT_MCOLOR_WHITE, MSG_BETAVERSION, L"SetOpenableStructStatusFromMapTempFile( %d, %d ) failed to find the openable struct. DF 1.", uiMapIndex, fOpened ); +// ScreenMsg( FONT_MCOLOR_WHITE, MSG_BETAVERSION, L"SetOpenableStructStatusFromMapTempFile( %d, %d ) failed to find the openable struct. DF 1.", uiMapIndex, fOpened ); return; } @@ -1051,33 +1050,33 @@ void SetOpenableStructStatusFromMapTempFile( UINT32 uiMapIndex, BOOLEAN fOpened { // Adjust the item's gridno to the base of struct..... pBase = FindBaseStructure( pStructure ); - - // Get LEVELNODE for struct and remove! - if ( pBase ) - { - sBaseGridNo = pBase->sGridNo; - } - if(SwapStructureForPartnerWithoutTriggeringSwitches( (UINT16)uiMapIndex, pStructure ) == NULL ) + // Get LEVELNODE for struct and remove! + if ( pBase ) + { + sBaseGridNo = pBase->sGridNo; + } + + if(SwapStructureForPartnerWithoutTriggeringSwitches( (INT16)uiMapIndex, pStructure ) == NULL ) { //an error occured } // Adjust visiblity of any item pools here.... - // ATE: Nasty bug here - use base gridno for structure for items! - // since items always drop to base gridno in AddItemToPool - if ( GetItemPool( sBaseGridNo, &pItemPool, 0 ) ) + // ATE: Nasty bug here - use base gridno for structure for items! + // since items always drop to base gridno in AddItemToPool + if ( GetItemPoolFromGround( sBaseGridNo, &pItemPool ) ) { if ( fOpened ) { - // We are open, make un-hidden if so.... - SetItemPoolVisibilityOn( pItemPool, ANY_VISIBILITY_VALUE, FALSE ); + // We are open, make un-hidden if so.... + SetItemPoolVisibilityOn( pItemPool, ANY_VISIBILITY_VALUE, FALSE ); } else { - // Make sure items are hidden... - SetItemPoolVisibilityHidden( pItemPool ); + // Make sure items are hidden... + SetItemPoolVisibilityHidden( pItemPool ); } } @@ -1088,7 +1087,7 @@ void SetOpenableStructStatusFromMapTempFile( UINT32 uiMapIndex, BOOLEAN fOpened -BOOLEAN ChangeStatusOfOpenableStructInUnloadedSector( UINT16 usSectorX, UINT16 usSectorY, INT8 bSectorZ, UINT16 usGridNo, BOOLEAN fChangeToOpen ) +BOOLEAN ChangeStatusOfOpenableStructInUnloadedSector( UINT16 usSectorX, UINT16 usSectorY, INT8 bSectorZ, INT16 sGridNo, BOOLEAN fChangeToOpen ) { // STRUCTURE * pStructure; // MODIFY_MAP Map; @@ -1098,7 +1097,6 @@ BOOLEAN ChangeStatusOfOpenableStructInUnloadedSector( UINT16 usSectorX, UINT16 u UINT32 uiNumBytesWritten; UINT32 uiFileSize; UINT32 uiNumberOfElements; - UINT32 uiNumberOfElementsSavedBackToFile = 0; // added becuase if no files get saved back to disk, the flag needs to be erased UINT32 cnt; MODIFY_MAP *pMap; MODIFY_MAP *pTempArrayOfMaps=NULL; @@ -1157,7 +1155,7 @@ BOOLEAN ChangeStatusOfOpenableStructInUnloadedSector( UINT16 usSectorX, UINT16 u uiNumberOfElements = uiFileSize / sizeof( MODIFY_MAP ); - //loop through all the array elements to + //loop through all the array elements to for( cnt=0; cnt< uiNumberOfElements; cnt++ ) { pMap = &pTempArrayOfMaps[ cnt ]; @@ -1166,7 +1164,7 @@ BOOLEAN ChangeStatusOfOpenableStructInUnloadedSector( UINT16 usSectorX, UINT16 u if( pMap->ubType == SLM_OPENABLE_STRUCT ) { //if its on the same gridno - if( pMap->usGridNo == usGridNo ) + if( pMap->sGridNo == sGridNo ) { //Change to the desired settings pMap->usImageType = fChangeToOpen; @@ -1201,3 +1199,4 @@ BOOLEAN ChangeStatusOfOpenableStructInUnloadedSector( UINT16 usSectorX, UINT16 u return( TRUE ); } + diff --git a/TileEngine/SaveLoadMap.h b/TileEngine/SaveLoadMap.h index 8d4bbead..f2aeba69 100644 --- a/TileEngine/SaveLoadMap.h +++ b/TileEngine/SaveLoadMap.h @@ -4,7 +4,7 @@ #include "WorldDef.h" #include "Exit Grids.h" -//Used for the ubType in the MODIFY_MAP struct +//Used for the ubType in the MODIFY_MAP struct enum { SLM_NONE, @@ -47,7 +47,7 @@ enum typedef struct { - UINT16 usGridNo; //The gridno the graphic will be applied to + UINT16 sGridNo; //The gridno the graphic will be applied to UINT16 usImageType; //graphic index UINT16 usSubImageIndex; // // UINT16 usIndex; @@ -57,7 +57,7 @@ typedef struct } MODIFY_MAP; -// Call this function, to set whether the map changes will be added to the map temp file +// Call this function, to set whether the map changes will be added to the map temp file void ApplyMapChangesToMapTempFile( BOOLEAN fAddToMap ); BOOLEAN SaveModifiedMapStructToMapTempFile( MODIFY_MAP *pMap, INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ); @@ -91,13 +91,13 @@ BOOLEAN SaveRevealedStatusArrayToRevealedTempFile( INT16 sSectorX, INT16 sSector BOOLEAN LoadRevealedStatusArrayFromRevealedTempFile(); -void AddRemoveObjectToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ); -void RemoveStructFromUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ); -void AddObjectToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ); -void AddStructToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ); +void AddRemoveObjectToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ); +void RemoveStructFromUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ); +void AddObjectToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ); +void AddStructToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ); //Adds the exit grid to -void AddExitGridToMapTempFile( UINT16 usGridNo, EXITGRID *pExitGrid, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ); +void AddExitGridToMapTempFile( INT16 sGridNo, EXITGRID *pExitGrid, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ ); //This function removes a struct with the same MapIndex and graphic index from the given sectors temp file @@ -109,7 +109,7 @@ void AddOpenableStructStatusToMapTempFile( UINT32 uiMapIndex, BOOLEAN fOpened ); void AddWindowHitToMapTempFile( UINT32 uiMapIndex ); -BOOLEAN ChangeStatusOfOpenableStructInUnloadedSector( UINT16 usSectorX, UINT16 usSectorY, INT8 bSectorZ, UINT16 usGridNo, BOOLEAN fChangeToOpen ); +BOOLEAN ChangeStatusOfOpenableStructInUnloadedSector( UINT16 usSectorX, UINT16 usSectorY, INT8 bSectorZ, INT16 sGridNo, BOOLEAN fChangeToOpen ); #endif diff --git a/TileEngine/Shade Table Util.cpp b/TileEngine/Shade Table Util.cpp index a2f05b02..7154cad5 100644 --- a/TileEngine/Shade Table Util.cpp +++ b/TileEngine/Shade Table Util.cpp @@ -42,14 +42,14 @@ void DetermineRGBDistributionSettings() // Snap: save current directory GetFileManCurrentDirectory( DataDir ); - //First, determine if we have a file saved. If not, then this is the first time, and - //all shade tables will have to be built and saved to disk. This can be time consuming, adding up to + //First, determine if we have a file saved. If not, then this is the first time, and + //all shade tables will have to be built and saved to disk. This can be time consuming, adding up to //3-4 seconds to the time of a map load. GetExecutableDirectory( ExecDir ); sprintf( ShadeTableDir, "%s\\%s", DataDir, SHADE_TABLE_DIR ); - - //Check to make sure we have a ShadeTable directory. If we don't create one! + + //Check to make sure we have a ShadeTable directory. If we don't create one! if( !SetFileManCurrentDirectory( ShadeTableDir ) ) { if( !MakeFileManDirectory( ShadeTableDir ) ) @@ -62,12 +62,12 @@ void DetermineRGBDistributionSettings() } fSaveRGBDist = TRUE; } - + if( !fSaveRGBDist ) { //Load the previous RGBDist and determine if it is the same one if( !FileExists( "RGBDist.dat" ) || FileExists( "ResetShadeTables.txt" ) ) - { //Can't find the RGBDist.dat file. The directory exists, but the file doesn't, which - //means the user deleted the file manually. Now, set it up to create a new one. + { //Can't find the RGBDist.dat file. The directory exists, but the file doesn't, which + //means the user deleted the file manually. Now, set it up to create a new one. fSaveRGBDist = TRUE; fCleanShadeTable = TRUE; } @@ -93,24 +93,24 @@ void DetermineRGBDistributionSettings() if( fLoadedPrevRGBDist ) { if( uiRBitMask != uiPrevRBitMask || uiGBitMask != uiPrevGBitMask || uiBBitMask != uiPrevBBitMask ) - { //The user has changed modes since the last time he has played JA2. This essentially can only happen if: - //1) The video card has been changed since the last run of JA2. - //2) Certain video cards have different RGB distributions in different operating systems such as + { //The user has changed modes since the last time he has played JA2. This essentially can only happen if: + //1) The video card has been changed since the last run of JA2. + //2) Certain video cards have different RGB distributions in different operating systems such as // the Millenium card using Windows NT or Windows 95 - //3) The user has physically modified the RGBDist.dat file. + //3) The user has physically modified the RGBDist.dat file. fSaveRGBDist = TRUE; fCleanShadeTable = TRUE; } } if( fCleanShadeTable ) { //This means that we are going to remove all of the current shade tables, if any exist, and - //start fresh. + //start fresh. EraseDirectory( ShadeTableDir ); } if( fSaveRGBDist ) - { //The RGB distribution is going to be saved in a tiny file for future reference. As long as the + { //The RGB distribution is going to be saved in a tiny file for future reference. As long as the //RGB distribution never changes, the shade table will grow until eventually, all tilesets are loaded, - //shadetables generated and saved in this directory. + //shadetables generated and saved in this directory. hfile = FileOpen( "RGBDist.dat", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if( !hfile ) { @@ -138,8 +138,8 @@ BOOLEAN LoadShadeTable( HVOBJECT pObj, UINT32 uiTileTypeIndex ) CHAR8 *ptr; //ASSUMPTIONS: //We are assuming that the uiTileTypeIndex is referring to the correct file - //stored in the TileSurfaceFilenames[]. If it isn't, then that is a huge problem - //and should be fixed. Also assumes that the directory is set to Data\ShadeTables. + //stored in the TileSurfaceFilenames[]. If it isn't, then that is a huge problem + //and should be fixed. Also assumes that the directory is set to Data\ShadeTables. strcpy( ShadeFileName, TileSurfaceFilenames[ uiTileTypeIndex ] ); ptr = strstr( ShadeFileName, "." ); if( !ptr ) @@ -156,7 +156,7 @@ BOOLEAN LoadShadeTable( HVOBJECT pObj, UINT32 uiTileTypeIndex ) return FALSE; } - //MISSING: Compare time stamps. + //MISSING: Compare time stamps. for( i = 0; i < 16; i++ ) { @@ -165,7 +165,7 @@ BOOLEAN LoadShadeTable( HVOBJECT pObj, UINT32 uiTileTypeIndex ) FileRead( hfile, pObj->pShades[ i ], 512, &uiNumBytesRead ); } - //The file exists, now make sure the + //The file exists, now make sure the FileClose( hfile ); #ifdef JA2TESTVERSION uiNumTablesLoaded++; @@ -185,8 +185,8 @@ BOOLEAN SaveShadeTable( HVOBJECT pObj, UINT32 uiTileTypeIndex ) #endif //ASSUMPTIONS: //We are assuming that the uiTileTypeIndex is referring to the correct file - //stored in the TileSurfaceFilenames[]. If it isn't, then that is a huge problem - //and should be fixed. Also assumes that the directory is set to Data\ShadeTables. + //stored in the TileSurfaceFilenames[]. If it isn't, then that is a huge problem + //and should be fixed. Also assumes that the directory is set to Data\ShadeTables. strcpy( ShadeFileName, TileSurfaceFilenames[ uiTileTypeIndex ] ); ptr = strstr( ShadeFileName, "." ); if( !ptr ) @@ -198,7 +198,7 @@ BOOLEAN SaveShadeTable( HVOBJECT pObj, UINT32 uiTileTypeIndex ) hfile = FileOpen( ShadeFileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if( !hfile ) - { + { FileClose( hfile ); AssertMsg( 0, String( "Can't create %s", ShadeFileName ) ); return FALSE; @@ -215,6 +215,6 @@ BOOLEAN SaveShadeTable( HVOBJECT pObj, UINT32 uiTileTypeIndex ) BOOLEAN DeleteShadeTableDir( ) -{ +{ return( RemoveFileManDirectory( SHADE_TABLE_DIR, TRUE ) ); -} \ No newline at end of file +} diff --git a/TileEngine/Smell.cpp b/TileEngine/Smell.cpp index 1a3a76f0..403e6dd3 100644 --- a/TileEngine/Smell.cpp +++ b/TileEngine/Smell.cpp @@ -17,13 +17,13 @@ /* * Smell & Blood system - * - * Smell and blood trails decay as time passes. - * - * Decay Rate Maximum Strength Decay Time: Min Max (for biggest volume) * - * Smell 1 per turn 31 31 31 - * Blood 1 every 1-3 turns 7 7 21 + * Smell and blood trails decay as time passes. + * + * Decay Rate Maximum Strength Decay Time: Min Max (for biggest volume) + * + * Smell 1 per turn 31 31 31 + * Blood 1 every 1-3 turns 7 7 21 * * Smell has a much finer resolution so that creatures which track by smell * can do so effectively. @@ -33,23 +33,23 @@ * Time for some crazy-ass macros! * The smell byte is spit as follows: * O \ - * O \ - * O \ Smell - * O / Strength (only on ground) - * O / + * O \ + * O \ Smell + * O / Strength (only on ground) + * O / * O / - * O > Type of blood on roof - * O > Type of smell/blood on ground + * O > Type of blood on roof + * O > Type of smell/blood on ground * * The blood byte is split as follows: * O \ - * O > Blood quantity on roof + * O > Blood quantity on roof * O / - * O \ - * O > Blood quantity on ground + * O \ + * O > Blood quantity on ground * O / - * O \ Blood decay - * O / time (roof and ground decay together) + * O \ Blood decay + * O / time (roof and ground decay together) */ /* @@ -58,20 +58,20 @@ */ // LUT for which graphic to use based on strength -// 0 1, 2, 3, 4, 5, 6, 7 -UINT8 ubBloodGraphicLUT [ ] = { 3, 3, 2, 2, 1, 1, 0, 0 }; +// 0 1, 2, 3, 4, 5, 6, 7 +UINT8 ubBloodGraphicLUT [ ] = { 3, 3, 2, 2, 1, 1, 0, 0 }; #define SMELL_STRENGTH_MAX 63 #define BLOOD_STRENGTH_MAX 7 -#define BLOOD_DELAY_MAX 3 +#define BLOOD_DELAY_MAX 3 #define SMELL_TYPE_BITS( s ) (s & 0x03) -#define BLOOD_ROOF_TYPE( s ) (s & 0x02) +#define BLOOD_ROOF_TYPE( s ) (s & 0x02) #define BLOOD_FLOOR_TYPE( s ) (s & 0x01) -#define BLOOD_ROOF_STRENGTH( b ) (b & 0xE0) +#define BLOOD_ROOF_STRENGTH( b ) (b & 0xE0) #define BLOOD_FLOOR_STRENGTH( b ) ( (b & 0x1C) >> 2 ) #define BLOOD_DELAY_TIME( b ) (b & 0x03) #define NO_BLOOD_STRENGTH( b ) ((b & 0xFC) == 0) @@ -151,7 +151,7 @@ void RemoveBlood( INT16 sGridNo, INT8 bLevel ) void DecaySmells( void ) -{ +{ UINT32 uiLoop; MAP_ELEMENT * pMapElement; @@ -215,7 +215,7 @@ void DecayBlood() if (NO_BLOOD_STRENGTH( pMapElement->ubBloodInfo )) { // wipe the whole byte to zero - pMapElement->ubBloodInfo = 0; + pMapElement->ubBloodInfo = 0; } } } @@ -241,7 +241,7 @@ void DecayBloodAndSmells( UINT32 uiTime ) { return; } - + // period between checks, in game seconds switch( giTimeCompressMode ) { @@ -279,11 +279,11 @@ void DropSmell( SOLDIERTYPE * pSoldier ) UINT8 ubStrength; /* - * Here we are creating a new smell on the ground. If there is blood in - * the tile, it overrides dropping smells of any type - */ + * Here we are creating a new smell on the ground. If there is blood in + * the tile, it overrides dropping smells of any type + */ - if (pSoldier->bLevel == 0) + if (pSoldier->pathing.bLevel == 0) { pMapElement = &(gpWorldLevelData[pSoldier->sGridNo]); if (pMapElement->ubBloodInfo) @@ -292,14 +292,14 @@ void DropSmell( SOLDIERTYPE * pSoldier ) return; } - if (pSoldier->bNormalSmell > pSoldier->bMonsterSmell) + if (pSoldier->aiData.bNormalSmell > pSoldier->aiData.bMonsterSmell) { - ubStrength = pSoldier->bNormalSmell - pSoldier->bMonsterSmell; + ubStrength = pSoldier->aiData.bNormalSmell - pSoldier->aiData.bMonsterSmell; ubSmell = HUMAN; } else { - ubStrength = pSoldier->bMonsterSmell - pSoldier->bNormalSmell; + ubStrength = pSoldier->aiData.bMonsterSmell - pSoldier->aiData.bNormalSmell; if (ubStrength == 0) { // don't drop any smell @@ -360,11 +360,11 @@ void InternalDropBlood( INT16 sGridNo, INT8 bLevel, UINT8 ubType, UINT8 ubStreng UINT8 ubOldStrength=0; UINT8 ubNewStrength=0; UINT8 bOverTerrainType; - + /* - * Dropping some blood; - * We can check the type of blood by consulting the type in the smell byte - */ + * Dropping some blood; + * We can check the type of blood by consulting the type in the smell byte + */ bOverTerrainType = GetTerrainType( sGridNo); // If we are in water... @@ -396,7 +396,7 @@ void InternalDropBlood( INT16 sGridNo, INT8 bLevel, UINT8 ubType, UINT8 ubStreng if (BLOOD_FLOOR_TYPE( pMapElement->ubBloodInfo ) == ubType) { // combine blood strengths! - ubNewStrength = __min( ( ubOldStrength + ubStrength ), BLOOD_STRENGTH_MAX ); + ubNewStrength = __min( ( ubOldStrength + ubStrength ), BLOOD_STRENGTH_MAX ); SET_BLOOD_FLOOR_STRENGTH( pMapElement->ubBloodInfo, ubNewStrength ); } @@ -414,7 +414,7 @@ void InternalDropBlood( INT16 sGridNo, INT8 bLevel, UINT8 ubType, UINT8 ubStreng else { // no blood on the ground yet, so drop this amount! - // set decay time + // set decay time SET_BLOOD_DELAY_TIME( pMapElement->ubBloodInfo ); SET_BLOOD_FLOOR_STRENGTH( pMapElement->ubBloodInfo, ubStrength ); // NB blood floor type stored in smell byte! @@ -431,8 +431,8 @@ void InternalDropBlood( INT16 sGridNo, INT8 bLevel, UINT8 ubType, UINT8 ubStreng if (BLOOD_ROOF_TYPE( pMapElement->ubSmellInfo ) == ubType) { // combine blood strengths! - ubNewStrength = __max( ubOldStrength, ubStrength ) + 1; - // make sure the strength is legal + ubNewStrength = __max( ubOldStrength, ubStrength ) + 1; + // make sure the strength is legal ubNewStrength = __max( ubNewStrength, BLOOD_STRENGTH_MAX ); SET_BLOOD_ROOF_STRENGTH( pMapElement->ubBloodInfo, ubNewStrength ); } @@ -450,7 +450,7 @@ void InternalDropBlood( INT16 sGridNo, INT8 bLevel, UINT8 ubType, UINT8 ubStreng else { // no blood on the roof yet, so drop this amount! - // set decay time + // set decay time SET_BLOOD_DELAY_TIME( pMapElement->ubBloodInfo ); SET_BLOOD_ROOF_STRENGTH( pMapElement->ubBloodInfo, ubNewStrength ); SET_BLOOD_ROOF_TYPE( pMapElement->ubSmellInfo, ubType ); @@ -471,18 +471,15 @@ void InternalDropBlood( INT16 sGridNo, INT8 bLevel, UINT8 ubType, UINT8 ubStreng void DropBlood( SOLDIERTYPE * pSoldier, UINT8 ubStrength, INT8 bVisible ) { UINT8 ubType; - UINT8 ubOldStrength=0; - UINT8 ubNewStrength=0; - /* - * Dropping some blood; - * We can check the type of blood by consulting the type in the smell byte - */ + * Dropping some blood; + * We can check the type of blood by consulting the type in the smell byte + */ // figure out the type of blood that we're dropping - if ( pSoldier->uiStatusFlags & SOLDIER_MONSTER ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_MONSTER ) { - if ( pSoldier->bLevel == 0 ) + if ( pSoldier->pathing.bLevel == 0 ) { ubType = CREATURE_ON_FLOOR; } @@ -497,7 +494,7 @@ void DropBlood( SOLDIERTYPE * pSoldier, UINT8 ubStrength, INT8 bVisible ) } - InternalDropBlood( pSoldier->sGridNo, pSoldier->bLevel, ubType, ubStrength, bVisible ); + InternalDropBlood( pSoldier->sGridNo, pSoldier->pathing.bLevel, ubType, ubStrength, bVisible ); } @@ -507,7 +504,7 @@ void UpdateBloodGraphics( INT16 sGridNo, INT8 bLevel ) MAP_ELEMENT * pMapElement; INT8 bValue; UINT16 usIndex, usNewIndex; - + // OK, based on level, type, display graphics for blood pMapElement = &(gpWorldLevelData[ sGridNo ]); @@ -527,7 +524,7 @@ void UpdateBloodGraphics( INT16 sGridNo, INT8 bLevel ) if ( bLevel == 0 ) { bValue = BLOOD_FLOOR_STRENGTH( pMapElement->ubBloodInfo ); - + // OK, remove tile graphic if one exists.... if ( TypeRangeExistsInObjectLayer( sGridNo, HUMANBLOOD, CREATUREBLOOD, &usIndex ) ) { @@ -579,4 +576,4 @@ void UpdateBloodGraphics( INT16 sGridNo, INT8 bLevel ) } } -} \ No newline at end of file +} diff --git a/TileEngine/Smell.h b/TileEngine/Smell.h index 82a0659f..4d4b2610 100644 --- a/TileEngine/Smell.h +++ b/TileEngine/Smell.h @@ -1,8 +1,8 @@ #include "soldier control.h" -#define HUMAN 0 -#define CREATURE_ON_FLOOR 0x01 -#define CREATURE_ON_ROOF 0x02 +#define HUMAN 0 +#define CREATURE_ON_FLOOR 0x01 +#define CREATURE_ON_ROOF 0x02 #define NORMAL_HUMAN_SMELL_STRENGTH 10 #define COW_SMELL_STRENGTH 15 diff --git a/TileEngine/SmokeEffects.cpp b/TileEngine/SmokeEffects.cpp index 265fba79..00191957 100644 --- a/TileEngine/SmokeEffects.cpp +++ b/TileEngine/SmokeEffects.cpp @@ -8,10 +8,10 @@ #include "wcheck.h" #include "stdlib.h" #include "debug.h" - #include "soldier control.h" + //#include "soldier control.h" #include "weapons.h" #include "handle items.h" - #include "worlddef.h" + #include "worlddef.h" #include "worldman.h" #include "animation control.h" #include "tile animation.h" @@ -30,6 +30,11 @@ #include "SaveLoadGame.h" +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + INT8 FromWorldFlagsToSmokeType( UINT16 ubWorldFlags ); UINT16 FromSmokeTypeToWorldFlags( INT8 bType ); @@ -153,10 +158,10 @@ UINT16 FromSmokeTypeToWorldFlags( INT8 bType ) return( MAPELEMENT_EXT_BURNABLEGAS ); break; - case CREATURE_SMOKE_EFFECT: - - return( MAPELEMENT_EXT_CREATUREGAS ); - break; + case CREATURE_SMOKE_EFFECT: + + return( MAPELEMENT_EXT_CREATUREGAS ); + break; default: @@ -192,8 +197,8 @@ INT32 NewSmokeEffect( INT16 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubOwner ) } - switch( Explosive[Item[usItem].ubClassIndex].ubType ) - { + switch( Explosive[Item[usItem].ubClassIndex].ubType ) + { case EXPLOSV_MUSTGAS: bSmokeEffectType = MUSTARDGAS_SMOKE_EFFECT; @@ -205,54 +210,54 @@ INT32 NewSmokeEffect( INT16 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubOwner ) break; case EXPLOSV_TEARGAS: - bSmokeEffectType = TEARGAS_SMOKE_EFFECT; + bSmokeEffectType = TEARGAS_SMOKE_EFFECT; break; case EXPLOSV_SMOKE: - bSmokeEffectType = NORMAL_SMOKE_EFFECT; + bSmokeEffectType = NORMAL_SMOKE_EFFECT; break; - // case SMALL_CREATURE_GAS: - //bSmokeEffectType = CREATURE_SMOKE_EFFECT; + // case SMALL_CREATURE_GAS: + //bSmokeEffectType = CREATURE_SMOKE_EFFECT; //ubDuration = 3; //ubStartRadius = 1; //break; - case EXPLOSV_CREATUREGAS: - bSmokeEffectType = CREATURE_SMOKE_EFFECT; + case EXPLOSV_CREATUREGAS: + bSmokeEffectType = CREATURE_SMOKE_EFFECT; break; - // case VERY_SMALL_CREATURE_GAS: + // case VERY_SMALL_CREATURE_GAS: - //bSmokeEffectType = CREATURE_SMOKE_EFFECT; + //bSmokeEffectType = CREATURE_SMOKE_EFFECT; //ubDuration = 2; //ubStartRadius = 0; - break; - } + break; + } pSmoke->ubDuration = (UINT8)Explosive[ Item[ usItem ].ubClassIndex ].ubDuration; - pSmoke->ubRadius = (UINT8)Explosive[ Item[ usItem ].ubClassIndex ].ubStartRadius; + pSmoke->ubRadius = (UINT8)Explosive[ Item[ usItem ].ubClassIndex ].ubStartRadius; pSmoke->bAge = 0; - pSmoke->fAllocated = TRUE; + pSmoke->fAllocated = TRUE; pSmoke->bType = bSmokeEffectType; - pSmoke->ubOwner = ubOwner; + pSmoke->ubOwner = ubOwner; - if ( pSmoke->bFlags & SMOKE_EFFECT_INDOORS ) - { + if ( pSmoke->bFlags & SMOKE_EFFECT_INDOORS ) + { // Duration is increased by 2 turns...indoors pSmoke->ubDuration += 3; - } + } - if ( bLevel ) - { - pSmoke->bFlags |= SMOKE_EFFECT_ON_ROOF; - } + if ( bLevel ) + { + pSmoke->bFlags |= SMOKE_EFFECT_ON_ROOF; + } - // ATE: FALSE into subsequent-- it's the first one! - SpreadEffect( pSmoke->sGridNo, pSmoke->ubRadius, pSmoke->usItem, pSmoke->ubOwner, FALSE, bLevel, iSmokeIndex ); + // ATE: FALSE into subsequent-- it's the first one! + SpreadEffect( pSmoke->sGridNo, pSmoke->ubRadius, pSmoke->usItem, pSmoke->ubOwner, FALSE, bLevel, iSmokeIndex ); return( iSmokeIndex ); } @@ -264,17 +269,17 @@ void AddSmokeEffectToTile( INT32 iSmokeEffectID, INT8 bType, INT16 sGridNo, INT8 { ANITILE_PARAMS AniParams; ANITILE *pAniTile; - SMOKEEFFECT *pSmoke; - BOOLEAN fDissipating = FALSE; + SMOKEEFFECT *pSmoke; + BOOLEAN fDissipating = FALSE; pSmoke = &gSmokeEffectData[ iSmokeEffectID ]; - if ( ( pSmoke->ubDuration - pSmoke->bAge ) < 2 ) - { - fDissipating = TRUE; - // Remove old one... - RemoveSmokeEffectFromTile( sGridNo, bLevel ); - } + if ( ( pSmoke->ubDuration - pSmoke->bAge ) < 2 ) + { + fDissipating = TRUE; + // Remove old one... + RemoveSmokeEffectFromTile( sGridNo, bLevel ); + } // If smoke effect exists already.... stop @@ -282,31 +287,31 @@ void AddSmokeEffectToTile( INT32 iSmokeEffectID, INT8 bType, INT16 sGridNo, INT8 { return; } - - // OK, Create anitile.... + + // OK, Create anitile.... memset( &AniParams, 0, sizeof( ANITILE_PARAMS ) ); AniParams.sGridNo = sGridNo; - if ( bLevel == 0 ) - { - AniParams.ubLevelID = ANI_STRUCT_LEVEL; - } - else - { - AniParams.ubLevelID = ANI_ONROOF_LEVEL; - } + if ( bLevel == 0 ) + { + AniParams.ubLevelID = ANI_STRUCT_LEVEL; + } + else + { + AniParams.ubLevelID = ANI_ONROOF_LEVEL; + } AniParams.sDelay = (INT16)( 300 + Random( 300 ) ); - if ( !( gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ] ) ) - { - AniParams.sStartFrame = (INT16)0; - } - else - { - AniParams.sStartFrame = (INT16)Random( 5 ); - } + if ( !( gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ] ) ) + { + AniParams.sStartFrame = (INT16)0; + } + else + { + AniParams.sStartFrame = (INT16)Random( 5 ); + } // Bare bones flags are... @@ -314,14 +319,14 @@ void AddSmokeEffectToTile( INT32 iSmokeEffectID, INT8 bType, INT16 sGridNo, INT8 //AniParams.uiFlags = ANITILE_CACHEDTILE | ANITILE_FORWARD | ANITILE_SMOKE_EFFECT | ANITILE_LOOPING; - if ( !( gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ] ) ) - { - AniParams.uiFlags = ANITILE_PAUSED | ANITILE_CACHEDTILE | ANITILE_FORWARD | ANITILE_SMOKE_EFFECT | ANITILE_LOOPING; - } - else - { - AniParams.uiFlags = ANITILE_CACHEDTILE | ANITILE_FORWARD | ANITILE_SMOKE_EFFECT | ANITILE_LOOPING | ANITILE_ALWAYS_TRANSLUCENT; - } + if ( !( gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ] ) ) + { + AniParams.uiFlags = ANITILE_PAUSED | ANITILE_CACHEDTILE | ANITILE_FORWARD | ANITILE_SMOKE_EFFECT | ANITILE_LOOPING; + } + else + { + AniParams.uiFlags = ANITILE_CACHEDTILE | ANITILE_FORWARD | ANITILE_SMOKE_EFFECT | ANITILE_LOOPING | ANITILE_ALWAYS_TRANSLUCENT; + } AniParams.sX = CenterX( sGridNo ); AniParams.sY = CenterY( sGridNo ); @@ -332,97 +337,97 @@ void AddSmokeEffectToTile( INT32 iSmokeEffectID, INT8 bType, INT16 sGridNo, INT8 { case NORMAL_SMOKE_EFFECT: - if ( !( gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ] ) ) - { - strcpy( AniParams.zCachedFile, "TILECACHE\\smkechze.STI" ); - } - else - { - if ( fDissipating ) - { - strcpy( AniParams.zCachedFile, "TILECACHE\\smalsmke.STI" ); - } - else - { - strcpy( AniParams.zCachedFile, "TILECACHE\\SMOKE.STI" ); - } - } + if ( !( gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ] ) ) + { + strcpy( AniParams.zCachedFile, "TILECACHE\\smkechze.STI" ); + } + else + { + if ( fDissipating ) + { + strcpy( AniParams.zCachedFile, "TILECACHE\\smalsmke.STI" ); + } + else + { + strcpy( AniParams.zCachedFile, "TILECACHE\\SMOKE.STI" ); + } + } break; case TEARGAS_SMOKE_EFFECT: - if ( !( gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ] ) ) - { - strcpy( AniParams.zCachedFile, "TILECACHE\\tearchze.STI" ); - } - else - { - if ( fDissipating ) - { - strcpy( AniParams.zCachedFile, "TILECACHE\\smaltear.STI" ); - } - else - { - strcpy( AniParams.zCachedFile, "TILECACHE\\TEARGAS.STI" ); - } - } + if ( !( gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ] ) ) + { + strcpy( AniParams.zCachedFile, "TILECACHE\\tearchze.STI" ); + } + else + { + if ( fDissipating ) + { + strcpy( AniParams.zCachedFile, "TILECACHE\\smaltear.STI" ); + } + else + { + strcpy( AniParams.zCachedFile, "TILECACHE\\TEARGAS.STI" ); + } + } break; case MUSTARDGAS_SMOKE_EFFECT: - if ( !( gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ] ) ) - { - strcpy( AniParams.zCachedFile, "TILECACHE\\mustchze.STI" ); - } - else - { - if ( fDissipating ) - { - strcpy( AniParams.zCachedFile, "TILECACHE\\smalmust.STI" ); - } - else - { - strcpy( AniParams.zCachedFile, "TILECACHE\\MUSTARD2.STI" ); - } - } + if ( !( gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ] ) ) + { + strcpy( AniParams.zCachedFile, "TILECACHE\\mustchze.STI" ); + } + else + { + if ( fDissipating ) + { + strcpy( AniParams.zCachedFile, "TILECACHE\\smalmust.STI" ); + } + else + { + strcpy( AniParams.zCachedFile, "TILECACHE\\MUSTARD2.STI" ); + } + } break; case BURNABLEGAS_SMOKE_EFFECT: - if ( !( gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ] ) ) - { - strcpy( AniParams.zCachedFile, "TILECACHE\\FLAMCHZE.STI" ); - } - else - { - if ( fDissipating ) - { - strcpy( AniParams.zCachedFile, "TILECACHE\\smalflam.STI" ); - } - else - { - strcpy( AniParams.zCachedFile, "TILECACHE\\FLAMETH2.STI" ); - } - } + if ( !( gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ] ) ) + { + strcpy( AniParams.zCachedFile, "TILECACHE\\FLAMCHZE.STI" ); + } + else + { + if ( fDissipating ) + { + strcpy( AniParams.zCachedFile, "TILECACHE\\smalflam.STI" ); + } + else + { + strcpy( AniParams.zCachedFile, "TILECACHE\\FLAMETH2.STI" ); + } + } break; case CREATURE_SMOKE_EFFECT: - if ( !( gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ] ) ) - { - strcpy( AniParams.zCachedFile, "TILECACHE\\spit_gas.STI" ); - } - else - { - if ( fDissipating ) - { - strcpy( AniParams.zCachedFile, "TILECACHE\\spit_gas.STI" ); - } - else - { - strcpy( AniParams.zCachedFile, "TILECACHE\\spit_gas.STI" ); - } - } + if ( !( gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ] ) ) + { + strcpy( AniParams.zCachedFile, "TILECACHE\\spit_gas.STI" ); + } + else + { + if ( fDissipating ) + { + strcpy( AniParams.zCachedFile, "TILECACHE\\spit_gas.STI" ); + } + else + { + strcpy( AniParams.zCachedFile, "TILECACHE\\spit_gas.STI" ); + } + } break; } @@ -455,7 +460,7 @@ void RemoveSmokeEffectFromTile( INT16 sGridNo, INT8 bLevel ) } pAniTile = GetCachedAniTileOfType( sGridNo, ubLevelID, ANITILE_SMOKE_EFFECT ); - + if ( pAniTile != NULL ) { DeleteAniTile( pAniTile ); @@ -476,71 +481,71 @@ void DecaySmokeEffects( UINT32 uiTime ) { SMOKEEFFECT *pSmoke; UINT32 cnt, cnt2; - BOOLEAN fUpdate = FALSE; - BOOLEAN fSpreadEffect; - INT8 bLevel; - UINT16 usNumUpdates = 1; + BOOLEAN fUpdate = FALSE; + BOOLEAN fSpreadEffect; + INT8 bLevel; + UINT16 usNumUpdates = 1; for ( cnt = 0; cnt < guiNumMercSlots; cnt++ ) { if ( MercSlots[ cnt ] ) { // reset 'hit by gas' flags - MercSlots[ cnt ]->fHitByGasFlags = 0; + MercSlots[ cnt ]->flags.fHitByGasFlags = 0; } } - // ATE: 1 ) make first pass and delete/mark any smoke effect for update - // all the deleting has to be done first/// + // ATE: 1 ) make first pass and delete/mark any smoke effect for update + // all the deleting has to be done first/// - // age all active tear gas clouds, deactivate those that are just dispersing - for ( cnt = 0; cnt < guiNumSmokeEffects; cnt++ ) - { + // age all active tear gas clouds, deactivate those that are just dispersing + for ( cnt = 0; cnt < guiNumSmokeEffects; cnt++ ) + { fSpreadEffect = TRUE; pSmoke = &gSmokeEffectData[ cnt ]; - + if ( pSmoke->fAllocated ) { - if ( pSmoke->bFlags & SMOKE_EFFECT_ON_ROOF ) - { - bLevel = 1; - } - else - { - bLevel = 0; - } + if ( pSmoke->bFlags & SMOKE_EFFECT_ON_ROOF ) + { + bLevel = 1; + } + else + { + bLevel = 0; + } - // Do things differently for combat /vs realtime - // always try to update during combat - if (gTacticalStatus.uiFlags & INCOMBAT ) - { - fUpdate = TRUE; - } - else - { - // ATE: Do this every so ofte, to acheive the effect we want... - if ( ( uiTime - pSmoke->uiTimeOfLastUpdate ) > 10 ) - { - fUpdate = TRUE; + // Do things differently for combat /vs realtime + // always try to update during combat + if (gTacticalStatus.uiFlags & INCOMBAT ) + { + fUpdate = TRUE; + } + else + { + // ATE: Do this every so ofte, to acheive the effect we want... + if ( ( uiTime - pSmoke->uiTimeOfLastUpdate ) > 10 ) + { + fUpdate = TRUE; - usNumUpdates = ( UINT16 ) ( ( uiTime - pSmoke->uiTimeOfLastUpdate ) / 10 ); - } - } + usNumUpdates = ( UINT16 ) ( ( uiTime - pSmoke->uiTimeOfLastUpdate ) / 10 ); + } + } - if ( fUpdate ) - { + if ( fUpdate ) + { pSmoke->uiTimeOfLastUpdate = uiTime; - for ( cnt2 = 0; cnt2 < usNumUpdates; cnt2++ ) - { - pSmoke->bAge++; + for ( cnt2 = 0; cnt2 < usNumUpdates; cnt2++ ) + { + pSmoke->bAge++; if ( pSmoke->bAge == 1 ) { - // ATE: At least mark for update! - pSmoke->bFlags |= SMOKE_EFFECT_MARK_FOR_UPDATE; + // ATE: At least mark for update! + pSmoke->bFlags |= SMOKE_EFFECT_MARK_FOR_UPDATE; fSpreadEffect = FALSE; } else @@ -548,66 +553,66 @@ void DecaySmokeEffects( UINT32 uiTime ) fSpreadEffect = TRUE; } - if ( fSpreadEffect ) - { - // if this cloud remains effective (duration not reached) - if ( pSmoke->bAge <= pSmoke->ubDuration) - { - // ATE: Only mark now and increse radius - actual drawing is done - // in another pass cause it could - // just get erased... - pSmoke->bFlags |= SMOKE_EFFECT_MARK_FOR_UPDATE; + if ( fSpreadEffect ) + { + // if this cloud remains effective (duration not reached) + if ( pSmoke->bAge <= pSmoke->ubDuration) + { + // ATE: Only mark now and increse radius - actual drawing is done + // in another pass cause it could + // just get erased... + pSmoke->bFlags |= SMOKE_EFFECT_MARK_FOR_UPDATE; - // calculate the new cloud radius - // cloud expands by 1 every turn outdoors, and every other turn indoors + // calculate the new cloud radius + // cloud expands by 1 every turn outdoors, and every other turn indoors - // ATE: If radius is < maximun, increase radius, otherwise keep at max - if ( pSmoke->ubRadius < Explosive[ Item[ pSmoke->usItem ].ubClassIndex ].ubRadius ) - { - pSmoke->ubRadius++; - } - } - else - { - // deactivate tear gas cloud (use last known radius) - SpreadEffect( pSmoke->sGridNo, pSmoke->ubRadius, pSmoke->usItem, pSmoke->ubOwner, ERASE_SPREAD_EFFECT, bLevel, cnt ); - pSmoke->fAllocated = FALSE; - break; - } - } - } + // ATE: If radius is < maximun, increase radius, otherwise keep at max + if ( pSmoke->ubRadius < Explosive[ Item[ pSmoke->usItem ].ubClassIndex ].ubRadius ) + { + pSmoke->ubRadius++; + } + } + else + { + // deactivate tear gas cloud (use last known radius) + SpreadEffect( pSmoke->sGridNo, pSmoke->ubRadius, pSmoke->usItem, pSmoke->ubOwner, ERASE_SPREAD_EFFECT, bLevel, cnt ); + pSmoke->fAllocated = FALSE; + break; + } + } + } } else { // damage anyone standing in cloud SpreadEffect( pSmoke->sGridNo, pSmoke->ubRadius, pSmoke->usItem, pSmoke->ubOwner, REDO_SPREAD_EFFECT, bLevel, cnt ); } - } - } + } + } - for ( cnt = 0; cnt < guiNumSmokeEffects; cnt++ ) - { + for ( cnt = 0; cnt < guiNumSmokeEffects; cnt++ ) + { pSmoke = &gSmokeEffectData[ cnt ]; - + if ( pSmoke->fAllocated ) { - if ( pSmoke->bFlags & SMOKE_EFFECT_ON_ROOF ) - { - bLevel = 1; - } - else - { - bLevel = 0; - } + if ( pSmoke->bFlags & SMOKE_EFFECT_ON_ROOF ) + { + bLevel = 1; + } + else + { + bLevel = 0; + } - // if this cloud remains effective (duration not reached) - if ( pSmoke->bFlags & SMOKE_EFFECT_MARK_FOR_UPDATE ) + // if this cloud remains effective (duration not reached) + if ( pSmoke->bFlags & SMOKE_EFFECT_MARK_FOR_UPDATE ) { - SpreadEffect( pSmoke->sGridNo, pSmoke->ubRadius, pSmoke->usItem, pSmoke->ubOwner, TRUE, bLevel, cnt ); - pSmoke->bFlags &= (~SMOKE_EFFECT_MARK_FOR_UPDATE); + SpreadEffect( pSmoke->sGridNo, pSmoke->ubRadius, pSmoke->usItem, pSmoke->ubOwner, TRUE, bLevel, cnt ); + pSmoke->bFlags &= (~SMOKE_EFFECT_MARK_FOR_UPDATE); } - } - } + } + } AllTeamsLookForAll( TRUE ); } @@ -665,10 +670,10 @@ BOOLEAN LoadSmokeEffectsFromLoadGameFile( HWFILE hFile ) UINT32 uiNumBytesRead; UINT32 uiCount; UINT32 uiCnt=0; - INT8 bLevel; + INT8 bLevel; - //no longer need to load smoke effects. They are now in temp files - if( guiSaveGameVersion < 75 ) + //no longer need to load smoke effects. They are now in temp files + if( guiCurrentSaveGameVersion < 75 ) { //Clear out the old list memset( gSmokeEffectData, 0, sizeof( SMOKEEFFECT ) * NUM_SMOKE_EFFECT_SLOTS ); @@ -681,7 +686,7 @@ BOOLEAN LoadSmokeEffectsFromLoadGameFile( HWFILE hFile ) } //This is a TEMP hack to allow us to use the saves - if( guiSaveGameVersion < 37 && guiNumSmokeEffects == 0 ) + if( guiCurrentSaveGameVersion < 37 && guiNumSmokeEffects == 0 ) { //Load the Smoke effect Data FileRead( hFile, gSmokeEffectData, sizeof( SMOKEEFFECT ), &uiNumBytesRead ); @@ -702,7 +707,7 @@ BOOLEAN LoadSmokeEffectsFromLoadGameFile( HWFILE hFile ) return( FALSE ); } //This is a TEMP hack to allow us to use the saves - if( guiSaveGameVersion < 37 ) + if( guiCurrentSaveGameVersion < 37 ) break; } @@ -713,14 +718,14 @@ BOOLEAN LoadSmokeEffectsFromLoadGameFile( HWFILE hFile ) //if this slot is allocated if( gSmokeEffectData[uiCount].fAllocated ) { - if ( gSmokeEffectData[uiCount].bFlags & SMOKE_EFFECT_ON_ROOF ) - { - bLevel = 1; - } - else - { - bLevel = 0; - } + if ( gSmokeEffectData[uiCount].bFlags & SMOKE_EFFECT_ON_ROOF ) + { + bLevel = 1; + } + else + { + bLevel = 0; + } SpreadEffect( gSmokeEffectData[uiCount].sGridNo, gSmokeEffectData[uiCount].ubRadius, gSmokeEffectData[uiCount].usItem, gSmokeEffectData[uiCount].ubOwner, TRUE, bLevel, uiCount ); } @@ -815,9 +820,8 @@ BOOLEAN LoadSmokeEffectsFromMapTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) UINT32 uiCount; UINT32 uiCnt=0; HWFILE hFile; - UINT32 uiNumBytesWritten=0; CHAR8 zMapName[ 128 ]; - INT8 bLevel; + INT8 bLevel; GetMapTempFileName( SF_SMOKE_EFFECTS_TEMP_FILE_EXISTS, zMapName, sMapX, sMapY, bMapZ ); @@ -860,14 +864,14 @@ BOOLEAN LoadSmokeEffectsFromMapTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) //if this slot is allocated if( gSmokeEffectData[uiCount].fAllocated ) { - if ( gSmokeEffectData[uiCount].bFlags & SMOKE_EFFECT_ON_ROOF ) - { - bLevel = 1; - } - else - { - bLevel = 0; - } + if ( gSmokeEffectData[uiCount].bFlags & SMOKE_EFFECT_ON_ROOF ) + { + bLevel = 1; + } + else + { + bLevel = 0; + } SpreadEffect( gSmokeEffectData[uiCount].sGridNo, gSmokeEffectData[uiCount].ubRadius, gSmokeEffectData[uiCount].usItem, gSmokeEffectData[uiCount].ubOwner, TRUE, bLevel, uiCount ); } @@ -889,9 +893,9 @@ void ResetSmokeEffects() void UpdateSmokeEffectGraphics( ) { - UINT32 uiCnt; + UINT32 uiCnt; SMOKEEFFECT *pSmoke; - INT8 bLevel; + INT8 bLevel; //loop through and save the number of smoke effects for( uiCnt=0; uiCnt < guiNumSmokeEffects; uiCnt++) @@ -901,18 +905,18 @@ void UpdateSmokeEffectGraphics( ) //if the smoke is active if( gSmokeEffectData[ uiCnt ].fAllocated ) { - if ( gSmokeEffectData[uiCnt].bFlags & SMOKE_EFFECT_ON_ROOF ) - { - bLevel = 1; - } - else - { - bLevel = 0; - } + if ( gSmokeEffectData[uiCnt].bFlags & SMOKE_EFFECT_ON_ROOF ) + { + bLevel = 1; + } + else + { + bLevel = 0; + } SpreadEffect( pSmoke->sGridNo, pSmoke->ubRadius, pSmoke->usItem, pSmoke->ubOwner, ERASE_SPREAD_EFFECT, bLevel, uiCnt ); - SpreadEffect( pSmoke->sGridNo, pSmoke->ubRadius, pSmoke->usItem, pSmoke->ubOwner, TRUE, bLevel, uiCnt ); - } - } -} \ No newline at end of file + SpreadEffect( pSmoke->sGridNo, pSmoke->ubRadius, pSmoke->usItem, pSmoke->ubOwner, TRUE, bLevel, uiCnt ); + } + } +} diff --git a/TileEngine/SmokeEffects.h b/TileEngine/SmokeEffects.h index 07d1036e..66a7f7b6 100644 --- a/TileEngine/SmokeEffects.h +++ b/TileEngine/SmokeEffects.h @@ -13,24 +13,24 @@ enum BURNABLEGAS_SMOKE_EFFECT, }; -#define SMOKE_EFFECT_INDOORS 0x01 -#define SMOKE_EFFECT_ON_ROOF 0x02 -#define SMOKE_EFFECT_MARK_FOR_UPDATE 0x04 +#define SMOKE_EFFECT_INDOORS 0x01 +#define SMOKE_EFFECT_ON_ROOF 0x02 +#define SMOKE_EFFECT_MARK_FOR_UPDATE 0x04 typedef struct TAG_SMOKE_EFFECT { - INT16 sGridNo; // gridno at which the tear gas cloud is centered + INT16 sGridNo; // gridno at which the tear gas cloud is centered - UINT8 ubDuration; // the number of turns gas will remain effective - UINT8 ubRadius; // the current radius of the cloud in map tiles - UINT8 bFlags; // 0 - outdoors (fast spread), 1 - indoors (slow) - UINT8 bAge; // the number of turns gas has been around + UINT8 ubDuration; // the number of turns gas will remain effective + UINT8 ubRadius; // the current radius of the cloud in map tiles + UINT8 bFlags; // 0 - outdoors (fast spread), 1 - indoors (slow) + UINT8 bAge; // the number of turns gas has been around BOOLEAN fAllocated; INT8 bType; UINT16 usItem; - UINT8 ubOwner; - UINT8 ubPadding; + UINT8 ubOwner; + UINT8 ubPadding; UINT32 uiTimeOfLastUpdate; } SMOKEEFFECT; diff --git a/TileEngine/Structure Internals.h b/TileEngine/Structure Internals.h index f2890973..42498660 100644 --- a/TileEngine/Structure Internals.h +++ b/TileEngine/Structure Internals.h @@ -19,9 +19,9 @@ // hit points, but instead stores a pointer to the // base object (section). // -// Each section has a line of sight profile. These +// Each section has a line of sight profile. These // profiles are split into 5 in each horizontal direction -// and 4 vertically, forming 100 "cubes". In real +// and 4 vertically, forming 100 "cubes". In real // world terms, each section represents a volume // with a height of 8 feet (and width and length // of what?) @@ -58,8 +58,8 @@ extern UINT8 AtHeight[PROFILE_Z_SIZE]; // then the structure is the "base" of the object // and its hitpoint value is the one for the object // -// vv generic flags for all structures -// vvv type flags +// vv generic flags for all structures +// vvv type flags // // how to handle explodable structures @@ -116,16 +116,16 @@ extern UINT8 AtHeight[PROFILE_Z_SIZE]; #define STRUCTURE_ANYDOOR 0x00CC0000 #define STRUCTURE_OBSTACLE 0x00008F00 #define STRUCTURE_WALLSTUFF 0x00CF0000 -#define STRUCTURE_BLOCKSMOVES 0x00208F00 +#define STRUCTURE_BLOCKSMOVES 0x00208F00 #define STRUCTURE_TYPE_DEFINED 0x8FEF8F00 -#define STRUCTURE_ROOF 0x07000000 +#define STRUCTURE_ROOF 0x07000000 #define TILE_ON_ROOF 0x01 #define TILE_PASSABLE 0x02 typedef struct TAG_STRUCTURE_TILE { - INT16 sPosRelToBase; // "single-axis" + INT16 sPosRelToBase; // "single-axis" INT8 bXPosRelToBase; INT8 bYPosRelToBase; PROFILE Shape; // 25 bytes diff --git a/TileEngine/Tactical Placement GUI.cpp b/TileEngine/Tactical Placement GUI.cpp index c0c91518..c54dd0ec 100644 --- a/TileEngine/Tactical Placement GUI.cpp +++ b/TileEngine/Tactical Placement GUI.cpp @@ -91,7 +91,7 @@ UINT8 gubHilightedGroupID = 0; UINT8 gubCursorGroupID = 0; INT8 gbSelectedMercID = -1; INT8 gbHilightedMercID = -1; -INT8 gbCursorMercID = -1; +INT8 gbCursorMercID = -1; SOLDIERTYPE *gpTacticalPlacementSelectedSoldier = NULL; SOLDIERTYPE *gpTacticalPlacementHilightedSoldier = NULL; @@ -114,7 +114,7 @@ void PickUpMercPiece( INT32 iPlacement ); void SetCursorMerc( INT8 bPlacementID ); void SelectNextUnplacedUnit(); -#ifdef JA2BETAVERSION +#ifdef JA2BETAVERSION BOOLEAN gfNorthValid, gfEastValid, gfSouthValid, gfWestValid; BOOLEAN gfChangedEntrySide = FALSE; @@ -126,38 +126,38 @@ void FindValidInsertionCode( UINT8 *pubStrategicInsertionCode ) gMapInformation.sSouthGridNo == -1 && gMapInformation.sWestGridNo == -1 ) { - AssertMsg( 0, "Map has no entry points at all. Can't generate edge points. LC:1" ); + AssertMsg( 0, "Map has no entry points at all. Can't generate edge points. LC:1" ); } - if( gMapInformation.sNorthGridNo != -1 && !gps1stNorthEdgepointArray || - gMapInformation.sEastGridNo != -1 && !gps1stEastEdgepointArray || - gMapInformation.sSouthGridNo != -1 && !gps1stSouthEdgepointArray || - gMapInformation.sWestGridNo != -1 && !gps1stWestEdgepointArray ) + if( gMapInformation.sNorthGridNo != -1 && !gps1stNorthEdgepointArray || + gMapInformation.sEastGridNo != -1 && !gps1stEastEdgepointArray || + gMapInformation.sSouthGridNo != -1 && !gps1stSouthEdgepointArray || + gMapInformation.sWestGridNo != -1 && !gps1stWestEdgepointArray ) { InvalidateScreen(); DrawTextToScreen( L"Map doesn't has entrypoints without corresponding edgepoints. LC:1", iOffsetHorizontal + 30, iOffsetVertical + 150, 600, FONT10ARIALBOLD, FONT_RED, FONT_MCOLOR_BLACK, TRUE, LEFT_JUSTIFIED ); - DrawTextToScreen( L"GENERATING MAP EDGEPOINTS! Please wait...", + DrawTextToScreen( L"GENERATING MAP EDGEPOINTS! Please wait...", iOffsetHorizontal + 30, iOffsetVertical + 160, 600, FONT10ARIALBOLD, FONT_YELLOW, FONT_MCOLOR_BLACK, TRUE, LEFT_JUSTIFIED ); - + RefreshScreen( NULL ); GenerateMapEdgepoints(); switch( *pubStrategicInsertionCode ) { - case INSERTION_CODE_NORTH: + case INSERTION_CODE_NORTH: if( !gps1stNorthEdgepointArray ) - AssertMsg( 0, "Map Edgepoint generation failed. KM : 0 -- send map" ); + AssertMsg( 0, "Map Edgepoint generation failed. KM : 0 -- send map" ); break; case INSERTION_CODE_EAST: if( !gps1stEastEdgepointArray ) - AssertMsg( 0, "Map Edgepoint generation failed. KM : 0 -- send map" ); + AssertMsg( 0, "Map Edgepoint generation failed. KM : 0 -- send map" ); break; - case INSERTION_CODE_SOUTH: + case INSERTION_CODE_SOUTH: if( !gps1stSouthEdgepointArray ) - AssertMsg( 0, "Map Edgepoint generation failed. KM : 0 -- send map" ); + AssertMsg( 0, "Map Edgepoint generation failed. KM : 0 -- send map" ); break; - case INSERTION_CODE_WEST: + case INSERTION_CODE_WEST: if( !gps1stWestEdgepointArray ) - AssertMsg( 0, "Map Edgepoint generation failed. KM : 0 -- send map" ); + AssertMsg( 0, "Map Edgepoint generation failed. KM : 0 -- send map" ); break; } return; @@ -192,7 +192,7 @@ void CheckForValidMapEdge( UINT8 *pubStrategicInsertionCode ) { switch( *pubStrategicInsertionCode ) { - case INSERTION_CODE_NORTH: + case INSERTION_CODE_NORTH: if( !gps1stNorthEdgepointArray ) FindValidInsertionCode( pubStrategicInsertionCode ); break; @@ -200,11 +200,11 @@ void CheckForValidMapEdge( UINT8 *pubStrategicInsertionCode ) if( !gps1stEastEdgepointArray ) FindValidInsertionCode( pubStrategicInsertionCode ); break; - case INSERTION_CODE_SOUTH: + case INSERTION_CODE_SOUTH: if( !gps1stSouthEdgepointArray ) FindValidInsertionCode( pubStrategicInsertionCode ); break; - case INSERTION_CODE_WEST: + case INSERTION_CODE_WEST: if( !gps1stWestEdgepointArray ) FindValidInsertionCode( pubStrategicInsertionCode ); break; @@ -265,7 +265,7 @@ void InitTacticalPlacementGUI() { AssertMsg( 0, "Failed to load Interface\\panels.sti" ); } - + giOverheadButtonImages[ DONE_BUTTON ] = LoadButtonImage( "Interface\\OverheadUIButtons.sti", -1, 0, -1, 1, -1 ); if( giOverheadButtonImages[ DONE_BUTTON ] == -1 ) { @@ -276,25 +276,25 @@ void InitTacticalPlacementGUI() giOverheadButtonImages[ CLEAR_BUTTON ] = UseLoadedButtonImage( giOverheadButtonImages[ DONE_BUTTON ], -1, 0, -1, 1, -1 ); //Create the buttons which provide automatic placements. - iTPButtons[ CLEAR_BUTTON ] = + iTPButtons[ CLEAR_BUTTON ] = QuickCreateButton( giOverheadButtonImages[ CLEAR_BUTTON ], 11, SCREEN_HEIGHT - 148, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, ClearPlacementsCallback ); SpecifyGeneralButtonTextAttributes( iTPButtons[ CLEAR_BUTTON ], gpStrategicString[ STR_TP_CLEAR ], BLOCKFONT, FONT_BEIGE, 141 ); SetButtonFastHelpText( iTPButtons[ CLEAR_BUTTON ], gpStrategicString[ STR_TP_CLEARHELP ] ); SetBtnHelpEndCallback( iTPButtons[ CLEAR_BUTTON ], FastHelpRemoved2Callback ); - iTPButtons[ SPREAD_BUTTON ] = + iTPButtons[ SPREAD_BUTTON ] = QuickCreateButton( giOverheadButtonImages[ SPREAD_BUTTON ], 11, SCREEN_HEIGHT - 113, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, SpreadPlacementsCallback ); SpecifyGeneralButtonTextAttributes( iTPButtons[ SPREAD_BUTTON ], gpStrategicString[ STR_TP_SPREAD ], BLOCKFONT, FONT_BEIGE, 141 ); SetButtonFastHelpText( iTPButtons[ SPREAD_BUTTON ], gpStrategicString[ STR_TP_SPREADHELP ] ); SetBtnHelpEndCallback( iTPButtons[ SPREAD_BUTTON ], FastHelpRemovedCallback ); - iTPButtons[ GROUP_BUTTON ] = + iTPButtons[ GROUP_BUTTON ] = QuickCreateButton( giOverheadButtonImages[ GROUP_BUTTON ], 11, SCREEN_HEIGHT - 78, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, GroupPlacementsCallback ); SpecifyGeneralButtonTextAttributes( iTPButtons[ GROUP_BUTTON ], gpStrategicString[ STR_TP_GROUP ], BLOCKFONT, FONT_BEIGE, 141 ); SetButtonFastHelpText( iTPButtons[ GROUP_BUTTON ], gpStrategicString[ STR_TP_GROUPHELP ] ); SetBtnHelpEndCallback( iTPButtons[ GROUP_BUTTON ], FastHelpRemovedCallback ); - iTPButtons[ DONE_BUTTON ] = + iTPButtons[ DONE_BUTTON ] = QuickCreateButton( giOverheadButtonImages[ DONE_BUTTON ], 11, SCREEN_HEIGHT - 43, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, DoneOverheadPlacementClickCallback ); SpecifyGeneralButtonTextAttributes( iTPButtons[ DONE_BUTTON ], gpStrategicString[ STR_TP_DONE ], BLOCKFONT, FONT_BEIGE, 141 ); @@ -307,16 +307,16 @@ void InitTacticalPlacementGUI() SpecifyButtonHilitedTextColors( iTPButtons[ GROUP_BUTTON ], FONT_WHITE, FONT_NEARBLACK ); SpecifyButtonHilitedTextColors( iTPButtons[ DONE_BUTTON ], FONT_WHITE, FONT_NEARBLACK ); - //First pass: Count the number of mercs that are going to be placed by the player. - // This determines the size of the array we will allocate. + //First pass: Count the number of mercs that are going to be placed by the player. + // This determines the size of the array we will allocate. giPlacements = 0; for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && !MercPtrs[ i ]->fBetweenSectors && + if( MercPtrs[ i ]->bActive && !MercPtrs[ i ]->flags.fBetweenSectors && MercPtrs[ i ]->sSectorX == gpBattleGroup->ubSectorX && - MercPtrs[ i ]->sSectorY == gpBattleGroup->ubSectorY && - !( MercPtrs[ i ]->uiStatusFlags & ( SOLDIER_VEHICLE ) ) && // ATE Ignore vehicles + MercPtrs[ i ]->sSectorY == gpBattleGroup->ubSectorY && + !( MercPtrs[ i ]->flags.uiStatusFlags & ( SOLDIER_VEHICLE ) ) && // ATE Ignore vehicles MercPtrs[ i ]->bAssignment != ASSIGNMENT_POW && MercPtrs[ i ]->bAssignment != IN_TRANSIT && !MercPtrs[ i ]->bSectorZ ) @@ -327,21 +327,21 @@ void InitTacticalPlacementGUI() //Allocate the array based on how many mercs there are. gMercPlacement = (MERCPLACEMENT*)MemAlloc( sizeof( MERCPLACEMENT ) * giPlacements ); Assert( gMercPlacement ); - //Second pass: Assign the mercs to their respective slots. + //Second pass: Assign the mercs to their respective slots. giPlacements = 0; for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bLife && !MercPtrs[ i ]->fBetweenSectors && + if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && !MercPtrs[ i ]->flags.fBetweenSectors && MercPtrs[ i ]->sSectorX == gpBattleGroup->ubSectorX && - MercPtrs[ i ]->sSectorY == gpBattleGroup->ubSectorY && + MercPtrs[ i ]->sSectorY == gpBattleGroup->ubSectorY && MercPtrs[ i ]->bAssignment != ASSIGNMENT_POW && MercPtrs[ i ]->bAssignment != IN_TRANSIT && - !( MercPtrs[ i ]->uiStatusFlags & ( SOLDIER_VEHICLE ) ) && // ATE Ignore vehicles + !( MercPtrs[ i ]->flags.uiStatusFlags & ( SOLDIER_VEHICLE ) ) && // ATE Ignore vehicles !MercPtrs[ i ]->bSectorZ ) { // ATE: If we are in a vehicle - remove ourselves from it! - //if ( MercPtrs[ i ]->uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) + //if ( MercPtrs[ i ]->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) //{ // RemoveSoldierFromVehicle( MercPtrs[ i ], MercPtrs[ i ]->bVehicleID ); //} @@ -359,17 +359,17 @@ void InitTacticalPlacementGUI() #endif switch( MercPtrs[ i ]->ubStrategicInsertionCode ) { - case INSERTION_CODE_NORTH: + case INSERTION_CODE_NORTH: gfNorth = TRUE; break; - case INSERTION_CODE_EAST: - gfEast = TRUE; + case INSERTION_CODE_EAST: + gfEast = TRUE; break; - case INSERTION_CODE_SOUTH: - gfSouth = TRUE; + case INSERTION_CODE_SOUTH: + gfSouth = TRUE; break; - case INSERTION_CODE_WEST: - gfWest = TRUE; + case INSERTION_CODE_WEST: + gfWest = TRUE; break; } giPlacements++; @@ -413,7 +413,7 @@ void InitTacticalPlacementGUI() //yp = (i % 2) ? 412 : 361; MSYS_DefineRegion( &gMercPlacement[ i ].region, (UINT16)xp, (UINT16)yp, (UINT16)(xp + 54), (UINT16)(yp + 62), MSYS_PRIORITY_HIGH, 0, MercMoveCallback, MercClickCallback ); } - + PlaceMercs(); if( gubDefaultButton == GROUP_BUTTON ) @@ -422,7 +422,7 @@ void InitTacticalPlacementGUI() for( i = 0; i < giPlacements; i++ ) { //go from the currently selected soldier to the end if( !gMercPlacement[ i ].fPlaced ) - { //Found an unplaced merc. Select him. + { //Found an unplaced merc. Select him. gbSelectedMercID = (INT8)i; if( gubDefaultButton == GROUP_BUTTON ) gubSelectedGroupID = gMercPlacement[ i ].pSoldier->ubGroupID; @@ -467,7 +467,7 @@ void RenderTacticalPlacementGUI() } //yp = (gbHilightedMercID % 2) ? 412 : 361; - + if( gusMouseXPos < xp || gusMouseXPos > xp + 54 || gusMouseYPos < yp || gusMouseYPos > yp + 62 ) { gbHilightedMercID = -1; @@ -501,17 +501,17 @@ void RenderTacticalPlacementGUI() { yp = SCREEN_HEIGHT - 109; } - + //yp = (i % 2) ? 422 : 371; ColorFillVideoSurfaceArea( FRAME_BUFFER, xp+36, yp+2, xp+44, yp+30, 0 ); BltVideoObjectFromIndex( FRAME_BUFFER, giMercPanelImage, 0, xp, yp, VO_BLT_SRCTRANSPARENCY, NULL ); BltVideoObjectFromIndex( FRAME_BUFFER, gMercPlacement[ i ].uiVObjectID, 0, xp+2, yp+2, VO_BLT_SRCTRANSPARENCY, NULL ); //HEALTH BAR - if( !pSoldier->bLife ) + if( !pSoldier->stats.bLife ) continue; //yellow one for bleeding - iStartY = yp + 29 - 27*pSoldier->bLifeMax/100; + iStartY = yp + 29 - 27*pSoldier->stats.bLifeMax/100; ColorFillVideoSurfaceArea( FRAME_BUFFER, xp+36, iStartY, xp+37, yp+29, Get16BPPColor( FROMRGB( 107, 107, 57 ) ) ); ColorFillVideoSurfaceArea( FRAME_BUFFER, xp+37, iStartY, xp+38, yp+29, Get16BPPColor( FROMRGB( 222, 181, 115 ) ) ); //pink one for bandaged. @@ -519,7 +519,7 @@ void RenderTacticalPlacementGUI() ColorFillVideoSurfaceArea( FRAME_BUFFER, xp+36, iStartY, xp+37, yp+29, Get16BPPColor( FROMRGB( 156, 57, 57 ) ) ); ColorFillVideoSurfaceArea( FRAME_BUFFER, xp+37, iStartY, xp+38, yp+29, Get16BPPColor( FROMRGB( 222, 132, 132 ) ) ); //red one for actual health - iStartY = yp + 29 - 27*pSoldier->bLife/100; + iStartY = yp + 29 - 27*pSoldier->stats.bLife/100; ColorFillVideoSurfaceArea( FRAME_BUFFER, xp+36, iStartY, xp+37, yp+29, Get16BPPColor( FROMRGB( 107, 8, 8 ) ) ); ColorFillVideoSurfaceArea( FRAME_BUFFER, xp+37, iStartY, xp+38, yp+29, Get16BPPColor( FROMRGB( 206, 0, 0 ) ) ); //BREATH BAR @@ -527,14 +527,14 @@ void RenderTacticalPlacementGUI() ColorFillVideoSurfaceArea( FRAME_BUFFER, xp+39, iStartY, xp+40, yp+29, Get16BPPColor( FROMRGB( 8, 8, 132 ) ) ); ColorFillVideoSurfaceArea( FRAME_BUFFER, xp+40, iStartY, xp+41, yp+29, Get16BPPColor( FROMRGB( 8, 8, 107 ) ) ); //MORALE BAR - iStartY = yp + 29 - 27*pSoldier->bMorale/100; + iStartY = yp + 29 - 27*pSoldier->aiData.bMorale/100; ColorFillVideoSurfaceArea( FRAME_BUFFER, xp+42, iStartY, xp+43, yp+29, Get16BPPColor( FROMRGB( 8, 156, 8 ) ) ); ColorFillVideoSurfaceArea( FRAME_BUFFER, xp+43, iStartY, xp+44, yp+29, Get16BPPColor( FROMRGB( 8, 107, 8 ) ) ); } SetFont( BLOCKFONT ); SetFontForeground( FONT_BEIGE ); SetFontShadow( 141 ); - + GetSectorIDString( gubPBSectorX, gubPBSectorY, gubPBSectorZ, str, TRUE ); mprintf(120, SCREEN_HEIGHT - 145, L"%s %s -- %s...", gpStrategicString[ STR_TP_SECTOR ], str, gpStrategicString[ STR_TP_CHOOSEENTRYPOSITIONS ] ); @@ -544,13 +544,13 @@ void RenderTacticalPlacementGUI() } if( gfValidLocationsChanged ) { - if( DayTime() ) + if( DayTime() ) { //6AM to 9PM is black usHatchColor = 0; //Black } else { //9PM to 6AM is gray (black is too dark to distinguish) - usHatchColor = Get16BPPColor( FROMRGB( 63, 31, 31 ) ); + usHatchColor = Get16BPPColor( FROMRGB( 63, 31, 31 ) ); } gfValidLocationsChanged--; BlitBufferToBuffer( guiSAVEBUFFER, FRAME_BUFFER, iOffsetHorizontal, iOffsetVertical, 640, 320 ); @@ -567,7 +567,7 @@ void RenderTacticalPlacementGUI() gTPClipRect.iLeft = iOffsetHorizontal; gTPClipRect.iTop = iOffsetVertical + 3; //gTPClipRect.iRight = iOffsetHorizontal + 640; - gTPClipRect.iRight = iOffsetHorizontal + 634; // 635 + gTPClipRect.iRight = iOffsetHorizontal + 634; // 635 gTPClipRect.iBottom = iOffsetVertical + 320; switch( gMercPlacement[ gbCursorMercID ].ubStrategicInsertionCode ) { @@ -586,7 +586,7 @@ void RenderTacticalPlacementGUI() for( i = 0; i < giPlacements; i++ ) { //Render the merc's names pSoldier = gMercPlacement[ i ].pSoldier; - + xp = 95 + (i / 2) * 54; if (i % 2) @@ -601,12 +601,12 @@ void RenderTacticalPlacementGUI() //yp = (i % 2) ? 422 : 371; //NAME if( gubDefaultButton == GROUP_BUTTON && gMercPlacement[ i ].pSoldier->ubGroupID == gubSelectedGroupID || - gubDefaultButton != GROUP_BUTTON && i == gbSelectedMercID ) + gubDefaultButton != GROUP_BUTTON && i == gbSelectedMercID ) { ubColor = FONT_YELLOW; } else if( gubDefaultButton == GROUP_BUTTON && gMercPlacement[ i ].pSoldier->ubGroupID == gubHilightedGroupID || - gubDefaultButton != GROUP_BUTTON && i == gbHilightedMercID ) + gubDefaultButton != GROUP_BUTTON && i == gbHilightedMercID ) { ubColor = FONT_WHITE; } @@ -620,7 +620,7 @@ void RenderTacticalPlacementGUI() //Render the question mark over the face if the merc hasn't yet been placed. if( gMercPlacement[ i ].fPlaced ) { - RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, (INT16)(xp + 16), (INT16)(yp + 14), (INT16)(xp + 24), (INT16)(yp + 22) ); + RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, (INT16)(xp + 16), (INT16)(yp + 14), (INT16)(xp + 24), (INT16)(yp + 22) ); } else { @@ -645,7 +645,7 @@ void EnsureDoneButtonStatus() //BOOLEAN fChanged = FALSE; for( i = 0; i < giPlacements; i++ ) { - if( !gMercPlacement[ i ].fPlaced ) + if( !gMercPlacement[ i ].fPlaced ) { if( ButtonList[ iTPButtons[ DONE_BUTTON ] ]->uiFlags & BUTTON_ENABLED ) { @@ -664,7 +664,7 @@ void EnsureDoneButtonStatus() void TacticalPlacementHandle() { - InputAtom InputEvent; + InputAtom InputEvent; EnsureDoneButtonStatus(); @@ -677,8 +677,8 @@ void TacticalPlacementHandle() gpTacticalPlacementSelectedSoldier = NULL; } - while( DequeueEvent( &InputEvent ) ) - { + while( DequeueEvent( &InputEvent ) ) + { if( InputEvent.usEvent == KEY_DOWN ) { switch( InputEvent.usParam ) @@ -719,19 +719,19 @@ void TacticalPlacementHandle() { switch( gMercPlacement[ gbCursorMercID ].ubStrategicInsertionCode ) { - case INSERTION_CODE_NORTH: + case INSERTION_CODE_NORTH: if( gusMouseYPos <= (iOffsetVertical + 30) ) // 40 gfValidCursor = TRUE; break; - case INSERTION_CODE_EAST: - if( gusMouseXPos >= (iOffsetHorizontal + 610) ) // 600 + case INSERTION_CODE_EAST: + if( gusMouseXPos >= (iOffsetHorizontal + 610) ) // 600 gfValidCursor = TRUE; break; - case INSERTION_CODE_SOUTH: - if( gusMouseYPos >= (iOffsetVertical + 290) ) // 280 + case INSERTION_CODE_SOUTH: + if( gusMouseYPos >= (iOffsetVertical + 290) ) // 280 gfValidCursor = TRUE; break; - case INSERTION_CODE_WEST: + case INSERTION_CODE_WEST: if( gusMouseXPos <= (iOffsetHorizontal + 30) ) // 40 gfValidCursor = TRUE; break; @@ -784,7 +784,7 @@ void KillTacticalPlacementGUI() gbCursorMercID = -1; gpTacticalPlacementHilightedSoldier = NULL; gpTacticalPlacementSelectedSoldier = NULL; - + //Destroy the tactical placement gui. gfEnterTacticalPlacementGUI = FALSE; gfTacticalPlacementGUIActive = FALSE; @@ -809,7 +809,7 @@ void KillTacticalPlacementGUI() gsCurInterfacePanel = TEAM_PANEL; SetCurrentInterfacePanel( (UINT8)gsCurInterfacePanel ); - + //Leave the overhead map. KillOverheadMap(); //Recreate the tactical panel. @@ -819,7 +819,7 @@ void KillTacticalPlacementGUI() for( i = 0; i < giPlacements; i++ ) { - PickUpMercPiece( i ); + PickUpMercPiece( i ); } PrepareLoadedSector(); @@ -828,7 +828,7 @@ void KillTacticalPlacementGUI() #ifdef JA2BETAVERSION if( gfChangedEntrySide ) { - ScreenMsg( FONT_RED, MSG_ERROR, L"Substituted different entry side due to invalid entry points or map edgepoints. KM, LC : 1" ); + ScreenMsg( FONT_RED, MSG_ERROR, L"Substituted different entry side due to invalid entry points or map edgepoints. KM, LC : 1" ); } #endif @@ -840,7 +840,7 @@ void ChooseRandomEdgepoints() INT32 i; for( i = 0; i < giPlacements; i++ ) { - if ( !( gMercPlacement[ i ].pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( !( gMercPlacement[ i ].pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { gMercPlacement[ i ].pSoldier->usStrategicInsertionData = ChooseMapEdgepoint( gMercPlacement[ i ].ubStrategicInsertionCode ); if( gMercPlacement[ i ].pSoldier->usStrategicInsertionData != NOWHERE ) @@ -873,7 +873,7 @@ void PlaceMercs() case CLEAR_BUTTON: for( i = 0; i < giPlacements; i++ ) { - PickUpMercPiece( i ); + PickUpMercPiece( i ); } gubSelectedGroupID = 0; gbSelectedMercID = 0; @@ -996,7 +996,7 @@ void SelectNextUnplacedUnit() for( i = gbSelectedMercID; i < giPlacements; i++ ) { //go from the currently selected soldier to the end if( !gMercPlacement[ i ].fPlaced ) - { //Found an unplaced merc. Select him. + { //Found an unplaced merc. Select him. gbSelectedMercID = (INT8)i; if( gubDefaultButton == GROUP_BUTTON ) gubSelectedGroupID = gMercPlacement[ i ].pSoldier->ubGroupID; @@ -1009,7 +1009,7 @@ void SelectNextUnplacedUnit() for( i = 0; i < gbSelectedMercID; i++ ) { //go from the beginning to the currently selected soldier if( !gMercPlacement[ i ].fPlaced ) - { //Found an unplaced merc. Select him. + { //Found an unplaced merc. Select him. gbSelectedMercID = (INT8)i; if( gubDefaultButton == GROUP_BUTTON ) gubSelectedGroupID = gMercPlacement[ i ].pSoldier->ubGroupID; @@ -1019,7 +1019,7 @@ void SelectNextUnplacedUnit() return; } } - //checked the whole array, and everybody has been placed. Select nobody. + //checked the whole array, and everybody has been placed. Select nobody. if( !gfEveryonePlaced ) { gfEveryonePlaced = TRUE; @@ -1050,9 +1050,9 @@ void HandleTacticalPlacementClicksInOverheadMap( MOUSE_REGION *reg, INT32 reason if( gubDefaultButton == GROUP_BUTTON ) { //We are placing a whole group. for( i = 0; i < giPlacements; i++ ) - { //Find locations of each member of the group, but don't place them yet. If + { //Find locations of each member of the group, but don't place them yet. If //one of the mercs can't be placed, then we won't place any, and tell the user - //the problem. If everything's okay, we will place them all. + //the problem. If everything's okay, we will place them all. if( gMercPlacement[ i ].pSoldier->ubGroupID == gubSelectedGroupID ) { gMercPlacement[ i ].pSoldier->usStrategicInsertionData = SearchForClosestPrimaryMapEdgepoint( sGridNo, gMercPlacement[ i ].ubStrategicInsertionCode ); @@ -1077,7 +1077,7 @@ void HandleTacticalPlacementClicksInOverheadMap( MOUSE_REGION *reg, INT32 reason } } else - { //This is a single merc placement. If valid, then place him, else report error. + { //This is a single merc placement. If valid, then place him, else report error. gMercPlacement[ gbSelectedMercID ].pSoldier->usStrategicInsertionData = SearchForClosestPrimaryMapEdgepoint( sGridNo, gMercPlacement[ gbSelectedMercID ].ubStrategicInsertionCode ); if( gMercPlacement[ gbSelectedMercID ].pSoldier->usStrategicInsertionData != NOWHERE ) { @@ -1099,14 +1099,14 @@ void HandleTacticalPlacementClicksInOverheadMap( MOUSE_REGION *reg, INT32 reason EndMapEdgepointSearch(); if( fInvalidArea ) - { + { // Only display the error message, when the cursor is on the overview map if (gusMouseYPos < (iOffsetVertical + 320) && gusMouseYPos > iOffsetVertical && gusMouseXPos > iOffsetHorizontal && gusMouseXPos < (iOffsetHorizontal + 640)) { //Report error due to invalid placement. SGPRect CenterRect = { 100, 100, SCREEN_WIDTH - 100, 300 }; - DoMessageBox( MSG_BOX_BASIC_STYLE, gpStrategicString[ STR_TP_INACCESSIBLE_MESSAGE ], guiCurrentScreen, MSG_BOX_FLAG_OK | MSG_BOX_FLAG_USE_CENTERING_RECT, DialogRemoved, &CenterRect ); + DoMessageBox( MSG_BOX_BASIC_STYLE, gpStrategicString[ STR_TP_INACCESSIBLE_MESSAGE ], guiCurrentScreen, MSG_BOX_FLAG_OK | MSG_BOX_FLAG_USE_CENTERING_RECT, DialogRemoved, &CenterRect ); } } else @@ -1123,9 +1123,9 @@ void HandleTacticalPlacementClicksInOverheadMap( MOUSE_REGION *reg, INT32 reason // Only display the error message, when the cursor is on the overview map if (gusMouseYPos < (iOffsetVertical + 320) && gusMouseYPos > iOffsetVertical && gusMouseXPos > iOffsetHorizontal && gusMouseXPos < (iOffsetHorizontal + 640)) - { + { SGPRect CenterRect = { 100, 100, SCREEN_WIDTH - 100, 300 }; - DoMessageBox( MSG_BOX_BASIC_STYLE, gpStrategicString[ STR_TP_INVALID_MESSAGE ], guiCurrentScreen, MSG_BOX_FLAG_OK | MSG_BOX_FLAG_USE_CENTERING_RECT, DialogRemoved, &CenterRect ); + DoMessageBox( MSG_BOX_BASIC_STYLE, gpStrategicString[ STR_TP_INVALID_MESSAGE ], guiCurrentScreen, MSG_BOX_FLAG_OK | MSG_BOX_FLAG_USE_CENTERING_RECT, DialogRemoved, &CenterRect ); } } } @@ -1136,8 +1136,8 @@ void SetCursorMerc( INT8 bPlacementID ) { if( gbCursorMercID != bPlacementID ) { - if( gbCursorMercID == -1 || bPlacementID == -1 || - gMercPlacement[ gbCursorMercID ].ubStrategicInsertionCode != gMercPlacement[ bPlacementID ].ubStrategicInsertionCode ) + if( gbCursorMercID == -1 || bPlacementID == -1 || + gMercPlacement[ gbCursorMercID ].ubStrategicInsertionCode != gMercPlacement[ bPlacementID ].ubStrategicInsertionCode ) gfValidLocationsChanged = TRUE; gbCursorMercID = bPlacementID; } @@ -1178,8 +1178,8 @@ void PutDownMercPiece( INT32 iPlacement ) if( sGridNo != NOWHERE ) { ConvertGridNoToCellXY( sGridNo, &sCellX, &sCellY ); - EVENT_SetSoldierPosition( pSoldier, (FLOAT)sCellX, (FLOAT)sCellY ); - EVENT_SetSoldierDirection( pSoldier, ubDirection ); + pSoldier->EVENT_SetSoldierPosition( (FLOAT)sCellX, (FLOAT)sCellY ); + pSoldier->EVENT_SetSoldierDirection( ubDirection ); pSoldier->ubInsertionDirection = pSoldier->ubDirection; gMercPlacement[ iPlacement ].fPlaced = TRUE; gMercPlacement[ iPlacement ].pSoldier->bInSector = TRUE; @@ -1188,7 +1188,7 @@ void PutDownMercPiece( INT32 iPlacement ) void PickUpMercPiece( INT32 iPlacement ) { - RemoveSoldierFromGridNo( gMercPlacement[ iPlacement ].pSoldier ); + gMercPlacement[ iPlacement ].pSoldier->RemoveSoldierFromGridNo( ); gMercPlacement[ iPlacement ].fPlaced = FALSE; gMercPlacement[ iPlacement ].pSoldier->bInSector = FALSE; } @@ -1207,5 +1207,5 @@ void FastHelpRemoved2Callback() void DialogRemoved( UINT8 ubResult ) { gfTacticalPlacementGUIDirty = TRUE; - gfValidLocationsChanged = TRUE; + gfValidLocationsChanged = TRUE; } diff --git a/TileEngine/Tactical Placement GUI.h b/TileEngine/Tactical Placement GUI.h index 3e80b1cc..237ad277 100644 --- a/TileEngine/Tactical Placement GUI.h +++ b/TileEngine/Tactical Placement GUI.h @@ -17,7 +17,7 @@ extern BOOLEAN gfEnterTacticalPlacementGUI; extern SOLDIERTYPE *gpTacticalPlacementSelectedSoldier; extern SOLDIERTYPE *gpTacticalPlacementHilightedSoldier; -//Saved value. Contains the last choice for future battles. +//Saved value. Contains the last choice for future battles. extern UINT8 gubDefaultButton; #endif \ No newline at end of file diff --git a/TileEngine/Tile Animation.cpp b/TileEngine/Tile Animation.cpp index 6286ff49..b8404202 100644 --- a/TileEngine/Tile Animation.cpp +++ b/TileEngine/Tile Animation.cpp @@ -73,7 +73,7 @@ ANITILE *CreateAnimationTile( ANITILE_PARAMS *pAniParams ) memset( pNewAniNode, 0, sizeof( ANITILE ) ); - if ( (uiFlags & ANITILE_EXISTINGTILE ) ) + if ( (uiFlags & ANITILE_EXISTINGTILE ) ) { pNewAniNode->pLevelNode = pGivenNode; pNewAniNode->pLevelNode->pAniTile = pNewAniNode; @@ -159,7 +159,7 @@ ANITILE *CreateAnimationTile( ANITILE_PARAMS *pAniParams ) if ( ( uiFlags & ANITILE_CACHEDTILE ) ) { - pNewAniNode->pLevelNode->uiFlags |= ( LEVELNODE_CACHEDANITILE ); + pNewAniNode->pLevelNode->uiFlags |= ( LEVELNODE_CACHEDANITILE ); pNewAniNode->sCachedTileID = (INT16)iCachedTile; pNewAniNode->usCachedTileSubIndex = usTileType; pNewAniNode->pLevelNode->pAniTile = pNewAniNode; @@ -169,7 +169,7 @@ ANITILE *CreateAnimationTile( ANITILE_PARAMS *pAniParams ) } // Can't set relative X,Y,Z IF FLAGS ANITILE_CACHEDTILE set! - else if ( (uiFlags & ANITILE_USEABSOLUTEPOS ) ) + else if ( (uiFlags & ANITILE_USEABSOLUTEPOS ) ) { pNewAniNode->pLevelNode->sRelativeX = sX; pNewAniNode->pLevelNode->sRelativeY = sY; @@ -285,7 +285,7 @@ ANITILE *CreateAnimationTile( ANITILE_PARAMS *pAniParams ) pNewAniNode->uiTimeLastUpdate = GetJA2Clock( ); pNewAniNode->sGridNo = sGridNo; - pNewAniNode->sStartFrame = sStartFrame; + pNewAniNode->sStartFrame = sStartFrame; pNewAniNode->ubKeyFrame1 = pAniParams->ubKeyFrame1; pNewAniNode->uiKeyFrame1Code = pAniParams->uiKeyFrame1Code; @@ -299,7 +299,7 @@ ANITILE *CreateAnimationTile( ANITILE_PARAMS *pAniParams ) //Set head pAniTileHead = pNewAniNode; - // Set some special stuff + // Set some special stuff return( pNewAniNode ); } @@ -348,7 +348,7 @@ void DeleteAniTile( ANITILE *pAniTile ) pOldAniNode->pNext = pAniNode->pNext; } - if ( !(pAniNode->uiFlags & ANITILE_EXISTINGTILE ) ) + if ( !(pAniNode->uiFlags & ANITILE_EXISTINGTILE ) ) { // Delete memory assosiated with item @@ -421,10 +421,10 @@ void DeleteAniTile( ANITILE *pAniTile ) { // First delete the bullet! RemoveBullet( pAniNode->uiUserData3 ); - - // 0verhaul: Removed because it's handled by RemoveBullet. + + // 0verhaul: Removed because it's handled by RemoveBullet. // DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - miss finished animation") ); - // FreeUpAttacker( (UINT8) pAniNode->ubAttackerMissed ); + // FreeUpAttacker( (UINT8) pAniNode->ubAttackerMissed ); } } else @@ -556,16 +556,16 @@ void UpdateAniTiles( ) case ANI_KEYFRAME_DO_SOUND: - PlayJA2Sample( pNode->uiUserData, RATE_11025, SoundVolume( MIDVOLUME, (INT16)pNode->uiUserData3 ), 1, SoundDir( (INT16)pNode->uiUserData3 ) ); + PlayJA2Sample( pNode->uiUserData, RATE_11025, SoundVolume( MIDVOLUME, (INT16)pNode->uiUserData3 ), 1, SoundDir( (INT16)pNode->uiUserData3 ) ); break; } - } + } // CHECK IF WE SHOULD BE DISPLAYING TRANSLUCENTLY! if ( pNode->sCurrentFrame == pNode->ubKeyFrame2 ) { - UINT16 ubExpType; + UINT16 ubExpType; switch( pNode->uiKeyFrame2Code ) { @@ -573,13 +573,13 @@ void UpdateAniTiles( ) ubExpType = Explosive[ Item[ (UINT16)pNode->uiUserData ].ubClassIndex ].ubType; - // if ( ubExpType == EXPLOSV_TEARGAS || ubExpType == EXPLOSV_MUSTGAS || - // ubExpType == EXPLOSV_SMOKE ) - if ( ubExpType == EXPLOSV_TEARGAS || ubExpType == EXPLOSV_MUSTGAS || + // if ( ubExpType == EXPLOSV_TEARGAS || ubExpType == EXPLOSV_MUSTGAS || + // ubExpType == EXPLOSV_SMOKE ) + if ( ubExpType == EXPLOSV_TEARGAS || ubExpType == EXPLOSV_MUSTGAS || ubExpType == EXPLOSV_SMOKE || ubExpType == EXPLOSV_BURNABLEGAS ) { // Do sound.... - // PlayJA2Sample( AIR_ESCAPING_1, RATE_11025, SoundVolume( HIGHVOLUME, pNode->sGridNo ), 1, SoundDir( pNode->sGridNo ) ); + // PlayJA2Sample( AIR_ESCAPING_1, RATE_11025, SoundVolume( HIGHVOLUME, pNode->sGridNo ), 1, SoundDir( pNode->sGridNo ) ); NewSmokeEffect( pNode->sGridNo, (UINT16)pNode->uiUserData, gExplosionData[ pNode->uiUserData3 ].Params.bLevel, (UINT8)pNode->ubUserData2 ); } else @@ -624,7 +624,7 @@ void UpdateAniTiles( ) pNode->uiFlags |= ANITILE_BACKWARD; } else - { + { // Delete from world! DeleteAniTile( pNode ); @@ -641,7 +641,7 @@ void UpdateAniTiles( ) if ( pNode->uiFlags & ANITILE_BACKWARD ) { if ( pNode->uiFlags & ANITILE_ERASEITEMFROMSAVEBUFFFER ) - { + { // ATE: Check if bounding box is on the screen... if ( pNode->bFrameCountAfterStart == 0 ) { @@ -729,7 +729,7 @@ void UpdateAniTiles( ) } if ( pNode->uiFlags & ANITILE_ERASEITEMFROMSAVEBUFFFER ) - { + { // ATE: Check if bounding box is on the screen... pNode->bFrameCountAfterStart = 0; //pNode->pLevelNode->uiFlags |= LEVELNODE_UPDATESAVEBUFFERONCE; @@ -750,7 +750,7 @@ void UpdateAniTiles( ) { // ONLY TURN OFF IF PAUSED... if ( ( pNode->uiFlags & ANITILE_ERASEITEMFROMSAVEBUFFFER ) ) - { + { if ( pNode->uiFlags & ANITILE_PAUSED ) { if ( pNode->pLevelNode->uiFlags & LEVELNODE_DYNAMIC ) diff --git a/TileEngine/Tile Animation.h b/TileEngine/Tile Animation.h index 8f0f158a..4833dccb 100644 --- a/TileEngine/Tile Animation.h +++ b/TileEngine/Tile Animation.h @@ -38,13 +38,13 @@ typedef struct TAG_anitile { - struct TAG_anitile *pNext; + struct TAG_anitile *pNext; UINT32 uiFlags; // flags struct UINT32 uiTimeLastUpdate; // Stuff for animated tiles LEVELNODE *pLevelNode; UINT8 ubLevelID; - INT16 sCurrentFrame; + INT16 sCurrentFrame; INT16 sStartFrame; INT16 sDelay; UINT16 usTileType; @@ -80,7 +80,7 @@ typedef struct TAG_anitile_params { UINT32 uiFlags; // flags struct UINT8 ubLevelID; // Level ID for rendering layer - INT16 sStartFrame; // Start frame + INT16 sStartFrame; // Start frame INT16 sDelay; // Delay time UINT16 usTileType; // Tile databse type ( optional ) UINT16 usTileIndex; // Tile database index ( optional ) @@ -112,7 +112,7 @@ enum KeyFrameEnums ANI_KEYFRAME_BEGIN_TRANSLUCENCY, ANI_KEYFRAME_BEGIN_DAMAGE, ANI_KEYFRAME_CHAIN_WATER_EXPLOSION, - ANI_KEYFRAME_DO_SOUND, + ANI_KEYFRAME_DO_SOUND, } ; diff --git a/TileEngine/Tile Cache.cpp b/TileEngine/Tile Cache.cpp index 7fbf0eab..d3b412d8 100644 --- a/TileEngine/Tile Cache.cpp +++ b/TileEngine/Tile Cache.cpp @@ -23,15 +23,15 @@ UINT32 guiNumTileCacheStructs = 0; UINT32 guiMaxTileCacheSize = 50; UINT32 guiCurTileCacheSize = 0; -INT32 giDefaultStructIndex = -1; +INT32 giDefaultStructIndex = -1; TILE_CACHE_ELEMENT *gpTileCache = NULL; TILE_CACHE_STRUCT *gpTileCacheStructInfo = NULL; -BOOLEAN InitTileCache( ) -{ +BOOLEAN InitTileCache( ) +{ UINT32 cnt; GETFILESTRUCT FileInfo; INT16 sFiles = 0; @@ -84,13 +84,13 @@ BOOLEAN InitTileCache( ) #ifdef JA2TESTVERSION if ( gpTileCacheStructInfo[ cnt ].pStructureFileRef == NULL ) { - SET_ERROR( "Cannot load tilecache JSD: %s", gpTileCacheStructInfo[ cnt ].Filename ); + SET_ERROR( "Cannot load tilecache JSD: %s", gpTileCacheStructInfo[ cnt ].Filename ); } #endif - if ( _stricmp( gpTileCacheStructInfo[ cnt ].zRootName, "l_dead1" ) == 0 ) - { - giDefaultStructIndex = cnt; - } + if ( _stricmp( gpTileCacheStructInfo[ cnt ].zRootName, "l_dead1" ) == 0 ) + { + giDefaultStructIndex = cnt; + } cnt++; } @@ -130,12 +130,12 @@ void DeleteTileCache( ) INT16 FindCacheStructDataIndex( STR8 cFilename ) { UINT32 cnt; - + for ( cnt = 0; cnt < guiNumTileCacheStructs; cnt++ ) { if ( _stricmp( gpTileCacheStructInfo[ cnt ].zRootName, cFilename ) == 0 ) { - return( (INT16)cnt ); + return( (INT16)cnt ); } } @@ -146,7 +146,7 @@ INT32 GetCachedTile( const STR8 cFilename ) { UINT32 cnt; UINT32 ubLowestIndex = 0; - INT16 sMostHits = (INT16)15000; + INT16 sMostHits = (INT16)15000; // Check to see if surface exists already for ( cnt = 0; cnt < guiCurTileCacheSize; cnt++ ) @@ -155,9 +155,9 @@ INT32 GetCachedTile( const STR8 cFilename ) { if ( _stricmp( gpTileCache[ cnt ].zName, cFilename ) == 0 ) { - // Found surface, return - gpTileCache[ cnt ].sHits++; - return( (INT32)cnt ); + // Found surface, return + gpTileCache[ cnt ].sHits++; + return( (INT32)cnt ); } } } @@ -168,11 +168,11 @@ INT32 GetCachedTile( const STR8 cFilename ) // cache out least used file for ( cnt = 0; cnt < guiCurTileCacheSize; cnt++ ) { - if ( gpTileCache[ cnt ].sHits < sMostHits ) - { + if ( gpTileCache[ cnt ].sHits < sMostHits ) + { sMostHits = gpTileCache[ cnt ].sHits; ubLowestIndex = cnt; - } + } } // Bump off lowest index @@ -209,7 +209,7 @@ INT32 GetCachedTile( const STR8 cFilename ) // ATE: Add z-strip info if ( gpTileCache[ cnt ].sStructRefID != -1 ) { - AddZStripInfoToVObject( gpTileCache[ cnt ].pImagery->vo, gpTileCacheStructInfo[ gpTileCache[ cnt ].sStructRefID ].pStructureFileRef, TRUE, 0 ); + AddZStripInfoToVObject( gpTileCache[ cnt ].pImagery->vo, gpTileCacheStructInfo[ gpTileCache[ cnt ].sStructRefID ].pStructureFileRef, TRUE, 0 ); } if ( gpTileCache[ cnt ].pImagery->pAuxData != NULL ) @@ -247,17 +247,17 @@ BOOLEAN RemoveCachedTile( INT32 iCachedTile ) { if ( cnt == (UINT32)iCachedTile ) { - // Found surface, decrement hits - gpTileCache[ cnt ].sHits--; + // Found surface, decrement hits + gpTileCache[ cnt ].sHits--; - // Are we at zero? - if ( gpTileCache[ cnt ].sHits == 0 ) - { + // Are we at zero? + if ( gpTileCache[ cnt ].sHits == 0 ) + { DeleteTileSurface( gpTileCache[ cnt ].pImagery ); gpTileCache[ cnt ].pImagery = NULL; gpTileCache[ cnt ].sStructRefID = -1; return( TRUE );; - } + } } } } @@ -315,7 +315,7 @@ STRUCTURE_FILE_REF *GetCachedTileStructureRefFromFilename( const STR8 cFilename void CheckForAndAddTileCacheStructInfo( LEVELNODE *pNode, INT16 sGridNo, UINT16 usIndex, UINT16 usSubIndex ) -{ +{ STRUCTURE_FILE_REF *pStructureFileRef; pStructureFileRef = GetCachedTileStructureRef( usIndex ); @@ -323,22 +323,22 @@ void CheckForAndAddTileCacheStructInfo( LEVELNODE *pNode, INT16 sGridNo, UINT16 if ( pStructureFileRef != NULL) { if ( !AddStructureToWorld( sGridNo, 0, &( pStructureFileRef->pDBStructureRef[ usSubIndex ] ), pNode ) ) - { - if ( giDefaultStructIndex != -1 ) - { - pStructureFileRef = gpTileCacheStructInfo[ giDefaultStructIndex ].pStructureFileRef; + { + if ( giDefaultStructIndex != -1 ) + { + pStructureFileRef = gpTileCacheStructInfo[ giDefaultStructIndex ].pStructureFileRef; - if ( pStructureFileRef != NULL) - { - AddStructureToWorld( sGridNo, 0, &( pStructureFileRef->pDBStructureRef[ usSubIndex ] ), pNode ); - } - } - } + if ( pStructureFileRef != NULL) + { + AddStructureToWorld( sGridNo, 0, &( pStructureFileRef->pDBStructureRef[ usSubIndex ] ), pNode ); + } + } + } } } void CheckForAndDeleteTileCacheStructInfo( LEVELNODE *pNode, UINT16 usIndex ) -{ +{ STRUCTURE_FILE_REF *pStructureFileRef; if ( usIndex >= TILE_CACHE_START_INDEX ) @@ -380,3 +380,4 @@ void GetRootName( STR8 pDestStr, const STR8 pSrcStr ) } + diff --git a/TileEngine/Tile Surface.cpp b/TileEngine/Tile Surface.cpp index 52f2e11b..1872efde 100644 --- a/TileEngine/Tile Surface.cpp +++ b/TileEngine/Tile Surface.cpp @@ -25,13 +25,13 @@ TILE_IMAGERY *gTileSurfaceArray[ NUMBEROFTILETYPES ]; UINT8 gbDefaultSurfaceUsed[ NUMBEROFTILETYPES ]; UINT8 gbSameAsDefaultSurfaceUsed[ NUMBEROFTILETYPES ]; -TILE_IMAGERY *LoadTileSurface( STR8 cFilename ) +TILE_IMAGERY *LoadTileSurface( STR8 cFilename ) { // Add tile surface - PTILE_IMAGERY pTileSurf = NULL; - VOBJECT_DESC VObjectDesc; - HVOBJECT hVObject; - HIMAGE hImage; + PTILE_IMAGERY pTileSurf = NULL; + VOBJECT_DESC VObjectDesc; + HVOBJECT hVObject; + HIMAGE hImage; SGPFILENAME cStructureFilename; STR cEndOfName; STRUCTURE_FILE_REF * pStructureFileRef; @@ -81,21 +81,21 @@ TILE_IMAGERY *LoadTileSurface( STR8 cFilename ) { DestroyImage( hImage ); DeleteVideoObject( hVObject ); - SET_ERROR( "Structure file error: %s", cStructureFilename ); + SET_ERROR( "Structure file error: %s", cStructureFilename ); return( NULL ); } - + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, cStructureFilename ); - + fOk = AddZStripInfoToVObject( hVObject, pStructureFileRef, FALSE, 0 ); if (fOk == FALSE) { DestroyImage( hImage ); DeleteVideoObject( hVObject ); - SET_ERROR( "ZStrip creation error: %s", cStructureFilename ); + SET_ERROR( "ZStrip creation error: %s", cStructureFilename ); return( NULL ); } - + } else { @@ -134,7 +134,7 @@ TILE_IMAGERY *LoadTileSurface( STR8 cFilename ) // the hImage is no longer needed DestroyImage( hImage ); - return( pTileSurf ); + return( pTileSurf ); } @@ -191,11 +191,11 @@ void SetRaisedObjectFlag( STR8 cFilename, TILE_IMAGERY *pTileSurf ) while( ubRaisedObjectFiles[ cnt ][ 0 ] != '1' ) { if ( _stricmp( ubRaisedObjectFiles[ cnt ], cRootFile ) == 0 ) - { + { pTileSurf->bRaisedObjectType = TRUE; } cnt++; } } -} \ No newline at end of file +} diff --git a/TileEngine/TileDat.cpp b/TileEngine/TileDat.cpp index 8ee3a561..2c4a0ce9 100644 --- a/TileEngine/TileDat.cpp +++ b/TileEngine/TileDat.cpp @@ -109,7 +109,7 @@ INT16 gReverseShadowBuddys[] = SECONDFULLSHADOW, SECONDFULLSHADOW1, SECONDFULLSTRUCT1, THIRDFULLSHADOW, THIRDFULLSHADOW1, THIRDFULLSTRUCT1, FOURTHFULLSHADOW, FOURTHFULLSHADOW1, FOURTHFULLSTRUCT1, - + FIRSTDOORSHADOW, FIRSTDOORSH1, FIRSTDOOR1, SECONDDOORSHADOW, SECONDDOORSH1, SECONDDOOR1, THIRDDOORSHADOW, THIRDDOORSH1, THIRDDOOR1, @@ -150,11 +150,11 @@ INT16 gForwardShadowBuddys[] = SEVENTHOSTRUCT, SEVENTHOSTRUCT1, SEVENTHSHADOW1, EIGHTOSTRUCT, EIGHTOSTRUCT1, EIGHTSHADOW1, - FIRSTFULLSTRUCT, FIRSTFULLSTRUCT1, FIRSTFULLSHADOW1, - SECONDFULLSTRUCT, SECONDFULLSTRUCT1, SECONDFULLSHADOW1, - THIRDFULLSTRUCT, THIRDFULLSTRUCT1, THIRDFULLSHADOW1, - FOURTHFULLSTRUCT, FOURTHFULLSTRUCT1, FOURTHFULLSHADOW1, - + FIRSTFULLSTRUCT, FIRSTFULLSTRUCT1, FIRSTFULLSHADOW1, + SECONDFULLSTRUCT, SECONDFULLSTRUCT1, SECONDFULLSHADOW1, + THIRDFULLSTRUCT, THIRDFULLSTRUCT1, THIRDFULLSHADOW1, + FOURTHFULLSTRUCT, FOURTHFULLSTRUCT1, FOURTHFULLSHADOW1, + FIRSTDOOR, FIRSTDOOR1, FIRSTDOORSH1, SECONDDOOR, SECONDDOOR1, SECONDDOORSH1, THIRDDOOR, THIRDDOOR1, THIRDDOORSH1, @@ -181,45 +181,45 @@ INT16 gForwardShadowBuddys[] = }; // Global variable used to initialize tile database with full tile spec -UINT8 gFullBaseTileValues[] = +UINT8 gFullBaseTileValues[] = -{ +{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // First Texture - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // Second Texture - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // Third Texture - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // Forth Texture - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // Fifth Texture - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // Sixth Texture - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // Seventh Texture - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // Water1 Texture - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // Water2 Texture @@ -404,116 +404,116 @@ STR gTileSurfaceName[NUMBEROFTILETYPES] = UINT16 gNumTilesPerType[ NUMBEROFTILETYPES ] = { - FIRSTTEXTURE35 - FIRSTTEXTURE1 + 1, - SECONDTEXTURE35 - SECONDTEXTURE1 + 1, - THIRDTEXTURE35 - THIRDTEXTURE1 + 1, - FOURTHTEXTURE35 - FOURTHTEXTURE1 + 1, - FIFTHTEXTURE35 - FIFTHTEXTURE1 + 1, - SIXTHTEXTURE37 - SIXTHTEXTURE1 + 1, - SEVENTHTEXTURE49 - SEVENTHTEXTURE1 + 1, - REGWATERTEXTURE50 - REGWATERTEXTURE1 + 1, + FIRSTTEXTURE35 - FIRSTTEXTURE1 + 1, + SECONDTEXTURE35 - SECONDTEXTURE1 + 1, + THIRDTEXTURE35 - THIRDTEXTURE1 + 1, + FOURTHTEXTURE35 - FOURTHTEXTURE1 + 1, + FIFTHTEXTURE35 - FIFTHTEXTURE1 + 1, + SIXTHTEXTURE37 - SIXTHTEXTURE1 + 1, + SEVENTHTEXTURE49 - SEVENTHTEXTURE1 + 1, + REGWATERTEXTURE50 - REGWATERTEXTURE1 + 1, DEEPWATERTEXTURE37 - DEEPWATERTEXTURE1 + 1, - FIRSTCLIFFHANG17 - FIRSTCLIFFHANG1 + 1, - FIRSTCLIFF17 - FIRSTCLIFF1 + 1, + FIRSTCLIFFHANG17 - FIRSTCLIFFHANG1 + 1, + FIRSTCLIFF17 - FIRSTCLIFF1 + 1, FIRSTCLIFFSHADOW17 - FIRSTCLIFFSHADOW1 + 1, // Med hill - FIRSTOSTRUCT12 - FIRSTOSTRUCT1 + 1, - SECONDOSTRUCT12 - SECONDOSTRUCT1 + 1, - THIRDOSTRUCT12 - THIRDOSTRUCT1 + 1, - FOURTHOSTRUCT12 - FOURTHOSTRUCT1 + 1, // Fourth OSTRUCT - FIFTHOSTRUCT12 - FIFTHOSTRUCT1 + 1, // Fifth OSTRUCT - SIXTHOSTRUCT12 - SIXTHOSTRUCT1 + 1, // Sixth OSTRUCT - SEVENTHOSTRUCT12 - SEVENTHOSTRUCT1 + 1, // Seventh OSTRUCT - EIGHTOSTRUCT12 - EIGHTOSTRUCT1 + 1, // Eigth OSTRUCT - FIRSTFULLSTRUCT12 - FIRSTFULLSTRUCT1 + 1, + FIRSTOSTRUCT12 - FIRSTOSTRUCT1 + 1, + SECONDOSTRUCT12 - SECONDOSTRUCT1 + 1, + THIRDOSTRUCT12 - THIRDOSTRUCT1 + 1, + FOURTHOSTRUCT12 - FOURTHOSTRUCT1 + 1, // Fourth OSTRUCT + FIFTHOSTRUCT12 - FIFTHOSTRUCT1 + 1, // Fifth OSTRUCT + SIXTHOSTRUCT12 - SIXTHOSTRUCT1 + 1, // Sixth OSTRUCT + SEVENTHOSTRUCT12 - SEVENTHOSTRUCT1 + 1, // Seventh OSTRUCT + EIGHTOSTRUCT12 - EIGHTOSTRUCT1 + 1, // Eigth OSTRUCT + FIRSTFULLSTRUCT12 - FIRSTFULLSTRUCT1 + 1, SECONDFULLSTRUCT12 - SECONDFULLSTRUCT1 + 1, - THIRDFULLSTRUCT2 - THIRDFULLSTRUCT1 + 1, + THIRDFULLSTRUCT2 - THIRDFULLSTRUCT1 + 1, FOURTHFULLSTRUCT2 - FOURTHFULLSTRUCT1 + 1, - FIRSTSHADOW12 - FIRSTSHADOW1 + 1, - SECONDSHADOW12 - SECONDSHADOW1 + 1, - THIRDSHADOW12 - THIRDSHADOW1 + 1, - FOURTHSHADOW12 - FOURTHSHADOW1 + 1, - FIFTHSHADOW12 - FIFTHSHADOW1 + 1, - SIXTHSHADOW12 - SIXTHSHADOW1 + 1, - SEVENTHSHADOW12 - SEVENTHSHADOW1 + 1, - EIGHTSHADOW12 - EIGHTSHADOW1 + 1, - FIRSTFULLSHADOW12 - FIRSTFULLSHADOW1 + 1, + FIRSTSHADOW12 - FIRSTSHADOW1 + 1, + SECONDSHADOW12 - SECONDSHADOW1 + 1, + THIRDSHADOW12 - THIRDSHADOW1 + 1, + FOURTHSHADOW12 - FOURTHSHADOW1 + 1, + FIFTHSHADOW12 - FIFTHSHADOW1 + 1, + SIXTHSHADOW12 - SIXTHSHADOW1 + 1, + SEVENTHSHADOW12 - SEVENTHSHADOW1 + 1, + EIGHTSHADOW12 - EIGHTSHADOW1 + 1, + FIRSTFULLSHADOW12 - FIRSTFULLSHADOW1 + 1, SECONDFULLSHADOW12 - SECONDFULLSHADOW1 + 1, - THIRDFULLSHADOW2 - THIRDFULLSHADOW1 + 1, + THIRDFULLSHADOW2 - THIRDFULLSHADOW1 + 1, FOURTHFULLSHADOW2 - FOURTHFULLSHADOW1 + 1, - FIRSTWALL65 - FIRSTWALL1 + 1, - SECONDWALL65 - SECONDWALL1 + 1, - THIRDWALL65 - THIRDWALL1 + 1, - FOURTHWALL65 - FOURTHWALL1 + 1, + FIRSTWALL65 - FIRSTWALL1 + 1, + SECONDWALL65 - SECONDWALL1 + 1, + THIRDWALL65 - THIRDWALL1 + 1, + FOURTHWALL65 - FOURTHWALL1 + 1, - FIRSTDOOR20 - FIRSTDOOR1 + 1, - SECONDDOOR20 - SECONDDOOR1 + 1, - THIRDDOOR20 - THIRDDOOR1 + 1, - FOURTHDOOR20 - FOURTHDOOR1 + 1, + FIRSTDOOR20 - FIRSTDOOR1 + 1, + SECONDDOOR20 - SECONDDOOR1 + 1, + THIRDDOOR20 - THIRDDOOR1 + 1, + FOURTHDOOR20 - FOURTHDOOR1 + 1, - FIRSTDOORSH20 - FIRSTDOORSH1 + 1, - SECONDDOORSH20 - SECONDDOORSH1 + 1, - THIRDDOORSH20 - THIRDDOORSH1 + 1, - FOURTHDOORSH20 - FOURTHDOORSH1 + 1, + FIRSTDOORSH20 - FIRSTDOORSH1 + 1, + SECONDDOORSH20 - SECONDDOORSH1 + 1, + THIRDDOORSH20 - THIRDDOORSH1 + 1, + FOURTHDOORSH20 - FOURTHDOORSH1 + 1, - SLANTROOFCEILING2 - SLANTROOFCEILING1 + 1, - ANOTHERDEBRIS10 - ANOTHERDEBRIS1 + 1, - ROADPIECES400 - ROADPIECES001 + 1, - FOURTHWINDOW2 - FOURTHWINDOW1 + 1, + SLANTROOFCEILING2 - SLANTROOFCEILING1 + 1, + ANOTHERDEBRIS10 - ANOTHERDEBRIS1 + 1, + ROADPIECES400 - ROADPIECES001 + 1, + FOURTHWINDOW2 - FOURTHWINDOW1 + 1, - FIRSTDECORATIONS10 - FIRSTDECORATIONS1 + 1, + FIRSTDECORATIONS10 - FIRSTDECORATIONS1 + 1, SECONDDECORATIONS10 - SECONDDECORATIONS1 + 1, - THIRDDECORATIONS10 - THIRDDECORATIONS1 + 1, + THIRDDECORATIONS10 - THIRDDECORATIONS1 + 1, FOURTHDECORATIONS10 - FOURTHDECORATIONS1 + 1, - FIRSTWALLDECAL10 - FIRSTWALLDECAL1 + 1, - SECONDWALLDECAL10 - SECONDWALLDECAL1 + 1, - THIRDWALLDECAL10 - THIRDWALLDECAL1 + 1, - FOURTHWALLDECAL10 - FOURTHWALLDECAL1 + 1, + FIRSTWALLDECAL10 - FIRSTWALLDECAL1 + 1, + SECONDWALLDECAL10 - SECONDWALLDECAL1 + 1, + THIRDWALLDECAL10 - THIRDWALLDECAL1 + 1, + FOURTHWALLDECAL10 - FOURTHWALLDECAL1 + 1, - FIRSTFLOOR8 - FIRSTFLOOR1 + 1, - SECONDFLOOR8 - SECONDFLOOR1 + 1, - THIRDFLOOR8 - THIRDFLOOR1 + 1, - FOURTHFLOOR8 - FOURTHFLOOR1 + 1, + FIRSTFLOOR8 - FIRSTFLOOR1 + 1, + SECONDFLOOR8 - SECONDFLOOR1 + 1, + THIRDFLOOR8 - THIRDFLOOR1 + 1, + FOURTHFLOOR8 - FOURTHFLOOR1 + 1, - FIRSTROOF14 - FIRSTROOF1 + 1, - SECONDROOF14 - SECONDROOF1 + 1, - THIRDROOF14 - THIRDROOF1 + 1, - FOURTHROOF14 - FOURTHROOF1 + 1, - FIRSTSLANTROOF20 - FIRSTSLANTROOF1 + 1, - SECONDSLANTROOF20 - SECONDSLANTROOF1 + 1, + FIRSTROOF14 - FIRSTROOF1 + 1, + SECONDROOF14 - SECONDROOF1 + 1, + THIRDROOF14 - THIRDROOF1 + 1, + FOURTHROOF14 - FOURTHROOF1 + 1, + FIRSTSLANTROOF20 - FIRSTSLANTROOF1 + 1, + SECONDSLANTROOF20 - SECONDSLANTROOF1 + 1, - FIRSTONROOF12 - FIRSTONROOF1 + 1, - SECONDONROOF12 - SECONDONROOF1 + 1, + FIRSTONROOF12 - FIRSTONROOF1 + 1, + SECONDONROOF12 - SECONDONROOF1 + 1, 1, - FIRSTISTRUCT24 - FIRSTISTRUCT1 + 1, - SECONDISTRUCT24 - SECONDISTRUCT1 + 1, - THIRDISTRUCT24 - THIRDISTRUCT1 + 1, - FOURTHISTRUCT24 - FOURTHISTRUCT1 + 1, - FIRSTCISTRUCT24 - FIRSTCISTRUCT1 + 1, + FIRSTISTRUCT24 - FIRSTISTRUCT1 + 1, + SECONDISTRUCT24 - SECONDISTRUCT1 + 1, + THIRDISTRUCT24 - THIRDISTRUCT1 + 1, + FOURTHISTRUCT24 - FOURTHISTRUCT1 + 1, + FIRSTCISTRUCT24 - FIRSTCISTRUCT1 + 1, - FIRSTROAD35 - FIRSTROAD1 + 1, + FIRSTROAD35 - FIRSTROAD1 + 1, - DEBRISROCKS10 - DEBRISROCKS1 + 1, - DEBRISWOOD10 - DEBRISWOOD1 + 1, - DEBRISWEEDS10 - DEBRISWEEDS1 + 1, - DEBRISGRASS10 - DEBRISGRASS1 + 1, - DEBRISSAND10 - DEBRISSAND1 + 1, - DEBRISMISC10 - DEBRISMISC1 + 1, + DEBRISROCKS10 - DEBRISROCKS1 + 1, + DEBRISWOOD10 - DEBRISWOOD1 + 1, + DEBRISWEEDS10 - DEBRISWEEDS1 + 1, + DEBRISGRASS10 - DEBRISGRASS1 + 1, + DEBRISSAND10 - DEBRISSAND1 + 1, + DEBRISMISC10 - DEBRISMISC1 + 1, - ANIOSTRUCT20 - ANIOSTRUCT1 + 1, - FENCESTRUCT23 - FENCESTRUCT1 + 1, - FENCESHADOW23 - FENCESHADOW1 + 1, + ANIOSTRUCT20 - ANIOSTRUCT1 + 1, + FENCESTRUCT23 - FENCESTRUCT1 + 1, + FENCESHADOW23 - FENCESHADOW1 + 1, FIRSTVEHICLE12 - FIRSTVEHICLE1 + 1, SECONDVEHICLE12 - SECONDVEHICLE1 + 1, FIRSTVEHICLESHADOW12 - FIRSTVEHICLESHADOW1 + 1, SECONDVEHICLESHADOW12 - SECONDVEHICLESHADOW1 + 1, - DEBRIS2MISC10 - DEBRIS2MISC1 + 1, + DEBRIS2MISC10 - DEBRIS2MISC1 + 1, FIRSTDEBRISSTRUCT10 - FIRSTDEBRISSTRUCT1 + 1, SECONDDEBRISSTRUCT10 - SECONDDEBRISSTRUCT1 + 1, @@ -540,10 +540,10 @@ UINT16 gNumTilesPerType[ NUMBEROFTILETYPES ] = FIRSTHIGHROOF15 - FIRSTHIGHROOF1 + 1, SECONDHIGHROOF15 - SECONDHIGHROOF1 + 1, - FIFTHWALLDECAL10 - FIFTHWALLDECAL1 + 1, - SIXTHWALLDECAL10 - SIXTHWALLDECAL1 + 1, + FIFTHWALLDECAL10 - FIFTHWALLDECAL1 + 1, + SIXTHWALLDECAL10 - SIXTHWALLDECAL1 + 1, SEVENTHWALLDECAL10 - SEVENTHWALLDECAL1 + 1, - EIGTHWALLDECAL10 - EIGTHWALLDECAL1 + 1, + EIGTHWALLDECAL10 - EIGTHWALLDECAL1 + 1, HUMANBLOOD16 - HUMANBLOOD1 + 1, CREATUREBLOOD16 - CREATUREBLOOD1 + 1, @@ -554,39 +554,39 @@ UINT16 gNumTilesPerType[ NUMBEROFTILETYPES ] = FIRSTREVEALEDHIGHROOFS11 - FIRSTREVEALEDHIGHROOFS1 + 1, SECONDREVEALEDHIGHROOFS11 - SECONDREVEALEDHIGHROOFS1 + 1, - GUN5000 - GUN1 + 1, - P1ITEM5000 - P1ITEM1 + 1, - P2ITEM5000 - P2ITEM1 + 1, + GUN5000 - GUN1 + 1, + P1ITEM5000 - P1ITEM1 + 1, + P2ITEM5000 - P2ITEM1 + 1, - WINDOWSHATTER20 - WINDOWSHATTER1 + 1, - P3ITEM5000 - P3ITEM1 + 1, - BODYEXPLOSION15 - BODYEXPLOSION1 + 1, + WINDOWSHATTER20 - WINDOWSHATTER1 + 1, + P3ITEM5000 - P3ITEM1 + 1, + BODYEXPLOSION15 - BODYEXPLOSION1 + 1, - EXITTEXTURE35 - EXITTEXTURE1 + 1, - FOOTPRINTS80 - FOOTPRINTS1 + 1, + EXITTEXTURE35 - EXITTEXTURE1 + 1, + FOOTPRINTS80 - FOOTPRINTS1 + 1, - FIRSTPOINTERS24 - FIRSTPOINTERS1 + 1, - SECONDPOINTERS8 - SECONDPOINTERS1 + 1, - THIRDPOINTERS3 - THIRDPOINTERS1 + 1, + FIRSTPOINTERS24 - FIRSTPOINTERS1 + 1, + SECONDPOINTERS8 - SECONDPOINTERS1 + 1, + THIRDPOINTERS3 - THIRDPOINTERS1 + 1, - GOODRUN11 - GOODRUN1 + 1, - GOODWALK11 - GOODWALK1 + 1, - GOODSWAT11 - GOODSWAT1 + 1, - GOODPRONE11 - GOODPRONE1 + 1, - CONFIRMMOVE11 - CONFIRMMOVE1 + 1, - VEHICLEMOVE10 - VEHICLEMOVE1 + 1, - ACTIONTWO11 - ACTIONTWO1 + 1, - BADMARKER11 - BADMARKER1 + 1, - GOODRING10 - GOODRING1 + 1, - ROTATINGKEY8 - ROTATINGKEY1 + 1, - SELRING10 - SELRING1 + 1, - SPECIALTILE_COVER_5 - SPECIALTILE_MAPEXIT + 1, - BULLETTILE2 - BULLETTILE1 + 1, + GOODRUN11 - GOODRUN1 + 1, + GOODWALK11 - GOODWALK1 + 1, + GOODSWAT11 - GOODSWAT1 + 1, + GOODPRONE11 - GOODPRONE1 + 1, + CONFIRMMOVE11 - CONFIRMMOVE1 + 1, + VEHICLEMOVE10 - VEHICLEMOVE1 + 1, + ACTIONTWO11 - ACTIONTWO1 + 1, + BADMARKER11 - BADMARKER1 + 1, + GOODRING10 - GOODRING1 + 1, + ROTATINGKEY8 - ROTATINGKEY1 + 1, + SELRING10 - SELRING1 + 1, + SPECIALTILE_COVER_5 - SPECIALTILE_MAPEXIT + 1, + BULLETTILE2 - BULLETTILE1 + 1, - FIRSTMISS5 - FIRSTMISS1 + 1, - SECONDMISS5 - SECONDMISS1 + 1, - THIRDMISS14 - THIRDMISS1 + 1, - WIREFRAMES15 - WIREFRAMES1 + 1 + FIRSTMISS5 - FIRSTMISS1 + 1, + SECONDMISS5 - SECONDMISS1 + 1, + THIRDMISS14 - THIRDMISS1 + 1, + WIREFRAMES15 - WIREFRAMES1 + 1 }; UINT8 gTileTypeLogicalHeight[ NUMBEROFTILETYPES ] = @@ -639,10 +639,10 @@ void SetSpecificDatabaseValues( UINT16 usType, UINT16 uiDatabaseElem, TILE_ELEME cnt+=3; }; - - if ( uiDatabaseElem >= FIRSTDOOR1 && - uiDatabaseElem <= FOURTHDOORSH20 ) + + if ( uiDatabaseElem >= FIRSTDOOR1 && + uiDatabaseElem <= FOURTHDOORSH20 ) { // Door anims // Open @@ -720,7 +720,7 @@ void SetSpecificDatabaseValues( UINT16 usType, UINT16 uiDatabaseElem, TILE_ELEME }; } - if ( uiDatabaseElem == FIRSTMISS1 ) + if ( uiDatabaseElem == FIRSTMISS1 ) { // Allocate Animated tile data AllocateAnimTileData( TileElement, 5 ); @@ -732,14 +732,14 @@ void SetSpecificDatabaseValues( UINT16 usType, UINT16 uiDatabaseElem, TILE_ELEME } } - if ( uiDatabaseElem >= FIRSTMISS1 && - uiDatabaseElem <= FIRSTMISS5 ) - { + if ( uiDatabaseElem >= FIRSTMISS1 && + uiDatabaseElem <= FIRSTMISS5 ) + { TileElement->uiFlags |= DYNAMIC_TILE; } - if ( uiDatabaseElem == WINDOWSHATTER1 || uiDatabaseElem == WINDOWSHATTER6 || uiDatabaseElem == WINDOWSHATTER11 || uiDatabaseElem == WINDOWSHATTER16 ) + if ( uiDatabaseElem == WINDOWSHATTER1 || uiDatabaseElem == WINDOWSHATTER6 || uiDatabaseElem == WINDOWSHATTER11 || uiDatabaseElem == WINDOWSHATTER16 ) { // Allocate Animated tile data AllocateAnimTileData( TileElement, 5 ); @@ -751,19 +751,19 @@ void SetSpecificDatabaseValues( UINT16 usType, UINT16 uiDatabaseElem, TILE_ELEME } } - if ( uiDatabaseElem >= WINDOWSHATTER1 && - uiDatabaseElem <= WINDOWSHATTER20 ) - { + if ( uiDatabaseElem >= WINDOWSHATTER1 && + uiDatabaseElem <= WINDOWSHATTER20 ) + { TileElement->uiFlags |= DYNAMIC_TILE; } // if ( usType == FIRSTEXPLOSION ) -// { +// { // TileElement->uiFlags |= DYNAMIC_TILE; // } if ( usType == BODYEXPLOSION ) - { + { TileElement->uiFlags |= DYNAMIC_TILE; } @@ -774,22 +774,22 @@ void SetSpecificDatabaseValues( UINT16 usType, UINT16 uiDatabaseElem, TILE_ELEME // SET FLAGS FOR OBJECTS PEICES WHICH USE PROPER Z if ( fUseRaisedObjectType ) - { + { TileElement->uiFlags |= OBJECTLAYER_USEZHEIGHT; } - + // OFFSET SLANTED ROOFS TO HEIGHT OF WALLS - if ( uiDatabaseElem >= FIRSTROOF1 && - uiDatabaseElem <= SECONDSLANTROOF20 ) - { + if ( uiDatabaseElem >= FIRSTROOF1 && + uiDatabaseElem <= SECONDSLANTROOF20 ) + { //TileElement->sOffsetHeight = WALL_HEIGHT; } // Set flag for full 3d tiles, as well as the dynamic flag for the folliage - if ( uiDatabaseElem >= FIRSTFULLSTRUCT1 && - uiDatabaseElem <= SECONDFULLSTRUCT12 ) - { + if ( uiDatabaseElem >= FIRSTFULLSTRUCT1 && + uiDatabaseElem <= SECONDFULLSTRUCT12 ) + { //TileElement->uiFlags |= FULL3D_TILE; sIndexDiff = uiDatabaseElem - gTileTypeStartIndex[ usType ]; @@ -808,9 +808,9 @@ void SetSpecificDatabaseValues( UINT16 usType, UINT16 uiDatabaseElem, TILE_ELEME } //Ignore height for cliffs ie: if we rasie the land, do not offset the cliff - if ( uiDatabaseElem >= FIRSTCLIFFHANG1 && - uiDatabaseElem <= FIRSTCLIFFSHADOW17 ) - { + if ( uiDatabaseElem >= FIRSTCLIFFHANG1 && + uiDatabaseElem <= FIRSTCLIFFSHADOW17 ) + { if ( usType == FIRSTCLIFFHANG ) { TileElement->uiFlags |= CLIFFHANG_TILE; @@ -819,20 +819,20 @@ void SetSpecificDatabaseValues( UINT16 usType, UINT16 uiDatabaseElem, TILE_ELEME } - if ( uiDatabaseElem >= FIRSTWALL1 && - uiDatabaseElem <= FOURTHWALL65 ) - { + if ( uiDatabaseElem >= FIRSTWALL1 && + uiDatabaseElem <= FOURTHWALL65 ) + { TileElement->uiFlags |= WALL_TILE; } // Set a-frames heigher! - if ( uiDatabaseElem >= FIRSTWALL1 && - uiDatabaseElem <= FOURTHWALL47 ) - { + if ( uiDatabaseElem >= FIRSTWALL1 && + uiDatabaseElem <= FOURTHWALL47 ) + { // Set these ones higher ( for roof pieces ) - if ( uiDatabaseElem >= ( gTileTypeStartIndex[ usType ] + WALL_AFRAME_START ) && - uiDatabaseElem <= ( gTileTypeStartIndex[ usType ] + WALL_AFRAME_END ) ) + if ( uiDatabaseElem >= ( gTileTypeStartIndex[ usType ] + WALL_AFRAME_START ) && + uiDatabaseElem <= ( gTileTypeStartIndex[ usType ] + WALL_AFRAME_END ) ) { //TileElement->sOffsetHeight = WALL_HEIGHT; TileElement->uiFlags |= AFRAME_TILE; @@ -842,32 +842,32 @@ void SetSpecificDatabaseValues( UINT16 usType, UINT16 uiDatabaseElem, TILE_ELEME } // Set UI Elements to be dynamic - if ( uiDatabaseElem >= FOOTPRINTS1 && - uiDatabaseElem <= THIRDPOINTERS2 ) - { + if ( uiDatabaseElem >= FOOTPRINTS1 && + uiDatabaseElem <= THIRDPOINTERS2 ) + { TileElement->uiFlags |= DYNAMIC_TILE; TileElement->uiFlags |= OBJECTLAYER_USEZHEIGHT; } // Set UI Elements to use object z level - if ( usType >= FOOTPRINTS && - usType <= LASTUIELEM ) - { + if ( usType >= FOOTPRINTS && + usType <= LASTUIELEM ) + { TileElement->uiFlags |= OBJECTLAYER_USEZHEIGHT; } // Set UI Elements to use object z level - if ( usType >= HUMANBLOOD && - usType <= CREATUREBLOOD ) - { + if ( usType >= HUMANBLOOD && + usType <= CREATUREBLOOD ) + { TileElement->uiFlags |= OBJECTLAYER_USEZHEIGHT; } // Set UI Elements to use object z level - if ( usType >= GUNS && - usType <= P2ITEMS ) - { + if ( usType >= GUNS && + usType <= P2ITEMS ) + { TileElement->uiFlags |= OBJECTLAYER_USEZHEIGHT; } if ( usType == P3ITEMS ) @@ -880,39 +880,39 @@ void SetSpecificDatabaseValues( UINT16 usType, UINT16 uiDatabaseElem, TILE_ELEME TileElement->uiFlags |= OBJECTLAYER_USEZHEIGHT; } - if ( uiDatabaseElem >= FIRSTDOOR1 && - uiDatabaseElem <= FOURTHDOORSH20 ) - { + if ( uiDatabaseElem >= FIRSTDOOR1 && + uiDatabaseElem <= FOURTHDOORSH20 ) + { //TileElement->uiFlags |= DYNAMIC_TILE; } // Set UI Elements to be dynamic - if ( uiDatabaseElem == MOCKFLOOR1 ) - { + if ( uiDatabaseElem == MOCKFLOOR1 ) + { TileElement->uiFlags |= DYNAMIC_TILE; } - if ( usType == BULLETTILE ) - { + if ( usType == BULLETTILE ) + { TileElement->uiFlags |= DYNAMIC_TILE; } - if ( usType == WIREFRAMES ) - { + if ( usType == WIREFRAMES ) + { //TileElement->uiFlags |= DYNAMIC_TILE; } // Set full tile flag for floors - if ( uiDatabaseElem >= FIRSTFLOOR1 && - uiDatabaseElem <= FOURTHFLOOR8 ) - { + if ( uiDatabaseElem >= FIRSTFLOOR1 && + uiDatabaseElem <= FOURTHFLOOR8 ) + { TileElement->ubFullTile = 1; } if ( uiDatabaseElem >= FIRSTTEXTURE1 && - uiDatabaseElem <= DEEPWATERTEXTURE10 ) + uiDatabaseElem <= DEEPWATERTEXTURE10 ) { // Set tile 'fullness' attribute TileElement->ubFullTile = gFullBaseTileValues[ uiDatabaseElem ]; @@ -925,7 +925,7 @@ void SetSpecificDatabaseValues( UINT16 usType, UINT16 uiDatabaseElem, TILE_ELEME } if ( uiDatabaseElem >= REGWATERTEXTURE18 && uiDatabaseElem <= REGWATERTEXTURE50 || uiDatabaseElem == REGWATERTEXTURE || - uiDatabaseElem == REGWATERTEXTURE12 || uiDatabaseElem == REGWATERTEXTURE14 || uiDatabaseElem == REGWATERTEXTURE16 ) + uiDatabaseElem == REGWATERTEXTURE12 || uiDatabaseElem == REGWATERTEXTURE14 || uiDatabaseElem == REGWATERTEXTURE16 ) { TileElement->ubTerrainID = FLAT_GROUND; } @@ -936,3 +936,4 @@ void SetSpecificDatabaseValues( UINT16 usType, UINT16 uiDatabaseElem, TILE_ELEME } } + diff --git a/TileEngine/TileDat.h b/TileEngine/TileDat.h index 30edb004..217dcf62 100644 --- a/TileEngine/TileDat.h +++ b/TileEngine/TileDat.h @@ -3225,7 +3225,7 @@ enum TileTypeDefines // Quick defines for finding last type entry in tile types #define LASTTEXTURE (DEEPWATERTEXTURE - 1) #define LASTBANKS (FIRSTCLIFFSHADOW - 1) -#define LASTCLIFFHANG (FIRSTCLIFF-1) +#define LASTCLIFFHANG (FIRSTCLIFF-1) #define LASTCLIFFSHADOW (FIRSTOSTRUCT - 1) #define LASTOSTRUCT (THIRDFULLSTRUCT - 1) #define LASTSHADOW (FIRSTWALL - 1) @@ -3245,7 +3245,7 @@ enum TileTypeDefines //#define LASTDEBRIS (FOOTPRINTS - 1) #define LASTFOOTPRINTS (FIRSTPOINTERS - 1) #define LASTPOINTERS (SELRING - 1) -#define LASTUIELEM (WIREFRAMES - 1) // Change this entry if adding new types to the end +#define LASTUIELEM (WIREFRAMES - 1) // Change this entry if adding new types to the end #define LASTTIELSETELEM (GUNS - 1) //=========================================================================== @@ -3253,10 +3253,10 @@ enum TileTypeDefines // DEFINES FOR SPECIFIC SPECIAL TILE SLOTS #define WALL_AFRAME_START 31 #define WALL_AFRAME_END 34 -#define WALL_AFRAME1 31 -#define WALL_AFRAME2 32 -#define WALL_AFRAME3 33 -#define WALL_AFRAME4 34 +#define WALL_AFRAME1 31 +#define WALL_AFRAME2 32 +#define WALL_AFRAME3 33 +#define WALL_AFRAME4 34 extern INT16 gOpenDoorList[20]; diff --git a/TileEngine/TileEngine All.h b/TileEngine/TileEngine All.h index 871daa40..86b3557c 100644 --- a/TileEngine/TileEngine All.h +++ b/TileEngine/TileEngine All.h @@ -94,7 +94,7 @@ #include "math.h" #include #include -#include "input.h" +#include "input.h" #include "video.h" #include "vobject_blitters.h" #include "edit_sys.h" diff --git a/TileEngine/TileEngine_2005Express.vcproj b/TileEngine/TileEngine_2005Express.vcproj index 61dc8511..a1dd599e 100644 --- a/TileEngine/TileEngine_2005Express.vcproj +++ b/TileEngine/TileEngine_2005Express.vcproj @@ -1,7 +1,7 @@ - + + + + + + + + + + + + + + + + + + @@ -224,6 +286,10 @@ RelativePath=".\Render Fun.h" > + + @@ -382,6 +448,10 @@ RelativePath=".\Render Fun.cpp" > + + diff --git a/TileEngine/World Tileset Enums.h b/TileEngine/World Tileset Enums.h index d48ef0dc..03f492e2 100644 --- a/TileEngine/World Tileset Enums.h +++ b/TileEngine/World Tileset Enums.h @@ -6,7 +6,7 @@ enum { - TLS_GENERIC_1, // 0, JA2 default + TLS_GENERIC_1, // 0, JA2 default TLS_CAVES_1, TLS_DESERT_1, TLS_LUSH_1, @@ -17,7 +17,7 @@ enum TLS_FARM_1, TLS_OMERTA, - TLS_GENERIC_2, // 10 + TLS_GENERIC_2, // 10 TLS_FARM_2, TLS_PRISON, TLS_HOSPITAL, @@ -28,7 +28,7 @@ enum TLS_LAWLESS_2, TLS_DEAD_AIRSTRIP, - TLS_BASEMENT, // 20 + TLS_BASEMENT, // 20 TLS_LAWLESS_3, TLS_PRISON_DUNGEON, TLS_ACTIVE_DRASSEN, @@ -39,7 +39,7 @@ enum TLS_MILITARY_WAREHOUSE, TLS_MILITARY_TOWN, - TLS_OLD_SCHOOL, // 30 + TLS_OLD_SCHOOL, // 30 TLS_CAMBRIA_STRIP, TLS_CAMBRIA_HOMES, TLS_PALACE, @@ -50,7 +50,7 @@ enum TLS_BALIME_MUSEUM, TLS_DESERT_SAM, - TLS_ORTA, // 40 + TLS_ORTA, // 40 TLS_ORTA_WEAPONS, TLS_SWAMP_BARETREES, TLS_ESTONI, @@ -61,7 +61,7 @@ enum TLS_QUEENS_AIRPORT, TLS_DEMO_TILESET, - TLS_HEAVY_SNOW, // 50, JA2.5 default + TLS_HEAVY_SNOW, // 50, JA2.5 default TLS_MIXED_SNOW, TLS_GRASS_SNOW, TLS_FALL_TOWN, @@ -72,7 +72,7 @@ enum TLS_UPPER_COMPLEX, TLS_LOWEST_LEVEL_COMPLEX, - TILESET_60, // 60 + TILESET_60, // 60 TILESET_61, TILESET_62, TILESET_63, @@ -83,7 +83,7 @@ enum TILESET_68, TILESET_69, - NUM_TILESETS // 70 + NUM_TILESETS // 70 }; #endif \ No newline at end of file diff --git a/TileEngine/WorldDat.cpp b/TileEngine/WorldDat.cpp index 23bd50df..4280dafd 100644 --- a/TileEngine/WorldDat.cpp +++ b/TileEngine/WorldDat.cpp @@ -24,7 +24,7 @@ void SetTilesetFourTerrainValues(); // where it is read from JA2SET.DAT header. UINT8 gubNumSets = MAX_TILESETS; -TILESET gTilesets[ MAX_TILESETS ]; +TILESET gTilesets[ MAX_TILESETS ]; void InitEngineTilesets( ) @@ -38,13 +38,13 @@ void InitEngineTilesets( ) //OPEN FILE // hfile = fopen( "BINARYDATA\\JA2SET.DAT", "rb" ); hfile = FileOpen( "BINARYDATA\\JA2SET.DAT", FILE_ACCESS_READ, FALSE ); - if ( !hfile ) + if ( !hfile ) { SET_ERROR( "Cannot open tileset data file" ); return; } - + // READ # TILESETS and compare // fread( &gubNumSets, sizeof( gubNumSets ), 1, hfile ); FileRead( hfile, &gubNumSets, sizeof( gubNumSets ), &uiNumBytesRead ); @@ -80,7 +80,7 @@ void InitEngineTilesets( ) // fread( &(gTilesets[ cnt ].ubAmbientID), sizeof( UINT8), 1, hfile ); FileRead( hfile, &(gTilesets[ cnt ].ubAmbientID), sizeof( UINT8 ), &uiNumBytesRead ); - // Set into tileset + // Set into tileset swprintf( gTilesets[ cnt ].zName, L"%S", zName ); // Loop for files diff --git a/TileEngine/WorldDat.h b/TileEngine/WorldDat.h index 432c68d9..f70dfa3f 100644 --- a/TileEngine/WorldDat.h +++ b/TileEngine/WorldDat.h @@ -20,9 +20,9 @@ typedef struct // Snap: The maximum number of tilesets allowed is max of UINT8 #define MAX_TILESETS 255 -extern UINT8 gubNumSets; // from WorldDat.cpp +extern UINT8 gubNumSets; // from WorldDat.cpp -extern TILESET gTilesets[ MAX_TILESETS ]; +extern TILESET gTilesets[ MAX_TILESETS ]; void InitEngineTilesets( ); diff --git a/TileEngine/XML_ExplosionData.cpp b/TileEngine/XML_ExplosionData.cpp index 9a8607cc..9dab1344 100644 --- a/TileEngine/XML_ExplosionData.cpp +++ b/TileEngine/XML_ExplosionData.cpp @@ -6,7 +6,7 @@ #else #include #include - #include "explosion control.h" + #include "explosion control.h" #include "TopicIDs.h" #include "TopicOps.h" #include "Debug.h" @@ -23,7 +23,7 @@ struct CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; - EXPLOSION_DATA expData; + EXPLOSION_DATA expData; INT32 maxArraySize; INT32 curIndex; INT32 currentDepth; @@ -31,7 +31,7 @@ struct } typedef explosionDataParseData; -static void XMLCALL +static void XMLCALL explosionDataStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { explosionDataParseData * pData = (explosionDataParseData *)userData; @@ -50,7 +50,7 @@ explosionDataStartElementHandle(void *userData, const XML_Char *name, const XML_ //DebugMsg(TOPIC_JA2, DBG_LEVEL_3,"MergeStartElementHandle: setting memory for curMerge"); - memset(&(pData->expData),0,sizeof(EXPLOSION_DATA)); + memset(&(pData->expData),0,sizeof(EXPLOSION_DATA)); pData->maxReadDepth++; //we are not skipping this element pData->curIndex++; @@ -59,8 +59,8 @@ explosionDataStartElementHandle(void *userData, const XML_Char *name, const XML_ (strcmp(name, "TransKeyFrame") == 0 || strcmp(name, "DamageKeyFrame") == 0 || strcmp(name, "ExplosionSoundID") == 0 || - strcmp(name, "AltExplosionSoundID") == 0 || - strcmp(name, "BlastFilename") == 0 || + strcmp(name, "AltExplosionSoundID") == 0 || + strcmp(name, "BlastFilename") == 0 || strcmp(name, "BlastSpeed") == 0 )) { pData->curElement = ELEMENT_PROPERTY; @@ -80,9 +80,9 @@ explosionDataCharacterDataHandle(void *userData, const XML_Char *str, int len) { explosionDataParseData * pData = (explosionDataParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); } } @@ -105,41 +105,41 @@ explosionDataEndElementHandle(void *userData, const XML_Char *name) if(pData->curIndex < pData->maxArraySize) { - memcpy( &(gExpAniData[pData->curIndex]), &(pData->expData), sizeof(EXPLOSION_DATA) ); + memcpy( &(gExpAniData[pData->curIndex]), &(pData->expData), sizeof(EXPLOSION_DATA) ); } } else if(strcmp(name, "TransKeyFrame") == 0) { pData->curElement = ELEMENT; - pData->expData.ubTransKeyFrame = (UINT8) atol(pData->szCharData); + pData->expData.ubTransKeyFrame = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "DamageKeyFrame") == 0) { pData->curElement = ELEMENT; - pData->expData.ubDamageKeyFrame = (UINT8) atol(pData->szCharData); + pData->expData.ubDamageKeyFrame = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "ExplosionSoundID") == 0) { pData->curElement = ELEMENT; - pData->expData.uiExplosionSoundID = (UINT32) atol(pData->szCharData); + pData->expData.uiExplosionSoundID = (UINT32) atol(pData->szCharData); } else if(strcmp(name, "AltExplosionSoundID") == 0) { pData->curElement = ELEMENT; - pData->expData.uiAltExplosionSoundID = (UINT32) atol(pData->szCharData); + pData->expData.uiAltExplosionSoundID = (UINT32) atol(pData->szCharData); } else if(strcmp(name, "BlastFilename") == 0) { pData->curElement = ELEMENT; - // Lesh: maybe it is needed to check lenght of the pData->szCharData string - // and warn user, otherwise game behavior is unexpected when trying to - // play animation from clipped filename (runtime error, crash ???) - strncpy(pData->expData.zBlastFilename, pData->szCharData, MAX_BLAST_FILENAME_LEN); + // Lesh: maybe it is needed to check lenght of the pData->szCharData string + // and warn user, otherwise game behavior is unexpected when trying to + // play animation from clipped filename (runtime error, crash ???) + strncpy(pData->expData.zBlastFilename, pData->szCharData, MAX_BLAST_FILENAME_LEN); } else if(strcmp(name, "BlastSpeed") == 0) { pData->curElement = ELEMENT; - pData->expData.sBlastSpeed = (UINT8) atol(pData->szCharData); + pData->expData.sBlastSpeed = (UINT8) atol(pData->szCharData); } pData->maxReadDepth--; @@ -158,7 +158,7 @@ BOOLEAN ReadInExplosionDataStats(STR fileName) UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + explosionDataParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading ExplosionData.xml" ); @@ -167,7 +167,7 @@ BOOLEAN ReadInExplosionDataStats(STR fileName) hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -182,19 +182,19 @@ BOOLEAN ReadInExplosionDataStats(STR fileName) FileClose( hFile ); - + XML_SetElementHandler(parser, explosionDataStartElementHandle, explosionDataEndElementHandle); XML_SetCharacterDataHandler(parser, explosionDataCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); - pData.maxArraySize = NUM_EXP_TYPES; + pData.maxArraySize = NUM_EXP_TYPES; pData.curIndex = -1; - + XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -221,21 +221,21 @@ BOOLEAN WriteExplosionDataStats() hFile = FileOpen( "TABLEDATA\\ExplosionData out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; FilePrintf(hFile,"\r\n"); - for(cnt = 0;cnt < NUM_EXP_TYPES;cnt++) + for(cnt = 0;cnt < NUM_EXP_TYPES;cnt++) { FilePrintf(hFile,"\t\r\n"); - FilePrintf(hFile,"\t\t%d\r\n", gExpAniData[cnt].ubTransKeyFrame); - FilePrintf(hFile,"\t\t%d\r\n", gExpAniData[cnt].ubDamageKeyFrame); - FilePrintf(hFile,"\t\t%d\r\n", gExpAniData[cnt].uiExplosionSoundID); - FilePrintf(hFile,"\t\t%d\r\n", gExpAniData[cnt].uiAltExplosionSoundID); - FilePrintf(hFile,"\t\t%s\r\n", gExpAniData[cnt].zBlastFilename); - FilePrintf(hFile,"\t\t%d\r\n", gExpAniData[cnt].sBlastSpeed); + FilePrintf(hFile,"\t\t%d\r\n", gExpAniData[cnt].ubTransKeyFrame); + FilePrintf(hFile,"\t\t%d\r\n", gExpAniData[cnt].ubDamageKeyFrame); + FilePrintf(hFile,"\t\t%d\r\n", gExpAniData[cnt].uiExplosionSoundID); + FilePrintf(hFile,"\t\t%d\r\n", gExpAniData[cnt].uiAltExplosionSoundID); + FilePrintf(hFile,"\t\t%s\r\n", gExpAniData[cnt].zBlastFilename); + FilePrintf(hFile,"\t\t%d\r\n", gExpAniData[cnt].sBlastSpeed); FilePrintf(hFile,"\t\r\n"); } @@ -244,4 +244,4 @@ BOOLEAN WriteExplosionDataStats() FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/TileEngine/environment.cpp b/TileEngine/environment.cpp index 131efb27..ccce9848 100644 --- a/TileEngine/environment.cpp +++ b/TileEngine/environment.cpp @@ -5,7 +5,7 @@ #include "lighting.h" #include "environment.h" #include "renderworld.h" - #include "sound control.h" + #include "Sound Control.h" #include "overhead.h" #include "Game Clock.h" #include "quests.h" @@ -28,37 +28,37 @@ #include "Text.h" -//effects whether or not time of day effects the lighting. Underground +//effects whether or not time of day effects the lighting. Underground //maps have an ambient light level that is saved in the map, and doesn't change. BOOLEAN gfBasement = FALSE; BOOLEAN gfCaves = FALSE; -#define ENV_TOD_FLAGS_DAY 0x00000001 -#define ENV_TOD_FLAGS_DAWN 0x00000002 -#define ENV_TOD_FLAGS_DUSK 0x00000004 -#define ENV_TOD_FLAGS_NIGHT 0x00000008 +#define ENV_TOD_FLAGS_DAY 0x00000001 +#define ENV_TOD_FLAGS_DAWN 0x00000002 +#define ENV_TOD_FLAGS_DUSK 0x00000004 +#define ENV_TOD_FLAGS_NIGHT 0x00000008 /* #define DAWNLIGHT_START ( 5 * 60 ) #define DAWN_START ( 6 * 60 ) -#define DAY_START ( 8 * 60 ) +#define DAY_START ( 8 * 60 ) #define TWILLIGHT_START ( 19 * 60 ) #define DUSK_START ( 20 * 60 ) -#define NIGHT_START ( 22 * 60 ) +#define NIGHT_START ( 22 * 60 ) */ #define DAWN_START ( 6 * 60 + 47 ) //6:47AM -#define DAY_START ( 7 * 60 + 5 ) //7:05AM +#define DAY_START ( 7 * 60 + 5 ) //7:05AM #define DUSK_START ( 20 * 60 + 57 ) //8:57PM -#define NIGHT_START ( 21 * 60 + 15 ) //9:15PM +#define NIGHT_START ( 21 * 60 + 15 ) //9:15PM #define DAWN_TO_DAY (DAY_START-DAWN_START) #define DAY_TO_DUSK (DUSK_START-DAY_START) #define DUSK_TO_NIGHT (NIGHT_START-DUSK_START) #define NIGHT_TO_DAWN (24*60-NIGHT_START+DAWN_START) -UINT32 guiEnvWeather = 0; -UINT32 guiRainLoop = NO_SAMPLE; +UINT32 guiEnvWeather = 0; +UINT32 guiRainLoop = NO_SAMPLE; // frame cues for lightning @@ -84,7 +84,7 @@ UINT8 ubLightningTable[3][10][2]= {7, 6}, {8, 0}, {9, 0} }, - + { {0, 15}, {1, 0}, {2, 15}, @@ -96,8 +96,8 @@ UINT8 ubLightningTable[3][10][2]= {8, 0}, {9, 0} } }; -// CJC: I don't think these are used anywhere! -UINT8 guiTODFlags[ENV_NUM_TIMES] = { +// CJC: I don't think these are used anywhere! +UINT8 guiTODFlags[ENV_NUM_TIMES] = { ENV_TOD_FLAGS_NIGHT, // 00 ENV_TOD_FLAGS_NIGHT, // 01 ENV_TOD_FLAGS_NIGHT, // 02 @@ -106,12 +106,12 @@ UINT8 guiTODFlags[ENV_NUM_TIMES] = { ENV_TOD_FLAGS_DAWN, // 05 ENV_TOD_FLAGS_DAWN, // 06 ENV_TOD_FLAGS_DAWN, // 07 - ENV_TOD_FLAGS_DAY, // 08 - ENV_TOD_FLAGS_DAY, // 09 - ENV_TOD_FLAGS_DAY, // 10 - ENV_TOD_FLAGS_DAY, // 11 + ENV_TOD_FLAGS_DAY, // 08 + ENV_TOD_FLAGS_DAY, // 09 + ENV_TOD_FLAGS_DAY, // 10 + ENV_TOD_FLAGS_DAY, // 11 ENV_TOD_FLAGS_DAY, // 12 - ENV_TOD_FLAGS_DAY, // 13 + ENV_TOD_FLAGS_DAY, // 13 ENV_TOD_FLAGS_DAY, // 14 ENV_TOD_FLAGS_DAY, // 15 ENV_TOD_FLAGS_DAY, // 16 @@ -121,7 +121,7 @@ UINT8 guiTODFlags[ENV_NUM_TIMES] = { ENV_TOD_FLAGS_DUSK, // 20 ENV_TOD_FLAGS_DUSK, // 21 ENV_TOD_FLAGS_NIGHT, // 22 - ENV_TOD_FLAGS_NIGHT}; // 23 + ENV_TOD_FLAGS_NIGHT}; // 23 typedef enum { @@ -133,7 +133,7 @@ typedef enum typedef enum { TEMPERATURE_DESERT_COOL, - TEMPERATURE_DESERT_WARM, + TEMPERATURE_DESERT_WARM, TEMPERATURE_DESERT_HOT, TEMPERATURE_GLOBAL_COOL, TEMPERATURE_GLOBAL_WARM, @@ -156,7 +156,7 @@ BOOLEAN fTimeOfDayControls=TRUE; UINT32 guiEnvTime=0; UINT32 guiEnvDay=0; UINT8 gubEnvLightValue = 0; -BOOLEAN gfDoLighting = FALSE; +BOOLEAN gfDoLighting = FALSE; UINT8 gubDesertTemperature = 0; UINT8 gubGlobalTemperature = 0; @@ -172,15 +172,15 @@ void EnvDoLightning(void); // polled by the game to handle time/atmosphere changes from gamescreen void EnvironmentController( BOOLEAN fCheckForLights ) { - UINT32 uiOldWorldHour; - UINT8 ubLightAdjustFromWeather = 0; + UINT32 uiOldWorldHour; + UINT8 ubLightAdjustFromWeather = 0; // do none of this stuff in the basement or caves if( gfBasement || gfCaves ) { - guiEnvWeather &= (~WEATHER_FORECAST_THUNDERSHOWERS ); - guiEnvWeather &= (~WEATHER_FORECAST_SHOWERS ); + guiEnvWeather &= (~WEATHER_FORECAST_THUNDERSHOWERS ); + guiEnvWeather &= (~WEATHER_FORECAST_SHOWERS ); if (gGameSettings.fOptions[ TOPTION_RAIN_SOUND ] == TRUE) { @@ -201,7 +201,7 @@ void EnvironmentController( BOOLEAN fCheckForLights ) if ( uiOldWorldHour != guiEnvTime ) { // Hour change.... - + guiEnvTime=uiOldWorldHour; } @@ -284,7 +284,7 @@ void EnvironmentController( BOOLEAN fCheckForLights ) } } - + } void BuildDayLightLevels() @@ -318,11 +318,11 @@ void BuildDayLightLevels() AddEveryDayStrategicEvent( EVENT_TEMPERATURE_UPDATE, GLOBAL_HOT_START, TEMPERATURE_GLOBAL_HOT ); AddEveryDayStrategicEvent( EVENT_TEMPERATURE_UPDATE, GLOBAL_HOT_END, TEMPERATURE_GLOBAL_WARM ); AddEveryDayStrategicEvent( EVENT_TEMPERATURE_UPDATE, GLOBAL_WARM_END, TEMPERATURE_GLOBAL_COOL ); - + /* // Twilight; light 5 AddEveryDayStrategicEvent( EVENT_CHANGELIGHTVAL, TWILLIGHT_START, NORMAL_LIGHTLEVEL_DAY + 1 ); - + // Dusk; loop from light 5 up to 12 for (uiLoop = 1; uiLoop < 8; uiLoop++) { @@ -393,7 +393,7 @@ void ForecastDayEvents( ) { UINT32 uiOldDay; UINT32 uiStartTime, uiEndTime; - UINT8 ubStormIntensity; + UINT8 ubStormIntensity; // UINT32 cnt; // Get current day and see if different @@ -409,22 +409,22 @@ void ForecastDayEvents( ) BuildDayAmbientSounds( ); // Build weather.... - + // ATE: Don't forecast if start of game... if ( guiEnvDay > 1 ) { - //rain + //rain if ( Random( 100 ) < gGameExternalOptions.gusRainChancePerDay ) { // Add rain! // Between 6:00 and 10:00 - uiStartTime = (UINT32)( Random( 1440 - 1 - gGameExternalOptions.gusRainMaxLength ) ); + uiStartTime = (UINT32)( Random( 1440 - 1 - gGameExternalOptions.gusRainMaxLength ) ); // Between 5 - 15 miniutes uiEndTime = uiStartTime + ( gGameExternalOptions.gusRainMinLength + Random( gGameExternalOptions.gusRainMaxLength - gGameExternalOptions.gusRainMinLength ) ); ubStormIntensity = 0; - + //Kaiden: making thunderstorms optional if (gGameExternalOptions.gfAllowLightning) { @@ -435,14 +435,14 @@ void ForecastDayEvents( ) } } - + if( gGameExternalOptions.gfAllowRain ) AddSameDayRangedStrategicEvent( EVENT_RAINSTORM, uiStartTime, uiEndTime - uiStartTime, ubStormIntensity ); //AddSameDayStrategicEvent( EVENT_BEGINRAINSTORM, uiStartTime, ubStormIntensity ); //AddSameDayStrategicEvent( EVENT_ENDRAINSTORM, uiEndTime, 0 ); } //end rain - + /* // Should it rain...? @@ -461,15 +461,15 @@ void ForecastDayEvents( ) { ubStormIntensity = 1; } - - // ATE: Disable RAIN! + + // ATE: Disable RAIN! // AddSameDayRangedStrategicEvent( EVENT_RAINSTORM, uiStartTime, uiEndTime - uiStartTime, ubStormIntensity ); //AddSameDayStrategicEvent( EVENT_BEGINRAINSTORM, uiStartTime, ubStormIntensity ); //AddSameDayStrategicEvent( EVENT_ENDRAINSTORM, uiEndTime, 0 ); } */ - } + } } } @@ -503,12 +503,12 @@ UINT32 guiChanceToDoLightningBetweenTurns = 20; #define MAX_DELAYED_SOUNDS 10 #define NO_DL_SOUND 0xFFFFFFFF - + // 1000 = 1 second #define MIN_DL_INTERVAL ( 1000 * guiMinDLInterval ) #define MAX_DL_INTERVAL ( 1000 * guiMaxDLInterval ) -#define EXTRA_ADD_VIS_DIST_IF_SEEN_SOMEONE ( 1000 * guiProlongLightningIfSeenSomeone ) +#define EXTRA_ADD_VIS_DIST_IF_SEEN_SOMEONE ( 1000 * guiProlongLightningIfSeenSomeone ) #define CHANCE_TO_DO_LIGHTNING_BETWEEN_TURNS guiChanceToDoLightningBetweenTurns BOOLEAN gfLightningInProgress = FALSE; @@ -522,7 +522,7 @@ BOOLEAN gfWasTurnBasedWhenLightningBegin = FALSE; UINT8 gubLastTeamLightning; -#define IS_TURNBASED ( gTacticalStatus.uiFlags & TURNBASED && gTacticalStatus.uiFlags & INCOMBAT ) +#define IS_TURNBASED ( gTacticalStatus.uiFlags & TURNBASED && gTacticalStatus.uiFlags & INCOMBAT ) void BeginTeamTurn( UINT8 ubTeam ); @@ -531,25 +531,25 @@ void BeginTeamTurn( UINT8 ubTeam ); void EnvDoLightning(void) { - static UINT32 uiCount=10, uiIndex=0, uiStrike=0, uiFrameNext=0; - static UINT8 ubLevel=0, ubLastLevel=0; - static UINT32 uiLastUpdate = 0xFFFFFFFF; - static UINT32 uiTurnOffExtraVisDist = 0xFFFFFFFF; - static UINT32 pDelayedSounds[ MAX_DELAYED_SOUNDS ]; - UINT32 uiDSIndex; + static UINT32 uiCount=10, uiIndex=0, uiStrike=0, uiFrameNext=0; + static UINT8 ubLevel=0, ubLastLevel=0; + static UINT32 uiLastUpdate = 0xFFFFFFFF; + static UINT32 uiTurnOffExtraVisDist = 0xFFFFFFFF; + static UINT32 pDelayedSounds[ MAX_DELAYED_SOUNDS ]; + UINT32 uiDSIndex; - if( GetJA2Clock() < uiLastUpdate ) - { + if( GetJA2Clock() < uiLastUpdate ) + { uiLastUpdate = 0; memset( pDelayedSounds, NO_DL_SOUND, sizeof( UINT32 ) * MAX_DELAYED_SOUNDS ); - } + } - if( GetJA2Clock() < uiLastUpdate + 1000 / 60 )return; + if( GetJA2Clock() < uiLastUpdate + 1000 / 60 )return; else uiLastUpdate = GetJA2Clock(); - if( GetJA2Clock() > uiTurnOffExtraVisDist ) - { + if( GetJA2Clock() > uiTurnOffExtraVisDist ) + { AllTeamsLookForAll( FALSE ); uiTurnOffExtraVisDist = 0xFFFFFFFF; @@ -559,26 +559,26 @@ void EnvDoLightning(void) gfTurnBasedLightningEnd = FALSE; } - } + } - for( uiDSIndex = 0; uiDSIndex < MAX_DELAYED_SOUNDS; ++uiDSIndex ) - if( GetJA2Clock() > pDelayedSounds[ uiDSIndex ] ) - { - PlayJA2Ambient(LIGHTNING_1+Random(2), HIGHVOLUME, 1); - pDelayedSounds[ uiDSIndex ] = NO_DL_SOUND; - } + for( uiDSIndex = 0; uiDSIndex < MAX_DELAYED_SOUNDS; ++uiDSIndex ) + if( GetJA2Clock() > pDelayedSounds[ uiDSIndex ] ) + { + PlayJA2Ambient(LIGHTNING_1+Random(2), HIGHVOLUME, 1); + pDelayedSounds[ uiDSIndex ] = NO_DL_SOUND; + } - if ( gfPauseDueToPlayerGamePause ) - { - return; - } + if ( gfPauseDueToPlayerGamePause ) + { + return; + } - if( IS_TURNBASED && !gfLightningInProgress ) - { + if( IS_TURNBASED && !gfLightningInProgress ) + { if( !gfTurnBasedDoLightning ) { return; - } + } else { gfTurnBasedDoLightning = FALSE; @@ -586,19 +586,19 @@ void EnvDoLightning(void) uiCount = 0; gfTurnBasedLightningEnd = TRUE; } - } + } uiCount++; if(uiCount >= (uiFrameNext+10)) { - if( gfHaveSeenSomeone && gfWasTurnBasedWhenLightningBegin ) + if( gfHaveSeenSomeone && gfWasTurnBasedWhenLightningBegin ) uiTurnOffExtraVisDist = GetJA2Clock() + EXTRA_ADD_VIS_DIST_IF_SEEN_SOMEONE; else uiTurnOffExtraVisDist = GetJA2Clock(); gfLightningInProgress = FALSE; gfHaveSeenSomeone = FALSE; - + uiCount=0; uiIndex=0; ubLevel=0; @@ -634,30 +634,30 @@ void EnvDoLightning(void) ubLastLevel=ubLevel; ubLevel=min( ubRealAmbientLightLevel - 1, ubLightningTable[uiStrike][uiIndex][1] ); -/* // ATE: Don't modify if scrolling! - if ( gfScrollPending || gfScrollInertia ) - { - } - else*/ - { - if(ubLastLevel!=ubLevel) - { - if(ubLevel > ubLastLevel) - { - LightAddBaseLevel(0, (UINT8)(ubLevel-ubLastLevel)); - if(ubLevel > 0) - RenderSetShadows(TRUE); - } - else - { -// LightSubtractBaseLevel(0, (UINT8)(ubLastLevel-ubLevel)); - LightSetBaseLevel( ubRealAmbientLightLevel - ubLevel ); - if(ubLevel > 0) - RenderSetShadows(TRUE); - } - SetRenderFlags(RENDER_FLAG_FULL); - } - } +/* // ATE: Don't modify if scrolling! + if ( gfScrollPending || gfScrollInertia ) + { + } + else*/ + { + if(ubLastLevel!=ubLevel) + { + if(ubLevel > ubLastLevel) + { + LightAddBaseLevel(0, (UINT8)(ubLevel-ubLastLevel)); + if(ubLevel > 0) + RenderSetShadows(TRUE); + } + else + { +// LightSubtractBaseLevel(0, (UINT8)(ubLastLevel-ubLevel)); + LightSetBaseLevel( ubRealAmbientLightLevel - ubLevel ); + if(ubLevel > 0) + RenderSetShadows(TRUE); + } + SetRenderFlags(RENDER_FLAG_FULL); + } + } } } @@ -673,7 +673,7 @@ BOOLEAN LightningEndOfTurn( UINT8 ubTeam ) gubLastTeamLightning = ubTeam; EnvDoLightning(); return FALSE; - } + } else { return TRUE; @@ -699,25 +699,25 @@ void EnvBeginRainStorm( UINT8 ubIntensity ) { gfDoLighting = TRUE; - #ifdef JA2TESTVERSION - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Starting Rain...." ); - #endif + #ifdef JA2TESTVERSION + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Starting Rain...." ); + #endif - // First turn off whatever rain it is, then turn on the requested rain - guiEnvWeather &= ~(WEATHER_FORECAST_THUNDERSHOWERS | WEATHER_FORECAST_SHOWERS); + // First turn off whatever rain it is, then turn on the requested rain + guiEnvWeather &= ~(WEATHER_FORECAST_THUNDERSHOWERS | WEATHER_FORECAST_SHOWERS); - if ( ubIntensity == 1 ) - { - // Turn on rain storms - guiEnvWeather |= WEATHER_FORECAST_THUNDERSHOWERS; + if ( ubIntensity == 1 ) + { + // Turn on rain storms + guiEnvWeather |= WEATHER_FORECAST_THUNDERSHOWERS; ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_STORM_STARTED] ); - } - else - { - guiEnvWeather |= WEATHER_FORECAST_SHOWERS; + } + else + { + guiEnvWeather |= WEATHER_FORECAST_SHOWERS; ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_RAIN_STARTED] ); - } - } + } + } } @@ -726,17 +726,17 @@ void EnvEndRainStorm( ) gfDoLighting = TRUE; #ifdef JA2TESTVERSION - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Ending Rain...." ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Ending Rain...." ); #endif - if ( guiEnvWeather & WEATHER_FORECAST_THUNDERSHOWERS ) - { + if ( guiEnvWeather & WEATHER_FORECAST_THUNDERSHOWERS ) + { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_STORM_ENDED] ); - } - else - { + } + else + { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_RAIN_ENDED] ); - } + } guiEnvWeather &= (~WEATHER_FORECAST_THUNDERSHOWERS ); @@ -759,10 +759,10 @@ void EnvDoLightning(void) static UINT32 uiCount=0, uiIndex=0, uiStrike=0, uiFrameNext=1000; static UINT8 ubLevel=0, ubLastLevel=0; - if ( gfPauseDueToPlayerGamePause ) - { - return; - } + if ( gfPauseDueToPlayerGamePause ) + { + return; + } uiCount++; if(uiCount >= (uiFrameNext+10)) @@ -789,29 +789,29 @@ static UINT8 ubLevel=0, ubLastLevel=0; ubLastLevel=ubLevel; ubLevel=ubLightningTable[uiStrike][uiIndex][1]; - // ATE: Don't modify if scrolling! - if ( gfScrollPending || gfScrollInertia ) - { - } - else - { - if(ubLastLevel!=ubLevel) - { - if(ubLevel > ubLastLevel) - { - LightAddBaseLevel(0, (UINT8)(ubLevel-ubLastLevel)); - if(ubLevel > 0) - RenderSetShadows(TRUE); - } - else - { - LightSubtractBaseLevel(0, (UINT8)(ubLastLevel-ubLevel)); - if(ubLevel > 0) - RenderSetShadows(TRUE); - } - SetRenderFlags(RENDER_FLAG_FULL); - } - } + // ATE: Don't modify if scrolling! + if ( gfScrollPending || gfScrollInertia ) + { + } + else + { + if(ubLastLevel!=ubLevel) + { + if(ubLevel > ubLastLevel) + { + LightAddBaseLevel(0, (UINT8)(ubLevel-ubLastLevel)); + if(ubLevel > 0) + RenderSetShadows(TRUE); + } + else + { + LightSubtractBaseLevel(0, (UINT8)(ubLastLevel-ubLevel)); + if(ubLevel > 0) + RenderSetShadows(TRUE); + } + SetRenderFlags(RENDER_FLAG_FULL); + } + } } } @@ -835,20 +835,20 @@ void EnvBeginRainStorm( UINT8 ubIntensity ) { gfDoLighting = TRUE; - #ifdef JA2TESTVERSION - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Starting Rain...." ); - #endif + #ifdef JA2TESTVERSION + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Starting Rain...." ); + #endif - if ( ubIntensity == 1 ) - { - // Turn on rain storms - guiEnvWeather |= WEATHER_FORECAST_THUNDERSHOWERS; - } - else - { - guiEnvWeather |= WEATHER_FORECAST_SHOWERS; - } - } + if ( ubIntensity == 1 ) + { + // Turn on rain storms + guiEnvWeather |= WEATHER_FORECAST_THUNDERSHOWERS; + } + else + { + guiEnvWeather |= WEATHER_FORECAST_SHOWERS; + } + } } @@ -857,7 +857,7 @@ void EnvEndRainStorm( ) gfDoLighting = TRUE; #ifdef JA2TESTVERSION - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Ending Rain...." ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Ending Rain...." ); #endif guiEnvWeather &= (~WEATHER_FORECAST_THUNDERSHOWERS ); @@ -872,7 +872,7 @@ void TurnOnNightLights() for( i = 0; i < MAX_LIGHT_SPRITES; i++ ) { if( LightSprites[ i ].uiFlags & LIGHT_SPR_ACTIVE && - LightSprites[ i ].uiFlags & LIGHT_NIGHTTIME && + LightSprites[ i ].uiFlags & LIGHT_NIGHTTIME && !(LightSprites[ i ].uiFlags & (LIGHT_SPR_ON|MERC_LIGHT) ) ) { LightSpritePower( i, TRUE ); @@ -886,9 +886,9 @@ void TurnOffNightLights() for( i = 0; i < MAX_LIGHT_SPRITES; i++ ) { if( LightSprites[ i ].uiFlags & LIGHT_SPR_ACTIVE && - LightSprites[ i ].uiFlags & LIGHT_NIGHTTIME && - LightSprites[ i ].uiFlags & LIGHT_SPR_ON && - !(LightSprites[ i ].uiFlags & MERC_LIGHT) ) + LightSprites[ i ].uiFlags & LIGHT_NIGHTTIME && + LightSprites[ i ].uiFlags & LIGHT_SPR_ON && + !(LightSprites[ i ].uiFlags & MERC_LIGHT) ) { LightSpritePower( i, FALSE ); } @@ -901,7 +901,7 @@ void TurnOnPrimeLights() for( i = 0; i < MAX_LIGHT_SPRITES; i++ ) { if( LightSprites[ i ].uiFlags & LIGHT_SPR_ACTIVE && - LightSprites[ i ].uiFlags & LIGHT_PRIMETIME && + LightSprites[ i ].uiFlags & LIGHT_PRIMETIME && !(LightSprites[ i ].uiFlags & (LIGHT_SPR_ON|MERC_LIGHT) ) ) { LightSpritePower( i, TRUE ); @@ -915,9 +915,9 @@ void TurnOffPrimeLights() for( i = 0; i < MAX_LIGHT_SPRITES; i++ ) { if( LightSprites[ i ].uiFlags & LIGHT_SPR_ACTIVE && - LightSprites[ i ].uiFlags & LIGHT_PRIMETIME && - LightSprites[ i ].uiFlags & LIGHT_SPR_ON && - !(LightSprites[ i ].uiFlags & MERC_LIGHT) ) + LightSprites[ i ].uiFlags & LIGHT_PRIMETIME && + LightSprites[ i ].uiFlags & LIGHT_SPR_ON && + !(LightSprites[ i ].uiFlags & MERC_LIGHT) ) { LightSpritePower( i, FALSE ); } @@ -931,7 +931,7 @@ void UpdateTemperature( UINT8 ubTemperatureCode ) case TEMPERATURE_DESERT_COOL: gubDesertTemperature = 0; break; - case TEMPERATURE_DESERT_WARM: + case TEMPERATURE_DESERT_WARM: gubDesertTemperature = 1; break; case TEMPERATURE_DESERT_HOT: @@ -947,7 +947,7 @@ void UpdateTemperature( UINT8 ubTemperatureCode ) gubGlobalTemperature = 2; break; } - gfDoLighting = TRUE; + gfDoLighting = TRUE; } INT8 SectorTemperature( UINT32 uiTime, INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) @@ -959,7 +959,7 @@ INT8 SectorTemperature( UINT32 uiTime, INT16 sSectorX, INT16 sSectorY, INT8 bSec } else if ( IsSectorDesert( sSectorX, sSectorY ) ) // is desert { - return( gubDesertTemperature ); + return( gubDesertTemperature ); } else { diff --git a/TileEngine/lighting.cpp b/TileEngine/lighting.cpp index 9a3f81ab..7e8b5602 100644 --- a/TileEngine/lighting.cpp +++ b/TileEngine/lighting.cpp @@ -26,7 +26,7 @@ #include "worlddef.h" #include "renderworld.h" #include "vsurface.h" - #include "input.h" + #include "input.h" #include "sysutil.h" #include "wchar.h" #include "video.h" @@ -64,7 +64,7 @@ #define LVL2_L2_PER (70) -#define LIGHT_TREE_REVEAL 5 // width of rect +#define LIGHT_TREE_REVEAL 5 // width of rect // Local-use only prototypes @@ -96,9 +96,9 @@ INT32 LightSpriteGetFree(void); BOOLEAN LightSpriteDirty(INT32 iLight); // Top node of linked lists, NULL = FREE -LIGHT_NODE *pLightList[MAX_LIGHT_TEMPLATES]; +LIGHT_NODE *pLightList[MAX_LIGHT_TEMPLATES]; UINT16 usTemplateSize[MAX_LIGHT_TEMPLATES]; -UINT16 *pLightRayList[MAX_LIGHT_TEMPLATES]; +UINT16 *pLightRayList[MAX_LIGHT_TEMPLATES]; UINT16 usRaySize[MAX_LIGHT_TEMPLATES]; INT16 LightHeight[MAX_LIGHT_TEMPLATES]; INT16 LightWidth[MAX_LIGHT_TEMPLATES]; @@ -165,8 +165,8 @@ UINT16 gusShadeLevels[16][3]={{500, 500, 500}, // green table /* //Linda's final version -UINT16 gusShadeLevels[16][3] = -{ +UINT16 gusShadeLevels[16][3] = +{ 500, 500, 500, 450, 450, 450, //bright 350, 350, 350, @@ -187,8 +187,8 @@ UINT16 gusShadeLevels[16][3] = */ // JA2 Gold: -UINT16 gusShadeLevels[16][3] = -{ +UINT16 gusShadeLevels[16][3] = +{ 500, 500, 500, 450, 450, 450, //bright 350, 350, 350, @@ -362,12 +362,12 @@ UINT16 usNumNodes; { if((pLightList[iLight]= (LIGHT_NODE *) MemAlloc(sizeof(LIGHT_NODE)))==NULL) return(65535); - + pLightList[iLight]->iDX=iX; pLightList[iLight]->iDY=iY; pLightList[iLight]->ubLight=ubLight; pLightList[iLight]->uiFlags=0; - + usTemplateSize[iLight]=1; return(0); } @@ -404,7 +404,7 @@ UINT16 usCount; return(usCount); } } - + return(LightCreateTemplateNode(iLight, iX, iY, ubLight)); } @@ -425,9 +425,9 @@ UINT16 usNumNodes; { if((pLightRayList[iLight]= (UINT16 *) MemAlloc(sizeof(UINT16)))==NULL) return(65535); - + *pLightRayList[iLight]=(LightAddTemplateNode(iLight, iX, iY, ubLight) | usFlags); - + usRaySize[iLight]=1; return(0); } @@ -456,9 +456,9 @@ UINT16 usNumNodes; { if((pLightRayList[iLight]= (UINT16 *) MemAlloc(sizeof(UINT16)))==NULL) return(65535); - + *pLightRayList[iLight]=(LightAddTemplateNode(iLight, iX, iY, ubLight) | usFlags); - + usRaySize[iLight]=1; return(0); } @@ -469,8 +469,8 @@ UINT16 usNumNodes; if(usIndex < usRaySize[iLight]) { - memmove(pLightRayList[iLight]+usIndex+1, - pLightRayList[iLight]+usIndex, + memmove(pLightRayList[iLight]+usIndex+1, + pLightRayList[iLight]+usIndex, (usRaySize[iLight]-usIndex)*sizeof(UINT16)); } @@ -510,7 +510,7 @@ UINT16 usTileNo, usSrcTileNo; { UINT16 usTileNo; LEVELNODE *pStruct; - + usTileNo=MAPROWCOLTOPOS(iY, iX); pStruct = gpWorldLevelData[ usTileNo ].pStructHead; @@ -543,7 +543,7 @@ INT8 bDirection; UINT8 ubTravelCost; //INT8 bWallCount = 0; //UINT16 usWallOrientation; - + Assert(gpWorldLevelData!=NULL); usTileNo=MAPROWCOLTOPOS(iY, iX); @@ -574,16 +574,15 @@ UINT8 ubTravelCost; bDirection = atan8( iSrcX, iSrcY, iX, iY ); #if 0 - if ( usTileNo == 20415 && bDirection == 3 ) - { - int i = 0; - } + if ( usTileNo == 20415 && bDirection == 3 ) + { + int i = 0; + } #endif - ubTravelCost = gubWorldMovementCosts[ usTileNo ][ bDirection ][ 0 ]; - if ( ubTravelCost == TRAVELCOST_WALL ) + if ( ubTravelCost == TRAVELCOST_WALL ) { return( TRUE ); } @@ -605,7 +604,7 @@ UINT8 ubTravelCost; if ( pStruct->usIndex < NUMBEROFTILES ) { GetTileType( pStruct->usIndex, &uiType ); - + // ATE: Changed to use last decordations rather than last decal // Could maybe check orientation value? Depends on our // use of the orientation value flags.. @@ -618,7 +617,7 @@ UINT8 ubTravelCost; } pStruct=pStruct->pNext; - } + } if ( bWallCount ) { @@ -771,7 +770,7 @@ UINT8 LightTrueLevel( INT16 sGridNo, INT16 bLevel ) iSum=__max(SHADE_MAX, iSum); return( (UINT8) iSum ); } -} +} /**************************************************************************************** LightAddNodeTile @@ -810,7 +809,7 @@ INT16 sSum; void LightSubtractTileNode(LEVELNODE *pNode, UINT32 uiLightType, UINT8 ubShadeSubtract, BOOLEAN fFake) { INT16 sSum; - + if (ubShadeSubtract > pNode->ubSumLights ) { pNode->ubSumLights = 0; @@ -820,7 +819,7 @@ INT16 sSum; pNode->ubSumLights = pNode->ubSumLights - ubShadeSubtract; } if (fFake) - { + { if (ubShadeSubtract > pNode->ubFakeShadeLevel) { pNode->ubFakeShadeLevel = 0; @@ -847,7 +846,7 @@ INT16 sSum; /**************************************************************************************** LightAddTile - Adds a specified amount of light to all objects on a given tile. + Adds a specified amount of light to all objects on a given tile. ***************************************************************************************/ BOOLEAN LightAddTile(UINT32 uiLightType, INT16 iSrcX, INT16 iSrcY, INT16 iX, INT16 iY, UINT8 ubShade, UINT32 uiFlags, BOOLEAN fOnlyWalls ) @@ -855,7 +854,7 @@ BOOLEAN LightAddTile(UINT32 uiLightType, INT16 iSrcX, INT16 iSrcY, INT16 iX, INT LEVELNODE *pLand, *pStruct, *pObject, *pMerc, *pRoof, *pOnRoof; UINT8 ubShadeAdd; UINT32 uiTile; -BOOLEAN fLitWall=FALSE; +BOOLEAN fLitWall=FALSE; BOOLEAN fFake; Assert(gpWorldLevelData!=NULL); @@ -874,10 +873,10 @@ BOOLEAN fFake; //else ubShadeAdd=ubShade; - // Lesh: it is not recomended due to problems with roof lighting + // Lesh: it is not recomended due to problems with roof lighting //if ( uiLightType == LIGHT_TYPE_BRIGHT ) // ubShadeAdd += -6; - + if (uiFlags&LIGHT_FAKE) { fFake = TRUE; @@ -889,7 +888,7 @@ BOOLEAN fFake; if(!(uiFlags&LIGHT_ROOF_ONLY) || (uiFlags&LIGHT_EVERYTHING)) { - pStruct = gpWorldLevelData[uiTile].pStructHead; + pStruct = gpWorldLevelData[uiTile].pStructHead; while(pStruct!=NULL) { if ( pStruct->usIndex < NUMBEROFTILES ) @@ -928,44 +927,44 @@ BOOLEAN fFake; ubShadeAdd=ubShade; - if ( !fOnlyWalls ) - { - pLand = gpWorldLevelData[uiTile].pLandHead; + if ( !fOnlyWalls ) + { + pLand = gpWorldLevelData[uiTile].pLandHead; - while( pLand ) - { - if( gfCaves || !fLitWall ) - { - LightAddTileNode(pLand, uiLightType, ubShadeAdd, fFake); - } - pLand=pLand->pNext; - } + while( pLand ) + { + if( gfCaves || !fLitWall ) + { + LightAddTileNode(pLand, uiLightType, ubShadeAdd, fFake); + } + pLand=pLand->pNext; + } - pObject = gpWorldLevelData[uiTile].pObjectHead; - while(pObject!=NULL) - { - if ( pObject->usIndex < NUMBEROFTILES ) - { - LightAddTileNode(pObject, uiLightType, ubShadeAdd, FALSE); - } - pObject=pObject->pNext; - } + pObject = gpWorldLevelData[uiTile].pObjectHead; + while(pObject!=NULL) + { + if ( pObject->usIndex < NUMBEROFTILES ) + { + LightAddTileNode(pObject, uiLightType, ubShadeAdd, FALSE); + } + pObject=pObject->pNext; + } - if(uiFlags&LIGHT_BACKLIGHT) - ubShadeAdd=(UINT8)((UINT16)ubShade*7/10); + if(uiFlags&LIGHT_BACKLIGHT) + ubShadeAdd=(UINT8)((UINT16)ubShade*7/10); + + pMerc = gpWorldLevelData[uiTile].pMercHead; + while(pMerc!=NULL) + { + LightAddTileNode(pMerc, uiLightType, ubShadeAdd, FALSE); + pMerc=pMerc->pNext; + } + } + } - pMerc = gpWorldLevelData[uiTile].pMercHead; - while(pMerc!=NULL) - { - LightAddTileNode(pMerc, uiLightType, ubShadeAdd, FALSE); - pMerc=pMerc->pNext; - } - } - } - if((uiFlags&LIGHT_ROOF_ONLY) || (uiFlags&LIGHT_EVERYTHING)) { - pRoof = gpWorldLevelData[uiTile].pRoofHead; + pRoof = gpWorldLevelData[uiTile].pRoofHead; while(pRoof!=NULL) { if ( pRoof->usIndex < NUMBEROFTILES ) @@ -975,7 +974,7 @@ BOOLEAN fFake; pRoof=pRoof->pNext; } - pOnRoof = gpWorldLevelData[uiTile].pOnRoofHead; + pOnRoof = gpWorldLevelData[uiTile].pOnRoofHead; while(pOnRoof!=NULL) { LightAddTileNode(pOnRoof, uiLightType, ubShadeAdd, FALSE); @@ -984,7 +983,7 @@ BOOLEAN fFake; } } return(TRUE); -} +} /**************************************************************************************** LightSubtractTile @@ -1017,7 +1016,7 @@ BOOLEAN fFake; // only passed in to land and roof layers; others get fed FALSE // else ubShadeSubtract=ubShade; - // Lesh: it is not recomended due to problems with roof lighting + // Lesh: it is not recomended due to problems with roof lighting //if ( uiLightType == LIGHT_TYPE_BRIGHT ) // ubShadeSubtract += -6; @@ -1032,7 +1031,7 @@ BOOLEAN fFake; // only passed in to land and roof layers; others get fed FALSE if(!(uiFlags&LIGHT_ROOF_ONLY) || (uiFlags&LIGHT_EVERYTHING)) { - pStruct = gpWorldLevelData[uiTile].pStructHead; + pStruct = gpWorldLevelData[uiTile].pStructHead; while(pStruct!=NULL) { if ( pStruct->usIndex < NUMBEROFTILES ) @@ -1055,60 +1054,60 @@ BOOLEAN fFake; // only passed in to land and roof layers; others get fed FALSE { LightSubtractTileNode(pStruct, uiLightType, ubShadeSubtract, FALSE); } - else if ( !fOnlyWalls ) - { - LightSubtractTileNode(pStruct, uiLightType, ubShadeSubtract, FALSE); - } + else if ( !fOnlyWalls ) + { + LightSubtractTileNode(pStruct, uiLightType, ubShadeSubtract, FALSE); + } } } } - else - { + else + { LightSubtractTileNode(pStruct, uiLightType, ubShadeSubtract, FALSE); - } + } pStruct=pStruct->pNext; } ubShadeSubtract=ubShade; - if ( !fOnlyWalls ) - { - pLand = gpWorldLevelData[uiTile].pLandHead; + if ( !fOnlyWalls ) + { + pLand = gpWorldLevelData[uiTile].pLandHead; - while( pLand ) - { - if( gfCaves || !fLitWall ) - { - LightSubtractTileNode(pLand, uiLightType, ubShadeSubtract, fFake); - } - pLand=pLand->pNext; - } + while( pLand ) + { + if( gfCaves || !fLitWall ) + { + LightSubtractTileNode(pLand, uiLightType, ubShadeSubtract, fFake); + } + pLand=pLand->pNext; + } - pObject = gpWorldLevelData[uiTile].pObjectHead; - while(pObject!=NULL) - { - if ( pObject->usIndex < NUMBEROFTILES ) - { - LightSubtractTileNode(pObject, uiLightType, ubShadeSubtract, FALSE); - } - pObject=pObject->pNext; - } + pObject = gpWorldLevelData[uiTile].pObjectHead; + while(pObject!=NULL) + { + if ( pObject->usIndex < NUMBEROFTILES ) + { + LightSubtractTileNode(pObject, uiLightType, ubShadeSubtract, FALSE); + } + pObject=pObject->pNext; + } - if(uiFlags&LIGHT_BACKLIGHT) - ubShadeSubtract=(UINT8) ((UINT16)ubShade*7/10); + if(uiFlags&LIGHT_BACKLIGHT) + ubShadeSubtract=(UINT8) ((UINT16)ubShade*7/10); - pMerc = gpWorldLevelData[uiTile].pMercHead; - while(pMerc!=NULL) - { - LightSubtractTileNode(pMerc, uiLightType, ubShadeSubtract, FALSE); - pMerc=pMerc->pNext; - } - } - } + pMerc = gpWorldLevelData[uiTile].pMercHead; + while(pMerc!=NULL) + { + LightSubtractTileNode(pMerc, uiLightType, ubShadeSubtract, FALSE); + pMerc=pMerc->pNext; + } + } + } if((uiFlags&LIGHT_ROOF_ONLY) || (uiFlags&LIGHT_EVERYTHING)) { - pRoof = gpWorldLevelData[uiTile].pRoofHead; + pRoof = gpWorldLevelData[uiTile].pRoofHead; while(pRoof!=NULL) { if ( pRoof->usIndex < NUMBEROFTILES ) @@ -1118,7 +1117,7 @@ BOOLEAN fFake; // only passed in to land and roof layers; others get fed FALSE pRoof=pRoof->pNext; } - pOnRoof = gpWorldLevelData[uiTile].pOnRoofHead; + pOnRoof = gpWorldLevelData[uiTile].pOnRoofHead; while(pOnRoof!=NULL) { if ( pOnRoof->usIndex < NUMBEROFTILES ) @@ -1128,14 +1127,14 @@ BOOLEAN fFake; // only passed in to land and roof layers; others get fed FALSE pOnRoof=pOnRoof->pNext; } } - + return(TRUE); -} +} /**************************************************************************************** LightSetNaturalTileNode - Sets the natural light level (as well as the current) on individual LEVELNODEs. + Sets the natural light level (as well as the current) on individual LEVELNODEs. ***************************************************************************************/ void LightSetNaturalTileNode(LEVELNODE *pNode, UINT8 ubShade) @@ -1170,7 +1169,7 @@ UINT32 uiIndex; ubShade=__max(SHADE_MAX, ubShade); ubShade=__min(SHADE_MIN, ubShade); - pLand = gpWorldLevelData[ uiIndex ].pLandHead; + pLand = gpWorldLevelData[ uiIndex ].pLandHead; while(pLand!=NULL) { @@ -1178,7 +1177,7 @@ UINT32 uiIndex; pLand=pLand->pNext; } - pStruct = gpWorldLevelData[ uiIndex ].pStructHead; + pStruct = gpWorldLevelData[ uiIndex ].pStructHead; while(pStruct!=NULL) { @@ -1186,42 +1185,42 @@ UINT32 uiIndex; pStruct=pStruct->pNext; } - pObject = gpWorldLevelData[ uiIndex ].pObjectHead; + pObject = gpWorldLevelData[ uiIndex ].pObjectHead; while(pObject!=NULL) { LightSetNaturalTileNode(pObject, ubShade); pObject=pObject->pNext; } - pRoof = gpWorldLevelData[ uiIndex ].pRoofHead; + pRoof = gpWorldLevelData[ uiIndex ].pRoofHead; while(pRoof!=NULL) { LightSetNaturalTileNode(pRoof, ubShade); pRoof=pRoof->pNext; } - pOnRoof = gpWorldLevelData[ uiIndex ].pOnRoofHead; + pOnRoof = gpWorldLevelData[ uiIndex ].pOnRoofHead; while(pOnRoof!=NULL) { LightSetNaturalTileNode(pOnRoof, ubShade); pOnRoof=pOnRoof->pNext; } - pTopmost = gpWorldLevelData[ uiIndex ].pTopmostHead; + pTopmost = gpWorldLevelData[ uiIndex ].pTopmostHead; while(pTopmost!=NULL) { LightSetNaturalTileNode(pTopmost, ubShade); pTopmost=pTopmost->pNext; } - pMerc = gpWorldLevelData[ uiIndex ].pMercHead; + pMerc = gpWorldLevelData[ uiIndex ].pMercHead; while(pMerc!=NULL) { LightSetNaturalTileNode(pMerc, ubShade); pMerc=pMerc->pNext; } return(TRUE); -} +} /**************************************************************************************** LightResetTileNode @@ -1253,10 +1252,10 @@ UINT32 uiTile; CHECKF(gpWorldLevelData!=NULL); uiTile = MAPROWCOLTOPOS( iY, iX ); - + CHECKF(uiTile!=0xffff); - pLand = gpWorldLevelData[uiTile].pLandHead; + pLand = gpWorldLevelData[uiTile].pLandHead; while(pLand!=NULL) { @@ -1264,7 +1263,7 @@ UINT32 uiTile; pLand=pLand->pNext; } - pStruct = gpWorldLevelData[ uiTile ].pStructHead; + pStruct = gpWorldLevelData[ uiTile ].pStructHead; while(pStruct!=NULL) { @@ -1272,35 +1271,35 @@ UINT32 uiTile; pStruct=pStruct->pNext; } - pObject = gpWorldLevelData[ uiTile ].pObjectHead; + pObject = gpWorldLevelData[ uiTile ].pObjectHead; while(pObject!=NULL) { LightResetTileNode(pObject); pObject=pObject->pNext; } - pRoof = gpWorldLevelData[ uiTile ].pRoofHead; + pRoof = gpWorldLevelData[ uiTile ].pRoofHead; while(pRoof!=NULL) { LightResetTileNode(pRoof); pRoof=pRoof->pNext; } - pOnRoof = gpWorldLevelData[ uiTile ].pOnRoofHead; + pOnRoof = gpWorldLevelData[ uiTile ].pOnRoofHead; while(pOnRoof!=NULL) { LightResetTileNode(pOnRoof); pOnRoof=pOnRoof->pNext; } - pTopmost = gpWorldLevelData[ uiTile ].pTopmostHead; + pTopmost = gpWorldLevelData[ uiTile ].pTopmostHead; while(pTopmost!=NULL) { LightResetTileNode(pTopmost); pTopmost=pTopmost->pNext; } - pMerc = gpWorldLevelData[ uiTile ].pMercHead; + pMerc = gpWorldLevelData[ uiTile ].pMercHead; while(pMerc!=NULL) { LightResetTileNode(pMerc); @@ -1308,7 +1307,7 @@ UINT32 uiTile; } return(TRUE); -} +} /**************************************************************************************** LightResetAllTiles @@ -1344,7 +1343,7 @@ UINT32 uiIndex; ubShade=__min(SHADE_MIN, ubShade); uiIndex = MAPROWCOLTOPOS( iY, iX ); - pLand = gpWorldLevelData[ uiIndex ].pLandHead; + pLand = gpWorldLevelData[ uiIndex ].pLandHead; while(pLand!=NULL) { @@ -1353,7 +1352,7 @@ UINT32 uiIndex; pLand=pLand->pNext; } - pStruct = gpWorldLevelData[ uiIndex ].pStructHead; + pStruct = gpWorldLevelData[ uiIndex ].pStructHead; while(pStruct!=NULL) { @@ -1362,7 +1361,7 @@ UINT32 uiIndex; pStruct=pStruct->pNext; } - pObject = gpWorldLevelData[ uiIndex ].pObjectHead; + pObject = gpWorldLevelData[ uiIndex ].pObjectHead; while(pObject!=NULL) { pObject->sSumLights[uiLightType]= ubShade-SHADE_MAX; @@ -1370,7 +1369,7 @@ UINT32 uiIndex; pObject=pObject->pNext; } - pRoof = gpWorldLevelData[ uiIndex ].pRoofHead; + pRoof = gpWorldLevelData[ uiIndex ].pRoofHead; while(pRoof!=NULL) { pRoof->sSumLights[uiLightType]= ubShade-SHADE_MAX; @@ -1378,7 +1377,7 @@ UINT32 uiIndex; pRoof=pRoof->pNext; } - pOnRoof = gpWorldLevelData[ uiIndex ].pOnRoofHead; + pOnRoof = gpWorldLevelData[ uiIndex ].pOnRoofHead; while(pOnRoof!=NULL) { pOnRoof->sSumLights[uiLightType]= ubShade-SHADE_MAX; @@ -1386,7 +1385,7 @@ UINT32 uiIndex; pOnRoof=pOnRoof->pNext; } - pFog = gpWorldLevelData[ uiIndex ].pFogHead; + pFog = gpWorldLevelData[ uiIndex ].pFogHead; while(pFog!=NULL) { pFog->sSumLights[uiLightType]= ubShade-SHADE_MAX; @@ -1394,7 +1393,7 @@ UINT32 uiIndex; pFog=pFog->pNext; } - pTopmost = gpWorldLevelData[ uiIndex ].pTopmostHead; + pTopmost = gpWorldLevelData[ uiIndex ].pTopmostHead; while(pTopmost!=NULL) { pTopmost->sSumLights[uiLightType]= ubShade-SHADE_MAX; @@ -1402,7 +1401,7 @@ UINT32 uiIndex; pTopmost=pTopmost->pNext; } */ return(TRUE); -} +} /**************************************************************************************** LightGetLastNode @@ -1414,7 +1413,7 @@ UINT32 uiIndex; UINT16 LightGetLastNode(INT32 iLight) { return(usRaySize[iLight]); -} +} /**************************************************************************************** @@ -1425,10 +1424,9 @@ UINT16 LightGetLastNode(INT32 iLight) ***************************************************************************************/ BOOLEAN LightAddNode(INT32 iLight, INT16 iHotSpotX, INT16 iHotSpotY, INT16 iX, INT16 iY, UINT8 ubIntensity, UINT16 uiFlags) { -//BOOLEAN fDuplicate=FALSE; -DOUBLE dDistance; -UINT8 ubShade; -INT32 iLightDecay; + DOUBLE dDistance; + UINT8 ubShade; + INT32 iLightDecay; dDistance=LinearDistanceDouble(iX, iY, iHotSpotX, iHotSpotY); dDistance/=DISTANCE_SCALE; @@ -1442,10 +1440,10 @@ INT32 iLightDecay; iX/=DISTANCE_SCALE; iY/=DISTANCE_SCALE; - + LightAddRayNode(iLight, iX, iY, ubShade, uiFlags); return(TRUE); -} +} /**************************************************************************************** @@ -1472,11 +1470,11 @@ INT32 iLightDecay; iX/=DISTANCE_SCALE; iY/=DISTANCE_SCALE; - + LightInsertRayNode(iLight, usLightIns, iX, iY, ubShade, uiFlags); return(TRUE); -} +} /**************************************************************************************** LightFindNextRay @@ -1514,9 +1512,9 @@ BOOLEAN fInsertNodes=FALSE; if((iEndPointX > 0) && (iEndPointY > 0)) usFlags=LIGHT_BACKLIGHT; - /* We'll always draw top to bottom, to reduce the number of cases we have to - handle, and to make lines between the same endpoints draw the same pixels */ - if (iStartY > iEndPointY) + /* We'll always draw top to bottom, to reduce the number of cases we have to + handle, and to make lines between the same endpoints draw the same pixels */ + if (iStartY > iEndPointY) { iXPos=iEndPointX; iEndX=iStartX; @@ -1532,141 +1530,141 @@ BOOLEAN fInsertNodes=FALSE; iEndY=iEndPointY; } - /* Figure out whether we're going left or right, and how far we're - going horizontally */ - if ((XDelta = (iEndX - iXPos)) < 0) - { - XAdvance = -1; - XDelta = -XDelta; - } - else - { - XAdvance = 1; - } - /* Figure out how far we're going vertically */ - YDelta = iEndY - iYPos; + /* Figure out whether we're going left or right, and how far we're + going horizontally */ + if ((XDelta = (iEndX - iXPos)) < 0) + { + XAdvance = -1; + XDelta = -XDelta; + } + else + { + XAdvance = 1; + } + /* Figure out how far we're going vertically */ + YDelta = iEndY - iYPos; - // Check for 0 length ray - if((XDelta==0) && (YDelta==0)) - return(FALSE); + // Check for 0 length ray + if((XDelta==0) && (YDelta==0)) + return(FALSE); //DebugMsg(TOPIC_GAME, DBG_LEVEL_0, String("Drawing (%d,%d) to (%d,%d)", iXPos, iYPos, iEndX, iEndY)); - LightAddNode(iLight, 32767, 32767, 32767, 32767, 0, LIGHT_NEW_RAY); + LightAddNode(iLight, 32767, 32767, 32767, 32767, 0, LIGHT_NEW_RAY); if(fInsertNodes) usCurNode=LightGetLastNode(iLight); /* Special-case horizontal, vertical, and diagonal lines, for speed - and to avoid nasty boundary conditions and division by 0 */ - if (XDelta == 0) - { - /* Vertical line */ - if(fInsertNodes) - { + and to avoid nasty boundary conditions and division by 0 */ + if (XDelta == 0) + { + /* Vertical line */ + if(fInsertNodes) + { for (i=0; i<=YDelta; i++) { LightInsertNode(iLight, usCurNode, iStartX, iStartY, iXPos, iYPos, ubStartIntens, usFlags); iYPos++; } - } - else - { + } + else + { for (i=0; i<=YDelta; i++) { LightAddNode(iLight, iStartX, iStartY, iXPos, iYPos, ubStartIntens, usFlags); iYPos++; } - } - return(TRUE); - } - if (YDelta == 0) - { - /* Horizontal line */ - if(fInsertNodes) - { + } + return(TRUE); + } + if (YDelta == 0) + { + /* Horizontal line */ + if(fInsertNodes) + { for (i=0; i<=XDelta; i++) { LightInsertNode(iLight, usCurNode, iStartX, iStartY, iXPos, iYPos, ubStartIntens, usFlags); iXPos=iXPos+XAdvance; - } - } - else - { + } + } + else + { for (i=0; i<=XDelta; i++) { LightAddNode(iLight, iStartX, iStartY, iXPos, iYPos, ubStartIntens, usFlags); iXPos=iXPos+XAdvance; - } - } - return(TRUE); - } - if (XDelta == YDelta) - { - /* Diagonal line */ - if(fInsertNodes) + } + } + return(TRUE); + } + if (XDelta == YDelta) + { + /* Diagonal line */ + if(fInsertNodes) + { + for (i=0; i<=XDelta; i++) { - for (i=0; i<=XDelta; i++) - { LightInsertNode(iLight, usCurNode, iStartX, iStartY, iXPos, iYPos, ubStartIntens, usFlags); iXPos+=XAdvance; iYPos++; } - } - else - { + } + else + { for (i=0; i<=XDelta; i++) { LightAddNode(iLight, iStartX, iStartY, iXPos, iYPos, ubStartIntens, usFlags); iXPos+=XAdvance; iYPos++; } - } - return(TRUE); - } + } + return(TRUE); + } - /* Determine whether the line is X or Y major, and handle accordingly */ - if (XDelta >= YDelta) - { + /* Determine whether the line is X or Y major, and handle accordingly */ + if (XDelta >= YDelta) + { /* X major line */ - /* Minimum # of pixels in a run in this line */ - WholeStep = XDelta / YDelta; + /* Minimum # of pixels in a run in this line */ + WholeStep = XDelta / YDelta; - /* Error term adjust each time Y steps by 1; used to tell when one - extra pixel should be drawn as part of a run, to account for - fractional steps along the X axis per 1-pixel steps along Y */ - AdjUp = (XDelta % YDelta) * 2; + /* Error term adjust each time Y steps by 1; used to tell when one + extra pixel should be drawn as part of a run, to account for + fractional steps along the X axis per 1-pixel steps along Y */ + AdjUp = (XDelta % YDelta) * 2; - /* Error term adjust when the error term turns over, used to factor - out the X step made at that time */ - AdjDown = YDelta * 2; + /* Error term adjust when the error term turns over, used to factor + out the X step made at that time */ + AdjDown = YDelta * 2; - /* Initial error term; reflects an initial step of 0.5 along the Y - axis */ - ErrorTerm = (XDelta % YDelta) - (YDelta * 2); + /* Initial error term; reflects an initial step of 0.5 along the Y + axis */ + ErrorTerm = (XDelta % YDelta) - (YDelta * 2); - /* The initial and last runs are partial, because Y advances only 0.5 - for these runs, rather than 1. Divide one full run, plus the - initial pixel, between the initial and last runs */ - InitialPixelCount = (WholeStep / 2) + 1; - FinalPixelCount = InitialPixelCount; + /* The initial and last runs are partial, because Y advances only 0.5 + for these runs, rather than 1. Divide one full run, plus the + initial pixel, between the initial and last runs */ + InitialPixelCount = (WholeStep / 2) + 1; + FinalPixelCount = InitialPixelCount; - /* If the basic run length is even and there's no fractional - advance, we have one pixel that could go to either the initial - or last partial run, which we'll arbitrarily allocate to the - last run */ - if ((AdjUp == 0) && ((WholeStep & 0x01) == 0)) - { - InitialPixelCount--; - } - /* If there're an odd number of pixels per run, we have 1 pixel that can't - be allocated to either the initial or last partial run, so we'll add 0.5 - to error term so this pixel will be handled by the normal full-run loop */ - if ((WholeStep & 0x01) != 0) - { - ErrorTerm += YDelta; - } - /* Draw the first, partial run of pixels */ - //DrawHorizontalRun(&ScreenPtr, XAdvance, InitialPixelCount, Color); + /* If the basic run length is even and there's no fractional + advance, we have one pixel that could go to either the initial + or last partial run, which we'll arbitrarily allocate to the + last run */ + if ((AdjUp == 0) && ((WholeStep & 0x01) == 0)) + { + InitialPixelCount--; + } + /* If there're an odd number of pixels per run, we have 1 pixel that can't + be allocated to either the initial or last partial run, so we'll add 0.5 + to error term so this pixel will be handled by the normal full-run loop */ + if ((WholeStep & 0x01) != 0) + { + ErrorTerm += YDelta; + } + /* Draw the first, partial run of pixels */ + //DrawHorizontalRun(&ScreenPtr, XAdvance, InitialPixelCount, Color); if(fInsertNodes) { for (i=0; i 0) - { - RunLength++; - ErrorTerm -= AdjDown; /* reset the error term */ - } - /* Draw this scan line's run */ - //DrawHorizontalRun(&ScreenPtr, XAdvance, RunLength, Color); - if(fInsertNodes) - { + /* Draw all full runs */ + for (j=0; j<(YDelta-1); j++) + { + RunLength = WholeStep; /* run is at least this long */ + /* Advance the error term and add an extra pixel if the error + term so indicates */ + if ((ErrorTerm += AdjUp) > 0) + { + RunLength++; + ErrorTerm -= AdjDown; /* reset the error term */ + } + /* Draw this scan line's run */ + //DrawHorizontalRun(&ScreenPtr, XAdvance, RunLength, Color); + if(fInsertNodes) + { for (i=0; i 0) - { - RunLength++; - ErrorTerm -= AdjDown; /* reset the error term */ - } - /* Draw this scan line's run */ - //DrawVerticalRun(&ScreenPtr, XAdvance, RunLength, Color); + /* Draw all full runs */ + for (j=0; j<(XDelta-1); j++) + { + RunLength = WholeStep; /* run is at least this long */ + /* Advance the error term and add an extra pixel if the error + term so indicates */ + if ((ErrorTerm += AdjUp) > 0) + { + RunLength++; + ErrorTerm -= AdjDown; /* reset the error term */ + } + /* Draw this scan line's run */ + //DrawVerticalRun(&ScreenPtr, XAdvance, RunLength, Color); if(fInsertNodes) { for (i=0; i= 0) WorkingY= (INT32)(sqrt(Temp)+0.5); else WorkingY=0; - /* Stop if X is no longer the major axis (the arc has passed the - 45-degree point) */ - if(((DOUBLE)WorkingY/BSquared) <= ((DOUBLE)WorkingX/ASquared)) - break; + /* Stop if X is no longer the major axis (the arc has passed the + 45-degree point) */ + if(((DOUBLE)WorkingY/BSquared) <= ((DOUBLE)WorkingX/ASquared)) + break; - /* Draw the 4 symmetries of the current point */ + /* Draw the 4 symmetries of the current point */ LightCastRay(iLight, iX, iY, (INT16)(iX+WorkingX), (INT16)(iY-WorkingY), iIntensity, 1); - LightCastRay(iLight, iX, iY, (INT16)(iX-WorkingX), (INT16)(iY-WorkingY), iIntensity, 1); - LightCastRay(iLight, iX, iY, (INT16)(iX+WorkingX), (INT16)(iY+WorkingY), iIntensity, 1); - LightCastRay(iLight, iX, iY, (INT16)(iX-WorkingX), (INT16)(iY+WorkingY), iIntensity, 1); - } + LightCastRay(iLight, iX, iY, (INT16)(iX-WorkingX), (INT16)(iY-WorkingY), iIntensity, 1); + LightCastRay(iLight, iX, iY, (INT16)(iX+WorkingX), (INT16)(iY+WorkingY), iIntensity, 1); + LightCastRay(iLight, iX, iY, (INT16)(iX-WorkingX), (INT16)(iY+WorkingY), iIntensity, 1); + } - /* Draw the four symmetric arcs for which Y advances faster (that is, - for which Y is the major axis) */ - /* Draw the initial left & right points */ - LightCastRay(iLight, iX, iY, (INT16)(iX+iA), iY, iIntensity, 1); - LightCastRay(iLight, iX, iY, (INT16)(iX-iA), iY, iIntensity, 1); + /* Draw the four symmetric arcs for which Y advances faster (that is, + for which Y is the major axis) */ + /* Draw the initial left & right points */ + LightCastRay(iLight, iX, iY, (INT16)(iX+iA), iY, iIntensity, 1); + LightCastRay(iLight, iX, iY, (INT16)(iX-iA), iY, iIntensity, 1); - /* Draw the four arcs */ - for (WorkingY = 0; ; ) - { - /* Advance one pixel along the Y axis */ - WorkingY++; + /* Draw the four arcs */ + for (WorkingY = 0; ; ) + { + /* Advance one pixel along the Y axis */ + WorkingY++; - /* Calculate the corresponding point along the X axis. Guard - against floating-point roundoff making the intermediate term - less than 0 */ - Temp = ASquared - (ASquared * WorkingY * WorkingY / BSquared); + /* Calculate the corresponding point along the X axis. Guard + against floating-point roundoff making the intermediate term + less than 0 */ + Temp = ASquared - (ASquared * WorkingY * WorkingY / BSquared); if(Temp >= 0) WorkingX = (INT32)(sqrt(Temp)+0.5); else WorkingX = 0; - /* Stop if Y is no longer the major axis (the arc has passed the - 45-degree point) */ - if (((DOUBLE)WorkingX/ASquared) < ((DOUBLE)WorkingY/BSquared)) - break; + /* Stop if Y is no longer the major axis (the arc has passed the + 45-degree point) */ + if (((DOUBLE)WorkingX/ASquared) < ((DOUBLE)WorkingY/BSquared)) + break; + + /* Draw the 4 symmetries of the current point */ + LightCastRay(iLight, iX, iY, (INT16)(iX+WorkingX), (INT16)(iY-WorkingY), iIntensity, 1); + LightCastRay(iLight, iX, iY, (INT16)(iX-WorkingX), (INT16)(iY-WorkingY), iIntensity, 1); + LightCastRay(iLight, iX, iY, (INT16)(iX+WorkingX), (INT16)(iY+WorkingY), iIntensity, 1); + LightCastRay(iLight, iX, iY, (INT16)(iX-WorkingX), (INT16)(iY+WorkingY), iIntensity, 1); + } - /* Draw the 4 symmetries of the current point */ - LightCastRay(iLight, iX, iY, (INT16)(iX+WorkingX), (INT16)(iY-WorkingY), iIntensity, 1); - LightCastRay(iLight, iX, iY, (INT16)(iX-WorkingX), (INT16)(iY-WorkingY), iIntensity, 1); - LightCastRay(iLight, iX, iY, (INT16)(iX+WorkingX), (INT16)(iY+WorkingY), iIntensity, 1); - LightCastRay(iLight, iX, iY, (INT16)(iX-WorkingX), (INT16)(iY+WorkingY), iIntensity, 1); - } - return(TRUE); } /**************************************************************************************** LightGenerateSquare - Creates an square light, taking two radii. + Creates an square light, taking two radii. ***************************************************************************************/ BOOLEAN LightGenerateSquare(INT32 iLight, UINT8 iIntensity, INT16 iA, INT16 iB) @@ -1960,7 +1958,7 @@ INT16 iX, iY; LightCastRay(iLight, 0, 0, (INT16)(0-iA), iY, iIntensity, 1); for(iY=0-iB; iY <= 0+iB; iY++) - LightCastRay(iLight, 0, 0, (INT16)(0+iA), iY, iIntensity, 1); + LightCastRay(iLight, 0, 0, (INT16)(0+iA), iY, iIntensity, 1); /*for(iY=0-iB; iY <= 0+iB; iY++) @@ -2015,7 +2013,7 @@ BOOLEAN LightSetBaseLevel(UINT8 iIntensity) if ( pSoldier->bTeam == gbPlayerNum ) { // Re-create soldier lights - ReCreateSoldierLight( pSoldier ); + pSoldier->ReCreateSoldierLight( ); } } } @@ -2188,7 +2186,7 @@ UINT16 usWallOrientation; #endif - return( TRUE ); + return( TRUE ); } /**************************************************************************************** @@ -2237,9 +2235,9 @@ BOOLEAN fOnlyWalls; sSum=__max(SHADE_MAX, sSum); gpWorldLevelData[ ].ubRealShadeLevel = (UINT8) sSum; - + } - + } */ @@ -2253,7 +2251,7 @@ BOOLEAN fOnlyWalls; if(!(usNodeIndex&LIGHT_NEW_RAY)) { fBlocked = FALSE; - fOnlyWalls = FALSE; + fOnlyWalls = FALSE; pLight=pLightList[iLight]+(usNodeIndex&(~LIGHT_BACKLIGHT)); @@ -2263,7 +2261,7 @@ BOOLEAN fOnlyWalls; { uiCount=LightFindNextRay(iLight, uiCount); - fOnlyWalls = TRUE; + fOnlyWalls = TRUE; fBlocked = TRUE; } } @@ -2292,7 +2290,7 @@ BOOLEAN fOnlyWalls; iOldX = iX+pLight->iDX; iOldY = iY+pLight->iDY; } - + } else { @@ -2317,7 +2315,7 @@ BOOLEAN LightRevealWall(INT16 sX, INT16 sY, INT16 sSrcX, INT16 sSrcY) if(sX < sSrcX) fDoRightWalls=FALSE; - + if(sY < sSrcY) fDoLeftWalls=FALSE; @@ -2328,7 +2326,7 @@ BOOLEAN LightRevealWall(INT16 sX, INT16 sY, INT16 sSrcX, INT16 sSrcY) } pStruct=gpWorldLevelData[uiTile].pStructHead; - + //while(pStruct!=NULL) while(pStruct!=NULL && pStruct->usIndexpNext; } - + pStruct=gpWorldLevelData[uiTile].pStructHead; - + //while(pStruct!=NULL) while(pStruct!=NULL && pStruct->usIndexusIndexusIndexusIndexusIndex]); switch(TileElem->usWallOrientation) @@ -2466,7 +2464,7 @@ TILE_ELEMENT *TileElem; if(fRerender) SetRenderFlags(RENDER_FLAG_FULL); - + return(fHitWall); } @@ -2491,12 +2489,12 @@ BOOLEAN CalcTranslucentWalls(INT16 iX, INT16 iY) { pLight=pLightList[0]+(usNodeIndex&(~LIGHT_BACKLIGHT)); - //Kris: added map boundary checking!!! + //Kris: added map boundary checking!!! if(LightRevealWall( - (INT16)min(max((iX+pLight->iDX),0),WORLD_COLS-1), - (INT16)min(max((iY+pLight->iDY),0),WORLD_ROWS-1), - (INT16)min(max(iX,0),WORLD_COLS-1), - (INT16)min(max(iY,0),WORLD_ROWS-1) + (INT16)min(max((iX+pLight->iDX),0),WORLD_COLS-1), + (INT16)min(max((iY+pLight->iDY),0),WORLD_ROWS-1), + (INT16)min(max(iX,0),WORLD_COLS-1), + (INT16)min(max(iY,0),WORLD_ROWS-1) )) { uiCount=LightFindNextRay(0, uiCount); @@ -2566,7 +2564,7 @@ TILE_ELEMENT *TileElem; gpWorldLevelData[uiTile].uiFlags|=MAPELEMENT_REDRAW; SetRenderFlags(RENDER_FLAG_MARKED); //} - + return(fHitWall); } @@ -2672,7 +2670,7 @@ TILE_ELEMENT *TileElem; gpWorldLevelData[uiTile].uiFlags|=MAPELEMENT_REDRAW; SetRenderFlags(RENDER_FLAG_MARKED); //} - + return(fHitWall); } @@ -2732,12 +2730,12 @@ UINT16 usNodeIndex; if(!(usNodeIndex&LIGHT_NEW_RAY)) { pLight=pLightList[0]+(usNodeIndex&(~LIGHT_BACKLIGHT)); - //Kris: added map boundary checking!!! + //Kris: added map boundary checking!!! if(LightHideWall( - (INT16)min(max((iX+pLight->iDX),0),WORLD_COLS-1), - (INT16)min(max((iY+pLight->iDY),0),WORLD_ROWS-1), - (INT16)min(max(iX,0),WORLD_COLS-1), - (INT16)min(max(iY,0),WORLD_ROWS-1) + (INT16)min(max((iX+pLight->iDX),0),WORLD_COLS-1), + (INT16)min(max((iY+pLight->iDY),0),WORLD_ROWS-1), + (INT16)min(max(iX,0),WORLD_COLS-1), + (INT16)min(max(iY,0),WORLD_ROWS-1) )) { uiCount=LightFindNextRay(0, uiCount); @@ -2777,7 +2775,7 @@ UINT32 fTileFlags; if ( !( pNode->uiFlags & LEVELNODE_REVEALTREES ) ) { //pNode->uiFlags |= ( LEVELNODE_REVEALTREES | LEVELNODE_ERASEZ ); - pNode->uiFlags |= ( LEVELNODE_REVEALTREES ); + pNode->uiFlags |= ( LEVELNODE_REVEALTREES ); gpWorldLevelData[uiTile].uiFlags |= MAPELEMENT_REDRAW; } @@ -2810,7 +2808,7 @@ LEVELNODE *pNode; BOOLEAN fRerender=FALSE; UINT32 fTileFlags; - //Kris: added map boundary checking!!! + //Kris: added map boundary checking!!! for(iCountY=(INT16)__max(iY-LIGHT_TREE_REVEAL,0); iCountY < (INT16)__min(iY+LIGHT_TREE_REVEAL,WORLD_ROWS-1); iCountY++) for(iCountX=(INT16)__max(iX-LIGHT_TREE_REVEAL,0); iCountX < (INT16)__min(iX+LIGHT_TREE_REVEAL,WORLD_COLS-1); iCountX++) { @@ -2822,11 +2820,11 @@ UINT32 fTileFlags; if ( fTileFlags & FULL3D_TILE ) { - + if ( ( pNode->uiFlags & LEVELNODE_REVEALTREES ) ) { - //pNode->uiFlags &=(~( LEVELNODE_REVEALTREES | LEVELNODE_ERASEZ ) ); - pNode->uiFlags &=(~( LEVELNODE_REVEALTREES ) ); + //pNode->uiFlags &=(~( LEVELNODE_REVEALTREES | LEVELNODE_ERASEZ ) ); + pNode->uiFlags &=(~( LEVELNODE_REVEALTREES ) ); gpWorldLevelData[uiTile].uiFlags |= MAPELEMENT_REDRAW; } @@ -2884,17 +2882,17 @@ BOOLEAN fOnlyWalls; if(!(usNodeIndex&LIGHT_NEW_RAY)) { fBlocked = FALSE; - fOnlyWalls = FALSE; + fOnlyWalls = FALSE; pLight=pLightList[iLight]+(usNodeIndex&(~LIGHT_BACKLIGHT)); - + if(!(LightSprites[uiSprite].uiFlags&LIGHT_SPR_ONROOF)) { if(LightTileBlocked( (INT16)iOldX, (INT16)iOldY, (INT16)(iX+pLight->iDX), (INT16)(iY+pLight->iDY))) { uiCount=LightFindNextRay(iLight, uiCount); - fOnlyWalls = TRUE; + fOnlyWalls = TRUE; fBlocked = TRUE; } } @@ -2920,7 +2918,7 @@ BOOLEAN fOnlyWalls; { iOldX = iX+pLight->iDX; iOldY = iY+pLight->iDY; - } + } } else { @@ -2968,10 +2966,10 @@ LIGHT_NODE *pLight; } } - FromCellToScreenCoordinates((INT16)(MaxRect.iLeft*CELL_X_SIZE), - (INT16)(MaxRect.iTop*CELL_Y_SIZE), + FromCellToScreenCoordinates((INT16)(MaxRect.iLeft*CELL_X_SIZE), + (INT16)(MaxRect.iTop*CELL_Y_SIZE), &sDummy, &sYValue); - + LightMapLeft[iLight]=(INT16)MaxRect.iLeft; LightMapTop[iLight]=(INT16)MaxRect.iTop; LightMapRight[iLight]=(INT16)MaxRect.iRight; @@ -2980,19 +2978,19 @@ LIGHT_NODE *pLight; LightHeight[iLight]=-sYValue; LightYOffset[iLight]=sYValue; - FromCellToScreenCoordinates((INT16)(MaxRect.iRight*CELL_X_SIZE), + FromCellToScreenCoordinates((INT16)(MaxRect.iRight*CELL_X_SIZE), (INT16)(MaxRect.iBottom*CELL_Y_SIZE), &sDummy, &sYValue); LightHeight[iLight]+=sYValue; - FromCellToScreenCoordinates((INT16)(MaxRect.iLeft*CELL_X_SIZE), - (INT16)(MaxRect.iBottom*CELL_Y_SIZE), + FromCellToScreenCoordinates((INT16)(MaxRect.iLeft*CELL_X_SIZE), + (INT16)(MaxRect.iBottom*CELL_Y_SIZE), &sXValue, &sDummy); LightWidth[iLight]=-sXValue; LightXOffset[iLight]=sXValue; - FromCellToScreenCoordinates((INT16)(MaxRect.iRight*CELL_X_SIZE), - (INT16)(MaxRect.iTop*CELL_Y_SIZE), + FromCellToScreenCoordinates((INT16)(MaxRect.iRight*CELL_X_SIZE), + (INT16)(MaxRect.iTop*CELL_Y_SIZE), &sXValue, &sDummy); LightWidth[iLight]+=sXValue; @@ -3019,7 +3017,7 @@ BOOLEAN LightSave(INT32 iLight, STR pFilename) if(pLightList[iLight]==NULL) return(FALSE); - else + else { if(pFilename==NULL) pName=pLightNames[iLight]; @@ -3051,12 +3049,11 @@ BOOLEAN LightSave(INT32 iLight, STR pFilename) INT32 LightLoad(STR pFilename) { HWFILE hFile; - LIGHT_NODE *pNewLight=NULL, *pLastLight=NULL; INT32 iLight; if((iLight=LightGetFree())==(-1)) return(-1); - else + else { if((hFile=FileOpen(pFilename, FILE_ACCESS_READ, FALSE))!=0) { @@ -3140,7 +3137,7 @@ BOOLEAN LightSetColors(SGPPaletteEntry *pPal, UINT8 ubNumColors) if( pPal[0].peRed != gpLightColors[0].peRed || pPal[0].peGreen != gpLightColors[0].peGreen || pPal[0].peBlue != gpLightColors[0].peBlue ) - { //Set the entire tileset database so that it reloads everything. It has to because the + { //Set the entire tileset database so that it reloads everything. It has to because the //colors have changed. SetAllNewTileSurfacesLoaded( TRUE ); } @@ -3160,7 +3157,7 @@ BOOLEAN LightSetColors(SGPPaletteEntry *pPal, UINT8 ubNumColors) sRed=__min((((INT16)pPal[0].peRed)*LVL1_L1_PER/100 + ((INT16)pPal[1].peRed)*LVL1_L2_PER/100), 255); sGreen=__min((((INT16)pPal[0].peGreen)*LVL1_L1_PER/100 + ((INT16)pPal[1].peGreen)*LVL1_L2_PER/100), 255); sBlue=__min((((INT16)pPal[0].peBlue)*LVL1_L1_PER/100 + ((INT16)pPal[1].peBlue)*LVL1_L2_PER/100), 255); - + gpLightColors[1].peRed=(UINT8)(sRed); gpLightColors[1].peGreen=(UINT8)(sGreen); gpLightColors[1].peBlue=(UINT8)(sBlue); @@ -3177,7 +3174,7 @@ BOOLEAN LightSetColors(SGPPaletteEntry *pPal, UINT8 ubNumColors) BuildTileShadeTables( ); - // Build all palettes for all soldiers in the world + // Build all palettes for all soldiers in the world // ( THIS FUNCTION WILL ERASE THEM IF THEY EXIST ) RebuildAllSoldierShadeTables( ); @@ -3200,14 +3197,14 @@ BOOLEAN LightSetColors(SGPPaletteEntry *pPal, UINT8 ubNumColors) ********************************************************************************/ INT32 LightSpriteGetFree(void) { - INT32 iCount; +INT32 iCount; for(iCount=0; iCount < MAX_LIGHT_SPRITES; iCount++) { if(!(LightSprites[iCount].uiFlags&LIGHT_SPR_ACTIVE)) return(iCount); } - + return(-1); } @@ -3220,7 +3217,7 @@ INT32 LightSpriteGetFree(void) ********************************************************************************/ INT32 LightSpriteCreate(STR pName, UINT32 uiLightType) { - INT32 iSprite; +INT32 iSprite; if((iSprite=LightSpriteGetFree())!=(-1)) { @@ -3236,7 +3233,7 @@ INT32 LightSpriteCreate(STR pName, UINT32 uiLightType) return(-1); LightSprites[iSprite].uiFlags|=LIGHT_SPR_ACTIVE; - } + } return(iSprite); } @@ -3269,7 +3266,7 @@ BOOLEAN LightSpriteFake(INT32 iSprite) /******************************************************************************** * LightSpriteDestroy * -* Removes an instance of a light. If it was on, it is erased from the scene. +* Removes an instance of a light. If it was on, it is erased from the scene. * ********************************************************************************/ BOOLEAN LightSpriteDestroy(INT32 iSprite) @@ -3285,7 +3282,7 @@ BOOLEAN LightSpriteDestroy(INT32 iSprite) { if((LightSprites[iSprite].iX < WORLD_COLS) && (LightSprites[iSprite].iY < WORLD_ROWS)) { - LightErase(LightSprites[iSprite].uiLightType, LightSprites[iSprite].iTemplate, LightSprites[iSprite].iX, LightSprites[iSprite].iY, iSprite); + LightErase(LightSprites[iSprite].uiLightType, LightSprites[iSprite].iTemplate, LightSprites[iSprite].iX, LightSprites[iSprite].iY, iSprite); LightSpriteDirty(iSprite); } LightSprites[iSprite].uiFlags&=(~LIGHT_SPR_ERASE); @@ -3316,7 +3313,7 @@ BOOLEAN LightSpriteRender(void) if(LightSprites[iCount].uiFlags&LIGHT_SPR_ACTIVE) { if((LightSprites[iCount].iX!=LightSprites[iCount].iOldX) - || (LightSprites[iCount].iY!=LightSprites[iCount].iOldY) + || (LightSprites[iCount].iY!=LightSprites[iCount].iOldY) || (LightSprites[iCount].uiFlags&LIGHT_SPR_REDRAW)) { if(LightSprites[iCount].iOldX < WORLD_COLS) @@ -3360,8 +3357,7 @@ BOOLEAN LightSpriteRender(void) ********************************************************************************/ BOOLEAN LightSpriteRenderAll(void) { -INT32 iCount; -BOOLEAN fRenderLights=FALSE; + INT32 iCount; LightResetAllTiles(); for(iCount=0; iCount < MAX_LIGHT_SPRITES; iCount++) @@ -3377,7 +3373,7 @@ BOOLEAN fRenderLights=FALSE; LightSprites[iCount].iOldX=LightSprites[iCount].iX; LightSprites[iCount].iOldY=LightSprites[iCount].iY; - } + } return(TRUE); } @@ -3408,7 +3404,7 @@ BOOLEAN LightSpritePosition(INT32 iSprite, INT16 iX, INT16 iY) LightSpriteDirty(iSprite); } } - + //LightSprites[iSprite].iOldX=LightSprites[iSprite].iX; //LightSprites[iSprite].iOldY=LightSprites[iSprite].iY; @@ -3427,7 +3423,7 @@ BOOLEAN LightSpritePosition(INT32 iSprite, INT16 iX, INT16 iY) } else return(FALSE); - + return(TRUE); } @@ -3446,10 +3442,10 @@ BOOLEAN LightSpriteRoofStatus(INT32 iSprite, BOOLEAN fOnRoof) if(fOnRoof && (LightSprites[iSprite].uiFlags&LIGHT_SPR_ONROOF)) return(FALSE); - + if(!fOnRoof && !(LightSprites[iSprite].uiFlags&LIGHT_SPR_ONROOF)) return(FALSE); - + if(LightSprites[iSprite].uiFlags&LIGHT_SPR_ACTIVE) { if(LightSprites[iSprite].uiFlags&LIGHT_SPR_ERASE) @@ -3479,7 +3475,7 @@ BOOLEAN LightSpriteRoofStatus(INT32 iSprite, BOOLEAN fOnRoof) } else return(FALSE); - + return(TRUE); } @@ -3547,8 +3543,8 @@ BOOLEAN LightSpriteDirty(INT32 iSprite) //INT16 iLeft_s, iTop_s; //INT16 iMapLeft, iMapTop, iMapRight, iMapBottom; - //CellXYToScreenXY((INT16)(LightSprites[iSprite].iX*CELL_X_SIZE), - // (INT16)(LightSprites[iSprite].iY*CELL_Y_SIZE), &iLeft_s, &iTop_s); + //CellXYToScreenXY((INT16)(LightSprites[iSprite].iX*CELL_X_SIZE), + // (INT16)(LightSprites[iSprite].iY*CELL_Y_SIZE), &iLeft_s, &iTop_s); //iLeft_s+=LightXOffset[LightSprites[iSprite].iTemplate]; //iTop_s+=LightYOffset[LightSprites[iSprite].iTemplate]; @@ -3561,10 +3557,10 @@ BOOLEAN LightSpriteDirty(INT32 iSprite) //ReRenderWorld(iMapLeft, iMapTop, iMapRight, iMapBottom); //UpdateSaveBuffer(); //AddBaseDirtyRect(gsVIEWPORT_START_X, gsVIEWPORT_START_Y, gsVIEWPORT_END_X, gsVIEWPORT_END_Y ); - //AddBaseDirtyRect(iLeft_s, iTop_s, - // (INT16)(iLeft_s+LightWidth[LightSprites[iSprite].iTemplate]), + //AddBaseDirtyRect(iLeft_s, iTop_s, + // (INT16)(iLeft_s+LightWidth[LightSprites[iSprite].iTemplate]), // (INT16)(iTop_s+LightHeight[LightSprites[iSprite].iTemplate])); - + SetRenderFlags(RENDER_FLAG_MARKED); return(TRUE); @@ -3577,13 +3573,13 @@ UINT32 uiCount; pObj->pShades[uiBase]=Create16BPPPaletteShaded( pShadePal, gusShadeLevels[0][0], gusShadeLevels[0][1], - gusShadeLevels[0][2], TRUE); - + gusShadeLevels[0][2], TRUE); + for(uiCount=1; uiCount < 16; uiCount++) { pObj->pShades[uiBase+uiCount]=Create16BPPPaletteShaded( pShadePal, gusShadeLevels[uiCount][0], gusShadeLevels[uiCount][1], - gusShadeLevels[uiCount][2], FALSE); + gusShadeLevels[uiCount][2], FALSE); } return(TRUE); @@ -3595,13 +3591,13 @@ BOOLEAN CreateSoldierShadedPalette( SOLDIERTYPE *pSoldier, UINT32 uiBase, SGPPal pSoldier->pShades[uiBase]=Create16BPPPaletteShaded( pShadePal, gusShadeLevels[0][0], gusShadeLevels[0][1], - gusShadeLevels[0][2], TRUE); - + gusShadeLevels[0][2], TRUE); + for(uiCount=1; uiCount < 16; uiCount++) { pSoldier->pShades[uiBase+uiCount]=Create16BPPPaletteShaded( pShadePal, gusShadeLevels[uiCount][0], gusShadeLevels[uiCount][1], - gusShadeLevels[uiCount][2], FALSE); + gusShadeLevels[uiCount][2], FALSE); } return(TRUE); @@ -3611,7 +3607,7 @@ BOOLEAN CreateSoldierShadedPalette( SOLDIERTYPE *pSoldier, UINT32 uiBase, SGPPal /********************************************************************************************** CreateObjectPaletteTables - Creates the shading tables for 8-bit brushes. One highlight table is created, based on + Creates the shading tables for 8-bit brushes. One highlight table is created, based on the object-type, 3 brightening tables, 1 normal, and 11 darkening tables. The entries are created iteratively, rather than in a loop to allow hand-tweaking of the values. If you change the HVOBJECT_SHADE_TABLES symbol, remember to add/delete entries here, it won't @@ -3632,8 +3628,8 @@ UINT16 CreateTilePaletteTables(HVOBJECT pObj, UINT32 uiTileIndex, BOOLEAN fForce // create the basic shade table if( !gfForceBuildShadeTables && !fForce ) - { //The overwhelming majority of maps use the neutral 0,0,0 light for outdoors. These shadetables - //are extremely time consuming to generate, so we will attempt to load them. If we do, then + { //The overwhelming majority of maps use the neutral 0,0,0 light for outdoors. These shadetables + //are extremely time consuming to generate, so we will attempt to load them. If we do, then //we skip the generation process altogether. if( LoadShadeTable( pObj, uiTileIndex ) ) { @@ -3675,7 +3671,7 @@ UINT16 CreateTilePaletteTables(HVOBJECT pObj, UINT32 uiTileIndex, BOOLEAN fForce LightPal[uiCount].peBlue=(UINT8)(__min((UINT16)pObj->pPaletteEntry[uiCount].peBlue+(UINT16)gpLightColors[1].peBlue, 255)); } CreateObjectPalette(pObj, 16, LightPal); - + // build a table that is a mix of the first two for(uiCount=0; uiCount < 256; uiCount++) { @@ -3685,7 +3681,7 @@ UINT16 CreateTilePaletteTables(HVOBJECT pObj, UINT32 uiTileIndex, BOOLEAN fForce } CreateObjectPalette(pObj, 32, LightPal); } - + // build neutral palette as well! // Set current shade table to neutral color pObj->pShadeCurrent=pObj->pShades[4]; @@ -3722,7 +3718,7 @@ UINT16 CreateSoldierPaletteTables(SOLDIERTYPE *pSoldier, UINT32 uiType) LightPal[uiCount].peBlue=(UINT8)(__min((UINT16)pSoldier->p8BPPPalette[uiCount].peBlue+(UINT16)gpLightColors[1].peBlue, 255)); } CreateSoldierShadedPalette(pSoldier, 16, LightPal); - + // build a table that is a mix of the first two for(uiCount=0; uiCount < 256; uiCount++) { @@ -3732,7 +3728,7 @@ UINT16 CreateSoldierPaletteTables(SOLDIERTYPE *pSoldier, UINT32 uiType) } CreateSoldierShadedPalette(pSoldier, 32, LightPal); } - + // build neutral palette as well! // Set current shade table to neutral color pSoldier->pCurrentShade=pSoldier->pShades[4]; @@ -3743,3 +3739,4 @@ UINT16 CreateSoldierPaletteTables(SOLDIERTYPE *pSoldier, UINT32 uiType) } + diff --git a/TileEngine/lighting.h b/TileEngine/lighting.h index 23538c81..7fc7f76b 100644 --- a/TileEngine/lighting.h +++ b/TileEngine/lighting.h @@ -26,7 +26,7 @@ // lightlist node flags #define LIGHT_NODE_DRAWN 0x00000001 // light node duplicate marker -#define LIGHT_ROOF_ONLY 0x00001000 // light only rooftops +#define LIGHT_ROOF_ONLY 0x00001000 // light only rooftops #define LIGHT_IGNORE_WALLS 0x00002000 // doesn't take walls into account #define LIGHT_BACKLIGHT 0x00004000 // light does not light objs, trees #define LIGHT_NEW_RAY 0x00008000 // start of new ray in linked list @@ -57,7 +57,7 @@ #define LIGHT_SPR_ERASE 0x0008 #define LIGHT_SPR_REDRAW 0x0010 #define LIGHT_SPR_ONROOF 0x0020 -#define MERC_LIGHT 0x0040 +#define MERC_LIGHT 0x0040 #define LIGHT_PRIMETIME 0x0080 // light turns goes on in evening, turns off at bedtime. #define LIGHT_NIGHTTIME 0x0100 // light stays on when dark outside diff --git a/TileEngine/overhead map.cpp b/TileEngine/overhead map.cpp index 2f83b343..b4641b8e 100644 --- a/TileEngine/overhead map.cpp +++ b/TileEngine/overhead map.cpp @@ -39,9 +39,9 @@ #include "gameloop.h" #include "sysutil.h" #include "tile surface.h" + #include #endif - #ifdef JA2EDITOR #include "Soldier Init List.h" extern SOLDIERINITNODE *gpSelected; @@ -70,7 +70,7 @@ typedef struct typedef struct { HVOBJECT vo; - UINT16 usSubIndex; + UINT16 usSubIndex; UINT32 fType; } SMALL_TILE_DB; @@ -78,7 +78,7 @@ typedef struct SMALL_TILE_SURF gSmTileSurf[ NUMBEROFTILETYPES ]; SMALL_TILE_DB gSmTileDB[ NUMBEROFTILES ]; -UINT8 gubSmTileNum = 0; +UINT8 gubSmTileNum = 0; BOOLEAN gfSmTileLoaded = FALSE; BOOLEAN gfInOverheadMap = FALSE; MOUSE_REGION OverheadRegion; @@ -116,8 +116,8 @@ void RenderOverheadOverlays(); void InitNewOverheadDB( UINT8 ubTilesetID ) { UINT32 uiLoop; - VOBJECT_DESC VObjectDesc; - HVOBJECT hVObject; + VOBJECT_DESC VObjectDesc; + HVOBJECT hVObject; CHAR8 cFileBPP[128]; CHAR8 cAdjustedFile[ 128 ]; UINT32 cnt1, cnt2; @@ -125,7 +125,7 @@ void InitNewOverheadDB( UINT8 ubTilesetID ) UINT32 NumRegions; UINT32 dbSize = 0; - + for (uiLoop = 0; uiLoop < NUMBEROFTILETYPES; uiLoop++) { @@ -135,7 +135,7 @@ void InitNewOverheadDB( UINT8 ubTilesetID ) FilenameForBPP( gTilesets[ ubTilesetID ].TileSurfaceFilenames[ uiLoop ], cFileBPP); // Adjust for tileset position - sprintf( cAdjustedFile, "TILESETS\\%d\\T\\%s", ubTilesetID, cFileBPP ); + sprintf( cAdjustedFile, "TILESETS\\%d\\T\\%s", ubTilesetID, cFileBPP ); VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; strcpy( VObjectDesc.ImageFile, cAdjustedFile); @@ -146,7 +146,7 @@ void InitNewOverheadDB( UINT8 ubTilesetID ) // TRY loading from default directory FilenameForBPP( gTilesets[ TLS_GENERIC_1 ].TileSurfaceFilenames[ uiLoop ], cFileBPP); // Adjust for tileset position - sprintf( cAdjustedFile, "TILESETS\\0\\T\\%s", cFileBPP ); + sprintf( cAdjustedFile, "TILESETS\\0\\T\\%s", cFileBPP ); // LOAD ONE WE KNOW ABOUT! VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; @@ -173,7 +173,7 @@ void InitNewOverheadDB( UINT8 ubTilesetID ) s = gSmTileSurf[ cnt1 ]; NumRegions = s.vo->usNumberOfObjects; - + // Check for overflow if ( NumRegions > gNumTilesPerType[ cnt1 ] ) { @@ -215,7 +215,7 @@ void InitNewOverheadDB( UINT8 ubTilesetID ) INT16 sX1, sY1, sX2, sY2; CalculateRestrictedMapCoords( NORTH, &sX1, &sY1, &sX2, &gsStartRestrictedY, iOffsetHorizontal + 640, iOffsetVertical + 320 ); - CalculateRestrictedMapCoords( EAST, &sX1, &sY1, &gsStartRestrictedX, &sY2, iOffsetHorizontal + 640, iOffsetVertical + 320 ); + CalculateRestrictedMapCoords( EAST, &sX1, &sY1, &gsStartRestrictedX, &sY2, iOffsetHorizontal + 640, iOffsetVertical + 320 ); } // Copy over shade tables from main tileset @@ -237,24 +237,24 @@ void DeleteOverheadDB( ) BOOLEAN GetClosestItemPool( INT16 sSweetGridNo, ITEM_POOL **ppReturnedItemPool, UINT8 ubRadius, INT8 bLevel ) { - INT16 sTop, sBottom; - INT16 sLeft, sRight; - INT16 cnt1, cnt2; + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2; INT16 sGridNo; INT32 uiRange, uiLowestRange = 999999; INT32 leftmost; BOOLEAN fFound = FALSE; ITEM_POOL *pItemPool; - + //create dummy soldier, and use the pathing to determine which nearby slots are //reachable. sTop = ubRadius; sBottom = -ubRadius; - sLeft = - ubRadius; - sRight = ubRadius; - - uiLowestRange = 999999; + sLeft = - ubRadius; + sRight = ubRadius; + + uiLowestRange = 999999; for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) { @@ -286,23 +286,23 @@ BOOLEAN GetClosestItemPool( INT16 sSweetGridNo, ITEM_POOL **ppReturnedItemPool, BOOLEAN GetClosestMercInOverheadMap( INT16 sSweetGridNo, SOLDIERTYPE **ppReturnedSoldier, UINT8 ubRadius ) { - INT16 sTop, sBottom; - INT16 sLeft, sRight; - INT16 cnt1, cnt2; + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2; INT16 sGridNo; INT32 uiRange, uiLowestRange = 999999; INT32 leftmost; BOOLEAN fFound = FALSE; - + //create dummy soldier, and use the pathing to determine which nearby slots are //reachable. sTop = ubRadius; sBottom = -ubRadius; - sLeft = - ubRadius; - sRight = ubRadius; - - uiLowestRange = 999999; + sLeft = - ubRadius; + sRight = ubRadius; + + uiLowestRange = 999999; for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) { @@ -315,7 +315,7 @@ BOOLEAN GetClosestMercInOverheadMap( INT16 sSweetGridNo, SOLDIERTYPE **ppReturne if( sGridNo >=0 && sGridNo < WORLD_MAX && sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) ) { // Go on sweet stop - if ( gpWorldLevelData[ sGridNo ].pMercHead != NULL && gpWorldLevelData[ sGridNo ].pMercHead->pSoldier->bVisible != -1 ) + if ( gpWorldLevelData[ sGridNo ].pMercHead != NULL && gpWorldLevelData[ sGridNo ].pMercHead->pSoldier->bVisible != -1 ) { uiRange = GetRangeInCellCoordsFromGridNoDiff( sSweetGridNo, sGridNo ); @@ -398,7 +398,7 @@ void HandleOverheadMap( ) // Force load gfSmTileLoaded = FALSE; - } + } } gubSmTileNum = (UINT8)giCurrentTilesetID; @@ -410,12 +410,12 @@ void HandleOverheadMap( ) InitNewOverheadDB( gubSmTileNum ); gfSmTileLoaded = TRUE; } - + // restore background rects RestoreBackgroundRects( ); // Render the overhead map - RenderOverheadMap( 0, (WORLD_COLS / 2), iOffsetHorizontal, + RenderOverheadMap( 0, (WORLD_COLS / 2), iOffsetHorizontal, iOffsetVertical, 640 + iOffsetHorizontal, 320 + iOffsetVertical, FALSE ); HandleTalkingAutoFaces( ); @@ -436,7 +436,7 @@ void HandleOverheadMap( ) HandleOverheadUI(); if ( !gfInOverheadMap ) - { + { return; } RenderTacticalInterface( ); @@ -448,74 +448,73 @@ void HandleOverheadMap( ) // RenderClock( CLOCK_X, CLOCK_Y ); // RenderTownIDString( ); - HandleAutoFaces( ); + HandleAutoFaces( ); } } if( !gfEditMode && !gfTacticalPlacementGUIActive ) { - INT16 usMapPos; + INT16 sMapPos; ITEM_POOL *pItemPool; gfUIHandleSelectionAboveGuy = FALSE; HandleAnyMercInSquadHasCompatibleStuff( (INT8) CurrentSquad( ), NULL, TRUE ); - if ( GetOverheadMouseGridNo( &usMapPos ) ) + if ( GetOverheadMouseGridNo( &sMapPos ) ) { // ATE: Find the closest item pool within 5 tiles.... - if ( GetClosestItemPool( usMapPos, &pItemPool, 1, 0 ) ) + if ( GetClosestItemPool( sMapPos, &pItemPool, 1, 0 ) ) { STRUCTURE *pStructure = NULL; INT16 sIntTileGridNo; INT8 bZLevel = 0; - INT16 sActionGridNo = usMapPos; + INT16 sActionGridNo = sMapPos; // Get interactive tile... if ( ConditionalGetCurInteractiveTileGridNoAndStructure( &sIntTileGridNo , &pStructure, FALSE ) ) { sActionGridNo = sIntTileGridNo; } - + bZLevel = GetZLevelOfItemPoolGivenStructure( sActionGridNo, 0, pStructure ); if ( AnyItemsVisibleOnLevel( pItemPool, bZLevel ) ) { - DrawItemPoolList( pItemPool, usMapPos , ITEMLIST_DISPLAY, bZLevel, gusMouseXPos, gusMouseYPos ); + DrawItemPoolList( pItemPool, sMapPos , ITEMLIST_DISPLAY, bZLevel, gusMouseXPos, gusMouseYPos ); gfOverItemPool = TRUE; gsOveritemPoolGridNo = pItemPool->sGridNo; } } - if ( GetClosestItemPool( usMapPos, &pItemPool, 1, 1 ) ) + if ( GetClosestItemPool( sMapPos, &pItemPool, 1, 1 ) ) { INT8 bZLevel = 0; - INT16 sActionGridNo = usMapPos; if ( AnyItemsVisibleOnLevel( pItemPool, bZLevel ) ) { - DrawItemPoolList( pItemPool, usMapPos , ITEMLIST_DISPLAY, bZLevel, gusMouseXPos, (UINT16)( gusMouseYPos - 5 ) ); + DrawItemPoolList( pItemPool, sMapPos , ITEMLIST_DISPLAY, bZLevel, gusMouseXPos, (UINT16)( gusMouseYPos - 5 ) ); gfOverItemPool = TRUE; gsOveritemPoolGridNo = pItemPool->sGridNo; } } - } + } - if ( GetOverheadMouseGridNoForFullSoldiersGridNo( &usMapPos ) ) - { - if ( GetClosestMercInOverheadMap( usMapPos, &pSoldier, 1 ) ) + if ( GetOverheadMouseGridNoForFullSoldiersGridNo( &sMapPos ) ) + { + if ( GetClosestMercInOverheadMap( sMapPos, &pSoldier, 1 ) ) { - if ( pSoldier->bTeam == gbPlayerNum ) - { - gfUIHandleSelectionAboveGuy = TRUE; - gsSelectedGuy = pSoldier->ubID; - } + if ( pSoldier->bTeam == gbPlayerNum ) + { + gfUIHandleSelectionAboveGuy = TRUE; + gsSelectedGuy = pSoldier->ubID; + } - DisplayMercNameInOverhead( pSoldier ); - } + DisplayMercNameInOverhead( pSoldier ); + } } } @@ -528,7 +527,7 @@ void HandleOverheadMap( ) { pSoldier = MercPtrs[ gusSelectedSoldier ]; - DisplayMercNameInOverhead( pSoldier ); + DisplayMercNameInOverhead( pSoldier ); } RenderButtons( ); @@ -553,7 +552,7 @@ BOOLEAN InOverheadMap( ) void GoIntoOverheadMap( ) { - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; HVOBJECT hVObject; gfInOverheadMap = TRUE; @@ -565,13 +564,13 @@ void GoIntoOverheadMap( ) iOffsetVertical = (SCREEN_HEIGHT - 160) / 2 - 160; // Vertical start position of the overview map MSYS_DefineRegion( &OverheadBackgroundRegion, 0, 0 , SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGH, - CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); //Add region MSYS_AddRegion( &OverheadBackgroundRegion ); MSYS_DefineRegion( &OverheadRegion, 0, 0 , SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGH, - CURSOR_NORMAL, MoveOverheadRegionCallback, ClickOverheadRegionCallback ); + CURSOR_NORMAL, MoveOverheadRegionCallback, ClickOverheadRegionCallback ); // Add region MSYS_AddRegion( &OverheadRegion ); @@ -608,9 +607,9 @@ void GoIntoOverheadMap( ) // Add shades to persons.... GetVideoObject( &hVObject, uiPERSONS ); - hVObject->pShades[ 0 ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 256, 256, 256, FALSE ); - hVObject->pShades[ 1 ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 310, 310, 310, FALSE ); - hVObject->pShades[ 2 ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 0, 0, 0, FALSE ); + hVObject->pShades[ 0 ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 256, 256, 256, FALSE ); + hVObject->pShades[ 1 ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 310, 310, 310, FALSE ); + hVObject->pShades[ 2 ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 0, 0, 0, FALSE ); gfOverheadMapDirty = TRUE; @@ -637,7 +636,7 @@ void GoIntoOverheadMap( ) void HandleOverheadUI( ) { - InputAtom InputEvent; + InputAtom InputEvent; INT16 sMousePos=0; UINT8 ubID; @@ -645,7 +644,7 @@ void HandleOverheadUI( ) if ( GetOverheadMouseGridNo( &sMousePos ) ) { // Look quickly for a soldier.... - ubID = QuickFindSoldier( sMousePos ); + ubID = QuickFindSoldier( sMousePos ); if ( ubID != NOBODY ) { @@ -658,10 +657,10 @@ void HandleOverheadUI( ) } } - while (DequeueEvent(&InputEvent) == TRUE) - { - if( ( InputEvent.usEvent == KEY_DOWN ) ) - { + while (DequeueEvent(&InputEvent) == TRUE) + { + if( ( InputEvent.usEvent == KEY_DOWN ) ) + { switch( InputEvent.usParam ) { case( ESC ): @@ -677,7 +676,7 @@ void HandleOverheadUI( ) } break; } - } + } } } @@ -702,7 +701,7 @@ void KillOverheadMap() INT16 GetOffsetLandHeight( INT32 sGridNo ) { INT16 sTileHeight; - + sTileHeight = gpWorldLevelData[ sGridNo ].sHeight; return( sTileHeight ); @@ -739,7 +738,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart INT16 sX, sY; UINT32 uiDestPitchBYTES; UINT8 *pDestBuf; - LEVELNODE *pNode; + LEVELNODE *pNode; SMALL_TILE_DB *pTile; INT16 sHeight; HVOBJECT hVObject; @@ -794,7 +793,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart do { - // / 5 -> / 3 + // / 5->/ 3 usTileIndex=FASTMAPROWCOLTOPOS( sTempPosY_M, sTempPosX_M ); @@ -814,8 +813,8 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart pTile->vo->pShadeCurrent= gSmTileSurf[ pTile->fType ].vo->pShades[pNode->ubShadeLevel]; // RENDER! - //BltVideoObjectFromIndex( FRAME_BUFFER, SGR1, gSmallTileDatabase[ gpWorldLevelData[ usTileIndex ].pLandHead->usIndex ], sX, sY, VO_BLT_SRCTRANSPARENCY, NULL ); - //BltVideoObjectFromIndex( FRAME_BUFFER, SGR1, 0, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL ); + //BltVideoObjectFromIndex( FRAME_BUFFER, SGR1, gSmallTileDatabase[ gpWorldLevelData[ usTileIndex ].pLandHead->usIndex ], sX, sY, VO_BLT_SRCTRANSPARENCY, NULL ); + //BltVideoObjectFromIndex( FRAME_BUFFER, SGR1, 0, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL ); Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, pTile->vo, sX, sY, pTile->usSubIndex ); pNode = pNode->pPrevNode; @@ -829,7 +828,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart if ( sTempPosX_S >= sEndXS ) { - fEndRenderRow = TRUE; + fEndRenderRow = TRUE; } } while( !fEndRenderRow ); @@ -842,7 +841,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart { sAnchorPosX_M ++; } - + bXOddFlag = !bXOddFlag; sAnchorPosY_S += 2; @@ -956,7 +955,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart sX = sTempPosX_S; sY = sTempPosY_S - (gTileDatabase[ pNode->usIndex ].sOffsetHeight/5); - + if( gTileDatabase[ pNode->usIndex ].uiFlags & IGNORE_WORLD_HEIGHT ) { sY -= sModifiedHeight; @@ -978,14 +977,14 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart pNode = pNode->pNext; } } - + sTempPosX_S += 8; sTempPosX_M ++; sTempPosY_M --; if ( sTempPosX_S >= sEndXS ) { - fEndRenderRow = TRUE; + fEndRenderRow = TRUE; } } while( !fEndRenderRow ); @@ -998,7 +997,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart { sAnchorPosX_M ++; } - + bXOddFlag = !bXOddFlag; sAnchorPosY_S += 2; @@ -1012,7 +1011,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart while( !fEndRenderCol ); //if ( !fFromMapUtility && !gfEditMode ) - { + { // ROOF RENDR LOOP // Begin Render Loop @@ -1044,30 +1043,30 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart { sHeight=( GetOffsetLandHeight(usTileIndex) /5); - pNode = gpWorldLevelData[ usTileIndex ].pRoofHead; - while( pNode != NULL ) - { - if ( pNode->usIndex < NUMBEROFTILES ) - { - if ( !( pNode->uiFlags & LEVELNODE_HIDDEN ) ) - { - pTile = &( gSmTileDB[ pNode->usIndex ] ); + pNode = gpWorldLevelData[ usTileIndex ].pRoofHead; + while( pNode != NULL ) + { + if ( pNode->usIndex < NUMBEROFTILES ) + { + if ( !( pNode->uiFlags & LEVELNODE_HIDDEN ) ) + { + pTile = &( gSmTileDB[ pNode->usIndex ] ); - sX = sTempPosX_S; - sY = sTempPosY_S - (gTileDatabase[ pNode->usIndex ].sOffsetHeight/5) -sHeight; + sX = sTempPosX_S; + sY = sTempPosY_S - (gTileDatabase[ pNode->usIndex ].sOffsetHeight/5) -sHeight; - sY -= ( WALL_HEIGHT/5 ); + sY -= ( WALL_HEIGHT/5 ); - sY += ( gsRenderHeight / 5 ); + sY += ( gsRenderHeight / 5 ); - pTile->vo->pShadeCurrent= gSmTileSurf[ pTile->fType ].vo->pShades[pNode->ubShadeLevel]; + pTile->vo->pShadeCurrent= gSmTileSurf[ pTile->fType ].vo->pShades[pNode->ubShadeLevel]; - // RENDER! - Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, pTile->vo, sX, sY, pTile->usSubIndex ); - } - } - pNode = pNode->pNext; - } + // RENDER! + Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, pTile->vo, sX, sY, pTile->usSubIndex ); + } + } + pNode = pNode->pNext; + } } sTempPosX_S += 8; @@ -1076,7 +1075,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart if ( sTempPosX_S >= sEndXS ) { - fEndRenderRow = TRUE; + fEndRenderRow = TRUE; } } while( !fEndRenderRow ); @@ -1089,7 +1088,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart { sAnchorPosX_M ++; } - + bXOddFlag = !bXOddFlag; sAnchorPosY_S += 2; @@ -1109,16 +1108,16 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart if ( gMapInformation.ubRestrictedScrollID != 0 ) { CalculateRestrictedMapCoords( NORTH, &sX1, &sY1, &sX2, &sY2, sEndXS, sEndYS ); - ColorFillVideoSurfaceArea( FRAME_BUFFER, sX1, sY1, sX2, sY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + ColorFillVideoSurfaceArea( FRAME_BUFFER, sX1, sY1, sX2, sY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); CalculateRestrictedMapCoords( EAST, &sX1, &sY1, &sX2, &sY2, sEndXS, sEndYS ); - ColorFillVideoSurfaceArea( FRAME_BUFFER, sX1, sY1, sX2, sY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + ColorFillVideoSurfaceArea( FRAME_BUFFER, sX1, sY1, sX2, sY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); CalculateRestrictedMapCoords( SOUTH, &sX1, &sY1, &sX2, &sY2, sEndXS, sEndYS ); - ColorFillVideoSurfaceArea( FRAME_BUFFER, sX1, sY1, sX2, sY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + ColorFillVideoSurfaceArea( FRAME_BUFFER, sX1, sY1, sX2, sY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); CalculateRestrictedMapCoords( WEST, &sX1, &sY1, &sX2, &sY2, sEndXS, sEndYS ); - ColorFillVideoSurfaceArea( FRAME_BUFFER, sX1, sY1, sX2, sY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + ColorFillVideoSurfaceArea( FRAME_BUFFER, sX1, sY1, sX2, sY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); } if ( !fFromMapUtility ) @@ -1127,31 +1126,31 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart BltVideoObjectFromIndex( FRAME_BUFFER, uiOVERMAP, 0, 0, 0, VO_BLT_SRCTRANSPARENCY, NULL ); } - // Update the save buffer - { - UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; - UINT8 *pDestBuf, *pSrcBuf; - UINT16 usWidth, usHeight; - UINT8 ubBitDepth; - - // Update saved buffer - do for the viewport size ony! - GetCurrentVideoSettings( &usWidth, &usHeight, &ubBitDepth ); + // Update the save buffer + { + UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; + UINT8 *pDestBuf, *pSrcBuf; + UINT16 usWidth, usHeight; + UINT8 ubBitDepth; - pSrcBuf = LockVideoSurface(guiRENDERBUFFER, &uiSrcPitchBYTES); - pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES); + // Update saved buffer - do for the viewport size ony! + GetCurrentVideoSettings( &usWidth, &usHeight, &ubBitDepth ); - if(gbPixelDepth==16) - { - // BLIT HERE - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - 0, 0, 0, 0, usWidth, usHeight ); - } + pSrcBuf = LockVideoSurface(guiRENDERBUFFER, &uiSrcPitchBYTES); + pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES); - UnLockVideoSurface(guiRENDERBUFFER); - UnLockVideoSurface(guiSAVEBUFFER); + if(gbPixelDepth==16) + { + // BLIT HERE + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + 0, 0, 0, 0, usWidth, usHeight ); + } - } + UnLockVideoSurface(guiRENDERBUFFER); + UnLockVideoSurface(guiSAVEBUFFER); + + } } } @@ -1172,7 +1171,7 @@ void RenderOverheadOverlays() GetVideoObject( &hVObject, uiPERSONS ); - //SOLDIER OVERLAY + //SOLDIER OVERLAY if( gfTacticalPlacementGUIActive ) { //loop through only the player soldiers end = gTacticalStatus.Team[ OUR_TEAM ].bLastID; @@ -1188,8 +1187,8 @@ void RenderOverheadOverlays() pSoldier = MercPtrs[ i ]; if( !pSoldier->bActive || !pSoldier->bInSector ) continue; - //Soldier is here. Calculate his screen position based on his current gridno. - + //Soldier is here. Calculate his screen position based on his current gridno. + GetOverheadScreenXYFromGridNo( pSoldier->sGridNo, &sX, &sY ); //Now, draw his "doll" @@ -1257,46 +1256,46 @@ void RenderOverheadOverlays() #ifdef JA2EDITOR if( gfEditMode && gpSelected && gpSelected->pSoldier == pSoldier ) - { //editor: show the selected edited merc as the yellow one. + { //editor: show the selected edited merc as the yellow one. Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 0 ); } else #endif if( !gfTacticalPlacementGUIActive ) - { //normal + { //normal Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, pSoldier->bTeam ); - RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, sX, sY, (INT16)(sX + 3), (INT16)(sY + 9)); + RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, sX, sY, (INT16)(sX + 3), (INT16)(sY + 9)); } - else if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + else if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { //vehicle Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 9 ); - RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, (INT16)(sX-6), (INT16)(sY), (INT16)(sX + 9), (INT16)(sY + 10)); + RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, (INT16)(sX-6), (INT16)(sY), (INT16)(sX + 9), (INT16)(sY + 10)); } - //else if( pSoldier->uiStatusFlags & (SOLDIER_PASSENGER | SOLDIER_DRIVER) ) + //else if( pSoldier->flags.uiStatusFlags & (SOLDIER_PASSENGER | SOLDIER_DRIVER) ) //{// //don't draw person, because they are inside the vehicle. // ubPassengers++; //} else if( gpTacticalPlacementSelectedSoldier == pSoldier ) { //tactical placement selected merc Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 7 ); - RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, (INT16)(sX-2), (INT16)(sY-2), (INT16)(sX + 5), (INT16)(sY + 11)); + RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, (INT16)(sX-2), (INT16)(sY-2), (INT16)(sX + 5), (INT16)(sY + 11)); } - else if( gpTacticalPlacementHilightedSoldier == pSoldier && pSoldier->uiStatusFlags ) + else if( gpTacticalPlacementHilightedSoldier == pSoldier && pSoldier->flags.uiStatusFlags ) { //tactical placement hilighted merc Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 8 ); - RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, (INT16)(sX-2), (INT16)(sY-2), (INT16)(sX + 5), (INT16)(sY + 11)); + RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, (INT16)(sX-2), (INT16)(sY-2), (INT16)(sX + 5), (INT16)(sY + 11)); } else - { //normal + { //normal Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, pSoldier->bTeam ); - RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, sX, sY, (INT16)(sX + 3), (INT16)(sY + 9)); + RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, sX, sY, (INT16)(sX + 3), (INT16)(sY + 9)); } if( ubPassengers ) { SetFont( SMALLCOMPFONT ); SetFontForeground( FONT_WHITE ); gprintfdirty( (INT16)(sX - 3), sY, L"%d", ubPassengers ); - mprintf_buffer( pDestBuf, uiDestPitchBYTES, SMALLCOMPFONT, sX - 3, sY , L"%d", ubPassengers ); + mprintf_buffer( pDestBuf, uiDestPitchBYTES, SMALLCOMPFONT, sX - 3, sY , L"%d", ubPassengers ); } } @@ -1304,7 +1303,7 @@ void RenderOverheadOverlays() //ITEMS OVERLAY if( !gfTacticalPlacementGUIActive ) { - for( i = 0 ; i < guiNumWorldItems; i++ ) + for( i = 0 ; i < guiNumWorldItems; i++ ) { pWorldItem = &gWorldItems[ i ]; if( !pWorldItem || !pWorldItem->fExists || pWorldItem->bVisible != VISIBLE && !(gTacticalStatus.uiFlags & SHOW_ALL_ITEMS) ) @@ -1331,7 +1330,7 @@ void RenderOverheadOverlays() { sX += iOffsetHorizontal; } - + // Smaller maps if (gsStartRestrictedY > 0) { @@ -1352,16 +1351,16 @@ void RenderOverheadOverlays() } else switch( pWorldItem->bVisible ) { - case HIDDEN_ITEM: usLineColor = Get16BPPColor( FROMRGB( 0, 0, 255 ) ); break; - case BURIED: usLineColor = Get16BPPColor( FROMRGB( 255, 0, 0 ) ); break; - case HIDDEN_IN_OBJECT: usLineColor = Get16BPPColor( FROMRGB( 0, 0, 255 ) ); break; - case INVISIBLE: usLineColor = Get16BPPColor( FROMRGB( 0, 255, 0 ) ); break; + case HIDDEN_ITEM: usLineColor = Get16BPPColor( FROMRGB( 0, 0, 255 ) ); break; + case BURIED: usLineColor = Get16BPPColor( FROMRGB( 255, 0, 0 ) ); break; + case HIDDEN_IN_OBJECT: usLineColor = Get16BPPColor( FROMRGB( 0, 0, 255 ) ); break; + case INVISIBLE: usLineColor = Get16BPPColor( FROMRGB( 0, 255, 0 ) ); break; case VISIBLE: usLineColor = Get16BPPColor( FROMRGB( 255, 255, 255 ) ); break; } if ( gfOverItemPool && gsOveritemPoolGridNo == pWorldItem->sGridNo ) { - usLineColor = Get16BPPColor( FROMRGB( 255, 0, 0 ) ); + usLineColor = Get16BPPColor( FROMRGB( 255, 0, 0 ) ); } PixelDraw( FALSE, sX, sY, usLineColor, pDestBuf ); @@ -1387,7 +1386,7 @@ void RenderOverheadOverlays( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 s INT16 sX, sY; UINT32 uiDestPitchBYTES; UINT8 *pDestBuf; - LEVELNODE *pNode; + LEVELNODE *pNode; UINT16 usLineColor; INT16 sHeight; SOLDIERTYPE *pSoldier; @@ -1434,7 +1433,7 @@ void RenderOverheadOverlays( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 s sX = sTempPosX_S; sY = sTempPosY_S - sHeight; // RENDER! - if ( pNode->pItemPool->bVisible == -1 && !(gTacticalStatus.uiFlags & SHOW_ALL_ITEMS) ) + if ( pNode->pItemPool->bVisible == -1 && !(gTacticalStatus.uiFlags & SHOW_ALL_ITEMS) ) { } @@ -1469,7 +1468,7 @@ void RenderOverheadOverlays( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 s sY = sTempPosY_S - sHeight - 8; // 8 height of doll guy // RENDER! - if ( pSoldier->bLastRenderVisibleValue == -1 && !(gTacticalStatus.uiFlags&SHOW_ALL_MERCS) ) + if ( pSoldier->bLastRenderVisibleValue == -1 && !(gTacticalStatus.uiFlags&SHOW_ALL_MERCS) ) { } @@ -1496,7 +1495,7 @@ void RenderOverheadOverlays( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 s } #ifdef JA2EDITOR if( gfEditMode && gpSelected && gpSelected->pSoldier == pSoldier ) - { //editor: show the selected edited merc as the yellow one. + { //editor: show the selected edited merc as the yellow one. Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 0 ); } else @@ -1510,10 +1509,10 @@ void RenderOverheadOverlays( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 s Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 8 ); } else - { //normal + { //normal Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, pSoldier->bTeam ); } - RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, (INT16)(sX-2), (INT16)(sY-2), (INT16)(sX + 5), (INT16)(sY + 11)); + RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, (INT16)(sX-2), (INT16)(sY-2), (INT16)(sX + 5), (INT16)(sY + 11)); } pNode = pNode->pNext; @@ -1526,7 +1525,7 @@ void RenderOverheadOverlays( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 s if ( sTempPosX_S >= sEndXS ) { - fEndRenderRow = TRUE; + fEndRenderRow = TRUE; } } while( !fEndRenderRow ); @@ -1539,7 +1538,7 @@ void RenderOverheadOverlays( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 s { sAnchorPosX_M ++; } - + bXOddFlag = !bXOddFlag; sAnchorPosY_S += 2; @@ -1563,7 +1562,7 @@ void MoveInOverheadRegionCallback(MOUSE_REGION *reg, INT32 reason) void ClickOverheadRegionCallback(MOUSE_REGION *reg,INT32 reason) { UINT32 uiCellX, uiCellY; - INT16 sWorldScreenX, sWorldScreenY; + INT16 sWorldScreenX, sWorldScreenY; if( gfTacticalPlacementGUIActive ) { @@ -1627,7 +1626,7 @@ void MoveOverheadRegionCallback(MOUSE_REGION *reg,INT32 reason) void GetOverheadScreenXYFromGridNo( INT16 sGridNo, INT16 *psScreenX, INT16 *psScreenY ) { - GetWorldXYAbsoluteScreenXY( (INT16)(CenterX( sGridNo ) / CELL_X_SIZE ), (INT16)( CenterY( sGridNo ) / CELL_Y_SIZE ), psScreenX, psScreenY ); + GetWorldXYAbsoluteScreenXY( (INT16)(CenterX( sGridNo ) / CELL_X_SIZE ), (INT16)( CenterY( sGridNo ) / CELL_Y_SIZE ), psScreenX, psScreenY ); *psScreenX /= 5; *psScreenY /= 5; @@ -1635,14 +1634,14 @@ void GetOverheadScreenXYFromGridNo( INT16 sGridNo, INT16 *psScreenX, INT16 *psSc *psScreenY += 5; //Subtract the height.... - //*psScreenY -= gpWorldLevelData[ sGridNo ].sHeight / 5; + //*psScreenY -= gpWorldLevelData[ sGridNo ].sHeight / 5; } // WANNE: Fixed bug from sir tech, which occured on smaller maps ;-) BOOLEAN GetOverheadMouseGridNo( INT16 *psGridNo ) { UINT32 uiCellX, uiCellY; - INT16 sWorldScreenX, sWorldScreenY; + INT16 sWorldScreenX, sWorldScreenY; if ( ( OverheadRegion.uiFlags & MSYS_MOUSE_IN_AREA ) ) { @@ -1697,7 +1696,7 @@ BOOLEAN GetOverheadMouseGridNo( INT16 *psGridNo ) BOOLEAN GetOverheadMouseGridNoForFullSoldiersGridNo( INT16 *psGridNo ) { UINT32 uiCellX, uiCellY; - INT16 sWorldScreenX, sWorldScreenY; + INT16 sWorldScreenX, sWorldScreenY; if ( ( OverheadRegion.uiFlags & MSYS_MOUSE_IN_AREA ) ) { @@ -1787,7 +1786,7 @@ void CalculateRestrictedMapCoords( INT8 bDirection, INT16 *psX1, INT16 *psY1, IN void CopyOverheadDBShadetablesFromTileset( ) { UINT32 uiLoop, uiLoop2; - PTILE_IMAGERY pTileSurf; + PTILE_IMAGERY pTileSurf; // Loop through tileset @@ -1802,7 +1801,7 @@ void CopyOverheadDBShadetablesFromTileset( ) gSmTileSurf[ uiLoop ].vo->pShades[ uiLoop2 ] = pTileSurf->vo->pShades[ uiLoop2 ]; } } - + } void TrashOverheadMap( ) @@ -1815,5 +1814,5 @@ void TrashOverheadMap( ) // Force load gfSmTileLoaded = FALSE; - } -} \ No newline at end of file + } +} diff --git a/TileEngine/phys math.cpp b/TileEngine/phys math.cpp index 3ff738b6..d362e252 100644 --- a/TileEngine/phys math.cpp +++ b/TileEngine/phys math.cpp @@ -24,7 +24,7 @@ vector_3 VSubtract( vector_3 *a, vector_3 *b ) c.x = a->x - b->x; c.y = a->y - b->y; c.z = a->z - b->z; - + return( c ); } @@ -35,7 +35,7 @@ vector_3 VAdd( vector_3 *a, vector_3 *b ) c.x = a->x + b->x; c.y = a->y + b->y; c.z = a->z + b->z; - + return( c ); } @@ -46,7 +46,7 @@ vector_3 VMultScalar( vector_3 *a, real b ) c.x = a->x * b; c.y = a->y * b; c.z = a->z * b; - + return( c ); } @@ -57,7 +57,7 @@ vector_3 VDivScalar( vector_3 *a, real b ) c.x = a->x / b; c.y = a->y / b; c.z = a->z / b; - + return( c ); } @@ -76,9 +76,9 @@ vector_3 VCrossProduct( vector_3 *a, vector_3 *b ) { vector_3 c; - c.x = ( a->y * b->z ) - ( a->z * b->y ); - c.y = ( a->x * b->z ) - ( a->z * b->x ); - c.z = ( a->x * b->y ) - ( a->y * b->x ); + c.x = ( a->y * b->z ) - ( a->z * b->y ); + c.y = ( a->x * b->z ) - ( a->z * b->x ); + c.z = ( a->x * b->y ) - ( a->y * b->x ); return( c ); } @@ -89,8 +89,8 @@ vector_3 VGetPerpendicular( vector_3 *a ) vector_3 c; c.x = -a->y; - c.y = a->x; - c.z = a->z; + c.y = a->x; + c.z = a->z; return( c ); } @@ -108,7 +108,7 @@ vector_3 VGetNormal( vector_3 *a ) Length = VGetLength( a ); - if ( Length == 0 ) + if ( Length == 0 ) { c.x = 0; c.y = 0; @@ -143,3 +143,4 @@ vector_3 VGetNormal( vector_3 *a ) + diff --git a/TileEngine/phys math.h b/TileEngine/phys math.h index 9623cde9..0b6641c5 100644 --- a/TileEngine/phys math.h +++ b/TileEngine/phys math.h @@ -8,8 +8,8 @@ typedef float real; -#define REAL_MAX FLT_MAX -#define REAL_MIN FLT_MIN +#define REAL_MAX FLT_MAX +#define REAL_MIN FLT_MIN #define PI2 3.14159265358979323846 #define Epsilon2 0.00001 @@ -61,3 +61,4 @@ vector_3 VCrossProduct( vector_3 *a, vector_3 *b ); + diff --git a/TileEngine/physics.cpp b/TileEngine/physics.cpp index 9489ac69..3af7e8f4 100644 --- a/TileEngine/physics.cpp +++ b/TileEngine/physics.cpp @@ -11,7 +11,7 @@ #include "worldman.h" #include "event pump.h" #include "Sound Control.h" -#include "soldier control.h" +//#include "soldier control.h" #include "interface.h" #include "interface items.h" #include "weapons.h" @@ -37,6 +37,11 @@ #include "Campaign.h" #include "SkillCheck.h" +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + + #define NO_TEST_OBJECT 0 #define TEST_OBJECT_NO_COLLISIONS 1 #define TEST_OBJECT_ANY_COLLISION 2 @@ -54,8 +59,8 @@ #define GET_SOLDIER_THROW_HEIGHT( l ) (INT16)( ( l * 256 ) + CROUCHED_HEIGHT ) #define GET_OBJECT_LEVEL( z ) ( (INT8)( ( z + 10 ) / HEIGHT_UNITS ) ) -//#define OBJECT_DETONATE_ON_IMPACT( o ) ( ( o->Obj.usItem == MORTAR_SHELL ) ) // && ( o->ubActionCode == THROW_ARM_ITEM || pObject->fTestObject ) ) -#define OBJECT_DETONATE_ON_IMPACT( o ) ( ( Item[o->Obj.usItem].usItemClass == IC_BOMB ) ) // && ( o->ubActionCode == THROW_ARM_ITEM || pObject->fTestObject ) ) +//#define OBJECT_DETONATE_ON_IMPACT( object ) ( ( object->Obj.usItem == MORTAR_SHELL ) ) // && ( object->ubActionCode == THROW_ARM_ITEM || pObject->fTestObject ) ) +#define OBJECT_DETONATE_ON_IMPACT( object ) ( ( Item[object->Obj.usItem].usItemClass == IC_BOMB ) ) // && ( object->ubActionCode == THROW_ARM_ITEM || pObject->fTestObject ) ) #define MAX_INTEGRATIONS 8 @@ -93,7 +98,7 @@ extern void DoGenericHit( SOLDIERTYPE *pSoldier, UINT8 ubSpecial, INT16 bDirecti BOOLEAN PhysicsUpdateLife( REAL_OBJECT *pObject, real DeltaTime ); -BOOLEAN PhysicsComputeForces( REAL_OBJECT *pObject ); +BOOLEAN PhysicsComputeForces( REAL_OBJECT *pObject ); BOOLEAN PhysicsIntegrate( REAL_OBJECT *pObject, real DeltaTime ); BOOLEAN PhysicsMoveObject( REAL_OBJECT *pObject ); BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID ); @@ -102,7 +107,7 @@ void PhysicsDeleteObject( REAL_OBJECT *pObject ); BOOLEAN PhysicsHandleCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID, real DeltaTime ); FLOAT CalculateForceFromRange( INT16 sRange, FLOAT dDegrees ); -UINT16 RandomGridFromRadius( INT16 sSweetGridNo, INT8 ubMinRadius, INT8 ubMaxRadius ); +INT16 RandomGridFromRadius( INT16 sSweetGridNo, INT8 ubMinRadius, INT8 ubMaxRadius ); // Lesh: needed to fix item throwing through window extern INT16 DirIncrementer[8]; @@ -112,13 +117,81 @@ void ObjectHitWindow( INT16 sGridNo, UINT16 usStructureID, BOOLEAN fBlowWindowSo FLOAT CalculateObjectTrajectory( INT16 sTargetZ, OBJECTTYPE *pItem, vector_3 *vPosition, vector_3 *vForce, INT16 *psFinalGridNo ); vector_3 FindBestForceForTrajectory( INT16 sSrcGridNo, INT16 sGridNo,INT16 sStartZ, INT16 sEndZ, real dzDegrees, OBJECTTYPE *pItem, INT16 *psGridNo, FLOAT *pzMagForce ); INT32 ChanceToGetThroughObjectTrajectory( INT16 sTargetZ, OBJECTTYPE *pItem, vector_3 *vPosition, vector_3 *vForce, INT16 *psFinalGridNo, INT8 *pbLevel, BOOLEAN fFromUI ); -FLOAT CalculateSoldierMaxForce( SOLDIERTYPE *pSoldier, FLOAT dDegrees, OBJECTTYPE *pObject, BOOLEAN fArmed ); +FLOAT CalculateSoldierMaxForce( SOLDIERTYPE *pSoldier, FLOAT dDegrees, OBJECTTYPE *pObject, BOOLEAN fArmed ); BOOLEAN AttemptToCatchObject( REAL_OBJECT *pObject ); BOOLEAN CheckForCatchObject( REAL_OBJECT *pObject ); BOOLEAN DoCatchObject( REAL_OBJECT *pObject ); BOOLEAN CheckForCatcher( REAL_OBJECT *pObject, UINT16 usStructureID ); +void REAL_OBJECT::initialize() +{ + memset(this, 0, SIZEOF_REAL_OBJECT_POD); + this->Obj.initialize(); +} + +REAL_OBJECT& REAL_OBJECT::operator =(OLD_REAL_OBJECT_101 &src) +{ + this->Obj = src.oldObj; + + this->fAllocated = src.fAllocated; + this->fAlive = src.fAlive; + this->fApplyFriction = src.fApplyFriction; + this->fColliding = src.fColliding; + this->fZOnRest = src.fZOnRest; + this->fVisible = src.fVisible; + this->fInWater = src.fInWater; + this->fTestObject = src.fTestObject; + this->fTestEndedWithCollision = src.fTestEndedWithCollision; + this->fTestPositionNotSet = src.fTestPositionNotSet; + + this->TestZTarget = src.TestZTarget; + this->OneOverMass = src.OneOverMass; + this->AppliedMu = src.AppliedMu; + + this->Position = src.Position; + this->TestTargetPosition = src.TestTargetPosition; + this->OldPosition = src.OldPosition; + this->Velocity = src.Velocity; + this->OldVelocity = src.OldVelocity; + this->InitialForce = src.InitialForce; + this->Force = src.Force; + this->CollisionNormal = src.CollisionNormal; + this->CollisionVelocity = src.CollisionVelocity; + this->CollisionElasticity = src.CollisionElasticity; + + this->sGridNo = src.sGridNo; + this->iID = src.iID; + this->pNode = src.pNode; + this->pShadow = src.pShadow; + + this->sConsecutiveCollisions = src.sConsecutiveCollisions; + this->sConsecutiveZeroVelocityCollisions = src.sConsecutiveZeroVelocityCollisions; + this->iOldCollisionCode = src.iOldCollisionCode; + + this->dLifeLength = src.dLifeLength; + this->dLifeSpan = src.dLifeSpan; + this->fFirstTimeMoved = src.fFirstTimeMoved; + this->sFirstGridNo = src.sFirstGridNo; + this->ubOwner = src.ubOwner; + this->ubActionCode = src.ubActionCode; + this->uiActionData = src.uiActionData; + this->fDropItem = src.fDropItem; + this->uiNumTilesMoved = src.uiNumTilesMoved; + this->fCatchGood = src.fCatchGood; + this->fAttemptedCatch = src.fAttemptedCatch; + this->fCatchAnimOn = src.fCatchAnimOn; + this->fCatchCheckDone = src.fCatchCheckDone; + this->fEndedWithCollisionPositionSet = src.fEndedWithCollisionPositionSet; + this->EndedWithCollisionPosition = src.EndedWithCollisionPosition; + this->fHaveHitGround = src.fHaveHitGround; + this->fPotentialForDebug = src.fPotentialForDebug; + this->sLevelNodeGridNo = src.sLevelNodeGridNo; + this->iSoundID = src.iSoundID; + this->ubLastTargetTakenDamage = src.ubLastTargetTakenDamage; + return *this; +} + /// OBJECT POOL FUNCTIONS INT32 GetFreeObjectSlot(void) { @@ -165,13 +238,13 @@ INT32 CreatePhysicalObject( OBJECTTYPE *pGameObj, real dLifeLength, real xPos, r pObject = &( ObjectSlots[ iObjectIndex ] ); - memset( pObject, 0, sizeof( REAL_OBJECT ) ); + pObject->initialize(); // OK, GET OBJECT DATA AND COPY - memcpy( &(pObject->Obj), pGameObj, sizeof( OBJECTTYPE ) ); + pObject->Obj = *pGameObj; // Get mass - mass = CALCULATE_OBJECT_MASS( Item[pGameObj->usItem ].ubWeight ); + mass = CALCULATE_OBJECT_MASS( Item[pGameObj->usItem ].ubWeight ); // If mass is z, make it something! if ( mass == 0 ) @@ -188,8 +261,8 @@ INT32 CreatePhysicalObject( OBJECTTYPE *pGameObj, real dLifeLength, real xPos, r pObject->fAllocated = TRUE; pObject->fAlive = TRUE; - pObject->fApplyFriction = FALSE; - pObject->iSoundID = NO_SAMPLE; + pObject->fApplyFriction = FALSE; + pObject->iSoundID = NO_SAMPLE; // Set values pObject->OneOverMass = 1 / mass; @@ -197,8 +270,8 @@ INT32 CreatePhysicalObject( OBJECTTYPE *pGameObj, real dLifeLength, real xPos, r pObject->Position.y = yPos; pObject->Position.z = zPos; pObject->fVisible = TRUE; - pObject->fTestObject = fTestObject; - pObject->ubOwner = ubOwner; + pObject->fTestObject = fTestObject; + pObject->ubOwner = ubOwner; pObject->ubActionCode = ubActionCode; pObject->uiActionData = uiActionData; pObject->fDropItem = TRUE; @@ -227,13 +300,13 @@ INT32 CreatePhysicalObject( OBJECTTYPE *pGameObj, real dLifeLength, real xPos, r pObject->EndedWithCollisionPosition.z += CONVERT_PIXELS_TO_HEIGHTUNITS( gpWorldLevelData[ pObject->sGridNo ].sHeight ); } - PhysicsDebugMsg( String( "NewPhysics Object") ); + PhysicsDebugMsg( String( "NewPhysics Object") ); // If this is a real object being created, then increase the ABC if (!fTestObject) { gTacticalStatus.ubAttackBusyCount++; - DebugAttackBusy( String( "@@@@@@@ Increasing attacker busy count..., PHYSICS OBJECT effect started. Now %d\n", gTacticalStatus.ubAttackBusyCount) ); + DebugAttackBusy( String( "@@@@@@@ Increasing attacker busy count..., PHYSICS OBJECT effect started. Now %d\n", gTacticalStatus.ubAttackBusyCount) ); } return( iObjectIndex ); @@ -252,7 +325,7 @@ BOOLEAN RemoveObjectSlot( INT32 iObject ) } -void SimulateWorld( ) +void SimulateWorld( ) { UINT32 cnt; REAL_OBJECT *pObject; @@ -294,12 +367,6 @@ void RemoveAllPhysicsObjects( ) void SimulateObject( REAL_OBJECT *pObject, real deltaT ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"SimulateObject"); - real DeltaTime = 0; - real CurrentTime = 0; - real TargetTime = DeltaTime; - INT32 iCollisionID; - BOOLEAN fEndThisObject = FALSE; - if ( !PhysicsUpdateLife( pObject, (float)deltaT ) ) { // DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"SimulateObject: don't update life, returning"); @@ -309,12 +376,8 @@ void SimulateObject( REAL_OBJECT *pObject, real deltaT ) // DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"SimulateObject: check life"); if ( pObject->fAlive ) { - CurrentTime = 0; - TargetTime = (float)deltaT; - //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"SimulateObject: do subtime"); // Do subtime here.... - DeltaTime = (float)deltaT / (float)10; if ( !PhysicsComputeForces( pObject ) ) { @@ -322,9 +385,15 @@ void SimulateObject( REAL_OBJECT *pObject, real deltaT ) return; } + real CurrentTime = 0; + real DeltaTime = (float)deltaT / 10.0f; + real TargetTime = (float)deltaT; + INT32 iCollisionID; + BOOLEAN fEndThisObject = FALSE; + while( CurrentTime < TargetTime ) { - //MADD TO KAIDEN: HERE IS THE PROBLEM: For some reason fEndThisObject is never set to true + //MADD TO KAIDEN: HERE IS THE PROBLEM: For some reason fEndThisObject is never set to true // DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("SimulateObject: in loop while CurrentTime < TargetTime: %d < %d",CurrentTime,TargetTime)); if ( !PhysicsIntegrate( pObject, DeltaTime ) ) @@ -333,7 +402,7 @@ void SimulateObject( REAL_OBJECT *pObject, real deltaT ) break; } - if ( !PhysicsHandleCollisions( pObject, &iCollisionID, DeltaTime ) ) + if ( !PhysicsHandleCollisions( pObject, &iCollisionID, DeltaTime ) ) { fEndThisObject = TRUE; break; @@ -423,11 +492,6 @@ BOOLEAN PhysicsUpdateLife( REAL_OBJECT *pObject, real DeltaTime ) if ( !pObject->fAlive ) { - if ( !pObject->fTestObject ) - { - int i = 0; - } - // ATE: OK, adjust gridno based on where we ended and if we hit any walls.... { // Check for SW wall... @@ -446,7 +510,7 @@ BOOLEAN PhysicsUpdateLife( REAL_OBJECT *pObject, real DeltaTime ) } // Now SE wall - remainder = (float)fmod( pObject->Position.y, CELL_X_SIZE ); + remainder = (float)fmod( pObject->Position.y, CELL_X_SIZE ); if ( remainder >= 9 ) { @@ -476,7 +540,7 @@ BOOLEAN PhysicsUpdateLife( REAL_OBJECT *pObject, real DeltaTime ) { // If we are in water, and we are a sinkable item... // if ( !pObject->fInWater || !( Item[ pObject->Obj.usItem ].fFlags & ITEM_SINKS ) ) - if ( !pObject->fInWater || !( Item[ pObject->Obj.usItem ].sinks ) ) + if ( !pObject->fInWater || !( Item[ pObject->Obj.usItem ].sinks ) ) { if ( pObject->fDropItem ) { @@ -493,7 +557,7 @@ BOOLEAN PhysicsUpdateLife( REAL_OBJECT *pObject, real DeltaTime ) pSoldier = MercPtrs[ pObject->ubLastTargetTakenDamage ]; - bLevel = pSoldier->bLevel; + bLevel = pSoldier->pathing.bLevel; } // ATE; If an armed object, don't add.... @@ -517,7 +581,7 @@ BOOLEAN PhysicsUpdateLife( REAL_OBJECT *pObject, real DeltaTime ) if ( !pObject->fTestObject && pObject->iOldCollisionCode == COLLISION_GROUND ) { - PlayJA2Sample( THROW_IMPACT_2, RATE_11025, SoundVolume( MIDVOLUME, pObject->sGridNo ), 1, SoundDir( pObject->sGridNo ) ); + PlayJA2Sample( THROW_IMPACT_2, RATE_11025, SoundVolume( MIDVOLUME, pObject->sGridNo ), 1, SoundDir( pObject->sGridNo ) ); } DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Reducing attacker busy count..., PHYSICS OBJECT DONE effect gone off") ); @@ -540,17 +604,17 @@ BOOLEAN PhysicsUpdateLife( REAL_OBJECT *pObject, real DeltaTime ) case ANIM_STAND: pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; - EVENT_InitNewSoldierAnim( pSoldier, END_CATCH, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( END_CATCH, 0 , FALSE ); break; case ANIM_CROUCH: pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; - EVENT_InitNewSoldierAnim( pSoldier, END_CROUCH_CATCH, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( END_CROUCH_CATCH, 0 , FALSE ); break; } - PlayJA2Sample( CATCH_OBJECT, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( CATCH_OBJECT, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } } @@ -577,7 +641,7 @@ BOOLEAN PhysicsIntegrate( REAL_OBJECT *pObject, real DeltaTime ) // Save test TargetPosition if ( pObject->fTestPositionNotSet ) { - pObject->TestTargetPosition = VSetEqual( &(pObject->Position) ); + pObject->TestTargetPosition = VSetEqual( &(pObject->Position) ); } vTemp = VMultScalar( &(pObject->Force), ( DeltaTime * pObject->OneOverMass ) ); @@ -591,8 +655,8 @@ BOOLEAN PhysicsIntegrate( REAL_OBJECT *pObject, real DeltaTime ) PhysicsDebugMsg( String( "Object %d: Delta Pos %f %f %f", pObject->iID, (pObject->OldPosition.x - pObject->Position.x ), (pObject->OldPosition.y - pObject->Position.y ), ( pObject->OldPosition.z - pObject->Position.z ) ) ); } - // if ( pObject->Obj.usItem == MORTAR_SHELL && !pObject->fTestObject && pObject->ubActionCode == THROW_ARM_ITEM ) - //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 524, usItemClass=%d",Item[pObject->Obj.usItem].usItemClass)); + // if ( pObject->Obj.usItem == MORTAR_SHELL && !pObject->fTestObject && pObject->ubActionCode == THROW_ARM_ITEM ) + //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 524, usItemClass=%d",Item[pObject->Obj.usItem].usItemClass)); if ( Item[pObject->Obj.usItem].usItemClass == IC_BOMB && !pObject->fTestObject && pObject->ubActionCode == THROW_ARM_ITEM ) { @@ -601,7 +665,7 @@ BOOLEAN PhysicsIntegrate( REAL_OBJECT *pObject, real DeltaTime ) { if ( pObject->iSoundID == NO_SAMPLE ) { - pObject->iSoundID = PlayJA2Sample( MORTAR_WHISTLE, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); + pObject->iSoundID = PlayJA2Sample( MORTAR_WHISTLE, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); } } } @@ -618,12 +682,12 @@ BOOLEAN PhysicsHandleCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID, rea if ( PhysicsCheckForCollisions( pObject, piCollisionID ) ) { - dDeltaX = pObject->Position.x - pObject->OldPosition.x; - dDeltaY = pObject->Position.y - pObject->OldPosition.y; - dDeltaZ = pObject->Position.z - pObject->OldPosition.z; + dDeltaX = pObject->Position.x - pObject->OldPosition.x; + dDeltaY = pObject->Position.y - pObject->OldPosition.y; + dDeltaZ = pObject->Position.z - pObject->OldPosition.z; - if ( dDeltaX <= EPSILONV && dDeltaX >= -EPSILONV && - dDeltaY <= EPSILONV && dDeltaY >= -EPSILONV ) + if ( dDeltaX <= EPSILONV && dDeltaX >= -EPSILONV && + dDeltaY <= EPSILONV && dDeltaY >= -EPSILONV ) { pObject->sConsecutiveZeroVelocityCollisions++; } @@ -655,7 +719,7 @@ BOOLEAN PhysicsHandleCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID, rea pObject->OldPosition.y = pObject->Position.x - dDeltaY; pObject->OldPosition.z = pObject->Position.z - dDeltaZ; - PhysicsResolveCollision( pObject, &(pObject->CollisionVelocity), &(pObject->CollisionNormal), pObject->CollisionElasticity ); + PhysicsResolveCollision( pObject, &(pObject->CollisionVelocity), &(pObject->CollisionNormal), pObject->CollisionElasticity ); } if ( pObject->Position.z < 0 ) @@ -667,9 +731,9 @@ BOOLEAN PhysicsHandleCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID, rea // TO STOP? // Check for delta position values - if ( dDeltaZ <= EPSILONP && dDeltaZ >= -EPSILONP && - dDeltaY <= EPSILONP && dDeltaY >= -EPSILONP && - dDeltaX <= EPSILONP && dDeltaX >= -EPSILONP ) + if ( dDeltaZ <= EPSILONP && dDeltaZ >= -EPSILONP && + dDeltaY <= EPSILONP && dDeltaY >= -EPSILONP && + dDeltaX <= EPSILONP && dDeltaX >= -EPSILONP ) { //pObject->fAlive = FALSE; //return( FALSE ); @@ -687,9 +751,9 @@ BOOLEAN PhysicsHandleCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID, rea } // Check for -ve velocity still... - /*if ( pObject->Velocity.z <= EPSILONV && pObject->Velocity.z >= -EPSILONV && - pObject->Velocity.y <= EPSILONV && pObject->Velocity.y >= -EPSILONV && - pObject->Velocity.x <= EPSILONV && pObject->Velocity.x >= -EPSILONV ) + /*if ( pObject->Velocity.z <= EPSILONV && pObject->Velocity.z >= -EPSILONV && + pObject->Velocity.y <= EPSILONV && pObject->Velocity.y >= -EPSILONV && + pObject->Velocity.x <= EPSILONV && pObject->Velocity.x >= -EPSILONV ) { PhysicsDeleteObject( pObject ); pObject->fAlive = FALSE; @@ -736,13 +800,13 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID ) dY = pObject->Position.y; dZ = pObject->Position.z; - vTemp.x = 0; - vTemp.y = 0; + vTemp.x = 0; + vTemp.y = 0; vTemp.z = 0; - dDeltaX = dX - pObject->OldPosition.x; - dDeltaY = dY - pObject->OldPosition.y; - dDeltaZ = dZ - pObject->OldPosition.z; + dDeltaX = dX - pObject->OldPosition.x; + dDeltaY = dY - pObject->OldPosition.y; + dDeltaZ = dZ - pObject->OldPosition.z; //Round delta pos to nearest 0.01 //dDeltaX = (float)( (int)dDeltaX * 100 ) / 100; @@ -766,7 +830,7 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID ) if ( pObject->TestZTarget > 32 ) { pObject->fTestPositionNotSet = FALSE; - pObject->TestZTarget = 0; + pObject->TestZTarget = 0; } else { @@ -836,7 +900,7 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID ) if ( !pObject->fEndedWithCollisionPositionSet ) { - pObject->fEndedWithCollisionPositionSet = TRUE; + pObject->fEndedWithCollisionPositionSet = TRUE; pObject->EndedWithCollisionPosition = VSetEqual( &(pObject->Position) ); } iCollisionCode = COLLISION_NONE; @@ -845,7 +909,7 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID ) { if ( !pObject->fEndedWithCollisionPositionSet ) { - pObject->fEndedWithCollisionPositionSet = TRUE; + pObject->fEndedWithCollisionPositionSet = TRUE; pObject->EndedWithCollisionPosition = VSetEqual( &(pObject->Position) ); } } @@ -855,7 +919,7 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID ) if ( !pObject->fEndedWithCollisionPositionSet ) { - pObject->fEndedWithCollisionPositionSet = TRUE; + pObject->fEndedWithCollisionPositionSet = TRUE; pObject->EndedWithCollisionPosition = VSetEqual( &(pObject->Position) ); } break; @@ -863,14 +927,14 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID ) case COLLISION_WATER: case COLLISION_GROUND: case COLLISION_MERC: - case COLLISION_INTERIOR_ROOF: + case COLLISION_INTERIOR_ROOF: case COLLISION_NONE: case COLLISION_WINDOW_SOUTHEAST: case COLLISION_WINDOW_SOUTHWEST: case COLLISION_WINDOW_NORTHEAST: case COLLISION_WINDOW_NORTHWEST: - // Here we just keep going.. + // Here we just keep going.. break; default: @@ -953,9 +1017,9 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID ) if ( iCollisionCode == COLLISION_GROUND ) { - vTemp.x = 0; - vTemp.y = 0; - vTemp.z = -1; + vTemp.x = 0; + vTemp.y = 0; + vTemp.z = -1; pObject->fApplyFriction = TRUE; //pObject->AppliedMu = (float)(0.54 * TIME_MULTI ); @@ -968,7 +1032,7 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID ) if ( !pObject->fTestObject && !pObject->fHaveHitGround ) { - PlayJA2Sample( THROW_IMPACT_2, RATE_11025, SoundVolume( MIDVOLUME, pObject->sGridNo ), 1, SoundDir( pObject->sGridNo ) ); + PlayJA2Sample( THROW_IMPACT_2, RATE_11025, SoundVolume( MIDVOLUME, pObject->sGridNo ), 1, SoundDir( pObject->sGridNo ) ); } pObject->fHaveHitGround = TRUE; @@ -1007,7 +1071,7 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID ) memset( &AniParams, 0, sizeof( ANITILE_PARAMS ) ); AniParams.sGridNo = sGridNo; AniParams.ubLevelID = ANI_STRUCT_LEVEL; - AniParams.usTileType = THIRDMISS; + AniParams.usTileType = THIRDMISS; AniParams.usTileIndex = THIRDMISS1; AniParams.sDelay = 50; AniParams.sStartFrame = 0; @@ -1038,9 +1102,9 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID ) } else if ( iCollisionCode == COLLISION_ROOF || iCollisionCode == COLLISION_INTERIOR_ROOF ) { - vTemp.x = 0; - vTemp.y = 0; - vTemp.z = -1; + vTemp.x = 0; + vTemp.y = 0; + vTemp.z = -1; pObject->fApplyFriction = TRUE; pObject->AppliedMu = (float)(0.54 * TIME_MULTI ); @@ -1052,9 +1116,9 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID ) } //else if ( iCollisionCode == COLLISION_INTERIOR_ROOF ) //{ - // vTemp.x = 0; - // vTemp.y = 0; - // vTemp.z = 1; + // vTemp.x = 0; + // vTemp.y = 0; + // vTemp.z = 1; // pObject->fApplyFriction = TRUE; // pObject->AppliedMu = (float)(0.54 * TIME_MULTI ); @@ -1073,9 +1137,9 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID ) CheckForObjectHittingMerc( pObject, usStructureID ); - vTemp.x = 0; - vTemp.y = 0; - vTemp.z = -1; + vTemp.x = 0; + vTemp.y = 0; + vTemp.z = -1; pObject->fApplyFriction = TRUE; pObject->AppliedMu = (float)(0.54 * TIME_MULTI ); @@ -1085,12 +1149,12 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID ) fDoCollision = TRUE; } - else if ( iCollisionCode == COLLISION_WALL_SOUTHEAST || iCollisionCode == COLLISION_WALL_SOUTHWEST || + else if ( iCollisionCode == COLLISION_WALL_SOUTHEAST || iCollisionCode == COLLISION_WALL_SOUTHWEST || iCollisionCode == COLLISION_WALL_NORTHEAST || iCollisionCode == COLLISION_WALL_NORTHWEST ) { // A wall, do stuff - vTemp.x = dNormalX; - vTemp.y = dNormalY; + vTemp.x = dNormalX; + vTemp.y = dNormalY; vTemp.z = dNormalZ; fDoCollision = TRUE; @@ -1115,11 +1179,11 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID ) vIncident = VGetNormal( &vIncident ); - //vTemp.x = -1; - //vTemp.y = 0; + //vTemp.x = -1; + //vTemp.y = 0; //vTemp.z = 0; - vTemp.x = -1 * vIncident.x; - vTemp.y = -1 * vIncident.y; + vTemp.x = -1 * vIncident.x; + vTemp.y = -1 * vIncident.y; vTemp.z = 0; fDoCollision = TRUE; @@ -1132,8 +1196,8 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID ) pObject->CollisionNormal.x = vTemp.x; pObject->CollisionNormal.y = vTemp.y; pObject->CollisionNormal.z = vTemp.z; - pObject->CollisionElasticity = dElasity; - pObject->iOldCollisionCode = iCollisionCode; + pObject->CollisionElasticity = dElasity; + pObject->iOldCollisionCode = iCollisionCode; // Save collision velocity pObject->CollisionVelocity = VSetEqual( &(pObject->OldVelocity) ); @@ -1156,7 +1220,7 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID ) pObject->sConsecutiveZeroVelocityCollisions = 0; pObject->fHaveHitGround = FALSE; } - } + } return( fDoCollision ); } @@ -1164,7 +1228,7 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID ) void PhysicsResolveCollision( REAL_OBJECT *pObject, vector_3 *pVelocity, vector_3 *pNormal, real CoefficientOfRestitution ) { - real ImpulseNumerator, Impulse; + real ImpulseNumerator, Impulse; vector_3 vTemp; ImpulseNumerator = -1 * CoefficientOfRestitution * VDotProduct( pVelocity , pNormal ); @@ -1191,7 +1255,7 @@ BOOLEAN PhysicsMoveObject( REAL_OBJECT *pObject ) if ( pObject->fFirstTimeMoved ) { pObject->fFirstTimeMoved = FALSE; - pObject->sFirstGridNo = sNewGridNo; + pObject->sFirstGridNo = sNewGridNo; } // CHECK FOR RANGE< IF INVALID, REMOVE! @@ -1216,7 +1280,7 @@ BOOLEAN PhysicsMoveObject( REAL_OBJECT *pObject ) { // Add smoke trails... // if ( pObject->Obj.usItem == MORTAR_SHELL && pObject->uiNumTilesMoved > 2 && pObject->ubActionCode == THROW_ARM_ITEM ) - //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 1147")); + //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 1147")); if ( Item[pObject->Obj.usItem].usItemClass == IC_BOMB && pObject->uiNumTilesMoved > 2 && pObject->ubActionCode == THROW_ARM_ITEM ) { @@ -1244,13 +1308,13 @@ BOOLEAN PhysicsMoveObject( REAL_OBJECT *pObject ) { // We're at a new gridno! if ( pObject->pNode != NULL ) - { + { RemoveStructFromLevelNode( pObject->sLevelNodeGridNo, pObject->pNode ); } // We're at a new gridno! if ( pObject->pShadow != NULL ) - { + { RemoveShadowFromLevelNode( pObject->sLevelNodeGridNo, pObject->pShadow ); } @@ -1285,18 +1349,18 @@ BOOLEAN PhysicsMoveObject( REAL_OBJECT *pObject ) { // Remove! if ( pObject->pNode != NULL ) - { + { RemoveStructFromLevelNode( pObject->sLevelNodeGridNo, pObject->pNode ); } // We're at a new gridno! if ( pObject->pShadow != NULL ) - { + { RemoveShadowFromLevelNode( pObject->sLevelNodeGridNo, pObject->pShadow ); } pObject->pNode = NULL; - pObject->pShadow = NULL; + pObject->pShadow = NULL; } if ( sNewGridNo != pObject->sGridNo ) @@ -1315,7 +1379,7 @@ BOOLEAN PhysicsMoveObject( REAL_OBJECT *pObject ) if ( pObject->fVisible ) { // if ( pObject->Obj.usItem != MORTAR_SHELL || pObject->ubActionCode != THROW_ARM_ITEM ) - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 1238")); + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 1238")); if ( !(Item[pObject->Obj.usItem].usItemClass == IC_BOMB) || pObject->ubActionCode != THROW_ARM_ITEM ) { @@ -1334,7 +1398,7 @@ BOOLEAN PhysicsMoveObject( REAL_OBJECT *pObject ) // Update position data pObject->pShadow->sRelativeX = (INT16)pObject->Position.x; // + pTrav->sOffsetX; pObject->pShadow->sRelativeY = (INT16)pObject->Position.y; // + pTrav->sOffsetY; - pObject->pShadow->sRelativeZ = (INT16)gpWorldLevelData[ pObject->sGridNo ].sHeight; + pObject->pShadow->sRelativeZ = (INT16)gpWorldLevelData[ pObject->sGridNo ].sHeight; } } } @@ -1467,7 +1531,7 @@ vector_3 FindBestForceForTrajectory( INT16 sSrcGridNo, INT16 sGridNo,INT16 sStar dPercentDiff = dForce * ( dTestDiff / dRange ); // Adjust force accordingly - dForce = dForce - ( ( dPercentDiff ) / 2 ); + dForce = dForce - ( ( dPercentDiff ) / 2 ); } while( TRUE ); @@ -1482,7 +1546,7 @@ vector_3 FindBestForceForTrajectory( INT16 sSrcGridNo, INT16 sGridNo,INT16 sStar (*pdMagForce) = dForce; } -#ifdef JA2TESTVERSION +#ifdef JA2TESTVERSION //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Number of integration: %d", iNumChecks ); #endif @@ -1710,7 +1774,7 @@ FLOAT CalculateObjectTrajectory( INT16 sTargetZ, OBJECTTYPE *pItem, vector_3 *vP pObject->fTestObject = TEST_OBJECT_NO_COLLISIONS; pObject->TestZTarget = sTargetZ; pObject->fTestPositionNotSet = TRUE; - pObject->fVisible = FALSE; + pObject->fVisible = FALSE; // Alrighty, move this beast until it dies.... while( pObject->fAlive ) @@ -1760,7 +1824,7 @@ INT32 ChanceToGetThroughObjectTrajectory( INT16 sTargetZ, OBJECTTYPE *pItem, vec pObject->fTestObject = TEST_OBJECT_NOTWALLROOF_COLLISIONS; pObject->fTestPositionNotSet = TRUE; pObject->TestZTarget = sTargetZ; - pObject->fVisible = FALSE; + pObject->fVisible = FALSE; //pObject->fPotentialForDebug = TRUE; // Alrighty, move this beast until it dies.... @@ -1775,8 +1839,8 @@ INT32 ChanceToGetThroughObjectTrajectory( INT16 sTargetZ, OBJECTTYPE *pItem, vec // Calculate gridno from last position // If NOT from UI, use exact collision position - // JA25 comment from CJC: testing breaklights, we ran into a situation where EndedWithCollisionPosition was not - // set due to breaklight stopping on flat ground. It makes sense that if EndedWithCollisionPosition is + // JA25 comment from CJC: testing breaklights, we ran into a situation where EndedWithCollisionPosition was not + // set due to breaklight stopping on flat ground. It makes sense that if EndedWithCollisionPosition is // unset, at least the Position value is of SOME use... if ( fFromUI || (pObject->EndedWithCollisionPosition.x == 0.0f && pObject->EndedWithCollisionPosition.y == 0.0f) ) { @@ -1811,7 +1875,7 @@ FLOAT CalculateLaunchItemAngle( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubHe ConvertGridNoToCenterCellXY( pSoldier->sGridNo, &sSrcX, &sSrcY ); - dAngle = FindBestAngleForTrajectory( pSoldier->sGridNo, sGridNo, GET_SOLDIER_THROW_HEIGHT( pSoldier->bLevel ), ubHeight, dForce, pItem, psGridNo ); + dAngle = FindBestAngleForTrajectory( pSoldier->sGridNo, sGridNo, GET_SOLDIER_THROW_HEIGHT( pSoldier->pathing.bLevel ), ubHeight, dForce, pItem, psGridNo ); // new we have defaut angle value... return( dAngle ); @@ -1819,7 +1883,7 @@ FLOAT CalculateLaunchItemAngle( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubHe -void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, INT16 sGridNo, UINT8 ubLevel, INT16 sEndZ, FLOAT *pdMagForce, FLOAT *pdDegrees, INT16 *psFinalGridNo, BOOLEAN fArmed ) +void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, INT16 sGridNo, UINT8 ubLevel, INT16 sEndZ, FLOAT *pdMagForce, FLOAT *pdDegrees, INT16 *psFinalGridNo, BOOLEAN fArmed ) { INT16 sInterGridNo; INT16 sStartZ; @@ -1835,35 +1899,35 @@ void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, I // Start with default degrees/ force dDegrees = OUTDOORS_START_ANGLE; - sStartZ = GET_SOLDIER_THROW_HEIGHT( pSoldier->bLevel ); + sStartZ = GET_SOLDIER_THROW_HEIGHT( pSoldier->pathing.bLevel ); // Are we armed, and are we throwing a LAUNCHABLE? usLauncher = GetLauncherFromLaunchable( pItem->usItem ); - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 1741")); + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 1741")); if ( fArmed && ( Item[usLauncher].mortar || Item[pItem->usItem].mortar ) ) { // Start at 0.... - sStartZ = ( pSoldier->bLevel * 256 ); + sStartZ = ( pSoldier->pathing.bLevel * 256 ); fMortar = TRUE; sMinRange = MIN_MORTAR_RANGE; //fLauncher = TRUE; } - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 1750")); + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 1750")); if ( fArmed && ( Item[usLauncher].grenadelauncher || Item[pItem->usItem].grenadelauncher ) ) { // OK, look at target level and decide angle to use... if ( ubLevel == 1 ) { - dDegrees = GLAUNCHER_HIGHER_LEVEL_START_ANGLE; + dDegrees = GLAUNCHER_HIGHER_LEVEL_START_ANGLE; } else { - dDegrees = GLAUNCHER_START_ANGLE; + dDegrees = GLAUNCHER_START_ANGLE; } fGLauncher = TRUE; - sMinRange = MIN_MORTAR_RANGE/2; + sMinRange = MIN_MORTAR_RANGE/2; if ( (gGameSettings.fOptions[TOPTION_GL_HIGH_ANGLE] && pSoldier->bTeam == OUR_TEAM) || ( pSoldier->bTeam == ENEMY_TEAM && gGameOptions.ubDifficultyLevel >= DIF_LEVEL_HARD ) ) dDegrees *= 2; @@ -1873,14 +1937,14 @@ void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, I // CHANGE DEGREE VALUES BASED ON IF WE ARE INSIDE, ETC // ARE WE INSIDE? - if ( gfCaves || gfBasement ) + if ( gfCaves || gfBasement ) { // Adjust angle.... dDegrees = INDOORS_START_ANGLE; fIndoors = TRUE; } - if ( ( IsRoofPresentAtGridno( pSoldier->sGridNo ) ) && pSoldier->bLevel == 0 ) + if ( ( IsRoofPresentAtGridno( pSoldier->sGridNo ) ) && pSoldier->pathing.bLevel == 0 ) { // Adjust angle.... dDegrees = INDOORS_START_ANGLE; @@ -1932,7 +1996,7 @@ void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, I FindBestForceForTrajectory( pSoldier->sGridNo, sGridNo, sStartZ, sEndZ, dDegrees, pItem, psFinalGridNo, &dMagForce ); // Adjust due to max range.... - dMaxForce = CalculateSoldierMaxForce( pSoldier, dDegrees, pItem, fArmed ); + dMaxForce = CalculateSoldierMaxForce( pSoldier, dDegrees, pItem, fArmed ); if ( fIndoors ) { @@ -1959,13 +2023,13 @@ void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, I if ( fThroughIntermediateGridNo ) { // Given this power, now try and go through this window.... - dDegrees = FindBestAngleForTrajectory( pSoldier->sGridNo, sInterGridNo, GET_SOLDIER_THROW_HEIGHT( pSoldier->bLevel ), 150, dMagForce, pItem, psFinalGridNo ); + dDegrees = FindBestAngleForTrajectory( pSoldier->sGridNo, sInterGridNo, GET_SOLDIER_THROW_HEIGHT( pSoldier->pathing.bLevel ), 150, dMagForce, pItem, psFinalGridNo ); } } else { // Use MAX force, vary angle.... - dMagForce = CalculateSoldierMaxForce( pSoldier, dDegrees, pItem, fArmed ); + dMagForce = CalculateSoldierMaxForce( pSoldier, dDegrees, pItem, fArmed ); if ( ubLevel == 0 ) { @@ -1982,7 +2046,7 @@ void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, I dMagForce = (float)( dMagForce * 0.85 ); // Yep, try to get angle... - dNewDegrees = FindBestAngleForTrajectory( pSoldier->sGridNo, sGridNo, GET_SOLDIER_THROW_HEIGHT( pSoldier->bLevel ), 150, dMagForce, pItem, psFinalGridNo ); + dNewDegrees = FindBestAngleForTrajectory( pSoldier->sGridNo, sGridNo, GET_SOLDIER_THROW_HEIGHT( pSoldier->pathing.bLevel ), 150, dMagForce, pItem, psFinalGridNo ); if ( dNewDegrees != 0 ) { @@ -1993,7 +2057,7 @@ void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, I if ( fThroughIntermediateGridNo ) { - dDegrees = FindBestAngleForTrajectory( pSoldier->sGridNo, sInterGridNo, GET_SOLDIER_THROW_HEIGHT( pSoldier->bLevel ), 150, dMagForce, pItem, psFinalGridNo ); + dDegrees = FindBestAngleForTrajectory( pSoldier->sGridNo, sInterGridNo, GET_SOLDIER_THROW_HEIGHT( pSoldier->pathing.bLevel ), 150, dMagForce, pItem, psFinalGridNo ); } } @@ -2003,9 +2067,9 @@ void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, I } -BOOLEAN CalculateLaunchItemChanceToGetThrough( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, INT16 sGridNo, UINT8 ubLevel, INT16 sEndZ, INT16 *psFinalGridNo, BOOLEAN fArmed, INT8 *pbLevel, BOOLEAN fFromUI ) +BOOLEAN CalculateLaunchItemChanceToGetThrough( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, INT16 sGridNo, UINT8 ubLevel, INT16 sEndZ, INT16 *psFinalGridNo, BOOLEAN fArmed, INT8 *pbLevel, BOOLEAN fFromUI ) { - FLOAT dForce, dDegrees; + FLOAT dForce, dDegrees; INT16 sDestX, sDestY, sSrcX, sSrcY; vector_3 vForce, vPosition, vDirNormal; @@ -2026,7 +2090,7 @@ BOOLEAN CalculateLaunchItemChanceToGetThrough( SOLDIERTYPE *pSoldier, OBJECTTYPE // Set position vPosition.x = sSrcX; vPosition.y = sSrcY; - vPosition.z = GET_SOLDIER_THROW_HEIGHT( pSoldier->bLevel ); + vPosition.z = GET_SOLDIER_THROW_HEIGHT( pSoldier->pathing.bLevel ); // OK, get direction normal vDirNormal.x = (float)(sDestX - sSrcX); @@ -2069,7 +2133,6 @@ FLOAT CalculateForceFromRange( INT16 sRange, FLOAT dDegrees ) { FLOAT dMagForce; INT16 sSrcGridNo, sDestGridNo; - OBJECTTYPE Object; INT16 sFinalGridNo; // OK, use a fake gridno, find the new gridno based on range, use height of merc, end height of ground, @@ -2078,9 +2141,9 @@ FLOAT CalculateForceFromRange( INT16 sRange, FLOAT dDegrees ) sDestGridNo = 4408 + ( sRange * WORLD_COLS ); // Use a grenade objecttype - CreateItem( HAND_GRENADE, 100, &Object ); + CreateItem( HAND_GRENADE, 100, &gTempObject ); - FindBestForceForTrajectory( sSrcGridNo, sDestGridNo, GET_SOLDIER_THROW_HEIGHT( 0 ), 0, dDegrees, &Object, &sFinalGridNo, &dMagForce ); + FindBestForceForTrajectory( sSrcGridNo, sDestGridNo, GET_SOLDIER_THROW_HEIGHT( 0 ), 0, dDegrees, &gTempObject, &sFinalGridNo, &dMagForce ); return( dMagForce ); } @@ -2104,21 +2167,21 @@ FLOAT CalculateSoldierMaxForce( SOLDIERTYPE *pSoldier, FLOAT dDegrees , OBJECTTY } -#define MAX_MISS_BY 30 -#define MIN_MISS_BY 1 -#define MAX_MISS_RADIUS 5 +#define MAX_MISS_BY 30 +#define MIN_MISS_BY 1 +#define MAX_MISS_RADIUS 5 void CalculateLaunchItemParamsForThrow( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubLevel, INT16 sEndZ, OBJECTTYPE *pItem, INT8 bMissBy, UINT8 ubActionCode, UINT32 uiActionData ) { - FLOAT dForce, dDegrees; + FLOAT dForce, dDegrees; INT16 sDestX, sDestY, sSrcX, sSrcY; vector_3 vForce, vDirNormal; INT16 sFinalGridNo; BOOLEAN fArmed = FALSE; UINT16 usLauncher; INT16 sStartZ; - INT8 bMinMissRadius, bMaxMissRadius, bMaxRadius; - FLOAT fScale; + INT8 bMinMissRadius, bMaxMissRadius, bMaxRadius; + FLOAT fScale; DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CalculateLaunchItemParamsForThrow"); @@ -2221,21 +2284,19 @@ void CalculateLaunchItemParamsForThrow( SOLDIERTYPE *pSoldier, INT16 sGridNo, UI pSoldier->pThrowParams = (THROW_PARAMS *) MemAlloc( sizeof( THROW_PARAMS ) ); memset( pSoldier->pThrowParams, 0, sizeof( THROW_PARAMS ) ); - pSoldier->pTempObject = (OBJECTTYPE *) MemAlloc( sizeof( OBJECTTYPE ) ); - - memcpy( pSoldier->pTempObject, pItem, sizeof( OBJECTTYPE ) ); + OBJECTTYPE::CopyToOrCreateAt( &pSoldier->pTempObject, pItem); pSoldier->pThrowParams->dX = (float)sSrcX; pSoldier->pThrowParams->dY = (float)sSrcY; - sStartZ = GET_SOLDIER_THROW_HEIGHT( pSoldier->bLevel ); + sStartZ = GET_SOLDIER_THROW_HEIGHT( pSoldier->pathing.bLevel ); usLauncher = GetLauncherFromLaunchable( pItem->usItem ); - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 2103")); + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 2103")); if ( fArmed && Item[usLauncher].mortar ) { // Start at 0.... - sStartZ = ( pSoldier->bLevel * 256 ) + 50; + sStartZ = ( pSoldier->pathing.bLevel * 256 ) + 50; } pSoldier->pThrowParams->dZ = (float)sStartZ; @@ -2256,7 +2317,7 @@ void CalculateLaunchItemParamsForThrow( SOLDIERTYPE *pSoldier, INT16 sGridNo, UI BOOLEAN CheckForCatcher( REAL_OBJECT *pObject, UINT16 usStructureID ) { // Do we want to catch? - if ( pObject->fTestObject == NO_TEST_OBJECT ) + if ( pObject->fTestObject == NO_TEST_OBJECT ) { if ( pObject->ubActionCode == THROW_TARGET_MERC_CATCH ) { @@ -2264,7 +2325,7 @@ BOOLEAN CheckForCatcher( REAL_OBJECT *pObject, UINT16 usStructureID ) if ( usStructureID < INVALID_STRUCTURE_ID ) { //Is it the same guy? - if ( usStructureID == pObject->uiActionData ) + if ( usStructureID == pObject->uiActionData ) { if ( DoCatchObject( pObject ) ) { @@ -2282,10 +2343,10 @@ BOOLEAN CheckForCatcher( REAL_OBJECT *pObject, UINT16 usStructureID ) void CheckForObjectHittingMerc( REAL_OBJECT *pObject, UINT16 usStructureID ) { SOLDIERTYPE *pSoldier; - INT16 sDamage, sBreath; + INT16 sDamage, sBreath; // Do we want to catch? - if ( pObject->fTestObject == NO_TEST_OBJECT ) + if ( pObject->fTestObject == NO_TEST_OBJECT ) { // Is it a guy? if ( usStructureID < INVALID_STRUCTURE_ID ) @@ -2297,7 +2358,7 @@ void CheckForObjectHittingMerc( REAL_OBJECT *pObject, UINT16 usStructureID ) sDamage = 1; sBreath = 0; - EVENT_SoldierGotHit( pSoldier, NOTHING, sDamage, sBreath, pSoldier->ubDirection, 0, pObject->ubOwner, FIRE_WEAPON_TOSSED_OBJECT_SPECIAL, 0, 0, NOWHERE ); + pSoldier->EVENT_SoldierGotHit( NOTHING, sDamage, sBreath, pSoldier->ubDirection, 0, pObject->ubOwner, FIRE_WEAPON_TOSSED_OBJECT_SPECIAL, 0, 0, NOWHERE ); pObject->ubLastTargetTakenDamage = (UINT8)( usStructureID ); } @@ -2312,7 +2373,7 @@ BOOLEAN CheckForCatchObject( REAL_OBJECT *pObject ) UINT32 uiSpacesAway; // Do we want to catch? - if ( pObject->fTestObject == NO_TEST_OBJECT ) + if ( pObject->fTestObject == NO_TEST_OBJECT ) { if ( pObject->ubActionCode == THROW_TARGET_MERC_CATCH ) { @@ -2324,17 +2385,17 @@ BOOLEAN CheckForCatchObject( REAL_OBJECT *pObject ) if ( uiSpacesAway < 4 && !pObject->fAttemptedCatch ) { - if ( pSoldier->usAnimState != CATCH_STANDING && - pSoldier->usAnimState != CATCH_CROUCHED && - pSoldier->usAnimState != LOWER_RIFLE ) + if ( pSoldier->usAnimState != CATCH_STANDING && + pSoldier->usAnimState != CATCH_CROUCHED && + pSoldier->usAnimState != LOWER_RIFLE ) { if ( gAnimControl[ pSoldier->usAnimState ].ubHeight == ANIM_STAND ) { - EVENT_InitNewSoldierAnim( pSoldier, CATCH_STANDING, 0 , FALSE ); - } + pSoldier->EVENT_InitNewSoldierAnim( CATCH_STANDING, 0 , FALSE ); + } else if ( gAnimControl[ pSoldier->usAnimState ].ubHeight == ANIM_CROUCH ) { - EVENT_InitNewSoldierAnim( pSoldier, CATCH_CROUCHED, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( CATCH_CROUCHED, 0 , FALSE ); } pObject->fCatchAnimOn = TRUE; @@ -2402,17 +2463,17 @@ BOOLEAN DoCatchObject( REAL_OBJECT *pObject ) case ANIM_STAND: pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; - EVENT_InitNewSoldierAnim( pSoldier, END_CATCH, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( END_CATCH, 0 , FALSE ); break; case ANIM_CROUCH: pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; - EVENT_InitNewSoldierAnim( pSoldier, END_CROUCH_CATCH, 0 , FALSE ); + pSoldier->EVENT_InitNewSoldierAnim( END_CROUCH_CATCH, 0 , FALSE ); break; } - PlayJA2Sample( CATCH_OBJECT, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); + PlayJA2Sample( CATCH_OBJECT, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); pObject->fCatchAnimOn = FALSE; @@ -2432,14 +2493,14 @@ BOOLEAN DoCatchObject( REAL_OBJECT *pObject ) { pObject->fDropItem = FALSE; - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_MERC_CAUGHT_ITEM ], pSoldier->name, ShortItemNames[ usItem ] ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_MERC_CAUGHT_ITEM ], pSoldier->name, ShortItemNames[ usItem ] ); } return( TRUE ); } -//#define TESTDUDEXPLOSIVES +//#define TESTDUDEXPLOSIVES void HandleArmedObjectImpact( REAL_OBJECT *pObject ) { @@ -2466,14 +2527,14 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject ) } // if ( pObj->usItem == MORTAR_SHELL ) - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 2337")); + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 2337")); if (Item[ pObj->usItem ].usItemClass == IC_BOMB) { fCheckForDuds = TRUE; } - if ( Item[ pObj->usItem ].usItemClass & IC_THROWN ) + if ( Item[ pObj->usItem ].usItemClass & IC_THROWN ) { AddItemToPool( pObject->sGridNo, pObj, INVISIBLE, bLevel, usFlags, 0 ); } @@ -2481,20 +2542,20 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject ) if ( fCheckForDuds ) { // If we landed on anything other than the floor, always! go off... -#ifdef TESTDUDEXPLOSIVES +#ifdef TESTDUDEXPLOSIVES if ( sZ != 0 || pObject->fInWater ) #else - if ( sZ != 0 || pObject->fInWater || ( pObj->ItemData.Generic.bStatus[0] >= USABLE && ( PreRandom( 100 ) < (UINT32) pObj->ItemData.Generic.bStatus[0] + PreRandom( 50 ) ) ) ) + if ( sZ != 0 || pObject->fInWater || ( (*pObj)[0]->data.objectStatus >= USABLE && ( PreRandom( 100 ) < (UINT32) (*pObj)[0]->data.objectStatus + PreRandom( 50 ) ) ) ) #endif { fDoImpact = TRUE; } else // didn't go off! { -#ifdef TESTDUDEXPLOSIVES - if ( 1 ) +#ifdef TESTDUDEXPLOSIVES + if ( 1 ) #else - if ( pObj->ItemData.Generic.bStatus[0] >= USABLE && PreRandom(100) < (UINT32) pObj->ItemData.Generic.bStatus[0] + PreRandom( 50 ) ) + if ( (*pObj)[0]->data.objectStatus >= USABLE && PreRandom(100) < (UINT32) (*pObj)[0]->data.objectStatus + PreRandom( 50 ) ) #endif { iTrapped = PreRandom( 4 ) + 2; @@ -2505,8 +2566,8 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject ) // Start timed bomb... usFlags |= WORLD_ITEM_ARMED_BOMB; - pObj->ItemData.Trigger.bDetonatorType = BOMB_TIMED; - pObj->ItemData.Trigger.BombTrigger.bDelay = (INT8)( 1 + PreRandom( 2 ) ); + (*pObj)[0]->data.misc.bDetonatorType = BOMB_TIMED; + (*pObj)[0]->data.misc.bDelay = (INT8)( 1 + PreRandom( 2 ) ); } // ATE: If we have collided with roof last... @@ -2523,7 +2584,7 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject ) if ( pObject->ubOwner != NOBODY ) { - DoMercBattleSound( MercPtrs[ pObject->ubOwner ], (INT8)( BATTLE_SOUND_CURSE1 ) ); + MercPtrs[ pObject->ubOwner ]->DoMercBattleSound( (INT8)( BATTLE_SOUND_CURSE1 ) ); } } } @@ -2539,7 +2600,7 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject ) //if the light object will ber created OFF the ground if( pObject->Position.z > 0 && FindBuilding(pObject->sGridNo) ) { - //we cannot create the light source above the ground, or on a roof. The system doesnt support it. + //we cannot create the light source above the ground, or on a roof. The system doesnt support it. AddItemToPool( pObject->sGridNo, &( pObject->Obj ), 1, 1, 0, -1 ); } else @@ -2549,13 +2610,13 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject ) NewLightEffect( pObject->sGridNo, (UINT8)Explosive[Item[pObject->Obj.usItem].ubClassIndex].ubDuration , (UINT8)Explosive[Item[pObject->Obj.usItem].ubClassIndex].ubStartRadius ); } } - else if ( Item[ pObject->Obj.usItem ].usItemClass & IC_GRENADE ) + else if ( Item[ pObject->Obj.usItem ].usItemClass & IC_GRENADE ) { - /* ARM: Removed. Rewards even missed throws, and pulling a pin doesn't really teach anything about explosives + /* ARM: Removed. Rewards even missed throws, and pulling a pin doesn't really teach anything about explosives if ( MercPtrs[ pObject->ubOwner ]->bTeam == gbPlayerNum && gTacticalStatus.uiFlags & INCOMBAT ) { // tossed grenade, not a dud, so grant xp - // EXPLOSIVES GAIN (10): Tossing grenade + // EXPLOSIVES GAIN (10): Tossing grenade if ( pObject->ubOwner != NOBODY ) { StatChange( MercPtrs[ pObject->ubOwner ], EXPLODEAMT, 10, FALSE ); @@ -2565,7 +2626,7 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject ) IgniteExplosion( pObject->ubOwner, (INT16)pObject->Position.x, (INT16)pObject->Position.y, sZ, pObject->sGridNo, pObject->Obj.usItem, GET_OBJECT_LEVEL( pObject->Position.z - CONVERT_PIXELS_TO_HEIGHTUNITS( gpWorldLevelData[ pObject->sGridNo ].sHeight ) ) ); } - else if ( Item[ pObject->Obj.usItem ].usItemClass == IC_BOMB ) //if ( pObject->Obj.usItem == MORTAR_SHELL ) + else if ( Item[ pObject->Obj.usItem ].usItemClass == IC_BOMB ) //if ( pObject->Obj.usItem == MORTAR_SHELL ) { sZ = (INT16)CONVERT_HEIGHTUNITS_TO_PIXELS( (INT16)pObject->Position.z ); @@ -2608,8 +2669,7 @@ BOOLEAN SavePhysicsTableToSaveGameFile( HWFILE hFile ) if( ObjectSlots[ usCnt ].fAllocated ) { //Save the the REAL_OBJECT structure - FileWrite( hFile, &ObjectSlots[usCnt], sizeof( REAL_OBJECT ), &uiNumBytesWritten ); - if( uiNumBytesWritten != sizeof( REAL_OBJECT ) ) + if ( !ObjectSlots[usCnt].Save(hFile) ) { return( FALSE ); } @@ -2627,7 +2687,10 @@ BOOLEAN LoadPhysicsTableFromSavedGameFile( HWFILE hFile ) UINT16 usCnt=0; //make sure the objects are not allocated - memset( ObjectSlots, 0, NUM_OBJECT_SLOTS * sizeof( REAL_OBJECT ) ); + for (int x = 0; x < NUM_OBJECT_SLOTS; ++x) + { + ObjectSlots[x].initialize(); + } //Load the number of REAL_OBJECTs in the array FileRead( hFile, &guiNumObjectSlots, sizeof( UINT32 ), &uiNumBytesRead ); @@ -2640,8 +2703,7 @@ BOOLEAN LoadPhysicsTableFromSavedGameFile( HWFILE hFile ) for( usCnt=0; usCnt=0 && sGridNo < WORLD_MAX && - sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) ) + if ( sGridNo >=0 && sGridNo < WORLD_MAX && + sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) ) { fFound = TRUE; } diff --git a/TileEngine/physics.h b/TileEngine/physics.h index ca9943bf..cbc6c24c 100644 --- a/TileEngine/physics.h +++ b/TileEngine/physics.h @@ -10,8 +10,9 @@ extern UINT32 guiNumObjectSlots; -typedef struct +class OLD_REAL_OBJECT_101 { +public: BOOLEAN fAllocated; BOOLEAN fAlive; BOOLEAN fApplyFriction; @@ -41,7 +42,7 @@ typedef struct INT16 sGridNo; INT32 iID; LEVELNODE *pNode; - LEVELNODE *pShadow; + LEVELNODE *pShadow; INT16 sConsecutiveCollisions; INT16 sConsecutiveZeroVelocityCollisions; @@ -49,7 +50,7 @@ typedef struct FLOAT dLifeLength; FLOAT dLifeSpan; - OBJECTTYPE Obj; + OLD_OBJECTTYPE_101 oldObj; BOOLEAN fFirstTimeMoved; INT16 sFirstGridNo; UINT8 ubOwner; @@ -64,18 +65,88 @@ typedef struct BOOLEAN fEndedWithCollisionPositionSet; vector_3 EndedWithCollisionPosition; BOOLEAN fHaveHitGround; - BOOLEAN fPotentialForDebug; - INT16 sLevelNodeGridNo; - INT32 iSoundID; - UINT8 ubLastTargetTakenDamage; + BOOLEAN fPotentialForDebug; + INT16 sLevelNodeGridNo; + INT32 iSoundID; + UINT8 ubLastTargetTakenDamage; UINT8 ubPadding[1]; -} REAL_OBJECT; +}; + +class REAL_OBJECT +{ +public: + REAL_OBJECT () {initialize();}; + REAL_OBJECT& operator=(OLD_REAL_OBJECT_101& src); + BOOLEAN Load(HWFILE hFile); + BOOLEAN Save(HWFILE hFile); + void initialize(); + + BOOLEAN fAllocated; + BOOLEAN fAlive; + BOOLEAN fApplyFriction; + BOOLEAN fColliding; + BOOLEAN fZOnRest; + BOOLEAN fVisible; + BOOLEAN fInWater; + BOOLEAN fTestObject; + BOOLEAN fTestEndedWithCollision; + BOOLEAN fTestPositionNotSet; + + real TestZTarget; + real OneOverMass; + real AppliedMu; + + vector_3 Position; + vector_3 TestTargetPosition; + vector_3 OldPosition; + vector_3 Velocity; + vector_3 OldVelocity; + vector_3 InitialForce; + vector_3 Force; + vector_3 CollisionNormal; + vector_3 CollisionVelocity; + real CollisionElasticity; + + INT16 sGridNo; + INT32 iID; + LEVELNODE *pNode; + LEVELNODE *pShadow; + + INT16 sConsecutiveCollisions; + INT16 sConsecutiveZeroVelocityCollisions; + INT32 iOldCollisionCode; + + FLOAT dLifeLength; + FLOAT dLifeSpan; + BOOLEAN fFirstTimeMoved; + INT16 sFirstGridNo; + UINT8 ubOwner; + UINT8 ubActionCode; + UINT32 uiActionData; + BOOLEAN fDropItem; + UINT32 uiNumTilesMoved; + BOOLEAN fCatchGood; + BOOLEAN fAttemptedCatch; + BOOLEAN fCatchAnimOn; + BOOLEAN fCatchCheckDone; + BOOLEAN fEndedWithCollisionPositionSet; + vector_3 EndedWithCollisionPosition; + BOOLEAN fHaveHitGround; + BOOLEAN fPotentialForDebug; + INT16 sLevelNodeGridNo; + INT32 iSoundID; + UINT8 ubLastTargetTakenDamage; + + char endOfPod; + OBJECTTYPE Obj; +}; +#define SIZEOF_REAL_OBJECT_POD offsetof(REAL_OBJECT, endOfPod) #define NUM_OBJECT_SLOTS 50 -extern REAL_OBJECT ObjectSlots[ NUM_OBJECT_SLOTS ]; +extern REAL_OBJECT ObjectSlots[ NUM_OBJECT_SLOTS ]; // OBJECT LIST STUFF @@ -95,7 +166,7 @@ void CalculateLaunchItemParamsForThrow( SOLDIERTYPE *pSoldier, INT16 sGridNo, UI // SIMULATE WORLD -void SimulateWorld( ); +void SimulateWorld( ); BOOLEAN SavePhysicsTableToSaveGameFile( HWFILE hFile ); diff --git a/TileEngine/pits.cpp b/TileEngine/pits.cpp index 0575fcd5..cb7ee931 100644 --- a/TileEngine/pits.cpp +++ b/TileEngine/pits.cpp @@ -30,28 +30,28 @@ void Add3X3Pit( INT32 iMapIndex ) if( !gfEditMode ) ApplyMapChangesToMapTempFile( TRUE ); AddObjectToTail( iMapIndex + 159, REGWATERTEXTURE1 ); - AddObjectToTail( iMapIndex - 1, REGWATERTEXTURE2 ); + AddObjectToTail( iMapIndex - 1, REGWATERTEXTURE2 ); AddObjectToTail( iMapIndex - 161, REGWATERTEXTURE3 ); AddObjectToTail( iMapIndex + 160, REGWATERTEXTURE4 ); AddObjectToTail( iMapIndex, REGWATERTEXTURE5 ); AddObjectToTail( iMapIndex - 160, REGWATERTEXTURE6 ); AddObjectToTail( iMapIndex + 161, REGWATERTEXTURE7 ); - AddObjectToTail( iMapIndex + 1, REGWATERTEXTURE8 ); + AddObjectToTail( iMapIndex + 1, REGWATERTEXTURE8 ); AddObjectToTail( iMapIndex - 159, REGWATERTEXTURE9 ); if( !gfEditMode ) { //Add the exitgrids associated with the pit. ExitGrid.ubGotoSectorX = (UINT8)gWorldSectorX; ExitGrid.ubGotoSectorY = (UINT8)gWorldSectorY; ExitGrid.ubGotoSectorZ = (UINT8)(gbWorldSectorZ+1); - ExitGrid.usGridNo = (UINT16)iMapIndex; + ExitGrid.sGridNo = (INT16)iMapIndex; AddExitGridToWorld( iMapIndex + 159, &ExitGrid ); - AddExitGridToWorld( iMapIndex - 1, &ExitGrid ); + AddExitGridToWorld( iMapIndex - 1, &ExitGrid ); AddExitGridToWorld( iMapIndex - 161, &ExitGrid ); AddExitGridToWorld( iMapIndex + 160, &ExitGrid ); - AddExitGridToWorld( iMapIndex, &ExitGrid ); + AddExitGridToWorld( iMapIndex, &ExitGrid ); AddExitGridToWorld( iMapIndex - 160, &ExitGrid ); AddExitGridToWorld( iMapIndex + 161, &ExitGrid ); - AddExitGridToWorld( iMapIndex + 1, &ExitGrid ); + AddExitGridToWorld( iMapIndex + 1, &ExitGrid ); AddExitGridToWorld( iMapIndex - 159, &ExitGrid ); RecompileLocalMovementCostsFromRadius( (INT16)iMapIndex, 2 ); } @@ -68,12 +68,12 @@ void Add5X5Pit( INT32 iMapIndex ) ApplyMapChangesToMapTempFile( TRUE ); AddObjectToTail( iMapIndex + 318, REGWATERTEXTURE10 ); AddObjectToTail( iMapIndex + 158, REGWATERTEXTURE11 ); - AddObjectToTail( iMapIndex - 2, REGWATERTEXTURE12 ); + AddObjectToTail( iMapIndex - 2, REGWATERTEXTURE12 ); AddObjectToTail( iMapIndex - 162, REGWATERTEXTURE13 ); AddObjectToTail( iMapIndex - 322, REGWATERTEXTURE14 ); AddObjectToTail( iMapIndex + 319, REGWATERTEXTURE15 ); AddObjectToTail( iMapIndex + 159, REGWATERTEXTURE16 ); - AddObjectToTail( iMapIndex - 1, REGWATERTEXTURE17 ); + AddObjectToTail( iMapIndex - 1, REGWATERTEXTURE17 ); AddObjectToTail( iMapIndex - 161, REGWATERTEXTURE18 ); AddObjectToTail( iMapIndex - 321, REGWATERTEXTURE19 ); AddObjectToTail( iMapIndex + 320, REGWATERTEXTURE20 ); @@ -83,12 +83,12 @@ void Add5X5Pit( INT32 iMapIndex ) AddObjectToTail( iMapIndex - 320, REGWATERTEXTURE24 ); AddObjectToTail( iMapIndex + 321, REGWATERTEXTURE25 ); AddObjectToTail( iMapIndex + 161, REGWATERTEXTURE26 ); - AddObjectToTail( iMapIndex + 1, REGWATERTEXTURE27 ); + AddObjectToTail( iMapIndex + 1, REGWATERTEXTURE27 ); AddObjectToTail( iMapIndex - 159, REGWATERTEXTURE28 ); AddObjectToTail( iMapIndex - 319, REGWATERTEXTURE29 ); AddObjectToTail( iMapIndex + 322, REGWATERTEXTURE30 ); AddObjectToTail( iMapIndex + 162, REGWATERTEXTURE31 ); - AddObjectToTail( iMapIndex + 2, REGWATERTEXTURE32 ); + AddObjectToTail( iMapIndex + 2, REGWATERTEXTURE32 ); AddObjectToTail( iMapIndex - 158, REGWATERTEXTURE33 ); AddObjectToTail( iMapIndex - 318, REGWATERTEXTURE34 ); if( !gfEditMode ) @@ -96,30 +96,30 @@ void Add5X5Pit( INT32 iMapIndex ) ExitGrid.ubGotoSectorX = (UINT8)gWorldSectorX; ExitGrid.ubGotoSectorY = (UINT8)gWorldSectorY; ExitGrid.ubGotoSectorZ = (UINT8)(gbWorldSectorZ+1); - ExitGrid.usGridNo = (UINT16)iMapIndex; + ExitGrid.sGridNo = (INT16)iMapIndex; AddExitGridToWorld( iMapIndex + 318, &ExitGrid ); AddExitGridToWorld( iMapIndex + 158, &ExitGrid ); - AddExitGridToWorld( iMapIndex - 2, &ExitGrid ); + AddExitGridToWorld( iMapIndex - 2, &ExitGrid ); AddExitGridToWorld( iMapIndex - 162, &ExitGrid ); AddExitGridToWorld( iMapIndex - 322, &ExitGrid ); AddExitGridToWorld( iMapIndex + 319, &ExitGrid ); AddExitGridToWorld( iMapIndex + 159, &ExitGrid ); - AddExitGridToWorld( iMapIndex - 1, &ExitGrid ); + AddExitGridToWorld( iMapIndex - 1, &ExitGrid ); AddExitGridToWorld( iMapIndex - 161, &ExitGrid ); AddExitGridToWorld( iMapIndex - 321, &ExitGrid ); AddExitGridToWorld( iMapIndex + 320, &ExitGrid ); AddExitGridToWorld( iMapIndex + 160, &ExitGrid ); - AddExitGridToWorld( iMapIndex, &ExitGrid ); + AddExitGridToWorld( iMapIndex, &ExitGrid ); AddExitGridToWorld( iMapIndex - 160, &ExitGrid ); AddExitGridToWorld( iMapIndex - 320, &ExitGrid ); AddExitGridToWorld( iMapIndex + 321, &ExitGrid ); AddExitGridToWorld( iMapIndex + 161, &ExitGrid ); - AddExitGridToWorld( iMapIndex + 1, &ExitGrid ); + AddExitGridToWorld( iMapIndex + 1, &ExitGrid ); AddExitGridToWorld( iMapIndex - 159, &ExitGrid ); AddExitGridToWorld( iMapIndex - 319, &ExitGrid ); AddExitGridToWorld( iMapIndex + 322, &ExitGrid ); AddExitGridToWorld( iMapIndex + 162, &ExitGrid ); - AddExitGridToWorld( iMapIndex + 2, &ExitGrid ); + AddExitGridToWorld( iMapIndex + 2, &ExitGrid ); AddExitGridToWorld( iMapIndex - 158, &ExitGrid ); AddExitGridToWorld( iMapIndex - 318, &ExitGrid ); RecompileLocalMovementCostsFromRadius( (INT16)iMapIndex, 3 ); @@ -132,13 +132,13 @@ void Add5X5Pit( INT32 iMapIndex ) void Remove3X3Pit( INT32 iMapIndex ) { RemoveAllObjectsOfTypeRange( iMapIndex + 159, REGWATERTEXTURE, REGWATERTEXTURE ); - RemoveAllObjectsOfTypeRange( iMapIndex - 1, REGWATERTEXTURE, REGWATERTEXTURE ); + RemoveAllObjectsOfTypeRange( iMapIndex - 1, REGWATERTEXTURE, REGWATERTEXTURE ); RemoveAllObjectsOfTypeRange( iMapIndex - 161, REGWATERTEXTURE, REGWATERTEXTURE ); RemoveAllObjectsOfTypeRange( iMapIndex + 160, REGWATERTEXTURE, REGWATERTEXTURE ); RemoveAllObjectsOfTypeRange( iMapIndex, REGWATERTEXTURE, REGWATERTEXTURE ); RemoveAllObjectsOfTypeRange( iMapIndex - 160, REGWATERTEXTURE, REGWATERTEXTURE ); RemoveAllObjectsOfTypeRange( iMapIndex + 161, REGWATERTEXTURE, REGWATERTEXTURE ); - RemoveAllObjectsOfTypeRange( iMapIndex + 1, REGWATERTEXTURE, REGWATERTEXTURE ); + RemoveAllObjectsOfTypeRange( iMapIndex + 1, REGWATERTEXTURE, REGWATERTEXTURE ); RemoveAllObjectsOfTypeRange( iMapIndex - 159, REGWATERTEXTURE, REGWATERTEXTURE ); MarkWorldDirty(); } @@ -147,12 +147,12 @@ void Remove5X5Pit( INT32 iMapIndex ) { RemoveAllObjectsOfTypeRange( iMapIndex + 318, REGWATERTEXTURE, REGWATERTEXTURE ); RemoveAllObjectsOfTypeRange( iMapIndex + 158, REGWATERTEXTURE, REGWATERTEXTURE ); - RemoveAllObjectsOfTypeRange( iMapIndex - 2, REGWATERTEXTURE, REGWATERTEXTURE ); + RemoveAllObjectsOfTypeRange( iMapIndex - 2, REGWATERTEXTURE, REGWATERTEXTURE ); RemoveAllObjectsOfTypeRange( iMapIndex - 162, REGWATERTEXTURE, REGWATERTEXTURE ); RemoveAllObjectsOfTypeRange( iMapIndex - 322, REGWATERTEXTURE, REGWATERTEXTURE ); RemoveAllObjectsOfTypeRange( iMapIndex + 319, REGWATERTEXTURE, REGWATERTEXTURE ); RemoveAllObjectsOfTypeRange( iMapIndex + 159, REGWATERTEXTURE, REGWATERTEXTURE ); - RemoveAllObjectsOfTypeRange( iMapIndex - 1, REGWATERTEXTURE, REGWATERTEXTURE ); + RemoveAllObjectsOfTypeRange( iMapIndex - 1, REGWATERTEXTURE, REGWATERTEXTURE ); RemoveAllObjectsOfTypeRange( iMapIndex - 161, REGWATERTEXTURE, REGWATERTEXTURE ); RemoveAllObjectsOfTypeRange( iMapIndex - 321, REGWATERTEXTURE, REGWATERTEXTURE ); RemoveAllObjectsOfTypeRange( iMapIndex + 320, REGWATERTEXTURE, REGWATERTEXTURE ); @@ -162,12 +162,12 @@ void Remove5X5Pit( INT32 iMapIndex ) RemoveAllObjectsOfTypeRange( iMapIndex - 320, REGWATERTEXTURE, REGWATERTEXTURE ); RemoveAllObjectsOfTypeRange( iMapIndex + 321, REGWATERTEXTURE, REGWATERTEXTURE ); RemoveAllObjectsOfTypeRange( iMapIndex + 161, REGWATERTEXTURE, REGWATERTEXTURE ); - RemoveAllObjectsOfTypeRange( iMapIndex + 1, REGWATERTEXTURE, REGWATERTEXTURE ); + RemoveAllObjectsOfTypeRange( iMapIndex + 1, REGWATERTEXTURE, REGWATERTEXTURE ); RemoveAllObjectsOfTypeRange( iMapIndex - 159, REGWATERTEXTURE, REGWATERTEXTURE ); RemoveAllObjectsOfTypeRange( iMapIndex - 319, REGWATERTEXTURE, REGWATERTEXTURE ); RemoveAllObjectsOfTypeRange( iMapIndex + 322, REGWATERTEXTURE, REGWATERTEXTURE ); RemoveAllObjectsOfTypeRange( iMapIndex + 162, REGWATERTEXTURE, REGWATERTEXTURE ); - RemoveAllObjectsOfTypeRange( iMapIndex + 2, REGWATERTEXTURE, REGWATERTEXTURE ); + RemoveAllObjectsOfTypeRange( iMapIndex + 2, REGWATERTEXTURE, REGWATERTEXTURE ); RemoveAllObjectsOfTypeRange( iMapIndex - 158, REGWATERTEXTURE, REGWATERTEXTURE ); RemoveAllObjectsOfTypeRange( iMapIndex - 318, REGWATERTEXTURE, REGWATERTEXTURE ); MarkWorldDirty(); @@ -178,13 +178,13 @@ void AddAllPits() UINT32 i; for( i = 0; i < guiNumWorldItems; i++ ) { - if( gWorldItems[ i ].o.usItem == ACTION_ITEM ) + if( gWorldItems[ i ].object.usItem == ACTION_ITEM ) { - if( gWorldItems[ i ].o.ItemData.Trigger.bActionValue == ACTION_ITEM_SMALL_PIT ) - Add3X3Pit( gWorldItems[ i ].sGridNo ); - else if( gWorldItems[ i ].o.ItemData.Trigger.bActionValue == ACTION_ITEM_LARGE_PIT ) + if( gWorldItems[ i ].object[0]->data.misc.bActionValue == ACTION_ITEM_SMALL_PIT ) + Add3X3Pit( gWorldItems[ i ].sGridNo ); + else if( gWorldItems[ i ].object[0]->data.misc.bActionValue == ACTION_ITEM_LARGE_PIT ) Add5X5Pit( gWorldItems[ i ].sGridNo ); - } + } } } @@ -193,13 +193,13 @@ void RemoveAllPits() UINT32 i; for( i = 0; i < guiNumWorldItems; i++ ) { - if( gWorldItems[ i ].o.usItem == ACTION_ITEM ) + if( gWorldItems[ i ].object.usItem == ACTION_ITEM ) { - if( gWorldItems[ i ].o.ItemData.Trigger.bActionValue == ACTION_ITEM_SMALL_PIT ) - Remove3X3Pit( gWorldItems[ i ].sGridNo ); - else if( gWorldItems[ i ].o.ItemData.Trigger.bActionValue == ACTION_ITEM_LARGE_PIT ) + if( gWorldItems[ i ].object[0]->data.misc.bActionValue == ACTION_ITEM_SMALL_PIT ) + Remove3X3Pit( gWorldItems[ i ].sGridNo ); + else if( gWorldItems[ i ].object[0]->data.misc.bActionValue == ACTION_ITEM_LARGE_PIT ) Remove5X5Pit( gWorldItems[ i ].sGridNo ); - } + } } } @@ -214,8 +214,8 @@ void SearchForOtherMembersWithinPitRadiusAndMakeThemFall( INT16 sGridNo, INT16 s for( y = -sRadius; y <= sRadius; y++ ) for( x = -sRadius; x <= sRadius; x++ ) { sNewGridNo = sGridNo + y * WORLD_COLS + x; - //Validate gridno location, and check if there are any mercs here. If there are - //any mercs, we want them to fall below. The exitgrid already exists at this location + //Validate gridno location, and check if there are any mercs here. If there are + //any mercs, we want them to fall below. The exitgrid already exists at this location if( GridNoOnVisibleWorldTile( sNewGridNo ) ) { @@ -228,10 +228,10 @@ void SearchForOtherMembersWithinPitRadiusAndMakeThemFall( INT16 sGridNo, INT16 s // Set data to look for exit grid.... pSoldier = MercPtrs[ ubID ]; - pSoldier->uiPendingActionData4 = sNewGridNo; + pSoldier->aiData.uiPendingActionData4 = sNewGridNo; - EVENT_InitNewSoldierAnim( pSoldier, FALL_INTO_PIT, 0 , FALSE ); - } + pSoldier->EVENT_InitNewSoldierAnim( FALL_INTO_PIT, 0 , FALSE ); + } } } } @@ -242,14 +242,14 @@ void HandleFallIntoPitFromAnimation( UINT8 ubID ) EXITGRID ExitGrid; INT16 sPitGridNo; // OK, get exit grid... - - sPitGridNo = (INT16)pSoldier->uiPendingActionData4; + + sPitGridNo = (INT16)pSoldier->aiData.uiPendingActionData4; GetExitGrid( sPitGridNo, &ExitGrid ); // Given exit grid, make buddy move to next sector.... pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; - pSoldier->usStrategicInsertionData = ExitGrid.usGridNo; + pSoldier->usStrategicInsertionData = ExitGrid.sGridNo; pSoldier->sSectorX = ExitGrid.ubGotoSectorX; pSoldier->sSectorY = ExitGrid.ubGotoSectorY; @@ -260,6 +260,6 @@ void HandleFallIntoPitFromAnimation( UINT8 ubID ) HandleSoldierLeavingSectorByThemSelf( pSoldier ); - SetSoldierHeight( pSoldier, 0 ); + pSoldier->SetSoldierHeight( 0 ); -} \ No newline at end of file +} diff --git a/TileEngine/renderworld.cpp b/TileEngine/renderworld.cpp index e46c57d4..e3acb4df 100644 --- a/TileEngine/renderworld.cpp +++ b/TileEngine/renderworld.cpp @@ -6,11 +6,11 @@ #include "math.h" #include #include - + #include "worlddef.h" #include "renderworld.h" #include "vsurface.h" - #include "input.h" + #include "input.h" #include "sysutil.h" #include "wchar.h" #include "video.h" @@ -18,13 +18,13 @@ #include "debug.h" #include "wcheck.h" #include "worldman.h" - #include "jascreens.h" + #include "jascreens.h" #include "edit_sys.h" #include "Isometric Utils.h" #include "line.h" #include "Animation Control.h" #include "Animation Data.h" - #include "Timer Control.h" + #include "Timer Control.h" #include "Radar Screen.h" #include "Render Dirty.h" #include "Font Control.h" @@ -52,18 +52,18 @@ /////////////////////////// // C file include here -#include "Render Z.cpp" +#include "Render Z.h" /////////////////////////// extern CHAR8 gDebugStr[128]; extern BOOLEAN fLandLayerDirty = TRUE; -extern INT16 gsVIEWPORT_START_X; -extern INT16 gsVIEWPORT_START_Y; -extern INT16 gsVIEWPORT_END_Y; -extern INT16 gsVIEWPORT_WINDOW_END_Y; +extern INT16 gsVIEWPORT_START_X; +extern INT16 gsVIEWPORT_START_Y; +extern INT16 gsVIEWPORT_END_Y; +extern INT16 gsVIEWPORT_WINDOW_END_Y; extern INT16 gsVIEWPORT_WINDOW_START_Y; -extern INT16 gsVIEWPORT_END_X; +extern INT16 gsVIEWPORT_END_X; UINT16 *gpZBuffer = NULL; BOOLEAN gfTagAnimatedTiles = TRUE; @@ -106,14 +106,14 @@ extern BOOLEAN gfTopMessageDirty; // RENDERER FLAGS FOR DIFFERENT RENDER LEVELS typedef enum { - RENDER_STATIC_LAND, RENDER_STATIC_OBJECTS, - RENDER_STATIC_SHADOWS, RENDER_STATIC_STRUCTS, - RENDER_STATIC_ROOF, RENDER_STATIC_ONROOF, - RENDER_STATIC_TOPMOST, RENDER_DYNAMIC_LAND, - RENDER_DYNAMIC_OBJECTS, RENDER_DYNAMIC_SHADOWS, - RENDER_DYNAMIC_STRUCT_MERCS, RENDER_DYNAMIC_MERCS, - RENDER_DYNAMIC_STRUCTS, RENDER_DYNAMIC_ROOF, - RENDER_DYNAMIC_HIGHMERCS, RENDER_DYNAMIC_ONROOF, + RENDER_STATIC_LAND, RENDER_STATIC_OBJECTS, + RENDER_STATIC_SHADOWS, RENDER_STATIC_STRUCTS, + RENDER_STATIC_ROOF, RENDER_STATIC_ONROOF, + RENDER_STATIC_TOPMOST, RENDER_DYNAMIC_LAND, + RENDER_DYNAMIC_OBJECTS, RENDER_DYNAMIC_SHADOWS, + RENDER_DYNAMIC_STRUCT_MERCS, RENDER_DYNAMIC_MERCS, + RENDER_DYNAMIC_STRUCTS, RENDER_DYNAMIC_ROOF, + RENDER_DYNAMIC_HIGHMERCS, RENDER_DYNAMIC_ONROOF, RENDER_DYNAMIC_TOPMOST, NUM_RENDER_FX_TYPES }; @@ -351,13 +351,13 @@ UINT8 ubRGBItemCycleYellowColors[] = #define NUMSPEEDS 5 -UINT8 gubNewScrollXSpeeds[2][ NUMSPEEDS ] = -{ +UINT8 gubNewScrollXSpeeds[2][ NUMSPEEDS ] = +{ 40, 80, 100, 180, 200, // Non-video mode scroll 20, 40, 80, 80, 80 // Video mode scroll -}; +}; -UINT8 gubNewScrollYSpeeds[2][ NUMSPEEDS ] = +UINT8 gubNewScrollYSpeeds[2][ NUMSPEEDS ] = { 40, 80, 100, 180, 200, // Non-video mode scroll 10, 20, 60, 80, 80 // Video mode scroll @@ -404,7 +404,7 @@ INT16 gsFastGlowFrames[] = // The glow frame pointer can be adjusted to use a faster/ slower glow INT16 *gpGlowFramePointer = gsGlowFrames; -UINT32 gScrollDirectionFlags[ NUM_WORLD_DIRECTIONS ] = +UINT32 gScrollDirectionFlags[ NUM_WORLD_DIRECTIONS ] = { SCROLL_UP | SCROLL_RIGHT, SCROLL_RIGHT, @@ -419,7 +419,7 @@ UINT32 gScrollDirectionFlags[ NUM_WORLD_DIRECTIONS ] = INT16 SCROLL_X_STEP = ( WORLD_TILE_X ); INT16 SCROLL_Y_STEP = ( WORLD_TILE_Y * 2); -/* +/* * ViewPort starting values * What is viewport? * So viewport are coords of map screen (tactical screen) @@ -429,7 +429,7 @@ INT16 SCROLL_Y_STEP = ( WORLD_TILE_Y * 2); * any questions? joker */ /* -INT16 gsVIEWPORT_START_X = 0; +INT16 gsVIEWPORT_START_X = 0; INT16 gsVIEWPORT_START_Y = 0; INT16 gsVIEWPORT_WINDOW_START_Y = 0; INT16 gsVIEWPORT_WINDOW_END_Y = INTERFACE_START_Y;//do zmiany @@ -439,7 +439,7 @@ INT16 gsVIEWPORT_END_Y = INTERFACE_START_Y; i changed for dynamic initialization joker */ // still need the global object container defined atleast once outside a header (jonathanl) -INT16 gsVIEWPORT_START_X = 0; +INT16 gsVIEWPORT_START_X = 0; INT16 gsVIEWPORT_START_Y = 0; INT16 gsVIEWPORT_WINDOW_START_Y = 0; INT16 gsVIEWPORT_WINDOW_END_Y = INTERFACE_START_Y; @@ -520,7 +520,7 @@ typedef struct BOOLEAN fObscured; } RenderFXType; -RenderFXType RenderFX[] = +RenderFXType RenderFX[] = { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, // STATIC LAND FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, // STATIC OBJECTS @@ -794,7 +794,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT UINT16 usImageIndex, *pShadeTable, *pDirtyBackPtr; UINT32 uiBrushWidth, uiBrushHeight, uiDirtyFlags; INT16 sTileHeight, sXPos, sYPos, sZLevel; - INT16 sMouseX_M, sMouseY_M; + INT16 sMouseX_M, sMouseY_M; BOOLEAN fShadowBlitter=FALSE; BOOLEAN fZBlitter=FALSE; BOOLEAN fZWrite=FALSE; @@ -815,7 +815,6 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT INT16 sX, sY; BOOLEAN fTileInvisible = FALSE; BOOLEAN fConvertTo16=FALSE; - BOOLEAN fBlit16=FALSE; UINT32 cnt; static UINT8 ubLevelNodeStartIndex[ NUM_RENDER_FX_TYPES ]; BOOLEAN bItemOutline; @@ -905,7 +904,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT iTempPosY_M = iAnchorPosY_M; iTempPosX_S = iAnchorPosX_S; iTempPosY_S = iAnchorPosY_S; - + uiMapPosIndex = 0; // Build tile index list @@ -916,7 +915,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT iTempPosX_S += 40; iTempPosX_M ++; iTempPosY_M --; - + uiMapPosIndex++; } while( iTempPosX_S < iEndXS ); @@ -940,7 +939,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT iTempPosY_M = iAnchorPosY_M; iTempPosX_S = iAnchorPosX_S; iTempPosY_S = iAnchorPosY_S; - + fEndRenderRow = FALSE; uiMapPosIndex = 0; @@ -976,7 +975,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT { //pNode = gpWorldLevelData[ uiTileIndex ].pLevelNodes[ RenderFXStartIndex[ psLevelIDs[ cnt ] ] ]; //pNode = gpWorldLevelData[ uiTileIndex ].pLevelNodes[ 0 ]; - //pNode=NULL; + //pNode=NULL; pNode = gpWorldLevelData[ uiTileIndex ].pLevelNodes[ ubLevelNodeStartIndex[ cnt ] ]; } @@ -991,7 +990,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT fObscured = RenderingFX.fObscured; fDynamic = RenderingFX.fDynamic; - + fMerc = RenderingFX.fMerc; fZWrite = RenderingFX.fZWrite; fZBlitter = RenderingFX.fZBlitter; @@ -1013,7 +1012,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT sZStripIndex = -1; uiLevelNodeFlags = pNode->uiFlags; - + if ( fCheckForRedundency ) { if ( ( gpWorldLevelData[ uiTileIndex ].uiFlags & MAPELEMENT_REDUNDENT) ) @@ -1136,7 +1135,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT fRenderTile=FALSE; } } - } + } // OK, ATE, CHECK FOR AN OBSCURED TILE AND MAKE SURE IF LEVELNODE IS SET // WE DON'T RENDER UNLESS WE HAVE THE RENDER FLAG SET! @@ -1176,12 +1175,12 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT } } } - + // If flag says to do dynamic as well, render! if ( ( uiFlags & TILES_DOALL ) ) { - fRenderTile = TRUE; + fRenderTile = TRUE; } // If we are on the struct layer, check for if it's hidden! @@ -1205,7 +1204,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT pNode = pNode->pPrevNode; else pNode = pNode->pNext; - + continue; } } @@ -1244,8 +1243,8 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT //pShadeTable = pCorpse->p16BPPPalette; dOffsetX = pCorpse->def.dXPos - gsRenderCenterX; - dOffsetY = pCorpse->def.dYPos - gsRenderCenterY; - + dOffsetY = pCorpse->def.dYPos - gsRenderCenterY; + // OK, if this is a corpse.... stop if not visible if ( pCorpse->def.bVisible != 1 && !(gTacticalStatus.uiFlags&SHOW_ALL_MERCS) ) { @@ -1254,12 +1253,12 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT pNode = pNode->pPrevNode; else pNode = pNode->pNext; - + continue; } } else - { + { dOffsetX = (FLOAT)( pNode->pAniTile->sRelativeX - gsRenderCenterX ); dOffsetY = (FLOAT)( pNode->pAniTile->sRelativeY - gsRenderCenterY ); } @@ -1282,7 +1281,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT // ADJUST FOR WORLD MAPELEM HIEGHT sYPos-=TileElem->sOffsetHeight; - + if((TileElem->uiFlags&IGNORE_WORLD_HEIGHT) ) { sYPos = sYPos - sModifiedTileHeight; @@ -1299,7 +1298,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT } } - + //ADJUST FOR RELATIVE OFFSETS if ( uiLevelNodeFlags & LEVELNODE_USERELPOS ) @@ -1385,7 +1384,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT pNode = pNode->pPrevNode; else pNode = pNode->pNext; - continue; + continue; } } if ( pItemPool->bRenderZHeightAboveLevel > 0 ) @@ -1412,13 +1411,13 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT { case TILES_STATIC_LAND: - LandZLevel( iTempPosX_M, iTempPosY_M ); + sZLevel = LandZLevel( iTempPosX_M, iTempPosY_M ); break; case TILES_STATIC_OBJECTS: // ATE: Modified to use constant z level, as these are same level as land items - ObjectZLevel( TileElem, pNode, iTempPosX_M, iTempPosY_M ); + sZLevel = ObjectZLevel( TileElem, pNode, uiTileElemFlags, iTempPosX_M, iTempPosY_M, sWorldY ); break; case TILES_STATIC_STRUCTURES: @@ -1440,7 +1439,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT case TILES_STATIC_ROOF: - RoofZLevel( iTempPosX_M, iTempPosY_M ); + sZLevel = RoofZLevel( iTempPosX_M, iTempPosY_M, sWorldY ); // Automatically adjust height! sYPos -= WALL_HEIGHT; @@ -1453,19 +1452,19 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT break; case TILES_STATIC_ONROOF: - OnRoofZLevel( iTempPosX_M, iTempPosY_M ); + sZLevel = OnRoofZLevel( iTempPosX_M, iTempPosY_M, sWorldY, uiLevelNodeFlags ); // Automatically adjust height! sYPos -= WALL_HEIGHT; break; case TILES_STATIC_TOPMOST: - TopmostZLevel( iTempPosX_M, iTempPosY_M ); + sZLevel = TopmostZLevel( iTempPosX_M, iTempPosY_M, sWorldY ); break; case TILES_STATIC_SHADOWS: - - ShadowZLevel( iTempPosX_M, iTempPosY_M ); + + sZLevel = ShadowZLevel( iTempPosX_M, iTempPosY_M, sWorldY ); if ( uiLevelNodeFlags & LEVELNODE_EXITGRID ) { @@ -1476,18 +1475,18 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT case TILES_DYNAMIC_LAND: - LandZLevel( iTempPosX_M, iTempPosY_M ); + sZLevel = LandZLevel( iTempPosX_M, iTempPosY_M ); uiDirtyFlags=BGND_FLAG_SINGLE|BGND_FLAG_ANIMATED; break; case TILES_DYNAMIC_SHADOWS: - ShadowZLevel( iTempPosX_M, iTempPosY_M ); + sZLevel = ShadowZLevel( iTempPosX_M, iTempPosY_M, sWorldY ); //sZLevel=SHADOW_Z_LEVEL; uiDirtyFlags=BGND_FLAG_SINGLE|BGND_FLAG_ANIMATED; break; case TILES_DYNAMIC_OBJECTS: - ObjectZLevel( TileElem, pNode, iTempPosX_M, iTempPosY_M ); + sZLevel = ObjectZLevel( TileElem, pNode, uiTileElemFlags, iTempPosX_M, iTempPosY_M, sWorldY ); uiDirtyFlags=BGND_FLAG_SINGLE|BGND_FLAG_ANIMATED; break; @@ -1495,7 +1494,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT StructZLevel( iTempPosX_M, iTempPosY_M ); uiDirtyFlags=BGND_FLAG_SINGLE|BGND_FLAG_ANIMATED; - + if ( uiTileElemFlags & Z_AWARE_DYNAMIC_TILE ) { fMultiZBlitter = TRUE; @@ -1508,7 +1507,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT sYPos -= WALL_HEIGHT; - RoofZLevel( iTempPosX_M, iTempPosY_M ); + sZLevel = RoofZLevel( iTempPosX_M, iTempPosY_M, sWorldY ); uiDirtyFlags=BGND_FLAG_SINGLE|BGND_FLAG_ANIMATED; // For now, adjust to hieght of a wall ( 50 temp, make define ) //if ( TileElem->fType > FOOTPRINTS ) @@ -1519,14 +1518,14 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT case TILES_DYNAMIC_ONROOF: - OnRoofZLevel( iTempPosX_M, iTempPosY_M ); + sZLevel = OnRoofZLevel( iTempPosX_M, iTempPosY_M, sWorldY, uiLevelNodeFlags ); uiDirtyFlags=BGND_FLAG_SINGLE|BGND_FLAG_ANIMATED; // Automatically adjust height! sYPos -= WALL_HEIGHT; break; case TILES_DYNAMIC_TOPMOST: - TopmostZLevel( iTempPosX_M, iTempPosY_M ); + sZLevel = TopmostZLevel( iTempPosX_M, iTempPosY_M, sWorldY ); uiDirtyFlags=BGND_FLAG_SINGLE|BGND_FLAG_ANIMATED; break; @@ -1542,14 +1541,14 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT if ( uiRowFlags == TILES_DYNAMIC_MERCS ) { // If we are multi-tiled, ignore here - if ( pSoldier->uiStatusFlags & ( SOLDIER_MULTITILE_Z | SOLDIER_Z ) ) + if ( pSoldier->flags.uiStatusFlags & ( SOLDIER_MULTITILE_Z | SOLDIER_Z ) ) { pNode = pNode->pNext; continue; } // If we are at a higher level, no not do anything unless we are at the highmerc stage - if ( pSoldier->bLevel > 0 ) + if ( pSoldier->pathing.bLevel > 0 ) { pNode = pNode->pNext; continue; @@ -1559,14 +1558,14 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT if ( uiRowFlags == TILES_DYNAMIC_HIGHMERCS ) { // If we are multi-tiled, ignore here - if ( pSoldier->uiStatusFlags & SOLDIER_MULTITILE_Z ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE_Z ) { pNode = pNode->pNext; continue; } // If we are at a lower level, no not do anything unless we are at the highmerc stage - if ( pSoldier->bLevel == 0 ) + if ( pSoldier->pathing.bLevel == 0 ) { pNode = pNode->pNext; continue; @@ -1577,22 +1576,22 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT if ( uiRowFlags == TILES_DYNAMIC_STRUCT_MERCS ) { // If we are not multi-tiled, ignore here - if ( !( pSoldier->uiStatusFlags & ( SOLDIER_MULTITILE_Z | SOLDIER_Z ) ) ) + if ( !( pSoldier->flags.uiStatusFlags & ( SOLDIER_MULTITILE_Z | SOLDIER_Z ) ) ) { // If we are at a low level, no not do anything unless we are at the merc stage - if ( pSoldier->bLevel == 0 ) + if ( pSoldier->pathing.bLevel == 0 ) { pNode = pNode->pNext; continue; } } - if ( pSoldier->uiStatusFlags & ( SOLDIER_MULTITILE_Z | SOLDIER_Z ) ) + if ( pSoldier->flags.uiStatusFlags & ( SOLDIER_MULTITILE_Z | SOLDIER_Z ) ) { fSaveZ = TRUE; fZBlitter = TRUE; - if ( pSoldier->uiStatusFlags & SOLDIER_MULTITILE_Z ) + if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE_Z ) { fMultiTransShadowZBlitter = TRUE; // ATE: Use one direction for queen! @@ -1610,7 +1609,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT fZWrite = TRUE; } } - + } // IF we are not active, or are a placeholder for multi-tile animations do nothing @@ -1622,7 +1621,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT } // Skip if we cannot see the guy! - if ( pSoldier->bLastRenderVisibleValue == -1 && !(gTacticalStatus.uiFlags&SHOW_ALL_MERCS) ) + if ( pSoldier->bLastRenderVisibleValue == -1 && !(gTacticalStatus.uiFlags&SHOW_ALL_MERCS) ) { pNode = pNode->pNext; continue; @@ -1646,8 +1645,8 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT ubShadeLevel = (pNode->ubShadeLevel&0x0f); ubShadeLevel=__max(ubShadeLevel-2, DEFAULT_SHADE_LEVEL); ubShadeLevel|=(pNode->ubShadeLevel&0x30); - - if ( pSoldier->fBeginFade ) + + if ( pSoldier->flags.fBeginFade ) { pShadeTable = pSoldier->pCurrentShade = pSoldier->pShades[ pSoldier->ubFadeLevel ]; } @@ -1678,11 +1677,11 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT sYPos -= pSoldier->sHeightAdjustment; // Handle shade stuff.... - if ( !pSoldier->fBeginFade ) + if ( !pSoldier->flags.fBeginFade ) { // Special effect - draw ghost if is seen by a guy in player's team but not current guy // ATE: Todo: setup flag for 'bad-guy' - can releive some checks in renderer - if ( !pSoldier->bNeutral && (pSoldier->bSide != gbPlayerNum ) ) + if ( !pSoldier->aiData.bNeutral && (pSoldier->bSide != gbPlayerNum ) ) { if ( gusSelectedSoldier != NOBODY ) { @@ -1702,10 +1701,10 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT { bGlowShadeOffset = 10; } - - if ( pSelSoldier != NULL ) + + if ( pSelSoldier != NULL ) { - if ( pSelSoldier->bOppList[ pSoldier->ubID ] != SEEN_CURRENTLY ) + if ( pSelSoldier->aiData.bOppList[ pSoldier->ubID ] != SEEN_CURRENTLY ) { if ( pSoldier->usAnimState != CHARIOTS_OF_FIRE && pSoldier->usAnimState != BODYEXPLODING ) { @@ -1715,7 +1714,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT } } - if ( pSoldier->bLevel == 0 ) + if ( pSoldier->pathing.bLevel == 0 ) { pShadeStart = (INT16 **) &( pSoldier->pGlowShades[ 0 ] ); } @@ -1750,7 +1749,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT if ( gTacticalStatus.ubCurrentTeam != OUR_TEAM ) { // Does he have baton? - if ( (pSoldier->uiStatusFlags & SOLDIER_UNDERAICONTROL) ) + if ( (pSoldier->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL) ) { pShadeTable = (UINT16 *) pShadeStart[ gpGlowFramePointer[ gsCurrentGlowFrame ] + bGlowShadeOffset ]; @@ -1776,7 +1775,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT // pSelSoldier = MercPtrs[ gusSelectedSoldier ]; // Shade differently depending on visiblity - // if ( pSoldier->bVisible == 0 || ( pSelSoldier->bOppList[ pSoldier->ubID ] == 0 ) ) + // if ( pSoldier->bVisible == 0 || ( pSelSoldier->aiData.bOppList[ pSoldier->ubID ] == 0 ) ) // { // Shade gray // pShadeTable = pSoldier->pGlowShades[ gpGlowFramePointer[ gsCurrentGlowFrame ] + 10 ]; @@ -1787,14 +1786,14 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT // Calculate Z level SoldierZLevel( pSoldier, iTempPosX_M, iTempPosY_M ); - + if(!(uiFlags&TILES_DIRTY)) { - if ( pSoldier->fForceShade ) + if ( pSoldier->flags.fForceShade ) { pShadeTable = pSoldier->pForcedShade; } - } + } // check if we are a merc duplicate, if so, only do minimal stuff! if ( pSoldier->ubID >= MAX_NUM_SOLDIERS ) @@ -1828,7 +1827,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT uiDirtyFlags=BGND_FLAG_SINGLE|BGND_FLAG_ANIMATED| BGND_FLAG_MERC; break; - } + } // Adjust for interface level sYPos += gsRenderHeight; @@ -1904,7 +1903,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT if ( fTileInvisible ) { - } + } else if ( uiLevelNodeFlags & LEVELNODE_DISPLAY_AP && !( uiFlags&TILES_DIRTY ) ) { pTrav = &(hVObject->pETRLEObject[usImageIndex]); @@ -1921,7 +1920,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( FONT_MCOLOR_WHITE ); } - + if ( gfUIDisplayActionPointsBlack ) { SetFontBackground( FONT_MCOLOR_BLACK ); @@ -2069,11 +2068,11 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT sXPos += pTrav->sOffsetX; sYPos += pTrav->sOffsetY; - RegisterBackgroundRect(uiDirtyFlags, NULL, sXPos, sYPos, (INT16)(sXPos + uiBrushWidth), (INT16)(__min((INT16)(sYPos + uiBrushHeight), gsVIEWPORT_WINDOW_END_Y))); + RegisterBackgroundRect(uiDirtyFlags, NULL, sXPos, sYPos, (INT16)(sXPos + uiBrushWidth), (INT16)(__min((INT16)(sYPos + uiBrushHeight), gsVIEWPORT_WINDOW_END_Y))); if ( fSaveZ ) { - RegisterBackgroundRect(uiDirtyFlags | BGND_FLAG_SAVE_Z, NULL, sXPos, sYPos, (INT16)(sXPos + uiBrushWidth), (INT16)(__min((INT16)(sYPos + uiBrushHeight), gsVIEWPORT_WINDOW_END_Y))); + RegisterBackgroundRect(uiDirtyFlags | BGND_FLAG_SAVE_Z, NULL, sXPos, sYPos, (INT16)(sXPos + uiBrushWidth), (INT16)(__min((INT16)(sYPos + uiBrushHeight), gsVIEWPORT_WINDOW_END_Y))); } } } @@ -2114,7 +2113,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT { if ( fObscuredBlitter ) { - Blt8BPPDataTo16BPPBufferTransZIncObscureClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + Blt8BPPDataTo16BPPBufferTransZIncObscureClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } else { @@ -2140,7 +2139,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect ); } } - else + else { bBlitClipVal = BltIsClippedOrOffScreen(hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); @@ -2162,39 +2161,39 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT //else Blt8BPPDataTo16BPPBufferTransZNBClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } - } + } else if(fMerc) { if ( fZBlitter ) { if ( fZWrite ) { - Blt8BPPDataTo16BPPBufferTransShadowZClip( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, + Blt8BPPDataTo16BPPBufferTransShadowZClip( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, + &gClippingRect, pShadeTable); - } + } else { if ( fObscuredBlitter ) { - Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredClip( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, + Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredClip( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, + &gClippingRect, pShadeTable); } else { - Blt8BPPDataTo16BPPBufferTransShadowZNBClip( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, + Blt8BPPDataTo16BPPBufferTransShadowZNBClip( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, + &gClippingRect, pShadeTable); } } @@ -2204,11 +2203,11 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES ); // BLIT HERE - Blt8BPPDataTo16BPPBufferTransShadowClip( (UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, + Blt8BPPDataTo16BPPBufferTransShadowClip( (UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, + hVObject, + sXPos, sYPos, + usImageIndex, + &gClippingRect, pShadeTable); UnLockVideoSurface(guiSAVEBUFFER); @@ -2220,11 +2219,11 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT } else { - Blt8BPPDataTo16BPPBufferTransShadowClip( (UINT16*)pDestBuf, uiDestPitchBYTES, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, + Blt8BPPDataTo16BPPBufferTransShadowClip( (UINT16*)pDestBuf, uiDestPitchBYTES, + hVObject, + sXPos, sYPos, + usImageIndex, + &gClippingRect, pShadeTable); } } @@ -2241,7 +2240,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT { Blt8BPPDataTo16BPPBufferShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } - } + } else if( fIntensityBlitter) { if ( fZBlitter ) @@ -2255,7 +2254,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT { Blt8BPPDataTo16BPPBufferIntensityClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } - } + } else if(fZBlitter) { if(fZWrite) @@ -2310,35 +2309,35 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT else Blt8BPPDataTo16BPPBufferTransZNBPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); } - } - else if(fMerc) + } + else if(fMerc) { if ( fZBlitter ) { if ( fZWrite ) { - Blt8BPPDataTo16BPPBufferTransShadowZ( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, + Blt8BPPDataTo16BPPBufferTransShadowZ( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, pShadeTable); } else { if ( fObscuredBlitter ) { - Blt8BPPDataTo16BPPBufferTransShadowZNBObscured( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, + Blt8BPPDataTo16BPPBufferTransShadowZNBObscured( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, pShadeTable); } else { - Blt8BPPDataTo16BPPBufferTransShadowZNB( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, + Blt8BPPDataTo16BPPBufferTransShadowZNB( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, pShadeTable); } } @@ -2349,8 +2348,8 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT // BLIT HERE Blt8BPPDataTo16BPPBufferTransShadow( (UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, - hVObject, - sXPos, sYPos, + hVObject, + sXPos, sYPos, usImageIndex, pShadeTable); @@ -2365,8 +2364,8 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT { Blt8BPPDataTo16BPPBufferTransShadow( (UINT16*)pDestBuf, uiDestPitchBYTES, - hVObject, - sXPos, sYPos, + hVObject, + sXPos, sYPos, usImageIndex, pShadeTable); } @@ -2446,16 +2445,16 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT Blt8BPPDataTo8BPPBufferTransZClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); else Blt8BPPDataTo8BPPBufferTransZNBClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } + } else if(BltIsClipped(hVObject, sXPos, sYPos, usImageIndex, &gClippingRect)) { if(fMerc) { - Blt8BPPDataTo8BPPBufferTransShadowZNBClip( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, + Blt8BPPDataTo8BPPBufferTransShadowZNBClip( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, + &gClippingRect, pShadeTable); } else if(fShadowBlitter) @@ -2463,7 +2462,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT Blt8BPPDataTo8BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); else Blt8BPPDataTo8BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - + else if(fZBlitter) { if(fZWrite) @@ -2476,20 +2475,20 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT } else { - if(fMerc) + if(fMerc) { - Blt8BPPDataTo16BPPBufferTransShadowZNBObscured( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, + Blt8BPPDataTo16BPPBufferTransShadowZNBObscured( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, pShadeTable); - // Blt8BPPDataTo8BPPBufferTransShadowZNB( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - // hVObject, - // sXPos, sYPos, - // usImageIndex, + // Blt8BPPDataTo8BPPBufferTransShadowZNB( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + // hVObject, + // sXPos, sYPos, + // usImageIndex, // pShadeTable); } else if(fShadowBlitter) @@ -2511,7 +2510,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT } } } - + // RENDR APS ONTOP OF PLANNED MERC GUY if ( fRenderTile && !( uiFlags&TILES_DIRTY ) ) { @@ -2544,20 +2543,20 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT { //ATE: Used here in the editor to denote then an area is not in the world - //Kris: Fixed a couple things here... + //Kris: Fixed a couple things here... // First, there was a problem with the FRAME_BUFFER already being locked which caused failures, // and eventual crashes, so if it reaches this code, the buffer needs to be unlocked first, as - // it gets locked and unlocked internally within ColorFillVideoSurfaceArea(). I'm surprised - // this problem didn't surface a long time ago. Anyway, it seems that scrolling to the bottom - // right hand corner of the map, would cause the end of the world to be drawn. Now, this would - // only crash on my computer and not Emmons, so this should work. Also, I changed the color - // from fluorescent green to black, which is easier on the eyes, and prevent the drawing of the + // it gets locked and unlocked internally within ColorFillVideoSurfaceArea(). I'm surprised + // this problem didn't surface a long time ago. Anyway, it seems that scrolling to the bottom + // right hand corner of the map, would cause the end of the world to be drawn. Now, this would + // only crash on my computer and not Emmons, so this should work. Also, I changed the color + // from fluorescent green to black, which is easier on the eyes, and prevent the drawing of the // end of the world if it would be drawn on the editor's taskbar. if( iTempPosY_S < INTERFACE_START_Y ) { if(!(uiFlags&TILES_DIRTY)) UnLockVideoSurface( FRAME_BUFFER ); - ColorFillVideoSurfaceArea( FRAME_BUFFER, iTempPosX_S, iTempPosY_S, (INT16)(iTempPosX_S + 40), + ColorFillVideoSurfaceArea( FRAME_BUFFER, iTempPosX_S, iTempPosY_S, (INT16)(iTempPosX_S + 40), (INT16)( min( iTempPosY_S + 20, INTERFACE_START_Y )), Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); if(!(uiFlags&TILES_DIRTY)) pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); @@ -2571,7 +2570,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT if ( iTempPosX_S >= iEndXS ) { - fEndRenderRow = TRUE; + fEndRenderRow = TRUE; } } while( !fEndRenderRow ); @@ -2687,7 +2686,7 @@ void ScrollBackground(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScroll } -} +} // Render routine takes center X, Y and Z coordinate and gets world // Coordinates for the window from that using the following functions @@ -2758,7 +2757,7 @@ UINT32 cnt = 0; gsCurrentItemGlowFrame = 0; } - } + } //RenderStaticWorldRect( gsVIEWPORT_START_X, gsVIEWPORT_START_Y, gsVIEWPORT_END_X, gsVIEWPORT_END_Y ); @@ -2804,7 +2803,7 @@ UINT32 cnt = 0; RenderMarkedWorld(); if(!(gRenderFlags&RENDER_FLAG_SAVEOFF)) UpdateSaveBuffer(); - + } if ( gfScrollInertia == FALSE || (gRenderFlags&RENDER_FLAG_NOZ ) || (gRenderFlags&RENDER_FLAG_FULL ) || (gRenderFlags&RENDER_FLAG_MARKED ) ) @@ -2819,10 +2818,10 @@ UINT32 cnt = 0; } if ( gfScrollInertia ) - { + { EmptyBackgroundRects( ); } - + if( gRenderFlags&RENDER_FLAG_ROOMIDS ) { RenderRoomInfo( gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS ); @@ -2872,7 +2871,7 @@ UINT32 cnt = 0; pDestBuf = (UINT16 *)LockVideoSurface(guiRENDERBUFFER, &uiDestPitchBYTES); for ( cnt = 0; cnt < (UINT32)( SCREEN_WIDTH * SCREEN_HEIGHT ); cnt++ ) - { + { // Get Z value zVal = gpZBuffer[ cnt ]; pDestBuf[cnt] = zVal; @@ -2912,7 +2911,7 @@ void RenderStaticWorldRect(INT16 sLeft, INT16 sTop, INT16 sRight, INT16 sBottom, uiLevelFlags[0] = TILES_STATIC_LAND; sLevelIDs [0] = RENDER_STATIC_LAND; RenderTiles( 0 , gsLStartPointX_M, gsLStartPointY_M, gsLStartPointX_S, gsLStartPointY_S, gsLEndXS, gsLEndYS, 1, uiLevelFlags, sLevelIDs ); - + //rendering objects uiLevelFlags[0] = TILES_STATIC_OBJECTS; sLevelIDs [0] = RENDER_STATIC_OBJECTS; @@ -2964,7 +2963,7 @@ void RenderStaticWorldRect(INT16 sLeft, INT16 sTop, INT16 sRight, INT16 sBottom, uiLevelFlags[6] = TILES_DYNAMIC_ROOF; uiLevelFlags[7] = TILES_DYNAMIC_HIGHMERCS; uiLevelFlags[8] = TILES_DYNAMIC_ONROOF; - + sLevelIDs[0] = RENDER_DYNAMIC_LAND; sLevelIDs[1] = RENDER_DYNAMIC_OBJECTS; sLevelIDs[2] = RENDER_DYNAMIC_SHADOWS; @@ -3011,12 +3010,12 @@ void RenderStaticWorld( ) FreeBackgroundRectType(BGND_FLAG_ANIMATED); InvalidateBackgroundRects(); - + // rendering land tiles uiLevelFlags[0] = TILES_STATIC_LAND; sLevelIDs [0] = RENDER_STATIC_LAND; RenderTiles( 0, gsLStartPointX_M, gsLStartPointY_M, gsLStartPointX_S, gsLStartPointY_S, gsLEndXS, gsLEndYS, 1, uiLevelFlags, sLevelIDs ); - + //rendering objects uiLevelFlags[0] = TILES_STATIC_OBJECTS; sLevelIDs [0] = RENDER_STATIC_OBJECTS; @@ -3052,7 +3051,7 @@ void RenderStaticWorld( ) ResetRenderParameters( ); } - + void RenderMarkedWorld(void) { UINT32 uiLevelFlags[4]; @@ -3092,15 +3091,15 @@ void RenderMarkedWorld(void) uiLevelFlags[0] = TILES_STATIC_ONROOF; sLevelIDs[0] = RENDER_STATIC_ONROOF; RenderTiles(TILES_MARKED, gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS, 1, uiLevelFlags, sLevelIDs ); - + uiLevelFlags[0] = TILES_STATIC_TOPMOST; sLevelIDs[0] = RENDER_STATIC_TOPMOST; RenderTiles(TILES_MARKED, gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS, 1, uiLevelFlags, sLevelIDs ); - + AddBaseDirtyRect(gsVIEWPORT_START_X, gsVIEWPORT_WINDOW_START_Y, gsVIEWPORT_END_X, gsVIEWPORT_WINDOW_END_Y ); - - + + ResetRenderParameters( ); } @@ -3166,7 +3165,7 @@ void RenderDynamicWorld( ) ubNumLevels = 9; } - + RenderTiles(TILES_DIRTY, gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS, ubNumLevels, uiLevelFlags, sLevelIDs ); #ifdef JA2EDITOR @@ -3177,7 +3176,7 @@ void RenderDynamicWorld( ) } SaveBackgroundRects(); - + //uiLevelFlags[0] = TILES_DYNAMIC_LAND; uiLevelFlags[0] = TILES_DYNAMIC_OBJECTS; uiLevelFlags[1] = TILES_DYNAMIC_SHADOWS; @@ -3233,9 +3232,9 @@ BOOLEAN HandleScrollDirections( UINT32 ScrollFlags, INT16 sScrollXStep, INT16 sS // This checking sequence just validates the values! if ( ScrollFlags & SCROLL_LEFT ) { - FromScreenToCellCoordinates( (INT16)-sScrollXStep, 0, &sTempX_W, &sTempY_W ); + FromScreenToCellCoordinates( (INT16)-sScrollXStep, 0, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; fMovedPos=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); if ( fMovedPos ) @@ -3254,7 +3253,7 @@ BOOLEAN HandleScrollDirections( UINT32 ScrollFlags, INT16 sScrollXStep, INT16 sS { FromScreenToCellCoordinates( sScrollXStep, 0, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; fMovedPos=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); if ( fMovedPos ) { @@ -3266,12 +3265,12 @@ BOOLEAN HandleScrollDirections( UINT32 ScrollFlags, INT16 sScrollXStep, INT16 sS ScrollBackground(SCROLL_RIGHT, sScrollXStep, sScrollYStep ); } } - + if ( ScrollFlags & SCROLL_UP ) { FromScreenToCellCoordinates( 0, (INT16)-sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; fMovedPos=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); if ( fMovedPos ) { @@ -3288,7 +3287,7 @@ BOOLEAN HandleScrollDirections( UINT32 ScrollFlags, INT16 sScrollXStep, INT16 sS { FromScreenToCellCoordinates( 0, sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; fMovedPos=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); if ( fMovedPos ) { @@ -3307,21 +3306,21 @@ BOOLEAN HandleScrollDirections( UINT32 ScrollFlags, INT16 sScrollXStep, INT16 sS // Check up FromScreenToCellCoordinates( 0, (INT16)-sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; fUpOK=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); // Check left - FromScreenToCellCoordinates( (INT16)-sScrollXStep, 0, &sTempX_W, &sTempY_W ); + FromScreenToCellCoordinates( (INT16)-sScrollXStep, 0, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; fLeftOK=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); if ( fLeftOK && fUpOK ) { - FromScreenToCellCoordinates( (INT16)-sScrollXStep, (INT16)-sScrollYStep, &sTempX_W, &sTempY_W ); + FromScreenToCellCoordinates( (INT16)-sScrollXStep, (INT16)-sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; fAGoodMove = TRUE; if ( !fCheckOnly ) @@ -3336,7 +3335,7 @@ BOOLEAN HandleScrollDirections( UINT32 ScrollFlags, INT16 sScrollXStep, INT16 sS FromScreenToCellCoordinates( 0, (INT16)-sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; if ( !fCheckOnly ) { @@ -3348,9 +3347,9 @@ BOOLEAN HandleScrollDirections( UINT32 ScrollFlags, INT16 sScrollXStep, INT16 sS { fAGoodMove = TRUE; - FromScreenToCellCoordinates( (INT16)-sScrollXStep, 0, &sTempX_W, &sTempY_W ); + FromScreenToCellCoordinates( (INT16)-sScrollXStep, 0, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; if ( !fCheckOnly ) { @@ -3365,20 +3364,20 @@ BOOLEAN HandleScrollDirections( UINT32 ScrollFlags, INT16 sScrollXStep, INT16 sS // Check up FromScreenToCellCoordinates( 0, (INT16)-sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; fUpOK=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); - + // Check right FromScreenToCellCoordinates( sScrollXStep, 0, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; fRightOK=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); if ( fUpOK && fRightOK ) { - FromScreenToCellCoordinates( (INT16)sScrollXStep, (INT16)-sScrollYStep, &sTempX_W, &sTempY_W ); + FromScreenToCellCoordinates( (INT16)sScrollXStep, (INT16)-sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; fAGoodMove = TRUE; if ( !fCheckOnly ) @@ -3393,7 +3392,7 @@ BOOLEAN HandleScrollDirections( UINT32 ScrollFlags, INT16 sScrollXStep, INT16 sS FromScreenToCellCoordinates( 0, (INT16)-sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; if ( !fCheckOnly ) { @@ -3406,7 +3405,7 @@ BOOLEAN HandleScrollDirections( UINT32 ScrollFlags, INT16 sScrollXStep, INT16 sS FromScreenToCellCoordinates( sScrollXStep, 0, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; if ( !fCheckOnly ) { @@ -3420,21 +3419,21 @@ BOOLEAN HandleScrollDirections( UINT32 ScrollFlags, INT16 sScrollXStep, INT16 sS // Check down...... FromScreenToCellCoordinates( 0, sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; fDownOK=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); // Check left..... - FromScreenToCellCoordinates( (INT16)-sScrollXStep, 0, &sTempX_W, &sTempY_W ); + FromScreenToCellCoordinates( (INT16)-sScrollXStep, 0, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; fLeftOK=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); if ( fLeftOK && fDownOK ) { fAGoodMove = TRUE; - FromScreenToCellCoordinates( (INT16)-sScrollXStep, (INT16)sScrollYStep, &sTempX_W, &sTempY_W ); + FromScreenToCellCoordinates( (INT16)-sScrollXStep, (INT16)sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; if ( !fCheckOnly ) { @@ -3444,9 +3443,9 @@ BOOLEAN HandleScrollDirections( UINT32 ScrollFlags, INT16 sScrollXStep, INT16 sS } else if ( fLeftOK ) { - FromScreenToCellCoordinates( (INT16)-sScrollXStep, 0, &sTempX_W, &sTempY_W ); + FromScreenToCellCoordinates( (INT16)-sScrollXStep, 0, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; fAGoodMove = TRUE; if ( !fCheckOnly ) @@ -3458,7 +3457,7 @@ BOOLEAN HandleScrollDirections( UINT32 ScrollFlags, INT16 sScrollXStep, INT16 sS { FromScreenToCellCoordinates( 0, sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; fAGoodMove = TRUE; if ( !fCheckOnly ) @@ -3473,20 +3472,20 @@ BOOLEAN HandleScrollDirections( UINT32 ScrollFlags, INT16 sScrollXStep, INT16 sS // Check right FromScreenToCellCoordinates( sScrollXStep, 0, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; fRightOK=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); // Check down FromScreenToCellCoordinates( 0, sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; fDownOK=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); if ( fDownOK && fRightOK ) { - FromScreenToCellCoordinates( (INT16)sScrollXStep, (INT16)sScrollYStep, &sTempX_W, &sTempY_W ); + FromScreenToCellCoordinates( (INT16)sScrollXStep, (INT16)sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; fAGoodMove = TRUE; if ( !fCheckOnly ) @@ -3499,7 +3498,7 @@ BOOLEAN HandleScrollDirections( UINT32 ScrollFlags, INT16 sScrollXStep, INT16 sS { FromScreenToCellCoordinates( 0, sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; fAGoodMove = TRUE; if ( !fCheckOnly ) @@ -3511,7 +3510,7 @@ BOOLEAN HandleScrollDirections( UINT32 ScrollFlags, INT16 sScrollXStep, INT16 sS { FromScreenToCellCoordinates( sScrollXStep, 0, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; - sTempRenderCenterY = gsRenderCenterY + sTempY_W; + sTempRenderCenterY = gsRenderCenterY + sTempY_W; fAGoodMove = TRUE; if ( !fCheckOnly ) @@ -3534,7 +3533,7 @@ extern BOOLEAN gfNextRefreshFullScreen; void ScrollWorld( ) { UINT32 ScrollFlags = 0; - BOOLEAN fDoScroll = FALSE, fMovedPos=FALSE, fAGoodMove = FALSE; + BOOLEAN fDoScroll = FALSE, fAGoodMove = FALSE; INT16 sTempRenderCenterX, sTempRenderCenterY; INT8 bDirection; INT16 sScrollXStep=-1; @@ -3596,7 +3595,7 @@ void ScrollWorld( ) ScrollFlags = 0; fDoScroll = FALSE; - // + // if ( SoldierLocationRelativeToScreen( gTacticalStatus.sSlideTarget, gTacticalStatus.sSlideReason, &bDirection, &ScrollFlags ) && GridNoOnVisibleWorldTile( gTacticalStatus.sSlideTarget ) ) { ScrollFlags = gScrollDirectionFlags[ bDirection ]; @@ -3628,7 +3627,7 @@ void ScrollWorld( ) fDoScroll = TRUE; ScrollFlags |= SCROLL_UP; } - + if ( _KeyDown( DNARROW ) ) { @@ -3650,7 +3649,7 @@ void ScrollWorld( ) ScrollFlags |= SCROLL_LEFT; } - + // Do mouse - PUT INTO A TIMER! // Put a counter on starting from mouse, if we have not started already! if ( !gfScrollInertia && gfScrollPending == FALSE ) @@ -3668,7 +3667,7 @@ void ScrollWorld( ) fDoScroll = TRUE; ScrollFlags |= SCROLL_UP; } - + if ( gusMouseYPos >= SCREEN_HEIGHT - 1 ) { @@ -3747,7 +3746,7 @@ void ScrollWorld( ) } fAGoodMove = HandleScrollDirections( ScrollFlags, sScrollXStep, sScrollYStep, &sTempRenderCenterX, &sTempRenderCenterY, TRUE ); - } + } // Has this been an OK scroll? if ( fAGoodMove ) @@ -3765,7 +3764,7 @@ void ScrollWorld( ) // Remove any interface stuff ClearInterface( ); - // Return so that next frame things will be erased! + // Return so that next frame things will be erased! return; } @@ -3780,7 +3779,7 @@ void ScrollWorld( ) HandleScrollDirections( ScrollFlags, sScrollXStep, sScrollYStep, &sTempRenderCenterX, &sTempRenderCenterY, FALSE ); if( gfNextRefreshFullScreen ) SetRenderFlags( RENDER_FLAG_FULL ); - } + } } else { @@ -3813,9 +3812,9 @@ void ScrollWorld( ) gfScrollInertia = FALSE; gfScrollPending = FALSE; - + if ( gfDoSubtileScroll ) - { + { gubCurScrollSpeedID = gubScrollSpeedStartID; } @@ -3830,13 +3829,13 @@ void ScrollWorld( ) void InitializeViewPort() { - gsVIEWPORT_START_X = 0; + gsVIEWPORT_START_X = 0; gsVIEWPORT_START_Y = 0; gsVIEWPORT_WINDOW_START_Y = 0; gsVIEWPORT_WINDOW_END_Y = INTERFACE_START_Y; gsVIEWPORT_END_X = SCREEN_WIDTH; gsVIEWPORT_END_Y = INTERFACE_START_Y; - + gClippingRect.iLeft = 0; gClippingRect.iTop = 0; gClippingRect.iRight = SCREEN_WIDTH; @@ -3853,32 +3852,32 @@ void InitRenderParams( UINT8 ubRestrictionID ) { case 0: //Default! - gTopLeftWorldLimitX = CELL_X_SIZE; - gTopLeftWorldLimitY = ( WORLD_ROWS / 2 ) * CELL_X_SIZE; + gTopLeftWorldLimitX = CELL_X_SIZE; + gTopLeftWorldLimitY = ( WORLD_ROWS / 2 ) * CELL_X_SIZE; - gTopRightWorldLimitX = ( WORLD_COLS / 2 ) * CELL_Y_SIZE; - gTopRightWorldLimitY = CELL_X_SIZE; - - gBottomLeftWorldLimitX = ( ( WORLD_COLS / 2 ) * CELL_Y_SIZE ); - gBottomLeftWorldLimitY = ( WORLD_ROWS * CELL_Y_SIZE ); + gTopRightWorldLimitX = ( WORLD_COLS / 2 ) * CELL_Y_SIZE; + gTopRightWorldLimitY = CELL_X_SIZE; - gBottomRightWorldLimitX = ( WORLD_COLS * CELL_Y_SIZE ); - gBottomRightWorldLimitY = ( ( WORLD_ROWS / 2 ) * CELL_X_SIZE ); + gBottomLeftWorldLimitX = ( ( WORLD_COLS / 2 ) * CELL_Y_SIZE ); + gBottomLeftWorldLimitY = ( WORLD_ROWS * CELL_Y_SIZE ); + + gBottomRightWorldLimitX = ( WORLD_COLS * CELL_Y_SIZE ); + gBottomRightWorldLimitY = ( ( WORLD_ROWS / 2 ) * CELL_X_SIZE ); break; case 1: // BAEMENT LEVEL 1 - gTopLeftWorldLimitX = ( 3 * WORLD_ROWS / 10 ) * CELL_X_SIZE; - gTopLeftWorldLimitY = ( WORLD_ROWS / 2 ) * CELL_X_SIZE; + gTopLeftWorldLimitX = ( 3 * WORLD_ROWS / 10 ) * CELL_X_SIZE; + gTopLeftWorldLimitY = ( WORLD_ROWS / 2 ) * CELL_X_SIZE; - gTopRightWorldLimitX = ( WORLD_ROWS / 2 ) * CELL_X_SIZE; - gTopRightWorldLimitY = ( 3 * WORLD_COLS / 10 ) * CELL_X_SIZE; - - gBottomLeftWorldLimitX = ( WORLD_ROWS / 2 ) * CELL_X_SIZE; + gTopRightWorldLimitX = ( WORLD_ROWS / 2 ) * CELL_X_SIZE; + gTopRightWorldLimitY = ( 3 * WORLD_COLS / 10 ) * CELL_X_SIZE; + + gBottomLeftWorldLimitX = ( WORLD_ROWS / 2 ) * CELL_X_SIZE; gBottomLeftWorldLimitY = ( 7 * WORLD_COLS / 10 ) * CELL_X_SIZE; - gBottomRightWorldLimitX = ( 7 * WORLD_ROWS / 10 ) * CELL_X_SIZE; - gBottomRightWorldLimitY = ( WORLD_ROWS / 2 ) * CELL_X_SIZE; + gBottomRightWorldLimitX = ( 7 * WORLD_ROWS / 10 ) * CELL_X_SIZE; + gBottomRightWorldLimitY = ( WORLD_ROWS / 2 ) * CELL_X_SIZE; break; } @@ -3901,8 +3900,8 @@ void InitRenderParams( UINT8 ubRestrictionID ) // Take these spaning distances and determine # tiles spaning gsTilesX = ( gsTRX - gsTLX ) / WORLD_TILE_X; gsTilesY = ( gsBRY - gsTRY ) / WORLD_TILE_Y; - - DebugMsg(TOPIC_JA2, DBG_LEVEL_0, String("World Screen Width %d Height %d", ( gsTRX - gsTLX ), ( gsBRY - gsTRY ))); + + DebugMsg(TOPIC_JA2, DBG_LEVEL_0, String("World Screen Width %d Height %d", ( gsTRX - gsTLX ), ( gsBRY - gsTRY ))); // Determine scale factors @@ -3929,7 +3928,7 @@ void InitRenderParams( UINT8 ubRestrictionID ) // NOW GET DISTANCE SPANNING WORLD LIMITS IN WORLD COORDS //FromScreenToCellCoordinates( ( gTopRightWorldLimitX - gTopLeftWorldLimitX ), ( gTopRightWorldLimitY - gTopLeftWorldLimitY ), &gsWorldSpanX, &gsWorldSpanY ); - + // CALCULATE 16BPP COLORS FOR ITEMS } @@ -3969,6 +3968,8 @@ BOOLEAN ApplyScrolling( INT16 sTempRenderCenterX, INT16 sTempRenderCenterY, BOOL INT16 sRadarBRX, sRadarBRY; INT16 sRadarCX, sRadarCY; INT16 sHeight, sWidth, sX, sY; + // CHRISL: + INT16 gsRadarX; INT16 gsRadarY; BOOLEAN fAllowScrollingHorizontal = FALSE; BOOLEAN fAllowScrollingVertical = FALSE; @@ -3982,18 +3983,18 @@ BOOLEAN ApplyScrolling( INT16 sTempRenderCenterX, INT16 sTempRenderCenterY, BOOL sMult = sTempRenderCenterY / CELL_Y_SIZE; sTempRenderCenterY = ( sMult * CELL_Y_SIZE ) + ( CELL_Y_SIZE / 2 ); - + // Find the diustance from render center to true world center sDistToCenterX = sTempRenderCenterX - gCenterWorldX; sDistToCenterY = sTempRenderCenterY - gCenterWorldY; - + // From render center in world coords, convert to render center in "screen" coords FromCellToScreenCoordinates( sDistToCenterX , sDistToCenterY, &sScreenCenterX, &sScreenCenterY ); // Subtract screen center sScreenCenterX += gsCX; sScreenCenterY += gsCY; - + // Adjust for offset position on screen sScreenCenterX -= 0; sScreenCenterY -= 10; @@ -4009,7 +4010,7 @@ BOOLEAN ApplyScrolling( INT16 sTempRenderCenterX, INT16 sTempRenderCenterY, BOOL sTopRightWorldX = sScreenCenterX + sX_S; sTopRightWorldY = sScreenCenterY - sY_S; - + sBottomLeftWorldX = sScreenCenterX - sX_S; sBottomLeftWorldY = sScreenCenterY + sY_S; @@ -4024,26 +4025,29 @@ BOOLEAN ApplyScrolling( INT16 sTempRenderCenterX, INT16 sTempRenderCenterY, BOOL if( guiCurrentScreen == MAP_SCREEN ) { + gsRadarX = RADAR_WINDOW_STRAT_X; gsRadarY = RADAR_WINDOW_STRAT_Y; } else if ( gsCurInterfacePanel == SM_PANEL ) { - gsRadarY = RADAR_WINDOW_TM_Y; + gsRadarX = RADAR_WINDOW_SM_X; + gsRadarY = RADAR_WINDOW_SM_Y; } else { + gsRadarX = RADAR_WINDOW_TM_X; gsRadarY = RADAR_WINDOW_TM_Y; } sWidth = ( RADAR_WINDOW_WIDTH ); sHeight = ( RADAR_WINDOW_HEIGHT ); - sX = RADAR_WINDOW_X; + sX = gsRadarX; sY = gsRadarY; sRadarTLX = (INT16)( ( sTopLeftWorldX * gdScaleX ) - sRadarCX + sX + ( sWidth /2 ) ); - sRadarTLY = (INT16)( ( sTopLeftWorldY * gdScaleY ) - sRadarCY + gsRadarY + ( sHeight /2 ) ); + sRadarTLY = (INT16)( ( sTopLeftWorldY * gdScaleY ) - sRadarCY + gsRadarY + ( sHeight /2 ) ); sRadarBRX = (INT16)( ( sBottomRightWorldX * gdScaleX ) - sRadarCX + sX + ( sWidth /2 ) ); sRadarBRY = (INT16)( ( sBottomRightWorldY * gdScaleY ) - sRadarCY + gsRadarY + ( sHeight /2 ) ); @@ -4074,7 +4078,7 @@ BOOLEAN ApplyScrolling( INT16 sTempRenderCenterX, INT16 sTempRenderCenterY, BOOL dAdj = sTopLeftWorldX - gsTLX; dAngle = (double)atan2( dAdj, dOpp ); - at1 = dAngle * 180 / PI; + at1 = dAngle * 180 / PI; if ( dAngle < 0 ) { @@ -4090,7 +4094,7 @@ BOOLEAN ApplyScrolling( INT16 sTempRenderCenterX, INT16 sTempRenderCenterY, BOOL dAdj = gsTRX - sTopRightWorldX; dAngle = (double)atan2( dAdj, dOpp ); - at2 = dAngle * 180 / PI; + at2 = dAngle * 180 / PI; if ( dAngle < 0 ) { @@ -4107,7 +4111,7 @@ BOOLEAN ApplyScrolling( INT16 sTempRenderCenterX, INT16 sTempRenderCenterY, BOOL dAdj = sBottomLeftWorldX - gsBLX; dAngle = (double)atan2( dAdj, dOpp ); - at3 = dAngle * 180 / PI; + at3 = dAngle * 180 / PI; if ( dAngle < 0 ) { @@ -4123,7 +4127,7 @@ BOOLEAN ApplyScrolling( INT16 sTempRenderCenterX, INT16 sTempRenderCenterY, BOOL dAdj = gsBRX - sBottomRightWorldX; dAngle = (double)atan2( dAdj, dOpp ); - at4 = dAngle * 180 / PI; + at4 = dAngle * 180 / PI; if ( dAngle < 0 ) { @@ -4181,7 +4185,7 @@ BOOLEAN ApplyScrolling( INT16 sTempRenderCenterX, INT16 sTempRenderCenterY, BOOL sTempRenderCenterY = sTempPosY_W; fScrollGood = TRUE; } - + if ( fOutLeft ) { CorrectRenderCenter( (INT16)( gsTLX + sX_S ) , sScreenCenterY , &sNewScreenX, &sNewScreenY ); @@ -4265,12 +4269,12 @@ BOOLEAN ApplyScrolling( INT16 sTempRenderCenterX, INT16 sTempRenderCenterY, BOOL //gsRenderCenterX = sTempRenderCenterX; //gsRenderCenterY = sTempRenderCenterY; - + gsTopLeftWorldX = sTopLeftWorldX - gsTLX; gsTopRightWorldX = sTopRightWorldX - gsTLX; gsBottomLeftWorldX = sBottomLeftWorldX - gsTLX; gsBottomRightWorldX = sBottomRightWorldX - gsTLX; - + gsTopLeftWorldY = sTopLeftWorldY - gsTLY; gsTopRightWorldY = sTopRightWorldY - gsTLY; gsBottomLeftWorldY = sBottomLeftWorldY - gsTLY; @@ -4322,7 +4326,7 @@ void InvalidateWorldRedundencyRadius(INT16 sX, INT16 sY, INT16 sRadius) void InvalidateWorldRedundency( ) { UINT32 uiCount; - + SetRenderFlags( RENDER_FLAG_CHECKZ ); for(uiCount=0; uiCount < WORLD_MAX; uiCount++) @@ -4390,19 +4394,19 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZIncClip( UINT16 *pBuffer, UINT32 uiDestPit RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - + // calculate the remaining rows and columns to blit BlitLength=((INT32)usWidth-LeftSkip-RightSkip); BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) + if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) return(TRUE); // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) + if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) return(TRUE); - + SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); @@ -4411,27 +4415,27 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZIncClip( UINT16 *pBuffer, UINT32 uiDestPit if(hSrcVObject->ppZStripInfo==NULL) { - DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); + DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); return(FALSE); } // setup for the z-column blitting stuff pZInfo=hSrcVObject->ppZStripInfo[usIndex]; if(pZInfo==NULL) { - DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); + DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); return(FALSE); } usZStartLevel=(UINT16)((INT16)usZValue+((INT16)pZInfo->bInitialZChange*Z_STRIP_DELTA_Y)); // set to odd number of pixels for first column - + if(LeftSkip > pZInfo->ubFirstZStripWidth) { usZStartCols=(LeftSkip - pZInfo->ubFirstZStripWidth); usZStartCols=20-(usZStartCols%20); } else if(LeftSkip < pZInfo->ubFirstZStripWidth) - usZStartCols=(UINT16)(pZInfo->ubFirstZStripWidth - LeftSkip); + usZStartCols=(UINT16)(pZInfo->ubFirstZStripWidth - LeftSkip); else usZStartCols=20; @@ -4481,8 +4485,8 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZIncClip( UINT16 *pBuffer, UINT32 uiDestPit // Skips the number of lines clipped at the top -TopSkipLoop: - +TopSkipLoop: + mov cl, [esi] inc esi or cl, cl @@ -4501,11 +4505,11 @@ TSEndLine: // Skips the pixels hanging outside the left-side boundry LeftSkipSetup: - + mov Unblitted, 0 // Unblitted counts any pixels left from a run mov eax, LeftSkip // after we have skipped enough left-side pixels mov LSCount, eax // LSCount counts how many pixels skipped so far - or eax, eax + or eax, eax jz BlitLineSetup // check for nothing to skip LeftSkipLoop: @@ -4526,7 +4530,7 @@ LeftSkipLoop: mov LSCount, eax mov Unblitted, 0 jmp BlitNTL1 // *** jumps into non-transparent blit loop - + LSSkip2: add esi, ecx // skip whole run, and start blit with new run jmp BlitLineSetup @@ -4549,7 +4553,7 @@ LSTrans: mov LSCount, eax mov Unblitted, 0 jmp BlitTransparent // *** jumps into transparent blit loop - + LSTrans1: sub LSCount, ecx // skip whole run, continue skipping @@ -4558,7 +4562,7 @@ LSTrans1: //------------------------------------------------- // setup for beginning of line -BlitLineSetup: +BlitLineSetup: mov eax, BlitLength mov LSCount, eax mov Unblitted, 0 @@ -4573,7 +4577,7 @@ BlitDispatch: or cl, cl js BlitTransparent jz RSLoop2 - + //-------------------------------- // blitting non-transparent pixels @@ -4602,7 +4606,7 @@ BlitNTL2: // update the z-level according to the z-table - push edx + push edx mov edx, pZArray // get pointer to array xor eax, eax mov ax, usZIndex // pick up the current array index @@ -4631,10 +4635,10 @@ BlitNTL5: BlitNTL6: dec LSCount // decrement pixel length to blit jz RightSkipLoop // done blitting the visible line - + dec ecx jnz BlitNTL1 // continue current run - + jmp BlitDispatch // done current run, go for another @@ -4649,13 +4653,13 @@ BlitTrans2: add edi, 2 // move up the destination pointer add ebx, 2 - + dec usZColsToGo jnz BlitTrans1 // update the z-level according to the z-table - push edx + push edx mov edx, pZArray // get pointer to array xor eax, eax mov ax, usZIndex // pick up the current array index @@ -4683,7 +4687,7 @@ BlitTrans5: BlitTrans1: - dec LSCount // decrement the pixels to blit + dec LSCount // decrement the pixels to blit jz RightSkipLoop // done the line dec ecx @@ -4694,12 +4698,12 @@ BlitTrans1: //--------------------------------------------- // Scans the ETRLE until it finds an EOL marker -RightSkipLoop: - - +RightSkipLoop: + + RSLoop1: mov al, [esi] - inc esi + inc esi or al, al jnz RSLoop1 @@ -4719,15 +4723,15 @@ RSLoop2: mov ax, usZStartCols mov usZColsToGo, ax - + jmp LeftSkipSetup - + BlitDone: } return(TRUE); -} +} /********************************************************************************************** @@ -4788,19 +4792,19 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZIncClipZSameZBurnsThrough( UINT16 *pBuffer RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - + // calculate the remaining rows and columns to blit BlitLength=((INT32)usWidth-LeftSkip-RightSkip); BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) + if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) return(TRUE); // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) + if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) return(TRUE); - + SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); @@ -4809,27 +4813,27 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZIncClipZSameZBurnsThrough( UINT16 *pBuffer if(hSrcVObject->ppZStripInfo==NULL) { - DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); + DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); return(FALSE); } // setup for the z-column blitting stuff pZInfo=hSrcVObject->ppZStripInfo[ usZStripIndex ]; if(pZInfo==NULL) { - DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); + DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); return(FALSE); } usZStartLevel=(UINT16)((INT16)usZValue+((INT16)pZInfo->bInitialZChange*Z_STRIP_DELTA_Y)); // set to odd number of pixels for first column - + if(LeftSkip > pZInfo->ubFirstZStripWidth) { usZStartCols=(LeftSkip - pZInfo->ubFirstZStripWidth); usZStartCols=20-(usZStartCols%20); } else if(LeftSkip < pZInfo->ubFirstZStripWidth) - usZStartCols=(UINT16)(pZInfo->ubFirstZStripWidth - LeftSkip); + usZStartCols=(UINT16)(pZInfo->ubFirstZStripWidth - LeftSkip); else usZStartCols=20; @@ -4879,8 +4883,8 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZIncClipZSameZBurnsThrough( UINT16 *pBuffer // Skips the number of lines clipped at the top -TopSkipLoop: - +TopSkipLoop: + mov cl, [esi] inc esi or cl, cl @@ -4899,11 +4903,11 @@ TSEndLine: // Skips the pixels hanging outside the left-side boundry LeftSkipSetup: - + mov Unblitted, 0 // Unblitted counts any pixels left from a run mov eax, LeftSkip // after we have skipped enough left-side pixels mov LSCount, eax // LSCount counts how many pixels skipped so far - or eax, eax + or eax, eax jz BlitLineSetup // check for nothing to skip LeftSkipLoop: @@ -4924,7 +4928,7 @@ LeftSkipLoop: mov LSCount, eax mov Unblitted, 0 jmp BlitNTL1 // *** jumps into non-transparent blit loop - + LSSkip2: add esi, ecx // skip whole run, and start blit with new run jmp BlitLineSetup @@ -4947,7 +4951,7 @@ LSTrans: mov LSCount, eax mov Unblitted, 0 jmp BlitTransparent // *** jumps into transparent blit loop - + LSTrans1: sub LSCount, ecx // skip whole run, continue skipping @@ -4956,7 +4960,7 @@ LSTrans1: //------------------------------------------------- // setup for beginning of line -BlitLineSetup: +BlitLineSetup: mov eax, BlitLength mov LSCount, eax mov Unblitted, 0 @@ -4971,7 +4975,7 @@ BlitDispatch: or cl, cl js BlitTransparent jz RSLoop2 - + //-------------------------------- // blitting non-transparent pixels @@ -5000,7 +5004,7 @@ BlitNTL2: // update the z-level according to the z-table - push edx + push edx mov edx, pZArray // get pointer to array xor eax, eax mov ax, usZIndex // pick up the current array index @@ -5029,10 +5033,10 @@ BlitNTL5: BlitNTL6: dec LSCount // decrement pixel length to blit jz RightSkipLoop // done blitting the visible line - + dec ecx jnz BlitNTL1 // continue current run - + jmp BlitDispatch // done current run, go for another @@ -5047,13 +5051,13 @@ BlitTrans2: add edi, 2 // move up the destination pointer add ebx, 2 - + dec usZColsToGo jnz BlitTrans1 // update the z-level according to the z-table - push edx + push edx mov edx, pZArray // get pointer to array xor eax, eax mov ax, usZIndex // pick up the current array index @@ -5081,7 +5085,7 @@ BlitTrans5: BlitTrans1: - dec LSCount // decrement the pixels to blit + dec LSCount // decrement the pixels to blit jz RightSkipLoop // done the line dec ecx @@ -5092,12 +5096,12 @@ BlitTrans1: //--------------------------------------------- // Scans the ETRLE until it finds an EOL marker -RightSkipLoop: - - +RightSkipLoop: + + RSLoop1: mov al, [esi] - inc esi + inc esi or al, al jnz RSLoop1 @@ -5117,15 +5121,15 @@ RSLoop2: mov ax, usZStartCols mov usZColsToGo, ax - + jmp LeftSkipSetup - + BlitDone: } return(TRUE); -} +} /********************************************************************************************** @@ -5190,7 +5194,7 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZIncObscureClip( UINT16 *pBuffer, UINT32 ui RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - + uiLineFlag=(iTempY&1); // calculate the remaining rows and columns to blit @@ -5198,13 +5202,13 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZIncObscureClip( UINT16 *pBuffer, UINT32 ui BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) + if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) return(TRUE); // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) + if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) return(TRUE); - + SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); @@ -5213,27 +5217,27 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZIncObscureClip( UINT16 *pBuffer, UINT32 ui if(hSrcVObject->ppZStripInfo==NULL) { - DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); + DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); return(FALSE); } // setup for the z-column blitting stuff pZInfo=hSrcVObject->ppZStripInfo[usIndex]; if(pZInfo==NULL) { - DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); + DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); return(FALSE); } usZStartLevel=(UINT16)((INT16)usZValue+((INT16)pZInfo->bInitialZChange*Z_STRIP_DELTA_Y)); // set to odd number of pixels for first column - + if(LeftSkip > pZInfo->ubFirstZStripWidth) { usZStartCols=(LeftSkip - pZInfo->ubFirstZStripWidth); usZStartCols=20-(usZStartCols%20); } else if(LeftSkip < pZInfo->ubFirstZStripWidth) - usZStartCols=(UINT16)(pZInfo->ubFirstZStripWidth - LeftSkip); + usZStartCols=(UINT16)(pZInfo->ubFirstZStripWidth - LeftSkip); else usZStartCols=20; @@ -5283,8 +5287,8 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZIncObscureClip( UINT16 *pBuffer, UINT32 ui // Skips the number of lines clipped at the top -TopSkipLoop: - +TopSkipLoop: + mov cl, [esi] inc esi or cl, cl @@ -5305,11 +5309,11 @@ TSEndLine: // Skips the pixels hanging outside the left-side boundry LeftSkipSetup: - + mov Unblitted, 0 // Unblitted counts any pixels left from a run mov eax, LeftSkip // after we have skipped enough left-side pixels mov LSCount, eax // LSCount counts how many pixels skipped so far - or eax, eax + or eax, eax jz BlitLineSetup // check for nothing to skip LeftSkipLoop: @@ -5330,7 +5334,7 @@ LeftSkipLoop: mov LSCount, eax mov Unblitted, 0 jmp BlitNTL1 // *** jumps into non-transparent blit loop - + LSSkip2: add esi, ecx // skip whole run, and start blit with new run jmp BlitLineSetup @@ -5353,7 +5357,7 @@ LSTrans: mov LSCount, eax mov Unblitted, 0 jmp BlitTransparent // *** jumps into transparent blit loop - + LSTrans1: sub LSCount, ecx // skip whole run, continue skipping @@ -5362,7 +5366,7 @@ LSTrans1: //------------------------------------------------- // setup for beginning of line -BlitLineSetup: +BlitLineSetup: mov eax, BlitLength mov LSCount, eax mov Unblitted, 0 @@ -5377,7 +5381,7 @@ BlitDispatch: or cl, cl js BlitTransparent jz RSLoop2 - + //-------------------------------- // blitting non-transparent pixels @@ -5402,7 +5406,7 @@ BlitPixellate1: BlitSkip1: test edi, 2 jnz BlitNTL2 - + BlitPixel1: mov ax, usZLevel // update z-level of pixel @@ -5423,7 +5427,7 @@ BlitNTL2: // update the z-level according to the z-table - push edx + push edx mov edx, pZArray // get pointer to array xor eax, eax mov ax, usZIndex // pick up the current array index @@ -5452,10 +5456,10 @@ BlitNTL5: BlitNTL6: dec LSCount // decrement pixel length to blit jz RightSkipLoop // done blitting the visible line - + dec ecx jnz BlitNTL1 // continue current run - + jmp BlitDispatch // done current run, go for another @@ -5470,13 +5474,13 @@ BlitTrans2: add edi, 2 // move up the destination pointer add ebx, 2 - + dec usZColsToGo jnz BlitTrans1 // update the z-level according to the z-table - push edx + push edx mov edx, pZArray // get pointer to array xor eax, eax mov ax, usZIndex // pick up the current array index @@ -5504,7 +5508,7 @@ BlitTrans5: BlitTrans1: - dec LSCount // decrement the pixels to blit + dec LSCount // decrement the pixels to blit jz RightSkipLoop // done the line dec ecx @@ -5515,12 +5519,12 @@ BlitTrans1: //--------------------------------------------- // Scans the ETRLE until it finds an EOL marker -RightSkipLoop: - - +RightSkipLoop: + + RSLoop1: mov al, [esi] - inc esi + inc esi or al, al jnz RSLoop1 @@ -5541,15 +5545,15 @@ RSLoop2: mov ax, usZStartCols mov usZColsToGo, ax - + jmp LeftSkipSetup - + BlitDone: } return(TRUE); -} +} // Blitter Specs @@ -5605,7 +5609,7 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClip( UINT16 *pBuffer RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - + uiLineFlag=(iTempY&1); // calculate the remaining rows and columns to blit @@ -5613,13 +5617,13 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClip( UINT16 *pBuffer BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) + if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) return(TRUE); // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) + if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) return(TRUE); - + SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); @@ -5627,14 +5631,14 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClip( UINT16 *pBuffer if(hSrcVObject->ppZStripInfo==NULL) { - DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); + DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); return(FALSE); } // setup for the z-column blitting stuff pZInfo=hSrcVObject->ppZStripInfo[sZIndex]; if(pZInfo==NULL) { - DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); + DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); return(FALSE); } @@ -5646,7 +5650,7 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClip( UINT16 *pBuffer usZStartCols=20-(usZStartCols%20); } else if(LeftSkip < pZInfo->ubFirstZStripWidth) - usZStartCols=(UINT16)(pZInfo->ubFirstZStripWidth - LeftSkip); + usZStartCols=(UINT16)(pZInfo->ubFirstZStripWidth - LeftSkip); else usZStartCols=20; @@ -5697,8 +5701,8 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClip( UINT16 *pBuffer // Skips the number of lines clipped at the top -TopSkipLoop: - +TopSkipLoop: + mov cl, [esi] inc esi or cl, cl @@ -5719,11 +5723,11 @@ TSEndLine: // Skips the pixels hanging outside the left-side boundry LeftSkipSetup: - + mov Unblitted, 0 // Unblitted counts any pixels left from a run mov eax, LeftSkip // after we have skipped enough left-side pixels mov LSCount, eax // LSCount counts how many pixels skipped so far - or eax, eax + or eax, eax jz BlitLineSetup // check for nothing to skip LeftSkipLoop: @@ -5744,7 +5748,7 @@ LeftSkipLoop: mov LSCount, eax mov Unblitted, 0 jmp BlitNTL1 // *** jumps into non-transparent blit loop - + LSSkip2: add esi, ecx // skip whole run, and start blit with new run jmp BlitLineSetup @@ -5768,7 +5772,7 @@ LSTrans: mov Unblitted, 0 jmp BlitTransparent // *** jumps into transparent blit loop - + LSTrans1: sub LSCount, ecx // skip whole run, continue skipping @@ -5777,7 +5781,7 @@ LSTrans1: //------------------------------------------------- // setup for beginning of line -BlitLineSetup: +BlitLineSetup: mov eax, BlitLength mov LSCount, eax mov Unblitted, 0 @@ -5792,7 +5796,7 @@ BlitDispatch: or cl, cl js BlitTransparent jz RSLoop2 - + //-------------------------------- // blitting non-transparent pixels @@ -5817,7 +5821,7 @@ BlitPixellate1: BlitSkip1: test edi, 2 jnz BlitNTL2 - + BlitPixel1: mov ax, usZLevel // update z-level of pixel @@ -5849,7 +5853,7 @@ BlitNTL2: // update the z-level according to the z-table - push edx + push edx mov edx, pZArray // get pointer to array xor eax, eax mov ax, usZIndex // pick up the current array index @@ -5878,10 +5882,10 @@ BlitNTL5: BlitNTL6: dec LSCount // decrement pixel length to blit jz RightSkipLoop // done blitting the visible line - + dec ecx jnz BlitNTL1 // continue current run - + jmp BlitDispatch // done current run, go for another @@ -5896,13 +5900,13 @@ BlitTrans2: add edi, 2 // move up the destination pointer add ebx, 2 - + dec usZColsToGo jnz BlitTrans1 // update the z-level according to the z-table - push edx + push edx mov edx, pZArray // get pointer to array xor eax, eax mov ax, usZIndex // pick up the current array index @@ -5930,7 +5934,7 @@ BlitTrans5: BlitTrans1: - dec LSCount // decrement the pixels to blit + dec LSCount // decrement the pixels to blit jz RightSkipLoop // done the line dec ecx @@ -5941,12 +5945,12 @@ BlitTrans1: //--------------------------------------------- // Scans the ETRLE until it finds an EOL marker -RightSkipLoop: - - +RightSkipLoop: + + RSLoop1: mov al, [esi] - inc esi + inc esi or al, al jnz RSLoop1 @@ -5967,15 +5971,15 @@ RSLoop2: mov ax, usZStartCols mov usZColsToGo, ax - + jmp LeftSkipSetup - + BlitDone: } return(TRUE); -} +} @@ -6069,19 +6073,19 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZTransShadowIncClip( UINT16 *pBuffer, UINT3 RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - + // calculate the remaining rows and columns to blit BlitLength=((INT32)usWidth-LeftSkip-RightSkip); BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) + if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) return(TRUE); // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) + if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) return(TRUE); - + SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); @@ -6089,14 +6093,14 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZTransShadowIncClip( UINT16 *pBuffer, UINT3 if(hSrcVObject->ppZStripInfo==NULL) { - DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); + DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); return(FALSE); } // setup for the z-column blitting stuff pZInfo=hSrcVObject->ppZStripInfo[sZIndex]; if(pZInfo==NULL) { - DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); + DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); return(FALSE); } @@ -6108,7 +6112,7 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZTransShadowIncClip( UINT16 *pBuffer, UINT3 usZStartCols=20-(usZStartCols%20); } else if(LeftSkip < pZInfo->ubFirstZStripWidth) - usZStartCols=(UINT16)(pZInfo->ubFirstZStripWidth - LeftSkip); + usZStartCols=(UINT16)(pZInfo->ubFirstZStripWidth - LeftSkip); else usZStartCols=20; @@ -6159,8 +6163,8 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZTransShadowIncClip( UINT16 *pBuffer, UINT3 // Skips the number of lines clipped at the top -TopSkipLoop: - +TopSkipLoop: + mov cl, [esi] inc esi or cl, cl @@ -6179,11 +6183,11 @@ TSEndLine: // Skips the pixels hanging outside the left-side boundry LeftSkipSetup: - + mov Unblitted, 0 // Unblitted counts any pixels left from a run mov eax, LeftSkip // after we have skipped enough left-side pixels mov LSCount, eax // LSCount counts how many pixels skipped so far - or eax, eax + or eax, eax jz BlitLineSetup // check for nothing to skip LeftSkipLoop: @@ -6204,7 +6208,7 @@ LeftSkipLoop: mov LSCount, eax mov Unblitted, 0 jmp BlitNTL1 // *** jumps into non-transparent blit loop - + LSSkip2: add esi, ecx // skip whole run, and start blit with new run jmp BlitLineSetup @@ -6228,7 +6232,7 @@ LSTrans: mov Unblitted, 0 jmp BlitTransparent // *** jumps into transparent blit loop - + LSTrans1: sub LSCount, ecx // skip whole run, continue skipping @@ -6237,7 +6241,7 @@ LSTrans1: //------------------------------------------------- // setup for beginning of line -BlitLineSetup: +BlitLineSetup: mov eax, BlitLength mov LSCount, eax mov Unblitted, 0 @@ -6252,7 +6256,7 @@ BlitDispatch: or cl, cl js BlitTransparent jz RSLoop2 - + //-------------------------------- // blitting non-transparent pixels @@ -6292,7 +6296,7 @@ BlitNTL2: // update the z-level according to the z-table - push edx + push edx mov edx, pZArray // get pointer to array xor eax, eax mov ax, usZIndex // pick up the current array index @@ -6321,10 +6325,10 @@ BlitNTL5: BlitNTL6: dec LSCount // decrement pixel length to blit jz RightSkipLoop // done blitting the visible line - + dec ecx jnz BlitNTL1 // continue current run - + jmp BlitDispatch // done current run, go for another @@ -6339,13 +6343,13 @@ BlitTrans2: add edi, 2 // move up the destination pointer add ebx, 2 - + dec usZColsToGo jnz BlitTrans1 // update the z-level according to the z-table - push edx + push edx mov edx, pZArray // get pointer to array xor eax, eax mov ax, usZIndex // pick up the current array index @@ -6373,7 +6377,7 @@ BlitTrans5: BlitTrans1: - dec LSCount // decrement the pixels to blit + dec LSCount // decrement the pixels to blit jz RightSkipLoop // done the line dec ecx @@ -6384,12 +6388,12 @@ BlitTrans1: //--------------------------------------------- // Scans the ETRLE until it finds an EOL marker -RightSkipLoop: - - +RightSkipLoop: + + RSLoop1: mov al, [esi] - inc esi + inc esi or al, al jnz RSLoop1 @@ -6409,15 +6413,15 @@ RSLoop2: mov ax, usZStartCols mov usZColsToGo, ax - + jmp LeftSkipSetup - + BlitDone: } return(TRUE); -} +} @@ -6488,14 +6492,14 @@ void RenderRoomInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPoi SetFontDestBuffer( FRAME_BUFFER , 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); } } - + sTempPosX_S += 40; sTempPosX_M ++; sTempPosY_M --; if ( sTempPosX_S >= sEndXS ) { - fEndRenderRow = TRUE; + fEndRenderRow = TRUE; } } while( !fEndRenderRow ); @@ -6508,7 +6512,7 @@ void RenderRoomInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPoi { sAnchorPosX_M ++; } - + bXOddFlag = !bXOddFlag; sAnchorPosY_S += 10; @@ -6600,14 +6604,14 @@ void RenderFOVDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStar } } - + sTempPosX_S += 40; sTempPosX_M ++; sTempPosY_M --; if ( sTempPosX_S >= sEndXS ) { - fEndRenderRow = TRUE; + fEndRenderRow = TRUE; } } while( !fEndRenderRow ); @@ -6620,7 +6624,7 @@ void RenderFOVDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStar { sAnchorPosX_M ++; } - + bXOddFlag = !bXOddFlag; sAnchorPosY_S += 10; @@ -6681,11 +6685,11 @@ void RenderCoverDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sSt { sX = sTempPosX_S + ( WORLD_TILE_X / 2 ) - 5; sY = sTempPosY_S + ( WORLD_TILE_Y / 2 ) - 5; - + // Adjust for interface level sY -= gpWorldLevelData[ usTileIndex ].sHeight; sY += gsRenderHeight; - + if (gsCoverValue[ usTileIndex] != 0x7F7F) { SetFont( SMALLCOMPFONT ); @@ -6707,14 +6711,14 @@ void RenderCoverDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sSt } } - + sTempPosX_S += 40; sTempPosX_M ++; sTempPosY_M --; if ( sTempPosX_S >= sEndXS ) { - fEndRenderRow = TRUE; + fEndRenderRow = TRUE; } } while( !fEndRenderRow ); @@ -6727,7 +6731,7 @@ void RenderCoverDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sSt { sAnchorPosX_M ++; } - + bXOddFlag = !bXOddFlag; sAnchorPosY_S += 10; @@ -6789,11 +6793,11 @@ void RenderGridNoVisibleDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, I { sX = sTempPosX_S + ( WORLD_TILE_X / 2 ) - 5; sY = sTempPosY_S + ( WORLD_TILE_Y / 2 ) - 5; - + // Adjust for interface level sY -= gpWorldLevelData[ usTileIndex ].sHeight; sY += gsRenderHeight; - + SetFont( SMALLCOMPFONT ); SetFontDestBuffer( FRAME_BUFFER , 0, 0, SCREEN_WIDTH, gsVIEWPORT_END_Y, FALSE ); @@ -6809,14 +6813,14 @@ void RenderGridNoVisibleDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, I SetFontDestBuffer( FRAME_BUFFER , 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); } - + sTempPosX_S += 40; sTempPosX_M ++; sTempPosY_M --; if ( sTempPosX_S >= sEndXS ) { - fEndRenderRow = TRUE; + fEndRenderRow = TRUE; } } while( !fEndRenderRow ); @@ -6829,7 +6833,7 @@ void RenderGridNoVisibleDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, I { sAnchorPosX_M ++; } - + bXOddFlag = !bXOddFlag; sAnchorPosY_S += 10; @@ -6926,7 +6930,7 @@ void ExamineZBufferForHiddenTiles( INT16 sStartPointX_M, INT16 sStartPointY_M, I GetWorldXYAbsoluteScreenXY( sTempPosX_M, sTempPosY_M, &sWorldX, &sZLevel); sZLevel += gsRenderHeight; - + sZLevel=(sZLevel*Z_SUBLAYERS)+STRUCT_Z_LEVEL; if ( gpWorldLevelData[usTileIndex].uiFlags & MAPELEMENT_REEVALUATE_REDUNDENCY ) @@ -6953,19 +6957,19 @@ void ExamineZBufferForHiddenTiles( INT16 sStartPointX_M, INT16 sStartPointY_M, I gpWorldLevelData[ usTileIndex ].uiFlags &= (~MAPELEMENT_REDUNDENT); } - } + } } } ENDOFLOOP: - + sTempPosX_S += 40; sTempPosX_M ++; sTempPosY_M --; if ( sTempPosX_S >= sEndXS ) { - fEndRenderRow = TRUE; + fEndRenderRow = TRUE; } } while( !fEndRenderRow ); @@ -6978,7 +6982,7 @@ ENDOFLOOP: { sAnchorPosX_M ++; } - + bXOddFlag = !bXOddFlag; sAnchorPosY_S += 10; @@ -7052,13 +7056,13 @@ void CalcRenderParameters(INT16 sLeft, INT16 sTop, INT16 sRight, INT16 sBottom ) if ( gsStartPointY_W < 0 ) { - gsStartPointY_S += 0;//(sOffsetY_S/2); + gsStartPointY_S += 0;//(sOffsetY_S/2); } else { - gsStartPointY_S -= sOffsetY_S; + gsStartPointY_S -= sOffsetY_S; } - gsStartPointX_S -= sOffsetX_S; + gsStartPointX_S -= sOffsetX_S; // Set globals for render offset @@ -7104,16 +7108,16 @@ void CalcRenderParameters(INT16 sLeft, INT16 sTop, INT16 sRight, INT16 sBottom ) gsLStartPointY_M = ( gsLStartPointY_W ) / CELL_Y_SIZE; // Adjust starting screen coordinates - gsLStartPointX_S -= sOffsetX_S; + gsLStartPointX_S -= sOffsetX_S; if ( gsLStartPointY_W < 0 ) { - gsLStartPointY_S += 0; - gsLStartPointX_S -= 20; + gsLStartPointY_S += 0; + gsLStartPointX_S -= 20; } else { - gsLStartPointY_S -= sOffsetY_S; + gsLStartPointY_S -= sOffsetY_S; } } @@ -7136,7 +7140,7 @@ BOOLEAN Zero8BPPDataTo16BPPBufferTransparent( UINT16 *pBuffer, UINT32 uiDestPitc ETRLEObject *pTrav; INT32 iTempX, iTempY; - + // Assertions Assert( hSrcVObject != NULL ); Assert( pBuffer != NULL ); @@ -7183,7 +7187,7 @@ BlitDispatch: jnc BlitNTL2 mov [edi], ax - + inc esi add edi, 2 @@ -7207,7 +7211,7 @@ BlitNTL3: xor ebx, ebx BlitNTL4: - + mov [edi], ax mov [edi+2], ax @@ -7233,19 +7237,19 @@ BlitTransparent: BlitDoneLine: - + dec usHeight jz BlitDone add edi, LineSkip jmp BlitDispatch - + BlitDone: } return(TRUE); -} +} BOOLEAN Blt8BPPDataTo16BPPBufferTransInvZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) @@ -7258,7 +7262,7 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransInvZ( UINT16 *pBuffer, UINT32 uiDestPitchBY ETRLEObject *pTrav; INT32 iTempX, iTempY; - + // Assertions Assert( hSrcVObject != NULL ); Assert( pBuffer != NULL ); @@ -7306,18 +7310,18 @@ BlitDispatch: xor eax, eax BlitNTL4: - - mov ax, usZValue + + mov ax, usZValue cmp ax, [ebx] jne BlitNTL5 //mov [ebx], ax - + xor ah, ah mov al, [esi] mov ax, [edx+eax*2] mov [edi], ax - + BlitNTL5: inc esi inc edi @@ -7342,20 +7346,20 @@ BlitTransparent: BlitDoneLine: - + dec usHeight jz BlitDone add edi, LineSkip add ebx, LineSkip jmp BlitDispatch - + BlitDone: } return(TRUE); -} +} @@ -7370,7 +7374,7 @@ BOOLEAN IsTileRedundent( UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZVa INT32 iTempX, iTempY; BOOLEAN fHidden = TRUE; - + // Assertions Assert( hSrcVObject != NULL ); @@ -7415,8 +7419,8 @@ BlitDispatch: xor eax, eax BlitNTL4: - - mov ax, usZValue + + mov ax, usZValue cmp ax, [ebx] jle BlitNTL5 @@ -7425,7 +7429,7 @@ BlitNTL4: mov fHidden, 0 jmp BlitDone - + BlitNTL5: inc esi inc ebx @@ -7447,19 +7451,19 @@ BlitTransparent: BlitDoneLine: - + dec usHeight jz BlitDone add ebx, LineSkip jmp BlitDispatch - + BlitDone: } return(fHidden); -} +} void SetMercGlowFast( ) { @@ -7490,12 +7494,12 @@ void SetMercGlowNormal( ) sZOffsetY = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetY;\ - if ( ( pSoldier->uiStatusFlags & SOLDIER_MULTITILE ) )\ + if ( ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE ) )\ {\ sZOffsetX = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetX;\ sZOffsetY = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetY;\ \ - GetMapXYWorldY( sMapX + sZOffsetX, sMapY + sZOffsetY, sWorldY );\ + sWorldY = GetMapXYWorldY( sMapX + sZOffsetX, sMapY + sZOffsetY );\ }\ else diff --git a/TileEngine/renderworld.h b/TileEngine/renderworld.h index 8373e2e9..d8842cd6 100644 --- a/TileEngine/renderworld.h +++ b/TileEngine/renderworld.h @@ -156,17 +156,17 @@ void ScrollWorld( ); void InitRenderParams( UINT8 ubRestrictionID ); void RenderWorld( ); -/* This procedure will initialize gsVIEWPORT_xxx variables - * they ware declared with static initializer - * any question? joker +/* This procedure will initialize gsVIEWPORT_xxx variables + * they ware declared with static initializer + * any question? joker */ void InitializeViewPort(); void ResetLayerOptimizing(void); void ResetSpecificLayerOptimizing( UINT32 uiRowFlag ); // Routines of RenderWorld -extern void RenderStaticWorld( ); -extern void RenderDynamicWorld( ); +extern void RenderStaticWorld( ); +extern void RenderDynamicWorld( ); void CopyRenderBuffer( ); void SetRenderFlags(UINT32 uiFlags); diff --git a/TileEngine/structure.cpp b/TileEngine/structure.cpp index 9badb015..798e8aa3 100644 --- a/TileEngine/structure.cpp +++ b/TileEngine/structure.cpp @@ -33,7 +33,7 @@ #endif #include "explosion control.h" - #include "sound control.h" + #include "Sound Control.h" #include "Buildings.h" @@ -51,13 +51,13 @@ void DeleteStructureFromTile( MAP_ELEMENT * pMapElement, STRUCTURE * pStructure ); /* - * NB: STRUCTURE_SPECIAL + * NB: STRUCTURE_SPECIAL * * Means different things depending on the context. - * + * * WALLNWINDOW SPECIAL - opaque to sight - * MULTI SPECIAL - second level (damaged) MULTI structure, should only be deleted if - * starting with the deletion of a MULTI SPECIAL structure + * MULTI SPECIAL - second level (damaged) MULTI structure, should only be deleted if + * starting with the deletion of a MULTI SPECIAL structure */ UINT8 AtHeight[PROFILE_Z_SIZE] = { 0x01, 0x02, 0x04, 0x08 }; @@ -106,7 +106,7 @@ INT32 guiMaterialHitSound[ NUM_MATERIAL_TYPES ] = UINT8 gubMaterialArmour[] = /* -index 1-10, organics +index 1-10, organics index 11-20, rocks and concretes index 21-30, metals @@ -125,11 +125,11 @@ index 25, indestructable metal */ { // note: must increase; r.c. should block *AP* 7.62mm rounds - 0, // nothing + 0, // nothing 25, // dry timber; wood wall +1/2 20, // furniture wood (thin!) or plywood wall +1/2 30, // wood (live); 1.5x timber - 3, // light vegetation + 3, // light vegetation 10, // upholstered furniture 47, // porcelain 10, // cactus, hay, bamboo @@ -138,9 +138,9 @@ index 25, indestructable metal 0, 55, // stone masonry; 3x timber 63, // non-reinforced concrete; 4x timber??? - 70, // reinforced concrete; 6x timber - 85, // rock? - number invented - 9, // rubber - tires + 70, // reinforced concrete; 6x timber + 85, // rock? - number invented + 9, // rubber - tires 40, // sand 1, // cloth 40, // sandbag @@ -148,7 +148,7 @@ index 25, indestructable metal 0, 37, // light metal (furniture; NB thin!) 57, // thicker metal (dumpster) - 85, // heavy metal (vault doors) - block everything + 85, // heavy metal (vault doors) - block everything // note that vehicle armour will probably end up in here 127, // rock indestructable 127, // indestructable @@ -185,8 +185,9 @@ UINT8 FilledTilePositions( DB_STRUCTURE_TILE * pTile ) // void FreeStructureFileRef( STRUCTURE_FILE_REF * pFileRef ) -{ // Frees all of the memory associated with a file reference, including - // the file reference structure itself +{ + // Frees all of the memory associated with a file reference, including + // the file reference structure itself UINT16 usLoop; @@ -218,7 +219,8 @@ void FreeStructureFileRef( STRUCTURE_FILE_REF * pFileRef ) } void FreeAllStructureFiles( void ) -{ // Frees all of the structure database! +{ + // Frees all of the structure database! STRUCTURE_FILE_REF * pFileRef; STRUCTURE_FILE_REF * pNextRef; @@ -261,14 +263,15 @@ BOOLEAN FreeStructureFile( STRUCTURE_FILE_REF * pStructureFile ) BOOLEAN LoadStructureData( STR szFileName, STRUCTURE_FILE_REF * pFileRef, UINT32 * puiStructureDataSize ) //UINT8 **ppubStructureData, UINT32 * puiDataSize, STRUCTURE_FILE_HEADER * pHeader ) -{ // Loads a structure file's data as a honking chunk o' memory +{ + // Loads a structure file's data as a honking chunk o' memory HWFILE hInput; - STRUCTURE_FILE_HEADER Header; + STRUCTURE_FILE_HEADER Header; UINT32 uiBytesRead; UINT32 uiDataSize; BOOLEAN fOk; - CHECKF( szFileName ); + CHECKF( szFileName ); CHECKF( pFileRef ); hInput = FileOpen( szFileName, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); if (hInput == 0) @@ -359,8 +362,9 @@ BOOLEAN LoadStructureData( STR szFileName, STRUCTURE_FILE_REF * pFileRef, UINT32 } BOOLEAN CreateFileStructureArrays( STRUCTURE_FILE_REF * pFileRef, UINT32 uiDataSize ) -{ // Based on a file chunk, creates all the dynamic arrays for the - // structure definitions contained within +{ + // Based on a file chunk, creates all the dynamic arrays for the + // structure definitions contained within UINT8 * pCurrent; DB_STRUCTURE_REF * pDBStructureRef; @@ -406,7 +410,7 @@ BOOLEAN CreateFileStructureArrays( STRUCTURE_FILE_REF * pFileRef, UINT32 uiDataS ppTileArray[usTileLoop] = (DB_STRUCTURE_TILE *) pCurrent; // set the single-value relative position between this tile and the base tile ppTileArray[usTileLoop]->sPosRelToBase = ppTileArray[usTileLoop]->bXPosRelToBase + ppTileArray[usTileLoop]->bYPosRelToBase * WORLD_COLS; - uiHitPoints += FilledTilePositions( ppTileArray[usTileLoop] ); + uiHitPoints += FilledTilePositions( ppTileArray[usTileLoop] ); pCurrent += sizeof( DB_STRUCTURE_TILE ); } // scale hit points down to something reasonable... @@ -429,7 +433,8 @@ BOOLEAN CreateFileStructureArrays( STRUCTURE_FILE_REF * pFileRef, UINT32 uiDataS } STRUCTURE_FILE_REF * LoadStructureFile( STR szFileName ) -{ // NB should be passed in expected number of structures so we can check equality +{ + // NB should be passed in expected number of structures so we can check equality UINT32 uiDataSize = 0; BOOLEAN fOk; STRUCTURE_FILE_REF * pFileRef; @@ -455,7 +460,7 @@ STRUCTURE_FILE_REF * LoadStructureFile( STR szFileName ) return( NULL ); } } - // Add the file reference to the master list, at the head for convenience + // Add the file reference to the master list, at the head for convenience if (gpStructureFileRefs != NULL) { gpStructureFileRefs->pPrev = pFileRef; @@ -472,7 +477,8 @@ STRUCTURE_FILE_REF * LoadStructureFile( STR szFileName ) STRUCTURE * CreateStructureFromDB( DB_STRUCTURE_REF * pDBStructureRef, UINT8 ubTileNum ) -{ // Creates a STRUCTURE struct for one tile of a structure +{ + // Creates a STRUCTURE struct for one tile of a structure STRUCTURE * pStructure; DB_STRUCTURE * pDBStructure; DB_STRUCTURE_TILE * pTile; @@ -484,7 +490,7 @@ STRUCTURE * CreateStructureFromDB( DB_STRUCTURE_REF * pDBStructureRef, UINT8 ubT CHECKN( pDBStructureRef->ppTile ); pTile = pDBStructureRef->ppTile[ubTileNum]; CHECKN( pTile ); - + // allocate memory... pStructure = (STRUCTURE *) MemAlloc( sizeof( STRUCTURE ) ); CHECKN( pStructure ); @@ -506,7 +512,7 @@ STRUCTURE * CreateStructureFromDB( DB_STRUCTURE_REF * pDBStructureRef, UINT8 ubT { // for multi-tile walls, which are only the special corner pieces, // the non-base tile gets no orientation value because this copy - // will be skipped + // will be skipped if (pStructure->fFlags & STRUCTURE_BASE_TILE) { pStructure->ubWallOrientation = pDBStructure->ubWallOrientation; @@ -522,7 +528,8 @@ STRUCTURE * CreateStructureFromDB( DB_STRUCTURE_REF * pDBStructureRef, UINT8 ubT } BOOLEAN OkayToAddStructureToTile( INT16 sBaseGridNo, INT16 sCubeOffset, DB_STRUCTURE_REF * pDBStructureRef, UINT8 ubTileIndex, INT16 sExclusionID, BOOLEAN fIgnorePeople ) -{ // Verifies whether a structure is blocked from being added to the map at a particular point +{ + // Verifies whether a structure is blocked from being added to the map at a particular point DB_STRUCTURE * pDBStructure; DB_STRUCTURE_TILE ** ppTile; STRUCTURE * pExistingStructure; @@ -562,15 +569,15 @@ BOOLEAN OkayToAddStructureToTile( INT16 sBaseGridNo, INT16 sCubeOffset, DB_STRUC // CJC: // If adding a mobile structure, allow addition if existing structure is passable - if ( (pDBStructure->fFlags & STRUCTURE_MOBILE) && (pExistingStructure->fFlags & STRUCTURE_PASSABLE) ) - { + if ( (pDBStructure->fFlags & STRUCTURE_MOBILE) && (pExistingStructure->fFlags & STRUCTURE_PASSABLE) ) + { // Skip! pExistingStructure = pExistingStructure->pNext; continue; } - if (pDBStructure->fFlags & STRUCTURE_OBSTACLE) + if (pDBStructure->fFlags & STRUCTURE_OBSTACLE) { // CJC: NB these next two if states are probably COMPLETELY OBSOLETE but I'm leaving @@ -598,14 +605,14 @@ BOOLEAN OkayToAddStructureToTile( INT16 sBaseGridNo, INT16 sCubeOffset, DB_STRUC continue; } } - + // two obstacle structures aren't allowed in the same tile at the same height // ATE: There is more sophisticated logic for mobiles, so postpone this check if mobile.... if ( ( pExistingStructure->fFlags & STRUCTURE_OBSTACLE ) && !( pDBStructure->fFlags & STRUCTURE_MOBILE ) ) { if ( pExistingStructure->fFlags & STRUCTURE_PASSABLE && !(pExistingStructure->fFlags & STRUCTURE_MOBILE) ) { - // no mobiles, existing structure is passable + // no mobiles, existing structure is passable } else { @@ -687,8 +694,8 @@ BOOLEAN OkayToAddStructureToTile( INT16 sBaseGridNo, INT16 sCubeOffset, DB_STRUC } } } - - if ( pDBStructure->fFlags & STRUCTURE_MOBILE ) + + if ( pDBStructure->fFlags & STRUCTURE_MOBILE ) { // ATE: // ignore this one if it has the same ID num as exclusion @@ -720,13 +727,13 @@ BOOLEAN OkayToAddStructureToTile( INT16 sBaseGridNo, INT16 sCubeOffset, DB_STRUC return( FALSE ); } - // ATE: Another rule: allow PASSABLE *IF* the PASSABLE is *NOT* MOBILE! + // ATE: Another rule: allow PASSABLE *IF* the PASSABLE is *NOT* MOBILE! if ( !( pExistingStructure->fFlags & STRUCTURE_MOBILE ) && (pExistingStructure->fFlags & STRUCTURE_PASSABLE) ) { // Skip! pExistingStructure = pExistingStructure->pNext; continue; - } + } // ATE: Added here - UNLESS this part is PASSABLE.... // two obstacle structures aren't allowed in the same tile at the same height @@ -735,7 +742,7 @@ BOOLEAN OkayToAddStructureToTile( INT16 sBaseGridNo, INT16 sCubeOffset, DB_STRUC return( FALSE ); } } - + if ((pDBStructure->fFlags & STRUCTURE_OPENABLE)) { if (pExistingStructure->fFlags & STRUCTURE_OPENABLE) @@ -749,7 +756,7 @@ BOOLEAN OkayToAddStructureToTile( INT16 sBaseGridNo, INT16 sCubeOffset, DB_STRUC pExistingStructure = pExistingStructure->pNext; } - + return( TRUE ); } @@ -803,7 +810,8 @@ BOOLEAN OkayToAddStructureToWorld( INT16 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_ } BOOLEAN AddStructureToTile( MAP_ELEMENT * pMapElement, STRUCTURE * pStructure, UINT16 usStructureID ) -{ // adds a STRUCTURE to a MAP_ELEMENT (adds part of a structure to a location on the map) +{ + // adds a STRUCTURE to a MAP_ELEMENT (adds part of a structure to a location on the map) STRUCTURE * pStructureTail; CHECKF( pMapElement ); @@ -829,7 +837,8 @@ BOOLEAN AddStructureToTile( MAP_ELEMENT * pMapElement, STRUCTURE * pStructure, U STRUCTURE * InternalAddStructureToWorld( INT16 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, LEVELNODE * pLevelNode ) -{ // Adds a complete structure to the world at a location plus all other locations covered by the structure +{ + // Adds a complete structure to the world at a location plus all other locations covered by the structure INT16 sGridNo; STRUCTURE ** ppStructure; STRUCTURE * pBaseStructure; @@ -859,9 +868,9 @@ STRUCTURE * InternalAddStructureToWorld( INT16 sBaseGridNo, INT8 bLevel, DB_STRU // We go through a definition stage here and a later stage of // adding everything to the world so that we don't have to untangle - // things if we run out of memory. First we create an array of + // things if we run out of memory. First we create an array of // pointers to point to all of the STRUCTURE elements created in - // the first stage. This array gets given to the base tile so + // the first stage. This array gets given to the base tile so // there is an easy way to remove an entire object from the world quickly // NB we add 1 because the 0th element is in fact the reference count! @@ -886,9 +895,9 @@ STRUCTURE * InternalAddStructureToWorld( INT16 sBaseGridNo, INT8 bLevel, DB_STRU if (ubLoop != BASE_TILE) { #ifdef JA2EDITOR - //Kris: + //Kris: //Added this undo code if in the editor. - //It is important to save tiles effected by multitiles. If the structure placement + //It is important to save tiles effected by multitiles. If the structure placement //fails below, it doesn't matter, because it won't hurt the undo code. if( gfEditMode ) AddToUndoList( ppStructure[ ubLoop ]->sGridNo ); @@ -938,7 +947,7 @@ STRUCTURE * InternalAddStructureToWorld( INT16 sBaseGridNo, INT8 bLevel, DB_STRU } else if (pLevelNode->uiFlags & LEVELNODE_ROTTINGCORPSE) { - // ATE: Offset IDs so they don't collide with soldiers + // ATE: Offset IDs so they don't collide with soldiers usStructureID = (UINT16)( TOTAL_SOLDIERS + pLevelNode->pAniTile->uiUserData ); } else @@ -956,7 +965,7 @@ STRUCTURE * InternalAddStructureToWorld( INT16 sBaseGridNo, INT8 bLevel, DB_STRU { sGridNo = ppStructure[ubLoop]->sGridNo; if (ubLoop == BASE_TILE) - { + { sBaseTileHeight = gpWorldLevelData[sGridNo].sHeight; } else @@ -1010,7 +1019,8 @@ BOOLEAN AddStructureToWorld( INT16 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * // void DeleteStructureFromTile( MAP_ELEMENT * pMapElement, STRUCTURE * pStructure ) -{ // removes a STRUCTURE element at a particular location from the world +{ + // removes a STRUCTURE element at a particular location from the world // put location pointer in tile if (pMapElement->pStructureHead == pStructure) { @@ -1034,7 +1044,7 @@ void DeleteStructureFromTile( MAP_ELEMENT * pMapElement, STRUCTURE * pStructure } else { - // second or later element in the list; it's guaranteed that there is a + // second or later element in the list; it's guaranteed that there is a // previous element but not necessary a next pStructure->pPrev->pNext = pStructure->pNext; if (pStructure->pNext != NULL) @@ -1050,7 +1060,8 @@ void DeleteStructureFromTile( MAP_ELEMENT * pMapElement, STRUCTURE * pStructure } BOOLEAN DeleteStructureFromWorld( STRUCTURE * pStructure ) -{ // removes all of the STRUCTURE elements for a structure from the world +{ + // removes all of the STRUCTURE elements for a structure from the world MAP_ELEMENT * pBaseMapElement; STRUCTURE * pBaseStructure; DB_STRUCTURE_TILE ** ppTile; @@ -1067,7 +1078,7 @@ BOOLEAN DeleteStructureFromWorld( STRUCTURE * pStructure ) CHECKF( pStructure ); pBaseStructure = FindBaseStructure( pStructure ); - CHECKF( pBaseStructure ); + CHECKF( pBaseStructure ); usStructureID = pBaseStructure->usStructureID; fMultiStructure = ( ( pBaseStructure->fFlags & STRUCTURE_MULTI ) != 0 ); @@ -1116,12 +1127,13 @@ BOOLEAN DeleteStructureFromWorld( STRUCTURE * pStructure ) } } } - } - return( TRUE ); + } + return( TRUE ); } STRUCTURE * InternalSwapStructureForPartner( INT16 sGridNo, STRUCTURE * pStructure, BOOLEAN fFlipSwitches, BOOLEAN fStoreInMap ) -{ // switch structure +{ + // switch structure LEVELNODE * pLevelNode; LEVELNODE * pShadowNode; STRUCTURE * pBaseStructure; @@ -1207,7 +1219,7 @@ STRUCTURE * InternalSwapStructureForPartner( INT16 sGridNo, STRUCTURE * pStructu } STRUCTURE * SwapStructureForPartner( INT16 sGridNo, STRUCTURE * pStructure ) -{ +{ return( InternalSwapStructureForPartner( sGridNo, pStructure, TRUE, FALSE ) ); } @@ -1222,13 +1234,14 @@ STRUCTURE * SwapStructureForPartnerAndStoreChangeInMap( INT16 sGridNo, STRUCTURE } STRUCTURE * FindStructure( INT16 sGridNo, UINT32 fFlags ) -{ // finds a structure that matches any of the given flags +{ + // finds a structure that matches any of the given flags STRUCTURE * pCurrent; if( sGridNo > WORLD_MAX-1 ) //bug fix for win98 crash when traveling between sectors return( NULL ); - pCurrent = gpWorldLevelData[sGridNo].pStructureHead; + pCurrent = gpWorldLevelData[sGridNo].pStructureHead; while (pCurrent != NULL) { if ((pCurrent->fFlags & fFlags) != 0) @@ -1258,10 +1271,11 @@ STRUCTURE * FindNextStructure( STRUCTURE * pStructure, UINT32 fFlags ) } STRUCTURE * FindStructureByID( INT16 sGridNo, UINT16 usStructureID ) -{ // finds a structure that matches any of the given flags +{ + // finds a structure that matches any of the given flags STRUCTURE * pCurrent; - pCurrent = gpWorldLevelData[sGridNo].pStructureHead; + pCurrent = gpWorldLevelData[sGridNo].pStructureHead; while (pCurrent != NULL) { if (pCurrent->usStructureID == usStructureID) @@ -1274,7 +1288,8 @@ STRUCTURE * FindStructureByID( INT16 sGridNo, UINT16 usStructureID ) } STRUCTURE * FindBaseStructure( STRUCTURE * pStructure ) -{ // finds the base structure for any structure +{ + // finds the base structure for any structure CHECKF( pStructure ); if (pStructure->fFlags & STRUCTURE_BASE_TILE) { @@ -1284,7 +1299,8 @@ STRUCTURE * FindBaseStructure( STRUCTURE * pStructure ) } STRUCTURE * FindNonBaseStructure( INT16 sGridNo, STRUCTURE * pStructure ) -{ // finds a non-base structure in a location +{ + // finds a non-base structure in a location CHECKF( pStructure ); if (!(pStructure->fFlags & STRUCTURE_BASE_TILE)) { // error! @@ -1311,7 +1327,8 @@ INT16 GetBaseTile( STRUCTURE * pStructure ) } INT8 StructureHeight( STRUCTURE * pStructure ) -{ // return the height of an object from 1-4 +{ + // return the height of an object from 1-4 UINT8 ubLoopX, ubLoopY; PROFILE * pShape; UINT8 ubShapeValue; @@ -1350,7 +1367,7 @@ INT8 StructureHeight( STRUCTURE * pStructure ) return( bGreatestHeight + 1); } break; - } + } } } } @@ -1443,7 +1460,8 @@ INT8 GetStructureTargetHeight( INT16 sGridNo, BOOLEAN fOnRoof ) INT8 StructureBottomLevel( STRUCTURE * pStructure ) -{ // return the bottom level of an object, from 1-4 +{ + // return the bottom level of an object, from 1-4 UINT8 ubLoopX, ubLoopY; PROFILE * pShape; UINT8 ubShapeValue; @@ -1474,7 +1492,7 @@ INT8 StructureBottomLevel( STRUCTURE * pStructure ) return( 1 ); } break; - } + } } } } @@ -1533,7 +1551,8 @@ BOOLEAN StructureDensity( STRUCTURE * pStructure, UINT8 * pubLevel0, UINT8 * pub } BOOLEAN DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason, INT16 sGridNo, INT16 sX, INT16 sY, UINT8 ubOwner ) -{ // do damage to a structure; returns TRUE if the structure should be removed +{ + // do damage to a structure; returns TRUE if the structure should be removed STRUCTURE *pBase; UINT8 ubArmour; @@ -1588,7 +1607,7 @@ BOOLEAN DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason, { // Remove struct! pBase = FindBaseStructure( pStructure ); - + // ATE: Set hit points to zero.... pBase->ubHitPoints = 0; @@ -1610,17 +1629,17 @@ BOOLEAN DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason, } // Make hit sound.... - if ( pStructure->fFlags & STRUCTURE_CAVEWALL ) - { - PlayJA2Sample( S_VEG_IMPACT1, RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); - } - else - { - if ( guiMaterialHitSound[ pStructure->pDBStructureRef->pDBStructure->ubArmour ] != -1 ) - { - PlayJA2Sample( guiMaterialHitSound[ pStructure->pDBStructureRef->pDBStructure->ubArmour ], RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); - } - } + if ( pStructure->fFlags & STRUCTURE_CAVEWALL ) + { + PlayJA2Sample( S_VEG_IMPACT1, RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); + } + else + { + if ( guiMaterialHitSound[ pStructure->pDBStructureRef->pDBStructure->ubArmour ] != -1 ) + { + PlayJA2Sample( guiMaterialHitSound[ pStructure->pDBStructureRef->pDBStructure->ubArmour ], RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); + } + } // Don't update damage HPs.... return( TRUE ); } @@ -1654,7 +1673,7 @@ void DebugStructurePage1( void ) STRUCTURE * pStructure; STRUCTURE * pBase; //LEVELNODE * pLand; - UINT16 usGridNo; + INT16 sGridNo; INT16 sDesiredLevel; INT8 bHeight, bDens0, bDens1, bDens2, bDens3; INT8 bStructures; @@ -1670,7 +1689,7 @@ void DebugStructurePage1( void ) SetFont( LARGEFONT1 ); gprintf( 0, 0, L"DEBUG STRUCTURES PAGE 1 OF 1" ); - if (GetMouseMapPos( &usGridNo ) == FALSE) + if (GetMouseMapPos( &sGridNo ) == FALSE) { return; //gprintf( 0, LINE_HEIGHT * 1, L"No structure selected" ); @@ -1685,14 +1704,14 @@ void DebugStructurePage1( void ) sDesiredLevel = STRUCTURE_ON_ROOF; } - gprintf( 320, 0, L"Building %d", gubBuildingInfo[ usGridNo ] ); + gprintf( 320, 0, L"Building %d", gubBuildingInfo[ sGridNo ] ); /* - pLand = gpWorldLevelData[usGridNo].pLandHead; + pLand = gpWorldLevelData[sGridNo].pLandHead; gprintf( 320, 0, L"Fake light %d", pLand->ubFakeShadeLevel ); - gprintf( 320, LINE_HEIGHT, L"Real light: ground %d roof %d", LightTrueLevel( usGridNo, 0 ), LightTrueLevel( usGridNo, 1 ) ); + gprintf( 320, LINE_HEIGHT, L"Real light: ground %d roof %d", LightTrueLevel( sGridNo, 0 ), LightTrueLevel( sGridNo, 1 ) ); */ - pStructure = gpWorldLevelData[usGridNo].pStructureHead; + pStructure = gpWorldLevelData[sGridNo].pStructureHead; while (pStructure != NULL) { if (pStructure->sCubeOffset == sDesiredLevel) @@ -1738,7 +1757,7 @@ void DebugStructurePage1( void ) } else if (pStructure->fFlags & STRUCTURE_SLIDINGDOOR) { - gprintf( 0, LINE_HEIGHT * 1, L"%s sliding door with orientation %s", + gprintf( 0, LINE_HEIGHT * 1, L"%s sliding door with orientation %s", (pStructure->fFlags & STRUCTURE_OPEN) ? L"Open" : L"Closed", WallOrientationString[pStructure->ubWallOrientation] ); } @@ -1755,7 +1774,7 @@ void DebugStructurePage1( void ) gprintf( 0, LINE_HEIGHT * 1, L"UNKNOWN STRUCTURE! (%x)", pStructure->fFlags ); } bHeight = StructureHeight( pStructure ); - pBase = FindBaseStructure( pStructure ); + pBase = FindBaseStructure( pStructure ); gprintf( 0, LINE_HEIGHT * 2, L"Structure height %d, cube offset %d, armour %d, HP %d", bHeight, pStructure->sCubeOffset, gubMaterialArmour[pStructure->pDBStructureRef->pDBStructure->ubArmour], pBase->ubHitPoints ); if (StructureDensity( pStructure, (UINT8 *)&bDens0, (UINT8 *)&bDens1, (UINT8 *)&bDens2, (UINT8 *)&bDens3 ) == TRUE) { @@ -1767,7 +1786,7 @@ void DebugStructurePage1( void ) gprintf( 0, LINE_HEIGHT * 4, L"Structure ID %d", pStructure->usStructureID ); #endif - pStructure = gpWorldLevelData[usGridNo].pStructureHead; + pStructure = gpWorldLevelData[sGridNo].pStructureHead; for ( bStructures = 0; pStructure != NULL; pStructure = pStructure->pNext) { bStructures++; @@ -1802,23 +1821,23 @@ void DebugStructurePage1( void ) } #endif gprintf( 0, LINE_HEIGHT * 13, L"N %d NE %d E %d SE %d", - gubWorldMovementCosts[ usGridNo ][ NORTH ][ gsInterfaceLevel ], - gubWorldMovementCosts[ usGridNo ][ NORTHEAST ][ gsInterfaceLevel ], - gubWorldMovementCosts[ usGridNo ][ EAST ][ gsInterfaceLevel ], - gubWorldMovementCosts[ usGridNo ][ SOUTHEAST ][ gsInterfaceLevel ] ); + gubWorldMovementCosts[ sGridNo ][ NORTH ][ gsInterfaceLevel ], + gubWorldMovementCosts[ sGridNo ][ NORTHEAST ][ gsInterfaceLevel ], + gubWorldMovementCosts[ sGridNo ][ EAST ][ gsInterfaceLevel ], + gubWorldMovementCosts[ sGridNo ][ SOUTHEAST ][ gsInterfaceLevel ] ); gprintf( 0, LINE_HEIGHT * 14, L"S %d SW %d W %d NW %d", - gubWorldMovementCosts[ usGridNo ][ SOUTH ][ gsInterfaceLevel ], - gubWorldMovementCosts[ usGridNo ][ SOUTHWEST ][ gsInterfaceLevel ], - gubWorldMovementCosts[ usGridNo ][ WEST ][ gsInterfaceLevel ], - gubWorldMovementCosts[ usGridNo ][ NORTHWEST ][ gsInterfaceLevel ] ); + gubWorldMovementCosts[ sGridNo ][ SOUTH ][ gsInterfaceLevel ], + gubWorldMovementCosts[ sGridNo ][ SOUTHWEST ][ gsInterfaceLevel ], + gubWorldMovementCosts[ sGridNo ][ WEST ][ gsInterfaceLevel ], + gubWorldMovementCosts[ sGridNo ][ NORTHWEST ][ gsInterfaceLevel ] ); gprintf( 0, LINE_HEIGHT * 15, L"Ground smell %d strength %d", - SMELL_TYPE( gpWorldLevelData[ usGridNo ].ubSmellInfo ), - SMELL_STRENGTH( gpWorldLevelData[ usGridNo ].ubSmellInfo ) ); + SMELL_TYPE( gpWorldLevelData[ sGridNo ].ubSmellInfo ), + SMELL_STRENGTH( gpWorldLevelData[ sGridNo ].ubSmellInfo ) ); #ifdef COUNT_PATHS if (guiTotalPathChecks > 0) { - gprintf( 0, LINE_HEIGHT * 16, + gprintf( 0, LINE_HEIGHT * 16, L"Total %ld, %%succ %3ld | %%failed %3ld | %%unsucc %3ld", guiTotalPathChecks, 100 * guiSuccessfulPathChecks / guiTotalPathChecks, @@ -1827,8 +1846,8 @@ void DebugStructurePage1( void ) } #else - gprintf( 0, LINE_HEIGHT * 16, - L"Adj soldiers %d", gpWorldLevelData[usGridNo].ubAdjacentSoldierCnt ); + gprintf( 0, LINE_HEIGHT * 16, + L"Adj soldiers %d", gpWorldLevelData[sGridNo].ubAdjacentSoldierCnt ); #endif } @@ -1874,7 +1893,7 @@ BOOLEAN AddZStripInfoToVObject( HVOBJECT hVObject, STRUCTURE_FILE_REF * pStructu { // spans multiple tiles! (could be two levels high in one tile) fFound = TRUE; - break; + break; } } } @@ -1919,8 +1938,8 @@ BOOLEAN AddZStripInfoToVObject( HVOBJECT hVObject, STRUCTURE_FILE_REF * pStructu } sStructIndex = 0; - sNext = sSTIStartIndex + sSTIStep; - fFirstTime = TRUE; + sNext = sSTIStartIndex + sSTIStep; + fFirstTime = TRUE; for (uiLoop = (UINT8)sSTIStartIndex; uiLoop < hVObject->usNumberOfObjects; uiLoop++ ) { @@ -1967,7 +1986,7 @@ BOOLEAN AddZStripInfoToVObject( HVOBJECT hVObject, STRUCTURE_FILE_REF * pStructu hVObject->ppZStripInfo[ uiDestVoIndex ] = (ZStripInfo *) MemAlloc( sizeof( ZStripInfo ) ); if (hVObject->ppZStripInfo[ uiDestVoIndex ] == NULL) { - // augh!! out of memory! free everything allocated and abort + // augh!! out of memory! free everything allocated and abort for (ubLoop2 = 0; ubLoop2 < uiLoop; ubLoop2++) { if (hVObject->ppZStripInfo[ubLoop2] != NULL) @@ -1993,16 +2012,15 @@ BOOLEAN AddZStripInfoToVObject( HVOBJECT hVObject, STRUCTURE_FILE_REF * pStructu usWidth = hVObject->pETRLEObject[uiLoop].usWidth; usHeight = hVObject->pETRLEObject[uiLoop].usHeight; if (pDBStructure->fFlags & (STRUCTURE_MOBILE | STRUCTURE_CORPSE) ) - { - UINT32 i = 0; - // adjust for the difference between the animation and structure base tile - + { + // adjust for the difference between the animation and structure base tile + //if (pDBStructure->fFlags & (STRUCTURE_MOBILE ) ) { sOffsetX = sOffsetX + (WORLD_TILE_X / 2); sOffsetY = sOffsetY + (WORLD_TILE_Y / 2); } - // adjust for the tile offset + // adjust for the tile offset sOffsetX = sOffsetX - pDBStructure->bZTileOffsetX * (WORLD_TILE_X / 2) + pDBStructure->bZTileOffsetY * (WORLD_TILE_X / 2); sOffsetY = sOffsetY - pDBStructure->bZTileOffsetY * (WORLD_TILE_Y / 2); } @@ -2016,7 +2034,7 @@ BOOLEAN AddZStripInfoToVObject( HVOBJECT hVObject, STRUCTURE_FILE_REF * pStructu sRightHalfWidth = usWidth + sOffsetX - (WORLD_TILE_X / 2); if (sRightHalfWidth >= 0) - { + { // Case 1: negative image offset, image straddles bottom corner // negative of a negative is positive @@ -2055,7 +2073,7 @@ BOOLEAN AddZStripInfoToVObject( HVOBJECT hVObject, STRUCTURE_FILE_REF * pStructu else { // Case 5: positive offset, image all on right side - // should never happen either + // should never happen either sLeftHalfWidth = 0; sRightHalfWidth = usWidth; } @@ -2064,7 +2082,7 @@ BOOLEAN AddZStripInfoToVObject( HVOBJECT hVObject, STRUCTURE_FILE_REF * pStructu { ubNumIncreasing = sLeftHalfWidth / (WORLD_TILE_X / 2); } - if (sRightHalfWidth > 0) + if (sRightHalfWidth > 0) { ubNumStable = 1; if (sRightHalfWidth > (WORLD_TILE_X / 2)) @@ -2118,12 +2136,12 @@ BOOLEAN AddZStripInfoToVObject( HVOBJECT hVObject, STRUCTURE_FILE_REF * pStructu } for (ubLoop2 = 0; ubLoop2 < ubNumIncreasing; ubLoop2++) { - pCurr->pbZChange[ubLoop2] = 1; - } + pCurr->pbZChange[ubLoop2] = 1; + } for (; ubLoop2 < ubNumIncreasing + ubNumStable; ubLoop2++) { pCurr->pbZChange[ubLoop2] = 0; - } + } for (; ubLoop2 < pCurr->ubNumberOfZChanges; ubLoop2++) { pCurr->pbZChange[ubLoop2] = -1; @@ -2163,7 +2181,7 @@ BOOLEAN FiniStructureDB( void ) INT8 GetBlockingStructureInfo( INT16 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLevel, INT8 *pStructHeight, STRUCTURE ** ppTallestStructure, BOOLEAN fWallsBlock ) { - STRUCTURE * pCurrent, *pStructure = NULL; + STRUCTURE * pCurrent, *pStructure = 0; INT16 sDesiredLevel; BOOLEAN fOKStructOnLevel = FALSE; BOOLEAN fMinimumBlockingFound = FALSE; @@ -2177,12 +2195,12 @@ INT8 GetBlockingStructureInfo( INT16 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLe sDesiredLevel = STRUCTURE_ON_ROOF; } - pCurrent = gpWorldLevelData[sGridNo].pStructureHead; + pCurrent = gpWorldLevelData[sGridNo].pStructureHead; // If no struct, return if ( pCurrent == NULL ) { - (*pStructHeight) = StructureHeight( pCurrent ); + (*pStructHeight) = StructureHeight( pCurrent ); (*ppTallestStructure) = NULL; return( NOTHING_BLOCKING ); } @@ -2193,16 +2211,16 @@ INT8 GetBlockingStructureInfo( INT16 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLe if (pCurrent->sCubeOffset == sDesiredLevel ) { fOKStructOnLevel = TRUE; - pStructure = pCurrent; + pStructure = pCurrent; // Turn off if we are on upper level! - if ( pCurrent->fFlags & STRUCTURE_ROOF && bLevel == 1 ) + if ( pCurrent->fFlags & STRUCTURE_ROOF && bLevel == 1 ) { fOKStructOnLevel = FALSE; } // Don't stop FOV for people - if ( pCurrent->fFlags & ( STRUCTURE_CORPSE | STRUCTURE_PERSON ) ) + if ( pCurrent->fFlags & ( STRUCTURE_CORPSE | STRUCTURE_PERSON ) ) { fOKStructOnLevel = FALSE; } @@ -2220,7 +2238,7 @@ INT8 GetBlockingStructureInfo( INT16 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLe // OK! This will be handled by movement costs......! fOKStructOnLevel = FALSE; } - + // CHECK FOR WINDOW if ( pCurrent->fFlags & STRUCTURE_WALLNWINDOW ) { @@ -2228,34 +2246,34 @@ INT8 GetBlockingStructureInfo( INT16 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLe { case OUTSIDE_TOP_LEFT: case INSIDE_TOP_LEFT: - - (*pStructHeight) = StructureHeight( pCurrent ); + + (*pStructHeight) = StructureHeight( pCurrent ); (*ppTallestStructure) = pCurrent; - if ( pCurrent->fFlags & STRUCTURE_OPEN ) - { - return( BLOCKING_TOPLEFT_OPEN_WINDOW ); - } - else - { - return( BLOCKING_TOPLEFT_WINDOW ); - } + if ( pCurrent->fFlags & STRUCTURE_OPEN ) + { + return( BLOCKING_TOPLEFT_OPEN_WINDOW ); + } + else + { + return( BLOCKING_TOPLEFT_WINDOW ); + } break; case OUTSIDE_TOP_RIGHT: case INSIDE_TOP_RIGHT: - (*pStructHeight) = StructureHeight( pCurrent ); + (*pStructHeight) = StructureHeight( pCurrent ); (*ppTallestStructure) = pCurrent; - if ( pCurrent->fFlags & STRUCTURE_OPEN ) - { - return( BLOCKING_TOPRIGHT_OPEN_WINDOW ); - } - else - { - return( BLOCKING_TOPRIGHT_WINDOW ); - } + if ( pCurrent->fFlags & STRUCTURE_OPEN ) + { + return( BLOCKING_TOPRIGHT_OPEN_WINDOW ); + } + else + { + return( BLOCKING_TOPRIGHT_WINDOW ); + } break; } } @@ -2266,10 +2284,10 @@ INT8 GetBlockingStructureInfo( INT16 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLe // If we are not opem, we are full blocking! if ( !(pCurrent->fFlags & STRUCTURE_OPEN ) ) { - (*pStructHeight) = StructureHeight( pCurrent ); + (*pStructHeight) = StructureHeight( pCurrent ); (*ppTallestStructure) = pCurrent; - return( FULL_BLOCKING ); - break; + return( FULL_BLOCKING ); + break; } else { @@ -2278,17 +2296,17 @@ INT8 GetBlockingStructureInfo( INT16 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLe case OUTSIDE_TOP_LEFT: case INSIDE_TOP_LEFT: - (*pStructHeight) = StructureHeight( pCurrent ); + (*pStructHeight) = StructureHeight( pCurrent ); (*ppTallestStructure) = pCurrent; - return( BLOCKING_TOPLEFT_DOOR ); + return( BLOCKING_TOPLEFT_DOOR ); break; case OUTSIDE_TOP_RIGHT: case INSIDE_TOP_RIGHT: - (*pStructHeight) = StructureHeight( pCurrent ); + (*pStructHeight) = StructureHeight( pCurrent ); (*ppTallestStructure) = pCurrent; - return( BLOCKING_TOPRIGHT_DOOR ); + return( BLOCKING_TOPRIGHT_DOOR ); break; } } @@ -2302,20 +2320,20 @@ INT8 GetBlockingStructureInfo( INT16 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLe { if ( fMinimumBlockingFound ) { - (*pStructHeight) = StructureHeight( pStructure ); + (*pStructHeight) = StructureHeight( pStructure ); (*ppTallestStructure) = pStructure; return( BLOCKING_REDUCE_RANGE ); } else { - (*pStructHeight) = StructureHeight( pStructure ); + (*pStructHeight) = StructureHeight( pStructure ); (*ppTallestStructure) = pStructure; return( BLOCKING_NEXT_TILE ); } } else { - (*pStructHeight) = 0; + (*pStructHeight) = 0; (*ppTallestStructure) = NULL; return( NOTHING_BLOCKING ); } @@ -2343,7 +2361,7 @@ UINT8 StructureFlagToType( UINT32 uiFlag ) UINT32 StructureTypeToFlag( UINT8 ubType ) { UINT32 uiFlag = 0x1; - + uiFlag = uiFlag << ubType; return( uiFlag ); } @@ -2355,9 +2373,9 @@ STRUCTURE * FindStructureBySavedInfo( INT16 sGridNo, UINT8 ubType, UINT8 ubWallO uiTypeFlag = StructureTypeToFlag( ubType ); - pCurrent = gpWorldLevelData[sGridNo].pStructureHead; + pCurrent = gpWorldLevelData[sGridNo].pStructureHead; while (pCurrent != NULL) - { + { if (pCurrent->fFlags & uiTypeFlag && pCurrent->ubWallOrientation == ubWallOrientation && ( (bLevel == 0 && pCurrent->sCubeOffset == 0) || (bLevel > 0 && pCurrent->sCubeOffset > 0) ) ) { @@ -2371,31 +2389,31 @@ STRUCTURE * FindStructureBySavedInfo( INT16 sGridNo, UINT8 ubType, UINT8 ubWallO UINT32 GetStructureOpenSound( STRUCTURE * pStructure, BOOLEAN fClose ) { - UINT32 uiSoundID; + UINT32 uiSoundID; - switch( pStructure->pDBStructureRef->pDBStructure->ubArmour ) - { - case MATERIAL_LIGHT_METAL: - case MATERIAL_THICKER_METAL: + switch( pStructure->pDBStructureRef->pDBStructure->ubArmour ) + { + case MATERIAL_LIGHT_METAL: + case MATERIAL_THICKER_METAL: - uiSoundID = OPEN_LOCKER; - break; + uiSoundID = OPEN_LOCKER; + break; - case MATERIAL_WOOD_WALL: - case MATERIAL_PLYWOOD_WALL: - case MATERIAL_FURNITURE: + case MATERIAL_WOOD_WALL: + case MATERIAL_PLYWOOD_WALL: + case MATERIAL_FURNITURE: - uiSoundID = OPEN_WOODEN_BOX; - break; + uiSoundID = OPEN_WOODEN_BOX; + break; - default: - uiSoundID = OPEN_DEFAULT_OPENABLE; - } + default: + uiSoundID = OPEN_DEFAULT_OPENABLE; + } - if ( fClose ) - { - uiSoundID++; - } + if ( fClose ) + { + uiSoundID++; + } - return( uiSoundID ); + return( uiSoundID ); } diff --git a/TileEngine/structure.h b/TileEngine/structure.h index f613ef75..8e357a95 100644 --- a/TileEngine/structure.h +++ b/TileEngine/structure.h @@ -13,7 +13,7 @@ #define BLOCKING_TOPLEFT_DOOR 50 #define BLOCKING_TOPRIGHT_DOOR 60 #define FULL_BLOCKING 70 -#define BLOCKING_TOPLEFT_OPEN_WINDOW 90 +#define BLOCKING_TOPLEFT_OPEN_WINDOW 90 #define BLOCKING_TOPRIGHT_OPEN_WINDOW 100 diff --git a/TileEngine/sysutil.cpp b/TileEngine/sysutil.cpp index a4493999..568fb8a2 100644 --- a/TileEngine/sysutil.cpp +++ b/TileEngine/sysutil.cpp @@ -33,7 +33,7 @@ BOOLEAN InitializeGameVideoObjects( ) UINT16 usWidth; UINT16 usHeight; UINT8 ubBitDepth; - + // Create render buffer GetCurrentVideoSettings( &usWidth, &usHeight, &ubBitDepth ); vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE; @@ -42,7 +42,7 @@ BOOLEAN InitializeGameVideoObjects( ) vs_desc.ubBitDepth = ubBitDepth; CHECKF( AddVideoSurface( &vs_desc, &guiSAVEBUFFER ) ); - + CHECKF( AddVideoSurface( &vs_desc, &guiEXTRABUFFER ) ); gfExtraBuffer = TRUE; diff --git a/TileEngine/tiledef.cpp b/TileEngine/tiledef.cpp index da10f2f8..57734f0b 100644 --- a/TileEngine/tiledef.cpp +++ b/TileEngine/tiledef.cpp @@ -33,577 +33,594 @@ UINT16 gTileTypeStartIndex[ NUMBEROFTILETYPES ]; UINT8 gubEncryptionArray2[ BASE_NUMBER_OF_ROTATION_ARRAYS * 3 ][ NEW_ROTATION_ARRAY_SIZE ] = { - { - 81,168,102,49,61,70,172, - 127,7,148,115,179,10,117, - 253,35,30,218,76,63,116, - 210,241,65,169,157,4,9, - 29,205,160,111,41,213,193, - 190,86,19,207,133,25,190, - 187,131,66,196,253,227,163 - }, - - { - 236,81,128,26,96,137,92, - 120,243,71,33,141,55,2, - 185,185,187,33,230,72,146, - 143,226,21,110,155,226,150, - 111,124,165,242,4,76,201, - 34,223,227,29,202,119,86, - 172,219,8,121,183,148,142 - }, - - { - 73,81,249,189,120,220,96, - 79,28,37,30,199,170,56, - 1,10,70,215,151,190,146, - 156,233,11,251,146,195,134, - 188,140,23,233,137,204,150, - 116,36,97,40,119,204,194, - 55,9,193,18,143,76,209 - }, - - { - 143,200,80,50,154,231,247, - 140,225,72,226,136,2,99, - 209,182,82,146,128,49,3, - 98,101,196,95,136,85,3, - 81,37,131,9,251,79,209, - 101,128,157,238,229,205,178, - 49,161,141,101,175,48,2 - }, - - { - 171,145,70,2,204,252,166, - 194,2,182,182,189,17,205, - 141,80,12,104,215,96,174, - 11,106,181,150,113,213,71, - 209,89,219,35,229,63,18, - 64,237,140,153,224,215,31, - 48,198,108,180,139,233,39 - }, - - { - 31,60,240,131,203,6,32, - 206,137,249,244,36,8,39, - 38,142,11,77,76,18,200, - 76,210,138,106,198,130,22, - 37,178,76,18,233,77,149, - 77,28,47,186,126,72,234, - 254,158,97,10,162,58,93 - }, - - { - 181,91,80,208,248,218,224, - 90,219,176,181,120,63,35, - 132,167,206,85,6,76,223, - 90,15,100,142,121,79,111, - 255,88,196,134,19,72,133, - 40,95,98,232,153,217,182, - 186,109,241,66,128,26,140 - }, - - { - 225,112,22,157,253,52,123, - 209,31,7,165,18,48,83, - 190,53,154,87,188,199,251, - 248,185,48,164,93,44,22, - 165,77,239,88,148,21,155, - 115,203,231,20,170,83,100, - 222,204,57,83,39,241,126 - }, - - { - 51,228,1,96,176,54,89, - 49,157,66,125,113,124,187, - 15,110,70,101,246,16,108, - 156,20,32,200,96,70,170, - 120,198,42,199,79,93,100, - 115,246,113,213,187,66,169, - 129,241,230,251,145,23,29 - }, - - { - 101,67,67,78,108,22,58, - 97,212,30,230,190,142,195, - 243,169,75,210,61,248,180, - 47,75,218,191,5,154,172, - 19,204,224,123,244,251,1, - 94,192,187,249,33,79,120, - 115,109,88,173,40,7,61 - }, - - { - 178,239,46,52,245,141,192, - 77,114,7,54,78,179,195, - 12,213,79,16,184,192,27, - 100,195,74,5,1,15,226, - 223,50,245,39,244,230,85, - 8,196,217,18,128,187,251, - 52,225,65,96,62,49,239 - }, - - { - 94,190,122,81,36,204,171, - 249,104,120,214,89,133,203, - 103,19,163,117,53,59,48, - 182,240,91,101,160,234,121, - 1,78,151,26,3,28,228, - 130,138,137,188,21,167,198, - 197,34,63,165,195,11,206 - }, - - { - 220,164,4,55,94,159,83, - 86,186,109,101,150,60,4, - 146,58,195,221,221,148,11, - 50,155,232,95,39,71,37, - 106,104,102,59,34,41,206, - 61,129,242,45,11,12,85, - 27,184,210,214,165,106,238 - }, - - { - 44,151,227,47,39,93,122, - 237,91,225,164,198,235,53, - 226,36,124,86,57,94,185, - 251,231,101,120,178,168,162, - 218,38,34,33,126,235,196, - 151,30,175,212,103,170,17, - 208,48,75,16,231,10,66 - }, - - { - 90,201,253,44,89,120,222, - 145,82,80,6,63,114,22, - 37,106,33,40,177,4,112, - 152,9,70,250,103,229,235, - 22,147,65,5,164,55,48, - 233,103,112,216,69,34,63, - 31,159,108,38,14,111,132 - }, - - { - 170,177,43,7,140,86,71, - 207,205,235,155,239,88,129, - 53,6,111,139,249,208,172, - 252,34,88,175,213,251,129, - 86,54,242,107,142,144,79, - 96,161,29,171,196,16,17, - 143,205,207,201,47,88,10 - }, - - { - 112,203,199,48,59,153,46, - 130,221,189,166,213,63,67, - 50,190,21,148,242,238,113, - 94,28,228,234,100,103,187, - 95,53,124,69,6,55,6, - 39,204,11,231,64,176,183, - 86,248,21,152,62,205,200 - }, - - { - 133,189,180,176,46,27,167, - 213,33,253,7,209,112,92, - 8,60,122,206,229,50,184, - 207,25,142,34,149,64,234, - 16,252,247,255,22,70,90, - 126,212,16,93,248,50,89, - 194,248,244,230,224,203,62 - }, - - { - 234,231,52,206,57,230,130, - 158,240,79,58,175,226,31, - 213,160,154,113,199,241,84, - 178,66,108,201,41,240,188, - 24,9,50,145,172,208,226, - 100,127,42,93,55,123,245, - 197,102,110,206,48,234,81 - }, - - { - 176,193,13,70,253,101,15, - 39,156,34,168,239,92,185, - 235,239,109,151,115,6,12, - 184,92,210,40,152,12,36, - 57,183,30,136,247,232,152, - 77,59,225,190,208,165,59, - 133,118,100,111,45,20,177 - }, - - { - 242,224,56,94,247,232,26, - 5,5,92,145,57,226,205, - 229,79,2,235,214,16,252, - 135,176,247,51,4,190,78, - 45,155,6,184,220,121,136, - 151,66,29,253,210,166,255, - 75,82,234,246,152,230,26 - }, - - { - 71,92,199,196,224,54,108, - 71,191,224,240,145,231,54, - 198,135,241,115,219,139,162, - 178,253,95,131,237,175,212, - 251,85,23,132,211,92,89, - 14,166,88,5,254,58,254, - 204,5,41,160,72,105,230 - }, - - { - 122,240,140,138,243,30,90, - 95,32,36,108,168,91,94, - 223,161,93,96,118,32,153, - 235,41,222,65,8,181,221, - 196,207,70,218,41,74,198, - 79,6,240,9,240,142,41, - 69,48,113,102,15,168,239 - }, - - { - 33,100,248,1,115,220,254, - 216,113,156,238,175,27,36, - 61,20,255,131,209,181,91, - 40,126,238,227,186,46,228, - 253,64,201,169,138,5,71, - 30,20,119,212,255,127,121, - 170,240,13,84,96,212,210 - }, - - { - 213,91,87,107,184,54,252, - 30,240,165,139,29,230,205, - 42,49,78,136,10,113,160, - 132,246,82,211,200,164,178, - 112,128,15,43,150,157,197, - 88,7,48,126,75,210,2, - 196,228,191,100,25,80,254 - }, - - { - 161,100,85,71,23,7,176, - 250,104,108,62,88,195,110, - 27,102,177,102,127,163,105, - 65,133,21,24,117,155,208, - 39,37,206,154,225,85,176, - 161,128,129,8,6,18,114, - 12,53,53,165,90,177,26 - }, - - { - 36,101,106,199,26,144,50, - 33,13,177,101,149,6,56, - 112,251,141,157,46,152,191, - 112,214,180,104,160,119,202, - 112,75,167,190,116,185,126, - 27,229,214,110,194,128,191, - 19,24,123,193,148,15,69 - }, - - { - 94,179,36,34,168,18,167, - 136,168,214,94,144,245,66, - 241,83,82,74,25,138,106, - 213,7,78,133,181,254,75, - 73,230,160,60,93,65,204, - 19,24,42,169,150,246,86, - 182,211,11,68,108,69,44 - }, - - { - 127,97,243,9,60,97,125, - 234,114,130,69,83,11,157, - 186,44,46,37,4,205,85, - 226,218,134,60,127,11,227, - 55,80,85,109,26,120,25, - 19,60,173,155,255,182,196, - 64,12,112,91,145,131,23 - }, - - { - 166,108,127,147,227,40,125, - 27,76,18,129,108,39,24, - 100,92,205,245,147,59,47, - 190,251,54,204,28,72,76, - 151,24,71,228,181,206,140, - 172,161,216,38,201,154,203, - 141,252,226,169,135,208,183 - }, - - { - 143,63,98,145,133,62,237, - 139,191,134,154,119,47,128, - 196,154,179,252,48,125,206, - 245,106,207,37,87,203,218, - 175,115,73,116,243,111,167, - 231,22,81,34,216,26,234, - 36,136,62,97,46,137,172 - }, - - { - 125,118,61,116,135,101,54, - 15,215,129,210,84,238,226, - 43,56,40,197,174,30,226, - 95,117,34,65,115,192,53, - 67,222,155,83,103,157,18, - 188,158,107,3,133,177,144, - 242,76,231,253,233,120,19 - }, - - { - 65,199,211,202,123,9,216, - 255,223,125,141,168,222,211, - 71,184,143,146,32,40,117, - 82,140,45,50,203,212,115, - 70,166,219,132,100,127,245, - 11,146,38,66,68,135,130, - 71,59,123,29,51,25,249 - }, - - { - 190,161,56,194,42,46,58, - 104,89,177,209,173,64,141, - 117,68,136,202,201,9,67, - 112,209,78,255,233,204,77, - 72,199,213,85,252,204,10, - 221,117,125,115,252,250,46, - 101,111,125,194,139,186,255 - }, - - { - 31,86,139,193,121,21,227, - 136,133,87,49,18,190,230, - 224,29,177,1,149,9,151, - 24,129,123,31,191,15,12, - 186,16,109,103,75,43,16, - 233,124,37,188,28,178,253, - 78,27,215,234,165,87,234 - }, - - { - 170,4,161,157,18,78,11, - 223,148,86,130,184,244,199, - 171,43,229,209,235,160,189, - 23,30,145,9,19,238,221, - 41,113,74,156,184,137,226, - 186,241,135,67,86,193,87, - 95,11,215,251,31,39,80 - }, - - { - 85,223,21,67,248,93,201, - 234,55,255,161,143,221,252, - 110,10,206,90,36,240,21, - 39,237,78,109,10,6,248, - 7,125,44,88,104,198,17, - 195,47,15,140,61,184,167, - 251,182,72,224,147,159,196 - }, - - { - 123,19,239,168,30,154,104, - 60,207,7,69,172,234,176, - 23,31,137,211,242,79,208, - 145,194,222,40,205,220,218, - 202,197,167,163,162,203,119, - 188,250,215,100,172,230,115, - 79,119,241,177,204,213,247 - }, - - { - 164,47,183,166,25,101,55, - 173,255,232,132,251,73,117, - 235,22,152,184,146,245,171, - 192,242,110,184,81,188,135, - 183,224,50,201,210,124,141, - 254,235,54,153,73,133,105, - 251,27,228,131,103,255,205 - }, - - { - 141,53,177,160,37,136,109, - 76,46,150,5,207,226,32, - 160,180,136,191,175,88,111, - 36,245,86,149,192,56,237, - 119,37,117,196,117,115,54, - 203,93,49,208,170,113,233, - 46,143,140,211,5,170,166 - }, - - { - 2,245,56,116,61,150,114, - 76,28,201,61,29,126,115, - 226,153,233,246,200,95,246, - 112,88,77,97,48,22,186, - 203,102,27,213,211,119,235, - 204,147,244,229,21,29,175, - 52,103,21,222,146,203,247 - }, - - { - 203,187,75,44,10,228,157, - 113,156,9,120,202,29,117, - 184,122,64,90,44,31,194, - 191,30,155,50,190,115,208, - 130,69,132,201,246,81,100, - 108,67,226,228,85,112,150, - 243,222,107,49,158,2,199 - }, - - { - 243,107,29,155,25,62,54, - 254,77,132,226,20,121,227, - 78,33,189,27,153,172,240, - 78,17,13,117,133,92,119, - 205,123,66,233,177,141,20, - 2,21,244,85,47,218,7, - 194,47,175,180,65,92,188 - }, - - { - 3,223,186,179,171,112,64, - 226,172,223,83,208,235,215, - 235,20,187,212,96,218,104, - 41,66,233,141,50,89,115, - 102,35,34,147,219,175,203, - 216,121,7,60,166,18,77, - 246,202,53,41,124,33,72 - }, - - { - 115,8,155,105,168,30,132, - 213,57,253,89,18,62,83, - 13,138,197,40,21,218,47, - 156,13,133,209,66,82,67, - 99,176,107,172,80,52,146, - 108,148,19,61,193,41,114, - 250,121,164,57,125,29,35 - }, - - { - 252,37,152,15,100,236,254, - 226,253,7,172,123,6,10, - 139,17,7,254,146,114,216, - 45,95,154,241,252,4,47, - 134,193,201,19,97,207,39, - 144,254,165,157,60,218,144, - 173,48,97,157,173,165,139 - }, - - { - 43,160,148,141,246,225,109, - 162,9,196,127,84,62,238, - 41,82,224,161,103,65,28, - 169,227,113,157,43,7,17, - 78,6,67,179,102,7,16, - 186,197,164,203,143,211,114, - 255,34,222,17,63,184,47 - }, - - { - 202,17,101,190,148,37,65, - 227,178,78,200,202,174,105, - 90,13,220,198,78,74,44, - 37,172,23,111,225,219,23, - 223,119,96,149,12,206,14, - 131,243,148,179,37,120,26, - 168,77,232,223,65,125,224 - }, - - { - 95,160,190,37,50,215,151, - 196,31,209,227,48,62,1, - 249,123,173,73,232,137,16, - 25,39,88,73,51,149,31, - 178,19,34,120,74,112,230, - 97,243,213,31,34,121,189, - 200,255,68,57,75,208,129 - }, - - { - 135,244,60,186,169,184,217, - 128,88,234,225,59,98,108, - 180,189,228,11,222,179,81, - 129,225,122,192,210,117,133, - 142,124,112,228,166,55,29, - 3,133,178,40,47,107,31, - 237,22,170,212,75,186,142 - }, - - { - 254,191,1,222,153,4,115, - 100,149,222,68,112,139,102, - 61,231,195,98,156,181,242, - 24,137,44,136,34,43,76, - 219,155,8,100,28,81,181, - 252,75,50,126,154,46,177, - 11,53,126,99,180,248,57 - }, - - { - 109,132,42,96,40,141,189, - 8,138,168,147,13,172,54, - 196,69,7,241,14,128,187, - 124,187,63,140,172,27,97, - 195,63,235,191,196,254,187, - 234,123,1,174,6,88,6, - 177,247,45,156,120,226,125 - }, - - { - 30,95,46,155,25,137,245, - 52,68,72,74,137,152,60, - 3,26,152,42,137,223,113, - 244,114,229,1,192,53,115, - 90,174,232,119,234,38,77, - 114,195,46,6,151,52,203, - 85,96,69,205,58,68,39 - }, - - { - 30,59,201,53,236,197,180, - 160,196,103,128,88,254,209, - 225,82,124,227,135,183,59, - 172,203,39,154,168,155,144, - 235,35,68,198,41,8,87, - 105,92,255,110,51,167,55, - 248,69,103,157,208,146,105 - }, - - { - 249,205,245,168,172,15,16, - 148,112,53,141,74,5,64, - 218,194,253,75,243,113,168, - 228,80,59,85,44,153,81, - 216,126,55,215,165,220,72, - 217,83,199,41,128,227,208, - 24,3,173,137,18,75,53 - }, - - { - 21,130,191,209,19,213,58, - 123,18,147,139,147,81,14, - 156,255,245,64,150,115,131, - 244,12,61,185,211,155,114, - 151,96,11,203,200,138,71, - 17,26,234,71,106,73,60, - 76,106,210,50,115,45,2 - }, - - { - 55,17,107,248,62,204,196, - 224,45,253,50,10,2,51, - 233,34,73,107,137,68,253, - 235,235,24,99,52,125,184, - 3,3,88,146,80,226,29, - 5,25,66,196,226,87,125, - 83,169,124,218,190,135,197 - }, + { + 81,168,102,49,61,70,172, + 127,7,148,115,179,10,117, + 253,35,30,218,76,63,116, + 210,241,65,169,157,4,9, + 29,205,160,111,41,213,193, + 190,86,19,207,133,25,190, + 187,131,66,196,253,227,163 + }, + + { + 236,81,128,26,96,137,92, + 120,243,71,33,141,55,2, + 185,185,187,33,230,72,146, + 143,226,21,110,155,226,150, + 111,124,165,242,4,76,201, + 34,223,227,29,202,119,86, + 172,219,8,121,183,148,142 + }, + + { + 73,81,249,189,120,220,96, + 79,28,37,30,199,170,56, + 1,10,70,215,151,190,146, + 156,233,11,251,146,195,134, + 188,140,23,233,137,204,150, + 116,36,97,40,119,204,194, + 55,9,193,18,143,76,209 + }, + + { + 143,200,80,50,154,231,247, + 140,225,72,226,136,2,99, + 209,182,82,146,128,49,3, + 98,101,196,95,136,85,3, + 81,37,131,9,251,79,209, + 101,128,157,238,229,205,178, + 49,161,141,101,175,48,2 + }, + + { + 171,145,70,2,204,252,166, + 194,2,182,182,189,17,205, + 141,80,12,104,215,96,174, + 11,106,181,150,113,213,71, + 209,89,219,35,229,63,18, + 64,237,140,153,224,215,31, + 48,198,108,180,139,233,39 + }, + + { + 31,60,240,131,203,6,32, + 206,137,249,244,36,8,39, + 38,142,11,77,76,18,200, + 76,210,138,106,198,130,22, + 37,178,76,18,233,77,149, + 77,28,47,186,126,72,234, + 254,158,97,10,162,58,93 + }, + + { + 181,91,80,208,248,218,224, + 90,219,176,181,120,63,35, + 132,167,206,85,6,76,223, + 90,15,100,142,121,79,111, + 255,88,196,134,19,72,133, + 40,95,98,232,153,217,182, + 186,109,241,66,128,26,140 + }, + + { + 225,112,22,157,253,52,123, + 209,31,7,165,18,48,83, + 190,53,154,87,188,199,251, + 248,185,48,164,93,44,22, + 165,77,239,88,148,21,155, + 115,203,231,20,170,83,100, + 222,204,57,83,39,241,126 + }, + + { + 51,228,1,96,176,54,89, + 49,157,66,125,113,124,187, + 15,110,70,101,246,16,108, + 156,20,32,200,96,70,170, + 120,198,42,199,79,93,100, + 115,246,113,213,187,66,169, + 129,241,230,251,145,23,29 + }, + + { + 101,67,67,78,108,22,58, + 97,212,30,230,190,142,195, + 243,169,75,210,61,248,180, + 47,75,218,191,5,154,172, + 19,204,224,123,244,251,1, + 94,192,187,249,33,79,120, + 115,109,88,173,40,7,61 + }, + + { + 178,239,46,52,245,141,192, + 77,114,7,54,78,179,195, + 12,213,79,16,184,192,27, + 100,195,74,5,1,15,226, + 223,50,245,39,244,230,85, + 8,196,217,18,128,187,251, + 52,225,65,96,62,49,239 + }, + + { + 94,190,122,81,36,204,171, + 249,104,120,214,89,133,203, + 103,19,163,117,53,59,48, + 182,240,91,101,160,234,121, + 1,78,151,26,3,28,228, + 130,138,137,188,21,167,198, + 197,34,63,165,195,11,206 + }, + + { + 220,164,4,55,94,159,83, + 86,186,109,101,150,60,4, + 146,58,195,221,221,148,11, + 50,155,232,95,39,71,37, + 106,104,102,59,34,41,206, + 61,129,242,45,11,12,85, + 27,184,210,214,165,106,238 + }, + + { + 44,151,227,47,39,93,122, + 237,91,225,164,198,235,53, + 226,36,124,86,57,94,185, + 251,231,101,120,178,168,162, + 218,38,34,33,126,235,196, + 151,30,175,212,103,170,17, + 208,48,75,16,231,10,66 + }, + + { + 90,201,253,44,89,120,222, + 145,82,80,6,63,114,22, + 37,106,33,40,177,4,112, + 152,9,70,250,103,229,235, + 22,147,65,5,164,55,48, + 233,103,112,216,69,34,63, + 31,159,108,38,14,111,132 + }, + + { + 170,177,43,7,140,86,71, + 207,205,235,155,239,88,129, + 53,6,111,139,249,208,172, + 252,34,88,175,213,251,129, + 86,54,242,107,142,144,79, + 96,161,29,171,196,16,17, + 143,205,207,201,47,88,10 + }, + + { + 112,203,199,48,59,153,46, + 130,221,189,166,213,63,67, + 50,190,21,148,242,238,113, + 94,28,228,234,100,103,187, + 95,53,124,69,6,55,6, + 39,204,11,231,64,176,183, + 86,248,21,152,62,205,200 + }, + + { + 133,189,180,176,46,27,167, + 213,33,253,7,209,112,92, + 8,60,122,206,229,50,184, + 207,25,142,34,149,64,234, + 16,252,247,255,22,70,90, + 126,212,16,93,248,50,89, + 194,248,244,230,224,203,62 + }, + + { + 234,231,52,206,57,230,130, + 158,240,79,58,175,226,31, + 213,160,154,113,199,241,84, + 178,66,108,201,41,240,188, + 24,9,50,145,172,208,226, + 100,127,42,93,55,123,245, + 197,102,110,206,48,234,81 + }, + + { + 176,193,13,70,253,101,15, + 39,156,34,168,239,92,185, + 235,239,109,151,115,6,12, + 184,92,210,40,152,12,36, + 57,183,30,136,247,232,152, + 77,59,225,190,208,165,59, + 133,118,100,111,45,20,177 + }, + + { + 242,224,56,94,247,232,26, + 5,5,92,145,57,226,205, + 229,79,2,235,214,16,252, + 135,176,247,51,4,190,78, + 45,155,6,184,220,121,136, + 151,66,29,253,210,166,255, + 75,82,234,246,152,230,26 + }, + + { + 71,92,199,196,224,54,108, + 71,191,224,240,145,231,54, + 198,135,241,115,219,139,162, + 178,253,95,131,237,175,212, + 251,85,23,132,211,92,89, + 14,166,88,5,254,58,254, + 204,5,41,160,72,105,230 + }, + + { + 122,240,140,138,243,30,90, + 95,32,36,108,168,91,94, + 223,161,93,96,118,32,153, + 235,41,222,65,8,181,221, + 196,207,70,218,41,74,198, + 79,6,240,9,240,142,41, + 69,48,113,102,15,168,239 + }, + + { + 33,100,248,1,115,220,254, + 216,113,156,238,175,27,36, + 61,20,255,131,209,181,91, + 40,126,238,227,186,46,228, + 253,64,201,169,138,5,71, + 30,20,119,212,255,127,121, + 170,240,13,84,96,212,210 + }, + + { + 213,91,87,107,184,54,252, + 30,240,165,139,29,230,205, + 42,49,78,136,10,113,160, + 132,246,82,211,200,164,178, + 112,128,15,43,150,157,197, + 88,7,48,126,75,210,2, + 196,228,191,100,25,80,254 + }, + + { + 161,100,85,71,23,7,176, + 250,104,108,62,88,195,110, + 27,102,177,102,127,163,105, + 65,133,21,24,117,155,208, + 39,37,206,154,225,85,176, + 161,128,129,8,6,18,114, + 12,53,53,165,90,177,26 + }, + + { + 36,101,106,199,26,144,50, + 33,13,177,101,149,6,56, + 112,251,141,157,46,152,191, + 112,214,180,104,160,119,202, + 112,75,167,190,116,185,126, + 27,229,214,110,194,128,191, + 19,24,123,193,148,15,69 + }, + + { + 94,179,36,34,168,18,167, + 136,168,214,94,144,245,66, + 241,83,82,74,25,138,106, + 213,7,78,133,181,254,75, + 73,230,160,60,93,65,204, + 19,24,42,169,150,246,86, + 182,211,11,68,108,69,44 + }, + + { + 127,97,243,9,60,97,125, + 234,114,130,69,83,11,157, + 186,44,46,37,4,205,85, + 226,218,134,60,127,11,227, + 55,80,85,109,26,120,25, + 19,60,173,155,255,182,196, + 64,12,112,91,145,131,23 + }, + + { + 166,108,127,147,227,40,125, + 27,76,18,129,108,39,24, + 100,92,205,245,147,59,47, + 190,251,54,204,28,72,76, + 151,24,71,228,181,206,140, + 172,161,216,38,201,154,203, + 141,252,226,169,135,208,183 + }, + + { + 143,63,98,145,133,62,237, + 139,191,134,154,119,47,128, + 196,154,179,252,48,125,206, + 245,106,207,37,87,203,218, + 175,115,73,116,243,111,167, + 231,22,81,34,216,26,234, + 36,136,62,97,46,137,172 + }, + + { + 125,118,61,116,135,101,54, + 15,215,129,210,84,238,226, + 43,56,40,197,174,30,226, + 95,117,34,65,115,192,53, + 67,222,155,83,103,157,18, + 188,158,107,3,133,177,144, + 242,76,231,253,233,120,19 + }, + + { + 65,199,211,202,123,9,216, + 255,223,125,141,168,222,211, + 71,184,143,146,32,40,117, + 82,140,45,50,203,212,115, + 70,166,219,132,100,127,245, + 11,146,38,66,68,135,130, + 71,59,123,29,51,25,249 + }, + + { + 190,161,56,194,42,46,58, + 104,89,177,209,173,64,141, + 117,68,136,202,201,9,67, + 112,209,78,255,233,204,77, + 72,199,213,85,252,204,10, + 221,117,125,115,252,250,46, + 101,111,125,194,139,186,255 + }, + + { + 31,86,139,193,121,21,227, + 136,133,87,49,18,190,230, + 224,29,177,1,149,9,151, + 24,129,123,31,191,15,12, + 186,16,109,103,75,43,16, + 233,124,37,188,28,178,253, + 78,27,215,234,165,87,234 + }, + + { + 170,4,161,157,18,78,11, + 223,148,86,130,184,244,199, + 171,43,229,209,235,160,189, + 23,30,145,9,19,238,221, + 41,113,74,156,184,137,226, + 186,241,135,67,86,193,87, + 95,11,215,251,31,39,80 + }, + + { + 85,223,21,67,248,93,201, + 234,55,255,161,143,221,252, + 110,10,206,90,36,240,21, + 39,237,78,109,10,6,248, + 7,125,44,88,104,198,17, + 195,47,15,140,61,184,167, + 251,182,72,224,147,159,196 + }, + + { + 123,19,239,168,30,154,104, + 60,207,7,69,172,234,176, + 23,31,137,211,242,79,208, + 145,194,222,40,205,220,218, + 202,197,167,163,162,203,119, + 188,250,215,100,172,230,115, + 79,119,241,177,204,213,247 + }, + + { + 164,47,183,166,25,101,55, + 173,255,232,132,251,73,117, + 235,22,152,184,146,245,171, + 192,242,110,184,81,188,135, + 183,224,50,201,210,124,141, + 254,235,54,153,73,133,105, + 251,27,228,131,103,255,205 + }, + + { + 141,53,177,160,37,136,109, + 76,46,150,5,207,226,32, + 160,180,136,191,175,88,111, + 36,245,86,149,192,56,237, + 119,37,117,196,117,115,54, + 203,93,49,208,170,113,233, + 46,143,140,211,5,170,166 + }, + + { + 2,245,56,116,61,150,114, + 76,28,201,61,29,126,115, + 226,153,233,246,200,95,246, + 112,88,77,97,48,22,186, + 203,102,27,213,211,119,235, + 204,147,244,229,21,29,175, + 52,103,21,222,146,203,247 + }, + + { + 203,187,75,44,10,228,157, + 113,156,9,120,202,29,117, + 184,122,64,90,44,31,194, + 191,30,155,50,190,115,208, + 130,69,132,201,246,81,100, + 108,67,226,228,85,112,150, + 243,222,107,49,158,2,199 + }, + + { + 243,107,29,155,25,62,54, + 254,77,132,226,20,121,227, + 78,33,189,27,153,172,240, + 78,17,13,117,133,92,119, + 205,123,66,233,177,141,20, + 2,21,244,85,47,218,7, + 194,47,175,180,65,92,188 + }, + + { + 3,223,186,179,171,112,64, + 226,172,223,83,208,235,215, + 235,20,187,212,96,218,104, + 41,66,233,141,50,89,115, + 102,35,34,147,219,175,203, + 216,121,7,60,166,18,77, + 246,202,53,41,124,33,72 + }, + + { + 115,8,155,105,168,30,132, + 213,57,253,89,18,62,83, + 13,138,197,40,21,218,47, + 156,13,133,209,66,82,67, + 99,176,107,172,80,52,146, + 108,148,19,61,193,41,114, + 250,121,164,57,125,29,35 + }, + + { + 252,37,152,15,100,236,254, + 226,253,7,172,123,6,10, + 139,17,7,254,146,114,216, + 45,95,154,241,252,4,47, + 134,193,201,19,97,207,39, + 144,254,165,157,60,218,144, + 173,48,97,157,173,165,139 + }, + + { + 43,160,148,141,246,225,109, + 162,9,196,127,84,62,238, + 41,82,224,161,103,65,28, + 169,227,113,157,43,7,17, + 78,6,67,179,102,7,16, + 186,197,164,203,143,211,114, + 255,34,222,17,63,184,47 + }, + + { + 202,17,101,190,148,37,65, + 227,178,78,200,202,174,105, + 90,13,220,198,78,74,44, + 37,172,23,111,225,219,23, + 223,119,96,149,12,206,14, + 131,243,148,179,37,120,26, + 168,77,232,223,65,125,224 + }, + + { + 95,160,190,37,50,215,151, + 196,31,209,227,48,62,1, + 249,123,173,73,232,137,16, + 25,39,88,73,51,149,31, + 178,19,34,120,74,112,230, + 97,243,213,31,34,121,189, + 200,255,68,57,75,208,129 + }, + + { + 135,244,60,186,169,184,217, + 128,88,234,225,59,98,108, + 180,189,228,11,222,179,81, + 129,225,122,192,210,117,133, + 142,124,112,228,166,55,29, + 3,133,178,40,47,107,31, + 237,22,170,212,75,186,142 + }, + + { + 254,191,1,222,153,4,115, + 100,149,222,68,112,139,102, + 61,231,195,98,156,181,242, + 24,137,44,136,34,43,76, + 219,155,8,100,28,81,181, + 252,75,50,126,154,46,177, + 11,53,126,99,180,248,57 + }, + + { + 109,132,42,96,40,141,189, + 8,138,168,147,13,172,54, + 196,69,7,241,14,128,187, + 124,187,63,140,172,27,97, + 195,63,235,191,196,254,187, + 234,123,1,174,6,88,6, + 177,247,45,156,120,226,125 + }, + + { + 30,95,46,155,25,137,245, + 52,68,72,74,137,152,60, + 3,26,152,42,137,223,113, + 244,114,229,1,192,53,115, + 90,174,232,119,234,38,77, + 114,195,46,6,151,52,203, + 85,96,69,205,58,68,39 + }, + + { + 30,59,201,53,236,197,180, + 160,196,103,128,88,254,209, + 225,82,124,227,135,183,59, + 172,203,39,154,168,155,144, + 235,35,68,198,41,8,87, + 105,92,255,110,51,167,55, + 248,69,103,157,208,146,105 + }, + + { + 249,205,245,168,172,15,16, + 148,112,53,141,74,5,64, + 218,194,253,75,243,113,168, + 228,80,59,85,44,153,81, + 216,126,55,215,165,220,72, + 217,83,199,41,128,227,208, + 24,3,173,137,18,75,53 + }, + + { + 21,130,191,209,19,213,58, + 123,18,147,139,147,81,14, + 156,255,245,64,150,115,131, + 244,12,61,185,211,155,114, + 151,96,11,203,200,138,71, + 17,26,234,71,106,73,60, + 76,106,210,50,115,45,2 + }, + + { + 55,17,107,248,62,204,196, + 224,45,253,50,10,2,51, + 233,34,73,107,137,68,253, + 235,235,24,99,52,125,184, + 3,3,88,146,80,226,29, + 5,25,66,196,226,87,125, + 83,169,124,218,190,135,197 + }, }; +#if 0 +// These values coorespond to TerrainTypeDefines order +UINT8 gTileTypeMovementCost[ NUM_TERRAIN_TYPES ] = +{ + TRAVELCOST_FLAT, // NO_TERRAIN + TRAVELCOST_FLAT, // FLAT GROUND + TRAVELCOST_FLATFLOOR, // FLAT FLOOR + TRAVELCOST_PAVEDROAD, // PAVED ROAD + TRAVELCOST_DIRTROAD, // DIRT ROAD + TRAVELCOST_GRASS, // LOW_GRASS + TRAVELCOST_THICK, // HIGH GRASS + TRAVELCOST_TRAINTRACKS, // TRAIN TRACKS + TRAVELCOST_SHORE, // LOW WATER + TRAVELCOST_KNEEDEEP, // MED WATER + TRAVELCOST_DEEPWATER, // DEEP WATER +}; +#else // These values coorespond to TerrainTypeDefines order UINT8 gTileTypeMovementCost[ NUM_TERRAIN_TYPES ] = { @@ -619,6 +636,7 @@ UINT8 gTileTypeMovementCost[ NUM_TERRAIN_TYPES ] = TRAVELCOST_SHORE, // MED WATER TRAVELCOST_SHORE, // DEEP WATER }; +#endif void CreateTileDatabase( ) @@ -639,10 +657,10 @@ void CreateTileDatabase( ) { // Build start index list - gTileTypeStartIndex[ cnt1 ] = (UINT16)gTileDatabaseSize; + gTileTypeStartIndex[ cnt1 ] = (UINT16)gTileDatabaseSize; NumRegions = TileSurf->vo->usNumberOfObjects; - + // Check for overflow if ( NumRegions > gNumTilesPerType[ cnt1 ] ) { @@ -670,17 +688,12 @@ void CreateTileDatabase( ) { // Only do this if we are within the # of video objects if ( cnt2 < TileSurf->vo->usNumberOfObjects ) - { + { if ( TileSurf->vo->ppZStripInfo[ cnt2 ] != NULL ) { TileElement.uiFlags |= MULTI_Z_TILE; } } - else - { - //Ate test to see if problems is gone - int i = 0; - } } // Structure database stuff! @@ -693,15 +706,15 @@ void CreateTileDatabase( ) if ( TileElement.pDBStructureRef->pDBStructure->fFlags & STRUCTURE_HIDDEN ) { // ATE: These are ignored! - //TileElement.uiFlags |= HIDDEN_TILE; + //TileElement.uiFlags |= HIDDEN_TILE; } } - } + } TileElement.fType = (UINT16)TileSurf->fType; TileElement.ubTerrainID = TileSurf->ubTerrainID; TileElement.usWallOrientation = NO_ORIENTATION; - + if (TileSurf->pAuxData != NULL) { if (TileSurf->pAuxData[cnt2].fFlags & AUX_FULL_TILE) @@ -731,14 +744,14 @@ void CreateTileDatabase( ) } */ - + // set into animation controller array gusAnimatedTiles[ gusNumAnimatedTiles ] = gTileDatabaseSize; gusNumAnimatedTiles++; Assert( gusNumAnimatedTiles <= MAX_ANIMATED_TILES ); - TileElement.uiFlags |= ANIMATED_TILE; + TileElement.uiFlags |= ANIMATED_TILE; } TileElement.usWallOrientation = TileSurf->pAuxData[cnt2].ubWallOrientation; if (TileSurf->pAuxData[cnt2].ubNumberOfTiles > 0) @@ -769,10 +782,10 @@ void CreateTileDatabase( ) TileElement.usRegionIndex = 0; TileElement.hTileSurface = TileSurf->vo; TileElement.fType = (UINT16)TileSurf->fType; - TileElement.ubFullTile = FALSE; + TileElement.ubFullTile = FALSE; TileElement.sOffsetHeight = 0; TileElement.ubFullTile = 0; - TileElement.uiFlags |= UNDERFLOW_FILLER; + TileElement.uiFlags |= UNDERFLOW_FILLER; gTileDatabase[ gTileDatabaseSize ] = TileElement; gTileDatabaseSize++; @@ -794,7 +807,7 @@ void CreateTileDatabase( ) void DeallocateTileDatabase( ) { - INT32 cnt; + INT32 cnt; for( cnt = 0; cnt < NUMBEROFTILES; cnt++ ) { @@ -802,7 +815,7 @@ void DeallocateTileDatabase( ) if ( gTileDatabase[ cnt ].pAnimData != NULL ) { FreeAnimTileData( &gTileDatabase[ cnt ] ); - } + } } gTileDatabaseSize = 0; @@ -878,7 +891,7 @@ BOOLEAN SetLandIndexWithRadius( INT32 iMapIndex, UINT16 usIndex, UINT32 uiNewTyp INT16 sTop, sBottom; INT16 sLeft, sRight; INT16 cnt1, cnt2; - INT32 iNewIndex; + INT32 iNewIndex; BOOLEAN fDoPaste = FALSE; INT32 leftmost; //BOOLEAN fNewCommand; @@ -901,8 +914,8 @@ BOOLEAN SetLandIndexWithRadius( INT32 iMapIndex, UINT16 usIndex, UINT32 uiNewTyp { iNewIndex = iMapIndex + ( WORLD_COLS * cnt1 ) + cnt2; - if ( iNewIndex >=0 && iNewIndex < WORLD_MAX && - iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) ) + if ( iNewIndex >=0 && iNewIndex < WORLD_MAX && + iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) ) { if ( fReplace ) @@ -916,10 +929,10 @@ BOOLEAN SetLandIndexWithRadius( INT32 iMapIndex, UINT16 usIndex, UINT32 uiNewTyp fDoPaste = TRUE; } } - - if ( fDoPaste && ((uiNewType >= FIRSTFLOOR && uiNewType <= LASTFLOOR) || - ((uiNewType < FIRSTFLOOR || uiNewType > LASTFLOOR) && - !TypeRangeExistsInLandLayer( iNewIndex, FIRSTFLOOR, LASTFLOOR, &Dummy ))) ) + + if ( fDoPaste && ((uiNewType >= FIRSTFLOOR && uiNewType <= LASTFLOOR) || + ((uiNewType < FIRSTFLOOR || uiNewType > LASTFLOOR) && + !TypeRangeExistsInLandLayer( iNewIndex, FIRSTFLOOR, LASTFLOOR, &Dummy ))) ) { SetLandIndex( iNewIndex, usIndex, uiNewType, FALSE ); } @@ -949,11 +962,11 @@ BOOLEAN GetTypeLandLevel( UINT32 iMapIndex, UINT32 uiNewType, UINT8 *pubLevel ) if ( fTileType == uiNewType ) { *pubLevel = level; - return( TRUE ); + return( TRUE ); } } - + level++; pLand = pLand->pNext; } @@ -998,7 +1011,7 @@ BOOLEAN GetTypeSubIndexFromTileIndex( UINT32 uiCheckType, UINT16 usIndex, UINT16 // Tile database is zero-based, Type indecies are 1-based! - *pusSubIndex = 0xffff; + *pusSubIndex = 0xffff; CHECKF ( uiCheckType < NUMBEROFTILETYPES ); @@ -1019,7 +1032,7 @@ BOOLEAN GetTypeSubIndexFromTileIndexChar( UINT32 uiCheckType, UINT16 usIndex, UI return( TRUE ); } - + BOOLEAN GetTileIndexFromTypeSubIndex( UINT32 uiCheckType, UINT16 usSubIndex, UINT16 *pusTileIndex ) { // Tile database is zero-based, Type indecies are 1-based! @@ -1053,7 +1066,7 @@ BOOLEAN GetTileType( UINT16 usIndex, UINT32 *puiType ) { TILE_ELEMENT TileElem; - *puiType = 0xffffffff; + *puiType = 0xffffffff; CHECKF( usIndex != NO_TILE ); CHECKF( usIndex < NUMBEROFTILES ); //lal bugfix @@ -1108,7 +1121,7 @@ BOOLEAN LandTypeHeigher( UINT32 uiDestType, UINT32 uiSrcType ) BOOLEAN AnyHeigherLand( UINT32 iMapIndex, UINT32 uiSrcType, UINT8 *pubLastLevel ) { - LEVELNODE *pLand = NULL; + LEVELNODE *pLand = NULL; UINT8 ubSrcLogHeight=0; UINT32 fTileType=0; UINT8 level = 0; @@ -1122,10 +1135,10 @@ BOOLEAN AnyHeigherLand( UINT32 iMapIndex, UINT32 uiSrcType, UINT8 *pubLastLevel // Check that src type is not head if ( GetTypeLandLevel( iMapIndex, uiSrcType, &ubSrcTypeLevel ) ) { - if ( ubSrcTypeLevel == LANDHEAD ) - { + if ( ubSrcTypeLevel == LANDHEAD ) + { return( FALSE ); - } + } } // Look through all objects and Search for type @@ -1137,7 +1150,7 @@ BOOLEAN AnyHeigherLand( UINT32 iMapIndex, UINT32 uiSrcType, UINT8 *pubLastLevel GetTileType( pLand->usIndex, &fTileType ); if ( gTileTypeLogicalHeight[ fTileType ] > ubSrcLogHeight ) - { + { *pubLastLevel = level; fFound = TRUE; } @@ -1156,7 +1169,7 @@ BOOLEAN AnyHeigherLand( UINT32 iMapIndex, UINT32 uiSrcType, UINT8 *pubLastLevel BOOLEAN AnyLowerLand( UINT32 iMapIndex, UINT32 uiSrcType, UINT8 *pubLastLevel ) { - LEVELNODE *pLand = NULL; + LEVELNODE *pLand = NULL; UINT8 ubSrcLogHeight; UINT32 fTileType=0; UINT8 level = 0; @@ -1177,7 +1190,7 @@ BOOLEAN AnyLowerLand( UINT32 iMapIndex, UINT32 uiSrcType, UINT8 *pubLastLevel ) GetTileType( pLand->usIndex, &fTileType ); if ( gTileTypeLogicalHeight[ fTileType ] < ubSrcLogHeight ) - { + { *pubLastLevel = level; return( TRUE ); } @@ -1210,7 +1223,7 @@ BOOLEAN GetWallOrientation( UINT16 usIndex, UINT16 *pusWallOrientation ) TILE_ELEMENT TileElem; *pusWallOrientation = 0xffff; - + CHECKF( usIndex != NO_TILE ); CHECKF( usIndex < NUMBEROFTILES ); //lal bugfix @@ -1256,8 +1269,8 @@ BOOLEAN ContainsWallOrientation( INT32 iMapIndex, UINT32 uiType, UINT16 usWallOr } //Kris: This function returns two special types if there are two walls -//sharing the same tile. This case only happens with the exterior and -//interior bottom corners. Otherwise, it returns the orientation of the +//sharing the same tile. This case only happens with the exterior and +//interior bottom corners. Otherwise, it returns the orientation of the //first wall encountered -- not that there should be duplicate walls... UINT8 CalculateWallOrientationsAtGridNo( INT32 iMapIndex ) { @@ -1323,9 +1336,10 @@ void FreeAnimTileData( TILE_ELEMENT *pTileElem ) { // Free frames list MemFree( pTileElem->pAnimData->pusFrames ); - + // Free frames MemFree( pTileElem->pAnimData ); } } + diff --git a/TileEngine/tiledef.h b/TileEngine/tiledef.h index 3103f733..e3f6bf63 100644 --- a/TileEngine/tiledef.h +++ b/TileEngine/tiledef.h @@ -27,7 +27,7 @@ #define AFRAME_TILE 0x00002000 #define HIDDEN_TILE 0x00004000 #define CLIFFHANG_TILE 0x00008000 -#define UNDERFLOW_FILLER 0x00010000 +#define UNDERFLOW_FILLER 0x00010000 #define Z_AWARE_DYNAMIC_TILE 0x00020000 @@ -35,8 +35,8 @@ #define WALL_HEIGHT 50 -//Kris: Added the last two bottom corner orientation values. This won't effect -//current code, but there is new code that makes use of this. A function called +//Kris: Added the last two bottom corner orientation values. This won't effect +//current code, but there is new code that makes use of this. A function called //UINT8 CalculateWallOrientationsAtGridNo( INT32 iMapIndex ) that will look at all //of the walls and return the last two wall orientations for tiles with two proper //wall pieces. @@ -71,7 +71,7 @@ typedef struct { HVOBJECT vo; UINT32 fType; - AuxObjectData * pAuxData; + AuxObjectData * pAuxData; RelTileLoc * pTileLocData; STRUCTURE_FILE_REF * pStructureFileRef; UINT8 ubTerrainID; @@ -113,12 +113,12 @@ typedef struct // Land and overlay type // struct // { - INT16 sOffsetHeight; - UINT16 usWallOrientation; - UINT8 ubFullTile; + INT16 sOffsetHeight; + UINT16 usWallOrientation; + UINT8 ubFullTile; - // For animated tiles - TILE_ANIMATION_DATA *pAnimData; + // For animated tiles + TILE_ANIMATION_DATA *pAnimData; // }; // }; @@ -171,7 +171,7 @@ UINT8 GetLandLevelDepth( UINT32 iMapIndex ); BOOLEAN SetLandIndexWithRadius( INT32 iMapIndex, UINT16 usIndex, UINT32 uiNewType, UINT8 ubRadius, BOOLEAN fReplace ); -BOOLEAN LandTypeHeigher( UINT32 uiDestType, UINT32 uiSrcType ); +BOOLEAN LandTypeHeigher( UINT32 uiDestType, UINT32 uiSrcType ); BOOLEAN MoveLandIndexToTop( UINT32 iMapIndex, UINT16 usIndex ); diff --git a/TileEngine/worlddef.cpp b/TileEngine/worlddef.cpp index 4eea227b..d21b284e 100644 --- a/TileEngine/worlddef.cpp +++ b/TileEngine/worlddef.cpp @@ -23,9 +23,9 @@ #include "lighting.h" #include "structure.h" #include "vobject.h" - #include "Soldier Control.h" + #include "isometric utils.h" - #include "Interactive Tiles.h" + #include "Interactive Tiles.h" #include "utilities.h" #include "overhead.h" #include "points.h" @@ -45,7 +45,7 @@ #include "Keys.h" #include "Map Information.h" #include "Exit Grids.h" - #include "Summary Info.h" + #include "Summary Info.h" #include "Animated ProgressBar.h" #include "pathai.h" #include "EditorBuildings.h" @@ -67,21 +67,26 @@ #include "meanwhile.h" #endif -#define SET_MOVEMENTCOST( a, b, c, d ) ( ( gubWorldMovementCosts[ a ][ b ][ c ] < d ) ? ( gubWorldMovementCosts[ a ][ b ][ c ] = d ) : 0 ); -#define FORCE_SET_MOVEMENTCOST( a, b, c, d ) ( gubWorldMovementCosts[ a ][ b ][ c ] = d ) -#define SET_CURRMOVEMENTCOST( a, b ) SET_MOVEMENTCOST( usGridNo, a, 0, b ) +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; -#define TEMP_FILE_FOR_TILESET_CHANGE "jatileS34.dat" -#define MAP_FULLSOLDIER_SAVED 0x00000001 -#define MAP_WORLDONLY_SAVED 0x00000002 -#define MAP_WORLDLIGHTS_SAVED 0x00000004 -#define MAP_WORLDITEMS_SAVED 0x00000008 -#define MAP_EXITGRIDS_SAVED 0x00000010 -#define MAP_DOORTABLE_SAVED 0x00000020 -#define MAP_EDGEPOINTS_SAVED 0x00000040 -#define MAP_AMBIENTLIGHTLEVEL_SAVED 0x00000080 -#define MAP_NPCSCHEDULES_SAVED 0x00000100 +#define SET_MOVEMENTCOST( a, b, c, d ) ( ( gubWorldMovementCosts[ a ][ b ][ c ] < d ) ? ( gubWorldMovementCosts[ a ][ b ][ c ] = d ) : 0 ); +#define FORCE_SET_MOVEMENTCOST( a, b, c, d ) ( gubWorldMovementCosts[ a ][ b ][ c ] = d ) +#define SET_CURRMOVEMENTCOST( a, b ) SET_MOVEMENTCOST( sGridNo, a, 0, b ) + +#define TEMP_FILE_FOR_TILESET_CHANGE "jatileS34.dat" + +#define MAP_FULLSOLDIER_SAVED 0x00000001 +#define MAP_WORLDONLY_SAVED 0x00000002 +#define MAP_WORLDLIGHTS_SAVED 0x00000004 +#define MAP_WORLDITEMS_SAVED 0x00000008 +#define MAP_EXITGRIDS_SAVED 0x00000010 +#define MAP_DOORTABLE_SAVED 0x00000020 +#define MAP_EDGEPOINTS_SAVED 0x00000040 +#define MAP_AMBIENTLIGHTLEVEL_SAVED 0x00000080 +#define MAP_NPCSCHEDULES_SAVED 0x00000100 #ifdef JA2EDITOR extern BOOLEAN gfErrorCatch; @@ -93,7 +98,7 @@ CHAR8 gubFilename[200]; // TEMP BOOLEAN gfForceLoadPlayers = FALSE; CHAR8 gzForceLoadFile[100 ]; -BOOLEAN gfForceLoad = FALSE; +BOOLEAN gfForceLoad = FALSE; UINT8 gubCurrentLevel; INT32 giCurrentTilesetID = 0; @@ -106,7 +111,7 @@ UINT32 gCurrentBackground = FIRSTTEXTURE; extern UINT32 guiMemTotal; -CHAR8 TileSurfaceFilenames[NUMBEROFTILETYPES][32]; +CHAR8 TileSurfaceFilenames[NUMBEROFTILETYPES][32]; INT8 gbNewTileSurfaceLoaded[ NUMBEROFTILETYPES ]; void SetAllNewTileSurfacesLoaded( BOOLEAN fNew ) @@ -231,9 +236,9 @@ void DOIT( ) if ( pStruct->usIndex >= DEBRISWOOD1 && pStruct->usIndex <= DEBRISWEEDS10 ) { - AddObjectToHead( uiLoop, pStruct->usIndex ); + AddObjectToHead( uiLoop, pStruct->usIndex ); - RemoveStruct( uiLoop, pStruct->usIndex ); + RemoveStruct( uiLoop, pStruct->usIndex ); } pStruct = pNewStruct; @@ -253,7 +258,7 @@ BOOLEAN InitializeWorld( ) gSurfaceMemUsage = 0; giCurrentTilesetID = -1; - // DB Adds the _8 to the names if we're in 8 bit mode. + // DB Adds the _8 to the names if we're in 8 bit mode. //ProcessTilesetNamesForBPP(); // Memset tileset list @@ -328,7 +333,7 @@ BOOLEAN ReloadTilesetSlot( INT32 iSlot ) BOOLEAN LoadTileSurfaces( char ppTileSurfaceFilenames[][32], UINT8 ubTilesetID ) { - SGPFILENAME cTemp; + SGPFILENAME cTemp; UINT32 uiLoop; UINT32 uiPercentage; @@ -356,7 +361,7 @@ BOOLEAN LoadTileSurfaces( char ppTileSurfaceFilenames[][32], UINT8 ubTilesetID ) } else { - for (uiLoop = 0; uiLoop < NUMBEROFTILETYPES; uiLoop++) + for (uiLoop = 0; uiLoop < NUMBEROFTILETYPES; uiLoop++) strcpy( TileSurfaceFilenames[uiLoop], ppTileSurfaceFilenames[uiLoop] );//(ppTileSurfaceFilenames + (65 * uiLoop)) ); } @@ -370,7 +375,7 @@ BOOLEAN LoadTileSurfaces( char ppTileSurfaceFilenames[][32], UINT8 ubTilesetID ) //uiFillColor = Get16BPPColor(FROMRGB( 100, 0, 0 )); // load the tile surfaces SetRelativeStartAndEndPercentage( 0, 1, 35, L"Tile Surfaces" ); - for (uiLoop = 0; uiLoop < NUMBEROFTILETYPES; uiLoop++) + for (uiLoop = 0; uiLoop < NUMBEROFTILETYPES; uiLoop++) { uiPercentage = (uiLoop * 100) / (NUMBEROFTILETYPES-1); @@ -401,7 +406,7 @@ BOOLEAN LoadTileSurfaces( char ppTileSurfaceFilenames[][32], UINT8 ubTilesetID ) // Use default if (AddTileSurface( TileSurfaceFilenames[uiLoop], uiLoop, ubTilesetID, FALSE ) == FALSE) { - DestroyTileSurfaces( ); + DestroyTileSurfaces( ); return( FALSE ); } @@ -416,7 +421,7 @@ BOOLEAN LoadTileSurfaces( char ppTileSurfaceFilenames[][32], UINT8 ubTilesetID ) strcpy( TileSurfaceFilenames[uiLoop], cTemp ); if (AddTileSurface( cTemp, uiLoop, ubTilesetID, TRUE ) == FALSE) { - DestroyTileSurfaces( ); + DestroyTileSurfaces( ); return( FALSE ); } } @@ -440,12 +445,12 @@ BOOLEAN LoadTileSurfaces( char ppTileSurfaceFilenames[][32], UINT8 ubTilesetID ) strcpy( TileSurfaceFilenames[uiLoop], gTilesets[ TLS_GENERIC_1 ].TileSurfaceFilenames[uiLoop] );//(ppTileSurfaceFilenames + (65 * uiLoop)) ); if (AddTileSurface( gTilesets[ TLS_GENERIC_1 ].TileSurfaceFilenames[uiLoop], uiLoop, TLS_GENERIC_1, FALSE ) == FALSE) { - DestroyTileSurfaces( ); + DestroyTileSurfaces( ); return( FALSE ); } } else - { + { gbSameAsDefaultSurfaceUsed[ uiLoop ] = TRUE; } } @@ -456,10 +461,10 @@ BOOLEAN LoadTileSurfaces( char ppTileSurfaceFilenames[][32], UINT8 ubTilesetID ) return( TRUE ); } -BOOLEAN AddTileSurface( STR8 cFilename, UINT32 ubType, UINT8 ubTilesetID, BOOLEAN fGetFromRoot ) +BOOLEAN AddTileSurface( STR8 cFilename, UINT32 ubType, UINT8 ubTilesetID, BOOLEAN fGetFromRoot ) { // Add tile surface - PTILE_IMAGERY TileSurf; + PTILE_IMAGERY TileSurf; CHAR8 cFileBPP[128]; CHAR8 cAdjustedFile[ 128 ]; @@ -479,11 +484,11 @@ BOOLEAN AddTileSurface( STR8 cFilename, UINT32 ubType, UINT8 ubTilesetID, BOOLE if ( !fGetFromRoot ) { // Adjust for tileset position - sprintf( cAdjustedFile, "TILESETS\\%d\\%s", ubTilesetID, cFileBPP ); + sprintf( cAdjustedFile, "TILESETS\\%d\\%s", ubTilesetID, cFileBPP ); } else { - sprintf( cAdjustedFile, "%s", cFileBPP ); + sprintf( cAdjustedFile, "%s", cFileBPP ); } TileSurf = LoadTileSurface( cAdjustedFile ); @@ -509,19 +514,19 @@ BOOLEAN AddTileSurface( STR8 cFilename, UINT32 ubType, UINT8 ubTilesetID, BOOLE gbNewTileSurfaceLoaded[ ubType ] = TRUE; - return( TRUE ); + return( TRUE ); } extern BOOLEAN gfLoadShadeTablesFromTextFile; -void BuildTileShadeTables( ) +void BuildTileShadeTables( ) { HWFILE hfile; STRING512 DataDir; STRING512 ShadeTableDir; UINT32 uiLoop; - CHAR8 cRootFile[ 128 ]; - BOOLEAN fForceRebuildForSlot = FALSE; + CHAR8 cRootFile[ 128 ]; + BOOLEAN fForceRebuildForSlot = FALSE; #ifdef JA2TESTVERSION UINT32 uiStartTime; @@ -541,7 +546,7 @@ void BuildTileShadeTables( ) sprintf( ShadeTableDir, "%s\\ShadeTables", DataDir ); if( !SetFileManCurrentDirectory( ShadeTableDir ) ) { - AssertMsg( 0, "Can't set the directory to Data\\ShadeTable. Kris' big problem!" ); + AssertMsg( 0, "Can't set the directory to Data\\ShadeTable. Kris' big problem!" ); } hfile = FileOpen( "IgnoreShadeTables.txt", FILE_ACCESS_READ, FALSE ); if( hfile ) @@ -555,9 +560,9 @@ void BuildTileShadeTables( ) } //now, determine if we are using specialized colors. if( gpLightColors[0].peRed || gpLightColors[0].peGreen || gpLightColors[0].peBlue ) - { //we are, which basically means we force build the shadetables. However, the one + { //we are, which basically means we force build the shadetables. However, the one //exception is if we are loading another map and the colors are the same. - if( gpLightColors[0].peRed != ubLastRed || + if( gpLightColors[0].peRed != ubLastRed || gpLightColors[0].peGreen != ubLastGreen || gpLightColors[0].peBlue != ubLastBlue ) { //Same tileset, but colors are different, so set things up to regenerate the shadetables. @@ -583,24 +588,24 @@ void BuildTileShadeTables( ) #ifdef JA2EDITOR if( gbNewTileSurfaceLoaded[ uiLoop ] || gfEditorForceShadeTableRebuild ) #else - if( gbNewTileSurfaceLoaded[ uiLoop ] ) - #endif + if( gbNewTileSurfaceLoaded[ uiLoop ] ) + #endif { - fForceRebuildForSlot = FALSE; + fForceRebuildForSlot = FALSE; - GetRootName( cRootFile, TileSurfaceFilenames[ uiLoop ] ); + GetRootName( cRootFile, TileSurfaceFilenames[ uiLoop ] ); - if ( strcmp( cRootFile, "grass2" ) == 0 ) - { - fForceRebuildForSlot = TRUE; - } + if ( strcmp( cRootFile, "grass2" ) == 0 ) + { + fForceRebuildForSlot = TRUE; + } #ifdef JA2TESTVERSION uiNumImagesReloaded++; #endif RenderProgressBar( 0, uiLoop * 100 / NUMBEROFTILETYPES ); CreateTilePaletteTables( gTileSurfaceArray[ uiLoop ]->vo, uiLoop, fForceRebuildForSlot ); - } + } } } @@ -704,7 +709,7 @@ void CompileWorldTerrainIDs( void ) } } -void CompileTileMovementCosts( UINT16 usGridNo ) +void CompileTileMovementCosts( INT16 sGridNo ) { UINT8 ubTerrainID; TILE_ELEMENT TileElem; @@ -718,22 +723,22 @@ void CompileTileMovementCosts( UINT16 usGridNo ) /* */ - if ( GridNoOnVisibleWorldTile( usGridNo ) ) + if ( GridNoOnVisibleWorldTile( sGridNo ) ) { // check for land of a different height in adjacent locations - for ( ubDirLoop = 0; ubDirLoop < 8; ubDirLoop++ ) + for ( ubDirLoop = 0; ubDirLoop < 8; ubDirLoop++ ) { - if ( gpWorldLevelData[ usGridNo ].sHeight != - gpWorldLevelData[ usGridNo + DirectionInc( ubDirLoop ) ].sHeight ) + if ( gpWorldLevelData[ sGridNo ].sHeight != + gpWorldLevelData[ sGridNo + DirectionInc( ubDirLoop ) ].sHeight ) { SET_CURRMOVEMENTCOST( ubDirLoop, TRAVELCOST_OBSTACLE ); } } // check for exit grids - if ( ExitGridAtGridNo( usGridNo ) ) + if ( ExitGridAtGridNo( sGridNo ) ) { - for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++) + for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++) { SET_CURRMOVEMENTCOST( ubDirLoop, TRAVELCOST_EXITGRID ); } @@ -743,21 +748,21 @@ void CompileTileMovementCosts( UINT16 usGridNo ) } else { - for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++) + for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++) { - SET_MOVEMENTCOST( usGridNo, ubDirLoop, 0, TRAVELCOST_OFF_MAP ); - SET_MOVEMENTCOST( usGridNo, ubDirLoop, 1, TRAVELCOST_OFF_MAP ); + SET_MOVEMENTCOST( sGridNo, ubDirLoop, 0, TRAVELCOST_OFF_MAP ); + SET_MOVEMENTCOST( sGridNo, ubDirLoop, 1, TRAVELCOST_OFF_MAP ); } - if (gpWorldLevelData[usGridNo].pStructureHead == NULL) + if (gpWorldLevelData[sGridNo].pStructureHead == NULL) { return; } } - if (gpWorldLevelData[usGridNo].pStructureHead != NULL) + if (gpWorldLevelData[sGridNo].pStructureHead != NULL) { // structures in tile // consider the land - pLand = gpWorldLevelData[ usGridNo ].pLandHead; + pLand = gpWorldLevelData[ sGridNo ].pLandHead; if ( pLand != NULL ) { // Set TEMPORARY cost here @@ -765,16 +770,16 @@ void CompileTileMovementCosts( UINT16 usGridNo ) TileElem = gTileDatabase[ pLand->usIndex ]; // Get terrain type - ubTerrainID = gpWorldLevelData[usGridNo].ubTerrainID; // = GetTerrainType( (INT16)usGridNo ); + ubTerrainID = gpWorldLevelData[sGridNo].ubTerrainID; // = GetTerrainType( (INT16)sGridNo ); for (ubDirLoop=0; ubDirLoop < NUM_WORLD_DIRECTIONS; ubDirLoop++) { SET_CURRMOVEMENTCOST( ubDirLoop, gTileTypeMovementCost[ ubTerrainID ] ); - } + } } // now consider all structures - pStructure = gpWorldLevelData[usGridNo].pStructureHead; + pStructure = gpWorldLevelData[sGridNo].pStructureHead; fStructuresOnRoof = FALSE; do { @@ -833,14 +838,14 @@ void CompileTileMovementCosts( UINT16 usGridNo ) SET_CURRMOVEMENTCOST( WEST, TRAVELCOST_OBSTACLE ); SET_CURRMOVEMENTCOST( NORTHWEST, TRAVELCOST_OBSTACLE ); // set values for the tiles EXITED from this location - FORCE_SET_MOVEMENTCOST( usGridNo - WORLD_COLS, NORTH, 0, TRAVELCOST_NONE ); - SET_MOVEMENTCOST( usGridNo - WORLD_COLS + 1, NORTHEAST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + 1, EAST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); - FORCE_SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTH, 0, TRAVELCOST_NONE ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS - 1, SOUTHWEST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo - 1, WEST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo - WORLD_COLS - 1, NORTHWEST, 0, TRAVELCOST_OBSTACLE ); + FORCE_SET_MOVEMENTCOST( sGridNo - WORLD_COLS, NORTH, 0, TRAVELCOST_NONE ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS + 1, NORTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + 1, EAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); + FORCE_SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTH, 0, TRAVELCOST_NONE ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS - 1, SOUTHWEST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo - 1, WEST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS - 1, NORTHWEST, 0, TRAVELCOST_OBSTACLE ); break; case OUTSIDE_TOP_RIGHT: @@ -855,28 +860,28 @@ void CompileTileMovementCosts( UINT16 usGridNo ) SET_CURRMOVEMENTCOST( WEST, TRAVELCOST_FENCE ); SET_CURRMOVEMENTCOST( NORTHWEST, TRAVELCOST_OBSTACLE ); // set values for the tiles EXITED from this location - SET_MOVEMENTCOST( usGridNo - WORLD_COLS, NORTH, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo - WORLD_COLS + 1, NORTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS, NORTH, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS + 1, NORTHEAST, 0, TRAVELCOST_OBSTACLE ); // make sure no obstacle costs exists before changing path cost to 0 - if ( gubWorldMovementCosts[ usGridNo + 1 ][ EAST ][ 0 ] < TRAVELCOST_BLOCKED ) + if ( gubWorldMovementCosts[ sGridNo + 1 ][ EAST ][ 0 ] < TRAVELCOST_BLOCKED ) { - FORCE_SET_MOVEMENTCOST( usGridNo + 1, EAST, 0, TRAVELCOST_NONE ); + FORCE_SET_MOVEMENTCOST( sGridNo + 1, EAST, 0, TRAVELCOST_NONE ); } - SET_MOVEMENTCOST( usGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTH, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS - 1, SOUTHWEST, 0, TRAVELCOST_OBSTACLE ); - if ( gubWorldMovementCosts[ usGridNo - 1 ][ WEST ][ 0 ] < TRAVELCOST_BLOCKED ) + SET_MOVEMENTCOST( sGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTH, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS - 1, SOUTHWEST, 0, TRAVELCOST_OBSTACLE ); + if ( gubWorldMovementCosts[ sGridNo - 1 ][ WEST ][ 0 ] < TRAVELCOST_BLOCKED ) { - FORCE_SET_MOVEMENTCOST( usGridNo - 1, WEST, 0, TRAVELCOST_NONE ); + FORCE_SET_MOVEMENTCOST( sGridNo - 1, WEST, 0, TRAVELCOST_NONE ); } - SET_MOVEMENTCOST( usGridNo - WORLD_COLS - 1, NORTHWEST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS - 1, NORTHWEST, 0, TRAVELCOST_OBSTACLE ); break; default: // corners aren't jumpable for (ubDirLoop=0; ubDirLoop < NUM_WORLD_DIRECTIONS; ubDirLoop++) { - SET_CURRMOVEMENTCOST( ubDirLoop, TRAVELCOST_OBSTACLE ); + SET_CURRMOVEMENTCOST( ubDirLoop, TRAVELCOST_OBSTACLE ); } break; } @@ -885,33 +890,33 @@ void CompileTileMovementCosts( UINT16 usGridNo ) { for (ubDirLoop=0; ubDirLoop < NUM_WORLD_DIRECTIONS; ubDirLoop++) { - SET_CURRMOVEMENTCOST( ubDirLoop, TRAVELCOST_OBSTACLE ); + SET_CURRMOVEMENTCOST( ubDirLoop, TRAVELCOST_OBSTACLE ); } - if ( FindStructure( (UINT16) (usGridNo - WORLD_COLS), STRUCTURE_OBSTACLE ) == FALSE && FindStructure( (UINT16)(usGridNo + WORLD_COLS), STRUCTURE_OBSTACLE ) == FALSE ) + if ( FindStructure( (INT16) (sGridNo - WORLD_COLS), STRUCTURE_OBSTACLE ) == FALSE && FindStructure( (INT16)(sGridNo + WORLD_COLS), STRUCTURE_OBSTACLE ) == FALSE ) { - FORCE_SET_MOVEMENTCOST( usGridNo, NORTH, 0, TRAVELCOST_FENCE ); - FORCE_SET_MOVEMENTCOST( usGridNo, SOUTH, 0, TRAVELCOST_FENCE ); + FORCE_SET_MOVEMENTCOST( sGridNo, NORTH, 0, TRAVELCOST_FENCE ); + FORCE_SET_MOVEMENTCOST( sGridNo, SOUTH, 0, TRAVELCOST_FENCE ); } - if ( FindStructure( (UINT16)(usGridNo - 1), STRUCTURE_OBSTACLE ) == FALSE && FindStructure( (UINT16)(usGridNo + 1), STRUCTURE_OBSTACLE ) == FALSE ) + if ( FindStructure( (INT16)(sGridNo - 1), STRUCTURE_OBSTACLE ) == FALSE && FindStructure( (INT16)(sGridNo + 1), STRUCTURE_OBSTACLE ) == FALSE ) { - FORCE_SET_MOVEMENTCOST( usGridNo, EAST, 0, TRAVELCOST_FENCE ); - FORCE_SET_MOVEMENTCOST( usGridNo, WEST, 0, TRAVELCOST_FENCE ); + FORCE_SET_MOVEMENTCOST( sGridNo, EAST, 0, TRAVELCOST_FENCE ); + FORCE_SET_MOVEMENTCOST( sGridNo, WEST, 0, TRAVELCOST_FENCE ); } } else if ( (pStructure->fFlags & STRUCTURE_CAVEWALL ) ) - { + { for (ubDirLoop=0; ubDirLoop < NUM_WORLD_DIRECTIONS; ubDirLoop++) { - SET_CURRMOVEMENTCOST( ubDirLoop, TRAVELCOST_CAVEWALL ); + SET_CURRMOVEMENTCOST( ubDirLoop, TRAVELCOST_CAVEWALL ); } - } + } else { for (ubDirLoop=0; ubDirLoop < NUM_WORLD_DIRECTIONS; ubDirLoop++) { - SET_CURRMOVEMENTCOST( ubDirLoop, TRAVELCOST_OBSTACLE ); + SET_CURRMOVEMENTCOST( ubDirLoop, TRAVELCOST_OBSTACLE ); } } } @@ -929,34 +934,34 @@ void CompileTileMovementCosts( UINT16 usGridNo ) SET_CURRMOVEMENTCOST( NORTHWEST, TRAVELCOST_WALL ); SET_CURRMOVEMENTCOST( WEST, TRAVELCOST_DOOR_CLOSED_HERE ); SET_CURRMOVEMENTCOST( SOUTHWEST, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + 1, NORTHEAST, 0, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + 1, EAST, 0, TRAVELCOST_DOOR_CLOSED_W ); - SET_MOVEMENTCOST( usGridNo + 1, SOUTHEAST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + 1, NORTHEAST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + 1, EAST, 0, TRAVELCOST_DOOR_CLOSED_W ); + SET_MOVEMENTCOST( sGridNo + 1, SOUTHEAST, 0, TRAVELCOST_WALL ); // corner - SET_MOVEMENTCOST( usGridNo + 1 + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + 1 + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_WALL ); } else { // door SET_CURRMOVEMENTCOST( NORTH, TRAVELCOST_DOOR_OPEN_W ); SET_CURRMOVEMENTCOST( NORTHWEST, TRAVELCOST_DOOR_OPEN_W ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTH, 0, TRAVELCOST_DOOR_OPEN_NW ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_DOOR_OPEN_NW ); - SET_MOVEMENTCOST( usGridNo + 1, NORTHEAST, 0, TRAVELCOST_DOOR_OPEN_W_W ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_DOOR_OPEN_NW_W ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTH, 0, TRAVELCOST_DOOR_OPEN_NW ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_DOOR_OPEN_NW ); + SET_MOVEMENTCOST( sGridNo + 1, NORTHEAST, 0, TRAVELCOST_DOOR_OPEN_W_W ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_DOOR_OPEN_NW_W ); } break; case INSIDE_TOP_RIGHT: // doorpost SET_CURRMOVEMENTCOST( NORTHWEST, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + 1,NORTHEAST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + 1,NORTHEAST, 0, TRAVELCOST_WALL ); // door SET_CURRMOVEMENTCOST( NORTH, TRAVELCOST_DOOR_OPEN_HERE ); SET_CURRMOVEMENTCOST( NORTHEAST, TRAVELCOST_DOOR_OPEN_HERE ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTH, 0, TRAVELCOST_DOOR_OPEN_N ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_DOOR_OPEN_N ); - SET_MOVEMENTCOST( usGridNo - 1, NORTHWEST, 0, TRAVELCOST_DOOR_OPEN_E ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS - 1, SOUTHWEST, 0, TRAVELCOST_DOOR_OPEN_NE ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTH, 0, TRAVELCOST_DOOR_OPEN_N ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_DOOR_OPEN_N ); + SET_MOVEMENTCOST( sGridNo - 1, NORTHWEST, 0, TRAVELCOST_DOOR_OPEN_E ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS - 1, SOUTHWEST, 0, TRAVELCOST_DOOR_OPEN_NE ); break; default: @@ -975,36 +980,36 @@ void CompileTileMovementCosts( UINT16 usGridNo ) SET_CURRMOVEMENTCOST( NORTHWEST, TRAVELCOST_WALL ); SET_CURRMOVEMENTCOST( NORTH, TRAVELCOST_DOOR_CLOSED_HERE ); SET_CURRMOVEMENTCOST( NORTHEAST, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTH, 0, TRAVELCOST_DOOR_CLOSED_N ) - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_WALL ); ; + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTH, 0, TRAVELCOST_DOOR_CLOSED_N ) + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_WALL ); ; // corner - SET_MOVEMENTCOST( usGridNo + 1 ,NORTHEAST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + 1 ,NORTHEAST, 0, TRAVELCOST_WALL ); } else { // door SET_CURRMOVEMENTCOST( NORTHWEST, TRAVELCOST_DOOR_OPEN_N ); SET_CURRMOVEMENTCOST( WEST, TRAVELCOST_DOOR_OPEN_N ); - SET_MOVEMENTCOST( usGridNo + 1, EAST, 0, TRAVELCOST_DOOR_OPEN_NW ); - SET_MOVEMENTCOST( usGridNo + 1, NORTHEAST, 0, TRAVELCOST_DOOR_OPEN_NW ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_DOOR_OPEN_N_N ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_DOOR_OPEN_NW_N ); + SET_MOVEMENTCOST( sGridNo + 1, EAST, 0, TRAVELCOST_DOOR_OPEN_NW ); + SET_MOVEMENTCOST( sGridNo + 1, NORTHEAST, 0, TRAVELCOST_DOOR_OPEN_NW ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_DOOR_OPEN_N_N ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_DOOR_OPEN_NW_N ); } break; case INSIDE_TOP_LEFT: // doorpost SET_CURRMOVEMENTCOST( NORTHEAST, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_WALL ); // corner - SET_MOVEMENTCOST( usGridNo + 1 ,NORTHEAST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + 1 ,NORTHEAST, 0, TRAVELCOST_WALL ); // door SET_CURRMOVEMENTCOST( WEST, TRAVELCOST_DOOR_OPEN_HERE ); SET_CURRMOVEMENTCOST( SOUTHWEST, TRAVELCOST_DOOR_OPEN_HERE ); - SET_MOVEMENTCOST( usGridNo + 1, EAST, 0, TRAVELCOST_DOOR_OPEN_W ); - SET_MOVEMENTCOST( usGridNo + 1, SOUTHEAST, 0, TRAVELCOST_DOOR_OPEN_W ); - SET_MOVEMENTCOST( usGridNo - WORLD_COLS, NORTHWEST, 0, TRAVELCOST_DOOR_OPEN_S ); - SET_MOVEMENTCOST( usGridNo - WORLD_COLS + 1, NORTHEAST, 0, TRAVELCOST_DOOR_OPEN_SW ); + SET_MOVEMENTCOST( sGridNo + 1, EAST, 0, TRAVELCOST_DOOR_OPEN_W ); + SET_MOVEMENTCOST( sGridNo + 1, SOUTHEAST, 0, TRAVELCOST_DOOR_OPEN_W ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS, NORTHWEST, 0, TRAVELCOST_DOOR_OPEN_S ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS + 1, NORTHEAST, 0, TRAVELCOST_DOOR_OPEN_SW ); break; default: // door with no orientation specified!? @@ -1019,13 +1024,13 @@ void CompileTileMovementCosts( UINT16 usGridNo ) case INSIDE_TOP_LEFT: // doorframe post in one corner of each of the tiles if (pStructure->fFlags & STRUCTURE_BASE_TILE) - { + { SET_CURRMOVEMENTCOST( NORTHWEST, TRAVELCOST_WALL ); SET_CURRMOVEMENTCOST( NORTH, TRAVELCOST_DOOR_CLOSED_HERE ); SET_CURRMOVEMENTCOST( NORTHEAST, TRAVELCOST_DOOR_CLOSED_HERE ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTH, 0, TRAVELCOST_DOOR_CLOSED_N ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_DOOR_CLOSED_N ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTH, 0, TRAVELCOST_DOOR_CLOSED_N ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_DOOR_CLOSED_N ); } else @@ -1033,9 +1038,9 @@ void CompileTileMovementCosts( UINT16 usGridNo ) SET_CURRMOVEMENTCOST( NORTHWEST, TRAVELCOST_DOOR_CLOSED_HERE ); SET_CURRMOVEMENTCOST( NORTH, TRAVELCOST_DOOR_CLOSED_HERE ); SET_CURRMOVEMENTCOST( NORTHEAST, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_DOOR_CLOSED_N); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTH, 0, TRAVELCOST_DOOR_CLOSED_N); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_DOOR_CLOSED_N); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTH, 0, TRAVELCOST_DOOR_CLOSED_N); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_WALL ); } break; @@ -1043,14 +1048,14 @@ void CompileTileMovementCosts( UINT16 usGridNo ) case INSIDE_TOP_RIGHT: // doorframe post in one corner of each of the tiles if (pStructure->fFlags & STRUCTURE_BASE_TILE) - { + { SET_CURRMOVEMENTCOST( NORTHWEST, TRAVELCOST_WALL ); SET_CURRMOVEMENTCOST( WEST, TRAVELCOST_DOOR_CLOSED_HERE ); SET_CURRMOVEMENTCOST( SOUTHWEST, TRAVELCOST_DOOR_CLOSED_HERE ); - SET_MOVEMENTCOST( usGridNo + 1, NORTHEAST, 0, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + 1, EAST, 0, TRAVELCOST_DOOR_CLOSED_W ); - SET_MOVEMENTCOST( usGridNo + 1, SOUTHEAST, 0, TRAVELCOST_DOOR_CLOSED_W ); + SET_MOVEMENTCOST( sGridNo + 1, NORTHEAST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + 1, EAST, 0, TRAVELCOST_DOOR_CLOSED_W ); + SET_MOVEMENTCOST( sGridNo + 1, SOUTHEAST, 0, TRAVELCOST_DOOR_CLOSED_W ); } else { @@ -1058,9 +1063,9 @@ void CompileTileMovementCosts( UINT16 usGridNo ) SET_CURRMOVEMENTCOST( WEST, TRAVELCOST_DOOR_CLOSED_HERE ); SET_CURRMOVEMENTCOST( SOUTHWEST, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + 1, NORTHEAST, 0, TRAVELCOST_DOOR_CLOSED_W ); - SET_MOVEMENTCOST( usGridNo + 1, EAST, 0, TRAVELCOST_DOOR_CLOSED_W ); - SET_MOVEMENTCOST( usGridNo + 1, SOUTHEAST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + 1, NORTHEAST, 0, TRAVELCOST_DOOR_CLOSED_W ); + SET_MOVEMENTCOST( sGridNo + 1, EAST, 0, TRAVELCOST_DOOR_CLOSED_W ); + SET_MOVEMENTCOST( sGridNo + 1, SOUTHEAST, 0, TRAVELCOST_WALL ); } break; } @@ -1077,32 +1082,32 @@ void CompileTileMovementCosts( UINT16 usGridNo ) SET_CURRMOVEMENTCOST( NORTH, TRAVELCOST_DOOR_CLOSED_HERE ); SET_CURRMOVEMENTCOST( NORTHWEST, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTH, 0, TRAVELCOST_DOOR_CLOSED_N ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTH, 0, TRAVELCOST_DOOR_CLOSED_N ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_WALL ); // DO CORNERS - SET_MOVEMENTCOST( usGridNo - 1, NORTHWEST, 0, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + 1, NORTHEAST, 0, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS - 1, SOUTHWEST, 0, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo - 1, NORTHWEST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + 1, NORTHEAST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS - 1, SOUTHWEST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_WALL ); //SET_CURRMOVEMENTCOST( NORTHEAST, TRAVELCOST_OBSTACLE ); //SET_CURRMOVEMENTCOST( NORTHWEST, TRAVELCOST_OBSTACLE ); - //SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); - //SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_OBSTACLE ); + //SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); + //SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_OBSTACLE ); // corner - //SET_MOVEMENTCOST( usGridNo + 1 ,NORTHEAST, 0, TRAVELCOST_OBSTACLE ); + //SET_MOVEMENTCOST( sGridNo + 1 ,NORTHEAST, 0, TRAVELCOST_OBSTACLE ); } else if (!(pStructure->fFlags & STRUCTURE_SLIDINGDOOR)) { // door SET_CURRMOVEMENTCOST( NORTHEAST, TRAVELCOST_WALL ); SET_CURRMOVEMENTCOST( EAST, TRAVELCOST_DOOR_OPEN_N ); - SET_MOVEMENTCOST( usGridNo - 1, WEST, 0, TRAVELCOST_DOOR_OPEN_NE ); - SET_MOVEMENTCOST( usGridNo - 1, NORTHWEST, 0, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_DOOR_OPEN_N_N ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS - 1, SOUTHWEST, 0, TRAVELCOST_DOOR_OPEN_NE_N ); + SET_MOVEMENTCOST( sGridNo - 1, WEST, 0, TRAVELCOST_DOOR_OPEN_NE ); + SET_MOVEMENTCOST( sGridNo - 1, NORTHWEST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_DOOR_OPEN_N_N ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS - 1, SOUTHWEST, 0, TRAVELCOST_DOOR_OPEN_NE_N ); } break; @@ -1111,32 +1116,32 @@ void CompileTileMovementCosts( UINT16 usGridNo ) SET_CURRMOVEMENTCOST( NORTH, TRAVELCOST_DOOR_CLOSED_HERE ); SET_CURRMOVEMENTCOST( NORTHWEST, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTH, 0, TRAVELCOST_DOOR_CLOSED_N ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTH, 0, TRAVELCOST_DOOR_CLOSED_N ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_OBSTACLE ); // DO CORNERS - SET_MOVEMENTCOST( usGridNo - 1, NORTHWEST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + 1, NORTHEAST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS - 1, SOUTHWEST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo - 1, NORTHWEST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + 1, NORTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS - 1, SOUTHWEST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); // doorframe //SET_CURRMOVEMENTCOST( NORTHEAST, TRAVELCOST_OBSTACLE ); //SET_CURRMOVEMENTCOST( NORTHWEST, TRAVELCOST_OBSTACLE ); - //SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); - //SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_OBSTACLE ); + //SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); + //SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_OBSTACLE ); // corner - //SET_MOVEMENTCOST( usGridNo + 1 ,NORTHEAST, 0, TRAVELCOST_OBSTACLE ); + //SET_MOVEMENTCOST( sGridNo + 1 ,NORTHEAST, 0, TRAVELCOST_OBSTACLE ); // door if (!(pStructure->fFlags & STRUCTURE_SLIDINGDOOR)) { SET_CURRMOVEMENTCOST( EAST, TRAVELCOST_DOOR_OPEN_HERE ); SET_CURRMOVEMENTCOST( SOUTHEAST, TRAVELCOST_DOOR_OPEN_HERE ); - SET_MOVEMENTCOST( usGridNo - 1, WEST, 0, TRAVELCOST_DOOR_OPEN_E ); - SET_MOVEMENTCOST( usGridNo - 1, SOUTHWEST, 0, TRAVELCOST_DOOR_OPEN_E ); - SET_MOVEMENTCOST( usGridNo - WORLD_COLS, NORTHEAST, 0, TRAVELCOST_DOOR_OPEN_S ); - SET_MOVEMENTCOST( usGridNo - WORLD_COLS - 1, NORTHWEST, 0, TRAVELCOST_DOOR_OPEN_SE ); + SET_MOVEMENTCOST( sGridNo - 1, WEST, 0, TRAVELCOST_DOOR_OPEN_E ); + SET_MOVEMENTCOST( sGridNo - 1, SOUTHWEST, 0, TRAVELCOST_DOOR_OPEN_E ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS, NORTHEAST, 0, TRAVELCOST_DOOR_OPEN_S ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS - 1, NORTHWEST, 0, TRAVELCOST_DOOR_OPEN_SE ); } break; @@ -1147,31 +1152,31 @@ void CompileTileMovementCosts( UINT16 usGridNo ) SET_CURRMOVEMENTCOST( WEST, TRAVELCOST_DOOR_CLOSED_HERE ); SET_CURRMOVEMENTCOST( NORTHWEST, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + 1, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + 1, EAST, 0, TRAVELCOST_DOOR_CLOSED_W ); - SET_MOVEMENTCOST( usGridNo + 1, NORTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + 1, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + 1, EAST, 0, TRAVELCOST_DOOR_CLOSED_W ); + SET_MOVEMENTCOST( sGridNo + 1, NORTHEAST, 0, TRAVELCOST_OBSTACLE ); // DO CORNERS - SET_MOVEMENTCOST( usGridNo - WORLD_COLS + 1, NORTHEAST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo - WORLD_COLS, NORTHWEST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS + 1, NORTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS, NORTHWEST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_OBSTACLE ); //SET_CURRMOVEMENTCOST( SOUTHWEST, TRAVELCOST_OBSTACLE ); //SET_CURRMOVEMENTCOST( NORTHWEST, TRAVELCOST_OBSTACLE ); - //SET_MOVEMENTCOST( usGridNo + 1, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); - //SET_MOVEMENTCOST( usGridNo + 1, NORTHEAST, 0, TRAVELCOST_OBSTACLE ); + //SET_MOVEMENTCOST( sGridNo + 1, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); + //SET_MOVEMENTCOST( sGridNo + 1, NORTHEAST, 0, TRAVELCOST_OBSTACLE ); // corner - //SET_MOVEMENTCOST( usGridNo + 1 + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); + //SET_MOVEMENTCOST( sGridNo + 1 + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); } else if (!(pStructure->fFlags & STRUCTURE_SLIDINGDOOR)) { // door SET_CURRMOVEMENTCOST( SOUTH, TRAVELCOST_DOOR_OPEN_W ); SET_CURRMOVEMENTCOST( SOUTHWEST, TRAVELCOST_DOOR_OPEN_W ); - SET_MOVEMENTCOST( usGridNo - WORLD_COLS, NORTH, 0, TRAVELCOST_DOOR_OPEN_SW ); - SET_MOVEMENTCOST( usGridNo - WORLD_COLS, NORTHWEST, 0, TRAVELCOST_DOOR_OPEN_SW ); - SET_MOVEMENTCOST( usGridNo + 1, SOUTHEAST, 0, TRAVELCOST_DOOR_OPEN_W_W ); - SET_MOVEMENTCOST( usGridNo - WORLD_COLS + 1, NORTHEAST, 0, TRAVELCOST_DOOR_OPEN_SW_W ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS, NORTH, 0, TRAVELCOST_DOOR_OPEN_SW ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS, NORTHWEST, 0, TRAVELCOST_DOOR_OPEN_SW ); + SET_MOVEMENTCOST( sGridNo + 1, SOUTHEAST, 0, TRAVELCOST_DOOR_OPEN_W_W ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS + 1, NORTHEAST, 0, TRAVELCOST_DOOR_OPEN_SW_W ); } break; @@ -1180,34 +1185,34 @@ void CompileTileMovementCosts( UINT16 usGridNo ) SET_CURRMOVEMENTCOST( WEST, TRAVELCOST_DOOR_CLOSED_HERE ); SET_CURRMOVEMENTCOST( NORTHWEST, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + 1, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + 1, EAST, 0, TRAVELCOST_DOOR_CLOSED_W ); - SET_MOVEMENTCOST( usGridNo + 1, NORTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + 1, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + 1, EAST, 0, TRAVELCOST_DOOR_CLOSED_W ); + SET_MOVEMENTCOST( sGridNo + 1, NORTHEAST, 0, TRAVELCOST_OBSTACLE ); // DO CORNERS - SET_MOVEMENTCOST( usGridNo - WORLD_COLS + 1, NORTHEAST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo - WORLD_COLS, NORTHWEST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS + 1, NORTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS, NORTHWEST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_OBSTACLE ); // doorframe /* SET_CURRMOVEMENTCOST( SOUTHWEST, TRAVELCOST_OBSTACLE ); SET_CURRMOVEMENTCOST( NORTHWEST, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + 1,SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + 1,NORTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + 1,SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + 1,NORTHEAST, 0, TRAVELCOST_OBSTACLE ); // corner - SET_MOVEMENTCOST( usGridNo - WORLD_COLS, NORTHWEST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS, NORTHWEST, 0, TRAVELCOST_OBSTACLE ); */ if (!(pStructure->fFlags & STRUCTURE_SLIDINGDOOR)) { // door SET_CURRMOVEMENTCOST( SOUTH, TRAVELCOST_DOOR_OPEN_HERE ); SET_CURRMOVEMENTCOST( SOUTHEAST, TRAVELCOST_DOOR_OPEN_HERE ); - SET_MOVEMENTCOST( usGridNo - WORLD_COLS, NORTH, 0, TRAVELCOST_DOOR_OPEN_S ); - SET_MOVEMENTCOST( usGridNo - WORLD_COLS, NORTHEAST, 0, TRAVELCOST_DOOR_OPEN_S ); - SET_MOVEMENTCOST( usGridNo - 1, SOUTHWEST, 0, TRAVELCOST_DOOR_OPEN_E ); - SET_MOVEMENTCOST( usGridNo - WORLD_COLS - 1, NORTHWEST, 0, TRAVELCOST_DOOR_OPEN_SE ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS, NORTH, 0, TRAVELCOST_DOOR_OPEN_S ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS, NORTHEAST, 0, TRAVELCOST_DOOR_OPEN_S ); + SET_MOVEMENTCOST( sGridNo - 1, SOUTHWEST, 0, TRAVELCOST_DOOR_OPEN_E ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS - 1, NORTHWEST, 0, TRAVELCOST_DOOR_OPEN_SE ); } break; @@ -1226,15 +1231,15 @@ void CompileTileMovementCosts( UINT16 usGridNo ) SET_CURRMOVEMENTCOST( NORTH, TRAVELCOST_DOOR_CLOSED_HERE ); SET_CURRMOVEMENTCOST( NORTHWEST, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTH, 0, TRAVELCOST_DOOR_CLOSED_N ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTH, 0, TRAVELCOST_DOOR_CLOSED_N ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_OBSTACLE ); // DO CORNERS - SET_MOVEMENTCOST( usGridNo - 1, NORTHWEST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + 1, NORTHEAST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS - 1, SOUTHWEST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo - 1, NORTHWEST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + 1, NORTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS - 1, SOUTHWEST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); break; case OUTSIDE_TOP_RIGHT: @@ -1243,15 +1248,15 @@ void CompileTileMovementCosts( UINT16 usGridNo ) SET_CURRMOVEMENTCOST( WEST, TRAVELCOST_DOOR_CLOSED_HERE ); SET_CURRMOVEMENTCOST( NORTHWEST, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + 1, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + 1, EAST, 0, TRAVELCOST_DOOR_CLOSED_W ); - SET_MOVEMENTCOST( usGridNo + 1, NORTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + 1, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + 1, EAST, 0, TRAVELCOST_DOOR_CLOSED_W ); + SET_MOVEMENTCOST( sGridNo + 1, NORTHEAST, 0, TRAVELCOST_OBSTACLE ); // DO CORNERS - SET_MOVEMENTCOST( usGridNo - WORLD_COLS + 1, NORTHEAST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo - WORLD_COLS, NORTHWEST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS + 1, NORTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS, NORTHWEST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_OBSTACLE ); break; default: @@ -1272,15 +1277,15 @@ void CompileTileMovementCosts( UINT16 usGridNo ) SET_CURRMOVEMENTCOST( NORTHEAST, TRAVELCOST_WALL ); SET_CURRMOVEMENTCOST( NORTH, TRAVELCOST_WALL ); SET_CURRMOVEMENTCOST( NORTHWEST, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTH, 0, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHEAST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTH, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_WALL ); // DO CORNERS - SET_MOVEMENTCOST( usGridNo - 1, NORTHWEST, 0, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + 1, NORTHEAST, 0, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS - 1, SOUTHWEST, 0, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo - 1, NORTHWEST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + 1, NORTHEAST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS - 1, SOUTHWEST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_WALL ); break; case OUTSIDE_TOP_RIGHT: @@ -1288,28 +1293,28 @@ void CompileTileMovementCosts( UINT16 usGridNo ) SET_CURRMOVEMENTCOST( SOUTHWEST, TRAVELCOST_WALL ); SET_CURRMOVEMENTCOST( WEST, TRAVELCOST_WALL ); SET_CURRMOVEMENTCOST( NORTHWEST, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + 1, SOUTHEAST, 0, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + 1, EAST, 0, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + 1, NORTHEAST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + 1, SOUTHEAST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + 1, EAST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + 1, NORTHEAST, 0, TRAVELCOST_WALL ); // DO CORNERS - SET_MOVEMENTCOST( usGridNo - WORLD_COLS + 1, NORTHEAST, 0, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo - WORLD_COLS, NORTHWEST, 0, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_WALL ); - SET_MOVEMENTCOST( usGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS + 1, NORTHEAST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo - WORLD_COLS, NORTHWEST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS + 1, SOUTHEAST, 0, TRAVELCOST_WALL ); + SET_MOVEMENTCOST( sGridNo + WORLD_COLS, SOUTHWEST, 0, TRAVELCOST_WALL ); break; default: // wall with no orientation specified!? break; } - } + } } else { if (!(pStructure->fFlags & STRUCTURE_PASSABLE || pStructure->fFlags & STRUCTURE_NORMAL_ROOF)) { - // DNS: Try a fix to prevent people from "permanently" blocking the roof + // DNS: Try a fix to prevent people from "permanently" blocking the roof if (!(pStructure->fFlags & STRUCTURE_PERSON)) { fStructuresOnRoof = TRUE; @@ -1320,28 +1325,28 @@ void CompileTileMovementCosts( UINT16 usGridNo ) } while (pStructure != NULL); // HIGHEST LAYER - if ((gpWorldLevelData[ usGridNo ].pRoofHead != NULL)) - { + if ((gpWorldLevelData[ sGridNo ].pRoofHead != NULL)) + { if (!fStructuresOnRoof) { - for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++) + for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++) { - SET_MOVEMENTCOST( usGridNo, ubDirLoop, 1, TRAVELCOST_FLAT ); + SET_MOVEMENTCOST( sGridNo, ubDirLoop, 1, TRAVELCOST_FLAT ); } } else { - for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++) + for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++) { - SET_MOVEMENTCOST( usGridNo, ubDirLoop, 1, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo, ubDirLoop, 1, TRAVELCOST_OBSTACLE ); } } } else - { - for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++) + { + for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++) { - SET_MOVEMENTCOST( usGridNo, ubDirLoop, 1, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo, ubDirLoop, 1, TRAVELCOST_OBSTACLE ); } } } @@ -1350,14 +1355,14 @@ void CompileTileMovementCosts( UINT16 usGridNo ) // consider just the land // Get terrain type - ubTerrainID = gpWorldLevelData[usGridNo].ubTerrainID; // = GetTerrainType( (INT16)usGridNo ); + ubTerrainID = gpWorldLevelData[sGridNo].ubTerrainID; // = GetTerrainType( (INT16)sGridNo ); for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++) { - SET_MOVEMENTCOST( usGridNo ,ubDirLoop, 0, gTileTypeMovementCost[ ubTerrainID ] ); + SET_MOVEMENTCOST( sGridNo ,ubDirLoop, 0, gTileTypeMovementCost[ ubTerrainID ] ); } /* - pLand = gpWorldLevelData[ usGridNo ].pLandHead; + pLand = gpWorldLevelData[ sGridNo ].pLandHead; if ( pLand != NULL ) { // Set cost here @@ -1365,27 +1370,27 @@ void CompileTileMovementCosts( UINT16 usGridNo ) TileElem = gTileDatabase[ pLand->usIndex ]; // Get terrain type - ubTerrainID = GetTerrainType( (INT16)usGridNo ); + ubTerrainID = GetTerrainType( (INT16)sGridNo ); for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++) { - SET_MOVEMENTCOST( usGridNo ,ubDirLoop, 0, gTileTypeMovementCost[ ubTerrainID ] ); + SET_MOVEMENTCOST( sGridNo ,ubDirLoop, 0, gTileTypeMovementCost[ ubTerrainID ] ); } } */ // HIGHEST LEVEL - if (gpWorldLevelData[ usGridNo ].pRoofHead != NULL) - { - for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++) + if (gpWorldLevelData[ sGridNo ].pRoofHead != NULL) + { + for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++) { - SET_MOVEMENTCOST( usGridNo, ubDirLoop, 1, TRAVELCOST_FLAT ); + SET_MOVEMENTCOST( sGridNo, ubDirLoop, 1, TRAVELCOST_FLAT ); } } else - { - for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++) + { + for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++) { - SET_MOVEMENTCOST( usGridNo, ubDirLoop, 1, TRAVELCOST_OBSTACLE ); + SET_MOVEMENTCOST( sGridNo, ubDirLoop, 1, TRAVELCOST_OBSTACLE ); } } } @@ -1395,25 +1400,25 @@ void CompileTileMovementCosts( UINT16 usGridNo ) void RecompileLocalMovementCosts( INT16 sCentreGridNo ) { - INT16 usGridNo; + INT16 sGridNo; INT16 sGridX, sGridY; INT16 sCentreGridX, sCentreGridY; - INT8 bDirLoop; + INT8 bDirLoop; ConvertGridNoToXY( sCentreGridNo, &sCentreGridX, &sCentreGridY ); for( sGridY = sCentreGridY - LOCAL_RADIUS; sGridY < sCentreGridY + LOCAL_RADIUS; sGridY++ ) { for( sGridX = sCentreGridX - LOCAL_RADIUS; sGridX < sCentreGridX + LOCAL_RADIUS; sGridX++ ) { - usGridNo = MAPROWCOLTOPOS( sGridY, sGridX ); + sGridNo = MAPROWCOLTOPOS( sGridY, sGridX ); // times 2 for 2 levels, times 2 for UINT16s -// memset( &(gubWorldMovementCosts[usGridNo]), 0, MAXDIR * 2 * 2 ); - if (usGridNo < WORLD_MAX) +// memset( &(gubWorldMovementCosts[sGridNo]), 0, MAXDIR * 2 * 2 ); + if (sGridNo < WORLD_MAX) { for( bDirLoop = 0; bDirLoop < MAXDIR; bDirLoop++) { - gubWorldMovementCosts[usGridNo][bDirLoop][0] = 0; - gubWorldMovementCosts[usGridNo][bDirLoop][1] = 0; + gubWorldMovementCosts[sGridNo][bDirLoop][0] = 0; + gubWorldMovementCosts[sGridNo][bDirLoop][1] = 0; } } } @@ -1425,10 +1430,10 @@ void RecompileLocalMovementCosts( INT16 sCentreGridNo ) { for( sGridX = sCentreGridX - LOCAL_RADIUS - 1; sGridX < sCentreGridX + LOCAL_RADIUS + 1; sGridX++ ) { - usGridNo = MAPROWCOLTOPOS( sGridY, sGridX ); - if (usGridNo < WORLD_MAX) + sGridNo = MAPROWCOLTOPOS( sGridY, sGridX ); + if (sGridNo < WORLD_MAX) { - CompileTileMovementCosts( usGridNo ); + CompileTileMovementCosts( sGridNo ); } } } @@ -1437,10 +1442,10 @@ void RecompileLocalMovementCosts( INT16 sCentreGridNo ) void RecompileLocalMovementCostsFromRadius( INT16 sCentreGridNo, INT8 bRadius ) { - INT16 usGridNo; + INT16 sGridNo; INT16 sGridX, sGridY; INT16 sCentreGridX, sCentreGridY; - INT8 bDirLoop; + INT8 bDirLoop; ConvertGridNoToXY( sCentreGridNo, &sCentreGridX, &sCentreGridY ); if (bRadius == 0) @@ -1459,15 +1464,15 @@ void RecompileLocalMovementCostsFromRadius( INT16 sCentreGridNo, INT8 bRadius ) { for( sGridX = sCentreGridX - bRadius; sGridX < sCentreGridX + bRadius; sGridX++ ) { - usGridNo = MAPROWCOLTOPOS( sGridY, sGridX ); + sGridNo = MAPROWCOLTOPOS( sGridY, sGridX ); // times 2 for 2 levels, times 2 for UINT16s - // memset( &(gubWorldMovementCosts[usGridNo]), 0, MAXDIR * 2 * 2 ); - if (usGridNo < WORLD_MAX) + // memset( &(gubWorldMovementCosts[sGridNo]), 0, MAXDIR * 2 * 2 ); + if (sGridNo < WORLD_MAX) { for( bDirLoop = 0; bDirLoop < MAXDIR; bDirLoop++) { - gubWorldMovementCosts[usGridNo][bDirLoop][0] = 0; - gubWorldMovementCosts[usGridNo][bDirLoop][1] = 0; + gubWorldMovementCosts[sGridNo][bDirLoop][0] = 0; + gubWorldMovementCosts[sGridNo][bDirLoop][1] = 0; } } } @@ -1479,10 +1484,10 @@ void RecompileLocalMovementCostsFromRadius( INT16 sCentreGridNo, INT8 bRadius ) { for( sGridX = sCentreGridX - bRadius - 1; sGridX < sCentreGridX + bRadius + 1; sGridX++ ) { - usGridNo = MAPROWCOLTOPOS( sGridY, sGridX ); - if (usGridNo < WORLD_MAX) + sGridNo = MAPROWCOLTOPOS( sGridY, sGridX ); + if (sGridNo < WORLD_MAX) { - CompileTileMovementCosts( usGridNo ); + CompileTileMovementCosts( sGridNo ); } } } @@ -1500,7 +1505,7 @@ void AddTileToRecompileArea( INT16 sGridNo ) { return; } - + gpWorldLevelData[ sGridNo ].ubExtFlags[0] |= MAPELEMENT_EXT_RECALCULATE_MOVEMENT; // check Top/Left of recompile region @@ -1532,25 +1537,25 @@ void AddTileToRecompileArea( INT16 sGridNo ) void RecompileLocalMovementCostsInAreaWithFlags( void ) { - INT16 usGridNo; + INT16 sGridNo; INT16 sGridX, sGridY; - INT8 bDirLoop; + INT8 bDirLoop; for( sGridY = gsRecompileAreaTop; sGridY <= gsRecompileAreaBottom; sGridY++ ) { for( sGridX = gsRecompileAreaLeft; sGridX < gsRecompileAreaRight; sGridX++ ) { - usGridNo = MAPROWCOLTOPOS( sGridY, sGridX ); - if ( usGridNo < WORLD_MAX && gpWorldLevelData[ usGridNo ].ubExtFlags[0] & MAPELEMENT_EXT_RECALCULATE_MOVEMENT ) + sGridNo = MAPROWCOLTOPOS( sGridY, sGridX ); + if ( sGridNo < WORLD_MAX && gpWorldLevelData[ sGridNo ].ubExtFlags[0] & MAPELEMENT_EXT_RECALCULATE_MOVEMENT ) { // wipe MPs in this tile! for( bDirLoop = 0; bDirLoop < MAXDIR; bDirLoop++) { - gubWorldMovementCosts[usGridNo][bDirLoop][0] = 0; - gubWorldMovementCosts[usGridNo][bDirLoop][1] = 0; + gubWorldMovementCosts[sGridNo][bDirLoop][0] = 0; + gubWorldMovementCosts[sGridNo][bDirLoop][1] = 0; } // reset flag - gpWorldLevelData[ usGridNo ].ubExtFlags[0] &= (~MAPELEMENT_EXT_RECALCULATE_MOVEMENT); + gpWorldLevelData[ sGridNo ].ubExtFlags[0] &= (~MAPELEMENT_EXT_RECALCULATE_MOVEMENT); } } } @@ -1559,10 +1564,10 @@ void RecompileLocalMovementCostsInAreaWithFlags( void ) { for( sGridX = gsRecompileAreaLeft; sGridX <= gsRecompileAreaRight; sGridX++ ) { - usGridNo = MAPROWCOLTOPOS( sGridY, sGridX ); - if (usGridNo < WORLD_MAX) + sGridNo = MAPROWCOLTOPOS( sGridY, sGridX ); + if (sGridNo < WORLD_MAX) { - CompileTileMovementCosts( usGridNo ); + CompileTileMovementCosts( sGridNo ); } } } @@ -1570,7 +1575,7 @@ void RecompileLocalMovementCostsInAreaWithFlags( void ) void RecompileLocalMovementCostsForWall( INT16 sGridNo, UINT8 ubOrientation ) { - INT8 bDirLoop; + INT8 bDirLoop; INT16 sUp, sDown, sLeft, sRight; INT16 sX, sY, sTempGridNo; @@ -1605,7 +1610,7 @@ void RecompileLocalMovementCostsForWall( INT16 sGridNo, UINT8 ubOrientation ) gubWorldMovementCosts[sTempGridNo][bDirLoop][1] = 0; } - CompileTileMovementCosts( sTempGridNo ); + CompileTileMovementCosts( sTempGridNo ); } } } @@ -1615,14 +1620,14 @@ void RecompileLocalMovementCostsForWall( INT16 sGridNo, UINT8 ubOrientation ) // GLOBAL WORLD MANIPULATION FUNCTIONS void CompileWorldMovementCosts( ) { - UINT16 usGridNo; + INT16 sGridNo; memset( gubWorldMovementCosts, 0, sizeof( gubWorldMovementCosts ) ); CompileWorldTerrainIDs(); - for( usGridNo = 0; usGridNo < WORLD_MAX; usGridNo++ ) + for( sGridNo = 0; sGridNo < WORLD_MAX; sGridNo++ ) { - CompileTileMovementCosts( usGridNo ); + CompileTileMovementCosts( sGridNo ); } } @@ -1646,7 +1651,7 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) LEVELNODE *pOnRoof; LEVELNODE *pTailLand=NULL; UINT16 usNumExitGrids = 0; - UINT16 usTypeSubIndex; + UINT16 usTypeSubIndex; UINT8 LayerCount; UINT8 ObjectCount; UINT8 StructCount; @@ -1694,8 +1699,7 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) // Write tileset ID FileWrite( hfile, &giCurrentTilesetID, sizeof( INT32 ), &uiBytesWritten ); - - // WDS - Clean up inventory handling + // Write SOLDIER CONTROL SIZE uiSoldierSize = SIZEOF_SOLDIERTYPE_POD; //SIZEOF_SOLDIERTYPE; FileWrite( hfile, &uiSoldierSize, sizeof( INT32 ), &uiBytesWritten ); @@ -1706,7 +1710,7 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) - { + { // Write out height values FileWrite( hfile, &gpWorldLevelData[ cnt ].sHeight, sizeof( INT16 ), &uiBytesWritten ); @@ -1715,11 +1719,11 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) // Write out # values - we'll have no more than 15 per level! for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) - { + { // Determine number of land pLand = gpWorldLevelData[ cnt ].pLandHead; LayerCount = 0; - + while( pLand != NULL ) { LayerCount++; @@ -1728,7 +1732,7 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) if( LayerCount > 15 ) { swprintf( gzErrorCatchString, L"SAVE ABORTED! Land count too high (%d) for gridno %d." - L" Need to fix before map can be saved! There are %d additional warnings.", + L" Need to fix before map can be saved! There are %d additional warnings.", LayerCount, cnt, uiNumWarningsCaught ); gfErrorCatch = TRUE; FileClose( hfile ); @@ -1738,7 +1742,7 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) { uiNumWarningsCaught++; gfErrorCatch = TRUE; - swprintf( gzErrorCatchString, L"Warnings %d -- Last warning: Land count warning of %d for gridno %d.", + swprintf( gzErrorCatchString, L"Warnings %d -- Last warning: Land count warning of %d for gridno %d.", uiNumWarningsCaught, LayerCount, cnt ); } bCounts[ cnt ][ 0 ] = LayerCount; @@ -1768,7 +1772,7 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) if( ObjectCount > 15 ) { swprintf( gzErrorCatchString, L"SAVE ABORTED! Object count too high (%d) for gridno %d." - L" Need to fix before map can be saved! There are %d additional warnings.", + L" Need to fix before map can be saved! There are %d additional warnings.", ObjectCount, cnt, uiNumWarningsCaught ); gfErrorCatch = TRUE; FileClose( hfile ); @@ -1778,7 +1782,7 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) { uiNumWarningsCaught++; gfErrorCatch = TRUE; - swprintf( gzErrorCatchString, L"Warnings %d -- Last warning: Object count warning of %d for gridno %d.", + swprintf( gzErrorCatchString, L"Warnings %d -- Last warning: Object count warning of %d for gridno %d.", uiNumWarningsCaught, ObjectCount, cnt ); } bCounts[ cnt ][ 1 ] = ObjectCount; @@ -1798,7 +1802,7 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) if( StructCount > 15 ) { swprintf( gzErrorCatchString, L"SAVE ABORTED! Struct count too high (%d) for gridno %d." - L" Need to fix before map can be saved! There are %d additional warnings.", + L" Need to fix before map can be saved! There are %d additional warnings.", StructCount, cnt, uiNumWarningsCaught ); gfErrorCatch = TRUE; FileClose( hfile ); @@ -1808,7 +1812,7 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) { uiNumWarningsCaught++; gfErrorCatch = TRUE; - swprintf( gzErrorCatchString, L"Warnings %d -- Last warning: Struct count warning of %d for gridno %d.", + swprintf( gzErrorCatchString, L"Warnings %d -- Last warning: Struct count warning of %d for gridno %d.", uiNumWarningsCaught, StructCount, cnt ); } bCounts[ cnt ][ 2 ] = StructCount; @@ -1824,7 +1828,7 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) while( pShadow != NULL ) { // Don't write any shadowbuddys or exit grids - if ( !(pShadow->uiFlags & ( LEVELNODE_BUDDYSHADOW | LEVELNODE_EXITGRID ) ) ) + if ( !(pShadow->uiFlags & ( LEVELNODE_BUDDYSHADOW | LEVELNODE_EXITGRID ) ) ) { ShadowCount++; } @@ -1833,7 +1837,7 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) if( ShadowCount > 15 ) { swprintf( gzErrorCatchString, L"SAVE ABORTED! Shadow count too high (%d) for gridno %d." - L" Need to fix before map can be saved! There are %d additional warnings.", + L" Need to fix before map can be saved! There are %d additional warnings.", ShadowCount, cnt, uiNumWarningsCaught ); gfErrorCatch = TRUE; FileClose( hfile ); @@ -1843,7 +1847,7 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) { uiNumWarningsCaught++; gfErrorCatch = TRUE; - swprintf( gzErrorCatchString, L"Warnings %d -- Last warning: Shadow count warning of %d for gridno %d.", + swprintf( gzErrorCatchString, L"Warnings %d -- Last warning: Shadow count warning of %d for gridno %d.", uiNumWarningsCaught, ShadowCount, cnt ); } bCounts[ cnt ][ 3 ] = ShadowCount; @@ -1863,7 +1867,7 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) if( RoofCount > 15 ) { swprintf( gzErrorCatchString, L"SAVE ABORTED! Roof count too high (%d) for gridno %d." - L" Need to fix before map can be saved! There are %d additional warnings.", + L" Need to fix before map can be saved! There are %d additional warnings.", RoofCount, cnt, uiNumWarningsCaught ); gfErrorCatch = TRUE; FileClose( hfile ); @@ -1873,7 +1877,7 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) { uiNumWarningsCaught++; gfErrorCatch = TRUE; - swprintf( gzErrorCatchString, L"Warnings %d -- Last warning: Roof count warning of %d for gridno %d.", + swprintf( gzErrorCatchString, L"Warnings %d -- Last warning: Roof count warning of %d for gridno %d.", uiNumWarningsCaught, RoofCount, cnt ); } bCounts[ cnt ][ 4 ] = RoofCount; @@ -1881,7 +1885,7 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) ubCombine = (UINT8)( ( ShadowCount&0xf ) | ( (RoofCount&0xf)<<4 ) ); // Write combination FileWrite( hfile, &ubCombine, sizeof( ubCombine ), &uiBytesWritten ); - + // Write OnRoof layer // Determine # of OnRoofs @@ -1896,7 +1900,7 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) if( OnRoofCount > 15 ) { swprintf( gzErrorCatchString, L"SAVE ABORTED! OnRoof count too high (%d) for gridno %d." - L" Need to fix before map can be saved! There are %d additional warnings.", + L" Need to fix before map can be saved! There are %d additional warnings.", OnRoofCount, cnt, uiNumWarningsCaught ); gfErrorCatch = TRUE; FileClose( hfile ); @@ -1906,7 +1910,7 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) { uiNumWarningsCaught++; gfErrorCatch = TRUE; - swprintf( gzErrorCatchString, L"Warnings %d -- Last warning: OnRoof count warning of %d for gridno %d.", + swprintf( gzErrorCatchString, L"Warnings %d -- Last warning: OnRoof count warning of %d for gridno %d.", uiNumWarningsCaught, OnRoofCount, cnt ); } bCounts[ cnt ][ 5 ] = RoofCount; @@ -1922,11 +1926,11 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) } for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) - { + { if ( bCounts[ cnt ][ 0 ] == 0 ) { - + FileWrite( hfile, &ubTest, sizeof( UINT8 ), &uiBytesWritten ); FileWrite( hfile, &ubTest, sizeof( UINT8 ), &uiBytesWritten ); } @@ -1951,14 +1955,14 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) GetTypeSubIndexFromTileIndexChar( uiType, pTailLand->usIndex, &ubTypeSubIndex ); FileWrite( hfile, &ubType, sizeof( UINT8 ), &uiBytesWritten ); FileWrite( hfile, &ubTypeSubIndex, sizeof( UINT8 ), &uiBytesWritten ); - + pTailLand = pTailLand->pPrevNode; } } } - + for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) - { + { // Write object layer pObject = gpWorldLevelData[ cnt ].pObjectHead; @@ -1985,7 +1989,7 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) } for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) - { + { // Write struct layer pStruct = gpWorldLevelData[ cnt ].pStructHead; while( pStruct != NULL ) @@ -2006,7 +2010,7 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) } for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) - { + { // Write shadows pShadow = gpWorldLevelData[ cnt ].pShadowHead; while( pShadow != NULL ) @@ -2033,7 +2037,7 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) } for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) - { + { pRoof = gpWorldLevelData[ cnt ].pRoofHead; while( pRoof != NULL ) { @@ -2051,9 +2055,9 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) pRoof = pRoof->pNext; } } - + for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) - { + { // Write OnRoofs pOnRoof = gpWorldLevelData[ cnt ].pOnRoofHead; while( pOnRoof != NULL ) @@ -2071,7 +2075,7 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) } for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) - { + { // Write out room information FileWrite( hfile, &gubWorldRoomInfo[ cnt ], sizeof( INT8 ), &uiBytesWritten ); @@ -2097,7 +2101,7 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) } SaveMapInformation( hfile ); - + if( uiFlags & MAP_FULLSOLDIER_SAVED ) { SaveSoldiersToMap( hfile ); @@ -2133,11 +2137,11 @@ BOOLEAN SaveWorld( const STR8 puiFilename ) #define NUM_DIR_SEARCHES 5 INT8 bDirectionsForShadowSearch[ NUM_DIR_SEARCHES ] = { - WEST, - SOUTHWEST, - SOUTH, - SOUTHEAST, - EAST + WEST, + SOUTHWEST, + SOUTH, + SOUTHEAST, + EAST }; void OptimizeMapForShadows( ) @@ -2153,10 +2157,10 @@ void OptimizeMapForShadows( ) for ( dir = 0; dir < NUM_DIR_SEARCHES; dir++ ) { sNewGridNo = NewGridNo( (INT16)cnt, (UINT16)DirectionInc( bDirectionsForShadowSearch[ dir ] ) ); - + if ( gpWorldLevelData[ sNewGridNo ].pStructureHead == NULL ) { - break; + break; } } // If we made it here, remove shadow! @@ -2222,7 +2226,7 @@ void InitLoadedWorld( ) #ifdef JA2EDITOR //This is a specialty function that is very similar to LoadWorld, except that it //doesn't actually load the world, it instead evaluates the map and generates summary -//information for use within the summary editor. The header is defined in Summary Info.h, +//information for use within the summary editor. The header is defined in Summary Info.h, //not worlddef.h -- though it's not likely this is going to be used anywhere where it would //matter. extern double MasterStart, MasterEnd; @@ -2248,10 +2252,13 @@ BOOLEAN EvaluateWorld( STR8 pSector, UINT8 ubLevel ) CHAR8 szFilename[ 40 ]; UINT8 ubMinorMapVersion; + float oldMajorMapVersion; + UINT8 oldMinorMapVersion; + //Make sure the file exists... if not, then return false sprintf( szFilename, pSector ); - if( ubLevel % 4 ) + if( ubLevel % 4 ) { CHAR8 str[4]; sprintf( str, "_b%d", ubLevel % 4 ); @@ -2266,7 +2273,7 @@ BOOLEAN EvaluateWorld( STR8 pSector, UINT8 ubLevel ) if( gfMajorUpdate ) { - if( !LoadWorld( szFilename ) ) //error + if( !LoadWorld( szFilename, &oldMajorMapVersion, &oldMinorMapVersion ) ) //error return FALSE; FileClearAttributes( szDirFilename ); SaveWorld( szFilename ); @@ -2275,7 +2282,7 @@ BOOLEAN EvaluateWorld( STR8 pSector, UINT8 ubLevel ) hfile = FileOpen( szDirFilename, FILE_ACCESS_READ, FALSE ); if( !hfile ) return FALSE; - + uiFileSize = FileGetSize( hfile ); pBuffer = (INT8*)MemAlloc( uiFileSize ); pBufferHead = pBuffer; @@ -2320,7 +2327,7 @@ BOOLEAN EvaluateWorld( STR8 pSector, UINT8 ubLevel ) //read layer counts for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) - { + { if( !( cnt % 2560 ) ) { RenderProgressBar( 0, (cnt / 2560)+1 ); //1 - 10 @@ -2328,25 +2335,25 @@ BOOLEAN EvaluateWorld( STR8 pSector, UINT8 ubLevel ) } // Read combination of land/world flags LOADDATA( &ubCombine, pBuffer, sizeof( UINT8 ) ); - // split + // split bCounts[ cnt ][0] = (UINT8)(ubCombine&0xf); gpWorldLevelData[ cnt ].uiFlags |= (UINT8)((ubCombine&0xf0)>>4); // Read #objects, structs LOADDATA( &ubCombine, pBuffer, sizeof( UINT8 ) ); - // split + // split bCounts[ cnt ][1] = (UINT8)(ubCombine&0xf); bCounts[ cnt ][2] = (UINT8)((ubCombine&0xf0)>>4); // Read shadows, roof LOADDATA( &ubCombine, pBuffer, sizeof( UINT8 ) ); - // split + // split bCounts[ cnt ][3] = (UINT8)(ubCombine&0xf); bCounts[ cnt ][4] = (UINT8)((ubCombine&0xf0)>>4); - // Read OnRoof, nothing + // Read OnRoof, nothing LOADDATA( &ubCombine, pBuffer, sizeof( UINT8 ) ); - // split + // split bCounts[ cnt ][5] = (UINT8)(ubCombine&0xf); //bCounts[ cnt ][4] = (UINT8)((ubCombine&0xf0)>>4); - bCounts[ cnt ][6] = bCounts[cnt][0] + bCounts[cnt][1] + + bCounts[ cnt ][6] = bCounts[cnt][0] + bCounts[cnt][1] + bCounts[cnt][2] + bCounts[cnt][3] + bCounts[cnt][4] + bCounts[cnt][5]; } @@ -2378,19 +2385,32 @@ BOOLEAN EvaluateWorld( STR8 pSector, UINT8 ubLevel ) if( uiFlags & MAP_WORLDITEMS_SAVED ) { UINT32 temp; - RenderProgressBar( 0, 91 ); - //RenderProgressBar( 1, 91 ); + RenderProgressBar( 0, 91 ); + //RenderProgressBar( 1, 91 ); //get number of items (for now) LOADDATA( &temp, pBuffer, 4 ); pSummary->usNumItems = (UINT16)temp; - //Important: Saves the file position (byte offset) of the position where the numitems - // resides. Checking this value and comparing to usNumItems will ensure validity. - if( pSummary->usNumItems ) - { + //Important: Saves the file position (byte offset) of the position where the numitems + // resides. Checking this value and comparing to usNumItems will ensure validity. + //ADB warning, even if the number of items is 0 we still need to store the position!!! + //if( pSummary->usNumItems ) + //{ pSummary->uiNumItemsPosition = pBuffer - pBufferHead - 4; + //} + + //the size of WORLDITEM has changed at 6.27, 5.26 or earlier are outdated + if (dMajorMapVersion >= 6.0 && ubMinorMapVersion > 26) { + //Skip the contents of the world items. + WORLDITEM dummyItem; + for (int x = 0; x < pSummary->usNumItems; ++x) { + dummyItem.Load(&pBuffer, dMajorMapVersion, ubMinorMapVersion); + } + } + else { + //ADB Shouldn't happen, we just saved as newest version + //Skip the contents of the world items. + pBuffer += sizeof( OLD_WORLDITEM_101 ) * pSummary->usNumItems; } - //Skip the contents of the world items. - pBuffer += sizeof( WORLDITEM ) * pSummary->usNumItems; } if( uiFlags & MAP_AMBIENTLIGHTLEVEL_SAVED ) @@ -2401,8 +2421,8 @@ BOOLEAN EvaluateWorld( STR8 pSector, UINT8 ubLevel ) if( uiFlags & MAP_WORLDLIGHTS_SAVED ) { UINT8 ubTemp; - RenderProgressBar( 0, 92 ); - //RenderProgressBar( 1, 92 ); + RenderProgressBar( 0, 92 ); + //RenderProgressBar( 1, 92 ); //skip number of light palette entries LOADDATA( &ubTemp, pBuffer, 1 ); pBuffer += sizeof( SGPPaletteEntry ) * ubTemp; @@ -2425,14 +2445,14 @@ BOOLEAN EvaluateWorld( STR8 pSector, UINT8 ubLevel ) LOADDATA( &mapInfo, pBuffer, sizeof( MAPCREATE_STRUCT ) ); memcpy( &pSummary->MapInfo, &mapInfo, sizeof( MAPCREATE_STRUCT ) ); - + if( uiFlags & MAP_FULLSOLDIER_SAVED ) { TEAMSUMMARY *pTeam=NULL; BASIC_SOLDIERCREATE_STRUCT basic; SOLDIERCREATE_STRUCT priority; - RenderProgressBar( 0, 94 ); - //RenderProgressBar( 1, 94 ); + RenderProgressBar( 0, 94 ); + //RenderProgressBar( 1, 94 ); pSummary->uiEnemyPlacementPosition = pBuffer - pBufferHead; @@ -2477,10 +2497,8 @@ BOOLEAN EvaluateWorld( STR8 pSector, UINT8 ubLevel ) case 4: pTeam->ubGreatE++; break; } if( basic.fDetailedPlacement ) - { //skip static priority placement - // WDS - Clean up inventory handling - LOADDATA( &priority, pBuffer, SIZEOF_SOLDIERCREATE_STRUCT_POD); //SIZEOF_SOLDIERCREATE_STRUCT ); - priority.CopyOldInventoryToNew(); + { //skip static priority placement + priority.Load(&pBuffer, dMajorMapVersion, ubMinorMapVersion); if( priority.ubProfile != NO_PROFILE ) pTeam->ubProfile++; else @@ -2544,29 +2562,29 @@ BOOLEAN EvaluateWorld( STR8 pSector, UINT8 ubLevel ) } pTeam->ubTotal++; } - RenderProgressBar( 0, 96 ); - //RenderProgressBar( 1, 96 ); + RenderProgressBar( 0, 96 ); + //RenderProgressBar( 1, 96 ); } if( uiFlags & MAP_EXITGRIDS_SAVED ) { EXITGRID exitGrid; INT32 loop; - UINT16 usMapIndex; + INT16 sMapIndex; BOOLEAN fExitGridFound; - RenderProgressBar( 0, 98 ); - //RenderProgressBar( 1, 98 ); + RenderProgressBar( 0, 98 ); + //RenderProgressBar( 1, 98 ); LOADDATA( &cnt, pBuffer, 2 ); for( i = 0; i < cnt; i++ ) { - LOADDATA( &usMapIndex, pBuffer, 2 ); + LOADDATA( &sMapIndex, pBuffer, 2 ); LOADDATA( &exitGrid, pBuffer, 5 ); fExitGridFound = FALSE; for( loop = 0; loop < pSummary->ubNumExitGridDests; loop++ ) { - if( pSummary->ExitGrid[ loop ].usGridNo == exitGrid.usGridNo && + if( pSummary->ExitGrid[ loop ].sGridNo == exitGrid.sGridNo && pSummary->ExitGrid[ loop ].ubGotoSectorX == exitGrid.ubGotoSectorX && pSummary->ExitGrid[ loop ].ubGotoSectorY == exitGrid.ubGotoSectorY && pSummary->ExitGrid[ loop ].ubGotoSectorZ == exitGrid.ubGotoSectorZ ) @@ -2586,7 +2604,7 @@ BOOLEAN EvaluateWorld( STR8 pSector, UINT8 ubLevel ) { pSummary->ubNumExitGridDests++; pSummary->usExitGridSize[ loop ]++; - pSummary->ExitGrid[ loop ].usGridNo = exitGrid.usGridNo; + pSummary->ExitGrid[ loop ].sGridNo = exitGrid.sGridNo; pSummary->ExitGrid[ loop ].ubGotoSectorX = exitGrid.ubGotoSectorX; pSummary->ExitGrid[ loop ].ubGotoSectorY = exitGrid.ubGotoSectorY; pSummary->ExitGrid[ loop ].ubGotoSectorZ = exitGrid.ubGotoSectorZ; @@ -2603,7 +2621,7 @@ BOOLEAN EvaluateWorld( STR8 pSector, UINT8 ubLevel ) if( uiFlags & MAP_DOORTABLE_SAVED ) { DOOR Door; - + LOADDATA( &pSummary->ubNumDoors, pBuffer, 1 ); for( cnt = 0; cnt < pSummary->ubNumDoors; cnt++ ) @@ -2619,8 +2637,8 @@ BOOLEAN EvaluateWorld( STR8 pSector, UINT8 ubLevel ) } } - RenderProgressBar( 0, 100 ); - //RenderProgressBar( 1, 100 ); + RenderProgressBar( 0, 100 ); + //RenderProgressBar( 1, 100 ); MemFree( pBufferHead ); @@ -2632,10 +2650,10 @@ BOOLEAN EvaluateWorld( STR8 pSector, UINT8 ubLevel ) extern UINT8 GetCurrentSummaryVersion(); extern void LoadShadeTablesFromTextFile(); -BOOLEAN LoadWorld( const STR8 puiFilename ) +BOOLEAN LoadWorld( const STR8 puiFilename, float* pMajorMapVersion, UINT8* pMinorMapVersion) { HWFILE hfile; - FLOAT dMajorMapVersion; + FLOAT dMajorMapVersion; UINT32 uiFlags; UINT32 uiBytesRead; UINT32 uiSoldierSize; @@ -2665,7 +2683,7 @@ BOOLEAN LoadWorld( const STR8 puiFilename ) LoadShadeTablesFromTextFile(); // Append exension to filename! - if ( gfForceLoad ) + if ( gfForceLoad ) { sprintf( aFilename, "MAPS\\%s", gzForceLoadFile ); } @@ -2680,10 +2698,10 @@ BOOLEAN LoadWorld( const STR8 puiFilename ) // Open file hfile = FileOpen( aFilename, FILE_ACCESS_READ, FALSE ); - + if ( !hfile ) { - SET_ERROR( "Could not load map file %S", aFilename ); + SET_ERROR( "Could not load map file %S", aFilename ); return( FALSE ); } @@ -2709,7 +2727,10 @@ BOOLEAN LoadWorld( const STR8 puiFilename ) FileClose( hfile ); // Read JA2 Version ID - LOADDATA( &dMajorMapVersion, pBuffer, sizeof( FLOAT ) ); + LOADDATA( &dMajorMapVersion, pBuffer, sizeof( FLOAT ) ); + if ( pMajorMapVersion ) { + *pMajorMapVersion = dMajorMapVersion; + } // Lesh: disable this because now we accept any version map //#ifdef RUSSIAN @@ -2720,13 +2741,15 @@ BOOLEAN LoadWorld( const STR8 puiFilename ) //#endif LOADDATA( &ubMinorMapVersion, pBuffer, sizeof( UINT8 ) ); - + if (pMinorMapVersion) { + *pMinorMapVersion = ubMinorMapVersion; + } // CHECK FOR NON-COMPATIBLE VERSIONS! // CHECK FOR MAJOR MAP VERSION INCOMPATIBLITIES //if ( dMajorMapVersion < gdMajorMapVersion ) //{ - //AssertMsg( 0, "Major version conflict. Should have force updated this map already!!!" ); - //SET_ERROR( "Incompatible JA2 map version: %f, map version is now at %f", gdLoadedMapVersion, gdMapVersion ); + //AssertMsg( 0, "Major version conflict. Should have force updated this map already!!!" ); + //SET_ERROR( "Incompatible JA2 map version: %f, map version is now at %f", gdLoadedMapVersion, gdMapVersion ); //return( FALSE ); //} @@ -2743,16 +2766,17 @@ BOOLEAN LoadWorld( const STR8 puiFilename ) uiLoadMapTilesetTime = GetJA2Clock() - uiStartTime; #endif + //ADB thankfully this isn't used, because the size has changed // Load soldier size LOADDATA( &uiSoldierSize, pBuffer, sizeof( INT32 ) ); //FP 0x000010 for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) - { + { // Read height values LOADDATA( &gpWorldLevelData[ cnt ].sHeight, pBuffer, sizeof( INT16 ) ); - } + } //FP 0x00c810 @@ -2761,32 +2785,32 @@ BOOLEAN LoadWorld( const STR8 puiFilename ) // Read layer counts for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) - { + { // Read combination of land/world flags LOADDATA( &ubCombine, pBuffer, sizeof( UINT8 ) ); - // split + // split bCounts[ cnt ][0] = (UINT8)(ubCombine&0xf); gpWorldLevelData[ cnt ].uiFlags |= (UINT8)((ubCombine&0xf0)>>4); // Read #objects, structs LOADDATA( &ubCombine, pBuffer, sizeof( UINT8 ) ); - // split + // split bCounts[ cnt ][1] = (UINT8)(ubCombine&0xf); bCounts[ cnt ][2] = (UINT8)((ubCombine&0xf0)>>4); // Read shadows, roof LOADDATA( &ubCombine, pBuffer, sizeof( UINT8 ) ); - // split + // split bCounts[ cnt ][3] = (UINT8)(ubCombine&0xf); bCounts[ cnt ][4] = (UINT8)((ubCombine&0xf0)>>4); - // Read OnRoof, nothing + // Read OnRoof, nothing LOADDATA( &ubCombine, pBuffer, sizeof( UINT8 ) ); - // split + // split bCounts[ cnt ][5] = (UINT8)(ubCombine&0xf); } @@ -2826,7 +2850,7 @@ BOOLEAN LoadWorld( const STR8 puiFilename ) RenderProgressBar( 0, 100 ); if( 0 ) - { //Old loads + { //Old loads for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) { // Set objects @@ -2835,7 +2859,7 @@ BOOLEAN LoadWorld( const STR8 puiFilename ) LOADDATA( &ubType, pBuffer, sizeof( UINT8 ) ); LOADDATA( &ubSubIndex, pBuffer, sizeof( UINT8 ) ); - if ( ubType >= FIRSTPOINTERS ) + if ( ubType >= FIRSTPOINTERS ) { continue; } @@ -2852,16 +2876,19 @@ BOOLEAN LoadWorld( const STR8 puiFilename ) for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) { // Set objects + /* if( bCounts[ cnt ][ 1 ] > 10 ) { + //ADB what's this here for? commented out cnt = cnt; } + */ for( cnt2 = 0; cnt2 < bCounts[ cnt ][ 1 ]; cnt2++ ) { LOADDATA( &ubType, pBuffer, sizeof( UINT8 ) ); LOADDATA( &usTypeSubIndex, pBuffer, sizeof( UINT16 ) ); - if ( ubType >= FIRSTPOINTERS ) + if ( ubType >= FIRSTPOINTERS ) { continue; } @@ -2896,14 +2923,14 @@ BOOLEAN LoadWorld( const STR8 puiFilename ) // Get tile index GetTileIndexFromTypeSubIndex( ubType, ubSubIndex, &usTileIndex ); - if ( ubMinorMapVersion <= 25 ) - { - // Check patching for phantom menace struct data... - if ( gTileDatabase[ usTileIndex ].uiFlags & UNDERFLOW_FILLER ) - { - GetTileIndexFromTypeSubIndex( ubType, 1, &usTileIndex ); - } - } + if ( ubMinorMapVersion <= 25 ) + { + // Check patching for phantom menace struct data... + if ( gTileDatabase[ usTileIndex ].uiFlags & UNDERFLOW_FILLER ) + { + GetTileIndexFromTypeSubIndex( ubType, 1, &usTileIndex ); + } + } // Add layer AddStructToTail( cnt, usTileIndex ); @@ -2997,12 +3024,18 @@ BOOLEAN LoadWorld( const STR8 puiFilename ) offset = 0; // Lesh: read additional bytes for map major version 6.00 - if( dMajorMapVersion == 6.00 ) + + //ADB Russian version of the game has some maps at version 6.0 while all others are 5.0 + //so let's update! + //if we are loading a 5.26 map (6.26 Russian) AND we are currently at 6.27 + //( what would be 7.27 Russian except that we are about to fix this) + //then read the data. + if( dMajorMapVersion == 6.00 && ubMinorMapVersion < 27 && MAJOR_MAP_VERSION == 6.00) { UINT32 uiNums[37]; - LOADDATA( uiNums, pBuffer, 37 * sizeof( INT32 ) ); - dMajorMapVersion = 5.00; + LOADDATA( uiNums, pBuffer, 37 * sizeof( UINT32 ) ); } + //now the data is discarded and when saved, as 6.27, you won't have this problem! SetRelativeStartAndEndPercentage( 0, 58, 59, L"Loading room information..." ); RenderProgressBar( 0, 100 ); @@ -3038,7 +3071,7 @@ BOOLEAN LoadWorld( const STR8 puiFilename ) { // Load out item information gfLoadPitsWithoutArming = TRUE; - LoadWorldItemsFromMap( &pBuffer ); + LoadWorldItemsFromMap( &pBuffer, dMajorMapVersion, ubMinorMapVersion ); gfLoadPitsWithoutArming = FALSE; } @@ -3086,12 +3119,12 @@ BOOLEAN LoadWorld( const STR8 puiFilename ) RenderProgressBar( 0, 0 ); LoadMapInformation( &pBuffer ); - + if( uiFlags & MAP_FULLSOLDIER_SAVED ) { SetRelativeStartAndEndPercentage( 0, 86, 87, L"Loading placements..." ); RenderProgressBar( 0, 0 ); - LoadSoldiersFromMap( &pBuffer ); + LoadSoldiersFromMap( &pBuffer, dMajorMapVersion, ubMinorMapVersion ); } if( uiFlags & MAP_EXITGRIDS_SAVED ) { @@ -3155,7 +3188,7 @@ BOOLEAN LoadWorld( const STR8 puiFilename ) //Reset some override flags gfForceLoadPlayers = FALSE; - gfForceLoad = FALSE; + gfForceLoad = FALSE; // CHECK IF OUR SELECTED GUY IS GONE! if ( gusSelectedSoldier != NOBODY ) @@ -3177,7 +3210,7 @@ BOOLEAN LoadWorld( const STR8 puiFilename ) LoadRadarScreenBitmap( puiFilename ); RenderProgressBar( 0, 80 ); - + gfWorldLoaded = TRUE; sprintf( gubFilename, puiFilename ); @@ -3191,11 +3224,11 @@ BOOLEAN LoadWorld( const STR8 puiFilename ) //#ifdef JA2TESTVERSION - // ATE: Not while updating maps! - if ( guiCurrentScreen != MAPUTILITY_SCREEN ) - { - GenerateBuildings(); - } + // ATE: Not while updating maps! + if ( guiCurrentScreen != MAPUTILITY_SCREEN ) + { + GenerateBuildings(); + } //#endif @@ -3234,7 +3267,7 @@ BOOLEAN NewWorld( void ) } - InitRoomDatabase( ); + InitRoomDatabase( ); gfWorldLoaded = TRUE; @@ -3259,15 +3292,15 @@ void TrashWorld( void ) if( !gfWorldLoaded ) return; - + // REMOVE ALL ITEMS FROM WORLD - TrashWorldItems( ); + TrashWorldItems( ); // Trash the overhead map TrashOverheadMap( ); - //Reset the smoke effects. + //Reset the smoke effects. ResetSmokeEffects(); //Reset the light effects @@ -3493,7 +3526,7 @@ void TrashMapTile(INT16 MapTile) MemFree( pOnRoofNode ); pOnRoofNode = pMapTile->pOnRoofHead; } - pMapTile->pOnRoofHead = NULL; + pMapTile->pOnRoofHead = NULL; pTopmostNode = pMapTile->pTopmostHead; while ( pTopmostNode != NULL ) @@ -3502,7 +3535,7 @@ void TrashMapTile(INT16 MapTile) MemFree( pTopmostNode ); pTopmostNode = pMapTile->pTopmostHead; } - pMapTile->pTopmostHead = NULL; + pMapTile->pTopmostHead = NULL; while (pMapTile->pStructureHead != NULL) { @@ -3569,13 +3602,13 @@ BOOLEAN SaveMapTileset( INT32 iTilesetID ) // Are we trying to save the default tileset? if ( iTilesetID == 0 ) return( TRUE ); - + sprintf( zTilesetName, "TSET%04d.SET", iTilesetID ); // Open file hTSet = FileOpen( zTilesetName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); - + if ( !hTSet ) { return( FALSE ); @@ -3592,7 +3625,7 @@ BOOLEAN SaveMapTileset( INT32 iTilesetID ) void SetLoadOverrideParams( BOOLEAN fForceLoad, BOOLEAN fForceFile, CHAR8 *zLoadName ) { gfForceLoadPlayers = fForceLoad; - gfForceLoad = fForceFile; + gfForceLoad = fForceFile; if ( zLoadName != NULL ) { @@ -3630,85 +3663,85 @@ void AddWireFrame( INT16 sGridNo, UINT16 usIndex, BOOLEAN fForced ) UINT16 GetWireframeGraphicNumToUseForWall( INT16 sGridNo, STRUCTURE *pStructure ) { - LEVELNODE *pNode = NULL; + LEVELNODE *pNode = NULL; UINT8 ubWallOrientation; - UINT16 usValue = 0; - UINT16 usSubIndex; - STRUCTURE *pBaseStructure; + UINT16 usValue = 0; + UINT16 usSubIndex; + STRUCTURE *pBaseStructure; ubWallOrientation = pStructure->ubWallOrientation; - + pBaseStructure = FindBaseStructure( pStructure ); - if ( pBaseStructure ) - { - // Find levelnode... - pNode = gpWorldLevelData[sGridNo].pStructHead; - while( pNode != NULL ) - { - if (pNode->pStructureData == pBaseStructure) - { - break; - } - pNode = pNode->pNext; - } - - if ( pNode != NULL ) - { - // Get Subindex for this wall... - GetSubIndexFromTileIndex( pNode->usIndex, &usSubIndex ); + if ( pBaseStructure ) + { + // Find levelnode... + pNode = gpWorldLevelData[sGridNo].pStructHead; + while( pNode != NULL ) + { + if (pNode->pStructureData == pBaseStructure) + { + break; + } + pNode = pNode->pNext; + } - // Check for broken peices... - if ( usSubIndex == 48 || usSubIndex == 52 ) - { - return( WIREFRAMES12 ); - } - else if ( usSubIndex == 49 || usSubIndex == 53 ) - { - return( WIREFRAMES13 ); - } - else if ( usSubIndex == 50 || usSubIndex == 54 ) - { - return( WIREFRAMES10 ); - } - else if ( usSubIndex == 51 || usSubIndex == 55 ) - { - return( WIREFRAMES11 ); - } - } - } + if ( pNode != NULL ) + { + // Get Subindex for this wall... + GetSubIndexFromTileIndex( pNode->usIndex, &usSubIndex ); + + // Check for broken peices... + if ( usSubIndex == 48 || usSubIndex == 52 ) + { + return( WIREFRAMES12 ); + } + else if ( usSubIndex == 49 || usSubIndex == 53 ) + { + return( WIREFRAMES13 ); + } + else if ( usSubIndex == 50 || usSubIndex == 54 ) + { + return( WIREFRAMES10 ); + } + else if ( usSubIndex == 51 || usSubIndex == 55 ) + { + return( WIREFRAMES11 ); + } + } + } switch( ubWallOrientation ) { case OUTSIDE_TOP_LEFT: case INSIDE_TOP_LEFT: - usValue = WIREFRAMES6; + usValue = WIREFRAMES6; break; case OUTSIDE_TOP_RIGHT: case INSIDE_TOP_RIGHT: - usValue = WIREFRAMES5; - break; + usValue = WIREFRAMES5; + break; - } + } - return( usValue ); + return( usValue ); } void CalculateWorldWireFrameTiles( BOOLEAN fForce ) { INT32 cnt; - STRUCTURE *pStructure; + STRUCTURE *pStructure; INT16 sGridNo; UINT8 ubWallOrientation; INT8 bHiddenVal; INT8 bNumWallsSameGridNo; - UINT16 usWireFrameIndex; + UINT16 usWireFrameIndex; // Create world randomly from tiles for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) - { + { if ( gpWorldLevelData[ cnt ].uiFlags & MAPELEMENT_RECALCULATE_WIREFRAMES || fForce ) { if ( cnt == 8377 ) @@ -3725,7 +3758,7 @@ void CalculateWorldWireFrameTiles( BOOLEAN fForce ) bNumWallsSameGridNo = 0; // Check our gridno, if we have a roof over us that has not beenr evealed, no need for a wiereframe - if ( IsRoofVisibleForWireframe( (UINT16)cnt ) && !( gpWorldLevelData[ cnt ].uiFlags & MAPELEMENT_REVEALED ) ) + if ( IsRoofVisibleForWireframe( (INT16)cnt ) && !( gpWorldLevelData[ cnt ].uiFlags & MAPELEMENT_REVEALED ) ) { continue; } @@ -3749,7 +3782,7 @@ void CalculateWorldWireFrameTiles( BOOLEAN fForce ) case OUTSIDE_TOP_LEFT: case INSIDE_TOP_LEFT: - // Get gridno + // Get gridno sGridNo = NewGridNo( (INT16)cnt, DirectionInc( SOUTH ) ); if ( IsRoofVisibleForWireframe( sGridNo ) && !( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) ) @@ -3761,7 +3794,7 @@ void CalculateWorldWireFrameTiles( BOOLEAN fForce ) case OUTSIDE_TOP_RIGHT: case INSIDE_TOP_RIGHT: - // Get gridno + // Get gridno sGridNo = NewGridNo( (INT16)cnt, DirectionInc( EAST ) ); if ( IsRoofVisibleForWireframe( sGridNo ) && !( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) ) @@ -3774,116 +3807,116 @@ void CalculateWorldWireFrameTiles( BOOLEAN fForce ) } } // Check for windows - else - { - if ( pStructure->fFlags & STRUCTURE_WALLNWINDOW ) - { - // Does the gridno we are over have a non-visible tile? - // Based on orientation - ubWallOrientation = pStructure->ubWallOrientation; + else + { + if ( pStructure->fFlags & STRUCTURE_WALLNWINDOW ) + { + // Does the gridno we are over have a non-visible tile? + // Based on orientation + ubWallOrientation = pStructure->ubWallOrientation; - switch( ubWallOrientation ) - { - case OUTSIDE_TOP_LEFT: - case INSIDE_TOP_LEFT: + switch( ubWallOrientation ) + { + case OUTSIDE_TOP_LEFT: + case INSIDE_TOP_LEFT: - // Get gridno - sGridNo = NewGridNo( (INT16)cnt, DirectionInc( SOUTH ) ); + // Get gridno + sGridNo = NewGridNo( (INT16)cnt, DirectionInc( SOUTH ) ); - if ( IsRoofVisibleForWireframe( sGridNo ) && !( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) ) - { - AddWireFrame( (INT16)cnt, WIREFRAMES2, (BOOLEAN)( ( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) != 0 ) ); - } - break; + if ( IsRoofVisibleForWireframe( sGridNo ) && !( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) ) + { + AddWireFrame( (INT16)cnt, WIREFRAMES2, (BOOLEAN)( ( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) != 0 ) ); + } + break; - case OUTSIDE_TOP_RIGHT: - case INSIDE_TOP_RIGHT: + case OUTSIDE_TOP_RIGHT: + case INSIDE_TOP_RIGHT: - // Get gridno - sGridNo = NewGridNo( (INT16)cnt, DirectionInc( EAST ) ); + // Get gridno + sGridNo = NewGridNo( (INT16)cnt, DirectionInc( EAST ) ); - if ( IsRoofVisibleForWireframe( sGridNo ) && !( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) ) - { - AddWireFrame( (INT16)cnt, WIREFRAMES1, (BOOLEAN)( ( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) != 0 ) ); - } - break; + if ( IsRoofVisibleForWireframe( sGridNo ) && !( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) ) + { + AddWireFrame( (INT16)cnt, WIREFRAMES1, (BOOLEAN)( ( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) != 0 ) ); + } + break; - } + } - } + } - // Check for walls - if ( pStructure->fFlags & STRUCTURE_WALLSTUFF ) - { - // Does the gridno we are over have a non-visible tile? - // Based on orientation - ubWallOrientation = pStructure->ubWallOrientation; + // Check for walls + if ( pStructure->fFlags & STRUCTURE_WALLSTUFF ) + { + // Does the gridno we are over have a non-visible tile? + // Based on orientation + ubWallOrientation = pStructure->ubWallOrientation; - usWireFrameIndex = GetWireframeGraphicNumToUseForWall( (UINT16)cnt, pStructure ); + usWireFrameIndex = GetWireframeGraphicNumToUseForWall( (UINT16)cnt, pStructure ); - switch( ubWallOrientation ) - { - case OUTSIDE_TOP_LEFT: - case INSIDE_TOP_LEFT: + switch( ubWallOrientation ) + { + case OUTSIDE_TOP_LEFT: + case INSIDE_TOP_LEFT: - // Get gridno - sGridNo = NewGridNo( (INT16)cnt, DirectionInc( SOUTH ) ); + // Get gridno + sGridNo = NewGridNo( (INT16)cnt, DirectionInc( SOUTH ) ); - if ( IsRoofVisibleForWireframe( sGridNo ) ) - { - bNumWallsSameGridNo++; + if ( IsRoofVisibleForWireframe( sGridNo ) ) + { + bNumWallsSameGridNo++; - AddWireFrame( (INT16)cnt, usWireFrameIndex, (BOOLEAN)( ( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) != 0 ) ); + AddWireFrame( (INT16)cnt, usWireFrameIndex, (BOOLEAN)( ( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) != 0 ) ); - // Check along our direction to see if we are a corner - sGridNo = NewGridNo( (INT16)cnt, DirectionInc( WEST ) ); - sGridNo = NewGridNo( sGridNo, DirectionInc( SOUTH ) ); - bHiddenVal = IsHiddenTileMarkerThere( sGridNo ); - // If we do not exist ( -1 ) or are revealed ( 1 ) - if ( bHiddenVal == -1 || bHiddenVal == 1 ) - { - // Place corner! - AddWireFrame( (INT16)cnt, WIREFRAMES9, (BOOLEAN)( ( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) != 0 ) ); - } - } - break; + // Check along our direction to see if we are a corner + sGridNo = NewGridNo( (INT16)cnt, DirectionInc( WEST ) ); + sGridNo = NewGridNo( sGridNo, DirectionInc( SOUTH ) ); + bHiddenVal = IsHiddenTileMarkerThere( sGridNo ); + // If we do not exist ( -1 ) or are revealed ( 1 ) + if ( bHiddenVal == -1 || bHiddenVal == 1 ) + { + // Place corner! + AddWireFrame( (INT16)cnt, WIREFRAMES9, (BOOLEAN)( ( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) != 0 ) ); + } + } + break; - case OUTSIDE_TOP_RIGHT: - case INSIDE_TOP_RIGHT: + case OUTSIDE_TOP_RIGHT: + case INSIDE_TOP_RIGHT: - // Get gridno - sGridNo = NewGridNo( (INT16)cnt, DirectionInc( EAST ) ); + // Get gridno + sGridNo = NewGridNo( (INT16)cnt, DirectionInc( EAST ) ); - if ( IsRoofVisibleForWireframe( sGridNo ) ) - { - bNumWallsSameGridNo++; + if ( IsRoofVisibleForWireframe( sGridNo ) ) + { + bNumWallsSameGridNo++; - AddWireFrame( (INT16)cnt, usWireFrameIndex, (BOOLEAN)( ( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) != 0 ) ); + AddWireFrame( (INT16)cnt, usWireFrameIndex, (BOOLEAN)( ( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) != 0 ) ); - // Check along our direction to see if we are a corner - sGridNo = NewGridNo( (INT16)cnt, DirectionInc( NORTH ) ); - sGridNo = NewGridNo( sGridNo, DirectionInc( EAST ) ); - bHiddenVal = IsHiddenTileMarkerThere( sGridNo ); - // If we do not exist ( -1 ) or are revealed ( 1 ) - if ( bHiddenVal == -1 || bHiddenVal == 1 ) - { - // Place corner! - AddWireFrame( (INT16)cnt, WIREFRAMES8, (BOOLEAN)( ( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) != 0 ) ); - } + // Check along our direction to see if we are a corner + sGridNo = NewGridNo( (INT16)cnt, DirectionInc( NORTH ) ); + sGridNo = NewGridNo( sGridNo, DirectionInc( EAST ) ); + bHiddenVal = IsHiddenTileMarkerThere( sGridNo ); + // If we do not exist ( -1 ) or are revealed ( 1 ) + if ( bHiddenVal == -1 || bHiddenVal == 1 ) + { + // Place corner! + AddWireFrame( (INT16)cnt, WIREFRAMES8, (BOOLEAN)( ( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) != 0 ) ); + } - } - break; + } + break; - } + } - // Check for both walls - if ( bNumWallsSameGridNo == 2 ) - { - sGridNo = NewGridNo( (INT16)cnt, DirectionInc( EAST ) ); - sGridNo = NewGridNo( sGridNo, DirectionInc( SOUTH ) ); - AddWireFrame( (INT16)cnt, WIREFRAMES7, (BOOLEAN)( ( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) != 0 ) ); - } - } + // Check for both walls + if ( bNumWallsSameGridNo == 2 ) + { + sGridNo = NewGridNo( (INT16)cnt, DirectionInc( EAST ) ); + sGridNo = NewGridNo( sGridNo, DirectionInc( SOUTH ) ); + AddWireFrame( (INT16)cnt, WIREFRAMES7, (BOOLEAN)( ( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) != 0 ) ); + } + } } pStructure = pStructure->pNext; @@ -3923,17 +3956,17 @@ void RemoveWireFrameTiles( INT16 sGridNo ) if ( pTileElement->fType == WIREFRAMES ) { - RemoveTopmost( sGridNo, pTopmost->usIndex ); + RemoveTopmost( sGridNo, pTopmost->usIndex ); } } - + pTopmost = pNewTopmost; } } - + INT8 IsHiddenTileMarkerThere( INT16 sGridNo ) { STRUCTURE * pStructure; @@ -3947,7 +3980,7 @@ INT8 IsHiddenTileMarkerThere( INT16 sGridNo ) //if ( !( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) ) { return( 2 ); - } + } // if we are here, a roof exists but has been revealed return( 1 ); @@ -3981,12 +4014,12 @@ void ReloadTileset( UINT8 ubID ) // Save Map SaveWorld( TEMP_FILE_FOR_TILESET_CHANGE ); - //IMPORTANT: If this is not set, the LoadTileset() will assume that + //IMPORTANT: If this is not set, the LoadTileset() will assume that //it is loading the same tileset and ignore it... giCurrentTilesetID = iCurrTilesetID; // Load Map with new tileset - LoadWorld( TEMP_FILE_FOR_TILESET_CHANGE ); + LoadWorld( TEMP_FILE_FOR_TILESET_CHANGE); // Delete file sprintf( aFilename, "MAPS\\%s", TEMP_FILE_FOR_TILESET_CHANGE ); @@ -4018,7 +4051,7 @@ void SaveMapLights( HWFILE hfile ) for( cnt = 0; cnt < MAX_LIGHT_SPRITES; cnt++ ) { if( LightSprites[ cnt ].uiFlags & LIGHT_SPR_ACTIVE ) - { //found an active light. Check to make sure it doesn't belong to a merc. + { //found an active light. Check to make sure it doesn't belong to a merc. fSoldierLight = FALSE; for ( cnt2 = 0; cnt2 < MAX_NUM_SOLDIERS && !fSoldierLight; cnt2++ ) { @@ -4040,7 +4073,7 @@ void SaveMapLights( HWFILE hfile ) for( cnt = 0; cnt < MAX_LIGHT_SPRITES; cnt++ ) { if( LightSprites[ cnt ].uiFlags & LIGHT_SPR_ACTIVE ) - { //found an active light. Check to make sure it doesn't belong to a merc. + { //found an active light. Check to make sure it doesn't belong to a merc. fSoldierLight = FALSE; for ( cnt2 = 0; cnt2 < MAX_NUM_SOLDIERS && !fSoldierLight; cnt2++ ) { @@ -4061,7 +4094,7 @@ void SaveMapLights( HWFILE hfile ) } } } -} +} void LoadMapLights( INT8 **hBuffer ) { @@ -4089,8 +4122,8 @@ void LoadMapLights( INT8 **hBuffer ) // ATE: OK, only regenrate if colors are different..... //if ( LColors[0].peRed != gpLightColors[0].peRed || - // LColors[0].peGreen != gpLightColors[0].peGreen || - // LColors[0].peBlue != gpLightColors[0].peBlue ) + // LColors[0].peGreen != gpLightColors[0].peGreen || + // LColors[0].peBlue != gpLightColors[0].peBlue ) { LightSetColors( LColors, ubNumColors ); } @@ -4118,9 +4151,9 @@ void LoadMapLights( INT8 **hBuffer ) { LOADDATA( str, *hBuffer, ubStrLen ); } - + str[ ubStrLen ] = 0; - + iLSprite = LightSpriteCreate( str, TmpLight.uiLightType ); //if this fails, then we will ignore the light. // ATE: Don't add ANY lights of mapscreen util is on @@ -4128,9 +4161,9 @@ void LoadMapLights( INT8 **hBuffer ) { if( !gfCaves || gfEditMode ) { - if( gfEditMode || + if( gfEditMode || TmpLight.uiFlags & LIGHT_PRIMETIME && fPrimeTime || - TmpLight.uiFlags & LIGHT_NIGHTTIME && fNightTime || + TmpLight.uiFlags & LIGHT_NIGHTTIME && fNightTime || !(TmpLight.uiFlags & (LIGHT_PRIMETIME | LIGHT_NIGHTTIME)) ) { //power only valid lights. LightSpritePower( iLSprite, TRUE ); diff --git a/TileEngine/worlddef.h b/TileEngine/worlddef.h index d6d7ae7e..4a6aa590 100644 --- a/TileEngine/worlddef.h +++ b/TileEngine/worlddef.h @@ -3,7 +3,7 @@ #include "vobject.h" #include "tiledef.h" -#include "Soldier Control.h" +//#include "Soldier Control.h" #include "structure.h" #include "Handle Items.h" @@ -17,14 +17,28 @@ #define CELL_X_SIZE 10 #define CELL_Y_SIZE 10 +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + +//Don't mess with this value, unless you want to force update all maps in the game! +// Lesh: fix the sad situation with the different major map versions +//#ifdef RUSSIAN + //#define MAJOR_MAP_VERSION 6.00 +//#else + #define MAJOR_MAP_VERSION 6.00 +//#endif +//Current minor map version updater. +#define MINOR_MAP_VERSION 27 + #define WORLD_BASE_HEIGHT 0 #define WORLD_CLIFF_HEIGHT 80 - + //A macro that actually memcpy's over data and increments the pointer automatically -//based on the size. Works like a FileRead except with a buffer instead of a file pointer. +//based on the size. Works like a FileRead except with a buffer instead of a file pointer. //Used by LoadWorld() and child functions. #include -#define LOADDATA( dst, src, size ) memcpy( dst, src, size ); src += size +#define LOADDATA( dst, src, size ) memcpy( dst, src, size ); src += size #define LANDHEAD 0 @@ -50,7 +64,7 @@ #define LEVELNODE_DISPLAY_AP 0x00000400 #define LEVELNODE_ANIMATION 0x00000800 #define LEVELNODE_USEABSOLUTEPOS 0x00001000 -#define LEVELNODE_REVEAL 0x00002000 +#define LEVELNODE_REVEAL 0x00002000 #define LEVELNODE_REVEALTREES 0x00004000 #define LEVELNODE_USEBESTTRANSTYPE 0x00008000 #define LEVELNODE_USEZ 0x00010000 @@ -94,7 +108,7 @@ #define MAPELEMENT_EXT_RECALCULATE_MOVEMENT 0x0010 //0x10 #define MAPELEMENT_EXT_NOBURN_STRUCT 0x0020 //0x20 #define MAPELEMENT_EXT_ROOFCODE_VISITED 0x0040 //0x40 -#define MAPELEMENT_EXT_CREATUREGAS 0x0080 //0x80 +#define MAPELEMENT_EXT_CREATUREGAS 0x0080 //0x80 #define MAPELEMENT_EXT_BURNABLEGAS 0x0100 //0x100 #define MAPELEMENT_EXT_CLIMBPOINT 0x0200 //0x200 @@ -105,7 +119,6 @@ #define ANY_SMOKE_EFFECT ( MAPELEMENT_EXT_CREATUREGAS | MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS | MAPELEMENT_EXT_BURNABLEGAS ) -// WDS - Clean up inventory handling struct LEVELNODE { struct LEVELNODE *pNext; @@ -273,7 +286,7 @@ void TrashMapTile(INT16 MapTile); BOOLEAN NewWorld( void ); BOOLEAN SaveWorld( const STR8 puiFilename ); -BOOLEAN LoadWorld( const STR8 puiFilename ); +BOOLEAN LoadWorld( const STR8 puiFilename, float* pMajorMapVersion = NULL, UINT8* pMinorMapVersion = NULL ); void CompileWorldMovementCosts( ); void RecompileLocalMovementCosts( INT16 sCentreGridNo ); @@ -290,7 +303,7 @@ void RemoveWorldWireFrameTiles( ); void RemoveWireFrameTiles( INT16 sGridNo ); -LEVELNODE *GetAnimProfileFlags( UINT16 sGridNo, UINT16 *usFlags, SOLDIERTYPE **ppTargSoldier, LEVELNODE *pGivenNode ); +LEVELNODE *GetAnimProfileFlags( INT16 sGridNo, UINT16 *usFlags, SOLDIERTYPE **ppTargSoldier, LEVELNODE *pGivenNode ); void ReloadTileset( UINT8 ubID ); diff --git a/TileEngine/worldman.cpp b/TileEngine/worldman.cpp index 5c56d150..254f3d40 100644 --- a/TileEngine/worldman.cpp +++ b/TileEngine/worldman.cpp @@ -34,13 +34,13 @@ UINT32 guiLNCount[9]; static CHAR16 gzLevelString[9][15] = { L"", - L"Land %d", - L"Object %d", - L"Struct %d", - L"Shadow %d", - L"Merc %d", - L"Roof %d", - L"Onroof %d", + L"Land %d", + L"Object %d", + L"Struct %d", + L"Shadow %d", + L"Merc %d", + L"Roof %d", + L"Onroof %d", L"Topmost %d", }; @@ -48,8 +48,8 @@ static CHAR16 gzLevelString[9][15] = void SetIndexLevelNodeFlags( LEVELNODE *pStartNode, UINT32 uiFlags, UINT16 usIndex ); void RemoveIndexLevelNodeFlags( LEVELNODE *pStartNode, UINT32 uiFlags, UINT16 usIndex ); -void SetWorldFlagsFromNewNode( UINT16 sGridNo, UINT16 usIndex ); -void RemoveWorldFlagsFromNewNode( UINT16 sGridNo, UINT16 usIndex ); +void SetWorldFlagsFromNewNode( INT16 sGridNo, UINT16 usIndex ); +void RemoveWorldFlagsFromNewNode( INT16 sGridNo, UINT16 usIndex ); BOOLEAN RemoveLandEx( UINT32 iMapIndex, UINT16 usIndex ); @@ -60,7 +60,7 @@ BOOLEAN CreateLevelNode( LEVELNODE **ppNode ) { *ppNode = (LEVELNODE *)MemAlloc( sizeof( LEVELNODE ) ); CHECKF( *ppNode != NULL ); - + // Clear all values memset( *ppNode, 0, sizeof( LEVELNODE ) ); @@ -89,7 +89,7 @@ void CountLevelNodes( void ) } for (uiLoop = 0; uiLoop < WORLD_MAX; uiLoop++) - { + { pME = &(gpWorldLevelData[uiLoop]); // start at 1 to skip land head ptr; 0 stores total for (uiLoop2 = 1; uiLoop2 < 9; uiLoop2++) @@ -137,7 +137,7 @@ BOOLEAN TypeExistsInLevel( LEVELNODE *pStartNode, UINT32 fType, UINT16 *pusIndex if ( fTileType == fType ) { *pusIndex = pStartNode->usIndex; - return( TRUE ); + return( TRUE ); } } @@ -233,8 +233,8 @@ void RemoveIndexLevelNodeFlags( LEVELNODE *pStartNode, UINT32 uiFlags, UINT16 us LEVELNODE *AddObjectToTail( UINT32 iMapIndex, UINT16 usIndex ) { - LEVELNODE *pObject = NULL; - LEVELNODE *pNextObject = NULL; + LEVELNODE *pObject = NULL; + LEVELNODE *pNextObject = NULL; pObject = gpWorldLevelData[ iMapIndex ].pObjectHead; @@ -278,8 +278,8 @@ LEVELNODE *AddObjectToTail( UINT32 iMapIndex, UINT16 usIndex ) BOOLEAN AddObjectToHead( UINT32 iMapIndex, UINT16 usIndex ) { - LEVELNODE *pObject = NULL; - LEVELNODE *pNextObject = NULL; + LEVELNODE *pObject = NULL; + LEVELNODE *pNextObject = NULL; pObject = gpWorldLevelData[ iMapIndex ].pObjectHead; @@ -306,7 +306,7 @@ BOOLEAN AddObjectToHead( UINT32 iMapIndex, UINT16 usIndex ) BOOLEAN RemoveObject( UINT32 iMapIndex, UINT16 usIndex ) { - LEVELNODE *pObject = NULL; + LEVELNODE *pObject = NULL; LEVELNODE *pOldObject = NULL; pObject = gpWorldLevelData[ iMapIndex ].pObjectHead; @@ -355,8 +355,8 @@ BOOLEAN RemoveObject( UINT32 iMapIndex, UINT16 usIndex ) BOOLEAN TypeRangeExistsInObjectLayer( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT16 *pusObjectIndex ) { - LEVELNODE *pObject = NULL; - LEVELNODE *pOldObject = NULL; + LEVELNODE *pObject = NULL; + LEVELNODE *pOldObject = NULL; UINT32 fTileType; pObject = gpWorldLevelData[ iMapIndex ].pObjectHead; @@ -392,7 +392,7 @@ BOOLEAN TypeRangeExistsInObjectLayer( UINT32 iMapIndex, UINT32 fStartType, UINT3 BOOLEAN TypeExistsInObjectLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusObjectIndex ) { - LEVELNODE *pObject = NULL; + LEVELNODE *pObject = NULL; pObject = gpWorldLevelData[ iMapIndex ].pObjectHead; @@ -402,7 +402,7 @@ BOOLEAN TypeExistsInObjectLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusObje void SetAllObjectShadeLevels( UINT32 iMapIndex, UINT8 ubShadeLevel ) { - LEVELNODE *pObject = NULL; + LEVELNODE *pObject = NULL; pObject = gpWorldLevelData[ iMapIndex ].pObjectHead; @@ -413,7 +413,7 @@ void SetAllObjectShadeLevels( UINT32 iMapIndex, UINT8 ubShadeLevel ) void AdjustAllObjectShadeLevels( UINT32 iMapIndex, INT8 bShadeDiff ) { - LEVELNODE *pObject = NULL; + LEVELNODE *pObject = NULL; pObject = gpWorldLevelData[ iMapIndex ].pObjectHead; @@ -427,8 +427,8 @@ void AdjustAllObjectShadeLevels( UINT32 iMapIndex, INT8 bShadeDiff ) BOOLEAN RemoveAllObjectsOfTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType ) { - LEVELNODE *pObject = NULL; - LEVELNODE *pOldObject = NULL; + LEVELNODE *pObject = NULL; + LEVELNODE *pOldObject = NULL; UINT32 fTileType; BOOLEAN fRetVal = FALSE; @@ -466,8 +466,8 @@ BOOLEAN RemoveAllObjectsOfTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 LEVELNODE *AddLandToTail( UINT32 iMapIndex, UINT16 usIndex ) { - LEVELNODE *pLand = NULL; - LEVELNODE *pNextLand = NULL; + LEVELNODE *pLand = NULL; + LEVELNODE *pNextLand = NULL; pLand = gpWorldLevelData[ iMapIndex ].pLandHead; @@ -478,7 +478,7 @@ LEVELNODE *AddLandToTail( UINT32 iMapIndex, UINT16 usIndex ) pNextLand->usIndex = usIndex; gpWorldLevelData[ iMapIndex ].pLandHead = pNextLand; - + } else { @@ -491,8 +491,8 @@ LEVELNODE *AddLandToTail( UINT32 iMapIndex, UINT16 usIndex ) pLand->pNext = pNextLand; pNextLand->pNext = NULL; - pNextLand->pPrevNode = pLand; - pNextLand->usIndex = usIndex; + pNextLand->pPrevNode = pLand; + pNextLand->usIndex = usIndex; break; } @@ -511,9 +511,9 @@ LEVELNODE *AddLandToTail( UINT32 iMapIndex, UINT16 usIndex ) BOOLEAN AddLandToHead( UINT32 iMapIndex, UINT16 usIndex ) { - LEVELNODE *pLand = NULL; - LEVELNODE *pNextLand = NULL; - TILE_ELEMENT TileElem; + LEVELNODE *pLand = NULL; + LEVELNODE *pNextLand = NULL; + TILE_ELEMENT TileElem; pLand = gpWorldLevelData[ iMapIndex ].pLandHead; @@ -521,14 +521,14 @@ BOOLEAN AddLandToHead( UINT32 iMapIndex, UINT16 usIndex ) CHECKF( CreateLevelNode( &pNextLand ) != FALSE ); pNextLand->pNext = pLand; - pNextLand->pPrevNode = NULL; + pNextLand->pPrevNode = NULL; pNextLand->usIndex = usIndex; pNextLand->ubShadeLevel = LightGetAmbient(); if ( usIndex < NUMBEROFTILES ) { // Get tile element - TileElem = gTileDatabase[ usIndex ]; + TileElem = gTileDatabase[ usIndex ]; // Check for full tile if ( TileElem.ubFullTile ) @@ -566,12 +566,12 @@ BOOLEAN RemoveLand( UINT32 iMapIndex, UINT16 usIndex ) BOOLEAN RemoveLandEx( UINT32 iMapIndex, UINT16 usIndex ) { - LEVELNODE *pLand = NULL; + LEVELNODE *pLand = NULL; pLand = gpWorldLevelData[ iMapIndex ].pLandHead; // Look through all Lands and remove index if found - + while( pLand != NULL ) { if ( pLand->usIndex == usIndex ) @@ -617,9 +617,9 @@ BOOLEAN RemoveLandEx( UINT32 iMapIndex, UINT16 usIndex ) BOOLEAN AdjustForFullTile( UINT32 iMapIndex ) { - LEVELNODE *pLand = NULL; - LEVELNODE *pOldLand = NULL; - TILE_ELEMENT TileElem; + LEVELNODE *pLand = NULL; + LEVELNODE *pOldLand = NULL; + TILE_ELEMENT TileElem; // UINT32 iType; // UINT16 iNewIndex; @@ -637,8 +637,8 @@ BOOLEAN AdjustForFullTile( UINT32 iMapIndex ) // Check for full tile if ( TileElem.ubFullTile ) { - gpWorldLevelData[ iMapIndex ].pLandStart = pLand; - return( TRUE ); + gpWorldLevelData[ iMapIndex ].pLandStart = pLand; + return( TRUE ); } } pOldLand = pLand; @@ -660,10 +660,10 @@ BOOLEAN AdjustForFullTile( UINT32 iMapIndex ) pNewNode = AddLandToTail( iMapIndex, NewIndex ); - gpWorldLevelData[ iMapIndex ].pLandStart = pNewNode; + gpWorldLevelData[ iMapIndex ].pLandStart = pNewNode; + + } - } - return( FALSE ); } @@ -704,7 +704,7 @@ BOOLEAN ReplaceLandIndex( UINT32 iMapIndex, UINT16 usOldIndex, UINT16 usNewIndex BOOLEAN TypeExistsInLandLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusLandIndex ) { - LEVELNODE *pLand = NULL; + LEVELNODE *pLand = NULL; pLand = gpWorldLevelData[ iMapIndex ].pLandHead; @@ -715,8 +715,8 @@ BOOLEAN TypeExistsInLandLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusLandIn BOOLEAN TypeRangeExistsInLandLayer( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT16 *pusLandIndex ) { - LEVELNODE *pLand = NULL; - LEVELNODE *pOldLand = NULL; + LEVELNODE *pLand = NULL; + LEVELNODE *pOldLand = NULL; UINT32 fTileType; pLand = gpWorldLevelData[ iMapIndex ].pLandHead; @@ -753,8 +753,8 @@ BOOLEAN TypeRangeExistsInLandLayer( UINT32 iMapIndex, UINT32 fStartType, UINT32 BOOLEAN TypeRangeExistsInLandHead( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT16 *pusLandIndex ) { - LEVELNODE *pLand = NULL; - LEVELNODE *pOldLand = NULL; + LEVELNODE *pLand = NULL; + LEVELNODE *pOldLand = NULL; UINT32 fTileType; pLand = gpWorldLevelData[ iMapIndex ].pLandHead; @@ -785,8 +785,8 @@ BOOLEAN TypeRangeExistsInLandHead( UINT32 iMapIndex, UINT32 fStartType, UINT32 f BOOLEAN TypeRangeExistsInStructLayer( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT16 *pusStructIndex ) { - LEVELNODE *pStruct = NULL; - LEVELNODE *pOldStruct = NULL; + LEVELNODE *pStruct = NULL; + LEVELNODE *pOldStruct = NULL; UINT32 fTileType; pStruct = gpWorldLevelData[ iMapIndex ].pStructHead; @@ -820,8 +820,8 @@ BOOLEAN TypeRangeExistsInStructLayer( UINT32 iMapIndex, UINT32 fStartType, UINT3 BOOLEAN RemoveAllLandsOfTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType ) { - LEVELNODE *pLand = NULL; - LEVELNODE *pOldLand = NULL; + LEVELNODE *pLand = NULL; + LEVELNODE *pOldLand = NULL; UINT32 fTileType; BOOLEAN fRetVal = FALSE; @@ -857,7 +857,7 @@ BOOLEAN RemoveAllLandsOfTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 f void SetAllLandShadeLevels( UINT32 iMapIndex, UINT8 ubShadeLevel ) { - LEVELNODE *pLand = NULL; + LEVELNODE *pLand = NULL; pLand = gpWorldLevelData[ iMapIndex ].pLandHead; @@ -868,7 +868,7 @@ void SetAllLandShadeLevels( UINT32 iMapIndex, UINT8 ubShadeLevel ) void AdjustAllLandShadeLevels( UINT32 iMapIndex, INT8 bShadeDiff ) { - LEVELNODE *pLand = NULL; + LEVELNODE *pLand = NULL; pLand = gpWorldLevelData[ iMapIndex ].pLandHead; @@ -880,8 +880,8 @@ void AdjustAllLandShadeLevels( UINT32 iMapIndex, INT8 bShadeDiff ) BOOLEAN DeleteAllLandLayers( UINT32 iMapIndex ) { - LEVELNODE *pLand = NULL; - LEVELNODE *pOldLand = NULL; + LEVELNODE *pLand = NULL; + LEVELNODE *pOldLand = NULL; pLand = gpWorldLevelData[ iMapIndex ].pLandHead; @@ -908,9 +908,9 @@ BOOLEAN DeleteAllLandLayers( UINT32 iMapIndex ) BOOLEAN InsertLandIndexAtLevel( UINT32 iMapIndex, UINT16 usIndex, UINT8 ubLevel ) { - LEVELNODE *pLand = NULL; - LEVELNODE *pNextLand = NULL; - UINT8 level = 0; + LEVELNODE *pLand = NULL; + LEVELNODE *pNextLand = NULL; + UINT8 level = 0; BOOLEAN CanInsert = FALSE; pLand = gpWorldLevelData[ iMapIndex ].pLandHead; @@ -919,15 +919,15 @@ BOOLEAN InsertLandIndexAtLevel( UINT32 iMapIndex, UINT16 usIndex, UINT8 ubLevel // If we want to insert at head; if ( ubLevel == 0 ) { - AddLandToHead( iMapIndex, usIndex ); - return( TRUE ); + AddLandToHead( iMapIndex, usIndex ); + return( TRUE ); } // Allocate memory for new item CHECKF( CreateLevelNode( &pNextLand ) != FALSE ); pNextLand->usIndex = usIndex; - + // Move to index before insertion while( pLand != NULL ) { @@ -957,8 +957,8 @@ BOOLEAN InsertLandIndexAtLevel( UINT32 iMapIndex, UINT16 usIndex, UINT8 ubLevel if ( pNextLand->pNext == NULL ) { } - else - { + else + { pNextLand->pNext->pPrevNode = pNextLand; } @@ -971,10 +971,10 @@ BOOLEAN InsertLandIndexAtLevel( UINT32 iMapIndex, UINT16 usIndex, UINT8 ubLevel BOOLEAN RemoveHigherLandLevels( UINT32 iMapIndex, UINT32 fSrcType, UINT32 **puiHigherTypes, UINT8 *pubNumHigherTypes ) { - LEVELNODE *pLand = NULL; - LEVELNODE *pOldLand = NULL; + LEVELNODE *pLand = NULL; + LEVELNODE *pOldLand = NULL; UINT32 fTileType; - UINT8 ubSrcLogHeight; + UINT8 ubSrcLogHeight; *pubNumHigherTypes = 0; *puiHigherTypes = NULL; @@ -1005,7 +1005,7 @@ BOOLEAN RemoveHigherLandLevels( UINT32 iMapIndex, UINT32 fSrcType, UINT32 **puiH pLand = pLand->pPrevNode; if ( gTileTypeLogicalHeight[ fTileType ] > ubSrcLogHeight ) - { + { // Remove Item SetLandIndex( iMapIndex, pOldLand->usIndex, fTileType, TRUE ); @@ -1027,12 +1027,12 @@ BOOLEAN RemoveHigherLandLevels( UINT32 iMapIndex, UINT32 fSrcType, UINT32 **puiH } -BOOLEAN SetLowerLandLevels( UINT32 iMapIndex, UINT32 fSrcType, UINT16 usIndex ) +BOOLEAN SetLowerLandLevels( UINT32 iMapIndex, UINT32 fSrcType, UINT16 usIndex ) { - LEVELNODE *pLand = NULL; - LEVELNODE *pOldLand = NULL; + LEVELNODE *pLand = NULL; + LEVELNODE *pOldLand = NULL; UINT32 fTileType; - UINT8 ubSrcLogHeight; + UINT8 ubSrcLogHeight; UINT16 NewTile; pLand = gpWorldLevelData[ iMapIndex ].pLandHead; @@ -1051,7 +1051,7 @@ BOOLEAN SetLowerLandLevels( UINT32 iMapIndex, UINT32 fSrcType, UINT16 usIndex ) pLand = pLand->pNext; if ( gTileTypeLogicalHeight[ fTileType ] < ubSrcLogHeight ) - { + { // Set item GetTileIndexFromTypeSubIndex( fTileType, usIndex, &NewTile ); @@ -1087,7 +1087,7 @@ LEVELNODE *ForceStructToTail( UINT32 iMapIndex, UINT16 usIndex ) LEVELNODE *AddStructToTailCommon( UINT32 iMapIndex, UINT16 usIndex, BOOLEAN fAddStructDBInfo ) { - LEVELNODE *pStruct = NULL; + LEVELNODE *pStruct = NULL; LEVELNODE *pTailStruct = NULL; LEVELNODE *pNextStruct = NULL; DB_STRUCTURE * pDBStructure; @@ -1098,7 +1098,7 @@ LEVELNODE *AddStructToTailCommon( UINT32 iMapIndex, UINT16 usIndex, BOOLEAN fAdd if ( pStruct == NULL ) { CHECKF( CreateLevelNode( &pNextStruct ) != FALSE ); - + if ( fAddStructDBInfo ) { if ( usIndex < NUMBEROFTILES ) @@ -1114,13 +1114,13 @@ LEVELNODE *AddStructToTailCommon( UINT32 iMapIndex, UINT16 usIndex, BOOLEAN fAdd } else { - // pNextStruct->pStructureData = NULL; + // pNextStruct->pStructureData = NULL; } } } - + pNextStruct->usIndex = usIndex; - + pNextStruct->pNext = NULL; gpWorldLevelData[ iMapIndex ].pStructHead = pNextStruct; @@ -1202,8 +1202,8 @@ LEVELNODE *AddStructToTailCommon( UINT32 iMapIndex, UINT16 usIndex, BOOLEAN fAdd BOOLEAN AddStructToHead( UINT32 iMapIndex, UINT16 usIndex ) { - LEVELNODE *pStruct = NULL; - LEVELNODE *pNextStruct = NULL; + LEVELNODE *pStruct = NULL; + LEVELNODE *pNextStruct = NULL; DB_STRUCTURE * pDBStructure; pStruct = gpWorldLevelData[ iMapIndex ].pStructHead; @@ -1229,7 +1229,7 @@ BOOLEAN AddStructToHead( UINT32 iMapIndex, UINT16 usIndex ) // Set head gpWorldLevelData[ iMapIndex ].pStructHead = pNextStruct; - SetWorldFlagsFromNewNode( (UINT16)iMapIndex, pNextStruct->usIndex ); + SetWorldFlagsFromNewNode( (INT16)iMapIndex, pNextStruct->usIndex ); if ( usIndex < NUMBEROFTILES ) { @@ -1270,9 +1270,9 @@ BOOLEAN AddStructToHead( UINT32 iMapIndex, UINT16 usIndex ) BOOLEAN InsertStructIndex( UINT32 iMapIndex, UINT16 usIndex, UINT8 ubLevel ) { - LEVELNODE *pStruct = NULL; - LEVELNODE *pNextStruct = NULL; - UINT8 level = 0; + LEVELNODE *pStruct = NULL; + LEVELNODE *pNextStruct = NULL; + UINT8 level = 0; BOOLEAN CanInsert = FALSE; pStruct = gpWorldLevelData[ iMapIndex ].pStructHead; @@ -1280,7 +1280,7 @@ BOOLEAN InsertStructIndex( UINT32 iMapIndex, UINT16 usIndex, UINT8 ubLevel ) // If we want to insert at head; if ( ubLevel == 0 ) { - return( AddStructToHead( iMapIndex, usIndex ) ); + return( AddStructToHead( iMapIndex, usIndex ) ); } @@ -1288,7 +1288,7 @@ BOOLEAN InsertStructIndex( UINT32 iMapIndex, UINT16 usIndex, UINT8 ubLevel ) CHECKF( CreateLevelNode( &pNextStruct ) != FALSE ); pNextStruct->usIndex = usIndex; - + // Move to index before insertion while( pStruct != NULL ) { @@ -1347,7 +1347,7 @@ BOOLEAN ForceRemoveStructFromTail( UINT32 iMapIndex ) BOOLEAN RemoveStructFromTailCommon( UINT32 iMapIndex, BOOLEAN fRemoveStructDBInfo ) { - LEVELNODE *pStruct = NULL; + LEVELNODE *pStruct = NULL; LEVELNODE *pPrevStruct = NULL; UINT16 usIndex; @@ -1414,8 +1414,8 @@ BOOLEAN RemoveStructFromTailCommon( UINT32 iMapIndex, BOOLEAN fRemoveStructDBInf BOOLEAN RemoveStruct( UINT32 iMapIndex, UINT16 usIndex ) { - LEVELNODE *pStruct = NULL; - LEVELNODE *pOldStruct = NULL; + LEVELNODE *pStruct = NULL; + LEVELNODE *pOldStruct = NULL; pStruct = gpWorldLevelData[ iMapIndex ].pStructHead; @@ -1474,7 +1474,7 @@ BOOLEAN RemoveStruct( UINT32 iMapIndex, UINT16 usIndex ) } // Could not find it, return FALSE - RemoveWorldFlagsFromNewNode( (UINT16)iMapIndex, usIndex ); + RemoveWorldFlagsFromNewNode( (INT16)iMapIndex, usIndex ); return( FALSE ); @@ -1483,8 +1483,8 @@ BOOLEAN RemoveStruct( UINT32 iMapIndex, UINT16 usIndex ) BOOLEAN RemoveStructFromLevelNode( UINT32 iMapIndex, LEVELNODE *pNode ) { - LEVELNODE *pStruct = NULL; - LEVELNODE *pOldStruct = NULL; + LEVELNODE *pStruct = NULL; + LEVELNODE *pOldStruct = NULL; UINT16 usIndex; usIndex = pNode->usIndex; @@ -1535,7 +1535,7 @@ BOOLEAN RemoveStructFromLevelNode( UINT32 iMapIndex, LEVELNODE *pNode ) } // Could not find it, return FALSE - RemoveWorldFlagsFromNewNode( (UINT16)iMapIndex, usIndex ); + RemoveWorldFlagsFromNewNode( (INT16)iMapIndex, usIndex ); return( FALSE ); @@ -1544,8 +1544,8 @@ BOOLEAN RemoveStructFromLevelNode( UINT32 iMapIndex, LEVELNODE *pNode ) BOOLEAN RemoveAllStructsOfTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType ) { - LEVELNODE *pStruct = NULL; - LEVELNODE *pOldStruct = NULL; + LEVELNODE *pStruct = NULL; + LEVELNODE *pOldStruct = NULL; UINT32 fTileType; UINT16 usIndex; BOOLEAN fRetVal = FALSE; @@ -1588,8 +1588,8 @@ BOOLEAN RemoveAllStructsOfTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 return fRetVal; } -//Kris: This was a serious problem. When saving the map and then reloading it, the structure -// information was invalid if you changed the types, etc. This is the bulletproof way. +//Kris: This was a serious problem. When saving the map and then reloading it, the structure +// information was invalid if you changed the types, etc. This is the bulletproof way. BOOLEAN ReplaceStructIndex( UINT32 iMapIndex, UINT16 usOldIndex, UINT16 usNewIndex ) { RemoveStruct( iMapIndex, usOldIndex ); @@ -1638,7 +1638,7 @@ BOOLEAN AddWallToStructLayer( INT32 iMapIndex, UINT16 usIndex, BOOLEAN fReplace { GetWallOrientation( pStruct->usIndex, &usCheckWallOrient ); - //OLD CASE + //OLD CASE //if ( usCheckWallOrient > usWallOrientation ) //Kris: //New case -- If placing a new wall which is at right angles to the current wall, then @@ -1646,7 +1646,7 @@ BOOLEAN AddWallToStructLayer( INT32 iMapIndex, UINT16 usIndex, BOOLEAN fReplace if( usCheckWallOrient > usWallOrientation ) { if( (usWallOrientation == INSIDE_TOP_RIGHT || usWallOrientation == OUTSIDE_TOP_RIGHT) && - (usCheckWallOrient == INSIDE_TOP_LEFT || usCheckWallOrient == OUTSIDE_TOP_LEFT ) || + (usCheckWallOrient == INSIDE_TOP_LEFT || usCheckWallOrient == OUTSIDE_TOP_LEFT ) || (usWallOrientation == INSIDE_TOP_LEFT || usWallOrientation == OUTSIDE_TOP_LEFT) && (usCheckWallOrient == INSIDE_TOP_RIGHT || usCheckWallOrient == OUTSIDE_TOP_RIGHT ) ) { @@ -1667,23 +1667,23 @@ BOOLEAN AddWallToStructLayer( INT32 iMapIndex, UINT16 usIndex, BOOLEAN fReplace // Check if it's the same orientation //if ( usCheckWallOrient == usWallOrientation ) //Kris: - //New check -- we want to check for walls being parallel to each other. If so, then - //we we want to replace it. This is because of an existing problem with say, INSIDE_TOP_LEFT + //New check -- we want to check for walls being parallel to each other. If so, then + //we we want to replace it. This is because of an existing problem with say, INSIDE_TOP_LEFT //and OUTSIDE_TOP_LEFT walls coexisting. if( (usWallOrientation == INSIDE_TOP_RIGHT || usWallOrientation == OUTSIDE_TOP_RIGHT) && - (usCheckWallOrient == INSIDE_TOP_RIGHT || usCheckWallOrient == OUTSIDE_TOP_RIGHT ) || + (usCheckWallOrient == INSIDE_TOP_RIGHT || usCheckWallOrient == OUTSIDE_TOP_RIGHT ) || (usWallOrientation == INSIDE_TOP_LEFT || usWallOrientation == OUTSIDE_TOP_LEFT) && - (usCheckWallOrient == INSIDE_TOP_LEFT || usCheckWallOrient == OUTSIDE_TOP_LEFT ) ) + (usCheckWallOrient == INSIDE_TOP_LEFT || usCheckWallOrient == OUTSIDE_TOP_LEFT ) ) { - // Same, if replace, replace here - if ( fReplace ) - { + // Same, if replace, replace here + if ( fReplace ) + { return( ReplaceStructIndex( iMapIndex, pStruct->usIndex, usIndex ) ); - } - else - { + } + else + { return( FALSE ); - } + } } // Advance to next @@ -1696,20 +1696,20 @@ BOOLEAN AddWallToStructLayer( INT32 iMapIndex, UINT16 usIndex, BOOLEAN fReplace // Check if we found an insert position, otherwise set to head if ( fInsertFound ) { - // Insert struct at head - AddStructToHead( iMapIndex, usIndex ); + // Insert struct at head + AddStructToHead( iMapIndex, usIndex ); } else { - // Make sure it's ALWAYS after the roof ( if any ) - if ( fRoofFound ) - { + // Make sure it's ALWAYS after the roof ( if any ) + if ( fRoofFound ) + { InsertStructIndex( iMapIndex, usIndex, ubRoofLevel ); - } - else - { + } + else + { AddStructToTail( iMapIndex, usIndex ); - } + } } ResetSpecificLayerOptimizing( TILES_DYNAMIC_STRUCTURES ); @@ -1720,7 +1720,7 @@ BOOLEAN AddWallToStructLayer( INT32 iMapIndex, UINT16 usIndex, BOOLEAN fReplace BOOLEAN TypeExistsInStructLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusStructIndex ) { - LEVELNODE *pStruct = NULL; + LEVELNODE *pStruct = NULL; pStruct = gpWorldLevelData[ iMapIndex ].pStructHead; @@ -1730,7 +1730,7 @@ BOOLEAN TypeExistsInStructLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusStru void SetAllStructShadeLevels( UINT32 iMapIndex, UINT8 ubShadeLevel ) { - LEVELNODE *pStruct = NULL; + LEVELNODE *pStruct = NULL; pStruct = gpWorldLevelData[ iMapIndex ].pStructHead; @@ -1741,7 +1741,7 @@ void SetAllStructShadeLevels( UINT32 iMapIndex, UINT8 ubShadeLevel ) void AdjustAllStructShadeLevels( UINT32 iMapIndex, INT8 bShadeDiff ) { - LEVELNODE *pStruct = NULL; + LEVELNODE *pStruct = NULL; pStruct = gpWorldLevelData[ iMapIndex ].pStructHead; @@ -1750,10 +1750,10 @@ void AdjustAllStructShadeLevels( UINT32 iMapIndex, INT8 bShadeDiff ) } -void SetStructIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags ) +void SetStructIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags ) { - LEVELNODE *pStruct = NULL; - LEVELNODE *pOldStruct = NULL; + LEVELNODE *pStruct = NULL; + LEVELNODE *pOldStruct = NULL; UINT32 fTileType; pStruct = gpWorldLevelData[ iMapIndex ].pStructHead; @@ -1787,14 +1787,14 @@ BOOLEAN HideStructOfGivenType( UINT32 iMapIndex, UINT32 fType, BOOLEAN fHide ) { if ( fHide ) { - SetRoofIndexFlagsFromTypeRange( iMapIndex, fType, fType, LEVELNODE_HIDDEN ); + SetRoofIndexFlagsFromTypeRange( iMapIndex, fType, fType, LEVELNODE_HIDDEN ); } else { // ONLY UNHIDE IF NOT REAVEALED ALREADY if ( !(gpWorldLevelData[ iMapIndex ].uiFlags & MAPELEMENT_REVEALED ) ) { - RemoveRoofIndexFlagsFromTypeRange( iMapIndex, fType, fType, LEVELNODE_HIDDEN ); + RemoveRoofIndexFlagsFromTypeRange( iMapIndex, fType, fType, LEVELNODE_HIDDEN ); } } return( TRUE ); @@ -1802,10 +1802,10 @@ BOOLEAN HideStructOfGivenType( UINT32 iMapIndex, UINT32 fType, BOOLEAN fHide ) -void RemoveStructIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags ) +void RemoveStructIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags ) { - LEVELNODE *pStruct = NULL; - LEVELNODE *pOldStruct = NULL; + LEVELNODE *pStruct = NULL; + LEVELNODE *pOldStruct = NULL; UINT32 fTileType; pStruct = gpWorldLevelData[ iMapIndex ].pStructHead; @@ -1841,8 +1841,8 @@ void RemoveStructIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, U BOOLEAN AddShadowToTail( UINT32 iMapIndex, UINT16 usIndex ) { - LEVELNODE *pShadow = NULL; - LEVELNODE *pNextShadow = NULL; + LEVELNODE *pShadow = NULL; + LEVELNODE *pNextShadow = NULL; pShadow = gpWorldLevelData[ iMapIndex ].pShadowHead; @@ -1853,7 +1853,7 @@ BOOLEAN AddShadowToTail( UINT32 iMapIndex, UINT16 usIndex ) pShadow->usIndex = usIndex; gpWorldLevelData[ iMapIndex ].pShadowHead = pShadow; - + } else { @@ -1880,9 +1880,9 @@ BOOLEAN AddShadowToTail( UINT32 iMapIndex, UINT16 usIndex ) } -//Kris: identical shadows can exist in the same gridno, though it makes no sense -// because it actually renders the shadows darker than the others. This is an -// undesirable effect with walls and buildings so I added this function to make +//Kris: identical shadows can exist in the same gridno, though it makes no sense +// because it actually renders the shadows darker than the others. This is an +// undesirable effect with walls and buildings so I added this function to make // sure there isn't already a shadow before placing it. void AddExclusiveShadow( UINT32 iMapIndex, UINT16 usIndex ) { @@ -1920,8 +1920,8 @@ BOOLEAN AddShadowToHead( UINT32 iMapIndex, UINT16 usIndex ) BOOLEAN RemoveShadow( UINT32 iMapIndex, UINT16 usIndex ) { - LEVELNODE *pShadow = NULL; - LEVELNODE *pOldShadow = NULL; + LEVELNODE *pShadow = NULL; + LEVELNODE *pOldShadow = NULL; pShadow = gpWorldLevelData[ iMapIndex ].pShadowHead; @@ -1964,8 +1964,8 @@ BOOLEAN RemoveShadow( UINT32 iMapIndex, UINT16 usIndex ) BOOLEAN RemoveShadowFromLevelNode( UINT32 iMapIndex, LEVELNODE *pNode ) { - LEVELNODE *pShadow = NULL; - LEVELNODE *pOldShadow = NULL; + LEVELNODE *pShadow = NULL; + LEVELNODE *pOldShadow = NULL; pShadow = gpWorldLevelData[ iMapIndex ].pShadowHead; @@ -2008,8 +2008,8 @@ BOOLEAN RemoveShadowFromLevelNode( UINT32 iMapIndex, LEVELNODE *pNode ) BOOLEAN RemoveStructShadowPartner( UINT32 iMapIndex, UINT16 usIndex ) { - LEVELNODE *pShadow = NULL; - LEVELNODE *pOldShadow = NULL; + LEVELNODE *pShadow = NULL; + LEVELNODE *pOldShadow = NULL; pShadow = gpWorldLevelData[ iMapIndex ].pShadowHead; @@ -2052,8 +2052,8 @@ BOOLEAN RemoveStructShadowPartner( UINT32 iMapIndex, UINT16 usIndex ) BOOLEAN RemoveAllShadowsOfTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType ) { - LEVELNODE *pShadow = NULL; - LEVELNODE *pOldShadow = NULL; + LEVELNODE *pShadow = NULL; + LEVELNODE *pOldShadow = NULL; UINT32 fTileType; BOOLEAN fRetVal = FALSE; @@ -2088,8 +2088,8 @@ BOOLEAN RemoveAllShadowsOfTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 BOOLEAN RemoveAllShadows( UINT32 iMapIndex ) { - LEVELNODE *pShadow = NULL; - LEVELNODE *pOldShadow = NULL; + LEVELNODE *pShadow = NULL; + LEVELNODE *pOldShadow = NULL; BOOLEAN fRetVal = FALSE; pShadow = gpWorldLevelData[ iMapIndex ].pShadowHead; @@ -2117,7 +2117,7 @@ BOOLEAN RemoveAllShadows( UINT32 iMapIndex ) BOOLEAN TypeExistsInShadowLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusShadowIndex ) { - LEVELNODE *pShadow = NULL; + LEVELNODE *pShadow = NULL; pShadow = gpWorldLevelData[ iMapIndex ].pShadowHead; @@ -2131,8 +2131,8 @@ BOOLEAN TypeExistsInShadowLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusShad BOOLEAN AddMercToHead( UINT32 iMapIndex, SOLDIERTYPE *pSoldier, BOOLEAN fAddStructInfo ) { - LEVELNODE *pMerc = NULL; - LEVELNODE *pNextMerc = NULL; + LEVELNODE *pMerc = NULL; + LEVELNODE *pNextMerc = NULL; pMerc = gpWorldLevelData[ iMapIndex ].pMercHead; @@ -2148,9 +2148,9 @@ BOOLEAN AddMercToHead( UINT32 iMapIndex, SOLDIERTYPE *pSoldier, BOOLEAN fAddStru // Set soldier's levelnode pSoldier->pLevelNode = pNextMerc; - AddMercStructureInfo( (UINT16)iMapIndex, pSoldier ); + AddMercStructureInfo( (INT16)iMapIndex, pSoldier ); } - + // Set head gpWorldLevelData[ iMapIndex ].pMercHead = pNextMerc; @@ -2180,7 +2180,7 @@ BOOLEAN AddMercStructureInfoFromAnimSurface( INT16 sGridNo, SOLDIERTYPE *pSoldie BOOLEAN fReturn; // Turn off multi tile flag... - pSoldier->uiStatusFlags &= ( ~SOLDIER_MULTITILE ); + pSoldier->flags.uiStatusFlags &= ( ~SOLDIER_MULTITILE ); if ( pSoldier->pLevelNode == NULL ) { @@ -2204,11 +2204,11 @@ BOOLEAN AddMercStructureInfoFromAnimSurface( INT16 sGridNo, SOLDIERTYPE *pSoldie if ( pSoldier->ubBodyType == QUEENMONSTER ) { // Queen uses onely one direction.... - fReturn = AddStructureToWorld( sGridNo, pSoldier->bLevel, &( pStructureFileRef->pDBStructureRef[ 0 ] ), pSoldier->pLevelNode ); + fReturn = AddStructureToWorld( sGridNo, pSoldier->pathing.bLevel, &( pStructureFileRef->pDBStructureRef[ 0 ] ), pSoldier->pLevelNode ); } else { - fReturn = AddStructureToWorld( sGridNo, pSoldier->bLevel, &( pStructureFileRef->pDBStructureRef[ gOneCDirection[ pSoldier->ubDirection ] ] ), pSoldier->pLevelNode ); + fReturn = AddStructureToWorld( sGridNo, pSoldier->pathing.bLevel, &( pStructureFileRef->pDBStructureRef[ gOneCDirection[ pSoldier->ubDirection ] ] ), pSoldier->pLevelNode ); } /* if ( fReturn == FALSE ) @@ -2219,7 +2219,7 @@ BOOLEAN AddMercStructureInfoFromAnimSurface( INT16 sGridNo, SOLDIERTYPE *pSoldie pStructureFileRef = GetDefaultStructureRef( pSoldier->ubID ); if ( pStructureFileRef ) { - fReturn = AddStructureToWorld( sGridNo, pSoldier->bLevel, &( pStructureFileRef->pDBStructureRef[ gOneCDirection[ pSoldier->ubDirection ] ] ), pSoldier->pLevelNode ); + fReturn = AddStructureToWorld( sGridNo, pSoldier->pathing.bLevel, &( pStructureFileRef->pDBStructureRef[ gOneCDirection[ pSoldier->ubDirection ] ] ), pSoldier->pLevelNode ); } } */ @@ -2233,23 +2233,23 @@ BOOLEAN AddMercStructureInfoFromAnimSurface( INT16 sGridNo, SOLDIERTYPE *pSoldie if ( pStructureFileRef->pDBStructureRef[ gOneCDirection[ pSoldier->ubDirection ] ].pDBStructure->ubNumberOfTiles > 1 ) { // If we have more than one tile - pSoldier->uiStatusFlags |= SOLDIER_MULTITILE_Z; + pSoldier->flags.uiStatusFlags |= SOLDIER_MULTITILE_Z; } return( FALSE ); - } + } else { // Turn on if we are multi-tiled if ( pSoldier->pLevelNode->pStructureData->pDBStructureRef->pDBStructure->ubNumberOfTiles > 1 ) { // If we have more than one tile - pSoldier->uiStatusFlags |= SOLDIER_MULTITILE_Z; + pSoldier->flags.uiStatusFlags |= SOLDIER_MULTITILE_Z; } else { - //pSoldier->uiStatusFlags |= SOLDIER_MULTITILE_NZ; + //pSoldier->flags.uiStatusFlags |= SOLDIER_MULTITILE_NZ; } } } @@ -2263,10 +2263,10 @@ BOOLEAN OKToAddMercToWorld( SOLDIERTYPE *pSoldier, INT8 bDirection ) STRUCTURE_FILE_REF *pStructFileRef; UINT16 usOKToAddStructID; - // 0verhaul: Reinserting this check. If a soldier is sitting or standing on a grid and another soldier is lying prone - // across that grid but has the structure, this call will not allow the current soldier to turn. Since we are talking + // 0verhaul: Reinserting this check. If a soldier is sitting or standing on a grid and another soldier is lying prone + // across that grid but has the structure, this call will not allow the current soldier to turn. Since we are talking // about the soldier whose turn it is, this is not a good thing because it will lead to deadlock. - if ( pSoldier->uiStatusFlags & SOLDIER_MULTITILE || + if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE || pSoldier->usAnimState == CRAWLING) { // Get surface data @@ -2291,7 +2291,7 @@ BOOLEAN OKToAddMercToWorld( SOLDIERTYPE *pSoldier, INT8 bDirection ) usOKToAddStructID = INVALID_STRUCTURE_ID; } - if ( !OkayToAddStructureToWorld( pSoldier->sGridNo, pSoldier->bLevel, &(pStructFileRef->pDBStructureRef[gOneCDirection[ bDirection ]]), usOKToAddStructID )) + if ( !OkayToAddStructureToWorld( pSoldier->sGridNo, pSoldier->pathing.bLevel, &(pStructFileRef->pDBStructureRef[gOneCDirection[ bDirection ]]), usOKToAddStructID )) { return( FALSE ); } @@ -2299,7 +2299,7 @@ BOOLEAN OKToAddMercToWorld( SOLDIERTYPE *pSoldier, INT8 bDirection ) } return( TRUE ); -} +} BOOLEAN UpdateMercStructureInfo( SOLDIERTYPE *pSoldier ) @@ -2319,8 +2319,8 @@ BOOLEAN UpdateMercStructureInfo( SOLDIERTYPE *pSoldier ) BOOLEAN RemoveMerc( UINT32 iMapIndex, SOLDIERTYPE *pSoldier, BOOLEAN fPlaceHolder ) { - LEVELNODE *pMerc = NULL; - LEVELNODE *pOldMerc = NULL; + LEVELNODE *pMerc = NULL; + LEVELNODE *pOldMerc = NULL; BOOLEAN fMercFound; if ( iMapIndex == NOWHERE ) @@ -2401,8 +2401,8 @@ BOOLEAN RemoveMerc( UINT32 iMapIndex, SOLDIERTYPE *pSoldier, BOOLEAN fPlaceHolde LEVELNODE *AddRoofToTail( UINT32 iMapIndex, UINT16 usIndex ) { - LEVELNODE *pRoof = NULL; - LEVELNODE *pNextRoof = NULL; + LEVELNODE *pRoof = NULL; + LEVELNODE *pNextRoof = NULL; pRoof = gpWorldLevelData[ iMapIndex ].pRoofHead; @@ -2474,8 +2474,8 @@ LEVELNODE *AddRoofToTail( UINT32 iMapIndex, UINT16 usIndex ) BOOLEAN AddRoofToHead( UINT32 iMapIndex, UINT16 usIndex ) { - LEVELNODE *pRoof = NULL; - LEVELNODE *pNextRoof = NULL; + LEVELNODE *pRoof = NULL; + LEVELNODE *pNextRoof = NULL; pRoof = gpWorldLevelData[ iMapIndex ].pRoofHead; @@ -2509,8 +2509,8 @@ BOOLEAN AddRoofToHead( UINT32 iMapIndex, UINT16 usIndex ) BOOLEAN RemoveRoof( UINT32 iMapIndex, UINT16 usIndex ) { - LEVELNODE *pRoof = NULL; - LEVELNODE *pOldRoof = NULL; + LEVELNODE *pRoof = NULL; + LEVELNODE *pOldRoof = NULL; pRoof = gpWorldLevelData[ iMapIndex ].pRoofHead; @@ -2553,7 +2553,7 @@ BOOLEAN RemoveRoof( UINT32 iMapIndex, UINT16 usIndex ) BOOLEAN TypeExistsInRoofLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusRoofIndex ) { - LEVELNODE *pRoof = NULL; + LEVELNODE *pRoof = NULL; pRoof = gpWorldLevelData[ iMapIndex ].pRoofHead; @@ -2563,8 +2563,8 @@ BOOLEAN TypeExistsInRoofLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusRoofIn BOOLEAN TypeRangeExistsInRoofLayer( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT16 *pusRoofIndex ) { - LEVELNODE *pRoof = NULL; - LEVELNODE *pOldRoof = NULL; + LEVELNODE *pRoof = NULL; + LEVELNODE *pOldRoof = NULL; UINT32 fTileType; pRoof = gpWorldLevelData[ iMapIndex ].pRoofHead; @@ -2598,8 +2598,7 @@ BOOLEAN TypeRangeExistsInRoofLayer( UINT32 iMapIndex, UINT32 fStartType, UINT32 BOOLEAN IndexExistsInRoofLayer( INT16 sGridNo, UINT16 usIndex ) { - LEVELNODE *pRoof = NULL; - LEVELNODE *pOldRoof = NULL; + LEVELNODE *pRoof = NULL; pRoof = gpWorldLevelData[ sGridNo ].pRoofHead; @@ -2625,7 +2624,7 @@ BOOLEAN IndexExistsInRoofLayer( INT16 sGridNo, UINT16 usIndex ) void SetAllRoofShadeLevels( UINT32 iMapIndex, UINT8 ubShadeLevel ) { - LEVELNODE *pRoof = NULL; + LEVELNODE *pRoof = NULL; pRoof = gpWorldLevelData[ iMapIndex ].pRoofHead; @@ -2636,7 +2635,7 @@ void SetAllRoofShadeLevels( UINT32 iMapIndex, UINT8 ubShadeLevel ) void AdjustAllRoofShadeLevels( UINT32 iMapIndex, INT8 bShadeDiff ) { - LEVELNODE *pRoof = NULL; + LEVELNODE *pRoof = NULL; pRoof = gpWorldLevelData[ iMapIndex ].pRoofHead; @@ -2649,8 +2648,8 @@ void AdjustAllRoofShadeLevels( UINT32 iMapIndex, INT8 bShadeDiff ) BOOLEAN RemoveAllRoofsOfTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType ) { - LEVELNODE *pRoof = NULL; - LEVELNODE *pOldRoof = NULL; + LEVELNODE *pRoof = NULL; + LEVELNODE *pOldRoof = NULL; UINT32 fTileType; BOOLEAN fRetVal = FALSE; @@ -2687,10 +2686,10 @@ BOOLEAN RemoveAllRoofsOfTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 f } -void RemoveRoofIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags ) +void RemoveRoofIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags ) { - LEVELNODE *pRoof = NULL; - LEVELNODE *pOldRoof = NULL; + LEVELNODE *pRoof = NULL; + LEVELNODE *pOldRoof = NULL; UINT32 fTileType; pRoof = gpWorldLevelData[ iMapIndex ].pRoofHead; @@ -2720,10 +2719,10 @@ void RemoveRoofIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, UIN } -void SetRoofIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags ) +void SetRoofIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags ) { - LEVELNODE *pRoof = NULL; - LEVELNODE *pOldRoof = NULL; + LEVELNODE *pRoof = NULL; + LEVELNODE *pOldRoof = NULL; UINT32 fTileType; pRoof = gpWorldLevelData[ iMapIndex ].pRoofHead; @@ -2752,15 +2751,15 @@ void SetRoofIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 } } - + // OnRoof layer // ################################################################# LEVELNODE *AddOnRoofToTail( UINT32 iMapIndex, UINT16 usIndex ) { - LEVELNODE *pOnRoof = NULL; - LEVELNODE *pNextOnRoof = NULL; + LEVELNODE *pOnRoof = NULL; + LEVELNODE *pNextOnRoof = NULL; pOnRoof = gpWorldLevelData[ iMapIndex ].pOnRoofHead; @@ -2784,7 +2783,7 @@ LEVELNODE *AddOnRoofToTail( UINT32 iMapIndex, UINT16 usIndex ) pOnRoof->usIndex = usIndex; gpWorldLevelData[ iMapIndex ].pOnRoofHead = pOnRoof; - + ResetSpecificLayerOptimizing( TILES_DYNAMIC_ONROOF ); return( pOnRoof ); @@ -2832,8 +2831,8 @@ LEVELNODE *AddOnRoofToTail( UINT32 iMapIndex, UINT16 usIndex ) BOOLEAN AddOnRoofToHead( UINT32 iMapIndex, UINT16 usIndex ) { - LEVELNODE *pOnRoof = NULL; - LEVELNODE *pNextOnRoof = NULL; + LEVELNODE *pOnRoof = NULL; + LEVELNODE *pNextOnRoof = NULL; pOnRoof = gpWorldLevelData[ iMapIndex ].pOnRoofHead; @@ -2866,8 +2865,8 @@ BOOLEAN AddOnRoofToHead( UINT32 iMapIndex, UINT16 usIndex ) BOOLEAN RemoveOnRoof( UINT32 iMapIndex, UINT16 usIndex ) { - LEVELNODE *pOnRoof = NULL; - LEVELNODE *pOldOnRoof = NULL; + LEVELNODE *pOnRoof = NULL; + LEVELNODE *pOldOnRoof = NULL; pOnRoof = gpWorldLevelData[ iMapIndex ].pOnRoofHead; @@ -2910,8 +2909,8 @@ BOOLEAN RemoveOnRoof( UINT32 iMapIndex, UINT16 usIndex ) BOOLEAN RemoveOnRoofFromLevelNode( UINT32 iMapIndex, LEVELNODE *pNode ) { - LEVELNODE *pOnRoof = NULL; - LEVELNODE *pOldOnRoof = NULL; + LEVELNODE *pOnRoof = NULL; + LEVELNODE *pOldOnRoof = NULL; pOnRoof = gpWorldLevelData[ iMapIndex ].pOnRoofHead; @@ -2954,7 +2953,7 @@ BOOLEAN RemoveOnRoofFromLevelNode( UINT32 iMapIndex, LEVELNODE *pNode ) BOOLEAN TypeExistsInOnRoofLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusOnRoofIndex ) { - LEVELNODE *pOnRoof = NULL; + LEVELNODE *pOnRoof = NULL; pOnRoof = gpWorldLevelData[ iMapIndex ].pOnRoofHead; @@ -2964,7 +2963,7 @@ BOOLEAN TypeExistsInOnRoofLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusOnRo void SetAllOnRoofShadeLevels( UINT32 iMapIndex, UINT8 ubShadeLevel ) { - LEVELNODE *pOnRoof = NULL; + LEVELNODE *pOnRoof = NULL; pOnRoof = gpWorldLevelData[ iMapIndex ].pOnRoofHead; @@ -2975,7 +2974,7 @@ void SetAllOnRoofShadeLevels( UINT32 iMapIndex, UINT8 ubShadeLevel ) void AdjustAllOnRoofShadeLevels( UINT32 iMapIndex, INT8 bShadeDiff ) { - LEVELNODE *pOnRoof = NULL; + LEVELNODE *pOnRoof = NULL; pOnRoof = gpWorldLevelData[ iMapIndex ].pOnRoofHead; @@ -2988,8 +2987,8 @@ void AdjustAllOnRoofShadeLevels( UINT32 iMapIndex, INT8 bShadeDiff ) BOOLEAN RemoveAllOnRoofsOfTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType ) { - LEVELNODE *pOnRoof = NULL; - LEVELNODE *pOldOnRoof = NULL; + LEVELNODE *pOnRoof = NULL; + LEVELNODE *pOldOnRoof = NULL; UINT32 fTileType; BOOLEAN fRetVal = FALSE; @@ -3026,10 +3025,10 @@ BOOLEAN RemoveAllOnRoofsOfTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 // Topmost layer // ################################################################# -LEVELNODE *AddTopmostToTail( UINT32 iMapIndex, UINT16 usIndex ) +LEVELNODE *AddTopmostToTail( UINT32 iMapIndex, UINT16 usIndex ) { - LEVELNODE *pTopmost = NULL; - LEVELNODE *pNextTopmost = NULL; + LEVELNODE *pTopmost = NULL; + LEVELNODE *pNextTopmost = NULL; pTopmost = gpWorldLevelData[ iMapIndex ].pTopmostHead; @@ -3040,7 +3039,7 @@ LEVELNODE *AddTopmostToTail( UINT32 iMapIndex, UINT16 usIndex ) pNextTopmost->usIndex = usIndex; gpWorldLevelData[ iMapIndex ].pTopmostHead = pNextTopmost; - + } else { @@ -3070,7 +3069,7 @@ LEVELNODE *AddTopmostToTail( UINT32 iMapIndex, UINT16 usIndex ) BOOLEAN AddUIElem( UINT32 iMapIndex, UINT16 usIndex, INT8 sRelativeX, INT8 sRelativeY, LEVELNODE **ppNewNode ) { - LEVELNODE *pTopmost = NULL; + LEVELNODE *pTopmost = NULL; pTopmost = AddTopmostToTail( iMapIndex, usIndex ); @@ -3099,8 +3098,8 @@ void RemoveUIElem( UINT32 iMapIndex, UINT16 usIndex ) BOOLEAN AddTopmostToHead( UINT32 iMapIndex, UINT16 usIndex ) { - LEVELNODE *pTopmost = NULL; - LEVELNODE *pNextTopmost = NULL; + LEVELNODE *pTopmost = NULL; + LEVELNODE *pNextTopmost = NULL; pTopmost = gpWorldLevelData[ iMapIndex ].pTopmostHead; @@ -3120,8 +3119,8 @@ BOOLEAN AddTopmostToHead( UINT32 iMapIndex, UINT16 usIndex ) BOOLEAN RemoveTopmost( UINT32 iMapIndex, UINT16 usIndex ) { - LEVELNODE *pTopmost = NULL; - LEVELNODE *pOldTopmost = NULL; + LEVELNODE *pTopmost = NULL; + LEVELNODE *pOldTopmost = NULL; pTopmost = gpWorldLevelData[ iMapIndex ].pTopmostHead; @@ -3164,8 +3163,8 @@ BOOLEAN RemoveTopmost( UINT32 iMapIndex, UINT16 usIndex ) BOOLEAN RemoveTopmostFromLevelNode( UINT32 iMapIndex, LEVELNODE *pNode ) { - LEVELNODE *pTopmost = NULL; - LEVELNODE *pOldTopmost = NULL; + LEVELNODE *pTopmost = NULL; + LEVELNODE *pOldTopmost = NULL; UINT16 usIndex; usIndex = pNode->usIndex; @@ -3211,8 +3210,8 @@ BOOLEAN RemoveTopmostFromLevelNode( UINT32 iMapIndex, LEVELNODE *pNode ) BOOLEAN RemoveAllTopmostsOfTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType ) { - LEVELNODE *pTopmost = NULL; - LEVELNODE *pOldTopmost = NULL; + LEVELNODE *pTopmost = NULL; + LEVELNODE *pOldTopmost = NULL; UINT32 fTileType; BOOLEAN fRetVal = FALSE; @@ -3240,12 +3239,12 @@ BOOLEAN RemoveAllTopmostsOfTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT3 } } - return fRetVal; + return fRetVal; } BOOLEAN TypeExistsInTopmostLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusTopmostIndex ) { - LEVELNODE *pTopmost = NULL; + LEVELNODE *pTopmost = NULL; pTopmost = gpWorldLevelData[ iMapIndex ].pTopmostHead; @@ -3255,7 +3254,7 @@ BOOLEAN TypeExistsInTopmostLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusTop void SetTopmostFlags( UINT32 iMapIndex, UINT32 uiFlags, UINT16 usIndex ) { - LEVELNODE *pTopmost = NULL; + LEVELNODE *pTopmost = NULL; pTopmost = gpWorldLevelData[ iMapIndex ].pTopmostHead; @@ -3264,7 +3263,7 @@ void SetTopmostFlags( UINT32 iMapIndex, UINT32 uiFlags, UINT16 usIndex ) void RemoveTopmostFlags( UINT32 iMapIndex, UINT32 uiFlags, UINT16 usIndex ) { - LEVELNODE *pTopmost = NULL; + LEVELNODE *pTopmost = NULL; pTopmost = gpWorldLevelData[ iMapIndex ].pTopmostHead; @@ -3375,17 +3374,17 @@ UINT8 WhoIsThere2( INT16 sGridNo, INT8 bLevel ) { STRUCTURE * pStructure; - if ( !GridNoOnVisibleWorldTile( sGridNo ) ) - { - return( NOBODY ); - } + if ( !GridNoOnVisibleWorldTile( sGridNo ) ) + { + return( NOBODY ); + } if ( gpWorldLevelData[ sGridNo ].pStructureHead != NULL ) { pStructure = gpWorldLevelData[ sGridNo ].pStructureHead; - + while ( pStructure ) { // person must either have their pSoldier->sGridNo here or be non-passable @@ -3435,15 +3434,15 @@ BOOLEAN Water( INT16 sGridNo ) { MAP_ELEMENT * pMapElement; - if ( sGridNo == NOWHERE ) - { - return( FALSE ); - } + if ( sGridNo == NOWHERE ) + { + return( FALSE ); + } pMapElement = &(gpWorldLevelData[sGridNo]); if ( TERRAIN_IS_WATER( pMapElement->ubTerrainID) ) { - // check for a bridge! otherwise... + // check for a bridge! otherwise... return( TRUE ); } else @@ -3459,7 +3458,7 @@ BOOLEAN DeepWater( INT16 sGridNo ) pMapElement = &(gpWorldLevelData[sGridNo]); if (TERRAIN_IS_DEEP_WATER( pMapElement->ubTerrainID) ) { - // check for a bridge! otherwise... + // check for a bridge! otherwise... return( TRUE ); } else @@ -3468,15 +3467,15 @@ BOOLEAN DeepWater( INT16 sGridNo ) } } -BOOLEAN WaterTooDeepForAttacks( INT16 sGridNo ) +BOOLEAN WaterTooDeepForAttacks( INT16 sGridNo ) { return( DeepWater( sGridNo ) ); } -void SetStructAframeFlags( UINT32 iMapIndex, UINT32 uiFlags ) +void SetStructAframeFlags( UINT32 iMapIndex, UINT32 uiFlags ) { - LEVELNODE *pStruct = NULL; - LEVELNODE *pOldStruct = NULL; + LEVELNODE *pStruct = NULL; + LEVELNODE *pOldStruct = NULL; UINT32 uiTileFlags; pStruct = gpWorldLevelData[ iMapIndex ].pRoofHead; @@ -3505,10 +3504,10 @@ void SetStructAframeFlags( UINT32 iMapIndex, UINT32 uiFlags ) } -void RemoveStructAframeFlags( UINT32 iMapIndex, UINT32 uiFlags ) +void RemoveStructAframeFlags( UINT32 iMapIndex, UINT32 uiFlags ) { - LEVELNODE *pStruct = NULL; - LEVELNODE *pOldStruct = NULL; + LEVELNODE *pStruct = NULL; + LEVELNODE *pOldStruct = NULL; UINT32 uiTileFlags; pStruct = gpWorldLevelData[ iMapIndex ].pRoofHead; @@ -3603,7 +3602,7 @@ LEVELNODE * FindShadow( INT16 sGridNo, UINT16 usStructIndex ) } usShadowIndex = usStructIndex - FIRSTOSTRUCT1 + FIRSTSHADOW1; - + pLevelNode = gpWorldLevelData[sGridNo].pShadowHead; while( pLevelNode != NULL ) { @@ -3636,7 +3635,7 @@ UINT32 cnt; { if ( !( pNode->uiFlags & LEVELNODE_REVEALTREES ) ) { - pNode->uiFlags |= ( LEVELNODE_REVEALTREES ); + pNode->uiFlags |= ( LEVELNODE_REVEALTREES ); } fRerender=TRUE; @@ -3668,7 +3667,7 @@ UINT32 cnt; if ( ( pNode->uiFlags & LEVELNODE_REVEALTREES ) ) { - pNode->uiFlags &=(~( LEVELNODE_REVEALTREES ) ); + pNode->uiFlags &=(~( LEVELNODE_REVEALTREES ) ); } fRerender=TRUE; @@ -3684,21 +3683,21 @@ UINT32 cnt; -void SetWorldFlagsFromNewNode( UINT16 sGridNo, UINT16 usIndex ) +void SetWorldFlagsFromNewNode( INT16 sGridNo, UINT16 usIndex ) { } -void RemoveWorldFlagsFromNewNode( UINT16 sGridNo, UINT16 usIndex ) +void RemoveWorldFlagsFromNewNode( INT16 sGridNo, UINT16 usIndex ) { } -void SetWallLevelnodeFlags( UINT16 sGridNo, UINT32 uiFlags ) +void SetWallLevelnodeFlags( INT16 sGridNo, UINT32 uiFlags ) { - LEVELNODE *pStruct = NULL; - + LEVELNODE *pStruct = NULL; + pStruct = gpWorldLevelData[ sGridNo ].pStructHead; // Look through all objects and Search for type @@ -3720,10 +3719,10 @@ void SetWallLevelnodeFlags( UINT16 sGridNo, UINT32 uiFlags ) } } -void RemoveWallLevelnodeFlags( UINT16 sGridNo, UINT32 uiFlags ) +void RemoveWallLevelnodeFlags( INT16 sGridNo, UINT32 uiFlags ) { - LEVELNODE *pStruct = NULL; - + LEVELNODE *pStruct = NULL; + pStruct = gpWorldLevelData[ sGridNo ].pStructHead; // Look through all objects and Search for type diff --git a/TileEngine/worldman.h b/TileEngine/worldman.h index c190ce12..e02aa745 100644 --- a/TileEngine/worldman.h +++ b/TileEngine/worldman.h @@ -18,17 +18,17 @@ BOOLEAN TypeRangeExistsInObjectLayer( UINT32 iMapIndex, UINT32 fStartType, UINT3 // Roof manipulation functions BOOLEAN RemoveRoof( UINT32 iMapIndex, UINT16 usIndex ); -LEVELNODE *AddRoofToTail( UINT32 iMapIndex, UINT16 usIndex ); +LEVELNODE *AddRoofToTail( UINT32 iMapIndex, UINT16 usIndex ); BOOLEAN AddRoofToHead( UINT32 iMapIndex, UINT16 usIndex ); BOOLEAN TypeExistsInRoofLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusRoofIndex ); BOOLEAN RemoveAllRoofsOfTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType ); void SetAllRoofShadeLevels( UINT32 iMapIndex, UINT8 ubShadeLevel ); void AdjustAllRoofShadeLevels( UINT32 iMapIndex, INT8 bShadeDiff ); -void RemoveRoofIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags ); -void SetRoofIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags ); +void RemoveRoofIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags ); +void SetRoofIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags ); BOOLEAN TypeRangeExistsInRoofLayer( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT16 *pusRoofIndex ); -void SetWallLevelnodeFlags( UINT16 sGridNo, UINT32 uiFlags ); -void RemoveWallLevelnodeFlags( UINT16 sGridNo, UINT32 uiFlags ); +void SetWallLevelnodeFlags( INT16 sGridNo, UINT32 uiFlags ); +void RemoveWallLevelnodeFlags( INT16 sGridNo, UINT32 uiFlags ); BOOLEAN IndexExistsInRoofLayer( INT16 sGridNo, UINT16 usIndex ); @@ -55,7 +55,7 @@ BOOLEAN ReplaceLandIndex( UINT32 iMapIndex, UINT16 usOldIndex, UINT16 usNewIndex BOOLEAN DeleteAllLandLayers( UINT32 iMapIndex ); BOOLEAN InsertLandIndexAtLevel( UINT32 iMapIndex, UINT16 usIndex, UINT8 ubLevel ); BOOLEAN RemoveHigherLandLevels( UINT32 iMapIndex, UINT32 fSrcType, UINT32 **puiHigherTypes, UINT8 *pubNumHigherTypes ); -BOOLEAN SetLowerLandLevels( UINT32 iMapIndex, UINT32 fSrcType, UINT16 usIndex ); +BOOLEAN SetLowerLandLevels( UINT32 iMapIndex, UINT32 fSrcType, UINT16 usIndex ); BOOLEAN AdjustForFullTile( UINT32 iMapIndex ); void SetAllLandShadeLevels( UINT32 iMapIndex, UINT8 ubShadeLevel ); void AdjustAllLandShadeLevels( UINT32 iMapIndex, INT8 bShadeDiff ); @@ -80,10 +80,10 @@ BOOLEAN HideStructOfGivenType( UINT32 iMapIndex, UINT32 fType, BOOLEAN fHide ); BOOLEAN InsertStructIndex( UINT32 iMapIndex, UINT16 usIndex, UINT8 ubLevel ); void SetAllStructShadeLevels( UINT32 iMapIndex, UINT8 ubShadeLevel ); void AdjustAllStructShadeLevels( UINT32 iMapIndex, INT8 bShadeDiff ); -void SetStructIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags ); -void RemoveStructIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags ); -void SetStructAframeFlags( UINT32 iMapIndex, UINT32 uiFlags ); -void RemoveStructAframeFlags( UINT32 iMapIndex, UINT32 uiFlags ); +void SetStructIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags ); +void RemoveStructIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags ); +void SetStructAframeFlags( UINT32 iMapIndex, UINT32 uiFlags ); +void RemoveStructAframeFlags( UINT32 iMapIndex, UINT32 uiFlags ); BOOLEAN RemoveStructFromLevelNode( UINT32 iMapIndex, LEVELNODE *pNode ); @@ -109,7 +109,7 @@ BOOLEAN RemoveShadowFromLevelNode( UINT32 iMapIndex, LEVELNODE *pNode ); // ################################################################# BOOLEAN AddMercToHead( UINT32 iMapIndex, SOLDIERTYPE *pSoldier, BOOLEAN fAddStructInfo ); -BOOLEAN RemoveMerc( UINT32 iMapIndex, SOLDIERTYPE *pSoldier, BOOLEAN fPlaceHolder ); +BOOLEAN RemoveMerc( UINT32 iMapIndex, SOLDIERTYPE *pSoldier, BOOLEAN fPlaceHolder ); UINT8 WhoIsThere2( INT16 sGridNo, INT8 bLevel ); BOOLEAN AddMercStructureInfo( INT16 sGridNo, SOLDIERTYPE *pSoldier ); BOOLEAN AddMercStructureInfoFromAnimSurface( INT16 sGridNo, SOLDIERTYPE *pSoldier, UINT16 usAnimSurface, UINT16 usAnimState ); @@ -118,7 +118,7 @@ BOOLEAN OKToAddMercToWorld( SOLDIERTYPE *pSoldier, INT8 bDirection ); // TOPMOST manipulation functions -LEVELNODE *AddTopmostToTail( UINT32 iMapIndex, UINT16 usIndex ); +LEVELNODE *AddTopmostToTail( UINT32 iMapIndex, UINT16 usIndex ); BOOLEAN AddTopmostToHead( UINT32 iMapIndex, UINT16 usIndex ); BOOLEAN RemoveTopmost( UINT32 iMapIndex, UINT16 usIndex ); BOOLEAN TypeExistsInTopmostLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusTopmostIndex ); diff --git a/Utils/Animated ProgressBar.cpp b/Utils/Animated ProgressBar.cpp index eeea9c20..9ed515ce 100644 --- a/Utils/Animated ProgressBar.cpp +++ b/Utils/Animated ProgressBar.cpp @@ -33,7 +33,7 @@ void CreateLoadingScreenProgressBar() gusLeftmostShaded = 162; gfUseLoadScreenProgressBar = TRUE; - // Special case -> show small image centered + // Special case->show small image centered if (bShowSmallImage == TRUE) { if (iResolution > 0) @@ -104,10 +104,10 @@ BOOLEAN CreateProgressBar( UINT8 ubProgressBarID, UINT16 usLeft, UINT16 usTop, U return TRUE; } -//You may also define a panel to go in behind the progress bar. You can now assign a title to go with +//You may also define a panel to go in behind the progress bar. You can now assign a title to go with //the panel. void DefineProgressBarPanel( UINT32 ubID, UINT8 r, UINT8 g, UINT8 b, - UINT16 usLeft, UINT16 usTop, UINT16 usRight, UINT16 usBottom ) + UINT16 usLeft, UINT16 usTop, UINT16 usRight, UINT16 usBottom ) { PROGRESSBAR *pCurr; Assert( ubID < MAX_PROGRESSBARS ); @@ -122,9 +122,9 @@ void DefineProgressBarPanel( UINT32 ubID, UINT8 r, UINT8 g, UINT8 b, pCurr->usPanelBottom = usBottom; pCurr->usColor = Get16BPPColor( FROMRGB( r, g, b ) ); //Calculate the slightly lighter and darker versions of the same rgb color - pCurr->usLtColor = Get16BPPColor( FROMRGB( (UINT8)min( 255, (UINT16)(r*1.33)), - (UINT8)min( 255, (UINT16)(g*1.33)), - (UINT8)min( 255, (UINT16)(b*1.33)) )); + pCurr->usLtColor = Get16BPPColor( FROMRGB( (UINT8)min( 255, (UINT16)(r*1.33)), + (UINT8)min( 255, (UINT16)(g*1.33)), + (UINT8)min( 255, (UINT16)(b*1.33)) )); pCurr->usDkColor = Get16BPPColor( FROMRGB( (UINT8)(r*0.75), (UINT8)(g*0.75), (UINT8)(b*0.75) ) ); } @@ -181,12 +181,12 @@ void RemoveProgressBar( UINT8 ubID ) } } -//An important setup function. The best explanation is through example. The example being the loading -//of a file -- there are many stages of the map loading. In JA2, the first step is to load the tileset. +//An important setup function. The best explanation is through example. The example being the loading +//of a file -- there are many stages of the map loading. In JA2, the first step is to load the tileset. //Because it is a large chunk of the total loading of the map, we may gauge that it takes up 30% of the -//total load. Because it is also at the beginning, we would pass in the arguments ( 0, 30, "text" ). +//total load. Because it is also at the beginning, we would pass in the arguments ( 0, 30, "text" ). //As the process animates using UpdateProgressBar( 0 to 100 ), the total progress bar will only reach 30% -//at the 100% mark within UpdateProgressBar. At that time, you would go onto the next step, resetting the +//at the 100% mark within UpdateProgressBar. At that time, you would go onto the next step, resetting the //relative start and end percentage from 30 to whatever, until your done. void SetRelativeStartAndEndPercentage( UINT8 ubID, UINT32 uiRelStartPerc, UINT32 uiRelEndPerc, STR16 str) { @@ -205,11 +205,11 @@ void SetRelativeStartAndEndPercentage( UINT8 ubID, UINT32 uiRelStartPerc, UINT32 if( pCurr->fPanel ) { //Draw panel - ColorFillVideoSurfaceArea( FRAME_BUFFER, + ColorFillVideoSurfaceArea( FRAME_BUFFER, pCurr->usPanelLeft, pCurr->usPanelTop, pCurr->usPanelRight, pCurr->usPanelBottom, pCurr->usLtColor ); - ColorFillVideoSurfaceArea( FRAME_BUFFER, + ColorFillVideoSurfaceArea( FRAME_BUFFER, pCurr->usPanelLeft+1, pCurr->usPanelTop+1, pCurr->usPanelRight, pCurr->usPanelBottom, pCurr->usDkColor ); - ColorFillVideoSurfaceArea( FRAME_BUFFER, + ColorFillVideoSurfaceArea( FRAME_BUFFER, pCurr->usPanelLeft+1, pCurr->usPanelTop+1, pCurr->usPanelRight-1, pCurr->usPanelBottom-1, pCurr->usColor ); InvalidateRegion( pCurr->usPanelLeft, pCurr->usPanelTop, pCurr->usPanelRight, pCurr->usPanelBottom ); //Draw title @@ -217,8 +217,8 @@ void SetRelativeStartAndEndPercentage( UINT8 ubID, UINT32 uiRelStartPerc, UINT32 if( pCurr->swzTitle ) { usStartX = pCurr->usPanelLeft + // left position - (pCurr->usPanelRight - pCurr->usPanelLeft)/2 - // + half width - StringPixLength( pCurr->swzTitle, pCurr->usTitleFont ) / 2; // - half string width + (pCurr->usPanelRight - pCurr->usPanelLeft)/2 - // + half width + StringPixLength( pCurr->swzTitle, pCurr->usTitleFont ) / 2; // - half string width usStartY = pCurr->usPanelTop + 3; SetFont( pCurr->usTitleFont ); SetFontForeground( pCurr->ubTitleFontForeColor ); @@ -249,9 +249,9 @@ void SetRelativeStartAndEndPercentage( UINT8 ubID, UINT32 uiRelStartPerc, UINT32 } } -//This part renders the progress bar at the percentage level that you specify. If you have set relative +//This part renders the progress bar at the percentage level that you specify. If you have set relative //percentage values in the above function, then the uiPercentage will be reflected based off of the relative -//percentages. +//percentages. void RenderProgressBar( UINT8 ubID, UINT32 uiPercentage ) { static UINT32 uiLastTime = 0; @@ -285,25 +285,25 @@ void RenderProgressBar( UINT8 ubID, UINT32 uiPercentage ) } if( gfUseLoadScreenProgressBar ) { - ColorFillVideoSurfaceArea( FRAME_BUFFER, - pCurr->usBarLeft, pCurr->usBarTop, end, pCurr->usBarBottom, + ColorFillVideoSurfaceArea( FRAME_BUFFER, + pCurr->usBarLeft, pCurr->usBarTop, end, pCurr->usBarBottom, Get16BPPColor(FROMRGB( pCurr->ubColorFillRed, pCurr->ubColorFillGreen, pCurr->ubColorFillBlue )) ); //if( pCurr->usBarRight > gusLeftmostShaded ) //{ - // ShadowVideoSurfaceRect( FRAME_BUFFER, gusLeftmostShaded+1, pCurr->usBarTop, end, pCurr->usBarBottom ); + // ShadowVideoSurfaceRect( FRAME_BUFFER, gusLeftmostShaded+1, pCurr->usBarTop, end, pCurr->usBarBottom ); // gusLeftmostShaded = (UINT16)end; //} } else { //Border edge of the progress bar itself in gray - ColorFillVideoSurfaceArea( FRAME_BUFFER, - pCurr->usBarLeft, pCurr->usBarTop, pCurr->usBarRight, pCurr->usBarBottom, + ColorFillVideoSurfaceArea( FRAME_BUFFER, + pCurr->usBarLeft, pCurr->usBarTop, pCurr->usBarRight, pCurr->usBarBottom, Get16BPPColor(FROMRGB(160, 160, 160)) ); //Interior of progress bar in black - ColorFillVideoSurfaceArea( FRAME_BUFFER, - pCurr->usBarLeft+2, pCurr->usBarTop+2, pCurr->usBarRight-2, pCurr->usBarBottom-2, - Get16BPPColor(FROMRGB( 0, 0, 0)) ); + ColorFillVideoSurfaceArea( FRAME_BUFFER, + pCurr->usBarLeft+2, pCurr->usBarTop+2, pCurr->usBarRight-2, pCurr->usBarBottom-2, + Get16BPPColor(FROMRGB( 0, 0, 0)) ); ColorFillVideoSurfaceArea(FRAME_BUFFER, pCurr->usBarLeft+2, pCurr->usBarTop+2, end, pCurr->usBarBottom-2, Get16BPPColor(FROMRGB(72 , 155, 24))); } InvalidateRegion( pCurr->usBarLeft, pCurr->usBarTop, pCurr->usBarRight, pCurr->usBarBottom ); @@ -359,4 +359,4 @@ void SetProgressBarTextDisplayFlag( UINT8 ubID, BOOLEAN fDisplayText, BOOLEAN fU //blit everything to the save buffer ( cause the save buffer can bleed through ) BlitBufferToBuffer(guiRENDERBUFFER, guiSAVEBUFFER, pCurr->usBarLeft, pCurr->usBarBottom, (UINT16)(pCurr->usBarRight-pCurr->usBarLeft), usFontHeight ); } -} \ No newline at end of file +} diff --git a/Utils/Animated ProgressBar.h b/Utils/Animated ProgressBar.h index 08fcc24b..aea495de 100644 --- a/Utils/Animated ProgressBar.h +++ b/Utils/Animated ProgressBar.h @@ -37,10 +37,10 @@ void RemoveLoadingScreenProgressBar(); //A panel is automatically created if you specify a title using SetProgressBarTitle BOOLEAN CreateProgressBar( UINT8 ubProgressBarID, UINT16 usLeft, UINT16 usTop, UINT16 usRight, UINT16 usBottom ); -//You may also define a panel to go in behind the progress bar. You can now assign a title to go with +//You may also define a panel to go in behind the progress bar. You can now assign a title to go with //the panel. void DefineProgressBarPanel( UINT32 ubID, UINT8 r, UINT8 g, UINT8 b, - UINT16 usLeft, UINT16 usTop, UINT16 usRight, UINT16 usBottom ); + UINT16 usLeft, UINT16 usTop, UINT16 usRight, UINT16 usBottom ); //Assigning a title for the panel will automatically position the text horizontally centered on the //panel and vertically centered from the top of the panel, to the top of the progress bar. @@ -54,18 +54,18 @@ void SetProgressBarMsgAttributes( UINT32 ubID, UINT32 usFont, UINT8 ubForeColor, //When finished, the progress bar needs to be removed. void RemoveProgressBar( UINT8 ubID ); -//An important setup function. The best explanation is through example. The example being the loading -//of a file -- there are many stages of the map loading. In JA2, the first step is to load the tileset. +//An important setup function. The best explanation is through example. The example being the loading +//of a file -- there are many stages of the map loading. In JA2, the first step is to load the tileset. //Because it is a large chunk of the total loading of the map, we may gauge that it takes up 30% of the -//total load. Because it is also at the beginning, we would pass in the arguments ( 0, 30, "text" ). +//total load. Because it is also at the beginning, we would pass in the arguments ( 0, 30, "text" ). //As the process animates using UpdateProgressBar( 0 to 100 ), the total progress bar will only reach 30% -//at the 100% mark within UpdateProgressBar. At that time, you would go onto the next step, resetting the +//at the 100% mark within UpdateProgressBar. At that time, you would go onto the next step, resetting the //relative start and end percentage from 30 to whatever, until your done. void SetRelativeStartAndEndPercentage( UINT8 ubID, UINT32 uiRelStartPerc, UINT32 uiRelEndPerc, STR16 str); -//This part renders the progress bar at the percentage level that you specify. If you have set relative +//This part renders the progress bar at the percentage level that you specify. If you have set relative //percentage values in the above function, then the uiPercentage will be reflected based off of the relative -//percentages. +//percentages. void RenderProgressBar( UINT8 ubID, UINT32 uiPercentage ); diff --git a/Utils/Cinematics.cpp b/Utils/Cinematics.cpp index 73dd89c6..6fcac4ce 100644 --- a/Utils/Cinematics.cpp +++ b/Utils/Cinematics.cpp @@ -5,9 +5,9 @@ // Stolen from Nemesis by Derek Beland. // Originally by Derek Beland and Bret Rowden. // -// ChangeLog: -// 10.12.2005 Lesh ripped everything that refers to MSS -// 15.12.2005 Lesh enabled sound in video +// ChangeLog: +// 10.12.2005 Lesh ripped everything that refers to MSS +// 15.12.2005 Lesh enabled sound in video //---------------------------------------------------------------------------------- //#include "LocalCodeAll.h" @@ -60,7 +60,7 @@ #define SMK_FLIC_AUTOCLOSE 0x00000008 // Close when done //-Globals------------------------------------------------------------------------- -SMKFLIC SmkList[SMK_NUM_FLICS]; +SMKFLIC SmkList[SMK_NUM_FLICS]; HWND hDisplayWindow=0; UINT32 uiDisplayHeight, uiDisplayWidth; @@ -95,13 +95,13 @@ DDSURFACEDESC SurfaceDescription; { if(SmkList[uiCount].uiFlags & SMK_FLIC_PLAYING) { - fFlicStatus=TRUE; + fFlicStatus=TRUE; if(!fSuspendFlics) { if(!SmackWait(SmkList[uiCount].SmackHandle)) { DDLockSurface(SmkList[uiCount].lpDDS, NULL, &SurfaceDescription, 0, NULL); - SmackToBuffer(SmkList[uiCount].SmackHandle,SmkList[uiCount].uiLeft, + SmackToBuffer(SmkList[uiCount].SmackHandle,SmkList[uiCount].uiLeft, SmkList[uiCount].uiTop, SurfaceDescription.lPitch, SmkList[uiCount].SmackHandle->Height, @@ -129,7 +129,7 @@ DDSURFACEDESC SurfaceDescription; } if(!fFlicStatus) SmkShutdownVideo(); - + return(fFlicStatus); } @@ -242,7 +242,7 @@ void SmkSetBlitPosition(SMKFLIC *pSmack, UINT32 uiLeft, UINT32 uiTop) pSmack->uiLeft=uiLeft; pSmack->uiTop=uiTop; } - + void SmkCloseFlic(SMKFLIC *pSmack) { // Attempt opening the filename @@ -282,18 +282,18 @@ void SmkSetupVideo(void) GetVideoSurface( &hVSurface, FRAME_BUFFER ); lpVideoPlayback2 = GetVideoSurfaceDDSurface( hVSurface ); - ZEROMEM(SurfaceDescription); - SurfaceDescription.dwSize = sizeof (DDSURFACEDESC); - ReturnCode = IDirectDrawSurface2_GetSurfaceDesc ( lpVideoPlayback2, &SurfaceDescription ); - if (ReturnCode != DD_OK) - { - DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); - return; - } - - usRed = (UINT16) SurfaceDescription.ddpfPixelFormat.dwRBitMask; + ZEROMEM(SurfaceDescription); + SurfaceDescription.dwSize = sizeof (DDSURFACEDESC); + ReturnCode = IDirectDrawSurface2_GetSurfaceDesc ( lpVideoPlayback2, &SurfaceDescription ); + if (ReturnCode != DD_OK) + { + DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); + return; + } + + usRed = (UINT16) SurfaceDescription.ddpfPixelFormat.dwRBitMask; usGreen = (UINT16) SurfaceDescription.ddpfPixelFormat.dwGBitMask; - usBlue = (UINT16) SurfaceDescription.ddpfPixelFormat.dwBBitMask; + usBlue = (UINT16) SurfaceDescription.ddpfPixelFormat.dwBBitMask; if((usRed==0xf800) && (usGreen==0x07e0) && (usBlue==0x001f)) guiSmackPixelFormat=SMACKBUFFER565; diff --git a/Utils/Cursors.cpp b/Utils/Cursors.cpp index 5da240eb..f8c67a9a 100644 --- a/Utils/Cursors.cpp +++ b/Utils/Cursors.cpp @@ -19,7 +19,7 @@ #endif //aim -extern UINT8 gubShowActionPointsInRed; +extern UINT8 gubShowActionPointsInRed; UINT8 gpShadesFromWhiteToRed[] = {FONT_MCOLOR_WHITE, FONT_MCOLOR_DKWHITE, FONT_MCOLOR_DKGRAY, FONT_MCOLOR_DKRED, FONT_MCOLOR_RED }; //aim @@ -43,79 +43,79 @@ void DrawMouseText( ); CursorFileData CursorFileDatabase[] = { - { "CURSORS\\cursor.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\cur_targ.sti" , FALSE, 0, ANIMATED_CURSOR, 7, NULL }, - { "CURSORS\\cur_tagr.sti" , FALSE, 0, ANIMATED_CURSOR, 7, NULL }, - { "CURSORS\\targblak.sti" , FALSE, 0, ANIMATED_CURSOR, 7, NULL }, - { "CURSORS\\cur_bst.sti" , FALSE, 0, ANIMATED_CURSOR, 7, NULL }, - { "CURSORS\\cur_rbst.sti" , FALSE, 0, ANIMATED_CURSOR, 7, NULL }, - { "CURSORS\\burstblk.sti" , FALSE, 0, ANIMATED_CURSOR, 7, NULL }, - { "CURSORS\\cur_tr.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\cur_trw.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\cur_tb.sti" , FALSE, 0, ANIMATED_CURSOR, 7, NULL }, + { "CURSORS\\cursor.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\cur_targ.sti" , FALSE, 0, ANIMATED_CURSOR, 7, NULL }, + { "CURSORS\\cur_tagr.sti" , FALSE, 0, ANIMATED_CURSOR, 7, NULL }, + { "CURSORS\\targblak.sti" , FALSE, 0, ANIMATED_CURSOR, 7, NULL }, + { "CURSORS\\cur_bst.sti" , FALSE, 0, ANIMATED_CURSOR, 7, NULL }, + { "CURSORS\\cur_rbst.sti" , FALSE, 0, ANIMATED_CURSOR, 7, NULL }, + { "CURSORS\\burstblk.sti" , FALSE, 0, ANIMATED_CURSOR, 7, NULL }, + { "CURSORS\\cur_tr.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\cur_trw.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\cur_tb.sti" , FALSE, 0, ANIMATED_CURSOR, 7, NULL }, - { "CURSORS\\punch.sti" , FALSE, 0, ANIMATED_CURSOR, 6, NULL }, - { "CURSORS\\punchr.sti" , FALSE, 0, ANIMATED_CURSOR, 6, NULL }, - { "CURSORS\\cur_run.sti" , FALSE, 0, ANIMATED_CURSOR, 10, NULL }, - { "CURSORS\\cur_walk.sti" , FALSE, 0, ANIMATED_CURSOR, 10, NULL }, - { "CURSORS\\cur_swat.sti" , FALSE, 0, ANIMATED_CURSOR, 10, NULL }, - { "CURSORS\\cur_pron.sti" , FALSE, 0, ANIMATED_CURSOR, 10, NULL }, - { "CURSORS\\grabsr.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\grabs.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\stab.sti" , FALSE, 0, ANIMATED_CURSOR, 6, NULL }, - { "CURSORS\\stabr.sti" , FALSE, 0, ANIMATED_CURSOR, 6, NULL }, + { "CURSORS\\punch.sti" , FALSE, 0, ANIMATED_CURSOR, 6, NULL }, + { "CURSORS\\punchr.sti" , FALSE, 0, ANIMATED_CURSOR, 6, NULL }, + { "CURSORS\\cur_run.sti" , FALSE, 0, ANIMATED_CURSOR, 10, NULL }, + { "CURSORS\\cur_walk.sti" , FALSE, 0, ANIMATED_CURSOR, 10, NULL }, + { "CURSORS\\cur_swat.sti" , FALSE, 0, ANIMATED_CURSOR, 10, NULL }, + { "CURSORS\\cur_pron.sti" , FALSE, 0, ANIMATED_CURSOR, 10, NULL }, + { "CURSORS\\grabsr.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\grabs.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\stab.sti" , FALSE, 0, ANIMATED_CURSOR, 6, NULL }, + { "CURSORS\\stabr.sti" , FALSE, 0, ANIMATED_CURSOR, 6, NULL }, - { "CURSORS\\cross1.sti" , FALSE, 0, ANIMATED_CURSOR, 6, NULL }, - { "CURSORS\\cross2.sti" , FALSE, 0, ANIMATED_CURSOR, 6, NULL }, - { "LAPTOP\\FingerCursor.sti" , FALSE, 0, 0, 0, NULL }, - { "LAPTOP\\LapTopCursor.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\ibeam.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\cur_look.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\cur_talk.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\cur_talkb.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\cur_talkr.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\cur_exit.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\cross1.sti" , FALSE, 0, ANIMATED_CURSOR, 6, NULL }, + { "CURSORS\\cross2.sti" , FALSE, 0, ANIMATED_CURSOR, 6, NULL }, + { "LAPTOP\\FingerCursor.sti" , FALSE, 0, 0, 0, NULL }, + { "LAPTOP\\LapTopCursor.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\ibeam.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\cur_look.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\cur_talk.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\cur_talkb.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\cur_talkr.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\cur_exit.sti" , FALSE, 0, 0, 0, NULL }, + + { "CURSORS\\VehicleCursor.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\WalkingCursor.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\que.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\chopper.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\check.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\cur_try.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\wirecut.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\wirecutr.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\bullet_g.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\bullet_d.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\ibeamWhite.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\throwg.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\throwb.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\throwr.sti" , FALSE, 0, 0, 0, NULL }, + { "" , FALSE, 0, USE_EXTERN_VO_CURSOR | USE_OUTLINE_BLITTER, 0, NULL }, + { "CURSORS\\bombg.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\bombr.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\remoteg.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\remoter.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\steering.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\cur_car.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\cur_wait.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\VehicleCursor.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\WalkingCursor.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\que.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\chopper.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\check.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\cur_try.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\wirecut.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\wirecutr.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\bullet_g.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\bullet_d.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\ibeamWhite.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\throwg.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\throwb.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\throwr.sti" , FALSE, 0, 0, 0, NULL }, - { "" , FALSE, 0, USE_EXTERN_VO_CURSOR | USE_OUTLINE_BLITTER, 0, NULL }, - { "CURSORS\\bombg.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\bombr.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\remoteg.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\remoter.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\steering.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\cur_car.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\cur_wait.sti" , FALSE, 0, 0, 0, NULL }, - //Tactical GUI cursors - { "CURSORS\\singlecursor.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\groupcursor.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\singledcursor.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\groupdcursor.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\repair.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\repairr.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\jar_cur.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\jar_cur_red.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\cur_x.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\can_01.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\can_02.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\cur_swit.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\bullseye.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\deadleap.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\can_01.sti" , FALSE, 0, 0, 0, NULL }, - { "CURSORS\\can_02.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\singlecursor.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\groupcursor.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\singledcursor.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\groupdcursor.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\repair.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\repairr.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\jar_cur.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\jar_cur_red.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\cur_x.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\can_01.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\can_02.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\cur_swit.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\bullseye.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\deadleap.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\can_01.sti" , FALSE, 0, 0, 0, NULL }, + { "CURSORS\\can_02.sti" , FALSE, 0, 0, 0, NULL }, }; @@ -126,378 +126,378 @@ void RaiseMouseToLevel( INT8 bLevel ) CursorData CursorDatabase[] = { - { C_MISC, 0, 0, 0, 0, + { C_MISC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0 , 0, 0 }, - - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - //{ C_TRINGS, 6, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + 1, 0, 0, 0, 0 , 0, 0 }, + + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + //{ C_TRINGS, 6, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_ACTIONMODE, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, // TARGET ( NORMAL W/ RINGS ) - { + { C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { - C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 5, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - - { - C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - - - { - C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 3, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - - { - C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - - { + { C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 3, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TRINGS, 5, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { + { C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 7, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { + + { C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 8, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TRINGS, 6, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 0, 0, 0, 0, 0, + 3, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { + { C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 4, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + + { + C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 3, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + 0, 0, 0, 0, 0, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + + { + C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 7, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + 0, 0, 0, 0, 0, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + + { + C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 8, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + 0, 0, 0, 0, 0, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + + { + C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 4, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + 0, 0, 0, 0, 0, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, // TARGET WITH WHITE RINGS - { + { C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TWRINGS, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TWRINGS, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { + { C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TWRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TWRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { + { C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TWRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TWRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { + { C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_TWRINGS, 3, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TWRINGS, 3, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { + { C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_TWRINGS, 4, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TWRINGS, 4, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, // TARGET RED CURSOR - { C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + { C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, // TARGET BLACK CURSOR - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, C_BLACKTARGET, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, // TARGET DARK BLACK CURSOR - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, // TARGET RED CURSOR - { + { C_TARGMODEBURSTRED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_TARGMODEBURSTBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 3, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - 5, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + C_TRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 3, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + 5, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { C_TARGMODEBURST, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + { C_TARGMODEBURST, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_TARGMODEBURSTRED, 0, 0, 0, 0, + { C_TARGMODEBURSTRED, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 1, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_TARGMODEBURSTBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + { C_TARGMODEBURSTBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_PUNCHGRAY, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_PUNCHGRAY, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_PUNCHRED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_PUNCHRED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_PUNCHRED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_PUNCHRED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_PUNCHRED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_PUNCHRED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_PUNCHRED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_YELLOWRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_PUNCHRED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_YELLOWRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_PUNCHRED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_YELLOWRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_PUNCHRED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_YELLOWRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, { - C_PUNCHRED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TWRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_PUNCHRED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TWRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { - C_PUNCHRED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TWRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { + C_PUNCHRED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TWRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_RUN1, 0, 0, CENTER_SUBCURSOR, 0, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_RUN1, 0, 0, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, 20 , 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, 20 , 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_WALK1, 0, 0, CENTER_SUBCURSOR, 0, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_WALK1, 0, 0, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, CENTER_CURSOR, 20 , 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_SWAT1, 0, 0, CENTER_SUBCURSOR, 0, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_SWAT1, 0, 0, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, 10 , 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, 10 , 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_PRONE1, 0, 0, CENTER_SUBCURSOR, 0, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_PRONE1, 0, 0, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, CENTER_CURSOR, 10 , 0, 0 , 0, 0 }, - { C_TRINGS, 0, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_GRAB1, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 0, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_GRAB1, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_TRINGS, 0, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_GRAB2, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 0, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_GRAB2, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_KNIFE1, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_KNIFE1, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_KNIFE2, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_KNIFE2, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_KNIFE2, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_KNIFE2, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_KNIFE2, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_KNIFE2, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_KNIFE2, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_YELLOWRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_KNIFE2, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_YELLOWRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_KNIFE2, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_YELLOWRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_KNIFE2, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_YELLOWRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_KNIFE2, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TWRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_KNIFE2, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TWRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_KNIFE2, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TWRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_KNIFE2, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TWRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_CROSS1, 0, 0, 0, 0, + { C_CROSS1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, + 1, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_CROSS2, 0, 0, 0, 0, + { C_CROSS2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_WWW, 0, 0, 0, 0, + 1, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, + { C_WWW, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0 , 0, 0 }, - { C_LAPTOPSCREEN, 0, 0, 0, 0, + 1, 0, 0, 0, 0 , 0, 0 }, + { C_LAPTOPSCREEN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0 , 0, 0 }, + 1, 0, 0, 0, 0 , 0, 0 }, { C_IBEAM, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -505,28 +505,28 @@ CursorData CursorDatabase[] = 0, 0, 0, 0, 0, 1, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_LOOK, 0, 0, 0, 0, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_LOOK, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, C_TALK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, C_BLACKTALK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, C_REDTALK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -534,246 +534,246 @@ CursorData CursorDatabase[] = 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, // Exit arrows - { C_EXITARROWS , 0, 0, 0, 0, + { C_EXITARROWS , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, CENTER_CURSOR, TOP_CURSOR, 0, 0 , 0, 0 }, + 1, CENTER_CURSOR, TOP_CURSOR, 0, 0 , 0, 0 }, - { C_EXITARROWS , 1, 0, 0, 0, + { C_EXITARROWS , 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, CENTER_CURSOR, BOTTOM_CURSOR, 0, 0 , 0, 0 }, + 1, CENTER_CURSOR, BOTTOM_CURSOR, 0, 0 , 0, 0 }, - { C_EXITARROWS , 2, 0, 0, 0, + { C_EXITARROWS , 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, RIGHT_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 1, RIGHT_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_EXITARROWS , 3, 0, 0, 0, + { C_EXITARROWS , 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, LEFT_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 1, LEFT_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_EXITARROWS , 4, 0, 0, 0, + { C_EXITARROWS , 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, CENTER_CURSOR, TOP_CURSOR, 0, 0 , 0, 0 }, + 1, CENTER_CURSOR, TOP_CURSOR, 0, 0 , 0, 0 }, - { C_EXITARROWS , 5, 0, 0, 0, + { C_EXITARROWS , 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, CENTER_CURSOR, BOTTOM_CURSOR, 0, 0 , 0, 0 }, + 1, CENTER_CURSOR, BOTTOM_CURSOR, 0, 0 , 0, 0 }, - { C_EXITARROWS , 6, 0, 0, 0, + { C_EXITARROWS , 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, RIGHT_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 1, RIGHT_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_EXITARROWS , 7, 0, 0, 0, + { C_EXITARROWS , 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, LEFT_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 1, LEFT_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_EXITARROWS , 8, 0, 0, 0, + { C_EXITARROWS , 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, CENTER_CURSOR, TOP_CURSOR, 0, 0 , 0, 0 }, + 1, CENTER_CURSOR, TOP_CURSOR, 0, 0 , 0, 0 }, - { C_EXITARROWS , 9, 0, 0, 0, + { C_EXITARROWS , 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, CENTER_CURSOR, BOTTOM_CURSOR, 0, 0 , 0, 0 }, + 1, CENTER_CURSOR, BOTTOM_CURSOR, 0, 0 , 0, 0 }, - { C_EXITARROWS , 10, 0, 0, 0, + { C_EXITARROWS , 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, RIGHT_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 1, RIGHT_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_EXITARROWS , 11, 0, 0, 0, + { C_EXITARROWS , 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, LEFT_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 1, LEFT_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_STRATVEH , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_STRATVEH , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_STRATFOOT , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_STRATFOOT , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_INVALIDACTION , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_INVALIDACTION , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_CHOPPER , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_CHOPPER , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { + { C_ACTIONMODE, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 3, CENTER_CURSOR, CENTER_CURSOR, 0, 0, CURSOR_TO_FLASH, 0 }, + 3, CENTER_CURSOR, CENTER_CURSOR, 0, 0, CURSOR_TO_FLASH, 0 }, - { C_TARGMODEBURST, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TARGMODEBURST, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_TARGMODEBURSTBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0, CURSOR_TO_FLASH, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0, CURSOR_TO_FLASH, 0 }, - { + { C_TALK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_BLACKTALK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, CENTER_CURSOR, CENTER_CURSOR, 0, 0, CURSOR_TO_FLASH, 0 }, - { + { C_REDTALK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_BLACKTALK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, CENTER_CURSOR, CENTER_CURSOR, 0, 0, CURSOR_TO_FLASH, 0 }, - { + { C_CHECKMARK, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, CENTER_CURSOR, CENTER_CURSOR, 0, 0, 0, 0 }, - { + { C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_YELLOWRINGS, 5, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_YELLOWRINGS, 5, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { + { C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_YELLOWRINGS, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_YELLOWRINGS, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { + { C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_YELLOWRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_YELLOWRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { + { C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_YELLOWRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_YELLOWRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { + { C_ACTIONMODERED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_YELLOWRINGS, 3, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_YELLOWRINGS, 3, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { C_EXITARROWS , 12, 0, 0, 0, + { C_EXITARROWS , 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 1, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_EXITARROWS , 13, 0, 0, 0, + { C_EXITARROWS , 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 1, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_EXITARROWS , 14, 0, 0, 0, + { C_EXITARROWS , 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 1, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_WIRECUTR , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_WIRECUTR , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_WIRECUT , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_WIRECUT , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { + { C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_RELOAD , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_RELOAD , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 3, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_FLASH, 0 }, + 3, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_FLASH, 0 }, - { + { C_ACTIONMODEBLACK, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_RELOADR , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_RELOADR , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 3, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_FLASH, 0 }, + 3, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_FLASH, 0 }, { C_IBEAM_WHITE, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -782,281 +782,281 @@ CursorData CursorDatabase[] = 0, 0, 0, 0, 0, 1, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { + { C_THROWG, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { + { C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { + { C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { + { C_THROWG, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 3, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_FLASH, 0 }, + 3, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_FLASH, 0 }, // THROW CURSORS W/ RINGS - { + { C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { - C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 5, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - - { - C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - - - { - C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 3, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - - { - C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - - { + { C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 3, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TRINGS, 5, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { + { C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 7, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { + + { C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 8, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TRINGS, 6, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 0, 0, 0, 0, 0, + 3, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { + { C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 4, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + + { + C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 3, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + 0, 0, 0, 0, 0, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + + { + C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 7, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + 0, 0, 0, 0, 0, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + + { + C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 8, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + 0, 0, 0, 0, 0, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + + { + C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 4, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + 0, 0, 0, 0, 0, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, // TARGET WITH WHITE RINGS - { + { C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TWRINGS, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TWRINGS, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { + { C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TWRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TWRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { + { C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TWRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TWRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { + { C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_TWRINGS, 3, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TWRINGS, 3, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { + { C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_TWRINGS, 4, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TWRINGS, 4, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, // YELLOW RINGS - { + { C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_YELLOWRINGS, 5, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_YELLOWRINGS, 5, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { + { C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_YELLOWRINGS, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_YELLOWRINGS, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { + { C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_YELLOWRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_YELLOWRINGS, 1, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { + { C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_YELLOWRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_YELLOWRINGS, 2, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, - { + { C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_YELLOWRINGS, 3, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_YELLOWRINGS, 3, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_SUB_CONDITIONALLY, 0 }, // ITEM THROW ONES... - { + { C_ITEMTHROW, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_THROWG, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 0, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TRINGS, 0, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 3, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 3, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { + { C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { + { C_ITEMTHROW, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_THROWR, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 3, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 3, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { + { C_ITEMTHROW, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_THROWG, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, C_THROWB, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, - 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_FLASH2, 0 }, + 4, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_FLASH2, 0 }, - { + { C_ITEMTHROW, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_FLASH2, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , CURSOR_TO_FLASH2, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_BOMB_GREY, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_BOMB_GREY, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_BOMB_RED , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_BOMB_RED , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_REMOTE_GREY, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_REMOTE_GREY, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_REMOTE_RED , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_REMOTE_RED , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, C_ENTERV, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_MOVEV, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_MOVEV, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_WAIT, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_WAIT, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1088,66 +1088,66 @@ CursorData CursorDatabase[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, CENTER_CURSOR, BOTTOM_CURSOR, 0, 0, 0, 0 }, - - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_REPAIR , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_REPAIRR , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_REPAIR , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_JAR , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_REPAIRR , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_JARRED , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_JAR , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_CAN , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_JARRED , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_CANRED , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_CAN , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { - C_X, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_CANRED , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 1, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_WAIT, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { + C_X, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, + + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_WAIT, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_EXCHANGE, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_EXCHANGE, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1160,26 +1160,26 @@ CursorData CursorDatabase[] = 0, 0, 0, 0, 0, 1, CENTER_CURSOR, CENTER_CURSOR, 0, 0, 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_JUMPOVER, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_JUMPOVER, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, CENTER_CURSOR, CENTER_CURSOR , 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_FUEL , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_FUEL , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, - { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, - C_FUEL_RED , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, + { C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR, + C_FUEL_RED , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, + 2, CENTER_CURSOR, CENTER_CURSOR, 0, 0 , 0, 0 }, }; @@ -1203,21 +1203,21 @@ void HandleAnimatedCursors( ) if ( gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA ) { UpdateAnimatedCursorFrames( gViewportRegion.Cursor ); - SetCurrentCursorFromDatabase( gViewportRegion.Cursor ); + SetCurrentCursorFromDatabase( gViewportRegion.Cursor ); } if ( gDisableRegion.uiFlags & MSYS_MOUSE_IN_AREA ) { UpdateAnimatedCursorFrames( gDisableRegion.Cursor ); - SetCurrentCursorFromDatabase( gDisableRegion.Cursor ); + SetCurrentCursorFromDatabase( gDisableRegion.Cursor ); } if ( gUserTurnRegion.uiFlags & MSYS_MOUSE_IN_AREA ) { UpdateAnimatedCursorFrames( gUserTurnRegion.Cursor ); - SetCurrentCursorFromDatabase( gUserTurnRegion.Cursor ); + SetCurrentCursorFromDatabase( gUserTurnRegion.Cursor ); } } @@ -1229,7 +1229,7 @@ void HandleAnimatedCursors( ) if ( gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA ) { UpdateFlashingCursorFrames( gViewportRegion.Cursor ); - SetCurrentCursorFromDatabase( gViewportRegion.Cursor ); + SetCurrentCursorFromDatabase( gViewportRegion.Cursor ); } } @@ -1237,10 +1237,10 @@ void HandleAnimatedCursors( ) } -/*extern INT16 gsCurMouseOffsetX; -extern INT16 gsCurMouseOffsetY; -extern UINT16 gsCurMouseHeight; -extern UINT16 gsCurMouseWidth;*/ +/*extern INT16 gsCurMouseOffsetX; +extern INT16 gsCurMouseOffsetY; +extern UINT16 gsCurMouseHeight; +extern UINT16 gsCurMouseWidth;*/ void DrawMouseGraphics( ) { @@ -1265,7 +1265,7 @@ void DrawMouseGraphics( ) for(cnt = gsCurMouseOffsetX+barLength/2;cnt > gsCurMouseOffsetX-barLength/2+1;cnt--) { ptrBuf[cnt-1 + uiPitch*(3+barY)] = usCBorderBottom; - ptrBuf[cnt-1 + uiPitch*barY] = usCBorderTop; + ptrBuf[cnt-1 + uiPitch*barY] = usCBorderTop; } ptrBuf[gsCurMouseOffsetX+barLength/2 + uiPitch*(1+barY)] = usCBorderBottom; @@ -1295,7 +1295,7 @@ void DrawMouseGraphics( ) void BltJA2CursorData( ) { - if ( ( gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA ) ) + if ( ( gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA ) ) { DrawMouseText(); DrawMouseGraphics(); @@ -1340,7 +1340,7 @@ void DrawMouseText( ) SetFontBackground( FONT_MCOLOR_BLACK ); if(gTintBulletCounts) - SetFontForeground( FONT_ORANGE ); + SetFontForeground( FONT_ORANGE ); else SetFontForeground( FONT_MCOLOR_LTYELLOW ); @@ -1403,7 +1403,7 @@ void DrawMouseText( ) { RESETCOUNTER( INVALID_AP_HOLD ); RESETCOUNTER( CURSORFLASH ); - + fShow = !fShow; fHoldInvalid = !fHoldInvalid; } @@ -1415,7 +1415,7 @@ void DrawMouseText( ) { RESETCOUNTER( CURSORFLASH ); RESETCOUNTER( INVALID_AP_HOLD ); - + fShow = !fShow; fHoldInvalid = !fHoldInvalid; } @@ -1449,14 +1449,14 @@ void DrawMouseText( ) { SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( 141 ); - //SetFontShadow( NO_SHADOW ); - SetFontShadow( DEFAULT_SHADOW ); + //SetFontShadow( NO_SHADOW ); + SetFontShadow( DEFAULT_SHADOW ); } else { SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( FONT_MCOLOR_WHITE ); - SetFontShadow( DEFAULT_SHADOW ); + SetFontShadow( DEFAULT_SHADOW ); //aim if ( gubShowActionPointsInRed ) @@ -1485,7 +1485,7 @@ void DrawMouseText( ) else //aim SetFontForeground( FONT_MCOLOR_WHITE ); - SetFontShadow( DEFAULT_SHADOW ); + SetFontShadow( DEFAULT_SHADOW ); } mprintf( sX, sY, L"%d", gsCurrentActionPoints ); @@ -1515,9 +1515,9 @@ void DrawMouseText( ) SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( FONT_MCOLOR_WHITE ); - SetFontShadow( DEFAULT_SHADOW ); + SetFontShadow( DEFAULT_SHADOW ); - if ( !( gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA ) ) + if ( !( gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA ) ) { mprintf( sX + 10, sY - 10, L"x%d", gpItemPointer->ubNumberOfObjects ); } @@ -1541,7 +1541,7 @@ void UpdateAnimatedCursorFrames( UINT32 uiCursorIndex ) for ( cnt = 0; cnt < pCurData->usNumComposites; cnt++ ) { - + pCurImage = &( pCurData->Composites[ cnt ] ); if ( CursorFileDatabase[ pCurImage->uiFileIndex ].ubFlags & ANIMATED_CURSOR ) @@ -1552,7 +1552,7 @@ void UpdateAnimatedCursorFrames( UINT32 uiCursorIndex ) { pCurImage->uiCurrentFrame = 0; } - + } } } @@ -1571,14 +1571,14 @@ void UpdateFlashingCursorFrames( UINT32 uiCursorIndex ) { pCurData->bFlashIndex = !pCurData->bFlashIndex; - // Should we play a sound? - if ( pCurData->bFlags & ( CURSOR_TO_PLAY_SOUND ) ) - { - if ( pCurData->bFlashIndex ) - { - PlayJA2Sample( TARGET_OUT_OF_RANGE, RATE_11025, MIDVOLUME, 1, MIDDLEPAN ); - } - } + // Should we play a sound? + if ( pCurData->bFlags & ( CURSOR_TO_PLAY_SOUND ) ) + { + if ( pCurData->bFlashIndex ) + { + PlayJA2Sample( TARGET_OUT_OF_RANGE, RATE_11025, MIDVOLUME, 1, MIDDLEPAN ); + } + } } } @@ -1653,4 +1653,4 @@ void SyncPairedCursorFrames( UINT32 uiSrcIndex, UINT32 uiDestIndex ) } } #endif -} \ No newline at end of file +} diff --git a/Utils/Cursors.h b/Utils/Cursors.h index da3a2aea..5c1e8e37 100644 --- a/Utils/Cursors.h +++ b/Utils/Cursors.h @@ -52,7 +52,7 @@ typedef enum CURSOR_KNIFE_NOGO_ON2, CURSOR_CROSS_REG, CURSOR_CROSS_ACTIVE, - CURSOR_WWW, + CURSOR_WWW, CURSOR_LAPTOP_SCREEN, CURSOR_IBEAM, CURSOR_LOOK, @@ -152,8 +152,8 @@ typedef enum CURSOR_STRATEGIC_BULLSEYE, CURSOR_JUMP_OVER, - CURSOR_FUEL, - CURSOR_FUEL_RED, + CURSOR_FUEL, + CURSOR_FUEL_RED, } CursorTypeDefines; @@ -181,7 +181,7 @@ typedef enum C_KNIFE2, C_CROSS1, C_CROSS2, - C_WWW, + C_WWW, C_LAPTOPSCREEN, C_IBEAM, C_LOOK, diff --git a/Utils/Debug Control.cpp b/Utils/Debug Control.cpp index 8354d142..21a5eac1 100644 --- a/Utils/Debug Control.cpp +++ b/Utils/Debug Control.cpp @@ -12,11 +12,11 @@ void AnimDbgMessage( CHAR8 *strMessage) { - FILE *OutFile; + FILE *OutFile; if ((OutFile = fopen("AnimDebug.txt", "a+t")) != NULL) { - fprintf(OutFile, "%s\n", strMessage); + fprintf(OutFile, "%s\n", strMessage); fclose(OutFile); } } @@ -28,11 +28,11 @@ void AnimDbgMessage( CHAR8 *strMessage) void PhysicsDbgMessage( CHAR8 *strMessage) { - FILE *OutFile; + FILE *OutFile; if ((OutFile = fopen("PhysicsDebug.txt", "a+t")) != NULL) { - fprintf(OutFile, "%s\n", strMessage); + fprintf(OutFile, "%s\n", strMessage); fclose(OutFile); } } @@ -45,11 +45,11 @@ void PhysicsDbgMessage( CHAR8 *strMessage) void AiDbgMessage( CHAR8 *strMessage) { - FILE *OutFile; + FILE *OutFile; if ((OutFile = fopen("AiDebug.txt", "a+t")) != NULL) { - fprintf(OutFile, "%s\n", strMessage); + fprintf(OutFile, "%s\n", strMessage); fclose(OutFile); } } @@ -59,11 +59,11 @@ void AiDbgMessage( CHAR8 *strMessage) void LiveMessage( CHAR8 *strMessage) { - FILE *OutFile; + FILE *OutFile; if ((OutFile = fopen("Log.txt", "a+t")) != NULL) { - fprintf(OutFile, "%s\n", strMessage); + fprintf(OutFile, "%s\n", strMessage); fclose(OutFile); } } diff --git a/Utils/Debug Control.h b/Utils/Debug Control.h index a8f26d56..257caaa7 100644 --- a/Utils/Debug Control.h +++ b/Utils/Debug Control.h @@ -8,7 +8,7 @@ //#define _AISUBSYSTEM_DEBUG #ifdef JA2BETAVERSION -// #define _ANIMSUBSYSTEM_DEBUG +// #define _ANIMSUBSYSTEM_DEBUG #endif diff --git a/Utils/Event Manager.cpp b/Utils/Event Manager.cpp index 109f91c6..320a8c35 100644 --- a/Utils/Event Manager.cpp +++ b/Utils/Event Manager.cpp @@ -86,16 +86,16 @@ BOOLEAN AddEvent( UINT32 uiEvent, UINT16 usDelay, PTR pEventData, UINT32 uiDataS CHECKF( pEvent != NULL ); // Set values - pEvent->TimeStamp = GetJA2Clock( ); - pEvent->usDelay = usDelay; - pEvent->uiEvent = uiEvent; - pEvent->uiFlags = 0; + pEvent->TimeStamp = GetJA2Clock( ); + pEvent->usDelay = usDelay; + pEvent->uiEvent = uiEvent; + pEvent->uiFlags = 0; pEvent->uiDataSize = uiDataSize; - pEvent->pData = (BYTE*)pEvent; - pEvent->pData = pEvent->pData + uiEventSize; + pEvent->pData = (BYTE*)pEvent; + pEvent->pData = pEvent->pData + uiEventSize; memcpy( pEvent->pData, pEventData, uiDataSize ); - + // Add event to queue hQueue = GetQueue( ubQueueID ); hQueue = AddtoList( hQueue, &pEvent, ListSize( hQueue ) ); @@ -187,7 +187,7 @@ UINT32 EventQueueSize( UINT8 ubQueueID ) // Get Size uiQueueSize = ListSize( hQueue ); - + return( uiQueueSize ); } diff --git a/Utils/Event Pump.cpp b/Utils/Event Pump.cpp index e404caf2..f541f637 100644 --- a/Utils/Event Pump.cpp +++ b/Utils/Event Pump.cpp @@ -24,578 +24,578 @@ UINT8 gubEncryptionArray4[ BASE_NUMBER_OF_ROTATION_ARRAYS * 3 ][ NEW_ROTATION_ARRAY_SIZE ] = { - { - 177,131,58,218,175,130,210, - 59,25,190,170,189,227,245, - 104,118,7,168,136,178,184, - 4,27,64,199,101,160,24, - 83,177,178,232,185,40,122, - 109,38,253,160,14,133,106, - 190,206,58,102,244,229,124 - }, - - { - 201,183,24,153,17,111,47, - 19,116,248,160,215,143,180, - 195,122,74,29,158,193,73, - 159,193,93,140,172,31,38, - 129,181,96,183,56,29,172, - 191,252,183,91,214,254,247, - 135,66,76,87,1,112,214 - }, - - { - 28,138,132,173,9,230,220, - 57,32,166,202,153,246,49, - 119,246,212,1,50,230,19, - 135,20,173,235,182,61,143, - 76,162,155,224,182,54,123, - 29,223,119,200,175,10,66, - 87,171,204,12,1,44,68 - }, - - { - 142,1,145,102,227,81,84, - 108,1,120,168,9,14,135, - 165,118,141,183,47,235,212, - 109,85,167,185,255,89,18, - 12,36,41,24,181,66,107, - 96,5,160,235,87,33,173, - 140,207,20,70,135,44,102 - }, - - { - 85,38,191,199,157,183,122, - 186,2,236,106,181,53,100, - 69,189,22,137,117,230,153, - 150,211,184,157,220,165,234, - 113,19,238,122,120,233,181, - 130,182,140,76,219,162,90, - 66,242,19,125,8,215,162 - }, - - { - 167,227,240,92,158,80,82, - 18,222,92,51,44,252,34, - 112,74,12,237,158,156,179, - 48,154,47,61,204,24,36, - 62,228,29,23,43,176,239, - 144,117,131,97,219,129,138, - 243,31,33,108,211,255,196 - }, - - { - 83,29,187,49,130,95,252, - 214,6,223,87,149,168,140, - 172,33,170,24,103,180,107, - 63,212,92,143,155,126,129, - 190,25,211,244,151,103,7, - 51,227,119,104,18,177,110, - 33,155,104,15,159,62,103 - }, - - { - 9,151,31,80,46,220,174, - 147,4,3,76,83,157,9, - 39,52,79,252,16,63,25, - 215,131,90,79,128,143,128, - 117,57,224,68,198,98,158, - 191,90,222,94,135,106,238, - 212,168,164,233,138,106,14 - }, - - { - 159,70,200,99,183,101,85, - 117,251,218,149,119,199,12, - 102,190,144,68,145,212,202, - 250,32,118,13,149,136,91, - 203,247,68,69,124,122,248, - 92,125,154,189,60,160,12, - 148,182,162,108,187,198,113 - }, - - { - 75,226,151,153,186,223,56, - 174,53,4,212,8,241,147, - 253,166,123,148,241,166,172, - 118,103,6,219,178,187,41, - 89,250,28,220,20,27,134, - 77,125,14,40,175,125,114, - 15,2,160,240,169,186,63 - }, - - { - 165,251,182,208,45,34,74, - 41,106,244,193,205,160,100, - 51,41,232,106,237,201,184, - 35,112,98,118,238,38,211, - 191,33,221,226,126,55,61, - 224,82,255,19,252,131,188, - 220,111,242,172,93,61,67 - }, - - { - 246,142,205,184,114,219,1, - 246,63,229,6,41,167,187, - 173,185,75,205,96,37,252, - 142,135,8,82,240,138,254, - 107,202,42,104,198,71,98, - 173,197,100,156,37,180,190, - 88,30,229,135,12,58,198 - }, - - { - 7,121,166,123,114,32,78, - 223,125,21,155,124,116,240, - 222,91,57,5,254,51,4, - 161,122,236,49,146,88,235, - 253,149,42,31,140,254,163, - 71,253,70,242,115,10,171, - 101,38,217,187,117,31,141 - }, - - { - 220,220,58,61,163,182,106, - 201,38,91,53,99,7,253, - 179,12,108,175,148,246,162, - 217,7,36,146,193,22,3, - 220,68,101,117,184,62,195, - 25,94,226,155,28,43,110, - 161,132,70,110,201,58,228 - }, - - { - 39,253,170,4,47,122,100, - 182,223,98,128,205,167,103, - 42,16,227,30,43,181,80, - 212,194,100,164,123,181,97, - 126,145,213,51,44,135,240, - 100,105,151,106,174,180,134, - 106,49,72,73,237,2,84 - }, - - { - 1,140,181,150,80,96,57, - 214,115,209,143,122,31,162, - 201,171,155,38,225,68,12, - 219,180,253,105,97,208,19, - 20,8,84,223,139,223,146, - 150,53,161,187,167,163,61, - 45,242,115,110,195,89,15 - }, - - { - 50,197,196,115,105,176,64, - 87,141,157,64,185,202,118, - 158,70,79,168,121,141,57, - 163,128,141,228,192,195,115, - 15,227,176,28,130,126,54, - 75,200,45,202,7,158,179, - 77,23,142,127,110,31,141 - }, - - { - 123,175,80,224,82,146,27, - 61,247,16,236,96,150,244, - 102,13,165,47,253,185,96, - 178,149,204,82,2,235,182, - 47,249,110,211,181,241,87, - 93,208,215,155,65,168,65, - 152,71,236,50,249,80,249 - }, - - { - 139,219,5,39,213,136,215, - 228,108,228,169,234,173,243, - 229,45,65,105,121,208,18, - 202,118,209,11,19,178,162, - 59,74,82,99,111,28,119, - 6,217,203,9,252,227,146, - 217,194,195,213,12,221,229 - }, - - { - 49,9,169,202,201,231,152, - 102,226,150,26,173,50,161, - 241,73,224,232,42,44,182, - 48,85,6,112,192,109,58, - 164,25,233,113,68,229,93, - 83,32,42,74,152,119,240, - 95,234,245,83,222,203,49 - }, - - { - 58,104,2,6,164,206,186, - 224,222,73,218,87,103,158, - 186,30,242,149,198,193,89, - 94,43,38,197,36,33,64, - 7,136,243,253,80,61,90, - 223,72,116,47,46,190,94, - 50,77,217,111,227,35,30 - }, - - { - 161,5,6,26,113,239,46, - 35,195,65,36,225,119,8, - 31,27,206,249,207,129,119, - 218,138,239,90,154,78,217, - 247,85,161,87,123,185,175, - 152,74,2,181,30,66,9, - 30,147,91,147,86,146,232 - }, - - { - 111,204,65,49,124,16,12, - 149,51,137,89,252,190,203, - 155,194,84,231,136,213,197, - 202,212,73,251,17,80,12, - 106,75,180,1,15,52,1, - 36,27,194,180,13,226,151, - 210,106,27,190,237,194,16 - }, - - { - 63,38,43,226,100,106,44, - 100,72,214,138,170,142,137, - 51,246,203,190,250,5,139, - 146,105,90,117,73,83,168, - 127,89,106,238,176,54,135, - 79,97,13,229,87,119,110, - 253,184,151,32,70,14,191 - }, - - { - 3,134,209,61,87,248,16, - 140,69,243,241,249,240,83, - 184,156,4,81,67,134,241, - 25,176,185,228,181,65,200, - 143,165,255,165,222,193,94, - 146,188,178,68,171,218,177, - 198,3,208,189,1,204,100 - }, - - { - 22,66,132,87,17,19,147, - 142,42,56,105,247,102,68, - 124,234,205,209,46,130,54, - 254,10,162,22,63,87,26, - 148,32,114,179,139,23,239, - 128,191,233,238,76,251,218, - 169,126,70,24,167,70,244 - }, - - { - 156,153,114,200,16,71,190, - 214,189,154,249,102,57,40, - 212,144,211,72,187,194,106, - 32,131,241,173,161,83,169, - 128,245,153,168,115,72,94, - 90,15,107,218,206,232,88, - 162,109,52,236,54,42,212 - }, - - { - 242,93,89,143,226,33,252, - 126,83,174,156,75,156,21, - 131,85,147,30,130,90,228, - 40,2,178,7,79,138,196, - 44,201,134,186,63,196,113, - 28,89,156,53,96,166,205, - 213,15,57,112,70,138,190 - }, - - { - 148,127,27,140,97,157,84, - 2,67,71,99,182,13,250, - 113,100,84,156,156,16,242, - 216,176,107,248,176,40,208, - 235,220,159,243,169,56,65, - 159,199,244,77,142,201,210, - 81,198,4,7,43,126,122 - }, - - { - 23,101,250,171,81,20,89, - 128,51,189,208,81,88,108, - 69,78,59,131,199,38,130, - 102,215,54,7,153,251,58, - 80,98,150,172,193,144,115, - 212,46,119,19,184,10,188, - 14,237,241,16,173,125,191 - }, - - { - 97,19,206,235,176,242,227, - 101,12,97,196,163,218,152, - 104,40,3,63,3,39,15, - 31,4,138,217,199,156,12, - 239,16,55,165,35,249,155, - 252,132,220,53,22,68,104, - 63,246,158,93,50,126,104 - }, - - { - 136,86,29,88,238,198,176, - 148,161,188,49,187,54,131, - 114,216,90,238,169,131,120, - 150,234,162,232,205,105,255, - 161,150,158,52,226,116,23, - 23,218,114,33,50,169,53, - 18,105,210,117,86,89,125 - }, - - { - 178,13,149,148,121,91,82, - 38,29,64,153,12,44,11, - 161,74,139,68,88,35,124, - 42,191,86,119,137,56,127, - 38,40,69,17,89,107,234, - 226,90,137,67,200,96,232, - 79,43,143,239,180,33,81 - }, - - { - 254,112,239,101,191,19,131, - 123,153,174,191,181,101,3, - 46,221,48,253,2,188,62, - 48,225,85,249,74,118,101, - 32,58,51,4,196,252,82, - 178,127,201,119,193,107,155, - 252,77,54,194,83,192,240 - }, - - { - 141,117,43,233,154,235,63, - 50,253,75,91,22,195,180, - 105,62,225,65,245,173,73, - 222,82,82,21,138,31,105, - 125,103,13,104,162,169,56, - 165,203,198,233,117,38,240, - 39,243,174,64,209,60,76 - }, - - { - 159,196,56,192,208,188,198, - 122,162,99,117,240,187,85, - 122,142,242,127,51,213,189, - 170,210,194,148,133,133,29, - 217,17,181,176,52,189,178, - 36,200,26,107,114,103,92, - 121,166,6,179,52,234,142 - }, - - { - 164,250,146,128,92,129,33, - 77,59,62,251,236,133,203, - 203,174,137,91,50,172,10, - 10,235,227,82,61,235,101, - 200,199,150,159,83,13,162, - 42,100,220,210,25,21,56, - 254,76,23,196,161,169,214 - }, - - { - 22,112,203,180,148,28,10, - 150,46,218,99,193,146,186, - 52,61,36,113,59,173,108, - 178,223,233,55,161,52,50, - 17,128,164,93,112,43,216, - 202,37,131,180,130,100,82, - 237,77,23,199,63,30,158 - }, - - { - 47,156,173,221,226,110,149, - 164,39,71,206,74,250,7, - 218,158,122,242,131,252,231, - 165,119,158,248,92,168,3, - 119,157,186,136,214,160,95, - 7,206,124,253,149,155,145, - 105,46,239,35,23,126,58 - }, - - { - 159,159,134,88,135,222,68, - 64,110,148,41,201,20,219, - 144,41,1,72,230,41,167, - 16,194,210,133,8,165,130, - 47,225,148,17,203,103,84, - 43,236,41,98,94,76,91, - 133,8,79,85,16,175,221 - }, - - { - 115,161,236,118,192,144,104, - 255,59,191,32,78,18,14, - 108,203,171,32,254,80,206, - 178,84,132,206,60,193,226, - 4,8,188,193,118,133,91, - 87,13,9,191,67,23,181, - 124,134,134,191,130,95,195 - }, - - { - 202,187,20,83,145,231,14, - 74,153,208,76,200,34,106, - 157,107,9,255,160,250,224, - 5,251,57,230,149,200,39, - 39,79,170,143,95,141,130, - 62,7,170,74,174,17,85, - 238,144,174,152,202,247,202 - }, - - { - 173,144,151,112,43,60,201, - 219,175,238,226,103,153,58, - 119,15,237,206,33,193,243, - 253,102,63,183,24,77,166, - 242,11,72,143,127,79,246, - 188,238,128,118,67,87,183, - 175,79,239,6,108,52,153 - }, - - { - 19,148,26,226,91,100,230, - 169,250,250,171,233,136,16, - 69,214,232,55,111,210,171, - 116,246,96,204,142,82,166, - 104,230,80,151,80,59,13, - 94,247,35,244,34,181,156, - 5,183,210,139,3,95,85 - }, - - { - 125,219,35,9,131,243,232, - 189,133,142,219,41,228,14, - 55,114,188,66,24,210,163, - 124,99,75,61,165,94,228, - 127,6,12,114,246,253,243, - 77,231,101,85,4,164,200, - 117,117,240,63,15,76,203 - }, - - { - 9,134,85,112,185,245,169, - 239,37,166,32,55,179,23, - 7,216,118,32,145,113,152, - 81,254,2,110,33,225,26, - 221,253,151,32,87,233,78, - 155,18,169,163,207,196,34, - 77,135,154,3,192,96,146 - }, - - { - 75,91,117,7,210,246,189, - 146,84,107,248,11,41,245, - 123,204,73,243,191,15,151, - 245,1,109,44,157,204,112, - 153,55,210,68,226,149,209, - 80,22,29,254,243,76,121, - 172,17,1,242,167,176,116 - }, - - { - 230,254,102,33,70,173,175, - 228,171,233,19,239,231,124, - 38,24,147,237,60,159,138, - 243,245,16,215,222,97,60, - 1,116,241,4,46,3,242, - 237,32,9,197,54,119,77, - 137,95,57,179,123,232,16 - }, - - { - 183,187,60,61,212,166,108, - 187,190,151,215,122,188,39, - 86,57,254,185,238,247,79, - 142,209,107,232,255,138,122, - 212,48,23,47,163,228,255, - 32,224,187,246,195,5,116, - 28,160,96,142,147,222,171 - }, - - { - 229,93,42,194,149,50,89, - 58,204,91,225,69,212,47, - 124,178,247,73,3,94,144, - 13,244,241,225,151,159,73, - 16,171,96,76,202,185,250, - 174,10,152,121,68,111,6, - 140,114,166,133,234,104,94 - }, - - { - 186,157,156,42,213,188,78, - 242,32,136,103,58,86,99, - 171,229,203,151,101,196,15, - 109,148,140,4,130,208,135, - 52,214,212,167,66,145,243, - 54,61,240,104,223,212,87, - 181,68,19,247,26,217,165 - }, - - { - 20,68,71,101,64,63,241, - 25,177,222,2,32,2,140, - 138,20,101,194,10,249,205, - 25,11,29,236,53,13,41, - 149,115,115,159,108,172,186, - 56,97,223,149,79,240,33, - 74,244,153,175,230,173,139 - }, - - { - 112,160,137,249,193,254,166, - 20,237,27,169,28,25,166, - 89,133,11,238,230,171,153, - 149,249,253,37,58,38,48, - 226,198,210,91,107,161,50, - 129,73,109,104,128,240,157, - 106,209,245,142,188,44,209 - }, - - { - 94,155,95,27,57,178,126, - 126,85,239,193,85,88,143, - 21,44,88,255,219,33,48, - 160,202,89,107,12,103,123, - 111,249,20,123,41,72,38, - 150,235,92,3,204,197,84, - 176,187,243,59,226,49,184 - }, - - { - 202,228,64,73,214,118,70, - 4,246,243,163,181,137,217, - 140,24,167,19,201,69,35, - 1,179,95,32,201,86,26, - 111,210,1,98,46,226,39, - 226,217,237,225,141,89,245, - 240,244,44,2,143,156,58 - }, - - { - 157,246,3,119,213,223,157, - 231,63,233,113,19,222,44, - 151,145,130,222,78,190,130, - 93,215,44,86,109,232,234, - 249,24,206,73,167,235,11, - 22,201,8,161,6,173,196, - 202,81,229,72,71,33,216 - }, - - { - 245,6,229,112,241,89,47, - 99,172,118,22,20,193,113, - 230,122,251,107,255,10,232, - 55,158,24,188,30,159,178, - 246,6,211,101,134,171,245, - 216,223,48,231,212,198,167, - 71,142,46,234,237,200,4 - }, + { + 177,131,58,218,175,130,210, + 59,25,190,170,189,227,245, + 104,118,7,168,136,178,184, + 4,27,64,199,101,160,24, + 83,177,178,232,185,40,122, + 109,38,253,160,14,133,106, + 190,206,58,102,244,229,124 + }, + + { + 201,183,24,153,17,111,47, + 19,116,248,160,215,143,180, + 195,122,74,29,158,193,73, + 159,193,93,140,172,31,38, + 129,181,96,183,56,29,172, + 191,252,183,91,214,254,247, + 135,66,76,87,1,112,214 + }, + + { + 28,138,132,173,9,230,220, + 57,32,166,202,153,246,49, + 119,246,212,1,50,230,19, + 135,20,173,235,182,61,143, + 76,162,155,224,182,54,123, + 29,223,119,200,175,10,66, + 87,171,204,12,1,44,68 + }, + + { + 142,1,145,102,227,81,84, + 108,1,120,168,9,14,135, + 165,118,141,183,47,235,212, + 109,85,167,185,255,89,18, + 12,36,41,24,181,66,107, + 96,5,160,235,87,33,173, + 140,207,20,70,135,44,102 + }, + + { + 85,38,191,199,157,183,122, + 186,2,236,106,181,53,100, + 69,189,22,137,117,230,153, + 150,211,184,157,220,165,234, + 113,19,238,122,120,233,181, + 130,182,140,76,219,162,90, + 66,242,19,125,8,215,162 + }, + + { + 167,227,240,92,158,80,82, + 18,222,92,51,44,252,34, + 112,74,12,237,158,156,179, + 48,154,47,61,204,24,36, + 62,228,29,23,43,176,239, + 144,117,131,97,219,129,138, + 243,31,33,108,211,255,196 + }, + + { + 83,29,187,49,130,95,252, + 214,6,223,87,149,168,140, + 172,33,170,24,103,180,107, + 63,212,92,143,155,126,129, + 190,25,211,244,151,103,7, + 51,227,119,104,18,177,110, + 33,155,104,15,159,62,103 + }, + + { + 9,151,31,80,46,220,174, + 147,4,3,76,83,157,9, + 39,52,79,252,16,63,25, + 215,131,90,79,128,143,128, + 117,57,224,68,198,98,158, + 191,90,222,94,135,106,238, + 212,168,164,233,138,106,14 + }, + + { + 159,70,200,99,183,101,85, + 117,251,218,149,119,199,12, + 102,190,144,68,145,212,202, + 250,32,118,13,149,136,91, + 203,247,68,69,124,122,248, + 92,125,154,189,60,160,12, + 148,182,162,108,187,198,113 + }, + + { + 75,226,151,153,186,223,56, + 174,53,4,212,8,241,147, + 253,166,123,148,241,166,172, + 118,103,6,219,178,187,41, + 89,250,28,220,20,27,134, + 77,125,14,40,175,125,114, + 15,2,160,240,169,186,63 + }, + + { + 165,251,182,208,45,34,74, + 41,106,244,193,205,160,100, + 51,41,232,106,237,201,184, + 35,112,98,118,238,38,211, + 191,33,221,226,126,55,61, + 224,82,255,19,252,131,188, + 220,111,242,172,93,61,67 + }, + + { + 246,142,205,184,114,219,1, + 246,63,229,6,41,167,187, + 173,185,75,205,96,37,252, + 142,135,8,82,240,138,254, + 107,202,42,104,198,71,98, + 173,197,100,156,37,180,190, + 88,30,229,135,12,58,198 + }, + + { + 7,121,166,123,114,32,78, + 223,125,21,155,124,116,240, + 222,91,57,5,254,51,4, + 161,122,236,49,146,88,235, + 253,149,42,31,140,254,163, + 71,253,70,242,115,10,171, + 101,38,217,187,117,31,141 + }, + + { + 220,220,58,61,163,182,106, + 201,38,91,53,99,7,253, + 179,12,108,175,148,246,162, + 217,7,36,146,193,22,3, + 220,68,101,117,184,62,195, + 25,94,226,155,28,43,110, + 161,132,70,110,201,58,228 + }, + + { + 39,253,170,4,47,122,100, + 182,223,98,128,205,167,103, + 42,16,227,30,43,181,80, + 212,194,100,164,123,181,97, + 126,145,213,51,44,135,240, + 100,105,151,106,174,180,134, + 106,49,72,73,237,2,84 + }, + + { + 1,140,181,150,80,96,57, + 214,115,209,143,122,31,162, + 201,171,155,38,225,68,12, + 219,180,253,105,97,208,19, + 20,8,84,223,139,223,146, + 150,53,161,187,167,163,61, + 45,242,115,110,195,89,15 + }, + + { + 50,197,196,115,105,176,64, + 87,141,157,64,185,202,118, + 158,70,79,168,121,141,57, + 163,128,141,228,192,195,115, + 15,227,176,28,130,126,54, + 75,200,45,202,7,158,179, + 77,23,142,127,110,31,141 + }, + + { + 123,175,80,224,82,146,27, + 61,247,16,236,96,150,244, + 102,13,165,47,253,185,96, + 178,149,204,82,2,235,182, + 47,249,110,211,181,241,87, + 93,208,215,155,65,168,65, + 152,71,236,50,249,80,249 + }, + + { + 139,219,5,39,213,136,215, + 228,108,228,169,234,173,243, + 229,45,65,105,121,208,18, + 202,118,209,11,19,178,162, + 59,74,82,99,111,28,119, + 6,217,203,9,252,227,146, + 217,194,195,213,12,221,229 + }, + + { + 49,9,169,202,201,231,152, + 102,226,150,26,173,50,161, + 241,73,224,232,42,44,182, + 48,85,6,112,192,109,58, + 164,25,233,113,68,229,93, + 83,32,42,74,152,119,240, + 95,234,245,83,222,203,49 + }, + + { + 58,104,2,6,164,206,186, + 224,222,73,218,87,103,158, + 186,30,242,149,198,193,89, + 94,43,38,197,36,33,64, + 7,136,243,253,80,61,90, + 223,72,116,47,46,190,94, + 50,77,217,111,227,35,30 + }, + + { + 161,5,6,26,113,239,46, + 35,195,65,36,225,119,8, + 31,27,206,249,207,129,119, + 218,138,239,90,154,78,217, + 247,85,161,87,123,185,175, + 152,74,2,181,30,66,9, + 30,147,91,147,86,146,232 + }, + + { + 111,204,65,49,124,16,12, + 149,51,137,89,252,190,203, + 155,194,84,231,136,213,197, + 202,212,73,251,17,80,12, + 106,75,180,1,15,52,1, + 36,27,194,180,13,226,151, + 210,106,27,190,237,194,16 + }, + + { + 63,38,43,226,100,106,44, + 100,72,214,138,170,142,137, + 51,246,203,190,250,5,139, + 146,105,90,117,73,83,168, + 127,89,106,238,176,54,135, + 79,97,13,229,87,119,110, + 253,184,151,32,70,14,191 + }, + + { + 3,134,209,61,87,248,16, + 140,69,243,241,249,240,83, + 184,156,4,81,67,134,241, + 25,176,185,228,181,65,200, + 143,165,255,165,222,193,94, + 146,188,178,68,171,218,177, + 198,3,208,189,1,204,100 + }, + + { + 22,66,132,87,17,19,147, + 142,42,56,105,247,102,68, + 124,234,205,209,46,130,54, + 254,10,162,22,63,87,26, + 148,32,114,179,139,23,239, + 128,191,233,238,76,251,218, + 169,126,70,24,167,70,244 + }, + + { + 156,153,114,200,16,71,190, + 214,189,154,249,102,57,40, + 212,144,211,72,187,194,106, + 32,131,241,173,161,83,169, + 128,245,153,168,115,72,94, + 90,15,107,218,206,232,88, + 162,109,52,236,54,42,212 + }, + + { + 242,93,89,143,226,33,252, + 126,83,174,156,75,156,21, + 131,85,147,30,130,90,228, + 40,2,178,7,79,138,196, + 44,201,134,186,63,196,113, + 28,89,156,53,96,166,205, + 213,15,57,112,70,138,190 + }, + + { + 148,127,27,140,97,157,84, + 2,67,71,99,182,13,250, + 113,100,84,156,156,16,242, + 216,176,107,248,176,40,208, + 235,220,159,243,169,56,65, + 159,199,244,77,142,201,210, + 81,198,4,7,43,126,122 + }, + + { + 23,101,250,171,81,20,89, + 128,51,189,208,81,88,108, + 69,78,59,131,199,38,130, + 102,215,54,7,153,251,58, + 80,98,150,172,193,144,115, + 212,46,119,19,184,10,188, + 14,237,241,16,173,125,191 + }, + + { + 97,19,206,235,176,242,227, + 101,12,97,196,163,218,152, + 104,40,3,63,3,39,15, + 31,4,138,217,199,156,12, + 239,16,55,165,35,249,155, + 252,132,220,53,22,68,104, + 63,246,158,93,50,126,104 + }, + + { + 136,86,29,88,238,198,176, + 148,161,188,49,187,54,131, + 114,216,90,238,169,131,120, + 150,234,162,232,205,105,255, + 161,150,158,52,226,116,23, + 23,218,114,33,50,169,53, + 18,105,210,117,86,89,125 + }, + + { + 178,13,149,148,121,91,82, + 38,29,64,153,12,44,11, + 161,74,139,68,88,35,124, + 42,191,86,119,137,56,127, + 38,40,69,17,89,107,234, + 226,90,137,67,200,96,232, + 79,43,143,239,180,33,81 + }, + + { + 254,112,239,101,191,19,131, + 123,153,174,191,181,101,3, + 46,221,48,253,2,188,62, + 48,225,85,249,74,118,101, + 32,58,51,4,196,252,82, + 178,127,201,119,193,107,155, + 252,77,54,194,83,192,240 + }, + + { + 141,117,43,233,154,235,63, + 50,253,75,91,22,195,180, + 105,62,225,65,245,173,73, + 222,82,82,21,138,31,105, + 125,103,13,104,162,169,56, + 165,203,198,233,117,38,240, + 39,243,174,64,209,60,76 + }, + + { + 159,196,56,192,208,188,198, + 122,162,99,117,240,187,85, + 122,142,242,127,51,213,189, + 170,210,194,148,133,133,29, + 217,17,181,176,52,189,178, + 36,200,26,107,114,103,92, + 121,166,6,179,52,234,142 + }, + + { + 164,250,146,128,92,129,33, + 77,59,62,251,236,133,203, + 203,174,137,91,50,172,10, + 10,235,227,82,61,235,101, + 200,199,150,159,83,13,162, + 42,100,220,210,25,21,56, + 254,76,23,196,161,169,214 + }, + + { + 22,112,203,180,148,28,10, + 150,46,218,99,193,146,186, + 52,61,36,113,59,173,108, + 178,223,233,55,161,52,50, + 17,128,164,93,112,43,216, + 202,37,131,180,130,100,82, + 237,77,23,199,63,30,158 + }, + + { + 47,156,173,221,226,110,149, + 164,39,71,206,74,250,7, + 218,158,122,242,131,252,231, + 165,119,158,248,92,168,3, + 119,157,186,136,214,160,95, + 7,206,124,253,149,155,145, + 105,46,239,35,23,126,58 + }, + + { + 159,159,134,88,135,222,68, + 64,110,148,41,201,20,219, + 144,41,1,72,230,41,167, + 16,194,210,133,8,165,130, + 47,225,148,17,203,103,84, + 43,236,41,98,94,76,91, + 133,8,79,85,16,175,221 + }, + + { + 115,161,236,118,192,144,104, + 255,59,191,32,78,18,14, + 108,203,171,32,254,80,206, + 178,84,132,206,60,193,226, + 4,8,188,193,118,133,91, + 87,13,9,191,67,23,181, + 124,134,134,191,130,95,195 + }, + + { + 202,187,20,83,145,231,14, + 74,153,208,76,200,34,106, + 157,107,9,255,160,250,224, + 5,251,57,230,149,200,39, + 39,79,170,143,95,141,130, + 62,7,170,74,174,17,85, + 238,144,174,152,202,247,202 + }, + + { + 173,144,151,112,43,60,201, + 219,175,238,226,103,153,58, + 119,15,237,206,33,193,243, + 253,102,63,183,24,77,166, + 242,11,72,143,127,79,246, + 188,238,128,118,67,87,183, + 175,79,239,6,108,52,153 + }, + + { + 19,148,26,226,91,100,230, + 169,250,250,171,233,136,16, + 69,214,232,55,111,210,171, + 116,246,96,204,142,82,166, + 104,230,80,151,80,59,13, + 94,247,35,244,34,181,156, + 5,183,210,139,3,95,85 + }, + + { + 125,219,35,9,131,243,232, + 189,133,142,219,41,228,14, + 55,114,188,66,24,210,163, + 124,99,75,61,165,94,228, + 127,6,12,114,246,253,243, + 77,231,101,85,4,164,200, + 117,117,240,63,15,76,203 + }, + + { + 9,134,85,112,185,245,169, + 239,37,166,32,55,179,23, + 7,216,118,32,145,113,152, + 81,254,2,110,33,225,26, + 221,253,151,32,87,233,78, + 155,18,169,163,207,196,34, + 77,135,154,3,192,96,146 + }, + + { + 75,91,117,7,210,246,189, + 146,84,107,248,11,41,245, + 123,204,73,243,191,15,151, + 245,1,109,44,157,204,112, + 153,55,210,68,226,149,209, + 80,22,29,254,243,76,121, + 172,17,1,242,167,176,116 + }, + + { + 230,254,102,33,70,173,175, + 228,171,233,19,239,231,124, + 38,24,147,237,60,159,138, + 243,245,16,215,222,97,60, + 1,116,241,4,46,3,242, + 237,32,9,197,54,119,77, + 137,95,57,179,123,232,16 + }, + + { + 183,187,60,61,212,166,108, + 187,190,151,215,122,188,39, + 86,57,254,185,238,247,79, + 142,209,107,232,255,138,122, + 212,48,23,47,163,228,255, + 32,224,187,246,195,5,116, + 28,160,96,142,147,222,171 + }, + + { + 229,93,42,194,149,50,89, + 58,204,91,225,69,212,47, + 124,178,247,73,3,94,144, + 13,244,241,225,151,159,73, + 16,171,96,76,202,185,250, + 174,10,152,121,68,111,6, + 140,114,166,133,234,104,94 + }, + + { + 186,157,156,42,213,188,78, + 242,32,136,103,58,86,99, + 171,229,203,151,101,196,15, + 109,148,140,4,130,208,135, + 52,214,212,167,66,145,243, + 54,61,240,104,223,212,87, + 181,68,19,247,26,217,165 + }, + + { + 20,68,71,101,64,63,241, + 25,177,222,2,32,2,140, + 138,20,101,194,10,249,205, + 25,11,29,236,53,13,41, + 149,115,115,159,108,172,186, + 56,97,223,149,79,240,33, + 74,244,153,175,230,173,139 + }, + + { + 112,160,137,249,193,254,166, + 20,237,27,169,28,25,166, + 89,133,11,238,230,171,153, + 149,249,253,37,58,38,48, + 226,198,210,91,107,161,50, + 129,73,109,104,128,240,157, + 106,209,245,142,188,44,209 + }, + + { + 94,155,95,27,57,178,126, + 126,85,239,193,85,88,143, + 21,44,88,255,219,33,48, + 160,202,89,107,12,103,123, + 111,249,20,123,41,72,38, + 150,235,92,3,204,197,84, + 176,187,243,59,226,49,184 + }, + + { + 202,228,64,73,214,118,70, + 4,246,243,163,181,137,217, + 140,24,167,19,201,69,35, + 1,179,95,32,201,86,26, + 111,210,1,98,46,226,39, + 226,217,237,225,141,89,245, + 240,244,44,2,143,156,58 + }, + + { + 157,246,3,119,213,223,157, + 231,63,233,113,19,222,44, + 151,145,130,222,78,190,130, + 93,215,44,86,109,232,234, + 249,24,206,73,167,235,11, + 22,201,8,161,6,173,196, + 202,81,229,72,71,33,216 + }, + + { + 245,6,229,112,241,89,47, + 99,172,118,22,20,193,113, + 230,122,251,107,255,10,232, + 55,158,24,188,30,159,178, + 246,6,211,101,134,171,245, + 216,223,48,231,212,198,167, + 71,142,46,234,237,200,4 + }, }; -// GLobals used here, for each event structure used, +// GLobals used here, for each event structure used, // Used as globals for stack reasons EV_E_PLAYSOUND EPlaySound; @@ -669,19 +669,19 @@ BOOLEAN AddGameEventFromNetwork( UINT32 uiEvent, UINT16 usDelay, PTR pEventData BOOLEAN AddGameEventToQueue( UINT32 uiEvent, UINT16 usDelay, PTR pEventData, UINT8 ubQueueID ) { - UINT32 uiDataSize; + UINT32 uiDataSize; - // Check range of Event ui - if ( uiEvent < 0 || uiEvent > NUM_EVENTS ) - { - // Set debug message! + // Check range of Event ui + if ( uiEvent < 0 || uiEvent > NUM_EVENTS ) + { + // Set debug message! DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Unknown event type"); return( FALSE ); - } + } - // Switch on event type and set size accordingly - switch( uiEvent ) - { + // Switch on event type and set size accordingly + switch( uiEvent ) + { case E_PLAYSOUND: uiDataSize = sizeof( EV_E_PLAYSOUND ); @@ -744,19 +744,19 @@ BOOLEAN AddGameEventToQueue( UINT32 uiEvent, UINT16 usDelay, PTR pEventData, UIN uiDataSize = sizeof( EV_S_WEAPONHIT ); break; - + case S_STRUCTUREHIT: uiDataSize = sizeof( EV_S_STRUCTUREHIT ); break; - + case S_WINDOWHIT: uiDataSize = sizeof( EV_S_STRUCTUREHIT ); break; - + case S_MISS: uiDataSize = sizeof( EV_S_MISS ); break; - + case S_NOISE: uiDataSize = sizeof( EV_S_NOISE ); break; @@ -779,23 +779,23 @@ BOOLEAN AddGameEventToQueue( UINT32 uiEvent, UINT16 usDelay, PTR pEventData, UIN DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Event Type mismatch"); return( FALSE ); - } + } - CHECKF( AddEvent( uiEvent, usDelay, pEventData, uiDataSize, ubQueueID ) ); + CHECKF( AddEvent( uiEvent, usDelay, pEventData, uiDataSize, ubQueueID ) ); - // successful - return( TRUE ); + // successful + return( TRUE ); } -BOOLEAN DequeAllGameEvents( BOOLEAN fExecute ) +BOOLEAN DequeAllGameEvents( BOOLEAN fExecute ) { EVENT *pEvent; UINT32 uiQueueSize, cnt; BOOLEAN fCompleteLoop = FALSE; // First dequeue all primary events - + while( EventQueueSize( PRIMARY_EVENT_QUEUE ) > 0 ) { // Get Event @@ -832,7 +832,7 @@ BOOLEAN DequeAllGameEvents( BOOLEAN fExecute ) { return( FALSE ); } - + // Check time if ( ( GetJA2Clock() - pEvent->TimeStamp ) > pEvent->usDelay ) { @@ -843,7 +843,7 @@ BOOLEAN DequeAllGameEvents( BOOLEAN fExecute ) // FLag as expired pEvent->uiFlags = EVENT_EXPIRED; - + } } @@ -858,7 +858,7 @@ BOOLEAN DequeAllGameEvents( BOOLEAN fExecute ) { return( FALSE ); } - + // Check time if ( pEvent->uiFlags & EVENT_EXPIRED ) { @@ -868,9 +868,9 @@ BOOLEAN DequeAllGameEvents( BOOLEAN fExecute ) break; } - + } - + if ( cnt == uiQueueSize ) { fCompleteLoop = TRUE; @@ -884,10 +884,9 @@ BOOLEAN DequeAllGameEvents( BOOLEAN fExecute ) BOOLEAN DequeueAllDemandGameEvents( BOOLEAN fExecute ) { EVENT *pEvent; - //BOOLEAN fCompleteLoop = FALSE; // Dequeue all events on the demand queue (only) - + while( EventQueueSize( DEMAND_EVENT_QUEUE ) > 0 ) { // Get Event @@ -929,7 +928,7 @@ BOOLEAN ExecuteGameEvent( EVENT *pEvent ) case E_PLAYSOUND: memcpy( &EPlaySound, pEvent->pData, pEvent->uiDataSize ); - + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Play Sound"); PlayJA2Sample( EPlaySound.usIndex, EPlaySound.usRate, EPlaySound.ubVolume, EPlaySound.ubLoops, EPlaySound.uiPan ); break; @@ -941,20 +940,20 @@ BOOLEAN ExecuteGameEvent( EVENT *pEvent ) // Get soldier pointer from ID if ( GetSoldier( &pSoldier, SChangeState.usSoldierID ) == FALSE ) { - // Handle Error? - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Invalid Soldier ID"); - break; + // Handle Error? + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Invalid Soldier ID"); + break; } // check for error - if( pSoldier-> uiUniqueSoldierIdValue != SChangeState.uiUniqueId ) + if( pSoldier->uiUniqueSoldierIdValue != SChangeState.uiUniqueId ) { break; } // Call soldier function // DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Event Pump: ChangeState %S (%d)", gAnimControl[ SChangeState.ubNewState ].zAnimStr, SChangeState.usSoldierID ) ); - EVENT_InitNewSoldierAnim( pSoldier, SChangeState.usNewState, SChangeState.usStartingAniCode, SChangeState.fForce ); + pSoldier->EVENT_InitNewSoldierAnim( SChangeState.usNewState, SChangeState.usStartingAniCode, SChangeState.fForce ); break; case S_CHANGEDEST: @@ -964,20 +963,20 @@ BOOLEAN ExecuteGameEvent( EVENT *pEvent ) // Get soldier pointer from ID if ( GetSoldier( &pSoldier, SChangeDest.usSoldierID ) == FALSE ) { - // Handle Error? - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Event Pump: Invalid Soldier ID #%d", SChangeDest.usSoldierID) ); - break; + // Handle Error? + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Event Pump: Invalid Soldier ID #%d", SChangeDest.usSoldierID) ); + break; } // check for error - if( pSoldier-> uiUniqueSoldierIdValue != SChangeDest.uiUniqueId ) + if( pSoldier->uiUniqueSoldierIdValue != SChangeDest.uiUniqueId ) { break; } // Call soldier function DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Change Dest"); - EVENT_SetSoldierDestination( pSoldier, (UINT8) SChangeDest.usNewDestination ); + pSoldier->EVENT_SetSoldierDestination( (UINT8) SChangeDest.usNewDestination ); break; case S_SETPOSITION: @@ -987,20 +986,20 @@ BOOLEAN ExecuteGameEvent( EVENT *pEvent ) // Get soldier pointer from ID if ( GetSoldier( &pSoldier, SSetPosition.usSoldierID ) == FALSE ) { - // Handle Error? - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Invalid Soldier ID"); - break; + // Handle Error? + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Invalid Soldier ID"); + break; } // check for error - if( pSoldier-> uiUniqueSoldierIdValue != SSetPosition.uiUniqueId ) + if( pSoldier->uiUniqueSoldierIdValue != SSetPosition.uiUniqueId ) { break; } // Call soldier function // DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Event Pump: SetPosition ( %f %f ) ( %d )", SSetPosition.dNewXPos, SSetPosition.dNewYPos, SSetPosition.usSoldierID ) ); - EVENT_SetSoldierPosition( pSoldier, SSetPosition.dNewXPos, SSetPosition.dNewYPos ); + pSoldier->EVENT_SetSoldierPosition( SSetPosition.dNewXPos, SSetPosition.dNewYPos ); break; case S_GETNEWPATH: @@ -1010,19 +1009,19 @@ BOOLEAN ExecuteGameEvent( EVENT *pEvent ) // Get soldier pointer from ID if ( GetSoldier( &pSoldier, SGetNewPath.usSoldierID ) == FALSE ) { - // Handle Error? - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Invalid Soldier ID"); - break; + // Handle Error? + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Invalid Soldier ID"); + break; } // check for error - if( pSoldier-> uiUniqueSoldierIdValue != SGetNewPath.uiUniqueId ) + if( pSoldier->uiUniqueSoldierIdValue != SGetNewPath.uiUniqueId ) { break; } // Call soldier function DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: GetNewPath"); - EVENT_GetNewSoldierPath( pSoldier, SGetNewPath.sDestGridNo, SGetNewPath.usMovementAnim ); + pSoldier->EVENT_GetNewSoldierPath( SGetNewPath.sDestGridNo, SGetNewPath.usMovementAnim ); break; case S_BEGINTURN: @@ -1032,20 +1031,20 @@ BOOLEAN ExecuteGameEvent( EVENT *pEvent ) // Get soldier pointer from ID if ( GetSoldier( &pSoldier, SBeginTurn.usSoldierID ) == FALSE ) { - // Handle Error? - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Invalid Soldier ID"); - break; + // Handle Error? + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Invalid Soldier ID"); + break; } // check for error - if( pSoldier-> uiUniqueSoldierIdValue != SBeginTurn.uiUniqueId ) + if( pSoldier->uiUniqueSoldierIdValue != SBeginTurn.uiUniqueId ) { break; } // Call soldier function DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: BeginTurn"); - EVENT_BeginMercTurn( pSoldier, FALSE, 0 ); + pSoldier->EVENT_BeginMercTurn( FALSE, 0 ); break; case S_CHANGESTANCE: @@ -1055,19 +1054,19 @@ BOOLEAN ExecuteGameEvent( EVENT *pEvent ) // Get soldier pointer from ID if ( GetSoldier( &pSoldier, SChangeStance.usSoldierID ) == FALSE ) { - // Handle Error? - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Invalid Soldier ID"); - break; + // Handle Error? + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Invalid Soldier ID"); + break; } // check for error - if( pSoldier-> uiUniqueSoldierIdValue != SChangeStance.uiUniqueId ) + if( pSoldier->uiUniqueSoldierIdValue != SChangeStance.uiUniqueId ) { break; } // Call soldier function DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: ChangeStance"); - ChangeSoldierStance( pSoldier, SChangeStance.ubNewStance ); + pSoldier->ChangeSoldierStance( SChangeStance.ubNewStance ); break; case S_SETDIRECTION: @@ -1077,20 +1076,20 @@ BOOLEAN ExecuteGameEvent( EVENT *pEvent ) // Get soldier pointer from ID if ( GetSoldier( &pSoldier, SSetDirection.usSoldierID ) == FALSE ) { - // Handle Error? - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Invalid Soldier ID"); - break; + // Handle Error? + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Invalid Soldier ID"); + break; } // check for error - if( pSoldier-> uiUniqueSoldierIdValue != SSetDirection.uiUniqueId ) + if( pSoldier->uiUniqueSoldierIdValue != SSetDirection.uiUniqueId ) { break; } // Call soldier function - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Event Pump: SetDirection: Dir( %d )", SSetDirection.usNewDirection) ); - EVENT_SetSoldierDirection( pSoldier, SSetDirection.usNewDirection ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Event Pump: SetDirection: Dir( %d )", SSetDirection.usNewDirection) ); + pSoldier->EVENT_SetSoldierDirection( SSetDirection.usNewDirection ); break; case S_SETDESIREDDIRECTION: @@ -1100,20 +1099,20 @@ BOOLEAN ExecuteGameEvent( EVENT *pEvent ) // Get soldier pointer from ID if ( GetSoldier( &pSoldier, SSetDesiredDirection.usSoldierID ) == FALSE ) { - // Handle Error? - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Invalid Soldier ID"); - break; + // Handle Error? + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Invalid Soldier ID"); + break; } // check for error - if( pSoldier-> uiUniqueSoldierIdValue != SSetDesiredDirection.uiUniqueId ) + if( pSoldier->uiUniqueSoldierIdValue != SSetDesiredDirection.uiUniqueId ) { break; } // Call soldier function - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Event Pump: SetDesiredDirection: Dir( %d )", SSetDesiredDirection.usDesiredDirection) ); - EVENT_SetSoldierDesiredDirection( pSoldier, (UINT8) SSetDesiredDirection.usDesiredDirection ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Event Pump: SetDesiredDirection: Dir( %d )", SSetDesiredDirection.usDesiredDirection) ); + pSoldier->EVENT_SetSoldierDesiredDirection( (UINT8) SSetDesiredDirection.usDesiredDirection ); break; @@ -1124,14 +1123,14 @@ BOOLEAN ExecuteGameEvent( EVENT *pEvent ) // Get soldier pointer from ID if ( GetSoldier( &pSoldier, SBeginFireWeapon.usSoldierID ) == FALSE ) { - pSoldier = NULL; - break; - // Handle Error? - // DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Invalid Soldier ID"); + pSoldier = NULL; + break; + // Handle Error? + // DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Invalid Soldier ID"); } // check for error - if( pSoldier-> uiUniqueSoldierIdValue != SBeginFireWeapon.uiUniqueId ) + if( pSoldier->uiUniqueSoldierIdValue != SBeginFireWeapon.uiUniqueId ) { break; } @@ -1141,7 +1140,7 @@ BOOLEAN ExecuteGameEvent( EVENT *pEvent ) pSoldier->sTargetGridNo = SBeginFireWeapon.sTargetGridNo; pSoldier->bTargetLevel = SBeginFireWeapon.bTargetLevel; pSoldier->bTargetCubeLevel = SBeginFireWeapon.bTargetCubeLevel; - EVENT_FireSoldierWeapon( pSoldier, SBeginFireWeapon.sTargetGridNo ); + pSoldier->EVENT_FireSoldierWeapon( SBeginFireWeapon.sTargetGridNo ); break; case S_FIREWEAPON: @@ -1151,13 +1150,13 @@ BOOLEAN ExecuteGameEvent( EVENT *pEvent ) // Get soldier pointer from ID if ( GetSoldier( &pSoldier, SFireWeapon.usSoldierID ) == FALSE ) { - // Handle Error? - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Invalid Soldier ID"); - break; + // Handle Error? + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Invalid Soldier ID"); + break; } // check for error - if( pSoldier-> uiUniqueSoldierIdValue != SFireWeapon.uiUniqueId ) + if( pSoldier->uiUniqueSoldierIdValue != SFireWeapon.uiUniqueId ) { break; } @@ -1168,7 +1167,7 @@ BOOLEAN ExecuteGameEvent( EVENT *pEvent ) pSoldier->sTargetGridNo = SFireWeapon.sTargetGridNo; pSoldier->bTargetLevel = SFireWeapon.bTargetLevel; pSoldier->bTargetCubeLevel = SFireWeapon.bTargetCubeLevel; - FireWeapon( pSoldier, SFireWeapon.sTargetGridNo ); + FireWeapon( pSoldier, SFireWeapon.sTargetGridNo ); break; @@ -1189,7 +1188,7 @@ BOOLEAN ExecuteGameEvent( EVENT *pEvent ) case S_WINDOWHIT: memcpy( &SWindowHit, pEvent->pData, pEvent->uiDataSize ); - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Event Pump: WindowHit" ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Event Pump: WindowHit" ) ); WindowHit( SWindowHit.sGridNo, SWindowHit.usStructureID, SWindowHit.fBlowWindowSouth, SWindowHit.fLargeForce ); break; @@ -1213,19 +1212,19 @@ BOOLEAN ExecuteGameEvent( EVENT *pEvent ) // Get soldier pointer from ID if ( GetSoldier( &pSoldier, SStopMerc.usSoldierID ) == FALSE ) { - // Handle Error? - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Invalid Soldier ID"); - break; + // Handle Error? + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Event Pump: Invalid Soldier ID"); + break; } - if( pSoldier-> uiUniqueSoldierIdValue != SStopMerc.uiUniqueId ) + if( pSoldier->uiUniqueSoldierIdValue != SStopMerc.uiUniqueId ) { break; } // Call soldier function DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Event Pump: Stop Merc at Gridno %d", SStopMerc.sGridNo )); - EVENT_StopMerc( pSoldier, SStopMerc.sGridNo, SStopMerc.bDirection ); + pSoldier->EVENT_StopMerc( SStopMerc.sGridNo, SStopMerc.bDirection ); break; @@ -1256,3 +1255,4 @@ BOOLEAN ClearEventQueue( void ) return( TRUE ); } + diff --git a/Utils/Event Pump.h b/Utils/Event Pump.h index e7e72f08..13898e92 100644 --- a/Utils/Event Pump.h +++ b/Utils/Event Pump.h @@ -34,7 +34,7 @@ enum eJA2Events S_SENDPATHTONETWORK, S_UPDATENETWORKSOLDIER, - EVENTS_ONLY_SENT_OVER_NETWORK, // Events above are only sent to the network + EVENTS_ONLY_SENT_OVER_NETWORK, // Events above are only sent to the network NUM_EVENTS @@ -59,12 +59,12 @@ typedef struct typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; + UINT16 usSoldierID; + UINT32 uiUniqueId; UINT16 usNewState; INT16 sXPos; INT16 sYPos; - UINT16 usStartingAniCode; + UINT16 usStartingAniCode; BOOLEAN fForce; } EV_S_CHANGESTATE; @@ -72,8 +72,8 @@ typedef struct typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; + UINT16 usSoldierID; + UINT32 uiUniqueId; UINT16 usNewDestination; } EV_S_CHANGEDEST; @@ -81,31 +81,31 @@ typedef struct typedef struct { UINT16 usSoldierID; - UINT32 uiUniqueId; - FLOAT dNewXPos; - FLOAT dNewYPos; + UINT32 uiUniqueId; + FLOAT dNewXPos; + FLOAT dNewYPos; } EV_S_SETPOSITION; typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; - INT16 sDestGridNo; - UINT16 usMovementAnim; + UINT16 usSoldierID; + UINT32 uiUniqueId; + INT16 sDestGridNo; + UINT16 usMovementAnim; } EV_S_GETNEWPATH; typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; + UINT16 usSoldierID; + UINT32 uiUniqueId; } EV_S_BEGINTURN; typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; + UINT16 usSoldierID; + UINT32 uiUniqueId; UINT8 ubNewStance; INT16 sXPos; INT16 sYPos; @@ -114,16 +114,16 @@ typedef struct typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; + UINT16 usSoldierID; + UINT32 uiUniqueId; UINT16 usNewDirection; } EV_S_SETDIRECTION; typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; + UINT16 usSoldierID; + UINT32 uiUniqueId; UINT16 usDesiredDirection; } EV_S_SETDESIREDDIRECTION; @@ -131,8 +131,8 @@ typedef struct typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; + UINT16 usSoldierID; + UINT32 uiUniqueId; INT16 sTargetGridNo; INT8 bTargetLevel; INT8 bTargetCubeLevel; @@ -141,8 +141,8 @@ typedef struct typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; + UINT16 usSoldierID; + UINT32 uiUniqueId; INT16 sTargetGridNo; INT8 bTargetLevel; INT8 bTargetCubeLevel; @@ -150,8 +150,8 @@ typedef struct typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; + UINT16 usSoldierID; + UINT32 uiUniqueId; UINT16 usWeaponIndex; INT16 sDamage; INT16 sBreathLoss; @@ -173,7 +173,7 @@ typedef struct INT16 sYPos; INT16 sZPos; UINT16 usWeaponIndex; - INT8 bWeaponStatus; + INT16 bWeaponStatus; UINT8 ubAttackerID; UINT16 usStructureID; INT32 iImpact; @@ -207,8 +207,8 @@ typedef struct typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; + UINT16 usSoldierID; + UINT32 uiUniqueId; INT8 bDirection; INT16 sGridNo; INT16 sXPos; @@ -221,11 +221,11 @@ typedef struct typedef struct { UINT8 usSoldierID; - UINT32 uiUniqueId; + UINT32 uiUniqueId; UINT8 usPathDataSize; // Size of Path INT16 sAtGridNo; // Owner merc is at this tile when sending packet UINT8 usCurrentPathIndex; // Index the owner of the merc is at when sending packet - UINT8 usPathData[ NETWORK_PATH_DATA_SIZE ]; // make define // Next X tile to go to + UINT8 usPathData[ NETWORK_PATH_DATA_SIZE ]; // make define // Next X tile to go to UINT8 ubNewState; // new movment Anim // INT8 bActionPoints; // INT8 bBreath; // current breath value @@ -237,7 +237,7 @@ typedef struct typedef struct { UINT8 usSoldierID; - UINT32 uiUniqueId; + UINT32 uiUniqueId; INT16 sAtGridNo; // Owner merc is at this tile when sending packet INT8 bActionPoints; // current A.P. value INT8 bBreath; // current breath value diff --git a/Utils/Font Control.cpp b/Utils/Font Control.cpp index 3757fbc1..6a3196ca 100644 --- a/Utils/Font Control.cpp +++ b/Utils/Font Control.cpp @@ -14,8 +14,8 @@ #include "WinFont.h" #endif -INT32 giCurWinFont = 0; -BOOLEAN gfUseWinFonts = FALSE; +INT32 giCurWinFont = 0; +BOOLEAN gfUseWinFonts = FALSE; // Global variables for video objects @@ -31,14 +31,14 @@ HVOBJECT gvoTinyFontType1; INT32 gp12PointFont1; HVOBJECT gvo12PointFont1; -INT32 gpClockFont; -HVOBJECT gvoClockFont; +INT32 gpClockFont; +HVOBJECT gvoClockFont; -INT32 gpCompFont; -HVOBJECT gvoCompFont; +INT32 gpCompFont; +HVOBJECT gvoCompFont; -INT32 gpSmallCompFont; -HVOBJECT gvoSmallCompFont; +INT32 gpSmallCompFont; +HVOBJECT gvoSmallCompFont; INT32 gp10PointRoman; HVOBJECT gvo10PointRoman; @@ -64,10 +64,10 @@ HVOBJECT gvo14PointArial; INT32 gp12PointArial; HVOBJECT gvo12PointArial; -INT32 gpBlockyFont; +INT32 gpBlockyFont; HVOBJECT gvoBlockyFont; -INT32 gpBlockyFont2; +INT32 gpBlockyFont2; HVOBJECT gvoBlockyFont2; INT32 gp12PointArialFixedFont; @@ -87,7 +87,7 @@ HVOBJECT gvo14PointHumanist; HVOBJECT gvoHugeFont; #endif -INT32 giSubTitleWinFont; +INT32 giSubTitleWinFont; @@ -100,8 +100,8 @@ extern UINT16 gzFontName[32]; BOOLEAN InitializeFonts( ) { - //INT16 zWinFontName[128]; // unused (jonathanl) - //COLORVAL Color; // usused (jonathanl) + //INT16 zWinFontName[128]; // unused (jonathanl) + //COLORVAL Color; // usused (jonathanl) // Initialize fonts // gpLargeFontType1 = LoadFontFile( "FONTS\\lfont1.sti" ); @@ -180,12 +180,12 @@ BOOLEAN InitializeFonts( ) gp12PointArial = LoadFontFile( "FONTS\\FONT12ARIAL.sti" ); gvo12PointArial = GetFontObject( gp12PointArial); CHECKF( CreateFontPaletteTables( gvo12PointArial) ); - + // gpBlockyFont = LoadFontFile( "FONTS\\FONT2.sti" ); gpBlockyFont = LoadFontFile( "FONTS\\BLOCKFONT.sti" ); gvoBlockyFont = GetFontObject( gpBlockyFont); CHECKF( CreateFontPaletteTables( gvoBlockyFont) ); - + // gpBlockyFont2 = LoadFontFile( "FONTS\\interface_font.sti" ); gpBlockyFont2 = LoadFontFile( "FONTS\\BLOCKFONT2.sti" ); gvoBlockyFont2 = GetFontObject( gpBlockyFont2); @@ -195,11 +195,11 @@ BOOLEAN InitializeFonts( ) gp12PointArialFixedFont = LoadFontFile( "FONTS\\FONT12ARIALFIXEDWIDTH.sti" ); gvo12PointArialFixedFont = GetFontObject( gp12PointArialFixedFont ); CHECKF( CreateFontPaletteTables( gvo12PointArialFixedFont ) ); - + gp16PointArial = LoadFontFile( "FONTS\\FONT16ARIAL.sti" ); gvo16PointArial = GetFontObject( gp16PointArial ); CHECKF( CreateFontPaletteTables( gvo16PointArial ) ); - + gpBlockFontNarrow = LoadFontFile( "FONTS\\BLOCKFONTNARROW.sti" ); gvoBlockFontNarrow = GetFontObject( gpBlockFontNarrow ); CHECKF( CreateFontPaletteTables( gvoBlockFontNarrow ) ); @@ -213,7 +213,7 @@ BOOLEAN InitializeFonts( ) gvoHugeFont = GetFontObject( gpHugeFont ); CHECKF( CreateFontPaletteTables( gvoHugeFont ) ); #endif - + // Set default for font system SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); @@ -228,7 +228,7 @@ BOOLEAN InitializeFonts( ) giSubTitleWinFont = CreateWinFont( -16, 0, 0, 0, FALSE, FALSE, FALSE, L"·s²Ó©úÅé", CHINESEBIG5_CHARSET ); SET_USE_WINFONTS( TRUE ); - SET_WINFONT( giSubTitleWinFont ); + SET_WINFONT( giSubTitleWinFont ); Color = FROMRGB( 255, 255, 255 ); SetWinFontForeColor( giSubTitleWinFont, &Color ); PrintWinFont( FRAME_BUFFER, giSubTitleWinFont, 10, 100, L"Font %s initialized", gzFontName ); @@ -265,7 +265,7 @@ void ShutdownFonts( ) // ATE: Shutdown any win fonts #ifdef WINFONTS - DeleteWinFont( giSubTitleWinFont ); + DeleteWinFont( giSubTitleWinFont ); #endif } @@ -316,7 +316,7 @@ UINT16 CreateFontPaletteTables(HVOBJECT pObj ) pObj->pShades[ FONT_SHADE_WHITE ]=Create16BPPPaletteShaded( pObj->pPaletteEntry, 255, 255, 255, TRUE); - + // the rest are darkening tables, right down to all-black. pObj->pShades[0]=Create16BPPPaletteShaded( pObj->pPaletteEntry, 165, 165, 165, FALSE); pObj->pShades[7]=Create16BPPPaletteShaded( pObj->pPaletteEntry, 135, 135, 135, FALSE); @@ -334,23 +334,23 @@ UINT16 CreateFontPaletteTables(HVOBJECT pObj ) // check to make sure every table got a palette //for(count=0; (count < HVOBJECT_SHADE_TABLES) && (pObj->pShades[count]!=NULL); count++); - + // return the result of the check //return(count==HVOBJECT_SHADE_TABLES); return(TRUE); } -UINT16 WFGetFontHeight( INT32 FontNum ) +UINT16 WFGetFontHeight( INT32 FontNum ) { if ( USE_WINFONTS( ) ) { // return how many Y pixels we used - return( GetWinFontHeight( L"a\0", GET_WINFONT( ) ) ); + return( GetWinFontHeight( L"a\0", GET_WINFONT( ) ) ); } else { // return how many Y pixels we used - return( GetFontHeight( FontNum ) ); + return( GetFontHeight( FontNum ) ); } } @@ -360,13 +360,14 @@ INT16 WFStringPixLength( STR16 string,INT32 UseFont ) if ( USE_WINFONTS( ) ) { // return how many Y pixels we used - return( WinFontStringPixLength( string, GET_WINFONT( ) ) ); + return( WinFontStringPixLength( string, GET_WINFONT( ) ) ); } else { // return how many Y pixels we used - return( StringPixLength( string, UseFont ) ); + return( StringPixLength( string, UseFont ) ); } } + diff --git a/Utils/Font Control.h b/Utils/Font Control.h index 532a8caf..04fe34c9 100644 --- a/Utils/Font Control.h +++ b/Utils/Font Control.h @@ -4,25 +4,25 @@ #include "builddefines.h" #include "font.h" -extern BOOLEAN gfUseWinFonts; -extern INT32 giCurWinFont; +extern BOOLEAN gfUseWinFonts; +extern INT32 giCurWinFont; // ATE: Use this define to enable winfonts in JA2 -// #define WINFONTS +// #define WINFONTS #ifdef WINFONTS - #define USE_WINFONTS( ) ( gfUseWinFonts ) + #define USE_WINFONTS( ) ( gfUseWinFonts ) #else - #define USE_WINFONTS( ) ( FALSE ) + #define USE_WINFONTS( ) ( FALSE ) #endif -#define GET_WINFONT( ) ( giCurWinFont ) -#define SET_USE_WINFONTS( fSet ) ( gfUseWinFonts = fSet ); -#define SET_WINFONT( fFont ) ( giCurWinFont = fFont ); +#define GET_WINFONT( ) ( giCurWinFont ) +#define SET_USE_WINFONTS( fSet ) ( gfUseWinFonts = fSet ); +#define SET_WINFONT( fFont ) ( giCurWinFont = fFont ); // ATE: A few winfont wrappers.. -UINT16 WFGetFontHeight( INT32 FontNum ); -INT16 WFStringPixLength( STR16 string,INT32 UseFont ); +UINT16 WFGetFontHeight( INT32 FontNum ); +INT16 WFStringPixLength( STR16 string,INT32 UseFont ); @@ -41,14 +41,14 @@ extern HVOBJECT gvoTinyFontType1; extern INT32 gp12PointFont1; extern HVOBJECT gvo12PointFont1; -extern INT32 gpClockFont; -extern HVOBJECT gvoClockFont; +extern INT32 gpClockFont; +extern HVOBJECT gvoClockFont; -extern INT32 gpCompFont; -extern HVOBJECT gvoCompFont; +extern INT32 gpCompFont; +extern HVOBJECT gvoCompFont; -extern INT32 gpSmallCompFont; -extern HVOBJECT gvoSmallCompFont; +extern INT32 gpSmallCompFont; +extern HVOBJECT gvoSmallCompFont; extern INT32 gp10PointRoman; extern HVOBJECT gvo10PointRoman; @@ -97,7 +97,7 @@ extern INT32 gpHugeFont; extern HVOBJECT gvoHugeFont; #endif -extern INT32 giSubTitleWinFont; +extern INT32 giSubTitleWinFont; extern BOOLEAN gfFontsInit; @@ -105,21 +105,21 @@ extern BOOLEAN gfFontsInit; // Defines #define LARGEFONT1 gpLargeFontType1 #define SMALLFONT1 gpSmallFontType1 -#define TINYFONT1 gpTinyFontType1 +#define TINYFONT1 gpTinyFontType1 #define FONT12POINT1 gp12PointFont1 -#define CLOCKFONT gpClockFont -#define COMPFONT gpCompFont -#define SMALLCOMPFONT gpSmallCompFont +#define CLOCKFONT gpClockFont +#define COMPFONT gpCompFont +#define SMALLCOMPFONT gpSmallCompFont #define FONT10ROMAN gp10PointRoman #define FONT12ROMAN gp12PointRoman #define FONT14SANSERIF gp14PointSansSerif #define MILITARYFONT1 BLOCKFONT //gpMilitaryFont1 #define FONT10ARIAL gp10PointArial #define FONT14ARIAL gp14PointArial -#define FONT12ARIAL gp12PointArial -#define FONT10ARIALBOLD gp10PointArialBold -#define BLOCKFONT gpBlockyFont -#define BLOCKFONT2 gpBlockyFont2 +#define FONT12ARIAL gp12PointArial +#define FONT10ARIALBOLD gp10PointArialBold +#define BLOCKFONT gpBlockyFont +#define BLOCKFONT2 gpBlockyFont2 #define FONT12ARIALFIXEDWIDTH gp12PointArialFixedFont #define FONT16ARIAL gp16PointArial #define BLOCKFONTNARROW gpBlockFontNarrow diff --git a/Utils/INIReader.cpp b/Utils/INIReader.cpp index 91f986f4..1c18b999 100644 --- a/Utils/INIReader.cpp +++ b/Utils/INIReader.cpp @@ -7,7 +7,7 @@ // Kaiden: INI reading function definitions: -CIniReader::CIniReader(const STR8 szFileName) +CIniReader::CIniReader(const STR8 szFileName) { // Snap: Look for the INI file in the custom Data directory. // If not there, leave at default location. @@ -20,15 +20,15 @@ CIniReader::CIniReader(const STR8 szFileName) } -int CIniReader::ReadInteger(const STR8 szSection, const STR8 szKey, int iDefaultValue) +int CIniReader::ReadInteger(const STR8 szSection, const STR8 szKey, int iDefaultValue) { - return GetPrivateProfileInt(szSection, szKey, iDefaultValue, m_szFileName); + return GetPrivateProfileInt(szSection, szKey, iDefaultValue, m_szFileName); } -int CIniReader::ReadInteger(const STR8 szSection, const STR8 szKey, int iDefaultValue, int iMinValue, int iMaxValue) +int CIniReader::ReadInteger(const STR8 szSection, const STR8 szKey, int iDefaultValue, int iMinValue, int iMaxValue) { - int i = GetPrivateProfileInt(szSection, szKey, iDefaultValue, m_szFileName); + int i = GetPrivateProfileInt(szSection, szKey, iDefaultValue, m_szFileName); if (i < iMinValue) return iMinValue; else if (i > iMaxValue) @@ -36,39 +36,39 @@ int CIniReader::ReadInteger(const STR8 szSection, const STR8 szKey, int iDefau return i; } - int ReadInteger(const STR8 szSection, const STR8 szKey, int iDefaultValue, int iMinValue, int iMaxValue); + int ReadInteger(const STR8 szSection, const STR8 szKey, int iDefaultValue, int iMinValue, int iMaxValue); -float CIniReader::ReadFloat(const STR8 szSection, const STR8 szKey, float fltDefaultValue) +float CIniReader::ReadFloat(const STR8 szSection, const STR8 szKey, float fltDefaultValue) { char szResult[255]; char szDefault[255]; float fltResult; sprintf(szDefault, "%f",fltDefaultValue); - GetPrivateProfileString(szSection, szKey, szDefault, szResult, 255, m_szFileName); + GetPrivateProfileString(szSection, szKey, szDefault, szResult, 255, m_szFileName); fltResult = (float) atof(szResult); return fltResult; } -bool CIniReader::ReadBoolean(const STR8 szSection, const STR8 szKey, bool bolDefaultValue) +bool CIniReader::ReadBoolean(const STR8 szSection, const STR8 szKey, bool bolDefaultValue) { char szResult[255]; char szDefault[255]; bool bolResult; sprintf(szDefault, "%s", bolDefaultValue? "TRUE" : "FALSE"); - GetPrivateProfileString(szSection, szKey, szDefault, szResult, 255, m_szFileName); - bolResult = (strcmp(szResult, "TRUE") == 0 || strcmp(szResult, "TRUE") == 0) ? true : false; + GetPrivateProfileString(szSection, szKey, szDefault, szResult, 255, m_szFileName); + bolResult = (strcmp(szResult, "TRUE") == 0 || strcmp(szResult, "TRUE") == 0) ? true : false; return bolResult; } -STR8 CIniReader::ReadString(const STR8 szSection, const STR8 szKey, const STR8 szDefaultValue) +STR8 CIniReader::ReadString(const STR8 szSection, const STR8 szKey, const STR8 szDefaultValue) { - STR8 szResult = new char[255]; + STR8 szResult = new char[255]; memset(szResult, 0x00, 255); - GetPrivateProfileString(szSection, szKey, szDefaultValue, szResult, 255, m_szFileName); + GetPrivateProfileString(szSection, szKey, szDefaultValue, szResult, 255, m_szFileName); return szResult; } @@ -77,3 +77,4 @@ STR8 CIniReader::ReadString(const STR8 szSection, const STR8 szKey, const STR + diff --git a/Utils/INIReader.h b/Utils/INIReader.h index 979cd0b3..332e348c 100644 --- a/Utils/INIReader.h +++ b/Utils/INIReader.h @@ -10,14 +10,14 @@ class CIniReader { public: - CIniReader(const STR8 szFileName); - int ReadInteger(const STR8 szSection, const STR8 szKey, int iDefaultValue); - int ReadInteger(const STR8 szSection, const STR8 szKey, int iDefaultValue, int iMinValue, int iMaxValue); - float ReadFloat(const STR8 szSection, const STR8 szKey, float fltDefaultValue); - bool ReadBoolean(const STR8 szSection, const STR8 szKey, bool bolDefaultValue); - STR8 ReadString(const STR8 szSection, const STR8 szKey, const STR8 szDefaultValue); + CIniReader(const STR8 szFileName); + int ReadInteger(const STR8 szSection, const STR8 szKey, int iDefaultValue); + int ReadInteger(const STR8 szSection, const STR8 szKey, int iDefaultValue, int iMinValue, int iMaxValue); + float ReadFloat(const STR8 szSection, const STR8 szKey, float fltDefaultValue); + bool ReadBoolean(const STR8 szSection, const STR8 szKey, bool bolDefaultValue); + STR8 ReadString(const STR8 szSection, const STR8 szKey, const STR8 szDefaultValue); private: - char m_szFileName[MAX_PATH]; + char m_szFileName[MAX_PATH]; }; #endif//INIREADER_H \ No newline at end of file diff --git a/Utils/MapUtility.cpp b/Utils/MapUtility.cpp index 8256ba55..9e57d44b 100644 --- a/Utils/MapUtility.cpp +++ b/Utils/MapUtility.cpp @@ -23,7 +23,7 @@ #ifdef JA2EDITOR -#include "quantize wrap.h" +#include "quantize wrap.h" #define MINIMAP_X_SIZE 88 #define MINIMAP_Y_SIZE 44 @@ -61,7 +61,7 @@ UINT32 MapUtilScreenHandle( ) { static INT16 fNewMap = TRUE; static INT16 sFileNum = 0; - InputAtom InputEvent; + InputAtom InputEvent; GETFILESTRUCT FileInfo; static FDLG_LIST *FListNode; static INT16 sFiles = 0, sCurFile = 0; @@ -85,7 +85,7 @@ UINT32 MapUtilScreenHandle( ) INT32 cnt; INT16 sX1, sX2, sY1, sY2, sTop, sBottom, sLeft, sRight; - + FLOAT dX, dY, dStartX, dStartY; INT32 iX, iY, iSubX1, iSubY1, iSubX2, iSubY2, iWindowX, iWindowY, iCount; @@ -102,7 +102,7 @@ UINT32 MapUtilScreenHandle( ) if ( fNewMap ) { fNewMap = FALSE; - + // Create render buffer GetCurrentVideoSettings( &usWidth, &usHeight, &ubBitDepth ); vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE; @@ -132,7 +132,7 @@ UINT32 MapUtilScreenHandle( ) //Allocate 24 bit Surface p24BitValues = (RGBValues *) MemAlloc( MINIMAP_X_SIZE * MINIMAP_Y_SIZE * sizeof( RGBValues ) ); - p24BitDest = (UINT8*)p24BitValues; + p24BitDest = (UINT8*)p24BitValues; //Allocate 8-bit surface @@ -153,7 +153,7 @@ UINT32 MapUtilScreenHandle( ) //OK, we are here, now loop through files if ( sCurFile == sFiles || FListNode== NULL ) { - gfProgramIsRunning = FALSE; + gfProgramIsRunning = FALSE; return( MAPUTILITY_SCREEN ); } @@ -170,10 +170,10 @@ UINT32 MapUtilScreenHandle( ) gfOverheadMapDirty = TRUE; - RenderOverheadMap( 0, (WORLD_COLS / 2), iOffsetHorizontal, + RenderOverheadMap( 0, (WORLD_COLS / 2), iOffsetHorizontal, iOffsetVertical, 640 + iOffsetHorizontal, 320 + iOffsetVertical, FALSE ); - TrashOverheadMap( ); + TrashOverheadMap( ); // OK, NOW PROCESS OVERHEAD MAP ( SHOUIDL BE ON THE FRAMEBUFFER ) gdXStep = (float)640/(float)88; @@ -185,7 +185,7 @@ UINT32 MapUtilScreenHandle( ) { CalculateRestrictedMapCoords( NORTH, &sX1, &sY1, &sX2, &sTop, iOffsetHorizontal + 640, iOffsetVertical + 320 ); CalculateRestrictedMapCoords( SOUTH, &sX1, &sBottom, &sX2, &sY2, iOffsetHorizontal + 640, iOffsetVertical + 320 ); - CalculateRestrictedMapCoords( WEST, &sX1, &sY1, &sLeft, &sY2, iOffsetHorizontal + 640, iOffsetVertical + 320 ); + CalculateRestrictedMapCoords( WEST, &sX1, &sY1, &sLeft, &sY2, iOffsetHorizontal + 640, iOffsetVertical + 320 ); CalculateRestrictedMapCoords( EAST, &sRight, &sY1, &sX2, &sY2, iOffsetHorizontal + 640, iOffsetVertical + 320 ); gdXStep = (float)( sRight - sLeft )/(float)88; @@ -291,7 +291,7 @@ UINT32 MapUtilScreenHandle( ) UINT16 usLineColor; SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, 640, 480 ); - + for ( cnt = 0; cnt < 256; cnt++ ) { usLineColor = Get16BPPColor( FROMRGB( pPalette[ cnt ].peRed, pPalette[ cnt ].peGreen, pPalette[ cnt ].peBlue ) ); @@ -320,19 +320,19 @@ UINT32 MapUtilScreenHandle( ) SetFont( TINYFONT1 ); SetFontBackground( FONT_MCOLOR_BLACK ); - SetFontForeground( FONT_MCOLOR_DKGRAY ); + SetFontForeground( FONT_MCOLOR_DKGRAY ); mprintf( 10, 340, L"Writing radar image %S", zFilename2 ); mprintf( 10, 350, L"Using tileset %s", gTilesets[ giCurrentTilesetID ].zName ); InvalidateScreen( ); - while (DequeueEvent(&InputEvent) == TRUE) - { - if ((InputEvent.usEvent == KEY_DOWN)&&(InputEvent.usParam == ESC)) - { // Exit the program - gfProgramIsRunning = FALSE; - } + while (DequeueEvent(&InputEvent) == TRUE) + { + if ((InputEvent.usEvent == KEY_DOWN)&&(InputEvent.usParam == ESC)) + { // Exit the program + gfProgramIsRunning = FALSE; + } } // Set next @@ -369,4 +369,4 @@ UINT32 MapUtilScreenShutdown( ) return( TRUE ); } -#endif \ No newline at end of file +#endif diff --git a/Utils/MercTextBox.cpp b/Utils/MercTextBox.cpp index a8c6d640..49ea790b 100644 --- a/Utils/MercTextBox.cpp +++ b/Utils/MercTextBox.cpp @@ -57,11 +57,11 @@ STR8 zMercBorderPopupFilenames[ ] = { // filenames for background popup .pcx's STR8 zMercBackgroundPopupFilenames[ ] = { - "INTERFACE\\TactPopupBackground.pcx", - "INTERFACE\\TactPopupWhiteBackground.pcx", - "INTERFACE\\TactPopupGreyBackground.pcx", - "INTERFACE\\TactPopupBackgroundMain.pcx", - "INTERFACE\\LaptopPopupBackground.pcx", + "INTERFACE\\TactPopupBackground.pcx", + "INTERFACE\\TactPopupWhiteBackground.pcx", + "INTERFACE\\TactPopupGreyBackground.pcx", + "INTERFACE\\TactPopupBackgroundMain.pcx", + "INTERFACE\\LaptopPopupBackground.pcx", "INTERFACE\\imp_popup_background.pcx", }; @@ -98,7 +98,7 @@ BOOLEAN SetCurrentPopUpBox( UINT32 uiId ) // see if box inited if( gpPopUpBoxList[ uiId ] != NULL ) - { + { gPopUpTextBox = gpPopUpBoxList[ uiId ]; return( TRUE ); } @@ -127,7 +127,7 @@ BOOLEAN ResetOverrideMercPopupBox( ) BOOLEAN InitMercPopupBox( ) { INT32 iCounter = 0; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; // init the pop up box list for( iCounter = 0; iCounter < MAX_NUMBER_OF_POPUP_BOXES; iCounter++ ) @@ -174,17 +174,17 @@ void GetMercPopupBoxFontColor( UINT8 ubBackgroundIndex, UINT8 *pubFontColor, UIN BOOLEAN LoadTextMercPopupImages( UINT8 ubBackgroundIndex, UINT8 ubBorderIndex) { VSURFACE_DESC vs_desc; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; + + // this function will load the graphics associated with the background and border index values - // this function will load the graphics associated with the background and border index values - // the background - vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; - strcpy(vs_desc.ImageFile, zMercBackgroundPopupFilenames [ ubBackgroundIndex ]); + vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; + strcpy(vs_desc.ImageFile, zMercBackgroundPopupFilenames [ ubBackgroundIndex ]); CHECKF(AddVideoSurface(&vs_desc, &gPopUpTextBox->uiMercTextPopUpBackground)); - - // border - VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + + // border + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; FilenameForBPP( zMercBorderPopupFilenames[ ubBorderIndex ], VObjectDesc.ImageFile ); CHECKF( AddVideoObject( &VObjectDesc, &gPopUpTextBox->uiMercTextPopUpBorder ) ); @@ -206,7 +206,7 @@ void RemoveTextMercPopupImages( ) { // the background DeleteVideoSurfaceFromIndex( gPopUpTextBox->uiMercTextPopUpBackground ); - + // the border DeleteVideoObjectFromIndex( gPopUpTextBox->uiMercTextPopUpBorder ); @@ -228,28 +228,28 @@ BOOLEAN RenderMercPopUpBoxFromIndex( INT32 iBoxId, INT16 sDestX, INT16 sDestY, U } // now attempt to render the box - return( RenderMercPopupBox( sDestX, sDestY, uiBuffer ) ); + return( RenderMercPopupBox( sDestX, sDestY, uiBuffer ) ); } BOOLEAN RenderMercPopupBox(INT16 sDestX, INT16 sDestY, UINT32 uiBuffer ) { -// UINT32 uiDestPitchBYTES; -// UINT32 uiSrcPitchBYTES; -// UINT16 *pDestBuf; -// UINT16 *pSrcBuf; +// UINT32 uiDestPitchBYTES; +// UINT32 uiSrcPitchBYTES; +// UINT16 *pDestBuf; +// UINT16 *pSrcBuf; // will render/transfer the image from the buffer in the data structure to the buffer specified by user BOOLEAN fReturnValue = TRUE; - + // grab the destination buffer // pDestBuf = ( UINT16* )LockVideoSurface( uiBuffer, &uiDestPitchBYTES ); - + // now lock it // pSrcBuf = ( UINT16* )LockVideoSurface( gPopUpTextBox->uiSourceBufferIndex, &uiSrcPitchBYTES); - //check to see if we are wanting to blit a transparent background + //check to see if we are wanting to blit a transparent background if ( gPopUpTextBox->uiFlags & MERC_POPUP_PREPARE_FLAGS_TRANS_BACK ) BltVideoSurface( uiBuffer, gPopUpTextBox->uiSourceBufferIndex, 0, sDestX, sDestY, VS_BLT_FAST | VS_BLT_USECOLORKEY, NULL ); else @@ -257,8 +257,8 @@ BOOLEAN RenderMercPopupBox(INT16 sDestX, INT16 sDestY, UINT32 uiBuffer ) // blt, and grab return value -// fReturnValue = Blt16BPPTo16BPP(pDestBuf, uiDestPitchBYTES, pSrcBuf, uiSrcPitchBYTES, sDestX, sDestY, 0, 0, gPopUpTextBox->sWidth, gPopUpTextBox->sHeight); - +// fReturnValue = Blt16BPPTo16BPP(pDestBuf, uiDestPitchBYTES, pSrcBuf, uiSrcPitchBYTES, sDestX, sDestY, 0, 0, gPopUpTextBox->sWidth, gPopUpTextBox->sHeight); + //Invalidate! if ( uiBuffer == FRAME_BUFFER ) { @@ -269,12 +269,12 @@ BOOLEAN RenderMercPopupBox(INT16 sDestX, INT16 sDestY, UINT32 uiBuffer ) // source // UnLockVideoSurface( gPopUpTextBox->uiSourceBufferIndex ); - + // destination // UnLockVideoSurface( uiBuffer ); - + // return success or failure - return fReturnValue; + return fReturnValue; } @@ -296,7 +296,7 @@ INT32 AddPopUpBoxToList( MercPopUpBox *pPopUpTextBox ) { // found a spot, inset gpPopUpBoxList[ iCounter ] = pPopUpTextBox; - + // set as current SetCurrentPopUpBox( iCounter ); @@ -315,23 +315,23 @@ MercPopUpBox * GetPopUpBoxIndex( INT32 iId ) return( gpPopUpBoxList[ iId ] ); } -INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorderIndex, STR16 pString, - UINT16 usWidth, UINT16 usMarginX, UINT16 usMarginTopY, UINT16 usMarginBottomY, +INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorderIndex, STR16 pString, + UINT16 usWidth, UINT16 usMarginX, UINT16 usMarginTopY, UINT16 usMarginBottomY, UINT16 *pActualWidth, UINT16 *pActualHeight) { UINT16 usNumberVerticalPixels, usNumberOfLines; UINT16 usTextWidth, usHeight; UINT16 i; - HVOBJECT hImageHandle; + HVOBJECT hImageHandle; UINT16 usPosY, usPosX; VSURFACE_DESC vs_desc; UINT16 usStringPixLength; SGPRect DestRect; - HVSURFACE hSrcVSurface; - UINT32 uiDestPitchBYTES; + HVSURFACE hSrcVSurface; + UINT32 uiDestPitchBYTES; UINT32 uiSrcPitchBYTES; - UINT16 *pDestBuf; - UINT8 *pSrcBuf; + UINT16 *pDestBuf; + UINT8 *pSrcBuf; UINT8 ubFontColor, ubFontShadowColor; UINT16 usColorVal; UINT16 usLoopEnd; @@ -348,7 +348,7 @@ INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorde if( iBoxId == -1 ) { // no box yet - + // create box pPopUpTextBox = (MercPopUpBox *) MemAlloc( sizeof( MercPopUpBox ) ); @@ -365,7 +365,7 @@ INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorde } else { - // has been created already, + // has been created already, // Check if these images are different // grab box @@ -373,7 +373,7 @@ INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorde // box has valid id and no instance?..error Assert( pPopUpTextBox ); - + // copy over ptr gPopUpTextBox = pPopUpTextBox; @@ -397,14 +397,14 @@ INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorde if( usStringPixLength < ( usWidth - ( MERC_TEXT_POPUP_WINDOW_TEXT_OFFSET_X ) * 2 ) ) { usWidth = usStringPixLength + MERC_TEXT_POPUP_WINDOW_TEXT_OFFSET_X * 2; - usTextWidth = usWidth - ( MERC_TEXT_POPUP_WINDOW_TEXT_OFFSET_X ) * 2 + 1; + usTextWidth = usWidth - ( MERC_TEXT_POPUP_WINDOW_TEXT_OFFSET_X ) * 2 + 1; } else { - usTextWidth = usWidth - ( MERC_TEXT_POPUP_WINDOW_TEXT_OFFSET_X ) * 2 + 1 - usMarginX; + usTextWidth = usWidth - ( MERC_TEXT_POPUP_WINDOW_TEXT_OFFSET_X ) * 2 + 1 - usMarginX; } - usNumberVerticalPixels = IanWrappedStringHeight(0,0, usTextWidth, 2, TEXT_POPUP_FONT, MERC_TEXT_COLOR, pString, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNumberVerticalPixels = IanWrappedStringHeight(0,0, usTextWidth, 2, TEXT_POPUP_FONT, MERC_TEXT_COLOR, pString, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNumberOfLines = usNumberVerticalPixels / TEXT_POPUP_GAP_BN_LINES; @@ -464,12 +464,12 @@ INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorde { // Zero with yellow, // Set source transparcenty - SetVideoSurfaceTransparency( pPopUpTextBox->uiSourceBufferIndex, FROMRGB( 255, 255, 0 ) ); + SetVideoSurfaceTransparency( pPopUpTextBox->uiSourceBufferIndex, FROMRGB( 255, 255, 0 ) ); - pDestBuf = (UINT16*)LockVideoSurface( pPopUpTextBox->uiSourceBufferIndex, &uiDestPitchBYTES); + pDestBuf = (UINT16*)LockVideoSurface( pPopUpTextBox->uiSourceBufferIndex, &uiDestPitchBYTES); usColorVal = Get16BPPColor( FROMRGB( 255, 255, 0 ) ); - usLoopEnd = ( usWidth * usHeight ); + usLoopEnd = ( usWidth * usHeight ); for ( i = 0; i uiMercTextPopUpBackground) ) { - AssertMsg( 0, String( "Failed to GetVideoSurface for PrepareMercPopupBox. VSurfaceID: %d", + AssertMsg( 0, String( "Failed to GetVideoSurface for PrepareMercPopupBox. VSurfaceID: %d", pPopUpTextBox->uiMercTextPopUpBackground ) ); } pDestBuf = (UINT16*)LockVideoSurface( pPopUpTextBox->uiSourceBufferIndex, &uiDestPitchBYTES); pSrcBuf = LockVideoSurface( pPopUpTextBox->uiMercTextPopUpBackground, &uiSrcPitchBYTES); - Blt8BPPDataSubTo16BPPBuffer( pDestBuf, uiDestPitchBYTES, hSrcVSurface, pSrcBuf,uiSrcPitchBYTES,0,0, &DestRect); + Blt8BPPDataSubTo16BPPBuffer( pDestBuf, uiDestPitchBYTES, hSrcVSurface, pSrcBuf,uiSrcPitchBYTES,0,0, &DestRect); UnLockVideoSurface( pPopUpTextBox->uiMercTextPopUpBackground); UnLockVideoSurface(pPopUpTextBox->uiSourceBufferIndex); @@ -503,17 +503,17 @@ INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorde for(i=TEXT_POPUP_GAP_BN_LINES; i< usWidth-TEXT_POPUP_GAP_BN_LINES; i+=TEXT_POPUP_GAP_BN_LINES) { //TOP ROW - BltVideoObject(pPopUpTextBox->uiSourceBufferIndex, hImageHandle, 1,i, usPosY, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(pPopUpTextBox->uiSourceBufferIndex, hImageHandle, 1,i, usPosY, VO_BLT_SRCTRANSPARENCY,NULL); //BOTTOM ROW - BltVideoObject(pPopUpTextBox->uiSourceBufferIndex, hImageHandle, 6,i, usHeight - TEXT_POPUP_GAP_BN_LINES+6, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(pPopUpTextBox->uiSourceBufferIndex, hImageHandle, 6,i, usHeight - TEXT_POPUP_GAP_BN_LINES+6, VO_BLT_SRCTRANSPARENCY,NULL); } //blit the left and right row of images usPosX = 0; for(i=TEXT_POPUP_GAP_BN_LINES; i< usHeight-TEXT_POPUP_GAP_BN_LINES; i+=TEXT_POPUP_GAP_BN_LINES) { - BltVideoObject(pPopUpTextBox->uiSourceBufferIndex, hImageHandle, 3,usPosX, i, VO_BLT_SRCTRANSPARENCY,NULL); - BltVideoObject(pPopUpTextBox->uiSourceBufferIndex, hImageHandle, 4,usPosX+usWidth-4, i, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(pPopUpTextBox->uiSourceBufferIndex, hImageHandle, 3,usPosX, i, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(pPopUpTextBox->uiSourceBufferIndex, hImageHandle, 4,usPosX+usWidth-4, i, VO_BLT_SRCTRANSPARENCY,NULL); } //blt the corner images for the row @@ -547,7 +547,7 @@ INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorde if ( pPopUpTextBox->uiFlags & ( MERC_POPUP_PREPARE_FLAGS_STOPICON | MERC_POPUP_PREPARE_FLAGS_SKULLICON ) ) { - sDispTextXPos += 30; + sDispTextXPos += 30; } @@ -561,7 +561,7 @@ INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorde } //Display the text - DisplayWrappedString( sDispTextXPos, (INT16)(( MERC_TEXT_POPUP_WINDOW_TEXT_OFFSET_Y + usMarginTopY ) ), usTextWidth, 2, MERC_TEXT_FONT, ubFontColor, pString, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DisplayWrappedString( sDispTextXPos, (INT16)(( MERC_TEXT_POPUP_WINDOW_TEXT_OFFSET_Y + usMarginTopY ) ), usTextWidth, 2, MERC_TEXT_FONT, ubFontColor, pString, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); //Disable the use of single word wordwrap UseSingleCharWordsForWordWrap( FALSE ); @@ -569,7 +569,7 @@ INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorde #else { //Display the text - DisplayWrappedString( sDispTextXPos, (INT16)(( MERC_TEXT_POPUP_WINDOW_TEXT_OFFSET_Y + usMarginTopY ) ), usTextWidth, 2, MERC_TEXT_FONT, ubFontColor, pString, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DisplayWrappedString( sDispTextXPos, (INT16)(( MERC_TEXT_POPUP_WINDOW_TEXT_OFFSET_Y + usMarginTopY ) ), usTextWidth, 2, MERC_TEXT_FONT, ubFontColor, pString, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); } #endif @@ -613,8 +613,8 @@ BOOLEAN RemoveMercPopupBox() { if( gpPopUpBoxList[ iCounter ] == gPopUpTextBox ) { - gpPopUpBoxList[ iCounter ] = NULL; - iCounter = MAX_NUMBER_OF_POPUP_BOXES; + gpPopUpBoxList[ iCounter ] = NULL; + iCounter = MAX_NUMBER_OF_POPUP_BOXES; } } // yep, get rid of the bloody... diff --git a/Utils/MercTextBox.h b/Utils/MercTextBox.h index c751d5d0..fdd9a025 100644 --- a/Utils/MercTextBox.h +++ b/Utils/MercTextBox.h @@ -13,7 +13,7 @@ BOOLEAN InitMercPopupBox( ); // create a pop up box if needed, return id of box..a -1 means couldn't be added -INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorderIndex, STR16 pString, UINT16 usWidth, UINT16 usMarginX, UINT16 usMarginTopY, UINT16 usMarginBottomY, UINT16 *pActualWidth, UINT16 *pActualHeight); +INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorderIndex, STR16 pString, UINT16 usWidth, UINT16 usMarginX, UINT16 usMarginTopY, UINT16 usMarginBottomY, UINT16 *pActualWidth, UINT16 *pActualHeight); // remove the current box @@ -64,10 +64,10 @@ enum{ // border enumeration enum{ - BASIC_MERC_POPUP_BORDER =0, - RED_MERC_POPUP_BORDER, - BLUE_MERC_POPUP_BORDER, - DIALOG_MERC_POPUP_BORDER, + BASIC_MERC_POPUP_BORDER =0, + RED_MERC_POPUP_BORDER, + BLUE_MERC_POPUP_BORDER, + DIALOG_MERC_POPUP_BORDER, LAPTOP_POP_BORDER }; diff --git a/Utils/Multi Language Graphic Utils.cpp b/Utils/Multi Language Graphic Utils.cpp index 0e9048a0..abb2aa4f 100644 --- a/Utils/Multi Language Graphic Utils.cpp +++ b/Utils/Multi Language Graphic Utils.cpp @@ -241,25 +241,25 @@ BOOLEAN GetMLGFilename( SGPFILENAME filename, UINT16 usMLGGraphicID ) // "GERMAN\\IMPSymbol_German.sti" #if defined( DUTCH ) - sprintf( zLanguage, "DUTCH" ); + sprintf( (char *)zLanguage, "DUTCH" ); #elif defined( FRENCH ) - sprintf( zLanguage, "FRENCH" ); + sprintf( (char *)zLanguage, "FRENCH" ); #elif defined( GERMAN ) - sprintf( zLanguage, "GERMAN" ); + sprintf( (char *)zLanguage, "GERMAN" ); #elif defined( ITALIAN ) - sprintf( zLanguage, "ITALIAN" ); + sprintf( (char *)zLanguage, "ITALIAN" ); #elif defined( JAPANESE ) - sprintf( zLanguage, "JAPANESE" ); + sprintf( (char *)zLanguage, "JAPANESE" ); #elif defined( KOREAN ) - sprintf( zLanguage, "KOREAN" ); + sprintf( (char *)zLanguage, "KOREAN" ); #elif defined( POLISH ) - sprintf( zLanguage, "POLISH" ); + sprintf( (char *)zLanguage, "POLISH" ); #elif defined( RUSSIAN ) sprintf( (char *)zLanguage, "RUSSIAN" ); #elif defined( SPANISH ) - sprintf( zLanguage, "SPANISH" ); + sprintf( (char *)zLanguage, "SPANISH" ); #elif defined( TAIWANESE ) - sprintf( zLanguage, "TAIWANESE" ); + sprintf( (char *)zLanguage, "TAIWANESE" ); #endif //SB: Also check for russian Gold version, like English diff --git a/Utils/Multilingual Text Code Generator.cpp b/Utils/Multilingual Text Code Generator.cpp index 0f13762c..256f9280 100644 --- a/Utils/Multilingual Text Code Generator.cpp +++ b/Utils/Multilingual Text Code Generator.cpp @@ -1,11 +1,11 @@ /* -MULTILINGUAL TEXT CODE GENERATOR -This code generator is used to conveniently compare the english master text file with another foreign language -such as German and verify that the appropriate language file is in perfect synch with the English. Verifying -that all of the strings have the correct order of printf format specifiers and the precise number. If -different, the errors are recorded via comments proceeding the string in question in the new file. For -simplicity, the German language will be used in examples throughout this documention. The comments will be -specially marked with "CONFLICT#xxx: error message" which can be searched for. The comment will report +MULTILINGUAL TEXT CODE GENERATOR +This code generator is used to conveniently compare the english master text file with another foreign language +such as German and verify that the appropriate language file is in perfect synch with the English. Verifying +that all of the strings have the correct order of printf format specifiers and the precise number. If +different, the errors are recorded via comments proceeding the string in question in the new file. For +simplicity, the German language will be used in examples throughout this documention. The comments will be +specially marked with "CONFLICT#xxx: error message" which can be searched for. The comment will report the format specifiers used in the english version. ASSUMPTIONS @@ -13,17 +13,17 @@ ASSUMPTIONS - Users don't use single strings using: STR16 str[] = L"Single String"; Instead use: - STR16 str[] = + STR16 str[] = { L"Single String"; } -- Users don't use comments containing the { character later followed by the L" token. The code generator - will mistaken that for a string. +- Users don't use comments containing the { character later followed by the L" token. The code generator + will mistaken that for a string. - Users don't use nested braces (2D text arrays) - -AUTHOR: Kris Morness + +AUTHOR: Kris Morness CREATED: Feb 16, 1999 */ @@ -37,8 +37,8 @@ CREATED: Feb 16, 1999 #include "Fileman.h" //Currently in JA2's _EnglishText, these tokens make up all of the -//format specifiers that are actually used. Feel free to add more, -//but make sure you change NUM_TOKENS accordingly. These tokens assume +//format specifiers that are actually used. Feel free to add more, +//but make sure you change NUM_TOKENS accordingly. These tokens assume //the previous character is a % character. UINT8 SupportedTokens[] = { @@ -53,11 +53,11 @@ UINT8 SupportedTokens[] = enum { //look for { character followed by L" before } to upgrade to INSIDE_STRING - OUTSIDE_STRING_ARRAY, + OUTSIDE_STRING_ARRAY, //look for } character to downgrade to OUTSIDE_STRING_ARRAY //look for L" characters to upgrade to INSIDE_STRING - INSIDE_STRING_ARRAY, + INSIDE_STRING_ARRAY, //look for " character to downgrade to INSIDE_STRING_ARRAY INSIDE_STRING, @@ -67,7 +67,7 @@ enum #define LCG_WORKINGDIRECTORY "build\\utils" #define LCG_ENGLISHMASTERFILE "_EnglishText.c" -//The commandline argument (add different one for each language supported +//The commandline argument (add different one for each language supported //***Only one can exist at a time and it is controlled by Language Defines.h ) #define LCG_COMMANDLINEARGUMENT "-GERMAN" #define LCG_FOREIGNMASTERFILE "_GermanText.c" @@ -77,7 +77,7 @@ enum UINT32 CountDoubleByteStringsInFile( STR8 filename ); -//One function does it all. First looks for the cmd line arg, and if it matches +//One function does it all. First looks for the cmd line arg, and if it matches //the above define, searches for the files, and processes them automatically. BOOLEAN ProcessIfMultilingualCmdLineArgDetected( STR8 str ) { @@ -99,7 +99,7 @@ BOOLEAN ProcessIfMultilingualCmdLineArgDetected( STR8 str ) //Build the working directory name sprintf( Dir, "%s\\%s", ExecDir, LCG_WORKINGDIRECTORY ); - + //Set the working directory if( !SetFileManCurrentDirectory( Dir ) ) { //We failed meaning the directory name is incorrect or non-existant @@ -119,24 +119,24 @@ BOOLEAN ProcessIfMultilingualCmdLineArgDetected( STR8 str ) return FALSE; } - //ALL PRELIMINARY CHECKS HAVE SUCCEEDED. + //ALL PRELIMINARY CHECKS HAVE SUCCEEDED. //Begin file preparation checks... - //STEP1: Read the English master file and count the number of DB strings that exist + //STEP1: Read the English master file and count the number of DB strings that exist uiEnglishStrings = CountDoubleByteStringsInFile( LCG_ENGLISHMASTERFILE ); - //STEP2: Read the Foreigh master file and count the number of DB strings that exist + //STEP2: Read the Foreigh master file and count the number of DB strings that exist uiForeignStrings = CountDoubleByteStringsInFile( LCG_FOREIGNMASTERFILE ); //Make sure they match, otherwise, we can't continue. if( uiEnglishStrings != uiForeignStrings ) { - AssertMsg( 0, String( "Mismatch during LCG preparation: English DB strings: %d, Foreign DB strings: %d", + AssertMsg( 0, String( "Mismatch during LCG preparation: English DB strings: %d, Foreign DB strings: %d", uiEnglishStrings, uiForeignStrings ) ); return FALSE; } - //Mission complete! Reset the previously known directory, and return TRUE; + //Mission complete! Reset the previously known directory, and return TRUE; SetFileManCurrentDirectory( CurrDir ); return TRUE; } diff --git a/Utils/Music Control.cpp b/Utils/Music Control.cpp index 80060bf3..5727f929 100644 --- a/Utils/Music Control.cpp +++ b/Utils/Music Control.cpp @@ -36,7 +36,7 @@ INT8 bBattleModeSong; INT8 gbFadeSpeed = 1; -CHAR8 *szMusicList[NUM_MUSIC]= +CHAR8 *szMusicList[NUM_MUSIC]= { "MUSIC\\marimbad 2.wav", "MUSIC\\menumix1.wav", @@ -56,7 +56,7 @@ CHAR8 *szMusicList[NUM_MUSIC]= }; BOOLEAN gfForceMusicToTense = FALSE; -BOOLEAN gfDontRestartSong = FALSE; +BOOLEAN gfDontRestartSong = FALSE; BOOLEAN StartMusicBasedOnMode( ); void DoneFadeOutDueToEndMusic( void ); @@ -65,25 +65,25 @@ extern void HandleEndDemoInCreatureLevel( ); BOOLEAN NoEnemiesInSight( ) { - SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pSoldier; INT32 cnt; // Loop through our guys // End the turn of player charactors cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - // look for all mercs on the same team, - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++ ) - { - if ( pSoldier->bActive && pSoldier->bLife >= OKLIFE ) + // look for all mercs on the same team, + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++ ) + { + if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE ) { - if ( pSoldier->bOppCnt != 0 ) + if ( pSoldier->aiData.bOppCnt != 0 ) { - return( FALSE ); + return( FALSE ); } } } - + return( TRUE ); } @@ -100,18 +100,18 @@ void MusicStopCallback( void *pData ); BOOLEAN MusicPlay(UINT32 uiNum) { // WANNE: We want music in windowed mode - //if( 1==iScreenMode ) /* on Windowed mode, skip the music? was coded for WINDOWED_MODE that way...*/ - // return FALSE; + //if( 1==iScreenMode ) /* on Windowed mode, skip the music? was coded for WINDOWED_MODE that way...*/ + //return FALSE; - SOUNDPARMS spParms; + SOUNDPARMS spParms; if(fMusicPlaying) MusicStop(); - + memset(&spParms, 0xff, sizeof(SOUNDPARMS)); spParms.uiPriority=PRIORITY_MAX; spParms.uiVolume=0; - spParms.uiLoop=1; // Lesh: only 1 line added + spParms.uiLoop=1; // Lesh: only 1 line added spParms.EOSCallback = MusicStopCallback; @@ -121,7 +121,7 @@ BOOLEAN MusicPlay(UINT32 uiNum) if(uiMusicHandle!=SOUND_ERROR) { - //DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Music PLay %d %d", uiMusicHandle, gubMusicMode ) ); + //DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Music PLay %d %d", uiMusicHandle, gubMusicMode ) ); gfMusicEnded = FALSE; fMusicPlaying=TRUE; @@ -129,7 +129,7 @@ BOOLEAN MusicPlay(UINT32 uiNum) return(TRUE); } - //DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Music PLay %d %d", uiMusicHandle, gubMusicMode ) ); + //DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Music PLay %d %d", uiMusicHandle, gubMusicMode ) ); return(FALSE); } @@ -143,36 +143,36 @@ BOOLEAN MusicPlay(UINT32 uiNum) //******************************************************************************** BOOLEAN MusicSetVolume(UINT32 uiVolume) { - INT32 uiOldMusicVolume = uiMusicVolume; + INT32 uiOldMusicVolume = uiMusicVolume; - // WANNE: We want music in windowed mode - //if( 1==iScreenMode ) /* on Windowed mode, skip the music? was coded for WINDOWED_MODE that way...*/ - // return FALSE; + // WANNE: We want music in windowed mode + //if( 1==iScreenMode ) /* on Windowed mode, skip the music? was coded for WINDOWED_MODE that way...*/ + //return FALSE; - - uiMusicVolume=__min(uiVolume, 127); + + uiMusicVolume=__min(uiVolume, 127); if(uiMusicHandle!=NO_SAMPLE) { - // get volume and if 0 stop music! - if ( uiMusicVolume == 0 ) - { - gfDontRestartSong = TRUE; - MusicStop( ); - return( TRUE ); - } + // get volume and if 0 stop music! + if ( uiMusicVolume == 0 ) + { + gfDontRestartSong = TRUE; + MusicStop( ); + return( TRUE ); + } SoundSetVolume(uiMusicHandle, uiMusicVolume); return(TRUE); } - - // If here, check if we need to re-start music - // Have we re-started? - if ( uiMusicVolume > 0 && uiOldMusicVolume == 0 ) - { - StartMusicBasedOnMode( ); - } + + // If here, check if we need to re-start music + // Have we re-started? + if ( uiMusicVolume > 0 && uiOldMusicVolume == 0 ) + { + StartMusicBasedOnMode( ); + } return(FALSE); } @@ -201,8 +201,8 @@ UINT32 MusicGetVolume(void) BOOLEAN MusicStop(void) { // WANNE: We want music in windowed mode - //if( 1==iScreenMode ) /* on Windowed mode, skip the music? was coded for WINDOWED_MODE that way...*/ - // return(FALSE); + //if( 1==iScreenMode ) /* on Windowed mode, skip the music? was coded for WINDOWED_MODE that way...*/ + // return(FALSE); if(uiMusicHandle!=NO_SAMPLE) @@ -269,8 +269,8 @@ BOOLEAN MusicPoll( BOOLEAN fForce ) //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"MusicPoll"); // WANNE: We want music in windowed mode - //if( 1==iScreenMode ) /* on Windowed mode, skip the music? was coded for WINDOWED_MODE that way...*/ - //return(TRUE); + //if( 1==iScreenMode ) /* on Windowed mode, skip the music? was coded for WINDOWED_MODE that way...*/ + // return(TRUE); INT32 iVol; @@ -281,7 +281,7 @@ BOOLEAN MusicPoll( BOOLEAN fForce ) //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"MusicPoll: Handle Sound every sound overhead time"); // Handle Sound every sound overhead time.... - if ( COUNTERDONE( MUSICOVERHEAD ) ) + if ( COUNTERDONE( MUSICOVERHEAD ) ) { //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"MusicPoll: Reset counter"); // Reset counter @@ -343,17 +343,17 @@ BOOLEAN MusicPoll( BOOLEAN fForce ) SetMusicMode( MUSIC_TACTICAL_NOTHING ); } } - else + else { if ( !gfDontRestartSong ) { //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"MusicPoll: don't restart song, StartMusicBasedOnMode"); StartMusicBasedOnMode( ); - } + } } gfMusicEnded = FALSE; - gfDontRestartSong = FALSE; + gfDontRestartSong = FALSE; } } @@ -370,10 +370,10 @@ BOOLEAN SetMusicMode( UINT8 ubMusicMode ) // OK, check if we want to restore if ( ubMusicMode == MUSIC_RESTORE ) { - if ( bPreviousMode == MUSIC_TACTICAL_VICTORY || bPreviousMode == MUSIC_TACTICAL_DEATH ) - { - bPreviousMode = MUSIC_TACTICAL_NOTHING; - } + if ( bPreviousMode == MUSIC_TACTICAL_VICTORY || bPreviousMode == MUSIC_TACTICAL_DEATH ) + { + bPreviousMode = MUSIC_TACTICAL_NOTHING; + } ubMusicMode = bPreviousMode; } @@ -382,19 +382,19 @@ BOOLEAN SetMusicMode( UINT8 ubMusicMode ) // Save previous mode... bPreviousMode = gubOldMusicMode; } - + // if different, start a new music song if ( gubOldMusicMode != ubMusicMode ) { // Set mode.... gubMusicMode = ubMusicMode; - //DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Music New Mode %d %d", uiMusicHandle, gubMusicMode ) ); + //DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Music New Mode %d %d", uiMusicHandle, gubMusicMode ) ); gbVictorySongCount = 0; gbDeathSongCount = 0; - if(uiMusicHandle!=NO_SAMPLE ) + if(uiMusicHandle!=NO_SAMPLE ) { // Fade out old music MusicFadeOut( ); @@ -435,7 +435,7 @@ BOOLEAN StartMusicBasedOnMode( ) switch( gubMusicMode ) { case MUSIC_MAIN_MENU: - // ATE: Don't fade in + // ATE: Don't fade in gbFadeSpeed = (INT8)uiMusicVolume; MusicPlay( MENUMIX_MUSIC ); break; @@ -446,7 +446,7 @@ BOOLEAN StartMusicBasedOnMode( ) break; case MUSIC_TACTICAL_NOTHING: - // ATE: Don't fade in + // ATE: Don't fade in gbFadeSpeed = (INT8)uiMusicVolume; if( gfUseCreatureMusic ) { @@ -474,7 +474,7 @@ BOOLEAN StartMusicBasedOnMode( ) break; case MUSIC_TACTICAL_BATTLE: - // ATE: Don't fade in + // ATE: Don't fade in gbFadeSpeed = (INT8)uiMusicVolume; if( gfUseCreatureMusic ) { @@ -519,9 +519,9 @@ BOOLEAN StartMusicBasedOnMode( ) void MusicStopCallback( void *pData ) { - //DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Music EndCallback %d %d", uiMusicHandle, gubMusicMode ) ); + //DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Music EndCallback %d %d", uiMusicHandle, gubMusicMode ) ); - gfMusicEnded = TRUE; + gfMusicEnded = TRUE; uiMusicHandle = NO_SAMPLE; //DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Music EndCallback completed" ); @@ -555,3 +555,4 @@ void DoneFadeOutDueToEndMusic( void ) //SetPendingNewScreen( MAINMENU_SCREEN ); } + diff --git a/Utils/PopUpBox.cpp b/Utils/PopUpBox.cpp index ff9b0c25..bc9ee3e7 100644 --- a/Utils/PopUpBox.cpp +++ b/Utils/PopUpBox.cpp @@ -6,14 +6,14 @@ #endif -#define BORDER_WIDTH 16 -#define BORDER_HEIGHT 8 -#define TOP_LEFT_CORNER 0 -#define TOP_EDGE 4 -#define TOP_RIGHT_CORNER 1 -#define SIDE_EDGE 5 -#define BOTTOM_LEFT_CORNER 2 -#define BOTTOM_EDGE 4 +#define BORDER_WIDTH 16 +#define BORDER_HEIGHT 8 +#define TOP_LEFT_CORNER 0 +#define TOP_EDGE 4 +#define TOP_RIGHT_CORNER 1 +#define SIDE_EDGE 5 +#define BOTTOM_LEFT_CORNER 2 +#define BOTTOM_EDGE 4 #define BOTTOM_RIGHT_CORNER 3 @@ -74,7 +74,7 @@ void SpecifyBoxMinWidth( INT32 hBoxHandle, INT32 iMinWidth ) Assert( PopUpBoxList[ hBoxHandle ] ); PopUpBoxList[hBoxHandle]->uiBoxMinWidth = iMinWidth; - + // check if the box is currently too small if( PopUpBoxList[hBoxHandle]->Dimensions.iRight < iMinWidth ) { @@ -105,7 +105,7 @@ BOOLEAN CreatePopUpBox(INT32 *phBoxHandle, SGPRect Dimensions, SGPPoint Position iCount=iCounter; *phBoxHandle=iCount; - pBox= (PopUpBoxPt) MemAlloc(sizeof(PopUpBo)); + pBox= (PopUpBoxPt) MemAlloc(sizeof(PopUpBo)); if (pBox == NULL) { return FALSE; @@ -119,8 +119,8 @@ BOOLEAN CreatePopUpBox(INT32 *phBoxHandle, SGPRect Dimensions, SGPPoint Position for(iCounter=0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++) { - PopUpBoxList[iCount]->Text[iCounter]=NULL; - PopUpBoxList[iCount]->pSecondColumnString[iCounter]=NULL; + PopUpBoxList[iCount]->Text[iCounter]=NULL; + PopUpBoxList[iCount]->pSecondColumnString[iCounter]=NULL; } SetCurrentBox(iCount); @@ -130,7 +130,7 @@ BOOLEAN CreatePopUpBox(INT32 *phBoxHandle, SGPRect Dimensions, SGPPoint Position PopUpBoxList[iCount]->fUpdated = FALSE; - return TRUE; + return TRUE; } @@ -141,8 +141,8 @@ void SetBoxFlags( INT32 hBoxHandle, UINT32 uiFlags) Assert( PopUpBoxList[ hBoxHandle ] ); - PopUpBoxList[hBoxHandle]->uiFlags=uiFlags; - PopUpBoxList[hBoxHandle]->fUpdated = FALSE; + PopUpBoxList[hBoxHandle]->uiFlags=uiFlags; + PopUpBoxList[hBoxHandle]->fUpdated = FALSE; return; } @@ -155,12 +155,12 @@ void SetMargins(INT32 hBoxHandle, UINT32 uiLeft, UINT32 uiTop, UINT32 uiBottom, Assert( PopUpBoxList[ hBoxHandle ] ); - PopUpBoxList[hBoxHandle]->uiLeftMargin=uiLeft; - PopUpBoxList[hBoxHandle]->uiRightMargin=uiRight; - PopUpBoxList[hBoxHandle]->uiTopMargin=uiTop; - PopUpBoxList[hBoxHandle]->uiBottomMargin=uiBottom; + PopUpBoxList[hBoxHandle]->uiLeftMargin=uiLeft; + PopUpBoxList[hBoxHandle]->uiRightMargin=uiRight; + PopUpBoxList[hBoxHandle]->uiTopMargin=uiTop; + PopUpBoxList[hBoxHandle]->uiBottomMargin=uiBottom; - PopUpBoxList[hBoxHandle]-> fUpdated = FALSE; + PopUpBoxList[hBoxHandle]->fUpdated = FALSE; return; } @@ -188,8 +188,8 @@ void ShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ) Assert( PopUpBoxList[ hBoxHandle ] ); - if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) - { + if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) + { // set current box SetCurrentBox( hBoxHandle ); @@ -210,7 +210,7 @@ void UnShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ) Assert( PopUpBoxList[ hBoxHandle ] ); if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) - { + { // set current box SetCurrentBox( hBoxHandle ); @@ -231,8 +231,8 @@ void SecondaryShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ) Assert( PopUpBoxList[ hBoxHandle ] ); - if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) - { + if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) + { // set current box SetCurrentBox( hBoxHandle ); @@ -253,7 +253,7 @@ void UnSecondaryShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ) Assert( PopUpBoxList[ hBoxHandle ] ); if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) - { + { // set current box SetCurrentBox( hBoxHandle ); @@ -275,7 +275,7 @@ void SetBoxBuffer(INT32 hBoxHandle, UINT32 uiBuffer) PopUpBoxList[hBoxHandle]->uiBuffer=uiBuffer; - PopUpBoxList[hBoxHandle]-> fUpdated = FALSE; + PopUpBoxList[hBoxHandle]->fUpdated = FALSE; return; } @@ -291,9 +291,9 @@ void SetBoxPosition( INT32 hBoxHandle,SGPPoint Position ) PopUpBoxList[hBoxHandle]->Position.iX=Position.iX; PopUpBoxList[hBoxHandle]->Position.iY=Position.iY; - PopUpBoxList[hBoxHandle]-> fUpdated = FALSE; + PopUpBoxList[hBoxHandle]->fUpdated = FALSE; - return; + return; } @@ -304,8 +304,8 @@ void GetBoxPosition( INT32 hBoxHandle, SGPPoint *Position ) Assert( PopUpBoxList[ hBoxHandle ] ); - Position -> iX = PopUpBoxList[hBoxHandle]->Position.iX; - Position -> iY = PopUpBoxList[hBoxHandle]->Position.iY; + Position->iX = PopUpBoxList[hBoxHandle]->Position.iX; + Position->iY = PopUpBoxList[hBoxHandle]->Position.iY; return; } @@ -322,7 +322,7 @@ void SetBoxSize(INT32 hBoxHandle,SGPRect Dimensions) PopUpBoxList[hBoxHandle]->Dimensions.iRight=Dimensions.iRight; PopUpBoxList[hBoxHandle]->Dimensions.iTop=Dimensions.iTop; - PopUpBoxList[hBoxHandle]-> fUpdated = FALSE; + PopUpBoxList[hBoxHandle]->fUpdated = FALSE; return; } @@ -335,15 +335,15 @@ void GetBoxSize( INT32 hBoxHandle, SGPRect *Dimensions ) Assert( PopUpBoxList[ hBoxHandle ] ); - Dimensions -> iLeft = PopUpBoxList[hBoxHandle]->Dimensions.iLeft; - Dimensions -> iBottom = PopUpBoxList[hBoxHandle]->Dimensions.iBottom; - Dimensions -> iRight = PopUpBoxList[hBoxHandle]->Dimensions.iRight; - Dimensions -> iTop = PopUpBoxList[hBoxHandle]->Dimensions.iTop; + Dimensions->iLeft = PopUpBoxList[hBoxHandle]->Dimensions.iLeft; + Dimensions->iBottom = PopUpBoxList[hBoxHandle]->Dimensions.iBottom; + Dimensions->iRight = PopUpBoxList[hBoxHandle]->Dimensions.iRight; + Dimensions->iTop = PopUpBoxList[hBoxHandle]->Dimensions.iTop; return; } - + void SetBorderType(INT32 hBoxHandle, INT32 iBorderObjectIndex) { if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) @@ -408,8 +408,8 @@ void AddMonoString(UINT32 *hStringHandle, STR16 pString) PopUpBoxList[guiCurrentBox]->Text[iCounter]->fSecondaryShadeFlag = FALSE; *hStringHandle=iCounter; - - PopUpBoxList[guiCurrentBox]-> fUpdated = FALSE; + + PopUpBoxList[guiCurrentBox]->fUpdated = FALSE; return; } @@ -438,25 +438,25 @@ void AddSecondColumnMonoString( UINT32 *hStringHandle, STR16 pString ) return; } - pStringSt=(POPUPSTRING *)(MemAlloc(sizeof(POPUPSTRING))); + pStringSt=(POPUPSTRING *)(MemAlloc(sizeof(POPUPSTRING))); if (pStringSt == NULL) return; - pLocalString=(STR16)MemAlloc((wcslen(pString)+1)*sizeof(CHAR16)); + pLocalString=(STR16)MemAlloc((wcslen(pString)+1)*sizeof(CHAR16)); if (pLocalString == NULL) return; - wcscpy(pLocalString, pString); + wcscpy(pLocalString, pString); RemoveCurrentBoxSecondaryText( iCounter ); PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter]=pStringSt; - PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter]->fColorFlag=FALSE; - PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter]->pString=pLocalString; - PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter]->fShadeFlag = FALSE; - PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter]->fHighLightFlag = FALSE; + PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter]->fColorFlag=FALSE; + PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter]->pString=pLocalString; + PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter]->fShadeFlag = FALSE; + PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter]->fHighLightFlag = FALSE; - *hStringHandle=iCounter; + *hStringHandle=iCounter; return; } @@ -503,7 +503,7 @@ void AddColorString(INT32 *hStringHandle, STR16 pString) *hStringHandle=iCounter; - PopUpBoxList[guiCurrentBox]-> fUpdated = FALSE; + PopUpBoxList[guiCurrentBox]->fUpdated = FALSE; return; } @@ -575,14 +575,14 @@ void SetBoxFont(INT32 hBoxHandle, UINT32 uiFont) { if ( PopUpBoxList[hBoxHandle]->Text[uiCounter] != NULL) { - PopUpBoxList[hBoxHandle]->Text[uiCounter]->uiFont=uiFont; + PopUpBoxList[hBoxHandle]->Text[uiCounter]->uiFont=uiFont; } } - + // set up the 2nd column font SetBoxSecondColumnFont( hBoxHandle, uiFont ); - PopUpBoxList[hBoxHandle]-> fUpdated = FALSE; + PopUpBoxList[hBoxHandle]->fUpdated = FALSE; return; } @@ -614,13 +614,13 @@ void SetBoxSecondColumnFont(INT32 hBoxHandle, UINT32 uiFont) for( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) { - if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) - { + if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + { PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->uiFont=uiFont; - } + } } - - PopUpBoxList[hBoxHandle]-> fUpdated = FALSE; + + PopUpBoxList[hBoxHandle]->fUpdated = FALSE; return; } @@ -825,7 +825,7 @@ void SetBoxForeground(INT32 hBoxHandle, UINT8 ubColor) { if (PopUpBoxList[hBoxHandle]->Text[uiCounter]!=NULL) { - PopUpBoxList[hBoxHandle]->Text[uiCounter]->ubForegroundColor=ubColor; + PopUpBoxList[hBoxHandle]->Text[uiCounter]->ubForegroundColor=ubColor; } } return; @@ -844,7 +844,7 @@ void SetBoxBackground(INT32 hBoxHandle, UINT8 ubColor) { if (PopUpBoxList[hBoxHandle]->Text[uiCounter]!=NULL) { - PopUpBoxList[hBoxHandle]->Text[uiCounter]->ubBackgroundColor=ubColor; + PopUpBoxList[hBoxHandle]->Text[uiCounter]->ubBackgroundColor=ubColor; } } return; @@ -863,7 +863,7 @@ void SetBoxHighLight(INT32 hBoxHandle, UINT8 ubColor) { if (PopUpBoxList[hBoxHandle]->Text[uiCounter]!=NULL) { - PopUpBoxList[hBoxHandle]->Text[uiCounter]->ubHighLight=ubColor; + PopUpBoxList[hBoxHandle]->Text[uiCounter]->ubHighLight=ubColor; } } return; @@ -882,7 +882,7 @@ void SetBoxShade(INT32 hBoxHandle, UINT8 ubColor) { if (PopUpBoxList[hBoxHandle]->Text[uiCounter]!=NULL) { - PopUpBoxList[hBoxHandle]->Text[uiCounter]->ubShade=ubColor; + PopUpBoxList[hBoxHandle]->Text[uiCounter]->ubShade=ubColor; } } return; @@ -891,7 +891,7 @@ void SetBoxShade(INT32 hBoxHandle, UINT8 ubColor) void SetBoxSecondColumnForeground(INT32 hBoxHandle, UINT8 ubColor) { UINT32 iCounter=0; - + if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) return; @@ -899,10 +899,10 @@ void SetBoxSecondColumnForeground(INT32 hBoxHandle, UINT8 ubColor) for( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) { - if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) - { - PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubForegroundColor=ubColor; - } + if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + { + PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubForegroundColor=ubColor; + } } return; @@ -919,10 +919,10 @@ void SetBoxSecondColumnBackground(INT32 hBoxHandle, UINT8 ubColor) for( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) { - if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) - { - PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubBackgroundColor=ubColor; - } + if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + { + PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubBackgroundColor=ubColor; + } } return; @@ -939,10 +939,10 @@ void SetBoxSecondColumnHighLight(INT32 hBoxHandle, UINT8 ubColor) for( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) { - if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) - { + if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + { PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubHighLight=ubColor; - } + } } return; @@ -959,10 +959,10 @@ void SetBoxSecondColumnShade(INT32 hBoxHandle, UINT8 ubColor) for( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) { - if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) - { + if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + { PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubShade=ubColor; - } + } } return; } @@ -976,7 +976,7 @@ void HighLightLine(INT32 hStringHandle) Assert( PopUpBoxList[guiCurrentBox] != NULL ); if(!PopUpBoxList[guiCurrentBox]->Text[hStringHandle]) - return; + return; PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->fHighLightFlag=TRUE; return; } @@ -989,7 +989,7 @@ BOOLEAN GetShadeFlag( INT32 hStringHandle ) Assert( PopUpBoxList[guiCurrentBox] != NULL ); if(!PopUpBoxList[guiCurrentBox]->Text[hStringHandle]) - return( FALSE ); + return( FALSE ); return( PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->fShadeFlag); } @@ -1002,7 +1002,7 @@ BOOLEAN GetSecondaryShadeFlag( INT32 hStringHandle ) Assert( PopUpBoxList[guiCurrentBox] != NULL ); if(!PopUpBoxList[guiCurrentBox]->Text[hStringHandle]) - return( FALSE ); + return( FALSE ); return( PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->fSecondaryShadeFlag ); } @@ -1015,8 +1015,8 @@ void HighLightBoxLine( INT32 hBoxHandle, INT32 iLineNumber ) // highlight iLineNumber Line in box indexed by hBoxHandle - if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) - { + if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) + { // set current box SetCurrentBox( hBoxHandle ); @@ -1033,8 +1033,8 @@ BOOLEAN GetBoxShadeFlag( INT32 hBoxHandle, INT32 iLineNumber ) return(FALSE); if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) - { - return( PopUpBoxList[hBoxHandle]->Text[iLineNumber]->fShadeFlag ); + { + return( PopUpBoxList[hBoxHandle]->Text[iLineNumber]->fShadeFlag ); } @@ -1047,8 +1047,8 @@ BOOLEAN GetBoxSecondaryShadeFlag( INT32 hBoxHandle, INT32 iLineNumber ) return(FALSE); if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) - { - return( PopUpBoxList[hBoxHandle]->Text[iLineNumber]->fSecondaryShadeFlag ); + { + return( PopUpBoxList[hBoxHandle]->Text[iLineNumber]->fSecondaryShadeFlag ); } @@ -1063,7 +1063,7 @@ void UnHighLightLine(INT32 hStringHandle) Assert( PopUpBoxList[guiCurrentBox] != NULL ); if(!PopUpBoxList[guiCurrentBox]->Text[hStringHandle]) - return; + return; PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->fHighLightFlag=FALSE; return; } @@ -1078,7 +1078,7 @@ void UnHighLightBox(INT32 hBoxHandle) for(iCounter=0; iCounter Text[iCounter]) - PopUpBoxList[hBoxHandle]->Text[iCounter]->fHighLightFlag=FALSE; + PopUpBoxList[hBoxHandle]->Text[iCounter]->fHighLightFlag=FALSE; } } @@ -1090,7 +1090,7 @@ void UnHighLightSecondColumnLine(INT32 hStringHandle) Assert( PopUpBoxList[guiCurrentBox] != NULL ); if(!PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]) - return; + return; PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->fHighLightFlag=FALSE; return; @@ -1106,7 +1106,7 @@ void UnHighLightSecondColumnBox(INT32 hBoxHandle) for(iCounter=0; iCounter pSecondColumnString[iCounter]) - PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->fHighLightFlag=FALSE; + PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->fHighLightFlag=FALSE; } } @@ -1132,8 +1132,8 @@ void RemoveOneCurrentBoxString(INT32 hStringHandle, BOOLEAN fFillGaps) PopUpBoxList[guiCurrentBox]->pSecondColumnString[uiCounter]=PopUpBoxList[guiCurrentBox]->pSecondColumnString[uiCounter+1]; } } - - PopUpBoxList[guiCurrentBox]-> fUpdated = FALSE; + + PopUpBoxList[guiCurrentBox]->fUpdated = FALSE; } @@ -1167,7 +1167,7 @@ void RemoveBox(INT32 hBoxHandle) PopUpBoxList[hBoxHandle]=NULL; if(hOldBoxHandle !=hBoxHandle) - SetCurrentBox(hOldBoxHandle); + SetCurrentBox(hOldBoxHandle); return; } @@ -1211,7 +1211,7 @@ void SetCurrentBox(INT32 hBoxHandle) if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) return; - guiCurrentBox = hBoxHandle; + guiCurrentBox = hBoxHandle; } @@ -1224,13 +1224,13 @@ void GetCurrentBox(INT32 *hBoxHandle) void DisplayBoxes(UINT32 uiBuffer) { - UINT32 uiCounter; + UINT32 uiCounter; for( uiCounter=0; uiCounter < MAX_POPUP_BOX_COUNT; uiCounter++ ) { DisplayOnePopupBox( uiCounter, uiBuffer ); - } - return; + } + return; } @@ -1241,10 +1241,10 @@ void DisplayOnePopupBox( UINT32 uiIndex, UINT32 uiBuffer ) if ( PopUpBoxList[ uiIndex ] != NULL ) { - if( ( PopUpBoxList[ uiIndex ]->uiBuffer == uiBuffer) && ( PopUpBoxList[ uiIndex ]->fShowBox ) ) + if( ( PopUpBoxList[ uiIndex ]->uiBuffer == uiBuffer) && ( PopUpBoxList[ uiIndex ]->fShowBox ) ) { - DrawBox( uiIndex ); - DrawBoxText( uiIndex ); + DrawBox( uiIndex ); + DrawBoxText( uiIndex ); } } } @@ -1267,18 +1267,18 @@ void ForceUpDateOfBox( UINT32 uiIndex ) BOOLEAN DrawBox(UINT32 uiCounter) { - // will build pop up box in usTopX, usTopY with dimensions usWidth and usHeight - UINT32 uiNumTilesWide; + // will build pop up box in usTopX, usTopY with dimensions usWidth and usHeight + UINT32 uiNumTilesWide; UINT32 uiNumTilesHigh; UINT32 uiCount=0; - HVOBJECT hBoxHandle; - HVSURFACE hSrcVSurface; - UINT32 uiDestPitchBYTES; + HVOBJECT hBoxHandle; + HVSURFACE hSrcVSurface; + UINT32 uiDestPitchBYTES; UINT32 uiSrcPitchBYTES; - UINT16 *pDestBuf; - UINT8 *pSrcBuf; + UINT16 *pDestBuf; + UINT8 *pSrcBuf; SGPRect clip; - UINT16 usTopX, usTopY; + UINT16 usTopX, usTopY; UINT16 usWidth, usHeight; @@ -1290,12 +1290,12 @@ BOOLEAN DrawBox(UINT32 uiCounter) // only update if we need to - if( PopUpBoxList[uiCounter]-> fUpdated == TRUE ) + if( PopUpBoxList[uiCounter]->fUpdated == TRUE ) { return( FALSE ); } - - PopUpBoxList[uiCounter]-> fUpdated = TRUE; + + PopUpBoxList[uiCounter]->fUpdated = TRUE; if( PopUpBoxList[uiCounter]->uiFlags & POPUP_BOX_FLAG_RESIZE ) { @@ -1314,7 +1314,7 @@ BOOLEAN DrawBox(UINT32 uiCounter) } // make sure it will fit on screen! - Assert( usTopX + usWidth <= SCREEN_WIDTH ); + Assert( usTopX + usWidth <= SCREEN_WIDTH ); Assert( usTopY + usHeight <= SCREEN_HEIGHT ); // subtract 4 because the 2 2-pixel corners are handled separately @@ -1322,58 +1322,58 @@ BOOLEAN DrawBox(UINT32 uiCounter) uiNumTilesHigh=((usHeight-4)/BORDER_HEIGHT); clip.iLeft=0; - clip.iRight=clip.iLeft+usWidth; + clip.iRight=clip.iLeft+usWidth; clip.iTop=0; clip.iBottom=clip.iTop+usHeight; // blit in texture first, then borders - // blit in surface - pDestBuf = (UINT16*)LockVideoSurface(PopUpBoxList[uiCounter]->uiBuffer, &uiDestPitchBYTES); - CHECKF( GetVideoSurface( &hSrcVSurface, PopUpBoxList[uiCounter]->iBackGroundSurface) ); + // blit in surface + pDestBuf = (UINT16*)LockVideoSurface(PopUpBoxList[uiCounter]->uiBuffer, &uiDestPitchBYTES); + CHECKF( GetVideoSurface( &hSrcVSurface, PopUpBoxList[uiCounter]->iBackGroundSurface) ); pSrcBuf = LockVideoSurface( PopUpBoxList[uiCounter]->iBackGroundSurface, &uiSrcPitchBYTES); - Blt8BPPDataSubTo16BPPBuffer( pDestBuf, uiDestPitchBYTES, hSrcVSurface, pSrcBuf,uiSrcPitchBYTES,usTopX,usTopY, &clip); + Blt8BPPDataSubTo16BPPBuffer( pDestBuf, uiDestPitchBYTES, hSrcVSurface, pSrcBuf,uiSrcPitchBYTES,usTopX,usTopY, &clip); UnLockVideoSurface( PopUpBoxList[uiCounter]->iBackGroundSurface); - UnLockVideoSurface(PopUpBoxList[uiCounter]->uiBuffer); + UnLockVideoSurface(PopUpBoxList[uiCounter]->uiBuffer); GetVideoObject(&hBoxHandle, PopUpBoxList[uiCounter]->iBorderObjectIndex); - // blit in 4 corners (they're 2x2 pixels) + // blit in 4 corners (they're 2x2 pixels) BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, TOP_LEFT_CORNER,usTopX,usTopY, VO_BLT_SRCTRANSPARENCY, NULL ); - BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, TOP_RIGHT_CORNER,usTopX+usWidth-2,usTopY, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, TOP_RIGHT_CORNER,usTopX+usWidth-2,usTopY, VO_BLT_SRCTRANSPARENCY, NULL ); BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, BOTTOM_RIGHT_CORNER,usTopX+usWidth-2,usTopY+usHeight-2, VO_BLT_SRCTRANSPARENCY, NULL ); BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, BOTTOM_LEFT_CORNER,usTopX,usTopY+usHeight-2, VO_BLT_SRCTRANSPARENCY, NULL ); - // blit in edges + // blit in edges if (uiNumTilesWide > 0) { // full pieces - for (uiCount=0; uiCount uiBuffer, hBoxHandle, TOP_EDGE, usTopX+2+(uiCount*BORDER_WIDTH),usTopY, VO_BLT_SRCTRANSPARENCY, NULL ); - BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, BOTTOM_EDGE,usTopX+2+(uiCount*BORDER_WIDTH),usTopY+usHeight-2, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, TOP_EDGE, usTopX+2+(uiCount*BORDER_WIDTH),usTopY, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, BOTTOM_EDGE,usTopX+2+(uiCount*BORDER_WIDTH),usTopY+usHeight-2, VO_BLT_SRCTRANSPARENCY, NULL ); } // partial pieces - BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, TOP_EDGE, usTopX+usWidth-2-BORDER_WIDTH,usTopY, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, TOP_EDGE, usTopX+usWidth-2-BORDER_WIDTH,usTopY, VO_BLT_SRCTRANSPARENCY, NULL ); BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, BOTTOM_EDGE,usTopX+usWidth-2-BORDER_WIDTH,usTopY+usHeight-2, VO_BLT_SRCTRANSPARENCY, NULL ); } - if (uiNumTilesHigh > 0) + if (uiNumTilesHigh > 0) { // full pieces - for (uiCount=0; uiCount uiBuffer, hBoxHandle, SIDE_EDGE,usTopX, usTopY+2+(uiCount*BORDER_HEIGHT), VO_BLT_SRCTRANSPARENCY, NULL ); - BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, SIDE_EDGE,usTopX+usWidth-2,usTopY+2+(uiCount*BORDER_HEIGHT), VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, SIDE_EDGE,usTopX, usTopY+2+(uiCount*BORDER_HEIGHT), VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, SIDE_EDGE,usTopX+usWidth-2,usTopY+2+(uiCount*BORDER_HEIGHT), VO_BLT_SRCTRANSPARENCY, NULL ); } // partial pieces - BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, SIDE_EDGE,usTopX, usTopY+usHeight-2-BORDER_HEIGHT, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, SIDE_EDGE,usTopX, usTopY+usHeight-2-BORDER_HEIGHT, VO_BLT_SRCTRANSPARENCY, NULL ); BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, SIDE_EDGE,usTopX+usWidth-2,usTopY+usHeight-2-BORDER_HEIGHT, VO_BLT_SRCTRANSPARENCY, NULL ); - } + } InvalidateRegion( usTopX, usTopY, usTopX + usWidth, usTopY + usHeight ); return TRUE; } - + BOOLEAN DrawBoxText(UINT32 uiCounter) @@ -1382,7 +1382,7 @@ BOOLEAN DrawBoxText(UINT32 uiCounter) INT16 uX, uY; CHAR16 sString[100]; - + if ( ( uiCounter < 0 ) || ( uiCounter >= MAX_POPUP_BOX_COUNT ) ) return(FALSE); @@ -1399,112 +1399,112 @@ BOOLEAN DrawBoxText(UINT32 uiCounter) { // there is text in this line? if(PopUpBoxList[uiCounter]->Text[uiCount]) - { + { // set font - SetFont(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont); - + SetFont(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont); + // are we highlighting?...shading?..or neither - if( ( PopUpBoxList[ uiCounter ] -> Text[ uiCount ] -> fHighLightFlag == FALSE )&&( PopUpBoxList[ uiCounter ] -> Text[ uiCount ] -> fShadeFlag == FALSE) &&( PopUpBoxList[ uiCounter ] -> Text[ uiCount ] -> fSecondaryShadeFlag == FALSE ) ) + if( ( PopUpBoxList[ uiCounter ]->Text[ uiCount ]->fHighLightFlag == FALSE )&&( PopUpBoxList[ uiCounter ]->Text[ uiCount ]->fShadeFlag == FALSE) &&( PopUpBoxList[ uiCounter ]->Text[ uiCount ]->fSecondaryShadeFlag == FALSE ) ) { // neither - SetFontForeground(PopUpBoxList[uiCounter]->Text[uiCount]->ubForegroundColor); + SetFontForeground(PopUpBoxList[uiCounter]->Text[uiCount]->ubForegroundColor); } - else if( ( PopUpBoxList[ uiCounter ] -> Text[ uiCount ] -> fHighLightFlag == TRUE ) ) + else if( ( PopUpBoxList[ uiCounter ]->Text[ uiCount ]->fHighLightFlag == TRUE ) ) { // highlight - SetFontForeground(PopUpBoxList[uiCounter]->Text[uiCount]->ubHighLight); + SetFontForeground(PopUpBoxList[uiCounter]->Text[uiCount]->ubHighLight); } - else if( ( PopUpBoxList[ uiCounter ] -> Text[ uiCount ] -> fSecondaryShadeFlag == TRUE ) ) + else if( ( PopUpBoxList[ uiCounter ]->Text[ uiCount ]->fSecondaryShadeFlag == TRUE ) ) { SetFontForeground(PopUpBoxList[uiCounter]->Text[uiCount]->ubSecondaryShade); } - else + else { //shading SetFontForeground(PopUpBoxList[uiCounter]->Text[uiCount]->ubShade); } - + // set background - SetFontBackground(PopUpBoxList[uiCounter]->Text[uiCount]->ubBackgroundColor); - + SetFontBackground(PopUpBoxList[uiCounter]->Text[uiCount]->ubBackgroundColor); + // copy string - wcsncpy(sString, PopUpBoxList[uiCounter]->Text[uiCount]->pString, wcslen(PopUpBoxList[uiCounter]->Text[uiCount]->pString)+1); - + wcsncpy(sString, PopUpBoxList[uiCounter]->Text[uiCount]->pString, wcslen(PopUpBoxList[uiCounter]->Text[uiCount]->pString)+1); + // cnetering? - if(PopUpBoxList[uiCounter]->uiFlags & POPUP_BOX_FLAG_CENTER_TEXT) + if(PopUpBoxList[uiCounter]->uiFlags & POPUP_BOX_FLAG_CENTER_TEXT) { - FindFontCenterCoordinates(((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin)),((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)),((INT16)(PopUpBoxList[uiCounter]->Dimensions.iRight-(PopUpBoxList[uiCounter]->uiRightMargin+PopUpBoxList[uiCounter]->uiLeftMargin+2))),((INT16)GetFontHeight(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont)),(sString),((INT32)PopUpBoxList[uiCounter]->Text[uiCount]->uiFont) ,&uX, &uY); - } - else - { - uX=((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin)); - uY=((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)); + FindFontCenterCoordinates(((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin)),((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)),((INT16)(PopUpBoxList[uiCounter]->Dimensions.iRight-(PopUpBoxList[uiCounter]->uiRightMargin+PopUpBoxList[uiCounter]->uiLeftMargin+2))),((INT16)GetFontHeight(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont)),(sString),((INT32)PopUpBoxList[uiCounter]->Text[uiCount]->uiFont) ,&uX, &uY); } - + else + { + uX=((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin)); + uY=((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)); + } + // print - //gprintfdirty(uX,uY,PopUpBoxList[uiCounter]->Text[uiCount]->pString ); - mprintf(uX,uY,PopUpBoxList[uiCounter]->Text[uiCount]->pString); + //gprintfdirty(uX,uY,PopUpBoxList[uiCounter]->Text[uiCount]->pString ); + mprintf(uX,uY,PopUpBoxList[uiCounter]->Text[uiCount]->pString); } - + // there is secondary text in this line? if(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]) - { + { // set font - SetFont(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont); - + SetFont(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont); + // are we highlighting?...shading?..or neither - if( ( PopUpBoxList[ uiCounter ] -> pSecondColumnString[ uiCount ] -> fHighLightFlag == FALSE )&&( PopUpBoxList[ uiCounter ] -> pSecondColumnString[ uiCount ] -> fShadeFlag == FALSE) ) + if( ( PopUpBoxList[ uiCounter ]->pSecondColumnString[ uiCount ]->fHighLightFlag == FALSE )&&( PopUpBoxList[ uiCounter ]->pSecondColumnString[ uiCount ]->fShadeFlag == FALSE) ) { // neither - SetFontForeground(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->ubForegroundColor); + SetFontForeground(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->ubForegroundColor); } - else if( ( PopUpBoxList[ uiCounter ] -> pSecondColumnString[ uiCount ] -> fHighLightFlag == TRUE ) ) + else if( ( PopUpBoxList[ uiCounter ]->pSecondColumnString[ uiCount ]->fHighLightFlag == TRUE ) ) { // highlight - SetFontForeground(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->ubHighLight); + SetFontForeground(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->ubHighLight); } - else + else { //shading SetFontForeground(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->ubShade); } - + // set background - SetFontBackground(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->ubBackgroundColor); - + SetFontBackground(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->ubBackgroundColor); + // copy string - wcsncpy(sString, PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->pString, wcslen(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->pString)+1); - + wcsncpy(sString, PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->pString, wcslen(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->pString)+1); + // cnetering? - if(PopUpBoxList[uiCounter]->uiFlags & POPUP_BOX_FLAG_CENTER_TEXT) + if(PopUpBoxList[uiCounter]->uiFlags & POPUP_BOX_FLAG_CENTER_TEXT) { - FindFontCenterCoordinates(((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin)),((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)),((INT16)(PopUpBoxList[uiCounter]->Dimensions.iRight-(PopUpBoxList[uiCounter]->uiRightMargin+PopUpBoxList[uiCounter]->uiLeftMargin+2))),((INT16)GetFontHeight(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont)),(sString),((INT32)PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont) ,&uX, &uY); - } - else - { - uX=((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin + PopUpBoxList[uiCounter]->uiSecondColumnCurrentOffset ) ); - uY=((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)); + FindFontCenterCoordinates(((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin)),((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)),((INT16)(PopUpBoxList[uiCounter]->Dimensions.iRight-(PopUpBoxList[uiCounter]->uiRightMargin+PopUpBoxList[uiCounter]->uiLeftMargin+2))),((INT16)GetFontHeight(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont)),(sString),((INT32)PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont) ,&uX, &uY); } - + else + { + uX=((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin + PopUpBoxList[uiCounter]->uiSecondColumnCurrentOffset ) ); + uY=((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)); + } + // print - //gprintfdirty(uX,uY,PopUpBoxList[uiCounter]->Text[uiCount]->pString ); - mprintf(uX,uY,PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->pString); - } + //gprintfdirty(uX,uY,PopUpBoxList[uiCounter]->Text[uiCount]->pString ); + mprintf(uX,uY,PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->pString); + } } - if( PopUpBoxList[uiCounter]->uiBuffer != guiSAVEBUFFER ) + if( PopUpBoxList[uiCounter]->uiBuffer != guiSAVEBUFFER ) { InvalidateRegion( PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin-1, PopUpBoxList[uiCounter]->Position.iY+PopUpBoxList[uiCounter]->uiTopMargin, PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->Dimensions.iRight-PopUpBoxList[uiCounter]->uiRightMargin,PopUpBoxList[uiCounter]->Position.iY+PopUpBoxList[uiCounter]->Dimensions.iBottom-PopUpBoxList[uiCounter]->uiBottomMargin ); } - SetFontDestBuffer(FRAME_BUFFER, 0,0,SCREEN_WIDTH, SCREEN_HEIGHT,FALSE); - + SetFontDestBuffer(FRAME_BUFFER, 0,0,SCREEN_WIDTH, SCREEN_HEIGHT,FALSE); + return TRUE; } @@ -1528,7 +1528,7 @@ void ResizeBoxToText(INT32 hBoxHandle) ResizeBoxForSecondStrings( hBoxHandle ); iHeight=PopUpBoxList[hBoxHandle]->uiTopMargin+PopUpBoxList[hBoxHandle]->uiBottomMargin; - + for ( iCurrString = 0; iCurrString < MAX_POPUP_BOX_STRING_COUNT; iCurrString++ ) { if ( PopUpBoxList[hBoxHandle]->Text[iCurrString] != NULL) @@ -1536,14 +1536,14 @@ void ResizeBoxToText(INT32 hBoxHandle) if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCurrString] != NULL ) { iSecondColumnLength = StringPixLength( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCurrString]->pString,PopUpBoxList[ hBoxHandle]->pSecondColumnString[ iCurrString ]->uiFont ); - if( PopUpBoxList[hBoxHandle] -> uiSecondColumnCurrentOffset + iSecondColumnLength + PopUpBoxList[hBoxHandle]->uiLeftMargin+PopUpBoxList[hBoxHandle]->uiRightMargin > ( ( UINT32 ) iWidth ) ) + if( PopUpBoxList[hBoxHandle]->uiSecondColumnCurrentOffset + iSecondColumnLength + PopUpBoxList[hBoxHandle]->uiLeftMargin+PopUpBoxList[hBoxHandle]->uiRightMargin > ( ( UINT32 ) iWidth ) ) { - iWidth = PopUpBoxList[hBoxHandle] -> uiSecondColumnCurrentOffset + iSecondColumnLength + PopUpBoxList[hBoxHandle]->uiLeftMargin+PopUpBoxList[hBoxHandle]->uiRightMargin; + iWidth = PopUpBoxList[hBoxHandle]->uiSecondColumnCurrentOffset + iSecondColumnLength + PopUpBoxList[hBoxHandle]->uiLeftMargin+PopUpBoxList[hBoxHandle]->uiRightMargin; } } if( ( StringPixLength(PopUpBoxList[hBoxHandle]->Text[iCurrString]->pString,PopUpBoxList[hBoxHandle]->Text[iCurrString]->uiFont ) + PopUpBoxList[hBoxHandle]->uiLeftMargin+PopUpBoxList[hBoxHandle]->uiRightMargin ) > ( (UINT32) iWidth ) ) - iWidth=StringPixLength(PopUpBoxList[hBoxHandle]->Text[iCurrString]->pString,PopUpBoxList[hBoxHandle]->Text[iCurrString]->uiFont ) + PopUpBoxList[hBoxHandle]->uiLeftMargin+PopUpBoxList[hBoxHandle]->uiRightMargin; + iWidth=StringPixLength(PopUpBoxList[hBoxHandle]->Text[iCurrString]->pString,PopUpBoxList[hBoxHandle]->Text[iCurrString]->uiFont ) + PopUpBoxList[hBoxHandle]->uiLeftMargin+PopUpBoxList[hBoxHandle]->uiRightMargin; //vertical iHeight+=GetFontHeight(PopUpBoxList[hBoxHandle]->Text[iCurrString]->uiFont)+PopUpBoxList[hBoxHandle]->uiLineSpace; @@ -1553,9 +1553,9 @@ void ResizeBoxToText(INT32 hBoxHandle) // doesn't support gaps in text array... break; } - } + } PopUpBoxList[hBoxHandle]->Dimensions.iBottom=iHeight; - PopUpBoxList[hBoxHandle]->Dimensions.iRight=iWidth; + PopUpBoxList[hBoxHandle]->Dimensions.iRight=iWidth; } @@ -1569,7 +1569,7 @@ BOOLEAN IsBoxShown( UINT32 uiHandle ) return ( FALSE ); } - return( PopUpBoxList[ uiHandle ] -> fShowBox ); + return( PopUpBoxList[ uiHandle ]->fShowBox ); } diff --git a/Utils/PopUpBox.h b/Utils/PopUpBox.h index ac294be9..08ee41ba 100644 --- a/Utils/PopUpBox.h +++ b/Utils/PopUpBox.h @@ -33,13 +33,13 @@ typedef struct popupstring POPUPSTRING; typedef POPUPSTRING* POPUPSTRINGPTR; struct popupbox{ - SGPRect Dimensions; + SGPRect Dimensions; SGPPoint Position; UINT32 uiLeftMargin; UINT32 uiRightMargin; UINT32 uiBottomMargin; UINT32 uiTopMargin; - UINT32 uiLineSpace; + UINT32 uiLineSpace; INT32 iBorderObjectIndex; INT32 iBackGroundSurface; UINT32 uiFlags; @@ -75,7 +75,7 @@ void SetBoxPosition(INT32 hBoxHandle,SGPPoint Position); void GetBoxPosition( INT32 hBoxHandle, SGPPoint *Position ); UINT32 GetNumberOfLinesOfTextInBox( INT32 hBoxHandle ); void SetBoxSize( INT32 hBoxHandle, SGPRect Dimensions ); -void GetBoxSize( INT32 hBoxHandle, SGPRect *Dimensions ); +void GetBoxSize( INT32 hBoxHandle, SGPRect *Dimensions ); void SetBoxFlags( INT32 hBoxHandle, UINT32 uiFlags); void SetBorderType(INT32 hBoxHandle,INT32 BorderObjectIndex); void SetBackGroundSurface(INT32 hBoxHandle, INT32 BackGroundSurfaceIndex); diff --git a/Utils/Quantize Wrap.cpp b/Utils/Quantize Wrap.cpp index 4681152b..e6e4b963 100644 --- a/Utils/Quantize Wrap.cpp +++ b/Utils/Quantize Wrap.cpp @@ -29,7 +29,7 @@ BOOLEAN QuantizeImage( UINT8 *pDest, UINT8 *pSrc, INT16 sWidth, INT16 sHeight, S sNumColors = q.GetColorCount(); - memset( pPalette, 0, sizeof( SGPPaletteEntry ) * 256 ); + memset( pPalette, 0, sizeof( SGPPaletteEntry ) * 256 ); q.GetColorTable( (RGBQUAD*)pPalette ); @@ -81,7 +81,7 @@ void MapPalette( UINT8 *pDest, UINT8 *pSrc, INT16 sWidth, INT16 sHeight, INT16 s { dLowestDist = dCubeDist; bBest = cnt; - } + } } // Now we have the lowest value @@ -93,4 +93,4 @@ void MapPalette( UINT8 *pDest, UINT8 *pSrc, INT16 sWidth, INT16 sHeight, INT16 s } } -} \ No newline at end of file +} diff --git a/Utils/Quantize.cpp b/Utils/Quantize.cpp index c6cdda23..f9c76789 100644 --- a/Utils/Quantize.cpp +++ b/Utils/Quantize.cpp @@ -10,199 +10,199 @@ CQuantizer::CQuantizer (UINT nMaxColors, UINT nColorBits) { - m_pTree = NULL; - m_nLeafCount = 0; - for (int i=0; i<=(int) nColorBits; i++) - m_pReducibleNodes[i] = NULL; - m_nMaxColors = nMaxColors; - m_nColorBits = nColorBits; + m_pTree = NULL; + m_nLeafCount = 0; + for (int i=0; i<=(int) nColorBits; i++) + m_pReducibleNodes[i] = NULL; + m_nMaxColors = nMaxColors; + m_nColorBits = nColorBits; } CQuantizer::~CQuantizer () { - if (m_pTree != NULL) - DeleteTree (&m_pTree); + if (m_pTree != NULL) + DeleteTree (&m_pTree); } BOOL CQuantizer::ProcessImage (BYTE *pData, int iWidth, int iHeight ) { - BYTE* pbBits; - BYTE r, g, b; - int i, j; + BYTE* pbBits; + BYTE r, g, b; + int i, j; - pbBits = (BYTE*)pData; - for (i=0; i m_nMaxColors) - ReduceTree (m_nColorBits, &m_nLeafCount, m_pReducibleNodes); - } + pbBits = (BYTE*)pData; + for (i=0; i m_nMaxColors) + ReduceTree (m_nColorBits, &m_nLeafCount, m_pReducibleNodes); + } //Padding - //pbBits ++; - } - return TRUE; + //pbBits ++; + } + return TRUE; } int CQuantizer::GetLeftShiftCount (DWORD dwVal) { - int nCount = 0; - for (int i=0; i>= 1; - } - return (8 - nCount); + int nCount = 0; + for (int i=0; i>= 1; + } + return (8 - nCount); } int CQuantizer::GetRightShiftCount (DWORD dwVal) { - for (int i=0; i>= 1; - } - return -1; + for (int i=0; i>= 1; + } + return -1; } void CQuantizer::AddColor (NODE** ppNode, BYTE r, BYTE g, BYTE b, - UINT nColorBits, UINT nLevel, UINT* pLeafCount, NODE** pReducibleNodes) + UINT nColorBits, UINT nLevel, UINT* pLeafCount, NODE** pReducibleNodes) { - static BYTE mask[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; + static BYTE mask[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; - // - // If the node doesn't exist, create it. - // - if (*ppNode == NULL) - *ppNode = CreateNode (nLevel, nColorBits, pLeafCount, - pReducibleNodes); + // + // If the node doesn't exist, create it. + // + if (*ppNode == NULL) + *ppNode = CreateNode (nLevel, nColorBits, pLeafCount, + pReducibleNodes); - // - // Update color information if it's a leaf node. - // - if ((*ppNode)->bIsLeaf) { - (*ppNode)->nPixelCount++; - (*ppNode)->nRedSum += r; - (*ppNode)->nGreenSum += g; - (*ppNode)->nBlueSum += b; - } + // + // Update color information if it's a leaf node. + // + if ((*ppNode)->bIsLeaf) { + (*ppNode)->nPixelCount++; + (*ppNode)->nRedSum += r; + (*ppNode)->nGreenSum += g; + (*ppNode)->nBlueSum += b; + } - // - // Recurse a level deeper if the node is not a leaf. - // - else { - int shift = 7 - nLevel; - int nIndex = (((r & mask[nLevel]) >> shift) << 2) | - (((g & mask[nLevel]) >> shift) << 1) | - ((b & mask[nLevel]) >> shift); - AddColor (&((*ppNode)->pChild[nIndex]), r, g, b, nColorBits, - nLevel + 1, pLeafCount, pReducibleNodes); - } + // + // Recurse a level deeper if the node is not a leaf. + // + else { + int shift = 7 - nLevel; + int nIndex = (((r & mask[nLevel]) >> shift) << 2) | + (((g & mask[nLevel]) >> shift) << 1) | + ((b & mask[nLevel]) >> shift); + AddColor (&((*ppNode)->pChild[nIndex]), r, g, b, nColorBits, + nLevel + 1, pLeafCount, pReducibleNodes); + } } NODE* CQuantizer::CreateNode (UINT nLevel, UINT nColorBits, UINT* pLeafCount, - NODE** pReducibleNodes) + NODE** pReducibleNodes) { - NODE* pNode; + NODE* pNode; - if ((pNode = (NODE*) HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, - sizeof (NODE))) == NULL) - return NULL; + if ((pNode = (NODE*) HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, + sizeof (NODE))) == NULL) + return NULL; - pNode->bIsLeaf = (nLevel == nColorBits) ? TRUE : FALSE; - if (pNode->bIsLeaf) - (*pLeafCount)++; - else { - pNode->pNext = pReducibleNodes[nLevel]; - pReducibleNodes[nLevel] = pNode; - } - return pNode; + pNode->bIsLeaf = (nLevel == nColorBits) ? TRUE : FALSE; + if (pNode->bIsLeaf) + (*pLeafCount)++; + else { + pNode->pNext = pReducibleNodes[nLevel]; + pReducibleNodes[nLevel] = pNode; + } + return pNode; } void CQuantizer::ReduceTree (UINT nColorBits, UINT* pLeafCount, - NODE** pReducibleNodes) + NODE** pReducibleNodes) { - // - // Find the deepest level containing at least one reducible node. - // + // + // Find the deepest level containing at least one reducible node. + // int i = 0; - for (i=nColorBits - 1; (i>0) && (pReducibleNodes[i] == NULL); i--); + for (i=nColorBits - 1; (i>0) && (pReducibleNodes[i] == NULL); i--); - // - // Reduce the node most recently added to the list at level i. - // + // + // Reduce the node most recently added to the list at level i. + // - NODE* pNode = pReducibleNodes[i]; - pReducibleNodes[i] = pNode->pNext; + NODE* pNode = pReducibleNodes[i]; + pReducibleNodes[i] = pNode->pNext; - UINT nRedSum = 0; - UINT nGreenSum = 0; - UINT nBlueSum = 0; - UINT nChildren = 0; + UINT nRedSum = 0; + UINT nGreenSum = 0; + UINT nBlueSum = 0; + UINT nChildren = 0; - for (i=0; i<8; i++) { - if (pNode->pChild[i] != NULL) { - nRedSum += pNode->pChild[i]->nRedSum; - nGreenSum += pNode->pChild[i]->nGreenSum; - nBlueSum += pNode->pChild[i]->nBlueSum; - pNode->nPixelCount += pNode->pChild[i]->nPixelCount; - HeapFree (GetProcessHeap (), 0, pNode->pChild[i]); - pNode->pChild[i] = NULL; - nChildren++; - } - } + for (i=0; i<8; i++) { + if (pNode->pChild[i] != NULL) { + nRedSum += pNode->pChild[i]->nRedSum; + nGreenSum += pNode->pChild[i]->nGreenSum; + nBlueSum += pNode->pChild[i]->nBlueSum; + pNode->nPixelCount += pNode->pChild[i]->nPixelCount; + HeapFree (GetProcessHeap (), 0, pNode->pChild[i]); + pNode->pChild[i] = NULL; + nChildren++; + } + } - pNode->bIsLeaf = TRUE; - pNode->nRedSum = nRedSum; - pNode->nGreenSum = nGreenSum; - pNode->nBlueSum = nBlueSum; - *pLeafCount -= (nChildren - 1); + pNode->bIsLeaf = TRUE; + pNode->nRedSum = nRedSum; + pNode->nGreenSum = nGreenSum; + pNode->nBlueSum = nBlueSum; + *pLeafCount -= (nChildren - 1); } void CQuantizer::DeleteTree (NODE** ppNode) { - for (int i=0; i<8; i++) { - if ((*ppNode)->pChild[i] != NULL) - DeleteTree (&((*ppNode)->pChild[i])); - } - HeapFree (GetProcessHeap (), 0, *ppNode); - *ppNode = NULL; + for (int i=0; i<8; i++) { + if ((*ppNode)->pChild[i] != NULL) + DeleteTree (&((*ppNode)->pChild[i])); + } + HeapFree (GetProcessHeap (), 0, *ppNode); + *ppNode = NULL; } void CQuantizer::GetPaletteColors (NODE* pTree, RGBQUAD* prgb, UINT* pIndex) { - if (pTree->bIsLeaf) { - prgb[*pIndex].rgbRed = - (BYTE) ((pTree->nRedSum) / (pTree->nPixelCount)); - prgb[*pIndex].rgbGreen = - (BYTE) ((pTree->nGreenSum) / (pTree->nPixelCount)); - prgb[*pIndex].rgbBlue = - (BYTE) ((pTree->nBlueSum) / (pTree->nPixelCount)); - prgb[*pIndex].rgbReserved = 0; - (*pIndex)++; - } - else { - for (int i=0; i<8; i++) { - if (pTree->pChild[i] != NULL) - GetPaletteColors (pTree->pChild[i], prgb, pIndex); - } - } + if (pTree->bIsLeaf) { + prgb[*pIndex].rgbRed = + (BYTE) ((pTree->nRedSum) / (pTree->nPixelCount)); + prgb[*pIndex].rgbGreen = + (BYTE) ((pTree->nGreenSum) / (pTree->nPixelCount)); + prgb[*pIndex].rgbBlue = + (BYTE) ((pTree->nBlueSum) / (pTree->nPixelCount)); + prgb[*pIndex].rgbReserved = 0; + (*pIndex)++; + } + else { + for (int i=0; i<8; i++) { + if (pTree->pChild[i] != NULL) + GetPaletteColors (pTree->pChild[i], prgb, pIndex); + } + } } UINT CQuantizer::GetColorCount () { - return m_nLeafCount; + return m_nLeafCount; } void CQuantizer::GetColorTable (RGBQUAD* prgb) { - UINT nIndex = 0; - GetPaletteColors (m_pTree, prgb, &nIndex); + UINT nIndex = 0; + GetPaletteColors (m_pTree, prgb, &nIndex); } diff --git a/Utils/Quantize.h b/Utils/Quantize.h index 3d8c516a..508ebdeb 100644 --- a/Utils/Quantize.h +++ b/Utils/Quantize.h @@ -2,42 +2,42 @@ #define __QUANTIZE_H_ typedef struct _NODE { - BOOL bIsLeaf; // TRUE if node has no children - UINT nPixelCount; // Number of pixels represented by this leaf - UINT nRedSum; // Sum of red components - UINT nGreenSum; // Sum of green components - UINT nBlueSum; // Sum of blue components - struct _NODE* pChild[8]; // Pointers to child nodes - struct _NODE* pNext; // Pointer to next reducible node + BOOL bIsLeaf; // TRUE if node has no children + UINT nPixelCount; // Number of pixels represented by this leaf + UINT nRedSum; // Sum of red components + UINT nGreenSum; // Sum of green components + UINT nBlueSum; // Sum of blue components + struct _NODE* pChild[8]; // Pointers to child nodes + struct _NODE* pNext; // Pointer to next reducible node } NODE; class CQuantizer { protected: - NODE* m_pTree; - UINT m_nLeafCount; - NODE* m_pReducibleNodes[9]; - UINT m_nMaxColors; - UINT m_nColorBits; + NODE* m_pTree; + UINT m_nLeafCount; + NODE* m_pReducibleNodes[9]; + UINT m_nMaxColors; + UINT m_nColorBits; public: - CQuantizer (UINT nMaxColors, UINT nColorBits); - virtual ~CQuantizer (); - BOOL ProcessImage (BYTE *pData, int iWidth, int iHeight ); - UINT GetColorCount (); - void GetColorTable (RGBQUAD* prgb); + CQuantizer (UINT nMaxColors, UINT nColorBits); + virtual ~CQuantizer (); + BOOL ProcessImage (BYTE *pData, int iWidth, int iHeight ); + UINT GetColorCount (); + void GetColorTable (RGBQUAD* prgb); protected: - int GetLeftShiftCount (DWORD dwVal); - int GetRightShiftCount (DWORD dwVal); - void AddColor (NODE** ppNode, BYTE r, BYTE g, BYTE b, UINT nColorBits, - UINT nLevel, UINT* pLeafCount, NODE** pReducibleNodes); - NODE* CreateNode (UINT nLevel, UINT nColorBits, UINT* pLeafCount, - NODE** pReducibleNodes); - void ReduceTree (UINT nColorBits, UINT* pLeafCount, - NODE** pReducibleNodes); - void DeleteTree (NODE** ppNode); - void GetPaletteColors (NODE* pTree, RGBQUAD* prgb, UINT* pIndex); + int GetLeftShiftCount (DWORD dwVal); + int GetRightShiftCount (DWORD dwVal); + void AddColor (NODE** ppNode, BYTE r, BYTE g, BYTE b, UINT nColorBits, + UINT nLevel, UINT* pLeafCount, NODE** pReducibleNodes); + NODE* CreateNode (UINT nLevel, UINT nColorBits, UINT* pLeafCount, + NODE** pReducibleNodes); + void ReduceTree (UINT nColorBits, UINT* pLeafCount, + NODE** pReducibleNodes); + void DeleteTree (NODE** ppNode); + void GetPaletteColors (NODE* pTree, RGBQUAD* prgb, UINT* pIndex); }; #endif \ No newline at end of file diff --git a/Utils/STIConvert.cpp b/Utils/STIConvert.cpp index c15c09a4..b4650f55 100644 --- a/Utils/STIConvert.cpp +++ b/Utils/STIConvert.cpp @@ -31,11 +31,11 @@ BOOLEAN ConvertToETRLE( UINT8 ** ppDest, UINT32 * puiDestLen, UINT8 ** ppSubImag #define CONVERT_ETRLE_FLIC_NAME 0x0800 #define CONVERT_TO_8_BIT 0x1000 #define CONVERT_TO_16_BIT 0x2000 -// NB 18-bit is actually 24 bit but with only 6 bits used in each byte. I implemented +// NB 18-bit is actually 24 bit but with only 6 bits used in each byte. I implemented // it to see how well such images would compress with ZLIB. #define CONVERT_TO_18_BIT 0x4000 -// Defines for inserting red/green/blue values into a 16-bit pixel. +// Defines for inserting red/green/blue values into a 16-bit pixel. // MASK is the mask to use to get the proper bits out of a byte (part of a 24-bit pixel) // use SHIFT_RIGHT to move the masked bits to the lowest bits of the byte // use SHIFT_LEFT to put the bits in their proper place in the 16-bit pixel @@ -78,7 +78,7 @@ void ConvertRGBDistribution555To565( UINT16 * p16BPPData, UINT32 uiNumberOfPixel { UINT16 * pPixel; UINT32 uiLoop; - + SplitUINT32 Pixel; pPixel = p16BPPData; @@ -99,7 +99,7 @@ void ConvertRGBDistribution555To565( UINT16 * p16BPPData, UINT32 uiNumberOfPixel } } -void WriteSTIFile( INT8 *pData, SGPPaletteEntry *pPalette, INT16 sWidth, INT16 sHeight, STR cOutputName, UINT32 fFlags, UINT32 uiAppDataSize ) +void WriteSTIFile( INT8 *pData, SGPPaletteEntry *pPalette, INT16 sWidth, INT16 sHeight, STR cOutputName, UINT32 fFlags, UINT32 uiAppDataSize ) { FILE * pOutput; @@ -120,10 +120,10 @@ void WriteSTIFile( INT8 *pData, SGPPaletteEntry *pPalette, INT16 sWidth, INT16 s UINT32 uiSubImageBufferSize=0; //UINT16 usLoop; - + memset( &Header, 0, STCI_HEADER_SIZE ); memset( &Image, 0, sizeof( image_type )); - + uiOriginalSize = sWidth * sHeight * (8 / 8); @@ -169,7 +169,7 @@ void WriteSTIFile( INT8 *pData, SGPPaletteEntry *pPalette, INT16 sWidth, INT16 s { return; } - // write header + // write header fwrite( &Header, STCI_HEADER_SIZE, 1, pOutput ); // write palette and subimage structs, if any if (Header.fFlags & STCI_INDEXED) @@ -261,7 +261,6 @@ BOOLEAN ConvertToETRLE( UINT8 ** ppDest, UINT32 * puiDestLen, UINT8 ** ppSubImag BOOLEAN fNextExists; STCISubImage * pCurrSubImage; STCISubImage TempSubImage; - UINT32 uiCompressedSize = 0; UINT32 uiSubImageCompressedSize; UINT32 uiSpaceLeft; @@ -270,7 +269,7 @@ BOOLEAN ConvertToETRLE( UINT8 ** ppDest, UINT32 * puiDestLen, UINT8 ** ppSubImag *ppDest = (UINT8 *) MemAlloc( uiSpaceLeft ); CHECKF( *ppDest ); *puiDestLen = uiSpaceLeft; - + pOutputNext = *ppDest; if (fFlags & CONVERT_ETRLE_COMPRESS_SINGLE) @@ -297,7 +296,7 @@ BOOLEAN ConvertToETRLE( UINT8 ** ppDest, UINT32 * puiDestLen, UINT8 ** ppSubImag if (!(DetermineSubImageUsedSize( p8BPPBuffer, usWidth, usHeight, pCurrSubImage ))) { MemFree( *ppDest ); - return( FALSE ); + return( FALSE ); } } uiSubImageCompressedSize = ETRLECompressSubImage( pOutputNext, uiSpaceLeft, p8BPPBuffer, usWidth, usHeight, pCurrSubImage ); @@ -324,7 +323,7 @@ BOOLEAN ConvertToETRLE( UINT8 ** ppDest, UINT32 * puiDestLen, UINT8 ** ppSubImag } *ppSubImageBuffer = NULL; *pusNumberOfSubImages = 0; - + while (fContinue) { // allocate more memory for SubImage structures, and set the current pointer to the last one @@ -339,9 +338,9 @@ BOOLEAN ConvertToETRLE( UINT8 ** ppDest, UINT32 * puiDestLen, UINT8 ** ppSubImag *ppSubImageBuffer = pTemp; } pCurrSubImage = (STCISubImage *) (*ppSubImageBuffer + (*pusNumberOfSubImages) * STCI_SUBIMAGE_SIZE); - + pCurrSubImage->sOffsetX = sCurrX; - pCurrSubImage->sOffsetY = sCurrY; + pCurrSubImage->sOffsetY = sCurrY; // determine the subimage's full size if (!DetermineSubImageSize( p8BPPBuffer, usWidth, usHeight, pCurrSubImage )) { @@ -352,7 +351,7 @@ BOOLEAN ConvertToETRLE( UINT8 ** ppDest, UINT32 * puiDestLen, UINT8 ** ppSubImag { printf( "\tWarning: no walls (subimage delimiters) found.\n" ); } - + memcpy( &TempSubImage, pCurrSubImage, STCI_SUBIMAGE_SIZE ); if (DetermineSubImageUsedSize( p8BPPBuffer, usWidth, usHeight, &TempSubImage)) { @@ -368,7 +367,7 @@ BOOLEAN ConvertToETRLE( UINT8 ** ppDest, UINT32 * puiDestLen, UINT8 ** ppSubImag // image is transparent; we will store it if there is another subimage // to the right of it on the same line // find the next subimage - fNextExists = GoToNextSubImage( &sNextX, &sNextY, p8BPPBuffer, usWidth, usHeight, sCurrX, sCurrY ); + fNextExists = GoToNextSubImage( &sNextX, &sNextY, p8BPPBuffer, usWidth, usHeight, sCurrX, sCurrY ); if (fNextExists && sNextY == sCurrY ) { fStore = TRUE; @@ -397,7 +396,7 @@ BOOLEAN ConvertToETRLE( UINT8 ** ppDest, UINT32 * puiDestLen, UINT8 ** ppSubImag pCurrSubImage->uiDataOffset = (*puiDestLen - uiSpaceLeft); pCurrSubImage->uiDataLength = uiSubImageCompressedSize; // this is a cheap hack; the sOffsetX and sOffsetY values have been used - // to store the location of the subimage within the whole image. Now + // to store the location of the subimage within the whole image. Now // we want the offset within the subimage, so, we subtract the coordatines // for the upper-left corner of the subimage. pCurrSubImage->sOffsetX -= sCurrX; @@ -454,14 +453,15 @@ UINT32 ETRLECompressSubImage( UINT8 * pDest, UINT32 uiDestLen, UINT8 * p8BPPBuff } UINT32 ETRLECompress( UINT8 * pDest, UINT32 uiDestLen, UINT8 * pSource, UINT32 uiSourceLen ) -{ // Compress a buffer (a scanline) into ETRLE format, which is a series of runs. - // Each run starts with a byte whose high bit is 1 if the run is compressed, 0 otherwise. +{ + // Compress a buffer (a scanline) into ETRLE format, which is a series of runs. + // Each run starts with a byte whose high bit is 1 if the run is compressed, 0 otherwise. // The lower seven bits of that byte indicate the length of the run - + // ETRLECompress returns the number of bytes used by the compressed buffer, or 0 if an error // occurred - // uiSourceLoc keeps track of our current position in the + // uiSourceLoc keeps track of our current position in the // source UINT32 uiSourceLoc = 0; // uiCurrentSourceLoc is used to look ahead in the source to @@ -469,21 +469,21 @@ UINT32 ETRLECompress( UINT8 * pDest, UINT32 uiDestLen, UINT8 * pSource, UINT32 u UINT32 uiCurrentSourceLoc = 0; UINT32 uiDestLoc = 0; UINT8 ubLength = 0; - + while (uiSourceLoc < uiSourceLen && uiDestLoc < uiDestLen) { if (pSource[uiSourceLoc] == TCI) { // transparent run - determine its length do - { + { uiCurrentSourceLoc++; ubLength++; } while ((uiCurrentSourceLoc < uiSourceLen) && pSource[uiCurrentSourceLoc] == TCI && (ubLength < COMPRESS_RUN_LIMIT)); // output run-byte pDest[uiDestLoc] = ubLength | COMPRESS_TRANSPARENT; - + // update location uiSourceLoc += ubLength; uiDestLoc += 1; @@ -500,7 +500,7 @@ UINT32 ETRLECompress( UINT8 * pDest, UINT32 uiDestLen, UINT8 * pSource, UINT32 u { // output run-byte pDest[uiDestLoc++] = ubLength | COMPRESS_NON_TRANSPARENT; - + // output run (and update location) memcpy( pDest + uiDestLoc, pSource + uiSourceLoc, ubLength ); uiSourceLoc += ubLength; @@ -509,7 +509,7 @@ UINT32 ETRLECompress( UINT8 * pDest, UINT32 uiDestLen, UINT8 * pSource, UINT32 u else { // not enough room in dest buffer to copy the run! return( 0 ); - } + } } uiCurrentSourceLoc = uiSourceLoc; ubLength = 0; @@ -518,7 +518,7 @@ UINT32 ETRLECompress( UINT8 * pDest, UINT32 uiDestLen, UINT8 * pSource, UINT32 u { return( 0 ); } - else + else { // end with a run of 0 length (which might as well be non-transparent, // giving a 0-byte @@ -537,7 +537,7 @@ BOOLEAN DetermineOffset( UINT32 * puiOffset, UINT16 usWidth, UINT16 usHeight, IN if (*puiOffset >= (UINT32) usWidth * (UINT32) usHeight) { return( FALSE ); - } + } return( TRUE ); } @@ -559,7 +559,7 @@ BOOLEAN GoPastWall( INT16 * psNewX, INT16 * psNewY, UINT16 usWidth, UINT16 usHei return( FALSE ); } } - } + } *psNewX = sCurrX; *psNewY = sCurrY; @@ -567,14 +567,15 @@ BOOLEAN GoPastWall( INT16 * psNewX, INT16 * psNewY, UINT16 usWidth, UINT16 usHei } BOOLEAN GoToNextSubImage( INT16 * psNewX, INT16 * psNewY, UINT8 * p8BPPBuffer, UINT16 usWidth, UINT16 usHeight, INT16 sOrigX, INT16 sOrigY ) -{ // return the coordinates of the next subimage in the image +{ + // return the coordinates of the next subimage in the image // (either to the right, or the first of the next row down INT16 sCurrX = sOrigX; INT16 sCurrY = sOrigY; UINT32 uiOffset; UINT8 * pCurrent; BOOLEAN fFound = TRUE; - + CHECKF( DetermineOffset( &uiOffset, usWidth, usHeight, sCurrX, sCurrY ) ) pCurrent = p8BPPBuffer + uiOffset; @@ -582,13 +583,13 @@ BOOLEAN GoToNextSubImage( INT16 * psNewX, INT16 * psNewY, UINT8 * p8BPPBuffer, U { return( GoPastWall( psNewX, psNewY, usWidth, usHeight, pCurrent, sCurrX, sCurrY ) ); } - else + else { - // The current pixel is not a wall. We scan right past all non-wall data to skip to + // The current pixel is not a wall. We scan right past all non-wall data to skip to // the right-hand end of the subimage, then right past all wall data to skip a vertical // wall, and should find ourselves at another subimage. - // If we hit the right edge of the image, we back up to our start point, go DOWN to + // If we hit the right edge of the image, we back up to our start point, go DOWN to // the bottom of the image to the horizontal wall, and then recurse to go along it // to the right place on the next scanline @@ -601,7 +602,7 @@ BOOLEAN GoToNextSubImage( INT16 * psNewX, INT16 * psNewY, UINT8 * p8BPPBuffer, U fFound = FALSE; break; } - } + } if (sCurrX < usWidth) { // skip all wall data to the right, starting at the new current position @@ -617,9 +618,9 @@ BOOLEAN GoToNextSubImage( INT16 * psNewX, INT16 * psNewY, UINT8 * p8BPPBuffer, U } } if (fFound) - { + { *psNewX = sCurrX; - *psNewY = sCurrY; + *psNewY = sCurrY; return( TRUE ); } else @@ -627,7 +628,7 @@ BOOLEAN GoToNextSubImage( INT16 * psNewX, INT16 * psNewY, UINT8 * p8BPPBuffer, U // go back to the beginning of the subimage and scan down sCurrX = sOrigX; pCurrent = p8BPPBuffer + uiOffset; - + // skip all non-wall data below, starting at the current position while (*pCurrent != WI) { @@ -655,7 +656,7 @@ BOOLEAN DetermineSubImageSize( UINT8 * p8BPPBuffer, UINT16 usWidth, UINT16 usHei { return( FALSE ); } - + // determine width pCurrent = p8BPPBuffer + uiOffset; do @@ -726,7 +727,7 @@ BOOLEAN DetermineSubImageUsedSize( UINT8 * p8BPPBuffer, UINT16 usWidth, UINT16 u pSubImage->sOffsetX = usNewX; pSubImage->sOffsetY = usNewY; pSubImage->usHeight = usNewHeight; - pSubImage->usWidth = usNewWidth; + pSubImage->usWidth = usNewWidth; return( TRUE ); } @@ -829,3 +830,4 @@ UINT8 * CheckForDataInRowOrColumn( UINT8 * pPixel, UINT16 usIncrement, UINT16 us return( NULL ); } + diff --git a/Utils/STIConvert.h b/Utils/STIConvert.h index 7ffef73e..583e47fa 100644 --- a/Utils/STIConvert.h +++ b/Utils/STIConvert.h @@ -5,7 +5,7 @@ #define CONVERT_ETRLE_COMPRESS 0x0020 #define CONVERT_TO_8_BIT 0x1000 -void WriteSTIFile( INT8 *pData, SGPPaletteEntry *pPalette, INT16 sWidth, INT16 sHeight, STR cOutputName, UINT32 fFlags, UINT32 uiAppDataSize ); +void WriteSTIFile( INT8 *pData, SGPPaletteEntry *pPalette, INT16 sWidth, INT16 sHeight, STR cOutputName, UINT32 fFlags, UINT32 uiAppDataSize ); #endif \ No newline at end of file diff --git a/Utils/Slider.cpp b/Utils/Slider.cpp index 91140af4..ba3cd4ca 100644 --- a/Utils/Slider.cpp +++ b/Utils/Slider.cpp @@ -43,7 +43,7 @@ typedef struct TAG_SLIDER UINT16 usBackGroundColor; - MOUSE_REGION ScrollAreaMouseRegion; + MOUSE_REGION ScrollAreaMouseRegion; UINT32 uiSliderBoxImage; UINT16 usCurrentSliderBoxPosition; @@ -115,8 +115,8 @@ void CalculateNewSliderIncrement( UINT32 uiSliderID, UINT16 usPosX ); BOOLEAN InitSlider() { - VOBJECT_DESC VObjectDesc; - + VOBJECT_DESC VObjectDesc; + // load Slider Box Graphic graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("INTERFACE\\SliderBox.sti", VObjectDesc.ImageFile); @@ -155,9 +155,6 @@ INT32 AddSlider( UINT8 ubStyle, UINT16 usCursor, UINT16 usPosX, UINT16 usPosY, U { SLIDER *pTemp = NULL; SLIDER *pNewSlider = NULL; - //INT32 iNewID=0; - //UINT32 cnt=0; - //UINT16 usIncrementWidth=0; AssertMsg( gfSliderInited, "Trying to Add a Slider Bar when the Slider System was never inited"); @@ -196,7 +193,7 @@ INT32 AddSlider( UINT8 ubStyle, UINT16 usCursor, UINT16 usPosX, UINT16 usPosY, U // // Create the mouse regions for each increment in the slider // - + //add the region usPosX = pNewSlider->usPosX; usPosY = pNewSlider->usPosY; @@ -214,10 +211,10 @@ INT32 AddSlider( UINT8 ubStyle, UINT16 usCursor, UINT16 usPosX, UINT16 usPosY, U MSYS_DefineRegion( &pNewSlider->ScrollAreaMouseRegion, (UINT16)(usPosX-pNewSlider->usWidth/2), usPosY, (UINT16)(usPosX+pNewSlider->usWidth/2), (UINT16)(pNewSlider->usPosY+pNewSlider->usHeight), sPriority, - usCursor, SelectedSliderMovementCallBack, SelectedSliderButtonCallBack ); + usCursor, SelectedSliderMovementCallBack, SelectedSliderButtonCallBack ); MSYS_SetRegionUserData( &pNewSlider->ScrollAreaMouseRegion, 1, pNewSlider->uiSliderID ); break; - + case SLIDER_DEFAULT_STYLE: default: @@ -226,7 +223,7 @@ INT32 AddSlider( UINT8 ubStyle, UINT16 usCursor, UINT16 usPosX, UINT16 usPosY, U pNewSlider->usHeight = DEFUALT_SLIDER_SIZE; MSYS_DefineRegion( &pNewSlider->ScrollAreaMouseRegion, usPosX, (UINT16)(usPosY-DEFUALT_SLIDER_SIZE), (UINT16)(pNewSlider->usPosX+pNewSlider->usWidth), (UINT16)(usPosY+DEFUALT_SLIDER_SIZE), sPriority, - usCursor, SelectedSliderMovementCallBack, SelectedSliderButtonCallBack ); + usCursor, SelectedSliderMovementCallBack, SelectedSliderButtonCallBack ); MSYS_SetRegionUserData( &pNewSlider->ScrollAreaMouseRegion, 1, pNewSlider->uiSliderID ); break; } @@ -234,7 +231,7 @@ INT32 AddSlider( UINT8 ubStyle, UINT16 usCursor, UINT16 usPosX, UINT16 usPosY, U // // Load the graphic image for the slider box - // + // //add the slider into the list pTemp = pSliderHead; @@ -252,7 +249,7 @@ INT32 AddSlider( UINT8 ubStyle, UINT16 usCursor, UINT16 usPosX, UINT16 usPosY, U { pTemp = pTemp->pNext; } - + pTemp->pNext = pNewSlider; pNewSlider->pPrev = pTemp; pNewSlider->pNext = NULL; @@ -278,8 +275,8 @@ void RenderAllSliderBars() else usPosY = gusMouseYPos - gpCurrentSlider->usPosY; - //if the mouse - CalculateNewSliderIncrement( gpCurrentSlider->uiSliderID, usPosY ); + //if the mouse + CalculateNewSliderIncrement( gpCurrentSlider->uiSliderID, usPosY ); } else { @@ -305,10 +302,10 @@ void RenderSelectedSliderBar( SLIDER *pSlider ) if( pSlider->uiFlags & SLIDER_VERTICAL ) { - } + } else { - //display the background ( the bar ) + //display the background ( the bar ) OptDisplayLine( (UINT16)(pSlider->usPosX+1), (UINT16)(pSlider->usPosY-1), (UINT16)(pSlider->usPosX + pSlider->usWidth-1), (UINT16)(pSlider->usPosY-1), pSlider->usBackGroundColor ); OptDisplayLine( pSlider->usPosX, pSlider->usPosY, (UINT16)(pSlider->usPosX + pSlider->usWidth), pSlider->usPosY, pSlider->usBackGroundColor ); OptDisplayLine( (UINT16)(pSlider->usPosX+1), (UINT16)(pSlider->usPosY+1), (UINT16)(pSlider->usPosX + pSlider->usWidth-1), (UINT16)(pSlider->usPosY+1), pSlider->usBackGroundColor ); @@ -322,7 +319,7 @@ void RenderSelectedSliderBar( SLIDER *pSlider ) void RenderSliderBox( SLIDER *pSlider ) { - HVOBJECT hPixHandle; + HVOBJECT hPixHandle; SGPRect SrcRect; SGPRect DestRect; @@ -340,7 +337,7 @@ void RenderSliderBox( SLIDER *pSlider ) DestRect.iRight = DestRect.iLeft + pSlider->ubSliderWidth; DestRect.iBottom = DestRect.iTop + pSlider->ubSliderHeight; - + //If it is not the first time to render the slider if( !( pSlider->LastRect.iLeft == 0 && pSlider->LastRect.iRight == 0 ) ) { @@ -480,7 +477,7 @@ void SelectedSliderMovementCallBack(MOUSE_REGION * pRegion, INT32 reason ) if( pSlider->uiFlags & SLIDER_VERTICAL ) { CalculateNewSliderIncrement( uiSelectedSlider, pRegion->RelativeYPos ); - } + } else { CalculateNewSliderIncrement( uiSelectedSlider, pRegion->RelativeXPos ); @@ -505,7 +502,7 @@ void SelectedSliderMovementCallBack(MOUSE_REGION * pRegion, INT32 reason ) if( pSlider->uiFlags & SLIDER_VERTICAL ) { CalculateNewSliderIncrement( uiSelectedSlider, pRegion->RelativeYPos ); - } + } else { CalculateNewSliderIncrement( uiSelectedSlider, pRegion->RelativeXPos ); @@ -531,19 +528,19 @@ void SelectedSliderMovementCallBack(MOUSE_REGION * pRegion, INT32 reason ) if( pSlider->uiFlags & SLIDER_VERTICAL ) { CalculateNewSliderIncrement( uiSelectedSlider, pRegion->RelativeYPos ); - } + } else { CalculateNewSliderIncrement( uiSelectedSlider, pRegion->RelativeXPos ); } } } -} +} void SelectedSliderButtonCallBack(MOUSE_REGION * pRegion, INT32 iReason ) -{ +{ UINT32 uiSelectedSlider; SLIDER *pSlider=NULL; @@ -573,16 +570,16 @@ void SelectedSliderButtonCallBack(MOUSE_REGION * pRegion, INT32 iReason ) if( pSlider->uiFlags & SLIDER_VERTICAL ) { CalculateNewSliderIncrement( uiSelectedSlider, pRegion->RelativeYPos ); - } + } else { CalculateNewSliderIncrement( uiSelectedSlider, pRegion->RelativeXPos ); } - } + } else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) { uiSelectedSlider = MSYS_GetRegionUserData( pRegion, 1 ); - + pSlider = GetSliderFromID( uiSelectedSlider ); if( pSlider == NULL ) return; @@ -597,7 +594,7 @@ void SelectedSliderButtonCallBack(MOUSE_REGION * pRegion, INT32 iReason ) if( pSlider->uiFlags & SLIDER_VERTICAL ) { CalculateNewSliderIncrement( uiSelectedSlider, pRegion->RelativeYPos ); - } + } else { CalculateNewSliderIncrement( uiSelectedSlider, pRegion->RelativeXPos ); @@ -606,7 +603,7 @@ void SelectedSliderButtonCallBack(MOUSE_REGION * pRegion, INT32 iReason ) else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) { - } + } } @@ -633,7 +630,7 @@ void CalculateNewSliderIncrement( UINT32 uiSliderID, UINT16 usPos ) if( usPos <= (UINT16)(pSlider->usHeight * (FLOAT).01 ) ) fFirstSpot = TRUE; - + //pSlider->usNumberOfIncrements if( fFirstSpot ) dNewIncrement = 0; @@ -675,14 +672,14 @@ void CalculateNewSliderIncrement( UINT32 uiSliderID, UINT16 usPos ) void OptDisplayLine( UINT16 usStartX, UINT16 usStartY, UINT16 EndX, UINT16 EndY, INT16 iColor ) { - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - // draw the line + // draw the line LineDraw(FALSE, usStartX, usStartY, EndX, EndY, iColor, pDestBuf); // unlock frame buffer @@ -752,8 +749,8 @@ SLIDER *GetSliderFromID( UINT32 uiSliderID ) // if we couldnt find the right slider if( pTemp == NULL ) return( NULL ); - - return( pTemp ); + + return( pTemp ); } @@ -776,3 +773,4 @@ void SetSliderValue( UINT32 uiSliderID, UINT32 uiNewValue ) CalculateNewSliderBoxPosition( pSlider ); } + diff --git a/Utils/Sound Control.cpp b/Utils/Sound Control.cpp index 282c29cc..394bf48e 100644 --- a/Utils/Sound Control.cpp +++ b/Utils/Sound Control.cpp @@ -13,7 +13,7 @@ #include "math.h" #endif -#define SOUND_FAR_VOLUME_MOD 25 +#define SOUND_FAR_VOLUME_MOD 25 /* UINT32 LOWVOLUME START_LOWVOLUME; @@ -103,7 +103,7 @@ char szSoundEffects[MAX_SAMPLES][255];// = // "SOUNDS\\BULLET IMPACT 02.WAV", // // "STSOUNDS\\BLAH.WAV", // CREATURE ATTACK -// +// // "SOUNDS\\STEP INTO WATER.WAV", // "SOUNDS\\SPLASH FROM SHALLOW TO DEEP.WAV", // @@ -142,14 +142,14 @@ char szSoundEffects[MAX_SAMPLES][255];// = // "SOUNDS\\STONE IMPACT 01.WAV", // "SOUNDS\\WATER IMPACT 01.WAV", // "SOUNDS\\VEG IMPACT 01.WAV", -// "SOUNDS\\METAL HIT 01.WAV", // S_METAL_HIT1 -// "SOUNDS\\METAL HIT 01.WAV", -// "SOUNDS\\METAL HIT 01.WAV", +// "SOUNDS\\METAL HIT 01.WAV", // S_METAL_HIT1 +// "SOUNDS\\METAL HIT 01.WAV", +// "SOUNDS\\METAL HIT 01.WAV", // // "SOUNDS\\SLAP_IMPACT.WAV", // // // FIREARM RELOAD -// "SOUNDS\\WEAPONS\\REVOLVER RELOAD.WAV", // REVOLVER +// "SOUNDS\\WEAPONS\\REVOLVER RELOAD.WAV", // REVOLVER // "SOUNDS\\WEAPONS\\PISTOL RELOAD.WAV", // PISTOL // "SOUNDS\\WEAPONS\\SMG RELOAD.WAV", // SMG // "SOUNDS\\WEAPONS\\RIFLE RELOAD.WAV", // RIFLE @@ -157,7 +157,7 @@ char szSoundEffects[MAX_SAMPLES][255];// = // "SOUNDS\\WEAPONS\\LMG RELOAD.WAV", // LMG // // // FIREARM LOCKNLOAD -// "SOUNDS\\WEAPONS\\REVOLVER LNL.WAV", // REVOLVER +// "SOUNDS\\WEAPONS\\REVOLVER LNL.WAV", // REVOLVER // "SOUNDS\\WEAPONS\\PISTOL LNL.WAV", // PISTOL // "SOUNDS\\WEAPONS\\SMG LNL.WAV", // SMG // "SOUNDS\\WEAPONS\\RIFLE LNL.WAV", // RIFLE @@ -168,7 +168,7 @@ char szSoundEffects[MAX_SAMPLES][255];// = // "SOUNDS\\WEAPONS\\SMALL ROCKET LAUNCHER.WAV", // SMALL ROCKET LUANCHER // "SOUNDS\\WEAPONS\\MORTAR FIRE 01.WAV", // GRENADE LAUNCHER // "SOUNDS\\WEAPONS\\MORTAR FIRE 01.WAV", // UNDERSLUNG GRENADE LAUNCHER -// "SOUNDS\\WEAPONS\\ROCKET LAUNCHER.WAV", +// "SOUNDS\\WEAPONS\\ROCKET LAUNCHER.WAV", // "SOUNDS\\WEAPONS\\MORTAR FIRE 01.WAV", // // // FIREARMS @@ -263,7 +263,7 @@ char szSoundEffects[MAX_SAMPLES][255];// = // "SOUNDS\\ARMPIT.WAV", // "SOUNDS\\CRACKING BACK.WAV", // -// "SOUNDS\\WEAPONS\\Auto Resolve Composite 02 (8-22).wav",// The FF sound in autoresolve interface +// "SOUNDS\\WEAPONS\\Auto Resolve Composite 02 (8-22).wav",// The FF sound in autoresolve interface // // "SOUNDS\\Email Alert 01.wav", // "SOUNDS\\Entering Text 02.wav", @@ -315,10 +315,10 @@ char szSoundEffects[MAX_SAMPLES][255];// = // "SOUNDS\\remote activate.WAV", // "SOUNDS\\wirecutters.WAV", // "SOUNDS\\drink from canteen.WAV", -// "SOUNDS\\bloodcat attack.wav", -// "SOUNDS\\bloodcat loud roar.wav", -// "SOUNDS\\robot greeting.wav", -// "SOUNDS\\robot death.wav", +// "SOUNDS\\bloodcat attack.wav", +// "SOUNDS\\bloodcat loud roar.wav", +// "SOUNDS\\robot greeting.wav", +// "SOUNDS\\robot death.wav", // "SOUNDS\\gas grenade explode.WAV", // "SOUNDS\\air escaping.WAV", // "SOUNDS\\drawer open.WAV", @@ -328,53 +328,53 @@ char szSoundEffects[MAX_SAMPLES][255];// = // "SOUNDS\\wooden box open.WAV", // "SOUNDS\\wooden box close.WAV", // "SOUNDS\\robot stop moving.WAV", -// "SOUNDS\\water movement 01.wav", -// "SOUNDS\\water movement 02.wav", -// "SOUNDS\\water movement 03.wav", -// "SOUNDS\\water movement 04.wav", -// "SOUNDS\\PRONE TO CROUCH.WAV", -// "SOUNDS\\CROUCH TO PRONE.WAV", -// "SOUNDS\\CROUCH TO STAND.WAV", -// "SOUNDS\\STAND TO CROUCH.WAV", -// "SOUNDS\\picking something up.WAV", -// "SOUNDS\\cow falling.wav", -// "SOUNDS\\bloodcat_growl_01.wav", -// "SOUNDS\\bloodcat_growl_02.wav", -// "SOUNDS\\bloodcat_growl_03.wav", -// "SOUNDS\\bloodcat_growl_04.wav", -// "SOUNDS\\spit ricochet.wav", +// "SOUNDS\\water movement 01.wav", +// "SOUNDS\\water movement 02.wav", +// "SOUNDS\\water movement 03.wav", +// "SOUNDS\\water movement 04.wav", +// "SOUNDS\\PRONE TO CROUCH.WAV", +// "SOUNDS\\CROUCH TO PRONE.WAV", +// "SOUNDS\\CROUCH TO STAND.WAV", +// "SOUNDS\\STAND TO CROUCH.WAV", +// "SOUNDS\\picking something up.WAV", +// "SOUNDS\\cow falling.wav", +// "SOUNDS\\bloodcat_growl_01.wav", +// "SOUNDS\\bloodcat_growl_02.wav", +// "SOUNDS\\bloodcat_growl_03.wav", +// "SOUNDS\\bloodcat_growl_04.wav", +// "SOUNDS\\spit ricochet.wav", // "SOUNDS\\ADULT crippled.WAV", -// "SOUNDS\\death disintegration.wav", -// "SOUNDS\\Queen Ambience.wav", -// "SOUNDS\\Alien Impact.wav", -// "SOUNDS\\crow pecking flesh 01.wav", -// "SOUNDS\\crow fly.wav", -// "SOUNDS\\slap 02.wav", -// "SOUNDS\\setting up mortar.wav", -// "SOUNDS\\mortar whistle.wav", -// "SOUNDS\\load mortar.wav", -// "SOUNDS\\tank turret a.wav", -// "SOUNDS\\tank turret b.wav", -// "SOUNDS\\cow falling b.wav", -// "SOUNDS\\stab into flesh.wav", -// "SOUNDS\\explosion 10.wav", -// "SOUNDS\\explosion 12.wav", +// "SOUNDS\\death disintegration.wav", +// "SOUNDS\\Queen Ambience.wav", +// "SOUNDS\\Alien Impact.wav", +// "SOUNDS\\crow pecking flesh 01.wav", +// "SOUNDS\\crow fly.wav", +// "SOUNDS\\slap 02.wav", +// "SOUNDS\\setting up mortar.wav", +// "SOUNDS\\mortar whistle.wav", +// "SOUNDS\\load mortar.wav", +// "SOUNDS\\tank turret a.wav", +// "SOUNDS\\tank turret b.wav", +// "SOUNDS\\cow falling b.wav", +// "SOUNDS\\stab into flesh.wav", +// "SOUNDS\\explosion 10.wav", +// "SOUNDS\\explosion 12.wav", // "SOUNDS\\drink from canteen male.WAV", // "SOUNDS\\x ray activated.WAV", -// "SOUNDS\\catch object.wav", -// "SOUNDS\\fence open.wav", +// "SOUNDS\\catch object.wav", +// "SOUNDS\\fence open.wav", ////MADD MARKER ////New Guns // "SOUNDS\\WEAPONS\\50CAL.WAV", // "SOUNDS\\WEAPONS\\VALSILENT.WAV" -//// "SOUNDS\\BreakLight.wav", +//// "SOUNDS\\BreakLight.wav", //}; char szAmbientEffects[NUM_AMBIENTS][255] = { - "SOUNDS\\storm1.wav", - "SOUNDS\\storm2.wav", + "SOUNDS\\storm1.wav", + "SOUNDS\\storm2.wav", "SOUNDS\\rain_loop_22k.wav", "SOUNDS\\bird1-22k.wav", "SOUNDS\\bird3-22k.wav", @@ -408,7 +408,7 @@ UINT8 AmbientVols[NUM_AMBIENTS]={ SOUNDPARMS gDelayedSoundParms; -UINT32 guiDelayedSoundNum; +UINT32 guiDelayedSoundNum; void DelayedSoundTimerCallback( void ); @@ -437,7 +437,7 @@ BOOLEAN ShutdownJA2Sound( ) //} return( TRUE ); -} +} UINT32 PlayJA2Sample( UINT32 usNum, UINT32 usRate, UINT32 ubVolume, UINT32 ubLoops, UINT32 uiPan ) { @@ -448,10 +448,10 @@ UINT32 PlayJA2Sample( UINT32 usNum, UINT32 usRate, UINT32 ubVolume, UINT32 ubLoo memset(&spParms, 0xff, sizeof(SOUNDPARMS)); spParms.uiSpeed = usRate; - + if ( strstr( szSoundEffects[usNum], "WEAPONS" ) == NULL ) { - spParms.uiVolume = CalculateSoundEffectsVolume( ubVolume ); + spParms.uiVolume = CalculateSoundEffectsVolume( ubVolume ); } else { @@ -471,7 +471,7 @@ UINT32 PlayJA2Sample( UINT32 usNum, UINT32 usRate, UINT32 ubVolume, UINT32 ubLoo UINT32 PlayJA2StreamingSample( UINT32 usNum, UINT32 usRate, UINT32 ubVolume, UINT32 ubLoops, UINT32 uiPan ) { - SOUNDPARMS spParms; + SOUNDPARMS spParms; memset(&spParms, 0xff, sizeof(SOUNDPARMS)); @@ -505,7 +505,7 @@ UINT32 PlayJA2SampleFromFile( STR8 szFileName, UINT32 usRate, UINT32 ubVolume, U { spParms.uiVolume = (UINT32)( ( ubVolume / (FLOAT) HIGHVOLUME ) * guiSoundEffectsVolume +.5 ) * (1 + gGameExternalOptions.guiWeaponSoundEffectsVolume / 100); } - + spParms.uiLoop = ubLoops; spParms.uiPan = uiPan; spParms.uiPriority=GROUP_PLAYER; @@ -520,7 +520,7 @@ UINT32 PlayJA2StreamingSampleFromFile( STR8 szFileName, UINT32 usRate, UINT32 ub // does the same thing as PlayJA2Sound, but one only has to pass the filename, not the index of the sound array - SOUNDPARMS spParms; + SOUNDPARMS spParms; memset(&spParms, 0xff, sizeof(SOUNDPARMS)); @@ -529,7 +529,7 @@ UINT32 PlayJA2StreamingSampleFromFile( STR8 szFileName, UINT32 usRate, UINT32 ub spParms.uiLoop = ubLoops; spParms.uiPan = uiPan; spParms.uiPriority=GROUP_PLAYER; - spParms.EOSCallback=EndsCallback; + spParms.EOSCallback=EndsCallback; return( SoundPlayStreamedFile(szFileName, &spParms) ); } @@ -569,13 +569,13 @@ UINT32 PlaySoldierJA2Sample( UINT16 usID, UINT32 usNum, UINT32 usRate, UINT32 ub { if( !( gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) - { - // CHECK IF GUY IS ON SCREEN BEFORE PLAYING! - if ( ( MercPtrs[ usID ]->bVisible != -1 ) || !fCheck ) - { - return( PlayJA2Sample( usNum, usRate, CalculateSoundEffectsVolume( ubVolume ), ubLoops, uiPan ) ); - } - } + { + // CHECK IF GUY IS ON SCREEN BEFORE PLAYING! + if ( ( MercPtrs[ usID ]->bVisible != -1 ) || !fCheck ) + { + return( PlayJA2Sample( usNum, usRate, CalculateSoundEffectsVolume( ubVolume ), ubLoops, uiPan ) ); + } + } return( 0 ); } @@ -587,7 +587,7 @@ UINT32 PlaySoldierJA2Sample( UINT16 usID, UINT32 usNum, UINT32 usRate, UINT32 ub void SetSpeechVolume( UINT32 uiNewVolume ) { - guiSpeechVolume = __min( uiNewVolume, 127); + guiSpeechVolume = __min( uiNewVolume, 127); } @@ -600,7 +600,7 @@ UINT32 GetSpeechVolume( ) void SetSoundEffectsVolume( UINT32 uiNewVolume ) { - guiSoundEffectsVolume = __min( uiNewVolume, 127); + guiSoundEffectsVolume = __min( uiNewVolume, 127); } @@ -632,26 +632,26 @@ int x,dif,absDif; dif = ScreenMiddleX - x; if ( (absDif=abs(dif)) > 32) - { - // OK, NOT the middle. + { + // OK, NOT the middle. - // Is it outside the screen? - if (absDif > HalfWindowWidth) - { - // yes, outside... - if (dif > 0) - return(25); - else - return(102); - } - else // inside screen - if (dif > 0) - return(LEFTSIDE); - else - return(RIGHTSIDE); - } + // Is it outside the screen? + if (absDif > HalfWindowWidth) + { + // yes, outside... + if (dif > 0) + return(25); + else + return(102); + } + else // inside screen + if (dif > 0) + return(LEFTSIDE); + else + return(RIGHTSIDE); + } else // hardly any difference, so sound should be played from middle - return(MIDDLE); + return(MIDDLE); } #endif @@ -664,10 +664,10 @@ INT32 SoundDir( INT16 sGridNo ) INT16 sMiddleX; INT16 sDif, sAbsDif; - if ( sGridNo == NOWHERE ) - { - return( MIDDLEPAN ); - } + if ( sGridNo == NOWHERE ) + { + return( MIDDLEPAN ); + } // OK, get screen position of gridno..... ConvertGridNoToXY( sGridNo, &sWorldX, &sWorldY ); @@ -681,21 +681,21 @@ INT32 SoundDir( INT16 sGridNo ) sDif = sMiddleX - sScreenX; if ( ( sAbsDif = (INT16) abs( sDif ) ) > 64 ) - { + { // OK, NOT the middle. // Is it outside the screen? if ( sAbsDif > ( ( gsBottomRightWorldX - gsTopLeftWorldX ) / 2 ) ) - { + { // yes, outside... if ( sDif > 0 ) { return( FARLEFT ); //return( 1 ); } - else - return( FARRIGHT ); - //return( 126 ); - } + else + return( FARRIGHT ); + //return( 126 ); + } else // inside screen { if ( sDif > 0) @@ -703,9 +703,9 @@ INT32 SoundDir( INT16 sGridNo ) else return( RIGHTSIDE ); } - } + } else // hardly any difference, so sound should be played from middle - return(MIDDLE); + return(MIDDLE); } @@ -717,10 +717,10 @@ INT32 SoundVolume( INT8 bInitialVolume, INT16 sGridNo ) INT16 sDifX, sAbsDifX; INT16 sDifY, sAbsDifY; - if ( sGridNo == NOWHERE ) - { - return( bInitialVolume ); - } + if ( sGridNo == NOWHERE ) + { + return( bInitialVolume ); + } // OK, get screen position of gridno..... ConvertGridNoToXY( sGridNo, &sWorldX, &sWorldY ); @@ -738,16 +738,16 @@ INT32 SoundVolume( INT8 bInitialVolume, INT16 sGridNo ) sAbsDifX = (INT16) abs( sDifX ); sAbsDifY = (INT16) abs( sDifY ); - if ( sAbsDifX > 64 || sAbsDifY > 64 ) - { + if ( sAbsDifX > 64 || sAbsDifY > 64 ) + { // OK, NOT the middle. // Is it outside the screen? - if ( sAbsDifX > ( ( gsBottomRightWorldX - gsTopLeftWorldX ) / 2 ) || - sAbsDifY > ( ( gsBottomRightWorldY - gsTopLeftWorldY ) / 2 ) ) - { + if ( sAbsDifX > ( ( gsBottomRightWorldX - gsTopLeftWorldX ) / 2 ) || + sAbsDifY > ( ( gsBottomRightWorldY - gsTopLeftWorldY ) / 2 ) ) + { return( __max( LOWVOLUME, ( bInitialVolume - SOUND_FAR_VOLUME_MOD ) ) ); - } - } + } + } return( bInitialVolume ); } @@ -791,13 +791,13 @@ void DelayedSoundTimerCallback( void ) typedef struct { - UINT32 uiFlags; - INT16 sGridNo; - INT32 iSoundSampleID; - INT32 iSoundToPlay; - UINT32 uiData; - BOOLEAN fAllocated; - BOOLEAN fInActive; + UINT32 uiFlags; + INT16 sGridNo; + INT32 iSoundSampleID; + INT32 iSoundToPlay; + UINT32 uiData; + BOOLEAN fAllocated; + BOOLEAN fInActive; } POSITIONSND; @@ -805,7 +805,7 @@ typedef struct // GLOBAL FOR SMOKE LISTING POSITIONSND gPositionSndData[ NUM_POSITION_SOUND_EFFECT_SLOTS ]; UINT32 guiNumPositionSnds = 0; -BOOLEAN gfPositionSoundsActive = FALSE; +BOOLEAN gfPositionSoundsActive = FALSE; INT32 GetFreePositionSnd( void ); @@ -857,114 +857,114 @@ INT32 NewPositionSnd( INT16 sGridNo, UINT32 uiFlags, UINT32 uiData, UINT32 iSoun pPositionSnd = &gPositionSndData[ iPositionSndIndex ]; - // Default to inactive + // Default to inactive - if ( gfPositionSoundsActive ) - { - pPositionSnd->fInActive = FALSE; - } - else - { - pPositionSnd->fInActive = TRUE; - } - - pPositionSnd->sGridNo = sGridNo; - pPositionSnd->uiData = uiData; - pPositionSnd->uiFlags = uiFlags; - pPositionSnd->fAllocated = TRUE; - pPositionSnd->iSoundToPlay = iSoundToPlay; + if ( gfPositionSoundsActive ) + { + pPositionSnd->fInActive = FALSE; + } + else + { + pPositionSnd->fInActive = TRUE; + } - pPositionSnd->iSoundSampleID = NO_SAMPLE; + pPositionSnd->sGridNo = sGridNo; + pPositionSnd->uiData = uiData; + pPositionSnd->uiFlags = uiFlags; + pPositionSnd->fAllocated = TRUE; + pPositionSnd->iSoundToPlay = iSoundToPlay; - return( iPositionSndIndex ); + pPositionSnd->iSoundSampleID = NO_SAMPLE; + + return( iPositionSndIndex ); } void DeletePositionSnd( INT32 iPositionSndIndex ) { POSITIONSND *pPositionSnd; - pPositionSnd = &gPositionSndData[ iPositionSndIndex ]; + pPositionSnd = &gPositionSndData[ iPositionSndIndex ]; - if ( pPositionSnd->fAllocated ) - { - // Turn inactive first... - pPositionSnd->fInActive = TRUE; + if ( pPositionSnd->fAllocated ) + { + // Turn inactive first... + pPositionSnd->fInActive = TRUE; - // End sound... - if ( pPositionSnd->iSoundSampleID != NO_SAMPLE ) - { - SoundStop( pPositionSnd->iSoundSampleID ); - } + // End sound... + if ( pPositionSnd->iSoundSampleID != NO_SAMPLE ) + { + SoundStop( pPositionSnd->iSoundSampleID ); + } - pPositionSnd->fAllocated = FALSE; + pPositionSnd->fAllocated = FALSE; - RecountPositionSnds( ); - } + RecountPositionSnds( ); + } } void SetPositionSndGridNo( INT32 iPositionSndIndex, INT16 sGridNo ) { POSITIONSND *pPositionSnd; - pPositionSnd = &gPositionSndData[ iPositionSndIndex ]; + pPositionSnd = &gPositionSndData[ iPositionSndIndex ]; - if ( pPositionSnd->fAllocated ) - { - pPositionSnd->sGridNo = sGridNo; + if ( pPositionSnd->fAllocated ) + { + pPositionSnd->sGridNo = sGridNo; - SetPositionSndsVolumeAndPanning( ); - } + SetPositionSndsVolumeAndPanning( ); + } } void SetPositionSndsActive( ) { - UINT32 cnt; + UINT32 cnt; POSITIONSND *pPositionSnd; - gfPositionSoundsActive = TRUE; + gfPositionSoundsActive = TRUE; - for ( cnt = 0; cnt < guiNumPositionSnds; cnt++ ) - { - pPositionSnd = &gPositionSndData[ cnt ]; + for ( cnt = 0; cnt < guiNumPositionSnds; cnt++ ) + { + pPositionSnd = &gPositionSndData[ cnt ]; - if ( pPositionSnd->fAllocated ) - { - if ( pPositionSnd->fInActive ) - { - pPositionSnd->fInActive = FALSE; + if ( pPositionSnd->fAllocated ) + { + if ( pPositionSnd->fInActive ) + { + pPositionSnd->fInActive = FALSE; - // Begin sound effect - // Volume 0 - pPositionSnd->iSoundSampleID = PlayJA2Sample( pPositionSnd->iSoundToPlay, RATE_11025, 0, 0, MIDDLEPAN ); - } - } - } + // Begin sound effect + // Volume 0 + pPositionSnd->iSoundSampleID = PlayJA2Sample( pPositionSnd->iSoundToPlay, RATE_11025, 0, 0, MIDDLEPAN ); + } + } + } } void SetPositionSndsInActive( ) { - UINT32 cnt; + UINT32 cnt; POSITIONSND *pPositionSnd; - gfPositionSoundsActive = FALSE; + gfPositionSoundsActive = FALSE; - for ( cnt = 0; cnt < guiNumPositionSnds; cnt++ ) - { - pPositionSnd = &gPositionSndData[ cnt ]; + for ( cnt = 0; cnt < guiNumPositionSnds; cnt++ ) + { + pPositionSnd = &gPositionSndData[ cnt ]; - if ( pPositionSnd->fAllocated ) - { - pPositionSnd->fInActive = TRUE; + if ( pPositionSnd->fAllocated ) + { + pPositionSnd->fInActive = TRUE; - // End sound... - if ( pPositionSnd->iSoundSampleID != NO_SAMPLE ) - { - SoundStop( pPositionSnd->iSoundSampleID ); - pPositionSnd->iSoundSampleID = NO_SAMPLE; - } - } - } + // End sound... + if ( pPositionSnd->iSoundSampleID != NO_SAMPLE ) + { + SoundStop( pPositionSnd->iSoundSampleID ); + pPositionSnd->iSoundSampleID = NO_SAMPLE; + } + } + } } // == Lesh slightly changed this function ============ @@ -975,10 +975,10 @@ UINT8 PositionSoundDir( INT16 sGridNo ) INT16 sMiddleX; INT16 sDif, sAbsDif; - if ( sGridNo == NOWHERE ) - { - return( MIDDLEPAN ); - } + if ( sGridNo == NOWHERE ) + { + return( MIDDLEPAN ); + } // OK, get screen position of gridno..... ConvertGridNoToXY( sGridNo, &sWorldX, &sWorldY ); @@ -992,23 +992,23 @@ UINT8 PositionSoundDir( INT16 sGridNo ) sDif = sMiddleX - sScreenX; if ( ( sAbsDif = (INT16) abs( sDif ) ) > 64 ) - { + { // OK, NOT the middle. - + // Is it outside the screen? if ( sAbsDif > ( ( gsBottomRightWorldX - gsTopLeftWorldX ) / 2 ) ) - { + { // yes, outside... if ( sDif > 0 ) { return( FARLEFT ); //return( 1 ); } - else - return( FARRIGHT ); - //return( 126 ); + else + return( FARRIGHT ); + //return( 126 ); - } + } else // inside screen { if ( sDif > 0) @@ -1016,9 +1016,9 @@ UINT8 PositionSoundDir( INT16 sGridNo ) else return( RIGHTSIDE ); } - } + } else // hardly any difference, so sound should be played from middle - return(MIDDLE); + return(MIDDLE); } @@ -1029,13 +1029,13 @@ INT8 PositionSoundVolume( INT8 bInitialVolume, INT16 sGridNo ) INT16 sMiddleX, sMiddleY; INT16 sDifX, sAbsDifX; INT16 sDifY, sAbsDifY; - INT16 sMaxDistX, sMaxDistY; - double sMaxSoundDist, sSoundDist; + INT16 sMaxDistX, sMaxDistY; + double sMaxSoundDist, sSoundDist; - if ( sGridNo == NOWHERE ) - { - return( bInitialVolume ); - } + if ( sGridNo == NOWHERE ) + { + return( bInitialVolume ); + } // OK, get screen position of gridno..... ConvertGridNoToXY( sGridNo, &sWorldX, &sWorldY ); @@ -1053,60 +1053,60 @@ INT8 PositionSoundVolume( INT8 bInitialVolume, INT16 sGridNo ) sAbsDifX = (INT16) abs( sDifX ); sAbsDifY = (INT16) abs( sDifY ); - sMaxDistX = (INT16)( ( gsBottomRightWorldX - gsTopLeftWorldX ) * 1.5 ); - sMaxDistY = (INT16)( ( gsBottomRightWorldY - gsTopLeftWorldY ) * 1.5 ); + sMaxDistX = (INT16)( ( gsBottomRightWorldX - gsTopLeftWorldX ) * 1.5 ); + sMaxDistY = (INT16)( ( gsBottomRightWorldY - gsTopLeftWorldY ) * 1.5 ); - sMaxSoundDist = sqrt( (double) ( sMaxDistX * sMaxDistX ) + ( sMaxDistY * sMaxDistY ) ); - sSoundDist = sqrt( (double)( sAbsDifX * sAbsDifX ) + ( sAbsDifY * sAbsDifY ) ); + sMaxSoundDist = sqrt( (double) ( sMaxDistX * sMaxDistX ) + ( sMaxDistY * sMaxDistY ) ); + sSoundDist = sqrt( (double)( sAbsDifX * sAbsDifX ) + ( sAbsDifY * sAbsDifY ) ); - if ( sSoundDist == 0 ) - { - return( bInitialVolume ); - } + if ( sSoundDist == 0 ) + { + return( bInitialVolume ); + } - if ( sSoundDist > sMaxSoundDist ) - { - sSoundDist = sMaxSoundDist; - } + if ( sSoundDist > sMaxSoundDist ) + { + sSoundDist = sMaxSoundDist; + } - // Scale - return( (INT8)( bInitialVolume * ( ( sMaxSoundDist - sSoundDist ) / sMaxSoundDist ) ) ); + // Scale + return( (INT8)( bInitialVolume * ( ( sMaxSoundDist - sSoundDist ) / sMaxSoundDist ) ) ); } void SetPositionSndsVolumeAndPanning( ) { - UINT32 cnt; + UINT32 cnt; POSITIONSND *pPositionSnd; - INT8 bVolume; - UINT8 ubPan; - SOLDIERTYPE *pSoldier; + INT8 bVolume; + UINT8 ubPan; + SOLDIERTYPE *pSoldier; - for ( cnt = 0; cnt < guiNumPositionSnds; cnt++ ) - { - pPositionSnd = &gPositionSndData[ cnt ]; + for ( cnt = 0; cnt < guiNumPositionSnds; cnt++ ) + { + pPositionSnd = &gPositionSndData[ cnt ]; - if ( pPositionSnd->fAllocated ) - { - if ( !pPositionSnd->fInActive ) - { - if ( pPositionSnd->iSoundSampleID != NO_SAMPLE ) - { - bVolume = PositionSoundVolume( 15, pPositionSnd->sGridNo ); + if ( pPositionSnd->fAllocated ) + { + if ( !pPositionSnd->fInActive ) + { + if ( pPositionSnd->iSoundSampleID != NO_SAMPLE ) + { + bVolume = PositionSoundVolume( 15, pPositionSnd->sGridNo ); - if ( pPositionSnd->uiFlags & POSITION_SOUND_FROM_SOLDIER ) - { - pSoldier = (SOLDIERTYPE*)pPositionSnd->uiData; + if ( pPositionSnd->uiFlags & POSITION_SOUND_FROM_SOLDIER ) + { + pSoldier = (SOLDIERTYPE*)pPositionSnd->uiData; - if ( pSoldier->bVisible == -1 ) - { - // Limit volume,,, - if ( bVolume > 10 ) - { - bVolume = 10; - } - } - } + if ( pSoldier->bVisible == -1 ) + { + // Limit volume,,, + if ( bVolume > 10 ) + { + bVolume = 10; + } + } + } //if the sound is from a stationay object if( pPositionSnd->uiFlags & POSITION_SOUND_STATIONATY_OBJECT ) @@ -1118,14 +1118,15 @@ void SetPositionSndsVolumeAndPanning( ) } } - SoundSetVolume( pPositionSnd->iSoundSampleID, bVolume ); + SoundSetVolume( pPositionSnd->iSoundSampleID, bVolume ); ubPan = PositionSoundDir( pPositionSnd->sGridNo ); SoundSetPan( pPositionSnd->iSoundSampleID, ubPan ); - } - } - } - } + } + } + } + } } + diff --git a/Utils/Sound Control.h b/Utils/Sound Control.h index 203c5d9f..96e8f0d5 100644 --- a/Utils/Sound Control.h +++ b/Utils/Sound Control.h @@ -1,17 +1,17 @@ /* * ChangeLog: - * 11.12.2005 Lesh changed balance settings + * 11.12.2005 Lesh changed balance settings */ #ifndef SOUND_CONTROL_H #define SOUND_CONTROL_H // == Lesh modifications ====== -#define FARLEFT 0 -#define LEFTSIDE 96 -#define MIDDLE 128 +#define FARLEFT 0 +#define LEFTSIDE 96 +#define MIDDLE 128 #define MIDDLEPAN 128 -#define RIGHTSIDE 160 -#define FARRIGHT 255 +#define RIGHTSIDE 160 +#define FARRIGHT 255 // == Lesh modifications ends = #define LOWVOLUME 25 @@ -175,8 +175,8 @@ enum SoundDefines S_MORTAR_SHOT, S_GLOCK17, S_GLOCK18, - S_BERETTA92, - S_BERETTA93, + S_BERETTA92, + S_BERETTA93, S_SWSPECIAL, S_BARRACUDA, S_DESERTEAGLE, @@ -212,7 +212,7 @@ enum SoundDefines S_THROWKNIFE, S_TANK_CANNON, S_BURSTTYPE1, - S_AUTOMAG, + S_AUTOMAG, S_SILENCER_1, S_SILENCER_2, @@ -315,64 +315,64 @@ enum SoundDefines SWIM_2, KEY_FAILURE, TARGET_OUT_OF_RANGE, - OPEN_STATUE, - USE_STATUE_REMOTE, - USE_WIRE_CUTTERS, - DRINK_CANTEEN_FEMALE, - BLOODCAT_ATTACK, - BLOODCAT_ROAR, - ROBOT_GREETING, - ROBOT_DEATH, - GAS_EXPLODE_1, - AIR_ESCAPING_1, + OPEN_STATUE, + USE_STATUE_REMOTE, + USE_WIRE_CUTTERS, + DRINK_CANTEEN_FEMALE, + BLOODCAT_ATTACK, + BLOODCAT_ROAR, + ROBOT_GREETING, + ROBOT_DEATH, + GAS_EXPLODE_1, + AIR_ESCAPING_1, - OPEN_DRAWER, - CLOSE_DRAWER, - OPEN_LOCKER, - CLOSE_LOCKER, - OPEN_WOODEN_BOX, - CLOSE_WOODEN_BOX, - ROBOT_STOP, + OPEN_DRAWER, + CLOSE_DRAWER, + OPEN_LOCKER, + CLOSE_LOCKER, + OPEN_WOODEN_BOX, + CLOSE_WOODEN_BOX, + ROBOT_STOP, WATER_WALK1_IN, WATER_WALK1_OUT, WATER_WALK2_IN, WATER_WALK2_OUT, - PRONE_UP_SOUND, - PRONE_DOWN_SOUND, - KNEEL_UP_SOUND, - KNEEL_DOWN_SOUND, - PICKING_SOMETHING_UP, + PRONE_UP_SOUND, + PRONE_DOWN_SOUND, + KNEEL_UP_SOUND, + KNEEL_DOWN_SOUND, + PICKING_SOMETHING_UP, - COW_FALL, + COW_FALL, - BLOODCAT_GROWL_1, - BLOODCAT_GROWL_2, - BLOODCAT_GROWL_3, - BLOODCAT_GROWL_4, - CREATURE_GAS_NOISE, - CREATURE_FALL_PART_2, - CREATURE_DISSOLVE_1, - QUEEN_AMBIENT_NOISE, - CREATURE_FALL, - CROW_PECKING_AT_FLESH, - CROW_FLYING_AWAY, - SLAP_2, - MORTAR_START, - MORTAR_WHISTLE, - MORTAR_LOAD, + BLOODCAT_GROWL_1, + BLOODCAT_GROWL_2, + BLOODCAT_GROWL_3, + BLOODCAT_GROWL_4, + CREATURE_GAS_NOISE, + CREATURE_FALL_PART_2, + CREATURE_DISSOLVE_1, + QUEEN_AMBIENT_NOISE, + CREATURE_FALL, + CROW_PECKING_AT_FLESH, + CROW_FLYING_AWAY, + SLAP_2, + MORTAR_START, + MORTAR_WHISTLE, + MORTAR_LOAD, - TURRET_MOVE, - TURRET_STOP, - COW_FALL_2, - KNIFE_IMPACT, - EXPLOSION_ALT_BLAST_1, - EXPLOSION_BLAST_2, - DRINK_CANTEEN_MALE, - USE_X_RAY_MACHINE, - CATCH_OBJECT, - FENCE_OPEN, + TURRET_MOVE, + TURRET_STOP, + COW_FALL_2, + KNIFE_IMPACT, + EXPLOSION_ALT_BLAST_1, + EXPLOSION_BLAST_2, + DRINK_CANTEEN_MALE, + USE_X_RAY_MACHINE, + CATCH_OBJECT, + FENCE_OPEN, //MADD MARKER S_BARRETT, @@ -448,7 +448,7 @@ INT32 SoundVolume( INT8 bInitialVolume, INT16 sGridNo ); void PlayDelayedJA2Sample( UINT32 uiDelay, UINT32 usNum, UINT32 usRate, UINT32 ubVolume, UINT32 ubLoops, UINT32 uiPan ); -#define POSITION_SOUND_FROM_SOLDIER 0x00000001 +#define POSITION_SOUND_FROM_SOLDIER 0x00000001 #define POSITION_SOUND_STATIONATY_OBJECT 0x00000002 INT32 NewPositionSnd( INT16 sGridNo, UINT32 uiFlags, UINT32 uiData, UINT32 iSoundToPlay ); diff --git a/Utils/Text Input.cpp b/Utils/Text Input.cpp index cfc5f5f5..acf643b5 100644 --- a/Utils/Text Input.cpp +++ b/Utils/Text Input.cpp @@ -73,7 +73,7 @@ typedef struct TEXTINPUTNODE{ struct TEXTINPUTNODE *next, *prev; }TEXTINPUTNODE; -//Stack list containing the head nodes of each level. Only the top level is the active level. +//Stack list containing the head nodes of each level. Only the top level is the active level. typedef struct STACKTEXTINPUTNODE { TEXTINPUTNODE *head; @@ -92,7 +92,7 @@ void ExecuteCopyCommand(); void ExecuteCutCommand(); void ExecutePasteCommand(); -//Internal list vars. active always points to the currently edited field. +//Internal list vars. active always points to the currently edited field. TEXTINPUTNODE *gpTextInputHead = NULL, *gpTextInputTail = NULL, *gpActive = NULL; //Saving current mode @@ -116,7 +116,7 @@ void PushTextInputLevel() } //After the currently text input mode is removed, we then restore the previous one -//automatically. Assert failure in this function will expose cases where you are trigger +//automatically. Assert failure in this function will expose cases where you are trigger //happy with killing non-existant text input modes. void PopTextInputLevel() { @@ -144,12 +144,12 @@ UINT8 gubEndHilite = 0; //allow the user to cut, copy, and paste just like windows. CHAR16 gszClipboardString[256]; -//Simply initiates that you wish to begin inputting text. This should only apply to screen -//initializations that contain fields that edit text. It also verifies and clears any existing -//fields. Your input loop must contain the function HandleTextInput and processed if the gfTextInputMode -//flag is set else process your regular input handler. Note that this doesn't mean you are necessarily typing, -//just that there are text fields in your screen and may be inactive. The TAB key cycles through your text fields, -//and special fields can be defined which will call a void functionName( UINT16 usFieldNum ) +//Simply initiates that you wish to begin inputting text. This should only apply to screen +//initializations that contain fields that edit text. It also verifies and clears any existing +//fields. Your input loop must contain the function HandleTextInput and processed if the gfTextInputMode +//flag is set else process your regular input handler. Note that this doesn't mean you are necessarily typing, +//just that there are text fields in your screen and may be inactive. The TAB key cycles through your text fields, +//and special fields can be defined which will call a void functionName( UINT16 usFieldNum ) void InitTextInputMode() { if( gpTextInputHead ) @@ -170,18 +170,18 @@ void InitTextInputMode() pColors->usCursorColor = 0; } -//A hybrid version of InitTextInput() which uses a specific scheme. JA2's editor uses scheme 1, so +//A hybrid version of InitTextInput() which uses a specific scheme. JA2's editor uses scheme 1, so //feel free to add new schemes. void InitTextInputModeWithScheme( UINT8 ubSchemeID ) { InitTextInputMode(); switch( ubSchemeID ) { - case DEFAULT_SCHEME: //yellow boxes with black text, with bluish bevelling + case DEFAULT_SCHEME: //yellow boxes with black text, with bluish bevelling SetTextInputFont( (UINT16)FONT12POINT1 ); Set16BPPTextFieldColor( Get16BPPColor(FROMRGB(250, 240, 188) ) ); SetBevelColors( Get16BPPColor(FROMRGB(136, 138, 135)), Get16BPPColor(FROMRGB(24, 61, 81)) ); - SetTextInputRegularColors( FONT_BLACK, FONT_BLACK ); + SetTextInputRegularColors( FONT_BLACK, FONT_BLACK ); SetTextInputHilitedColors( FONT_GRAY2, FONT_GRAY2, FONT_METALGRAY ); break; } @@ -225,8 +225,8 @@ void KillTextInputMode() gpActive = NULL; } -//Kills all levels of text input modes. When you init a second consecutive text input mode, without -//first removing them, the existing mode will be preserved. This function removes all of them in one +//Kills all levels of text input modes. When you init a second consecutive text input mode, without +//first removing them, the existing mode will be preserved. This function removes all of them in one //call, though doing so "may" reflect poor coding style, though I haven't thought about any really //just uses for it :( void KillAllTextInputModes() @@ -235,18 +235,18 @@ void KillAllTextInputModes() KillTextInputMode(); } -//After calling InitTextInputMode, you want to define one or more text input fields. The order -//of calls to this function dictate the TAB order from traversing from one field to the next. This +//After calling InitTextInputMode, you want to define one or more text input fields. The order +//of calls to this function dictate the TAB order from traversing from one field to the next. This //function adds mouse regions and processes them for you, as well as deleting them when you are done. -void AddTextInputField( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 sHeight, INT8 bPriority, - STR16 szInitText, UINT8 ubMaxChars, UINT16 usInputType ) +void AddTextInputField( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 sHeight, INT8 bPriority, + STR16 szInitText, UINT8 ubMaxChars, UINT16 usInputType ) { TEXTINPUTNODE *pNode; pNode = (TEXTINPUTNODE*)MemAlloc(sizeof(TEXTINPUTNODE)); Assert(pNode); memset( pNode, 0, sizeof( TEXTINPUTNODE ) ); pNode->next = NULL; - if( !gpTextInputHead ) //first entry, so we start with text input. + if( !gpTextInputHead ) //first entry, so we start with text input. { gfEditingText = TRUE; gpTextInputHead = gpTextInputTail = pNode; @@ -263,7 +263,7 @@ void AddTextInputField( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 sHeight, IN } //Setup the information for the node pNode->usInputType = usInputType; //setup the filter type - //All 24hourclock inputtypes have 6 characters. 01:23 (null terminated) + //All 24hourclock inputtypes have 6 characters. 01:23 (null terminated) if( usInputType == INPUTTYPE_EXCLUSIVE_24HOURCLOCK ) ubMaxChars = 6; //Allocate and copy the string. @@ -271,7 +271,7 @@ void AddTextInputField( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 sHeight, IN Assert( pNode->szString ); if( szInitText ) { - pNode->ubStrLen = (UINT8)wcslen( szInitText ); + pNode->ubStrLen = (UINT8)wcslen( szInitText ); Assert( pNode->ubStrLen <= ubMaxChars ); swprintf( pNode->szString, szInitText ); } @@ -294,16 +294,16 @@ void AddTextInputField( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 sHeight, IN pNode->fEnabled = TRUE; //Setup the region. MSYS_DefineRegion( &pNode->region, sLeft, sTop, (INT16)(sLeft+sWidth), (INT16)(sTop+sHeight), bPriority, - gusTextInputCursor, MouseMovedInTextRegionCallback, MouseClickedInTextRegionCallback ); + gusTextInputCursor, MouseMovedInTextRegionCallback, MouseClickedInTextRegionCallback ); MSYS_SetRegionUserData( &pNode->region, 0, pNode->ubID ); } -//This allows you to insert special processing functions and modes that can't be determined here. An example -//would be a file dialog where there would be a file list. This file list would be accessed using the Win95 -//convention by pressing TAB. In there, your key presses would be handled differently and by adding a userinput -//field, you can make this hook into your function to accomplish this. In a filedialog, alpha characters -//would be used to jump to the file starting with that letter, and setting the field in the text input -//field. Pressing TAB again would place you back in the text input field. All of that stuff would be handled +//This allows you to insert special processing functions and modes that can't be determined here. An example +//would be a file dialog where there would be a file list. This file list would be accessed using the Win95 +//convention by pressing TAB. In there, your key presses would be handled differently and by adding a userinput +//field, you can make this hook into your function to accomplish this. In a filedialog, alpha characters +//would be used to jump to the file starting with that letter, and setting the field in the text input +//field. Pressing TAB again would place you back in the text input field. All of that stuff would be handled //externally, except for the TAB keys. void AddUserInputField( INPUT_CALLBACK userFunction ) { @@ -311,7 +311,7 @@ void AddUserInputField( INPUT_CALLBACK userFunction ) pNode = (TEXTINPUTNODE*)MemAlloc(sizeof(TEXTINPUTNODE)); Assert(pNode); pNode->next = NULL; - if( !gpTextInputHead ) //first entry, so we don't start with text input. + if( !gpTextInputHead ) //first entry, so we don't start with text input. { gfEditingText = FALSE; gpTextInputHead = gpTextInputTail = pNode; @@ -334,7 +334,7 @@ void AddUserInputField( INPUT_CALLBACK userFunction ) pNode->InputCallback = userFunction; } -//Removes the specified field from the existing fields. If it doesn't exist, then there will be an +//Removes the specified field from the existing fields. If it doesn't exist, then there will be an //assertion failure. void RemoveTextInputField( UINT8 ubField ) { @@ -370,10 +370,10 @@ void RemoveTextInputField( UINT8 ubField ) } curr = curr->next; } - AssertMsg( 0, "Attempt to remove a text input field that doesn't exist. Check your IDs." ); + AssertMsg( 0, "Attempt to remove a text input field that doesn't exist. Check your IDs." ); } -//Returns the gpActive field ID number. It'll return -1 if no field is active. +//Returns the gpActive field ID number. It'll return -1 if no field is active. INT16 GetActiveFieldID() { if( gpActive ) @@ -381,13 +381,13 @@ INT16 GetActiveFieldID() return -1; } -//This is a useful call made from an external user input field. Using the previous file dialog example, this +//This is a useful call made from an external user input field. Using the previous file dialog example, this //call would be made when the user selected a different filename in the list via clicking or scrolling with //the arrows, or even using alpha chars to jump to the appropriate filename. void SetInputFieldStringWith16BitString( UINT8 ubField, const STR16 szNewText ) { TEXTINPUTNODE *curr; - curr = gpTextInputHead; + curr = gpTextInputHead; while( curr ) { if( curr->ubID == ubField ) @@ -416,7 +416,7 @@ void SetInputFieldStringWith16BitString( UINT8 ubField, const STR16 szNewText ) void SetInputFieldStringWith8BitString( UINT8 ubField, const STR8 szNewText ) { TEXTINPUTNODE *curr; - curr = gpTextInputHead; + curr = gpTextInputHead; while( curr ) { if( curr->ubID == ubField ) @@ -446,7 +446,7 @@ void SetInputFieldStringWith8BitString( UINT8 ubField, const STR8 szNewText ) void Get8BitStringFromField( UINT8 ubField, STR8 szString ) { TEXTINPUTNODE *curr; - curr = gpTextInputHead; + curr = gpTextInputHead; while( curr ) { if( curr->ubID == ubField ) @@ -462,7 +462,7 @@ void Get8BitStringFromField( UINT8 ubField, STR8 szString ) void Get16BitStringFromField( UINT8 ubField, STR16 szString ) { TEXTINPUTNODE *curr; - curr = gpTextInputHead; + curr = gpTextInputHead; while( curr ) { if( curr->ubID == ubField ) @@ -476,7 +476,7 @@ void Get16BitStringFromField( UINT8 ubField, STR16 szString ) } //Converts the field's string into a number, then returns that number -//returns -1 if blank or invalid. Only works for positive numbers. +//returns -1 if blank or invalid. Only works for positive numbers. INT32 GetNumericStrictValueFromField( UINT8 ubField ) { STR16 ptr; @@ -486,7 +486,7 @@ INT32 GetNumericStrictValueFromField( UINT8 ubField ) //Blank string, so return -1 if( str[0] == '\0' ) return -1; - //Convert the string to a number. Don't trust other functions. This will + //Convert the string to a number. Don't trust other functions. This will //ensure that nonnumeric values automatically return -1. total = 0; ptr = str; @@ -494,7 +494,7 @@ INT32 GetNumericStrictValueFromField( UINT8 ubField ) { if( *ptr >= '0' && *ptr <= '9' ) //...make sure it is numeric... { //Multiply prev total by 10 and add converted char digit value. - total = total * 10 + (*ptr - '0'); + total = total * 10 + (*ptr - '0'); } else //...else the string is invalid. return -1; @@ -503,7 +503,7 @@ INT32 GetNumericStrictValueFromField( UINT8 ubField ) return total; //if we made it this far, then we have a valid number. } -//Converts a number to a numeric strict value. If the number is negative, the +//Converts a number to a numeric strict value. If the number is negative, the //field will be blank. void SetInputFieldStringWithNumericStrictValue( UINT8 ubField, INT32 iNumber ) { @@ -517,7 +517,7 @@ void SetInputFieldStringWithNumericStrictValue( UINT8 ubField, INT32 iNumber ) AssertMsg( 0, String( "Attempting to illegally set text into user field %d", curr->ubID ) ); if( iNumber < 0 ) //negative number converts to blank string swprintf( curr->szString, L"" ); - else + else { INT32 iMax = (INT32)pow( 10.0, curr->ubMaxChars ); if( iNumber > iMax ) //set string to max value based on number of chars. @@ -527,7 +527,7 @@ void SetInputFieldStringWithNumericStrictValue( UINT8 ubField, INT32 iNumber ) } curr->ubStrLen = (UINT8)wcslen( curr->szString ); return; - } + } curr = curr->next; } } @@ -651,9 +651,9 @@ void SelectPrevField() } } -//These allow you to customize the general color scheme of your text input boxes. I am assuming that -//under no circumstances would a user want a different color for each field. It follows the Win95 convention -//that all text input boxes are exactly the same color scheme. However, these colors can be set at anytime, +//These allow you to customize the general color scheme of your text input boxes. I am assuming that +//under no circumstances would a user want a different color for each field. It follows the Win95 convention +//that all text input boxes are exactly the same color scheme. However, these colors can be set at anytime, //but will effect all of the colors. void SetTextInputFont( UINT16 usFont ) { @@ -698,14 +698,14 @@ void SetCursorColor( UINT16 usCursorColor ) pColors->usCursorColor = usCursorColor; } -//All CTRL and ALT keys combinations, F1-F12 keys, ENTER and ESC are ignored allowing -//processing to be done with your own input handler. Otherwise, the keyboard event +//All CTRL and ALT keys combinations, F1-F12 keys, ENTER and ESC are ignored allowing +//processing to be done with your own input handler. Otherwise, the keyboard event //is absorbed by this input handler, if used in the appropriate manner. //This call must be added at the beginning of your input handler in this format: //while( DequeueEvent(&Event) ) //{ -// if( !HandleTextInput( &Event ) && (your conditions...ex: Event.usEvent == KEY_DOWN ) ) -// { +// if( !HandleTextInput( &Event ) && (your conditions...ex: Event.usEvent == KEY_DOWN ) ) +// { // switch( Event.usParam ) // { // //Normal key cases here. @@ -719,11 +719,11 @@ BOOLEAN HandleTextInput( InputAtom *Event ) //not in text input mode gfNoScroll = FALSE; - if( !gfTextInputMode ) - return FALSE; + if( !gfTextInputMode ) + return FALSE; //currently in a user field, so return unless TAB or SHIFT_TAB are pressed. - if( !gfEditingText && Event->usParam != TAB && Event->usParam != SHIFT_TAB ) - return FALSE; + if( !gfEditingText && Event->usParam != TAB && Event->usParam != SHIFT_TAB ) + return FALSE; //unless we are psycho typers, we only want to process these key events. if( Event->usEvent != KEY_DOWN && Event->usEvent != KEY_REPEAT ) return FALSE; @@ -739,7 +739,7 @@ BOOLEAN HandleTextInput( InputAtom *Event ) //For any number of reasons, these ALT and CTRL combination key presses //will be processed externally #if 0 - if( Event->usKeyState & CTRL_DOWN ) + if( Event->usKeyState & CTRL_DOWN ) { if( Event->usParam == 'c' || Event->usParam == 'C' ) { @@ -761,8 +761,8 @@ BOOLEAN HandleTextInput( InputAtom *Event ) if( Event->usKeyState & ALT_DOWN || Event->usKeyState & CTRL_DOWN && Event->usParam != DEL ) return FALSE; //F1-F12 regardless of state are processed externally as well. - if( Event->usParam >= F1 && Event->usParam <= F12 || - Event->usParam >= SHIFT_F1 && Event->usParam <= SHIFT_F12 ) + if( Event->usParam >= F1 && Event->usParam <= F12 || + Event->usParam >= SHIFT_F1 && Event->usParam <= SHIFT_F12 ) { return FALSE; } @@ -785,7 +785,7 @@ BOOLEAN HandleTextInput( InputAtom *Event ) SelectPrevField(); break; case LEFTARROW: - //Move the cursor to the left one position. If there is selected text, + //Move the cursor to the left one position. If there is selected text, //the cursor moves to the left of the block, and clears the block. gfNoScroll = TRUE; if( gfHiliteMode ) @@ -798,7 +798,7 @@ BOOLEAN HandleTextInput( InputAtom *Event ) gubCursorPos--; break; case RIGHTARROW: - //Move the cursor to the right one position. If there is selected text, + //Move the cursor to the right one position. If there is selected text, //the block is cleared. gfNoScroll = TRUE; if( gfHiliteMode ) @@ -821,7 +821,7 @@ BOOLEAN HandleTextInput( InputAtom *Event ) gubCursorPos = 0; break; case SHIFT_LEFTARROW: - //Initiates or continues hilighting to the left one position. If the cursor + //Initiates or continues hilighting to the left one position. If the cursor //is at the left end of the block, then the block decreases one position. gfNoScroll = TRUE; if( !gfHiliteMode ) @@ -834,7 +834,7 @@ BOOLEAN HandleTextInput( InputAtom *Event ) gubEndHilite = gubCursorPos; break; case SHIFT_RIGHTARROW: - //Initiates or continues hilighting to the right one position. If the cursor + //Initiates or continues hilighting to the right one position. If the cursor //is at the right end of the block, then the block decreases one position. gfNoScroll = TRUE; if( !gfHiliteMode ) @@ -858,7 +858,7 @@ BOOLEAN HandleTextInput( InputAtom *Event ) gubEndHilite = gubCursorPos; break; case SHIFT_HOME: - //From the location of the anchored cursor for hilighting, the cursor goes to + //From the location of the anchored cursor for hilighting, the cursor goes to //the beginning of the text, selecting all text from the anchor to the beginning //of the text. if( !gfHiliteMode ) @@ -871,7 +871,7 @@ BOOLEAN HandleTextInput( InputAtom *Event ) break; case DEL: //CTRL+DEL will delete the entire text field, regardless of hilighting. - //DEL will either delete the selected text, or the character to the right + //DEL will either delete the selected text, or the character to the right //of the cursor if applicable. PlayJA2Sample( ENTERING_TEXT, RATE_11025, BTNVOLUME, 1, MIDDLEPAN ); if( Event->usKeyState & CTRL_DOWN ) @@ -899,7 +899,7 @@ BOOLEAN HandleTextInput( InputAtom *Event ) RemoveChar( --gubCursorPos ); } break; - default: //check for typing keys + default: //check for typing keys if( gfHiliteMode ) DeleteHilitedText(); if( gpActive->usInputType >= INPUTTYPE_EXCLUSIVE_BASEVALUE ) @@ -927,7 +927,7 @@ BOOLEAN HandleTextInput( InputAtom *Event ) AddChar( key ); return TRUE; } - //Handle alphas + //Handle alphas if( type & INPUTTYPE_ALPHA ) { if( key >= 'A' && key <= 'Z' ) @@ -949,10 +949,10 @@ BOOLEAN HandleTextInput( InputAtom *Event ) if( type & INPUTTYPE_SPECIAL ) { //More can be added, but not all of the fonts support these - if( key >= 0x21 && key <= 0x2f || // ! " # $ % & ' ( ) * + , - . / - key >= 0x3a && key <= 0x40 || // : ; < = > ? @ + if( key >= 0x21 && key <= 0x2f || // ! " # $ % & ' ( ) * + , - . / + key >= 0x3a && key <= 0x40 || // : ; < = > ? @ key >= 0x5b && key <= 0x5f || // [ \ ] ^ _ - key >= 0x7b && key <= 0x7d ) // { | } + key >= 0x7b && key <= 0x7d ) // { | } { AddChar( key ); return TRUE; @@ -969,7 +969,7 @@ void HandleExclusiveInput( UINT32 uiKey ) switch( gpActive->usInputType ) { case INPUTTYPE_EXCLUSIVE_DOSFILENAME: //dos file names - if( uiKey >= 'A' && uiKey <= 'Z' || + if( uiKey >= 'A' && uiKey <= 'Z' || uiKey >= 'a' && uiKey <= 'z' || uiKey >= '0' && uiKey <= '9' || uiKey == '_' || uiKey == '.' ) @@ -981,11 +981,11 @@ void HandleExclusiveInput( UINT32 uiKey ) AddChar( uiKey ); } break; - case INPUTTYPE_EXCLUSIVE_COORDINATE: //coordinates such as a9, z78, etc. + case INPUTTYPE_EXCLUSIVE_COORDINATE: //coordinates such as a9, z78, etc. if( !gubCursorPos ) //first char is an lower case alpha { if( uiKey >= 'a' && uiKey <= 'z' ) - AddChar( uiKey ); + AddChar( uiKey ); else if( uiKey >= 'A' && uiKey <= 'Z' ) AddChar( uiKey + 32 ); //convert to lowercase } @@ -1022,7 +1022,7 @@ void HandleExclusiveInput( UINT32 uiKey ) { AddChar( ':' ); AddChar( uiKey ); - } + } } else if( gubCursorPos == 3 ) { @@ -1042,7 +1042,7 @@ void AddChar( UINT32 uiKey ) { PlayJA2Sample( ENTERING_TEXT, RATE_11025, BTNVOLUME, 1, MIDDLEPAN ); if( gpActive->ubStrLen >= gpActive->ubMaxChars ) - { //max length reached. Just replace the last character with new one. + { //max length reached. Just replace the last character with new one. gpActive->ubStrLen = gpActive->ubMaxChars; gpActive->szString[ gpActive->ubStrLen-1 ] = (UINT16)uiKey; gpActive->szString[ gpActive->ubStrLen ] = '\0'; @@ -1108,7 +1108,7 @@ void RemoveChar( UINT8 ubArrayIndex ) fDeleting = TRUE; } //if we deleted a char, then decrement the strlen. - if( fDeleting ) + if( fDeleting ) gpActive->ubStrLen--; } @@ -1118,7 +1118,7 @@ void MouseMovedInTextRegionCallback(MOUSE_REGION *reg, INT32 reason) TEXTINPUTNODE *curr; if( gfLeftButtonState ) { - if( reason & MSYS_CALLBACK_REASON_MOVE || + if( reason & MSYS_CALLBACK_REASON_MOVE || reason & MSYS_CALLBACK_REASON_LOST_MOUSE || reason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) { @@ -1130,7 +1130,7 @@ void MouseMovedInTextRegionCallback(MOUSE_REGION *reg, INT32 reason) RenderInactiveTextFieldNode( gpActive ); curr = gpTextInputHead; while( curr ) - { + { if( curr->ubID == ubNewID ) { gpActive = curr; @@ -1141,7 +1141,7 @@ void MouseMovedInTextRegionCallback(MOUSE_REGION *reg, INT32 reason) } if( reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { - if( gusMouseYPos < reg->RegionTopLeftY ) + if( gusMouseYPos < reg->RegionTopLeftY ) { gubEndHilite = 0; gfHiliteMode = TRUE; @@ -1187,7 +1187,7 @@ void MouseClickedInTextRegionCallback(MOUSE_REGION *reg, INT32 reason) RenderInactiveTextFieldNode( gpActive ); curr = gpTextInputHead; while( curr ) - { + { if( curr->ubID == ubNewID ) { gpActive = curr; @@ -1209,10 +1209,10 @@ void MouseClickedInTextRegionCallback(MOUSE_REGION *reg, INT32 reason) iCurrCharPos = iNextCharPos; iNextCharPos = StringPixLengthArg( pColors->usFont, gubCursorPos + 1, gpActive->szString ); } - gubStartHilite = gubCursorPos; //This value is the anchor + gubStartHilite = gubCursorPos; //This value is the anchor gubEndHilite = gubCursorPos; //The end will move with the cursor as long as it's down. gfHiliteMode = FALSE; - + } } @@ -1221,9 +1221,9 @@ void RenderBackgroundField( TEXTINPUTNODE *pNode ) UINT16 usColor; if( pColors->fBevelling ) { - ColorFillVideoSurfaceArea(FRAME_BUFFER, pNode->region.RegionTopLeftX, pNode->region.RegionTopLeftY, + ColorFillVideoSurfaceArea(FRAME_BUFFER, pNode->region.RegionTopLeftX, pNode->region.RegionTopLeftY, pNode->region.RegionBottomRightX, pNode->region.RegionBottomRightY, pColors->usDarkerColor ); - ColorFillVideoSurfaceArea(FRAME_BUFFER, pNode->region.RegionTopLeftX+1, pNode->region.RegionTopLeftY+1, + ColorFillVideoSurfaceArea(FRAME_BUFFER, pNode->region.RegionTopLeftX+1, pNode->region.RegionTopLeftY+1, pNode->region.RegionBottomRightX, pNode->region.RegionBottomRightY, pColors->usBrighterColor ); } if( !pNode->fEnabled && !pColors->fUseDisabledAutoShade ) @@ -1231,10 +1231,10 @@ void RenderBackgroundField( TEXTINPUTNODE *pNode ) else usColor = pColors->usTextFieldColor; - ColorFillVideoSurfaceArea(FRAME_BUFFER, pNode->region.RegionTopLeftX+1, pNode->region.RegionTopLeftY+1, + ColorFillVideoSurfaceArea(FRAME_BUFFER, pNode->region.RegionTopLeftX+1, pNode->region.RegionTopLeftY+1, pNode->region.RegionBottomRightX-1, pNode->region.RegionBottomRightY-1, usColor ); - InvalidateRegion( pNode->region.RegionTopLeftX, pNode->region.RegionTopLeftY, + InvalidateRegion( pNode->region.RegionTopLeftX, pNode->region.RegionTopLeftY, pNode->region.RegionBottomRightX, pNode->region.RegionBottomRightY ); } @@ -1307,10 +1307,10 @@ void RenderActiveTextField() uiCursorXPos = StringPixLengthArg( pColors->usFont, gubCursorPos, str ) + 2; if( GetJA2Clock()%1000 < 500 ) { //draw the blinking ibeam cursor during the on blink period. - ColorFillVideoSurfaceArea(FRAME_BUFFER, - gpActive->region.RegionTopLeftX + uiCursorXPos, - gpActive->region.RegionTopLeftY + usOffset, - gpActive->region.RegionTopLeftX + uiCursorXPos + 1, + ColorFillVideoSurfaceArea(FRAME_BUFFER, + gpActive->region.RegionTopLeftX + uiCursorXPos, + gpActive->region.RegionTopLeftY + usOffset, + gpActive->region.RegionTopLeftX + uiCursorXPos + 1, gpActive->region.RegionTopLeftY + usOffset + GetFontHeight( pColors->usFont ), pColors->usCursorColor ); } } @@ -1418,7 +1418,7 @@ void RenderAllTextFields() void EnableTextField( UINT8 ubID ) { TEXTINPUTNODE *curr; - curr = gpTextInputHead; + curr = gpTextInputHead; while( curr ) { if( curr->ubID == ubID ) @@ -1440,7 +1440,7 @@ void EnableTextField( UINT8 ubID ) void DisableTextField( UINT8 ubID ) { TEXTINPUTNODE *curr; - curr = gpTextInputHead; + curr = gpTextInputHead; while( curr ) { if( curr->ubID == ubID ) @@ -1462,7 +1462,7 @@ void DisableTextField( UINT8 ubID ) void EnableTextFields( UINT8 ubFirstID, UINT8 ubLastID ) { TEXTINPUTNODE *curr; - curr = gpTextInputHead; + curr = gpTextInputHead; while( curr ) { if( curr->ubID >= ubFirstID && curr->ubID <= ubLastID ) @@ -1482,7 +1482,7 @@ void EnableTextFields( UINT8 ubFirstID, UINT8 ubLastID ) void DisableTextFields( UINT8 ubFirstID, UINT8 ubLastID ) { TEXTINPUTNODE *curr; - curr = gpTextInputHead; + curr = gpTextInputHead; while( curr ) { if( curr->ubID >= ubFirstID && curr->ubID <= ubLastID ) @@ -1502,7 +1502,7 @@ void DisableTextFields( UINT8 ubFirstID, UINT8 ubLastID ) void EnableAllTextFields() { TEXTINPUTNODE *curr; - curr = gpTextInputHead; + curr = gpTextInputHead; while( curr ) { if( !curr->fEnabled ) @@ -1519,7 +1519,7 @@ void EnableAllTextFields() void DisableAllTextFields() { TEXTINPUTNODE *curr; - curr = gpTextInputHead; + curr = gpTextInputHead; while( curr ) { if( curr->fEnabled ) @@ -1596,10 +1596,10 @@ void ExecutePasteCommand() if( !gpActive || !szClipboard ) return; DeleteHilitedText(); - + ubCount = 0; while( szClipboard[ ubCount ] ) - { + { AddChar( szClipboard[ ubCount ] ); ubCount++; } @@ -1612,7 +1612,7 @@ void ExecuteCutCommand() } //Saves the current text input mode, then removes it and activates the previous text input mode, -//if applicable. The second function restores the settings. Doesn't currently support nested +//if applicable. The second function restores the settings. Doesn't currently support nested //calls. void SaveAndRemoveCurrentTextInputMode() { @@ -1636,7 +1636,7 @@ void RestoreSavedTextInputMode() { if( !pSavedHead ) AssertMsg( 0, "Attempting to restore saved text input stack head, when one doesn't exist."); - gpTextInputHead = pSavedHead; + gpTextInputHead = pSavedHead; pColors = pSavedColors; pSavedHead = NULL; pSavedColors = NULL; @@ -1644,7 +1644,7 @@ void RestoreSavedTextInputMode() UINT16 GetTextInputCursor() { - return gusTextInputCursor; + return gusTextInputCursor; } void SetTextInputCursor( UINT16 usNewCursor ) @@ -1694,9 +1694,9 @@ UINT16 GetExclusive24HourTimeValueFromField( UINT8 ubField ) if( curr->szString[0] == '2' && curr->szString[1] >= '0' && //20-23 curr->szString[1] <='3' || curr->szString[0] >= '0' && curr->szString[0] <= '1' && // 00-19 - curr->szString[1] >= '0' && curr->szString[1] <= '9' ) + curr->szString[1] >= '0' && curr->szString[1] <= '9' ) { //Next, validate the colon, and the minutes 00-59 - if( curr->szString[2] == ':' && curr->szString[5] == 0 && // : + if( curr->szString[2] == ':' && curr->szString[5] == 0 && // : curr->szString[3] >= '0' && curr->szString[3] <= '5' && // 0-5 curr->szString[4] >= '0' && curr->szString[4] <= '9' ) // 0-9 { @@ -1721,7 +1721,7 @@ UINT16 GetExclusive24HourTimeValueFromField( UINT8 ubField ) void SetExclusive24HourTimeValue( UINT8 ubField, UINT16 usTime ) { TEXTINPUTNODE *curr; - //First make sure the time is a valid time. If not, then use 23:59 + //First make sure the time is a valid time. If not, then use 23:59 if( usTime == 0xffff ) { SetInputFieldStringWith16BitString( ubField, L"" ); diff --git a/Utils/Text Input.h b/Utils/Text Input.h index 14c1ec86..5c08e5af 100644 --- a/Utils/Text Input.h +++ b/Utils/Text Input.h @@ -3,33 +3,33 @@ #include "input.h" -//AUTHOR: Kris Morness +//AUTHOR: Kris Morness //Intended for inclusion with SGP. -//NEW CHANGES: January 16, 1998 -//I have added the ability to stack the text input modes. So, if you have a particular +//NEW CHANGES: January 16, 1998 +//I have added the ability to stack the text input modes. So, if you have a particular //screen that has fields, then somehow, hit a key to go into another mode with text input, -//it will automatically disable the current fields, as you go on to define new ones. Previously, -//you would have to make sure the mode was removed before initializing a new one. There were +//it will automatically disable the current fields, as you go on to define new ones. Previously, +//you would have to make sure the mode was removed before initializing a new one. There were //potential side effects of crashes, and unpredictable results, as the new fields would cook the //existing ones. -//NOTE: You may have to modify you code now, so that you don't accidentally kill a text input mode -//when you don't one to begin with. (like removing an already deleted button). Also, remember that +//NOTE: You may have to modify you code now, so that you don't accidentally kill a text input mode +//when you don't one to begin with. (like removing an already deleted button). Also, remember that //this works like a stack system and you can't flip through existing defined text input modes at will. //NOTES ON LIMITATIONS: // -max number of fields 255 (per level) -// -max num of chars in field 255 +// -max num of chars in field 255 -//These are the definitions for the input types. I didn't like the input filter idea, -//and the lack of freedom it gives you. This method is much simpler to use. -//NOTE: Uppercase/lowercase filters ensures that all input is either all uppercase or lowercase -//NOTE: Feel free to expand this to your needs, though you also need to support it in the filter -// section. +//These are the definitions for the input types. I didn't like the input filter idea, +//and the lack of freedom it gives you. This method is much simpler to use. +//NOTE: Uppercase/lowercase filters ensures that all input is either all uppercase or lowercase +//NOTE: Feel free to expand this to your needs, though you also need to support it in the filter +// section. #define INPUTTYPE_NUMERICSTRICT 0x0001 //0-9 only, no minus signs. #define INPUTTYPE_ALPHA 0x0002 //a-z A-Z #define INPUTTYPE_SPACES 0x0004 //allows spaces in input -#define INPUTTYPE_SPECIAL 0x0008 // !@#$%^&*()_+`|\[]{};':"<>,./? (spaces not included) +#define INPUTTYPE_SPECIAL 0x0008 // !@#$%^&*()_+`|\[]{};':"<>,./? (spaces not included) #define INPUTTYPE_UPPERCASE 0x0010 //converts all lowercase to uppercase #define INPUTTYPE_LOWERCASE 0x0020 //converts all uppercase to lowercase #define INPUTTYPE_FIRSTPOSMINUS 0x0002 //allows '-' at beginning of field only @@ -39,12 +39,12 @@ #define INPUTTYPE_ASCII (INPUTTYPE_ALPHANUMERIC | INPUTTYPE_SPECIALCHARS) //DON'T GO ABOVE INPUTTYPE_EXCLUSIVE_BASEVALUE FOR INPUTTYPE MASKED VALUES LISTED ABOVE!!! -#define INPUTTYPE_EXCLUSIVE_BASEVALUE 0x1000 //increase this value if necessary +#define INPUTTYPE_EXCLUSIVE_BASEVALUE 0x1000 //increase this value if necessary //Exclusive handlers //The dosfilename inputtype is a perfect example of what is a exclusive handler. //In this method, the input accepts only alphas and an underscore as the first character, -//then alphanumerics afterwards. For further support, chances are you'll want to treat it +//then alphanumerics afterwards. For further support, chances are you'll want to treat it //as an exclusive handler, and you'll have to process it in the filter input function. enum { @@ -54,15 +54,15 @@ enum //INPUTTYPE_EXCLUSIVE_NEWNEWNEW, etc... }; -//Simply initiates that you wish to begin inputting text. This should only apply to screen -//initializations that contain fields that edit text. It also verifies and clears any existing -//fields. Your input loop must contain the function HandleTextInput and processed if the gfTextInputMode -//flag is set else process your regular input handler. Note that this doesn't mean you are necessarily typing, -//just that there are text fields in your screen and may be inactive. The TAB key cycles through your text fields, +//Simply initiates that you wish to begin inputting text. This should only apply to screen +//initializations that contain fields that edit text. It also verifies and clears any existing +//fields. Your input loop must contain the function HandleTextInput and processed if the gfTextInputMode +//flag is set else process your regular input handler. Note that this doesn't mean you are necessarily typing, +//just that there are text fields in your screen and may be inactive. The TAB key cycles through your text fields, //and special fields can be defined which will call a void functionName( UINT16 usFieldNum ) void InitTextInputMode(); -//A hybrid version of InitTextInput() which uses a specific scheme. JA2's editor uses scheme 1, so +//A hybrid version of InitTextInput() which uses a specific scheme. JA2's editor uses scheme 1, so //feel free to add new color/font schemes. enum{ DEFAULT_SCHEME @@ -71,14 +71,14 @@ void InitTextInputModeWithScheme( UINT8 ubSchemeID ); //Clears any existing fields, and ends text input mode. void KillTextInputMode(); -//Kills all levels of text input modes. When you init a second consecutive text input mode, without -//first removing them, the existing mode will be preserved. This function removes all of them in one +//Kills all levels of text input modes. When you init a second consecutive text input mode, without +//first removing them, the existing mode will be preserved. This function removes all of them in one //call, though doing so "may" reflect poor coding style, though I haven't thought about any really //just uses for it :( void KillAllTextInputModes(); //Saves the current text input mode, then removes it and activates the previous text input mode, -//if applicable. The second function restores the settings. Doesn't currently support nested +//if applicable. The second function restores the settings. Doesn't currently support nested //calls. void SaveAndRemoveCurrentTextInputMode(); void RestoreSavedTextInputMode(); @@ -86,31 +86,31 @@ void RestoreSavedTextInputMode(); void SetTextInputCursor( UINT16 usNewCursor ); UINT16 GetTextInputCursor(); -//After calling InitTextInputMode, you want to define one or more text input fields. The order -//of calls to this function dictate the TAB order from traversing from one field to the next. This +//After calling InitTextInputMode, you want to define one or more text input fields. The order +//of calls to this function dictate the TAB order from traversing from one field to the next. This //function adds mouse regions and processes them for you, as well as deleting them when you are done. void AddTextInputField( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 sHeight, INT8 bPriority, - STR16 szInitText, UINT8 ubMaxChars, UINT16 usInputType ); + STR16 szInitText, UINT8 ubMaxChars, UINT16 usInputType ); -//This allows you to insert special processing functions and modes that can't be determined here. An example -//would be a file dialog where there would be a file list. This file list would be accessed using the Win95 -//convention by pressing TAB. In there, your key presses would be handled differently and by adding a userinput -//field, you can make this hook into your function to accomplish this. In a filedialog, alpha characters +//This allows you to insert special processing functions and modes that can't be determined here. An example +//would be a file dialog where there would be a file list. This file list would be accessed using the Win95 +//convention by pressing TAB. In there, your key presses would be handled differently and by adding a userinput +//field, you can make this hook into your function to accomplish this. In a filedialog, alpha characters //would be used to jump to the file starting with that letter, and setting the field in the text input -//field. Pressing TAB again would place you back in the text input field. All of that stuff would be handled +//field. Pressing TAB again would place you back in the text input field. All of that stuff would be handled //externally, except for the TAB keys. typedef void (*INPUT_CALLBACK)(UINT8,BOOLEAN); void AddUserInputField( INPUT_CALLBACK userFunction ); //INPUT_CALLBACK explanation: -//The function must use this signature: void FunctionName( UINT8 ubFieldID, BOOLEAN fEntering ); +//The function must use this signature: void FunctionName( UINT8 ubFieldID, BOOLEAN fEntering ); //ubFieldID contains the fieldID of that field //fEntering is true if you are entering the user field, false if exiting. -//Removes the specified field from the existing fields. If it doesn't exist, then there will be an +//Removes the specified field from the existing fields. If it doesn't exist, then there will be an //assertion failure. void RemoveTextInputField( UINT8 ubField ); -//This is a useful call made from an external user input field. Using the previous file dialog example, this +//This is a useful call made from an external user input field. Using the previous file dialog example, this //call would be made when the user selected a different filename in the list via clicking or scrolling with //the arrows, or even using alpha chars to jump to the appropriate filename. void SetInputFieldStringWith16BitString( UINT8 ubField, const STR16 szNewText ); @@ -126,10 +126,10 @@ UINT16 GetExclusive24HourTimeValueFromField( UINT8 ubField ); void SetExclusive24HourTimeValue( UINT8 ubField, UINT16 usTime ); //Converts the field's string into a number, then returns that number -//returns -1 if blank or invalid. Only works for positive numbers. +//returns -1 if blank or invalid. Only works for positive numbers. INT32 GetNumericStrictValueFromField( UINT8 ubField ); -//Converts a number to a numeric strict value. If the number is negative, the +//Converts a number to a numeric strict value. If the number is negative, the //field will be blank. void SetInputFieldStringWithNumericStrictValue( UINT8 ubField, INT32 iNumber ); @@ -138,12 +138,12 @@ void SetActiveField( UINT8 ubField ); void SelectNextField(); void SelectPrevField(); -//Returns the active field ID number. It'll return -1 if no field is active. +//Returns the active field ID number. It'll return -1 if no field is active. INT16 GetActiveFieldID(); -//These allow you to customize the general color scheme of your text input boxes. I am assuming that -//under no circumstances would a user want a different color for each field. It follows the Win95 convention -//that all text input boxes are exactly the same color scheme. However, these colors can be set at anytime, +//These allow you to customize the general color scheme of your text input boxes. I am assuming that +//under no circumstances would a user want a different color for each field. It follows the Win95 convention +//that all text input boxes are exactly the same color scheme. However, these colors can be set at anytime, //but will effect all of the colors. void SetTextInputFont( UINT16 usFont ); void Set16BPPTextFieldColor( UINT16 usTextFieldColor ); @@ -155,13 +155,13 @@ void SetBevelColors( UINT16 usBrighterColor, UINT16 usDarkerColor ); void SetCursorColor( UINT16 usCursorColor ); //All CTRL and ALT keys combinations, F1-F12 keys, ENTER and ESC are ignored allowing -//processing to be done with your own input handler. Otherwise, the keyboard event +//processing to be done with your own input handler. Otherwise, the keyboard event //is absorbed by this input handler, if used in the appropriate manner. //This call must be added at the beginning of your input handler in this format: //while( DequeueEvent(&Event) ) //{ -// if( !HandleTextInput( &Event ) && (your conditions...ex: Event.usEvent == KEY_DOWN ) ) -// { +// if( !HandleTextInput( &Event ) && (your conditions...ex: Event.usEvent == KEY_DOWN ) ) +// { // switch( Event.usParam ) // { // //Normal key cases here. diff --git a/Utils/Text Utils.cpp b/Utils/Text Utils.cpp index d7971938..fbf86b22 100644 --- a/Utils/Text Utils.cpp +++ b/Utils/Text Utils.cpp @@ -20,7 +20,7 @@ BOOLEAN LoadItemInfo(UINT16 ubIndex, STR16 pNameString, STR16 pInfoString ) j++; if ( j<(int)strlen(Item[ubIndex].szLongItemName )) { - pNameString[i] = Item[ubIndex].szLongItemName [j]; + pNameString[i] = Item[ubIndex].szLongItemName [j]; #ifdef GERMAN // We have a german special character @@ -30,39 +30,39 @@ BOOLEAN LoadItemInfo(UINT16 ubIndex, STR16 pNameString, STR16 pInfoString ) switch (Item[ubIndex].szLongItemName [j + 1]) { // ü - case -68: + case -68: pNameString[i] = 252; // Skip next character, because "umlaute" have 2 chars j++; break; // Ü - case -100: + case -100: pNameString[i] = 220; j++; break; // ä - case -92: - pNameString[i] = 228; + case -92: + pNameString[i] = 228; j++; break; // Ä - case -124: - pNameString[i] = 196; + case -124: + pNameString[i] = 196; j++; break; // ö - case -74: - pNameString[i] = 246; + case -74: + pNameString[i] = 246; j++; break; // Ö - case -106: - pNameString[i] = 214; + case -106: + pNameString[i] = 214; j++; break; // ß - case -97: - pNameString[i] = 223; + case -97: + pNameString[i] = 223; j++; break; } @@ -100,7 +100,7 @@ BOOLEAN LoadItemInfo(UINT16 ubIndex, STR16 pNameString, STR16 pInfoString ) { // This character determines the special character switch ( (unsigned char)Item[ubIndex].szLongItemName [j + 1] ) - { + { //capital letters case 129: pNameString[ i ] = 197; j++; break; //U+0401 d0 81 CYRILLIC CAPITAL LETTER IO @@ -134,7 +134,7 @@ BOOLEAN LoadItemInfo(UINT16 ubIndex, STR16 pNameString, STR16 pInfoString ) case 171: pNameString[ i ] = 219; j++; break; case 172: pNameString[ i ] = 220; j++; break; case 173: pNameString[ i ] = 221; j++; break; - case 174: pNameString[ i ] = 222; j++; break; + case 174: pNameString[ i ] = 222; j++; break; case 175: pNameString[ i ] = 223; j++; break; //U+042F d0 af CYRILLIC CAPITAL LETTER YA //small letters @@ -152,7 +152,7 @@ BOOLEAN LoadItemInfo(UINT16 ubIndex, STR16 pNameString, STR16 pInfoString ) case 187: pNameString[ i ] = 235; j++; break; case 188: pNameString[ i ] = 236; j++; break; case 189: pNameString[ i ] = 237; j++; break; - case 190: pNameString[ i ] = 238; j++; break; + case 190: pNameString[ i ] = 238; j++; break; case 191: pNameString[ i ] = 239; j++; break; //U+043F d0 bf CYRILLIC SMALL LETTER PE } } @@ -161,7 +161,7 @@ BOOLEAN LoadItemInfo(UINT16 ubIndex, STR16 pNameString, STR16 pInfoString ) { // This character determines the special character switch ( (unsigned char)Item[ubIndex].szLongItemName [j + 1] ) - { + { case 128: pNameString[ i ] = 240; j++; break; //U+0440 p d1 80 CYRILLIC SMALL LETTER ER case 129: pNameString[ i ] = 241; j++; break; case 130: pNameString[ i ] = 242; j++; break; @@ -205,7 +205,7 @@ BOOLEAN LoadItemInfo(UINT16 ubIndex, STR16 pNameString, STR16 pInfoString ) j++; if ( j<(int)strlen(Item[ubIndex].szItemDesc )) { - pInfoString[i] = Item[ubIndex].szItemDesc [j]; + pInfoString[i] = Item[ubIndex].szItemDesc [j]; #ifdef GERMAN // We have a german special character @@ -215,39 +215,39 @@ BOOLEAN LoadItemInfo(UINT16 ubIndex, STR16 pNameString, STR16 pInfoString ) switch (Item[ubIndex].szItemDesc [j + 1]) { // ü - case -68: + case -68: pInfoString[i] = 252; // Skip next character, because "umlaute" have 2 chars j++; break; // Ü - case -100: + case -100: pInfoString[i] = 220; j++; break; // ä - case -92: - pInfoString[i] = 228; + case -92: + pInfoString[i] = 228; j++; break; // Ä - case -124: - pInfoString[i] = 196; + case -124: + pInfoString[i] = 196; j++; break; // ö - case -74: - pInfoString[i] = 246; + case -74: + pInfoString[i] = 246; j++; break; // Ö - case -106: - pInfoString[i] = 214; + case -106: + pInfoString[i] = 214; j++; break; // ß - case -97: - pInfoString[i] = 223; + case -97: + pInfoString[i] = 223; j++; break; } @@ -286,7 +286,7 @@ BOOLEAN LoadItemInfo(UINT16 ubIndex, STR16 pNameString, STR16 pInfoString ) { // This character determines the special character switch ( (unsigned char)Item[ubIndex].szItemDesc [j + 1] ) - { + { //capital letters case 129: pInfoString[ i ] = 197; j++; break; //U+0401 d0 81 CYRILLIC CAPITAL LETTER IO @@ -320,7 +320,7 @@ BOOLEAN LoadItemInfo(UINT16 ubIndex, STR16 pNameString, STR16 pInfoString ) case 171: pInfoString[ i ] = 219; j++; break; case 172: pInfoString[ i ] = 220; j++; break; case 173: pInfoString[ i ] = 221; j++; break; - case 174: pInfoString[ i ] = 222; j++; break; + case 174: pInfoString[ i ] = 222; j++; break; case 175: pInfoString[ i ] = 223; j++; break; //U+042F d0 af CYRILLIC CAPITAL LETTER YA //small letters @@ -338,7 +338,7 @@ BOOLEAN LoadItemInfo(UINT16 ubIndex, STR16 pNameString, STR16 pInfoString ) case 187: pInfoString[ i ] = 235; j++; break; case 188: pInfoString[ i ] = 236; j++; break; case 189: pInfoString[ i ] = 237; j++; break; - case 190: pInfoString[ i ] = 238; j++; break; + case 190: pInfoString[ i ] = 238; j++; break; case 191: pInfoString[ i ] = 239; j++; break; //U+043F d0 bf CYRILLIC SMALL LETTER PE } } @@ -347,7 +347,7 @@ BOOLEAN LoadItemInfo(UINT16 ubIndex, STR16 pNameString, STR16 pInfoString ) { // This character determines the special character switch ( (unsigned char)Item[ubIndex].szItemDesc [j + 1] ) - { + { case 128: pInfoString[ i ] = 240; j++; break; //U+0440 p d1 80 CYRILLIC SMALL LETTER ER case 129: pInfoString[ i ] = 241; j++; break; case 130: pInfoString[ i ] = 242; j++; break; @@ -368,12 +368,12 @@ BOOLEAN LoadItemInfo(UINT16 ubIndex, STR16 pNameString, STR16 pInfoString ) case 145: pInfoString[ i ] = 229; j++; break; //U+0451 d1 91 CYRILLIC SMALL LETTER IO } } - + //if ( ((unsigned char)Item[ubIndex].szItemDesc [j] == 211) ) //d3 //{ // // This character determines the special character // switch ( (unsigned char)Item[ubIndex].szItemDesc [j + 1] ) - // { + // { // case 162: pInfoString[ i ] = 20; j++; break;//U+04E2 d3a2 CYRILLIC CAPITAL LETTER I WITH MACRON // case 163: pInfoString[ i ] = 20; j++; break;//U+04E3 d3a3 CYRILLIC SMALL LETTER I WITH MACRON // } @@ -406,7 +406,7 @@ BOOLEAN LoadBRName(UINT16 ubIndex, STR16 pNameString ) j++; if ( j<(int)strlen(Item[ubIndex].szBRName)) { - pNameString[i] = Item[ubIndex].szBRName [j]; + pNameString[i] = Item[ubIndex].szBRName [j]; #ifdef GERMAN // We have a german special character @@ -416,39 +416,39 @@ BOOLEAN LoadBRName(UINT16 ubIndex, STR16 pNameString ) switch (Item[ubIndex].szBRName [j + 1]) { // ü - case -68: + case -68: pNameString[i] = 252; // Skip next character, because "umlaute" have 2 chars j++; break; // Ü - case -100: + case -100: pNameString[i] = 220; j++; break; // ä - case -92: - pNameString[i] = 228; + case -92: + pNameString[i] = 228; j++; break; // Ä - case -124: - pNameString[i] = 196; + case -124: + pNameString[i] = 196; j++; break; // ö - case -74: - pNameString[i] = 246; + case -74: + pNameString[i] = 246; j++; break; // Ö - case -106: - pNameString[i] = 214; + case -106: + pNameString[i] = 214; j++; break; // ß - case -97: - pNameString[i] = 223; + case -97: + pNameString[i] = 223; j++; break; } @@ -486,7 +486,7 @@ BOOLEAN LoadBRName(UINT16 ubIndex, STR16 pNameString ) { // This character determines the special character switch ( (unsigned char)Item[ubIndex].szBRName [j + 1] ) - { + { //capital letters case 129: pNameString[ i ] = 197; j++; break; //U+0401 d0 81 CYRILLIC CAPITAL LETTER IO @@ -520,7 +520,7 @@ BOOLEAN LoadBRName(UINT16 ubIndex, STR16 pNameString ) case 171: pNameString[ i ] = 219; j++; break; case 172: pNameString[ i ] = 220; j++; break; case 173: pNameString[ i ] = 221; j++; break; - case 174: pNameString[ i ] = 222; j++; break; + case 174: pNameString[ i ] = 222; j++; break; case 175: pNameString[ i ] = 223; j++; break; //U+042F d0 af CYRILLIC CAPITAL LETTER YA //small letters @@ -538,7 +538,7 @@ BOOLEAN LoadBRName(UINT16 ubIndex, STR16 pNameString ) case 187: pNameString[ i ] = 235; j++; break; case 188: pNameString[ i ] = 236; j++; break; case 189: pNameString[ i ] = 237; j++; break; - case 190: pNameString[ i ] = 238; j++; break; + case 190: pNameString[ i ] = 238; j++; break; case 191: pNameString[ i ] = 239; j++; break; //U+043F d0 bf CYRILLIC SMALL LETTER PE } } @@ -547,7 +547,7 @@ BOOLEAN LoadBRName(UINT16 ubIndex, STR16 pNameString ) { // This character determines the special character switch ( (unsigned char)Item[ubIndex].szBRName [j + 1] ) - { + { case 128: pNameString[ i ] = 240; j++; break; //U+0440 p d1 80 CYRILLIC SMALL LETTER ER case 129: pNameString[ i ] = 241; j++; break; case 130: pNameString[ i ] = 242; j++; break; @@ -595,7 +595,7 @@ BOOLEAN LoadBRDesc(UINT16 ubIndex, STR16 pDescString ) j++; if ( j<(int)strlen(Item[ubIndex].szBRDesc)) { - pDescString[i] = Item[ubIndex].szBRDesc [j]; + pDescString[i] = Item[ubIndex].szBRDesc [j]; // WANNE: German specific characters #ifdef GERMAN @@ -606,39 +606,39 @@ BOOLEAN LoadBRDesc(UINT16 ubIndex, STR16 pDescString ) switch (Item[ubIndex].szBRDesc [j + 1]) { // ü - case -68: + case -68: pDescString[i] = 252; // Skip next character, because "umlaute" have 2 chars j++; break; // Ü - case -100: + case -100: pDescString[i] = 220; j++; break; // ä - case -92: - pDescString[i] = 228; + case -92: + pDescString[i] = 228; j++; break; // Ä - case -124: - pDescString[i] = 196; + case -124: + pDescString[i] = 196; j++; break; // ö - case -74: - pDescString[i] = 246; + case -74: + pDescString[i] = 246; j++; break; // Ö - case -106: - pDescString[i] = 214; + case -106: + pDescString[i] = 214; j++; break; // ß - case -97: - pDescString[i] = 223; + case -97: + pDescString[i] = 223; j++; break; } @@ -676,7 +676,7 @@ BOOLEAN LoadBRDesc(UINT16 ubIndex, STR16 pDescString ) { // This character determines the special character switch ( (unsigned char)Item[ubIndex].szBRDesc [j + 1] ) - { + { //capital letters case 129: pDescString[ i ] = 197; j++; break; //U+0401 d0 81 CYRILLIC CAPITAL LETTER IO @@ -710,7 +710,7 @@ BOOLEAN LoadBRDesc(UINT16 ubIndex, STR16 pDescString ) case 171: pDescString[ i ] = 219; j++; break; case 172: pDescString[ i ] = 220; j++; break; case 173: pDescString[ i ] = 221; j++; break; - case 174: pDescString[ i ] = 222; j++; break; + case 174: pDescString[ i ] = 222; j++; break; case 175: pDescString[ i ] = 223; j++; break; //U+042F d0 af CYRILLIC CAPITAL LETTER YA //small letters @@ -728,7 +728,7 @@ BOOLEAN LoadBRDesc(UINT16 ubIndex, STR16 pDescString ) case 187: pDescString[ i ] = 235; j++; break; case 188: pDescString[ i ] = 236; j++; break; case 189: pDescString[ i ] = 237; j++; break; - case 190: pDescString[ i ] = 238; j++; break; + case 190: pDescString[ i ] = 238; j++; break; case 191: pDescString[ i ] = 239; j++; break; //U+043F d0 bf CYRILLIC SMALL LETTER PE } } @@ -737,7 +737,7 @@ BOOLEAN LoadBRDesc(UINT16 ubIndex, STR16 pDescString ) { // This character determines the special character switch ( (unsigned char)Item[ubIndex].szBRDesc [j + 1] ) - { + { case 128: pDescString[ i ] = 240; j++; break; //U+0440 p d1 80 CYRILLIC SMALL LETTER ER case 129: pDescString[ i ] = 241; j++; break; case 130: pDescString[ i ] = 242; j++; break; @@ -784,7 +784,7 @@ BOOLEAN LoadShortNameItemInfo(UINT16 ubIndex, STR16 pNameString ) for (int i=0;i<80;i++) { j++; - + if ( i<(int)wcslen(Item[ubIndex].szItemName)) { pNameString[i] = Item[ubIndex].szItemName [j]; @@ -798,39 +798,39 @@ BOOLEAN LoadShortNameItemInfo(UINT16 ubIndex, STR16 pNameString ) switch (Item[ubIndex].szItemName [j + 1]) { // ü - case -68: + case -68: pNameString[i] = 252; // Skip next character, because "umlaute" have 2 chars j++; break; // Ü - case -100: + case -100: pNameString[i] = 220; j++; break; // ä - case -92: - pNameString[i] = 228; + case -92: + pNameString[i] = 228; j++; break; // Ä - case -124: - pNameString[i] = 196; + case -124: + pNameString[i] = 196; j++; break; // ö - case -74: - pNameString[i] = 246; + case -74: + pNameString[i] = 246; j++; break; // Ö - case -106: - pNameString[i] = 214; + case -106: + pNameString[i] = 214; j++; break; // ß - case -97: - pNameString[i] = 223; + case -97: + pNameString[i] = 223; j++; break; } @@ -870,7 +870,7 @@ BOOLEAN LoadShortNameItemInfo(UINT16 ubIndex, STR16 pNameString ) { // This character determines the special character switch ( (unsigned char)Item[ubIndex].szItemName [j + 1] ) - { + { //capital letters case 129: pNameString[ i ] = 197; j++; break; //U+0401 d0 81 CYRILLIC CAPITAL LETTER IO @@ -904,7 +904,7 @@ BOOLEAN LoadShortNameItemInfo(UINT16 ubIndex, STR16 pNameString ) case 171: pNameString[ i ] = 219; j++; break; case 172: pNameString[ i ] = 220; j++; break; case 173: pNameString[ i ] = 221; j++; break; - case 174: pNameString[ i ] = 222; j++; break; + case 174: pNameString[ i ] = 222; j++; break; case 175: pNameString[ i ] = 223; j++; break; //U+042F d0 af CYRILLIC CAPITAL LETTER YA //small letters @@ -922,7 +922,7 @@ BOOLEAN LoadShortNameItemInfo(UINT16 ubIndex, STR16 pNameString ) case 187: pNameString[ i ] = 235; j++; break; case 188: pNameString[ i ] = 236; j++; break; case 189: pNameString[ i ] = 237; j++; break; - case 190: pNameString[ i ] = 238; j++; break; + case 190: pNameString[ i ] = 238; j++; break; case 191: pNameString[ i ] = 239; j++; break; //U+043F d0 bf CYRILLIC SMALL LETTER PE } } @@ -931,7 +931,7 @@ BOOLEAN LoadShortNameItemInfo(UINT16 ubIndex, STR16 pNameString ) { // This character determines the special character switch ( (unsigned char)Item[ubIndex].szItemName [j + 1] ) - { + { case 128: pNameString[ i ] = 240; j++; break; //U+0440 p d1 80 CYRILLIC SMALL LETTER ER case 129: pNameString[ i ] = 241; j++; break; case 130: pNameString[ i ] = 242; j++; break; @@ -1021,3 +1021,4 @@ FLOAT GetWeightBasedOnMetricOption( UINT32 uiObjectWeight ) } + diff --git a/Utils/Text.h b/Utils/Text.h index 0a980de3..58b70015 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -325,7 +325,7 @@ enum STR_SURRENDER, STR_REFUSE_FIRSTAID, STR_REFUSE_FIRSTAID_FOR_CREATURE, - STR_HOW_TO_USE_SKYRIDDER, + STR_HOW_TO_USE_SKYRIDDER, STR_RELOAD_ONLY_ONE_GUN, STR_BLOODCATS_TURN, STR_AUTOFIRE, @@ -547,9 +547,10 @@ enum LOCK_HAS_BEEN_HIT, LOCK_HAS_BEEN_DESTROYED, DOOR_IS_BUSY, - VEHICLE_VITAL_STATS_POPUPTEXT, - NO_LOS_TO_TALK_TARGET, + VEHICLE_VITAL_STATS_POPUPTEXT, + NO_LOS_TO_TALK_TARGET, ATTACHMENT_REMOVED, + VEHICLE_CAN_NOT_BE_ADDED, }; enum{ @@ -820,6 +821,7 @@ enum // Used BOBBYR_FILTER_USED_GUNS, BOBBYR_FILTER_USED_ARMOR, + BOBBYR_FILTER_USED_LBEGEAR, BOBBYR_FILTER_USED_MISC, // Armour BOBBYR_FILTER_ARMOUR_HELM, @@ -835,6 +837,7 @@ enum BOBBYR_FILTER_MISC_MEDKIT, BOBBYR_FILTER_MISC_KIT, BOBBYR_FILTER_MISC_FACE, + BOBBYR_FILTER_MISC_LBEGEAR, BOBBYR_FILTER_MISC_MISC, }; @@ -1112,11 +1115,11 @@ extern STR16 zMarksMapScreenText[]; //Weapon Name and Description size #define ITEMSTRINGFILENAME "BINARYDATA\\ITEMDESC.EDT" -#define SIZE_ITEM_NAME 160 -#define SIZE_SHORT_ITEM_NAME 160 -#define SIZE_ITEM_INFO 480 -#define SIZE_ITEM_PROS 160 -#define SIZE_ITEM_CONS 160 +#define SIZE_ITEM_NAME 160 +#define SIZE_SHORT_ITEM_NAME 160 +#define SIZE_ITEM_INFO 480 +#define SIZE_ITEM_PROS 160 +#define SIZE_ITEM_CONS 160 BOOLEAN LoadItemInfo(UINT16 ubIndex, STR16 pNameString, STR16 pInfoString ); extern void LoadAllExternalText( void ); @@ -1325,6 +1328,8 @@ enum SLG_BR_GREAT_TEXT, SLG_BR_EXCELLENT_TEXT, SLG_BR_AWESOME_TEXT, + + SLG_INV_RES_ERROR, }; extern STR16 zSaveLoadText[]; @@ -1406,6 +1411,10 @@ enum GIO_BR_GREAT_TEXT, GIO_BR_EXCELLENT_TEXT, GIO_BR_AWESOME_TEXT, + + GIO_INV_TEXT, + GIO_INV_OLD_TEXT, + GIO_INV_NEW_TEXT, }; extern STR16 gzGIOScreenText[]; @@ -1547,4 +1556,16 @@ enum MSG113_ARRIVINGREROUTED, }; -#endif \ No newline at end of file +//CHRISL: NewInv messages +extern STR16 NewInvMessage[]; + +enum +{ + NIV_CAN_NOT_PICKUP, + NIV_NO_DROP, + NIV_NO_PACK, + NIV_ZIPPER_COMBAT, + NIV_ZIPPER_NO_MOVE, +}; + +#endif diff --git a/Utils/Timer Control.cpp b/Utils/Timer Control.cpp index f5a9f7d3..2781c5a6 100644 --- a/Utils/Timer Control.cpp +++ b/Utils/Timer Control.cpp @@ -1,6 +1,6 @@ #ifdef PRECOMPILEDHEADERS #include "Utils All.h" - #include "interface control.h" + #include "interface control.h" #else #include #include @@ -29,7 +29,7 @@ UINT32 guiBaseJA2NoPauseClock = 0; BOOLEAN gfPauseClock = FALSE; INT32 giTimerIntervals[ NUMTIMERS ] = -{ +{ 5, // Tactical Overhead 20, // NEXTSCROLL 200, // Start Scroll @@ -93,7 +93,7 @@ extern INT32 giCommonGlowBaseTime; extern INT32 giFlashAssignBaseTime; extern INT32 giFlashContractBaseTime; extern UINT32 guiFlashCursorBaseTime; -extern INT32 giPotCharPathBaseTime; +extern INT32 giPotCharPathBaseTime; UINT32 InitializeJA2TimerCallback( UINT32 uiDelay, LPTIMECALLBACK TimerProc, UINT32 uiUser ); @@ -136,40 +136,40 @@ void CALLBACK TimeProc( UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2 #ifndef BOUNDS_CHECKER - // If mapscreen... - if( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) - { - // IN Mapscreen, loop through player's team..... - for ( gCNT = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; gCNT <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; gCNT++ ) - { - gPSOLDIER = MercPtrs[ gCNT ]; - UPDATETIMECOUNTER( gPSOLDIER->PortraitFlashCounter ); - UPDATETIMECOUNTER( gPSOLDIER->PanelAnimateCounter ); - } - } - else - { - // Set update flags for soldiers - //////////////////////////// - for ( gCNT = 0; gCNT < guiNumMercSlots; gCNT++ ) - { - gPSOLDIER = MercSlots[ gCNT ]; + // If mapscreen... + if( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) + { + // IN Mapscreen, loop through player's team..... + for ( gCNT = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; gCNT <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; gCNT++ ) + { + gPSOLDIER = MercPtrs[ gCNT ]; + UPDATETIMECOUNTER( gPSOLDIER->timeCounters.PortraitFlashCounter ); + UPDATETIMECOUNTER( gPSOLDIER->timeCounters.PanelAnimateCounter ); + } + } + else + { + // Set update flags for soldiers + //////////////////////////// + for ( gCNT = 0; gCNT < guiNumMercSlots; gCNT++ ) + { + gPSOLDIER = MercSlots[ gCNT ]; - if ( gPSOLDIER != NULL ) - { - UPDATETIMECOUNTER( gPSOLDIER->UpdateCounter ); - UPDATETIMECOUNTER( gPSOLDIER->DamageCounter ); - UPDATETIMECOUNTER( gPSOLDIER->ReloadCounter ); - UPDATETIMECOUNTER( gPSOLDIER->FlashSelCounter ); - UPDATETIMECOUNTER( gPSOLDIER->BlinkSelCounter ); - UPDATETIMECOUNTER( gPSOLDIER->PortraitFlashCounter ); - UPDATETIMECOUNTER( gPSOLDIER->AICounter ); - UPDATETIMECOUNTER( gPSOLDIER->FadeCounter ); - UPDATETIMECOUNTER( gPSOLDIER->NextTileCounter ); - UPDATETIMECOUNTER( gPSOLDIER->PanelAnimateCounter ); - } - } - } + if ( gPSOLDIER != NULL ) + { + UPDATETIMECOUNTER( gPSOLDIER->timeCounters.UpdateCounter ); + UPDATETIMECOUNTER( gPSOLDIER->timeCounters.DamageCounter ); + UPDATETIMECOUNTER( gPSOLDIER->timeCounters.ReloadCounter ); + UPDATETIMECOUNTER( gPSOLDIER->timeCounters.FlashSelCounter ); + UPDATETIMECOUNTER( gPSOLDIER->timeCounters.BlinkSelCounter ); + UPDATETIMECOUNTER( gPSOLDIER->timeCounters.PortraitFlashCounter ); + UPDATETIMECOUNTER( gPSOLDIER->timeCounters.AICounter ); + UPDATETIMECOUNTER( gPSOLDIER->timeCounters.FadeCounter ); + UPDATETIMECOUNTER( gPSOLDIER->timeCounters.NextTileCounter ); + UPDATETIMECOUNTER( gPSOLDIER->timeCounters.PanelAnimateCounter ); + } + } + } #endif } @@ -203,28 +203,28 @@ BOOLEAN InitializeJA2Clock(void) if ( mmResult != TIMERR_NOERROR ) { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Could not get timer properties"); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Could not get timer properties"); } // Set timer at lowest resolution. Could use middle of lowest/highest, we'll see how this performs first gTimerID = timeSetEvent( BASETIMESLICE, BASETIMESLICE, TimeProc, (DWORD)0, TIME_PERIODIC ); - + if ( !gTimerID ) { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Could not create timer callback"); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Could not create timer callback"); } #endif - return TRUE; + return TRUE; } -void ShutdownJA2Clock(void) +void ShutdownJA2Clock(void) { - // Make sure we kill the timer + // Make sure we kill the timer #ifdef CALLBACKTIMER - timeKillEvent( gTimerID ); + timeKillEvent( gTimerID ); #endif @@ -242,18 +242,18 @@ UINT32 InitializeJA2TimerCallback( UINT32 uiDelay, LPTIMECALLBACK TimerProc, UIN if ( mmResult != TIMERR_NOERROR ) { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Could not get timer properties"); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Could not get timer properties"); } // Set timer at lowest resolution. Could use middle of lowest/highest, we'll see how this performs first TimerID = timeSetEvent( (UINT)uiDelay, (UINT)uiDelay, TimerProc, (DWORD)uiUser, TIME_PERIODIC ); - + if ( !TimerID ) { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Could not create timer callback"); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Could not create timer callback"); } - return ( (UINT32)TimerID ); + return ( (UINT32)TimerID ); } @@ -271,7 +271,7 @@ UINT32 InitializeJA2TimerID( UINT32 uiDelay, UINT32 uiCallbackID, UINT32 uiUser return( InitializeJA2TimerCallback( uiDelay, FlashItem, uiUser ) ); break; - + } // invalid callback id @@ -316,7 +316,7 @@ void CheckCustomizableTimer( void ) if ( TIMECOUNTERDONE( giTimerCustomizable, 0 ) ) { // set the callback to a temp variable so we can reset the global variable - // before calling the callback, so that if the callback sets up another + // before calling the callback, so that if the callback sets up another // instance of the timer, we don't reset it afterwards CUSTOMIZABLE_TIMER_CALLBACK pTempCallback; @@ -337,8 +337,8 @@ void ResetJA2ClockGlobalTimers( void ) guiCompressionStringBaseTime = uiCurrentTime; giFlashHighlightedItemBaseTime = uiCurrentTime; giCompatibleItemBaseTime = uiCurrentTime; - giAnimateRouteBaseTime = uiCurrentTime; - giPotHeliPathBaseTime = uiCurrentTime; + giAnimateRouteBaseTime = uiCurrentTime; + giPotHeliPathBaseTime = uiCurrentTime; giClickHeliIconBaseTime = uiCurrentTime; giExitToTactBaseTime = uiCurrentTime; guiSectorLocatorBaseTime = uiCurrentTime; @@ -347,5 +347,5 @@ void ResetJA2ClockGlobalTimers( void ) giFlashAssignBaseTime = uiCurrentTime; giFlashContractBaseTime = uiCurrentTime; guiFlashCursorBaseTime = uiCurrentTime; - giPotCharPathBaseTime = uiCurrentTime; + giPotCharPathBaseTime = uiCurrentTime; } diff --git a/Utils/Timer Control.h b/Utils/Timer Control.h index 412f82ab..2e1b29f2 100644 --- a/Utils/Timer Control.h +++ b/Utils/Timer Control.h @@ -29,7 +29,7 @@ enum PATHFINDCOUNTER, // PATH FIND COUNTER CURSORCOUNTER, // ANIMATED CURSOR RMOUSECLICK_DELAY_COUNTER, // RIGHT BUTTON CLICK DELAY - LMOUSECLICK_DELAY_COUNTER, // LEFT BUTTON CLICK DELAY + LMOUSECLICK_DELAY_COUNTER, // LEFT BUTTON CLICK DELAY SLIDETEXT, // DAMAGE DISPLAY TARGETREFINE, // TARGET REFINE CURSORFLASH, // Cursor/AP flash @@ -66,14 +66,14 @@ extern INT32 giTimerTeamTurnUpdate; // Functions BOOLEAN InitializeJA2Clock( void ); -void ShutdownJA2Clock( void ); +void ShutdownJA2Clock( void ); #define GetJA2Clock() guiBaseJA2Clock UINT32 GetPauseJA2Clock( ); UINT32 InitializeJA2TimerID( UINT32 uiDelay, UINT32 uiCallbackID, UINT32 uiUser ); -void RemoveJA2TimerCallback( UINT32 uiTimer ); +void RemoveJA2TimerCallback( UINT32 uiTimer ); void PauseTime( BOOLEAN fPaused ); @@ -85,35 +85,35 @@ extern UINT32 guiBaseJA2Clock; extern CUSTOMIZABLE_TIMER_CALLBACK gpCustomizableTimerCallback; // MACROS -// CHeck if new counter < 0 | set to 0 | Decrement +// CHeck if new counter < 0 | set to 0 | Decrement #ifdef CALLBACKTIMER -#define UPDATECOUNTER( c ) ( ( giTimerCounters[ c ] - BASETIMESLICE ) < 0 ) ? ( giTimerCounters[ c ] = 0 ) : ( giTimerCounters[ c ] -= BASETIMESLICE ) -#define RESETCOUNTER( c ) ( giTimerCounters[ c ] = giTimerIntervals[ c ] ) -#define COUNTERDONE( c ) ( giTimerCounters[ c ] == 0 ) ? TRUE : FALSE +#define UPDATECOUNTER( c ) ( ( giTimerCounters[ c ] - BASETIMESLICE ) < 0 ) ? ( giTimerCounters[ c ] = 0 ) : ( giTimerCounters[ c ] -= BASETIMESLICE ) +#define RESETCOUNTER( c ) ( giTimerCounters[ c ] = giTimerIntervals[ c ] ) +#define COUNTERDONE( c ) ( giTimerCounters[ c ] == 0 ) ? TRUE : FALSE -#define UPDATETIMECOUNTER( c ) ( ( c - BASETIMESLICE ) < 0 ) ? ( c = 0 ) : ( c -= BASETIMESLICE ) +#define UPDATETIMECOUNTER( c ) ( ( c - BASETIMESLICE ) < 0 ) ? ( c = 0 ) : ( c -= BASETIMESLICE ) #define RESETTIMECOUNTER( c, d ) ( c = d ) #ifdef BOUNDS_CHECKER - #define TIMECOUNTERDONE( c, d ) ( TRUE ) + #define TIMECOUNTERDONE( c, d ) ( TRUE ) #else - #define TIMECOUNTERDONE( c, d ) ( c == 0 ) ? TRUE : FALSE + #define TIMECOUNTERDONE( c, d ) ( c == 0 ) ? TRUE : FALSE #endif #define SYNCTIMECOUNTER( ) -#define ZEROTIMECOUNTER( c ) ( c = 0 ) +#define ZEROTIMECOUNTER( c ) ( c = 0 ) #else -#define UPDATECOUNTER( c ) -#define RESETCOUNTER( c ) ( giTimerCounters[ c ] = giClockTimer ) -#define COUNTERDONE( c ) ( ( ( giClockTimer = GetJA2Clock() ) - giTimerCounters[ c ] ) > giTimerIntervals[ c ] ) ? TRUE : FALSE +#define UPDATECOUNTER( c ) +#define RESETCOUNTER( c ) ( giTimerCounters[ c ] = giClockTimer ) +#define COUNTERDONE( c ) ( ( ( giClockTimer = GetJA2Clock() ) - giTimerCounters[ c ] ) > giTimerIntervals[ c ] ) ? TRUE : FALSE -#define UPDATETIMECOUNTER( c ) -#define RESETTIMECOUNTER( c, d ) ( c = giClockTimer ) -#define TIMECOUNTERDONE( c, d ) ( giClockTimer - c > d ) ? TRUE : FALSE +#define UPDATETIMECOUNTER( c ) +#define RESETTIMECOUNTER( c, d ) ( c = giClockTimer ) +#define TIMECOUNTERDONE( c, d ) ( giClockTimer - c > d ) ? TRUE : FALSE #define SYNCTIMECOUNTER( ) ( giClockTimer = GetJA2Clock() ) #endif diff --git a/Utils/Utilities.cpp b/Utils/Utilities.cpp index 0090094b..b6fa108e 100644 --- a/Utils/Utilities.cpp +++ b/Utils/Utilities.cpp @@ -24,76 +24,76 @@ extern BOOLEAN GetCDromDriveLetter( STR8 pString ); BOOLEAN PerformTimeLimitedCheck(); // WANNE: Given a string, replaces all instances of "oldpiece" with "newpiece" -/* +/* * * Modified this routine to eliminate recursion and to avoid infinite - * expansion of string when newpiece contains oldpiece. --Byron -*/ -//STR8 Replace(STR8 string, STR8 oldpiece, STR8 newpiece) -//{ -// int str_index, newstr_index, oldpiece_index, end, + * expansion of string when newpiece contains oldpiece. --Byron +*/ +//STR8 Replace(STR8 string, STR8 oldpiece, STR8 newpiece) +//{ +// int str_index, newstr_index, oldpiece_index, end, // -// new_len, old_len, cpy_len; -// STR8 c; -// static char newstring[MAXLINE]; +// new_len, old_len, cpy_len; +// STR8 c; +// static char newstring[MAXLINE]; // -// if ((c = strstr(string, oldpiece)) == NULL) +// if ((c = strstr(string, oldpiece)) == NULL) // -// return string; +// return string; // -// new_len = strlen(newpiece); -// old_len = strlen(oldpiece); -// end = strlen(string) - old_len; -// oldpiece_index = c - string; +// new_len = strlen(newpiece); +// old_len = strlen(oldpiece); +// end = strlen(string) - old_len; +// oldpiece_index = c - string; // // -// newstr_index = 0; -// str_index = 0; -// while(str_index <= end && c != NULL) -// { +// newstr_index = 0; +// str_index = 0; +// while(str_index <= end && c != NULL) +// { // -// //Copy characters from the left of matched pattern occurence -// cpy_len = oldpiece_index-str_index; -// strncpy(newstring+newstr_index, string+str_index, cpy_len); -// newstr_index += cpy_len; -// str_index += cpy_len; +// //Copy characters from the left of matched pattern occurence +// cpy_len = oldpiece_index-str_index; +// strncpy(newstring+newstr_index, string+str_index, cpy_len); +// newstr_index += cpy_len; +// str_index += cpy_len; // -// //Copy replacement characters instead of matched pattern -// strcpy(newstring+newstr_index, newpiece); -// newstr_index += new_len; -// str_index += old_len; +// //Copy replacement characters instead of matched pattern +// strcpy(newstring+newstr_index, newpiece); +// newstr_index += new_len; +// str_index += old_len; // -// //Check for another pattern match -// if((c = strstr(string+str_index, oldpiece)) != NULL) -// oldpiece_index = c - string; +// //Check for another pattern match +// if((c = strstr(string+str_index, oldpiece)) != NULL) +// oldpiece_index = c - string; // // -// } -// // Copy remaining characters from the right of last matched pattern -// strcpy(newstring+newstr_index, string+str_index); +// } +// // Copy remaining characters from the right of last matched pattern +// strcpy(newstring+newstr_index, string+str_index); // -// return newstring; -//} +// return newstring; +//} -// WANNE: Replaces german specific characters +// WANNE: Replaces german specific characters //STR8 ReplaceGermanSpecialCharacters(STR8 text) //{ -// // ä -// text = Replace(text, "ä", "ä"); -// // Ä -// text = Replace(text, "Ä", "Ä"); -// // ö -// text = Replace(text, "ö", "ö"); -// // Ö -// text = Replace(text, "Ö", "Ö"); -// // ü -// text = Replace(text, "ü", "ü"); -// // Ü -// text = Replace(text, "Ü", "Ü"); -// // ß -// text = Replace(text, "ß", "ß"); +// // ä +// text = Replace(text, "ä", "ä"); +// // Ä +// text = Replace(text, "Ä", "Ä"); +// // ö +// text = Replace(text, "ö", "ö"); +// // Ö +// text = Replace(text, "Ö", "Ö"); +// // ü +// text = Replace(text, "ü", "ü"); +// // Ü +// text = Replace(text, "Ü", "Ü"); +// // ß +// text = Replace(text, "ß", "ß"); // -// return text; +// return text; //} @@ -111,7 +111,7 @@ CHAR8 Drive[128], Dir[128], Name[128], Ext[128]; else { _splitpath(pFilename, Drive, Dir, Name, Ext); - + strcat(Name, "_8"); strcpy(pDestination, Drive); @@ -125,9 +125,9 @@ CHAR8 Drive[128], Dir[128], Name[128], Ext[128]; BOOLEAN CreateSGPPaletteFromCOLFile( SGPPaletteEntry *pPalette, SGPFILENAME ColFile ) { - HWFILE hFileHandle; - BYTE bColHeader[ 8 ]; - UINT32 cnt; + HWFILE hFileHandle; + BYTE bColHeader[ 8 ]; + UINT32 cnt; //See if files exists, if not, return error if ( !FileExists( ColFile ) ) @@ -138,7 +138,7 @@ BOOLEAN CreateSGPPaletteFromCOLFile( SGPPaletteEntry *pPalette, SGPFILENAME ColF } // Open and read in the file - if ( ( hFileHandle = FileOpen( ColFile, FILE_ACCESS_READ, FALSE)) == 0) + if ( ( hFileHandle = FileOpen( ColFile, FILE_ACCESS_READ, FALSE)) == 0) { // Return FALSE w/ debug DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Cannot open COL file"); @@ -146,14 +146,14 @@ BOOLEAN CreateSGPPaletteFromCOLFile( SGPPaletteEntry *pPalette, SGPFILENAME ColF } // Skip header - FileRead( hFileHandle, bColHeader, sizeof( bColHeader ) , NULL); + FileRead( hFileHandle, bColHeader, sizeof( bColHeader ) , NULL); // Read in a palette entry at a time for ( cnt = 0; cnt < 256; cnt++ ) { - FileRead( hFileHandle, &pPalette[ cnt ].peRed, sizeof( UINT8 ) , NULL); - FileRead( hFileHandle, &pPalette[ cnt ].peGreen, sizeof( UINT8 ) , NULL); - FileRead( hFileHandle, &pPalette[ cnt ].peBlue, sizeof( UINT8 ) , NULL); + FileRead( hFileHandle, &pPalette[ cnt ].peRed, sizeof( UINT8 ) , NULL); + FileRead( hFileHandle, &pPalette[ cnt ].peGreen, sizeof( UINT8 ) , NULL); + FileRead( hFileHandle, &pPalette[ cnt ].peBlue, sizeof( UINT8 ) , NULL); } // Close file @@ -167,7 +167,7 @@ BOOLEAN DisplayPaletteRep( PaletteRepID aPalRep, UINT8 ubXPos, UINT8 ubYPos, UIN UINT16 us16BPPColor; UINT32 cnt1; UINT8 ubSize, ubType; - INT16 sTLX, sTLY, sBRX, sBRY; + INT16 sTLX, sTLY, sBRX, sBRY; UINT8 ubPaletteRep; // Create 16BPP Palette @@ -197,7 +197,7 @@ BOOLEAN DisplayPaletteRep( PaletteRepID aPalRep, UINT8 ubXPos, UINT8 ubYPos, UIN } -BOOLEAN WrapString( STR16 pStr, STR16 pStr2, UINT16 usWidth, INT32 uiFont ) +BOOLEAN WrapString( STR16 pStr, STR16 pStr2, UINT16 usWidth, INT32 uiFont ) { UINT32 Cur, uiLet, uiNewLet, uiHyphenLet; STR16 curletter; @@ -205,7 +205,7 @@ BOOLEAN WrapString( STR16 pStr, STR16 pStr2, UINT16 usWidth, INT32 uiFont ) BOOLEAN fLineSplit = FALSE; HVOBJECT hFont; - // CHECK FOR WRAP + // CHECK FOR WRAP Cur=0; uiLet = 0; curletter = pStr; @@ -229,12 +229,12 @@ BOOLEAN WrapString( STR16 pStr, STR16 pStr2, UINT16 usWidth, INT32 uiFont ) { if ( (*curletter) == 32 ) { - // Split Line! - fLineSplit = TRUE; + // Split Line! + fLineSplit = TRUE; - pStr[ uiNewLet ] = (INT16)'\0'; + pStr[ uiNewLet ] = (INT16)'\0'; - wcscpy( pStr2, &(pStr[ uiNewLet + 1 ]) ); + wcscpy( pStr2, &(pStr[ uiNewLet + 1 ]) ); } if ( fLineSplit ) @@ -242,14 +242,14 @@ BOOLEAN WrapString( STR16 pStr, STR16 pStr2, UINT16 usWidth, INT32 uiFont ) uiNewLet--; curletter--; - + } if( !fLineSplit) { //We completed the check for a space, but failed, so use the hyphen method. swprintf( pStr2, L"-%s", &(pStr[uiHyphenLet]) ); pStr[uiHyphenLet] = (INT16)'/0'; - fLineSplit = TRUE; //hyphen method + fLineSplit = TRUE; //hyphen method break; } } @@ -298,7 +298,7 @@ BOOLEAN IfWin95(void) void HandleLimitedNumExecutions( ) { // Get system directory - HWFILE hFileHandle; + HWFILE hFileHandle; CHAR8 ubSysDir[ 512 ]; INT8 bNumRuns; @@ -328,7 +328,7 @@ void HandleLimitedNumExecutions( ) SET_ERROR( "Error 1054: Cannot execute - contact Sir-Tech Software." ); return; } - + } else { @@ -355,9 +355,9 @@ void HandleLimitedNumExecutions( ) SGPFILENAME gCheckFilenames[] = { - "DATA\\INTRO.SLF", - "DATA\\LOADSCREENS.SLF", - "DATA\\MAPS.SLF", + "DATA\\INTRO.SLF", + "DATA\\LOADSCREENS.SLF", + "DATA\\MAPS.SLF", "DATA\\NPC_SPEECH.SLF", "DATA\\SPEECH.SLF", }; @@ -365,14 +365,14 @@ SGPFILENAME gCheckFilenames[] = UINT32 gCheckFileMinSizes[] = { - 68000000, - 36000000, - 87000000, - 187000000, - 236000000 + 68000000, + 36000000, + 87000000, + 187000000, + 236000000 }; -#if defined( JA2TESTVERSION ) || defined( _DEBUG ) +#if defined( JA2TESTVERSION ) || defined( _DEBUG ) #define NOCDCHECK #endif @@ -400,46 +400,46 @@ BOOLEAN HandleJA2CDCheck( ) BOOLEAN fFailed = FALSE; CHAR8 zCdLocation[ SGPFILENAME_LEN ]; CHAR8 zCdFile[ SGPFILENAME_LEN ]; - INT32 cnt; + INT32 cnt; HWFILE hFile; // Check for a file on CD.... if( GetCDromDriveLetter( zCdLocation ) ) { - for ( cnt = 0; cnt < 5; cnt++ ) - { - // OK, build filename - sprintf( zCdFile, "%s%s", zCdLocation, gCheckFilenames[ cnt ] ); + for ( cnt = 0; cnt < 5; cnt++ ) + { + // OK, build filename + sprintf( zCdFile, "%s%s", zCdLocation, gCheckFilenames[ cnt ] ); hFile = FileOpen( zCdFile, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); - // Check if it exists... - if ( !hFile ) - { - fFailed = TRUE; + // Check if it exists... + if ( !hFile ) + { + fFailed = TRUE; FileClose( hFile ); - break; - } + break; + } - // Check min size + // Check min size //#ifndef GERMAN -// if ( FileGetSize( hFile ) < gCheckFileMinSizes[ cnt ] ) -// { -// fFailed = TRUE; +// if ( FileGetSize( hFile ) < gCheckFileMinSizes[ cnt ] ) +// { +// fFailed = TRUE; // FileClose( hFile ); -// break; -// } +// break; +// } //#endif FileClose( hFile ); - } } - else - { - fFailed = TRUE; - } - + } + else + { + fFailed = TRUE; + } + if ( fFailed ) { CHAR8 zErrorMessage[256]; @@ -452,8 +452,8 @@ BOOLEAN HandleJA2CDCheck( ) } } - return( TRUE ); - + return( TRUE ); + #endif } @@ -482,7 +482,7 @@ BOOLEAN HandleJA2CDCheckTwo( ) fFailed = FALSE; } } - + if ( fFailed ) { CHAR8 zErrorMessage[256]; @@ -519,7 +519,7 @@ BOOLEAN PerformTimeLimitedCheck() if( sSystemTime.wYear > 1999 || sSystemTime.wMonth > 7 ) { //spit out an error message - MessageBox( NULL, "This time limited version of Jagged Alliance 2 has expired.", "Ja2 Error!", MB_OK ); + MessageBox( NULL, "This time limited version of Jagged Alliance 2 has expired.", "Ja2 Error!", MB_OK ); return( FALSE ); } @@ -531,11 +531,11 @@ BOOLEAN DoJA2FilesExistsOnDrive( CHAR8 *zCdLocation ) { BOOLEAN fFailed = FALSE; CHAR8 zCdFile[ SGPFILENAME_LEN ]; - INT32 cnt; + INT32 cnt; HWFILE hFile; - for ( cnt = 0; cnt < 4; cnt++ ) - { + for ( cnt = 0; cnt < 4; cnt++ ) + { // OK, build filename sprintf( zCdFile, "%s%s", zCdLocation, gCheckFilenames[ cnt ] ); @@ -546,7 +546,7 @@ BOOLEAN DoJA2FilesExistsOnDrive( CHAR8 *zCdLocation ) { fFailed = TRUE; FileClose( hFile ); - break; + break; } FileClose( hFile ); } diff --git a/Utils/Utilities.h b/Utils/Utilities.h index 20a44838..3ffc30e0 100644 --- a/Utils/Utilities.h +++ b/Utils/Utilities.h @@ -8,14 +8,14 @@ #define GETPIXELDEPTH( ) ( gbPixelDepth ) // WANNE: Maximum number of characters in german description (German xml files) -#define MAXLINE 200 +#define MAXLINE 200 BOOLEAN CreateSGPPaletteFromCOLFile( SGPPaletteEntry *pPalette, SGPFILENAME ColFile ); BOOLEAN DisplayPaletteRep( PaletteRepID aPalRep, UINT8 ubXPos, UINT8 ubYPos, UINT32 uiDestSurface ); void FilenameForBPP(STR pFilename, STR pDestination); -BOOLEAN WrapString( STR16 pStr, STR16 pStr2, UINT16 usWidth, INT32 uiFont ); +BOOLEAN WrapString( STR16 pStr, STR16 pStr2, UINT16 usWidth, INT32 uiFont ); BOOLEAN IfWinNT(void); BOOLEAN IfWin95(void); @@ -38,7 +38,7 @@ template inline Integer idiv(Integer a, Integer b) { return a > 0 ? b > 0 ? (a + b/2) / b : (a - b/2) / b : - b > 0 ? (a - b/2) / b : (a + b/2) / b ; + b > 0 ? (a - b/2) / b : (a + b/2) / b ; } -#endif \ No newline at end of file +#endif diff --git a/Utils/Utils_2005Express.vcproj b/Utils/Utils_2005Express.vcproj index 19617e06..d0ec708a 100644 --- a/Utils/Utils_2005Express.vcproj +++ b/Utils/Utils_2005Express.vcproj @@ -1,7 +1,7 @@ - + + + + + + + + + + + + + + + + + + @@ -148,18 +210,38 @@ Filter="h;hpp;hxx;hm;inl;inc;xsd" UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" > + + + + + + + + + + @@ -302,18 +384,38 @@ RelativePath=".\_ItalianText.cpp" > + + + + + + + + + + diff --git a/Utils/WordWrap.cpp b/Utils/WordWrap.cpp index 8c1941e0..b71b6314 100644 --- a/Utils/WordWrap.cpp +++ b/Utils/WordWrap.cpp @@ -1,6 +1,6 @@ #ifdef PRECOMPILEDHEADERS #include "Utils All.h" - #include "winfont.h" + #include "winfont.h" #else #include "WordWrap.h" #include "sgp.h" @@ -28,19 +28,19 @@ WRAPPED_STRING *LineWrapForSingleCharWords(UINT32 ulFont, UINT16 usLineWidthPixe WRAPPED_STRING FirstWrappedString; WRAPPED_STRING *pWrappedString = NULL; CHAR16 TempString[1024]; -// CHAR16 pNullString[2]; +// CHAR16 pNullString[2]; INT16 usCurIndex, usEndIndex, usDestIndex; - CHAR16 DestString[1024]; + CHAR16 DestString[1024]; va_list argptr; BOOLEAN fDone = FALSE; UINT16 usCurrentWidthPixels=0; // UINT16 usCurrentLineWidthPixels=0; CHAR16 OneChar[2]; - BOOLEAN fNewLine=FALSE; + BOOLEAN fNewLine=FALSE; // BOOLEAN fTheStringIsToLong=FALSE; // INT32 iCounter=0; // INT32 iErrorCount = 0; -// pNullString[0]=L' '; +// pNullString[0]=L' '; // pNullString[1]=0; memset(&FirstWrappedString, 0, sizeof(WRAPPED_STRING) ); @@ -50,7 +50,7 @@ WRAPPED_STRING *LineWrapForSingleCharWords(UINT32 ulFont, UINT16 usLineWidthPixe if(pString == NULL) return(FALSE); - va_start(argptr, pString); // Set up variable argument pointer + va_start(argptr, pString); // Set up variable argument pointer vswprintf(TempString, pString, argptr); // process string (get output str) va_end(argptr); @@ -59,12 +59,12 @@ WRAPPED_STRING *LineWrapForSingleCharWords(UINT32 ulFont, UINT16 usLineWidthPixe while(!fDone) { - fNewLine=FALSE; + fNewLine=FALSE; DestString[ usDestIndex ] = TempString[ usCurIndex ]; //If the new char is a newline character - if( DestString[usDestIndex] == NEWLINE_CHAR ) + if( DestString[usDestIndex] == NEWLINE_CHAR ) { DestString[usDestIndex]=TempString[usCurIndex]=0; fNewLine=TRUE; @@ -72,11 +72,11 @@ WRAPPED_STRING *LineWrapForSingleCharWords(UINT32 ulFont, UINT16 usLineWidthPixe //Get the next char OneChar[0] = TempString[ usCurIndex ]; - - usCurrentWidthPixels = usCurrentWidthPixels + WFStringPixLength( OneChar, ulFont); + + usCurrentWidthPixels = usCurrentWidthPixels + WFStringPixLength( OneChar, ulFont); //If we are at the end of the string - if(TempString[ usCurIndex ] == 0) + if(TempString[ usCurIndex ] == 0) { //get to next WrappedString structure pWrappedString = &FirstWrappedString; @@ -145,20 +145,19 @@ WRAPPED_STRING *LineWrap(UINT32 ulFont, UINT16 usLineWidthPixels, UINT16 *pusLin WRAPPED_STRING FirstWrappedString; WRAPPED_STRING *pWrappedString = NULL; CHAR16 TempString[1024]; - CHAR16 pNullString[2]; + CHAR16 pNullString[2]; INT16 usCurIndex, usEndIndex, usDestIndex; STR16 pCurrentStringLoc; - CHAR16 DestString[1024]; + CHAR16 DestString[1024]; va_list argptr; BOOLEAN fDone = FALSE; UINT16 usCurrentWidthPixels=0; - //UINT16 usCurrentLineWidthPixels=0; CHAR16 OneChar[2]; - BOOLEAN fNewLine=FALSE; + BOOLEAN fNewLine=FALSE; BOOLEAN fTheStringIsToLong=FALSE; INT32 iCounter=0; INT32 iErrorCount = 0; - pNullString[0]=L' '; + pNullString[0]=L' '; pNullString[1]=0; DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LineWrap: %s", pString)); @@ -172,7 +171,7 @@ WRAPPED_STRING *LineWrap(UINT32 ulFont, UINT16 usLineWidthPixels, UINT16 *pusLin DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LineWrap: done")); return(FALSE); } - va_start(argptr, pString); // Set up variable argument pointer + va_start(argptr, pString); // Set up variable argument pointer vswprintf(TempString, pString, argptr); // process string (get output str) va_end(argptr); @@ -181,8 +180,8 @@ WRAPPED_STRING *LineWrap(UINT32 ulFont, UINT16 usLineWidthPixels, UINT16 *pusLin while(!fDone) { - //Kris: - //This is TEMPORARY!!! Dave, I've added this to get out of the infinite loop by slowing increasing the + //Kris: + //This is TEMPORARY!!! Dave, I've added this to get out of the infinite loop by slowing increasing the //line width! iErrorCount++; if( iErrorCount > 300 ) @@ -191,20 +190,20 @@ WRAPPED_STRING *LineWrap(UINT32 ulFont, UINT16 usLineWidthPixels, UINT16 *pusLin usLineWidthPixels++; } - fNewLine=FALSE; - + fNewLine=FALSE; + DestString[ usDestIndex ] = TempString[ usCurIndex ]; - if(DestString[usDestIndex]==NEWLINE_CHAR) + if(DestString[usDestIndex]==NEWLINE_CHAR) { DestString[usDestIndex]=TempString[usCurIndex]=0; fNewLine=TRUE; } OneChar[0] = TempString[ usCurIndex ]; - - usCurrentWidthPixels = usCurrentWidthPixels + WFStringPixLength( OneChar, ulFont); + + usCurrentWidthPixels = usCurrentWidthPixels + WFStringPixLength( OneChar, ulFont); //If we are at the end of the string - if(TempString[ usCurIndex ] == 0) + if(TempString[ usCurIndex ] == 0) { //get to next WrappedString structure pWrappedString = &FirstWrappedString; @@ -228,29 +227,29 @@ WRAPPED_STRING *LineWrap(UINT32 ulFont, UINT16 usLineWidthPixels, UINT16 *pusLin return(FirstWrappedString.pNextWrappedString); } - + if((usCurrentWidthPixels > usLineWidthPixels))//||(DestString[ usDestIndex ]==NEWLINE_CHAR )||(fNewLine)) { - + //if an error has occured, and the string is too long if( fTheStringIsToLong ) DestString[ usDestIndex ] = L' '; - //Go back to begining of word - while( (DestString[ usDestIndex ] != L' ') && (usCurIndex > 0) ) - { - OneChar[0] = DestString[ usDestIndex ]; + //Go back to begining of word + while( (DestString[ usDestIndex ] != L' ') && (usCurIndex > 0) ) + { + OneChar[0] = DestString[ usDestIndex ]; - usCurrentWidthPixels = usCurrentWidthPixels - WFStringPixLength( OneChar, ulFont); + usCurrentWidthPixels = usCurrentWidthPixels - WFStringPixLength( OneChar, ulFont); usCurIndex--; usDestIndex--; - } - usEndIndex = usDestIndex; + } + usEndIndex = usDestIndex; - if( usEndIndex < 0 ) - usEndIndex = 0; + if( usEndIndex < 0 ) + usEndIndex = 0; // put next line into temp buffer DestString[usEndIndex] = 0; @@ -282,8 +281,8 @@ WRAPPED_STRING *LineWrap(UINT32 ulFont, UINT16 usLineWidthPixels, UINT16 *pusLin pCurrentStringLoc = &TempString[ usEndIndex ]; //if last line, put line into string structure - if ( WFStringPixLength( pCurrentStringLoc, ulFont) < usLineWidthPixels ) - { + if ( WFStringPixLength( pCurrentStringLoc, ulFont) < usLineWidthPixels ) + { // run until end of DestString wcscpy(DestString, pCurrentStringLoc); iCounter=0; @@ -297,7 +296,7 @@ WRAPPED_STRING *LineWrap(UINT32 ulFont, UINT16 usLineWidthPixels, UINT16 *pusLin } iCounter++; } - + //get to next WrappedString structure pWrappedString = &FirstWrappedString; while(pWrappedString->pNextWrappedString != NULL) @@ -313,17 +312,17 @@ WRAPPED_STRING *LineWrap(UINT32 ulFont, UINT16 usLineWidthPixels, UINT16 *pusLin pWrappedString->pNextWrappedString->pNextWrappedString = NULL; if(fNewLine) { - pWrappedString = &FirstWrappedString; - while(pWrappedString->pNextWrappedString != NULL) - pWrappedString = pWrappedString->pNextWrappedString; + pWrappedString = &FirstWrappedString; + while(pWrappedString->pNextWrappedString != NULL) + pWrappedString = pWrappedString->pNextWrappedString; - //allocate memory for the string - pWrappedString->pNextWrappedString = (WRAPPED_STRING *) MemAlloc(sizeof(WRAPPED_STRING)); - pWrappedString->pNextWrappedString->sString = (STR16) MemAlloc((wcslen(pNullString) +2 )* sizeof(CHAR16) ); - wcscpy(pWrappedString->pNextWrappedString->sString, pNullString); - pWrappedString->pNextWrappedString->pNextWrappedString = NULL; + //allocate memory for the string + pWrappedString->pNextWrappedString = (WRAPPED_STRING *) MemAlloc(sizeof(WRAPPED_STRING)); + pWrappedString->pNextWrappedString->sString = (STR16) MemAlloc((wcslen(pNullString) +2 )* sizeof(CHAR16) ); + wcscpy(pWrappedString->pNextWrappedString->sString, pNullString); + pWrappedString->pNextWrappedString->pNextWrappedString = NULL; } - + fDone = TRUE; } usCurIndex--; @@ -333,7 +332,7 @@ WRAPPED_STRING *LineWrap(UINT32 ulFont, UINT16 usLineWidthPixels, UINT16 *pusLin { CHAR zText[1024]; - sprintf( zText, "LineWrap() Error! The string ( %S ) has a word ( %S ) that is too long to fit into the required width of %d! Please fix!!", pString, &TempString[usCurIndex], usLineWidthPixels ); + sprintf( zText, "LineWrap() Error! The string ( %S ) has a word ( %S ) that is too long to fit into the required width of %d! Please fix!!", pString, &TempString[usCurIndex], usLineWidthPixels ); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, zText ); @@ -375,18 +374,18 @@ UINT16 DisplayWrappedString(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT8 WRAPPED_STRING *pFirstWrappedString, *pTempWrappedString; UINT16 uiCounter=0; UINT16 usLineWidthIfWordIsWiderThenWidth=0; - UINT16 usHeight; + UINT16 usHeight; - usHeight = WFGetFontHeight(uiFont); + usHeight = WFGetFontHeight(uiFont); //If we are to a Single char for a word ( like in Taiwan ) if( gfUseSingleCharWordsForWordWrap ) { - pFirstWrappedString = LineWrapForSingleCharWords(uiFont, usWidth, &usLineWidthIfWordIsWiderThenWidth, pString); + pFirstWrappedString = LineWrapForSingleCharWords(uiFont, usWidth, &usLineWidthIfWordIsWiderThenWidth, pString); } else { - pFirstWrappedString = LineWrap(uiFont, usWidth, &usLineWidthIfWordIsWiderThenWidth, pString); + pFirstWrappedString = LineWrap(uiFont, usWidth, &usLineWidthIfWordIsWiderThenWidth, pString); } //if an error occured and a word was bigger then the width passed in, reset the width @@ -394,9 +393,9 @@ UINT16 DisplayWrappedString(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT8 usWidth = usLineWidthIfWordIsWiderThenWidth; while(pFirstWrappedString != NULL) - { - DrawTextToScreen(pFirstWrappedString->sString, usPosX, usPosY, usWidth, uiFont, ubColor, ubBackGroundColor, fDirty, uiFlags ); - + { + DrawTextToScreen(pFirstWrappedString->sString, usPosX, usPosY, usWidth, uiFont, ubColor, ubBackGroundColor, fDirty, uiFlags ); + pTempWrappedString = pFirstWrappedString; pFirstWrappedString = pTempWrappedString->pNextWrappedString; MemFree( pTempWrappedString->sString ); @@ -419,7 +418,7 @@ UINT16 DeleteWrappedString(WRAPPED_STRING *pWrappedString) UINT16 uiCounter=0; while(pWrappedString != NULL) - { + { pTempWrappedString = pWrappedString; pWrappedString = pTempWrappedString->pNextWrappedString; MemFree( pTempWrappedString->sString ); @@ -437,11 +436,11 @@ UINT16 DeleteWrappedString(WRAPPED_STRING *pWrappedString) // The string, // X position // Y position -// The width of the area you are drawing in. It can be 0 for left justified +// The width of the area you are drawing in. It can be 0 for left justified // The font // the color you want the font // the color of the background -// do you want to display it using dirty rects, TRUE or FALSE +// do you want to display it using dirty rects, TRUE or FALSE // flags for either LEFT_JUSTIFIED, CENTER_JUSTIFIED, RIGHT_JUSTIFIED BOOLEAN DrawTextToScreen(STR16 pStr, UINT16 usLocX, UINT16 usLocY, UINT16 usWidth, UINT32 ulFont, UINT8 ubColor, UINT8 ubBackGroundColor, BOOLEAN fDirty, UINT32 ulFlags) @@ -455,7 +454,7 @@ BOOLEAN DrawTextToScreen(STR16 pStr, UINT16 usLocX, UINT16 usLocY, UINT16 usWidt if( ulFlags == 0 ) ulFlags = LEFT_JUSTIFIED; - + // FONT_MCOLOR_BLACK, FALSE if( ulFlags & LEFT_JUSTIFIED ) { @@ -468,62 +467,62 @@ BOOLEAN DrawTextToScreen(STR16 pStr, UINT16 usLocX, UINT16 usLocY, UINT16 usWidt } else if( ulFlags & RIGHT_JUSTIFIED ) { - VarFindFontRightCoordinates( usLocX, usLocY, usWidth, WFGetFontHeight(ulFont), ulFont, (INT16 *)&usPosX, (INT16 *)&usPosY, pStr ); + VarFindFontRightCoordinates( usLocX, usLocY, usWidth, WFGetFontHeight(ulFont), ulFont, (INT16 *)&usPosX, (INT16 *)&usPosY, pStr ); } SetFont(ulFont); - - if ( USE_WINFONTS( ) ) - { - COLORVAL Color = FROMRGB( 255, 255, 255 ); - SetWinFontForeColor( GET_WINFONT( ), &Color ); - } - else - { - SetFontForeground(ubColor); - SetFontBackground( ubBackGroundColor ); - } - + + if ( USE_WINFONTS( ) ) + { + COLORVAL Color = FROMRGB( 255, 255, 255 ); + SetWinFontForeColor( GET_WINFONT( ), &Color ); + } + else + { + SetFontForeground(ubColor); + SetFontBackground( ubBackGroundColor ); + } + if( ulFlags & TEXT_SHADOWED ) ShadowText( FRAME_BUFFER, pStr, ulFont, (UINT16)(usPosX-1), (UINT16)(usPosY-1 ) ); - if ( USE_WINFONTS( ) ) - { - if( fDirty ) - { - gprintfdirty( usPosX, usPosY, pStr); - WinFont_mprintf( GET_WINFONT( ), usPosX,usPosY,pStr); - } - else - { - WinFont_mprintf( GET_WINFONT( ), usPosX,usPosY,pStr); - } - } - else - { - if( fDirty ) - { - gprintfdirty( usPosX, usPosY, pStr); - mprintf(usPosX,usPosY,pStr); - } - else - { - mprintf(usPosX,usPosY,pStr); - } - } + if ( USE_WINFONTS( ) ) + { + if( fDirty ) + { + gprintfdirty( usPosX, usPosY, pStr); + WinFont_mprintf( GET_WINFONT( ), usPosX,usPosY,pStr); + } + else + { + WinFont_mprintf( GET_WINFONT( ), usPosX,usPosY,pStr); + } + } + else + { + if( fDirty ) + { + gprintfdirty( usPosX, usPosY, pStr); + mprintf(usPosX,usPosY,pStr); + } + else + { + mprintf(usPosX,usPosY,pStr); + } + } if( IAN_WRAP_NO_SHADOW & ulFlags ) { // reset shadow - SetFontShadow( DEFAULT_SHADOW ); + SetFontShadow( DEFAULT_SHADOW ); } if( ulFlags & INVALIDATE_TEXT ) { - usFontHeight= WFGetFontHeight( ulFont ); - usStringWidth = WFStringPixLength( pStr, ulFont ); + usFontHeight= WFGetFontHeight( ulFont ); + usStringWidth = WFStringPixLength( pStr, ulFont ); - InvalidateRegion( usPosX, usPosY, usPosX+usStringWidth, usPosY+usFontHeight ); + InvalidateRegion( usPosX, usPosY, usPosX+usStringWidth, usPosY+usFontHeight ); } return(TRUE); @@ -536,9 +535,9 @@ BOOLEAN DrawTextToScreen(STR16 pStr, UINT16 usLocX, UINT16 usLocY, UINT16 usWidt // the gap in between the lines // -UINT16 IanDisplayWrappedString(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT8 ubGap, - UINT32 uiFont, UINT8 ubColor, STR16 pString, - UINT8 ubBackGroundColor, BOOLEAN fDirty, UINT32 uiFlags) +UINT16 IanDisplayWrappedString(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT8 ubGap, + UINT32 uiFont, UINT8 ubColor, STR16 pString, + UINT8 ubBackGroundColor, BOOLEAN fDirty, UINT32 uiFlags) { UINT16 usHeight; @@ -550,17 +549,17 @@ UINT16 IanDisplayWrappedString(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UIN BOOLEAN fBoldOn=FALSE; CHAR16 zLineString[128] = L"",zWordString[64]= L""; - - usHeight = WFGetFontHeight( uiFont ); - - do + + usHeight = WFGetFontHeight( uiFont ); + + do { // each character goes towards building a new word if (pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0) { zWordString[usDestCounter++] = pString[usSourceCounter]; } - else + else { // we hit a space (or end of record), so this is the END of a word! @@ -570,7 +569,7 @@ UINT16 IanDisplayWrappedString(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UIN switch(zWordString[0]) { case TEXT_CODE_CENTER: - + if (usJustification != CENTER_JUSTIFIED) { usJustification = CENTER_JUSTIFIED; @@ -589,27 +588,27 @@ UINT16 IanDisplayWrappedString(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UIN } else // turn OFF centering... { - + // shadow control if( IAN_WRAP_NO_SHADOW & uiFlags ) { - // turn off shadow - SetFontShadow( NO_SHADOW ); + // turn off shadow + SetFontShadow( NO_SHADOW ); } - - + + // time to draw this line of text (centered)! - DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification); - - // shadow control + DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification); + + // shadow control if( IAN_WRAP_NO_SHADOW & uiFlags ) { - // turn on shadow - SetFontShadow( DEFAULT_SHADOW ); + // turn on shadow + SetFontShadow( DEFAULT_SHADOW ); } // increment Y position for next time - usPosY += (WFGetFontHeight(uiLocalFont)) + ubGap; //; // +ubGap + usPosY += (WFGetFontHeight(uiLocalFont)) + ubGap; //; // +ubGap // we just used a line, so note that usLinesUsed++; @@ -627,40 +626,40 @@ UINT16 IanDisplayWrappedString(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UIN usLineLengthPixels = 0; // reset dest char counter - usDestCounter = 0; + usDestCounter = 0; // turn off centering... usJustification = LEFT_JUSTIFIED; } - + break; case TEXT_CODE_NEWLINE: - + // NEWLINE character! // shadow control if( IAN_WRAP_NO_SHADOW & uiFlags ) { - // turn off shadow - SetFontShadow( NO_SHADOW ); + // turn off shadow + SetFontShadow( NO_SHADOW ); } - - // Display what we have up to now - DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification ); - // shadow control + // Display what we have up to now + DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification ); + + // shadow control if( IAN_WRAP_NO_SHADOW & uiFlags ) { - // turn on shadow - SetFontShadow( DEFAULT_SHADOW ); + // turn on shadow + SetFontShadow( DEFAULT_SHADOW ); } // increment Y position for next time - usPosY += (WFGetFontHeight(uiLocalFont))+ubGap; //; // +ubGap + usPosY += (WFGetFontHeight(uiLocalFont))+ubGap; //; // +ubGap // we just used a line, so note that usLinesUsed++; @@ -677,35 +676,35 @@ UINT16 IanDisplayWrappedString(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UIN // reset the line length usLineLengthPixels = 0; - // reset width + // reset width usLocalWidth = usWidth; // reset dest char counter - usDestCounter = 0; - + usDestCounter = 0; + break; case TEXT_CODE_BOLD: - + if (!fBoldOn) { // shadow control - if( IAN_WRAP_NO_SHADOW & uiFlags ) + if( IAN_WRAP_NO_SHADOW & uiFlags ) { - // turn off shadow - SetFontShadow( NO_SHADOW ); + // turn off shadow + SetFontShadow( NO_SHADOW ); } // turn bold ON.... but first, write whatever we have in normal now... - DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubColor, ubBackGroundColor, fDirty, usJustification ); + DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubColor, ubBackGroundColor, fDirty, usJustification ); // shadow control - if( IAN_WRAP_NO_SHADOW & uiFlags ) + if( IAN_WRAP_NO_SHADOW & uiFlags ) { - // turn on shadow - SetFontShadow( DEFAULT_SHADOW ); + // turn on shadow + SetFontShadow( DEFAULT_SHADOW ); } // calc length of what we just wrote @@ -726,7 +725,7 @@ UINT16 IanDisplayWrappedString(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UIN // turn bold ON uiLocalFont = FONT10ARIALBOLD; SetFontShadow(NO_SHADOW); - fBoldOn = TRUE; + fBoldOn = TRUE; // reset dest char counter usDestCounter = 0; @@ -736,23 +735,23 @@ UINT16 IanDisplayWrappedString(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UIN // shadow control - if( IAN_WRAP_NO_SHADOW & uiFlags ) + if( IAN_WRAP_NO_SHADOW & uiFlags ) { - // turn off shadow - SetFontShadow( NO_SHADOW ); + // turn off shadow + SetFontShadow( NO_SHADOW ); } // turn bold OFF - write whatever we have in bold now... - DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubColor, ubBackGroundColor, fDirty, usJustification ); + DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubColor, ubBackGroundColor, fDirty, usJustification ); // shadow control - if( IAN_WRAP_NO_SHADOW & uiFlags ) + if( IAN_WRAP_NO_SHADOW & uiFlags ) { - // turn on shadow - SetFontShadow( DEFAULT_SHADOW ); + // turn on shadow + SetFontShadow( DEFAULT_SHADOW ); } - // calc length of what we just wrote + // calc length of what we just wrote usPhraseLengthPixels = WFStringPixLength(zLineString,uiLocalFont); // calculate new x position for next time @@ -767,7 +766,7 @@ UINT16 IanDisplayWrappedString(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UIN // new by Ian Nov 30th, 1998 /* -DEF: commented out for Beta. Nov 30 +DEF: commented out for Beta. Nov 30 // measure length of WordString and if length > 1, then we have a word to deal with if (wcslen(zWordString) > 1) @@ -775,19 +774,19 @@ DEF: commented out for Beta. Nov 30 // need to reduce the usSourceCounter by the true word length (not counting the code char) usSourceCounter -= (wcslen(zWordString) - 1); } - -*/ + +*/ // erase word string memset(zWordString,0,sizeof(zWordString)); // turn bold OFF uiLocalFont = uiFont; - fBoldOn = FALSE; + fBoldOn = FALSE; // reset dest char counter usDestCounter = 0; } - + break; @@ -795,22 +794,22 @@ DEF: commented out for Beta. Nov 30 case TEXT_CODE_NEWCOLOR: - - // shadow control + + // shadow control if( IAN_WRAP_NO_SHADOW & uiFlags ) { - // turn off shadow - SetFontShadow( NO_SHADOW ); + // turn off shadow + SetFontShadow( NO_SHADOW ); } // change to new color.... but first, write whatever we have in normal now... - DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification ); + DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification ); - // shadow control + // shadow control if( IAN_WRAP_NO_SHADOW & uiFlags ) { - // turn on shadow - SetFontShadow( DEFAULT_SHADOW ); + // turn on shadow + SetFontShadow( DEFAULT_SHADOW ); } @@ -842,26 +841,26 @@ DEF: commented out for Beta. Nov 30 - case TEXT_CODE_DEFCOLOR: - + case TEXT_CODE_DEFCOLOR: + // shadow control if( IAN_WRAP_NO_SHADOW & uiFlags ) { - // turn off shadow - SetFontShadow( NO_SHADOW ); + // turn off shadow + SetFontShadow( NO_SHADOW ); } // turn color back to default - write whatever we have in bold now... - DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification ); + DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification ); - // shadow control + // shadow control if( IAN_WRAP_NO_SHADOW & uiFlags ) { - // turn on shadow - SetFontShadow( DEFAULT_SHADOW ); + // turn on shadow + SetFontShadow( DEFAULT_SHADOW ); } - // calc length of what we just wrote + // calc length of what we just wrote usPhraseLengthPixels = WFStringPixLength(zLineString,uiLocalFont); // calculate new x position for next time @@ -882,15 +881,15 @@ DEF: commented out for Beta. Nov 30 // reset dest char counter usDestCounter = 0; break; - + } // end of switch of CODES - + } else // not a special character { // terminate the string TEMPORARILY - zWordString[usDestCounter] = 0; + zWordString[usDestCounter] = 0; // get the length (in pixels) of this word usWordLengthPixels = WFStringPixLength(zWordString,uiLocalFont); @@ -899,15 +898,15 @@ DEF: commented out for Beta. Nov 30 zWordString[usDestCounter++] = 32; // RE-terminate the string - zWordString[usDestCounter] = 0; + zWordString[usDestCounter] = 0; // can we fit it onto the length of our "line" ? if ((usLineLengthPixels + usWordLengthPixels) < usWidth) { // yes we can fit this word. - + // get the length AGAIN (in pixels with the SPACE) for this word - usWordLengthPixels = WFStringPixLength(zWordString,uiLocalFont); + usWordLengthPixels = WFStringPixLength(zWordString,uiLocalFont); // calc new pixel length for the line usLineLengthPixels = usLineLengthPixels + usWordLengthPixels; @@ -921,23 +920,23 @@ DEF: commented out for Beta. Nov 30 else { // can't fit this word! - + // shadow control if( IAN_WRAP_NO_SHADOW & uiFlags ) { - // turn off shadow - SetFontShadow( NO_SHADOW ); + // turn off shadow + SetFontShadow( NO_SHADOW ); } // Display what we have up to now - DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification ); + DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification ); - // shadow control + // shadow control if( IAN_WRAP_NO_SHADOW & uiFlags ) { - // turn off shadow - SetFontShadow( DEFAULT_SHADOW ); + // turn off shadow + SetFontShadow( DEFAULT_SHADOW ); } @@ -953,43 +952,43 @@ DEF: commented out for Beta. Nov 30 // start off next line string with the word we couldn't fit wcscpy(zLineString,zWordString); - // remeasure the line length + // remeasure the line length usLineLengthPixels = WFStringPixLength(zLineString,uiLocalFont); // reset dest char counter usDestCounter = 0; - // reset width + // reset width usLocalWidth = usWidth; } } // end of this word was NOT a special code } - - + + } while (pString[usSourceCounter++] != 0); - - + + // terminate the entire paragraph with a null string (null character guaranteed) wcscat(zLineString, L""); - // shadow control - if( IAN_WRAP_NO_SHADOW & uiFlags ) - { - // turn off shadow - SetFontShadow( NO_SHADOW ); - } - - // draw the paragraph - DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification ); - - // shadow control if( IAN_WRAP_NO_SHADOW & uiFlags ) { - // turn on shadow - SetFontShadow( DEFAULT_SHADOW ); + // turn off shadow + SetFontShadow( NO_SHADOW ); + } + + // draw the paragraph + DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification ); + + + // shadow control + if( IAN_WRAP_NO_SHADOW & uiFlags ) + { + // turn on shadow + SetFontShadow( DEFAULT_SHADOW ); } // return how many Y pixels we used @@ -1007,11 +1006,11 @@ void CleanOutControlCodesFromString(STR16 pSourceString, STR16 pDestString) BOOLEAN fRemoveCurrentCharAndNextChar; // this procedure will run through a STR16 and strip out all control characters. This is a nessacary as wcscmp and the like tend not to like control chars in thier strings - + fRemoveCurrentChar = FALSE; fRemoveCurrentCharAndNextChar = FALSE; - // while not end of source string, + // while not end of source string, while( pSourceString[ iSourceCounter ] != 0 ) { if( pSourceString[ iSourceCounter + 1 ] == 0 ) @@ -1021,7 +1020,7 @@ void CleanOutControlCodesFromString(STR16 pSourceString, STR16 pDestString) } else { - switch ( pSourceString[iSourceCounter] ) + switch ( pSourceString[iSourceCounter] ) { case TEXT_CODE_CENTER: case TEXT_CODE_NEWCOLOR: @@ -1088,9 +1087,9 @@ void CleanOutControlCodesFromString(STR16 pSourceString, STR16 pDestString) // the gap in between the lines, the height of buffer and which page you want the text displayed for, and the total height to date // -INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT16 usPageHeight, UINT16 usTotalHeight, UINT16 usPageNumber,UINT8 ubGap, - UINT32 uiFont, UINT8 ubColor, STR16 pString, - UINT8 ubBackGroundColor, BOOLEAN fDirty, UINT32 uiFlags, BOOLEAN *fOnLastPageFlag) +INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT16 usPageHeight, UINT16 usTotalHeight, UINT16 usPageNumber,UINT8 ubGap, + UINT32 uiFont, UINT8 ubColor, STR16 pString, + UINT8 ubBackGroundColor, BOOLEAN fDirty, UINT32 uiFlags, BOOLEAN *fOnLastPageFlag) { UINT16 usHeight; UINT16 usSourceCounter=0,usDestCounter=0,usWordLengthPixels,usLineLengthPixels=0,usPhraseLengthPixels=0; @@ -1099,26 +1098,25 @@ INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidt UINT16 usJustification = LEFT_JUSTIFIED,usLocalPosX=usPosX; UINT8 ubLocalColor = ubColor; BOOLEAN fBoldOn=FALSE; - //UINT32 iTotalHeight =0; CHAR16 zLineString[640] = L"",zWordString[640]= L""; - - usHeight = WFGetFontHeight(uiFont); + + usHeight = WFGetFontHeight(uiFont); // identical to ianwordwrap, but this one lets the user to specify the page they want to display, if the text takes more than one page // multiple calls to this function will allow one to work out how many pages there are - - do + + do { - // last page is not true, YET! - *fOnLastPageFlag = FALSE; - // each character goes towards building a new word - if (pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0) - { - zWordString[usDestCounter++] = pString[usSourceCounter]; - } - else - { + // last page is not true, YET! + *fOnLastPageFlag = FALSE; + // each character goes towards building a new word + if (pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0) + { + zWordString[usDestCounter++] = pString[usSourceCounter]; + } + else + { // we hit a space (or end of record), so this is the END of a word! // is this a special CODE? @@ -1127,7 +1125,7 @@ INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidt switch(zWordString[0]) { case TEXT_CODE_CENTER: - + if (usJustification != CENTER_JUSTIFIED) { usJustification = CENTER_JUSTIFIED; @@ -1146,10 +1144,10 @@ INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidt } else // turn OFF centering... { - + // time to draw this line of text (centered)! - DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification); - + DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification); + // increment Y position for next time usPosY += (WFGetFontHeight(uiLocalFont)) +ubGap; @@ -1169,26 +1167,26 @@ INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidt usLineLengthPixels = 0; // reset dest char counter - usDestCounter = 0; + usDestCounter = 0; // turn off centering... usJustification = LEFT_JUSTIFIED; } - + break; case TEXT_CODE_NEWLINE: - + // NEWLINE character! - + // Display what we have up to now - DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification ); - - + DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification ); + + // increment Y position for next time - usPosY += (WFGetFontHeight(uiLocalFont)) +ubGap; + usPosY += (WFGetFontHeight(uiLocalFont)) +ubGap; // we just used a line, so note that usLinesUsed++; @@ -1205,24 +1203,24 @@ INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidt // reset the line length usLineLengthPixels = 0; - // reset width + // reset width usLocalWidth = usWidth; // reset dest char counter - usDestCounter = 0; - + usDestCounter = 0; + break; case TEXT_CODE_BOLD: - + if (!fBoldOn) { - - + + // turn bold ON.... but first, write whatever we have in normal now... - DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubColor, ubBackGroundColor, fDirty, usJustification ); - + DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubColor, ubBackGroundColor, fDirty, usJustification ); + // calc length of what we just wrote usPhraseLengthPixels = WFStringPixLength(zLineString,uiLocalFont); @@ -1241,20 +1239,20 @@ INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidt // turn bold ON uiLocalFont = FONT10ARIALBOLD; SetFontShadow(NO_SHADOW); - fBoldOn = TRUE; + fBoldOn = TRUE; // reset dest char counter usDestCounter = 0; } else { - - + + // turn bold OFF - write whatever we have in bold now... - DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubColor, ubBackGroundColor, fDirty, usJustification ); - - // calc length of what we just wrote - usPhraseLengthPixels = WFStringPixLength(zLineString,uiLocalFont); + DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubColor, ubBackGroundColor, fDirty, usJustification ); + + // calc length of what we just wrote + usPhraseLengthPixels = WFStringPixLength(zLineString,uiLocalFont); // calculate new x position for next time usLocalPosX = usLocalPosX + usPhraseLengthPixels; @@ -1270,12 +1268,12 @@ INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidt // turn bold OFF uiLocalFont = uiFont; - fBoldOn = FALSE; + fBoldOn = FALSE; // reset dest char counter usDestCounter = 0; } - + break; @@ -1283,11 +1281,11 @@ INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidt case TEXT_CODE_NEWCOLOR: - - + + // change to new color.... but first, write whatever we have in normal now... - DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification ); - + DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification ); + // the new color value is the next character in the word if (zWordString[1] != TEXT_SPACE && zWordString[1] < 256) ubLocalColor = (UINT8) zWordString[1]; @@ -1296,7 +1294,7 @@ INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidt ubLocalColor = 184;; // calc length of what we just wrote - usPhraseLengthPixels = WFStringPixLength(zLineString,uiLocalFont); + usPhraseLengthPixels = WFStringPixLength(zLineString,uiLocalFont); // calculate new x position for next time usLocalPosX = usLocalPosX + usPhraseLengthPixels; @@ -1316,13 +1314,13 @@ INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidt - case TEXT_CODE_DEFCOLOR: - - + case TEXT_CODE_DEFCOLOR: + + // turn color back to default - write whatever we have in bold now... - DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification ); - - // calc length of what we just wrote + DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification ); + + // calc length of what we just wrote usPhraseLengthPixels = WFStringPixLength(zLineString,uiLocalFont); // calculate new x position for next time @@ -1343,32 +1341,32 @@ INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidt // reset dest char counter usDestCounter = 0; break; - + } // end of switch of CODES - + } else // not a special character { // terminate the string TEMPORARILY - zWordString[usDestCounter] = 0; + zWordString[usDestCounter] = 0; // get the length (in pixels) of this word - usWordLengthPixels = WFStringPixLength(zWordString,uiLocalFont); + usWordLengthPixels = WFStringPixLength(zWordString,uiLocalFont); // add a space (in case we add another word to it) zWordString[usDestCounter++] = 32; // RE-terminate the string - zWordString[usDestCounter] = 0; + zWordString[usDestCounter] = 0; // can we fit it onto the length of our "line" ? if ((usLineLengthPixels + usWordLengthPixels) < usWidth) { // yes we can fit this word. - + // get the length AGAIN (in pixels with the SPACE) for this word - usWordLengthPixels = WFStringPixLength(zWordString,uiLocalFont); + usWordLengthPixels = WFStringPixLength(zWordString,uiLocalFont); // calc new pixel length for the line usLineLengthPixels = usLineLengthPixels + usWordLengthPixels; @@ -1381,17 +1379,17 @@ INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidt } else { - + // Display what we have up to now - DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification ); - - + DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification ); + + // reset x position usLocalPosX = usPosX; // increment Y position for next time - usPosY += (WFGetFontHeight(uiLocalFont)) +ubGap; - + usPosY += (WFGetFontHeight(uiLocalFont)) +ubGap; + // we just used a line, so note that usLinesUsed++; @@ -1399,37 +1397,37 @@ INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidt wcscpy(zLineString,zWordString); // remeasure the line length - usLineLengthPixels = WFStringPixLength(zLineString,uiLocalFont); + usLineLengthPixels = WFStringPixLength(zLineString,uiLocalFont); // reset dest char counter usDestCounter = 0; - // reset width + // reset width usLocalWidth = usWidth; } } // end of this word was NOT a special code - } - + } + } while (pString[usSourceCounter++] != 0); - - + + // terminate the entire paragraph with a null string (null character guaranteed) wcscat(zLineString, L""); - - + + // draw the paragraph - DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification ); - + DrawTextToScreen(zLineString, usLocalPosX, usPosY, usLocalWidth, uiLocalFont, ubLocalColor, ubBackGroundColor, fDirty, usJustification ); + // return how many Y pixels we used - return(usLinesUsed * ( WFGetFontHeight(uiFont) + ( UINT16 )ubGap ) ); // +ubGap + return(usLinesUsed * ( WFGetFontHeight(uiFont) + ( UINT16 )ubGap ) ); // +ubGap } // now variant for grabbing height -UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT8 ubGap, - UINT32 uiFont, UINT8 ubColor, STR16 pString, - UINT8 ubBackGroundColor, BOOLEAN fDirty, UINT32 uiFlags) +UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT8 ubGap, + UINT32 uiFont, UINT8 ubColor, STR16 pString, + UINT8 ubBackGroundColor, BOOLEAN fDirty, UINT32 uiFlags) { UINT16 usHeight; UINT16 usSourceCounter=0,usDestCounter=0,usWordLengthPixels,usLineLengthPixels=0,usPhraseLengthPixels=0; @@ -1438,22 +1436,21 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT UINT16 usJustification = LEFT_JUSTIFIED,usLocalPosX=usPosX; UINT8 ubLocalColor = ubColor; BOOLEAN fBoldOn=FALSE; - //UINT32 iTotalHeight =0; CHAR16 zLineString[640] = L"",zWordString[640]= L""; - + usHeight = WFGetFontHeight(uiFont); // simply a cut and paste operation on Ian Display Wrapped, but will not write string to screen // since this all we want to do, everything IanWrapped will do but without displaying string - do + do { // each character goes towards building a new word if (pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0) { zWordString[usDestCounter++] = pString[usSourceCounter]; } - else + else { // we hit a space (or end of record), so this is the END of a word! @@ -1463,7 +1460,7 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT switch(zWordString[0]) { case TEXT_CODE_CENTER: - + if (usJustification != CENTER_JUSTIFIED) { usJustification = CENTER_JUSTIFIED; @@ -1482,9 +1479,9 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT } else // turn OFF centering... { - + // increment Y position for next time - usPosY += (WFGetFontHeight(uiLocalFont)) + ubGap; + usPosY += (WFGetFontHeight(uiLocalFont)) + ubGap; // we just used a line, so note that usLinesUsed++; @@ -1502,23 +1499,23 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT usLineLengthPixels = 0; // reset dest char counter - usDestCounter = 0; + usDestCounter = 0; // turn off centering... usJustification = LEFT_JUSTIFIED; } - + break; case TEXT_CODE_NEWLINE: - + // NEWLINE character! - + // increment Y position for next time - usPosY += (WFGetFontHeight(uiLocalFont)) +ubGap; + usPosY += (WFGetFontHeight(uiLocalFont)) +ubGap; // we just used a line, so note that usLinesUsed++; @@ -1535,22 +1532,22 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT // reset the line length usLineLengthPixels = 0; - // reset width + // reset width usLocalWidth = usWidth; // reset dest char counter - usDestCounter = 0; - + usDestCounter = 0; + break; case TEXT_CODE_BOLD: - + if (!fBoldOn) { - + // calc length of what we just wrote - usPhraseLengthPixels = WFStringPixLength(zLineString,uiLocalFont); + usPhraseLengthPixels = WFStringPixLength(zLineString,uiLocalFont); // calculate new x position for next time usLocalPosX = usLocalPosX + usPhraseLengthPixels; @@ -1566,15 +1563,15 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT // turn bold ON uiLocalFont = FONT10ARIALBOLD; SetFontShadow(NO_SHADOW); - fBoldOn = TRUE; + fBoldOn = TRUE; // reset dest char counter usDestCounter = 0; } else { - - // calc length of what we just wrote + + // calc length of what we just wrote usPhraseLengthPixels = WFStringPixLength(zLineString,uiLocalFont); // calculate new x position for next time @@ -1591,12 +1588,12 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT // turn bold OFF uiLocalFont = uiFont; - fBoldOn = FALSE; + fBoldOn = FALSE; // reset dest char counter usDestCounter = 0; } - + break; @@ -1631,12 +1628,12 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT - case TEXT_CODE_DEFCOLOR: - - - // calc length of what we just wrote + case TEXT_CODE_DEFCOLOR: + + + // calc length of what we just wrote usPhraseLengthPixels = WFStringPixLength(zLineString,uiLocalFont); - + // calculate new x position for next time usLocalPosX = usLocalPosX + usPhraseLengthPixels; @@ -1655,15 +1652,15 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT // reset dest char counter usDestCounter = 0; break; - + } // end of switch of CODES - + } else // not a special character { // terminate the string TEMPORARILY - zWordString[usDestCounter] = 0; + zWordString[usDestCounter] = 0; // get the length (in pixels) of this word usWordLengthPixels = WFStringPixLength(zWordString,uiLocalFont); @@ -1672,15 +1669,15 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT zWordString[usDestCounter++] = 32; // RE-terminate the string - zWordString[usDestCounter] = 0; + zWordString[usDestCounter] = 0; // can we fit it onto the length of our "line" ? if ((usLineLengthPixels + usWordLengthPixels) <= usWidth) { // yes we can fit this word. - + // get the length AGAIN (in pixels with the SPACE) for this word - usWordLengthPixels = WFStringPixLength(zWordString,uiLocalFont); + usWordLengthPixels = WFStringPixLength(zWordString,uiLocalFont); // calc new pixel length for the line usLineLengthPixels = usLineLengthPixels + usWordLengthPixels; @@ -1694,10 +1691,10 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT else { // can't fit this word! - - + + // increment Y position for next time - usPosY += (WFGetFontHeight(uiLocalFont)) +ubGap; + usPosY += (WFGetFontHeight(uiLocalFont)) +ubGap; // reset x position usLocalPosX = usPosX; @@ -1709,25 +1706,25 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT wcscpy(zLineString,zWordString); // remeasure the line length - usLineLengthPixels = WFStringPixLength(zLineString,uiLocalFont); + usLineLengthPixels = WFStringPixLength(zLineString,uiLocalFont); // reset dest char counter usDestCounter = 0; - // reset width + // reset width usLocalWidth = usWidth; } } // end of this word was NOT a special code } - - + + } while (pString[usSourceCounter++] != 0); - + SetFontShadow(DEFAULT_SHADOW); - + // return how many Y pixels we used return( usLinesUsed * ( WFGetFontHeight(uiFont) + ( UINT16 )ubGap) ); // +ubGap } @@ -1735,13 +1732,13 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT BOOLEAN WillThisStringGetCutOff( INT32 iTotalYPosition, INT32 iBottomOfPage, INT32 iWrapWidth, UINT32 uiFont, STR16 pString, INT32 iGap, INT32 iPage ) { - BOOLEAN fGetCutOff = FALSE; - INT32 iHeight; + BOOLEAN fGetCutOff = FALSE; + INT32 iHeight; // Will return if this string will get cut off - - iHeight = IanWrappedStringHeight(0, 0, ( INT16 )iWrapWidth, ( UINT8 ) ( iGap ), - uiFont, 0, pString, + + iHeight = IanWrappedStringHeight(0, 0, ( INT16 )iWrapWidth, ( UINT8 ) ( iGap ), + uiFont, 0, pString, 0, FALSE , 0); if( iHeight + iTotalYPosition >= ((iPage + 1) * iBottomOfPage ) ) @@ -1756,10 +1753,10 @@ BOOLEAN IsThisStringBeforeTheCurrentPage( INT32 iTotalYPosition, INT32 iPageSize { // check to see if the current string will appear on the current page BOOLEAN fBeforeCurrentPage = FALSE; - - if( iTotalYPosition + IanWrappedStringHeight(0, 0, ( INT16 )iWrapWidth, ( UINT8 ) ( iGap ), - uiFont, 0, pString, - 0, FALSE , 0) > ( iPageSize * iCurrentPage ) ) + + if( iTotalYPosition + IanWrappedStringHeight(0, 0, ( INT16 )iWrapWidth, ( UINT8 ) ( iGap ), + uiFont, 0, pString, + 0, FALSE , 0) > ( iPageSize * iCurrentPage ) ) { fBeforeCurrentPage = FALSE; } @@ -1774,10 +1771,10 @@ BOOLEAN IsThisStringBeforeTheCurrentPage( INT32 iTotalYPosition, INT32 iPageSize INT32 GetNewTotalYPositionOfThisString( INT32 iTotalYPosition, INT32 iPageSize, INT32 iCurrentPage ,INT32 iWrapWidth, UINT32 uiFont, STR16 pString, INT32 iGap ) { INT32 iNewYPosition = 0; - // will returnt he new total y value of this string + // will returnt he new total y value of this string - iNewYPosition = iTotalYPosition + IanWrappedStringHeight(0, 0, ( INT16 )iWrapWidth, ( UINT8 ) ( iGap ), - uiFont, 0, pString, + iNewYPosition = iTotalYPosition + IanWrappedStringHeight(0, 0, ( INT16 )iWrapWidth, ( UINT8 ) ( iGap ), + uiFont, 0, pString, 0, FALSE , 0); return( iNewYPosition ); @@ -1818,18 +1815,18 @@ RecordPtr GetFirstRecordOnThisPage( RecordPtr RecordList, UINT32 uiFont, UINT16 while( iCurrentPage < iPage ) { // build record list to this point - while( ( iCurrentPositionOnThisPage + IanWrappedStringHeight(0, 0, usWidth, ubGap, - uiFont, 0, CurrentRecord->pRecord, - 0, 0, 0 ) ) <= iPageSize ) + while( ( iCurrentPositionOnThisPage + IanWrappedStringHeight(0, 0, usWidth, ubGap, + uiFont, 0, CurrentRecord->pRecord, + 0, 0, 0 ) ) <= iPageSize ) { - + // still room on this page - iCurrentPositionOnThisPage += IanWrappedStringHeight(0, 0, usWidth, ubGap, - uiFont, 0, CurrentRecord->pRecord, - 0, 0, 0 ) ; + iCurrentPositionOnThisPage += IanWrappedStringHeight(0, 0, usWidth, ubGap, + uiFont, 0, CurrentRecord->pRecord, + 0, 0, 0 ) ; // next record - CurrentRecord = CurrentRecord -> Next; + CurrentRecord = CurrentRecord->Next; // check if we have gone too far? if( CurrentRecord == NULL ) @@ -1880,13 +1877,13 @@ FileStringPtr GetFirstStringOnThisPage( FileStringPtr RecordList, UINT32 uiFont, while( iCurrentPage < iPage ) { - + usCurrentWidth = usWidth; pWidthList = WidthList; while( pWidthList ) { - + if( iCounter == pWidthList->iRecordNumber ) { usCurrentWidth = ( INT16 ) pWidthList->iRecordWidth; @@ -1902,25 +1899,25 @@ FileStringPtr GetFirstStringOnThisPage( FileStringPtr RecordList, UINT32 uiFont, iCurrentPositionOnThisPage += pWidthList->iRecordHeightAdjustment; } - pWidthList = pWidthList ->Next; + pWidthList = pWidthList->Next; } // build record list to this point - while( ( iCurrentPositionOnThisPage + IanWrappedStringHeight(0, 0, usCurrentWidth, ubGap, - uiFont, 0, CurrentRecord->pString, - 0, 0, 0 ) ) < iPageSize ) + while( ( iCurrentPositionOnThisPage + IanWrappedStringHeight(0, 0, usCurrentWidth, ubGap, + uiFont, 0, CurrentRecord->pString, + 0, 0, 0 ) ) < iPageSize ) { - - - + + + // still room on this page - iCurrentPositionOnThisPage += IanWrappedStringHeight(0, 0, usCurrentWidth, ubGap, - uiFont, 0, CurrentRecord->pString, - 0, 0, 0 ) ; + iCurrentPositionOnThisPage += IanWrappedStringHeight(0, 0, usCurrentWidth, ubGap, + uiFont, 0, CurrentRecord->pString, + 0, 0, 0 ) ; // next record CurrentRecord = CurrentRecord->Next; @@ -1930,7 +1927,7 @@ FileStringPtr GetFirstStringOnThisPage( FileStringPtr RecordList, UINT32 uiFont, pWidthList = WidthList; while( pWidthList ) { - + if( iCounter == pWidthList->iRecordNumber ) { usCurrentWidth = ( INT16 ) pWidthList->iRecordWidth; @@ -1952,7 +1949,7 @@ FileStringPtr GetFirstStringOnThisPage( FileStringPtr RecordList, UINT32 uiFont, // reset position iCurrentPositionOnThisPage = 0; - + // next page iCurrentPage++; // iCounter++; @@ -1974,7 +1971,7 @@ BOOLEAN ReduceStringLength( STR16 pString, UINT32 uiWidthToFitIn, UINT32 uiFont UINT32 uiSrcStringCntr = 0; UINT32 uiOneCharWidth = 0; - uiStringPixWidth = WFStringPixLength( pString, uiFont ); + uiStringPixWidth = WFStringPixLength( pString, uiFont ); OneChar[1] = L'\0'; zTemp[0] = L'\0'; @@ -1990,7 +1987,7 @@ BOOLEAN ReduceStringLength( STR16 pString, UINT32 uiWidthToFitIn, UINT32 uiFont wcscpy( zStrDots, L"..." ); //get the width of the '...' - uiDotWidth = StringPixLength( zStrDots, uiFont ); + uiDotWidth = StringPixLength( zStrDots, uiFont ); //since the temp strig will contain the '...' add the '...' width to the temp string now uiTempStringPixWidth = uiDotWidth; @@ -2002,7 +1999,7 @@ BOOLEAN ReduceStringLength( STR16 pString, UINT32 uiWidthToFitIn, UINT32 uiFont OneChar[0] = pString[ uiSrcStringCntr ]; //get the width of the character - uiOneCharWidth = StringPixLength( OneChar, uiFont ); + uiOneCharWidth = StringPixLength( OneChar, uiFont ); //will the new char + the old string be too wide for the width if( ( uiTempStringPixWidth + uiOneCharWidth ) <= uiWidthToFitIn ) diff --git a/Utils/WordWrap.h b/Utils/WordWrap.h index cd8ba279..d094ee98 100644 --- a/Utils/WordWrap.h +++ b/Utils/WordWrap.h @@ -9,7 +9,7 @@ // Defines for coded text For use with IanDisplayWrappedString() -#define TEXT_SPACE 32 +#define TEXT_SPACE 32 #define TEXT_CODE_NEWLINE 177 #define TEXT_CODE_BOLD 178 #define TEXT_CODE_CENTER 179 @@ -25,10 +25,10 @@ UINT16 IanDisplayWrappedString(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UIN #define TEXT_SHADOWED 0x00000008 #define INVALIDATE_TEXT 0x00000010 -#define DONT_DISPLAY_TEXT 0x00000020 //Wont display the text. Used if you just want to get how many lines will be displayed +#define DONT_DISPLAY_TEXT 0x00000020 //Wont display the text. Used if you just want to get how many lines will be displayed -#define IAN_WRAP_NO_SHADOW 32 +#define IAN_WRAP_NO_SHADOW 32 @@ -48,14 +48,14 @@ UINT16 DisplayWrappedString(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT8 UINT16 DeleteWrappedString(WRAPPED_STRING *pWrappedString); void CleanOutControlCodesFromString(STR16 pSourceString, STR16 pDestString); INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT16 usPageHeight, UINT16 usTotalHeight, UINT16 usPageNumber,UINT8 ubGap, - UINT32 uiFont, UINT8 ubColor, STR16 pString, - UINT8 ubBackGroundColor, BOOLEAN fDirty, UINT32 uiFlags, BOOLEAN *fOnLastPageFlag); + UINT32 uiFont, UINT8 ubColor, STR16 pString, + UINT8 ubBackGroundColor, BOOLEAN fDirty, UINT32 uiFlags, BOOLEAN *fOnLastPageFlag); BOOLEAN DrawTextToScreen(STR16 pStr, UINT16 LocX, UINT16 LocY, UINT16 usWidth, UINT32 ulFont, UINT8 ubColor, UINT8 ubBackGroundColor, BOOLEAN fDirty, UINT32 FLAGS); UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT8 ubGap, - UINT32 uiFont, UINT8 ubColor, STR16 pString, - UINT8 ubBackGroundColor, BOOLEAN fDirty, UINT32 uiFlags); + UINT32 uiFont, UINT8 ubColor, STR16 pString, + UINT8 ubBackGroundColor, BOOLEAN fDirty, UINT32 uiFlags); -BOOLEAN WillThisStringGetCutOff( INT32 iCurrentYPosition, INT32 iBottomOfPage, INT32 iWrapWidth, UINT32 uiFont, STR16 pString, INT32 iGap, INT32 iPage ); +BOOLEAN WillThisStringGetCutOff( INT32 iCurrentYPosition, INT32 iBottomOfPage, INT32 iWrapWidth, UINT32 uiFont, STR16 pString, INT32 iGap, INT32 iPage ); BOOLEAN IsThisStringBeforeTheCurrentPage( INT32 iTotalYPosition, INT32 iPageSize, INT32 iCurrentPage ,INT32 iWrapWidth, UINT32 uiFont, STR16 pString, INT32 iGap ); INT32 GetNewTotalYPositionOfThisString( INT32 iTotalYPosition, INT32 iPageSize, INT32 iCurrentPage ,INT32 iWrapWidth, UINT32 uiFont, STR16 pString, INT32 iGap ); RecordPtr GetFirstRecordOnThisPage( RecordPtr RecordList, UINT32 uiFont, UINT16 usWidth, UINT8 ubGap, INT32 iPage, INT32 iPageSize ); diff --git a/Utils/XML_Items.cpp b/Utils/XML_Items.cpp index 86291b76..ed4bd07f 100644 --- a/Utils/XML_Items.cpp +++ b/Utils/XML_Items.cpp @@ -103,6 +103,7 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at strcmp(name, "ubGraphicNum") == 0 || strcmp(name, "ubWeight") == 0 || strcmp(name, "ubPerPocket") == 0 || + strcmp(name, "ItemSize") == 0 || strcmp(name, "usPrice") == 0 || strcmp(name, "ubCoolness") == 0 || strcmp(name, "bReliability") == 0 || @@ -162,6 +163,7 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at strcmp(name, "DayVisionRangeBonus") == 0 || strcmp(name, "CaveVisionRangeBonus") == 0 || strcmp(name, "BrightLightVisionRangeBonus") == 0 || + strcmp(name, "ItemSizeBonus") == 0 || strcmp(name, "LeatherJacket") == 0 || strcmp(name, "NeedsBatteries") == 0 || strcmp(name, "Batteries") == 0 || @@ -185,6 +187,7 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at strcmp(name, "Flare") == 0 || strcmp(name, "MetalDetector") == 0 || strcmp(name, "FingerPrintID") == 0 || + strcmp(name, "AmmoCrate") == 0 || strcmp(name, "Cannon") == 0 || strcmp(name, "RocketRifle") == 0 || strcmp(name, "MedicalKit") == 0 || @@ -209,6 +212,7 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at strcmp(name, "SnowCamoBonus") == 0 || strcmp(name, "StealthBonus") == 0 || strcmp(name, "SciFi") == 0 || + strcmp(name, "NewInv") == 0 || strcmp(name, "fFlags") == 0 )) { @@ -242,7 +246,9 @@ static void XMLCALL itemEndElementHandle(void *userData, const XML_Char *name) { itemParseData * pData = (itemParseData *)userData; +#if 0 char temp; +#endif if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading { @@ -457,6 +463,11 @@ itemEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curItem.ubPerPocket = (UINT8) atol(pData->szCharData); } + else if(strcmp(name, "ItemSize") == 0) + { + pData->curElement = ELEMENT; + pData->curItem.ItemSize = (UINT8) atol(pData->szCharData); + } else if(strcmp(name, "usPrice") == 0) { pData->curElement = ELEMENT; @@ -749,6 +760,11 @@ itemEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curItem.scifi = (BOOLEAN) atol(pData->szCharData); } + else if(strcmp(name, "NewInv") == 0) + { + pData->curElement = ELEMENT; + pData->curItem.newinv = (BOOLEAN) atol(pData->szCharData); + } else if(strcmp(name, "HideMuzzleFlash") == 0) { pData->curElement = ELEMENT; @@ -874,6 +890,11 @@ itemEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curItem.brightlightvisionrangebonus = (INT16) atol(pData->szCharData); } + if(strcmp(name, "ItemSizeBonus") == 0) + { + pData->curElement = ELEMENT; + pData->curItem.itemsizebonus = (INT16) atol(pData->szCharData); + } else if(strcmp(name, "LeatherJacket") == 0) { pData->curElement = ELEMENT; @@ -964,6 +985,11 @@ itemEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curItem.fingerprintid = (BOOLEAN) atol(pData->szCharData); } + else if(strcmp(name, "AmmoCrate") == 0) + { + pData->curElement = ELEMENT; + pData->curItem.ammocrate = (BOOLEAN) atol(pData->szCharData); + } else if(strcmp(name, "Rock") == 0) { pData->curElement = ELEMENT; @@ -1398,6 +1424,7 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubGraphicNum); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubWeight); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubPerPocket); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ItemSize); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usPrice); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubCoolness); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bReliability); @@ -1432,6 +1459,7 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].attachment ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].biggunlist ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].scifi ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].newinv ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].notineditor ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].defaultundroppable ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].unaerodynamic ); @@ -1508,6 +1536,7 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].dayvisionrangebonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].cavevisionrangebonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].brightlightvisionrangebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].itemsizebonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percenttunnelvision ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].thermaloptics ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].gasmask ); @@ -1533,6 +1562,7 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].containsliquid ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].metaldetector ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fingerprintid ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ammocrate ); FilePrintf(hFile,"\t\r\n"); } @@ -1541,4 +1571,4 @@ BOOLEAN WriteItemStats() FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Utils/XML_Strings.cpp b/Utils/XML_Strings.cpp index b5cdfeca..2185017b 100644 --- a/Utils/XML_Strings.cpp +++ b/Utils/XML_Strings.cpp @@ -47,15 +47,15 @@ struct PARSE_STAGE curElement; CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; - + UINT32 maxArraySize; - UINT32 curIndex; + UINT32 curIndex; UINT32 currentDepth; UINT32 maxReadDepth; } typedef stringParseData; -static void XMLCALL +static void XMLCALL stringStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) { stringParseData * pData = (stringParseData *)userData; @@ -88,9 +88,9 @@ stringCharacterDataHandle(void *userData, const XML_Char *str, int len) { stringParseData * pData = (stringParseData *)userData; - if( (pData->currentDepth <= pData->maxReadDepth) && + if( (pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ + ){ strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); } } @@ -133,7 +133,7 @@ BOOLEAN ReadInStringArray() UINT32 uiFSize; CHAR8 * lpcBuffer; XML_Parser parser = XML_ParserCreate(NULL); - + stringParseData pData; DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("Loading %s",AMMOCALIBERSTRINGSFILENAME ) ); @@ -142,7 +142,7 @@ BOOLEAN ReadInStringArray() hFile = FileOpen( AMMOCALIBERSTRINGSFILENAME, FILE_ACCESS_READ, FALSE ); if ( !hFile ) return( FALSE ); - + uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); @@ -157,19 +157,19 @@ BOOLEAN ReadInStringArray() FileClose( hFile ); - + XML_SetElementHandler(parser, stringStartElementHandle, stringEndElementHandle); XML_SetCharacterDataHandler(parser, stringCharacterDataHandle); - + memset(&pData,0,sizeof(pData)); - pData.maxArraySize = MAXITEMS; + pData.maxArraySize = MAXITEMS; pData.curIndex = 0xffffffff; XML_SetUserData(parser, &pData); - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { CHAR8 errorBuf[511]; @@ -196,7 +196,7 @@ BOOLEAN WriteStringArray() hFile = FileOpen( "TABLEDATA\\AmmoCaliberStrings out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); if ( !hFile ) return( FALSE ); - + { UINT32 cnt; @@ -211,7 +211,7 @@ BOOLEAN WriteStringArray() { UINT32 uiCharLoc = wcscspn(szRemainder,L"&<>\'\"\0"); CHAR16 invChar = szRemainder[uiCharLoc]; - + if(uiCharLoc) { szRemainder[uiCharLoc] = '\0'; diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index 02732f8b..5f14862e 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -767,7 +767,7 @@ STR16 gzMercSkillText[] = L"Dief", L"Vechtkunsten", L"Mesworp", - L"Raak op dak! Bonus", + L"Sniper", L"Camouflaged", L"Camouflage (Urban)", L"Camouflage (Desert)", @@ -1081,7 +1081,7 @@ STR16 sKeyDescriptionStrings[2] = //The headers used to describe various weapon statistics. -INT16 gWeaponStatsDesc[][ 14 ] = +CHAR16 gWeaponStatsDesc[][ 14 ] = { L"Gewicht (%s):", L"Status:", @@ -1102,7 +1102,7 @@ INT16 gWeaponStatsDesc[][ 14 ] = //The headers used for the merc's money. -INT16 gMoneyStatsDesc[][ 13 ] = +CHAR16 gMoneyStatsDesc[][ 13 ] = { L"Bedrag", L"Restbedrag:", //this is the overall balance @@ -1140,12 +1140,12 @@ STR16 gzMoneyAmounts[6] = }; // short words meaning "Advantages" for "Pros" and "Disadvantages" for "Cons." -INT16 gzProsLabel[10] = +CHAR16 gzProsLabel[10] = { L"Voor:", }; -INT16 gzConsLabel[10] = +CHAR16 gzConsLabel[10] = { L"Tegen:", }; @@ -1408,6 +1408,7 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = L"Gezondheid: %d/%d\nBrandstof: %d/%d", //L"Health: %d/%d\nFuel: %d/%d", L"%s kan %s niet zien.", // Cannot see person trying to talk to L"Attachment removed", + L"Kan niet een ander voertuig bereiken aangezien u reeds 2 hebt", }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. @@ -1618,6 +1619,7 @@ STR16 pMapInventoryErrorString[] = L"Tijdens gevechten moet je items handmatig oppakken.", L"Tijdens gevechten moet je items handmatig neerleggen.", L"%s is niet in de sector om dat item neer te leggen.", + L"Tijdens gevecht, kunt u met een munitiekrat herladen niet.", }; STR16 pMapInventoryStrings[] = @@ -2843,6 +2845,7 @@ STR16 BobbyRFilter[] = // Used L"Guns", L"Armor", + L"LBE Gear", L"Misc", // Armour @@ -2860,6 +2863,7 @@ STR16 BobbyRFilter[] = L"Med. Kits", L"Kits", L"Face Items", + L"LBE Gear", L"Misc.", }; @@ -3384,6 +3388,8 @@ STR16 zSaveLoadText[] = L"Great Selection", L"Excellent Selection", L"Awesome Selection", + + L"New Inventory does not work in 640x480 screen size. Please resize and try again.", }; @@ -3602,6 +3608,9 @@ STR16 gzGIOScreenText[] = L"Excellent", L"Awesome", L"INSANE", + L"Inventory System", + L"Old", + L"New", }; STR16 pDeliveryLocationStrings[] = @@ -3994,6 +4003,8 @@ STR16 sRepairsDoneString[] = L"%s is klaar met reparatie van ieders wapens en bepantering", L"%s is klaar met reparatie van ieders uitrusting", L"%s is klaar met reparatie van ieders vervoerde items", + L"%s is klaar met reparatie van ieders vervoerde items", + L"%s is klaar met reparatie van ieders vervoerde items", }; /*STR16 zGioDifConfirmText[]= @@ -4243,10 +4254,19 @@ STR16 New113MERCMercMailTexts[] = // INFO: Do not replace the ± characters. They indicate the (-> Newline) from the edt files STR16 MissingIMPSkillsDescriptions[] = { - // Rooftop sniping - L"Rooftop Sniping: Not even ants are on the save side. Each target is mercilessly tracked down! ± ", + // Sniper + L"Sniper: De ogen van een havik, u kunnen de vleugels van een vlieg bij honderd werven ontspruiten! ± ", // Camouflage - L"Camouflage: Besides you even bushes look synthetic! ± ", + L"Camouflage: Naast u ringt synthetische zelfs blik! ± ", +}; + +STR16 NewInvMessage[] = +{ + L"Kan op dit moment niet bestelwagenrugzak", + L"Geen plaats om rugzak te zetten", + L"Gevonden niet rugzak", + L"De ritssluiting werkt slechts in gevecht", + L"Kan niet me bewegen terwijl actieve rugzakritssluiting", }; #endif //DUTCH diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index 39e433fc..9237cc48 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -2,13 +2,13 @@ #include "Utils All.h" #else #include "Language Defines.h" - #if defined( ENGLISH ) || defined( TAIWANESE ) + #if defined( ENGLISH ) #include "text.h" #include "Fileman.h" #endif #endif -#if defined( ENGLISH ) || defined( TAIWANESE ) +#if defined( ENGLISH ) /* @@ -765,7 +765,7 @@ STR16 gzMercSkillText[] = L"Thief", L"Martial Arts", L"Knifing", - L"Rooftop Sniping", //JA25: modified + L"Sniper", L"Camouflage", //JA25: modified L"Camouflage (Urban)", L"Camouflage (Desert)", @@ -1408,6 +1408,7 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = L"Health: %d/%d\nFuel: %d/%d", L"%s cannot see %s.", // Cannot see person trying to talk to L"Attachment removed", + L"Can not gain another vehicle as you already have 2", }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. @@ -1618,6 +1619,7 @@ STR16 pMapInventoryErrorString[] = L"During combat, you'll have to pick up items manually.", L"During combat, you'll have to drop items manually.", L"%s isn't in the sector to drop that item.", + L"During combat, you can't reload with an ammo crate.", }; STR16 pMapInventoryStrings[] = @@ -2844,6 +2846,7 @@ STR16 BobbyRFilter[] = // Used L"Guns", L"Armor", + L"LBE Gear", L"Misc", // Armour @@ -2861,6 +2864,7 @@ STR16 BobbyRFilter[] = L"Med. Kits", L"Kits", L"Face Items", + L"LBE Gear", L"Misc.", }; @@ -3385,6 +3389,8 @@ STR16 zSaveLoadText[] = L"Great Selection", L"Excellent Selection", L"Awesome Selection", + + L"New Inventory does not work in 640x480 screen size. Please resize and try again.", }; @@ -3605,6 +3611,9 @@ STR16 gzGIOScreenText[] = L"Great", L"Excellent", L"Awesome", + L"Inventory System", + L"Old", + L"New", }; STR16 pDeliveryLocationStrings[] = @@ -3997,6 +4006,8 @@ STR16 sRepairsDoneString[] = L"%s finished repairing everyone's guns & armor", L"%s finished repairing everyone's equipped items", L"%s finished repairing everyone's carried items", + L"%s finished repairing everyone's carried items", + L"%s finished repairing everyone's carried items", }; STR16 zGioDifConfirmText[]= @@ -4238,10 +4249,19 @@ STR16 New113MERCMercMailTexts[] = // INFO: Do not replace the ± characters. They indicate the (-> Newline) from the edt files STR16 MissingIMPSkillsDescriptions[] = { - // Rooftop sniping - L"Rooftop Sniping: Not even ants are on the save side. Each target is mercilessly tracked down! ± ", + // Sniper + L"Sniper: Eyes of a hawk, you can shoot the wings from a fly at a hundred yards! ± ", // Camouflage L"Camouflage: Besides you even bushes look synthetic! ± ", }; -#endif //ENGLISH \ No newline at end of file +STR16 NewInvMessage[] = +{ + L"Cannot pickup backpack at this time", + L"No place to put backpack", + L"Backpack not found", + L"Zipper only works in combat", + L"Can not move while backpack zipper active", +}; + +#endif //ENGLISH diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index 11e8f64c..aad7c88a 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -757,7 +757,7 @@ STR16 gzMercSkillText[] = L"Voleur", L"Arts martiaux", L"Couteau", - L"Bonus toucher (sur le toit)", + L"Tireur isolé", L"Camouflage", L"Camouflage (Urban)", L"Camouflage (Desert)", @@ -1071,7 +1071,7 @@ STR16 sKeyDescriptionStrings[2] = //The headers used to describe various weapon statistics. -INT16 gWeaponStatsDesc[][ 14 ] = +CHAR16 gWeaponStatsDesc[][ 14 ] = { L"Poids (%s):", L"Etat :", @@ -1092,7 +1092,7 @@ INT16 gWeaponStatsDesc[][ 14 ] = //The headers used for the merc's money. -INT16 gMoneyStatsDesc[][ 13 ] = +CHAR16 gMoneyStatsDesc[][ 13 ] = { L"Montant", L"Restant :", //this is the overall balance @@ -1130,12 +1130,12 @@ STR16 gzMoneyAmounts[6] = }; // short words meaning "Advantages" for "Pros" and "Disadvantages" for "Cons." -INT16 gzProsLabel[10] = +CHAR16 gzProsLabel[10] = { L"Plus :", }; -INT16 gzConsLabel[10] = +CHAR16 gzConsLabel[10] = { L"Moins :", }; @@ -1398,6 +1398,7 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = L"Etat : %d/%d\nCarburant : %d/%d", L"%s ne peut pas voir %s.", // Cannot see person trying to talk to L"Attachment removed", + L"Ne peut pas gagner un autre véhicule car vous avez déjà 2", }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. @@ -1608,6 +1609,7 @@ STR16 pMapInventoryErrorString[] = L"En combat, vous devez prendre les objets vous-même.", L"En combat, vous devez abandonner les objets vous-même.", L"%s n'est pas dans le bon secteur.", + L"Pendant le combat, vous ne pouvez pas recharger avec une caisse de munitions.", }; STR16 pMapInventoryStrings[] = @@ -2832,6 +2834,7 @@ STR16 BobbyRFilter[] = // Used L"Guns", L"Armor", + L"LBE Gear", L"Misc", // Armour @@ -2849,6 +2852,7 @@ STR16 BobbyRFilter[] = L"Med. Kits", L"Kits", L"Face Items", + L"LBE Gear", L"Misc.", }; @@ -3373,6 +3377,8 @@ STR16 zSaveLoadText[] = L"Meilleur Selection", L"Excellent Selection", L"Superb Selection", + + L"New Inventory does not work in 640x480 screen size. Please resize and try again.", }; @@ -3592,6 +3598,9 @@ STR16 gzGIOScreenText[] = L"Meilleur", L"Excellent", L"Superb", + L"Inventory System", + L"Old", + L"New", }; STR16 pDeliveryLocationStrings[] = @@ -3984,6 +3993,8 @@ STR16 sRepairsDoneString[] = L"%s a terminé la réparation des armes & armures", L"%s a terminé la réparation des objets portés", L"%s a terminé la réparation des objets transportés", + L"%s a terminé la réparation des objets transportés", + L"%s a terminé la réparation des objets transportés", }; STR16 zGioDifConfirmText[]= @@ -4225,10 +4236,19 @@ STR16 New113MERCMercMailTexts[] = // INFO: Do not replace the ± characters. They indicate the (-> Newline) from the edt files STR16 MissingIMPSkillsDescriptions[] = { - // Rooftop sniping - L"Rooftop Sniping: Not even ants are on the save side. Each target is mercilessly tracked down! ± ", + // Sniper + L"Tireur isolé : Des yeux d'un faucon, vous pouvez tirer les ailes d'une mouche à cent yards! ± ", // Camouflage - L"Camouflage: Besides you even bushes look synthetic! ± ", + L"Camouflage : Sans compter que vous même les buissons semblent synthétiques! ± ", +}; + +STR16 NewInvMessage[] = +{ + L"Ne peut pas le baluchon de collecte actuellement", + L"Aucun endroit pour mettre le baluchon", + L"Baluchon non trouvé", + L"La tirette fonctionne seulement dans le combat", + L"Ne peut pas se déplacer alors que la tirette de baluchon active", }; #endif //FRENCH diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index 47d79cb2..cbccee0c 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -739,7 +739,7 @@ STR16 gzMercSkillText[] = L"Dieb", L"Kampfsport", L"Messer", - L"Dach-Treffer-Bonus", + L"Scharfschütze", L"Getarnt", L"Getarnt (Stadt)", L"Getarnt (Wüste)", @@ -1370,6 +1370,7 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = L"Gesundh.: %d/%d\nTank: %d/%d", L"%s kann %s nicht sehen.", // Cannot see person trying to talk to L"Attachment removed", + L"Sie können kein weiteres Fahrzeug mehr verwenden, da Sie bereits 2 haben", }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. @@ -1569,6 +1570,7 @@ STR16 pMapInventoryErrorString[] = L"Während einer Schlacht müssen Sie Gegenstände manuell nehmen.", L"Während einer Schlacht müssen Sie Gegenstände manuell fallenlassen.", L"%s ist nicht im Sektor und kann Gegenstand nicht fallen lassen.", + L"Während des Kampfes können Sie die Munitionskiste nicht zum Nachladen verwenden.", }; STR16 pMapInventoryStrings[] = @@ -2702,6 +2704,7 @@ STR16 BobbyRFilter[] = // Used L"Feuerwfn.", L"Rüstungen", + L"LBE Ausr.", L"Sonstiges", // Armour @@ -2719,6 +2722,7 @@ STR16 BobbyRFilter[] = L"Verbandsk.", L"Taschen", L"Gesicht G.", + L"LBE Ausr.", L"Sonstiges", }; @@ -3187,6 +3191,8 @@ STR16 zSaveLoadText[] = L"Große Auswahl", L"Ausgezeichnete Auswahl", L"Fantastische Auswahl", + + L"Neuer Warenbestand arbeitet nicht im 640x480 Bildumfang. Bitte bestimmen Sie die Größe neu und versuchen Sie wieder.", }; //MapScreen @@ -3406,6 +3412,9 @@ STR16 gzGIOScreenText[] = L"Groß", L"Ausgezeichnet", L"Fantastisch", + L"Inventar System", + L"Alt", + L"Neu", }; STR16 pDeliveryLocationStrings[] = @@ -3796,6 +3805,8 @@ STR16 sRepairsDoneString[] = L"%s hat die Waffen und Rüstungen aller Teammitglieder repariert", L"%s hat die aktivierten Gegenstände aller Teammitglieder repariert", L"%s hat die mitgeführten Gegenstände aller Teammitglieder repariert", + L"%s hat die mitgeführten Gegenstände aller Teammitglieder repariert", + L"%s hat die mitgeführten Gegenstände aller Teammitglieder repariert", }; STR16 zGioDifConfirmText[]= @@ -4030,10 +4041,19 @@ STR16 New113MERCMercMailTexts[] = // INFO: Do not replace the ± characters. They indicate the (-> Newline) from the edt files STR16 MissingIMPSkillsDescriptions[] = { - // Rooftop sniping - L"Dach-Treffer Bonus: Vor Ihnen sind nicht einmal Ameisen sicher. Jedes anvisierte Ziel wird gnadenlos zur Strecke gebracht! ± ", + // Sniper + L"Scharfschütze: Sie haben Augen wie ein Falke. Dadurch können sie sogar auf die Flügel einer Fliege aus hunderten von Metern schießen! ± ", // Camouflage - L"Getarnt: Neben Ihnen sehen selbst Sträucher künstlich aus! ± ", + L"Tarnung: Neben Ihnen schauen sogar Büsche synthetisch aus! ± ", +}; + +STR16 NewInvMessage[] = +{ + L"Rucksack kann zur Zeit nicht aufgehoben werden", + L"Kein Platz zum Ablegen des Rucksacks", + L"Rucksack nicht gefunden", + L"Reißverschluss funktioniert nur im Kampf", + L"Bewegung nicht möglich, während Reißverschluss des Rucksacks offen ist", }; #endif //GERMAN diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 702254ea..f3407c64 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -750,7 +750,7 @@ STR16 gzMercSkillText[] = L"Furtività", L"Arti marziali", L"Coltelli", - L"Bonus per altezza", + L"Sniper", L"Camuffato", L"Camuffato (Urban)", L"Camuffato (Desert)", @@ -1064,7 +1064,7 @@ STR16 sKeyDescriptionStrings[2] = //The headers used to describe various weapon statistics. -INT16 gWeaponStatsDesc[][ 14 ] = +CHAR16 gWeaponStatsDesc[][ 14 ] = { L"Peso (%s):", L"Stato:", @@ -1085,7 +1085,7 @@ INT16 gWeaponStatsDesc[][ 14 ] = //The headers used for the merc's money. -INT16 gMoneyStatsDesc[][ 13 ] = +CHAR16 gMoneyStatsDesc[][ 13 ] = { L"Ammontare", L"Rimanenti:", //this is the overall balance @@ -1123,12 +1123,12 @@ STR16 gzMoneyAmounts[6] = }; // short words meaning "Advantages" for "Pros" and "Disadvantages" for "Cons." -INT16 gzProsLabel[10] = +CHAR16 gzProsLabel[10] = { L"Vant.:", }; -INT16 gzConsLabel[10] = +CHAR16 gzConsLabel[10] = { L"Svant.:", }; @@ -1392,6 +1392,7 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = L"Salute: %d/%d\nCarburante: %d/%d", L"%s non riesce a vedere %s.", // Cannot see person trying to talk to L"Attachment removed", + L"Non può guadagnare un altro veicolo poichè già avete 2", }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. @@ -1602,6 +1603,7 @@ STR16 pMapInventoryErrorString[] = L"Durante il combattimento, dovrete raccogliere gli oggetti manualmente.", L"Durante il combattimento, dovrete rilasciare gli oggetti manualmente.", L"%s non si trova nel settore per rilasciare quell'oggetto.", + L"Durante il combattimento, non potete ricaricare con una cassa del ammo.", }; STR16 pMapInventoryStrings[] = @@ -2826,6 +2828,7 @@ STR16 BobbyRFilter[] = // Used L"Guns", L"Armor", + L"LBE Gear", L"Misc", // Armour @@ -2843,6 +2846,7 @@ STR16 BobbyRFilter[] = L"Med. Kits", L"Kits", L"Face Items", + L"LBE Gear", L"Misc.", }; @@ -3365,6 +3369,8 @@ STR16 zSaveLoadText[] = L"Great Selection", L"Excellent Selection", L"Awesome Selection", + + L"New Inventory does not work in 640x480 screen size. Please resize and try again.", }; @@ -3583,6 +3589,9 @@ STR16 gzGIOScreenText[] = L"Excellent", L"Awesome", L"INSANE", + L"Inventory System", + L"Old", + L"New", }; STR16 pDeliveryLocationStrings[] = @@ -3975,6 +3984,8 @@ STR16 sRepairsDoneString[] = L"%s ha finito di riparare le armi e i giubbotti antiproiettile di tutti", L"%s ha finito di riparare gli oggetti dell'equipaggiamento di tutti", L"%s ha finito di riparare gli oggetti trasportati di tutti", + L"%s ha finito di riparare gli oggetti trasportati di tutti", + L"%s ha finito di riparare gli oggetti trasportati di tutti", }; STR16 zGioDifConfirmText[]= @@ -4222,10 +4233,19 @@ STR16 New113MERCMercMailTexts[] = // INFO: Do not replace the ± characters. They indicate the (-> Newline) from the edt files STR16 MissingIMPSkillsDescriptions[] = { - // Rooftop sniping - L"Rooftop Sniping: Not even ants are on the save side. Each target is mercilessly tracked down! ± ", + // Sniper + L"Sniper: Occhi di un hawk, potete sparare le ale da un mosca ad cento yarde! ± ", // Camouflage - L"Camouflage: Besides you even bushes look synthetic! ± ", + L"Camuffamento: Oltre voi persino i cespugli sembrano sintetici! ± ", +}; + +STR16 NewInvMessage[] = +{ + L"Non può il fagotto della raccolta attualmente", + L"Nessun posto per mettere fagotto", + L"Fagotto non trovato", + L"La chiusura lampo funziona soltanto nel combattimento", + L"Non può muoversi mentre la chiusura lampo del fagotto attiva", }; #endif //ITALIAN diff --git a/Utils/_Ja25DutchText.cpp b/Utils/_Ja25DutchText.cpp new file mode 100644 index 00000000..56811a0d --- /dev/null +++ b/Utils/_Ja25DutchText.cpp @@ -0,0 +1,71 @@ +#ifdef PRECOMPILEDHEADERS + #include "Utils All.h" + #include "_Ja25Dutchtext.h" +#else + #include "Language Defines.h" + #ifdef DUTCH + #include "text.h" + #include "Fileman.h" + #endif +#endif + +#ifdef DUTCH + +// VERY TRUNCATED FILE COPIED FROM JA2.5 FOR ITS FEATURES FOR JA2 GOLD + +STR16 zNewTacticalMessages[]= +{ + L"Range to target: %d tiles, Brightness: %d/%d", + L"Attaching the transmitter to your laptop computer.", + L"You cannot afford to hire %s", + L"For a limited time, the above fee covers the cost of the entire mission and includes the equipment listed below.", + L"Hire %s now and take advantage of our unprecedented 'one fee covers all' pricing. Also included in this unbelievable offer is the mercenary's personal equipment at no charge.", + L"Fee", + L"There is someone else in the sector...", + L"Gun Range: %d tiles, Chance to hit: %d percent", + L"Display Cover", + L"Line of Sight", + L"New Recruits cannot arrive there.", + L"Since your laptop has no transmitter, you won't be able to hire new team members. Perhaps this would be a good time to load a saved game or start over!", + L"%s hears the sound of crumpling metal coming from underneath Jerry's body. It sounds disturbingly like your laptop antenna being crushed.", //the %s is the name of a merc. @@@ Modified + L"After scanning the note left behind by Deputy Commander Morris, %s senses an oppurtinity. The note contains the coordinates for launching missiles against different towns in Arulco. It also gives the coodinates of the origin - the missile facility.", + L"Noticing the control panel, %s figures the numbers can be reveresed, so that the missile might destroy this very facility. %s needs to find an escape route. The elevator appears to offer the fastest solution...", + L"This is an IRON MAN game and you cannot save when enemies are around.", // @@@ new text + L"(Cannot save during combat)", //@@@@ new text + L"The current campaign name is greater than 30 characters.", // @@@ new text + L"The current campaign cannot be found.", // @@@ new text + L"Campaign: Default ( %S )", // @@@ new text + L"Campaign: %S", // @@@ new text + L"You have selected the campaign %S. This campaign is a player-modified version of the original Unfinished Business campaign. Are you sure you wish to play the %S campaign?", // @@@ new text + L"In order to use the editor, please select a campaign other than the default.", ///@@new +}; + +//these strings match up with the defines in IMP Skill trait.cpp +STR16 gzIMPSkillTraitsText[]= +{ + L"Lock picking", + L"Hand to hand combat", + L"Electronics", + L"Night operations", + L"Throwing", + L"Teaching", + L"Heavy Weapons", + L"Auto Weapons", + L"Stealth", + L"Ambidextrous", + L"Knifing", + L"Sniper", + L"Camouflage", + L"Martial Arts", + + L"None", + L"I.M.P. Specialties", +}; +//@@@: New string as of March 3, 2000. +STR16 gzIronManModeWarningText[]= +{ + L"You have chosen IRON MAN mode. This setting makes the game considerably more challenging as you will not be able to save your game when in a sector occupied by enemies. This setting will affect the entire course of the game. Are you sure want to play in IRON MAN mode?", +}; + + +#endif diff --git a/Utils/_Ja25DutchText.h b/Utils/_Ja25DutchText.h new file mode 100644 index 00000000..3df69617 --- /dev/null +++ b/Utils/_Ja25DutchText.h @@ -0,0 +1,43 @@ +#ifndef _JA25ENGLISHTEXT__H_ +#define _JA25ENGLISHTEXT__H_ + + +enum +{ + TCTL_MSG__RANGE_TO_TARGET, + TCTL_MSG__ATTACH_TRANSMITTER_TO_LAPTOP, + TACT_MSG__CANNOT_AFFORD_MERC, + TACT_MSG__AIMMEMBER_FEE_TEXT, + TACT_MSG__AIMMEMBER_ONE_TIME_FEE, + TACT_MSG__FEE, + TACT_MSG__SOMEONE_ELSE_IN_SECTOR, + TCTL_MSG__GUN_RANGE_AND_CTH, + TCTL_MSG__DISPLAY_COVER, + TCTL_MSG__LOS, + TCTL_MSG__INVALID_DROPOFF_SECTOR, + TCTL_MSG__PLAYER_LOST_SHOULD_RESTART, + TCTL_MSG__JERRY_BREAKIN_LAPTOP_ANTENA, + TCTL_MSG__END_GAME_POPUP_TXT_1, + TCTL_MSG__END_GAME_POPUP_TXT_2, + TCTL_MSG__IRON_MAN_CANT_SAVE_NOW, + TCTL_MSG__CANNOT_SAVE_DURING_COMBAT, + TCTL_MSG__CAMPAIGN_NAME_TOO_LARGE, + TCTL_MSG__CAMPAIGN_DOESN_T_EXIST, + TCTL_MSG__DEFAULT_CAMPAIGN_LABEL, + TCTL_MSG__CAMPAIGN_LABEL, + TCTL_MSG__NEW_CAMPAIGN_CONFIRM, + TCTL_MSG__CANT_EDIT_DEFAULT, + +}; +extern STR16 zNewTacticalMessages[]; +extern STR16 gzIMPSkillTraitsText[]; + +enum +{ + IMM__IRON_MAN_MODE_WARNING_TEXT, +}; +extern STR16 gzIronManModeWarningText[]; + +#endif + + diff --git a/Utils/_Ja25EnglishText.cpp b/Utils/_Ja25EnglishText.cpp index d3a43277..3104e1c3 100644 --- a/Utils/_Ja25EnglishText.cpp +++ b/Utils/_Ja25EnglishText.cpp @@ -54,7 +54,7 @@ STR16 gzIMPSkillTraitsText[]= L"Stealth", L"Ambidextrous", L"Knifing", - L"Rooftop Sniping", + L"Sniper", L"Camouflage", L"Martial Arts", diff --git a/Utils/_Ja25EnglishText.h b/Utils/_Ja25EnglishText.h index 3df69617..a7553001 100644 --- a/Utils/_Ja25EnglishText.h +++ b/Utils/_Ja25EnglishText.h @@ -12,6 +12,7 @@ enum TACT_MSG__FEE, TACT_MSG__SOMEONE_ELSE_IN_SECTOR, TCTL_MSG__GUN_RANGE_AND_CTH, + //TCTL_MSG__RANGE_TO_TARGET_AND_GUN_RANGE, // WANNE: Not used TCTL_MSG__DISPLAY_COVER, TCTL_MSG__LOS, TCTL_MSG__INVALID_DROPOFF_SECTOR, diff --git a/Utils/_Ja25FrenchText.cpp b/Utils/_Ja25FrenchText.cpp new file mode 100644 index 00000000..8d5e52a0 --- /dev/null +++ b/Utils/_Ja25FrenchText.cpp @@ -0,0 +1,71 @@ +#ifdef PRECOMPILEDHEADERS + #include "Utils All.h" + #include "_Ja25Frenchtext.h" +#else + #include "Language Defines.h" + #ifdef FRENCH + #include "text.h" + #include "Fileman.h" + #endif +#endif + +#ifdef FRENCH + +// VERY TRUNCATED FILE COPIED FROM JA2.5 FOR ITS FEATURES FOR JA2 GOLD + +STR16 zNewTacticalMessages[]= +{ + L"Range to target: %d tiles, Brightness: %d/%d", + L"Attaching the transmitter to your laptop computer.", + L"You cannot afford to hire %s", + L"For a limited time, the above fee covers the cost of the entire mission and includes the equipment listed below.", + L"Hire %s now and take advantage of our unprecedented 'one fee covers all' pricing. Also included in this unbelievable offer is the mercenary's personal equipment at no charge.", + L"Fee", + L"There is someone else in the sector...", + L"Gun Range: %d tiles, Chance to hit: %d percent", + L"Display Cover", + L"Line of Sight", + L"New Recruits cannot arrive there.", + L"Since your laptop has no transmitter, you won't be able to hire new team members. Perhaps this would be a good time to load a saved game or start over!", + L"%s hears the sound of crumpling metal coming from underneath Jerry's body. It sounds disturbingly like your laptop antenna being crushed.", //the %s is the name of a merc. @@@ Modified + L"After scanning the note left behind by Deputy Commander Morris, %s senses an oppurtinity. The note contains the coordinates for launching missiles against different towns in Arulco. It also gives the coodinates of the origin - the missile facility.", + L"Noticing the control panel, %s figures the numbers can be reveresed, so that the missile might destroy this very facility. %s needs to find an escape route. The elevator appears to offer the fastest solution...", + L"This is an IRON MAN game and you cannot save when enemies are around.", // @@@ new text + L"(Cannot save during combat)", //@@@@ new text + L"The current campaign name is greater than 30 characters.", // @@@ new text + L"The current campaign cannot be found.", // @@@ new text + L"Campaign: Default ( %S )", // @@@ new text + L"Campaign: %S", // @@@ new text + L"You have selected the campaign %S. This campaign is a player-modified version of the original Unfinished Business campaign. Are you sure you wish to play the %S campaign?", // @@@ new text + L"In order to use the editor, please select a campaign other than the default.", ///@@new +}; + +//these strings match up with the defines in IMP Skill trait.cpp +STR16 gzIMPSkillTraitsText[]= +{ + L"Lock picking", + L"Hand to hand combat", + L"Electronics", + L"Night operations", + L"Throwing", + L"Teaching", + L"Heavy Weapons", + L"Auto Weapons", + L"Stealth", + L"Ambidextrous", + L"Knifing", + L"Sniper", + L"Camouflage", + L"Martial Arts", + + L"None", + L"I.M.P. Specialties", +}; +//@@@: New string as of March 3, 2000. +STR16 gzIronManModeWarningText[]= +{ + L"You have chosen IRON MAN mode. This setting makes the game considerably more challenging as you will not be able to save your game when in a sector occupied by enemies. This setting will affect the entire course of the game. Are you sure want to play in IRON MAN mode?", +}; + + +#endif diff --git a/Utils/_Ja25FrenchText.h b/Utils/_Ja25FrenchText.h new file mode 100644 index 00000000..3df69617 --- /dev/null +++ b/Utils/_Ja25FrenchText.h @@ -0,0 +1,43 @@ +#ifndef _JA25ENGLISHTEXT__H_ +#define _JA25ENGLISHTEXT__H_ + + +enum +{ + TCTL_MSG__RANGE_TO_TARGET, + TCTL_MSG__ATTACH_TRANSMITTER_TO_LAPTOP, + TACT_MSG__CANNOT_AFFORD_MERC, + TACT_MSG__AIMMEMBER_FEE_TEXT, + TACT_MSG__AIMMEMBER_ONE_TIME_FEE, + TACT_MSG__FEE, + TACT_MSG__SOMEONE_ELSE_IN_SECTOR, + TCTL_MSG__GUN_RANGE_AND_CTH, + TCTL_MSG__DISPLAY_COVER, + TCTL_MSG__LOS, + TCTL_MSG__INVALID_DROPOFF_SECTOR, + TCTL_MSG__PLAYER_LOST_SHOULD_RESTART, + TCTL_MSG__JERRY_BREAKIN_LAPTOP_ANTENA, + TCTL_MSG__END_GAME_POPUP_TXT_1, + TCTL_MSG__END_GAME_POPUP_TXT_2, + TCTL_MSG__IRON_MAN_CANT_SAVE_NOW, + TCTL_MSG__CANNOT_SAVE_DURING_COMBAT, + TCTL_MSG__CAMPAIGN_NAME_TOO_LARGE, + TCTL_MSG__CAMPAIGN_DOESN_T_EXIST, + TCTL_MSG__DEFAULT_CAMPAIGN_LABEL, + TCTL_MSG__CAMPAIGN_LABEL, + TCTL_MSG__NEW_CAMPAIGN_CONFIRM, + TCTL_MSG__CANT_EDIT_DEFAULT, + +}; +extern STR16 zNewTacticalMessages[]; +extern STR16 gzIMPSkillTraitsText[]; + +enum +{ + IMM__IRON_MAN_MODE_WARNING_TEXT, +}; +extern STR16 gzIronManModeWarningText[]; + +#endif + + diff --git a/Utils/_Ja25GermanText.cpp b/Utils/_Ja25GermanText.cpp index 1ba8a4b6..f10573da 100644 --- a/Utils/_Ja25GermanText.cpp +++ b/Utils/_Ja25GermanText.cpp @@ -1,6 +1,6 @@ #ifdef PRECOMPILEDHEADERS #include "Utils All.h" - #include "_Ja25EnglishText.h" + #include "_Ja25GermanText.h" #else #include "Language Defines.h" #include "text.h" diff --git a/Utils/_Ja25GermanText.h b/Utils/_Ja25GermanText.h index 37c5daa1..3daff5ab 100644 --- a/Utils/_Ja25GermanText.h +++ b/Utils/_Ja25GermanText.h @@ -31,6 +31,7 @@ enum }; extern STR16 zNewTacticalMessages[]; +extern STR16 gzIMPSkillTraitsText[]; enum { diff --git a/Utils/_Ja25ItalianText.cpp b/Utils/_Ja25ItalianText.cpp new file mode 100644 index 00000000..cbc0dd30 --- /dev/null +++ b/Utils/_Ja25ItalianText.cpp @@ -0,0 +1,71 @@ +#ifdef PRECOMPILEDHEADERS + #include "Utils All.h" + #include "_Ja25Italiantext.h" +#else + #include "Language Defines.h" + #ifdef ITALIAN + #include "text.h" + #include "Fileman.h" + #endif +#endif + +#ifdef ITALIAN + +// VERY TRUNCATED FILE COPIED FROM JA2.5 FOR ITS FEATURES FOR JA2 GOLD + +STR16 zNewTacticalMessages[]= +{ + L"Range to target: %d tiles, Brightness: %d/%d", + L"Attaching the transmitter to your laptop computer.", + L"You cannot afford to hire %s", + L"For a limited time, the above fee covers the cost of the entire mission and includes the equipment listed below.", + L"Hire %s now and take advantage of our unprecedented 'one fee covers all' pricing. Also included in this unbelievable offer is the mercenary's personal equipment at no charge.", + L"Fee", + L"There is someone else in the sector...", + L"Gun Range: %d tiles, Chance to hit: %d percent", + L"Display Cover", + L"Line of Sight", + L"New Recruits cannot arrive there.", + L"Since your laptop has no transmitter, you won't be able to hire new team members. Perhaps this would be a good time to load a saved game or start over!", + L"%s hears the sound of crumpling metal coming from underneath Jerry's body. It sounds disturbingly like your laptop antenna being crushed.", //the %s is the name of a merc. @@@ Modified + L"After scanning the note left behind by Deputy Commander Morris, %s senses an oppurtinity. The note contains the coordinates for launching missiles against different towns in Arulco. It also gives the coodinates of the origin - the missile facility.", + L"Noticing the control panel, %s figures the numbers can be reveresed, so that the missile might destroy this very facility. %s needs to find an escape route. The elevator appears to offer the fastest solution...", + L"This is an IRON MAN game and you cannot save when enemies are around.", // @@@ new text + L"(Cannot save during combat)", //@@@@ new text + L"The current campaign name is greater than 30 characters.", // @@@ new text + L"The current campaign cannot be found.", // @@@ new text + L"Campaign: Default ( %S )", // @@@ new text + L"Campaign: %S", // @@@ new text + L"You have selected the campaign %S. This campaign is a player-modified version of the original Unfinished Business campaign. Are you sure you wish to play the %S campaign?", // @@@ new text + L"In order to use the editor, please select a campaign other than the default.", ///@@new +}; + +//these strings match up with the defines in IMP Skill trait.cpp +STR16 gzIMPSkillTraitsText[]= +{ + L"Lock picking", + L"Hand to hand combat", + L"Electronics", + L"Night operations", + L"Throwing", + L"Teaching", + L"Heavy Weapons", + L"Auto Weapons", + L"Stealth", + L"Ambidextrous", + L"Knifing", + L"Sniper", + L"Camouflage", + L"Martial Arts", + + L"None", + L"I.M.P. Specialties", +}; +//@@@: New string as of March 3, 2000. +STR16 gzIronManModeWarningText[]= +{ + L"You have chosen IRON MAN mode. This setting makes the game considerably more challenging as you will not be able to save your game when in a sector occupied by enemies. This setting will affect the entire course of the game. Are you sure want to play in IRON MAN mode?", +}; + + +#endif diff --git a/Utils/_Ja25ItalianText.h b/Utils/_Ja25ItalianText.h new file mode 100644 index 00000000..3df69617 --- /dev/null +++ b/Utils/_Ja25ItalianText.h @@ -0,0 +1,43 @@ +#ifndef _JA25ENGLISHTEXT__H_ +#define _JA25ENGLISHTEXT__H_ + + +enum +{ + TCTL_MSG__RANGE_TO_TARGET, + TCTL_MSG__ATTACH_TRANSMITTER_TO_LAPTOP, + TACT_MSG__CANNOT_AFFORD_MERC, + TACT_MSG__AIMMEMBER_FEE_TEXT, + TACT_MSG__AIMMEMBER_ONE_TIME_FEE, + TACT_MSG__FEE, + TACT_MSG__SOMEONE_ELSE_IN_SECTOR, + TCTL_MSG__GUN_RANGE_AND_CTH, + TCTL_MSG__DISPLAY_COVER, + TCTL_MSG__LOS, + TCTL_MSG__INVALID_DROPOFF_SECTOR, + TCTL_MSG__PLAYER_LOST_SHOULD_RESTART, + TCTL_MSG__JERRY_BREAKIN_LAPTOP_ANTENA, + TCTL_MSG__END_GAME_POPUP_TXT_1, + TCTL_MSG__END_GAME_POPUP_TXT_2, + TCTL_MSG__IRON_MAN_CANT_SAVE_NOW, + TCTL_MSG__CANNOT_SAVE_DURING_COMBAT, + TCTL_MSG__CAMPAIGN_NAME_TOO_LARGE, + TCTL_MSG__CAMPAIGN_DOESN_T_EXIST, + TCTL_MSG__DEFAULT_CAMPAIGN_LABEL, + TCTL_MSG__CAMPAIGN_LABEL, + TCTL_MSG__NEW_CAMPAIGN_CONFIRM, + TCTL_MSG__CANT_EDIT_DEFAULT, + +}; +extern STR16 zNewTacticalMessages[]; +extern STR16 gzIMPSkillTraitsText[]; + +enum +{ + IMM__IRON_MAN_MODE_WARNING_TEXT, +}; +extern STR16 gzIronManModeWarningText[]; + +#endif + + diff --git a/Utils/_Ja25PolishText.cpp b/Utils/_Ja25PolishText.cpp new file mode 100644 index 00000000..8b7bf82b --- /dev/null +++ b/Utils/_Ja25PolishText.cpp @@ -0,0 +1,71 @@ +#ifdef PRECOMPILEDHEADERS + #include "Utils All.h" + #include "_Ja25Polishtext.h" +#else + #include "Language Defines.h" + #ifdef POLISH + #include "text.h" + #include "Fileman.h" + #endif +#endif + +#ifdef POLISH + +// VERY TRUNCATED FILE COPIED FROM JA2.5 FOR ITS FEATURES FOR JA2 GOLD + +STR16 zNewTacticalMessages[]= +{ + L"Range to target: %d tiles, Brightness: %d/%d", + L"Attaching the transmitter to your laptop computer.", + L"You cannot afford to hire %s", + L"For a limited time, the above fee covers the cost of the entire mission and includes the equipment listed below.", + L"Hire %s now and take advantage of our unprecedented 'one fee covers all' pricing. Also included in this unbelievable offer is the mercenary's personal equipment at no charge.", + L"Fee", + L"There is someone else in the sector...", + L"Gun Range: %d tiles, Chance to hit: %d percent", + L"Display Cover", + L"Line of Sight", + L"New Recruits cannot arrive there.", + L"Since your laptop has no transmitter, you won't be able to hire new team members. Perhaps this would be a good time to load a saved game or start over!", + L"%s hears the sound of crumpling metal coming from underneath Jerry's body. It sounds disturbingly like your laptop antenna being crushed.", //the %s is the name of a merc. @@@ Modified + L"After scanning the note left behind by Deputy Commander Morris, %s senses an oppurtinity. The note contains the coordinates for launching missiles against different towns in Arulco. It also gives the coodinates of the origin - the missile facility.", + L"Noticing the control panel, %s figures the numbers can be reveresed, so that the missile might destroy this very facility. %s needs to find an escape route. The elevator appears to offer the fastest solution...", + L"This is an IRON MAN game and you cannot save when enemies are around.", // @@@ new text + L"(Cannot save during combat)", //@@@@ new text + L"The current campaign name is greater than 30 characters.", // @@@ new text + L"The current campaign cannot be found.", // @@@ new text + L"Campaign: Default ( %S )", // @@@ new text + L"Campaign: %S", // @@@ new text + L"You have selected the campaign %S. This campaign is a player-modified version of the original Unfinished Business campaign. Are you sure you wish to play the %S campaign?", // @@@ new text + L"In order to use the editor, please select a campaign other than the default.", ///@@new +}; + +//these strings match up with the defines in IMP Skill trait.cpp +STR16 gzIMPSkillTraitsText[]= +{ + L"Lock picking", + L"Hand to hand combat", + L"Electronics", + L"Night operations", + L"Throwing", + L"Teaching", + L"Heavy Weapons", + L"Auto Weapons", + L"Stealth", + L"Ambidextrous", + L"Knifing", + L"Sniper", + L"Camouflage", + L"Martial Arts", + + L"None", + L"I.M.P. Specialties", +}; +//@@@: New string as of March 3, 2000. +STR16 gzIronManModeWarningText[]= +{ + L"You have chosen IRON MAN mode. This setting makes the game considerably more challenging as you will not be able to save your game when in a sector occupied by enemies. This setting will affect the entire course of the game. Are you sure want to play in IRON MAN mode?", +}; + + +#endif diff --git a/Utils/_Ja25PolishText.h b/Utils/_Ja25PolishText.h new file mode 100644 index 00000000..3df69617 --- /dev/null +++ b/Utils/_Ja25PolishText.h @@ -0,0 +1,43 @@ +#ifndef _JA25ENGLISHTEXT__H_ +#define _JA25ENGLISHTEXT__H_ + + +enum +{ + TCTL_MSG__RANGE_TO_TARGET, + TCTL_MSG__ATTACH_TRANSMITTER_TO_LAPTOP, + TACT_MSG__CANNOT_AFFORD_MERC, + TACT_MSG__AIMMEMBER_FEE_TEXT, + TACT_MSG__AIMMEMBER_ONE_TIME_FEE, + TACT_MSG__FEE, + TACT_MSG__SOMEONE_ELSE_IN_SECTOR, + TCTL_MSG__GUN_RANGE_AND_CTH, + TCTL_MSG__DISPLAY_COVER, + TCTL_MSG__LOS, + TCTL_MSG__INVALID_DROPOFF_SECTOR, + TCTL_MSG__PLAYER_LOST_SHOULD_RESTART, + TCTL_MSG__JERRY_BREAKIN_LAPTOP_ANTENA, + TCTL_MSG__END_GAME_POPUP_TXT_1, + TCTL_MSG__END_GAME_POPUP_TXT_2, + TCTL_MSG__IRON_MAN_CANT_SAVE_NOW, + TCTL_MSG__CANNOT_SAVE_DURING_COMBAT, + TCTL_MSG__CAMPAIGN_NAME_TOO_LARGE, + TCTL_MSG__CAMPAIGN_DOESN_T_EXIST, + TCTL_MSG__DEFAULT_CAMPAIGN_LABEL, + TCTL_MSG__CAMPAIGN_LABEL, + TCTL_MSG__NEW_CAMPAIGN_CONFIRM, + TCTL_MSG__CANT_EDIT_DEFAULT, + +}; +extern STR16 zNewTacticalMessages[]; +extern STR16 gzIMPSkillTraitsText[]; + +enum +{ + IMM__IRON_MAN_MODE_WARNING_TEXT, +}; +extern STR16 gzIronManModeWarningText[]; + +#endif + + diff --git a/Utils/_Ja25TaiwaneseText.cpp b/Utils/_Ja25TaiwaneseText.cpp new file mode 100644 index 00000000..b06e97b6 --- /dev/null +++ b/Utils/_Ja25TaiwaneseText.cpp @@ -0,0 +1,71 @@ +#ifdef PRECOMPILEDHEADERS + #include "Utils All.h" + #include "_Ja25Taiwanesetext.h" +#else + #include "Language Defines.h" + #ifdef TAIWANESE + #include "text.h" + #include "Fileman.h" + #endif +#endif + +#ifdef TAIWANESE + +// VERY TRUNCATED FILE COPIED FROM JA2.5 FOR ITS FEATURES FOR JA2 GOLD + +STR16 zNewTacticalMessages[]= +{ + L"Range to target: %d tiles, Brightness: %d/%d", + L"Attaching the transmitter to your laptop computer.", + L"You cannot afford to hire %s", + L"For a limited time, the above fee covers the cost of the entire mission and includes the equipment listed below.", + L"Hire %s now and take advantage of our unprecedented 'one fee covers all' pricing. Also included in this unbelievable offer is the mercenary's personal equipment at no charge.", + L"Fee", + L"There is someone else in the sector...", + L"Gun Range: %d tiles, Chance to hit: %d percent", + L"Display Cover", + L"Line of Sight", + L"New Recruits cannot arrive there.", + L"Since your laptop has no transmitter, you won't be able to hire new team members. Perhaps this would be a good time to load a saved game or start over!", + L"%s hears the sound of crumpling metal coming from underneath Jerry's body. It sounds disturbingly like your laptop antenna being crushed.", //the %s is the name of a merc. @@@ Modified + L"After scanning the note left behind by Deputy Commander Morris, %s senses an oppurtinity. The note contains the coordinates for launching missiles against different towns in Arulco. It also gives the coodinates of the origin - the missile facility.", + L"Noticing the control panel, %s figures the numbers can be reveresed, so that the missile might destroy this very facility. %s needs to find an escape route. The elevator appears to offer the fastest solution...", + L"This is an IRON MAN game and you cannot save when enemies are around.", // @@@ new text + L"(Cannot save during combat)", //@@@@ new text + L"The current campaign name is greater than 30 characters.", // @@@ new text + L"The current campaign cannot be found.", // @@@ new text + L"Campaign: Default ( %S )", // @@@ new text + L"Campaign: %S", // @@@ new text + L"You have selected the campaign %S. This campaign is a player-modified version of the original Unfinished Business campaign. Are you sure you wish to play the %S campaign?", // @@@ new text + L"In order to use the editor, please select a campaign other than the default.", ///@@new +}; + +//these strings match up with the defines in IMP Skill trait.cpp +STR16 gzIMPSkillTraitsText[]= +{ + L"Lock picking", + L"Hand to hand combat", + L"Electronics", + L"Night operations", + L"Throwing", + L"Teaching", + L"Heavy Weapons", + L"Auto Weapons", + L"Stealth", + L"Ambidextrous", + L"Knifing", + L"Sniper", + L"Camouflage", + L"Martial Arts", + + L"None", + L"I.M.P. Specialties", +}; +//@@@: New string as of March 3, 2000. +STR16 gzIronManModeWarningText[]= +{ + L"You have chosen IRON MAN mode. This setting makes the game considerably more challenging as you will not be able to save your game when in a sector occupied by enemies. This setting will affect the entire course of the game. Are you sure want to play in IRON MAN mode?", +}; + + +#endif diff --git a/Utils/_Ja25TaiwaneseText.h b/Utils/_Ja25TaiwaneseText.h new file mode 100644 index 00000000..3df69617 --- /dev/null +++ b/Utils/_Ja25TaiwaneseText.h @@ -0,0 +1,43 @@ +#ifndef _JA25ENGLISHTEXT__H_ +#define _JA25ENGLISHTEXT__H_ + + +enum +{ + TCTL_MSG__RANGE_TO_TARGET, + TCTL_MSG__ATTACH_TRANSMITTER_TO_LAPTOP, + TACT_MSG__CANNOT_AFFORD_MERC, + TACT_MSG__AIMMEMBER_FEE_TEXT, + TACT_MSG__AIMMEMBER_ONE_TIME_FEE, + TACT_MSG__FEE, + TACT_MSG__SOMEONE_ELSE_IN_SECTOR, + TCTL_MSG__GUN_RANGE_AND_CTH, + TCTL_MSG__DISPLAY_COVER, + TCTL_MSG__LOS, + TCTL_MSG__INVALID_DROPOFF_SECTOR, + TCTL_MSG__PLAYER_LOST_SHOULD_RESTART, + TCTL_MSG__JERRY_BREAKIN_LAPTOP_ANTENA, + TCTL_MSG__END_GAME_POPUP_TXT_1, + TCTL_MSG__END_GAME_POPUP_TXT_2, + TCTL_MSG__IRON_MAN_CANT_SAVE_NOW, + TCTL_MSG__CANNOT_SAVE_DURING_COMBAT, + TCTL_MSG__CAMPAIGN_NAME_TOO_LARGE, + TCTL_MSG__CAMPAIGN_DOESN_T_EXIST, + TCTL_MSG__DEFAULT_CAMPAIGN_LABEL, + TCTL_MSG__CAMPAIGN_LABEL, + TCTL_MSG__NEW_CAMPAIGN_CONFIRM, + TCTL_MSG__CANT_EDIT_DEFAULT, + +}; +extern STR16 zNewTacticalMessages[]; +extern STR16 gzIMPSkillTraitsText[]; + +enum +{ + IMM__IRON_MAN_MODE_WARNING_TEXT, +}; +extern STR16 gzIronManModeWarningText[]; + +#endif + + diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 0c1c43b5..9abfbeff 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -751,7 +751,7 @@ STR16 gzMercSkillText[] = L"Kradzie¿e", L"Sztuki walki", L"Broñ bia³a", - L"Snajper", + L"Sniper", L"Kamufla¿", L"Kamufla¿ (Urban)", L"Kamufla¿ (Desert)", @@ -1065,7 +1065,7 @@ STR16 sKeyDescriptionStrings[2] = //The headers used to describe various weapon statistics. -INT16 gWeaponStatsDesc[][ 14 ] = +CHAR16 gWeaponStatsDesc[][ 14 ] = { L"Waga (%s):", // change kg to another weight unit if your standard is not kilograms, and TELL SIR-TECH! L"Stan:", @@ -1086,7 +1086,7 @@ INT16 gWeaponStatsDesc[][ 14 ] = //The headers used for the merc's money. -INT16 gMoneyStatsDesc[][ 13 ] = +CHAR16 gMoneyStatsDesc[][ 13 ] = { L"Kwota", L"Pozosta³o:", //this is the overall balance @@ -1124,12 +1124,12 @@ STR16 gzMoneyAmounts[6] = }; // short words meaning "Advantages" for "Pros" and "Disadvantages" for "Cons." -INT16 gzProsLabel[10] = +CHAR16 gzProsLabel[10] = { L"Zalety:", }; -INT16 gzConsLabel[10] = +CHAR16 gzConsLabel[10] = { L"Wady:", }; @@ -1392,6 +1392,7 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = L"Stan: %d/%d\nPaliwo: %d/%d", L"%s nie widzi - %s.", // Cannot see person trying to talk to L"Attachment removed", + L"Can not gain another vehicle as you already have 2", }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. @@ -1602,6 +1603,7 @@ STR16 pMapInventoryErrorString[] = L"Podczas walki nie mo¿na korzystaæ z tego panelu.", L"Podczas walki nie mo¿na korzystaæ z tego panelu.", L"%s nie mo¿e tu zostawiæ tego przedmiotu, gdy¿ nie jest w tym sektorze.", + L"During combat, you can't reload with an ammo crate.", }; STR16 pMapInventoryStrings[] = @@ -2825,6 +2827,7 @@ STR16 BobbyRFilter[] = // Used L"Guns", L"Armor", + L"LBE Gear", L"Misc", // Armour @@ -2842,6 +2845,7 @@ STR16 BobbyRFilter[] = L"Med. Kits", L"Kits", L"Face Items", + L"LBE Gear", L"Misc.", }; @@ -3366,6 +3370,7 @@ STR16 zSaveLoadText[] = L"Excellent Selection", L"Awesome Selection", + L"New Inventory does not work in 640x480 screen size. Please resize and try again.", }; @@ -3584,6 +3589,9 @@ STR16 gzGIOScreenText[] = L"Great", L"Excellent", L"Awesome", + L"Inventory System", + L"Old", + L"New", }; STR16 pDeliveryLocationStrings[] = @@ -3976,6 +3984,8 @@ STR16 sRepairsDoneString[] = L"%s skoñczy³(a) naprawiaæ broñ i ochraniacze wszystkich cz³onków oddzia³u", L"%s skoñczy³(a) naprawiaæ wyposa¿enie wszystkich cz³onków oddzia³u", L"%s skoñczy³(a) naprawiaæ ekwipunek wszystkich cz³onków oddzia³u", + L"%s skoñczy³(a) naprawiaæ ekwipunek wszystkich cz³onków oddzia³u", + L"%s skoñczy³(a) naprawiaæ ekwipunek wszystkich cz³onków oddzia³u", }; @@ -4133,6 +4143,11 @@ STR16 gzLateLocalizedString[] = L"%s fires %d more round than intended!", }; +STR16 gzCWStrings[] = +{ + L"Call reinforcements from adjacent sectors?", +}; + // WANNE: Tooltips STR16 gzTooltipStrings[] = { @@ -4214,10 +4229,19 @@ STR16 New113MERCMercMailTexts[] = // INFO: Do not replace the ± characters. They indicate the (-> Newline) from the edt files STR16 MissingIMPSkillsDescriptions[] = { - // Rooftop sniping - L"Rooftop Sniping: Not even ants are on the save side. Each target is mercilessly tracked down! ± ", + // Sniper + L"Sniper: Eyes of a hawk, you can shoot the wings from a fly at a hundred yards! ± ", // Camouflage L"Camouflage: Besides you even bushes look synthetic! ± ", }; +STR16 NewInvMessage[] = +{ + L"Cannot pickup backpack at this time", + L"No place to put backpack", + L"Backpack not found", + L"Zipper only works in combat", + L"Can not move while backpack zipper active", +}; + #endif //POLISH diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index c0aec98a..c89feaa2 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -763,7 +763,7 @@ STR16 gzMercSkillText[] = L"Âîðîâñòâî", L"Áîåâûå èñêóññòâà", L"Õîëîäíîå îðóæèå", - L"Ñòðåëüáà ñ êðûø", + L"Ñíàéïåð", L"Êàìóôëÿæ", L"Êàìóôëÿæ (Ãîðîä)", L"Êàìóôëÿæ (Ïóñòûíÿ)", @@ -1404,6 +1404,7 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = L"Ñîñòîÿíèå: %d/%d\nÒîïëèâî: %d/%d", L"%s íå âèäèò %s.", // Cannot see person trying to talk to L"Ïðèíàäëåæíîñòü îòñîåäèíåíà", //ïð + L"Âû íå ìîæåòå ñîäåðæàòü åùå îäíó ìàøèíó, äîâîëüñòâóéòåñü óæå èìåþùèìèñÿ äâóìÿ.", }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. @@ -1614,6 +1615,7 @@ STR16 pMapInventoryErrorString[] = L"Âî âðåìÿ áîÿ âàì ïðèäåòñÿ ïîäáèðàòü âåùè âðó÷íóþ.", //*ïåðåôðàçèðîâàòü, ïîêàçûâàåòñÿ êîãäà ïûòàåøüñÿ ñî ñòðàòåãè÷ êàðòû â èíâåíòàðå ñåêòîðà âçÿòü ïðåäìåò L"Âî âðåìÿ áîÿ âàì ïðèäåòñÿ âûêëàäûâàòü âåùè âðó÷íóþ.", L"%s âíå ýòîãî ñåêòîðà, è íå ìîæåò îñòàâèòü ïðåäìåò.", + L"Âî âðåìÿ áèòâû âû íå ìîæåòå çàðÿæàòü îðóæèå ïàòðîíàìè èç êîðîáà.", }; STR16 pMapInventoryStrings[] = @@ -2417,7 +2419,7 @@ STR16 pWebPagesTitles[] = STR16 pShowBookmarkString[] = { L"Ïîäñêàçêà", - L"Ùåëêíèòå åùå ðàç ïî êíîïêå \"Ñàéòû\" äëÿ îòîáðàæåíèÿ ìåíþ ñàéòîâ.", + L"Ùåëêíèòå åùå ðàç ïî êíîïêå \"Ñàéòû\" äëÿ îòîáðàæåíèÿ ìåíþ ñàéòîâ.", }; STR16 pLaptopTitles[] = @@ -2839,6 +2841,7 @@ STR16 BobbyRFilter[] = // Used L"Îðóæèå", L"Áðîíÿ", + L"Ðàçãð.ñ-ìû", L"Ðàçíîå", // Armour @@ -2856,6 +2859,7 @@ STR16 BobbyRFilter[] = L"Àïòå÷êè", L"Íàáîðû", L"Ãîëîâíûå", + L"Ðàçãð.ñ-ìû", L"Ðàçíîå", }; @@ -3379,6 +3383,8 @@ STR16 zSaveLoadText[] = L"Áîëüøîé", L"Îãðîìíûé", L"Âñå, âêëþ÷àÿ ýêñêëþçèâ", + + L"Íîâûé èíâåíòàðü, èñïîëüçóåìûé â ýòîì ðåëèçå, íå ðàáîòàåò ïðè ðàçðåøåíèè ýêðàíà 640õ480. Èçìåíèòå ðàçðåøåíèå è çàïóñòèò èãðó çàíîâî.", }; @@ -3598,6 +3604,9 @@ STR16 gzGIOScreenText[] = L"Áîëüøîé", L"Îãðîìíûé", L"Âñå, âêëþ÷àÿ ýêñêëþçèâ", + L"Ðåæèì èíâåíòàðÿ", + L"Êëàññè÷åñêèé", + L"Íîâûé âàðèàíò", }; STR16 pDeliveryLocationStrings[] = @@ -3990,6 +3999,8 @@ STR16 sRepairsDoneString[] = L"%s: çàâåðøåí ðåìîíò âñåãî îðóæèÿ è áðîíè.", L"%s: çàâåðøåí ðåìîíò âñåé ýêèïèðîâêè îòðÿäà.", L"%s: çàâåðøåí ðåìîíò âñåõ âåùåé, èìåþùèõñÿ ó îòðÿäà.", + L"%s: çàâåðøåí ðåìîíò âñåõ âåùåé, èìåþùèõñÿ ó îòðÿäà.", + L"%s: çàâåðøåí ðåìîíò âñåõ âåùåé, èìåþùèõñÿ ó îòðÿäà.", }; STR16 zGioDifConfirmText[]= @@ -4231,10 +4242,19 @@ STR16 New113MERCMercMailTexts[] = // INFO: Do not replace the ± characters. They indicate the (-> Newline) from the edt files STR16 MissingIMPSkillsDescriptions[] = { - // Rooftop sniping - L"Ñòðåëüáà ñ êðûø: Äàæå ìóðàâüè â îïàñíîñòè. Êàäæàÿ öåëü áåçæàëîñòíî îòñëåæèâàåòñÿ! ± ", + // Sniper + L"Ñíàéïåð: Ó âàñ ãëàçà ÿñòðåáà.  ñâîáîäíîå âðåìÿ âû ðàçâëåêàåòåñü îòñòðåëèâàÿ êðûëûøêè ó ìóõ ñ ðàññòîÿíèÿ 100 ìåòðîâ! ± ", // Camouflage L"Ìàñêèðîâêà: Íà âàøåì ôîíå êóñòû âûãëÿäÿò ñèíòåòè÷åñêèìè! ± ", }; +STR16 NewInvMessage[] = +{ + L" äàííûé ìîìåíò ïîäíÿòü ðþêçàê íåëüçÿ.", + L"Âû íå ìîæåòå îäíîâðåìåííî íîñèòü 2 ðþêçàêà.", + L"Âû ïîòåðÿëè ñâîé ðþêçàê...", + L"Çàìîê ðþêçàêà ðàáîòàåò ëèøü âî âðåìÿ áèòâû.", + L"Âû íå ìîæåòå ïåðåäâèãàòüñÿ ñ îòêðûòûì ðþêçàêîì.", +}; + #endif //RUSSIAN diff --git a/Utils/_TaiwaneseText.cpp b/Utils/_TaiwaneseText.cpp index 9234489c..a8a4de34 100644 --- a/Utils/_TaiwaneseText.cpp +++ b/Utils/_TaiwaneseText.cpp @@ -11,7 +11,7 @@ #ifdef TAIWANESE /* - + ****************************************************************************************************** ** IMPORTANT TRANSLATION NOTES ** ****************************************************************************************************** @@ -106,13 +106,24 @@ FAST HELP TEXT -- Explains how the syntax of fast help text works. */ -UINT16 ItemNames[MAXITEMS][80] = +STR16 pCreditsJA2113[] = +{ + L"@T,{;JA2 v1.13 Development Team", + L"@T,C144,R134,{;Coding", + L"@T,C144,R134,{;Graphics and Sounds", + L"@};(Various other mods!)", + L"@T,C144,R134,{;Items", + L"@T,C144,R134,{;Other Contributors", + L"@};(All other community members who contributed input and feedback!)", +}; + +CHAR16 ItemNames[MAXITEMS][80] = { L"", }; -UINT16 ShortItemNames[MAXITEMS][80] = +CHAR16 ShortItemNames[MAXITEMS][80] = { L"", }; @@ -122,26 +133,28 @@ UINT16 ShortItemNames[MAXITEMS][80] = // NATO is the North Atlantic Treaty Organization // WP is Warsaw Pact // cal is an abbreviation for calibre -UINT16 AmmoCaliber[][20] = -{ - L"0", - L".38 cal", - L"9mm", - L".45 cal", - L".357 cal", - L"12 gauge", - L"CAWS", - L"5.45mm", - L"5.56mm", - L"7.62mm NATO", - L"7.62mm WP", - L"4.7mm", - L"5.7mm", - L"Monster", - L"Rocket", - L"", // dart - L"", // flame -}; +CHAR16 AmmoCaliber[MAXITEMS][20];// = +//{ +// L"0", +// L".38 cal", +// L"9mm", +// L".45 cal", +// L".357 cal", +// L"12 gauge", +// L"CAWS", +// L"5.45mm", +// L"5.56mm", +// L"7.62mm NATO", +// L"7.62mm WP", +// L"4.7mm", +// L"5.7mm", +// L"Monster", +// L"Rocket", +// L"", // dart +// L"", // flame +// L".50 cal", // barrett +// L"9mm Hvy", // Val silent +//}; // This BobbyRayAmmoCaliber is virtually the same as AmmoCaliber however the bobby version doesnt have as much room for the words. // @@ -150,41 +163,44 @@ UINT16 AmmoCaliber[][20] = // NATO is the North Atlantic Treaty Organization // WP is Warsaw Pact // cal is an abbreviation for calibre -UINT16 BobbyRayAmmoCaliber[][20] = -{ - L"0", - L".38 cal", - L"9mm", - L".45 cal", - L".357 cal", - L"12 gauge", - L"CAWS", - L"5.45mm", - L"5.56mm", - L"7.62mm N.", - L"7.62mm WP", - L"4.7mm", - L"5.7mm", - L"Monster", - L"Rocket", - L"", // dart -}; +CHAR16 BobbyRayAmmoCaliber[MAXITEMS][20] ;//= +//{ +// L"0", +// L".38 cal", +// L"9mm", +// L".45 cal", +// L".357 cal", +// L"12 gauge", +// L"CAWS", +// L"5.45mm", +// L"5.56mm", +// L"7.62mm N.", +// L"7.62mm WP", +// L"4.7mm", +// L"5.7mm", +// L"Monster", +// L"Rocket", +// L"dart", // dart +// L"", // flamethrower +// L".50 cal", // barrett +// L"9mm Hvy", // Val silent +//}; -UINT16 WeaponType[][30] = +CHAR16 WeaponType[MAXITEMS][30] = { L"Other", L"Pistol", - L"Machine pistol", - L"Submachine gun", + L"MP", + L"SMG", L"Rifle", L"Sniper rifle", L"Assault rifle", - L"Light machine gun", + L"LMG", L"Shotgun", }; -UINT16 TeamTurnString[][STRING_LENGTH] = +CHAR16 TeamTurnString[][STRING_LENGTH] = { L"Player's Turn", // player's turn L"Opponents' Turn", @@ -194,7 +210,7 @@ UINT16 TeamTurnString[][STRING_LENGTH] = // planning turn }; -UINT16 Message[][STRING_LENGTH] = +CHAR16 Message[][STRING_LENGTH] = { L"", @@ -269,7 +285,7 @@ UINT16 Message[][STRING_LENGTH] = //You cannot use "item(s)" and your "other item" at the same time. //Ex: You cannot use sun goggles and you gas mask at the same time. - L"You cannot use %s and your %s at the same time.", + L"You cannot use your %s and your %s at the same time.", L"The item you have in your cursor can be attached to certain items by placing it in one of the four attachment slots.", L"The item you have in your cursor can be attached to certain items by placing it in one of the four attachment slots. (However in this case, the item is not compatible.)", @@ -280,7 +296,7 @@ UINT16 Message[][STRING_LENGTH] = L"This attachment will be permanent. Go ahead with it?", L"%s feels more energetic!", L"%s slipped on some marbles!", - L"%s failed to grab the %s!", + L"%s failed to grab the %s from enemy's hand!", L"%s has repaired the %s", L"Interrupt for ", L"Surrender?", @@ -289,12 +305,19 @@ UINT16 Message[][STRING_LENGTH] = L"To travel in Skyrider's chopper, you'll have to ASSIGN mercs to VEHICLE/HELICOPTER first.", L"%s only had enough time to reload ONE gun", L"Bloodcats' turn", + L"full auto", + L"no full auto", + L"accurate", + L"inaccurate", + L"no semi auto", + L"The enemy has no more items to steal!", + L"The enemy has no item in its hand!", }; // the names of the towns in the game -STR16 pTownNames[] = +CHAR16 pTownNames[MAX_TOWNS][MAX_TOWN_NAME_LENGHT] = { L"", L"Omerta", @@ -527,6 +550,8 @@ STR16 pInvPanelTitleStrings[] = L"Armor", // the armor rating of the merc L"Weight", // the weight the merc is carrying L"Camo", // the merc's camouflage rating + L"Camouflage:", + L"Protection:", }; STR16 pShortAttributeStrings[] = @@ -603,6 +628,36 @@ STR16 pAssignMenuStrings[] = L"Cancel", // cancel this menu }; +//lal +STR16 pMilitiaControlMenuStrings[] = +{ + L"Attack", // set militia to aggresive + L"Hold Position", // set militia to stationary + L"Retreat", // retreat militia + L"Come to me", // retreat militia + L"Get down", // retreat militia + L"Take cover", + L"All: Attack", + L"All: Hold Position", + L"All: Retreat", + L"All: Come to me", + L"All: Spread out", + L"All: Get down", + L"All: Take cover", + //L"All: Find items", + L"Cancel", // cancel this menu +}; + +//STR16 pTalkToAllMenuStrings[] = +//{ +// L"Attack", // set militia to aggresive +// L"Hold Position", // set militia to stationary +// L"Retreat", // retreat militia +// L"Come to me", // retreat militia +// L"Get down", // retreat militia +// L"Cancel", // cancel this menu +//}; + STR16 pRemoveMercStrings[] = { L"Remove Merc", // remove dead merc from current team @@ -698,20 +753,23 @@ STR16 gzMercSkillText[] = { L"No Skill", L"Lock picking", - L"Hand to hand", + L"Hand to hand combat", //JA25: modified L"Electronics", - L"Night ops", + L"Night operations", //JA25: modified L"Throwing", L"Teaching", L"Heavy Weapons", L"Auto Weapons", - L"Stealthy", + L"Stealth", L"Ambidextrous", L"Thief", L"Martial Arts", L"Knifing", - L"On Roof Bonus to hit", - L"Camouflaged", + L"Sniper", + L"Camouflage", //JA25: modified + L"Camouflage (Urban)", + L"Camouflage (Desert)", + L"Camouflage (Snow)", L"(Expert)", }; @@ -1021,22 +1079,30 @@ STR16 sKeyDescriptionStrings[2] = //The headers used to describe various weapon statistics. -INT16 gWeaponStatsDesc[][ 14 ] = +CHAR16 gWeaponStatsDesc[][ 14 ] = { L"Weight (%s):", L"Status:", - L"Amount:", // Number of bullets left in a magazine + L"Amount:", // Number of bullets left in a magazine L"Rng:", // Range L"Dam:", // Damage L"AP:", // abbreviation for Action Points L"", L"=", L"=", + //Lal: additional strings for tooltips + L"Accuracy:", //9 + L"Range:", //10 + L"Damage:", //11 + L"Weight:", //12 + L"Stun Damage:",//13 + + }; //The headers used for the merc's money. -INT16 gMoneyStatsDesc[][ 13 ] = +CHAR16 gMoneyStatsDesc[][ 13 ] = { L"Amount", L"Remaining:", //this is the overall balance @@ -1052,7 +1118,7 @@ INT16 gMoneyStatsDesc[][ 13 ] = //The health of various creatures, enemies, characters in the game. The numbers following each are for comment //only, but represent the precentage of points remaining. -UINT16 zHealthStr[][13] = +CHAR16 zHealthStr[][13] = { L"DYING", // >= 0 L"CRITICAL", // >= 15 @@ -1074,18 +1140,18 @@ STR16 gzMoneyAmounts[6] = }; // short words meaning "Advantages" for "Pros" and "Disadvantages" for "Cons." -INT16 gzProsLabel[10] = +CHAR16 gzProsLabel[10] = { L"Pros:", }; -INT16 gzConsLabel[10] = +CHAR16 gzConsLabel[10] = { L"Cons:", }; //Conversation options a player has when encountering an NPC -UINT16 zTalkMenuStrings[6][ SMALL_STRING_LENGTH ] = +CHAR16 zTalkMenuStrings[6][ SMALL_STRING_LENGTH ] = { L"Come Again?", //meaning "Repeat yourself" L"Friendly", //approach in a friendly @@ -1096,7 +1162,7 @@ UINT16 zTalkMenuStrings[6][ SMALL_STRING_LENGTH ] = }; //Some NPCs buy, sell or repair items. These different options are available for those NPCs as well. -UINT16 zDealerStrings[4][ SMALL_STRING_LENGTH ]= +CHAR16 zDealerStrings[4][ SMALL_STRING_LENGTH ]= { L"Buy/Sell", L"Buy", @@ -1104,7 +1170,7 @@ UINT16 zDealerStrings[4][ SMALL_STRING_LENGTH ]= L"Repair", }; -UINT16 zDialogActions[1][ SMALL_STRING_LENGTH ] = +CHAR16 zDialogActions[1][ SMALL_STRING_LENGTH ] = { L"Done", }; @@ -1145,7 +1211,7 @@ STR16 zVehicleName[] = //These are messages Used in the Tactical Screen -UINT16 TacticalStr[][ MED_STRING_LENGTH ] = +CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = { L"Air Raid", L"Apply first aid automatically?", @@ -1255,7 +1321,7 @@ UINT16 TacticalStr[][ MED_STRING_LENGTH ] = L"Mute", L"Stance Up (|P|g|U|p)", L"Cursor Level (|T|a|b)", - L"Climb / Jump", + L"Climb / |Jump", L"Stance Down (|P|g|D|n)", L"Examine (|C|t|r|l)", L"Previous Merc", @@ -1330,7 +1396,7 @@ UINT16 TacticalStr[][ MED_STRING_LENGTH ] = L"Key Ring Panel", L"You cannot do that with an EPC.", L"Spare Krott?", - L"Out of weapon range", + L"Out of effective weapon range.", L"Miner", L"Vehicle can only travel between sectors", L"Can't autobandage right now", @@ -1340,7 +1406,9 @@ UINT16 TacticalStr[][ MED_STRING_LENGTH ] = L"Lock destroyed", L"Somebody else is trying to use this door.", L"Health: %d/%d\nFuel: %d/%d", - L"%s cannot see %s.", // Cannot see person trying to talk to + L"%s cannot see %s.", // Cannot see person trying to talk to + L"Attachment removed", + L"Can not gain another vehicle as you already have 2", }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. @@ -1551,6 +1619,7 @@ STR16 pMapInventoryErrorString[] = L"During combat, you'll have to pick up items manually.", L"During combat, you'll have to drop items manually.", L"%s isn't in the sector to drop that item.", + L"During combat, you can't reload with an ammo crate.", }; STR16 pMapInventoryStrings[] = @@ -1678,7 +1747,7 @@ STR16 pSenderNameList[] = L"Len", L"Danny", L"Magic", - L"Stephan", + L"Stephen", L"Scully", L"Malice", L"Dr.Q", @@ -1806,6 +1875,7 @@ STR16 pTransactionText[] = L"Equip militia in %s", // initial cost to equip a town's militia L"Purchased items from %s.", //is used for the Shop keeper interface. The dealers name will be appended to the end of the string. L"%s deposited money.", + L"Sold Item(s) to the Locals", }; STR16 pTransactionAlternateText[] = @@ -1896,7 +1966,7 @@ STR16 pMapErrorString[] = L"needs an escort to move. Place her on a squad with one.", // for a female L"Merc hasn't yet arrived in Arulco!", L"Looks like there's some contract negotiations to settle first.", - L"", + L"Cannot give a movement order. Air raid is going on.", //11-15 L"Movement orders? There's a battle going on!", L"You have been ambushed by bloodcats in sector %s!", @@ -1910,13 +1980,13 @@ STR16 pMapErrorString[] = L"%s could not join %s as it is already full", L"%s could not join %s as it is too far away.", //21-25 - L"The mine in %s has been captured by Deidranna's forces!", - L"Deidranna's forces have just invaded the SAM site in %s", - L"Deidranna's forces have just invaded %s", - L"Deidranna's forces have just been spotted in %s.", - L"Deidranna's forces have just taken over %s.", + L"The mine in %s has been captured by enemy forces!", + L"Enemy forces have just invaded the SAM site in %s", + L"Enemy forces have just invaded %s", + L"Enemy forces have just been spotted in %s.", + L"Enemy forces have just taken over %s.", //26-30 - L"At least one of your mercs could not be put asleep.", + L"At least one of your mercs is not tired.", L"At least one of your mercs could not be woken up.", L"Militia will not appear until they have finished training.", L"%s cannot be given movement orders at this time.", @@ -2013,15 +2083,22 @@ STR16 pMercContractOverStrings[] = // Text used on IMP Web Pages +// WDS: Allow flexible numbers of IMPs of each sex +// note: I only updated the English text to remove "three" below STR16 pImpPopUpStrings[] = { - L"Invalid Authorization Code", - L"You Are About To Restart The Entire Profiling Process. Are You Certain?", - L"Please Enter A Valid Full Name and Gender", + L"Invalid authorization code", + L"You are about to restart the entire profiling process. Are you certain?", + L"Please enter a valid full name and gender", L"Preliminary analysis of your financial status shows that you cannot afford a profile analysis.", - L"Not A Valid Option At This Time.", + L"Not a valid option at this time.", L"To complete an accurate profile, you must have room for at least one team member.", - L"Profile Already Completed.", + L"Profile already completed.", + L"Cannot load I.M.P. character from disk.", + L"You have already reached the maximum number of I.M.P. characters.", + L"You have already the maximum number of I.M.P characters with that gender on your team.", + L"You cannot afford the I.M.P character.", + L"The new I.M.P character has joined your team.", }; @@ -2031,7 +2108,7 @@ STR16 pImpButtonText[] = { L"About Us", // about the IMP site L"BEGIN", // begin profiling - L"Personality", // personality section + L"Skills", // personality section L"Attributes", // personal stats/attributes section L"Portrait", // the personal portrait selection L"Voice %d", // the voice selection @@ -2478,7 +2555,7 @@ STR16 pUpdatePanelButtons[] = // Text which appears when everyone on your team is incapacitated and incapable of battle -UINT16 LargeTacticalStr[][ LARGE_STRING_LENGTH ] = +CHAR16 LargeTacticalStr[][ LARGE_STRING_LENGTH ] = { L"You have been defeated in this sector!", L"The enemy, having no mercy for the team's soul, devours each and every one of you!", @@ -2527,6 +2604,13 @@ STR16 MercAccountText[] = L"Are you sure you want to authorize the payment of %s?", //the %s is a string that contains the dollar amount ( ex. "$150" ) }; +// Merc Account Page buttons +STR16 MercAccountPageText[] = +{ + // Text on the buttons on the bottom of the screen + L"Previous", + L"Next", +}; //For use at the M.E.R.C. web site. Text relating a MERC mercenary @@ -2736,6 +2820,54 @@ STR16 BobbyROrderFormText[] = L"Shipments", }; +STR16 BobbyRFilter[] = +{ + // Guns + L"Heavy W.", + L"Pistol", + L"M. Pistol", + L"SMG", + L"Rifle", + L"SN Rifle", + L"AS Rifle", + L"MG", + L"Shotgun", + + // Ammo + L"Pistol", + L"M. Pistol", + L"SMG", + L"Rifle", + L"SN Rifle", + L"AS Rifle", + L"MG", + L"Shotgun", + + // Used + L"Guns", + L"Armor", + L"LBE Gear", + L"Misc", + + // Armour + L"Helmets", + L"Vests", + L"Leggings", + L"Plates", + + // Misc + L"Blades", + L"Th. Knives", + L"Punch. W.", + L"Grenades", + L"Bombs", + L"Med. Kits", + L"Kits", + L"Face Items", + L"LBE Gear", + L"Misc.", +}; + // This text is used when on the various Bobby Ray Web site pages that sell items @@ -3078,7 +3210,7 @@ STR16 AimScreenText[] = L"A.I.M. and the A.I.M. logo are registered trademarks in most countries.", L"So don't even think of trying to copy us.", - L"Copyright 1998-1999 A.I.M., Ltd. All rights reserved.", + L"Copyright 2005 A.I.M., Ltd. All rights reserved.", //1.13 modified to 2005 //Text for an advertisement that gets displayed on the AIM page @@ -3213,25 +3345,25 @@ STR16 zSaveLoadText[] = L"Loaded the game successfully", L"ERROR loading the game!", - L"The game version in the saved game file is different then the current version. It is most likely safe to continue. Continue?", - L"The saved game files may be invalidated. Do you want them all deleted?", + L"The game version in the saved game file is different then the current version. It is most likely safe to continue. Continue?", + L"The saved game files may be invalidated. Do you want them all deleted?", //Translators, the next two strings are for the same thing. The first one is for beta version releases and the second one //is used for the final version. Please don't modify the "#ifdef JA2BETAVERSION" or the "#else" or the "#endif" as they are //used by the compiler and will cause program errors if modified/removed. It's okay to translate the strings though. #ifdef JA2BETAVERSION - L"Save version has changed. Please report if there any problems. Continue?", + L"Save version has changed. Please report if there any problems. Continue?", #else - L"Attempting to load an older version save. Automatically update and load the save?", + L"Attempting to load an older version save. Automatically update and load the save?", #endif //Translators, the next two strings are for the same thing. The first one is for beta version releases and the second one //is used for the final version. Please don't modify the "#ifdef JA2BETAVERSION" or the "#else" or the "#endif" as they are //used by the compiler and will cause program errors if modified/removed. It's okay to translate the strings though. #ifdef JA2BETAVERSION - L"Save version and game version have changed. Please report if there are any problems. Continue?", + L"Save version and game version have changed. Please report if there are any problems. Continue?", #else - L"Attempting to load an older version save. Automatically update and load the save?", + L"Attempting to load an older version save. Automatically update and load the save?", #endif L"Are you sure you want to overwrite the saved game in slot #%d?", @@ -3250,6 +3382,15 @@ STR16 zSaveLoadText[] = L"Sci Fi style", L"Difficulty", + L"Platinum Mode", //Placeholder English + + L"Bobby Ray's", + L"Normal Selection", + L"Great Selection", + L"Excellent Selection", + L"Awesome Selection", + + L"New Inventory does not work in 640x480 screen size. Please resize and try again.", }; @@ -3285,6 +3426,7 @@ STR16 zMarksMapScreenText[] = L"%s is full of militia.", L"Merc has a finite contract.", L"Merc's contract is not insured", + L"Map Overview", // 24 }; @@ -3344,6 +3486,21 @@ STR16 zOptionsToggleText[] = L"Show Tree Tops", L"Show Wireframes", L"Show 3D Cursor", + L"Show Chance to Hit on cursor", + L"GL Burst uses Burst cursor", + L"Enemies Drop all Items", + L"High angle Grenade launching", + L"Restrict extra Aim Levels", + L"Space selects next Squad", + L"Show Item Shadow", + L"Show Weapon Ranges in Tiles", + L"Tracer effect for single shot", + L"Rain noises", + L"Allow crows", + L"Random I.M.P personality", + L"Auto save", + L"Silent Skyrider", + L"Low CPU usage", }; //This is the help text associated with the above toggles. @@ -3383,7 +3540,7 @@ STR16 zOptionsScreenHelpText[] = L"When ON, an additional \"safety\" click will be required for movement in Real-time.", //Sleep/Wake notification - L"When ON, you will be notified when mercs on \"assignment\" go to sleep and resume work.", + L"When ON, you will be notified when mercs on \"assignment\" go to sleep and resume work.", //Use the metric system L"When ON, uses the metric system for measurements; otherwise it uses the Imperial system.", @@ -3408,6 +3565,22 @@ STR16 zOptionsScreenHelpText[] = L"When ON, the movement cursor is shown in 3D. ( |Home )", + // Options for 1.13 + L"When ON, the chance to hit is shown on the cursor.", + L"When ON, GL burst uses burst cursor.", + L"When ON, dead enemies drop all items.", + L"When ON, grenade launchers fire grenades at higher angles (|Q).", + L"When ON, aim levels beyond 4 are restricted to rifles and sniper rifles.", + L"When ON, |S|p|a|c|e selects next squad automatically.", + L"When ON, item shadows will be shown.", + L"When ON, weapon ranges will be shown in tiles.", + L"When ON, tracer effect will be shown for single shots.", + L"When ON, you will hear rain noises when it is raining.", + L"When ON, the crows are present in game.", + L"When ON, I.M.P characters will get random personality and attitude.", + L"When ON, game will be saved after each players turn.", + L"When ON, Skyrider will not talk anymore.", + L"When ON, game will run with much lower CPU usage.", }; @@ -3417,19 +3590,30 @@ STR16 gzGIOScreenText[] = L"Game Style", L"Realistic", L"Sci Fi", - L"Gun Options", + L"Platinum", + L"Items", L"Tons of Guns", - L"Normal", + L"Normal Guns", L"Difficulty Level", L"Novice", L"Experienced", L"Expert", + L"INSANE", L"Ok", L"Cancel", L"Extra Difficulty", - L"Unlimited Time", - L"Timed Turns", + L"Save Anytime", + L"Iron Man", L"Disabled for Demo", + + L"Bobby Ray's Selection", + L"Normal", + L"Great", + L"Excellent", + L"Awesome", + L"Inventory System", + L"Old", + L"New", }; STR16 pDeliveryLocationStrings[] = @@ -3514,7 +3698,7 @@ STR16 pMessageStrings[] = L"No description", //Save slots that don't have a description. L"Game Saved.", L"Game Saved.", - L"QuickSave", //The name of the quicksave file (filename, text reference) + L"QuickSave", //10 The name of the quicksave file (filename, text reference) L"SaveGame", //The name of the normal savegame file, such as SaveGame01, SaveGame02, etc. L"sav", //The 3 character dos extension (represents sav) L"..\\SavedGames", //The name of the directory where games are saved. @@ -3524,7 +3708,7 @@ STR16 pMessageStrings[] = L"Demo", //Demo of JA2 L"Debug", //State of development of a project (JA2) that is a debug build L"Release", //Release build for JA2 - L"rpm", //Abbreviation for Rounds per minute -- the potential # of bullets fired in a minute. + L"rpm", //20 Abbreviation for Rounds per minute -- the potential # of bullets fired in a minute. L"min", //Abbreviation for minute. L"m", //One character abbreviation for meter (metric distance measurement unit). L"rnds", //Abbreviation for rounds (# of bullets) @@ -3534,7 +3718,7 @@ STR16 pMessageStrings[] = L"USD", //Abbreviation to US dollars L"n/a", //Lowercase acronym for not applicable. L"Meanwhile", //Meanwhile - L"%s has arrived in sector %s%s", //Name/Squad has arrived in sector A9. Order must not change without notifying + L"%s has arrived in sector %s%s", //30 Name/Squad has arrived in sector A9. Order must not change without notifying //SirTech L"Version", L"Empty Quick Save Slot", @@ -3545,7 +3729,7 @@ STR16 pMessageStrings[] = L"Hired %s from AIM", L"%s has caught %s.", //'Merc name' has caught 'item' -- let SirTech know if name comes after item. L"%s has taken the drug.", //'Merc name' has taken the drug - L"%s has no medical skill",//'Merc name' has no medical skill. + L"%s has no medical skill",//40 'Merc name' has no medical skill. //CDRom errors (such as ejecting CD while attempting to read the CD) L"The integrity of the game has been compromised.", @@ -3567,7 +3751,7 @@ STR16 pMessageStrings[] = L"No room to pass %s to %s.", //pass "item" to "merc". Same instructions as above. //A list of attachments appear after the items. Ex: Kevlar vest ( Ceramic Plate 'Attached )' - L" Attached )", + L" attached]", // 50 //Cheat modes L"Cheat level ONE reached", @@ -3587,7 +3771,7 @@ STR16 pMessageStrings[] = //These are used in the cheat modes for changing levels in the game. Going from a basement level to //an upper level, etc. L"Can't go up from this level...", - L"There are no lower levels...", + L"There are no lower levels...", // 60 L"Entering basement level %d...", L"Leaving basement...", @@ -3598,20 +3782,26 @@ STR16 pMessageStrings[] = L"3D Cursor ON.", L"Squad %d active.", L"You cannot afford to pay for %s's daily salary of %s", //first %s is the mercs name, the seconds is a string containing the salary - L"Skip", + L"Skip", // 70 L"%s cannot leave alone.", L"A save has been created called, SaveGame99.sav. If needed, rename it to SaveGame01 - SaveGame10 and then you will have access to it in the Load screen.", L"%s drank some %s", L"A package has arrived in Drassen.", L"%s should arrive at the designated drop-off point (sector %s) on day %d, at approximately %s.", //first %s is mercs name, next is the sector location and name where they will be arriving in, lastely is the day an the time of arrival L"History log updated.", + L"Grenade Bursts use Targeting Cursor (Spread fire enabled)", + L"Grenade Bursts use Trajectory Cursor (Spread fire disabled)", + L"Drop All Enabled", + L"Drop All Disabled", + L"Grenade Launchers fire at standard angles", + L"Grenade Launchers fire at higher angles", #ifdef JA2BETAVERSION L"Successfully Saved the Game into the End Turn Auto Save slot.", #endif }; -UINT16 ItemPickupHelpPopup[][40] = +CHAR16 ItemPickupHelpPopup[][40] = { L"OK", L"Scroll Up", @@ -3816,6 +4006,16 @@ STR16 sRepairsDoneString[] = L"%s finished repairing everyone's guns & armor", L"%s finished repairing everyone's equipped items", L"%s finished repairing everyone's carried items", + L"%s finished repairing everyone's carried items", + L"%s finished repairing everyone's carried items", +}; + +STR16 zGioDifConfirmText[]= +{ + L"You have chosen NOVICE mode. This setting is appropriate for those new to Jagged Alliance, those new to strategy games in general, or those wishing shorter battles in the game. Your choice will affect things throughout the entire course of the game, so choose wisely. Are you sure you want to play in Novice mode?", + L"You have chosen EXPERIENCED mode. This setting is suitable for those already familiar with Jagged Alliance or similar games. Your choice will affect things throughout the entire course of the game, so choose wisely. Are you sure you want to play in Experienced mode?", + L"You have chosen EXPERT mode. We warned you. Don't blame us if you get shipped back in a body bag. Your choice will affect things throughout the entire course of the game, so choose wisely. Are you sure you want to play in Expert mode?", + L"You have chosen INSANE mode. WARNING: Don't blame us if you get shipped back in little pieces... Deidranna WILL kick your ass. Hard. Your choice will affect things throughout the entire course of the game, so choose wisely. Are you sure you want to play in INSANE mode?", }; STR16 gzLateLocalizedString[] = @@ -3891,9 +4091,9 @@ STR16 gzLateLocalizedString[] = L"It is currently unsafe to compress time when mercs are in the creature infested mines.", //29-31 singular versions - L"1 green militia has been promoted to an veteran militia.", + L"1 green militia has been promoted to a veteran militia.", L"1 green militia has been promoted to a regular militia.", - L"1 regular militia has been promoted to an veteran militia.", + L"1 regular militia has been promoted to a veteran militia.", //32-34 L"%s doesn't say anything.", @@ -3945,7 +4145,7 @@ STR16 gzLateLocalizedString[] = //55 L"Can't compress time while viewing sector inventory.", - L"The Jagged Alliance 2 PLAY CD was not found. Program will now exit.", + L"The Jagged Alliance 2 PLAY DISK was not found. Program will now exit.", L"Items successfully combined.", @@ -3953,9 +4153,64 @@ STR16 gzLateLocalizedString[] = //Displayed with the version information when cheats are enabled. L"Current/Max Progress: %d%%/%d%%", - //59 L"Escort John and Mary?", + // 60 + L"Switch Activated.", + + L"%s's armour attachment has been smashed!", + L"%s fires %d more rounds than intended!", + L"%s fires %d more round than intended!", +}; + +STR16 gzCWStrings[] = +{ + L"Call reinforcements from adjacent sectors?", +}; + +// WANNE: Tooltips +STR16 gzTooltipStrings[] = +{ + // Debug info + L"%s|Location: %d\n", + L"%s|Brightness: %d / %d\n", + L"%s|Range to |Target: %d\n", + L"%s|I|D: %d\n", + L"%s|Orders: %d\n", + L"%s|Attitude: %d\n", + L"%s|Current |A|Ps: %d\n", + L"%s|Current |Health: %d\n", + // Full info + L"%s|Helmet: %s\n", + L"%s|Vest: %s\n", + L"%s|Leggings: %s\n", + // Limited, Basic + L"|Armor: ", + L"Helmet ", + L"Vest ", + L"Leggings", + L"worn", + L"no Armor", + L"%s|N|V|G: %s\n", + L"no NVG", + L"%s|Gas |Mask: %s\n", + L"no Gas Mask", + L"%s|Head |Position |1: %s\n", + L"%s|Head |Position |2: %s\n", + L"\n(in Backpack) ", + L"%s|Weapon: %s ", + L"no Weapon", + L"Handgun", + L"SMG", + L"Rifle", + L"MG", + L"Shotgun", + L"Knife", + L"Heavy Weapon", + L"no Helmet", + L"no Vest", + L"no Leggings", + L"|Armor: %s\n", }; STR16 New113Message[] = @@ -3994,10 +4249,19 @@ STR16 New113MERCMercMailTexts[] = // INFO: Do not replace the ± characters. They indicate the (-> Newline) from the edt files STR16 MissingIMPSkillsDescriptions[] = { - // Rooftop sniping - L"Rooftop Sniping: Not even ants are on the save side. Each target is mercilessly tracked down! ± ", + // Sniper + L"Sniper: Eyes of a hawk, you can shoot the wings from a fly at a hundred yards! ± ", // Camouflage L"Camouflage: Besides you even bushes look synthetic! ± ", }; +STR16 NewInvMessage[] = +{ + L"Cannot pickup backpack at this time", + L"No place to put backpack", + L"Backpack not found", + L"Zipper only works in combat", + L"Can not move while backpack zipper active", +}; + #endif //TAIWANESE diff --git a/Utils/dsutil.cpp b/Utils/dsutil.cpp index fb886f0b..a1060a88 100644 --- a/Utils/dsutil.cpp +++ b/Utils/dsutil.cpp @@ -19,11 +19,11 @@ typedef struct { - BYTE *pbWaveData; // pointer into wave resource (for restore) - DWORD cbWaveSize; // size of wave data (for restore) - int iAlloc; // number of buffers. - int iCurrent; // current buffer - IDirectSoundBuffer* Buffers[1]; // list of buffers + BYTE *pbWaveData; // pointer into wave resource (for restore) + DWORD cbWaveSize; // size of wave data (for restore) + int iAlloc; // number of buffers. + int iCurrent; // current buffer + IDirectSoundBuffer* Buffers[1]; // list of buffers } SNDOBJ, *HSNDOBJ; @@ -40,30 +40,30 @@ static const char c_szWAV[] = "WAVE"; IDirectSoundBuffer *DSLoadSoundBuffer(IDirectSound *pDS, LPCTSTR lpName) { - IDirectSoundBuffer *pDSB = NULL; - DSBUFFERDESC dsBD = {0}; - BYTE *pbWaveData; + IDirectSoundBuffer *pDSB = NULL; + DSBUFFERDESC dsBD = {0}; + BYTE *pbWaveData; - if (DSGetWaveResource(NULL, lpName, &dsBD.lpwfxFormat, &pbWaveData, &dsBD.dwBufferBytes)) - { - dsBD.dwSize = sizeof(dsBD); - dsBD.dwFlags = DSBCAPS_STATIC | DSBCAPS_CTRLDEFAULT; // | DSBCAPS_GETCURRENTPOSITION2; + if (DSGetWaveResource(NULL, lpName, &dsBD.lpwfxFormat, &pbWaveData, &dsBD.dwBufferBytes)) + { + dsBD.dwSize = sizeof(dsBD); + dsBD.dwFlags = DSBCAPS_STATIC | DSBCAPS_CTRLDEFAULT; // | DSBCAPS_GETCURRENTPOSITION2; - if (SUCCEEDED(IDirectSound_CreateSoundBuffer(pDS, &dsBD, &pDSB, NULL))) - { - if (!DSFillSoundBuffer(pDSB, pbWaveData, dsBD.dwBufferBytes)) - { - IDirectSoundBuffer_Release(pDSB); - pDSB = NULL; - } - } - else - { - pDSB = NULL; - } - } + if (SUCCEEDED(IDirectSound_CreateSoundBuffer(pDS, &dsBD, &pDSB, NULL))) + { + if (!DSFillSoundBuffer(pDSB, pbWaveData, dsBD.dwBufferBytes)) + { + IDirectSoundBuffer_Release(pDSB); + pDSB = NULL; + } + } + else + { + pDSB = NULL; + } + } - return pDSB; + return pDSB; } /////////////////////////////////////////////////////////////////////////////// @@ -74,20 +74,20 @@ IDirectSoundBuffer *DSLoadSoundBuffer(IDirectSound *pDS, LPCTSTR lpName) BOOL DSReloadSoundBuffer(IDirectSoundBuffer *pDSB, LPCTSTR lpName) { - BOOL result=FALSE; - BYTE *pbWaveData; - DWORD cbWaveSize; + BOOL result=FALSE; + BYTE *pbWaveData; + DWORD cbWaveSize; - if (DSGetWaveResource(NULL, lpName, NULL, &pbWaveData, &cbWaveSize)) - { - if (SUCCEEDED(IDirectSoundBuffer_Restore(pDSB)) && - DSFillSoundBuffer(pDSB, pbWaveData, cbWaveSize)) - { - result = TRUE; - } - } + if (DSGetWaveResource(NULL, lpName, NULL, &pbWaveData, &cbWaveSize)) + { + if (SUCCEEDED(IDirectSoundBuffer_Restore(pDSB)) && + DSFillSoundBuffer(pDSB, pbWaveData, cbWaveSize)) + { + result = TRUE; + } + } - return result; + return result; } /////////////////////////////////////////////////////////////////////////////// @@ -97,21 +97,21 @@ BOOL DSReloadSoundBuffer(IDirectSoundBuffer *pDSB, LPCTSTR lpName) /////////////////////////////////////////////////////////////////////////////// BOOL DSGetWaveResource(HMODULE hModule, LPCTSTR lpName, - WAVEFORMATEX **ppWaveHeader, BYTE **ppbWaveData, DWORD *pcbWaveSize) + WAVEFORMATEX **ppWaveHeader, BYTE **ppbWaveData, DWORD *pcbWaveSize) { - HRSRC hResInfo; - HGLOBAL hResData; - void *pvRes; + HRSRC hResInfo; + HGLOBAL hResData; + void *pvRes; - if (((hResInfo = FindResource(hModule, lpName, c_szWAV)) != NULL) && - ((hResData = LoadResource(hModule, hResInfo)) != NULL) && - ((pvRes = LockResource(hResData)) != NULL) && - DSParseWaveResource(pvRes, ppWaveHeader, ppbWaveData, pcbWaveSize)) - { - return TRUE; - } + if (((hResInfo = FindResource(hModule, lpName, c_szWAV)) != NULL) && + ((hResData = LoadResource(hModule, hResInfo)) != NULL) && + ((pvRes = LockResource(hResData)) != NULL) && + DSParseWaveResource(pvRes, ppWaveHeader, ppbWaveData, pcbWaveSize)) + { + return TRUE; + } - return FALSE; + return FALSE; } /////////////////////////////////////////////////////////////////////////////// @@ -120,43 +120,43 @@ BOOL DSGetWaveResource(HMODULE hModule, LPCTSTR lpName, SNDOBJ *SndObjCreate(IDirectSound *pDS, LPCTSTR lpName, int iConcurrent) { - SNDOBJ *pSO = NULL; - LPWAVEFORMATEX pWaveHeader; - BYTE *pbData; - UINT cbData; + SNDOBJ *pSO = NULL; + LPWAVEFORMATEX pWaveHeader; + BYTE *pbData; + UINT cbData; - if (DSGetWaveResource(NULL, lpName, &pWaveHeader, &pbData, (DWORD *)&cbData)) - { - if (iConcurrent < 1) - iConcurrent = 1; + if (DSGetWaveResource(NULL, lpName, &pWaveHeader, &pbData, (DWORD *)&cbData)) + { + if (iConcurrent < 1) + iConcurrent = 1; - if ((pSO = (SNDOBJ *)LocalAlloc(LPTR, sizeof(SNDOBJ) + - (iConcurrent-1) * sizeof(IDirectSoundBuffer *))) != NULL) - { - int i; + if ((pSO = (SNDOBJ *)LocalAlloc(LPTR, sizeof(SNDOBJ) + + (iConcurrent-1) * sizeof(IDirectSoundBuffer *))) != NULL) + { + int i; - pSO->iAlloc = iConcurrent; - pSO->pbWaveData = pbData; - pSO->cbWaveSize = cbData; - pSO->Buffers[0] = DSLoadSoundBuffer(pDS, lpName); + pSO->iAlloc = iConcurrent; + pSO->pbWaveData = pbData; + pSO->cbWaveSize = cbData; + pSO->Buffers[0] = DSLoadSoundBuffer(pDS, lpName); - for (i=1; iiAlloc; i++) - { - if (FAILED(IDirectSound_DuplicateSoundBuffer(pDS, - pSO->Buffers[0], &pSO->Buffers[i]))) - { - pSO->Buffers[i] = DSLoadSoundBuffer(pDS, lpName); - if (!pSO->Buffers[i]) { - SndObjDestroy(pSO); - pSO = NULL; - break; - } - } - } - } - } + for (i=1; iiAlloc; i++) + { + if (FAILED(IDirectSound_DuplicateSoundBuffer(pDS, + pSO->Buffers[0], &pSO->Buffers[i]))) + { + pSO->Buffers[i] = DSLoadSoundBuffer(pDS, lpName); + if (!pSO->Buffers[i]) { + SndObjDestroy(pSO); + pSO = NULL; + break; + } + } + } + } + } - return pSO; + return pSO; } /////////////////////////////////////////////////////////////////////////////// @@ -164,20 +164,20 @@ SNDOBJ *SndObjCreate(IDirectSound *pDS, LPCTSTR lpName, int iConcurrent) void SndObjDestroy(SNDOBJ *pSO) { - if (pSO) - { - int i; + if (pSO) + { + int i; - for (i=0; iiAlloc; i++) - { - if (pSO->Buffers[i]) - { - IDirectSoundBuffer_Release(pSO->Buffers[i]); - pSO->Buffers[i] = NULL; - } - } - LocalFree((HANDLE)pSO); - } + for (i=0; iiAlloc; i++) + { + if (pSO->Buffers[i]) + { + IDirectSoundBuffer_Release(pSO->Buffers[i]); + pSO->Buffers[i] = NULL; + } + } + LocalFree((HANDLE)pSO); + } } /////////////////////////////////////////////////////////////////////////////// @@ -185,54 +185,54 @@ void SndObjDestroy(SNDOBJ *pSO) IDirectSoundBuffer *SndObjGetFreeBuffer(SNDOBJ *pSO) { - IDirectSoundBuffer *pDSB; + IDirectSoundBuffer *pDSB; - if (pSO == NULL) - return NULL; + if (pSO == NULL) + return NULL; - if (pDSB = pSO->Buffers[pSO->iCurrent]) - { - HRESULT hres; - DWORD dwStatus; + if (pDSB = pSO->Buffers[pSO->iCurrent]) + { + HRESULT hres; + DWORD dwStatus; - hres = IDirectSoundBuffer_GetStatus(pDSB, &dwStatus); + hres = IDirectSoundBuffer_GetStatus(pDSB, &dwStatus); - if (FAILED(hres)) - dwStatus = 0; + if (FAILED(hres)) + dwStatus = 0; - if ((dwStatus & DSBSTATUS_PLAYING) == DSBSTATUS_PLAYING) - { - if (pSO->iAlloc > 1) - { - if (++pSO->iCurrent >= pSO->iAlloc) - pSO->iCurrent = 0; + if ((dwStatus & DSBSTATUS_PLAYING) == DSBSTATUS_PLAYING) + { + if (pSO->iAlloc > 1) + { + if (++pSO->iCurrent >= pSO->iAlloc) + pSO->iCurrent = 0; - pDSB = pSO->Buffers[pSO->iCurrent]; - hres = IDirectSoundBuffer_GetStatus(pDSB, &dwStatus); + pDSB = pSO->Buffers[pSO->iCurrent]; + hres = IDirectSoundBuffer_GetStatus(pDSB, &dwStatus); - if (SUCCEEDED(hres) && (dwStatus & DSBSTATUS_PLAYING) == DSBSTATUS_PLAYING) - { - IDirectSoundBuffer_Stop(pDSB); - IDirectSoundBuffer_SetCurrentPosition(pDSB, 0); - } - } - else - { - pDSB = NULL; - } - } + if (SUCCEEDED(hres) && (dwStatus & DSBSTATUS_PLAYING) == DSBSTATUS_PLAYING) + { + IDirectSoundBuffer_Stop(pDSB); + IDirectSoundBuffer_SetCurrentPosition(pDSB, 0); + } + } + else + { + pDSB = NULL; + } + } - if (pDSB && (dwStatus & DSBSTATUS_BUFFERLOST)) - { - if (FAILED(IDirectSoundBuffer_Restore(pDSB)) || - !DSFillSoundBuffer(pDSB, pSO->pbWaveData, pSO->cbWaveSize)) - { - pDSB = NULL; - } - } - } + if (pDSB && (dwStatus & DSBSTATUS_BUFFERLOST)) + { + if (FAILED(IDirectSoundBuffer_Restore(pDSB)) || + !DSFillSoundBuffer(pDSB, pSO->pbWaveData, pSO->cbWaveSize)) + { + pDSB = NULL; + } + } + } - return pDSB; + return pDSB; } /////////////////////////////////////////////////////////////////////////////// @@ -240,20 +240,20 @@ IDirectSoundBuffer *SndObjGetFreeBuffer(SNDOBJ *pSO) BOOL SndObjPlay(SNDOBJ *pSO, DWORD dwPlayFlags) { - BOOL result = FALSE; + BOOL result = FALSE; - if (pSO == NULL) - return FALSE; + if (pSO == NULL) + return FALSE; - if ((!(dwPlayFlags & DSBPLAY_LOOPING) || (pSO->iAlloc == 1))) - { - IDirectSoundBuffer *pDSB = SndObjGetFreeBuffer(pSO); - if (pDSB != NULL) { - result = SUCCEEDED(IDirectSoundBuffer_Play(pDSB, 0, 0, dwPlayFlags)); - } - } + if ((!(dwPlayFlags & DSBPLAY_LOOPING) || (pSO->iAlloc == 1))) + { + IDirectSoundBuffer *pDSB = SndObjGetFreeBuffer(pSO); + if (pDSB != NULL) { + result = SUCCEEDED(IDirectSoundBuffer_Play(pDSB, 0, 0, dwPlayFlags)); + } + } - return result; + return result; } /////////////////////////////////////////////////////////////////////////////// @@ -261,18 +261,18 @@ BOOL SndObjPlay(SNDOBJ *pSO, DWORD dwPlayFlags) BOOL SndObjStop(SNDOBJ *pSO) { - int i; + int i; - if (pSO == NULL) - return FALSE; + if (pSO == NULL) + return FALSE; - for (i=0; iiAlloc; i++) - { - IDirectSoundBuffer_Stop(pSO->Buffers[i]); - IDirectSoundBuffer_SetCurrentPosition(pSO->Buffers[i], 0); - } + for (i=0; iiAlloc; i++) + { + IDirectSoundBuffer_Stop(pSO->Buffers[i]); + IDirectSoundBuffer_SetCurrentPosition(pSO->Buffers[i], 0); + } - return TRUE; + return TRUE; } /////////////////////////////////////////////////////////////////////////////// @@ -280,25 +280,25 @@ BOOL SndObjStop(SNDOBJ *pSO) BOOL DSFillSoundBuffer(IDirectSoundBuffer *pDSB, BYTE *pbWaveData, DWORD cbWaveSize) { - if (pDSB && pbWaveData && cbWaveSize) - { - LPVOID pMem1, pMem2; - DWORD dwSize1, dwSize2; + if (pDSB && pbWaveData && cbWaveSize) + { + LPVOID pMem1, pMem2; + DWORD dwSize1, dwSize2; - if (SUCCEEDED(IDirectSoundBuffer_Lock(pDSB, 0, cbWaveSize, - &pMem1, &dwSize1, &pMem2, &dwSize2, 0))) - { - CopyMemory(pMem1, pbWaveData, dwSize1); + if (SUCCEEDED(IDirectSoundBuffer_Lock(pDSB, 0, cbWaveSize, + &pMem1, &dwSize1, &pMem2, &dwSize2, 0))) + { + CopyMemory(pMem1, pbWaveData, dwSize1); - if ( 0 != dwSize2 ) - CopyMemory(pMem2, pbWaveData+dwSize1, dwSize2); + if ( 0 != dwSize2 ) + CopyMemory(pMem2, pbWaveData+dwSize1, dwSize2); - IDirectSoundBuffer_Unlock(pDSB, pMem1, dwSize1, pMem2, dwSize2); - return TRUE; - } - } + IDirectSoundBuffer_Unlock(pDSB, pMem1, dwSize1, pMem2, dwSize2); + return TRUE; + } + } - return FALSE; + return FALSE; } /////////////////////////////////////////////////////////////////////////////// @@ -306,76 +306,76 @@ BOOL DSFillSoundBuffer(IDirectSoundBuffer *pDSB, BYTE *pbWaveData, DWORD cbWaveS BOOL DSParseWaveResource(void *pvRes, WAVEFORMATEX **ppWaveHeader, BYTE **ppbWaveData,DWORD *pcbWaveSize) { - DWORD *pdw; - DWORD *pdwEnd; - DWORD dwRiff; - DWORD dwType; - DWORD dwLength; + DWORD *pdw; + DWORD *pdwEnd; + DWORD dwRiff; + DWORD dwType; + DWORD dwLength; - if (ppWaveHeader) - *ppWaveHeader = NULL; + if (ppWaveHeader) + *ppWaveHeader = NULL; - if (ppbWaveData) - *ppbWaveData = NULL; + if (ppbWaveData) + *ppbWaveData = NULL; - if (pcbWaveSize) - *pcbWaveSize = 0; + if (pcbWaveSize) + *pcbWaveSize = 0; - pdw = (DWORD *)pvRes; - dwRiff = *pdw++; - dwLength = *pdw++; - dwType = *pdw++; + pdw = (DWORD *)pvRes; + dwRiff = *pdw++; + dwLength = *pdw++; + dwType = *pdw++; - if (dwRiff != mmioFOURCC('R', 'I', 'F', 'F')) - goto exit; // not even RIFF + if (dwRiff != mmioFOURCC('R', 'I', 'F', 'F')) + goto exit; // not even RIFF - if (dwType != mmioFOURCC('W', 'A', 'V', 'E')) - goto exit; // not a WAV + if (dwType != mmioFOURCC('W', 'A', 'V', 'E')) + goto exit; // not a WAV - pdwEnd = (DWORD *)((BYTE *)pdw + dwLength-4); + pdwEnd = (DWORD *)((BYTE *)pdw + dwLength-4); - while (pdw < pdwEnd) - { - dwType = *pdw++; - dwLength = *pdw++; + while (pdw < pdwEnd) + { + dwType = *pdw++; + dwLength = *pdw++; - switch (dwType) - { - case mmioFOURCC('f', 'm', 't', ' '): - if (ppWaveHeader && !*ppWaveHeader) - { - if (dwLength < sizeof(WAVEFORMAT)) - goto exit; // not a WAV + switch (dwType) + { + case mmioFOURCC('f', 'm', 't', ' '): + if (ppWaveHeader && !*ppWaveHeader) + { + if (dwLength < sizeof(WAVEFORMAT)) + goto exit; // not a WAV - *ppWaveHeader = (WAVEFORMATEX *)pdw; + *ppWaveHeader = (WAVEFORMATEX *)pdw; - if ((!ppbWaveData || *ppbWaveData) && - (!pcbWaveSize || *pcbWaveSize)) - { - return TRUE; - } - } - break; + if ((!ppbWaveData || *ppbWaveData) && + (!pcbWaveSize || *pcbWaveSize)) + { + return TRUE; + } + } + break; - case mmioFOURCC('d', 'a', 't', 'a'): - if ((ppbWaveData && !*ppbWaveData) || - (pcbWaveSize && !*pcbWaveSize)) - { - if (ppbWaveData) - *ppbWaveData = (LPBYTE)pdw; + case mmioFOURCC('d', 'a', 't', 'a'): + if ((ppbWaveData && !*ppbWaveData) || + (pcbWaveSize && !*pcbWaveSize)) + { + if (ppbWaveData) + *ppbWaveData = (LPBYTE)pdw; - if (pcbWaveSize) - *pcbWaveSize = dwLength; + if (pcbWaveSize) + *pcbWaveSize = dwLength; - if (!ppWaveHeader || *ppWaveHeader) - return TRUE; - } - break; - } + if (!ppWaveHeader || *ppWaveHeader) + return TRUE; + } + break; + } - pdw = (DWORD *)((BYTE *)pdw + ((dwLength+1)&~1)); - } + pdw = (DWORD *)((BYTE *)pdw + ((dwLength+1)&~1)); + } exit: - return FALSE; + return FALSE; } diff --git a/Utils/dsutil.h b/Utils/dsutil.h index c75a01c8..90fbf296 100644 --- a/Utils/dsutil.h +++ b/Utils/dsutil.h @@ -1,9 +1,9 @@ /*========================================================================== * - * Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. + * Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. * - * File: dsutil.cpp - * Content: Routines for dealing with sounds from resources + * File: dsutil.cpp + * Content: Routines for dealing with sounds from resources * * ***************************************************************************/ @@ -14,110 +14,110 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////// // -// DSLoadSoundBuffer Loads an IDirectSoundBuffer from a Win32 resource in -// the current application. +// DSLoadSoundBuffer Loads an IDirectSoundBuffer from a Win32 resource in +// the current application. // // Params: -// pDS -- Pointer to an IDirectSound that will be used to create -// the buffer. +// pDS -- Pointer to an IDirectSound that will be used to create +// the buffer. // -// lpName -- Name of WAV resource to load the data from. Can be a -// resource id specified using the MAKEINTRESOURCE macro. +// lpName -- Name of WAV resource to load the data from. Can be a +// resource id specified using the MAKEINTRESOURCE macro. // // Returns an IDirectSoundBuffer containing the wave data or NULL on error. // // example: -// in the application's resource script (.RC file) -// Turtle WAV turtle.wav +// in the application's resource script (.RC file) +// Turtle WAV turtle.wav // -// some code in the application: -// IDirectSoundBuffer *pDSB = DSLoadSoundBuffer(pDS, "Turtle"); +// some code in the application: +// IDirectSoundBuffer *pDSB = DSLoadSoundBuffer(pDS, "Turtle"); // -// if (pDSB) -// { -// IDirectSoundBuffer_Play(pDSB, 0, 0, DSBPLAY_TOEND); -// /* ... */ +// if (pDSB) +// { +// IDirectSoundBuffer_Play(pDSB, 0, 0, DSBPLAY_TOEND); +// /* ... */ // /////////////////////////////////////////////////////////////////////////////// IDirectSoundBuffer *DSLoadSoundBuffer(IDirectSound *pDS, LPCTSTR lpName); /////////////////////////////////////////////////////////////////////////////// // -// DSReloadSoundBuffer Reloads an IDirectSoundBuffer from a Win32 resource in -// the current application. normally used to handle -// a DSERR_BUFFERLOST error. +// DSReloadSoundBuffer Reloads an IDirectSoundBuffer from a Win32 resource in +// the current application. normally used to handle +// a DSERR_BUFFERLOST error. // Params: -// pDSB -- Pointer to an IDirectSoundBuffer to be reloaded. +// pDSB -- Pointer to an IDirectSoundBuffer to be reloaded. // -// lpName -- Name of WAV resource to load the data from. Can be a -// resource id specified using the MAKEINTRESOURCE macro. +// lpName -- Name of WAV resource to load the data from. Can be a +// resource id specified using the MAKEINTRESOURCE macro. // // Returns a BOOL indicating whether the buffer was successfully reloaded. // // example: -// in the application's resource script (.RC file) -// Turtle WAV turtle.wav +// in the application's resource script (.RC file) +// Turtle WAV turtle.wav // -// some code in the application: -// TryAgain: -// HRESULT hres = IDirectSoundBuffer_Play(pDSB, 0, 0, DSBPLAY_TOEND); +// some code in the application: +// TryAgain: +// HRESULT hres = IDirectSoundBuffer_Play(pDSB, 0, 0, DSBPLAY_TOEND); // -// if (FAILED(hres)) -// { -// if ((hres == DSERR_BUFFERLOST) && -// DSReloadSoundBuffer(pDSB, "Turtle")) -// { -// goto TryAgain; -// } -// /* deal with other errors... */ -// } +// if (FAILED(hres)) +// { +// if ((hres == DSERR_BUFFERLOST) && +// DSReloadSoundBuffer(pDSB, "Turtle")) +// { +// goto TryAgain; +// } +// /* deal with other errors... */ +// } // /////////////////////////////////////////////////////////////////////////////// BOOL DSReloadSoundBuffer(IDirectSoundBuffer *pDSB, LPCTSTR lpName); /////////////////////////////////////////////////////////////////////////////// // -// DSGetWaveResource Finds a WAV resource in a Win32 module. +// DSGetWaveResource Finds a WAV resource in a Win32 module. // // Params: -// hModule -- Win32 module handle of module containing WAV resource. -// Pass NULL to indicate current application. +// hModule -- Win32 module handle of module containing WAV resource. +// Pass NULL to indicate current application. // -// lpName -- Name of WAV resource to load the data from. Can be a -// resource id specified using the MAKEINTRESOURCE macro. +// lpName -- Name of WAV resource to load the data from. Can be a +// resource id specified using the MAKEINTRESOURCE macro. // -// ppWaveHeader-- Optional pointer to WAVEFORMATEX * to receive a pointer to -// the WAVEFORMATEX header in the specified WAV resource. -// Pass NULL if not required. +// ppWaveHeader-- Optional pointer to WAVEFORMATEX * to receive a pointer to +// the WAVEFORMATEX header in the specified WAV resource. +// Pass NULL if not required. // -// ppbWaveData -- Optional pointer to BYTE * to receive a pointer to the -// waveform data in the specified WAV resource. Pass NULL if -// not required. +// ppbWaveData -- Optional pointer to BYTE * to receive a pointer to the +// waveform data in the specified WAV resource. Pass NULL if +// not required. // -// pdwWaveSize -- Optional pointer to DWORD to receive the size of the -// waveform data in the specified WAV resource. Pass NULL if -// not required. +// pdwWaveSize -- Optional pointer to DWORD to receive the size of the +// waveform data in the specified WAV resource. Pass NULL if +// not required. // // Returns a BOOL indicating whether a valid WAV resource was found. // /////////////////////////////////////////////////////////////////////////////// BOOL DSGetWaveResource(HMODULE hModule, LPCTSTR lpName, - WAVEFORMATEX **ppWaveHeader, BYTE **ppbWaveData, DWORD *pdwWaveSize); + WAVEFORMATEX **ppWaveHeader, BYTE **ppbWaveData, DWORD *pdwWaveSize); /////////////////////////////////////////////////////////////////////////////// // -// HSNDOBJ Handle to a SNDOBJ object. +// HSNDOBJ Handle to a SNDOBJ object. // -// SNDOBJs are implemented in dsutil as an example layer built on top -// of DirectSound. +// SNDOBJs are implemented in dsutil as an example layer built on top +// of DirectSound. // -// A SNDOBJ is generally used to manage individual -// sounds which need to be played multiple times concurrently. A -// SNDOBJ represents a queue of IDirectSoundBuffer objects which -// all refer to the same buffer memory. +// A SNDOBJ is generally used to manage individual +// sounds which need to be played multiple times concurrently. A +// SNDOBJ represents a queue of IDirectSoundBuffer objects which +// all refer to the same buffer memory. // -// A SNDOBJ also automatically reloads the sound resource when -// DirectSound returns a DSERR_BUFFERLOST +// A SNDOBJ also automatically reloads the sound resource when +// DirectSound returns a DSERR_BUFFERLOST // /////////////////////////////////////////////////////////////////////////////// #ifndef _HSNDOBJ_DEFINED @@ -126,77 +126,77 @@ DECLARE_HANDLE32(HSNDOBJ); /////////////////////////////////////////////////////////////////////////////// // -// SndObjCreate Loads a SNDOBJ from a Win32 resource in -// the current application. +// SndObjCreate Loads a SNDOBJ from a Win32 resource in +// the current application. // // Params: -// pDS -- Pointer to an IDirectSound that will be used to create -// the SNDOBJ. +// pDS -- Pointer to an IDirectSound that will be used to create +// the SNDOBJ. // -// lpName -- Name of WAV resource to load the data from. Can be a -// resource id specified using the MAKEINTRESOURCE macro. +// lpName -- Name of WAV resource to load the data from. Can be a +// resource id specified using the MAKEINTRESOURCE macro. // -// iConcurrent -- Integer representing the number of concurrent playbacks of -// to plan for. Attempts to play more than this number will -// succeed but will restart the least recently played buffer -// even if it is not finished playing yet. +// iConcurrent -- Integer representing the number of concurrent playbacks of +// to plan for. Attempts to play more than this number will +// succeed but will restart the least recently played buffer +// even if it is not finished playing yet. // // Returns an HSNDOBJ or NULL on error. // // NOTES: -// SNDOBJs automatically restore and reload themselves as required. +// SNDOBJs automatically restore and reload themselves as required. // /////////////////////////////////////////////////////////////////////////////// HSNDOBJ SndObjCreate(IDirectSound *pDS, LPCTSTR lpName, int iConcurrent); /////////////////////////////////////////////////////////////////////////////// // -// SndObjDestroy Frees a SNDOBJ and releases all of its buffers. +// SndObjDestroy Frees a SNDOBJ and releases all of its buffers. // // Params: -// hSO -- Handle to a SNDOBJ to free. +// hSO -- Handle to a SNDOBJ to free. // /////////////////////////////////////////////////////////////////////////////// void SndObjDestroy(HSNDOBJ hSO); /////////////////////////////////////////////////////////////////////////////// // -// SndObjPlay Plays a buffer in a SNDOBJ. +// SndObjPlay Plays a buffer in a SNDOBJ. // // Params: -// hSO -- Handle to a SNDOBJ to play a buffer from. +// hSO -- Handle to a SNDOBJ to play a buffer from. // -// dwPlayFlags -- Flags to pass to IDirectSoundBuffer::Play. It is not -// legal to play an SndObj which has more than one buffer -// with the DSBPLAY_LOOPING flag. Pass 0 to stop playback. +// dwPlayFlags -- Flags to pass to IDirectSoundBuffer::Play. It is not +// legal to play an SndObj which has more than one buffer +// with the DSBPLAY_LOOPING flag. Pass 0 to stop playback. // /////////////////////////////////////////////////////////////////////////////// BOOL SndObjPlay(HSNDOBJ hSO, DWORD dwPlayFlags); /////////////////////////////////////////////////////////////////////////////// // -// SndObjStop Stops one or more buffers in a SNDOBJ. +// SndObjStop Stops one or more buffers in a SNDOBJ. // // Params: -// hSO -- Handle to a SNDOBJ to play a buffer from. +// hSO -- Handle to a SNDOBJ to play a buffer from. // /////////////////////////////////////////////////////////////////////////////// BOOL SndObjStop(HSNDOBJ hSO); /////////////////////////////////////////////////////////////////////////////// // -// SndObjGetFreeBuffer returns one of the cloned buffers that is -// not currently playing +// SndObjGetFreeBuffer returns one of the cloned buffers that is +// not currently playing // // Params: -// hSO -- Handle to a SNDOBJ +// hSO -- Handle to a SNDOBJ // // NOTES: -// This function is provided so that callers can set things like pan etc -// before playing the buffer. +// This function is provided so that callers can set things like pan etc +// before playing the buffer. // // EXAMPLE: -// ... +// ... // /////////////////////////////////////////////////////////////////////////////// IDirectSoundBuffer *SndObjGetFreeBuffer(HSNDOBJ hSO); diff --git a/Utils/message.cpp b/Utils/message.cpp index 99e62706..611dc195 100644 --- a/Utils/message.cpp +++ b/Utils/message.cpp @@ -23,17 +23,18 @@ #include "Dialogue Control.h" #include #include "Game Clock.h" + #include "GameSettings.h" #endif -typedef struct +typedef struct { - UINT32 uiFont; - UINT32 uiTimeOfLastUpdate; - UINT32 uiFlags; + UINT32 uiFont; + UINT32 uiTimeOfLastUpdate; + UINT32 uiFlags; UINT32 uiPadding[ 3 ]; - UINT16 usColor; + UINT16 usColor; BOOLEAN fBeginningOfNewString; - + } StringSaveStruct; @@ -68,7 +69,7 @@ BOOLEAN fOkToBeepNewMessage = TRUE; static ScrollStringStPtr gpDisplayList[ MAX_LINE_COUNT ]; static ScrollStringStPtr gMapScreenMessageList[ 256 ]; -static ScrollStringStPtr pStringS=NULL; +extern ScrollStringStPtr pStringS=NULL; // first time adding any message to the message dialogue system BOOLEAN fFirstTimeInMessageSystem = TRUE; @@ -93,7 +94,7 @@ extern BOOLEAN fDialogueBoxDueToLastMessage; // prototypes BOOLEAN CreateStringVideoOverlay( ScrollStringStPtr pStringSt, UINT16 usX, UINT16 usY ); -void SetStringVideoOverlayPosition( ScrollStringStPtr pStringSt, UINT16 usX, UINT16 usY ); +void SetStringVideoOverlayPosition( ScrollStringStPtr pStringSt, UINT16 usX, UINT16 usY ); void BlitString( VIDEO_OVERLAY *pBlitter ); void RemoveStringVideoOverlay( ScrollStringStPtr pStringSt ); @@ -109,7 +110,7 @@ ScrollStringStPtr AddString(STR16 string, UINT16 usColor, UINT32 uiFont, BOOLEAN void SetString(ScrollStringStPtr pStringSt, STR16 String); void SetStringPosition(ScrollStringStPtr pStringSt, UINT16 x, UINT16 y); -void SetStringColor(ScrollStringStPtr pStringSt, UINT16 color); +void SetStringColor(ScrollStringStPtr pStringSt, UINT16 color); ScrollStringStPtr SetStringNext(ScrollStringStPtr pStringSt, ScrollStringStPtr pNext); ScrollStringStPtr SetStringPrev(ScrollStringStPtr pStringSt, ScrollStringStPtr pPrev); void AddStringToMapScreenMessageList( STR16 pString, UINT16 usColor, UINT32 uiFont, BOOLEAN fStartOfNewString, UINT8 ubPriority ); @@ -148,13 +149,13 @@ ScrollStringStPtr AddString(STR16 pString, UINT16 usColor, UINT32 uiFont, BOOLEA // add a new string to the list of strings ScrollStringStPtr pStringSt=NULL; pStringSt= (ScrollStringStPtr)MemAlloc(sizeof(ScrollStringSt)); - + SetString(pStringSt, pString); SetStringColor(pStringSt, usColor); pStringSt->uiFont = uiFont; - pStringSt -> fBeginningOfNewString = fStartOfNewString; - pStringSt -> uiFlags = ubPriority; - + pStringSt->fBeginningOfNewString = fStartOfNewString; + pStringSt->uiFlags = ubPriority; + SetStringNext(pStringSt, NULL); SetStringPrev(pStringSt, NULL); pStringSt->iVideoOverlay=-1; @@ -190,7 +191,7 @@ void SetStringColor(ScrollStringStPtr pStringSt, UINT16 usColor) ScrollStringStPtr GetNextString(ScrollStringStPtr pStringSt) { // returns pointer to next string line - if (pStringSt==NULL) + if (pStringSt==NULL) return NULL; else return pStringSt->pNext; @@ -210,14 +211,14 @@ ScrollStringStPtr GetPrevString(ScrollStringStPtr pStringSt) ScrollStringStPtr SetStringNext(ScrollStringStPtr pStringSt, ScrollStringStPtr pNext) { pStringSt->pNext=pNext; - return pStringSt; + return pStringSt; } ScrollStringStPtr SetStringPrev(ScrollStringStPtr pStringSt, ScrollStringStPtr pPrev) { pStringSt->pPrev=pPrev; - return pStringSt; + return pStringSt; } @@ -229,16 +230,16 @@ BOOLEAN CreateStringVideoOverlay( ScrollStringStPtr pStringSt, UINT16 usX, UINT1 memset( &VideoOverlayDesc, 0, sizeof( VIDEO_OVERLAY_DESC ) ); // SET VIDEO OVERLAY - VideoOverlayDesc.sLeft = usX; - VideoOverlayDesc.sTop = usY; - VideoOverlayDesc.uiFontID = pStringSt->uiFont; - VideoOverlayDesc.ubFontBack = FONT_MCOLOR_BLACK ; - VideoOverlayDesc.ubFontFore = (unsigned char)pStringSt->usColor; - VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; - VideoOverlayDesc.sY = VideoOverlayDesc.sTop; + VideoOverlayDesc.sLeft = usX; + VideoOverlayDesc.sTop = usY; + VideoOverlayDesc.uiFontID = pStringSt->uiFont; + VideoOverlayDesc.ubFontBack = FONT_MCOLOR_BLACK ; + VideoOverlayDesc.ubFontFore = (unsigned char)pStringSt->usColor; + VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; + VideoOverlayDesc.sY = VideoOverlayDesc.sTop; swprintf( VideoOverlayDesc.pzText, pStringSt->pString16 ); VideoOverlayDesc.BltCallback = BlitString; - pStringSt->iVideoOverlay = RegisterVideoOverlay( ( VOVERLAY_DIRTYBYTEXT ), &VideoOverlayDesc ); + pStringSt->iVideoOverlay = RegisterVideoOverlay( ( VOVERLAY_DIRTYBYTEXT ), &VideoOverlayDesc ); if ( pStringSt->iVideoOverlay == -1 ) { @@ -264,7 +265,7 @@ void RemoveStringVideoOverlay( ScrollStringStPtr pStringSt ) } -void SetStringVideoOverlayPosition( ScrollStringStPtr pStringSt, UINT16 usX, UINT16 usY ) +void SetStringVideoOverlayPosition( ScrollStringStPtr pStringSt, UINT16 usX, UINT16 usY ) { VIDEO_OVERLAY_DESC VideoOverlayDesc; @@ -273,11 +274,11 @@ void SetStringVideoOverlayPosition( ScrollStringStPtr pStringSt, UINT16 usX, UI // Donot update if not allocated! if ( pStringSt->iVideoOverlay != -1 ) { - VideoOverlayDesc.uiFlags = VOVERLAY_DESC_POSITION; - VideoOverlayDesc.sLeft = usX; - VideoOverlayDesc.sTop = usY; - VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; - VideoOverlayDesc.sY = VideoOverlayDesc.sTop; + VideoOverlayDesc.uiFlags = VOVERLAY_DESC_POSITION; + VideoOverlayDesc.sLeft = usX; + VideoOverlayDesc.sTop = usY; + VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; + VideoOverlayDesc.sY = VideoOverlayDesc.sTop; UpdateVideoOverlay( &VideoOverlayDesc, pStringSt->iVideoOverlay, FALSE ); } } @@ -285,12 +286,12 @@ void SetStringVideoOverlayPosition( ScrollStringStPtr pStringSt, UINT16 usX, UI void BlitString( VIDEO_OVERLAY *pBlitter ) { - UINT8 *pDestBuf; + UINT8 *pDestBuf; UINT32 uiDestPitchBYTES; - //gprintfdirty(pBlitter->sX,pBlitter->sY, pBlitter->zText); + //gprintfdirty(pBlitter->sX,pBlitter->sY, pBlitter->zText); //RestoreExternBackgroundRect(pBlitter->sX,pBlitter->sY, pBlitter->sX+StringPixLength(pBlitter->zText,pBlitter->uiFontID ), pBlitter->sY+GetFontHeight(pBlitter->uiFontID )); - + if( fScrollMessagesHidden == TRUE ) { return; @@ -305,7 +306,7 @@ void BlitString( VIDEO_OVERLAY *pBlitter ) SetFontShadow( DEFAULT_SHADOW ); mprintf_buffer_coded( pDestBuf, uiDestPitchBYTES, pBlitter->uiFontID, pBlitter->sX, pBlitter->sY, pBlitter->zText ); UnLockVideoSurface( pBlitter->uiDestBuff ); - + } @@ -318,7 +319,7 @@ void EnableStringVideoOverlay( ScrollStringStPtr pStringSt, BOOLEAN fEnable ) if ( pStringSt->iVideoOverlay != -1 ) { VideoOverlayDesc.fDisabled = !fEnable; - VideoOverlayDesc.uiFlags = VOVERLAY_DESC_DISABLED; + VideoOverlayDesc.uiFlags = VOVERLAY_DESC_DISABLED; UpdateVideoOverlay( &VideoOverlayDesc, pStringSt->iVideoOverlay, FALSE ); } } @@ -329,22 +330,22 @@ void ClearDisplayedListOfTacticalStrings( void ) // this function will go through list of display strings and clear them all out UINT32 cnt; - for ( cnt = 0; cnt < MAX_LINE_COUNT; cnt++ ) - { + for ( cnt = 0; cnt < MAX_LINE_COUNT; cnt++ ) + { if ( gpDisplayList[ cnt ] != NULL ) { // CHECK IF WE HAVE AGED - + // Remove our sorry ass RemoveStringVideoOverlay( gpDisplayList[ cnt ] ); MemFree( gpDisplayList[ cnt ]->pString16); MemFree( gpDisplayList[ cnt ] ); - + // Free slot - gpDisplayList[ cnt ] = NULL; + gpDisplayList[ cnt ] = NULL; } - } - + } + return; } @@ -352,15 +353,15 @@ void ClearDisplayedListOfTacticalStrings( void ) void ScrollString( ) { - //ScrollStringStPtr pStringSt = pStringS; UINT32 suiTimer=0; UINT32 cnt; - INT32 iNumberOfNewStrings = 0; // the count of new strings, so we can update position by WIDTH_BETWEEN_NEW_STRINGS pixels in the y + INT32 iNumberOfNewStrings = 0; // the count of new strings, so we can update position by WIDTH_BETWEEN_NEW_STRINGS pixels in the y INT32 iNumberOfMessagesOnQueue = 0; INT32 iMaxAge = 0; BOOLEAN fDitchLastMessage = FALSE; - INT16 iMsgYStart = SCREEN_HEIGHT - 150; + INT16 iMsgYStart = ((UsingNewInventorySystem() == false)) ? SCREEN_HEIGHT - 150 : SCREEN_HEIGHT - 210; + // UPDATE TIMER suiTimer=GetJA2Clock(); @@ -386,7 +387,7 @@ void ScrollString( ) } iNumberOfMessagesOnQueue = GetMessageQueueSize( ); - iMaxAge = MAX_AGE; + iMaxAge = MAX_AGE; if( ( iNumberOfMessagesOnQueue > 0 )&&( gpDisplayList[ MAX_LINE_COUNT - 1 ] != NULL) ) { @@ -398,7 +399,7 @@ void ScrollString( ) } - + if( ( iNumberOfMessagesOnQueue * 1000 ) >= iMaxAge ) { iNumberOfMessagesOnQueue = ( iMaxAge / 1000 ); @@ -407,7 +408,7 @@ void ScrollString( ) { iNumberOfMessagesOnQueue = 0; } - + //AGE for ( cnt = 0; cnt < MAX_LINE_COUNT; cnt++ ) { @@ -418,15 +419,15 @@ void ScrollString( ) gpDisplayList[ cnt ]->uiTimeOfLastUpdate = iMaxAge; } // CHECK IF WE HAVE AGED - if ( ( suiTimer - gpDisplayList[ cnt ]->uiTimeOfLastUpdate ) > ( UINT32 )( iMaxAge - ( 1000 * iNumberOfMessagesOnQueue ) ) ) + if ( ( suiTimer - gpDisplayList[ cnt ]->uiTimeOfLastUpdate ) > ( UINT32 )( iMaxAge - ( 1000 * iNumberOfMessagesOnQueue ) ) ) { // Remove our sorry ass RemoveStringVideoOverlay( gpDisplayList[ cnt ] ); MemFree( gpDisplayList[ cnt ]->pString16); MemFree( gpDisplayList[ cnt ] ); - + // Free slot - gpDisplayList[ cnt ] = NULL; + gpDisplayList[ cnt ] = NULL; } } } @@ -442,57 +443,57 @@ void ScrollString( ) if ( gpDisplayList[ MAX_LINE_COUNT - 1 ] == NULL ) { // MOVE ALL UP! - - // cpy, then move - for( cnt = MAX_LINE_COUNT - 1; cnt > 0; cnt-- ) - { - gpDisplayList[ cnt ] = gpDisplayList[ cnt - 1 ]; - } + + // cpy, then move + for( cnt = MAX_LINE_COUNT - 1; cnt > 0; cnt-- ) + { + gpDisplayList[ cnt ] = gpDisplayList[ cnt - 1 ]; + } // now add in the new string - cnt = 0; - gpDisplayList[ cnt ] = pStringS; - CreateStringVideoOverlay( pStringS, X_START, iMsgYStart ); - if( pStringS -> fBeginningOfNewString == TRUE ) - { - iNumberOfNewStrings++; - } + cnt = 0; + gpDisplayList[ cnt ] = pStringS; + CreateStringVideoOverlay( pStringS, X_START, iMsgYStart ); + if( pStringS->fBeginningOfNewString == TRUE ) + { + iNumberOfNewStrings++; + } + + // set up age + pStringS->uiTimeOfLastUpdate = GetJA2Clock(); + + // now move + for ( cnt = 0; cnt <= MAX_LINE_COUNT - 1; cnt++ ) + { - // set up age - pStringS->uiTimeOfLastUpdate = GetJA2Clock(); - - // now move - for ( cnt = 0; cnt <= MAX_LINE_COUNT - 1; cnt++ ) - { - // Adjust position! - if ( gpDisplayList[ cnt ] != NULL ) + if ( gpDisplayList[ cnt ] != NULL ) { - + SetStringVideoOverlayPosition( gpDisplayList[ cnt ], X_START, (INT16)( ( iMsgYStart - ( ( cnt ) * GetFontHeight( SMALLFONT1 ) ) ) - ( INT16)( WIDTH_BETWEEN_NEW_STRINGS * ( iNumberOfNewStrings ) ) ) ); - + // start of new string, increment count of new strings, for spacing purposes - if( gpDisplayList[ cnt ] -> fBeginningOfNewString == TRUE ) + if( gpDisplayList[ cnt ]->fBeginningOfNewString == TRUE ) { iNumberOfNewStrings++; - } - + } + } - } + } - - // WE NOW HAVE A FREE SPACE, INSERT! - - // Adjust head! - pStringS = pStringS->pNext; - if( pStringS ) - { - pStringS->pPrev = NULL; - } - //check if new meesage we have not seen since mapscreen..if so, beep + // WE NOW HAVE A FREE SPACE, INSERT! + + // Adjust head! + pStringS = pStringS->pNext; + if( pStringS ) + { + pStringS->pPrev = NULL; + } + + //check if new meesage we have not seen since mapscreen..if so, beep if( ( fOkToBeepNewMessage == TRUE ) && ( gpDisplayList[ MAX_LINE_COUNT - 2 ] == NULL ) && ( ( guiCurrentScreen == GAME_SCREEN ) || ( guiCurrentScreen == MAP_SCREEN ) ) && ( gfFacePanelActive == FALSE ) ) { PlayNewMessageSound( ); @@ -528,18 +529,18 @@ void HideMessagesDuringNPCDialogue( void ) VideoOverlayDesc.fDisabled = TRUE; - VideoOverlayDesc.uiFlags = VOVERLAY_DESC_DISABLED; + VideoOverlayDesc.uiFlags = VOVERLAY_DESC_DISABLED; + - fScrollMessagesHidden = TRUE; uiStartOfPauseTime = GetJA2Clock(); - + for ( cnt = 0; cnt < MAX_LINE_COUNT; cnt++ ) { if ( gpDisplayList[ cnt ] != NULL ) { - RestoreExternBackgroundRectGivenID( gVideoOverlays[ gpDisplayList[ cnt ] -> iVideoOverlay ].uiBackground ); - UpdateVideoOverlay( &VideoOverlayDesc, gpDisplayList[ cnt ] -> iVideoOverlay, FALSE ); + RestoreExternBackgroundRectGivenID( gVideoOverlays[ gpDisplayList[ cnt ]->iVideoOverlay ].uiBackground ); + UpdateVideoOverlay( &VideoOverlayDesc, gpDisplayList[ cnt ]->iVideoOverlay, FALSE ); } } @@ -557,15 +558,15 @@ void UnHideMessagesDuringNPCDialogue( void ) VideoOverlayDesc.fDisabled = FALSE; - VideoOverlayDesc.uiFlags = VOVERLAY_DESC_DISABLED; + VideoOverlayDesc.uiFlags = VOVERLAY_DESC_DISABLED; fScrollMessagesHidden = FALSE; - + for ( cnt = 0; cnt < MAX_LINE_COUNT; cnt++ ) { if ( gpDisplayList[ cnt ] != NULL ) { gpDisplayList[ cnt ]->uiTimeOfLastUpdate+= GetJA2Clock() - uiStartOfPauseTime; - UpdateVideoOverlay( &VideoOverlayDesc, gpDisplayList[ cnt ] -> iVideoOverlay, FALSE ); + UpdateVideoOverlay( &VideoOverlayDesc, gpDisplayList[ cnt ]->iVideoOverlay, FALSE ); } } @@ -602,7 +603,7 @@ void ScreenMsg( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ...) #ifndef _DEBUG return; #endif - } + } if( ubPriority == MSG_BETAVERSION ) { @@ -620,12 +621,12 @@ void ScreenMsg( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ...) usColor = TESTVERSION_COLOR; #ifndef JA2TESTVERSION - return; + return; #endif } - va_start(argptr, pStringA); + va_start(argptr, pStringA); vswprintf(DestString, pStringA, argptr); va_end(argptr); @@ -677,7 +678,7 @@ void ClearWrappedStrings( WRAPPED_STRING *pStringWrapperHead ) pDeleteNode = pNode; // set current node as next node - pNode = pNode -> pNextWrappedString; + pNode = pNode->pNextWrappedString; //delete the string MemFree( pDeleteNode->sString ); @@ -700,26 +701,19 @@ void ClearWrappedStrings( WRAPPED_STRING *pStringWrapperHead ) // new tactical and mapscreen message system void TacticalScreenMsg( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ... ) { - // this function sets up the string into several single line structures - + // this function sets up the string into several single line structures + ScrollStringStPtr pStringSt; UINT32 uiFont = TINYFONT1; - //UINT16 usPosition=0; - //UINT16 usCount=0; - //UINT16 usStringLength=0; - //UINT16 usCurrentSPosition=0; - //UINT16 usCurrentLookup=0; //STR16pString; - //BOOLEAN fLastLine=FALSE; - va_list argptr; + va_list argptr; - CHAR16 DestString[512];//, DestStringA[ 512 ]; + CHAR16 DestString[512];//, DestStringA[ 512 ]; //STR16pStringBuffer; - //BOOLEAN fMultiLine=FALSE; - ScrollStringStPtr pTempStringSt=NULL; - WRAPPED_STRING *pStringWrapper=NULL; - WRAPPED_STRING *pStringWrapperHead=NULL; - BOOLEAN fNewString = FALSE; + ScrollStringStPtr pTempStringSt=NULL; + WRAPPED_STRING *pStringWrapper=NULL; + WRAPPED_STRING *pStringWrapperHead=NULL; + BOOLEAN fNewString = FALSE; UINT16 usLineWidthIfWordIsWiderThenWidth=0; @@ -750,7 +744,7 @@ void TacticalScreenMsg( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ... ) usColor = TESTVERSION_COLOR; #ifndef JA2TESTVERSION - return; + return; #endif WriteMessageToFile( DestString ); @@ -767,12 +761,12 @@ void TacticalScreenMsg( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ... ) // return; } - + pStringSt=pStringS; while(GetNextString(pStringSt)) - pStringSt=GetNextString(pStringSt); + pStringSt=GetNextString(pStringSt); - va_start(argptr, pStringA); // Set up variable argument pointer + va_start(argptr, pStringA); // Set up variable argument pointer vswprintf(DestString, pStringA, argptr); // process gprintf string (get output str) va_end(argptr); @@ -801,76 +795,69 @@ void TacticalScreenMsg( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ... ) pStringWrapperHead=LineWrap(uiFont, LINE_WIDTH, &usLineWidthIfWordIsWiderThenWidth, DestString); - pStringWrapper=pStringWrapperHead; + pStringWrapper=pStringWrapperHead; if(!pStringWrapper) - return; - + return; + fNewString = TRUE; while(pStringWrapper->pNextWrappedString!=NULL) { - if(!pStringSt) - { - pStringSt=AddString(pStringWrapper->sString, usColor, uiFont, fNewString, ubPriority ); + if(!pStringSt) + { + pStringSt=AddString(pStringWrapper->sString, usColor, uiFont, fNewString, ubPriority ); fNewString = FALSE; pStringSt->pNext=NULL; pStringSt->pPrev=NULL; - pStringS=pStringSt; - } - else - { - pTempStringSt=AddString(pStringWrapper->sString, usColor, uiFont, fNewString, ubPriority); - fNewString = FALSE; - pTempStringSt->pPrev=pStringSt; - pStringSt->pNext=pTempStringSt; - pStringSt=pTempStringSt; - pTempStringSt->pNext=NULL; - } - pStringWrapper=pStringWrapper->pNextWrappedString; + pStringS=pStringSt; } - pTempStringSt=AddString(pStringWrapper->sString, usColor, uiFont, fNewString, ubPriority ); + else + { + pTempStringSt=AddString(pStringWrapper->sString, usColor, uiFont, fNewString, ubPriority); + fNewString = FALSE; + pTempStringSt->pPrev=pStringSt; + pStringSt->pNext=pTempStringSt; + pStringSt=pTempStringSt; + pTempStringSt->pNext=NULL; + } + pStringWrapper=pStringWrapper->pNextWrappedString; + } + pTempStringSt=AddString(pStringWrapper->sString, usColor, uiFont, fNewString, ubPriority ); if(pStringSt) { - pStringSt->pNext=pTempStringSt; - pTempStringSt->pPrev=pStringSt; - pStringSt=pTempStringSt; - pStringSt->pNext=NULL; + pStringSt->pNext=pTempStringSt; + pTempStringSt->pPrev=pStringSt; + pStringSt=pTempStringSt; + pStringSt->pNext=NULL; } - else + else { pStringSt=pTempStringSt; pStringSt->pNext=NULL; pStringSt->pPrev=NULL; - pStringS=pStringSt; + pStringS=pStringSt; } - + // clear up list of wrapped strings ClearWrappedStrings( pStringWrapperHead ); //LeaveMutex(SCROLL_MESSAGE_MUTEX, __LINE__, __FILE__); return; -} +} void MapScreenMessage( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ... ) { - // this function sets up the string into several single line structures - + // this function sets up the string into several single line structures + ScrollStringStPtr pStringSt; UINT32 uiFont = MAP_SCREEN_MESSAGE_FONT; - //UINT16 usPosition=0; - //UINT16 usCount=0; - //UINT16 usStringLength=0; - //UINT16 usCurrentSPosition=0; - //UINT16 usCurrentLookup=0; //STR16pString; - //BOOLEAN fLastLine=FALSE; - va_list argptr; - CHAR16 DestString[512], DestStringA[ 512 ]; + va_list argptr; + CHAR16 DestString[512], DestStringA[ 512 ]; //STR16pStringBuffer; - //BOOLEAN fMultiLine=FALSE; - WRAPPED_STRING *pStringWrapper=NULL; - WRAPPED_STRING *pStringWrapperHead=NULL; - BOOLEAN fNewString = FALSE; + WRAPPED_STRING *pStringWrapper=NULL; + WRAPPED_STRING *pStringWrapperHead=NULL; + BOOLEAN fNewString = FALSE; UINT16 usLineWidthIfWordIsWiderThenWidth; if( fDisableJustForIan == TRUE ) @@ -906,14 +893,14 @@ void MapScreenMessage( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ... ) usColor = TESTVERSION_COLOR; #ifndef JA2TESTVERSION - return; + return; #endif WriteMessageToFile( DestString ); } // OK, check if we are ani imeediate feedback message, if so, do something else! if ( ubPriority == MSG_UI_FEEDBACK ) { - va_start(argptr, pStringA); // Set up variable argument pointer + va_start(argptr, pStringA); // Set up variable argument pointer vswprintf(DestString, pStringA, argptr); // process gprintf string (get output str) va_end(argptr); @@ -923,7 +910,7 @@ void MapScreenMessage( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ... ) if ( ubPriority == MSG_SKULL_UI_FEEDBACK ) { - va_start(argptr, pStringA); // Set up variable argument pointer + va_start(argptr, pStringA); // Set up variable argument pointer vswprintf(DestString, pStringA, argptr); // process gprintf string (get output str) va_end(argptr); @@ -934,7 +921,7 @@ void MapScreenMessage( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ... ) // check if error if ( ubPriority == MSG_ERROR ) { - va_start(argptr, pStringA); // Set up variable argument pointer + va_start(argptr, pStringA); // Set up variable argument pointer vswprintf(DestString, pStringA, argptr); // process gprintf string (get output str) va_end(argptr); @@ -948,11 +935,11 @@ void MapScreenMessage( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ... ) // OK, check if we are an immediate MAP feedback message, if so, do something else! - if ( ( ubPriority == MSG_MAP_UI_POSITION_UPPER ) || - ( ubPriority == MSG_MAP_UI_POSITION_MIDDLE ) || - ( ubPriority == MSG_MAP_UI_POSITION_LOWER ) ) + if ( ( ubPriority == MSG_MAP_UI_POSITION_UPPER ) || + ( ubPriority == MSG_MAP_UI_POSITION_MIDDLE ) || + ( ubPriority == MSG_MAP_UI_POSITION_LOWER ) ) { - va_start(argptr, pStringA); // Set up variable argument pointer + va_start(argptr, pStringA); // Set up variable argument pointer vswprintf(DestString, pStringA, argptr); // process gprintf string (get output str) va_end(argptr); @@ -970,12 +957,12 @@ void MapScreenMessage( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ... ) // return; } - + pStringSt=pStringS; while(GetNextString(pStringSt)) - pStringSt=GetNextString(pStringSt); + pStringSt=GetNextString(pStringSt); - va_start(argptr, pStringA); // Set up variable argument pointer + va_start(argptr, pStringA); // Set up variable argument pointer vswprintf(DestString, pStringA, argptr); // process gprintf string (get output str) va_end(argptr); @@ -1000,10 +987,10 @@ void MapScreenMessage( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ... ) } pStringWrapperHead=LineWrap(uiFont, MAP_LINE_WIDTH, &usLineWidthIfWordIsWiderThenWidth, DestString); - pStringWrapper=pStringWrapperHead; + pStringWrapper=pStringWrapperHead; if(!pStringWrapper) - return; - + return; + fNewString = TRUE; while(pStringWrapper->pNextWrappedString!=NULL) @@ -1014,7 +1001,7 @@ void MapScreenMessage( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ... ) pStringWrapper=pStringWrapper->pNextWrappedString; } - AddStringToMapScreenMessageList(pStringWrapper->sString, usColor, uiFont, fNewString, ubPriority ); + AddStringToMapScreenMessageList(pStringWrapper->sString, usColor, uiFont, fNewString, ubPriority ); // clear up list of wrapped strings @@ -1033,22 +1020,21 @@ void MapScreenMessage( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ... ) // add string to the map screen message list void AddStringToMapScreenMessageList( STR16 pString, UINT16 usColor, UINT32 uiFont, BOOLEAN fStartOfNewString, UINT8 ubPriority ) { - //UINT8 ubSlotIndex = 0; - ScrollStringStPtr pStringSt = NULL; + ScrollStringStPtr pStringSt = NULL; - pStringSt = (ScrollStringStPtr) MemAlloc(sizeof(ScrollStringSt)); - + pStringSt = (ScrollStringStPtr) MemAlloc(sizeof(ScrollStringSt)); + SetString(pStringSt, pString); - SetStringColor(pStringSt, usColor); + SetStringColor(pStringSt, usColor); pStringSt->uiFont = uiFont; - pStringSt->fBeginningOfNewString = fStartOfNewString; + pStringSt->fBeginningOfNewString = fStartOfNewString; pStringSt->uiFlags = ubPriority; - pStringSt->iVideoOverlay = -1; - + pStringSt->iVideoOverlay = -1; + // next/previous are not used, it's strictly a wraparound queue - SetStringNext(pStringSt, NULL); - SetStringPrev(pStringSt, NULL); + SetStringNext(pStringSt, NULL); + SetStringPrev(pStringSt, NULL); // Figure out which queue slot index we're going to use to store this @@ -1063,7 +1049,7 @@ void AddStringToMapScreenMessageList( STR16 pString, UINT16 usColor, UINT32 uiFo { MemFree( gMapScreenMessageList[ gubEndOfMapScreenMessageList ]->pString16 ); MemFree( gMapScreenMessageList[ gubEndOfMapScreenMessageList ] ); - } + } // store the new message there gMapScreenMessageList[ gubEndOfMapScreenMessageList ] = pStringSt; @@ -1089,6 +1075,9 @@ void DisplayStringsInMapScreenMessageList( void ) //SetFontDestBuffer( FRAME_BUFFER, 17, 360 + 6, 407, 360 + 101, FALSE ); + // CHRISL: Change both X paramters so they dynamically generate from right edge of screen + //SetFontDestBuffer( FRAME_BUFFER, (SCREEN_WIDTH - 509), (SCREEN_HEIGHT - 114), (SCREEN_WIDTH - 233), (SCREEN_HEIGHT - 114) + 101, FALSE ); + // CHRISL: Use this setup if we want message box on the left side SetFontDestBuffer( FRAME_BUFFER, 17, (SCREEN_HEIGHT - 114), 407, (SCREEN_HEIGHT - 114) + 101, FALSE ); SetFont( MAP_SCREEN_MESSAGE_FONT ); // no longer supports variable fonts @@ -1120,6 +1109,9 @@ void DisplayStringsInMapScreenMessageList( void ) SetFontForeground( ( UINT8 )( gMapScreenMessageList[ ubCurrentStringIndex ]->usColor ) ); // print this line + // CHRISL: Change X parameter to dynamically generate from right edge of screen + //mprintf_coded( (SCREEN_WIDTH - 506), sY, gMapScreenMessageList[ ubCurrentStringIndex ]->pString16 ); + // CHRISL: Use this line if we want to display from the left edge mprintf_coded( 20, sY, gMapScreenMessageList[ ubCurrentStringIndex ]->pString16 ); sY = sY + usSpacing; @@ -1140,11 +1132,11 @@ void EnableDisableScrollStringVideoOverlay( BOOLEAN fEnable ) for( bCounter = 0; bCounter < MAX_LINE_COUNT; bCounter++ ) { - + // if valid, enable/disable if( gpDisplayList[ bCounter ] != NULL ) { - EnableVideoOverlay( fEnable ,gpDisplayList[ bCounter ] -> iVideoOverlay ); + EnableVideoOverlay( fEnable ,gpDisplayList[ bCounter ]->iVideoOverlay ); } } @@ -1162,7 +1154,7 @@ void PlayNewMessageSound( void ) { // is sound playing?..don't play new one if( SoundIsPlaying( uiSoundId ) == TRUE ) - { + { return; } } @@ -1230,7 +1222,7 @@ BOOLEAN SaveMapScreenMessagesToSaveGameFile( HWFILE hFile ) return(FALSE); } - // Create the saved string struct + // Create the saved string struct StringSave.uiFont = gMapScreenMessageList[ uiCount ]->uiFont; StringSave.usColor = gMapScreenMessageList[ uiCount ]->usColor; StringSave.fBeginningOfNewString = gMapScreenMessageList[ uiCount ]->fBeginningOfNewString; @@ -1322,7 +1314,7 @@ BOOLEAN LoadMapScreenMessagesFromSaveGameFile( HWFILE hFile ) // There is now message here, add one ScrollStringSt *sScroll; - + sScroll = (ScrollStringSt *) MemAlloc( sizeof( ScrollStringSt ) ); if( sScroll == NULL ) return( FALSE ); @@ -1350,7 +1342,7 @@ BOOLEAN LoadMapScreenMessagesFromSaveGameFile( HWFILE hFile ) return(FALSE); } - // Create the saved string struct + // Create the saved string struct gMapScreenMessageList[ uiCount ]->uiFont = StringSave.uiFont; gMapScreenMessageList[ uiCount ]->usColor = StringSave.usColor; gMapScreenMessageList[ uiCount ]->uiFlags = StringSave.uiFlags; @@ -1378,7 +1370,7 @@ void HandleLastQuotePopUpTimer( void ) } // check if timed out - if( GetJA2Clock() - guiDialogueLastQuoteTime > guiDialogueLastQuoteDelay ) + if( GetJA2Clock() - guiDialogueLastQuoteTime > guiDialogueLastQuoteDelay ) { // done clear up ShutDownLastQuoteTacticalTextBox( ); @@ -1438,7 +1430,7 @@ void ClearTacticalMessageQueue( void ) { pOtherStringSt = pStringSt; pStringSt = pStringSt->pNext; - MemFree( pOtherStringSt-> pString16 ); + MemFree( pOtherStringSt->pString16 ); MemFree( pOtherStringSt ); } @@ -1452,14 +1444,14 @@ void WriteMessageToFile( STR16 pString ) #ifdef JA2BETAVERSION FILE *fp; - + fp = fopen( "DebugMessage.txt", "a" ); - + if( fp == NULL ) { - return; + return; } - + fprintf( fp, "%S\n", pString ); fclose( fp ); @@ -1548,7 +1540,7 @@ UINT8 GetFirstEmptySlotInTheMapScreenMessageList( void ) // find first empty slot in list - if( IsThereAnEmptySlotInTheMapScreenMessageList( ) == FALSE) + if( IsThereAnEmptySlotInTheMapScreenMessageList( ) == FALSE) { ubSlotId = gubEndOfMapScreenMessageList; return( ubSlotId ); @@ -1573,7 +1565,7 @@ UINT8 GetFirstEmptySlotInTheMapScreenMessageList( void ) void SetCurrentMapScreenMessageString( UINT8 ubCurrentStringPosition ) { // will attempt to set current string to this value, or the closest one - UINT8 ubCounter = 0; + UINT8 ubCounter = 0; if( gMapScreenMessageList[ ubCurrentStringPosition ] == NULL ) { @@ -1581,7 +1573,7 @@ void SetCurrentMapScreenMessageString( UINT8 ubCurrentStringPosition ) ubCounter = ubCurrentStringPosition; ubCounter--; - while( ( gMapScreenMessageList[ ubCounter ] == NULL )&&( ubCounter != ubCurrentStringPosition ) ) + while( ( gMapScreenMessageList[ ubCounter ] == NULL )&&( ubCounter != ubCurrentStringPosition ) ) { if( ubCounter == 0 ) { @@ -1623,9 +1615,9 @@ UINT8 GetTheRelativePositionOfCurrentMessage( void ) void MoveCurrentMessagePointerDownList( void ) { // check to see if we can move 'down' to newer messages? - if( gMapScreenMessageList[ ( UINT8 )( gubCurrentMapMessageString + 1 ) ] != NULL ) + if( gMapScreenMessageList[ ( UINT8 )( gubCurrentMapMessageString + 1 ) ] != NULL ) { - if( ( UINT8 ) ( gubCurrentMapMessageString + 1 ) != gubEndOfMapScreenMessageList ) + if( ( UINT8 ) ( gubCurrentMapMessageString + 1 ) != gubEndOfMapScreenMessageList ) { if( ( AreThereASetOfStringsAfterThisIndex( gubCurrentMapMessageString, MAX_MESSAGES_ON_MAP_BOTTOM ) == TRUE ) ) { @@ -1639,7 +1631,7 @@ void MoveCurrentMessagePointerDownList( void ) void MoveCurrentMessagePointerUpList(void ) { // check to see if we can move 'down' to newer messages? - if( gMapScreenMessageList[ ( UINT8 )( gubCurrentMapMessageString - 1 ) ] != NULL ) + if( gMapScreenMessageList[ ( UINT8 )( gubCurrentMapMessageString - 1 ) ] != NULL ) { if( ( UINT8 ) ( gubCurrentMapMessageString - 1 ) != gubEndOfMapScreenMessageList ) { @@ -1665,7 +1657,7 @@ void ScrollToHereInMapScreenMessageList( UINT8 ubPosition ) ubRange += 9; } - ubTestPosition = ( UINT8 )( gubEndOfMapScreenMessageList - ( UINT8 )( ubRange ) + ( ( ( UINT8 )( ubRange ) * ubPosition ) / 256 ) ); + ubTestPosition = ( UINT8 )( gubEndOfMapScreenMessageList - ( UINT8 )( ubRange ) + ( ( ( UINT8 )( ubRange ) * ubPosition ) / 256 ) ); if( AreThereASetOfStringsAfterThisIndex( ubTestPosition, MAX_MESSAGES_ON_MAP_BOTTOM ) == TRUE ) { @@ -1715,9 +1707,9 @@ UINT8 GetCurrentMessageValue( void ) { // return the value of the current message in the list, relative to the start of the list - if( GetRangeOfMapScreenMessages( ) >= 255 ) + if( GetRangeOfMapScreenMessages( ) >= 255 ) { - return( gubCurrentMapMessageString - gubStartOfMapScreenMessageList ); + return( gubCurrentMapMessageString - gubStartOfMapScreenMessageList ); } else { @@ -1729,7 +1721,7 @@ UINT8 GetCurrentMessageValue( void ) UINT8 GetCurrentTempMessageValue( void ) { - if( GetRangeOfMapScreenMessages( ) >= 255 ) + if( GetRangeOfMapScreenMessages( ) >= 255 ) { return( ubTempPosition - gubEndOfMapScreenMessageList ); } @@ -1803,8 +1795,8 @@ void DisplayLastMessage( void ) // set counter to end of list - while( ( gMapScreenMessageList[ ( UINT8 )( ubCounter + 1 ) ] != NULL ) && ( ( UINT8 ) ( ubCounter + 1 ) != gubEndOfMapScreenMessageList ) ) - { + while( ( gMapScreenMessageList[ ( UINT8 )( ubCounter + 1 ) ] != NULL ) && ( ( UINT8 ) ( ubCounter + 1 ) != gubEndOfMapScreenMessageList ) ) + { ubCounter++; } @@ -1827,12 +1819,12 @@ void DisplayLastMessage( void ) // check if message if dialogue if( gMapScreenMessageList[ ubCounter ]->uiFlags == MSG_DIALOG ) { - if( gMapScreenMessageList[ ubCounter ]-> fBeginningOfNewString == TRUE ) + if( gMapScreenMessageList[ ubCounter ]->fBeginningOfNewString == TRUE ) { // yup fNotDone = FALSE; fFound = TRUE; - + // now display message continue; } @@ -1849,7 +1841,7 @@ void DisplayLastMessage( void ) { if( gMapScreenMessageList[ ubCounter ] ) { - if( ( fSecondNewString ) && ( gMapScreenMessageList[ ubCounter ] -> fBeginningOfNewString ) ) + if( ( fSecondNewString ) && ( gMapScreenMessageList[ ubCounter ]-> fBeginningOfNewString ) ) { fNotDone = FALSE; } @@ -1859,7 +1851,7 @@ void DisplayLastMessage( void ) wcscat( sString, L" " ); } - if( ( gMapScreenMessageList[ ubCounter ] -> fBeginningOfNewString ) ) + if( ( gMapScreenMessageList[ ubCounter ]-> fBeginningOfNewString ) ) { fSecondNewString = TRUE; } @@ -1874,7 +1866,7 @@ void DisplayLastMessage( void ) ubCounter++; } // execute text box - ExecuteTacticalTextBoxForLastQuote( ( INT16 )( ( 640 - gusSubtitleBoxWidth ) / 2 ), sString ); + ExecuteTacticalTextBoxForLastQuote( ( INT16 )( ( 640 - gusSubtitleBoxWidth ) / 2 ), sString ); } return; diff --git a/Utils/message.h b/Utils/message.h index e4500be2..85b84594 100644 --- a/Utils/message.h +++ b/Utils/message.h @@ -10,30 +10,30 @@ struct stringstruct{ - STR16 pString16; - INT32 iVideoOverlay; - UINT32 uiFont; - UINT16 usColor; - UINT32 uiFlags; + STR16 pString16; + INT32 iVideoOverlay; + UINT32 uiFont; + UINT16 usColor; + UINT32 uiFlags; BOOLEAN fBeginningOfNewString; - UINT32 uiTimeOfLastUpdate; - UINT32 uiPadding[ 5 ]; - struct stringstruct *pNext; - struct stringstruct *pPrev; + UINT32 uiTimeOfLastUpdate; + UINT32 uiPadding[ 5 ]; + struct stringstruct *pNext; + struct stringstruct *pPrev; }; #define MSG_INTERFACE 0 #define MSG_DIALOG 1 #define MSG_CHAT 2 -#define MSG_DEBUG 3 +#define MSG_DEBUG 3 #define MSG_UI_FEEDBACK 4 -#define MSG_ERROR 5 -#define MSG_BETAVERSION 6 -#define MSG_TESTVERSION 7 -#define MSG_MAP_UI_POSITION_MIDDLE 8 -#define MSG_MAP_UI_POSITION_UPPER 9 -#define MSG_MAP_UI_POSITION_LOWER 10 -#define MSG_SKULL_UI_FEEDBACK 11 +#define MSG_ERROR 5 +#define MSG_BETAVERSION 6 +#define MSG_TESTVERSION 7 +#define MSG_MAP_UI_POSITION_MIDDLE 8 +#define MSG_MAP_UI_POSITION_UPPER 9 +#define MSG_MAP_UI_POSITION_LOWER 10 +#define MSG_SKULL_UI_FEEDBACK 11 // These defines correlate to defines in font.h @@ -43,7 +43,7 @@ struct stringstruct{ typedef struct stringstruct ScrollStringSt; -typedef ScrollStringSt *ScrollStringStPtr; +typedef ScrollStringSt *ScrollStringStPtr; extern ScrollStringStPtr pStringS; diff --git a/aniviewscreen.cpp b/aniviewscreen.cpp index f645fb9e..10fe121e 100644 --- a/aniviewscreen.cpp +++ b/aniviewscreen.cpp @@ -4,26 +4,25 @@ #include "builddefines.h" #include #include - #include - #include "sgp.h" + #include + #include "sgp.h" #include "gameloop.h" #include "himage.h" #include "vobject.h" #include "vobject_private.h" #include "vobject_blitters.h" #include "wcheck.h" - #include "worlddef.h" + #include "worlddef.h" #include "renderworld.h" #include "input.h" - #include "font.h" + #include "font.h" #include "screenids.h" - #include "container.h" + #include "container.h" #include "overhead.h" #include "Isometric Utils.h" #include "sysutil.h" - #include "Font Control.h" + #include "Font Control.h" #include "Radar Screen.h" - #include "Soldier Control.h" #include "Animation Control.h" #include "Animation Data.h" #include "Event Pump.h" @@ -39,6 +38,10 @@ #include "messageboxscreen.h" #endif +//forward declarations of common classes to eliminate includes +class OBJECTTYPE; +class SOLDIERTYPE; + void BuildListFile( ); @@ -63,27 +66,27 @@ void CycleAnimations( ) if ( gAnimControl[ cnt ].ubHeight == ubStartHeight ) { usStartAnim = ( UINT8) cnt; - EVENT_InitNewSoldierAnim( pSoldier, usStartAnim, 0 , TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( usStartAnim, 0 , TRUE ); return; } } usStartAnim = 0; - EVENT_InitNewSoldierAnim( pSoldier, usStartAnim, 0 , TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( usStartAnim, 0 , TRUE ); } UINT32 AniEditScreenInit(void) -{ +{ return TRUE; } - + // The ShutdownGame function will free up/undo all things that were started in InitializeGame() // It will also be responsible to making sure that all Gaming Engine tasks exit properly UINT32 AniEditScreenShutdown(void) -{ +{ return TRUE; } @@ -116,16 +119,16 @@ UINT32 AniEditScreenHandle(void) pSoldier = MercPtrs[ gusSelectedSoldier ]; gTacticalStatus.uiFlags |= LOADING_SAVED_GAME; - - EVENT_InitNewSoldierAnim( pSoldier, usStartAnim, 0 , TRUE ); + + pSoldier->EVENT_InitNewSoldierAnim( usStartAnim, 0 , TRUE ); BuildListFile( ); } - - ///////////////////////////////////////////////////// + + ///////////////////////////////////////////////////// StartFrameBufferRender( ); RenderWorld( ); @@ -185,7 +188,7 @@ UINT32 AniEditScreenHandle(void) if (DequeueEvent(&InputEvent) == TRUE) { if ((InputEvent.usEvent == KEY_DOWN)&&(InputEvent.usParam == ESC)) - { + { fFirstTime = TRUE; gfAniEditMode = FALSE; @@ -201,7 +204,7 @@ UINT32 AniEditScreenHandle(void) fOKFiles = FALSE; - return( GAME_SCREEN ); + return( GAME_SCREEN ); } if ((InputEvent.usEvent == KEY_UP) && (InputEvent.usParam == SPACE )) @@ -236,12 +239,12 @@ UINT32 AniEditScreenHandle(void) usAnim = PRONE; break; } - - EVENT_InitNewSoldierAnim( pSoldier, usAnim, 0 , TRUE ); + + pSoldier->EVENT_InitNewSoldierAnim( usAnim, 0 , TRUE ); } else { - EVENT_InitNewSoldierAnim( pSoldier, usOldState, 0 , TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( usOldState, 0 , TRUE ); } fToggle = !fToggle; @@ -253,11 +256,11 @@ UINT32 AniEditScreenHandle(void) { usOldState = usStartAnim; - EVENT_InitNewSoldierAnim( pSoldier, pusStates[ ubCurLoadedState ], 0 , TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( pusStates[ ubCurLoadedState ], 0 , TRUE ); } else { - EVENT_InitNewSoldierAnim( pSoldier, usOldState, 0 , TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( usOldState, 0 , TRUE ); } fToggle2 = !fToggle2; @@ -275,7 +278,7 @@ UINT32 AniEditScreenHandle(void) ubCurLoadedState = 0; } - EVENT_InitNewSoldierAnim( pSoldier, pusStates[ ubCurLoadedState ], 0 , TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( pusStates[ ubCurLoadedState ], 0 , TRUE ); } } @@ -292,7 +295,7 @@ UINT32 AniEditScreenHandle(void) ubCurLoadedState = ubNumStates; } - EVENT_InitNewSoldierAnim( pSoldier, pusStates[ ubCurLoadedState ], 0 , TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( pusStates[ ubCurLoadedState ], 0 , TRUE ); } } @@ -300,7 +303,7 @@ UINT32 AniEditScreenHandle(void) { // CLEAR! usStartAnim = 0; - EVENT_InitNewSoldierAnim( pSoldier, usStartAnim, 0 , TRUE ); + pSoldier->EVENT_InitNewSoldierAnim( usStartAnim, 0 , TRUE ); } if ((InputEvent.usEvent == KEY_UP) && (InputEvent.usParam == ENTER )) @@ -313,7 +316,7 @@ UINT32 AniEditScreenHandle(void) { ubStartHeight = ANIM_PRONE; } - else + else { ubStartHeight = ANIM_STAND; } @@ -321,7 +324,7 @@ UINT32 AniEditScreenHandle(void) } - + return( ANIEDIT_SCREEN ); } @@ -352,7 +355,7 @@ void BuildListFile( ) int cnt; UINT16 usState; CHAR16 zError[128]; - + //Verify the existance of the header text file. infoFile = fopen( "ANITEST.DAT", "rb"); @@ -368,7 +371,7 @@ void BuildListFile( ) numEntries++; } - fseek( infoFile, 0, SEEK_SET ); //reset header file + fseek( infoFile, 0, SEEK_SET ); //reset header file // Allocate array pusStates = (UINT16 *) MemAlloc( sizeof( UINT16 ) * numEntries ); @@ -401,4 +404,4 @@ void BuildListFile( ) } } -} \ No newline at end of file +} diff --git a/builddefines.h b/builddefines.h index 3c7de8cf..c0654ff9 100644 --- a/builddefines.h +++ b/builddefines.h @@ -11,10 +11,17 @@ //#define JA2EDITOR +//#define SGP_DEBUG + //#define DEBUG_ATTACKBUSY +//#define DEBUGDECISIONS + #define ROBOT_ALWAYS_READY + +#define BLOOD_N_GORE_ENABLED + //#ifdef _DEBUG // #ifndef JA2TESTVERSION // #define JA2TESTVERSION @@ -51,4 +58,4 @@ #include "Profiler.h" -#endif \ No newline at end of file +#endif diff --git a/gameloop.cpp b/gameloop.cpp index 8991d7bd..a1b6b403 100644 --- a/gameloop.cpp +++ b/gameloop.cpp @@ -9,7 +9,7 @@ #include "Gameloop.h" #include "Screens.h" #include "Wcheck.h" - #include "cursors.h" + #include "cursors.h" #include "init.h" #include "music control.h" #include "sys globals.h" @@ -31,11 +31,10 @@ #include "PreBattle Interface.h" #endif -//#include "Console.h" #include "Lua Interpreter.h" // rain -#include "Rain.h" +#include "Rain.h" // end rain @@ -43,7 +42,7 @@ UINT32 guiCurrentScreen; UINT32 guiPendingScreen = NO_PENDING_SCREEN; UINT32 guiPreviousScreen = NO_PENDING_SCREEN; -INT32 giStartingMemValue = 0; +INT32 giStartingMemValue = 0; #define DONT_CHECK_FOR_FREE_SPACE 255 UINT8 gubCheckForFreeSpaceOnHardDriveCount=DONT_CHECK_FOR_FREE_SPACE; @@ -53,7 +52,7 @@ extern BOOLEAN DoSkiMessageBox( UINT8 ubStyle, STR16 zString, UINT32 uiExitScree extern void NotEnoughHardDriveSpaceForQuickSaveMessageBoxCallBack( UINT8 bExitValue ); extern BOOLEAN gfTacticalPlacementGUIActive; extern BOOLEAN gfTacticalPlacementGUIDirty; -extern BOOLEAN gfValidLocationsChanged; +extern BOOLEAN gfValidLocationsChanged; extern BOOLEAN gfInMsgBox; extern void InitSightRange(); //lal @@ -72,13 +71,13 @@ void ReportMapscreenErrorLock() switch( gubReportMapscreenLock ) { case 1: - DoScreenIndependantMessageBox( L"You have just loaded the game which is in a state that you shouldn't be able to. You can still play, but there should be a sector with enemies co-existing with mercs. Please don't report that.", MSG_BOX_FLAG_OK, NULL ); + DoScreenIndependantMessageBox( L"You have just loaded the game which is in a state that you shouldn't be able to. You can still play, but there should be a sector with enemies co-existing with mercs. Please don't report that.", MSG_BOX_FLAG_OK, NULL ); fDisableDueToBattleRoster = FALSE; fDisableMapInterfaceDueToBattle = FALSE; gubReportMapscreenLock = 0; break; case 2: - DoScreenIndependantMessageBox( L"You have just saved the game which is in a state that you shouldn't be able to. Please report circumstances (ex: merc in other sector pipes up about enemies), etc. Autocorrected, but if you reload the save, don't report the error appearing in load.", MSG_BOX_FLAG_OK, NULL ); + DoScreenIndependantMessageBox( L"You have just saved the game which is in a state that you shouldn't be able to. Please report circumstances (ex: merc in other sector pipes up about enemies), etc. Autocorrected, but if you reload the save, don't report the error appearing in load.", MSG_BOX_FLAG_OK, NULL ); fDisableDueToBattleRoster = FALSE; fDisableMapInterfaceDueToBattle = FALSE; gubReportMapscreenLock = 0; @@ -88,7 +87,7 @@ void ReportMapscreenErrorLock() #endif BOOLEAN InitializeGame(void) -{ +{ UINT32 uiIndex; giStartingMemValue = MemGetFree( ); @@ -123,9 +122,9 @@ BOOLEAN InitializeGame(void) // Initialize Game Screens. for (uiIndex = 0; uiIndex < MAX_SCREENS; uiIndex++) - { + { if ((*(GameScreens[uiIndex].InitializeScreen))() == FALSE) - { // Failed to initialize one of the screens. + { // Failed to initialize one of the screens. return FALSE; } } @@ -151,18 +150,18 @@ BOOLEAN InitializeGame(void) // It will also be responsible to making sure that all Gaming Engine tasks exit properly void ShutdownGame(void) -{ +{ // handle shutdown of game with respect to preloaded mapscreen graphics HandleRemovalOfPreLoadedMapGraphics( ); - ShutdownJA2( ); + ShutdownJA2( ); //Save the general save game settings to disk SaveGameSettings(); - //shutdown the file database manager - ShutDownFileDatabase( ); + //shutdown the file database manager + ShutDownFileDatabase( ); //Deletes all the Temp files in the Maps\Temp directory @@ -173,7 +172,7 @@ void ShutdownGame(void) FreeGameExternalOptions(); } - + // This is the main Gameloop. This should eventually be one big switch statement which represents // the state of the game (i.e. Main Menu, PC Generation, Combat loop, etc....) // This function exits constantly and reenters constantly @@ -188,11 +187,11 @@ void GameLoop(void) InputAtom InputEvent; POINT MousePos; UINT32 uiOldScreen=guiCurrentScreen; - clock_t startTime = clock(); // decrease CPU load patch from defrog + //clock_t startTime = clock(); // decrease CPU load patch from defrog //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"GameLoop: get mouse position"); GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! + ScreenToClient(ghWindow, &MousePos); // In window coords! // Hook into mouse stuff for MOVEMENT MESSAGES //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"GameLoop: get mouse hook"); @@ -204,9 +203,9 @@ void GameLoop(void) while (DequeueSpecificEvent(&InputEvent, LEFT_BUTTON_REPEAT|RIGHT_BUTTON_REPEAT|LEFT_BUTTON_DOWN|LEFT_BUTTON_UP|RIGHT_BUTTON_DOWN|RIGHT_BUTTON_UP ) == TRUE ) { // HOOK INTO MOUSE HOOKS - //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GameLoop: mouse event %d", InputEvent.usEvent )); + //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GameLoop: mouse event %d", InputEvent.usEvent )); switch(InputEvent.usEvent) - { + { case LEFT_BUTTON_DOWN: MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; @@ -216,16 +215,16 @@ void GameLoop(void) case RIGHT_BUTTON_DOWN: MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - case RIGHT_BUTTON_UP: + case RIGHT_BUTTON_UP: MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - case LEFT_BUTTON_REPEAT: + case LEFT_BUTTON_REPEAT: MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - case RIGHT_BUTTON_REPEAT: + case RIGHT_BUTTON_REPEAT: MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); break; - } + } } @@ -239,7 +238,7 @@ void GameLoop(void) } /* - // Madd: removed check because it kept coming up for me, even on new games, even though I have 12GB free!! I think the "DoesUserHaveEnoughHardDriveSpace" function is busted. + // Madd: removed check because it kept coming up for me, even on new games, even though I have 12GB free!! I think the "DoesUserHaveEnoughHardDriveSpace" function is busted. //if we are to check for free space on the hard drive //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"GameLoop: check hard drive"); if( gubCheckForFreeSpaceOnHardDriveCount < DONT_CHECK_FOR_FREE_SPACE ) @@ -323,7 +322,7 @@ void GameLoop(void) //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"GameLoop: screen changed"); - uiOldScreen = (*(GameScreens[guiCurrentScreen].HandleScreen))(); + uiOldScreen = (*(GameScreens[guiCurrentScreen].HandleScreen))(); // if the screen has chnaged if( uiOldScreen != guiCurrentScreen ) @@ -374,12 +373,12 @@ void GameLoop(void) #endif //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"GameLoop done"); -} +} void SetCurrentScreen( UINT32 uiNewScreen ) { guiCurrentScreen = uiNewScreen; - (*(GameScreens[guiCurrentScreen].HandleScreen))(); + (*(GameScreens[guiCurrentScreen].HandleScreen))(); } @@ -394,7 +393,7 @@ extern UINT32 guiRainLoop; // Gets called when the screen changes, place any needed in code in here void HandleNewScreenChange( UINT32 uiNewScreen, UINT32 uiOldScreen ) -{ +{ //if we are not going into the message box screen, and we didnt just come from it if( ( uiNewScreen != MSG_BOX_SCREEN && uiOldScreen != MSG_BOX_SCREEN ) ) { @@ -429,7 +428,7 @@ void HandleShortCutExitState( void ) if( guiCurrentScreen == AUTORESOLVE_SCREEN ) { - DoMessageBox( MSG_BOX_BASIC_STYLE, pMessageStrings[ MSG_EXITGAME ], guiCurrentScreen, ( UINT8 ) ( MSG_BOX_FLAG_YESNO | MSG_BOX_FLAG_USE_CENTERING_RECT ), EndGameMessageBoxCallBack, &pCenteringRect ); + DoMessageBox( MSG_BOX_BASIC_STYLE, pMessageStrings[ MSG_EXITGAME ], guiCurrentScreen, ( UINT8 ) ( MSG_BOX_FLAG_YESNO | MSG_BOX_FLAG_USE_CENTERING_RECT ), EndGameMessageBoxCallBack, &pCenteringRect ); return; } @@ -443,7 +442,7 @@ void HandleShortCutExitState( void ) else if( guiCurrentScreen == LAPTOP_SCREEN ) { // set up for laptop - DoLapTopSystemMessageBox( MSG_BOX_LAPTOP_DEFAULT, pMessageStrings[ MSG_EXITGAME ], LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, EndGameMessageBoxCallBack ); + DoLapTopSystemMessageBox( MSG_BOX_LAPTOP_DEFAULT, pMessageStrings[ MSG_EXITGAME ], LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, EndGameMessageBoxCallBack ); } else if( guiCurrentScreen == SHOPKEEPER_SCREEN ) { @@ -470,7 +469,7 @@ void HandleShortCutExitState( void ) } // set up for all otherscreens - DoMessageBox( MSG_BOX_BASIC_STYLE, pMessageStrings[ MSG_EXITGAME ], guiCurrentScreen, ( UINT8 ) ( MSG_BOX_FLAG_YESNO | MSG_BOX_FLAG_USE_CENTERING_RECT ), EndGameMessageBoxCallBack, &pCenteringRect ); + DoMessageBox( MSG_BOX_BASIC_STYLE, pMessageStrings[ MSG_EXITGAME ], guiCurrentScreen, ( UINT8 ) ( MSG_BOX_FLAG_YESNO | MSG_BOX_FLAG_USE_CENTERING_RECT ), EndGameMessageBoxCallBack, &pCenteringRect ); } } @@ -478,7 +477,7 @@ void HandleShortCutExitState( void ) void EndGameMessageBoxCallBack( UINT8 bExitValue ) { // yes, so start over, else stay here and do nothing for now - if( bExitValue == MSG_BOX_RETURN_YES ) + if( bExitValue == MSG_BOX_RETURN_YES ) { gfProgramIsRunning = FALSE; } @@ -487,7 +486,7 @@ void EndGameMessageBoxCallBack( UINT8 bExitValue ) if( gfTacticalPlacementGUIActive ) { gfTacticalPlacementGUIDirty = TRUE; - gfValidLocationsChanged = TRUE; + gfValidLocationsChanged = TRUE; } return; diff --git a/gameloop.h b/gameloop.h index 08bd31f1..b7c7e7b1 100644 --- a/gameloop.h +++ b/gameloop.h @@ -10,8 +10,8 @@ extern BOOLEAN InitializeGame(void); -extern void ShutdownGame(void); -extern void GameLoop(void); +extern void ShutdownGame(void); +extern void GameLoop(void); // handle exit from game due to shortcut key void HandleShortCutExitState( void ); diff --git a/gamescreen.cpp b/gamescreen.cpp index 89e3f7eb..aecb808c 100644 --- a/gamescreen.cpp +++ b/gamescreen.cpp @@ -6,22 +6,22 @@ #include "builddefines.h" #include #include - #include - #include "sgp.h" + #include + #include "sgp.h" #include "gameloop.h" #include "vobject.h" #include "wcheck.h" - #include "worlddef.h" + #include "worlddef.h" #include "renderworld.h" - #include "font.h" + #include "font.h" #include "screenids.h" #include "screens.h" #include "overhead.h" #include "Isometric Utils.h" #include "sysutil.h" - #include "input.h" + #include "input.h" #include "Event Pump.h" - #include "Font Control.h" + #include "Font Control.h" #include "Timer Control.h" #include "Radar Screen.h" #include "Render Dirty.h" @@ -29,7 +29,7 @@ #include "Handle UI.h" #include #include - #include "cursors.h" + #include "cursors.h" #include "vobject_blitters.h" #include "Button System.h" #include "lighting.h" @@ -56,7 +56,7 @@ #include "interface control.h" #include "game clock.h" #include "physics.h" - #include "fade screen.h" + #include "fade screen.h" #include "dialogue control.h" #include "soldier macros.h" #include "faces.h" @@ -92,7 +92,7 @@ #define ARE_IN_FADE_IN( ) ( gfFadeIn || gfFadeInitialized ) BOOLEAN fDirtyRectangleMode = FALSE; -UINT16 *gpFPSBuffer=NULL; +UINT16 *gpFPSBuffer=NULL; // MarkNote // extern ScrollStringStPtr pStringS=NULL; UINT32 counter=0; @@ -146,18 +146,18 @@ BOOLEAN guiTacticalLeaveScreen = FALSE; void HandleModalTactical( ); extern void CheckForDisabledRegionRemove( ); -extern void InternalLocateGridNo( UINT16 sGridNo, BOOLEAN fForce ); +extern void InternalLocateGridNo( INT16 sGridNo, BOOLEAN fForce ); UINT32 MainGameScreenInit(void) -{ +{ VIDEO_OVERLAY_DESC VideoOverlayDesc; UINT32 uiDestPitchBYTES; UINT8 *pDestBuf=NULL; -/* If any 1 have time please calculate how big this buffer should be - * any questions? joker +/* If any 1 have time please calculate how big this buffer should be + * any questions? joker */ pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); gpZBuffer=InitZBuffer( uiDestPitchBYTES, SCREEN_HEIGHT); @@ -174,40 +174,40 @@ UINT32 MainGameScreenInit(void) // Init Video Overlays // FIRST, FRAMERATE - VideoOverlayDesc.sLeft = 0; - VideoOverlayDesc.sTop = 0; - VideoOverlayDesc.uiFontID = SMALLFONT1; - VideoOverlayDesc.ubFontBack = FONT_MCOLOR_BLACK ; - VideoOverlayDesc.ubFontFore = FONT_MCOLOR_DKGRAY ; - VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; - VideoOverlayDesc.sY = VideoOverlayDesc.sTop; + VideoOverlayDesc.sLeft = 0; + VideoOverlayDesc.sTop = 0; + VideoOverlayDesc.uiFontID = SMALLFONT1; + VideoOverlayDesc.ubFontBack = FONT_MCOLOR_BLACK ; + VideoOverlayDesc.ubFontFore = FONT_MCOLOR_DKGRAY ; + VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; + VideoOverlayDesc.sY = VideoOverlayDesc.sTop; swprintf( VideoOverlayDesc.pzText, L"90" ); VideoOverlayDesc.BltCallback = BlitMFont; - giFPSOverlay = RegisterVideoOverlay( ( VOVERLAY_STARTDISABLED | VOVERLAY_DIRTYBYTEXT ), &VideoOverlayDesc ); + giFPSOverlay = RegisterVideoOverlay( ( VOVERLAY_STARTDISABLED | VOVERLAY_DIRTYBYTEXT ), &VideoOverlayDesc ); // SECOND, PERIOD COUNTER - VideoOverlayDesc.sLeft = 30; - VideoOverlayDesc.sTop = 0; - VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; - VideoOverlayDesc.sY = VideoOverlayDesc.sTop; + VideoOverlayDesc.sLeft = 30; + VideoOverlayDesc.sTop = 0; + VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; + VideoOverlayDesc.sY = VideoOverlayDesc.sTop; swprintf( VideoOverlayDesc.pzText, L"Levelnodes: 100000" ); VideoOverlayDesc.BltCallback = BlitMFont; - giCounterPeriodOverlay = RegisterVideoOverlay( ( VOVERLAY_STARTDISABLED | VOVERLAY_DIRTYBYTEXT ), &VideoOverlayDesc ); - + giCounterPeriodOverlay = RegisterVideoOverlay( ( VOVERLAY_STARTDISABLED | VOVERLAY_DIRTYBYTEXT ), &VideoOverlayDesc ); + // register debug topics RegisterJA2DebugTopic( TOPIC_JA2, "Reg JA2 Debug" ); - // MarkNote - - return TRUE; + // MarkNote + + return TRUE; } - + // The ShutdownGame function will free up/undo all things that were started in InitializeGame() // It will also be responsible to making sure that all Gaming Engine tasks exit properly UINT32 MainGameScreenShutdown(void) -{ +{ ShutdownZBuffer(gpZBuffer); ShutdownBackgroundRects(); @@ -237,7 +237,7 @@ void EnterTacticalScreen( ) guiTacticalLeaveScreen = FALSE; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EnterTacticalScreen: setpositionsndsactive")); - SetPositionSndsActive( ); + SetPositionSndsActive( ); // Set pending screen DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EnterTacticalScreen: setpendingnewscreen")); @@ -263,10 +263,10 @@ void EnterTacticalScreen( ) } DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EnterTacticalScreen: who is selected? %d", gusSelectedSoldier)); // ATE: If the current guy is sleeping, change.... - if ( gusSelectedSoldier != NOBODY && MercPtrs[ gusSelectedSoldier ]->fMercAsleep ) + if ( gusSelectedSoldier != NOBODY && MercPtrs[ gusSelectedSoldier ]->flags.fMercAsleep ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EnterTacticalScreen: SelectNextAvailSoldier, merc asleep")); - SelectNextAvailSoldier( MercPtrs[ gusSelectedSoldier ] ); + SelectNextAvailSoldier( MercPtrs[ gusSelectedSoldier ] ); } } else @@ -275,12 +275,12 @@ void EnterTacticalScreen( ) SetCurrentInterfacePanel( (UINT8)TEAM_PANEL ); } - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EnterTacticalScreen:enable viewport region")); + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EnterTacticalScreen:enable viewport region")); if( !gfTacticalPlacementGUIActive ) { MSYS_EnableRegion(&gRadarRegion); } - MSYS_EnableRegion( &gViewportRegion ); + MSYS_EnableRegion( &gViewportRegion ); // set default squad on sector entry // ATE: moved these 2 call after initalizing the interface! @@ -291,7 +291,7 @@ void EnterTacticalScreen( ) DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EnterTacticalScreen: Init Interface")); - // Init interface ( ALWAYS TO TEAM PANEL. DEF changed it to go back to the previous panel ) + // Init interface ( ALWAYS TO TEAM PANEL. DEF changed it to go back to the previous panel ) if( !gfTacticalPlacementGUIActive ) { //make sure the gsCurInterfacePanel is valid @@ -309,7 +309,7 @@ void EnterTacticalScreen( ) SetDefaultSquadOnSectorEntry( FALSE ); ExamineCurrentSquadLights( ); - + fFirstTimeInGameScreen = FALSE; @@ -335,7 +335,7 @@ void EnterTacticalScreen( ) } DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EnterTacticalScreen: clear messages")); - // Clear tactical message q + // Clear tactical message q ClearTacticalMessageQueue( ); // ATE: Enable messages again... @@ -354,15 +354,15 @@ void LeaveTacticalScreen( UINT32 uiNewScreen ) void InternalLeaveTacticalScreen( UINT32 uiNewScreen ) { - gpCustomizableTimerCallback = NULL; + gpCustomizableTimerCallback = NULL; // unload the sector they teleported out of - if ( !gfAutomaticallyStartAutoResolve ) - { - CheckAndHandleUnloadingOfCurrentWorld(); - } + if ( !gfAutomaticallyStartAutoResolve ) + { + CheckAndHandleUnloadingOfCurrentWorld(); + } - SetPositionSndsInActive( ); + SetPositionSndsInActive( ); // Turn off active flag gTacticalStatus.uiFlags &= ( ~ACTIVE ); @@ -373,19 +373,19 @@ void InternalLeaveTacticalScreen( UINT32 uiNewScreen ) //Disable all faces SetAllAutoFacesInactive( ); - + ResetInterfaceAndUI( ); // Remove cursor and reset height.... gsGlobalCursorYOffset = 0; SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); - + // Shutdown panel ShutdownCurrentPanel( ); //disable the radar map MSYS_DisableRegion(&gRadarRegion); - //MSYS_DisableRegion( &gViewportRegion ); + //MSYS_DisableRegion( &gViewportRegion ); // We are leaving... turn off pedning autobadage... SetAutoBandagePending( FALSE ); @@ -393,7 +393,7 @@ void InternalLeaveTacticalScreen( UINT32 uiNewScreen ) // ATE: Disable messages.... DisableScrollMessages( ); - + if ( uiNewScreen == MAINMENU_SCREEN ) { //We want to reinitialize the game @@ -422,12 +422,9 @@ extern INT32 iInterfaceDialogueBox; extern BOOLEAN gfDoDialogOnceGameScreenFadesIn; #endif -UINT32 MainGameScreenHandle(void) +UINT32 MainGameScreenHandle(void) { UINT32 uiNewScreen = GAME_SCREEN; - BOOLEAN fEnterDemoMode = FALSE; - - //DO NOT MOVE THIS FUNCTION CALL!!! //This determines if the help screen should be active // if( ( !gfTacticalDoHeliRun && !gfFirstHeliRun ) && ShouldTheHelpScreenComeUp( HELP_SCREEN_TACTICAL, FALSE ) ) @@ -435,11 +432,11 @@ UINT32 MainGameScreenHandle(void) { // handle the help screen HelpScreenHandler(); - return( GAME_SCREEN ); + return( GAME_SCREEN ); } - + #ifdef JA2BETAVERSION DebugValidateSoldierData( ); #endif @@ -460,10 +457,10 @@ UINT32 MainGameScreenHandle(void) pDestBuf = LockVideoSurface(guiRENDERBUFFER, &uiDestPitchBYTES); - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pData, uiPitch, - 0 , 0, - 0 , 0, + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pData, uiPitch, + 0 , 0, + 0 , 0, 64, 64 ); UnlockMouseBuffer( ); @@ -494,7 +491,7 @@ UINT32 MainGameScreenHandle(void) SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); //Shadow area - ShadowVideoSurfaceRect( FRAME_BUFFER, 0, 0, 640, 480 ); + ShadowVideoSurfaceRect( FRAME_BUFFER, 0, 0, 640, 480 ); InvalidateScreen( ); // Next frame please @@ -515,7 +512,7 @@ UINT32 MainGameScreenHandle(void) */ - // The gfFailedToSaveGameWhenInsideAMessageBox flag will only be set at this point if the game fails to save during + // The gfFailedToSaveGameWhenInsideAMessageBox flag will only be set at this point if the game fails to save during // a quick save and when the game was already in a message box. //If the game failed to save when in a message box, pop up a message box stating an error occured if( gfFailedToSaveGameWhenInsideAMessageBox ) @@ -534,7 +531,7 @@ UINT32 MainGameScreenHandle(void) ExecuteBaseDirtyRectQueue( ); EndFrameBufferRender( ); - + return( GAME_SCREEN ); } @@ -561,9 +558,9 @@ UINT32 MainGameScreenHandle(void) { if ( gTacticalStatus.ubCurrentTeam != gbPlayerNum ) { - AdjustNoAPToFinishMove( MercPtrs[ gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID ], FALSE ); + MercPtrs[ gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID ]->AdjustNoAPToFinishMove( FALSE ); } - MercPtrs[ gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID ]->fPauseAllAnimation = FALSE; + MercPtrs[ gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID ]->flags.fPauseAllAnimation = FALSE; gTacticalStatus.fEnemySightingOnTheirTurn = FALSE; } @@ -651,7 +648,7 @@ UINT32 MainGameScreenHandle(void) ScreenMsg( FONT_ORANGE, MSG_BETAVERSION, L"MAPSCREEN_INTERFACE flag set: Please remember how you entered Tactical." ); #endif } - + if ( HandleFadeOutCallback( ) ) { return( GAME_SCREEN ); @@ -676,9 +673,9 @@ UINT32 MainGameScreenHandle(void) HandleHeliDrop( ); if ( !ARE_IN_FADE_IN( ) ) - { - HandleAutoBandagePending( ); - } + { + HandleAutoBandagePending( ); + } // ATE: CHRIS_C LOOK HERE FOR GETTING AI CONSTANTLY GOING @@ -709,7 +706,7 @@ UINT32 MainGameScreenHandle(void) // Handle Interface uiNewScreen = HandleTacticalUI( ); - + // called to handle things like face panels changeing due to team panel, squad changes, etc // To be done AFTER HandleUI and before ExecuteOverlays( ) HandleDialogueUIAdjustments( ); @@ -742,14 +739,14 @@ UINT32 MainGameScreenHandle(void) } - - ///////////////////////////////////////////////////// + + ///////////////////////////////////////////////////// StartFrameBufferRender( ); HandleTopMessages( ); if ( gfScrollPending || gfScrollInertia ) - { + { } else { @@ -781,7 +778,7 @@ UINT32 MainGameScreenHandle(void) } #ifdef NETWORKED - // DEF: Test Code + // DEF: Test Code PrintNetworkInfo(); #endif @@ -793,7 +790,7 @@ UINT32 MainGameScreenHandle(void) { SetFont( MILITARYFONT1 ); SetFontBackground( FONT_MCOLOR_BLACK ); - SetFontForeground( FONT_MCOLOR_LTGREEN ); + SetFontForeground( FONT_MCOLOR_LTGREEN ); mprintf( 0, 0, L"IN CONVERSATION %d", giNPCReferenceCount ); gprintfdirty( 0, 0, L"IN CONVERSATION %d", giNPCReferenceCount ); @@ -805,7 +802,7 @@ UINT32 MainGameScreenHandle(void) { SetFont( MILITARYFONT1 ); SetFontBackground( FONT_MCOLOR_BLACK ); - SetFontForeground( FONT_MCOLOR_LTGREEN ); + SetFontForeground( FONT_MCOLOR_LTGREEN ); mprintf( 0, 10, L"Game Clock Paused" ); gprintfdirty( 0, 10, L"Game Clock Paused" ); @@ -822,7 +819,7 @@ UINT32 MainGameScreenHandle(void) SetFont( MILITARYFONT1 ); SetFontBackground( FONT_MCOLOR_BLACK ); - SetFontForeground( FONT_MCOLOR_LTGREEN ); + SetFontForeground( FONT_MCOLOR_LTGREEN ); mprintf( 0, 15, L"Attacker Busy Count: %d", gTacticalStatus.ubAttackBusyCount ); gprintfdirty( 0, 15, L"Attacker Busy Count: %d", gTacticalStatus.ubAttackBusyCount ); @@ -839,14 +836,14 @@ UINT32 MainGameScreenHandle(void) gprintfdirty( 0, 25, L"Schedules: %d", iSchedules ); } #endif - - + + // Render view window RenderRadarScreen( ); - + ResetInterface( ); - if ( gfScrollPending ) + if ( gfScrollPending ) { DeleteVideoOverlaysArea( ); AllocateVideoOverlaysArea( ); @@ -871,7 +868,7 @@ UINT32 MainGameScreenHandle(void) if ( gusSelectedSoldier != NOBODY ) { if( !gGameSettings.fOptions[ TOPTION_MUTE_CONFIRMATIONS ] ) - DoMercBattleSound( MercPtrs[ gusSelectedSoldier ], BATTLE_SOUND_ATTN1 ); + MercPtrs[ gusSelectedSoldier ]->DoMercBattleSound( BATTLE_SOUND_ATTN1 ); } } @@ -889,8 +886,8 @@ UINT32 MainGameScreenHandle(void) CheckForMeanwhileOKStart( ); - ScrollString( ); - + ScrollString( ); + ExecuteBaseDirtyRectQueue( ); //KillBackgroundRects( ); @@ -914,7 +911,7 @@ UINT32 MainGameScreenHandle(void) if ( guiTacticalLeaveScreen ) { guiTacticalLeaveScreen = FALSE; - + InternalLeaveTacticalScreen( guiTacticalLeaveScreenID ); } @@ -930,8 +927,8 @@ UINT32 MainGameScreenHandle(void) if ( gfEnteringMapScreen > 0 ) { gfEnteringMapScreen++; - } - + } + return( GAME_SCREEN ); } @@ -952,7 +949,7 @@ void DisableFPSOverlay( BOOLEAN fEnable ) VideoOverlayDesc.fDisabled = fEnable; - VideoOverlayDesc.uiFlags = VOVERLAY_DESC_DISABLED; + VideoOverlayDesc.uiFlags = VOVERLAY_DESC_DISABLED; UpdateVideoOverlay( &VideoOverlayDesc, giFPSOverlay, FALSE ); UpdateVideoOverlay( &VideoOverlayDesc, giCounterPeriodOverlay, FALSE ); @@ -985,7 +982,7 @@ void TacticalScreenLocateToSoldier( ) cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) - { + { if ( OK_CONTROLLABLE_MERC( pSoldier ) && OK_INTERRUPT_MERC( pSoldier ) ) { LocateSoldier( pSoldier->ubID, 10 ); @@ -995,7 +992,7 @@ void TacticalScreenLocateToSoldier( ) } } } - + void EnterMapScreen( ) { // ATE: These flags well get set later on in mapscreen.... @@ -1017,8 +1014,8 @@ void UpdateTeamPanelAssignments( ) // Set locator to first merc cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) - { + for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) + { // Setup team interface CheckForAndAddMercToTeamPanel( pSoldier ); } @@ -1038,7 +1035,7 @@ void EnterModalTactical( INT8 bMode ) gfTacticalDisableRegionActive = TRUE; MSYS_DefineRegion( &gTacticalDisableRegion, 0, 0 ,SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGH, - VIDEO_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + VIDEO_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); // Add region MSYS_AddRegion( &gTacticalDisableRegion ); } @@ -1051,11 +1048,11 @@ void EnterModalTactical( INT8 bMode ) void EndModalTactical( ) { if ( gfTacticalDisableRegionActive ) - { + { MSYS_RemoveRegion( &gTacticalDisableRegion ); gfTacticalDisableRegionActive = FALSE; - } + } if ( gModalDoneCallback != NULL ) @@ -1067,7 +1064,7 @@ void EndModalTactical( ) gfTacticalIsModal = FALSE; - SetRenderFlags( RENDER_FLAG_FULL ); + SetRenderFlags( RENDER_FLAG_FULL ); } @@ -1077,8 +1074,8 @@ void HandleModalTactical( ) RestoreBackgroundRects(); - - RenderWorld( ); + + RenderWorld( ); RenderRadarScreen( ); ExecuteVideoOverlays( ); @@ -1132,7 +1129,7 @@ void InitHelicopterEntranceByMercs( void ) AirRaidDef.uiFlags = AIR_RAID_BEGINNING_GAME; AirRaidDef.ubNumMinsFromCurrentTime = Random(5) + 1; - // Madd - nevermind initial air strike. It just seems silly, since Deidranna doesn't know the mercs are there. + // Madd - nevermind initial air strike. It just seems silly, since Deidranna doesn't know the mercs are there. //if ( gGameOptions.fAirStrikes ) // ScheduleAirRaid( &AirRaidDef ); diff --git a/ja2_2005Express.sln b/ja2_2005Express.sln index 5d4e973c..1852c685 100644 --- a/ja2_2005Express.sln +++ b/ja2_2005Express.sln @@ -38,51 +38,74 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 + MapEditor|Win32 = MapEditor|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {F44669E7-74AC-444B-B75F-F16F4B9F0265}.Debug|Win32.ActiveCfg = Debug|Win32 {F44669E7-74AC-444B-B75F-F16F4B9F0265}.Debug|Win32.Build.0 = Debug|Win32 + {F44669E7-74AC-444B-B75F-F16F4B9F0265}.MapEditor|Win32.ActiveCfg = MapEditor|Win32 + {F44669E7-74AC-444B-B75F-F16F4B9F0265}.MapEditor|Win32.Build.0 = MapEditor|Win32 {F44669E7-74AC-444B-B75F-F16F4B9F0265}.Release|Win32.ActiveCfg = Release|Win32 {F44669E7-74AC-444B-B75F-F16F4B9F0265}.Release|Win32.Build.0 = Release|Win32 {60D793F2-90B4-43C9-83B5-221EE11B37E6}.Debug|Win32.ActiveCfg = Debug|Win32 {60D793F2-90B4-43C9-83B5-221EE11B37E6}.Debug|Win32.Build.0 = Debug|Win32 + {60D793F2-90B4-43C9-83B5-221EE11B37E6}.MapEditor|Win32.ActiveCfg = MapEditor|Win32 + {60D793F2-90B4-43C9-83B5-221EE11B37E6}.MapEditor|Win32.Build.0 = MapEditor|Win32 {60D793F2-90B4-43C9-83B5-221EE11B37E6}.Release|Win32.ActiveCfg = Release|Win32 {60D793F2-90B4-43C9-83B5-221EE11B37E6}.Release|Win32.Build.0 = Release|Win32 {5234CD2E-97F1-42FF-828D-CE0A1B46805E}.Debug|Win32.ActiveCfg = Debug|Win32 {5234CD2E-97F1-42FF-828D-CE0A1B46805E}.Debug|Win32.Build.0 = Debug|Win32 + {5234CD2E-97F1-42FF-828D-CE0A1B46805E}.MapEditor|Win32.ActiveCfg = MapEditor|Win32 + {5234CD2E-97F1-42FF-828D-CE0A1B46805E}.MapEditor|Win32.Build.0 = MapEditor|Win32 {5234CD2E-97F1-42FF-828D-CE0A1B46805E}.Release|Win32.ActiveCfg = Release|Win32 {5234CD2E-97F1-42FF-828D-CE0A1B46805E}.Release|Win32.Build.0 = Release|Win32 {A83DA7DA-2C31-45D8-9A69-B4993A885E76}.Debug|Win32.ActiveCfg = Debug|Win32 {A83DA7DA-2C31-45D8-9A69-B4993A885E76}.Debug|Win32.Build.0 = Debug|Win32 + {A83DA7DA-2C31-45D8-9A69-B4993A885E76}.MapEditor|Win32.ActiveCfg = MapEditor|Win32 + {A83DA7DA-2C31-45D8-9A69-B4993A885E76}.MapEditor|Win32.Build.0 = MapEditor|Win32 {A83DA7DA-2C31-45D8-9A69-B4993A885E76}.Release|Win32.ActiveCfg = Release|Win32 {A83DA7DA-2C31-45D8-9A69-B4993A885E76}.Release|Win32.Build.0 = Release|Win32 {6283CE93-2960-4596-8E74-7A6FBA8716FF}.Debug|Win32.ActiveCfg = Debug|Win32 {6283CE93-2960-4596-8E74-7A6FBA8716FF}.Debug|Win32.Build.0 = Debug|Win32 + {6283CE93-2960-4596-8E74-7A6FBA8716FF}.MapEditor|Win32.ActiveCfg = MapEditor|Win32 + {6283CE93-2960-4596-8E74-7A6FBA8716FF}.MapEditor|Win32.Build.0 = MapEditor|Win32 {6283CE93-2960-4596-8E74-7A6FBA8716FF}.Release|Win32.ActiveCfg = Release|Win32 {6283CE93-2960-4596-8E74-7A6FBA8716FF}.Release|Win32.Build.0 = Release|Win32 {AB8837DB-0435-40C7-916A-0AACF5CFF1C4}.Debug|Win32.ActiveCfg = Debug|Win32 {AB8837DB-0435-40C7-916A-0AACF5CFF1C4}.Debug|Win32.Build.0 = Debug|Win32 + {AB8837DB-0435-40C7-916A-0AACF5CFF1C4}.MapEditor|Win32.ActiveCfg = MapEditor|Win32 + {AB8837DB-0435-40C7-916A-0AACF5CFF1C4}.MapEditor|Win32.Build.0 = MapEditor|Win32 {AB8837DB-0435-40C7-916A-0AACF5CFF1C4}.Release|Win32.ActiveCfg = Release|Win32 {AB8837DB-0435-40C7-916A-0AACF5CFF1C4}.Release|Win32.Build.0 = Release|Win32 {D4BDA6AD-9B61-4953-892D-DA3F8CC7E096}.Debug|Win32.ActiveCfg = Debug|Win32 {D4BDA6AD-9B61-4953-892D-DA3F8CC7E096}.Debug|Win32.Build.0 = Debug|Win32 + {D4BDA6AD-9B61-4953-892D-DA3F8CC7E096}.MapEditor|Win32.ActiveCfg = MapEditor|Win32 + {D4BDA6AD-9B61-4953-892D-DA3F8CC7E096}.MapEditor|Win32.Build.0 = MapEditor|Win32 {D4BDA6AD-9B61-4953-892D-DA3F8CC7E096}.Release|Win32.ActiveCfg = Release|Win32 {D4BDA6AD-9B61-4953-892D-DA3F8CC7E096}.Release|Win32.Build.0 = Release|Win32 {27A49DAF-3F5A-4FF2-B943-9559F0B63032}.Debug|Win32.ActiveCfg = Debug|Win32 {27A49DAF-3F5A-4FF2-B943-9559F0B63032}.Debug|Win32.Build.0 = Debug|Win32 + {27A49DAF-3F5A-4FF2-B943-9559F0B63032}.MapEditor|Win32.ActiveCfg = MapEditor|Win32 + {27A49DAF-3F5A-4FF2-B943-9559F0B63032}.MapEditor|Win32.Build.0 = MapEditor|Win32 {27A49DAF-3F5A-4FF2-B943-9559F0B63032}.Release|Win32.ActiveCfg = Release|Win32 {27A49DAF-3F5A-4FF2-B943-9559F0B63032}.Release|Win32.Build.0 = Release|Win32 {FC1938E8-9253-49A8-AA99-4639BBB46C1B}.Debug|Win32.ActiveCfg = Debug|Win32 {FC1938E8-9253-49A8-AA99-4639BBB46C1B}.Debug|Win32.Build.0 = Debug|Win32 + {FC1938E8-9253-49A8-AA99-4639BBB46C1B}.MapEditor|Win32.ActiveCfg = MapEditor|Win32 + {FC1938E8-9253-49A8-AA99-4639BBB46C1B}.MapEditor|Win32.Build.0 = MapEditor|Win32 {FC1938E8-9253-49A8-AA99-4639BBB46C1B}.Release|Win32.ActiveCfg = Release|Win32 {FC1938E8-9253-49A8-AA99-4639BBB46C1B}.Release|Win32.Build.0 = Release|Win32 {262A5F80-0B99-4E8E-A6C7-74CB1FD0A67C}.Debug|Win32.ActiveCfg = Debug|Win32 {262A5F80-0B99-4E8E-A6C7-74CB1FD0A67C}.Debug|Win32.Build.0 = Debug|Win32 + {262A5F80-0B99-4E8E-A6C7-74CB1FD0A67C}.MapEditor|Win32.ActiveCfg = MapEditor|Win32 + {262A5F80-0B99-4E8E-A6C7-74CB1FD0A67C}.MapEditor|Win32.Build.0 = MapEditor|Win32 {262A5F80-0B99-4E8E-A6C7-74CB1FD0A67C}.Release|Win32.ActiveCfg = Release|Win32 {262A5F80-0B99-4E8E-A6C7-74CB1FD0A67C}.Release|Win32.Build.0 = Release|Win32 {F962CFA1-2215-4124-938F-253973A27591}.Debug|Win32.ActiveCfg = Debug|Win32 {F962CFA1-2215-4124-938F-253973A27591}.Debug|Win32.Build.0 = Debug|Win32 + {F962CFA1-2215-4124-938F-253973A27591}.MapEditor|Win32.ActiveCfg = MapEditor|Win32 + {F962CFA1-2215-4124-938F-253973A27591}.MapEditor|Win32.Build.0 = MapEditor|Win32 {F962CFA1-2215-4124-938F-253973A27591}.Release|Win32.ActiveCfg = Release|Win32 {F962CFA1-2215-4124-938F-253973A27591}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection diff --git a/ja2_2005Express.vcproj b/ja2_2005Express.vcproj index 610096a1..bb86d3c8 100644 --- a/ja2_2005Express.vcproj +++ b/ja2_2005Express.vcproj @@ -1,7 +1,7 @@ + + + + + + + + + + + + + + + + + + + + @@ -241,6 +322,10 @@ RelativePath=".\jascreens.cpp" > + + @@ -436,6 +521,14 @@ AdditionalIncludeDirectories=".\Res" /> + + + diff --git a/ja2_2005ExpressEditor.vsprops b/ja2_2005ExpressEditor.vsprops new file mode 100644 index 00000000..411c849d --- /dev/null +++ b/ja2_2005ExpressEditor.vsprops @@ -0,0 +1,11 @@ + + + + diff --git a/jascreens.cpp b/jascreens.cpp index fc769d20..bf7561ae 100644 --- a/jascreens.cpp +++ b/jascreens.cpp @@ -18,7 +18,7 @@ #include "mousesystem.h" #include "screenids.h" #include "screens.h" - #include "Font Control.h" + #include "Font Control.h" #include "sysutil.h" #include "renderworld.h" #include "tiledef.h" @@ -26,7 +26,7 @@ #include "editscreen.h" #include #include - #include "Timer Control.h" + #include "Timer Control.h" #include "Sys Globals.h" #include "interface.h" #include "overhead.h" @@ -41,7 +41,6 @@ #include "lighting.h" #include "interface panels.h" #include "Music Control.h" - #include "Sound Control.h" #include "mainmenuscreen.h" #include "Game Init.h" #include "init.h" @@ -76,9 +75,9 @@ extern BOOLEAN gfAmINetworked; #define MAX_DEBUG_PAGES 4 -// GLOBAL FOR PAL EDITOR -UINT8 CurrentPalette = 0; -UINT32 guiBackgroundRect; +// GLOBAL FOR PAL EDITOR +UINT8 CurrentPalette = 0; +UINT32 guiBackgroundRect; BOOLEAN gfExitPalEditScreen = FALSE; BOOLEAN gfExitDebugScreen = FALSE; BOOLEAN gfInitRect = TRUE; @@ -87,10 +86,10 @@ BOOLEAN gfDoneWithSplashScreen = FALSE; -void PalEditRenderHook( ); +void PalEditRenderHook( ); BOOLEAN PalEditKeyboardHook( InputAtom *pInputEvent ); -void DebugRenderHook( ); +void DebugRenderHook( ); BOOLEAN DebugKeyboardHook( InputAtom *pInputEvent ); INT8 gCurDebugPage = 0; @@ -107,17 +106,17 @@ void DefaultDebugPage1( ); void DefaultDebugPage2( ); void DefaultDebugPage3( ); void DefaultDebugPage4( ); -RENDER_HOOK gDebugRenderOverride[ MAX_DEBUG_PAGES ] = -{ (RENDER_HOOK)DefaultDebugPage1, (RENDER_HOOK)DefaultDebugPage2, - (RENDER_HOOK)DefaultDebugPage3, (RENDER_HOOK)DefaultDebugPage4 }; +RENDER_HOOK gDebugRenderOverride[ MAX_DEBUG_PAGES ] = +{ (RENDER_HOOK)DefaultDebugPage1, (RENDER_HOOK)DefaultDebugPage2, + (RENDER_HOOK)DefaultDebugPage3, (RENDER_HOOK)DefaultDebugPage4 }; extern HVSURFACE ghFrameBuffer; void DisplayFrameRate( ) { static UINT32 uiFPS = 0; - static UINT32 uiFrameCount = 0; - UINT16 usMapPos; + static UINT32 uiFrameCount = 0; + INT16 sMapPos; VIDEO_OVERLAY_DESC VideoOverlayDesc; // Increment frame count @@ -128,7 +127,7 @@ void DisplayFrameRate( ) // Reset counter RESETCOUNTER( FPSCOUNTER ); - uiFPS = uiFrameCount; + uiFPS = uiFrameCount; uiFrameCount = 0; } @@ -136,16 +135,16 @@ void DisplayFrameRate( ) SetFont( SMALLFONT1 ); //DebugMsg(TOPIC_JA2, DBG_LEVEL_0, String( "FPS: %d ", __min( uiFPS, 1000 ) ) ); - + if ( uiFPS < 20 ) { SetFontBackground( FONT_MCOLOR_BLACK ); - SetFontForeground( FONT_MCOLOR_LTRED ); + SetFontForeground( FONT_MCOLOR_LTRED ); } else { SetFontBackground( FONT_MCOLOR_BLACK ); - SetFontForeground( FONT_MCOLOR_DKGRAY ); + SetFontForeground( FONT_MCOLOR_DKGRAY ); } if ( gbFPSDisplay == SHOW_FULL_FPS ) @@ -153,24 +152,24 @@ void DisplayFrameRate( ) // FRAME RATE memset( &VideoOverlayDesc, 0, sizeof( VideoOverlayDesc ) ); swprintf( VideoOverlayDesc.pzText, L"%ld", __min( uiFPS, 1000 ) ); - VideoOverlayDesc.uiFlags = VOVERLAY_DESC_TEXT; + VideoOverlayDesc.uiFlags = VOVERLAY_DESC_TEXT; UpdateVideoOverlay( &VideoOverlayDesc, giFPSOverlay, FALSE ); - // TIMER COUNTER + // TIMER COUNTER swprintf( VideoOverlayDesc.pzText, L"%ld", __min( giTimerDiag, 1000 ) ); - VideoOverlayDesc.uiFlags = VOVERLAY_DESC_TEXT; + VideoOverlayDesc.uiFlags = VOVERLAY_DESC_TEXT; UpdateVideoOverlay( &VideoOverlayDesc, giCounterPeriodOverlay, FALSE ); - - if( GetMouseMapPos( &usMapPos) ) + + if( GetMouseMapPos( &sMapPos) ) { - //gprintfdirty( 0, 315, L"(%d)",usMapPos); - //mprintf( 0,315,L"(%d)",usMapPos); + //gprintfdirty( 0, 315, L"(%d)",sMapPos); + //mprintf( 0,315,L"(%d)",sMapPos); } else { - //gprintfdirty( 0, 315, L"(%d %d)",gusMouseXPos, gusMouseYPos - INTERFACE_START_Y ); - //mprintf( 0,315,L"(%d %d)",gusMouseXPos, gusMouseYPos - INTERFACE_START_Y ); + //gprintfdirty( 0, 315, L"(%d %d)",gusMouseXPos, gusMouseYPos - INTERFACE_START_Y ); + //mprintf( 0,315,L"(%d %d)",gusMouseXPos, gusMouseYPos - INTERFACE_START_Y ); } } @@ -178,7 +177,7 @@ void DisplayFrameRate( ) { SetFont( SMALLFONT1 ); SetFontBackground( FONT_MCOLOR_BLACK ); - SetFontForeground( FONT_MCOLOR_DKRED ); + SetFontForeground( FONT_MCOLOR_DKRED ); //gprintfdirty( 0, 0, L"GOD MODE" ); //mprintf( 0, 0, L"GOD MODE" ); } @@ -187,7 +186,7 @@ void DisplayFrameRate( ) { SetFont( SMALLFONT1 ); SetFontBackground( FONT_MCOLOR_BLACK ); - SetFontForeground( FONT_MCOLOR_DKGRAY ); + SetFontForeground( FONT_MCOLOR_DKGRAY ); //gprintfdirty( 0, 0, L"DEMO MODE" ); //mprintf( 0, 0, L"DEMO MODE" ); } @@ -196,11 +195,11 @@ void DisplayFrameRate( ) SetFont( SMALLFONT1 ); SetFontBackground( FONT_MCOLOR_BLACK ); - SetFontForeground( FONT_MCOLOR_DKGRAY ); + SetFontForeground( FONT_MCOLOR_DKGRAY ); if ( gbFPSDisplay == SHOW_FULL_FPS ) { - // Debug + // Debug if (gDebugStr[0] != '\0') { //gprintfdirty( 0, 345, L"DEBUG: %S",gDebugStr); @@ -260,11 +259,11 @@ UINT32 LoadingScreenShutdown(void) UINT32 ErrorScreenInitialize(void) { return( TRUE ); -} +} UINT32 ErrorScreenHandle(void) { - InputAtom InputEvent; + InputAtom InputEvent; static BOOLEAN fFirstTime = FALSE; #ifdef JA2BETAVERSION CHAR16 str[256]; @@ -282,19 +281,19 @@ UINT32 ErrorScreenHandle(void) mprintf( 50, 225, L"PRESS TO EXIT" ); SetFont( FONT12ARIAL ); - SetFontForeground( FONT_YELLOW ); - SetFontShadow( 60 ); //60 is near black + SetFontForeground( FONT_YELLOW ); + SetFontShadow( 60 ); //60 is near black mprintf( 50, 255, L"%S", gubErrorText ); - SetFontForeground( FONT_LTRED ); + SetFontForeground( FONT_LTRED ); #ifdef JA2BETAVERSION - - if( gubAssertString[0] ) - { - swprintf( str, L"%S", gubAssertString ); - DisplayWrappedString( 50, 270, 560, 2, FONT12ARIAL, FONT_RED, str, FONT_BLACK, TRUE, LEFT_JUSTIFIED ); - } + + if( gubAssertString[0] ) + { + swprintf( str, L"%S", gubAssertString ); + DisplayWrappedString( 50, 270, 560, 2, FONT12ARIAL, FONT_RED, str, FONT_BLACK, TRUE, LEFT_JUSTIFIED ); + } #endif if ( !fFirstTime ) @@ -307,17 +306,17 @@ UINT32 ErrorScreenHandle(void) InvalidateScreen( ); EndFrameBufferRender( ); - // Check for esc - while (DequeueEvent(&InputEvent) == TRUE) - { - if( InputEvent.usEvent == KEY_DOWN ) + // Check for esc + while (DequeueEvent(&InputEvent) == TRUE) + { + if( InputEvent.usEvent == KEY_DOWN ) { if( InputEvent.usParam == ESC || InputEvent.usParam == 'x' && InputEvent.usKeyState & ALT_DOWN ) { // Exit the program DebugMsg(TOPIC_GAME, DBG_LEVEL_0, "GameLoop: User pressed ESCape, TERMINATING"); - + // handle shortcut exit - HandleShortCutExitState( ); + HandleShortCutExitState( ); } } } @@ -335,7 +334,7 @@ UINT32 ErrorScreenShutdown(void) UINT32 InitScreenInitialize(void) { return( TRUE ); -} +} UINT32 InitScreenHandle(void) { @@ -403,19 +402,19 @@ UINT32 InitScreenHandle(void) mprintf( 10, 0, L"(LIMITED PRESS PREVIEW VERSION)" ); -#elif defined JA2BETAVERSION +#elif defined JA2BETAVERSION mprintf( 10, 0, L"(Beta version error reporting enabled)" ); #endif -#ifdef _DEBUG +#ifdef _DEBUG mprintf( 10, 20, L"SOLDIERTYPE: %d bytes", sizeof( SOLDIERTYPE ) ); #endif if ( gfDontUseDDBlits ) { - #ifdef _DEBUG + #ifdef _DEBUG mprintf( 10, 10, L"SOLDIERTYPE: %d bytes", sizeof( SOLDIERTYPE ) ); #else mprintf( 10, 20, L"Using software blitters" ); @@ -429,7 +428,7 @@ UINT32 InitScreenHandle(void) #ifdef RUSSIAN if( hVSurface ) #endif - DeleteVideoSurface( hVSurface ); + DeleteVideoSurface( hVSurface ); //ATE: Set to true to reset before going into main screen! SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); @@ -493,7 +492,7 @@ UINT32 PalEditScreenHandle(void) SetUIKeyboardHook( (UIKEYBOARD_HOOK)NULL ); return( GAME_SCREEN ); } - + if ( FirstTime ) { FirstTime = FALSE; @@ -522,7 +521,7 @@ UINT32 PalEditScreenShutdown(void) } -void PalEditRenderHook( ) +void PalEditRenderHook( ) { SOLDIERTYPE *pSoldier; @@ -553,14 +552,14 @@ BOOLEAN PalEditKeyboardHook( InputAtom *pInputEvent ) return( FALSE ); } - if ((pInputEvent->usEvent == KEY_DOWN )&& ( pInputEvent->usParam == ESC )) - { + if ((pInputEvent->usEvent == KEY_DOWN )&& ( pInputEvent->usParam == ESC )) + { gfExitPalEditScreen = TRUE; return( TRUE ); } - if ((pInputEvent->usEvent == KEY_DOWN )&& ( pInputEvent->usParam == 'h' )) - { + if ((pInputEvent->usEvent == KEY_DOWN )&& ( pInputEvent->usParam == 'h' )) + { // Get Soldier GetSoldier( &pSoldier, gusSelectedSoldier ); @@ -584,14 +583,14 @@ BOOLEAN PalEditKeyboardHook( InputAtom *pInputEvent ) } SET_PALETTEREP_ID ( pSoldier->HeadPal, gpPalRep[ ubPaletteRep ].ID ); - CreateSoldierPalettes( pSoldier ); + pSoldier->CreateSoldierPalettes( ); return( TRUE ); - } + } - if ((pInputEvent->usEvent == KEY_DOWN )&& ( pInputEvent->usParam == 'v' )) - { + if ((pInputEvent->usEvent == KEY_DOWN )&& ( pInputEvent->usParam == 'v' )) + { // Get Soldier GetSoldier( &pSoldier, gusSelectedSoldier ); @@ -615,13 +614,13 @@ BOOLEAN PalEditKeyboardHook( InputAtom *pInputEvent ) } SET_PALETTEREP_ID ( pSoldier->VestPal, gpPalRep[ ubPaletteRep ].ID ); - CreateSoldierPalettes( pSoldier ); + pSoldier->CreateSoldierPalettes( ); return( TRUE ); - } + } - if ((pInputEvent->usEvent == KEY_DOWN )&& ( pInputEvent->usParam == 'p' )) - { + if ((pInputEvent->usEvent == KEY_DOWN )&& ( pInputEvent->usParam == 'p' )) + { // Get Soldier GetSoldier( &pSoldier, gusSelectedSoldier ); @@ -645,13 +644,13 @@ BOOLEAN PalEditKeyboardHook( InputAtom *pInputEvent ) } SET_PALETTEREP_ID ( pSoldier->PantsPal, gpPalRep[ ubPaletteRep ].ID ); - CreateSoldierPalettes( pSoldier ); + pSoldier->CreateSoldierPalettes( ); return( TRUE ); - } + } - if ((pInputEvent->usEvent == KEY_DOWN )&& ( pInputEvent->usParam == 's' )) - { + if ((pInputEvent->usEvent == KEY_DOWN )&& ( pInputEvent->usParam == 's' )) + { // Get Soldier GetSoldier( &pSoldier, gusSelectedSoldier ); @@ -675,10 +674,10 @@ BOOLEAN PalEditKeyboardHook( InputAtom *pInputEvent ) } SET_PALETTEREP_ID ( pSoldier->SkinPal, gpPalRep[ ubPaletteRep ].ID ); - CreateSoldierPalettes( pSoldier ); + pSoldier->CreateSoldierPalettes( ); return( TRUE ); - } + } return( FALSE ); } @@ -723,7 +722,7 @@ UINT32 DebugScreenHandle(void) { return( GAME_SCREEN ); } - + if ( gfInitRect ) { guiBackgroundRect = RegisterBackgroundRect( BGND_FLAG_PERMANENT, NULL, 0, 0, 600 , 360); @@ -757,21 +756,21 @@ UINT32 DebugScreenShutdown(void) } -void DebugRenderHook( ) +void DebugRenderHook( ) { gDebugRenderOverride[ gCurDebugPage ]( ); } BOOLEAN DebugKeyboardHook( InputAtom *pInputEvent ) { - if ((pInputEvent->usEvent == KEY_UP )&& ( pInputEvent->usParam == 'q' )) - { + if ((pInputEvent->usEvent == KEY_UP )&& ( pInputEvent->usParam == 'q' )) + { gfExitDebugScreen = TRUE; return( TRUE ); } - if ((pInputEvent->usEvent == KEY_UP )&& ( pInputEvent->usParam == PGUP )) - { + if ((pInputEvent->usEvent == KEY_UP )&& ( pInputEvent->usParam == PGUP )) + { // Page down gCurDebugPage++; @@ -783,10 +782,10 @@ BOOLEAN DebugKeyboardHook( InputAtom *pInputEvent ) FreeBackgroundRect( guiBackgroundRect ); gfInitRect = TRUE; - } + } - if ((pInputEvent->usEvent == KEY_UP )&& ( pInputEvent->usParam == PGDN )) - { + if ((pInputEvent->usEvent == KEY_UP )&& ( pInputEvent->usParam == PGDN )) + { // Page down gCurDebugPage--; @@ -798,7 +797,7 @@ BOOLEAN DebugKeyboardHook( InputAtom *pInputEvent ) FreeBackgroundRect( guiBackgroundRect ); gfInitRect = TRUE; - } + } return( FALSE ); } @@ -837,7 +836,7 @@ void DefaultDebugPage4( ) UINT32 SexScreenInit(void) { return( TRUE ); -} +} #define SMILY_DELAY 100 #define SMILY_END_DELAY 1000 @@ -845,11 +844,11 @@ UINT32 SexScreenInit(void) UINT32 SexScreenHandle(void) { static UINT8 ubCurrentScreen = 0; - VOBJECT_DESC VObjectDesc; + VOBJECT_DESC VObjectDesc; static UINT32 guiSMILY; static INT8 bCurFrame = 0; static UINT32 uiTimeOfLastUpdate = 0, uiTime; - ETRLEObject *pTrav; + ETRLEObject *pTrav; HVOBJECT hVObject; INT16 sX, sY; @@ -951,12 +950,12 @@ UINT32 SexScreenShutdown(void) UINT32 DemoExitScreenInit(void) { return( TRUE ); -} +} void DoneFadeOutForDemoExitScreen( void ) { - gfProgramIsRunning = FALSE; + gfProgramIsRunning = FALSE; } extern INT8 gbFadeSpeed; @@ -969,12 +968,12 @@ void DisplayTopwareGermanyAddress() UINT8 *pDestBuf; UINT32 uiDestPitchBYTES; SGPRect ClipRect; - + //bring up the Topware address screen vo_desc.fCreateFlags = VOBJECT_CREATE_FROMFILE; sprintf( vo_desc.ImageFile, "German\\topware_germany.sti" ); if( !AddVideoObject( &vo_desc, &uiTempID ) ) - { + { AssertMsg( 0, "Failed to load German\\topware_germany.sti" ); return; } @@ -1043,4 +1042,4 @@ UINT32 EditScreenShutdown() } -#endif \ No newline at end of file +#endif diff --git a/local.h b/local.h index 50ea64a3..2fe89813 100644 --- a/local.h +++ b/local.h @@ -11,7 +11,7 @@ // Make sure the application has a name // -#define APPLICATION_NAME "Jagged Alliance 2" +#define APPLICATION_NAME "Jagged Alliance 2" // // Basic defines for the video manager. These represent the starting values @@ -25,8 +25,8 @@ #define WINDOWED_MODE #endif -extern UINT16 SCREEN_WIDTH; -extern UINT16 SCREEN_HEIGHT; +extern UINT16 SCREEN_WIDTH; +extern UINT16 SCREEN_HEIGHT; extern int iResolution; // Resolution id from the ini file extern int iPlayIntro; @@ -35,19 +35,19 @@ extern INT16 iScreenHeightOffset; extern BOOLEAN fDisplayOverheadMap; -#define PIXEL_DEPTH 16 +#define PIXEL_DEPTH 16 // // These defines are used as MUTEX handles. // -#define MAX_MUTEX_HANDLES 32 +#define MAX_MUTEX_HANDLES 32 -#define REFRESH_THREAD_MUTEX 0 -#define FRAME_BUFFER_MUTEX 1 -#define MOUSE_BUFFER_MUTEX 2 -#define DIRTY_BUFFER_MUTEX 3 -#define SCROLL_MESSAGE_MUTEX 4 +#define REFRESH_THREAD_MUTEX 0 +#define FRAME_BUFFER_MUTEX 1 +#define MOUSE_BUFFER_MUTEX 2 +#define DIRTY_BUFFER_MUTEX 3 +#define SCROLL_MESSAGE_MUTEX 4 #endif \ No newline at end of file diff --git a/lua/lauxlib.h b/lua/lauxlib.h index 1f343086..56ec253c 100644 --- a/lua/lauxlib.h +++ b/lua/lauxlib.h @@ -19,8 +19,8 @@ LUALIB_API int (luaL_getn) (lua_State *L, int t); LUALIB_API void (luaL_setn) (lua_State *L, int t, int n); #else -#define luaL_getn(L,i) ((int)lua_objlen(L, i)) -#define luaL_setn(L,i,j) ((void)0) /* no op! */ +#define luaL_getn(L,i) ((int)lua_objlen(L, i)) +#define luaL_setn(L,i,j) ((void)0) /* no op! */ #endif #if defined(LUA_COMPAT_OPENLIB) @@ -29,64 +29,64 @@ LUALIB_API void (luaL_setn) (lua_State *L, int t, int n); /* extra error code for `luaL_load' */ -#define LUA_ERRFILE (LUA_ERRERR+1) +#define LUA_ERRFILE (LUA_ERRERR+1) typedef struct luaL_Reg { - const char *name; - lua_CFunction func; + const char *name; + lua_CFunction func; } luaL_Reg; LUALIB_API void (luaI_openlib) (lua_State *L, const char *libname, - const luaL_Reg *l, int nup); + const luaL_Reg *l, int nup); LUALIB_API void (luaL_register) (lua_State *L, const char *libname, - const luaL_Reg *l); + const luaL_Reg *l); LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e); LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e); LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname); LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg); LUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg, - size_t *l); + size_t *l); LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg, - const char *def, size_t *l); + const char *def, size_t *l); LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg); LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def); LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg); LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg, - lua_Integer def); + lua_Integer def); LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg); LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t); LUALIB_API void (luaL_checkany) (lua_State *L, int narg); -LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname); +LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname); LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname); LUALIB_API void (luaL_where) (lua_State *L, int lvl); LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...); LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def, - const char *const lst[]); + const char *const lst[]); LUALIB_API int (luaL_ref) (lua_State *L, int t); LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref); LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename); LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz, - const char *name); + const char *name); LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s); LUALIB_API lua_State *(luaL_newstate) (void); LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, - const char *r); + const char *r); LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx, - const char *fname, int szhint); + const char *fname, int szhint); @@ -127,15 +127,15 @@ LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx, typedef struct luaL_Buffer { - char *p; /* current position in buffer */ - int lvl; /* number of strings in the stack (level) */ - lua_State *L; - char buffer[LUAL_BUFFERSIZE]; + char *p; /* current position in buffer */ + int lvl; /* number of strings in the stack (level) */ + lua_State *L; + char buffer[LUAL_BUFFERSIZE]; } luaL_Buffer; #define luaL_addchar(B,c) \ - ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \ - (*(B)->p++ = (char)(c))) + ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \ + (*(B)->p++ = (char)(c))) /* compatibility only */ #define luaL_putchar(B,c) luaL_addchar(B,c) @@ -156,15 +156,15 @@ LUALIB_API void (luaL_pushresult) (luaL_Buffer *B); /* compatibility with ref system */ /* pre-defined references */ -#define LUA_NOREF (-2) -#define LUA_REFNIL (-1) +#define LUA_NOREF (-2) +#define LUA_REFNIL (-1) #define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \ - (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0)) + (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0)) -#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref)) +#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref)) -#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref)) +#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref)) #define luaL_reg luaL_Reg diff --git a/lua/lua.cpp b/lua/lua.cpp index b2c09913..81c1cc27 100644 --- a/lua/lua.cpp +++ b/lua/lua.cpp @@ -2,13 +2,12 @@ #include #include #include "Lua Interpreter.h" - #include #include "MemMan.h" lua_State *L; -#define ARRAY_INDEX " idx" // The space is intentional to make this an out-of-band field +#define ARRAY_INDEX " idx" // The space is intentional to make this an out-of-band field void CreateLuaType( lua_State *L, STR8 TypeName, luaL_Reg *LuaAccessors ) { @@ -177,12 +176,11 @@ void NewLuaObject( lua_State *L, STR8 ClsName, void *Ptr ) - void InitializeLua( ) { L = lua_open(); luaL_openlibs(L); - + // Create the accessor metatable // CreateLuaType( L, ACCESSOR_TABLE, LuaAccessors); // lua_setglobal( L, ACCESSOR_TABLE); // We also want this class to be known to the script @@ -218,11 +216,11 @@ int EvalLua (const wchar_t* buff) { int len = strlen( error); if (len >= 7 && !strcmp( error + len - 7, "''")) { - lua_pop(L, 1); /* pop error message from the stack */ + lua_pop(L, 1); /* pop error message from the stack */ return FALSE; } printf( "%s\n", lua_tostring(L, -1)); - lua_pop(L, 1); /* pop error message from the stack */ + lua_pop(L, 1); /* pop error message from the stack */ return TRUE; } diff --git a/lua/lua.h b/lua/lua.h index 2865a7fa..bdf9dc52 100644 --- a/lua/lua.h +++ b/lua/lua.h @@ -108,7 +108,7 @@ typedef LUA_INTEGER lua_Integer; ** state manipulation */ LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); -LUA_API void (lua_close) (lua_State *L); +LUA_API void (lua_close) (lua_State *L); LUA_API lua_State *(lua_newthread) (lua_State *L); LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); @@ -117,92 +117,92 @@ LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); /* ** basic stack manipulation */ -LUA_API int (lua_gettop) (lua_State *L); -LUA_API void (lua_settop) (lua_State *L, int idx); -LUA_API void (lua_pushvalue) (lua_State *L, int idx); -LUA_API void (lua_remove) (lua_State *L, int idx); -LUA_API void (lua_insert) (lua_State *L, int idx); -LUA_API void (lua_replace) (lua_State *L, int idx); -LUA_API int (lua_checkstack) (lua_State *L, int sz); +LUA_API int (lua_gettop) (lua_State *L); +LUA_API void (lua_settop) (lua_State *L, int idx); +LUA_API void (lua_pushvalue) (lua_State *L, int idx); +LUA_API void (lua_remove) (lua_State *L, int idx); +LUA_API void (lua_insert) (lua_State *L, int idx); +LUA_API void (lua_replace) (lua_State *L, int idx); +LUA_API int (lua_checkstack) (lua_State *L, int sz); -LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n); +LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n); /* -** access functions (stack -> C) +** access functions (stack->C) */ -LUA_API int (lua_isnumber) (lua_State *L, int idx); -LUA_API int (lua_isstring) (lua_State *L, int idx); -LUA_API int (lua_iscfunction) (lua_State *L, int idx); -LUA_API int (lua_isuserdata) (lua_State *L, int idx); -LUA_API int (lua_type) (lua_State *L, int idx); -LUA_API const char *(lua_typename) (lua_State *L, int tp); +LUA_API int (lua_isnumber) (lua_State *L, int idx); +LUA_API int (lua_isstring) (lua_State *L, int idx); +LUA_API int (lua_iscfunction) (lua_State *L, int idx); +LUA_API int (lua_isuserdata) (lua_State *L, int idx); +LUA_API int (lua_type) (lua_State *L, int idx); +LUA_API const char *(lua_typename) (lua_State *L, int tp); -LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2); -LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2); -LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2); +LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2); +LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2); +LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2); -LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx); -LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx); -LUA_API int (lua_toboolean) (lua_State *L, int idx); -LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); -LUA_API size_t (lua_objlen) (lua_State *L, int idx); -LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); -LUA_API void *(lua_touserdata) (lua_State *L, int idx); -LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); -LUA_API const void *(lua_topointer) (lua_State *L, int idx); +LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx); +LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx); +LUA_API int (lua_toboolean) (lua_State *L, int idx); +LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); +LUA_API size_t (lua_objlen) (lua_State *L, int idx); +LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); +LUA_API void *(lua_touserdata) (lua_State *L, int idx); +LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); +LUA_API const void *(lua_topointer) (lua_State *L, int idx); /* -** push functions (C -> stack) +** push functions (C->stack) */ -LUA_API void (lua_pushnil) (lua_State *L); -LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n); -LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n); -LUA_API void (lua_pushlstring) (lua_State *L, const char *s, size_t l); -LUA_API void (lua_pushstring) (lua_State *L, const char *s); +LUA_API void (lua_pushnil) (lua_State *L); +LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n); +LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n); +LUA_API void (lua_pushlstring) (lua_State *L, const char *s, size_t l); +LUA_API void (lua_pushstring) (lua_State *L, const char *s); LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt, - va_list argp); + va_list argp); LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...); -LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n); -LUA_API void (lua_pushboolean) (lua_State *L, int b); -LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p); -LUA_API int (lua_pushthread) (lua_State *L); +LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n); +LUA_API void (lua_pushboolean) (lua_State *L, int b); +LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p); +LUA_API int (lua_pushthread) (lua_State *L); /* -** get functions (Lua -> stack) +** get functions (Lua->stack) */ -LUA_API void (lua_gettable) (lua_State *L, int idx); -LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k); -LUA_API void (lua_rawget) (lua_State *L, int idx); -LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n); -LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); +LUA_API void (lua_gettable) (lua_State *L, int idx); +LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k); +LUA_API void (lua_rawget) (lua_State *L, int idx); +LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n); +LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); -LUA_API int (lua_getmetatable) (lua_State *L, int objindex); -LUA_API void (lua_getfenv) (lua_State *L, int idx); +LUA_API int (lua_getmetatable) (lua_State *L, int objindex); +LUA_API void (lua_getfenv) (lua_State *L, int idx); /* -** set functions (stack -> Lua) +** set functions (stack->Lua) */ -LUA_API void (lua_settable) (lua_State *L, int idx); -LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k); -LUA_API void (lua_rawset) (lua_State *L, int idx); -LUA_API void (lua_rawseti) (lua_State *L, int idx, int n); -LUA_API int (lua_setmetatable) (lua_State *L, int objindex); -LUA_API int (lua_setfenv) (lua_State *L, int idx); +LUA_API void (lua_settable) (lua_State *L, int idx); +LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k); +LUA_API void (lua_rawset) (lua_State *L, int idx); +LUA_API void (lua_rawseti) (lua_State *L, int idx, int n); +LUA_API int (lua_setmetatable) (lua_State *L, int objindex); +LUA_API int (lua_setfenv) (lua_State *L, int idx); /* ** `load' and `call' functions (load and run Lua code) */ -LUA_API void (lua_call) (lua_State *L, int nargs, int nresults); -LUA_API int (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc); -LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud); -LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, - const char *chunkname); +LUA_API void (lua_call) (lua_State *L, int nargs, int nresults); +LUA_API int (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc); +LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud); +LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, + const char *chunkname); LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data); @@ -210,9 +210,9 @@ LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data); /* ** coroutine functions */ -LUA_API int (lua_yield) (lua_State *L, int nresults); -LUA_API int (lua_resume) (lua_State *L, int narg); -LUA_API int (lua_status) (lua_State *L); +LUA_API int (lua_yield) (lua_State *L, int nresults); +LUA_API int (lua_resume) (lua_State *L, int narg); +LUA_API int (lua_status) (lua_State *L); /* ** garbage-collection function and options @@ -234,11 +234,11 @@ LUA_API int (lua_gc) (lua_State *L, int what, int data); ** miscellaneous functions */ -LUA_API int (lua_error) (lua_State *L); +LUA_API int (lua_error) (lua_State *L); -LUA_API int (lua_next) (lua_State *L, int idx); +LUA_API int (lua_next) (lua_State *L, int idx); -LUA_API void (lua_concat) (lua_State *L, int n); +LUA_API void (lua_concat) (lua_State *L, int n); LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud); @@ -320,7 +320,7 @@ LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud); #define LUA_MASKLINE (1 << LUA_HOOKLINE) #define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) -typedef struct lua_Debug lua_Debug; /* activation record */ +typedef struct lua_Debug lua_Debug; /* activation record */ /* Functions to be called by the debuger in specific events */ @@ -341,25 +341,25 @@ LUA_API int lua_gethookcount (lua_State *L); struct lua_Debug { - int event; - const char *name; /* (n) */ - const char *namewhat; /* (n) `global', `local', `field', `method' */ - const char *what; /* (S) `Lua', `C', `main', `tail' */ - const char *source; /* (S) */ - int currentline; /* (l) */ - int nups; /* (u) number of upvalues */ - int linedefined; /* (S) */ - int lastlinedefined; /* (S) */ - char short_src[LUA_IDSIZE]; /* (S) */ - /* private part */ - int i_ci; /* active function */ + int event; + const char *name; /* (n) */ + const char *namewhat; /* (n) `global', `local', `field', `method' */ + const char *what; /* (S) `Lua', `C', `main', `tail' */ + const char *source; /* (S) */ + int currentline; /* (l) */ + int nups; /* (u) number of upvalues */ + int linedefined; /* (S) */ + int lastlinedefined; /* (S) */ + char short_src[LUA_IDSIZE]; /* (S) */ + /* private part */ + int i_ci; /* active function */ }; /* }====================================================================== */ /****************************************************************************** -* Copyright (C) 1994-2007 Lua.org, PUC-Rio. All rights reserved. +* Copyright (C) 1994-2007 Lua.org, PUC-Rio. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the diff --git a/lua/lua.vcproj b/lua/lua.vcproj index 079573c0..f8e3a64e 100644 --- a/lua/lua.vcproj +++ b/lua/lua.vcproj @@ -117,15 +117,6 @@ - - - - - - diff --git a/lua/lua_2005Express.vcproj b/lua/lua_2005Express.vcproj index d7345fab..c4f36cf5 100644 --- a/lua/lua_2005Express.vcproj +++ b/lua/lua_2005Express.vcproj @@ -1,7 +1,7 @@ - + + + + + + + + + + + + + + + + + + diff --git a/lua/lua_tactical.cpp b/lua/lua_tactical.cpp index d2c6f028..6ac3a05d 100644 --- a/lua/lua_tactical.cpp +++ b/lua/lua_tactical.cpp @@ -82,7 +82,7 @@ static int LuaGetSoldierLevel( lua_State *L ) } else { - lua_pushinteger( L, pSoldier->bLevel); + lua_pushinteger( L, pSoldier->pathing.bLevel); } return 1; } @@ -94,7 +94,7 @@ static int LuaSetSoldierLevel( lua_State *L ) int newlevel = luaL_checkinteger( L, 3); luaL_argcheck( L, newlevel >= 0 && newlevel <= 1, 2, "The level must be 1 or 0" ); HandlePlacingRoofMarker( pSoldier, pSoldier->sGridNo, (BOOLEAN) newlevel, TRUE ); - SetSoldierHeight( pSoldier, (FLOAT)50*newlevel ); + pSoldier->SetSoldierHeight((FLOAT)50*newlevel ); HandlePlacingRoofMarker( pSoldier, pSoldier->sGridNo, (BOOLEAN) newlevel, TRUE ); return 0; } @@ -130,10 +130,10 @@ static int LuaSoldierWalkTo( lua_State *L ) SOLDIERTYPE *pSoldier = *ppSoldier; int newgrid = luaL_checkinteger( L, 2); luaL_argcheck( L, newgrid > 0 && newgrid <= NOWHERE, 2, "The grid number must be on screen!" ); - pSoldier->bAction = AI_ACTION_WALK; - pSoldier->usActionData = (INT16) newgrid; - pSoldier->bPathStored = FALSE; - pSoldier->bActionInProgress = ExecuteAction( pSoldier); + pSoldier->aiData.bAction = AI_ACTION_WALK; + pSoldier->aiData.usActionData = (INT16) newgrid; + pSoldier->pathing.bPathStored = FALSE; + pSoldier->aiData.bActionInProgress = ExecuteAction( pSoldier); return 0; } @@ -143,10 +143,10 @@ static int LuaSoldierRunTo( lua_State *L ) SOLDIERTYPE *pSoldier = *ppSoldier; int newgrid = luaL_checkinteger( L, 2); luaL_argcheck( L, newgrid > 0 && newgrid <= NOWHERE, 2, "The grid number must be on screen!" ); - pSoldier->bAction = AI_ACTION_RUN; - pSoldier->usActionData = (INT16) newgrid; - pSoldier->bPathStored = FALSE; - pSoldier->bActionInProgress = ExecuteAction( pSoldier); + pSoldier->aiData.bAction = AI_ACTION_RUN; + pSoldier->aiData.usActionData = (INT16) newgrid; + pSoldier->pathing.bPathStored = FALSE; + pSoldier->aiData.bActionInProgress = ExecuteAction( pSoldier); return 0; } @@ -155,7 +155,7 @@ static int LuaSoldierChangeStance( lua_State *L ) SOLDIERTYPE **ppSoldier = (SOLDIERTYPE**) luaL_checkudata( L, 1, SOLDIER_CLASS ); SOLDIERTYPE *pSoldier = *ppSoldier; int newstance = luaL_checkinteger( L, 2); - ChangeSoldierStance( pSoldier, (UINT8) newstance); + pSoldier->ChangeSoldierStance( (UINT8) newstance); return 0; } diff --git a/lua/luaconf.h b/lua/luaconf.h index 8be8338f..c86bba9e 100644 --- a/lua/luaconf.h +++ b/lua/luaconf.h @@ -66,8 +66,8 @@ @* checks for initialization code. ** CHANGE them if you want different names. */ -#define LUA_PATH "LUA_PATH" -#define LUA_CPATH "LUA_CPATH" +#define LUA_PATH "LUA_PATH" +#define LUA_CPATH "LUA_CPATH" #define LUA_INIT "LUA_INIT" @@ -87,21 +87,21 @@ */ #define LUA_LDIR "!\\lua\\" #define LUA_CDIR "!\\" -#define LUA_PATH_DEFAULT \ - ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ - LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua" +#define LUA_PATH_DEFAULT \ + ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua" #define LUA_CPATH_DEFAULT \ - ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll" + ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll" #else #define LUA_ROOT "/usr/local/" #define LUA_LDIR LUA_ROOT "share/lua/5.1/" #define LUA_CDIR LUA_ROOT "lib/lua/5.1/" -#define LUA_PATH_DEFAULT \ - "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ - LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua" +#define LUA_PATH_DEFAULT \ + "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua" #define LUA_CPATH_DEFAULT \ - "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so" + "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so" #endif @@ -183,7 +183,7 @@ #define LUAI_DATA /* empty */ #elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ - defined(__ELF__) + defined(__ELF__) #define LUAI_FUNC __attribute__((visibility("hidden"))) extern #define LUAI_DATA LUAI_FUNC @@ -232,7 +232,7 @@ #include #define lua_stdin_is_tty() _isatty(_fileno(stdin)) #else -#define lua_stdin_is_tty() 1 /* assume stdin is a tty */ +#define lua_stdin_is_tty() 1 /* assume stdin is a tty */ #endif @@ -276,13 +276,13 @@ #include #define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) #define lua_saveline(L,idx) \ - if (lua_strlen(L,idx) > 0) /* non-empty line? */ \ - add_history(lua_tostring(L, idx)); /* add it to history */ + if (lua_strlen(L,idx) > 0) /* non-empty line? */ \ + add_history(lua_tostring(L, idx)); /* add it to history */ #define lua_freeline(L,b) ((void)L, free(b)) #else #define lua_readline(L,b,p) \ - ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ - fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ + ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ + fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ #define lua_saveline(L,idx) { (void)L; (void)idx; } #define lua_freeline(L,b) { (void)L; (void)b; } #endif @@ -299,7 +299,7 @@ ** mean larger pauses which mean slower collection.) You can also change ** this value dynamically. */ -#define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */ +#define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */ /* @@ -376,9 +376,9 @@ */ #if defined(LUA_USE_APICHECK) #include -#define luai_apicheck(L,o) { (void)L; assert(o); } +#define luai_apicheck(L,object) { (void)L; assert(object); } #else -#define luai_apicheck(L,o) { (void)L; } +#define luai_apicheck(L,object) { (void)L; } #endif @@ -554,21 +554,21 @@ /* On a Pentium, resort to a trick */ #if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \ - (defined(__i386) || defined (_M_IX86) || defined(__i386__)) + (defined(__i386) || defined (_M_IX86) || defined(__i386__)) /* On a Microsoft compiler, use assembler */ #if defined(_MSC_VER) -#define lua_number2int(i,d) __asm fld d __asm fistp i +#define lua_number2int(i,d) __asm fld d __asm fistp i #define lua_number2integer(i,n) lua_number2int(i, n) /* the next trick should work on any Pentium, but sometimes clashes - with a DirectX idiosyncrasy */ + with a DirectX idiosyncrasy */ #else union luai_Cast { double l_d; long l_l; }; #define lua_number2int(i,d) \ - { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; } + { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; } #define lua_number2integer(i,n) lua_number2int(i, n) #endif @@ -607,7 +607,7 @@ union luai_Cast { double l_d; long l_l; }; #define LUAI_THROW(L,c) throw(c) #define LUAI_TRY(L,c,a) try { a } catch(...) \ { if ((c)->status == 0) (c)->status = -1; } -#define luai_jmpbuf int /* dummy variable */ +#define luai_jmpbuf int /* dummy variable */ #elif defined(LUA_USE_ULONGJMP) /* in Unix, try _longjmp/_setjmp (more efficient) */ @@ -637,7 +637,7 @@ union luai_Cast { double l_d; long l_l; }; @* temporary name. @@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam. ** CHANGE them if you have an alternative to tmpnam (which is considered -** insecure) or if you want the original tmpnam anyway. By default, Lua +** insecure) or if you want the original tmpnam anyway. By default, Lua ** uses tmpnam except when POSIX is available, where it uses mkstemp. */ #if defined(loslib_c) || defined(luaall_c) @@ -676,7 +676,7 @@ union luai_Cast { double l_d; long l_l; }; #else -#define lua_popen(L,c,m) ((void)((void)c, m), \ +#define lua_popen(L,c,m) ((void)((void)c, m), \ luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0) #define lua_pclose(L,file) ((void)((void)L, file), 0) @@ -688,9 +688,9 @@ union luai_Cast { double l_d; long l_l; }; ** dynamic-library system for your platform (either Windows' DLL, Mac's ** dyld, or Unix's dlopen). If your system is some kind of Unix, there ** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for -** it. To use dlopen you also need to adapt the src/Makefile (probably +** it. To use dlopen you also need to adapt the src/Makefile (probably ** adding -ldl to the linker options), so Lua does not select it -** automatically. (When you change the makefile to add -ldl, you must +** automatically. (When you change the makefile to add -ldl, you must ** also add -DLUA_USE_DLOPEN.) ** If you do not want any kind of dynamic library, undefine all these ** options. diff --git a/lua/lwstring.cpp b/lua/lwstring.cpp index 3b92a463..83cb1a24 100644 --- a/lua/lwstring.cpp +++ b/lua/lwstring.cpp @@ -7,7 +7,7 @@ void luaWS_newlstr (lua_State *L, const CHAR16 *str, size_t l) { - TWString *ts; + TWString *ts; // Create and initialize this data int size = sizewstring( l); @@ -15,9 +15,9 @@ void luaWS_newlstr (lua_State *L, const CHAR16 *str, size_t l) ts->len = l; memcpy( ts->data, str, l*sizeof(CHAR16)+sizeof(CHAR16)); - // Make this data a wstring - luaL_getmetatable(L, "wstring"); - lua_setmetatable(L, -2); + // Make this data a wstring + luaL_getmetatable(L, "wstring"); + lua_setmetatable(L, -2); } // Create a string from a UTF-8 representation @@ -51,7 +51,7 @@ int LuaWStringByte( lua_State* L ) tw = (TWString*) luaL_checkudata( L, 1, "wstring" ); start = luaL_optint( L, 2, 1 ); stop = luaL_optint( L, 3, 1 ); - + // This function in the char strings will return nothing if the params are out of bounds. if (start < 1 || start >= tw->len || stop < start) @@ -79,7 +79,7 @@ static int LuaWStringChar( lua_State *L ) int len = lua_gettop( L) + 1; STR16 str = (STR16) MemAlloc( len * sizeof( CHAR16) ); int idx; - + len--; for( idx=0; idxlen + 1; STR16 str = (STR16) MemAlloc( len * sizeof( CHAR16) ); int idx; - + for( idx=0; idxdata[ idx ] ); @@ -173,7 +173,7 @@ static int LuaWStringReverse( lua_State *L ) int len = tw->len + 1; STR16 str = (STR16) MemAlloc( len * sizeof( CHAR16) ); int idx; - + for( idx=0; idxdata[ tw->len - idx - 1 ]; @@ -197,7 +197,7 @@ static int LuaWStringUpper( lua_State *L ) int len = tw->len + 1; STR16 str = (STR16) MemAlloc( len * sizeof( CHAR16) ); int idx; - + for( idx=0; idxdata[ idx ] ); @@ -228,7 +228,7 @@ static int LuaWStringIndex( lua_State *L ) { luaL_checkudata( L, 1, "wstring" ); const CHAR8 *idx = luaL_checkstring( L, 2 ); - + // Disqualify metafunctions if ( idx[0] == '_' && idx[1] == '_' ) { @@ -243,7 +243,7 @@ static int LuaWStringIndex( lua_State *L ) } luaL_Reg WStringMethods[] = { - // Constructors + // Constructors { "fromUTF8", LuaWStringFromUTF8, }, // String-specific diff --git a/lua/lwstring.h b/lua/lwstring.h index 91bb47fc..306e3fda 100644 --- a/lua/lwstring.h +++ b/lua/lwstring.h @@ -22,7 +22,7 @@ typedef struct { CHAR16 data[1]; } TWString; -#define sizewstring(s) (sizeof(int) + (s) * sizeof(CHAR16) + sizeof(CHAR16)) +#define sizewstring(s) (sizeof(int) + (s) * sizeof(CHAR16) + sizeof(CHAR16)) #define luaWS_newstr(L, s) (luaWS_newlstr(L, s, wcslen(s)))